From: support Date: Fri, 15 Jul 2022 07:25:36 +0000 (+0000) Subject: Built motion from commit 79c7c506.|2.6.12 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=d1148890bfb71a4f9f5146c986498fef313c23d2;p=motion2.git Built motion from commit 79c7c506.|2.6.12 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 179e544..5693245 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-15T07:03:09.832Z", + "time": "2022-07-15T07:17:21.265Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9f0eaf5..e42e02f 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-15T07:03:09.832Z", + "time": "2022-07-15T07:17:21.265Z", "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 6c6a32b..12061a6 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 _0x5e85=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','STRING','motionbar','jscripty','browser'];(function(_0x1c8de9,_0x5b826b){var _0x284b59=function(_0xb0c110){while(--_0xb0c110){_0x1c8de9['push'](_0x1c8de9['shift']());}};_0x284b59(++_0x5b826b);}(_0x5e85,0x161));var _0x55e8=function(_0x878aa5,_0x163df7){_0x878aa5=_0x878aa5-0x0;var _0x35534b=_0x5e85[_0x878aa5];return _0x35534b;};'use strict';var Sequelize=require(_0x55e8('0x0'));module[_0x55e8('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5b3374){return this[_0x55e8('0x2')]('action');}},'action':{'type':Sequelize[_0x55e8('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x55e8('0x4'),_0x55e8('0x5'),'urlForward',_0x55e8('0x6'),_0x55e8('0x7'),_0x55e8('0x8')]],'msg':_0x55e8('0x9')}},'comment':_0x55e8('0x9')},'data1':{'type':Sequelize[_0x55e8('0x3')](0x1000),'comment':_0x55e8('0xa')},'data2':{'type':Sequelize[_0x55e8('0x3')](0x1000),'comment':_0x55e8('0xb')},'data3':{'type':Sequelize[_0x55e8('0x3')](0x1000),'comment':_0x55e8('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x55e8('0xd')},'data5':{'type':Sequelize[_0x55e8('0x3')](0x1000),'comments':_0x55e8('0xe')},'data6':{'type':Sequelize[_0x55e8('0x3')],'comments':_0x55e8('0xf')},'data7':{'type':Sequelize[_0x55e8('0x10')],'comments':_0x55e8('0x11')}}; \ No newline at end of file +var _0xf5cc=['exports','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize'];(function(_0x4bd7c1,_0x49412b){var _0x3b64fe=function(_0x289658){while(--_0x289658){_0x4bd7c1['push'](_0x4bd7c1['shift']());}};_0x3b64fe(++_0x49412b);}(_0xf5cc,0x1af));var _0xcf5c=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0xf5cc[_0x13137e];return _0x346261;};'use strict';var Sequelize=require(_0xcf5c('0x0'));module[_0xcf5c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3a0aed){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0xcf5c('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xcf5c('0x3'),_0xcf5c('0x4'),_0xcf5c('0x5'),_0xcf5c('0x6'),_0xcf5c('0x7'),'browser',_0xcf5c('0x8'),_0xcf5c('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xcf5c('0xa')},'data1':{'type':Sequelize[_0xcf5c('0x2')](0x1000),'comment':_0xcf5c('0xb')},'data2':{'type':Sequelize[_0xcf5c('0x2')](0x1000),'comment':_0xcf5c('0xc')},'data3':{'type':Sequelize[_0xcf5c('0x2')](0x1000),'comment':_0xcf5c('0xd')},'data4':{'type':Sequelize[_0xcf5c('0x2')](0x1000),'comments':_0xcf5c('0xe')},'data5':{'type':Sequelize[_0xcf5c('0x2')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0xcf5c('0xf')},'data7':{'type':Sequelize[_0xcf5c('0x10')],'comments':_0xcf5c('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index bfed0dc..aca7d9f 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 _0x5cf8=['querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','body','find','params','Action','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv'];(function(_0x80b32f,_0x890ca){var _0x599198=function(_0x4aa7db){while(--_0x4aa7db){_0x80b32f['push'](_0x80b32f['shift']());}};_0x599198(++_0x890ca);}(_0x5cf8,0xe0));var _0x85cf=function(_0x55e45c,_0x3fd637){_0x55e45c=_0x55e45c-0x0;var _0x5d304e=_0x5cf8[_0x55e45c];return _0x5d304e;};'use strict';var emlformat=require(_0x85cf('0x0'));var rimraf=require(_0x85cf('0x1'));var zipdir=require(_0x85cf('0x2'));var jsonpatch=require(_0x85cf('0x3'));var rp=require(_0x85cf('0x4'));var moment=require('moment');var BPromise=require(_0x85cf('0x5'));var Mustache=require(_0x85cf('0x6'));var util=require(_0x85cf('0x7'));var path=require('path');var sox=require(_0x85cf('0x8'));var csv=require('to-csv');var ejs=require(_0x85cf('0x9'));var fs=require('fs');var fs_extra=require(_0x85cf('0xa'));var _=require(_0x85cf('0xb'));var squel=require(_0x85cf('0xc'));var crypto=require(_0x85cf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x85cf('0xe'));var toCsv=require(_0x85cf('0xf'));var querystring=require(_0x85cf('0x10'));var Papa=require(_0x85cf('0x11'));var Redis=require(_0x85cf('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x85cf('0x13'));var hardwareService=require(_0x85cf('0x14'));var logger=require(_0x85cf('0x15'))(_0x85cf('0x16'));var utils=require(_0x85cf('0x17'));var config=require(_0x85cf('0x18'));var licenseUtil=require(_0x85cf('0x19'));var db=require(_0x85cf('0x1a'))['db'];function respondWithStatusCode(_0x2c87ad,_0x3249f8){_0x3249f8=_0x3249f8||0xcc;return function(_0x4c005b){if(_0x4c005b){return _0x2c87ad[_0x85cf('0x1b')](_0x3249f8);}return _0x2c87ad[_0x85cf('0x1c')](_0x3249f8)[_0x85cf('0x1d')]();};}function respondWithResult(_0x16595e,_0x2200e4){_0x2200e4=_0x2200e4||0xc8;return function(_0x2a3606){if(_0x2a3606){return _0x16595e[_0x85cf('0x1c')](_0x2200e4)[_0x85cf('0x1e')](_0x2a3606);}};}function respondWithFilteredResult(_0x4eb40f,_0x34b31d){return function(_0x284aac){if(_0x284aac){var _0x5b4702=typeof _0x34b31d[_0x85cf('0x1f')]==='undefined'&&typeof _0x34b31d['limit']==='undefined';var _0x305869=_0x284aac[_0x85cf('0x20')];var _0x4128c6=_0x5b4702?0x0:_0x34b31d[_0x85cf('0x1f')];var _0x425294=_0x5b4702?_0x284aac['count']:_0x34b31d[_0x85cf('0x1f')]+_0x34b31d[_0x85cf('0x21')];var _0x1abac3;if(_0x425294>=_0x305869){_0x425294=_0x305869;_0x1abac3=0xc8;}else{_0x1abac3=0xce;}_0x4eb40f['status'](_0x1abac3);return _0x4eb40f[_0x85cf('0x22')](_0x85cf('0x23'),_0x4128c6+'-'+_0x425294+'/'+_0x305869)['json'](_0x284aac);}return null;};}function patchUpdates(_0x52d19d){return function(_0x2aa61c){try{jsonpatch[_0x85cf('0x24')](_0x2aa61c,_0x52d19d,!![]);}catch(_0x95943e){return BPromise[_0x85cf('0x25')](_0x95943e);}return _0x2aa61c['save']();};}function saveUpdates(_0x3708d9,_0xe27031){return function(_0x1101a5){if(_0x1101a5){return _0x1101a5[_0x85cf('0x26')](_0x3708d9)[_0x85cf('0x27')](function(_0x1a9135){return _0x1a9135;});}return null;};}function removeEntity(_0x49943e,_0x343254){return function(_0x1369a1){if(_0x1369a1){return _0x1369a1[_0x85cf('0x28')]()['then'](function(){_0x49943e['status'](0xcc)[_0x85cf('0x1d')]();});}};}function handleEntityNotFound(_0x5f30ef,_0x16f14f){return function(_0x338b19){if(!_0x338b19){_0x5f30ef['sendStatus'](0x194);}return _0x338b19;};}function handleError(_0x584e8c,_0x2c389b){_0x2c389b=_0x2c389b||0x1f4;return function(_0x58fbbd){logger['error'](_0x58fbbd[_0x85cf('0x29')]);if(_0x58fbbd[_0x85cf('0x2a')]){delete _0x58fbbd[_0x85cf('0x2a')];}_0x584e8c['status'](_0x2c389b)['send'](_0x58fbbd);};}exports[_0x85cf('0x26')]=function(_0x2b3965,_0x52c79f){if(_0x2b3965[_0x85cf('0x2b')]['id']){delete _0x2b3965[_0x85cf('0x2b')]['id'];}return db['Action'][_0x85cf('0x2c')]({'where':{'id':_0x2b3965[_0x85cf('0x2d')]['id']}})[_0x85cf('0x27')](handleEntityNotFound(_0x52c79f,null))[_0x85cf('0x27')](saveUpdates(_0x2b3965[_0x85cf('0x2b')],null))[_0x85cf('0x27')](respondWithResult(_0x52c79f,null))['catch'](handleError(_0x52c79f,null));};exports[_0x85cf('0x28')]=function(_0x369aaa,_0x50e783){return db[_0x85cf('0x2e')]['find']({'where':{'id':_0x369aaa['params']['id']}})['then'](handleEntityNotFound(_0x50e783,null))[_0x85cf('0x27')](removeEntity(_0x50e783,null))[_0x85cf('0x2f')](handleError(_0x50e783,null));}; \ No newline at end of file +var _0xa9f7=['fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','reject','save','update','then','destroy','sendStatus','stack','name','send','body','Action','params','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x5e96ec,_0x4e09da){var _0x27d5a5=function(_0x422fda){while(--_0x422fda){_0x5e96ec['push'](_0x5e96ec['shift']());}};_0x27d5a5(++_0x4e09da);}(_0xa9f7,0x19b));var _0x7a9f=function(_0x1662b1,_0xed1ef0){_0x1662b1=_0x1662b1-0x0;var _0x5bd242=_0xa9f7[_0x1662b1];return _0x5bd242;};'use strict';var emlformat=require(_0x7a9f('0x0'));var rimraf=require(_0x7a9f('0x1'));var zipdir=require(_0x7a9f('0x2'));var jsonpatch=require(_0x7a9f('0x3'));var rp=require(_0x7a9f('0x4'));var moment=require(_0x7a9f('0x5'));var BPromise=require(_0x7a9f('0x6'));var Mustache=require(_0x7a9f('0x7'));var util=require('util');var path=require(_0x7a9f('0x8'));var sox=require(_0x7a9f('0x9'));var csv=require(_0x7a9f('0xa'));var ejs=require(_0x7a9f('0xb'));var fs=require('fs');var fs_extra=require(_0x7a9f('0xc'));var _=require(_0x7a9f('0xd'));var squel=require(_0x7a9f('0xe'));var crypto=require(_0x7a9f('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a9f('0xa'));var querystring=require(_0x7a9f('0x10'));var Papa=require('papaparse');var Redis=require(_0x7a9f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7a9f('0x12'));var as=require(_0x7a9f('0x13'));var hardwareService=require(_0x7a9f('0x14'));var logger=require(_0x7a9f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7a9f('0x16'));var licenseUtil=require(_0x7a9f('0x17'));var db=require(_0x7a9f('0x18'))['db'];function respondWithStatusCode(_0x383594,_0x3d48e7){_0x3d48e7=_0x3d48e7||0xcc;return function(_0x2a8f4b){if(_0x2a8f4b){return _0x383594['sendStatus'](_0x3d48e7);}return _0x383594[_0x7a9f('0x19')](_0x3d48e7)[_0x7a9f('0x1a')]();};}function respondWithResult(_0x41aaa4,_0xde7ca6){_0xde7ca6=_0xde7ca6||0xc8;return function(_0xc8faa){if(_0xc8faa){return _0x41aaa4['status'](_0xde7ca6)['json'](_0xc8faa);}};}function respondWithFilteredResult(_0x28102b,_0x5efa67){return function(_0x128058){if(_0x128058){var _0x444f40=typeof _0x5efa67[_0x7a9f('0x1b')]===_0x7a9f('0x1c')&&typeof _0x5efa67['limit']===_0x7a9f('0x1c');var _0x1f1cb7=_0x128058[_0x7a9f('0x1d')];var _0x122d1f=_0x444f40?0x0:_0x5efa67[_0x7a9f('0x1b')];var _0x1c966a=_0x444f40?_0x128058[_0x7a9f('0x1d')]:_0x5efa67[_0x7a9f('0x1b')]+_0x5efa67[_0x7a9f('0x1e')];var _0x159496;if(_0x1c966a>=_0x1f1cb7){_0x1c966a=_0x1f1cb7;_0x159496=0xc8;}else{_0x159496=0xce;}_0x28102b['status'](_0x159496);return _0x28102b[_0x7a9f('0x1f')]('Content-Range',_0x122d1f+'-'+_0x1c966a+'/'+_0x1f1cb7)[_0x7a9f('0x20')](_0x128058);}return null;};}function patchUpdates(_0x257063){return function(_0x23a93a){try{jsonpatch['apply'](_0x23a93a,_0x257063,!![]);}catch(_0x5c218d){return BPromise[_0x7a9f('0x21')](_0x5c218d);}return _0x23a93a[_0x7a9f('0x22')]();};}function saveUpdates(_0xd27ea5,_0x736edb){return function(_0x443179){if(_0x443179){return _0x443179[_0x7a9f('0x23')](_0xd27ea5)[_0x7a9f('0x24')](function(_0xbc2f8a){return _0xbc2f8a;});}return null;};}function removeEntity(_0x108130,_0x276d78){return function(_0x5914cb){if(_0x5914cb){return _0x5914cb[_0x7a9f('0x25')]()[_0x7a9f('0x24')](function(){_0x108130[_0x7a9f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59382c,_0x2f069b){return function(_0x5f5170){if(!_0x5f5170){_0x59382c[_0x7a9f('0x26')](0x194);}return _0x5f5170;};}function handleError(_0x469222,_0xc93bb9){_0xc93bb9=_0xc93bb9||0x1f4;return function(_0x24d9d7){logger['error'](_0x24d9d7[_0x7a9f('0x27')]);if(_0x24d9d7[_0x7a9f('0x28')]){delete _0x24d9d7[_0x7a9f('0x28')];}_0x469222[_0x7a9f('0x19')](_0xc93bb9)[_0x7a9f('0x29')](_0x24d9d7);};}exports[_0x7a9f('0x23')]=function(_0x18d4c3,_0x3caf9a){if(_0x18d4c3[_0x7a9f('0x2a')]['id']){delete _0x18d4c3[_0x7a9f('0x2a')]['id'];}return db[_0x7a9f('0x2b')]['find']({'where':{'id':_0x18d4c3[_0x7a9f('0x2c')]['id']}})[_0x7a9f('0x24')](handleEntityNotFound(_0x3caf9a,null))[_0x7a9f('0x24')](saveUpdates(_0x18d4c3[_0x7a9f('0x2a')],null))[_0x7a9f('0x24')](respondWithResult(_0x3caf9a,null))['catch'](handleError(_0x3caf9a,null));};exports[_0x7a9f('0x25')]=function(_0x2d22bb,_0x10e1aa){return db[_0x7a9f('0x2b')][_0x7a9f('0x2d')]({'where':{'id':_0x2d22bb['params']['id']}})[_0x7a9f('0x24')](handleEntityNotFound(_0x10e1aa,null))[_0x7a9f('0x24')](removeEntity(_0x10e1aa,null))[_0x7a9f('0x2e')](handleError(_0x10e1aa,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index ec6ba48..4928d01 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 _0xff01=['rimraf','./action.attributes','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0xff01,0x130));var _0x1ff0=function(_0xfe28c5,_0x452499){_0xfe28c5=_0xfe28c5-0x0;var _0xad25d1=_0xff01[_0xfe28c5];return _0xad25d1;};'use strict';var _=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var logger=require(_0x1ff0('0x2'))(_0x1ff0('0x3'));var moment=require(_0x1ff0('0x4'));var BPromise=require(_0x1ff0('0x5'));var rp=require(_0x1ff0('0x6'));var fs=require('fs');var path=require(_0x1ff0('0x7'));var rimraf=require(_0x1ff0('0x8'));var config=require('../../config/environment');var attributes=require(_0x1ff0('0x9'));module['exports']=function(_0x34c0f2,_0x43d97b){return _0x34c0f2[_0x1ff0('0xa')](_0x1ff0('0xb'),attributes,{'tableName':_0x1ff0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1596=['define','Action','tools_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./action.attributes','exports'];(function(_0x22c0a4,_0x57a1f5){var _0x1b0bea=function(_0x9958e8){while(--_0x9958e8){_0x22c0a4['push'](_0x22c0a4['shift']());}};_0x1b0bea(++_0x57a1f5);}(_0x1596,0x16f));var _0x6159=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1596[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x6159('0x0'));var util=require(_0x6159('0x1'));var logger=require(_0x6159('0x2'))(_0x6159('0x3'));var moment=require('moment');var BPromise=require(_0x6159('0x4'));var rp=require(_0x6159('0x5'));var fs=require('fs');var path=require(_0x6159('0x6'));var rimraf=require('rimraf');var config=require(_0x6159('0x7'));var attributes=require(_0x6159('0x8'));module[_0x6159('0x9')]=function(_0x50665b,_0x21f136){return _0x50665b[_0x6159('0xa')](_0x6159('0xb'),attributes,{'tableName':_0x6159('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 1e5d425..1b2d353 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x822d4e,_0x3acaac){var _0x5b7fd9=function(_0x4055e6){while(--_0x4055e6){_0x822d4e['push'](_0x822d4e['shift']());}};_0x5b7fd9(++_0x3acaac);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'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')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x542575,_0x251452){var _0x11ad0a=function(_0x4bbede){while(--_0x4bbede){_0x542575['push'](_0x542575['shift']());}};_0x11ad0a(++_0x251452);}(_0x5fab,0x177));var _0xb5fa=function(_0x475278,_0x38c7a9){_0x475278=_0x475278-0x0;var _0x26da4e=_0x5fab[_0x475278];return _0x26da4e;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 97def7a..b76ae69 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 _0x347e=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated','update','delete','exports','multer','util','path'];(function(_0x1a45e3,_0x385589){var _0x3615f8=function(_0x40ce0a){while(--_0x40ce0a){_0x1a45e3['push'](_0x1a45e3['shift']());}};_0x3615f8(++_0x385589);}(_0x347e,0x135));var _0xe347=function(_0x24e893,_0x130483){_0x24e893=_0x24e893-0x0;var _0x437e82=_0x347e[_0x24e893];return _0x437e82;};'use strict';var multer=require(_0xe347('0x0'));var util=require(_0xe347('0x1'));var path=require(_0xe347('0x2'));var timeout=require(_0xe347('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe347('0x4'));var auth=require(_0xe347('0x5'));var interaction=require(_0xe347('0x6'));var config=require('../../config/environment');var controller=require(_0xe347('0x7'));router['put'](_0xe347('0x8'),auth[_0xe347('0x9')](),controller[_0xe347('0xa')]);router[_0xe347('0xb')]('/:id',auth[_0xe347('0x9')](),controller['destroy']);module[_0xe347('0xc')]=router; \ No newline at end of file +var _0xeb6a=['multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','destroy','exports'];(function(_0x208f6d,_0x428050){var _0x8e579e=function(_0x7482e1){while(--_0x7482e1){_0x208f6d['push'](_0x208f6d['shift']());}};_0x8e579e(++_0x428050);}(_0xeb6a,0x18c));var _0xaeb6=function(_0x2bce9c,_0x45ebd1){_0x2bce9c=_0x2bce9c-0x0;var _0x1a91c3=_0xeb6a[_0x2bce9c];return _0x1a91c3;};'use strict';var multer=require(_0xaeb6('0x0'));var util=require(_0xaeb6('0x1'));var path=require(_0xaeb6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xaeb6('0x3'));var auth=require(_0xaeb6('0x4'));var interaction=require(_0xaeb6('0x5'));var config=require('../../config/environment');var controller=require(_0xaeb6('0x6'));router[_0xaeb6('0x7')](_0xaeb6('0x8'),auth[_0xaeb6('0x9')](),controller['update']);router['delete'](_0xaeb6('0x8'),auth[_0xaeb6('0x9')](),controller[_0xaeb6('0xa')]);module[_0xaeb6('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 296788e..5214ea1 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x1a043b,_0x4d540a){var _0x105ff5=function(_0x49532e){while(--_0x49532e){_0x1a043b['push'](_0x1a043b['shift']());}};_0x105ff5(++_0x4d540a);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x17f822,_0x484879){_0x17f822=_0x17f822-0x0;var _0x4a5bfa=_0x8ef6[_0x17f822];return _0x4a5bfa;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 6bb2151..2212be1 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 _0x1e91=['send','index','map','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','AnalyticCustomReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','Limited\x20Query:','toString','QueryTypes','COUNT(%s)','AVG(%s)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','Sequelize','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','sequelize','SELECT','run','runReport','value','select','metric','debug','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','UserProfileResource','error','name'];(function(_0x3ba1b1,_0x35446d){var _0x473018=function(_0x11ca92){while(--_0x11ca92){_0x3ba1b1['push'](_0x3ba1b1['shift']());}};_0x473018(++_0x35446d);}(_0x1e91,0x1d0));var _0x11e9=function(_0x27f424,_0xa6af37){_0x27f424=_0x27f424-0x0;var _0x5ae589=_0x1e91[_0x27f424];return _0x5ae589;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x11e9('0x0'));var zipdir=require(_0x11e9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11e9('0x2'));var moment=require(_0x11e9('0x3'));var BPromise=require(_0x11e9('0x4'));var Mustache=require(_0x11e9('0x5'));var util=require('util');var path=require(_0x11e9('0x6'));var sox=require(_0x11e9('0x7'));var csv=require(_0x11e9('0x8'));var ejs=require(_0x11e9('0x9'));var fs=require('fs');var fs_extra=require(_0x11e9('0xa'));var _=require('lodash');var squel=require(_0x11e9('0xb'));var crypto=require(_0x11e9('0xc'));var jsforce=require(_0x11e9('0xd'));var deskjs=require(_0x11e9('0xe'));var toCsv=require(_0x11e9('0x8'));var querystring=require('querystring');var Papa=require(_0x11e9('0xf'));var Redis=require(_0x11e9('0x10'));var authService=require(_0x11e9('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11e9('0x12'));var logger=require(_0x11e9('0x13'))(_0x11e9('0x14'));var utils=require(_0x11e9('0x15'));var config=require(_0x11e9('0x16'));var licenseUtil=require(_0x11e9('0x17'));var db=require(_0x11e9('0x18'))['db'];var dbH=require(_0x11e9('0x18'))[_0x11e9('0x19')];function respondWithStatusCode(_0x3f51c6,_0x2e9c78){_0x2e9c78=_0x2e9c78||0xcc;return function(_0x290e9b){if(_0x290e9b){return _0x3f51c6['sendStatus'](_0x2e9c78);}return _0x3f51c6['status'](_0x2e9c78)[_0x11e9('0x1a')]();};}function respondWithResult(_0x2abd33,_0x5b3e0a){_0x5b3e0a=_0x5b3e0a||0xc8;return function(_0x30629e){if(_0x30629e){return _0x2abd33[_0x11e9('0x1b')](_0x5b3e0a)[_0x11e9('0x1c')](_0x30629e);}};}function respondWithFilteredResult(_0x4b2364,_0x19031d){return function(_0xecf89a){if(_0xecf89a){var _0x1d831d=typeof _0x19031d[_0x11e9('0x1d')]===_0x11e9('0x1e')&&typeof _0x19031d['limit']===_0x11e9('0x1e');var _0x468e66=_0xecf89a[_0x11e9('0x1f')];var _0x232622=_0x1d831d?0x0:_0x19031d[_0x11e9('0x1d')];var _0x49679b=_0x1d831d?_0xecf89a[_0x11e9('0x1f')]:_0x19031d[_0x11e9('0x1d')]+_0x19031d[_0x11e9('0x20')];var _0x384608;if(_0x49679b>=_0x468e66){_0x49679b=_0x468e66;_0x384608=0xc8;}else{_0x384608=0xce;}_0x4b2364[_0x11e9('0x1b')](_0x384608);return _0x4b2364[_0x11e9('0x21')]('Content-Range',_0x232622+'-'+_0x49679b+'/'+_0x468e66)[_0x11e9('0x1c')](_0xecf89a);}return null;};}function patchUpdates(_0x48fb76){return function(_0x4cb8cf){try{jsonpatch[_0x11e9('0x22')](_0x4cb8cf,_0x48fb76,!![]);}catch(_0x57eebe){return BPromise[_0x11e9('0x23')](_0x57eebe);}return _0x4cb8cf[_0x11e9('0x24')]();};}function saveUpdates(_0x5a0744,_0x598c76){return function(_0x38831c){if(_0x38831c){return _0x38831c[_0x11e9('0x25')](_0x5a0744)[_0x11e9('0x26')](function(_0x27eb23){return _0x27eb23;});}return null;};}function removeEntity(_0x1521c4,_0xccaa9b){return function(_0x1c73c8){if(_0x1c73c8){return _0x1c73c8['destroy']()[_0x11e9('0x26')](function(){var _0x278a2f=_0x1c73c8[_0x11e9('0x27')]({'plain':!![]});var _0x43f763='CustomReports';return db[_0x11e9('0x28')]['destroy']({'where':{'type':_0x43f763,'resourceId':_0x278a2f['id']}})[_0x11e9('0x26')](function(){return _0x1c73c8;});})[_0x11e9('0x26')](function(){_0x1521c4['status'](0xcc)[_0x11e9('0x1a')]();});}};}function handleEntityNotFound(_0x46af11,_0x40279d){return function(_0x44ebd5){if(!_0x44ebd5){_0x46af11['sendStatus'](0x194);}return _0x44ebd5;};}function handleError(_0x42096e,_0x4ca2bd){_0x4ca2bd=_0x4ca2bd||0x1f4;return function(_0x3a0c78){logger[_0x11e9('0x29')](_0x3a0c78['stack']);if(_0x3a0c78['name']){delete _0x3a0c78[_0x11e9('0x2a')];}_0x42096e[_0x11e9('0x1b')](_0x4ca2bd)[_0x11e9('0x2b')](_0x3a0c78);};}exports[_0x11e9('0x2c')]=function(_0x1a1bde,_0x582079){var _0x1b8281={},_0x1f668f={},_0x1f309f={'count':0x0,'rows':[]};var _0x502bf2=_[_0x11e9('0x2d')](db['AnalyticCustomReport']['rawAttributes'],function(_0x33b7e0){return{'name':_0x33b7e0['fieldName'],'type':_0x33b7e0[_0x11e9('0x2e')][_0x11e9('0x2f')]};});_0x1f668f[_0x11e9('0x30')]=_[_0x11e9('0x2d')](_0x502bf2,_0x11e9('0x2a'));_0x1f668f['query']=_[_0x11e9('0x31')](_0x1a1bde['query']);_0x1f668f['filters']=_[_0x11e9('0x32')](_0x1f668f[_0x11e9('0x30')],_0x1f668f[_0x11e9('0x33')]);_0x1b8281[_0x11e9('0x34')]=_['intersection'](_0x1f668f['model'],qs[_0x11e9('0x35')](_0x1a1bde['query'][_0x11e9('0x35')]));_0x1b8281[_0x11e9('0x34')]=_0x1b8281[_0x11e9('0x34')][_0x11e9('0x36')]?_0x1b8281['attributes']:_0x1f668f[_0x11e9('0x30')];if(!_0x1a1bde[_0x11e9('0x33')][_0x11e9('0x37')](_0x11e9('0x38'))){_0x1b8281[_0x11e9('0x20')]=qs[_0x11e9('0x20')](_0x1a1bde['query'][_0x11e9('0x20')]);_0x1b8281[_0x11e9('0x1d')]=qs[_0x11e9('0x1d')](_0x1a1bde[_0x11e9('0x33')][_0x11e9('0x1d')]);}_0x1b8281[_0x11e9('0x39')]=qs[_0x11e9('0x3a')](_0x1a1bde[_0x11e9('0x33')][_0x11e9('0x3a')]);_0x1b8281[_0x11e9('0x3b')]=qs[_0x11e9('0x3c')](_[_0x11e9('0x3d')](_0x1a1bde[_0x11e9('0x33')],_0x1f668f['filters']),_0x502bf2);if(_0x1a1bde[_0x11e9('0x33')][_0x11e9('0x3e')]){_0x1b8281[_0x11e9('0x3b')]=_['merge'](_0x1b8281[_0x11e9('0x3b')],{'$or':_[_0x11e9('0x2d')](_0x502bf2,function(_0x43a37f){if(_0x43a37f[_0x11e9('0x2e')]!=='VIRTUAL'){var _0x1cd6e7={};_0x1cd6e7[_0x43a37f['name']]={'$like':'%'+_0x1a1bde[_0x11e9('0x33')][_0x11e9('0x3e')]+'%'};return _0x1cd6e7;}})});}_0x1b8281=_[_0x11e9('0x3f')]({},_0x1b8281,_0x1a1bde[_0x11e9('0x40')]);var _0x252abb={'where':_0x1b8281[_0x11e9('0x3b')]};return db[_0x11e9('0x41')][_0x11e9('0x1f')](_0x252abb)[_0x11e9('0x26')](function(_0x3022e6){_0x1f309f[_0x11e9('0x1f')]=_0x3022e6;if(_0x1a1bde[_0x11e9('0x33')][_0x11e9('0x42')]){_0x1b8281['include']=[{'all':!![]}];}return db[_0x11e9('0x41')][_0x11e9('0x43')](_0x1b8281);})[_0x11e9('0x26')](function(_0x52b6c3){_0x1f309f[_0x11e9('0x44')]=_0x52b6c3;return _0x1f309f;})[_0x11e9('0x26')](respondWithFilteredResult(_0x582079,_0x1b8281))[_0x11e9('0x45')](handleError(_0x582079,null));};exports[_0x11e9('0x46')]=function(_0x2b88ec,_0x3fe633){var _0x962f9b={'raw':![],'where':{'id':_0x2b88ec[_0x11e9('0x47')]['id']}},_0x354edc={};_0x354edc['model']=_[_0x11e9('0x31')](db['AnalyticCustomReport'][_0x11e9('0x48')]);_0x354edc['query']=_['keys'](_0x2b88ec[_0x11e9('0x33')]);_0x354edc[_0x11e9('0x3c')]=_[_0x11e9('0x32')](_0x354edc[_0x11e9('0x30')],_0x354edc[_0x11e9('0x33')]);_0x962f9b['attributes']=_['intersection'](_0x354edc[_0x11e9('0x30')],qs[_0x11e9('0x35')](_0x2b88ec[_0x11e9('0x33')][_0x11e9('0x35')]));_0x962f9b[_0x11e9('0x34')]=_0x962f9b[_0x11e9('0x34')][_0x11e9('0x36')]?_0x962f9b['attributes']:_0x354edc[_0x11e9('0x30')];if(_0x2b88ec[_0x11e9('0x33')][_0x11e9('0x42')]){_0x962f9b[_0x11e9('0x49')]=[{'all':!![]}];}_0x962f9b=_[_0x11e9('0x3f')]({},_0x962f9b,_0x2b88ec[_0x11e9('0x40')]);return db['AnalyticCustomReport'][_0x11e9('0x4a')](_0x962f9b)[_0x11e9('0x26')](handleEntityNotFound(_0x3fe633,null))[_0x11e9('0x26')](respondWithResult(_0x3fe633,null))[_0x11e9('0x45')](handleError(_0x3fe633,null));};exports['create']=function(_0x41099,_0x472cde){return db[_0x11e9('0x41')][_0x11e9('0x4b')](_0x41099[_0x11e9('0x4c')],{})[_0x11e9('0x26')](function(_0x3186e4){var _0x7e4ea7=_0x41099[_0x11e9('0x4d')][_0x11e9('0x27')]({'plain':!![]});if(!_0x7e4ea7)throw new Error(_0x11e9('0x4e'));if(_0x7e4ea7[_0x11e9('0x4f')]==='user'){var _0x12323c=_0x3186e4[_0x11e9('0x27')]({'plain':!![]});var _0x282bd7=_0x11e9('0x50');return db[_0x11e9('0x51')][_0x11e9('0x4a')]({'where':{'name':_0x282bd7,'userProfileId':_0x7e4ea7['userProfileId']},'raw':!![]})[_0x11e9('0x26')](function(_0x4c6f74){if(_0x4c6f74&&_0x4c6f74[_0x11e9('0x52')]===0x0){return db['UserProfileResource'][_0x11e9('0x4b')]({'name':_0x12323c[_0x11e9('0x2a')],'resourceId':_0x12323c['id'],'type':_0x11e9('0x53'),'sectionId':_0x4c6f74['id']},{})[_0x11e9('0x26')](function(){return _0x3186e4;});}else{return _0x3186e4;}})[_0x11e9('0x45')](function(_0x15cef8){logger['error'](_0x11e9('0x54'),_0x15cef8);throw _0x15cef8;});}return _0x3186e4;})[_0x11e9('0x26')](respondWithResult(_0x472cde,0xc9))[_0x11e9('0x45')](handleError(_0x472cde,null));};exports[_0x11e9('0x25')]=function(_0x5dc41e,_0x588d8e){if(_0x5dc41e[_0x11e9('0x4c')]['id']){delete _0x5dc41e[_0x11e9('0x4c')]['id'];}return db[_0x11e9('0x41')][_0x11e9('0x4a')]({'where':{'id':_0x5dc41e[_0x11e9('0x47')]['id']}})[_0x11e9('0x26')](handleEntityNotFound(_0x588d8e,null))[_0x11e9('0x26')](saveUpdates(_0x5dc41e[_0x11e9('0x4c')],null))[_0x11e9('0x26')](respondWithResult(_0x588d8e,null))['catch'](handleError(_0x588d8e,null));};exports[_0x11e9('0x55')]=function(_0x4ca36a,_0x1a30be){return db['AnalyticCustomReport'][_0x11e9('0x4a')]({'where':{'id':_0x4ca36a[_0x11e9('0x47')]['id']}})[_0x11e9('0x26')](handleEntityNotFound(_0x1a30be,null))[_0x11e9('0x26')](removeEntity(_0x1a30be,null))[_0x11e9('0x45')](handleError(_0x1a30be,null));};exports[_0x11e9('0x56')]=function(_0x2f231e,_0x31949e){var _0x56c81f=0xa;var _0x201756=[_0x11e9('0x57'),_0x11e9('0x58'),_0x11e9('0x59'),_0x11e9('0x5a')];var _0x549b79={'SUM':_0x11e9('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x11e9('0x5c'),'MAX':_0x11e9('0x5d'),'MIN':_0x11e9('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x11e9('0x5f'),'GROUP_CONCAT ASC':_0x11e9('0x60'),'GROUP_CONCAT DESC':_0x11e9('0x61')};var _0x3b4f91={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x11e9('0x62'),'ROUND':_0x11e9('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4fa69e=function(_0x239f29){return!_[_0x11e9('0x64')]([_0x11e9('0x65'),_0x11e9('0x66'),'IS\x20EMPTY',_0x11e9('0x67')],_0x239f29);};var _0x99fd7=function(_0x165cfd){if(!_0x165cfd||!_0x165cfd['rules'][_0x11e9('0x36')]){return'';}for(var _0x3340e0='(',_0x1e29b0=0x0;_0x1e29b0<_0x165cfd[_0x11e9('0x68')][_0x11e9('0x36')];_0x1e29b0+=0x1){_0x1e29b0>0x0&&(_0x3340e0+='\x20'+_0x165cfd[_0x11e9('0x69')]+'\x20');_0x3340e0+=_0x165cfd[_0x11e9('0x68')][_0x1e29b0][_0x11e9('0x6a')]?_0x99fd7(_0x165cfd[_0x11e9('0x68')][_0x1e29b0][_0x11e9('0x6a')]):_0x165cfd[_0x11e9('0x68')][_0x1e29b0]['field']+'\x20'+_0x165cfd['rules'][_0x1e29b0]['condition']+(_0x4fa69e(_0x165cfd[_0x11e9('0x68')][_0x1e29b0][_0x11e9('0x6b')])?'\x20'+_0x165cfd[_0x11e9('0x68')][_0x1e29b0]['value']:'');}return _0x3340e0+')';};var _0x361c8c={'where':{'id':_0x2f231e['params']['id']}},_0x124532,_0xffad16,_0x3801f0,_0x3572e1,_0x7341eb;_0x361c8c=_[_0x11e9('0x3f')]({},_0x361c8c,_0x2f231e[_0x11e9('0x40')]);return db[_0x11e9('0x41')][_0x11e9('0x4a')](_0x361c8c)['then'](function(_0x26984a){if(_0x26984a){_0x124532=_0x26984a;return _0x26984a[_0x11e9('0x6c')]();}return null;})[_0x11e9('0x26')](function(_0x44caf0){if(_0x44caf0){if(!_0x44caf0[_0x11e9('0x36')]){throw new db['Sequelize'][(_0x11e9('0x6d'))](_0x11e9('0x6e'),0x193);}_0xffad16=_0x44caf0;return db[_0x11e9('0x6f')][_0x11e9('0x43')]({'raw':!![]});}return null;})[_0x11e9('0x26')](function(_0x344095){if(_0x344095){_0x3801f0=_[_0x11e9('0x70')](_0x344095,'id');var _0x39acd1;var _0x3d48a1=squel['select']();_0x3d48a1[_0x11e9('0x71')](_0x124532[_0x11e9('0x72')]);for(var _0x2de040=0x0;_0x2de040<_0xffad16[_0x11e9('0x36')];_0x2de040+=0x1){_0x39acd1=_0xffad16[_0x2de040][_0x11e9('0x73')]?_0x3801f0[_0xffad16[_0x2de040][_0x11e9('0x73')]]['metric']:_0xffad16[_0x2de040][_0x11e9('0x74')];_0x39acd1=_0xffad16[_0x2de040][_0x11e9('0x75')]?_[_0x11e9('0x76')](_0x549b79[_0xffad16[_0x2de040][_0x11e9('0x75')]],'%s',_0x39acd1):_0x39acd1;_0x39acd1=_0xffad16[_0x2de040][_0x11e9('0x77')]?_['replace'](_0x3b4f91[_0xffad16[_0x2de040][_0x11e9('0x77')]],'%s',_0x39acd1):_0x39acd1;if(_0xffad16[_0x2de040][_0x11e9('0x78')]){_0x3d48a1['group'](_0x39acd1);}_0xffad16[_0x2de040]['orderBy']&&_0x3d48a1[_0x11e9('0x39')](_0x39acd1,_0xffad16[_0x2de040][_0x11e9('0x79')]===_0x11e9('0x7a')?![]:!![]);_0x3d48a1['field'](_0x39acd1,_0xffad16[_0x2de040][_0x11e9('0x7b')]||_0x39acd1);}if(_0x124532[_0x11e9('0x7c')]){_0x124532[_0x11e9('0x7c')]=JSON[_0x11e9('0x7d')](_0x124532['joins']);for(var _0x7ef269=0x0;_0x7ef269<_0x124532[_0x11e9('0x7c')][_0x11e9('0x36')];_0x7ef269+=0x1){if(_0x124532['joins'][_0x7ef269][_0x11e9('0x2e')]&&_['includes'](_0x201756,_0x124532[_0x11e9('0x7c')][_0x7ef269][_0x11e9('0x2e')])&&_0x124532['joins'][_0x7ef269][_0x11e9('0x7e')]&&_0x124532[_0x11e9('0x7c')][_0x7ef269][_0x11e9('0x7f')]&&_0x124532[_0x11e9('0x7c')][_0x7ef269]['foreignKey']){_0x3d48a1[_0x124532['joins'][_0x7ef269]['type']](_0x124532[_0x11e9('0x7c')][_0x7ef269][_0x11e9('0x7f')],null,util['format'](_0x11e9('0x80'),_0x124532[_0x11e9('0x72')],_0x124532[_0x11e9('0x7c')][_0x7ef269]['parentKey'],_0x124532[_0x11e9('0x7c')][_0x7ef269][_0x11e9('0x7f')],_0x124532[_0x11e9('0x7c')][_0x7ef269][_0x11e9('0x81')]));}}}if(_0x124532['conditions']){_0x124532[_0x11e9('0x82')]=JSON[_0x11e9('0x7d')](_0x124532['conditions']);_0x3d48a1[_0x11e9('0x3b')](_0x99fd7(_0x124532[_0x11e9('0x82')][_0x11e9('0x6a')]));}_0x7341eb=_0x3d48a1[_0x11e9('0x83')]();_0x3d48a1[_0x11e9('0x20')](_0x56c81f);_0x3d48a1[_0x11e9('0x1d')](0x0);logger['debug'](_0x11e9('0x84'),_0x3d48a1[_0x11e9('0x85')]());return dbH['sequelize']['query'](_0x3d48a1[_0x11e9('0x85')](),{'type':dbH['sequelize'][_0x11e9('0x86')]['SELECT']});}})[_0x11e9('0x26')](respondWithResult(_0x31949e,null))[_0x11e9('0x45')](handleError(_0x31949e,null));};function runReport(_0x56d38b,_0x40b67d,_0x5d29ed){var _0x13b7eb=_0x40b67d['name'];var _0x2297a4=0xa;var _0x270905=[_0x11e9('0x57'),_0x11e9('0x58'),_0x11e9('0x59'),_0x11e9('0x5a')];var _0x2ed1fd={'SUM':'SUM(%s)','COUNT':_0x11e9('0x87'),'COUNT DISTINCT':_0x11e9('0x5c'),'MAX':_0x11e9('0x5d'),'MIN':_0x11e9('0x5e'),'AVG':_0x11e9('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x11e9('0x60'),'GROUP_CONCAT DESC':_0x11e9('0x61')};var _0x49d3a2={'SEC_TO_TIME':_0x11e9('0x89'),'DATE':_0x11e9('0x8a'),'HOUR':_0x11e9('0x62'),'ROUND':_0x11e9('0x63'),'UNIX_TIMESTAMP':_0x11e9('0x8b')};var _0x145727=function(_0x43376e){return!_['includes']([_0x11e9('0x65'),_0x11e9('0x66'),_0x11e9('0x8c'),_0x11e9('0x67')],_0x43376e);};var _0x49d742=function(_0xeb16a9){if(!_0xeb16a9||!_0xeb16a9[_0x11e9('0x68')][_0x11e9('0x36')]){return'';}for(var _0x540d1f='(',_0x42c6b3=0x0;_0x42c6b3<_0xeb16a9['rules'][_0x11e9('0x36')];_0x42c6b3+=0x1){_0x42c6b3>0x0&&(_0x540d1f+='\x20'+_0xeb16a9['operator']+'\x20');_0x540d1f+=_0xeb16a9[_0x11e9('0x68')][_0x42c6b3][_0x11e9('0x6a')]?_0x49d742(_0xeb16a9[_0x11e9('0x68')][_0x42c6b3][_0x11e9('0x6a')]):_0xeb16a9[_0x11e9('0x68')][_0x42c6b3]['field']+'\x20'+_0xeb16a9[_0x11e9('0x68')][_0x42c6b3][_0x11e9('0x6b')]+(_0x145727(_0xeb16a9['rules'][_0x42c6b3][_0x11e9('0x6b')])?'\x20'+_0xeb16a9['rules'][_0x42c6b3]['value']:'');}return _0x540d1f+')';};var _0x203c03={'where':{'id':_0x56d38b['id']}},_0x4bf3c4,_0x5a38e2,_0x34d8e7,_0xbc6a54,_0x209e8e;_0x203c03=_['merge']({},_0x203c03,_0x5d29ed);return db[_0x11e9('0x41')]['find'](_0x203c03)['then'](function(_0x4b1a87){if(_0x4b1a87){_0x4bf3c4=_0x4b1a87;return _0x4b1a87[_0x11e9('0x6c')]();}return null;})[_0x11e9('0x26')](function(_0x556ca9){if(_0x556ca9){if(!_0x556ca9[_0x11e9('0x36')]){throw new db[(_0x11e9('0x8d'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5a38e2=_0x556ca9;return db[_0x11e9('0x6f')][_0x11e9('0x43')]({'raw':!![]});}return null;})[_0x11e9('0x26')](function(_0x56b34f){if(_0x56b34f){_0x34d8e7=_['keyBy'](_0x56b34f,'id');var _0x124cee;var _0x36217d=squel['select']();_0x36217d[_0x11e9('0x71')](_0x4bf3c4[_0x11e9('0x72')]);for(var _0x4de937=0x0;_0x4de937<_0x5a38e2[_0x11e9('0x36')];_0x4de937+=0x1){_0x124cee=_0x5a38e2[_0x4de937]['MetricId']?_0x34d8e7[_0x5a38e2[_0x4de937]['MetricId']]['metric']:_0x5a38e2[_0x4de937]['field'];_0x124cee=_0x5a38e2[_0x4de937][_0x11e9('0x75')]?_[_0x11e9('0x76')](_0x2ed1fd[_0x5a38e2[_0x4de937]['function']],'%s',_0x124cee):_0x124cee;_0x124cee=_0x5a38e2[_0x4de937]['format']?_[_0x11e9('0x76')](_0x49d3a2[_0x5a38e2[_0x4de937]['format']],'%s',_0x124cee):_0x124cee;if(_0x5a38e2[_0x4de937][_0x11e9('0x78')]){_0x36217d[_0x11e9('0x6a')](_0x124cee);}_0x5a38e2[_0x4de937][_0x11e9('0x79')]&&_0x36217d[_0x11e9('0x39')](_0x124cee,_0x5a38e2[_0x4de937]['orderBy']===_0x11e9('0x7a')?![]:!![]);_0x36217d[_0x11e9('0x74')](_0x124cee,_0x5a38e2[_0x4de937][_0x11e9('0x7b')]||_0x124cee);}if(_0x4bf3c4[_0x11e9('0x7c')]){_0x4bf3c4['joins']=JSON[_0x11e9('0x7d')](_0x4bf3c4[_0x11e9('0x7c')]);for(var _0x357077=0x0;_0x357077<_0x4bf3c4['joins'][_0x11e9('0x36')];_0x357077+=0x1){if(_0x4bf3c4[_0x11e9('0x7c')][_0x357077][_0x11e9('0x2e')]&&_['includes'](_0x270905,_0x4bf3c4[_0x11e9('0x7c')][_0x357077][_0x11e9('0x2e')])&&_0x4bf3c4['joins'][_0x357077]['parentKey']&&_0x4bf3c4[_0x11e9('0x7c')][_0x357077]['foreignTable']&&_0x4bf3c4[_0x11e9('0x7c')][_0x357077][_0x11e9('0x81')]){_0x36217d[_0x4bf3c4[_0x11e9('0x7c')][_0x357077][_0x11e9('0x2e')]](_0x4bf3c4[_0x11e9('0x7c')][_0x357077][_0x11e9('0x7f')],null,util[_0x11e9('0x77')]('%s.%s\x20=\x20%s.%s',_0x4bf3c4[_0x11e9('0x72')],_0x4bf3c4[_0x11e9('0x7c')][_0x357077][_0x11e9('0x7e')],_0x4bf3c4[_0x11e9('0x7c')][_0x357077]['foreignTable'],_0x4bf3c4[_0x11e9('0x7c')][_0x357077][_0x11e9('0x81')]));}}}if(_0x4bf3c4[_0x11e9('0x82')]){_0x4bf3c4[_0x11e9('0x82')]=JSON[_0x11e9('0x7d')](_0x4bf3c4[_0x11e9('0x82')]);_0x36217d[_0x11e9('0x3b')](_0x49d742(_0x4bf3c4[_0x11e9('0x82')][_0x11e9('0x6a')]));}_0x209e8e=_0x36217d[_0x11e9('0x83')]();_0x36217d[_0x11e9('0x20')](_0x2297a4);_0x36217d[_0x11e9('0x1d')](0x0);return;}})[_0x11e9('0x26')](function(){if(_0x40b67d[_0x11e9('0x8e')]===_0x11e9('0x8f')){return null;}var _0x456074=_[_0x11e9('0x3f')](_0x40b67d,{'name':_0x40b67d[_0x11e9('0x90')]||_0x40b67d[_0x11e9('0x2a')]||_0x4bf3c4[_0x11e9('0x2a')],'basename':_0x13b7eb,'savename':util[_0x11e9('0x77')]('%s-%s.%s',_0x40b67d[_0x11e9('0x2a')]||_0x4bf3c4[_0x11e9('0x2a')],require(_0x11e9('0x91'))[_0x11e9('0x92')](0x4),_0x40b67d[_0x11e9('0x8e')]||_0x11e9('0x93')),'reportId':_0x4bf3c4['id'],'reportType':_0x11e9('0x94')});return db[_0x11e9('0x95')]['create'](_0x456074,{'raw':!![]});})['then'](function(_0x134f75){if(_0x4bf3c4['table']==='cdr'){_0x209e8e['where'](_0x4bf3c4[_0x11e9('0x72')]+_0x11e9('0x96'),_0x40b67d[_0x11e9('0x97')],_0x40b67d[_0x11e9('0x98')]);}else{_0x209e8e[_0x11e9('0x3b')](_0x4bf3c4[_0x11e9('0x72')]+_0x11e9('0x99'),_0x40b67d[_0x11e9('0x97')],_0x40b67d[_0x11e9('0x98')]);}if(_0x134f75){logger[_0x11e9('0x9a')](_0x11e9('0x9b'),_0x209e8e[_0x11e9('0x85')]());require(_0x11e9('0x9c'))[_0x11e9('0x9d')](path['join'](__dirname,_0x11e9('0x9e'),_0x134f75['output']),[_0x134f75['id'],_0x209e8e[_0x11e9('0x85')](),path[_0x11e9('0x57')](__dirname,'../../files/reports',_0x134f75[_0x11e9('0x9f')]),_0x13b7eb]);return _0x134f75;}else{var _0xc2f347=squel['select']();_0xc2f347[_0x11e9('0x71')]('('+_0x209e8e[_0x11e9('0x85')]()+')','countTable');_0xc2f347[_0x11e9('0x74')](_0x11e9('0xa0'),_0x11e9('0x1f'));_0x209e8e[_0x11e9('0x20')](_0x40b67d['limit']||_0x2297a4);_0x209e8e[_0x11e9('0x1d')](_0x40b67d[_0x11e9('0x1d')]||0x0);return dbH[_0x11e9('0xa1')]['query'](_0xc2f347['toString'](),{'type':dbH[_0x11e9('0xa1')][_0x11e9('0x86')]['SELECT']})[_0x11e9('0x26')](function(_0x21592d){if(!_0x21592d[_0x11e9('0x36')]){_0xbc6a54=0x0;}else{_0xbc6a54=_0x21592d[0x0][_0x11e9('0x1f')]||0x0;}return dbH[_0x11e9('0xa1')]['query'](_0x209e8e[_0x11e9('0x85')](),{'type':dbH[_0x11e9('0xa1')][_0x11e9('0x86')][_0x11e9('0xa2')]});})['then'](function(_0x5ebccf){return{'rows':_0x5ebccf||[],'count':_0xbc6a54};});}});}exports[_0x11e9('0xa3')]=function(_0x299dc7,_0x51e2d5){return runReport(_0x299dc7[_0x11e9('0x47')],_0x299dc7['query'],_0x299dc7[_0x11e9('0x40')])['then'](respondWithResult(_0x51e2d5,null))['catch'](handleError(_0x51e2d5,null));};exports[_0x11e9('0xa4')]=runReport;exports[_0x11e9('0x33')]=function(_0x221300,_0x5dd0a5){var _0x2e3ed0=0xa;var _0x1333e4=[_0x11e9('0x57'),_0x11e9('0x58'),_0x11e9('0x59'),_0x11e9('0x5a')];var _0xd2aa06={'SUM':_0x11e9('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x11e9('0x5c'),'MAX':_0x11e9('0x5d'),'MIN':_0x11e9('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x11e9('0x5f'),'GROUP_CONCAT ASC':_0x11e9('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xe8b688={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x11e9('0x8a'),'HOUR':_0x11e9('0x62'),'ROUND':_0x11e9('0x63'),'UNIX_TIMESTAMP':_0x11e9('0x8b')};var _0x440c64=function(_0x432da6){return!_['includes']([_0x11e9('0x65'),_0x11e9('0x66'),_0x11e9('0x8c'),_0x11e9('0x67')],_0x432da6);};var _0x7aee04=function(_0x13b7f6){if(!_0x13b7f6||!_0x13b7f6[_0x11e9('0x68')][_0x11e9('0x36')]){return'';}for(var _0x202bbd='(',_0x7a25b1=0x0;_0x7a25b1<_0x13b7f6[_0x11e9('0x68')][_0x11e9('0x36')];_0x7a25b1+=0x1){_0x7a25b1>0x0&&(_0x202bbd+='\x20'+_0x13b7f6[_0x11e9('0x69')]+'\x20');_0x202bbd+=_0x13b7f6[_0x11e9('0x68')][_0x7a25b1][_0x11e9('0x6a')]?_0x7aee04(_0x13b7f6[_0x11e9('0x68')][_0x7a25b1][_0x11e9('0x6a')]):_0x13b7f6[_0x11e9('0x68')][_0x7a25b1][_0x11e9('0x74')]+'\x20'+_0x13b7f6[_0x11e9('0x68')][_0x7a25b1][_0x11e9('0x6b')]+(_0x440c64(_0x13b7f6[_0x11e9('0x68')][_0x7a25b1][_0x11e9('0x6b')])?'\x20'+_0x13b7f6['rules'][_0x7a25b1][_0x11e9('0xa5')]:'');}return _0x202bbd+')';};var _0x19cb52={'where':{'id':_0x221300[_0x11e9('0x47')]['id']}},_0x1c2031,_0x377fdf,_0x5b2a4c,_0x5bf5f7,_0x404128;_0x19cb52=_[_0x11e9('0x3f')]({},_0x19cb52,_0x221300[_0x11e9('0x40')]);return db[_0x11e9('0x41')][_0x11e9('0x4a')](_0x19cb52)['then'](function(_0x1dd63c){if(_0x1dd63c){_0x1c2031=_0x1dd63c;return _0x1dd63c['getFields']();}return null;})[_0x11e9('0x26')](function(_0x43e7b4){if(_0x43e7b4){if(!_0x43e7b4['length']){throw new db['Sequelize'][(_0x11e9('0x6d'))](_0x11e9('0x6e'),0x193);}_0x377fdf=_0x43e7b4;return db[_0x11e9('0x6f')][_0x11e9('0x43')]({'raw':!![]});}return null;})[_0x11e9('0x26')](function(_0x20fbd8){if(_0x20fbd8){_0x5b2a4c=_[_0x11e9('0x70')](_0x20fbd8,'id');var _0x557f0d;var _0x430002=squel[_0x11e9('0xa6')]();_0x430002[_0x11e9('0x71')](_0x1c2031[_0x11e9('0x72')]);for(var _0x460cd9=0x0;_0x460cd9<_0x377fdf['length'];_0x460cd9+=0x1){_0x557f0d=_0x377fdf[_0x460cd9][_0x11e9('0x73')]?_0x5b2a4c[_0x377fdf[_0x460cd9][_0x11e9('0x73')]][_0x11e9('0xa7')]:_0x377fdf[_0x460cd9]['field'];_0x557f0d=_0x377fdf[_0x460cd9]['function']?_[_0x11e9('0x76')](_0xd2aa06[_0x377fdf[_0x460cd9][_0x11e9('0x75')]],'%s',_0x557f0d):_0x557f0d;_0x557f0d=_0x377fdf[_0x460cd9][_0x11e9('0x77')]?_[_0x11e9('0x76')](_0xe8b688[_0x377fdf[_0x460cd9]['format']],'%s',_0x557f0d):_0x557f0d;if(_0x377fdf[_0x460cd9][_0x11e9('0x78')]){_0x430002[_0x11e9('0x6a')](_0x557f0d);}_0x377fdf[_0x460cd9][_0x11e9('0x79')]&&_0x430002['order'](_0x557f0d,_0x377fdf[_0x460cd9]['orderBy']===_0x11e9('0x7a')?![]:!![]);_0x430002[_0x11e9('0x74')](_0x557f0d,_0x377fdf[_0x460cd9]['alias']||_0x557f0d);}if(_0x1c2031[_0x11e9('0x7c')]){_0x1c2031[_0x11e9('0x7c')]=JSON['parse'](_0x1c2031[_0x11e9('0x7c')]);for(var _0x4108a9=0x0;_0x4108a9<_0x1c2031[_0x11e9('0x7c')][_0x11e9('0x36')];_0x4108a9+=0x1){if(_0x1c2031['joins'][_0x4108a9]['type']&&_[_0x11e9('0x64')](_0x1333e4,_0x1c2031['joins'][_0x4108a9]['type'])&&_0x1c2031[_0x11e9('0x7c')][_0x4108a9][_0x11e9('0x7e')]&&_0x1c2031['joins'][_0x4108a9][_0x11e9('0x7f')]&&_0x1c2031[_0x11e9('0x7c')][_0x4108a9][_0x11e9('0x81')]){_0x430002[_0x1c2031['joins'][_0x4108a9]['type']](_0x1c2031[_0x11e9('0x7c')][_0x4108a9][_0x11e9('0x7f')],null,util[_0x11e9('0x77')]('%s.%s\x20=\x20%s.%s',_0x1c2031['table'],_0x1c2031[_0x11e9('0x7c')][_0x4108a9][_0x11e9('0x7e')],_0x1c2031['joins'][_0x4108a9][_0x11e9('0x7f')],_0x1c2031['joins'][_0x4108a9][_0x11e9('0x81')]));}}}if(_0x1c2031[_0x11e9('0x82')]){_0x1c2031['conditions']=JSON[_0x11e9('0x7d')](_0x1c2031['conditions']);_0x430002['where'](_0x7aee04(_0x1c2031['conditions'][_0x11e9('0x6a')]));}_0x404128=_0x430002['clone']();_0x430002[_0x11e9('0x20')](_0x2e3ed0);_0x430002[_0x11e9('0x1d')](0x0);logger[_0x11e9('0xa8')]('Limited\x20Query:',_0x430002[_0x11e9('0x85')]());return dbH[_0x11e9('0xa1')][_0x11e9('0x33')](_0x430002['toString'](),{'type':dbH[_0x11e9('0xa1')][_0x11e9('0x86')][_0x11e9('0xa2')]});}})[_0x11e9('0x26')](function(){return{'sql':_0x404128['toString']()};})['then'](respondWithResult(_0x5dd0a5,null))['catch'](handleError(_0x5dd0a5,null));}; \ No newline at end of file +var _0xebfc=['name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','show','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','options','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','MetricId','metric','function','format','replace','orderBy','alias','joins','foreignTable','foreignKey','table','parentKey','conditions','parse','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','left_join','SUM(%s)','AVG(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','select','DESC','%s.%s\x20=\x20%s.%s','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','SEC_TO_TIME(%s)','operator','groupBy','eml-format','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','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','dbH','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','sendStatus','error','stack'];(function(_0x54ece6,_0x11a6c6){var _0x2cfd35=function(_0x8163c6){while(--_0x8163c6){_0x54ece6['push'](_0x54ece6['shift']());}};_0x2cfd35(++_0x11a6c6);}(_0xebfc,0x12b));var _0xcebf=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xebfc[_0x59bcb1];return _0x4a737f;};'use strict';var emlformat=require(_0xcebf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcebf('0x1'));var moment=require(_0xcebf('0x2'));var BPromise=require(_0xcebf('0x3'));var Mustache=require(_0xcebf('0x4'));var util=require('util');var path=require(_0xcebf('0x5'));var sox=require(_0xcebf('0x6'));var csv=require('to-csv');var ejs=require(_0xcebf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcebf('0x8'));var squel=require(_0xcebf('0x9'));var crypto=require(_0xcebf('0xa'));var jsforce=require(_0xcebf('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcebf('0xc'));var Papa=require('papaparse');var Redis=require(_0xcebf('0xd'));var authService=require(_0xcebf('0xe'));var qs=require(_0xcebf('0xf'));var as=require(_0xcebf('0x10'));var hardwareService=require(_0xcebf('0x11'));var logger=require(_0xcebf('0x12'))(_0xcebf('0x13'));var utils=require(_0xcebf('0x14'));var config=require(_0xcebf('0x15'));var licenseUtil=require(_0xcebf('0x16'));var db=require(_0xcebf('0x17'))['db'];var dbH=require(_0xcebf('0x17'))[_0xcebf('0x18')];function respondWithStatusCode(_0x3f1ced,_0x4ca807){_0x4ca807=_0x4ca807||0xcc;return function(_0x2d2854){if(_0x2d2854){return _0x3f1ced['sendStatus'](_0x4ca807);}return _0x3f1ced[_0xcebf('0x19')](_0x4ca807)[_0xcebf('0x1a')]();};}function respondWithResult(_0xf1d6b9,_0x2d397c){_0x2d397c=_0x2d397c||0xc8;return function(_0x5bfc37){if(_0x5bfc37){return _0xf1d6b9[_0xcebf('0x19')](_0x2d397c)[_0xcebf('0x1b')](_0x5bfc37);}};}function respondWithFilteredResult(_0xc46843,_0x53c9fd){return function(_0x1820ab){if(_0x1820ab){var _0x549321=typeof _0x53c9fd[_0xcebf('0x1c')]===_0xcebf('0x1d')&&typeof _0x53c9fd['limit']===_0xcebf('0x1d');var _0x2c7f46=_0x1820ab[_0xcebf('0x1e')];var _0xaf825d=_0x549321?0x0:_0x53c9fd[_0xcebf('0x1c')];var _0x7854db=_0x549321?_0x1820ab[_0xcebf('0x1e')]:_0x53c9fd['offset']+_0x53c9fd[_0xcebf('0x1f')];var _0x12c4cf;if(_0x7854db>=_0x2c7f46){_0x7854db=_0x2c7f46;_0x12c4cf=0xc8;}else{_0x12c4cf=0xce;}_0xc46843[_0xcebf('0x19')](_0x12c4cf);return _0xc46843[_0xcebf('0x20')](_0xcebf('0x21'),_0xaf825d+'-'+_0x7854db+'/'+_0x2c7f46)['json'](_0x1820ab);}return null;};}function patchUpdates(_0x1a307e){return function(_0x4d19de){try{jsonpatch[_0xcebf('0x22')](_0x4d19de,_0x1a307e,!![]);}catch(_0x4e9e76){return BPromise[_0xcebf('0x23')](_0x4e9e76);}return _0x4d19de[_0xcebf('0x24')]();};}function saveUpdates(_0x59cf79,_0x11dd83){return function(_0x657bdc){if(_0x657bdc){return _0x657bdc[_0xcebf('0x25')](_0x59cf79)[_0xcebf('0x26')](function(_0x4e1461){return _0x4e1461;});}return null;};}function removeEntity(_0x427736,_0xb38452){return function(_0x5d187c){if(_0x5d187c){return _0x5d187c[_0xcebf('0x27')]()['then'](function(){var _0x2428d5=_0x5d187c['get']({'plain':!![]});var _0x415b39=_0xcebf('0x28');return db[_0xcebf('0x29')]['destroy']({'where':{'type':_0x415b39,'resourceId':_0x2428d5['id']}})[_0xcebf('0x26')](function(){return _0x5d187c;});})['then'](function(){_0x427736['status'](0xcc)[_0xcebf('0x1a')]();});}};}function handleEntityNotFound(_0x5aea6a,_0x3e046a){return function(_0x281282){if(!_0x281282){_0x5aea6a[_0xcebf('0x2a')](0x194);}return _0x281282;};}function handleError(_0x3268d7,_0x5997fd){_0x5997fd=_0x5997fd||0x1f4;return function(_0x1dcd53){logger[_0xcebf('0x2b')](_0x1dcd53[_0xcebf('0x2c')]);if(_0x1dcd53[_0xcebf('0x2d')]){delete _0x1dcd53[_0xcebf('0x2d')];}_0x3268d7['status'](_0x5997fd)[_0xcebf('0x2e')](_0x1dcd53);};}exports[_0xcebf('0x2f')]=function(_0x215cd3,_0x2e7b11){var _0xf30306={},_0x93f444={},_0x5a867e={'count':0x0,'rows':[]};var _0x2cfd7f=_[_0xcebf('0x30')](db[_0xcebf('0x31')][_0xcebf('0x32')],function(_0x577366){return{'name':_0x577366[_0xcebf('0x33')],'type':_0x577366[_0xcebf('0x34')][_0xcebf('0x35')]};});_0x93f444[_0xcebf('0x36')]=_[_0xcebf('0x30')](_0x2cfd7f,_0xcebf('0x2d'));_0x93f444[_0xcebf('0x37')]=_[_0xcebf('0x38')](_0x215cd3['query']);_0x93f444[_0xcebf('0x39')]=_[_0xcebf('0x3a')](_0x93f444['model'],_0x93f444[_0xcebf('0x37')]);_0xf30306['attributes']=_[_0xcebf('0x3a')](_0x93f444[_0xcebf('0x36')],qs[_0xcebf('0x3b')](_0x215cd3[_0xcebf('0x37')]['fields']));_0xf30306['attributes']=_0xf30306['attributes']['length']?_0xf30306[_0xcebf('0x3c')]:_0x93f444[_0xcebf('0x36')];if(!_0x215cd3[_0xcebf('0x37')][_0xcebf('0x3d')](_0xcebf('0x3e'))){_0xf30306['limit']=qs['limit'](_0x215cd3[_0xcebf('0x37')][_0xcebf('0x1f')]);_0xf30306[_0xcebf('0x1c')]=qs[_0xcebf('0x1c')](_0x215cd3[_0xcebf('0x37')][_0xcebf('0x1c')]);}_0xf30306[_0xcebf('0x3f')]=qs['sort'](_0x215cd3[_0xcebf('0x37')]['sort']);_0xf30306[_0xcebf('0x40')]=qs[_0xcebf('0x39')](_[_0xcebf('0x41')](_0x215cd3[_0xcebf('0x37')],_0x93f444[_0xcebf('0x39')]),_0x2cfd7f);if(_0x215cd3[_0xcebf('0x37')][_0xcebf('0x42')]){_0xf30306[_0xcebf('0x40')]=_['merge'](_0xf30306[_0xcebf('0x40')],{'$or':_[_0xcebf('0x30')](_0x2cfd7f,function(_0x4327e6){if(_0x4327e6[_0xcebf('0x34')]!==_0xcebf('0x43')){var _0x52cdf3={};_0x52cdf3[_0x4327e6[_0xcebf('0x2d')]]={'$like':'%'+_0x215cd3['query'][_0xcebf('0x42')]+'%'};return _0x52cdf3;}})});}_0xf30306=_[_0xcebf('0x44')]({},_0xf30306,_0x215cd3['options']);var _0x57516a={'where':_0xf30306[_0xcebf('0x40')]};return db['AnalyticCustomReport']['count'](_0x57516a)[_0xcebf('0x26')](function(_0x1c1a37){_0x5a867e[_0xcebf('0x1e')]=_0x1c1a37;if(_0x215cd3[_0xcebf('0x37')][_0xcebf('0x45')]){_0xf30306[_0xcebf('0x46')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0xf30306);})[_0xcebf('0x26')](function(_0x168d52){_0x5a867e['rows']=_0x168d52;return _0x5a867e;})[_0xcebf('0x26')](respondWithFilteredResult(_0x2e7b11,_0xf30306))[_0xcebf('0x47')](handleError(_0x2e7b11,null));};exports[_0xcebf('0x48')]=function(_0x720d6f,_0x1481ee){var _0x1af596={'raw':![],'where':{'id':_0x720d6f[_0xcebf('0x49')]['id']}},_0x30985a={};_0x30985a['model']=_[_0xcebf('0x38')](db[_0xcebf('0x31')][_0xcebf('0x32')]);_0x30985a[_0xcebf('0x37')]=_[_0xcebf('0x38')](_0x720d6f[_0xcebf('0x37')]);_0x30985a['filters']=_['intersection'](_0x30985a[_0xcebf('0x36')],_0x30985a[_0xcebf('0x37')]);_0x1af596[_0xcebf('0x3c')]=_[_0xcebf('0x3a')](_0x30985a[_0xcebf('0x36')],qs['fields'](_0x720d6f[_0xcebf('0x37')][_0xcebf('0x3b')]));_0x1af596[_0xcebf('0x3c')]=_0x1af596['attributes'][_0xcebf('0x4a')]?_0x1af596[_0xcebf('0x3c')]:_0x30985a['model'];if(_0x720d6f[_0xcebf('0x37')][_0xcebf('0x45')]){_0x1af596[_0xcebf('0x46')]=[{'all':!![]}];}_0x1af596=_[_0xcebf('0x44')]({},_0x1af596,_0x720d6f['options']);return db[_0xcebf('0x31')]['find'](_0x1af596)[_0xcebf('0x26')](handleEntityNotFound(_0x1481ee,null))['then'](respondWithResult(_0x1481ee,null))[_0xcebf('0x47')](handleError(_0x1481ee,null));};exports['create']=function(_0x562f19,_0x4d45e6){return db['AnalyticCustomReport'][_0xcebf('0x4b')](_0x562f19[_0xcebf('0x4c')],{})[_0xcebf('0x26')](function(_0x20c070){var _0x39867b=_0x562f19[_0xcebf('0x4d')][_0xcebf('0x4e')]({'plain':!![]});if(!_0x39867b)throw new Error(_0xcebf('0x4f'));if(_0x39867b['role']===_0xcebf('0x4d')){var _0x4da9e5=_0x20c070[_0xcebf('0x4e')]({'plain':!![]});var _0x17da20=_0xcebf('0x50');return db[_0xcebf('0x51')][_0xcebf('0x52')]({'where':{'name':_0x17da20,'userProfileId':_0x39867b[_0xcebf('0x53')]},'raw':!![]})[_0xcebf('0x26')](function(_0x1eb47f){if(_0x1eb47f&&_0x1eb47f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4da9e5[_0xcebf('0x2d')],'resourceId':_0x4da9e5['id'],'type':'CustomReports','sectionId':_0x1eb47f['id']},{})[_0xcebf('0x26')](function(){return _0x20c070;});}else{return _0x20c070;}})[_0xcebf('0x47')](function(_0x401d94){logger[_0xcebf('0x2b')](_0xcebf('0x54'),_0x401d94);throw _0x401d94;});}return _0x20c070;})['then'](respondWithResult(_0x4d45e6,0xc9))[_0xcebf('0x47')](handleError(_0x4d45e6,null));};exports[_0xcebf('0x25')]=function(_0x3bc55d,_0x3fd64c){if(_0x3bc55d['body']['id']){delete _0x3bc55d[_0xcebf('0x4c')]['id'];}return db[_0xcebf('0x31')][_0xcebf('0x52')]({'where':{'id':_0x3bc55d[_0xcebf('0x49')]['id']}})[_0xcebf('0x26')](handleEntityNotFound(_0x3fd64c,null))[_0xcebf('0x26')](saveUpdates(_0x3bc55d[_0xcebf('0x4c')],null))['then'](respondWithResult(_0x3fd64c,null))[_0xcebf('0x47')](handleError(_0x3fd64c,null));};exports[_0xcebf('0x27')]=function(_0x352d52,_0x141169){return db['AnalyticCustomReport'][_0xcebf('0x52')]({'where':{'id':_0x352d52[_0xcebf('0x49')]['id']}})[_0xcebf('0x26')](handleEntityNotFound(_0x141169,null))[_0xcebf('0x26')](removeEntity(_0x141169,null))['catch'](handleError(_0x141169,null));};exports[_0xcebf('0x55')]=function(_0x1801d8,_0x753eac){var _0x50f2dc=0xa;var _0x5ee6d2=[_0xcebf('0x56'),'left_join',_0xcebf('0x57'),_0xcebf('0x58')];var _0x58cf16={'SUM':'SUM(%s)','COUNT':_0xcebf('0x59'),'COUNT DISTINCT':_0xcebf('0x5a'),'MAX':_0xcebf('0x5b'),'MIN':_0xcebf('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcebf('0x5d'),'GROUP_CONCAT ASC':_0xcebf('0x5e'),'GROUP_CONCAT DESC':_0xcebf('0x5f')};var _0xd24097={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcebf('0x60'),'HOUR':_0xcebf('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xcebf('0x62')};var _0x3b3801=function(_0x21d32e){return!_[_0xcebf('0x63')](['IS\x20NULL',_0xcebf('0x64'),_0xcebf('0x65'),'IS\x20NOT\x20EMPTY'],_0x21d32e);};var _0x4a71d1=function(_0x18562d){if(!_0x18562d||!_0x18562d[_0xcebf('0x66')][_0xcebf('0x4a')]){return'';}for(var _0x1f0038='(',_0x20a713=0x0;_0x20a713<_0x18562d[_0xcebf('0x66')][_0xcebf('0x4a')];_0x20a713+=0x1){_0x20a713>0x0&&(_0x1f0038+='\x20'+_0x18562d['operator']+'\x20');_0x1f0038+=_0x18562d[_0xcebf('0x66')][_0x20a713]['group']?_0x4a71d1(_0x18562d[_0xcebf('0x66')][_0x20a713][_0xcebf('0x67')]):_0x18562d[_0xcebf('0x66')][_0x20a713][_0xcebf('0x68')]+'\x20'+_0x18562d['rules'][_0x20a713][_0xcebf('0x69')]+(_0x3b3801(_0x18562d['rules'][_0x20a713][_0xcebf('0x69')])?'\x20'+_0x18562d[_0xcebf('0x66')][_0x20a713][_0xcebf('0x6a')]:'');}return _0x1f0038+')';};var _0x4e9dc5={'where':{'id':_0x1801d8['params']['id']}},_0x3f2796,_0x705fcc,_0x332159,_0x3478eb,_0xe6a966;_0x4e9dc5=_[_0xcebf('0x44')]({},_0x4e9dc5,_0x1801d8[_0xcebf('0x6b')]);return db['AnalyticCustomReport'][_0xcebf('0x52')](_0x4e9dc5)[_0xcebf('0x26')](function(_0x31d007){if(_0x31d007){_0x3f2796=_0x31d007;return _0x31d007[_0xcebf('0x6c')]();}return null;})['then'](function(_0x4350c2){if(_0x4350c2){if(!_0x4350c2[_0xcebf('0x4a')]){throw new db[(_0xcebf('0x6d'))][(_0xcebf('0x6e'))](_0xcebf('0x6f'),0x193);}_0x705fcc=_0x4350c2;return db[_0xcebf('0x70')][_0xcebf('0x71')]({'raw':!![]});}return null;})['then'](function(_0x4b6907){if(_0x4b6907){_0x332159=_[_0xcebf('0x72')](_0x4b6907,'id');var _0xa22c3d;var _0x5692e6=squel['select']();_0x5692e6[_0xcebf('0x73')](_0x3f2796['table']);for(var _0x53793a=0x0;_0x53793a<_0x705fcc[_0xcebf('0x4a')];_0x53793a+=0x1){_0xa22c3d=_0x705fcc[_0x53793a]['MetricId']?_0x332159[_0x705fcc[_0x53793a][_0xcebf('0x74')]][_0xcebf('0x75')]:_0x705fcc[_0x53793a][_0xcebf('0x68')];_0xa22c3d=_0x705fcc[_0x53793a]['function']?_['replace'](_0x58cf16[_0x705fcc[_0x53793a][_0xcebf('0x76')]],'%s',_0xa22c3d):_0xa22c3d;_0xa22c3d=_0x705fcc[_0x53793a][_0xcebf('0x77')]?_[_0xcebf('0x78')](_0xd24097[_0x705fcc[_0x53793a]['format']],'%s',_0xa22c3d):_0xa22c3d;if(_0x705fcc[_0x53793a]['groupBy']){_0x5692e6[_0xcebf('0x67')](_0xa22c3d);}_0x705fcc[_0x53793a]['orderBy']&&_0x5692e6[_0xcebf('0x3f')](_0xa22c3d,_0x705fcc[_0x53793a][_0xcebf('0x79')]==='DESC'?![]:!![]);_0x5692e6[_0xcebf('0x68')](_0xa22c3d,_0x705fcc[_0x53793a][_0xcebf('0x7a')]||_0xa22c3d);}if(_0x3f2796[_0xcebf('0x7b')]){_0x3f2796[_0xcebf('0x7b')]=JSON['parse'](_0x3f2796[_0xcebf('0x7b')]);for(var _0x55088b=0x0;_0x55088b<_0x3f2796[_0xcebf('0x7b')][_0xcebf('0x4a')];_0x55088b+=0x1){if(_0x3f2796[_0xcebf('0x7b')][_0x55088b]['type']&&_['includes'](_0x5ee6d2,_0x3f2796[_0xcebf('0x7b')][_0x55088b]['type'])&&_0x3f2796[_0xcebf('0x7b')][_0x55088b]['parentKey']&&_0x3f2796[_0xcebf('0x7b')][_0x55088b][_0xcebf('0x7c')]&&_0x3f2796[_0xcebf('0x7b')][_0x55088b][_0xcebf('0x7d')]){_0x5692e6[_0x3f2796[_0xcebf('0x7b')][_0x55088b]['type']](_0x3f2796[_0xcebf('0x7b')][_0x55088b][_0xcebf('0x7c')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3f2796[_0xcebf('0x7e')],_0x3f2796[_0xcebf('0x7b')][_0x55088b][_0xcebf('0x7f')],_0x3f2796['joins'][_0x55088b][_0xcebf('0x7c')],_0x3f2796[_0xcebf('0x7b')][_0x55088b][_0xcebf('0x7d')]));}}}if(_0x3f2796[_0xcebf('0x80')]){_0x3f2796[_0xcebf('0x80')]=JSON[_0xcebf('0x81')](_0x3f2796[_0xcebf('0x80')]);_0x5692e6[_0xcebf('0x40')](_0x4a71d1(_0x3f2796[_0xcebf('0x80')]['group']));}_0xe6a966=_0x5692e6['clone']();_0x5692e6['limit'](_0x50f2dc);_0x5692e6['offset'](0x0);logger[_0xcebf('0x82')](_0xcebf('0x83'),_0x5692e6['toString']());return dbH[_0xcebf('0x84')]['query'](_0x5692e6[_0xcebf('0x85')](),{'type':dbH[_0xcebf('0x84')][_0xcebf('0x86')][_0xcebf('0x87')]});}})[_0xcebf('0x26')](respondWithResult(_0x753eac,null))[_0xcebf('0x47')](handleError(_0x753eac,null));};function runReport(_0x3f3dad,_0x333d56,_0x4a5be4){var _0x9d9c60=_0x333d56[_0xcebf('0x2d')];var _0x3aaee1=0xa;var _0x2eab23=[_0xcebf('0x56'),_0xcebf('0x88'),_0xcebf('0x57'),_0xcebf('0x58')];var _0xbf8ced={'SUM':_0xcebf('0x89'),'COUNT':_0xcebf('0x59'),'COUNT DISTINCT':_0xcebf('0x5a'),'MAX':_0xcebf('0x5b'),'MIN':_0xcebf('0x5c'),'AVG':_0xcebf('0x8a'),'GROUP_CONCAT':_0xcebf('0x5d'),'GROUP_CONCAT ASC':_0xcebf('0x5e'),'GROUP_CONCAT DESC':_0xcebf('0x5f')};var _0x2f2a2a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcebf('0x8b'),'UNIX_TIMESTAMP':_0xcebf('0x62')};var _0x551834=function(_0x529f62){return!_[_0xcebf('0x63')]([_0xcebf('0x8c'),_0xcebf('0x64'),_0xcebf('0x65'),_0xcebf('0x8d')],_0x529f62);};var _0x5ce925=function(_0x1845c8){if(!_0x1845c8||!_0x1845c8[_0xcebf('0x66')]['length']){return'';}for(var _0x59cf21='(',_0x4e8bab=0x0;_0x4e8bab<_0x1845c8[_0xcebf('0x66')]['length'];_0x4e8bab+=0x1){_0x4e8bab>0x0&&(_0x59cf21+='\x20'+_0x1845c8['operator']+'\x20');_0x59cf21+=_0x1845c8['rules'][_0x4e8bab]['group']?_0x5ce925(_0x1845c8[_0xcebf('0x66')][_0x4e8bab][_0xcebf('0x67')]):_0x1845c8[_0xcebf('0x66')][_0x4e8bab][_0xcebf('0x68')]+'\x20'+_0x1845c8[_0xcebf('0x66')][_0x4e8bab][_0xcebf('0x69')]+(_0x551834(_0x1845c8[_0xcebf('0x66')][_0x4e8bab][_0xcebf('0x69')])?'\x20'+_0x1845c8[_0xcebf('0x66')][_0x4e8bab][_0xcebf('0x6a')]:'');}return _0x59cf21+')';};var _0x287b51={'where':{'id':_0x3f3dad['id']}},_0x5d21ea,_0x57d72b,_0x14bea9,_0xc53a80,_0x789912;_0x287b51=_[_0xcebf('0x44')]({},_0x287b51,_0x4a5be4);return db[_0xcebf('0x31')]['find'](_0x287b51)[_0xcebf('0x26')](function(_0x54a4d2){if(_0x54a4d2){_0x5d21ea=_0x54a4d2;return _0x54a4d2['getFields']();}return null;})[_0xcebf('0x26')](function(_0x58ff0d){if(_0x58ff0d){if(!_0x58ff0d[_0xcebf('0x4a')]){throw new db[(_0xcebf('0x6d'))][(_0xcebf('0x6e'))](_0xcebf('0x6f'),0x193);}_0x57d72b=_0x58ff0d;return db['AnalyticMetric'][_0xcebf('0x71')]({'raw':!![]});}return null;})[_0xcebf('0x26')](function(_0x3619ca){if(_0x3619ca){_0x14bea9=_[_0xcebf('0x72')](_0x3619ca,'id');var _0x57c655;var _0x32bde4=squel[_0xcebf('0x8e')]();_0x32bde4[_0xcebf('0x73')](_0x5d21ea[_0xcebf('0x7e')]);for(var _0xe6645b=0x0;_0xe6645b<_0x57d72b[_0xcebf('0x4a')];_0xe6645b+=0x1){_0x57c655=_0x57d72b[_0xe6645b][_0xcebf('0x74')]?_0x14bea9[_0x57d72b[_0xe6645b]['MetricId']][_0xcebf('0x75')]:_0x57d72b[_0xe6645b]['field'];_0x57c655=_0x57d72b[_0xe6645b]['function']?_[_0xcebf('0x78')](_0xbf8ced[_0x57d72b[_0xe6645b][_0xcebf('0x76')]],'%s',_0x57c655):_0x57c655;_0x57c655=_0x57d72b[_0xe6645b][_0xcebf('0x77')]?_[_0xcebf('0x78')](_0x2f2a2a[_0x57d72b[_0xe6645b][_0xcebf('0x77')]],'%s',_0x57c655):_0x57c655;if(_0x57d72b[_0xe6645b]['groupBy']){_0x32bde4['group'](_0x57c655);}_0x57d72b[_0xe6645b][_0xcebf('0x79')]&&_0x32bde4['order'](_0x57c655,_0x57d72b[_0xe6645b][_0xcebf('0x79')]===_0xcebf('0x8f')?![]:!![]);_0x32bde4['field'](_0x57c655,_0x57d72b[_0xe6645b]['alias']||_0x57c655);}if(_0x5d21ea[_0xcebf('0x7b')]){_0x5d21ea[_0xcebf('0x7b')]=JSON['parse'](_0x5d21ea[_0xcebf('0x7b')]);for(var _0x1ca85e=0x0;_0x1ca85e<_0x5d21ea[_0xcebf('0x7b')][_0xcebf('0x4a')];_0x1ca85e+=0x1){if(_0x5d21ea[_0xcebf('0x7b')][_0x1ca85e][_0xcebf('0x34')]&&_[_0xcebf('0x63')](_0x2eab23,_0x5d21ea[_0xcebf('0x7b')][_0x1ca85e][_0xcebf('0x34')])&&_0x5d21ea['joins'][_0x1ca85e][_0xcebf('0x7f')]&&_0x5d21ea['joins'][_0x1ca85e][_0xcebf('0x7c')]&&_0x5d21ea[_0xcebf('0x7b')][_0x1ca85e][_0xcebf('0x7d')]){_0x32bde4[_0x5d21ea[_0xcebf('0x7b')][_0x1ca85e]['type']](_0x5d21ea[_0xcebf('0x7b')][_0x1ca85e]['foreignTable'],null,util[_0xcebf('0x77')](_0xcebf('0x90'),_0x5d21ea['table'],_0x5d21ea[_0xcebf('0x7b')][_0x1ca85e][_0xcebf('0x7f')],_0x5d21ea[_0xcebf('0x7b')][_0x1ca85e][_0xcebf('0x7c')],_0x5d21ea[_0xcebf('0x7b')][_0x1ca85e][_0xcebf('0x7d')]));}}}if(_0x5d21ea[_0xcebf('0x80')]){_0x5d21ea[_0xcebf('0x80')]=JSON['parse'](_0x5d21ea[_0xcebf('0x80')]);_0x32bde4[_0xcebf('0x40')](_0x5ce925(_0x5d21ea[_0xcebf('0x80')][_0xcebf('0x67')]));}_0x789912=_0x32bde4[_0xcebf('0x91')]();_0x32bde4[_0xcebf('0x1f')](_0x3aaee1);_0x32bde4[_0xcebf('0x1c')](0x0);return;}})[_0xcebf('0x26')](function(){if(_0x333d56[_0xcebf('0x92')]===_0xcebf('0x93')){return null;}var _0x51707c=_[_0xcebf('0x44')](_0x333d56,{'name':_0x333d56[_0xcebf('0x94')]||_0x333d56['name']||_0x5d21ea['name'],'basename':_0x9d9c60,'savename':util[_0xcebf('0x77')](_0xcebf('0x95'),_0x333d56[_0xcebf('0x2d')]||_0x5d21ea['name'],require(_0xcebf('0x96'))[_0xcebf('0x97')](0x4),_0x333d56[_0xcebf('0x92')]||_0xcebf('0x98')),'reportId':_0x5d21ea['id'],'reportType':_0xcebf('0x99')});return db[_0xcebf('0x9a')][_0xcebf('0x4b')](_0x51707c,{'raw':!![]});})[_0xcebf('0x26')](function(_0x3d8a9e){if(_0x5d21ea[_0xcebf('0x7e')]===_0xcebf('0x9b')){_0x789912['where'](_0x5d21ea[_0xcebf('0x7e')]+_0xcebf('0x9c'),_0x333d56['startDate'],_0x333d56['endDate']);}else{_0x789912[_0xcebf('0x40')](_0x5d21ea['table']+_0xcebf('0x9d'),_0x333d56[_0xcebf('0x9e')],_0x333d56[_0xcebf('0x9f')]);}if(_0x3d8a9e){logger[_0xcebf('0xa0')](_0xcebf('0xa1'),_0x789912[_0xcebf('0x85')]());require(_0xcebf('0xa2'))[_0xcebf('0xa3')](path[_0xcebf('0x56')](__dirname,'../../components/export/',_0x3d8a9e[_0xcebf('0x92')]),[_0x3d8a9e['id'],_0x789912['toString'](),path['join'](__dirname,_0xcebf('0xa4'),_0x3d8a9e[_0xcebf('0xa5')]),_0x9d9c60]);return _0x3d8a9e;}else{var _0x2acfcb=squel[_0xcebf('0x8e')]();_0x2acfcb[_0xcebf('0x73')]('('+_0x789912[_0xcebf('0x85')]()+')',_0xcebf('0xa6'));_0x2acfcb['field']('COUNT(*)',_0xcebf('0x1e'));_0x789912[_0xcebf('0x1f')](_0x333d56['limit']||_0x3aaee1);_0x789912[_0xcebf('0x1c')](_0x333d56[_0xcebf('0x1c')]||0x0);return dbH['sequelize']['query'](_0x2acfcb[_0xcebf('0x85')](),{'type':dbH[_0xcebf('0x84')][_0xcebf('0x86')][_0xcebf('0x87')]})[_0xcebf('0x26')](function(_0x1195ef){if(!_0x1195ef[_0xcebf('0x4a')]){_0xc53a80=0x0;}else{_0xc53a80=_0x1195ef[0x0]['count']||0x0;}return dbH[_0xcebf('0x84')]['query'](_0x789912['toString'](),{'type':dbH[_0xcebf('0x84')]['QueryTypes'][_0xcebf('0x87')]});})['then'](function(_0x10283a){return{'rows':_0x10283a||[],'count':_0xc53a80};});}});}exports[_0xcebf('0xa7')]=function(_0x322dc1,_0x916310){return runReport(_0x322dc1['params'],_0x322dc1[_0xcebf('0x37')],_0x322dc1[_0xcebf('0x6b')])['then'](respondWithResult(_0x916310,null))['catch'](handleError(_0x916310,null));};exports[_0xcebf('0xa8')]=runReport;exports['query']=function(_0x30573a,_0xd34285){var _0x553521=0xa;var _0x57a12a=[_0xcebf('0x56'),'left_join',_0xcebf('0x57'),_0xcebf('0x58')];var _0x295a3f={'SUM':'SUM(%s)','COUNT':_0xcebf('0x59'),'COUNT DISTINCT':_0xcebf('0x5a'),'MAX':_0xcebf('0x5b'),'MIN':_0xcebf('0x5c'),'AVG':_0xcebf('0x8a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcebf('0x5f')};var _0x4410fc={'SEC_TO_TIME':_0xcebf('0xa9'),'DATE':_0xcebf('0x60'),'HOUR':_0xcebf('0x61'),'ROUND':_0xcebf('0x8b'),'UNIX_TIMESTAMP':_0xcebf('0x62')};var _0x27ecb7=function(_0x41660c){return!_[_0xcebf('0x63')]([_0xcebf('0x8c'),_0xcebf('0x64'),'IS\x20EMPTY',_0xcebf('0x8d')],_0x41660c);};var _0x1e12e6=function(_0x51c88d){if(!_0x51c88d||!_0x51c88d[_0xcebf('0x66')][_0xcebf('0x4a')]){return'';}for(var _0x3e21df='(',_0x4a9129=0x0;_0x4a9129<_0x51c88d[_0xcebf('0x66')][_0xcebf('0x4a')];_0x4a9129+=0x1){_0x4a9129>0x0&&(_0x3e21df+='\x20'+_0x51c88d[_0xcebf('0xaa')]+'\x20');_0x3e21df+=_0x51c88d[_0xcebf('0x66')][_0x4a9129][_0xcebf('0x67')]?_0x1e12e6(_0x51c88d['rules'][_0x4a9129][_0xcebf('0x67')]):_0x51c88d[_0xcebf('0x66')][_0x4a9129][_0xcebf('0x68')]+'\x20'+_0x51c88d[_0xcebf('0x66')][_0x4a9129]['condition']+(_0x27ecb7(_0x51c88d[_0xcebf('0x66')][_0x4a9129][_0xcebf('0x69')])?'\x20'+_0x51c88d[_0xcebf('0x66')][_0x4a9129][_0xcebf('0x6a')]:'');}return _0x3e21df+')';};var _0x4510ed={'where':{'id':_0x30573a[_0xcebf('0x49')]['id']}},_0x400543,_0x1a32b4,_0x37cc5f,_0x4b4ed2,_0x460872;_0x4510ed=_[_0xcebf('0x44')]({},_0x4510ed,_0x30573a[_0xcebf('0x6b')]);return db[_0xcebf('0x31')]['find'](_0x4510ed)['then'](function(_0x761e7e){if(_0x761e7e){_0x400543=_0x761e7e;return _0x761e7e[_0xcebf('0x6c')]();}return null;})[_0xcebf('0x26')](function(_0x243a4d){if(_0x243a4d){if(!_0x243a4d[_0xcebf('0x4a')]){throw new db[(_0xcebf('0x6d'))]['ValidationErrorItem'](_0xcebf('0x6f'),0x193);}_0x1a32b4=_0x243a4d;return db[_0xcebf('0x70')]['findAll']({'raw':!![]});}return null;})[_0xcebf('0x26')](function(_0x2fd76e){if(_0x2fd76e){_0x37cc5f=_[_0xcebf('0x72')](_0x2fd76e,'id');var _0x160af7;var _0x2f5a32=squel['select']();_0x2f5a32[_0xcebf('0x73')](_0x400543[_0xcebf('0x7e')]);for(var _0x2d8832=0x0;_0x2d8832<_0x1a32b4[_0xcebf('0x4a')];_0x2d8832+=0x1){_0x160af7=_0x1a32b4[_0x2d8832][_0xcebf('0x74')]?_0x37cc5f[_0x1a32b4[_0x2d8832][_0xcebf('0x74')]]['metric']:_0x1a32b4[_0x2d8832][_0xcebf('0x68')];_0x160af7=_0x1a32b4[_0x2d8832][_0xcebf('0x76')]?_[_0xcebf('0x78')](_0x295a3f[_0x1a32b4[_0x2d8832][_0xcebf('0x76')]],'%s',_0x160af7):_0x160af7;_0x160af7=_0x1a32b4[_0x2d8832]['format']?_[_0xcebf('0x78')](_0x4410fc[_0x1a32b4[_0x2d8832]['format']],'%s',_0x160af7):_0x160af7;if(_0x1a32b4[_0x2d8832][_0xcebf('0xab')]){_0x2f5a32[_0xcebf('0x67')](_0x160af7);}_0x1a32b4[_0x2d8832][_0xcebf('0x79')]&&_0x2f5a32['order'](_0x160af7,_0x1a32b4[_0x2d8832]['orderBy']==='DESC'?![]:!![]);_0x2f5a32[_0xcebf('0x68')](_0x160af7,_0x1a32b4[_0x2d8832]['alias']||_0x160af7);}if(_0x400543['joins']){_0x400543['joins']=JSON[_0xcebf('0x81')](_0x400543[_0xcebf('0x7b')]);for(var _0x1e55e2=0x0;_0x1e55e2<_0x400543[_0xcebf('0x7b')][_0xcebf('0x4a')];_0x1e55e2+=0x1){if(_0x400543[_0xcebf('0x7b')][_0x1e55e2][_0xcebf('0x34')]&&_[_0xcebf('0x63')](_0x57a12a,_0x400543[_0xcebf('0x7b')][_0x1e55e2][_0xcebf('0x34')])&&_0x400543['joins'][_0x1e55e2][_0xcebf('0x7f')]&&_0x400543[_0xcebf('0x7b')][_0x1e55e2][_0xcebf('0x7c')]&&_0x400543[_0xcebf('0x7b')][_0x1e55e2][_0xcebf('0x7d')]){_0x2f5a32[_0x400543[_0xcebf('0x7b')][_0x1e55e2][_0xcebf('0x34')]](_0x400543[_0xcebf('0x7b')][_0x1e55e2][_0xcebf('0x7c')],null,util[_0xcebf('0x77')](_0xcebf('0x90'),_0x400543['table'],_0x400543['joins'][_0x1e55e2]['parentKey'],_0x400543[_0xcebf('0x7b')][_0x1e55e2][_0xcebf('0x7c')],_0x400543[_0xcebf('0x7b')][_0x1e55e2][_0xcebf('0x7d')]));}}}if(_0x400543[_0xcebf('0x80')]){_0x400543[_0xcebf('0x80')]=JSON['parse'](_0x400543['conditions']);_0x2f5a32[_0xcebf('0x40')](_0x1e12e6(_0x400543[_0xcebf('0x80')]['group']));}_0x460872=_0x2f5a32[_0xcebf('0x91')]();_0x2f5a32[_0xcebf('0x1f')](_0x553521);_0x2f5a32[_0xcebf('0x1c')](0x0);logger['debug'](_0xcebf('0x83'),_0x2f5a32[_0xcebf('0x85')]());return dbH[_0xcebf('0x84')]['query'](_0x2f5a32[_0xcebf('0x85')](),{'type':dbH['sequelize'][_0xcebf('0x86')]['SELECT']});}})[_0xcebf('0x26')](function(){return{'sql':_0x460872[_0xcebf('0x85')]()};})[_0xcebf('0x26')](respondWithResult(_0xd34285,null))[_0xcebf('0x47')](handleError(_0xd34285,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 03bcfc6..5ed97ae 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 _0xe657=['path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x8473ab,_0x11263e){var _0x3a89c0=function(_0x95ab9f){while(--_0x95ab9f){_0x8473ab['push'](_0x8473ab['shift']());}};_0x3a89c0(++_0x11263e);}(_0xe657,0x1c1));var _0x7e65=function(_0xdfe8c4,_0x3f695c){_0xdfe8c4=_0xdfe8c4-0x0;var _0x5ee124=_0xe657[_0xdfe8c4];return _0x5ee124;};'use strict';var _=require(_0x7e65('0x0'));var util=require(_0x7e65('0x1'));var logger=require(_0x7e65('0x2'))('api');var moment=require(_0x7e65('0x3'));var BPromise=require(_0x7e65('0x4'));var rp=require(_0x7e65('0x5'));var fs=require('fs');var path=require(_0x7e65('0x6'));var rimraf=require(_0x7e65('0x7'));var config=require(_0x7e65('0x8'));var attributes=require(_0x7e65('0x9'));module['exports']=function(_0x4e416a,_0x51ba1d){return _0x4e416a[_0x7e65('0xa')](_0x7e65('0xb'),attributes,{'tableName':_0x7e65('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82c2=['lodash','util','api','bluebird','rimraf','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x259f30,_0x1ada25){var _0xa8bc49=function(_0x2f7721){while(--_0x2f7721){_0x259f30['push'](_0x259f30['shift']());}};_0xa8bc49(++_0x1ada25);}(_0x82c2,0x1e6));var _0x282c=function(_0x54bf67,_0x5381e5){_0x54bf67=_0x54bf67-0x0;var _0x5f18a9=_0x82c2[_0x54bf67];return _0x5f18a9;};'use strict';var _=require(_0x282c('0x0'));var util=require(_0x282c('0x1'));var logger=require('../../config/logger')(_0x282c('0x2'));var moment=require('moment');var BPromise=require(_0x282c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x282c('0x4'));var config=require('../../config/environment');var attributes=require(_0x282c('0x5'));module['exports']=function(_0x414d8e,_0x1012ef){return _0x414d8e[_0x282c('0x6')](_0x282c('0x7'),attributes,{'tableName':_0x282c('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index c7f31ea..6bc0266 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 _0xd3be=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2514ff,_0x381293){var _0x21579d=function(_0x411c12){while(--_0x411c12){_0x2514ff['push'](_0x2514ff['shift']());}};_0x21579d(++_0x381293);}(_0xd3be,0xdf));var _0xed3b=function(_0x5d35b7,_0x3337e2){_0x5d35b7=_0x5d35b7-0x0;var _0x158b8b=_0xd3be[_0x5d35b7];return _0x158b8b;};'use strict';var _=require(_0xed3b('0x0'));var util=require(_0xed3b('0x1'));var moment=require(_0xed3b('0x2'));var BPromise=require('bluebird');var rs=require(_0xed3b('0x3'));var fs=require('fs');var Redis=require(_0xed3b('0x4'));var db=require(_0xed3b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xed3b('0x6'))(_0xed3b('0x7'));var config=require(_0xed3b('0x8'));var jayson=require(_0xed3b('0x9'));var client=jayson['client'][_0xed3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47dbac,_0x4d281e,_0x44bfb7){return new BPromise(function(_0x16bea0,_0x4f5223){return client[_0xed3b('0xb')](_0x47dbac,_0x44bfb7)[_0xed3b('0xc')](function(_0x3ff99d){logger[_0xed3b('0xd')](_0xed3b('0xe'),_0x4d281e,_0xed3b('0xf'));logger['debug'](_0xed3b('0x10'),_0x4d281e,'request\x20sent',JSON['stringify'](_0x3ff99d));if(_0x3ff99d[_0xed3b('0x11')]){if(_0x3ff99d[_0xed3b('0x11')][_0xed3b('0x12')]===0x1f4){logger[_0xed3b('0x11')](_0xed3b('0xe'),_0x4d281e,_0x3ff99d[_0xed3b('0x11')][_0xed3b('0x13')]);return _0x4f5223(_0x3ff99d['error'][_0xed3b('0x13')]);}logger[_0xed3b('0x11')](_0xed3b('0xe'),_0x4d281e,_0x3ff99d[_0xed3b('0x11')][_0xed3b('0x13')]);return _0x16bea0(_0x3ff99d[_0xed3b('0x11')][_0xed3b('0x13')]);}else{logger[_0xed3b('0xd')](_0xed3b('0xe'),_0x4d281e,_0xed3b('0xf'));_0x16bea0(_0x3ff99d[_0xed3b('0x14')]['message']);}})[_0xed3b('0x15')](function(_0x3ff86b){logger[_0xed3b('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4d281e,_0x3ff86b);_0x4f5223(_0x3ff86b);});});} \ No newline at end of file +var _0x4f9f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0xbed8a2,_0x578ae3){var _0x11d4f2=function(_0x49e846){while(--_0x49e846){_0xbed8a2['push'](_0xbed8a2['shift']());}};_0x11d4f2(++_0x578ae3);}(_0x4f9f,0x1b1));var _0xf4f9=function(_0x4afa89,_0x1b9ed3){_0x4afa89=_0x4afa89-0x0;var _0x151c58=_0x4f9f[_0x4afa89];return _0x151c58;};'use strict';var _=require(_0xf4f9('0x0'));var util=require(_0xf4f9('0x1'));var moment=require(_0xf4f9('0x2'));var BPromise=require(_0xf4f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4f9('0x4'));var db=require(_0xf4f9('0x5'))['db'];var utils=require(_0xf4f9('0x6'));var logger=require(_0xf4f9('0x7'))(_0xf4f9('0x8'));var config=require(_0xf4f9('0x9'));var jayson=require(_0xf4f9('0xa'));var client=jayson['client'][_0xf4f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54eb22,_0x4fec19,_0x215924){return new BPromise(function(_0x193f3d,_0x33a13e){return client[_0xf4f9('0xc')](_0x54eb22,_0x215924)[_0xf4f9('0xd')](function(_0x4beed0){logger[_0xf4f9('0xe')](_0xf4f9('0xf'),_0x4fec19,_0xf4f9('0x10'));logger['debug'](_0xf4f9('0x11'),_0x4fec19,'request\x20sent',JSON[_0xf4f9('0x12')](_0x4beed0));if(_0x4beed0['error']){if(_0x4beed0[_0xf4f9('0x13')][_0xf4f9('0x14')]===0x1f4){logger[_0xf4f9('0x13')](_0xf4f9('0xf'),_0x4fec19,_0x4beed0[_0xf4f9('0x13')]['message']);return _0x33a13e(_0x4beed0[_0xf4f9('0x13')][_0xf4f9('0x15')]);}logger['error'](_0xf4f9('0xf'),_0x4fec19,_0x4beed0[_0xf4f9('0x13')][_0xf4f9('0x15')]);return _0x193f3d(_0x4beed0[_0xf4f9('0x13')]['message']);}else{logger[_0xf4f9('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4fec19,_0xf4f9('0x10'));_0x193f3d(_0x4beed0['result'][_0xf4f9('0x15')]);}})[_0xf4f9('0x16')](function(_0x139735){logger[_0xf4f9('0x13')](_0xf4f9('0xf'),_0x4fec19,_0x139735);_0x33a13e(_0x139735);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index cb4cf2c..1426b4a 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 _0xd78c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','query','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xd78c,0x10d));var _0xcd78=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd78c[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xcd78('0x0'));var util=require(_0xcd78('0x1'));var path=require(_0xcd78('0x2'));var timeout=require(_0xcd78('0x3'));var express=require(_0xcd78('0x4'));var router=express[_0xcd78('0x5')]();var fs_extra=require(_0xcd78('0x6'));var auth=require(_0xcd78('0x7'));var interaction=require(_0xcd78('0x8'));var config=require(_0xcd78('0x9'));var controller=require(_0xcd78('0xa'));router[_0xcd78('0xb')]('/',auth[_0xcd78('0xc')](),controller['index']);router[_0xcd78('0xb')](_0xcd78('0xd'),auth['isAuthenticated'](),controller[_0xcd78('0xe')]);router['get'](_0xcd78('0xf'),auth['isAuthenticated'](),controller[_0xcd78('0x10')]);router[_0xcd78('0xb')]('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0xcd78('0xb')]('/:id/query',auth[_0xcd78('0xc')](),controller[_0xcd78('0x11')]);router[_0xcd78('0x12')]('/',auth[_0xcd78('0xc')](),controller[_0xcd78('0x13')]);router[_0xcd78('0x14')](_0xcd78('0xd'),auth[_0xcd78('0xc')](),controller['update']);router[_0xcd78('0x15')](_0xcd78('0xd'),auth[_0xcd78('0xc')](),controller['destroy']);module[_0xcd78('0x16')]=router; \ No newline at end of file +var _0xad25=['get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','destroy','exports','util','path','../../components/auth/service','./analyticCustomReport.controller'];(function(_0x37002e,_0x41f2f5){var _0x25d8db=function(_0x46fa9b){while(--_0x46fa9b){_0x37002e['push'](_0x37002e['shift']());}};_0x25d8db(++_0x41f2f5);}(_0xad25,0xe6));var _0x5ad2=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xad25[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require('multer');var util=require(_0x5ad2('0x0'));var path=require(_0x5ad2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5ad2('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5ad2('0x3'));router[_0x5ad2('0x4')]('/',auth[_0x5ad2('0x5')](),controller[_0x5ad2('0x6')]);router['get'](_0x5ad2('0x7'),auth[_0x5ad2('0x5')](),controller[_0x5ad2('0x8')]);router[_0x5ad2('0x4')](_0x5ad2('0x9'),auth['isAuthenticated'](),controller['preview']);router[_0x5ad2('0x4')](_0x5ad2('0xa'),auth[_0x5ad2('0x5')](),controller[_0x5ad2('0xb')]);router['get'](_0x5ad2('0xc'),auth[_0x5ad2('0x5')](),controller['query']);router[_0x5ad2('0xd')]('/',auth[_0x5ad2('0x5')](),controller[_0x5ad2('0xe')]);router[_0x5ad2('0xf')](_0x5ad2('0x7'),auth[_0x5ad2('0x5')](),controller['update']);router['delete'](_0x5ad2('0x7'),auth[_0x5ad2('0x5')](),controller[_0x5ad2('0x10')]);module[_0x5ad2('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6afd776..b868094 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 _0x3eea=['STRING','TEXT','sequelize'];(function(_0x55ad58,_0x44c12f){var _0x471b98=function(_0x52a1cd){while(--_0x52a1cd){_0x55ad58['push'](_0x55ad58['shift']());}};_0x471b98(++_0x44c12f);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x299565,_0x13b4df){_0x299565=_0x299565-0x0;var _0x413367=_0x3eea[_0x299565];return _0x413367;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file +var _0x2eb2=['TEXT','exports','STRING'];(function(_0x3e330a,_0x11bf04){var _0x451dee=function(_0x1074b7){while(--_0x1074b7){_0x3e330a['push'](_0x3e330a['shift']());}};_0x451dee(++_0x11bf04);}(_0x2eb2,0x19f));var _0x22eb=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x2eb2[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ca4c3af..8d33155 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 _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x191559,_0xb1a10f){var _0x1f6626=function(_0x61578b){while(--_0x61578b){_0x191559['push'](_0x191559['shift']());}};_0x1f6626(++_0xb1a10f);}(_0x814b,0x1a2));var _0xb814=function(_0x5a2299,_0x3e2922){_0x5a2299=_0x5a2299-0x0;var _0xedff0f=_0x814b[_0x5a2299];return _0xedff0f;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'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 _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file +var _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x2d2fb0,_0x165e6e){var _0xc057c0=function(_0x1e17ba){while(--_0x1e17ba){_0x2d2fb0['push'](_0x2d2fb0['shift']());}};_0xc057c0(++_0x165e6e);}(_0x187d,0x93));var _0xd187=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x187d[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0f4255e..2d64818 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 _0xab19=['AnalyticDefaultReport','analytics_default_reports','util','api','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xab19,0x138));var _0x9ab1=function(_0x3750cb,_0x505a79){_0x3750cb=_0x3750cb-0x0;var _0xc93ab6=_0xab19[_0x3750cb];return _0xc93ab6;};'use strict';var _=require('lodash');var util=require(_0x9ab1('0x0'));var logger=require('../../config/logger')(_0x9ab1('0x1'));var moment=require(_0x9ab1('0x2'));var BPromise=require(_0x9ab1('0x3'));var rp=require(_0x9ab1('0x4'));var fs=require('fs');var path=require(_0x9ab1('0x5'));var rimraf=require(_0x9ab1('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ab1('0x7'));module['exports']=function(_0x2aff26,_0xb5bba5){return _0x2aff26['define'](_0x9ab1('0x8'),attributes,{'tableName':_0x9ab1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6a7=['exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xe6a7,0xac));var _0x7e6a=function(_0x524870,_0x553a86){_0x524870=_0x524870-0x0;var _0x1f9c95=_0xe6a7[_0x524870];return _0x1f9c95;};'use strict';var _=require(_0x7e6a('0x0'));var util=require(_0x7e6a('0x1'));var logger=require('../../config/logger')(_0x7e6a('0x2'));var moment=require(_0x7e6a('0x3'));var BPromise=require(_0x7e6a('0x4'));var rp=require(_0x7e6a('0x5'));var fs=require('fs');var path=require(_0x7e6a('0x6'));var rimraf=require(_0x7e6a('0x7'));var config=require(_0x7e6a('0x8'));var attributes=require(_0x7e6a('0x9'));module[_0x7e6a('0xa')]=function(_0x2574ca,_0x1d977d){return _0x2574ca['define'](_0x7e6a('0xb'),attributes,{'tableName':_0x7e6a('0xc'),'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 41147b9..ae620b8 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 _0x1d37=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message'];(function(_0x2c4d32,_0x69e859){var _0x19fe28=function(_0x167e8e){while(--_0x167e8e){_0x2c4d32['push'](_0x2c4d32['shift']());}};_0x19fe28(++_0x69e859);}(_0x1d37,0xfe));var _0x71d3=function(_0x45fc9c,_0x70f2cb){_0x45fc9c=_0x45fc9c-0x0;var _0x984946=_0x1d37[_0x45fc9c];return _0x984946;};'use strict';var _=require(_0x71d3('0x0'));var util=require('util');var moment=require(_0x71d3('0x1'));var BPromise=require(_0x71d3('0x2'));var rs=require(_0x71d3('0x3'));var fs=require('fs');var Redis=require(_0x71d3('0x4'));var db=require(_0x71d3('0x5'))['db'];var utils=require(_0x71d3('0x6'));var logger=require(_0x71d3('0x7'))(_0x71d3('0x8'));var config=require('../../config/environment');var jayson=require(_0x71d3('0x9'));var client=jayson['client'][_0x71d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48971f,_0x4fad8f,_0x5cd9cb){return new BPromise(function(_0x37ff50,_0x2c72f6){return client[_0x71d3('0xb')](_0x48971f,_0x5cd9cb)['then'](function(_0xd89246){logger[_0x71d3('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4fad8f,_0x71d3('0xd'));logger[_0x71d3('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4fad8f,'request\x20sent',JSON[_0x71d3('0xf')](_0xd89246));if(_0xd89246[_0x71d3('0x10')]){if(_0xd89246[_0x71d3('0x10')]['code']===0x1f4){logger['error'](_0x71d3('0x11'),_0x4fad8f,_0xd89246[_0x71d3('0x10')][_0x71d3('0x12')]);return _0x2c72f6(_0xd89246['error'][_0x71d3('0x12')]);}logger[_0x71d3('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4fad8f,_0xd89246[_0x71d3('0x10')][_0x71d3('0x12')]);return _0x37ff50(_0xd89246[_0x71d3('0x10')][_0x71d3('0x12')]);}else{logger[_0x71d3('0xc')](_0x71d3('0x11'),_0x4fad8f,_0x71d3('0xd'));_0x37ff50(_0xd89246[_0x71d3('0x13')][_0x71d3('0x12')]);}})[_0x71d3('0x14')](function(_0x5143d7){logger['error'](_0x71d3('0x11'),_0x4fad8f,_0x5143d7);_0x2c72f6(_0x5143d7);});});} \ No newline at end of file +var _0xb31a=['client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5257fc,_0x4e0ed6){var _0x15662f=function(_0x29b1f9){while(--_0x29b1f9){_0x5257fc['push'](_0x5257fc['shift']());}};_0x15662f(++_0x4e0ed6);}(_0xb31a,0x199));var _0xab31=function(_0x53e738,_0x2005a6){_0x53e738=_0x53e738-0x0;var _0x149beb=_0xb31a[_0x53e738];return _0x149beb;};'use strict';var _=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var moment=require(_0xab31('0x2'));var BPromise=require(_0xab31('0x3'));var rs=require(_0xab31('0x4'));var fs=require('fs');var Redis=require(_0xab31('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xab31('0x6'));var logger=require(_0xab31('0x7'))(_0xab31('0x8'));var config=require(_0xab31('0x9'));var jayson=require(_0xab31('0xa'));var client=jayson[_0xab31('0xb')][_0xab31('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ad297,_0x168b0b,_0x538886){return new BPromise(function(_0x2c87a2,_0x5f12ed){return client['request'](_0x2ad297,_0x538886)['then'](function(_0x2f3bde){logger[_0xab31('0xd')](_0xab31('0xe'),_0x168b0b,_0xab31('0xf'));logger[_0xab31('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x168b0b,_0xab31('0xf'),JSON[_0xab31('0x11')](_0x2f3bde));if(_0x2f3bde[_0xab31('0x12')]){if(_0x2f3bde[_0xab31('0x12')]['code']===0x1f4){logger[_0xab31('0x12')](_0xab31('0xe'),_0x168b0b,_0x2f3bde[_0xab31('0x12')][_0xab31('0x13')]);return _0x5f12ed(_0x2f3bde[_0xab31('0x12')][_0xab31('0x13')]);}logger['error'](_0xab31('0xe'),_0x168b0b,_0x2f3bde['error'][_0xab31('0x13')]);return _0x2c87a2(_0x2f3bde[_0xab31('0x12')][_0xab31('0x13')]);}else{logger[_0xab31('0xd')](_0xab31('0xe'),_0x168b0b,_0xab31('0xf'));_0x2c87a2(_0x2f3bde['result'][_0xab31('0x13')]);}})[_0xab31('0x14')](function(_0x3cc14a){logger[_0xab31('0x12')](_0xab31('0xe'),_0x168b0b,_0x3cc14a);_0x5f12ed(_0x3cc14a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2bce2b6..60325fc 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 _0x4f14=['preview','/:id/run','run','/:id/query','query','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview'];(function(_0x23bddf,_0x4c3a28){var _0x3feb29=function(_0x1bcc05){while(--_0x1bcc05){_0x23bddf['push'](_0x23bddf['shift']());}};_0x3feb29(++_0x4c3a28);}(_0x4f14,0x11d));var _0x44f1=function(_0x55edc6,_0x18485c){_0x55edc6=_0x55edc6-0x0;var _0xd2d02c=_0x4f14[_0x55edc6];return _0xd2d02c;};'use strict';var multer=require(_0x44f1('0x0'));var util=require(_0x44f1('0x1'));var path=require(_0x44f1('0x2'));var timeout=require(_0x44f1('0x3'));var express=require(_0x44f1('0x4'));var router=express[_0x44f1('0x5')]();var fs_extra=require(_0x44f1('0x6'));var auth=require(_0x44f1('0x7'));var interaction=require(_0x44f1('0x8'));var config=require('../../config/environment');var controller=require(_0x44f1('0x9'));router[_0x44f1('0xa')]('/',auth[_0x44f1('0xb')](),controller[_0x44f1('0xc')]);router[_0x44f1('0xa')](_0x44f1('0xd'),auth[_0x44f1('0xb')](),controller['show']);router[_0x44f1('0xa')](_0x44f1('0xe'),auth[_0x44f1('0xb')](),controller[_0x44f1('0xf')]);router[_0x44f1('0xa')](_0x44f1('0x10'),auth[_0x44f1('0xb')](),controller[_0x44f1('0x11')]);router['get'](_0x44f1('0x12'),auth[_0x44f1('0xb')](),controller[_0x44f1('0x13')]);router[_0x44f1('0x14')]('/',auth[_0x44f1('0xb')](),controller[_0x44f1('0x15')]);router[_0x44f1('0x16')](_0x44f1('0xd'),auth[_0x44f1('0xb')](),controller['update']);router[_0x44f1('0x17')](_0x44f1('0xd'),auth[_0x44f1('0xb')](),controller['destroy']);module[_0x44f1('0x18')]=router; \ No newline at end of file +var _0x8ef4=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','preview','/:id/run','/:id/query','query','post','create','update','delete','destroy','exports','multer'];(function(_0x12e55a,_0x240ea7){var _0x1d7aec=function(_0x579192){while(--_0x579192){_0x12e55a['push'](_0x12e55a['shift']());}};_0x1d7aec(++_0x240ea7);}(_0x8ef4,0x11d));var _0x48ef=function(_0x7a8365,_0x563ade){_0x7a8365=_0x7a8365-0x0;var _0x55359f=_0x8ef4[_0x7a8365];return _0x55359f;};'use strict';var multer=require(_0x48ef('0x0'));var util=require(_0x48ef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x48ef('0x2'));var router=express[_0x48ef('0x3')]();var fs_extra=require(_0x48ef('0x4'));var auth=require(_0x48ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x48ef('0x6'));var controller=require(_0x48ef('0x7'));router['get']('/',auth[_0x48ef('0x8')](),controller[_0x48ef('0x9')]);router[_0x48ef('0xa')](_0x48ef('0xb'),auth[_0x48ef('0x8')](),controller['show']);router[_0x48ef('0xa')]('/:id/preview',auth['isAuthenticated'](),controller[_0x48ef('0xc')]);router[_0x48ef('0xa')](_0x48ef('0xd'),auth[_0x48ef('0x8')](),controller['run']);router['get'](_0x48ef('0xe'),auth[_0x48ef('0x8')](),controller[_0x48ef('0xf')]);router[_0x48ef('0x10')]('/',auth[_0x48ef('0x8')](),controller[_0x48ef('0x11')]);router['put'](_0x48ef('0xb'),auth['isAuthenticated'](),controller[_0x48ef('0x12')]);router[_0x48ef('0x13')]('/:id',auth[_0x48ef('0x8')](),controller[_0x48ef('0x14')]);module[_0x48ef('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 560f72f..da150e7 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 _0x0244=['scheduled','INTEGER','UNSIGNED','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual'];(function(_0x385ef4,_0x593598){var _0x2a7f3f=function(_0x7898fc){while(--_0x7898fc){_0x385ef4['push'](_0x385ef4['shift']());}};_0x2a7f3f(++_0x593598);}(_0x0244,0x10b));var _0x4024=function(_0x4421a0,_0x1525bc){_0x4421a0=_0x4421a0-0x0;var _0x5626d0=_0x0244[_0x4421a0];return _0x5626d0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x4024('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0x4024('0x1')]('csv',_0x4024('0x2'),_0x4024('0x3')),'allowNull':![],'defaultValue':_0x4024('0x4')},'savename':{'type':Sequelize[_0x4024('0x0')],'allowNull':![]},'startDate':{'type':Sequelize[_0x4024('0x5')]},'endDate':{'type':Sequelize[_0x4024('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x4024('0x6')},'type':{'type':Sequelize['ENUM'](_0x4024('0x7'),_0x4024('0x8')),'allowNull':![],'defaultValue':_0x4024('0x7')},'reportId':{'type':Sequelize[_0x4024('0x9')](0xb)[_0x4024('0xa')]},'reportType':{'type':Sequelize[_0x4024('0x0')]}}; \ No newline at end of file +var _0x24e7=['xlsx','csv','DATE','ENUM','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','pdf'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x24e7,0xdf));var _0x724e=function(_0x3202a5,_0x41aa0f){_0x3202a5=_0x3202a5-0x0;var _0xd8ce1=_0x24e7[_0x3202a5];return _0xd8ce1;};'use strict';var Sequelize=require(_0x724e('0x0'));var moment=require(_0x724e('0x1'));module[_0x724e('0x2')]={'name':{'type':Sequelize[_0x724e('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x724e('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x724e('0x4'),_0x724e('0x5')),'allowNull':![],'defaultValue':_0x724e('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x724e('0x7')]},'endDate':{'type':Sequelize[_0x724e('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x724e('0x8')]('manual',_0x724e('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x724e('0xa')](0xb)[_0x724e('0xb')]},'reportType':{'type':Sequelize[_0x724e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index cfdeb01..1bc5f56 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 _0x98ba=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','get','ExtractedReports','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x98ba,0x147));var _0xa98b=function(_0x3ce878,_0x5bff06){_0x3ce878=_0x3ce878-0x0;var _0x39e51f=_0x98ba[_0x3ce878];return _0x39e51f;};'use strict';var emlformat=require(_0xa98b('0x0'));var rimraf=require(_0xa98b('0x1'));var zipdir=require(_0xa98b('0x2'));var jsonpatch=require(_0xa98b('0x3'));var rp=require('request-promise');var moment=require(_0xa98b('0x4'));var BPromise=require(_0xa98b('0x5'));var Mustache=require(_0xa98b('0x6'));var util=require(_0xa98b('0x7'));var path=require('path');var sox=require(_0xa98b('0x8'));var csv=require('to-csv');var ejs=require(_0xa98b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa98b('0xa'));var squel=require(_0xa98b('0xb'));var crypto=require(_0xa98b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa98b('0xd'));var toCsv=require(_0xa98b('0xe'));var querystring=require(_0xa98b('0xf'));var Papa=require(_0xa98b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa98b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa98b('0x12'));var logger=require(_0xa98b('0x13'))(_0xa98b('0x14'));var utils=require(_0xa98b('0x15'));var config=require(_0xa98b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa98b('0x17'))['db'];function respondWithStatusCode(_0x4e1158,_0x22cf16){_0x22cf16=_0x22cf16||0xcc;return function(_0x45284e){if(_0x45284e){return _0x4e1158[_0xa98b('0x18')](_0x22cf16);}return _0x4e1158[_0xa98b('0x19')](_0x22cf16)[_0xa98b('0x1a')]();};}function respondWithResult(_0x2d0a5f,_0x3efbcc){_0x3efbcc=_0x3efbcc||0xc8;return function(_0x42922b){if(_0x42922b){return _0x2d0a5f[_0xa98b('0x19')](_0x3efbcc)[_0xa98b('0x1b')](_0x42922b);}};}function respondWithFilteredResult(_0x27153b,_0x12f5da){return function(_0x36b004){if(_0x36b004){var _0x52c2e2=typeof _0x12f5da[_0xa98b('0x1c')]===_0xa98b('0x1d')&&typeof _0x12f5da[_0xa98b('0x1e')]===_0xa98b('0x1d');var _0x498e64=_0x36b004[_0xa98b('0x1f')];var _0x292ade=_0x52c2e2?0x0:_0x12f5da[_0xa98b('0x1c')];var _0x181ab9=_0x52c2e2?_0x36b004[_0xa98b('0x1f')]:_0x12f5da[_0xa98b('0x1c')]+_0x12f5da['limit'];var _0x3f4880;if(_0x181ab9>=_0x498e64){_0x181ab9=_0x498e64;_0x3f4880=0xc8;}else{_0x3f4880=0xce;}_0x27153b['status'](_0x3f4880);return _0x27153b[_0xa98b('0x20')](_0xa98b('0x21'),_0x292ade+'-'+_0x181ab9+'/'+_0x498e64)[_0xa98b('0x1b')](_0x36b004);}return null;};}function patchUpdates(_0xb3e6ed){return function(_0x11abea){try{jsonpatch[_0xa98b('0x22')](_0x11abea,_0xb3e6ed,!![]);}catch(_0x4f3dc9){return BPromise[_0xa98b('0x23')](_0x4f3dc9);}return _0x11abea['save']();};}function saveUpdates(_0x233c6f,_0x3c712b){return function(_0x550ae0){if(_0x550ae0){return _0x550ae0['update'](_0x233c6f)['then'](function(_0x28a356){return _0x28a356;});}return null;};}function removeEntity(_0x5bc0d4,_0x5e0eff){return function(_0x54d478){if(_0x54d478){return _0x54d478[_0xa98b('0x24')]()[_0xa98b('0x25')](function(){var _0x102109=_0x54d478[_0xa98b('0x26')]({'plain':!![]});var _0x4f119f=_0xa98b('0x27');return db['UserProfileResource'][_0xa98b('0x24')]({'where':{'type':_0x4f119f,'resourceId':_0x102109['id']}})[_0xa98b('0x25')](function(){return _0x54d478;});})[_0xa98b('0x25')](function(){_0x5bc0d4[_0xa98b('0x19')](0xcc)[_0xa98b('0x1a')]();});}};}function handleEntityNotFound(_0x495c88,_0x4e4bf7){return function(_0x19c6cb){if(!_0x19c6cb){_0x495c88[_0xa98b('0x18')](0x194);}return _0x19c6cb;};}function handleError(_0x15daf9,_0x469e7a){_0x469e7a=_0x469e7a||0x1f4;return function(_0x2524ea){logger['error'](_0x2524ea[_0xa98b('0x28')]);if(_0x2524ea[_0xa98b('0x29')]){delete _0x2524ea[_0xa98b('0x29')];}_0x15daf9[_0xa98b('0x19')](_0x469e7a)[_0xa98b('0x2a')](_0x2524ea);};}exports[_0xa98b('0x2b')]=function(_0x58e809,_0x406a4c){var _0x227797={},_0x5a78db={},_0x1a7038={'count':0x0,'rows':[]};var _0x1bd565=_[_0xa98b('0x2c')](db[_0xa98b('0x2d')][_0xa98b('0x2e')],function(_0x4aa678){return{'name':_0x4aa678[_0xa98b('0x2f')],'type':_0x4aa678[_0xa98b('0x30')][_0xa98b('0x31')]};});_0x5a78db[_0xa98b('0x32')]=_['map'](_0x1bd565,_0xa98b('0x29'));_0x5a78db[_0xa98b('0x33')]=_[_0xa98b('0x34')](_0x58e809[_0xa98b('0x33')]);_0x5a78db[_0xa98b('0x35')]=_[_0xa98b('0x36')](_0x5a78db[_0xa98b('0x32')],_0x5a78db[_0xa98b('0x33')]);_0x227797[_0xa98b('0x37')]=_['intersection'](_0x5a78db['model'],qs[_0xa98b('0x38')](_0x58e809['query'][_0xa98b('0x38')]));_0x227797[_0xa98b('0x37')]=_0x227797[_0xa98b('0x37')][_0xa98b('0x39')]?_0x227797[_0xa98b('0x37')]:_0x5a78db[_0xa98b('0x32')];if(!_0x58e809[_0xa98b('0x33')][_0xa98b('0x3a')](_0xa98b('0x3b'))){_0x227797[_0xa98b('0x1e')]=qs['limit'](_0x58e809[_0xa98b('0x33')][_0xa98b('0x1e')]);_0x227797[_0xa98b('0x1c')]=qs[_0xa98b('0x1c')](_0x58e809[_0xa98b('0x33')][_0xa98b('0x1c')]);}_0x227797['order']=qs[_0xa98b('0x3c')](_0x58e809[_0xa98b('0x33')]['sort']);_0x227797[_0xa98b('0x3d')]=qs['filters'](_[_0xa98b('0x3e')](_0x58e809[_0xa98b('0x33')],_0x5a78db[_0xa98b('0x35')]),_0x1bd565);if(_0x58e809[_0xa98b('0x33')][_0xa98b('0x3f')]){_0x227797[_0xa98b('0x3d')]=_[_0xa98b('0x40')](_0x227797[_0xa98b('0x3d')],{'$or':_['map'](_0x1bd565,function(_0x3b23ff){if(_0x3b23ff['type']!==_0xa98b('0x41')){var _0x50bc61={};_0x50bc61[_0x3b23ff[_0xa98b('0x29')]]={'$like':'%'+_0x58e809[_0xa98b('0x33')][_0xa98b('0x3f')]+'%'};return _0x50bc61;}})});}_0x227797=_[_0xa98b('0x40')]({},_0x227797,_0x58e809['options']);var _0x132760={'where':_0x227797[_0xa98b('0x3d')]};return db[_0xa98b('0x2d')][_0xa98b('0x1f')](_0x132760)['then'](function(_0x502fc1){_0x1a7038[_0xa98b('0x1f')]=_0x502fc1;if(_0x58e809[_0xa98b('0x33')][_0xa98b('0x42')]){_0x227797[_0xa98b('0x43')]=[{'all':!![]}];}return db[_0xa98b('0x2d')][_0xa98b('0x44')](_0x227797);})[_0xa98b('0x25')](function(_0x2c9e20){_0x1a7038['rows']=_0x2c9e20;return _0x1a7038;})[_0xa98b('0x25')](respondWithFilteredResult(_0x406a4c,_0x227797))['catch'](handleError(_0x406a4c,null));};exports[_0xa98b('0x45')]=function(_0x3cf813,_0xea6b9d){var _0x3c748a={'raw':!![],'where':{'id':_0x3cf813[_0xa98b('0x46')]['id']}},_0x18ff73={};_0x18ff73[_0xa98b('0x32')]=_[_0xa98b('0x34')](db[_0xa98b('0x2d')][_0xa98b('0x2e')]);_0x18ff73[_0xa98b('0x33')]=_[_0xa98b('0x34')](_0x3cf813[_0xa98b('0x33')]);_0x18ff73[_0xa98b('0x35')]=_['intersection'](_0x18ff73[_0xa98b('0x32')],_0x18ff73[_0xa98b('0x33')]);_0x3c748a[_0xa98b('0x37')]=_[_0xa98b('0x36')](_0x18ff73[_0xa98b('0x32')],qs[_0xa98b('0x38')](_0x3cf813[_0xa98b('0x33')][_0xa98b('0x38')]));_0x3c748a[_0xa98b('0x37')]=_0x3c748a[_0xa98b('0x37')][_0xa98b('0x39')]?_0x3c748a[_0xa98b('0x37')]:_0x18ff73[_0xa98b('0x32')];if(_0x3cf813[_0xa98b('0x33')][_0xa98b('0x42')]){_0x3c748a[_0xa98b('0x43')]=[{'all':!![]}];}_0x3c748a=_[_0xa98b('0x40')]({},_0x3c748a,_0x3cf813[_0xa98b('0x47')]);return db[_0xa98b('0x2d')]['find'](_0x3c748a)[_0xa98b('0x25')](handleEntityNotFound(_0xea6b9d,null))[_0xa98b('0x25')](respondWithResult(_0xea6b9d,null))[_0xa98b('0x48')](handleError(_0xea6b9d,null));};exports[_0xa98b('0x49')]=function(_0x2e9a10,_0x473ce8){return db[_0xa98b('0x2d')][_0xa98b('0x49')](_0x2e9a10[_0xa98b('0x4a')],{})[_0xa98b('0x25')](function(_0x3fba50){var _0x341936=_0x2e9a10[_0xa98b('0x4b')]['get']({'plain':!![]});if(!_0x341936)throw new Error(_0xa98b('0x4c'));if(_0x341936[_0xa98b('0x4d')]===_0xa98b('0x4b')){var _0x86c04e=_0x3fba50[_0xa98b('0x26')]({'plain':!![]});var _0x4e3587=_0xa98b('0x27');return db[_0xa98b('0x4e')][_0xa98b('0x4f')]({'where':{'name':_0x4e3587,'userProfileId':_0x341936['userProfileId']},'raw':!![]})[_0xa98b('0x25')](function(_0x12f9b9){if(_0x12f9b9&&_0x12f9b9['autoAssociation']===0x0){return db[_0xa98b('0x50')]['create']({'name':_0x86c04e[_0xa98b('0x29')],'resourceId':_0x86c04e['id'],'type':_0x12f9b9[_0xa98b('0x29')],'sectionId':_0x12f9b9['id']},{})['then'](function(){return _0x3fba50;});}else{return _0x3fba50;}})[_0xa98b('0x48')](function(_0x418dd0){logger[_0xa98b('0x51')](_0xa98b('0x52'),_0x418dd0);throw _0x418dd0;});}return _0x3fba50;})[_0xa98b('0x25')](respondWithResult(_0x473ce8,0xc9))[_0xa98b('0x48')](handleError(_0x473ce8,null));};exports['update']=function(_0xaea4ae,_0x148603){if(_0xaea4ae[_0xa98b('0x4a')]['id']){delete _0xaea4ae['body']['id'];}return db[_0xa98b('0x2d')][_0xa98b('0x4f')]({'where':{'id':_0xaea4ae[_0xa98b('0x46')]['id']}})[_0xa98b('0x25')](handleEntityNotFound(_0x148603,null))[_0xa98b('0x25')](saveUpdates(_0xaea4ae[_0xa98b('0x4a')],null))[_0xa98b('0x25')](respondWithResult(_0x148603,null))[_0xa98b('0x48')](handleError(_0x148603,null));};exports[_0xa98b('0x24')]=function(_0x6408e3,_0x3d5344){return db['AnalyticExtractedReport'][_0xa98b('0x4f')]({'where':{'id':_0x6408e3[_0xa98b('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d5344,null))[_0xa98b('0x25')](removeEntity(_0x3d5344,null))[_0xa98b('0x48')](handleError(_0x3d5344,null));};exports[_0xa98b('0x53')]=function(_0xa264e7,_0x24db6e,_0x32b25c){return db[_0xa98b('0x2d')]['find']({'where':{'id':_0xa264e7[_0xa98b('0x46')]['id']},'attributes':[_0xa98b('0x29'),_0xa98b('0x54'),_0xa98b('0x55'),_0xa98b('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x24db6e,null))[_0xa98b('0x25')](function(_0x52b386){if(_0x52b386){if(!fs[_0xa98b('0x57')](path[_0xa98b('0x58')](config[_0xa98b('0x59')],_0xa98b('0x5a'),_0x52b386[_0xa98b('0x55')]))){throw new db['Sequelize'][(_0xa98b('0x5b'))](_0xa98b('0x5c'));}if(_0xa264e7[_0xa98b('0x33')][_0xa98b('0x5d')]){return _0x24db6e[_0xa98b('0x18')](0xc8);}return _0x24db6e['download'](path[_0xa98b('0x58')](config['root'],_0xa98b('0x5a'),_0x52b386[_0xa98b('0x55')]),util['format']('%s.%s',_0x52b386[_0xa98b('0x54')]||_0x52b386[_0xa98b('0x29')],_0x52b386[_0xa98b('0x56')][_0xa98b('0x5e')]()));}})[_0xa98b('0x48')](handleError(_0x24db6e,null));}; \ No newline at end of file +var _0xe815=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','type','VIRTUAL','merge','options','AnalyticExtractedReport','includeAll','include','rows','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','update','params','download','basename','savename','output','existsSync','join','server/files/reports','ValidationError','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x263ba6,_0x54b977){var _0x110a7a=function(_0x50a2cd){while(--_0x50a2cd){_0x263ba6['push'](_0x263ba6['shift']());}};_0x110a7a(++_0x54b977);}(_0xe815,0x1dc));var _0x5e81=function(_0x4f785c,_0x301bff){_0x4f785c=_0x4f785c-0x0;var _0x3d81f8=_0xe815[_0x4f785c];return _0x3d81f8;};'use strict';var emlformat=require(_0x5e81('0x0'));var rimraf=require(_0x5e81('0x1'));var zipdir=require(_0x5e81('0x2'));var jsonpatch=require(_0x5e81('0x3'));var rp=require('request-promise');var moment=require(_0x5e81('0x4'));var BPromise=require(_0x5e81('0x5'));var Mustache=require('mustache');var util=require(_0x5e81('0x6'));var path=require(_0x5e81('0x7'));var sox=require(_0x5e81('0x8'));var csv=require(_0x5e81('0x9'));var ejs=require(_0x5e81('0xa'));var fs=require('fs');var fs_extra=require(_0x5e81('0xb'));var _=require(_0x5e81('0xc'));var squel=require('squel');var crypto=require(_0x5e81('0xd'));var jsforce=require(_0x5e81('0xe'));var deskjs=require(_0x5e81('0xf'));var toCsv=require(_0x5e81('0x9'));var querystring=require(_0x5e81('0x10'));var Papa=require(_0x5e81('0x11'));var Redis=require(_0x5e81('0x12'));var authService=require(_0x5e81('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5e81('0x14'));var hardwareService=require(_0x5e81('0x15'));var logger=require(_0x5e81('0x16'))(_0x5e81('0x17'));var utils=require('../../config/utils');var config=require(_0x5e81('0x18'));var licenseUtil=require(_0x5e81('0x19'));var db=require(_0x5e81('0x1a'))['db'];function respondWithStatusCode(_0x11b798,_0x4adfd7){_0x4adfd7=_0x4adfd7||0xcc;return function(_0x5f0308){if(_0x5f0308){return _0x11b798[_0x5e81('0x1b')](_0x4adfd7);}return _0x11b798[_0x5e81('0x1c')](_0x4adfd7)[_0x5e81('0x1d')]();};}function respondWithResult(_0x502db7,_0x71e3f8){_0x71e3f8=_0x71e3f8||0xc8;return function(_0x550848){if(_0x550848){return _0x502db7[_0x5e81('0x1c')](_0x71e3f8)[_0x5e81('0x1e')](_0x550848);}};}function respondWithFilteredResult(_0x5e0ab3,_0x2f3ffd){return function(_0x3765e0){if(_0x3765e0){var _0x384395=typeof _0x2f3ffd[_0x5e81('0x1f')]===_0x5e81('0x20')&&typeof _0x2f3ffd['limit']===_0x5e81('0x20');var _0x5577f7=_0x3765e0[_0x5e81('0x21')];var _0x58b997=_0x384395?0x0:_0x2f3ffd['offset'];var _0x5d690e=_0x384395?_0x3765e0[_0x5e81('0x21')]:_0x2f3ffd['offset']+_0x2f3ffd[_0x5e81('0x22')];var _0x39a4b8;if(_0x5d690e>=_0x5577f7){_0x5d690e=_0x5577f7;_0x39a4b8=0xc8;}else{_0x39a4b8=0xce;}_0x5e0ab3[_0x5e81('0x1c')](_0x39a4b8);return _0x5e0ab3[_0x5e81('0x23')](_0x5e81('0x24'),_0x58b997+'-'+_0x5d690e+'/'+_0x5577f7)[_0x5e81('0x1e')](_0x3765e0);}return null;};}function patchUpdates(_0x507ec3){return function(_0x3d5e3c){try{jsonpatch[_0x5e81('0x25')](_0x3d5e3c,_0x507ec3,!![]);}catch(_0x323975){return BPromise['reject'](_0x323975);}return _0x3d5e3c[_0x5e81('0x26')]();};}function saveUpdates(_0x4db016,_0x1e9ea7){return function(_0x779424){if(_0x779424){return _0x779424['update'](_0x4db016)[_0x5e81('0x27')](function(_0x4ad617){return _0x4ad617;});}return null;};}function removeEntity(_0x328bbf,_0x3899c6){return function(_0x54ad74){if(_0x54ad74){return _0x54ad74[_0x5e81('0x28')]()[_0x5e81('0x27')](function(){var _0x3ccb87=_0x54ad74[_0x5e81('0x29')]({'plain':!![]});var _0x2dd980=_0x5e81('0x2a');return db[_0x5e81('0x2b')][_0x5e81('0x28')]({'where':{'type':_0x2dd980,'resourceId':_0x3ccb87['id']}})[_0x5e81('0x27')](function(){return _0x54ad74;});})['then'](function(){_0x328bbf['status'](0xcc)[_0x5e81('0x1d')]();});}};}function handleEntityNotFound(_0x64b69a,_0x2fa316){return function(_0x26025f){if(!_0x26025f){_0x64b69a[_0x5e81('0x1b')](0x194);}return _0x26025f;};}function handleError(_0x20d452,_0x536f1c){_0x536f1c=_0x536f1c||0x1f4;return function(_0x359dd6){logger[_0x5e81('0x2c')](_0x359dd6[_0x5e81('0x2d')]);if(_0x359dd6['name']){delete _0x359dd6['name'];}_0x20d452[_0x5e81('0x1c')](_0x536f1c)[_0x5e81('0x2e')](_0x359dd6);};}exports[_0x5e81('0x2f')]=function(_0x442a1c,_0x457a13){var _0x495b1b={},_0x3ec488={},_0x3119e8={'count':0x0,'rows':[]};var _0x3e3527=_[_0x5e81('0x30')](db['AnalyticExtractedReport'][_0x5e81('0x31')],function(_0x458c63){return{'name':_0x458c63[_0x5e81('0x32')],'type':_0x458c63['type'][_0x5e81('0x33')]};});_0x3ec488[_0x5e81('0x34')]=_[_0x5e81('0x30')](_0x3e3527,_0x5e81('0x35'));_0x3ec488[_0x5e81('0x36')]=_['keys'](_0x442a1c[_0x5e81('0x36')]);_0x3ec488['filters']=_['intersection'](_0x3ec488[_0x5e81('0x34')],_0x3ec488['query']);_0x495b1b[_0x5e81('0x37')]=_[_0x5e81('0x38')](_0x3ec488[_0x5e81('0x34')],qs[_0x5e81('0x39')](_0x442a1c[_0x5e81('0x36')][_0x5e81('0x39')]));_0x495b1b[_0x5e81('0x37')]=_0x495b1b[_0x5e81('0x37')][_0x5e81('0x3a')]?_0x495b1b[_0x5e81('0x37')]:_0x3ec488[_0x5e81('0x34')];if(!_0x442a1c['query'][_0x5e81('0x3b')](_0x5e81('0x3c'))){_0x495b1b['limit']=qs[_0x5e81('0x22')](_0x442a1c[_0x5e81('0x36')][_0x5e81('0x22')]);_0x495b1b['offset']=qs[_0x5e81('0x1f')](_0x442a1c[_0x5e81('0x36')][_0x5e81('0x1f')]);}_0x495b1b['order']=qs[_0x5e81('0x3d')](_0x442a1c[_0x5e81('0x36')][_0x5e81('0x3d')]);_0x495b1b['where']=qs['filters'](_[_0x5e81('0x3e')](_0x442a1c[_0x5e81('0x36')],_0x3ec488[_0x5e81('0x3f')]),_0x3e3527);if(_0x442a1c['query'][_0x5e81('0x40')]){_0x495b1b[_0x5e81('0x41')]=_['merge'](_0x495b1b[_0x5e81('0x41')],{'$or':_['map'](_0x3e3527,function(_0x5855fc){if(_0x5855fc[_0x5e81('0x42')]!==_0x5e81('0x43')){var _0x4fc130={};_0x4fc130[_0x5855fc[_0x5e81('0x35')]]={'$like':'%'+_0x442a1c[_0x5e81('0x36')]['filter']+'%'};return _0x4fc130;}})});}_0x495b1b=_[_0x5e81('0x44')]({},_0x495b1b,_0x442a1c[_0x5e81('0x45')]);var _0x3027f8={'where':_0x495b1b[_0x5e81('0x41')]};return db[_0x5e81('0x46')][_0x5e81('0x21')](_0x3027f8)[_0x5e81('0x27')](function(_0x2e62ad){_0x3119e8[_0x5e81('0x21')]=_0x2e62ad;if(_0x442a1c[_0x5e81('0x36')][_0x5e81('0x47')]){_0x495b1b[_0x5e81('0x48')]=[{'all':!![]}];}return db[_0x5e81('0x46')]['findAll'](_0x495b1b);})['then'](function(_0xbd1b21){_0x3119e8[_0x5e81('0x49')]=_0xbd1b21;return _0x3119e8;})[_0x5e81('0x27')](respondWithFilteredResult(_0x457a13,_0x495b1b))[_0x5e81('0x4a')](handleError(_0x457a13,null));};exports[_0x5e81('0x4b')]=function(_0x40595a,_0x222008){var _0x3e35f8={'raw':!![],'where':{'id':_0x40595a['params']['id']}},_0x10385a={};_0x10385a[_0x5e81('0x34')]=_[_0x5e81('0x4c')](db[_0x5e81('0x46')][_0x5e81('0x31')]);_0x10385a[_0x5e81('0x36')]=_[_0x5e81('0x4c')](_0x40595a[_0x5e81('0x36')]);_0x10385a[_0x5e81('0x3f')]=_[_0x5e81('0x38')](_0x10385a[_0x5e81('0x34')],_0x10385a['query']);_0x3e35f8[_0x5e81('0x37')]=_[_0x5e81('0x38')](_0x10385a['model'],qs[_0x5e81('0x39')](_0x40595a[_0x5e81('0x36')][_0x5e81('0x39')]));_0x3e35f8[_0x5e81('0x37')]=_0x3e35f8['attributes']['length']?_0x3e35f8[_0x5e81('0x37')]:_0x10385a[_0x5e81('0x34')];if(_0x40595a[_0x5e81('0x36')][_0x5e81('0x47')]){_0x3e35f8[_0x5e81('0x48')]=[{'all':!![]}];}_0x3e35f8=_[_0x5e81('0x44')]({},_0x3e35f8,_0x40595a['options']);return db[_0x5e81('0x46')]['find'](_0x3e35f8)[_0x5e81('0x27')](handleEntityNotFound(_0x222008,null))['then'](respondWithResult(_0x222008,null))[_0x5e81('0x4a')](handleError(_0x222008,null));};exports[_0x5e81('0x4d')]=function(_0x5da436,_0x4b8f33){return db[_0x5e81('0x46')][_0x5e81('0x4d')](_0x5da436[_0x5e81('0x4e')],{})[_0x5e81('0x27')](function(_0x1a0c41){var _0x32266a=_0x5da436[_0x5e81('0x4f')]['get']({'plain':!![]});if(!_0x32266a)throw new Error(_0x5e81('0x50'));if(_0x32266a[_0x5e81('0x51')]===_0x5e81('0x4f')){var _0x502ef7=_0x1a0c41[_0x5e81('0x29')]({'plain':!![]});var _0x25bac1=_0x5e81('0x2a');return db['UserProfileSection'][_0x5e81('0x52')]({'where':{'name':_0x25bac1,'userProfileId':_0x32266a[_0x5e81('0x53')]},'raw':!![]})[_0x5e81('0x27')](function(_0x40dc96){if(_0x40dc96&&_0x40dc96[_0x5e81('0x54')]===0x0){return db[_0x5e81('0x2b')]['create']({'name':_0x502ef7[_0x5e81('0x35')],'resourceId':_0x502ef7['id'],'type':_0x40dc96['name'],'sectionId':_0x40dc96['id']},{})['then'](function(){return _0x1a0c41;});}else{return _0x1a0c41;}})[_0x5e81('0x4a')](function(_0x36ff00){logger[_0x5e81('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36ff00);throw _0x36ff00;});}return _0x1a0c41;})[_0x5e81('0x27')](respondWithResult(_0x4b8f33,0xc9))['catch'](handleError(_0x4b8f33,null));};exports[_0x5e81('0x55')]=function(_0x50f4b3,_0x390af1){if(_0x50f4b3['body']['id']){delete _0x50f4b3[_0x5e81('0x4e')]['id'];}return db[_0x5e81('0x46')][_0x5e81('0x52')]({'where':{'id':_0x50f4b3[_0x5e81('0x56')]['id']}})[_0x5e81('0x27')](handleEntityNotFound(_0x390af1,null))['then'](saveUpdates(_0x50f4b3[_0x5e81('0x4e')],null))[_0x5e81('0x27')](respondWithResult(_0x390af1,null))[_0x5e81('0x4a')](handleError(_0x390af1,null));};exports[_0x5e81('0x28')]=function(_0x22fc81,_0x259fa6){return db[_0x5e81('0x46')]['find']({'where':{'id':_0x22fc81['params']['id']}})['then'](handleEntityNotFound(_0x259fa6,null))[_0x5e81('0x27')](removeEntity(_0x259fa6,null))['catch'](handleError(_0x259fa6,null));};exports[_0x5e81('0x57')]=function(_0x3a12f8,_0x1177c9,_0x19df6f){return db[_0x5e81('0x46')]['find']({'where':{'id':_0x3a12f8[_0x5e81('0x56')]['id']},'attributes':[_0x5e81('0x35'),_0x5e81('0x58'),_0x5e81('0x59'),_0x5e81('0x5a')],'raw':!![]})[_0x5e81('0x27')](handleEntityNotFound(_0x1177c9,null))['then'](function(_0x3b7250){if(_0x3b7250){if(!fs[_0x5e81('0x5b')](path[_0x5e81('0x5c')](config['root'],_0x5e81('0x5d'),_0x3b7250[_0x5e81('0x59')]))){throw new db['Sequelize'][(_0x5e81('0x5e'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x3a12f8[_0x5e81('0x36')]['exists']){return _0x1177c9[_0x5e81('0x1b')](0xc8);}return _0x1177c9[_0x5e81('0x57')](path[_0x5e81('0x5c')](config['root'],_0x5e81('0x5d'),_0x3b7250['savename']),util[_0x5e81('0x5f')](_0x5e81('0x60'),_0x3b7250[_0x5e81('0x58')]||_0x3b7250['name'],_0x3b7250[_0x5e81('0x5a')][_0x5e81('0x61')]()));}})[_0x5e81('0x4a')](handleError(_0x1177c9,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 4c38967..eb5d6b7 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 _0x5beb=['moment','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api'];(function(_0x86f228,_0x6e0345){var _0x3b0c39=function(_0xa7cb1d){while(--_0xa7cb1d){_0x86f228['push'](_0x86f228['shift']());}};_0x3b0c39(++_0x6e0345);}(_0x5beb,0x81));var _0xb5be=function(_0x3f22a9,_0x2908fb){_0x3f22a9=_0x3f22a9-0x0;var _0x48143c=_0x5beb[_0x3f22a9];return _0x48143c;};'use strict';var _=require(_0xb5be('0x0'));var util=require(_0xb5be('0x1'));var logger=require('../../config/logger')(_0xb5be('0x2'));var moment=require(_0xb5be('0x3'));var BPromise=require('bluebird');var rp=require(_0xb5be('0x4'));var fs=require('fs');var path=require(_0xb5be('0x5'));var rimraf=require('rimraf');var config=require(_0xb5be('0x6'));var attributes=require(_0xb5be('0x7'));module[_0xb5be('0x8')]=function(_0x141bcb,_0x47bc3d){return _0x141bcb[_0xb5be('0x9')](_0xb5be('0xa'),attributes,{'tableName':_0xb5be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7169=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash'];(function(_0x95cf3f,_0x25e260){var _0x305d5f=function(_0x59e82c){while(--_0x59e82c){_0x95cf3f['push'](_0x95cf3f['shift']());}};_0x305d5f(++_0x25e260);}(_0x7169,0x1af));var _0x9716=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7169[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x9716('0x0'));var util=require('util');var logger=require(_0x9716('0x1'))(_0x9716('0x2'));var moment=require(_0x9716('0x3'));var BPromise=require('bluebird');var rp=require(_0x9716('0x4'));var fs=require('fs');var path=require(_0x9716('0x5'));var rimraf=require(_0x9716('0x6'));var config=require(_0x9716('0x7'));var attributes=require(_0x9716('0x8'));module[_0x9716('0x9')]=function(_0xffdb6,_0xdcb2a3){return _0xffdb6[_0x9716('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0x9716('0xb'),'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 62228a0..4c890fc 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 _0x1c52=['code','message','info','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5d5fcd,_0x165444){var _0x5ec451=function(_0x1fb0c5){while(--_0x1fb0c5){_0x5d5fcd['push'](_0x5d5fcd['shift']());}};_0x5ec451(++_0x165444);}(_0x1c52,0x7c));var _0x21c5=function(_0x50c1cf,_0x4d75e8){_0x50c1cf=_0x50c1cf-0x0;var _0x4c285c=_0x1c52[_0x50c1cf];return _0x4c285c;};'use strict';var _=require(_0x21c5('0x0'));var util=require(_0x21c5('0x1'));var moment=require(_0x21c5('0x2'));var BPromise=require(_0x21c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x21c5('0x4'));var logger=require(_0x21c5('0x5'))('rpc');var config=require(_0x21c5('0x6'));var jayson=require(_0x21c5('0x7'));var client=jayson[_0x21c5('0x8')][_0x21c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b12d5,_0xed0195,_0xb4b1e4){return new BPromise(function(_0x4c5a4f,_0xd34da2){return client[_0x21c5('0xa')](_0x5b12d5,_0xb4b1e4)[_0x21c5('0xb')](function(_0x27389f){logger['info'](_0x21c5('0xc'),_0xed0195,_0x21c5('0xd'));logger[_0x21c5('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0xed0195,_0x21c5('0xd'),JSON['stringify'](_0x27389f));if(_0x27389f[_0x21c5('0xf')]){if(_0x27389f[_0x21c5('0xf')][_0x21c5('0x10')]===0x1f4){logger[_0x21c5('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xed0195,_0x27389f[_0x21c5('0xf')]['message']);return _0xd34da2(_0x27389f[_0x21c5('0xf')][_0x21c5('0x11')]);}logger['error'](_0x21c5('0xc'),_0xed0195,_0x27389f['error']['message']);return _0x4c5a4f(_0x27389f[_0x21c5('0xf')][_0x21c5('0x11')]);}else{logger[_0x21c5('0x12')](_0x21c5('0xc'),_0xed0195,_0x21c5('0xd'));_0x4c5a4f(_0x27389f[_0x21c5('0x13')][_0x21c5('0x11')]);}})['catch'](function(_0x331080){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0xed0195,_0x331080);_0xd34da2(_0x331080);});});} \ No newline at end of file +var _0x61ac=['ioredis','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticExtractedReport,\x20%s,\x20%s','catch','util','bluebird','randomstring'];(function(_0x60277,_0x1e776a){var _0x1f48aa=function(_0x2f3972){while(--_0x2f3972){_0x60277['push'](_0x60277['shift']());}};_0x1f48aa(++_0x1e776a);}(_0x61ac,0x82));var _0xc61a=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x61ac[_0x30b0d8];return _0x459c09;};'use strict';var _=require('lodash');var util=require(_0xc61a('0x0'));var moment=require('moment');var BPromise=require(_0xc61a('0x1'));var rs=require(_0xc61a('0x2'));var fs=require('fs');var Redis=require(_0xc61a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc61a('0x4'))(_0xc61a('0x5'));var config=require(_0xc61a('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd3713d,_0x44dc3a,_0x18c5f6){return new BPromise(function(_0x142793,_0x249565){return client[_0xc61a('0x7')](_0xd3713d,_0x18c5f6)[_0xc61a('0x8')](function(_0x11db87){logger[_0xc61a('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x44dc3a,_0xc61a('0xa'));logger[_0xc61a('0xb')](_0xc61a('0xc'),_0x44dc3a,_0xc61a('0xa'),JSON[_0xc61a('0xd')](_0x11db87));if(_0x11db87[_0xc61a('0xe')]){if(_0x11db87['error'][_0xc61a('0xf')]===0x1f4){logger[_0xc61a('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x44dc3a,_0x11db87[_0xc61a('0xe')]['message']);return _0x249565(_0x11db87['error'][_0xc61a('0x10')]);}logger['error'](_0xc61a('0x11'),_0x44dc3a,_0x11db87['error'][_0xc61a('0x10')]);return _0x142793(_0x11db87[_0xc61a('0xe')][_0xc61a('0x10')]);}else{logger[_0xc61a('0x9')](_0xc61a('0x11'),_0x44dc3a,'request\x20sent');_0x142793(_0x11db87['result']['message']);}})[_0xc61a('0x12')](function(_0x2af687){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x44dc3a,_0x2af687);_0x249565(_0x2af687);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b1d301c..f7fca46 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 _0x7311=['/:id','show','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x7311,0xc6));var _0x1731=function(_0x2d4686,_0x3d6dbb){_0x2d4686=_0x2d4686-0x0;var _0x16f68b=_0x7311[_0x2d4686];return _0x16f68b;};'use strict';var multer=require(_0x1731('0x0'));var util=require(_0x1731('0x1'));var path=require(_0x1731('0x2'));var timeout=require(_0x1731('0x3'));var express=require(_0x1731('0x4'));var router=express[_0x1731('0x5')]();var fs_extra=require(_0x1731('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1731('0x7'));var controller=require(_0x1731('0x8'));router[_0x1731('0x9')]('/',auth[_0x1731('0xa')](),controller[_0x1731('0xb')]);router['get'](_0x1731('0xc'),auth['isAuthenticated'](),controller[_0x1731('0xd')]);router['get']('/:id/download',auth[_0x1731('0xa')](),controller[_0x1731('0xe')]);router[_0x1731('0xf')]('/',auth['isAuthenticated'](),controller[_0x1731('0x10')]);router[_0x1731('0x11')]('/:id',auth[_0x1731('0xa')](),controller[_0x1731('0x12')]);router[_0x1731('0x13')](_0x1731('0xc'),auth[_0x1731('0xa')](),controller[_0x1731('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6cef=['/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','delete'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x6cef,0x168));var _0xf6ce=function(_0x5759e0,_0x31984b){_0x5759e0=_0x5759e0-0x0;var _0x1a64cd=_0x6cef[_0x5759e0];return _0x1a64cd;};'use strict';var multer=require(_0xf6ce('0x0'));var util=require(_0xf6ce('0x1'));var path=require('path');var timeout=require(_0xf6ce('0x2'));var express=require(_0xf6ce('0x3'));var router=express['Router']();var fs_extra=require(_0xf6ce('0x4'));var auth=require(_0xf6ce('0x5'));var interaction=require(_0xf6ce('0x6'));var config=require(_0xf6ce('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0xf6ce('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xf6ce('0x9')](),controller[_0xf6ce('0xa')]);router[_0xf6ce('0x8')]('/:id/download',auth[_0xf6ce('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xf6ce('0xb')]);router[_0xf6ce('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf6ce('0xd')](_0xf6ce('0xe'),auth[_0xf6ce('0x9')](),controller[_0xf6ce('0xf')]);module[_0xf6ce('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3604fab..a534833 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 _0xdebb=['TEXT','STRING','BOOLEAN','exports'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0xdebb,0x19f));var _0xbdeb=function(_0x51a5f0,_0x242359){_0x51a5f0=_0x51a5f0-0x0;var _0x5e4c22=_0xdebb[_0x51a5f0];return _0x5e4c22;};'use strict';var Sequelize=require('sequelize');module[_0xbdeb('0x0')]={'field':{'type':Sequelize[_0xbdeb('0x1')]},'alias':{'type':Sequelize[_0xbdeb('0x2')]},'function':{'type':Sequelize[_0xbdeb('0x2')]},'format':{'type':Sequelize[_0xbdeb('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbdeb('0x2')]},'custom':{'type':Sequelize[_0xbdeb('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9957=['exports','STRING','BOOLEAN','sequelize'];(function(_0x145a20,_0x36bf23){var _0x2e94a2=function(_0x1a2666){while(--_0x1a2666){_0x145a20['push'](_0x145a20['shift']());}};_0x2e94a2(++_0x36bf23);}(_0x9957,0x1c7));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x7995('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x7995('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x7995('0x2')]},'custom':{'type':Sequelize[_0x7995('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 6c0bb7a..0c39fb1 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 _0xb107=['filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','find','catch','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','status','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x595e6a,_0x470428){var _0x1ab357=function(_0x13be26){while(--_0x13be26){_0x595e6a['push'](_0x595e6a['shift']());}};_0x1ab357(++_0x470428);}(_0xb107,0x157));var _0x7b10=function(_0x43ae08,_0x17c9a7){_0x43ae08=_0x43ae08-0x0;var _0x368c3e=_0xb107[_0x43ae08];return _0x368c3e;};'use strict';var emlformat=require(_0x7b10('0x0'));var rimraf=require(_0x7b10('0x1'));var zipdir=require(_0x7b10('0x2'));var jsonpatch=require(_0x7b10('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7b10('0x4'));var Mustache=require(_0x7b10('0x5'));var util=require(_0x7b10('0x6'));var path=require(_0x7b10('0x7'));var sox=require(_0x7b10('0x8'));var csv=require(_0x7b10('0x9'));var ejs=require(_0x7b10('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b10('0xb'));var squel=require(_0x7b10('0xc'));var crypto=require(_0x7b10('0xd'));var jsforce=require(_0x7b10('0xe'));var deskjs=require(_0x7b10('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b10('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b10('0x11'));var logger=require(_0x7b10('0x12'))(_0x7b10('0x13'));var utils=require(_0x7b10('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x357792,_0x148f0c){_0x148f0c=_0x148f0c||0xcc;return function(_0x495171){if(_0x495171){return _0x357792['sendStatus'](_0x148f0c);}return _0x357792['status'](_0x148f0c)[_0x7b10('0x15')]();};}function respondWithResult(_0x26b85b,_0xa47908){_0xa47908=_0xa47908||0xc8;return function(_0x16e739){if(_0x16e739){return _0x26b85b['status'](_0xa47908)['json'](_0x16e739);}};}function respondWithFilteredResult(_0x2ad258,_0xe65ddc){return function(_0x315ef3){if(_0x315ef3){var _0x429520=typeof _0xe65ddc[_0x7b10('0x16')]===_0x7b10('0x17')&&typeof _0xe65ddc[_0x7b10('0x18')]==='undefined';var _0x2fdc4a=_0x315ef3[_0x7b10('0x19')];var _0x13286a=_0x429520?0x0:_0xe65ddc['offset'];var _0x10dad7=_0x429520?_0x315ef3[_0x7b10('0x19')]:_0xe65ddc[_0x7b10('0x16')]+_0xe65ddc['limit'];var _0x74bc51;if(_0x10dad7>=_0x2fdc4a){_0x10dad7=_0x2fdc4a;_0x74bc51=0xc8;}else{_0x74bc51=0xce;}_0x2ad258['status'](_0x74bc51);return _0x2ad258[_0x7b10('0x1a')](_0x7b10('0x1b'),_0x13286a+'-'+_0x10dad7+'/'+_0x2fdc4a)[_0x7b10('0x1c')](_0x315ef3);}return null;};}function patchUpdates(_0x2fa0c1){return function(_0x8fde2b){try{jsonpatch['apply'](_0x8fde2b,_0x2fa0c1,!![]);}catch(_0x599610){return BPromise[_0x7b10('0x1d')](_0x599610);}return _0x8fde2b['save']();};}function saveUpdates(_0x30314d,_0x5af895){return function(_0x5254c0){if(_0x5254c0){return _0x5254c0[_0x7b10('0x1e')](_0x30314d)[_0x7b10('0x1f')](function(_0x1d01c1){return _0x1d01c1;});}return null;};}function removeEntity(_0x4201ab,_0x39ba60){return function(_0x5ca8fe){if(_0x5ca8fe){return _0x5ca8fe[_0x7b10('0x20')]()['then'](function(){_0x4201ab[_0x7b10('0x21')](0xcc)[_0x7b10('0x15')]();});}};}function handleEntityNotFound(_0x42b2c9,_0x58b147){return function(_0x5c3745){if(!_0x5c3745){_0x42b2c9[_0x7b10('0x22')](0x194);}return _0x5c3745;};}function handleError(_0x106b69,_0x12304a){_0x12304a=_0x12304a||0x1f4;return function(_0x1b585b){logger[_0x7b10('0x23')](_0x1b585b[_0x7b10('0x24')]);if(_0x1b585b[_0x7b10('0x25')]){delete _0x1b585b['name'];}_0x106b69['status'](_0x12304a)[_0x7b10('0x26')](_0x1b585b);};}exports[_0x7b10('0x27')]=function(_0x348a09,_0x15b653){var _0x3756b={},_0x41508d={},_0x29875f={'count':0x0,'rows':[]};var _0x4c7c60=_[_0x7b10('0x28')](db[_0x7b10('0x29')]['rawAttributes'],function(_0xbd9eb4){return{'name':_0xbd9eb4[_0x7b10('0x2a')],'type':_0xbd9eb4[_0x7b10('0x2b')][_0x7b10('0x2c')]};});_0x41508d['model']=_[_0x7b10('0x28')](_0x4c7c60,_0x7b10('0x25'));_0x41508d[_0x7b10('0x2d')]=_[_0x7b10('0x2e')](_0x348a09[_0x7b10('0x2d')]);_0x41508d[_0x7b10('0x2f')]=_[_0x7b10('0x30')](_0x41508d[_0x7b10('0x31')],_0x41508d[_0x7b10('0x2d')]);_0x3756b['attributes']=_[_0x7b10('0x30')](_0x41508d[_0x7b10('0x31')],qs[_0x7b10('0x32')](_0x348a09[_0x7b10('0x2d')][_0x7b10('0x32')]));_0x3756b['attributes']=_0x3756b['attributes']['length']?_0x3756b[_0x7b10('0x33')]:_0x41508d['model'];if(!_0x348a09[_0x7b10('0x2d')][_0x7b10('0x34')](_0x7b10('0x35'))){_0x3756b[_0x7b10('0x18')]=qs[_0x7b10('0x18')](_0x348a09[_0x7b10('0x2d')][_0x7b10('0x18')]);_0x3756b[_0x7b10('0x16')]=qs[_0x7b10('0x16')](_0x348a09[_0x7b10('0x2d')][_0x7b10('0x16')]);}_0x3756b[_0x7b10('0x36')]=qs['sort'](_0x348a09['query'][_0x7b10('0x37')]);_0x3756b[_0x7b10('0x38')]=qs[_0x7b10('0x2f')](_['pick'](_0x348a09[_0x7b10('0x2d')],_0x41508d[_0x7b10('0x2f')]),_0x4c7c60);if(_0x348a09['query'][_0x7b10('0x39')]){_0x3756b['where']=_[_0x7b10('0x3a')](_0x3756b[_0x7b10('0x38')],{'$or':_['map'](_0x4c7c60,function(_0x416d1e){if(_0x416d1e[_0x7b10('0x2b')]!==_0x7b10('0x3b')){var _0x316ab4={};_0x316ab4[_0x416d1e[_0x7b10('0x25')]]={'$like':'%'+_0x348a09['query'][_0x7b10('0x39')]+'%'};return _0x316ab4;}})});}_0x3756b=_[_0x7b10('0x3a')]({},_0x3756b,_0x348a09[_0x7b10('0x3c')]);var _0x5218ad={'where':_0x3756b[_0x7b10('0x38')]};return db[_0x7b10('0x29')][_0x7b10('0x19')](_0x5218ad)[_0x7b10('0x1f')](function(_0xa200e7){_0x29875f[_0x7b10('0x19')]=_0xa200e7;if(_0x348a09[_0x7b10('0x2d')][_0x7b10('0x3d')]){_0x3756b[_0x7b10('0x3e')]=[{'all':!![]}];}return db[_0x7b10('0x29')]['findAll'](_0x3756b);})[_0x7b10('0x1f')](function(_0x152e8c){_0x29875f[_0x7b10('0x3f')]=_0x152e8c;return _0x29875f;})[_0x7b10('0x1f')](respondWithFilteredResult(_0x15b653,_0x3756b))['catch'](handleError(_0x15b653,null));};exports[_0x7b10('0x40')]=function(_0x2f1219,_0x1f6998){var _0x1e6253={'raw':![],'where':{'id':_0x2f1219[_0x7b10('0x41')]['id']}},_0x155a25={};_0x155a25[_0x7b10('0x31')]=_[_0x7b10('0x2e')](db['AnalyticFieldReport'][_0x7b10('0x42')]);_0x155a25['query']=_[_0x7b10('0x2e')](_0x2f1219['query']);_0x155a25[_0x7b10('0x2f')]=_[_0x7b10('0x30')](_0x155a25[_0x7b10('0x31')],_0x155a25[_0x7b10('0x2d')]);_0x1e6253[_0x7b10('0x33')]=_['intersection'](_0x155a25['model'],qs['fields'](_0x2f1219['query'][_0x7b10('0x32')]));_0x1e6253[_0x7b10('0x33')]=_0x1e6253[_0x7b10('0x33')][_0x7b10('0x43')]?_0x1e6253['attributes']:_0x155a25[_0x7b10('0x31')];if(_0x2f1219[_0x7b10('0x2d')][_0x7b10('0x3d')]){_0x1e6253[_0x7b10('0x3e')]=[{'all':!![]}];}_0x1e6253=_[_0x7b10('0x3a')]({},_0x1e6253,_0x2f1219[_0x7b10('0x3c')]);return db[_0x7b10('0x29')][_0x7b10('0x44')](_0x1e6253)[_0x7b10('0x1f')](handleEntityNotFound(_0x1f6998,null))[_0x7b10('0x1f')](respondWithResult(_0x1f6998,null))[_0x7b10('0x45')](handleError(_0x1f6998,null));};exports[_0x7b10('0x46')]=function(_0x59eb92,_0x248b38){return db[_0x7b10('0x29')][_0x7b10('0x46')](_0x59eb92[_0x7b10('0x47')],{})[_0x7b10('0x1f')](respondWithResult(_0x248b38,0xc9))[_0x7b10('0x45')](handleError(_0x248b38,null));};exports[_0x7b10('0x48')]=function(_0x403760,_0x44af1c){return db[_0x7b10('0x29')][_0x7b10('0x48')](_0x403760[_0x7b10('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x44af1c,0xc9))['catch'](handleError(_0x44af1c,null));};exports[_0x7b10('0x1e')]=function(_0x3284a1,_0x502df7){if(_0x3284a1[_0x7b10('0x47')]['id']){delete _0x3284a1[_0x7b10('0x47')]['id'];}return db['AnalyticFieldReport'][_0x7b10('0x44')]({'where':{'id':_0x3284a1[_0x7b10('0x41')]['id']}})[_0x7b10('0x1f')](handleEntityNotFound(_0x502df7,null))[_0x7b10('0x1f')](saveUpdates(_0x3284a1[_0x7b10('0x47')],null))['then'](respondWithResult(_0x502df7,null))[_0x7b10('0x45')](handleError(_0x502df7,null));};exports[_0x7b10('0x20')]=function(_0x5c0742,_0xf7b42a){return db[_0x7b10('0x29')][_0x7b10('0x44')]({'where':{'id':_0x5c0742[_0x7b10('0x41')]['id']}})[_0x7b10('0x1f')](handleEntityNotFound(_0xf7b42a,null))['then'](removeEntity(_0xf7b42a,null))[_0x7b10('0x45')](handleError(_0xf7b42a,null));};exports['bulkDestroy']=function(_0x39f9de,_0x1eda68){return db['AnalyticFieldReport'][_0x7b10('0x20')]({'where':{'id':_0x39f9de[_0x7b10('0x2d')][_0x7b10('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x7b10('0x1f')](respondWithResult(_0x1eda68,0xcc))[_0x7b10('0x45')](handleError(_0x1eda68,null));};exports[_0x7b10('0x4a')]=function(_0xc68cfc,_0x3ec1f9,_0x24f101){return db[_0x7b10('0x4b')][_0x7b10('0x4c')]({'where':{'id':_0xc68cfc[_0x7b10('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ec1f9,null))[_0x7b10('0x1f')](function(_0x3c0bc5){if(_0x3c0bc5){return db[_0x7b10('0x4d')][_0x7b10('0x4e')](function(_0xbc74fe){return db[_0x7b10('0x29')]['destroy']({'where':{'CustomReportId':_0xc68cfc[_0x7b10('0x41')]['id']},'transaction':_0xbc74fe})[_0x7b10('0x1f')](function(_0x17d2eb){var _0x3c194c=_[_0x7b10('0x28')](_0xc68cfc[_0x7b10('0x47')],function(_0x5b023d){delete _0x5b023d['id'];_0x5b023d[_0x7b10('0x4f')]=_0xc68cfc[_0x7b10('0x41')]['id'];return _0x5b023d;});return db[_0x7b10('0x29')][_0x7b10('0x48')](_0x3c194c,{'transaction':_0xbc74fe});});})[_0x7b10('0x1f')](function(){return db[_0x7b10('0x29')]['findAll']({'where':{'CustomReportId':_0xc68cfc['params']['id']}});});}})[_0x7b10('0x1f')](respondWithResult(_0x3ec1f9,null))['catch'](handleError(_0x3ec1f9,null));}; \ No newline at end of file +var _0x3054=['bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','catch','create','bulkCreate','body','bulkDestroy','ids','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x13bd18,_0x5a0a04){var _0x22505d=function(_0x22f135){while(--_0x22f135){_0x13bd18['push'](_0x13bd18['shift']());}};_0x22505d(++_0x5a0a04);}(_0x3054,0x9d));var _0x4305=function(_0x434f9a,_0x47a0ea){_0x434f9a=_0x434f9a-0x0;var _0x43877e=_0x3054[_0x434f9a];return _0x43877e;};'use strict';var emlformat=require(_0x4305('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4305('0x1'));var jsonpatch=require(_0x4305('0x2'));var rp=require(_0x4305('0x3'));var moment=require(_0x4305('0x4'));var BPromise=require(_0x4305('0x5'));var Mustache=require(_0x4305('0x6'));var util=require(_0x4305('0x7'));var path=require(_0x4305('0x8'));var sox=require(_0x4305('0x9'));var csv=require('to-csv');var ejs=require(_0x4305('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4305('0xb'));var squel=require(_0x4305('0xc'));var crypto=require(_0x4305('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4305('0xe'));var querystring=require(_0x4305('0xf'));var Papa=require(_0x4305('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4305('0x11'));var as=require(_0x4305('0x12'));var hardwareService=require(_0x4305('0x13'));var logger=require('../../config/logger')(_0x4305('0x14'));var utils=require(_0x4305('0x15'));var config=require(_0x4305('0x16'));var licenseUtil=require(_0x4305('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fb3cb,_0x3531a6){_0x3531a6=_0x3531a6||0xcc;return function(_0x56b247){if(_0x56b247){return _0x4fb3cb[_0x4305('0x18')](_0x3531a6);}return _0x4fb3cb[_0x4305('0x19')](_0x3531a6)[_0x4305('0x1a')]();};}function respondWithResult(_0x29f4fd,_0x401cee){_0x401cee=_0x401cee||0xc8;return function(_0x5d00b9){if(_0x5d00b9){return _0x29f4fd['status'](_0x401cee)[_0x4305('0x1b')](_0x5d00b9);}};}function respondWithFilteredResult(_0x1e10fa,_0xde2ce8){return function(_0xcacefb){if(_0xcacefb){var _0x52f790=typeof _0xde2ce8[_0x4305('0x1c')]===_0x4305('0x1d')&&typeof _0xde2ce8[_0x4305('0x1e')]===_0x4305('0x1d');var _0x4d73f4=_0xcacefb[_0x4305('0x1f')];var _0x41d1b8=_0x52f790?0x0:_0xde2ce8[_0x4305('0x1c')];var _0x201d40=_0x52f790?_0xcacefb[_0x4305('0x1f')]:_0xde2ce8[_0x4305('0x1c')]+_0xde2ce8['limit'];var _0x341fa0;if(_0x201d40>=_0x4d73f4){_0x201d40=_0x4d73f4;_0x341fa0=0xc8;}else{_0x341fa0=0xce;}_0x1e10fa['status'](_0x341fa0);return _0x1e10fa[_0x4305('0x20')](_0x4305('0x21'),_0x41d1b8+'-'+_0x201d40+'/'+_0x4d73f4)['json'](_0xcacefb);}return null;};}function patchUpdates(_0x176f50){return function(_0x433203){try{jsonpatch[_0x4305('0x22')](_0x433203,_0x176f50,!![]);}catch(_0x5cc90a){return BPromise['reject'](_0x5cc90a);}return _0x433203[_0x4305('0x23')]();};}function saveUpdates(_0x4498b1,_0x1f7d8f){return function(_0x451660){if(_0x451660){return _0x451660[_0x4305('0x24')](_0x4498b1)[_0x4305('0x25')](function(_0x269151){return _0x269151;});}return null;};}function removeEntity(_0x30ca31,_0x5a27c0){return function(_0x3038d1){if(_0x3038d1){return _0x3038d1[_0x4305('0x26')]()[_0x4305('0x25')](function(){_0x30ca31['status'](0xcc)[_0x4305('0x1a')]();});}};}function handleEntityNotFound(_0x1cf6b6,_0x3563b9){return function(_0x3ab565){if(!_0x3ab565){_0x1cf6b6['sendStatus'](0x194);}return _0x3ab565;};}function handleError(_0x3ccdfc,_0x2796c7){_0x2796c7=_0x2796c7||0x1f4;return function(_0x5e9ecd){logger['error'](_0x5e9ecd[_0x4305('0x27')]);if(_0x5e9ecd[_0x4305('0x28')]){delete _0x5e9ecd['name'];}_0x3ccdfc[_0x4305('0x19')](_0x2796c7)[_0x4305('0x29')](_0x5e9ecd);};}exports[_0x4305('0x2a')]=function(_0x1d66ea,_0x1b33d9){var _0x85c563={},_0x910886={},_0x6f5671={'count':0x0,'rows':[]};var _0x28fff8=_[_0x4305('0x2b')](db[_0x4305('0x2c')][_0x4305('0x2d')],function(_0x13f3a3){return{'name':_0x13f3a3[_0x4305('0x2e')],'type':_0x13f3a3[_0x4305('0x2f')][_0x4305('0x30')]};});_0x910886[_0x4305('0x31')]=_['map'](_0x28fff8,_0x4305('0x28'));_0x910886['query']=_[_0x4305('0x32')](_0x1d66ea[_0x4305('0x33')]);_0x910886[_0x4305('0x34')]=_[_0x4305('0x35')](_0x910886['model'],_0x910886['query']);_0x85c563['attributes']=_[_0x4305('0x35')](_0x910886[_0x4305('0x31')],qs[_0x4305('0x36')](_0x1d66ea[_0x4305('0x33')][_0x4305('0x36')]));_0x85c563[_0x4305('0x37')]=_0x85c563[_0x4305('0x37')]['length']?_0x85c563['attributes']:_0x910886[_0x4305('0x31')];if(!_0x1d66ea[_0x4305('0x33')][_0x4305('0x38')](_0x4305('0x39'))){_0x85c563[_0x4305('0x1e')]=qs[_0x4305('0x1e')](_0x1d66ea[_0x4305('0x33')]['limit']);_0x85c563['offset']=qs[_0x4305('0x1c')](_0x1d66ea[_0x4305('0x33')][_0x4305('0x1c')]);}_0x85c563['order']=qs[_0x4305('0x3a')](_0x1d66ea[_0x4305('0x33')]['sort']);_0x85c563[_0x4305('0x3b')]=qs['filters'](_['pick'](_0x1d66ea[_0x4305('0x33')],_0x910886['filters']),_0x28fff8);if(_0x1d66ea[_0x4305('0x33')][_0x4305('0x3c')]){_0x85c563[_0x4305('0x3b')]=_[_0x4305('0x3d')](_0x85c563[_0x4305('0x3b')],{'$or':_[_0x4305('0x2b')](_0x28fff8,function(_0x4065d4){if(_0x4065d4[_0x4305('0x2f')]!==_0x4305('0x3e')){var _0x3e24a8={};_0x3e24a8[_0x4065d4['name']]={'$like':'%'+_0x1d66ea['query'][_0x4305('0x3c')]+'%'};return _0x3e24a8;}})});}_0x85c563=_['merge']({},_0x85c563,_0x1d66ea[_0x4305('0x3f')]);var _0x279519={'where':_0x85c563[_0x4305('0x3b')]};return db[_0x4305('0x2c')][_0x4305('0x1f')](_0x279519)[_0x4305('0x25')](function(_0x1ea355){_0x6f5671[_0x4305('0x1f')]=_0x1ea355;if(_0x1d66ea['query'][_0x4305('0x40')]){_0x85c563[_0x4305('0x41')]=[{'all':!![]}];}return db[_0x4305('0x2c')][_0x4305('0x42')](_0x85c563);})[_0x4305('0x25')](function(_0x186aa4){_0x6f5671['rows']=_0x186aa4;return _0x6f5671;})[_0x4305('0x25')](respondWithFilteredResult(_0x1b33d9,_0x85c563))['catch'](handleError(_0x1b33d9,null));};exports[_0x4305('0x43')]=function(_0x386054,_0x425e77){var _0x48e217={'raw':![],'where':{'id':_0x386054[_0x4305('0x44')]['id']}},_0x151b7a={};_0x151b7a[_0x4305('0x31')]=_[_0x4305('0x32')](db[_0x4305('0x2c')]['rawAttributes']);_0x151b7a[_0x4305('0x33')]=_['keys'](_0x386054[_0x4305('0x33')]);_0x151b7a['filters']=_['intersection'](_0x151b7a[_0x4305('0x31')],_0x151b7a[_0x4305('0x33')]);_0x48e217[_0x4305('0x37')]=_['intersection'](_0x151b7a[_0x4305('0x31')],qs[_0x4305('0x36')](_0x386054[_0x4305('0x33')][_0x4305('0x36')]));_0x48e217[_0x4305('0x37')]=_0x48e217[_0x4305('0x37')][_0x4305('0x45')]?_0x48e217['attributes']:_0x151b7a[_0x4305('0x31')];if(_0x386054[_0x4305('0x33')][_0x4305('0x40')]){_0x48e217[_0x4305('0x41')]=[{'all':!![]}];}_0x48e217=_[_0x4305('0x3d')]({},_0x48e217,_0x386054[_0x4305('0x3f')]);return db[_0x4305('0x2c')][_0x4305('0x46')](_0x48e217)[_0x4305('0x25')](handleEntityNotFound(_0x425e77,null))[_0x4305('0x25')](respondWithResult(_0x425e77,null))[_0x4305('0x47')](handleError(_0x425e77,null));};exports[_0x4305('0x48')]=function(_0xf2cb1b,_0x3f9d1b){return db[_0x4305('0x2c')]['create'](_0xf2cb1b['body'],{})[_0x4305('0x25')](respondWithResult(_0x3f9d1b,0xc9))[_0x4305('0x47')](handleError(_0x3f9d1b,null));};exports[_0x4305('0x49')]=function(_0x24dd3f,_0x239f57){return db['AnalyticFieldReport'][_0x4305('0x49')](_0x24dd3f[_0x4305('0x4a')],{'raw':![],'individualHooks':!![]})[_0x4305('0x25')](respondWithResult(_0x239f57,0xc9))[_0x4305('0x47')](handleError(_0x239f57,null));};exports[_0x4305('0x24')]=function(_0x2dde8b,_0x53ca6b){if(_0x2dde8b[_0x4305('0x4a')]['id']){delete _0x2dde8b['body']['id'];}return db[_0x4305('0x2c')][_0x4305('0x46')]({'where':{'id':_0x2dde8b[_0x4305('0x44')]['id']}})[_0x4305('0x25')](handleEntityNotFound(_0x53ca6b,null))[_0x4305('0x25')](saveUpdates(_0x2dde8b[_0x4305('0x4a')],null))[_0x4305('0x25')](respondWithResult(_0x53ca6b,null))[_0x4305('0x47')](handleError(_0x53ca6b,null));};exports[_0x4305('0x26')]=function(_0x57922e,_0x172b1){return db[_0x4305('0x2c')][_0x4305('0x46')]({'where':{'id':_0x57922e[_0x4305('0x44')]['id']}})[_0x4305('0x25')](handleEntityNotFound(_0x172b1,null))[_0x4305('0x25')](removeEntity(_0x172b1,null))['catch'](handleError(_0x172b1,null));};exports[_0x4305('0x4b')]=function(_0x2f6b5f,_0x1fcd75){return db['AnalyticFieldReport'][_0x4305('0x26')]({'where':{'id':_0x2f6b5f[_0x4305('0x33')][_0x4305('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1fcd75,0xcc))[_0x4305('0x47')](handleError(_0x1fcd75,null));};exports['addFields']=function(_0x52b8a1,_0x423c0f,_0x5cfdda){return db['AnalyticCustomReport'][_0x4305('0x4d')]({'where':{'id':_0x52b8a1[_0x4305('0x44')]['id']}})[_0x4305('0x25')](handleEntityNotFound(_0x423c0f,null))[_0x4305('0x25')](function(_0x2997c0){if(_0x2997c0){return db[_0x4305('0x4e')][_0x4305('0x4f')](function(_0x395b82){return db[_0x4305('0x2c')][_0x4305('0x26')]({'where':{'CustomReportId':_0x52b8a1[_0x4305('0x44')]['id']},'transaction':_0x395b82})[_0x4305('0x25')](function(_0x1f0b81){var _0xc0606e=_['map'](_0x52b8a1[_0x4305('0x4a')],function(_0x281ad9){delete _0x281ad9['id'];_0x281ad9[_0x4305('0x50')]=_0x52b8a1[_0x4305('0x44')]['id'];return _0x281ad9;});return db[_0x4305('0x2c')][_0x4305('0x49')](_0xc0606e,{'transaction':_0x395b82});});})[_0x4305('0x25')](function(){return db[_0x4305('0x2c')][_0x4305('0x42')]({'where':{'CustomReportId':_0x52b8a1['params']['id']}});});}})['then'](respondWithResult(_0x423c0f,null))[_0x4305('0x47')](handleError(_0x423c0f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 631cd8b..1bcc255 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 _0x87cc=['api','moment','bluebird','request-promise','../../config/environment','AnalyticFieldReport','analytics_report_fields','util','../../config/logger'];(function(_0xc2a130,_0x900599){var _0x247f87=function(_0x3c78c3){while(--_0x3c78c3){_0xc2a130['push'](_0xc2a130['shift']());}};_0x247f87(++_0x900599);}(_0x87cc,0x19c));var _0xc87c=function(_0x49f9e8,_0x54ee65){_0x49f9e8=_0x49f9e8-0x0;var _0xdd03e4=_0x87cc[_0x49f9e8];return _0xdd03e4;};'use strict';var _=require('lodash');var util=require(_0xc87c('0x0'));var logger=require(_0xc87c('0x1'))(_0xc87c('0x2'));var moment=require(_0xc87c('0x3'));var BPromise=require(_0xc87c('0x4'));var rp=require(_0xc87c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc87c('0x6'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x41cbfc,_0x553ace){return _0x41cbfc['define'](_0xc87c('0x7'),attributes,{'tableName':_0xc87c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1075=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields'];(function(_0x27db09,_0x440a29){var _0x2c2ee0=function(_0xc378c2){while(--_0xc378c2){_0x27db09['push'](_0x27db09['shift']());}};_0x2c2ee0(++_0x440a29);}(_0x1075,0x1e0));var _0x5107=function(_0xe506a9,_0x3105d4){_0xe506a9=_0xe506a9-0x0;var _0x12ca6f=_0x1075[_0xe506a9];return _0x12ca6f;};'use strict';var _=require(_0x5107('0x0'));var util=require(_0x5107('0x1'));var logger=require(_0x5107('0x2'))(_0x5107('0x3'));var moment=require(_0x5107('0x4'));var BPromise=require(_0x5107('0x5'));var rp=require(_0x5107('0x6'));var fs=require('fs');var path=require(_0x5107('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5107('0x8'));module[_0x5107('0x9')]=function(_0x4a777a,_0x3049e0){return _0x4a777a['define'](_0x5107('0xa'),attributes,{'tableName':_0x5107('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 6a97e37..5007bb0 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 _0x6449=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x32ac3d,_0x12aef3){var _0x4065b8=function(_0x2dcca7){while(--_0x2dcca7){_0x32ac3d['push'](_0x32ac3d['shift']());}};_0x4065b8(++_0x12aef3);}(_0x6449,0x1a4));var _0x9644=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x6449[_0x31ced5];return _0x10d9e5;};'use strict';var _=require('lodash');var util=require(_0x9644('0x0'));var moment=require(_0x9644('0x1'));var BPromise=require(_0x9644('0x2'));var rs=require(_0x9644('0x3'));var fs=require('fs');var Redis=require(_0x9644('0x4'));var db=require(_0x9644('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9644('0x6'))(_0x9644('0x7'));var config=require(_0x9644('0x8'));var jayson=require(_0x9644('0x9'));var client=jayson['client'][_0x9644('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4662b1,_0x3aab6a,_0x4445bc){return new BPromise(function(_0x1067c5,_0x3eae31){return client[_0x9644('0xb')](_0x4662b1,_0x4445bc)[_0x9644('0xc')](function(_0x9b8175){logger[_0x9644('0xd')](_0x9644('0xe'),_0x3aab6a,_0x9644('0xf'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x3aab6a,_0x9644('0xf'),JSON['stringify'](_0x9b8175));if(_0x9b8175[_0x9644('0x10')]){if(_0x9b8175[_0x9644('0x10')][_0x9644('0x11')]===0x1f4){logger[_0x9644('0x10')](_0x9644('0xe'),_0x3aab6a,_0x9b8175[_0x9644('0x10')][_0x9644('0x12')]);return _0x3eae31(_0x9b8175[_0x9644('0x10')][_0x9644('0x12')]);}logger[_0x9644('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3aab6a,_0x9b8175['error'][_0x9644('0x12')]);return _0x1067c5(_0x9b8175[_0x9644('0x10')][_0x9644('0x12')]);}else{logger[_0x9644('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3aab6a,_0x9644('0xf'));_0x1067c5(_0x9b8175[_0x9644('0x13')][_0x9644('0x12')]);}})[_0x9644('0x14')](function(_0x2d54e3){logger[_0x9644('0x10')](_0x9644('0xe'),_0x3aab6a,_0x2d54e3);_0x3eae31(_0x2d54e3);});});} \ No newline at end of file +var _0x012d=['../../config/environment','jayson/promise','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3a87c9,_0x132bad){var _0x4e1ad8=function(_0x4ef7cd){while(--_0x4ef7cd){_0x3a87c9['push'](_0x3a87c9['shift']());}};_0x4e1ad8(++_0x132bad);}(_0x012d,0xdb));var _0xd012=function(_0x5c600e,_0x3c2fbc){_0x5c600e=_0x5c600e-0x0;var _0x12821d=_0x012d[_0x5c600e];return _0x12821d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd012('0x0'));var BPromise=require(_0xd012('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd012('0x2'))['db'];var utils=require(_0xd012('0x3'));var logger=require(_0xd012('0x4'))('rpc');var config=require(_0xd012('0x5'));var jayson=require(_0xd012('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x214d8a,_0x4de228,_0x1a4bc0){return new BPromise(function(_0x8fae65,_0x2fd76c){return client[_0xd012('0x7')](_0x214d8a,_0x1a4bc0)['then'](function(_0x555840){logger[_0xd012('0x8')](_0xd012('0x9'),_0x4de228,_0xd012('0xa'));logger[_0xd012('0xb')](_0xd012('0xc'),_0x4de228,_0xd012('0xa'),JSON['stringify'](_0x555840));if(_0x555840[_0xd012('0xd')]){if(_0x555840[_0xd012('0xd')][_0xd012('0xe')]===0x1f4){logger[_0xd012('0xd')](_0xd012('0x9'),_0x4de228,_0x555840[_0xd012('0xd')][_0xd012('0xf')]);return _0x2fd76c(_0x555840['error'][_0xd012('0xf')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x4de228,_0x555840[_0xd012('0xd')][_0xd012('0xf')]);return _0x8fae65(_0x555840[_0xd012('0xd')][_0xd012('0xf')]);}else{logger[_0xd012('0x8')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4de228,_0xd012('0xa'));_0x8fae65(_0x555840['result'][_0xd012('0xf')]);}})['catch'](function(_0x35de5e){logger[_0xd012('0xd')](_0xd012('0x9'),_0x4de228,_0x35de5e);_0x2fd76c(_0x35de5e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 45c786d..33785dd 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(_0x54919b,_0x23ff76){var _0x49a8a5=function(_0x37ee89){while(--_0x37ee89){_0x54919b['push'](_0x54919b['shift']());}};_0x49a8a5(++_0x23ff76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x3461db,_0x3e64bf){var _0xf49372=function(_0x2f11c8){while(--_0x2f11c8){_0x3461db['push'](_0x3461db['shift']());}};_0xf49372(++_0x3e64bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 b3bd9bb..1081c45 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 _0xc686=['STRING'];(function(_0x346b2b,_0x3c7be1){var _0xe31b68=function(_0xd2f439){while(--_0xd2f439){_0x346b2b['push'](_0x346b2b['shift']());}};_0xe31b68(++_0x3c7be1);}(_0xc686,0x148));var _0x6c68=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xc686[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6c68('0x0')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x6c68('0x0')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x6c68('0x0')]}}; \ No newline at end of file +var _0x6b24=['exports','STRING','name'];(function(_0x562b2c,_0x597e60){var _0xaf8f62=function(_0xe1b3ff){while(--_0xe1b3ff){_0x562b2c['push'](_0x562b2c['shift']());}};_0xaf8f62(++_0x597e60);}(_0x6b24,0x1ce));var _0x46b2=function(_0x382ca6,_0x1aaf79){_0x382ca6=_0x382ca6-0x0;var _0x295a6c=_0x6b24[_0x382ca6];return _0x295a6c;};'use strict';var Sequelize=require('sequelize');module[_0x46b2('0x0')]={'name':{'type':Sequelize[_0x46b2('0x1')],'allowNull':![],'unique':_0x46b2('0x2')},'table':{'type':Sequelize[_0x46b2('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 25b9895..ca51e05 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 _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(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x84ab,0x12f));var _0xb84a=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x84ab[_0x37ffea];return _0x2e2615;};'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 +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','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/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46717d,_0x71b508){var _0x35f49e=function(_0x3d1b39){while(--_0x3d1b39){_0x46717d['push'](_0x46717d['shift']());}};_0x35f49e(++_0x71b508);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x450f09,_0x59561d){_0x450f09=_0x450f09-0x0;var _0x4e22ec=_0xf2ca[_0x450f09];return _0x4e22ec;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5020ef9..2d20054 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 _0xc5c8=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x307462,_0x58a62f){var _0x7bced2=function(_0x5aacee){while(--_0x5aacee){_0x307462['push'](_0x307462['shift']());}};_0x7bced2(++_0x58a62f);}(_0xc5c8,0x118));var _0x8c5c=function(_0x5c8aee,_0x374f36){_0x5c8aee=_0x5c8aee-0x0;var _0x292920=_0xc5c8[_0x5c8aee];return _0x292920;};'use strict';var _=require(_0x8c5c('0x0'));var util=require(_0x8c5c('0x1'));var logger=require(_0x8c5c('0x2'))('api');var moment=require(_0x8c5c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c5c('0x4'));var rimraf=require(_0x8c5c('0x5'));var config=require('../../config/environment');var attributes=require(_0x8c5c('0x6'));module[_0x8c5c('0x7')]=function(_0x390b86,_0x2e297d){return _0x390b86[_0x8c5c('0x8')](_0x8c5c('0x9'),attributes,{'tableName':_0x8c5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb931=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x11f9cc,_0xe933d9){var _0x48d3d3=function(_0x5c442b){while(--_0x5c442b){_0x11f9cc['push'](_0x11f9cc['shift']());}};_0x48d3d3(++_0xe933d9);}(_0xb931,0x155));var _0x1b93=function(_0x347a6a,_0x353c64){_0x347a6a=_0x347a6a-0x0;var _0x4a07d8=_0xb931[_0x347a6a];return _0x4a07d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1b93('0x0'))('api');var moment=require('moment');var BPromise=require(_0x1b93('0x1'));var rp=require(_0x1b93('0x2'));var fs=require('fs');var path=require(_0x1b93('0x3'));var rimraf=require(_0x1b93('0x4'));var config=require(_0x1b93('0x5'));var attributes=require(_0x1b93('0x6'));module[_0x1b93('0x7')]=function(_0x3a30b2,_0x701ab1){return _0x3a30b2[_0x1b93('0x8')](_0x1b93('0x9'),attributes,{'tableName':_0x1b93('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 d01fdf6..64310cc 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 _0x06bb=['debug','error','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x58401b,_0x1fe81c){var _0x5d7f3f=function(_0x1f8cd8){while(--_0x1f8cd8){_0x58401b['push'](_0x58401b['shift']());}};_0x5d7f3f(++_0x1fe81c);}(_0x06bb,0x17e));var _0xb06b=function(_0x4467f2,_0x512525){_0x4467f2=_0x4467f2-0x0;var _0x1fcc7d=_0x06bb[_0x4467f2];return _0x1fcc7d;};'use strict';var _=require(_0xb06b('0x0'));var util=require('util');var moment=require(_0xb06b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb06b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb06b('0x3'))['db'];var utils=require(_0xb06b('0x4'));var logger=require(_0xb06b('0x5'))(_0xb06b('0x6'));var config=require(_0xb06b('0x7'));var jayson=require(_0xb06b('0x8'));var client=jayson[_0xb06b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27578e,_0x104306,_0xcbf83d){return new BPromise(function(_0x527159,_0x36cb7c){return client[_0xb06b('0xa')](_0x27578e,_0xcbf83d)['then'](function(_0x382c44){logger[_0xb06b('0xb')](_0xb06b('0xc'),_0x104306,_0xb06b('0xd'));logger[_0xb06b('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x104306,'request\x20sent',JSON['stringify'](_0x382c44));if(_0x382c44[_0xb06b('0xf')]){if(_0x382c44[_0xb06b('0xf')]['code']===0x1f4){logger[_0xb06b('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x104306,_0x382c44['error'][_0xb06b('0x10')]);return _0x36cb7c(_0x382c44[_0xb06b('0xf')]['message']);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x104306,_0x382c44[_0xb06b('0xf')][_0xb06b('0x10')]);return _0x527159(_0x382c44[_0xb06b('0xf')][_0xb06b('0x10')]);}else{logger[_0xb06b('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x104306,_0xb06b('0xd'));_0x527159(_0x382c44['result'][_0xb06b('0x10')]);}})[_0xb06b('0x11')](function(_0x22e9a8){logger['error'](_0xb06b('0xc'),_0x104306,_0x22e9a8);_0x36cb7c(_0x22e9a8);});});} \ No newline at end of file +var _0x1810=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','info','request\x20sent','catch','lodash'];(function(_0x4941ee,_0x465d06){var _0x567c9c=function(_0x5a368f){while(--_0x5a368f){_0x4941ee['push'](_0x4941ee['shift']());}};_0x567c9c(++_0x465d06);}(_0x1810,0x15f));var _0x0181=function(_0x1ca66c,_0x3e3868){_0x1ca66c=_0x1ca66c-0x0;var _0x5a78ce=_0x1810[_0x1ca66c];return _0x5a78ce;};'use strict';var _=require(_0x0181('0x0'));var util=require('util');var moment=require(_0x0181('0x1'));var BPromise=require(_0x0181('0x2'));var rs=require(_0x0181('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0181('0x4'))['db'];var utils=require(_0x0181('0x5'));var logger=require(_0x0181('0x6'))(_0x0181('0x7'));var config=require(_0x0181('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0181('0x9')][_0x0181('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x153c6d,_0x3e1c8d,_0x3ea7b7){return new BPromise(function(_0x15b912,_0x2ecc7d){return client[_0x0181('0xb')](_0x153c6d,_0x3ea7b7)[_0x0181('0xc')](function(_0x4a2dfa){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3e1c8d,'request\x20sent');logger[_0x0181('0xd')](_0x0181('0xe'),_0x3e1c8d,'request\x20sent',JSON[_0x0181('0xf')](_0x4a2dfa));if(_0x4a2dfa[_0x0181('0x10')]){if(_0x4a2dfa[_0x0181('0x10')]['code']===0x1f4){logger[_0x0181('0x10')](_0x0181('0x11'),_0x3e1c8d,_0x4a2dfa[_0x0181('0x10')]['message']);return _0x2ecc7d(_0x4a2dfa[_0x0181('0x10')][_0x0181('0x12')]);}logger[_0x0181('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3e1c8d,_0x4a2dfa['error'][_0x0181('0x12')]);return _0x15b912(_0x4a2dfa[_0x0181('0x10')][_0x0181('0x12')]);}else{logger[_0x0181('0x13')](_0x0181('0x11'),_0x3e1c8d,_0x0181('0x14'));_0x15b912(_0x4a2dfa['result']['message']);}})[_0x0181('0x15')](function(_0xd3e00f){logger[_0x0181('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3e1c8d,_0xd3e00f);_0x2ecc7d(_0xd3e00f);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 27728f6..a683d69 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 _0xd206=['isAuthenticated','/:id','post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x26c1ea,_0x1c2f33){var _0x394cee=function(_0x22b216){while(--_0x22b216){_0x26c1ea['push'](_0x26c1ea['shift']());}};_0x394cee(++_0x1c2f33);}(_0xd206,0x107));var _0x6d20=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xd206[_0x616290];return _0x453879;};'use strict';var multer=require(_0x6d20('0x0'));var util=require(_0x6d20('0x1'));var path=require('path');var timeout=require(_0x6d20('0x2'));var express=require(_0x6d20('0x3'));var router=express[_0x6d20('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d20('0x5'));var interaction=require(_0x6d20('0x6'));var config=require(_0x6d20('0x7'));var controller=require(_0x6d20('0x8'));router['get']('/',auth[_0x6d20('0x9')](),controller['index']);router['get'](_0x6d20('0xa'),auth[_0x6d20('0x9')](),controller['show']);router[_0x6d20('0xb')]('/',auth['isAuthenticated'](),controller[_0x6d20('0xc')]);router[_0x6d20('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6d20('0xe')](_0x6d20('0xa'),auth['isAuthenticated'](),controller[_0x6d20('0xf')]);module['exports']=router; \ No newline at end of file +var _0xdd68=['post','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','show'];(function(_0x2b28e0,_0x4f4540){var _0x345d8b=function(_0x7fc60a){while(--_0x7fc60a){_0x2b28e0['push'](_0x2b28e0['shift']());}};_0x345d8b(++_0x4f4540);}(_0xdd68,0x196));var _0x8dd6=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0xdd68[_0xc8a11];return _0x55a500;};'use strict';var multer=require(_0x8dd6('0x0'));var util=require('util');var path=require(_0x8dd6('0x1'));var timeout=require(_0x8dd6('0x2'));var express=require(_0x8dd6('0x3'));var router=express[_0x8dd6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8dd6('0x5'));var interaction=require(_0x8dd6('0x6'));var config=require('../../config/environment');var controller=require(_0x8dd6('0x7'));router[_0x8dd6('0x8')]('/',auth['isAuthenticated'](),controller[_0x8dd6('0x9')]);router['get'](_0x8dd6('0xa'),auth['isAuthenticated'](),controller[_0x8dd6('0xb')]);router[_0x8dd6('0xc')]('/',auth[_0x8dd6('0xd')](),controller['create']);router[_0x8dd6('0xe')](_0x8dd6('0xa'),auth[_0x8dd6('0xd')](),controller[_0x8dd6('0xf')]);router[_0x8dd6('0x10')](_0x8dd6('0xa'),auth[_0x8dd6('0xd')](),controller[_0x8dd6('0x11')]);module[_0x8dd6('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6ec9d95..abba461 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 _0x8ead=['exports','TEXT','sequelize'];(function(_0x23d313,_0x4a9058){var _0x30aaa0=function(_0x4f3735){while(--_0x4f3735){_0x23d313['push'](_0x23d313['shift']());}};_0x30aaa0(++_0x4a9058);}(_0x8ead,0x1c4));var _0xd8ea=function(_0x4ef375,_0x2be61a){_0x4ef375=_0x4ef375-0x0;var _0x4bd11a=_0x8ead[_0x4ef375];return _0x4bd11a;};'use strict';var Sequelize=require(_0xd8ea('0x0'));module[_0xd8ea('0x1')]={'tree':{'type':Sequelize[_0xd8ea('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfb3c=['exports','TEXT','sequelize'];(function(_0x5a50d4,_0x230600){var _0x27fc12=function(_0x4753fc){while(--_0x4753fc){_0x5a50d4['push'](_0x5a50d4['shift']());}};_0x27fc12(++_0x230600);}(_0xfb3c,0x1df));var _0xcfb3=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xfb3c[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0xcfb3('0x0'));module[_0xcfb3('0x1')]={'tree':{'type':Sequelize[_0xcfb3('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 b1e73cf..38263bf 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 _0x79b6=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','stack','name','index','map','AnalyticTreeReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x197122,_0x350384){var _0x405a4a=function(_0xcf36eb){while(--_0xcf36eb){_0x197122['push'](_0x197122['shift']());}};_0x405a4a(++_0x350384);}(_0x79b6,0x84));var _0x679b=function(_0x327c0e,_0xcd6344){_0x327c0e=_0x327c0e-0x0;var _0x3a38b6=_0x79b6[_0x327c0e];return _0x3a38b6;};'use strict';var emlformat=require(_0x679b('0x0'));var rimraf=require(_0x679b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x679b('0x2'));var moment=require(_0x679b('0x3'));var BPromise=require(_0x679b('0x4'));var Mustache=require('mustache');var util=require(_0x679b('0x5'));var path=require(_0x679b('0x6'));var sox=require(_0x679b('0x7'));var csv=require(_0x679b('0x8'));var ejs=require(_0x679b('0x9'));var fs=require('fs');var fs_extra=require(_0x679b('0xa'));var _=require(_0x679b('0xb'));var squel=require('squel');var crypto=require(_0x679b('0xc'));var jsforce=require(_0x679b('0xd'));var deskjs=require(_0x679b('0xe'));var toCsv=require(_0x679b('0x8'));var querystring=require(_0x679b('0xf'));var Papa=require(_0x679b('0x10'));var Redis=require('ioredis');var authService=require(_0x679b('0x11'));var qs=require(_0x679b('0x12'));var as=require(_0x679b('0x13'));var hardwareService=require(_0x679b('0x14'));var logger=require('../../config/logger')(_0x679b('0x15'));var utils=require('../../config/utils');var config=require(_0x679b('0x16'));var licenseUtil=require(_0x679b('0x17'));var db=require(_0x679b('0x18'))['db'];function respondWithStatusCode(_0xd605b0,_0x8b5fc8){_0x8b5fc8=_0x8b5fc8||0xcc;return function(_0x1a34ef){if(_0x1a34ef){return _0xd605b0[_0x679b('0x19')](_0x8b5fc8);}return _0xd605b0['status'](_0x8b5fc8)['end']();};}function respondWithResult(_0x58a662,_0x183b7b){_0x183b7b=_0x183b7b||0xc8;return function(_0xb67091){if(_0xb67091){return _0x58a662[_0x679b('0x1a')](_0x183b7b)[_0x679b('0x1b')](_0xb67091);}};}function respondWithFilteredResult(_0x1bf1eb,_0x4b04ef){return function(_0x2a4ab6){if(_0x2a4ab6){var _0x2296bd=typeof _0x4b04ef[_0x679b('0x1c')]==='undefined'&&typeof _0x4b04ef['limit']===_0x679b('0x1d');var _0x59ff82=_0x2a4ab6[_0x679b('0x1e')];var _0x2c6c23=_0x2296bd?0x0:_0x4b04ef['offset'];var _0x1b6b1e=_0x2296bd?_0x2a4ab6[_0x679b('0x1e')]:_0x4b04ef[_0x679b('0x1c')]+_0x4b04ef[_0x679b('0x1f')];var _0x3a2071;if(_0x1b6b1e>=_0x59ff82){_0x1b6b1e=_0x59ff82;_0x3a2071=0xc8;}else{_0x3a2071=0xce;}_0x1bf1eb[_0x679b('0x1a')](_0x3a2071);return _0x1bf1eb[_0x679b('0x20')]('Content-Range',_0x2c6c23+'-'+_0x1b6b1e+'/'+_0x59ff82)[_0x679b('0x1b')](_0x2a4ab6);}return null;};}function patchUpdates(_0x622957){return function(_0x231e01){try{jsonpatch[_0x679b('0x21')](_0x231e01,_0x622957,!![]);}catch(_0x5f1603){return BPromise['reject'](_0x5f1603);}return _0x231e01[_0x679b('0x22')]();};}function saveUpdates(_0x2644e3,_0x513613){return function(_0x408ca8){if(_0x408ca8){return _0x408ca8[_0x679b('0x23')](_0x2644e3)[_0x679b('0x24')](function(_0x591e36){return _0x591e36;});}return null;};}function removeEntity(_0x195942,_0x588496){return function(_0x2c2c6f){if(_0x2c2c6f){return _0x2c2c6f[_0x679b('0x25')]()[_0x679b('0x24')](function(){_0x195942['status'](0xcc)[_0x679b('0x26')]();});}};}function handleEntityNotFound(_0x1cc5fd,_0x35bbc7){return function(_0x25538b){if(!_0x25538b){_0x1cc5fd[_0x679b('0x19')](0x194);}return _0x25538b;};}function handleError(_0x3f36c5,_0x59e586){_0x59e586=_0x59e586||0x1f4;return function(_0xdd548f){logger['error'](_0xdd548f[_0x679b('0x27')]);if(_0xdd548f[_0x679b('0x28')]){delete _0xdd548f[_0x679b('0x28')];}_0x3f36c5['status'](_0x59e586)['send'](_0xdd548f);};}exports[_0x679b('0x29')]=function(_0x37a86c,_0xe9f57){var _0x430a11={},_0x262099={},_0x24c8e2={'count':0x0,'rows':[]};var _0x294063=_[_0x679b('0x2a')](db[_0x679b('0x2b')]['rawAttributes'],function(_0x6a8a4a){return{'name':_0x6a8a4a[_0x679b('0x2c')],'type':_0x6a8a4a[_0x679b('0x2d')]['key']};});_0x262099['model']=_['map'](_0x294063,_0x679b('0x28'));_0x262099[_0x679b('0x2e')]=_[_0x679b('0x2f')](_0x37a86c[_0x679b('0x2e')]);_0x262099[_0x679b('0x30')]=_[_0x679b('0x31')](_0x262099[_0x679b('0x32')],_0x262099[_0x679b('0x2e')]);_0x430a11[_0x679b('0x33')]=_[_0x679b('0x31')](_0x262099['model'],qs[_0x679b('0x34')](_0x37a86c[_0x679b('0x2e')][_0x679b('0x34')]));_0x430a11[_0x679b('0x33')]=_0x430a11[_0x679b('0x33')]['length']?_0x430a11[_0x679b('0x33')]:_0x262099[_0x679b('0x32')];if(!_0x37a86c[_0x679b('0x2e')][_0x679b('0x35')](_0x679b('0x36'))){_0x430a11[_0x679b('0x1f')]=qs['limit'](_0x37a86c[_0x679b('0x2e')][_0x679b('0x1f')]);_0x430a11[_0x679b('0x1c')]=qs[_0x679b('0x1c')](_0x37a86c['query'][_0x679b('0x1c')]);}_0x430a11[_0x679b('0x37')]=qs[_0x679b('0x38')](_0x37a86c[_0x679b('0x2e')][_0x679b('0x38')]);_0x430a11['where']=qs[_0x679b('0x30')](_[_0x679b('0x39')](_0x37a86c['query'],_0x262099[_0x679b('0x30')]),_0x294063);if(_0x37a86c[_0x679b('0x2e')][_0x679b('0x3a')]){_0x430a11['where']=_[_0x679b('0x3b')](_0x430a11[_0x679b('0x3c')],{'$or':_[_0x679b('0x2a')](_0x294063,function(_0x39f42b){if(_0x39f42b[_0x679b('0x2d')]!=='VIRTUAL'){var _0x55404d={};_0x55404d[_0x39f42b[_0x679b('0x28')]]={'$like':'%'+_0x37a86c['query'][_0x679b('0x3a')]+'%'};return _0x55404d;}})});}_0x430a11=_[_0x679b('0x3b')]({},_0x430a11,_0x37a86c[_0x679b('0x3d')]);var _0x2da713={'where':_0x430a11[_0x679b('0x3c')]};return db[_0x679b('0x2b')][_0x679b('0x1e')](_0x2da713)[_0x679b('0x24')](function(_0x7706ef){_0x24c8e2[_0x679b('0x1e')]=_0x7706ef;if(_0x37a86c[_0x679b('0x2e')][_0x679b('0x3e')]){_0x430a11[_0x679b('0x3f')]=[{'all':!![]}];}return db[_0x679b('0x2b')][_0x679b('0x40')](_0x430a11);})[_0x679b('0x24')](function(_0x4d1504){_0x24c8e2[_0x679b('0x41')]=_0x4d1504;return _0x24c8e2;})[_0x679b('0x24')](respondWithFilteredResult(_0xe9f57,_0x430a11))[_0x679b('0x42')](handleError(_0xe9f57,null));};exports[_0x679b('0x43')]=function(_0x534108,_0x2061dd){var _0xa33260={'raw':!![],'where':{'id':_0x534108['params']['id']}},_0x468939={};_0x468939['model']=_[_0x679b('0x2f')](db[_0x679b('0x2b')]['rawAttributes']);_0x468939['query']=_['keys'](_0x534108['query']);_0x468939[_0x679b('0x30')]=_[_0x679b('0x31')](_0x468939[_0x679b('0x32')],_0x468939[_0x679b('0x2e')]);_0xa33260['attributes']=_[_0x679b('0x31')](_0x468939[_0x679b('0x32')],qs[_0x679b('0x34')](_0x534108[_0x679b('0x2e')][_0x679b('0x34')]));_0xa33260[_0x679b('0x33')]=_0xa33260[_0x679b('0x33')]['length']?_0xa33260[_0x679b('0x33')]:_0x468939[_0x679b('0x32')];if(_0x534108[_0x679b('0x2e')]['includeAll']){_0xa33260[_0x679b('0x3f')]=[{'all':!![]}];}_0xa33260=_['merge']({},_0xa33260,_0x534108['options']);return db['AnalyticTreeReport']['find'](_0xa33260)[_0x679b('0x24')](handleEntityNotFound(_0x2061dd,null))[_0x679b('0x24')](respondWithResult(_0x2061dd,null))[_0x679b('0x42')](handleError(_0x2061dd,null));};exports[_0x679b('0x44')]=function(_0x7e0ac3,_0x20b8e4){return db[_0x679b('0x2b')]['create'](_0x7e0ac3[_0x679b('0x45')],{})['then'](respondWithResult(_0x20b8e4,0xc9))[_0x679b('0x42')](handleError(_0x20b8e4,null));};exports['update']=function(_0x2a69d1,_0x3c8ac4){if(_0x2a69d1['body']['id']){delete _0x2a69d1[_0x679b('0x45')]['id'];}return db[_0x679b('0x2b')][_0x679b('0x46')]({'where':{'id':_0x2a69d1[_0x679b('0x47')]['id']}})[_0x679b('0x24')](handleEntityNotFound(_0x3c8ac4,null))[_0x679b('0x24')](saveUpdates(_0x2a69d1[_0x679b('0x45')],null))['then'](respondWithResult(_0x3c8ac4,null))[_0x679b('0x42')](handleError(_0x3c8ac4,null));};exports[_0x679b('0x25')]=function(_0x15597c,_0x39d4bb){return db['AnalyticTreeReport'][_0x679b('0x46')]({'where':{'id':_0x15597c[_0x679b('0x47')]['id']}})[_0x679b('0x24')](handleEntityNotFound(_0x39d4bb,null))[_0x679b('0x24')](removeEntity(_0x39d4bb,null))[_0x679b('0x42')](handleError(_0x39d4bb,null));}; \ No newline at end of file +var _0x9bc4=['jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','lodash','squel','crypto'];(function(_0x19bcd2,_0x47fd97){var _0x152996=function(_0x41f195){while(--_0x41f195){_0x19bcd2['push'](_0x19bcd2['shift']());}};_0x152996(++_0x47fd97);}(_0x9bc4,0xd1));var _0x49bc=function(_0x143bb5,_0x2400ad){_0x143bb5=_0x143bb5-0x0;var _0x54cb40=_0x9bc4[_0x143bb5];return _0x54cb40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49bc('0x0'));var zipdir=require(_0x49bc('0x1'));var jsonpatch=require(_0x49bc('0x2'));var rp=require(_0x49bc('0x3'));var moment=require('moment');var BPromise=require(_0x49bc('0x4'));var Mustache=require(_0x49bc('0x5'));var util=require(_0x49bc('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('fs-extra');var _=require(_0x49bc('0x7'));var squel=require(_0x49bc('0x8'));var crypto=require(_0x49bc('0x9'));var jsforce=require(_0x49bc('0xa'));var deskjs=require(_0x49bc('0xb'));var toCsv=require(_0x49bc('0xc'));var querystring=require(_0x49bc('0xd'));var Papa=require('papaparse');var Redis=require(_0x49bc('0xe'));var authService=require(_0x49bc('0xf'));var qs=require(_0x49bc('0x10'));var as=require(_0x49bc('0x11'));var hardwareService=require(_0x49bc('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x49bc('0x13'));var config=require(_0x49bc('0x14'));var licenseUtil=require(_0x49bc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452268,_0x4709bd){_0x4709bd=_0x4709bd||0xcc;return function(_0x563ccc){if(_0x563ccc){return _0x452268[_0x49bc('0x16')](_0x4709bd);}return _0x452268['status'](_0x4709bd)[_0x49bc('0x17')]();};}function respondWithResult(_0x4b2fc2,_0x36ca90){_0x36ca90=_0x36ca90||0xc8;return function(_0x9fa191){if(_0x9fa191){return _0x4b2fc2['status'](_0x36ca90)[_0x49bc('0x18')](_0x9fa191);}};}function respondWithFilteredResult(_0xe97bc0,_0x221d62){return function(_0x5a60ca){if(_0x5a60ca){var _0x23c89d=typeof _0x221d62['offset']==='undefined'&&typeof _0x221d62[_0x49bc('0x19')]===_0x49bc('0x1a');var _0x133701=_0x5a60ca[_0x49bc('0x1b')];var _0x4294af=_0x23c89d?0x0:_0x221d62[_0x49bc('0x1c')];var _0x1eb04d=_0x23c89d?_0x5a60ca[_0x49bc('0x1b')]:_0x221d62['offset']+_0x221d62['limit'];var _0x40093c;if(_0x1eb04d>=_0x133701){_0x1eb04d=_0x133701;_0x40093c=0xc8;}else{_0x40093c=0xce;}_0xe97bc0[_0x49bc('0x1d')](_0x40093c);return _0xe97bc0['set'](_0x49bc('0x1e'),_0x4294af+'-'+_0x1eb04d+'/'+_0x133701)[_0x49bc('0x18')](_0x5a60ca);}return null;};}function patchUpdates(_0x1b2afa){return function(_0x190759){try{jsonpatch['apply'](_0x190759,_0x1b2afa,!![]);}catch(_0x11b023){return BPromise[_0x49bc('0x1f')](_0x11b023);}return _0x190759[_0x49bc('0x20')]();};}function saveUpdates(_0x5e5e18,_0x6c54bc){return function(_0x538e81){if(_0x538e81){return _0x538e81[_0x49bc('0x21')](_0x5e5e18)[_0x49bc('0x22')](function(_0x34dfb2){return _0x34dfb2;});}return null;};}function removeEntity(_0x14226d,_0x2367d5){return function(_0x57cc8e){if(_0x57cc8e){return _0x57cc8e[_0x49bc('0x23')]()['then'](function(){_0x14226d[_0x49bc('0x1d')](0xcc)[_0x49bc('0x17')]();});}};}function handleEntityNotFound(_0x13e168,_0x2f7c6a){return function(_0x5bf2d5){if(!_0x5bf2d5){_0x13e168[_0x49bc('0x16')](0x194);}return _0x5bf2d5;};}function handleError(_0x15df54,_0x3244a3){_0x3244a3=_0x3244a3||0x1f4;return function(_0x5e292e){logger[_0x49bc('0x24')](_0x5e292e[_0x49bc('0x25')]);if(_0x5e292e[_0x49bc('0x26')]){delete _0x5e292e['name'];}_0x15df54[_0x49bc('0x1d')](_0x3244a3)[_0x49bc('0x27')](_0x5e292e);};}exports[_0x49bc('0x28')]=function(_0x3aa3da,_0x3fef37){var _0x542e84={},_0x3daea1={},_0x3dd64d={'count':0x0,'rows':[]};var _0x23d977=_[_0x49bc('0x29')](db[_0x49bc('0x2a')][_0x49bc('0x2b')],function(_0x3985e0){return{'name':_0x3985e0[_0x49bc('0x2c')],'type':_0x3985e0[_0x49bc('0x2d')][_0x49bc('0x2e')]};});_0x3daea1['model']=_[_0x49bc('0x29')](_0x23d977,_0x49bc('0x26'));_0x3daea1['query']=_[_0x49bc('0x2f')](_0x3aa3da[_0x49bc('0x30')]);_0x3daea1[_0x49bc('0x31')]=_[_0x49bc('0x32')](_0x3daea1[_0x49bc('0x33')],_0x3daea1[_0x49bc('0x30')]);_0x542e84[_0x49bc('0x34')]=_[_0x49bc('0x32')](_0x3daea1[_0x49bc('0x33')],qs['fields'](_0x3aa3da[_0x49bc('0x30')][_0x49bc('0x35')]));_0x542e84[_0x49bc('0x34')]=_0x542e84[_0x49bc('0x34')][_0x49bc('0x36')]?_0x542e84[_0x49bc('0x34')]:_0x3daea1[_0x49bc('0x33')];if(!_0x3aa3da[_0x49bc('0x30')][_0x49bc('0x37')](_0x49bc('0x38'))){_0x542e84[_0x49bc('0x19')]=qs['limit'](_0x3aa3da[_0x49bc('0x30')]['limit']);_0x542e84[_0x49bc('0x1c')]=qs[_0x49bc('0x1c')](_0x3aa3da['query'][_0x49bc('0x1c')]);}_0x542e84[_0x49bc('0x39')]=qs[_0x49bc('0x3a')](_0x3aa3da[_0x49bc('0x30')]['sort']);_0x542e84[_0x49bc('0x3b')]=qs['filters'](_[_0x49bc('0x3c')](_0x3aa3da[_0x49bc('0x30')],_0x3daea1[_0x49bc('0x31')]),_0x23d977);if(_0x3aa3da[_0x49bc('0x30')]['filter']){_0x542e84[_0x49bc('0x3b')]=_[_0x49bc('0x3d')](_0x542e84[_0x49bc('0x3b')],{'$or':_[_0x49bc('0x29')](_0x23d977,function(_0x56960a){if(_0x56960a['type']!==_0x49bc('0x3e')){var _0x364703={};_0x364703[_0x56960a[_0x49bc('0x26')]]={'$like':'%'+_0x3aa3da['query'][_0x49bc('0x3f')]+'%'};return _0x364703;}})});}_0x542e84=_['merge']({},_0x542e84,_0x3aa3da[_0x49bc('0x40')]);var _0x4f81d8={'where':_0x542e84[_0x49bc('0x3b')]};return db['AnalyticTreeReport'][_0x49bc('0x1b')](_0x4f81d8)['then'](function(_0x375fd0){_0x3dd64d[_0x49bc('0x1b')]=_0x375fd0;if(_0x3aa3da['query'][_0x49bc('0x41')]){_0x542e84[_0x49bc('0x42')]=[{'all':!![]}];}return db[_0x49bc('0x2a')][_0x49bc('0x43')](_0x542e84);})[_0x49bc('0x22')](function(_0x3e1a1d){_0x3dd64d['rows']=_0x3e1a1d;return _0x3dd64d;})['then'](respondWithFilteredResult(_0x3fef37,_0x542e84))[_0x49bc('0x44')](handleError(_0x3fef37,null));};exports['show']=function(_0x453f3d,_0x16530d){var _0x542136={'raw':!![],'where':{'id':_0x453f3d[_0x49bc('0x45')]['id']}},_0x469675={};_0x469675[_0x49bc('0x33')]=_[_0x49bc('0x2f')](db[_0x49bc('0x2a')]['rawAttributes']);_0x469675['query']=_[_0x49bc('0x2f')](_0x453f3d[_0x49bc('0x30')]);_0x469675[_0x49bc('0x31')]=_[_0x49bc('0x32')](_0x469675['model'],_0x469675['query']);_0x542136[_0x49bc('0x34')]=_[_0x49bc('0x32')](_0x469675[_0x49bc('0x33')],qs[_0x49bc('0x35')](_0x453f3d[_0x49bc('0x30')][_0x49bc('0x35')]));_0x542136[_0x49bc('0x34')]=_0x542136['attributes'][_0x49bc('0x36')]?_0x542136[_0x49bc('0x34')]:_0x469675['model'];if(_0x453f3d['query'][_0x49bc('0x41')]){_0x542136[_0x49bc('0x42')]=[{'all':!![]}];}_0x542136=_[_0x49bc('0x3d')]({},_0x542136,_0x453f3d[_0x49bc('0x40')]);return db[_0x49bc('0x2a')][_0x49bc('0x46')](_0x542136)[_0x49bc('0x22')](handleEntityNotFound(_0x16530d,null))['then'](respondWithResult(_0x16530d,null))['catch'](handleError(_0x16530d,null));};exports[_0x49bc('0x47')]=function(_0xfef2a5,_0x578b9d){return db[_0x49bc('0x2a')][_0x49bc('0x47')](_0xfef2a5[_0x49bc('0x48')],{})['then'](respondWithResult(_0x578b9d,0xc9))[_0x49bc('0x44')](handleError(_0x578b9d,null));};exports[_0x49bc('0x21')]=function(_0x47e55f,_0x1d0935){if(_0x47e55f[_0x49bc('0x48')]['id']){delete _0x47e55f[_0x49bc('0x48')]['id'];}return db['AnalyticTreeReport'][_0x49bc('0x46')]({'where':{'id':_0x47e55f[_0x49bc('0x45')]['id']}})['then'](handleEntityNotFound(_0x1d0935,null))[_0x49bc('0x22')](saveUpdates(_0x47e55f[_0x49bc('0x48')],null))[_0x49bc('0x22')](respondWithResult(_0x1d0935,null))[_0x49bc('0x44')](handleError(_0x1d0935,null));};exports[_0x49bc('0x23')]=function(_0xa3d06e,_0x349123){return db[_0x49bc('0x2a')][_0x49bc('0x46')]({'where':{'id':_0xa3d06e['params']['id']}})['then'](handleEntityNotFound(_0x349123,null))[_0x49bc('0x22')](removeEntity(_0x349123,null))[_0x49bc('0x44')](handleError(_0x349123,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 83431c4..7f39060 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 _0x52f0=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0xd1f854,_0x532346){var _0x548294=function(_0x4be823){while(--_0x4be823){_0xd1f854['push'](_0xd1f854['shift']());}};_0x548294(++_0x532346);}(_0x52f0,0xa1));var _0x052f=function(_0x1765c4,_0x151565){_0x1765c4=_0x1765c4-0x0;var _0x56645f=_0x52f0[_0x1765c4];return _0x56645f;};'use strict';var _=require(_0x052f('0x0'));var util=require(_0x052f('0x1'));var logger=require(_0x052f('0x2'))('api');var moment=require(_0x052f('0x3'));var BPromise=require(_0x052f('0x4'));var rp=require(_0x052f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x052f('0x6'));var config=require(_0x052f('0x7'));var attributes=require(_0x052f('0x8'));module[_0x052f('0x9')]=function(_0x3010e8,_0x172e9b){return _0x3010e8[_0x052f('0xa')](_0x052f('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33f3=['define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x3ab5b5,_0x51ac49){var _0xec5463=function(_0x3d71ba){while(--_0x3d71ba){_0x3ab5b5['push'](_0x3ab5b5['shift']());}};_0xec5463(++_0x51ac49);}(_0x33f3,0x1ef));var _0x333f=function(_0xbd7af7,_0xac5f7){_0xbd7af7=_0xbd7af7-0x0;var _0x151e9d=_0x33f3[_0xbd7af7];return _0x151e9d;};'use strict';var _=require('lodash');var util=require(_0x333f('0x0'));var logger=require(_0x333f('0x1'))('api');var moment=require(_0x333f('0x2'));var BPromise=require(_0x333f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x333f('0x4'));var rimraf=require(_0x333f('0x5'));var config=require(_0x333f('0x6'));var attributes=require(_0x333f('0x7'));module[_0x333f('0x8')]=function(_0x52ba27,_0x462f3f){return _0x52ba27[_0x333f('0x9')](_0x333f('0xa'),attributes,{'tableName':_0x333f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index bad7b32..0c5466e 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x191323,_0x395e8c){var _0xa3d43f=function(_0x408d9f){while(--_0x408d9f){_0x191323['push'](_0x191323['shift']());}};_0xa3d43f(++_0x395e8c);}(_0xdb28,0x106));var _0x8db2=function(_0xe14ea0,_0xfb030e){_0xe14ea0=_0xe14ea0-0x0;var _0x365aa2=_0xdb28[_0xe14ea0];return _0x365aa2;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x2312dd,_0x4c5ccf){_0x2312dd=_0x2312dd-0x0;var _0x3df0c0=_0x7a54[_0x2312dd];return _0x3df0c0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 182e949..2dd244c 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 _0x8913=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout','express','../../config/environment'];(function(_0x3f80a6,_0x3960a8){var _0x20ffcb=function(_0x331363){while(--_0x331363){_0x3f80a6['push'](_0x3f80a6['shift']());}};_0x20ffcb(++_0x3960a8);}(_0x8913,0xab));var _0x3891=function(_0x1280b8,_0x403c4f){_0x1280b8=_0x1280b8-0x0;var _0x54b802=_0x8913[_0x1280b8];return _0x54b802;};'use strict';var multer=require(_0x3891('0x0'));var util=require('util');var path=require(_0x3891('0x1'));var timeout=require(_0x3891('0x2'));var express=require(_0x3891('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3891('0x4'));var controller=require(_0x3891('0x5'));router[_0x3891('0x6')]('/',auth[_0x3891('0x7')](),controller[_0x3891('0x8')]);router['get'](_0x3891('0x9'),auth[_0x3891('0x7')](),controller[_0x3891('0xa')]);router[_0x3891('0xb')]('/',auth[_0x3891('0x7')](),controller['create']);router[_0x3891('0xc')](_0x3891('0x9'),auth[_0x3891('0x7')](),controller[_0x3891('0xd')]);router[_0x3891('0xe')](_0x3891('0x9'),auth[_0x3891('0x7')](),controller[_0x3891('0xf')]);module['exports']=router; \ No newline at end of file +var _0x66e4=['connect-timeout','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x66e4,0x76));var _0x466e=function(_0x5685f7,_0x53e368){_0x5685f7=_0x5685f7-0x0;var _0x446dab=_0x66e4[_0x5685f7];return _0x446dab;};'use strict';var multer=require(_0x466e('0x0'));var util=require(_0x466e('0x1'));var path=require('path');var timeout=require(_0x466e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x466e('0x3'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x466e('0x4')]('/',auth['isAuthenticated'](),controller[_0x466e('0x5')]);router[_0x466e('0x4')](_0x466e('0x6'),auth[_0x466e('0x7')](),controller[_0x466e('0x8')]);router[_0x466e('0x9')]('/',auth[_0x466e('0x7')](),controller[_0x466e('0xa')]);router[_0x466e('0xb')](_0x466e('0x6'),auth['isAuthenticated'](),controller[_0x466e('0xc')]);router[_0x466e('0xd')](_0x466e('0x6'),auth['isAuthenticated'](),controller['destroy']);module[_0x466e('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 73f6fce..ead80cd 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 _0x9009=['sequelize','STRING'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9009,0x1d4));var _0x9900=function(_0x5d0877,_0x4423e5){_0x5d0877=_0x5d0877-0x0;var _0x8413be=_0x9009[_0x5d0877];return _0x8413be;};'use strict';var Sequelize=require(_0x9900('0x0'));module['exports']={'name':{'type':Sequelize[_0x9900('0x1')]},'basename':{'type':Sequelize[_0x9900('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x48ea=['sequelize','STRING'];(function(_0x16d8fe,_0x5b9abd){var _0x1dac64=function(_0x33d7ef){while(--_0x33d7ef){_0x16d8fe['push'](_0x16d8fe['shift']());}};_0x1dac64(++_0x5b9abd);}(_0x48ea,0x9c));var _0xa48e=function(_0x108a1d,_0x2e0098){_0x108a1d=_0x108a1d-0x0;var _0x150a18=_0x48ea[_0x108a1d];return _0x150a18;};'use strict';var Sequelize=require(_0xa48e('0x0'));module['exports']={'name':{'type':Sequelize[_0xa48e('0x1')]},'basename':{'type':Sequelize[_0xa48e('0x1')]},'type':{'type':Sequelize[_0xa48e('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9cc546f..d03f3fa 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 _0x7968=['mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','Attachment','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','rows','catch','show','params','include','merge','find','clone','get','createdAt','body','updatedAt','create','originalname','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x2ea58d,_0x3bf0ee){var _0x538406=function(_0x3d0f06){while(--_0x3d0f06){_0x2ea58d['push'](_0x2ea58d['shift']());}};_0x538406(++_0x3bf0ee);}(_0x7968,0x1bd));var _0x8796=function(_0x1c6ac9,_0x1a4c6e){_0x1c6ac9=_0x1c6ac9-0x0;var _0x1286ce=_0x7968[_0x1c6ac9];return _0x1286ce;};'use strict';var emlformat=require(_0x8796('0x0'));var rimraf=require(_0x8796('0x1'));var zipdir=require(_0x8796('0x2'));var jsonpatch=require(_0x8796('0x3'));var rp=require('request-promise');var moment=require(_0x8796('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8796('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8796('0x6'));var ejs=require(_0x8796('0x7'));var fs=require('fs');var fs_extra=require(_0x8796('0x8'));var _=require(_0x8796('0x9'));var squel=require(_0x8796('0xa'));var crypto=require(_0x8796('0xb'));var jsforce=require(_0x8796('0xc'));var deskjs=require(_0x8796('0xd'));var toCsv=require(_0x8796('0x6'));var querystring=require(_0x8796('0xe'));var Papa=require(_0x8796('0xf'));var Redis=require('ioredis');var authService=require(_0x8796('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8796('0x11'));var hardwareService=require(_0x8796('0x12'));var logger=require(_0x8796('0x13'))(_0x8796('0x14'));var utils=require(_0x8796('0x15'));var config=require(_0x8796('0x16'));var licenseUtil=require(_0x8796('0x17'));var db=require(_0x8796('0x18'))['db'];function respondWithStatusCode(_0x18b5d9,_0x33ce42){_0x33ce42=_0x33ce42||0xcc;return function(_0x48c700){if(_0x48c700){return _0x18b5d9[_0x8796('0x19')](_0x33ce42);}return _0x18b5d9['status'](_0x33ce42)[_0x8796('0x1a')]();};}function respondWithResult(_0x417ade,_0x4bf70a){_0x4bf70a=_0x4bf70a||0xc8;return function(_0x4a8f24){if(_0x4a8f24){return _0x417ade[_0x8796('0x1b')](_0x4bf70a)['json'](_0x4a8f24);}};}function respondWithFilteredResult(_0x4ca2fe,_0x2fa708){return function(_0x1c595e){if(_0x1c595e){var _0x5037fc=typeof _0x2fa708[_0x8796('0x1c')]==='undefined'&&typeof _0x2fa708[_0x8796('0x1d')]===_0x8796('0x1e');var _0x3c53c7=_0x1c595e[_0x8796('0x1f')];var _0x39959d=_0x5037fc?0x0:_0x2fa708[_0x8796('0x1c')];var _0x414391=_0x5037fc?_0x1c595e['count']:_0x2fa708[_0x8796('0x1c')]+_0x2fa708[_0x8796('0x1d')];var _0x9aac38;if(_0x414391>=_0x3c53c7){_0x414391=_0x3c53c7;_0x9aac38=0xc8;}else{_0x9aac38=0xce;}_0x4ca2fe['status'](_0x9aac38);return _0x4ca2fe[_0x8796('0x20')](_0x8796('0x21'),_0x39959d+'-'+_0x414391+'/'+_0x3c53c7)[_0x8796('0x22')](_0x1c595e);}return null;};}function patchUpdates(_0x16c8a9){return function(_0xe43e91){try{jsonpatch['apply'](_0xe43e91,_0x16c8a9,!![]);}catch(_0x5ebefe){return BPromise['reject'](_0x5ebefe);}return _0xe43e91[_0x8796('0x23')]();};}function saveUpdates(_0x508243,_0x597823){return function(_0x2cf38a){if(_0x2cf38a){return _0x2cf38a[_0x8796('0x24')](_0x508243)[_0x8796('0x25')](function(_0x3b4e78){return _0x3b4e78;});}return null;};}function removeEntity(_0x5c5f1e,_0x500cb){return function(_0x3e667c){if(_0x3e667c){return _0x3e667c[_0x8796('0x26')]()[_0x8796('0x25')](function(){_0x5c5f1e[_0x8796('0x1b')](0xcc)[_0x8796('0x1a')]();});}};}function handleEntityNotFound(_0x30cfd5,_0x41250f){return function(_0x47e070){if(!_0x47e070){_0x30cfd5[_0x8796('0x19')](0x194);}return _0x47e070;};}function handleError(_0x36638f,_0x510941){_0x510941=_0x510941||0x1f4;return function(_0x3be189){logger[_0x8796('0x27')](_0x3be189[_0x8796('0x28')]);if(_0x3be189[_0x8796('0x29')]){delete _0x3be189[_0x8796('0x29')];}_0x36638f[_0x8796('0x1b')](_0x510941)[_0x8796('0x2a')](_0x3be189);};}exports[_0x8796('0x2b')]=function(_0xae3c72,_0x5ab9bc){var _0x3d0e47={},_0x53d8bc={},_0x417d7b={'count':0x0,'rows':[]};var _0x2b6d76=_[_0x8796('0x2c')](db[_0x8796('0x2d')]['rawAttributes'],function(_0x454c40){return{'name':_0x454c40[_0x8796('0x2e')],'type':_0x454c40['type']['key']};});_0x53d8bc['model']=_[_0x8796('0x2c')](_0x2b6d76,_0x8796('0x29'));_0x53d8bc[_0x8796('0x2f')]=_[_0x8796('0x30')](_0xae3c72[_0x8796('0x2f')]);_0x53d8bc[_0x8796('0x31')]=_[_0x8796('0x32')](_0x53d8bc[_0x8796('0x33')],_0x53d8bc['query']);_0x3d0e47[_0x8796('0x34')]=_['intersection'](_0x53d8bc[_0x8796('0x33')],qs[_0x8796('0x35')](_0xae3c72[_0x8796('0x2f')][_0x8796('0x35')]));_0x3d0e47[_0x8796('0x34')]=_0x3d0e47['attributes'][_0x8796('0x36')]?_0x3d0e47[_0x8796('0x34')]:_0x53d8bc['model'];if(!_0xae3c72[_0x8796('0x2f')][_0x8796('0x37')](_0x8796('0x38'))){_0x3d0e47[_0x8796('0x1d')]=qs[_0x8796('0x1d')](_0xae3c72[_0x8796('0x2f')][_0x8796('0x1d')]);_0x3d0e47['offset']=qs[_0x8796('0x1c')](_0xae3c72['query']['offset']);}_0x3d0e47['order']=qs['sort'](_0xae3c72[_0x8796('0x2f')][_0x8796('0x39')]);_0x3d0e47[_0x8796('0x3a')]=qs[_0x8796('0x31')](_[_0x8796('0x3b')](_0xae3c72['query'],_0x53d8bc['filters']),_0x2b6d76);if(_0xae3c72['query'][_0x8796('0x3c')]){_0x3d0e47[_0x8796('0x3a')]=_['merge'](_0x3d0e47['where'],{'$or':_[_0x8796('0x2c')](_0x2b6d76,function(_0x210c5f){if(_0x210c5f[_0x8796('0x3d')]!==_0x8796('0x3e')){var _0x4ecbe9={};_0x4ecbe9[_0x210c5f[_0x8796('0x29')]]={'$like':'%'+_0xae3c72[_0x8796('0x2f')][_0x8796('0x3c')]+'%'};return _0x4ecbe9;}})});}_0x3d0e47=_['merge']({},_0x3d0e47,_0xae3c72[_0x8796('0x3f')]);var _0x27fc10={'where':_0x3d0e47[_0x8796('0x3a')]};return db['Attachment']['count'](_0x27fc10)['then'](function(_0x16b586){_0x417d7b['count']=_0x16b586;if(_0xae3c72[_0x8796('0x2f')][_0x8796('0x40')]){_0x3d0e47['include']=[{'all':!![]}];}return db[_0x8796('0x2d')]['findAll'](_0x3d0e47);})['then'](function(_0x4a832f){_0x417d7b[_0x8796('0x41')]=_0x4a832f;return _0x417d7b;})[_0x8796('0x25')](respondWithFilteredResult(_0x5ab9bc,_0x3d0e47))[_0x8796('0x42')](handleError(_0x5ab9bc,null));};exports[_0x8796('0x43')]=function(_0xfcad66,_0x836ac3){var _0x1c433c={'raw':!![],'where':{'id':_0xfcad66[_0x8796('0x44')]['id']}},_0x2bfb58={};_0x2bfb58['model']=_[_0x8796('0x30')](db[_0x8796('0x2d')]['rawAttributes']);_0x2bfb58[_0x8796('0x2f')]=_[_0x8796('0x30')](_0xfcad66[_0x8796('0x2f')]);_0x2bfb58[_0x8796('0x31')]=_[_0x8796('0x32')](_0x2bfb58[_0x8796('0x33')],_0x2bfb58[_0x8796('0x2f')]);_0x1c433c[_0x8796('0x34')]=_[_0x8796('0x32')](_0x2bfb58['model'],qs[_0x8796('0x35')](_0xfcad66[_0x8796('0x2f')][_0x8796('0x35')]));_0x1c433c['attributes']=_0x1c433c['attributes']['length']?_0x1c433c[_0x8796('0x34')]:_0x2bfb58[_0x8796('0x33')];if(_0xfcad66[_0x8796('0x2f')][_0x8796('0x40')]){_0x1c433c[_0x8796('0x45')]=[{'all':!![]}];}_0x1c433c=_[_0x8796('0x46')]({},_0x1c433c,_0xfcad66[_0x8796('0x3f')]);return db[_0x8796('0x2d')][_0x8796('0x47')](_0x1c433c)[_0x8796('0x25')](handleEntityNotFound(_0x836ac3,null))[_0x8796('0x25')](respondWithResult(_0x836ac3,null))[_0x8796('0x42')](handleError(_0x836ac3,null));};exports[_0x8796('0x48')]=function(_0x45af25,_0x4b5955){var _0x323452={'where':{'id':_0x45af25[_0x8796('0x44')]['id']}},_0x166e73={};_0x166e73[_0x8796('0x33')]=_['keys'](db[_0x8796('0x2d')]['rawAttributes']);_0x323452['attributes']=_[_0x8796('0x32')](_0x166e73[_0x8796('0x33')],qs['fields'](_0x45af25[_0x8796('0x2f')][_0x8796('0x35')]));_0x323452[_0x8796('0x34')]=_0x323452[_0x8796('0x34')][_0x8796('0x36')]?_0x323452[_0x8796('0x34')]:_0x166e73['model'];if(_0x45af25[_0x8796('0x2f')][_0x8796('0x40')]){_0x323452['include']=[{'all':!![]}];}_0x323452=_[_0x8796('0x46')]({},_0x323452,_0x45af25['options']);return db[_0x8796('0x2d')][_0x8796('0x47')](_0x323452)[_0x8796('0x25')](handleEntityNotFound(_0x4b5955,null))['then'](function(_0x20c448){if(_0x20c448){var _0xa0a53a=_0x20c448[_0x8796('0x49')]({'plain':!![]});_0xa0a53a=qs['omit'](_0xa0a53a,['id',_0x8796('0x4a'),'updatedAt']);_0x45af25[_0x8796('0x4b')]=_['omit'](_0x45af25[_0x8796('0x4b')],['id','createdAt',_0x8796('0x4c')]);return db['Attachment'][_0x8796('0x4d')](_[_0x8796('0x46')](_0xa0a53a,_0x45af25['body']),{'include':_0x45af25['query'][_0x8796('0x40')]?[{'all':!![]}]:undefined});}})[_0x8796('0x25')](respondWithResult(_0x4b5955,0xc9))[_0x8796('0x42')](handleError(_0x4b5955,null));};exports[_0x8796('0x24')]=function(_0x3b35c9,_0x1c5fe9){if(_0x3b35c9[_0x8796('0x4b')]['id']){delete _0x3b35c9[_0x8796('0x4b')]['id'];}return db[_0x8796('0x2d')]['find']({'where':{'id':_0x3b35c9['params']['id']}})[_0x8796('0x25')](handleEntityNotFound(_0x1c5fe9,null))[_0x8796('0x25')](saveUpdates(_0x3b35c9['body'],null))[_0x8796('0x25')](respondWithResult(_0x1c5fe9,null))[_0x8796('0x42')](handleError(_0x1c5fe9,null));};exports[_0x8796('0x26')]=function(_0x32fd76,_0xcbae6a){return db[_0x8796('0x2d')][_0x8796('0x47')]({'where':{'id':_0x32fd76[_0x8796('0x44')]['id']}})[_0x8796('0x25')](handleEntityNotFound(_0xcbae6a,null))[_0x8796('0x25')](removeEntity(_0xcbae6a,null))[_0x8796('0x42')](handleError(_0xcbae6a,null));};exports['create']=function(_0x28c690,_0x4e2507,_0x319bdc){_0x28c690[_0x8796('0x4b')][_0x8796('0x29')]=_0x28c690['file'][_0x8796('0x4e')];_0x28c690[_0x8796('0x4b')]['basename']=_0x28c690[_0x8796('0x4f')][_0x8796('0x50')];_0x28c690[_0x8796('0x4b')]['type']=_0x28c690[_0x8796('0x4f')][_0x8796('0x51')];return db[_0x8796('0x2d')][_0x8796('0x4d')](_0x28c690[_0x8796('0x4b')])['then'](respondWithResult(_0x4e2507,0xc9))[_0x8796('0x42')](handleError(_0x4e2507,null));};exports[_0x8796('0x52')]=function(_0x452825,_0x3a0946,_0x406765){return db[_0x8796('0x2d')][_0x8796('0x53')]({'where':{'id':_0x452825[_0x8796('0x44')]['id']},'raw':!![]})[_0x8796('0x25')](handleEntityNotFound(_0x3a0946,null))[_0x8796('0x25')](function(_0x52cf8a){if(_0x52cf8a){var _0x7e17de=_0x52cf8a[_0x8796('0x54')]!==null;var _0x58690d=path[_0x8796('0x55')](config[_0x8796('0x56')],_0x8796('0x57'));if(_0x7e17de){_0x58690d=path[_0x8796('0x55')](_0x58690d,_0x8796('0x58'));}var _0x2ed0b1=path[_0x8796('0x55')](_0x58690d,_0x52cf8a[_0x8796('0x59')]);return _0x3a0946[_0x8796('0x52')](_0x2ed0b1);}})[_0x8796('0x42')](handleError(_0x3a0946,null));}; \ No newline at end of file +var _0x1141=['order','sort','filter','merge','where','map','VIRTUAL','options','include','findAll','catch','show','includeAll','find','clone','params','get','omit','createdAt','updatedAt','body','create','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','sendStatus','json','limit','undefined','offset','count','set','apply','reject','save','update','then','destroy','error','name','status','index','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x1141,0xcc));var _0x1114=function(_0x382ca6,_0x1aaf79){_0x382ca6=_0x382ca6-0x0;var _0x295a6c=_0x1141[_0x382ca6];return _0x295a6c;};'use strict';var emlformat=require(_0x1114('0x0'));var rimraf=require(_0x1114('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1114('0x2'));var rp=require(_0x1114('0x3'));var moment=require(_0x1114('0x4'));var BPromise=require(_0x1114('0x5'));var Mustache=require(_0x1114('0x6'));var util=require(_0x1114('0x7'));var path=require('path');var sox=require(_0x1114('0x8'));var csv=require(_0x1114('0x9'));var ejs=require(_0x1114('0xa'));var fs=require('fs');var fs_extra=require(_0x1114('0xb'));var _=require('lodash');var squel=require(_0x1114('0xc'));var crypto=require('crypto');var jsforce=require(_0x1114('0xd'));var deskjs=require(_0x1114('0xe'));var toCsv=require(_0x1114('0x9'));var querystring=require(_0x1114('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1114('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1114('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x1114('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x1114('0x13'))['db'];function respondWithStatusCode(_0x32bdd5,_0x1d1914){_0x1d1914=_0x1d1914||0xcc;return function(_0x52fae6){if(_0x52fae6){return _0x32bdd5[_0x1114('0x14')](_0x1d1914);}return _0x32bdd5['status'](_0x1d1914)['end']();};}function respondWithResult(_0xb6209a,_0x38d888){_0x38d888=_0x38d888||0xc8;return function(_0x3feb53){if(_0x3feb53){return _0xb6209a['status'](_0x38d888)[_0x1114('0x15')](_0x3feb53);}};}function respondWithFilteredResult(_0x4cfdb4,_0x546c44){return function(_0x5e790f){if(_0x5e790f){var _0x4f0769=typeof _0x546c44['offset']==='undefined'&&typeof _0x546c44[_0x1114('0x16')]===_0x1114('0x17');var _0x43d582=_0x5e790f['count'];var _0x54db49=_0x4f0769?0x0:_0x546c44[_0x1114('0x18')];var _0x35979d=_0x4f0769?_0x5e790f[_0x1114('0x19')]:_0x546c44[_0x1114('0x18')]+_0x546c44[_0x1114('0x16')];var _0x244e5f;if(_0x35979d>=_0x43d582){_0x35979d=_0x43d582;_0x244e5f=0xc8;}else{_0x244e5f=0xce;}_0x4cfdb4['status'](_0x244e5f);return _0x4cfdb4[_0x1114('0x1a')]('Content-Range',_0x54db49+'-'+_0x35979d+'/'+_0x43d582)[_0x1114('0x15')](_0x5e790f);}return null;};}function patchUpdates(_0x480104){return function(_0x312d55){try{jsonpatch[_0x1114('0x1b')](_0x312d55,_0x480104,!![]);}catch(_0x441e97){return BPromise[_0x1114('0x1c')](_0x441e97);}return _0x312d55[_0x1114('0x1d')]();};}function saveUpdates(_0x13722f,_0x20125b){return function(_0x444e69){if(_0x444e69){return _0x444e69[_0x1114('0x1e')](_0x13722f)[_0x1114('0x1f')](function(_0x31a96d){return _0x31a96d;});}return null;};}function removeEntity(_0x3fa872,_0x3513fd){return function(_0x2227b9){if(_0x2227b9){return _0x2227b9[_0x1114('0x20')]()[_0x1114('0x1f')](function(){_0x3fa872['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9e1bc9,_0x151bc9){return function(_0x418252){if(!_0x418252){_0x9e1bc9['sendStatus'](0x194);}return _0x418252;};}function handleError(_0x3a4efc,_0x35b45a){_0x35b45a=_0x35b45a||0x1f4;return function(_0xfeaaa3){logger[_0x1114('0x21')](_0xfeaaa3['stack']);if(_0xfeaaa3[_0x1114('0x22')]){delete _0xfeaaa3['name'];}_0x3a4efc[_0x1114('0x23')](_0x35b45a)['send'](_0xfeaaa3);};}exports[_0x1114('0x24')]=function(_0x1eb397,_0x2d4220){var _0x5b0068={},_0x3d2275={},_0x1fb843={'count':0x0,'rows':[]};var _0x93444e=_['map'](db[_0x1114('0x25')][_0x1114('0x26')],function(_0x57f56a){return{'name':_0x57f56a[_0x1114('0x27')],'type':_0x57f56a[_0x1114('0x28')][_0x1114('0x29')]};});_0x3d2275[_0x1114('0x2a')]=_['map'](_0x93444e,'name');_0x3d2275[_0x1114('0x2b')]=_[_0x1114('0x2c')](_0x1eb397[_0x1114('0x2b')]);_0x3d2275[_0x1114('0x2d')]=_[_0x1114('0x2e')](_0x3d2275[_0x1114('0x2a')],_0x3d2275[_0x1114('0x2b')]);_0x5b0068[_0x1114('0x2f')]=_[_0x1114('0x2e')](_0x3d2275[_0x1114('0x2a')],qs[_0x1114('0x30')](_0x1eb397[_0x1114('0x2b')][_0x1114('0x30')]));_0x5b0068[_0x1114('0x2f')]=_0x5b0068['attributes'][_0x1114('0x31')]?_0x5b0068[_0x1114('0x2f')]:_0x3d2275['model'];if(!_0x1eb397['query']['hasOwnProperty'](_0x1114('0x32'))){_0x5b0068[_0x1114('0x16')]=qs[_0x1114('0x16')](_0x1eb397['query'][_0x1114('0x16')]);_0x5b0068[_0x1114('0x18')]=qs[_0x1114('0x18')](_0x1eb397['query'][_0x1114('0x18')]);}_0x5b0068[_0x1114('0x33')]=qs[_0x1114('0x34')](_0x1eb397[_0x1114('0x2b')][_0x1114('0x34')]);_0x5b0068['where']=qs[_0x1114('0x2d')](_['pick'](_0x1eb397[_0x1114('0x2b')],_0x3d2275[_0x1114('0x2d')]),_0x93444e);if(_0x1eb397[_0x1114('0x2b')][_0x1114('0x35')]){_0x5b0068['where']=_[_0x1114('0x36')](_0x5b0068[_0x1114('0x37')],{'$or':_[_0x1114('0x38')](_0x93444e,function(_0x252792){if(_0x252792[_0x1114('0x28')]!==_0x1114('0x39')){var _0x2e1086={};_0x2e1086[_0x252792[_0x1114('0x22')]]={'$like':'%'+_0x1eb397['query'][_0x1114('0x35')]+'%'};return _0x2e1086;}})});}_0x5b0068=_[_0x1114('0x36')]({},_0x5b0068,_0x1eb397[_0x1114('0x3a')]);var _0x49b295={'where':_0x5b0068[_0x1114('0x37')]};return db[_0x1114('0x25')]['count'](_0x49b295)['then'](function(_0x536ac7){_0x1fb843[_0x1114('0x19')]=_0x536ac7;if(_0x1eb397[_0x1114('0x2b')]['includeAll']){_0x5b0068[_0x1114('0x3b')]=[{'all':!![]}];}return db[_0x1114('0x25')][_0x1114('0x3c')](_0x5b0068);})['then'](function(_0x378d2a){_0x1fb843['rows']=_0x378d2a;return _0x1fb843;})[_0x1114('0x1f')](respondWithFilteredResult(_0x2d4220,_0x5b0068))[_0x1114('0x3d')](handleError(_0x2d4220,null));};exports[_0x1114('0x3e')]=function(_0x29d817,_0x21d885){var _0x447f78={'raw':!![],'where':{'id':_0x29d817['params']['id']}},_0x2232b1={};_0x2232b1['model']=_[_0x1114('0x2c')](db[_0x1114('0x25')][_0x1114('0x26')]);_0x2232b1[_0x1114('0x2b')]=_[_0x1114('0x2c')](_0x29d817[_0x1114('0x2b')]);_0x2232b1[_0x1114('0x2d')]=_['intersection'](_0x2232b1[_0x1114('0x2a')],_0x2232b1[_0x1114('0x2b')]);_0x447f78['attributes']=_[_0x1114('0x2e')](_0x2232b1[_0x1114('0x2a')],qs[_0x1114('0x30')](_0x29d817[_0x1114('0x2b')][_0x1114('0x30')]));_0x447f78[_0x1114('0x2f')]=_0x447f78[_0x1114('0x2f')][_0x1114('0x31')]?_0x447f78[_0x1114('0x2f')]:_0x2232b1['model'];if(_0x29d817[_0x1114('0x2b')][_0x1114('0x3f')]){_0x447f78[_0x1114('0x3b')]=[{'all':!![]}];}_0x447f78=_[_0x1114('0x36')]({},_0x447f78,_0x29d817[_0x1114('0x3a')]);return db[_0x1114('0x25')][_0x1114('0x40')](_0x447f78)[_0x1114('0x1f')](handleEntityNotFound(_0x21d885,null))[_0x1114('0x1f')](respondWithResult(_0x21d885,null))[_0x1114('0x3d')](handleError(_0x21d885,null));};exports[_0x1114('0x41')]=function(_0x5f315c,_0x464204){var _0x21bb72={'where':{'id':_0x5f315c[_0x1114('0x42')]['id']}},_0x5b9ddf={};_0x5b9ddf[_0x1114('0x2a')]=_['keys'](db[_0x1114('0x25')][_0x1114('0x26')]);_0x21bb72[_0x1114('0x2f')]=_[_0x1114('0x2e')](_0x5b9ddf[_0x1114('0x2a')],qs[_0x1114('0x30')](_0x5f315c['query'][_0x1114('0x30')]));_0x21bb72[_0x1114('0x2f')]=_0x21bb72[_0x1114('0x2f')]['length']?_0x21bb72[_0x1114('0x2f')]:_0x5b9ddf['model'];if(_0x5f315c['query'][_0x1114('0x3f')]){_0x21bb72[_0x1114('0x3b')]=[{'all':!![]}];}_0x21bb72=_[_0x1114('0x36')]({},_0x21bb72,_0x5f315c['options']);return db[_0x1114('0x25')][_0x1114('0x40')](_0x21bb72)[_0x1114('0x1f')](handleEntityNotFound(_0x464204,null))[_0x1114('0x1f')](function(_0x165ecf){if(_0x165ecf){var _0x241850=_0x165ecf[_0x1114('0x43')]({'plain':!![]});_0x241850=qs[_0x1114('0x44')](_0x241850,['id',_0x1114('0x45'),_0x1114('0x46')]);_0x5f315c[_0x1114('0x47')]=_[_0x1114('0x44')](_0x5f315c[_0x1114('0x47')],['id',_0x1114('0x45'),_0x1114('0x46')]);return db[_0x1114('0x25')][_0x1114('0x48')](_['merge'](_0x241850,_0x5f315c[_0x1114('0x47')]),{'include':_0x5f315c[_0x1114('0x2b')][_0x1114('0x3f')]?[{'all':!![]}]:undefined});}})[_0x1114('0x1f')](respondWithResult(_0x464204,0xc9))[_0x1114('0x3d')](handleError(_0x464204,null));};exports[_0x1114('0x1e')]=function(_0x46bae5,_0x2bd0cb){if(_0x46bae5[_0x1114('0x47')]['id']){delete _0x46bae5[_0x1114('0x47')]['id'];}return db[_0x1114('0x25')]['find']({'where':{'id':_0x46bae5['params']['id']}})[_0x1114('0x1f')](handleEntityNotFound(_0x2bd0cb,null))[_0x1114('0x1f')](saveUpdates(_0x46bae5['body'],null))[_0x1114('0x1f')](respondWithResult(_0x2bd0cb,null))[_0x1114('0x3d')](handleError(_0x2bd0cb,null));};exports['destroy']=function(_0x3ddb11,_0x2b7e03){return db[_0x1114('0x25')][_0x1114('0x40')]({'where':{'id':_0x3ddb11[_0x1114('0x42')]['id']}})[_0x1114('0x1f')](handleEntityNotFound(_0x2b7e03,null))[_0x1114('0x1f')](removeEntity(_0x2b7e03,null))[_0x1114('0x3d')](handleError(_0x2b7e03,null));};exports['create']=function(_0x211950,_0x584692,_0x148430){_0x211950[_0x1114('0x47')]['name']=_0x211950['file'][_0x1114('0x49')];_0x211950['body'][_0x1114('0x4a')]=_0x211950[_0x1114('0x4b')][_0x1114('0x4c')];_0x211950[_0x1114('0x47')][_0x1114('0x28')]=_0x211950[_0x1114('0x4b')][_0x1114('0x4d')];return db[_0x1114('0x25')][_0x1114('0x48')](_0x211950[_0x1114('0x47')])[_0x1114('0x1f')](respondWithResult(_0x584692,0xc9))[_0x1114('0x3d')](handleError(_0x584692,null));};exports[_0x1114('0x4e')]=function(_0x546b6f,_0x2afff4,_0x32f9a7){return db[_0x1114('0x25')][_0x1114('0x4f')]({'where':{'id':_0x546b6f[_0x1114('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2afff4,null))[_0x1114('0x1f')](function(_0x3e6555){if(_0x3e6555){var _0x4d02d5=_0x3e6555[_0x1114('0x50')]!==null;var _0x5b892a=path['join'](config[_0x1114('0x51')],_0x1114('0x52'));if(_0x4d02d5){_0x5b892a=path['join'](_0x5b892a,_0x1114('0x53'));}var _0x2ea27b=path[_0x1114('0x54')](_0x5b892a,_0x3e6555['basename']);return _0x2afff4['download'](_0x2ea27b);}})[_0x1114('0x3d')](handleError(_0x2afff4,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 05fb964..e080d58 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 _0x1f66=['./attachment.attributes','exports','Attachment','lodash','util','bluebird','rimraf','../../config/environment'];(function(_0x2e2aa7,_0x29adde){var _0x4c4445=function(_0x124d5b){while(--_0x124d5b){_0x2e2aa7['push'](_0x2e2aa7['shift']());}};_0x4c4445(++_0x29adde);}(_0x1f66,0xeb));var _0x61f6=function(_0x1bbd1f,_0x3ddc56){_0x1bbd1f=_0x1bbd1f-0x0;var _0x5c88b0=_0x1f66[_0x1bbd1f];return _0x5c88b0;};'use strict';var _=require(_0x61f6('0x0'));var util=require(_0x61f6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x61f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x61f6('0x3'));var config=require(_0x61f6('0x4'));var attributes=require(_0x61f6('0x5'));module[_0x61f6('0x6')]=function(_0x4709c0,_0x10eca7){return _0x4709c0['define'](_0x61f6('0x7'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fcc=['bluebird','request-promise','path','rimraf','../../config/environment','define','Attachment','attachments','lodash','api'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x0fcc,0x9e));var _0xc0fc=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x0fcc[_0x1afabf];return _0x497ff1;};'use strict';var _=require(_0xc0fc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0fc('0x1'));var moment=require('moment');var BPromise=require(_0xc0fc('0x2'));var rp=require(_0xc0fc('0x3'));var fs=require('fs');var path=require(_0xc0fc('0x4'));var rimraf=require(_0xc0fc('0x5'));var config=require(_0xc0fc('0x6'));var attributes=require('./attachment.attributes');module['exports']=function(_0x250d67,_0x5189ec){return _0x250d67[_0xc0fc('0x7')](_0xc0fc('0x8'),attributes,{'tableName':_0xc0fc('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 9432525..e0238fc 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 _0x8b29=['bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateAttachment','create','body','options','lodash','moment'];(function(_0x4102f9,_0x47ff76){var _0x2d3ebc=function(_0x2ede38){while(--_0x2ede38){_0x4102f9['push'](_0x4102f9['shift']());}};_0x2d3ebc(++_0x47ff76);}(_0x8b29,0xbe));var _0x98b2=function(_0xa0cbbd,_0x49e591){_0xa0cbbd=_0xa0cbbd-0x0;var _0x21d204=_0x8b29[_0xa0cbbd];return _0x21d204;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var moment=require(_0x98b2('0x1'));var BPromise=require(_0x98b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98b2('0x3'))['db'];var utils=require(_0x98b2('0x4'));var logger=require('../../config/logger')(_0x98b2('0x5'));var config=require('../../config/environment');var jayson=require(_0x98b2('0x6'));var client=jayson[_0x98b2('0x7')][_0x98b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e7ef5,_0x221cee,_0x2cd0cb){return new BPromise(function(_0x417ca6,_0x388827){return client[_0x98b2('0x9')](_0x3e7ef5,_0x2cd0cb)[_0x98b2('0xa')](function(_0x501b51){logger['info'](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));logger[_0x98b2('0xd')](_0x98b2('0xe'),_0x221cee,_0x98b2('0xc'),JSON[_0x98b2('0xf')](_0x501b51));if(_0x501b51['error']){if(_0x501b51[_0x98b2('0x10')][_0x98b2('0x11')]===0x1f4){logger['error'](_0x98b2('0xb'),_0x221cee,_0x501b51[_0x98b2('0x10')][_0x98b2('0x12')]);return _0x388827(_0x501b51['error']['message']);}logger[_0x98b2('0x10')]('Attachment,\x20%s,\x20%s',_0x221cee,_0x501b51[_0x98b2('0x10')]['message']);return _0x417ca6(_0x501b51['error']['message']);}else{logger[_0x98b2('0x13')](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));_0x417ca6(_0x501b51['result']['message']);}})['catch'](function(_0x389d22){logger[_0x98b2('0x10')](_0x98b2('0xb'),_0x221cee,_0x389d22);_0x388827(_0x389d22);});});}exports[_0x98b2('0x14')]=function(_0x4b9f2c){var _0x1cd8c6=this;return new Promise(function(_0x588837,_0x989082){return db['Attachment'][_0x98b2('0x15')](_0x4b9f2c[_0x98b2('0x16')],{'raw':_0x4b9f2c[_0x98b2('0x17')]?_0x4b9f2c[_0x98b2('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x98b2('0xa')](function(_0x242cbd){logger['info']('CreateAttachment',_0x4b9f2c);logger[_0x98b2('0xd')](_0x98b2('0x14'),_0x4b9f2c,JSON['stringify'](_0x242cbd));_0x588837(_0x242cbd);})['catch'](function(_0x3796c0){logger[_0x98b2('0x10')]('CreateAttachment',_0x3796c0[_0x98b2('0x12')],_0x4b9f2c);_0x989082(_0x1cd8c6[_0x98b2('0x10')](0x1f4,_0x3796c0[_0x98b2('0x12')]));});});}; \ No newline at end of file +var _0x2333=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateAttachment','options','raw','stringify','lodash','util','randomstring','ioredis'];(function(_0x167e46,_0x5d0cb2){var _0x544e7b=function(_0x261b0e){while(--_0x261b0e){_0x167e46['push'](_0x167e46['shift']());}};_0x544e7b(++_0x5d0cb2);}(_0x2333,0x11a));var _0x3233=function(_0x1f1061,_0xbe6428){_0x1f1061=_0x1f1061-0x0;var _0x4a94f4=_0x2333[_0x1f1061];return _0x4a94f4;};'use strict';var _=require(_0x3233('0x0'));var util=require(_0x3233('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3233('0x2'));var fs=require('fs');var Redis=require(_0x3233('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3233('0x4'));var logger=require(_0x3233('0x5'))(_0x3233('0x6'));var config=require(_0x3233('0x7'));var jayson=require(_0x3233('0x8'));var client=jayson[_0x3233('0x9')][_0x3233('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33a56d,_0x1e93e8,_0x1842a1){return new BPromise(function(_0x1837b6,_0x2ee6df){return client[_0x3233('0xb')](_0x33a56d,_0x1842a1)[_0x3233('0xc')](function(_0x7ff4bd){logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));logger[_0x3233('0x10')](_0x3233('0x11'),_0x1e93e8,_0x3233('0xf'),JSON['stringify'](_0x7ff4bd));if(_0x7ff4bd[_0x3233('0x12')]){if(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x13')]===0x1f4){logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x2ee6df(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);}logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x1837b6(_0x7ff4bd['error']['message']);}else{logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));_0x1837b6(_0x7ff4bd['result'][_0x3233('0x14')]);}})[_0x3233('0x15')](function(_0x127227){logger['error'](_0x3233('0xe'),_0x1e93e8,_0x127227);_0x2ee6df(_0x127227);});});}exports[_0x3233('0x16')]=function(_0x55fa30){var _0x38a9c0=this;return new Promise(function(_0x58420c,_0x233141){return db['Attachment']['create'](_0x55fa30['body'],{'raw':_0x55fa30[_0x3233('0x17')]?_0x55fa30['options'][_0x3233('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x305227){logger[_0x3233('0xd')](_0x3233('0x16'),_0x55fa30);logger[_0x3233('0x10')]('CreateAttachment',_0x55fa30,JSON[_0x3233('0x19')](_0x305227));_0x58420c(_0x305227);})[_0x3233('0x15')](function(_0x56fa5a){logger['error'](_0x3233('0x16'),_0x56fa5a['message'],_0x55fa30);_0x233141(_0x38a9c0[_0x3233('0x12')](0x1f4,_0x56fa5a[_0x3233('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4b3f771..ea746a5 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x472ffa,_0x22e185){var _0x2bfefd=function(_0x5a95b3){while(--_0x5a95b3){_0x472ffa['push'](_0x472ffa['shift']());}};_0x2bfefd(++_0x22e185);}(_0x5f2f,0x73));var _0xf5f2=function(_0x19e013,_0x5c74e0){_0x19e013=_0x19e013-0x0;var _0x58c128=_0x5f2f[_0x19e013];return _0x58c128;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb28,0x106));var _0x8db2=function(_0x142fcd,_0x4e41ff){_0x142fcd=_0x142fcd-0x0;var _0x1d4c77=_0xdb28[_0x142fcd];return _0x1d4c77;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 4ec1d0d..4b6af5c 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 _0x40a3=['role','blockedAt','online','admin','user','agent','name','blockDuration','blocked','minutes','getLicense','catch','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x40a3,0x1c3));var _0x340a=function(_0x302e77,_0x3bc416){_0x302e77=_0x302e77-0x0;var _0x490f3d=_0x40a3[_0x302e77];return _0x490f3d;};'use strict';var passport=require(_0x340a('0x0'));var LocalStrategy=require(_0x340a('0x1'))[_0x340a('0x2')];var moment=require(_0x340a('0x3'));var ActiveDirectory=require(_0x340a('0x4'));var BPromise=require('bluebird');var util=require(_0x340a('0x5'));var db=require(_0x340a('0x6'))['db'];var authService=require(_0x340a('0x7'));var utils=require(_0x340a('0x8'));var config=require(_0x340a('0x9'));var logger=require(_0x340a('0xa'))(_0x340a('0xb'));function isActiveDirectoryConfigured(_0x33e52b){var _0xd4559f=![];if(typeof _0x33e52b[_0x340a('0xc')]!==_0x340a('0xd')){_0xd4559f=_0x33e52b[_0x340a('0xc')][_0x340a('0xe')]&&_0x33e52b['activedirectory']['url']&&_0x33e52b[_0x340a('0xc')][_0x340a('0xf')];}return _0xd4559f;}function adAuthenticate(_0x245459,_0x80c108,_0x158db8){return new BPromise(function(_0x19c616,_0x27e260){try{var _0x16a530=new ActiveDirectory(_0x245459);_0x16a530[_0x340a('0x10')](_0x80c108,_0x158db8,function(_0x4c7cfa,_0x41586b){if(_0x4c7cfa){logger[_0x340a('0x11')](_0x340a('0x12'),_0x80c108,util[_0x340a('0x13')](_0x4c7cfa,{'showHidden':![],'depth':null}));_0x27e260('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x41586b){logger[_0x340a('0x11')](_0x340a('0x14'),_0x80c108);_0x27e260(_0x340a('0x15'));}else{_0x19c616(_0x41586b);}});}catch(_0x12dd29){_0x27e260(_0x12dd29);}});}function ActiveDirectoryAuthenticate(_0x180789,_0x12070b,_0x3aaf46,_0x529397){var _0x36c2d7,_0x4b145f;if(!isActiveDirectoryConfigured(config)){logger[_0x340a('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x12070b);return _0x529397(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x340a('0x16')][_0x340a('0x17')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0x340a('0x18')](function(_0x46c98f){_0x36c2d7=_0x46c98f;if(!_0x36c2d7[_0x340a('0x19')]){logger[_0x340a('0x11')](_0x340a('0x1a'),_0x12070b);throw new Error(_0x340a('0x15'));}return _0x180789[_0x340a('0x17')]({'attributes':['id','name',_0x340a('0x1b'),_0x340a('0x1c'),_0x340a('0x1d'),'disabled','blocked',_0x340a('0x1e'),_0x340a('0x1f')],'where':{'name':_0x12070b,'role':{'$or':[_0x340a('0x20'),_0x340a('0x21'),_0x340a('0x22')]},'adSsoEnabled':!![]}});})['then'](function(_0xe7c338){if(!_0xe7c338||_0xe7c338&&_0xe7c338[_0x340a('0x23')]!==_0x12070b){throw new Error(_0x340a('0x15'));}_0x4b145f=_0xe7c338;var _0x4418bf=_0x4b145f[_0x340a('0x23')]+'@'+config[_0x340a('0xc')]['domain'];return adAuthenticate(config[_0x340a('0xc')],_0x4418bf,_0x3aaf46);})[_0x340a('0x18')](function(_0x459a99){if(_0x4b145f['disabled']){throw new Error(_0x340a('0x15'));}if(_0x36c2d7[_0x340a('0x24')]>0x0){if(_0x4b145f[_0x340a('0x25')]){if(moment(_0x4b145f[_0x340a('0x1e')])['add'](_0x36c2d7['blockDuration'],_0x340a('0x26'))>moment()){throw new Error(_0x340a('0x15'));}return utils['clearBlockUser'](_0x4b145f,0x0,![],null)['then'](function(){return utils[_0x340a('0x27')](_0x4b145f);})[_0x340a('0x18')](function(){return _0x529397(null,_0x4b145f);});}else{return utils[_0x340a('0x27')](_0x4b145f)['then'](function(){return _0x529397(null,_0x4b145f);});}}else{return utils[_0x340a('0x27')](_0x4b145f)[_0x340a('0x18')](function(){return _0x529397(null,_0x4b145f);});}})[_0x340a('0x28')](function(_0x596299){return _0x529397(null,![],_0x596299);});}function handleError(_0x2c5d7d,_0x952a95,_0x26ed27){return _0x2c5d7d['status'](_0x952a95||0x1f4)['send']({'message':_0x26ed27?_0x26ed27[_0x340a('0x29')]||_0x26ed27:''});}exports[_0x340a('0x2a')]=function(_0x4f474c,_0x231e00,_0x446b98){passport[_0x340a('0x10')](_0x340a('0x2b'),function(_0xd54679,_0x4e3bc6,_0x351e8a){var _0x2f1ce4=_0xd54679||_0x351e8a;if(_0x2f1ce4){return handleError(_0x231e00,0x191,_0x2f1ce4);}if(!_0x4e3bc6){return handleError(_0x231e00,0x194,{'message':_0x340a('0x2c')});}else{var _0x1c0916={'payload':{'id':_0x4e3bc6['id'],'role':_0x4e3bc6[_0x340a('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x340a('0x2d')](_0x1c0916)[_0x340a('0x18')](function(_0x5c9adf){_0x231e00[_0x340a('0x2e')]({'id':_0x4e3bc6['id'],'token':_0x5c9adf,'statusCall':'','isAlreadyLogged':_0x4e3bc6[_0x340a('0x1f')]});});}})(_0x4f474c,_0x231e00,_0x446b98);};passport['use'](_0x340a('0x2b'),new LocalStrategy({'usernameField':_0x340a('0x23'),'passwordField':_0x340a('0x1b')},function(_0x397831,_0x1cdee6,_0x4b7c19){return ActiveDirectoryAuthenticate(db[_0x340a('0x2f')],_0x397831,_0x1cdee6,_0x4b7c19);})); \ No newline at end of file +var _0xc5b0=['add','clearBlockUser','getLicense','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','password','User','passport','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','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:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','name','salt','role','disabled','blocked','blockedAt','admin','user','agent','blockDuration'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc5b0,0x173));var _0x0c5b=function(_0x397f7f,_0x3c97e9){_0x397f7f=_0x397f7f-0x0;var _0x49984f=_0xc5b0[_0x397f7f];return _0x49984f;};'use strict';var passport=require(_0x0c5b('0x0'));var LocalStrategy=require(_0x0c5b('0x1'))[_0x0c5b('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x0c5b('0x3'));var BPromise=require(_0x0c5b('0x4'));var util=require(_0x0c5b('0x5'));var db=require(_0x0c5b('0x6'))['db'];var authService=require(_0x0c5b('0x7'));var utils=require(_0x0c5b('0x8'));var config=require(_0x0c5b('0x9'));var logger=require(_0x0c5b('0xa'))(_0x0c5b('0xb'));function isActiveDirectoryConfigured(_0x407e85){var _0x405f66=![];if(typeof _0x407e85[_0x0c5b('0xc')]!==_0x0c5b('0xd')){_0x405f66=_0x407e85['activedirectory'][_0x0c5b('0xe')]&&_0x407e85[_0x0c5b('0xc')][_0x0c5b('0xf')]&&_0x407e85[_0x0c5b('0xc')][_0x0c5b('0x10')];}return _0x405f66;}function adAuthenticate(_0x25b0dc,_0x27380e,_0x3b65ab){return new BPromise(function(_0x14a066,_0x2b3568){try{var _0x44fcaa=new ActiveDirectory(_0x25b0dc);_0x44fcaa[_0x0c5b('0x11')](_0x27380e,_0x3b65ab,function(_0x4c6a32,_0x4b7c05){if(_0x4c6a32){logger[_0x0c5b('0x12')](_0x0c5b('0x13'),_0x27380e,util[_0x0c5b('0x14')](_0x4c6a32,{'showHidden':![],'depth':null}));_0x2b3568('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x4b7c05){logger[_0x0c5b('0x12')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x27380e);_0x2b3568(_0x0c5b('0x15'));}else{_0x14a066(_0x4b7c05);}});}catch(_0x1ffb31){_0x2b3568(_0x1ffb31);}});}function ActiveDirectoryAuthenticate(_0x173bc1,_0xaddc05,_0xfcbf03,_0x391040){var _0x4c9822,_0x151dc4;if(!isActiveDirectoryConfigured(config)){logger[_0x0c5b('0x12')](_0x0c5b('0x16'),_0xaddc05);return _0x391040(null,![],{'message':_0x0c5b('0x15')});}return db[_0x0c5b('0x17')][_0x0c5b('0x18')]({'where':{'id':0x1},'attributes':[_0x0c5b('0x19'),'blockDuration'],'raw':!![]})[_0x0c5b('0x1a')](function(_0x1babdd){_0x4c9822=_0x1babdd;if(!_0x4c9822[_0x0c5b('0x19')]){logger[_0x0c5b('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0xaddc05);throw new Error(_0x0c5b('0x15'));}return _0x173bc1[_0x0c5b('0x18')]({'attributes':['id',_0x0c5b('0x1b'),'password',_0x0c5b('0x1c'),_0x0c5b('0x1d'),_0x0c5b('0x1e'),_0x0c5b('0x1f'),_0x0c5b('0x20'),'online'],'where':{'name':_0xaddc05,'role':{'$or':[_0x0c5b('0x21'),_0x0c5b('0x22'),_0x0c5b('0x23')]},'adSsoEnabled':!![]}});})['then'](function(_0xee0988){if(!_0xee0988||_0xee0988&&_0xee0988[_0x0c5b('0x1b')]!==_0xaddc05){throw new Error(_0x0c5b('0x15'));}_0x151dc4=_0xee0988;var _0x2215b5=_0x151dc4[_0x0c5b('0x1b')]+'@'+config[_0x0c5b('0xc')][_0x0c5b('0x10')];return adAuthenticate(config[_0x0c5b('0xc')],_0x2215b5,_0xfcbf03);})[_0x0c5b('0x1a')](function(_0x3de5a0){if(_0x151dc4[_0x0c5b('0x1e')]){throw new Error(_0x0c5b('0x15'));}if(_0x4c9822[_0x0c5b('0x24')]>0x0){if(_0x151dc4[_0x0c5b('0x1f')]){if(moment(_0x151dc4[_0x0c5b('0x20')])[_0x0c5b('0x25')](_0x4c9822[_0x0c5b('0x24')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x0c5b('0x26')](_0x151dc4,0x0,![],null)[_0x0c5b('0x1a')](function(){return utils[_0x0c5b('0x27')](_0x151dc4);})[_0x0c5b('0x1a')](function(){return _0x391040(null,_0x151dc4);});}else{return utils['getLicense'](_0x151dc4)[_0x0c5b('0x1a')](function(){return _0x391040(null,_0x151dc4);});}}else{return utils[_0x0c5b('0x27')](_0x151dc4)[_0x0c5b('0x1a')](function(){return _0x391040(null,_0x151dc4);});}})['catch'](function(_0x4e940f){return _0x391040(null,![],_0x4e940f);});}function handleError(_0x215234,_0x470634,_0xd14a67){return _0x215234['status'](_0x470634||0x1f4)[_0x0c5b('0x28')]({'message':_0xd14a67?_0xd14a67[_0x0c5b('0x29')]||_0xd14a67:''});}exports[_0x0c5b('0x2a')]=function(_0x399a95,_0x1914da,_0x419baf){passport[_0x0c5b('0x11')](_0x0c5b('0x2b'),function(_0x43ae64,_0x7c53cd,_0x317132){var _0x4399cc=_0x43ae64||_0x317132;if(_0x4399cc){return handleError(_0x1914da,0x191,_0x4399cc);}if(!_0x7c53cd){return handleError(_0x1914da,0x194,{'message':_0x0c5b('0x2c')});}else{var _0x1f208b={'payload':{'id':_0x7c53cd['id'],'role':_0x7c53cd[_0x0c5b('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x0c5b('0x2d')](_0x1f208b)[_0x0c5b('0x1a')](function(_0x245e81){_0x1914da[_0x0c5b('0x2e')]({'id':_0x7c53cd['id'],'token':_0x245e81,'statusCall':'','isAlreadyLogged':_0x7c53cd[_0x0c5b('0x2f')]});});}})(_0x399a95,_0x1914da,_0x419baf);};passport[_0x0c5b('0x30')](_0x0c5b('0x2b'),new LocalStrategy({'usernameField':_0x0c5b('0x1b'),'passwordField':_0x0c5b('0x31')},function(_0x1dc04f,_0x1f30aa,_0xe73a08){return ActiveDirectoryAuthenticate(db[_0x0c5b('0x32')],_0x1dc04f,_0x1f30aa,_0xe73a08);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 640e0c0..3ea002f 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 _0x7e2f=['exports','express','Router','post','login'];(function(_0x116482,_0x35ddae){var _0x56db37=function(_0xc3685c){while(--_0xc3685c){_0x116482['push'](_0x116482['shift']());}};_0x56db37(++_0x35ddae);}(_0x7e2f,0x164));var _0xf7e2=function(_0x100dea,_0x2ca828){_0x100dea=_0x100dea-0x0;var _0x785cb5=_0x7e2f[_0x100dea];return _0x785cb5;};'use strict';var express=require(_0xf7e2('0x0'));var router=express[_0xf7e2('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xf7e2('0x2')]('/',controller[_0xf7e2('0x3')]);module[_0xf7e2('0x4')]=router; \ No newline at end of file +var _0x6c80=['Router','./authActiveDirectory.controller','post','exports'];(function(_0x6dccf9,_0x4b2c5f){var _0x3fbde4=function(_0x82b170){while(--_0x82b170){_0x6dccf9['push'](_0x6dccf9['shift']());}};_0x3fbde4(++_0x4b2c5f);}(_0x6c80,0x18c));var _0x06c8=function(_0x41113f,_0x299dd9){_0x41113f=_0x41113f-0x0;var _0x7168f5=_0x6c80[_0x41113f];return _0x7168f5;};'use strict';var express=require('express');var router=express[_0x06c8('0x0')]();var controller=require(_0x06c8('0x1'));router[_0x06c8('0x2')]('/',controller['login']);module[_0x06c8('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b8c0c10..573373e 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(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x7a54,0x106));var _0x47a5=function(_0x51d9c4,_0x3d1835){_0x51d9c4=_0x51d9c4-0x0;var _0x1f3b35=_0x7a54[_0x51d9c4];return _0x1f3b35;};'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(_0x92c366,_0x43503f){var _0x50aa8e=function(_0x5a0273){while(--_0x5a0273){_0x92c366['push'](_0x92c366['shift']());}};_0x50aa8e(++_0x43503f);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 2dbdf99..1cd2457 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 _0x433b=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','setTokenCookie','passport','Router'];(function(_0x46744a,_0x5725f9){var _0x3a1d95=function(_0x1b40a7){while(--_0x1b40a7){_0x46744a['push'](_0x46744a['shift']());}};_0x3a1d95(++_0x5725f9);}(_0x433b,0x15c));var _0xb433=function(_0x47c5bd,_0x7605da){_0x47c5bd=_0x47c5bd-0x0;var _0x2447dc=_0x433b[_0x47c5bd];return _0x2447dc;};'use strict';var express=require('express');var passport=require(_0xb433('0x0'));var router=express[_0xb433('0x1')]();var controller=require(_0xb433('0x2'));var userController=require(_0xb433('0x3'));var authService=require(_0xb433('0x4'));router[_0xb433('0x5')]('/',controller[_0xb433('0x6')]);router[_0xb433('0x5')](_0xb433('0x7'),controller[_0xb433('0x8')],authService['isMiddleware'],userController[_0xb433('0x6')],authService[_0xb433('0x9')]);module['exports']=router; \ No newline at end of file +var _0x0a13=['callback','setTokenCookie','exports','express','passport','../../components/auth/service','get','login'];(function(_0x5c0015,_0xb4fcbf){var _0x526496=function(_0x267630){while(--_0x267630){_0x5c0015['push'](_0x5c0015['shift']());}};_0x526496(++_0xb4fcbf);}(_0x0a13,0x123));var _0x30a1=function(_0x289330,_0x54f85a){_0x289330=_0x289330-0x0;var _0x22d2d0=_0x0a13[_0x289330];return _0x22d2d0;};'use strict';var express=require(_0x30a1('0x0'));var passport=require(_0x30a1('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x30a1('0x2'));router[_0x30a1('0x3')]('/',controller[_0x30a1('0x4')]);router[_0x30a1('0x3')]('/callback',controller[_0x30a1('0x5')],authService['isMiddleware'],userController['login'],authService[_0x30a1('0x6')]);module[_0x30a1('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6ecf4f0..3bf76cb 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 _0x310f=['resetPasswordToken','resetPasswordExpires','Password\x20reset!','util','passport-local','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','password','salt','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','name','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory'];(function(_0x22574c,_0x416cfd){var _0x38a919=function(_0x164633){while(--_0x164633){_0x22574c['push'](_0x22574c['shift']());}};_0x38a919(++_0x416cfd);}(_0x310f,0xf9));var _0xf310=function(_0x2ba3a2,_0x27b815){_0x2ba3a2=_0x2ba3a2-0x0;var _0x25870e=_0x310f[_0x2ba3a2];return _0x25870e;};'use strict';var util=require(_0xf310('0x0'));var passport=require('passport');var LocalStrategy=require(_0xf310('0x1'))['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xf310('0x2'));var moment=require(_0xf310('0x3'));var db=require(_0xf310('0x4'))['db'];var authService=require(_0xf310('0x5'));var utils=require(_0xf310('0x6'));var client=jayson['client'][_0xf310('0x7')]({'port':0x232b});function localAuthenticate(_0x8bbf06,_0x39ec73,_0x4d7965,_0x608a73){var _0x5c90c6,_0x31eff2;return db[_0xf310('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0xf310('0x9'),_0xf310('0xa')],'raw':!![]})[_0xf310('0xb')](function(_0x33ed89){_0x5c90c6=_0x33ed89;return _0x8bbf06[_0xf310('0xc')]({'attributes':['id','name',_0xf310('0xd'),_0xf310('0xe'),'role','disabled',_0xf310('0xf'),_0xf310('0x10'),_0xf310('0x11')],'where':{'name':_0x39ec73,'role':{'$or':[_0xf310('0x12'),_0xf310('0x13'),_0xf310('0x14')]}}});})[_0xf310('0xb')](function(_0x569925){if(!_0x569925||_0x569925&&_0x569925['name']!==_0x39ec73){throw new Error(_0xf310('0x15'));}else{_0x31eff2=_0x569925;return _0x31eff2;}})[_0xf310('0xb')](function(){_0x31eff2[_0xf310('0x16')](_0x4d7965,function(_0x2bd0ed,_0x5330ca){var _0x743d40=_0x31eff2[_0xf310('0x11')]+0x1;if(_0x2bd0ed){return _0x608a73(_0x2bd0ed);}else if(!_0x5330ca){if(_0x31eff2[_0xf310('0x17')]){return _0x608a73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5c90c6[_0xf310('0x9')]>0x0){if(_0x31eff2['blocked']){if(_0x5c90c6['blockDuration']>0x0){if(moment(_0x31eff2['blockedAt'])[_0xf310('0x18')](_0x5c90c6['blockDuration'],_0xf310('0x19'))>moment()){return _0x608a73(null,![],{'message':_0xf310('0x15')});}else{return utils['clearBlockUser'](_0x31eff2,_0x743d40,![],null)[_0xf310('0xb')](function(){return _0x608a73(null,![],{'message':_0xf310('0x15')});});}}else{return _0x608a73(null,![],{'message':_0xf310('0x15')});}}else{if(_0x743d40>=_0x5c90c6[_0xf310('0x9')]){return utils[_0xf310('0x1a')](_0x31eff2,0x0,!![],moment())['then'](function(){return _0x608a73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xf310('0x1a')](_0x31eff2,_0x743d40,![],null)[_0xf310('0xb')](function(){return _0x608a73(null,![],{'message':_0xf310('0x15')});});}}}else{return _0x608a73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x31eff2[_0xf310('0x17')]){return _0x608a73(null,![],{'message':_0xf310('0x15')});}else if(_0x5c90c6['allowedLoginAttempts']>0x0){if(_0x31eff2[_0xf310('0xf')]){if(_0x5c90c6[_0xf310('0xa')]>0x0){if(moment(_0x31eff2[_0xf310('0x10')])[_0xf310('0x18')](_0x5c90c6[_0xf310('0xa')],_0xf310('0x19'))>moment()){return _0x608a73(null,![],{'message':_0xf310('0x15')});}else{return utils[_0xf310('0x1a')](_0x31eff2,0x0,![],null)['then'](function(){return utils[_0xf310('0x1b')](_0x31eff2);})[_0xf310('0xb')](function(){return _0x608a73(null,_0x31eff2);});}}else{return _0x608a73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xf310('0x1a')](_0x31eff2,0x0,![],null)[_0xf310('0xb')](function(){return utils[_0xf310('0x1b')](_0x31eff2);})[_0xf310('0xb')](function(){return _0x608a73(null,_0x31eff2);})[_0xf310('0x1c')](function(_0x258fdb){return _0x608a73(null,![],_0x258fdb);});}}else{if(_0x31eff2[_0xf310('0xf')]){return _0x608a73(null,![],{'message':_0xf310('0x15')});}else{return utils[_0xf310('0x1b')](_0x31eff2)[_0xf310('0xb')](function(){return _0x608a73(null,_0x31eff2);});}}}});})[_0xf310('0x1c')](function(_0x19bb3c){return _0x608a73(null,![],_0x19bb3c);});}function sendServiceMail(_0x2d5d60){return db[_0xf310('0x1d')][_0xf310('0x1e')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0xf310('0x1f'),'include':[{'model':db['CloudProvider'],'as':_0xf310('0x20')}]}]})[_0xf310('0xb')](function(_0x1aca71){if(!_0x1aca71){throw new Error(_0xf310('0x21'));}var _0x462979=_0x1aca71[_0xf310('0x22')]();var _0x23ea19={'account':_0x462979,'message':_[_0xf310('0x23')]({'from':util[_0xf310('0x24')]('\x22%s\x22\x20<%s>',_0x1aca71[_0xf310('0x25')],_0x1aca71[_0xf310('0x26')]||_0x1aca71[_0xf310('0x1f')][_0xf310('0x13')])},_0x2d5d60)};return client[_0xf310('0x27')](_0xf310('0x28'),_0x23ea19);})[_0xf310('0xb')](function(_0x2ca45f){if(_0x2ca45f[_0xf310('0x29')]){throw new Error(util[_0xf310('0x24')](_0xf310('0x2a'),_0x2ca45f[_0xf310('0x29')][_0xf310('0x2b')]||JSON[_0xf310('0x2c')](_0x2ca45f[_0xf310('0x29')])));}return!![];});}function handleError(_0x288cf2,_0x1a1fb4,_0x49b461){return _0x288cf2[_0xf310('0x2d')](_0x1a1fb4||0x1f4)[_0xf310('0x2e')]({'message':_0x49b461?_0x49b461[_0xf310('0x2b')]||_0x49b461:''});}exports[_0xf310('0x2f')]=function(_0x223cda,_0x2eb74a,_0x4b3133){passport[_0xf310('0x16')](_0xf310('0x30'),function(_0x3d12c1,_0x29445a,_0x36fbd1){var _0xe943d5=_0x3d12c1||_0x36fbd1;if(_0xe943d5){return handleError(_0x2eb74a,0x191,_0xe943d5);}if(!_0x29445a){return handleError(_0x2eb74a,0x194,{'message':_0xf310('0x31')});}else{var _0x63851f={'payload':{'id':_0x29445a['id'],'role':_0x29445a['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x63851f)[_0xf310('0xb')](function(_0x2ec5e0){_0x2eb74a[_0xf310('0x32')]({'id':_0x29445a['id'],'token':_0x2ec5e0,'statusCall':'','isAlreadyLogged':_0x29445a[_0xf310('0x33')]});});}})(_0x223cda,_0x2eb74a,_0x4b3133);};exports['forgot']=function(_0x3e1cf7,_0x3e3950){if(!_0x3e1cf7[_0xf310('0x34')][_0xf310('0x26')]){return handleError(_0x3e3950,0x1f4,{'message':_0xf310('0x35')});}var _0x402999=rs[_0xf310('0x36')]();_0x3e1cf7[_0xf310('0x34')][_0xf310('0x26')]=_0x3e1cf7[_0xf310('0x34')][_0xf310('0x26')][_0xf310('0x37')]()[_0xf310('0x38')]();var _0x152c06;return db[_0xf310('0x8')][_0xf310('0xc')]({'where':{'id':0x1},'attributes':[_0xf310('0x9'),_0xf310('0xa')],'raw':!![]})[_0xf310('0xb')](function(_0xc6094a){_0x152c06=_0xc6094a;return db[_0xf310('0x39')][_0xf310('0x1e')]({'where':{'email':_0x3e1cf7[_0xf310('0x34')][_0xf310('0x26')]}});})[_0xf310('0xb')](function(_0x3307a4){if(!_0x3307a4){throw new Error(_0xf310('0x3a'));}if(_0x3307a4[_0xf310('0x17')]){throw new Error(_0xf310('0x3b'));}if(_0x3307a4['blocked']){if(moment(_0x3307a4[_0xf310('0x10')])[_0xf310('0x18')](_0x152c06[_0xf310('0xa')],_0xf310('0x19'))>moment()){throw new Error(_0xf310('0x3c'));}else{_0x3307a4[_0xf310('0xf')]=![];_0x3307a4[_0xf310('0x10')]=null;}}_0x3307a4['resetPasswordToken']=_0x402999;_0x3307a4['resetPasswordExpires']=Date[_0xf310('0x3d')]()+0x36ee80;return _0x3307a4[_0xf310('0x3e')]();})[_0xf310('0xb')](function(){return sendServiceMail({'to':_0x3e1cf7[_0xf310('0x34')][_0xf310('0x26')],'subject':_0xf310('0x3f'),'text':_0xf310('0x40')+_0xf310('0x41')+_0xf310('0x42')+_0x3e1cf7[_0xf310('0x43')][_0xf310('0x44')]+'/reset/'+_0x402999+'\x0a\x0a'+_0xf310('0x45')});})['then'](function(){_0x3e3950[_0xf310('0x2d')](0xc8)[_0xf310('0x2e')]({'message':_0xf310('0x46')});})[_0xf310('0x1c')](function(_0x31aead){return handleError(_0x3e3950,0x1f4,_0x31aead);});};exports['reset']=function(_0x24ac9a,_0x5ad28f){return db[_0xf310('0x39')][_0xf310('0x1e')]({'where':{'resetPasswordToken':_0x24ac9a[_0xf310('0x47')][_0xf310('0x48')],'resetPasswordExpires':{'$gt':Date[_0xf310('0x3d')]()}}})[_0xf310('0xb')](function(_0xb10fc7){if(!_0xb10fc7){throw new Error(_0xf310('0x49'));}return db[_0xf310('0x8')]['findOne']({'attributes':['id','securePassword',_0xf310('0x4a'),_0xf310('0x4b')]})[_0xf310('0xb')](function(_0x170f3e){if(_0x170f3e[_0xf310('0x4c')])authService[_0xf310('0x4d')](_0x24ac9a['body'][_0xf310('0xd')]);if(!_0x170f3e[_0xf310('0x4a')]||!_0xb10fc7['previousPasswords'])return _0xb10fc7;authService[_0xf310('0x4e')](_0x24ac9a[_0xf310('0x34')][_0xf310('0xd')],_0xb10fc7['previousPasswords'],_0x170f3e[_0xf310('0x4b')]);return _0xb10fc7;})['then'](function(){_0xb10fc7[_0xf310('0xd')]=_0x24ac9a['body'][_0xf310('0xd')];_0xb10fc7[_0xf310('0x4f')]=null;_0xb10fc7[_0xf310('0x50')]=null;return _0xb10fc7[_0xf310('0x3e')]();});})[_0xf310('0xb')](function(){_0x5ad28f[_0xf310('0x2d')](0xc8)[_0xf310('0x2e')]({'message':_0xf310('0x51')});})[_0xf310('0x1c')](function(_0x4ddc4c){return handleError(_0x5ad28f,0x1f4,_0x4ddc4c);});};passport['use'](_0xf310('0x30'),new LocalStrategy({'usernameField':'name','passwordField':_0xf310('0xd')},function(_0x324b6b,_0x4ae829,_0x154be5){return localAuthenticate(db[_0xf310('0x39')],_0x324b6b,_0x4ae829,_0x154be5);})); \ No newline at end of file +var _0xaae9=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','password','send','Password\x20reset!','use','local-login','passport','passport-local','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','findOne','allowedLoginAttempts','then','role','disabled','blocked','loginAttempts','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','generate','body','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0xc036bb,_0x5cab81){var _0x523ab9=function(_0x2eed72){while(--_0x2eed72){_0xc036bb['push'](_0xc036bb['shift']());}};_0x523ab9(++_0x5cab81);}(_0xaae9,0x194));var _0x9aae=function(_0xbaaffc,_0xc5ce9b){_0xbaaffc=_0xbaaffc-0x0;var _0x1f91a4=_0xaae9[_0xbaaffc];return _0x1f91a4;};'use strict';var util=require('util');var passport=require(_0x9aae('0x0'));var LocalStrategy=require(_0x9aae('0x1'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x9aae('0x2'));var rs=require('randomstring');var moment=require(_0x9aae('0x3'));var db=require(_0x9aae('0x4'))['db'];var authService=require(_0x9aae('0x5'));var utils=require(_0x9aae('0x6'));var client=jayson[_0x9aae('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x3ac299,_0x5c8c60,_0x26e6f9,_0x1bdfe2){var _0x2bcc4f,_0x3a0b9f;return db['Setting'][_0x9aae('0x8')]({'where':{'id':0x1},'attributes':[_0x9aae('0x9'),'blockDuration'],'raw':!![]})[_0x9aae('0xa')](function(_0x19e807){_0x2bcc4f=_0x19e807;return _0x3ac299[_0x9aae('0x8')]({'attributes':['id','name','password','salt',_0x9aae('0xb'),_0x9aae('0xc'),_0x9aae('0xd'),'blockedAt',_0x9aae('0xe')],'where':{'name':_0x5c8c60,'role':{'$or':['admin',_0x9aae('0xf'),'agent']}}});})[_0x9aae('0xa')](function(_0x28f016){if(!_0x28f016||_0x28f016&&_0x28f016[_0x9aae('0x10')]!==_0x5c8c60){throw new Error(_0x9aae('0x11'));}else{_0x3a0b9f=_0x28f016;return _0x3a0b9f;}})[_0x9aae('0xa')](function(){_0x3a0b9f[_0x9aae('0x12')](_0x26e6f9,function(_0x22cba8,_0xfd9565){var _0x20f68e=_0x3a0b9f[_0x9aae('0xe')]+0x1;if(_0x22cba8){return _0x1bdfe2(_0x22cba8);}else if(!_0xfd9565){if(_0x3a0b9f[_0x9aae('0xc')]){return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});}else if(_0x2bcc4f[_0x9aae('0x9')]>0x0){if(_0x3a0b9f[_0x9aae('0xd')]){if(_0x2bcc4f[_0x9aae('0x13')]>0x0){if(moment(_0x3a0b9f[_0x9aae('0x14')])[_0x9aae('0x15')](_0x2bcc4f[_0x9aae('0x13')],'minutes')>moment()){return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});}else{return utils[_0x9aae('0x16')](_0x3a0b9f,_0x20f68e,![],null)[_0x9aae('0xa')](function(){return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});});}}else{return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});}}else{if(_0x20f68e>=_0x2bcc4f[_0x9aae('0x9')]){return utils[_0x9aae('0x16')](_0x3a0b9f,0x0,!![],moment())[_0x9aae('0xa')](function(){return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});});}else{return utils[_0x9aae('0x16')](_0x3a0b9f,_0x20f68e,![],null)[_0x9aae('0xa')](function(){return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});});}}}else{return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});}}else{if(_0x3a0b9f['disabled']){return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});}else if(_0x2bcc4f[_0x9aae('0x9')]>0x0){if(_0x3a0b9f[_0x9aae('0xd')]){if(_0x2bcc4f['blockDuration']>0x0){if(moment(_0x3a0b9f[_0x9aae('0x14')])[_0x9aae('0x15')](_0x2bcc4f[_0x9aae('0x13')],_0x9aae('0x17'))>moment()){return _0x1bdfe2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x9aae('0x16')](_0x3a0b9f,0x0,![],null)[_0x9aae('0xa')](function(){return utils[_0x9aae('0x18')](_0x3a0b9f);})[_0x9aae('0xa')](function(){return _0x1bdfe2(null,_0x3a0b9f);});}}else{return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});}}else{return utils[_0x9aae('0x16')](_0x3a0b9f,0x0,![],null)[_0x9aae('0xa')](function(){return utils[_0x9aae('0x18')](_0x3a0b9f);})[_0x9aae('0xa')](function(){return _0x1bdfe2(null,_0x3a0b9f);})[_0x9aae('0x19')](function(_0x6fb7c6){return _0x1bdfe2(null,![],_0x6fb7c6);});}}else{if(_0x3a0b9f['blocked']){return _0x1bdfe2(null,![],{'message':_0x9aae('0x11')});}else{return utils[_0x9aae('0x18')](_0x3a0b9f)[_0x9aae('0xa')](function(){return _0x1bdfe2(null,_0x3a0b9f);});}}}});})['catch'](function(_0x1aef99){return _0x1bdfe2(null,![],_0x1aef99);});}function sendServiceMail(_0x486911){return db[_0x9aae('0x1a')][_0x9aae('0x1b')]({'where':{'service':!![]},'attributes':['id','name',_0x9aae('0x1c')],'include':[{'model':db['MailServerOut'],'as':_0x9aae('0x1d'),'include':[{'model':db[_0x9aae('0x1e')],'as':_0x9aae('0x1e')}]}]})['then'](function(_0x392106){if(!_0x392106){throw new Error(_0x9aae('0x1f'));}var _0x5e6794=_0x392106[_0x9aae('0x20')]();var _0x4890ec={'account':_0x5e6794,'message':_['merge']({'from':util['format'](_0x9aae('0x21'),_0x392106[_0x9aae('0x10')],_0x392106[_0x9aae('0x1c')]||_0x392106[_0x9aae('0x1d')]['user'])},_0x486911)};return client[_0x9aae('0x22')](_0x9aae('0x23'),_0x4890ec);})[_0x9aae('0xa')](function(_0x110d6f){if(_0x110d6f[_0x9aae('0x24')]){throw new Error(util['format'](_0x9aae('0x25'),_0x110d6f[_0x9aae('0x24')]['message']||JSON[_0x9aae('0x26')](_0x110d6f[_0x9aae('0x24')])));}return!![];});}function handleError(_0x236924,_0x77b2ee,_0x1ff3aa){return _0x236924[_0x9aae('0x27')](_0x77b2ee||0x1f4)['send']({'message':_0x1ff3aa?_0x1ff3aa['message']||_0x1ff3aa:''});}exports[_0x9aae('0x28')]=function(_0x1bf381,_0x58c327,_0x3c8c8){passport[_0x9aae('0x12')]('local-login',function(_0x3d242b,_0x1fc4a2,_0x25b380){var _0x28be07=_0x3d242b||_0x25b380;if(_0x28be07){return handleError(_0x58c327,0x191,_0x28be07);}if(!_0x1fc4a2){return handleError(_0x58c327,0x194,{'message':_0x9aae('0x29')});}else{var _0x81bbf2={'payload':{'id':_0x1fc4a2['id'],'role':_0x1fc4a2['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x81bbf2)[_0x9aae('0xa')](function(_0x29ef2b){_0x58c327[_0x9aae('0x2a')]({'id':_0x1fc4a2['id'],'token':_0x29ef2b,'statusCall':'','isAlreadyLogged':_0x1fc4a2[_0x9aae('0x2b')]});});}})(_0x1bf381,_0x58c327,_0x3c8c8);};exports[_0x9aae('0x2c')]=function(_0x39653c,_0x2154d9){if(!_0x39653c['body'][_0x9aae('0x1c')]){return handleError(_0x2154d9,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x41c635=rs[_0x9aae('0x2d')]();_0x39653c[_0x9aae('0x2e')][_0x9aae('0x1c')]=_0x39653c[_0x9aae('0x2e')][_0x9aae('0x1c')]['trim']()[_0x9aae('0x2f')]();var _0x182f27;return db[_0x9aae('0x30')][_0x9aae('0x8')]({'where':{'id':0x1},'attributes':[_0x9aae('0x9'),_0x9aae('0x13')],'raw':!![]})[_0x9aae('0xa')](function(_0x461976){_0x182f27=_0x461976;return db[_0x9aae('0x31')][_0x9aae('0x1b')]({'where':{'email':_0x39653c[_0x9aae('0x2e')][_0x9aae('0x1c')]}});})[_0x9aae('0xa')](function(_0x3f6ce8){if(!_0x3f6ce8){throw new Error(_0x9aae('0x32'));}if(_0x3f6ce8[_0x9aae('0xc')]){throw new Error(_0x9aae('0x33'));}if(_0x3f6ce8[_0x9aae('0xd')]){if(moment(_0x3f6ce8[_0x9aae('0x14')])['add'](_0x182f27[_0x9aae('0x13')],_0x9aae('0x17'))>moment()){throw new Error(_0x9aae('0x34'));}else{_0x3f6ce8[_0x9aae('0xd')]=![];_0x3f6ce8[_0x9aae('0x14')]=null;}}_0x3f6ce8[_0x9aae('0x35')]=_0x41c635;_0x3f6ce8[_0x9aae('0x36')]=Date[_0x9aae('0x37')]()+0x36ee80;return _0x3f6ce8['save']();})['then'](function(){return sendServiceMail({'to':_0x39653c[_0x9aae('0x2e')][_0x9aae('0x1c')],'subject':_0x9aae('0x38'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x9aae('0x39')+_0x9aae('0x3a')+_0x39653c[_0x9aae('0x3b')]['host']+_0x9aae('0x3c')+_0x41c635+'\x0a\x0a'+_0x9aae('0x3d')});})['then'](function(){_0x2154d9['status'](0xc8)['send']({'message':_0x9aae('0x3e')});})['catch'](function(_0x1bafa9){return handleError(_0x2154d9,0x1f4,_0x1bafa9);});};exports['reset']=function(_0x210012,_0x53fdd0){return db[_0x9aae('0x31')][_0x9aae('0x1b')]({'where':{'resetPasswordToken':_0x210012[_0x9aae('0x3f')]['token'],'resetPasswordExpires':{'$gt':Date[_0x9aae('0x37')]()}}})[_0x9aae('0xa')](function(_0xeb4f11){if(!_0xeb4f11){throw new Error(_0x9aae('0x40'));}return db[_0x9aae('0x30')]['findOne']({'attributes':['id',_0x9aae('0x41'),_0x9aae('0x42'),_0x9aae('0x43')]})[_0x9aae('0xa')](function(_0x3ce500){if(_0x3ce500[_0x9aae('0x41')])authService[_0x9aae('0x44')](_0x210012['body']['password']);if(!_0x3ce500[_0x9aae('0x42')]||!_0xeb4f11[_0x9aae('0x45')])return _0xeb4f11;authService[_0x9aae('0x46')](_0x210012[_0x9aae('0x2e')][_0x9aae('0x47')],_0xeb4f11[_0x9aae('0x45')],_0x3ce500['passwordHistoryLimit']);return _0xeb4f11;})[_0x9aae('0xa')](function(){_0xeb4f11[_0x9aae('0x47')]=_0x210012[_0x9aae('0x2e')][_0x9aae('0x47')];_0xeb4f11[_0x9aae('0x35')]=null;_0xeb4f11[_0x9aae('0x36')]=null;return _0xeb4f11['save']();});})['then'](function(){_0x53fdd0[_0x9aae('0x27')](0xc8)[_0x9aae('0x48')]({'message':_0x9aae('0x49')});})[_0x9aae('0x19')](function(_0x2ff719){return handleError(_0x53fdd0,0x1f4,_0x2ff719);});};passport[_0x9aae('0x4a')](_0x9aae('0x4b'),new LocalStrategy({'usernameField':_0x9aae('0x10'),'passwordField':_0x9aae('0x47')},function(_0x597c5,_0x34585b,_0x5efca3){return localAuthenticate(db[_0x9aae('0x31')],_0x597c5,_0x34585b,_0x5efca3);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8d0126c..1245a73 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 _0xf8f5=['exports','Router','./authLocal.controller','login','post','reset'];(function(_0x59591b,_0x354045){var _0x576642=function(_0x12d1ce){while(--_0x12d1ce){_0x59591b['push'](_0x59591b['shift']());}};_0x576642(++_0x354045);}(_0xf8f5,0x13f));var _0x5f8f=function(_0x1e80f9,_0xa68ab1){_0x1e80f9=_0x1e80f9-0x0;var _0x46f8f5=_0xf8f5[_0x1e80f9];return _0x46f8f5;};'use strict';var express=require('express');var router=express[_0x5f8f('0x0')]();var controller=require(_0x5f8f('0x1'));router['post']('/',controller[_0x5f8f('0x2')]);router[_0x5f8f('0x3')]('/forgot',controller['forgot']);router[_0x5f8f('0x3')]('/reset/:token',controller[_0x5f8f('0x4')]);module[_0x5f8f('0x5')]=router; \ No newline at end of file +var _0xc4a4=['./authLocal.controller','post','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x92dfa8,_0x192395){var _0x473bdc=function(_0x356816){while(--_0x356816){_0x92dfa8['push'](_0x92dfa8['shift']());}};_0x473bdc(++_0x192395);}(_0xc4a4,0xa9));var _0x4c4a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc4a4[_0x1035c1];return _0x308d67;};'use strict';var express=require(_0x4c4a('0x0'));var router=express[_0x4c4a('0x1')]();var controller=require(_0x4c4a('0x2'));router[_0x4c4a('0x3')]('/',controller['login']);router[_0x4c4a('0x3')](_0x4c4a('0x4'),controller[_0x4c4a('0x5')]);router[_0x4c4a('0x3')](_0x4c4a('0x6'),controller[_0x4c4a('0x7')]);module[_0x4c4a('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ccba078..5837344 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 _0x3511=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0x3511,0x1c2));var _0x1351=function(_0x5ecac1,_0x2d7338){_0x5ecac1=_0x5ecac1-0x0;var _0x1fe487=_0x3511[_0x5ecac1];return _0x1fe487;};'use strict';var Sequelize=require(_0x1351('0x0'));module[_0x1351('0x1')]={'name':{'type':Sequelize[_0x1351('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x1351('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1351('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x0e22=['STRING','BOOLEAN','exports'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x0e22,0x1ee));var _0x20e2=function(_0x260ce2,_0x2e22b8){_0x260ce2=_0x260ce2-0x0;var _0x16b105=_0x0e22[_0x260ce2];return _0x16b105;};'use strict';var Sequelize=require('sequelize');module[_0x20e2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x20e2('0x1')]},'status':{'type':Sequelize[_0x20e2('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 2239a5a..b2e6e57 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 _0x08ff=['name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','findAll','catch','length','find','create','body','params','destroy','Condition','addConditions','ids','omit','getConditions','filter','addActions','getActions','findOne','Action','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','reject','save','update','then','error','stack','send','index','map','Automation','rawAttributes','fieldName','key','model'];(function(_0x5177c4,_0x1a76ab){var _0x6be752=function(_0x2269a3){while(--_0x2269a3){_0x5177c4['push'](_0x5177c4['shift']());}};_0x6be752(++_0x1a76ab);}(_0x08ff,0xbc));var _0xf08f=function(_0x23f5f6,_0x3950b2){_0x23f5f6=_0x23f5f6-0x0;var _0x686cbd=_0x08ff[_0x23f5f6];return _0x686cbd;};'use strict';var emlformat=require(_0xf08f('0x0'));var rimraf=require(_0xf08f('0x1'));var zipdir=require(_0xf08f('0x2'));var jsonpatch=require(_0xf08f('0x3'));var rp=require(_0xf08f('0x4'));var moment=require('moment');var BPromise=require(_0xf08f('0x5'));var Mustache=require(_0xf08f('0x6'));var util=require(_0xf08f('0x7'));var path=require(_0xf08f('0x8'));var sox=require(_0xf08f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf08f('0xa'));var _=require(_0xf08f('0xb'));var squel=require(_0xf08f('0xc'));var crypto=require('crypto');var jsforce=require(_0xf08f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf08f('0xe'));var querystring=require(_0xf08f('0xf'));var Papa=require(_0xf08f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf08f('0x11'));var as=require(_0xf08f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf08f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf08f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf08f('0x15'))['db'];function respondWithStatusCode(_0x17c011,_0x382e72){_0x382e72=_0x382e72||0xcc;return function(_0x6827d6){if(_0x6827d6){return _0x17c011[_0xf08f('0x16')](_0x382e72);}return _0x17c011[_0xf08f('0x17')](_0x382e72)[_0xf08f('0x18')]();};}function respondWithResult(_0x526131,_0x3c1151){_0x3c1151=_0x3c1151||0xc8;return function(_0x3768f0){if(_0x3768f0){return _0x526131[_0xf08f('0x17')](_0x3c1151)[_0xf08f('0x19')](_0x3768f0);}};}function respondWithFilteredResult(_0x949955,_0x3d37bc){return function(_0x4995f2){if(_0x4995f2){var _0xca2cb0=typeof _0x3d37bc[_0xf08f('0x1a')]==='undefined'&&typeof _0x3d37bc[_0xf08f('0x1b')]==='undefined';var _0x403ec2=_0x4995f2['count'];var _0x20acb4=_0xca2cb0?0x0:_0x3d37bc[_0xf08f('0x1a')];var _0x4480ff=_0xca2cb0?_0x4995f2[_0xf08f('0x1c')]:_0x3d37bc[_0xf08f('0x1a')]+_0x3d37bc[_0xf08f('0x1b')];var _0x17044a;if(_0x4480ff>=_0x403ec2){_0x4480ff=_0x403ec2;_0x17044a=0xc8;}else{_0x17044a=0xce;}_0x949955['status'](_0x17044a);return _0x949955['set']('Content-Range',_0x20acb4+'-'+_0x4480ff+'/'+_0x403ec2)[_0xf08f('0x19')](_0x4995f2);}return null;};}function patchUpdates(_0x400748){return function(_0x1e9046){try{jsonpatch['apply'](_0x1e9046,_0x400748,!![]);}catch(_0x180ff2){return BPromise[_0xf08f('0x1d')](_0x180ff2);}return _0x1e9046[_0xf08f('0x1e')]();};}function saveUpdates(_0x1d87cc,_0x39bd6e){return function(_0xd2c69c){if(_0xd2c69c){return _0xd2c69c[_0xf08f('0x1f')](_0x1d87cc)[_0xf08f('0x20')](function(_0x1fcbb7){return _0x1fcbb7;});}return null;};}function removeEntity(_0x5d36cc,_0x42d1f9){return function(_0x2d2b6a){if(_0x2d2b6a){return _0x2d2b6a['destroy']()[_0xf08f('0x20')](function(){_0x5d36cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d6db2,_0x24bc3e){return function(_0x3b9c9d){if(!_0x3b9c9d){_0x1d6db2[_0xf08f('0x16')](0x194);}return _0x3b9c9d;};}function handleError(_0x1e00a0,_0x5ba820){_0x5ba820=_0x5ba820||0x1f4;return function(_0x4eaef4){logger[_0xf08f('0x21')](_0x4eaef4[_0xf08f('0x22')]);if(_0x4eaef4['name']){delete _0x4eaef4['name'];}_0x1e00a0['status'](_0x5ba820)[_0xf08f('0x23')](_0x4eaef4);};}exports[_0xf08f('0x24')]=function(_0xff880f,_0x151aa5){var _0x516f26={},_0xba1c49={},_0x2313d5={'count':0x0,'rows':[]};var _0x2fb007=_[_0xf08f('0x25')](db[_0xf08f('0x26')][_0xf08f('0x27')],function(_0x5678fe){return{'name':_0x5678fe[_0xf08f('0x28')],'type':_0x5678fe['type'][_0xf08f('0x29')]};});_0xba1c49[_0xf08f('0x2a')]=_[_0xf08f('0x25')](_0x2fb007,_0xf08f('0x2b'));_0xba1c49[_0xf08f('0x2c')]=_[_0xf08f('0x2d')](_0xff880f['query']);_0xba1c49[_0xf08f('0x2e')]=_[_0xf08f('0x2f')](_0xba1c49[_0xf08f('0x2a')],_0xba1c49[_0xf08f('0x2c')]);_0x516f26[_0xf08f('0x30')]=_['intersection'](_0xba1c49[_0xf08f('0x2a')],qs[_0xf08f('0x31')](_0xff880f[_0xf08f('0x2c')][_0xf08f('0x31')]));_0x516f26[_0xf08f('0x30')]=_0x516f26[_0xf08f('0x30')]['length']?_0x516f26[_0xf08f('0x30')]:_0xba1c49['model'];if(!_0xff880f['query'][_0xf08f('0x32')](_0xf08f('0x33'))){_0x516f26['limit']=qs[_0xf08f('0x1b')](_0xff880f[_0xf08f('0x2c')][_0xf08f('0x1b')]);_0x516f26[_0xf08f('0x1a')]=qs[_0xf08f('0x1a')](_0xff880f[_0xf08f('0x2c')]['offset']);}_0x516f26[_0xf08f('0x34')]=qs[_0xf08f('0x35')](_0xff880f[_0xf08f('0x2c')][_0xf08f('0x35')]);_0x516f26[_0xf08f('0x36')]=qs['filters'](_['pick'](_0xff880f[_0xf08f('0x2c')],_0xba1c49['filters']),_0x2fb007);if(_0xff880f[_0xf08f('0x2c')]['filter']){_0x516f26[_0xf08f('0x36')]=_['merge'](_0x516f26['where'],{'$or':_[_0xf08f('0x25')](_0x2fb007,function(_0x40a929){if(_0x40a929['type']!=='VIRTUAL'){var _0x3f6ae0={};_0x3f6ae0[_0x40a929[_0xf08f('0x2b')]]={'$like':'%'+_0xff880f[_0xf08f('0x2c')]['filter']+'%'};return _0x3f6ae0;}})});}_0x516f26=_[_0xf08f('0x37')]({},_0x516f26,_0xff880f[_0xf08f('0x38')]);var _0x26863b={'where':_0x516f26[_0xf08f('0x36')]};return db[_0xf08f('0x26')]['count'](_0x26863b)[_0xf08f('0x20')](function(_0x562704){_0x2313d5[_0xf08f('0x1c')]=_0x562704;if(_0xff880f[_0xf08f('0x2c')][_0xf08f('0x39')]){_0x516f26['include']=[{'all':!![]}];}return db[_0xf08f('0x26')][_0xf08f('0x3a')](_0x516f26);})[_0xf08f('0x20')](function(_0x566ad6){_0x2313d5['rows']=_0x566ad6;return _0x2313d5;})['then'](respondWithFilteredResult(_0x151aa5,_0x516f26))[_0xf08f('0x3b')](handleError(_0x151aa5,null));};exports['show']=function(_0x379140,_0x17bce3){var _0x38f5c1={'raw':![],'where':{'id':_0x379140['params']['id']}},_0xc12883={};_0xc12883[_0xf08f('0x2a')]=_[_0xf08f('0x2d')](db[_0xf08f('0x26')][_0xf08f('0x27')]);_0xc12883['query']=_[_0xf08f('0x2d')](_0x379140[_0xf08f('0x2c')]);_0xc12883['filters']=_[_0xf08f('0x2f')](_0xc12883[_0xf08f('0x2a')],_0xc12883['query']);_0x38f5c1[_0xf08f('0x30')]=_['intersection'](_0xc12883[_0xf08f('0x2a')],qs[_0xf08f('0x31')](_0x379140[_0xf08f('0x2c')]['fields']));_0x38f5c1[_0xf08f('0x30')]=_0x38f5c1[_0xf08f('0x30')][_0xf08f('0x3c')]?_0x38f5c1[_0xf08f('0x30')]:_0xc12883[_0xf08f('0x2a')];if(_0x379140[_0xf08f('0x2c')][_0xf08f('0x39')]){_0x38f5c1['include']=[{'all':!![]}];}_0x38f5c1=_[_0xf08f('0x37')]({},_0x38f5c1,_0x379140[_0xf08f('0x38')]);return db[_0xf08f('0x26')][_0xf08f('0x3d')](_0x38f5c1)[_0xf08f('0x20')](handleEntityNotFound(_0x17bce3,null))[_0xf08f('0x20')](respondWithResult(_0x17bce3,null))[_0xf08f('0x3b')](handleError(_0x17bce3,null));};exports[_0xf08f('0x3e')]=function(_0x224944,_0x380b9b){return db[_0xf08f('0x26')][_0xf08f('0x3e')](_0x224944[_0xf08f('0x3f')],{})[_0xf08f('0x20')](respondWithResult(_0x380b9b,0xc9))[_0xf08f('0x3b')](handleError(_0x380b9b,null));};exports[_0xf08f('0x1f')]=function(_0xb8e17d,_0x2b9052){if(_0xb8e17d[_0xf08f('0x3f')]['id']){delete _0xb8e17d[_0xf08f('0x3f')]['id'];}return db['Automation'][_0xf08f('0x3d')]({'where':{'id':_0xb8e17d[_0xf08f('0x40')]['id']}})[_0xf08f('0x20')](handleEntityNotFound(_0x2b9052,null))[_0xf08f('0x20')](saveUpdates(_0xb8e17d[_0xf08f('0x3f')],null))[_0xf08f('0x20')](respondWithResult(_0x2b9052,null))[_0xf08f('0x3b')](handleError(_0x2b9052,null));};exports[_0xf08f('0x41')]=function(_0x20c80f,_0xb1f6c2){return db['Automation'][_0xf08f('0x3d')]({'where':{'id':_0x20c80f[_0xf08f('0x40')]['id']}})[_0xf08f('0x20')](handleEntityNotFound(_0xb1f6c2,null))[_0xf08f('0x20')](removeEntity(_0xb1f6c2,null))['catch'](handleError(_0xb1f6c2,null));};exports['addConditions']=function(_0x2cbe89,_0x192dd7,_0x52119b){return db[_0xf08f('0x42')][_0xf08f('0x3d')]({'where':{'id':_0x2cbe89[_0xf08f('0x40')]['id']}})[_0xf08f('0x20')](handleEntityNotFound(_0x192dd7,null))['then'](function(_0x7a47fe){if(_0x7a47fe){return _0x7a47fe[_0xf08f('0x43')](_0x2cbe89['body'][_0xf08f('0x44')],_[_0xf08f('0x45')](_0x2cbe89[_0xf08f('0x3f')],[_0xf08f('0x44'),'id'])||{});}})[_0xf08f('0x20')](respondWithResult(_0x192dd7,null))['catch'](handleError(_0x192dd7,null));};exports[_0xf08f('0x46')]=function(_0x1c35c8,_0x28aeae,_0x3542a9){var _0x382317={};var _0x26ec05={};var _0x342df1;var _0x40914a;return db[_0xf08f('0x26')]['findOne']({'where':{'id':_0x1c35c8[_0xf08f('0x40')]['id']}})['then'](handleEntityNotFound(_0x28aeae,null))[_0xf08f('0x20')](function(_0x4121f8){if(_0x4121f8){_0x342df1=_0x4121f8;_0x26ec05[_0xf08f('0x2a')]=_[_0xf08f('0x2d')](db[_0xf08f('0x42')][_0xf08f('0x27')]);_0x26ec05['query']=_[_0xf08f('0x2d')](_0x1c35c8[_0xf08f('0x2c')]);_0x26ec05[_0xf08f('0x2e')]=_[_0xf08f('0x2f')](_0x26ec05['model'],_0x26ec05[_0xf08f('0x2c')]);_0x382317[_0xf08f('0x30')]=_[_0xf08f('0x2f')](_0x26ec05[_0xf08f('0x2a')],qs[_0xf08f('0x31')](_0x1c35c8['query'][_0xf08f('0x31')]));_0x382317[_0xf08f('0x30')]=_0x382317[_0xf08f('0x30')][_0xf08f('0x3c')]?_0x382317['attributes']:_0x26ec05[_0xf08f('0x2a')];_0x382317[_0xf08f('0x34')]=qs[_0xf08f('0x35')](_0x1c35c8[_0xf08f('0x2c')][_0xf08f('0x35')]);_0x382317[_0xf08f('0x36')]=qs[_0xf08f('0x2e')](_['pick'](_0x1c35c8[_0xf08f('0x2c')],_0x26ec05[_0xf08f('0x2e')]));if(_0x1c35c8['query'][_0xf08f('0x47')]){_0x382317['where']=_['merge'](_0x382317['where'],{'$or':_[_0xf08f('0x25')](_0x382317[_0xf08f('0x30')],function(_0x470ceb){var _0x13151c={};_0x13151c[_0x470ceb]={'$like':'%'+_0x1c35c8[_0xf08f('0x2c')][_0xf08f('0x47')]+'%'};return _0x13151c;})});}_0x382317=_[_0xf08f('0x37')]({},_0x382317,_0x1c35c8[_0xf08f('0x38')]);return _0x342df1[_0xf08f('0x46')](_0x382317);}})[_0xf08f('0x20')](function(_0x1aa1fb){if(_0x1aa1fb){_0x40914a=_0x1aa1fb['length'];if(!_0x1c35c8[_0xf08f('0x2c')]['hasOwnProperty'](_0xf08f('0x33'))){_0x382317['limit']=qs[_0xf08f('0x1b')](_0x1c35c8['query'][_0xf08f('0x1b')]);_0x382317[_0xf08f('0x1a')]=qs[_0xf08f('0x1a')](_0x1c35c8['query'][_0xf08f('0x1a')]);}return _0x342df1[_0xf08f('0x46')](_0x382317);}})['then'](function(_0x356fd1){if(_0x356fd1){return _0x356fd1?{'count':_0x40914a,'rows':_0x356fd1}:null;}})[_0xf08f('0x20')](respondWithResult(_0x28aeae,null))[_0xf08f('0x3b')](handleError(_0x28aeae,null));};exports['addActions']=function(_0xe69279,_0x437051,_0xf02ee0){return db['Action'][_0xf08f('0x3d')]({'where':{'id':_0xe69279['params']['id']}})[_0xf08f('0x20')](handleEntityNotFound(_0x437051,null))['then'](function(_0x7d2a63){if(_0x7d2a63){return _0x7d2a63[_0xf08f('0x48')](_0xe69279['body'][_0xf08f('0x44')],_[_0xf08f('0x45')](_0xe69279[_0xf08f('0x3f')],['ids','id'])||{});}})[_0xf08f('0x20')](respondWithResult(_0x437051,null))[_0xf08f('0x3b')](handleError(_0x437051,null));};exports[_0xf08f('0x49')]=function(_0x34ac4b,_0x31fafb,_0x44133a){var _0x3b84ac={};var _0x53bbe9={};var _0x3ba856;var _0x15a0e0;return db[_0xf08f('0x26')][_0xf08f('0x4a')]({'where':{'id':_0x34ac4b['params']['id']}})['then'](handleEntityNotFound(_0x31fafb,null))[_0xf08f('0x20')](function(_0x622562){if(_0x622562){_0x3ba856=_0x622562;_0x53bbe9[_0xf08f('0x2a')]=_[_0xf08f('0x2d')](db[_0xf08f('0x4b')]['rawAttributes']);_0x53bbe9['query']=_['keys'](_0x34ac4b[_0xf08f('0x2c')]);_0x53bbe9[_0xf08f('0x2e')]=_[_0xf08f('0x2f')](_0x53bbe9[_0xf08f('0x2a')],_0x53bbe9[_0xf08f('0x2c')]);_0x3b84ac[_0xf08f('0x30')]=_[_0xf08f('0x2f')](_0x53bbe9[_0xf08f('0x2a')],qs[_0xf08f('0x31')](_0x34ac4b[_0xf08f('0x2c')]['fields']));_0x3b84ac[_0xf08f('0x30')]=_0x3b84ac['attributes'][_0xf08f('0x3c')]?_0x3b84ac['attributes']:_0x53bbe9[_0xf08f('0x2a')];_0x3b84ac[_0xf08f('0x34')]=qs['sort'](_0x34ac4b[_0xf08f('0x2c')]['sort']);_0x3b84ac[_0xf08f('0x36')]=qs[_0xf08f('0x2e')](_[_0xf08f('0x4c')](_0x34ac4b[_0xf08f('0x2c')],_0x53bbe9[_0xf08f('0x2e')]));if(_0x34ac4b['query'][_0xf08f('0x47')]){_0x3b84ac[_0xf08f('0x36')]=_[_0xf08f('0x37')](_0x3b84ac[_0xf08f('0x36')],{'$or':_[_0xf08f('0x25')](_0x3b84ac['attributes'],function(_0xa12d2d){var _0x1c2b46={};_0x1c2b46[_0xa12d2d]={'$like':'%'+_0x34ac4b['query'][_0xf08f('0x47')]+'%'};return _0x1c2b46;})});}_0x3b84ac=_[_0xf08f('0x37')]({},_0x3b84ac,_0x34ac4b[_0xf08f('0x38')]);return _0x3ba856[_0xf08f('0x49')](_0x3b84ac);}})[_0xf08f('0x20')](function(_0x317a3f){if(_0x317a3f){_0x15a0e0=_0x317a3f['length'];if(!_0x34ac4b['query'][_0xf08f('0x32')]('nolimit')){_0x3b84ac['limit']=qs[_0xf08f('0x1b')](_0x34ac4b[_0xf08f('0x2c')][_0xf08f('0x1b')]);_0x3b84ac['offset']=qs[_0xf08f('0x1a')](_0x34ac4b[_0xf08f('0x2c')][_0xf08f('0x1a')]);}return _0x3ba856[_0xf08f('0x49')](_0x3b84ac);}})[_0xf08f('0x20')](function(_0x25403a){if(_0x25403a){return _0x25403a?{'count':_0x15a0e0,'rows':_0x25403a}:null;}})[_0xf08f('0x20')](respondWithResult(_0x31fafb,null))[_0xf08f('0x3b')](handleError(_0x31fafb,null));}; \ No newline at end of file +var _0x05e8=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','addConditions','ids','omit','getConditions','findOne','sort','addActions','Action','getActions','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','Automation','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0x05e8,0x104));var _0x805e=function(_0x12b5f1,_0x2ad05e){_0x12b5f1=_0x12b5f1-0x0;var _0x5f2511=_0x05e8[_0x12b5f1];return _0x5f2511;};'use strict';var emlformat=require(_0x805e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x805e('0x1'));var rp=require(_0x805e('0x2'));var moment=require(_0x805e('0x3'));var BPromise=require(_0x805e('0x4'));var Mustache=require('mustache');var util=require(_0x805e('0x5'));var path=require(_0x805e('0x6'));var sox=require(_0x805e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x805e('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x805e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x805e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x805e('0xb'));var authService=require(_0x805e('0xc'));var qs=require(_0x805e('0xd'));var as=require(_0x805e('0xe'));var hardwareService=require(_0x805e('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x805e('0x10'));var licenseUtil=require(_0x805e('0x11'));var db=require(_0x805e('0x12'))['db'];function respondWithStatusCode(_0x18bb8e,_0x368f18){_0x368f18=_0x368f18||0xcc;return function(_0x588a7f){if(_0x588a7f){return _0x18bb8e[_0x805e('0x13')](_0x368f18);}return _0x18bb8e[_0x805e('0x14')](_0x368f18)[_0x805e('0x15')]();};}function respondWithResult(_0x28f8a4,_0x508767){_0x508767=_0x508767||0xc8;return function(_0x43b478){if(_0x43b478){return _0x28f8a4['status'](_0x508767)['json'](_0x43b478);}};}function respondWithFilteredResult(_0x5366f0,_0x2e0ec3){return function(_0x9d8944){if(_0x9d8944){var _0x51feb8=typeof _0x2e0ec3[_0x805e('0x16')]==='undefined'&&typeof _0x2e0ec3[_0x805e('0x17')]===_0x805e('0x18');var _0x4ea9fa=_0x9d8944[_0x805e('0x19')];var _0x40de42=_0x51feb8?0x0:_0x2e0ec3[_0x805e('0x16')];var _0x5641f1=_0x51feb8?_0x9d8944['count']:_0x2e0ec3[_0x805e('0x16')]+_0x2e0ec3['limit'];var _0x50b630;if(_0x5641f1>=_0x4ea9fa){_0x5641f1=_0x4ea9fa;_0x50b630=0xc8;}else{_0x50b630=0xce;}_0x5366f0[_0x805e('0x14')](_0x50b630);return _0x5366f0[_0x805e('0x1a')](_0x805e('0x1b'),_0x40de42+'-'+_0x5641f1+'/'+_0x4ea9fa)[_0x805e('0x1c')](_0x9d8944);}return null;};}function patchUpdates(_0x398635){return function(_0x30cc53){try{jsonpatch[_0x805e('0x1d')](_0x30cc53,_0x398635,!![]);}catch(_0x19417){return BPromise[_0x805e('0x1e')](_0x19417);}return _0x30cc53[_0x805e('0x1f')]();};}function saveUpdates(_0x10182a,_0x5669ea){return function(_0xb0a263){if(_0xb0a263){return _0xb0a263[_0x805e('0x20')](_0x10182a)[_0x805e('0x21')](function(_0x41157f){return _0x41157f;});}return null;};}function removeEntity(_0x4cb96d,_0x43ec9a){return function(_0x54650b){if(_0x54650b){return _0x54650b[_0x805e('0x22')]()[_0x805e('0x21')](function(){_0x4cb96d[_0x805e('0x14')](0xcc)[_0x805e('0x15')]();});}};}function handleEntityNotFound(_0x66f9fa,_0x3f78cc){return function(_0x2ca1fa){if(!_0x2ca1fa){_0x66f9fa[_0x805e('0x13')](0x194);}return _0x2ca1fa;};}function handleError(_0x31ea9f,_0x559a99){_0x559a99=_0x559a99||0x1f4;return function(_0x12a40c){logger[_0x805e('0x23')](_0x12a40c['stack']);if(_0x12a40c['name']){delete _0x12a40c[_0x805e('0x24')];}_0x31ea9f[_0x805e('0x14')](_0x559a99)[_0x805e('0x25')](_0x12a40c);};}exports[_0x805e('0x26')]=function(_0x52497c,_0xc450e1){var _0x51022={},_0x3dd5cf={},_0x11f00b={'count':0x0,'rows':[]};var _0x319992=_[_0x805e('0x27')](db[_0x805e('0x28')]['rawAttributes'],function(_0x29d9a9){return{'name':_0x29d9a9['fieldName'],'type':_0x29d9a9[_0x805e('0x29')]['key']};});_0x3dd5cf[_0x805e('0x2a')]=_['map'](_0x319992,'name');_0x3dd5cf[_0x805e('0x2b')]=_[_0x805e('0x2c')](_0x52497c['query']);_0x3dd5cf[_0x805e('0x2d')]=_[_0x805e('0x2e')](_0x3dd5cf['model'],_0x3dd5cf[_0x805e('0x2b')]);_0x51022[_0x805e('0x2f')]=_[_0x805e('0x2e')](_0x3dd5cf[_0x805e('0x2a')],qs[_0x805e('0x30')](_0x52497c[_0x805e('0x2b')][_0x805e('0x30')]));_0x51022['attributes']=_0x51022[_0x805e('0x2f')][_0x805e('0x31')]?_0x51022['attributes']:_0x3dd5cf[_0x805e('0x2a')];if(!_0x52497c[_0x805e('0x2b')][_0x805e('0x32')](_0x805e('0x33'))){_0x51022[_0x805e('0x17')]=qs[_0x805e('0x17')](_0x52497c[_0x805e('0x2b')][_0x805e('0x17')]);_0x51022[_0x805e('0x16')]=qs[_0x805e('0x16')](_0x52497c['query'][_0x805e('0x16')]);}_0x51022[_0x805e('0x34')]=qs['sort'](_0x52497c[_0x805e('0x2b')]['sort']);_0x51022[_0x805e('0x35')]=qs[_0x805e('0x2d')](_[_0x805e('0x36')](_0x52497c['query'],_0x3dd5cf[_0x805e('0x2d')]),_0x319992);if(_0x52497c[_0x805e('0x2b')][_0x805e('0x37')]){_0x51022[_0x805e('0x35')]=_[_0x805e('0x38')](_0x51022['where'],{'$or':_['map'](_0x319992,function(_0x3497d1){if(_0x3497d1['type']!==_0x805e('0x39')){var _0x50b080={};_0x50b080[_0x3497d1['name']]={'$like':'%'+_0x52497c[_0x805e('0x2b')][_0x805e('0x37')]+'%'};return _0x50b080;}})});}_0x51022=_[_0x805e('0x38')]({},_0x51022,_0x52497c[_0x805e('0x3a')]);var _0x577f11={'where':_0x51022[_0x805e('0x35')]};return db[_0x805e('0x28')][_0x805e('0x19')](_0x577f11)[_0x805e('0x21')](function(_0x46b92e){_0x11f00b[_0x805e('0x19')]=_0x46b92e;if(_0x52497c[_0x805e('0x2b')][_0x805e('0x3b')]){_0x51022[_0x805e('0x3c')]=[{'all':!![]}];}return db[_0x805e('0x28')][_0x805e('0x3d')](_0x51022);})[_0x805e('0x21')](function(_0x44ad56){_0x11f00b[_0x805e('0x3e')]=_0x44ad56;return _0x11f00b;})[_0x805e('0x21')](respondWithFilteredResult(_0xc450e1,_0x51022))['catch'](handleError(_0xc450e1,null));};exports[_0x805e('0x3f')]=function(_0x4500ce,_0x24d727){var _0x24b051={'raw':![],'where':{'id':_0x4500ce[_0x805e('0x40')]['id']}},_0x7beca4={};_0x7beca4['model']=_['keys'](db[_0x805e('0x28')][_0x805e('0x41')]);_0x7beca4['query']=_[_0x805e('0x2c')](_0x4500ce[_0x805e('0x2b')]);_0x7beca4[_0x805e('0x2d')]=_[_0x805e('0x2e')](_0x7beca4['model'],_0x7beca4['query']);_0x24b051[_0x805e('0x2f')]=_[_0x805e('0x2e')](_0x7beca4[_0x805e('0x2a')],qs['fields'](_0x4500ce['query'][_0x805e('0x30')]));_0x24b051[_0x805e('0x2f')]=_0x24b051[_0x805e('0x2f')][_0x805e('0x31')]?_0x24b051[_0x805e('0x2f')]:_0x7beca4[_0x805e('0x2a')];if(_0x4500ce[_0x805e('0x2b')]['includeAll']){_0x24b051[_0x805e('0x3c')]=[{'all':!![]}];}_0x24b051=_['merge']({},_0x24b051,_0x4500ce['options']);return db[_0x805e('0x28')][_0x805e('0x42')](_0x24b051)[_0x805e('0x21')](handleEntityNotFound(_0x24d727,null))[_0x805e('0x21')](respondWithResult(_0x24d727,null))[_0x805e('0x43')](handleError(_0x24d727,null));};exports[_0x805e('0x44')]=function(_0x2751f7,_0x275a86){return db[_0x805e('0x28')][_0x805e('0x44')](_0x2751f7[_0x805e('0x45')],{})[_0x805e('0x21')](respondWithResult(_0x275a86,0xc9))[_0x805e('0x43')](handleError(_0x275a86,null));};exports['update']=function(_0x3425ce,_0x3b1ac8){if(_0x3425ce[_0x805e('0x45')]['id']){delete _0x3425ce[_0x805e('0x45')]['id'];}return db[_0x805e('0x28')][_0x805e('0x42')]({'where':{'id':_0x3425ce[_0x805e('0x40')]['id']}})[_0x805e('0x21')](handleEntityNotFound(_0x3b1ac8,null))[_0x805e('0x21')](saveUpdates(_0x3425ce[_0x805e('0x45')],null))[_0x805e('0x21')](respondWithResult(_0x3b1ac8,null))[_0x805e('0x43')](handleError(_0x3b1ac8,null));};exports[_0x805e('0x22')]=function(_0x12a78f,_0x4f4c42){return db['Automation'][_0x805e('0x42')]({'where':{'id':_0x12a78f['params']['id']}})[_0x805e('0x21')](handleEntityNotFound(_0x4f4c42,null))['then'](removeEntity(_0x4f4c42,null))[_0x805e('0x43')](handleError(_0x4f4c42,null));};exports[_0x805e('0x46')]=function(_0x2f00ac,_0x2fa306,_0x30e6ab){return db['Condition'][_0x805e('0x42')]({'where':{'id':_0x2f00ac[_0x805e('0x40')]['id']}})['then'](handleEntityNotFound(_0x2fa306,null))[_0x805e('0x21')](function(_0x3484ea){if(_0x3484ea){return _0x3484ea['addConditions'](_0x2f00ac[_0x805e('0x45')][_0x805e('0x47')],_[_0x805e('0x48')](_0x2f00ac[_0x805e('0x45')],[_0x805e('0x47'),'id'])||{});}})[_0x805e('0x21')](respondWithResult(_0x2fa306,null))[_0x805e('0x43')](handleError(_0x2fa306,null));};exports[_0x805e('0x49')]=function(_0x53959e,_0x3ff8b5,_0x30cce6){var _0x550f7b={};var _0x66c671={};var _0x43ce67;var _0x173d22;return db[_0x805e('0x28')][_0x805e('0x4a')]({'where':{'id':_0x53959e['params']['id']}})['then'](handleEntityNotFound(_0x3ff8b5,null))[_0x805e('0x21')](function(_0x526610){if(_0x526610){_0x43ce67=_0x526610;_0x66c671[_0x805e('0x2a')]=_[_0x805e('0x2c')](db['Condition'][_0x805e('0x41')]);_0x66c671[_0x805e('0x2b')]=_[_0x805e('0x2c')](_0x53959e['query']);_0x66c671[_0x805e('0x2d')]=_[_0x805e('0x2e')](_0x66c671[_0x805e('0x2a')],_0x66c671[_0x805e('0x2b')]);_0x550f7b[_0x805e('0x2f')]=_[_0x805e('0x2e')](_0x66c671[_0x805e('0x2a')],qs[_0x805e('0x30')](_0x53959e[_0x805e('0x2b')][_0x805e('0x30')]));_0x550f7b[_0x805e('0x2f')]=_0x550f7b['attributes'][_0x805e('0x31')]?_0x550f7b[_0x805e('0x2f')]:_0x66c671[_0x805e('0x2a')];_0x550f7b['order']=qs[_0x805e('0x4b')](_0x53959e[_0x805e('0x2b')][_0x805e('0x4b')]);_0x550f7b['where']=qs['filters'](_[_0x805e('0x36')](_0x53959e[_0x805e('0x2b')],_0x66c671[_0x805e('0x2d')]));if(_0x53959e[_0x805e('0x2b')][_0x805e('0x37')]){_0x550f7b[_0x805e('0x35')]=_[_0x805e('0x38')](_0x550f7b[_0x805e('0x35')],{'$or':_[_0x805e('0x27')](_0x550f7b[_0x805e('0x2f')],function(_0x3579e9){var _0x2046b4={};_0x2046b4[_0x3579e9]={'$like':'%'+_0x53959e[_0x805e('0x2b')]['filter']+'%'};return _0x2046b4;})});}_0x550f7b=_['merge']({},_0x550f7b,_0x53959e['options']);return _0x43ce67['getConditions'](_0x550f7b);}})['then'](function(_0x555e29){if(_0x555e29){_0x173d22=_0x555e29[_0x805e('0x31')];if(!_0x53959e[_0x805e('0x2b')][_0x805e('0x32')](_0x805e('0x33'))){_0x550f7b['limit']=qs[_0x805e('0x17')](_0x53959e[_0x805e('0x2b')][_0x805e('0x17')]);_0x550f7b[_0x805e('0x16')]=qs[_0x805e('0x16')](_0x53959e['query'][_0x805e('0x16')]);}return _0x43ce67['getConditions'](_0x550f7b);}})[_0x805e('0x21')](function(_0x3cac22){if(_0x3cac22){return _0x3cac22?{'count':_0x173d22,'rows':_0x3cac22}:null;}})[_0x805e('0x21')](respondWithResult(_0x3ff8b5,null))[_0x805e('0x43')](handleError(_0x3ff8b5,null));};exports[_0x805e('0x4c')]=function(_0x2454ab,_0xa413b2,_0x235fe1){return db[_0x805e('0x4d')][_0x805e('0x42')]({'where':{'id':_0x2454ab[_0x805e('0x40')]['id']}})['then'](handleEntityNotFound(_0xa413b2,null))[_0x805e('0x21')](function(_0x59cfbd){if(_0x59cfbd){return _0x59cfbd[_0x805e('0x4c')](_0x2454ab[_0x805e('0x45')][_0x805e('0x47')],_[_0x805e('0x48')](_0x2454ab[_0x805e('0x45')],[_0x805e('0x47'),'id'])||{});}})[_0x805e('0x21')](respondWithResult(_0xa413b2,null))[_0x805e('0x43')](handleError(_0xa413b2,null));};exports[_0x805e('0x4e')]=function(_0xc9bcbd,_0x43e9fc,_0xd9a853){var _0xd2bc51={};var _0xa29893={};var _0xe308fe;var _0xf8a64c;return db[_0x805e('0x28')][_0x805e('0x4a')]({'where':{'id':_0xc9bcbd[_0x805e('0x40')]['id']}})['then'](handleEntityNotFound(_0x43e9fc,null))[_0x805e('0x21')](function(_0x916c2f){if(_0x916c2f){_0xe308fe=_0x916c2f;_0xa29893['model']=_['keys'](db[_0x805e('0x4d')][_0x805e('0x41')]);_0xa29893[_0x805e('0x2b')]=_[_0x805e('0x2c')](_0xc9bcbd[_0x805e('0x2b')]);_0xa29893['filters']=_['intersection'](_0xa29893[_0x805e('0x2a')],_0xa29893['query']);_0xd2bc51[_0x805e('0x2f')]=_[_0x805e('0x2e')](_0xa29893[_0x805e('0x2a')],qs[_0x805e('0x30')](_0xc9bcbd[_0x805e('0x2b')][_0x805e('0x30')]));_0xd2bc51['attributes']=_0xd2bc51[_0x805e('0x2f')][_0x805e('0x31')]?_0xd2bc51['attributes']:_0xa29893[_0x805e('0x2a')];_0xd2bc51[_0x805e('0x34')]=qs[_0x805e('0x4b')](_0xc9bcbd['query'][_0x805e('0x4b')]);_0xd2bc51[_0x805e('0x35')]=qs['filters'](_[_0x805e('0x36')](_0xc9bcbd[_0x805e('0x2b')],_0xa29893[_0x805e('0x2d')]));if(_0xc9bcbd[_0x805e('0x2b')]['filter']){_0xd2bc51[_0x805e('0x35')]=_[_0x805e('0x38')](_0xd2bc51[_0x805e('0x35')],{'$or':_['map'](_0xd2bc51[_0x805e('0x2f')],function(_0x1b5b06){var _0x33c2a3={};_0x33c2a3[_0x1b5b06]={'$like':'%'+_0xc9bcbd[_0x805e('0x2b')][_0x805e('0x37')]+'%'};return _0x33c2a3;})});}_0xd2bc51=_[_0x805e('0x38')]({},_0xd2bc51,_0xc9bcbd['options']);return _0xe308fe['getActions'](_0xd2bc51);}})[_0x805e('0x21')](function(_0x134f12){if(_0x134f12){_0xf8a64c=_0x134f12[_0x805e('0x31')];if(!_0xc9bcbd[_0x805e('0x2b')][_0x805e('0x32')](_0x805e('0x33'))){_0xd2bc51['limit']=qs['limit'](_0xc9bcbd['query'][_0x805e('0x17')]);_0xd2bc51['offset']=qs['offset'](_0xc9bcbd[_0x805e('0x2b')][_0x805e('0x16')]);}return _0xe308fe[_0x805e('0x4e')](_0xd2bc51);}})['then'](function(_0x2631fa){if(_0x2631fa){return _0x2631fa?{'count':_0xf8a64c,'rows':_0x2631fa}:null;}})[_0x805e('0x21')](respondWithResult(_0x43e9fc,null))[_0x805e('0x43')](handleError(_0x43e9fc,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index dc5ebe2..0851da5 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 _0x8a11=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','tools_automations'];(function(_0x260072,_0x163b97){var _0x28380a=function(_0x2aba52){while(--_0x2aba52){_0x260072['push'](_0x260072['shift']());}};_0x28380a(++_0x163b97);}(_0x8a11,0x84));var _0x18a1=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0x8a11[_0x3e7e96];return _0x13f6f0;};'use strict';var _=require(_0x18a1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x18a1('0x1'));var moment=require(_0x18a1('0x2'));var BPromise=require(_0x18a1('0x3'));var rp=require(_0x18a1('0x4'));var fs=require('fs');var path=require(_0x18a1('0x5'));var rimraf=require(_0x18a1('0x6'));var config=require(_0x18a1('0x7'));var attributes=require(_0x18a1('0x8'));module[_0x18a1('0x9')]=function(_0x58089f,_0x2e0370){return _0x58089f['define']('Automation',attributes,{'tableName':_0x18a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba04=['../../config/logger','api','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util'];(function(_0x10dfc9,_0x25b62c){var _0x154afc=function(_0x5099ac){while(--_0x5099ac){_0x10dfc9['push'](_0x10dfc9['shift']());}};_0x154afc(++_0x25b62c);}(_0xba04,0x10f));var _0x4ba0=function(_0x859f36,_0x30dffb){_0x859f36=_0x859f36-0x0;var _0x35107b=_0xba04[_0x859f36];return _0x35107b;};'use strict';var _=require(_0x4ba0('0x0'));var util=require(_0x4ba0('0x1'));var logger=require(_0x4ba0('0x2'))(_0x4ba0('0x3'));var moment=require('moment');var BPromise=require(_0x4ba0('0x4'));var rp=require(_0x4ba0('0x5'));var fs=require('fs');var path=require(_0x4ba0('0x6'));var rimraf=require(_0x4ba0('0x7'));var config=require('../../config/environment');var attributes=require(_0x4ba0('0x8'));module[_0x4ba0('0x9')]=function(_0x145342,_0x392784){return _0x145342[_0x4ba0('0xa')](_0x4ba0('0xb'),attributes,{'tableName':_0x4ba0('0xc'),'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 5359c5d..ded4ffb 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 _0x349e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x349e,0xcb));var _0xe349=function(_0x41da72,_0x224fd6){_0x41da72=_0x41da72-0x0;var _0x36aade=_0x349e[_0x41da72];return _0x36aade;};'use strict';var _=require(_0xe349('0x0'));var util=require(_0xe349('0x1'));var moment=require(_0xe349('0x2'));var BPromise=require(_0xe349('0x3'));var rs=require(_0xe349('0x4'));var fs=require('fs');var Redis=require(_0xe349('0x5'));var db=require(_0xe349('0x6'))['db'];var utils=require(_0xe349('0x7'));var logger=require(_0xe349('0x8'))('rpc');var config=require(_0xe349('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe349('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494605,_0xcb9b49,_0x6efb47){return new BPromise(function(_0x535968,_0x114c1b){return client[_0xe349('0xb')](_0x494605,_0x6efb47)[_0xe349('0xc')](function(_0x7b08d2){logger[_0xe349('0xd')]('Automation,\x20%s,\x20%s',_0xcb9b49,_0xe349('0xe'));logger[_0xe349('0xf')](_0xe349('0x10'),_0xcb9b49,_0xe349('0xe'),JSON[_0xe349('0x11')](_0x7b08d2));if(_0x7b08d2[_0xe349('0x12')]){if(_0x7b08d2[_0xe349('0x12')][_0xe349('0x13')]===0x1f4){logger[_0xe349('0x12')](_0xe349('0x14'),_0xcb9b49,_0x7b08d2[_0xe349('0x12')][_0xe349('0x15')]);return _0x114c1b(_0x7b08d2[_0xe349('0x12')][_0xe349('0x15')]);}logger[_0xe349('0x12')](_0xe349('0x14'),_0xcb9b49,_0x7b08d2[_0xe349('0x12')]['message']);return _0x535968(_0x7b08d2[_0xe349('0x12')]['message']);}else{logger[_0xe349('0xd')](_0xe349('0x14'),_0xcb9b49,_0xe349('0xe'));_0x535968(_0x7b08d2['result']['message']);}})[_0xe349('0x16')](function(_0x3ff17c){logger[_0xe349('0x12')](_0xe349('0x14'),_0xcb9b49,_0x3ff17c);_0x114c1b(_0x3ff17c);});});} \ No newline at end of file +var _0x3f72=['request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x3f72,0xaf));var _0x23f7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3f72[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x23f7('0x0'));var util=require(_0x23f7('0x1'));var moment=require(_0x23f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23f7('0x3'));var db=require(_0x23f7('0x4'))['db'];var utils=require(_0x23f7('0x5'));var logger=require(_0x23f7('0x6'))(_0x23f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x23f7('0x8'));var client=jayson['client'][_0x23f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cc54a,_0x23e468,_0x2db48b){return new BPromise(function(_0x412d29,_0x258026){return client[_0x23f7('0xa')](_0x5cc54a,_0x2db48b)[_0x23f7('0xb')](function(_0x3a048c){logger[_0x23f7('0xc')](_0x23f7('0xd'),_0x23e468,_0x23f7('0xe'));logger['debug'](_0x23f7('0xf'),_0x23e468,_0x23f7('0xe'),JSON[_0x23f7('0x10')](_0x3a048c));if(_0x3a048c['error']){if(_0x3a048c['error'][_0x23f7('0x11')]===0x1f4){logger[_0x23f7('0x12')](_0x23f7('0xd'),_0x23e468,_0x3a048c[_0x23f7('0x12')][_0x23f7('0x13')]);return _0x258026(_0x3a048c['error'][_0x23f7('0x13')]);}logger[_0x23f7('0x12')](_0x23f7('0xd'),_0x23e468,_0x3a048c[_0x23f7('0x12')]['message']);return _0x412d29(_0x3a048c[_0x23f7('0x12')][_0x23f7('0x13')]);}else{logger[_0x23f7('0xc')](_0x23f7('0xd'),_0x23e468,_0x23f7('0xe'));_0x412d29(_0x3a048c[_0x23f7('0x14')][_0x23f7('0x13')]);}})['catch'](function(_0x2669ab){logger[_0x23f7('0x12')]('Automation,\x20%s,\x20%s',_0x23e468,_0x2669ab);_0x258026(_0x2669ab);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index dcd6f8a..77f78ff 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 _0x7bb8=['isAuthenticated','index','show','get','getConditions','/:id/actions','getActions','post','create','/:id/conditions','addActions','put','/:id','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./automation.controller'];(function(_0x2c05d6,_0xf8af3d){var _0xb11f76=function(_0x2b4052){while(--_0x2b4052){_0x2c05d6['push'](_0x2c05d6['shift']());}};_0xb11f76(++_0xf8af3d);}(_0x7bb8,0xe8));var _0x87bb=function(_0x350610,_0x3f4eef){_0x350610=_0x350610-0x0;var _0x3b33c6=_0x7bb8[_0x350610];return _0x3b33c6;};'use strict';var multer=require('multer');var util=require(_0x87bb('0x0'));var path=require(_0x87bb('0x1'));var timeout=require(_0x87bb('0x2'));var express=require(_0x87bb('0x3'));var router=express['Router']();var fs_extra=require(_0x87bb('0x4'));var auth=require(_0x87bb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x87bb('0x6'));var controller=require(_0x87bb('0x7'));router['get']('/',auth[_0x87bb('0x8')](),controller[_0x87bb('0x9')]);router['get']('/:id',auth[_0x87bb('0x8')](),controller[_0x87bb('0xa')]);router[_0x87bb('0xb')]('/:id/conditions',auth[_0x87bb('0x8')](),controller[_0x87bb('0xc')]);router[_0x87bb('0xb')](_0x87bb('0xd'),auth[_0x87bb('0x8')](),controller[_0x87bb('0xe')]);router[_0x87bb('0xf')]('/',auth[_0x87bb('0x8')](),controller[_0x87bb('0x10')]);router[_0x87bb('0xf')](_0x87bb('0x11'),auth[_0x87bb('0x8')](),controller['addConditions']);router[_0x87bb('0xf')](_0x87bb('0xd'),auth[_0x87bb('0x8')](),controller[_0x87bb('0x12')]);router[_0x87bb('0x13')](_0x87bb('0x14'),auth['isAuthenticated'](),controller[_0x87bb('0x15')]);router[_0x87bb('0x16')](_0x87bb('0x14'),auth[_0x87bb('0x8')](),controller['destroy']);module[_0x87bb('0x17')]=router; \ No newline at end of file +var _0x6dd1=['getActions','create','post','addConditions','addActions','put','/:id','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id/conditions','getConditions','/:id/actions'];(function(_0x5aabcb,_0x219fbd){var _0x4b6e71=function(_0x1546ee){while(--_0x1546ee){_0x5aabcb['push'](_0x5aabcb['shift']());}};_0x4b6e71(++_0x219fbd);}(_0x6dd1,0x111));var _0x16dd=function(_0x33418d,_0x2aaedc){_0x33418d=_0x33418d-0x0;var _0x363ce2=_0x6dd1[_0x33418d];return _0x363ce2;};'use strict';var multer=require(_0x16dd('0x0'));var util=require('util');var path=require(_0x16dd('0x1'));var timeout=require(_0x16dd('0x2'));var express=require('express');var router=express[_0x16dd('0x3')]();var fs_extra=require(_0x16dd('0x4'));var auth=require(_0x16dd('0x5'));var interaction=require(_0x16dd('0x6'));var config=require(_0x16dd('0x7'));var controller=require(_0x16dd('0x8'));router[_0x16dd('0x9')]('/',auth[_0x16dd('0xa')](),controller[_0x16dd('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x16dd('0x9')](_0x16dd('0xc'),auth[_0x16dd('0xa')](),controller[_0x16dd('0xd')]);router['get'](_0x16dd('0xe'),auth['isAuthenticated'](),controller[_0x16dd('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x16dd('0x10')]);router[_0x16dd('0x11')]('/:id/conditions',auth[_0x16dd('0xa')](),controller[_0x16dd('0x12')]);router[_0x16dd('0x11')]('/:id/actions',auth[_0x16dd('0xa')](),controller[_0x16dd('0x13')]);router[_0x16dd('0x14')](_0x16dd('0x15'),auth[_0x16dd('0xa')](),controller['update']);router['delete'](_0x16dd('0x15'),auth['isAuthenticated'](),controller[_0x16dd('0x16')]);module[_0x16dd('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index dfcb05d..415217a 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 _0xa9bf=['UNSIGNED','Max\x20200\x20calls.','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER'];(function(_0x5c028c,_0x4fbf6d){var _0x9a4301=function(_0x27831a){while(--_0x27831a){_0x5c028c['push'](_0x5c028c['shift']());}};_0x9a4301(++_0x4fbf6d);}(_0xa9bf,0x136));var _0xfa9b=function(_0x51b8e7,_0x5c70fb){_0x51b8e7=_0x51b8e7-0x0;var _0x81fd25=_0xa9bf[_0x51b8e7];return _0x81fd25;};'use strict';var Sequelize=require(_0xfa9b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xfa9b('0x1')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xfa9b('0x2')],'defaultValue':0x0,'comment':_0xfa9b('0x3')},'limitCalls':{'type':Sequelize[_0xfa9b('0x4')](0x4)[_0xfa9b('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xfa9b('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfa9b('0x7')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfa9b('0x7')]},'dialOriginateTimeout':{'type':Sequelize[_0xfa9b('0x4')](0x3)[_0xfa9b('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa9b('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfa9b('0x4')](0x3)[_0xfa9b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfa9b('0x4')](0x5)[_0xfa9b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa9b('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xfa9b('0x4')](0x3)[_0xfa9b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa9b('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfa9b('0x4')](0x5)[_0xfa9b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfa9b('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xfa9b('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xfa9b('0x4')](0x3)[_0xfa9b('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xfa9b('0x7')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xfa9b('0xc')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xfa9b('0xd'),_0xfa9b('0xe'),_0xfa9b('0xf')),'defaultValue':_0xfa9b('0xd')},'dialAMDActive':{'type':Sequelize[_0xfa9b('0x2')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfa9b('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xfa9b('0x4')](0x9)[_0xfa9b('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfa9b('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfa9b('0x4')](0x9)[_0xfa9b('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfa9b('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfa9b('0x4')](0x9)[_0xfa9b('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xfa9b('0x4')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfa9b('0x12')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfa9b('0x4')](0x9)[_0xfa9b('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfa9b('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfa9b('0x4')](0x9)[_0xfa9b('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfa9b('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xfa9b('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfa9b('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfa9b('0x4')](0x9)[_0xfa9b('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfa9b('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0xfa9b('0x17')](_0xfa9b('0x18'),'ASC'),'defaultValue':_0xfa9b('0x18')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfa9b('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfa9b('0x19')},'dialCutDigit':{'type':Sequelize[_0xfa9b('0x4')](0x3)[_0xfa9b('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfa9b('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfa9b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa9b('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfa9b('0x4')](0x5)[_0xfa9b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xfa9b('0x4')](0x3)[_0xfa9b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa9b('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xfa9b('0x4')](0x5)[_0xfa9b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa9b('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfa9b('0x4')](0x3)[_0xfa9b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfa9b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa9b('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0xfa9b('0x4')](0x3)[_0xfa9b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa9b('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xfa9b('0x4')](0x5)[_0xfa9b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa9b('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfa9b('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa9b('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfa9b('0x4')](0x5)[_0xfa9b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa9b('0x22')}}; \ No newline at end of file +var _0xa270=['#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','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','STRING','name','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1765c4,_0x151565){var _0x56645f=function(_0x12dfbe){while(--_0x12dfbe){_0x1765c4['push'](_0x1765c4['shift']());}};_0x56645f(++_0x151565);}(_0xa270,0x18d));var _0x0a27=function(_0x2dc6f2,_0x34fc64){_0x2dc6f2=_0x2dc6f2-0x0;var _0x4b7f98=_0xa270[_0x2dc6f2];return _0x4b7f98;};'use strict';var Sequelize=require(_0x0a27('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a27('0x1')],'unique':_0x0a27('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x0a27('0x1')]},'active':{'type':Sequelize[_0x0a27('0x3')],'defaultValue':0x0,'comment':_0x0a27('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x0a27('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a27('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a27('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a27('0x6')](0x3)[_0x0a27('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a27('0x7')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a27('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0a27('0x6')](0x5)[_0x0a27('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a27('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a27('0x6')](0x3)[_0x0a27('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a27('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a27('0x6')](0x5)[_0x0a27('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a27('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a27('0x6')](0x3)[_0x0a27('0x5')],'defaultValue':0x3,'comment':_0x0a27('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a27('0x6')](0x5)[_0x0a27('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a27('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a27('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a27('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a27('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x0a27('0xe')](_0x0a27('0xf'),_0x0a27('0x10'),_0x0a27('0x11')),'defaultValue':_0x0a27('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0a27('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a27('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x0a27('0x6')](0x9)[_0x0a27('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a27('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a27('0x6')](0x9)[_0x0a27('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a27('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a27('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a27('0x6')](0x9)[_0x0a27('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a27('0x6')](0x9)[_0x0a27('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0a27('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0a27('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0a27('0x6')](0x5)[_0x0a27('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a27('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a27('0x6')](0x9)[_0x0a27('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a27('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0a27('0xe')](_0x0a27('0x19'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x0a27('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0a27('0x6')](0x3)[_0x0a27('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a27('0x1a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a27('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a27('0x6')](0x3)[_0x0a27('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a27('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a27('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x0a27('0x6')](0x3)[_0x0a27('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x0a27('0x6')](0x5)[_0x0a27('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a27('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0a27('0x6')](0x3)[_0x0a27('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a27('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a27('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a27('0x1e')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a27('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a27('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a27('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a27('0x6')](0x3)[_0x0a27('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a27('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a27('0x5')],'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 bebed2f..aa29d9f 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 _0xbca8=['hasOwnProperty','pick','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','NOW()','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','OrderBy','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','apply','reject','then','destroy','get','IvrCampaigns','end','error','name','send','map','Campaign','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','params','options','createdAt','updatedAt','body','omit','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','CmHopper'];(function(_0x2a4d83,_0x2f548c){var _0x1f223d=function(_0x513327){while(--_0x513327){_0x2a4d83['push'](_0x2a4d83['shift']());}};_0x1f223d(++_0x2f548c);}(_0xbca8,0xcc));var _0x8bca=function(_0x40d342,_0x110e54){_0x40d342=_0x40d342-0x0;var _0x153c50=_0xbca8[_0x40d342];return _0x153c50;};'use strict';var emlformat=require(_0x8bca('0x0'));var rimraf=require(_0x8bca('0x1'));var zipdir=require(_0x8bca('0x2'));var jsonpatch=require(_0x8bca('0x3'));var rp=require(_0x8bca('0x4'));var moment=require('moment');var BPromise=require(_0x8bca('0x5'));var Mustache=require(_0x8bca('0x6'));var util=require(_0x8bca('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8bca('0x8'));var ejs=require(_0x8bca('0x9'));var fs=require('fs');var fs_extra=require(_0x8bca('0xa'));var _=require(_0x8bca('0xb'));var squel=require('squel');var crypto=require(_0x8bca('0xc'));var jsforce=require(_0x8bca('0xd'));var deskjs=require(_0x8bca('0xe'));var toCsv=require(_0x8bca('0x8'));var querystring=require(_0x8bca('0xf'));var Papa=require(_0x8bca('0x10'));var Redis=require(_0x8bca('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8bca('0x12'));var hardwareService=require(_0x8bca('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8bca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8bca('0x15'));var db=require(_0x8bca('0x16'))['db'];function respondWithStatusCode(_0x5eec01,_0x62c6d1){_0x62c6d1=_0x62c6d1||0xcc;return function(_0x1fe1b5){if(_0x1fe1b5){return _0x5eec01[_0x8bca('0x17')](_0x62c6d1);}return _0x5eec01[_0x8bca('0x18')](_0x62c6d1)['end']();};}function respondWithResult(_0x4bbf5c,_0x250d09){_0x250d09=_0x250d09||0xc8;return function(_0x59b65b){if(_0x59b65b){return _0x4bbf5c[_0x8bca('0x18')](_0x250d09)[_0x8bca('0x19')](_0x59b65b);}};}function respondWithFilteredResult(_0x145cfd,_0x2e3633){return function(_0x1c3590){if(_0x1c3590){var _0x1c78d5=typeof _0x2e3633['offset']==='undefined'&&typeof _0x2e3633[_0x8bca('0x1a')]==='undefined';var _0x2bd7b1=_0x1c3590[_0x8bca('0x1b')];var _0x4e24c8=_0x1c78d5?0x0:_0x2e3633['offset'];var _0x5622ba=_0x1c78d5?_0x1c3590[_0x8bca('0x1b')]:_0x2e3633[_0x8bca('0x1c')]+_0x2e3633['limit'];var _0x1a834c;if(_0x5622ba>=_0x2bd7b1){_0x5622ba=_0x2bd7b1;_0x1a834c=0xc8;}else{_0x1a834c=0xce;}_0x145cfd['status'](_0x1a834c);return _0x145cfd['set']('Content-Range',_0x4e24c8+'-'+_0x5622ba+'/'+_0x2bd7b1)[_0x8bca('0x19')](_0x1c3590);}return null;};}function patchUpdates(_0x17046f){return function(_0xdafaa1){try{jsonpatch[_0x8bca('0x1d')](_0xdafaa1,_0x17046f,!![]);}catch(_0x2d64cd){return BPromise[_0x8bca('0x1e')](_0x2d64cd);}return _0xdafaa1['save']();};}function saveUpdates(_0x315a59,_0x20dc10){return function(_0xf3296b){if(_0xf3296b){return _0xf3296b['update'](_0x315a59)[_0x8bca('0x1f')](function(_0x5ac207){return _0x5ac207;});}return null;};}function removeEntity(_0x1f014d,_0x4e4bff){return function(_0x2e3522){if(_0x2e3522){return _0x2e3522[_0x8bca('0x20')]()[_0x8bca('0x1f')](function(){var _0x8620e2=_0x2e3522[_0x8bca('0x21')]({'plain':!![]});var _0x3a7498=_0x8bca('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x3a7498,'resourceId':_0x8620e2['id']}})[_0x8bca('0x1f')](function(){return _0x2e3522;});})[_0x8bca('0x1f')](function(){_0x1f014d['status'](0xcc)[_0x8bca('0x23')]();});}};}function handleEntityNotFound(_0x706106,_0x103b53){return function(_0x344eae){if(!_0x344eae){_0x706106[_0x8bca('0x17')](0x194);}return _0x344eae;};}function handleError(_0x54ccae,_0x4767b5){_0x4767b5=_0x4767b5||0x1f4;return function(_0x58bfda){logger[_0x8bca('0x24')](_0x58bfda['stack']);if(_0x58bfda[_0x8bca('0x25')]){delete _0x58bfda[_0x8bca('0x25')];}_0x54ccae[_0x8bca('0x18')](_0x4767b5)[_0x8bca('0x26')](_0x58bfda);};}exports['index']=function(_0x252819,_0x429c3a){var _0x288f99={},_0x543897={},_0x539f7e={'count':0x0,'rows':[]};var _0x4dc8ef=_[_0x8bca('0x27')](db[_0x8bca('0x28')][_0x8bca('0x29')],function(_0x5b13a1){return{'name':_0x5b13a1[_0x8bca('0x2a')],'type':_0x5b13a1[_0x8bca('0x2b')]['key']};});_0x543897[_0x8bca('0x2c')]=_[_0x8bca('0x27')](_0x4dc8ef,_0x8bca('0x25'));_0x543897[_0x8bca('0x2d')]=_[_0x8bca('0x2e')](_0x252819['query']);_0x543897[_0x8bca('0x2f')]=_[_0x8bca('0x30')](_0x543897[_0x8bca('0x2c')],_0x543897[_0x8bca('0x2d')]);_0x288f99[_0x8bca('0x31')]=_['intersection'](_0x543897[_0x8bca('0x2c')],qs['fields'](_0x252819['query'][_0x8bca('0x32')]));_0x288f99[_0x8bca('0x31')]=_0x288f99['attributes']['length']?_0x288f99[_0x8bca('0x31')]:_0x543897[_0x8bca('0x2c')];if(!_0x252819[_0x8bca('0x2d')]['hasOwnProperty'](_0x8bca('0x33'))){_0x288f99['limit']=qs[_0x8bca('0x1a')](_0x252819[_0x8bca('0x2d')]['limit']);_0x288f99[_0x8bca('0x1c')]=qs[_0x8bca('0x1c')](_0x252819[_0x8bca('0x2d')]['offset']);}_0x288f99[_0x8bca('0x34')]=qs[_0x8bca('0x35')](_0x252819['query']['sort']);_0x288f99[_0x8bca('0x36')]=qs[_0x8bca('0x2f')](_['pick'](_0x252819['query'],_0x543897[_0x8bca('0x2f')]),_0x4dc8ef);if(_0x252819[_0x8bca('0x2d')][_0x8bca('0x37')]){_0x288f99[_0x8bca('0x36')]=_[_0x8bca('0x38')](_0x288f99[_0x8bca('0x36')],{'$or':_['map'](_0x4dc8ef,function(_0x150b0d){if(_0x150b0d[_0x8bca('0x2b')]!==_0x8bca('0x39')){var _0x8873d1={};_0x8873d1[_0x150b0d[_0x8bca('0x25')]]={'$like':'%'+_0x252819[_0x8bca('0x2d')][_0x8bca('0x37')]+'%'};return _0x8873d1;}})});}_0x288f99=_[_0x8bca('0x38')]({},_0x288f99,_0x252819['options']);var _0x4c01f7={'where':_0x288f99[_0x8bca('0x36')]};return db[_0x8bca('0x28')]['count'](_0x4c01f7)[_0x8bca('0x1f')](function(_0x2bc3ff){_0x539f7e[_0x8bca('0x1b')]=_0x2bc3ff;if(_0x252819[_0x8bca('0x2d')][_0x8bca('0x3a')]){_0x288f99[_0x8bca('0x3b')]=[{'all':!![]}];}return db[_0x8bca('0x28')][_0x8bca('0x3c')](_0x288f99);})[_0x8bca('0x1f')](function(_0x4b2839){_0x539f7e[_0x8bca('0x3d')]=_0x4b2839;return _0x539f7e;})['then'](respondWithFilteredResult(_0x429c3a,_0x288f99))[_0x8bca('0x3e')](handleError(_0x429c3a,null));};exports[_0x8bca('0x3f')]=function(_0x23bd03,_0x11a4be){var _0x291a77={'raw':![],'where':{'id':_0x23bd03['params']['id']}},_0x165404={};_0x165404[_0x8bca('0x2c')]=_[_0x8bca('0x2e')](db['Campaign'][_0x8bca('0x29')]);_0x165404['query']=_['keys'](_0x23bd03['query']);_0x165404['filters']=_[_0x8bca('0x30')](_0x165404[_0x8bca('0x2c')],_0x165404[_0x8bca('0x2d')]);_0x291a77[_0x8bca('0x31')]=_['intersection'](_0x165404[_0x8bca('0x2c')],qs[_0x8bca('0x32')](_0x23bd03[_0x8bca('0x2d')][_0x8bca('0x32')]));_0x291a77['attributes']=_0x291a77[_0x8bca('0x31')][_0x8bca('0x40')]?_0x291a77[_0x8bca('0x31')]:_0x165404[_0x8bca('0x2c')];if(_0x23bd03[_0x8bca('0x2d')][_0x8bca('0x3a')]){_0x291a77[_0x8bca('0x3b')]=[{'all':!![]}];}_0x291a77=_[_0x8bca('0x38')]({},_0x291a77,_0x23bd03['options']);return db[_0x8bca('0x28')][_0x8bca('0x41')](_0x291a77)['then'](handleEntityNotFound(_0x11a4be,null))['then'](respondWithResult(_0x11a4be,null))[_0x8bca('0x3e')](handleError(_0x11a4be,null));};exports[_0x8bca('0x42')]=function(_0x41379f,_0x58a6c0){return db[_0x8bca('0x28')][_0x8bca('0x42')](_0x41379f['body'],{})[_0x8bca('0x1f')](function(_0x123e37){var _0x32e030=_0x41379f[_0x8bca('0x43')]['get']({'plain':!![]});if(!_0x32e030)throw new Error(_0x8bca('0x44'));if(_0x32e030[_0x8bca('0x45')]==='user'){var _0x3174b0=_0x123e37[_0x8bca('0x21')]({'plain':!![]});var _0x16dfb9='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x16dfb9,'userProfileId':_0x32e030[_0x8bca('0x46')]},'raw':!![]})['then'](function(_0x3547bd){if(_0x3547bd&&_0x3547bd[_0x8bca('0x47')]===0x0){return db['UserProfileResource'][_0x8bca('0x42')]({'name':_0x3174b0[_0x8bca('0x25')],'resourceId':_0x3174b0['id'],'type':_0x3547bd['name'],'sectionId':_0x3547bd['id']},{})[_0x8bca('0x1f')](function(){return _0x123e37;});}else{return _0x123e37;}})[_0x8bca('0x3e')](function(_0x5b4ffd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b4ffd);throw _0x5b4ffd;});}return _0x123e37;})[_0x8bca('0x1f')](respondWithResult(_0x58a6c0,0xc9))[_0x8bca('0x3e')](handleError(_0x58a6c0,null));};exports[_0x8bca('0x48')]=function(_0x134d07,_0x5c14dd){var _0xc2ec12={'where':{'id':_0x134d07[_0x8bca('0x49')]['id']}},_0x6e7dd7={};_0x6e7dd7[_0x8bca('0x2c')]=_[_0x8bca('0x2e')](db[_0x8bca('0x28')][_0x8bca('0x29')]);_0xc2ec12[_0x8bca('0x31')]=_[_0x8bca('0x30')](_0x6e7dd7[_0x8bca('0x2c')],qs[_0x8bca('0x32')](_0x134d07[_0x8bca('0x2d')][_0x8bca('0x32')]));_0xc2ec12[_0x8bca('0x31')]=_0xc2ec12[_0x8bca('0x31')]['length']?_0xc2ec12[_0x8bca('0x31')]:_0x6e7dd7[_0x8bca('0x2c')];if(_0x134d07['query'][_0x8bca('0x3a')]){_0xc2ec12[_0x8bca('0x3b')]=[{'all':!![]}];}_0xc2ec12=_[_0x8bca('0x38')]({},_0xc2ec12,_0x134d07[_0x8bca('0x4a')]);return db[_0x8bca('0x28')][_0x8bca('0x41')](_0xc2ec12)[_0x8bca('0x1f')](handleEntityNotFound(_0x5c14dd,null))[_0x8bca('0x1f')](function(_0x2ce8fb){if(_0x2ce8fb){var _0x411772=_0x2ce8fb[_0x8bca('0x21')]({'plain':!![]});_0x411772=qs['omit'](_0x411772,['id',_0x8bca('0x4b'),_0x8bca('0x4c')]);_0x134d07[_0x8bca('0x4d')]=_[_0x8bca('0x4e')](_0x134d07['body'],['id',_0x8bca('0x4b'),_0x8bca('0x4c')]);return db[_0x8bca('0x28')][_0x8bca('0x42')](_['merge'](_0x411772,_0x134d07[_0x8bca('0x4d')]),{'include':_0x134d07[_0x8bca('0x2d')][_0x8bca('0x3a')]?[{'all':!![]}]:undefined})[_0x8bca('0x1f')](function(_0x1d3975){var _0x13d038=_0x134d07[_0x8bca('0x43')][_0x8bca('0x21')]({'plain':!![]});if(!_0x13d038)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13d038['role']===_0x8bca('0x43')){var _0x1d9b41=_0x1d3975[_0x8bca('0x21')]({'plain':!![]});var _0x30f6b3=_0x8bca('0x22');return db[_0x8bca('0x4f')]['find']({'where':{'name':_0x30f6b3,'userProfileId':_0x13d038[_0x8bca('0x46')]},'raw':!![]})['then'](function(_0x1672fe){if(_0x1672fe&&_0x1672fe['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1d9b41[_0x8bca('0x25')],'resourceId':_0x1d9b41['id'],'type':_0x1672fe[_0x8bca('0x25')],'sectionId':_0x1672fe['id']},{})[_0x8bca('0x1f')](function(){return _0x1d3975;});}else{return _0x1d3975;}})[_0x8bca('0x3e')](function(_0x153116){logger['error'](_0x8bca('0x50'),_0x153116);throw _0x153116;});}return _0x1d3975;});}})[_0x8bca('0x1f')](respondWithResult(_0x5c14dd,0xc9))[_0x8bca('0x3e')](handleError(_0x5c14dd,null));};exports[_0x8bca('0x51')]=function(_0x17cb8e,_0x1133fe){if(_0x17cb8e['body']['id']){delete _0x17cb8e['body']['id'];}return db[_0x8bca('0x28')][_0x8bca('0x41')]({'where':{'id':_0x17cb8e['params']['id']}})[_0x8bca('0x1f')](handleEntityNotFound(_0x1133fe,null))[_0x8bca('0x1f')](saveUpdates(_0x17cb8e[_0x8bca('0x4d')],null))[_0x8bca('0x1f')](respondWithResult(_0x1133fe,null))[_0x8bca('0x3e')](handleError(_0x1133fe,null));};exports[_0x8bca('0x20')]=function(_0x2621ac,_0x3e8058){return db[_0x8bca('0x28')][_0x8bca('0x41')]({'where':{'id':_0x2621ac['params']['id']}})['then'](handleEntityNotFound(_0x3e8058,null))[_0x8bca('0x1f')](removeEntity(_0x3e8058,null))[_0x8bca('0x3e')](handleError(_0x3e8058,null));};exports[_0x8bca('0x52')]=function(_0x12ab81,_0x33d117,_0x26f374){var _0x18c6cb={'raw':!![],'where':{}};var _0x4dd3d5={};var _0x35e6eb={'count':0x0,'rows':[]};return db[_0x8bca('0x28')]['findOne']({'where':{'id':_0x12ab81[_0x8bca('0x49')]['id']}})[_0x8bca('0x1f')](handleEntityNotFound(_0x33d117,null))[_0x8bca('0x1f')](function(_0x243988){if(_0x243988){_0x4dd3d5['model']=_[_0x8bca('0x2e')](db[_0x8bca('0x53')][_0x8bca('0x29')]);_0x4dd3d5[_0x8bca('0x2d')]=_[_0x8bca('0x2e')](_0x12ab81[_0x8bca('0x2d')]);_0x4dd3d5[_0x8bca('0x2f')]=_['intersection'](_0x4dd3d5['model'],_0x4dd3d5[_0x8bca('0x2d')]);_0x18c6cb[_0x8bca('0x31')]=_[_0x8bca('0x30')](_0x4dd3d5[_0x8bca('0x2c')],qs[_0x8bca('0x32')](_0x12ab81[_0x8bca('0x2d')][_0x8bca('0x32')]));_0x18c6cb['attributes']=_0x18c6cb[_0x8bca('0x31')][_0x8bca('0x40')]?_0x18c6cb[_0x8bca('0x31')]:_0x4dd3d5[_0x8bca('0x2c')];if(!_0x12ab81[_0x8bca('0x2d')][_0x8bca('0x54')]('nolimit')){_0x18c6cb[_0x8bca('0x1a')]=qs[_0x8bca('0x1a')](_0x12ab81[_0x8bca('0x2d')]['limit']);_0x18c6cb[_0x8bca('0x1c')]=qs[_0x8bca('0x1c')](_0x12ab81['query'][_0x8bca('0x1c')]);}_0x18c6cb[_0x8bca('0x34')]=qs[_0x8bca('0x35')](_0x12ab81[_0x8bca('0x2d')][_0x8bca('0x35')]);_0x18c6cb['where']=qs[_0x8bca('0x2f')](_[_0x8bca('0x55')](_0x12ab81[_0x8bca('0x2d')],_0x4dd3d5[_0x8bca('0x2f')]));_0x18c6cb[_0x8bca('0x36')][_0x8bca('0x56')]=_0x243988['id'];if(_0x12ab81['query'][_0x8bca('0x37')]){_0x18c6cb[_0x8bca('0x36')]=_[_0x8bca('0x38')](_0x18c6cb[_0x8bca('0x36')],{'$or':_[_0x8bca('0x27')](_0x18c6cb['attributes'],function(_0x35958f){var _0x42b85b={};_0x42b85b[_0x35958f]={'$like':'%'+_0x12ab81[_0x8bca('0x2d')][_0x8bca('0x37')]+'%'};return _0x42b85b;})});}_0x18c6cb=_[_0x8bca('0x38')]({},_0x18c6cb,_0x12ab81[_0x8bca('0x4a')]);return db['CmHopper'][_0x8bca('0x1b')]({'where':_0x18c6cb[_0x8bca('0x36')]})[_0x8bca('0x1f')](function(_0x4d9477){_0x35e6eb['count']=_0x4d9477;if(_0x12ab81[_0x8bca('0x2d')][_0x8bca('0x3a')]){_0x18c6cb[_0x8bca('0x3b')]=[{'all':!![]}];}return db['CmHopper'][_0x8bca('0x3c')](_0x18c6cb);})['then'](function(_0x12fc38){_0x35e6eb['rows']=_0x12fc38;return _0x35e6eb;});}})['then'](respondWithFilteredResult(_0x33d117,_0x18c6cb))[_0x8bca('0x3e')](handleError(_0x33d117,null));};exports[_0x8bca('0x57')]=function(_0x18d999,_0x57ae60,_0x1fa442){var _0x46d56a={'raw':!![],'where':{}};var _0x5e5b2c={};var _0x3281c7={'count':0x0,'rows':[]};return db['Campaign'][_0x8bca('0x58')]({'where':{'id':_0x18d999['params']['id']}})['then'](handleEntityNotFound(_0x57ae60,null))[_0x8bca('0x1f')](function(_0x2a308b){if(_0x2a308b){_0x5e5b2c['model']=_[_0x8bca('0x2e')](db[_0x8bca('0x59')][_0x8bca('0x29')]);_0x5e5b2c[_0x8bca('0x2d')]=_[_0x8bca('0x2e')](_0x18d999[_0x8bca('0x2d')]);_0x5e5b2c['filters']=_['intersection'](_0x5e5b2c[_0x8bca('0x2c')],_0x5e5b2c['query']);_0x46d56a['attributes']=_['intersection'](_0x5e5b2c['model'],qs[_0x8bca('0x32')](_0x18d999['query'][_0x8bca('0x32')]));_0x46d56a[_0x8bca('0x31')]=_0x46d56a[_0x8bca('0x31')][_0x8bca('0x40')]?_0x46d56a[_0x8bca('0x31')]:_0x5e5b2c[_0x8bca('0x2c')];if(!_0x18d999[_0x8bca('0x2d')][_0x8bca('0x54')]('nolimit')){_0x46d56a['limit']=qs[_0x8bca('0x1a')](_0x18d999[_0x8bca('0x2d')][_0x8bca('0x1a')]);_0x46d56a[_0x8bca('0x1c')]=qs[_0x8bca('0x1c')](_0x18d999[_0x8bca('0x2d')][_0x8bca('0x1c')]);}_0x46d56a['order']=qs[_0x8bca('0x35')](_0x18d999[_0x8bca('0x2d')][_0x8bca('0x35')]);_0x46d56a[_0x8bca('0x36')]=qs[_0x8bca('0x2f')](_['pick'](_0x18d999['query'],_0x5e5b2c[_0x8bca('0x2f')]));_0x46d56a[_0x8bca('0x36')]['CampaignId']=_0x2a308b['id'];if(_0x18d999[_0x8bca('0x2d')]['filter']){_0x46d56a[_0x8bca('0x36')]=_[_0x8bca('0x38')](_0x46d56a[_0x8bca('0x36')],{'$or':_[_0x8bca('0x27')](_0x46d56a[_0x8bca('0x31')],function(_0x153ff1){var _0x1455fd={};_0x1455fd[_0x153ff1]={'$like':'%'+_0x18d999[_0x8bca('0x2d')][_0x8bca('0x37')]+'%'};return _0x1455fd;})});}_0x46d56a=_['merge']({},_0x46d56a,_0x18d999[_0x8bca('0x4a')]);return db[_0x8bca('0x59')][_0x8bca('0x1b')]({'where':_0x46d56a[_0x8bca('0x36')]})[_0x8bca('0x1f')](function(_0x566946){_0x3281c7['count']=_0x566946;if(_0x18d999[_0x8bca('0x2d')][_0x8bca('0x3a')]){_0x46d56a['include']=[{'all':!![]}];}return db[_0x8bca('0x59')][_0x8bca('0x3c')](_0x46d56a);})[_0x8bca('0x1f')](function(_0x3dde74){_0x3281c7[_0x8bca('0x3d')]=_0x3dde74;return _0x3281c7;});}})['then'](respondWithFilteredResult(_0x57ae60,_0x46d56a))[_0x8bca('0x3e')](handleError(_0x57ae60,null));};exports[_0x8bca('0x5a')]=function(_0x319387,_0xef2a8b,_0x2c1557){var _0x473672={'raw':!![],'where':{}};var _0x222efa={};var _0x90fafe={'count':0x0,'rows':[]};return db[_0x8bca('0x28')]['findOne']({'where':{'id':_0x319387[_0x8bca('0x49')]['id']}})[_0x8bca('0x1f')](handleEntityNotFound(_0xef2a8b,null))['then'](function(_0x2143e2){if(_0x2143e2){_0x222efa[_0x8bca('0x2c')]=_[_0x8bca('0x2e')](db['CmHopperFinal'][_0x8bca('0x29')]);_0x222efa[_0x8bca('0x2d')]=_['keys'](_0x319387[_0x8bca('0x2d')]);_0x222efa[_0x8bca('0x2f')]=_[_0x8bca('0x30')](_0x222efa[_0x8bca('0x2c')],_0x222efa[_0x8bca('0x2d')]);_0x473672['attributes']=_[_0x8bca('0x30')](_0x222efa[_0x8bca('0x2c')],qs[_0x8bca('0x32')](_0x319387[_0x8bca('0x2d')][_0x8bca('0x32')]));_0x473672['attributes']=_0x473672[_0x8bca('0x31')][_0x8bca('0x40')]?_0x473672[_0x8bca('0x31')]:_0x222efa['model'];if(!_0x319387['query']['hasOwnProperty'](_0x8bca('0x33'))){_0x473672[_0x8bca('0x1a')]=qs[_0x8bca('0x1a')](_0x319387[_0x8bca('0x2d')]['limit']);_0x473672['offset']=qs[_0x8bca('0x1c')](_0x319387[_0x8bca('0x2d')][_0x8bca('0x1c')]);}_0x473672[_0x8bca('0x34')]=qs['sort'](_0x319387['query'][_0x8bca('0x35')]);_0x473672['where']=qs[_0x8bca('0x2f')](_[_0x8bca('0x55')](_0x319387[_0x8bca('0x2d')],_0x222efa[_0x8bca('0x2f')]));_0x473672[_0x8bca('0x36')]['CampaignId']=_0x2143e2['id'];if(_0x319387['query'][_0x8bca('0x37')]){_0x473672[_0x8bca('0x36')]=_[_0x8bca('0x38')](_0x473672[_0x8bca('0x36')],{'$or':_[_0x8bca('0x27')](_0x473672['attributes'],function(_0x49e6f0){var _0x2d6d91={};_0x2d6d91[_0x49e6f0]={'$like':'%'+_0x319387[_0x8bca('0x2d')][_0x8bca('0x37')]+'%'};return _0x2d6d91;})});}_0x473672=_[_0x8bca('0x38')]({},_0x473672,_0x319387[_0x8bca('0x4a')]);return db[_0x8bca('0x5b')][_0x8bca('0x1b')]({'where':_0x473672[_0x8bca('0x36')]})[_0x8bca('0x1f')](function(_0x30470c){_0x90fafe[_0x8bca('0x1b')]=_0x30470c;if(_0x319387[_0x8bca('0x2d')][_0x8bca('0x3a')]){_0x473672['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x8bca('0x3c')](_0x473672);})[_0x8bca('0x1f')](function(_0x5dbd2e){_0x90fafe[_0x8bca('0x3d')]=_0x5dbd2e;return _0x90fafe;});}})[_0x8bca('0x1f')](respondWithFilteredResult(_0xef2a8b,_0x473672))[_0x8bca('0x3e')](handleError(_0xef2a8b,null));};exports[_0x8bca('0x5c')]=function(_0x280d1d,_0x215c78,_0x45bd58){var _0x1a5a65={'raw':!![],'where':{}};var _0x194f58={};var _0x12d957={'count':0x0,'rows':[]};return db['Campaign'][_0x8bca('0x58')]({'where':{'id':_0x280d1d[_0x8bca('0x49')]['id']}})[_0x8bca('0x1f')](handleEntityNotFound(_0x215c78,null))[_0x8bca('0x1f')](function(_0xd09bd0){if(_0xd09bd0){_0x194f58[_0x8bca('0x2c')]=_[_0x8bca('0x2e')](db[_0x8bca('0x5d')][_0x8bca('0x29')]);_0x194f58[_0x8bca('0x2d')]=_['keys'](_0x280d1d[_0x8bca('0x2d')]);_0x194f58[_0x8bca('0x2f')]=_[_0x8bca('0x30')](_0x194f58['model'],_0x194f58[_0x8bca('0x2d')]);_0x1a5a65[_0x8bca('0x31')]=_[_0x8bca('0x30')](_0x194f58[_0x8bca('0x2c')],qs[_0x8bca('0x32')](_0x280d1d[_0x8bca('0x2d')][_0x8bca('0x32')]));_0x1a5a65[_0x8bca('0x31')]=_0x1a5a65[_0x8bca('0x31')][_0x8bca('0x40')]?_0x1a5a65[_0x8bca('0x31')]:_0x194f58[_0x8bca('0x2c')];if(!_0x280d1d[_0x8bca('0x2d')][_0x8bca('0x54')]('nolimit')){_0x1a5a65[_0x8bca('0x1a')]=qs[_0x8bca('0x1a')](_0x280d1d[_0x8bca('0x2d')][_0x8bca('0x1a')]);_0x1a5a65[_0x8bca('0x1c')]=qs['offset'](_0x280d1d['query']['offset']);}_0x1a5a65[_0x8bca('0x34')]=qs[_0x8bca('0x35')](_0x280d1d[_0x8bca('0x2d')][_0x8bca('0x35')]);_0x1a5a65[_0x8bca('0x36')]=qs[_0x8bca('0x2f')](_['pick'](_0x280d1d[_0x8bca('0x2d')],_0x194f58['filters']));_0x1a5a65[_0x8bca('0x36')]['CampaignId']=_0xd09bd0['id'];if(_0x280d1d[_0x8bca('0x2d')][_0x8bca('0x37')]){_0x1a5a65['where']=_['merge'](_0x1a5a65[_0x8bca('0x36')],{'$or':_[_0x8bca('0x27')](_0x1a5a65[_0x8bca('0x31')],function(_0x4fb3e2){var _0x5cfce1={};_0x5cfce1[_0x4fb3e2]={'$like':'%'+_0x280d1d[_0x8bca('0x2d')][_0x8bca('0x37')]+'%'};return _0x5cfce1;})});}_0x1a5a65=_[_0x8bca('0x38')]({},_0x1a5a65,_0x280d1d[_0x8bca('0x4a')]);return db[_0x8bca('0x5d')][_0x8bca('0x1b')]({'where':_0x1a5a65['where']})['then'](function(_0x2b1e57){_0x12d957[_0x8bca('0x1b')]=_0x2b1e57;if(_0x280d1d[_0x8bca('0x2d')][_0x8bca('0x3a')]){_0x1a5a65[_0x8bca('0x3b')]=[{'all':!![]}];}return db[_0x8bca('0x5d')][_0x8bca('0x3c')](_0x1a5a65);})[_0x8bca('0x1f')](function(_0x204d9c){_0x12d957[_0x8bca('0x3d')]=_0x204d9c;return _0x12d957;});}})[_0x8bca('0x1f')](respondWithFilteredResult(_0x215c78,_0x1a5a65))[_0x8bca('0x3e')](handleError(_0x215c78,null));};exports[_0x8bca('0x5e')]=function(_0x2d3041,_0x3421ae,_0x16b698){var _0x31070e={};var _0x22c9f1={};var _0x364e03;var _0x1fb3d2;return db[_0x8bca('0x28')][_0x8bca('0x58')]({'where':{'id':_0x2d3041[_0x8bca('0x49')]['id']}})[_0x8bca('0x1f')](handleEntityNotFound(_0x3421ae,null))[_0x8bca('0x1f')](function(_0x4cefb0){if(_0x4cefb0){_0x364e03=_0x4cefb0;_0x22c9f1[_0x8bca('0x2c')]=_[_0x8bca('0x2e')](db[_0x8bca('0x5f')]['rawAttributes']);_0x22c9f1[_0x8bca('0x2d')]=_['keys'](_0x2d3041[_0x8bca('0x2d')]);_0x22c9f1[_0x8bca('0x2f')]=_['intersection'](_0x22c9f1[_0x8bca('0x2c')],_0x22c9f1['query']);_0x31070e[_0x8bca('0x31')]=_['intersection'](_0x22c9f1[_0x8bca('0x2c')],qs[_0x8bca('0x32')](_0x2d3041[_0x8bca('0x2d')]['fields']));_0x31070e[_0x8bca('0x31')]=_0x31070e['attributes'][_0x8bca('0x40')]?_0x31070e[_0x8bca('0x31')]:_0x22c9f1['model'];_0x31070e[_0x8bca('0x34')]=qs[_0x8bca('0x35')](_0x2d3041[_0x8bca('0x2d')][_0x8bca('0x35')]);_0x31070e[_0x8bca('0x36')]=qs[_0x8bca('0x2f')](_['pick'](_0x2d3041['query'],_0x22c9f1[_0x8bca('0x2f')]));if(_0x2d3041['query'][_0x8bca('0x37')]){_0x31070e[_0x8bca('0x36')]=_[_0x8bca('0x38')](_0x31070e[_0x8bca('0x36')],{'$or':_[_0x8bca('0x27')](_0x31070e[_0x8bca('0x31')],function(_0x55b799){var _0x5e02d2={};_0x5e02d2[_0x55b799]={'$like':'%'+_0x2d3041['query']['filter']+'%'};return _0x5e02d2;})});}_0x31070e=_[_0x8bca('0x38')]({},_0x31070e,_0x2d3041[_0x8bca('0x4a')]);return _0x364e03[_0x8bca('0x5e')](_0x31070e);}})[_0x8bca('0x1f')](function(_0x6cedc3){if(_0x6cedc3){_0x1fb3d2=_0x6cedc3['length'];if(!_0x2d3041['query'][_0x8bca('0x54')](_0x8bca('0x33'))){_0x31070e[_0x8bca('0x1a')]=qs[_0x8bca('0x1a')](_0x2d3041['query'][_0x8bca('0x1a')]);_0x31070e[_0x8bca('0x1c')]=qs[_0x8bca('0x1c')](_0x2d3041['query'][_0x8bca('0x1c')]);}return _0x364e03[_0x8bca('0x5e')](_0x31070e);}})[_0x8bca('0x1f')](function(_0xe6d2c6){if(_0xe6d2c6){return _0xe6d2c6?{'count':_0x1fb3d2,'rows':_0xe6d2c6}:null;}})['then'](respondWithResult(_0x3421ae,null))[_0x8bca('0x3e')](handleError(_0x3421ae,null));};exports[_0x8bca('0x60')]=function(_0x14a9c1,_0x146796,_0x3e7d0c){var _0x29eac1,_0x49c29a;var _0x2ec68f=[];var _0x3c17a4=moment()[_0x8bca('0x61')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x8bca('0x28')][_0x8bca('0x41')]({'where':{'id':_0x14a9c1[_0x8bca('0x49')]['id']}})[_0x8bca('0x1f')](handleEntityNotFound(_0x146796,null))[_0x8bca('0x1f')](function(_0x5b601d){if(_0x5b601d){_0x49c29a=_0x5b601d;return _0x5b601d['addLists'](_0x14a9c1[_0x8bca('0x4d')][_0x8bca('0x62')],_[_0x8bca('0x4e')](_0x14a9c1[_0x8bca('0x4d')],[_0x8bca('0x62'),'id'])||{});}return null;})[_0x8bca('0x63')](function(_0x446d0b){var _0x4a8102;var _0x19da71;_0x29eac1=_0x446d0b||[];var _0xaae941=[];if(_0x446d0b){for(var _0x37e651=0x0;_0x37e651<_0x446d0b[_0x8bca('0x40')];_0x37e651+=0x1){var _0x265c90=_0x446d0b[_0x37e651][_0x8bca('0x21')]({'plain':!![]});_0x49c29a[_0x8bca('0x64')]=_0x14a9c1[_0x8bca('0x4d')][_0x8bca('0x64')]?_0x14a9c1['body']['dialCheckDuplicateType']:_0x49c29a['dialCheckDuplicateType'];switch(_0x49c29a[_0x8bca('0x64')]){case _0x8bca('0x65'):_0x4a8102=squel['insert']()[_0x8bca('0x66')](_0x8bca('0x67'))[_0x8bca('0x68')]([_0x8bca('0x69'),_0x8bca('0x6a'),_0x8bca('0x6b'),_0x8bca('0x6c'),_0x8bca('0x56'),_0x8bca('0x4b'),_0x8bca('0x4c')],squel[_0x8bca('0x6d')]()['field'](_0x8bca('0x69'),_0x8bca('0x69'))[_0x8bca('0x6e')]('NOW()',_0x8bca('0x6a'))[_0x8bca('0x6e')]('id','ContactId')[_0x8bca('0x6e')](_0x265c90[_0x8bca('0x6f')][_0x8bca('0x70')](),_0x8bca('0x6c'))['field'](_0x14a9c1['params']['id']['toString'](),_0x8bca('0x56'))[_0x8bca('0x6e')]('\x27'+_0x3c17a4+'\x27','createdAt')[_0x8bca('0x6e')]('\x27'+_0x3c17a4+'\x27',_0x8bca('0x4c'))[_0x8bca('0x71')](_0x8bca('0x72'))[_0x8bca('0x36')](_0x8bca('0x73'))['where']('ListId\x20=\x20?',_0x265c90[_0x8bca('0x6f')][_0x8bca('0x70')]())[_0x8bca('0x36')](_0x8bca('0x74'))[_0x8bca('0x36')](_0x8bca('0x75'),squel[_0x8bca('0x6d')]()[_0x8bca('0x6e')](_0x8bca('0x76'))[_0x8bca('0x71')](_0x8bca('0x77'))[_0x8bca('0x36')](_0x8bca('0x78'),_0x14a9c1[_0x8bca('0x49')]['id']['toString']()))[_0x8bca('0x36')](_0x8bca('0x75'),squel['select']()['field'](_0x8bca('0x79'))[_0x8bca('0x71')]('cm_hopper')['where'](_0x8bca('0x78'),_0x14a9c1['params']['id'][_0x8bca('0x70')]())))[_0x8bca('0x70')]();break;case _0x8bca('0x7a'):_0x4a8102=squel[_0x8bca('0x7b')]()[_0x8bca('0x66')](_0x8bca('0x67'))[_0x8bca('0x68')](['phone',_0x8bca('0x6a'),_0x8bca('0x6b'),_0x8bca('0x6c'),_0x8bca('0x56'),'createdAt',_0x8bca('0x4c')],squel[_0x8bca('0x6d')]()[_0x8bca('0x6e')](_0x8bca('0x69'),_0x8bca('0x69'))[_0x8bca('0x6e')](_0x8bca('0x7c'),_0x8bca('0x6a'))[_0x8bca('0x6e')]('id',_0x8bca('0x6b'))[_0x8bca('0x6e')](_0x265c90[_0x8bca('0x6f')][_0x8bca('0x70')](),'ListId')[_0x8bca('0x6e')](_0x14a9c1[_0x8bca('0x49')]['id'][_0x8bca('0x70')](),_0x8bca('0x56'))['field']('\x27'+_0x3c17a4+'\x27','createdAt')[_0x8bca('0x6e')]('\x27'+_0x3c17a4+'\x27',_0x8bca('0x4c'))[_0x8bca('0x71')]('cm_contacts')[_0x8bca('0x36')]('deletedAt\x20IS\x20NULL')[_0x8bca('0x36')](_0x8bca('0x7d'),_0x265c90[_0x8bca('0x6f')]['toString']())['where'](_0x8bca('0x74'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x8bca('0x6d')]()[_0x8bca('0x6e')](_0x8bca('0x79'))[_0x8bca('0x71')](_0x8bca('0x67'))[_0x8bca('0x36')]('CampaignId\x20=\x20?',_0x14a9c1[_0x8bca('0x49')]['id'][_0x8bca('0x70')]())))[_0x8bca('0x70')]();break;default:_0x4a8102=squel['insert']()['into']('cm_hopper')[_0x8bca('0x68')]([_0x8bca('0x69'),'scheduledAt',_0x8bca('0x6b'),_0x8bca('0x6c'),_0x8bca('0x56'),_0x8bca('0x4b'),'updatedAt'],squel['select']()[_0x8bca('0x6e')]('phone',_0x8bca('0x69'))[_0x8bca('0x6e')]('NOW()','scheduledAt')[_0x8bca('0x6e')]('id',_0x8bca('0x6b'))[_0x8bca('0x6e')](_0x265c90['CmListId'][_0x8bca('0x70')](),'ListId')[_0x8bca('0x6e')](_0x14a9c1['params']['id']['toString'](),'CampaignId')['field']('\x27'+_0x3c17a4+'\x27',_0x8bca('0x4b'))['field']('\x27'+_0x3c17a4+'\x27',_0x8bca('0x4c'))[_0x8bca('0x71')](_0x8bca('0x72'))[_0x8bca('0x36')](_0x8bca('0x73'))[_0x8bca('0x36')]('ListId\x20=\x20?',_0x265c90[_0x8bca('0x6f')][_0x8bca('0x70')]())['where'](_0x8bca('0x74')))['toString']();}_0x19da71=squel[_0x8bca('0x7b')]()[_0x8bca('0x66')](_0x8bca('0x7e'))[_0x8bca('0x68')]([_0x8bca('0x7f'),_0x8bca('0x6a'),'phone','OrderBy',_0x8bca('0x4b'),_0x8bca('0x4c')],squel[_0x8bca('0x6d')]()[_0x8bca('0x6e')](_0x8bca('0x80'),'id')[_0x8bca('0x6e')](_0x8bca('0x7c'),'scheduledAt')['field']('ci.item',_0x8bca('0x69'))[_0x8bca('0x6e')](_0x8bca('0x81'),_0x8bca('0x82'))[_0x8bca('0x6e')]('\x27'+_0x3c17a4+'\x27',_0x8bca('0x4b'))[_0x8bca('0x6e')]('\x27'+_0x3c17a4+'\x27',_0x8bca('0x4c'))[_0x8bca('0x71')]('cm_contact_has_items','ci')[_0x8bca('0x83')](_0x8bca('0x67'),'h',_0x8bca('0x84'))[_0x8bca('0x36')](_0x8bca('0x85'),_0x265c90[_0x8bca('0x6f')][_0x8bca('0x70')]())[_0x8bca('0x36')](_0x8bca('0x86'),_0x14a9c1[_0x8bca('0x49')]['id']['toString']())[_0x8bca('0x36')](_0x8bca('0x87'),_0x3c17a4))[_0x8bca('0x70')]();_0xaae941[_0x8bca('0x88')](db[_0x8bca('0x89')][_0x8bca('0x2d')](_0x4a8102));_0x2ec68f[_0x8bca('0x88')](db['sequelize'][_0x8bca('0x2d')](_0x19da71));}return BPromise[_0x8bca('0x8a')](_0xaae941);}})[_0x8bca('0x1f')](function(){return BPromise[_0x8bca('0x8a')](_0x2ec68f);})[_0x8bca('0x1f')](function(){return _0x29eac1;})[_0x8bca('0x1f')](respondWithResult(_0x146796,null))[_0x8bca('0x3e')](handleError(_0x146796,null));};exports['removeLists']=function(_0x22c7c7,_0x17b179,_0x8e017c){return db[_0x8bca('0x28')][_0x8bca('0x41')]({'where':{'id':_0x22c7c7[_0x8bca('0x49')]['id']}})['then'](handleEntityNotFound(_0x17b179,null))['then'](function(_0x314497){if(_0x314497){return _0x314497[_0x8bca('0x8b')](_0x22c7c7[_0x8bca('0x2d')][_0x8bca('0x62')]);}})[_0x8bca('0x1f')](function(_0x4525ce){if(_0x4525ce){return db[_0x8bca('0x53')][_0x8bca('0x20')]({'where':{'ListId':_0x22c7c7[_0x8bca('0x2d')][_0x8bca('0x62')],'CampaignId':_0x22c7c7[_0x8bca('0x49')]['id']}})[_0x8bca('0x1f')](function(){return _0x4525ce;});}})[_0x8bca('0x1f')](respondWithStatusCode(_0x17b179,null))['catch'](handleError(_0x17b179,null));};exports[_0x8bca('0x8c')]=function(_0x510ba5,_0x27a4be,_0x44aea0){var _0x47cec2={};var _0x4e8b75={};var _0x4fa822;var _0x227f3f;return db[_0x8bca('0x28')][_0x8bca('0x58')]({'where':{'id':_0x510ba5[_0x8bca('0x49')]['id']}})[_0x8bca('0x1f')](handleEntityNotFound(_0x27a4be,null))[_0x8bca('0x1f')](function(_0x192bd5){if(_0x192bd5){_0x4fa822=_0x192bd5;_0x4e8b75['model']=_[_0x8bca('0x2e')](db['CmList'][_0x8bca('0x29')]);_0x4e8b75[_0x8bca('0x2d')]=_['keys'](_0x510ba5[_0x8bca('0x2d')]);_0x4e8b75[_0x8bca('0x2f')]=_['intersection'](_0x4e8b75[_0x8bca('0x2c')],_0x4e8b75[_0x8bca('0x2d')]);_0x47cec2['attributes']=_[_0x8bca('0x30')](_0x4e8b75['model'],qs[_0x8bca('0x32')](_0x510ba5[_0x8bca('0x2d')]['fields']));_0x47cec2['attributes']=_0x47cec2[_0x8bca('0x31')]['length']?_0x47cec2[_0x8bca('0x31')]:_0x4e8b75[_0x8bca('0x2c')];_0x47cec2[_0x8bca('0x34')]=qs[_0x8bca('0x35')](_0x510ba5[_0x8bca('0x2d')][_0x8bca('0x35')]);_0x47cec2['where']=qs['filters'](_[_0x8bca('0x55')](_0x510ba5['query'],_0x4e8b75[_0x8bca('0x2f')]));if(_0x510ba5[_0x8bca('0x2d')][_0x8bca('0x37')]){_0x47cec2[_0x8bca('0x36')]=_['merge'](_0x47cec2[_0x8bca('0x36')],{'$or':_[_0x8bca('0x27')](_0x47cec2['attributes'],function(_0x10d2f5){var _0x23f618={};_0x23f618[_0x10d2f5]={'$like':'%'+_0x510ba5[_0x8bca('0x2d')]['filter']+'%'};return _0x23f618;})});}_0x47cec2=_[_0x8bca('0x38')]({},_0x47cec2,_0x510ba5[_0x8bca('0x4a')]);return _0x4fa822[_0x8bca('0x8c')](_0x47cec2);}})[_0x8bca('0x1f')](function(_0x23c6a2){if(_0x23c6a2){_0x227f3f=_0x23c6a2[_0x8bca('0x40')];if(!_0x510ba5[_0x8bca('0x2d')][_0x8bca('0x54')]('nolimit')){_0x47cec2[_0x8bca('0x1a')]=qs[_0x8bca('0x1a')](_0x510ba5['query'][_0x8bca('0x1a')]);_0x47cec2[_0x8bca('0x1c')]=qs[_0x8bca('0x1c')](_0x510ba5['query'][_0x8bca('0x1c')]);}return _0x4fa822[_0x8bca('0x8c')](_0x47cec2);}})['then'](function(_0x3e243d){if(_0x3e243d){return _0x3e243d?{'count':_0x227f3f,'rows':_0x3e243d}:null;}})[_0x8bca('0x1f')](respondWithResult(_0x27a4be,null))[_0x8bca('0x3e')](handleError(_0x27a4be,null));};exports[_0x8bca('0x8d')]=function(_0x1d2df1,_0x44dc99,_0x385119){var _0x1671d6,_0x21534b;var _0x28400f=[];var _0x2cc157=moment()[_0x8bca('0x61')](_0x8bca('0x8e'));return db['Campaign']['find']({'where':{'id':_0x1d2df1[_0x8bca('0x49')]['id']}})[_0x8bca('0x1f')](handleEntityNotFound(_0x44dc99,null))[_0x8bca('0x1f')](function(_0x52bef4){if(_0x52bef4){_0x21534b=_0x52bef4;return _0x52bef4[_0x8bca('0x8d')](_0x1d2df1[_0x8bca('0x4d')][_0x8bca('0x62')],_[_0x8bca('0x4e')](_0x1d2df1['body'],[_0x8bca('0x62'),'id'])||{});}return null;})[_0x8bca('0x63')](function(_0xf7b106){var _0x34fb34;var _0x13841a;_0x1671d6=_0xf7b106||[];var _0x5b9fd9=[];if(_0xf7b106){for(var _0x355512=0x0;_0x355512<_0xf7b106['length'];_0x355512+=0x1){var _0x30d51c=_0xf7b106[_0x355512][_0x8bca('0x21')]({'plain':!![]});_0x34fb34=squel[_0x8bca('0x7b')]()[_0x8bca('0x66')]('cm_hopper_black')[_0x8bca('0x68')](['phone','ContactId',_0x8bca('0x6c'),_0x8bca('0x56'),_0x8bca('0x4b'),_0x8bca('0x4c')],squel[_0x8bca('0x6d')]()['field']('phone',_0x8bca('0x69'))['field']('id',_0x8bca('0x6b'))[_0x8bca('0x6e')](_0x30d51c[_0x8bca('0x6f')][_0x8bca('0x70')](),_0x8bca('0x6c'))[_0x8bca('0x6e')](_0x1d2df1[_0x8bca('0x49')]['id'][_0x8bca('0x70')](),_0x8bca('0x56'))[_0x8bca('0x6e')](_0x8bca('0x7c'),'createdAt')[_0x8bca('0x6e')]('NOW()',_0x8bca('0x4c'))[_0x8bca('0x71')](_0x8bca('0x72'))[_0x8bca('0x36')](_0x8bca('0x73'))[_0x8bca('0x36')](_0x8bca('0x7d'),_0x30d51c[_0x8bca('0x6f')][_0x8bca('0x70')]())['where'](_0x8bca('0x74')))[_0x8bca('0x70')]();_0x5b9fd9['push'](db[_0x8bca('0x89')]['query'](_0x34fb34));}return BPromise[_0x8bca('0x8a')](_0x5b9fd9);}})[_0x8bca('0x1f')](function(){return _0x1671d6;})['then'](respondWithResult(_0x44dc99,null))['catch'](handleError(_0x44dc99,null));};exports[_0x8bca('0x8f')]=function(_0x2dbd22,_0x570de3,_0x21d79c){return db[_0x8bca('0x28')][_0x8bca('0x41')]({'where':{'id':_0x2dbd22[_0x8bca('0x49')]['id']}})['then'](handleEntityNotFound(_0x570de3,null))[_0x8bca('0x1f')](function(_0x21ec10){if(_0x21ec10){return _0x21ec10[_0x8bca('0x8f')](_0x2dbd22['query'][_0x8bca('0x62')]);}})[_0x8bca('0x1f')](function(_0x10b7ec){if(_0x10b7ec){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x2dbd22[_0x8bca('0x2d')][_0x8bca('0x62')],'CampaignId':_0x2dbd22[_0x8bca('0x49')]['id']}})['then'](function(){return _0x10b7ec;});}})[_0x8bca('0x1f')](respondWithStatusCode(_0x570de3,null))['catch'](handleError(_0x570de3,null));}; \ No newline at end of file +var _0xce2f=['IvrCampaigns','error','stack','name','send','map','Campaign','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','keys','rawAttributes','options','find','body','user','role','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getHoppers','findOne','CmHopper','length','hasOwnProperty','CampaignId','CmHopperHistory','pick','findAll','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce2f,0x18a));var _0xfce2=function(_0x595334,_0x475958){_0x595334=_0x595334-0x0;var _0x14abc8=_0xce2f[_0x595334];return _0x14abc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfce2('0x0'));var zipdir=require(_0xfce2('0x1'));var jsonpatch=require(_0xfce2('0x2'));var rp=require(_0xfce2('0x3'));var moment=require(_0xfce2('0x4'));var BPromise=require(_0xfce2('0x5'));var Mustache=require('mustache');var util=require(_0xfce2('0x6'));var path=require('path');var sox=require(_0xfce2('0x7'));var csv=require('to-csv');var ejs=require(_0xfce2('0x8'));var fs=require('fs');var fs_extra=require(_0xfce2('0x9'));var _=require(_0xfce2('0xa'));var squel=require(_0xfce2('0xb'));var crypto=require(_0xfce2('0xc'));var jsforce=require(_0xfce2('0xd'));var deskjs=require(_0xfce2('0xe'));var toCsv=require(_0xfce2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfce2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfce2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfce2('0x12'));var logger=require('../../config/logger')(_0xfce2('0x13'));var utils=require(_0xfce2('0x14'));var config=require(_0xfce2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfce2('0x16'))['db'];function respondWithStatusCode(_0x5bc459,_0x14cf81){_0x14cf81=_0x14cf81||0xcc;return function(_0x1149ac){if(_0x1149ac){return _0x5bc459[_0xfce2('0x17')](_0x14cf81);}return _0x5bc459[_0xfce2('0x18')](_0x14cf81)[_0xfce2('0x19')]();};}function respondWithResult(_0x3fa748,_0x272f58){_0x272f58=_0x272f58||0xc8;return function(_0x4fdcc2){if(_0x4fdcc2){return _0x3fa748[_0xfce2('0x18')](_0x272f58)[_0xfce2('0x1a')](_0x4fdcc2);}};}function respondWithFilteredResult(_0x47c53a,_0x32094b){return function(_0x1d35c5){if(_0x1d35c5){var _0x5781fe=typeof _0x32094b['offset']===_0xfce2('0x1b')&&typeof _0x32094b[_0xfce2('0x1c')]==='undefined';var _0x18e430=_0x1d35c5[_0xfce2('0x1d')];var _0x1e02a6=_0x5781fe?0x0:_0x32094b[_0xfce2('0x1e')];var _0x2ad9f5=_0x5781fe?_0x1d35c5[_0xfce2('0x1d')]:_0x32094b[_0xfce2('0x1e')]+_0x32094b[_0xfce2('0x1c')];var _0x1cdd29;if(_0x2ad9f5>=_0x18e430){_0x2ad9f5=_0x18e430;_0x1cdd29=0xc8;}else{_0x1cdd29=0xce;}_0x47c53a[_0xfce2('0x18')](_0x1cdd29);return _0x47c53a['set']('Content-Range',_0x1e02a6+'-'+_0x2ad9f5+'/'+_0x18e430)[_0xfce2('0x1a')](_0x1d35c5);}return null;};}function patchUpdates(_0x3ea07b){return function(_0x312c10){try{jsonpatch[_0xfce2('0x1f')](_0x312c10,_0x3ea07b,!![]);}catch(_0x4bbebc){return BPromise[_0xfce2('0x20')](_0x4bbebc);}return _0x312c10[_0xfce2('0x21')]();};}function saveUpdates(_0x33ced0,_0x4c239b){return function(_0x4088c7){if(_0x4088c7){return _0x4088c7[_0xfce2('0x22')](_0x33ced0)[_0xfce2('0x23')](function(_0x4d59b7){return _0x4d59b7;});}return null;};}function removeEntity(_0x57bc28,_0x39476b){return function(_0x208903){if(_0x208903){return _0x208903[_0xfce2('0x24')]()[_0xfce2('0x23')](function(){var _0x57d743=_0x208903[_0xfce2('0x25')]({'plain':!![]});var _0x5cd9b2=_0xfce2('0x26');return db['UserProfileResource'][_0xfce2('0x24')]({'where':{'type':_0x5cd9b2,'resourceId':_0x57d743['id']}})[_0xfce2('0x23')](function(){return _0x208903;});})[_0xfce2('0x23')](function(){_0x57bc28['status'](0xcc)[_0xfce2('0x19')]();});}};}function handleEntityNotFound(_0x2358dc,_0x175bcc){return function(_0x112f0a){if(!_0x112f0a){_0x2358dc['sendStatus'](0x194);}return _0x112f0a;};}function handleError(_0x6c8a47,_0xef1b38){_0xef1b38=_0xef1b38||0x1f4;return function(_0x58022e){logger[_0xfce2('0x27')](_0x58022e[_0xfce2('0x28')]);if(_0x58022e[_0xfce2('0x29')]){delete _0x58022e[_0xfce2('0x29')];}_0x6c8a47['status'](_0xef1b38)[_0xfce2('0x2a')](_0x58022e);};}exports['index']=function(_0x1b211c,_0x468739){var _0x3332f9={},_0x35b7fe={},_0x1882cd={'count':0x0,'rows':[]};var _0x101107=_[_0xfce2('0x2b')](db[_0xfce2('0x2c')]['rawAttributes'],function(_0x10b9ec){return{'name':_0x10b9ec[_0xfce2('0x2d')],'type':_0x10b9ec[_0xfce2('0x2e')]['key']};});_0x35b7fe[_0xfce2('0x2f')]=_['map'](_0x101107,'name');_0x35b7fe[_0xfce2('0x30')]=_['keys'](_0x1b211c[_0xfce2('0x30')]);_0x35b7fe[_0xfce2('0x31')]=_[_0xfce2('0x32')](_0x35b7fe[_0xfce2('0x2f')],_0x35b7fe['query']);_0x3332f9['attributes']=_['intersection'](_0x35b7fe[_0xfce2('0x2f')],qs[_0xfce2('0x33')](_0x1b211c[_0xfce2('0x30')][_0xfce2('0x33')]));_0x3332f9[_0xfce2('0x34')]=_0x3332f9['attributes']['length']?_0x3332f9[_0xfce2('0x34')]:_0x35b7fe[_0xfce2('0x2f')];if(!_0x1b211c[_0xfce2('0x30')]['hasOwnProperty'](_0xfce2('0x35'))){_0x3332f9['limit']=qs[_0xfce2('0x1c')](_0x1b211c[_0xfce2('0x30')][_0xfce2('0x1c')]);_0x3332f9['offset']=qs['offset'](_0x1b211c[_0xfce2('0x30')][_0xfce2('0x1e')]);}_0x3332f9[_0xfce2('0x36')]=qs[_0xfce2('0x37')](_0x1b211c['query'][_0xfce2('0x37')]);_0x3332f9['where']=qs[_0xfce2('0x31')](_['pick'](_0x1b211c[_0xfce2('0x30')],_0x35b7fe[_0xfce2('0x31')]),_0x101107);if(_0x1b211c[_0xfce2('0x30')][_0xfce2('0x38')]){_0x3332f9[_0xfce2('0x39')]=_['merge'](_0x3332f9[_0xfce2('0x39')],{'$or':_[_0xfce2('0x2b')](_0x101107,function(_0x52ae47){if(_0x52ae47[_0xfce2('0x2e')]!==_0xfce2('0x3a')){var _0x3df655={};_0x3df655[_0x52ae47[_0xfce2('0x29')]]={'$like':'%'+_0x1b211c[_0xfce2('0x30')]['filter']+'%'};return _0x3df655;}})});}_0x3332f9=_[_0xfce2('0x3b')]({},_0x3332f9,_0x1b211c['options']);var _0x35108a={'where':_0x3332f9[_0xfce2('0x39')]};return db[_0xfce2('0x2c')][_0xfce2('0x1d')](_0x35108a)[_0xfce2('0x23')](function(_0x51037e){_0x1882cd['count']=_0x51037e;if(_0x1b211c[_0xfce2('0x30')][_0xfce2('0x3c')]){_0x3332f9[_0xfce2('0x3d')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x3332f9);})['then'](function(_0x3fcd0e){_0x1882cd[_0xfce2('0x3e')]=_0x3fcd0e;return _0x1882cd;})['then'](respondWithFilteredResult(_0x468739,_0x3332f9))[_0xfce2('0x3f')](handleError(_0x468739,null));};exports[_0xfce2('0x40')]=function(_0x5beb7a,_0x2faefa){var _0x158bbe={'raw':![],'where':{'id':_0x5beb7a[_0xfce2('0x41')]['id']}},_0x5ad765={};_0x5ad765[_0xfce2('0x2f')]=_[_0xfce2('0x42')](db[_0xfce2('0x2c')][_0xfce2('0x43')]);_0x5ad765['query']=_['keys'](_0x5beb7a[_0xfce2('0x30')]);_0x5ad765[_0xfce2('0x31')]=_['intersection'](_0x5ad765['model'],_0x5ad765[_0xfce2('0x30')]);_0x158bbe[_0xfce2('0x34')]=_[_0xfce2('0x32')](_0x5ad765[_0xfce2('0x2f')],qs['fields'](_0x5beb7a[_0xfce2('0x30')][_0xfce2('0x33')]));_0x158bbe['attributes']=_0x158bbe[_0xfce2('0x34')]['length']?_0x158bbe[_0xfce2('0x34')]:_0x5ad765[_0xfce2('0x2f')];if(_0x5beb7a[_0xfce2('0x30')][_0xfce2('0x3c')]){_0x158bbe[_0xfce2('0x3d')]=[{'all':!![]}];}_0x158bbe=_['merge']({},_0x158bbe,_0x5beb7a[_0xfce2('0x44')]);return db[_0xfce2('0x2c')][_0xfce2('0x45')](_0x158bbe)['then'](handleEntityNotFound(_0x2faefa,null))[_0xfce2('0x23')](respondWithResult(_0x2faefa,null))[_0xfce2('0x3f')](handleError(_0x2faefa,null));};exports['create']=function(_0x281b4f,_0x2f64d7){return db['Campaign']['create'](_0x281b4f[_0xfce2('0x46')],{})[_0xfce2('0x23')](function(_0x388424){var _0x486750=_0x281b4f[_0xfce2('0x47')][_0xfce2('0x25')]({'plain':!![]});if(!_0x486750)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x486750[_0xfce2('0x48')]===_0xfce2('0x47')){var _0xdecfe0=_0x388424[_0xfce2('0x25')]({'plain':!![]});var _0x418f39=_0xfce2('0x26');return db['UserProfileSection'][_0xfce2('0x45')]({'where':{'name':_0x418f39,'userProfileId':_0x486750[_0xfce2('0x49')]},'raw':!![]})[_0xfce2('0x23')](function(_0x2c04d2){if(_0x2c04d2&&_0x2c04d2[_0xfce2('0x4a')]===0x0){return db[_0xfce2('0x4b')][_0xfce2('0x4c')]({'name':_0xdecfe0[_0xfce2('0x29')],'resourceId':_0xdecfe0['id'],'type':_0x2c04d2[_0xfce2('0x29')],'sectionId':_0x2c04d2['id']},{})[_0xfce2('0x23')](function(){return _0x388424;});}else{return _0x388424;}})[_0xfce2('0x3f')](function(_0x4f8a2f){logger[_0xfce2('0x27')](_0xfce2('0x4d'),_0x4f8a2f);throw _0x4f8a2f;});}return _0x388424;})['then'](respondWithResult(_0x2f64d7,0xc9))['catch'](handleError(_0x2f64d7,null));};exports[_0xfce2('0x4e')]=function(_0x889efe,_0x58417a){var _0x2ce4f3={'where':{'id':_0x889efe['params']['id']}},_0x157f50={};_0x157f50[_0xfce2('0x2f')]=_[_0xfce2('0x42')](db[_0xfce2('0x2c')][_0xfce2('0x43')]);_0x2ce4f3[_0xfce2('0x34')]=_[_0xfce2('0x32')](_0x157f50[_0xfce2('0x2f')],qs['fields'](_0x889efe[_0xfce2('0x30')][_0xfce2('0x33')]));_0x2ce4f3[_0xfce2('0x34')]=_0x2ce4f3[_0xfce2('0x34')]['length']?_0x2ce4f3[_0xfce2('0x34')]:_0x157f50[_0xfce2('0x2f')];if(_0x889efe[_0xfce2('0x30')]['includeAll']){_0x2ce4f3[_0xfce2('0x3d')]=[{'all':!![]}];}_0x2ce4f3=_['merge']({},_0x2ce4f3,_0x889efe[_0xfce2('0x44')]);return db[_0xfce2('0x2c')][_0xfce2('0x45')](_0x2ce4f3)['then'](handleEntityNotFound(_0x58417a,null))[_0xfce2('0x23')](function(_0x29c464){if(_0x29c464){var _0x1a76db=_0x29c464['get']({'plain':!![]});_0x1a76db=qs[_0xfce2('0x4f')](_0x1a76db,['id',_0xfce2('0x50'),_0xfce2('0x51')]);_0x889efe[_0xfce2('0x46')]=_[_0xfce2('0x4f')](_0x889efe[_0xfce2('0x46')],['id','createdAt',_0xfce2('0x51')]);return db[_0xfce2('0x2c')][_0xfce2('0x4c')](_['merge'](_0x1a76db,_0x889efe[_0xfce2('0x46')]),{'include':_0x889efe[_0xfce2('0x30')][_0xfce2('0x3c')]?[{'all':!![]}]:undefined})[_0xfce2('0x23')](function(_0x26a041){var _0x27ca29=_0x889efe[_0xfce2('0x47')][_0xfce2('0x25')]({'plain':!![]});if(!_0x27ca29)throw new Error(_0xfce2('0x52'));if(_0x27ca29[_0xfce2('0x48')]===_0xfce2('0x47')){var _0x2a8691=_0x26a041[_0xfce2('0x25')]({'plain':!![]});var _0xcaf8c2=_0xfce2('0x26');return db[_0xfce2('0x53')][_0xfce2('0x45')]({'where':{'name':_0xcaf8c2,'userProfileId':_0x27ca29['userProfileId']},'raw':!![]})[_0xfce2('0x23')](function(_0x5651c5){if(_0x5651c5&&_0x5651c5['autoAssociation']===0x0){return db[_0xfce2('0x4b')][_0xfce2('0x4c')]({'name':_0x2a8691[_0xfce2('0x29')],'resourceId':_0x2a8691['id'],'type':_0x5651c5[_0xfce2('0x29')],'sectionId':_0x5651c5['id']},{})[_0xfce2('0x23')](function(){return _0x26a041;});}else{return _0x26a041;}})[_0xfce2('0x3f')](function(_0x52fdd2){logger[_0xfce2('0x27')](_0xfce2('0x4d'),_0x52fdd2);throw _0x52fdd2;});}return _0x26a041;});}})['then'](respondWithResult(_0x58417a,0xc9))[_0xfce2('0x3f')](handleError(_0x58417a,null));};exports[_0xfce2('0x22')]=function(_0x27027c,_0xaeaab5){if(_0x27027c[_0xfce2('0x46')]['id']){delete _0x27027c['body']['id'];}return db[_0xfce2('0x2c')]['find']({'where':{'id':_0x27027c['params']['id']}})['then'](handleEntityNotFound(_0xaeaab5,null))[_0xfce2('0x23')](saveUpdates(_0x27027c['body'],null))[_0xfce2('0x23')](respondWithResult(_0xaeaab5,null))[_0xfce2('0x3f')](handleError(_0xaeaab5,null));};exports[_0xfce2('0x24')]=function(_0x270a73,_0x5e571a){return db['Campaign'][_0xfce2('0x45')]({'where':{'id':_0x270a73[_0xfce2('0x41')]['id']}})['then'](handleEntityNotFound(_0x5e571a,null))[_0xfce2('0x23')](removeEntity(_0x5e571a,null))['catch'](handleError(_0x5e571a,null));};exports[_0xfce2('0x54')]=function(_0x2c6131,_0x52605b,_0x457ca4){var _0xf55475={'raw':!![],'where':{}};var _0x2960c8={};var _0x4783a4={'count':0x0,'rows':[]};return db[_0xfce2('0x2c')][_0xfce2('0x55')]({'where':{'id':_0x2c6131[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](handleEntityNotFound(_0x52605b,null))[_0xfce2('0x23')](function(_0x5abd7b){if(_0x5abd7b){_0x2960c8[_0xfce2('0x2f')]=_[_0xfce2('0x42')](db[_0xfce2('0x56')]['rawAttributes']);_0x2960c8[_0xfce2('0x30')]=_[_0xfce2('0x42')](_0x2c6131[_0xfce2('0x30')]);_0x2960c8[_0xfce2('0x31')]=_[_0xfce2('0x32')](_0x2960c8[_0xfce2('0x2f')],_0x2960c8[_0xfce2('0x30')]);_0xf55475[_0xfce2('0x34')]=_[_0xfce2('0x32')](_0x2960c8[_0xfce2('0x2f')],qs[_0xfce2('0x33')](_0x2c6131[_0xfce2('0x30')]['fields']));_0xf55475['attributes']=_0xf55475[_0xfce2('0x34')][_0xfce2('0x57')]?_0xf55475[_0xfce2('0x34')]:_0x2960c8[_0xfce2('0x2f')];if(!_0x2c6131[_0xfce2('0x30')][_0xfce2('0x58')]('nolimit')){_0xf55475[_0xfce2('0x1c')]=qs[_0xfce2('0x1c')](_0x2c6131[_0xfce2('0x30')][_0xfce2('0x1c')]);_0xf55475[_0xfce2('0x1e')]=qs['offset'](_0x2c6131[_0xfce2('0x30')][_0xfce2('0x1e')]);}_0xf55475[_0xfce2('0x36')]=qs[_0xfce2('0x37')](_0x2c6131[_0xfce2('0x30')][_0xfce2('0x37')]);_0xf55475[_0xfce2('0x39')]=qs[_0xfce2('0x31')](_['pick'](_0x2c6131['query'],_0x2960c8[_0xfce2('0x31')]));_0xf55475[_0xfce2('0x39')][_0xfce2('0x59')]=_0x5abd7b['id'];if(_0x2c6131[_0xfce2('0x30')][_0xfce2('0x38')]){_0xf55475[_0xfce2('0x39')]=_[_0xfce2('0x3b')](_0xf55475[_0xfce2('0x39')],{'$or':_[_0xfce2('0x2b')](_0xf55475[_0xfce2('0x34')],function(_0x4e3e10){var _0x3ed5a0={};_0x3ed5a0[_0x4e3e10]={'$like':'%'+_0x2c6131['query']['filter']+'%'};return _0x3ed5a0;})});}_0xf55475=_['merge']({},_0xf55475,_0x2c6131[_0xfce2('0x44')]);return db[_0xfce2('0x56')][_0xfce2('0x1d')]({'where':_0xf55475[_0xfce2('0x39')]})[_0xfce2('0x23')](function(_0x4312b8){_0x4783a4[_0xfce2('0x1d')]=_0x4312b8;if(_0x2c6131[_0xfce2('0x30')][_0xfce2('0x3c')]){_0xf55475[_0xfce2('0x3d')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xf55475);})['then'](function(_0x18fb08){_0x4783a4['rows']=_0x18fb08;return _0x4783a4;});}})[_0xfce2('0x23')](respondWithFilteredResult(_0x52605b,_0xf55475))[_0xfce2('0x3f')](handleError(_0x52605b,null));};exports['getHopperHistories']=function(_0x1ecb8d,_0x38040c,_0x53bb66){var _0x279d9a={'raw':!![],'where':{}};var _0x3d0f85={};var _0x3fb980={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x1ecb8d[_0xfce2('0x41')]['id']}})['then'](handleEntityNotFound(_0x38040c,null))[_0xfce2('0x23')](function(_0x4c1cd8){if(_0x4c1cd8){_0x3d0f85[_0xfce2('0x2f')]=_['keys'](db[_0xfce2('0x5a')]['rawAttributes']);_0x3d0f85[_0xfce2('0x30')]=_[_0xfce2('0x42')](_0x1ecb8d[_0xfce2('0x30')]);_0x3d0f85[_0xfce2('0x31')]=_[_0xfce2('0x32')](_0x3d0f85[_0xfce2('0x2f')],_0x3d0f85[_0xfce2('0x30')]);_0x279d9a[_0xfce2('0x34')]=_['intersection'](_0x3d0f85[_0xfce2('0x2f')],qs[_0xfce2('0x33')](_0x1ecb8d[_0xfce2('0x30')][_0xfce2('0x33')]));_0x279d9a[_0xfce2('0x34')]=_0x279d9a[_0xfce2('0x34')][_0xfce2('0x57')]?_0x279d9a[_0xfce2('0x34')]:_0x3d0f85['model'];if(!_0x1ecb8d[_0xfce2('0x30')]['hasOwnProperty'](_0xfce2('0x35'))){_0x279d9a['limit']=qs[_0xfce2('0x1c')](_0x1ecb8d[_0xfce2('0x30')]['limit']);_0x279d9a[_0xfce2('0x1e')]=qs['offset'](_0x1ecb8d[_0xfce2('0x30')]['offset']);}_0x279d9a[_0xfce2('0x36')]=qs['sort'](_0x1ecb8d[_0xfce2('0x30')]['sort']);_0x279d9a[_0xfce2('0x39')]=qs['filters'](_[_0xfce2('0x5b')](_0x1ecb8d[_0xfce2('0x30')],_0x3d0f85[_0xfce2('0x31')]));_0x279d9a['where']['CampaignId']=_0x4c1cd8['id'];if(_0x1ecb8d[_0xfce2('0x30')]['filter']){_0x279d9a[_0xfce2('0x39')]=_[_0xfce2('0x3b')](_0x279d9a[_0xfce2('0x39')],{'$or':_['map'](_0x279d9a[_0xfce2('0x34')],function(_0x45a5b7){var _0x3abf0b={};_0x3abf0b[_0x45a5b7]={'$like':'%'+_0x1ecb8d[_0xfce2('0x30')][_0xfce2('0x38')]+'%'};return _0x3abf0b;})});}_0x279d9a=_[_0xfce2('0x3b')]({},_0x279d9a,_0x1ecb8d['options']);return db['CmHopperHistory']['count']({'where':_0x279d9a['where']})[_0xfce2('0x23')](function(_0x16a6f0){_0x3fb980[_0xfce2('0x1d')]=_0x16a6f0;if(_0x1ecb8d['query'][_0xfce2('0x3c')]){_0x279d9a[_0xfce2('0x3d')]=[{'all':!![]}];}return db[_0xfce2('0x5a')][_0xfce2('0x5c')](_0x279d9a);})[_0xfce2('0x23')](function(_0x2042b1){_0x3fb980[_0xfce2('0x3e')]=_0x2042b1;return _0x3fb980;});}})[_0xfce2('0x23')](respondWithFilteredResult(_0x38040c,_0x279d9a))[_0xfce2('0x3f')](handleError(_0x38040c,null));};exports['getHopperFinals']=function(_0x211219,_0x224d14,_0x5da57a){var _0x439b22={'raw':!![],'where':{}};var _0x4279fc={};var _0x3ecc30={'count':0x0,'rows':[]};return db[_0xfce2('0x2c')][_0xfce2('0x55')]({'where':{'id':_0x211219[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](handleEntityNotFound(_0x224d14,null))['then'](function(_0x4b6980){if(_0x4b6980){_0x4279fc[_0xfce2('0x2f')]=_[_0xfce2('0x42')](db['CmHopperFinal'][_0xfce2('0x43')]);_0x4279fc[_0xfce2('0x30')]=_[_0xfce2('0x42')](_0x211219[_0xfce2('0x30')]);_0x4279fc['filters']=_['intersection'](_0x4279fc[_0xfce2('0x2f')],_0x4279fc[_0xfce2('0x30')]);_0x439b22[_0xfce2('0x34')]=_[_0xfce2('0x32')](_0x4279fc['model'],qs[_0xfce2('0x33')](_0x211219['query']['fields']));_0x439b22[_0xfce2('0x34')]=_0x439b22[_0xfce2('0x34')][_0xfce2('0x57')]?_0x439b22[_0xfce2('0x34')]:_0x4279fc[_0xfce2('0x2f')];if(!_0x211219[_0xfce2('0x30')][_0xfce2('0x58')](_0xfce2('0x35'))){_0x439b22[_0xfce2('0x1c')]=qs[_0xfce2('0x1c')](_0x211219['query'][_0xfce2('0x1c')]);_0x439b22['offset']=qs[_0xfce2('0x1e')](_0x211219[_0xfce2('0x30')][_0xfce2('0x1e')]);}_0x439b22[_0xfce2('0x36')]=qs['sort'](_0x211219['query']['sort']);_0x439b22[_0xfce2('0x39')]=qs[_0xfce2('0x31')](_['pick'](_0x211219[_0xfce2('0x30')],_0x4279fc[_0xfce2('0x31')]));_0x439b22[_0xfce2('0x39')]['CampaignId']=_0x4b6980['id'];if(_0x211219[_0xfce2('0x30')][_0xfce2('0x38')]){_0x439b22['where']=_['merge'](_0x439b22['where'],{'$or':_[_0xfce2('0x2b')](_0x439b22['attributes'],function(_0x476eb8){var _0xd34078={};_0xd34078[_0x476eb8]={'$like':'%'+_0x211219['query'][_0xfce2('0x38')]+'%'};return _0xd34078;})});}_0x439b22=_[_0xfce2('0x3b')]({},_0x439b22,_0x211219['options']);return db[_0xfce2('0x5d')][_0xfce2('0x1d')]({'where':_0x439b22[_0xfce2('0x39')]})['then'](function(_0x4a8660){_0x3ecc30[_0xfce2('0x1d')]=_0x4a8660;if(_0x211219['query'][_0xfce2('0x3c')]){_0x439b22[_0xfce2('0x3d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xfce2('0x5c')](_0x439b22);})['then'](function(_0x1efff7){_0x3ecc30['rows']=_0x1efff7;return _0x3ecc30;});}})[_0xfce2('0x23')](respondWithFilteredResult(_0x224d14,_0x439b22))[_0xfce2('0x3f')](handleError(_0x224d14,null));};exports[_0xfce2('0x5e')]=function(_0x486911,_0x19be6a,_0xe396fc){var _0x290ba0={'raw':!![],'where':{}};var _0x55f34e={};var _0x1809d4={'count':0x0,'rows':[]};return db[_0xfce2('0x2c')][_0xfce2('0x55')]({'where':{'id':_0x486911[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](handleEntityNotFound(_0x19be6a,null))[_0xfce2('0x23')](function(_0x5daed7){if(_0x5daed7){_0x55f34e['model']=_['keys'](db[_0xfce2('0x5f')][_0xfce2('0x43')]);_0x55f34e[_0xfce2('0x30')]=_[_0xfce2('0x42')](_0x486911[_0xfce2('0x30')]);_0x55f34e['filters']=_[_0xfce2('0x32')](_0x55f34e[_0xfce2('0x2f')],_0x55f34e[_0xfce2('0x30')]);_0x290ba0[_0xfce2('0x34')]=_[_0xfce2('0x32')](_0x55f34e[_0xfce2('0x2f')],qs[_0xfce2('0x33')](_0x486911[_0xfce2('0x30')]['fields']));_0x290ba0[_0xfce2('0x34')]=_0x290ba0['attributes'][_0xfce2('0x57')]?_0x290ba0['attributes']:_0x55f34e[_0xfce2('0x2f')];if(!_0x486911[_0xfce2('0x30')][_0xfce2('0x58')](_0xfce2('0x35'))){_0x290ba0['limit']=qs[_0xfce2('0x1c')](_0x486911[_0xfce2('0x30')][_0xfce2('0x1c')]);_0x290ba0[_0xfce2('0x1e')]=qs[_0xfce2('0x1e')](_0x486911[_0xfce2('0x30')][_0xfce2('0x1e')]);}_0x290ba0['order']=qs[_0xfce2('0x37')](_0x486911['query'][_0xfce2('0x37')]);_0x290ba0['where']=qs[_0xfce2('0x31')](_['pick'](_0x486911[_0xfce2('0x30')],_0x55f34e[_0xfce2('0x31')]));_0x290ba0[_0xfce2('0x39')]['CampaignId']=_0x5daed7['id'];if(_0x486911['query'][_0xfce2('0x38')]){_0x290ba0[_0xfce2('0x39')]=_['merge'](_0x290ba0[_0xfce2('0x39')],{'$or':_['map'](_0x290ba0[_0xfce2('0x34')],function(_0x1e71de){var _0x1ba17e={};_0x1ba17e[_0x1e71de]={'$like':'%'+_0x486911[_0xfce2('0x30')][_0xfce2('0x38')]+'%'};return _0x1ba17e;})});}_0x290ba0=_[_0xfce2('0x3b')]({},_0x290ba0,_0x486911[_0xfce2('0x44')]);return db['CmHopperBlack']['count']({'where':_0x290ba0[_0xfce2('0x39')]})[_0xfce2('0x23')](function(_0x13d2d2){_0x1809d4[_0xfce2('0x1d')]=_0x13d2d2;if(_0x486911[_0xfce2('0x30')]['includeAll']){_0x290ba0[_0xfce2('0x3d')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x290ba0);})[_0xfce2('0x23')](function(_0x3e351e){_0x1809d4[_0xfce2('0x3e')]=_0x3e351e;return _0x1809d4;});}})[_0xfce2('0x23')](respondWithFilteredResult(_0x19be6a,_0x290ba0))['catch'](handleError(_0x19be6a,null));};exports[_0xfce2('0x60')]=function(_0xa3128a,_0x307403,_0x4237d0){var _0x27bba5={};var _0x362aaa={};var _0x39f6d4;var _0x4a39bc;return db[_0xfce2('0x2c')][_0xfce2('0x55')]({'where':{'id':_0xa3128a[_0xfce2('0x41')]['id']}})['then'](handleEntityNotFound(_0x307403,null))[_0xfce2('0x23')](function(_0x6fe993){if(_0x6fe993){_0x39f6d4=_0x6fe993;_0x362aaa[_0xfce2('0x2f')]=_[_0xfce2('0x42')](db[_0xfce2('0x61')][_0xfce2('0x43')]);_0x362aaa[_0xfce2('0x30')]=_[_0xfce2('0x42')](_0xa3128a[_0xfce2('0x30')]);_0x362aaa[_0xfce2('0x31')]=_[_0xfce2('0x32')](_0x362aaa[_0xfce2('0x2f')],_0x362aaa[_0xfce2('0x30')]);_0x27bba5['attributes']=_['intersection'](_0x362aaa[_0xfce2('0x2f')],qs[_0xfce2('0x33')](_0xa3128a['query']['fields']));_0x27bba5[_0xfce2('0x34')]=_0x27bba5[_0xfce2('0x34')][_0xfce2('0x57')]?_0x27bba5[_0xfce2('0x34')]:_0x362aaa[_0xfce2('0x2f')];_0x27bba5[_0xfce2('0x36')]=qs[_0xfce2('0x37')](_0xa3128a[_0xfce2('0x30')][_0xfce2('0x37')]);_0x27bba5[_0xfce2('0x39')]=qs[_0xfce2('0x31')](_[_0xfce2('0x5b')](_0xa3128a[_0xfce2('0x30')],_0x362aaa['filters']));if(_0xa3128a[_0xfce2('0x30')][_0xfce2('0x38')]){_0x27bba5[_0xfce2('0x39')]=_[_0xfce2('0x3b')](_0x27bba5[_0xfce2('0x39')],{'$or':_[_0xfce2('0x2b')](_0x27bba5[_0xfce2('0x34')],function(_0x5d90c6){var _0x29e5ed={};_0x29e5ed[_0x5d90c6]={'$like':'%'+_0xa3128a[_0xfce2('0x30')]['filter']+'%'};return _0x29e5ed;})});}_0x27bba5=_['merge']({},_0x27bba5,_0xa3128a[_0xfce2('0x44')]);return _0x39f6d4[_0xfce2('0x60')](_0x27bba5);}})[_0xfce2('0x23')](function(_0x58b095){if(_0x58b095){_0x4a39bc=_0x58b095[_0xfce2('0x57')];if(!_0xa3128a['query'][_0xfce2('0x58')](_0xfce2('0x35'))){_0x27bba5[_0xfce2('0x1c')]=qs[_0xfce2('0x1c')](_0xa3128a[_0xfce2('0x30')][_0xfce2('0x1c')]);_0x27bba5[_0xfce2('0x1e')]=qs[_0xfce2('0x1e')](_0xa3128a['query'][_0xfce2('0x1e')]);}return _0x39f6d4[_0xfce2('0x60')](_0x27bba5);}})[_0xfce2('0x23')](function(_0x27c9ed){if(_0x27c9ed){return _0x27c9ed?{'count':_0x4a39bc,'rows':_0x27c9ed}:null;}})[_0xfce2('0x23')](respondWithResult(_0x307403,null))[_0xfce2('0x3f')](handleError(_0x307403,null));};exports[_0xfce2('0x62')]=function(_0x1defe4,_0x18239a,_0x42e152){var _0x55c743,_0x1942ae;var _0x3997d3=[];var _0xe2234=moment()['format'](_0xfce2('0x63'));return db['Campaign'][_0xfce2('0x45')]({'where':{'id':_0x1defe4[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](handleEntityNotFound(_0x18239a,null))[_0xfce2('0x23')](function(_0x27fd4d){if(_0x27fd4d){_0x1942ae=_0x27fd4d;return _0x27fd4d['addLists'](_0x1defe4[_0xfce2('0x46')][_0xfce2('0x64')],_['omit'](_0x1defe4[_0xfce2('0x46')],[_0xfce2('0x64'),'id'])||{});}return null;})[_0xfce2('0x65')](function(_0x2177bb){var _0x40a812;var _0x41962d;_0x55c743=_0x2177bb||[];var _0x2014c2=[];if(_0x2177bb){for(var _0x2bf272=0x0;_0x2bf272<_0x2177bb[_0xfce2('0x57')];_0x2bf272+=0x1){var _0x4f9441=_0x2177bb[_0x2bf272][_0xfce2('0x25')]({'plain':!![]});_0x1942ae[_0xfce2('0x66')]=_0x1defe4[_0xfce2('0x46')][_0xfce2('0x66')]?_0x1defe4['body'][_0xfce2('0x66')]:_0x1942ae[_0xfce2('0x66')];switch(_0x1942ae['dialCheckDuplicateType']){case _0xfce2('0x67'):_0x40a812=squel[_0xfce2('0x68')]()[_0xfce2('0x69')](_0xfce2('0x6a'))[_0xfce2('0x6b')](['phone','scheduledAt',_0xfce2('0x6c'),_0xfce2('0x6d'),'CampaignId',_0xfce2('0x50'),_0xfce2('0x51')],squel[_0xfce2('0x6e')]()[_0xfce2('0x6f')](_0xfce2('0x70'),_0xfce2('0x70'))['field'](_0xfce2('0x71'),'scheduledAt')[_0xfce2('0x6f')]('id',_0xfce2('0x6c'))[_0xfce2('0x6f')](_0x4f9441[_0xfce2('0x72')]['toString'](),'ListId')[_0xfce2('0x6f')](_0x1defe4[_0xfce2('0x41')]['id'][_0xfce2('0x73')](),_0xfce2('0x59'))[_0xfce2('0x6f')]('\x27'+_0xe2234+'\x27','createdAt')[_0xfce2('0x6f')]('\x27'+_0xe2234+'\x27',_0xfce2('0x51'))['from'](_0xfce2('0x74'))['where']('deletedAt\x20IS\x20NULL')[_0xfce2('0x39')]('ListId\x20=\x20?',_0x4f9441['CmListId'][_0xfce2('0x73')]())[_0xfce2('0x39')](_0xfce2('0x75'))[_0xfce2('0x39')](_0xfce2('0x76'),squel[_0xfce2('0x6e')]()[_0xfce2('0x6f')](_0xfce2('0x77'))[_0xfce2('0x78')]('cm_hopper_final')[_0xfce2('0x39')](_0xfce2('0x79'),_0x1defe4['params']['id'][_0xfce2('0x73')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xfce2('0x6f')](_0xfce2('0x7a'))[_0xfce2('0x78')](_0xfce2('0x6a'))[_0xfce2('0x39')](_0xfce2('0x79'),_0x1defe4[_0xfce2('0x41')]['id'][_0xfce2('0x73')]())))['toString']();break;case _0xfce2('0x7b'):_0x40a812=squel[_0xfce2('0x68')]()['into'](_0xfce2('0x6a'))[_0xfce2('0x6b')]([_0xfce2('0x70'),_0xfce2('0x7c'),_0xfce2('0x6c'),_0xfce2('0x6d'),'CampaignId',_0xfce2('0x50'),_0xfce2('0x51')],squel[_0xfce2('0x6e')]()[_0xfce2('0x6f')](_0xfce2('0x70'),_0xfce2('0x70'))['field'](_0xfce2('0x71'),_0xfce2('0x7c'))[_0xfce2('0x6f')]('id','ContactId')[_0xfce2('0x6f')](_0x4f9441[_0xfce2('0x72')][_0xfce2('0x73')](),'ListId')[_0xfce2('0x6f')](_0x1defe4[_0xfce2('0x41')]['id'][_0xfce2('0x73')](),_0xfce2('0x59'))[_0xfce2('0x6f')]('\x27'+_0xe2234+'\x27',_0xfce2('0x50'))['field']('\x27'+_0xe2234+'\x27',_0xfce2('0x51'))[_0xfce2('0x78')](_0xfce2('0x74'))[_0xfce2('0x39')](_0xfce2('0x7d'))[_0xfce2('0x39')](_0xfce2('0x7e'),_0x4f9441[_0xfce2('0x72')][_0xfce2('0x73')]())[_0xfce2('0x39')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xfce2('0x76'),squel[_0xfce2('0x6e')]()[_0xfce2('0x6f')]('COALESCE(phone,\x27\x27)')[_0xfce2('0x78')](_0xfce2('0x6a'))[_0xfce2('0x39')](_0xfce2('0x79'),_0x1defe4['params']['id']['toString']())))[_0xfce2('0x73')]();break;default:_0x40a812=squel['insert']()[_0xfce2('0x69')](_0xfce2('0x6a'))['fromQuery']([_0xfce2('0x70'),_0xfce2('0x7c'),_0xfce2('0x6c'),_0xfce2('0x6d'),_0xfce2('0x59'),_0xfce2('0x50'),'updatedAt'],squel[_0xfce2('0x6e')]()[_0xfce2('0x6f')](_0xfce2('0x70'),'phone')['field'](_0xfce2('0x71'),'scheduledAt')[_0xfce2('0x6f')]('id',_0xfce2('0x6c'))[_0xfce2('0x6f')](_0x4f9441[_0xfce2('0x72')]['toString'](),_0xfce2('0x6d'))[_0xfce2('0x6f')](_0x1defe4[_0xfce2('0x41')]['id'][_0xfce2('0x73')](),_0xfce2('0x59'))[_0xfce2('0x6f')]('\x27'+_0xe2234+'\x27',_0xfce2('0x50'))[_0xfce2('0x6f')]('\x27'+_0xe2234+'\x27',_0xfce2('0x51'))[_0xfce2('0x78')]('cm_contacts')['where'](_0xfce2('0x7d'))['where']('ListId\x20=\x20?',_0x4f9441[_0xfce2('0x72')]['toString']())[_0xfce2('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xfce2('0x73')]();}_0x41962d=squel[_0xfce2('0x68')]()[_0xfce2('0x69')]('cm_hopper_additional_phones')[_0xfce2('0x6b')](['cmHopperId',_0xfce2('0x7c'),_0xfce2('0x70'),_0xfce2('0x7f'),_0xfce2('0x50'),'updatedAt'],squel['select']()['field'](_0xfce2('0x80'),'id')[_0xfce2('0x6f')](_0xfce2('0x71'),'scheduledAt')['field'](_0xfce2('0x81'),_0xfce2('0x70'))[_0xfce2('0x6f')](_0xfce2('0x82'),_0xfce2('0x7f'))[_0xfce2('0x6f')]('\x27'+_0xe2234+'\x27',_0xfce2('0x50'))[_0xfce2('0x6f')]('\x27'+_0xe2234+'\x27','updatedAt')[_0xfce2('0x78')](_0xfce2('0x83'),'ci')[_0xfce2('0x84')](_0xfce2('0x6a'),'h',_0xfce2('0x85'))[_0xfce2('0x39')](_0xfce2('0x86'),_0x4f9441[_0xfce2('0x72')]['toString']())[_0xfce2('0x39')](_0xfce2('0x87'),_0x1defe4[_0xfce2('0x41')]['id']['toString']())[_0xfce2('0x39')](_0xfce2('0x88'),_0xe2234))[_0xfce2('0x73')]();_0x2014c2[_0xfce2('0x89')](db[_0xfce2('0x8a')][_0xfce2('0x30')](_0x40a812));_0x3997d3['push'](db[_0xfce2('0x8a')]['query'](_0x41962d));}return BPromise[_0xfce2('0x8b')](_0x2014c2);}})[_0xfce2('0x23')](function(){return BPromise[_0xfce2('0x8b')](_0x3997d3);})['then'](function(){return _0x55c743;})[_0xfce2('0x23')](respondWithResult(_0x18239a,null))[_0xfce2('0x3f')](handleError(_0x18239a,null));};exports['removeLists']=function(_0x410ad7,_0xe0dbb7,_0x427a23){return db[_0xfce2('0x2c')]['find']({'where':{'id':_0x410ad7[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](handleEntityNotFound(_0xe0dbb7,null))[_0xfce2('0x23')](function(_0x10e68f){if(_0x10e68f){return _0x10e68f['removeLists'](_0x410ad7[_0xfce2('0x30')][_0xfce2('0x64')]);}})[_0xfce2('0x23')](function(_0x24a264){if(_0x24a264){return db[_0xfce2('0x56')]['destroy']({'where':{'ListId':_0x410ad7['query'][_0xfce2('0x64')],'CampaignId':_0x410ad7[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](function(){return _0x24a264;});}})[_0xfce2('0x23')](respondWithStatusCode(_0xe0dbb7,null))[_0xfce2('0x3f')](handleError(_0xe0dbb7,null));};exports[_0xfce2('0x8c')]=function(_0x4e8c09,_0x1319b2,_0x5b0823){var _0x50e0e0={};var _0x4c60ee={};var _0x313a32;var _0x439a2d;return db['Campaign'][_0xfce2('0x55')]({'where':{'id':_0x4e8c09[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](handleEntityNotFound(_0x1319b2,null))[_0xfce2('0x23')](function(_0x334079){if(_0x334079){_0x313a32=_0x334079;_0x4c60ee[_0xfce2('0x2f')]=_[_0xfce2('0x42')](db[_0xfce2('0x61')][_0xfce2('0x43')]);_0x4c60ee['query']=_[_0xfce2('0x42')](_0x4e8c09[_0xfce2('0x30')]);_0x4c60ee[_0xfce2('0x31')]=_[_0xfce2('0x32')](_0x4c60ee[_0xfce2('0x2f')],_0x4c60ee[_0xfce2('0x30')]);_0x50e0e0[_0xfce2('0x34')]=_[_0xfce2('0x32')](_0x4c60ee[_0xfce2('0x2f')],qs[_0xfce2('0x33')](_0x4e8c09[_0xfce2('0x30')]['fields']));_0x50e0e0[_0xfce2('0x34')]=_0x50e0e0[_0xfce2('0x34')][_0xfce2('0x57')]?_0x50e0e0['attributes']:_0x4c60ee[_0xfce2('0x2f')];_0x50e0e0[_0xfce2('0x36')]=qs[_0xfce2('0x37')](_0x4e8c09[_0xfce2('0x30')][_0xfce2('0x37')]);_0x50e0e0['where']=qs[_0xfce2('0x31')](_[_0xfce2('0x5b')](_0x4e8c09['query'],_0x4c60ee[_0xfce2('0x31')]));if(_0x4e8c09[_0xfce2('0x30')]['filter']){_0x50e0e0['where']=_['merge'](_0x50e0e0[_0xfce2('0x39')],{'$or':_[_0xfce2('0x2b')](_0x50e0e0[_0xfce2('0x34')],function(_0x1d163e){var _0x591b15={};_0x591b15[_0x1d163e]={'$like':'%'+_0x4e8c09[_0xfce2('0x30')][_0xfce2('0x38')]+'%'};return _0x591b15;})});}_0x50e0e0=_['merge']({},_0x50e0e0,_0x4e8c09[_0xfce2('0x44')]);return _0x313a32[_0xfce2('0x8c')](_0x50e0e0);}})[_0xfce2('0x23')](function(_0xc1df00){if(_0xc1df00){_0x439a2d=_0xc1df00[_0xfce2('0x57')];if(!_0x4e8c09['query'][_0xfce2('0x58')](_0xfce2('0x35'))){_0x50e0e0['limit']=qs[_0xfce2('0x1c')](_0x4e8c09[_0xfce2('0x30')]['limit']);_0x50e0e0[_0xfce2('0x1e')]=qs[_0xfce2('0x1e')](_0x4e8c09['query'][_0xfce2('0x1e')]);}return _0x313a32['getBlackLists'](_0x50e0e0);}})[_0xfce2('0x23')](function(_0x447029){if(_0x447029){return _0x447029?{'count':_0x439a2d,'rows':_0x447029}:null;}})['then'](respondWithResult(_0x1319b2,null))['catch'](handleError(_0x1319b2,null));};exports[_0xfce2('0x8d')]=function(_0x5cb503,_0x5cf2a8,_0x30517e){var _0x3a91d3,_0x2d5628;var _0x594d5c=[];var _0x4b180f=moment()['format'](_0xfce2('0x63'));return db[_0xfce2('0x2c')]['find']({'where':{'id':_0x5cb503[_0xfce2('0x41')]['id']}})['then'](handleEntityNotFound(_0x5cf2a8,null))[_0xfce2('0x23')](function(_0x117586){if(_0x117586){_0x2d5628=_0x117586;return _0x117586[_0xfce2('0x8d')](_0x5cb503[_0xfce2('0x46')]['ids'],_[_0xfce2('0x4f')](_0x5cb503[_0xfce2('0x46')],[_0xfce2('0x64'),'id'])||{});}return null;})['spread'](function(_0x2505b0){var _0x425438;var _0x1fe7f5;_0x3a91d3=_0x2505b0||[];var _0x77cde0=[];if(_0x2505b0){for(var _0x53c639=0x0;_0x53c639<_0x2505b0[_0xfce2('0x57')];_0x53c639+=0x1){var _0x1108e3=_0x2505b0[_0x53c639][_0xfce2('0x25')]({'plain':!![]});_0x425438=squel[_0xfce2('0x68')]()['into'](_0xfce2('0x8e'))['fromQuery']([_0xfce2('0x70'),'ContactId',_0xfce2('0x6d'),'CampaignId',_0xfce2('0x50'),'updatedAt'],squel[_0xfce2('0x6e')]()[_0xfce2('0x6f')](_0xfce2('0x70'),_0xfce2('0x70'))[_0xfce2('0x6f')]('id',_0xfce2('0x6c'))[_0xfce2('0x6f')](_0x1108e3[_0xfce2('0x72')]['toString'](),_0xfce2('0x6d'))[_0xfce2('0x6f')](_0x5cb503['params']['id']['toString'](),_0xfce2('0x59'))[_0xfce2('0x6f')]('NOW()','createdAt')[_0xfce2('0x6f')](_0xfce2('0x71'),'updatedAt')['from']('cm_contacts')[_0xfce2('0x39')](_0xfce2('0x7d'))[_0xfce2('0x39')](_0xfce2('0x7e'),_0x1108e3[_0xfce2('0x72')][_0xfce2('0x73')]())[_0xfce2('0x39')](_0xfce2('0x75')))[_0xfce2('0x73')]();_0x77cde0[_0xfce2('0x89')](db[_0xfce2('0x8a')]['query'](_0x425438));}return BPromise[_0xfce2('0x8b')](_0x77cde0);}})[_0xfce2('0x23')](function(){return _0x3a91d3;})[_0xfce2('0x23')](respondWithResult(_0x5cf2a8,null))[_0xfce2('0x3f')](handleError(_0x5cf2a8,null));};exports['removeBlackLists']=function(_0xb90b71,_0x156528,_0x1dd5e5){return db[_0xfce2('0x2c')][_0xfce2('0x45')]({'where':{'id':_0xb90b71[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](handleEntityNotFound(_0x156528,null))[_0xfce2('0x23')](function(_0xf9b381){if(_0xf9b381){return _0xf9b381[_0xfce2('0x8f')](_0xb90b71[_0xfce2('0x30')]['ids']);}})[_0xfce2('0x23')](function(_0x14b4ab){if(_0x14b4ab){return db[_0xfce2('0x5f')][_0xfce2('0x24')]({'where':{'ListId':_0xb90b71[_0xfce2('0x30')]['ids'],'CampaignId':_0xb90b71[_0xfce2('0x41')]['id']}})[_0xfce2('0x23')](function(){return _0x14b4ab;});}})[_0xfce2('0x23')](respondWithStatusCode(_0x156528,null))[_0xfce2('0x3f')](handleError(_0x156528,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7af845c..1b04d62 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(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2c341e,_0x414d11){var _0x43c1e8=function(_0xe783f3){while(--_0xe783f3){_0x2c341e['push'](_0x2c341e['shift']());}};_0x43c1e8(++_0x414d11);}(_0x7a54,0x106));var _0x47a5=function(_0x6c8a75,_0x21879b){_0x6c8a75=_0x6c8a75-0x0;var _0x378714=_0x7a54[_0x6c8a75];return _0x378714;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 3aebb79..5c49078 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 _0xce25=['code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error'];(function(_0x3ab4bb,_0x4568e8){var _0x46aa87=function(_0xcc43bf){while(--_0xcc43bf){_0x3ab4bb['push'](_0x3ab4bb['shift']());}};_0x46aa87(++_0x4568e8);}(_0xce25,0x196));var _0x5ce2=function(_0x238020,_0x3fa739){_0x238020=_0x238020-0x0;var _0x550533=_0xce25[_0x238020];return _0x550533;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ce2('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ce2('0x1'))['db'];var utils=require(_0x5ce2('0x2'));var logger=require('../../config/logger')(_0x5ce2('0x3'));var config=require(_0x5ce2('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5ce2('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x417149,_0x1ab2e7,_0xcb80ee){return new BPromise(function(_0x4a57a6,_0x2ccf81){return client[_0x5ce2('0x6')](_0x417149,_0xcb80ee)[_0x5ce2('0x7')](function(_0x49ede4){logger[_0x5ce2('0x8')](_0x5ce2('0x9'),_0x1ab2e7,_0x5ce2('0xa'));logger[_0x5ce2('0xb')](_0x5ce2('0xc'),_0x1ab2e7,_0x5ce2('0xa'),JSON['stringify'](_0x49ede4));if(_0x49ede4[_0x5ce2('0xd')]){if(_0x49ede4['error'][_0x5ce2('0xe')]===0x1f4){logger[_0x5ce2('0xd')]('Campaign,\x20%s,\x20%s',_0x1ab2e7,_0x49ede4['error']['message']);return _0x2ccf81(_0x49ede4['error'][_0x5ce2('0xf')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x1ab2e7,_0x49ede4[_0x5ce2('0xd')]['message']);return _0x4a57a6(_0x49ede4[_0x5ce2('0xd')][_0x5ce2('0xf')]);}else{logger[_0x5ce2('0x8')]('Campaign,\x20%s,\x20%s',_0x1ab2e7,_0x5ce2('0xa'));_0x4a57a6(_0x49ede4[_0x5ce2('0x10')][_0x5ce2('0xf')]);}})['catch'](function(_0x4b89d3){logger[_0x5ce2('0xd')](_0x5ce2('0x9'),_0x1ab2e7,_0x4b89d3);_0x2ccf81(_0x4b89d3);});});}exports[_0x5ce2('0x11')]=function(_0x5369e7){var _0x19915d=this;return new Promise(function(_0x30cb39,_0x3dd57a){return db[_0x5ce2('0x12')][_0x5ce2('0x13')]({'raw':_0x5369e7[_0x5ce2('0x14')]?_0x5369e7[_0x5ce2('0x14')][_0x5ce2('0x15')]===undefined?!![]:![]:!![],'where':_0x5369e7[_0x5ce2('0x14')]?_0x5369e7[_0x5ce2('0x14')][_0x5ce2('0x16')]||null:null,'attributes':_0x5369e7[_0x5ce2('0x14')]?_0x5369e7[_0x5ce2('0x14')][_0x5ce2('0x17')]||null:null,'limit':_0x5369e7[_0x5ce2('0x14')]?_0x5369e7[_0x5ce2('0x14')][_0x5ce2('0x18')]||null:null,'include':_0x5369e7[_0x5ce2('0x14')]?_0x5369e7[_0x5ce2('0x14')]['include']?_['map'](_0x5369e7[_0x5ce2('0x14')][_0x5ce2('0x19')],function(_0x3440b5){return{'model':db[_0x3440b5['model']],'as':_0x3440b5['as'],'attributes':_0x3440b5['attributes'],'include':_0x3440b5[_0x5ce2('0x19')]?_[_0x5ce2('0x1a')](_0x3440b5['include'],function(_0x3008af){return{'model':db[_0x3008af[_0x5ce2('0x1b')]],'as':_0x3008af['as'],'attributes':_0x3008af[_0x5ce2('0x17')],'include':_0x3008af[_0x5ce2('0x19')]?_[_0x5ce2('0x1a')](_0x3008af[_0x5ce2('0x19')],function(_0x3a4bb9){return{'model':db[_0x3a4bb9[_0x5ce2('0x1b')]],'as':_0x3a4bb9['as'],'attributes':_0x3a4bb9[_0x5ce2('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5ce2('0x7')](function(_0x2f4ccd){logger[_0x5ce2('0x8')](_0x5ce2('0x11'),_0x5369e7);logger[_0x5ce2('0xb')](_0x5ce2('0x11'),_0x5369e7,JSON[_0x5ce2('0x1c')](_0x2f4ccd));_0x30cb39(_0x2f4ccd);})[_0x5ce2('0x1d')](function(_0x2898ae){logger[_0x5ce2('0xd')](_0x5ce2('0x11'),_0x2898ae[_0x5ce2('0xf')],_0x5369e7);_0x3dd57a(_0x19915d[_0x5ce2('0xd')](0x1f4,_0x2898ae[_0x5ce2('0xf')]));});});}; \ No newline at end of file +var _0x8d9b=['info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','attributes','include','map','model','debug','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','request','then'];(function(_0x57b58b,_0x59b61e){var _0x453a3a=function(_0x7b6f5e){while(--_0x7b6f5e){_0x57b58b['push'](_0x57b58b['shift']());}};_0x453a3a(++_0x59b61e);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var moment=require(_0xb8d9('0x2'));var BPromise=require(_0xb8d9('0x3'));var rs=require(_0xb8d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb8d9('0x5'));var logger=require('../../config/logger')(_0xb8d9('0x6'));var config=require(_0xb8d9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21c87d,_0x537b18,_0x53339b){return new BPromise(function(_0x4c2b8f,_0x13352e){return client[_0xb8d9('0x8')](_0x21c87d,_0x53339b)[_0xb8d9('0x9')](function(_0x2189b1){logger[_0xb8d9('0xa')](_0xb8d9('0xb'),_0x537b18,_0xb8d9('0xc'));logger['debug'](_0xb8d9('0xd'),_0x537b18,'request\x20sent',JSON[_0xb8d9('0xe')](_0x2189b1));if(_0x2189b1[_0xb8d9('0xf')]){if(_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x10')]===0x1f4){logger[_0xb8d9('0xf')](_0xb8d9('0xb'),_0x537b18,_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x11')]);return _0x13352e(_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x11')]);}logger[_0xb8d9('0xf')](_0xb8d9('0xb'),_0x537b18,_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x11')]);return _0x4c2b8f(_0x2189b1['error'][_0xb8d9('0x11')]);}else{logger[_0xb8d9('0xa')](_0xb8d9('0xb'),_0x537b18,_0xb8d9('0xc'));_0x4c2b8f(_0x2189b1[_0xb8d9('0x12')]['message']);}})['catch'](function(_0x5b7d5a){logger[_0xb8d9('0xf')](_0xb8d9('0xb'),_0x537b18,_0x5b7d5a);_0x13352e(_0x5b7d5a);});});}exports[_0xb8d9('0x13')]=function(_0x1183e4){var _0x4fec1e=this;return new Promise(function(_0x31b33f,_0x59b7f6){return db[_0xb8d9('0x14')][_0xb8d9('0x15')]({'raw':_0x1183e4[_0xb8d9('0x16')]?_0x1183e4[_0xb8d9('0x16')][_0xb8d9('0x17')]===undefined?!![]:![]:!![],'where':_0x1183e4['options']?_0x1183e4['options']['where']||null:null,'attributes':_0x1183e4[_0xb8d9('0x16')]?_0x1183e4[_0xb8d9('0x16')][_0xb8d9('0x18')]||null:null,'limit':_0x1183e4[_0xb8d9('0x16')]?_0x1183e4[_0xb8d9('0x16')]['limit']||null:null,'include':_0x1183e4[_0xb8d9('0x16')]?_0x1183e4[_0xb8d9('0x16')][_0xb8d9('0x19')]?_[_0xb8d9('0x1a')](_0x1183e4[_0xb8d9('0x16')][_0xb8d9('0x19')],function(_0x3f4b9d){return{'model':db[_0x3f4b9d[_0xb8d9('0x1b')]],'as':_0x3f4b9d['as'],'attributes':_0x3f4b9d[_0xb8d9('0x18')],'include':_0x3f4b9d[_0xb8d9('0x19')]?_['map'](_0x3f4b9d[_0xb8d9('0x19')],function(_0x49380d){return{'model':db[_0x49380d['model']],'as':_0x49380d['as'],'attributes':_0x49380d[_0xb8d9('0x18')],'include':_0x49380d[_0xb8d9('0x19')]?_[_0xb8d9('0x1a')](_0x49380d[_0xb8d9('0x19')],function(_0x30b346){return{'model':db[_0x30b346['model']],'as':_0x30b346['as'],'attributes':_0x30b346[_0xb8d9('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb8d9('0x9')](function(_0x3111aa){logger['info'](_0xb8d9('0x13'),_0x1183e4);logger[_0xb8d9('0x1c')](_0xb8d9('0x13'),_0x1183e4,JSON['stringify'](_0x3111aa));_0x31b33f(_0x3111aa);})[_0xb8d9('0x1d')](function(_0x12a043){logger['error'](_0xb8d9('0x13'),_0x12a043[_0xb8d9('0x11')],_0x1183e4);_0x59b7f6(_0x4fec1e[_0xb8d9('0xf')](0x1f4,_0x12a043[_0xb8d9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 3d000d7..74ef8e6 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 _0x5119=['/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','addLists','put','/:id','update','destroy','removeLists','delete','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','isAuthenticated','show','get','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x19e785,_0x115ef1){var _0x5b4a67=function(_0x156346){while(--_0x156346){_0x19e785['push'](_0x19e785['shift']());}};_0x5b4a67(++_0x115ef1);}(_0x5119,0xc0));var _0x9511=function(_0x3b6d96,_0x5d3241){_0x3b6d96=_0x3b6d96-0x0;var _0x1e6b1c=_0x5119[_0x3b6d96];return _0x1e6b1c;};'use strict';var multer=require(_0x9511('0x0'));var util=require('util');var path=require(_0x9511('0x1'));var timeout=require(_0x9511('0x2'));var express=require(_0x9511('0x3'));var router=express[_0x9511('0x4')]();var fs_extra=require(_0x9511('0x5'));var auth=require(_0x9511('0x6'));var interaction=require(_0x9511('0x7'));var config=require(_0x9511('0x8'));var controller=require('./campaign.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9511('0x9')]);router['get']('/:id',auth[_0x9511('0xa')](),controller[_0x9511('0xb')]);router[_0x9511('0xc')](_0x9511('0xd'),auth[_0x9511('0xa')](),controller[_0x9511('0xe')]);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x9511('0xf')]);router[_0x9511('0xc')](_0x9511('0x10'),auth['isAuthenticated'](),controller[_0x9511('0x11')]);router[_0x9511('0xc')](_0x9511('0x12'),auth[_0x9511('0xa')](),controller[_0x9511('0x13')]);router[_0x9511('0xc')](_0x9511('0x14'),auth[_0x9511('0xa')](),controller['getLists']);router[_0x9511('0xc')](_0x9511('0x15'),auth[_0x9511('0xa')](),controller['getBlackLists']);router[_0x9511('0x16')]('/',auth['isAuthenticated'](),controller[_0x9511('0x17')]);router['post'](_0x9511('0x18'),auth[_0x9511('0xa')](),controller[_0x9511('0x19')]);router['post'](_0x9511('0x14'),auth[_0x9511('0xa')](),controller[_0x9511('0x1a')]);router[_0x9511('0x16')](_0x9511('0x15'),auth[_0x9511('0xa')](),controller['addBlackLists']);router[_0x9511('0x1b')](_0x9511('0x1c'),auth['isAuthenticated'](),controller[_0x9511('0x1d')]);router['delete']('/:id',auth[_0x9511('0xa')](),controller[_0x9511('0x1e')]);router['delete'](_0x9511('0x14'),auth[_0x9511('0xa')](),controller[_0x9511('0x1f')]);router[_0x9511('0x20')](_0x9511('0x15'),auth[_0x9511('0xa')](),controller[_0x9511('0x21')]);module[_0x9511('0x22')]=router; \ No newline at end of file +var _0xcd56=['put','/:id','update','delete','destroy','removeLists','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','create','clone','post','addLists','addBlackLists'];(function(_0x101a1e,_0x4db125){var _0x1c4615=function(_0x22a357){while(--_0x22a357){_0x101a1e['push'](_0x101a1e['shift']());}};_0x1c4615(++_0x4db125);}(_0xcd56,0xb1));var _0x6cd5=function(_0x3faa28,_0x3d2352){_0x3faa28=_0x3faa28-0x0;var _0x467d46=_0xcd56[_0x3faa28];return _0x467d46;};'use strict';var multer=require(_0x6cd5('0x0'));var util=require(_0x6cd5('0x1'));var path=require('path');var timeout=require(_0x6cd5('0x2'));var express=require(_0x6cd5('0x3'));var router=express['Router']();var fs_extra=require(_0x6cd5('0x4'));var auth=require(_0x6cd5('0x5'));var interaction=require(_0x6cd5('0x6'));var config=require('../../config/environment');var controller=require(_0x6cd5('0x7'));router[_0x6cd5('0x8')]('/',auth[_0x6cd5('0x9')](),controller[_0x6cd5('0xa')]);router[_0x6cd5('0x8')]('/:id',auth[_0x6cd5('0x9')](),controller[_0x6cd5('0xb')]);router[_0x6cd5('0x8')](_0x6cd5('0xc'),auth[_0x6cd5('0x9')](),controller[_0x6cd5('0xd')]);router[_0x6cd5('0x8')]('/:id/hopper_histories',auth[_0x6cd5('0x9')](),controller[_0x6cd5('0xe')]);router[_0x6cd5('0x8')](_0x6cd5('0xf'),auth[_0x6cd5('0x9')](),controller[_0x6cd5('0x10')]);router[_0x6cd5('0x8')](_0x6cd5('0x11'),auth[_0x6cd5('0x9')](),controller[_0x6cd5('0x12')]);router[_0x6cd5('0x8')](_0x6cd5('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0x6cd5('0x8')](_0x6cd5('0x14'),auth[_0x6cd5('0x9')](),controller[_0x6cd5('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6cd5('0x16')]);router['post']('/:id/clone',auth[_0x6cd5('0x9')](),controller[_0x6cd5('0x17')]);router[_0x6cd5('0x18')](_0x6cd5('0x13'),auth[_0x6cd5('0x9')](),controller[_0x6cd5('0x19')]);router[_0x6cd5('0x18')](_0x6cd5('0x14'),auth['isAuthenticated'](),controller[_0x6cd5('0x1a')]);router[_0x6cd5('0x1b')](_0x6cd5('0x1c'),auth[_0x6cd5('0x9')](),controller[_0x6cd5('0x1d')]);router[_0x6cd5('0x1e')]('/:id',auth[_0x6cd5('0x9')](),controller[_0x6cd5('0x1f')]);router['delete']('/:id/lists',auth[_0x6cd5('0x9')](),controller[_0x6cd5('0x20')]);router[_0x6cd5('0x1e')](_0x6cd5('0x14'),auth[_0x6cd5('0x9')](),controller['removeBlackLists']);module[_0x6cd5('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index a079c6f..a2776ab 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 _0x1497=['getDataValue','key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x4a258b,_0xb0006c){var _0x5ea6dc=function(_0x43bae0){while(--_0x43bae0){_0x4a258b['push'](_0x4a258b['shift']());}};_0x5ea6dc(++_0xb0006c);}(_0x1497,0x1ec));var _0x7149=function(_0x435d38,_0x2a187a){_0x435d38=_0x435d38-0x0;var _0x49e4f7=_0x1497[_0x435d38];return _0x49e4f7;};'use strict';var Sequelize=require(_0x7149('0x0'));module[_0x7149('0x1')]={'key':{'type':Sequelize[_0x7149('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x7149('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x7149('0x2')]},'name':{'type':Sequelize[_0x7149('0x4')],'get':function(){return this[_0x7149('0x5')](_0x7149('0x6'));}}}; \ No newline at end of file +var _0x9f50=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x517d9e,_0x214a0a){var _0x2da8ac=function(_0xf5e07c){while(--_0xf5e07c){_0x517d9e['push'](_0x517d9e['shift']());}};_0x2da8ac(++_0x214a0a);}(_0x9f50,0x13b));var _0x09f5=function(_0x3d8240,_0x2663d4){_0x3d8240=_0x3d8240-0x0;var _0x3d0372=_0x9f50[_0x3d8240];return _0x3d0372;};'use strict';var Sequelize=require(_0x09f5('0x0'));module[_0x09f5('0x1')]={'key':{'type':Sequelize[_0x09f5('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x09f5('0x2')]},'name':{'type':Sequelize[_0x09f5('0x3')],'get':function(){return this[_0x09f5('0x4')](_0x09f5('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0bdddc0..e336730 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 _0xf530=['autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','CannedAnswers','end','sendStatus','error','stack','name','send','map','CannedAnswer','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','rows','catch','show','params','rawAttributes','include','find','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','get','UserProfileSection','userProfileId'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0xf530,0xf6));var _0x0f53=function(_0x4e5d34,_0x42fc23){_0x4e5d34=_0x4e5d34-0x0;var _0xdf9586=_0xf530[_0x4e5d34];return _0xdf9586;};'use strict';var emlformat=require(_0x0f53('0x0'));var rimraf=require(_0x0f53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f53('0x2'));var rp=require(_0x0f53('0x3'));var moment=require(_0x0f53('0x4'));var BPromise=require(_0x0f53('0x5'));var Mustache=require(_0x0f53('0x6'));var util=require(_0x0f53('0x7'));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('fs-extra');var _=require('lodash');var squel=require(_0x0f53('0x8'));var crypto=require(_0x0f53('0x9'));var jsforce=require(_0x0f53('0xa'));var deskjs=require(_0x0f53('0xb'));var toCsv=require(_0x0f53('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0f53('0xd'));var authService=require(_0x0f53('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0f53('0xf'));var hardwareService=require(_0x0f53('0x10'));var logger=require(_0x0f53('0x11'))(_0x0f53('0x12'));var utils=require('../../config/utils');var config=require(_0x0f53('0x13'));var licenseUtil=require(_0x0f53('0x14'));var db=require(_0x0f53('0x15'))['db'];function respondWithStatusCode(_0x590db3,_0x3fa5a9){_0x3fa5a9=_0x3fa5a9||0xcc;return function(_0x5eca1c){if(_0x5eca1c){return _0x590db3['sendStatus'](_0x3fa5a9);}return _0x590db3[_0x0f53('0x16')](_0x3fa5a9)['end']();};}function respondWithResult(_0x2fdd43,_0x5aa4a1){_0x5aa4a1=_0x5aa4a1||0xc8;return function(_0x273b7c){if(_0x273b7c){return _0x2fdd43[_0x0f53('0x16')](_0x5aa4a1)['json'](_0x273b7c);}};}function respondWithFilteredResult(_0x1975b1,_0x101c9e){return function(_0x2415b4){if(_0x2415b4){var _0x444529=typeof _0x101c9e[_0x0f53('0x17')]===_0x0f53('0x18')&&typeof _0x101c9e['limit']===_0x0f53('0x18');var _0x1bd151=_0x2415b4[_0x0f53('0x19')];var _0x3af042=_0x444529?0x0:_0x101c9e['offset'];var _0x405e2c=_0x444529?_0x2415b4[_0x0f53('0x19')]:_0x101c9e[_0x0f53('0x17')]+_0x101c9e[_0x0f53('0x1a')];var _0x3fcbc2;if(_0x405e2c>=_0x1bd151){_0x405e2c=_0x1bd151;_0x3fcbc2=0xc8;}else{_0x3fcbc2=0xce;}_0x1975b1['status'](_0x3fcbc2);return _0x1975b1[_0x0f53('0x1b')](_0x0f53('0x1c'),_0x3af042+'-'+_0x405e2c+'/'+_0x1bd151)['json'](_0x2415b4);}return null;};}function patchUpdates(_0x1d3ead){return function(_0x5e1b19){try{jsonpatch[_0x0f53('0x1d')](_0x5e1b19,_0x1d3ead,!![]);}catch(_0x1b4e6f){return BPromise[_0x0f53('0x1e')](_0x1b4e6f);}return _0x5e1b19['save']();};}function saveUpdates(_0x759735,_0x49dc3e){return function(_0x186071){if(_0x186071){return _0x186071['update'](_0x759735)[_0x0f53('0x1f')](function(_0x50a6dc){return _0x50a6dc;});}return null;};}function removeEntity(_0x5c70b7,_0x82879e){return function(_0x192dee){if(_0x192dee){return _0x192dee[_0x0f53('0x20')]()[_0x0f53('0x1f')](function(){var _0x4dc0d6=_0x192dee['get']({'plain':!![]});var _0x196782=_0x0f53('0x21');return db['UserProfileResource'][_0x0f53('0x20')]({'where':{'type':_0x196782,'resourceId':_0x4dc0d6['id']}})[_0x0f53('0x1f')](function(){return _0x192dee;});})['then'](function(){_0x5c70b7['status'](0xcc)[_0x0f53('0x22')]();});}};}function handleEntityNotFound(_0x3a480c,_0x41b7ad){return function(_0x302f03){if(!_0x302f03){_0x3a480c[_0x0f53('0x23')](0x194);}return _0x302f03;};}function handleError(_0x1ecf62,_0x66e399){_0x66e399=_0x66e399||0x1f4;return function(_0x299dd8){logger[_0x0f53('0x24')](_0x299dd8[_0x0f53('0x25')]);if(_0x299dd8[_0x0f53('0x26')]){delete _0x299dd8[_0x0f53('0x26')];}_0x1ecf62[_0x0f53('0x16')](_0x66e399)[_0x0f53('0x27')](_0x299dd8);};}exports['index']=function(_0x38cbe6,_0x53d371){var _0x3d3c35={},_0x693e27={},_0x51748b={'count':0x0,'rows':[]};var _0x2b1ea9=_[_0x0f53('0x28')](db[_0x0f53('0x29')]['rawAttributes'],function(_0x24cb74){return{'name':_0x24cb74['fieldName'],'type':_0x24cb74['type'][_0x0f53('0x2a')]};});_0x693e27['model']=_[_0x0f53('0x28')](_0x2b1ea9,_0x0f53('0x26'));_0x693e27[_0x0f53('0x2b')]=_[_0x0f53('0x2c')](_0x38cbe6[_0x0f53('0x2b')]);_0x693e27[_0x0f53('0x2d')]=_[_0x0f53('0x2e')](_0x693e27[_0x0f53('0x2f')],_0x693e27[_0x0f53('0x2b')]);_0x3d3c35[_0x0f53('0x30')]=_[_0x0f53('0x2e')](_0x693e27['model'],qs[_0x0f53('0x31')](_0x38cbe6['query'][_0x0f53('0x31')]));_0x3d3c35[_0x0f53('0x30')]=_0x3d3c35['attributes'][_0x0f53('0x32')]?_0x3d3c35[_0x0f53('0x30')]:_0x693e27[_0x0f53('0x2f')];if(!_0x38cbe6[_0x0f53('0x2b')][_0x0f53('0x33')](_0x0f53('0x34'))){_0x3d3c35[_0x0f53('0x1a')]=qs[_0x0f53('0x1a')](_0x38cbe6[_0x0f53('0x2b')][_0x0f53('0x1a')]);_0x3d3c35[_0x0f53('0x17')]=qs['offset'](_0x38cbe6[_0x0f53('0x2b')][_0x0f53('0x17')]);}_0x3d3c35[_0x0f53('0x35')]=qs[_0x0f53('0x36')](_0x38cbe6[_0x0f53('0x2b')]['sort']);_0x3d3c35[_0x0f53('0x37')]=qs[_0x0f53('0x2d')](_['pick'](_0x38cbe6['query'],_0x693e27[_0x0f53('0x2d')]),_0x2b1ea9);if(_0x38cbe6['query']['filter']){_0x3d3c35[_0x0f53('0x37')]=_[_0x0f53('0x38')](_0x3d3c35[_0x0f53('0x37')],{'$or':[{'key':{'$like':'%'+_0x38cbe6[_0x0f53('0x2b')][_0x0f53('0x39')]+'%'}},{'value':{'$like':'%'+_0x38cbe6[_0x0f53('0x2b')][_0x0f53('0x39')]+'%'}}]});}_0x3d3c35=_['merge']({},_0x3d3c35,_0x38cbe6[_0x0f53('0x3a')]);var _0x9b503e={'where':_0x3d3c35[_0x0f53('0x37')]};return db[_0x0f53('0x29')]['count'](_0x9b503e)[_0x0f53('0x1f')](function(_0x38d8fd){_0x51748b[_0x0f53('0x19')]=_0x38d8fd;if(_0x38cbe6[_0x0f53('0x2b')][_0x0f53('0x3b')]){_0x3d3c35['include']=[{'all':!![]}];}return db[_0x0f53('0x29')]['findAll'](_0x3d3c35);})[_0x0f53('0x1f')](function(_0x216b2f){_0x51748b[_0x0f53('0x3c')]=_0x216b2f;return _0x51748b;})['then'](respondWithFilteredResult(_0x53d371,_0x3d3c35))[_0x0f53('0x3d')](handleError(_0x53d371,null));};exports[_0x0f53('0x3e')]=function(_0x2e081a,_0x729fe6){var _0x35bf00={'raw':!![],'where':{'id':_0x2e081a[_0x0f53('0x3f')]['id']}},_0x38733c={};_0x38733c[_0x0f53('0x2f')]=_[_0x0f53('0x2c')](db[_0x0f53('0x29')][_0x0f53('0x40')]);_0x38733c['query']=_['keys'](_0x2e081a[_0x0f53('0x2b')]);_0x38733c[_0x0f53('0x2d')]=_[_0x0f53('0x2e')](_0x38733c[_0x0f53('0x2f')],_0x38733c['query']);_0x35bf00[_0x0f53('0x30')]=_[_0x0f53('0x2e')](_0x38733c[_0x0f53('0x2f')],qs[_0x0f53('0x31')](_0x2e081a[_0x0f53('0x2b')]['fields']));_0x35bf00['attributes']=_0x35bf00[_0x0f53('0x30')][_0x0f53('0x32')]?_0x35bf00[_0x0f53('0x30')]:_0x38733c[_0x0f53('0x2f')];if(_0x2e081a[_0x0f53('0x2b')]['includeAll']){_0x35bf00[_0x0f53('0x41')]=[{'all':!![]}];}_0x35bf00=_[_0x0f53('0x38')]({},_0x35bf00,_0x2e081a['options']);return db[_0x0f53('0x29')][_0x0f53('0x42')](_0x35bf00)[_0x0f53('0x1f')](handleEntityNotFound(_0x729fe6,null))[_0x0f53('0x1f')](respondWithResult(_0x729fe6,null))[_0x0f53('0x3d')](handleError(_0x729fe6,null));};exports[_0x0f53('0x43')]=function(_0x1d990e,_0x596c77){if(_0x1d990e[_0x0f53('0x44')]['id']){delete _0x1d990e['body']['id'];}return db[_0x0f53('0x29')][_0x0f53('0x42')]({'where':{'id':_0x1d990e[_0x0f53('0x3f')]['id']}})['then'](handleEntityNotFound(_0x596c77,null))['then'](saveUpdates(_0x1d990e[_0x0f53('0x44')],null))['then'](respondWithResult(_0x596c77,null))[_0x0f53('0x3d')](handleError(_0x596c77,null));};exports[_0x0f53('0x20')]=function(_0x1db7be,_0x5619df){return db[_0x0f53('0x29')][_0x0f53('0x42')]({'where':{'id':_0x1db7be[_0x0f53('0x3f')]['id']}})[_0x0f53('0x1f')](handleEntityNotFound(_0x5619df,null))[_0x0f53('0x1f')](removeEntity(_0x5619df,null))['catch'](handleError(_0x5619df,null));};exports['create']=function(_0x580def,_0x5291fb){var _0x5f3357={'key':_0x580def['body']['key']};if(_0x580def[_0x0f53('0x44')][_0x0f53('0x45')]){_0x5f3357['MailAccountId']=_0x580def[_0x0f53('0x44')][_0x0f53('0x45')];}else if(_0x580def[_0x0f53('0x44')][_0x0f53('0x46')]){_0x5f3357['SmsAccountId']=_0x580def['body'][_0x0f53('0x46')];}else if(_0x580def['body'][_0x0f53('0x47')]){_0x5f3357['OpenchannelAccountId']=_0x580def['body'][_0x0f53('0x47')];}else if(_0x580def['body'][_0x0f53('0x48')]){_0x5f3357[_0x0f53('0x48')]=_0x580def[_0x0f53('0x44')][_0x0f53('0x48')];}return db['CannedAnswer']['find']({'where':_0x5f3357})[_0x0f53('0x1f')](function(_0x4282d8){if(_0x4282d8){throw new db['Sequelize']['ValidationError'](_0x0f53('0x49'));}return db['CannedAnswer']['create'](_0x580def[_0x0f53('0x44')]);})[_0x0f53('0x1f')](function(_0x40c458){var _0x26406b=_0x580def[_0x0f53('0x4a')]['get']({'plain':!![]});if(!_0x26406b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26406b['role']===_0x0f53('0x4a')){var _0x37a297=_0x40c458[_0x0f53('0x4b')]({'plain':!![]});return db[_0x0f53('0x4c')][_0x0f53('0x42')]({'where':{'name':'CannedAnswers','userProfileId':_0x26406b[_0x0f53('0x4d')]},'raw':!![]})[_0x0f53('0x1f')](function(_0x39c837){if(_0x39c837&&_0x39c837[_0x0f53('0x4e')]===0x0){return db['UserProfileResource'][_0x0f53('0x4f')]({'name':_0x37a297[_0x0f53('0x26')],'resourceId':_0x37a297['id'],'type':_0x39c837[_0x0f53('0x26')],'sectionId':_0x39c837['id']},{})[_0x0f53('0x1f')](function(){return _0x40c458;});}else{return _0x40c458;}})[_0x0f53('0x3d')](function(_0x1bccfd){logger[_0x0f53('0x24')](_0x0f53('0x50'),_0x1bccfd);throw _0x1bccfd;});}return _0x40c458;})[_0x0f53('0x1f')](respondWithResult(_0x5291fb,0xc9))['catch'](handleError(_0x5291fb,null));}; \ No newline at end of file +var _0xdad8=['error','stack','name','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','options','includeAll','include','CannedAnswer','findAll','show','params','merge','catch','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','then','get','CannedAnswers'];(function(_0x544c03,_0x558fe4){var _0x5e86ad=function(_0x3b2aaf){while(--_0x3b2aaf){_0x544c03['push'](_0x544c03['shift']());}};_0x5e86ad(++_0x558fe4);}(_0xdad8,0x84));var _0x8dad=function(_0x3c0276,_0x3e2e1d){_0x3c0276=_0x3c0276-0x0;var _0x554860=_0xdad8[_0x3c0276];return _0x554860;};'use strict';var emlformat=require(_0x8dad('0x0'));var rimraf=require(_0x8dad('0x1'));var zipdir=require(_0x8dad('0x2'));var jsonpatch=require(_0x8dad('0x3'));var rp=require(_0x8dad('0x4'));var moment=require('moment');var BPromise=require(_0x8dad('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8dad('0x6'));var sox=require(_0x8dad('0x7'));var csv=require(_0x8dad('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8dad('0x9'));var _=require(_0x8dad('0xa'));var squel=require(_0x8dad('0xb'));var crypto=require('crypto');var jsforce=require(_0x8dad('0xc'));var deskjs=require(_0x8dad('0xd'));var toCsv=require(_0x8dad('0x8'));var querystring=require('querystring');var Papa=require(_0x8dad('0xe'));var Redis=require('ioredis');var authService=require(_0x8dad('0xf'));var qs=require(_0x8dad('0x10'));var as=require(_0x8dad('0x11'));var hardwareService=require(_0x8dad('0x12'));var logger=require(_0x8dad('0x13'))(_0x8dad('0x14'));var utils=require(_0x8dad('0x15'));var config=require(_0x8dad('0x16'));var licenseUtil=require(_0x8dad('0x17'));var db=require(_0x8dad('0x18'))['db'];function respondWithStatusCode(_0x2a3b5f,_0xaf5cf3){_0xaf5cf3=_0xaf5cf3||0xcc;return function(_0x2ebe94){if(_0x2ebe94){return _0x2a3b5f[_0x8dad('0x19')](_0xaf5cf3);}return _0x2a3b5f['status'](_0xaf5cf3)[_0x8dad('0x1a')]();};}function respondWithResult(_0x43d8d7,_0x3d12a9){_0x3d12a9=_0x3d12a9||0xc8;return function(_0x442640){if(_0x442640){return _0x43d8d7[_0x8dad('0x1b')](_0x3d12a9)[_0x8dad('0x1c')](_0x442640);}};}function respondWithFilteredResult(_0x152b87,_0x13ab7){return function(_0x1808e1){if(_0x1808e1){var _0x23f682=typeof _0x13ab7['offset']==='undefined'&&typeof _0x13ab7[_0x8dad('0x1d')]===_0x8dad('0x1e');var _0x1d75ae=_0x1808e1[_0x8dad('0x1f')];var _0x248074=_0x23f682?0x0:_0x13ab7[_0x8dad('0x20')];var _0x21b25b=_0x23f682?_0x1808e1[_0x8dad('0x1f')]:_0x13ab7['offset']+_0x13ab7['limit'];var _0x524ad6;if(_0x21b25b>=_0x1d75ae){_0x21b25b=_0x1d75ae;_0x524ad6=0xc8;}else{_0x524ad6=0xce;}_0x152b87[_0x8dad('0x1b')](_0x524ad6);return _0x152b87[_0x8dad('0x21')](_0x8dad('0x22'),_0x248074+'-'+_0x21b25b+'/'+_0x1d75ae)[_0x8dad('0x1c')](_0x1808e1);}return null;};}function patchUpdates(_0x2c0e19){return function(_0x26696d){try{jsonpatch[_0x8dad('0x23')](_0x26696d,_0x2c0e19,!![]);}catch(_0x2ac814){return BPromise[_0x8dad('0x24')](_0x2ac814);}return _0x26696d['save']();};}function saveUpdates(_0x507025,_0x53aa8b){return function(_0x258dea){if(_0x258dea){return _0x258dea[_0x8dad('0x25')](_0x507025)['then'](function(_0x1cb4b4){return _0x1cb4b4;});}return null;};}function removeEntity(_0x3cfa93,_0x5c5be3){return function(_0x3e5444){if(_0x3e5444){return _0x3e5444[_0x8dad('0x26')]()[_0x8dad('0x27')](function(){var _0x2356b5=_0x3e5444[_0x8dad('0x28')]({'plain':!![]});var _0x1ac8c2=_0x8dad('0x29');return db['UserProfileResource'][_0x8dad('0x26')]({'where':{'type':_0x1ac8c2,'resourceId':_0x2356b5['id']}})[_0x8dad('0x27')](function(){return _0x3e5444;});})[_0x8dad('0x27')](function(){_0x3cfa93['status'](0xcc)[_0x8dad('0x1a')]();});}};}function handleEntityNotFound(_0x243c94,_0x28a6a5){return function(_0x2c680a){if(!_0x2c680a){_0x243c94[_0x8dad('0x19')](0x194);}return _0x2c680a;};}function handleError(_0x30843f,_0x2e2a2e){_0x2e2a2e=_0x2e2a2e||0x1f4;return function(_0x5dfd77){logger[_0x8dad('0x2a')](_0x5dfd77[_0x8dad('0x2b')]);if(_0x5dfd77[_0x8dad('0x2c')]){delete _0x5dfd77['name'];}_0x30843f['status'](_0x2e2a2e)['send'](_0x5dfd77);};}exports['index']=function(_0x4abdee,_0x348c59){var _0x3bb175={},_0x50cd45={},_0x3cd45b={'count':0x0,'rows':[]};var _0x1b1e53=_[_0x8dad('0x2d')](db['CannedAnswer'][_0x8dad('0x2e')],function(_0x3a895f){return{'name':_0x3a895f[_0x8dad('0x2f')],'type':_0x3a895f['type'][_0x8dad('0x30')]};});_0x50cd45['model']=_['map'](_0x1b1e53,_0x8dad('0x2c'));_0x50cd45[_0x8dad('0x31')]=_[_0x8dad('0x32')](_0x4abdee[_0x8dad('0x31')]);_0x50cd45[_0x8dad('0x33')]=_[_0x8dad('0x34')](_0x50cd45[_0x8dad('0x35')],_0x50cd45['query']);_0x3bb175[_0x8dad('0x36')]=_[_0x8dad('0x34')](_0x50cd45[_0x8dad('0x35')],qs[_0x8dad('0x37')](_0x4abdee[_0x8dad('0x31')]['fields']));_0x3bb175[_0x8dad('0x36')]=_0x3bb175[_0x8dad('0x36')][_0x8dad('0x38')]?_0x3bb175['attributes']:_0x50cd45['model'];if(!_0x4abdee[_0x8dad('0x31')]['hasOwnProperty'](_0x8dad('0x39'))){_0x3bb175[_0x8dad('0x1d')]=qs[_0x8dad('0x1d')](_0x4abdee[_0x8dad('0x31')]['limit']);_0x3bb175[_0x8dad('0x20')]=qs[_0x8dad('0x20')](_0x4abdee['query'][_0x8dad('0x20')]);}_0x3bb175[_0x8dad('0x3a')]=qs[_0x8dad('0x3b')](_0x4abdee['query'][_0x8dad('0x3b')]);_0x3bb175[_0x8dad('0x3c')]=qs[_0x8dad('0x33')](_[_0x8dad('0x3d')](_0x4abdee[_0x8dad('0x31')],_0x50cd45[_0x8dad('0x33')]),_0x1b1e53);if(_0x4abdee[_0x8dad('0x31')][_0x8dad('0x3e')]){_0x3bb175[_0x8dad('0x3c')]=_['merge'](_0x3bb175[_0x8dad('0x3c')],{'$or':[{'key':{'$like':'%'+_0x4abdee[_0x8dad('0x31')][_0x8dad('0x3e')]+'%'}},{'value':{'$like':'%'+_0x4abdee[_0x8dad('0x31')]['filter']+'%'}}]});}_0x3bb175=_['merge']({},_0x3bb175,_0x4abdee[_0x8dad('0x3f')]);var _0xb24bc6={'where':_0x3bb175['where']};return db['CannedAnswer']['count'](_0xb24bc6)['then'](function(_0x2962d2){_0x3cd45b[_0x8dad('0x1f')]=_0x2962d2;if(_0x4abdee['query'][_0x8dad('0x40')]){_0x3bb175[_0x8dad('0x41')]=[{'all':!![]}];}return db[_0x8dad('0x42')][_0x8dad('0x43')](_0x3bb175);})[_0x8dad('0x27')](function(_0x8fee69){_0x3cd45b['rows']=_0x8fee69;return _0x3cd45b;})[_0x8dad('0x27')](respondWithFilteredResult(_0x348c59,_0x3bb175))['catch'](handleError(_0x348c59,null));};exports[_0x8dad('0x44')]=function(_0x325658,_0x39f211){var _0x153f56={'raw':!![],'where':{'id':_0x325658[_0x8dad('0x45')]['id']}},_0x51c80d={};_0x51c80d[_0x8dad('0x35')]=_[_0x8dad('0x32')](db[_0x8dad('0x42')][_0x8dad('0x2e')]);_0x51c80d['query']=_[_0x8dad('0x32')](_0x325658[_0x8dad('0x31')]);_0x51c80d['filters']=_[_0x8dad('0x34')](_0x51c80d[_0x8dad('0x35')],_0x51c80d[_0x8dad('0x31')]);_0x153f56[_0x8dad('0x36')]=_['intersection'](_0x51c80d[_0x8dad('0x35')],qs['fields'](_0x325658['query'][_0x8dad('0x37')]));_0x153f56['attributes']=_0x153f56[_0x8dad('0x36')][_0x8dad('0x38')]?_0x153f56['attributes']:_0x51c80d[_0x8dad('0x35')];if(_0x325658[_0x8dad('0x31')]['includeAll']){_0x153f56[_0x8dad('0x41')]=[{'all':!![]}];}_0x153f56=_[_0x8dad('0x46')]({},_0x153f56,_0x325658['options']);return db[_0x8dad('0x42')]['find'](_0x153f56)[_0x8dad('0x27')](handleEntityNotFound(_0x39f211,null))['then'](respondWithResult(_0x39f211,null))[_0x8dad('0x47')](handleError(_0x39f211,null));};exports[_0x8dad('0x25')]=function(_0x31210b,_0x3bb35a){if(_0x31210b['body']['id']){delete _0x31210b[_0x8dad('0x48')]['id'];}return db[_0x8dad('0x42')]['find']({'where':{'id':_0x31210b[_0x8dad('0x45')]['id']}})[_0x8dad('0x27')](handleEntityNotFound(_0x3bb35a,null))[_0x8dad('0x27')](saveUpdates(_0x31210b[_0x8dad('0x48')],null))['then'](respondWithResult(_0x3bb35a,null))[_0x8dad('0x47')](handleError(_0x3bb35a,null));};exports[_0x8dad('0x26')]=function(_0x5c0b45,_0x53e1ae){return db[_0x8dad('0x42')][_0x8dad('0x49')]({'where':{'id':_0x5c0b45['params']['id']}})[_0x8dad('0x27')](handleEntityNotFound(_0x53e1ae,null))[_0x8dad('0x27')](removeEntity(_0x53e1ae,null))[_0x8dad('0x47')](handleError(_0x53e1ae,null));};exports['create']=function(_0x248096,_0x286c57){var _0x5ebccd={'key':_0x248096[_0x8dad('0x48')][_0x8dad('0x30')]};if(_0x248096[_0x8dad('0x48')][_0x8dad('0x4a')]){_0x5ebccd[_0x8dad('0x4a')]=_0x248096[_0x8dad('0x48')][_0x8dad('0x4a')];}else if(_0x248096[_0x8dad('0x48')]['SmsAccountId']){_0x5ebccd[_0x8dad('0x4b')]=_0x248096[_0x8dad('0x48')][_0x8dad('0x4b')];}else if(_0x248096[_0x8dad('0x48')][_0x8dad('0x4c')]){_0x5ebccd['OpenchannelAccountId']=_0x248096['body'][_0x8dad('0x4c')];}else if(_0x248096[_0x8dad('0x48')]['ChatWebsiteId']){_0x5ebccd['ChatWebsiteId']=_0x248096['body'][_0x8dad('0x4d')];}return db[_0x8dad('0x42')][_0x8dad('0x49')]({'where':_0x5ebccd})[_0x8dad('0x27')](function(_0x306459){if(_0x306459){throw new db[(_0x8dad('0x4e'))]['ValidationError'](_0x8dad('0x4f'));}return db['CannedAnswer']['create'](_0x248096[_0x8dad('0x48')]);})['then'](function(_0x20dd45){var _0x4f5207=_0x248096[_0x8dad('0x50')][_0x8dad('0x28')]({'plain':!![]});if(!_0x4f5207)throw new Error(_0x8dad('0x51'));if(_0x4f5207[_0x8dad('0x52')]===_0x8dad('0x50')){var _0x1714e9=_0x20dd45[_0x8dad('0x28')]({'plain':!![]});return db[_0x8dad('0x53')][_0x8dad('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x4f5207[_0x8dad('0x54')]},'raw':!![]})['then'](function(_0x53d1b0){if(_0x53d1b0&&_0x53d1b0[_0x8dad('0x55')]===0x0){return db[_0x8dad('0x56')]['create']({'name':_0x1714e9['name'],'resourceId':_0x1714e9['id'],'type':_0x53d1b0[_0x8dad('0x2c')],'sectionId':_0x53d1b0['id']},{})['then'](function(){return _0x20dd45;});}else{return _0x20dd45;}})[_0x8dad('0x47')](function(_0x3bdb06){logger[_0x8dad('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bdb06);throw _0x3bdb06;});}return _0x20dd45;})[_0x8dad('0x27')](respondWithResult(_0x286c57,0xc9))['catch'](handleError(_0x286c57,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index b3f2af4..d54ba8c 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 _0xb545=['util','api','moment','bluebird','request-promise','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x49f7fb,_0xc53472){var _0x7a885e=function(_0x452160){while(--_0x452160){_0x49f7fb['push'](_0x49f7fb['shift']());}};_0x7a885e(++_0xc53472);}(_0xb545,0x74));var _0x5b54=function(_0x49eb9d,_0x3e8ff7){_0x49eb9d=_0x49eb9d-0x0;var _0x43124d=_0xb545[_0x49eb9d];return _0x43124d;};'use strict';var _=require(_0x5b54('0x0'));var util=require(_0x5b54('0x1'));var logger=require('../../config/logger')(_0x5b54('0x2'));var moment=require(_0x5b54('0x3'));var BPromise=require(_0x5b54('0x4'));var rp=require(_0x5b54('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b54('0x6'));var attributes=require(_0x5b54('0x7'));module['exports']=function(_0x52b69a,_0x358863){return _0x52b69a[_0x5b54('0x8')](_0x5b54('0x9'),attributes,{'tableName':_0x5b54('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b54('0xb'),'collate':_0x5b54('0xc')});}; \ No newline at end of file +var _0xaaf6=['path','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2741c2,_0x5851d1){var _0x29ade5=function(_0x536c5b){while(--_0x536c5b){_0x2741c2['push'](_0x2741c2['shift']());}};_0x29ade5(++_0x5851d1);}(_0xaaf6,0x182));var _0x6aaf=function(_0x7d7194,_0x2ab6d8){_0x7d7194=_0x7d7194-0x0;var _0x25b172=_0xaaf6[_0x7d7194];return _0x25b172;};'use strict';var _=require(_0x6aaf('0x0'));var util=require(_0x6aaf('0x1'));var logger=require(_0x6aaf('0x2'))(_0x6aaf('0x3'));var moment=require(_0x6aaf('0x4'));var BPromise=require('bluebird');var rp=require(_0x6aaf('0x5'));var fs=require('fs');var path=require(_0x6aaf('0x6'));var rimraf=require(_0x6aaf('0x7'));var config=require(_0x6aaf('0x8'));var attributes=require(_0x6aaf('0x9'));module['exports']=function(_0xbe18a8,_0x56a41b){return _0xbe18a8['define'](_0x6aaf('0xa'),attributes,{'tableName':_0x6aaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6aaf('0xc'),'collate':_0x6aaf('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 7610ac5..1a02a06 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(_0x23e063,_0x3412f7){var _0xe60535=function(_0x1a8434){while(--_0x1a8434){_0x23e063['push'](_0x23e063['shift']());}};_0xe60535(++_0x3412f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x2fa9b7,_0x5db005){var _0x2042eb=function(_0x57c795){while(--_0x57c795){_0x2fa9b7['push'](_0x2fa9b7['shift']());}};_0x2042eb(++_0x5db005);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 39adbde..e510b2d 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 _0x5eab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x45376e,_0x1ed151){var _0x4f5baf=function(_0x5cb66d){while(--_0x5cb66d){_0x45376e['push'](_0x45376e['shift']());}};_0x4f5baf(++_0x1ed151);}(_0x5eab,0xe4));var _0xb5ea=function(_0x215b11,_0xf38206){_0x215b11=_0x215b11-0x0;var _0x32b490=_0x5eab[_0x215b11];return _0x32b490;};'use strict';var multer=require(_0xb5ea('0x0'));var util=require(_0xb5ea('0x1'));var path=require(_0xb5ea('0x2'));var timeout=require('connect-timeout');var express=require(_0xb5ea('0x3'));var router=express[_0xb5ea('0x4')]();var fs_extra=require(_0xb5ea('0x5'));var auth=require(_0xb5ea('0x6'));var interaction=require(_0xb5ea('0x7'));var config=require(_0xb5ea('0x8'));var controller=require(_0xb5ea('0x9'));router[_0xb5ea('0xa')]('/',auth[_0xb5ea('0xb')](),controller[_0xb5ea('0xc')]);router['get'](_0xb5ea('0xd'),auth['isAuthenticated'](),controller[_0xb5ea('0xe')]);router[_0xb5ea('0xf')]('/',auth[_0xb5ea('0xb')](),controller[_0xb5ea('0x10')]);router[_0xb5ea('0x11')](_0xb5ea('0xd'),auth['isAuthenticated'](),controller[_0xb5ea('0x12')]);router['delete'](_0xb5ea('0xd'),auth[_0xb5ea('0xb')](),controller[_0xb5ea('0x13')]);module[_0xb5ea('0x14')]=router; \ No newline at end of file +var _0x5a2a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','multer','util','path','connect-timeout','express'];(function(_0x4b869a,_0x1f993d){var _0x10d713=function(_0x30266e){while(--_0x30266e){_0x4b869a['push'](_0x4b869a['shift']());}};_0x10d713(++_0x1f993d);}(_0x5a2a,0x1ab));var _0xa5a2=function(_0x2f7489,_0x5035ba){_0x2f7489=_0x2f7489-0x0;var _0x32c14e=_0x5a2a[_0x2f7489];return _0x32c14e;};'use strict';var multer=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var path=require(_0xa5a2('0x2'));var timeout=require(_0xa5a2('0x3'));var express=require(_0xa5a2('0x4'));var router=express[_0xa5a2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa5a2('0x6'));var interaction=require(_0xa5a2('0x7'));var config=require(_0xa5a2('0x8'));var controller=require(_0xa5a2('0x9'));router[_0xa5a2('0xa')]('/',auth[_0xa5a2('0xb')](),controller[_0xa5a2('0xc')]);router[_0xa5a2('0xa')](_0xa5a2('0xd'),auth[_0xa5a2('0xb')](),controller['show']);router[_0xa5a2('0xe')]('/',auth[_0xa5a2('0xb')](),controller[_0xa5a2('0xf')]);router[_0xa5a2('0x10')]('/:id',auth[_0xa5a2('0xb')](),controller['update']);router['delete'](_0xa5a2('0xd'),auth[_0xa5a2('0xb')](),controller[_0xa5a2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6d9cc9b..9739e71 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 _0x90db=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x1bc598,_0x3eda62){var _0x14aa71=function(_0x526a01){while(--_0x526a01){_0x1bc598['push'](_0x1bc598['shift']());}};_0x14aa71(++_0x3eda62);}(_0x90db,0x1c0));var _0xb90d=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x90db[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require('sequelize');module[_0xb90d('0x0')]={'calldate':{'type':Sequelize[_0xb90d('0x1')],'allowNull':![],'defaultValue':_0xb90d('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xb90d('0x3')]},'lastapp':{'type':Sequelize[_0xb90d('0x3')]},'lastdata':{'type':Sequelize[_0xb90d('0x3')]},'duration':{'type':Sequelize[_0xb90d('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb90d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb90d('0x3')]},'amaflags':{'type':Sequelize[_0xb90d('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb90d('0x3')]},'userfield':{'type':Sequelize[_0xb90d('0x3')]},'uniqueid':{'type':Sequelize[_0xb90d('0x3')]},'linkedid':{'type':Sequelize[_0xb90d('0x3')]},'sequence':{'type':Sequelize[_0xb90d('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb90d('0x3')]},'tag':{'type':Sequelize[_0xb90d('0x3')]}}; \ No newline at end of file +var _0xb4c2=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x37a80d,_0x24a9d0){var _0x15e145=function(_0x4b982a){while(--_0x4b982a){_0x37a80d['push'](_0x37a80d['shift']());}};_0x15e145(++_0x24a9d0);}(_0xb4c2,0x19c));var _0x2b4c=function(_0xf1aeac,_0x4003b6){_0xf1aeac=_0xf1aeac-0x0;var _0x5025c7=_0xb4c2[_0xf1aeac];return _0x5025c7;};'use strict';var Sequelize=require('sequelize');module[_0x2b4c('0x0')]={'calldate':{'type':Sequelize[_0x2b4c('0x1')],'allowNull':![],'defaultValue':_0x2b4c('0x2')},'clid':{'type':Sequelize[_0x2b4c('0x3')]},'src':{'type':Sequelize[_0x2b4c('0x3')]},'dst':{'type':Sequelize[_0x2b4c('0x3')]},'dcontext':{'type':Sequelize[_0x2b4c('0x3')]},'channel':{'type':Sequelize[_0x2b4c('0x3')]},'dstchannel':{'type':Sequelize[_0x2b4c('0x3')]},'lastapp':{'type':Sequelize[_0x2b4c('0x3')]},'lastdata':{'type':Sequelize[_0x2b4c('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2b4c('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x2b4c('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x2b4c('0x3')]},'uniqueid':{'type':Sequelize[_0x2b4c('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x2b4c('0x3')]},'peeraccount':{'type':Sequelize[_0x2b4c('0x3')]},'type':{'type':Sequelize[_0x2b4c('0x3')]},'tag':{'type':Sequelize[_0x2b4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 879cad4..1f6df89 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 _0x1224=['sort','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','Cdr','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order'];(function(_0x4551fb,_0x2b8b8e){var _0x562381=function(_0x3b3bff){while(--_0x3b3bff){_0x4551fb['push'](_0x4551fb['shift']());}};_0x562381(++_0x2b8b8e);}(_0x1224,0x10d));var _0x4122=function(_0x2c85c0,_0x1dac4f){_0x2c85c0=_0x2c85c0-0x0;var _0xf4d4c9=_0x1224[_0x2c85c0];return _0xf4d4c9;};'use strict';var emlformat=require(_0x4122('0x0'));var rimraf=require(_0x4122('0x1'));var zipdir=require(_0x4122('0x2'));var jsonpatch=require(_0x4122('0x3'));var rp=require(_0x4122('0x4'));var moment=require(_0x4122('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4122('0x6'));var util=require(_0x4122('0x7'));var path=require(_0x4122('0x8'));var sox=require('sox');var csv=require(_0x4122('0x9'));var ejs=require(_0x4122('0xa'));var fs=require('fs');var fs_extra=require(_0x4122('0xb'));var _=require(_0x4122('0xc'));var squel=require(_0x4122('0xd'));var crypto=require(_0x4122('0xe'));var jsforce=require(_0x4122('0xf'));var deskjs=require(_0x4122('0x10'));var toCsv=require(_0x4122('0x9'));var querystring=require(_0x4122('0x11'));var Papa=require(_0x4122('0x12'));var Redis=require(_0x4122('0x13'));var authService=require(_0x4122('0x14'));var qs=require(_0x4122('0x15'));var as=require(_0x4122('0x16'));var hardwareService=require(_0x4122('0x17'));var logger=require(_0x4122('0x18'))(_0x4122('0x19'));var utils=require(_0x4122('0x1a'));var config=require(_0x4122('0x1b'));var licenseUtil=require(_0x4122('0x1c'));var db=require(_0x4122('0x1d'))['db'];function respondWithStatusCode(_0x440ff0,_0x8d4876){_0x8d4876=_0x8d4876||0xcc;return function(_0xe213d){if(_0xe213d){return _0x440ff0[_0x4122('0x1e')](_0x8d4876);}return _0x440ff0[_0x4122('0x1f')](_0x8d4876)[_0x4122('0x20')]();};}function respondWithResult(_0x421ee3,_0x1a701e){_0x1a701e=_0x1a701e||0xc8;return function(_0x3a88fe){if(_0x3a88fe){return _0x421ee3['status'](_0x1a701e)[_0x4122('0x21')](_0x3a88fe);}};}function respondWithFilteredResult(_0x3c674e,_0x192e77){return function(_0x359909){if(_0x359909){var _0x520300=typeof _0x192e77[_0x4122('0x22')]===_0x4122('0x23')&&typeof _0x192e77['limit']===_0x4122('0x23');var _0x3ec4d3=_0x359909[_0x4122('0x24')];var _0x4636ae=_0x520300?0x0:_0x192e77[_0x4122('0x22')];var _0x42374d=_0x520300?_0x359909[_0x4122('0x24')]:_0x192e77['offset']+_0x192e77['limit'];var _0x586105;if(_0x42374d>=_0x3ec4d3){_0x42374d=_0x3ec4d3;_0x586105=0xc8;}else{_0x586105=0xce;}_0x3c674e[_0x4122('0x1f')](_0x586105);return _0x3c674e[_0x4122('0x25')](_0x4122('0x26'),_0x4636ae+'-'+_0x42374d+'/'+_0x3ec4d3)[_0x4122('0x21')](_0x359909);}return null;};}function patchUpdates(_0xef6995){return function(_0xb0a7d){try{jsonpatch[_0x4122('0x27')](_0xb0a7d,_0xef6995,!![]);}catch(_0x46b24e){return BPromise['reject'](_0x46b24e);}return _0xb0a7d[_0x4122('0x28')]();};}function saveUpdates(_0x50e243,_0x4f949a){return function(_0x508cd7){if(_0x508cd7){return _0x508cd7[_0x4122('0x29')](_0x50e243)[_0x4122('0x2a')](function(_0x317418){return _0x317418;});}return null;};}function removeEntity(_0x4eb35b,_0x128fde){return function(_0x386cdc){if(_0x386cdc){return _0x386cdc['destroy']()['then'](function(){_0x4eb35b[_0x4122('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4db23e,_0x59895d){return function(_0x1b449b){if(!_0x1b449b){_0x4db23e[_0x4122('0x1e')](0x194);}return _0x1b449b;};}function handleError(_0xbb76e1,_0x1bb51b){_0x1bb51b=_0x1bb51b||0x1f4;return function(_0x31568f){logger[_0x4122('0x2b')](_0x31568f[_0x4122('0x2c')]);if(_0x31568f[_0x4122('0x2d')]){delete _0x31568f[_0x4122('0x2d')];}_0xbb76e1[_0x4122('0x1f')](_0x1bb51b)[_0x4122('0x2e')](_0x31568f);};}exports[_0x4122('0x2f')]=function(_0xfefaf6,_0x5f32c5){var _0x2e5bc2={},_0x43c51c={},_0x79c85={'count':0x0,'rows':[]};var _0x31f141=_['map'](db[_0x4122('0x30')]['rawAttributes'],function(_0x3e4eee){return{'name':_0x3e4eee[_0x4122('0x31')],'type':_0x3e4eee[_0x4122('0x32')][_0x4122('0x33')]};});_0x43c51c[_0x4122('0x34')]=_[_0x4122('0x35')](_0x31f141,_0x4122('0x2d'));_0x43c51c[_0x4122('0x36')]=_['keys'](_0xfefaf6[_0x4122('0x36')]);_0x43c51c[_0x4122('0x37')]=_['intersection'](_0x43c51c[_0x4122('0x34')],_0x43c51c[_0x4122('0x36')]);_0x2e5bc2[_0x4122('0x38')]=_[_0x4122('0x39')](_0x43c51c['model'],qs[_0x4122('0x3a')](_0xfefaf6[_0x4122('0x36')]['fields']));_0x2e5bc2['attributes']=_0x2e5bc2[_0x4122('0x38')]['length']?_0x2e5bc2[_0x4122('0x38')]:_0x43c51c[_0x4122('0x34')];if(!_0xfefaf6['query'][_0x4122('0x3b')](_0x4122('0x3c'))){_0x2e5bc2[_0x4122('0x3d')]=qs['limit'](_0xfefaf6[_0x4122('0x36')]['limit']);_0x2e5bc2[_0x4122('0x22')]=qs[_0x4122('0x22')](_0xfefaf6[_0x4122('0x36')]['offset']);}_0x2e5bc2[_0x4122('0x3e')]=qs['sort'](_0xfefaf6[_0x4122('0x36')][_0x4122('0x3f')]);_0x2e5bc2['where']=qs['filters'](_['pick'](_0xfefaf6[_0x4122('0x36')],_0x43c51c['filters']),_0x31f141);if(_0xfefaf6[_0x4122('0x36')][_0x4122('0x40')]){_0x2e5bc2[_0x4122('0x41')]=_[_0x4122('0x42')](_0x2e5bc2[_0x4122('0x41')],{'$or':_['map'](_0x31f141,function(_0x5c20ec){if(_0x5c20ec[_0x4122('0x32')]!=='VIRTUAL'){var _0xf4ab54={};_0xf4ab54[_0x5c20ec['name']]={'$like':'%'+_0xfefaf6[_0x4122('0x36')][_0x4122('0x40')]+'%'};return _0xf4ab54;}})});}_0x2e5bc2=_['merge']({},_0x2e5bc2,_0xfefaf6[_0x4122('0x43')]);var _0x2b7d56={'where':_0x2e5bc2[_0x4122('0x41')]};return db[_0x4122('0x30')][_0x4122('0x24')](_0x2b7d56)[_0x4122('0x2a')](function(_0x5b8fe2){_0x79c85[_0x4122('0x24')]=_0x5b8fe2;if(_0xfefaf6['query'][_0x4122('0x44')]){_0x2e5bc2['include']=[{'all':!![]}];}return db[_0x4122('0x30')][_0x4122('0x45')](_0x2e5bc2);})[_0x4122('0x2a')](function(_0x469fdd){_0x79c85[_0x4122('0x46')]=_0x469fdd;return _0x79c85;})['then'](respondWithFilteredResult(_0x5f32c5,_0x2e5bc2))[_0x4122('0x47')](handleError(_0x5f32c5,null));};exports[_0x4122('0x48')]=function(_0x59ed80,_0x589b39){var _0x5853ae={'raw':!![],'where':{'id':_0x59ed80[_0x4122('0x49')]['id']}},_0x297937={};_0x297937[_0x4122('0x34')]=_[_0x4122('0x4a')](db[_0x4122('0x30')][_0x4122('0x4b')]);_0x297937[_0x4122('0x36')]=_[_0x4122('0x4a')](_0x59ed80[_0x4122('0x36')]);_0x297937['filters']=_[_0x4122('0x39')](_0x297937['model'],_0x297937['query']);_0x5853ae[_0x4122('0x38')]=_[_0x4122('0x39')](_0x297937[_0x4122('0x34')],qs['fields'](_0x59ed80[_0x4122('0x36')][_0x4122('0x3a')]));_0x5853ae['attributes']=_0x5853ae[_0x4122('0x38')][_0x4122('0x4c')]?_0x5853ae[_0x4122('0x38')]:_0x297937[_0x4122('0x34')];if(_0x59ed80['query'][_0x4122('0x44')]){_0x5853ae[_0x4122('0x4d')]=[{'all':!![]}];}_0x5853ae=_[_0x4122('0x42')]({},_0x5853ae,_0x59ed80[_0x4122('0x43')]);return db[_0x4122('0x30')]['find'](_0x5853ae)['then'](handleEntityNotFound(_0x589b39,null))[_0x4122('0x2a')](respondWithResult(_0x589b39,null))[_0x4122('0x47')](handleError(_0x589b39,null));};exports[_0x4122('0x4e')]=function(_0x13cc1d,_0x144d4c){return db['Cdr'][_0x4122('0x4e')](_0x13cc1d[_0x4122('0x4f')],{})[_0x4122('0x2a')](respondWithResult(_0x144d4c,0xc9))['catch'](handleError(_0x144d4c,null));};exports[_0x4122('0x29')]=function(_0x53f7d9,_0x39515c){if(_0x53f7d9[_0x4122('0x4f')]['id']){delete _0x53f7d9[_0x4122('0x4f')]['id'];}return db[_0x4122('0x30')]['find']({'where':{'id':_0x53f7d9['params']['id']}})[_0x4122('0x2a')](handleEntityNotFound(_0x39515c,null))[_0x4122('0x2a')](saveUpdates(_0x53f7d9[_0x4122('0x4f')],null))[_0x4122('0x2a')](respondWithResult(_0x39515c,null))['catch'](handleError(_0x39515c,null));};exports[_0x4122('0x50')]=function(_0x5678ff,_0x376782){return db['Cdr'][_0x4122('0x51')]({'where':{'id':_0x5678ff[_0x4122('0x49')]['id']}})[_0x4122('0x2a')](handleEntityNotFound(_0x376782,null))[_0x4122('0x2a')](removeEntity(_0x376782,null))[_0x4122('0x47')](handleError(_0x376782,null));};exports[_0x4122('0x52')]=function(_0x4fb7ac,_0xf265ed){return db['Cdr'][_0x4122('0x52')]()[_0x4122('0x2a')](respondWithResult(_0xf265ed,null))[_0x4122('0x47')](handleError(_0xf265ed,null));}; \ No newline at end of file +var _0x1cb9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','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','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr'];(function(_0x1c94a1,_0x5476cc){var _0x2a5838=function(_0x494224){while(--_0x494224){_0x1c94a1['push'](_0x1c94a1['shift']());}};_0x2a5838(++_0x5476cc);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2044d1,_0x3b5985){_0x2044d1=_0x2044d1-0x0;var _0x3fe489=_0x1cb9[_0x2044d1];return _0x3fe489;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29'));_0x504275[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x3b3ee6[_0x91cb('0x33')]);_0x504275['filters']=_[_0x91cb('0x35')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x33')]);_0x468908[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x504275['model'],qs[_0x91cb('0x37')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x37')]));_0x468908[_0x91cb('0x36')]=_0x468908[_0x91cb('0x36')]['length']?_0x468908[_0x91cb('0x36')]:_0x504275['model'];if(!_0x3b3ee6['query']['hasOwnProperty'](_0x91cb('0x38'))){_0x468908['limit']=qs[_0x91cb('0x1d')](_0x3b3ee6['query']['limit']);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x1f')]);}_0x468908[_0x91cb('0x39')]=qs['sort'](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3a')]);_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_['pick'](_0x3b3ee6['query'],_0x504275[_0x91cb('0x3c')]),_0x52670a);if(_0x3b3ee6[_0x91cb('0x33')]['filter']){_0x468908[_0x91cb('0x3b')]=_[_0x91cb('0x3d')](_0x468908['where'],{'$or':_[_0x91cb('0x2c')](_0x52670a,function(_0xddc409){if(_0xddc409['type']!==_0x91cb('0x3e')){var _0x545687={};_0x545687[_0xddc409[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3f')]+'%'};return _0x545687;}})});}_0x468908=_[_0x91cb('0x3d')]({},_0x468908,_0x3b3ee6[_0x91cb('0x40')]);var _0x20bf50={'where':_0x468908['where']};return db[_0x91cb('0x2d')][_0x91cb('0x1e')](_0x20bf50)['then'](function(_0x312581){_0x2f04a3['count']=_0x312581;if(_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x41')]){_0x468908[_0x91cb('0x42')]=[{'all':!![]}];}return db[_0x91cb('0x2d')]['findAll'](_0x468908);})[_0x91cb('0x25')](function(_0x5af0e6){_0x2f04a3[_0x91cb('0x43')]=_0x5af0e6;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x44')](handleError(_0x2fb473,null));};exports[_0x91cb('0x45')]=function(_0x451463,_0x111cc0){var _0x325dca={'raw':!![],'where':{'id':_0x451463['params']['id']}},_0x3cc4c1={};_0x3cc4c1[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x3cc4c1[_0x91cb('0x33')]=_['keys'](_0x451463[_0x91cb('0x33')]);_0x3cc4c1[_0x91cb('0x3c')]=_[_0x91cb('0x35')](_0x3cc4c1[_0x91cb('0x32')],_0x3cc4c1['query']);_0x325dca[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x3cc4c1['model'],qs[_0x91cb('0x37')](_0x451463[_0x91cb('0x33')][_0x91cb('0x37')]));_0x325dca[_0x91cb('0x36')]=_0x325dca[_0x91cb('0x36')][_0x91cb('0x46')]?_0x325dca[_0x91cb('0x36')]:_0x3cc4c1[_0x91cb('0x32')];if(_0x451463[_0x91cb('0x33')]['includeAll']){_0x325dca[_0x91cb('0x42')]=[{'all':!![]}];}_0x325dca=_[_0x91cb('0x3d')]({},_0x325dca,_0x451463[_0x91cb('0x40')]);return db[_0x91cb('0x2d')][_0x91cb('0x47')](_0x325dca)[_0x91cb('0x25')](handleEntityNotFound(_0x111cc0,null))[_0x91cb('0x25')](respondWithResult(_0x111cc0,null))[_0x91cb('0x44')](handleError(_0x111cc0,null));};exports['create']=function(_0x348d78,_0x46caf1){return db[_0x91cb('0x2d')][_0x91cb('0x48')](_0x348d78['body'],{})[_0x91cb('0x25')](respondWithResult(_0x46caf1,0xc9))[_0x91cb('0x44')](handleError(_0x46caf1,null));};exports['update']=function(_0x212473,_0x47cdb7){if(_0x212473[_0x91cb('0x49')]['id']){delete _0x212473['body']['id'];}return db['Cdr']['find']({'where':{'id':_0x212473[_0x91cb('0x4a')]['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x47cdb7,null))[_0x91cb('0x25')](saveUpdates(_0x212473[_0x91cb('0x49')],null))[_0x91cb('0x25')](respondWithResult(_0x47cdb7,null))['catch'](handleError(_0x47cdb7,null));};exports['destroy']=function(_0x1d26b8,_0xfe6692){return db[_0x91cb('0x2d')][_0x91cb('0x47')]({'where':{'id':_0x1d26b8['params']['id']}})['then'](handleEntityNotFound(_0xfe6692,null))['then'](removeEntity(_0xfe6692,null))[_0x91cb('0x44')](handleError(_0xfe6692,null));};exports['describe']=function(_0x3f22a1,_0x4aa670){return db[_0x91cb('0x2d')][_0x91cb('0x4b')]()[_0x91cb('0x25')](respondWithResult(_0x4aa670,null))[_0x91cb('0x44')](handleError(_0x4aa670,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 11d8fa1..f59b90d 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(_0x696973,_0x3b62b4){var _0x527f71=function(_0x4e0db0){while(--_0x4e0db0){_0x696973['push'](_0x696973['shift']());}};_0x527f71(++_0x3b62b4);}(_0x7a54,0x106));var _0x47a5=function(_0x8713ca,_0x1ce76d){_0x8713ca=_0x8713ca-0x0;var _0x2dc080=_0x7a54[_0x8713ca];return _0x2dc080;};'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(_0x5ed00c,_0x526749){var _0x2368e9=function(_0x452632){while(--_0x452632){_0x5ed00c['push'](_0x5ed00c['shift']());}};_0x2368e9(++_0x526749);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 a7c8824..3b1c894 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 _0xf34b=['debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf34b,0xe5));var _0xbf34=function(_0x46e4fd,_0x2a3819){_0x46e4fd=_0x46e4fd-0x0;var _0x2032e1=_0xf34b[_0x46e4fd];return _0x2032e1;};'use strict';var _=require('lodash');var util=require(_0xbf34('0x0'));var moment=require(_0xbf34('0x1'));var BPromise=require(_0xbf34('0x2'));var rs=require(_0xbf34('0x3'));var fs=require('fs');var Redis=require(_0xbf34('0x4'));var db=require(_0xbf34('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf34('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbf34('0x7'));var client=jayson[_0xbf34('0x8')][_0xbf34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x495e47,_0x136354,_0x1f50c3){return new BPromise(function(_0x3e1ce2,_0x35897e){return client['request'](_0x495e47,_0x1f50c3)[_0xbf34('0xa')](function(_0x212bc5){logger[_0xbf34('0xb')](_0xbf34('0xc'),_0x136354,'request\x20sent');logger[_0xbf34('0xd')](_0xbf34('0xe'),_0x136354,_0xbf34('0xf'),JSON[_0xbf34('0x10')](_0x212bc5));if(_0x212bc5[_0xbf34('0x11')]){if(_0x212bc5[_0xbf34('0x11')][_0xbf34('0x12')]===0x1f4){logger[_0xbf34('0x11')](_0xbf34('0xc'),_0x136354,_0x212bc5[_0xbf34('0x11')][_0xbf34('0x13')]);return _0x35897e(_0x212bc5[_0xbf34('0x11')]['message']);}logger[_0xbf34('0x11')](_0xbf34('0xc'),_0x136354,_0x212bc5[_0xbf34('0x11')][_0xbf34('0x13')]);return _0x3e1ce2(_0x212bc5[_0xbf34('0x11')][_0xbf34('0x13')]);}else{logger[_0xbf34('0xb')](_0xbf34('0xc'),_0x136354,'request\x20sent');_0x3e1ce2(_0x212bc5[_0xbf34('0x14')][_0xbf34('0x13')]);}})[_0xbf34('0x15')](function(_0x198e9c){logger[_0xbf34('0x11')](_0xbf34('0xc'),_0x136354,_0x198e9c);_0x35897e(_0x198e9c);});});} \ No newline at end of file +var _0x2b87=['request\x20sent','debug','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s'];(function(_0x3de1c9,_0x47ab64){var _0x5e8188=function(_0x59135e){while(--_0x59135e){_0x3de1c9['push'](_0x3de1c9['shift']());}};_0x5e8188(++_0x47ab64);}(_0x2b87,0x75));var _0x72b8=function(_0x4443d8,_0x1091e3){_0x4443d8=_0x4443d8-0x0;var _0x34c4a1=_0x2b87[_0x4443d8];return _0x34c4a1;};'use strict';var _=require(_0x72b8('0x0'));var util=require(_0x72b8('0x1'));var moment=require('moment');var BPromise=require(_0x72b8('0x2'));var rs=require(_0x72b8('0x3'));var fs=require('fs');var Redis=require(_0x72b8('0x4'));var db=require(_0x72b8('0x5'))['db'];var utils=require(_0x72b8('0x6'));var logger=require(_0x72b8('0x7'))('rpc');var config=require(_0x72b8('0x8'));var jayson=require(_0x72b8('0x9'));var client=jayson[_0x72b8('0xa')][_0x72b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18f3e2,_0x1fc70c,_0x4446ed){return new BPromise(function(_0x4affda,_0x432dc5){return client[_0x72b8('0xc')](_0x18f3e2,_0x4446ed)[_0x72b8('0xd')](function(_0x173265){logger['info'](_0x72b8('0xe'),_0x1fc70c,_0x72b8('0xf'));logger[_0x72b8('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x1fc70c,_0x72b8('0xf'),JSON['stringify'](_0x173265));if(_0x173265[_0x72b8('0x11')]){if(_0x173265[_0x72b8('0x11')][_0x72b8('0x12')]===0x1f4){logger['error'](_0x72b8('0xe'),_0x1fc70c,_0x173265[_0x72b8('0x11')][_0x72b8('0x13')]);return _0x432dc5(_0x173265[_0x72b8('0x11')][_0x72b8('0x13')]);}logger[_0x72b8('0x11')](_0x72b8('0xe'),_0x1fc70c,_0x173265[_0x72b8('0x11')][_0x72b8('0x13')]);return _0x4affda(_0x173265['error'][_0x72b8('0x13')]);}else{logger[_0x72b8('0x14')](_0x72b8('0xe'),_0x1fc70c,_0x72b8('0xf'));_0x4affda(_0x173265[_0x72b8('0x15')][_0x72b8('0x13')]);}})['catch'](function(_0x7a3f04){logger[_0x72b8('0x11')]('Cdr,\x20%s,\x20%s',_0x1fc70c,_0x7a3f04);_0x432dc5(_0x7a3f04);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c527281..896b345 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(_0x46891a,_0x3e3051){var _0x4c578d=function(_0x3cf400){while(--_0x3cf400){_0x46891a['push'](_0x46891a['shift']());}};_0x4c578d(++_0x3e3051);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 24f61d0..38bfda5 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 _0x4089=['INTEGER','STRING','noop','*,*,*,*'];(function(_0x43fd11,_0x5f4a49){var _0x402181=function(_0x4e2ab2){while(--_0x4e2ab2){_0x43fd11['push'](_0x43fd11['shift']());}};_0x402181(++_0x5f4a49);}(_0x4089,0x84));var _0x9408=function(_0x30fb66,_0x35da54){_0x30fb66=_0x30fb66-0x0;var _0x2880d9=_0x4089[_0x30fb66];return _0x2880d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x9408('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x9408('0x1')],'allowNull':![],'defaultValue':_0x9408('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9408('0x1')]},'interval':{'type':Sequelize[_0x9408('0x1')],'defaultValue':_0x9408('0x3')}}; \ No newline at end of file +var _0x6598=['noop','STRING','*,*,*,*','sequelize'];(function(_0x1d8f95,_0xcd1d0e){var _0x4cb618=function(_0xddea13){while(--_0xddea13){_0x1d8f95['push'](_0x1d8f95['shift']());}};_0x4cb618(++_0xcd1d0e);}(_0x6598,0x1cb));var _0x8659=function(_0x1073cc,_0x35a19c){_0x1073cc=_0x1073cc-0x0;var _0x34a481=_0x6598[_0x1073cc];return _0x34a481;};'use strict';var Sequelize=require(_0x8659('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8659('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8659('0x2')],'defaultValue':_0x8659('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c358aef..4206474 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 _0xd52d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','ChatApplication','catch','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x541c5d,_0x2ef384){var _0x3568b5=function(_0x589bd1){while(--_0x589bd1){_0x541c5d['push'](_0x541c5d['shift']());}};_0x3568b5(++_0x2ef384);}(_0xd52d,0x1c7));var _0xdd52=function(_0x2a5497,_0x19bceb){_0x2a5497=_0x2a5497-0x0;var _0x5a335a=_0xd52d[_0x2a5497];return _0x5a335a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd52('0x0'));var zipdir=require(_0xdd52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd52('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdd52('0x3'));var util=require(_0xdd52('0x4'));var path=require(_0xdd52('0x5'));var sox=require(_0xdd52('0x6'));var csv=require(_0xdd52('0x7'));var ejs=require(_0xdd52('0x8'));var fs=require('fs');var fs_extra=require(_0xdd52('0x9'));var _=require(_0xdd52('0xa'));var squel=require('squel');var crypto=require(_0xdd52('0xb'));var jsforce=require(_0xdd52('0xc'));var deskjs=require(_0xdd52('0xd'));var toCsv=require(_0xdd52('0x7'));var querystring=require(_0xdd52('0xe'));var Papa=require(_0xdd52('0xf'));var Redis=require(_0xdd52('0x10'));var authService=require(_0xdd52('0x11'));var qs=require(_0xdd52('0x12'));var as=require(_0xdd52('0x13'));var hardwareService=require(_0xdd52('0x14'));var logger=require(_0xdd52('0x15'))(_0xdd52('0x16'));var utils=require('../../config/utils');var config=require(_0xdd52('0x17'));var licenseUtil=require(_0xdd52('0x18'));var db=require(_0xdd52('0x19'))['db'];function respondWithStatusCode(_0x2e940f,_0x19283f){_0x19283f=_0x19283f||0xcc;return function(_0xee8463){if(_0xee8463){return _0x2e940f['sendStatus'](_0x19283f);}return _0x2e940f[_0xdd52('0x1a')](_0x19283f)[_0xdd52('0x1b')]();};}function respondWithResult(_0x2e5642,_0x55b823){_0x55b823=_0x55b823||0xc8;return function(_0x3f6585){if(_0x3f6585){return _0x2e5642[_0xdd52('0x1a')](_0x55b823)[_0xdd52('0x1c')](_0x3f6585);}};}function respondWithFilteredResult(_0x181876,_0x336797){return function(_0x12c6da){if(_0x12c6da){var _0x25a2b7=typeof _0x336797[_0xdd52('0x1d')]==='undefined'&&typeof _0x336797[_0xdd52('0x1e')]==='undefined';var _0x2822be=_0x12c6da[_0xdd52('0x1f')];var _0x4568dc=_0x25a2b7?0x0:_0x336797[_0xdd52('0x1d')];var _0x4dc017=_0x25a2b7?_0x12c6da[_0xdd52('0x1f')]:_0x336797[_0xdd52('0x1d')]+_0x336797[_0xdd52('0x1e')];var _0x13f667;if(_0x4dc017>=_0x2822be){_0x4dc017=_0x2822be;_0x13f667=0xc8;}else{_0x13f667=0xce;}_0x181876['status'](_0x13f667);return _0x181876[_0xdd52('0x20')]('Content-Range',_0x4568dc+'-'+_0x4dc017+'/'+_0x2822be)[_0xdd52('0x1c')](_0x12c6da);}return null;};}function patchUpdates(_0x56e1db){return function(_0x30c411){try{jsonpatch[_0xdd52('0x21')](_0x30c411,_0x56e1db,!![]);}catch(_0x5a671a){return BPromise[_0xdd52('0x22')](_0x5a671a);}return _0x30c411['save']();};}function saveUpdates(_0x38c153,_0x59a041){return function(_0x14cd54){if(_0x14cd54){return _0x14cd54[_0xdd52('0x23')](_0x38c153)[_0xdd52('0x24')](function(_0xfd321){return _0xfd321;});}return null;};}function removeEntity(_0x1e8dbb,_0x455e74){return function(_0x3ce226){if(_0x3ce226){return _0x3ce226[_0xdd52('0x25')]()['then'](function(){_0x1e8dbb[_0xdd52('0x1a')](0xcc)[_0xdd52('0x1b')]();});}};}function handleEntityNotFound(_0x592f15,_0x1156cc){return function(_0x353fde){if(!_0x353fde){_0x592f15[_0xdd52('0x26')](0x194);}return _0x353fde;};}function handleError(_0x2f2dfa,_0x4ee66d){_0x4ee66d=_0x4ee66d||0x1f4;return function(_0x41c7e5){logger[_0xdd52('0x27')](_0x41c7e5[_0xdd52('0x28')]);if(_0x41c7e5['name']){delete _0x41c7e5['name'];}_0x2f2dfa[_0xdd52('0x1a')](_0x4ee66d)['send'](_0x41c7e5);};}exports[_0xdd52('0x29')]=function(_0x3f96bd,_0xeb81a0){var _0x539418={'raw':!![],'where':{'id':_0x3f96bd[_0xdd52('0x2a')]['id']}},_0x499e14={};_0x499e14[_0xdd52('0x2b')]=_[_0xdd52('0x2c')](db['ChatApplication']['rawAttributes']);_0x499e14[_0xdd52('0x2d')]=_['keys'](_0x3f96bd[_0xdd52('0x2d')]);_0x499e14[_0xdd52('0x2e')]=_[_0xdd52('0x2f')](_0x499e14[_0xdd52('0x2b')],_0x499e14[_0xdd52('0x2d')]);_0x539418[_0xdd52('0x30')]=_[_0xdd52('0x2f')](_0x499e14[_0xdd52('0x2b')],qs[_0xdd52('0x31')](_0x3f96bd[_0xdd52('0x2d')][_0xdd52('0x31')]));_0x539418[_0xdd52('0x30')]=_0x539418[_0xdd52('0x30')][_0xdd52('0x32')]?_0x539418[_0xdd52('0x30')]:_0x499e14[_0xdd52('0x2b')];if(_0x3f96bd[_0xdd52('0x2d')][_0xdd52('0x33')]){_0x539418[_0xdd52('0x34')]=[{'all':!![]}];}_0x539418=_[_0xdd52('0x35')]({},_0x539418,_0x3f96bd[_0xdd52('0x36')]);return db['ChatApplication'][_0xdd52('0x37')](_0x539418)[_0xdd52('0x24')](handleEntityNotFound(_0xeb81a0,null))['then'](respondWithResult(_0xeb81a0,null))['catch'](handleError(_0xeb81a0,null));};exports['update']=function(_0x17f735,_0x10d053){if(_0x17f735[_0xdd52('0x38')]['id']){delete _0x17f735[_0xdd52('0x38')]['id'];}return db[_0xdd52('0x39')][_0xdd52('0x37')]({'where':{'id':_0x17f735[_0xdd52('0x2a')]['id']}})[_0xdd52('0x24')](handleEntityNotFound(_0x10d053,null))[_0xdd52('0x24')](saveUpdates(_0x17f735[_0xdd52('0x38')],null))['then'](respondWithResult(_0x10d053,null))[_0xdd52('0x3a')](handleError(_0x10d053,null));};exports[_0xdd52('0x25')]=function(_0x19ab35,_0x3497c3){return db[_0xdd52('0x39')][_0xdd52('0x37')]({'where':{'id':_0x19ab35[_0xdd52('0x2a')]['id']}})[_0xdd52('0x24')](handleEntityNotFound(_0x3497c3,null))[_0xdd52('0x24')](removeEntity(_0x3497c3,null))[_0xdd52('0x3a')](handleError(_0x3497c3,null));}; \ No newline at end of file +var _0x67da=['end','sendStatus','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x67da,0x192));var _0xa67d=function(_0x688de0,_0x3cb0dd){_0x688de0=_0x688de0-0x0;var _0x220f5d=_0x67da[_0x688de0];return _0x220f5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa67d('0x0'));var zipdir=require(_0xa67d('0x1'));var jsonpatch=require(_0xa67d('0x2'));var rp=require(_0xa67d('0x3'));var moment=require(_0xa67d('0x4'));var BPromise=require(_0xa67d('0x5'));var Mustache=require(_0xa67d('0x6'));var util=require(_0xa67d('0x7'));var path=require(_0xa67d('0x8'));var sox=require(_0xa67d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa67d('0xa'));var _=require('lodash');var squel=require(_0xa67d('0xb'));var crypto=require(_0xa67d('0xc'));var jsforce=require(_0xa67d('0xd'));var deskjs=require(_0xa67d('0xe'));var toCsv=require(_0xa67d('0xf'));var querystring=require(_0xa67d('0x10'));var Papa=require(_0xa67d('0x11'));var Redis=require(_0xa67d('0x12'));var authService=require(_0xa67d('0x13'));var qs=require(_0xa67d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67d('0x15'));var logger=require(_0xa67d('0x16'))(_0xa67d('0x17'));var utils=require(_0xa67d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa67d('0x19'));var db=require(_0xa67d('0x1a'))['db'];function respondWithStatusCode(_0x560485,_0x4e86f6){_0x4e86f6=_0x4e86f6||0xcc;return function(_0x304ee2){if(_0x304ee2){return _0x560485['sendStatus'](_0x4e86f6);}return _0x560485[_0xa67d('0x1b')](_0x4e86f6)['end']();};}function respondWithResult(_0x5d757b,_0x22dcc7){_0x22dcc7=_0x22dcc7||0xc8;return function(_0x3b99e3){if(_0x3b99e3){return _0x5d757b['status'](_0x22dcc7)[_0xa67d('0x1c')](_0x3b99e3);}};}function respondWithFilteredResult(_0x267a67,_0x1cfe81){return function(_0x288e5f){if(_0x288e5f){var _0x5a47de=typeof _0x1cfe81['offset']==='undefined'&&typeof _0x1cfe81['limit']===_0xa67d('0x1d');var _0x553811=_0x288e5f[_0xa67d('0x1e')];var _0xf8422c=_0x5a47de?0x0:_0x1cfe81[_0xa67d('0x1f')];var _0x1b58c3=_0x5a47de?_0x288e5f[_0xa67d('0x1e')]:_0x1cfe81[_0xa67d('0x1f')]+_0x1cfe81[_0xa67d('0x20')];var _0x5538a5;if(_0x1b58c3>=_0x553811){_0x1b58c3=_0x553811;_0x5538a5=0xc8;}else{_0x5538a5=0xce;}_0x267a67[_0xa67d('0x1b')](_0x5538a5);return _0x267a67[_0xa67d('0x21')](_0xa67d('0x22'),_0xf8422c+'-'+_0x1b58c3+'/'+_0x553811)[_0xa67d('0x1c')](_0x288e5f);}return null;};}function patchUpdates(_0x28f38b){return function(_0x1c3498){try{jsonpatch['apply'](_0x1c3498,_0x28f38b,!![]);}catch(_0x3f1898){return BPromise[_0xa67d('0x23')](_0x3f1898);}return _0x1c3498[_0xa67d('0x24')]();};}function saveUpdates(_0xed6c3e,_0x48f240){return function(_0x276ef7){if(_0x276ef7){return _0x276ef7['update'](_0xed6c3e)[_0xa67d('0x25')](function(_0x415141){return _0x415141;});}return null;};}function removeEntity(_0x46bbc8,_0x9c2935){return function(_0x559009){if(_0x559009){return _0x559009[_0xa67d('0x26')]()[_0xa67d('0x25')](function(){_0x46bbc8['status'](0xcc)[_0xa67d('0x27')]();});}};}function handleEntityNotFound(_0x3dd0b9,_0x2b890c){return function(_0xe0c7b2){if(!_0xe0c7b2){_0x3dd0b9[_0xa67d('0x28')](0x194);}return _0xe0c7b2;};}function handleError(_0x1d6e68,_0x5ef92a){_0x5ef92a=_0x5ef92a||0x1f4;return function(_0x435e56){logger[_0xa67d('0x29')](_0x435e56['stack']);if(_0x435e56[_0xa67d('0x2a')]){delete _0x435e56[_0xa67d('0x2a')];}_0x1d6e68[_0xa67d('0x1b')](_0x5ef92a)[_0xa67d('0x2b')](_0x435e56);};}exports[_0xa67d('0x2c')]=function(_0x8793cf,_0x42c858){var _0xf4fc64={'raw':!![],'where':{'id':_0x8793cf[_0xa67d('0x2d')]['id']}},_0x204f83={};_0x204f83[_0xa67d('0x2e')]=_[_0xa67d('0x2f')](db[_0xa67d('0x30')][_0xa67d('0x31')]);_0x204f83['query']=_[_0xa67d('0x2f')](_0x8793cf[_0xa67d('0x32')]);_0x204f83[_0xa67d('0x33')]=_[_0xa67d('0x34')](_0x204f83[_0xa67d('0x2e')],_0x204f83['query']);_0xf4fc64[_0xa67d('0x35')]=_[_0xa67d('0x34')](_0x204f83[_0xa67d('0x2e')],qs[_0xa67d('0x36')](_0x8793cf[_0xa67d('0x32')][_0xa67d('0x36')]));_0xf4fc64[_0xa67d('0x35')]=_0xf4fc64[_0xa67d('0x35')][_0xa67d('0x37')]?_0xf4fc64[_0xa67d('0x35')]:_0x204f83['model'];if(_0x8793cf[_0xa67d('0x32')]['includeAll']){_0xf4fc64[_0xa67d('0x38')]=[{'all':!![]}];}_0xf4fc64=_[_0xa67d('0x39')]({},_0xf4fc64,_0x8793cf[_0xa67d('0x3a')]);return db['ChatApplication'][_0xa67d('0x3b')](_0xf4fc64)[_0xa67d('0x25')](handleEntityNotFound(_0x42c858,null))[_0xa67d('0x25')](respondWithResult(_0x42c858,null))[_0xa67d('0x3c')](handleError(_0x42c858,null));};exports[_0xa67d('0x3d')]=function(_0x199e8f,_0x4ded76){if(_0x199e8f[_0xa67d('0x3e')]['id']){delete _0x199e8f[_0xa67d('0x3e')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x199e8f['params']['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x4ded76,null))['then'](saveUpdates(_0x199e8f[_0xa67d('0x3e')],null))[_0xa67d('0x25')](respondWithResult(_0x4ded76,null))[_0xa67d('0x3c')](handleError(_0x4ded76,null));};exports[_0xa67d('0x26')]=function(_0x35a0a0,_0x44310e){return db[_0xa67d('0x30')][_0xa67d('0x3b')]({'where':{'id':_0x35a0a0[_0xa67d('0x2d')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x44310e,null))[_0xa67d('0x25')](removeEntity(_0x44310e,null))[_0xa67d('0x3c')](handleError(_0x44310e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 3c1ba58..ace1f8e 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 _0xd2d6=['rimraf','../../config/environment','./chatApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xd2d6,0xa3));var _0x6d2d=function(_0x2b30cc,_0x54f567){_0x2b30cc=_0x2b30cc-0x0;var _0x39122c=_0xd2d6[_0x2b30cc];return _0x39122c;};'use strict';var _=require(_0x6d2d('0x0'));var util=require(_0x6d2d('0x1'));var logger=require(_0x6d2d('0x2'))('api');var moment=require(_0x6d2d('0x3'));var BPromise=require(_0x6d2d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d2d('0x5'));var rimraf=require(_0x6d2d('0x6'));var config=require(_0x6d2d('0x7'));var attributes=require(_0x6d2d('0x8'));module[_0x6d2d('0x9')]=function(_0x43dfa0,_0x3575eb){return _0x43dfa0[_0x6d2d('0xa')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d2d('0xb'),'collate':_0x6d2d('0xc')});}; \ No newline at end of file +var _0x5137=['./chatApplication.attributes','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x147b6b,_0x23c714){var _0x8da7ac=function(_0x282beb){while(--_0x282beb){_0x147b6b['push'](_0x147b6b['shift']());}};_0x8da7ac(++_0x23c714);}(_0x5137,0x1e5));var _0x7513=function(_0x3379af,_0x416f71){_0x3379af=_0x3379af-0x0;var _0x30134e=_0x5137[_0x3379af];return _0x30134e;};'use strict';var _=require(_0x7513('0x0'));var util=require(_0x7513('0x1'));var logger=require(_0x7513('0x2'))('api');var moment=require(_0x7513('0x3'));var BPromise=require('bluebird');var rp=require(_0x7513('0x4'));var fs=require('fs');var path=require(_0x7513('0x5'));var rimraf=require('rimraf');var config=require(_0x7513('0x6'));var attributes=require(_0x7513('0x7'));module['exports']=function(_0x5c7bdc,_0x1ceb08){return _0x5c7bdc['define'](_0x7513('0x8'),attributes,{'tableName':_0x7513('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7513('0xa'),'collate':_0x7513('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 97d4ef2..eb21030 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 _0x1ec9=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ChatApplication,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x1ec9,0x142));var _0x91ec=function(_0x7dfaa,_0x1c8ae2){_0x7dfaa=_0x7dfaa-0x0;var _0x561f7d=_0x1ec9[_0x7dfaa];return _0x561f7d;};'use strict';var _=require(_0x91ec('0x0'));var util=require(_0x91ec('0x1'));var moment=require('moment');var BPromise=require(_0x91ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91ec('0x3'))['db'];var utils=require(_0x91ec('0x4'));var logger=require(_0x91ec('0x5'))(_0x91ec('0x6'));var config=require(_0x91ec('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x91ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x539328,_0x4266ed,_0xdfe11d){return new BPromise(function(_0x5ccb50,_0x198664){return client[_0x91ec('0x9')](_0x539328,_0xdfe11d)[_0x91ec('0xa')](function(_0x42f1a2){logger['info'](_0x91ec('0xb'),_0x4266ed,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4266ed,'request\x20sent',JSON[_0x91ec('0xc')](_0x42f1a2));if(_0x42f1a2[_0x91ec('0xd')]){if(_0x42f1a2['error'][_0x91ec('0xe')]===0x1f4){logger[_0x91ec('0xd')](_0x91ec('0xb'),_0x4266ed,_0x42f1a2[_0x91ec('0xd')][_0x91ec('0xf')]);return _0x198664(_0x42f1a2[_0x91ec('0xd')][_0x91ec('0xf')]);}logger[_0x91ec('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4266ed,_0x42f1a2[_0x91ec('0xd')][_0x91ec('0xf')]);return _0x5ccb50(_0x42f1a2[_0x91ec('0xd')]['message']);}else{logger[_0x91ec('0x10')]('ChatApplication,\x20%s,\x20%s',_0x4266ed,'request\x20sent');_0x5ccb50(_0x42f1a2[_0x91ec('0x11')][_0x91ec('0xf')]);}})[_0x91ec('0x12')](function(_0x4075ed){logger[_0x91ec('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4266ed,_0x4075ed);_0x198664(_0x4075ed);});});} \ No newline at end of file +var _0x8952=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x8952,0x75));var _0x2895=function(_0x4bd5c8,_0x3ef87e){_0x4bd5c8=_0x4bd5c8-0x0;var _0x50cfda=_0x8952[_0x4bd5c8];return _0x50cfda;};'use strict';var _=require(_0x2895('0x0'));var util=require(_0x2895('0x1'));var moment=require(_0x2895('0x2'));var BPromise=require(_0x2895('0x3'));var rs=require(_0x2895('0x4'));var fs=require('fs');var Redis=require(_0x2895('0x5'));var db=require(_0x2895('0x6'))['db'];var utils=require(_0x2895('0x7'));var logger=require(_0x2895('0x8'))(_0x2895('0x9'));var config=require(_0x2895('0xa'));var jayson=require(_0x2895('0xb'));var client=jayson['client'][_0x2895('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ff232,_0x11adc8,_0x5a5766){return new BPromise(function(_0x462fbf,_0x1fb8e4){return client[_0x2895('0xd')](_0x2ff232,_0x5a5766)[_0x2895('0xe')](function(_0x112962){logger['info']('ChatApplication,\x20%s,\x20%s',_0x11adc8,_0x2895('0xf'));logger['debug'](_0x2895('0x10'),_0x11adc8,_0x2895('0xf'),JSON[_0x2895('0x11')](_0x112962));if(_0x112962['error']){if(_0x112962[_0x2895('0x12')]['code']===0x1f4){logger['error'](_0x2895('0x13'),_0x11adc8,_0x112962[_0x2895('0x12')][_0x2895('0x14')]);return _0x1fb8e4(_0x112962['error'][_0x2895('0x14')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x11adc8,_0x112962[_0x2895('0x12')][_0x2895('0x14')]);return _0x462fbf(_0x112962[_0x2895('0x12')]['message']);}else{logger['info'](_0x2895('0x13'),_0x11adc8,_0x2895('0xf'));_0x462fbf(_0x112962[_0x2895('0x15')]['message']);}})[_0x2895('0x16')](function(_0x3e3032){logger[_0x2895('0x12')]('ChatApplication,\x20%s,\x20%s',_0x11adc8,_0x3e3032);_0x1fb8e4(_0x3e3032);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index ef4ed64..810ab20 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 _0xaa79=['../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x8c20da,_0x49cfd6){var _0x50d918=function(_0xeaf97d){while(--_0xeaf97d){_0x8c20da['push'](_0x8c20da['shift']());}};_0x50d918(++_0x49cfd6);}(_0xaa79,0xd6));var _0x9aa7=function(_0x396052,_0x46a315){_0x396052=_0x396052-0x0;var _0x2221c4=_0xaa79[_0x396052];return _0x2221c4;};'use strict';var multer=require(_0x9aa7('0x0'));var util=require(_0x9aa7('0x1'));var path=require(_0x9aa7('0x2'));var timeout=require(_0x9aa7('0x3'));var express=require(_0x9aa7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9aa7('0x5'));var interaction=require(_0x9aa7('0x6'));var config=require(_0x9aa7('0x7'));var controller=require(_0x9aa7('0x8'));router[_0x9aa7('0x9')](_0x9aa7('0xa'),auth[_0x9aa7('0xb')](),controller[_0x9aa7('0xc')]);router['put'](_0x9aa7('0xa'),auth[_0x9aa7('0xb')](),controller[_0x9aa7('0xd')]);router[_0x9aa7('0xe')]('/:id',auth[_0x9aa7('0xb')](),controller[_0x9aa7('0xf')]);module[_0x9aa7('0x10')]=router; \ No newline at end of file +var _0x3fe1=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','exports'];(function(_0x407fda,_0x3967f7){var _0x3b0fe2=function(_0x1a47ec){while(--_0x1a47ec){_0x407fda['push'](_0x407fda['shift']());}};_0x3b0fe2(++_0x3967f7);}(_0x3fe1,0x1a4));var _0x13fe=function(_0x545ced,_0x2eb3d3){_0x545ced=_0x545ced-0x0;var _0x40da32=_0x3fe1[_0x545ced];return _0x40da32;};'use strict';var multer=require(_0x13fe('0x0'));var util=require('util');var path=require(_0x13fe('0x1'));var timeout=require('connect-timeout');var express=require(_0x13fe('0x2'));var router=express[_0x13fe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x13fe('0x4'));var interaction=require(_0x13fe('0x5'));var config=require('../../config/environment');var controller=require(_0x13fe('0x6'));router[_0x13fe('0x7')](_0x13fe('0x8'),auth[_0x13fe('0x9')](),controller[_0x13fe('0xa')]);router[_0x13fe('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x13fe('0xc')]);router['delete']('/:id',auth[_0x13fe('0x9')](),controller['destroy']);module[_0x13fe('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 41dcc55..477a5b5 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 _0xc177=['STRING','BOOLEAN','sequelize','exports'];(function(_0x51c021,_0x1706ca){var _0xab7c52=function(_0x32f913){while(--_0x32f913){_0x51c021['push'](_0x51c021['shift']());}};_0xab7c52(++_0x1706ca);}(_0xc177,0x1b2));var _0x7c17=function(_0x319f8c,_0x4db9c4){_0x319f8c=_0x319f8c-0x0;var _0x9be6dc=_0xc177[_0x319f8c];return _0x9be6dc;};'use strict';var Sequelize=require(_0x7c17('0x0'));module[_0x7c17('0x1')]={'name':{'type':Sequelize[_0x7c17('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7c17('0x2')]},'write':{'type':Sequelize[_0x7c17('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x09a7=['BOOLEAN','sequelize','STRING'];(function(_0x40f52b,_0x5d64d9){var _0x107c47=function(_0x4668a0){while(--_0x4668a0){_0x40f52b['push'](_0x40f52b['shift']());}};_0x107c47(++_0x5d64d9);}(_0x09a7,0x15d));var _0x709a=function(_0x4db784,_0x11e9f2){_0x4db784=_0x4db784-0x0;var _0x343347=_0x09a7[_0x4db784];return _0x343347;};'use strict';var Sequelize=require(_0x709a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x709a('0x1')]},'write':{'type':Sequelize[_0x709a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 268f618..73bb95e 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 _0xfcb2=['offset','undefined','limit','count','Content-Range','json','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','where','merge','VIRTUAL','includeAll','ChatGroup','rows','catch','show','params','include','options','find','create','body','getUnread','ChatInternalMessage','addMembers','ids','omit','pick','filter','length','hasOwnProperty','getMembers','removeMembers','addMessage','ChatGroupId','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','end','status'];(function(_0x14d17d,_0x56493b){var _0x388bb6=function(_0x3dd963){while(--_0x3dd963){_0x14d17d['push'](_0x14d17d['shift']());}};_0x388bb6(++_0x56493b);}(_0xfcb2,0xa2));var _0x2fcb=function(_0x523297,_0x15f343){_0x523297=_0x523297-0x0;var _0x530017=_0xfcb2[_0x523297];return _0x530017;};'use strict';var emlformat=require(_0x2fcb('0x0'));var rimraf=require(_0x2fcb('0x1'));var zipdir=require(_0x2fcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fcb('0x3'));var moment=require('moment');var BPromise=require(_0x2fcb('0x4'));var Mustache=require(_0x2fcb('0x5'));var util=require(_0x2fcb('0x6'));var path=require(_0x2fcb('0x7'));var sox=require(_0x2fcb('0x8'));var csv=require('to-csv');var ejs=require(_0x2fcb('0x9'));var fs=require('fs');var fs_extra=require(_0x2fcb('0xa'));var _=require(_0x2fcb('0xb'));var squel=require('squel');var crypto=require(_0x2fcb('0xc'));var jsforce=require(_0x2fcb('0xd'));var deskjs=require(_0x2fcb('0xe'));var toCsv=require(_0x2fcb('0xf'));var querystring=require('querystring');var Papa=require(_0x2fcb('0x10'));var Redis=require(_0x2fcb('0x11'));var authService=require(_0x2fcb('0x12'));var qs=require(_0x2fcb('0x13'));var as=require(_0x2fcb('0x14'));var hardwareService=require(_0x2fcb('0x15'));var logger=require(_0x2fcb('0x16'))(_0x2fcb('0x17'));var utils=require(_0x2fcb('0x18'));var config=require(_0x2fcb('0x19'));var licenseUtil=require(_0x2fcb('0x1a'));var db=require(_0x2fcb('0x1b'))['db'];config['redis']=_[_0x2fcb('0x1c')](config[_0x2fcb('0x1d')],{'host':_0x2fcb('0x1e'),'port':0x18eb});var socket=require(_0x2fcb('0x1f'))(new Redis(config[_0x2fcb('0x1d')]));require(_0x2fcb('0x20'))['register'](socket);function respondWithStatusCode(_0x1bc884,_0xba21d7){_0xba21d7=_0xba21d7||0xcc;return function(_0x3d69ce){if(_0x3d69ce){return _0x1bc884[_0x2fcb('0x21')](_0xba21d7);}return _0x1bc884['status'](_0xba21d7)[_0x2fcb('0x22')]();};}function respondWithResult(_0x8e5a34,_0x2f1a49){_0x2f1a49=_0x2f1a49||0xc8;return function(_0x2c0d19){if(_0x2c0d19){return _0x8e5a34[_0x2fcb('0x23')](_0x2f1a49)['json'](_0x2c0d19);}};}function respondWithFilteredResult(_0x4453fb,_0x28dd2d){return function(_0x5311b1){if(_0x5311b1){var _0x10ffbc=typeof _0x28dd2d[_0x2fcb('0x24')]===_0x2fcb('0x25')&&typeof _0x28dd2d[_0x2fcb('0x26')]===_0x2fcb('0x25');var _0x1f68aa=_0x5311b1[_0x2fcb('0x27')];var _0x5bf009=_0x10ffbc?0x0:_0x28dd2d[_0x2fcb('0x24')];var _0x518d68=_0x10ffbc?_0x5311b1[_0x2fcb('0x27')]:_0x28dd2d[_0x2fcb('0x24')]+_0x28dd2d[_0x2fcb('0x26')];var _0x1c674d;if(_0x518d68>=_0x1f68aa){_0x518d68=_0x1f68aa;_0x1c674d=0xc8;}else{_0x1c674d=0xce;}_0x4453fb[_0x2fcb('0x23')](_0x1c674d);return _0x4453fb['set'](_0x2fcb('0x28'),_0x5bf009+'-'+_0x518d68+'/'+_0x1f68aa)[_0x2fcb('0x29')](_0x5311b1);}return null;};}function patchUpdates(_0x155464){return function(_0x35159b){try{jsonpatch['apply'](_0x35159b,_0x155464,!![]);}catch(_0x59c5c8){return BPromise['reject'](_0x59c5c8);}return _0x35159b[_0x2fcb('0x2a')]();};}function saveUpdates(_0x41bb07,_0x4e1f71){return function(_0x53b6ed){if(_0x53b6ed){return _0x53b6ed[_0x2fcb('0x2b')](_0x41bb07)['then'](function(_0x5b4498){return _0x5b4498;});}return null;};}function removeEntity(_0x243786,_0x51e378){return function(_0x131383){if(_0x131383){return _0x131383[_0x2fcb('0x2c')]()[_0x2fcb('0x2d')](function(){_0x243786[_0x2fcb('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a847,_0x326298){return function(_0x311904){if(!_0x311904){_0x51a847[_0x2fcb('0x21')](0x194);}return _0x311904;};}function handleError(_0xc4d7fe,_0x34d225){_0x34d225=_0x34d225||0x1f4;return function(_0x4b5464){logger[_0x2fcb('0x2e')](_0x4b5464[_0x2fcb('0x2f')]);if(_0x4b5464[_0x2fcb('0x30')]){delete _0x4b5464[_0x2fcb('0x30')];}_0xc4d7fe[_0x2fcb('0x23')](_0x34d225)[_0x2fcb('0x31')](_0x4b5464);};}exports[_0x2fcb('0x32')]=function(_0x72424b,_0x4858b9){var _0x469d66={},_0x1b186f={},_0x5d836c={'count':0x0,'rows':[]};var _0x5542c8=_[_0x2fcb('0x33')](db['ChatGroup'][_0x2fcb('0x34')],function(_0x2d3c1e){return{'name':_0x2d3c1e[_0x2fcb('0x35')],'type':_0x2d3c1e[_0x2fcb('0x36')][_0x2fcb('0x37')]};});_0x1b186f[_0x2fcb('0x38')]=_[_0x2fcb('0x33')](_0x5542c8,_0x2fcb('0x30'));_0x1b186f[_0x2fcb('0x39')]=_[_0x2fcb('0x3a')](_0x72424b[_0x2fcb('0x39')]);_0x1b186f['filters']=_[_0x2fcb('0x3b')](_0x1b186f[_0x2fcb('0x38')],_0x1b186f[_0x2fcb('0x39')]);_0x469d66[_0x2fcb('0x3c')]=_[_0x2fcb('0x3b')](_0x1b186f[_0x2fcb('0x38')],qs['fields'](_0x72424b[_0x2fcb('0x39')][_0x2fcb('0x3d')]));_0x469d66['attributes']=_0x469d66[_0x2fcb('0x3c')]['length']?_0x469d66['attributes']:_0x1b186f['model'];if(!_0x72424b[_0x2fcb('0x39')]['hasOwnProperty'](_0x2fcb('0x3e'))){_0x469d66[_0x2fcb('0x26')]=qs[_0x2fcb('0x26')](_0x72424b[_0x2fcb('0x39')][_0x2fcb('0x26')]);_0x469d66['offset']=qs[_0x2fcb('0x24')](_0x72424b[_0x2fcb('0x39')]['offset']);}_0x469d66[_0x2fcb('0x3f')]=qs['sort'](_0x72424b[_0x2fcb('0x39')][_0x2fcb('0x40')]);_0x469d66['where']=qs['filters'](_['pick'](_0x72424b[_0x2fcb('0x39')],_0x1b186f[_0x2fcb('0x41')]),_0x5542c8);if(_0x72424b['query']['filter']){_0x469d66[_0x2fcb('0x42')]=_[_0x2fcb('0x43')](_0x469d66[_0x2fcb('0x42')],{'$or':_[_0x2fcb('0x33')](_0x5542c8,function(_0x279db2){if(_0x279db2[_0x2fcb('0x36')]!==_0x2fcb('0x44')){var _0x4fd0ab={};_0x4fd0ab[_0x279db2[_0x2fcb('0x30')]]={'$like':'%'+_0x72424b['query']['filter']+'%'};return _0x4fd0ab;}})});}_0x469d66=_[_0x2fcb('0x43')]({},_0x469d66,_0x72424b['options']);var _0x3241df={'where':_0x469d66[_0x2fcb('0x42')]};return db['ChatGroup'][_0x2fcb('0x27')](_0x3241df)[_0x2fcb('0x2d')](function(_0x3a242d){_0x5d836c['count']=_0x3a242d;if(_0x72424b['query'][_0x2fcb('0x45')]){_0x469d66['include']=[{'all':!![]}];}return db[_0x2fcb('0x46')]['findAll'](_0x469d66);})[_0x2fcb('0x2d')](function(_0x1db681){_0x5d836c[_0x2fcb('0x47')]=_0x1db681;return _0x5d836c;})['then'](respondWithFilteredResult(_0x4858b9,_0x469d66))[_0x2fcb('0x48')](handleError(_0x4858b9,null));};exports[_0x2fcb('0x49')]=function(_0x283367,_0x20fb0a){var _0x1a11a7={'raw':!![],'where':{'id':_0x283367[_0x2fcb('0x4a')]['id']}},_0x3c543d={};_0x3c543d['model']=_[_0x2fcb('0x3a')](db[_0x2fcb('0x46')][_0x2fcb('0x34')]);_0x3c543d[_0x2fcb('0x39')]=_[_0x2fcb('0x3a')](_0x283367['query']);_0x3c543d[_0x2fcb('0x41')]=_[_0x2fcb('0x3b')](_0x3c543d[_0x2fcb('0x38')],_0x3c543d['query']);_0x1a11a7[_0x2fcb('0x3c')]=_[_0x2fcb('0x3b')](_0x3c543d[_0x2fcb('0x38')],qs[_0x2fcb('0x3d')](_0x283367[_0x2fcb('0x39')][_0x2fcb('0x3d')]));_0x1a11a7['attributes']=_0x1a11a7[_0x2fcb('0x3c')]['length']?_0x1a11a7['attributes']:_0x3c543d['model'];if(_0x283367['query']['includeAll']){_0x1a11a7[_0x2fcb('0x4b')]=[{'all':!![]}];}_0x1a11a7=_[_0x2fcb('0x43')]({},_0x1a11a7,_0x283367[_0x2fcb('0x4c')]);return db[_0x2fcb('0x46')][_0x2fcb('0x4d')](_0x1a11a7)[_0x2fcb('0x2d')](handleEntityNotFound(_0x20fb0a,null))['then'](respondWithResult(_0x20fb0a,null))[_0x2fcb('0x48')](handleError(_0x20fb0a,null));};exports[_0x2fcb('0x4e')]=function(_0x4feba0,_0x348b04){return db[_0x2fcb('0x46')][_0x2fcb('0x4e')](_0x4feba0[_0x2fcb('0x4f')],{})[_0x2fcb('0x2d')](respondWithResult(_0x348b04,0xc9))[_0x2fcb('0x48')](handleError(_0x348b04,null));};exports[_0x2fcb('0x2b')]=function(_0x9850d0,_0x283d7f){if(_0x9850d0[_0x2fcb('0x4f')]['id']){delete _0x9850d0[_0x2fcb('0x4f')]['id'];}return db[_0x2fcb('0x46')][_0x2fcb('0x4d')]({'where':{'id':_0x9850d0[_0x2fcb('0x4a')]['id']}})[_0x2fcb('0x2d')](handleEntityNotFound(_0x283d7f,null))[_0x2fcb('0x2d')](saveUpdates(_0x9850d0['body'],null))[_0x2fcb('0x2d')](respondWithResult(_0x283d7f,null))[_0x2fcb('0x48')](handleError(_0x283d7f,null));};exports[_0x2fcb('0x2c')]=function(_0x510b54,_0x1c577d){return db[_0x2fcb('0x46')][_0x2fcb('0x4d')]({'where':{'id':_0x510b54[_0x2fcb('0x4a')]['id']}})[_0x2fcb('0x2d')](handleEntityNotFound(_0x1c577d,null))[_0x2fcb('0x2d')](removeEntity(_0x1c577d,null))['catch'](handleError(_0x1c577d,null));};exports['describe']=function(_0x13c461,_0x1c3f0f){return db[_0x2fcb('0x46')]['describe']()[_0x2fcb('0x2d')](respondWithResult(_0x1c3f0f,null))[_0x2fcb('0x48')](handleError(_0x1c3f0f,null));};exports[_0x2fcb('0x50')]=function(_0x1dd70,_0x551a53,_0x1cd9fa){return db[_0x2fcb('0x51')][_0x2fcb('0x27')]({'where':{'ChatGroupId':_0x1dd70[_0x2fcb('0x4a')]['id'],'ToId':_0x1dd70['user']['id'],'read':![]}})['then'](function(_0x20cf4e){return{'id':_['toInteger'](_0x1dd70[_0x2fcb('0x4a')]['id']),'count':_0x20cf4e};})[_0x2fcb('0x2d')](respondWithResult(_0x551a53,null))[_0x2fcb('0x48')](handleError(_0x551a53,null));};exports[_0x2fcb('0x52')]=function(_0x18b5a6,_0x383137,_0x59abf1){return db[_0x2fcb('0x46')]['find']({'where':{'id':_0x18b5a6[_0x2fcb('0x4a')]['id']}})[_0x2fcb('0x2d')](handleEntityNotFound(_0x383137,null))[_0x2fcb('0x2d')](function(_0x39646b){if(_0x39646b){return _0x39646b[_0x2fcb('0x52')](_0x18b5a6['body'][_0x2fcb('0x53')],_[_0x2fcb('0x54')](_0x18b5a6[_0x2fcb('0x4f')],['ids','id'])||{});}})[_0x2fcb('0x2d')](respondWithResult(_0x383137,null))['catch'](handleError(_0x383137,null));};exports['getMembers']=function(_0xabd242,_0x3c7ec0,_0x3563c2){var _0x3bdafd={};var _0x26f81b={};var _0xb9fa9f;var _0x21a55f;return db[_0x2fcb('0x46')]['findOne']({'where':{'id':_0xabd242[_0x2fcb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c7ec0,null))[_0x2fcb('0x2d')](function(_0x161c0f){if(_0x161c0f){_0xb9fa9f=_0x161c0f;_0x26f81b[_0x2fcb('0x38')]=_[_0x2fcb('0x3a')](db['User']['rawAttributes']);_0x26f81b[_0x2fcb('0x39')]=_[_0x2fcb('0x3a')](_0xabd242[_0x2fcb('0x39')]);_0x26f81b['filters']=_[_0x2fcb('0x3b')](_0x26f81b[_0x2fcb('0x38')],_0x26f81b['query']);_0x3bdafd[_0x2fcb('0x3c')]=_['intersection'](_0x26f81b[_0x2fcb('0x38')],qs[_0x2fcb('0x3d')](_0xabd242[_0x2fcb('0x39')]['fields']));_0x3bdafd['attributes']=_0x3bdafd[_0x2fcb('0x3c')]['length']?_0x3bdafd['attributes']:_0x26f81b[_0x2fcb('0x38')];_0x3bdafd[_0x2fcb('0x3f')]=qs[_0x2fcb('0x40')](_0xabd242['query']['sort']);_0x3bdafd['where']=qs[_0x2fcb('0x41')](_[_0x2fcb('0x55')](_0xabd242[_0x2fcb('0x39')],_0x26f81b[_0x2fcb('0x41')]));if(_0xabd242['query'][_0x2fcb('0x56')]){_0x3bdafd[_0x2fcb('0x42')]=_[_0x2fcb('0x43')](_0x3bdafd[_0x2fcb('0x42')],{'$or':_['map'](_0x3bdafd[_0x2fcb('0x3c')],function(_0x594044){var _0x4f8ebb={};_0x4f8ebb[_0x594044]={'$like':'%'+_0xabd242[_0x2fcb('0x39')][_0x2fcb('0x56')]+'%'};return _0x4f8ebb;})});}_0x3bdafd=_[_0x2fcb('0x43')]({},_0x3bdafd,_0xabd242[_0x2fcb('0x4c')]);return _0xb9fa9f['getMembers'](_0x3bdafd);}})[_0x2fcb('0x2d')](function(_0xedff81){if(_0xedff81){_0x21a55f=_0xedff81[_0x2fcb('0x57')];if(!_0xabd242[_0x2fcb('0x39')][_0x2fcb('0x58')](_0x2fcb('0x3e'))){_0x3bdafd[_0x2fcb('0x26')]=qs[_0x2fcb('0x26')](_0xabd242[_0x2fcb('0x39')][_0x2fcb('0x26')]);_0x3bdafd[_0x2fcb('0x24')]=qs['offset'](_0xabd242['query'][_0x2fcb('0x24')]);}return _0xb9fa9f[_0x2fcb('0x59')](_0x3bdafd);}})[_0x2fcb('0x2d')](function(_0x48ee49){if(_0x48ee49){return _0x48ee49?{'count':_0x21a55f,'rows':_0x48ee49}:null;}})[_0x2fcb('0x2d')](respondWithResult(_0x3c7ec0,null))[_0x2fcb('0x48')](handleError(_0x3c7ec0,null));};exports[_0x2fcb('0x5a')]=function(_0x71e11,_0x249f4f,_0x4ce9dd){return db[_0x2fcb('0x46')][_0x2fcb('0x4d')]({'where':{'id':_0x71e11['params']['id']}})[_0x2fcb('0x2d')](handleEntityNotFound(_0x249f4f,null))[_0x2fcb('0x2d')](function(_0x45bc34){if(_0x45bc34){return _0x45bc34[_0x2fcb('0x5a')](_0x71e11[_0x2fcb('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x249f4f,null))[_0x2fcb('0x48')](handleError(_0x249f4f,null));};exports[_0x2fcb('0x5b')]=function(_0x44e6d5,_0x5edbfb,_0x1fa3a8){if(_0x44e6d5[_0x2fcb('0x4f')]['id']){delete _0x44e6d5[_0x2fcb('0x4f')]['id'];}return db[_0x2fcb('0x46')][_0x2fcb('0x4d')]({'where':{'id':_0x44e6d5[_0x2fcb('0x4a')]['id']}})[_0x2fcb('0x2d')](handleEntityNotFound(_0x5edbfb,null))[_0x2fcb('0x2d')](function(_0x316cc6){if(_0x316cc6){_0x44e6d5[_0x2fcb('0x4f')][_0x2fcb('0x5c')]=_0x316cc6['id'];return db[_0x2fcb('0x51')][_0x2fcb('0x4e')](_0x44e6d5[_0x2fcb('0x4f')]);}})[_0x2fcb('0x2d')](respondWithResult(_0x5edbfb,null))[_0x2fcb('0x48')](handleError(_0x5edbfb,null));};exports['getMessages']=function(_0x1d974f,_0x1bd307,_0x545e68){var _0x22125d={};var _0x43f3f4={};var _0x33b687;var _0x52f5c0;return db['ChatGroup'][_0x2fcb('0x5d')]({'where':{'id':_0x1d974f[_0x2fcb('0x4a')]['id']}})[_0x2fcb('0x2d')](handleEntityNotFound(_0x1bd307,null))[_0x2fcb('0x2d')](function(_0x2861bd){if(_0x2861bd){_0x33b687=_0x2861bd;_0x43f3f4[_0x2fcb('0x38')]=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x43f3f4[_0x2fcb('0x39')]=_[_0x2fcb('0x3a')](_0x1d974f[_0x2fcb('0x39')]);_0x43f3f4['filters']=_[_0x2fcb('0x3b')](_0x43f3f4[_0x2fcb('0x38')],_0x43f3f4['query']);_0x22125d[_0x2fcb('0x3c')]=_[_0x2fcb('0x3b')](_0x43f3f4['model'],qs[_0x2fcb('0x3d')](_0x1d974f[_0x2fcb('0x39')][_0x2fcb('0x3d')]));_0x22125d[_0x2fcb('0x3c')]=_0x22125d['attributes'][_0x2fcb('0x57')]?_0x22125d['attributes']:_0x43f3f4[_0x2fcb('0x38')];_0x22125d['order']=qs[_0x2fcb('0x40')](_0x1d974f[_0x2fcb('0x39')][_0x2fcb('0x40')]);_0x22125d['where']=qs[_0x2fcb('0x41')](_[_0x2fcb('0x55')](_0x1d974f['query'],_0x43f3f4[_0x2fcb('0x41')]));if(_0x1d974f[_0x2fcb('0x39')]['filter']){_0x22125d[_0x2fcb('0x42')]=_[_0x2fcb('0x43')](_0x22125d[_0x2fcb('0x42')],{'$or':_[_0x2fcb('0x33')](_0x22125d['attributes'],function(_0x36ed8a){var _0x44fe1c={};_0x44fe1c[_0x36ed8a]={'$like':'%'+_0x1d974f['query'][_0x2fcb('0x56')]+'%'};return _0x44fe1c;})});}if(_0x1d974f['query']['$gte']){var _0x3e48ea=_0x1d974f[_0x2fcb('0x39')][_0x2fcb('0x5e')][_0x2fcb('0x5f')](',');var _0x47054c={};_0x47054c[_0x3e48ea[0x0]]={'$gte':moment(_0x3e48ea[0x1])[_0x2fcb('0x60')](_0x2fcb('0x61'))};_0x22125d[_0x2fcb('0x42')]=_[_0x2fcb('0x43')](_0x22125d[_0x2fcb('0x42')],_0x47054c);}_0x22125d=_[_0x2fcb('0x43')]({},_0x22125d,_0x1d974f[_0x2fcb('0x4c')]);return _0x33b687[_0x2fcb('0x62')](_0x22125d);}})[_0x2fcb('0x2d')](function(_0x419a37){if(_0x419a37){_0x52f5c0=_0x419a37[_0x2fcb('0x57')];if(!_0x1d974f[_0x2fcb('0x39')]['hasOwnProperty'](_0x2fcb('0x3e'))){_0x22125d['limit']=qs['limit'](_0x1d974f['query'][_0x2fcb('0x26')]);_0x22125d[_0x2fcb('0x24')]=qs[_0x2fcb('0x24')](_0x1d974f[_0x2fcb('0x39')]['offset']);}return _0x33b687[_0x2fcb('0x62')](_0x22125d);}})[_0x2fcb('0x2d')](function(_0x383e77){if(_0x383e77){return _0x383e77?{'count':_0x52f5c0,'rows':_0x383e77}:null;}})[_0x2fcb('0x2d')](respondWithResult(_0x1bd307,null))[_0x2fcb('0x48')](handleError(_0x1bd307,null));}; \ No newline at end of file +var _0x41a8=['addMembers','ids','omit','User','filter','getMembers','removeMembers','addMessage','getMessages','findOne','$gte','split','eml-format','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/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','error','name','send','ChatGroup','fieldName','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','destroy','getUnread','ChatInternalMessage','toInteger'];(function(_0x98aa6f,_0x1c2cb0){var _0x1371ec=function(_0x56db51){while(--_0x56db51){_0x98aa6f['push'](_0x98aa6f['shift']());}};_0x1371ec(++_0x1c2cb0);}(_0x41a8,0x120));var _0x841a=function(_0x2f621b,_0x222f2f){_0x2f621b=_0x2f621b-0x0;var _0x5f234e=_0x41a8[_0x2f621b];return _0x5f234e;};'use strict';var emlformat=require(_0x841a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x841a('0x1'));var jsonpatch=require(_0x841a('0x2'));var rp=require(_0x841a('0x3'));var moment=require(_0x841a('0x4'));var BPromise=require(_0x841a('0x5'));var Mustache=require('mustache');var util=require(_0x841a('0x6'));var path=require('path');var sox=require(_0x841a('0x7'));var csv=require(_0x841a('0x8'));var ejs=require(_0x841a('0x9'));var fs=require('fs');var fs_extra=require(_0x841a('0xa'));var _=require('lodash');var squel=require(_0x841a('0xb'));var crypto=require(_0x841a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x841a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x841a('0xe'));var Papa=require(_0x841a('0xf'));var Redis=require(_0x841a('0x10'));var authService=require(_0x841a('0x11'));var qs=require(_0x841a('0x12'));var as=require(_0x841a('0x13'));var hardwareService=require(_0x841a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x841a('0x15'));var config=require(_0x841a('0x16'));var licenseUtil=require(_0x841a('0x17'));var db=require(_0x841a('0x18'))['db'];config[_0x841a('0x19')]=_[_0x841a('0x1a')](config[_0x841a('0x19')],{'host':_0x841a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x841a('0x1c'))['register'](socket);function respondWithStatusCode(_0xa2161d,_0x1df99b){_0x1df99b=_0x1df99b||0xcc;return function(_0xdb3770){if(_0xdb3770){return _0xa2161d['sendStatus'](_0x1df99b);}return _0xa2161d[_0x841a('0x1d')](_0x1df99b)[_0x841a('0x1e')]();};}function respondWithResult(_0x637a9e,_0x3e52fe){_0x3e52fe=_0x3e52fe||0xc8;return function(_0x48e690){if(_0x48e690){return _0x637a9e['status'](_0x3e52fe)['json'](_0x48e690);}};}function respondWithFilteredResult(_0xd12ab3,_0x10bc52){return function(_0x49cd6a){if(_0x49cd6a){var _0x4da48c=typeof _0x10bc52['offset']===_0x841a('0x1f')&&typeof _0x10bc52[_0x841a('0x20')]==='undefined';var _0x5ee0c1=_0x49cd6a[_0x841a('0x21')];var _0x5ce943=_0x4da48c?0x0:_0x10bc52[_0x841a('0x22')];var _0x499d4e=_0x4da48c?_0x49cd6a[_0x841a('0x21')]:_0x10bc52[_0x841a('0x22')]+_0x10bc52[_0x841a('0x20')];var _0x8bdb15;if(_0x499d4e>=_0x5ee0c1){_0x499d4e=_0x5ee0c1;_0x8bdb15=0xc8;}else{_0x8bdb15=0xce;}_0xd12ab3[_0x841a('0x1d')](_0x8bdb15);return _0xd12ab3['set']('Content-Range',_0x5ce943+'-'+_0x499d4e+'/'+_0x5ee0c1)[_0x841a('0x23')](_0x49cd6a);}return null;};}function patchUpdates(_0x76872b){return function(_0x1cd59e){try{jsonpatch[_0x841a('0x24')](_0x1cd59e,_0x76872b,!![]);}catch(_0x4dfb0e){return BPromise[_0x841a('0x25')](_0x4dfb0e);}return _0x1cd59e[_0x841a('0x26')]();};}function saveUpdates(_0x35a6d1,_0x57eae5){return function(_0x500a39){if(_0x500a39){return _0x500a39[_0x841a('0x27')](_0x35a6d1)[_0x841a('0x28')](function(_0x2d21ed){return _0x2d21ed;});}return null;};}function removeEntity(_0x392424,_0x1c7f80){return function(_0x2917d0){if(_0x2917d0){return _0x2917d0['destroy']()[_0x841a('0x28')](function(){_0x392424[_0x841a('0x1d')](0xcc)[_0x841a('0x1e')]();});}};}function handleEntityNotFound(_0x44dac8,_0x2c72c6){return function(_0x4032fc){if(!_0x4032fc){_0x44dac8['sendStatus'](0x194);}return _0x4032fc;};}function handleError(_0x303e2b,_0x516754){_0x516754=_0x516754||0x1f4;return function(_0x5949f3){logger[_0x841a('0x29')](_0x5949f3['stack']);if(_0x5949f3['name']){delete _0x5949f3[_0x841a('0x2a')];}_0x303e2b[_0x841a('0x1d')](_0x516754)[_0x841a('0x2b')](_0x5949f3);};}exports['index']=function(_0x1f81b4,_0x10ec31){var _0x573f10={},_0x4d6346={},_0x283643={'count':0x0,'rows':[]};var _0xd4a0c3=_['map'](db[_0x841a('0x2c')]['rawAttributes'],function(_0x15d761){return{'name':_0x15d761[_0x841a('0x2d')],'type':_0x15d761['type'][_0x841a('0x2e')]};});_0x4d6346[_0x841a('0x2f')]=_[_0x841a('0x30')](_0xd4a0c3,_0x841a('0x2a'));_0x4d6346['query']=_[_0x841a('0x31')](_0x1f81b4['query']);_0x4d6346['filters']=_[_0x841a('0x32')](_0x4d6346[_0x841a('0x2f')],_0x4d6346[_0x841a('0x33')]);_0x573f10[_0x841a('0x34')]=_['intersection'](_0x4d6346['model'],qs[_0x841a('0x35')](_0x1f81b4[_0x841a('0x33')][_0x841a('0x35')]));_0x573f10[_0x841a('0x34')]=_0x573f10[_0x841a('0x34')][_0x841a('0x36')]?_0x573f10[_0x841a('0x34')]:_0x4d6346['model'];if(!_0x1f81b4[_0x841a('0x33')][_0x841a('0x37')](_0x841a('0x38'))){_0x573f10['limit']=qs['limit'](_0x1f81b4[_0x841a('0x33')]['limit']);_0x573f10['offset']=qs[_0x841a('0x22')](_0x1f81b4[_0x841a('0x33')]['offset']);}_0x573f10[_0x841a('0x39')]=qs['sort'](_0x1f81b4[_0x841a('0x33')][_0x841a('0x3a')]);_0x573f10[_0x841a('0x3b')]=qs[_0x841a('0x3c')](_[_0x841a('0x3d')](_0x1f81b4['query'],_0x4d6346[_0x841a('0x3c')]),_0xd4a0c3);if(_0x1f81b4[_0x841a('0x33')]['filter']){_0x573f10['where']=_[_0x841a('0x3e')](_0x573f10[_0x841a('0x3b')],{'$or':_[_0x841a('0x30')](_0xd4a0c3,function(_0x3692d4){if(_0x3692d4[_0x841a('0x3f')]!==_0x841a('0x40')){var _0x475d69={};_0x475d69[_0x3692d4[_0x841a('0x2a')]]={'$like':'%'+_0x1f81b4[_0x841a('0x33')]['filter']+'%'};return _0x475d69;}})});}_0x573f10=_[_0x841a('0x3e')]({},_0x573f10,_0x1f81b4[_0x841a('0x41')]);var _0x4a9ef7={'where':_0x573f10[_0x841a('0x3b')]};return db[_0x841a('0x2c')]['count'](_0x4a9ef7)[_0x841a('0x28')](function(_0x1f3117){_0x283643['count']=_0x1f3117;if(_0x1f81b4['query'][_0x841a('0x42')]){_0x573f10['include']=[{'all':!![]}];}return db['ChatGroup'][_0x841a('0x43')](_0x573f10);})[_0x841a('0x28')](function(_0x5ecbcd){_0x283643['rows']=_0x5ecbcd;return _0x283643;})[_0x841a('0x28')](respondWithFilteredResult(_0x10ec31,_0x573f10))[_0x841a('0x44')](handleError(_0x10ec31,null));};exports[_0x841a('0x45')]=function(_0x593488,_0x458cf4){var _0xed1947={'raw':!![],'where':{'id':_0x593488[_0x841a('0x46')]['id']}},_0x4ffcdf={};_0x4ffcdf['model']=_[_0x841a('0x31')](db['ChatGroup'][_0x841a('0x47')]);_0x4ffcdf[_0x841a('0x33')]=_['keys'](_0x593488[_0x841a('0x33')]);_0x4ffcdf[_0x841a('0x3c')]=_[_0x841a('0x32')](_0x4ffcdf['model'],_0x4ffcdf[_0x841a('0x33')]);_0xed1947['attributes']=_[_0x841a('0x32')](_0x4ffcdf[_0x841a('0x2f')],qs['fields'](_0x593488['query']['fields']));_0xed1947[_0x841a('0x34')]=_0xed1947['attributes']['length']?_0xed1947[_0x841a('0x34')]:_0x4ffcdf['model'];if(_0x593488['query']['includeAll']){_0xed1947[_0x841a('0x48')]=[{'all':!![]}];}_0xed1947=_[_0x841a('0x3e')]({},_0xed1947,_0x593488['options']);return db['ChatGroup'][_0x841a('0x49')](_0xed1947)[_0x841a('0x28')](handleEntityNotFound(_0x458cf4,null))[_0x841a('0x28')](respondWithResult(_0x458cf4,null))[_0x841a('0x44')](handleError(_0x458cf4,null));};exports[_0x841a('0x4a')]=function(_0x196d66,_0x5e6ba0){return db[_0x841a('0x2c')][_0x841a('0x4a')](_0x196d66[_0x841a('0x4b')],{})[_0x841a('0x28')](respondWithResult(_0x5e6ba0,0xc9))[_0x841a('0x44')](handleError(_0x5e6ba0,null));};exports[_0x841a('0x27')]=function(_0x1c24a9,_0x3c3f49){if(_0x1c24a9[_0x841a('0x4b')]['id']){delete _0x1c24a9[_0x841a('0x4b')]['id'];}return db['ChatGroup'][_0x841a('0x49')]({'where':{'id':_0x1c24a9[_0x841a('0x46')]['id']}})[_0x841a('0x28')](handleEntityNotFound(_0x3c3f49,null))[_0x841a('0x28')](saveUpdates(_0x1c24a9[_0x841a('0x4b')],null))['then'](respondWithResult(_0x3c3f49,null))[_0x841a('0x44')](handleError(_0x3c3f49,null));};exports[_0x841a('0x4c')]=function(_0x198f04,_0x25dce1){return db['ChatGroup'][_0x841a('0x49')]({'where':{'id':_0x198f04['params']['id']}})[_0x841a('0x28')](handleEntityNotFound(_0x25dce1,null))['then'](removeEntity(_0x25dce1,null))[_0x841a('0x44')](handleError(_0x25dce1,null));};exports['describe']=function(_0x149d7a,_0x153f1c){return db[_0x841a('0x2c')]['describe']()[_0x841a('0x28')](respondWithResult(_0x153f1c,null))[_0x841a('0x44')](handleError(_0x153f1c,null));};exports[_0x841a('0x4d')]=function(_0x1afd61,_0x3f033b,_0x20f999){return db[_0x841a('0x4e')]['count']({'where':{'ChatGroupId':_0x1afd61['params']['id'],'ToId':_0x1afd61['user']['id'],'read':![]}})['then'](function(_0x5d2e5a){return{'id':_[_0x841a('0x4f')](_0x1afd61[_0x841a('0x46')]['id']),'count':_0x5d2e5a};})[_0x841a('0x28')](respondWithResult(_0x3f033b,null))['catch'](handleError(_0x3f033b,null));};exports[_0x841a('0x50')]=function(_0x4e9823,_0x40bc27,_0x12579f){return db[_0x841a('0x2c')]['find']({'where':{'id':_0x4e9823[_0x841a('0x46')]['id']}})['then'](handleEntityNotFound(_0x40bc27,null))['then'](function(_0x4a340f){if(_0x4a340f){return _0x4a340f[_0x841a('0x50')](_0x4e9823[_0x841a('0x4b')][_0x841a('0x51')],_[_0x841a('0x52')](_0x4e9823[_0x841a('0x4b')],[_0x841a('0x51'),'id'])||{});}})[_0x841a('0x28')](respondWithResult(_0x40bc27,null))['catch'](handleError(_0x40bc27,null));};exports['getMembers']=function(_0x4501b0,_0x3cc76e,_0x13b8d2){var _0x58d613={};var _0x1eea8a={};var _0x21547e;var _0x4df8de;return db['ChatGroup']['findOne']({'where':{'id':_0x4501b0[_0x841a('0x46')]['id']}})[_0x841a('0x28')](handleEntityNotFound(_0x3cc76e,null))['then'](function(_0x2ad4e3){if(_0x2ad4e3){_0x21547e=_0x2ad4e3;_0x1eea8a['model']=_[_0x841a('0x31')](db[_0x841a('0x53')][_0x841a('0x47')]);_0x1eea8a['query']=_['keys'](_0x4501b0['query']);_0x1eea8a[_0x841a('0x3c')]=_['intersection'](_0x1eea8a[_0x841a('0x2f')],_0x1eea8a[_0x841a('0x33')]);_0x58d613[_0x841a('0x34')]=_['intersection'](_0x1eea8a[_0x841a('0x2f')],qs[_0x841a('0x35')](_0x4501b0['query'][_0x841a('0x35')]));_0x58d613[_0x841a('0x34')]=_0x58d613[_0x841a('0x34')][_0x841a('0x36')]?_0x58d613[_0x841a('0x34')]:_0x1eea8a['model'];_0x58d613['order']=qs['sort'](_0x4501b0['query'][_0x841a('0x3a')]);_0x58d613[_0x841a('0x3b')]=qs[_0x841a('0x3c')](_['pick'](_0x4501b0[_0x841a('0x33')],_0x1eea8a[_0x841a('0x3c')]));if(_0x4501b0[_0x841a('0x33')]['filter']){_0x58d613[_0x841a('0x3b')]=_[_0x841a('0x3e')](_0x58d613['where'],{'$or':_[_0x841a('0x30')](_0x58d613['attributes'],function(_0x32f36d){var _0x5e1b32={};_0x5e1b32[_0x32f36d]={'$like':'%'+_0x4501b0[_0x841a('0x33')][_0x841a('0x54')]+'%'};return _0x5e1b32;})});}_0x58d613=_[_0x841a('0x3e')]({},_0x58d613,_0x4501b0[_0x841a('0x41')]);return _0x21547e[_0x841a('0x55')](_0x58d613);}})[_0x841a('0x28')](function(_0x3c4ef4){if(_0x3c4ef4){_0x4df8de=_0x3c4ef4[_0x841a('0x36')];if(!_0x4501b0[_0x841a('0x33')]['hasOwnProperty'](_0x841a('0x38'))){_0x58d613['limit']=qs[_0x841a('0x20')](_0x4501b0[_0x841a('0x33')][_0x841a('0x20')]);_0x58d613[_0x841a('0x22')]=qs[_0x841a('0x22')](_0x4501b0[_0x841a('0x33')][_0x841a('0x22')]);}return _0x21547e[_0x841a('0x55')](_0x58d613);}})['then'](function(_0x5999b2){if(_0x5999b2){return _0x5999b2?{'count':_0x4df8de,'rows':_0x5999b2}:null;}})['then'](respondWithResult(_0x3cc76e,null))['catch'](handleError(_0x3cc76e,null));};exports[_0x841a('0x56')]=function(_0x1a2908,_0x109580,_0x3cc349){return db[_0x841a('0x2c')][_0x841a('0x49')]({'where':{'id':_0x1a2908[_0x841a('0x46')]['id']}})['then'](handleEntityNotFound(_0x109580,null))['then'](function(_0x25f208){if(_0x25f208){return _0x25f208['removeMembers'](_0x1a2908[_0x841a('0x33')][_0x841a('0x51')]);}})[_0x841a('0x28')](respondWithStatusCode(_0x109580,null))[_0x841a('0x44')](handleError(_0x109580,null));};exports[_0x841a('0x57')]=function(_0x56d0e9,_0x192889,_0x4694ff){if(_0x56d0e9['body']['id']){delete _0x56d0e9[_0x841a('0x4b')]['id'];}return db[_0x841a('0x2c')][_0x841a('0x49')]({'where':{'id':_0x56d0e9['params']['id']}})[_0x841a('0x28')](handleEntityNotFound(_0x192889,null))[_0x841a('0x28')](function(_0xb334f7){if(_0xb334f7){_0x56d0e9[_0x841a('0x4b')]['ChatGroupId']=_0xb334f7['id'];return db['ChatInternalMessage']['create'](_0x56d0e9[_0x841a('0x4b')]);}})[_0x841a('0x28')](respondWithResult(_0x192889,null))['catch'](handleError(_0x192889,null));};exports[_0x841a('0x58')]=function(_0x5dbbce,_0x34dcaf,_0x249c9b){var _0x53cf24={};var _0x107b16={};var _0xc7941c;var _0xb25ff1;return db[_0x841a('0x2c')][_0x841a('0x59')]({'where':{'id':_0x5dbbce['params']['id']}})[_0x841a('0x28')](handleEntityNotFound(_0x34dcaf,null))[_0x841a('0x28')](function(_0x1d0d31){if(_0x1d0d31){_0xc7941c=_0x1d0d31;_0x107b16[_0x841a('0x2f')]=_[_0x841a('0x31')](db['ChatInternalMessage'][_0x841a('0x47')]);_0x107b16['query']=_['keys'](_0x5dbbce[_0x841a('0x33')]);_0x107b16['filters']=_[_0x841a('0x32')](_0x107b16[_0x841a('0x2f')],_0x107b16[_0x841a('0x33')]);_0x53cf24[_0x841a('0x34')]=_[_0x841a('0x32')](_0x107b16[_0x841a('0x2f')],qs[_0x841a('0x35')](_0x5dbbce[_0x841a('0x33')][_0x841a('0x35')]));_0x53cf24[_0x841a('0x34')]=_0x53cf24[_0x841a('0x34')]['length']?_0x53cf24[_0x841a('0x34')]:_0x107b16[_0x841a('0x2f')];_0x53cf24[_0x841a('0x39')]=qs[_0x841a('0x3a')](_0x5dbbce[_0x841a('0x33')]['sort']);_0x53cf24[_0x841a('0x3b')]=qs['filters'](_['pick'](_0x5dbbce['query'],_0x107b16['filters']));if(_0x5dbbce['query'][_0x841a('0x54')]){_0x53cf24[_0x841a('0x3b')]=_[_0x841a('0x3e')](_0x53cf24['where'],{'$or':_[_0x841a('0x30')](_0x53cf24[_0x841a('0x34')],function(_0x30c268){var _0x13eb16={};_0x13eb16[_0x30c268]={'$like':'%'+_0x5dbbce[_0x841a('0x33')][_0x841a('0x54')]+'%'};return _0x13eb16;})});}if(_0x5dbbce[_0x841a('0x33')][_0x841a('0x5a')]){var _0x1cd9eb=_0x5dbbce[_0x841a('0x33')][_0x841a('0x5a')][_0x841a('0x5b')](',');var _0x23e512={};_0x23e512[_0x1cd9eb[0x0]]={'$gte':moment(_0x1cd9eb[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x53cf24[_0x841a('0x3b')]=_[_0x841a('0x3e')](_0x53cf24['where'],_0x23e512);}_0x53cf24=_[_0x841a('0x3e')]({},_0x53cf24,_0x5dbbce[_0x841a('0x41')]);return _0xc7941c[_0x841a('0x58')](_0x53cf24);}})[_0x841a('0x28')](function(_0x61bd21){if(_0x61bd21){_0xb25ff1=_0x61bd21[_0x841a('0x36')];if(!_0x5dbbce[_0x841a('0x33')][_0x841a('0x37')](_0x841a('0x38'))){_0x53cf24['limit']=qs[_0x841a('0x20')](_0x5dbbce[_0x841a('0x33')][_0x841a('0x20')]);_0x53cf24['offset']=qs[_0x841a('0x22')](_0x5dbbce['query'][_0x841a('0x22')]);}return _0xc7941c[_0x841a('0x58')](_0x53cf24);}})[_0x841a('0x28')](function(_0x21d2a5){if(_0x21d2a5){return _0x21d2a5?{'count':_0xb25ff1,'rows':_0x21d2a5}:null;}})['then'](respondWithResult(_0x34dcaf,null))[_0x841a('0x44')](handleError(_0x34dcaf,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 7d34ca8..f883443 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 _0x626d=['ChatGroup','setMaxListeners','save','remove','emit','exports','events'];(function(_0xc85e7f,_0x10574a){var _0x90e7c6=function(_0x4b2c85){while(--_0x4b2c85){_0xc85e7f['push'](_0xc85e7f['shift']());}};_0x90e7c6(++_0x10574a);}(_0x626d,0xa0));var _0xd626=function(_0x989980,_0x1e5018){_0x989980=_0x989980-0x0;var _0x939945=_0x626d[_0x989980];return _0x939945;};'use strict';var EventEmitter=require(_0xd626('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xd626('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd626('0x2')](0x0);var events={'afterCreate':_0xd626('0x3'),'afterUpdate':'update','afterDestroy':_0xd626('0x4')};function emitEvent(_0x33e3fc){return function(_0x31b2a5,_0x1ea984,_0xada387){ChatGroupEvents['emit'](_0x33e3fc+':'+_0x31b2a5['id'],_0x31b2a5);ChatGroupEvents[_0xd626('0x5')](_0x33e3fc,_0x31b2a5);_0xada387(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xd626('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xd07e=['ChatGroup','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x40ec55,_0x1c66a4){var _0x5a6be9=function(_0x1a69c9){while(--_0x1a69c9){_0x40ec55['push'](_0x40ec55['shift']());}};_0x5a6be9(++_0x1c66a4);}(_0xd07e,0x8e));var _0xed07=function(_0x37fff5,_0x2e32a4){_0x37fff5=_0x37fff5-0x0;var _0x51c788=_0xd07e[_0x37fff5];return _0x51c788;};'use strict';var EventEmitter=require(_0xed07('0x0'));var ChatGroup=require(_0xed07('0x1'))['db'][_0xed07('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xed07('0x3')](0x0);var events={'afterCreate':_0xed07('0x4'),'afterUpdate':'update','afterDestroy':_0xed07('0x5')};function emitEvent(_0x1d1e24){return function(_0x1546dd,_0x580878,_0x44e93e){ChatGroupEvents[_0xed07('0x6')](_0x1d1e24+':'+_0x1546dd['id'],_0x1546dd);ChatGroupEvents['emit'](_0x1d1e24,_0x1546dd);_0x44e93e(null);};}for(var e in events){if(events[_0xed07('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xed07('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 eee08cc..8345ccd 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 _0x4d7f=['define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x4d2612,_0x1f2501){var _0x1f21c4=function(_0x51ecab){while(--_0x51ecab){_0x4d2612['push'](_0x4d2612['shift']());}};_0x1f21c4(++_0x1f2501);}(_0x4d7f,0x161));var _0xf4d7=function(_0x580ea0,_0x3f57ef){_0x580ea0=_0x580ea0-0x0;var _0x54755e=_0x4d7f[_0x580ea0];return _0x54755e;};'use strict';var _=require(_0xf4d7('0x0'));var util=require(_0xf4d7('0x1'));var logger=require(_0xf4d7('0x2'))(_0xf4d7('0x3'));var moment=require(_0xf4d7('0x4'));var BPromise=require(_0xf4d7('0x5'));var rp=require(_0xf4d7('0x6'));var fs=require('fs');var path=require(_0xf4d7('0x7'));var rimraf=require(_0xf4d7('0x8'));var config=require(_0xf4d7('0x9'));var attributes=require(_0xf4d7('0xa'));module['exports']=function(_0x169cc6,_0x5793e4){return _0x169cc6[_0xf4d7('0xb')](_0xf4d7('0xc'),attributes,{'tableName':_0xf4d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cdc=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x6f114,_0x2ac0f9){var _0x40546b=function(_0x3902ac){while(--_0x3902ac){_0x6f114['push'](_0x6f114['shift']());}};_0x40546b(++_0x2ac0f9);}(_0x1cdc,0x15d));var _0xc1cd=function(_0x55f480,_0x256438){_0x55f480=_0x55f480-0x0;var _0x13dfa1=_0x1cdc[_0x55f480];return _0x13dfa1;};'use strict';var _=require(_0xc1cd('0x0'));var util=require(_0xc1cd('0x1'));var logger=require(_0xc1cd('0x2'))(_0xc1cd('0x3'));var moment=require(_0xc1cd('0x4'));var BPromise=require(_0xc1cd('0x5'));var rp=require(_0xc1cd('0x6'));var fs=require('fs');var path=require(_0xc1cd('0x7'));var rimraf=require('rimraf');var config=require(_0xc1cd('0x8'));var attributes=require('./chatGroup.attributes');module[_0xc1cd('0x9')]=function(_0xc3370f,_0x12bfcf){return _0xc3370f[_0xc1cd('0xa')](_0xc1cd('0xb'),attributes,{'tableName':_0xc1cd('0xc'),'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 63bbc99..9ac39f3 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 _0x8ece=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1ffa28,_0x104537){var _0x235fbb=function(_0x1dcc42){while(--_0x1dcc42){_0x1ffa28['push'](_0x1ffa28['shift']());}};_0x235fbb(++_0x104537);}(_0x8ece,0x195));var _0xe8ec=function(_0x3b8576,_0x241739){_0x3b8576=_0x3b8576-0x0;var _0x410744=_0x8ece[_0x3b8576];return _0x410744;};'use strict';var _=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var moment=require(_0xe8ec('0x2'));var BPromise=require(_0xe8ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8ec('0x4'))['db'];var utils=require(_0xe8ec('0x5'));var logger=require(_0xe8ec('0x6'))(_0xe8ec('0x7'));var config=require(_0xe8ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe8ec('0x9')][_0xe8ec('0xa')]({'port':0x232a});config[_0xe8ec('0xb')]=_[_0xe8ec('0xc')](config[_0xe8ec('0xb')],{'host':_0xe8ec('0xd'),'port':0x18eb});var socket=require(_0xe8ec('0xe'))(new Redis(config['redis']));require(_0xe8ec('0xf'))['register'](socket);function respondWithRpcPromise(_0x1345e0,_0x5b1569,_0x1b0a84){return new BPromise(function(_0x278f86,_0x4ff773){return client[_0xe8ec('0x10')](_0x1345e0,_0x1b0a84)[_0xe8ec('0x11')](function(_0x959f4){logger[_0xe8ec('0x12')](_0xe8ec('0x13'),_0x5b1569,_0xe8ec('0x14'));logger[_0xe8ec('0x15')](_0xe8ec('0x16'),_0x5b1569,_0xe8ec('0x14'),JSON[_0xe8ec('0x17')](_0x959f4));if(_0x959f4['error']){if(_0x959f4[_0xe8ec('0x18')][_0xe8ec('0x19')]===0x1f4){logger[_0xe8ec('0x18')](_0xe8ec('0x13'),_0x5b1569,_0x959f4[_0xe8ec('0x18')][_0xe8ec('0x1a')]);return _0x4ff773(_0x959f4[_0xe8ec('0x18')][_0xe8ec('0x1a')]);}logger['error'](_0xe8ec('0x13'),_0x5b1569,_0x959f4[_0xe8ec('0x18')][_0xe8ec('0x1a')]);return _0x278f86(_0x959f4['error'][_0xe8ec('0x1a')]);}else{logger[_0xe8ec('0x12')](_0xe8ec('0x13'),_0x5b1569,_0xe8ec('0x14'));_0x278f86(_0x959f4[_0xe8ec('0x1b')][_0xe8ec('0x1a')]);}})[_0xe8ec('0x1c')](function(_0x2e54f0){logger['error'](_0xe8ec('0x13'),_0x5b1569,_0x2e54f0);_0x4ff773(_0x2e54f0);});});} \ No newline at end of file +var _0xfbf0=['ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','info'];(function(_0x2e45c2,_0x40ca8a){var _0x4df9cb=function(_0x452f3d){while(--_0x452f3d){_0x2e45c2['push'](_0x2e45c2['shift']());}};_0x4df9cb(++_0x40ca8a);}(_0xfbf0,0x141));var _0x0fbf=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xfbf0[_0x2283dc];return _0x16db90;};'use strict';var _=require('lodash');var util=require(_0x0fbf('0x0'));var moment=require(_0x0fbf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fbf('0x2'));var db=require(_0x0fbf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fbf('0x4'))('rpc');var config=require(_0x0fbf('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0fbf('0x6')][_0x0fbf('0x7')]({'port':0x232a});config['redis']=_[_0x0fbf('0x8')](config[_0x0fbf('0x9')],{'host':_0x0fbf('0xa'),'port':0x18eb});var socket=require(_0x0fbf('0xb'))(new Redis(config[_0x0fbf('0x9')]));require(_0x0fbf('0xc'))[_0x0fbf('0xd')](socket);function respondWithRpcPromise(_0x409b04,_0x165eec,_0x174e66){return new BPromise(function(_0x4d1f16,_0x3b2a6a){return client['request'](_0x409b04,_0x174e66)['then'](function(_0x45e96e){logger[_0x0fbf('0xe')](_0x0fbf('0xf'),_0x165eec,_0x0fbf('0x10'));logger['debug'](_0x0fbf('0x11'),_0x165eec,_0x0fbf('0x10'),JSON[_0x0fbf('0x12')](_0x45e96e));if(_0x45e96e[_0x0fbf('0x13')]){if(_0x45e96e[_0x0fbf('0x13')][_0x0fbf('0x14')]===0x1f4){logger[_0x0fbf('0x13')](_0x0fbf('0xf'),_0x165eec,_0x45e96e[_0x0fbf('0x13')][_0x0fbf('0x15')]);return _0x3b2a6a(_0x45e96e[_0x0fbf('0x13')][_0x0fbf('0x15')]);}logger[_0x0fbf('0x13')](_0x0fbf('0xf'),_0x165eec,_0x45e96e[_0x0fbf('0x13')][_0x0fbf('0x15')]);return _0x4d1f16(_0x45e96e[_0x0fbf('0x13')][_0x0fbf('0x15')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x165eec,'request\x20sent');_0x4d1f16(_0x45e96e[_0x0fbf('0x16')][_0x0fbf('0x15')]);}})[_0x0fbf('0x17')](function(_0x296602){logger[_0x0fbf('0x13')](_0x0fbf('0xf'),_0x165eec,_0x296602);_0x3b2a6a(_0x296602);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c3bd289..e5ba595 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 _0x363a=['./chatGroup.events','remove','emit','register','chatGroup:'];(function(_0x51d92a,_0x49d811){var _0x1236b0=function(_0x46c098){while(--_0x46c098){_0x51d92a['push'](_0x51d92a['shift']());}};_0x1236b0(++_0x49d811);}(_0x363a,0x1d6));var _0xa363=function(_0x1475a6,_0x56628c){_0x1475a6=_0x1475a6-0x0;var _0x3c0d07=_0x363a[_0x1475a6];return _0x3c0d07;};'use strict';var ChatGroupEvents=require(_0xa363('0x0'));var events=['save',_0xa363('0x1'),'update'];function createListener(_0x3e3904,_0x3ed619){return function(_0x38b957){_0x3ed619[_0xa363('0x2')](_0x3e3904,_0x38b957);};}function removeListener(_0x19adfb,_0x117c5a){return function(){ChatGroupEvents['removeListener'](_0x19adfb,_0x117c5a);};}exports[_0xa363('0x3')]=function(_0x16526d){for(var _0x43de0a=0x0,_0x135b6f=events['length'];_0x43de0a<_0x135b6f;_0x43de0a++){var _0x28b096=events[_0x43de0a];var _0x5447ed=createListener(_0xa363('0x4')+_0x28b096,_0x16526d);ChatGroupEvents['on'](_0x28b096,_0x5447ed);}}; \ No newline at end of file +var _0x59ba=['remove','update','emit','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x59ba,0x1ae));var _0xa59b=function(_0x2347b5,_0x384435){_0x2347b5=_0x2347b5-0x0;var _0x5c5c12=_0x59ba[_0x2347b5];return _0x5c5c12;};'use strict';var ChatGroupEvents=require(_0xa59b('0x0'));var events=[_0xa59b('0x1'),_0xa59b('0x2'),_0xa59b('0x3')];function createListener(_0x701629,_0x399042){return function(_0x26b559){_0x399042[_0xa59b('0x4')](_0x701629,_0x26b559);};}function removeListener(_0xff5ee8,_0x2e5418){return function(){ChatGroupEvents['removeListener'](_0xff5ee8,_0x2e5418);};}exports[_0xa59b('0x5')]=function(_0x3b23fa){for(var _0x4713ad=0x0,_0xa1abe1=events[_0xa59b('0x6')];_0x4713ad<_0xa1abe1;_0x4713ad++){var _0x51d0d9=events[_0x4713ad];var _0x44c804=createListener(_0xa59b('0x7')+_0x51d0d9,_0x3b23fa);ChatGroupEvents['on'](_0x51d0d9,_0x44c804);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fe0edf5..8971501 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 _0x4219=['post','/:id/members','addMembers','addMessage','put','update','delete','destroy','removeMembers','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','create'];(function(_0x484a3e,_0x4c0eda){var _0x29a66a=function(_0x5310c3){while(--_0x5310c3){_0x484a3e['push'](_0x484a3e['shift']());}};_0x29a66a(++_0x4c0eda);}(_0x4219,0x17d));var _0x9421=function(_0xd89388,_0x33c473){_0xd89388=_0xd89388-0x0;var _0x4157a3=_0x4219[_0xd89388];return _0x4157a3;};'use strict';var multer=require('multer');var util=require(_0x9421('0x0'));var path=require(_0x9421('0x1'));var timeout=require(_0x9421('0x2'));var express=require(_0x9421('0x3'));var router=express[_0x9421('0x4')]();var fs_extra=require(_0x9421('0x5'));var auth=require(_0x9421('0x6'));var interaction=require(_0x9421('0x7'));var config=require(_0x9421('0x8'));var controller=require(_0x9421('0x9'));router['get']('/',auth[_0x9421('0xa')](),controller[_0x9421('0xb')]);router[_0x9421('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x9421('0xd')]);router['get'](_0x9421('0xe'),auth[_0x9421('0xa')](),controller[_0x9421('0xf')]);router[_0x9421('0xc')](_0x9421('0x10'),auth[_0x9421('0xa')](),controller[_0x9421('0x11')]);router[_0x9421('0xc')]('/:id/members',auth[_0x9421('0xa')](),controller[_0x9421('0x12')]);router[_0x9421('0xc')](_0x9421('0x13'),auth[_0x9421('0xa')](),controller[_0x9421('0x14')]);router['post']('/',auth[_0x9421('0xa')](),controller[_0x9421('0x15')]);router[_0x9421('0x16')](_0x9421('0x17'),auth[_0x9421('0xa')](),controller[_0x9421('0x18')]);router[_0x9421('0x16')]('/:id/messages',auth[_0x9421('0xa')](),controller[_0x9421('0x19')]);router[_0x9421('0x1a')](_0x9421('0xe'),auth[_0x9421('0xa')](),controller[_0x9421('0x1b')]);router[_0x9421('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x9421('0x1d')]);router[_0x9421('0x1c')](_0x9421('0x17'),auth[_0x9421('0xa')](),controller[_0x9421('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xfe9d=['describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','put','delete','destroy','removeMembers','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','isAuthenticated'];(function(_0x2d530c,_0x3cfc95){var _0x41b1a8=function(_0x1e4be3){while(--_0x1e4be3){_0x2d530c['push'](_0x2d530c['shift']());}};_0x41b1a8(++_0x3cfc95);}(_0xfe9d,0x151));var _0xdfe9=function(_0x3629b9,_0xfff26e){_0x3629b9=_0x3629b9-0x0;var _0xadcff3=_0xfe9d[_0x3629b9];return _0xadcff3;};'use strict';var multer=require(_0xdfe9('0x0'));var util=require(_0xdfe9('0x1'));var path=require(_0xdfe9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdfe9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdfe9('0x4'));var interaction=require(_0xdfe9('0x5'));var config=require(_0xdfe9('0x6'));var controller=require(_0xdfe9('0x7'));router[_0xdfe9('0x8')]('/',auth['isAuthenticated'](),controller[_0xdfe9('0x9')]);router[_0xdfe9('0x8')]('/describe',auth[_0xdfe9('0xa')](),controller[_0xdfe9('0xb')]);router['get'](_0xdfe9('0xc'),auth['isAuthenticated'](),controller[_0xdfe9('0xd')]);router['get'](_0xdfe9('0xe'),auth[_0xdfe9('0xa')](),controller[_0xdfe9('0xf')]);router['get'](_0xdfe9('0x10'),auth['isAuthenticated'](),controller[_0xdfe9('0x11')]);router[_0xdfe9('0x8')](_0xdfe9('0x12'),auth[_0xdfe9('0xa')](),controller[_0xdfe9('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdfe9('0x14')]);router[_0xdfe9('0x15')](_0xdfe9('0x10'),auth['isAuthenticated'](),controller[_0xdfe9('0x16')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xdfe9('0x17')]);router[_0xdfe9('0x18')](_0xdfe9('0xc'),auth[_0xdfe9('0xa')](),controller['update']);router[_0xdfe9('0x19')](_0xdfe9('0xc'),auth[_0xdfe9('0xa')](),controller[_0xdfe9('0x1a')]);router['delete'](_0xdfe9('0x10'),auth[_0xdfe9('0xa')](),controller[_0xdfe9('0x1b')]);module[_0xdfe9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index b5b3e44..d23b485 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 _0xb248=['INTEGER','ENUM','star','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN'];(function(_0x2d5818,_0xc9aa8b){var _0x1d1e9d=function(_0xdea9e8){while(--_0xdea9e8){_0x2d5818['push'](_0x2d5818['shift']());}};_0x1d1e9d(++_0xc9aa8b);}(_0xb248,0xc6));var _0x8b24=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb248[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0x8b24('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8b24('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8b24('0x2')]},'ratingType':{'type':Sequelize[_0x8b24('0x3')](_0x8b24('0x4'),'thumb'),'defaultValue':_0x8b24('0x4')},'ratingMessage':{'type':Sequelize[_0x8b24('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x8b24('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8b24('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8b24('0x6')]},'thirdDisposition':{'type':Sequelize[_0x8b24('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x8b24('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x8b24('0x6')]},'osVersion':{'type':Sequelize[_0x8b24('0x6')]},'deviceModel':{'type':Sequelize[_0x8b24('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x8b24('0x6')]},'referer':{'type':Sequelize[_0x8b24('0x5')]},'customerIp':{'type':Sequelize[_0x8b24('0x6')]},'formData':{'type':Sequelize[_0x8b24('0x5')](_0x8b24('0x8'))},'read1stAt':{'type':Sequelize[_0x8b24('0x7')]},'lastMsgAt':{'type':Sequelize[_0x8b24('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x8b24('0x3')]('in',_0x8b24('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8b24('0x6')]},'customerPort':{'type':Sequelize[_0x8b24('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x8b24('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x8b24('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x4227=['thumb','TEXT','STRING','DATE','long','ENUM','BOOLEAN','sequelize','INTEGER','star'];(function(_0x1cafa2,_0x370ccb){var _0x51e4f3=function(_0x30d879){while(--_0x30d879){_0x1cafa2['push'](_0x1cafa2['shift']());}};_0x51e4f3(++_0x370ccb);}(_0x4227,0x89));var _0x7422=function(_0x23db00,_0x28891e){_0x23db00=_0x23db00-0x0;var _0x4daf8d=_0x4227[_0x23db00];return _0x4daf8d;};'use strict';var Sequelize=require(_0x7422('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7422('0x1')]},'ratingType':{'type':Sequelize['ENUM'](_0x7422('0x2'),_0x7422('0x3')),'defaultValue':_0x7422('0x2')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x7422('0x4')]},'mailTranscript':{'type':Sequelize[_0x7422('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7422('0x6')]},'disposition':{'type':Sequelize[_0x7422('0x5')]},'secondDisposition':{'type':Sequelize[_0x7422('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7422('0x5')]},'note':{'type':Sequelize[_0x7422('0x5')]},'browserName':{'type':Sequelize[_0x7422('0x5')]},'browserVersion':{'type':Sequelize[_0x7422('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x7422('0x5')]},'deviceModel':{'type':Sequelize[_0x7422('0x5')]},'deviceVendor':{'type':Sequelize[_0x7422('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x7422('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7422('0x4')](_0x7422('0x7'))},'read1stAt':{'type':Sequelize[_0x7422('0x6')]},'lastMsgAt':{'type':Sequelize[_0x7422('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x7422('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7422('0x5')]},'customerPort':{'type':Sequelize[_0x7422('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x7422('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c856604..1430d15 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 _0xa641=['unlinkSync','zip-dir','request-promise','util','path','ejs','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','destroy','name','send','render','merge','body','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','params','model','keys','filters','intersection','attributes','fields','include','find','create','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','join_url','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','json','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','mailTranscript','format','transcript-%s.txt','now','User','ChatWebsite','ContactId','Messages','length','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','pick','ChatInteractionId','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','getMyMessages','push','addTags','setTags','color','emit','chatInteractionTags:save','removeTags','download','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','direction','read','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','existsSync','pipe','createWriteStream','out','lastName','value','renderFile','views','downloadInteraction.ejs','.pdf','Chat','createPdfFromHTML'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xa641,0x199));var _0x1a64=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa641[_0x4e676e];return _0x336a3c;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1a64('0x0'));var rp=require(_0x1a64('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a64('0x2'));var path=require(_0x1a64('0x3'));var ejs=require(_0x1a64('0x4'));var fs=require('fs');var _=require(_0x1a64('0x5'));var Redis=require(_0x1a64('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x1a64('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x1a64('0x8'));var config=require(_0x1a64('0x9'));var db=require(_0x1a64('0xa'))['db'];config['redis']=_[_0x1a64('0xb')](config[_0x1a64('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a64('0xd'))(new Redis(config[_0x1a64('0xc')]));require(_0x1a64('0xe'))['register'](socket);var jayson=require(_0x1a64('0xf'));var client=jayson[_0x1a64('0x10')][_0x1a64('0x11')]({'port':0x232b});var client9004=jayson['client'][_0x1a64('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x15a5d3,_0x37b612,_0x5ba2e9,_0x195186){return new BPromise(function(_0x5b385e,_0x231d68){var _0x51a48c=_0x195186||client;return _0x51a48c[_0x1a64('0x12')](_0x15a5d3,_0x5ba2e9)[_0x1a64('0x13')](function(_0x950204){logger[_0x1a64('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x37b612,'request\x20sent');logger[_0x1a64('0x15')](_0x1a64('0x16'),_0x37b612,_0x1a64('0x17'),JSON['stringify'](_0x950204));if(_0x950204['error']){if(_0x950204[_0x1a64('0x18')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x37b612,_0x950204[_0x1a64('0x18')][_0x1a64('0x19')]);return _0x231d68(_0x950204[_0x1a64('0x18')][_0x1a64('0x19')]);}logger[_0x1a64('0x18')](_0x1a64('0x1a'),_0x37b612,_0x950204[_0x1a64('0x18')][_0x1a64('0x19')]);return _0x5b385e(_0x950204[_0x1a64('0x18')][_0x1a64('0x19')]);}else{logger[_0x1a64('0x14')](_0x1a64('0x1a'),_0x37b612,_0x1a64('0x17'));_0x5b385e(_0x950204[_0x1a64('0x1b')][_0x1a64('0x19')]);}})[_0x1a64('0x1c')](function(_0x5ea058){logger[_0x1a64('0x18')](_0x1a64('0x1a'),_0x37b612,_0x5ea058);_0x231d68(_0x5ea058);});});}function respondWithStatusCode(_0x1f6fb5,_0x516c69){_0x516c69=_0x516c69||0xcc;return function(_0xc71066){if(_0xc71066){return _0x1f6fb5[_0x1a64('0x1d')](_0x516c69);}return _0x1f6fb5['status'](_0x516c69)[_0x1a64('0x1e')]();};}function respondWithResult(_0x3c74ec,_0x5630ce){_0x5630ce=_0x5630ce||0xc8;return function(_0x286743){if(_0x286743){return _0x3c74ec[_0x1a64('0x1f')](_0x5630ce)['json'](_0x286743);}};}function respondWithFilteredResult(_0xf3ad73,_0x4e3f92){return function(_0x523d6e){if(_0x523d6e){var _0x57168c=typeof _0x4e3f92['offset']==='undefined'&&typeof _0x4e3f92[_0x1a64('0x20')]===_0x1a64('0x21');var _0x21084f=_0x523d6e[_0x1a64('0x22')];var _0x17fbc0=_0x57168c?0x0:_0x4e3f92['offset'];var _0x5916bc=_0x57168c?_0x523d6e[_0x1a64('0x22')]:_0x4e3f92[_0x1a64('0x23')]+_0x4e3f92[_0x1a64('0x20')];var _0x2e3da4;if(_0x5916bc>=_0x21084f){_0x5916bc=_0x21084f;_0x2e3da4=0xc8;}else{_0x2e3da4=0xce;}_0xf3ad73[_0x1a64('0x1f')](_0x2e3da4);return _0xf3ad73[_0x1a64('0x24')](_0x1a64('0x25'),_0x17fbc0+'-'+_0x5916bc+'/'+_0x21084f)['json'](_0x523d6e);}return null;};}function saveUpdates(_0x3c2b26){return function(_0x1004ad){if(_0x1004ad){return _0x1004ad['update'](_0x3c2b26)['then'](function(_0x212d33){return _0x212d33;});}return null;};}function removeEntity(_0x264138){return function(_0xfe058d){if(_0xfe058d){return _0xfe058d[_0x1a64('0x26')]()['then'](function(){_0x264138[_0x1a64('0x1f')](0xcc)[_0x1a64('0x1e')]();});}};}function handleEntityNotFound(_0x3c12f6){return function(_0x4563a1){if(!_0x4563a1){_0x3c12f6[_0x1a64('0x1d')](0x194);}return _0x4563a1;};}function handleError(_0x3a42fc,_0x53ff3e){_0x53ff3e=_0x53ff3e||0x1f4;return function(_0x2fd0c8){logger[_0x1a64('0x18')](_0x2fd0c8['stack']);if(_0x2fd0c8[_0x1a64('0x27')]){delete _0x2fd0c8[_0x1a64('0x27')];}_0x3a42fc[_0x1a64('0x1f')](_0x53ff3e)[_0x1a64('0x28')](_0x2fd0c8);};}function getMustacheRender(_0x235c58,_0x4a6b9f){return Mustache[_0x1a64('0x29')](_0x235c58,_[_0x1a64('0x2a')](_0x4a6b9f[_0x1a64('0x2b')],{'contact':_0x4a6b9f['contact'],'message':_0x4a6b9f[_0x1a64('0x19')],'agent':_0x4a6b9f['agent'],'interaction':_0x4a6b9f[_0x1a64('0x2c')],'account':_0x4a6b9f[_0x1a64('0x2d')]}))||'';}exports[_0x1a64('0x2e')]=function(_0x18d31a,_0x59aaf2){var _0x4a9ca5={};var _0x82ab76=_[_0x1a64('0x2f')](db[_0x1a64('0x30')][_0x1a64('0x31')],function(_0x5c953c){return{'name':_0x5c953c[_0x1a64('0x32')],'type':_0x5c953c[_0x1a64('0x33')][_0x1a64('0x34')]};});_0x4a9ca5=qs[_0x1a64('0x35')](_0x82ab76,_0x18d31a);return interaction[_0x1a64('0x36')](_0x1a64('0x37'),_0x18d31a[_0x1a64('0x38')],_0x18d31a[_0x1a64('0x39')],_0x4a9ca5,_0x82ab76)[_0x1a64('0x13')](respondWithFilteredResult(_0x59aaf2,_0x4a9ca5))['catch'](handleError(_0x59aaf2,null));};exports['show']=function(_0x3d3b4c,_0x2b1a1e){var _0x437a36={'raw':![],'where':{'id':_0x3d3b4c[_0x1a64('0x3a')]['id']}},_0x183501={};_0x183501[_0x1a64('0x3b')]=_[_0x1a64('0x3c')](db[_0x1a64('0x30')][_0x1a64('0x31')]);_0x183501[_0x1a64('0x38')]=_[_0x1a64('0x3c')](_0x3d3b4c[_0x1a64('0x38')]);_0x183501[_0x1a64('0x3d')]=_[_0x1a64('0x3e')](_0x183501[_0x1a64('0x3b')],_0x183501[_0x1a64('0x38')]);_0x437a36[_0x1a64('0x3f')]=_[_0x1a64('0x3e')](_0x183501['model'],qs[_0x1a64('0x40')](_0x3d3b4c[_0x1a64('0x38')]['fields']));_0x437a36[_0x1a64('0x3f')]=_0x437a36[_0x1a64('0x3f')]['length']?_0x437a36[_0x1a64('0x3f')]:_0x183501[_0x1a64('0x3b')];if(_0x3d3b4c[_0x1a64('0x38')]['includeAll']){_0x437a36[_0x1a64('0x41')]=[{'all':!![]}];}_0x437a36=_[_0x1a64('0x2a')]({},_0x437a36,_0x3d3b4c['options']);return db['ChatInteraction'][_0x1a64('0x42')](_0x437a36)[_0x1a64('0x13')](handleEntityNotFound(_0x2b1a1e,null))[_0x1a64('0x13')](respondWithResult(_0x2b1a1e,null))[_0x1a64('0x1c')](handleError(_0x2b1a1e,null));};exports['create']=function(_0x54777b,_0x48a095){return db['ChatInteraction'][_0x1a64('0x43')](_0x54777b['body'],{})['then'](respondWithResult(_0x48a095,0xc9))[_0x1a64('0x1c')](handleError(_0x48a095,null));};exports['update']=function(_0x558e63,_0x176d5c){if(_0x558e63[_0x1a64('0x2b')]['id']){delete _0x558e63[_0x1a64('0x2b')]['id'];}return db[_0x1a64('0x30')][_0x1a64('0x42')]({'where':{'id':_0x558e63[_0x1a64('0x3a')]['id']}})[_0x1a64('0x13')](handleEntityNotFound(_0x176d5c,null))['then'](saveUpdates(_0x558e63[_0x1a64('0x2b')],null))[_0x1a64('0x13')](respondWithResult(_0x176d5c,null))[_0x1a64('0x1c')](handleError(_0x176d5c,null));};exports['destroy']=function(_0x4441b5,_0x3a24ea){return db[_0x1a64('0x30')]['find']({'where':{'id':_0x4441b5['params']['id']}})['then'](handleEntityNotFound(_0x3a24ea,null))[_0x1a64('0x13')](removeEntity(_0x3a24ea,null))[_0x1a64('0x1c')](handleError(_0x3a24ea,null));};exports[_0x1a64('0x44')]=function(_0x54ffee,_0x303447){return db[_0x1a64('0x30')][_0x1a64('0x44')]()[_0x1a64('0x13')](respondWithResult(_0x303447,null))[_0x1a64('0x1c')](handleError(_0x303447,null));};exports[_0x1a64('0x45')]=function(_0x29c915,_0x3c62ef){var _0x2279bd=_0x29c915['params']['id'];var _0x3e0a5c;var _0x19b7a9;var _0x530d47;return db[_0x1a64('0x30')][_0x1a64('0x46')]({'where':{'id':_0x2279bd}})[_0x1a64('0x13')](function(_0x2a7931){_0x3e0a5c=_0x2a7931;return db['ChatWebsite']['findOne']({'where':{'id':_0x2a7931[_0x1a64('0x47')]},'attributes':['id',_0x1a64('0x48'),_0x1a64('0x49'),_0x1a64('0x4a'),_0x1a64('0x4b'),_0x1a64('0x4c')],'raw':!![]});})[_0x1a64('0x13')](function(_0x4b94a0){if(_0x4b94a0&&_0x4b94a0['vidaooApiKey']&&_0x4b94a0['vidaooEscalation']){_0x19b7a9=_0x4b94a0;var _0x17fa55={'interaction':{'id':_0x2279bd},'agent':{'id':_0x29c915[_0x1a64('0x39')]['id'],'name':_0x29c915['user'][_0x1a64('0x27')],'fullname':_0x29c915[_0x1a64('0x39')][_0x1a64('0x4d')],'email':_0x29c915['user'][_0x1a64('0x4e')]},'contact':_0x29c915[_0x1a64('0x2b')][_0x1a64('0x4f')],'account':_0x29c915['body'][_0x1a64('0x2d')]};var _0x54f570={'rejectUnauthorized':![],'method':_0x1a64('0x50'),'url':_0x1a64('0x51'),'headers':{'X-APIKEY':_0x4b94a0[_0x1a64('0x48')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x29c915[_0x1a64('0x39')][_0x1a64('0x4e')]],'buttons':null,'topic':_0x19b7a9[_0x1a64('0x4a')],'note':_[_0x1a64('0x52')](_0x19b7a9[_0x1a64('0x4b')])?null:getMustacheRender(_0x19b7a9['vidaooNote'],_0x17fa55),'metadata':null},'redirect':_0x1a64('0x53'),'json':!![]};try{if(!_[_0x1a64('0x52')](_0x19b7a9[_0x1a64('0x4c')])){var _0x1aa14e=getMustacheRender(_0x19b7a9[_0x1a64('0x4c')],_0x17fa55);var _0x565e78=JSON[_0x1a64('0x54')](_0x1aa14e);_0x54f570[_0x1a64('0x2b')][_0x1a64('0x55')]=_0x565e78;}}catch(_0x319363){throw new db[(_0x1a64('0x56'))][(_0x1a64('0x57'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x54f570);}else{throw new db[(_0x1a64('0x56'))][(_0x1a64('0x57'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x1a64('0x13')](function(_0x581434){_0x530d47=_0x581434;if(_0x530d47['id']){var _0x665aae={'body':_0x530d47[_0x1a64('0x58')],'ChatWebsiteId':_0x19b7a9['id'],'ChatInteractionId':_0x3e0a5c['id'],'direction':'out','UserId':_0x29c915[_0x1a64('0x39')]['id']};return db[_0x1a64('0x59')][_0x1a64('0x43')](_0x665aae,{});}else{throw new db[(_0x1a64('0x56'))][(_0x1a64('0x57'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x1a64('0x13')](function(){return _0x3e0a5c[_0x1a64('0x5a')]({'vidaooSessionId':_0x530d47['id']});})[_0x1a64('0x13')](respondWithResult(_0x3c62ef,null))[_0x1a64('0x1c')](handleError(_0x3c62ef,null));};exports[_0x1a64('0x5b')]=function(_0x5dd1f4,_0x24b291){if(_0x5dd1f4[_0x1a64('0x2b')]['id']){delete _0x5dd1f4[_0x1a64('0x2b')]['id'];}return db[_0x1a64('0x30')][_0x1a64('0x42')]({'where':{'id':_0x5dd1f4[_0x1a64('0x3a')]['id']},'include':[{'model':db[_0x1a64('0x5c')],'as':_0x1a64('0x5d')}]})['then'](handleEntityNotFound(_0x24b291,null))[_0x1a64('0x13')](saveUpdates(_0x5dd1f4[_0x1a64('0x2b')],null))[_0x1a64('0x13')](respondWithResult(_0x24b291,null))[_0x1a64('0x1c')](handleError(_0x24b291,null));};exports[_0x1a64('0x5e')]=function(_0x3ecf23,_0x108da6){if(_0x3ecf23[_0x1a64('0x2b')]['id']){delete _0x3ecf23['body']['id'];}return db['ChatInteraction'][_0x1a64('0x42')]({'where':{'id':_0x3ecf23[_0x1a64('0x3a')]['id']}})[_0x1a64('0x13')](function(_0x1be29f){if(!_0x1be29f){logger[_0x1a64('0x18')](_0x1a64('0x5f'),_0x1a64('0x5e'),0x194,_0x1a64('0x60'));_0x108da6[_0x1a64('0x1d')](0x194);}else{if(_0x1be29f[_0x1a64('0x61')]){throw new db[(_0x1a64('0x56'))][(_0x1a64('0x57'))](_0x1a64('0x62'));}}return _0x1be29f;})['then'](function(_0x5e0627){if(_0x5e0627){return _0x5e0627['update']({'closed':_0x3ecf23[_0x1a64('0x2b')][_0x1a64('0x63')],'disposition':_0x3ecf23['body']['disposition']})['then'](function(_0x191c21){return _0x191c21;});}})[_0x1a64('0x13')](function(){return respondWithRpcPromise('AbandonInteraction',_0x1a64('0x5e'),_0x3ecf23['body'],client9004);})[_0x1a64('0x13')](respondWithResult(_0x108da6,null))[_0x1a64('0x1c')](handleError(_0x108da6,null));};exports[_0x1a64('0x64')]=function(_0x46c07b,_0x2c63bf){_0x46c07b[_0x1a64('0x2b')][_0x1a64('0x27')]=_0x46c07b[_0x1a64('0x65')][_0x1a64('0x66')];_0x46c07b['body'][_0x1a64('0x67')]=_0x46c07b[_0x1a64('0x65')][_0x1a64('0x68')];_0x46c07b[_0x1a64('0x2b')]['type']=_0x46c07b[_0x1a64('0x65')][_0x1a64('0x69')];return db[_0x1a64('0x6a')][_0x1a64('0x43')](_0x46c07b['body'])[_0x1a64('0x13')](respondWithResult(_0x2c63bf,0xc9))[_0x1a64('0x1c')](handleError(_0x2c63bf,null));};exports[_0x1a64('0x6b')]=function(_0x4e1d73,_0x2f3338){return db[_0x1a64('0x30')][_0x1a64('0x46')]({'where':{'id':_0x4e1d73['params']['id']},'raw':!![]})[_0x1a64('0x13')](handleEntityNotFound(_0x2f3338,null))['then'](function(_0xba9f42){if(_0xba9f42){if(_0xba9f42[_0x1a64('0x63')]){return _0x2f3338[_0x1a64('0x1f')](0x193)[_0x1a64('0x6c')]({'status':0x193,'message':_0x1a64('0x6d')});}return db['Attachment'][_0x1a64('0x46')]({'where':{'id':_0x4e1d73['query'][_0x1a64('0x6e')]},'raw':!![]})[_0x1a64('0x13')](handleEntityNotFound(_0x2f3338,null));}})['then'](function(_0x1a7539){if(_0x1a7539){var _0x4d895b=_0x1a7539['ChatOfflineMessageId']!==null;var _0x6c8f4d=path[_0x1a64('0x6f')](config[_0x1a64('0x70')],_0x1a64('0x71'));if(_0x4d895b){_0x6c8f4d=path['join'](_0x6c8f4d,_0x1a64('0x72'));}var _0x4edd79=path['join'](_0x6c8f4d,_0x1a7539[_0x1a64('0x67')]);return _0x2f3338['download'](_0x4edd79);}})['catch'](handleError(_0x2f3338,null));};exports['close']=function(_0x14ce35,_0x466e70){var _0x499857=null;var _0x2ed772=null;var _0x359d57=null;if(_0x14ce35['body']['id']){delete _0x14ce35[_0x1a64('0x2b')]['id'];}if(_0x14ce35[_0x1a64('0x2b')][_0x1a64('0x73')]){_0x359d57=path[_0x1a64('0x6f')](config[_0x1a64('0x70')],'server/files/chat/upload/',util[_0x1a64('0x74')](_0x1a64('0x75'),Date[_0x1a64('0x76')]()));_0x14ce35[_0x1a64('0x2b')]['pathTranscript']=_0x359d57;}return db['ChatInteraction'][_0x1a64('0x42')]({'where':{'id':_0x14ce35['params']['id']},'include':[{'model':db[_0x1a64('0x59')],'as':'Messages','include':[{'model':db[_0x1a64('0x77')],'as':_0x1a64('0x77')}]}]})[_0x1a64('0x13')](handleEntityNotFound(_0x466e70,null))[_0x1a64('0x13')](saveUpdates(_0x14ce35[_0x1a64('0x2b')],null))[_0x1a64('0x13')](function(_0xda163e){if(_0xda163e){_0x499857=_0xda163e;return db[_0x1a64('0x78')]['find']({'where':{'id':_0x499857[_0x1a64('0x47')]}});}})[_0x1a64('0x13')](function(_0xa24c0a){if(_0xa24c0a){_0x2ed772=_0xa24c0a;return db[_0x1a64('0x5c')]['find']({'where':{'id':_0x499857[_0x1a64('0x79')]}});}})[_0x1a64('0x13')](function(_0x2176c7){if(_0x2176c7){if(_0x359d57){var _0x3cfb92=null;for(var _0x3308e1=0x1;_0x3308e1<_0x499857[_0x1a64('0x7a')][_0x1a64('0x7b')];++_0x3308e1){_0x3cfb92=_0x499857['Messages'][_0x3308e1];var _0x2fea2e=_0x3cfb92['UserId']?util[_0x1a64('0x74')](_0x1a64('0x7c'),_0x2ed772[_0x1a64('0x7d')],_0x3cfb92[_0x1a64('0x61')]):'System';var _0x557867=_0x14ce35[_0x1a64('0x2b')][_0x1a64('0x7e')]||util['format'](_0x1a64('0x7c'),_0x1a64('0x7f'),_0x3cfb92[_0x1a64('0x79')]);switch(_0x2ed772[_0x1a64('0x80')]){case _0x1a64('0x81'):_0x2fea2e=_0x3cfb92['UserId']?util['format'](_0x1a64('0x7c'),_0x2ed772['agentAlias'],_0x3cfb92['UserId']):_0x1a64('0x82');break;case'agent_alias':_0x2fea2e=_0x3cfb92['UserId']?_0x3cfb92[_0x1a64('0x77')][_0x1a64('0x83')]||_0x3cfb92[_0x1a64('0x77')][_0x1a64('0x4d')]:_0x1a64('0x82');break;case'agent_fullname':_0x2fea2e=_0x3cfb92[_0x1a64('0x61')]?_0x3cfb92[_0x1a64('0x77')][_0x1a64('0x4d')]:_0x1a64('0x82');break;default:_0x2fea2e=_0x3cfb92['UserId']?util[_0x1a64('0x74')](_0x1a64('0x7c'),_0x2ed772[_0x1a64('0x7d')],_0x3cfb92[_0x1a64('0x61')]):_0x1a64('0x82');}var _0xd884a1=util[_0x1a64('0x74')](_0x1a64('0x84'),moment(_0x3cfb92[_0x1a64('0x85')])[_0x1a64('0x74')](_0x1a64('0x86')),_0x3cfb92['direction']==='in'?_0x557867:_0x2fea2e,_0x3cfb92['body']);if(!_0x3cfb92[_0x1a64('0x87')]){fs[_0x1a64('0x88')](_0x359d57,_0xd884a1);}}return db[_0x1a64('0x89')][_0x1a64('0x46')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1a64('0x8a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x1a64('0x13')](function(_0x4aa540){if(!_0x4aa540||!_0x4aa540[_0x1a64('0x8a')]||!_0x14ce35[_0x1a64('0x2b')])return _0x499857;var _0xad1595=_0x4aa540[_0x1a64('0x8b')]();return respondWithRpcPromise('SendMail',_0x1a64('0x8c'),{'account':_0xad1595,'message':{'from':util[_0x1a64('0x74')](_0x1a64('0x8d'),_0x4aa540[_0x1a64('0x27')],_0x4aa540[_0x1a64('0x4e')]||_0x4aa540[_0x1a64('0x8a')][_0x1a64('0x39')]),'to':_0x14ce35[_0x1a64('0x2b')][_0x1a64('0x73')],'subject':_0x1a64('0x8e'),'text':util[_0x1a64('0x74')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x14ce35['body'][_0x1a64('0x73')]),'attachments':[{'path':_0x359d57}]}})[_0x1a64('0x13')](function(){return _0x499857;})[_0x1a64('0x1c')](function(_0x37a943){logger['error'](_0x37a943);});})['then'](respondWithStatusCode(_0x466e70,0xc8))[_0x1a64('0x1c')](handleError(_0x466e70,null));};exports[_0x1a64('0x8f')]=function(_0x171499,_0x8e9541){return db['ChatMessage'][_0x1a64('0x42')]({'where':{'id':_0x171499[_0x1a64('0x3a')]['id']}})[_0x1a64('0x13')](handleEntityNotFound(_0x8e9541,null))[_0x1a64('0x13')](function(_0x286b91){if(_0x286b91){return _0x286b91[_0x1a64('0x8f')](_0x171499['body'][_0x1a64('0x90')],_[_0x1a64('0x91')](_0x171499['body'],[_0x1a64('0x90'),'id'])||{});}})[_0x1a64('0x13')](respondWithResult(_0x8e9541,null))[_0x1a64('0x1c')](handleError(_0x8e9541,null));};exports[_0x1a64('0x92')]=function(_0x3ba777,_0x467fb1){var _0xd8bead={'raw':![],'where':{}};var _0x1e5f01={};var _0x590db6={'count':0x0,'rows':[]};return db[_0x1a64('0x30')]['findOne']({'where':{'id':_0x3ba777[_0x1a64('0x3a')]['id']}})['then'](handleEntityNotFound(_0x467fb1,null))[_0x1a64('0x13')](function(_0x47a817){if(_0x47a817){_0x1e5f01['model']=_[_0x1a64('0x3c')](db[_0x1a64('0x59')][_0x1a64('0x31')]);_0x1e5f01[_0x1a64('0x38')]=_[_0x1a64('0x3c')](_0x3ba777[_0x1a64('0x38')]);_0x1e5f01[_0x1a64('0x3d')]=_['intersection'](_0x1e5f01['model'],_0x1e5f01[_0x1a64('0x38')]);_0xd8bead[_0x1a64('0x3f')]=_[_0x1a64('0x3e')](_0x1e5f01[_0x1a64('0x3b')],qs[_0x1a64('0x40')](_0x3ba777[_0x1a64('0x38')]['fields']));_0xd8bead['attributes']=_0xd8bead[_0x1a64('0x3f')][_0x1a64('0x7b')]?_0xd8bead['attributes']:_0x1e5f01['model'];if(!_0x3ba777[_0x1a64('0x38')][_0x1a64('0x93')](_0x1a64('0x94'))){_0xd8bead[_0x1a64('0x20')]=qs[_0x1a64('0x20')](_0x3ba777['query'][_0x1a64('0x20')]);_0xd8bead['offset']=qs[_0x1a64('0x23')](_0x3ba777['query'][_0x1a64('0x23')]);}_0xd8bead[_0x1a64('0x95')]=qs[_0x1a64('0x96')](_0x3ba777['query'][_0x1a64('0x96')]);_0xd8bead['where']=qs['filters'](_[_0x1a64('0x97')](_0x3ba777[_0x1a64('0x38')],_0x1e5f01[_0x1a64('0x3d')]));_0xd8bead['where'][_0x1a64('0x98')]=_0x47a817['id'];if(_0x3ba777[_0x1a64('0x38')]['filter']){_0xd8bead[_0x1a64('0x99')]=_[_0x1a64('0x2a')](_0xd8bead[_0x1a64('0x99')],{'$or':_[_0x1a64('0x2f')](_0xd8bead[_0x1a64('0x3f')],function(_0x513e72){var _0x577af4={};_0x577af4[_0x513e72]={'$like':'%'+_0x3ba777[_0x1a64('0x38')][_0x1a64('0x9a')]+'%'};return _0x577af4;})});}if(_0x3ba777[_0x1a64('0x38')][_0x1a64('0x9b')]){var _0x294799=_0x3ba777[_0x1a64('0x38')]['$gte'][_0x1a64('0x9c')](',');var _0x404058={};_0x404058[_0x294799[0x0]]={'$gte':moment(_0x294799[0x1])[_0x1a64('0x74')](_0x1a64('0x9d'))};_0xd8bead[_0x1a64('0x99')]=_['merge'](_0xd8bead[_0x1a64('0x99')],_0x404058);}_0xd8bead=_['merge']({},_0xd8bead,_0x3ba777[_0x1a64('0x9e')]);return db['ChatMessage']['count']({'where':_0xd8bead[_0x1a64('0x99')]})[_0x1a64('0x13')](function(_0x4724b7){_0x590db6['count']=_0x4724b7;if(_0x3ba777[_0x1a64('0x38')][_0x1a64('0x9f')]){_0xd8bead[_0x1a64('0x41')]=[{'all':!![]}];}return db[_0x1a64('0x59')][_0x1a64('0x36')](_0xd8bead);})[_0x1a64('0x13')](function(_0x31f7f1){_0x590db6[_0x1a64('0xa0')]=_0x31f7f1;return _0x590db6;});}})[_0x1a64('0x13')](respondWithFilteredResult(_0x467fb1,_0xd8bead))[_0x1a64('0x1c')](handleError(_0x467fb1,null));};exports[_0x1a64('0xa1')]=function(_0x17f008,_0x5cf9fe){var _0x4266d4={'where':{}},_0x8cdf89={},_0x4c44ba={'count':0x0,'rows':[]};return db[_0x1a64('0x30')][_0x1a64('0x46')]({'where':{'id':_0x17f008['params']['id']}})[_0x1a64('0x13')](handleEntityNotFound(_0x5cf9fe,null))['then'](function(_0x2a7d11){if(_0x2a7d11){_0x8cdf89[_0x1a64('0x3b')]=_[_0x1a64('0x3c')](db[_0x1a64('0x59')][_0x1a64('0x31')]);_0x8cdf89[_0x1a64('0x38')]=_[_0x1a64('0x3c')](_0x17f008['query']);_0x8cdf89[_0x1a64('0x3d')]=_[_0x1a64('0x3e')](_0x8cdf89['model'],_0x8cdf89[_0x1a64('0x38')]);_0x4266d4['attributes']=_[_0x1a64('0x3e')](_0x8cdf89[_0x1a64('0x3b')],qs[_0x1a64('0x40')](_0x17f008[_0x1a64('0x38')][_0x1a64('0x40')]));_0x4266d4[_0x1a64('0x3f')]=_0x4266d4[_0x1a64('0x3f')][_0x1a64('0x7b')]?_0x4266d4['attributes']:_0x8cdf89[_0x1a64('0x3b')];if(!_0x17f008[_0x1a64('0x38')][_0x1a64('0x93')](_0x1a64('0x94'))){_0x4266d4[_0x1a64('0x20')]=qs[_0x1a64('0x20')](_0x17f008[_0x1a64('0x38')][_0x1a64('0x20')]);_0x4266d4[_0x1a64('0x23')]=qs[_0x1a64('0x23')](_0x17f008[_0x1a64('0x38')]['offset']);}_0x4266d4[_0x1a64('0x95')]=qs['sort'](_0x17f008['query']['sort']);_0x4266d4[_0x1a64('0x99')]=qs[_0x1a64('0x3d')](_[_0x1a64('0x97')](_0x17f008[_0x1a64('0x38')],_0x8cdf89['filters']));_0x4266d4[_0x1a64('0x99')][_0x1a64('0x98')]=_0x2a7d11['id'];if(_0x17f008[_0x1a64('0x38')]['filter']){_0x4266d4[_0x1a64('0x99')]=_[_0x1a64('0x2a')](_0x4266d4[_0x1a64('0x99')],{'$or':_[_0x1a64('0x2f')](_0x4266d4[_0x1a64('0x3f')],function(_0x33a008){var _0x3040ca={};_0x3040ca[_0x33a008]={'$like':'%'+_0x17f008[_0x1a64('0x38')][_0x1a64('0x9a')]+'%'};return _0x3040ca;})});}_0x4266d4['where'][_0x1a64('0x87')]=![];if(_0x17f008[_0x1a64('0x38')]['id']){_0x4266d4[_0x1a64('0x99')]['id']={'$gt':_0x17f008[_0x1a64('0x38')]['id']};}_0x4266d4=_[_0x1a64('0x2a')]({},_0x4266d4,_0x17f008[_0x1a64('0x9e')]);return db[_0x1a64('0x59')][_0x1a64('0x22')]({'where':_0x4266d4[_0x1a64('0x99')]})[_0x1a64('0x13')](function(_0x283bc5){_0x4c44ba[_0x1a64('0x22')]=_0x283bc5;_0x4266d4[_0x1a64('0x41')]=[];if(_0x17f008[_0x1a64('0x38')]['includeAgent']){_0x4266d4[_0x1a64('0x41')][_0x1a64('0xa2')]({'model':db[_0x1a64('0x77')],'as':_0x1a64('0x77'),'attributes':['id',_0x1a64('0x4d'),_0x1a64('0x83')]});}if(_0x17f008['query'][_0x1a64('0x9f')]){_0x4266d4[_0x1a64('0x41')]=[{'all':!![]}];}return db[_0x1a64('0x59')]['findAll'](_0x4266d4);})['then'](function(_0x3be321){_0x4c44ba[_0x1a64('0xa0')]=_0x3be321;return _0x4c44ba;});}})[_0x1a64('0x13')](respondWithFilteredResult(_0x5cf9fe,_0x4266d4))['catch'](handleError(_0x5cf9fe,null));};exports[_0x1a64('0xa3')]=function(_0x4bf208,_0x54ecd5){return db[_0x1a64('0x30')][_0x1a64('0x42')]({'where':{'id':_0x4bf208[_0x1a64('0x3a')]['id']}})[_0x1a64('0x13')](handleEntityNotFound(_0x54ecd5,null))['then'](function(_0x17c76d){if(_0x17c76d){return _0x17c76d[_0x1a64('0xa4')](_0x4bf208['body'][_0x1a64('0x90')],_['omit'](_0x4bf208[_0x1a64('0x2b')],[_0x1a64('0x90'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x1a64('0x27'),_0x1a64('0xa5')],'where':{'id':_0x4bf208['body']['ids']}});})[_0x1a64('0x13')](function(_0x3d6e4f){socket[_0x1a64('0xa6')](_0x1a64('0xa7'),{'id':Number(_0x4bf208[_0x1a64('0x3a')]['id']),'tags':_0x3d6e4f||[]});return{'id':Number(_0x4bf208[_0x1a64('0x3a')]['id']),'tags':_0x3d6e4f||[]};});}})['then'](respondWithResult(_0x54ecd5,null))[_0x1a64('0x1c')](handleError(_0x54ecd5,null));};exports[_0x1a64('0xa8')]=function(_0xe59e81,_0x4873b5){return db[_0x1a64('0x30')][_0x1a64('0x42')]({'where':{'id':_0xe59e81['params']['id']}})[_0x1a64('0x13')](handleEntityNotFound(_0x4873b5,null))[_0x1a64('0x13')](function(_0x54f1c6){if(_0x54f1c6){return _0x54f1c6['removeTags'](_0xe59e81[_0x1a64('0x38')][_0x1a64('0x90')]);}})[_0x1a64('0x13')](respondWithStatusCode(_0x4873b5,null))[_0x1a64('0x1c')](handleError(_0x4873b5,null));};exports[_0x1a64('0xa9')]=function(_0x3f30fa,_0x38aa49){var _0x5aa2b0=moment()['unix']()[_0x1a64('0xaa')]();var _0x4927cf=path[_0x1a64('0x6f')](config[_0x1a64('0x70')],_0x1a64('0xab'),_0x1a64('0xac'),_0x1a64('0xad'));var _0x5b88fe=path['join'](config[_0x1a64('0x70')],_0x1a64('0xab'),_0x1a64('0xac'),_0x1a64('0xae'));var _0x2fa326=path[_0x1a64('0x6f')](_0x4927cf,_0x5aa2b0);var _0x54de0d=util['format'](_0x1a64('0xaf'),_0x3f30fa[_0x1a64('0x3a')]['id'],_0x5aa2b0);var _0x366745=path[_0x1a64('0x6f')](_0x4927cf,_0x54de0d);var _0x5c1706=[];_0x5c1706['push']({'model':db[_0x1a64('0x77')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5c1706[_0x1a64('0xa2')]({'model':db[_0x1a64('0x5c')],'as':_0x1a64('0x5d'),'attributes':['id',_0x1a64('0xb0'),'lastName'],'raw':!![]});if(_0x3f30fa['query']['attachments']){_0x5c1706[_0x1a64('0xa2')]({'model':db['Attachment'],'as':_0x1a64('0x6a'),'raw':!![]});}var _0x368a01=[{'model':db['ChatMessage'],'as':_0x1a64('0x7a'),'attributes':['id',_0x1a64('0x2b'),_0x1a64('0x85'),_0x1a64('0xb1'),_0x1a64('0x87'),_0x1a64('0xb2')],'include':_0x5c1706}];_0x368a01[_0x1a64('0xa2')]({'model':db[_0x1a64('0x78')],'as':_0x1a64('0xb3'),'attributes':['id',_0x1a64('0x27')]});_0x368a01[_0x1a64('0xa2')]({'model':db[_0x1a64('0x77')],'as':_0x1a64('0xb4'),'attributes':['id','fullname']});return db[_0x1a64('0x30')][_0x1a64('0x42')]({'where':{'id':_0x3f30fa['params']['id']},'include':_0x368a01})[_0x1a64('0x13')](handleEntityNotFound(_0x38aa49,null))[_0x1a64('0x13')](function(_0x5d4f34){if(_0x5d4f34){var _0x20a865=_0x5d4f34[_0x1a64('0xb5')]({'plain':!![]});fs[_0x1a64('0xb6')](_0x2fa326);var _0xea5e27={'channel':'Chat','account':_0x20a865[_0x1a64('0xb3')][_0x1a64('0x27')],'agent':_0x20a865[_0x1a64('0xb4')]?_0x20a865['Owner'][_0x1a64('0x4d')]:_0x1a64('0xb7'),'createdAt':moment(_0x20a865[_0x1a64('0x85')])[_0x1a64('0x74')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x20a865[_0x1a64('0x63')]?moment(_0x20a865[_0x1a64('0xb8')])[_0x1a64('0x74')](_0x1a64('0x9d'))[_0x1a64('0xaa')]():'','disposition':_0x20a865[_0x1a64('0xb9')],'chatInfo':{'browser':_0x20a865[_0x1a64('0xba')],'os':_0x20a865[_0x1a64('0xbb')],'referer':_0x20a865[_0x1a64('0xbc')],'customerIp':_0x20a865[_0x1a64('0xbd')],'customerPort':_0x20a865[_0x1a64('0xbe')]?_0x20a865[_0x1a64('0xbe')]:_0x1a64('0xb7')},'messages':_(_0x20a865[_0x1a64('0x7a')])['tail']()[_0x1a64('0x9a')]({'secret':![]})[_0x1a64('0x2f')](function(_0x1048d4){if(_0x1048d4[_0x1a64('0x6a')]){var _0x449543=path[_0x1a64('0x6f')](_0x5b88fe,_0x1048d4['Attachment'][_0x1a64('0x67')]);if(fs[_0x1a64('0xbf')](_0x449543)){fs['createReadStream'](_0x449543)[_0x1a64('0xc0')](fs[_0x1a64('0xc1')](path[_0x1a64('0x6f')](_0x2fa326,_0x1048d4['Attachment'][_0x1a64('0x67')])));}}return{'date':moment(_0x1048d4[_0x1a64('0x85')])['format'](_0x1a64('0x9d'))[_0x1a64('0xaa')](),'sender':_0x1048d4['direction']===_0x1a64('0xc2')?_0x1048d4[_0x1a64('0x77')]?_0x1048d4[_0x1a64('0x77')][_0x1a64('0x4d')]:_0x1a64('0x82'):_0x1048d4[_0x1a64('0x5d')]['firstName']+(_0x1048d4['Contact'][_0x1a64('0xc3')]?'\x20'+_0x1048d4[_0x1a64('0x5d')][_0x1a64('0xc3')]:''),'body':_0x1048d4[_0x1a64('0x6a')]?_0x1048d4['Attachment'][_0x1a64('0x67')]:_0x1048d4[_0x1a64('0x2b')],'direction':_0x1048d4['direction']===_0x1a64('0xc2')?'A':'C','secret':_0x1048d4['secret'],'read':_0x1048d4['read'],'attachment':_0x1048d4[_0x1a64('0x6a')]};})[_0x1a64('0xc4')]()};return ejs[_0x1a64('0xc5')](path[_0x1a64('0x6f')](config[_0x1a64('0x70')],'server',_0x1a64('0xc6'),_0x1a64('0xc7')),{'interaction':_0xea5e27})['then'](function(_0x1c6318){var _0x52f59e=path[_0x1a64('0x6f')](_0x2fa326,'transcript-'+_0x20a865['id']+'-'+_0x5aa2b0+_0x1a64('0xc8'));var _0x52a754={'path':_0x52f59e,'channel':_0x1a64('0xc9'),'interactionId':_0x20a865['id']};return pdf[_0x1a64('0xca')](_0x1c6318,_0x52a754);})['then'](function(){return new Promise(function(_0x19ee42,_0x456154){zipdir(_0x2fa326,{'saveTo':_0x366745},function(_0x481f6c,_0x5b5923){if(_0x481f6c)return _0x456154(_0x481f6c);return _0x19ee42(_0x5b5923);});})[_0x1a64('0x13')](function(){return new BPromise(function(_0x4f3340,_0x122bc8){rimraf(_0x2fa326,function(_0x803957){if(_0x803957)_0x122bc8(_0x803957);return _0x4f3340();});});})[_0x1a64('0x13')](function(){return _0x38aa49[_0x1a64('0xa9')](_0x366745,_0x54de0d,function(_0x2b6aff){if(_0x2b6aff){logger[_0x1a64('0x18')]('err',_0x2b6aff);}else{fs[_0x1a64('0xcb')](_0x366745);}});});});}else{return _0x38aa49[_0x1a64('0x1d')](0xc8);}})[_0x1a64('0x1c')](handleError(_0x38aa49,null));}; \ No newline at end of file +var _0x28ba=['Owner','get','mkdirSync','Account','N.A.','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','lastName','value','renderFile','views','downloadInteraction.ejs','.pdf','Chat','createPdfFromHTML','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','stack','render','merge','body','contact','agent','interaction','account','map','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','chat','query','user','show','params','keys','model','attributes','fields','length','includeAll','include','options','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','name','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','create','attachmentDownload','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','User','ContactId','format','%s%d','UserId','System','customer','Visitor','agentIdentifier','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','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','getMessages','intersection','hasOwnProperty','nolimit','order','sort','where','filters','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','fullname','setTags','spread','emit','chatInteractionTags:save','removeTags','toString','files','server','attachments','transcript-%d-%s.zip','firstName','push','read'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x28ba,0x1be));var _0xa28b=function(_0x291a2d,_0x56ce92){_0x291a2d=_0x291a2d-0x0;var _0x4a660a=_0x28ba[_0x291a2d];return _0x4a660a;};'use strict';var rimraf=require(_0xa28b('0x0'));var zipdir=require(_0xa28b('0x1'));var rp=require(_0xa28b('0x2'));var moment=require(_0xa28b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa28b('0x4'));var util=require(_0xa28b('0x5'));var path=require('path');var ejs=require(_0xa28b('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xa28b('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xa28b('0x8'));var pdf=require(_0xa28b('0x9'));var logger=require(_0xa28b('0xa'))(_0xa28b('0xb'));var config=require(_0xa28b('0xc'));var db=require(_0xa28b('0xd'))['db'];config[_0xa28b('0xe')]=_[_0xa28b('0xf')](config['redis'],{'host':_0xa28b('0x10'),'port':0x18eb});var socket=require(_0xa28b('0x11'))(new Redis(config[_0xa28b('0xe')]));require(_0xa28b('0x12'))[_0xa28b('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa28b('0x14')][_0xa28b('0x15')]({'port':0x232b});var client9004=jayson[_0xa28b('0x14')][_0xa28b('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x14463a,_0xf0d998,_0x5375ef,_0xb392d1){return new BPromise(function(_0x331a09,_0x5b1130){var _0x3887e6=_0xb392d1||client;return _0x3887e6[_0xa28b('0x16')](_0x14463a,_0x5375ef)[_0xa28b('0x17')](function(_0x36f834){logger[_0xa28b('0x18')](_0xa28b('0x19'),_0xf0d998,_0xa28b('0x1a'));logger[_0xa28b('0x1b')](_0xa28b('0x1c'),_0xf0d998,_0xa28b('0x1a'),JSON[_0xa28b('0x1d')](_0x36f834));if(_0x36f834[_0xa28b('0x1e')]){if(_0x36f834['error'][_0xa28b('0x1f')]===0x1f4){logger['error'](_0xa28b('0x19'),_0xf0d998,_0x36f834[_0xa28b('0x1e')][_0xa28b('0x20')]);return _0x5b1130(_0x36f834[_0xa28b('0x1e')][_0xa28b('0x20')]);}logger[_0xa28b('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0xf0d998,_0x36f834[_0xa28b('0x1e')][_0xa28b('0x20')]);return _0x331a09(_0x36f834['error'][_0xa28b('0x20')]);}else{logger[_0xa28b('0x18')]('ChatInteraction,\x20%s,\x20%s',_0xf0d998,'request\x20sent');_0x331a09(_0x36f834[_0xa28b('0x21')][_0xa28b('0x20')]);}})[_0xa28b('0x22')](function(_0x21596a){logger[_0xa28b('0x1e')](_0xa28b('0x19'),_0xf0d998,_0x21596a);_0x5b1130(_0x21596a);});});}function respondWithStatusCode(_0x2b0f64,_0x381974){_0x381974=_0x381974||0xcc;return function(_0x2cc6ee){if(_0x2cc6ee){return _0x2b0f64[_0xa28b('0x23')](_0x381974);}return _0x2b0f64[_0xa28b('0x24')](_0x381974)[_0xa28b('0x25')]();};}function respondWithResult(_0x3f56e4,_0x4f2012){_0x4f2012=_0x4f2012||0xc8;return function(_0x504122){if(_0x504122){return _0x3f56e4[_0xa28b('0x24')](_0x4f2012)[_0xa28b('0x26')](_0x504122);}};}function respondWithFilteredResult(_0x2fd971,_0x264070){return function(_0x501c4b){if(_0x501c4b){var _0x411f0f=typeof _0x264070['offset']===_0xa28b('0x27')&&typeof _0x264070[_0xa28b('0x28')]==='undefined';var _0x297f10=_0x501c4b[_0xa28b('0x29')];var _0x3cd9f4=_0x411f0f?0x0:_0x264070[_0xa28b('0x2a')];var _0xcb72d4=_0x411f0f?_0x501c4b['count']:_0x264070['offset']+_0x264070['limit'];var _0x25aebd;if(_0xcb72d4>=_0x297f10){_0xcb72d4=_0x297f10;_0x25aebd=0xc8;}else{_0x25aebd=0xce;}_0x2fd971['status'](_0x25aebd);return _0x2fd971['set'](_0xa28b('0x2b'),_0x3cd9f4+'-'+_0xcb72d4+'/'+_0x297f10)[_0xa28b('0x26')](_0x501c4b);}return null;};}function saveUpdates(_0x4599e7){return function(_0x10f0a9){if(_0x10f0a9){return _0x10f0a9[_0xa28b('0x2c')](_0x4599e7)[_0xa28b('0x17')](function(_0x2ffb8a){return _0x2ffb8a;});}return null;};}function removeEntity(_0x4b8974){return function(_0x565f24){if(_0x565f24){return _0x565f24[_0xa28b('0x2d')]()[_0xa28b('0x17')](function(){_0x4b8974[_0xa28b('0x24')](0xcc)[_0xa28b('0x25')]();});}};}function handleEntityNotFound(_0x170d65){return function(_0x2e3c67){if(!_0x2e3c67){_0x170d65['sendStatus'](0x194);}return _0x2e3c67;};}function handleError(_0xcee7d4,_0x32ce5f){_0x32ce5f=_0x32ce5f||0x1f4;return function(_0x1f52e1){logger[_0xa28b('0x1e')](_0x1f52e1[_0xa28b('0x2e')]);if(_0x1f52e1['name']){delete _0x1f52e1['name'];}_0xcee7d4[_0xa28b('0x24')](_0x32ce5f)['send'](_0x1f52e1);};}function getMustacheRender(_0x11943b,_0x353337){return Mustache[_0xa28b('0x2f')](_0x11943b,_[_0xa28b('0x30')](_0x353337[_0xa28b('0x31')],{'contact':_0x353337[_0xa28b('0x32')],'message':_0x353337[_0xa28b('0x20')],'agent':_0x353337[_0xa28b('0x33')],'interaction':_0x353337[_0xa28b('0x34')],'account':_0x353337[_0xa28b('0x35')]}))||'';}exports['index']=function(_0x227722,_0x31f43f){var _0x4079c8={};var _0x3ca4e0=_[_0xa28b('0x36')](db[_0xa28b('0x37')][_0xa28b('0x38')],function(_0x5e3e74){return{'name':_0x5e3e74[_0xa28b('0x39')],'type':_0x5e3e74[_0xa28b('0x3a')]['key']};});_0x4079c8=qs[_0xa28b('0x3b')](_0x3ca4e0,_0x227722);return interaction[_0xa28b('0x3c')](_0xa28b('0x3d'),_0x227722[_0xa28b('0x3e')],_0x227722[_0xa28b('0x3f')],_0x4079c8,_0x3ca4e0)['then'](respondWithFilteredResult(_0x31f43f,_0x4079c8))[_0xa28b('0x22')](handleError(_0x31f43f,null));};exports[_0xa28b('0x40')]=function(_0x981495,_0x291ab0){var _0x9a8e8={'raw':![],'where':{'id':_0x981495[_0xa28b('0x41')]['id']}},_0x6279f1={};_0x6279f1['model']=_['keys'](db['ChatInteraction']['rawAttributes']);_0x6279f1[_0xa28b('0x3e')]=_[_0xa28b('0x42')](_0x981495[_0xa28b('0x3e')]);_0x6279f1['filters']=_['intersection'](_0x6279f1[_0xa28b('0x43')],_0x6279f1[_0xa28b('0x3e')]);_0x9a8e8[_0xa28b('0x44')]=_['intersection'](_0x6279f1[_0xa28b('0x43')],qs[_0xa28b('0x45')](_0x981495[_0xa28b('0x3e')]['fields']));_0x9a8e8['attributes']=_0x9a8e8[_0xa28b('0x44')][_0xa28b('0x46')]?_0x9a8e8[_0xa28b('0x44')]:_0x6279f1[_0xa28b('0x43')];if(_0x981495[_0xa28b('0x3e')][_0xa28b('0x47')]){_0x9a8e8[_0xa28b('0x48')]=[{'all':!![]}];}_0x9a8e8=_[_0xa28b('0x30')]({},_0x9a8e8,_0x981495[_0xa28b('0x49')]);return db['ChatInteraction'][_0xa28b('0x4a')](_0x9a8e8)[_0xa28b('0x17')](handleEntityNotFound(_0x291ab0,null))[_0xa28b('0x17')](respondWithResult(_0x291ab0,null))['catch'](handleError(_0x291ab0,null));};exports['create']=function(_0x21026b,_0x18ac45){return db[_0xa28b('0x37')]['create'](_0x21026b['body'],{})[_0xa28b('0x17')](respondWithResult(_0x18ac45,0xc9))[_0xa28b('0x22')](handleError(_0x18ac45,null));};exports['update']=function(_0x1bcdee,_0x3c349f){if(_0x1bcdee['body']['id']){delete _0x1bcdee[_0xa28b('0x31')]['id'];}return db[_0xa28b('0x37')][_0xa28b('0x4a')]({'where':{'id':_0x1bcdee[_0xa28b('0x41')]['id']}})[_0xa28b('0x17')](handleEntityNotFound(_0x3c349f,null))[_0xa28b('0x17')](saveUpdates(_0x1bcdee[_0xa28b('0x31')],null))[_0xa28b('0x17')](respondWithResult(_0x3c349f,null))[_0xa28b('0x22')](handleError(_0x3c349f,null));};exports[_0xa28b('0x2d')]=function(_0x2a702c,_0x4ac6da){return db['ChatInteraction']['find']({'where':{'id':_0x2a702c[_0xa28b('0x41')]['id']}})[_0xa28b('0x17')](handleEntityNotFound(_0x4ac6da,null))[_0xa28b('0x17')](removeEntity(_0x4ac6da,null))[_0xa28b('0x22')](handleError(_0x4ac6da,null));};exports[_0xa28b('0x4b')]=function(_0x1e7ec5,_0x192928){return db['ChatInteraction'][_0xa28b('0x4b')]()[_0xa28b('0x17')](respondWithResult(_0x192928,null))[_0xa28b('0x22')](handleError(_0x192928,null));};exports[_0xa28b('0x4c')]=function(_0x965fd2,_0x32e82e){var _0x193e98=_0x965fd2[_0xa28b('0x41')]['id'];var _0x310f5f;var _0x16f7b4;var _0x1c5b04;return db[_0xa28b('0x37')][_0xa28b('0x4d')]({'where':{'id':_0x193e98}})['then'](function(_0x3313fd){_0x310f5f=_0x3313fd;return db[_0xa28b('0x4e')][_0xa28b('0x4d')]({'where':{'id':_0x3313fd[_0xa28b('0x4f')]},'attributes':['id',_0xa28b('0x50'),_0xa28b('0x51'),_0xa28b('0x52'),_0xa28b('0x53'),_0xa28b('0x54')],'raw':!![]});})['then'](function(_0x3197ee){if(_0x3197ee&&_0x3197ee['vidaooApiKey']&&_0x3197ee[_0xa28b('0x51')]){_0x16f7b4=_0x3197ee;var _0x29f256={'interaction':{'id':_0x193e98},'agent':{'id':_0x965fd2['user']['id'],'name':_0x965fd2[_0xa28b('0x3f')][_0xa28b('0x55')],'fullname':_0x965fd2[_0xa28b('0x3f')]['fullname'],'email':_0x965fd2[_0xa28b('0x3f')]['email']},'contact':_0x965fd2[_0xa28b('0x31')][_0xa28b('0x32')],'account':_0x965fd2['body'][_0xa28b('0x35')]};var _0x325db8={'rejectUnauthorized':![],'method':'POST','url':_0xa28b('0x56'),'headers':{'X-APIKEY':_0x3197ee[_0xa28b('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x965fd2[_0xa28b('0x3f')][_0xa28b('0x57')]],'buttons':null,'topic':_0x16f7b4['vidaooTopic'],'note':_[_0xa28b('0x58')](_0x16f7b4[_0xa28b('0x53')])?null:getMustacheRender(_0x16f7b4[_0xa28b('0x53')],_0x29f256),'metadata':null},'redirect':_0xa28b('0x59'),'json':!![]};try{if(!_[_0xa28b('0x58')](_0x16f7b4[_0xa28b('0x54')])){var _0x2a5983=getMustacheRender(_0x16f7b4[_0xa28b('0x54')],_0x29f256);var _0x503797=JSON[_0xa28b('0x5a')](_0x2a5983);_0x325db8['body'][_0xa28b('0x5b')]=_0x503797;}}catch(_0x2d05b4){throw new db[(_0xa28b('0x5c'))]['ValidationError'](_0xa28b('0x5d'));}return rp(_0x325db8);}else{throw new db[(_0xa28b('0x5c'))][(_0xa28b('0x5e'))](_0xa28b('0x5f'));}})['then'](function(_0x11c2c2){_0x1c5b04=_0x11c2c2;if(_0x1c5b04['id']){var _0x356acd={'body':_0x1c5b04['join_url'],'ChatWebsiteId':_0x16f7b4['id'],'ChatInteractionId':_0x310f5f['id'],'direction':_0xa28b('0x60'),'UserId':_0x965fd2['user']['id']};return db[_0xa28b('0x61')]['create'](_0x356acd,{});}else{throw new db['Sequelize'][(_0xa28b('0x5e'))](_0xa28b('0x62'));}})[_0xa28b('0x17')](function(){return _0x310f5f[_0xa28b('0x63')]({'vidaooSessionId':_0x1c5b04['id']});})[_0xa28b('0x17')](respondWithResult(_0x32e82e,null))[_0xa28b('0x22')](handleError(_0x32e82e,null));};exports[_0xa28b('0x64')]=function(_0x1d6e08,_0x5d29d1){if(_0x1d6e08['body']['id']){delete _0x1d6e08['body']['id'];}return db['ChatInteraction'][_0xa28b('0x4a')]({'where':{'id':_0x1d6e08['params']['id']},'include':[{'model':db[_0xa28b('0x65')],'as':_0xa28b('0x66')}]})[_0xa28b('0x17')](handleEntityNotFound(_0x5d29d1,null))[_0xa28b('0x17')](saveUpdates(_0x1d6e08[_0xa28b('0x31')],null))[_0xa28b('0x17')](respondWithResult(_0x5d29d1,null))['catch'](handleError(_0x5d29d1,null));};exports[_0xa28b('0x67')]=function(_0x28823b,_0x4f98e6){if(_0x28823b[_0xa28b('0x31')]['id']){delete _0x28823b[_0xa28b('0x31')]['id'];}return db[_0xa28b('0x37')]['find']({'where':{'id':_0x28823b[_0xa28b('0x41')]['id']}})[_0xa28b('0x17')](function(_0x725364){if(!_0x725364){logger[_0xa28b('0x1e')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xa28b('0x67'),0x194,_0xa28b('0x68'));_0x4f98e6[_0xa28b('0x23')](0x194);}else{if(_0x725364['UserId']){throw new db[(_0xa28b('0x5c'))][(_0xa28b('0x5e'))](_0xa28b('0x69'));}}return _0x725364;})[_0xa28b('0x17')](function(_0x45f99b){if(_0x45f99b){return _0x45f99b[_0xa28b('0x2c')]({'closed':_0x28823b[_0xa28b('0x31')][_0xa28b('0x6a')],'disposition':_0x28823b['body'][_0xa28b('0x6b')]})[_0xa28b('0x17')](function(_0x1c8fe6){return _0x1c8fe6;});}})[_0xa28b('0x17')](function(){return respondWithRpcPromise(_0xa28b('0x6c'),_0xa28b('0x67'),_0x28823b['body'],client9004);})['then'](respondWithResult(_0x4f98e6,null))['catch'](handleError(_0x4f98e6,null));};exports[_0xa28b('0x6d')]=function(_0x5764bf,_0x10b832){_0x5764bf[_0xa28b('0x31')][_0xa28b('0x55')]=_0x5764bf[_0xa28b('0x6e')][_0xa28b('0x6f')];_0x5764bf[_0xa28b('0x31')][_0xa28b('0x70')]=_0x5764bf[_0xa28b('0x6e')][_0xa28b('0x71')];_0x5764bf['body']['type']=_0x5764bf['file'][_0xa28b('0x72')];return db[_0xa28b('0x73')][_0xa28b('0x74')](_0x5764bf[_0xa28b('0x31')])[_0xa28b('0x17')](respondWithResult(_0x10b832,0xc9))[_0xa28b('0x22')](handleError(_0x10b832,null));};exports[_0xa28b('0x75')]=function(_0x160a84,_0x5765d9){return db['ChatInteraction'][_0xa28b('0x4d')]({'where':{'id':_0x160a84[_0xa28b('0x41')]['id']},'raw':!![]})[_0xa28b('0x17')](handleEntityNotFound(_0x5765d9,null))[_0xa28b('0x17')](function(_0x2e1f88){if(_0x2e1f88){if(_0x2e1f88[_0xa28b('0x6a')]){return _0x5765d9[_0xa28b('0x24')](0x193)[_0xa28b('0x26')]({'status':0x193,'message':_0xa28b('0x76')});}return db[_0xa28b('0x73')]['findOne']({'where':{'id':_0x160a84['query']['attachId']},'raw':!![]})[_0xa28b('0x17')](handleEntityNotFound(_0x5765d9,null));}})[_0xa28b('0x17')](function(_0xbd02e){if(_0xbd02e){var _0x3c3a5b=_0xbd02e[_0xa28b('0x77')]!==null;var _0x3c9c80=path['join'](config[_0xa28b('0x78')],_0xa28b('0x79'));if(_0x3c3a5b){_0x3c9c80=path[_0xa28b('0x7a')](_0x3c9c80,_0xa28b('0x7b'));}var _0x2ba7fb=path[_0xa28b('0x7a')](_0x3c9c80,_0xbd02e[_0xa28b('0x70')]);return _0x5765d9[_0xa28b('0x7c')](_0x2ba7fb);}})[_0xa28b('0x22')](handleError(_0x5765d9,null));};exports['close']=function(_0x309952,_0xccc5a){var _0x152a37=null;var _0x1cf021=null;var _0x15f6ec=null;if(_0x309952[_0xa28b('0x31')]['id']){delete _0x309952[_0xa28b('0x31')]['id'];}if(_0x309952[_0xa28b('0x31')][_0xa28b('0x7d')]){_0x15f6ec=path[_0xa28b('0x7a')](config['root'],_0xa28b('0x7e'),util['format'](_0xa28b('0x7f'),Date['now']()));_0x309952[_0xa28b('0x31')][_0xa28b('0x80')]=_0x15f6ec;}return db[_0xa28b('0x37')][_0xa28b('0x4a')]({'where':{'id':_0x309952['params']['id']},'include':[{'model':db[_0xa28b('0x61')],'as':_0xa28b('0x81'),'include':[{'model':db[_0xa28b('0x82')],'as':'User'}]}]})[_0xa28b('0x17')](handleEntityNotFound(_0xccc5a,null))[_0xa28b('0x17')](saveUpdates(_0x309952['body'],null))[_0xa28b('0x17')](function(_0x5aab41){if(_0x5aab41){_0x152a37=_0x5aab41;return db[_0xa28b('0x4e')][_0xa28b('0x4a')]({'where':{'id':_0x152a37[_0xa28b('0x4f')]}});}})['then'](function(_0x341689){if(_0x341689){_0x1cf021=_0x341689;return db[_0xa28b('0x65')][_0xa28b('0x4a')]({'where':{'id':_0x152a37[_0xa28b('0x83')]}});}})[_0xa28b('0x17')](function(_0x44531a){if(_0x44531a){if(_0x15f6ec){var _0x392317=null;for(var _0x12ea30=0x1;_0x12ea30<_0x152a37[_0xa28b('0x81')][_0xa28b('0x46')];++_0x12ea30){_0x392317=_0x152a37[_0xa28b('0x81')][_0x12ea30];var _0x44e315=_0x392317['UserId']?util[_0xa28b('0x84')](_0xa28b('0x85'),_0x1cf021['agentAlias'],_0x392317[_0xa28b('0x86')]):_0xa28b('0x87');var _0x4d9654=_0x309952[_0xa28b('0x31')][_0xa28b('0x88')]||util['format'](_0xa28b('0x85'),_0xa28b('0x89'),_0x392317['ContactId']);switch(_0x1cf021[_0xa28b('0x8a')]){case'website_alias':_0x44e315=_0x392317['UserId']?util['format']('%s%d',_0x1cf021[_0xa28b('0x8b')],_0x392317[_0xa28b('0x86')]):'System';break;case _0xa28b('0x8c'):_0x44e315=_0x392317['UserId']?_0x392317[_0xa28b('0x82')][_0xa28b('0x8d')]||_0x392317['User']['fullname']:'System';break;case _0xa28b('0x8e'):_0x44e315=_0x392317[_0xa28b('0x86')]?_0x392317['User']['fullname']:_0xa28b('0x87');break;default:_0x44e315=_0x392317['UserId']?util[_0xa28b('0x84')]('%s%d',_0x1cf021[_0xa28b('0x8b')],_0x392317['UserId']):_0xa28b('0x87');}var _0x18fc7f=util[_0xa28b('0x84')](_0xa28b('0x8f'),moment(_0x392317[_0xa28b('0x90')])[_0xa28b('0x84')]('MM/DD/YYYY\x20HH:mm:ss'),_0x392317[_0xa28b('0x91')]==='in'?_0x4d9654:_0x44e315,_0x392317['body']);if(!_0x392317[_0xa28b('0x92')]){fs[_0xa28b('0x93')](_0x15f6ec,_0x18fc7f);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa28b('0x94')],'as':_0xa28b('0x95'),'raw':!![],'include':[{'model':db[_0xa28b('0x96')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xa28b('0x17')](function(_0x59ec0d){if(!_0x59ec0d||!_0x59ec0d['Smtp']||!_0x309952['body'])return _0x152a37;var _0x47ac25=_0x59ec0d[_0xa28b('0x97')]();return respondWithRpcPromise(_0xa28b('0x98'),_0xa28b('0x99'),{'account':_0x47ac25,'message':{'from':util[_0xa28b('0x84')](_0xa28b('0x9a'),_0x59ec0d[_0xa28b('0x55')],_0x59ec0d['email']||_0x59ec0d[_0xa28b('0x95')][_0xa28b('0x3f')]),'to':_0x309952[_0xa28b('0x31')][_0xa28b('0x7d')],'subject':_0xa28b('0x9b'),'text':util[_0xa28b('0x84')](_0xa28b('0x9c'),_0x309952[_0xa28b('0x31')][_0xa28b('0x7d')]),'attachments':[{'path':_0x15f6ec}]}})[_0xa28b('0x17')](function(){return _0x152a37;})[_0xa28b('0x22')](function(_0x197cc0){logger['error'](_0x197cc0);});})['then'](respondWithStatusCode(_0xccc5a,0xc8))[_0xa28b('0x22')](handleError(_0xccc5a,null));};exports[_0xa28b('0x9d')]=function(_0x4ab03d,_0x5245d0){return db['ChatMessage'][_0xa28b('0x4a')]({'where':{'id':_0x4ab03d[_0xa28b('0x41')]['id']}})[_0xa28b('0x17')](handleEntityNotFound(_0x5245d0,null))[_0xa28b('0x17')](function(_0x3b7060){if(_0x3b7060){return _0x3b7060[_0xa28b('0x9d')](_0x4ab03d['body'][_0xa28b('0x9e')],_[_0xa28b('0x9f')](_0x4ab03d[_0xa28b('0x31')],[_0xa28b('0x9e'),'id'])||{});}})[_0xa28b('0x17')](respondWithResult(_0x5245d0,null))[_0xa28b('0x22')](handleError(_0x5245d0,null));};exports[_0xa28b('0xa0')]=function(_0x471155,_0x4cad74){var _0x15c790={'raw':![],'where':{}};var _0x56b1d1={};var _0x513079={'count':0x0,'rows':[]};return db[_0xa28b('0x37')][_0xa28b('0x4d')]({'where':{'id':_0x471155[_0xa28b('0x41')]['id']}})[_0xa28b('0x17')](handleEntityNotFound(_0x4cad74,null))[_0xa28b('0x17')](function(_0x542f60){if(_0x542f60){_0x56b1d1[_0xa28b('0x43')]=_['keys'](db[_0xa28b('0x61')][_0xa28b('0x38')]);_0x56b1d1['query']=_[_0xa28b('0x42')](_0x471155[_0xa28b('0x3e')]);_0x56b1d1['filters']=_[_0xa28b('0xa1')](_0x56b1d1[_0xa28b('0x43')],_0x56b1d1['query']);_0x15c790['attributes']=_[_0xa28b('0xa1')](_0x56b1d1[_0xa28b('0x43')],qs['fields'](_0x471155['query'][_0xa28b('0x45')]));_0x15c790['attributes']=_0x15c790['attributes'][_0xa28b('0x46')]?_0x15c790[_0xa28b('0x44')]:_0x56b1d1['model'];if(!_0x471155[_0xa28b('0x3e')][_0xa28b('0xa2')](_0xa28b('0xa3'))){_0x15c790[_0xa28b('0x28')]=qs[_0xa28b('0x28')](_0x471155[_0xa28b('0x3e')][_0xa28b('0x28')]);_0x15c790['offset']=qs[_0xa28b('0x2a')](_0x471155[_0xa28b('0x3e')][_0xa28b('0x2a')]);}_0x15c790[_0xa28b('0xa4')]=qs[_0xa28b('0xa5')](_0x471155[_0xa28b('0x3e')][_0xa28b('0xa5')]);_0x15c790[_0xa28b('0xa6')]=qs[_0xa28b('0xa7')](_[_0xa28b('0xa8')](_0x471155['query'],_0x56b1d1[_0xa28b('0xa7')]));_0x15c790[_0xa28b('0xa6')][_0xa28b('0xa9')]=_0x542f60['id'];if(_0x471155[_0xa28b('0x3e')][_0xa28b('0xaa')]){_0x15c790[_0xa28b('0xa6')]=_[_0xa28b('0x30')](_0x15c790[_0xa28b('0xa6')],{'$or':_[_0xa28b('0x36')](_0x15c790['attributes'],function(_0x23de92){var _0x314bf6={};_0x314bf6[_0x23de92]={'$like':'%'+_0x471155[_0xa28b('0x3e')][_0xa28b('0xaa')]+'%'};return _0x314bf6;})});}if(_0x471155['query']['$gte']){var _0x46d7da=_0x471155[_0xa28b('0x3e')][_0xa28b('0xab')]['split'](',');var _0x2a7caf={};_0x2a7caf[_0x46d7da[0x0]]={'$gte':moment(_0x46d7da[0x1])[_0xa28b('0x84')](_0xa28b('0xac'))};_0x15c790[_0xa28b('0xa6')]=_[_0xa28b('0x30')](_0x15c790[_0xa28b('0xa6')],_0x2a7caf);}_0x15c790=_[_0xa28b('0x30')]({},_0x15c790,_0x471155[_0xa28b('0x49')]);return db[_0xa28b('0x61')]['count']({'where':_0x15c790[_0xa28b('0xa6')]})[_0xa28b('0x17')](function(_0xd8bb98){_0x513079[_0xa28b('0x29')]=_0xd8bb98;if(_0x471155['query']['includeAll']){_0x15c790[_0xa28b('0x48')]=[{'all':!![]}];}return db[_0xa28b('0x61')]['findAll'](_0x15c790);})['then'](function(_0x28b95c){_0x513079[_0xa28b('0xad')]=_0x28b95c;return _0x513079;});}})[_0xa28b('0x17')](respondWithFilteredResult(_0x4cad74,_0x15c790))[_0xa28b('0x22')](handleError(_0x4cad74,null));};exports[_0xa28b('0xae')]=function(_0x22f1f8,_0x5326b9){var _0x1361e6={'where':{}},_0x1d5640={},_0x368c1d={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa28b('0x4d')]({'where':{'id':_0x22f1f8[_0xa28b('0x41')]['id']}})['then'](handleEntityNotFound(_0x5326b9,null))['then'](function(_0x3d654d){if(_0x3d654d){_0x1d5640[_0xa28b('0x43')]=_[_0xa28b('0x42')](db['ChatMessage']['rawAttributes']);_0x1d5640[_0xa28b('0x3e')]=_[_0xa28b('0x42')](_0x22f1f8[_0xa28b('0x3e')]);_0x1d5640[_0xa28b('0xa7')]=_[_0xa28b('0xa1')](_0x1d5640[_0xa28b('0x43')],_0x1d5640[_0xa28b('0x3e')]);_0x1361e6['attributes']=_[_0xa28b('0xa1')](_0x1d5640['model'],qs['fields'](_0x22f1f8['query'][_0xa28b('0x45')]));_0x1361e6[_0xa28b('0x44')]=_0x1361e6[_0xa28b('0x44')][_0xa28b('0x46')]?_0x1361e6[_0xa28b('0x44')]:_0x1d5640[_0xa28b('0x43')];if(!_0x22f1f8['query'][_0xa28b('0xa2')]('nolimit')){_0x1361e6[_0xa28b('0x28')]=qs[_0xa28b('0x28')](_0x22f1f8[_0xa28b('0x3e')][_0xa28b('0x28')]);_0x1361e6[_0xa28b('0x2a')]=qs['offset'](_0x22f1f8[_0xa28b('0x3e')][_0xa28b('0x2a')]);}_0x1361e6[_0xa28b('0xa4')]=qs[_0xa28b('0xa5')](_0x22f1f8[_0xa28b('0x3e')][_0xa28b('0xa5')]);_0x1361e6[_0xa28b('0xa6')]=qs['filters'](_[_0xa28b('0xa8')](_0x22f1f8[_0xa28b('0x3e')],_0x1d5640['filters']));_0x1361e6[_0xa28b('0xa6')][_0xa28b('0xa9')]=_0x3d654d['id'];if(_0x22f1f8[_0xa28b('0x3e')][_0xa28b('0xaa')]){_0x1361e6[_0xa28b('0xa6')]=_['merge'](_0x1361e6[_0xa28b('0xa6')],{'$or':_['map'](_0x1361e6[_0xa28b('0x44')],function(_0x314c94){var _0x3f2f72={};_0x3f2f72[_0x314c94]={'$like':'%'+_0x22f1f8[_0xa28b('0x3e')][_0xa28b('0xaa')]+'%'};return _0x3f2f72;})});}_0x1361e6['where'][_0xa28b('0x92')]=![];if(_0x22f1f8[_0xa28b('0x3e')]['id']){_0x1361e6[_0xa28b('0xa6')]['id']={'$gt':_0x22f1f8[_0xa28b('0x3e')]['id']};}_0x1361e6=_[_0xa28b('0x30')]({},_0x1361e6,_0x22f1f8[_0xa28b('0x49')]);return db[_0xa28b('0x61')][_0xa28b('0x29')]({'where':_0x1361e6[_0xa28b('0xa6')]})['then'](function(_0x113837){_0x368c1d[_0xa28b('0x29')]=_0x113837;_0x1361e6[_0xa28b('0x48')]=[];if(_0x22f1f8[_0xa28b('0x3e')][_0xa28b('0xaf')]){_0x1361e6[_0xa28b('0x48')]['push']({'model':db[_0xa28b('0x82')],'as':_0xa28b('0x82'),'attributes':['id',_0xa28b('0xb0'),_0xa28b('0x8d')]});}if(_0x22f1f8[_0xa28b('0x3e')][_0xa28b('0x47')]){_0x1361e6[_0xa28b('0x48')]=[{'all':!![]}];}return db[_0xa28b('0x61')][_0xa28b('0x3c')](_0x1361e6);})['then'](function(_0x1a6284){_0x368c1d['rows']=_0x1a6284;return _0x368c1d;});}})[_0xa28b('0x17')](respondWithFilteredResult(_0x5326b9,_0x1361e6))['catch'](handleError(_0x5326b9,null));};exports['addTags']=function(_0x4f030d,_0x269f51){return db[_0xa28b('0x37')][_0xa28b('0x4a')]({'where':{'id':_0x4f030d[_0xa28b('0x41')]['id']}})[_0xa28b('0x17')](handleEntityNotFound(_0x269f51,null))[_0xa28b('0x17')](function(_0x31ad71){if(_0x31ad71){return _0x31ad71[_0xa28b('0xb1')](_0x4f030d[_0xa28b('0x31')][_0xa28b('0x9e')],_['omit'](_0x4f030d['body'],['ids','id'])||{})[_0xa28b('0xb2')](function(){return db['Tag'][_0xa28b('0x3c')]({'attributes':['id',_0xa28b('0x55'),'color'],'where':{'id':_0x4f030d[_0xa28b('0x31')]['ids']}});})['then'](function(_0x42b90e){socket[_0xa28b('0xb3')](_0xa28b('0xb4'),{'id':Number(_0x4f030d[_0xa28b('0x41')]['id']),'tags':_0x42b90e||[]});return{'id':Number(_0x4f030d[_0xa28b('0x41')]['id']),'tags':_0x42b90e||[]};});}})[_0xa28b('0x17')](respondWithResult(_0x269f51,null))[_0xa28b('0x22')](handleError(_0x269f51,null));};exports[_0xa28b('0xb5')]=function(_0xce3a98,_0xb5d817){return db[_0xa28b('0x37')][_0xa28b('0x4a')]({'where':{'id':_0xce3a98[_0xa28b('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5d817,null))[_0xa28b('0x17')](function(_0x40804b){if(_0x40804b){return _0x40804b[_0xa28b('0xb5')](_0xce3a98[_0xa28b('0x3e')][_0xa28b('0x9e')]);}})[_0xa28b('0x17')](respondWithStatusCode(_0xb5d817,null))[_0xa28b('0x22')](handleError(_0xb5d817,null));};exports[_0xa28b('0x7c')]=function(_0x442d2b,_0x27417a){var _0x41329c=moment()['unix']()[_0xa28b('0xb6')]();var _0x4fe5fd=path[_0xa28b('0x7a')](config[_0xa28b('0x78')],'server',_0xa28b('0xb7'),'tmp');var _0x1f2e9b=path['join'](config[_0xa28b('0x78')],_0xa28b('0xb8'),_0xa28b('0xb7'),_0xa28b('0xb9'));var _0x23e2b5=path['join'](_0x4fe5fd,_0x41329c);var _0x2b1ad9=util[_0xa28b('0x84')](_0xa28b('0xba'),_0x442d2b[_0xa28b('0x41')]['id'],_0x41329c);var _0x224365=path['join'](_0x4fe5fd,_0x2b1ad9);var _0x427cf2=[];_0x427cf2['push']({'model':db[_0xa28b('0x82')],'as':_0xa28b('0x82'),'attributes':['id','fullname'],'raw':!![]});_0x427cf2['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xa28b('0xbb'),'lastName'],'raw':!![]});if(_0x442d2b[_0xa28b('0x3e')][_0xa28b('0xb9')]){_0x427cf2[_0xa28b('0xbc')]({'model':db['Attachment'],'as':_0xa28b('0x73'),'raw':!![]});}var _0x3908a1=[{'model':db['ChatMessage'],'as':_0xa28b('0x81'),'attributes':['id',_0xa28b('0x31'),_0xa28b('0x90'),_0xa28b('0x91'),'secret',_0xa28b('0xbd')],'include':_0x427cf2}];_0x3908a1[_0xa28b('0xbc')]({'model':db[_0xa28b('0x4e')],'as':'Account','attributes':['id',_0xa28b('0x55')]});_0x3908a1[_0xa28b('0xbc')]({'model':db[_0xa28b('0x82')],'as':_0xa28b('0xbe'),'attributes':['id',_0xa28b('0xb0')]});return db[_0xa28b('0x37')]['find']({'where':{'id':_0x442d2b[_0xa28b('0x41')]['id']},'include':_0x3908a1})[_0xa28b('0x17')](handleEntityNotFound(_0x27417a,null))[_0xa28b('0x17')](function(_0x3be289){if(_0x3be289){var _0x328978=_0x3be289[_0xa28b('0xbf')]({'plain':!![]});fs[_0xa28b('0xc0')](_0x23e2b5);var _0x1eb219={'channel':'Chat','account':_0x328978[_0xa28b('0xc1')][_0xa28b('0x55')],'agent':_0x328978[_0xa28b('0xbe')]?_0x328978[_0xa28b('0xbe')][_0xa28b('0xb0')]:_0xa28b('0xc2'),'createdAt':moment(_0x328978[_0xa28b('0x90')])[_0xa28b('0x84')](_0xa28b('0xac'))['toString'](),'closedAt':_0x328978['closed']?moment(_0x328978['closedAt'])[_0xa28b('0x84')](_0xa28b('0xac'))[_0xa28b('0xb6')]():'','disposition':_0x328978[_0xa28b('0x6b')],'chatInfo':{'browser':_0x328978[_0xa28b('0xc3')],'os':_0x328978[_0xa28b('0xc4')],'referer':_0x328978[_0xa28b('0xc5')],'customerIp':_0x328978[_0xa28b('0xc6')],'customerPort':_0x328978['customerPort']?_0x328978[_0xa28b('0xc7')]:_0xa28b('0xc2')},'messages':_(_0x328978[_0xa28b('0x81')])[_0xa28b('0xc8')]()[_0xa28b('0xaa')]({'secret':![]})['map'](function(_0x2fb166){if(_0x2fb166[_0xa28b('0x73')]){var _0x1f373e=path[_0xa28b('0x7a')](_0x1f2e9b,_0x2fb166['Attachment'][_0xa28b('0x70')]);if(fs['existsSync'](_0x1f373e)){fs[_0xa28b('0xc9')](_0x1f373e)[_0xa28b('0xca')](fs[_0xa28b('0xcb')](path['join'](_0x23e2b5,_0x2fb166['Attachment'][_0xa28b('0x70')])));}}return{'date':moment(_0x2fb166[_0xa28b('0x90')])['format'](_0xa28b('0xac'))[_0xa28b('0xb6')](),'sender':_0x2fb166[_0xa28b('0x91')]==='out'?_0x2fb166[_0xa28b('0x82')]?_0x2fb166[_0xa28b('0x82')][_0xa28b('0xb0')]:_0xa28b('0x87'):_0x2fb166[_0xa28b('0x66')][_0xa28b('0xbb')]+(_0x2fb166[_0xa28b('0x66')][_0xa28b('0xcc')]?'\x20'+_0x2fb166['Contact'][_0xa28b('0xcc')]:''),'body':_0x2fb166[_0xa28b('0x73')]?_0x2fb166['Attachment'][_0xa28b('0x70')]:_0x2fb166['body'],'direction':_0x2fb166[_0xa28b('0x91')]==='out'?'A':'C','secret':_0x2fb166[_0xa28b('0x92')],'read':_0x2fb166['read'],'attachment':_0x2fb166[_0xa28b('0x73')]};})[_0xa28b('0xcd')]()};return ejs[_0xa28b('0xce')](path[_0xa28b('0x7a')](config[_0xa28b('0x78')],'server',_0xa28b('0xcf'),_0xa28b('0xd0')),{'interaction':_0x1eb219})['then'](function(_0x16ce6f){var _0x13cc87=path[_0xa28b('0x7a')](_0x23e2b5,'transcript-'+_0x328978['id']+'-'+_0x41329c+_0xa28b('0xd1'));var _0x76089c={'path':_0x13cc87,'channel':_0xa28b('0xd2'),'interactionId':_0x328978['id']};return pdf[_0xa28b('0xd3')](_0x16ce6f,_0x76089c);})[_0xa28b('0x17')](function(){return new Promise(function(_0x3e638c,_0x16d97f){zipdir(_0x23e2b5,{'saveTo':_0x224365},function(_0x45e144,_0x65621a){if(_0x45e144)return _0x16d97f(_0x45e144);return _0x3e638c(_0x65621a);});})[_0xa28b('0x17')](function(){return new BPromise(function(_0xc58c76,_0x4db9f2){rimraf(_0x23e2b5,function(_0xed80c5){if(_0xed80c5)_0x4db9f2(_0xed80c5);return _0xc58c76();});});})['then'](function(){return _0x27417a[_0xa28b('0x7c')](_0x224365,_0x2b1ad9,function(_0x28506f){if(_0x28506f){logger[_0xa28b('0x1e')]('err',_0x28506f);}else{fs['unlinkSync'](_0x224365);}});});});}else{return _0x27417a[_0xa28b('0x23')](0xc8);}})['catch'](handleError(_0x27417a,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 39a0bdd..7bc487f 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 _0x155b=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x155b,0x16a));var _0xb155=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x155b[_0x3817a9];return _0x443f30;};'use strict';var EventEmitter=require(_0xb155('0x0'));var ChatInteraction=require(_0xb155('0x1'))['db'][_0xb155('0x2')];var ChatMessage=require(_0xb155('0x1'))['db'][_0xb155('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb155('0x4')](0x0);var events={'afterCreate':_0xb155('0x5'),'afterUpdate':_0xb155('0x6'),'afterDestroy':_0xb155('0x7')};function emitEvent(_0x1a9f1f){return function(_0x495da9,_0x46b008,_0x8bc4c){_0x495da9[_0xb155('0x8')]({'attributes':['id'],'raw':!![]})[_0xb155('0x9')](function(_0x112068){_0x495da9['setDataValue'](_0xb155('0xa'),_0x112068[_0xb155('0xb')](function(_0x3e17ad){return{'id':_0x3e17ad['id']};}));return ChatMessage[_0xb155('0xc')]({'where':{'ChatInteractionId':_0x495da9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb155('0x9')](function(_0xe9fe15){_0x495da9[_0xb155('0xd')](_0xb155('0xe'),_0xe9fe15[_0xb155('0xf')]);ChatInteractionEvents[_0xb155('0x10')](_0x1a9f1f+':'+_0x495da9['id'],_0x495da9);ChatInteractionEvents[_0xb155('0x10')](_0x1a9f1f,_0x495da9);_0x8bc4c(null);})[_0xb155('0x11')](_0x8bc4c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xb155('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x1b27=['update','remove','getUsers','then','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','save'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1b27,0x1cf));var _0x71b2=function(_0x5e973d,_0x201874){_0x5e973d=_0x5e973d-0x0;var _0x20eb1c=_0x1b27[_0x5e973d];return _0x20eb1c;};'use strict';var EventEmitter=require(_0x71b2('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x71b2('0x1')];var ChatMessage=require(_0x71b2('0x2'))['db'][_0x71b2('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x71b2('0x4'),'afterUpdate':_0x71b2('0x5'),'afterDestroy':_0x71b2('0x6')};function emitEvent(_0x1655a4){return function(_0x25b188,_0x2d0f90,_0xaf0c2b){_0x25b188[_0x71b2('0x7')]({'attributes':['id'],'raw':!![]})[_0x71b2('0x8')](function(_0x91641c){_0x25b188['setDataValue'](_0x71b2('0x9'),_0x91641c[_0x71b2('0xa')](function(_0x18ad0e){return{'id':_0x18ad0e['id']};}));return ChatMessage[_0x71b2('0xb')]({'where':{'ChatInteractionId':_0x25b188['id'],'direction':'in','read':![]},'raw':!![]});})[_0x71b2('0x8')](function(_0x4b609b){_0x25b188['setDataValue'](_0x71b2('0xc'),_0x4b609b['length']);ChatInteractionEvents[_0x71b2('0xd')](_0x1655a4+':'+_0x25b188['id'],_0x25b188);ChatInteractionEvents[_0x71b2('0xd')](_0x1655a4,_0x25b188);_0xaf0c2b(null);})[_0x71b2('0xe')](_0xaf0c2b(null));};}for(var e in events){if(events[_0x71b2('0xf')](e)){var event=events[e];ChatInteraction[_0x71b2('0x10')](e,emitEvent(event));}}module[_0x71b2('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index aa006ac..96105a6 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 _0x1396=['changed','closed','format','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction'];(function(_0xda8f6f,_0x11c149){var _0x1b3e68=function(_0x168b8d){while(--_0x168b8d){_0xda8f6f['push'](_0xda8f6f['shift']());}};_0x1b3e68(++_0x11c149);}(_0x1396,0x122));var _0x6139=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x1396[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6139('0x0'))(_0x6139('0x1'));var moment=require('moment');var BPromise=require(_0x6139('0x2'));var rp=require(_0x6139('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6139('0x4'));var config=require(_0x6139('0x5'));var attributes=require(_0x6139('0x6'));module[_0x6139('0x7')]=function(_0x152d10,_0x591dc2){return _0x152d10[_0x6139('0x8')](_0x6139('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x564e83,_0x1041b5,_0x1a2d2e){if(_0x564e83[_0x6139('0xa')](_0x6139('0xb'))){_0x564e83['closedAt']=moment()[_0x6139('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1a2d2e(null,_0x564e83);}},'charset':_0x6139('0xd'),'collate':_0x6139('0xe')});}; \ No newline at end of file +var _0x7884=['closed','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions'];(function(_0x22fe71,_0x4554de){var _0x1283ab=function(_0x12a750){while(--_0x12a750){_0x22fe71['push'](_0x22fe71['shift']());}};_0x1283ab(++_0x4554de);}(_0x7884,0x19c));var _0x4788=function(_0x7ba025,_0xf0e9f4){_0x7ba025=_0x7ba025-0x0;var _0x5dce8f=_0x7884[_0x7ba025];return _0x5dce8f;};'use strict';var _=require(_0x4788('0x0'));var util=require(_0x4788('0x1'));var logger=require(_0x4788('0x2'))(_0x4788('0x3'));var moment=require(_0x4788('0x4'));var BPromise=require(_0x4788('0x5'));var rp=require(_0x4788('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4788('0x7'));var config=require(_0x4788('0x8'));var attributes=require(_0x4788('0x9'));module[_0x4788('0xa')]=function(_0x3e147a,_0xc0a619){return _0x3e147a[_0x4788('0xb')]('ChatInteraction',attributes,{'tableName':_0x4788('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5079b1,_0x1105c7,_0x4af43c){if(_0x5079b1['changed'](_0x4788('0xd'))){_0x5079b1['closedAt']=moment()[_0x4788('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4af43c(null,_0x5079b1);}},'charset':_0x4788('0xf'),'collate':_0x4788('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 337601d..aae49f1 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 _0x067d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','UpdateChatInteraction','ChatInteraction','options','raw','where','attributes','limit','then','catch','AddTagsToChatInteraction','addTags','body','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis'];(function(_0x868d30,_0x121202){var _0xe498ab=function(_0x55f7b6){while(--_0x55f7b6){_0x868d30['push'](_0x868d30['shift']());}};_0xe498ab(++_0x121202);}(_0x067d,0xcd));var _0xd067=function(_0x1b2667,_0x279eb1){_0x1b2667=_0x1b2667-0x0;var _0x179ae8=_0x067d[_0x1b2667];return _0x179ae8;};'use strict';var _=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var moment=require(_0xd067('0x2'));var BPromise=require('bluebird');var rs=require(_0xd067('0x3'));var fs=require('fs');var Redis=require(_0xd067('0x4'));var db=require(_0xd067('0x5'))['db'];var utils=require(_0xd067('0x6'));var logger=require(_0xd067('0x7'))(_0xd067('0x8'));var config=require(_0xd067('0x9'));var jayson=require(_0xd067('0xa'));var client=jayson[_0xd067('0xb')][_0xd067('0xc')]({'port':0x232a});config[_0xd067('0xd')]=_['defaults'](config[_0xd067('0xd')],{'host':_0xd067('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd067('0xd')]));require(_0xd067('0xf'))[_0xd067('0x10')](socket);function respondWithRpcPromise(_0xdcbfce,_0x214593,_0x566763){return new BPromise(function(_0x5cfe3d,_0x561c78){return client[_0xd067('0x11')](_0xdcbfce,_0x566763)['then'](function(_0x5b4bc6){logger[_0xd067('0x12')](_0xd067('0x13'),_0x214593,'request\x20sent');logger[_0xd067('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x214593,'request\x20sent',JSON[_0xd067('0x15')](_0x5b4bc6));if(_0x5b4bc6[_0xd067('0x16')]){if(_0x5b4bc6['error'][_0xd067('0x17')]===0x1f4){logger[_0xd067('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x214593,_0x5b4bc6[_0xd067('0x16')][_0xd067('0x18')]);return _0x561c78(_0x5b4bc6['error'][_0xd067('0x18')]);}logger[_0xd067('0x16')](_0xd067('0x13'),_0x214593,_0x5b4bc6[_0xd067('0x16')]['message']);return _0x5cfe3d(_0x5b4bc6[_0xd067('0x16')][_0xd067('0x18')]);}else{logger['info'](_0xd067('0x13'),_0x214593,_0xd067('0x19'));_0x5cfe3d(_0x5b4bc6[_0xd067('0x1a')]['message']);}})['catch'](function(_0x33fe23){logger[_0xd067('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x214593,_0x33fe23);_0x561c78(_0x33fe23);});});}exports[_0xd067('0x1b')]=function(_0x96fa05){var _0x524132=this;return new Promise(function(_0x256d9e,_0xfd0b13){return db[_0xd067('0x1c')]['update'](_0x96fa05['body'],{'raw':_0x96fa05['options']?_0x96fa05[_0xd067('0x1d')][_0xd067('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x96fa05['options']?_0x96fa05[_0xd067('0x1d')][_0xd067('0x1f')]||null:null,'attributes':_0x96fa05[_0xd067('0x1d')]?_0x96fa05['options'][_0xd067('0x20')]||null:null,'limit':_0x96fa05['options']?_0x96fa05[_0xd067('0x1d')][_0xd067('0x21')]||null:null})[_0xd067('0x22')](function(_0x29bc3b){logger[_0xd067('0x12')]('UpdateChatInteraction',_0x96fa05);logger[_0xd067('0x14')](_0xd067('0x1b'),_0x96fa05,JSON[_0xd067('0x15')](_0x29bc3b));_0x256d9e(_0x29bc3b);})[_0xd067('0x23')](function(_0x34de72){logger[_0xd067('0x16')](_0xd067('0x1b'),_0x34de72[_0xd067('0x18')],_0x96fa05);_0xfd0b13(_0x524132[_0xd067('0x16')](0x1f4,_0x34de72[_0xd067('0x18')]));});});};exports[_0xd067('0x24')]=function(_0x30474f){return new Promise(function(_0x50e112,_0x486ee8){return db[_0xd067('0x1c')]['find']({'where':_0x30474f[_0xd067('0x1d')]?_0x30474f[_0xd067('0x1d')]['where']||null:null})[_0xd067('0x22')](function(_0x2200c7){if(_0x2200c7){return _0x2200c7[_0xd067('0x25')](_0x30474f[_0xd067('0x26')][_0xd067('0x27')],_['omit'](_0x30474f['body'],[_0xd067('0x27'),'id'])||{});}})[_0xd067('0x28')](function(_0x2172ff){logger[_0xd067('0x12')](_0xd067('0x29'),_0x30474f);logger['debug']('AddTags',_0x30474f,JSON['stringify'](_0x2172ff));_0x50e112(_0x2172ff);})[_0xd067('0x23')](function(_0x2e8d0a){logger[_0xd067('0x16')](_0xd067('0x29'),_0x2e8d0a['message'],_0x30474f);_0x486ee8(_this[_0xd067('0x16')](0x1f4,_0x2e8d0a[_0xd067('0x18')]));});});}; \ No newline at end of file +var _0xbdcb=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','limit','catch','find','where','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis'];(function(_0x494a97,_0xa61382){var _0x4a14ff=function(_0x4b2560){while(--_0x4b2560){_0x494a97['push'](_0x494a97['shift']());}};_0x4a14ff(++_0xa61382);}(_0xbdcb,0xf7));var _0xbbdc=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xbdcb[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xbbdc('0x0'));var util=require(_0xbbdc('0x1'));var moment=require(_0xbbdc('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbdc('0x3'));var fs=require('fs');var Redis=require(_0xbbdc('0x4'));var db=require(_0xbbdc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbdc('0x6'))(_0xbbdc('0x7'));var config=require(_0xbbdc('0x8'));var jayson=require(_0xbbdc('0x9'));var client=jayson[_0xbbdc('0xa')][_0xbbdc('0xb')]({'port':0x232a});config[_0xbbdc('0xc')]=_[_0xbbdc('0xd')](config[_0xbbdc('0xc')],{'host':_0xbbdc('0xe'),'port':0x18eb});var socket=require(_0xbbdc('0xf'))(new Redis(config['redis']));require(_0xbbdc('0x10'))['register'](socket);function respondWithRpcPromise(_0x23eb67,_0x5afc9a,_0x2513a2){return new BPromise(function(_0x1cfcc8,_0x58cc4b){return client['request'](_0x23eb67,_0x2513a2)[_0xbbdc('0x11')](function(_0x8f3697){logger[_0xbbdc('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x5afc9a,_0xbbdc('0x13'));logger[_0xbbdc('0x14')](_0xbbdc('0x15'),_0x5afc9a,'request\x20sent',JSON[_0xbbdc('0x16')](_0x8f3697));if(_0x8f3697['error']){if(_0x8f3697['error'][_0xbbdc('0x17')]===0x1f4){logger[_0xbbdc('0x18')](_0xbbdc('0x19'),_0x5afc9a,_0x8f3697['error'][_0xbbdc('0x1a')]);return _0x58cc4b(_0x8f3697[_0xbbdc('0x18')][_0xbbdc('0x1a')]);}logger[_0xbbdc('0x18')](_0xbbdc('0x19'),_0x5afc9a,_0x8f3697[_0xbbdc('0x18')][_0xbbdc('0x1a')]);return _0x1cfcc8(_0x8f3697[_0xbbdc('0x18')][_0xbbdc('0x1a')]);}else{logger[_0xbbdc('0x12')](_0xbbdc('0x19'),_0x5afc9a,_0xbbdc('0x13'));_0x1cfcc8(_0x8f3697[_0xbbdc('0x1b')][_0xbbdc('0x1a')]);}})['catch'](function(_0x2abbdb){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5afc9a,_0x2abbdb);_0x58cc4b(_0x2abbdb);});});}exports[_0xbbdc('0x1c')]=function(_0x11c044){var _0x229cf0=this;return new Promise(function(_0x3a2068,_0x3c8be6){return db[_0xbbdc('0x1d')][_0xbbdc('0x1e')](_0x11c044[_0xbbdc('0x1f')],{'raw':_0x11c044[_0xbbdc('0x20')]?_0x11c044[_0xbbdc('0x20')][_0xbbdc('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c044[_0xbbdc('0x20')]?_0x11c044[_0xbbdc('0x20')]['where']||null:null,'attributes':_0x11c044[_0xbbdc('0x20')]?_0x11c044[_0xbbdc('0x20')]['attributes']||null:null,'limit':_0x11c044[_0xbbdc('0x20')]?_0x11c044[_0xbbdc('0x20')][_0xbbdc('0x22')]||null:null})['then'](function(_0x765af9){logger[_0xbbdc('0x12')](_0xbbdc('0x1c'),_0x11c044);logger[_0xbbdc('0x14')](_0xbbdc('0x1c'),_0x11c044,JSON[_0xbbdc('0x16')](_0x765af9));_0x3a2068(_0x765af9);})[_0xbbdc('0x23')](function(_0x23bedc){logger[_0xbbdc('0x18')](_0xbbdc('0x1c'),_0x23bedc[_0xbbdc('0x1a')],_0x11c044);_0x3c8be6(_0x229cf0[_0xbbdc('0x18')](0x1f4,_0x23bedc[_0xbbdc('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0x5b586b){return new Promise(function(_0x18585b,_0x551b4c){return db[_0xbbdc('0x1d')][_0xbbdc('0x24')]({'where':_0x5b586b['options']?_0x5b586b[_0xbbdc('0x20')][_0xbbdc('0x25')]||null:null})[_0xbbdc('0x11')](function(_0x4ec61c){if(_0x4ec61c){return _0x4ec61c[_0xbbdc('0x26')](_0x5b586b[_0xbbdc('0x1f')]['ids'],_['omit'](_0x5b586b['body'],[_0xbbdc('0x27'),'id'])||{});}})[_0xbbdc('0x28')](function(_0x5280e7){logger[_0xbbdc('0x12')](_0xbbdc('0x29'),_0x5b586b);logger[_0xbbdc('0x14')](_0xbbdc('0x29'),_0x5b586b,JSON[_0xbbdc('0x16')](_0x5280e7));_0x18585b(_0x5280e7);})[_0xbbdc('0x23')](function(_0x11031f){logger[_0xbbdc('0x18')](_0xbbdc('0x29'),_0x11031f[_0xbbdc('0x1a')],_0x5b586b);_0x551b4c(_this['error'](0x1f4,_0x11031f[_0xbbdc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 20f2575..0e0d077 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 _0x15d6=['save','remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x366d42,_0x338fb4){var _0x1a47f7=function(_0x404f01){while(--_0x404f01){_0x366d42['push'](_0x366d42['shift']());}};_0x1a47f7(++_0x338fb4);}(_0x15d6,0xb3));var _0x615d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x15d6[_0xa464c9];return _0x3d73c4;};'use strict';var ChatInteractionEvents=require(_0x615d('0x0'));var events=[_0x615d('0x1'),_0x615d('0x2'),_0x615d('0x3')];function createListener(_0x46ca8b,_0x423267){return function(_0x688729){_0x423267[_0x615d('0x4')](_0x46ca8b,_0x688729);};}function removeListener(_0x2c6415,_0x5d4beb){return function(){ChatInteractionEvents[_0x615d('0x5')](_0x2c6415,_0x5d4beb);};}exports[_0x615d('0x6')]=function(_0x5296d4){for(var _0x58fdaa=0x0,_0x162493=events[_0x615d('0x7')];_0x58fdaa<_0x162493;_0x58fdaa++){var _0x42ee0f=events[_0x58fdaa];var _0x1cb449=createListener(_0x615d('0x8')+_0x42ee0f,_0x5296d4);ChatInteractionEvents['on'](_0x42ee0f,_0x1cb449);}}; \ No newline at end of file +var _0x4133=['update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x236092,_0x2f90ba){var _0x353481=function(_0x591807){while(--_0x591807){_0x236092['push'](_0x236092['shift']());}};_0x353481(++_0x2f90ba);}(_0x4133,0x14a));var _0x3413=function(_0x98d5fb,_0x22a6b1){_0x98d5fb=_0x98d5fb-0x0;var _0x545f94=_0x4133[_0x98d5fb];return _0x545f94;};'use strict';var ChatInteractionEvents=require(_0x3413('0x0'));var events=[_0x3413('0x1'),_0x3413('0x2'),_0x3413('0x3')];function createListener(_0x474054,_0x87e11f){return function(_0x3864c9){_0x87e11f[_0x3413('0x4')](_0x474054,_0x3864c9);};}function removeListener(_0xcd7884,_0x1986f6){return function(){ChatInteractionEvents[_0x3413('0x5')](_0xcd7884,_0x1986f6);};}exports[_0x3413('0x6')]=function(_0xf7eec0){for(var _0x1cc3c8=0x0,_0x71d523=events[_0x3413('0x7')];_0x1cc3c8<_0x71d523;_0x1cc3c8++){var _0x426ff0=events[_0x1cc3c8];var _0x4c5d7e=createListener(_0x3413('0x8')+_0x426ff0,_0xf7eec0);ChatInteractionEvents['on'](_0x426ff0,_0x4c5d7e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2b96b2b..dc623bb 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 _0x9b6d=['describe','/:id','show','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','root','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','chat','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x483461,_0x3a7690){var _0x1c851f=function(_0x3683ca){while(--_0x3683ca){_0x483461['push'](_0x483461['shift']());}};_0x1c851f(++_0x3a7690);}(_0x9b6d,0x1d5));var _0xd9b6=function(_0x15b6bc,_0x47b90f){_0x15b6bc=_0x15b6bc-0x0;var _0x50fb17=_0x9b6d[_0x15b6bc];return _0x50fb17;};'use strict';var multer=require('multer');var util=require(_0xd9b6('0x0'));var path=require('path');var timeout=require(_0xd9b6('0x1'));var express=require(_0xd9b6('0x2'));var router=express[_0xd9b6('0x3')]();var fs_extra=require(_0xd9b6('0x4'));var auth=require(_0xd9b6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd9b6('0x6'));var controller=require('./chatInteraction.controller');router[_0xd9b6('0x7')]('/',auth[_0xd9b6('0x8')](),controller[_0xd9b6('0x9')]);router[_0xd9b6('0x7')](_0xd9b6('0xa'),auth[_0xd9b6('0x8')](),controller[_0xd9b6('0xb')]);router[_0xd9b6('0x7')](_0xd9b6('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xd9b6('0xd')]);router[_0xd9b6('0x7')]('/:id/attachment_download',auth[_0xd9b6('0xe')](),controller['attachmentDownload']);router[_0xd9b6('0x7')](_0xd9b6('0xf'),auth[_0xd9b6('0x8')](),controller[_0xd9b6('0x10')]);router[_0xd9b6('0x7')](_0xd9b6('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xd9b6('0x12')]);router['get'](_0xd9b6('0x13'),auth[_0xd9b6('0x8')](),controller[_0xd9b6('0x14')]);router[_0xd9b6('0x15')]('/',auth[_0xd9b6('0x8')](),controller[_0xd9b6('0x16')]);router[_0xd9b6('0x15')](_0xd9b6('0x17'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xd9b6('0x18')]({'destination':function(_0xa05025,_0x590f10,_0x3030a9){_0x3030a9(null,path['join'](config[_0xd9b6('0x19')],'server/files/attachments/'));},'filename':function(_0x83eaad,_0xc863be,_0xcf1ef5){_0xcf1ef5(null,util['format'](_0xd9b6('0x1a'),Date[_0xd9b6('0x1b')](),_0xc863be['originalname'][_0xd9b6('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd9b6('0x15')](_0xd9b6('0x1d'),upload[_0xd9b6('0x1e')](_0xd9b6('0x1f')),controller[_0xd9b6('0x20')]);router['post'](_0xd9b6('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xd9b6('0x21')]);router[_0xd9b6('0x15')]('/:id/tags',auth[_0xd9b6('0x8')](),interaction['tracked'](_0xd9b6('0x22'),'chatinteraction:addtags'),controller[_0xd9b6('0x23')]);router[_0xd9b6('0x24')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xd9b6('0x22'),_0xd9b6('0x25')),controller[_0xd9b6('0x26')]);router[_0xd9b6('0x24')]('/:id/custom_update',controller[_0xd9b6('0x27')]);router[_0xd9b6('0x24')](_0xd9b6('0x28'),auth[_0xd9b6('0xe')](),controller['abandon']);router[_0xd9b6('0x24')](_0xd9b6('0x29'),controller[_0xd9b6('0x2a')]);router[_0xd9b6('0x2b')](_0xd9b6('0xc'),auth[_0xd9b6('0x8')](),interaction['tracked']('chat',_0xd9b6('0x2c')),controller[_0xd9b6('0x2d')]);router[_0xd9b6('0x2b')]('/:id/tags',auth[_0xd9b6('0x8')](),controller[_0xd9b6('0x2e')]);module[_0xd9b6('0x2f')]=router; \ No newline at end of file +var _0x013d=['addMessage','/:id/tags','tracked','chatinteraction:addtags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','getMessages','download','post','create','/:id/vidaoo','createVidaooSession','join','root','format','now','originalname','/:id/attachment_upload','single','file','attachmentUpload'];(function(_0x1785d4,_0x2faaf0){var _0x4dcdca=function(_0xad1fbe){while(--_0xad1fbe){_0x1785d4['push'](_0x1785d4['shift']());}};_0x4dcdca(++_0x2faaf0);}(_0x013d,0x13e));var _0xd013=function(_0x33c70e,_0xd8cb0b){_0x33c70e=_0x33c70e-0x0;var _0x5a33e5=_0x013d[_0x33c70e];return _0x5a33e5;};'use strict';var multer=require(_0xd013('0x0'));var util=require(_0xd013('0x1'));var path=require(_0xd013('0x2'));var timeout=require(_0xd013('0x3'));var express=require(_0xd013('0x4'));var router=express[_0xd013('0x5')]();var fs_extra=require(_0xd013('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd013('0x7'));var config=require(_0xd013('0x8'));var controller=require(_0xd013('0x9'));router[_0xd013('0xa')]('/',auth[_0xd013('0xb')](),controller[_0xd013('0xc')]);router['get'](_0xd013('0xd'),auth[_0xd013('0xb')](),controller['describe']);router['get'](_0xd013('0xe'),auth[_0xd013('0xf')](),controller[_0xd013('0x10')]);router[_0xd013('0xa')]('/:id/attachment_download',auth[_0xd013('0xf')](),controller['attachmentDownload']);router[_0xd013('0xa')]('/:id/messages',auth[_0xd013('0xb')](),controller[_0xd013('0x11')]);router[_0xd013('0xa')]('/:id/my_messages',auth[_0xd013('0xf')](),controller['getMyMessages']);router[_0xd013('0xa')]('/:id/download',auth[_0xd013('0xb')](),controller[_0xd013('0x12')]);router[_0xd013('0x13')]('/',auth[_0xd013('0xb')](),controller[_0xd013('0x14')]);router[_0xd013('0x13')](_0xd013('0x15'),auth[_0xd013('0xb')](),controller[_0xd013('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4244a9,_0x3c08c7,_0x410ea0){_0x410ea0(null,path[_0xd013('0x17')](config[_0xd013('0x18')],'server/files/attachments/'));},'filename':function(_0x2713bc,_0x56d624,_0x191e89){_0x191e89(null,util[_0xd013('0x19')]('%s-%s',Date[_0xd013('0x1a')](),_0x56d624[_0xd013('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd013('0x13')](_0xd013('0x1c'),upload[_0xd013('0x1d')](_0xd013('0x1e')),controller[_0xd013('0x1f')]);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0xd013('0x20')]);router[_0xd013('0x13')](_0xd013('0x21'),auth[_0xd013('0xb')](),interaction[_0xd013('0x22')]('chat',_0xd013('0x23')),controller['addTags']);router[_0xd013('0x24')](_0xd013('0xe'),auth[_0xd013('0xb')](),interaction[_0xd013('0x22')](_0xd013('0x25'),_0xd013('0x26')),controller[_0xd013('0x27')]);router[_0xd013('0x24')](_0xd013('0x28'),controller[_0xd013('0x29')]);router['put'](_0xd013('0x2a'),auth[_0xd013('0xf')](),controller[_0xd013('0x2b')]);router[_0xd013('0x24')]('/:id/close',controller[_0xd013('0x2c')]);router[_0xd013('0x2d')](_0xd013('0xe'),auth[_0xd013('0xb')](),interaction[_0xd013('0x22')]('chat',_0xd013('0x2e')),controller[_0xd013('0x2f')]);router[_0xd013('0x2d')](_0xd013('0x21'),auth[_0xd013('0xb')](),controller[_0xd013('0x30')]);module[_0xd013('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index d0c99fa..d4ec850 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 _0xf492=['medium','BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0xf492,0x102));var _0x2f49=function(_0x1f1578,_0x33d122){_0x1f1578=_0x1f1578-0x0;var _0x2603f6=_0xf492[_0x1f1578];return _0x2603f6;};'use strict';var Sequelize=require(_0x2f49('0x0'));module['exports']={'body':{'type':Sequelize[_0x2f49('0x1')](_0x2f49('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2f49('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x2f49('0x4')]}}; \ No newline at end of file +var _0x29d9=['medium','BOOLEAN','sequelize','exports','TEXT'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x29d9,0x11a));var _0x929d=function(_0x4b89f1,_0x590c84){_0x4b89f1=_0x4b89f1-0x0;var _0x3530fd=_0x29d9[_0x4b89f1];return _0x3530fd;};'use strict';var Sequelize=require(_0x929d('0x0'));module[_0x929d('0x1')]={'body':{'type':Sequelize[_0x929d('0x2')](_0x929d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x929d('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 3d358e8..cbb362b 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 _0xc027=['sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','show','params','intersection','include','find','catch','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','findAll','user','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','autoAssociation','isEmpty','agent','resourceId','push','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path'];(function(_0x1d61ca,_0x19164c){var _0x2fdf1f=function(_0x1526e3){while(--_0x1526e3){_0x1d61ca['push'](_0x1d61ca['shift']());}};_0x2fdf1f(++_0x19164c);}(_0xc027,0xcf));var _0x7c02=function(_0x2871c2,_0xe4c551){_0x2871c2=_0x2871c2-0x0;var _0x279bac=_0xc027[_0x2871c2];return _0x279bac;};'use strict';var emlformat=require(_0x7c02('0x0'));var rimraf=require(_0x7c02('0x1'));var zipdir=require(_0x7c02('0x2'));var jsonpatch=require(_0x7c02('0x3'));var rp=require(_0x7c02('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7c02('0x5'));var util=require('util');var path=require(_0x7c02('0x6'));var sox=require(_0x7c02('0x7'));var csv=require('to-csv');var ejs=require(_0x7c02('0x8'));var fs=require('fs');var fs_extra=require(_0x7c02('0x9'));var _=require(_0x7c02('0xa'));var squel=require(_0x7c02('0xb'));var crypto=require('crypto');var jsforce=require(_0x7c02('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7c02('0xd'));var querystring=require(_0x7c02('0xe'));var Papa=require('papaparse');var Redis=require(_0x7c02('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7c02('0x10'));var as=require(_0x7c02('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7c02('0x12'));var utils=require(_0x7c02('0x13'));var config=require(_0x7c02('0x14'));var licenseUtil=require(_0x7c02('0x15'));var db=require(_0x7c02('0x16'))['db'];config[_0x7c02('0x17')]=_[_0x7c02('0x18')](config[_0x7c02('0x17')],{'host':_0x7c02('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c02('0x17')]));require(_0x7c02('0x1a'))[_0x7c02('0x1b')](socket);function respondWithStatusCode(_0x36f34b,_0x5728a0){_0x5728a0=_0x5728a0||0xcc;return function(_0x341976){if(_0x341976){return _0x36f34b[_0x7c02('0x1c')](_0x5728a0);}return _0x36f34b[_0x7c02('0x1d')](_0x5728a0)[_0x7c02('0x1e')]();};}function respondWithResult(_0x38f8ab,_0x2b23ea){_0x2b23ea=_0x2b23ea||0xc8;return function(_0x39a1f9){if(_0x39a1f9){return _0x38f8ab[_0x7c02('0x1d')](_0x2b23ea)[_0x7c02('0x1f')](_0x39a1f9);}};}function respondWithFilteredResult(_0x102706,_0x222ba0){return function(_0x2f9f1d){if(_0x2f9f1d){var _0x4ae159=typeof _0x222ba0[_0x7c02('0x20')]===_0x7c02('0x21')&&typeof _0x222ba0[_0x7c02('0x22')]==='undefined';var _0x1eeb3a=_0x2f9f1d[_0x7c02('0x23')];var _0x3a3950=_0x4ae159?0x0:_0x222ba0[_0x7c02('0x20')];var _0x70055d=_0x4ae159?_0x2f9f1d[_0x7c02('0x23')]:_0x222ba0[_0x7c02('0x20')]+_0x222ba0[_0x7c02('0x22')];var _0x3a474e;if(_0x70055d>=_0x1eeb3a){_0x70055d=_0x1eeb3a;_0x3a474e=0xc8;}else{_0x3a474e=0xce;}_0x102706[_0x7c02('0x1d')](_0x3a474e);return _0x102706[_0x7c02('0x24')](_0x7c02('0x25'),_0x3a3950+'-'+_0x70055d+'/'+_0x1eeb3a)[_0x7c02('0x1f')](_0x2f9f1d);}return null;};}function patchUpdates(_0x3ce541){return function(_0x761643){try{jsonpatch[_0x7c02('0x26')](_0x761643,_0x3ce541,!![]);}catch(_0x5edd8c){return BPromise[_0x7c02('0x27')](_0x5edd8c);}return _0x761643[_0x7c02('0x28')]();};}function saveUpdates(_0x5522af,_0x17c2cb){return function(_0x1ed8f4){if(_0x1ed8f4){return _0x1ed8f4[_0x7c02('0x29')](_0x5522af)[_0x7c02('0x2a')](function(_0x5183f7){return _0x5183f7;});}return null;};}function removeEntity(_0x54bf4c,_0x366ba1){return function(_0x352380){if(_0x352380){return _0x352380['destroy']()[_0x7c02('0x2a')](function(){_0x54bf4c['status'](0xcc)[_0x7c02('0x1e')]();});}};}function handleEntityNotFound(_0x2e615d,_0x2c6701){return function(_0x2395ea){if(!_0x2395ea){_0x2e615d['sendStatus'](0x194);}return _0x2395ea;};}function handleError(_0x45e0e8,_0x5e13d8){_0x5e13d8=_0x5e13d8||0x1f4;return function(_0x584c2e){logger[_0x7c02('0x2b')](_0x584c2e[_0x7c02('0x2c')]);if(_0x584c2e[_0x7c02('0x2d')]){delete _0x584c2e[_0x7c02('0x2d')];}_0x45e0e8[_0x7c02('0x1d')](_0x5e13d8)[_0x7c02('0x2e')](_0x584c2e);};}exports[_0x7c02('0x2f')]=function(_0x498bdc,_0x949df5){var _0x5e3b42={},_0xce8aff={},_0x579339={'count':0x0,'rows':[]};var _0x11baa5=_[_0x7c02('0x30')](db[_0x7c02('0x31')][_0x7c02('0x32')],function(_0x56e48d){return{'name':_0x56e48d['fieldName'],'type':_0x56e48d[_0x7c02('0x33')][_0x7c02('0x34')]};});_0xce8aff['model']=_[_0x7c02('0x30')](_0x11baa5,'name');_0xce8aff[_0x7c02('0x35')]=_[_0x7c02('0x36')](_0x498bdc[_0x7c02('0x35')]);_0xce8aff[_0x7c02('0x37')]=_['intersection'](_0xce8aff[_0x7c02('0x38')],_0xce8aff['query']);_0x5e3b42['attributes']=_['intersection'](_0xce8aff[_0x7c02('0x38')],qs[_0x7c02('0x39')](_0x498bdc[_0x7c02('0x35')][_0x7c02('0x39')]));_0x5e3b42[_0x7c02('0x3a')]=_0x5e3b42['attributes'][_0x7c02('0x3b')]?_0x5e3b42[_0x7c02('0x3a')]:_0xce8aff['model'];if(!_0x498bdc[_0x7c02('0x35')][_0x7c02('0x3c')](_0x7c02('0x3d'))){_0x5e3b42[_0x7c02('0x22')]=qs[_0x7c02('0x22')](_0x498bdc[_0x7c02('0x35')][_0x7c02('0x22')]);_0x5e3b42[_0x7c02('0x20')]=qs[_0x7c02('0x20')](_0x498bdc[_0x7c02('0x35')][_0x7c02('0x20')]);}_0x5e3b42['order']=qs[_0x7c02('0x3e')](_0x498bdc['query'][_0x7c02('0x3e')]);_0x5e3b42[_0x7c02('0x3f')]=qs[_0x7c02('0x37')](_[_0x7c02('0x40')](_0x498bdc[_0x7c02('0x35')],_0xce8aff[_0x7c02('0x37')]),_0x11baa5);if(_0x498bdc[_0x7c02('0x35')][_0x7c02('0x41')]){_0x5e3b42[_0x7c02('0x3f')]=_[_0x7c02('0x42')](_0x5e3b42[_0x7c02('0x3f')],{'$or':_[_0x7c02('0x30')](_0x11baa5,function(_0x3fa6f6){if(_0x3fa6f6['type']!=='VIRTUAL'){var _0x196325={};_0x196325[_0x3fa6f6['name']]={'$like':'%'+_0x498bdc[_0x7c02('0x35')][_0x7c02('0x41')]+'%'};return _0x196325;}})});}_0x5e3b42=_[_0x7c02('0x42')]({},_0x5e3b42,_0x498bdc[_0x7c02('0x43')]);var _0x34217d={'where':_0x5e3b42[_0x7c02('0x3f')]};return db[_0x7c02('0x31')]['count'](_0x34217d)[_0x7c02('0x2a')](function(_0x237114){_0x579339[_0x7c02('0x23')]=_0x237114;if(_0x498bdc[_0x7c02('0x35')][_0x7c02('0x44')]){_0x5e3b42['include']=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x5e3b42);})[_0x7c02('0x2a')](function(_0x537438){_0x579339['rows']=_0x537438;return _0x579339;})[_0x7c02('0x2a')](respondWithFilteredResult(_0x949df5,_0x5e3b42))['catch'](handleError(_0x949df5,null));};exports[_0x7c02('0x45')]=function(_0x3d699d,_0x1d4c9f){var _0x460cd2={'raw':!![],'where':{'id':_0x3d699d[_0x7c02('0x46')]['id']}},_0x491407={};_0x491407[_0x7c02('0x38')]=_[_0x7c02('0x36')](db['ChatInternalMessage'][_0x7c02('0x32')]);_0x491407[_0x7c02('0x35')]=_['keys'](_0x3d699d[_0x7c02('0x35')]);_0x491407[_0x7c02('0x37')]=_[_0x7c02('0x47')](_0x491407[_0x7c02('0x38')],_0x491407[_0x7c02('0x35')]);_0x460cd2[_0x7c02('0x3a')]=_[_0x7c02('0x47')](_0x491407[_0x7c02('0x38')],qs[_0x7c02('0x39')](_0x3d699d[_0x7c02('0x35')][_0x7c02('0x39')]));_0x460cd2[_0x7c02('0x3a')]=_0x460cd2[_0x7c02('0x3a')][_0x7c02('0x3b')]?_0x460cd2['attributes']:_0x491407['model'];if(_0x3d699d[_0x7c02('0x35')][_0x7c02('0x44')]){_0x460cd2[_0x7c02('0x48')]=[{'all':!![]}];}_0x460cd2=_[_0x7c02('0x42')]({},_0x460cd2,_0x3d699d['options']);return db[_0x7c02('0x31')][_0x7c02('0x49')](_0x460cd2)[_0x7c02('0x2a')](handleEntityNotFound(_0x1d4c9f,null))[_0x7c02('0x2a')](respondWithResult(_0x1d4c9f,null))[_0x7c02('0x4a')](handleError(_0x1d4c9f,null));};exports[_0x7c02('0x4b')]=function(_0x513ef2,_0x108f59){return db[_0x7c02('0x31')][_0x7c02('0x4b')](_0x513ef2[_0x7c02('0x4c')],{})[_0x7c02('0x2a')](respondWithResult(_0x108f59,0xc9))[_0x7c02('0x4a')](handleError(_0x108f59,null));};exports[_0x7c02('0x29')]=function(_0xa62f5,_0x16b8c6){if(_0xa62f5[_0x7c02('0x4c')]['id']){delete _0xa62f5['body']['id'];}return db[_0x7c02('0x31')][_0x7c02('0x49')]({'where':{'id':_0xa62f5['params']['id']}})[_0x7c02('0x2a')](handleEntityNotFound(_0x16b8c6,null))[_0x7c02('0x2a')](saveUpdates(_0xa62f5[_0x7c02('0x4c')],null))[_0x7c02('0x2a')](respondWithResult(_0x16b8c6,null))[_0x7c02('0x4a')](handleError(_0x16b8c6,null));};exports[_0x7c02('0x4d')]=function(_0x4dbe91,_0x5b7b68){return db[_0x7c02('0x31')][_0x7c02('0x49')]({'where':{'id':_0x4dbe91[_0x7c02('0x46')]['id']}})[_0x7c02('0x2a')](handleEntityNotFound(_0x5b7b68,null))[_0x7c02('0x2a')](removeEntity(_0x5b7b68,null))[_0x7c02('0x4a')](handleError(_0x5b7b68,null));};exports[_0x7c02('0x4e')]=function(_0x486b50,_0xddea67){return db[_0x7c02('0x31')][_0x7c02('0x4e')]()[_0x7c02('0x2a')](respondWithResult(_0xddea67,null))[_0x7c02('0x4a')](handleError(_0xddea67,null));};function wrapUser(_0x1a31b0){return function(_0x3449c3){var _0x5b3bf2=_0x1a31b0[_0x7c02('0x4f')]({'plain':!![]});_0x5b3bf2[_0x7c02('0x50')]=[];if(_0x3449c3){_0x5b3bf2[_0x7c02('0x51')]=_0x3449c3[_0x7c02('0x52')];_0x5b3bf2['lastMessage']=_0x3449c3;}else{_0x5b3bf2[_0x7c02('0x51')]=moment(0x0)[_0x7c02('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b3bf2[_0x7c02('0x54')]={};}return _0x5b3bf2;};}exports[_0x7c02('0x55')]=function(_0xe8b756,_0x4d763d,_0x4682d4){var _0x29bde6=[];return db[_0x7c02('0x56')][_0x7c02('0x57')]({'where':{'role':['agent','admin',_0x7c02('0x58')]},'attributes':['id',_0x7c02('0x59'),_0x7c02('0x2d'),_0x7c02('0x5a'),'userpic',_0x7c02('0x5b'),_0x7c02('0x5c'),_0x7c02('0x5d'),_0x7c02('0x5e'),_0x7c02('0x5f')],'order':qs[_0x7c02('0x3e')](_0x7c02('0x60')),'include':[{'model':db[_0x7c02('0x61')],'as':_0x7c02('0x62'),'attributes':['id',_0x7c02('0x2d'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x3b1bb7){if(_0x3b1bb7){var _0x5be4d4=_0xe8b756[_0x7c02('0x58')]['get']({'plain':!![]});if(!_0x5be4d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5be4d4[_0x7c02('0x5a')]===_0x7c02('0x58')){return db['UserProfileSection'][_0x7c02('0x49')]({'where':{'name':'Agents','userProfileId':_0x5be4d4['userProfileId']},'raw':!![]})[_0x7c02('0x2a')](function(_0x3b3ff0){if(_0x3b3ff0){if(_0x3b3ff0[_0x7c02('0x63')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3b3ff0['id']},'raw':!![]})['then'](function(_0x135ee1){var _0xae15cc=[];if(_[_0x7c02('0x64')](_0x135ee1)){_0xae15cc=_[_0x7c02('0x41')](_0x3b1bb7,function(_0x27237e){if(_0x27237e['role']!=='agent'){return _0x27237e;}});return _0xae15cc;}else{for(var _0x3e48d8=0x0;_0x3e48d8<_0x3b1bb7['length'];_0x3e48d8++){var _0x2a7dcb=_0x3b1bb7[_0x3e48d8];if(_0x2a7dcb[_0x7c02('0x5a')]===_0x7c02('0x65')){var _0xe5f2c4=_['find'](_0x135ee1,function(_0xaf7391){return _0xaf7391[_0x7c02('0x66')]===_0x2a7dcb['id'];});if(_0xe5f2c4)_0xae15cc['push'](_0x2a7dcb);}else{_0xae15cc[_0x7c02('0x67')](_0x2a7dcb);}}return _0xae15cc;}});}else{return _0x3b1bb7;}}else{var _0x3ef451=_[_0x7c02('0x41')](_0x3b1bb7,function(_0x47c902){if(_0x47c902[_0x7c02('0x5a')]!==_0x7c02('0x65')){return _0x47c902;}});return _0x3ef451;}});}else{return _0x3b1bb7;}}})[_0x7c02('0x2a')](function(_0x54d075){var _0x36f622=[];if(_0x54d075){_0x29bde6=_0x54d075;for(var _0x2a6e5b=0x0;_0x2a6e5b<_0x54d075[_0x7c02('0x3b')];_0x2a6e5b+=0x1){_0x29bde6[_0x2a6e5b][_0x7c02('0x50')]=[];_0x36f622[_0x7c02('0x67')](db['ChatInternalMessage'][_0x7c02('0x49')]({'where':{'FromId':[_0xe8b756[_0x7c02('0x58')]['id'],_0x54d075[_0x2a6e5b]['id']],'ToId':[_0xe8b756[_0x7c02('0x58')]['id'],_0x54d075[_0x2a6e5b]['id']],'ChatGroupId':null},'attributes':['id',_0x7c02('0x52'),'FromId',_0x7c02('0x68'),_0x7c02('0x69'),'body'],'order':qs[_0x7c02('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7c02('0x2a')](wrapUser(_0x54d075[_0x2a6e5b])));}return BPromise[_0x7c02('0x6a')](_0x36f622);}return[];})[_0x7c02('0x2a')](function(_0x20121c){return{'rows':_0x20121c,'count':_0x20121c[_0x7c02('0x3b')]};})[_0x7c02('0x2a')](respondWithResult(_0x4d763d,null))[_0x7c02('0x4a')](handleError(_0x4d763d,null));}; \ No newline at end of file +var _0xd2ec=['bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','sendStatus','status','json','limit','undefined','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','agent','admin','fullname','role','userpic','lastLoginAt','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','user','FromId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2ec,0x1bb));var _0xcd2e=function(_0x3e2810,_0x104d34){_0x3e2810=_0x3e2810-0x0;var _0x577d18=_0xd2ec[_0x3e2810];return _0x577d18;};'use strict';var emlformat=require(_0xcd2e('0x0'));var rimraf=require(_0xcd2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd2e('0x2'));var rp=require(_0xcd2e('0x3'));var moment=require(_0xcd2e('0x4'));var BPromise=require(_0xcd2e('0x5'));var Mustache=require('mustache');var util=require(_0xcd2e('0x6'));var path=require(_0xcd2e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd2e('0x8'));var fs=require('fs');var fs_extra=require(_0xcd2e('0x9'));var _=require(_0xcd2e('0xa'));var squel=require('squel');var crypto=require(_0xcd2e('0xb'));var jsforce=require(_0xcd2e('0xc'));var deskjs=require(_0xcd2e('0xd'));var toCsv=require(_0xcd2e('0xe'));var querystring=require(_0xcd2e('0xf'));var Papa=require(_0xcd2e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd2e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd2e('0x12'));var logger=require(_0xcd2e('0x13'))(_0xcd2e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcd2e('0x15'));var db=require(_0xcd2e('0x16'))['db'];config[_0xcd2e('0x17')]=_[_0xcd2e('0x18')](config['redis'],{'host':_0xcd2e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcd2e('0x1a'))['register'](socket);function respondWithStatusCode(_0x789704,_0x5708cb){_0x5708cb=_0x5708cb||0xcc;return function(_0x4922a5){if(_0x4922a5){return _0x789704[_0xcd2e('0x1b')](_0x5708cb);}return _0x789704[_0xcd2e('0x1c')](_0x5708cb)['end']();};}function respondWithResult(_0x3d1ba8,_0x4713dd){_0x4713dd=_0x4713dd||0xc8;return function(_0x2970c1){if(_0x2970c1){return _0x3d1ba8['status'](_0x4713dd)[_0xcd2e('0x1d')](_0x2970c1);}};}function respondWithFilteredResult(_0x51a210,_0x3d8072){return function(_0x24a02f){if(_0x24a02f){var _0x4a5e37=typeof _0x3d8072['offset']==='undefined'&&typeof _0x3d8072[_0xcd2e('0x1e')]===_0xcd2e('0x1f');var _0xba33b4=_0x24a02f[_0xcd2e('0x20')];var _0x397229=_0x4a5e37?0x0:_0x3d8072['offset'];var _0x512eb2=_0x4a5e37?_0x24a02f[_0xcd2e('0x20')]:_0x3d8072['offset']+_0x3d8072[_0xcd2e('0x1e')];var _0x402540;if(_0x512eb2>=_0xba33b4){_0x512eb2=_0xba33b4;_0x402540=0xc8;}else{_0x402540=0xce;}_0x51a210[_0xcd2e('0x1c')](_0x402540);return _0x51a210[_0xcd2e('0x21')](_0xcd2e('0x22'),_0x397229+'-'+_0x512eb2+'/'+_0xba33b4)['json'](_0x24a02f);}return null;};}function patchUpdates(_0x545918){return function(_0x3238c3){try{jsonpatch['apply'](_0x3238c3,_0x545918,!![]);}catch(_0x579fbf){return BPromise[_0xcd2e('0x23')](_0x579fbf);}return _0x3238c3[_0xcd2e('0x24')]();};}function saveUpdates(_0x137967,_0x5cd389){return function(_0x316d93){if(_0x316d93){return _0x316d93[_0xcd2e('0x25')](_0x137967)[_0xcd2e('0x26')](function(_0x501c93){return _0x501c93;});}return null;};}function removeEntity(_0x2b57ff,_0x231c01){return function(_0x5d7f87){if(_0x5d7f87){return _0x5d7f87['destroy']()[_0xcd2e('0x26')](function(){_0x2b57ff['status'](0xcc)[_0xcd2e('0x27')]();});}};}function handleEntityNotFound(_0x5e0ac1,_0x300677){return function(_0x41f3f6){if(!_0x41f3f6){_0x5e0ac1[_0xcd2e('0x1b')](0x194);}return _0x41f3f6;};}function handleError(_0x5eaa9f,_0x38fe88){_0x38fe88=_0x38fe88||0x1f4;return function(_0x1f15da){logger[_0xcd2e('0x28')](_0x1f15da[_0xcd2e('0x29')]);if(_0x1f15da[_0xcd2e('0x2a')]){delete _0x1f15da[_0xcd2e('0x2a')];}_0x5eaa9f[_0xcd2e('0x1c')](_0x38fe88)[_0xcd2e('0x2b')](_0x1f15da);};}exports[_0xcd2e('0x2c')]=function(_0xb20524,_0x40cb69){var _0x2f70a0={},_0x1c0b91={},_0x454831={'count':0x0,'rows':[]};var _0x17c234=_[_0xcd2e('0x2d')](db[_0xcd2e('0x2e')][_0xcd2e('0x2f')],function(_0x2842f8){return{'name':_0x2842f8[_0xcd2e('0x30')],'type':_0x2842f8[_0xcd2e('0x31')][_0xcd2e('0x32')]};});_0x1c0b91['model']=_['map'](_0x17c234,_0xcd2e('0x2a'));_0x1c0b91[_0xcd2e('0x33')]=_['keys'](_0xb20524['query']);_0x1c0b91[_0xcd2e('0x34')]=_[_0xcd2e('0x35')](_0x1c0b91['model'],_0x1c0b91['query']);_0x2f70a0[_0xcd2e('0x36')]=_[_0xcd2e('0x35')](_0x1c0b91[_0xcd2e('0x37')],qs[_0xcd2e('0x38')](_0xb20524['query'][_0xcd2e('0x38')]));_0x2f70a0[_0xcd2e('0x36')]=_0x2f70a0[_0xcd2e('0x36')]['length']?_0x2f70a0['attributes']:_0x1c0b91[_0xcd2e('0x37')];if(!_0xb20524[_0xcd2e('0x33')][_0xcd2e('0x39')](_0xcd2e('0x3a'))){_0x2f70a0[_0xcd2e('0x1e')]=qs[_0xcd2e('0x1e')](_0xb20524['query']['limit']);_0x2f70a0[_0xcd2e('0x3b')]=qs[_0xcd2e('0x3b')](_0xb20524[_0xcd2e('0x33')][_0xcd2e('0x3b')]);}_0x2f70a0[_0xcd2e('0x3c')]=qs[_0xcd2e('0x3d')](_0xb20524['query'][_0xcd2e('0x3d')]);_0x2f70a0[_0xcd2e('0x3e')]=qs[_0xcd2e('0x34')](_[_0xcd2e('0x3f')](_0xb20524['query'],_0x1c0b91['filters']),_0x17c234);if(_0xb20524[_0xcd2e('0x33')][_0xcd2e('0x40')]){_0x2f70a0[_0xcd2e('0x3e')]=_[_0xcd2e('0x41')](_0x2f70a0['where'],{'$or':_['map'](_0x17c234,function(_0x3b08eb){if(_0x3b08eb[_0xcd2e('0x31')]!==_0xcd2e('0x42')){var _0x8d3b71={};_0x8d3b71[_0x3b08eb['name']]={'$like':'%'+_0xb20524[_0xcd2e('0x33')][_0xcd2e('0x40')]+'%'};return _0x8d3b71;}})});}_0x2f70a0=_[_0xcd2e('0x41')]({},_0x2f70a0,_0xb20524['options']);var _0x86bc21={'where':_0x2f70a0[_0xcd2e('0x3e')]};return db[_0xcd2e('0x2e')][_0xcd2e('0x20')](_0x86bc21)['then'](function(_0x591390){_0x454831[_0xcd2e('0x20')]=_0x591390;if(_0xb20524[_0xcd2e('0x33')][_0xcd2e('0x43')]){_0x2f70a0[_0xcd2e('0x44')]=[{'all':!![]}];}return db[_0xcd2e('0x2e')][_0xcd2e('0x45')](_0x2f70a0);})[_0xcd2e('0x26')](function(_0x5a80c0){_0x454831[_0xcd2e('0x46')]=_0x5a80c0;return _0x454831;})['then'](respondWithFilteredResult(_0x40cb69,_0x2f70a0))[_0xcd2e('0x47')](handleError(_0x40cb69,null));};exports[_0xcd2e('0x48')]=function(_0x29443b,_0x47ab6f){var _0xe589e9={'raw':!![],'where':{'id':_0x29443b[_0xcd2e('0x49')]['id']}},_0x4459d4={};_0x4459d4[_0xcd2e('0x37')]=_[_0xcd2e('0x4a')](db[_0xcd2e('0x2e')][_0xcd2e('0x2f')]);_0x4459d4[_0xcd2e('0x33')]=_[_0xcd2e('0x4a')](_0x29443b['query']);_0x4459d4[_0xcd2e('0x34')]=_[_0xcd2e('0x35')](_0x4459d4[_0xcd2e('0x37')],_0x4459d4[_0xcd2e('0x33')]);_0xe589e9[_0xcd2e('0x36')]=_[_0xcd2e('0x35')](_0x4459d4[_0xcd2e('0x37')],qs[_0xcd2e('0x38')](_0x29443b[_0xcd2e('0x33')]['fields']));_0xe589e9[_0xcd2e('0x36')]=_0xe589e9['attributes'][_0xcd2e('0x4b')]?_0xe589e9[_0xcd2e('0x36')]:_0x4459d4['model'];if(_0x29443b[_0xcd2e('0x33')]['includeAll']){_0xe589e9['include']=[{'all':!![]}];}_0xe589e9=_[_0xcd2e('0x41')]({},_0xe589e9,_0x29443b[_0xcd2e('0x4c')]);return db[_0xcd2e('0x2e')][_0xcd2e('0x4d')](_0xe589e9)[_0xcd2e('0x26')](handleEntityNotFound(_0x47ab6f,null))['then'](respondWithResult(_0x47ab6f,null))[_0xcd2e('0x47')](handleError(_0x47ab6f,null));};exports[_0xcd2e('0x4e')]=function(_0x4ea9e7,_0x2a4498){return db[_0xcd2e('0x2e')][_0xcd2e('0x4e')](_0x4ea9e7[_0xcd2e('0x4f')],{})[_0xcd2e('0x26')](respondWithResult(_0x2a4498,0xc9))['catch'](handleError(_0x2a4498,null));};exports[_0xcd2e('0x25')]=function(_0x3a0cd0,_0x5b87aa){if(_0x3a0cd0[_0xcd2e('0x4f')]['id']){delete _0x3a0cd0[_0xcd2e('0x4f')]['id'];}return db[_0xcd2e('0x2e')][_0xcd2e('0x4d')]({'where':{'id':_0x3a0cd0['params']['id']}})['then'](handleEntityNotFound(_0x5b87aa,null))[_0xcd2e('0x26')](saveUpdates(_0x3a0cd0['body'],null))[_0xcd2e('0x26')](respondWithResult(_0x5b87aa,null))[_0xcd2e('0x47')](handleError(_0x5b87aa,null));};exports[_0xcd2e('0x50')]=function(_0x4d302b,_0x55d8ca){return db[_0xcd2e('0x2e')][_0xcd2e('0x4d')]({'where':{'id':_0x4d302b[_0xcd2e('0x49')]['id']}})[_0xcd2e('0x26')](handleEntityNotFound(_0x55d8ca,null))['then'](removeEntity(_0x55d8ca,null))[_0xcd2e('0x47')](handleError(_0x55d8ca,null));};exports[_0xcd2e('0x51')]=function(_0xaba908,_0x5afe7d){return db[_0xcd2e('0x2e')][_0xcd2e('0x51')]()['then'](respondWithResult(_0x5afe7d,null))[_0xcd2e('0x47')](handleError(_0x5afe7d,null));};function wrapUser(_0x4a42de){return function(_0x313884){var _0x37843d=_0x4a42de[_0xcd2e('0x52')]({'plain':!![]});_0x37843d[_0xcd2e('0x53')]=[];if(_0x313884){_0x37843d[_0xcd2e('0x54')]=_0x313884[_0xcd2e('0x55')];_0x37843d['lastMessage']=_0x313884;}else{_0x37843d['lastMessageAt']=moment(0x0)[_0xcd2e('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x37843d[_0xcd2e('0x57')]={};}return _0x37843d;};}exports[_0xcd2e('0x58')]=function(_0x2309a0,_0x135d9d,_0x23d6b0){var _0x41e4ad=[];return db[_0xcd2e('0x59')][_0xcd2e('0x45')]({'where':{'role':[_0xcd2e('0x5a'),_0xcd2e('0x5b'),'user']},'attributes':['id',_0xcd2e('0x5c'),_0xcd2e('0x2a'),_0xcd2e('0x5d'),_0xcd2e('0x5e'),'internal','online',_0xcd2e('0x5f'),'allowmessenger',_0xcd2e('0x60')],'order':qs[_0xcd2e('0x3d')]('-online'),'include':[{'model':db[_0xcd2e('0x61')],'as':'VoiceQueues','attributes':['id','name',_0xcd2e('0x31')],'through':{'attributes':[]}}]})['then'](function(_0x21cd5f){if(_0x21cd5f){var _0x2697a7=_0x2309a0['user']['get']({'plain':!![]});if(!_0x2697a7)throw new Error(_0xcd2e('0x62'));if(_0x2697a7['role']==='user'){return db[_0xcd2e('0x63')][_0xcd2e('0x4d')]({'where':{'name':_0xcd2e('0x64'),'userProfileId':_0x2697a7[_0xcd2e('0x65')]},'raw':!![]})[_0xcd2e('0x26')](function(_0x218c9b){if(_0x218c9b){if(_0x218c9b[_0xcd2e('0x66')]===0x0){return db[_0xcd2e('0x67')][_0xcd2e('0x45')]({'where':{'sectionId':_0x218c9b['id']},'raw':!![]})[_0xcd2e('0x26')](function(_0x15558f){var _0x4aadcf=[];if(_[_0xcd2e('0x68')](_0x15558f)){_0x4aadcf=_[_0xcd2e('0x40')](_0x21cd5f,function(_0x2cc612){if(_0x2cc612['role']!==_0xcd2e('0x5a')){return _0x2cc612;}});return _0x4aadcf;}else{for(var _0x5e2092=0x0;_0x5e2092<_0x21cd5f[_0xcd2e('0x4b')];_0x5e2092++){var _0x465004=_0x21cd5f[_0x5e2092];if(_0x465004[_0xcd2e('0x5d')]===_0xcd2e('0x5a')){var _0x2c18d1=_[_0xcd2e('0x4d')](_0x15558f,function(_0x534ac1){return _0x534ac1[_0xcd2e('0x69')]===_0x465004['id'];});if(_0x2c18d1)_0x4aadcf[_0xcd2e('0x6a')](_0x465004);}else{_0x4aadcf[_0xcd2e('0x6a')](_0x465004);}}return _0x4aadcf;}});}else{return _0x21cd5f;}}else{var _0x4518e8=_['filter'](_0x21cd5f,function(_0x5d9956){if(_0x5d9956[_0xcd2e('0x5d')]!=='agent'){return _0x5d9956;}});return _0x4518e8;}});}else{return _0x21cd5f;}}})[_0xcd2e('0x26')](function(_0x4c35cf){var _0x1232fc=[];if(_0x4c35cf){_0x41e4ad=_0x4c35cf;for(var _0x34c2e8=0x0;_0x34c2e8<_0x4c35cf[_0xcd2e('0x4b')];_0x34c2e8+=0x1){_0x41e4ad[_0x34c2e8][_0xcd2e('0x53')]=[];_0x1232fc[_0xcd2e('0x6a')](db[_0xcd2e('0x2e')][_0xcd2e('0x4d')]({'where':{'FromId':[_0x2309a0['user']['id'],_0x4c35cf[_0x34c2e8]['id']],'ToId':[_0x2309a0[_0xcd2e('0x6b')]['id'],_0x4c35cf[_0x34c2e8]['id']],'ChatGroupId':null},'attributes':['id',_0xcd2e('0x55'),_0xcd2e('0x6c'),'ToId',_0xcd2e('0x6d'),_0xcd2e('0x4f')],'order':qs[_0xcd2e('0x3d')](_0xcd2e('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xcd2e('0x26')](wrapUser(_0x4c35cf[_0x34c2e8])));}return BPromise[_0xcd2e('0x6f')](_0x1232fc);}return[];})[_0xcd2e('0x26')](function(_0x59d93e){return{'rows':_0x59d93e,'count':_0x59d93e['length']};})['then'](respondWithResult(_0x135d9d,null))['catch'](handleError(_0x135d9d,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 72aa08f..b1cf8ad 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 _0xbde6=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','emit'];(function(_0x36055a,_0x55613a){var _0x1eb71f=function(_0x489fc4){while(--_0x489fc4){_0x36055a['push'](_0x36055a['shift']());}};_0x1eb71f(++_0x55613a);}(_0xbde6,0xae));var _0x6bde=function(_0x14c606,_0x4d97f1){_0x14c606=_0x14c606-0x0;var _0x34fe6e=_0xbde6[_0x14c606];return _0x34fe6e;};'use strict';var EventEmitter=require(_0x6bde('0x0'));var ChatInternalMessage=require(_0x6bde('0x1'))['db'][_0x6bde('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6bde('0x3')](0x0);var events={'afterCreate':_0x6bde('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x185367){return function(_0x1e95b2,_0x24b635,_0x291732){ChatInternalMessageEvents[_0x6bde('0x5')](_0x185367+':'+_0x1e95b2['id'],_0x1e95b2);ChatInternalMessageEvents[_0x6bde('0x5')](_0x185367,_0x1e95b2);_0x291732(null);};}for(var e in events){if(events[_0x6bde('0x6')](e)){var event=events[e];ChatInternalMessage[_0x6bde('0x7')](e,emitEvent(event));}}module[_0x6bde('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x0476=['ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x33ad1f,_0xfc2fc8){var _0x26ef22=function(_0x58f97c){while(--_0x58f97c){_0x33ad1f['push'](_0x33ad1f['shift']());}};_0x26ef22(++_0xfc2fc8);}(_0x0476,0x177));var _0x6047=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x0476[_0x17406e];return _0x2bfc5a;};'use strict';var EventEmitter=require(_0x6047('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x6047('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6047('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6047('0x3'),'afterDestroy':_0x6047('0x4')};function emitEvent(_0x4eea46){return function(_0x1d37b6,_0x55a1ee,_0x21e0c8){ChatInternalMessageEvents[_0x6047('0x5')](_0x4eea46+':'+_0x1d37b6['id'],_0x1d37b6);ChatInternalMessageEvents[_0x6047('0x5')](_0x4eea46,_0x1d37b6);_0x21e0c8(null);};}for(var e in events){if(events[_0x6047('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x6047('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 0adcf13..e9e0ea0 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 _0x1135=['moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xaf0e4c,_0x4760ab){var _0x28b3f9=function(_0xc36c19){while(--_0xc36c19){_0xaf0e4c['push'](_0xaf0e4c['shift']());}};_0x28b3f9(++_0x4760ab);}(_0x1135,0x1b7));var _0x5113=function(_0x16ba90,_0x108eb7){_0x16ba90=_0x16ba90-0x0;var _0x2bc281=_0x1135[_0x16ba90];return _0x2bc281;};'use strict';var _=require(_0x5113('0x0'));var util=require(_0x5113('0x1'));var logger=require(_0x5113('0x2'))('api');var moment=require(_0x5113('0x3'));var BPromise=require('bluebird');var rp=require(_0x5113('0x4'));var fs=require('fs');var path=require(_0x5113('0x5'));var rimraf=require(_0x5113('0x6'));var config=require(_0x5113('0x7'));var attributes=require(_0x5113('0x8'));module[_0x5113('0x9')]=function(_0x1fcd0d,_0xb8fccd){return _0x1fcd0d[_0x5113('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5113('0xb'),'collate':_0x5113('0xc')});}; \ No newline at end of file +var _0x183c=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x589274,_0xa3f1bd){var _0x21814b=function(_0x221253){while(--_0x221253){_0x589274['push'](_0x589274['shift']());}};_0x21814b(++_0xa3f1bd);}(_0x183c,0x1d5));var _0xc183=function(_0x5590da,_0x593a64){_0x5590da=_0x5590da-0x0;var _0x1aae1f=_0x183c[_0x5590da];return _0x1aae1f;};'use strict';var _=require(_0xc183('0x0'));var util=require('util');var logger=require(_0xc183('0x1'))('api');var moment=require(_0xc183('0x2'));var BPromise=require(_0xc183('0x3'));var rp=require(_0xc183('0x4'));var fs=require('fs');var path=require(_0xc183('0x5'));var rimraf=require(_0xc183('0x6'));var config=require(_0xc183('0x7'));var attributes=require(_0xc183('0x8'));module[_0xc183('0x9')]=function(_0x45321e,_0x1c7ac0){return _0x45321e[_0xc183('0xa')](_0xc183('0xb'),attributes,{'tableName':_0xc183('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc183('0xd'),'collate':_0xc183('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4b27c2f..212529e 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 _0xdadf=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatInternalMessage.socket','request','then','info','request\x20sent','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x20bcef,_0x55607f){var _0x372a1d=function(_0x2c9b3e){while(--_0x2c9b3e){_0x20bcef['push'](_0x20bcef['shift']());}};_0x372a1d(++_0x55607f);}(_0xdadf,0xc8));var _0xfdad=function(_0x47bf5b,_0x4531da){_0x47bf5b=_0x47bf5b-0x0;var _0x34edac=_0xdadf[_0x47bf5b];return _0x34edac;};'use strict';var _=require(_0xfdad('0x0'));var util=require('util');var moment=require(_0xfdad('0x1'));var BPromise=require(_0xfdad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdad('0x3'));var db=require(_0xfdad('0x4'))['db'];var utils=require(_0xfdad('0x5'));var logger=require(_0xfdad('0x6'))(_0xfdad('0x7'));var config=require(_0xfdad('0x8'));var jayson=require(_0xfdad('0x9'));var client=jayson['client'][_0xfdad('0xa')]({'port':0x232a});config[_0xfdad('0xb')]=_[_0xfdad('0xc')](config[_0xfdad('0xb')],{'host':_0xfdad('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdad('0xb')]));require(_0xfdad('0xe'))['register'](socket);function respondWithRpcPromise(_0xc5be48,_0x5889cd,_0x546cb9){return new BPromise(function(_0x48ee1e,_0x413a62){return client[_0xfdad('0xf')](_0xc5be48,_0x546cb9)[_0xfdad('0x10')](function(_0x29049c){logger[_0xfdad('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x5889cd,_0xfdad('0x12'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5889cd,_0xfdad('0x12'),JSON['stringify'](_0x29049c));if(_0x29049c[_0xfdad('0x13')]){if(_0x29049c['error'][_0xfdad('0x14')]===0x1f4){logger[_0xfdad('0x13')](_0xfdad('0x15'),_0x5889cd,_0x29049c['error'][_0xfdad('0x16')]);return _0x413a62(_0x29049c['error'][_0xfdad('0x16')]);}logger['error'](_0xfdad('0x15'),_0x5889cd,_0x29049c[_0xfdad('0x13')][_0xfdad('0x16')]);return _0x48ee1e(_0x29049c[_0xfdad('0x13')][_0xfdad('0x16')]);}else{logger['info'](_0xfdad('0x15'),_0x5889cd,_0xfdad('0x12'));_0x48ee1e(_0x29049c[_0xfdad('0x17')][_0xfdad('0x16')]);}})[_0xfdad('0x18')](function(_0x47cd2d){logger['error'](_0xfdad('0x15'),_0x5889cd,_0x47cd2d);_0x413a62(_0x47cd2d);});});} \ No newline at end of file +var _0x5c85=['then','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','register','request'];(function(_0x51d7ee,_0x3493f6){var _0x1cf6f1=function(_0x29916f){while(--_0x29916f){_0x51d7ee['push'](_0x51d7ee['shift']());}};_0x1cf6f1(++_0x3493f6);}(_0x5c85,0xc1));var _0x55c8=function(_0x5bd136,_0x319250){_0x5bd136=_0x5bd136-0x0;var _0x1d4337=_0x5c85[_0x5bd136];return _0x1d4337;};'use strict';var _=require(_0x55c8('0x0'));var util=require(_0x55c8('0x1'));var moment=require(_0x55c8('0x2'));var BPromise=require(_0x55c8('0x3'));var rs=require(_0x55c8('0x4'));var fs=require('fs');var Redis=require(_0x55c8('0x5'));var db=require(_0x55c8('0x6'))['db'];var utils=require(_0x55c8('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x55c8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55c8('0x9')]({'port':0x232a});config[_0x55c8('0xa')]=_[_0x55c8('0xb')](config['redis'],{'host':_0x55c8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55c8('0xa')]));require('./chatInternalMessage.socket')[_0x55c8('0xd')](socket);function respondWithRpcPromise(_0x316791,_0x80f28e,_0x3064dc){return new BPromise(function(_0x26ed35,_0x1e548d){return client[_0x55c8('0xe')](_0x316791,_0x3064dc)[_0x55c8('0xf')](function(_0x3f994f){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x80f28e,'request\x20sent');logger[_0x55c8('0x10')](_0x55c8('0x11'),_0x80f28e,_0x55c8('0x12'),JSON[_0x55c8('0x13')](_0x3f994f));if(_0x3f994f[_0x55c8('0x14')]){if(_0x3f994f[_0x55c8('0x14')]['code']===0x1f4){logger['error'](_0x55c8('0x15'),_0x80f28e,_0x3f994f[_0x55c8('0x14')][_0x55c8('0x16')]);return _0x1e548d(_0x3f994f['error'][_0x55c8('0x16')]);}logger[_0x55c8('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x80f28e,_0x3f994f[_0x55c8('0x14')]['message']);return _0x26ed35(_0x3f994f[_0x55c8('0x14')][_0x55c8('0x16')]);}else{logger[_0x55c8('0x17')](_0x55c8('0x15'),_0x80f28e,_0x55c8('0x12'));_0x26ed35(_0x3f994f[_0x55c8('0x18')]['message']);}})[_0x55c8('0x19')](function(_0x1e83ef){logger[_0x55c8('0x14')](_0x55c8('0x15'),_0x80f28e,_0x1e83ef);_0x1e548d(_0x1e83ef);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4031087..008e2cb 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 _0x7f2e=['removeListener','chatInternalMessage:','./chatInternalMessage.events','remove','emit'];(function(_0x34fe2c,_0x3c12cc){var _0x4fef94=function(_0x761711){while(--_0x761711){_0x34fe2c['push'](_0x34fe2c['shift']());}};_0x4fef94(++_0x3c12cc);}(_0x7f2e,0x19c));var _0xe7f2=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0x7f2e[_0x225f50];return _0x19d003;};'use strict';var ChatInternalMessageEvents=require(_0xe7f2('0x0'));var events=['save',_0xe7f2('0x1'),'update'];function createListener(_0x210ba0,_0x4fc5b3){return function(_0x4ad911){_0x4fc5b3[_0xe7f2('0x2')](_0x210ba0,_0x4ad911);};}function removeListener(_0x3c08cb,_0x1c5630){return function(){ChatInternalMessageEvents[_0xe7f2('0x3')](_0x3c08cb,_0x1c5630);};}exports['register']=function(_0x2de62f){for(var _0x14958f=0x0,_0xea3769=events['length'];_0x14958f<_0xea3769;_0x14958f++){var _0x15beaf=events[_0x14958f];var _0x329198=createListener(_0xe7f2('0x4')+_0x15beaf,_0x2de62f);ChatInternalMessageEvents['on'](_0x15beaf,_0x329198);}}; \ No newline at end of file +var _0x9a9b=['save','remove','update','register','length','./chatInternalMessage.events'];(function(_0x3c1b2c,_0xc1c9e7){var _0x107d5b=function(_0x588383){while(--_0x588383){_0x3c1b2c['push'](_0x3c1b2c['shift']());}};_0x107d5b(++_0xc1c9e7);}(_0x9a9b,0x185));var _0xb9a9=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x9a9b[_0xdd2bfa];return _0x55397e;};'use strict';var ChatInternalMessageEvents=require(_0xb9a9('0x0'));var events=[_0xb9a9('0x1'),_0xb9a9('0x2'),_0xb9a9('0x3')];function createListener(_0x26a75a,_0x52d66e){return function(_0x27f0e7){_0x52d66e['emit'](_0x26a75a,_0x27f0e7);};}function removeListener(_0xa6806a,_0x13de64){return function(){ChatInternalMessageEvents['removeListener'](_0xa6806a,_0x13de64);};}exports[_0xb9a9('0x4')]=function(_0x54a064){for(var _0x37abe4=0x0,_0x19bb21=events[_0xb9a9('0x5')];_0x37abe4<_0x19bb21;_0x37abe4++){var _0x32601b=events[_0x37abe4];var _0x749923=createListener('chatInternalMessage:'+_0x32601b,_0x54a064);ChatInternalMessageEvents['on'](_0x32601b,_0x749923);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 6d27c2a..9a5b4b9 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 _0x2d3d=['delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','getUsers','/:id','show','post','create','put','update'];(function(_0x44adaf,_0xa3c961){var _0x1dad05=function(_0x5540e6){while(--_0x5540e6){_0x44adaf['push'](_0x44adaf['shift']());}};_0x1dad05(++_0xa3c961);}(_0x2d3d,0x1a3));var _0xd2d3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2d3d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xd2d3('0x0'));var util=require(_0xd2d3('0x1'));var path=require(_0xd2d3('0x2'));var timeout=require(_0xd2d3('0x3'));var express=require(_0xd2d3('0x4'));var router=express[_0xd2d3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd2d3('0x6'));var interaction=require(_0xd2d3('0x7'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0xd2d3('0x8')]('/',auth[_0xd2d3('0x9')](),controller['index']);router[_0xd2d3('0x8')]('/describe',auth[_0xd2d3('0x9')](),controller[_0xd2d3('0xa')]);router[_0xd2d3('0x8')]('/users',auth[_0xd2d3('0x9')](),controller[_0xd2d3('0xb')]);router[_0xd2d3('0x8')](_0xd2d3('0xc'),auth['isAuthenticated'](),controller[_0xd2d3('0xd')]);router[_0xd2d3('0xe')]('/',auth['isAuthenticated'](),controller[_0xd2d3('0xf')]);router[_0xd2d3('0x10')](_0xd2d3('0xc'),controller[_0xd2d3('0x11')]);router[_0xd2d3('0x12')](_0xd2d3('0xc'),auth[_0xd2d3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x357f=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/users','getUsers','/:id','show','create','put','delete','destroy','exports','util'];(function(_0x2ffe16,_0x11955f){var _0x35a747=function(_0x33e76f){while(--_0x33e76f){_0x2ffe16['push'](_0x2ffe16['shift']());}};_0x35a747(++_0x11955f);}(_0x357f,0x77));var _0xf357=function(_0x114896,_0x3a741a){_0x114896=_0x114896-0x0;var _0x3f0136=_0x357f[_0x114896];return _0x3f0136;};'use strict';var multer=require('multer');var util=require(_0xf357('0x0'));var path=require(_0xf357('0x1'));var timeout=require(_0xf357('0x2'));var express=require('express');var router=express[_0xf357('0x3')]();var fs_extra=require(_0xf357('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf357('0x5'));var config=require(_0xf357('0x6'));var controller=require('./chatInternalMessage.controller');router[_0xf357('0x7')]('/',auth['isAuthenticated'](),controller[_0xf357('0x8')]);router[_0xf357('0x7')](_0xf357('0x9'),auth[_0xf357('0xa')](),controller['describe']);router[_0xf357('0x7')](_0xf357('0xb'),auth[_0xf357('0xa')](),controller[_0xf357('0xc')]);router[_0xf357('0x7')](_0xf357('0xd'),auth[_0xf357('0xa')](),controller[_0xf357('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf357('0xf')]);router[_0xf357('0x10')](_0xf357('0xd'),controller['update']);router[_0xf357('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf357('0x12')]);module[_0xf357('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 fdfd7f8..94aa744 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 _0xc224=['exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x3afeda,_0x4b249f){var _0xb4c759=function(_0x4db382){while(--_0x4db382){_0x3afeda['push'](_0x3afeda['shift']());}};_0xb4c759(++_0x4b249f);}(_0xc224,0x1af));var _0x4c22=function(_0x5614ed,_0x180602){_0x5614ed=_0x5614ed-0x0;var _0xd0b252=_0xc224[_0x5614ed];return _0xd0b252;};'use strict';var Sequelize=require(_0x4c22('0x0'));module[_0x4c22('0x1')]={'body':{'type':Sequelize[_0x4c22('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4c22('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4c22('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4c22('0x4')]('in',_0x4c22('0x5')),'defaultValue':_0x4c22('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4c22('0x6')]},'providerName':{'type':Sequelize[_0x4c22('0x7')]},'providerResponse':{'type':Sequelize[_0x4c22('0x2')]}}; \ No newline at end of file +var _0xb921=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x2d51cc,_0x2ca3e2){var _0x3dc46b=function(_0x14bc3b){while(--_0x14bc3b){_0x2d51cc['push'](_0x2d51cc['shift']());}};_0x3dc46b(++_0x2ca3e2);}(_0xb921,0x16a));var _0x1b92=function(_0x1b58b8,_0x3e1c2a){_0x1b58b8=_0x1b58b8-0x0;var _0x479502=_0xb921[_0x1b58b8];return _0x479502;};'use strict';var Sequelize=require(_0x1b92('0x0'));module[_0x1b92('0x1')]={'body':{'type':Sequelize[_0x1b92('0x2')](_0x1b92('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1b92('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1b92('0x5')),'defaultValue':_0x1b92('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1b92('0x6')]},'providerName':{'type':Sequelize[_0x1b92('0x7')]},'providerResponse':{'type':Sequelize[_0x1b92('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 55c5125..fb65375 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 _0xeddd=['user','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','motionChannel','reject','rejectmessage','formData','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','create','update','body','params','describe','chat-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x292fbe,_0x1148ec){var _0x53ddce=function(_0x1890e5){while(--_0x1890e5){_0x292fbe['push'](_0x292fbe['shift']());}};_0x53ddce(++_0x1148ec);}(_0xeddd,0xa8));var _0xdedd=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xeddd[_0x45d55e];return _0x29812a;};'use strict';var emlformat=require(_0xdedd('0x0'));var rimraf=require(_0xdedd('0x1'));var zipdir=require(_0xdedd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdedd('0x3'));var moment=require('moment');var BPromise=require(_0xdedd('0x4'));var Mustache=require(_0xdedd('0x5'));var util=require(_0xdedd('0x6'));var path=require(_0xdedd('0x7'));var sox=require(_0xdedd('0x8'));var csv=require(_0xdedd('0x9'));var ejs=require(_0xdedd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdedd('0xb'));var squel=require('squel');var crypto=require(_0xdedd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdedd('0xd'));var toCsv=require(_0xdedd('0x9'));var querystring=require(_0xdedd('0xe'));var Papa=require(_0xdedd('0xf'));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(_0xdedd('0x10'));var logger=require(_0xdedd('0x11'))(_0xdedd('0x12'));var utils=require(_0xdedd('0x13'));var config=require(_0xdedd('0x14'));var licenseUtil=require(_0xdedd('0x15'));var db=require(_0xdedd('0x16'))['db'];config[_0xdedd('0x17')]=_[_0xdedd('0x18')](config[_0xdedd('0x17')],{'host':_0xdedd('0x19'),'port':0x18eb});var socket=require(_0xdedd('0x1a'))(new Redis(config[_0xdedd('0x17')]));require(_0xdedd('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdedd('0x1c')][_0xdedd('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xdedd('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x491595,_0x443358,_0x3d6f09,_0x228aa1){return new BPromise(function(_0x20bb0f,_0x447a06){var _0x263938=_0x228aa1||client;return _0x263938[_0xdedd('0x1e')](_0x491595,_0x3d6f09)[_0xdedd('0x1f')](function(_0x220d39){logger[_0xdedd('0x20')]('ChatMessage,\x20%s,\x20%s',_0x443358,_0xdedd('0x21'));logger[_0xdedd('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x443358,_0xdedd('0x21'),JSON[_0xdedd('0x23')](_0x220d39));if(_0x220d39[_0xdedd('0x24')]){if(_0x220d39[_0xdedd('0x24')][_0xdedd('0x25')]===0x1f4){logger[_0xdedd('0x24')](_0xdedd('0x26'),_0x443358,_0x220d39['error']['message']);return _0x447a06(_0x220d39[_0xdedd('0x24')][_0xdedd('0x27')]);}logger['error'](_0xdedd('0x26'),_0x443358,_0x220d39[_0xdedd('0x24')]['message']);return _0x20bb0f(_0x220d39[_0xdedd('0x24')][_0xdedd('0x27')]);}else{logger['info'](_0xdedd('0x26'),_0x443358,_0xdedd('0x21'));_0x20bb0f(_0x220d39[_0xdedd('0x28')][_0xdedd('0x27')]);}})[_0xdedd('0x29')](function(_0x1ef903){logger['error'](_0xdedd('0x26'),_0x443358,_0x1ef903);_0x447a06(_0x1ef903);});});}function respondWithStatusCode(_0x42c8f7,_0x4abc9e){_0x4abc9e=_0x4abc9e||0xcc;return function(_0x316a9b){if(_0x316a9b){return _0x42c8f7[_0xdedd('0x2a')](_0x4abc9e);}return _0x42c8f7[_0xdedd('0x2b')](_0x4abc9e)[_0xdedd('0x2c')]();};}function respondWithResult(_0x8a1418,_0x73d9de){_0x73d9de=_0x73d9de||0xc8;return function(_0x5f0a15){if(_0x5f0a15){return _0x8a1418[_0xdedd('0x2b')](_0x73d9de)[_0xdedd('0x2d')](_0x5f0a15);}};}function respondWithFilteredResult(_0xa7d00b,_0x1051c6){return function(_0x2f0a29){if(_0x2f0a29){var _0x5bb57f=typeof _0x1051c6['offset']===_0xdedd('0x2e')&&typeof _0x1051c6['limit']===_0xdedd('0x2e');var _0x18a75d=_0x2f0a29[_0xdedd('0x2f')];var _0x5370c8=_0x5bb57f?0x0:_0x1051c6[_0xdedd('0x30')];var _0x351624=_0x5bb57f?_0x2f0a29[_0xdedd('0x2f')]:_0x1051c6['offset']+_0x1051c6[_0xdedd('0x31')];var _0x456329;if(_0x351624>=_0x18a75d){_0x351624=_0x18a75d;_0x456329=0xc8;}else{_0x456329=0xce;}_0xa7d00b[_0xdedd('0x2b')](_0x456329);return _0xa7d00b[_0xdedd('0x32')](_0xdedd('0x33'),_0x5370c8+'-'+_0x351624+'/'+_0x18a75d)[_0xdedd('0x2d')](_0x2f0a29);}return null;};}function patchUpdates(_0x3fa081){return function(_0x38d046){try{jsonpatch[_0xdedd('0x34')](_0x38d046,_0x3fa081,!![]);}catch(_0xbba0f2){return BPromise['reject'](_0xbba0f2);}return _0x38d046[_0xdedd('0x35')]();};}function saveUpdates(_0x4aa293,_0x12857c){return function(_0x28b169){if(_0x28b169){return _0x28b169['update'](_0x4aa293)[_0xdedd('0x1f')](function(_0x475abf){return _0x475abf;});}return null;};}function removeEntity(_0x17b537,_0x521f19){return function(_0x593c63){if(_0x593c63){return _0x593c63[_0xdedd('0x36')]()['then'](function(){_0x17b537[_0xdedd('0x2b')](0xcc)[_0xdedd('0x2c')]();});}};}function handleEntityNotFound(_0x53cc94,_0x590a3a){return function(_0x198416){if(!_0x198416){_0x53cc94[_0xdedd('0x2a')](0x194);}return _0x198416;};}function handleError(_0x4715d3,_0x310ff1){_0x310ff1=_0x310ff1||0x1f4;return function(_0x4b88be){logger[_0xdedd('0x24')](_0x4b88be[_0xdedd('0x37')]);if(_0x4b88be['name']){delete _0x4b88be[_0xdedd('0x38')];}_0x4715d3['status'](_0x310ff1)[_0xdedd('0x39')](_0x4b88be);};}exports[_0xdedd('0x3a')]=function(_0x283886,_0x31837f){var _0x454d74={},_0xeb4285={},_0x2692fe={'count':0x0,'rows':[]};var _0x5a6779=_[_0xdedd('0x3b')](db[_0xdedd('0x3c')]['rawAttributes'],function(_0xadc8e1){return{'name':_0xadc8e1[_0xdedd('0x3d')],'type':_0xadc8e1[_0xdedd('0x3e')][_0xdedd('0x3f')]};});_0xeb4285[_0xdedd('0x40')]=_[_0xdedd('0x3b')](_0x5a6779,_0xdedd('0x38'));_0xeb4285[_0xdedd('0x41')]=_[_0xdedd('0x42')](_0x283886[_0xdedd('0x41')]);_0xeb4285[_0xdedd('0x43')]=_[_0xdedd('0x44')](_0xeb4285[_0xdedd('0x40')],_0xeb4285[_0xdedd('0x41')]);_0x454d74[_0xdedd('0x45')]=_[_0xdedd('0x44')](_0xeb4285[_0xdedd('0x40')],qs[_0xdedd('0x46')](_0x283886['query'][_0xdedd('0x46')]));_0x454d74[_0xdedd('0x45')]=_0x454d74[_0xdedd('0x45')][_0xdedd('0x47')]?_0x454d74[_0xdedd('0x45')]:_0xeb4285[_0xdedd('0x40')];if(!_0x283886[_0xdedd('0x41')]['hasOwnProperty'](_0xdedd('0x48'))){_0x454d74[_0xdedd('0x31')]=qs['limit'](_0x283886[_0xdedd('0x41')][_0xdedd('0x31')]);_0x454d74[_0xdedd('0x30')]=qs[_0xdedd('0x30')](_0x283886[_0xdedd('0x41')][_0xdedd('0x30')]);}_0x454d74[_0xdedd('0x49')]=qs[_0xdedd('0x4a')](_0x283886[_0xdedd('0x41')][_0xdedd('0x4a')]);_0x454d74[_0xdedd('0x4b')]=qs[_0xdedd('0x43')](_[_0xdedd('0x4c')](_0x283886[_0xdedd('0x41')],_0xeb4285[_0xdedd('0x43')]),_0x5a6779);if(_0x283886[_0xdedd('0x41')]['filter']){_0x454d74['where']=_[_0xdedd('0x4d')](_0x454d74['where'],{'$or':_['map'](_0x5a6779,function(_0x864f11){if(_0x864f11[_0xdedd('0x3e')]!==_0xdedd('0x4e')){var _0x3bfedc={};_0x3bfedc[_0x864f11[_0xdedd('0x38')]]={'$like':'%'+_0x283886[_0xdedd('0x41')][_0xdedd('0x4f')]+'%'};return _0x3bfedc;}})});}_0x454d74=_[_0xdedd('0x4d')]({},_0x454d74,_0x283886[_0xdedd('0x50')]);var _0x2e805d={'where':_0x454d74['where']};return db['ChatMessage'][_0xdedd('0x2f')](_0x2e805d)[_0xdedd('0x1f')](function(_0x374e06){_0x2692fe[_0xdedd('0x2f')]=_0x374e06;if(_0x283886['query'][_0xdedd('0x51')]){_0x454d74[_0xdedd('0x52')]=[{'all':!![]}];}return db[_0xdedd('0x3c')][_0xdedd('0x53')](_0x454d74);})[_0xdedd('0x1f')](function(_0xe39b0){_0x2692fe[_0xdedd('0x54')]=_0xe39b0;return _0x2692fe;})[_0xdedd('0x1f')](respondWithFilteredResult(_0x31837f,_0x454d74))[_0xdedd('0x29')](handleError(_0x31837f,null));};exports[_0xdedd('0x55')]=function(_0x227602,_0x7697a7){var _0x4932bd={'raw':!![],'where':{'id':_0x227602['params']['id']}},_0x4bfc9c={};_0x4bfc9c[_0xdedd('0x40')]=_[_0xdedd('0x42')](db[_0xdedd('0x3c')]['rawAttributes']);_0x4bfc9c[_0xdedd('0x41')]=_[_0xdedd('0x42')](_0x227602[_0xdedd('0x41')]);_0x4bfc9c[_0xdedd('0x43')]=_[_0xdedd('0x44')](_0x4bfc9c[_0xdedd('0x40')],_0x4bfc9c[_0xdedd('0x41')]);_0x4932bd['attributes']=_[_0xdedd('0x44')](_0x4bfc9c['model'],qs['fields'](_0x227602[_0xdedd('0x41')][_0xdedd('0x46')]));_0x4932bd['attributes']=_0x4932bd[_0xdedd('0x45')]['length']?_0x4932bd[_0xdedd('0x45')]:_0x4bfc9c[_0xdedd('0x40')];if(_0x227602['query'][_0xdedd('0x51')]){_0x4932bd[_0xdedd('0x52')]=[{'all':!![]}];}_0x4932bd=_['merge']({},_0x4932bd,_0x227602['options']);return db[_0xdedd('0x3c')][_0xdedd('0x56')](_0x4932bd)[_0xdedd('0x1f')](handleEntityNotFound(_0x7697a7,null))[_0xdedd('0x1f')](respondWithResult(_0x7697a7,null))[_0xdedd('0x29')](handleError(_0x7697a7,null));};exports[_0xdedd('0x57')]=function(_0x2e7040,_0x5d3cd1){return db[_0xdedd('0x3c')][_0xdedd('0x57')](_0x2e7040['body'],{})['then'](respondWithResult(_0x5d3cd1,0xc9))['catch'](handleError(_0x5d3cd1,null));};exports[_0xdedd('0x58')]=function(_0x33b665,_0x2ad4b3){if(_0x33b665['body']['id']){delete _0x33b665[_0xdedd('0x59')]['id'];}return db[_0xdedd('0x3c')][_0xdedd('0x56')]({'where':{'id':_0x33b665['params']['id']}})[_0xdedd('0x1f')](handleEntityNotFound(_0x2ad4b3,null))[_0xdedd('0x1f')](saveUpdates(_0x33b665[_0xdedd('0x59')],null))[_0xdedd('0x1f')](respondWithResult(_0x2ad4b3,null))[_0xdedd('0x29')](handleError(_0x2ad4b3,null));};exports[_0xdedd('0x36')]=function(_0x8d74ba,_0x51920b){return db[_0xdedd('0x3c')][_0xdedd('0x56')]({'where':{'id':_0x8d74ba[_0xdedd('0x5a')]['id']}})['then'](handleEntityNotFound(_0x51920b,null))[_0xdedd('0x1f')](removeEntity(_0x51920b,null))[_0xdedd('0x29')](handleError(_0x51920b,null));};exports[_0xdedd('0x5b')]=function(_0x587ee1,_0x48cf67){return db['ChatMessage'][_0xdedd('0x5b')]()['then'](respondWithResult(_0x48cf67,null))[_0xdedd('0x29')](handleError(_0x48cf67,null));};var interaction_log=require(_0xdedd('0x11'))(_0xdedd('0x5c'));exports[_0xdedd('0x5d')]=function(_0x3f4518,_0x5daa53,_0x240c43){var _0x48fcce={'agent':{},'channel':'chat'};if(_0x3f4518['body']['id']){delete _0x3f4518[_0xdedd('0x59')]['id'];}_0x3f4518['body'][_0xdedd('0x5e')]=!![];_0x3f4518['body'][_0xdedd('0x5f')]=moment()['format'](_0xdedd('0x60'));_0x3f4518[_0xdedd('0x59')][_0xdedd('0x61')]=_0x3f4518[_0xdedd('0x59')]['UserId']||_0x3f4518[_0xdedd('0x62')]['id'];_0x48fcce[_0xdedd('0x63')]['id']=_0x3f4518[_0xdedd('0x59')][_0xdedd('0x61')];return db[_0xdedd('0x3c')][_0xdedd('0x56')]({'where':{'id':_0x3f4518['params']['id'],'UserId':null}})[_0xdedd('0x1f')](handleEntityNotFound(_0x5daa53,null))[_0xdedd('0x1f')](saveUpdates(_0x3f4518[_0xdedd('0x59')],null))[_0xdedd('0x1f')](function(_0x1c360d){if(_0x1c360d){_0x48fcce['message']=_0x1c360d[_0xdedd('0x64')]({'plain':!![]});return db[_0xdedd('0x65')][_0xdedd('0x56')]({'where':{'id':_0x1c360d[_0xdedd('0x66')]}});}return null;})[_0xdedd('0x1f')](handleEntityNotFound(_0x5daa53,null))[_0xdedd('0x1f')](function(_0x52ba38){if(_0x52ba38){return _0x52ba38[_0xdedd('0x58')]({'UserId':_0x3f4518[_0xdedd('0x59')][_0xdedd('0x61')],'read1stAt':_[_0xdedd('0x67')](_0x52ba38['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdedd('0x1f')](function(_0x45c484){if(_0x45c484){_0x48fcce[_0xdedd('0x68')]=_0x45c484[_0xdedd('0x64')]({'plain':!![]});interaction_log[_0xdedd('0x20')](_0xdedd('0x69'),_0x3f4518[_0xdedd('0x62')]['id'],_0x3f4518[_0xdedd('0x62')][_0xdedd('0x38')],_0x3f4518['user'][_0xdedd('0x6a')],_0x48fcce[_0xdedd('0x68')]['id'],_0x3f4518[_0xdedd('0x59')]?JSON[_0xdedd('0x23')](_0x3f4518[_0xdedd('0x59')]):'null');return respondWithRpcPromise(_0xdedd('0x6b'),_0xdedd('0x6c'),_0x48fcce);}return null;})[_0xdedd('0x1f')](function(_0x3ad6de){var _0x188041='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3ad6de[_0xdedd('0x27')]['ContactId'];return db[_0xdedd('0x6d')][_0xdedd('0x41')](_0x188041,{'type':db[_0xdedd('0x6e')][_0xdedd('0x6f')][_0xdedd('0x70')],'raw':!![]})['then'](function(_0x2b69a5){return _0x2b69a5;});})[_0xdedd('0x1f')](function(_0x309bef){if(_0x309bef){_0x48fcce[_0xdedd('0x27')][_0xdedd('0x71')]=_0x309bef[0x0];if(!_0x3f4518[_0xdedd('0x59')][_0xdedd('0x61')])return;return db[_0xdedd('0x72')]['find']({'where':{'id':_0x3f4518[_0xdedd('0x59')][_0xdedd('0x61')],'role':_0xdedd('0x63')},'attributes':['id',_0xdedd('0x38'),_0xdedd('0x73'),_0xdedd('0x74'),'internal'],'raw':!![]});}return null;})[_0xdedd('0x1f')](function(_0x2002f7){if(!_0x2002f7)return null;_0x48fcce[_0xdedd('0x27')]['agent']=_0x2002f7;return _0x48fcce;})[_0xdedd('0x1f')](function(_0x1d0dcd){if(_0x1d0dcd){if(_0x3f4518[_0xdedd('0x59')]['manual']){_0x48fcce['message'][_0xdedd('0x75')]=util[_0xdedd('0x76')](_0xdedd('0x77'),_0x3f4518[_0xdedd('0x62')][_0xdedd('0x38')]);_0x48fcce['message']['channel']=_0x48fcce['channel'];_0x48fcce[_0xdedd('0x27')]['motionChannel']=_0x48fcce[_0xdedd('0x78')];_0x48fcce[_0xdedd('0x27')][_0xdedd('0x79')]=_0xdedd('0x5d');return respondWithRpcPromise(_0xdedd('0x7a'),_0xdedd('0x7a'),{'event':_0xdedd('0x7b'),'message':_['merge'](_0x48fcce[_0xdedd('0x27')],JSON[_0xdedd('0x7c')](_0x48fcce[_0xdedd('0x68')]['formData']))},client9002)['then'](function(){return _0x48fcce;});}return _0x48fcce;}return null;})[_0xdedd('0x1f')](respondWithResult(_0x5daa53,null))[_0xdedd('0x29')](handleError(_0x5daa53,null));};var interaction_log=require(_0xdedd('0x11'))(_0xdedd('0x5c'));exports['reject']=function(_0x1ad572,_0x21915f,_0x58445){var _0x472d73={'agent':{},'channel':'chat'};if(_0x1ad572[_0xdedd('0x59')]['id']){delete _0x1ad572[_0xdedd('0x59')]['id'];}_0x1ad572['body'][_0xdedd('0x61')]=_0x1ad572[_0xdedd('0x59')][_0xdedd('0x61')]||_0x1ad572[_0xdedd('0x62')]['id'];_0x472d73['agent']['id']=_0x1ad572[_0xdedd('0x59')][_0xdedd('0x61')];return db[_0xdedd('0x3c')][_0xdedd('0x56')]({'where':{'id':_0x1ad572[_0xdedd('0x5a')]['id'],'UserId':null}})[_0xdedd('0x1f')](handleEntityNotFound(_0x21915f,null))[_0xdedd('0x1f')](function(_0x32d865){if(_0x32d865){_0x472d73[_0xdedd('0x27')]=_0x32d865['get']({'plain':!![]});return db[_0xdedd('0x65')]['find']({'where':{'id':_0x32d865[_0xdedd('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x21915f,null))[_0xdedd('0x1f')](function(_0x1ff0a1){if(_0x1ff0a1){_0x472d73['interaction']=_0x1ff0a1[_0xdedd('0x64')]({'plain':!![]});interaction_log[_0xdedd('0x20')](_0xdedd('0x7d'),_0x1ad572[_0xdedd('0x62')]['id'],_0x1ad572['user'][_0xdedd('0x38')],_0x1ad572[_0xdedd('0x62')][_0xdedd('0x6a')],_0x472d73[_0xdedd('0x68')]['id'],_0x1ad572['body']?JSON[_0xdedd('0x23')](_0x1ad572['body']):_0xdedd('0x7e'));return respondWithRpcPromise(_0xdedd('0x7f'),_0xdedd('0x80'),_0x472d73);}return null;})[_0xdedd('0x1f')](function(_0x564f39){var _0x33e75f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x564f39[_0xdedd('0x27')]['ContactId'];return db[_0xdedd('0x6d')]['query'](_0x33e75f,{'type':db[_0xdedd('0x6e')][_0xdedd('0x6f')][_0xdedd('0x70')],'raw':!![]})[_0xdedd('0x1f')](function(_0x4ed250){return _0x4ed250;});})[_0xdedd('0x1f')](function(_0x25f6d0){if(_0x25f6d0){_0x472d73[_0xdedd('0x27')]['contact']=_0x25f6d0[0x0];if(!_0x1ad572['body'][_0xdedd('0x61')])return;return db[_0xdedd('0x72')][_0xdedd('0x56')]({'where':{'id':_0x1ad572[_0xdedd('0x59')][_0xdedd('0x61')],'role':_0xdedd('0x63')},'attributes':['id',_0xdedd('0x38'),_0xdedd('0x73'),_0xdedd('0x74'),'internal'],'raw':!![]});}return null;})[_0xdedd('0x1f')](function(_0x4a2267){if(!_0x4a2267)return null;_0x472d73[_0xdedd('0x27')][_0xdedd('0x63')]=_0x4a2267;return _0x472d73;})[_0xdedd('0x1f')](function(_0x5a34e3){if(_0x5a34e3){_0x5a34e3[_0xdedd('0x27')][_0xdedd('0x75')]=util[_0xdedd('0x76')](_0xdedd('0x77'),_0x1ad572[_0xdedd('0x62')][_0xdedd('0x38')]);_0x5a34e3[_0xdedd('0x27')][_0xdedd('0x78')]=_0x472d73[_0xdedd('0x78')];_0x5a34e3[_0xdedd('0x27')][_0xdedd('0x81')]=_0x472d73[_0xdedd('0x78')];_0x5a34e3['message']['event']=_0xdedd('0x82');respondWithRpcPromise(_0xdedd('0x7a'),_0xdedd('0x7a'),{'event':_0xdedd('0x83'),'message':_[_0xdedd('0x4d')](_0x472d73[_0xdedd('0x27')],JSON['parse'](_0x472d73['interaction'][_0xdedd('0x84')]))},client9002);return _0x472d73;}return null;})['then'](respondWithResult(_0x21915f,null))[_0xdedd('0x29')](handleError(_0x21915f,null));}; \ No newline at end of file +var _0x9c2e=['set','Content-Range','apply','save','then','stack','name','send','index','map','fieldName','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','ChatMessage','includeAll','rows','show','keys','intersection','include','find','create','body','update','params','destroy','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','interaction','formData','reject','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','User','fullname','rejectmessage','parse','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x431f27,_0x152cc4){var _0x559a65=function(_0x1117ed){while(--_0x1117ed){_0x431f27['push'](_0x431f27['shift']());}};_0x559a65(++_0x152cc4);}(_0x9c2e,0x161));var _0xe9c2=function(_0x3ccc0d,_0xaf0382){_0x3ccc0d=_0x3ccc0d-0x0;var _0x1c2d89=_0x9c2e[_0x3ccc0d];return _0x1c2d89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9c2('0x0'));var zipdir=require(_0xe9c2('0x1'));var jsonpatch=require(_0xe9c2('0x2'));var rp=require(_0xe9c2('0x3'));var moment=require(_0xe9c2('0x4'));var BPromise=require(_0xe9c2('0x5'));var Mustache=require('mustache');var util=require(_0xe9c2('0x6'));var path=require(_0xe9c2('0x7'));var sox=require(_0xe9c2('0x8'));var csv=require('to-csv');var ejs=require(_0xe9c2('0x9'));var fs=require('fs');var fs_extra=require(_0xe9c2('0xa'));var _=require('lodash');var squel=require(_0xe9c2('0xb'));var crypto=require(_0xe9c2('0xc'));var jsforce=require(_0xe9c2('0xd'));var deskjs=require(_0xe9c2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe9c2('0xf'));var Papa=require(_0xe9c2('0x10'));var Redis=require(_0xe9c2('0x11'));var authService=require(_0xe9c2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe9c2('0x13'));var hardwareService=require(_0xe9c2('0x14'));var logger=require(_0xe9c2('0x15'))(_0xe9c2('0x16'));var utils=require(_0xe9c2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe9c2('0x18'));var db=require(_0xe9c2('0x19'))['db'];config[_0xe9c2('0x1a')]=_[_0xe9c2('0x1b')](config[_0xe9c2('0x1a')],{'host':_0xe9c2('0x1c'),'port':0x18eb});var socket=require(_0xe9c2('0x1d'))(new Redis(config[_0xe9c2('0x1a')]));require(_0xe9c2('0x1e'))['register'](socket);var jayson=require(_0xe9c2('0x1f'));var client=jayson[_0xe9c2('0x20')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18e5b5,_0xafde69,_0x1312e8,_0x2cd991){return new BPromise(function(_0x5da239,_0x4edff9){var _0x2eeabe=_0x2cd991||client;return _0x2eeabe[_0xe9c2('0x21')](_0x18e5b5,_0x1312e8)['then'](function(_0x38b4bc){logger[_0xe9c2('0x22')](_0xe9c2('0x23'),_0xafde69,_0xe9c2('0x24'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0xafde69,_0xe9c2('0x24'),JSON[_0xe9c2('0x25')](_0x38b4bc));if(_0x38b4bc[_0xe9c2('0x26')]){if(_0x38b4bc[_0xe9c2('0x26')]['code']===0x1f4){logger[_0xe9c2('0x26')](_0xe9c2('0x23'),_0xafde69,_0x38b4bc[_0xe9c2('0x26')][_0xe9c2('0x27')]);return _0x4edff9(_0x38b4bc['error'][_0xe9c2('0x27')]);}logger[_0xe9c2('0x26')](_0xe9c2('0x23'),_0xafde69,_0x38b4bc[_0xe9c2('0x26')]['message']);return _0x5da239(_0x38b4bc['error'][_0xe9c2('0x27')]);}else{logger[_0xe9c2('0x22')](_0xe9c2('0x23'),_0xafde69,_0xe9c2('0x24'));_0x5da239(_0x38b4bc['result'][_0xe9c2('0x27')]);}})[_0xe9c2('0x28')](function(_0x4d882e){logger['error'](_0xe9c2('0x23'),_0xafde69,_0x4d882e);_0x4edff9(_0x4d882e);});});}function respondWithStatusCode(_0x1abcff,_0x2c3bf4){_0x2c3bf4=_0x2c3bf4||0xcc;return function(_0x46d614){if(_0x46d614){return _0x1abcff[_0xe9c2('0x29')](_0x2c3bf4);}return _0x1abcff[_0xe9c2('0x2a')](_0x2c3bf4)[_0xe9c2('0x2b')]();};}function respondWithResult(_0x23fccf,_0x4b992f){_0x4b992f=_0x4b992f||0xc8;return function(_0x5c0e1){if(_0x5c0e1){return _0x23fccf[_0xe9c2('0x2a')](_0x4b992f)[_0xe9c2('0x2c')](_0x5c0e1);}};}function respondWithFilteredResult(_0x3e9287,_0x402dc3){return function(_0x40f328){if(_0x40f328){var _0x6b49d8=typeof _0x402dc3[_0xe9c2('0x2d')]===_0xe9c2('0x2e')&&typeof _0x402dc3[_0xe9c2('0x2f')]===_0xe9c2('0x2e');var _0x31e7a5=_0x40f328[_0xe9c2('0x30')];var _0x4632e9=_0x6b49d8?0x0:_0x402dc3['offset'];var _0x665c6e=_0x6b49d8?_0x40f328[_0xe9c2('0x30')]:_0x402dc3[_0xe9c2('0x2d')]+_0x402dc3[_0xe9c2('0x2f')];var _0x49cfd3;if(_0x665c6e>=_0x31e7a5){_0x665c6e=_0x31e7a5;_0x49cfd3=0xc8;}else{_0x49cfd3=0xce;}_0x3e9287[_0xe9c2('0x2a')](_0x49cfd3);return _0x3e9287[_0xe9c2('0x31')](_0xe9c2('0x32'),_0x4632e9+'-'+_0x665c6e+'/'+_0x31e7a5)[_0xe9c2('0x2c')](_0x40f328);}return null;};}function patchUpdates(_0x2559d9){return function(_0x437ddb){try{jsonpatch[_0xe9c2('0x33')](_0x437ddb,_0x2559d9,!![]);}catch(_0x439626){return BPromise['reject'](_0x439626);}return _0x437ddb[_0xe9c2('0x34')]();};}function saveUpdates(_0x19b279,_0x274d57){return function(_0x34a890){if(_0x34a890){return _0x34a890['update'](_0x19b279)[_0xe9c2('0x35')](function(_0x35c0fc){return _0x35c0fc;});}return null;};}function removeEntity(_0x3acf3a,_0x36cc3b){return function(_0x376bc1){if(_0x376bc1){return _0x376bc1['destroy']()[_0xe9c2('0x35')](function(){_0x3acf3a[_0xe9c2('0x2a')](0xcc)[_0xe9c2('0x2b')]();});}};}function handleEntityNotFound(_0xe71bfe,_0x250574){return function(_0x3fd145){if(!_0x3fd145){_0xe71bfe[_0xe9c2('0x29')](0x194);}return _0x3fd145;};}function handleError(_0x2bbc79,_0x427748){_0x427748=_0x427748||0x1f4;return function(_0x351a82){logger[_0xe9c2('0x26')](_0x351a82[_0xe9c2('0x36')]);if(_0x351a82['name']){delete _0x351a82[_0xe9c2('0x37')];}_0x2bbc79['status'](_0x427748)[_0xe9c2('0x38')](_0x351a82);};}exports[_0xe9c2('0x39')]=function(_0x5bb081,_0x38041f){var _0x17ab53={},_0x530dea={},_0x195598={'count':0x0,'rows':[]};var _0x191509=_[_0xe9c2('0x3a')](db['ChatMessage']['rawAttributes'],function(_0x1eebba){return{'name':_0x1eebba[_0xe9c2('0x3b')],'type':_0x1eebba['type']['key']};});_0x530dea[_0xe9c2('0x3c')]=_[_0xe9c2('0x3a')](_0x191509,'name');_0x530dea[_0xe9c2('0x3d')]=_['keys'](_0x5bb081['query']);_0x530dea[_0xe9c2('0x3e')]=_['intersection'](_0x530dea['model'],_0x530dea[_0xe9c2('0x3d')]);_0x17ab53['attributes']=_['intersection'](_0x530dea['model'],qs[_0xe9c2('0x3f')](_0x5bb081['query']['fields']));_0x17ab53[_0xe9c2('0x40')]=_0x17ab53[_0xe9c2('0x40')][_0xe9c2('0x41')]?_0x17ab53[_0xe9c2('0x40')]:_0x530dea['model'];if(!_0x5bb081[_0xe9c2('0x3d')][_0xe9c2('0x42')](_0xe9c2('0x43'))){_0x17ab53[_0xe9c2('0x2f')]=qs['limit'](_0x5bb081['query']['limit']);_0x17ab53[_0xe9c2('0x2d')]=qs[_0xe9c2('0x2d')](_0x5bb081[_0xe9c2('0x3d')][_0xe9c2('0x2d')]);}_0x17ab53[_0xe9c2('0x44')]=qs['sort'](_0x5bb081[_0xe9c2('0x3d')][_0xe9c2('0x45')]);_0x17ab53['where']=qs['filters'](_[_0xe9c2('0x46')](_0x5bb081['query'],_0x530dea[_0xe9c2('0x3e')]),_0x191509);if(_0x5bb081['query'][_0xe9c2('0x47')]){_0x17ab53[_0xe9c2('0x48')]=_[_0xe9c2('0x49')](_0x17ab53[_0xe9c2('0x48')],{'$or':_['map'](_0x191509,function(_0x11b9cc){if(_0x11b9cc[_0xe9c2('0x4a')]!=='VIRTUAL'){var _0x252c93={};_0x252c93[_0x11b9cc[_0xe9c2('0x37')]]={'$like':'%'+_0x5bb081[_0xe9c2('0x3d')][_0xe9c2('0x47')]+'%'};return _0x252c93;}})});}_0x17ab53=_['merge']({},_0x17ab53,_0x5bb081[_0xe9c2('0x4b')]);var _0x526fe3={'where':_0x17ab53[_0xe9c2('0x48')]};return db[_0xe9c2('0x4c')][_0xe9c2('0x30')](_0x526fe3)['then'](function(_0x5e24fc){_0x195598[_0xe9c2('0x30')]=_0x5e24fc;if(_0x5bb081[_0xe9c2('0x3d')][_0xe9c2('0x4d')]){_0x17ab53['include']=[{'all':!![]}];}return db[_0xe9c2('0x4c')]['findAll'](_0x17ab53);})['then'](function(_0xad4397){_0x195598[_0xe9c2('0x4e')]=_0xad4397;return _0x195598;})[_0xe9c2('0x35')](respondWithFilteredResult(_0x38041f,_0x17ab53))[_0xe9c2('0x28')](handleError(_0x38041f,null));};exports[_0xe9c2('0x4f')]=function(_0x22d382,_0xece3d3){var _0x47dfc1={'raw':!![],'where':{'id':_0x22d382['params']['id']}},_0x5d75f1={};_0x5d75f1[_0xe9c2('0x3c')]=_['keys'](db[_0xe9c2('0x4c')]['rawAttributes']);_0x5d75f1[_0xe9c2('0x3d')]=_[_0xe9c2('0x50')](_0x22d382[_0xe9c2('0x3d')]);_0x5d75f1['filters']=_[_0xe9c2('0x51')](_0x5d75f1[_0xe9c2('0x3c')],_0x5d75f1[_0xe9c2('0x3d')]);_0x47dfc1[_0xe9c2('0x40')]=_[_0xe9c2('0x51')](_0x5d75f1[_0xe9c2('0x3c')],qs[_0xe9c2('0x3f')](_0x22d382['query']['fields']));_0x47dfc1[_0xe9c2('0x40')]=_0x47dfc1['attributes'][_0xe9c2('0x41')]?_0x47dfc1[_0xe9c2('0x40')]:_0x5d75f1[_0xe9c2('0x3c')];if(_0x22d382[_0xe9c2('0x3d')]['includeAll']){_0x47dfc1[_0xe9c2('0x52')]=[{'all':!![]}];}_0x47dfc1=_[_0xe9c2('0x49')]({},_0x47dfc1,_0x22d382[_0xe9c2('0x4b')]);return db['ChatMessage'][_0xe9c2('0x53')](_0x47dfc1)[_0xe9c2('0x35')](handleEntityNotFound(_0xece3d3,null))[_0xe9c2('0x35')](respondWithResult(_0xece3d3,null))[_0xe9c2('0x28')](handleError(_0xece3d3,null));};exports[_0xe9c2('0x54')]=function(_0x454c4e,_0x372b1a){return db[_0xe9c2('0x4c')]['create'](_0x454c4e[_0xe9c2('0x55')],{})[_0xe9c2('0x35')](respondWithResult(_0x372b1a,0xc9))[_0xe9c2('0x28')](handleError(_0x372b1a,null));};exports[_0xe9c2('0x56')]=function(_0x28400c,_0x3cfec4){if(_0x28400c[_0xe9c2('0x55')]['id']){delete _0x28400c[_0xe9c2('0x55')]['id'];}return db[_0xe9c2('0x4c')][_0xe9c2('0x53')]({'where':{'id':_0x28400c[_0xe9c2('0x57')]['id']}})[_0xe9c2('0x35')](handleEntityNotFound(_0x3cfec4,null))[_0xe9c2('0x35')](saveUpdates(_0x28400c[_0xe9c2('0x55')],null))[_0xe9c2('0x35')](respondWithResult(_0x3cfec4,null))[_0xe9c2('0x28')](handleError(_0x3cfec4,null));};exports[_0xe9c2('0x58')]=function(_0x30704f,_0x275ee7){return db[_0xe9c2('0x4c')][_0xe9c2('0x53')]({'where':{'id':_0x30704f[_0xe9c2('0x57')]['id']}})[_0xe9c2('0x35')](handleEntityNotFound(_0x275ee7,null))['then'](removeEntity(_0x275ee7,null))[_0xe9c2('0x28')](handleError(_0x275ee7,null));};exports['describe']=function(_0x397c4c,_0x35eb26){return db['ChatMessage']['describe']()[_0xe9c2('0x35')](respondWithResult(_0x35eb26,null))[_0xe9c2('0x28')](handleError(_0x35eb26,null));};var interaction_log=require(_0xe9c2('0x15'))(_0xe9c2('0x59'));exports[_0xe9c2('0x5a')]=function(_0x2cc084,_0x2ae29a,_0x4d77bf){var _0x2a7ff4={'agent':{},'channel':_0xe9c2('0x5b')};if(_0x2cc084['body']['id']){delete _0x2cc084['body']['id'];}_0x2cc084['body'][_0xe9c2('0x5c')]=!![];_0x2cc084['body'][_0xe9c2('0x5d')]=moment()[_0xe9c2('0x5e')](_0xe9c2('0x5f'));_0x2cc084[_0xe9c2('0x55')][_0xe9c2('0x60')]=_0x2cc084[_0xe9c2('0x55')][_0xe9c2('0x60')]||_0x2cc084[_0xe9c2('0x61')]['id'];_0x2a7ff4[_0xe9c2('0x62')]['id']=_0x2cc084['body'][_0xe9c2('0x60')];return db['ChatMessage'][_0xe9c2('0x53')]({'where':{'id':_0x2cc084[_0xe9c2('0x57')]['id'],'UserId':null}})[_0xe9c2('0x35')](handleEntityNotFound(_0x2ae29a,null))[_0xe9c2('0x35')](saveUpdates(_0x2cc084[_0xe9c2('0x55')],null))['then'](function(_0x280870){if(_0x280870){_0x2a7ff4[_0xe9c2('0x27')]=_0x280870[_0xe9c2('0x63')]({'plain':!![]});return db[_0xe9c2('0x64')][_0xe9c2('0x53')]({'where':{'id':_0x280870['ChatInteractionId']}});}return null;})[_0xe9c2('0x35')](handleEntityNotFound(_0x2ae29a,null))[_0xe9c2('0x35')](function(_0x428f35){if(_0x428f35){return _0x428f35['update']({'UserId':_0x2cc084[_0xe9c2('0x55')][_0xe9c2('0x60')],'read1stAt':_[_0xe9c2('0x65')](_0x428f35[_0xe9c2('0x66')])?moment()[_0xe9c2('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe9c2('0x35')](function(_0x395b2c){if(_0x395b2c){_0x2a7ff4['interaction']=_0x395b2c[_0xe9c2('0x63')]({'plain':!![]});interaction_log['info'](_0xe9c2('0x67'),_0x2cc084[_0xe9c2('0x61')]['id'],_0x2cc084[_0xe9c2('0x61')][_0xe9c2('0x37')],_0x2cc084['user']['role'],_0x2a7ff4['interaction']['id'],_0x2cc084['body']?JSON[_0xe9c2('0x25')](_0x2cc084[_0xe9c2('0x55')]):_0xe9c2('0x68'));return respondWithRpcPromise(_0xe9c2('0x69'),_0xe9c2('0x6a'),_0x2a7ff4);}return null;})[_0xe9c2('0x35')](function(_0x5b0ff3){var _0x3cb6d3=_0xe9c2('0x6b')+_0x5b0ff3[_0xe9c2('0x27')][_0xe9c2('0x6c')];return db[_0xe9c2('0x6d')][_0xe9c2('0x3d')](_0x3cb6d3,{'type':db['Sequelize'][_0xe9c2('0x6e')][_0xe9c2('0x6f')],'raw':!![]})['then'](function(_0x579061){return _0x579061;});})[_0xe9c2('0x35')](function(_0x53026a){if(_0x53026a){_0x2a7ff4[_0xe9c2('0x27')][_0xe9c2('0x70')]=_0x53026a[0x0];if(!_0x2cc084[_0xe9c2('0x55')][_0xe9c2('0x60')])return;return db['User'][_0xe9c2('0x53')]({'where':{'id':_0x2cc084[_0xe9c2('0x55')][_0xe9c2('0x60')],'role':_0xe9c2('0x62')},'attributes':['id',_0xe9c2('0x37'),'fullname',_0xe9c2('0x71'),_0xe9c2('0x72')],'raw':!![]});}return null;})['then'](function(_0x3e448e){if(!_0x3e448e)return null;_0x2a7ff4['message'][_0xe9c2('0x62')]=_0x3e448e;return _0x2a7ff4;})[_0xe9c2('0x35')](function(_0xaf2def){if(_0xaf2def){if(_0x2cc084[_0xe9c2('0x55')][_0xe9c2('0x73')]){_0x2a7ff4[_0xe9c2('0x27')][_0xe9c2('0x74')]=util[_0xe9c2('0x5e')](_0xe9c2('0x75'),_0x2cc084[_0xe9c2('0x61')]['name']);_0x2a7ff4[_0xe9c2('0x27')][_0xe9c2('0x76')]=_0x2a7ff4[_0xe9c2('0x76')];_0x2a7ff4['message'][_0xe9c2('0x77')]=_0x2a7ff4[_0xe9c2('0x76')];_0x2a7ff4[_0xe9c2('0x27')][_0xe9c2('0x78')]=_0xe9c2('0x5a');return respondWithRpcPromise('EventManager',_0xe9c2('0x79'),{'event':'acceptmessage','message':_[_0xe9c2('0x49')](_0x2a7ff4[_0xe9c2('0x27')],JSON['parse'](_0x2a7ff4[_0xe9c2('0x7a')][_0xe9c2('0x7b')]))},client9002)[_0xe9c2('0x35')](function(){return _0x2a7ff4;});}return _0x2a7ff4;}return null;})[_0xe9c2('0x35')](respondWithResult(_0x2ae29a,null))[_0xe9c2('0x28')](handleError(_0x2ae29a,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xe9c2('0x7c')]=function(_0x121fbc,_0xe74144,_0x2e8206){var _0x571441={'agent':{},'channel':_0xe9c2('0x5b')};if(_0x121fbc[_0xe9c2('0x55')]['id']){delete _0x121fbc[_0xe9c2('0x55')]['id'];}_0x121fbc[_0xe9c2('0x55')][_0xe9c2('0x60')]=_0x121fbc['body']['UserId']||_0x121fbc[_0xe9c2('0x61')]['id'];_0x571441[_0xe9c2('0x62')]['id']=_0x121fbc['body'][_0xe9c2('0x60')];return db[_0xe9c2('0x4c')][_0xe9c2('0x53')]({'where':{'id':_0x121fbc[_0xe9c2('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xe74144,null))[_0xe9c2('0x35')](function(_0x114979){if(_0x114979){_0x571441[_0xe9c2('0x27')]=_0x114979[_0xe9c2('0x63')]({'plain':!![]});return db[_0xe9c2('0x64')]['find']({'where':{'id':_0x114979[_0xe9c2('0x7d')]}});}return null;})[_0xe9c2('0x35')](handleEntityNotFound(_0xe74144,null))[_0xe9c2('0x35')](function(_0x190d98){if(_0x190d98){_0x571441[_0xe9c2('0x7a')]=_0x190d98[_0xe9c2('0x63')]({'plain':!![]});interaction_log[_0xe9c2('0x22')](_0xe9c2('0x7e'),_0x121fbc[_0xe9c2('0x61')]['id'],_0x121fbc[_0xe9c2('0x61')]['name'],_0x121fbc[_0xe9c2('0x61')][_0xe9c2('0x7f')],_0x571441['interaction']['id'],_0x121fbc[_0xe9c2('0x55')]?JSON['stringify'](_0x121fbc['body']):_0xe9c2('0x68'));return respondWithRpcPromise(_0xe9c2('0x80'),_0xe9c2('0x81'),_0x571441);}return null;})[_0xe9c2('0x35')](function(_0x3d8ef2){var _0xb6b9e5=_0xe9c2('0x6b')+_0x3d8ef2[_0xe9c2('0x27')]['ContactId'];return db['sequelize'][_0xe9c2('0x3d')](_0xb6b9e5,{'type':db['Sequelize'][_0xe9c2('0x6e')][_0xe9c2('0x6f')],'raw':!![]})[_0xe9c2('0x35')](function(_0x36341b){return _0x36341b;});})[_0xe9c2('0x35')](function(_0x46dc6b){if(_0x46dc6b){_0x571441['message'][_0xe9c2('0x70')]=_0x46dc6b[0x0];if(!_0x121fbc[_0xe9c2('0x55')][_0xe9c2('0x60')])return;return db[_0xe9c2('0x82')][_0xe9c2('0x53')]({'where':{'id':_0x121fbc[_0xe9c2('0x55')][_0xe9c2('0x60')],'role':_0xe9c2('0x62')},'attributes':['id',_0xe9c2('0x37'),_0xe9c2('0x83'),_0xe9c2('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x20dea9){if(!_0x20dea9)return null;_0x571441[_0xe9c2('0x27')][_0xe9c2('0x62')]=_0x20dea9;return _0x571441;})[_0xe9c2('0x35')](function(_0x44d21e){if(_0x44d21e){_0x44d21e['message']['interface']=util[_0xe9c2('0x5e')](_0xe9c2('0x75'),_0x121fbc[_0xe9c2('0x61')]['name']);_0x44d21e[_0xe9c2('0x27')][_0xe9c2('0x76')]=_0x571441['channel'];_0x44d21e[_0xe9c2('0x27')][_0xe9c2('0x77')]=_0x571441[_0xe9c2('0x76')];_0x44d21e[_0xe9c2('0x27')][_0xe9c2('0x78')]=_0xe9c2('0x7c');respondWithRpcPromise(_0xe9c2('0x79'),_0xe9c2('0x79'),{'event':_0xe9c2('0x84'),'message':_[_0xe9c2('0x49')](_0x571441[_0xe9c2('0x27')],JSON[_0xe9c2('0x85')](_0x571441['interaction'][_0xe9c2('0x7b')]))},client9002);return _0x571441;}return null;})[_0xe9c2('0x35')](respondWithResult(_0xe74144,null))[_0xe9c2('0x28')](handleError(_0xe74144,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5c838b0..8aee763 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 _0x83aa=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x57a2be,_0x2900b6){var _0x7f99d3=function(_0x1732b4){while(--_0x1732b4){_0x57a2be['push'](_0x57a2be['shift']());}};_0x7f99d3(++_0x2900b6);}(_0x83aa,0xb3));var _0xa83a=function(_0x5ade89,_0x2a90b0){_0x5ade89=_0x5ade89-0x0;var _0x272f1f=_0x83aa[_0x5ade89];return _0x272f1f;};'use strict';var EventEmitter=require(_0xa83a('0x0'));var ChatMessage=require(_0xa83a('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa83a('0x2')](0x0);var events={'afterCreate':_0xa83a('0x3'),'afterUpdate':_0xa83a('0x4'),'afterDestroy':_0xa83a('0x5')};function emitEvent(_0x2a6180){return function(_0x2e0ddd,_0x2c72fe,_0xce83d9){ChatMessageEvents['emit'](_0x2a6180+':'+_0x2e0ddd['id'],_0x2e0ddd);ChatMessageEvents[_0xa83a('0x6')](_0x2a6180,_0x2e0ddd);_0xce83d9(null);};}for(var e in events){if(events[_0xa83a('0x7')](e)){var event=events[e];ChatMessage[_0xa83a('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xdbf3=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x1c31fa,_0x2925cb){var _0xdf751=function(_0x51b6c9){while(--_0x51b6c9){_0x1c31fa['push'](_0x1c31fa['shift']());}};_0xdf751(++_0x2925cb);}(_0xdbf3,0x164));var _0x3dbf=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xdbf3[_0x1a36a5];return _0x746243;};'use strict';var EventEmitter=require(_0x3dbf('0x0'));var ChatMessage=require(_0x3dbf('0x1'))['db'][_0x3dbf('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3dbf('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dbf('0x4'),'afterDestroy':_0x3dbf('0x5')};function emitEvent(_0x1aeb40){return function(_0x5afe69,_0x5466a3,_0x6c050a){ChatMessageEvents[_0x3dbf('0x6')](_0x1aeb40+':'+_0x5afe69['id'],_0x5afe69);ChatMessageEvents['emit'](_0x1aeb40,_0x5afe69);_0x6c050a(null);};}for(var e in events){if(events[_0x3dbf('0x7')](e)){var event=events[e];ChatMessage[_0x3dbf('0x8')](e,emitEvent(event));}}module[_0x3dbf('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 593a053..a7f6424 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 _0xe131=['chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','ChatInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0xe131,0x1b5));var _0x1e13=function(_0x496763,_0x43c2e1){_0x496763=_0x496763-0x0;var _0x19b652=_0xe131[_0x496763];return _0x19b652;};'use strict';var _=require(_0x1e13('0x0'));var util=require(_0x1e13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1e13('0x2'));var BPromise=require('bluebird');var rp=require(_0x1e13('0x3'));var fs=require('fs');var path=require(_0x1e13('0x4'));var rimraf=require(_0x1e13('0x5'));var config=require(_0x1e13('0x6'));var attributes=require(_0x1e13('0x7'));module[_0x1e13('0x8')]=function(_0x440239,_0x3ec2e6){return _0x440239[_0x1e13('0x9')](_0x1e13('0xa'),attributes,{'tableName':_0x1e13('0xb'),'paranoid':![],'indexes':[{'name':_0x1e13('0xc'),'fields':[_0x1e13('0xd')],'type':_0x1e13('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1569f3,_0x528329,_0x1012f4){var _0x39e8f1=_0x440239['models'];var _0x523f28=_0x1569f3[_0x1e13('0xf')]({'plain':!![]});if(_0x523f28[_0x1e13('0x10')][_0x1e13('0x11')]()==='in'||_0x523f28['direction'][_0x1e13('0x11')]()==='out'&&!_0x523f28[_0x1e13('0x12')]&&!_[_0x1e13('0x13')](_0x523f28['UserId'])){_0x39e8f1[_0x1e13('0x14')][_0x1e13('0x15')]({'where':{'id':_0x523f28['ChatInteractionId']}})[_0x1e13('0x16')](function(_0x2cc3d0){if(_0x2cc3d0){_0x2cc3d0[_0x1e13('0x17')]({'lastMsgAt':_0x523f28['createdAt'],'lastMsgDirection':_0x523f28[_0x1e13('0x10')][_0x1e13('0x11')]()});}})[_0x1e13('0x18')](function(_0x164aa8){console[_0x1e13('0x19')](_0x164aa8);});}_0x1012f4();}},'charset':_0x1e13('0x1a'),'collate':_0x1e13('0x1b')});}; \ No newline at end of file +var _0x0896=['define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x24d06a,_0x59c850){var _0x4a987d=function(_0x3bd772){while(--_0x3bd772){_0x24d06a['push'](_0x24d06a['shift']());}};_0x4a987d(++_0x59c850);}(_0x0896,0xfb));var _0x6089=function(_0x1397bf,_0x33b141){_0x1397bf=_0x1397bf-0x0;var _0x30c835=_0x0896[_0x1397bf];return _0x30c835;};'use strict';var _=require(_0x6089('0x0'));var util=require(_0x6089('0x1'));var logger=require(_0x6089('0x2'))('api');var moment=require(_0x6089('0x3'));var BPromise=require(_0x6089('0x4'));var rp=require(_0x6089('0x5'));var fs=require('fs');var path=require(_0x6089('0x6'));var rimraf=require(_0x6089('0x7'));var config=require(_0x6089('0x8'));var attributes=require('./chatMessage.attributes');module[_0x6089('0x9')]=function(_0x4f195e,_0x5080a3){return _0x4f195e[_0x6089('0xa')](_0x6089('0xb'),attributes,{'tableName':_0x6089('0xc'),'paranoid':![],'indexes':[{'name':_0x6089('0xd'),'fields':[_0x6089('0xe')],'type':_0x6089('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a7673,_0x5769d8,_0x141d67){var _0xe2337b=_0x4f195e[_0x6089('0x10')];var _0x18a6de=_0x2a7673['get']({'plain':!![]});if(_0x18a6de[_0x6089('0x11')][_0x6089('0x12')]()==='in'||_0x18a6de['direction'][_0x6089('0x12')]()==='out'&&!_0x18a6de[_0x6089('0x13')]&&!_[_0x6089('0x14')](_0x18a6de['UserId'])){_0xe2337b[_0x6089('0x15')][_0x6089('0x16')]({'where':{'id':_0x18a6de[_0x6089('0x17')]}})[_0x6089('0x18')](function(_0x3f5623){if(_0x3f5623){_0x3f5623['update']({'lastMsgAt':_0x18a6de[_0x6089('0x19')],'lastMsgDirection':_0x18a6de[_0x6089('0x11')][_0x6089('0x12')]()});}})[_0x6089('0x1a')](function(_0x9e2d98){console[_0x6089('0x1b')](_0x9e2d98);});}_0x141d67();}},'charset':_0x6089('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 68b44e4..ea92f29 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 _0xe0b0=['localhost','socket.io-emitter','redis','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','then','CreateChatMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x5a4bf4,_0x574d36){var _0x4187e8=function(_0x4532b4){while(--_0x4532b4){_0x5a4bf4['push'](_0x5a4bf4['shift']());}};_0x4187e8(++_0x574d36);}(_0xe0b0,0x70));var _0x0e0b=function(_0x5bc683,_0x23fab6){_0x5bc683=_0x5bc683-0x0;var _0x10b119=_0xe0b0[_0x5bc683];return _0x10b119;};'use strict';var _=require(_0x0e0b('0x0'));var util=require(_0x0e0b('0x1'));var moment=require(_0x0e0b('0x2'));var BPromise=require(_0x0e0b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e0b('0x4'));var db=require(_0x0e0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0e0b('0x6'));var config=require(_0x0e0b('0x7'));var jayson=require(_0x0e0b('0x8'));var client=jayson[_0x0e0b('0x9')][_0x0e0b('0xa')]({'port':0x232a});config['redis']=_[_0x0e0b('0xb')](config['redis'],{'host':_0x0e0b('0xc'),'port':0x18eb});var socket=require(_0x0e0b('0xd'))(new Redis(config[_0x0e0b('0xe')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2fcc75,_0x3d7e51,_0x41f7fa){return new BPromise(function(_0x330756,_0x4d2157){return client['request'](_0x2fcc75,_0x41f7fa)['then'](function(_0x18019a){logger[_0x0e0b('0xf')](_0x0e0b('0x10'),_0x3d7e51,_0x0e0b('0x11'));logger['debug'](_0x0e0b('0x12'),_0x3d7e51,_0x0e0b('0x11'),JSON[_0x0e0b('0x13')](_0x18019a));if(_0x18019a[_0x0e0b('0x14')]){if(_0x18019a[_0x0e0b('0x14')][_0x0e0b('0x15')]===0x1f4){logger[_0x0e0b('0x14')]('ChatMessage,\x20%s,\x20%s',_0x3d7e51,_0x18019a['error'][_0x0e0b('0x16')]);return _0x4d2157(_0x18019a[_0x0e0b('0x14')][_0x0e0b('0x16')]);}logger[_0x0e0b('0x14')](_0x0e0b('0x10'),_0x3d7e51,_0x18019a['error']['message']);return _0x330756(_0x18019a[_0x0e0b('0x14')]['message']);}else{logger[_0x0e0b('0xf')](_0x0e0b('0x10'),_0x3d7e51,_0x0e0b('0x11'));_0x330756(_0x18019a[_0x0e0b('0x17')][_0x0e0b('0x16')]);}})[_0x0e0b('0x18')](function(_0x3f665b){logger[_0x0e0b('0x14')]('ChatMessage,\x20%s,\x20%s',_0x3d7e51,_0x3f665b);_0x4d2157(_0x3f665b);});});}exports['CreateChatMessage']=function(_0x28747a){var _0x435951=this;return new Promise(function(_0x2a3d0b,_0x3d7341){return db['ChatMessage'][_0x0e0b('0x19')](_0x28747a[_0x0e0b('0x1a')],{'raw':_0x28747a[_0x0e0b('0x1b')]?_0x28747a[_0x0e0b('0x1b')][_0x0e0b('0x1c')]===undefined?!![]:![]:!![]})[_0x0e0b('0x1d')](function(_0x9adbce){logger[_0x0e0b('0xf')](_0x0e0b('0x1e'),_0x28747a);logger['debug'](_0x0e0b('0x1e'),_0x28747a,JSON['stringify'](_0x9adbce));_0x2a3d0b(_0x9adbce);})[_0x0e0b('0x18')](function(_0x2171a6){logger[_0x0e0b('0x14')](_0x0e0b('0x1e'),_0x2171a6['message'],_0x28747a);_0x3d7341(_0x435951[_0x0e0b('0x14')](0x1f4,_0x2171a6[_0x0e0b('0x16')]));});});}; \ No newline at end of file +var _0xa174=['info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','register','request','then'];(function(_0x3e8c65,_0x3b1527){var _0xdec56c=function(_0x5d526b){while(--_0x5d526b){_0x3e8c65['push'](_0x3e8c65['shift']());}};_0xdec56c(++_0x3b1527);}(_0xa174,0x1df));var _0x4a17=function(_0x16b12d,_0x59fb4e){_0x16b12d=_0x16b12d-0x0;var _0xcb647f=_0xa174[_0x16b12d];return _0xcb647f;};'use strict';var _=require('lodash');var util=require(_0x4a17('0x0'));var moment=require(_0x4a17('0x1'));var BPromise=require(_0x4a17('0x2'));var rs=require(_0x4a17('0x3'));var fs=require('fs');var Redis=require(_0x4a17('0x4'));var db=require(_0x4a17('0x5'))['db'];var utils=require(_0x4a17('0x6'));var logger=require(_0x4a17('0x7'))('rpc');var config=require(_0x4a17('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a17('0x9')][_0x4a17('0xa')]({'port':0x232a});config['redis']=_[_0x4a17('0xb')](config[_0x4a17('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a17('0xc')]));require('./chatMessage.socket')[_0x4a17('0xd')](socket);function respondWithRpcPromise(_0x36f7c4,_0x256060,_0x571f01){return new BPromise(function(_0x7cd21b,_0x13a475){return client[_0x4a17('0xe')](_0x36f7c4,_0x571f01)[_0x4a17('0xf')](function(_0x49ce3d){logger[_0x4a17('0x10')]('ChatMessage,\x20%s,\x20%s',_0x256060,'request\x20sent');logger[_0x4a17('0x11')](_0x4a17('0x12'),_0x256060,_0x4a17('0x13'),JSON[_0x4a17('0x14')](_0x49ce3d));if(_0x49ce3d['error']){if(_0x49ce3d[_0x4a17('0x15')][_0x4a17('0x16')]===0x1f4){logger['error'](_0x4a17('0x17'),_0x256060,_0x49ce3d[_0x4a17('0x15')][_0x4a17('0x18')]);return _0x13a475(_0x49ce3d['error'][_0x4a17('0x18')]);}logger[_0x4a17('0x15')](_0x4a17('0x17'),_0x256060,_0x49ce3d['error'][_0x4a17('0x18')]);return _0x7cd21b(_0x49ce3d[_0x4a17('0x15')][_0x4a17('0x18')]);}else{logger[_0x4a17('0x10')]('ChatMessage,\x20%s,\x20%s',_0x256060,_0x4a17('0x13'));_0x7cd21b(_0x49ce3d[_0x4a17('0x19')][_0x4a17('0x18')]);}})[_0x4a17('0x1a')](function(_0x1e8902){logger[_0x4a17('0x15')](_0x4a17('0x17'),_0x256060,_0x1e8902);_0x13a475(_0x1e8902);});});}exports[_0x4a17('0x1b')]=function(_0xbc91d5){var _0x2a5be4=this;return new Promise(function(_0xcc16d4,_0x333e11){return db[_0x4a17('0x1c')][_0x4a17('0x1d')](_0xbc91d5[_0x4a17('0x1e')],{'raw':_0xbc91d5[_0x4a17('0x1f')]?_0xbc91d5[_0x4a17('0x1f')][_0x4a17('0x20')]===undefined?!![]:![]:!![]})[_0x4a17('0xf')](function(_0x137555){logger[_0x4a17('0x10')](_0x4a17('0x1b'),_0xbc91d5);logger[_0x4a17('0x11')](_0x4a17('0x1b'),_0xbc91d5,JSON[_0x4a17('0x14')](_0x137555));_0xcc16d4(_0x137555);})[_0x4a17('0x1a')](function(_0x5bc64e){logger[_0x4a17('0x15')](_0x4a17('0x1b'),_0x5bc64e[_0x4a17('0x18')],_0xbc91d5);_0x333e11(_0x2a5be4[_0x4a17('0x15')](0x1f4,_0x5bc64e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 10f51e1..6d9814e 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 _0x2e88=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x4de2c5,_0x21aeb7){var _0x4ef52b=function(_0x5e52f4){while(--_0x5e52f4){_0x4de2c5['push'](_0x4de2c5['shift']());}};_0x4ef52b(++_0x21aeb7);}(_0x2e88,0x95));var _0x82e8=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0x2e88[_0x5948dd];return _0xb1f8be;};'use strict';var ChatMessageEvents=require(_0x82e8('0x0'));var events=[_0x82e8('0x1'),_0x82e8('0x2'),_0x82e8('0x3')];function createListener(_0x9dd860,_0x46c27f){return function(_0x552153){_0x46c27f[_0x82e8('0x4')](_0x9dd860,_0x552153);};}function removeListener(_0x1d7415,_0x576435){return function(){ChatMessageEvents[_0x82e8('0x5')](_0x1d7415,_0x576435);};}exports[_0x82e8('0x6')]=function(_0x4e909a){for(var _0x3162d1=0x0,_0x1e2496=events[_0x82e8('0x7')];_0x3162d1<_0x1e2496;_0x3162d1++){var _0x27df44=events[_0x3162d1];var _0x393c2c=createListener(_0x82e8('0x8')+_0x27df44,_0x4e909a);ChatMessageEvents['on'](_0x27df44,_0x393c2c);}}; \ No newline at end of file +var _0x7118=['length','chatMessage:','remove','update','emit','removeListener','register'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x7118,0x159));var _0x8711=function(_0x25fbe4,_0xdcd3e7){_0x25fbe4=_0x25fbe4-0x0;var _0x39595f=_0x7118[_0x25fbe4];return _0x39595f;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x8711('0x0'),_0x8711('0x1')];function createListener(_0x5c64d4,_0x1758c5){return function(_0x3ea36f){_0x1758c5[_0x8711('0x2')](_0x5c64d4,_0x3ea36f);};}function removeListener(_0x259c36,_0x12496b){return function(){ChatMessageEvents[_0x8711('0x3')](_0x259c36,_0x12496b);};}exports[_0x8711('0x4')]=function(_0x54885e){for(var _0x385033=0x0,_0x2244c2=events[_0x8711('0x5')];_0x385033<_0x2244c2;_0x385033++){var _0x3d82f2=events[_0x385033];var _0x189349=createListener(_0x8711('0x6')+_0x3d82f2,_0x54885e);ChatMessageEvents['on'](_0x3d82f2,_0x189349);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0324787..820ef10 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 _0x88ae=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','chat','chatmessage:create','put','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x27ba9c,_0x27a4b3){var _0xca605c=function(_0xb172bd){while(--_0xb172bd){_0x27ba9c['push'](_0x27ba9c['shift']());}};_0xca605c(++_0x27a4b3);}(_0x88ae,0xe5));var _0xe88a=function(_0x287cac,_0xb41eef){_0x287cac=_0x287cac-0x0;var _0x3dcd41=_0x88ae[_0x287cac];return _0x3dcd41;};'use strict';var multer=require('multer');var util=require(_0xe88a('0x0'));var path=require(_0xe88a('0x1'));var timeout=require(_0xe88a('0x2'));var express=require(_0xe88a('0x3'));var router=express['Router']();var fs_extra=require(_0xe88a('0x4'));var auth=require(_0xe88a('0x5'));var interaction=require(_0xe88a('0x6'));var config=require(_0xe88a('0x7'));var controller=require(_0xe88a('0x8'));router['get']('/',auth[_0xe88a('0x9')](),controller[_0xe88a('0xa')]);router[_0xe88a('0xb')](_0xe88a('0xc'),auth[_0xe88a('0x9')](),controller[_0xe88a('0xd')]);router['get'](_0xe88a('0xe'),auth['isAuthenticated'](),controller[_0xe88a('0xf')]);router[_0xe88a('0x10')]('/',auth[_0xe88a('0x9')](),interaction['tracked'](_0xe88a('0x11'),_0xe88a('0x12')),controller['create']);router[_0xe88a('0x13')](_0xe88a('0xe'),controller['update']);router[_0xe88a('0x13')]('/:id/accept',auth[_0xe88a('0x9')](),controller[_0xe88a('0x14')]);router['put'](_0xe88a('0x15'),auth[_0xe88a('0x9')](),controller[_0xe88a('0x16')]);router[_0xe88a('0x17')](_0xe88a('0xe'),auth['isAuthenticated'](),controller[_0xe88a('0x18')]);module[_0xe88a('0x19')]=router; \ No newline at end of file +var _0x7112=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','show','post','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer'];(function(_0x26a51d,_0x5aaa3a){var _0x1d8bef=function(_0x3335dd){while(--_0x3335dd){_0x26a51d['push'](_0x26a51d['shift']());}};_0x1d8bef(++_0x5aaa3a);}(_0x7112,0xa1));var _0x2711=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7112[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2711('0x0'));var util=require('util');var path=require(_0x2711('0x1'));var timeout=require(_0x2711('0x2'));var express=require(_0x2711('0x3'));var router=express['Router']();var fs_extra=require(_0x2711('0x4'));var auth=require(_0x2711('0x5'));var interaction=require(_0x2711('0x6'));var config=require(_0x2711('0x7'));var controller=require(_0x2711('0x8'));router[_0x2711('0x9')]('/',auth[_0x2711('0xa')](),controller[_0x2711('0xb')]);router[_0x2711('0x9')]('/describe',auth[_0x2711('0xa')](),controller[_0x2711('0xc')]);router['get']('/:id',auth[_0x2711('0xa')](),controller[_0x2711('0xd')]);router[_0x2711('0xe')]('/',auth['isAuthenticated'](),interaction['tracked']('chat',_0x2711('0xf')),controller[_0x2711('0x10')]);router[_0x2711('0x11')]('/:id',controller[_0x2711('0x12')]);router[_0x2711('0x11')](_0x2711('0x13'),auth[_0x2711('0xa')](),controller[_0x2711('0x14')]);router['put'](_0x2711('0x15'),auth[_0x2711('0xa')](),controller[_0x2711('0x16')]);router[_0x2711('0x17')](_0x2711('0x18'),auth[_0x2711('0xa')](),controller[_0x2711('0x19')]);module[_0x2711('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 7310dee..70e9ea5 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0x2b8fa9,_0x296276){var _0x2583db=function(_0x2270e4){while(--_0x2270e4){_0x2b8fa9['push'](_0x2b8fa9['shift']());}};_0x2583db(++_0x296276);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x4ea064,_0x105b04){var _0x15a832=function(_0x1c1055){while(--_0x1c1055){_0x4ea064['push'](_0x4ea064['shift']());}};_0x15a832(++_0x105b04);}(_0x2032,0xd9));var _0x2203=function(_0x395c96,_0x4fe05a){_0x395c96=_0x395c96-0x0;var _0xae83e9=_0x2032[_0x395c96];return _0xae83e9;};'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 deb6ef8..5e0e5fe 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 _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(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x7a54,0x106));var _0x47a5=function(_0x2cc64e,_0x9ba4ba){_0x2cc64e=_0x2cc64e-0x0;var _0x3e0080=_0x7a54[_0x2cc64e];return _0x3e0080;};'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 +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(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x7a54,0x106));var _0x47a5=function(_0x4af0cf,_0x4555cf){_0x4af0cf=_0x4af0cf-0x0;var _0x4ea99e=_0x7a54[_0x4af0cf];return _0x4ea99e;};'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 7d5de13..cbe308f 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 _0xe29d=['events','../../mysqldb','ChatOfflineMessage','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x283152,_0x468a35){var _0x6cb80d=function(_0x17598a){while(--_0x17598a){_0x283152['push'](_0x283152['shift']());}};_0x6cb80d(++_0x468a35);}(_0xe29d,0x1a7));var _0xde29=function(_0x256fb0,_0x3cb5ab){_0x256fb0=_0x256fb0-0x0;var _0x80bcdd=_0xe29d[_0x256fb0];return _0x80bcdd;};'use strict';var EventEmitter=require(_0xde29('0x0'));var ChatOfflineMessage=require(_0xde29('0x1'))['db'][_0xde29('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xde29('0x3'),'afterUpdate':'update','afterDestroy':_0xde29('0x4')};function emitEvent(_0x12cc24){return function(_0x40c756,_0x478b2a,_0xef43d5){ChatOfflineMessageEvents['emit'](_0x12cc24+':'+_0x40c756['id'],_0x40c756);ChatOfflineMessageEvents[_0xde29('0x5')](_0x12cc24,_0x40c756);_0xef43d5(null);};}for(var e in events){if(events[_0xde29('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xde29('0x7')](e,emitEvent(event));}}module[_0xde29('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xed17=['emit','hasOwnProperty','hook','events','ChatOfflineMessage','setMaxListeners','remove'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xed17,0x1d1));var _0x7ed1=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0xed17[_0x3de7e0];return _0x11d0b3;};'use strict';var EventEmitter=require(_0x7ed1('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x7ed1('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7ed1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7ed1('0x3')};function emitEvent(_0x21d076){return function(_0x370ca6,_0x4263b9,_0x2abca2){ChatOfflineMessageEvents[_0x7ed1('0x4')](_0x21d076+':'+_0x370ca6['id'],_0x370ca6);ChatOfflineMessageEvents[_0x7ed1('0x4')](_0x21d076,_0x370ca6);_0x2abca2(null);};}for(var e in events){if(events[_0x7ed1('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x7ed1('0x6')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2eac1a9..4f7de7c 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 _0xadd6=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x26cee6,_0x4794c6){var _0x54c1a1=function(_0x3ec1d9){while(--_0x3ec1d9){_0x26cee6['push'](_0x26cee6['shift']());}};_0x54c1a1(++_0x4794c6);}(_0xadd6,0xcf));var _0x6add=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xadd6[_0x1a0ef3];return _0x2b86da;};'use strict';var attributes=require(_0x6add('0x0'));module['exports']=function(_0x1c7655){return _0x1c7655['define'](_0x6add('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6add('0x2'),'collate':_0x6add('0x3')});}; \ No newline at end of file +var _0x9a6c=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x9a6c,0x12e));var _0xc9a6=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x9a6c[_0x53cf8e];return _0x459197;};'use strict';var attributes=require(_0xc9a6('0x0'));module[_0xc9a6('0x1')]=function(_0x4947b0){return _0x4947b0['define'](_0xc9a6('0x2'),attributes,{'tableName':_0xc9a6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc9a6('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index fa1595e..f7821dd 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 _0x6f0d=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x11cba0,_0x310f52){var _0xe00153=function(_0x589b86){while(--_0x589b86){_0x11cba0['push'](_0x11cba0['shift']());}};_0xe00153(++_0x310f52);}(_0x6f0d,0x1e5));var _0xd6f0=function(_0x560625,_0x7407e3){_0x560625=_0x560625-0x0;var _0x57db60=_0x6f0d[_0x560625];return _0x57db60;};'use strict';var _=require(_0xd6f0('0x0'));var util=require('util');var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require(_0xd6f0('0x4'));var db=require(_0xd6f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd6f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cf8b2,_0x2ba1b2,_0x289bc6){return new BPromise(function(_0x272022,_0x16f3c4){return client[_0xd6f0('0xa')](_0x1cf8b2,_0x289bc6)[_0xd6f0('0xb')](function(_0x4b8c2b){logger[_0xd6f0('0xc')](_0xd6f0('0xd'),_0x2ba1b2,_0xd6f0('0xe'));logger[_0xd6f0('0xf')](_0xd6f0('0x10'),_0x2ba1b2,'request\x20sent',JSON['stringify'](_0x4b8c2b));if(_0x4b8c2b[_0xd6f0('0x11')]){if(_0x4b8c2b['error'][_0xd6f0('0x12')]===0x1f4){logger[_0xd6f0('0x11')](_0xd6f0('0xd'),_0x2ba1b2,_0x4b8c2b[_0xd6f0('0x11')][_0xd6f0('0x13')]);return _0x16f3c4(_0x4b8c2b[_0xd6f0('0x11')][_0xd6f0('0x13')]);}logger[_0xd6f0('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2ba1b2,_0x4b8c2b[_0xd6f0('0x11')][_0xd6f0('0x13')]);return _0x272022(_0x4b8c2b['error'][_0xd6f0('0x13')]);}else{logger['info'](_0xd6f0('0xd'),_0x2ba1b2,_0xd6f0('0xe'));_0x272022(_0x4b8c2b['result'][_0xd6f0('0x13')]);}})[_0xd6f0('0x14')](function(_0x4b17c2){logger[_0xd6f0('0x11')](_0xd6f0('0xd'),_0x2ba1b2,_0x4b17c2);_0x16f3c4(_0x4b17c2);});});} \ No newline at end of file +var _0xc904=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19b932,_0x10efa2){var _0x454bc8=function(_0x685283){while(--_0x685283){_0x19b932['push'](_0x19b932['shift']());}};_0x454bc8(++_0x10efa2);}(_0xc904,0x1aa));var _0x4c90=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xc904[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x4c90('0x0'));var util=require(_0x4c90('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c90('0x2'));var fs=require('fs');var Redis=require(_0x4c90('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c90('0x4'));var logger=require(_0x4c90('0x5'))(_0x4c90('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c90('0x7'));var client=jayson[_0x4c90('0x8')][_0x4c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a0315,_0x20b0b2,_0x30f19d){return new BPromise(function(_0x126682,_0x3d95d6){return client[_0x4c90('0xa')](_0x1a0315,_0x30f19d)['then'](function(_0x30bb3c){logger['info'](_0x4c90('0xb'),_0x20b0b2,_0x4c90('0xc'));logger[_0x4c90('0xd')](_0x4c90('0xe'),_0x20b0b2,_0x4c90('0xc'),JSON[_0x4c90('0xf')](_0x30bb3c));if(_0x30bb3c[_0x4c90('0x10')]){if(_0x30bb3c[_0x4c90('0x10')][_0x4c90('0x11')]===0x1f4){logger[_0x4c90('0x10')](_0x4c90('0xb'),_0x20b0b2,_0x30bb3c[_0x4c90('0x10')][_0x4c90('0x12')]);return _0x3d95d6(_0x30bb3c[_0x4c90('0x10')][_0x4c90('0x12')]);}logger[_0x4c90('0x10')](_0x4c90('0xb'),_0x20b0b2,_0x30bb3c[_0x4c90('0x10')][_0x4c90('0x12')]);return _0x126682(_0x30bb3c['error'][_0x4c90('0x12')]);}else{logger[_0x4c90('0x13')](_0x4c90('0xb'),_0x20b0b2,_0x4c90('0xc'));_0x126682(_0x30bb3c[_0x4c90('0x14')][_0x4c90('0x12')]);}})[_0x4c90('0x15')](function(_0x5763c0){logger[_0x4c90('0x10')](_0x4c90('0xb'),_0x20b0b2,_0x5763c0);_0x3d95d6(_0x5763c0);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 95a8370..94bb88f 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 _0x8274=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8274,0x1df));var _0x4827=function(_0x22dc35,_0x37b6ed){_0x22dc35=_0x22dc35-0x0;var _0x17dcf4=_0x8274[_0x22dc35];return _0x17dcf4;};'use strict';var multer=require(_0x4827('0x0'));var util=require(_0x4827('0x1'));var path=require('path');var timeout=require(_0x4827('0x2'));var express=require(_0x4827('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4827('0x4'));var interaction=require(_0x4827('0x5'));var config=require(_0x4827('0x6'));var controller=require(_0x4827('0x7'));router[_0x4827('0x8')]('/',auth[_0x4827('0x9')](),controller[_0x4827('0xa')]);router['get'](_0x4827('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4827('0x8')](_0x4827('0xc'),auth[_0x4827('0x9')](),controller[_0x4827('0xd')]);router[_0x4827('0xe')]('/',auth['isAuthenticated'](),controller[_0x4827('0xf')]);router[_0x4827('0x10')](_0x4827('0xc'),auth[_0x4827('0x9')](),controller[_0x4827('0x11')]);router[_0x4827('0x12')](_0x4827('0xc'),auth[_0x4827('0x9')](),controller[_0x4827('0x13')]);module[_0x4827('0x14')]=router; \ No newline at end of file +var _0xdd4a=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','show','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x598ca6,_0xa5fbd1){var _0x1555da=function(_0x1b9651){while(--_0x1b9651){_0x598ca6['push'](_0x598ca6['shift']());}};_0x1555da(++_0xa5fbd1);}(_0xdd4a,0xac));var _0xadd4=function(_0x4f74a5,_0x1fd979){_0x4f74a5=_0x4f74a5-0x0;var _0x5be8b2=_0xdd4a[_0x4f74a5];return _0x5be8b2;};'use strict';var multer=require(_0xadd4('0x0'));var util=require(_0xadd4('0x1'));var path=require(_0xadd4('0x2'));var timeout=require(_0xadd4('0x3'));var express=require(_0xadd4('0x4'));var router=express[_0xadd4('0x5')]();var fs_extra=require(_0xadd4('0x6'));var auth=require(_0xadd4('0x7'));var interaction=require(_0xadd4('0x8'));var config=require(_0xadd4('0x9'));var controller=require(_0xadd4('0xa'));router['get']('/',auth[_0xadd4('0xb')](),controller['index']);router[_0xadd4('0xc')](_0xadd4('0xd'),auth[_0xadd4('0xb')](),controller['describe']);router[_0xadd4('0xc')]('/:id',auth[_0xadd4('0xb')](),controller[_0xadd4('0xe')]);router['post']('/',auth[_0xadd4('0xb')](),controller['create']);router[_0xadd4('0xf')](_0xadd4('0x10'),auth['isAuthenticated'](),controller[_0xadd4('0x11')]);router['delete']('/:id',auth[_0xadd4('0xb')](),controller[_0xadd4('0x12')]);module[_0xadd4('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 cf95d18..92d0ff5 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 _0x2e9c=['ENUM','mouseOver','INTEGER','sequelize','STRING'];(function(_0x1cf7af,_0x50f213){var _0x1b8088=function(_0x127b9e){while(--_0x127b9e){_0x1cf7af['push'](_0x1cf7af['shift']());}};_0x1b8088(++_0x50f213);}(_0x2e9c,0xfd));var _0xc2e9=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x2e9c[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0xc2e9('0x0'));module['exports']={'name':{'type':Sequelize[_0xc2e9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc2e9('0x2')]('mouseOver','timeout'),'defaultValue':_0xc2e9('0x3')},'selector':{'type':Sequelize[_0xc2e9('0x1')]},'timeout':{'type':Sequelize[_0xc2e9('0x4')]}}; \ No newline at end of file +var _0x9b72=['ENUM','mouseOver','INTEGER','sequelize','STRING'];(function(_0x143bb6,_0x541bb6){var _0x155e0d=function(_0x55a045){while(--_0x55a045){_0x143bb6['push'](_0x143bb6['shift']());}};_0x155e0d(++_0x541bb6);}(_0x9b72,0x148));var _0x29b7=function(_0x4aee70,_0x8dfa8c){_0x4aee70=_0x4aee70-0x0;var _0x487b51=_0x9b72[_0x4aee70];return _0x487b51;};'use strict';var Sequelize=require(_0x29b7('0x0'));module['exports']={'name':{'type':Sequelize[_0x29b7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x29b7('0x2')](_0x29b7('0x3'),'timeout'),'defaultValue':_0x29b7('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x29b7('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c802241..f9f9ed5 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 _0x61b8=['query','filters','intersection','attributes','includeAll','include','options','ChatProactiveAction','then','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','destroy','error','stack','name','params','model','rawAttributes','keys'];(function(_0x1d68e1,_0x241674){var _0x2696aa=function(_0x13fddd){while(--_0x13fddd){_0x1d68e1['push'](_0x1d68e1['shift']());}};_0x2696aa(++_0x241674);}(_0x61b8,0x169));var _0x861b=function(_0x1bbe1d,_0x517125){_0x1bbe1d=_0x1bbe1d-0x0;var _0x508012=_0x61b8[_0x1bbe1d];return _0x508012;};'use strict';var emlformat=require(_0x861b('0x0'));var rimraf=require(_0x861b('0x1'));var zipdir=require(_0x861b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x861b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x861b('0x4'));var util=require(_0x861b('0x5'));var path=require(_0x861b('0x6'));var sox=require('sox');var csv=require(_0x861b('0x7'));var ejs=require(_0x861b('0x8'));var fs=require('fs');var fs_extra=require(_0x861b('0x9'));var _=require(_0x861b('0xa'));var squel=require(_0x861b('0xb'));var crypto=require(_0x861b('0xc'));var jsforce=require(_0x861b('0xd'));var deskjs=require(_0x861b('0xe'));var toCsv=require(_0x861b('0x7'));var querystring=require(_0x861b('0xf'));var Papa=require(_0x861b('0x10'));var Redis=require('ioredis');var authService=require(_0x861b('0x11'));var qs=require(_0x861b('0x12'));var as=require(_0x861b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x861b('0x14'))('api');var utils=require(_0x861b('0x15'));var config=require(_0x861b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x861b('0x17'))['db'];function respondWithStatusCode(_0x16eb59,_0x125345){_0x125345=_0x125345||0xcc;return function(_0x23c3db){if(_0x23c3db){return _0x16eb59[_0x861b('0x18')](_0x125345);}return _0x16eb59[_0x861b('0x19')](_0x125345)[_0x861b('0x1a')]();};}function respondWithResult(_0x21c585,_0x44b444){_0x44b444=_0x44b444||0xc8;return function(_0x226ee9){if(_0x226ee9){return _0x21c585[_0x861b('0x19')](_0x44b444)[_0x861b('0x1b')](_0x226ee9);}};}function respondWithFilteredResult(_0x264ba1,_0x3ee3ab){return function(_0x437bbd){if(_0x437bbd){var _0x3dbd5e=typeof _0x3ee3ab['offset']===_0x861b('0x1c')&&typeof _0x3ee3ab['limit']==='undefined';var _0x3d828f=_0x437bbd['count'];var _0x1b3d5c=_0x3dbd5e?0x0:_0x3ee3ab[_0x861b('0x1d')];var _0x4aafa8=_0x3dbd5e?_0x437bbd[_0x861b('0x1e')]:_0x3ee3ab[_0x861b('0x1d')]+_0x3ee3ab[_0x861b('0x1f')];var _0x11a914;if(_0x4aafa8>=_0x3d828f){_0x4aafa8=_0x3d828f;_0x11a914=0xc8;}else{_0x11a914=0xce;}_0x264ba1['status'](_0x11a914);return _0x264ba1['set'](_0x861b('0x20'),_0x1b3d5c+'-'+_0x4aafa8+'/'+_0x3d828f)[_0x861b('0x1b')](_0x437bbd);}return null;};}function patchUpdates(_0x20422f){return function(_0x4e76a3){try{jsonpatch[_0x861b('0x21')](_0x4e76a3,_0x20422f,!![]);}catch(_0x4dab89){return BPromise[_0x861b('0x22')](_0x4dab89);}return _0x4e76a3[_0x861b('0x23')]();};}function saveUpdates(_0x4af003,_0x4fd2b3){return function(_0x474f49){if(_0x474f49){return _0x474f49[_0x861b('0x24')](_0x4af003)['then'](function(_0x4e61cd){return _0x4e61cd;});}return null;};}function removeEntity(_0x24aed8,_0x47be04){return function(_0x5b91db){if(_0x5b91db){return _0x5b91db[_0x861b('0x25')]()['then'](function(){_0x24aed8['status'](0xcc)[_0x861b('0x1a')]();});}};}function handleEntityNotFound(_0x24d378,_0x22369c){return function(_0xb763e2){if(!_0xb763e2){_0x24d378[_0x861b('0x18')](0x194);}return _0xb763e2;};}function handleError(_0x58527c,_0x536c97){_0x536c97=_0x536c97||0x1f4;return function(_0x726496){logger[_0x861b('0x26')](_0x726496[_0x861b('0x27')]);if(_0x726496[_0x861b('0x28')]){delete _0x726496[_0x861b('0x28')];}_0x58527c[_0x861b('0x19')](_0x536c97)['send'](_0x726496);};}exports['show']=function(_0x3882a1,_0x3aeaf8){var _0x419259={'raw':!![],'where':{'id':_0x3882a1[_0x861b('0x29')]['id']}},_0x1fc11a={};_0x1fc11a[_0x861b('0x2a')]=_['keys'](db['ChatProactiveAction'][_0x861b('0x2b')]);_0x1fc11a['query']=_[_0x861b('0x2c')](_0x3882a1[_0x861b('0x2d')]);_0x1fc11a[_0x861b('0x2e')]=_[_0x861b('0x2f')](_0x1fc11a[_0x861b('0x2a')],_0x1fc11a[_0x861b('0x2d')]);_0x419259[_0x861b('0x30')]=_[_0x861b('0x2f')](_0x1fc11a['model'],qs['fields'](_0x3882a1[_0x861b('0x2d')]['fields']));_0x419259[_0x861b('0x30')]=_0x419259[_0x861b('0x30')]['length']?_0x419259[_0x861b('0x30')]:_0x1fc11a['model'];if(_0x3882a1['query'][_0x861b('0x31')]){_0x419259[_0x861b('0x32')]=[{'all':!![]}];}_0x419259=_['merge']({},_0x419259,_0x3882a1[_0x861b('0x33')]);return db[_0x861b('0x34')]['find'](_0x419259)[_0x861b('0x35')](handleEntityNotFound(_0x3aeaf8,null))[_0x861b('0x35')](respondWithResult(_0x3aeaf8,null))['catch'](handleError(_0x3aeaf8,null));};exports[_0x861b('0x36')]=function(_0x1d0e67,_0x5a48f3){return db[_0x861b('0x34')][_0x861b('0x36')](_0x1d0e67[_0x861b('0x37')],{})['then'](respondWithResult(_0x5a48f3,0xc9))[_0x861b('0x38')](handleError(_0x5a48f3,null));};exports[_0x861b('0x24')]=function(_0x1a677e,_0x2936fc){if(_0x1a677e[_0x861b('0x37')]['id']){delete _0x1a677e['body']['id'];}return db['ChatProactiveAction'][_0x861b('0x39')]({'where':{'id':_0x1a677e[_0x861b('0x29')]['id']}})['then'](handleEntityNotFound(_0x2936fc,null))['then'](saveUpdates(_0x1a677e[_0x861b('0x37')],null))[_0x861b('0x35')](respondWithResult(_0x2936fc,null))[_0x861b('0x38')](handleError(_0x2936fc,null));};exports[_0x861b('0x25')]=function(_0x339a95,_0x307e97){return db['ChatProactiveAction'][_0x861b('0x39')]({'where':{'id':_0x339a95[_0x861b('0x29')]['id']}})[_0x861b('0x35')](handleEntityNotFound(_0x307e97,null))[_0x861b('0x35')](removeEntity(_0x307e97,null))[_0x861b('0x38')](handleError(_0x307e97,null));}; \ No newline at end of file +var _0x9b69=['limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined'];(function(_0x1a2d05,_0x3ba3d9){var _0x1009ca=function(_0x4a895c){while(--_0x4a895c){_0x1a2d05['push'](_0x1a2d05['shift']());}};_0x1009ca(++_0x3ba3d9);}(_0x9b69,0xa3));var _0x99b6=function(_0x57aa62,_0x763c99){_0x57aa62=_0x57aa62-0x0;var _0x4b3e59=_0x9b69[_0x57aa62];return _0x4b3e59;};'use strict';var emlformat=require(_0x99b6('0x0'));var rimraf=require(_0x99b6('0x1'));var zipdir=require(_0x99b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x99b6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x99b6('0x4'));var util=require(_0x99b6('0x5'));var path=require(_0x99b6('0x6'));var sox=require('sox');var csv=require(_0x99b6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99b6('0x8'));var _=require(_0x99b6('0x9'));var squel=require(_0x99b6('0xa'));var crypto=require(_0x99b6('0xb'));var jsforce=require(_0x99b6('0xc'));var deskjs=require(_0x99b6('0xd'));var toCsv=require(_0x99b6('0x7'));var querystring=require(_0x99b6('0xe'));var Papa=require(_0x99b6('0xf'));var Redis=require(_0x99b6('0x10'));var authService=require(_0x99b6('0x11'));var qs=require(_0x99b6('0x12'));var as=require(_0x99b6('0x13'));var hardwareService=require(_0x99b6('0x14'));var logger=require(_0x99b6('0x15'))(_0x99b6('0x16'));var utils=require(_0x99b6('0x17'));var config=require(_0x99b6('0x18'));var licenseUtil=require(_0x99b6('0x19'));var db=require(_0x99b6('0x1a'))['db'];function respondWithStatusCode(_0x48a408,_0x4fc440){_0x4fc440=_0x4fc440||0xcc;return function(_0x5791e5){if(_0x5791e5){return _0x48a408['sendStatus'](_0x4fc440);}return _0x48a408['status'](_0x4fc440)['end']();};}function respondWithResult(_0x54cd12,_0x172f35){_0x172f35=_0x172f35||0xc8;return function(_0x184e90){if(_0x184e90){return _0x54cd12[_0x99b6('0x1b')](_0x172f35)['json'](_0x184e90);}};}function respondWithFilteredResult(_0xb63749,_0x1ceee5){return function(_0x70b3f5){if(_0x70b3f5){var _0x417e9a=typeof _0x1ceee5['offset']===_0x99b6('0x1c')&&typeof _0x1ceee5[_0x99b6('0x1d')]===_0x99b6('0x1c');var _0x2a2bf2=_0x70b3f5[_0x99b6('0x1e')];var _0x3fd5ad=_0x417e9a?0x0:_0x1ceee5[_0x99b6('0x1f')];var _0x4cb2e7=_0x417e9a?_0x70b3f5[_0x99b6('0x1e')]:_0x1ceee5['offset']+_0x1ceee5[_0x99b6('0x1d')];var _0x391c6a;if(_0x4cb2e7>=_0x2a2bf2){_0x4cb2e7=_0x2a2bf2;_0x391c6a=0xc8;}else{_0x391c6a=0xce;}_0xb63749[_0x99b6('0x1b')](_0x391c6a);return _0xb63749[_0x99b6('0x20')](_0x99b6('0x21'),_0x3fd5ad+'-'+_0x4cb2e7+'/'+_0x2a2bf2)[_0x99b6('0x22')](_0x70b3f5);}return null;};}function patchUpdates(_0x35b47a){return function(_0x59045f){try{jsonpatch['apply'](_0x59045f,_0x35b47a,!![]);}catch(_0x11b866){return BPromise[_0x99b6('0x23')](_0x11b866);}return _0x59045f[_0x99b6('0x24')]();};}function saveUpdates(_0x465587,_0x4db3a8){return function(_0x38a916){if(_0x38a916){return _0x38a916[_0x99b6('0x25')](_0x465587)[_0x99b6('0x26')](function(_0x563210){return _0x563210;});}return null;};}function removeEntity(_0x13c52d,_0x22db3f){return function(_0x454d43){if(_0x454d43){return _0x454d43[_0x99b6('0x27')]()[_0x99b6('0x26')](function(){_0x13c52d[_0x99b6('0x1b')](0xcc)[_0x99b6('0x28')]();});}};}function handleEntityNotFound(_0x2d92a6,_0x1f8f01){return function(_0x58176f){if(!_0x58176f){_0x2d92a6[_0x99b6('0x29')](0x194);}return _0x58176f;};}function handleError(_0x47ce41,_0x39d788){_0x39d788=_0x39d788||0x1f4;return function(_0x486a7f){logger[_0x99b6('0x2a')](_0x486a7f[_0x99b6('0x2b')]);if(_0x486a7f['name']){delete _0x486a7f['name'];}_0x47ce41[_0x99b6('0x1b')](_0x39d788)[_0x99b6('0x2c')](_0x486a7f);};}exports[_0x99b6('0x2d')]=function(_0x48f796,_0x4a53fa){var _0x5a56fb={'raw':!![],'where':{'id':_0x48f796[_0x99b6('0x2e')]['id']}},_0x55e859={};_0x55e859[_0x99b6('0x2f')]=_['keys'](db[_0x99b6('0x30')][_0x99b6('0x31')]);_0x55e859[_0x99b6('0x32')]=_[_0x99b6('0x33')](_0x48f796[_0x99b6('0x32')]);_0x55e859['filters']=_[_0x99b6('0x34')](_0x55e859[_0x99b6('0x2f')],_0x55e859[_0x99b6('0x32')]);_0x5a56fb[_0x99b6('0x35')]=_[_0x99b6('0x34')](_0x55e859['model'],qs[_0x99b6('0x36')](_0x48f796[_0x99b6('0x32')][_0x99b6('0x36')]));_0x5a56fb[_0x99b6('0x35')]=_0x5a56fb[_0x99b6('0x35')][_0x99b6('0x37')]?_0x5a56fb[_0x99b6('0x35')]:_0x55e859[_0x99b6('0x2f')];if(_0x48f796['query'][_0x99b6('0x38')]){_0x5a56fb[_0x99b6('0x39')]=[{'all':!![]}];}_0x5a56fb=_[_0x99b6('0x3a')]({},_0x5a56fb,_0x48f796[_0x99b6('0x3b')]);return db[_0x99b6('0x30')][_0x99b6('0x3c')](_0x5a56fb)[_0x99b6('0x26')](handleEntityNotFound(_0x4a53fa,null))[_0x99b6('0x26')](respondWithResult(_0x4a53fa,null))[_0x99b6('0x3d')](handleError(_0x4a53fa,null));};exports['create']=function(_0x27c82e,_0x166924){return db['ChatProactiveAction'][_0x99b6('0x3e')](_0x27c82e['body'],{})[_0x99b6('0x26')](respondWithResult(_0x166924,0xc9))[_0x99b6('0x3d')](handleError(_0x166924,null));};exports[_0x99b6('0x25')]=function(_0x1350b1,_0x4e5fb5){if(_0x1350b1[_0x99b6('0x3f')]['id']){delete _0x1350b1['body']['id'];}return db[_0x99b6('0x30')][_0x99b6('0x3c')]({'where':{'id':_0x1350b1[_0x99b6('0x2e')]['id']}})[_0x99b6('0x26')](handleEntityNotFound(_0x4e5fb5,null))[_0x99b6('0x26')](saveUpdates(_0x1350b1[_0x99b6('0x3f')],null))[_0x99b6('0x26')](respondWithResult(_0x4e5fb5,null))[_0x99b6('0x3d')](handleError(_0x4e5fb5,null));};exports[_0x99b6('0x27')]=function(_0x34f785,_0xf99ed6){return db[_0x99b6('0x30')]['find']({'where':{'id':_0x34f785['params']['id']}})[_0x99b6('0x26')](handleEntityNotFound(_0xf99ed6,null))[_0x99b6('0x26')](removeEntity(_0xf99ed6,null))[_0x99b6('0x3d')](handleError(_0xf99ed6,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 8740d00..24eb960 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 _0xf1c2=['exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatProactiveAction.attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf1c2,0x157));var _0x2f1c=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0xf1c2[_0x53ad58];return _0x554b03;};'use strict';var _=require(_0x2f1c('0x0'));var util=require(_0x2f1c('0x1'));var logger=require(_0x2f1c('0x2'))(_0x2f1c('0x3'));var moment=require(_0x2f1c('0x4'));var BPromise=require(_0x2f1c('0x5'));var rp=require(_0x2f1c('0x6'));var fs=require('fs');var path=require(_0x2f1c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2f1c('0x8'));module[_0x2f1c('0x9')]=function(_0x3fdfc6,_0x2c2803){return _0x3fdfc6['define'](_0x2f1c('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5580=['bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5580,0x68));var _0x0558=function(_0xbfc3e6,_0x58d6ae){_0xbfc3e6=_0xbfc3e6-0x0;var _0x477eb0=_0x5580[_0xbfc3e6];return _0x477eb0;};'use strict';var _=require(_0x0558('0x0'));var util=require(_0x0558('0x1'));var logger=require(_0x0558('0x2'))(_0x0558('0x3'));var moment=require('moment');var BPromise=require(_0x0558('0x4'));var rp=require(_0x0558('0x5'));var fs=require('fs');var path=require(_0x0558('0x6'));var rimraf=require(_0x0558('0x7'));var config=require(_0x0558('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x0558('0x9')]=function(_0x51dba0,_0x4cd505){return _0x51dba0['define'](_0x0558('0xa'),attributes,{'tableName':_0x0558('0xb'),'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 d4892be..97a9a48 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 _0xa625=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51e34d,_0x480ab7){var _0x8b5825=function(_0x30511b){while(--_0x30511b){_0x51e34d['push'](_0x51e34d['shift']());}};_0x8b5825(++_0x480ab7);}(_0xa625,0x1d4));var _0x5a62=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xa625[_0x4bb66f];return _0xf2772f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a62('0x0'));var BPromise=require('bluebird');var rs=require(_0x5a62('0x1'));var fs=require('fs');var Redis=require(_0x5a62('0x2'));var db=require(_0x5a62('0x3'))['db'];var utils=require(_0x5a62('0x4'));var logger=require(_0x5a62('0x5'))('rpc');var config=require(_0x5a62('0x6'));var jayson=require(_0x5a62('0x7'));var client=jayson[_0x5a62('0x8')][_0x5a62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44f30e,_0x524b8c,_0x17ac0b){return new BPromise(function(_0x58b046,_0x2c6e75){return client[_0x5a62('0xa')](_0x44f30e,_0x17ac0b)[_0x5a62('0xb')](function(_0x2156b2){logger[_0x5a62('0xc')](_0x5a62('0xd'),_0x524b8c,_0x5a62('0xe'));logger[_0x5a62('0xf')](_0x5a62('0x10'),_0x524b8c,'request\x20sent',JSON[_0x5a62('0x11')](_0x2156b2));if(_0x2156b2[_0x5a62('0x12')]){if(_0x2156b2['error']['code']===0x1f4){logger[_0x5a62('0x12')](_0x5a62('0xd'),_0x524b8c,_0x2156b2[_0x5a62('0x12')]['message']);return _0x2c6e75(_0x2156b2[_0x5a62('0x12')][_0x5a62('0x13')]);}logger['error'](_0x5a62('0xd'),_0x524b8c,_0x2156b2['error'][_0x5a62('0x13')]);return _0x58b046(_0x2156b2[_0x5a62('0x12')][_0x5a62('0x13')]);}else{logger[_0x5a62('0xc')](_0x5a62('0xd'),_0x524b8c,_0x5a62('0xe'));_0x58b046(_0x2156b2[_0x5a62('0x14')][_0x5a62('0x13')]);}})[_0x5a62('0x15')](function(_0x3b619a){logger['error'](_0x5a62('0xd'),_0x524b8c,_0x3b619a);_0x2c6e75(_0x3b619a);});});} \ No newline at end of file +var _0x9e55=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9e55,0xa3));var _0x59e5=function(_0x3c6ac5,_0x45ff4b){_0x3c6ac5=_0x3c6ac5-0x0;var _0xde82b0=_0x9e55[_0x3c6ac5];return _0xde82b0;};'use strict';var _=require(_0x59e5('0x0'));var util=require(_0x59e5('0x1'));var moment=require(_0x59e5('0x2'));var BPromise=require(_0x59e5('0x3'));var rs=require(_0x59e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59e5('0x5'))['db'];var utils=require(_0x59e5('0x6'));var logger=require('../../config/logger')(_0x59e5('0x7'));var config=require(_0x59e5('0x8'));var jayson=require(_0x59e5('0x9'));var client=jayson[_0x59e5('0xa')][_0x59e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x522624,_0x430dd0,_0x510534){return new BPromise(function(_0x472130,_0x4fe6d9){return client[_0x59e5('0xc')](_0x522624,_0x510534)[_0x59e5('0xd')](function(_0x5c0171){logger[_0x59e5('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x430dd0,_0x59e5('0xf'));logger[_0x59e5('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x430dd0,_0x59e5('0xf'),JSON[_0x59e5('0x11')](_0x5c0171));if(_0x5c0171['error']){if(_0x5c0171[_0x59e5('0x12')][_0x59e5('0x13')]===0x1f4){logger[_0x59e5('0x12')](_0x59e5('0x14'),_0x430dd0,_0x5c0171[_0x59e5('0x12')][_0x59e5('0x15')]);return _0x4fe6d9(_0x5c0171[_0x59e5('0x12')]['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x430dd0,_0x5c0171[_0x59e5('0x12')][_0x59e5('0x15')]);return _0x472130(_0x5c0171[_0x59e5('0x12')][_0x59e5('0x15')]);}else{logger[_0x59e5('0xe')](_0x59e5('0x14'),_0x430dd0,'request\x20sent');_0x472130(_0x5c0171[_0x59e5('0x16')][_0x59e5('0x15')]);}})[_0x59e5('0x17')](function(_0x4f7f2d){logger[_0x59e5('0x12')](_0x59e5('0x14'),_0x430dd0,_0x4f7f2d);_0x4fe6d9(_0x4f7f2d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c8c8a96..f3f9835 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 _0xf2ca=['show','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x2a2e9c,_0x4108f6){var _0x6f6fc6=function(_0x524998){while(--_0x524998){_0x2a2e9c['push'](_0x2a2e9c['shift']());}};_0x6f6fc6(++_0x4108f6);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0xf2ca[_0x18776a];return _0x484e4a;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./chatProactiveAction.controller');router[_0xaf2c('0x9')](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xc')]);router['post']('/',auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xd')]);router['put'](_0xaf2c('0xa'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['delete'](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xf')]);module[_0xaf2c('0x10')]=router; \ No newline at end of file +var _0x46ed=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports'];(function(_0x110230,_0x9327b4){var _0xef860f=function(_0x146037){while(--_0x146037){_0x110230['push'](_0x110230['shift']());}};_0xef860f(++_0x9327b4);}(_0x46ed,0x168));var _0xd46e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x46ed[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0xa')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller['update']);router[_0xd46e('0xf')](_0xd46e('0x9'),auth['isAuthenticated'](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 77a3384..13b6a92 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 _0x2509=['INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x48d2ec,_0x21a83a){var _0x198198=function(_0x1d1f95){while(--_0x1d1f95){_0x48d2ec['push'](_0x48d2ec['shift']());}};_0x198198(++_0x21a83a);}(_0x2509,0xe3));var _0x9250=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0x2509[_0x251e8c];return _0x1e0c1d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9250('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9250('0x0')]},'timeout':{'type':Sequelize[_0x9250('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9250('0x2')](_0x9250('0x3'),_0x9250('0x4'),_0x9250('0x5'))}}; \ No newline at end of file +var _0x7d30=['INTEGER','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7d30,0x18b));var _0x07d3=function(_0x3cc237,_0x34a581){_0x3cc237=_0x3cc237-0x0;var _0x4e1cfc=_0x7d30[_0x3cc237];return _0x4e1cfc;};'use strict';var Sequelize=require(_0x07d3('0x0'));module[_0x07d3('0x1')]={'name':{'type':Sequelize[_0x07d3('0x2')],'unique':_0x07d3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x07d3('0x2')]},'timeout':{'type':Sequelize[_0x07d3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x07d3('0x5'),'beepall',_0x07d3('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 6e4ca04..6dbdfda 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 _0x8760=['to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','get','ChatQueues','UserProfileResource','destroy','stack','name','send','index','ChatQueue','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','show','params','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','getMembers','findOne','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','rows','format','%s/%s','SIP','createdAt','updatedAt','Team','rawAttributes','addTeams','ids','online','voicePause','interface','flatMap','Agents','each','forEach','emit','userChatQueue:save','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x445770,_0x3bff55){var _0x310ece=function(_0x57df88){while(--_0x57df88){_0x445770['push'](_0x445770['shift']());}};_0x310ece(++_0x3bff55);}(_0x8760,0x132));var _0x0876=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x8760[_0x251d9c];return _0x16ae64;};'use strict';var emlformat=require(_0x0876('0x0'));var rimraf=require(_0x0876('0x1'));var zipdir=require(_0x0876('0x2'));var jsonpatch=require(_0x0876('0x3'));var rp=require(_0x0876('0x4'));var moment=require(_0x0876('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0876('0x6'));var util=require(_0x0876('0x7'));var path=require(_0x0876('0x8'));var sox=require(_0x0876('0x9'));var csv=require(_0x0876('0xa'));var ejs=require(_0x0876('0xb'));var fs=require('fs');var fs_extra=require(_0x0876('0xc'));var _=require('lodash');var squel=require(_0x0876('0xd'));var crypto=require(_0x0876('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0876('0xf'));var Redis=require(_0x0876('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0876('0x11'));var as=require(_0x0876('0x12'));var hardwareService=require(_0x0876('0x13'));var logger=require(_0x0876('0x14'))(_0x0876('0x15'));var utils=require(_0x0876('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0876('0x17'));var db=require(_0x0876('0x18'))['db'];config[_0x0876('0x19')]=_[_0x0876('0x1a')](config[_0x0876('0x19')],{'host':_0x0876('0x1b'),'port':0x18eb});var socket=require(_0x0876('0x1c'))(new Redis(config[_0x0876('0x19')]));require(_0x0876('0x1d'))[_0x0876('0x1e')](socket);var jayson=require(_0x0876('0x1f'));var client=jayson[_0x0876('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1524f7,_0x370588,_0xd0a2d7,_0x2bfb9e){return new BPromise(function(_0x1c6328,_0x48480c){var _0x1092cc=_0x2bfb9e||client;return _0x1092cc[_0x0876('0x21')](_0x1524f7,_0xd0a2d7)['then'](function(_0x27961f){logger[_0x0876('0x22')](_0x0876('0x23'),_0x370588,_0x0876('0x24'));logger[_0x0876('0x25')](_0x0876('0x26'),_0x370588,_0x0876('0x24'),JSON['stringify'](_0x27961f));if(_0x27961f[_0x0876('0x27')]){if(_0x27961f[_0x0876('0x27')]['code']===0x1f4){logger['error'](_0x0876('0x23'),_0x370588,_0x27961f[_0x0876('0x27')][_0x0876('0x28')]);return _0x48480c(_0x27961f[_0x0876('0x27')]['message']);}logger[_0x0876('0x27')]('ChatQueue,\x20%s,\x20%s',_0x370588,_0x27961f['error'][_0x0876('0x28')]);return _0x1c6328(_0x27961f[_0x0876('0x27')][_0x0876('0x28')]);}else{logger[_0x0876('0x22')](_0x0876('0x23'),_0x370588,_0x0876('0x24'));_0x1c6328(_0x27961f[_0x0876('0x29')]['message']);}})[_0x0876('0x2a')](function(_0x140a16){logger[_0x0876('0x27')](_0x0876('0x23'),_0x370588,_0x140a16);_0x48480c(_0x140a16);});});}function respondWithStatusCode(_0x26d07d,_0x1448d4){_0x1448d4=_0x1448d4||0xcc;return function(_0x383707){if(_0x383707){return _0x26d07d[_0x0876('0x2b')](_0x1448d4);}return _0x26d07d[_0x0876('0x2c')](_0x1448d4)[_0x0876('0x2d')]();};}function respondWithResult(_0x41b198,_0x3f7f7b){_0x3f7f7b=_0x3f7f7b||0xc8;return function(_0x3dd9a4){if(_0x3dd9a4){return _0x41b198[_0x0876('0x2c')](_0x3f7f7b)[_0x0876('0x2e')](_0x3dd9a4);}};}function respondWithFilteredResult(_0x437b04,_0x1902de){return function(_0x5b0868){if(_0x5b0868){var _0x1af134=typeof _0x1902de[_0x0876('0x2f')]===_0x0876('0x30')&&typeof _0x1902de['limit']===_0x0876('0x30');var _0x4f1912=_0x5b0868[_0x0876('0x31')];var _0x24ff6f=_0x1af134?0x0:_0x1902de[_0x0876('0x2f')];var _0xa4634b=_0x1af134?_0x5b0868['count']:_0x1902de['offset']+_0x1902de['limit'];var _0x11adc2;if(_0xa4634b>=_0x4f1912){_0xa4634b=_0x4f1912;_0x11adc2=0xc8;}else{_0x11adc2=0xce;}_0x437b04['status'](_0x11adc2);return _0x437b04['set']('Content-Range',_0x24ff6f+'-'+_0xa4634b+'/'+_0x4f1912)[_0x0876('0x2e')](_0x5b0868);}return null;};}function patchUpdates(_0x1f03cf){return function(_0x16aba8){try{jsonpatch[_0x0876('0x32')](_0x16aba8,_0x1f03cf,!![]);}catch(_0x1265b7){return BPromise[_0x0876('0x33')](_0x1265b7);}return _0x16aba8[_0x0876('0x34')]();};}function saveUpdates(_0x314138,_0x43970f){return function(_0x13c155){if(_0x13c155){return _0x13c155[_0x0876('0x35')](_0x314138)[_0x0876('0x36')](function(_0x58bf63){return _0x58bf63;});}return null;};}function removeEntity(_0x3ec54c,_0x1e12a3){return function(_0xb1576){if(_0xb1576){return _0xb1576['destroy']()['then'](function(){var _0x11b5e5=_0xb1576[_0x0876('0x37')]({'plain':!![]});var _0x5524b3=_0x0876('0x38');return db[_0x0876('0x39')][_0x0876('0x3a')]({'where':{'type':_0x5524b3,'resourceId':_0x11b5e5['id']}})[_0x0876('0x36')](function(){return _0xb1576;});})[_0x0876('0x36')](function(){_0x3ec54c['status'](0xcc)[_0x0876('0x2d')]();});}};}function handleEntityNotFound(_0x5246df,_0x3d6dbb){return function(_0xffefb5){if(!_0xffefb5){_0x5246df['sendStatus'](0x194);}return _0xffefb5;};}function handleError(_0x1aedd2,_0x209d6e){_0x209d6e=_0x209d6e||0x1f4;return function(_0x3a5fbb){logger['error'](_0x3a5fbb[_0x0876('0x3b')]);if(_0x3a5fbb[_0x0876('0x3c')]){delete _0x3a5fbb[_0x0876('0x3c')];}_0x1aedd2['status'](_0x209d6e)[_0x0876('0x3d')](_0x3a5fbb);};}exports[_0x0876('0x3e')]=function(_0x2be5c1,_0x314578){var _0x12a9e9={},_0x3cffce={},_0xec9498={'count':0x0,'rows':[]};var _0x4b12f1=_['map'](db[_0x0876('0x3f')]['rawAttributes'],function(_0xa74acd){return{'name':_0xa74acd[_0x0876('0x40')],'type':_0xa74acd[_0x0876('0x41')][_0x0876('0x42')]};});_0x3cffce[_0x0876('0x43')]=_[_0x0876('0x44')](_0x4b12f1,_0x0876('0x3c'));_0x3cffce[_0x0876('0x45')]=_[_0x0876('0x46')](_0x2be5c1[_0x0876('0x45')]);_0x3cffce[_0x0876('0x47')]=_[_0x0876('0x48')](_0x3cffce[_0x0876('0x43')],_0x3cffce[_0x0876('0x45')]);_0x12a9e9[_0x0876('0x49')]=_[_0x0876('0x48')](_0x3cffce[_0x0876('0x43')],qs[_0x0876('0x4a')](_0x2be5c1[_0x0876('0x45')][_0x0876('0x4a')]));_0x12a9e9[_0x0876('0x49')]=_0x12a9e9[_0x0876('0x49')][_0x0876('0x4b')]?_0x12a9e9[_0x0876('0x49')]:_0x3cffce[_0x0876('0x43')];if(!_0x2be5c1[_0x0876('0x45')][_0x0876('0x4c')](_0x0876('0x4d'))){_0x12a9e9[_0x0876('0x4e')]=qs[_0x0876('0x4e')](_0x2be5c1[_0x0876('0x45')][_0x0876('0x4e')]);_0x12a9e9[_0x0876('0x2f')]=qs['offset'](_0x2be5c1['query'][_0x0876('0x2f')]);}_0x12a9e9[_0x0876('0x4f')]=qs[_0x0876('0x50')](_0x2be5c1[_0x0876('0x45')][_0x0876('0x50')]);_0x12a9e9['where']=qs['filters'](_[_0x0876('0x51')](_0x2be5c1[_0x0876('0x45')],_0x3cffce[_0x0876('0x47')]),_0x4b12f1);if(_0x2be5c1[_0x0876('0x45')]['filter']){_0x12a9e9[_0x0876('0x52')]=_['merge'](_0x12a9e9[_0x0876('0x52')],{'$or':_[_0x0876('0x44')](_0x4b12f1,function(_0x5e79cf){if(_0x5e79cf[_0x0876('0x41')]!==_0x0876('0x53')){var _0x4d328b={};_0x4d328b[_0x5e79cf['name']]={'$like':'%'+_0x2be5c1[_0x0876('0x45')][_0x0876('0x54')]+'%'};return _0x4d328b;}})});}_0x12a9e9=_['merge']({},_0x12a9e9,_0x2be5c1[_0x0876('0x55')]);var _0x1b1200={'where':_0x12a9e9[_0x0876('0x52')]};return db[_0x0876('0x3f')]['count'](_0x1b1200)[_0x0876('0x36')](function(_0x16fa85){_0xec9498[_0x0876('0x31')]=_0x16fa85;if(_0x2be5c1['query'][_0x0876('0x56')]){_0x12a9e9[_0x0876('0x57')]=[{'all':!![]}];}return db[_0x0876('0x3f')][_0x0876('0x58')](_0x12a9e9);})[_0x0876('0x36')](function(_0x49dbb1){_0xec9498['rows']=_0x49dbb1;return _0xec9498;})['then'](respondWithFilteredResult(_0x314578,_0x12a9e9))[_0x0876('0x2a')](handleError(_0x314578,null));};exports[_0x0876('0x59')]=function(_0x1a0a9c,_0x58fa25){var _0x4be2c5={'raw':!![],'where':{'id':_0x1a0a9c[_0x0876('0x5a')]['id']}},_0x40b328={};_0x40b328[_0x0876('0x43')]=_[_0x0876('0x46')](db['ChatQueue']['rawAttributes']);_0x40b328[_0x0876('0x45')]=_['keys'](_0x1a0a9c[_0x0876('0x45')]);_0x40b328[_0x0876('0x47')]=_[_0x0876('0x48')](_0x40b328[_0x0876('0x43')],_0x40b328[_0x0876('0x45')]);_0x4be2c5['attributes']=_[_0x0876('0x48')](_0x40b328[_0x0876('0x43')],qs[_0x0876('0x4a')](_0x1a0a9c[_0x0876('0x45')][_0x0876('0x4a')]));_0x4be2c5[_0x0876('0x49')]=_0x4be2c5['attributes'][_0x0876('0x4b')]?_0x4be2c5['attributes']:_0x40b328[_0x0876('0x43')];if(_0x1a0a9c[_0x0876('0x45')][_0x0876('0x56')]){_0x4be2c5[_0x0876('0x57')]=[{'all':!![]}];}_0x4be2c5=_[_0x0876('0x5b')]({},_0x4be2c5,_0x1a0a9c[_0x0876('0x55')]);return db[_0x0876('0x3f')]['find'](_0x4be2c5)[_0x0876('0x36')](handleEntityNotFound(_0x58fa25,null))[_0x0876('0x36')](respondWithResult(_0x58fa25,null))[_0x0876('0x2a')](handleError(_0x58fa25,null));};exports[_0x0876('0x5c')]=function(_0x3a922d,_0xf18768){return db[_0x0876('0x3f')]['create'](_0x3a922d['body'],{})['then'](function(_0xd04599){var _0x30a1a5=_0x3a922d[_0x0876('0x5d')][_0x0876('0x37')]({'plain':!![]});if(!_0x30a1a5)throw new Error(_0x0876('0x5e'));if(_0x30a1a5[_0x0876('0x5f')]===_0x0876('0x5d')){var _0x1a4faf=_0xd04599['get']({'plain':!![]});var _0x22de74=_0x0876('0x38');return db[_0x0876('0x60')]['find']({'where':{'name':_0x22de74,'userProfileId':_0x30a1a5[_0x0876('0x61')]},'raw':!![]})[_0x0876('0x36')](function(_0x551a84){if(_0x551a84&&_0x551a84[_0x0876('0x62')]===0x0){return db['UserProfileResource'][_0x0876('0x5c')]({'name':_0x1a4faf['name'],'resourceId':_0x1a4faf['id'],'type':_0x551a84[_0x0876('0x3c')],'sectionId':_0x551a84['id']},{})[_0x0876('0x36')](function(){return _0xd04599;});}else{return _0xd04599;}})['catch'](function(_0x50578c){logger['error'](_0x0876('0x63'),_0x50578c);throw _0x50578c;});}return _0xd04599;})[_0x0876('0x36')](respondWithResult(_0xf18768,0xc9))[_0x0876('0x2a')](handleError(_0xf18768,null));};exports[_0x0876('0x35')]=function(_0x501a46,_0x5d7c7e){if(_0x501a46[_0x0876('0x64')]['id']){delete _0x501a46[_0x0876('0x64')]['id'];}return db[_0x0876('0x3f')]['find']({'where':{'id':_0x501a46['params']['id']}})[_0x0876('0x36')](handleEntityNotFound(_0x5d7c7e,null))[_0x0876('0x36')](saveUpdates(_0x501a46[_0x0876('0x64')],null))[_0x0876('0x36')](respondWithResult(_0x5d7c7e,null))[_0x0876('0x2a')](handleError(_0x5d7c7e,null));};exports[_0x0876('0x3a')]=function(_0x983c3e,_0x151003){return db[_0x0876('0x3f')][_0x0876('0x65')]({'where':{'id':_0x983c3e[_0x0876('0x5a')]['id']}})[_0x0876('0x36')](handleEntityNotFound(_0x151003,null))['then'](removeEntity(_0x151003,null))[_0x0876('0x2a')](handleError(_0x151003,null));};exports[_0x0876('0x66')]=function(_0xa6eff8,_0x2ff4e4){return db[_0x0876('0x3f')][_0x0876('0x66')]()[_0x0876('0x36')](respondWithResult(_0x2ff4e4,null))['catch'](handleError(_0x2ff4e4,null));};exports[_0x0876('0x67')]=function(_0xcd6094,_0x3f92f3,_0x3a509f){var _0x490127={'raw':!![],'where':{}},_0x277c77={},_0x6fe262;return db[_0x0876('0x3f')][_0x0876('0x68')]({'where':{'id':_0xcd6094[_0x0876('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3f92f3,null))[_0x0876('0x36')](function(_0x20b154){if(_0x20b154){_0x6fe262=_0x20b154[_0x0876('0x37')]({'plain':!![]});_0x277c77[_0x0876('0x43')]=_[_0x0876('0x46')](db['UserChatQueue']['rawAttributes']);_0x277c77['query']=_[_0x0876('0x46')](_0xcd6094['query']);_0x277c77[_0x0876('0x47')]=_['intersection'](_0x277c77[_0x0876('0x43')],_0x277c77[_0x0876('0x45')]);_0x490127[_0x0876('0x49')]=_[_0x0876('0x48')](_0x277c77[_0x0876('0x43')],qs[_0x0876('0x4a')](_0xcd6094[_0x0876('0x45')]['fields']));_0x490127[_0x0876('0x49')]=_0x490127[_0x0876('0x49')][_0x0876('0x4b')]?_0x490127[_0x0876('0x49')]:_0x277c77[_0x0876('0x43')];if(!_0xcd6094['query']['hasOwnProperty'](_0x0876('0x4d'))){_0x490127[_0x0876('0x4e')]=qs[_0x0876('0x4e')](_0xcd6094[_0x0876('0x45')][_0x0876('0x4e')]);_0x490127[_0x0876('0x2f')]=qs[_0x0876('0x2f')](_0xcd6094[_0x0876('0x45')]['offset']);}_0x490127['order']=qs[_0x0876('0x50')](_0xcd6094[_0x0876('0x45')][_0x0876('0x50')]);_0x490127['where']=qs[_0x0876('0x47')](_['pick'](_0xcd6094[_0x0876('0x45')],_0x277c77[_0x0876('0x47')]));_0x490127[_0x0876('0x52')][_0x0876('0x69')]=_0x20b154['id'];if(_0xcd6094['query'][_0x0876('0x54')]){_0x490127['where']=_[_0x0876('0x5b')](_0x490127['where'],{'$or':_[_0x0876('0x44')](_0x490127[_0x0876('0x49')],function(_0x475a00){var _0x56431a={};_0x56431a[_0x475a00]={'$like':'%'+_0xcd6094[_0x0876('0x45')][_0x0876('0x54')]+'%'};return _0x56431a;})});}_0x490127=_[_0x0876('0x5b')]({},_0x490127,_0xcd6094[_0x0876('0x55')]);return db['UserChatQueue'][_0x0876('0x58')](_0x490127);}})[_0x0876('0x36')](function(_0xed3537){if(_0xed3537){return db[_0x0876('0x6a')][_0x0876('0x6b')]({'where':{'id':_[_0x0876('0x44')](_0xed3537,_0x0876('0x6c')),'role':_0x0876('0x6d')},'attributes':['id',_0x0876('0x3c'),_0x0876('0x6e'),'updatedAt','createdAt']});}})['then'](function(_0x15d962){if(_0x15d962){return{'count':_0x15d962['count'],'rows':_[_0x0876('0x44')](_0x15d962[_0x0876('0x6f')],function(_0x1adc3b){return{'membername':_0x1adc3b[_0x0876('0x3c')],'UserId':_0x1adc3b['id'],'queue_name':_0x6fe262['name'],'ChatQueueId':_0x6fe262['id'],'interface':util[_0x0876('0x70')](_0x0876('0x71'),_0x0876('0x72'),_0x1adc3b[_0x0876('0x3c')]),'penalty':0x0,'paused':_0x1adc3b['chatPause'],'createdAt':_0x1adc3b[_0x0876('0x73')],'updatedAt':_0x1adc3b[_0x0876('0x74')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0876('0x36')](respondWithFilteredResult(_0x3f92f3,_0x490127))[_0x0876('0x2a')](handleError(_0x3f92f3,null));};exports['getTeams']=function(_0x1d65c8,_0x11e4c2,_0x40d8be){var _0x24767b={};var _0x172977={};var _0x1d6862;var _0x5cb767;return db[_0x0876('0x3f')][_0x0876('0x68')]({'where':{'id':_0x1d65c8[_0x0876('0x5a')]['id']}})[_0x0876('0x36')](handleEntityNotFound(_0x11e4c2,null))[_0x0876('0x36')](function(_0x7f5ef5){if(_0x7f5ef5){_0x1d6862=_0x7f5ef5;_0x172977['model']=_['keys'](db[_0x0876('0x75')][_0x0876('0x76')]);_0x172977['query']=_['keys'](_0x1d65c8[_0x0876('0x45')]);_0x172977[_0x0876('0x47')]=_[_0x0876('0x48')](_0x172977[_0x0876('0x43')],_0x172977[_0x0876('0x45')]);_0x24767b[_0x0876('0x49')]=_[_0x0876('0x48')](_0x172977[_0x0876('0x43')],qs[_0x0876('0x4a')](_0x1d65c8[_0x0876('0x45')]['fields']));_0x24767b[_0x0876('0x49')]=_0x24767b[_0x0876('0x49')][_0x0876('0x4b')]?_0x24767b[_0x0876('0x49')]:_0x172977[_0x0876('0x43')];_0x24767b[_0x0876('0x4f')]=qs['sort'](_0x1d65c8[_0x0876('0x45')][_0x0876('0x50')]);_0x24767b[_0x0876('0x52')]=qs[_0x0876('0x47')](_[_0x0876('0x51')](_0x1d65c8['query'],_0x172977['filters']));if(_0x1d65c8['query'][_0x0876('0x54')]){_0x24767b[_0x0876('0x52')]=_[_0x0876('0x5b')](_0x24767b['where'],{'$or':_[_0x0876('0x44')](_0x24767b[_0x0876('0x49')],function(_0x8e4610){var _0xd399e9={};_0xd399e9[_0x8e4610]={'$like':'%'+_0x1d65c8['query']['filter']+'%'};return _0xd399e9;})});}_0x24767b=_[_0x0876('0x5b')]({},_0x24767b,_0x1d65c8[_0x0876('0x55')]);return _0x1d6862['getTeams'](_0x24767b);}})[_0x0876('0x36')](function(_0x5099cd){if(_0x5099cd){_0x5cb767=_0x5099cd[_0x0876('0x4b')];if(!_0x1d65c8[_0x0876('0x45')]['hasOwnProperty']('nolimit')){_0x24767b[_0x0876('0x4e')]=qs[_0x0876('0x4e')](_0x1d65c8[_0x0876('0x45')][_0x0876('0x4e')]);_0x24767b[_0x0876('0x2f')]=qs[_0x0876('0x2f')](_0x1d65c8['query']['offset']);}return _0x1d6862['getTeams'](_0x24767b);}})[_0x0876('0x36')](function(_0x527d5f){if(_0x527d5f){return _0x527d5f?{'count':_0x5cb767,'rows':_0x527d5f}:null;}})[_0x0876('0x36')](respondWithResult(_0x11e4c2,null))[_0x0876('0x2a')](handleError(_0x11e4c2,null));};exports[_0x0876('0x77')]=function(_0x2d358c,_0xca6bc3,_0xb643c9){var _0x1209d1=_0x2d358c[_0x0876('0x64')][_0x0876('0x78')];return db[_0x0876('0x75')][_0x0876('0x58')]({'where':{'id':_0x1209d1},'attributes':['id'],'include':[{'model':db[_0x0876('0x6a')],'as':'Agents','attributes':['id',_0x0876('0x3c'),_0x0876('0x79'),_0x0876('0x7a'),_0x0876('0x7b')],'raw':!![]}]})[_0x0876('0x36')](function(_0x360301){if(_0x360301){var _0x2b285f=_[_0x0876('0x7c')](_0x360301,function(_0x44dd1b){var _0x5c38df=_0x44dd1b[_0x0876('0x37')]({'plain':!![]});return _0x5c38df[_0x0876('0x7d')];});return db[_0x0876('0x3f')][_0x0876('0x65')]({'where':{'id':_0x2d358c[_0x0876('0x5a')]['id']}})[_0x0876('0x36')](function(_0x184552){return db['sequelize']['transaction'](function(_0xcc2d0e){return _0x184552[_0x0876('0x77')](_0x1209d1,{'transaction':_0xcc2d0e})[_0x0876('0x36')](function(){return BPromise[_0x0876('0x7e')](_0x2b285f,function(_0x29179f){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x29179f['id'],'ChatQueueId':_0x2d358c['params']['id']},'transaction':_0xcc2d0e});});})['then'](function(){_0x2b285f[_0x0876('0x7f')](function(_0x254b07){socket[_0x0876('0x80')](_0x0876('0x81'),{'UserId':_0x254b07['id'],'ChatQueueId':_0x184552['id']});});});});});}})[_0x0876('0x36')](respondWithStatusCode(_0xca6bc3,null))[_0x0876('0x2a')](handleError(_0xca6bc3,null));};exports['removeTeams']=function(_0x40b5f5,_0x1a793b,_0x2d76b9){return db[_0x0876('0x75')][_0x0876('0x58')]({'where':{'id':_0x40b5f5[_0x0876('0x45')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0876('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0876('0x36')](handleEntityNotFound(_0x1a793b,null))[_0x0876('0x36')](function(_0xddac92){var _0x24026e=_[_0x0876('0x44')](_0xddac92,'id');var _0x4f35da=[];var _0x3b39ce=[];var _0x1ac41d=squel['select']();_0x1ac41d[_0x0876('0x82')]('tq.TeamId')[_0x0876('0x83')](_0x0876('0x84'),'tq')[_0x0876('0x85')](_0x0876('0x86'),'ut',_0x0876('0x87'))['where'](_0x0876('0x88'),_0x40b5f5[_0x0876('0x5a')]['id']);for(var _0x20ebd7=0x0;_0x20ebd7<_0xddac92['length'];_0x20ebd7+=0x1){let _0x56b2d5=_0xddac92[_0x20ebd7];for(var _0x22f735=0x0;_0x22f735<_0x56b2d5['Agents'][_0x0876('0x4b')];_0x22f735+=0x1){let _0x47af80=_0x56b2d5[_0x0876('0x7d')][_0x22f735];var _0x533146=_0x1ac41d[_0x0876('0x89')]();_0x533146[_0x0876('0x52')](_0x0876('0x8a'),_0x47af80['id']);_0x3b39ce['push'](db['sequelize']['query'](_0x533146[_0x0876('0x8b')](),{'type':db[_0x0876('0x8c')][_0x0876('0x8d')][_0x0876('0x8e')]})['then'](function(_0x206faf){if(_0x206faf[_0x0876('0x4b')]===0x1){return _0x47af80['id'];}else{var _0x58fb8d=_[_0x0876('0x8f')](_[_0x0876('0x44')](_0x206faf,_0x0876('0x90')),function(_0x5daaa8){return _[_0x0876('0x91')](_0x24026e,_0x5daaa8);});if(_0x58fb8d){return _0x47af80['id'];}}}));}}return BPromise[_0x0876('0x92')](_0x3b39ce)[_0x0876('0x36')](function(_0x394e3a){_0x4f35da=_(_0x4f35da)[_0x0876('0x93')](_0x394e3a)['compact']()[_0x0876('0x94')]();return db[_0x0876('0x3f')][_0x0876('0x65')]({'where':{'id':_0x40b5f5[_0x0876('0x5a')]['id']}})[_0x0876('0x36')](function(_0x1c2635){return db['sequelize'][_0x0876('0x95')](function(_0x53e0aa){return _0x1c2635[_0x0876('0x96')](_0x40b5f5[_0x0876('0x45')][_0x0876('0x78')],{'transaction':_0x53e0aa})[_0x0876('0x36')](function(){if(!_[_0x0876('0x97')](_0x4f35da)){return _0x1c2635[_0x0876('0x98')](_0x4f35da,{'transaction':_0x53e0aa});}})['then'](function(){_0x4f35da['forEach'](function(_0x315ce1){socket[_0x0876('0x80')](_0x0876('0x99'),{'UserId':_0x315ce1,'ChatQueueId':_0x1c2635['id']});});});});});});})[_0x0876('0x36')](respondWithStatusCode(_0x1a793b,null))[_0x0876('0x2a')](handleError(_0x1a793b,null));};exports['addAgents']=function(_0x496d3f,_0x122dd9,_0xc8b26a){return db[_0x0876('0x3f')][_0x0876('0x65')]({'where':{'id':_0x496d3f[_0x0876('0x5a')]['id']}})[_0x0876('0x36')](handleEntityNotFound(_0x122dd9,null))[_0x0876('0x36')](function(_0x45a245){if(_0x45a245){return _0x45a245[_0x0876('0x9a')](_0x496d3f[_0x0876('0x64')][_0x0876('0x78')],_[_0x0876('0x9b')](_0x496d3f[_0x0876('0x64')],[_0x0876('0x78'),'id'])||{})[_0x0876('0x9c')](function(_0x58d861){for(var _0x501a1b=0x0;_0x501a1b<_0x496d3f['body'][_0x0876('0x78')]['length'];_0x501a1b+=0x1){socket['emit'](_0x0876('0x81'),{'UserId':Number(_0x496d3f[_0x0876('0x64')][_0x0876('0x78')][_0x501a1b]),'ChatQueueId':Number(_0x496d3f[_0x0876('0x5a')]['id'])});}return _0x58d861;});}})[_0x0876('0x36')](respondWithResult(_0x122dd9,null))['catch'](handleError(_0x122dd9,null));};exports[_0x0876('0x98')]=function(_0x44c3f2,_0x367e9f,_0x5b12f8){return db[_0x0876('0x3f')][_0x0876('0x65')]({'where':{'id':_0x44c3f2['params']['id']}})[_0x0876('0x36')](handleEntityNotFound(_0x367e9f,null))[_0x0876('0x36')](function(_0x2bb535){if(_0x2bb535){return _0x2bb535[_0x0876('0x98')](_0x44c3f2[_0x0876('0x45')][_0x0876('0x78')])[_0x0876('0x36')](function(){if(_['isArray'](_0x44c3f2[_0x0876('0x45')]['ids'])){for(var _0x29948e=0x0;_0x29948e<_0x44c3f2[_0x0876('0x45')][_0x0876('0x78')][_0x0876('0x4b')];_0x29948e+=0x1){socket[_0x0876('0x80')](_0x0876('0x99'),{'UserId':Number(_0x44c3f2[_0x0876('0x45')][_0x0876('0x78')][_0x29948e]),'ChatQueueId':Number(_0x44c3f2[_0x0876('0x5a')]['id'])});}}else{socket[_0x0876('0x80')](_0x0876('0x99'),{'UserId':Number(_0x44c3f2[_0x0876('0x45')][_0x0876('0x78')]),'ChatQueueId':Number(_0x44c3f2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x367e9f,null))['catch'](handleError(_0x367e9f,null));};exports[_0x0876('0x9d')]=function(_0x3b93e7,_0x14fea0,_0xc305bc){var _0x5ef0be={};var _0x11345a={};var _0x4ed2dc;var _0x1fd5e2;return db['ChatQueue'][_0x0876('0x68')]({'where':{'id':_0x3b93e7[_0x0876('0x5a')]['id']}})[_0x0876('0x36')](handleEntityNotFound(_0x14fea0,null))[_0x0876('0x36')](function(_0x3b6d1d){if(_0x3b6d1d){_0x4ed2dc=_0x3b6d1d;_0x11345a['model']=_[_0x0876('0x46')](db['User'][_0x0876('0x76')]);_0x11345a[_0x0876('0x45')]=_[_0x0876('0x46')](_0x3b93e7['query']);_0x11345a[_0x0876('0x47')]=_['intersection'](_0x11345a['model'],_0x11345a[_0x0876('0x45')]);_0x5ef0be[_0x0876('0x49')]=_[_0x0876('0x48')](_0x11345a['model'],qs[_0x0876('0x4a')](_0x3b93e7[_0x0876('0x45')][_0x0876('0x4a')]));_0x5ef0be[_0x0876('0x49')]=_0x5ef0be[_0x0876('0x49')]['length']?_0x5ef0be[_0x0876('0x49')]:_0x11345a[_0x0876('0x43')];_0x5ef0be['order']=qs[_0x0876('0x50')](_0x3b93e7[_0x0876('0x45')]['sort']);_0x5ef0be['where']=qs[_0x0876('0x47')](_[_0x0876('0x51')](_0x3b93e7[_0x0876('0x45')],_0x11345a[_0x0876('0x47')]));if(_0x3b93e7[_0x0876('0x45')][_0x0876('0x54')]){_0x5ef0be[_0x0876('0x52')]=_['merge'](_0x5ef0be[_0x0876('0x52')],{'$or':_['map'](_0x5ef0be[_0x0876('0x49')],function(_0x2ed4cd){var _0x2b7fc5={};_0x2b7fc5[_0x2ed4cd]={'$like':'%'+_0x3b93e7[_0x0876('0x45')][_0x0876('0x54')]+'%'};return _0x2b7fc5;})});}_0x5ef0be=_['merge']({},_0x5ef0be,_0x3b93e7['options']);return _0x4ed2dc[_0x0876('0x9d')](_0x5ef0be);}})[_0x0876('0x36')](function(_0x36793c){if(_0x36793c){_0x1fd5e2=_0x36793c[_0x0876('0x4b')];if(!_0x3b93e7[_0x0876('0x45')][_0x0876('0x4c')](_0x0876('0x4d'))){_0x5ef0be[_0x0876('0x4e')]=qs[_0x0876('0x4e')](_0x3b93e7[_0x0876('0x45')][_0x0876('0x4e')]);_0x5ef0be['offset']=qs[_0x0876('0x2f')](_0x3b93e7['query'][_0x0876('0x2f')]);}return _0x4ed2dc[_0x0876('0x9d')](_0x5ef0be);}})[_0x0876('0x36')](function(_0x226f25){if(_0x226f25){return _0x226f25?{'count':_0x1fd5e2,'rows':_0x226f25}:null;}})[_0x0876('0x36')](respondWithResult(_0x14fea0,null))[_0x0876('0x2a')](handleError(_0x14fea0,null));}; \ No newline at end of file +var _0xbb94=['from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','get','ChatQueues','UserProfileResource','name','index','ChatQueue','rawAttributes','fieldName','type','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','chatPause','updatedAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId'];(function(_0x10fb80,_0x4a842c){var _0x2f1939=function(_0x28d15a){while(--_0x28d15a){_0x10fb80['push'](_0x10fb80['shift']());}};_0x2f1939(++_0x4a842c);}(_0xbb94,0x1e9));var _0x4bb9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbb94[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x4bb9('0x0'));var rimraf=require(_0x4bb9('0x1'));var zipdir=require(_0x4bb9('0x2'));var jsonpatch=require(_0x4bb9('0x3'));var rp=require(_0x4bb9('0x4'));var moment=require(_0x4bb9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4bb9('0x6'));var util=require(_0x4bb9('0x7'));var path=require(_0x4bb9('0x8'));var sox=require(_0x4bb9('0x9'));var csv=require(_0x4bb9('0xa'));var ejs=require(_0x4bb9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bb9('0xc'));var squel=require(_0x4bb9('0xd'));var crypto=require(_0x4bb9('0xe'));var jsforce=require(_0x4bb9('0xf'));var deskjs=require(_0x4bb9('0x10'));var toCsv=require(_0x4bb9('0xa'));var querystring=require(_0x4bb9('0x11'));var Papa=require('papaparse');var Redis=require(_0x4bb9('0x12'));var authService=require(_0x4bb9('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bb9('0x14'));var logger=require('../../config/logger')(_0x4bb9('0x15'));var utils=require(_0x4bb9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4bb9('0x17'))['db'];config[_0x4bb9('0x18')]=_['defaults'](config[_0x4bb9('0x18')],{'host':_0x4bb9('0x19'),'port':0x18eb});var socket=require(_0x4bb9('0x1a'))(new Redis(config['redis']));require(_0x4bb9('0x1b'))[_0x4bb9('0x1c')](socket);var jayson=require(_0x4bb9('0x1d'));var client=jayson[_0x4bb9('0x1e')][_0x4bb9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x36638d,_0x3afb3b,_0x57ff9c,_0x3d8c6f){return new BPromise(function(_0x5922f0,_0xbbb62b){var _0x322ab5=_0x3d8c6f||client;return _0x322ab5[_0x4bb9('0x20')](_0x36638d,_0x57ff9c)[_0x4bb9('0x21')](function(_0x4f82d7){logger[_0x4bb9('0x22')](_0x4bb9('0x23'),_0x3afb3b,_0x4bb9('0x24'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3afb3b,'request\x20sent',JSON[_0x4bb9('0x25')](_0x4f82d7));if(_0x4f82d7['error']){if(_0x4f82d7[_0x4bb9('0x26')]['code']===0x1f4){logger[_0x4bb9('0x26')](_0x4bb9('0x23'),_0x3afb3b,_0x4f82d7['error'][_0x4bb9('0x27')]);return _0xbbb62b(_0x4f82d7[_0x4bb9('0x26')][_0x4bb9('0x27')]);}logger[_0x4bb9('0x26')](_0x4bb9('0x23'),_0x3afb3b,_0x4f82d7[_0x4bb9('0x26')]['message']);return _0x5922f0(_0x4f82d7[_0x4bb9('0x26')][_0x4bb9('0x27')]);}else{logger[_0x4bb9('0x22')]('ChatQueue,\x20%s,\x20%s',_0x3afb3b,_0x4bb9('0x24'));_0x5922f0(_0x4f82d7[_0x4bb9('0x28')][_0x4bb9('0x27')]);}})[_0x4bb9('0x29')](function(_0x915584){logger[_0x4bb9('0x26')](_0x4bb9('0x23'),_0x3afb3b,_0x915584);_0xbbb62b(_0x915584);});});}function respondWithStatusCode(_0x4d0ab5,_0x16721a){_0x16721a=_0x16721a||0xcc;return function(_0x9c8f8c){if(_0x9c8f8c){return _0x4d0ab5[_0x4bb9('0x2a')](_0x16721a);}return _0x4d0ab5[_0x4bb9('0x2b')](_0x16721a)[_0x4bb9('0x2c')]();};}function respondWithResult(_0x1c22d3,_0x233c9b){_0x233c9b=_0x233c9b||0xc8;return function(_0x1524b1){if(_0x1524b1){return _0x1c22d3[_0x4bb9('0x2b')](_0x233c9b)[_0x4bb9('0x2d')](_0x1524b1);}};}function respondWithFilteredResult(_0x2b4c02,_0x3e8552){return function(_0x352eb2){if(_0x352eb2){var _0x1e0b56=typeof _0x3e8552['offset']==='undefined'&&typeof _0x3e8552['limit']==='undefined';var _0x38408c=_0x352eb2[_0x4bb9('0x2e')];var _0x33f03c=_0x1e0b56?0x0:_0x3e8552['offset'];var _0x463463=_0x1e0b56?_0x352eb2[_0x4bb9('0x2e')]:_0x3e8552[_0x4bb9('0x2f')]+_0x3e8552['limit'];var _0xc96305;if(_0x463463>=_0x38408c){_0x463463=_0x38408c;_0xc96305=0xc8;}else{_0xc96305=0xce;}_0x2b4c02[_0x4bb9('0x2b')](_0xc96305);return _0x2b4c02[_0x4bb9('0x30')](_0x4bb9('0x31'),_0x33f03c+'-'+_0x463463+'/'+_0x38408c)[_0x4bb9('0x2d')](_0x352eb2);}return null;};}function patchUpdates(_0x2feae6){return function(_0x27d38c){try{jsonpatch[_0x4bb9('0x32')](_0x27d38c,_0x2feae6,!![]);}catch(_0x4cf9db){return BPromise[_0x4bb9('0x33')](_0x4cf9db);}return _0x27d38c[_0x4bb9('0x34')]();};}function saveUpdates(_0x1a97da,_0x1bba9d){return function(_0xa058e2){if(_0xa058e2){return _0xa058e2['update'](_0x1a97da)[_0x4bb9('0x21')](function(_0x3888a1){return _0x3888a1;});}return null;};}function removeEntity(_0x4eabc4,_0x1c36a6){return function(_0x1f265d){if(_0x1f265d){return _0x1f265d[_0x4bb9('0x35')]()[_0x4bb9('0x21')](function(){var _0x495969=_0x1f265d[_0x4bb9('0x36')]({'plain':!![]});var _0x4df9a8=_0x4bb9('0x37');return db[_0x4bb9('0x38')][_0x4bb9('0x35')]({'where':{'type':_0x4df9a8,'resourceId':_0x495969['id']}})[_0x4bb9('0x21')](function(){return _0x1f265d;});})[_0x4bb9('0x21')](function(){_0x4eabc4[_0x4bb9('0x2b')](0xcc)[_0x4bb9('0x2c')]();});}};}function handleEntityNotFound(_0x1631ab,_0x599688){return function(_0x5550c3){if(!_0x5550c3){_0x1631ab[_0x4bb9('0x2a')](0x194);}return _0x5550c3;};}function handleError(_0x5ed065,_0x44a45b){_0x44a45b=_0x44a45b||0x1f4;return function(_0x31dff0){logger['error'](_0x31dff0['stack']);if(_0x31dff0[_0x4bb9('0x39')]){delete _0x31dff0[_0x4bb9('0x39')];}_0x5ed065['status'](_0x44a45b)['send'](_0x31dff0);};}exports[_0x4bb9('0x3a')]=function(_0x5ca061,_0x45d0cd){var _0x75b94e={},_0x41817b={},_0xc59070={'count':0x0,'rows':[]};var _0x27703b=_['map'](db[_0x4bb9('0x3b')][_0x4bb9('0x3c')],function(_0x15a5ad){return{'name':_0x15a5ad[_0x4bb9('0x3d')],'type':_0x15a5ad[_0x4bb9('0x3e')][_0x4bb9('0x3f')]};});_0x41817b['model']=_[_0x4bb9('0x40')](_0x27703b,_0x4bb9('0x39'));_0x41817b[_0x4bb9('0x41')]=_['keys'](_0x5ca061['query']);_0x41817b[_0x4bb9('0x42')]=_['intersection'](_0x41817b['model'],_0x41817b[_0x4bb9('0x41')]);_0x75b94e[_0x4bb9('0x43')]=_[_0x4bb9('0x44')](_0x41817b[_0x4bb9('0x45')],qs['fields'](_0x5ca061[_0x4bb9('0x41')][_0x4bb9('0x46')]));_0x75b94e['attributes']=_0x75b94e[_0x4bb9('0x43')][_0x4bb9('0x47')]?_0x75b94e[_0x4bb9('0x43')]:_0x41817b[_0x4bb9('0x45')];if(!_0x5ca061['query'][_0x4bb9('0x48')](_0x4bb9('0x49'))){_0x75b94e[_0x4bb9('0x4a')]=qs[_0x4bb9('0x4a')](_0x5ca061[_0x4bb9('0x41')][_0x4bb9('0x4a')]);_0x75b94e[_0x4bb9('0x2f')]=qs[_0x4bb9('0x2f')](_0x5ca061[_0x4bb9('0x41')][_0x4bb9('0x2f')]);}_0x75b94e['order']=qs[_0x4bb9('0x4b')](_0x5ca061['query'][_0x4bb9('0x4b')]);_0x75b94e[_0x4bb9('0x4c')]=qs[_0x4bb9('0x42')](_['pick'](_0x5ca061[_0x4bb9('0x41')],_0x41817b['filters']),_0x27703b);if(_0x5ca061[_0x4bb9('0x41')]['filter']){_0x75b94e[_0x4bb9('0x4c')]=_[_0x4bb9('0x4d')](_0x75b94e[_0x4bb9('0x4c')],{'$or':_[_0x4bb9('0x40')](_0x27703b,function(_0x182285){if(_0x182285[_0x4bb9('0x3e')]!==_0x4bb9('0x4e')){var _0x1a6fd8={};_0x1a6fd8[_0x182285[_0x4bb9('0x39')]]={'$like':'%'+_0x5ca061[_0x4bb9('0x41')][_0x4bb9('0x4f')]+'%'};return _0x1a6fd8;}})});}_0x75b94e=_[_0x4bb9('0x4d')]({},_0x75b94e,_0x5ca061['options']);var _0x111a9a={'where':_0x75b94e[_0x4bb9('0x4c')]};return db[_0x4bb9('0x3b')][_0x4bb9('0x2e')](_0x111a9a)['then'](function(_0x5c13c2){_0xc59070[_0x4bb9('0x2e')]=_0x5c13c2;if(_0x5ca061['query'][_0x4bb9('0x50')]){_0x75b94e['include']=[{'all':!![]}];}return db[_0x4bb9('0x3b')][_0x4bb9('0x51')](_0x75b94e);})[_0x4bb9('0x21')](function(_0x31c5fc){_0xc59070[_0x4bb9('0x52')]=_0x31c5fc;return _0xc59070;})['then'](respondWithFilteredResult(_0x45d0cd,_0x75b94e))['catch'](handleError(_0x45d0cd,null));};exports[_0x4bb9('0x53')]=function(_0x2dd027,_0xa6fa50){var _0x3cb440={'raw':!![],'where':{'id':_0x2dd027[_0x4bb9('0x54')]['id']}},_0x1d4170={};_0x1d4170[_0x4bb9('0x45')]=_[_0x4bb9('0x55')](db['ChatQueue'][_0x4bb9('0x3c')]);_0x1d4170[_0x4bb9('0x41')]=_['keys'](_0x2dd027[_0x4bb9('0x41')]);_0x1d4170[_0x4bb9('0x42')]=_['intersection'](_0x1d4170[_0x4bb9('0x45')],_0x1d4170[_0x4bb9('0x41')]);_0x3cb440[_0x4bb9('0x43')]=_['intersection'](_0x1d4170[_0x4bb9('0x45')],qs[_0x4bb9('0x46')](_0x2dd027['query'][_0x4bb9('0x46')]));_0x3cb440[_0x4bb9('0x43')]=_0x3cb440[_0x4bb9('0x43')][_0x4bb9('0x47')]?_0x3cb440['attributes']:_0x1d4170[_0x4bb9('0x45')];if(_0x2dd027[_0x4bb9('0x41')][_0x4bb9('0x50')]){_0x3cb440['include']=[{'all':!![]}];}_0x3cb440=_[_0x4bb9('0x4d')]({},_0x3cb440,_0x2dd027[_0x4bb9('0x56')]);return db[_0x4bb9('0x3b')]['find'](_0x3cb440)['then'](handleEntityNotFound(_0xa6fa50,null))[_0x4bb9('0x21')](respondWithResult(_0xa6fa50,null))[_0x4bb9('0x29')](handleError(_0xa6fa50,null));};exports[_0x4bb9('0x57')]=function(_0x210980,_0x516df3){return db[_0x4bb9('0x3b')]['create'](_0x210980[_0x4bb9('0x58')],{})['then'](function(_0x5e579d){var _0x4531f2=_0x210980[_0x4bb9('0x59')][_0x4bb9('0x36')]({'plain':!![]});if(!_0x4531f2)throw new Error(_0x4bb9('0x5a'));if(_0x4531f2[_0x4bb9('0x5b')]===_0x4bb9('0x59')){var _0x7f5fd1=_0x5e579d[_0x4bb9('0x36')]({'plain':!![]});var _0x589205=_0x4bb9('0x37');return db[_0x4bb9('0x5c')][_0x4bb9('0x5d')]({'where':{'name':_0x589205,'userProfileId':_0x4531f2[_0x4bb9('0x5e')]},'raw':!![]})[_0x4bb9('0x21')](function(_0x4c2458){if(_0x4c2458&&_0x4c2458[_0x4bb9('0x5f')]===0x0){return db[_0x4bb9('0x38')][_0x4bb9('0x57')]({'name':_0x7f5fd1[_0x4bb9('0x39')],'resourceId':_0x7f5fd1['id'],'type':_0x4c2458[_0x4bb9('0x39')],'sectionId':_0x4c2458['id']},{})['then'](function(){return _0x5e579d;});}else{return _0x5e579d;}})[_0x4bb9('0x29')](function(_0x2cc849){logger[_0x4bb9('0x26')](_0x4bb9('0x60'),_0x2cc849);throw _0x2cc849;});}return _0x5e579d;})[_0x4bb9('0x21')](respondWithResult(_0x516df3,0xc9))[_0x4bb9('0x29')](handleError(_0x516df3,null));};exports[_0x4bb9('0x61')]=function(_0x27f8ed,_0x21dd50){if(_0x27f8ed[_0x4bb9('0x58')]['id']){delete _0x27f8ed[_0x4bb9('0x58')]['id'];}return db[_0x4bb9('0x3b')][_0x4bb9('0x5d')]({'where':{'id':_0x27f8ed[_0x4bb9('0x54')]['id']}})[_0x4bb9('0x21')](handleEntityNotFound(_0x21dd50,null))[_0x4bb9('0x21')](saveUpdates(_0x27f8ed[_0x4bb9('0x58')],null))[_0x4bb9('0x21')](respondWithResult(_0x21dd50,null))[_0x4bb9('0x29')](handleError(_0x21dd50,null));};exports['destroy']=function(_0x34db84,_0x25dcb2){return db[_0x4bb9('0x3b')][_0x4bb9('0x5d')]({'where':{'id':_0x34db84[_0x4bb9('0x54')]['id']}})[_0x4bb9('0x21')](handleEntityNotFound(_0x25dcb2,null))['then'](removeEntity(_0x25dcb2,null))[_0x4bb9('0x29')](handleError(_0x25dcb2,null));};exports[_0x4bb9('0x62')]=function(_0x1541ce,_0x5d9896){return db['ChatQueue'][_0x4bb9('0x62')]()[_0x4bb9('0x21')](respondWithResult(_0x5d9896,null))[_0x4bb9('0x29')](handleError(_0x5d9896,null));};exports['getMembers']=function(_0x60cbbd,_0x35b8c0,_0x4af186){var _0x2691ec={'raw':!![],'where':{}},_0x5565a9={},_0x167cb5;return db[_0x4bb9('0x3b')][_0x4bb9('0x63')]({'where':{'id':_0x60cbbd[_0x4bb9('0x54')]['id']}})['then'](handleEntityNotFound(_0x35b8c0,null))[_0x4bb9('0x21')](function(_0x23e358){if(_0x23e358){_0x167cb5=_0x23e358[_0x4bb9('0x36')]({'plain':!![]});_0x5565a9[_0x4bb9('0x45')]=_['keys'](db[_0x4bb9('0x64')][_0x4bb9('0x3c')]);_0x5565a9[_0x4bb9('0x41')]=_[_0x4bb9('0x55')](_0x60cbbd[_0x4bb9('0x41')]);_0x5565a9[_0x4bb9('0x42')]=_[_0x4bb9('0x44')](_0x5565a9[_0x4bb9('0x45')],_0x5565a9['query']);_0x2691ec[_0x4bb9('0x43')]=_['intersection'](_0x5565a9[_0x4bb9('0x45')],qs[_0x4bb9('0x46')](_0x60cbbd['query'][_0x4bb9('0x46')]));_0x2691ec[_0x4bb9('0x43')]=_0x2691ec[_0x4bb9('0x43')][_0x4bb9('0x47')]?_0x2691ec['attributes']:_0x5565a9[_0x4bb9('0x45')];if(!_0x60cbbd[_0x4bb9('0x41')][_0x4bb9('0x48')](_0x4bb9('0x49'))){_0x2691ec[_0x4bb9('0x4a')]=qs[_0x4bb9('0x4a')](_0x60cbbd['query'][_0x4bb9('0x4a')]);_0x2691ec['offset']=qs[_0x4bb9('0x2f')](_0x60cbbd['query']['offset']);}_0x2691ec['order']=qs[_0x4bb9('0x4b')](_0x60cbbd[_0x4bb9('0x41')]['sort']);_0x2691ec[_0x4bb9('0x4c')]=qs[_0x4bb9('0x42')](_[_0x4bb9('0x65')](_0x60cbbd[_0x4bb9('0x41')],_0x5565a9[_0x4bb9('0x42')]));_0x2691ec[_0x4bb9('0x4c')][_0x4bb9('0x66')]=_0x23e358['id'];if(_0x60cbbd[_0x4bb9('0x41')][_0x4bb9('0x4f')]){_0x2691ec[_0x4bb9('0x4c')]=_[_0x4bb9('0x4d')](_0x2691ec[_0x4bb9('0x4c')],{'$or':_['map'](_0x2691ec[_0x4bb9('0x43')],function(_0x239a99){var _0x3fa887={};_0x3fa887[_0x239a99]={'$like':'%'+_0x60cbbd[_0x4bb9('0x41')][_0x4bb9('0x4f')]+'%'};return _0x3fa887;})});}_0x2691ec=_['merge']({},_0x2691ec,_0x60cbbd['options']);return db[_0x4bb9('0x64')]['findAll'](_0x2691ec);}})[_0x4bb9('0x21')](function(_0x2af289){if(_0x2af289){return db[_0x4bb9('0x67')][_0x4bb9('0x68')]({'where':{'id':_[_0x4bb9('0x40')](_0x2af289,_0x4bb9('0x69')),'role':_0x4bb9('0x6a')},'attributes':['id','name','chatPause','updatedAt',_0x4bb9('0x6b')]});}})[_0x4bb9('0x21')](function(_0x447b0b){if(_0x447b0b){return{'count':_0x447b0b[_0x4bb9('0x2e')],'rows':_[_0x4bb9('0x40')](_0x447b0b[_0x4bb9('0x52')],function(_0x2bbeca){return{'membername':_0x2bbeca[_0x4bb9('0x39')],'UserId':_0x2bbeca['id'],'queue_name':_0x167cb5[_0x4bb9('0x39')],'ChatQueueId':_0x167cb5['id'],'interface':util[_0x4bb9('0x6c')](_0x4bb9('0x6d'),_0x4bb9('0x6e'),_0x2bbeca['name']),'penalty':0x0,'paused':_0x2bbeca[_0x4bb9('0x6f')],'createdAt':_0x2bbeca['createdAt'],'updatedAt':_0x2bbeca[_0x4bb9('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4bb9('0x21')](respondWithFilteredResult(_0x35b8c0,_0x2691ec))[_0x4bb9('0x29')](handleError(_0x35b8c0,null));};exports['getTeams']=function(_0x1c3b01,_0x55ca12,_0x326597){var _0x32e78a={};var _0x5e280d={};var _0x1ea26a;var _0x5de92d;return db[_0x4bb9('0x3b')][_0x4bb9('0x63')]({'where':{'id':_0x1c3b01[_0x4bb9('0x54')]['id']}})[_0x4bb9('0x21')](handleEntityNotFound(_0x55ca12,null))[_0x4bb9('0x21')](function(_0x10618a){if(_0x10618a){_0x1ea26a=_0x10618a;_0x5e280d[_0x4bb9('0x45')]=_['keys'](db[_0x4bb9('0x71')][_0x4bb9('0x3c')]);_0x5e280d['query']=_['keys'](_0x1c3b01[_0x4bb9('0x41')]);_0x5e280d[_0x4bb9('0x42')]=_[_0x4bb9('0x44')](_0x5e280d['model'],_0x5e280d[_0x4bb9('0x41')]);_0x32e78a[_0x4bb9('0x43')]=_[_0x4bb9('0x44')](_0x5e280d[_0x4bb9('0x45')],qs[_0x4bb9('0x46')](_0x1c3b01[_0x4bb9('0x41')][_0x4bb9('0x46')]));_0x32e78a[_0x4bb9('0x43')]=_0x32e78a['attributes'][_0x4bb9('0x47')]?_0x32e78a[_0x4bb9('0x43')]:_0x5e280d['model'];_0x32e78a['order']=qs['sort'](_0x1c3b01[_0x4bb9('0x41')][_0x4bb9('0x4b')]);_0x32e78a['where']=qs[_0x4bb9('0x42')](_[_0x4bb9('0x65')](_0x1c3b01[_0x4bb9('0x41')],_0x5e280d[_0x4bb9('0x42')]));if(_0x1c3b01[_0x4bb9('0x41')][_0x4bb9('0x4f')]){_0x32e78a[_0x4bb9('0x4c')]=_['merge'](_0x32e78a[_0x4bb9('0x4c')],{'$or':_[_0x4bb9('0x40')](_0x32e78a[_0x4bb9('0x43')],function(_0x2f6366){var _0x3cf5cc={};_0x3cf5cc[_0x2f6366]={'$like':'%'+_0x1c3b01[_0x4bb9('0x41')][_0x4bb9('0x4f')]+'%'};return _0x3cf5cc;})});}_0x32e78a=_[_0x4bb9('0x4d')]({},_0x32e78a,_0x1c3b01[_0x4bb9('0x56')]);return _0x1ea26a[_0x4bb9('0x72')](_0x32e78a);}})[_0x4bb9('0x21')](function(_0x3a3ccd){if(_0x3a3ccd){_0x5de92d=_0x3a3ccd['length'];if(!_0x1c3b01[_0x4bb9('0x41')]['hasOwnProperty'](_0x4bb9('0x49'))){_0x32e78a[_0x4bb9('0x4a')]=qs[_0x4bb9('0x4a')](_0x1c3b01['query']['limit']);_0x32e78a[_0x4bb9('0x2f')]=qs['offset'](_0x1c3b01[_0x4bb9('0x41')][_0x4bb9('0x2f')]);}return _0x1ea26a[_0x4bb9('0x72')](_0x32e78a);}})[_0x4bb9('0x21')](function(_0x240c82){if(_0x240c82){return _0x240c82?{'count':_0x5de92d,'rows':_0x240c82}:null;}})['then'](respondWithResult(_0x55ca12,null))[_0x4bb9('0x29')](handleError(_0x55ca12,null));};exports[_0x4bb9('0x73')]=function(_0x3df0fb,_0x5c7b35,_0x184a1f){var _0x3edd6e=_0x3df0fb[_0x4bb9('0x58')][_0x4bb9('0x74')];return db[_0x4bb9('0x71')]['findAll']({'where':{'id':_0x3edd6e},'attributes':['id'],'include':[{'model':db[_0x4bb9('0x67')],'as':_0x4bb9('0x75'),'attributes':['id',_0x4bb9('0x39'),_0x4bb9('0x76'),_0x4bb9('0x77'),'interface'],'raw':!![]}]})['then'](function(_0x29578e){if(_0x29578e){var _0xfcf559=_[_0x4bb9('0x78')](_0x29578e,function(_0x2162c4){var _0x44f323=_0x2162c4[_0x4bb9('0x36')]({'plain':!![]});return _0x44f323[_0x4bb9('0x75')];});return db[_0x4bb9('0x3b')][_0x4bb9('0x5d')]({'where':{'id':_0x3df0fb[_0x4bb9('0x54')]['id']}})[_0x4bb9('0x21')](function(_0x1f7ae4){return db[_0x4bb9('0x79')][_0x4bb9('0x7a')](function(_0x164ff1){return _0x1f7ae4[_0x4bb9('0x73')](_0x3edd6e,{'transaction':_0x164ff1})[_0x4bb9('0x21')](function(){return BPromise[_0x4bb9('0x7b')](_0xfcf559,function(_0x2140bf){return db[_0x4bb9('0x64')][_0x4bb9('0x7c')]({'where':{'UserId':_0x2140bf['id'],'ChatQueueId':_0x3df0fb[_0x4bb9('0x54')]['id']},'transaction':_0x164ff1});});})[_0x4bb9('0x21')](function(){_0xfcf559[_0x4bb9('0x7d')](function(_0x4fe447){socket[_0x4bb9('0x7e')](_0x4bb9('0x7f'),{'UserId':_0x4fe447['id'],'ChatQueueId':_0x1f7ae4['id']});});});});});}})['then'](respondWithStatusCode(_0x5c7b35,null))[_0x4bb9('0x29')](handleError(_0x5c7b35,null));};exports[_0x4bb9('0x80')]=function(_0x165609,_0x44318e,_0x3e8b1c){return db['Team'][_0x4bb9('0x51')]({'where':{'id':_0x165609[_0x4bb9('0x41')][_0x4bb9('0x74')]},'attributes':['id'],'include':[{'model':db[_0x4bb9('0x67')],'as':_0x4bb9('0x75'),'attributes':['id'],'raw':!![]}]})[_0x4bb9('0x21')](handleEntityNotFound(_0x44318e,null))['then'](function(_0x15ff2a){var _0x68e41a=_[_0x4bb9('0x40')](_0x15ff2a,'id');var _0x58ef6f=[];var _0x35d0ce=[];var _0x146a73=squel['select']();_0x146a73[_0x4bb9('0x81')](_0x4bb9('0x82'))[_0x4bb9('0x83')](_0x4bb9('0x84'),'tq')[_0x4bb9('0x85')](_0x4bb9('0x86'),'ut',_0x4bb9('0x87'))['where'](_0x4bb9('0x88'),_0x165609['params']['id']);for(var _0x9ff78d=0x0;_0x9ff78d<_0x15ff2a['length'];_0x9ff78d+=0x1){let _0x2edb17=_0x15ff2a[_0x9ff78d];for(var _0xc08508=0x0;_0xc08508<_0x2edb17[_0x4bb9('0x75')]['length'];_0xc08508+=0x1){let _0x28955d=_0x2edb17[_0x4bb9('0x75')][_0xc08508];var _0xa51029=_0x146a73[_0x4bb9('0x89')]();_0xa51029['where']('ut.UserId\x20=\x20?',_0x28955d['id']);_0x35d0ce['push'](db['sequelize']['query'](_0xa51029[_0x4bb9('0x8a')](),{'type':db['sequelize'][_0x4bb9('0x8b')][_0x4bb9('0x8c')]})[_0x4bb9('0x21')](function(_0x49207d){if(_0x49207d['length']===0x1){return _0x28955d['id'];}else{var _0x492da7=_[_0x4bb9('0x8d')](_[_0x4bb9('0x40')](_0x49207d,_0x4bb9('0x8e')),function(_0x34f2d8){return _[_0x4bb9('0x8f')](_0x68e41a,_0x34f2d8);});if(_0x492da7){return _0x28955d['id'];}}}));}}return BPromise[_0x4bb9('0x90')](_0x35d0ce)[_0x4bb9('0x21')](function(_0x9fc6eb){_0x58ef6f=_(_0x58ef6f)[_0x4bb9('0x91')](_0x9fc6eb)['compact']()[_0x4bb9('0x92')]();return db['ChatQueue'][_0x4bb9('0x5d')]({'where':{'id':_0x165609[_0x4bb9('0x54')]['id']}})[_0x4bb9('0x21')](function(_0x5a0a0f){return db['sequelize'][_0x4bb9('0x7a')](function(_0x179a13){return _0x5a0a0f[_0x4bb9('0x80')](_0x165609['query'][_0x4bb9('0x74')],{'transaction':_0x179a13})[_0x4bb9('0x21')](function(){if(!_[_0x4bb9('0x93')](_0x58ef6f)){return _0x5a0a0f[_0x4bb9('0x94')](_0x58ef6f,{'transaction':_0x179a13});}})[_0x4bb9('0x21')](function(){_0x58ef6f[_0x4bb9('0x7d')](function(_0x7cc82f){socket[_0x4bb9('0x7e')](_0x4bb9('0x95'),{'UserId':_0x7cc82f,'ChatQueueId':_0x5a0a0f['id']});});});});});});})[_0x4bb9('0x21')](respondWithStatusCode(_0x44318e,null))[_0x4bb9('0x29')](handleError(_0x44318e,null));};exports[_0x4bb9('0x96')]=function(_0xc2e940,_0x328bad,_0x139930){return db[_0x4bb9('0x3b')][_0x4bb9('0x5d')]({'where':{'id':_0xc2e940[_0x4bb9('0x54')]['id']}})[_0x4bb9('0x21')](handleEntityNotFound(_0x328bad,null))[_0x4bb9('0x21')](function(_0x42a133){if(_0x42a133){return _0x42a133[_0x4bb9('0x96')](_0xc2e940[_0x4bb9('0x58')][_0x4bb9('0x74')],_[_0x4bb9('0x97')](_0xc2e940[_0x4bb9('0x58')],[_0x4bb9('0x74'),'id'])||{})[_0x4bb9('0x98')](function(_0x34d42e){for(var _0x1d8b26=0x0;_0x1d8b26<_0xc2e940[_0x4bb9('0x58')][_0x4bb9('0x74')][_0x4bb9('0x47')];_0x1d8b26+=0x1){socket[_0x4bb9('0x7e')](_0x4bb9('0x7f'),{'UserId':Number(_0xc2e940['body']['ids'][_0x1d8b26]),'ChatQueueId':Number(_0xc2e940['params']['id'])});}return _0x34d42e;});}})[_0x4bb9('0x21')](respondWithResult(_0x328bad,null))[_0x4bb9('0x29')](handleError(_0x328bad,null));};exports[_0x4bb9('0x94')]=function(_0x1e0163,_0x1b8f90,_0x1de811){return db[_0x4bb9('0x3b')][_0x4bb9('0x5d')]({'where':{'id':_0x1e0163[_0x4bb9('0x54')]['id']}})['then'](handleEntityNotFound(_0x1b8f90,null))['then'](function(_0x26e0c0){if(_0x26e0c0){return _0x26e0c0[_0x4bb9('0x94')](_0x1e0163['query'][_0x4bb9('0x74')])[_0x4bb9('0x21')](function(){if(_[_0x4bb9('0x99')](_0x1e0163[_0x4bb9('0x41')][_0x4bb9('0x74')])){for(var _0x2cd780=0x0;_0x2cd780<_0x1e0163[_0x4bb9('0x41')][_0x4bb9('0x74')]['length'];_0x2cd780+=0x1){socket[_0x4bb9('0x7e')]('userChatQueue:remove',{'UserId':Number(_0x1e0163[_0x4bb9('0x41')][_0x4bb9('0x74')][_0x2cd780]),'ChatQueueId':Number(_0x1e0163[_0x4bb9('0x54')]['id'])});}}else{socket[_0x4bb9('0x7e')](_0x4bb9('0x95'),{'UserId':Number(_0x1e0163[_0x4bb9('0x41')][_0x4bb9('0x74')]),'ChatQueueId':Number(_0x1e0163[_0x4bb9('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b8f90,null))['catch'](handleError(_0x1b8f90,null));};exports[_0x4bb9('0x9a')]=function(_0x282830,_0x52e563,_0x10973d){var _0x4b5c3f={};var _0x5ac39b={};var _0x4a279f;var _0x6cc014;return db[_0x4bb9('0x3b')][_0x4bb9('0x63')]({'where':{'id':_0x282830[_0x4bb9('0x54')]['id']}})['then'](handleEntityNotFound(_0x52e563,null))['then'](function(_0x105cf0){if(_0x105cf0){_0x4a279f=_0x105cf0;_0x5ac39b[_0x4bb9('0x45')]=_[_0x4bb9('0x55')](db[_0x4bb9('0x67')][_0x4bb9('0x3c')]);_0x5ac39b['query']=_[_0x4bb9('0x55')](_0x282830[_0x4bb9('0x41')]);_0x5ac39b[_0x4bb9('0x42')]=_[_0x4bb9('0x44')](_0x5ac39b[_0x4bb9('0x45')],_0x5ac39b[_0x4bb9('0x41')]);_0x4b5c3f[_0x4bb9('0x43')]=_[_0x4bb9('0x44')](_0x5ac39b[_0x4bb9('0x45')],qs[_0x4bb9('0x46')](_0x282830['query'][_0x4bb9('0x46')]));_0x4b5c3f[_0x4bb9('0x43')]=_0x4b5c3f[_0x4bb9('0x43')][_0x4bb9('0x47')]?_0x4b5c3f[_0x4bb9('0x43')]:_0x5ac39b[_0x4bb9('0x45')];_0x4b5c3f['order']=qs['sort'](_0x282830[_0x4bb9('0x41')][_0x4bb9('0x4b')]);_0x4b5c3f[_0x4bb9('0x4c')]=qs[_0x4bb9('0x42')](_[_0x4bb9('0x65')](_0x282830[_0x4bb9('0x41')],_0x5ac39b[_0x4bb9('0x42')]));if(_0x282830[_0x4bb9('0x41')][_0x4bb9('0x4f')]){_0x4b5c3f[_0x4bb9('0x4c')]=_[_0x4bb9('0x4d')](_0x4b5c3f[_0x4bb9('0x4c')],{'$or':_['map'](_0x4b5c3f[_0x4bb9('0x43')],function(_0x2d99f7){var _0x44a51f={};_0x44a51f[_0x2d99f7]={'$like':'%'+_0x282830[_0x4bb9('0x41')][_0x4bb9('0x4f')]+'%'};return _0x44a51f;})});}_0x4b5c3f=_[_0x4bb9('0x4d')]({},_0x4b5c3f,_0x282830[_0x4bb9('0x56')]);return _0x4a279f[_0x4bb9('0x9a')](_0x4b5c3f);}})[_0x4bb9('0x21')](function(_0x5537a8){if(_0x5537a8){_0x6cc014=_0x5537a8[_0x4bb9('0x47')];if(!_0x282830[_0x4bb9('0x41')][_0x4bb9('0x48')](_0x4bb9('0x49'))){_0x4b5c3f['limit']=qs[_0x4bb9('0x4a')](_0x282830[_0x4bb9('0x41')]['limit']);_0x4b5c3f[_0x4bb9('0x2f')]=qs[_0x4bb9('0x2f')](_0x282830['query'][_0x4bb9('0x2f')]);}return _0x4a279f['getAgents'](_0x4b5c3f);}})[_0x4bb9('0x21')](function(_0xe82fc7){if(_0xe82fc7){return _0xe82fc7?{'count':_0x6cc014,'rows':_0xe82fc7}:null;}})[_0x4bb9('0x21')](respondWithResult(_0x52e563,null))[_0x4bb9('0x29')](handleError(_0x52e563,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 19e0ece..dcfa0b7 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 _0xe528=['update','emit','hasOwnProperty','hook','exports','ChatQueue','setMaxListeners','save'];(function(_0x3cf1b1,_0x445a0a){var _0x347602=function(_0x19c0a1){while(--_0x19c0a1){_0x3cf1b1['push'](_0x3cf1b1['shift']());}};_0x347602(++_0x445a0a);}(_0xe528,0x9d));var _0x8e52=function(_0x33f43e,_0x349e92){_0x33f43e=_0x33f43e-0x0;var _0xa9ae29=_0xe528[_0x33f43e];return _0xa9ae29;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x8e52('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8e52('0x1')](0x0);var events={'afterCreate':_0x8e52('0x2'),'afterUpdate':_0x8e52('0x3'),'afterDestroy':'remove'};function emitEvent(_0x59aed4){return function(_0x450338,_0x454f2d,_0x1bd4fb){ChatQueueEvents[_0x8e52('0x4')](_0x59aed4+':'+_0x450338['id'],_0x450338);ChatQueueEvents['emit'](_0x59aed4,_0x450338);_0x1bd4fb(null);};}for(var e in events){if(events[_0x8e52('0x5')](e)){var event=events[e];ChatQueue[_0x8e52('0x6')](e,emitEvent(event));}}module[_0x8e52('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xc1de=['ChatQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4f5a3e,_0x320eab){var _0x47d0a5=function(_0x38f4d1){while(--_0x38f4d1){_0x4f5a3e['push'](_0x4f5a3e['shift']());}};_0x47d0a5(++_0x320eab);}(_0xc1de,0xaa));var _0xec1d=function(_0xd66c60,_0x112c80){_0xd66c60=_0xd66c60-0x0;var _0x15e39a=_0xc1de[_0xd66c60];return _0x15e39a;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xec1d('0x0'))['db'][_0xec1d('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xec1d('0x2')](0x0);var events={'afterCreate':_0xec1d('0x3'),'afterUpdate':_0xec1d('0x4'),'afterDestroy':_0xec1d('0x5')};function emitEvent(_0xf50037){return function(_0x52e074,_0x396cc3,_0x4431d5){ChatQueueEvents['emit'](_0xf50037+':'+_0x52e074['id'],_0x52e074);ChatQueueEvents['emit'](_0xf50037,_0x52e074);_0x4431d5(null);};}for(var e in events){if(events[_0xec1d('0x6')](e)){var event=events[e];ChatQueue[_0xec1d('0x7')](e,emitEvent(event));}}module[_0xec1d('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index ca5bb1b..bd9c31d 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 _0xb7de=['bluebird','request-promise','./chatQueue.attributes','chat_queues','lodash','../../config/logger'];(function(_0x16ba5b,_0x34ba4c){var _0xc98ed9=function(_0x197167){while(--_0x197167){_0x16ba5b['push'](_0x16ba5b['shift']());}};_0xc98ed9(++_0x34ba4c);}(_0xb7de,0x70));var _0xeb7d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb7de[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xeb7d('0x0'));var util=require('util');var logger=require(_0xeb7d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xeb7d('0x2'));var rp=require(_0xeb7d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeb7d('0x4'));module['exports']=function(_0x3c65ba,_0x3b4c1f){return _0x3c65ba['define']('ChatQueue',attributes,{'tableName':_0xeb7d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9be4=['../../config/environment','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3e04b1,_0x474e5d){var _0x2a3a06=function(_0x78e666){while(--_0x78e666){_0x3e04b1['push'](_0x3e04b1['shift']());}};_0x2a3a06(++_0x474e5d);}(_0x9be4,0xb7));var _0x49be=function(_0x2b7dab,_0x2505fc){_0x2b7dab=_0x2b7dab-0x0;var _0x36cc35=_0x9be4[_0x2b7dab];return _0x36cc35;};'use strict';var _=require('lodash');var util=require(_0x49be('0x0'));var logger=require(_0x49be('0x1'))(_0x49be('0x2'));var moment=require(_0x49be('0x3'));var BPromise=require(_0x49be('0x4'));var rp=require(_0x49be('0x5'));var fs=require('fs');var path=require(_0x49be('0x6'));var rimraf=require('rimraf');var config=require(_0x49be('0x7'));var attributes=require('./chatQueue.attributes');module[_0x49be('0x8')]=function(_0x320106,_0x3a6429){return _0x320106[_0x49be('0x9')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 5715f59..acd3568 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 _0xebc4=['./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','info','GetChatQueue','ChatQueue','then','ShowChatQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis','socket.io-emitter'];(function(_0x7b7e25,_0x36e928){var _0x24e1e5=function(_0x7711e6){while(--_0x7711e6){_0x7b7e25['push'](_0x7b7e25['shift']());}};_0x24e1e5(++_0x36e928);}(_0xebc4,0xf9));var _0x4ebc=function(_0x8df750,_0x22c0f5){_0x8df750=_0x8df750-0x0;var _0x290bc8=_0xebc4[_0x8df750];return _0x290bc8;};'use strict';var _=require('lodash');var util=require(_0x4ebc('0x0'));var moment=require(_0x4ebc('0x1'));var BPromise=require(_0x4ebc('0x2'));var rs=require(_0x4ebc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ebc('0x4'))['db'];var utils=require(_0x4ebc('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ebc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4ebc('0x7')]['http']({'port':0x232a});config[_0x4ebc('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ebc('0x9'))(new Redis(config[_0x4ebc('0x8')]));require(_0x4ebc('0xa'))[_0x4ebc('0xb')](socket);function respondWithRpcPromise(_0x46e0dc,_0x5d6a99,_0x27a221){return new BPromise(function(_0x1b5dbc,_0x12e3c6){return client[_0x4ebc('0xc')](_0x46e0dc,_0x27a221)['then'](function(_0x1522b9){logger['info'](_0x4ebc('0xd'),_0x5d6a99,_0x4ebc('0xe'));logger[_0x4ebc('0xf')](_0x4ebc('0x10'),_0x5d6a99,'request\x20sent',JSON[_0x4ebc('0x11')](_0x1522b9));if(_0x1522b9['error']){if(_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x13')]===0x1f4){logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x14')]);return _0x12e3c6(_0x1522b9['error'][_0x4ebc('0x14')]);}logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x1522b9[_0x4ebc('0x12')]['message']);return _0x1b5dbc(_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x14')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x5d6a99,_0x4ebc('0xe'));_0x1b5dbc(_0x1522b9[_0x4ebc('0x15')]['message']);}})[_0x4ebc('0x16')](function(_0x28571e){logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x28571e);_0x12e3c6(_0x28571e);});});}exports['GetChatQueue']=function(_0x59251b){var _0x249dcf=this;return new Promise(function(_0x3e6195,_0x137ec9){return db['ChatQueue'][_0x4ebc('0x17')]({'raw':_0x59251b['options']?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x19')]===undefined?!![]:![]:!![],'where':_0x59251b['options']?_0x59251b['options'][_0x4ebc('0x1a')]||null:null,'attributes':_0x59251b['options']?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1b')]||null:null,'limit':_0x59251b[_0x4ebc('0x18')]?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1c')]||null:null,'include':_0x59251b[_0x4ebc('0x18')]?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x59251b[_0x4ebc('0x18')]['include'],function(_0x376a83){return{'model':db[_0x376a83[_0x4ebc('0x1f')]],'as':_0x376a83['as'],'attributes':_0x376a83[_0x4ebc('0x1b')],'include':_0x376a83[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x376a83[_0x4ebc('0x1d')],function(_0x165924){return{'model':db[_0x165924[_0x4ebc('0x1f')]],'as':_0x165924['as'],'attributes':_0x165924[_0x4ebc('0x1b')],'include':_0x165924[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x165924['include'],function(_0x10b09a){return{'model':db[_0x10b09a[_0x4ebc('0x1f')]],'as':_0x10b09a['as'],'attributes':_0x10b09a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42590d){logger[_0x4ebc('0x20')](_0x4ebc('0x21'),_0x59251b);logger[_0x4ebc('0xf')](_0x4ebc('0x21'),_0x59251b,JSON[_0x4ebc('0x11')](_0x42590d));_0x3e6195(_0x42590d);})[_0x4ebc('0x16')](function(_0x1d3d15){logger[_0x4ebc('0x12')]('GetChatQueue',_0x1d3d15[_0x4ebc('0x14')],_0x59251b);_0x137ec9(_0x249dcf[_0x4ebc('0x12')](0x1f4,_0x1d3d15[_0x4ebc('0x14')]));});});};exports['ShowChatQueue']=function(_0x3f9c40){var _0xbf2673=this;return new Promise(function(_0x141869,_0x3da50a){return db[_0x4ebc('0x22')]['find']({'raw':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1a')]||null:null,'attributes':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1b')]||null:null,'include':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1d')]?_['map'](_0x3f9c40['options'][_0x4ebc('0x1d')],function(_0x136d78){return{'model':db[_0x136d78[_0x4ebc('0x1f')]],'as':_0x136d78['as'],'attributes':_0x136d78[_0x4ebc('0x1b')],'include':_0x136d78[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x136d78[_0x4ebc('0x1d')],function(_0x4af0ec){return{'model':db[_0x4af0ec[_0x4ebc('0x1f')]],'as':_0x4af0ec['as'],'attributes':_0x4af0ec['attributes'],'include':_0x4af0ec['include']?_[_0x4ebc('0x1e')](_0x4af0ec[_0x4ebc('0x1d')],function(_0x34b276){return{'model':db[_0x34b276[_0x4ebc('0x1f')]],'as':_0x34b276['as'],'attributes':_0x34b276[_0x4ebc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4ebc('0x23')](function(_0x4fcfb6){logger[_0x4ebc('0x20')]('ShowChatQueue',_0x3f9c40);logger['debug'](_0x4ebc('0x24'),_0x3f9c40,JSON[_0x4ebc('0x11')](_0x4fcfb6));_0x141869(_0x4fcfb6);})[_0x4ebc('0x16')](function(_0x28ab22){logger[_0x4ebc('0x12')](_0x4ebc('0x24'),_0x28ab22[_0x4ebc('0x14')],_0x3f9c40);_0x3da50a(_0xbf2673['error'](0x1f4,_0x28ab22['message']));});});}; \ No newline at end of file +var _0x285b=['http','redis','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetChatQueue','ChatQueue','findAll','options','limit','include','map','model','attributes','ShowChatQueue','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x325061,_0x36f481){var _0x5ae23d=function(_0x1ffec0){while(--_0x1ffec0){_0x325061['push'](_0x325061['shift']());}};_0x5ae23d(++_0x36f481);}(_0x285b,0x171));var _0xb285=function(_0xf97f35,_0x43a1f7){_0xf97f35=_0xf97f35-0x0;var _0x23f958=_0x285b[_0xf97f35];return _0x23f958;};'use strict';var _=require(_0xb285('0x0'));var util=require('util');var moment=require(_0xb285('0x1'));var BPromise=require(_0xb285('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb285('0x3'));var db=require(_0xb285('0x4'))['db'];var utils=require(_0xb285('0x5'));var logger=require(_0xb285('0x6'))(_0xb285('0x7'));var config=require(_0xb285('0x8'));var jayson=require(_0xb285('0x9'));var client=jayson[_0xb285('0xa')][_0xb285('0xb')]({'port':0x232a});config[_0xb285('0xc')]=_['defaults'](config[_0xb285('0xc')],{'host':_0xb285('0xd'),'port':0x18eb});var socket=require(_0xb285('0xe'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xb285('0xf')](socket);function respondWithRpcPromise(_0x2556dc,_0x133cc7,_0xd138d8){return new BPromise(function(_0x4e5976,_0x3d2a2b){return client['request'](_0x2556dc,_0xd138d8)[_0xb285('0x10')](function(_0x46ef65){logger[_0xb285('0x11')](_0xb285('0x12'),_0x133cc7,_0xb285('0x13'));logger[_0xb285('0x14')](_0xb285('0x15'),_0x133cc7,_0xb285('0x13'),JSON[_0xb285('0x16')](_0x46ef65));if(_0x46ef65[_0xb285('0x17')]){if(_0x46ef65['error']['code']===0x1f4){logger[_0xb285('0x17')](_0xb285('0x12'),_0x133cc7,_0x46ef65[_0xb285('0x17')][_0xb285('0x18')]);return _0x3d2a2b(_0x46ef65['error'][_0xb285('0x18')]);}logger[_0xb285('0x17')](_0xb285('0x12'),_0x133cc7,_0x46ef65[_0xb285('0x17')]['message']);return _0x4e5976(_0x46ef65[_0xb285('0x17')]['message']);}else{logger[_0xb285('0x11')](_0xb285('0x12'),_0x133cc7,_0xb285('0x13'));_0x4e5976(_0x46ef65['result'][_0xb285('0x18')]);}})[_0xb285('0x19')](function(_0x99b1e6){logger[_0xb285('0x17')](_0xb285('0x12'),_0x133cc7,_0x99b1e6);_0x3d2a2b(_0x99b1e6);});});}exports[_0xb285('0x1a')]=function(_0x17ad6f){var _0x378069=this;return new Promise(function(_0x402822,_0x5d77cb){return db[_0xb285('0x1b')][_0xb285('0x1c')]({'raw':_0x17ad6f[_0xb285('0x1d')]?_0x17ad6f[_0xb285('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x17ad6f[_0xb285('0x1d')]?_0x17ad6f[_0xb285('0x1d')]['where']||null:null,'attributes':_0x17ad6f[_0xb285('0x1d')]?_0x17ad6f[_0xb285('0x1d')]['attributes']||null:null,'limit':_0x17ad6f['options']?_0x17ad6f[_0xb285('0x1d')][_0xb285('0x1e')]||null:null,'include':_0x17ad6f[_0xb285('0x1d')]?_0x17ad6f[_0xb285('0x1d')][_0xb285('0x1f')]?_[_0xb285('0x20')](_0x17ad6f[_0xb285('0x1d')][_0xb285('0x1f')],function(_0x8d9a16){return{'model':db[_0x8d9a16[_0xb285('0x21')]],'as':_0x8d9a16['as'],'attributes':_0x8d9a16[_0xb285('0x22')],'include':_0x8d9a16['include']?_[_0xb285('0x20')](_0x8d9a16[_0xb285('0x1f')],function(_0x56c81f){return{'model':db[_0x56c81f[_0xb285('0x21')]],'as':_0x56c81f['as'],'attributes':_0x56c81f['attributes'],'include':_0x56c81f[_0xb285('0x1f')]?_[_0xb285('0x20')](_0x56c81f[_0xb285('0x1f')],function(_0x4377aa){return{'model':db[_0x4377aa[_0xb285('0x21')]],'as':_0x4377aa['as'],'attributes':_0x4377aa[_0xb285('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb285('0x10')](function(_0x4a4408){logger[_0xb285('0x11')]('GetChatQueue',_0x17ad6f);logger[_0xb285('0x14')](_0xb285('0x1a'),_0x17ad6f,JSON[_0xb285('0x16')](_0x4a4408));_0x402822(_0x4a4408);})[_0xb285('0x19')](function(_0x3f7139){logger[_0xb285('0x17')](_0xb285('0x1a'),_0x3f7139['message'],_0x17ad6f);_0x5d77cb(_0x378069[_0xb285('0x17')](0x1f4,_0x3f7139[_0xb285('0x18')]));});});};exports[_0xb285('0x23')]=function(_0x2ece08){var _0x152e0d=this;return new Promise(function(_0x521837,_0x4ed2b5){return db[_0xb285('0x1b')][_0xb285('0x24')]({'raw':_0x2ece08[_0xb285('0x1d')]?_0x2ece08[_0xb285('0x1d')][_0xb285('0x25')]===undefined?!![]:![]:!![],'where':_0x2ece08[_0xb285('0x1d')]?_0x2ece08[_0xb285('0x1d')]['where']||null:null,'attributes':_0x2ece08[_0xb285('0x1d')]?_0x2ece08[_0xb285('0x1d')][_0xb285('0x22')]||null:null,'include':_0x2ece08[_0xb285('0x1d')]?_0x2ece08['options'][_0xb285('0x1f')]?_[_0xb285('0x20')](_0x2ece08[_0xb285('0x1d')][_0xb285('0x1f')],function(_0x2efbaf){return{'model':db[_0x2efbaf[_0xb285('0x21')]],'as':_0x2efbaf['as'],'attributes':_0x2efbaf['attributes'],'include':_0x2efbaf[_0xb285('0x1f')]?_[_0xb285('0x20')](_0x2efbaf['include'],function(_0x420fa8){return{'model':db[_0x420fa8[_0xb285('0x21')]],'as':_0x420fa8['as'],'attributes':_0x420fa8['attributes'],'include':_0x420fa8[_0xb285('0x1f')]?_[_0xb285('0x20')](_0x420fa8['include'],function(_0x14ef0d){return{'model':db[_0x14ef0d[_0xb285('0x21')]],'as':_0x14ef0d['as'],'attributes':_0x14ef0d[_0xb285('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb285('0x10')](function(_0x1afa35){logger[_0xb285('0x11')](_0xb285('0x23'),_0x2ece08);logger[_0xb285('0x14')](_0xb285('0x23'),_0x2ece08,JSON['stringify'](_0x1afa35));_0x521837(_0x1afa35);})[_0xb285('0x19')](function(_0x2346f4){logger[_0xb285('0x17')](_0xb285('0x23'),_0x2346f4[_0xb285('0x18')],_0x2ece08);_0x4ed2b5(_0x152e0d[_0xb285('0x17')](0x1f4,_0x2346f4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0b6fa75..0f25ddb 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 _0x54ef=['remove','emit','removeListener','length','./chatQueue.events','save'];(function(_0x42ffa2,_0x4b3b89){var _0x281f01=function(_0x101e47){while(--_0x101e47){_0x42ffa2['push'](_0x42ffa2['shift']());}};_0x281f01(++_0x4b3b89);}(_0x54ef,0x112));var _0xf54e=function(_0x12baa8,_0x30d9b6){_0x12baa8=_0x12baa8-0x0;var _0x3a0200=_0x54ef[_0x12baa8];return _0x3a0200;};'use strict';var ChatQueueEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){ChatQueueEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('chatQueue:'+_0x561870,_0x55e611);ChatQueueEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file +var _0x5636=['save','emit','removeListener','register','length','chatQueue:','./chatQueue.events'];(function(_0x4aae4c,_0x3f4b73){var _0x25b7bb=function(_0x44b763){while(--_0x44b763){_0x4aae4c['push'](_0x4aae4c['shift']());}};_0x25b7bb(++_0x3f4b73);}(_0x5636,0x102));var _0x6563=function(_0x1e0a60,_0x37718e){_0x1e0a60=_0x1e0a60-0x0;var _0x54febc=_0x5636[_0x1e0a60];return _0x54febc;};'use strict';var ChatQueueEvents=require(_0x6563('0x0'));var events=[_0x6563('0x1'),'remove','update'];function createListener(_0x579d5c,_0x44872c){return function(_0x3a95f7){_0x44872c[_0x6563('0x2')](_0x579d5c,_0x3a95f7);};}function removeListener(_0x4ac653,_0x166a58){return function(){ChatQueueEvents[_0x6563('0x3')](_0x4ac653,_0x166a58);};}exports[_0x6563('0x4')]=function(_0x39792f){for(var _0x29f687=0x0,_0x193942=events[_0x6563('0x5')];_0x29f687<_0x193942;_0x29f687++){var _0x2d57d5=events[_0x29f687];var _0x2d0d5b=createListener(_0x6563('0x6')+_0x2d57d5,_0x39792f);ChatQueueEvents['on'](_0x2d57d5,_0x2d0d5b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 56ff6f0..660e774 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x495acd,_0x2d5066){var _0x4a46d8=function(_0x5dec06){while(--_0x5dec06){_0x495acd['push'](_0x495acd['shift']());}};_0x4a46d8(++_0x2d5066);}(_0x55ca,0x126));var _0xa55c=function(_0x5530a9,_0x48e4c2){_0x5530a9=_0x5530a9-0x0;var _0x1c69f4=_0x55ca[_0x5530a9];return _0x1c69f4;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x546391,_0x5790a9){var _0x67d3d4=function(_0x391cb5){while(--_0x391cb5){_0x546391['push'](_0x546391['shift']());}};_0x67d3d4(++_0x5790a9);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 0bdb05a..c6e7b61 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 _0x2707=['STRING','DATE','moment'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x2707,0x143));var _0x7270=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x2707[_0x2e4e19];return _0x9ba20b;};'use strict';var moment=require(_0x7270('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x7270('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7270('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7270('0x2')]},'reason':{'type':Sequelize[_0x7270('0x1')]}}; \ No newline at end of file +var _0x4215=['STRING','DATE','moment'];(function(_0x5d87ce,_0x456653){var _0x5e7428=function(_0xf3d89b){while(--_0xf3d89b){_0x5d87ce['push'](_0x5d87ce['shift']());}};_0x5e7428(++_0x456653);}(_0x4215,0x6e));var _0x5421=function(_0x5829eb,_0x173950){_0x5829eb=_0x5829eb-0x0;var _0x472f7a=_0x4215[_0x5829eb];return _0x472f7a;};'use strict';var moment=require(_0x5421('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x5421('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5421('0x1')]},'joinAt':{'type':Sequelize[_0x5421('0x2')]},'leaveAt':{'type':Sequelize[_0x5421('0x2')]},'acceptAt':{'type':Sequelize[_0x5421('0x2')]},'exitAt':{'type':Sequelize[_0x5421('0x2')]},'reason':{'type':Sequelize[_0x5421('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 41a7625..30550da 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 _0xacc6=['index','map','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','ChatQueueReport','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send'];(function(_0x283290,_0x1bef2f){var _0x4c7e20=function(_0x44d8ad){while(--_0x44d8ad){_0x283290['push'](_0x283290['shift']());}};_0x4c7e20(++_0x1bef2f);}(_0xacc6,0x150));var _0x6acc=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xacc6[_0x5416db];return _0x243e35;};'use strict';var emlformat=require(_0x6acc('0x0'));var rimraf=require(_0x6acc('0x1'));var zipdir=require(_0x6acc('0x2'));var jsonpatch=require(_0x6acc('0x3'));var rp=require(_0x6acc('0x4'));var moment=require('moment');var BPromise=require(_0x6acc('0x5'));var Mustache=require(_0x6acc('0x6'));var util=require(_0x6acc('0x7'));var path=require('path');var sox=require(_0x6acc('0x8'));var csv=require('to-csv');var ejs=require(_0x6acc('0x9'));var fs=require('fs');var fs_extra=require(_0x6acc('0xa'));var _=require('lodash');var squel=require(_0x6acc('0xb'));var crypto=require('crypto');var jsforce=require(_0x6acc('0xc'));var deskjs=require(_0x6acc('0xd'));var toCsv=require(_0x6acc('0xe'));var querystring=require(_0x6acc('0xf'));var Papa=require('papaparse');var Redis=require(_0x6acc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6acc('0x11'));var as=require(_0x6acc('0x12'));var hardwareService=require(_0x6acc('0x13'));var logger=require(_0x6acc('0x14'))(_0x6acc('0x15'));var utils=require(_0x6acc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6acc('0x17'));var db=require(_0x6acc('0x18'))['db'];function respondWithStatusCode(_0x1d951c,_0xcf8224){_0xcf8224=_0xcf8224||0xcc;return function(_0x1b95a6){if(_0x1b95a6){return _0x1d951c['sendStatus'](_0xcf8224);}return _0x1d951c['status'](_0xcf8224)[_0x6acc('0x19')]();};}function respondWithResult(_0x497356,_0x14a543){_0x14a543=_0x14a543||0xc8;return function(_0x230318){if(_0x230318){return _0x497356[_0x6acc('0x1a')](_0x14a543)[_0x6acc('0x1b')](_0x230318);}};}function respondWithFilteredResult(_0x3c4e61,_0x4034fb){return function(_0xf24527){if(_0xf24527){var _0xc07208=typeof _0x4034fb[_0x6acc('0x1c')]===_0x6acc('0x1d')&&typeof _0x4034fb[_0x6acc('0x1e')]===_0x6acc('0x1d');var _0x24f513=_0xf24527[_0x6acc('0x1f')];var _0x3818d8=_0xc07208?0x0:_0x4034fb[_0x6acc('0x1c')];var _0x4ee616=_0xc07208?_0xf24527[_0x6acc('0x1f')]:_0x4034fb[_0x6acc('0x1c')]+_0x4034fb[_0x6acc('0x1e')];var _0x151282;if(_0x4ee616>=_0x24f513){_0x4ee616=_0x24f513;_0x151282=0xc8;}else{_0x151282=0xce;}_0x3c4e61['status'](_0x151282);return _0x3c4e61[_0x6acc('0x20')]('Content-Range',_0x3818d8+'-'+_0x4ee616+'/'+_0x24f513)['json'](_0xf24527);}return null;};}function patchUpdates(_0x4af9e){return function(_0x5d5382){try{jsonpatch[_0x6acc('0x21')](_0x5d5382,_0x4af9e,!![]);}catch(_0x3edf4a){return BPromise[_0x6acc('0x22')](_0x3edf4a);}return _0x5d5382[_0x6acc('0x23')]();};}function saveUpdates(_0x245536,_0x5ecb25){return function(_0x3e4a71){if(_0x3e4a71){return _0x3e4a71[_0x6acc('0x24')](_0x245536)['then'](function(_0x334416){return _0x334416;});}return null;};}function removeEntity(_0x5ba0b6,_0x22abf1){return function(_0x1db7bd){if(_0x1db7bd){return _0x1db7bd[_0x6acc('0x25')]()[_0x6acc('0x26')](function(){_0x5ba0b6['status'](0xcc)[_0x6acc('0x19')]();});}};}function handleEntityNotFound(_0xa4d97c,_0x4a4ca1){return function(_0x10f286){if(!_0x10f286){_0xa4d97c[_0x6acc('0x27')](0x194);}return _0x10f286;};}function handleError(_0x441f90,_0x125084){_0x125084=_0x125084||0x1f4;return function(_0x212bde){logger[_0x6acc('0x28')](_0x212bde[_0x6acc('0x29')]);if(_0x212bde[_0x6acc('0x2a')]){delete _0x212bde['name'];}_0x441f90[_0x6acc('0x1a')](_0x125084)[_0x6acc('0x2b')](_0x212bde);};}exports[_0x6acc('0x2c')]=function(_0x490ce6,_0x1bcfad){var _0x8e75a9={},_0x3c8c95={},_0x259373={'count':0x0,'rows':[]};var _0x19fdd3=_[_0x6acc('0x2d')](db['ChatQueueReport']['rawAttributes'],function(_0x47ff48){return{'name':_0x47ff48['fieldName'],'type':_0x47ff48[_0x6acc('0x2e')][_0x6acc('0x2f')]};});_0x3c8c95[_0x6acc('0x30')]=_[_0x6acc('0x2d')](_0x19fdd3,_0x6acc('0x2a'));_0x3c8c95[_0x6acc('0x31')]=_['keys'](_0x490ce6['query']);_0x3c8c95[_0x6acc('0x32')]=_[_0x6acc('0x33')](_0x3c8c95[_0x6acc('0x30')],_0x3c8c95[_0x6acc('0x31')]);_0x8e75a9['attributes']=_[_0x6acc('0x33')](_0x3c8c95[_0x6acc('0x30')],qs['fields'](_0x490ce6[_0x6acc('0x31')][_0x6acc('0x34')]));_0x8e75a9[_0x6acc('0x35')]=_0x8e75a9['attributes']['length']?_0x8e75a9[_0x6acc('0x35')]:_0x3c8c95[_0x6acc('0x30')];if(!_0x490ce6['query']['hasOwnProperty'](_0x6acc('0x36'))){_0x8e75a9[_0x6acc('0x1e')]=qs[_0x6acc('0x1e')](_0x490ce6['query'][_0x6acc('0x1e')]);_0x8e75a9[_0x6acc('0x1c')]=qs[_0x6acc('0x1c')](_0x490ce6[_0x6acc('0x31')][_0x6acc('0x1c')]);}_0x8e75a9['order']=qs[_0x6acc('0x37')](_0x490ce6['query'][_0x6acc('0x37')]);_0x8e75a9[_0x6acc('0x38')]=qs['filters'](_[_0x6acc('0x39')](_0x490ce6['query'],_0x3c8c95['filters']),_0x19fdd3);if(_0x490ce6[_0x6acc('0x31')][_0x6acc('0x3a')]){_0x8e75a9[_0x6acc('0x38')]=_['merge'](_0x8e75a9[_0x6acc('0x38')],{'$or':_['map'](_0x19fdd3,function(_0x1841b1){if(_0x1841b1['type']!==_0x6acc('0x3b')){var _0x13f74a={};_0x13f74a[_0x1841b1['name']]={'$like':'%'+_0x490ce6[_0x6acc('0x31')][_0x6acc('0x3a')]+'%'};return _0x13f74a;}})});}_0x8e75a9=_[_0x6acc('0x3c')]({},_0x8e75a9,_0x490ce6[_0x6acc('0x3d')]);var _0x46f7db={'where':_0x8e75a9[_0x6acc('0x38')]};return db[_0x6acc('0x3e')]['count'](_0x46f7db)['then'](function(_0x3481ad){_0x259373[_0x6acc('0x1f')]=_0x3481ad;if(_0x490ce6[_0x6acc('0x31')]['includeAll']){_0x8e75a9[_0x6acc('0x3f')]=[{'all':!![]}];}return db[_0x6acc('0x3e')][_0x6acc('0x40')](_0x8e75a9);})[_0x6acc('0x26')](function(_0x3f848c){_0x259373[_0x6acc('0x41')]=_0x3f848c;return _0x259373;})[_0x6acc('0x26')](respondWithFilteredResult(_0x1bcfad,_0x8e75a9))[_0x6acc('0x42')](handleError(_0x1bcfad,null));};exports[_0x6acc('0x43')]=function(_0x1c2776,_0x114709){var _0x17f828={'raw':!![],'where':{'id':_0x1c2776['params']['id']}},_0x5c938d={};_0x5c938d['model']=_[_0x6acc('0x44')](db['ChatQueueReport']['rawAttributes']);_0x5c938d[_0x6acc('0x31')]=_[_0x6acc('0x44')](_0x1c2776[_0x6acc('0x31')]);_0x5c938d[_0x6acc('0x32')]=_[_0x6acc('0x33')](_0x5c938d[_0x6acc('0x30')],_0x5c938d[_0x6acc('0x31')]);_0x17f828[_0x6acc('0x35')]=_[_0x6acc('0x33')](_0x5c938d[_0x6acc('0x30')],qs[_0x6acc('0x34')](_0x1c2776[_0x6acc('0x31')][_0x6acc('0x34')]));_0x17f828['attributes']=_0x17f828[_0x6acc('0x35')][_0x6acc('0x45')]?_0x17f828['attributes']:_0x5c938d[_0x6acc('0x30')];if(_0x1c2776['query'][_0x6acc('0x46')]){_0x17f828[_0x6acc('0x3f')]=[{'all':!![]}];}_0x17f828=_['merge']({},_0x17f828,_0x1c2776[_0x6acc('0x3d')]);return db[_0x6acc('0x3e')][_0x6acc('0x47')](_0x17f828)[_0x6acc('0x26')](handleEntityNotFound(_0x114709,null))[_0x6acc('0x26')](respondWithResult(_0x114709,null))['catch'](handleError(_0x114709,null));};exports[_0x6acc('0x48')]=function(_0x391a4f,_0x45c5e0){return db[_0x6acc('0x3e')][_0x6acc('0x48')](_0x391a4f[_0x6acc('0x49')],{})[_0x6acc('0x26')](respondWithResult(_0x45c5e0,0xc9))[_0x6acc('0x42')](handleError(_0x45c5e0,null));};exports[_0x6acc('0x24')]=function(_0x28e601,_0x1989a6){if(_0x28e601[_0x6acc('0x49')]['id']){delete _0x28e601[_0x6acc('0x49')]['id'];}return db[_0x6acc('0x3e')][_0x6acc('0x47')]({'where':{'id':_0x28e601[_0x6acc('0x4a')]['id']}})[_0x6acc('0x26')](handleEntityNotFound(_0x1989a6,null))['then'](saveUpdates(_0x28e601['body'],null))['then'](respondWithResult(_0x1989a6,null))[_0x6acc('0x42')](handleError(_0x1989a6,null));};exports[_0x6acc('0x25')]=function(_0x5d63ee,_0x13e10e){return db[_0x6acc('0x3e')][_0x6acc('0x47')]({'where':{'id':_0x5d63ee[_0x6acc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x13e10e,null))[_0x6acc('0x26')](removeEntity(_0x13e10e,null))[_0x6acc('0x42')](handleError(_0x13e10e,null));};exports[_0x6acc('0x4b')]=function(_0x1a1e1f,_0x459b99){return db['ChatQueueReport'][_0x6acc('0x4b')]()[_0x6acc('0x26')](respondWithResult(_0x459b99,null))[_0x6acc('0x42')](handleError(_0x459b99,null));}; \ No newline at end of file +var _0xd8fb=['catch','show','params','keys','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows'];(function(_0x1c6eaf,_0x51bf9c){var _0x1403b4=function(_0x5ea2b8){while(--_0x5ea2b8){_0x1c6eaf['push'](_0x1c6eaf['shift']());}};_0x1403b4(++_0x51bf9c);}(_0xd8fb,0x99));var _0xbd8f=function(_0x552133,_0x1fcd11){_0x552133=_0x552133-0x0;var _0xd83c57=_0xd8fb[_0x552133];return _0xd83c57;};'use strict';var emlformat=require(_0xbd8f('0x0'));var rimraf=require(_0xbd8f('0x1'));var zipdir=require(_0xbd8f('0x2'));var jsonpatch=require(_0xbd8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd8f('0x4'));var util=require(_0xbd8f('0x5'));var path=require('path');var sox=require(_0xbd8f('0x6'));var csv=require(_0xbd8f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd8f('0x8'));var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=typeof _0xa57e91[_0xbd8f('0x18')]===_0xbd8f('0x19')&&typeof _0xa57e91['limit']===_0xbd8f('0x19');var _0xf5e7a=_0x10d72e['count'];var _0x4435b9=_0x4da96f?0x0:_0xa57e91[_0xbd8f('0x18')];var _0x47d317=_0x4da96f?_0x10d72e['count']:_0xa57e91[_0xbd8f('0x18')]+_0xa57e91['limit'];var _0x5705c5;if(_0x47d317>=_0xf5e7a){_0x47d317=_0xf5e7a;_0x5705c5=0xc8;}else{_0x5705c5=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5705c5);return _0x829fb2['set'](_0xbd8f('0x1a'),_0x4435b9+'-'+_0x47d317+'/'+_0xf5e7a)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0xb47c8e){return function(_0x897f25){try{jsonpatch[_0xbd8f('0x1b')](_0x897f25,_0xb47c8e,!![]);}catch(_0x20cab7){return BPromise[_0xbd8f('0x1c')](_0x20cab7);}return _0x897f25[_0xbd8f('0x1d')]();};}function saveUpdates(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x1e')](_0x2fbe3b)[_0xbd8f('0x1f')](function(_0x15c4a9){return _0x15c4a9;});}return null;};}function removeEntity(_0x320ede,_0xd11ae){return function(_0x395b1b){if(_0x395b1b){return _0x395b1b['destroy']()[_0xbd8f('0x1f')](function(){_0x320ede[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0x2f3df7,_0xa88414){return function(_0x2257fd){if(!_0x2257fd){_0x2f3df7[_0xbd8f('0x14')](0x194);}return _0x2257fd;};}function handleError(_0x264e62,_0x4ea554){_0x4ea554=_0x4ea554||0x1f4;return function(_0x40cb43){logger[_0xbd8f('0x20')](_0x40cb43['stack']);if(_0x40cb43[_0xbd8f('0x21')]){delete _0x40cb43['name'];}_0x264e62[_0xbd8f('0x15')](_0x4ea554)[_0xbd8f('0x22')](_0x40cb43);};}exports[_0xbd8f('0x23')]=function(_0x202126,_0x2aefa2){var _0x247b07={},_0x4c4431={},_0x166de7={'count':0x0,'rows':[]};var _0x14f3cb=_[_0xbd8f('0x24')](db[_0xbd8f('0x25')][_0xbd8f('0x26')],function(_0x2ac26f){return{'name':_0x2ac26f[_0xbd8f('0x27')],'type':_0x2ac26f['type'][_0xbd8f('0x28')]};});_0x4c4431[_0xbd8f('0x29')]=_[_0xbd8f('0x24')](_0x14f3cb,_0xbd8f('0x21'));_0x4c4431['query']=_['keys'](_0x202126[_0xbd8f('0x2a')]);_0x4c4431[_0xbd8f('0x2b')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],_0x4c4431['query']);_0x247b07[_0xbd8f('0x2d')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x202126[_0xbd8f('0x2a')]['fields']));_0x247b07[_0xbd8f('0x2d')]=_0x247b07[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x247b07[_0xbd8f('0x2d')]:_0x4c4431[_0xbd8f('0x29')];if(!_0x202126['query'][_0xbd8f('0x30')]('nolimit')){_0x247b07[_0xbd8f('0x31')]=qs[_0xbd8f('0x31')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x31')]);_0x247b07[_0xbd8f('0x18')]=qs[_0xbd8f('0x18')](_0x202126['query']['offset']);}_0x247b07['order']=qs[_0xbd8f('0x32')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x32')]);_0x247b07[_0xbd8f('0x33')]=qs[_0xbd8f('0x2b')](_[_0xbd8f('0x34')](_0x202126[_0xbd8f('0x2a')],_0x4c4431[_0xbd8f('0x2b')]),_0x14f3cb);if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]){_0x247b07[_0xbd8f('0x33')]=_[_0xbd8f('0x36')](_0x247b07[_0xbd8f('0x33')],{'$or':_[_0xbd8f('0x24')](_0x14f3cb,function(_0x391d45){if(_0x391d45['type']!==_0xbd8f('0x37')){var _0x4181e0={};_0x4181e0[_0x391d45['name']]={'$like':'%'+_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]+'%'};return _0x4181e0;}})});}_0x247b07=_[_0xbd8f('0x36')]({},_0x247b07,_0x202126['options']);var _0x21da54={'where':_0x247b07['where']};return db[_0xbd8f('0x25')][_0xbd8f('0x38')](_0x21da54)[_0xbd8f('0x1f')](function(_0x4f2ebc){_0x166de7[_0xbd8f('0x38')]=_0x4f2ebc;if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x247b07['include']=[{'all':!![]}];}return db[_0xbd8f('0x25')][_0xbd8f('0x3a')](_0x247b07);})[_0xbd8f('0x1f')](function(_0x351027){_0x166de7[_0xbd8f('0x3b')]=_0x351027;return _0x166de7;})[_0xbd8f('0x1f')](respondWithFilteredResult(_0x2aefa2,_0x247b07))[_0xbd8f('0x3c')](handleError(_0x2aefa2,null));};exports[_0xbd8f('0x3d')]=function(_0x14b768,_0x5e1e77){var _0x52c62b={'raw':!![],'where':{'id':_0x14b768[_0xbd8f('0x3e')]['id']}},_0x2907a3={};_0x2907a3[_0xbd8f('0x29')]=_[_0xbd8f('0x3f')](db['ChatQueueReport'][_0xbd8f('0x26')]);_0x2907a3[_0xbd8f('0x2a')]=_[_0xbd8f('0x3f')](_0x14b768[_0xbd8f('0x2a')]);_0x2907a3[_0xbd8f('0x2b')]=_['intersection'](_0x2907a3['model'],_0x2907a3[_0xbd8f('0x2a')]);_0x52c62b['attributes']=_[_0xbd8f('0x2c')](_0x2907a3[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x2e')]));_0x52c62b[_0xbd8f('0x2d')]=_0x52c62b[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x52c62b['attributes']:_0x2907a3[_0xbd8f('0x29')];if(_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x52c62b[_0xbd8f('0x40')]=[{'all':!![]}];}_0x52c62b=_[_0xbd8f('0x36')]({},_0x52c62b,_0x14b768[_0xbd8f('0x41')]);return db[_0xbd8f('0x25')][_0xbd8f('0x42')](_0x52c62b)['then'](handleEntityNotFound(_0x5e1e77,null))[_0xbd8f('0x1f')](respondWithResult(_0x5e1e77,null))[_0xbd8f('0x3c')](handleError(_0x5e1e77,null));};exports[_0xbd8f('0x43')]=function(_0x1f12dd,_0x2fdbd0){return db[_0xbd8f('0x25')][_0xbd8f('0x43')](_0x1f12dd[_0xbd8f('0x44')],{})[_0xbd8f('0x1f')](respondWithResult(_0x2fdbd0,0xc9))[_0xbd8f('0x3c')](handleError(_0x2fdbd0,null));};exports[_0xbd8f('0x1e')]=function(_0x255c59,_0x3d0ffa){if(_0x255c59[_0xbd8f('0x44')]['id']){delete _0x255c59[_0xbd8f('0x44')]['id'];}return db[_0xbd8f('0x25')][_0xbd8f('0x42')]({'where':{'id':_0x255c59[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x3d0ffa,null))['then'](saveUpdates(_0x255c59[_0xbd8f('0x44')],null))[_0xbd8f('0x1f')](respondWithResult(_0x3d0ffa,null))[_0xbd8f('0x3c')](handleError(_0x3d0ffa,null));};exports[_0xbd8f('0x45')]=function(_0x4ce6b0,_0x1b38ad){return db['ChatQueueReport'][_0xbd8f('0x42')]({'where':{'id':_0x4ce6b0[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x1b38ad,null))[_0xbd8f('0x1f')](removeEntity(_0x1b38ad,null))['catch'](handleError(_0x1b38ad,null));};exports[_0xbd8f('0x46')]=function(_0x35b814,_0x3b67ac){return db[_0xbd8f('0x25')][_0xbd8f('0x46')]()[_0xbd8f('0x1f')](respondWithResult(_0x3b67ac,null))['catch'](handleError(_0x3b67ac,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index e7ae753..fbdc01f 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x11d3b5,_0x13fce1){var _0x332d27=function(_0x346fcb){while(--_0x346fcb){_0x11d3b5['push'](_0x11d3b5['shift']());}};_0x332d27(++_0x13fce1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x513e58,_0x37c056){var _0x5cd7be=function(_0x26f680){while(--_0x26f680){_0x513e58['push'](_0x513e58['shift']());}};_0x5cd7be(++_0x37c056);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 9cef27f..cd06a4e 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 _0x0de2=['message','info','result','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','stringify','UpdateChatQueueReport','attributes','limit','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2ab5c1,_0x50cd7d){var _0x24a514=function(_0x48be12){while(--_0x48be12){_0x2ab5c1['push'](_0x2ab5c1['shift']());}};_0x24a514(++_0x50cd7d);}(_0x0de2,0xa4));var _0x20de=function(_0x422994,_0x99047b){_0x422994=_0x422994-0x0;var _0x43ad8f=_0x0de2[_0x422994];return _0x43ad8f;};'use strict';var _=require('lodash');var util=require(_0x20de('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x20de('0x1'));var fs=require('fs');var Redis=require(_0x20de('0x2'));var db=require(_0x20de('0x3'))['db'];var utils=require(_0x20de('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x20de('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x20de('0x6')][_0x20de('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e72e0,_0x92d904,_0x46a18e){return new BPromise(function(_0x3bc681,_0x157494){return client[_0x20de('0x8')](_0x5e72e0,_0x46a18e)[_0x20de('0x9')](function(_0x149e8c){logger['info'](_0x20de('0xa'),_0x92d904,_0x20de('0xb'));logger[_0x20de('0xc')](_0x20de('0xd'),_0x92d904,_0x20de('0xb'),JSON['stringify'](_0x149e8c));if(_0x149e8c[_0x20de('0xe')]){if(_0x149e8c[_0x20de('0xe')][_0x20de('0xf')]===0x1f4){logger[_0x20de('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x92d904,_0x149e8c[_0x20de('0xe')][_0x20de('0x10')]);return _0x157494(_0x149e8c['error'][_0x20de('0x10')]);}logger['error'](_0x20de('0xa'),_0x92d904,_0x149e8c[_0x20de('0xe')]['message']);return _0x3bc681(_0x149e8c[_0x20de('0xe')]['message']);}else{logger[_0x20de('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x92d904,_0x20de('0xb'));_0x3bc681(_0x149e8c[_0x20de('0x12')][_0x20de('0x10')]);}})['catch'](function(_0x4d76da){logger[_0x20de('0xe')](_0x20de('0xa'),_0x92d904,_0x4d76da);_0x157494(_0x4d76da);});});}exports['CreateChatQueueReport']=function(_0x35bd02){var _0x3c2924=this;return new Promise(function(_0x1fb1ce,_0x55d422){return db[_0x20de('0x13')][_0x20de('0x14')](_0x35bd02[_0x20de('0x15')],{'raw':_0x35bd02[_0x20de('0x16')]?_0x35bd02[_0x20de('0x16')][_0x20de('0x17')]===undefined?!![]:![]:!![]})[_0x20de('0x9')](function(_0x3ba9bb){logger[_0x20de('0x11')](_0x20de('0x18'),_0x35bd02);logger[_0x20de('0xc')](_0x20de('0x18'),_0x35bd02,JSON[_0x20de('0x19')](_0x3ba9bb));_0x1fb1ce(_0x3ba9bb);})['catch'](function(_0x57b938){logger[_0x20de('0xe')]('CreateChatQueueReport',_0x57b938[_0x20de('0x10')],_0x35bd02);_0x55d422(_0x3c2924['error'](0x1f4,_0x57b938[_0x20de('0x10')]));});});};exports[_0x20de('0x1a')]=function(_0x3ed8de){var _0x21bd82=this;return new Promise(function(_0x49dcd5,_0x4693c2){return db[_0x20de('0x13')]['update'](_0x3ed8de[_0x20de('0x15')],{'raw':_0x3ed8de[_0x20de('0x16')]?_0x3ed8de['options'][_0x20de('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ed8de[_0x20de('0x16')]?_0x3ed8de['options']['where']||null:null,'attributes':_0x3ed8de[_0x20de('0x16')]?_0x3ed8de[_0x20de('0x16')][_0x20de('0x1b')]||null:null,'limit':_0x3ed8de[_0x20de('0x16')]?_0x3ed8de[_0x20de('0x16')][_0x20de('0x1c')]||null:null})[_0x20de('0x9')](function(_0x366839){logger[_0x20de('0x11')](_0x20de('0x1a'),_0x3ed8de);logger[_0x20de('0xc')](_0x20de('0x1a'),_0x3ed8de,JSON['stringify'](_0x366839));_0x49dcd5(_0x366839);})[_0x20de('0x1d')](function(_0x22ba5e){logger[_0x20de('0xe')](_0x20de('0x1a'),_0x22ba5e['message'],_0x3ed8de);_0x4693c2(_0x21bd82[_0x20de('0xe')](0x1f4,_0x22ba5e[_0x20de('0x10')]));});});}; \ No newline at end of file +var _0x552a=['body','options','info','catch','update','limit','UpdateChatQueueReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create'];(function(_0x101bc1,_0xc2eb03){var _0x3a2bc0=function(_0x54bf68){while(--_0x54bf68){_0x101bc1['push'](_0x101bc1['shift']());}};_0x3a2bc0(++_0xc2eb03);}(_0x552a,0xaf));var _0xa552=function(_0x3cde5e,_0x4e2206){_0x3cde5e=_0x3cde5e-0x0;var _0x23c07b=_0x552a[_0x3cde5e];return _0x23c07b;};'use strict';var _=require('lodash');var util=require(_0xa552('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa552('0x1'));var fs=require('fs');var Redis=require(_0xa552('0x2'));var db=require(_0xa552('0x3'))['db'];var utils=require(_0xa552('0x4'));var logger=require('../../config/logger')(_0xa552('0x5'));var config=require('../../config/environment');var jayson=require(_0xa552('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a55bb,_0x341054,_0x42ae3e){return new BPromise(function(_0x26cacf,_0x400561){return client[_0xa552('0x7')](_0x5a55bb,_0x42ae3e)[_0xa552('0x8')](function(_0x47546d){logger['info'](_0xa552('0x9'),_0x341054,_0xa552('0xa'));logger[_0xa552('0xb')](_0xa552('0xc'),_0x341054,_0xa552('0xa'),JSON[_0xa552('0xd')](_0x47546d));if(_0x47546d[_0xa552('0xe')]){if(_0x47546d[_0xa552('0xe')][_0xa552('0xf')]===0x1f4){logger[_0xa552('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x341054,_0x47546d[_0xa552('0xe')][_0xa552('0x10')]);return _0x400561(_0x47546d[_0xa552('0xe')][_0xa552('0x10')]);}logger[_0xa552('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x341054,_0x47546d[_0xa552('0xe')][_0xa552('0x10')]);return _0x26cacf(_0x47546d[_0xa552('0xe')][_0xa552('0x10')]);}else{logger['info'](_0xa552('0x9'),_0x341054,_0xa552('0xa'));_0x26cacf(_0x47546d[_0xa552('0x11')][_0xa552('0x10')]);}})['catch'](function(_0x169be4){logger[_0xa552('0xe')](_0xa552('0x9'),_0x341054,_0x169be4);_0x400561(_0x169be4);});});}exports[_0xa552('0x12')]=function(_0x5780ad){var _0x2db3df=this;return new Promise(function(_0x1cdb04,_0x3616f9){return db[_0xa552('0x13')][_0xa552('0x14')](_0x5780ad[_0xa552('0x15')],{'raw':_0x5780ad['options']?_0x5780ad[_0xa552('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xa552('0x8')](function(_0x9ac27d){logger[_0xa552('0x17')]('CreateChatQueueReport',_0x5780ad);logger[_0xa552('0xb')](_0xa552('0x12'),_0x5780ad,JSON[_0xa552('0xd')](_0x9ac27d));_0x1cdb04(_0x9ac27d);})[_0xa552('0x18')](function(_0x106097){logger[_0xa552('0xe')](_0xa552('0x12'),_0x106097['message'],_0x5780ad);_0x3616f9(_0x2db3df[_0xa552('0xe')](0x1f4,_0x106097[_0xa552('0x10')]));});});};exports['UpdateChatQueueReport']=function(_0x920756){var _0x53658b=this;return new Promise(function(_0x43e573,_0x2f3064){return db[_0xa552('0x13')][_0xa552('0x19')](_0x920756[_0xa552('0x15')],{'raw':_0x920756['options']?_0x920756[_0xa552('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x920756['options']?_0x920756[_0xa552('0x16')]['where']||null:null,'attributes':_0x920756[_0xa552('0x16')]?_0x920756[_0xa552('0x16')]['attributes']||null:null,'limit':_0x920756[_0xa552('0x16')]?_0x920756[_0xa552('0x16')][_0xa552('0x1a')]||null:null})[_0xa552('0x8')](function(_0x13f647){logger[_0xa552('0x17')](_0xa552('0x1b'),_0x920756);logger[_0xa552('0xb')]('UpdateChatQueueReport',_0x920756,JSON[_0xa552('0xd')](_0x13f647));_0x43e573(_0x13f647);})[_0xa552('0x18')](function(_0x45919a){logger['error'](_0xa552('0x1b'),_0x45919a[_0xa552('0x10')],_0x920756);_0x2f3064(_0x53658b['error'](0x1f4,_0x45919a[_0xa552('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 10ddfc3..3484745 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 _0xcea1=['isAuthenticated','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xcea1,0x7f));var _0x1cea=function(_0x3058bc,_0x391ddb){_0x3058bc=_0x3058bc-0x0;var _0x586a60=_0xcea1[_0x3058bc];return _0x586a60;};'use strict';var multer=require(_0x1cea('0x0'));var util=require(_0x1cea('0x1'));var path=require(_0x1cea('0x2'));var timeout=require(_0x1cea('0x3'));var express=require('express');var router=express[_0x1cea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1cea('0x5'));var interaction=require(_0x1cea('0x6'));var config=require(_0x1cea('0x7'));var controller=require('./chatQueueReport.controller');router[_0x1cea('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1cea('0x8')]('/describe',auth[_0x1cea('0x9')](),controller['describe']);router[_0x1cea('0x8')](_0x1cea('0xa'),auth[_0x1cea('0x9')](),controller[_0x1cea('0xb')]);router[_0x1cea('0xc')]('/',auth[_0x1cea('0x9')](),controller['create']);router[_0x1cea('0xd')](_0x1cea('0xa'),auth[_0x1cea('0x9')](),controller[_0x1cea('0xe')]);router[_0x1cea('0xf')](_0x1cea('0xa'),auth[_0x1cea('0x9')](),controller[_0x1cea('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4e72=['isAuthenticated','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get'];(function(_0x12031f,_0x514040){var _0x4ae80e=function(_0x1e47a0){while(--_0x1e47a0){_0x12031f['push'](_0x12031f['shift']());}};_0x4ae80e(++_0x514040);}(_0x4e72,0x1e3));var _0x24e7=function(_0xb8baa9,_0x3fcc6a){_0xb8baa9=_0xb8baa9-0x0;var _0x464bd0=_0x4e72[_0xb8baa9];return _0x464bd0;};'use strict';var multer=require(_0x24e7('0x0'));var util=require('util');var path=require(_0x24e7('0x1'));var timeout=require(_0x24e7('0x2'));var express=require(_0x24e7('0x3'));var router=express[_0x24e7('0x4')]();var fs_extra=require(_0x24e7('0x5'));var auth=require(_0x24e7('0x6'));var interaction=require(_0x24e7('0x7'));var config=require(_0x24e7('0x8'));var controller=require(_0x24e7('0x9'));router[_0x24e7('0xa')]('/',auth[_0x24e7('0xb')](),controller['index']);router[_0x24e7('0xa')]('/describe',auth[_0x24e7('0xb')](),controller['describe']);router[_0x24e7('0xa')](_0x24e7('0xc'),auth[_0x24e7('0xb')](),controller['show']);router[_0x24e7('0xd')]('/',auth[_0x24e7('0xb')](),controller[_0x24e7('0xe')]);router[_0x24e7('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x24e7('0x10')]);router[_0x24e7('0x11')](_0x24e7('0xc'),auth[_0x24e7('0xb')](),controller['destroy']);module[_0x24e7('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 c336152..6bef608 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x214d3d,_0x1c7156){var _0x1d585e=function(_0x41ce57){while(--_0x41ce57){_0x214d3d['push'](_0x214d3d['shift']());}};_0x1d585e(++_0x1c7156);}(_0xe706,0xa3));var _0x6e70=function(_0x374870,_0x82a474){_0x374870=_0x374870-0x0;var _0x4de8f4=_0xe706[_0x374870];return _0x4de8f4;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x1ea124,_0x2244b3){var _0x480f33=function(_0x287ef2){while(--_0x287ef2){_0x1ea124['push'](_0x1ea124['shift']());}};_0x480f33(++_0x2244b3);}(_0x34e8,0x12c));var _0x834e=function(_0x1834e7,_0x5211e4){_0x1834e7=_0x1834e7-0x0;var _0xbfbdc9=_0x34e8[_0x1834e7];return _0xbfbdc9;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 922497a..b77ac18 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 _0x09d9=['destroy','sendStatus','error','stack','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','update','then'];(function(_0x27dc8d,_0x1f0639){var _0x3f7fd4=function(_0x3ca25d){while(--_0x3ca25d){_0x27dc8d['push'](_0x27dc8d['shift']());}};_0x3f7fd4(++_0x1f0639);}(_0x09d9,0x71));var _0x909d=function(_0x38838d,_0x15d035){_0x38838d=_0x38838d-0x0;var _0x9f6165=_0x09d9[_0x38838d];return _0x9f6165;};'use strict';var emlformat=require(_0x909d('0x0'));var rimraf=require(_0x909d('0x1'));var zipdir=require(_0x909d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x909d('0x3'));var moment=require(_0x909d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x909d('0x5'));var util=require('util');var path=require(_0x909d('0x6'));var sox=require(_0x909d('0x7'));var csv=require(_0x909d('0x8'));var ejs=require(_0x909d('0x9'));var fs=require('fs');var fs_extra=require(_0x909d('0xa'));var _=require(_0x909d('0xb'));var squel=require('squel');var crypto=require(_0x909d('0xc'));var jsforce=require(_0x909d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x909d('0x8'));var querystring=require(_0x909d('0xe'));var Papa=require(_0x909d('0xf'));var Redis=require('ioredis');var authService=require(_0x909d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x909d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x909d('0x12'));var utils=require(_0x909d('0x13'));var config=require(_0x909d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x909d('0x15'))['db'];function respondWithStatusCode(_0x30b7e3,_0x286a0e){_0x286a0e=_0x286a0e||0xcc;return function(_0x1e9495){if(_0x1e9495){return _0x30b7e3['sendStatus'](_0x286a0e);}return _0x30b7e3['status'](_0x286a0e)[_0x909d('0x16')]();};}function respondWithResult(_0xe0742c,_0x3651e1){_0x3651e1=_0x3651e1||0xc8;return function(_0x290d2c){if(_0x290d2c){return _0xe0742c['status'](_0x3651e1)[_0x909d('0x17')](_0x290d2c);}};}function respondWithFilteredResult(_0xc9fec0,_0x333d4f){return function(_0x44cd6f){if(_0x44cd6f){var _0x4b0fd6=typeof _0x333d4f['offset']===_0x909d('0x18')&&typeof _0x333d4f['limit']===_0x909d('0x18');var _0x38ee20=_0x44cd6f[_0x909d('0x19')];var _0x2f91c2=_0x4b0fd6?0x0:_0x333d4f[_0x909d('0x1a')];var _0x51eb39=_0x4b0fd6?_0x44cd6f[_0x909d('0x19')]:_0x333d4f[_0x909d('0x1a')]+_0x333d4f[_0x909d('0x1b')];var _0x114f74;if(_0x51eb39>=_0x38ee20){_0x51eb39=_0x38ee20;_0x114f74=0xc8;}else{_0x114f74=0xce;}_0xc9fec0[_0x909d('0x1c')](_0x114f74);return _0xc9fec0[_0x909d('0x1d')](_0x909d('0x1e'),_0x2f91c2+'-'+_0x51eb39+'/'+_0x38ee20)[_0x909d('0x17')](_0x44cd6f);}return null;};}function patchUpdates(_0x184144){return function(_0x1a818f){try{jsonpatch['apply'](_0x1a818f,_0x184144,!![]);}catch(_0x5f14cb){return BPromise[_0x909d('0x1f')](_0x5f14cb);}return _0x1a818f[_0x909d('0x20')]();};}function saveUpdates(_0x1e2400,_0x1a87c5){return function(_0x2d3a68){if(_0x2d3a68){return _0x2d3a68[_0x909d('0x21')](_0x1e2400)[_0x909d('0x22')](function(_0x3b0a71){return _0x3b0a71;});}return null;};}function removeEntity(_0x24e19d,_0x554ba7){return function(_0x36b126){if(_0x36b126){return _0x36b126[_0x909d('0x23')]()['then'](function(){_0x24e19d[_0x909d('0x1c')](0xcc)[_0x909d('0x16')]();});}};}function handleEntityNotFound(_0x57c829,_0x4b2ee3){return function(_0x47dc3b){if(!_0x47dc3b){_0x57c829[_0x909d('0x24')](0x194);}return _0x47dc3b;};}function handleError(_0x39a211,_0x3e24db){_0x3e24db=_0x3e24db||0x1f4;return function(_0x4d5169){logger[_0x909d('0x25')](_0x4d5169[_0x909d('0x26')]);if(_0x4d5169['name']){delete _0x4d5169['name'];}_0x39a211[_0x909d('0x1c')](_0x3e24db)[_0x909d('0x27')](_0x4d5169);};}exports['index']=function(_0x16f7e6,_0x209d66){var _0x4766ea={},_0x1b8f03={},_0x5a9cfc={'count':0x0,'rows':[]};var _0x5a5b70=_[_0x909d('0x28')](db[_0x909d('0x29')][_0x909d('0x2a')],function(_0x250e97){return{'name':_0x250e97[_0x909d('0x2b')],'type':_0x250e97[_0x909d('0x2c')][_0x909d('0x2d')]};});_0x1b8f03['model']=_[_0x909d('0x28')](_0x5a5b70,'name');_0x1b8f03[_0x909d('0x2e')]=_[_0x909d('0x2f')](_0x16f7e6[_0x909d('0x2e')]);_0x1b8f03[_0x909d('0x30')]=_[_0x909d('0x31')](_0x1b8f03[_0x909d('0x32')],_0x1b8f03[_0x909d('0x2e')]);_0x4766ea[_0x909d('0x33')]=_[_0x909d('0x31')](_0x1b8f03[_0x909d('0x32')],qs['fields'](_0x16f7e6[_0x909d('0x2e')][_0x909d('0x34')]));_0x4766ea[_0x909d('0x33')]=_0x4766ea[_0x909d('0x33')][_0x909d('0x35')]?_0x4766ea['attributes']:_0x1b8f03[_0x909d('0x32')];if(!_0x16f7e6['query'][_0x909d('0x36')](_0x909d('0x37'))){_0x4766ea['limit']=qs[_0x909d('0x1b')](_0x16f7e6[_0x909d('0x2e')][_0x909d('0x1b')]);_0x4766ea['offset']=qs[_0x909d('0x1a')](_0x16f7e6['query'][_0x909d('0x1a')]);}_0x4766ea['order']=qs['sort'](_0x16f7e6[_0x909d('0x2e')][_0x909d('0x38')]);_0x4766ea[_0x909d('0x39')]=qs[_0x909d('0x30')](_[_0x909d('0x3a')](_0x16f7e6['query'],_0x1b8f03['filters']),_0x5a5b70);if(_0x16f7e6[_0x909d('0x2e')]['filter']){_0x4766ea[_0x909d('0x39')]=_[_0x909d('0x3b')](_0x4766ea[_0x909d('0x39')],{'$or':_[_0x909d('0x28')](_0x5a5b70,function(_0x369a28){if(_0x369a28[_0x909d('0x2c')]!==_0x909d('0x3c')){var _0x3e8507={};_0x3e8507[_0x369a28[_0x909d('0x3d')]]={'$like':'%'+_0x16f7e6[_0x909d('0x2e')]['filter']+'%'};return _0x3e8507;}})});}_0x4766ea=_[_0x909d('0x3b')]({},_0x4766ea,_0x16f7e6[_0x909d('0x3e')]);var _0x58dc9={'where':_0x4766ea[_0x909d('0x39')]};return db[_0x909d('0x29')]['count'](_0x58dc9)[_0x909d('0x22')](function(_0x4b23ea){_0x5a9cfc['count']=_0x4b23ea;if(_0x16f7e6[_0x909d('0x2e')][_0x909d('0x3f')]){_0x4766ea[_0x909d('0x40')]=[{'all':!![]}];}return db[_0x909d('0x29')][_0x909d('0x41')](_0x4766ea);})[_0x909d('0x22')](function(_0x16db09){_0x5a9cfc[_0x909d('0x42')]=_0x16db09;return _0x5a9cfc;})[_0x909d('0x22')](respondWithFilteredResult(_0x209d66,_0x4766ea))[_0x909d('0x43')](handleError(_0x209d66,null));};exports[_0x909d('0x44')]=function(_0x3c2ec2,_0x1fb43b){var _0x2119d2={'raw':!![],'where':{'id':_0x3c2ec2['params']['id']}},_0x3ad6cc={};_0x3ad6cc[_0x909d('0x32')]=_[_0x909d('0x2f')](db['ChatTransferReport'][_0x909d('0x2a')]);_0x3ad6cc[_0x909d('0x2e')]=_[_0x909d('0x2f')](_0x3c2ec2['query']);_0x3ad6cc[_0x909d('0x30')]=_[_0x909d('0x31')](_0x3ad6cc['model'],_0x3ad6cc['query']);_0x2119d2['attributes']=_[_0x909d('0x31')](_0x3ad6cc['model'],qs[_0x909d('0x34')](_0x3c2ec2[_0x909d('0x2e')]['fields']));_0x2119d2['attributes']=_0x2119d2['attributes'][_0x909d('0x35')]?_0x2119d2[_0x909d('0x33')]:_0x3ad6cc[_0x909d('0x32')];if(_0x3c2ec2[_0x909d('0x2e')][_0x909d('0x3f')]){_0x2119d2['include']=[{'all':!![]}];}_0x2119d2=_[_0x909d('0x3b')]({},_0x2119d2,_0x3c2ec2[_0x909d('0x3e')]);return db[_0x909d('0x29')][_0x909d('0x45')](_0x2119d2)[_0x909d('0x22')](handleEntityNotFound(_0x1fb43b,null))[_0x909d('0x22')](respondWithResult(_0x1fb43b,null))['catch'](handleError(_0x1fb43b,null));};exports[_0x909d('0x46')]=function(_0x376a32,_0x49a6e6){return db[_0x909d('0x29')][_0x909d('0x46')](_0x376a32[_0x909d('0x47')],{})[_0x909d('0x22')](respondWithResult(_0x49a6e6,0xc9))[_0x909d('0x43')](handleError(_0x49a6e6,null));};exports[_0x909d('0x21')]=function(_0x442a63,_0x1aa101){if(_0x442a63['body']['id']){delete _0x442a63[_0x909d('0x47')]['id'];}return db[_0x909d('0x29')][_0x909d('0x45')]({'where':{'id':_0x442a63[_0x909d('0x48')]['id']}})[_0x909d('0x22')](handleEntityNotFound(_0x1aa101,null))[_0x909d('0x22')](saveUpdates(_0x442a63[_0x909d('0x47')],null))['then'](respondWithResult(_0x1aa101,null))[_0x909d('0x43')](handleError(_0x1aa101,null));};exports[_0x909d('0x23')]=function(_0x5009cb,_0x2b8c7a){return db[_0x909d('0x29')][_0x909d('0x45')]({'where':{'id':_0x5009cb[_0x909d('0x48')]['id']}})[_0x909d('0x22')](handleEntityNotFound(_0x2b8c7a,null))[_0x909d('0x22')](removeEntity(_0x2b8c7a,null))[_0x909d('0x43')](handleError(_0x2b8c7a,null));};exports[_0x909d('0x49')]=function(_0x465959,_0x4fbd23){return db['ChatTransferReport'][_0x909d('0x49')]()[_0x909d('0x22')](respondWithResult(_0x4fbd23,null))['catch'](handleError(_0x4fbd23,null));}; \ No newline at end of file +var _0x9e61=['rows','catch','show','params','model','keys','rawAttributes','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include'];(function(_0x475b02,_0x344f93){var _0x2f75a7=function(_0x30842d){while(--_0x30842d){_0x475b02['push'](_0x475b02['shift']());}};_0x2f75a7(++_0x344f93);}(_0x9e61,0x149));var _0x19e6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9e61[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x19e6('0x0'));var rimraf=require(_0x19e6('0x1'));var zipdir=require(_0x19e6('0x2'));var jsonpatch=require(_0x19e6('0x3'));var rp=require(_0x19e6('0x4'));var moment=require(_0x19e6('0x5'));var BPromise=require(_0x19e6('0x6'));var Mustache=require('mustache');var util=require(_0x19e6('0x7'));var path=require(_0x19e6('0x8'));var sox=require(_0x19e6('0x9'));var csv=require('to-csv');var ejs=require(_0x19e6('0xa'));var fs=require('fs');var fs_extra=require(_0x19e6('0xb'));var _=require(_0x19e6('0xc'));var squel=require(_0x19e6('0xd'));var crypto=require(_0x19e6('0xe'));var jsforce=require(_0x19e6('0xf'));var deskjs=require(_0x19e6('0x10'));var toCsv=require(_0x19e6('0x11'));var querystring=require(_0x19e6('0x12'));var Papa=require(_0x19e6('0x13'));var Redis=require(_0x19e6('0x14'));var authService=require(_0x19e6('0x15'));var qs=require(_0x19e6('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x19e6('0x17'));var utils=require(_0x19e6('0x18'));var config=require(_0x19e6('0x19'));var licenseUtil=require(_0x19e6('0x1a'));var db=require(_0x19e6('0x1b'))['db'];function respondWithStatusCode(_0x14eb59,_0x1d9ed8){_0x1d9ed8=_0x1d9ed8||0xcc;return function(_0x5d0cad){if(_0x5d0cad){return _0x14eb59[_0x19e6('0x1c')](_0x1d9ed8);}return _0x14eb59['status'](_0x1d9ed8)[_0x19e6('0x1d')]();};}function respondWithResult(_0x20a3d6,_0x4ff093){_0x4ff093=_0x4ff093||0xc8;return function(_0x56dd21){if(_0x56dd21){return _0x20a3d6[_0x19e6('0x1e')](_0x4ff093)[_0x19e6('0x1f')](_0x56dd21);}};}function respondWithFilteredResult(_0x52b6b9,_0x3cd95a){return function(_0x3e2ff5){if(_0x3e2ff5){var _0x1d600d=typeof _0x3cd95a[_0x19e6('0x20')]===_0x19e6('0x21')&&typeof _0x3cd95a[_0x19e6('0x22')]===_0x19e6('0x21');var _0x3bd27b=_0x3e2ff5[_0x19e6('0x23')];var _0x4738a8=_0x1d600d?0x0:_0x3cd95a[_0x19e6('0x20')];var _0x3ee600=_0x1d600d?_0x3e2ff5[_0x19e6('0x23')]:_0x3cd95a[_0x19e6('0x20')]+_0x3cd95a[_0x19e6('0x22')];var _0x1cea59;if(_0x3ee600>=_0x3bd27b){_0x3ee600=_0x3bd27b;_0x1cea59=0xc8;}else{_0x1cea59=0xce;}_0x52b6b9[_0x19e6('0x1e')](_0x1cea59);return _0x52b6b9['set'](_0x19e6('0x24'),_0x4738a8+'-'+_0x3ee600+'/'+_0x3bd27b)[_0x19e6('0x1f')](_0x3e2ff5);}return null;};}function patchUpdates(_0x30124c){return function(_0x1c871f){try{jsonpatch[_0x19e6('0x25')](_0x1c871f,_0x30124c,!![]);}catch(_0x3c2cb7){return BPromise[_0x19e6('0x26')](_0x3c2cb7);}return _0x1c871f['save']();};}function saveUpdates(_0x707e16,_0x3f51df){return function(_0x11d4c1){if(_0x11d4c1){return _0x11d4c1[_0x19e6('0x27')](_0x707e16)[_0x19e6('0x28')](function(_0x56f323){return _0x56f323;});}return null;};}function removeEntity(_0x362176,_0x298f34){return function(_0x1bb9c7){if(_0x1bb9c7){return _0x1bb9c7['destroy']()[_0x19e6('0x28')](function(){_0x362176[_0x19e6('0x1e')](0xcc)[_0x19e6('0x1d')]();});}};}function handleEntityNotFound(_0x4a821d,_0x2d1b89){return function(_0x1288c0){if(!_0x1288c0){_0x4a821d[_0x19e6('0x1c')](0x194);}return _0x1288c0;};}function handleError(_0x4a80a0,_0x2cbaf0){_0x2cbaf0=_0x2cbaf0||0x1f4;return function(_0x4e018a){logger[_0x19e6('0x29')](_0x4e018a[_0x19e6('0x2a')]);if(_0x4e018a[_0x19e6('0x2b')]){delete _0x4e018a[_0x19e6('0x2b')];}_0x4a80a0['status'](_0x2cbaf0)[_0x19e6('0x2c')](_0x4e018a);};}exports[_0x19e6('0x2d')]=function(_0x46e5c7,_0x3ec307){var _0x4ea096={},_0x3ed057={},_0x20089b={'count':0x0,'rows':[]};var _0x48c18d=_[_0x19e6('0x2e')](db[_0x19e6('0x2f')]['rawAttributes'],function(_0x177d6c){return{'name':_0x177d6c[_0x19e6('0x30')],'type':_0x177d6c[_0x19e6('0x31')][_0x19e6('0x32')]};});_0x3ed057['model']=_['map'](_0x48c18d,_0x19e6('0x2b'));_0x3ed057[_0x19e6('0x33')]=_['keys'](_0x46e5c7[_0x19e6('0x33')]);_0x3ed057[_0x19e6('0x34')]=_[_0x19e6('0x35')](_0x3ed057['model'],_0x3ed057[_0x19e6('0x33')]);_0x4ea096[_0x19e6('0x36')]=_[_0x19e6('0x35')](_0x3ed057['model'],qs[_0x19e6('0x37')](_0x46e5c7[_0x19e6('0x33')][_0x19e6('0x37')]));_0x4ea096[_0x19e6('0x36')]=_0x4ea096[_0x19e6('0x36')]['length']?_0x4ea096[_0x19e6('0x36')]:_0x3ed057['model'];if(!_0x46e5c7[_0x19e6('0x33')][_0x19e6('0x38')]('nolimit')){_0x4ea096[_0x19e6('0x22')]=qs[_0x19e6('0x22')](_0x46e5c7['query'][_0x19e6('0x22')]);_0x4ea096['offset']=qs[_0x19e6('0x20')](_0x46e5c7[_0x19e6('0x33')][_0x19e6('0x20')]);}_0x4ea096[_0x19e6('0x39')]=qs[_0x19e6('0x3a')](_0x46e5c7[_0x19e6('0x33')][_0x19e6('0x3a')]);_0x4ea096['where']=qs[_0x19e6('0x34')](_[_0x19e6('0x3b')](_0x46e5c7[_0x19e6('0x33')],_0x3ed057['filters']),_0x48c18d);if(_0x46e5c7[_0x19e6('0x33')][_0x19e6('0x3c')]){_0x4ea096[_0x19e6('0x3d')]=_[_0x19e6('0x3e')](_0x4ea096[_0x19e6('0x3d')],{'$or':_[_0x19e6('0x2e')](_0x48c18d,function(_0xab7078){if(_0xab7078[_0x19e6('0x31')]!=='VIRTUAL'){var _0x3b59d0={};_0x3b59d0[_0xab7078[_0x19e6('0x2b')]]={'$like':'%'+_0x46e5c7['query']['filter']+'%'};return _0x3b59d0;}})});}_0x4ea096=_['merge']({},_0x4ea096,_0x46e5c7[_0x19e6('0x3f')]);var _0x10f2c5={'where':_0x4ea096[_0x19e6('0x3d')]};return db['ChatTransferReport'][_0x19e6('0x23')](_0x10f2c5)[_0x19e6('0x28')](function(_0xeb07d1){_0x20089b['count']=_0xeb07d1;if(_0x46e5c7[_0x19e6('0x33')][_0x19e6('0x40')]){_0x4ea096[_0x19e6('0x41')]=[{'all':!![]}];}return db[_0x19e6('0x2f')]['findAll'](_0x4ea096);})[_0x19e6('0x28')](function(_0x2eaa61){_0x20089b[_0x19e6('0x42')]=_0x2eaa61;return _0x20089b;})[_0x19e6('0x28')](respondWithFilteredResult(_0x3ec307,_0x4ea096))[_0x19e6('0x43')](handleError(_0x3ec307,null));};exports[_0x19e6('0x44')]=function(_0x55e048,_0x3de44a){var _0xacf0ca={'raw':!![],'where':{'id':_0x55e048[_0x19e6('0x45')]['id']}},_0x48a973={};_0x48a973[_0x19e6('0x46')]=_[_0x19e6('0x47')](db[_0x19e6('0x2f')][_0x19e6('0x48')]);_0x48a973['query']=_[_0x19e6('0x47')](_0x55e048[_0x19e6('0x33')]);_0x48a973[_0x19e6('0x34')]=_[_0x19e6('0x35')](_0x48a973[_0x19e6('0x46')],_0x48a973['query']);_0xacf0ca['attributes']=_[_0x19e6('0x35')](_0x48a973[_0x19e6('0x46')],qs['fields'](_0x55e048[_0x19e6('0x33')][_0x19e6('0x37')]));_0xacf0ca[_0x19e6('0x36')]=_0xacf0ca[_0x19e6('0x36')][_0x19e6('0x49')]?_0xacf0ca[_0x19e6('0x36')]:_0x48a973[_0x19e6('0x46')];if(_0x55e048[_0x19e6('0x33')]['includeAll']){_0xacf0ca['include']=[{'all':!![]}];}_0xacf0ca=_[_0x19e6('0x3e')]({},_0xacf0ca,_0x55e048[_0x19e6('0x3f')]);return db['ChatTransferReport'][_0x19e6('0x4a')](_0xacf0ca)['then'](handleEntityNotFound(_0x3de44a,null))[_0x19e6('0x28')](respondWithResult(_0x3de44a,null))[_0x19e6('0x43')](handleError(_0x3de44a,null));};exports[_0x19e6('0x4b')]=function(_0x4140fe,_0x1b447b){return db[_0x19e6('0x2f')][_0x19e6('0x4b')](_0x4140fe['body'],{})['then'](respondWithResult(_0x1b447b,0xc9))[_0x19e6('0x43')](handleError(_0x1b447b,null));};exports[_0x19e6('0x27')]=function(_0x185b45,_0x37931f){if(_0x185b45[_0x19e6('0x4c')]['id']){delete _0x185b45[_0x19e6('0x4c')]['id'];}return db[_0x19e6('0x2f')][_0x19e6('0x4a')]({'where':{'id':_0x185b45['params']['id']}})[_0x19e6('0x28')](handleEntityNotFound(_0x37931f,null))['then'](saveUpdates(_0x185b45[_0x19e6('0x4c')],null))[_0x19e6('0x28')](respondWithResult(_0x37931f,null))[_0x19e6('0x43')](handleError(_0x37931f,null));};exports[_0x19e6('0x4d')]=function(_0x2c2df8,_0x5d4ffe){return db[_0x19e6('0x2f')][_0x19e6('0x4a')]({'where':{'id':_0x2c2df8[_0x19e6('0x45')]['id']}})[_0x19e6('0x28')](handleEntityNotFound(_0x5d4ffe,null))[_0x19e6('0x28')](removeEntity(_0x5d4ffe,null))[_0x19e6('0x43')](handleError(_0x5d4ffe,null));};exports[_0x19e6('0x4e')]=function(_0x3dc4d2,_0x2efddf){return db[_0x19e6('0x2f')][_0x19e6('0x4e')]()[_0x19e6('0x28')](respondWithResult(_0x2efddf,null))[_0x19e6('0x43')](handleError(_0x2efddf,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 5045642..6ae7b46 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 _0xbbc4=['ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./chatTransferReport.attributes'];(function(_0x55c97d,_0x228ffc){var _0x1d5112=function(_0x2ab908){while(--_0x2ab908){_0x55c97d['push'](_0x55c97d['shift']());}};_0x1d5112(++_0x228ffc);}(_0xbbc4,0x1ba));var _0x4bbc=function(_0x56fad7,_0x69bcbd){_0x56fad7=_0x56fad7-0x0;var _0x21dad9=_0xbbc4[_0x56fad7];return _0x21dad9;};'use strict';var _=require(_0x4bbc('0x0'));var util=require(_0x4bbc('0x1'));var logger=require(_0x4bbc('0x2'))(_0x4bbc('0x3'));var moment=require(_0x4bbc('0x4'));var BPromise=require(_0x4bbc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4bbc('0x6'));var config=require('../../config/environment');var attributes=require(_0x4bbc('0x7'));module['exports']=function(_0xa2ea30,_0x41e035){return _0xa2ea30['define'](_0x4bbc('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x4bbc('0x9'),'fields':[_0x4bbc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7420=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','ChatTransferReport','uniqueid','lodash'];(function(_0x1da811,_0x2e30db){var _0x53858b=function(_0x4e70ce){while(--_0x4e70ce){_0x1da811['push'](_0x1da811['shift']());}};_0x53858b(++_0x2e30db);}(_0x7420,0x16a));var _0x0742=function(_0x57802e,_0x103644){_0x57802e=_0x57802e-0x0;var _0x4fc542=_0x7420[_0x57802e];return _0x4fc542;};'use strict';var _=require(_0x0742('0x0'));var util=require('util');var logger=require(_0x0742('0x1'))(_0x0742('0x2'));var moment=require('moment');var BPromise=require(_0x0742('0x3'));var rp=require(_0x0742('0x4'));var fs=require('fs');var path=require(_0x0742('0x5'));var rimraf=require('rimraf');var config=require(_0x0742('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x0742('0x7')]=function(_0x1fa036,_0xf6503f){return _0x1fa036[_0x0742('0x8')](_0x0742('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x0742('0xa'),'fields':[_0x0742('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index be0c41a..dfddce6 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 _0x5d99=['../../config/environment','jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x5d99,0x9a));var _0x95d9=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x5d99[_0x4b03c9];return _0x161ba2;};'use strict';var _=require(_0x95d9('0x0'));var util=require('util');var moment=require(_0x95d9('0x1'));var BPromise=require(_0x95d9('0x2'));var rs=require(_0x95d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x95d9('0x4'))(_0x95d9('0x5'));var config=require(_0x95d9('0x6'));var jayson=require(_0x95d9('0x7'));var client=jayson[_0x95d9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54c98a,_0x150407,_0x292a5b){return new BPromise(function(_0x51ee1a,_0x2ff389){return client['request'](_0x54c98a,_0x292a5b)[_0x95d9('0x9')](function(_0x472128){logger[_0x95d9('0xa')](_0x95d9('0xb'),_0x150407,_0x95d9('0xc'));logger['debug'](_0x95d9('0xd'),_0x150407,'request\x20sent',JSON[_0x95d9('0xe')](_0x472128));if(_0x472128[_0x95d9('0xf')]){if(_0x472128[_0x95d9('0xf')][_0x95d9('0x10')]===0x1f4){logger['error'](_0x95d9('0xb'),_0x150407,_0x472128[_0x95d9('0xf')][_0x95d9('0x11')]);return _0x2ff389(_0x472128[_0x95d9('0xf')][_0x95d9('0x11')]);}logger['error'](_0x95d9('0xb'),_0x150407,_0x472128['error']['message']);return _0x51ee1a(_0x472128[_0x95d9('0xf')][_0x95d9('0x11')]);}else{logger[_0x95d9('0xa')](_0x95d9('0xb'),_0x150407,_0x95d9('0xc'));_0x51ee1a(_0x472128[_0x95d9('0x12')]['message']);}})[_0x95d9('0x13')](function(_0x11f8d5){logger[_0x95d9('0xf')](_0x95d9('0xb'),_0x150407,_0x11f8d5);_0x2ff389(_0x11f8d5);});});} \ No newline at end of file +var _0x7a8d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x7a8d,0x165));var _0xd7a8=function(_0x368b27,_0x489fe5){_0x368b27=_0x368b27-0x0;var _0x77421c=_0x7a8d[_0x368b27];return _0x77421c;};'use strict';var _=require(_0xd7a8('0x0'));var util=require(_0xd7a8('0x1'));var moment=require(_0xd7a8('0x2'));var BPromise=require('bluebird');var rs=require(_0xd7a8('0x3'));var fs=require('fs');var Redis=require(_0xd7a8('0x4'));var db=require(_0xd7a8('0x5'))['db'];var utils=require(_0xd7a8('0x6'));var logger=require(_0xd7a8('0x7'))(_0xd7a8('0x8'));var config=require(_0xd7a8('0x9'));var jayson=require(_0xd7a8('0xa'));var client=jayson[_0xd7a8('0xb')][_0xd7a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a21c1,_0x1c9805,_0x298945){return new BPromise(function(_0x284f88,_0x550ec0){return client[_0xd7a8('0xd')](_0x4a21c1,_0x298945)[_0xd7a8('0xe')](function(_0x2c28b7){logger[_0xd7a8('0xf')](_0xd7a8('0x10'),_0x1c9805,_0xd7a8('0x11'));logger['debug'](_0xd7a8('0x12'),_0x1c9805,_0xd7a8('0x11'),JSON[_0xd7a8('0x13')](_0x2c28b7));if(_0x2c28b7[_0xd7a8('0x14')]){if(_0x2c28b7['error'][_0xd7a8('0x15')]===0x1f4){logger['error'](_0xd7a8('0x10'),_0x1c9805,_0x2c28b7[_0xd7a8('0x14')][_0xd7a8('0x16')]);return _0x550ec0(_0x2c28b7[_0xd7a8('0x14')]['message']);}logger[_0xd7a8('0x14')](_0xd7a8('0x10'),_0x1c9805,_0x2c28b7[_0xd7a8('0x14')][_0xd7a8('0x16')]);return _0x284f88(_0x2c28b7['error']['message']);}else{logger[_0xd7a8('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x1c9805,_0xd7a8('0x11'));_0x284f88(_0x2c28b7['result'][_0xd7a8('0x16')]);}})[_0xd7a8('0x17')](function(_0x10af9f){logger[_0xd7a8('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x1c9805,_0x10af9f);_0x550ec0(_0x10af9f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c80a0e0..ba7628c 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 _0xeedd=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x41d0c6,_0x35a93e){var _0x50f407=function(_0x4cce17){while(--_0x4cce17){_0x41d0c6['push'](_0x41d0c6['shift']());}};_0x50f407(++_0x35a93e);}(_0xeedd,0x7d));var _0xdeed=function(_0x58b40b,_0x3c2dbf){_0x58b40b=_0x58b40b-0x0;var _0x5715e2=_0xeedd[_0x58b40b];return _0x5715e2;};'use strict';var multer=require(_0xdeed('0x0'));var util=require(_0xdeed('0x1'));var path=require(_0xdeed('0x2'));var timeout=require(_0xdeed('0x3'));var express=require(_0xdeed('0x4'));var router=express['Router']();var fs_extra=require(_0xdeed('0x5'));var auth=require(_0xdeed('0x6'));var interaction=require(_0xdeed('0x7'));var config=require(_0xdeed('0x8'));var controller=require(_0xdeed('0x9'));router[_0xdeed('0xa')]('/',auth[_0xdeed('0xb')](),controller['index']);router[_0xdeed('0xa')]('/describe',auth[_0xdeed('0xb')](),controller[_0xdeed('0xc')]);router['get'](_0xdeed('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdeed('0xe')](_0xdeed('0xd'),auth[_0xdeed('0xb')](),controller[_0xdeed('0xf')]);router[_0xdeed('0x10')](_0xdeed('0xd'),auth[_0xdeed('0xb')](),controller[_0xdeed('0x11')]);module[_0xdeed('0x12')]=router; \ No newline at end of file +var _0x5b57=['get','isAuthenticated','index','describe','/:id','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5b57,0x15d));var _0x75b5=function(_0x3f1500,_0x51abfc){_0x3f1500=_0x3f1500-0x0;var _0x472f31=_0x5b57[_0x3f1500];return _0x472f31;};'use strict';var multer=require(_0x75b5('0x0'));var util=require(_0x75b5('0x1'));var path=require(_0x75b5('0x2'));var timeout=require(_0x75b5('0x3'));var express=require(_0x75b5('0x4'));var router=express[_0x75b5('0x5')]();var fs_extra=require(_0x75b5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x75b5('0x7'));var controller=require('./chatTransferReport.controller');router[_0x75b5('0x8')]('/',auth[_0x75b5('0x9')](),controller[_0x75b5('0xa')]);router[_0x75b5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x75b5('0xb')]);router[_0x75b5('0x8')](_0x75b5('0xc'),auth[_0x75b5('0x9')](),controller['show']);router['post']('/',auth[_0x75b5('0x9')](),controller[_0x75b5('0xd')]);router[_0x75b5('0xe')](_0x75b5('0xc'),auth['isAuthenticated'](),controller[_0x75b5('0xf')]);router['delete'](_0x75b5('0xc'),auth[_0x75b5('0x9')](),controller[_0x75b5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index d44d12f..d4af30f 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 _0x99e9=['System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x12bcf7,_0x20878d){var _0x516440=function(_0x26eff1){while(--_0x26eff1){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x516440(++_0x20878d);}(_0x99e9,0xb4));var _0x999e=function(_0x169e53,_0x46be55){_0x169e53=_0x169e53-0x0;var _0x252bb3=_0x99e9[_0x169e53];return _0x252bb3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x999e('0x0'));module[_0x999e('0x1')]={'name':{'type':Sequelize[_0x999e('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x999e('0x2')]},'mapKey':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x4')},'customerAlias':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x999e('0x2')]},'animation':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x999e('0x9')](_0x999e('0xa'),_0x999e('0xb')),'defaultValue':_0x999e('0xa')},'header_online':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xc')},'start_chat_button':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0xf')},'download_transcript':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x999e('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x13')},'noteTitle':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x15')},'closingMessageButton':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xe')},'skipMessageButton':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x16')},'conditionAgreement':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0x999e('0x18'),_0x999e('0x19')),'defaultValue':_0x999e('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x999e('0x11')],'defaultValue':function(){return JSON[_0x999e('0x1a')]({'items':[{'type':_0x999e('0x1b'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x999e('0x1c'),'helpText':''}},{'type':_0x999e('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x999e('0x3'),'type':_0x999e('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x999e('0x1d')](_0x999e('0x1e'))?JSON[_0x999e('0x1f')](this[_0x999e('0x1d')]('onlineForm')):{};},'set':function(_0x2e1cc5){return this[_0x999e('0x20')](_0x999e('0x1e'),JSON[_0x999e('0x1a')](_0x2e1cc5));}},'offlineForm':{'type':Sequelize[_0x999e('0x11')],'defaultValue':function(){return JSON[_0x999e('0x1a')]({'items':[{'type':_0x999e('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x999e('0x3'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x999e('0x21')},'props':{'title':_0x999e('0x21'),'helpText':_0x999e('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x999e('0x23'))?JSON[_0x999e('0x1f')](this[_0x999e('0x1d')](_0x999e('0x23'))):{};},'set':function(_0x15dca1){return this[_0x999e('0x20')](_0x999e('0x23'),JSON[_0x999e('0x1a')](_0x15dca1));}},'token':{'type':Sequelize[_0x999e('0x2')],'defaultValue':function(){return rs[_0x999e('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x999e('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x999e('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x16')},'sendUnmanaged':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x999e('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x999e('0x2')]},'notificationTemplate':{'type':Sequelize[_0x999e('0x11')],'defaultValue':function(){return _0x999e('0x27');}},'notificationSound':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x999e('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x999e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x999e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x28')},'systemAvatar':{'type':Sequelize[_0x999e('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x999e('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![],'comment':_0x999e('0x29'),'set':function(_0x1e1229){if(!_0x1e1229)this[_0x999e('0x20')]('mandatoryDispositionPauseId',null);this[_0x999e('0x20')]('mandatoryDisposition',_0x1e1229);}},'vidaooEscalation':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x999e('0x2')]},'vidaooTopic':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x2a')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x999e('0x2b');}},'vidaooMetadata':{'type':Sequelize[_0x999e('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x22fb=['email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','TEXT','stringify','input','name','text','getDataValue','parse','setDataValue','textarea','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address'];(function(_0x31911a,_0x388623){var _0xc8d19=function(_0x388e02){while(--_0x388e02){_0x31911a['push'](_0x31911a['shift']());}};_0xc8d19(++_0x388623);}(_0x22fb,0x192));var _0xb22f=function(_0x52a195,_0x35dfbe){_0x52a195=_0x52a195-0x0;var _0x31a85c=_0x22fb[_0x52a195];return _0x31a85c;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xb22f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'unique':_0xb22f('0x2')},'description':{'type':Sequelize[_0xb22f('0x1')]},'mapKey':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0x3')},'key':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x4')},'customerAlias':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb22f('0x1')]},'animation':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb22f('0x9')](_0xb22f('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0xc')},'header_offline':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xd')},'download_transcript':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xf')},'noteTitle':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x10')},'closingMessageButton':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xc')},'skipMessageButton':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x11')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x12')},'ratingType':{'type':Sequelize[_0xb22f('0x9')](_0xb22f('0x13'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':function(){return JSON[_0xb22f('0x15')]({'items':[{'type':_0xb22f('0x16'),'variable':null,'config':{'placeholder':_0xb22f('0x17'),'type':_0xb22f('0x18'),'required':!![]},'props':{'title':_0xb22f('0x17'),'helpText':''}},{'type':_0xb22f('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb22f('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb22f('0x19')]('onlineForm')?JSON[_0xb22f('0x1a')](this[_0xb22f('0x19')]('onlineForm')):{};},'set':function(_0x4687f2){return this[_0xb22f('0x1b')]('onlineForm',JSON[_0xb22f('0x15')](_0x4687f2));}},'offlineForm':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':function(){return JSON[_0xb22f('0x15')]({'items':[{'type':_0xb22f('0x16'),'props':{'title':_0xb22f('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xb22f('0x3'),'type':_0xb22f('0x3')},'variable':null},{'type':_0xb22f('0x1c'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xb22f('0x19')]('offlineForm')?JSON[_0xb22f('0x1a')](this[_0xb22f('0x19')](_0xb22f('0x1d'))):{};},'set':function(_0x413575){return this[_0xb22f('0x1b')]('offlineForm',JSON['stringify'](_0x413575));}},'token':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':function(){return rs[_0xb22f('0x1e')]();}},'autoclose':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb22f('0x1')]},'forwardOffline':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x1f')},'waitingMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x20')},'offlineMessageSubject':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0x21')},'enableUnmanagedNote':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x22')},'skipUnmanaged':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x11')},'sendUnmanaged':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb22f('0x14')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':function(){return _0xb22f('0x23');}},'notificationSound':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x24')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb22f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x25')},'verticalAlignment':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x26')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xb22f('0x1')]},'customerAvatar':{'type':Sequelize[_0xb22f('0x14')]},'showCustomerAvatar':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xb22f('0x14')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb22f('0x7')],'comment':_0xb22f('0x28')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb22f('0x29'),'set':function(_0x2d265c){if(!_0x2d265c)this[_0xb22f('0x1b')]('mandatoryDispositionPauseId',null);this[_0xb22f('0x1b')](_0xb22f('0x2a'),_0x2d265c);}},'vidaooEscalation':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb22f('0x1')]},'vidaooTopic':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x2b')},'vidaooNote':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':function(){return _0xb22f('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index c65a8f5..798f267 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 _0x6691=['show','params','length','options','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','create','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','ChatApplication','List','applications','Applications','list','asc','account','ListId','contact','customerIp','headers','cf-connecting-ip','first','x-forwarded-for','split','firstName','x-real-port','referer','browser','format','version','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','offline','send','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','openNewInteraction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','mimetype','toPairsIn','mapValues','subjectOffline','email','NotifyMailAccount','notifyMail','files','offline-chat','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','URL','address','3.1.0','remote','x-real-ip','connection','remoteAddress','replace','alignment','textColor','textButtonColor','IntervalId','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','stack','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../config/logger','api','../../config/environment','url','defaults','redis','localhost','socket.io-emitter','register','html-to-text','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch','end','json','undefined','count','offset','limit','status','set','Content-Range','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus','name','mandatoryDispositionPause','map','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','ChatWebsite','includeAll','include','findAll','rows'];(function(_0x4e7f55,_0x3729f9){var _0xa2aee1=function(_0x1a66a2){while(--_0x1a66a2){_0x4e7f55['push'](_0x4e7f55['shift']());}};_0xa2aee1(++_0x3729f9);}(_0x6691,0xe7));var _0x1669=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6691[_0x1035c1];return _0x308d67;};'use strict';var BPromise=require(_0x1669('0x0'));var Mustache=require(_0x1669('0x1'));var util=require(_0x1669('0x2'));var path=require(_0x1669('0x3'));var ejs=require(_0x1669('0x4'));var fs=require('fs');var fs_extra=require(_0x1669('0x5'));var _=require(_0x1669('0x6'));var querystring=require(_0x1669('0x7'));var Redis=require(_0x1669('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x1669('0x9'))(_0x1669('0xa'));var config=require(_0x1669('0xb'));var url=require(_0x1669('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1669('0xd')](config[_0x1669('0xe')],{'host':_0x1669('0xf'),'port':0x18eb});var socket=require(_0x1669('0x10'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x1669('0x11')](socket);var htmlToText=require(_0x1669('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x1669('0x13')][_0x1669('0x14')]({'port':0x232c});var client9002=jayson[_0x1669('0x13')]['http']({'port':0x232a});var client9003=jayson[_0x1669('0x13')][_0x1669('0x14')]({'port':0x232b});var client9001=jayson[_0x1669('0x13')][_0x1669('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x2552a3,_0x5ebf12,_0x4ae9a7,_0x2100b7){return new BPromise(function(_0x4647db,_0x2d926e){var _0x3c352b=_0x2100b7||client;return _0x3c352b[_0x1669('0x15')](_0x2552a3,_0x4ae9a7)[_0x1669('0x16')](function(_0x5868be){logger['info'](_0x1669('0x17'),_0x5ebf12,_0x1669('0x18'));logger[_0x1669('0x19')](_0x1669('0x1a'),_0x5ebf12,'request\x20sent',JSON['stringify'](_0x5868be));if(_0x5868be[_0x1669('0x1b')]){if(_0x5868be[_0x1669('0x1b')][_0x1669('0x1c')]===0x1f4){logger[_0x1669('0x1b')](_0x1669('0x17'),_0x5ebf12,_0x5868be['error']['message']);return _0x2d926e(_0x5868be[_0x1669('0x1b')][_0x1669('0x1d')]);}logger[_0x1669('0x1b')](_0x1669('0x17'),_0x5ebf12,_0x5868be['error']['message']);return _0x4647db(_0x5868be[_0x1669('0x1b')]['message']);}else{logger['info'](_0x1669('0x17'),_0x5ebf12,_0x1669('0x18'));_0x4647db(_0x5868be['result'][_0x1669('0x1d')]);}})[_0x1669('0x1e')](function(_0x1345d8){logger['error'](_0x1669('0x17'),_0x5ebf12,_0x1345d8);_0x2d926e(_0x1345d8);});});}function respondWithStatusCode(_0x87b47b,_0x623948){_0x623948=_0x623948||0xcc;return function(_0x301dc7){if(_0x301dc7){return _0x87b47b['sendStatus'](_0x623948);}return _0x87b47b['status'](_0x623948)[_0x1669('0x1f')]();};}function respondWithResult(_0x43577b,_0x40612b){_0x40612b=_0x40612b||0xc8;return function(_0x321ccf){if(_0x321ccf){return _0x43577b['status'](_0x40612b)[_0x1669('0x20')](_0x321ccf);}};}function respondWithFilteredResult(_0x4401a2,_0x12470c){return function(_0x4a228e){if(_0x4a228e){var _0x3055aa=typeof _0x12470c['offset']===_0x1669('0x21')&&typeof _0x12470c['limit']==='undefined';var _0x1ab97b=_0x4a228e[_0x1669('0x22')];var _0x1f62ea=_0x3055aa?0x0:_0x12470c[_0x1669('0x23')];var _0x35c0ac=_0x3055aa?_0x4a228e[_0x1669('0x22')]:_0x12470c[_0x1669('0x23')]+_0x12470c[_0x1669('0x24')];var _0x57e754;if(_0x35c0ac>=_0x1ab97b){_0x35c0ac=_0x1ab97b;_0x57e754=0xc8;}else{_0x57e754=0xce;}_0x4401a2[_0x1669('0x25')](_0x57e754);return _0x4401a2[_0x1669('0x26')](_0x1669('0x27'),_0x1f62ea+'-'+_0x35c0ac+'/'+_0x1ab97b)[_0x1669('0x20')](_0x4a228e);}return null;};}function saveUpdates(_0x348c14){return function(_0x3b0437){if(_0x3b0437){return _0x3b0437[_0x1669('0x28')](_0x348c14)[_0x1669('0x16')](function(_0x15bebb){return _0x15bebb;});}return null;};}function removeEntity(_0x404d87){return function(_0x1af32e){if(_0x1af32e){return _0x1af32e['destroy']()[_0x1669('0x16')](function(){var _0x324fe9=_0x1af32e[_0x1669('0x29')]({'plain':!![]});var _0x1827e2=_0x1669('0x2a');return db[_0x1669('0x2b')][_0x1669('0x2c')]({'where':{'type':_0x1827e2,'resourceId':_0x324fe9['id']}})[_0x1669('0x16')](function(){return _0x1af32e;});})[_0x1669('0x16')](function(){_0x404d87[_0x1669('0x25')](0xcc)[_0x1669('0x1f')]();});}};}function handleEntityNotFound(_0x3938f1){return function(_0x182241){if(!_0x182241){_0x3938f1[_0x1669('0x2d')](0x194);}return _0x182241;};}function handleError(_0xa74528,_0x5c9be4){_0x5c9be4=_0x5c9be4||0x1f4;return function(_0x58c844){logger[_0x1669('0x1b')](_0x58c844['stack']);if(_0x58c844[_0x1669('0x2e')]){delete _0x58c844['name'];}_0xa74528[_0x1669('0x25')](_0x5c9be4)['send'](_0x58c844);};}exports['index']=function(_0x834182,_0x23bf51){var _0x6165df={'include':[{'model':db['Pause'],'as':_0x1669('0x2f')}]},_0x1fdd21={},_0x610175={'count':0x0,'rows':[]};var _0x22ab96=_[_0x1669('0x30')](db['ChatWebsite'][_0x1669('0x31')],function(_0x5925ff){return{'name':_0x5925ff['fieldName'],'type':_0x5925ff['type'][_0x1669('0x32')]};});_0x1fdd21[_0x1669('0x33')]=_[_0x1669('0x30')](_0x22ab96,_0x1669('0x2e'));_0x1fdd21[_0x1669('0x34')]=_[_0x1669('0x35')](_0x834182[_0x1669('0x34')]);_0x1fdd21['filters']=_[_0x1669('0x36')](_0x1fdd21[_0x1669('0x33')],_0x1fdd21[_0x1669('0x34')]);_0x6165df[_0x1669('0x37')]=_['intersection'](_0x1fdd21[_0x1669('0x33')],qs[_0x1669('0x38')](_0x834182[_0x1669('0x34')][_0x1669('0x38')]));_0x6165df[_0x1669('0x37')]=_0x6165df[_0x1669('0x37')]['length']?_0x6165df[_0x1669('0x37')]:_0x1fdd21[_0x1669('0x33')];if(!_0x834182[_0x1669('0x34')][_0x1669('0x39')](_0x1669('0x3a'))){_0x6165df[_0x1669('0x24')]=qs[_0x1669('0x24')](_0x834182[_0x1669('0x34')][_0x1669('0x24')]);_0x6165df[_0x1669('0x23')]=qs[_0x1669('0x23')](_0x834182[_0x1669('0x34')][_0x1669('0x23')]);}_0x6165df[_0x1669('0x3b')]=qs['sort'](_0x834182[_0x1669('0x34')][_0x1669('0x3c')]);_0x6165df[_0x1669('0x3d')]=qs[_0x1669('0x3e')](_[_0x1669('0x3f')](_0x834182[_0x1669('0x34')],_0x1fdd21['filters']),_0x22ab96);if(_0x834182['query'][_0x1669('0x40')]){_0x6165df[_0x1669('0x3d')]=_[_0x1669('0x41')](_0x6165df[_0x1669('0x3d')],{'$or':_[_0x1669('0x30')](_0x22ab96,function(_0x5bb65a){if(_0x5bb65a[_0x1669('0x42')]!=='VIRTUAL'){var _0x5df323={};_0x5df323[_0x5bb65a[_0x1669('0x2e')]]={'$like':'%'+_0x834182[_0x1669('0x34')][_0x1669('0x40')]+'%'};return _0x5df323;}})});}_0x6165df=_[_0x1669('0x41')]({},_0x6165df,_0x834182['options']);var _0x174e2f={'where':_0x6165df['where']};return db[_0x1669('0x43')][_0x1669('0x22')](_0x174e2f)[_0x1669('0x16')](function(_0x19bdec){_0x610175[_0x1669('0x22')]=_0x19bdec;if(_0x834182[_0x1669('0x34')][_0x1669('0x44')]){_0x6165df[_0x1669('0x45')]=[{'all':!![]}];}return db[_0x1669('0x43')][_0x1669('0x46')](_0x6165df);})['then'](function(_0x1466a2){_0x610175[_0x1669('0x47')]=_0x1466a2;return _0x610175;})[_0x1669('0x16')](respondWithFilteredResult(_0x23bf51,_0x6165df))['catch'](handleError(_0x23bf51,null));};exports[_0x1669('0x48')]=function(_0x28a30d,_0x490ea2){var _0x19bf78={'raw':![],'where':{'id':_0x28a30d[_0x1669('0x49')]['id']},'include':[{'model':db['Pause'],'as':_0x1669('0x2f')}]},_0x115645={};_0x115645[_0x1669('0x33')]=_[_0x1669('0x35')](db['ChatWebsite']['rawAttributes']);_0x115645[_0x1669('0x34')]=_[_0x1669('0x35')](_0x28a30d[_0x1669('0x34')]);_0x115645[_0x1669('0x3e')]=_[_0x1669('0x36')](_0x115645[_0x1669('0x33')],_0x115645[_0x1669('0x34')]);_0x19bf78[_0x1669('0x37')]=_[_0x1669('0x36')](_0x115645[_0x1669('0x33')],qs[_0x1669('0x38')](_0x28a30d[_0x1669('0x34')][_0x1669('0x38')]));_0x19bf78[_0x1669('0x37')]=_0x19bf78[_0x1669('0x37')][_0x1669('0x4a')]?_0x19bf78[_0x1669('0x37')]:_0x115645[_0x1669('0x33')];if(_0x28a30d[_0x1669('0x34')][_0x1669('0x44')]){_0x19bf78[_0x1669('0x45')]=[{'all':!![]}];}_0x19bf78=_[_0x1669('0x41')]({},_0x19bf78,_0x28a30d[_0x1669('0x4b')]);return db[_0x1669('0x43')]['find'](_0x19bf78)[_0x1669('0x16')](handleEntityNotFound(_0x490ea2,null))['then'](respondWithResult(_0x490ea2,null))[_0x1669('0x1e')](handleError(_0x490ea2,null));};exports['create']=function(_0x5d527d,_0x575796){return db['ChatWebsite']['create'](_0x5d527d[_0x1669('0x4c')],{})[_0x1669('0x16')](function(_0x5b98c0){var _0x3d08f2=_0x5d527d['user'][_0x1669('0x29')]({'plain':!![]});if(!_0x3d08f2)throw new Error(_0x1669('0x4d'));if(_0x3d08f2[_0x1669('0x4e')]==='user'){var _0x2ecc38=_0x5b98c0[_0x1669('0x29')]({'plain':!![]});var _0x25695c=_0x1669('0x2a');return db[_0x1669('0x4f')][_0x1669('0x50')]({'where':{'name':_0x25695c,'userProfileId':_0x3d08f2['userProfileId']},'raw':!![]})[_0x1669('0x16')](function(_0x4964b0){if(_0x4964b0&&_0x4964b0[_0x1669('0x51')]===0x0){return db['UserProfileResource'][_0x1669('0x52')]({'name':_0x2ecc38[_0x1669('0x2e')],'resourceId':_0x2ecc38['id'],'type':_0x4964b0[_0x1669('0x2e')],'sectionId':_0x4964b0['id']},{})[_0x1669('0x16')](function(){return _0x5b98c0;});}else{return _0x5b98c0;}})['catch'](function(_0x3876cb){logger[_0x1669('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3876cb);throw _0x3876cb;});}return _0x5b98c0;})[_0x1669('0x16')](respondWithResult(_0x575796,0xc9))[_0x1669('0x1e')](handleError(_0x575796,null));};exports[_0x1669('0x28')]=function(_0x38cf1a,_0x2237ab){if(_0x38cf1a[_0x1669('0x4c')]['id']){delete _0x38cf1a[_0x1669('0x4c')]['id'];}return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x38cf1a[_0x1669('0x49')]['id']},'include':[{'model':db['Pause'],'as':_0x1669('0x2f')}]})[_0x1669('0x16')](handleEntityNotFound(_0x2237ab,null))[_0x1669('0x16')](saveUpdates(_0x38cf1a[_0x1669('0x4c')],null))['then'](respondWithResult(_0x2237ab,null))[_0x1669('0x1e')](handleError(_0x2237ab,null));};exports[_0x1669('0x2c')]=function(_0x3dfa73,_0x4a2eca){return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x3dfa73[_0x1669('0x49')]['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x4a2eca,null))[_0x1669('0x16')](removeEntity(_0x4a2eca,null))['catch'](handleError(_0x4a2eca,null));};exports[_0x1669('0x53')]=function(_0x2ab2f6,_0xa43a09){return db[_0x1669('0x43')]['describe']()['then'](respondWithResult(_0xa43a09,null))[_0x1669('0x1e')](handleError(_0xa43a09,null));};exports[_0x1669('0x54')]=function(_0x24fc6e,_0xea02bd){if(_0x24fc6e[_0x1669('0x4c')]['id']){delete _0x24fc6e[_0x1669('0x4c')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x24fc6e[_0x1669('0x49')]['id']}})['then'](handleEntityNotFound(_0xea02bd,null))[_0x1669('0x16')](function(_0x5037a8){if(_0x5037a8){_0x24fc6e[_0x1669('0x4c')][_0x1669('0x55')]=_0x5037a8['id'];return db[_0x1669('0x56')][_0x1669('0x52')](_0x24fc6e[_0x1669('0x4c')]);}})['then'](respondWithResult(_0xea02bd,null))[_0x1669('0x1e')](handleError(_0xea02bd,null));};exports[_0x1669('0x57')]=function(_0x3df7fd,_0x7d644){var _0x39f21b={'raw':![],'where':{}};var _0x6d0306={};var _0x272111={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1669('0x58')]({'where':{'id':_0x3df7fd['params']['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x7d644,null))[_0x1669('0x16')](function(_0x4d566e){if(_0x4d566e){_0x6d0306[_0x1669('0x33')]=_['keys'](db[_0x1669('0x56')]['rawAttributes']);_0x6d0306[_0x1669('0x34')]=_['keys'](_0x3df7fd[_0x1669('0x34')]);_0x6d0306['filters']=_[_0x1669('0x36')](_0x6d0306['model'],_0x6d0306[_0x1669('0x34')]);_0x39f21b[_0x1669('0x37')]=_['intersection'](_0x6d0306[_0x1669('0x33')],qs[_0x1669('0x38')](_0x3df7fd[_0x1669('0x34')][_0x1669('0x38')]));_0x39f21b[_0x1669('0x37')]=_0x39f21b[_0x1669('0x37')]['length']?_0x39f21b[_0x1669('0x37')]:_0x6d0306['model'];if(!_0x3df7fd[_0x1669('0x34')][_0x1669('0x39')](_0x1669('0x3a'))){_0x39f21b[_0x1669('0x24')]=qs[_0x1669('0x24')](_0x3df7fd[_0x1669('0x34')][_0x1669('0x24')]);_0x39f21b[_0x1669('0x23')]=qs[_0x1669('0x23')](_0x3df7fd['query'][_0x1669('0x23')]);}_0x39f21b[_0x1669('0x3b')]=qs['sort'](_0x3df7fd[_0x1669('0x34')]['sort']);_0x39f21b['where']=qs[_0x1669('0x3e')](_['pick'](_0x3df7fd[_0x1669('0x34')],_0x6d0306[_0x1669('0x3e')]));_0x39f21b[_0x1669('0x3d')][_0x1669('0x55')]=_0x4d566e['id'];if(_0x3df7fd['query'][_0x1669('0x40')]){_0x39f21b[_0x1669('0x3d')]=_[_0x1669('0x41')](_0x39f21b[_0x1669('0x3d')],{'$or':_['map'](_0x39f21b[_0x1669('0x37')],function(_0x3ca4ab){var _0x3d1dbf={};_0x3d1dbf[_0x3ca4ab]={'$like':'%'+_0x3df7fd[_0x1669('0x34')][_0x1669('0x40')]+'%'};return _0x3d1dbf;})});}_0x39f21b=_[_0x1669('0x41')]({},_0x39f21b,_0x3df7fd[_0x1669('0x4b')]);return db['Disposition'][_0x1669('0x22')]({'where':_0x39f21b[_0x1669('0x3d')]})['then'](function(_0x5db23d){_0x272111[_0x1669('0x22')]=_0x5db23d;if(_0x3df7fd[_0x1669('0x34')][_0x1669('0x44')]){_0x39f21b[_0x1669('0x45')]=[{'all':!![]}];}return db[_0x1669('0x56')][_0x1669('0x46')](_0x39f21b);})[_0x1669('0x16')](function(_0x533e59){_0x272111['rows']=_0x533e59;return _0x272111;});}})[_0x1669('0x16')](respondWithFilteredResult(_0x7d644,_0x39f21b))[_0x1669('0x1e')](handleError(_0x7d644,null));};exports[_0x1669('0x59')]=function(_0x56f211,_0x70a9ca){return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x56f211[_0x1669('0x49')]['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x70a9ca,null))[_0x1669('0x16')](function(_0x1bebe1){if(_0x1bebe1){return _0x1bebe1['removeDispositions'](_0x56f211[_0x1669('0x34')][_0x1669('0x5a')]);}})[_0x1669('0x16')](respondWithStatusCode(_0x70a9ca,null))['catch'](handleError(_0x70a9ca,null));};exports['addAnswer']=function(_0x34d4ec,_0x1158d6){if(_0x34d4ec[_0x1669('0x4c')]['id']){delete _0x34d4ec[_0x1669('0x4c')]['id'];}return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x34d4ec[_0x1669('0x49')]['id']}})['then'](handleEntityNotFound(_0x1158d6,null))[_0x1669('0x16')](function(_0x35597e){if(_0x35597e){_0x34d4ec[_0x1669('0x4c')][_0x1669('0x55')]=_0x35597e['id'];return db[_0x1669('0x5b')]['create'](_0x34d4ec[_0x1669('0x4c')]);}})[_0x1669('0x16')](respondWithResult(_0x1158d6,null))['catch'](handleError(_0x1158d6,null));};exports[_0x1669('0x5c')]=function(_0x418eed,_0x5b82bc){var _0x2b538c={'raw':![],'where':{}};var _0xe35d38={};var _0x4137fb={'count':0x0,'rows':[]};return db[_0x1669('0x43')][_0x1669('0x58')]({'where':{'id':_0x418eed[_0x1669('0x49')]['id']}})['then'](handleEntityNotFound(_0x5b82bc,null))['then'](function(_0x3704f4){if(_0x3704f4){_0xe35d38[_0x1669('0x33')]=_[_0x1669('0x35')](db[_0x1669('0x5b')][_0x1669('0x31')]);_0xe35d38['query']=_['keys'](_0x418eed['query']);_0xe35d38['filters']=_['intersection'](_0xe35d38['model'],_0xe35d38[_0x1669('0x34')]);_0x2b538c[_0x1669('0x37')]=_['intersection'](_0xe35d38[_0x1669('0x33')],qs[_0x1669('0x38')](_0x418eed[_0x1669('0x34')][_0x1669('0x38')]));_0x2b538c[_0x1669('0x37')]=_0x2b538c['attributes'][_0x1669('0x4a')]?_0x2b538c[_0x1669('0x37')]:_0xe35d38['model'];if(!_0x418eed[_0x1669('0x34')][_0x1669('0x39')](_0x1669('0x3a'))){_0x2b538c[_0x1669('0x24')]=qs[_0x1669('0x24')](_0x418eed[_0x1669('0x34')]['limit']);_0x2b538c[_0x1669('0x23')]=qs[_0x1669('0x23')](_0x418eed[_0x1669('0x34')][_0x1669('0x23')]);}_0x2b538c['order']=qs['sort'](_0x418eed[_0x1669('0x34')][_0x1669('0x3c')]);_0x2b538c['where']=qs['filters'](_[_0x1669('0x3f')](_0x418eed['query'],_0xe35d38[_0x1669('0x3e')]));_0x2b538c[_0x1669('0x3d')][_0x1669('0x55')]=_0x3704f4['id'];if(_0x418eed['query'][_0x1669('0x40')]){_0x2b538c[_0x1669('0x3d')]=_[_0x1669('0x41')](_0x2b538c[_0x1669('0x3d')],{'$or':_['map'](_0x2b538c['attributes'],function(_0xe9b1b){var _0x32c53a={};_0x32c53a[_0xe9b1b]={'$like':'%'+_0x418eed['query'][_0x1669('0x40')]+'%'};return _0x32c53a;})});}_0x2b538c=_[_0x1669('0x41')]({},_0x2b538c,_0x418eed[_0x1669('0x4b')]);return db['CannedAnswer']['count']({'where':_0x2b538c[_0x1669('0x3d')]})[_0x1669('0x16')](function(_0x2e88e8){_0x4137fb[_0x1669('0x22')]=_0x2e88e8;if(_0x418eed[_0x1669('0x34')][_0x1669('0x44')]){_0x2b538c[_0x1669('0x45')]=[{'all':!![]}];}return db[_0x1669('0x5b')][_0x1669('0x46')](_0x2b538c);})[_0x1669('0x16')](function(_0xab854b){_0x4137fb[_0x1669('0x47')]=_0xab854b;return _0x4137fb;});}})['then'](respondWithFilteredResult(_0x5b82bc,_0x2b538c))['catch'](handleError(_0x5b82bc,null));};exports[_0x1669('0x5d')]=function(_0x52ec4b,_0x508b94){return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x52ec4b[_0x1669('0x49')]['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x508b94,null))[_0x1669('0x16')](function(_0x1b4941){if(_0x1b4941){return _0x1b4941[_0x1669('0x5d')](_0x52ec4b[_0x1669('0x34')][_0x1669('0x5a')]);}})[_0x1669('0x16')](respondWithStatusCode(_0x508b94,null))[_0x1669('0x1e')](handleError(_0x508b94,null));};exports[_0x1669('0x5e')]=function(_0x247939,_0x4d461d){_0x247939['body'][_0x1669('0x5f')]=_0x247939[_0x1669('0x60')][_0x1669('0x61')];return db['ChatWebsite'][_0x1669('0x50')]({'where':{'id':_0x247939[_0x1669('0x49')]['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x4d461d,null))['then'](saveUpdates(_0x247939['body'],null))['then'](respondWithResult(_0x4d461d,null))[_0x1669('0x1e')](handleError(_0x4d461d,null));};exports['addAvatar']=function(_0x1f2f4d,_0x4877aa){_0x1f2f4d['body'][_0x1669('0x62')]=_0x1f2f4d[_0x1669('0x60')][_0x1669('0x61')];return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x1f2f4d[_0x1669('0x49')]['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x4877aa,null))['then'](saveUpdates(_0x1f2f4d[_0x1669('0x4c')],null))[_0x1669('0x16')](respondWithResult(_0x4877aa,null))[_0x1669('0x1e')](handleError(_0x4877aa,null));};exports[_0x1669('0x63')]=function(_0x563429,_0x25ef1a){_0x563429[_0x1669('0x4c')][_0x1669('0x64')]=_0x563429[_0x1669('0x60')]['filename'];return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x563429['params']['id']}})['then'](handleEntityNotFound(_0x25ef1a,null))[_0x1669('0x16')](saveUpdates(_0x563429[_0x1669('0x4c')],null))['then'](respondWithResult(_0x25ef1a,null))['catch'](handleError(_0x25ef1a,null));};exports[_0x1669('0x65')]=function(_0x35b279,_0xd90e09){_0x35b279['body'][_0x1669('0x66')]=_0x35b279[_0x1669('0x60')][_0x1669('0x61')];return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x35b279['params']['id']}})['then'](handleEntityNotFound(_0xd90e09,null))[_0x1669('0x16')](saveUpdates(_0x35b279['body'],null))[_0x1669('0x16')](respondWithResult(_0xd90e09,null))[_0x1669('0x1e')](handleError(_0xd90e09,null));};exports[_0x1669('0x67')]=function(_0x5862eb,_0x276b78){var _0x4353c2=path[_0x1669('0x68')](config[_0x1669('0x69')],_0x1669('0x6a'));var _0x2cab47={'where':{'id':_0x5862eb[_0x1669('0x49')]['id']},'attributes':['id',_0x1669('0x5f')],'raw':!![]};var _0x3679d0=![];return require(_0x1669('0x6b'))[_0x1669('0x6c')]()['then'](function(_0xcf579f){if(_0xcf579f){_0x3679d0=_0xcf579f[_0x1669('0x6d')];}})[_0x1669('0x16')](function(){return db['ChatWebsite'][_0x1669('0x50')](_0x2cab47);})[_0x1669('0x16')](handleEntityNotFound(_0x276b78,null))['then'](function(_0x49c2fe){if(_0x49c2fe){if(!_[_0x1669('0x6e')](_0x49c2fe[_0x1669('0x5f')])){if(fs[_0x1669('0x6f')](path[_0x1669('0x68')](config['root'],_0x1669('0x70'),_0x49c2fe[_0x1669('0x5f')]))&&_0x3679d0){_0x4353c2=path[_0x1669('0x68')](config[_0x1669('0x69')],_0x1669('0x70'),_0x49c2fe['sitepic']);}}return _0x276b78[_0x1669('0x71')](_0x4353c2);}})['catch'](handleError(_0x276b78,null));};exports[_0x1669('0x72')]=function(_0x344b11,_0x460d0e){var _0x2808ac=path[_0x1669('0x68')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x438abe={'where':{'id':_0x344b11['params']['id']},'attributes':['id',_0x1669('0x62')],'raw':!![]};return db[_0x1669('0x43')][_0x1669('0x50')](_0x438abe)[_0x1669('0x16')](handleEntityNotFound(_0x460d0e,null))[_0x1669('0x16')](function(_0x8c0af8){if(_0x8c0af8){if(!_[_0x1669('0x6e')](_0x8c0af8[_0x1669('0x62')])){if(fs[_0x1669('0x6f')](path['join'](config[_0x1669('0x69')],'server/files/images/avatars/',_0x8c0af8[_0x1669('0x62')]))){_0x2808ac=path[_0x1669('0x68')](config['root'],_0x1669('0x73'),_0x8c0af8['agentAvatar']);}}return _0x460d0e[_0x1669('0x71')](_0x2808ac);}})[_0x1669('0x1e')](handleError(_0x460d0e,null));};exports[_0x1669('0x74')]=function(_0x461af2,_0x337325){var _0x3b7dce=path['join'](config[_0x1669('0x69')],_0x1669('0x75'));var _0x29b2b7={'where':{'id':_0x461af2[_0x1669('0x49')]['id']},'attributes':['id',_0x1669('0x64'),_0x1669('0x76')],'raw':!![]};return db['ChatWebsite'][_0x1669('0x50')](_0x29b2b7)[_0x1669('0x16')](handleEntityNotFound(_0x337325,null))[_0x1669('0x16')](function(_0x55778a){if(_0x55778a){if(!_[_0x1669('0x6e')](_0x55778a[_0x1669('0x64')])){if(fs['existsSync'](path[_0x1669('0x68')](config['root'],_0x1669('0x73'),_0x55778a[_0x1669('0x64')]))&&_0x55778a[_0x1669('0x76')]){_0x3b7dce=path['join'](config['root'],_0x1669('0x73'),_0x55778a[_0x1669('0x64')]);}}return _0x337325[_0x1669('0x71')](_0x3b7dce);}})[_0x1669('0x1e')](handleError(_0x337325,null));};exports['getSystemAvatar']=function(_0x54c7d0,_0x4c379a){var _0x1259d0=path['join'](config[_0x1669('0x69')],_0x1669('0x77'));var _0x5ba281={'where':{'id':_0x54c7d0['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x1669('0x43')][_0x1669('0x50')](_0x5ba281)[_0x1669('0x16')](handleEntityNotFound(_0x4c379a,null))[_0x1669('0x16')](function(_0x1ab6fd){if(_0x1ab6fd){if(!_[_0x1669('0x6e')](_0x1ab6fd[_0x1669('0x66')])){if(fs[_0x1669('0x6f')](path['join'](config[_0x1669('0x69')],_0x1669('0x73'),_0x1ab6fd[_0x1669('0x66')]))){_0x1259d0=path[_0x1669('0x68')](config[_0x1669('0x69')],_0x1669('0x73'),_0x1ab6fd[_0x1669('0x66')]);}}return _0x4c379a[_0x1669('0x71')](_0x1259d0);}})['catch'](handleError(_0x4c379a,null));};exports[_0x1669('0x78')]=function(_0x288269,_0xe08359){var _0x71746a=require(_0x1669('0x79'));var _0x5f3181=new _0x71746a();var _0x2202a3=_0x5f3181[_0x1669('0x7a')](_0x288269['headers'][_0x1669('0x7b')])[_0x1669('0x7c')]();var _0x5a24d3={'body':_0x288269['body'],'channel':_0x1669('0x7d')};var _0x285875=[];var _0x18fd61=[];var _0x1c34af={};var _0x24eb12=![];return db[_0x1669('0x7e')][_0x1669('0x53')]()[_0x1669('0x16')](function(_0x774a7e){if(!_0x774a7e){throw new db['Sequelize'][(_0x1669('0x7f'))](_0x1669('0x80'));}_0x285875=_[_0x1669('0x81')](_['keys'](_0x774a7e),[_0x1669('0x82'),_0x1669('0x83')]);_0x18fd61=_[_0x1669('0x81')](_[_0x1669('0x35')](_0x774a7e),['createdAt',_0x1669('0x83'),_0x1669('0x84'),'ListId']);if(_0x288269['body']['id']){delete _0x288269[_0x1669('0x4c')]['id'];}if(_['isNil'](_0x288269[_0x1669('0x4c')][_0x1669('0x85')])){throw new db[(_0x1669('0x86'))][(_0x1669('0x7f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x288269['body'][_0x1669('0x4c')])||_0x288269['body']['body']===''){throw new db[(_0x1669('0x86'))][(_0x1669('0x7f'))](_0x1669('0x87'));}if(_[_0x1669('0x6e')](_0x288269[_0x1669('0x4c')][_0x1669('0x88')])){throw new db[(_0x1669('0x86'))][(_0x1669('0x7f'))](_0x1669('0x89')+_0x18fd61);}if(!_[_0x1669('0x8a')](_0x18fd61,_0x288269['body'][_0x1669('0x88')])){throw new db[(_0x1669('0x86'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18fd61);}_0x1c34af[_0x288269[_0x1669('0x4c')][_0x1669('0x88')]]=_0x288269[_0x1669('0x4c')][_0x1669('0x85')];})[_0x1669('0x16')](function(){return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x288269[_0x1669('0x49')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1669('0x7e')],'as':_0x1669('0x8b'),'where':_0x1c34af,'limit':0x1,'order':[['updatedAt',_0x1669('0x8c')]]}]},{'model':db[_0x1669('0x8d')],'as':'Applications'}]});})[_0x1669('0x16')](handleEntityNotFound(_0xe08359,null))['then'](function(_0x81f3f2){if(_0x81f3f2&&_0x81f3f2[_0x1669('0x8e')]){_0x5a24d3['account']=_0x81f3f2;_0x5a24d3[_0x1669('0x8f')]=_0x81f3f2[_0x1669('0x90')];_0x5a24d3[_0x1669('0x91')]=_0x81f3f2['List'];_0x5a24d3[_0x1669('0x8f')]=_['orderBy'](_0x5a24d3[_0x1669('0x8f')],['priority'],[_0x1669('0x92')]);if(_0x5a24d3['account'][_0x1669('0x90')]){delete _0x5a24d3[_0x1669('0x93')][_0x1669('0x90')];}if(_0x5a24d3[_0x1669('0x93')]['List']&&_0x5a24d3[_0x1669('0x93')][_0x1669('0x8e')][_0x1669('0x8b')][_0x1669('0x4a')]){return _0x5a24d3['account'][_0x1669('0x8e')][_0x1669('0x8b')][0x0];}var _0x554124=_[_0x1669('0xd')](_0x288269[_0x1669('0x4c')],{'firstName':_0x288269[_0x1669('0x4c')]['from'],'ListId':_0x81f3f2[_0x1669('0x94')]});_0x554124[_0x288269[_0x1669('0x4c')][_0x1669('0x88')]]=_0x288269[_0x1669('0x4c')][_0x1669('0x85')];return db[_0x1669('0x7e')][_0x1669('0x52')](_0x554124,{'fields':_0x285875,'raw':!![]});}})[_0x1669('0x16')](handleEntityNotFound(_0xe08359,null))[_0x1669('0x16')](function(_0x2ca56e){_0x5a24d3[_0x1669('0x95')]=_0x2ca56e;var _0x51cc77=_0x288269['body'][_0x1669('0x96')];if(_0x288269[_0x1669('0x97')][_0x1669('0x98')]){_0x51cc77=_0x288269['headers'][_0x1669('0x98')];}else if(_0x288269['headers']['x-forwarded-for']){_0x51cc77=_[_0x1669('0x99')](_0x288269['headers'][_0x1669('0x9a')][_0x1669('0x9b')](','));}if(_0x2ca56e){var _0xfc8aaa={'ContactId':_0x2ca56e['id'],'ChatWebsiteId':_0x288269[_0x1669('0x49')]['id'],'from':(_0x2ca56e[_0x1669('0x9c')]||'')+'\x20'+(_0x2ca56e['lastName']||''),'customerIp':_0x51cc77,'customerPort':_0x288269[_0x1669('0x97')][_0x1669('0x9d')]?_0x288269[_0x1669('0x97')][_0x1669('0x9d')]:null,'referer':_0x288269[_0x1669('0x4c')][_0x1669('0x9e')],'browserName':_0x2202a3[_0x1669('0x9f')][_0x1669('0x2e')]&&_0x2202a3[_0x1669('0x9f')]['version']?util[_0x1669('0xa0')]('%s\x20%s',_0x2202a3[_0x1669('0x9f')]['name'],_0x2202a3[_0x1669('0x9f')][_0x1669('0xa1')]):'unknown','browserVersion':_0x2202a3[_0x1669('0x9f')]['version']||_0x1669('0xa2'),'osName':util[_0x1669('0xa0')](_0x1669('0xa3'),_0x2202a3['os'][_0x1669('0x2e')],_0x2202a3['os']['version']),'osVersion':_0x2202a3['os'][_0x1669('0xa1')],'deviceModel':_0x2202a3[_0x1669('0xa4')][_0x1669('0x33')]&&_0x2202a3[_0x1669('0xa4')][_0x1669('0xa5')]?util[_0x1669('0xa0')](_0x1669('0xa6'),_0x2202a3['device'][_0x1669('0x33')],_0x2202a3['device'][_0x1669('0xa5')],_0x2202a3[_0x1669('0xa4')][_0x1669('0x42')]):null,'deviceVendor':_0x2202a3[_0x1669('0xa4')][_0x1669('0xa5')],'deviceType':_0x2202a3['device']['type'],'formData':JSON[_0x1669('0xa7')](_0x288269['body'])};var _0x3b7010={'ChatWebsiteId':_0x288269[_0x1669('0x49')]['id'],'closed':![]};if(_0x288269[_0x1669('0x4c')][_0x1669('0xa8')]){_0x3b7010['threadId']=_0x288269[_0x1669('0x4c')]['threadId'];return db[_0x1669('0xa9')][_0x1669('0x50')]({'where':_0x3b7010})[_0x1669('0x16')](function(_0x4e68e2){if(_0x4e68e2){return[_0x4e68e2,![]];}_0xfc8aaa[_0x1669('0xa8')]=_0x288269[_0x1669('0x4c')]['threadId'];_0xfc8aaa['externalUrl']=_0x288269[_0x1669('0x4c')][_0x1669('0xaa')];return db[_0x1669('0xa9')][_0x1669('0x52')](_0xfc8aaa)[_0x1669('0x16')](function(_0x2c2237){return[_0x2c2237,!![]];});});}_0x3b7010[_0x1669('0xab')]=_0x2ca56e['id'];if(_0x288269['body'][_0x1669('0xac')]&&_0x288269[_0x1669('0x4c')]['interaction']['id']){_0x3b7010['id']=_0x288269[_0x1669('0x4c')]['interaction']['id'];return db['ChatInteraction'][_0x1669('0x50')]({'where':_0x3b7010})[_0x1669('0x16')](function(_0x212c10){if(_0x212c10){return[_0x212c10,![]];}return db['ChatInteraction'][_0x1669('0x52')](_0xfc8aaa)[_0x1669('0x16')](function(_0x9c0df9){return[_0x9c0df9,!![]];});});}return db[_0x1669('0xa9')]['create'](_0xfc8aaa)[_0x1669('0x16')](function(_0x1981ca){return[_0x1981ca,!![]];});}})[_0x1669('0xad')](function(_0x504c18,_0x4f87d4){if(_0x504c18){_0x24eb12=_0x4f87d4;if(!_0x4f87d4){var _0x481499={'from':(_0x5a24d3[_0x1669('0x95')][_0x1669('0x9c')]||'')+'\x20'+(_0x5a24d3['contact'][_0x1669('0xae')]||'')};if(_0x288269['body'][_0x1669('0xa8')]&&_0x288269[_0x1669('0x4c')]['messageId']&&_0x288269[_0x1669('0x4c')][_0x1669('0xa8')]!=_0x288269[_0x1669('0x4c')]['messageId']){_0x481499[_0x1669('0xa8')]=_0x288269[_0x1669('0x4c')][_0x1669('0xaf')];}return _0x504c18[_0x1669('0x28')](_0x481499);}else{return _0x504c18;}}})[_0x1669('0x16')](function(_0x2ae80f){_0x5a24d3[_0x1669('0xac')]=_0x2ae80f['get']({'plain':!![]});_0x5a24d3[_0x1669('0xac')][_0x1669('0xb0')]=_0x24eb12;if(_0x5a24d3[_0x1669('0xac')][_0x1669('0xb0')]){if(_0x5a24d3[_0x1669('0x93')][_0x1669('0xb1')]){_0x5a24d3['applications'][_0x1669('0xb2')]({'id':0x0,'priority':_0x5a24d3['applications'][_0x1669('0x4a')]+0x1,'app':_0x1669('0xb3'),'appdata':_0x1669('0xb4'),'interval':_0x1669('0xb5')});}}return db[_0x1669('0xb6')]['create']({'body':_0x288269['body']['body'],'ChatWebsiteId':_0x288269['params']['id'],'ChatInteractionId':_0x2ae80f['id'],'direction':'in','ContactId':_0x5a24d3[_0x1669('0x95')]['id'],'AttachmentId':_0x288269['body'][_0x1669('0xb7')]});})['then'](function(_0x40eea8){_0x5a24d3['message']=_0x40eea8;if(_0x5a24d3[_0x1669('0xac')]['UserId']){return db[_0x1669('0xb8')]['find']({'attributes':['id',_0x1669('0x2e')],'where':{'id':_0x5a24d3[_0x1669('0xac')][_0x1669('0xb9')]}})[_0x1669('0x16')](function(_0x33a8af){if(_0x33a8af){_0x5a24d3['applications'][_0x1669('0xba')]({'id':0x0,'priority':0x0,'app':_0x1669('0xbb'),'appdata':_0x33a8af['name']+','+(_0x5a24d3[_0x1669('0x93')][_0x1669('0xbc')]||0xa),'interval':_0x1669('0xb5')});_0x5a24d3[_0x1669('0xbd')]=!![];}return respondWithRpcPromise(_0x1669('0xbe'),'startRouting',_0x5a24d3);});}return respondWithRpcPromise(_0x1669('0xbe'),_0x1669('0xbf'),_0x5a24d3);})['then'](function(_0x3798a2){respondWithRpcPromise('EventManager','EventManager',{'event':_0x1669('0x78'),'message':_0x3798a2},client9002);return _0x3798a2;})[_0x1669('0x16')](respondWithResult(_0xe08359,null))[_0x1669('0x1e')](handleError(_0xe08359,null));};exports[_0x1669('0xc0')]=function(_0x21a63c,_0x4858d9){var _0x17a18f,_0x476300,_0x214bdd;var _0x1f54aa=[];var _0x5c6898={};var _0x1cd11a=_0x21a63c['files']||[];var _0x237dbb=[];var _0x18be40;return db[_0x1669('0x7e')]['describe']()[_0x1669('0x16')](function(_0x3efed6){if(!_0x3efed6){throw new db['Sequelize'][(_0x1669('0x7f'))]('no\x20available\x20attributes');}_0x1f54aa=_['difference'](_[_0x1669('0x35')](_0x3efed6),['createdAt',_0x1669('0x83'),'CompanyId',_0x1669('0x94')]);if(_0x21a63c[_0x1669('0x4c')]['id']){delete _0x21a63c[_0x1669('0x4c')]['id'];}if(_[_0x1669('0x6e')](_0x21a63c[_0x1669('0x4c')][_0x1669('0x85')])){throw _0x4858d9[_0x1669('0x25')](0x1f4)[_0x1669('0xc1')](new db[(_0x1669('0x86'))][(_0x1669('0x7f'))](_0x1669('0xc2')));}if(_['isNil'](_0x21a63c['body'][_0x1669('0x4c')])||_0x21a63c[_0x1669('0x4c')][_0x1669('0x4c')]===''){throw _0x4858d9[_0x1669('0x25')](0x1f4)[_0x1669('0xc1')](new db['Sequelize'][(_0x1669('0x7f'))](_0x1669('0x87')));}if(_[_0x1669('0x6e')](_0x21a63c[_0x1669('0x4c')]['mapKeyOffline'])){throw _0x4858d9['status'](0x1f4)[_0x1669('0xc1')](new db[(_0x1669('0x86'))]['ValidationError'](_0x1669('0xc3')+_0x1f54aa));}if(!_['includes'](_0x1f54aa,_0x21a63c[_0x1669('0x4c')][_0x1669('0xc4')])){throw _0x4858d9[_0x1669('0x25')](0x1f4)[_0x1669('0xc1')](new db['Sequelize'][(_0x1669('0x7f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f54aa));}_0x5c6898[_0x21a63c[_0x1669('0x4c')][_0x1669('0xc4')]]=_0x21a63c[_0x1669('0x4c')][_0x1669('0x85')];})[_0x1669('0x16')](function(){return db[_0x1669('0x43')]['find']({'where':{'id':_0x21a63c[_0x1669('0x49')]['id']},'include':[{'model':db[_0x1669('0xc5')],'as':'List'},{'model':db['MailAccount'],'as':_0x1669('0xc6')}]});})[_0x1669('0x16')](handleEntityNotFound(_0x4858d9,null))[_0x1669('0x16')](function(_0x47ff50){if(_0x47ff50&&_0x47ff50['List']){_0x476300=_0x47ff50;var _0xdcc339=_[_0x1669('0xd')](_0x21a63c[_0x1669('0x4c')],{'firstName':_0x21a63c['body']['from'],'phone':_0x21a63c[_0x1669('0x4c')][_0x1669('0x85')],'ListId':_0x47ff50[_0x1669('0x94')]});_0xdcc339[_0x21a63c[_0x1669('0x4c')][_0x1669('0xc4')]]=_0x21a63c['body'][_0x1669('0x85')];return db[_0x1669('0x7e')][_0x1669('0xc7')]({'where':_0x5c6898,'defaults':_0xdcc339});}})['spread'](function(_0x38c602){if(_0x38c602){_0x214bdd=_0x38c602;var _0x164e85=fs[_0x1669('0xc8')](path[_0x1669('0x68')](config[_0x1669('0x69')],_0x1669('0xc9')),_0x1669('0xca'));var _0x3c8975=ejs[_0x1669('0xcb')](_0x164e85,{'body':_[_0x1669('0xcc')](_0x21a63c[_0x1669('0x4c')][_0x1669('0x4c')]),'bodyTitle':_0x476300[_0x1669('0xcd')]});return db[_0x1669('0xce')][_0x1669('0x52')]({'body':_0x3c8975,'plainBody':htmlToText[_0x1669('0xcf')](_0x3c8975),'ContactId':_0x38c602['id'],'ChatWebsiteId':_0x476300['id']});}})['then'](function(_0x3cae4f){_0x18be40=_0x3cae4f;if(_0x1cd11a['length']){var _0xe147a4=_0x1cd11a[_0x1669('0x30')](function(_0x1cf9be){return{'name':_0x1cf9be[_0x1669('0xd0')],'basename':_0x1cf9be[_0x1669('0x61')],'type':_0x1cf9be['mimetype'],'ChatOfflineMessageId':_0x3cae4f['id']};});_0x237dbb=_0xe147a4[_0x1669('0x30')](_0x1f28cc=>{var _0x29e4c8={'filename':_0x1f28cc['name'],'path':path[_0x1669('0x68')](config[_0x1669('0x69')],_0x1669('0xd1'),'files','attachments','offline-chat',_0x1f28cc['basename'])};return _0x29e4c8;});if(!_0x476300[_0x1669('0xd2')]){return db['sequelize']['transaction'](function(_0x318c09){return db[_0x1669('0xd3')][_0x1669('0xd4')](_0xe147a4,{'transaction':_0x318c09});});}}})[_0x1669('0x16')](function(){if(_0x18be40){_0x17a18f=_0x18be40;return db[_0x1669('0xc6')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1669('0xd5'),'raw':!![],'include':[{'model':db[_0x1669('0xd6')],'as':_0x1669('0xd6'),'raw':!![]}]}]});}})[_0x1669('0x16')](function(_0x1c87f6){if(_0x1c87f6&&_0x1c87f6[_0x1669('0xd5')]&&_0x476300[_0x1669('0xd7')]&&_0x476300[_0x1669('0xd8')]){var _0xef67c=_0x1c87f6[_0x1669('0xd9')]();return respondWithRpcPromise('SendMail',_0x1669('0xda'),{'account':_0xef67c,'message':{'from':util[_0x1669('0xa0')](_0x1669('0xdb'),_0x1c87f6[_0x1669('0x2e')],_0x1c87f6['email']||_0x1c87f6[_0x1669('0xd5')]['user']),'to':_0x476300['forwardOfflineAddress'],'subject':_0x476300[_0x1669('0xdc')],'html':_0x17a18f[_0x1669('0x4c')],'attachments':_0x237dbb}},client9003)['then'](function(){return _0x17a18f;})[_0x1669('0x1e')](function(_0x51c454){logger[_0x1669('0x1b')](_0x51c454);});}})['then'](function(){if(_0x476300&&_0x476300[_0x1669('0xd2')]&&_0x476300[_0x1669('0xdd')]){var _0x2764ee=[];if(_0x1cd11a[_0x1669('0x4a')]){_0x2764ee=_0x1cd11a[_0x1669('0x30')](function(_0x50647b){return{'name':_0x50647b[_0x1669('0xd0')],'basename':_0x50647b['filename'],'type':_0x50647b[_0x1669('0xde')],'ChatOfflineMessageId':_0x18be40['id']};});}var _0x6832f1;if(!_['isNil'](_0x476300['subjectOffline'])){var _0x4cc3b5=_[_0x1669('0x30')](_0x21a63c[_0x1669('0x4c')],function(_0x583bf0){return _0x583bf0;});var _0x3790cd=_[_0x1669('0xdf')](_0x4cc3b5)[0x0];var _0x53ec59=_[_0x1669('0xe0')](_0x3790cd,function(_0x3339c9){return _0x3339c9;});_0x6832f1=_0x53ec59[0x1][_0x476300[_0x1669('0xe1')]];}var _0x5583ca={'from':_0x214bdd[_0x1669('0xe2')],'firstName':_0x214bdd[_0x1669('0x9c')],'lastName':_0x214bdd[_0x1669('0xae')],'mapKey':_0x1669('0xe2'),'message':{'from':_0x214bdd['email'],'to':_0x476300[_0x1669('0xc6')][_0x1669('0xe2')],'cc':'','subject':_[_0x1669('0x6e')](_0x6832f1)?_0x476300['offlineMessageSubject']:_0x6832f1,'messageId':'','sentAt':new Date(),'attach':_0x2764ee[_0x1669('0x4a')],'attachments':_0x2764ee,'originChannel':'Chat','ChatWebsiteId':_0x476300['id'],'ChatOfflineMessageId':_0x17a18f['id'],'originTo':_0x476300[_0x1669('0xc6')]['email']},'body':_0x17a18f[_0x1669('0x4c')]};var _0x1983f7={'account':{'id':_0x476300[_0x1669('0xdd')]},'body':_0x5583ca,'log':_0x1669('0xe3')};return respondWithRpcPromise(_0x1669('0xe3'),_0x1669('0xe4'),_0x1983f7,client9001)[_0x1669('0x16')](function(){return _0x17a18f;})[_0x1669('0x1e')](function(_0x2d4f44){logger[_0x1669('0x1b')](_0x2d4f44);});}return;})[_0x1669('0x16')](function(){if(_0x17a18f){return _0x17a18f;}})[_0x1669('0x16')](respondWithResult(_0x4858d9,null))[_0x1669('0x1e')](function(_0x4dbfb1){logger[_0x1669('0x1b')](_0x1669('0x1e'),_0x4dbfb1);for(var _0x2d70fb of _0x1cd11a){var _0x1df1bd=path['join'](config[_0x1669('0x69')],'server',_0x1669('0xe5'),'attachments',_0x1669('0xe6'),_0x2d70fb[_0x1669('0x61')]);fs_extra['remove'](_0x1df1bd)['catch'](function(_0x5e918c){logger[_0x1669('0x1b')](_0x1669('0xe7'),_0x1df1bd,_0x5e918c);});}});};exports['addInteraction']=function(_0x1bbf61,_0x4a657d){return db[_0x1669('0xa9')][_0x1669('0x50')]({'where':{'id':_0x1bbf61[_0x1669('0x49')]['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x4a657d,null))[_0x1669('0x16')](function(_0x8e39f2){if(_0x8e39f2){return _0x8e39f2[_0x1669('0xe8')](_0x1bbf61[_0x1669('0x4c')][_0x1669('0x5a')],_[_0x1669('0xe9')](_0x1bbf61['body'],['ids','id'])||{});}})[_0x1669('0x16')](respondWithResult(_0x4a657d,null))[_0x1669('0x1e')](handleError(_0x4a657d,null));};exports[_0x1669('0xea')]=function(_0x36ac99,_0x3c9211){var _0x3e68d0={'raw':![],'where':{}};var _0x2fc665={};var _0x5679f6={'count':0x0,'rows':[]};return db[_0x1669('0x43')][_0x1669('0x58')]({'where':{'id':_0x36ac99[_0x1669('0x49')]['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x3c9211,null))[_0x1669('0x16')](function(_0x3a3660){if(_0x3a3660){_0x2fc665[_0x1669('0x33')]=_[_0x1669('0x35')](db[_0x1669('0xa9')]['rawAttributes']);_0x2fc665['query']=_['keys'](_0x36ac99['query']);_0x2fc665[_0x1669('0x3e')]=_[_0x1669('0x36')](_0x2fc665[_0x1669('0x33')],_0x2fc665[_0x1669('0x34')]);_0x3e68d0['attributes']=_['intersection'](_0x2fc665[_0x1669('0x33')],qs[_0x1669('0x38')](_0x36ac99[_0x1669('0x34')][_0x1669('0x38')]));_0x3e68d0[_0x1669('0x37')]=_0x3e68d0[_0x1669('0x37')][_0x1669('0x4a')]?_0x3e68d0[_0x1669('0x37')]:_0x2fc665[_0x1669('0x33')];if(!_0x36ac99[_0x1669('0x34')][_0x1669('0x39')](_0x1669('0x3a'))){_0x3e68d0[_0x1669('0x24')]=qs[_0x1669('0x24')](_0x36ac99[_0x1669('0x34')][_0x1669('0x24')]);_0x3e68d0[_0x1669('0x23')]=qs[_0x1669('0x23')](_0x36ac99['query'][_0x1669('0x23')]);}_0x3e68d0[_0x1669('0x3b')]=qs[_0x1669('0x3c')](_0x36ac99[_0x1669('0x34')][_0x1669('0x3c')]);_0x3e68d0[_0x1669('0x3d')]=qs[_0x1669('0x3e')](_[_0x1669('0x3f')](_0x36ac99[_0x1669('0x34')],_0x2fc665[_0x1669('0x3e')]));_0x3e68d0[_0x1669('0x3d')][_0x1669('0x55')]=_0x3a3660['id'];if(_0x36ac99[_0x1669('0x34')][_0x1669('0x40')]){_0x3e68d0['where']=_[_0x1669('0x41')](_0x3e68d0['where'],{'$or':_[_0x1669('0x30')](_0x3e68d0[_0x1669('0x37')],function(_0x3fb779){var _0x5af99f={};_0x5af99f[_0x3fb779]={'$like':'%'+_0x36ac99['query'][_0x1669('0x40')]+'%'};return _0x5af99f;})});}_0x3e68d0=_[_0x1669('0x41')]({},_0x3e68d0,_0x36ac99[_0x1669('0x4b')]);return db[_0x1669('0xa9')][_0x1669('0x22')]({'where':_0x3e68d0['where']})[_0x1669('0x16')](function(_0xe46fd5){_0x5679f6[_0x1669('0x22')]=_0xe46fd5;if(_0x36ac99['query'][_0x1669('0x44')]){_0x3e68d0[_0x1669('0x45')]=[{'model':db[_0x1669('0x7e')],'as':_0x1669('0xeb'),'required':![]},{'model':db[_0x1669('0xb8')],'as':_0x1669('0xec'),'attributes':[_0x1669('0x2e'),'fullname',_0x1669('0xed')],'required':![]},{'model':db[_0x1669('0xee')],'as':_0x1669('0xef'),'attributes':['id',_0x1669('0x2e'),_0x1669('0xf0')],'where':_0x36ac99[_0x1669('0x34')]['tag']?{'id':_0x36ac99['query']['tag']}:undefined,'required':_0x36ac99[_0x1669('0x34')][_0x1669('0xf1')]?!![]:![]}];}return db[_0x1669('0xa9')][_0x1669('0x46')](_0x3e68d0);})[_0x1669('0x16')](function(_0x172854){_0x5679f6['rows']=_0x172854;return _0x5679f6;});}})['then'](respondWithFilteredResult(_0x3c9211,_0x3e68d0))[_0x1669('0x1e')](handleError(_0x3c9211,null));};function iftimePromise(_0x2d5324,_0x5bb7d1){return respondWithRpcPromise(_0x1669('0xf2'),_0x1669('0xf3'),{'command':_0x5bb7d1[_0x1669('0xf4')]?util[_0x1669('0xa0')]('iftime\x20%s,%s',_0x2d5324[_0x1669('0xf5')],_0x5bb7d1[_0x1669('0xf4')]):util['format'](_0x1669('0xf6'),_0x2d5324[_0x1669('0xf5')])},client9002)[_0x1669('0x16')](function(_0x427722){var _0x5d5768=_0x427722&&_0x427722[_0x1669('0xf7')](_0x1669('0xf8'))>=0x0?!![]:![];logger[_0x1669('0xf9')](_0x1669('0xfa'),_0x5bb7d1['id'],_0x2d5324['id'],_0x2d5324[_0x1669('0xf5')],_0x5d5768?_0x1669('0xfb'):_0x1669('0xfc'),_0x5bb7d1['timezone']?_0x5bb7d1[_0x1669('0xf4')]:'No\x20timezone');return _0x5d5768;})[_0x1669('0x1e')](function(_0x88d776){logger[_0x1669('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5bb7d1['id'],_0x2d5324['id'],_0x2d5324[_0x1669('0xf5')],util[_0x1669('0xfd')](_0x88d776,{'showHidden':![],'depth':null}),_0x5bb7d1[_0x1669('0xf4')]?_0x5bb7d1[_0x1669('0xf4')]:_0x1669('0xfe'));return![];});}exports['getSnippet']=function(_0x22926c,_0x3ac347){var _0x4ec729=0x0;var _0x165aad=0x0;var _0x1af2e4=![];var _0x31e171;var _0x5cb4a6;return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x22926c[_0x1669('0x49')]['id']},'include':[{'model':db[_0x1669('0xff')],'as':_0x1669('0xff'),'include':[{'model':db['Interval'],'as':_0x1669('0x100'),'attributes':['id',_0x1669('0xf5')],'raw':!![]}]}]})[_0x1669('0x16')](handleEntityNotFound(_0x3ac347,null))[_0x1669('0x16')](function(_0x3f73cc){if(_0x3f73cc){_0x31e171=_0x3f73cc;return _0x3f73cc[_0x1669('0x101')]({'raw':!![]});}})[_0x1669('0x16')](function(_0x1d9e6c){if(_0x31e171){if(_0x1d9e6c){_0x5cb4a6=_0x1d9e6c;}}return require('../../config/license/util')['getLicense']();})['then'](function(_0x37475d){if(_0x37475d){_0x165aad=_0x37475d[_0x1669('0x102')];_0x1af2e4=_0x37475d[_0x1669('0x6d')];}})[_0x1669('0x16')](function(){return db[_0x1669('0xa9')][_0x1669('0x22')]({'where':{'closed':![]}});})[_0x1669('0x16')](function(_0x56ed3a){_0x4ec729=_0x56ed3a;if(_0x165aad&&_0x56ed3a>_0x165aad){return db['License'][_0x1669('0x58')]({'where':{'id':0x1}})[_0x1669('0x16')](function(_0x2a3db9){if(_0x2a3db9){_0x2a3db9[_0x1669('0x103')](_0x1669('0x104'));}});}})['then'](function(){if(_0x31e171[_0x1669('0xff')]&&_0x31e171['Interval'][_0x1669('0x100')]){var _0x83fec7=[];for(var _0x274b6a=0x0;_0x274b6a<_0x31e171[_0x1669('0xff')][_0x1669('0x100')][_0x1669('0x4a')];_0x274b6a++){var _0x272e35=_0x31e171[_0x1669('0xff')]['Intervals'][_0x274b6a][_0x1669('0x29')]({'plain':!![]});_0x83fec7[_0x1669('0xb2')](iftimePromise(_0x272e35,_0x31e171));}return BPromise[_0x1669('0x105')](_0x83fec7)[_0x1669('0x16')](function(_0x22afa0){return _['some'](_0x22afa0);});}else{return!![];}})[_0x1669('0x16')](function(_0x5f5e08){var _0x3cbb87=fs[_0x1669('0xc8')](path['join'](config[_0x1669('0x69')],_0x1669('0x106')),_0x1669('0xca'));var _0x5ca537=new url[(_0x1669('0x107'))](_0x31e171[_0x1669('0x108')])['origin'];var _0x247e03=_0x1669('0x109');var _0x39378d=![];var _0x2400a0={'chatVersion':_0x247e03,'chatWebsiteAddressOrigin':_0x5ca537,'remote':_0x31e171[_0x1669('0x10a')],'query':querystring['stringify'](_[_0x1669('0x41')](_0x31e171[_0x1669('0x29')]({'plain':!![]}),{'customerIp':_0x22926c['headers']['x-forwarded-for']||_0x22926c[_0x1669('0x97')][_0x1669('0x10b')]||_0x22926c[_0x1669('0x10c')][_0x1669('0x10d')]||_0x22926c['ip'],'referer':_0x22926c[_0x1669('0x97')]['referer'],'openedInteractions':_0x4ec729,'maxInteractions':_0x165aad,'virtual':_0x1af2e4['virtual'],'online':_0x5f5e08,'custom':_0x1af2e4}))[_0x1669('0x10e')](/'/g,'\x5c\x27')};_0x3ac347[_0x1669('0xc1')](ejs[_0x1669('0xcb')](Mustache[_0x1669('0xcb')](_0x3cbb87,_0x2400a0),{'proactiveActions':_0x5cb4a6,'alignment':_0x31e171[_0x1669('0x10f')],'verticalAlignment':_0x31e171['verticalAlignment'],'div_color':_0x31e171[_0x1669('0xf0')],'labelText':_0x31e171['labelText'],'text_color':_0x31e171[_0x1669('0x110')],'text_button_color':_0x31e171[_0x1669('0x111')],'button_color':_0x31e171['color_button'],'background_color':_0x31e171['backgroundColor'],'hideWhenOffline':_0x31e171['hideWhenOffline'],'intervalId':_0x31e171[_0x1669('0x112')],'isDevelopment':_0x39378d,'chatVersion':_0x247e03}));})[_0x1669('0x1e')](handleError(_0x3ac347,null));};exports[_0x1669('0x113')]=function(_0x1e33b0,_0x466e98){var _0x111746=_0x1e33b0[_0x1669('0x49')]['id'];var _0x2eff3a=_0x1e33b0[_0x1669('0x4c')];var _0x42bc59=0xc8;var _0x28fde8=null;return db[_0x1669('0x114')][_0x1669('0x115')]({'isolationLevel':db[_0x1669('0x114')]['Transaction'][_0x1669('0x116')][_0x1669('0x117')]},function(_0x3577bd){return db[_0x1669('0x43')][_0x1669('0x58')]({'where':{'id':_0x111746},'transaction':_0x3577bd})[_0x1669('0x16')](function(_0xccac2){if(_0xccac2){return db['ChatApplication'][_0x1669('0x2c')]({'where':{'ChatWebsiteId':_0x111746},'transaction':_0x3577bd})[_0x1669('0x16')](function(){var _0x17d532=_[_0x1669('0x30')](_0x2eff3a,function(_0x1e81d2){_0x1e81d2[_0x1669('0x55')]=_0x111746;return _0x1e81d2;});return db[_0x1669('0x8d')][_0x1669('0xd4')](_0x17d532,{'transaction':_0x3577bd});});}else{_0x42bc59=0x194;_0x28fde8=[];}});})[_0x1669('0x16')](function(){if(_0x42bc59!==0x194){return db[_0x1669('0x8d')][_0x1669('0x118')]({'where':{'ChatWebsiteId':_0x111746},'order':_0x1669('0x119')})[_0x1669('0x16')](function(_0x520eba){_0x28fde8=_0x520eba;});}})[_0x1669('0x1e')](function(_0x320a7d){_0x42bc59=0x1f4;logger[_0x1669('0x1b')](_0x320a7d[_0x1669('0x11a')]);if(_0x320a7d['name']){delete _0x320a7d[_0x1669('0x2e')];}_0x28fde8=_0x320a7d;})[_0x1669('0x11b')](function(){if(_0x28fde8===null){_0x466e98[_0x1669('0x2d')](_0x42bc59);}else{if(_0x42bc59===0x1f4){_0x466e98['status'](_0x42bc59)[_0x1669('0xc1')](_0x28fde8);}else{_0x466e98[_0x1669('0x25')](_0x42bc59)[_0x1669('0x20')](_0x28fde8);}}});};exports[_0x1669('0x11c')]=function(_0xde3e5,_0x2a58cb){var _0x18c765={};var _0x3a583a={};var _0xaa7d34;var _0x7cce67;return db[_0x1669('0x43')][_0x1669('0x58')]({'where':{'id':_0xde3e5['params']['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x2a58cb,null))['then'](function(_0x4e2aee){if(_0x4e2aee){_0xaa7d34=_0x4e2aee;_0x3a583a[_0x1669('0x33')]=_[_0x1669('0x35')](db[_0x1669('0x8d')][_0x1669('0x31')]);_0x3a583a['query']=_[_0x1669('0x35')](_0xde3e5[_0x1669('0x34')]);_0x3a583a[_0x1669('0x3e')]=_[_0x1669('0x36')](_0x3a583a['model'],_0x3a583a[_0x1669('0x34')]);_0x18c765[_0x1669('0x37')]=_[_0x1669('0x36')](_0x3a583a['model'],qs[_0x1669('0x38')](_0xde3e5[_0x1669('0x34')]['fields']));_0x18c765[_0x1669('0x37')]=_0x18c765[_0x1669('0x37')][_0x1669('0x4a')]?_0x18c765[_0x1669('0x37')]:_0x3a583a[_0x1669('0x33')];_0x18c765['order']=qs['sort'](_0xde3e5['query'][_0x1669('0x3c')]);_0x18c765[_0x1669('0x3d')]=qs['filters'](_['pick'](_0xde3e5[_0x1669('0x34')],_0x3a583a[_0x1669('0x3e')]));if(_0xde3e5[_0x1669('0x34')]['filter']){_0x18c765[_0x1669('0x3d')]=_[_0x1669('0x41')](_0x18c765['where'],{'$or':_[_0x1669('0x30')](_0x18c765[_0x1669('0x37')],function(_0x14ade0){var _0x47c6d3={};_0x47c6d3[_0x14ade0]={'$like':'%'+_0xde3e5[_0x1669('0x34')]['filter']+'%'};return _0x47c6d3;})});}_0x18c765=_['merge']({},_0x18c765,_0xde3e5[_0x1669('0x4b')]);return _0xaa7d34[_0x1669('0x11c')](_0x18c765);}})[_0x1669('0x16')](function(_0x1df05c){if(_0x1df05c){_0x7cce67=_0x1df05c[_0x1669('0x4a')];if(!_0xde3e5[_0x1669('0x34')][_0x1669('0x39')](_0x1669('0x3a'))){_0x18c765['limit']=qs['limit'](_0xde3e5['query'][_0x1669('0x24')]);_0x18c765[_0x1669('0x23')]=qs['offset'](_0xde3e5['query'][_0x1669('0x23')]);}return _0xaa7d34[_0x1669('0x11c')](_0x18c765);}})['then'](function(_0x2d2911){if(_0x2d2911){return _0x2d2911?{'count':_0x7cce67,'rows':_0x2d2911}:null;}})[_0x1669('0x16')](respondWithResult(_0x2a58cb,null))[_0x1669('0x1e')](handleError(_0x2a58cb,null));};exports['addProactiveActions']=function(_0x39094e,_0x3981bb){return db[_0x1669('0x11d')][_0x1669('0x50')]({'where':{'id':_0x39094e[_0x1669('0x49')]['id']}})['then'](handleEntityNotFound(_0x3981bb,null))[_0x1669('0x16')](function(_0x2a20f7){if(_0x2a20f7){return _0x2a20f7[_0x1669('0x11e')](_0x39094e[_0x1669('0x4c')][_0x1669('0x5a')],_[_0x1669('0xe9')](_0x39094e[_0x1669('0x4c')],['ids','id'])||{});}})[_0x1669('0x16')](respondWithResult(_0x3981bb,null))[_0x1669('0x1e')](handleError(_0x3981bb,null));};exports['getProactiveActions']=function(_0x372cef,_0xc4e95a){var _0x33a13d={};var _0x64a11b={};var _0x446a96;var _0x4d2a3c;return db[_0x1669('0x43')][_0x1669('0x58')]({'where':{'id':_0x372cef[_0x1669('0x49')]['id']}})[_0x1669('0x16')](handleEntityNotFound(_0xc4e95a,null))[_0x1669('0x16')](function(_0x5cbf0a){if(_0x5cbf0a){_0x446a96=_0x5cbf0a;_0x64a11b[_0x1669('0x33')]=_['keys'](db[_0x1669('0x11f')][_0x1669('0x31')]);_0x64a11b[_0x1669('0x34')]=_[_0x1669('0x35')](_0x372cef[_0x1669('0x34')]);_0x64a11b[_0x1669('0x3e')]=_['intersection'](_0x64a11b[_0x1669('0x33')],_0x64a11b['query']);_0x33a13d[_0x1669('0x37')]=_[_0x1669('0x36')](_0x64a11b[_0x1669('0x33')],qs[_0x1669('0x38')](_0x372cef[_0x1669('0x34')][_0x1669('0x38')]));_0x33a13d[_0x1669('0x37')]=_0x33a13d[_0x1669('0x37')][_0x1669('0x4a')]?_0x33a13d[_0x1669('0x37')]:_0x64a11b['model'];_0x33a13d[_0x1669('0x3b')]=qs['sort'](_0x372cef['query'][_0x1669('0x3c')]);_0x33a13d['where']=qs[_0x1669('0x3e')](_[_0x1669('0x3f')](_0x372cef[_0x1669('0x34')],_0x64a11b['filters']));if(_0x372cef[_0x1669('0x34')][_0x1669('0x40')]){_0x33a13d[_0x1669('0x3d')]=_[_0x1669('0x41')](_0x33a13d[_0x1669('0x3d')],{'$or':_[_0x1669('0x30')](_0x33a13d[_0x1669('0x37')],function(_0x1d7ba5){var _0x4dfdcf={};_0x4dfdcf[_0x1d7ba5]={'$like':'%'+_0x372cef['query'][_0x1669('0x40')]+'%'};return _0x4dfdcf;})});}_0x33a13d=_[_0x1669('0x41')]({},_0x33a13d,_0x372cef[_0x1669('0x4b')]);return _0x446a96['getProactiveActions'](_0x33a13d);}})[_0x1669('0x16')](function(_0x1de237){if(_0x1de237){_0x4d2a3c=_0x1de237[_0x1669('0x4a')];if(!_0x372cef[_0x1669('0x34')]['hasOwnProperty']('nolimit')){_0x33a13d['limit']=qs[_0x1669('0x24')](_0x372cef[_0x1669('0x34')]['limit']);_0x33a13d[_0x1669('0x23')]=qs[_0x1669('0x23')](_0x372cef['query'][_0x1669('0x23')]);}return _0x446a96[_0x1669('0x101')](_0x33a13d);}})[_0x1669('0x16')](function(_0x43d980){if(_0x43d980){return _0x43d980?{'count':_0x4d2a3c,'rows':_0x43d980}:null;}})[_0x1669('0x16')](respondWithResult(_0xc4e95a,null))[_0x1669('0x1e')](handleError(_0xc4e95a,null));};exports[_0x1669('0x120')]=function(_0x10146c,_0x4c397f){var _0x1462fa=_0x10146c[_0x1669('0x34')][_0x1669('0x121')]===_0x1669('0x122')?_0x1669('0x123'):_0x1669('0x124');return db[_0x1669('0x43')][_0x1669('0x50')]({'attributes':['id',_0x1462fa],'where':{'id':_0x10146c[_0x1669('0x49')]['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x4c397f,null))['then'](function(_0x3f97e2){if(_0x3f97e2){var _0x13120d=_0x3f97e2[_0x1462fa];var _0x43e785=_0x13120d&&_0x13120d[_0x1669('0x125')]?_0x13120d[_0x1669('0x125')]:[];_0x4c397f[_0x1669('0xc1')]({'fromKey':_[_0x1669('0x6e')](_0x13120d[_0x1669('0x126')])?undefined:_0x13120d['fromKey'],'count':_0x43e785[_0x1669('0x4a')],'rows':_0x43e785});}})[_0x1669('0x1e')](handleError(_0x4c397f,null));};exports[_0x1669('0x127')]=function(_0x2c7619,_0x48a989){var _0x439c90={'raw':![],'where':{}};var _0x2aba09={};var _0x25b0ab={'count':0x0,'rows':[]};return db[_0x1669('0x43')][_0x1669('0x58')]({'where':{'id':_0x2c7619[_0x1669('0x49')]['id']}})['then'](handleEntityNotFound(_0x48a989,null))['then'](function(_0x2e59f6){if(_0x2e59f6){_0x2aba09[_0x1669('0x33')]=_[_0x1669('0x35')](db[_0x1669('0xce')][_0x1669('0x31')]);_0x2aba09[_0x1669('0x34')]=_['keys'](_0x2c7619[_0x1669('0x34')]);_0x2aba09['filters']=_[_0x1669('0x36')](_0x2aba09[_0x1669('0x33')],_0x2aba09[_0x1669('0x34')]);_0x439c90[_0x1669('0x37')]=_[_0x1669('0x36')](_0x2aba09[_0x1669('0x33')],qs['fields'](_0x2c7619['query']['fields']));_0x439c90[_0x1669('0x37')]=_0x439c90[_0x1669('0x37')][_0x1669('0x4a')]?_0x439c90[_0x1669('0x37')]:_0x2aba09[_0x1669('0x33')];if(!_0x2c7619[_0x1669('0x34')][_0x1669('0x39')](_0x1669('0x3a'))){_0x439c90[_0x1669('0x24')]=qs['limit'](_0x2c7619['query'][_0x1669('0x24')]);_0x439c90['offset']=qs[_0x1669('0x23')](_0x2c7619[_0x1669('0x34')][_0x1669('0x23')]);}_0x439c90[_0x1669('0x3b')]=qs['sort'](_0x2c7619['query'][_0x1669('0x3c')]);_0x439c90[_0x1669('0x3d')]=qs['filters'](_['pick'](_0x2c7619['query'],_0x2aba09[_0x1669('0x3e')]));_0x439c90['where'][_0x1669('0x55')]=_0x2e59f6['id'];if(_0x2c7619[_0x1669('0x34')]['filter']){_0x439c90[_0x1669('0x3d')]=_['merge'](_0x439c90['where'],{'$or':_[_0x1669('0x30')](_0x439c90[_0x1669('0x37')],function(_0xe2aa1d){var _0x3e557c={};_0x3e557c[_0xe2aa1d]={'$like':'%'+_0x2c7619['query'][_0x1669('0x40')]+'%'};return _0x3e557c;})});}_0x439c90=_[_0x1669('0x41')]({},_0x439c90,_0x2c7619[_0x1669('0x4b')]);return db['ChatOfflineMessage'][_0x1669('0x22')]({'where':_0x439c90[_0x1669('0x3d')]})[_0x1669('0x16')](function(_0x4adb36){_0x25b0ab['count']=_0x4adb36;if(_0x2c7619[_0x1669('0x34')][_0x1669('0x44')]){_0x439c90[_0x1669('0x45')]=[{'all':!![]}];}else{_0x439c90['include']=[{'model':db['CmContact'],'as':_0x1669('0xeb'),'required':![]},{'model':db[_0x1669('0xd3')],'as':_0x1669('0x128'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x439c90);})[_0x1669('0x16')](function(_0x3e86ac){_0x25b0ab[_0x1669('0x47')]=_0x3e86ac;return _0x25b0ab;});}})[_0x1669('0x16')](respondWithFilteredResult(_0x48a989,_0x439c90))[_0x1669('0x1e')](handleError(_0x48a989,null));};exports[_0x1669('0x129')]=function(_0x4f899d,_0x5a89b2){return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x4f899d['params']['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x5a89b2,null))[_0x1669('0x16')](function(_0x895cb7){if(_0x895cb7){return _0x895cb7[_0x1669('0x129')](_0x4f899d[_0x1669('0x4c')][_0x1669('0x5a')],_[_0x1669('0xe9')](_0x4f899d['body'],[_0x1669('0x5a'),'id'])||{})['spread'](function(_0x1a9e25){for(var _0x3e1768=0x0;_0x3e1768<_0x4f899d[_0x1669('0x4c')]['ids'][_0x1669('0x4a')];_0x3e1768+=0x1){socket['emit'](_0x1669('0x12a'),{'UserId':Number(_0x4f899d[_0x1669('0x4c')]['ids'][_0x3e1768]),'ChatWebsiteId':Number(_0x4f899d['params']['id'])});}return _0x1a9e25;});}})[_0x1669('0x16')](respondWithResult(_0x5a89b2,null))[_0x1669('0x1e')](handleError(_0x5a89b2,null));};exports[_0x1669('0x12b')]=function(_0x1d60d1,_0x498179){return db[_0x1669('0x43')][_0x1669('0x50')]({'where':{'id':_0x1d60d1[_0x1669('0x49')]['id']}})['then'](handleEntityNotFound(_0x498179,null))['then'](function(_0x489c63){if(_0x489c63){return _0x489c63[_0x1669('0x12b')](_0x1d60d1[_0x1669('0x34')][_0x1669('0x5a')])[_0x1669('0x16')](function(){if(_[_0x1669('0x12c')](_0x1d60d1[_0x1669('0x34')][_0x1669('0x5a')])){for(var _0x724f92=0x0;_0x724f92<_0x1d60d1[_0x1669('0x34')][_0x1669('0x5a')][_0x1669('0x4a')];_0x724f92+=0x1){socket[_0x1669('0x12d')]('userChatWebsite:remove',{'UserId':Number(_0x1d60d1[_0x1669('0x34')][_0x1669('0x5a')][_0x724f92]),'ChatWebsiteId':Number(_0x1d60d1[_0x1669('0x49')]['id'])});}}else{socket[_0x1669('0x12d')]('userChatWebsite:remove',{'UserId':Number(_0x1d60d1[_0x1669('0x34')][_0x1669('0x5a')]),'ChatWebsiteId':Number(_0x1d60d1['params']['id'])});}});}})[_0x1669('0x16')](respondWithStatusCode(_0x498179,null))[_0x1669('0x1e')](handleError(_0x498179,null));};exports[_0x1669('0x12e')]=function(_0x2f74e9,_0x917dc4){var _0x1d5e1b={};var _0x1e089b={};var _0x5293be;var _0xc13303;return db['ChatWebsite']['findOne']({'where':{'id':_0x2f74e9['params']['id']}})[_0x1669('0x16')](handleEntityNotFound(_0x917dc4,null))[_0x1669('0x16')](function(_0x4abb31){if(_0x4abb31){_0x5293be=_0x4abb31;_0x1e089b['model']=_[_0x1669('0x35')](db[_0x1669('0xb8')][_0x1669('0x31')]);_0x1e089b[_0x1669('0x34')]=_['keys'](_0x2f74e9['query']);_0x1e089b[_0x1669('0x3e')]=_['intersection'](_0x1e089b[_0x1669('0x33')],_0x1e089b[_0x1669('0x34')]);_0x1d5e1b['attributes']=_[_0x1669('0x36')](_0x1e089b[_0x1669('0x33')],qs['fields'](_0x2f74e9['query'][_0x1669('0x38')]));_0x1d5e1b[_0x1669('0x37')]=_0x1d5e1b[_0x1669('0x37')][_0x1669('0x4a')]?_0x1d5e1b[_0x1669('0x37')]:_0x1e089b[_0x1669('0x33')];_0x1d5e1b[_0x1669('0x3b')]=qs['sort'](_0x2f74e9[_0x1669('0x34')]['sort']);_0x1d5e1b[_0x1669('0x3d')]=qs[_0x1669('0x3e')](_[_0x1669('0x3f')](_0x2f74e9[_0x1669('0x34')],_0x1e089b[_0x1669('0x3e')]));if(_0x2f74e9[_0x1669('0x34')][_0x1669('0x40')]){_0x1d5e1b['where']=_[_0x1669('0x41')](_0x1d5e1b[_0x1669('0x3d')],{'$or':_[_0x1669('0x30')](_0x1d5e1b[_0x1669('0x37')],function(_0xe931a9){var _0x43d45d={};_0x43d45d[_0xe931a9]={'$like':'%'+_0x2f74e9[_0x1669('0x34')]['filter']+'%'};return _0x43d45d;})});}_0x1d5e1b=_[_0x1669('0x41')]({},_0x1d5e1b,_0x2f74e9[_0x1669('0x4b')]);return _0x5293be[_0x1669('0x12e')](_0x1d5e1b);}})[_0x1669('0x16')](function(_0x3f1589){if(_0x3f1589){_0xc13303=_0x3f1589[_0x1669('0x4a')];if(!_0x2f74e9[_0x1669('0x34')][_0x1669('0x39')](_0x1669('0x3a'))){_0x1d5e1b[_0x1669('0x24')]=qs[_0x1669('0x24')](_0x2f74e9[_0x1669('0x34')][_0x1669('0x24')]);_0x1d5e1b[_0x1669('0x23')]=qs['offset'](_0x2f74e9[_0x1669('0x34')][_0x1669('0x23')]);}return _0x5293be['getAgents'](_0x1d5e1b);}})[_0x1669('0x16')](function(_0x475b98){if(_0x475b98){return _0x475b98?{'count':_0xc13303,'rows':_0x475b98}:null;}})['then'](respondWithResult(_0x917dc4,null))[_0x1669('0x1e')](handleError(_0x917dc4,null));}; \ No newline at end of file +var _0x49ce=['client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','findAll','rows','show','params','Pause','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','addDisposition','Disposition','getDispositions','pick','ChatWebsiteId','includeAll','include','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','getLogo','join','root','sitepic','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','getResult','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','account','list','applications','priority','Contacts','defaults','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','bulkCreate','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','email','Chat','MailAccountId','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','User','Owner','internal','Tags','color','tag','Command','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','getSnippet','Interval','getProactiveActions','../../config/license/util','getLicense','virtual','License','increment','Intervals','some','URL','address','origin','remote','stringify','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./chatWebsite.socket','html-to-text'];(function(_0x485e45,_0x35d726){var _0x246445=function(_0xa1c5c8){while(--_0xa1c5c8){_0x485e45['push'](_0x485e45['shift']());}};_0x246445(++_0x35d726);}(_0x49ce,0x11c));var _0xe49c=function(_0x13c38a,_0x522286){_0x13c38a=_0x13c38a-0x0;var _0x5c658a=_0x49ce[_0x13c38a];return _0x5c658a;};'use strict';var BPromise=require(_0xe49c('0x0'));var Mustache=require(_0xe49c('0x1'));var util=require(_0xe49c('0x2'));var path=require(_0xe49c('0x3'));var ejs=require(_0xe49c('0x4'));var fs=require('fs');var fs_extra=require(_0xe49c('0x5'));var _=require(_0xe49c('0x6'));var querystring=require('querystring');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xe49c('0x7'))(_0xe49c('0x8'));var config=require('../../config/environment');var url=require('url');var db=require(_0xe49c('0x9'))['db'];config[_0xe49c('0xa')]=_['defaults'](config[_0xe49c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe49c('0xb'))(new Redis(config[_0xe49c('0xa')]));require(_0xe49c('0xc'))['register'](socket);var htmlToText=require(_0xe49c('0xd'));var jayson=require('jayson/promise');var client=jayson[_0xe49c('0xe')][_0xe49c('0xf')]({'port':0x232c});var client9002=jayson[_0xe49c('0xe')][_0xe49c('0xf')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0xe49c('0xe')][_0xe49c('0xf')]({'port':0x2329});function respondWithRpcPromise(_0x31cfef,_0x33ebdd,_0x26689e,_0x2413b2){return new BPromise(function(_0x197f7e,_0x13d50b){var _0x59b25a=_0x2413b2||client;return _0x59b25a['request'](_0x31cfef,_0x26689e)['then'](function(_0x1f2be8){logger[_0xe49c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x33ebdd,_0xe49c('0x11'));logger[_0xe49c('0x12')](_0xe49c('0x13'),_0x33ebdd,_0xe49c('0x11'),JSON['stringify'](_0x1f2be8));if(_0x1f2be8[_0xe49c('0x14')]){if(_0x1f2be8[_0xe49c('0x14')][_0xe49c('0x15')]===0x1f4){logger[_0xe49c('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x33ebdd,_0x1f2be8[_0xe49c('0x14')]['message']);return _0x13d50b(_0x1f2be8[_0xe49c('0x14')]['message']);}logger['error'](_0xe49c('0x16'),_0x33ebdd,_0x1f2be8[_0xe49c('0x14')][_0xe49c('0x17')]);return _0x197f7e(_0x1f2be8[_0xe49c('0x14')][_0xe49c('0x17')]);}else{logger[_0xe49c('0x10')](_0xe49c('0x16'),_0x33ebdd,_0xe49c('0x11'));_0x197f7e(_0x1f2be8['result'][_0xe49c('0x17')]);}})[_0xe49c('0x18')](function(_0x3ea0b2){logger['error'](_0xe49c('0x16'),_0x33ebdd,_0x3ea0b2);_0x13d50b(_0x3ea0b2);});});}function respondWithStatusCode(_0x5490d0,_0x50131e){_0x50131e=_0x50131e||0xcc;return function(_0x4720e6){if(_0x4720e6){return _0x5490d0[_0xe49c('0x19')](_0x50131e);}return _0x5490d0[_0xe49c('0x1a')](_0x50131e)[_0xe49c('0x1b')]();};}function respondWithResult(_0x1240d3,_0x1e3bba){_0x1e3bba=_0x1e3bba||0xc8;return function(_0x312169){if(_0x312169){return _0x1240d3['status'](_0x1e3bba)[_0xe49c('0x1c')](_0x312169);}};}function respondWithFilteredResult(_0x58bf64,_0x2e64b9){return function(_0x2e0457){if(_0x2e0457){var _0x489788=typeof _0x2e64b9[_0xe49c('0x1d')]===_0xe49c('0x1e')&&typeof _0x2e64b9[_0xe49c('0x1f')]==='undefined';var _0x4776f2=_0x2e0457[_0xe49c('0x20')];var _0x5b8b56=_0x489788?0x0:_0x2e64b9['offset'];var _0x154895=_0x489788?_0x2e0457[_0xe49c('0x20')]:_0x2e64b9[_0xe49c('0x1d')]+_0x2e64b9[_0xe49c('0x1f')];var _0x1c8e57;if(_0x154895>=_0x4776f2){_0x154895=_0x4776f2;_0x1c8e57=0xc8;}else{_0x1c8e57=0xce;}_0x58bf64[_0xe49c('0x1a')](_0x1c8e57);return _0x58bf64[_0xe49c('0x21')](_0xe49c('0x22'),_0x5b8b56+'-'+_0x154895+'/'+_0x4776f2)['json'](_0x2e0457);}return null;};}function saveUpdates(_0x22d365){return function(_0x129306){if(_0x129306){return _0x129306[_0xe49c('0x23')](_0x22d365)[_0xe49c('0x24')](function(_0x57e489){return _0x57e489;});}return null;};}function removeEntity(_0xc9e25){return function(_0x3fab8e){if(_0x3fab8e){return _0x3fab8e[_0xe49c('0x25')]()[_0xe49c('0x24')](function(){var _0x46ca2c=_0x3fab8e[_0xe49c('0x26')]({'plain':!![]});var _0x233a2d=_0xe49c('0x27');return db[_0xe49c('0x28')][_0xe49c('0x25')]({'where':{'type':_0x233a2d,'resourceId':_0x46ca2c['id']}})['then'](function(){return _0x3fab8e;});})['then'](function(){_0xc9e25[_0xe49c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1046a3){return function(_0x575999){if(!_0x575999){_0x1046a3[_0xe49c('0x19')](0x194);}return _0x575999;};}function handleError(_0x393875,_0x3a1e7a){_0x3a1e7a=_0x3a1e7a||0x1f4;return function(_0x5f4a93){logger['error'](_0x5f4a93[_0xe49c('0x29')]);if(_0x5f4a93[_0xe49c('0x2a')]){delete _0x5f4a93[_0xe49c('0x2a')];}_0x393875[_0xe49c('0x1a')](_0x3a1e7a)[_0xe49c('0x2b')](_0x5f4a93);};}exports[_0xe49c('0x2c')]=function(_0x38d06c,_0x491ee2){var _0x27afe6={'include':[{'model':db['Pause'],'as':_0xe49c('0x2d')}]},_0x72c2fb={},_0x2b1d89={'count':0x0,'rows':[]};var _0x50ea9d=_[_0xe49c('0x2e')](db[_0xe49c('0x2f')][_0xe49c('0x30')],function(_0x28530e){return{'name':_0x28530e[_0xe49c('0x31')],'type':_0x28530e[_0xe49c('0x32')][_0xe49c('0x33')]};});_0x72c2fb['model']=_[_0xe49c('0x2e')](_0x50ea9d,_0xe49c('0x2a'));_0x72c2fb[_0xe49c('0x34')]=_[_0xe49c('0x35')](_0x38d06c['query']);_0x72c2fb[_0xe49c('0x36')]=_['intersection'](_0x72c2fb[_0xe49c('0x37')],_0x72c2fb[_0xe49c('0x34')]);_0x27afe6[_0xe49c('0x38')]=_[_0xe49c('0x39')](_0x72c2fb['model'],qs['fields'](_0x38d06c[_0xe49c('0x34')][_0xe49c('0x3a')]));_0x27afe6[_0xe49c('0x38')]=_0x27afe6[_0xe49c('0x38')]['length']?_0x27afe6['attributes']:_0x72c2fb[_0xe49c('0x37')];if(!_0x38d06c[_0xe49c('0x34')][_0xe49c('0x3b')](_0xe49c('0x3c'))){_0x27afe6[_0xe49c('0x1f')]=qs[_0xe49c('0x1f')](_0x38d06c[_0xe49c('0x34')][_0xe49c('0x1f')]);_0x27afe6[_0xe49c('0x1d')]=qs[_0xe49c('0x1d')](_0x38d06c[_0xe49c('0x34')]['offset']);}_0x27afe6[_0xe49c('0x3d')]=qs[_0xe49c('0x3e')](_0x38d06c[_0xe49c('0x34')][_0xe49c('0x3e')]);_0x27afe6[_0xe49c('0x3f')]=qs[_0xe49c('0x36')](_['pick'](_0x38d06c[_0xe49c('0x34')],_0x72c2fb[_0xe49c('0x36')]),_0x50ea9d);if(_0x38d06c[_0xe49c('0x34')][_0xe49c('0x40')]){_0x27afe6[_0xe49c('0x3f')]=_[_0xe49c('0x41')](_0x27afe6[_0xe49c('0x3f')],{'$or':_['map'](_0x50ea9d,function(_0x452123){if(_0x452123['type']!=='VIRTUAL'){var _0x1f703d={};_0x1f703d[_0x452123['name']]={'$like':'%'+_0x38d06c[_0xe49c('0x34')]['filter']+'%'};return _0x1f703d;}})});}_0x27afe6=_[_0xe49c('0x41')]({},_0x27afe6,_0x38d06c['options']);var _0x17af45={'where':_0x27afe6[_0xe49c('0x3f')]};return db[_0xe49c('0x2f')][_0xe49c('0x20')](_0x17af45)[_0xe49c('0x24')](function(_0x1779a0){_0x2b1d89[_0xe49c('0x20')]=_0x1779a0;if(_0x38d06c[_0xe49c('0x34')]['includeAll']){_0x27afe6['include']=[{'all':!![]}];}return db[_0xe49c('0x2f')][_0xe49c('0x42')](_0x27afe6);})[_0xe49c('0x24')](function(_0x1c8325){_0x2b1d89[_0xe49c('0x43')]=_0x1c8325;return _0x2b1d89;})[_0xe49c('0x24')](respondWithFilteredResult(_0x491ee2,_0x27afe6))[_0xe49c('0x18')](handleError(_0x491ee2,null));};exports[_0xe49c('0x44')]=function(_0x483313,_0x21b5da){var _0x1acf5e={'raw':![],'where':{'id':_0x483313[_0xe49c('0x45')]['id']},'include':[{'model':db[_0xe49c('0x46')],'as':_0xe49c('0x2d')}]},_0x81e039={};_0x81e039[_0xe49c('0x37')]=_[_0xe49c('0x35')](db['ChatWebsite']['rawAttributes']);_0x81e039[_0xe49c('0x34')]=_[_0xe49c('0x35')](_0x483313[_0xe49c('0x34')]);_0x81e039[_0xe49c('0x36')]=_[_0xe49c('0x39')](_0x81e039[_0xe49c('0x37')],_0x81e039[_0xe49c('0x34')]);_0x1acf5e[_0xe49c('0x38')]=_['intersection'](_0x81e039[_0xe49c('0x37')],qs[_0xe49c('0x3a')](_0x483313['query']['fields']));_0x1acf5e[_0xe49c('0x38')]=_0x1acf5e[_0xe49c('0x38')][_0xe49c('0x47')]?_0x1acf5e[_0xe49c('0x38')]:_0x81e039['model'];if(_0x483313['query']['includeAll']){_0x1acf5e['include']=[{'all':!![]}];}_0x1acf5e=_['merge']({},_0x1acf5e,_0x483313[_0xe49c('0x48')]);return db[_0xe49c('0x2f')][_0xe49c('0x49')](_0x1acf5e)['then'](handleEntityNotFound(_0x21b5da,null))['then'](respondWithResult(_0x21b5da,null))[_0xe49c('0x18')](handleError(_0x21b5da,null));};exports['create']=function(_0x386e50,_0x1f7890){return db['ChatWebsite'][_0xe49c('0x4a')](_0x386e50[_0xe49c('0x4b')],{})[_0xe49c('0x24')](function(_0xd58c21){var _0x1a8adb=_0x386e50[_0xe49c('0x4c')][_0xe49c('0x26')]({'plain':!![]});if(!_0x1a8adb)throw new Error(_0xe49c('0x4d'));if(_0x1a8adb[_0xe49c('0x4e')]===_0xe49c('0x4c')){var _0x2b6a0f=_0xd58c21[_0xe49c('0x26')]({'plain':!![]});var _0x5a7702=_0xe49c('0x27');return db[_0xe49c('0x4f')][_0xe49c('0x49')]({'where':{'name':_0x5a7702,'userProfileId':_0x1a8adb['userProfileId']},'raw':!![]})[_0xe49c('0x24')](function(_0x5edec6){if(_0x5edec6&&_0x5edec6[_0xe49c('0x50')]===0x0){return db[_0xe49c('0x28')][_0xe49c('0x4a')]({'name':_0x2b6a0f['name'],'resourceId':_0x2b6a0f['id'],'type':_0x5edec6[_0xe49c('0x2a')],'sectionId':_0x5edec6['id']},{})[_0xe49c('0x24')](function(){return _0xd58c21;});}else{return _0xd58c21;}})[_0xe49c('0x18')](function(_0x27bf67){logger[_0xe49c('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27bf67);throw _0x27bf67;});}return _0xd58c21;})[_0xe49c('0x24')](respondWithResult(_0x1f7890,0xc9))[_0xe49c('0x18')](handleError(_0x1f7890,null));};exports[_0xe49c('0x23')]=function(_0x2e574b,_0x27b017){if(_0x2e574b[_0xe49c('0x4b')]['id']){delete _0x2e574b[_0xe49c('0x4b')]['id'];}return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'where':{'id':_0x2e574b['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xe49c('0x24')](handleEntityNotFound(_0x27b017,null))[_0xe49c('0x24')](saveUpdates(_0x2e574b['body'],null))['then'](respondWithResult(_0x27b017,null))[_0xe49c('0x18')](handleError(_0x27b017,null));};exports[_0xe49c('0x25')]=function(_0x358e01,_0x570f11){return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'where':{'id':_0x358e01['params']['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x570f11,null))[_0xe49c('0x24')](removeEntity(_0x570f11,null))[_0xe49c('0x18')](handleError(_0x570f11,null));};exports['describe']=function(_0x3ab31d,_0x4f4c01){return db[_0xe49c('0x2f')][_0xe49c('0x51')]()[_0xe49c('0x24')](respondWithResult(_0x4f4c01,null))[_0xe49c('0x18')](handleError(_0x4f4c01,null));};exports[_0xe49c('0x52')]=function(_0x349905,_0x5aab80){if(_0x349905['body']['id']){delete _0x349905[_0xe49c('0x4b')]['id'];}return db['ChatWebsite'][_0xe49c('0x49')]({'where':{'id':_0x349905['params']['id']}})['then'](handleEntityNotFound(_0x5aab80,null))[_0xe49c('0x24')](function(_0x9555b7){if(_0x9555b7){_0x349905['body']['ChatWebsiteId']=_0x9555b7['id'];return db[_0xe49c('0x53')]['create'](_0x349905[_0xe49c('0x4b')]);}})[_0xe49c('0x24')](respondWithResult(_0x5aab80,null))[_0xe49c('0x18')](handleError(_0x5aab80,null));};exports[_0xe49c('0x54')]=function(_0x47aede,_0x18bd52){var _0x37327a={'raw':![],'where':{}};var _0x3f8d2c={};var _0x8a0ac={'count':0x0,'rows':[]};return db[_0xe49c('0x2f')]['findOne']({'where':{'id':_0x47aede[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x18bd52,null))[_0xe49c('0x24')](function(_0x34e79b){if(_0x34e79b){_0x3f8d2c['model']=_[_0xe49c('0x35')](db[_0xe49c('0x53')]['rawAttributes']);_0x3f8d2c['query']=_[_0xe49c('0x35')](_0x47aede[_0xe49c('0x34')]);_0x3f8d2c['filters']=_[_0xe49c('0x39')](_0x3f8d2c[_0xe49c('0x37')],_0x3f8d2c[_0xe49c('0x34')]);_0x37327a['attributes']=_[_0xe49c('0x39')](_0x3f8d2c[_0xe49c('0x37')],qs['fields'](_0x47aede[_0xe49c('0x34')]['fields']));_0x37327a[_0xe49c('0x38')]=_0x37327a[_0xe49c('0x38')]['length']?_0x37327a[_0xe49c('0x38')]:_0x3f8d2c[_0xe49c('0x37')];if(!_0x47aede['query'][_0xe49c('0x3b')](_0xe49c('0x3c'))){_0x37327a[_0xe49c('0x1f')]=qs['limit'](_0x47aede[_0xe49c('0x34')][_0xe49c('0x1f')]);_0x37327a[_0xe49c('0x1d')]=qs['offset'](_0x47aede['query'][_0xe49c('0x1d')]);}_0x37327a[_0xe49c('0x3d')]=qs[_0xe49c('0x3e')](_0x47aede['query'][_0xe49c('0x3e')]);_0x37327a['where']=qs[_0xe49c('0x36')](_[_0xe49c('0x55')](_0x47aede[_0xe49c('0x34')],_0x3f8d2c[_0xe49c('0x36')]));_0x37327a[_0xe49c('0x3f')][_0xe49c('0x56')]=_0x34e79b['id'];if(_0x47aede[_0xe49c('0x34')][_0xe49c('0x40')]){_0x37327a[_0xe49c('0x3f')]=_[_0xe49c('0x41')](_0x37327a[_0xe49c('0x3f')],{'$or':_[_0xe49c('0x2e')](_0x37327a[_0xe49c('0x38')],function(_0x2dde29){var _0x299fab={};_0x299fab[_0x2dde29]={'$like':'%'+_0x47aede[_0xe49c('0x34')][_0xe49c('0x40')]+'%'};return _0x299fab;})});}_0x37327a=_[_0xe49c('0x41')]({},_0x37327a,_0x47aede[_0xe49c('0x48')]);return db[_0xe49c('0x53')][_0xe49c('0x20')]({'where':_0x37327a[_0xe49c('0x3f')]})['then'](function(_0x532860){_0x8a0ac[_0xe49c('0x20')]=_0x532860;if(_0x47aede[_0xe49c('0x34')][_0xe49c('0x57')]){_0x37327a[_0xe49c('0x58')]=[{'all':!![]}];}return db['Disposition'][_0xe49c('0x42')](_0x37327a);})[_0xe49c('0x24')](function(_0x1e9a46){_0x8a0ac[_0xe49c('0x43')]=_0x1e9a46;return _0x8a0ac;});}})[_0xe49c('0x24')](respondWithFilteredResult(_0x18bd52,_0x37327a))[_0xe49c('0x18')](handleError(_0x18bd52,null));};exports[_0xe49c('0x59')]=function(_0x5102ea,_0x3ee98d){return db['ChatWebsite'][_0xe49c('0x49')]({'where':{'id':_0x5102ea['params']['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x3ee98d,null))[_0xe49c('0x24')](function(_0x16a287){if(_0x16a287){return _0x16a287[_0xe49c('0x59')](_0x5102ea[_0xe49c('0x34')][_0xe49c('0x5a')]);}})[_0xe49c('0x24')](respondWithStatusCode(_0x3ee98d,null))[_0xe49c('0x18')](handleError(_0x3ee98d,null));};exports[_0xe49c('0x5b')]=function(_0x4fbc1f,_0x1746fc){if(_0x4fbc1f[_0xe49c('0x4b')]['id']){delete _0x4fbc1f[_0xe49c('0x4b')]['id'];}return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'where':{'id':_0x4fbc1f['params']['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x1746fc,null))[_0xe49c('0x24')](function(_0x6a0881){if(_0x6a0881){_0x4fbc1f[_0xe49c('0x4b')][_0xe49c('0x56')]=_0x6a0881['id'];return db['CannedAnswer'][_0xe49c('0x4a')](_0x4fbc1f[_0xe49c('0x4b')]);}})['then'](respondWithResult(_0x1746fc,null))['catch'](handleError(_0x1746fc,null));};exports[_0xe49c('0x5c')]=function(_0xdf2ca,_0x942669){var _0xf3cead={'raw':![],'where':{}};var _0x10ebb8={};var _0x2b4e3a={'count':0x0,'rows':[]};return db[_0xe49c('0x2f')][_0xe49c('0x5d')]({'where':{'id':_0xdf2ca['params']['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x942669,null))[_0xe49c('0x24')](function(_0x1b25bb){if(_0x1b25bb){_0x10ebb8[_0xe49c('0x37')]=_[_0xe49c('0x35')](db[_0xe49c('0x5e')][_0xe49c('0x30')]);_0x10ebb8[_0xe49c('0x34')]=_[_0xe49c('0x35')](_0xdf2ca['query']);_0x10ebb8[_0xe49c('0x36')]=_[_0xe49c('0x39')](_0x10ebb8[_0xe49c('0x37')],_0x10ebb8[_0xe49c('0x34')]);_0xf3cead[_0xe49c('0x38')]=_['intersection'](_0x10ebb8[_0xe49c('0x37')],qs[_0xe49c('0x3a')](_0xdf2ca[_0xe49c('0x34')][_0xe49c('0x3a')]));_0xf3cead['attributes']=_0xf3cead[_0xe49c('0x38')][_0xe49c('0x47')]?_0xf3cead[_0xe49c('0x38')]:_0x10ebb8[_0xe49c('0x37')];if(!_0xdf2ca[_0xe49c('0x34')][_0xe49c('0x3b')](_0xe49c('0x3c'))){_0xf3cead['limit']=qs[_0xe49c('0x1f')](_0xdf2ca['query'][_0xe49c('0x1f')]);_0xf3cead[_0xe49c('0x1d')]=qs[_0xe49c('0x1d')](_0xdf2ca[_0xe49c('0x34')][_0xe49c('0x1d')]);}_0xf3cead[_0xe49c('0x3d')]=qs[_0xe49c('0x3e')](_0xdf2ca['query'][_0xe49c('0x3e')]);_0xf3cead[_0xe49c('0x3f')]=qs['filters'](_['pick'](_0xdf2ca[_0xe49c('0x34')],_0x10ebb8['filters']));_0xf3cead[_0xe49c('0x3f')]['ChatWebsiteId']=_0x1b25bb['id'];if(_0xdf2ca['query'][_0xe49c('0x40')]){_0xf3cead[_0xe49c('0x3f')]=_[_0xe49c('0x41')](_0xf3cead[_0xe49c('0x3f')],{'$or':_['map'](_0xf3cead[_0xe49c('0x38')],function(_0x335b3e){var _0x2e3587={};_0x2e3587[_0x335b3e]={'$like':'%'+_0xdf2ca['query'][_0xe49c('0x40')]+'%'};return _0x2e3587;})});}_0xf3cead=_['merge']({},_0xf3cead,_0xdf2ca[_0xe49c('0x48')]);return db[_0xe49c('0x5e')][_0xe49c('0x20')]({'where':_0xf3cead['where']})[_0xe49c('0x24')](function(_0x142e64){_0x2b4e3a[_0xe49c('0x20')]=_0x142e64;if(_0xdf2ca[_0xe49c('0x34')][_0xe49c('0x57')]){_0xf3cead[_0xe49c('0x58')]=[{'all':!![]}];}return db[_0xe49c('0x5e')][_0xe49c('0x42')](_0xf3cead);})[_0xe49c('0x24')](function(_0x21de96){_0x2b4e3a[_0xe49c('0x43')]=_0x21de96;return _0x2b4e3a;});}})[_0xe49c('0x24')](respondWithFilteredResult(_0x942669,_0xf3cead))[_0xe49c('0x18')](handleError(_0x942669,null));};exports[_0xe49c('0x5f')]=function(_0x41b4a7,_0x41b2b2){return db['ChatWebsite'][_0xe49c('0x49')]({'where':{'id':_0x41b4a7['params']['id']}})['then'](handleEntityNotFound(_0x41b2b2,null))[_0xe49c('0x24')](function(_0x56f76f){if(_0x56f76f){return _0x56f76f[_0xe49c('0x5f')](_0x41b4a7['query'][_0xe49c('0x5a')]);}})[_0xe49c('0x24')](respondWithStatusCode(_0x41b2b2,null))[_0xe49c('0x18')](handleError(_0x41b2b2,null));};exports[_0xe49c('0x60')]=function(_0x57903c,_0x5e84da){_0x57903c[_0xe49c('0x4b')]['sitepic']=_0x57903c[_0xe49c('0x61')][_0xe49c('0x62')];return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'where':{'id':_0x57903c['params']['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x5e84da,null))['then'](saveUpdates(_0x57903c['body'],null))[_0xe49c('0x24')](respondWithResult(_0x5e84da,null))[_0xe49c('0x18')](handleError(_0x5e84da,null));};exports[_0xe49c('0x63')]=function(_0x334e70,_0x461caf){_0x334e70['body'][_0xe49c('0x64')]=_0x334e70[_0xe49c('0x61')][_0xe49c('0x62')];return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'where':{'id':_0x334e70[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x461caf,null))[_0xe49c('0x24')](saveUpdates(_0x334e70['body'],null))[_0xe49c('0x24')](respondWithResult(_0x461caf,null))[_0xe49c('0x18')](handleError(_0x461caf,null));};exports[_0xe49c('0x65')]=function(_0x21cef1,_0x497af1){_0x21cef1[_0xe49c('0x4b')][_0xe49c('0x66')]=_0x21cef1[_0xe49c('0x61')][_0xe49c('0x62')];return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'where':{'id':_0x21cef1[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x497af1,null))[_0xe49c('0x24')](saveUpdates(_0x21cef1['body'],null))[_0xe49c('0x24')](respondWithResult(_0x497af1,null))['catch'](handleError(_0x497af1,null));};exports['addSystemAvatar']=function(_0x18cecd,_0x2a0a1d){_0x18cecd['body']['systemAvatar']=_0x18cecd[_0xe49c('0x61')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x18cecd[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x2a0a1d,null))[_0xe49c('0x24')](saveUpdates(_0x18cecd[_0xe49c('0x4b')],null))['then'](respondWithResult(_0x2a0a1d,null))['catch'](handleError(_0x2a0a1d,null));};exports[_0xe49c('0x67')]=function(_0x36c4be,_0x47716b){var _0x94e75a=path[_0xe49c('0x68')](config[_0xe49c('0x69')],'server/files/images/logos/default_logo.svg');var _0x2a9be0={'where':{'id':_0x36c4be[_0xe49c('0x45')]['id']},'attributes':['id',_0xe49c('0x6a')],'raw':!![]};var _0x3e8881=![];return require('../../config/license/util')['getLicense']()['then'](function(_0x2c0f44){if(_0x2c0f44){_0x3e8881=_0x2c0f44[_0xe49c('0x6b')];}})['then'](function(){return db[_0xe49c('0x2f')][_0xe49c('0x49')](_0x2a9be0);})['then'](handleEntityNotFound(_0x47716b,null))[_0xe49c('0x24')](function(_0x7a63dd){if(_0x7a63dd){if(!_[_0xe49c('0x6c')](_0x7a63dd[_0xe49c('0x6a')])){if(fs[_0xe49c('0x6d')](path['join'](config[_0xe49c('0x69')],_0xe49c('0x6e'),_0x7a63dd['sitepic']))&&_0x3e8881){_0x94e75a=path[_0xe49c('0x68')](config[_0xe49c('0x69')],'server/files/images/logos/',_0x7a63dd[_0xe49c('0x6a')]);}}return _0x47716b[_0xe49c('0x6f')](_0x94e75a);}})[_0xe49c('0x18')](handleError(_0x47716b,null));};exports[_0xe49c('0x70')]=function(_0x307f56,_0x1cef16){var _0x4c5915=path[_0xe49c('0x68')](config['root'],_0xe49c('0x71'));var _0x74f807={'where':{'id':_0x307f56[_0xe49c('0x45')]['id']},'attributes':['id',_0xe49c('0x64')],'raw':!![]};return db[_0xe49c('0x2f')][_0xe49c('0x49')](_0x74f807)['then'](handleEntityNotFound(_0x1cef16,null))[_0xe49c('0x24')](function(_0x480363){if(_0x480363){if(!_[_0xe49c('0x6c')](_0x480363[_0xe49c('0x64')])){if(fs[_0xe49c('0x6d')](path['join'](config[_0xe49c('0x69')],_0xe49c('0x72'),_0x480363[_0xe49c('0x64')]))){_0x4c5915=path[_0xe49c('0x68')](config['root'],_0xe49c('0x72'),_0x480363[_0xe49c('0x64')]);}}return _0x1cef16[_0xe49c('0x6f')](_0x4c5915);}})[_0xe49c('0x18')](handleError(_0x1cef16,null));};exports[_0xe49c('0x73')]=function(_0x9a6944,_0x1bce53){var _0x53a7f8=path[_0xe49c('0x68')](config[_0xe49c('0x69')],'server/files/images/avatars/customer_avatar.png');var _0x4a8085={'where':{'id':_0x9a6944[_0xe49c('0x45')]['id']},'attributes':['id',_0xe49c('0x66'),_0xe49c('0x74')],'raw':!![]};return db[_0xe49c('0x2f')][_0xe49c('0x49')](_0x4a8085)[_0xe49c('0x24')](handleEntityNotFound(_0x1bce53,null))[_0xe49c('0x24')](function(_0x5537aa){if(_0x5537aa){if(!_[_0xe49c('0x6c')](_0x5537aa[_0xe49c('0x66')])){if(fs['existsSync'](path[_0xe49c('0x68')](config[_0xe49c('0x69')],_0xe49c('0x72'),_0x5537aa[_0xe49c('0x66')]))&&_0x5537aa[_0xe49c('0x74')]){_0x53a7f8=path[_0xe49c('0x68')](config['root'],'server/files/images/avatars/',_0x5537aa[_0xe49c('0x66')]);}}return _0x1bce53[_0xe49c('0x6f')](_0x53a7f8);}})[_0xe49c('0x18')](handleError(_0x1bce53,null));};exports[_0xe49c('0x75')]=function(_0x348b7a,_0x1110ed){var _0x18a7b7=path[_0xe49c('0x68')](config['root'],_0xe49c('0x76'));var _0x3649e1={'where':{'id':_0x348b7a[_0xe49c('0x45')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xe49c('0x2f')][_0xe49c('0x49')](_0x3649e1)[_0xe49c('0x24')](handleEntityNotFound(_0x1110ed,null))[_0xe49c('0x24')](function(_0x5a3a5e){if(_0x5a3a5e){if(!_[_0xe49c('0x6c')](_0x5a3a5e['systemAvatar'])){if(fs['existsSync'](path[_0xe49c('0x68')](config[_0xe49c('0x69')],_0xe49c('0x72'),_0x5a3a5e[_0xe49c('0x77')]))){_0x18a7b7=path[_0xe49c('0x68')](config[_0xe49c('0x69')],'server/files/images/avatars/',_0x5a3a5e['systemAvatar']);}}return _0x1110ed['download'](_0x18a7b7);}})[_0xe49c('0x18')](handleError(_0x1110ed,null));};exports['notify']=function(_0x5aed91,_0x3334f0){var _0x47511b=require(_0xe49c('0x78'));var _0x5e4ece=new _0x47511b();var _0x92bb25=_0x5e4ece[_0xe49c('0x79')](_0x5aed91['headers']['user-agent'])[_0xe49c('0x7a')]();var _0x66bd52={'body':_0x5aed91[_0xe49c('0x4b')],'channel':'chat'};var _0x3794e9=[];var _0x143258=[];var _0x4aecd3={};var _0x23c7e5=![];return db[_0xe49c('0x7b')]['describe']()[_0xe49c('0x24')](function(_0x1e5ce2){if(!_0x1e5ce2){throw new db[(_0xe49c('0x7c'))]['ValidationError'](_0xe49c('0x7d'));}_0x3794e9=_[_0xe49c('0x7e')](_['keys'](_0x1e5ce2),[_0xe49c('0x7f'),_0xe49c('0x80')]);_0x143258=_[_0xe49c('0x7e')](_[_0xe49c('0x35')](_0x1e5ce2),[_0xe49c('0x7f'),_0xe49c('0x80'),_0xe49c('0x81'),'ListId']);if(_0x5aed91['body']['id']){delete _0x5aed91[_0xe49c('0x4b')]['id'];}if(_[_0xe49c('0x6c')](_0x5aed91[_0xe49c('0x4b')][_0xe49c('0x82')])){throw new db[(_0xe49c('0x7c'))][(_0xe49c('0x83'))](_0xe49c('0x84'));}if(_[_0xe49c('0x6c')](_0x5aed91[_0xe49c('0x4b')][_0xe49c('0x4b')])||_0x5aed91[_0xe49c('0x4b')][_0xe49c('0x4b')]===''){throw new db[(_0xe49c('0x7c'))][(_0xe49c('0x83'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe49c('0x6c')](_0x5aed91[_0xe49c('0x4b')][_0xe49c('0x85')])){throw new db['Sequelize'][(_0xe49c('0x83'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x143258);}if(!_[_0xe49c('0x86')](_0x143258,_0x5aed91['body'][_0xe49c('0x85')])){throw new db[(_0xe49c('0x7c'))][(_0xe49c('0x83'))](_0xe49c('0x87')+_0x143258);}_0x4aecd3[_0x5aed91['body']['mapKey']]=_0x5aed91[_0xe49c('0x4b')][_0xe49c('0x82')];})[_0xe49c('0x24')](function(){return db['ChatWebsite'][_0xe49c('0x49')]({'where':{'id':_0x5aed91[_0xe49c('0x45')]['id']},'include':[{'model':db[_0xe49c('0x88')],'as':_0xe49c('0x89'),'include':[{'model':db[_0xe49c('0x7b')],'as':'Contacts','where':_0x4aecd3,'limit':0x1,'order':[[_0xe49c('0x80'),_0xe49c('0x8a')]]}]},{'model':db[_0xe49c('0x8b')],'as':_0xe49c('0x8c')}]});})['then'](handleEntityNotFound(_0x3334f0,null))[_0xe49c('0x24')](function(_0x51d675){if(_0x51d675&&_0x51d675[_0xe49c('0x89')]){_0x66bd52[_0xe49c('0x8d')]=_0x51d675;_0x66bd52['applications']=_0x51d675[_0xe49c('0x8c')];_0x66bd52[_0xe49c('0x8e')]=_0x51d675['List'];_0x66bd52['applications']=_['orderBy'](_0x66bd52[_0xe49c('0x8f')],[_0xe49c('0x90')],['asc']);if(_0x66bd52[_0xe49c('0x8d')][_0xe49c('0x8c')]){delete _0x66bd52[_0xe49c('0x8d')]['Applications'];}if(_0x66bd52[_0xe49c('0x8d')][_0xe49c('0x89')]&&_0x66bd52[_0xe49c('0x8d')][_0xe49c('0x89')][_0xe49c('0x91')]['length']){return _0x66bd52['account']['List'][_0xe49c('0x91')][0x0];}var _0x2d2d0c=_[_0xe49c('0x92')](_0x5aed91['body'],{'firstName':_0x5aed91[_0xe49c('0x4b')][_0xe49c('0x82')],'ListId':_0x51d675[_0xe49c('0x93')]});_0x2d2d0c[_0x5aed91['body'][_0xe49c('0x85')]]=_0x5aed91[_0xe49c('0x4b')]['from'];return db['CmContact'][_0xe49c('0x4a')](_0x2d2d0c,{'fields':_0x3794e9,'raw':!![]});}})['then'](handleEntityNotFound(_0x3334f0,null))[_0xe49c('0x24')](function(_0x32642a){_0x66bd52[_0xe49c('0x94')]=_0x32642a;var _0x18de8c=_0x5aed91['body'][_0xe49c('0x95')];if(_0x5aed91[_0xe49c('0x96')][_0xe49c('0x97')]){_0x18de8c=_0x5aed91['headers'][_0xe49c('0x97')];}else if(_0x5aed91['headers'][_0xe49c('0x98')]){_0x18de8c=_[_0xe49c('0x99')](_0x5aed91['headers']['x-forwarded-for'][_0xe49c('0x9a')](','));}if(_0x32642a){var _0x6b6f66={'ContactId':_0x32642a['id'],'ChatWebsiteId':_0x5aed91[_0xe49c('0x45')]['id'],'from':(_0x32642a[_0xe49c('0x9b')]||'')+'\x20'+(_0x32642a['lastName']||''),'customerIp':_0x18de8c,'customerPort':_0x5aed91[_0xe49c('0x96')][_0xe49c('0x9c')]?_0x5aed91[_0xe49c('0x96')][_0xe49c('0x9c')]:null,'referer':_0x5aed91[_0xe49c('0x4b')][_0xe49c('0x9d')],'browserName':_0x92bb25[_0xe49c('0x9e')][_0xe49c('0x2a')]&&_0x92bb25[_0xe49c('0x9e')][_0xe49c('0x9f')]?util[_0xe49c('0xa0')](_0xe49c('0xa1'),_0x92bb25['browser'][_0xe49c('0x2a')],_0x92bb25['browser'][_0xe49c('0x9f')]):'unknown','browserVersion':_0x92bb25[_0xe49c('0x9e')]['version']||_0xe49c('0xa2'),'osName':util[_0xe49c('0xa0')]('%s\x20%s',_0x92bb25['os'][_0xe49c('0x2a')],_0x92bb25['os']['version']),'osVersion':_0x92bb25['os'][_0xe49c('0x9f')],'deviceModel':_0x92bb25[_0xe49c('0xa3')][_0xe49c('0x37')]&&_0x92bb25[_0xe49c('0xa3')][_0xe49c('0xa4')]?util[_0xe49c('0xa0')](_0xe49c('0xa5'),_0x92bb25[_0xe49c('0xa3')]['model'],_0x92bb25['device'][_0xe49c('0xa4')],_0x92bb25['device']['type']):null,'deviceVendor':_0x92bb25[_0xe49c('0xa3')][_0xe49c('0xa4')],'deviceType':_0x92bb25[_0xe49c('0xa3')]['type'],'formData':JSON['stringify'](_0x5aed91['body'])};var _0x2a7996={'ChatWebsiteId':_0x5aed91['params']['id'],'closed':![]};if(_0x5aed91['body'][_0xe49c('0xa6')]){_0x2a7996[_0xe49c('0xa6')]=_0x5aed91[_0xe49c('0x4b')]['threadId'];return db[_0xe49c('0xa7')][_0xe49c('0x49')]({'where':_0x2a7996})[_0xe49c('0x24')](function(_0xc3b3e7){if(_0xc3b3e7){return[_0xc3b3e7,![]];}_0x6b6f66[_0xe49c('0xa6')]=_0x5aed91[_0xe49c('0x4b')]['threadId'];_0x6b6f66[_0xe49c('0xa8')]=_0x5aed91[_0xe49c('0x4b')]['externalUrl'];return db[_0xe49c('0xa7')][_0xe49c('0x4a')](_0x6b6f66)[_0xe49c('0x24')](function(_0x121595){return[_0x121595,!![]];});});}_0x2a7996[_0xe49c('0xa9')]=_0x32642a['id'];if(_0x5aed91[_0xe49c('0x4b')][_0xe49c('0xaa')]&&_0x5aed91[_0xe49c('0x4b')][_0xe49c('0xaa')]['id']){_0x2a7996['id']=_0x5aed91[_0xe49c('0x4b')][_0xe49c('0xaa')]['id'];return db[_0xe49c('0xa7')]['find']({'where':_0x2a7996})[_0xe49c('0x24')](function(_0x7b1706){if(_0x7b1706){return[_0x7b1706,![]];}return db[_0xe49c('0xa7')][_0xe49c('0x4a')](_0x6b6f66)[_0xe49c('0x24')](function(_0x1219b8){return[_0x1219b8,!![]];});});}return db['ChatInteraction'][_0xe49c('0x4a')](_0x6b6f66)['then'](function(_0x369f2d){return[_0x369f2d,!![]];});}})[_0xe49c('0xab')](function(_0x25301e,_0x427494){if(_0x25301e){_0x23c7e5=_0x427494;if(!_0x427494){var _0x19549d={'from':(_0x66bd52['contact']['firstName']||'')+'\x20'+(_0x66bd52[_0xe49c('0x94')][_0xe49c('0xac')]||'')};if(_0x5aed91[_0xe49c('0x4b')][_0xe49c('0xa6')]&&_0x5aed91[_0xe49c('0x4b')][_0xe49c('0xad')]&&_0x5aed91[_0xe49c('0x4b')][_0xe49c('0xa6')]!=_0x5aed91[_0xe49c('0x4b')]['messageId']){_0x19549d['threadId']=_0x5aed91[_0xe49c('0x4b')][_0xe49c('0xad')];}return _0x25301e[_0xe49c('0x23')](_0x19549d);}else{return _0x25301e;}}})[_0xe49c('0x24')](function(_0x15d86f){_0x66bd52[_0xe49c('0xaa')]=_0x15d86f[_0xe49c('0x26')]({'plain':!![]});_0x66bd52['interaction'][_0xe49c('0xae')]=_0x23c7e5;if(_0x66bd52[_0xe49c('0xaa')]['created']){if(_0x66bd52['account']['autoclose']){_0x66bd52[_0xe49c('0x8f')][_0xe49c('0xaf')]({'id':0x0,'priority':_0x66bd52[_0xe49c('0x8f')][_0xe49c('0x47')]+0x1,'app':_0xe49c('0xb0'),'appdata':_0xe49c('0xb1'),'interval':_0xe49c('0xb2')});}}return db[_0xe49c('0xb3')][_0xe49c('0x4a')]({'body':_0x5aed91[_0xe49c('0x4b')]['body'],'ChatWebsiteId':_0x5aed91[_0xe49c('0x45')]['id'],'ChatInteractionId':_0x15d86f['id'],'direction':'in','ContactId':_0x66bd52[_0xe49c('0x94')]['id'],'AttachmentId':_0x5aed91['body'][_0xe49c('0xb4')]});})['then'](function(_0x6ef0f2){_0x66bd52[_0xe49c('0x17')]=_0x6ef0f2;if(_0x66bd52[_0xe49c('0xaa')][_0xe49c('0xb5')]){return db['User'][_0xe49c('0x49')]({'attributes':['id',_0xe49c('0x2a')],'where':{'id':_0x66bd52[_0xe49c('0xaa')]['UserId']}})[_0xe49c('0x24')](function(_0x3f2bbe){if(_0x3f2bbe){_0x66bd52[_0xe49c('0x8f')][_0xe49c('0xb6')]({'id':0x0,'priority':0x0,'app':_0xe49c('0xb7'),'appdata':_0x3f2bbe[_0xe49c('0x2a')]+','+(_0x66bd52[_0xe49c('0x8d')][_0xe49c('0xb8')]||0xa),'interval':_0xe49c('0xb2')});_0x66bd52[_0xe49c('0xb9')]=!![];}return respondWithRpcPromise(_0xe49c('0xba'),_0xe49c('0xbb'),_0x66bd52);});}return respondWithRpcPromise(_0xe49c('0xba'),_0xe49c('0xbb'),_0x66bd52);})[_0xe49c('0x24')](function(_0x41c488){respondWithRpcPromise('EventManager',_0xe49c('0xbc'),{'event':'notify','message':_0x41c488},client9002);return _0x41c488;})[_0xe49c('0x24')](respondWithResult(_0x3334f0,null))[_0xe49c('0x18')](handleError(_0x3334f0,null));};exports[_0xe49c('0xbd')]=function(_0xc70b2,_0x2cdc04){var _0x4f8a8b,_0x74482b,_0x3ba7b9;var _0x35a90c=[];var _0x54b908={};var _0x1a5c10=_0xc70b2[_0xe49c('0xbe')]||[];var _0x341016=[];var _0x277f3f;return db['CmContact']['describe']()['then'](function(_0x24be60){if(!_0x24be60){throw new db[(_0xe49c('0x7c'))]['ValidationError'](_0xe49c('0x7d'));}_0x35a90c=_[_0xe49c('0x7e')](_['keys'](_0x24be60),[_0xe49c('0x7f'),'updatedAt',_0xe49c('0x81'),_0xe49c('0x93')]);if(_0xc70b2['body']['id']){delete _0xc70b2[_0xe49c('0x4b')]['id'];}if(_[_0xe49c('0x6c')](_0xc70b2[_0xe49c('0x4b')][_0xe49c('0x82')])){throw _0x2cdc04[_0xe49c('0x1a')](0x1f4)[_0xe49c('0x2b')](new db[(_0xe49c('0x7c'))][(_0xe49c('0x83'))](_0xe49c('0x84')));}if(_[_0xe49c('0x6c')](_0xc70b2[_0xe49c('0x4b')][_0xe49c('0x4b')])||_0xc70b2[_0xe49c('0x4b')][_0xe49c('0x4b')]===''){throw _0x2cdc04['status'](0x1f4)['send'](new db[(_0xe49c('0x7c'))][(_0xe49c('0x83'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe49c('0x6c')](_0xc70b2[_0xe49c('0x4b')][_0xe49c('0xbf')])){throw _0x2cdc04['status'](0x1f4)['send'](new db[(_0xe49c('0x7c'))][(_0xe49c('0x83'))](_0xe49c('0xc0')+_0x35a90c));}if(!_[_0xe49c('0x86')](_0x35a90c,_0xc70b2['body'][_0xe49c('0xbf')])){throw _0x2cdc04['status'](0x1f4)['send'](new db[(_0xe49c('0x7c'))][(_0xe49c('0x83'))](_0xe49c('0xc1')+_0x35a90c));}_0x54b908[_0xc70b2[_0xe49c('0x4b')][_0xe49c('0xbf')]]=_0xc70b2[_0xe49c('0x4b')][_0xe49c('0x82')];})[_0xe49c('0x24')](function(){return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'where':{'id':_0xc70b2[_0xe49c('0x45')]['id']},'include':[{'model':db[_0xe49c('0x88')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x2cdc04,null))[_0xe49c('0x24')](function(_0x412c0a){if(_0x412c0a&&_0x412c0a[_0xe49c('0x89')]){_0x74482b=_0x412c0a;var _0x4d8e37=_[_0xe49c('0x92')](_0xc70b2[_0xe49c('0x4b')],{'firstName':_0xc70b2[_0xe49c('0x4b')][_0xe49c('0x82')],'phone':_0xc70b2[_0xe49c('0x4b')][_0xe49c('0x82')],'ListId':_0x412c0a[_0xe49c('0x93')]});_0x4d8e37[_0xc70b2[_0xe49c('0x4b')][_0xe49c('0xbf')]]=_0xc70b2[_0xe49c('0x4b')][_0xe49c('0x82')];return db[_0xe49c('0x7b')][_0xe49c('0xc2')]({'where':_0x54b908,'defaults':_0x4d8e37});}})[_0xe49c('0xab')](function(_0x31e01e){if(_0x31e01e){_0x3ba7b9=_0x31e01e;var _0x49ab67=fs[_0xe49c('0xc3')](path[_0xe49c('0x68')](config[_0xe49c('0x69')],'server/files/templates/chatOfflineMessage.ejs'),_0xe49c('0xc4'));var _0x3a5c8d=ejs[_0xe49c('0xc5')](_0x49ab67,{'body':_[_0xe49c('0xc6')](_0xc70b2[_0xe49c('0x4b')][_0xe49c('0x4b')]),'bodyTitle':_0x74482b[_0xe49c('0xc7')]});return db[_0xe49c('0xc8')][_0xe49c('0x4a')]({'body':_0x3a5c8d,'plainBody':htmlToText['fromString'](_0x3a5c8d),'ContactId':_0x31e01e['id'],'ChatWebsiteId':_0x74482b['id']});}})[_0xe49c('0x24')](function(_0x31813a){_0x277f3f=_0x31813a;if(_0x1a5c10[_0xe49c('0x47')]){var _0x2e80c5=_0x1a5c10[_0xe49c('0x2e')](function(_0x1ca231){return{'name':_0x1ca231[_0xe49c('0xc9')],'basename':_0x1ca231[_0xe49c('0x62')],'type':_0x1ca231[_0xe49c('0xca')],'ChatOfflineMessageId':_0x31813a['id']};});_0x341016=_0x2e80c5['map'](_0x302d7d=>{var _0x4fa3ec={'filename':_0x302d7d[_0xe49c('0x2a')],'path':path[_0xe49c('0x68')](config[_0xe49c('0x69')],_0xe49c('0xcb'),_0xe49c('0xbe'),_0xe49c('0xcc'),_0xe49c('0xcd'),_0x302d7d[_0xe49c('0xce')])};return _0x4fa3ec;});if(!_0x74482b[_0xe49c('0xcf')]){return db['sequelize'][_0xe49c('0xd0')](function(_0x567a44){return db['Attachment'][_0xe49c('0xd1')](_0x2e80c5,{'transaction':_0x567a44});});}}})[_0xe49c('0x24')](function(){if(_0x277f3f){_0x4f8a8b=_0x277f3f;return db[_0xe49c('0xd2')][_0xe49c('0x5d')]({'where':{'service':!![]},'include':[{'model':db[_0xe49c('0xd3')],'as':_0xe49c('0xd4'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x3661ee){if(_0x3661ee&&_0x3661ee[_0xe49c('0xd4')]&&_0x74482b['forwardOffline']&&_0x74482b[_0xe49c('0xd5')]){var _0x15acef=_0x3661ee[_0xe49c('0xd6')]();return respondWithRpcPromise(_0xe49c('0xd7'),_0xe49c('0xd8'),{'account':_0x15acef,'message':{'from':util[_0xe49c('0xa0')]('\x22%s\x22\x20<%s>',_0x3661ee[_0xe49c('0x2a')],_0x3661ee['email']||_0x3661ee['Smtp']['user']),'to':_0x74482b['forwardOfflineAddress'],'subject':_0x74482b[_0xe49c('0xd9')],'html':_0x4f8a8b['body'],'attachments':_0x341016}},client9003)[_0xe49c('0x24')](function(){return _0x4f8a8b;})[_0xe49c('0x18')](function(_0x46ffc0){logger['error'](_0x46ffc0);});}})['then'](function(){if(_0x74482b&&_0x74482b[_0xe49c('0xcf')]&&_0x74482b['MailAccountId']){var _0x19ec9e=[];if(_0x1a5c10[_0xe49c('0x47')]){_0x19ec9e=_0x1a5c10['map'](function(_0x1e71a4){return{'name':_0x1e71a4[_0xe49c('0xc9')],'basename':_0x1e71a4[_0xe49c('0x62')],'type':_0x1e71a4[_0xe49c('0xca')],'ChatOfflineMessageId':_0x277f3f['id']};});}var _0x452f9d;if(!_[_0xe49c('0x6c')](_0x74482b[_0xe49c('0xda')])){var _0x5764b0=_['map'](_0xc70b2['body'],function(_0x58aa10){return _0x58aa10;});var _0x13b525=_[_0xe49c('0xdb')](_0x5764b0)[0x0];var _0x31b39c=_[_0xe49c('0xdc')](_0x13b525,function(_0x103ac3){return _0x103ac3;});_0x452f9d=_0x31b39c[0x1][_0x74482b[_0xe49c('0xda')]];}var _0x3a1cc7={'from':_0x3ba7b9[_0xe49c('0xdd')],'firstName':_0x3ba7b9[_0xe49c('0x9b')],'lastName':_0x3ba7b9[_0xe49c('0xac')],'mapKey':_0xe49c('0xdd'),'message':{'from':_0x3ba7b9[_0xe49c('0xdd')],'to':_0x74482b[_0xe49c('0xd2')]['email'],'cc':'','subject':_[_0xe49c('0x6c')](_0x452f9d)?_0x74482b[_0xe49c('0xd9')]:_0x452f9d,'messageId':'','sentAt':new Date(),'attach':_0x19ec9e[_0xe49c('0x47')],'attachments':_0x19ec9e,'originChannel':_0xe49c('0xde'),'ChatWebsiteId':_0x74482b['id'],'ChatOfflineMessageId':_0x4f8a8b['id'],'originTo':_0x74482b[_0xe49c('0xd2')][_0xe49c('0xdd')]},'body':_0x4f8a8b[_0xe49c('0x4b')]};var _0x5ec3f7={'account':{'id':_0x74482b[_0xe49c('0xdf')]},'body':_0x3a1cc7,'log':_0xe49c('0xe0')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x5ec3f7,client9001)[_0xe49c('0x24')](function(){return _0x4f8a8b;})[_0xe49c('0x18')](function(_0x11c76d){logger[_0xe49c('0x14')](_0x11c76d);});}return;})[_0xe49c('0x24')](function(){if(_0x4f8a8b){return _0x4f8a8b;}})[_0xe49c('0x24')](respondWithResult(_0x2cdc04,null))[_0xe49c('0x18')](function(_0x466fe7){logger[_0xe49c('0x14')]('catch',_0x466fe7);for(var _0x3ffca5 of _0x1a5c10){var _0x3933a8=path[_0xe49c('0x68')](config[_0xe49c('0x69')],_0xe49c('0xcb'),_0xe49c('0xbe'),_0xe49c('0xcc'),'offline-chat',_0x3ffca5[_0xe49c('0x62')]);fs_extra[_0xe49c('0xe1')](_0x3933a8)[_0xe49c('0x18')](function(_0x1c1e65){logger[_0xe49c('0x14')](_0xe49c('0xe2'),_0x3933a8,_0x1c1e65);});}});};exports['addInteraction']=function(_0x10de7c,_0x2a3071){return db[_0xe49c('0xa7')][_0xe49c('0x49')]({'where':{'id':_0x10de7c[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x2a3071,null))[_0xe49c('0x24')](function(_0x4ff387){if(_0x4ff387){return _0x4ff387[_0xe49c('0xe3')](_0x10de7c[_0xe49c('0x4b')][_0xe49c('0x5a')],_[_0xe49c('0xe4')](_0x10de7c['body'],[_0xe49c('0x5a'),'id'])||{});}})[_0xe49c('0x24')](respondWithResult(_0x2a3071,null))[_0xe49c('0x18')](handleError(_0x2a3071,null));};exports['getInteractions']=function(_0x1c6da5,_0x46f017){var _0x1446ee={'raw':![],'where':{}};var _0x148f01={};var _0x61904f={'count':0x0,'rows':[]};return db[_0xe49c('0x2f')][_0xe49c('0x5d')]({'where':{'id':_0x1c6da5['params']['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x46f017,null))[_0xe49c('0x24')](function(_0x4ec6c8){if(_0x4ec6c8){_0x148f01[_0xe49c('0x37')]=_[_0xe49c('0x35')](db[_0xe49c('0xa7')][_0xe49c('0x30')]);_0x148f01[_0xe49c('0x34')]=_[_0xe49c('0x35')](_0x1c6da5['query']);_0x148f01[_0xe49c('0x36')]=_[_0xe49c('0x39')](_0x148f01[_0xe49c('0x37')],_0x148f01[_0xe49c('0x34')]);_0x1446ee[_0xe49c('0x38')]=_[_0xe49c('0x39')](_0x148f01[_0xe49c('0x37')],qs['fields'](_0x1c6da5[_0xe49c('0x34')]['fields']));_0x1446ee['attributes']=_0x1446ee[_0xe49c('0x38')][_0xe49c('0x47')]?_0x1446ee[_0xe49c('0x38')]:_0x148f01[_0xe49c('0x37')];if(!_0x1c6da5['query'][_0xe49c('0x3b')]('nolimit')){_0x1446ee[_0xe49c('0x1f')]=qs[_0xe49c('0x1f')](_0x1c6da5['query'][_0xe49c('0x1f')]);_0x1446ee['offset']=qs[_0xe49c('0x1d')](_0x1c6da5[_0xe49c('0x34')][_0xe49c('0x1d')]);}_0x1446ee[_0xe49c('0x3d')]=qs[_0xe49c('0x3e')](_0x1c6da5['query'][_0xe49c('0x3e')]);_0x1446ee[_0xe49c('0x3f')]=qs['filters'](_[_0xe49c('0x55')](_0x1c6da5[_0xe49c('0x34')],_0x148f01['filters']));_0x1446ee[_0xe49c('0x3f')][_0xe49c('0x56')]=_0x4ec6c8['id'];if(_0x1c6da5[_0xe49c('0x34')][_0xe49c('0x40')]){_0x1446ee['where']=_[_0xe49c('0x41')](_0x1446ee['where'],{'$or':_[_0xe49c('0x2e')](_0x1446ee[_0xe49c('0x38')],function(_0x560119){var _0x15bc64={};_0x15bc64[_0x560119]={'$like':'%'+_0x1c6da5['query'][_0xe49c('0x40')]+'%'};return _0x15bc64;})});}_0x1446ee=_[_0xe49c('0x41')]({},_0x1446ee,_0x1c6da5[_0xe49c('0x48')]);return db[_0xe49c('0xa7')][_0xe49c('0x20')]({'where':_0x1446ee[_0xe49c('0x3f')]})['then'](function(_0x3652c3){_0x61904f[_0xe49c('0x20')]=_0x3652c3;if(_0x1c6da5[_0xe49c('0x34')]['includeAll']){_0x1446ee[_0xe49c('0x58')]=[{'model':db[_0xe49c('0x7b')],'as':_0xe49c('0xe5'),'required':![]},{'model':db[_0xe49c('0xe6')],'as':_0xe49c('0xe7'),'attributes':[_0xe49c('0x2a'),'fullname',_0xe49c('0xe8')],'required':![]},{'model':db['Tag'],'as':_0xe49c('0xe9'),'attributes':['id',_0xe49c('0x2a'),_0xe49c('0xea')],'where':_0x1c6da5[_0xe49c('0x34')][_0xe49c('0xeb')]?{'id':_0x1c6da5['query']['tag']}:undefined,'required':_0x1c6da5[_0xe49c('0x34')][_0xe49c('0xeb')]?!![]:![]}];}return db[_0xe49c('0xa7')]['findAll'](_0x1446ee);})['then'](function(_0x1926c9){_0x61904f[_0xe49c('0x43')]=_0x1926c9;return _0x61904f;});}})[_0xe49c('0x24')](respondWithFilteredResult(_0x46f017,_0x1446ee))[_0xe49c('0x18')](handleError(_0x46f017,null));};function iftimePromise(_0x4fc0d1,_0x12234a){return respondWithRpcPromise(_0xe49c('0xec'),'getSnippet',{'command':_0x12234a[_0xe49c('0xed')]?util[_0xe49c('0xa0')]('iftime\x20%s,%s',_0x4fc0d1[_0xe49c('0xee')],_0x12234a[_0xe49c('0xed')]):util[_0xe49c('0xa0')](_0xe49c('0xef'),_0x4fc0d1[_0xe49c('0xee')])},client9002)[_0xe49c('0x24')](function(_0x3b8b06){var _0x2e4d14=_0x3b8b06&&_0x3b8b06[_0xe49c('0xf0')](_0xe49c('0xf1'))>=0x0?!![]:![];logger[_0xe49c('0x10')](_0xe49c('0xf2'),_0x12234a['id'],_0x4fc0d1['id'],_0x4fc0d1[_0xe49c('0xee')],_0x2e4d14?_0xe49c('0xf3'):_0xe49c('0xf4'),_0x12234a[_0xe49c('0xed')]?_0x12234a[_0xe49c('0xed')]:_0xe49c('0xf5'));return _0x2e4d14;})['catch'](function(_0x295420){logger[_0xe49c('0x14')](_0xe49c('0xf2'),_0x12234a['id'],_0x4fc0d1['id'],_0x4fc0d1[_0xe49c('0xee')],util['inspect'](_0x295420,{'showHidden':![],'depth':null}),_0x12234a['timezone']?_0x12234a['timezone']:_0xe49c('0xf5'));return![];});}exports[_0xe49c('0xf6')]=function(_0x26f890,_0x394a16){var _0x341bca=0x0;var _0x3a251d=0x0;var _0x13bb65=![];var _0x954402;var _0x2e3a14;return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'where':{'id':_0x26f890['params']['id']},'include':[{'model':db[_0xe49c('0xf7')],'as':_0xe49c('0xf7'),'include':[{'model':db[_0xe49c('0xf7')],'as':'Intervals','attributes':['id',_0xe49c('0xee')],'raw':!![]}]}]})[_0xe49c('0x24')](handleEntityNotFound(_0x394a16,null))[_0xe49c('0x24')](function(_0x335de4){if(_0x335de4){_0x954402=_0x335de4;return _0x335de4[_0xe49c('0xf8')]({'raw':!![]});}})[_0xe49c('0x24')](function(_0x5bd215){if(_0x954402){if(_0x5bd215){_0x2e3a14=_0x5bd215;}}return require(_0xe49c('0xf9'))[_0xe49c('0xfa')]();})[_0xe49c('0x24')](function(_0x5d2add){if(_0x5d2add){_0x3a251d=_0x5d2add[_0xe49c('0xfb')];_0x13bb65=_0x5d2add[_0xe49c('0x6b')];}})[_0xe49c('0x24')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xe49c('0x24')](function(_0x44998a){_0x341bca=_0x44998a;if(_0x3a251d&&_0x44998a>_0x3a251d){return db[_0xe49c('0xfc')][_0xe49c('0x5d')]({'where':{'id':0x1}})[_0xe49c('0x24')](function(_0x55ddf5){if(_0x55ddf5){_0x55ddf5[_0xe49c('0xfd')]('chatLicenseExceeded');}});}})[_0xe49c('0x24')](function(){if(_0x954402[_0xe49c('0xf7')]&&_0x954402[_0xe49c('0xf7')][_0xe49c('0xfe')]){var _0xc09b02=[];for(var _0x48d7bc=0x0;_0x48d7bc<_0x954402[_0xe49c('0xf7')]['Intervals'][_0xe49c('0x47')];_0x48d7bc++){var _0xeb17af=_0x954402[_0xe49c('0xf7')][_0xe49c('0xfe')][_0x48d7bc]['get']({'plain':!![]});_0xc09b02[_0xe49c('0xaf')](iftimePromise(_0xeb17af,_0x954402));}return BPromise['all'](_0xc09b02)[_0xe49c('0x24')](function(_0x1ed58e){return _[_0xe49c('0xff')](_0x1ed58e);});}else{return!![];}})[_0xe49c('0x24')](function(_0x29fd78){var _0x11edb6=fs['readFileSync'](path[_0xe49c('0x68')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x33c747=new url[(_0xe49c('0x100'))](_0x954402[_0xe49c('0x101')])[_0xe49c('0x102')];var _0x54bc2f='3.1.0';var _0x18fd0b=![];var _0x5d717b={'chatVersion':_0x54bc2f,'chatWebsiteAddressOrigin':_0x33c747,'remote':_0x954402[_0xe49c('0x103')],'query':querystring[_0xe49c('0x104')](_[_0xe49c('0x41')](_0x954402[_0xe49c('0x26')]({'plain':!![]}),{'customerIp':_0x26f890[_0xe49c('0x96')][_0xe49c('0x98')]||_0x26f890[_0xe49c('0x96')][_0xe49c('0x105')]||_0x26f890[_0xe49c('0x106')][_0xe49c('0x107')]||_0x26f890['ip'],'referer':_0x26f890[_0xe49c('0x96')]['referer'],'openedInteractions':_0x341bca,'maxInteractions':_0x3a251d,'virtual':_0x13bb65['virtual'],'online':_0x29fd78,'custom':_0x13bb65}))[_0xe49c('0x108')](/'/g,'\x5c\x27')};_0x394a16['send'](ejs[_0xe49c('0xc5')](Mustache['render'](_0x11edb6,_0x5d717b),{'proactiveActions':_0x2e3a14,'alignment':_0x954402[_0xe49c('0x109')],'verticalAlignment':_0x954402[_0xe49c('0x10a')],'div_color':_0x954402['color'],'labelText':_0x954402[_0xe49c('0x10b')],'text_color':_0x954402[_0xe49c('0x10c')],'text_button_color':_0x954402[_0xe49c('0x10d')],'button_color':_0x954402[_0xe49c('0x10e')],'background_color':_0x954402[_0xe49c('0x10f')],'hideWhenOffline':_0x954402[_0xe49c('0x110')],'intervalId':_0x954402[_0xe49c('0x111')],'isDevelopment':_0x18fd0b,'chatVersion':_0x54bc2f}));})[_0xe49c('0x18')](handleError(_0x394a16,null));};exports[_0xe49c('0x112')]=function(_0x5138dc,_0x285dc1){var _0x31c2f9=_0x5138dc[_0xe49c('0x45')]['id'];var _0x26090e=_0x5138dc[_0xe49c('0x4b')];var _0x55679=0xc8;var _0x2bb7fd=null;return db[_0xe49c('0x113')]['transaction']({'isolationLevel':db[_0xe49c('0x113')][_0xe49c('0x114')][_0xe49c('0x115')][_0xe49c('0x116')]},function(_0x1dce0b){return db[_0xe49c('0x2f')][_0xe49c('0x5d')]({'where':{'id':_0x31c2f9},'transaction':_0x1dce0b})['then'](function(_0x3b57c5){if(_0x3b57c5){return db[_0xe49c('0x8b')]['destroy']({'where':{'ChatWebsiteId':_0x31c2f9},'transaction':_0x1dce0b})['then'](function(){var _0x1e9f72=_[_0xe49c('0x2e')](_0x26090e,function(_0x4a8810){_0x4a8810['ChatWebsiteId']=_0x31c2f9;return _0x4a8810;});return db[_0xe49c('0x8b')][_0xe49c('0xd1')](_0x1e9f72,{'transaction':_0x1dce0b});});}else{_0x55679=0x194;_0x2bb7fd=[];}});})[_0xe49c('0x24')](function(){if(_0x55679!==0x194){return db[_0xe49c('0x8b')][_0xe49c('0x117')]({'where':{'ChatWebsiteId':_0x31c2f9},'order':_0xe49c('0x90')})['then'](function(_0xcfac53){_0x2bb7fd=_0xcfac53;});}})[_0xe49c('0x18')](function(_0x398d61){_0x55679=0x1f4;logger[_0xe49c('0x14')](_0x398d61[_0xe49c('0x29')]);if(_0x398d61[_0xe49c('0x2a')]){delete _0x398d61[_0xe49c('0x2a')];}_0x2bb7fd=_0x398d61;})[_0xe49c('0x118')](function(){if(_0x2bb7fd===null){_0x285dc1['sendStatus'](_0x55679);}else{if(_0x55679===0x1f4){_0x285dc1[_0xe49c('0x1a')](_0x55679)[_0xe49c('0x2b')](_0x2bb7fd);}else{_0x285dc1[_0xe49c('0x1a')](_0x55679)[_0xe49c('0x1c')](_0x2bb7fd);}}});};exports[_0xe49c('0x119')]=function(_0x271c61,_0x3d30b0){var _0x19acaf={};var _0x306d00={};var _0x35c5af;var _0x50df8a;return db[_0xe49c('0x2f')][_0xe49c('0x5d')]({'where':{'id':_0x271c61[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x3d30b0,null))[_0xe49c('0x24')](function(_0x3da1b0){if(_0x3da1b0){_0x35c5af=_0x3da1b0;_0x306d00[_0xe49c('0x37')]=_['keys'](db[_0xe49c('0x8b')][_0xe49c('0x30')]);_0x306d00[_0xe49c('0x34')]=_[_0xe49c('0x35')](_0x271c61[_0xe49c('0x34')]);_0x306d00[_0xe49c('0x36')]=_[_0xe49c('0x39')](_0x306d00[_0xe49c('0x37')],_0x306d00[_0xe49c('0x34')]);_0x19acaf[_0xe49c('0x38')]=_[_0xe49c('0x39')](_0x306d00[_0xe49c('0x37')],qs[_0xe49c('0x3a')](_0x271c61[_0xe49c('0x34')][_0xe49c('0x3a')]));_0x19acaf['attributes']=_0x19acaf[_0xe49c('0x38')][_0xe49c('0x47')]?_0x19acaf['attributes']:_0x306d00[_0xe49c('0x37')];_0x19acaf[_0xe49c('0x3d')]=qs[_0xe49c('0x3e')](_0x271c61['query'][_0xe49c('0x3e')]);_0x19acaf[_0xe49c('0x3f')]=qs[_0xe49c('0x36')](_[_0xe49c('0x55')](_0x271c61['query'],_0x306d00['filters']));if(_0x271c61[_0xe49c('0x34')][_0xe49c('0x40')]){_0x19acaf[_0xe49c('0x3f')]=_[_0xe49c('0x41')](_0x19acaf[_0xe49c('0x3f')],{'$or':_[_0xe49c('0x2e')](_0x19acaf[_0xe49c('0x38')],function(_0x2d5c91){var _0x76f940={};_0x76f940[_0x2d5c91]={'$like':'%'+_0x271c61[_0xe49c('0x34')][_0xe49c('0x40')]+'%'};return _0x76f940;})});}_0x19acaf=_[_0xe49c('0x41')]({},_0x19acaf,_0x271c61[_0xe49c('0x48')]);return _0x35c5af[_0xe49c('0x119')](_0x19acaf);}})['then'](function(_0x1bd815){if(_0x1bd815){_0x50df8a=_0x1bd815[_0xe49c('0x47')];if(!_0x271c61['query'][_0xe49c('0x3b')](_0xe49c('0x3c'))){_0x19acaf[_0xe49c('0x1f')]=qs['limit'](_0x271c61[_0xe49c('0x34')]['limit']);_0x19acaf[_0xe49c('0x1d')]=qs[_0xe49c('0x1d')](_0x271c61['query'][_0xe49c('0x1d')]);}return _0x35c5af[_0xe49c('0x119')](_0x19acaf);}})[_0xe49c('0x24')](function(_0x599c9c){if(_0x599c9c){return _0x599c9c?{'count':_0x50df8a,'rows':_0x599c9c}:null;}})[_0xe49c('0x24')](respondWithResult(_0x3d30b0,null))['catch'](handleError(_0x3d30b0,null));};exports['addProactiveActions']=function(_0x27d1cd,_0x31fd5e){return db['chatProactiveAction'][_0xe49c('0x49')]({'where':{'id':_0x27d1cd[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x31fd5e,null))[_0xe49c('0x24')](function(_0x17ff24){if(_0x17ff24){return _0x17ff24[_0xe49c('0x11a')](_0x27d1cd['body'][_0xe49c('0x5a')],_['omit'](_0x27d1cd[_0xe49c('0x4b')],[_0xe49c('0x5a'),'id'])||{});}})[_0xe49c('0x24')](respondWithResult(_0x31fd5e,null))[_0xe49c('0x18')](handleError(_0x31fd5e,null));};exports[_0xe49c('0xf8')]=function(_0x7cb665,_0xe3436e){var _0xf10535={};var _0x4db4c5={};var _0x159c71;var _0x12e926;return db['ChatWebsite'][_0xe49c('0x5d')]({'where':{'id':_0x7cb665[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0xe3436e,null))[_0xe49c('0x24')](function(_0x1c6c9d){if(_0x1c6c9d){_0x159c71=_0x1c6c9d;_0x4db4c5['model']=_[_0xe49c('0x35')](db[_0xe49c('0x11b')][_0xe49c('0x30')]);_0x4db4c5['query']=_[_0xe49c('0x35')](_0x7cb665[_0xe49c('0x34')]);_0x4db4c5['filters']=_[_0xe49c('0x39')](_0x4db4c5[_0xe49c('0x37')],_0x4db4c5[_0xe49c('0x34')]);_0xf10535['attributes']=_[_0xe49c('0x39')](_0x4db4c5[_0xe49c('0x37')],qs[_0xe49c('0x3a')](_0x7cb665[_0xe49c('0x34')][_0xe49c('0x3a')]));_0xf10535[_0xe49c('0x38')]=_0xf10535[_0xe49c('0x38')][_0xe49c('0x47')]?_0xf10535[_0xe49c('0x38')]:_0x4db4c5[_0xe49c('0x37')];_0xf10535[_0xe49c('0x3d')]=qs[_0xe49c('0x3e')](_0x7cb665['query'][_0xe49c('0x3e')]);_0xf10535[_0xe49c('0x3f')]=qs['filters'](_['pick'](_0x7cb665[_0xe49c('0x34')],_0x4db4c5['filters']));if(_0x7cb665['query'][_0xe49c('0x40')]){_0xf10535[_0xe49c('0x3f')]=_[_0xe49c('0x41')](_0xf10535[_0xe49c('0x3f')],{'$or':_[_0xe49c('0x2e')](_0xf10535[_0xe49c('0x38')],function(_0x391e87){var _0x48130e={};_0x48130e[_0x391e87]={'$like':'%'+_0x7cb665[_0xe49c('0x34')][_0xe49c('0x40')]+'%'};return _0x48130e;})});}_0xf10535=_[_0xe49c('0x41')]({},_0xf10535,_0x7cb665[_0xe49c('0x48')]);return _0x159c71['getProactiveActions'](_0xf10535);}})['then'](function(_0xb69b57){if(_0xb69b57){_0x12e926=_0xb69b57[_0xe49c('0x47')];if(!_0x7cb665['query']['hasOwnProperty'](_0xe49c('0x3c'))){_0xf10535[_0xe49c('0x1f')]=qs[_0xe49c('0x1f')](_0x7cb665[_0xe49c('0x34')]['limit']);_0xf10535[_0xe49c('0x1d')]=qs['offset'](_0x7cb665[_0xe49c('0x34')][_0xe49c('0x1d')]);}return _0x159c71[_0xe49c('0xf8')](_0xf10535);}})[_0xe49c('0x24')](function(_0x5bbf98){if(_0x5bbf98){return _0x5bbf98?{'count':_0x12e926,'rows':_0x5bbf98}:null;}})[_0xe49c('0x24')](respondWithResult(_0xe3436e,null))[_0xe49c('0x18')](handleError(_0xe3436e,null));};exports[_0xe49c('0x11c')]=function(_0x2a3d0b,_0x3ac575){var _0x895917=_0x2a3d0b[_0xe49c('0x34')]['online']===_0xe49c('0x11d')?_0xe49c('0x11e'):'onlineForm';return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'attributes':['id',_0x895917],'where':{'id':_0x2a3d0b[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x3ac575,null))[_0xe49c('0x24')](function(_0x37d0e1){if(_0x37d0e1){var _0x16484b=_0x37d0e1[_0x895917];var _0x53e4b3=_0x16484b&&_0x16484b['items']?_0x16484b[_0xe49c('0x11f')]:[];_0x3ac575[_0xe49c('0x2b')]({'fromKey':_[_0xe49c('0x6c')](_0x16484b['fromKey'])?undefined:_0x16484b[_0xe49c('0x120')],'count':_0x53e4b3[_0xe49c('0x47')],'rows':_0x53e4b3});}})[_0xe49c('0x18')](handleError(_0x3ac575,null));};exports[_0xe49c('0x121')]=function(_0x3c7f27,_0x2077c3){var _0x1eb64c={'raw':![],'where':{}};var _0x346aa0={};var _0x3a96ea={'count':0x0,'rows':[]};return db[_0xe49c('0x2f')][_0xe49c('0x5d')]({'where':{'id':_0x3c7f27[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x2077c3,null))[_0xe49c('0x24')](function(_0x21ec8f){if(_0x21ec8f){_0x346aa0[_0xe49c('0x37')]=_['keys'](db[_0xe49c('0xc8')][_0xe49c('0x30')]);_0x346aa0[_0xe49c('0x34')]=_[_0xe49c('0x35')](_0x3c7f27[_0xe49c('0x34')]);_0x346aa0[_0xe49c('0x36')]=_[_0xe49c('0x39')](_0x346aa0[_0xe49c('0x37')],_0x346aa0[_0xe49c('0x34')]);_0x1eb64c[_0xe49c('0x38')]=_[_0xe49c('0x39')](_0x346aa0[_0xe49c('0x37')],qs['fields'](_0x3c7f27[_0xe49c('0x34')][_0xe49c('0x3a')]));_0x1eb64c[_0xe49c('0x38')]=_0x1eb64c[_0xe49c('0x38')][_0xe49c('0x47')]?_0x1eb64c[_0xe49c('0x38')]:_0x346aa0[_0xe49c('0x37')];if(!_0x3c7f27[_0xe49c('0x34')][_0xe49c('0x3b')](_0xe49c('0x3c'))){_0x1eb64c[_0xe49c('0x1f')]=qs[_0xe49c('0x1f')](_0x3c7f27[_0xe49c('0x34')][_0xe49c('0x1f')]);_0x1eb64c[_0xe49c('0x1d')]=qs[_0xe49c('0x1d')](_0x3c7f27[_0xe49c('0x34')][_0xe49c('0x1d')]);}_0x1eb64c[_0xe49c('0x3d')]=qs[_0xe49c('0x3e')](_0x3c7f27[_0xe49c('0x34')][_0xe49c('0x3e')]);_0x1eb64c['where']=qs['filters'](_[_0xe49c('0x55')](_0x3c7f27['query'],_0x346aa0[_0xe49c('0x36')]));_0x1eb64c[_0xe49c('0x3f')][_0xe49c('0x56')]=_0x21ec8f['id'];if(_0x3c7f27[_0xe49c('0x34')][_0xe49c('0x40')]){_0x1eb64c['where']=_[_0xe49c('0x41')](_0x1eb64c[_0xe49c('0x3f')],{'$or':_[_0xe49c('0x2e')](_0x1eb64c['attributes'],function(_0x59b64b){var _0x5d0d80={};_0x5d0d80[_0x59b64b]={'$like':'%'+_0x3c7f27[_0xe49c('0x34')]['filter']+'%'};return _0x5d0d80;})});}_0x1eb64c=_[_0xe49c('0x41')]({},_0x1eb64c,_0x3c7f27['options']);return db[_0xe49c('0xc8')][_0xe49c('0x20')]({'where':_0x1eb64c[_0xe49c('0x3f')]})[_0xe49c('0x24')](function(_0x2593f9){_0x3a96ea[_0xe49c('0x20')]=_0x2593f9;if(_0x3c7f27[_0xe49c('0x34')][_0xe49c('0x57')]){_0x1eb64c[_0xe49c('0x58')]=[{'all':!![]}];}else{_0x1eb64c[_0xe49c('0x58')]=[{'model':db['CmContact'],'as':_0xe49c('0xe5'),'required':![]},{'model':db[_0xe49c('0x122')],'as':_0xe49c('0x123'),'required':![]}];}return db[_0xe49c('0xc8')][_0xe49c('0x42')](_0x1eb64c);})[_0xe49c('0x24')](function(_0x10205e){_0x3a96ea[_0xe49c('0x43')]=_0x10205e;return _0x3a96ea;});}})[_0xe49c('0x24')](respondWithFilteredResult(_0x2077c3,_0x1eb64c))[_0xe49c('0x18')](handleError(_0x2077c3,null));};exports['addAgents']=function(_0x4811d8,_0x1296ed){return db['ChatWebsite'][_0xe49c('0x49')]({'where':{'id':_0x4811d8[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x1296ed,null))['then'](function(_0x2b2ea6){if(_0x2b2ea6){return _0x2b2ea6[_0xe49c('0x124')](_0x4811d8[_0xe49c('0x4b')][_0xe49c('0x5a')],_[_0xe49c('0xe4')](_0x4811d8[_0xe49c('0x4b')],[_0xe49c('0x5a'),'id'])||{})[_0xe49c('0xab')](function(_0x35eb34){for(var _0xa5611a=0x0;_0xa5611a<_0x4811d8[_0xe49c('0x4b')][_0xe49c('0x5a')][_0xe49c('0x47')];_0xa5611a+=0x1){socket[_0xe49c('0x125')](_0xe49c('0x126'),{'UserId':Number(_0x4811d8[_0xe49c('0x4b')][_0xe49c('0x5a')][_0xa5611a]),'ChatWebsiteId':Number(_0x4811d8[_0xe49c('0x45')]['id'])});}return _0x35eb34;});}})[_0xe49c('0x24')](respondWithResult(_0x1296ed,null))[_0xe49c('0x18')](handleError(_0x1296ed,null));};exports['removeAgents']=function(_0x1cb864,_0x10b1e5){return db[_0xe49c('0x2f')][_0xe49c('0x49')]({'where':{'id':_0x1cb864[_0xe49c('0x45')]['id']}})['then'](handleEntityNotFound(_0x10b1e5,null))['then'](function(_0x121383){if(_0x121383){return _0x121383['removeAgents'](_0x1cb864[_0xe49c('0x34')][_0xe49c('0x5a')])['then'](function(){if(_[_0xe49c('0x127')](_0x1cb864[_0xe49c('0x34')][_0xe49c('0x5a')])){for(var _0x2383b5=0x0;_0x2383b5<_0x1cb864['query']['ids'][_0xe49c('0x47')];_0x2383b5+=0x1){socket[_0xe49c('0x125')]('userChatWebsite:remove',{'UserId':Number(_0x1cb864[_0xe49c('0x34')][_0xe49c('0x5a')][_0x2383b5]),'ChatWebsiteId':Number(_0x1cb864[_0xe49c('0x45')]['id'])});}}else{socket[_0xe49c('0x125')](_0xe49c('0x128'),{'UserId':Number(_0x1cb864[_0xe49c('0x34')]['ids']),'ChatWebsiteId':Number(_0x1cb864[_0xe49c('0x45')]['id'])});}});}})[_0xe49c('0x24')](respondWithStatusCode(_0x10b1e5,null))[_0xe49c('0x18')](handleError(_0x10b1e5,null));};exports[_0xe49c('0x129')]=function(_0x15d41f,_0x299855){var _0x358f5e={};var _0x359c93={};var _0x426eb6;var _0x57e61d;return db[_0xe49c('0x2f')][_0xe49c('0x5d')]({'where':{'id':_0x15d41f[_0xe49c('0x45')]['id']}})[_0xe49c('0x24')](handleEntityNotFound(_0x299855,null))[_0xe49c('0x24')](function(_0x5aa1ef){if(_0x5aa1ef){_0x426eb6=_0x5aa1ef;_0x359c93['model']=_[_0xe49c('0x35')](db[_0xe49c('0xe6')][_0xe49c('0x30')]);_0x359c93[_0xe49c('0x34')]=_[_0xe49c('0x35')](_0x15d41f[_0xe49c('0x34')]);_0x359c93['filters']=_[_0xe49c('0x39')](_0x359c93['model'],_0x359c93[_0xe49c('0x34')]);_0x358f5e[_0xe49c('0x38')]=_[_0xe49c('0x39')](_0x359c93[_0xe49c('0x37')],qs[_0xe49c('0x3a')](_0x15d41f[_0xe49c('0x34')][_0xe49c('0x3a')]));_0x358f5e[_0xe49c('0x38')]=_0x358f5e[_0xe49c('0x38')][_0xe49c('0x47')]?_0x358f5e[_0xe49c('0x38')]:_0x359c93[_0xe49c('0x37')];_0x358f5e[_0xe49c('0x3d')]=qs[_0xe49c('0x3e')](_0x15d41f[_0xe49c('0x34')]['sort']);_0x358f5e[_0xe49c('0x3f')]=qs[_0xe49c('0x36')](_['pick'](_0x15d41f[_0xe49c('0x34')],_0x359c93['filters']));if(_0x15d41f[_0xe49c('0x34')][_0xe49c('0x40')]){_0x358f5e[_0xe49c('0x3f')]=_['merge'](_0x358f5e['where'],{'$or':_[_0xe49c('0x2e')](_0x358f5e[_0xe49c('0x38')],function(_0x39e475){var _0x36f194={};_0x36f194[_0x39e475]={'$like':'%'+_0x15d41f['query']['filter']+'%'};return _0x36f194;})});}_0x358f5e=_[_0xe49c('0x41')]({},_0x358f5e,_0x15d41f['options']);return _0x426eb6[_0xe49c('0x129')](_0x358f5e);}})[_0xe49c('0x24')](function(_0x52f025){if(_0x52f025){_0x57e61d=_0x52f025['length'];if(!_0x15d41f[_0xe49c('0x34')]['hasOwnProperty'](_0xe49c('0x3c'))){_0x358f5e['limit']=qs[_0xe49c('0x1f')](_0x15d41f[_0xe49c('0x34')][_0xe49c('0x1f')]);_0x358f5e[_0xe49c('0x1d')]=qs[_0xe49c('0x1d')](_0x15d41f[_0xe49c('0x34')]['offset']);}return _0x426eb6['getAgents'](_0x358f5e);}})[_0xe49c('0x24')](function(_0x31ed07){if(_0x31ed07){return _0x31ed07?{'count':_0x57e61d,'rows':_0x31ed07}:null;}})[_0xe49c('0x24')](respondWithResult(_0x299855,null))[_0xe49c('0x18')](handleError(_0x299855,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index d6d1dcb..7121e9a 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 _0xa9b1=['exports','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x1a9b('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1a9b('0x1')](0x0);var events={'afterCreate':_0x1a9b('0x2'),'afterUpdate':_0x1a9b('0x3'),'afterDestroy':_0x1a9b('0x4')};function emitEvent(_0x10c90c){return function(_0x52f55f,_0x57b453,_0x4914cd){ChatWebsiteEvents[_0x1a9b('0x5')](_0x10c90c+':'+_0x52f55f['id'],_0x52f55f);ChatWebsiteEvents[_0x1a9b('0x5')](_0x10c90c,_0x52f55f);_0x4914cd(null);};}for(var e in events){if(events[_0x1a9b('0x6')](e)){var event=events[e];ChatWebsite[_0x1a9b('0x7')](e,emitEvent(event));}}module[_0x1a9b('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xae1c=['hasOwnProperty','hook','exports','save','update','remove','emit'];(function(_0xec9c4e,_0x1f3b34){var _0x49cf7b=function(_0x34c86d){while(--_0x34c86d){_0xec9c4e['push'](_0xec9c4e['shift']());}};_0x49cf7b(++_0x1f3b34);}(_0xae1c,0xff));var _0xcae1=function(_0x31b1ab,_0x384147){_0x31b1ab=_0x31b1ab-0x0;var _0x58ed0a=_0xae1c[_0x31b1ab];return _0x58ed0a;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcae1('0x0'),'afterUpdate':_0xcae1('0x1'),'afterDestroy':_0xcae1('0x2')};function emitEvent(_0x32bfaa){return function(_0x1d37db,_0x2b6b57,_0x3d11cb){ChatWebsiteEvents[_0xcae1('0x3')](_0x32bfaa+':'+_0x1d37db['id'],_0x1d37db);ChatWebsiteEvents[_0xcae1('0x3')](_0x32bfaa,_0x1d37db);_0x3d11cb(null);};}for(var e in events){if(events[_0xcae1('0x4')](e)){var event=events[e];ChatWebsite[_0xcae1('0x5')](e,emitEvent(event));}}module[_0xcae1('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 843a767..f9ec6f8 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 _0x8704=['rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird'];(function(_0x58ce43,_0x4b7288){var _0x1351cd=function(_0x1664fd){while(--_0x1664fd){_0x58ce43['push'](_0x58ce43['shift']());}};_0x1351cd(++_0x4b7288);}(_0x8704,0x1ea));var _0x4870=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x8704[_0x15876a];return _0xbd900f;};'use strict';var _=require(_0x4870('0x0'));var util=require('util');var logger=require(_0x4870('0x1'))(_0x4870('0x2'));var moment=require(_0x4870('0x3'));var BPromise=require(_0x4870('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4870('0x5'));var config=require(_0x4870('0x6'));var attributes=require('./chatWebsite.attributes');module[_0x4870('0x7')]=function(_0x44e866,_0x1dd9e3){return _0x44e866[_0x4870('0x8')](_0x4870('0x9'),attributes,{'tableName':_0x4870('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8adf=['define','lodash','util','../../config/logger','api','moment','path','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x2b4863,_0x25df31){var _0x49ab47=function(_0x8eea98){while(--_0x8eea98){_0x2b4863['push'](_0x2b4863['shift']());}};_0x49ab47(++_0x25df31);}(_0x8adf,0x1af));var _0xf8ad=function(_0xb47687,_0x4419f1){_0xb47687=_0xb47687-0x0;var _0x3c8516=_0x8adf[_0xb47687];return _0x3c8516;};'use strict';var _=require(_0xf8ad('0x0'));var util=require(_0xf8ad('0x1'));var logger=require(_0xf8ad('0x2'))(_0xf8ad('0x3'));var moment=require(_0xf8ad('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8ad('0x5'));var rimraf=require('rimraf');var config=require(_0xf8ad('0x6'));var attributes=require(_0xf8ad('0x7'));module[_0xf8ad('0x8')]=function(_0x4a1820,_0x2a6ec8){return _0x4a1820[_0xf8ad('0x9')]('ChatWebsite',attributes,{'tableName':'chat_websites','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 cffcbe4..af474ba 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 _0xf2c3=['ChatWebsite,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0xe3cdba,_0x3b92d0){var _0x3afefa=function(_0x1d9662){while(--_0x1d9662){_0xe3cdba['push'](_0xe3cdba['shift']());}};_0x3afefa(++_0x3b92d0);}(_0xf2c3,0x6c));var _0x3f2c=function(_0x15781b,_0x4db9bb){_0x15781b=_0x15781b-0x0;var _0x20f955=_0xf2c3[_0x15781b];return _0x20f955;};'use strict';var _=require('lodash');var util=require(_0x3f2c('0x0'));var moment=require(_0x3f2c('0x1'));var BPromise=require(_0x3f2c('0x2'));var rs=require(_0x3f2c('0x3'));var fs=require('fs');var Redis=require(_0x3f2c('0x4'));var db=require(_0x3f2c('0x5'))['db'];var utils=require(_0x3f2c('0x6'));var logger=require(_0x3f2c('0x7'))(_0x3f2c('0x8'));var config=require(_0x3f2c('0x9'));var jayson=require(_0x3f2c('0xa'));var client=jayson[_0x3f2c('0xb')][_0x3f2c('0xc')]({'port':0x232a});config[_0x3f2c('0xd')]=_['defaults'](config[_0x3f2c('0xd')],{'host':_0x3f2c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f2c('0xf'))['register'](socket);function respondWithRpcPromise(_0x5088f1,_0x14c818,_0x1874b2){return new BPromise(function(_0x50ff46,_0x1e433a){return client[_0x3f2c('0x10')](_0x5088f1,_0x1874b2)['then'](function(_0x23ef11){logger[_0x3f2c('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x14c818,'request\x20sent');logger['debug'](_0x3f2c('0x12'),_0x14c818,_0x3f2c('0x13'),JSON['stringify'](_0x23ef11));if(_0x23ef11[_0x3f2c('0x14')]){if(_0x23ef11[_0x3f2c('0x14')][_0x3f2c('0x15')]===0x1f4){logger[_0x3f2c('0x14')](_0x3f2c('0x16'),_0x14c818,_0x23ef11[_0x3f2c('0x14')][_0x3f2c('0x17')]);return _0x1e433a(_0x23ef11[_0x3f2c('0x14')][_0x3f2c('0x17')]);}logger[_0x3f2c('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x14c818,_0x23ef11['error'][_0x3f2c('0x17')]);return _0x50ff46(_0x23ef11['error']['message']);}else{logger[_0x3f2c('0x11')](_0x3f2c('0x16'),_0x14c818,'request\x20sent');_0x50ff46(_0x23ef11[_0x3f2c('0x18')]['message']);}})[_0x3f2c('0x19')](function(_0x3ab112){logger[_0x3f2c('0x14')](_0x3f2c('0x16'),_0x14c818,_0x3ab112);_0x1e433a(_0x3ab112);});});} \ No newline at end of file +var _0x1c77=['rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x204b3b,_0x90528c){var _0x212141=function(_0x2aa809){while(--_0x2aa809){_0x204b3b['push'](_0x204b3b['shift']());}};_0x212141(++_0x90528c);}(_0x1c77,0x164));var _0x71c7=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x1c77[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x71c7('0x0'));var util=require(_0x71c7('0x1'));var moment=require(_0x71c7('0x2'));var BPromise=require(_0x71c7('0x3'));var rs=require(_0x71c7('0x4'));var fs=require('fs');var Redis=require(_0x71c7('0x5'));var db=require(_0x71c7('0x6'))['db'];var utils=require(_0x71c7('0x7'));var logger=require('../../config/logger')(_0x71c7('0x8'));var config=require(_0x71c7('0x9'));var jayson=require(_0x71c7('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x71c7('0xb')](config['redis'],{'host':_0x71c7('0xc'),'port':0x18eb});var socket=require(_0x71c7('0xd'))(new Redis(config[_0x71c7('0xe')]));require('./chatWebsite.socket')[_0x71c7('0xf')](socket);function respondWithRpcPromise(_0x1951e9,_0x1a6e36,_0x5b8ee5){return new BPromise(function(_0x3ad3e8,_0x2aeb6d){return client[_0x71c7('0x10')](_0x1951e9,_0x5b8ee5)[_0x71c7('0x11')](function(_0x4d5746){logger[_0x71c7('0x12')](_0x71c7('0x13'),_0x1a6e36,'request\x20sent');logger[_0x71c7('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1a6e36,_0x71c7('0x15'),JSON[_0x71c7('0x16')](_0x4d5746));if(_0x4d5746[_0x71c7('0x17')]){if(_0x4d5746[_0x71c7('0x17')][_0x71c7('0x18')]===0x1f4){logger[_0x71c7('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1a6e36,_0x4d5746[_0x71c7('0x17')][_0x71c7('0x19')]);return _0x2aeb6d(_0x4d5746[_0x71c7('0x17')][_0x71c7('0x19')]);}logger['error'](_0x71c7('0x13'),_0x1a6e36,_0x4d5746[_0x71c7('0x17')]['message']);return _0x3ad3e8(_0x4d5746[_0x71c7('0x17')]['message']);}else{logger['info'](_0x71c7('0x13'),_0x1a6e36,'request\x20sent');_0x3ad3e8(_0x4d5746[_0x71c7('0x1a')][_0x71c7('0x19')]);}})[_0x71c7('0x1b')](function(_0x479d55){logger[_0x71c7('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1a6e36,_0x479d55);_0x2aeb6d(_0x479d55);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 49209bc..b9dfbfe 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 _0xa7e8=['save','remove','update','emit','removeListener','length','./chatWebsite.events'];(function(_0x44591b,_0x148970){var _0xbb9e05=function(_0x1d37eb){while(--_0x1d37eb){_0x44591b['push'](_0x44591b['shift']());}};_0xbb9e05(++_0x148970);}(_0xa7e8,0xb5));var _0x8a7e=function(_0x2259d8,_0x47c9a1){_0x2259d8=_0x2259d8-0x0;var _0x291060=_0xa7e8[_0x2259d8];return _0x291060;};'use strict';var ChatWebsiteEvents=require(_0x8a7e('0x0'));var events=[_0x8a7e('0x1'),_0x8a7e('0x2'),_0x8a7e('0x3')];function createListener(_0x439c55,_0x445f83){return function(_0x39e35a){_0x445f83[_0x8a7e('0x4')](_0x439c55,_0x39e35a);};}function removeListener(_0x23ecc4,_0x26f80d){return function(){ChatWebsiteEvents[_0x8a7e('0x5')](_0x23ecc4,_0x26f80d);};}exports['register']=function(_0x44872a){for(var _0x36e5be=0x0,_0x1860e6=events[_0x8a7e('0x6')];_0x36e5be<_0x1860e6;_0x36e5be++){var _0x1f7a52=events[_0x36e5be];var _0x4a5199=createListener('chatWebsite:'+_0x1f7a52,_0x44872a);ChatWebsiteEvents['on'](_0x1f7a52,_0x4a5199);}}; \ No newline at end of file +var _0xca19=['removeListener','register','save','remove','emit'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0xca19,0x10b));var _0x9ca1=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xca19[_0x1b7368];return _0x25d54c;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x9ca1('0x0'),_0x9ca1('0x1'),'update'];function createListener(_0x3b5d00,_0x21df07){return function(_0x4b2036){_0x21df07[_0x9ca1('0x2')](_0x3b5d00,_0x4b2036);};}function removeListener(_0x3a17ef,_0x451e21){return function(){ChatWebsiteEvents[_0x9ca1('0x3')](_0x3a17ef,_0x451e21);};}exports[_0x9ca1('0x4')]=function(_0x46949c){for(var _0x49e6cd=0x0,_0x5b373e=events['length'];_0x49e6cd<_0x5b373e;_0x49e6cd++){var _0x1f6842=events[_0x49e6cd];var _0x5f1e9=createListener('chatWebsite:'+_0x1f6842,_0x46949c);ChatWebsiteEvents['on'](_0x1f6842,_0x5f1e9);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 72c4455..6b1f5ca 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 _0x2b19=['root','%s-%s','now','file','addLogo','join','server/files/images/avatars/','originalname','/:id/avatar','single','addAvatar','format','/:id/system_avatar','addSystemAvatar','notify','server/files','attachments','offline-chat','replace','/:id/offline','offline','addInteraction','addApplications','addAgents','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage'];(function(_0x29bd19,_0x43928d){var _0x9551bf=function(_0x2c14a7){while(--_0x2c14a7){_0x29bd19['push'](_0x29bd19['shift']());}};_0x9551bf(++_0x43928d);}(_0x2b19,0x132));var _0x92b1=function(_0x145075,_0x202545){_0x145075=_0x145075-0x0;var _0x34bbd0=_0x2b19[_0x145075];return _0x34bbd0;};'use strict';var multer=require(_0x92b1('0x0'));var util=require(_0x92b1('0x1'));var path=require(_0x92b1('0x2'));var timeout=require(_0x92b1('0x3'));var express=require('express');var router=express[_0x92b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x92b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x92b1('0x6'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x92b1('0x7')](),controller['index']);router[_0x92b1('0x8')](_0x92b1('0x9'),auth['isAuthenticated'](),controller[_0x92b1('0xa')]);router[_0x92b1('0x8')](_0x92b1('0xb'),auth[_0x92b1('0x7')](),controller[_0x92b1('0xc')]);router['get'](_0x92b1('0xd'),auth[_0x92b1('0x7')](),controller[_0x92b1('0xe')]);router[_0x92b1('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x92b1('0xf')]);router[_0x92b1('0x8')](_0x92b1('0x10'),controller[_0x92b1('0x11')]);router[_0x92b1('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x92b1('0x8')](_0x92b1('0x12'),controller[_0x92b1('0x13')]);router[_0x92b1('0x8')]('/:id/system_avatar',controller[_0x92b1('0x14')]);router[_0x92b1('0x8')](_0x92b1('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x92b1('0x16'),controller[_0x92b1('0x17')]);router[_0x92b1('0x8')](_0x92b1('0x18'),auth[_0x92b1('0x7')](),controller['getApplications']);router[_0x92b1('0x8')](_0x92b1('0x19'),auth['isAuthenticated'](),controller[_0x92b1('0x1a')]);router[_0x92b1('0x8')](_0x92b1('0x1b'),controller[_0x92b1('0x1c')]);router['get'](_0x92b1('0x1d'),auth[_0x92b1('0x7')](),controller[_0x92b1('0x1e')]);router['get'](_0x92b1('0x1f'),auth[_0x92b1('0x7')](),controller[_0x92b1('0x20')]);router[_0x92b1('0x21')]('/',auth[_0x92b1('0x7')](),controller[_0x92b1('0x22')]);router[_0x92b1('0x21')](_0x92b1('0xd'),auth['isAuthenticated'](),controller[_0x92b1('0x23')]);router[_0x92b1('0x21')](_0x92b1('0x24'),auth[_0x92b1('0x7')](),controller[_0x92b1('0x25')]);var upload=multer({'storage':multer[_0x92b1('0x26')]({'destination':function(_0x1cc6e5,_0x1ee6f0,_0xa4dc80){_0xa4dc80(null,path['join'](config[_0x92b1('0x27')],'server/files/images/logos/'));},'filename':function(_0x300666,_0x5a5204,_0x548e8d){_0x548e8d(null,util['format'](_0x92b1('0x28'),Date[_0x92b1('0x29')](),_0x5a5204['originalname']));}})});router[_0x92b1('0x21')](_0x92b1('0x10'),upload['single'](_0x92b1('0x2a')),controller[_0x92b1('0x2b')]);var upload=multer({'storage':multer[_0x92b1('0x26')]({'destination':function(_0x1f9a0d,_0x18406b,_0xe871ac){_0xe871ac(null,path[_0x92b1('0x2c')](config['root'],_0x92b1('0x2d')));},'filename':function(_0x5247a9,_0x22a01e,_0x94c551){_0x94c551(null,util['format'](_0x92b1('0x28'),Date[_0x92b1('0x29')](),_0x22a01e[_0x92b1('0x2e')]));}})});router[_0x92b1('0x21')](_0x92b1('0x2f'),upload[_0x92b1('0x30')](_0x92b1('0x2a')),controller[_0x92b1('0x31')]);var upload=multer({'storage':multer[_0x92b1('0x26')]({'destination':function(_0x4ba860,_0x6c50bb,_0x235694){_0x235694(null,path['join'](config['root'],_0x92b1('0x2d')));},'filename':function(_0x43207a,_0xf37e9,_0x223f26){_0x223f26(null,util[_0x92b1('0x32')](_0x92b1('0x28'),Date['now'](),_0xf37e9[_0x92b1('0x2e')]));}})});router[_0x92b1('0x21')](_0x92b1('0x12'),upload[_0x92b1('0x30')](_0x92b1('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x92b1('0x26')]({'destination':function(_0x196837,_0x15e2d0,_0x33507b){_0x33507b(null,path[_0x92b1('0x2c')](config[_0x92b1('0x27')],_0x92b1('0x2d')));},'filename':function(_0x289ef1,_0x215e4f,_0x41a22e){_0x41a22e(null,util[_0x92b1('0x32')](_0x92b1('0x28'),Date[_0x92b1('0x29')](),_0x215e4f['originalname']));}})});router[_0x92b1('0x21')](_0x92b1('0x33'),upload[_0x92b1('0x30')](_0x92b1('0x2a')),controller[_0x92b1('0x34')]);router[_0x92b1('0x21')]('/:id/notify',controller[_0x92b1('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2c34c3,_0x530e98,_0x5418f1){const _0x5d4619=path[_0x92b1('0x2c')](config['root'],_0x92b1('0x36'),_0x92b1('0x37'),_0x92b1('0x38'));fs_extra['ensureDir'](_0x5d4619,function(){_0x5418f1(null,_0x5d4619);});},'filename':function(_0x2298f8,_0xbdd047,_0x282509){const _0x37fb5d=_0xbdd047[_0x92b1('0x2e')][_0x92b1('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5c3523=path['extname'](_0x37fb5d);const _0x9975d5=Date['now']()+'-'+_0x37fb5d[_0x92b1('0x39')](_0x5c3523,'')+_0x5c3523;_0x282509(null,_0x9975d5);}})});router[_0x92b1('0x21')](_0x92b1('0x3a'),offlineUploadMulter['any'](),controller[_0x92b1('0x3b')]);router[_0x92b1('0x21')]('/:id/interactions',auth[_0x92b1('0x7')](),controller[_0x92b1('0x3c')]);router[_0x92b1('0x21')](_0x92b1('0x18'),auth[_0x92b1('0x7')](),controller[_0x92b1('0x3d')]);router['post'](_0x92b1('0x19'),auth[_0x92b1('0x7')](),controller['addProactiveActions']);router[_0x92b1('0x21')]('/:id/users',auth['isAuthenticated'](),controller[_0x92b1('0x3e')]);router['put'](_0x92b1('0xb'),auth[_0x92b1('0x7')](),controller['update']);router[_0x92b1('0x3f')](_0x92b1('0xb'),auth[_0x92b1('0x7')](),controller[_0x92b1('0x40')]);router[_0x92b1('0x3f')](_0x92b1('0xd'),auth[_0x92b1('0x7')](),controller[_0x92b1('0x41')]);router[_0x92b1('0x3f')](_0x92b1('0x24'),auth[_0x92b1('0x7')](),controller[_0x92b1('0x42')]);router[_0x92b1('0x3f')](_0x92b1('0x1f'),auth['isAuthenticated'](),controller[_0x92b1('0x43')]);module[_0x92b1('0x44')]=router; \ No newline at end of file +var _0xb2b4=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','%s-%s','now','originalname','single','file','addLogo','join','root','server/files/images/avatars/','format','/:id/avatar','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','any','offline','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util'];(function(_0x4d0681,_0x3a594a){var _0x1cf1a3=function(_0x5a782e){while(--_0x5a782e){_0x4d0681['push'](_0x4d0681['shift']());}};_0x1cf1a3(++_0x3a594a);}(_0xb2b4,0x126));var _0x4b2b=function(_0x4fbaf9,_0x3b8190){_0x4fbaf9=_0x4fbaf9-0x0;var _0x1d89a0=_0xb2b4[_0x4fbaf9];return _0x1d89a0;};'use strict';var multer=require(_0x4b2b('0x0'));var util=require(_0x4b2b('0x1'));var path=require(_0x4b2b('0x2'));var timeout=require(_0x4b2b('0x3'));var express=require(_0x4b2b('0x4'));var router=express[_0x4b2b('0x5')]();var fs_extra=require(_0x4b2b('0x6'));var auth=require(_0x4b2b('0x7'));var interaction=require(_0x4b2b('0x8'));var config=require(_0x4b2b('0x9'));var controller=require(_0x4b2b('0xa'));router[_0x4b2b('0xb')]('/',auth[_0x4b2b('0xc')](),controller[_0x4b2b('0xd')]);router['get'](_0x4b2b('0xe'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0xf')]);router[_0x4b2b('0xb')](_0x4b2b('0x10'),auth[_0x4b2b('0xc')](),controller['show']);router[_0x4b2b('0xb')](_0x4b2b('0x11'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x12')]);router[_0x4b2b('0xb')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4b2b('0x13')]);router['get'](_0x4b2b('0x14'),controller[_0x4b2b('0x15')]);router[_0x4b2b('0xb')]('/:id/avatar',controller[_0x4b2b('0x16')]);router[_0x4b2b('0xb')]('/:id/customer_avatar',controller[_0x4b2b('0x17')]);router[_0x4b2b('0xb')](_0x4b2b('0x18'),controller[_0x4b2b('0x19')]);router[_0x4b2b('0xb')](_0x4b2b('0x1a'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x1b')]);router[_0x4b2b('0xb')]('/:id/snippet',controller[_0x4b2b('0x1c')]);router[_0x4b2b('0xb')](_0x4b2b('0x1d'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x1e')]);router['get'](_0x4b2b('0x1f'),auth[_0x4b2b('0xc')](),controller['getProactiveActions']);router['get'](_0x4b2b('0x20'),controller['getFields']);router[_0x4b2b('0xb')]('/:id/offline_messages',auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x21')]);router[_0x4b2b('0xb')](_0x4b2b('0x22'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x23')]);router[_0x4b2b('0x24')]('/',auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x25')]);router[_0x4b2b('0x24')](_0x4b2b('0x11'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x26')]);router[_0x4b2b('0x24')](_0x4b2b('0x27'),auth['isAuthenticated'](),controller[_0x4b2b('0x28')]);var upload=multer({'storage':multer[_0x4b2b('0x29')]({'destination':function(_0x55ea0f,_0x2d7403,_0x527268){_0x527268(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x276d21,_0x4d5291,_0x1d926b){_0x1d926b(null,util['format'](_0x4b2b('0x2a'),Date[_0x4b2b('0x2b')](),_0x4d5291[_0x4b2b('0x2c')]));}})});router['post'](_0x4b2b('0x14'),upload[_0x4b2b('0x2d')](_0x4b2b('0x2e')),controller[_0x4b2b('0x2f')]);var upload=multer({'storage':multer[_0x4b2b('0x29')]({'destination':function(_0x3e2e39,_0xb3a58c,_0x26b5a0){_0x26b5a0(null,path[_0x4b2b('0x30')](config[_0x4b2b('0x31')],_0x4b2b('0x32')));},'filename':function(_0x4ebdca,_0x4bb423,_0x3c8fff){_0x3c8fff(null,util[_0x4b2b('0x33')](_0x4b2b('0x2a'),Date['now'](),_0x4bb423[_0x4b2b('0x2c')]));}})});router[_0x4b2b('0x24')](_0x4b2b('0x34'),upload[_0x4b2b('0x2d')](_0x4b2b('0x2e')),controller[_0x4b2b('0x35')]);var upload=multer({'storage':multer[_0x4b2b('0x29')]({'destination':function(_0x1faf0c,_0x37ecac,_0x1bd053){_0x1bd053(null,path[_0x4b2b('0x30')](config['root'],_0x4b2b('0x32')));},'filename':function(_0x17cf6b,_0x12c9a6,_0x2868bd){_0x2868bd(null,util[_0x4b2b('0x33')](_0x4b2b('0x2a'),Date[_0x4b2b('0x2b')](),_0x12c9a6[_0x4b2b('0x2c')]));}})});router[_0x4b2b('0x24')](_0x4b2b('0x36'),upload[_0x4b2b('0x2d')](_0x4b2b('0x2e')),controller[_0x4b2b('0x37')]);var upload=multer({'storage':multer[_0x4b2b('0x29')]({'destination':function(_0xc768ca,_0x33b6a1,_0x5b4a00){_0x5b4a00(null,path['join'](config[_0x4b2b('0x31')],_0x4b2b('0x32')));},'filename':function(_0x14a474,_0x1fe039,_0x583786){_0x583786(null,util[_0x4b2b('0x33')](_0x4b2b('0x2a'),Date['now'](),_0x1fe039[_0x4b2b('0x2c')]));}})});router[_0x4b2b('0x24')](_0x4b2b('0x18'),upload['single']('file'),controller[_0x4b2b('0x38')]);router[_0x4b2b('0x24')](_0x4b2b('0x39'),controller[_0x4b2b('0x3a')]);const offlineUploadMulter=multer({'storage':multer[_0x4b2b('0x29')]({'destination':function(_0x1120a1,_0x141f39,_0x58a6fb){const _0x13301d=path['join'](config[_0x4b2b('0x31')],_0x4b2b('0x3b'),_0x4b2b('0x3c'),_0x4b2b('0x3d'));fs_extra['ensureDir'](_0x13301d,function(){_0x58a6fb(null,_0x13301d);});},'filename':function(_0x2abb7a,_0x273818,_0x19a878){const _0x46c0f7=_0x273818[_0x4b2b('0x2c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x41a6a4=path['extname'](_0x46c0f7);const _0x12155a=Date['now']()+'-'+_0x46c0f7[_0x4b2b('0x3e')](_0x41a6a4,'')+_0x41a6a4;_0x19a878(null,_0x12155a);}})});router[_0x4b2b('0x24')]('/:id/offline',offlineUploadMulter[_0x4b2b('0x3f')](),controller[_0x4b2b('0x40')]);router[_0x4b2b('0x24')](_0x4b2b('0x1a'),auth[_0x4b2b('0xc')](),controller['addInteraction']);router[_0x4b2b('0x24')](_0x4b2b('0x1d'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x41')]);router[_0x4b2b('0x24')](_0x4b2b('0x1f'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x42')]);router[_0x4b2b('0x24')](_0x4b2b('0x22'),auth['isAuthenticated'](),controller[_0x4b2b('0x43')]);router['put'](_0x4b2b('0x10'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x44')]);router[_0x4b2b('0x45')](_0x4b2b('0x10'),auth[_0x4b2b('0xc')](),controller[_0x4b2b('0x46')]);router[_0x4b2b('0x45')](_0x4b2b('0x11'),auth['isAuthenticated'](),controller[_0x4b2b('0x47')]);router[_0x4b2b('0x45')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4b2b('0x48')]);router['delete'](_0x4b2b('0x22'),auth['isAuthenticated'](),controller[_0x4b2b('0x49')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 39c8489..90af52d 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 _0x010d=['isAuthenticated','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x3c61c5,_0x425714){var _0x36ee96=function(_0x549335){while(--_0x549335){_0x3c61c5['push'](_0x3c61c5['shift']());}};_0x36ee96(++_0x425714);}(_0x010d,0x1ef));var _0xd010=function(_0x3a924a,_0x5b8ed3){_0x3a924a=_0x3a924a-0x0;var _0x144b03=_0x010d[_0x3a924a];return _0x144b03;};var beaverLogger=require(_0xd010('0x0'));var express=require(_0xd010('0x1'));var auth=require(_0xd010('0x2'));var config=require(_0xd010('0x3'));var router=express[_0xd010('0x4')]();var isProduction=config[_0xd010('0x5')]==='production'||![];function clientSideLogs(_0x50f5a4,_0x4e7a33,_0x465082){var _0x51afb7=_0x50f5a4[_0xd010('0x6')][_0xd010('0x7')](_0xd010('0x8'));if(!_0x51afb7){throw new Error(_0xd010('0x9'));}return beaverLogger[_0xd010('0xa')]({'uri':_0xd010('0xb'),'logger':_0x51afb7,'enableCors':!isProduction})(_0x50f5a4,_0x4e7a33,_0x465082);}router['use'](auth[_0xd010('0xc')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xd7c8=['Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','express','../config/environment'];(function(_0x7aaac8,_0x3a4233){var _0x4a8013=function(_0x45cf4e){while(--_0x45cf4e){_0x7aaac8['push'](_0x7aaac8['shift']());}};_0x4a8013(++_0x3a4233);}(_0xd7c8,0xc1));var _0x8d7c=function(_0x66190f,_0x5ce078){_0x66190f=_0x66190f-0x0;var _0x4cd1d7=_0xd7c8[_0x66190f];return _0x4cd1d7;};var beaverLogger=require('beaver-logger/server');var express=require(_0x8d7c('0x0'));var auth=require('../components/auth/service');var config=require(_0x8d7c('0x1'));var router=express[_0x8d7c('0x2')]();var isProduction=config[_0x8d7c('0x3')]===_0x8d7c('0x4')||![];function clientSideLogs(_0x1973ef,_0x5d85fb,_0x173b98){var _0x20df24=_0x1973ef[_0x8d7c('0x5')][_0x8d7c('0x6')](_0x8d7c('0x7'));if(!_0x20df24){throw new Error(_0x8d7c('0x8'));}return beaverLogger[_0x8d7c('0x9')]({'uri':'/client-logs','logger':_0x20df24,'enableCors':!isProduction})(_0x1973ef,_0x5d85fb,_0x173b98);}router[_0x8d7c('0xa')](auth[_0x8d7c('0xb')](),clientSideLogs);module[_0x8d7c('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f34f841..f29db23 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 _0x7f2b=['Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f2b,0x1f4));var _0xb7f2=function(_0x4ad683,_0x5d2b9b){_0x4ad683=_0x4ad683-0x0;var _0x297ec9=_0x7f2b[_0x4ad683];return _0x297ec9;};'use strict';var Sequelize=require(_0xb7f2('0x0'));module[_0xb7f2('0x1')]={'name':{'type':Sequelize[_0xb7f2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb7f2('0x3')](_0xb7f2('0x4'),_0xb7f2('0x5'),_0xb7f2('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xb7f2('0x3')](_0xb7f2('0x7'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0xb7f2('0x8')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0xb7f2('0x9')},'data4':{'type':Sequelize[_0xb7f2('0x2')],'comment':_0xb7f2('0xa')},'data5':{'type':Sequelize[_0xb7f2('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xb7f2('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xb7f2('0xb')],'comment':_0xb7f2('0xc')}}; \ No newline at end of file +var _0xb19e=['sequelize','STRING','AmazonAWS','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x3659b5,_0xec8922){var _0x4d8d40=function(_0x33c120){while(--_0x33c120){_0x3659b5['push'](_0x3659b5['shift']());}};_0x4d8d40(++_0xec8922);}(_0xb19e,0x7e));var _0xeb19=function(_0x555069,_0x23d66a){_0x555069=_0x555069-0x0;var _0x100af7=_0xb19e[_0x555069];return _0x100af7;};'use strict';var Sequelize=require(_0xeb19('0x0'));module['exports']={'name':{'type':Sequelize[_0xeb19('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xeb19('0x2'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xeb19('0x3')](_0xeb19('0x4'),_0xeb19('0x5'))},'data1':{'type':Sequelize[_0xeb19('0x1')],'comment':_0xeb19('0x6')},'data2':{'type':Sequelize[_0xeb19('0x1')],'comment':_0xeb19('0x7')},'data3':{'type':Sequelize[_0xeb19('0x1')],'comment':_0xeb19('0x8')},'data4':{'type':Sequelize[_0xeb19('0x1')],'comment':_0xeb19('0x9')},'data5':{'type':Sequelize[_0xeb19('0xa')],'comment':_0xeb19('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0xeb19('0xc')},'data7':{'type':Sequelize['TEXT'],'comment':_0xeb19('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 5097bc9..2aa5cae 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 _0x6245=['lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','socket.io-emitter','sendStatus','status','end','json','undefined','count','limit','Content-Range','update','then','destroy','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','service','MicrosoftAzure','decryptString','data3','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','catch','find','params','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','parse','state','base64','toString','ascii','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','microsoftAuthorization:error','stringify'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x6245,0x164));var _0x5624=function(_0x3b2e0a,_0x49a3f9){_0x3b2e0a=_0x3b2e0a-0x0;var _0x4a84bd=_0x6245[_0x3b2e0a];return _0x4a84bd;};'use strict';var _=require(_0x5624('0x0'));var Redis=require(_0x5624('0x1'));var qs=require(_0x5624('0x2'));var encryptor=require(_0x5624('0x3'));var config=require(_0x5624('0x4'));var logger=require(_0x5624('0x5'))(_0x5624('0x6'));var db=require(_0x5624('0x7'))['db'];var oauth=require(_0x5624('0x8'));config[_0x5624('0x9')]=_['defaults'](config[_0x5624('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5624('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x5624('0x9')]);function respondWithStatusCode(_0x4b32e3,_0x1d5a46){_0x1d5a46=_0x1d5a46||0xcc;return function(_0x507e20){if(_0x507e20){return _0x4b32e3[_0x5624('0xb')](_0x1d5a46);}return _0x4b32e3[_0x5624('0xc')](_0x1d5a46)[_0x5624('0xd')]();};}function respondWithResult(_0x25722e,_0x20eae9){_0x20eae9=_0x20eae9||0xc8;return function(_0x110704){if(_0x110704){return _0x25722e[_0x5624('0xc')](_0x20eae9)[_0x5624('0xe')](_0x110704);}};}function respondWithFilteredResult(_0x2241a1,_0x12e597){return function(_0x4f373f){if(_0x4f373f){var _0x1c6454=typeof _0x12e597['offset']===_0x5624('0xf')&&typeof _0x12e597['limit']===_0x5624('0xf');var _0xa7dcdb=_0x4f373f[_0x5624('0x10')];var _0x900856=_0x1c6454?0x0:_0x12e597['offset'];var _0xcc6644=_0x1c6454?_0x4f373f[_0x5624('0x10')]:_0x12e597['offset']+_0x12e597[_0x5624('0x11')];var _0x519de3;if(_0xcc6644>=_0xa7dcdb){_0xcc6644=_0xa7dcdb;_0x519de3=0xc8;}else{_0x519de3=0xce;}_0x2241a1[_0x5624('0xc')](_0x519de3);return _0x2241a1['set'](_0x5624('0x12'),_0x900856+'-'+_0xcc6644+'/'+_0xa7dcdb)[_0x5624('0xe')](_0x4f373f);}return null;};}function saveUpdates(_0x2dcf32){return function(_0x15add5){if(_0x15add5){return _0x15add5[_0x5624('0x13')](_0x2dcf32)[_0x5624('0x14')](function(_0xcd02e3){return _0xcd02e3;});}return null;};}function removeEntity(_0x55f2bf){return function(_0x438fde){if(_0x438fde){return _0x438fde[_0x5624('0x15')]()[_0x5624('0x14')](function(){_0x55f2bf[_0x5624('0xc')](0xcc)[_0x5624('0xd')]();});}};}function handleEntityNotFound(_0x31a15f){return function(_0x4ed883){if(!_0x4ed883){_0x31a15f['sendStatus'](0x194);}return _0x4ed883;};}function handleError(_0x4d503f,_0x2749d1){_0x2749d1=_0x2749d1||0x1f4;return function(_0x23d787){logger[_0x5624('0x16')](_0x23d787[_0x5624('0x17')]);if(_0x23d787[_0x5624('0x18')]){delete _0x23d787[_0x5624('0x18')];}_0x4d503f[_0x5624('0xc')](_0x2749d1)[_0x5624('0x19')](_0x23d787);};}function maskClientSecret(_0x5d5b35){return _['padEnd'](_0x5d5b35[_0x5624('0x1a')](0x0,0x3),0x14,'*');}exports[_0x5624('0x1b')]=function(_0x42740a,_0x21f423){var _0x46353e={},_0x3076f0={},_0x1eed80={'count':0x0,'rows':[]};var _0x4d79d7=_[_0x5624('0x1c')](db[_0x5624('0x1d')][_0x5624('0x1e')],function(_0x572a2e){return{'name':_0x572a2e[_0x5624('0x1f')],'type':_0x572a2e[_0x5624('0x20')]['key']};});_0x3076f0[_0x5624('0x21')]=_[_0x5624('0x1c')](_0x4d79d7,_0x5624('0x18'));_0x3076f0[_0x5624('0x22')]=_[_0x5624('0x23')](_0x42740a['query']);_0x3076f0[_0x5624('0x24')]=_[_0x5624('0x25')](_0x3076f0[_0x5624('0x21')],_0x3076f0[_0x5624('0x22')]);_0x46353e[_0x5624('0x26')]=_[_0x5624('0x25')](_0x3076f0[_0x5624('0x21')],qs[_0x5624('0x27')](_0x42740a[_0x5624('0x22')][_0x5624('0x27')]));_0x46353e[_0x5624('0x26')]=_0x46353e['attributes'][_0x5624('0x28')]?_0x46353e['attributes']:_0x3076f0['model'];if(!_0x42740a[_0x5624('0x22')][_0x5624('0x29')](_0x5624('0x2a'))){_0x46353e['limit']=qs[_0x5624('0x11')](_0x42740a[_0x5624('0x22')]['limit']);_0x46353e[_0x5624('0x2b')]=qs[_0x5624('0x2b')](_0x42740a[_0x5624('0x22')][_0x5624('0x2b')]);}_0x46353e[_0x5624('0x2c')]=qs[_0x5624('0x2d')](_0x42740a[_0x5624('0x22')]['sort']);_0x46353e[_0x5624('0x2e')]=qs['filters'](_[_0x5624('0x2f')](_0x42740a[_0x5624('0x22')],_0x3076f0['filters']),_0x4d79d7);if(_0x42740a[_0x5624('0x22')][_0x5624('0x30')]){_0x46353e['where']=_[_0x5624('0x31')](_0x46353e['where'],{'$or':_[_0x5624('0x1c')](_0x4d79d7,function(_0x5c1404){if(_0x5c1404[_0x5624('0x20')]!==_0x5624('0x32')){var _0x244da0={};_0x244da0[_0x5c1404[_0x5624('0x18')]]={'$like':'%'+_0x42740a[_0x5624('0x22')][_0x5624('0x30')]+'%'};return _0x244da0;}})});}_0x46353e=_[_0x5624('0x31')]({},_0x46353e,_0x42740a[_0x5624('0x33')]);var _0x4962aa={'where':_0x46353e[_0x5624('0x2e')]};return db[_0x5624('0x1d')][_0x5624('0x10')](_0x4962aa)[_0x5624('0x14')](function(_0x30f404){_0x1eed80[_0x5624('0x10')]=_0x30f404;if(_0x42740a[_0x5624('0x22')]['includeAll']){_0x46353e[_0x5624('0x34')]=[{'all':!![]}];}return db[_0x5624('0x1d')][_0x5624('0x35')](_0x46353e);})[_0x5624('0x14')](function(_0x192380){_0x1eed80['rows']=_[_0x5624('0x1c')](_0x192380,function(_0x4bdf37){if(_0x4bdf37[_0x5624('0x36')]===_0x5624('0x37')){var _0x3dad41=encryptor[_0x5624('0x38')](_0x4bdf37[_0x5624('0x39')]);_0x4bdf37[_0x5624('0x39')]=maskClientSecret(_0x3dad41);}return _0x4bdf37;});return _0x1eed80;})[_0x5624('0x14')](respondWithFilteredResult(_0x21f423,_0x46353e))['catch'](handleError(_0x21f423,null));};exports['show']=function(_0x199030,_0x3054a9){var _0x4f68bb={'raw':!![],'where':{'id':_0x199030['params']['id']}},_0x42129b={};_0x42129b['model']=_['keys'](db[_0x5624('0x1d')][_0x5624('0x1e')]);_0x42129b['query']=_[_0x5624('0x23')](_0x199030[_0x5624('0x22')]);_0x42129b[_0x5624('0x24')]=_[_0x5624('0x25')](_0x42129b[_0x5624('0x21')],_0x42129b[_0x5624('0x22')]);_0x4f68bb['attributes']=_['intersection'](_0x42129b['model'],qs[_0x5624('0x27')](_0x199030[_0x5624('0x22')]['fields']));_0x4f68bb['attributes']=_0x4f68bb[_0x5624('0x26')][_0x5624('0x28')]?_0x4f68bb[_0x5624('0x26')]:_0x42129b['model'];if(_0x199030[_0x5624('0x22')]['includeAll']){_0x4f68bb['include']=[{'all':!![]}];}_0x4f68bb=_[_0x5624('0x31')]({},_0x4f68bb,_0x199030[_0x5624('0x33')]);return db[_0x5624('0x1d')]['find'](_0x4f68bb)[_0x5624('0x14')](handleEntityNotFound(_0x3054a9,null))[_0x5624('0x14')](function(_0x5b280d){if(_0x5b280d[_0x5624('0x36')]===_0x5624('0x37')){var _0x4247ea=encryptor[_0x5624('0x38')](_0x5b280d[_0x5624('0x39')]);_0x5b280d[_0x5624('0x39')]=maskClientSecret(_0x4247ea);}return _0x5b280d;})[_0x5624('0x14')](respondWithResult(_0x3054a9,null))['catch'](handleError(_0x3054a9,null));};exports[_0x5624('0x3a')]=function(_0x28c674,_0x5bcf11){if(!_0x28c674[_0x5624('0x3b')][_0x5624('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x28c674[_0x5624('0x3b')][_0x5624('0x36')])throw new Error(_0x5624('0x3c'));var _0x3698bf=db[_0x5624('0x1d')][_0x5624('0x1e')]['service'][_0x5624('0x3d')];if(!_0x3698bf[_0x5624('0x3e')](_0x28c674[_0x5624('0x3b')][_0x5624('0x36')]))throw new Error(_0x5624('0x3f')+_0x3698bf[_0x5624('0x40')](',\x20'));if(_0x28c674[_0x5624('0x3b')][_0x5624('0x36')]==='MicrosoftAzure'&&_0x28c674[_0x5624('0x3b')][_0x5624('0x39')]){_0x28c674[_0x5624('0x3b')][_0x5624('0x39')]=encryptor[_0x5624('0x41')](_0x28c674[_0x5624('0x3b')]['data3']);}return db[_0x5624('0x1d')][_0x5624('0x3a')](_0x28c674['body'],{})[_0x5624('0x14')](respondWithResult(_0x5bcf11,0xc9))[_0x5624('0x42')](handleError(_0x5bcf11,null));};exports[_0x5624('0x13')]=function(_0x51fe24,_0x2cee62){if(_0x51fe24[_0x5624('0x3b')]['id']){delete _0x51fe24[_0x5624('0x3b')]['id'];}return db[_0x5624('0x1d')][_0x5624('0x43')]({'where':{'id':_0x51fe24[_0x5624('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cee62,null))[_0x5624('0x14')](function(_0x5c7a30){if(_0x5c7a30[_0x5624('0x36')]===_0x5624('0x37')&&_0x51fe24[_0x5624('0x3b')]['data3']){_0x51fe24['body'][_0x5624('0x39')]=encryptor[_0x5624('0x41')](_0x51fe24[_0x5624('0x3b')][_0x5624('0x39')]);}return _0x5c7a30;})['then'](saveUpdates(_0x51fe24[_0x5624('0x3b')],null))[_0x5624('0x14')](respondWithResult(_0x2cee62,null))[_0x5624('0x42')](handleError(_0x2cee62,null));};exports[_0x5624('0x15')]=function(_0x3b9acf,_0x3015ec){return db['CloudProvider']['find']({'where':{'id':_0x3b9acf[_0x5624('0x44')]['id']}})['then'](handleEntityNotFound(_0x3015ec,null))[_0x5624('0x14')](removeEntity(_0x3015ec,null))[_0x5624('0x42')](handleError(_0x3015ec,null));};exports[_0x5624('0x45')]=function(_0x30f427,_0x146ac5){return db['CloudProvider']['findOne']({'where':{'id':_0x30f427['params']['id']},'raw':!![]})[_0x5624('0x14')](function(_0x41b2b1){if(!_0x41b2b1)return _0x146ac5[_0x5624('0xb')](0x194);return{'url':oauth[_0x5624('0x46')](_0x41b2b1,_0x30f427[_0x5624('0x47')]['id'])};})[_0x5624('0x14')](respondWithResult(_0x146ac5,null))[_0x5624('0x42')](handleError(_0x146ac5,null));};exports[_0x5624('0x48')]=function(_0x11dbc2,_0x1907d8){var _0x4cce28=_0x11dbc2[_0x5624('0x3b')];var _0x1d2aec;var _0x30d666;if(_0x4cce28[_0x5624('0x16')])throw _0x4cce28;redis['get'](_0x4cce28['state'])['then'](function(_0x245527){if(!_0x245527)throw new Error('Invalid\x20state\x20parameter');_0x1d2aec=JSON[_0x5624('0x49')](_0x245527);var _0x566850=Buffer['from'](_0x4cce28[_0x5624('0x4a')],_0x5624('0x4b'))[_0x5624('0x4c')](_0x5624('0x4d'));_0x30d666=JSON['parse'](_0x566850);if(!oauth[_0x5624('0x4e')](_0x4cce28['id_token'],_0x1d2aec['oauth2Claims']))throw new Error(_0x5624('0x4f'));redis[_0x5624('0x50')](_0x4cce28[_0x5624('0x4a')]);return oauth[_0x5624('0x51')](_0x4cce28[_0x5624('0x52')],_0x1d2aec);})[_0x5624('0x14')](function(_0x2acb8a){_0x1d2aec[_0x5624('0x53')]=_0x2acb8a[_0x5624('0x54')];_0x1d2aec[_0x5624('0x55')]=_0x2acb8a['refresh_token'];return db[_0x5624('0x1d')]['update']({'data5':_0x1d2aec[_0x5624('0x53')],'data6':_0x1d2aec[_0x5624('0x55')]},{'where':{'id':_0x1d2aec['id']}});})[_0x5624('0x14')](function(){oauth[_0x5624('0x56')](_0x1d2aec);socket['emit']('microsoftAuthorization:success',{'id':_0x30d666['id']});return;})[_0x5624('0x14')](respondWithStatusCode(_0x1907d8,null))[_0x5624('0x42')](function(_0x43515b){if(_0x30d666){socket['emit'](_0x5624('0x57'),{'id':_0x30d666['id']});}if(!_0x1d2aec){logger[_0x5624('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x43515b);return _0x1907d8['status'](0x1f4)[_0x5624('0x19')](_0x43515b['message']);}logger[_0x5624('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1d2aec['id'],JSON[_0x5624('0x58')](_0x43515b));});}; \ No newline at end of file +var _0x2d29=['destroy','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','data6','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','error','name','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','service','MicrosoftAzure','decryptString','catch','show','params','find','data3','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString'];(function(_0x524c0c,_0x31d379){var _0xe33cf4=function(_0x153545){while(--_0x153545){_0x524c0c['push'](_0x524c0c['shift']());}};_0xe33cf4(++_0x31d379);}(_0x2d29,0x11c));var _0x92d2=function(_0x3bff95,_0x5787c6){_0x3bff95=_0x3bff95-0x0;var _0x599bac=_0x2d29[_0x3bff95];return _0x599bac;};'use strict';var _=require(_0x92d2('0x0'));var Redis=require(_0x92d2('0x1'));var qs=require(_0x92d2('0x2'));var encryptor=require(_0x92d2('0x3'));var config=require(_0x92d2('0x4'));var logger=require('../../config/logger')('api');var db=require(_0x92d2('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x92d2('0x6')]=_[_0x92d2('0x7')](config[_0x92d2('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x92d2('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x92d2('0x6')]);function respondWithStatusCode(_0x5671c5,_0x2cec7a){_0x2cec7a=_0x2cec7a||0xcc;return function(_0x767132){if(_0x767132){return _0x5671c5[_0x92d2('0x9')](_0x2cec7a);}return _0x5671c5['status'](_0x2cec7a)[_0x92d2('0xa')]();};}function respondWithResult(_0x218fbf,_0xafe727){_0xafe727=_0xafe727||0xc8;return function(_0xfc619d){if(_0xfc619d){return _0x218fbf[_0x92d2('0xb')](_0xafe727)[_0x92d2('0xc')](_0xfc619d);}};}function respondWithFilteredResult(_0x387319,_0x516608){return function(_0x12ff5f){if(_0x12ff5f){var _0xafd15a=typeof _0x516608[_0x92d2('0xd')]===_0x92d2('0xe')&&typeof _0x516608[_0x92d2('0xf')]===_0x92d2('0xe');var _0xd5a67f=_0x12ff5f['count'];var _0x57cc5d=_0xafd15a?0x0:_0x516608['offset'];var _0x1ee672=_0xafd15a?_0x12ff5f[_0x92d2('0x10')]:_0x516608['offset']+_0x516608[_0x92d2('0xf')];var _0x33e6cd;if(_0x1ee672>=_0xd5a67f){_0x1ee672=_0xd5a67f;_0x33e6cd=0xc8;}else{_0x33e6cd=0xce;}_0x387319[_0x92d2('0xb')](_0x33e6cd);return _0x387319[_0x92d2('0x11')]('Content-Range',_0x57cc5d+'-'+_0x1ee672+'/'+_0xd5a67f)[_0x92d2('0xc')](_0x12ff5f);}return null;};}function saveUpdates(_0x318a5c){return function(_0x2e4241){if(_0x2e4241){return _0x2e4241[_0x92d2('0x12')](_0x318a5c)[_0x92d2('0x13')](function(_0x5c8590){return _0x5c8590;});}return null;};}function removeEntity(_0x13e020){return function(_0x35991f){if(_0x35991f){return _0x35991f['destroy']()[_0x92d2('0x13')](function(){_0x13e020[_0x92d2('0xb')](0xcc)[_0x92d2('0xa')]();});}};}function handleEntityNotFound(_0x5bcbe4){return function(_0x10a602){if(!_0x10a602){_0x5bcbe4[_0x92d2('0x9')](0x194);}return _0x10a602;};}function handleError(_0x2cc7a2,_0x3e0acc){_0x3e0acc=_0x3e0acc||0x1f4;return function(_0xc87bdb){logger[_0x92d2('0x14')](_0xc87bdb['stack']);if(_0xc87bdb[_0x92d2('0x15')]){delete _0xc87bdb[_0x92d2('0x15')];}_0x2cc7a2[_0x92d2('0xb')](_0x3e0acc)['send'](_0xc87bdb);};}function maskClientSecret(_0x3b3d1d){return _['padEnd'](_0x3b3d1d[_0x92d2('0x16')](0x0,0x3),0x14,'*');}exports[_0x92d2('0x17')]=function(_0x30e803,_0x88e432){var _0x3049f9={},_0x5d79b8={},_0xf7d449={'count':0x0,'rows':[]};var _0x59c536=_[_0x92d2('0x18')](db[_0x92d2('0x19')][_0x92d2('0x1a')],function(_0x5ba712){return{'name':_0x5ba712[_0x92d2('0x1b')],'type':_0x5ba712[_0x92d2('0x1c')][_0x92d2('0x1d')]};});_0x5d79b8[_0x92d2('0x1e')]=_['map'](_0x59c536,_0x92d2('0x15'));_0x5d79b8[_0x92d2('0x1f')]=_[_0x92d2('0x20')](_0x30e803['query']);_0x5d79b8[_0x92d2('0x21')]=_[_0x92d2('0x22')](_0x5d79b8[_0x92d2('0x1e')],_0x5d79b8[_0x92d2('0x1f')]);_0x3049f9[_0x92d2('0x23')]=_[_0x92d2('0x22')](_0x5d79b8[_0x92d2('0x1e')],qs[_0x92d2('0x24')](_0x30e803['query'][_0x92d2('0x24')]));_0x3049f9[_0x92d2('0x23')]=_0x3049f9[_0x92d2('0x23')][_0x92d2('0x25')]?_0x3049f9[_0x92d2('0x23')]:_0x5d79b8[_0x92d2('0x1e')];if(!_0x30e803[_0x92d2('0x1f')][_0x92d2('0x26')]('nolimit')){_0x3049f9[_0x92d2('0xf')]=qs[_0x92d2('0xf')](_0x30e803[_0x92d2('0x1f')][_0x92d2('0xf')]);_0x3049f9[_0x92d2('0xd')]=qs[_0x92d2('0xd')](_0x30e803['query'][_0x92d2('0xd')]);}_0x3049f9['order']=qs[_0x92d2('0x27')](_0x30e803[_0x92d2('0x1f')][_0x92d2('0x27')]);_0x3049f9[_0x92d2('0x28')]=qs[_0x92d2('0x21')](_['pick'](_0x30e803['query'],_0x5d79b8['filters']),_0x59c536);if(_0x30e803[_0x92d2('0x1f')][_0x92d2('0x29')]){_0x3049f9[_0x92d2('0x28')]=_[_0x92d2('0x2a')](_0x3049f9['where'],{'$or':_[_0x92d2('0x18')](_0x59c536,function(_0xb2928d){if(_0xb2928d[_0x92d2('0x1c')]!==_0x92d2('0x2b')){var _0xda199f={};_0xda199f[_0xb2928d[_0x92d2('0x15')]]={'$like':'%'+_0x30e803[_0x92d2('0x1f')][_0x92d2('0x29')]+'%'};return _0xda199f;}})});}_0x3049f9=_[_0x92d2('0x2a')]({},_0x3049f9,_0x30e803[_0x92d2('0x2c')]);var _0x3708cc={'where':_0x3049f9['where']};return db[_0x92d2('0x19')][_0x92d2('0x10')](_0x3708cc)[_0x92d2('0x13')](function(_0x1efd66){_0xf7d449[_0x92d2('0x10')]=_0x1efd66;if(_0x30e803['query'][_0x92d2('0x2d')]){_0x3049f9[_0x92d2('0x2e')]=[{'all':!![]}];}return db[_0x92d2('0x19')]['findAll'](_0x3049f9);})[_0x92d2('0x13')](function(_0x5b9381){_0xf7d449[_0x92d2('0x2f')]=_[_0x92d2('0x18')](_0x5b9381,function(_0x336df4){if(_0x336df4[_0x92d2('0x30')]===_0x92d2('0x31')){var _0xa86eb7=encryptor[_0x92d2('0x32')](_0x336df4['data3']);_0x336df4['data3']=maskClientSecret(_0xa86eb7);}return _0x336df4;});return _0xf7d449;})['then'](respondWithFilteredResult(_0x88e432,_0x3049f9))[_0x92d2('0x33')](handleError(_0x88e432,null));};exports[_0x92d2('0x34')]=function(_0x2d6623,_0x437c96){var _0x4fac4c={'raw':!![],'where':{'id':_0x2d6623[_0x92d2('0x35')]['id']}},_0x19970d={};_0x19970d['model']=_[_0x92d2('0x20')](db['CloudProvider'][_0x92d2('0x1a')]);_0x19970d[_0x92d2('0x1f')]=_[_0x92d2('0x20')](_0x2d6623[_0x92d2('0x1f')]);_0x19970d['filters']=_['intersection'](_0x19970d[_0x92d2('0x1e')],_0x19970d[_0x92d2('0x1f')]);_0x4fac4c['attributes']=_[_0x92d2('0x22')](_0x19970d['model'],qs[_0x92d2('0x24')](_0x2d6623[_0x92d2('0x1f')]['fields']));_0x4fac4c[_0x92d2('0x23')]=_0x4fac4c[_0x92d2('0x23')]['length']?_0x4fac4c['attributes']:_0x19970d['model'];if(_0x2d6623['query'][_0x92d2('0x2d')]){_0x4fac4c['include']=[{'all':!![]}];}_0x4fac4c=_[_0x92d2('0x2a')]({},_0x4fac4c,_0x2d6623['options']);return db['CloudProvider'][_0x92d2('0x36')](_0x4fac4c)[_0x92d2('0x13')](handleEntityNotFound(_0x437c96,null))[_0x92d2('0x13')](function(_0x512271){if(_0x512271[_0x92d2('0x30')]===_0x92d2('0x31')){var _0x29bb54=encryptor['decryptString'](_0x512271[_0x92d2('0x37')]);_0x512271[_0x92d2('0x37')]=maskClientSecret(_0x29bb54);}return _0x512271;})['then'](respondWithResult(_0x437c96,null))[_0x92d2('0x33')](handleError(_0x437c96,null));};exports[_0x92d2('0x38')]=function(_0x2d19f6,_0x2e0549){if(!_0x2d19f6['body'][_0x92d2('0x15')])throw new Error(_0x92d2('0x39'));if(!_0x2d19f6[_0x92d2('0x3a')][_0x92d2('0x30')])throw new Error(_0x92d2('0x3b'));var _0x646d3a=db['CloudProvider']['rawAttributes']['service'][_0x92d2('0x3c')];if(!_0x646d3a[_0x92d2('0x3d')](_0x2d19f6[_0x92d2('0x3a')]['service']))throw new Error(_0x92d2('0x3e')+_0x646d3a['join'](',\x20'));if(_0x2d19f6[_0x92d2('0x3a')][_0x92d2('0x30')]===_0x92d2('0x31')&&_0x2d19f6[_0x92d2('0x3a')]['data3']){_0x2d19f6[_0x92d2('0x3a')]['data3']=encryptor[_0x92d2('0x3f')](_0x2d19f6[_0x92d2('0x3a')][_0x92d2('0x37')]);}return db[_0x92d2('0x19')][_0x92d2('0x38')](_0x2d19f6[_0x92d2('0x3a')],{})['then'](respondWithResult(_0x2e0549,0xc9))[_0x92d2('0x33')](handleError(_0x2e0549,null));};exports[_0x92d2('0x12')]=function(_0x514ee3,_0x41979a){if(_0x514ee3[_0x92d2('0x3a')]['id']){delete _0x514ee3[_0x92d2('0x3a')]['id'];}return db[_0x92d2('0x19')]['find']({'where':{'id':_0x514ee3[_0x92d2('0x35')]['id']}})[_0x92d2('0x13')](handleEntityNotFound(_0x41979a,null))[_0x92d2('0x13')](function(_0x56206d){if(_0x56206d[_0x92d2('0x30')]===_0x92d2('0x31')&&_0x514ee3[_0x92d2('0x3a')][_0x92d2('0x37')]){_0x514ee3[_0x92d2('0x3a')][_0x92d2('0x37')]=encryptor['encryptString'](_0x514ee3[_0x92d2('0x3a')][_0x92d2('0x37')]);}return _0x56206d;})[_0x92d2('0x13')](saveUpdates(_0x514ee3['body'],null))[_0x92d2('0x13')](respondWithResult(_0x41979a,null))['catch'](handleError(_0x41979a,null));};exports[_0x92d2('0x40')]=function(_0x2548e4,_0x347d42){return db[_0x92d2('0x19')]['find']({'where':{'id':_0x2548e4[_0x92d2('0x35')]['id']}})['then'](handleEntityNotFound(_0x347d42,null))[_0x92d2('0x13')](removeEntity(_0x347d42,null))[_0x92d2('0x33')](handleError(_0x347d42,null));};exports['oauth2MicrosoftAuthorize']=function(_0x3a6270,_0x1e35bb){return db[_0x92d2('0x19')]['findOne']({'where':{'id':_0x3a6270[_0x92d2('0x35')]['id']},'raw':!![]})[_0x92d2('0x13')](function(_0x4a2c4f){if(!_0x4a2c4f)return _0x1e35bb['sendStatus'](0x194);return{'url':oauth[_0x92d2('0x41')](_0x4a2c4f,_0x3a6270[_0x92d2('0x42')]['id'])};})['then'](respondWithResult(_0x1e35bb,null))[_0x92d2('0x33')](handleError(_0x1e35bb,null));};exports[_0x92d2('0x43')]=function(_0x3ca76d,_0x4ea26a){var _0x2e2978=_0x3ca76d[_0x92d2('0x3a')];var _0x4678d5;var _0x5dd87a;if(_0x2e2978[_0x92d2('0x14')])throw _0x2e2978;redis['get'](_0x2e2978[_0x92d2('0x44')])[_0x92d2('0x13')](function(_0x59b7be){if(!_0x59b7be)throw new Error(_0x92d2('0x45'));_0x4678d5=JSON[_0x92d2('0x46')](_0x59b7be);var _0x1badfa=Buffer[_0x92d2('0x47')](_0x2e2978[_0x92d2('0x44')],_0x92d2('0x48'))[_0x92d2('0x49')](_0x92d2('0x4a'));_0x5dd87a=JSON[_0x92d2('0x46')](_0x1badfa);if(!oauth[_0x92d2('0x4b')](_0x2e2978[_0x92d2('0x4c')],_0x4678d5[_0x92d2('0x4d')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x92d2('0x4e')](_0x2e2978[_0x92d2('0x44')]);return oauth[_0x92d2('0x4f')](_0x2e2978[_0x92d2('0x50')],_0x4678d5);})['then'](function(_0x429eef){_0x4678d5[_0x92d2('0x51')]=_0x429eef['access_token'];_0x4678d5[_0x92d2('0x52')]=_0x429eef['refresh_token'];return db['CloudProvider'][_0x92d2('0x12')]({'data5':_0x4678d5['data5'],'data6':_0x4678d5[_0x92d2('0x52')]},{'where':{'id':_0x4678d5['id']}});})[_0x92d2('0x13')](function(){oauth['startRefreshInterval'](_0x4678d5);socket[_0x92d2('0x53')]('microsoftAuthorization:success',{'id':_0x5dd87a['id']});return;})[_0x92d2('0x13')](respondWithStatusCode(_0x4ea26a,null))[_0x92d2('0x33')](function(_0x560d3a){if(_0x5dd87a){socket[_0x92d2('0x53')](_0x92d2('0x54'),{'id':_0x5dd87a['id']});}if(!_0x4678d5){logger[_0x92d2('0x14')](_0x92d2('0x55'),_0x560d3a);return _0x4ea26a['status'](0x1f4)[_0x92d2('0x56')](_0x560d3a['message']);}logger[_0x92d2('0x14')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x4678d5['id'],JSON['stringify'](_0x560d3a));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3f682ef..39aed82 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 _0x160d=['path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x160d,0x7e));var _0xd160=function(_0x5cae78,_0x398e85){_0x5cae78=_0x5cae78-0x0;var _0x5394b6=_0x160d[_0x5cae78];return _0x5394b6;};'use strict';var _=require('lodash');var util=require(_0xd160('0x0'));var logger=require(_0xd160('0x1'))(_0xd160('0x2'));var moment=require(_0xd160('0x3'));var BPromise=require(_0xd160('0x4'));var rp=require(_0xd160('0x5'));var fs=require('fs');var path=require(_0xd160('0x6'));var rimraf=require(_0xd160('0x7'));var config=require('../../config/environment');var attributes=require(_0xd160('0x8'));module[_0xd160('0x9')]=function(_0x14c4a9,_0x367006){return _0x14c4a9[_0xd160('0xa')](_0xd160('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7da=['CloudProvider','cloud_providers','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./cloudProvider.attributes','exports','define'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xf7da,0x18e));var _0xaf7d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf7da[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xaf7d('0x0'));var util=require('util');var logger=require(_0xaf7d('0x1'))('api');var moment=require(_0xaf7d('0x2'));var BPromise=require(_0xaf7d('0x3'));var rp=require(_0xaf7d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf7d('0x5'));var config=require('../../config/environment');var attributes=require(_0xaf7d('0x6'));module[_0xaf7d('0x7')]=function(_0x3de17c,_0x5daaa9){return _0x3de17c[_0xaf7d('0x8')](_0xaf7d('0x9'),attributes,{'tableName':_0xaf7d('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 8c92372..602ba73 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 _0xab4e=['join','Dynamics365','/.default','replace','data2','code','stringify','toString','base64','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','value','oauth2Claims','oauth2/','set','decode','iss','aud','audience','unix','exp','data3','refresh_token','data6','decryptString','{TENANT_ID}','then','data5','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','exports','lodash','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','push','data7'];(function(_0x177777,_0x126b6b){var _0x5dd5c0=function(_0xe7de6e){while(--_0xe7de6e){_0x177777['push'](_0x177777['shift']());}};_0x5dd5c0(++_0x126b6b);}(_0xab4e,0x11a));var _0xeab4=function(_0x21e26a,_0x74beb4){_0x21e26a=_0x21e26a-0x0;var _0x33f236=_0xab4e[_0x21e26a];return _0x33f236;};'use strict';var _=require(_0xeab4('0x0'));var crypto=require(_0xeab4('0x1'));var jwt=require(_0xeab4('0x2'));var moment=require(_0xeab4('0x3'));var Redis=require(_0xeab4('0x4'));var rp=require('request-promise');var util=require(_0xeab4('0x5'));var encryptor=require(_0xeab4('0x6'));var config=require(_0xeab4('0x7'));var logger=require(_0xeab4('0x8'))('api');var schedule=require(_0xeab4('0x9'));var db=require(_0xeab4('0xa'))['db'];config[_0xeab4('0xb')]=_[_0xeab4('0xc')](config[_0xeab4('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xeab4('0xb')]);var MICROSOFT_AUTH_URL=_0xeab4('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xeab4('0xe'),_0xeab4('0xf'),_0xeab4('0x10'),_0xeab4('0x11'),_0xeab4('0x12'),_0xeab4('0x13'),_0xeab4('0x14')],'Dynamics365':[_0xeab4('0xe'),_0xeab4('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xeab4('0x15');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4cd173){var _0x48515c=_[_0xeab4('0x16')](AZURE_AUTH_SCOPES[_0x4cd173[_0xeab4('0x17')]]);if(_0x4cd173[_0xeab4('0x17')]==='Dynamics365')_0x48515c[_0xeab4('0x18')](_0x4cd173[_0xeab4('0x19')]+'/.default');return _0x48515c[_0xeab4('0x1a')]('\x20');}function getAccessTokenScope(_0x29f893){if(_0x29f893[_0xeab4('0x17')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x29f893[_0xeab4('0x17')]===_0xeab4('0x1b'))return _0x29f893['data7']+_0xeab4('0x1c');}function generateMicrosoftAuthorizationUrl(_0x4cec5a,_0x10941e){var _0x23c4dd=MICROSOFT_AUTH_URL[_0xeab4('0x1d')]('{TENANT_ID}',_0x4cec5a[_0xeab4('0x1e')]);var _0x55f6da=[_0xeab4('0x1f'),'id_token'];var _0x19979f=Buffer['from'](JSON[_0xeab4('0x20')]({'id':_0x10941e}))[_0xeab4('0x21')](_0xeab4('0x22'));var _0x2315dc=crypto['randomBytes'](0x10)['toString'](_0xeab4('0x23'));var _0x259bd5=getAuthorizationScopes(_0x4cec5a);var _0x77b6f0=[{'key':_0xeab4('0x24'),'value':_0x4cec5a[_0xeab4('0x25')]},{'key':_0xeab4('0x26'),'value':encodeURIComponent(_0x55f6da[_0xeab4('0x1a')]('\x20'))},{'key':_0xeab4('0x27'),'value':_0x4cec5a[_0xeab4('0x28')]},{'key':_0xeab4('0x29'),'value':_0xeab4('0x2a')},{'key':_0xeab4('0x2b'),'value':encodeURIComponent(_0x259bd5)},{'key':_0xeab4('0x2c'),'value':_0x19979f},{'key':_0xeab4('0x2d'),'value':_0x2315dc},{'key':_0xeab4('0x2e'),'value':_0xeab4('0x2f')}];var _0x256f58=_0x23c4dd+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x77b6f0,function(_0x56d471){return _0x56d471['key']+'='+_0x56d471[_0xeab4('0x30')];})[_0xeab4('0x1a')]('&');_0x4cec5a[_0xeab4('0x31')]={'issuer':_0x23c4dd[_0xeab4('0x1d')](_0xeab4('0x32'),''),'audience':_0x4cec5a[_0xeab4('0x25')],'state':_0x19979f,'nonce':_0x2315dc};redis[_0xeab4('0x33')](_0x19979f,JSON['stringify'](_0x4cec5a));return _0x256f58;}function isValidIdToken(_0x12057e,_0x5d4e7c){try{var _0x54712c=jwt[_0xeab4('0x34')](_0x12057e,{'complete':!![]});var _0x15486d=_0x54712c['payload'];if(_0x15486d[_0xeab4('0x35')]!==_0x5d4e7c['issuer'])return![];if(_0x15486d[_0xeab4('0x36')]!==_0x5d4e7c[_0xeab4('0x37')])return![];if(_0x15486d[_0xeab4('0x2d')]!==_0x5d4e7c[_0xeab4('0x2d')])return![];if(moment()['isAfter'](moment[_0xeab4('0x38')](_0x15486d[_0xeab4('0x39')])))return![];return!![];}catch(_0x3cb93b){throw _0x3cb93b;}}function refreshOauth2MicrosoftAccessToken(_0x2b06b5){return Promise['resolve']()['then'](function(){if(_0x2b06b5[_0xeab4('0x3a')])return _0x2b06b5;return db['CloudProvider']['findOne']({'where':{'id':_0x2b06b5['id']},'raw':!![]});})['then'](function(_0x5efec7){var _0x1f2b0e={'grant_type':_0xeab4('0x3b'),'refresh_token':_0x5efec7[_0xeab4('0x3c')],'scope':getAccessTokenScope(_0x5efec7),'redirect_uri':_0x5efec7[_0xeab4('0x28')],'client_id':_0x5efec7[_0xeab4('0x25')],'client_secret':encryptor[_0xeab4('0x3d')](_0x5efec7[_0xeab4('0x3a')])};var _0x15ed44={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xeab4('0x1d')](_0xeab4('0x3e'),_0x5efec7[_0xeab4('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1f2b0e,'json':!![]};return rp(_0x15ed44);})[_0xeab4('0x3f')](function(_0x52894c){_0x2b06b5[_0xeab4('0x40')]=_0x52894c['access_token'];_0x2b06b5[_0xeab4('0x3c')]=_0x52894c[_0xeab4('0x3b')];return db[_0xeab4('0x41')][_0xeab4('0x42')]({'data5':_0x2b06b5['data5'],'data6':_0x2b06b5[_0xeab4('0x3c')]},{'where':{'id':_0x2b06b5['id']}});})[_0xeab4('0x3f')](function(){return _0x2b06b5;})[_0xeab4('0x43')](function(_0x14fc30){logger[_0xeab4('0x44')](_0xeab4('0x45'),_0x2b06b5['id'],_0x14fc30);});}function getOauth2MicrosoftAccessToken(_0x50d4f9,_0x4b0982){var _0x382fda={'grant_type':_0xeab4('0x46'),'code':_0x50d4f9,'scope':getAccessTokenScope(_0x4b0982),'redirect_uri':_0x4b0982[_0xeab4('0x28')],'client_id':_0x4b0982[_0xeab4('0x25')],'client_secret':encryptor[_0xeab4('0x3d')](_0x4b0982[_0xeab4('0x3a')])};var _0x324c6b={'method':_0xeab4('0x47'),'uri':MICROSOFT_AUTH_URL[_0xeab4('0x1d')](_0xeab4('0x3e'),_0x4b0982[_0xeab4('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x382fda,'json':!![]};return rp(_0x324c6b);}function startRefreshInterval(_0x31a0c9){var _0x2021cb=schedule[_0xeab4('0x48')];if(_0x2021cb[_0x31a0c9['id']])clearInterval(_0x2021cb[_0x31a0c9['id']]);_0x2021cb[_0x31a0c9['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xeab4('0x49')](this,{'id':_0x31a0c9['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xeab4('0x48')]=_0x2021cb;}function startAllRefreshIntervals(){return db[_0xeab4('0x41')][_0xeab4('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xeab4('0x3f')](function(_0x5c1048){var _0x91562=_0x5c1048[_0xeab4('0x16')](function(_0x208527){return refreshOauth2MicrosoftAccessToken(_0x208527)[_0xeab4('0x3f')](function(_0x5b8632){startRefreshInterval(_0x5b8632);});});return Promise[_0xeab4('0x4b')](_0x91562);})[_0xeab4('0x43')](function(_0x16eafa){var _0x2d5760=_0x16eafa?util['inspect'](_0x16eafa,{'showHidden':![],'depth':null}):'';logger[_0xeab4('0x44')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x2d5760);});}module[_0xeab4('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x0ce8=['key','value','oauth2Claims','oauth2/','set','payload','iss','issuer','aud','audience','isAfter','exp','resolve','then','data3','CloudProvider','refresh_token','data6','decryptString','POST','data5','access_token','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','replace','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','map','type','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','from','stringify','base64','randomBytes','toString','hex','client_id','data1','redirect_uri','data4','response_mode','scope','state','nonce','prompt'];(function(_0x291882,_0x20063d){var _0x229e64=function(_0x4c59e9){while(--_0x4c59e9){_0x291882['push'](_0x291882['shift']());}};_0x229e64(++_0x20063d);}(_0x0ce8,0x102));var _0x80ce=function(_0x38a077,_0x40ce2b){_0x38a077=_0x38a077-0x0;var _0xfce4a3=_0x0ce8[_0x38a077];return _0xfce4a3;};'use strict';var _=require('lodash');var crypto=require(_0x80ce('0x0'));var jwt=require(_0x80ce('0x1'));var moment=require(_0x80ce('0x2'));var Redis=require(_0x80ce('0x3'));var rp=require(_0x80ce('0x4'));var util=require('util');var encryptor=require(_0x80ce('0x5'));var config=require(_0x80ce('0x6'));var logger=require('../../config/logger')(_0x80ce('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x80ce('0x8'))['db'];config['redis']=_['defaults'](config[_0x80ce('0x9')],{'host':_0x80ce('0xa'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x80ce('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x80ce('0xc'),_0x80ce('0xd'),'email',_0x80ce('0xe'),_0x80ce('0xf'),_0x80ce('0x10'),_0x80ce('0x11')],'Dynamics365':[_0x80ce('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2d5077){var _0x5c6dcd=_[_0x80ce('0x12')](AZURE_AUTH_SCOPES[_0x2d5077[_0x80ce('0x13')]]);if(_0x2d5077[_0x80ce('0x13')]==='Dynamics365')_0x5c6dcd[_0x80ce('0x14')](_0x2d5077[_0x80ce('0x15')]+_0x80ce('0x16'));return _0x5c6dcd[_0x80ce('0x17')]('\x20');}function getAccessTokenScope(_0x26daff){if(_0x26daff[_0x80ce('0x13')]===_0x80ce('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x26daff['type']==='Dynamics365')return _0x26daff[_0x80ce('0x15')]+_0x80ce('0x16');}function generateMicrosoftAuthorizationUrl(_0x2578bf,_0x5a0bbf){var _0x2b5a88=MICROSOFT_AUTH_URL['replace'](_0x80ce('0x19'),_0x2578bf[_0x80ce('0x1a')]);var _0x37d591=['code','id_token'];var _0x5db94c=Buffer[_0x80ce('0x1b')](JSON[_0x80ce('0x1c')]({'id':_0x5a0bbf}))['toString'](_0x80ce('0x1d'));var _0x510eb6=crypto[_0x80ce('0x1e')](0x10)[_0x80ce('0x1f')](_0x80ce('0x20'));var _0x515ece=getAuthorizationScopes(_0x2578bf);var _0x2c4246=[{'key':_0x80ce('0x21'),'value':_0x2578bf[_0x80ce('0x22')]},{'key':'response_type','value':encodeURIComponent(_0x37d591['join']('\x20'))},{'key':_0x80ce('0x23'),'value':_0x2578bf[_0x80ce('0x24')]},{'key':_0x80ce('0x25'),'value':'form_post'},{'key':_0x80ce('0x26'),'value':encodeURIComponent(_0x515ece)},{'key':_0x80ce('0x27'),'value':_0x5db94c},{'key':_0x80ce('0x28'),'value':_0x510eb6},{'key':_0x80ce('0x29'),'value':'login'}];var _0x4ebd5a=_0x2b5a88+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x80ce('0x12')](_0x2c4246,function(_0x1c6e99){return _0x1c6e99[_0x80ce('0x2a')]+'='+_0x1c6e99[_0x80ce('0x2b')];})[_0x80ce('0x17')]('&');_0x2578bf[_0x80ce('0x2c')]={'issuer':_0x2b5a88['replace'](_0x80ce('0x2d'),''),'audience':_0x2578bf[_0x80ce('0x22')],'state':_0x5db94c,'nonce':_0x510eb6};redis[_0x80ce('0x2e')](_0x5db94c,JSON[_0x80ce('0x1c')](_0x2578bf));return _0x4ebd5a;}function isValidIdToken(_0x1efa15,_0x21464b){try{var _0x1d6d81=jwt['decode'](_0x1efa15,{'complete':!![]});var _0x553318=_0x1d6d81[_0x80ce('0x2f')];if(_0x553318[_0x80ce('0x30')]!==_0x21464b[_0x80ce('0x31')])return![];if(_0x553318[_0x80ce('0x32')]!==_0x21464b[_0x80ce('0x33')])return![];if(_0x553318[_0x80ce('0x28')]!==_0x21464b[_0x80ce('0x28')])return![];if(moment()[_0x80ce('0x34')](moment['unix'](_0x553318[_0x80ce('0x35')])))return![];return!![];}catch(_0xe2397){throw _0xe2397;}}function refreshOauth2MicrosoftAccessToken(_0x469865){return Promise[_0x80ce('0x36')]()[_0x80ce('0x37')](function(){if(_0x469865[_0x80ce('0x38')])return _0x469865;return db[_0x80ce('0x39')]['findOne']({'where':{'id':_0x469865['id']},'raw':!![]});})[_0x80ce('0x37')](function(_0x4f9d15){var _0xae0ab2={'grant_type':_0x80ce('0x3a'),'refresh_token':_0x4f9d15[_0x80ce('0x3b')],'scope':getAccessTokenScope(_0x4f9d15),'redirect_uri':_0x4f9d15[_0x80ce('0x24')],'client_id':_0x4f9d15[_0x80ce('0x22')],'client_secret':encryptor[_0x80ce('0x3c')](_0x4f9d15[_0x80ce('0x38')])};var _0x511e4f={'method':_0x80ce('0x3d'),'uri':MICROSOFT_AUTH_URL['replace'](_0x80ce('0x19'),_0x4f9d15[_0x80ce('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xae0ab2,'json':!![]};return rp(_0x511e4f);})[_0x80ce('0x37')](function(_0x4288ad){_0x469865[_0x80ce('0x3e')]=_0x4288ad[_0x80ce('0x3f')];_0x469865['data6']=_0x4288ad['refresh_token'];return db['CloudProvider']['update']({'data5':_0x469865[_0x80ce('0x3e')],'data6':_0x469865['data6']},{'where':{'id':_0x469865['id']}});})['then'](function(){return _0x469865;})[_0x80ce('0x40')](function(_0x5f2413){logger['error'](_0x80ce('0x41'),_0x469865['id'],_0x5f2413);});}function getOauth2MicrosoftAccessToken(_0x2484c9,_0x500187){var _0x25af0c={'grant_type':_0x80ce('0x42'),'code':_0x2484c9,'scope':getAccessTokenScope(_0x500187),'redirect_uri':_0x500187[_0x80ce('0x24')],'client_id':_0x500187[_0x80ce('0x22')],'client_secret':encryptor[_0x80ce('0x3c')](_0x500187['data3'])};var _0x53e30f={'method':_0x80ce('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x80ce('0x43')]('{TENANT_ID}',_0x500187[_0x80ce('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x25af0c,'json':!![]};return rp(_0x53e30f);}function startRefreshInterval(_0x53e447){var _0x579f41=schedule[_0x80ce('0x44')];if(_0x579f41[_0x53e447['id']])clearInterval(_0x579f41[_0x53e447['id']]);_0x579f41[_0x53e447['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x80ce('0x45')](this,{'id':_0x53e447['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x80ce('0x44')]=_0x579f41;}function startAllRefreshIntervals(){return db[_0x80ce('0x39')][_0x80ce('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x80ce('0x37')](function(_0x15be1b){var _0xd1f4a2=_0x15be1b[_0x80ce('0x12')](function(_0x442d93){return refreshOauth2MicrosoftAccessToken(_0x442d93)[_0x80ce('0x37')](function(_0x3a19bc){startRefreshInterval(_0x3a19bc);});});return Promise[_0x80ce('0x47')](_0xd1f4a2);})['catch'](function(_0x2b813b){var _0x21d169=_0x2b813b?util[_0x80ce('0x48')](_0x2b813b,{'showHidden':![],'depth':null}):'';logger[_0x80ce('0x49')](_0x80ce('0x4a'),_0x21d169);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index c093302..9ea3df4 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 _0x30d6=['client','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x3818c0,_0x542521){var _0x55ec33=function(_0x2be9ea){while(--_0x2be9ea){_0x3818c0['push'](_0x3818c0['shift']());}};_0x55ec33(++_0x542521);}(_0x30d6,0x1b0));var _0x630d=function(_0x3e3f8b,_0x98ea26){_0x3e3f8b=_0x3e3f8b-0x0;var _0x354e47=_0x30d6[_0x3e3f8b];return _0x354e47;};'use strict';var _=require(_0x630d('0x0'));var util=require(_0x630d('0x1'));var moment=require('moment');var BPromise=require(_0x630d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x630d('0x3'));var db=require(_0x630d('0x4'))['db'];var utils=require(_0x630d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x630d('0x6'));var jayson=require(_0x630d('0x7'));var client=jayson[_0x630d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8950bb,_0x3aa6f4,_0x2c1b77){return new BPromise(function(_0x4b60c1,_0x533e4f){return client[_0x630d('0x9')](_0x8950bb,_0x2c1b77)[_0x630d('0xa')](function(_0x24d260){logger[_0x630d('0xb')]('CloudProvider,\x20%s,\x20%s',_0x3aa6f4,_0x630d('0xc'));logger[_0x630d('0xd')](_0x630d('0xe'),_0x3aa6f4,_0x630d('0xc'),JSON[_0x630d('0xf')](_0x24d260));if(_0x24d260[_0x630d('0x10')]){if(_0x24d260[_0x630d('0x10')][_0x630d('0x11')]===0x1f4){logger[_0x630d('0x10')](_0x630d('0x12'),_0x3aa6f4,_0x24d260['error'][_0x630d('0x13')]);return _0x533e4f(_0x24d260['error'][_0x630d('0x13')]);}logger[_0x630d('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3aa6f4,_0x24d260[_0x630d('0x10')][_0x630d('0x13')]);return _0x4b60c1(_0x24d260[_0x630d('0x10')][_0x630d('0x13')]);}else{logger[_0x630d('0xb')](_0x630d('0x12'),_0x3aa6f4,_0x630d('0xc'));_0x4b60c1(_0x24d260[_0x630d('0x14')]['message']);}})[_0x630d('0x15')](function(_0x4db79d){logger[_0x630d('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3aa6f4,_0x4db79d);_0x533e4f(_0x4db79d);});});} \ No newline at end of file +var _0xcefd=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xcefd,0x126));var _0xdcef=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0xcefd[_0x218994];return _0x3f350b;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var moment=require(_0xdcef('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcef('0x6'))(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdcef('0x9')][_0xdcef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fb1b7,_0x3260fe,_0x53e707){return new BPromise(function(_0x56ee48,_0x8b30d4){return client[_0xdcef('0xb')](_0x3fb1b7,_0x53e707)[_0xdcef('0xc')](function(_0x5d601b){logger[_0xdcef('0xd')](_0xdcef('0xe'),_0x3260fe,_0xdcef('0xf'));logger[_0xdcef('0x10')](_0xdcef('0x11'),_0x3260fe,_0xdcef('0xf'),JSON['stringify'](_0x5d601b));if(_0x5d601b['error']){if(_0x5d601b[_0xdcef('0x12')][_0xdcef('0x13')]===0x1f4){logger['error'](_0xdcef('0xe'),_0x3260fe,_0x5d601b['error']['message']);return _0x8b30d4(_0x5d601b[_0xdcef('0x12')][_0xdcef('0x14')]);}logger[_0xdcef('0x12')](_0xdcef('0xe'),_0x3260fe,_0x5d601b[_0xdcef('0x12')][_0xdcef('0x14')]);return _0x56ee48(_0x5d601b[_0xdcef('0x12')][_0xdcef('0x14')]);}else{logger[_0xdcef('0xd')](_0xdcef('0xe'),_0x3260fe,_0xdcef('0xf'));_0x56ee48(_0x5d601b[_0xdcef('0x15')]['message']);}})[_0xdcef('0x16')](function(_0x4dd058){logger[_0xdcef('0x12')](_0xdcef('0xe'),_0x3260fe,_0x4dd058);_0x8b30d4(_0x4dd058);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 0b5c476..723961d 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(_0x5ee49f,_0x317771){var _0x44cca1=function(_0x1f7b6f){while(--_0x1f7b6f){_0x5ee49f['push'](_0x5ee49f['shift']());}};_0x44cca1(++_0x317771);}(_0xdb28,0x106));var _0x8db2=function(_0x4c88c7,_0x3f0882){_0x4c88c7=_0x4c88c7-0x0;var _0x2c03e7=_0xdb28[_0x4c88c7];return _0x2c03e7;};'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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x1261,0x144));var _0x1126=function(_0x474035,_0x41e639){_0x474035=_0x474035-0x0;var _0x1b58e0=_0x1261[_0x474035];return _0x1b58e0;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index ea86756..0fbdc71 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 _0x5915=['sequelize','exports','STRING'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x5915,0x14a));var _0x5591=function(_0x2d4924,_0x34b36f){_0x2d4924=_0x2d4924-0x0;var _0x2db190=_0x5915[_0x2d4924];return _0x2db190;};'use strict';var Sequelize=require(_0x5591('0x0'));module[_0x5591('0x1')]={'name':{'type':Sequelize[_0x5591('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x5591('0x2')]},'website':{'type':Sequelize[_0x5591('0x2')]},'phone':{'type':Sequelize[_0x5591('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5591('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x5591('0x2')]},'country':{'type':Sequelize[_0x5591('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5591('0x2')]},'sStreet':{'type':Sequelize[_0x5591('0x2')]},'sPostalCode':{'type':Sequelize[_0x5591('0x2')]},'sCity':{'type':Sequelize[_0x5591('0x2')]},'sCountry':{'type':Sequelize[_0x5591('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5a52=['exports','name','STRING','sequelize'];(function(_0x8468c5,_0x1c7ed4){var _0x4db462=function(_0xb557fa){while(--_0xb557fa){_0x8468c5['push'](_0x8468c5['shift']());}};_0x4db462(++_0x1c7ed4);}(_0x5a52,0xc3));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x25a5('0x0'));module[_0x25a5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x25a5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x25a5('0x3')]},'companyId':{'type':Sequelize[_0x25a5('0x3')]},'website':{'type':Sequelize[_0x25a5('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x25a5('0x3')]},'type':{'type':Sequelize[_0x25a5('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x25a5('0x3')]},'country':{'type':Sequelize[_0x25a5('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x25a5('0x3')]},'sStreet':{'type':Sequelize[_0x25a5('0x3')]},'sPostalCode':{'type':Sequelize[_0x25a5('0x3')]},'sCity':{'type':Sequelize[_0x25a5('0x3')]},'sCountry':{'type':Sequelize[_0x25a5('0x3')]},'description':{'type':Sequelize[_0x25a5('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7275b2b..98d107f 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 _0xbfb8=['../../mysqldb','status','end','offset','undefined','Content-Range','json','apply','reject','save','then','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','map','count','includeAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','autoAssociation','update','destroy','addContacts','CmContact','ids','omit','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x44ab0b,_0x4a2fc4){var _0x54f695=function(_0x27da24){while(--_0x27da24){_0x44ab0b['push'](_0x44ab0b['shift']());}};_0x54f695(++_0x4a2fc4);}(_0xbfb8,0x195));var _0x8bfb=function(_0xf7d2be,_0x559b6c){_0xf7d2be=_0xf7d2be-0x0;var _0x1e62c3=_0xbfb8[_0xf7d2be];return _0x1e62c3;};'use strict';var emlformat=require(_0x8bfb('0x0'));var rimraf=require(_0x8bfb('0x1'));var zipdir=require(_0x8bfb('0x2'));var jsonpatch=require(_0x8bfb('0x3'));var rp=require(_0x8bfb('0x4'));var moment=require(_0x8bfb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8bfb('0x6'));var util=require('util');var path=require(_0x8bfb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8bfb('0x8'));var fs=require('fs');var fs_extra=require(_0x8bfb('0x9'));var _=require(_0x8bfb('0xa'));var squel=require(_0x8bfb('0xb'));var crypto=require(_0x8bfb('0xc'));var jsforce=require(_0x8bfb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8bfb('0xe'));var querystring=require(_0x8bfb('0xf'));var Papa=require(_0x8bfb('0x10'));var Redis=require(_0x8bfb('0x11'));var authService=require(_0x8bfb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8bfb('0x13'));var hardwareService=require(_0x8bfb('0x14'));var logger=require(_0x8bfb('0x15'))(_0x8bfb('0x16'));var utils=require('../../config/utils');var config=require(_0x8bfb('0x17'));var licenseUtil=require(_0x8bfb('0x18'));var db=require(_0x8bfb('0x19'))['db'];function respondWithStatusCode(_0x12dec1,_0x4ac179){_0x4ac179=_0x4ac179||0xcc;return function(_0x4985c5){if(_0x4985c5){return _0x12dec1['sendStatus'](_0x4ac179);}return _0x12dec1[_0x8bfb('0x1a')](_0x4ac179)[_0x8bfb('0x1b')]();};}function respondWithResult(_0x48e8a0,_0x36657f){_0x36657f=_0x36657f||0xc8;return function(_0x52e22b){if(_0x52e22b){return _0x48e8a0[_0x8bfb('0x1a')](_0x36657f)['json'](_0x52e22b);}};}function respondWithFilteredResult(_0x5c615d,_0x31a02c){return function(_0x87c62a){if(_0x87c62a){var _0x1a10ad=typeof _0x31a02c[_0x8bfb('0x1c')]===_0x8bfb('0x1d')&&typeof _0x31a02c['limit']===_0x8bfb('0x1d');var _0xbe5c42=_0x87c62a['count'];var _0x2a7ea2=_0x1a10ad?0x0:_0x31a02c[_0x8bfb('0x1c')];var _0x301c8a=_0x1a10ad?_0x87c62a['count']:_0x31a02c[_0x8bfb('0x1c')]+_0x31a02c['limit'];var _0x4ca033;if(_0x301c8a>=_0xbe5c42){_0x301c8a=_0xbe5c42;_0x4ca033=0xc8;}else{_0x4ca033=0xce;}_0x5c615d[_0x8bfb('0x1a')](_0x4ca033);return _0x5c615d['set'](_0x8bfb('0x1e'),_0x2a7ea2+'-'+_0x301c8a+'/'+_0xbe5c42)[_0x8bfb('0x1f')](_0x87c62a);}return null;};}function patchUpdates(_0xc949c7){return function(_0x2da1c0){try{jsonpatch[_0x8bfb('0x20')](_0x2da1c0,_0xc949c7,!![]);}catch(_0x1e36f0){return BPromise[_0x8bfb('0x21')](_0x1e36f0);}return _0x2da1c0[_0x8bfb('0x22')]();};}function saveUpdates(_0x11d2fa,_0x1220ac){return function(_0x56a39c){if(_0x56a39c){return _0x56a39c['update'](_0x11d2fa)['then'](function(_0x31b718){return _0x31b718;});}return null;};}function removeEntity(_0x1a412b,_0x5a8673){return function(_0x259b18){if(_0x259b18){return _0x259b18['destroy']()[_0x8bfb('0x23')](function(){var _0x4622d7=_0x259b18['get']({'plain':!![]});var _0x2a290c='Companies';return db[_0x8bfb('0x24')]['destroy']({'where':{'type':_0x2a290c,'resourceId':_0x4622d7['id']}})[_0x8bfb('0x23')](function(){return _0x259b18;});})['then'](function(){_0x1a412b[_0x8bfb('0x1a')](0xcc)[_0x8bfb('0x1b')]();});}};}function handleEntityNotFound(_0x2be4de,_0x59e449){return function(_0x539c6b){if(!_0x539c6b){_0x2be4de[_0x8bfb('0x25')](0x194);}return _0x539c6b;};}function handleError(_0x187849,_0x487462){_0x487462=_0x487462||0x1f4;return function(_0x58bd61){logger[_0x8bfb('0x26')](_0x58bd61[_0x8bfb('0x27')]);if(_0x58bd61[_0x8bfb('0x28')]){delete _0x58bd61['name'];}_0x187849[_0x8bfb('0x1a')](_0x487462)[_0x8bfb('0x29')](_0x58bd61);};}exports[_0x8bfb('0x2a')]=function(_0x5bef19,_0xd6e3fe){var _0x5dfd1b={},_0x1b27da={},_0x6bd547={'count':0x0,'rows':[]};return db[_0x8bfb('0x2b')][_0x8bfb('0x2c')]()[_0x8bfb('0x23')](function(_0x48a054){_0x1b27da[_0x8bfb('0x2d')]=_[_0x8bfb('0x2e')](_0x48a054);_0x1b27da[_0x8bfb('0x2f')]=_[_0x8bfb('0x2e')](_0x5bef19[_0x8bfb('0x2f')]);_0x1b27da[_0x8bfb('0x30')]=_[_0x8bfb('0x31')](_0x1b27da[_0x8bfb('0x2d')],_0x1b27da[_0x8bfb('0x2f')]);_0x5dfd1b[_0x8bfb('0x32')]=_['intersection'](_0x1b27da[_0x8bfb('0x2d')],qs['fields'](_0x5bef19['query'][_0x8bfb('0x33')]));_0x5dfd1b[_0x8bfb('0x32')]=_0x5dfd1b[_0x8bfb('0x32')][_0x8bfb('0x34')]?_0x5dfd1b[_0x8bfb('0x32')]:_0x1b27da[_0x8bfb('0x2d')];if(!_0x5bef19[_0x8bfb('0x2f')][_0x8bfb('0x35')](_0x8bfb('0x36'))){_0x5dfd1b[_0x8bfb('0x37')]=qs[_0x8bfb('0x37')](_0x5bef19['query']['limit']);_0x5dfd1b[_0x8bfb('0x1c')]=qs['offset'](_0x5bef19[_0x8bfb('0x2f')][_0x8bfb('0x1c')]);}_0x5dfd1b['order']=qs[_0x8bfb('0x38')](_0x5bef19['query'][_0x8bfb('0x38')]);_0x5dfd1b[_0x8bfb('0x39')]=qs[_0x8bfb('0x30')](_['pick'](_0x5bef19['query'],_0x1b27da[_0x8bfb('0x30')]),_0x48a054);if(_0x5bef19['query'][_0x8bfb('0x3a')]){_0x5dfd1b['where']=_[_0x8bfb('0x3b')](_0x5dfd1b[_0x8bfb('0x39')],{'$or':_[_0x8bfb('0x3c')](_0x5dfd1b[_0x8bfb('0x32')],function(_0x485f38){var _0x4e7a15={};_0x4e7a15[_0x485f38]={'$like':'%'+_0x5bef19[_0x8bfb('0x2f')]['filter']+'%'};return _0x4e7a15;})});}_0x5dfd1b=_['merge']({},_0x5dfd1b,_0x5bef19['options']);var _0xbffa9d={'where':_0x5dfd1b['where']};return db[_0x8bfb('0x2b')][_0x8bfb('0x3d')](_0xbffa9d)[_0x8bfb('0x23')](function(_0x4b2163){_0x6bd547[_0x8bfb('0x3d')]=_0x4b2163;if(_0x5bef19[_0x8bfb('0x2f')][_0x8bfb('0x3e')]){_0x5dfd1b['include']=[{'all':!![]}];}return db[_0x8bfb('0x2b')]['findAll'](_0x5dfd1b);})[_0x8bfb('0x23')](function(_0x2855f6){_0x6bd547[_0x8bfb('0x3f')]=_0x2855f6;return _0x6bd547;})[_0x8bfb('0x23')](respondWithFilteredResult(_0xd6e3fe,_0x5dfd1b))[_0x8bfb('0x40')](handleError(_0xd6e3fe,null));})[_0x8bfb('0x40')](handleError(_0xd6e3fe,null));};exports[_0x8bfb('0x41')]=function(_0x4d5806,_0x527421){var _0x19f42e={'raw':![],'where':{'id':_0x4d5806[_0x8bfb('0x42')]['id']}},_0x5dbe5d={};_0x5dbe5d[_0x8bfb('0x2d')]=_['keys'](db[_0x8bfb('0x2b')][_0x8bfb('0x43')]);_0x5dbe5d[_0x8bfb('0x2f')]=_[_0x8bfb('0x2e')](_0x4d5806[_0x8bfb('0x2f')]);_0x5dbe5d[_0x8bfb('0x30')]=_['intersection'](_0x5dbe5d['model'],_0x5dbe5d[_0x8bfb('0x2f')]);_0x19f42e[_0x8bfb('0x32')]=_[_0x8bfb('0x31')](_0x5dbe5d['model'],qs[_0x8bfb('0x33')](_0x4d5806[_0x8bfb('0x2f')][_0x8bfb('0x33')]));_0x19f42e['attributes']=_0x19f42e[_0x8bfb('0x32')][_0x8bfb('0x34')]?_0x19f42e[_0x8bfb('0x32')]:_0x5dbe5d[_0x8bfb('0x2d')];if(_0x4d5806[_0x8bfb('0x2f')][_0x8bfb('0x3e')]){_0x19f42e[_0x8bfb('0x44')]=[{'all':!![]}];}_0x19f42e=_['merge']({},_0x19f42e,_0x4d5806[_0x8bfb('0x45')]);return db['CmCompany'][_0x8bfb('0x46')](_0x19f42e)['then'](handleEntityNotFound(_0x527421,null))[_0x8bfb('0x23')](respondWithResult(_0x527421,null))[_0x8bfb('0x40')](handleError(_0x527421,null));};exports['create']=function(_0x36742e,_0x97f27a){return db[_0x8bfb('0x2b')][_0x8bfb('0x47')](_0x36742e[_0x8bfb('0x48')],{})['then'](function(_0x567824){var _0x1f2bf2=_0x36742e['user'][_0x8bfb('0x49')]({'plain':!![]});if(!_0x1f2bf2)throw new Error(_0x8bfb('0x4a'));if(_0x1f2bf2[_0x8bfb('0x4b')]==='user'){var _0x1b2ef5=_0x567824[_0x8bfb('0x49')]({'plain':!![]});var _0x38e2aa=_0x8bfb('0x4c');return db[_0x8bfb('0x4d')][_0x8bfb('0x46')]({'where':{'name':_0x38e2aa,'userProfileId':_0x1f2bf2['userProfileId']},'raw':!![]})[_0x8bfb('0x23')](function(_0x173ca1){if(_0x173ca1&&_0x173ca1[_0x8bfb('0x4e')]===0x0){return db[_0x8bfb('0x24')][_0x8bfb('0x47')]({'name':_0x1b2ef5[_0x8bfb('0x28')],'resourceId':_0x1b2ef5['id'],'type':_0x173ca1[_0x8bfb('0x28')],'sectionId':_0x173ca1['id']},{})[_0x8bfb('0x23')](function(){return _0x567824;});}else{return _0x567824;}})['catch'](function(_0x24a89d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24a89d);throw _0x24a89d;});}return _0x567824;})[_0x8bfb('0x23')](respondWithResult(_0x97f27a,0xc9))[_0x8bfb('0x40')](handleError(_0x97f27a,null));};exports[_0x8bfb('0x4f')]=function(_0x429620,_0x2a731d){if(_0x429620['body']['id']){delete _0x429620[_0x8bfb('0x48')]['id'];}return db[_0x8bfb('0x2b')][_0x8bfb('0x46')]({'where':{'id':_0x429620[_0x8bfb('0x42')]['id']}})[_0x8bfb('0x23')](handleEntityNotFound(_0x2a731d,null))['then'](saveUpdates(_0x429620['body'],null))[_0x8bfb('0x23')](respondWithResult(_0x2a731d,null))[_0x8bfb('0x40')](handleError(_0x2a731d,null));};exports[_0x8bfb('0x50')]=function(_0x13754b,_0x24ae60){return db[_0x8bfb('0x2b')][_0x8bfb('0x46')]({'where':{'id':_0x13754b[_0x8bfb('0x42')]['id']}})[_0x8bfb('0x23')](handleEntityNotFound(_0x24ae60,null))['then'](removeEntity(_0x24ae60,null))[_0x8bfb('0x40')](handleError(_0x24ae60,null));};exports['describe']=function(_0x1121e7,_0x353e64){return db[_0x8bfb('0x2b')][_0x8bfb('0x2c')]()[_0x8bfb('0x23')](respondWithResult(_0x353e64,null))[_0x8bfb('0x40')](handleError(_0x353e64,null));};exports[_0x8bfb('0x51')]=function(_0x44360d,_0x5a63c9,_0xd1099b){return db[_0x8bfb('0x52')][_0x8bfb('0x46')]({'where':{'id':_0x44360d[_0x8bfb('0x42')]['id']}})[_0x8bfb('0x23')](handleEntityNotFound(_0x5a63c9,null))['then'](function(_0x90d476){if(_0x90d476){return _0x90d476['addContacts'](_0x44360d[_0x8bfb('0x48')][_0x8bfb('0x53')],_[_0x8bfb('0x54')](_0x44360d[_0x8bfb('0x48')],[_0x8bfb('0x53'),'id'])||{});}})[_0x8bfb('0x23')](respondWithResult(_0x5a63c9,null))[_0x8bfb('0x40')](handleError(_0x5a63c9,null));};exports['getContacts']=function(_0x405c91,_0x1a6631,_0x50715f){var _0x378879={};var _0x566903={};var _0x8ac9ce;var _0xbfb29b;return db[_0x8bfb('0x2b')]['findOne']({'where':{'id':_0x405c91[_0x8bfb('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a6631,null))['then'](function(_0x23d001){if(_0x23d001){_0x8ac9ce=_0x23d001;_0x566903[_0x8bfb('0x2d')]=_[_0x8bfb('0x2e')](db[_0x8bfb('0x52')][_0x8bfb('0x43')]);_0x566903[_0x8bfb('0x2f')]=_[_0x8bfb('0x2e')](_0x405c91[_0x8bfb('0x2f')]);_0x566903[_0x8bfb('0x30')]=_[_0x8bfb('0x31')](_0x566903[_0x8bfb('0x2d')],_0x566903[_0x8bfb('0x2f')]);_0x378879[_0x8bfb('0x32')]=_[_0x8bfb('0x31')](_0x566903[_0x8bfb('0x2d')],qs[_0x8bfb('0x33')](_0x405c91['query'][_0x8bfb('0x33')]));_0x378879[_0x8bfb('0x32')]=_0x378879[_0x8bfb('0x32')][_0x8bfb('0x34')]?_0x378879[_0x8bfb('0x32')]:_0x566903[_0x8bfb('0x2d')];_0x378879['order']=qs[_0x8bfb('0x38')](_0x405c91['query'][_0x8bfb('0x38')]);_0x378879[_0x8bfb('0x39')]=qs[_0x8bfb('0x30')](_['pick'](_0x405c91[_0x8bfb('0x2f')],_0x566903['filters']));if(_0x405c91[_0x8bfb('0x2f')][_0x8bfb('0x3a')]){_0x378879[_0x8bfb('0x39')]=_[_0x8bfb('0x3b')](_0x378879[_0x8bfb('0x39')],{'$or':_['map'](_0x378879[_0x8bfb('0x32')],function(_0x1d1312){var _0x360210={};_0x360210[_0x1d1312]={'$like':'%'+_0x405c91[_0x8bfb('0x2f')]['filter']+'%'};return _0x360210;})});}_0x378879=_[_0x8bfb('0x3b')]({},_0x378879,_0x405c91[_0x8bfb('0x45')]);return _0x8ac9ce[_0x8bfb('0x55')](_0x378879);}})[_0x8bfb('0x23')](function(_0x5580c0){if(_0x5580c0){_0xbfb29b=_0x5580c0[_0x8bfb('0x34')];if(!_0x405c91[_0x8bfb('0x2f')][_0x8bfb('0x35')]('nolimit')){_0x378879[_0x8bfb('0x37')]=qs[_0x8bfb('0x37')](_0x405c91[_0x8bfb('0x2f')][_0x8bfb('0x37')]);_0x378879['offset']=qs[_0x8bfb('0x1c')](_0x405c91['query'][_0x8bfb('0x1c')]);}return _0x8ac9ce['getContacts'](_0x378879);}})['then'](function(_0x32daf5){if(_0x32daf5){return _0x32daf5?{'count':_0xbfb29b,'rows':_0x32daf5}:null;}})['then'](respondWithResult(_0x1a6631,null))['catch'](handleError(_0x1a6631,null));}; \ No newline at end of file +var _0x8997=['json','offset','undefined','limit','count','set','apply','reject','save','then','get','UserProfileResource','end','error','stack','name','send','index','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','map','merge','options','includeAll','include','catch','show','params','rawAttributes','CmCompany','find','create','body','role','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','CmContact','addContacts','omit','ids','findOne','order','filter','getContacts','fast-json-patch','request-promise','bluebird','mustache','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x50c89d,_0xb15283){var _0x2d4011=function(_0x2650fc){while(--_0x2650fc){_0x50c89d['push'](_0x50c89d['shift']());}};_0x2d4011(++_0xb15283);}(_0x8997,0x91));var _0x7899=function(_0x4256df,_0x28716d){_0x4256df=_0x4256df-0x0;var _0x389042=_0x8997[_0x4256df];return _0x389042;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7899('0x0'));var rp=require(_0x7899('0x1'));var moment=require('moment');var BPromise=require(_0x7899('0x2'));var Mustache=require(_0x7899('0x3'));var util=require('util');var path=require('path');var sox=require(_0x7899('0x4'));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(_0x7899('0x5'));var crypto=require(_0x7899('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x7899('0x7'));var toCsv=require(_0x7899('0x8'));var querystring=require(_0x7899('0x9'));var Papa=require(_0x7899('0xa'));var Redis=require(_0x7899('0xb'));var authService=require(_0x7899('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x7899('0xd'));var hardwareService=require(_0x7899('0xe'));var logger=require(_0x7899('0xf'))(_0x7899('0x10'));var utils=require(_0x7899('0x11'));var config=require(_0x7899('0x12'));var licenseUtil=require(_0x7899('0x13'));var db=require(_0x7899('0x14'))['db'];function respondWithStatusCode(_0x2f10ae,_0x567551){_0x567551=_0x567551||0xcc;return function(_0x1ac303){if(_0x1ac303){return _0x2f10ae[_0x7899('0x15')](_0x567551);}return _0x2f10ae[_0x7899('0x16')](_0x567551)['end']();};}function respondWithResult(_0xc31d1d,_0x580c9e){_0x580c9e=_0x580c9e||0xc8;return function(_0x3e2132){if(_0x3e2132){return _0xc31d1d[_0x7899('0x16')](_0x580c9e)[_0x7899('0x17')](_0x3e2132);}};}function respondWithFilteredResult(_0x12e9f3,_0x3a50d1){return function(_0x151108){if(_0x151108){var _0x9d0ecc=typeof _0x3a50d1[_0x7899('0x18')]===_0x7899('0x19')&&typeof _0x3a50d1[_0x7899('0x1a')]==='undefined';var _0x246a52=_0x151108['count'];var _0x5b0fa0=_0x9d0ecc?0x0:_0x3a50d1[_0x7899('0x18')];var _0x19b84c=_0x9d0ecc?_0x151108[_0x7899('0x1b')]:_0x3a50d1[_0x7899('0x18')]+_0x3a50d1[_0x7899('0x1a')];var _0x56cc27;if(_0x19b84c>=_0x246a52){_0x19b84c=_0x246a52;_0x56cc27=0xc8;}else{_0x56cc27=0xce;}_0x12e9f3[_0x7899('0x16')](_0x56cc27);return _0x12e9f3[_0x7899('0x1c')]('Content-Range',_0x5b0fa0+'-'+_0x19b84c+'/'+_0x246a52)['json'](_0x151108);}return null;};}function patchUpdates(_0x34b18a){return function(_0x44eab6){try{jsonpatch[_0x7899('0x1d')](_0x44eab6,_0x34b18a,!![]);}catch(_0x2e5103){return BPromise[_0x7899('0x1e')](_0x2e5103);}return _0x44eab6[_0x7899('0x1f')]();};}function saveUpdates(_0x370f55,_0x5799e0){return function(_0x1931b6){if(_0x1931b6){return _0x1931b6['update'](_0x370f55)[_0x7899('0x20')](function(_0x317a7d){return _0x317a7d;});}return null;};}function removeEntity(_0x19b659,_0x1fd7d5){return function(_0x5541bd){if(_0x5541bd){return _0x5541bd['destroy']()[_0x7899('0x20')](function(){var _0x54dac9=_0x5541bd[_0x7899('0x21')]({'plain':!![]});var _0x504436='Companies';return db[_0x7899('0x22')]['destroy']({'where':{'type':_0x504436,'resourceId':_0x54dac9['id']}})[_0x7899('0x20')](function(){return _0x5541bd;});})[_0x7899('0x20')](function(){_0x19b659[_0x7899('0x16')](0xcc)[_0x7899('0x23')]();});}};}function handleEntityNotFound(_0x413e01,_0x50f960){return function(_0x2078ea){if(!_0x2078ea){_0x413e01[_0x7899('0x15')](0x194);}return _0x2078ea;};}function handleError(_0x4e8088,_0x57483a){_0x57483a=_0x57483a||0x1f4;return function(_0x3f66e1){logger[_0x7899('0x24')](_0x3f66e1[_0x7899('0x25')]);if(_0x3f66e1[_0x7899('0x26')]){delete _0x3f66e1[_0x7899('0x26')];}_0x4e8088[_0x7899('0x16')](_0x57483a)[_0x7899('0x27')](_0x3f66e1);};}exports[_0x7899('0x28')]=function(_0x3848bb,_0x304331){var _0x51aef5={},_0x4ef86c={},_0x4213b5={'count':0x0,'rows':[]};return db['CmCompany']['describe']()['then'](function(_0x1aff66){_0x4ef86c['model']=_[_0x7899('0x29')](_0x1aff66);_0x4ef86c[_0x7899('0x2a')]=_[_0x7899('0x29')](_0x3848bb[_0x7899('0x2a')]);_0x4ef86c[_0x7899('0x2b')]=_[_0x7899('0x2c')](_0x4ef86c[_0x7899('0x2d')],_0x4ef86c['query']);_0x51aef5[_0x7899('0x2e')]=_[_0x7899('0x2c')](_0x4ef86c[_0x7899('0x2d')],qs[_0x7899('0x2f')](_0x3848bb[_0x7899('0x2a')]['fields']));_0x51aef5[_0x7899('0x2e')]=_0x51aef5[_0x7899('0x2e')][_0x7899('0x30')]?_0x51aef5[_0x7899('0x2e')]:_0x4ef86c[_0x7899('0x2d')];if(!_0x3848bb[_0x7899('0x2a')][_0x7899('0x31')](_0x7899('0x32'))){_0x51aef5[_0x7899('0x1a')]=qs[_0x7899('0x1a')](_0x3848bb[_0x7899('0x2a')][_0x7899('0x1a')]);_0x51aef5[_0x7899('0x18')]=qs[_0x7899('0x18')](_0x3848bb['query'][_0x7899('0x18')]);}_0x51aef5['order']=qs[_0x7899('0x33')](_0x3848bb[_0x7899('0x2a')][_0x7899('0x33')]);_0x51aef5[_0x7899('0x34')]=qs[_0x7899('0x2b')](_[_0x7899('0x35')](_0x3848bb[_0x7899('0x2a')],_0x4ef86c['filters']),_0x1aff66);if(_0x3848bb[_0x7899('0x2a')]['filter']){_0x51aef5['where']=_['merge'](_0x51aef5[_0x7899('0x34')],{'$or':_[_0x7899('0x36')](_0x51aef5[_0x7899('0x2e')],function(_0x4cf08e){var _0x31edee={};_0x31edee[_0x4cf08e]={'$like':'%'+_0x3848bb['query']['filter']+'%'};return _0x31edee;})});}_0x51aef5=_[_0x7899('0x37')]({},_0x51aef5,_0x3848bb[_0x7899('0x38')]);var _0x1527bf={'where':_0x51aef5[_0x7899('0x34')]};return db['CmCompany'][_0x7899('0x1b')](_0x1527bf)['then'](function(_0x2e7baf){_0x4213b5[_0x7899('0x1b')]=_0x2e7baf;if(_0x3848bb[_0x7899('0x2a')][_0x7899('0x39')]){_0x51aef5[_0x7899('0x3a')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x51aef5);})[_0x7899('0x20')](function(_0x51797c){_0x4213b5['rows']=_0x51797c;return _0x4213b5;})[_0x7899('0x20')](respondWithFilteredResult(_0x304331,_0x51aef5))[_0x7899('0x3b')](handleError(_0x304331,null));})[_0x7899('0x3b')](handleError(_0x304331,null));};exports[_0x7899('0x3c')]=function(_0x21cf80,_0x129771){var _0x1878e6={'raw':![],'where':{'id':_0x21cf80[_0x7899('0x3d')]['id']}},_0x17ea9b={};_0x17ea9b[_0x7899('0x2d')]=_[_0x7899('0x29')](db['CmCompany'][_0x7899('0x3e')]);_0x17ea9b['query']=_['keys'](_0x21cf80['query']);_0x17ea9b[_0x7899('0x2b')]=_['intersection'](_0x17ea9b[_0x7899('0x2d')],_0x17ea9b[_0x7899('0x2a')]);_0x1878e6['attributes']=_['intersection'](_0x17ea9b['model'],qs['fields'](_0x21cf80[_0x7899('0x2a')][_0x7899('0x2f')]));_0x1878e6['attributes']=_0x1878e6[_0x7899('0x2e')][_0x7899('0x30')]?_0x1878e6[_0x7899('0x2e')]:_0x17ea9b['model'];if(_0x21cf80[_0x7899('0x2a')][_0x7899('0x39')]){_0x1878e6[_0x7899('0x3a')]=[{'all':!![]}];}_0x1878e6=_[_0x7899('0x37')]({},_0x1878e6,_0x21cf80[_0x7899('0x38')]);return db[_0x7899('0x3f')][_0x7899('0x40')](_0x1878e6)[_0x7899('0x20')](handleEntityNotFound(_0x129771,null))[_0x7899('0x20')](respondWithResult(_0x129771,null))[_0x7899('0x3b')](handleError(_0x129771,null));};exports[_0x7899('0x41')]=function(_0x51e745,_0x12e7f9){return db[_0x7899('0x3f')][_0x7899('0x41')](_0x51e745[_0x7899('0x42')],{})['then'](function(_0x5ea572){var _0x4da096=_0x51e745['user']['get']({'plain':!![]});if(!_0x4da096)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4da096[_0x7899('0x43')]==='user'){var _0x15f70e=_0x5ea572[_0x7899('0x21')]({'plain':!![]});var _0x3d57b0=_0x7899('0x44');return db[_0x7899('0x45')][_0x7899('0x40')]({'where':{'name':_0x3d57b0,'userProfileId':_0x4da096[_0x7899('0x46')]},'raw':!![]})['then'](function(_0x50b3f6){if(_0x50b3f6&&_0x50b3f6[_0x7899('0x47')]===0x0){return db[_0x7899('0x22')]['create']({'name':_0x15f70e['name'],'resourceId':_0x15f70e['id'],'type':_0x50b3f6[_0x7899('0x26')],'sectionId':_0x50b3f6['id']},{})[_0x7899('0x20')](function(){return _0x5ea572;});}else{return _0x5ea572;}})['catch'](function(_0x3912b9){logger[_0x7899('0x24')](_0x7899('0x48'),_0x3912b9);throw _0x3912b9;});}return _0x5ea572;})[_0x7899('0x20')](respondWithResult(_0x12e7f9,0xc9))[_0x7899('0x3b')](handleError(_0x12e7f9,null));};exports[_0x7899('0x49')]=function(_0xd39e3c,_0x4ed274){if(_0xd39e3c[_0x7899('0x42')]['id']){delete _0xd39e3c['body']['id'];}return db[_0x7899('0x3f')][_0x7899('0x40')]({'where':{'id':_0xd39e3c['params']['id']}})[_0x7899('0x20')](handleEntityNotFound(_0x4ed274,null))['then'](saveUpdates(_0xd39e3c[_0x7899('0x42')],null))[_0x7899('0x20')](respondWithResult(_0x4ed274,null))[_0x7899('0x3b')](handleError(_0x4ed274,null));};exports[_0x7899('0x4a')]=function(_0x414525,_0x1129fb){return db[_0x7899('0x3f')]['find']({'where':{'id':_0x414525[_0x7899('0x3d')]['id']}})[_0x7899('0x20')](handleEntityNotFound(_0x1129fb,null))['then'](removeEntity(_0x1129fb,null))[_0x7899('0x3b')](handleError(_0x1129fb,null));};exports[_0x7899('0x4b')]=function(_0x124278,_0x581a36){return db[_0x7899('0x3f')][_0x7899('0x4b')]()['then'](respondWithResult(_0x581a36,null))['catch'](handleError(_0x581a36,null));};exports['addContacts']=function(_0x11f8cf,_0x1674f8,_0x50961f){return db[_0x7899('0x4c')]['find']({'where':{'id':_0x11f8cf[_0x7899('0x3d')]['id']}})[_0x7899('0x20')](handleEntityNotFound(_0x1674f8,null))['then'](function(_0x16302d){if(_0x16302d){return _0x16302d[_0x7899('0x4d')](_0x11f8cf['body']['ids'],_[_0x7899('0x4e')](_0x11f8cf[_0x7899('0x42')],[_0x7899('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x1674f8,null))[_0x7899('0x3b')](handleError(_0x1674f8,null));};exports['getContacts']=function(_0x130763,_0x2d7413,_0x18bef2){var _0x2ffdcb={};var _0x5ac46a={};var _0x29602a;var _0x266fd0;return db[_0x7899('0x3f')][_0x7899('0x50')]({'where':{'id':_0x130763[_0x7899('0x3d')]['id']}})[_0x7899('0x20')](handleEntityNotFound(_0x2d7413,null))[_0x7899('0x20')](function(_0x5a32ed){if(_0x5a32ed){_0x29602a=_0x5a32ed;_0x5ac46a[_0x7899('0x2d')]=_[_0x7899('0x29')](db[_0x7899('0x4c')]['rawAttributes']);_0x5ac46a['query']=_['keys'](_0x130763[_0x7899('0x2a')]);_0x5ac46a[_0x7899('0x2b')]=_[_0x7899('0x2c')](_0x5ac46a['model'],_0x5ac46a[_0x7899('0x2a')]);_0x2ffdcb[_0x7899('0x2e')]=_['intersection'](_0x5ac46a[_0x7899('0x2d')],qs[_0x7899('0x2f')](_0x130763[_0x7899('0x2a')][_0x7899('0x2f')]));_0x2ffdcb[_0x7899('0x2e')]=_0x2ffdcb[_0x7899('0x2e')][_0x7899('0x30')]?_0x2ffdcb[_0x7899('0x2e')]:_0x5ac46a[_0x7899('0x2d')];_0x2ffdcb[_0x7899('0x51')]=qs[_0x7899('0x33')](_0x130763[_0x7899('0x2a')]['sort']);_0x2ffdcb[_0x7899('0x34')]=qs[_0x7899('0x2b')](_[_0x7899('0x35')](_0x130763[_0x7899('0x2a')],_0x5ac46a[_0x7899('0x2b')]));if(_0x130763[_0x7899('0x2a')][_0x7899('0x52')]){_0x2ffdcb[_0x7899('0x34')]=_[_0x7899('0x37')](_0x2ffdcb[_0x7899('0x34')],{'$or':_[_0x7899('0x36')](_0x2ffdcb[_0x7899('0x2e')],function(_0x4952d9){var _0x17dbac={};_0x17dbac[_0x4952d9]={'$like':'%'+_0x130763[_0x7899('0x2a')][_0x7899('0x52')]+'%'};return _0x17dbac;})});}_0x2ffdcb=_[_0x7899('0x37')]({},_0x2ffdcb,_0x130763[_0x7899('0x38')]);return _0x29602a[_0x7899('0x53')](_0x2ffdcb);}})[_0x7899('0x20')](function(_0x476e29){if(_0x476e29){_0x266fd0=_0x476e29[_0x7899('0x30')];if(!_0x130763[_0x7899('0x2a')]['hasOwnProperty'](_0x7899('0x32'))){_0x2ffdcb[_0x7899('0x1a')]=qs['limit'](_0x130763['query'][_0x7899('0x1a')]);_0x2ffdcb[_0x7899('0x18')]=qs[_0x7899('0x18')](_0x130763[_0x7899('0x2a')][_0x7899('0x18')]);}return _0x29602a['getContacts'](_0x2ffdcb);}})[_0x7899('0x20')](function(_0x388f8d){if(_0x388f8d){return _0x388f8d?{'count':_0x266fd0,'rows':_0x388f8d}:null;}})[_0x7899('0x20')](respondWithResult(_0x2d7413,null))['catch'](handleError(_0x2d7413,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6b916d1..a8b0b24 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 _0x42cd=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','define','CmCompany','cm_companies'];(function(_0x4d168e,_0x2c6b65){var _0x2009e1=function(_0x51b144){while(--_0x51b144){_0x4d168e['push'](_0x4d168e['shift']());}};_0x2009e1(++_0x2c6b65);}(_0x42cd,0xf0));var _0xd42c=function(_0x3282a2,_0xb4b2c9){_0x3282a2=_0x3282a2-0x0;var _0xdec417=_0x42cd[_0x3282a2];return _0xdec417;};'use strict';var _=require(_0xd42c('0x0'));var util=require(_0xd42c('0x1'));var logger=require(_0xd42c('0x2'))(_0xd42c('0x3'));var moment=require('moment');var BPromise=require(_0xd42c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd42c('0x5'));var rimraf=require('rimraf');var config=require(_0xd42c('0x6'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x29bc09,_0xa3d6f){return _0x29bc09[_0xd42c('0x7')](_0xd42c('0x8'),attributes,{'tableName':_0xd42c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x991d=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies'];(function(_0x47cf89,_0x3990bb){var _0x53fdf7=function(_0x1e5b81){while(--_0x1e5b81){_0x47cf89['push'](_0x47cf89['shift']());}};_0x53fdf7(++_0x3990bb);}(_0x991d,0xdc));var _0xd991=function(_0x170e68,_0x354ac5){_0x170e68=_0x170e68-0x0;var _0x4d2a76=_0x991d[_0x170e68];return _0x4d2a76;};'use strict';var _=require('lodash');var util=require(_0xd991('0x0'));var logger=require(_0xd991('0x1'))(_0xd991('0x2'));var moment=require('moment');var BPromise=require(_0xd991('0x3'));var rp=require(_0xd991('0x4'));var fs=require('fs');var path=require(_0xd991('0x5'));var rimraf=require('rimraf');var config=require(_0xd991('0x6'));var attributes=require(_0xd991('0x7'));module[_0xd991('0x8')]=function(_0x42f1ad,_0x16e098){return _0x42f1ad['define'](_0xd991('0x9'),attributes,{'tableName':_0xd991('0xa'),'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 18ea631..85645a9 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 _0xa59f=['error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa59f,0x16b));var _0xfa59=function(_0x51fe46,_0xb550d1){_0x51fe46=_0x51fe46-0x0;var _0x4d62c2=_0xa59f[_0x51fe46];return _0x4d62c2;};'use strict';var _=require(_0xfa59('0x0'));var util=require(_0xfa59('0x1'));var moment=require(_0xfa59('0x2'));var BPromise=require(_0xfa59('0x3'));var rs=require(_0xfa59('0x4'));var fs=require('fs');var Redis=require(_0xfa59('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfa59('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa59('0x7')][_0xfa59('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x345d54,_0x2af8f9,_0xfcb4e7){return new BPromise(function(_0x262e83,_0x137313){return client[_0xfa59('0x9')](_0x345d54,_0xfcb4e7)['then'](function(_0x235563){logger[_0xfa59('0xa')](_0xfa59('0xb'),_0x2af8f9,'request\x20sent');logger[_0xfa59('0xc')](_0xfa59('0xd'),_0x2af8f9,'request\x20sent',JSON[_0xfa59('0xe')](_0x235563));if(_0x235563[_0xfa59('0xf')]){if(_0x235563[_0xfa59('0xf')][_0xfa59('0x10')]===0x1f4){logger['error'](_0xfa59('0xb'),_0x2af8f9,_0x235563[_0xfa59('0xf')][_0xfa59('0x11')]);return _0x137313(_0x235563[_0xfa59('0xf')][_0xfa59('0x11')]);}logger[_0xfa59('0xf')]('CmCompany,\x20%s,\x20%s',_0x2af8f9,_0x235563['error'][_0xfa59('0x11')]);return _0x262e83(_0x235563[_0xfa59('0xf')][_0xfa59('0x11')]);}else{logger[_0xfa59('0xa')]('CmCompany,\x20%s,\x20%s',_0x2af8f9,_0xfa59('0x12'));_0x262e83(_0x235563[_0xfa59('0x13')]['message']);}})[_0xfa59('0x14')](function(_0x3e7983){logger[_0xfa59('0xf')]('CmCompany,\x20%s,\x20%s',_0x2af8f9,_0x3e7983);_0x137313(_0x3e7983);});});} \ No newline at end of file +var _0x547c=['catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x278acc,_0x5dd4c6){var _0x4fac69=function(_0x2aed8f){while(--_0x2aed8f){_0x278acc['push'](_0x278acc['shift']());}};_0x4fac69(++_0x5dd4c6);}(_0x547c,0x1cf));var _0xc547=function(_0x5baeb5,_0x2eed5a){_0x5baeb5=_0x5baeb5-0x0;var _0x1f85bb=_0x547c[_0x5baeb5];return _0x1f85bb;};'use strict';var _=require(_0xc547('0x0'));var util=require('util');var moment=require(_0xc547('0x1'));var BPromise=require(_0xc547('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc547('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc547('0x4'));var logger=require(_0xc547('0x5'))(_0xc547('0x6'));var config=require(_0xc547('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc547('0x8')][_0xc547('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45fc58,_0x558320,_0x5def89){return new BPromise(function(_0x265b0e,_0x3de0fa){return client['request'](_0x45fc58,_0x5def89)[_0xc547('0xa')](function(_0x3b74be){logger[_0xc547('0xb')](_0xc547('0xc'),_0x558320,_0xc547('0xd'));logger[_0xc547('0xe')](_0xc547('0xf'),_0x558320,_0xc547('0xd'),JSON[_0xc547('0x10')](_0x3b74be));if(_0x3b74be[_0xc547('0x11')]){if(_0x3b74be[_0xc547('0x11')][_0xc547('0x12')]===0x1f4){logger['error'](_0xc547('0xc'),_0x558320,_0x3b74be[_0xc547('0x11')][_0xc547('0x13')]);return _0x3de0fa(_0x3b74be['error'][_0xc547('0x13')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x558320,_0x3b74be['error']['message']);return _0x265b0e(_0x3b74be[_0xc547('0x11')][_0xc547('0x13')]);}else{logger[_0xc547('0xb')](_0xc547('0xc'),_0x558320,_0xc547('0xd'));_0x265b0e(_0x3b74be['result']['message']);}})[_0xc547('0x14')](function(_0x53faaa){logger[_0xc547('0x11')](_0xc547('0xc'),_0x558320,_0x53faaa);_0x3de0fa(_0x53faaa);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 30bf0e2..3a7411c 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 _0x2477=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','post','addContacts'];(function(_0x371a41,_0x2a19cc){var _0x360d99=function(_0x17a760){while(--_0x17a760){_0x371a41['push'](_0x371a41['shift']());}};_0x360d99(++_0x2a19cc);}(_0x2477,0x138));var _0x7247=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x2477[_0x3bef2c];return _0x331503;};'use strict';var multer=require(_0x7247('0x0'));var util=require(_0x7247('0x1'));var path=require(_0x7247('0x2'));var timeout=require(_0x7247('0x3'));var express=require(_0x7247('0x4'));var router=express[_0x7247('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7247('0x6'));var interaction=require(_0x7247('0x7'));var config=require('../../config/environment');var controller=require(_0x7247('0x8'));router[_0x7247('0x9')]('/',auth[_0x7247('0xa')](),controller[_0x7247('0xb')]);router[_0x7247('0x9')](_0x7247('0xc'),auth[_0x7247('0xa')](),controller[_0x7247('0xd')]);router[_0x7247('0x9')]('/:id',auth[_0x7247('0xa')](),controller[_0x7247('0xe')]);router[_0x7247('0x9')](_0x7247('0xf'),auth[_0x7247('0xa')](),controller['getContacts']);router['post']('/',auth[_0x7247('0xa')](),controller['create']);router[_0x7247('0x10')]('/:id/contacts',auth[_0x7247('0xa')](),controller[_0x7247('0x11')]);router[_0x7247('0x12')]('/:id',auth[_0x7247('0xa')](),controller[_0x7247('0x13')]);router[_0x7247('0x14')]('/:id',auth[_0x7247('0xa')](),controller['destroy']);module[_0x7247('0x15')]=router; \ No newline at end of file +var _0x6c67=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated','index','get','describe','show','getContacts','post','/:id/contacts','addContacts'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x6c67,0x1af));var _0x76c6=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x6c67[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0x76c6('0x0'));var util=require(_0x76c6('0x1'));var path=require(_0x76c6('0x2'));var timeout=require(_0x76c6('0x3'));var express=require(_0x76c6('0x4'));var router=express[_0x76c6('0x5')]();var fs_extra=require(_0x76c6('0x6'));var auth=require(_0x76c6('0x7'));var interaction=require(_0x76c6('0x8'));var config=require('../../config/environment');var controller=require(_0x76c6('0x9'));router['get']('/',auth[_0x76c6('0xa')](),controller[_0x76c6('0xb')]);router[_0x76c6('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x76c6('0xd')]);router['get']('/:id',auth[_0x76c6('0xa')](),controller[_0x76c6('0xe')]);router[_0x76c6('0xc')]('/:id/contacts',auth[_0x76c6('0xa')](),controller[_0x76c6('0xf')]);router[_0x76c6('0x10')]('/',auth[_0x76c6('0xa')](),controller['create']);router[_0x76c6('0x10')](_0x76c6('0x11'),auth[_0x76c6('0xa')](),controller[_0x76c6('0x12')]);router[_0x76c6('0x13')](_0x76c6('0x14'),auth[_0x76c6('0xa')](),controller[_0x76c6('0x15')]);router[_0x76c6('0x16')](_0x76c6('0x14'),auth[_0x76c6('0xa')](),controller[_0x76c6('0x17')]);module[_0x76c6('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6121b3a..de319d9 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 _0x80c1=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x80c1,0x68));var _0x180c=function(_0x437c62,_0x593e7a){_0x437c62=_0x437c62-0x0;var _0x6fb267=_0x80c1[_0x437c62];return _0x6fb267;};'use strict';var _=require('lodash');var Sequelize=require(_0x180c('0x0'));module[_0x180c('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x180c('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x180c('0x2')]},'country':{'type':Sequelize[_0x180c('0x2')]},'dateOfBirth':{'type':Sequelize[_0x180c('0x2')]},'description':{'type':Sequelize[_0x180c('0x3')]},'phone':{'type':Sequelize[_0x180c('0x2')]},'mobile':{'type':Sequelize[_0x180c('0x2')]},'fax':{'type':Sequelize[_0x180c('0x2')]},'email':{'type':Sequelize[_0x180c('0x2')]},'url':{'type':Sequelize[_0x180c('0x2')]},'facebook':{'type':Sequelize[_0x180c('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x180c('0x2')]},'skype':{'type':Sequelize[_0x180c('0x2')]},'teams':{'type':Sequelize[_0x180c('0x2')]},'viber':{'type':Sequelize[_0x180c('0x2')]},'line':{'type':Sequelize[_0x180c('0x2')]},'wechat':{'type':Sequelize[_0x180c('0x2')]},'telegram':{'type':Sequelize[_0x180c('0x2')]},'UserId':{'type':Sequelize[_0x180c('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x180c('0x2')]},'priority':{'type':Sequelize[_0x180c('0x4')](0x2)[_0x180c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x180c('0x6')],'defaultValue':Sequelize[_0x180c('0x7')]},'dialTimezone':{'type':Sequelize[_0x180c('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xea37=['NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x48cf1c,_0x232eea){var _0x3290e9=function(_0x5e5182){while(--_0x5e5182){_0x48cf1c['push'](_0x48cf1c['shift']());}};_0x3290e9(++_0x232eea);}(_0xea37,0xf6));var _0x7ea3=function(_0x5b7f3b,_0x58b085){_0x5b7f3b=_0x5b7f3b-0x0;var _0x13d5dc=_0xea37[_0x5b7f3b];return _0x13d5dc;};'use strict';var _=require(_0x7ea3('0x0'));var Sequelize=require('sequelize');module[_0x7ea3('0x1')]={'firstName':{'type':Sequelize[_0x7ea3('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x7ea3('0x2')]},'street':{'type':Sequelize[_0x7ea3('0x2')]},'postalCode':{'type':Sequelize[_0x7ea3('0x2')]},'city':{'type':Sequelize[_0x7ea3('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7ea3('0x3')]},'phone':{'type':Sequelize[_0x7ea3('0x2')]},'mobile':{'type':Sequelize[_0x7ea3('0x2')]},'fax':{'type':Sequelize[_0x7ea3('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x7ea3('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x7ea3('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x7ea3('0x2')]},'line':{'type':Sequelize[_0x7ea3('0x2')]},'wechat':{'type':Sequelize[_0x7ea3('0x2')]},'telegram':{'type':Sequelize[_0x7ea3('0x2')]},'UserId':{'type':Sequelize[_0x7ea3('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x7ea3('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x7ea3('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x7ea3('0x6')]},'dialTimezone':{'type':Sequelize[_0x7ea3('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 8ffb047..733e5b2 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 4eeed9a..7e68f42 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 _0x7340=['exports','events','CmContact','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7340,0x10f));var _0x0734=function(_0x1ad48e,_0x3ba0bb){_0x1ad48e=_0x1ad48e-0x0;var _0x2bdbc4=_0x7340[_0x1ad48e];return _0x2bdbc4;};'use strict';var EventEmitter=require(_0x0734('0x0'));var CmContact=require('../../mysqldb')['db'][_0x0734('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x0734('0x2')](0x0);var events={'afterCreate':_0x0734('0x3'),'afterUpdate':'update','afterDestroy':_0x0734('0x4')};function emitEvent(_0x2295e1){return function(_0x1a5413,_0x5163a8,_0x105671){CmContactEvents[_0x0734('0x5')](_0x2295e1+':'+_0x1a5413['id'],_0x1a5413);CmContactEvents[_0x0734('0x5')](_0x2295e1,_0x1a5413);_0x105671(null);};}for(var e in events){if(events[_0x0734('0x6')](e)){var event=events[e];CmContact[_0x0734('0x7')](e,emitEvent(event));}}module[_0x0734('0x8')]=CmContactEvents; \ No newline at end of file +var _0x28e5=['hasOwnProperty','exports','events','setMaxListeners','save','remove','emit'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x28e5,0x1a6));var _0x528e=function(_0x1c6ca2,_0x5ee3e2){_0x1c6ca2=_0x1c6ca2-0x0;var _0x5ccc0f=_0x28e5[_0x1c6ca2];return _0x5ccc0f;};'use strict';var EventEmitter=require(_0x528e('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x528e('0x1')](0x0);var events={'afterCreate':_0x528e('0x2'),'afterUpdate':'update','afterDestroy':_0x528e('0x3')};function emitEvent(_0x346b26){return function(_0xb8f42d,_0x382859,_0x2dc992){CmContactEvents['emit'](_0x346b26+':'+_0xb8f42d['id'],_0xb8f42d);CmContactEvents[_0x528e('0x4')](_0x346b26,_0xb8f42d);_0x2dc992(null);};}for(var e in events){if(events[_0x528e('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x528e('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index e91835c..cce44f7 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 _0x681d=['dialTimezone','VoiceQueue','findOne','then','utcOffset','minutes','ret','CmHopper','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','ListId','inspect','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','onlyIfOpen','BlackLists','length','cmContact,\x20%s,\x20%s','message','Campaign','CmHopperBlack','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Error]','lodash','util','moment','request-promise','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','fti_cm_contacts','firstName','lastName','phone','mobile','fax','FULLTEXT','utf8mb4','models','error','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil'];(function(_0x5bad3f,_0x42d5fe){var _0x5dde00=function(_0x4cce45){while(--_0x4cce45){_0x5bad3f['push'](_0x5bad3f['shift']());}};_0x5dde00(++_0x42d5fe);}(_0x681d,0x13a));var _0xd681=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x681d[_0x251d9c];return _0x16ae64;};'use strict';var _=require(_0xd681('0x0'));var util=require(_0xd681('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd681('0x2'));var BPromise=require('bluebird');var rp=require(_0xd681('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd681('0x4'));var config=require(_0xd681('0x5'));var shared=require(_0xd681('0x6'));var attributes=require(_0xd681('0x7'));module[_0xd681('0x8')]=function(_0xe577f9,_0x478c8a){return _0xe577f9[_0xd681('0x9')]('CmContact',attributes,{'tableName':_0xd681('0xa'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0xd681('0xb'),'fields':[_0xd681('0xc'),_0xd681('0xd'),_0xd681('0xe'),_0xd681('0xf'),_0xd681('0x10'),'email'],'type':_0xd681('0x11')}],'timestamps':!![],'charset':_0xd681('0x12'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x59515f,_0x4c0760,_0x845afe){var _0x394d58=_0xe577f9[_0xd681('0x13')];var _0x4209e5=_0x59515f['get']({'plain':!![]});function _0x50723b(){return function(_0x37f410){logger[_0xd681('0x14')]('cmContact',_0xd681('0x15'),util['inspect'](_0x37f410,{'showHidden':![],'depth':null}));};}function _0x2600a2(_0x454c28,_0x2419fb){var _0x462854=_0x2419fb[_0xd681('0x16')]?_0x2419fb[_0xd681('0x16')]:moment()[_0xd681('0x17')](_0xd681('0x18'));return new BPromise(function(_0x53be90,_0x330d7e){if(_[_0xd681('0x19')](_0x2419fb[_0xd681('0x1a')])){_0x53be90({'ret':_0x462854});}else{_0x394d58[_0xd681('0x1b')][_0xd681('0x1c')]({'where':{'id':_0x454c28['id']}})[_0xd681('0x1d')](function(_0x44f0f2){if(!_[_0xd681('0x19')](_0x44f0f2)){var _0x190622=_0x44f0f2['dialTimezone'];if(!_[_0xd681('0x19')](_0x190622)){var _0x5c4077=shared['timezones'];var _0x2791d0=_0x5c4077[_0x190622];var _0x1df378=_0x5c4077[_0x2419fb[_0xd681('0x1a')]];if(!_[_0xd681('0x19')](_0x2791d0)&&!_[_0xd681('0x19')](_0x1df378)){var _0x439691=_0x2791d0[_0xd681('0x1e')]-_0x1df378[_0xd681('0x1e')];_0x462854=_0x2419fb[_0xd681('0x16')]?_0x2419fb[_0xd681('0x16')]:moment();var _0x27d78e=moment(_0x462854)['add'](_0x439691,_0xd681('0x1f'));_0x53be90({'ret':_0x27d78e[_0xd681('0x17')](_0xd681('0x18'))});}else _0x53be90({'ret':_0x462854});}else _0x53be90({'ret':_0x462854});}else{_0x53be90({'ret':_0x462854});}});}});return 0xa;}var _0x2f9890=function(_0x5e2b6b){return new BPromise(function(_0x53e270,_0x11507b){_0x2600a2(_0x5e2b6b,_0x4209e5)[_0xd681('0x1d')](function(_0x5ebe4d){_0x4209e5[_0xd681('0x16')]=_0x5ebe4d[_0xd681('0x20')];_0x394d58[_0xd681('0x21')][_0xd681('0x1c')]({'where':{'phone':_0x4209e5[_0xd681('0xe')],'VoiceQueueId':_0x5e2b6b['id']}})['then'](function(_0x160bb7){if(!_[_0xd681('0x19')](_0x160bb7)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4209e5['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5e2b6b['id']);}return _0x394d58[_0xd681('0x21')]['create']({'phone':_0x4209e5[_0xd681('0xe')],'ContactId':_0x4209e5['id'],'ListId':_0x4209e5['ListId'],'priority':_0x4209e5[_0xd681('0x22')]?_0x4209e5[_0xd681('0x22')]:0x2,'scheduledat':_0x4209e5[_0xd681('0x16')]?_0x4209e5[_0xd681('0x16')]:moment()[_0xd681('0x17')](_0xd681('0x18')),'callback':_0x4209e5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4209e5[_0xd681('0x23')]?_0x4209e5['callbackUniqueid']:undefined,'callbackat':_0x4209e5['callbackUniqueid']?moment()[_0xd681('0x17')](_0xd681('0x18')):undefined,'VoiceQueueId':_0x5e2b6b['id']});})[_0xd681('0x24')](function(_0x187be8){_0x11507b(_0x187be8);});});});};var _0x2d1d8b=function(_0x493c1a){return new BPromise(function(_0x1250c3,_0x358f71){_0x2600a2(_0x493c1a,_0x4209e5)[_0xd681('0x1d')](function(_0x4aeeff){_0x4209e5['scheduledat']=_0x4aeeff[_0xd681('0x20')];_0x394d58[_0xd681('0x21')]['findOne']({'where':{'phone':_0x4209e5['phone'],'VoiceQueueId':_0x493c1a['id']}})['then'](function(_0x203932){if(!_[_0xd681('0x19')](_0x203932)){throw new Error(_0xd681('0x25')+_0x4209e5[_0xd681('0xe')]+_0xd681('0x26')+_0x493c1a['id']);}return _0x394d58['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x4209e5['phone'],'VoiceQueueId':_0x493c1a['id']}});})[_0xd681('0x1d')](function(_0x5ea9c0){if(!_[_0xd681('0x19')](_0x5ea9c0)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4209e5[_0xd681('0xe')]+_0xd681('0x27')+_0x493c1a['id']);}return _0x394d58[_0xd681('0x21')][_0xd681('0x28')]({'phone':_0x4209e5[_0xd681('0xe')],'ContactId':_0x4209e5['id'],'ListId':_0x4209e5[_0xd681('0x29')],'priority':_0x4209e5[_0xd681('0x22')]?_0x4209e5[_0xd681('0x22')]:0x2,'scheduledat':_0x4209e5[_0xd681('0x16')]?_0x4209e5['scheduledat']:moment()[_0xd681('0x17')](_0xd681('0x18')),'callback':_0x4209e5[_0xd681('0x23')]?!![]:![],'callbackuniqueid':_0x4209e5[_0xd681('0x23')]?_0x4209e5[_0xd681('0x23')]:undefined,'callbackat':_0x4209e5[_0xd681('0x23')]?moment()['format'](_0xd681('0x18')):undefined,'VoiceQueueId':_0x493c1a['id']});})[_0xd681('0x24')](function(_0x4355fb){_0x358f71(_0x4355fb);});});});};function _0x1f8785(){return function(_0x112b3c){logger[_0xd681('0x14')]('cmContact',_0xd681('0x15'),util[_0xd681('0x2a')](_0x112b3c,{'showHidden':![],'depth':null}));};}function _0x4129b5(_0x1ff465,_0x483f2f){var _0x33a4bf=_0x483f2f['scheduledat']?_0x483f2f['scheduledat']:moment()[_0xd681('0x17')](_0xd681('0x18'));return new BPromise(function(_0x184770,_0x29fc4f){if(_[_0xd681('0x19')](_0x483f2f[_0xd681('0x1a')])){_0x184770({'ret':_0x33a4bf});}else{_0x394d58['Campaign'][_0xd681('0x1c')]({'where':{'id':_0x1ff465['id']}})[_0xd681('0x1d')](function(_0x4b2887){if(!_[_0xd681('0x19')](_0x4b2887)){var _0x5227f0=_0x4b2887[_0xd681('0x1a')];if(!_[_0xd681('0x19')](_0x5227f0)){var _0x2e6b81=shared['timezones'];var _0x53781f=_0x2e6b81[_0x5227f0];var _0x554d32=_0x2e6b81[_0x483f2f[_0xd681('0x1a')]];if(!_[_0xd681('0x19')](_0x53781f)&&!_[_0xd681('0x19')](_0x554d32)){var _0x519564=_0x53781f['utcOffset']-_0x554d32[_0xd681('0x1e')];_0x33a4bf=_0x483f2f[_0xd681('0x16')]?_0x483f2f[_0xd681('0x16')]:moment();var _0x215e1c=moment(_0x33a4bf)[_0xd681('0x2b')](_0x519564,_0xd681('0x1f'));_0x184770({'ret':_0x215e1c[_0xd681('0x17')](_0xd681('0x18'))});}else _0x184770({'ret':_0x33a4bf});}else _0x184770({'ret':_0x33a4bf});}else{_0x184770({'ret':_0x33a4bf});}});}});return 0xa;}var _0x524e44=function(_0x2c8778){return new BPromise(function(_0x5bcdce,_0x5d60ec){_0x4129b5(_0x2c8778,_0x4209e5)['then'](function(_0x29ea46){_0x4209e5[_0xd681('0x16')]=_0x29ea46['ret'];_0x394d58[_0xd681('0x21')][_0xd681('0x1c')]({'where':{'phone':_0x4209e5[_0xd681('0xe')],'CampaignId':_0x2c8778['id']}})[_0xd681('0x1d')](function(_0x1ec97f){if(!_[_0xd681('0x19')](_0x1ec97f)){throw new Error(_0xd681('0x25')+_0x4209e5['phone']+_0xd681('0x2c')+_0x2c8778['id']);}return _0x394d58[_0xd681('0x21')][_0xd681('0x28')]({'phone':_0x4209e5[_0xd681('0xe')],'ContactId':_0x4209e5['id'],'ListId':_0x4209e5[_0xd681('0x29')],'priority':_0x4209e5[_0xd681('0x22')]?_0x4209e5['priority']:0x2,'scheduledat':_0x4209e5[_0xd681('0x16')]?_0x4209e5['scheduledat']:moment()[_0xd681('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4209e5[_0xd681('0x23')]?!![]:![],'callbackuniqueid':_0x4209e5[_0xd681('0x23')]?_0x4209e5[_0xd681('0x23')]:undefined,'callbackat':_0x4209e5[_0xd681('0x23')]?moment()[_0xd681('0x17')](_0xd681('0x18')):undefined,'CampaignId':_0x2c8778['id']});})[_0xd681('0x24')](function(_0x5cf589){_0x5d60ec(_0x5cf589);});});});};var _0x82c2eb=function(_0x34c1f6){return new BPromise(function(_0x4249dd,_0xe63014){_0x4129b5(_0x34c1f6,_0x4209e5)[_0xd681('0x1d')](function(_0x3fa286){_0x4209e5[_0xd681('0x16')]=_0x3fa286['ret'];_0x394d58['CmHopper']['findOne']({'where':{'phone':_0x4209e5[_0xd681('0xe')],'CampaignId':_0x34c1f6['id']}})[_0xd681('0x1d')](function(_0x5eec1c){if(!_[_0xd681('0x19')](_0x5eec1c)){throw new Error(_0xd681('0x25')+_0x4209e5[_0xd681('0xe')]+_0xd681('0x2d')+_0x34c1f6['id']);}return _0x394d58[_0xd681('0x2e')]['findOne']({'where':{'calleridnum':_0x4209e5[_0xd681('0xe')],'CampaignId':_0x34c1f6['id']}});})[_0xd681('0x1d')](function(_0x2b759b){if(!_['isNil'](_0x2b759b)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4209e5['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x34c1f6['id']);}return _0x394d58[_0xd681('0x21')][_0xd681('0x28')]({'phone':_0x4209e5[_0xd681('0xe')],'ContactId':_0x4209e5['id'],'ListId':_0x4209e5[_0xd681('0x29')],'priority':_0x4209e5['priority']?_0x4209e5['priority']:0x2,'scheduledat':_0x4209e5[_0xd681('0x16')]?_0x4209e5[_0xd681('0x16')]:moment()[_0xd681('0x17')](_0xd681('0x18')),'callback':_0x4209e5[_0xd681('0x23')]?!![]:![],'callbackuniqueid':_0x4209e5[_0xd681('0x23')]?_0x4209e5['callbackUniqueid']:undefined,'callbackat':_0x4209e5[_0xd681('0x23')]?moment()[_0xd681('0x17')](_0xd681('0x18')):undefined,'CampaignId':_0x34c1f6['id']});})[_0xd681('0x24')](function(_0x2cdd6b){_0xe63014(_0x2cdd6b);});});});};if(_0x4209e5[_0xd681('0x29')]){_0x394d58[_0xd681('0x1b')][_0xd681('0x2f')]({'where':{'type':_0xd681('0x30')},'attributes':['id',_0xd681('0x31'),'dialTimezone'],'include':[{'model':_0x394d58[_0xd681('0x32')],'as':_0xd681('0x33'),'where':{'id':_0x4209e5[_0xd681('0x29')]}}]})[_0xd681('0x1d')](function(_0xecadbc){if(_0xecadbc){var _0xad7d81=[];for(var _0x388ed8=0x0,_0x8d3eee;_0x388ed8<_0xecadbc['length'];_0x388ed8+=0x1){_0x8d3eee=_0xecadbc[_0x388ed8][_0xd681('0x34')]({'plain':!![]});switch(_0x8d3eee['dialCheckDuplicateType']){case'always':_0x2d1d8b(_0x8d3eee)[_0xd681('0x24')](_0x50723b());break;case _0xd681('0x35'):_0x2f9890(_0x8d3eee)['catch'](_0x50723b());break;default:_0x4129b5(_0x8d3eee,_0x4209e5)['then'](function(_0x27334f){_0x4209e5['scheduledat']=_0x27334f['ret'];_0x394d58['CmHopper']['create']({'phone':_0x4209e5[_0xd681('0xe')],'ContactId':_0x4209e5['id'],'ListId':_0x4209e5[_0xd681('0x29')],'scheduledat':_0x4209e5[_0xd681('0x16')]?_0x4209e5['scheduledat']:moment()[_0xd681('0x17')](_0xd681('0x18')),'priority':_0x4209e5[_0xd681('0x22')]?_0x4209e5['priority']:0x2,'callback':_0x4209e5[_0xd681('0x23')]?!![]:![],'callbackuniqueid':_0x4209e5[_0xd681('0x23')]?_0x4209e5['callbackUniqueid']:undefined,'callbackat':_0x4209e5[_0xd681('0x23')]?moment()[_0xd681('0x17')](_0xd681('0x18')):undefined,'VoiceQueueId':_0x8d3eee['id']})[_0xd681('0x24')](_0x50723b());});}}}})[_0xd681('0x1d')](function(){return _0x394d58[_0xd681('0x1b')][_0xd681('0x2f')]({'where':{'type':_0xd681('0x30')},'attributes':['id'],'include':[{'model':_0x394d58[_0xd681('0x32')],'as':_0xd681('0x36'),'where':{'id':_0x4209e5[_0xd681('0x29')]}}]})['then'](function(_0x50be24){if(_0x50be24){var _0x2af545=[];for(var _0x723e2=0x0,_0x397d4f;_0x723e2<_0x50be24[_0xd681('0x37')];_0x723e2+=0x1){_0x397d4f=_0x50be24[_0x723e2][_0xd681('0x34')]({'plain':!![]});_0x394d58['CmHopperBlack']['create']({'phone':_0x4209e5[_0xd681('0xe')],'ContactId':_0x4209e5['id'],'ListId':_0x4209e5[_0xd681('0x29')],'VoiceQueueId':_0x397d4f['id']})[_0xd681('0x24')](function(_0x351797){logger['error'](_0xd681('0x38'),_0xd681('0x15'),_0x351797[_0xd681('0x39')]);});}}});})[_0xd681('0x1d')](function(){return _0x394d58['Campaign']['findAll']({'attributes':['id',_0xd681('0x31'),_0xd681('0x1a')],'include':[{'model':_0x394d58['CmList'],'as':_0xd681('0x33'),'where':{'id':_0x4209e5[_0xd681('0x29')]}}]})[_0xd681('0x1d')](function(_0x5db8b1){if(_0x5db8b1){var _0x3926b5=[];for(var _0x2b6db3=0x0,_0x352dd0;_0x2b6db3<_0x5db8b1[_0xd681('0x37')];_0x2b6db3+=0x1){_0x352dd0=_0x5db8b1[_0x2b6db3][_0xd681('0x34')]({'plain':!![]});switch(_0x352dd0[_0xd681('0x31')]){case'always':_0x82c2eb(_0x352dd0)[_0xd681('0x24')](_0x1f8785());break;case _0xd681('0x35'):_0x524e44(_0x352dd0)[_0xd681('0x24')](_0x1f8785());break;default:_0x394d58['CmHopper'][_0xd681('0x28')]({'phone':_0x4209e5[_0xd681('0xe')],'ContactId':_0x4209e5['id'],'ListId':_0x4209e5['ListId'],'scheduledat':_0x4209e5[_0xd681('0x16')]?_0x4209e5[_0xd681('0x16')]:moment()[_0xd681('0x17')](_0xd681('0x18')),'priority':_0x4209e5[_0xd681('0x22')]?_0x4209e5['priority']:0x2,'callback':_0x4209e5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4209e5['callbackUniqueid']?_0x4209e5['callbackUniqueid']:undefined,'callbackat':_0x4209e5[_0xd681('0x23')]?moment()[_0xd681('0x17')](_0xd681('0x18')):undefined,'CampaignId':_0x352dd0['id']})[_0xd681('0x24')](_0x1f8785());}}}});})[_0xd681('0x1d')](function(){return _0x394d58[_0xd681('0x3a')]['findAll']({'attributes':['id'],'include':[{'model':_0x394d58[_0xd681('0x32')],'as':'BlackLists','where':{'id':_0x4209e5[_0xd681('0x29')]}}]})[_0xd681('0x1d')](function(_0x11ea6c){if(_0x11ea6c){var _0x26bd16=[];for(var _0x212bb9=0x0,_0x3fd261;_0x212bb9<_0x11ea6c['length'];_0x212bb9+=0x1){_0x3fd261=_0x11ea6c[_0x212bb9][_0xd681('0x34')]({'plain':!![]});_0x394d58[_0xd681('0x3b')][_0xd681('0x28')]({'phone':_0x4209e5['phone'],'ContactId':_0x4209e5['id'],'ListId':_0x4209e5[_0xd681('0x29')],'CampaignId':_0x3fd261['id']})[_0xd681('0x24')](function(_0x2bd1e0){logger[_0xd681('0x14')]('cmContact,\x20%s,\x20%s',_0xd681('0x15'),_0x2bd1e0['message']);});}}});})[_0xd681('0x1d')](function(){_0x845afe();})['catch'](function(_0x42760a){logger[_0xd681('0x14')](_0xd681('0x38'),'afterCreate',_0x42760a['message']);_0x845afe(_0x42760a);});}else{_0x845afe(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x3aee3b,_0x47b512,_0x254149){var _0x1a310b=_0xe577f9['models'];var _0x29757c=_0x3aee3b[_0xd681('0x34')]({'plain':!![]});return _0x1a310b[_0xd681('0x21')][_0xd681('0x2f')]({'raw':!![],'where':{'ListId':_0x29757c['ListId'],'ContactId':_0x29757c['id']}})['then'](function(_0x55b34d){if(!_[_0xd681('0x3c')](_0x55b34d)){var _0x4adcfc=[];for(var _0xe2663c=0x0;_0xe2663c<_0x55b34d[_0xd681('0x37')];_0xe2663c+=0x1){var _0x53e51a=_0x1a310b[_0xd681('0x21')][_0xd681('0x3d')]({'where':{'ListId':_0x55b34d[_0xe2663c]['ListId'],'ContactId':_0x55b34d[_0xe2663c][_0xd681('0x3e')],'VoiceQueueId':_0x55b34d[_0xe2663c][_0xd681('0x3f')],'CampaignId':_0x55b34d[_0xe2663c][_0xd681('0x40')]}});_0x4adcfc['push'](_0x53e51a);}return BPromise[_0xd681('0x41')](_0x4adcfc);}})['then'](function(_0xc6c426){logger[_0xd681('0x42')]('[CmContact][afterDestroy][Succesfull]',util[_0xd681('0x2a')](_0xc6c426,{'showHidden':![],'depth':null}));_0x254149();})['catch'](function(_0x3fd8d2){logger['error'](_0xd681('0x43'),util['inspect'](_0x3fd8d2,{'showHidden':![],'depth':null}));_0x254149(_0x3fd8d2);});}}});}; \ No newline at end of file +var _0xe37a=['CmList','Lists','outbound','BlackLists','length','CmHopperBlack','message','always','onlyIfOpen','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','phone','utf8mb4','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','minutes','CmHopper','findOne','create','ListId','priority','callbackUniqueid','catch','ret','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','add','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType'];(function(_0x559bd9,_0x31312b){var _0x12adb5=function(_0x2eaddd){while(--_0x2eaddd){_0x559bd9['push'](_0x559bd9['shift']());}};_0x12adb5(++_0x31312b);}(_0xe37a,0xf2));var _0xae37=function(_0x2695f7,_0x318865){_0x2695f7=_0x2695f7-0x0;var _0x34e7e0=_0xe37a[_0x2695f7];return _0x34e7e0;};'use strict';var _=require(_0xae37('0x0'));var util=require(_0xae37('0x1'));var logger=require(_0xae37('0x2'))(_0xae37('0x3'));var moment=require(_0xae37('0x4'));var BPromise=require(_0xae37('0x5'));var rp=require(_0xae37('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xae37('0x7'));var shared=require(_0xae37('0x8'));var attributes=require(_0xae37('0x9'));module[_0xae37('0xa')]=function(_0x5cf30b,_0x28f6d6){return _0x5cf30b[_0xae37('0xb')](_0xae37('0xc'),attributes,{'tableName':_0xae37('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0xae37('0xe'),'fields':[_0xae37('0xf'),_0xae37('0x10'),_0xae37('0x11'),'mobile','fax','email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xae37('0x12'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x198f4d,_0x400fff,_0xaccfc9){var _0x575ca2=_0x5cf30b[_0xae37('0x13')];var _0x1ab25d=_0x198f4d[_0xae37('0x14')]({'plain':!![]});function _0x40843c(){return function(_0x5b8ad9){logger[_0xae37('0x15')](_0xae37('0x16'),_0xae37('0x17'),util[_0xae37('0x18')](_0x5b8ad9,{'showHidden':![],'depth':null}));};}function _0x5d7084(_0x437d4a,_0x4f4821){var _0x260f48=_0x4f4821[_0xae37('0x19')]?_0x4f4821[_0xae37('0x19')]:moment()[_0xae37('0x1a')](_0xae37('0x1b'));return new BPromise(function(_0x46d80b,_0x4cbb63){if(_[_0xae37('0x1c')](_0x4f4821[_0xae37('0x1d')])){_0x46d80b({'ret':_0x260f48});}else{_0x575ca2[_0xae37('0x1e')]['findOne']({'where':{'id':_0x437d4a['id']}})[_0xae37('0x1f')](function(_0x6d53f9){if(!_[_0xae37('0x1c')](_0x6d53f9)){var _0xe8fd61=_0x6d53f9['dialTimezone'];if(!_[_0xae37('0x1c')](_0xe8fd61)){var _0x4f6573=shared[_0xae37('0x20')];var _0x3ae178=_0x4f6573[_0xe8fd61];var _0x1d0cab=_0x4f6573[_0x4f4821[_0xae37('0x1d')]];if(!_[_0xae37('0x1c')](_0x3ae178)&&!_[_0xae37('0x1c')](_0x1d0cab)){var _0x200111=_0x3ae178[_0xae37('0x21')]-_0x1d0cab[_0xae37('0x21')];_0x260f48=_0x4f4821['scheduledat']?_0x4f4821[_0xae37('0x19')]:moment();var _0x52da83=moment(_0x260f48)['add'](_0x200111,_0xae37('0x22'));_0x46d80b({'ret':_0x52da83[_0xae37('0x1a')](_0xae37('0x1b'))});}else _0x46d80b({'ret':_0x260f48});}else _0x46d80b({'ret':_0x260f48});}else{_0x46d80b({'ret':_0x260f48});}});}});return 0xa;}var _0x22e345=function(_0x17bb34){return new BPromise(function(_0xec1650,_0x45f140){_0x5d7084(_0x17bb34,_0x1ab25d)[_0xae37('0x1f')](function(_0x23ef73){_0x1ab25d[_0xae37('0x19')]=_0x23ef73['ret'];_0x575ca2[_0xae37('0x23')][_0xae37('0x24')]({'where':{'phone':_0x1ab25d[_0xae37('0x11')],'VoiceQueueId':_0x17bb34['id']}})[_0xae37('0x1f')](function(_0x39b29d){if(!_['isNil'](_0x39b29d)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1ab25d[_0xae37('0x11')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x17bb34['id']);}return _0x575ca2['CmHopper'][_0xae37('0x25')]({'phone':_0x1ab25d[_0xae37('0x11')],'ContactId':_0x1ab25d['id'],'ListId':_0x1ab25d[_0xae37('0x26')],'priority':_0x1ab25d[_0xae37('0x27')]?_0x1ab25d[_0xae37('0x27')]:0x2,'scheduledat':_0x1ab25d[_0xae37('0x19')]?_0x1ab25d[_0xae37('0x19')]:moment()[_0xae37('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1ab25d[_0xae37('0x28')]?!![]:![],'callbackuniqueid':_0x1ab25d[_0xae37('0x28')]?_0x1ab25d['callbackUniqueid']:undefined,'callbackat':_0x1ab25d['callbackUniqueid']?moment()[_0xae37('0x1a')](_0xae37('0x1b')):undefined,'VoiceQueueId':_0x17bb34['id']});})[_0xae37('0x29')](function(_0x5bf131){_0x45f140(_0x5bf131);});});});};var _0x38047e=function(_0x2062b8){return new BPromise(function(_0x36dd06,_0xa179bd){_0x5d7084(_0x2062b8,_0x1ab25d)[_0xae37('0x1f')](function(_0x52de36){_0x1ab25d[_0xae37('0x19')]=_0x52de36[_0xae37('0x2a')];_0x575ca2[_0xae37('0x23')][_0xae37('0x24')]({'where':{'phone':_0x1ab25d[_0xae37('0x11')],'VoiceQueueId':_0x2062b8['id']}})[_0xae37('0x1f')](function(_0x5a2e07){if(!_['isNil'](_0x5a2e07)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1ab25d[_0xae37('0x11')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x2062b8['id']);}return _0x575ca2[_0xae37('0x2b')][_0xae37('0x24')]({'where':{'calleridnum':_0x1ab25d[_0xae37('0x11')],'VoiceQueueId':_0x2062b8['id']}});})[_0xae37('0x1f')](function(_0x4097cf){if(!_['isNil'](_0x4097cf)){throw new Error(_0xae37('0x2c')+_0x1ab25d[_0xae37('0x11')]+_0xae37('0x2d')+_0x2062b8['id']);}return _0x575ca2['CmHopper'][_0xae37('0x25')]({'phone':_0x1ab25d[_0xae37('0x11')],'ContactId':_0x1ab25d['id'],'ListId':_0x1ab25d[_0xae37('0x26')],'priority':_0x1ab25d[_0xae37('0x27')]?_0x1ab25d[_0xae37('0x27')]:0x2,'scheduledat':_0x1ab25d[_0xae37('0x19')]?_0x1ab25d[_0xae37('0x19')]:moment()[_0xae37('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1ab25d[_0xae37('0x28')]?!![]:![],'callbackuniqueid':_0x1ab25d[_0xae37('0x28')]?_0x1ab25d[_0xae37('0x28')]:undefined,'callbackat':_0x1ab25d[_0xae37('0x28')]?moment()[_0xae37('0x1a')](_0xae37('0x1b')):undefined,'VoiceQueueId':_0x2062b8['id']});})['catch'](function(_0x113127){_0xa179bd(_0x113127);});});});};function _0x37b668(){return function(_0x1b6549){logger['error']('cmContact',_0xae37('0x17'),util[_0xae37('0x18')](_0x1b6549,{'showHidden':![],'depth':null}));};}function _0x3843e5(_0x5b84e7,_0x3bf76d){var _0x48f148=_0x3bf76d[_0xae37('0x19')]?_0x3bf76d['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2db26e,_0x591b1d){if(_[_0xae37('0x1c')](_0x3bf76d[_0xae37('0x1d')])){_0x2db26e({'ret':_0x48f148});}else{_0x575ca2[_0xae37('0x2e')][_0xae37('0x24')]({'where':{'id':_0x5b84e7['id']}})[_0xae37('0x1f')](function(_0x370cda){if(!_[_0xae37('0x1c')](_0x370cda)){var _0x5969f2=_0x370cda[_0xae37('0x1d')];if(!_[_0xae37('0x1c')](_0x5969f2)){var _0x4d098d=shared[_0xae37('0x20')];var _0x5ccd8c=_0x4d098d[_0x5969f2];var _0x4f6ff1=_0x4d098d[_0x3bf76d[_0xae37('0x1d')]];if(!_[_0xae37('0x1c')](_0x5ccd8c)&&!_['isNil'](_0x4f6ff1)){var _0x178e78=_0x5ccd8c[_0xae37('0x21')]-_0x4f6ff1[_0xae37('0x21')];_0x48f148=_0x3bf76d[_0xae37('0x19')]?_0x3bf76d[_0xae37('0x19')]:moment();var _0x3e269a=moment(_0x48f148)[_0xae37('0x2f')](_0x178e78,_0xae37('0x22'));_0x2db26e({'ret':_0x3e269a[_0xae37('0x1a')](_0xae37('0x1b'))});}else _0x2db26e({'ret':_0x48f148});}else _0x2db26e({'ret':_0x48f148});}else{_0x2db26e({'ret':_0x48f148});}});}});return 0xa;}var _0x352f7b=function(_0x571d9f){return new BPromise(function(_0x22a3e1,_0x566f3b){_0x3843e5(_0x571d9f,_0x1ab25d)[_0xae37('0x1f')](function(_0x59d8dc){_0x1ab25d[_0xae37('0x19')]=_0x59d8dc['ret'];_0x575ca2[_0xae37('0x23')]['findOne']({'where':{'phone':_0x1ab25d[_0xae37('0x11')],'CampaignId':_0x571d9f['id']}})['then'](function(_0x40d020){if(!_[_0xae37('0x1c')](_0x40d020)){throw new Error(_0xae37('0x30')+_0x1ab25d[_0xae37('0x11')]+_0xae37('0x31')+_0x571d9f['id']);}return _0x575ca2[_0xae37('0x23')]['create']({'phone':_0x1ab25d['phone'],'ContactId':_0x1ab25d['id'],'ListId':_0x1ab25d[_0xae37('0x26')],'priority':_0x1ab25d[_0xae37('0x27')]?_0x1ab25d[_0xae37('0x27')]:0x2,'scheduledat':_0x1ab25d[_0xae37('0x19')]?_0x1ab25d['scheduledat']:moment()[_0xae37('0x1a')](_0xae37('0x1b')),'callback':_0x1ab25d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1ab25d[_0xae37('0x28')]?_0x1ab25d[_0xae37('0x28')]:undefined,'callbackat':_0x1ab25d[_0xae37('0x28')]?moment()[_0xae37('0x1a')](_0xae37('0x1b')):undefined,'CampaignId':_0x571d9f['id']});})[_0xae37('0x29')](function(_0x1c7ba4){_0x566f3b(_0x1c7ba4);});});});};var _0x5b7c72=function(_0x48a216){return new BPromise(function(_0x121799,_0x25328c){_0x3843e5(_0x48a216,_0x1ab25d)[_0xae37('0x1f')](function(_0x2912e9){_0x1ab25d[_0xae37('0x19')]=_0x2912e9[_0xae37('0x2a')];_0x575ca2[_0xae37('0x23')]['findOne']({'where':{'phone':_0x1ab25d['phone'],'CampaignId':_0x48a216['id']}})[_0xae37('0x1f')](function(_0x328219){if(!_[_0xae37('0x1c')](_0x328219)){throw new Error(_0xae37('0x30')+_0x1ab25d['phone']+_0xae37('0x32')+_0x48a216['id']);}return _0x575ca2[_0xae37('0x2b')][_0xae37('0x24')]({'where':{'calleridnum':_0x1ab25d['phone'],'CampaignId':_0x48a216['id']}});})[_0xae37('0x1f')](function(_0x88ebc1){if(!_[_0xae37('0x1c')](_0x88ebc1)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x1ab25d[_0xae37('0x11')]+_0xae37('0x33')+_0x48a216['id']);}return _0x575ca2['CmHopper']['create']({'phone':_0x1ab25d[_0xae37('0x11')],'ContactId':_0x1ab25d['id'],'ListId':_0x1ab25d['ListId'],'priority':_0x1ab25d[_0xae37('0x27')]?_0x1ab25d[_0xae37('0x27')]:0x2,'scheduledat':_0x1ab25d[_0xae37('0x19')]?_0x1ab25d[_0xae37('0x19')]:moment()[_0xae37('0x1a')](_0xae37('0x1b')),'callback':_0x1ab25d[_0xae37('0x28')]?!![]:![],'callbackuniqueid':_0x1ab25d[_0xae37('0x28')]?_0x1ab25d[_0xae37('0x28')]:undefined,'callbackat':_0x1ab25d[_0xae37('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x48a216['id']});})['catch'](function(_0x4166bc){_0x25328c(_0x4166bc);});});});};if(_0x1ab25d[_0xae37('0x26')]){_0x575ca2[_0xae37('0x1e')][_0xae37('0x34')]({'where':{'type':'outbound'},'attributes':['id',_0xae37('0x35'),'dialTimezone'],'include':[{'model':_0x575ca2[_0xae37('0x36')],'as':_0xae37('0x37'),'where':{'id':_0x1ab25d[_0xae37('0x26')]}}]})[_0xae37('0x1f')](function(_0x2e86f6){if(_0x2e86f6){var _0x26619c=[];for(var _0xd76474=0x0,_0x4ab167;_0xd76474<_0x2e86f6['length'];_0xd76474+=0x1){_0x4ab167=_0x2e86f6[_0xd76474][_0xae37('0x14')]({'plain':!![]});switch(_0x4ab167['dialCheckDuplicateType']){case'always':_0x38047e(_0x4ab167)[_0xae37('0x29')](_0x40843c());break;case'onlyIfOpen':_0x22e345(_0x4ab167)[_0xae37('0x29')](_0x40843c());break;default:_0x3843e5(_0x4ab167,_0x1ab25d)[_0xae37('0x1f')](function(_0x2d489e){_0x1ab25d[_0xae37('0x19')]=_0x2d489e[_0xae37('0x2a')];_0x575ca2[_0xae37('0x23')][_0xae37('0x25')]({'phone':_0x1ab25d[_0xae37('0x11')],'ContactId':_0x1ab25d['id'],'ListId':_0x1ab25d[_0xae37('0x26')],'scheduledat':_0x1ab25d['scheduledat']?_0x1ab25d[_0xae37('0x19')]:moment()['format'](_0xae37('0x1b')),'priority':_0x1ab25d[_0xae37('0x27')]?_0x1ab25d[_0xae37('0x27')]:0x2,'callback':_0x1ab25d[_0xae37('0x28')]?!![]:![],'callbackuniqueid':_0x1ab25d[_0xae37('0x28')]?_0x1ab25d['callbackUniqueid']:undefined,'callbackat':_0x1ab25d[_0xae37('0x28')]?moment()[_0xae37('0x1a')](_0xae37('0x1b')):undefined,'VoiceQueueId':_0x4ab167['id']})[_0xae37('0x29')](_0x40843c());});}}}})[_0xae37('0x1f')](function(){return _0x575ca2[_0xae37('0x1e')][_0xae37('0x34')]({'where':{'type':_0xae37('0x38')},'attributes':['id'],'include':[{'model':_0x575ca2[_0xae37('0x36')],'as':_0xae37('0x39'),'where':{'id':_0x1ab25d[_0xae37('0x26')]}}]})[_0xae37('0x1f')](function(_0x4aebc2){if(_0x4aebc2){var _0x354937=[];for(var _0x3f3814=0x0,_0x10d2a3;_0x3f3814<_0x4aebc2[_0xae37('0x3a')];_0x3f3814+=0x1){_0x10d2a3=_0x4aebc2[_0x3f3814][_0xae37('0x14')]({'plain':!![]});_0x575ca2[_0xae37('0x3b')][_0xae37('0x25')]({'phone':_0x1ab25d['phone'],'ContactId':_0x1ab25d['id'],'ListId':_0x1ab25d['ListId'],'VoiceQueueId':_0x10d2a3['id']})['catch'](function(_0x35312e){logger[_0xae37('0x15')]('cmContact,\x20%s,\x20%s','afterCreate',_0x35312e[_0xae37('0x3c')]);});}}});})[_0xae37('0x1f')](function(){return _0x575ca2[_0xae37('0x2e')][_0xae37('0x34')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x575ca2[_0xae37('0x36')],'as':'Lists','where':{'id':_0x1ab25d[_0xae37('0x26')]}}]})[_0xae37('0x1f')](function(_0x455ce5){if(_0x455ce5){var _0x3b626e=[];for(var _0x3a583c=0x0,_0x5a74f9;_0x3a583c<_0x455ce5['length'];_0x3a583c+=0x1){_0x5a74f9=_0x455ce5[_0x3a583c][_0xae37('0x14')]({'plain':!![]});switch(_0x5a74f9['dialCheckDuplicateType']){case _0xae37('0x3d'):_0x5b7c72(_0x5a74f9)['catch'](_0x37b668());break;case _0xae37('0x3e'):_0x352f7b(_0x5a74f9)[_0xae37('0x29')](_0x37b668());break;default:_0x575ca2['CmHopper'][_0xae37('0x25')]({'phone':_0x1ab25d[_0xae37('0x11')],'ContactId':_0x1ab25d['id'],'ListId':_0x1ab25d[_0xae37('0x26')],'scheduledat':_0x1ab25d['scheduledat']?_0x1ab25d[_0xae37('0x19')]:moment()[_0xae37('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1ab25d[_0xae37('0x27')]?_0x1ab25d['priority']:0x2,'callback':_0x1ab25d[_0xae37('0x28')]?!![]:![],'callbackuniqueid':_0x1ab25d[_0xae37('0x28')]?_0x1ab25d[_0xae37('0x28')]:undefined,'callbackat':_0x1ab25d['callbackUniqueid']?moment()[_0xae37('0x1a')](_0xae37('0x1b')):undefined,'CampaignId':_0x5a74f9['id']})[_0xae37('0x29')](_0x37b668());}}}});})['then'](function(){return _0x575ca2[_0xae37('0x2e')][_0xae37('0x34')]({'attributes':['id'],'include':[{'model':_0x575ca2[_0xae37('0x36')],'as':_0xae37('0x39'),'where':{'id':_0x1ab25d[_0xae37('0x26')]}}]})['then'](function(_0x54f9e2){if(_0x54f9e2){var _0x59b0dc=[];for(var _0x11aed7=0x0,_0x538450;_0x11aed7<_0x54f9e2[_0xae37('0x3a')];_0x11aed7+=0x1){_0x538450=_0x54f9e2[_0x11aed7]['get']({'plain':!![]});_0x575ca2[_0xae37('0x3b')][_0xae37('0x25')]({'phone':_0x1ab25d['phone'],'ContactId':_0x1ab25d['id'],'ListId':_0x1ab25d[_0xae37('0x26')],'CampaignId':_0x538450['id']})[_0xae37('0x29')](function(_0x3e0e6f){logger['error'](_0xae37('0x3f'),_0xae37('0x17'),_0x3e0e6f['message']);});}}});})[_0xae37('0x1f')](function(){_0xaccfc9();})[_0xae37('0x29')](function(_0x107237){logger[_0xae37('0x15')](_0xae37('0x3f'),'afterCreate',_0x107237[_0xae37('0x3c')]);_0xaccfc9(_0x107237);});}else{_0xaccfc9(new Error(_0xae37('0x40')));}},'afterDestroy':function(_0x29e849,_0x4e144e,_0x1589d2){var _0x576f88=_0x5cf30b[_0xae37('0x13')];var _0x19403a=_0x29e849[_0xae37('0x14')]({'plain':!![]});return _0x576f88['CmHopper'][_0xae37('0x34')]({'raw':!![],'where':{'ListId':_0x19403a[_0xae37('0x26')],'ContactId':_0x19403a['id']}})['then'](function(_0x329216){if(!_[_0xae37('0x41')](_0x329216)){var _0xcfbc69=[];for(var _0x2e5a87=0x0;_0x2e5a87<_0x329216[_0xae37('0x3a')];_0x2e5a87+=0x1){var _0x476768=_0x576f88[_0xae37('0x23')][_0xae37('0x42')]({'where':{'ListId':_0x329216[_0x2e5a87]['ListId'],'ContactId':_0x329216[_0x2e5a87][_0xae37('0x43')],'VoiceQueueId':_0x329216[_0x2e5a87][_0xae37('0x44')],'CampaignId':_0x329216[_0x2e5a87]['CampaignId']}});_0xcfbc69[_0xae37('0x45')](_0x476768);}return BPromise[_0xae37('0x46')](_0xcfbc69);}})['then'](function(_0x1c302d){logger[_0xae37('0x47')](_0xae37('0x48'),util[_0xae37('0x18')](_0x1c302d,{'showHidden':![],'depth':null}));_0x1589d2();})[_0xae37('0x29')](function(_0x1d2e25){logger[_0xae37('0x15')](_0xae37('0x49'),util[_0xae37('0x18')](_0x1d2e25,{'showHidden':![],'depth':null}));_0x1589d2(_0x1d2e25);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index f6538d7..e638738 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x270dad,_0x544c7b){var _0x572236=function(_0x4bba13){while(--_0x4bba13){_0x270dad['push'](_0x270dad['shift']());}};_0x572236(++_0x544c7b);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x534e8e,_0x10aee0){var _0x5e4dfa=function(_0x5be9fa){while(--_0x5be9fa){_0x534e8e['push'](_0x534e8e['shift']());}};_0x5e4dfa(++_0x10aee0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 351c944..7ae2757 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 _0xc36d=['STRING','sequelize','exports','INTEGER'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc36d,0x7d));var _0xdc36=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0xc36d[_0x13524d];return _0x9918b4;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'CmContactId':{'type':Sequelize[_0xdc36('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xdc36('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xdc36('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xdc36('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xdc36('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xdc36('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x8e94=['sequelize','exports','STRING','INTEGER'];(function(_0x28dad2,_0x12700c){var _0x1fdd3b=function(_0x5afe5d){while(--_0x5afe5d){_0x28dad2['push'](_0x28dad2['shift']());}};_0x1fdd3b(++_0x12700c);}(_0x8e94,0xf8));var _0x48e9=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x8e94[_0x45c48f];return _0xaf5037;};'use strict';var Sequelize=require(_0x48e9('0x0'));module[_0x48e9('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x48e9('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x48e9('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x48e9('0x3')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 734db72..23a4022 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 _0x1a4a=['catch','params','include','create','body','user','get','role','CmContactHasItems','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','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','limit','undefined','count','offset','set','Content-Range','apply','reject','destroy','then','UserProfileResource','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','rows'];(function(_0x545d71,_0x2b384a){var _0x338e93=function(_0x31075b){while(--_0x31075b){_0x545d71['push'](_0x545d71['shift']());}};_0x338e93(++_0x2b384a);}(_0x1a4a,0x1c1));var _0xa1a4=function(_0x16bd8c,_0x51a059){_0x16bd8c=_0x16bd8c-0x0;var _0x3ff6e8=_0x1a4a[_0x16bd8c];return _0x3ff6e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1a4('0x0'));var zipdir=require(_0xa1a4('0x1'));var jsonpatch=require(_0xa1a4('0x2'));var rp=require(_0xa1a4('0x3'));var moment=require(_0xa1a4('0x4'));var BPromise=require(_0xa1a4('0x5'));var Mustache=require(_0xa1a4('0x6'));var util=require(_0xa1a4('0x7'));var path=require(_0xa1a4('0x8'));var sox=require(_0xa1a4('0x9'));var csv=require(_0xa1a4('0xa'));var ejs=require(_0xa1a4('0xb'));var fs=require('fs');var fs_extra=require(_0xa1a4('0xc'));var _=require(_0xa1a4('0xd'));var squel=require(_0xa1a4('0xe'));var crypto=require(_0xa1a4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa1a4('0x10'));var toCsv=require(_0xa1a4('0xa'));var querystring=require(_0xa1a4('0x11'));var Papa=require(_0xa1a4('0x12'));var Redis=require(_0xa1a4('0x13'));var authService=require(_0xa1a4('0x14'));var qs=require(_0xa1a4('0x15'));var as=require(_0xa1a4('0x16'));var hardwareService=require(_0xa1a4('0x17'));var logger=require(_0xa1a4('0x18'))(_0xa1a4('0x19'));var utils=require(_0xa1a4('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xa1a4('0x1b'));var db=require(_0xa1a4('0x1c'))['db'];function respondWithStatusCode(_0x4364f8,_0x589c0d){_0x589c0d=_0x589c0d||0xcc;return function(_0x10638d){if(_0x10638d){return _0x4364f8[_0xa1a4('0x1d')](_0x589c0d);}return _0x4364f8[_0xa1a4('0x1e')](_0x589c0d)[_0xa1a4('0x1f')]();};}function respondWithResult(_0x15518f,_0x866767){_0x866767=_0x866767||0xc8;return function(_0x5b5882){if(_0x5b5882){return _0x15518f[_0xa1a4('0x1e')](_0x866767)[_0xa1a4('0x20')](_0x5b5882);}};}function respondWithFilteredResult(_0x4c07ab,_0x5e2bd5){return function(_0x59b78e){if(_0x59b78e){var _0x584c87=typeof _0x5e2bd5['offset']==='undefined'&&typeof _0x5e2bd5[_0xa1a4('0x21')]===_0xa1a4('0x22');var _0x41c411=_0x59b78e[_0xa1a4('0x23')];var _0x375904=_0x584c87?0x0:_0x5e2bd5[_0xa1a4('0x24')];var _0x4456fe=_0x584c87?_0x59b78e[_0xa1a4('0x23')]:_0x5e2bd5[_0xa1a4('0x24')]+_0x5e2bd5[_0xa1a4('0x21')];var _0x4f0669;if(_0x4456fe>=_0x41c411){_0x4456fe=_0x41c411;_0x4f0669=0xc8;}else{_0x4f0669=0xce;}_0x4c07ab[_0xa1a4('0x1e')](_0x4f0669);return _0x4c07ab[_0xa1a4('0x25')](_0xa1a4('0x26'),_0x375904+'-'+_0x4456fe+'/'+_0x41c411)[_0xa1a4('0x20')](_0x59b78e);}return null;};}function patchUpdates(_0x47f1c1){return function(_0x511f6c){try{jsonpatch[_0xa1a4('0x27')](_0x511f6c,_0x47f1c1,!![]);}catch(_0x41dcf8){return BPromise[_0xa1a4('0x28')](_0x41dcf8);}return _0x511f6c['save']();};}function saveUpdates(_0x37e4f2,_0x185d4f){return function(_0x5a6f2f){if(_0x5a6f2f){return _0x5a6f2f['update'](_0x37e4f2)['then'](function(_0x5892c9){return _0x5892c9;});}return null;};}function removeEntity(_0x23448f,_0x5bfc5f){return function(_0x1321f4){if(_0x1321f4){return _0x1321f4[_0xa1a4('0x29')]()[_0xa1a4('0x2a')](function(){var _0x3498e7=_0x1321f4['get']({'plain':!![]});var _0x50089a='CmContactHasItems';return db[_0xa1a4('0x2b')][_0xa1a4('0x29')]({'where':{'type':_0x50089a,'resourceId':_0x3498e7['id']}})[_0xa1a4('0x2a')](function(){return _0x1321f4;});})[_0xa1a4('0x2a')](function(){_0x23448f[_0xa1a4('0x1e')](0xcc)[_0xa1a4('0x1f')]();});}};}function handleEntityNotFound(_0x228741,_0x4df3c7){return function(_0x15b907){if(!_0x15b907){_0x228741[_0xa1a4('0x1d')](0x194);}return _0x15b907;};}function handleError(_0x350928,_0x27edcb){_0x27edcb=_0x27edcb||0x1f4;return function(_0x253879){logger[_0xa1a4('0x2c')](_0x253879['stack']);if(_0x253879['name']){delete _0x253879[_0xa1a4('0x2d')];}_0x350928[_0xa1a4('0x1e')](_0x27edcb)[_0xa1a4('0x2e')](_0x253879);};}exports[_0xa1a4('0x2f')]=function(_0x1d46d5,_0x2967de){var _0x54959c={},_0x440103={},_0x37d480={'count':0x0,'rows':[]};var _0x234331=_[_0xa1a4('0x30')](db[_0xa1a4('0x31')][_0xa1a4('0x32')],function(_0x1c1598){return{'name':_0x1c1598[_0xa1a4('0x33')],'type':_0x1c1598[_0xa1a4('0x34')][_0xa1a4('0x35')]};});_0x440103[_0xa1a4('0x36')]=_[_0xa1a4('0x30')](_0x234331,_0xa1a4('0x2d'));_0x440103[_0xa1a4('0x37')]=_[_0xa1a4('0x38')](_0x1d46d5[_0xa1a4('0x37')]);_0x440103['filters']=_[_0xa1a4('0x39')](_0x440103[_0xa1a4('0x36')],_0x440103[_0xa1a4('0x37')]);_0x54959c[_0xa1a4('0x3a')]=_[_0xa1a4('0x39')](_0x440103[_0xa1a4('0x36')],qs['fields'](_0x1d46d5[_0xa1a4('0x37')][_0xa1a4('0x3b')]));_0x54959c[_0xa1a4('0x3a')]=_0x54959c[_0xa1a4('0x3a')][_0xa1a4('0x3c')]?_0x54959c[_0xa1a4('0x3a')]:_0x440103['model'];if(!_0x1d46d5['query']['hasOwnProperty'](_0xa1a4('0x3d'))){_0x54959c['limit']=qs[_0xa1a4('0x21')](_0x1d46d5[_0xa1a4('0x37')]['limit']);_0x54959c[_0xa1a4('0x24')]=qs[_0xa1a4('0x24')](_0x1d46d5['query'][_0xa1a4('0x24')]);}_0x54959c[_0xa1a4('0x3e')]=qs[_0xa1a4('0x3f')](_0x1d46d5[_0xa1a4('0x37')][_0xa1a4('0x3f')]);_0x54959c[_0xa1a4('0x40')]=qs['filters'](_[_0xa1a4('0x41')](_0x1d46d5[_0xa1a4('0x37')],_0x440103[_0xa1a4('0x42')]),_0x234331);if(_0x1d46d5['query']['filter']){_0x54959c[_0xa1a4('0x40')]=_['merge'](_0x54959c['where'],{'$or':_[_0xa1a4('0x30')](_0x234331,function(_0x435618){if(_0x435618[_0xa1a4('0x34')]!==_0xa1a4('0x43')){var _0x39f5bb={};_0x39f5bb[_0x435618['name']]={'$like':'%'+_0x1d46d5[_0xa1a4('0x37')][_0xa1a4('0x44')]+'%'};return _0x39f5bb;}})});}_0x54959c=_[_0xa1a4('0x45')]({},_0x54959c,_0x1d46d5[_0xa1a4('0x46')]);var _0x3b3fab={'where':_0x54959c[_0xa1a4('0x40')]};return db[_0xa1a4('0x31')][_0xa1a4('0x23')](_0x3b3fab)[_0xa1a4('0x2a')](function(_0x288a81){_0x37d480[_0xa1a4('0x23')]=_0x288a81;if(_0x1d46d5['query'][_0xa1a4('0x47')]){_0x54959c['include']=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x54959c);})['then'](function(_0x34e024){_0x37d480[_0xa1a4('0x48')]=_0x34e024;return _0x37d480;})[_0xa1a4('0x2a')](respondWithFilteredResult(_0x2967de,_0x54959c))[_0xa1a4('0x49')](handleError(_0x2967de,null));};exports['show']=function(_0x384320,_0x571eca){var _0x2aefc4={'raw':!![],'where':{'id':_0x384320[_0xa1a4('0x4a')]['id']}},_0x21aa0d={};_0x21aa0d[_0xa1a4('0x36')]=_[_0xa1a4('0x38')](db[_0xa1a4('0x31')]['rawAttributes']);_0x21aa0d[_0xa1a4('0x37')]=_['keys'](_0x384320['query']);_0x21aa0d[_0xa1a4('0x42')]=_['intersection'](_0x21aa0d[_0xa1a4('0x36')],_0x21aa0d['query']);_0x2aefc4[_0xa1a4('0x3a')]=_[_0xa1a4('0x39')](_0x21aa0d[_0xa1a4('0x36')],qs['fields'](_0x384320['query'][_0xa1a4('0x3b')]));_0x2aefc4[_0xa1a4('0x3a')]=_0x2aefc4[_0xa1a4('0x3a')][_0xa1a4('0x3c')]?_0x2aefc4[_0xa1a4('0x3a')]:_0x21aa0d['model'];if(_0x384320[_0xa1a4('0x37')]['includeAll']){_0x2aefc4[_0xa1a4('0x4b')]=[{'all':!![]}];}_0x2aefc4=_['merge']({},_0x2aefc4,_0x384320[_0xa1a4('0x46')]);return db[_0xa1a4('0x31')]['find'](_0x2aefc4)['then'](handleEntityNotFound(_0x571eca,null))[_0xa1a4('0x2a')](respondWithResult(_0x571eca,null))[_0xa1a4('0x49')](handleError(_0x571eca,null));};exports[_0xa1a4('0x4c')]=function(_0x5e48cc,_0x341767){return db[_0xa1a4('0x31')]['create'](_0x5e48cc[_0xa1a4('0x4d')],{})[_0xa1a4('0x2a')](function(_0x57b61a){var _0x5b8508=_0x5e48cc[_0xa1a4('0x4e')][_0xa1a4('0x4f')]({'plain':!![]});if(!_0x5b8508)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b8508[_0xa1a4('0x50')]===_0xa1a4('0x4e')){var _0x18ab93=_0x57b61a[_0xa1a4('0x4f')]({'plain':!![]});var _0x13b640=_0xa1a4('0x51');return db[_0xa1a4('0x52')][_0xa1a4('0x53')]({'where':{'name':_0x13b640,'userProfileId':_0x5b8508['userProfileId']},'raw':!![]})[_0xa1a4('0x2a')](function(_0x5c340c){if(_0x5c340c&&_0x5c340c[_0xa1a4('0x54')]===0x0){return db[_0xa1a4('0x2b')]['create']({'name':_0x18ab93[_0xa1a4('0x2d')],'resourceId':_0x18ab93['id'],'type':_0x5c340c[_0xa1a4('0x2d')],'sectionId':_0x5c340c['id']},{})[_0xa1a4('0x2a')](function(){return _0x57b61a;});}else{return _0x57b61a;}})[_0xa1a4('0x49')](function(_0x2646d5){logger[_0xa1a4('0x2c')](_0xa1a4('0x55'),_0x2646d5);throw _0x2646d5;});}return _0x57b61a;})['then'](respondWithResult(_0x341767,0xc9))['catch'](handleError(_0x341767,null));};exports[_0xa1a4('0x56')]=function(_0x3df302,_0x1a6a37){if(_0x3df302[_0xa1a4('0x4d')]['id']){delete _0x3df302[_0xa1a4('0x4d')]['id'];}return db[_0xa1a4('0x31')][_0xa1a4('0x53')]({'where':{'id':_0x3df302['params']['id']}})['then'](handleEntityNotFound(_0x1a6a37,null))['then'](saveUpdates(_0x3df302[_0xa1a4('0x4d')],null))[_0xa1a4('0x2a')](respondWithResult(_0x1a6a37,null))[_0xa1a4('0x49')](handleError(_0x1a6a37,null));};exports['destroy']=function(_0x30c92d,_0x55ee4b){return db[_0xa1a4('0x31')][_0xa1a4('0x53')]({'where':{'id':_0x30c92d[_0xa1a4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x55ee4b,null))[_0xa1a4('0x2a')](removeEntity(_0x55ee4b,null))['catch'](handleError(_0x55ee4b,null));}; \ No newline at end of file +var _0x93b4=['status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','end','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','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','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x50aff7,_0x58dba1){var _0x3a0844=function(_0x1191ac){while(--_0x1191ac){_0x50aff7['push'](_0x50aff7['shift']());}};_0x3a0844(++_0x58dba1);}(_0x93b4,0xe1));var _0x493b=function(_0x1b7231,_0x14a282){_0x1b7231=_0x1b7231-0x0;var _0x2c9dfc=_0x93b4[_0x1b7231];return _0x2c9dfc;};'use strict';var emlformat=require(_0x493b('0x0'));var rimraf=require(_0x493b('0x1'));var zipdir=require(_0x493b('0x2'));var jsonpatch=require(_0x493b('0x3'));var rp=require('request-promise');var moment=require(_0x493b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x493b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x493b('0x6'));var ejs=require(_0x493b('0x7'));var fs=require('fs');var fs_extra=require(_0x493b('0x8'));var _=require(_0x493b('0x9'));var squel=require(_0x493b('0xa'));var crypto=require(_0x493b('0xb'));var jsforce=require(_0x493b('0xc'));var deskjs=require(_0x493b('0xd'));var toCsv=require(_0x493b('0x6'));var querystring=require(_0x493b('0xe'));var Papa=require(_0x493b('0xf'));var Redis=require(_0x493b('0x10'));var authService=require(_0x493b('0x11'));var qs=require(_0x493b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x493b('0x13'))('api');var utils=require(_0x493b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x493b('0x15'));var db=require(_0x493b('0x16'))['db'];function respondWithStatusCode(_0x3c1935,_0x566c29){_0x566c29=_0x566c29||0xcc;return function(_0x2ae9fb){if(_0x2ae9fb){return _0x3c1935[_0x493b('0x17')](_0x566c29);}return _0x3c1935[_0x493b('0x18')](_0x566c29)['end']();};}function respondWithResult(_0x3ef795,_0x573f3e){_0x573f3e=_0x573f3e||0xc8;return function(_0x36ac4b){if(_0x36ac4b){return _0x3ef795[_0x493b('0x18')](_0x573f3e)[_0x493b('0x19')](_0x36ac4b);}};}function respondWithFilteredResult(_0x1104a9,_0xd8f021){return function(_0x3de1a8){if(_0x3de1a8){var _0x39cd49=typeof _0xd8f021[_0x493b('0x1a')]===_0x493b('0x1b')&&typeof _0xd8f021[_0x493b('0x1c')]==='undefined';var _0x4c2eed=_0x3de1a8[_0x493b('0x1d')];var _0x29dca3=_0x39cd49?0x0:_0xd8f021[_0x493b('0x1a')];var _0x36be63=_0x39cd49?_0x3de1a8['count']:_0xd8f021[_0x493b('0x1a')]+_0xd8f021['limit'];var _0x472b10;if(_0x36be63>=_0x4c2eed){_0x36be63=_0x4c2eed;_0x472b10=0xc8;}else{_0x472b10=0xce;}_0x1104a9[_0x493b('0x18')](_0x472b10);return _0x1104a9[_0x493b('0x1e')]('Content-Range',_0x29dca3+'-'+_0x36be63+'/'+_0x4c2eed)['json'](_0x3de1a8);}return null;};}function patchUpdates(_0x1f224a){return function(_0x2d55f0){try{jsonpatch[_0x493b('0x1f')](_0x2d55f0,_0x1f224a,!![]);}catch(_0x5c97c4){return BPromise[_0x493b('0x20')](_0x5c97c4);}return _0x2d55f0['save']();};}function saveUpdates(_0x302b98,_0x2839f3){return function(_0x8bb1f4){if(_0x8bb1f4){return _0x8bb1f4[_0x493b('0x21')](_0x302b98)[_0x493b('0x22')](function(_0x3c0609){return _0x3c0609;});}return null;};}function removeEntity(_0x5644f8,_0x263bfb){return function(_0x4409c7){if(_0x4409c7){return _0x4409c7[_0x493b('0x23')]()[_0x493b('0x22')](function(){var _0x40d45c=_0x4409c7[_0x493b('0x24')]({'plain':!![]});var _0x44a8ee=_0x493b('0x25');return db[_0x493b('0x26')][_0x493b('0x23')]({'where':{'type':_0x44a8ee,'resourceId':_0x40d45c['id']}})[_0x493b('0x22')](function(){return _0x4409c7;});})[_0x493b('0x22')](function(){_0x5644f8[_0x493b('0x18')](0xcc)[_0x493b('0x27')]();});}};}function handleEntityNotFound(_0x39466e,_0x2fa35e){return function(_0x4d6dce){if(!_0x4d6dce){_0x39466e[_0x493b('0x17')](0x194);}return _0x4d6dce;};}function handleError(_0x23363c,_0x42ac66){_0x42ac66=_0x42ac66||0x1f4;return function(_0x180b30){logger['error'](_0x180b30['stack']);if(_0x180b30[_0x493b('0x28')]){delete _0x180b30[_0x493b('0x28')];}_0x23363c[_0x493b('0x18')](_0x42ac66)[_0x493b('0x29')](_0x180b30);};}exports[_0x493b('0x2a')]=function(_0xc5f4fb,_0x391dc7){var _0x45fa40={},_0x5a3160={},_0x3b39b4={'count':0x0,'rows':[]};var _0x1ac4d4=_['map'](db[_0x493b('0x2b')][_0x493b('0x2c')],function(_0x1598ab){return{'name':_0x1598ab[_0x493b('0x2d')],'type':_0x1598ab[_0x493b('0x2e')]['key']};});_0x5a3160[_0x493b('0x2f')]=_[_0x493b('0x30')](_0x1ac4d4,_0x493b('0x28'));_0x5a3160[_0x493b('0x31')]=_['keys'](_0xc5f4fb[_0x493b('0x31')]);_0x5a3160['filters']=_[_0x493b('0x32')](_0x5a3160[_0x493b('0x2f')],_0x5a3160[_0x493b('0x31')]);_0x45fa40['attributes']=_[_0x493b('0x32')](_0x5a3160['model'],qs[_0x493b('0x33')](_0xc5f4fb[_0x493b('0x31')][_0x493b('0x33')]));_0x45fa40[_0x493b('0x34')]=_0x45fa40[_0x493b('0x34')]['length']?_0x45fa40['attributes']:_0x5a3160[_0x493b('0x2f')];if(!_0xc5f4fb['query'][_0x493b('0x35')](_0x493b('0x36'))){_0x45fa40['limit']=qs[_0x493b('0x1c')](_0xc5f4fb['query'][_0x493b('0x1c')]);_0x45fa40['offset']=qs[_0x493b('0x1a')](_0xc5f4fb[_0x493b('0x31')][_0x493b('0x1a')]);}_0x45fa40[_0x493b('0x37')]=qs[_0x493b('0x38')](_0xc5f4fb[_0x493b('0x31')]['sort']);_0x45fa40[_0x493b('0x39')]=qs[_0x493b('0x3a')](_[_0x493b('0x3b')](_0xc5f4fb['query'],_0x5a3160['filters']),_0x1ac4d4);if(_0xc5f4fb[_0x493b('0x31')][_0x493b('0x3c')]){_0x45fa40[_0x493b('0x39')]=_['merge'](_0x45fa40['where'],{'$or':_['map'](_0x1ac4d4,function(_0x5d2a1e){if(_0x5d2a1e[_0x493b('0x2e')]!==_0x493b('0x3d')){var _0x4bb1ce={};_0x4bb1ce[_0x5d2a1e[_0x493b('0x28')]]={'$like':'%'+_0xc5f4fb[_0x493b('0x31')][_0x493b('0x3c')]+'%'};return _0x4bb1ce;}})});}_0x45fa40=_['merge']({},_0x45fa40,_0xc5f4fb[_0x493b('0x3e')]);var _0x2329f0={'where':_0x45fa40[_0x493b('0x39')]};return db[_0x493b('0x2b')][_0x493b('0x1d')](_0x2329f0)[_0x493b('0x22')](function(_0x3562df){_0x3b39b4[_0x493b('0x1d')]=_0x3562df;if(_0xc5f4fb['query'][_0x493b('0x3f')]){_0x45fa40['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x493b('0x40')](_0x45fa40);})[_0x493b('0x22')](function(_0x1ea1ca){_0x3b39b4[_0x493b('0x41')]=_0x1ea1ca;return _0x3b39b4;})[_0x493b('0x22')](respondWithFilteredResult(_0x391dc7,_0x45fa40))[_0x493b('0x42')](handleError(_0x391dc7,null));};exports[_0x493b('0x43')]=function(_0x341a86,_0x38afcd){var _0x325f51={'raw':!![],'where':{'id':_0x341a86[_0x493b('0x44')]['id']}},_0x2ba69a={};_0x2ba69a['model']=_[_0x493b('0x45')](db[_0x493b('0x2b')][_0x493b('0x2c')]);_0x2ba69a[_0x493b('0x31')]=_[_0x493b('0x45')](_0x341a86[_0x493b('0x31')]);_0x2ba69a[_0x493b('0x3a')]=_['intersection'](_0x2ba69a[_0x493b('0x2f')],_0x2ba69a[_0x493b('0x31')]);_0x325f51['attributes']=_[_0x493b('0x32')](_0x2ba69a[_0x493b('0x2f')],qs['fields'](_0x341a86[_0x493b('0x31')][_0x493b('0x33')]));_0x325f51[_0x493b('0x34')]=_0x325f51[_0x493b('0x34')][_0x493b('0x46')]?_0x325f51['attributes']:_0x2ba69a[_0x493b('0x2f')];if(_0x341a86[_0x493b('0x31')][_0x493b('0x3f')]){_0x325f51['include']=[{'all':!![]}];}_0x325f51=_[_0x493b('0x47')]({},_0x325f51,_0x341a86['options']);return db[_0x493b('0x2b')][_0x493b('0x48')](_0x325f51)[_0x493b('0x22')](handleEntityNotFound(_0x38afcd,null))[_0x493b('0x22')](respondWithResult(_0x38afcd,null))[_0x493b('0x42')](handleError(_0x38afcd,null));};exports[_0x493b('0x49')]=function(_0x3ddf2e,_0x29f19d){return db['CmContactHasItem'][_0x493b('0x49')](_0x3ddf2e[_0x493b('0x4a')],{})[_0x493b('0x22')](function(_0x1b5961){var _0x34bcec=_0x3ddf2e[_0x493b('0x4b')][_0x493b('0x24')]({'plain':!![]});if(!_0x34bcec)throw new Error(_0x493b('0x4c'));if(_0x34bcec[_0x493b('0x4d')]===_0x493b('0x4b')){var _0x1d5002=_0x1b5961[_0x493b('0x24')]({'plain':!![]});var _0x354aed='CmContactHasItems';return db[_0x493b('0x4e')][_0x493b('0x48')]({'where':{'name':_0x354aed,'userProfileId':_0x34bcec[_0x493b('0x4f')]},'raw':!![]})['then'](function(_0x40e06b){if(_0x40e06b&&_0x40e06b[_0x493b('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x1d5002[_0x493b('0x28')],'resourceId':_0x1d5002['id'],'type':_0x40e06b[_0x493b('0x28')],'sectionId':_0x40e06b['id']},{})['then'](function(){return _0x1b5961;});}else{return _0x1b5961;}})[_0x493b('0x42')](function(_0x3fda3a){logger[_0x493b('0x51')](_0x493b('0x52'),_0x3fda3a);throw _0x3fda3a;});}return _0x1b5961;})[_0x493b('0x22')](respondWithResult(_0x29f19d,0xc9))['catch'](handleError(_0x29f19d,null));};exports['update']=function(_0x36f08e,_0x3b0a6b){if(_0x36f08e[_0x493b('0x4a')]['id']){delete _0x36f08e[_0x493b('0x4a')]['id'];}return db[_0x493b('0x2b')][_0x493b('0x48')]({'where':{'id':_0x36f08e[_0x493b('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b0a6b,null))['then'](saveUpdates(_0x36f08e['body'],null))[_0x493b('0x22')](respondWithResult(_0x3b0a6b,null))[_0x493b('0x42')](handleError(_0x3b0a6b,null));};exports[_0x493b('0x23')]=function(_0x327539,_0x471dcd){return db[_0x493b('0x2b')][_0x493b('0x48')]({'where':{'id':_0x327539[_0x493b('0x44')]['id']}})[_0x493b('0x22')](handleEntityNotFound(_0x471dcd,null))[_0x493b('0x22')](removeEntity(_0x471dcd,null))[_0x493b('0x42')](handleError(_0x471dcd,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index bd191ff..7862ffd 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 _0xbc46=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xbc46,0x14a));var _0x6bc4=function(_0x58d402,_0x738151){_0x58d402=_0x58d402-0x0;var _0x68b966=_0xbc46[_0x58d402];return _0x68b966;};'use strict';var _=require(_0x6bc4('0x0'));var util=require(_0x6bc4('0x1'));var logger=require(_0x6bc4('0x2'))('api');var moment=require(_0x6bc4('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bc4('0x4'));var fs=require('fs');var path=require(_0x6bc4('0x5'));var rimraf=require('rimraf');var config=require(_0x6bc4('0x6'));var attributes=require(_0x6bc4('0x7'));module[_0x6bc4('0x8')]=function(_0x5ea477,_0x14c469){return _0x5ea477['define'](_0x6bc4('0x9'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2114=['lodash','util','../../config/logger','api','moment','path','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x59959f,_0x4c3b00){var _0x1533d7=function(_0x117b2d){while(--_0x117b2d){_0x59959f['push'](_0x59959f['shift']());}};_0x1533d7(++_0x4c3b00);}(_0x2114,0x84));var _0x4211=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x2114[_0x220afa];return _0x1b79d1;};'use strict';var _=require(_0x4211('0x0'));var util=require(_0x4211('0x1'));var logger=require(_0x4211('0x2'))(_0x4211('0x3'));var moment=require(_0x4211('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4211('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4211('0x6'));module[_0x4211('0x7')]=function(_0x49e7bb,_0x4c0aa){return _0x49e7bb[_0x4211('0x8')](_0x4211('0x9'),attributes,{'tableName':_0x4211('0xa'),'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 a990842..25f2b8f 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 _0x7e15=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x82bfba,_0x5eab20){var _0x114a32=function(_0x42508e){while(--_0x42508e){_0x82bfba['push'](_0x82bfba['shift']());}};_0x114a32(++_0x5eab20);}(_0x7e15,0x163));var _0x57e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7e15[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x57e1('0x0'));var util=require(_0x57e1('0x1'));var moment=require(_0x57e1('0x2'));var BPromise=require(_0x57e1('0x3'));var rs=require(_0x57e1('0x4'));var fs=require('fs');var Redis=require(_0x57e1('0x5'));var db=require(_0x57e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x57e1('0x7'))(_0x57e1('0x8'));var config=require(_0x57e1('0x9'));var jayson=require(_0x57e1('0xa'));var client=jayson[_0x57e1('0xb')][_0x57e1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33f184,_0x36d7b5,_0x529dbc){return new BPromise(function(_0x1c24c3,_0x5d6df4){return client[_0x57e1('0xd')](_0x33f184,_0x529dbc)['then'](function(_0x157911){logger[_0x57e1('0xe')](_0x57e1('0xf'),_0x36d7b5,'request\x20sent');logger[_0x57e1('0x10')](_0x57e1('0x11'),_0x36d7b5,_0x57e1('0x12'),JSON['stringify'](_0x157911));if(_0x157911[_0x57e1('0x13')]){if(_0x157911[_0x57e1('0x13')][_0x57e1('0x14')]===0x1f4){logger[_0x57e1('0x13')](_0x57e1('0xf'),_0x36d7b5,_0x157911[_0x57e1('0x13')][_0x57e1('0x15')]);return _0x5d6df4(_0x157911['error'][_0x57e1('0x15')]);}logger[_0x57e1('0x13')](_0x57e1('0xf'),_0x36d7b5,_0x157911[_0x57e1('0x13')][_0x57e1('0x15')]);return _0x1c24c3(_0x157911[_0x57e1('0x13')][_0x57e1('0x15')]);}else{logger['info'](_0x57e1('0xf'),_0x36d7b5,'request\x20sent');_0x1c24c3(_0x157911[_0x57e1('0x16')][_0x57e1('0x15')]);}})[_0x57e1('0x17')](function(_0x54f53e){logger[_0x57e1('0x13')](_0x57e1('0xf'),_0x36d7b5,_0x54f53e);_0x5d6df4(_0x54f53e);});});} \ No newline at end of file +var _0x4c44=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment'];(function(_0x323b26,_0x33d4b0){var _0x4b2b65=function(_0x2134a7){while(--_0x2134a7){_0x323b26['push'](_0x323b26['shift']());}};_0x4b2b65(++_0x33d4b0);}(_0x4c44,0x13f));var _0x44c4=function(_0x140e7f,_0x5f50a7){_0x140e7f=_0x140e7f-0x0;var _0x39656b=_0x4c44[_0x140e7f];return _0x39656b;};'use strict';var _=require(_0x44c4('0x0'));var util=require(_0x44c4('0x1'));var moment=require(_0x44c4('0x2'));var BPromise=require(_0x44c4('0x3'));var rs=require(_0x44c4('0x4'));var fs=require('fs');var Redis=require(_0x44c4('0x5'));var db=require(_0x44c4('0x6'))['db'];var utils=require(_0x44c4('0x7'));var logger=require('../../config/logger')(_0x44c4('0x8'));var config=require(_0x44c4('0x9'));var jayson=require(_0x44c4('0xa'));var client=jayson[_0x44c4('0xb')][_0x44c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ef15a,_0x4b354b,_0x5d6692){return new BPromise(function(_0x46ad2d,_0xbb69b8){return client[_0x44c4('0xd')](_0x3ef15a,_0x5d6692)[_0x44c4('0xe')](function(_0x30c2d0){logger[_0x44c4('0xf')](_0x44c4('0x10'),_0x4b354b,_0x44c4('0x11'));logger[_0x44c4('0x12')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x4b354b,'request\x20sent',JSON['stringify'](_0x30c2d0));if(_0x30c2d0[_0x44c4('0x13')]){if(_0x30c2d0[_0x44c4('0x13')][_0x44c4('0x14')]===0x1f4){logger[_0x44c4('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x4b354b,_0x30c2d0[_0x44c4('0x13')][_0x44c4('0x15')]);return _0xbb69b8(_0x30c2d0[_0x44c4('0x13')][_0x44c4('0x15')]);}logger['error'](_0x44c4('0x10'),_0x4b354b,_0x30c2d0[_0x44c4('0x13')][_0x44c4('0x15')]);return _0x46ad2d(_0x30c2d0[_0x44c4('0x13')]['message']);}else{logger['info'](_0x44c4('0x10'),_0x4b354b,_0x44c4('0x11'));_0x46ad2d(_0x30c2d0[_0x44c4('0x16')]['message']);}})['catch'](function(_0x2099ef){logger[_0x44c4('0x13')](_0x44c4('0x10'),_0x4b354b,_0x2099ef);_0xbb69b8(_0x2099ef);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 5953dee..b7da419 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 _0x25d3=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x25d3,0xc5));var _0x325d=function(_0x518fbb,_0x225475){_0x518fbb=_0x518fbb-0x0;var _0x5c8708=_0x25d3[_0x518fbb];return _0x5c8708;};'use strict';var multer=require(_0x325d('0x0'));var util=require('util');var path=require(_0x325d('0x1'));var timeout=require('connect-timeout');var express=require(_0x325d('0x2'));var router=express[_0x325d('0x3')]();var fs_extra=require(_0x325d('0x4'));var auth=require(_0x325d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x325d('0x6'));var controller=require('./cmContactHasItem.controller');router[_0x325d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x325d('0x7')](_0x325d('0x8'),auth[_0x325d('0x9')](),controller[_0x325d('0xa')]);router[_0x325d('0xb')]('/',auth[_0x325d('0x9')](),controller[_0x325d('0xc')]);router[_0x325d('0xd')](_0x325d('0x8'),auth['isAuthenticated'](),controller[_0x325d('0xe')]);router[_0x325d('0xf')](_0x325d('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x325d('0x10')]=router; \ No newline at end of file +var _0xc882=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','post','put','/:id','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc882,0xff));var _0x2c88=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc882[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x2c88('0x0'));var util=require(_0x2c88('0x1'));var path=require(_0x2c88('0x2'));var timeout=require(_0x2c88('0x3'));var express=require(_0x2c88('0x4'));var router=express[_0x2c88('0x5')]();var fs_extra=require(_0x2c88('0x6'));var auth=require(_0x2c88('0x7'));var interaction=require(_0x2c88('0x8'));var config=require(_0x2c88('0x9'));var controller=require(_0x2c88('0xa'));router[_0x2c88('0xb')]('/',auth[_0x2c88('0xc')](),controller[_0x2c88('0xd')]);router[_0x2c88('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2c88('0xe')]('/',auth[_0x2c88('0xc')](),controller['create']);router[_0x2c88('0xf')](_0x2c88('0x10'),auth['isAuthenticated'](),controller[_0x2c88('0x11')]);router[_0x2c88('0x12')](_0x2c88('0x10'),auth['isAuthenticated'](),controller[_0x2c88('0x13')]);module[_0x2c88('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 9d7b44c..59c6e7f 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 _0x86c8=['VIRTUAL','getDataValue','alias','STRING','setDataValue','name','long','type','select','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86c8,0xd5));var _0x886c=function(_0x5bbeaf,_0x4229de){_0x5bbeaf=_0x5bbeaf-0x0;var _0x28c2b3=_0x86c8[_0x5bbeaf];return _0x28c2b3;};'use strict';var Sequelize=require(_0x886c('0x0'));var _=require(_0x886c('0x1'));module[_0x886c('0x2')]={'name':{'type':Sequelize[_0x886c('0x3')],'get':function(_0x36a6d5){return this[_0x886c('0x4')](_0x886c('0x5'));}},'alias':{'type':Sequelize[_0x886c('0x6')],'allowNull':![],'set':function(_0x287b15){this[_0x886c('0x7')]('alias',_0x287b15?_0x287b15:this['getDataValue'](_0x886c('0x8')));}},'type':{'type':Sequelize[_0x886c('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x886c('0x9')),'get':function(){if(this[_0x886c('0x4')](_0x886c('0xa'))===_0x886c('0xb')){return JSON['parse'](this[_0x886c('0x4')]('values'));}else{return this['getDataValue'](_0x886c('0xc'));}},'set':function(_0x338576){if(Array[_0x886c('0xd')](_0x338576)){this['setDataValue'](_0x886c('0xc'),JSON[_0x886c('0xe')](_0x338576));}else{this[_0x886c('0x7')](_0x886c('0xc'),_0x338576);}}},'required':{'type':Sequelize[_0x886c('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x886c('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x886c('0x10')](_0x886c('0x11'))}}; \ No newline at end of file +var _0xc93c=['voice','VIRTUAL','alias','setDataValue','getDataValue','name','STRING','TEXT','long','type','select','parse','values','stringify','BOOLEAN','ENUM'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xc93c,0xa1));var _0xcc93=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc93c[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xcc93('0x0')],'get':function(_0x538cdc){return this['getDataValue'](_0xcc93('0x1'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xfdc6f5){this[_0xcc93('0x2')]('alias',_0xfdc6f5?_0xfdc6f5:this[_0xcc93('0x3')](_0xcc93('0x4')));}},'type':{'type':Sequelize[_0xcc93('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xcc93('0x6')](_0xcc93('0x7')),'get':function(){if(this[_0xcc93('0x3')](_0xcc93('0x8'))===_0xcc93('0x9')){return JSON[_0xcc93('0xa')](this[_0xcc93('0x3')](_0xcc93('0xb')));}else{return this[_0xcc93('0x3')](_0xcc93('0xb'));}},'set':function(_0x3c91df){if(Array['isArray'](_0x3c91df)){this[_0xcc93('0x2')]('values',JSON[_0xcc93('0xc')](_0x3c91df));}else{this['setDataValue'](_0xcc93('0xb'),_0x3c91df);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xcc93('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xcc93('0xe')](_0xcc93('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 85e937b..1717433 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 _0x861e=['number','switch','BOOLEAN','addColumn','format','cf_%d','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','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','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll','include','options','find','catch','body','create','sequelize','transaction','Sequelize','text','TEXT'];(function(_0x5c54e0,_0x3d8d7a){var _0xd6345d=function(_0x20f9e9){while(--_0x20f9e9){_0x5c54e0['push'](_0x5c54e0['shift']());}};_0xd6345d(++_0x3d8d7a);}(_0x861e,0x1aa));var _0xe861=function(_0x5613b7,_0x1e2c68){_0x5613b7=_0x5613b7-0x0;var _0x40dc96=_0x861e[_0x5613b7];return _0x40dc96;};'use strict';var emlformat=require(_0xe861('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe861('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe861('0x2'));var moment=require(_0xe861('0x3'));var BPromise=require(_0xe861('0x4'));var Mustache=require(_0xe861('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe861('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe861('0x7'));var _=require(_0xe861('0x8'));var squel=require(_0xe861('0x9'));var crypto=require(_0xe861('0xa'));var jsforce=require(_0xe861('0xb'));var deskjs=require(_0xe861('0xc'));var toCsv=require(_0xe861('0x6'));var querystring=require('querystring');var Papa=require(_0xe861('0xd'));var Redis=require(_0xe861('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe861('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe861('0x10'));var logger=require(_0xe861('0x11'))(_0xe861('0x12'));var utils=require(_0xe861('0x13'));var config=require(_0xe861('0x14'));var licenseUtil=require(_0xe861('0x15'));var db=require(_0xe861('0x16'))['db'];function respondWithStatusCode(_0x365a28,_0x3ded65){_0x3ded65=_0x3ded65||0xcc;return function(_0x4c82b6){if(_0x4c82b6){return _0x365a28[_0xe861('0x17')](_0x3ded65);}return _0x365a28[_0xe861('0x18')](_0x3ded65)[_0xe861('0x19')]();};}function respondWithResult(_0x2fa373,_0x3da949){_0x3da949=_0x3da949||0xc8;return function(_0x2dbe5b){if(_0x2dbe5b){return _0x2fa373[_0xe861('0x18')](_0x3da949)[_0xe861('0x1a')](_0x2dbe5b);}};}function respondWithFilteredResult(_0x3e57af,_0x20ed4d){return function(_0x128ef7){if(_0x128ef7){var _0x28e17c=typeof _0x20ed4d[_0xe861('0x1b')]===_0xe861('0x1c')&&typeof _0x20ed4d[_0xe861('0x1d')]===_0xe861('0x1c');var _0x144929=_0x128ef7['count'];var _0x389f3c=_0x28e17c?0x0:_0x20ed4d[_0xe861('0x1b')];var _0x161bcd=_0x28e17c?_0x128ef7[_0xe861('0x1e')]:_0x20ed4d['offset']+_0x20ed4d['limit'];var _0x3e95af;if(_0x161bcd>=_0x144929){_0x161bcd=_0x144929;_0x3e95af=0xc8;}else{_0x3e95af=0xce;}_0x3e57af['status'](_0x3e95af);return _0x3e57af[_0xe861('0x1f')]('Content-Range',_0x389f3c+'-'+_0x161bcd+'/'+_0x144929)['json'](_0x128ef7);}return null;};}function patchUpdates(_0x245115){return function(_0x567e5a){try{jsonpatch[_0xe861('0x20')](_0x567e5a,_0x245115,!![]);}catch(_0x445c01){return BPromise[_0xe861('0x21')](_0x445c01);}return _0x567e5a['save']();};}function saveUpdates(_0x140bab,_0x4d8411){return function(_0x431859){if(_0x431859){return _0x431859[_0xe861('0x22')](_0x140bab)[_0xe861('0x23')](function(_0x2f3ef0){return _0x2f3ef0;});}return null;};}function removeEntity(_0x5e0ac6,_0x2c3801){return function(_0x30ee35){if(_0x30ee35){return _0x30ee35[_0xe861('0x24')]()['then'](function(){_0x5e0ac6['status'](0xcc)[_0xe861('0x19')]();});}};}function handleEntityNotFound(_0x3d2ee1,_0x17ef37){return function(_0x4bc3dc){if(!_0x4bc3dc){_0x3d2ee1[_0xe861('0x17')](0x194);}return _0x4bc3dc;};}function handleError(_0x40d413,_0x1c3f3c){_0x1c3f3c=_0x1c3f3c||0x1f4;return function(_0x36fe54){logger[_0xe861('0x25')](_0x36fe54[_0xe861('0x26')]);if(_0x36fe54[_0xe861('0x27')]){delete _0x36fe54[_0xe861('0x27')];}_0x40d413['status'](_0x1c3f3c)['send'](_0x36fe54);};}exports[_0xe861('0x28')]=function(_0x31d5c3,_0x46590a){var _0x59d021={},_0x25cff0={},_0x5f0f11={'count':0x0,'rows':[]};var _0x5c16ac=_[_0xe861('0x29')](db[_0xe861('0x2a')][_0xe861('0x2b')],function(_0x20cd25){return{'name':_0x20cd25[_0xe861('0x2c')],'type':_0x20cd25[_0xe861('0x2d')][_0xe861('0x2e')]};});_0x25cff0[_0xe861('0x2f')]=_[_0xe861('0x30')](_['map'](_0x5c16ac,_0xe861('0x27')),[_0xe861('0x27')]);_0x25cff0['query']=_[_0xe861('0x31')](_0x31d5c3[_0xe861('0x32')]);_0x25cff0[_0xe861('0x33')]=_[_0xe861('0x34')](_0x25cff0['model'],_0x25cff0['query']);_0x59d021[_0xe861('0x35')]=_['intersection'](_0x25cff0[_0xe861('0x2f')],qs[_0xe861('0x36')](_0x31d5c3['query'][_0xe861('0x36')]));_0x59d021['attributes']=_0x59d021[_0xe861('0x35')]['length']?_0x59d021['attributes']:_0x25cff0[_0xe861('0x2f')];if(!_0x31d5c3[_0xe861('0x32')][_0xe861('0x37')]('nolimit')){_0x59d021['limit']=qs['limit'](_0x31d5c3[_0xe861('0x32')]['limit']);_0x59d021[_0xe861('0x1b')]=qs[_0xe861('0x1b')](_0x31d5c3[_0xe861('0x32')][_0xe861('0x1b')]);}_0x59d021[_0xe861('0x38')]=qs[_0xe861('0x39')](_0x31d5c3[_0xe861('0x32')][_0xe861('0x39')]);_0x59d021[_0xe861('0x3a')]=qs[_0xe861('0x33')](_['pick'](_0x31d5c3[_0xe861('0x32')],_0x25cff0['filters']),_0x5c16ac);if(_0x31d5c3[_0xe861('0x32')][_0xe861('0x3b')]){_0x59d021[_0xe861('0x3a')]=_[_0xe861('0x3c')](_0x59d021[_0xe861('0x3a')],{'$or':_[_0xe861('0x29')](_0x5c16ac,function(_0x1f82ff){if(_0x1f82ff[_0xe861('0x2d')]!==_0xe861('0x3d')){var _0x377438={};_0x377438[_0x1f82ff[_0xe861('0x27')]]={'$like':'%'+_0x31d5c3[_0xe861('0x32')][_0xe861('0x3b')]+'%'};return _0x377438;}})});}_0x59d021=_[_0xe861('0x3c')]({},_0x59d021,_0x31d5c3['options']);var _0x5cce30={'where':_0x59d021[_0xe861('0x3a')]};return db['CmCustomField'][_0xe861('0x1e')](_0x5cce30)[_0xe861('0x23')](function(_0x589171){_0x5f0f11[_0xe861('0x1e')]=_0x589171;if(_0x31d5c3['query']['includeAll']){_0x59d021['include']=[{'all':!![]}];}return db['CmCustomField'][_0xe861('0x3e')](_0x59d021);})['then'](function(_0x11073e){_0x5f0f11[_0xe861('0x3f')]=_0x11073e;return _0x5f0f11;})[_0xe861('0x23')](respondWithFilteredResult(_0x46590a,_0x59d021))['catch'](handleError(_0x46590a,null));};exports[_0xe861('0x40')]=function(_0x1fc82a,_0x46b7d9){var _0x5ce903={'raw':!![],'where':{'id':_0x1fc82a[_0xe861('0x41')]['id']}},_0x24e328={};_0x24e328['model']=_[_0xe861('0x31')](db[_0xe861('0x2a')]['rawAttributes']);_0x24e328[_0xe861('0x32')]=_[_0xe861('0x31')](_0x1fc82a[_0xe861('0x32')]);_0x24e328[_0xe861('0x33')]=_[_0xe861('0x34')](_0x24e328[_0xe861('0x2f')],_0x24e328[_0xe861('0x32')]);_0x5ce903['attributes']=_['intersection'](_0x24e328[_0xe861('0x2f')],qs[_0xe861('0x36')](_0x1fc82a[_0xe861('0x32')][_0xe861('0x36')]));_0x5ce903['attributes']=_0x5ce903[_0xe861('0x35')]['length']?_0x5ce903['attributes']:_0x24e328[_0xe861('0x2f')];if(_0x1fc82a[_0xe861('0x32')][_0xe861('0x42')]){_0x5ce903[_0xe861('0x43')]=[{'all':!![]}];}_0x5ce903=_[_0xe861('0x3c')]({},_0x5ce903,_0x1fc82a[_0xe861('0x44')]);return db[_0xe861('0x2a')][_0xe861('0x45')](_0x5ce903)[_0xe861('0x23')](handleEntityNotFound(_0x46b7d9,null))[_0xe861('0x23')](respondWithResult(_0x46b7d9,null))[_0xe861('0x46')](handleError(_0x46b7d9,null));};exports[_0xe861('0x22')]=function(_0x470e33,_0xb9dbe1){if(_0x470e33[_0xe861('0x47')]['id']){delete _0x470e33['body']['id'];}return db['CmCustomField'][_0xe861('0x45')]({'where':{'id':_0x470e33[_0xe861('0x41')]['id']}})[_0xe861('0x23')](handleEntityNotFound(_0xb9dbe1,null))['then'](saveUpdates(_0x470e33[_0xe861('0x47')],null))[_0xe861('0x23')](respondWithResult(_0xb9dbe1,null))[_0xe861('0x46')](handleError(_0xb9dbe1,null));};exports[_0xe861('0x24')]=function(_0x242832,_0x1e4621){return db[_0xe861('0x2a')][_0xe861('0x45')]({'where':{'id':_0x242832[_0xe861('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e4621,null))['then'](removeEntity(_0x1e4621,null))[_0xe861('0x46')](handleError(_0x1e4621,null));};exports[_0xe861('0x48')]=function(_0x4cbc9a,_0x8d7a62){var _0x2d36ad;return db[_0xe861('0x49')][_0xe861('0x4a')](function(_0x27991b){return db['CmCustomField'][_0xe861('0x48')](_0x4cbc9a['body'],{'transaction':_0x27991b})['then'](function(_0x3f423a){_0x2d36ad=_0x3f423a;var _0x40a3bf={'type':db[_0xe861('0x4b')]['TEXT'],'transaction':_0x27991b};switch(_0x4cbc9a[_0xe861('0x47')][_0xe861('0x2d')]){case _0xe861('0x4c'):_0x40a3bf[_0xe861('0x2d')]=db['Sequelize'][_0xe861('0x4d')];break;case _0xe861('0x4e'):_0x40a3bf[_0xe861('0x2d')]=db['Sequelize']['INTEGER'];break;case _0xe861('0x4f'):_0x40a3bf[_0xe861('0x2d')]=db[_0xe861('0x4b')][_0xe861('0x50')];_0x40a3bf['defaultValue']=![];break;default:}return db[_0xe861('0x49')]['queryInterface'][_0xe861('0x51')]('cm_contacts',util[_0xe861('0x52')](_0xe861('0x53'),_0x2d36ad['id']),_0x40a3bf);})[_0xe861('0x23')](function(){return _0x2d36ad;});})[_0xe861('0x23')](respondWithResult(_0x8d7a62,0xc9))[_0xe861('0x46')](handleError(_0x8d7a62,null));}; \ No newline at end of file +var _0x35a8=['map','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','body','destroy','create','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','CmCustomField','rawAttributes','type','key','model','differenceBy'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x35a8,0xd4));var _0x835a=function(_0x103caf,_0x457d68){_0x103caf=_0x103caf-0x0;var _0x5872a0=_0x35a8[_0x103caf];return _0x5872a0;};'use strict';var emlformat=require(_0x835a('0x0'));var rimraf=require(_0x835a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x835a('0x2'));var BPromise=require(_0x835a('0x3'));var Mustache=require(_0x835a('0x4'));var util=require(_0x835a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x835a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x835a('0x7'));var _=require(_0x835a('0x8'));var squel=require(_0x835a('0x9'));var crypto=require('crypto');var jsforce=require(_0x835a('0xa'));var deskjs=require(_0x835a('0xb'));var toCsv=require(_0x835a('0x6'));var querystring=require(_0x835a('0xc'));var Papa=require(_0x835a('0xd'));var Redis=require(_0x835a('0xe'));var authService=require(_0x835a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x835a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x835a('0x11'));var utils=require('../../config/utils');var config=require(_0x835a('0x12'));var licenseUtil=require(_0x835a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567313,_0x2d4dd2){_0x2d4dd2=_0x2d4dd2||0xcc;return function(_0x4dd9d2){if(_0x4dd9d2){return _0x567313[_0x835a('0x14')](_0x2d4dd2);}return _0x567313[_0x835a('0x15')](_0x2d4dd2)['end']();};}function respondWithResult(_0x5003dc,_0x369b18){_0x369b18=_0x369b18||0xc8;return function(_0x371d1f){if(_0x371d1f){return _0x5003dc[_0x835a('0x15')](_0x369b18)['json'](_0x371d1f);}};}function respondWithFilteredResult(_0xe5ffcc,_0x380fb5){return function(_0x3225c6){if(_0x3225c6){var _0x33e7a0=typeof _0x380fb5[_0x835a('0x16')]===_0x835a('0x17')&&typeof _0x380fb5[_0x835a('0x18')]==='undefined';var _0x512e53=_0x3225c6['count'];var _0xc2c376=_0x33e7a0?0x0:_0x380fb5['offset'];var _0x3326b0=_0x33e7a0?_0x3225c6['count']:_0x380fb5[_0x835a('0x16')]+_0x380fb5[_0x835a('0x18')];var _0x215126;if(_0x3326b0>=_0x512e53){_0x3326b0=_0x512e53;_0x215126=0xc8;}else{_0x215126=0xce;}_0xe5ffcc[_0x835a('0x15')](_0x215126);return _0xe5ffcc['set'](_0x835a('0x19'),_0xc2c376+'-'+_0x3326b0+'/'+_0x512e53)['json'](_0x3225c6);}return null;};}function patchUpdates(_0x50d38c){return function(_0x2b591c){try{jsonpatch[_0x835a('0x1a')](_0x2b591c,_0x50d38c,!![]);}catch(_0x5c66d4){return BPromise[_0x835a('0x1b')](_0x5c66d4);}return _0x2b591c[_0x835a('0x1c')]();};}function saveUpdates(_0x4c2baa,_0x4ac0d3){return function(_0x1cec2f){if(_0x1cec2f){return _0x1cec2f[_0x835a('0x1d')](_0x4c2baa)[_0x835a('0x1e')](function(_0x6caba4){return _0x6caba4;});}return null;};}function removeEntity(_0x1842a4,_0x38537b){return function(_0x4e2650){if(_0x4e2650){return _0x4e2650['destroy']()[_0x835a('0x1e')](function(){_0x1842a4['status'](0xcc)[_0x835a('0x1f')]();});}};}function handleEntityNotFound(_0x5d2ecc,_0x5d9b2b){return function(_0x3a12f0){if(!_0x3a12f0){_0x5d2ecc[_0x835a('0x14')](0x194);}return _0x3a12f0;};}function handleError(_0x114123,_0x31db3c){_0x31db3c=_0x31db3c||0x1f4;return function(_0x415c48){logger[_0x835a('0x20')](_0x415c48[_0x835a('0x21')]);if(_0x415c48[_0x835a('0x22')]){delete _0x415c48['name'];}_0x114123['status'](_0x31db3c)[_0x835a('0x23')](_0x415c48);};}exports[_0x835a('0x24')]=function(_0x2a2306,_0x118511){var _0x40c4e3={},_0x265e09={},_0x8561d7={'count':0x0,'rows':[]};var _0x3b05bf=_['map'](db[_0x835a('0x25')][_0x835a('0x26')],function(_0x3e0975){return{'name':_0x3e0975['fieldName'],'type':_0x3e0975[_0x835a('0x27')][_0x835a('0x28')]};});_0x265e09[_0x835a('0x29')]=_[_0x835a('0x2a')](_[_0x835a('0x2b')](_0x3b05bf,'name'),[_0x835a('0x22')]);_0x265e09['query']=_['keys'](_0x2a2306['query']);_0x265e09[_0x835a('0x2c')]=_[_0x835a('0x2d')](_0x265e09[_0x835a('0x29')],_0x265e09['query']);_0x40c4e3['attributes']=_[_0x835a('0x2d')](_0x265e09['model'],qs[_0x835a('0x2e')](_0x2a2306[_0x835a('0x2f')]['fields']));_0x40c4e3[_0x835a('0x30')]=_0x40c4e3[_0x835a('0x30')][_0x835a('0x31')]?_0x40c4e3[_0x835a('0x30')]:_0x265e09[_0x835a('0x29')];if(!_0x2a2306[_0x835a('0x2f')][_0x835a('0x32')](_0x835a('0x33'))){_0x40c4e3[_0x835a('0x18')]=qs[_0x835a('0x18')](_0x2a2306[_0x835a('0x2f')][_0x835a('0x18')]);_0x40c4e3[_0x835a('0x16')]=qs[_0x835a('0x16')](_0x2a2306[_0x835a('0x2f')][_0x835a('0x16')]);}_0x40c4e3['order']=qs[_0x835a('0x34')](_0x2a2306['query']['sort']);_0x40c4e3[_0x835a('0x35')]=qs[_0x835a('0x2c')](_[_0x835a('0x36')](_0x2a2306[_0x835a('0x2f')],_0x265e09['filters']),_0x3b05bf);if(_0x2a2306[_0x835a('0x2f')][_0x835a('0x37')]){_0x40c4e3[_0x835a('0x35')]=_['merge'](_0x40c4e3[_0x835a('0x35')],{'$or':_[_0x835a('0x2b')](_0x3b05bf,function(_0x4f19a1){if(_0x4f19a1[_0x835a('0x27')]!==_0x835a('0x38')){var _0x5892c6={};_0x5892c6[_0x4f19a1['name']]={'$like':'%'+_0x2a2306[_0x835a('0x2f')][_0x835a('0x37')]+'%'};return _0x5892c6;}})});}_0x40c4e3=_[_0x835a('0x39')]({},_0x40c4e3,_0x2a2306[_0x835a('0x3a')]);var _0x6b8db0={'where':_0x40c4e3['where']};return db[_0x835a('0x25')][_0x835a('0x3b')](_0x6b8db0)[_0x835a('0x1e')](function(_0x40e817){_0x8561d7[_0x835a('0x3b')]=_0x40e817;if(_0x2a2306[_0x835a('0x2f')][_0x835a('0x3c')]){_0x40c4e3[_0x835a('0x3d')]=[{'all':!![]}];}return db[_0x835a('0x25')][_0x835a('0x3e')](_0x40c4e3);})[_0x835a('0x1e')](function(_0x16acf3){_0x8561d7[_0x835a('0x3f')]=_0x16acf3;return _0x8561d7;})[_0x835a('0x1e')](respondWithFilteredResult(_0x118511,_0x40c4e3))[_0x835a('0x40')](handleError(_0x118511,null));};exports[_0x835a('0x41')]=function(_0xe43248,_0x559ac5){var _0x36c7bd={'raw':!![],'where':{'id':_0xe43248[_0x835a('0x42')]['id']}},_0x5f3ac8={};_0x5f3ac8[_0x835a('0x29')]=_[_0x835a('0x43')](db[_0x835a('0x25')][_0x835a('0x26')]);_0x5f3ac8[_0x835a('0x2f')]=_[_0x835a('0x43')](_0xe43248[_0x835a('0x2f')]);_0x5f3ac8[_0x835a('0x2c')]=_[_0x835a('0x2d')](_0x5f3ac8[_0x835a('0x29')],_0x5f3ac8[_0x835a('0x2f')]);_0x36c7bd[_0x835a('0x30')]=_[_0x835a('0x2d')](_0x5f3ac8[_0x835a('0x29')],qs[_0x835a('0x2e')](_0xe43248[_0x835a('0x2f')]['fields']));_0x36c7bd[_0x835a('0x30')]=_0x36c7bd[_0x835a('0x30')][_0x835a('0x31')]?_0x36c7bd['attributes']:_0x5f3ac8[_0x835a('0x29')];if(_0xe43248[_0x835a('0x2f')][_0x835a('0x3c')]){_0x36c7bd[_0x835a('0x3d')]=[{'all':!![]}];}_0x36c7bd=_[_0x835a('0x39')]({},_0x36c7bd,_0xe43248[_0x835a('0x3a')]);return db[_0x835a('0x25')][_0x835a('0x44')](_0x36c7bd)[_0x835a('0x1e')](handleEntityNotFound(_0x559ac5,null))[_0x835a('0x1e')](respondWithResult(_0x559ac5,null))['catch'](handleError(_0x559ac5,null));};exports[_0x835a('0x1d')]=function(_0x4440b9,_0x25f976){if(_0x4440b9[_0x835a('0x45')]['id']){delete _0x4440b9[_0x835a('0x45')]['id'];}return db[_0x835a('0x25')]['find']({'where':{'id':_0x4440b9['params']['id']}})[_0x835a('0x1e')](handleEntityNotFound(_0x25f976,null))[_0x835a('0x1e')](saveUpdates(_0x4440b9['body'],null))[_0x835a('0x1e')](respondWithResult(_0x25f976,null))[_0x835a('0x40')](handleError(_0x25f976,null));};exports[_0x835a('0x46')]=function(_0x3d9f9d,_0x17cc41){return db[_0x835a('0x25')][_0x835a('0x44')]({'where':{'id':_0x3d9f9d['params']['id']}})['then'](handleEntityNotFound(_0x17cc41,null))[_0x835a('0x1e')](removeEntity(_0x17cc41,null))[_0x835a('0x40')](handleError(_0x17cc41,null));};exports[_0x835a('0x47')]=function(_0x4771d7,_0x4328a7){var _0x5071b4;return db['sequelize'][_0x835a('0x48')](function(_0x58ab8c){return db[_0x835a('0x25')][_0x835a('0x47')](_0x4771d7['body'],{'transaction':_0x58ab8c})[_0x835a('0x1e')](function(_0x487c15){_0x5071b4=_0x487c15;var _0x263a06={'type':db[_0x835a('0x49')]['TEXT'],'transaction':_0x58ab8c};switch(_0x4771d7[_0x835a('0x45')][_0x835a('0x27')]){case _0x835a('0x4a'):_0x263a06[_0x835a('0x27')]=db[_0x835a('0x49')][_0x835a('0x4b')];break;case _0x835a('0x4c'):_0x263a06[_0x835a('0x27')]=db['Sequelize'][_0x835a('0x4d')];break;case _0x835a('0x4e'):_0x263a06[_0x835a('0x27')]=db[_0x835a('0x49')][_0x835a('0x4f')];_0x263a06['defaultValue']=![];break;default:}return db[_0x835a('0x50')][_0x835a('0x51')][_0x835a('0x52')](_0x835a('0x53'),util['format'](_0x835a('0x54'),_0x5071b4['id']),_0x263a06);})[_0x835a('0x1e')](function(){return _0x5071b4;});})[_0x835a('0x1e')](respondWithResult(_0x4328a7,0xc9))[_0x835a('0x40')](handleError(_0x4328a7,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d8eefe6..78d86c6 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 _0x5d9a=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','api','moment','request-promise','path'];(function(_0x72872f,_0x22fd46){var _0xf05886=function(_0x388521){while(--_0x388521){_0x72872f['push'](_0x72872f['shift']());}};_0xf05886(++_0x22fd46);}(_0x5d9a,0xae));var _0xa5d9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5d9a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xa5d9('0x0'));var util=require(_0xa5d9('0x1'));var logger=require('../../config/logger')(_0xa5d9('0x2'));var moment=require(_0xa5d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xa5d9('0x4'));var fs=require('fs');var path=require(_0xa5d9('0x5'));var rimraf=require(_0xa5d9('0x6'));var config=require(_0xa5d9('0x7'));var attributes=require(_0xa5d9('0x8'));module[_0xa5d9('0x9')]=function(_0x292576,_0x1d1694){return _0x292576[_0xa5d9('0xa')](_0xa5d9('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f17=['path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5100d1,_0x426fe4){var _0x32d087=function(_0x322872){while(--_0x322872){_0x5100d1['push'](_0x5100d1['shift']());}};_0x32d087(++_0x426fe4);}(_0x2f17,0x1db));var _0x72f1=function(_0x36b04d,_0x5e4fe2){_0x36b04d=_0x36b04d-0x0;var _0x285b3b=_0x2f17[_0x36b04d];return _0x285b3b;};'use strict';var _=require(_0x72f1('0x0'));var util=require('util');var logger=require(_0x72f1('0x1'))(_0x72f1('0x2'));var moment=require(_0x72f1('0x3'));var BPromise=require(_0x72f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72f1('0x5'));var rimraf=require(_0x72f1('0x6'));var config=require(_0x72f1('0x7'));var attributes=require(_0x72f1('0x8'));module['exports']=function(_0x223838,_0x25d15a){return _0x223838[_0x72f1('0x9')](_0x72f1('0xa'),attributes,{'tableName':_0x72f1('0xb'),'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 779c28b..0d8c38a 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 _0x4a0a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','ioredis','../../mysqldb'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x4a0a,0x9c));var _0xa4a0=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x4a0a[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0xa4a0('0x0'));var moment=require(_0xa4a0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4a0('0x2'));var db=require(_0xa4a0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4a0('0x4'))(_0xa4a0('0x5'));var config=require(_0xa4a0('0x6'));var jayson=require(_0xa4a0('0x7'));var client=jayson[_0xa4a0('0x8')][_0xa4a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151258,_0x3b83c3,_0x3232f5){return new BPromise(function(_0x4c8b9e,_0x3b28a9){return client['request'](_0x151258,_0x3232f5)[_0xa4a0('0xa')](function(_0x171b63){logger[_0xa4a0('0xb')](_0xa4a0('0xc'),_0x3b83c3,_0xa4a0('0xd'));logger['debug'](_0xa4a0('0xe'),_0x3b83c3,_0xa4a0('0xd'),JSON['stringify'](_0x171b63));if(_0x171b63['error']){if(_0x171b63[_0xa4a0('0xf')][_0xa4a0('0x10')]===0x1f4){logger['error'](_0xa4a0('0xc'),_0x3b83c3,_0x171b63['error'][_0xa4a0('0x11')]);return _0x3b28a9(_0x171b63[_0xa4a0('0xf')][_0xa4a0('0x11')]);}logger[_0xa4a0('0xf')](_0xa4a0('0xc'),_0x3b83c3,_0x171b63[_0xa4a0('0xf')][_0xa4a0('0x11')]);return _0x4c8b9e(_0x171b63[_0xa4a0('0xf')]['message']);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x3b83c3,'request\x20sent');_0x4c8b9e(_0x171b63[_0xa4a0('0x12')][_0xa4a0('0x11')]);}})[_0xa4a0('0x13')](function(_0xc5f4b9){logger[_0xa4a0('0xf')](_0xa4a0('0xc'),_0x3b83c3,_0xc5f4b9);_0x3b28a9(_0xc5f4b9);});});} \ No newline at end of file +var _0x542b=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x542b,0x69));var _0xb542=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x542b[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xb542('0x0'));var util=require(_0xb542('0x1'));var moment=require('moment');var BPromise=require(_0xb542('0x2'));var rs=require(_0xb542('0x3'));var fs=require('fs');var Redis=require(_0xb542('0x4'));var db=require(_0xb542('0x5'))['db'];var utils=require(_0xb542('0x6'));var logger=require('../../config/logger')(_0xb542('0x7'));var config=require(_0xb542('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb542('0x9')][_0xb542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x355599,_0x4d3bcb,_0x4104dd){return new BPromise(function(_0x270670,_0x133d7f){return client[_0xb542('0xb')](_0x355599,_0x4104dd)['then'](function(_0x2310ee){logger[_0xb542('0xc')](_0xb542('0xd'),_0x4d3bcb,_0xb542('0xe'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4d3bcb,_0xb542('0xe'),JSON[_0xb542('0xf')](_0x2310ee));if(_0x2310ee['error']){if(_0x2310ee[_0xb542('0x10')][_0xb542('0x11')]===0x1f4){logger['error'](_0xb542('0xd'),_0x4d3bcb,_0x2310ee['error'][_0xb542('0x12')]);return _0x133d7f(_0x2310ee[_0xb542('0x10')][_0xb542('0x12')]);}logger[_0xb542('0x10')](_0xb542('0xd'),_0x4d3bcb,_0x2310ee[_0xb542('0x10')]['message']);return _0x270670(_0x2310ee[_0xb542('0x10')][_0xb542('0x12')]);}else{logger[_0xb542('0xc')](_0xb542('0xd'),_0x4d3bcb,_0xb542('0xe'));_0x270670(_0x2310ee[_0xb542('0x13')]['message']);}})[_0xb542('0x14')](function(_0x2e890a){logger[_0xb542('0x10')](_0xb542('0xd'),_0x4d3bcb,_0x2e890a);_0x133d7f(_0x2e890a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2300a19..38e49c2 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 _0x931f=['/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated'];(function(_0x5f9cea,_0x5d4a5d){var _0x5a2f04=function(_0x3be405){while(--_0x3be405){_0x5f9cea['push'](_0x5f9cea['shift']());}};_0x5a2f04(++_0x5d4a5d);}(_0x931f,0x139));var _0xf931=function(_0x4bab92,_0x497266){_0x4bab92=_0x4bab92-0x0;var _0x5ebe8b=_0x931f[_0x4bab92];return _0x5ebe8b;};'use strict';var multer=require(_0xf931('0x0'));var util=require(_0xf931('0x1'));var path=require(_0xf931('0x2'));var timeout=require(_0xf931('0x3'));var express=require(_0xf931('0x4'));var router=express[_0xf931('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf931('0x6'));var interaction=require(_0xf931('0x7'));var config=require(_0xf931('0x8'));var controller=require(_0xf931('0x9'));router['get']('/',auth[_0xf931('0xa')](),controller['index']);router['get'](_0xf931('0xb'),auth[_0xf931('0xa')](),controller[_0xf931('0xc')]);router[_0xf931('0xd')]('/',auth[_0xf931('0xa')](),controller['create']);router['put'](_0xf931('0xb'),auth[_0xf931('0xa')](),controller[_0xf931('0xe')]);router[_0xf931('0xf')](_0xf931('0xb'),auth[_0xf931('0xa')](),controller[_0xf931('0x10')]);module[_0xf931('0x11')]=router; \ No newline at end of file +var _0xb41d=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','create','/:id'];(function(_0x4282c3,_0x164275){var _0x5d247f=function(_0x37886d){while(--_0x37886d){_0x4282c3['push'](_0x4282c3['shift']());}};_0x5d247f(++_0x164275);}(_0xb41d,0xb8));var _0xdb41=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xb41d[_0x40bffc];return _0x3007e9;};'use strict';var multer=require('multer');var util=require(_0xdb41('0x0'));var path=require(_0xdb41('0x1'));var timeout=require(_0xdb41('0x2'));var express=require(_0xdb41('0x3'));var router=express[_0xdb41('0x4')]();var fs_extra=require(_0xdb41('0x5'));var auth=require(_0xdb41('0x6'));var interaction=require(_0xdb41('0x7'));var config=require('../../config/environment');var controller=require(_0xdb41('0x8'));router['get']('/',auth[_0xdb41('0x9')](),controller[_0xdb41('0xa')]);router[_0xdb41('0xb')]('/:id',auth[_0xdb41('0x9')](),controller['show']);router['post']('/',auth[_0xdb41('0x9')](),controller[_0xdb41('0xc')]);router['put'](_0xdb41('0xd'),auth['isAuthenticated'](),controller[_0xdb41('0xe')]);router[_0xdb41('0xf')](_0xdb41('0xd'),auth[_0xdb41('0x9')](),controller[_0xdb41('0x10')]);module[_0xdb41('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 36d2b2c..7a95d5f 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 _0xe5eb=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format'];(function(_0x54a8d3,_0x12b8b7){var _0x5eec0e=function(_0xbc1ade){while(--_0xbc1ade){_0x54a8d3['push'](_0x54a8d3['shift']());}};_0x5eec0e(++_0x12b8b7);}(_0xe5eb,0x185));var _0xbe5e=function(_0x2f4cfb,_0x160886){_0x2f4cfb=_0x2f4cfb-0x0;var _0x2d0702=_0xe5eb[_0x2f4cfb];return _0x2d0702;};'use strict';var moment=require(_0xbe5e('0x0'));var Sequelize=require(_0xbe5e('0x1'));module[_0xbe5e('0x2')]={'phone':{'type':Sequelize[_0xbe5e('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xbe5e('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xbe5e('0x5')],'defaultValue':moment()[_0xbe5e('0x6')](_0xbe5e('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbe5e('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xbe5e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbe5e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbe5e('0x5')]},'priority':{'type':Sequelize[_0xbe5e('0x8')](0x2)[_0xbe5e('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xbe5e('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbe5e('0x8')],'unique':_0xbe5e('0xa')},'ListId':{'type':Sequelize[_0xbe5e('0x8')],'unique':_0xbe5e('0xa')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xbe5e('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbe5e('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbe5e('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xbe5e('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xbe5e('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xbe5e('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x6271=['INTEGER','STRING','UNSIGNED','contactListQueue','moment','sequelize','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6271,0x158));var _0x1627=function(_0x597efd,_0x3d690e){_0x597efd=_0x597efd-0x0;var _0xaa25df=_0x6271[_0x597efd];return _0xaa25df;};'use strict';var moment=require(_0x1627('0x0'));var Sequelize=require(_0x1627('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x1627('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1627('0x3')],'defaultValue':moment()[_0x1627('0x4')](_0x1627('0x5'))},'countbusyretry':{'type':Sequelize[_0x1627('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1627('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1627('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1627('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1627('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1627('0x3')]},'priority':{'type':Sequelize[_0x1627('0x6')](0x2)[_0x1627('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1627('0x6')],'unique':_0x1627('0x9')},'ListId':{'type':Sequelize[_0x1627('0x6')],'unique':_0x1627('0x9')},'UserId':{'type':Sequelize[_0x1627('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x1627('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x1627('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x1627('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1627('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1627('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1627('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x1627('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1627('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0x1627('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 3df5eaf..103684b 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 _0xed95=['phone','queue','CmContact','firstName','lastName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','List','dialActive','update','getPreviewRecall','Queue','getOpenContacts','isNil','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','sendStatus','error','name','send','index','map','CmHopper','fieldName','keys','query','filters','intersection','concat','$and','$or','$lt','$lte','$ne','$between','$notBetween','$in','$like','$notLike','$iLike','$overlap','$contains','$contained','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','then','includeAll','include','findAll','rows','params','model','rawAttributes','options','find','catch','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','merge','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4bb604,_0x40cb05){var _0x47ac49=function(_0x5d2e01){while(--_0x5d2e01){_0x4bb604['push'](_0x4bb604['shift']());}};_0x47ac49(++_0x40cb05);}(_0xed95,0xb9));var _0x5ed9=function(_0x129404,_0x1075b2){_0x129404=_0x129404-0x0;var _0x437365=_0xed95[_0x129404];return _0x437365;};'use strict';var moment=require(_0x5ed9('0x0'));var _=require(_0x5ed9('0x1'));var qs=require(_0x5ed9('0x2'));var logger=require(_0x5ed9('0x3'))(_0x5ed9('0x4'));var shared=require(_0x5ed9('0x5'));var db=require(_0x5ed9('0x6'))['db'];function respondWithResult(_0x3e2272,_0x2a28e9){_0x2a28e9=_0x2a28e9||0xc8;return function(_0x7b84d6){if(_0x7b84d6){return _0x3e2272[_0x5ed9('0x7')](_0x2a28e9)[_0x5ed9('0x8')](_0x7b84d6);}};}function respondWithFilteredResult(_0x52a57d,_0x48efa8){return function(_0x2612a8){if(_0x2612a8){var _0x217c71=typeof _0x48efa8[_0x5ed9('0x9')]===_0x5ed9('0xa')&&typeof _0x48efa8[_0x5ed9('0xb')]===_0x5ed9('0xa');var _0x5b48b1=_0x2612a8['count'];var _0x3cbaf0=_0x217c71?0x0:_0x48efa8[_0x5ed9('0x9')];var _0x46fc84=_0x217c71?_0x2612a8[_0x5ed9('0xc')]:_0x48efa8['offset']+_0x48efa8['limit'];var _0x28e087;if(_0x46fc84>=_0x5b48b1){_0x46fc84=_0x5b48b1;_0x28e087=0xc8;}else{_0x28e087=0xce;}_0x52a57d[_0x5ed9('0x7')](_0x28e087);return _0x52a57d[_0x5ed9('0xd')](_0x5ed9('0xe'),_0x3cbaf0+'-'+_0x46fc84+'/'+_0x5b48b1)['json'](_0x2612a8);}return null;};}function saveUpdates(_0x217a53,_0x110d83){return function(_0x246f80){if(_0x246f80){return _0x246f80['update'](_0x217a53)['then'](function(_0x3de296){return _0x3de296;});}return null;};}function handleEntityNotFound(_0x28587e,_0x5e952c){return function(_0x2cfd87){if(!_0x2cfd87){_0x28587e[_0x5ed9('0xf')](0x194);}return _0x2cfd87;};}function handleError(_0x59bace,_0x57692b){_0x57692b=_0x57692b||0x1f4;return function(_0x1d2d60){logger[_0x5ed9('0x10')](_0x1d2d60['stack']);if(_0x1d2d60[_0x5ed9('0x11')]){delete _0x1d2d60[_0x5ed9('0x11')];}_0x59bace['status'](_0x57692b)[_0x5ed9('0x12')](_0x1d2d60);};}exports[_0x5ed9('0x13')]=function(_0x54a570,_0x49fe37){var _0x5a3ac1={},_0x510ffe={},_0x3f65df={'count':0x0,'rows':[]};var _0x409a26=_[_0x5ed9('0x14')](db[_0x5ed9('0x15')]['rawAttributes'],function(_0x120a60){return{'name':_0x120a60[_0x5ed9('0x16')],'type':_0x120a60['type']['key']};});_0x510ffe['model']=_[_0x5ed9('0x14')](_0x409a26,_0x5ed9('0x11'));_0x510ffe['query']=_[_0x5ed9('0x17')](_0x54a570[_0x5ed9('0x18')]);_0x510ffe[_0x5ed9('0x19')]=_[_0x5ed9('0x1a')](_0x510ffe['model'],_0x510ffe[_0x5ed9('0x18')]);_0x510ffe[_0x5ed9('0x19')]=_[_0x5ed9('0x1b')](_0x510ffe[_0x5ed9('0x19')],[_0x5ed9('0x1c'),_0x5ed9('0x1d'),'$gt','$gte',_0x5ed9('0x1e'),_0x5ed9('0x1f'),_0x5ed9('0x20'),'$eq','$not',_0x5ed9('0x21'),_0x5ed9('0x22'),_0x5ed9('0x23'),'$notIn',_0x5ed9('0x24'),_0x5ed9('0x25'),_0x5ed9('0x26'),'$notILike',_0x5ed9('0x24'),_0x5ed9('0x27'),_0x5ed9('0x28'),_0x5ed9('0x29'),'$any']);_0x5a3ac1['attributes']=_[_0x5ed9('0x1a')](_0x510ffe['model'],qs[_0x5ed9('0x2a')](_0x54a570[_0x5ed9('0x18')][_0x5ed9('0x2a')]));_0x5a3ac1[_0x5ed9('0x2b')]=_0x5a3ac1[_0x5ed9('0x2b')][_0x5ed9('0x2c')]?_0x5a3ac1[_0x5ed9('0x2b')]:_0x510ffe['model'];if(!_0x54a570['query']['hasOwnProperty'](_0x5ed9('0x2d'))){_0x5a3ac1[_0x5ed9('0xb')]=qs[_0x5ed9('0xb')](_0x54a570['query'][_0x5ed9('0xb')]);_0x5a3ac1['offset']=qs[_0x5ed9('0x9')](_0x54a570[_0x5ed9('0x18')][_0x5ed9('0x9')]);}_0x5a3ac1[_0x5ed9('0x2e')]=qs[_0x5ed9('0x2f')](_0x54a570[_0x5ed9('0x18')]['sort']);_0x5a3ac1[_0x5ed9('0x30')]=qs[_0x5ed9('0x19')](_[_0x5ed9('0x31')](_0x54a570['query'],_0x510ffe['filters']),_0x409a26);if(_0x54a570[_0x5ed9('0x18')][_0x5ed9('0x32')]){_0x5a3ac1['where']=_['merge'](_0x5a3ac1[_0x5ed9('0x30')],{'$or':_[_0x5ed9('0x14')](_0x409a26,function(_0x13cac8){if(_0x13cac8[_0x5ed9('0x33')]!==_0x5ed9('0x34')){var _0x355899={};_0x355899[_0x13cac8[_0x5ed9('0x11')]]={'$like':'%'+_0x54a570[_0x5ed9('0x18')]['filter']+'%'};return _0x355899;}})});}_0x5a3ac1=_['merge']({},_0x5a3ac1,_0x54a570['options']);var _0x4699a0={'where':_0x5a3ac1[_0x5ed9('0x30')]};return db['CmHopper'][_0x5ed9('0xc')](_0x4699a0)[_0x5ed9('0x35')](function(_0x4407d2){_0x3f65df[_0x5ed9('0xc')]=_0x4407d2;if(_0x54a570['query'][_0x5ed9('0x36')]){_0x5a3ac1[_0x5ed9('0x37')]=[{'all':!![]}];}return db[_0x5ed9('0x15')][_0x5ed9('0x38')](_0x5a3ac1);})[_0x5ed9('0x35')](function(_0x5d01fe){_0x3f65df[_0x5ed9('0x39')]=_0x5d01fe;return _0x3f65df;})[_0x5ed9('0x35')](respondWithFilteredResult(_0x49fe37,_0x5a3ac1))['catch'](handleError(_0x49fe37,null));};exports['show']=function(_0x1ac6b7,_0x52c7ca){var _0x4fedbe={'raw':!![],'where':{'id':_0x1ac6b7[_0x5ed9('0x3a')]['id']}},_0x5a9287={};_0x5a9287[_0x5ed9('0x3b')]=_['keys'](db['CmHopper'][_0x5ed9('0x3c')]);_0x5a9287[_0x5ed9('0x18')]=_[_0x5ed9('0x17')](_0x1ac6b7[_0x5ed9('0x18')]);_0x5a9287[_0x5ed9('0x19')]=_[_0x5ed9('0x1a')](_0x5a9287[_0x5ed9('0x3b')],_0x5a9287[_0x5ed9('0x18')]);_0x4fedbe[_0x5ed9('0x2b')]=_[_0x5ed9('0x1a')](_0x5a9287[_0x5ed9('0x3b')],qs[_0x5ed9('0x2a')](_0x1ac6b7[_0x5ed9('0x18')][_0x5ed9('0x2a')]));_0x4fedbe['attributes']=_0x4fedbe[_0x5ed9('0x2b')][_0x5ed9('0x2c')]?_0x4fedbe[_0x5ed9('0x2b')]:_0x5a9287[_0x5ed9('0x3b')];if(_0x1ac6b7[_0x5ed9('0x18')]['includeAll']){_0x4fedbe[_0x5ed9('0x37')]=[{'all':!![]}];}_0x4fedbe=_['merge']({},_0x4fedbe,_0x1ac6b7[_0x5ed9('0x3d')]);return db[_0x5ed9('0x15')][_0x5ed9('0x3e')](_0x4fedbe)[_0x5ed9('0x35')](handleEntityNotFound(_0x52c7ca,null))[_0x5ed9('0x35')](respondWithResult(_0x52c7ca,null))[_0x5ed9('0x3f')](handleError(_0x52c7ca,null));};exports[_0x5ed9('0x40')]=function(_0x53c64f,_0x5e717b){return db[_0x5ed9('0x15')][_0x5ed9('0x40')](_0x53c64f['body'],{})[_0x5ed9('0x35')](respondWithResult(_0x5e717b,0xc9))[_0x5ed9('0x3f')](handleError(_0x5e717b,null));};exports['update']=function(_0x53a601,_0x23ea4b){if(_0x53a601[_0x5ed9('0x41')]['id']){delete _0x53a601['body']['id'];}return db[_0x5ed9('0x15')][_0x5ed9('0x3e')]({'where':{'id':_0x53a601[_0x5ed9('0x3a')]['id']}})[_0x5ed9('0x35')](handleEntityNotFound(_0x23ea4b,null))[_0x5ed9('0x35')](saveUpdates(_0x53a601[_0x5ed9('0x41')],null))[_0x5ed9('0x35')](respondWithResult(_0x23ea4b,null))[_0x5ed9('0x3f')](handleError(_0x23ea4b,null));};exports[_0x5ed9('0x42')]=function(_0x2620f0,_0x4422dd){return db[_0x5ed9('0x15')][_0x5ed9('0x42')]()['then'](respondWithResult(_0x4422dd,null))[_0x5ed9('0x3f')](handleError(_0x4422dd,null));};exports[_0x5ed9('0x43')]=function(_0x134b29,_0x5e6515){var _0xb50921;var _0x4e65ed=_0x134b29[_0x5ed9('0x3a')]['id'];return db[_0x5ed9('0x15')][_0x5ed9('0x3e')]({'where':{'id':_0x134b29[_0x5ed9('0x3a')]['id']}})[_0x5ed9('0x35')](handleEntityNotFound(_0x5e6515,null))[_0x5ed9('0x35')](function(_0x17c434){if(_0x17c434){return _0x17c434[_0x5ed9('0x43')]()[_0x5ed9('0x35')](function(_0x2ec8c2){return _0x2ec8c2;});}})[_0x5ed9('0x35')](function(_0x345bff){_0xb50921=_0x345bff;if(_0x345bff){if(_0x345bff['VoiceQueueId']||_0x345bff[_0x5ed9('0x44')]){return db[_0x345bff[_0x5ed9('0x45')]?_0x5ed9('0x46'):_0x5ed9('0x47')][_0x5ed9('0x3e')]({'where':{'id':_0x345bff['VoiceQueueId']?_0x345bff['VoiceQueueId']:_0x345bff['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x44a1ee){var _0x1bb8b8={};if(_0x44a1ee){_[_0x5ed9('0x48')](_0x1bb8b8,_[_0x5ed9('0x49')](_0xb50921[_0x5ed9('0x4a')],[_0x5ed9('0x4b'),_0x5ed9('0x4c'),'id']));_0x1bb8b8[_0x5ed9('0x4d')]=0x15;_0x1bb8b8[_0x5ed9('0x4e')]=_0x5ed9('0x4f');_0x1bb8b8[_0x5ed9('0x50')]=_0x44a1ee[_0x5ed9('0x11')];_0x1bb8b8[_0x5ed9('0x51')]=_0x134b29[_0x5ed9('0x52')]['name'];_0x1bb8b8[_0x5ed9('0x53')]=_0x134b29[_0x5ed9('0x52')]['id'];_0x1bb8b8[_0x5ed9('0x4f')]=!![];_0x1bb8b8[_0x5ed9('0x54')]=moment()[_0x5ed9('0x55')](_0x5ed9('0x56'));_0x1bb8b8['calleridnum']=_0xb50921[_0x5ed9('0x57')];_0x1bb8b8['campaigntype']=_0xb50921['VoiceQueueId']?_0x5ed9('0x58'):'ivr';return db[_0x5ed9('0x59')][_0x5ed9('0x3e')]({'where':{'id':_0x1bb8b8['ContactId']},'attributes':[_0x5ed9('0x5a'),_0x5ed9('0x5b')]})[_0x5ed9('0x35')](function(_0x1c0321){if(!_['isNil'](_0x5e6515)&&!_['isNil'](_0x1c0321['firstName'])){_0x1bb8b8[_0x5ed9('0x5c')]=_0x1c0321[_0x5ed9('0x5a')];if(!_['isNil'](_0x1c0321[_0x5ed9('0x5b')])){_0x1bb8b8[_0x5ed9('0x5c')]+='\x20'+_0x1c0321['lastName'];}}})[_0x5ed9('0x5d')](function(){return db[_0x5ed9('0x5e')]['create'](_0x1bb8b8);});}})[_0x5ed9('0x35')](function(_0x3ce6ab){return db[_0x5ed9('0x5f')]['destroy']({'where':{'CmHopperId':_0x4e65ed}});})[_0x5ed9('0x35')](function(){return _0x5e6515[_0x5ed9('0x7')](0xcc)[_0x5ed9('0x60')]();})[_0x5ed9('0x3f')](handleError(_0x5e6515,null));};exports[_0x5ed9('0x61')]=function(_0x10340f,_0x21be65){var _0xe72d99=[];return db['CmContact'][_0x5ed9('0x42')]()[_0x5ed9('0x35')](function(_0x2b36d){_0xe72d99=_[_0x5ed9('0x17')](_0x2b36d);return _0x10340f[_0x5ed9('0x52')][_0x5ed9('0x62')]({'where':{'type':_0x5ed9('0x63'),'dialActive':!![],'dialMethod':_0x5ed9('0x64')},'attributes':['id',_0x5ed9('0x65'),_0x5ed9('0x66')],'raw':!![]});})[_0x5ed9('0x35')](function(_0x3b6d17){if(_0x3b6d17&&_0x3b6d17[_0x5ed9('0x2c')]){return db[_0x5ed9('0x67')][_0x5ed9('0x68')](function(_0x3d51b6){var _0x4b08b1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5ed9('0x55')](_0x5ed9('0x56'))},'VoiceQueueId':{'$in':_['map'](_0x3b6d17,'id')},'$or':[{'UserId':null},{'UserId':_0x10340f[_0x5ed9('0x52')]['id']}]};var _0x97ab7e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3b6d17)[_0x5ed9('0x32')]([_0x5ed9('0x66'),0x0])[_0x5ed9('0x14')]('id')[_0x5ed9('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x10340f[_0x5ed9('0x52')]['id']}]};var _0xe56a17={'$or':[_0x4b08b1,_0x97ab7e]};var _0x54b343=[];if(_0x10340f[_0x5ed9('0x41')]['direction']&&_0x10340f['body'][_0x5ed9('0x6a')]===_0x5ed9('0x6b')){if(!_[_0x5ed9('0x6c')](_0x10340f['body'][_0x5ed9('0x6d')])){_0xe56a17['id']={'$in':_0x10340f[_0x5ed9('0x41')][_0x5ed9('0x6d')]};}_0x54b343=[[_0x5ed9('0x6e'),_0x5ed9('0x6f')],[_0x5ed9('0x70'),_0x3b6d17[0x0][_0x5ed9('0x65')]==='ASC'?'DESC':'ASC'],db[_0x5ed9('0x67')][_0x5ed9('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x5ed9('0x72')]];}else{if(!_[_0x5ed9('0x6c')](_0x10340f[_0x5ed9('0x41')][_0x5ed9('0x6d')])){_0xe56a17['id']={'$notIn':_0x10340f[_0x5ed9('0x41')][_0x5ed9('0x6d')]};}_0x54b343=[[_0x5ed9('0x6e'),_0x5ed9('0x72')],[_0x5ed9('0x70'),_0x3b6d17[0x0][_0x5ed9('0x65')]],db['sequelize'][_0x5ed9('0x71')](_0x5ed9('0x73')),['id',_0x5ed9('0x6f')]];}return db[_0x5ed9('0x15')][_0x5ed9('0x74')]({'attributes':['id',_0x5ed9('0x75'),_0x5ed9('0x57'),_0x5ed9('0x76')],'where':_0xe56a17,'order':_0x54b343,'transaction':_0x3d51b6,'lock':_0x3d51b6[_0x5ed9('0x77')][_0x5ed9('0x78')],'include':[{'model':db[_0x5ed9('0x59')],'as':_0x5ed9('0x79'),'attributes':_0xe72d99,'include':[{'model':db[_0x5ed9('0x7a')],'as':'Company','attributes':['id',_0x5ed9('0x11')]}]},{'model':db['CmList'],'as':_0x5ed9('0x7b'),'attributes':['id',_0x5ed9('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x5ed9('0x7c')]}]})[_0x5ed9('0x35')](function(_0x13560f){if(_0x13560f){return _0x13560f[_0x5ed9('0x7d')]({'UserId':_0x10340f[_0x5ed9('0x52')]['id']},{'transaction':_0x3d51b6});}});});}})['then'](handleEntityNotFound(_0x21be65,null))['then'](respondWithResult(_0x21be65,null))[_0x5ed9('0x3f')](handleError(_0x21be65,null));};exports[_0x5ed9('0x7e')]=function(_0x2aaa14,_0x64f4b7,_0x55821c){var _0x5bf1c0=[];var _0xbe0e06=_0x2aaa14['params']['id'];var _0x5f46f4=_0x2aaa14[_0x5ed9('0x52')]['id'];return db[_0x5ed9('0x59')][_0x5ed9('0x42')]()['then'](function(_0x24487f){_0x5bf1c0=_[_0x5ed9('0x17')](_0x24487f);return db['sequelize'][_0x5ed9('0x68')](function(_0x18e7a1){const _0x34362c={'id':_0xbe0e06};return db[_0x5ed9('0x15')]['findOne']({'attributes':['id',_0x5ed9('0x75'),'recallme'],'where':_0x34362c,'transaction':_0x18e7a1,'lock':_0x18e7a1[_0x5ed9('0x77')][_0x5ed9('0x78')],'include':[{'model':db[_0x5ed9('0x59')],'as':_0x5ed9('0x79'),'attributes':_0x5bf1c0,'include':[{'model':db[_0x5ed9('0x7a')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x5ed9('0x11')]},{'model':db[_0x5ed9('0x46')],'as':_0x5ed9('0x7f'),'attributes':['id',_0x5ed9('0x11'),'dialActive']}]})[_0x5ed9('0x35')](function(_0x45cf95){if(_0x45cf95){return _0x45cf95['update']({'UserId':_0x5f46f4},{'transaction':_0x18e7a1});}});});})[_0x5ed9('0x35')](handleEntityNotFound(_0x64f4b7,null))[_0x5ed9('0x35')](respondWithResult(_0x64f4b7,null))[_0x5ed9('0x3f')](handleError(_0x64f4b7,null));};exports[_0x5ed9('0x80')]=function(_0x20a579,_0x533866){return _0x20a579[_0x5ed9('0x52')][_0x5ed9('0x62')]({'where':{'type':_0x5ed9('0x63'),'dialActive':!![],'dialMethod':_0x5ed9('0x64')},'attributes':['id'],'raw':!![]})[_0x5ed9('0x35')](function(_0x24d9fe){if(_0x24d9fe&&_0x24d9fe[_0x5ed9('0x2c')]){return db['CmHopper'][_0x5ed9('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5ed9('0x55')](_0x5ed9('0x56'))},'VoiceQueueId':{'$in':_[_0x5ed9('0x14')](_0x24d9fe,'id')},'$or':[{'UserId':null},{'UserId':_0x20a579[_0x5ed9('0x52')]['id']}]}});}return 0x0;})[_0x5ed9('0x35')](function(_0x565405){if(!_[_0x5ed9('0x81')](_0x565405)&&_[_0x5ed9('0x82')](_0x565405)){return _0x533866[_0x5ed9('0x7')](0xc8)[_0x5ed9('0x8')]({'contacts':_0x565405});}else{logger['error'](_0x5ed9('0x83'),'getOpenContacts',0x194,_0x5ed9('0x84'));_0x533866[_0x5ed9('0xf')](0x194);}})[_0x5ed9('0x3f')](handleError(_0x533866,null));};exports[_0x5ed9('0x85')]=function(_0x3b474e,_0x5db252){var _0x37b98a=shared[_0x5ed9('0x86')];var _0x682d7c=[];_[_0x5ed9('0x14')](_0x37b98a,function(_0x50d590){_0x682d7c[_0x5ed9('0x87')]({'id':_0x50d590[_0x5ed9('0x11')],'name':_0x50d590[_0x5ed9('0x11')],'utcOffset':_0x50d590['utcOffset']});});return _0x5db252[_0x5ed9('0x7')](0xc8)[_0x5ed9('0x8')]({'tz':_0x682d7c});};exports['getTimezone']=function(_0x1ea31e,_0x2d8868){var _0x2164f1=shared['timezones'];var _0x1bbb1a={};if(!_[_0x5ed9('0x81')](_0x2164f1[_0x1ea31e[_0x5ed9('0x41')]['id']]))_0x1bbb1a=_0x2164f1[_0x1ea31e[_0x5ed9('0x41')]['id']];return _0x2d8868[_0x5ed9('0x7')](0xc8)[_0x5ed9('0x8')](_0x1bbb1a);}; \ No newline at end of file +var _0x4c4e=['options','include','findAll','rows','show','params','includeAll','find','catch','create','body','update','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','scheduledAt','sequelize','findOne','scheduledat','phone','LOCK','UPDATE','Company','CmList','List','Queue','dialActive','recallme','Contact','getOpenContacts','getVoiceQueues','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','then','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','keys','filters','intersection','concat','$gt','$lt','$ne','$not','$notBetween','$iLike','$overlap','$contains','attributes','fields','length','sort','where','pick','filter','merge'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x4c4e,0x152));var _0xe4c4=function(_0x17b1c1,_0x56dbc4){_0x17b1c1=_0x17b1c1-0x0;var _0x2a732e=_0x4c4e[_0x17b1c1];return _0x2a732e;};'use strict';var moment=require(_0xe4c4('0x0'));var _=require('lodash');var qs=require(_0xe4c4('0x1'));var logger=require(_0xe4c4('0x2'))(_0xe4c4('0x3'));var shared=require('../../config/environment');var db=require(_0xe4c4('0x4'))['db'];function respondWithResult(_0x7d7655,_0x1a4483){_0x1a4483=_0x1a4483||0xc8;return function(_0x4cd652){if(_0x4cd652){return _0x7d7655[_0xe4c4('0x5')](_0x1a4483)['json'](_0x4cd652);}};}function respondWithFilteredResult(_0x177732,_0x1a12a6){return function(_0x262b64){if(_0x262b64){var _0xad105=typeof _0x1a12a6[_0xe4c4('0x6')]===_0xe4c4('0x7')&&typeof _0x1a12a6[_0xe4c4('0x8')]===_0xe4c4('0x7');var _0x4c953c=_0x262b64['count'];var _0x31f879=_0xad105?0x0:_0x1a12a6[_0xe4c4('0x6')];var _0x27ad42=_0xad105?_0x262b64[_0xe4c4('0x9')]:_0x1a12a6[_0xe4c4('0x6')]+_0x1a12a6[_0xe4c4('0x8')];var _0x50264f;if(_0x27ad42>=_0x4c953c){_0x27ad42=_0x4c953c;_0x50264f=0xc8;}else{_0x50264f=0xce;}_0x177732[_0xe4c4('0x5')](_0x50264f);return _0x177732[_0xe4c4('0xa')](_0xe4c4('0xb'),_0x31f879+'-'+_0x27ad42+'/'+_0x4c953c)[_0xe4c4('0xc')](_0x262b64);}return null;};}function saveUpdates(_0x50bfab,_0x262083){return function(_0x115802){if(_0x115802){return _0x115802['update'](_0x50bfab)[_0xe4c4('0xd')](function(_0x1a44e5){return _0x1a44e5;});}return null;};}function handleEntityNotFound(_0x5aa89b,_0x42ce9e){return function(_0x29766a){if(!_0x29766a){_0x5aa89b['sendStatus'](0x194);}return _0x29766a;};}function handleError(_0x307aa8,_0x465c9b){_0x465c9b=_0x465c9b||0x1f4;return function(_0x26ea05){logger[_0xe4c4('0xe')](_0x26ea05[_0xe4c4('0xf')]);if(_0x26ea05[_0xe4c4('0x10')]){delete _0x26ea05[_0xe4c4('0x10')];}_0x307aa8[_0xe4c4('0x5')](_0x465c9b)[_0xe4c4('0x11')](_0x26ea05);};}exports[_0xe4c4('0x12')]=function(_0x23b7e6,_0x42242c){var _0x3820c7={},_0x43a9ce={},_0x376585={'count':0x0,'rows':[]};var _0x5a32b5=_[_0xe4c4('0x13')](db[_0xe4c4('0x14')][_0xe4c4('0x15')],function(_0x317cc8){return{'name':_0x317cc8['fieldName'],'type':_0x317cc8[_0xe4c4('0x16')][_0xe4c4('0x17')]};});_0x43a9ce[_0xe4c4('0x18')]=_[_0xe4c4('0x13')](_0x5a32b5,_0xe4c4('0x10'));_0x43a9ce[_0xe4c4('0x19')]=_[_0xe4c4('0x1a')](_0x23b7e6[_0xe4c4('0x19')]);_0x43a9ce[_0xe4c4('0x1b')]=_[_0xe4c4('0x1c')](_0x43a9ce[_0xe4c4('0x18')],_0x43a9ce[_0xe4c4('0x19')]);_0x43a9ce[_0xe4c4('0x1b')]=_[_0xe4c4('0x1d')](_0x43a9ce[_0xe4c4('0x1b')],['$and','$or',_0xe4c4('0x1e'),'$gte',_0xe4c4('0x1f'),'$lte',_0xe4c4('0x20'),'$eq',_0xe4c4('0x21'),'$between',_0xe4c4('0x22'),'$in','$notIn','$like','$notLike',_0xe4c4('0x23'),'$notILike','$like',_0xe4c4('0x24'),_0xe4c4('0x25'),'$contained','$any']);_0x3820c7[_0xe4c4('0x26')]=_[_0xe4c4('0x1c')](_0x43a9ce['model'],qs[_0xe4c4('0x27')](_0x23b7e6[_0xe4c4('0x19')][_0xe4c4('0x27')]));_0x3820c7['attributes']=_0x3820c7['attributes'][_0xe4c4('0x28')]?_0x3820c7[_0xe4c4('0x26')]:_0x43a9ce[_0xe4c4('0x18')];if(!_0x23b7e6[_0xe4c4('0x19')]['hasOwnProperty']('nolimit')){_0x3820c7[_0xe4c4('0x8')]=qs[_0xe4c4('0x8')](_0x23b7e6['query'][_0xe4c4('0x8')]);_0x3820c7[_0xe4c4('0x6')]=qs[_0xe4c4('0x6')](_0x23b7e6['query'][_0xe4c4('0x6')]);}_0x3820c7['order']=qs[_0xe4c4('0x29')](_0x23b7e6[_0xe4c4('0x19')][_0xe4c4('0x29')]);_0x3820c7[_0xe4c4('0x2a')]=qs[_0xe4c4('0x1b')](_[_0xe4c4('0x2b')](_0x23b7e6[_0xe4c4('0x19')],_0x43a9ce[_0xe4c4('0x1b')]),_0x5a32b5);if(_0x23b7e6[_0xe4c4('0x19')][_0xe4c4('0x2c')]){_0x3820c7[_0xe4c4('0x2a')]=_[_0xe4c4('0x2d')](_0x3820c7['where'],{'$or':_[_0xe4c4('0x13')](_0x5a32b5,function(_0x25eb81){if(_0x25eb81[_0xe4c4('0x16')]!=='VIRTUAL'){var _0xac6cb4={};_0xac6cb4[_0x25eb81[_0xe4c4('0x10')]]={'$like':'%'+_0x23b7e6[_0xe4c4('0x19')]['filter']+'%'};return _0xac6cb4;}})});}_0x3820c7=_[_0xe4c4('0x2d')]({},_0x3820c7,_0x23b7e6[_0xe4c4('0x2e')]);var _0x4a3644={'where':_0x3820c7[_0xe4c4('0x2a')]};return db[_0xe4c4('0x14')][_0xe4c4('0x9')](_0x4a3644)[_0xe4c4('0xd')](function(_0x44f4eb){_0x376585[_0xe4c4('0x9')]=_0x44f4eb;if(_0x23b7e6[_0xe4c4('0x19')]['includeAll']){_0x3820c7[_0xe4c4('0x2f')]=[{'all':!![]}];}return db[_0xe4c4('0x14')][_0xe4c4('0x30')](_0x3820c7);})[_0xe4c4('0xd')](function(_0x4c5551){_0x376585[_0xe4c4('0x31')]=_0x4c5551;return _0x376585;})[_0xe4c4('0xd')](respondWithFilteredResult(_0x42242c,_0x3820c7))['catch'](handleError(_0x42242c,null));};exports[_0xe4c4('0x32')]=function(_0x185959,_0x4db15d){var _0x433f0c={'raw':!![],'where':{'id':_0x185959[_0xe4c4('0x33')]['id']}},_0x3cd4d3={};_0x3cd4d3[_0xe4c4('0x18')]=_[_0xe4c4('0x1a')](db[_0xe4c4('0x14')][_0xe4c4('0x15')]);_0x3cd4d3[_0xe4c4('0x19')]=_[_0xe4c4('0x1a')](_0x185959[_0xe4c4('0x19')]);_0x3cd4d3[_0xe4c4('0x1b')]=_[_0xe4c4('0x1c')](_0x3cd4d3['model'],_0x3cd4d3[_0xe4c4('0x19')]);_0x433f0c[_0xe4c4('0x26')]=_[_0xe4c4('0x1c')](_0x3cd4d3[_0xe4c4('0x18')],qs[_0xe4c4('0x27')](_0x185959[_0xe4c4('0x19')]['fields']));_0x433f0c[_0xe4c4('0x26')]=_0x433f0c['attributes'][_0xe4c4('0x28')]?_0x433f0c[_0xe4c4('0x26')]:_0x3cd4d3[_0xe4c4('0x18')];if(_0x185959[_0xe4c4('0x19')][_0xe4c4('0x34')]){_0x433f0c['include']=[{'all':!![]}];}_0x433f0c=_['merge']({},_0x433f0c,_0x185959[_0xe4c4('0x2e')]);return db[_0xe4c4('0x14')][_0xe4c4('0x35')](_0x433f0c)['then'](handleEntityNotFound(_0x4db15d,null))[_0xe4c4('0xd')](respondWithResult(_0x4db15d,null))[_0xe4c4('0x36')](handleError(_0x4db15d,null));};exports[_0xe4c4('0x37')]=function(_0x36e7b1,_0x54e073){return db[_0xe4c4('0x14')][_0xe4c4('0x37')](_0x36e7b1[_0xe4c4('0x38')],{})[_0xe4c4('0xd')](respondWithResult(_0x54e073,0xc9))[_0xe4c4('0x36')](handleError(_0x54e073,null));};exports[_0xe4c4('0x39')]=function(_0x1eda5e,_0x176712){if(_0x1eda5e[_0xe4c4('0x38')]['id']){delete _0x1eda5e['body']['id'];}return db[_0xe4c4('0x14')]['find']({'where':{'id':_0x1eda5e[_0xe4c4('0x33')]['id']}})[_0xe4c4('0xd')](handleEntityNotFound(_0x176712,null))[_0xe4c4('0xd')](saveUpdates(_0x1eda5e[_0xe4c4('0x38')],null))[_0xe4c4('0xd')](respondWithResult(_0x176712,null))[_0xe4c4('0x36')](handleError(_0x176712,null));};exports[_0xe4c4('0x3a')]=function(_0xeb6432,_0x36f8ad){return db[_0xe4c4('0x14')][_0xe4c4('0x3a')]()[_0xe4c4('0xd')](respondWithResult(_0x36f8ad,null))[_0xe4c4('0x36')](handleError(_0x36f8ad,null));};exports[_0xe4c4('0x3b')]=function(_0x535bcc,_0x4922f5){var _0xe0e351;var _0x198961=_0x535bcc['params']['id'];return db[_0xe4c4('0x14')][_0xe4c4('0x35')]({'where':{'id':_0x535bcc[_0xe4c4('0x33')]['id']}})[_0xe4c4('0xd')](handleEntityNotFound(_0x4922f5,null))[_0xe4c4('0xd')](function(_0x5587b2){if(_0x5587b2){return _0x5587b2[_0xe4c4('0x3b')]()[_0xe4c4('0xd')](function(_0x4f6e03){return _0x4f6e03;});}})[_0xe4c4('0xd')](function(_0x24b0e7){_0xe0e351=_0x24b0e7;if(_0x24b0e7){if(_0x24b0e7['VoiceQueueId']||_0x24b0e7[_0xe4c4('0x3c')]){return db[_0x24b0e7['VoiceQueueId']?_0xe4c4('0x3d'):_0xe4c4('0x3e')][_0xe4c4('0x35')]({'where':{'id':_0x24b0e7[_0xe4c4('0x3f')]?_0x24b0e7[_0xe4c4('0x3f')]:_0x24b0e7['CampaignId']},'attributes':['id',_0xe4c4('0x10')],'raw':!![]});}}})[_0xe4c4('0xd')](function(_0x33bcec){var _0x2350d7={};if(_0x33bcec){_[_0xe4c4('0x2d')](_0x2350d7,_[_0xe4c4('0x40')](_0xe0e351[_0xe4c4('0x41')],[_0xe4c4('0x42'),_0xe4c4('0x43'),'id']));_0x2350d7[_0xe4c4('0x44')]=0x15;_0x2350d7[_0xe4c4('0x45')]=_0xe4c4('0x46');_0x2350d7[_0xe4c4('0x47')]=_0x33bcec[_0xe4c4('0x10')];_0x2350d7[_0xe4c4('0x48')]=_0x535bcc[_0xe4c4('0x49')]['name'];_0x2350d7[_0xe4c4('0x4a')]=_0x535bcc[_0xe4c4('0x49')]['id'];_0x2350d7[_0xe4c4('0x46')]=!![];_0x2350d7['deletedat']=moment()[_0xe4c4('0x4b')](_0xe4c4('0x4c'));_0x2350d7[_0xe4c4('0x4d')]=_0xe0e351['phone'];_0x2350d7[_0xe4c4('0x4e')]=_0xe0e351['VoiceQueueId']?_0xe4c4('0x4f'):_0xe4c4('0x50');return db[_0xe4c4('0x51')]['find']({'where':{'id':_0x2350d7['ContactId']},'attributes':[_0xe4c4('0x52'),_0xe4c4('0x53')]})[_0xe4c4('0xd')](function(_0x5edcae){if(!_[_0xe4c4('0x54')](_0x4922f5)&&!_['isNil'](_0x5edcae['firstName'])){_0x2350d7['calleridname']=_0x5edcae['firstName'];if(!_[_0xe4c4('0x54')](_0x5edcae[_0xe4c4('0x53')])){_0x2350d7[_0xe4c4('0x55')]+='\x20'+_0x5edcae[_0xe4c4('0x53')];}}})[_0xe4c4('0x56')](function(){return db[_0xe4c4('0x57')]['create'](_0x2350d7);});}})[_0xe4c4('0xd')](function(_0x44eb3b){return db[_0xe4c4('0x58')][_0xe4c4('0x3b')]({'where':{'CmHopperId':_0x198961}});})[_0xe4c4('0xd')](function(){return _0x4922f5[_0xe4c4('0x5')](0xcc)['end']();})['catch'](handleError(_0x4922f5,null));};exports[_0xe4c4('0x59')]=function(_0x6f374e,_0x1986ab){var _0x3c8e44=[];return db[_0xe4c4('0x51')][_0xe4c4('0x3a')]()[_0xe4c4('0xd')](function(_0x24e1a2){_0x3c8e44=_[_0xe4c4('0x1a')](_0x24e1a2);return _0x6f374e['user']['getVoiceQueues']({'where':{'type':_0xe4c4('0x5a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xe4c4('0x5b'),_0xe4c4('0x5c')],'raw':!![]});})[_0xe4c4('0xd')](function(_0x58f2dd){if(_0x58f2dd&&_0x58f2dd[_0xe4c4('0x28')]){return db['sequelize'][_0xe4c4('0x5d')](function(_0x56ead3){var _0x5d6c0a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe4c4('0x4b')](_0xe4c4('0x4c'))},'VoiceQueueId':{'$in':_[_0xe4c4('0x13')](_0x58f2dd,'id')},'$or':[{'UserId':null},{'UserId':_0x6f374e['user']['id']}]};var _0x57e38e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x58f2dd)['filter']([_0xe4c4('0x5c'),0x0])[_0xe4c4('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x6f374e[_0xe4c4('0x49')]['id']}]};var _0x3850da={'$or':[_0x5d6c0a,_0x57e38e]};var _0x11115a=[];if(_0x6f374e['body']['direction']&&_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x5e')]===_0xe4c4('0x5f')){if(!_[_0xe4c4('0x60')](_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x61')])){_0x3850da['id']={'$in':_0x6f374e['body'][_0xe4c4('0x61')]};}_0x11115a=[[_0xe4c4('0x62'),_0xe4c4('0x63')],['scheduledAt',_0x58f2dd[0x0][_0xe4c4('0x5b')]===_0xe4c4('0x63')?_0xe4c4('0x64'):'ASC'],db['sequelize'][_0xe4c4('0x65')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0xe4c4('0x60')](_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x61')])){_0x3850da['id']={'$notIn':_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x61')]};}_0x11115a=[[_0xe4c4('0x62'),_0xe4c4('0x64')],[_0xe4c4('0x66'),_0x58f2dd[0x0]['dialOrderByScheduledAt']],db[_0xe4c4('0x67')][_0xe4c4('0x65')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0xe4c4('0x14')][_0xe4c4('0x68')]({'attributes':['id',_0xe4c4('0x69'),_0xe4c4('0x6a'),'recallme'],'where':_0x3850da,'order':_0x11115a,'transaction':_0x56ead3,'lock':_0x56ead3[_0xe4c4('0x6b')][_0xe4c4('0x6c')],'include':[{'model':db[_0xe4c4('0x51')],'as':'Contact','attributes':_0x3c8e44,'include':[{'model':db['CmCompany'],'as':_0xe4c4('0x6d'),'attributes':['id',_0xe4c4('0x10')]}]},{'model':db[_0xe4c4('0x6e')],'as':_0xe4c4('0x6f'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xe4c4('0x70'),'attributes':['id',_0xe4c4('0x10'),_0xe4c4('0x71')]}]})[_0xe4c4('0xd')](function(_0x1c9f4b){if(_0x1c9f4b){return _0x1c9f4b['update']({'UserId':_0x6f374e[_0xe4c4('0x49')]['id']},{'transaction':_0x56ead3});}});});}})['then'](handleEntityNotFound(_0x1986ab,null))[_0xe4c4('0xd')](respondWithResult(_0x1986ab,null))[_0xe4c4('0x36')](handleError(_0x1986ab,null));};exports['getPreviewRecall']=function(_0x570f1f,_0x4eddfd,_0x279075){var _0x250bb8=[];var _0x1f880f=_0x570f1f[_0xe4c4('0x33')]['id'];var _0x5b41e6=_0x570f1f['user']['id'];return db['CmContact'][_0xe4c4('0x3a')]()[_0xe4c4('0xd')](function(_0x4c10ef){_0x250bb8=_[_0xe4c4('0x1a')](_0x4c10ef);return db[_0xe4c4('0x67')][_0xe4c4('0x5d')](function(_0xb0a006){const _0x5cbc28={'id':_0x1f880f};return db['CmHopper'][_0xe4c4('0x68')]({'attributes':['id',_0xe4c4('0x69'),_0xe4c4('0x72')],'where':_0x5cbc28,'transaction':_0xb0a006,'lock':_0xb0a006[_0xe4c4('0x6b')][_0xe4c4('0x6c')],'include':[{'model':db[_0xe4c4('0x51')],'as':_0xe4c4('0x73'),'attributes':_0x250bb8,'include':[{'model':db['CmCompany'],'as':_0xe4c4('0x6d'),'attributes':['id',_0xe4c4('0x10')]}]},{'model':db[_0xe4c4('0x6e')],'as':_0xe4c4('0x6f'),'attributes':['id','name']},{'model':db[_0xe4c4('0x3d')],'as':_0xe4c4('0x70'),'attributes':['id',_0xe4c4('0x10'),_0xe4c4('0x71')]}]})['then'](function(_0x209602){if(_0x209602){return _0x209602[_0xe4c4('0x39')]({'UserId':_0x5b41e6},{'transaction':_0xb0a006});}});});})['then'](handleEntityNotFound(_0x4eddfd,null))['then'](respondWithResult(_0x4eddfd,null))[_0xe4c4('0x36')](handleError(_0x4eddfd,null));};exports[_0xe4c4('0x74')]=function(_0x3314d6,_0xe30faf){return _0x3314d6[_0xe4c4('0x49')][_0xe4c4('0x75')]({'where':{'type':_0xe4c4('0x5a'),'dialActive':!![],'dialMethod':_0xe4c4('0x76')},'attributes':['id'],'raw':!![]})['then'](function(_0x5ae9f0){if(_0x5ae9f0&&_0x5ae9f0[_0xe4c4('0x28')]){return db[_0xe4c4('0x14')][_0xe4c4('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe4c4('0x4b')](_0xe4c4('0x4c'))},'VoiceQueueId':{'$in':_['map'](_0x5ae9f0,'id')},'$or':[{'UserId':null},{'UserId':_0x3314d6[_0xe4c4('0x49')]['id']}]}});}return 0x0;})[_0xe4c4('0xd')](function(_0x425f38){if(!_[_0xe4c4('0x54')](_0x425f38)&&_[_0xe4c4('0x77')](_0x425f38)){return _0xe30faf[_0xe4c4('0x5')](0xc8)[_0xe4c4('0xc')]({'contacts':_0x425f38});}else{logger[_0xe4c4('0xe')](_0xe4c4('0x78'),_0xe4c4('0x74'),0x194,_0xe4c4('0x79'));_0xe30faf[_0xe4c4('0x7a')](0x194);}})[_0xe4c4('0x36')](handleError(_0xe30faf,null));};exports[_0xe4c4('0x7b')]=function(_0x1ccdb2,_0x1295a4){var _0x52c3e0=shared['timezones'];var _0x340983=[];_['map'](_0x52c3e0,function(_0x46de38){_0x340983[_0xe4c4('0x7c')]({'id':_0x46de38[_0xe4c4('0x10')],'name':_0x46de38[_0xe4c4('0x10')],'utcOffset':_0x46de38[_0xe4c4('0x7d')]});});return _0x1295a4[_0xe4c4('0x5')](0xc8)[_0xe4c4('0xc')]({'tz':_0x340983});};exports[_0xe4c4('0x7e')]=function(_0x371947,_0x1579fe){var _0x37bf48=shared[_0xe4c4('0x7f')];var _0x3030f6={};if(!_['isNil'](_0x37bf48[_0x371947[_0xe4c4('0x38')]['id']]))_0x3030f6=_0x37bf48[_0x371947[_0xe4c4('0x38')]['id']];return _0x1579fe[_0xe4c4('0x5')](0xc8)[_0xe4c4('0xc')](_0x3030f6);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c431b26..f53087d 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 _0x5fab=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5b889c,_0x5089be){var _0x313f75=function(_0x13b941){while(--_0x13b941){_0x5b889c['push'](_0x5b889c['shift']());}};_0x313f75(++_0x5089be);}(_0x5fab,0x177));var _0xb5fa=function(_0x368682,_0x56698f){_0x368682=_0x368682-0x0;var _0x2bc428=_0x5fab[_0x368682];return _0x2bc428;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['scheduledat']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x1a61b7,_0x3363e2){var _0x531316=function(_0x15573f){while(--_0x15573f){_0x1a61b7['push'](_0x1a61b7['shift']());}};_0x531316(++_0x3363e2);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'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 diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index bed5fda..ba8d36a 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 _0xe128=['push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','NOW()','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe128,0x1a3));var _0x8e12=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xe128[_0x420f2a];return _0x28f802;};'use strict';var _=require(_0x8e12('0x0'));var util=require(_0x8e12('0x1'));var moment=require(_0x8e12('0x2'));var BPromise=require(_0x8e12('0x3'));var db=require(_0x8e12('0x4'))['db'];var logger=require(_0x8e12('0x5'))(_0x8e12('0x6'));exports[_0x8e12('0x7')]=function(_0x4f459d){var _0x675d9a=this;return new Promise(function(_0x3730c4,_0x33cb16){return db[_0x8e12('0x8')][_0x8e12('0x9')]({'raw':_0x4f459d[_0x8e12('0xa')]?_0x4f459d[_0x8e12('0xa')][_0x8e12('0xb')]===undefined?!![]:![]:!![],'where':_0x4f459d[_0x8e12('0xa')]?_0x4f459d[_0x8e12('0xa')][_0x8e12('0xc')]||null:null,'attributes':_0x4f459d[_0x8e12('0xa')]?_0x4f459d['options'][_0x8e12('0xd')]||null:null,'limit':_0x4f459d['options']?_0x4f459d['options'][_0x8e12('0xe')]||null:null,'include':_0x4f459d[_0x8e12('0xa')]?_0x4f459d[_0x8e12('0xa')][_0x8e12('0xf')]?_[_0x8e12('0x10')](_0x4f459d['options'][_0x8e12('0xf')],function(_0x356ae8){return{'model':db[_0x356ae8[_0x8e12('0x11')]],'as':_0x356ae8['as'],'attributes':_0x356ae8['attributes'],'include':_0x356ae8[_0x8e12('0xf')]?_[_0x8e12('0x10')](_0x356ae8[_0x8e12('0xf')],function(_0x31afad){return{'model':db[_0x31afad[_0x8e12('0x11')]],'as':_0x31afad['as'],'attributes':_0x31afad['attributes'],'include':_0x31afad[_0x8e12('0xf')]?_[_0x8e12('0x10')](_0x31afad[_0x8e12('0xf')],function(_0x385d73){return{'model':db[_0x385d73[_0x8e12('0x11')]],'as':_0x385d73['as'],'attributes':_0x385d73[_0x8e12('0xd')]};}):[]};}):[]};}):[]:[]})[_0x8e12('0x12')](function(_0x5b322d){logger[_0x8e12('0x13')](_0x8e12('0x7'),_0x4f459d);logger[_0x8e12('0x14')](_0x8e12('0x7'),_0x4f459d,JSON[_0x8e12('0x15')](_0x5b322d));_0x3730c4(_0x5b322d);})[_0x8e12('0x16')](function(_0x45c7be){logger[_0x8e12('0x17')](_0x8e12('0x7'),_0x45c7be[_0x8e12('0x18')],_0x4f459d);_0x33cb16(_0x675d9a[_0x8e12('0x17')](0x1f4,_0x45c7be[_0x8e12('0x18')]));});});};exports[_0x8e12('0x19')]=function(_0x4d4c7f){var _0x34eb8e=this;return new Promise(function(_0x597422,_0x3c0d90){return db[_0x8e12('0x8')][_0x8e12('0x1a')]({'raw':_0x4d4c7f[_0x8e12('0xa')]?_0x4d4c7f['options'][_0x8e12('0xb')]===undefined?!![]:![]:!![],'where':_0x4d4c7f[_0x8e12('0xa')]?_0x4d4c7f[_0x8e12('0xa')][_0x8e12('0xc')]||null:null,'attributes':_0x4d4c7f[_0x8e12('0xa')]?_0x4d4c7f[_0x8e12('0xa')]['attributes']||null:null,'include':_0x4d4c7f[_0x8e12('0xa')]?_0x4d4c7f[_0x8e12('0xa')][_0x8e12('0xf')]?_[_0x8e12('0x10')](_0x4d4c7f[_0x8e12('0xa')][_0x8e12('0xf')],function(_0x47050f){return{'model':db[_0x47050f['model']],'as':_0x47050f['as'],'attributes':_0x47050f[_0x8e12('0xd')],'include':_0x47050f[_0x8e12('0xf')]?_[_0x8e12('0x10')](_0x47050f[_0x8e12('0xf')],function(_0x5e3cb0){return{'model':db[_0x5e3cb0['model']],'as':_0x5e3cb0['as'],'attributes':_0x5e3cb0[_0x8e12('0xd')],'include':_0x5e3cb0[_0x8e12('0xf')]?_[_0x8e12('0x10')](_0x5e3cb0[_0x8e12('0xf')],function(_0x139b36){return{'model':db[_0x139b36['model']],'as':_0x139b36['as'],'attributes':_0x139b36[_0x8e12('0xd')]};}):[]};}):[]};}):[]:[]})[_0x8e12('0x12')](function(_0x2521ac){logger[_0x8e12('0x13')]('ShowCmHopper',_0x4d4c7f);logger[_0x8e12('0x14')](_0x8e12('0x19'),_0x4d4c7f,JSON[_0x8e12('0x15')](_0x2521ac));_0x597422(_0x2521ac);})[_0x8e12('0x16')](function(_0x5d7741){logger[_0x8e12('0x17')]('ShowCmHopper',_0x5d7741['message'],_0x4d4c7f);_0x3c0d90(_0x34eb8e[_0x8e12('0x17')](0x1f4,_0x5d7741[_0x8e12('0x18')]));});});};exports[_0x8e12('0x1b')]=function(_0x54d930){var _0x10a5e5=this;return new Promise(function(_0x8d1501,_0x7fe519){return db[_0x8e12('0x8')]['create'](_0x54d930[_0x8e12('0x1c')],{'raw':_0x54d930[_0x8e12('0xa')]?_0x54d930[_0x8e12('0xa')]['raw']===undefined?!![]:![]:!![]})[_0x8e12('0x12')](function(_0x43b0e5){logger['info']('CreateCmHopper',_0x54d930);logger['debug']('CreateCmHopper',_0x54d930,JSON[_0x8e12('0x15')](_0x43b0e5));_0x8d1501(_0x43b0e5);})[_0x8e12('0x16')](function(_0x438e21){logger[_0x8e12('0x17')](_0x8e12('0x1b'),_0x438e21[_0x8e12('0x18')],_0x54d930);_0x7fe519(_0x10a5e5[_0x8e12('0x17')](0x1f4,_0x438e21[_0x8e12('0x18')]));});});};exports[_0x8e12('0x1d')]=function(_0x7ad01d){var _0x4610f6=this;return new Promise(function(_0x426048,_0xf73b7f){return db[_0x8e12('0x8')][_0x8e12('0x1e')](_0x7ad01d['body'],{'raw':_0x7ad01d['options']?_0x7ad01d[_0x8e12('0xa')][_0x8e12('0xb')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7ad01d['options']?_0x7ad01d[_0x8e12('0xa')][_0x8e12('0xc')]||null:null,'attributes':_0x7ad01d[_0x8e12('0xa')]?_0x7ad01d[_0x8e12('0xa')][_0x8e12('0xd')]||null:null,'limit':_0x7ad01d[_0x8e12('0xa')]?_0x7ad01d['options']['limit']||null:null})['then'](function(_0x3268f6){logger['info'](_0x8e12('0x1d'),_0x7ad01d);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x8e12('0x15')](_0x7ad01d['options'][_0x8e12('0xc')]),_0x7ad01d[_0x8e12('0x1c')][_0x8e12('0x1f')]);logger[_0x8e12('0x14')]('UpdateCmHopper',_0x7ad01d,JSON[_0x8e12('0x15')](_0x3268f6));_0x426048(_0x3268f6);})[_0x8e12('0x16')](function(_0x4d9882){logger[_0x8e12('0x17')](_0x8e12('0x1d'),_0x4d9882[_0x8e12('0x18')],_0x7ad01d);_0xf73b7f(_0x4610f6[_0x8e12('0x17')](0x1f4,_0x4d9882['message']));});});};exports[_0x8e12('0x20')]=function(_0x5b7f2e){var _0x58e6bb=this;return new Promise(function(_0x40506f,_0x5a4587){return db[_0x8e12('0x8')]['destroy']({'where':_0x5b7f2e[_0x8e12('0xa')]?_0x5b7f2e['options'][_0x8e12('0xc')]||null:null})[_0x8e12('0x12')](function(_0x10e7f9){logger[_0x8e12('0x13')](_0x8e12('0x20'),_0x5b7f2e);logger[_0x8e12('0x14')]('DestroyCmHopper',_0x5b7f2e,JSON['stringify'](_0x10e7f9));_0x40506f(_0x10e7f9);})[_0x8e12('0x16')](function(_0x37dd65){logger[_0x8e12('0x17')](_0x8e12('0x20'),_0x37dd65[_0x8e12('0x18')],_0x5b7f2e);_0x5a4587(_0x58e6bb[_0x8e12('0x17')](0x1f4,_0x37dd65['message']));});});};exports[_0x8e12('0x21')]=function(_0x27a411){var _0x7d2bb0=this;return new Promise(function(_0x12e12f,_0x2d4526){return db[_0x8e12('0x22')][_0x8e12('0x23')]()[_0x8e12('0x12')](function(_0x849334){return db[_0x8e12('0x24')][_0x8e12('0x25')](function(_0x402b22){return db[_0x8e12('0x8')][_0x8e12('0x9')]({'where':_0x27a411['options']?_0x27a411[_0x8e12('0xa')][_0x8e12('0xc')]||null:null,'attributes':_0x27a411[_0x8e12('0xa')]?_0x27a411[_0x8e12('0xa')]['attributes']||null:null,'limit':_0x27a411[_0x8e12('0xa')]?_0x27a411[_0x8e12('0xa')]['limit']||null:null,'order':_0x27a411[_0x8e12('0xa')]?_0x27a411['options'][_0x8e12('0x26')]||null:null,'transaction':_0x402b22,'lock':_0x402b22[_0x8e12('0x27')][_0x8e12('0x28')],'include':[{'model':db[_0x8e12('0x22')],'as':_0x8e12('0x29'),'attributes':_[_0x8e12('0x2a')](_0x849334)},{'model':db[_0x8e12('0x2b')],'as':_0x8e12('0x2c'),'attributes':['id',_0x8e12('0x2d'),_0x8e12('0x2e')]}]})[_0x8e12('0x12')](function(_0x2df902){var _0x136839=[];var _0x57e894=[];for(var _0x2e4389=0x0;_0x2e4389<_0x2df902[_0x8e12('0x2f')];_0x2e4389+=0x1){var _0x1f1b1f=_0x2df902[_0x2e4389][_0x8e12('0x30')];if(_0x1f1b1f===null){_0x136839[_0x8e12('0x31')](_0x2df902[_0x2e4389][_0x8e12('0x1e')](_0x27a411[_0x8e12('0x1c')],{'transaction':_0x402b22}));}else if(!_0x57e894[_0x8e12('0x32')](_0x1f1b1f)){_0x57e894[_0x8e12('0x31')](_0x1f1b1f);_0x136839[_0x8e12('0x31')](_0x2df902[_0x2e4389][_0x8e12('0x1e')](_0x27a411[_0x8e12('0x1c')],{'transaction':_0x402b22}));}}return BPromise[_0x8e12('0x33')](_0x136839);});})[_0x8e12('0x12')](function(_0x4e7928){logger['info'](_0x8e12('0x21'),_0x27a411);if(_0x4e7928[_0x8e12('0x2f')]>0x0){logger[_0x8e12('0x13')](_0x8e12('0x34'),_0x4e7928[0x0][_0x8e12('0x35')]['id'],_0x4e7928[0x0]['dataValues'][_0x8e12('0x36')],_0x4e7928[0x0]['dataValues']['active']);}logger[_0x8e12('0x14')](_0x8e12('0x21'),_0x27a411,JSON[_0x8e12('0x15')](_0x4e7928));_0x12e12f(_0x4e7928);})[_0x8e12('0x16')](function(_0xd18d7e){logger[_0x8e12('0x17')](_0x8e12('0x21'),_0xd18d7e['message'],_0x27a411);_0x2d4526(_0x7d2bb0[_0x8e12('0x17')](0x1f4,_0xd18d7e['message']));});});});};exports['MoveContactManagedDialer']=function(_0x38e874){var _0x5ed6b0=this;return new Promise(function(_0x4d5a3f,_0x471b9b){return db[_0x8e12('0x24')][_0x8e12('0x25')](function(_0x4b75a9){return db['CmHopperFinal']['create'](_0x38e874[_0x8e12('0x1c')],{'raw':_0x38e874[_0x8e12('0xa')]?_0x38e874['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x4b75a9})['then'](function(){logger[_0x8e12('0x13')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x38e874[_0x8e12('0xa')][_0x8e12('0xc')]),_0x38e874[_0x8e12('0xa')][_0x8e12('0xc')][_0x8e12('0x1f')]);return db['CmHopper'][_0x8e12('0x37')]({'where':_0x38e874[_0x8e12('0xa')]?_0x38e874[_0x8e12('0xa')][_0x8e12('0xc')]||null:null,'transaction':_0x4b75a9});});})[_0x8e12('0x12')](function(_0x111852){logger[_0x8e12('0x13')]('MoveContactManagedDialer',_0x38e874);logger[_0x8e12('0x14')]('MoveContactManagedDialer',_0x38e874,JSON['stringify'](_0x111852));_0x4d5a3f(_0x111852);})[_0x8e12('0x16')](function(_0x111dd2){logger[_0x8e12('0x17')](_0x8e12('0x38'),_0x111dd2[_0x8e12('0x18')],_0x38e874);_0x471b9b(_0x5ed6b0['error'](0x1f4,_0x111dd2[_0x8e12('0x18')]));});});};exports[_0x8e12('0x39')]=function(_0x16bf04){var _0x607c4f=this;return new Promise(function(_0x5800a1,_0x351fcf){return db[_0x8e12('0x8')][_0x8e12('0x9')]({'raw':_0x16bf04[_0x8e12('0xa')]?_0x16bf04[_0x8e12('0xa')][_0x8e12('0xb')]===undefined?!![]:![]:!![],'where':_0x16bf04[_0x8e12('0xa')]?_0x16bf04['options'][_0x8e12('0xc')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8e12('0x3a'),db[_0x8e12('0x24')]['fn']('IF',db[_0x8e12('0x24')][_0x8e12('0x3b')](_0x8e12('0x3c')+util['format'](_0x8e12('0x3d'),moment()[_0x8e12('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x8e12('0x3f')))),_0x8e12('0x40')]]})[_0x8e12('0x12')](function(_0x30833b){logger['info']('CountReScheduled',_0x16bf04);logger[_0x8e12('0x14')](_0x8e12('0x39'),_0x16bf04,JSON['stringify'](_0x30833b));_0x5800a1(_0x30833b);})[_0x8e12('0x16')](function(_0x11eb3a){logger[_0x8e12('0x17')](_0x8e12('0x39'),_0x11eb3a[_0x8e12('0x18')],_0x16bf04);_0x351fcf(_0x607c4f[_0x8e12('0x17')](0x1f4,_0x11eb3a[_0x8e12('0x18')]));});});};exports[_0x8e12('0x41')]=function(_0x259970){var _0x281558=this;return new Promise(function(_0x286bc7,_0x8c6d2){return db[_0x8e12('0x22')][_0x8e12('0x23')]()[_0x8e12('0x12')](function(){return db[_0x8e12('0x24')][_0x8e12('0x25')](function(_0xf33516){return db[_0x8e12('0x8')]['findAll']({'where':_0x259970['options']?_0x259970[_0x8e12('0xa')]['where']||null:null,'attributes':_0x259970['options']?_0x259970[_0x8e12('0xa')][_0x8e12('0xd')]||null:null,'limit':0x1,'order':_0x259970['options']?_0x259970[_0x8e12('0xa')][_0x8e12('0x26')]||null:null,'group':db[_0x8e12('0x8')][_0x8e12('0x30')],'transaction':_0xf33516,'lock':_0xf33516[_0x8e12('0x27')][_0x8e12('0x28')],'include':_0x259970[_0x8e12('0xa')]?_0x259970[_0x8e12('0xa')]['include']?_[_0x8e12('0x10')](_0x259970[_0x8e12('0xa')][_0x8e12('0xf')],function(_0x277fc5){return{'model':db[_0x277fc5[_0x8e12('0x11')]],'as':_0x277fc5['as'],'attributes':_0x277fc5[_0x8e12('0xd')],'include':_0x277fc5[_0x8e12('0xf')]?_[_0x8e12('0x10')](_0x277fc5[_0x8e12('0xf')],function(_0x4aeb30){return{'model':db[_0x4aeb30[_0x8e12('0x11')]],'as':_0x4aeb30['as'],'attributes':_0x4aeb30[_0x8e12('0xd')],'include':_0x4aeb30['include']?_[_0x8e12('0x10')](_0x4aeb30[_0x8e12('0xf')],function(_0x274b62){return{'model':db[_0x274b62[_0x8e12('0x11')]],'as':_0x274b62['as'],'attributes':_0x274b62[_0x8e12('0xd')]};}):[]};}):[]};}):[]:[]})[_0x8e12('0x12')](function(_0x5db402){var _0x4d1f28=[];for(var _0x36d894=0x0;_0x36d894<_0x5db402[_0x8e12('0x2f')];_0x36d894+=0x1){_0x4d1f28[_0x8e12('0x31')](_0x5db402[_0x36d894][_0x8e12('0x1e')](_0x259970[_0x8e12('0x1c')],{'transaction':_0xf33516}));}return BPromise[_0x8e12('0x33')](_0x4d1f28);});})['then'](function(_0x40773a){logger[_0x8e12('0x13')](_0x8e12('0x41'),_0x259970);logger['debug'](_0x8e12('0x41'),_0x259970,JSON[_0x8e12('0x15')](_0x40773a));_0x286bc7(_0x40773a);})['catch'](function(_0x10d12e){logger[_0x8e12('0x17')](_0x8e12('0x41'),_0x10d12e[_0x8e12('0x18')],_0x259970);_0x8c6d2(_0x281558[_0x8e12('0x17')](0x1f4,_0x10d12e[_0x8e12('0x18')]));});});});};exports[_0x8e12('0x42')]=function(_0x184d6d){var _0xbcff0a=this;return new Promise(function(_0x58ee6d,_0xc5d4a0){db['CmContact'][_0x8e12('0x23')]()['then'](function(_0x195145){return db[_0x8e12('0x8')][_0x8e12('0x9')]({'raw':_0x184d6d['options']?_0x184d6d[_0x8e12('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x184d6d[_0x8e12('0xa')]?_0x184d6d[_0x8e12('0xa')][_0x8e12('0xc')]||null:null,'attributes':_0x184d6d[_0x8e12('0xa')]?_0x184d6d['options'][_0x8e12('0xd')]||null:null,'limit':_0x184d6d['options']?_0x184d6d['options'][_0x8e12('0xe')]||null:null,'include':_0x184d6d[_0x8e12('0xa')]?_0x184d6d['options'][_0x8e12('0xf')]?_[_0x8e12('0x10')](_0x184d6d['options'][_0x8e12('0xf')],function(_0x3ea92b){return{'model':db[_0x3ea92b[_0x8e12('0x11')]],'as':_0x3ea92b['as'],'attributes':_0x3ea92b['as']===_0x8e12('0x29')?_[_0x8e12('0x2a')](_0x195145):_0x3ea92b[_0x8e12('0xd')],'include':_0x3ea92b['include']?_[_0x8e12('0x10')](_0x3ea92b[_0x8e12('0xf')],function(_0x2c1f7d){return{'model':db[_0x2c1f7d['model']],'as':_0x2c1f7d['as'],'attributes':_0x2c1f7d[_0x8e12('0xd')],'include':_0x2c1f7d[_0x8e12('0xf')]?_[_0x8e12('0x10')](_0x2c1f7d[_0x8e12('0xf')],function(_0x373df5){return{'model':db[_0x373df5['model']],'as':_0x373df5['as'],'attributes':_0x373df5[_0x8e12('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54907b){logger['info'](_0x8e12('0x7'),_0x184d6d);logger[_0x8e12('0x14')](_0x8e12('0x7'),_0x184d6d,JSON[_0x8e12('0x15')](_0x54907b));_0x58ee6d(_0x54907b);})[_0x8e12('0x16')](function(_0x1eedb){logger[_0x8e12('0x17')]('GetCmHopper',_0x1eedb['message'],_0x184d6d);_0xc5d4a0(_0xbcff0a[_0x8e12('0x17')](0x1f4,_0x1eedb[_0x8e12('0x18')]));});});});};exports['GetContactByPhone']=function(_0x570a62){var _0x3517b2=this;return new Promise(function(_0x4701c4,_0x4af814){return db[_0x8e12('0x22')][_0x8e12('0x43')]({'raw':!![],'where':{'phone':_0x570a62[_0x8e12('0xa')][_0x8e12('0xc')][_0x8e12('0x44')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x8e12('0x12')](function(_0x2b02f7){logger[_0x8e12('0x13')](_0x8e12('0x45'),_0x570a62);logger[_0x8e12('0x14')](_0x8e12('0x45'),_0x570a62,JSON[_0x8e12('0x15')](_0x2b02f7));_0x4701c4(_0x2b02f7);})[_0x8e12('0x16')](function(_0x26170a){logger[_0x8e12('0x17')](_0x8e12('0x45'),_0x26170a[_0x8e12('0x18')],_0x570a62);_0x4af814(_0x3517b2[_0x8e12('0x17')](0x1f4,_0x26170a[_0x8e12('0x18')]));});});};exports[_0x8e12('0x46')]=function(_0x4ec78c){var _0x339e7d=this;return new Promise(function(_0x444742,_0x13db88){return db[_0x8e12('0x24')][_0x8e12('0x25')](function(_0x20a4cf){var _0x277685=_0x4ec78c[_0x8e12('0xa')]&&_0x4ec78c[_0x8e12('0xa')][_0x8e12('0xc')]?_0x4ec78c[_0x8e12('0xa')][_0x8e12('0xc')]:{};return db['CmHopper'][_0x8e12('0x1e')](_0x4ec78c[_0x8e12('0x1c')],{'where':_0x277685,'transaction':_0x20a4cf})[_0x8e12('0x12')](function(_0x757f88){logger[_0x8e12('0x13')]('ResetActiveCalls',_0x4ec78c);logger[_0x8e12('0x14')](_0x8e12('0x46'),_0x4ec78c,JSON[_0x8e12('0x15')](_0x757f88));_0x444742(_0x757f88);})[_0x8e12('0x16')](function(_0x137ec4){logger[_0x8e12('0x17')](_0x8e12('0x46'),_0x137ec4[_0x8e12('0x18')],_0x4ec78c);_0x13db88(_0x339e7d['error'](0x1f4,_0x137ec4[_0x8e12('0x18')]));});});});};exports[_0x8e12('0x47')]=function(_0x44b43d){var _0x587c6a=this;var _0x1a8eb2=_0x44b43d['body'][_0x8e12('0xc')][_0x8e12('0x48')];var _0x3df43a=_0x44b43d[_0x8e12('0x1c')][_0x8e12('0xc')][_0x8e12('0x49')];var _0x1d0d62=_0x44b43d[_0x8e12('0x1c')][_0x8e12('0xc')][_0x8e12('0x4a')];return new Promise(function(_0x571183,_0x5e1428){return db['CmHopper'][_0x8e12('0x9')]({'where':{'voiceQueueId':{'$in':_0x1a8eb2},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x8e12('0x3b')]('NOW()\x20+\x20INTERVAL\x20'+_0x3df43a+_0x8e12('0x4b')),'$gt':db[_0x8e12('0x24')][_0x8e12('0x3b')](_0x8e12('0x4c'))}},'UserId':{'$in':_0x1d0d62}},'include':[{'model':db[_0x8e12('0x22')],'as':_0x8e12('0x29')},{'model':db[_0x8e12('0x2b')],'as':_0x8e12('0x2c'),'attributes':['id',_0x8e12('0x2d'),_0x8e12('0x2e')]},{'model':db['CmList'],'as':_0x8e12('0x4d')}]})[_0x8e12('0x12')](function(_0x2c6186){if(_0x2c6186[_0x8e12('0x2f')]>0x0){return db['sequelize']['transaction'](function(_0x17b81e){return db['CmHopper'][_0x8e12('0x1e')]({'recallmeNotifiedDate':db[_0x8e12('0x24')][_0x8e12('0x3b')](_0x8e12('0x4c'))},{'where':{'id':{'$in':_[_0x8e12('0x10')](_0x2c6186,'id')}},'transaction':_0x17b81e})['then'](function(){_0x571183(_0x2c6186);})[_0x8e12('0x16')](function(_0x1d2794){logger[_0x8e12('0x17')](_0x8e12('0x47'),_0x1d2794['message'],_0x44b43d);_0x5e1428(_0x587c6a['error'](0x1f4,_0x1d2794['message']));});})[_0x8e12('0x16')](function(_0x3db363){logger[_0x8e12('0x17')](_0x8e12('0x47'),_0x3db363[_0x8e12('0x18')],_0x44b43d);_0x5e1428(_0x587c6a[_0x8e12('0x17')](0x1f4,_0x3db363['message']));});}else{_0x571183(_0x2c6186);}});});}; \ No newline at end of file +var _0xa099=['CountReScheduled','COUNT','sequelize','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','describe','order','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','List','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','error','message','ShowCmHopper','find','catch','create','body','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','GetContactDialer','transaction','LOCK','UPDATE','CmContact','User','Agent','name','voicePause','length','UserId','push','includes','update','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer'];(function(_0x31c3c5,_0x25e2bf){var _0x228fc6=function(_0x21ae25){while(--_0x21ae25){_0x31c3c5['push'](_0x31c3c5['shift']());}};_0x228fc6(++_0x25e2bf);}(_0xa099,0x69));var _0x9a09=function(_0x599e0d,_0x17dfc5){_0x599e0d=_0x599e0d-0x0;var _0x23d4be=_0xa099[_0x599e0d];return _0x23d4be;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9a09('0x0'));var db=require(_0x9a09('0x1'))['db'];var logger=require(_0x9a09('0x2'))(_0x9a09('0x3'));exports[_0x9a09('0x4')]=function(_0x31f6e2){var _0x36aed9=this;return new Promise(function(_0x4796e6,_0x2c0181){return db[_0x9a09('0x5')][_0x9a09('0x6')]({'raw':_0x31f6e2[_0x9a09('0x7')]?_0x31f6e2[_0x9a09('0x7')][_0x9a09('0x8')]===undefined?!![]:![]:!![],'where':_0x31f6e2[_0x9a09('0x7')]?_0x31f6e2[_0x9a09('0x7')][_0x9a09('0x9')]||null:null,'attributes':_0x31f6e2[_0x9a09('0x7')]?_0x31f6e2['options'][_0x9a09('0xa')]||null:null,'limit':_0x31f6e2['options']?_0x31f6e2[_0x9a09('0x7')][_0x9a09('0xb')]||null:null,'include':_0x31f6e2[_0x9a09('0x7')]?_0x31f6e2[_0x9a09('0x7')][_0x9a09('0xc')]?_[_0x9a09('0xd')](_0x31f6e2['options'][_0x9a09('0xc')],function(_0x10ed69){return{'model':db[_0x10ed69[_0x9a09('0xe')]],'as':_0x10ed69['as'],'attributes':_0x10ed69[_0x9a09('0xa')],'include':_0x10ed69[_0x9a09('0xc')]?_[_0x9a09('0xd')](_0x10ed69[_0x9a09('0xc')],function(_0x3047c7){return{'model':db[_0x3047c7[_0x9a09('0xe')]],'as':_0x3047c7['as'],'attributes':_0x3047c7[_0x9a09('0xa')],'include':_0x3047c7[_0x9a09('0xc')]?_[_0x9a09('0xd')](_0x3047c7[_0x9a09('0xc')],function(_0x53fad2){return{'model':db[_0x53fad2[_0x9a09('0xe')]],'as':_0x53fad2['as'],'attributes':_0x53fad2['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a09('0xf')](function(_0x584e8a){logger[_0x9a09('0x10')]('GetCmHopper',_0x31f6e2);logger[_0x9a09('0x11')](_0x9a09('0x4'),_0x31f6e2,JSON[_0x9a09('0x12')](_0x584e8a));_0x4796e6(_0x584e8a);})['catch'](function(_0x4b2100){logger[_0x9a09('0x13')](_0x9a09('0x4'),_0x4b2100[_0x9a09('0x14')],_0x31f6e2);_0x2c0181(_0x36aed9[_0x9a09('0x13')](0x1f4,_0x4b2100[_0x9a09('0x14')]));});});};exports[_0x9a09('0x15')]=function(_0x322b76){var _0x302258=this;return new Promise(function(_0x1f63cd,_0x48d384){return db[_0x9a09('0x5')][_0x9a09('0x16')]({'raw':_0x322b76[_0x9a09('0x7')]?_0x322b76['options'][_0x9a09('0x8')]===undefined?!![]:![]:!![],'where':_0x322b76[_0x9a09('0x7')]?_0x322b76[_0x9a09('0x7')]['where']||null:null,'attributes':_0x322b76['options']?_0x322b76[_0x9a09('0x7')][_0x9a09('0xa')]||null:null,'include':_0x322b76['options']?_0x322b76[_0x9a09('0x7')]['include']?_[_0x9a09('0xd')](_0x322b76[_0x9a09('0x7')][_0x9a09('0xc')],function(_0x1083da){return{'model':db[_0x1083da['model']],'as':_0x1083da['as'],'attributes':_0x1083da['attributes'],'include':_0x1083da['include']?_[_0x9a09('0xd')](_0x1083da['include'],function(_0x10b939){return{'model':db[_0x10b939['model']],'as':_0x10b939['as'],'attributes':_0x10b939[_0x9a09('0xa')],'include':_0x10b939[_0x9a09('0xc')]?_['map'](_0x10b939[_0x9a09('0xc')],function(_0x13e4e5){return{'model':db[_0x13e4e5['model']],'as':_0x13e4e5['as'],'attributes':_0x13e4e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a09('0xf')](function(_0x1f9c49){logger[_0x9a09('0x10')](_0x9a09('0x15'),_0x322b76);logger[_0x9a09('0x11')](_0x9a09('0x15'),_0x322b76,JSON[_0x9a09('0x12')](_0x1f9c49));_0x1f63cd(_0x1f9c49);})[_0x9a09('0x17')](function(_0x2b1e50){logger['error'](_0x9a09('0x15'),_0x2b1e50['message'],_0x322b76);_0x48d384(_0x302258[_0x9a09('0x13')](0x1f4,_0x2b1e50[_0x9a09('0x14')]));});});};exports['CreateCmHopper']=function(_0x575818){var _0x318bd6=this;return new Promise(function(_0x149398,_0x405238){return db[_0x9a09('0x5')][_0x9a09('0x18')](_0x575818[_0x9a09('0x19')],{'raw':_0x575818[_0x9a09('0x7')]?_0x575818[_0x9a09('0x7')][_0x9a09('0x8')]===undefined?!![]:![]:!![]})[_0x9a09('0xf')](function(_0xce942c){logger['info'](_0x9a09('0x1a'),_0x575818);logger[_0x9a09('0x11')](_0x9a09('0x1a'),_0x575818,JSON[_0x9a09('0x12')](_0xce942c));_0x149398(_0xce942c);})[_0x9a09('0x17')](function(_0x59f198){logger[_0x9a09('0x13')]('CreateCmHopper',_0x59f198['message'],_0x575818);_0x405238(_0x318bd6[_0x9a09('0x13')](0x1f4,_0x59f198[_0x9a09('0x14')]));});});};exports[_0x9a09('0x1b')]=function(_0x2ef6c5){var _0x3c9259=this;return new Promise(function(_0x524612,_0x1da736){return db[_0x9a09('0x5')]['update'](_0x2ef6c5[_0x9a09('0x19')],{'raw':_0x2ef6c5[_0x9a09('0x7')]?_0x2ef6c5[_0x9a09('0x7')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef6c5[_0x9a09('0x7')]?_0x2ef6c5[_0x9a09('0x7')][_0x9a09('0x9')]||null:null,'attributes':_0x2ef6c5[_0x9a09('0x7')]?_0x2ef6c5[_0x9a09('0x7')][_0x9a09('0xa')]||null:null,'limit':_0x2ef6c5['options']?_0x2ef6c5['options'][_0x9a09('0xb')]||null:null})[_0x9a09('0xf')](function(_0x4f1d08){logger[_0x9a09('0x10')](_0x9a09('0x1b'),_0x2ef6c5);logger[_0x9a09('0x10')](_0x9a09('0x1c'),JSON[_0x9a09('0x12')](_0x2ef6c5[_0x9a09('0x7')][_0x9a09('0x9')]),_0x2ef6c5[_0x9a09('0x19')]['active']);logger[_0x9a09('0x11')]('UpdateCmHopper',_0x2ef6c5,JSON[_0x9a09('0x12')](_0x4f1d08));_0x524612(_0x4f1d08);})[_0x9a09('0x17')](function(_0x494988){logger[_0x9a09('0x13')](_0x9a09('0x1b'),_0x494988[_0x9a09('0x14')],_0x2ef6c5);_0x1da736(_0x3c9259['error'](0x1f4,_0x494988[_0x9a09('0x14')]));});});};exports['DestroyCmHopper']=function(_0x15ec6a){var _0x47c385=this;return new Promise(function(_0x5e364f,_0x5759d7){return db[_0x9a09('0x5')]['destroy']({'where':_0x15ec6a['options']?_0x15ec6a[_0x9a09('0x7')]['where']||null:null})[_0x9a09('0xf')](function(_0x436d55){logger[_0x9a09('0x10')]('DestroyCmHopper',_0x15ec6a);logger['debug'](_0x9a09('0x1d'),_0x15ec6a,JSON[_0x9a09('0x12')](_0x436d55));_0x5e364f(_0x436d55);})[_0x9a09('0x17')](function(_0x244cbe){logger[_0x9a09('0x13')](_0x9a09('0x1d'),_0x244cbe[_0x9a09('0x14')],_0x15ec6a);_0x5759d7(_0x47c385[_0x9a09('0x13')](0x1f4,_0x244cbe[_0x9a09('0x14')]));});});};exports[_0x9a09('0x1e')]=function(_0x3b51b7){var _0x88289a=this;return new Promise(function(_0x52b829,_0x1bdbc2){return db['CmContact']['describe']()[_0x9a09('0xf')](function(_0x253b25){return db['sequelize'][_0x9a09('0x1f')](function(_0x3469b7){return db['CmHopper'][_0x9a09('0x6')]({'where':_0x3b51b7['options']?_0x3b51b7['options'][_0x9a09('0x9')]||null:null,'attributes':_0x3b51b7[_0x9a09('0x7')]?_0x3b51b7[_0x9a09('0x7')][_0x9a09('0xa')]||null:null,'limit':_0x3b51b7['options']?_0x3b51b7[_0x9a09('0x7')][_0x9a09('0xb')]||null:null,'order':_0x3b51b7[_0x9a09('0x7')]?_0x3b51b7[_0x9a09('0x7')]['order']||null:null,'transaction':_0x3469b7,'lock':_0x3469b7[_0x9a09('0x20')][_0x9a09('0x21')],'include':[{'model':db[_0x9a09('0x22')],'as':'Contact','attributes':_['keys'](_0x253b25)},{'model':db[_0x9a09('0x23')],'as':_0x9a09('0x24'),'attributes':['id',_0x9a09('0x25'),_0x9a09('0x26')]}]})[_0x9a09('0xf')](function(_0x306ed1){var _0x1e40a6=[];var _0x509441=[];for(var _0x38c60a=0x0;_0x38c60a<_0x306ed1[_0x9a09('0x27')];_0x38c60a+=0x1){var _0x1a261b=_0x306ed1[_0x38c60a][_0x9a09('0x28')];if(_0x1a261b===null){_0x1e40a6[_0x9a09('0x29')](_0x306ed1[_0x38c60a]['update'](_0x3b51b7[_0x9a09('0x19')],{'transaction':_0x3469b7}));}else if(!_0x509441[_0x9a09('0x2a')](_0x1a261b)){_0x509441['push'](_0x1a261b);_0x1e40a6[_0x9a09('0x29')](_0x306ed1[_0x38c60a][_0x9a09('0x2b')](_0x3b51b7['body'],{'transaction':_0x3469b7}));}}return BPromise[_0x9a09('0x2c')](_0x1e40a6);});})[_0x9a09('0xf')](function(_0x51db2c){logger['info'](_0x9a09('0x1e'),_0x3b51b7);if(_0x51db2c['length']>0x0){logger[_0x9a09('0x10')](_0x9a09('0x2d'),_0x51db2c[0x0][_0x9a09('0x2e')]['id'],_0x51db2c[0x0][_0x9a09('0x2e')][_0x9a09('0x2f')],_0x51db2c[0x0][_0x9a09('0x2e')][_0x9a09('0x30')]);}logger['debug'](_0x9a09('0x1e'),_0x3b51b7,JSON[_0x9a09('0x12')](_0x51db2c));_0x52b829(_0x51db2c);})[_0x9a09('0x17')](function(_0x13cc2d){logger['error'](_0x9a09('0x1e'),_0x13cc2d[_0x9a09('0x14')],_0x3b51b7);_0x1bdbc2(_0x88289a[_0x9a09('0x13')](0x1f4,_0x13cc2d[_0x9a09('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x44c3ce){var _0x196b26=this;return new Promise(function(_0x19fd4d,_0x257717){return db['sequelize'][_0x9a09('0x1f')](function(_0x9fdb3f){return db[_0x9a09('0x31')]['create'](_0x44c3ce['body'],{'raw':_0x44c3ce[_0x9a09('0x7')]?_0x44c3ce[_0x9a09('0x7')][_0x9a09('0x8')]===undefined?!![]:![]:!![],'transaction':_0x9fdb3f})[_0x9a09('0xf')](function(){logger['info'](_0x9a09('0x32'),JSON[_0x9a09('0x12')](_0x44c3ce[_0x9a09('0x7')][_0x9a09('0x9')]),_0x44c3ce['options'][_0x9a09('0x9')][_0x9a09('0x30')]);return db[_0x9a09('0x5')][_0x9a09('0x33')]({'where':_0x44c3ce['options']?_0x44c3ce[_0x9a09('0x7')]['where']||null:null,'transaction':_0x9fdb3f});});})['then'](function(_0x2964fa){logger[_0x9a09('0x10')](_0x9a09('0x34'),_0x44c3ce);logger[_0x9a09('0x11')](_0x9a09('0x34'),_0x44c3ce,JSON[_0x9a09('0x12')](_0x2964fa));_0x19fd4d(_0x2964fa);})[_0x9a09('0x17')](function(_0x73a486){logger[_0x9a09('0x13')](_0x9a09('0x34'),_0x73a486[_0x9a09('0x14')],_0x44c3ce);_0x257717(_0x196b26['error'](0x1f4,_0x73a486[_0x9a09('0x14')]));});});};exports[_0x9a09('0x35')]=function(_0x5e41d1){var _0x456fd4=this;return new Promise(function(_0x104c17,_0x3e264b){return db[_0x9a09('0x5')][_0x9a09('0x6')]({'raw':_0x5e41d1[_0x9a09('0x7')]?_0x5e41d1[_0x9a09('0x7')][_0x9a09('0x8')]===undefined?!![]:![]:!![],'where':_0x5e41d1[_0x9a09('0x7')]?_0x5e41d1[_0x9a09('0x7')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x9a09('0x36'),db[_0x9a09('0x37')]['fn']('IF',db[_0x9a09('0x37')]['literal'](_0x9a09('0x38')+util[_0x9a09('0x39')](_0x9a09('0x3a'),moment()[_0x9a09('0x39')](_0x9a09('0x3b')))+'\x20,\x201,\x20null'))),_0x9a09('0x3c')]]})[_0x9a09('0xf')](function(_0x47770d){logger[_0x9a09('0x10')](_0x9a09('0x35'),_0x5e41d1);logger[_0x9a09('0x11')](_0x9a09('0x35'),_0x5e41d1,JSON[_0x9a09('0x12')](_0x47770d));_0x104c17(_0x47770d);})[_0x9a09('0x17')](function(_0x3d9c38){logger[_0x9a09('0x13')](_0x9a09('0x35'),_0x3d9c38['message'],_0x5e41d1);_0x3e264b(_0x456fd4[_0x9a09('0x13')](0x1f4,_0x3d9c38[_0x9a09('0x14')]));});});};exports['GetContactRecallMe']=function(_0x310829){var _0x7595f2=this;return new Promise(function(_0x2944b2,_0xf7835c){return db[_0x9a09('0x22')][_0x9a09('0x3d')]()[_0x9a09('0xf')](function(){return db['sequelize'][_0x9a09('0x1f')](function(_0x3e0d46){return db[_0x9a09('0x5')][_0x9a09('0x6')]({'where':_0x310829[_0x9a09('0x7')]?_0x310829[_0x9a09('0x7')][_0x9a09('0x9')]||null:null,'attributes':_0x310829[_0x9a09('0x7')]?_0x310829['options'][_0x9a09('0xa')]||null:null,'limit':0x1,'order':_0x310829[_0x9a09('0x7')]?_0x310829['options'][_0x9a09('0x3e')]||null:null,'group':db[_0x9a09('0x5')][_0x9a09('0x28')],'transaction':_0x3e0d46,'lock':_0x3e0d46[_0x9a09('0x20')][_0x9a09('0x21')],'include':_0x310829[_0x9a09('0x7')]?_0x310829[_0x9a09('0x7')]['include']?_[_0x9a09('0xd')](_0x310829[_0x9a09('0x7')][_0x9a09('0xc')],function(_0x1312be){return{'model':db[_0x1312be['model']],'as':_0x1312be['as'],'attributes':_0x1312be['attributes'],'include':_0x1312be[_0x9a09('0xc')]?_['map'](_0x1312be[_0x9a09('0xc')],function(_0x241a4b){return{'model':db[_0x241a4b[_0x9a09('0xe')]],'as':_0x241a4b['as'],'attributes':_0x241a4b['attributes'],'include':_0x241a4b[_0x9a09('0xc')]?_[_0x9a09('0xd')](_0x241a4b[_0x9a09('0xc')],function(_0x3a1e93){return{'model':db[_0x3a1e93[_0x9a09('0xe')]],'as':_0x3a1e93['as'],'attributes':_0x3a1e93[_0x9a09('0xa')]};}):[]};}):[]};}):[]:[]})[_0x9a09('0xf')](function(_0x4f7cec){var _0x2e1d9e=[];for(var _0x15184e=0x0;_0x15184e<_0x4f7cec[_0x9a09('0x27')];_0x15184e+=0x1){_0x2e1d9e[_0x9a09('0x29')](_0x4f7cec[_0x15184e][_0x9a09('0x2b')](_0x310829[_0x9a09('0x19')],{'transaction':_0x3e0d46}));}return BPromise['all'](_0x2e1d9e);});})[_0x9a09('0xf')](function(_0x1232e3){logger[_0x9a09('0x10')](_0x9a09('0x3f'),_0x310829);logger[_0x9a09('0x11')](_0x9a09('0x3f'),_0x310829,JSON[_0x9a09('0x12')](_0x1232e3));_0x2944b2(_0x1232e3);})[_0x9a09('0x17')](function(_0x23ce8c){logger[_0x9a09('0x13')]('GetContactRecallMe',_0x23ce8c[_0x9a09('0x14')],_0x310829);_0xf7835c(_0x7595f2[_0x9a09('0x13')](0x1f4,_0x23ce8c[_0x9a09('0x14')]));});});});};exports[_0x9a09('0x40')]=function(_0x44f45f){var _0x44949a=this;return new Promise(function(_0x3b22d6,_0x486f1d){db[_0x9a09('0x22')][_0x9a09('0x3d')]()[_0x9a09('0xf')](function(_0x7331e1){return db['CmHopper']['findAll']({'raw':_0x44f45f[_0x9a09('0x7')]?_0x44f45f[_0x9a09('0x7')][_0x9a09('0x8')]===undefined?!![]:![]:!![],'where':_0x44f45f[_0x9a09('0x7')]?_0x44f45f[_0x9a09('0x7')][_0x9a09('0x9')]||null:null,'attributes':_0x44f45f[_0x9a09('0x7')]?_0x44f45f[_0x9a09('0x7')][_0x9a09('0xa')]||null:null,'limit':_0x44f45f[_0x9a09('0x7')]?_0x44f45f[_0x9a09('0x7')]['limit']||null:null,'include':_0x44f45f[_0x9a09('0x7')]?_0x44f45f['options'][_0x9a09('0xc')]?_['map'](_0x44f45f[_0x9a09('0x7')][_0x9a09('0xc')],function(_0x49d3f1){return{'model':db[_0x49d3f1[_0x9a09('0xe')]],'as':_0x49d3f1['as'],'attributes':_0x49d3f1['as']===_0x9a09('0x41')?_[_0x9a09('0x42')](_0x7331e1):_0x49d3f1[_0x9a09('0xa')],'include':_0x49d3f1['include']?_[_0x9a09('0xd')](_0x49d3f1[_0x9a09('0xc')],function(_0x4fbfae){return{'model':db[_0x4fbfae['model']],'as':_0x4fbfae['as'],'attributes':_0x4fbfae[_0x9a09('0xa')],'include':_0x4fbfae[_0x9a09('0xc')]?_[_0x9a09('0xd')](_0x4fbfae['include'],function(_0x2558fc){return{'model':db[_0x2558fc[_0x9a09('0xe')]],'as':_0x2558fc['as'],'attributes':_0x2558fc[_0x9a09('0xa')]};}):[]};}):[]};}):[]:[]})[_0x9a09('0xf')](function(_0x85335c){logger[_0x9a09('0x10')](_0x9a09('0x4'),_0x44f45f);logger[_0x9a09('0x11')](_0x9a09('0x4'),_0x44f45f,JSON[_0x9a09('0x12')](_0x85335c));_0x3b22d6(_0x85335c);})['catch'](function(_0x2f01cd){logger['error'](_0x9a09('0x4'),_0x2f01cd['message'],_0x44f45f);_0x486f1d(_0x44949a[_0x9a09('0x13')](0x1f4,_0x2f01cd[_0x9a09('0x14')]));});});});};exports[_0x9a09('0x43')]=function(_0xbb8721){var _0xa2136b=this;return new Promise(function(_0x5da6c9,_0x2dd52b){return db[_0x9a09('0x22')]['findOne']({'raw':!![],'where':{'phone':_0xbb8721[_0x9a09('0x7')][_0x9a09('0x9')][_0x9a09('0x44')]},'attributes':['id',_0x9a09('0x45')],'order':[['id','DESC']]})[_0x9a09('0xf')](function(_0x1a2665){logger['info'](_0x9a09('0x46'),_0xbb8721);logger[_0x9a09('0x11')]('getContactByPhone',_0xbb8721,JSON[_0x9a09('0x12')](_0x1a2665));_0x5da6c9(_0x1a2665);})['catch'](function(_0x5ae361){logger['error'](_0x9a09('0x46'),_0x5ae361[_0x9a09('0x14')],_0xbb8721);_0x2dd52b(_0xa2136b[_0x9a09('0x13')](0x1f4,_0x5ae361[_0x9a09('0x14')]));});});};exports[_0x9a09('0x47')]=function(_0x4b8199){var _0x3217b9=this;return new Promise(function(_0x342373,_0x22bbd3){return db[_0x9a09('0x37')][_0x9a09('0x1f')](function(_0x2b4030){var _0x961d3d=_0x4b8199[_0x9a09('0x7')]&&_0x4b8199['options'][_0x9a09('0x9')]?_0x4b8199['options'][_0x9a09('0x9')]:{};return db['CmHopper'][_0x9a09('0x2b')](_0x4b8199[_0x9a09('0x19')],{'where':_0x961d3d,'transaction':_0x2b4030})[_0x9a09('0xf')](function(_0x382d4d){logger['info'](_0x9a09('0x47'),_0x4b8199);logger['debug']('ResetActiveCalls',_0x4b8199,JSON[_0x9a09('0x12')](_0x382d4d));_0x342373(_0x382d4d);})['catch'](function(_0x5b5481){logger[_0x9a09('0x13')]('ResetActiveCalls',_0x5b5481[_0x9a09('0x14')],_0x4b8199);_0x22bbd3(_0x3217b9[_0x9a09('0x13')](0x1f4,_0x5b5481[_0x9a09('0x14')]));});});});};exports[_0x9a09('0x48')]=function(_0x41bb9a){var _0x169f47=this;var _0x27e05c=_0x41bb9a[_0x9a09('0x19')][_0x9a09('0x9')][_0x9a09('0x49')];var _0x394962=_0x41bb9a[_0x9a09('0x19')]['where'][_0x9a09('0x4a')];var _0x4e3030=_0x41bb9a[_0x9a09('0x19')]['where']['availableAgentsIds'];return new Promise(function(_0x557780,_0x57702d){return db[_0x9a09('0x5')][_0x9a09('0x6')]({'where':{'voiceQueueId':{'$in':_0x27e05c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x9a09('0x37')][_0x9a09('0x4b')](_0x9a09('0x4c')+_0x394962+'\x20MINUTE'),'$gt':db[_0x9a09('0x37')][_0x9a09('0x4b')](_0x9a09('0x4d'))}},'UserId':{'$in':_0x4e3030}},'include':[{'model':db[_0x9a09('0x22')],'as':'Contact'},{'model':db[_0x9a09('0x23')],'as':'Agent','attributes':['id',_0x9a09('0x25'),_0x9a09('0x26')]},{'model':db['CmList'],'as':_0x9a09('0x4e')}]})['then'](function(_0x248a29){if(_0x248a29[_0x9a09('0x27')]>0x0){return db['sequelize'][_0x9a09('0x1f')](function(_0x49a882){return db[_0x9a09('0x5')][_0x9a09('0x2b')]({'recallmeNotifiedDate':db[_0x9a09('0x37')][_0x9a09('0x4b')]('NOW()')},{'where':{'id':{'$in':_[_0x9a09('0xd')](_0x248a29,'id')}},'transaction':_0x49a882})[_0x9a09('0xf')](function(){_0x557780(_0x248a29);})[_0x9a09('0x17')](function(_0x4edd8e){logger[_0x9a09('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x4edd8e[_0x9a09('0x14')],_0x41bb9a);_0x57702d(_0x169f47[_0x9a09('0x13')](0x1f4,_0x4edd8e[_0x9a09('0x14')]));});})[_0x9a09('0x17')](function(_0x325084){logger[_0x9a09('0x13')](_0x9a09('0x48'),_0x325084[_0x9a09('0x14')],_0x41bb9a);_0x57702d(_0x169f47['error'](0x1f4,_0x325084[_0x9a09('0x14')]));});}else{_0x557780(_0x248a29);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 4379423..bc38304 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 _0x4bc5=['/timezone','getTimezone','put','update','delete','destroy','express','../../components/auth/service','./cmHopper.controller','get','index','isAuthenticated','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','post','/preview','getPreview'];(function(_0x549c29,_0x180f6d){var _0xc297c6=function(_0x54cffb){while(--_0x54cffb){_0x549c29['push'](_0x549c29['shift']());}};_0xc297c6(++_0x180f6d);}(_0x4bc5,0xc3));var _0x54bc=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4bc5[_0x40a045];return _0x1a687c;};'use strict';var express=require(_0x54bc('0x0'));var router=express['Router']();var auth=require(_0x54bc('0x1'));var controller=require(_0x54bc('0x2'));router[_0x54bc('0x3')]('/',auth['isAuthenticated'](),controller[_0x54bc('0x4')]);router[_0x54bc('0x3')]('/describe',auth[_0x54bc('0x5')](),controller['describe']);router['get'](_0x54bc('0x6'),auth['isAuthenticated'](),controller[_0x54bc('0x7')]);router[_0x54bc('0x3')](_0x54bc('0x8'),auth[_0x54bc('0x5')](),controller[_0x54bc('0x9')]);router['get'](_0x54bc('0xa'),auth[_0x54bc('0x5')](),controller['show']);router[_0x54bc('0x3')](_0x54bc('0xb'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0x54bc('0xc')]('/',auth[_0x54bc('0x5')](),controller['create']);router[_0x54bc('0xc')](_0x54bc('0xd'),auth[_0x54bc('0x5')](),controller[_0x54bc('0xe')]);router[_0x54bc('0xc')](_0x54bc('0xf'),auth['isAuthenticated'](),controller[_0x54bc('0x10')]);router[_0x54bc('0x11')](_0x54bc('0xa'),auth[_0x54bc('0x5')](),controller[_0x54bc('0x12')]);router[_0x54bc('0x13')](_0x54bc('0xa'),auth[_0x54bc('0x5')](),controller[_0x54bc('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe008=['destroy','exports','express','Router','../../components/auth/service','index','get','/describe','isAuthenticated','/opencontacts','getOpenContacts','/timezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','getPreview','update','delete'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xe008,0x156));var _0x8e00=function(_0x1638a8,_0x523afa){_0x1638a8=_0x1638a8-0x0;var _0x29c4a9=_0xe008[_0x1638a8];return _0x29c4a9;};'use strict';var express=require(_0x8e00('0x0'));var router=express[_0x8e00('0x1')]();var auth=require(_0x8e00('0x2'));var controller=require('./cmHopper.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8e00('0x3')]);router[_0x8e00('0x4')](_0x8e00('0x5'),auth[_0x8e00('0x6')](),controller['describe']);router['get'](_0x8e00('0x7'),auth[_0x8e00('0x6')](),controller[_0x8e00('0x8')]);router[_0x8e00('0x4')](_0x8e00('0x9'),auth[_0x8e00('0x6')](),controller['getTimezones']);router[_0x8e00('0x4')](_0x8e00('0xa'),auth[_0x8e00('0x6')](),controller['show']);router[_0x8e00('0x4')](_0x8e00('0xb'),auth[_0x8e00('0x6')](),controller[_0x8e00('0xc')]);router[_0x8e00('0xd')]('/',auth[_0x8e00('0x6')](),controller[_0x8e00('0xe')]);router[_0x8e00('0xd')]('/preview',auth[_0x8e00('0x6')](),controller[_0x8e00('0xf')]);router[_0x8e00('0xd')]('/timezone',auth[_0x8e00('0x6')](),controller['getTimezone']);router['put'](_0x8e00('0xa'),auth[_0x8e00('0x6')](),controller[_0x8e00('0x10')]);router[_0x8e00('0x11')](_0x8e00('0xa'),auth[_0x8e00('0x6')](),controller[_0x8e00('0x12')]);module[_0x8e00('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 4bba80c..5c2e757 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 _0xa020=['sequelize','exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa020,0x1b1));var _0x0a02=function(_0x417dd8,_0x127ca3){_0x417dd8=_0x417dd8-0x0;var _0x4bd271=_0xa020[_0x417dd8];return _0x4bd271;};'use strict';var moment=require(_0x0a02('0x0'));var Sequelize=require(_0x0a02('0x1'));module[_0x0a02('0x2')]={'CmHopperId':{'type':Sequelize[_0x0a02('0x3')]},'phone':{'type':Sequelize[_0x0a02('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0a02('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x0a02('0x5')](_0x0a02('0x6'))},'countbusyretry':{'type':Sequelize[_0x0a02('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0a02('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0a02('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0a02('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0a02('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0a02('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0a02('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9f78=['moment','sequelize','exports','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x54ac28,_0x4c6b15){var _0x16818a=function(_0x534a06){while(--_0x534a06){_0x54ac28['push'](_0x54ac28['shift']());}};_0x16818a(++_0x4c6b15);}(_0x9f78,0x1c0));var _0x89f7=function(_0x40b981,_0x48b308){_0x40b981=_0x40b981-0x0;var _0x58696b=_0x9f78[_0x40b981];return _0x58696b;};'use strict';var moment=require(_0x89f7('0x0'));var Sequelize=require(_0x89f7('0x1'));module[_0x89f7('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x89f7('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x89f7('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x89f7('0x5')],'defaultValue':moment()[_0x89f7('0x6')](_0x89f7('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x89f7('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x89f7('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x89f7('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 8736565..685eba3 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 _0x8a62=['squel','crypto','jsforce','desk.js','papaparse','../../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','count','limit','Content-Range','apply','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x2ac5bd,_0x3e6c39){var _0x4bfd91=function(_0x21053d){while(--_0x21053d){_0x2ac5bd['push'](_0x2ac5bd['shift']());}};_0x4bfd91(++_0x3e6c39);}(_0x8a62,0xfd));var _0x28a6=function(_0x4f1181,_0x44eb61){_0x4f1181=_0x4f1181-0x0;var _0x3747da=_0x8a62[_0x4f1181];return _0x3747da;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x28a6('0x0'));var jsonpatch=require(_0x28a6('0x1'));var rp=require(_0x28a6('0x2'));var moment=require('moment');var BPromise=require(_0x28a6('0x3'));var Mustache=require(_0x28a6('0x4'));var util=require(_0x28a6('0x5'));var path=require(_0x28a6('0x6'));var sox=require(_0x28a6('0x7'));var csv=require(_0x28a6('0x8'));var ejs=require(_0x28a6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28a6('0xa'));var squel=require(_0x28a6('0xb'));var crypto=require(_0x28a6('0xc'));var jsforce=require(_0x28a6('0xd'));var deskjs=require(_0x28a6('0xe'));var toCsv=require(_0x28a6('0x8'));var querystring=require('querystring');var Papa=require(_0x28a6('0xf'));var Redis=require('ioredis');var authService=require(_0x28a6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x28a6('0x11'));var hardwareService=require(_0x28a6('0x12'));var logger=require(_0x28a6('0x13'))(_0x28a6('0x14'));var utils=require(_0x28a6('0x15'));var config=require(_0x28a6('0x16'));var licenseUtil=require(_0x28a6('0x17'));var db=require(_0x28a6('0x18'))['db'];function respondWithStatusCode(_0x345b54,_0x5e8dbe){_0x5e8dbe=_0x5e8dbe||0xcc;return function(_0x4a1b39){if(_0x4a1b39){return _0x345b54[_0x28a6('0x19')](_0x5e8dbe);}return _0x345b54[_0x28a6('0x1a')](_0x5e8dbe)['end']();};}function respondWithResult(_0x52ee22,_0x1f9074){_0x1f9074=_0x1f9074||0xc8;return function(_0x12cc4f){if(_0x12cc4f){return _0x52ee22['status'](_0x1f9074)[_0x28a6('0x1b')](_0x12cc4f);}};}function respondWithFilteredResult(_0x857871,_0x407435){return function(_0x552915){if(_0x552915){var _0x3f9908=typeof _0x407435[_0x28a6('0x1c')]===_0x28a6('0x1d')&&typeof _0x407435['limit']===_0x28a6('0x1d');var _0x2e31df=_0x552915['count'];var _0x27b5b7=_0x3f9908?0x0:_0x407435[_0x28a6('0x1c')];var _0x3db793=_0x3f9908?_0x552915[_0x28a6('0x1e')]:_0x407435[_0x28a6('0x1c')]+_0x407435[_0x28a6('0x1f')];var _0x40eda6;if(_0x3db793>=_0x2e31df){_0x3db793=_0x2e31df;_0x40eda6=0xc8;}else{_0x40eda6=0xce;}_0x857871['status'](_0x40eda6);return _0x857871['set'](_0x28a6('0x20'),_0x27b5b7+'-'+_0x3db793+'/'+_0x2e31df)[_0x28a6('0x1b')](_0x552915);}return null;};}function patchUpdates(_0x530db1){return function(_0x3c0442){try{jsonpatch[_0x28a6('0x21')](_0x3c0442,_0x530db1,!![]);}catch(_0x3f8829){return BPromise[_0x28a6('0x22')](_0x3f8829);}return _0x3c0442[_0x28a6('0x23')]();};}function saveUpdates(_0x18179b,_0x3e67e2){return function(_0x520936){if(_0x520936){return _0x520936[_0x28a6('0x24')](_0x18179b)[_0x28a6('0x25')](function(_0x40e767){return _0x40e767;});}return null;};}function removeEntity(_0x204480,_0x23a49d){return function(_0x4b1e0c){if(_0x4b1e0c){return _0x4b1e0c['destroy']()[_0x28a6('0x25')](function(){var _0x37e601=_0x4b1e0c[_0x28a6('0x26')]({'plain':!![]});var _0x4b9ee1=_0x28a6('0x27');return db[_0x28a6('0x28')][_0x28a6('0x29')]({'where':{'type':_0x4b9ee1,'resourceId':_0x37e601['id']}})['then'](function(){return _0x4b1e0c;});})[_0x28a6('0x25')](function(){_0x204480['status'](0xcc)[_0x28a6('0x2a')]();});}};}function handleEntityNotFound(_0xaa9c87,_0x51dd10){return function(_0xf98208){if(!_0xf98208){_0xaa9c87[_0x28a6('0x19')](0x194);}return _0xf98208;};}function handleError(_0xe88312,_0x59505c){_0x59505c=_0x59505c||0x1f4;return function(_0x31c2e0){logger[_0x28a6('0x2b')](_0x31c2e0[_0x28a6('0x2c')]);if(_0x31c2e0[_0x28a6('0x2d')]){delete _0x31c2e0[_0x28a6('0x2d')];}_0xe88312[_0x28a6('0x1a')](_0x59505c)[_0x28a6('0x2e')](_0x31c2e0);};}exports[_0x28a6('0x2f')]=function(_0xbf62cc,_0x18a868){var _0x3b14d2={},_0x208b01={},_0xa8e821={'count':0x0,'rows':[]};var _0x2d9e04=_[_0x28a6('0x30')](db[_0x28a6('0x31')][_0x28a6('0x32')],function(_0xc873f1){return{'name':_0xc873f1[_0x28a6('0x33')],'type':_0xc873f1[_0x28a6('0x34')][_0x28a6('0x35')]};});_0x208b01[_0x28a6('0x36')]=_['map'](_0x2d9e04,_0x28a6('0x2d'));_0x208b01['query']=_['keys'](_0xbf62cc['query']);_0x208b01[_0x28a6('0x37')]=_['intersection'](_0x208b01['model'],_0x208b01['query']);_0x3b14d2[_0x28a6('0x38')]=_[_0x28a6('0x39')](_0x208b01[_0x28a6('0x36')],qs[_0x28a6('0x3a')](_0xbf62cc[_0x28a6('0x3b')][_0x28a6('0x3a')]));_0x3b14d2[_0x28a6('0x38')]=_0x3b14d2[_0x28a6('0x38')][_0x28a6('0x3c')]?_0x3b14d2[_0x28a6('0x38')]:_0x208b01[_0x28a6('0x36')];if(!_0xbf62cc[_0x28a6('0x3b')][_0x28a6('0x3d')](_0x28a6('0x3e'))){_0x3b14d2[_0x28a6('0x1f')]=qs[_0x28a6('0x1f')](_0xbf62cc[_0x28a6('0x3b')]['limit']);_0x3b14d2[_0x28a6('0x1c')]=qs['offset'](_0xbf62cc[_0x28a6('0x3b')][_0x28a6('0x1c')]);}_0x3b14d2['order']=qs[_0x28a6('0x3f')](_0xbf62cc['query'][_0x28a6('0x3f')]);_0x3b14d2[_0x28a6('0x40')]=qs['filters'](_[_0x28a6('0x41')](_0xbf62cc[_0x28a6('0x3b')],_0x208b01[_0x28a6('0x37')]),_0x2d9e04);if(_0xbf62cc['query'][_0x28a6('0x42')]){_0x3b14d2[_0x28a6('0x40')]=_[_0x28a6('0x43')](_0x3b14d2[_0x28a6('0x40')],{'$or':_[_0x28a6('0x30')](_0x2d9e04,function(_0x13584a){if(_0x13584a['type']!==_0x28a6('0x44')){var _0x3abe01={};_0x3abe01[_0x13584a[_0x28a6('0x2d')]]={'$like':'%'+_0xbf62cc['query'][_0x28a6('0x42')]+'%'};return _0x3abe01;}})});}_0x3b14d2=_['merge']({},_0x3b14d2,_0xbf62cc[_0x28a6('0x45')]);var _0x56510f={'where':_0x3b14d2[_0x28a6('0x40')]};return db[_0x28a6('0x31')]['count'](_0x56510f)[_0x28a6('0x25')](function(_0x5901d6){_0xa8e821[_0x28a6('0x1e')]=_0x5901d6;if(_0xbf62cc[_0x28a6('0x3b')][_0x28a6('0x46')]){_0x3b14d2[_0x28a6('0x47')]=[{'all':!![]}];}return db[_0x28a6('0x31')][_0x28a6('0x48')](_0x3b14d2);})[_0x28a6('0x25')](function(_0x1a3217){_0xa8e821[_0x28a6('0x49')]=_0x1a3217;return _0xa8e821;})['then'](respondWithFilteredResult(_0x18a868,_0x3b14d2))[_0x28a6('0x4a')](handleError(_0x18a868,null));};exports[_0x28a6('0x4b')]=function(_0x4db53b,_0x237aff){var _0x269ea3={'raw':!![],'where':{'id':_0x4db53b[_0x28a6('0x4c')]['id']}},_0x453b1f={};_0x453b1f['model']=_[_0x28a6('0x4d')](db['CmHopperAdditionalPhone'][_0x28a6('0x32')]);_0x453b1f['query']=_[_0x28a6('0x4d')](_0x4db53b[_0x28a6('0x3b')]);_0x453b1f[_0x28a6('0x37')]=_[_0x28a6('0x39')](_0x453b1f['model'],_0x453b1f[_0x28a6('0x3b')]);_0x269ea3['attributes']=_[_0x28a6('0x39')](_0x453b1f[_0x28a6('0x36')],qs[_0x28a6('0x3a')](_0x4db53b[_0x28a6('0x3b')][_0x28a6('0x3a')]));_0x269ea3[_0x28a6('0x38')]=_0x269ea3['attributes'][_0x28a6('0x3c')]?_0x269ea3[_0x28a6('0x38')]:_0x453b1f[_0x28a6('0x36')];if(_0x4db53b[_0x28a6('0x3b')]['includeAll']){_0x269ea3[_0x28a6('0x47')]=[{'all':!![]}];}_0x269ea3=_[_0x28a6('0x43')]({},_0x269ea3,_0x4db53b['options']);return db['CmHopperAdditionalPhone'][_0x28a6('0x4e')](_0x269ea3)[_0x28a6('0x25')](handleEntityNotFound(_0x237aff,null))[_0x28a6('0x25')](respondWithResult(_0x237aff,null))[_0x28a6('0x4a')](handleError(_0x237aff,null));};exports[_0x28a6('0x4f')]=function(_0x3e90d2,_0x2b19a9){return db[_0x28a6('0x31')][_0x28a6('0x4f')](_0x3e90d2[_0x28a6('0x50')],{})['then'](function(_0x4bb571){var _0x21eae4=_0x3e90d2[_0x28a6('0x51')][_0x28a6('0x26')]({'plain':!![]});if(!_0x21eae4)throw new Error(_0x28a6('0x52'));if(_0x21eae4[_0x28a6('0x53')]===_0x28a6('0x51')){var _0x3cf41a=_0x4bb571[_0x28a6('0x26')]({'plain':!![]});var _0x19dc96=_0x28a6('0x27');return db[_0x28a6('0x54')]['find']({'where':{'name':_0x19dc96,'userProfileId':_0x21eae4[_0x28a6('0x55')]},'raw':!![]})[_0x28a6('0x25')](function(_0x632cff){if(_0x632cff&&_0x632cff[_0x28a6('0x56')]===0x0){return db[_0x28a6('0x28')][_0x28a6('0x4f')]({'name':_0x3cf41a[_0x28a6('0x2d')],'resourceId':_0x3cf41a['id'],'type':_0x632cff[_0x28a6('0x2d')],'sectionId':_0x632cff['id']},{})[_0x28a6('0x25')](function(){return _0x4bb571;});}else{return _0x4bb571;}})['catch'](function(_0x448330){logger[_0x28a6('0x2b')](_0x28a6('0x57'),_0x448330);throw _0x448330;});}return _0x4bb571;})[_0x28a6('0x25')](respondWithResult(_0x2b19a9,0xc9))[_0x28a6('0x4a')](handleError(_0x2b19a9,null));};exports['update']=function(_0xd58f01,_0x5130e3){if(_0xd58f01[_0x28a6('0x50')]['id']){delete _0xd58f01[_0x28a6('0x50')]['id'];}return db[_0x28a6('0x31')][_0x28a6('0x4e')]({'where':{'id':_0xd58f01[_0x28a6('0x4c')]['id']}})[_0x28a6('0x25')](handleEntityNotFound(_0x5130e3,null))[_0x28a6('0x25')](saveUpdates(_0xd58f01[_0x28a6('0x50')],null))[_0x28a6('0x25')](respondWithResult(_0x5130e3,null))[_0x28a6('0x4a')](handleError(_0x5130e3,null));};exports[_0x28a6('0x29')]=function(_0x29dcc8,_0xfcf111){return db[_0x28a6('0x31')]['find']({'where':{'id':_0x29dcc8[_0x28a6('0x4c')]['id']}})['then'](handleEntityNotFound(_0xfcf111,null))[_0x28a6('0x25')](removeEntity(_0xfcf111,null))[_0x28a6('0x4a')](handleError(_0xfcf111,null));}; \ No newline at end of file +var _0x3fa9=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','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','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','rows','show','params','length','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x2f6e15,_0x4baa1a){var _0x3281bf=function(_0x335e35){while(--_0x335e35){_0x2f6e15['push'](_0x2f6e15['shift']());}};_0x3281bf(++_0x4baa1a);}(_0x3fa9,0x194));var _0x93fa=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x3fa9[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93fa('0x0'));var zipdir=require(_0x93fa('0x1'));var jsonpatch=require(_0x93fa('0x2'));var rp=require(_0x93fa('0x3'));var moment=require('moment');var BPromise=require(_0x93fa('0x4'));var Mustache=require(_0x93fa('0x5'));var util=require(_0x93fa('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x93fa('0x7'));var fs=require('fs');var fs_extra=require(_0x93fa('0x8'));var _=require('lodash');var squel=require(_0x93fa('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x93fa('0xa'));var toCsv=require(_0x93fa('0xb'));var querystring=require(_0x93fa('0xc'));var Papa=require(_0x93fa('0xd'));var Redis=require(_0x93fa('0xe'));var authService=require(_0x93fa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x93fa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93fa('0x11'))(_0x93fa('0x12'));var utils=require(_0x93fa('0x13'));var config=require(_0x93fa('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x93fa('0x15'))['db'];function respondWithStatusCode(_0xca87db,_0x21e684){_0x21e684=_0x21e684||0xcc;return function(_0x4a463e){if(_0x4a463e){return _0xca87db[_0x93fa('0x16')](_0x21e684);}return _0xca87db[_0x93fa('0x17')](_0x21e684)[_0x93fa('0x18')]();};}function respondWithResult(_0x2bb280,_0x320fa2){_0x320fa2=_0x320fa2||0xc8;return function(_0x10675f){if(_0x10675f){return _0x2bb280[_0x93fa('0x17')](_0x320fa2)[_0x93fa('0x19')](_0x10675f);}};}function respondWithFilteredResult(_0xa2fd74,_0x2a0c25){return function(_0x9e60f5){if(_0x9e60f5){var _0x1ab85b=typeof _0x2a0c25[_0x93fa('0x1a')]===_0x93fa('0x1b')&&typeof _0x2a0c25[_0x93fa('0x1c')]===_0x93fa('0x1b');var _0x5f38c2=_0x9e60f5[_0x93fa('0x1d')];var _0xddd50e=_0x1ab85b?0x0:_0x2a0c25[_0x93fa('0x1a')];var _0x5736fb=_0x1ab85b?_0x9e60f5[_0x93fa('0x1d')]:_0x2a0c25['offset']+_0x2a0c25[_0x93fa('0x1c')];var _0x30d2a2;if(_0x5736fb>=_0x5f38c2){_0x5736fb=_0x5f38c2;_0x30d2a2=0xc8;}else{_0x30d2a2=0xce;}_0xa2fd74[_0x93fa('0x17')](_0x30d2a2);return _0xa2fd74[_0x93fa('0x1e')](_0x93fa('0x1f'),_0xddd50e+'-'+_0x5736fb+'/'+_0x5f38c2)[_0x93fa('0x19')](_0x9e60f5);}return null;};}function patchUpdates(_0x56aaab){return function(_0x21255b){try{jsonpatch[_0x93fa('0x20')](_0x21255b,_0x56aaab,!![]);}catch(_0x55357f){return BPromise[_0x93fa('0x21')](_0x55357f);}return _0x21255b[_0x93fa('0x22')]();};}function saveUpdates(_0x22a26e,_0x36210f){return function(_0xf40700){if(_0xf40700){return _0xf40700[_0x93fa('0x23')](_0x22a26e)[_0x93fa('0x24')](function(_0x14ed8a){return _0x14ed8a;});}return null;};}function removeEntity(_0x3a196f,_0x5bdb11){return function(_0x1dd859){if(_0x1dd859){return _0x1dd859[_0x93fa('0x25')]()[_0x93fa('0x24')](function(){var _0x1a8219=_0x1dd859[_0x93fa('0x26')]({'plain':!![]});var _0x3468a8=_0x93fa('0x27');return db[_0x93fa('0x28')][_0x93fa('0x25')]({'where':{'type':_0x3468a8,'resourceId':_0x1a8219['id']}})[_0x93fa('0x24')](function(){return _0x1dd859;});})['then'](function(){_0x3a196f['status'](0xcc)[_0x93fa('0x18')]();});}};}function handleEntityNotFound(_0x2d6f39,_0x2b06d2){return function(_0x4d5dd8){if(!_0x4d5dd8){_0x2d6f39[_0x93fa('0x16')](0x194);}return _0x4d5dd8;};}function handleError(_0x1939cb,_0x2ef186){_0x2ef186=_0x2ef186||0x1f4;return function(_0x3a12ae){logger[_0x93fa('0x29')](_0x3a12ae[_0x93fa('0x2a')]);if(_0x3a12ae[_0x93fa('0x2b')]){delete _0x3a12ae['name'];}_0x1939cb['status'](_0x2ef186)[_0x93fa('0x2c')](_0x3a12ae);};}exports[_0x93fa('0x2d')]=function(_0x2714f9,_0x5e32e4){var _0x4ced49={},_0x374d63={},_0x40a7ba={'count':0x0,'rows':[]};var _0x4d1f20=_[_0x93fa('0x2e')](db['CmHopperAdditionalPhone'][_0x93fa('0x2f')],function(_0x2c9b79){return{'name':_0x2c9b79[_0x93fa('0x30')],'type':_0x2c9b79[_0x93fa('0x31')][_0x93fa('0x32')]};});_0x374d63[_0x93fa('0x33')]=_[_0x93fa('0x2e')](_0x4d1f20,'name');_0x374d63[_0x93fa('0x34')]=_[_0x93fa('0x35')](_0x2714f9[_0x93fa('0x34')]);_0x374d63[_0x93fa('0x36')]=_[_0x93fa('0x37')](_0x374d63['model'],_0x374d63[_0x93fa('0x34')]);_0x4ced49[_0x93fa('0x38')]=_[_0x93fa('0x37')](_0x374d63[_0x93fa('0x33')],qs[_0x93fa('0x39')](_0x2714f9[_0x93fa('0x34')][_0x93fa('0x39')]));_0x4ced49[_0x93fa('0x38')]=_0x4ced49[_0x93fa('0x38')]['length']?_0x4ced49[_0x93fa('0x38')]:_0x374d63['model'];if(!_0x2714f9[_0x93fa('0x34')][_0x93fa('0x3a')](_0x93fa('0x3b'))){_0x4ced49[_0x93fa('0x1c')]=qs[_0x93fa('0x1c')](_0x2714f9[_0x93fa('0x34')][_0x93fa('0x1c')]);_0x4ced49[_0x93fa('0x1a')]=qs[_0x93fa('0x1a')](_0x2714f9['query'][_0x93fa('0x1a')]);}_0x4ced49[_0x93fa('0x3c')]=qs[_0x93fa('0x3d')](_0x2714f9['query'][_0x93fa('0x3d')]);_0x4ced49[_0x93fa('0x3e')]=qs[_0x93fa('0x36')](_[_0x93fa('0x3f')](_0x2714f9['query'],_0x374d63['filters']),_0x4d1f20);if(_0x2714f9[_0x93fa('0x34')][_0x93fa('0x40')]){_0x4ced49[_0x93fa('0x3e')]=_[_0x93fa('0x41')](_0x4ced49[_0x93fa('0x3e')],{'$or':_[_0x93fa('0x2e')](_0x4d1f20,function(_0x53f961){if(_0x53f961[_0x93fa('0x31')]!==_0x93fa('0x42')){var _0x8e6129={};_0x8e6129[_0x53f961[_0x93fa('0x2b')]]={'$like':'%'+_0x2714f9[_0x93fa('0x34')][_0x93fa('0x40')]+'%'};return _0x8e6129;}})});}_0x4ced49=_[_0x93fa('0x41')]({},_0x4ced49,_0x2714f9[_0x93fa('0x43')]);var _0x2a0379={'where':_0x4ced49['where']};return db[_0x93fa('0x44')]['count'](_0x2a0379)[_0x93fa('0x24')](function(_0x75345c){_0x40a7ba[_0x93fa('0x1d')]=_0x75345c;if(_0x2714f9[_0x93fa('0x34')][_0x93fa('0x45')]){_0x4ced49['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x4ced49);})[_0x93fa('0x24')](function(_0x2199d1){_0x40a7ba[_0x93fa('0x46')]=_0x2199d1;return _0x40a7ba;})[_0x93fa('0x24')](respondWithFilteredResult(_0x5e32e4,_0x4ced49))['catch'](handleError(_0x5e32e4,null));};exports[_0x93fa('0x47')]=function(_0x15025f,_0x32a88c){var _0x2d012b={'raw':!![],'where':{'id':_0x15025f[_0x93fa('0x48')]['id']}},_0x3c2db3={};_0x3c2db3[_0x93fa('0x33')]=_['keys'](db[_0x93fa('0x44')][_0x93fa('0x2f')]);_0x3c2db3[_0x93fa('0x34')]=_[_0x93fa('0x35')](_0x15025f[_0x93fa('0x34')]);_0x3c2db3[_0x93fa('0x36')]=_[_0x93fa('0x37')](_0x3c2db3[_0x93fa('0x33')],_0x3c2db3[_0x93fa('0x34')]);_0x2d012b[_0x93fa('0x38')]=_[_0x93fa('0x37')](_0x3c2db3[_0x93fa('0x33')],qs[_0x93fa('0x39')](_0x15025f[_0x93fa('0x34')][_0x93fa('0x39')]));_0x2d012b[_0x93fa('0x38')]=_0x2d012b[_0x93fa('0x38')][_0x93fa('0x49')]?_0x2d012b[_0x93fa('0x38')]:_0x3c2db3[_0x93fa('0x33')];if(_0x15025f[_0x93fa('0x34')][_0x93fa('0x45')]){_0x2d012b[_0x93fa('0x4a')]=[{'all':!![]}];}_0x2d012b=_['merge']({},_0x2d012b,_0x15025f['options']);return db['CmHopperAdditionalPhone']['find'](_0x2d012b)[_0x93fa('0x24')](handleEntityNotFound(_0x32a88c,null))[_0x93fa('0x24')](respondWithResult(_0x32a88c,null))[_0x93fa('0x4b')](handleError(_0x32a88c,null));};exports[_0x93fa('0x4c')]=function(_0xb5b389,_0x4fcf8a){return db['CmHopperAdditionalPhone'][_0x93fa('0x4c')](_0xb5b389[_0x93fa('0x4d')],{})[_0x93fa('0x24')](function(_0x4d30d0){var _0x1ce681=_0xb5b389[_0x93fa('0x4e')][_0x93fa('0x26')]({'plain':!![]});if(!_0x1ce681)throw new Error(_0x93fa('0x4f'));if(_0x1ce681[_0x93fa('0x50')]===_0x93fa('0x4e')){var _0x41144d=_0x4d30d0[_0x93fa('0x26')]({'plain':!![]});var _0x1d8aeb=_0x93fa('0x27');return db[_0x93fa('0x51')][_0x93fa('0x52')]({'where':{'name':_0x1d8aeb,'userProfileId':_0x1ce681[_0x93fa('0x53')]},'raw':!![]})[_0x93fa('0x24')](function(_0x150c18){if(_0x150c18&&_0x150c18[_0x93fa('0x54')]===0x0){return db[_0x93fa('0x28')][_0x93fa('0x4c')]({'name':_0x41144d['name'],'resourceId':_0x41144d['id'],'type':_0x150c18[_0x93fa('0x2b')],'sectionId':_0x150c18['id']},{})[_0x93fa('0x24')](function(){return _0x4d30d0;});}else{return _0x4d30d0;}})[_0x93fa('0x4b')](function(_0x2d5ebe){logger[_0x93fa('0x29')](_0x93fa('0x55'),_0x2d5ebe);throw _0x2d5ebe;});}return _0x4d30d0;})[_0x93fa('0x24')](respondWithResult(_0x4fcf8a,0xc9))[_0x93fa('0x4b')](handleError(_0x4fcf8a,null));};exports[_0x93fa('0x23')]=function(_0x5d2a3b,_0xf3a63){if(_0x5d2a3b[_0x93fa('0x4d')]['id']){delete _0x5d2a3b[_0x93fa('0x4d')]['id'];}return db[_0x93fa('0x44')][_0x93fa('0x52')]({'where':{'id':_0x5d2a3b[_0x93fa('0x48')]['id']}})[_0x93fa('0x24')](handleEntityNotFound(_0xf3a63,null))[_0x93fa('0x24')](saveUpdates(_0x5d2a3b[_0x93fa('0x4d')],null))[_0x93fa('0x24')](respondWithResult(_0xf3a63,null))[_0x93fa('0x4b')](handleError(_0xf3a63,null));};exports[_0x93fa('0x25')]=function(_0x3b063b,_0x3edff4){return db[_0x93fa('0x44')][_0x93fa('0x52')]({'where':{'id':_0x3b063b[_0x93fa('0x48')]['id']}})[_0x93fa('0x24')](handleEntityNotFound(_0x3edff4,null))[_0x93fa('0x24')](removeEntity(_0x3edff4,null))[_0x93fa('0x4b')](handleError(_0x3edff4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index e94e849..47659d3 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 _0x2066=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x366276,_0xa3cbaf){var _0xcefaff=function(_0x53fb69){while(--_0x53fb69){_0x366276['push'](_0x366276['shift']());}};_0xcefaff(++_0xa3cbaf);}(_0x2066,0x7b));var _0x6206=function(_0x12bec6,_0x1bae75){_0x12bec6=_0x12bec6-0x0;var _0x3870a7=_0x2066[_0x12bec6];return _0x3870a7;};'use strict';var _=require(_0x6206('0x0'));var util=require(_0x6206('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6206('0x2'));var BPromise=require(_0x6206('0x3'));var rp=require(_0x6206('0x4'));var fs=require('fs');var path=require(_0x6206('0x5'));var rimraf=require(_0x6206('0x6'));var config=require(_0x6206('0x7'));var attributes=require(_0x6206('0x8'));module[_0x6206('0x9')]=function(_0x18a945,_0x286ce6){return _0x18a945[_0x6206('0xa')](_0x6206('0xb'),attributes,{'tableName':_0x6206('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35cb=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define'];(function(_0x554795,_0xb80719){var _0x3cc757=function(_0x5eb900){while(--_0x5eb900){_0x554795['push'](_0x554795['shift']());}};_0x3cc757(++_0xb80719);}(_0x35cb,0xb8));var _0xb35c=function(_0x914364,_0x29a489){_0x914364=_0x914364-0x0;var _0x49c6f3=_0x35cb[_0x914364];return _0x49c6f3;};'use strict';var _=require(_0xb35c('0x0'));var util=require(_0xb35c('0x1'));var logger=require(_0xb35c('0x2'))(_0xb35c('0x3'));var moment=require(_0xb35c('0x4'));var BPromise=require(_0xb35c('0x5'));var rp=require(_0xb35c('0x6'));var fs=require('fs');var path=require(_0xb35c('0x7'));var rimraf=require(_0xb35c('0x8'));var config=require('../../config/environment');var attributes=require(_0xb35c('0x9'));module[_0xb35c('0xa')]=function(_0x204db5,_0x238d68){return _0x204db5[_0xb35c('0xb')](_0xb35c('0xc'),attributes,{'tableName':_0xb35c('0xd'),'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 8f62773..aa334bc 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 _0xa531=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','ASC','countcongestionretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','update','field','IncrementPreviewCounters','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x51ac81,_0x4722b2){var _0x12ac7e=function(_0x4dd4c1){while(--_0x4dd4c1){_0x51ac81['push'](_0x51ac81['shift']());}};_0x12ac7e(++_0x4722b2);}(_0xa531,0x12e));var _0x1a53=function(_0x2444a4,_0x36b773){_0x2444a4=_0x2444a4-0x0;var _0x1786fb=_0xa531[_0x2444a4];return _0x1786fb;};'use strict';var _=require(_0x1a53('0x0'));var util=require(_0x1a53('0x1'));var moment=require(_0x1a53('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a53('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a53('0x4'));var logger=require(_0x1a53('0x5'))(_0x1a53('0x6'));var config=require(_0x1a53('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a53('0x8')][_0x1a53('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d1d3f,_0x2f4e98,_0x55382c){return new BPromise(function(_0x4c1ab4,_0xb57b1c){return client[_0x1a53('0xa')](_0x2d1d3f,_0x55382c)[_0x1a53('0xb')](function(_0x10012d){logger[_0x1a53('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2f4e98,_0x1a53('0xd'));logger[_0x1a53('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x2f4e98,'request\x20sent',JSON[_0x1a53('0xf')](_0x10012d));if(_0x10012d[_0x1a53('0x10')]){if(_0x10012d['error'][_0x1a53('0x11')]===0x1f4){logger['error'](_0x1a53('0x12'),_0x2f4e98,_0x10012d[_0x1a53('0x10')][_0x1a53('0x13')]);return _0xb57b1c(_0x10012d[_0x1a53('0x10')][_0x1a53('0x13')]);}logger[_0x1a53('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2f4e98,_0x10012d[_0x1a53('0x10')][_0x1a53('0x13')]);return _0x4c1ab4(_0x10012d[_0x1a53('0x10')][_0x1a53('0x13')]);}else{logger[_0x1a53('0xc')](_0x1a53('0x12'),_0x2f4e98,'request\x20sent');_0x4c1ab4(_0x10012d[_0x1a53('0x14')][_0x1a53('0x13')]);}})[_0x1a53('0x15')](function(_0x3cae4a){logger[_0x1a53('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2f4e98,_0x3cae4a);_0xb57b1c(_0x3cae4a);});});}exports['VerifyAdditionalPhones']=function(_0x5bd6c9){var _0x409d0e=this;return new Promise(function(_0x295a62,_0x3ad41c){return db[_0x1a53('0x16')][_0x1a53('0x17')]({'raw':!![],'where':{'ContactId':_0x5bd6c9[_0x1a53('0x18')][_0x1a53('0x19')],'ListId':_0x5bd6c9['body'][_0x1a53('0x1a')],'VoiceQueueId':_0x5bd6c9[_0x1a53('0x18')][_0x1a53('0x1b')]===undefined?null:_0x5bd6c9[_0x1a53('0x18')][_0x1a53('0x1b')],'CampaignId':_0x5bd6c9[_0x1a53('0x18')][_0x1a53('0x1c')]===undefined?null:_0x5bd6c9[_0x1a53('0x18')][_0x1a53('0x1c')]}})[_0x1a53('0xb')](function(_0x4a2ec7){if(_0x4a2ec7!=null){return db[_0x1a53('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4a2ec7['id'],'OrderBy':{'$gt':_0x4a2ec7[_0x1a53('0x1e')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x1ff0f0){var _0x56dd59=0x0;if(_0x1ff0f0){if(_0x1ff0f0[_0x1a53('0x1f')]+_0x1ff0f0['countcongestionretry']+_0x1ff0f0[_0x1a53('0x20')]+_0x1ff0f0[_0x1a53('0x21')]+_0x1ff0f0[_0x1a53('0x22')]+_0x1ff0f0[_0x1a53('0x23')]+_0x1ff0f0[_0x1a53('0x24')]+_0x1ff0f0[_0x1a53('0x25')]<_0x5bd6c9['entity'][_0x1a53('0x26')])_0x56dd59=0x1;_0x295a62({'additional':_0x56dd59});}else{return db[_0x1a53('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4a2ec7['id']},'order':[[_0x1a53('0x1e'),_0x1a53('0x27')]]})[_0x1a53('0xb')](function(_0xd17829){var _0x49bbaa=0x0;if(_0xd17829){if(_0xd17829['countbusyretry']+_0xd17829[_0x1a53('0x28')]+_0xd17829['countnoanswerretry']+_0xd17829[_0x1a53('0x21')]+_0xd17829[_0x1a53('0x22')]+_0xd17829[_0x1a53('0x23')]+_0xd17829[_0x1a53('0x24')]+_0xd17829['countagentrejectretry']<_0x5bd6c9[_0x1a53('0x29')]['dialGlobalMaxRetry'])_0x49bbaa=0x1;_0x295a62({'additional':_0x49bbaa});}else{_0x295a62({'additional':0x0});}})[_0x1a53('0x15')](function(_0x14834b){logger['error'](_0x1a53('0x2a'),_0x14834b[_0x1a53('0x13')]);_0x3ad41c(_0x409d0e[_0x1a53('0x10')](0x1f4,_0x14834b[_0x1a53('0x13')]));});}})[_0x1a53('0x15')](function(_0x37c316){logger[_0x1a53('0x10')]('VerifyAdditionalPhones',_0x37c316[_0x1a53('0x13')]);_0x3ad41c(_0x409d0e[_0x1a53('0x10')](0x1f4,_0x37c316[_0x1a53('0x13')]));});}else _0x295a62({'additional':0x0});});});};exports[_0x1a53('0x2b')]=function(_0x479bb4){var _0x4ae0e0=this;return new Promise(function(_0x2e788d,_0x4ca8b2){return db[_0x1a53('0x16')][_0x1a53('0x17')]({'raw':!![],'where':{'ContactId':_0x479bb4[_0x1a53('0x18')][_0x1a53('0x19')],'ListId':_0x479bb4[_0x1a53('0x18')][_0x1a53('0x1a')],'VoiceQueueId':_0x479bb4[_0x1a53('0x18')]['VoiceQueueId']===undefined?null:_0x479bb4[_0x1a53('0x18')][_0x1a53('0x1b')],'CampaignId':_0x479bb4[_0x1a53('0x18')][_0x1a53('0x1c')]===undefined?null:_0x479bb4[_0x1a53('0x18')][_0x1a53('0x1c')]}})[_0x1a53('0xb')](function(_0x3e5398){if(_0x3e5398!=null){return db[_0x1a53('0x1d')][_0x1a53('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3e5398['id'],'OrderBy':{'$gte':_0x3e5398['OrderBy']}},'order':[[_0x1a53('0x1e'),'ASC']]})[_0x1a53('0xb')](function(_0x5a2f78){if(_0x5a2f78)return activateAdditionalPhone(_0x3e5398,_0x479bb4[_0x1a53('0x18')],_0x5a2f78,_0x479bb4[_0x1a53('0x2c')],_0x479bb4['waitTime'])[_0x1a53('0xb')](function(_0x5f7f76){_0x2e788d(_0x5f7f76);});else{return db[_0x1a53('0x1d')][_0x1a53('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3e5398['id']},'order':[['OrderBy',_0x1a53('0x27')]]})[_0x1a53('0xb')](function(_0x287d2d){if(_0x287d2d)return activateAdditionalPhone(_0x3e5398,_0x479bb4['body'],_0x287d2d,_0x479bb4[_0x1a53('0x2c')],_0x479bb4[_0x1a53('0x2d')])[_0x1a53('0xb')](function(_0x14eeb5){_0x2e788d(_0x14eeb5);});else{_0x2e788d({'id':_0x3e5398['id'],'phone':''});}})[_0x1a53('0x15')](function(_0x52d38e){logger['error']('VerifyAdditionalPhones',_0x52d38e['message']);_0x4ca8b2(_0x4ae0e0[_0x1a53('0x10')](0x1f4,_0x52d38e[_0x1a53('0x13')]));});}})['catch'](function(_0xbb5f8e){logger[_0x1a53('0x10')]('VerifyAdditionalPhones',_0xbb5f8e[_0x1a53('0x13')]);_0x4ca8b2(_0x4ae0e0[_0x1a53('0x10')](0x1f4,_0xbb5f8e['message']));});}else _0x2e788d(0x1);});});};function activateAdditionalPhone(_0x63889f,_0x14baa3,_0x5d8cdb,_0x569657,_0x2f67eb){return new Promise(function(_0x34174e,_0x9c9cbb){var _0x470d35;if(_[_0x1a53('0x2e')](_0x5d8cdb[_0x1a53('0x2f')])){_0x5d8cdb[_0x1a53('0x2f')]=moment();}if(moment()>moment(_0x5d8cdb['scheduledat'])){_0x470d35=moment()[_0x1a53('0x30')](_0x2f67eb||0x3,_0x1a53('0x31'));}else{if(_0x5d8cdb[_0x1a53('0x1e')]==0x0){_0x470d35=moment(_0x5d8cdb['scheduledat']);}else{_0x470d35=moment()[_0x1a53('0x30')](_0x2f67eb||0x3,'minutes');}}if(_[_0x1a53('0x2e')](_0x470d35)){_0x470d35=moment()[_0x1a53('0x30')](_0x2f67eb||0x3,'minutes');}var _0x26f3c8={'phone':_0x63889f['phone'],'active':0x0,'OrderBy':_[_0x1a53('0x2e')](_0x63889f['OrderBy'])?0x0:_0x63889f[_0x1a53('0x1e')],'scheduledat':moment()[_0x1a53('0x30')](_0x569657||0x1,_0x1a53('0x31')),'countbusyretry':_0x14baa3[_0x1a53('0x1f')],'countcongestionretry':_0x14baa3[_0x1a53('0x28')],'countnoanswerretry':_0x14baa3[_0x1a53('0x20')],'countnosuchnumberretry':_0x14baa3['countnosuchnumberretry'],'countdropretry':_0x14baa3[_0x1a53('0x22')],'countabandonedretry':_0x14baa3[_0x1a53('0x23')],'countmachineretry':_0x14baa3[_0x1a53('0x24')],'countagentrejectretry':_0x14baa3[_0x1a53('0x25')],'createdAt':_0x14baa3[_0x1a53('0x32')],'updatedAt':_0x14baa3[_0x1a53('0x33')]};var _0x51dbb5={'CmHopperId':_0x63889f['id'],'phone':_0x5d8cdb[_0x1a53('0x34')],'active':0x0,'OrderBy':_['isNil'](_0x5d8cdb['OrderBy'])?0x0:_0x5d8cdb[_0x1a53('0x1e')],'scheduledat':_0x470d35,'countbusyretry':_0x5d8cdb[_0x1a53('0x1f')],'countcongestionretry':_0x5d8cdb[_0x1a53('0x28')],'countnoanswerretry':_0x5d8cdb[_0x1a53('0x20')],'countnosuchnumberretry':_0x5d8cdb[_0x1a53('0x21')],'countdropretry':_0x5d8cdb[_0x1a53('0x22')],'countabandonedretry':_0x5d8cdb[_0x1a53('0x23')],'countmachineretry':_0x5d8cdb[_0x1a53('0x24')],'countagentrejectretry':_0x5d8cdb['countagentrejectretry'],'createdAt':_0x5d8cdb[_0x1a53('0x32')],'updatedAt':_0x5d8cdb[_0x1a53('0x33')]};return db['sequelize']['transaction'](function(_0x558144){return db[_0x1a53('0x1d')][_0x1a53('0x35')](_0x26f3c8,{'where':{'id':_0x5d8cdb['id']}},{'transaction':_0x558144})['then'](function(){return db[_0x1a53('0x16')]['update'](_0x51dbb5,{'where':{'id':_0x63889f['id']}},{'transaction':_0x558144});});})['then'](function(_0x275eb2){_0x34174e({'id':_0x63889f['id'],'phone':_0x5d8cdb[_0x1a53('0x34')]});})[_0x1a53('0x15')](function(_0x4f8006){logger[_0x1a53('0x10')]('activateAdditionalPhone',_0x4f8006[_0x1a53('0x13')]);_0x9c9cbb({'error':_0x4f8006['message']});});});}exports['IncrementPreviewCounters']=function(_0x5aad7e){var _0x154e3a=this;return new Promise(function(_0x3a2f16,_0x1f244a){return db[_0x1a53('0x16')][_0x1a53('0x35')](_0x5aad7e[_0x1a53('0x18')][_0x1a53('0x36')],{'where':{'id':_0x5aad7e[_0x1a53('0x18')]['id']}})[_0x1a53('0xb')](function(_0x35ca95){_0x3a2f16(_0x35ca95);})[_0x1a53('0x15')](function(_0x4e266f){logger[_0x1a53('0x10')](_0x1a53('0x37'),_0x4e266f[_0x1a53('0x13')]);_0x1f244a(_0x154e3a[_0x1a53('0x10')](0x1f4,_0x4e266f['message']));});});}; \ No newline at end of file +var _0x4aad=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4aad,0x116));var _0xd4aa=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x4aad[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xd4aa('0x0'));var util=require(_0xd4aa('0x1'));var moment=require(_0xd4aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4aa('0x3'));var fs=require('fs');var Redis=require(_0xd4aa('0x4'));var db=require(_0xd4aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4aa('0x6'))(_0xd4aa('0x7'));var config=require(_0xd4aa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd4aa('0x9')][_0xd4aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bac89,_0x5aceef,_0x3e7980){return new BPromise(function(_0x2ce97a,_0xe9454e){return client['request'](_0x5bac89,_0x3e7980)[_0xd4aa('0xb')](function(_0x4d01e8){logger[_0xd4aa('0xc')](_0xd4aa('0xd'),_0x5aceef,_0xd4aa('0xe'));logger['debug'](_0xd4aa('0xf'),_0x5aceef,_0xd4aa('0xe'),JSON['stringify'](_0x4d01e8));if(_0x4d01e8['error']){if(_0x4d01e8[_0xd4aa('0x10')][_0xd4aa('0x11')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5aceef,_0x4d01e8[_0xd4aa('0x10')][_0xd4aa('0x12')]);return _0xe9454e(_0x4d01e8['error'][_0xd4aa('0x12')]);}logger[_0xd4aa('0x10')](_0xd4aa('0xd'),_0x5aceef,_0x4d01e8[_0xd4aa('0x10')][_0xd4aa('0x12')]);return _0x2ce97a(_0x4d01e8[_0xd4aa('0x10')][_0xd4aa('0x12')]);}else{logger[_0xd4aa('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5aceef,_0xd4aa('0xe'));_0x2ce97a(_0x4d01e8[_0xd4aa('0x13')][_0xd4aa('0x12')]);}})[_0xd4aa('0x14')](function(_0x39fcb6){logger[_0xd4aa('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5aceef,_0x39fcb6);_0xe9454e(_0x39fcb6);});});}exports['VerifyAdditionalPhones']=function(_0x49f9f8){var _0x37ac6b=this;return new Promise(function(_0x5123c6,_0x821c4d){return db[_0xd4aa('0x15')][_0xd4aa('0x16')]({'raw':!![],'where':{'ContactId':_0x49f9f8[_0xd4aa('0x17')][_0xd4aa('0x18')],'ListId':_0x49f9f8['body'][_0xd4aa('0x19')],'VoiceQueueId':_0x49f9f8['body'][_0xd4aa('0x1a')]===undefined?null:_0x49f9f8[_0xd4aa('0x17')][_0xd4aa('0x1a')],'CampaignId':_0x49f9f8[_0xd4aa('0x17')][_0xd4aa('0x1b')]===undefined?null:_0x49f9f8[_0xd4aa('0x17')][_0xd4aa('0x1b')]}})[_0xd4aa('0xb')](function(_0x14a8f9){if(_0x14a8f9!=null){return db[_0xd4aa('0x1c')][_0xd4aa('0x16')]({'raw':!![],'where':{'CmHopperId':_0x14a8f9['id'],'OrderBy':{'$gt':_0x14a8f9[_0xd4aa('0x1d')]}},'order':[[_0xd4aa('0x1d'),_0xd4aa('0x1e')]]})['then'](function(_0x3bf342){var _0x53a612=0x0;if(_0x3bf342){if(_0x3bf342[_0xd4aa('0x1f')]+_0x3bf342[_0xd4aa('0x20')]+_0x3bf342[_0xd4aa('0x21')]+_0x3bf342[_0xd4aa('0x22')]+_0x3bf342[_0xd4aa('0x23')]+_0x3bf342[_0xd4aa('0x24')]+_0x3bf342[_0xd4aa('0x25')]+_0x3bf342[_0xd4aa('0x26')]<_0x49f9f8['entity']['dialGlobalMaxRetry'])_0x53a612=0x1;_0x5123c6({'additional':_0x53a612});}else{return db[_0xd4aa('0x1c')][_0xd4aa('0x16')]({'raw':!![],'where':{'CmHopperId':_0x14a8f9['id']},'order':[['OrderBy','ASC']]})[_0xd4aa('0xb')](function(_0xc346c1){var _0x546ee0=0x0;if(_0xc346c1){if(_0xc346c1[_0xd4aa('0x1f')]+_0xc346c1[_0xd4aa('0x20')]+_0xc346c1[_0xd4aa('0x21')]+_0xc346c1[_0xd4aa('0x22')]+_0xc346c1[_0xd4aa('0x23')]+_0xc346c1[_0xd4aa('0x24')]+_0xc346c1['countmachineretry']+_0xc346c1[_0xd4aa('0x26')]<_0x49f9f8[_0xd4aa('0x27')][_0xd4aa('0x28')])_0x546ee0=0x1;_0x5123c6({'additional':_0x546ee0});}else{_0x5123c6({'additional':0x0});}})[_0xd4aa('0x14')](function(_0x12a08b){logger['error'](_0xd4aa('0x29'),_0x12a08b[_0xd4aa('0x12')]);_0x821c4d(_0x37ac6b['error'](0x1f4,_0x12a08b[_0xd4aa('0x12')]));});}})[_0xd4aa('0x14')](function(_0x160427){logger[_0xd4aa('0x10')]('VerifyAdditionalPhones',_0x160427[_0xd4aa('0x12')]);_0x821c4d(_0x37ac6b[_0xd4aa('0x10')](0x1f4,_0x160427[_0xd4aa('0x12')]));});}else _0x5123c6({'additional':0x0});});});};exports[_0xd4aa('0x2a')]=function(_0x2654ca){var _0x4ebeda=this;return new Promise(function(_0x39dafc,_0x9c8551){return db[_0xd4aa('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x2654ca['body']['ContactId'],'ListId':_0x2654ca[_0xd4aa('0x17')][_0xd4aa('0x19')],'VoiceQueueId':_0x2654ca['body'][_0xd4aa('0x1a')]===undefined?null:_0x2654ca['body'][_0xd4aa('0x1a')],'CampaignId':_0x2654ca[_0xd4aa('0x17')][_0xd4aa('0x1b')]===undefined?null:_0x2654ca[_0xd4aa('0x17')]['CampaignId']}})['then'](function(_0x3f2f46){if(_0x3f2f46!=null){return db[_0xd4aa('0x1c')][_0xd4aa('0x16')]({'raw':!![],'where':{'CmHopperId':_0x3f2f46['id'],'OrderBy':{'$gte':_0x3f2f46[_0xd4aa('0x1d')]}},'order':[['OrderBy',_0xd4aa('0x1e')]]})[_0xd4aa('0xb')](function(_0x4b6927){if(_0x4b6927)return activateAdditionalPhone(_0x3f2f46,_0x2654ca[_0xd4aa('0x17')],_0x4b6927,_0x2654ca[_0xd4aa('0x2b')],_0x2654ca[_0xd4aa('0x2c')])[_0xd4aa('0xb')](function(_0x317dc9){_0x39dafc(_0x317dc9);});else{return db['CmHopperAdditionalPhone'][_0xd4aa('0x16')]({'raw':!![],'where':{'CmHopperId':_0x3f2f46['id']},'order':[[_0xd4aa('0x1d'),_0xd4aa('0x1e')]]})[_0xd4aa('0xb')](function(_0x415e08){if(_0x415e08)return activateAdditionalPhone(_0x3f2f46,_0x2654ca[_0xd4aa('0x17')],_0x415e08,_0x2654ca['duration'],_0x2654ca[_0xd4aa('0x2c')])[_0xd4aa('0xb')](function(_0x1c333a){_0x39dafc(_0x1c333a);});else{_0x39dafc({'id':_0x3f2f46['id'],'phone':''});}})[_0xd4aa('0x14')](function(_0x48ce8c){logger[_0xd4aa('0x10')](_0xd4aa('0x29'),_0x48ce8c[_0xd4aa('0x12')]);_0x9c8551(_0x4ebeda[_0xd4aa('0x10')](0x1f4,_0x48ce8c[_0xd4aa('0x12')]));});}})[_0xd4aa('0x14')](function(_0x1e88f7){logger['error'](_0xd4aa('0x29'),_0x1e88f7[_0xd4aa('0x12')]);_0x9c8551(_0x4ebeda['error'](0x1f4,_0x1e88f7[_0xd4aa('0x12')]));});}else _0x39dafc(0x1);});});};function activateAdditionalPhone(_0xba303b,_0x2f083e,_0x111d2e,_0x4ecb4e,_0xd2727d){return new Promise(function(_0x265a76,_0x30c60b){var _0x1be6ac;if(_[_0xd4aa('0x2d')](_0x111d2e['scheduledat'])){_0x111d2e[_0xd4aa('0x2e')]=moment();}if(moment()>moment(_0x111d2e['scheduledat'])){_0x1be6ac=moment()[_0xd4aa('0x2f')](_0xd2727d||0x3,'minutes');}else{if(_0x111d2e['OrderBy']==0x0){_0x1be6ac=moment(_0x111d2e['scheduledat']);}else{_0x1be6ac=moment()[_0xd4aa('0x2f')](_0xd2727d||0x3,_0xd4aa('0x30'));}}if(_[_0xd4aa('0x2d')](_0x1be6ac)){_0x1be6ac=moment()[_0xd4aa('0x2f')](_0xd2727d||0x3,_0xd4aa('0x30'));}var _0x45f70a={'phone':_0xba303b[_0xd4aa('0x31')],'active':0x0,'OrderBy':_[_0xd4aa('0x2d')](_0xba303b['OrderBy'])?0x0:_0xba303b['OrderBy'],'scheduledat':moment()[_0xd4aa('0x2f')](_0x4ecb4e||0x1,_0xd4aa('0x30')),'countbusyretry':_0x2f083e[_0xd4aa('0x1f')],'countcongestionretry':_0x2f083e[_0xd4aa('0x20')],'countnoanswerretry':_0x2f083e[_0xd4aa('0x21')],'countnosuchnumberretry':_0x2f083e[_0xd4aa('0x22')],'countdropretry':_0x2f083e['countdropretry'],'countabandonedretry':_0x2f083e[_0xd4aa('0x24')],'countmachineretry':_0x2f083e[_0xd4aa('0x25')],'countagentrejectretry':_0x2f083e[_0xd4aa('0x26')],'createdAt':_0x2f083e[_0xd4aa('0x32')],'updatedAt':_0x2f083e[_0xd4aa('0x33')]};var _0x1ebb7b={'CmHopperId':_0xba303b['id'],'phone':_0x111d2e[_0xd4aa('0x31')],'active':0x0,'OrderBy':_[_0xd4aa('0x2d')](_0x111d2e[_0xd4aa('0x1d')])?0x0:_0x111d2e[_0xd4aa('0x1d')],'scheduledat':_0x1be6ac,'countbusyretry':_0x111d2e[_0xd4aa('0x1f')],'countcongestionretry':_0x111d2e[_0xd4aa('0x20')],'countnoanswerretry':_0x111d2e[_0xd4aa('0x21')],'countnosuchnumberretry':_0x111d2e[_0xd4aa('0x22')],'countdropretry':_0x111d2e[_0xd4aa('0x23')],'countabandonedretry':_0x111d2e[_0xd4aa('0x24')],'countmachineretry':_0x111d2e['countmachineretry'],'countagentrejectretry':_0x111d2e[_0xd4aa('0x26')],'createdAt':_0x111d2e[_0xd4aa('0x32')],'updatedAt':_0x111d2e[_0xd4aa('0x33')]};return db['sequelize'][_0xd4aa('0x34')](function(_0x2cd17e){return db[_0xd4aa('0x1c')][_0xd4aa('0x35')](_0x45f70a,{'where':{'id':_0x111d2e['id']}},{'transaction':_0x2cd17e})[_0xd4aa('0xb')](function(){return db[_0xd4aa('0x15')][_0xd4aa('0x35')](_0x1ebb7b,{'where':{'id':_0xba303b['id']}},{'transaction':_0x2cd17e});});})[_0xd4aa('0xb')](function(_0x5dcef5){_0x265a76({'id':_0xba303b['id'],'phone':_0x111d2e[_0xd4aa('0x31')]});})[_0xd4aa('0x14')](function(_0x52d449){logger[_0xd4aa('0x10')](_0xd4aa('0x36'),_0x52d449[_0xd4aa('0x12')]);_0x30c60b({'error':_0x52d449['message']});});});}exports[_0xd4aa('0x37')]=function(_0x20c79d){var _0x1f0348=this;return new Promise(function(_0x167d8a,_0x348209){return db[_0xd4aa('0x15')][_0xd4aa('0x35')](_0x20c79d[_0xd4aa('0x17')]['field'],{'where':{'id':_0x20c79d[_0xd4aa('0x17')]['id']}})[_0xd4aa('0xb')](function(_0x439569){_0x167d8a(_0x439569);})[_0xd4aa('0x14')](function(_0x179a7f){logger[_0xd4aa('0x10')](_0xd4aa('0x37'),_0x179a7f[_0xd4aa('0x12')]);_0x348209(_0x1f0348[_0xd4aa('0x10')](0x1f4,_0x179a7f[_0xd4aa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 31c81b4..27314e7 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 _0x299e=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','./cmHopperAdditionalPhone.controller'];(function(_0x1eb82d,_0x1e23cb){var _0x2c9502=function(_0x4a3500){while(--_0x4a3500){_0x1eb82d['push'](_0x1eb82d['shift']());}};_0x2c9502(++_0x1e23cb);}(_0x299e,0x1e7));var _0xe299=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x299e[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0xe299('0x0'));var path=require(_0xe299('0x1'));var timeout=require(_0xe299('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe299('0x3'));var auth=require(_0xe299('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe299('0x5'));router['get']('/',auth[_0xe299('0x6')](),controller[_0xe299('0x7')]);router['get'](_0xe299('0x8'),auth[_0xe299('0x6')](),controller[_0xe299('0x9')]);router[_0xe299('0xa')]('/',auth[_0xe299('0x6')](),controller[_0xe299('0xb')]);router[_0xe299('0xc')](_0xe299('0x8'),auth[_0xe299('0x6')](),controller[_0xe299('0xd')]);router[_0xe299('0xe')](_0xe299('0x8'),auth['isAuthenticated'](),controller[_0xe299('0xf')]);module[_0xe299('0x10')]=router; \ No newline at end of file +var _0x7400=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id','show','post','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x7c6b73,_0x569eb1){var _0x1d7b4f=function(_0x45ba25){while(--_0x45ba25){_0x7c6b73['push'](_0x7c6b73['shift']());}};_0x1d7b4f(++_0x569eb1);}(_0x7400,0x1d7));var _0x0740=function(_0x377b59,_0x1f167d){_0x377b59=_0x377b59-0x0;var _0x2cae54=_0x7400[_0x377b59];return _0x2cae54;};'use strict';var multer=require('multer');var util=require(_0x0740('0x0'));var path=require(_0x0740('0x1'));var timeout=require(_0x0740('0x2'));var express=require(_0x0740('0x3'));var router=express[_0x0740('0x4')]();var fs_extra=require(_0x0740('0x5'));var auth=require(_0x0740('0x6'));var interaction=require(_0x0740('0x7'));var config=require(_0x0740('0x8'));var controller=require(_0x0740('0x9'));router['get']('/',auth[_0x0740('0xa')](),controller[_0x0740('0xb')]);router['get'](_0x0740('0xc'),auth[_0x0740('0xa')](),controller[_0x0740('0xd')]);router[_0x0740('0xe')]('/',auth[_0x0740('0xa')](),controller['create']);router[_0x0740('0xf')](_0x0740('0xc'),auth[_0x0740('0xa')](),controller[_0x0740('0x10')]);router[_0x0740('0x11')](_0x0740('0xc'),auth[_0x0740('0xa')](),controller['destroy']);module[_0x0740('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3ab445b..8cf4138 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 _0x67cb=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x2aa9e8,_0x148b35){var _0x55b468=function(_0x57d950){while(--_0x57d950){_0x2aa9e8['push'](_0x2aa9e8['shift']());}};_0x55b468(++_0x148b35);}(_0x67cb,0x19e));var _0xb67c=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x67cb[_0x5a2285];return _0x48f6ed;};'use strict';var moment=require(_0xb67c('0x0'));var Sequelize=require('sequelize');module[_0xb67c('0x1')]={'phone':{'type':Sequelize[_0xb67c('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb67c('0x3')],'unique':_0xb67c('0x4')},'ListId':{'type':Sequelize[_0xb67c('0x3')],'unique':_0xb67c('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x1d64=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x1a3098,_0x5828c0){var _0x263bae=function(_0x4c8cfe){while(--_0x4c8cfe){_0x1a3098['push'](_0x1a3098['shift']());}};_0x263bae(++_0x5828c0);}(_0x1d64,0x1cd));var _0x41d6=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0x1d64[_0x35e75a];return _0xb23c7f;};'use strict';var moment=require(_0x41d6('0x0'));var Sequelize=require(_0x41d6('0x1'));module[_0x41d6('0x2')]={'phone':{'type':Sequelize[_0x41d6('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x41d6('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x41d6('0x4')],'unique':_0x41d6('0x5')},'VoiceQueueId':{'type':Sequelize[_0x41d6('0x4')],'unique':_0x41d6('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 5f11104..bcc858d 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 _0xaefc=['lodash','squel','desk.js','papaparse','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','undefined','limit','count','set','reject','save','update','then','error','stack','name','index','CmHopperBlack','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x5ea351,_0x38393e){var _0x2d19b8=function(_0x324b66){while(--_0x324b66){_0x5ea351['push'](_0x5ea351['shift']());}};_0x2d19b8(++_0x38393e);}(_0xaefc,0x11a));var _0xcaef=function(_0x169683,_0x40d687){_0x169683=_0x169683-0x0;var _0x3fc533=_0xaefc[_0x169683];return _0x3fc533;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcaef('0x1'));var rp=require(_0xcaef('0x2'));var moment=require(_0xcaef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcaef('0x4'));var util=require(_0xcaef('0x5'));var path=require(_0xcaef('0x6'));var sox=require(_0xcaef('0x7'));var csv=require(_0xcaef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcaef('0x9'));var _=require(_0xcaef('0xa'));var squel=require(_0xcaef('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcaef('0xc'));var toCsv=require(_0xcaef('0x8'));var querystring=require('querystring');var Papa=require(_0xcaef('0xd'));var Redis=require(_0xcaef('0xe'));var authService=require(_0xcaef('0xf'));var qs=require(_0xcaef('0x10'));var as=require(_0xcaef('0x11'));var hardwareService=require(_0xcaef('0x12'));var logger=require(_0xcaef('0x13'))(_0xcaef('0x14'));var utils=require(_0xcaef('0x15'));var config=require(_0xcaef('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4928cb,_0x4c8f70){_0x4c8f70=_0x4c8f70||0xcc;return function(_0xfba032){if(_0xfba032){return _0x4928cb[_0xcaef('0x17')](_0x4c8f70);}return _0x4928cb['status'](_0x4c8f70)[_0xcaef('0x18')]();};}function respondWithResult(_0x5ec47d,_0x42d74e){_0x42d74e=_0x42d74e||0xc8;return function(_0x54b035){if(_0x54b035){return _0x5ec47d[_0xcaef('0x19')](_0x42d74e)[_0xcaef('0x1a')](_0x54b035);}};}function respondWithFilteredResult(_0x14de07,_0x8a09fc){return function(_0x20f859){if(_0x20f859){var _0xc382c7=typeof _0x8a09fc[_0xcaef('0x1b')]===_0xcaef('0x1c')&&typeof _0x8a09fc[_0xcaef('0x1d')]===_0xcaef('0x1c');var _0x2c9be7=_0x20f859['count'];var _0x2c0616=_0xc382c7?0x0:_0x8a09fc[_0xcaef('0x1b')];var _0x49cd07=_0xc382c7?_0x20f859[_0xcaef('0x1e')]:_0x8a09fc['offset']+_0x8a09fc[_0xcaef('0x1d')];var _0x40f749;if(_0x49cd07>=_0x2c9be7){_0x49cd07=_0x2c9be7;_0x40f749=0xc8;}else{_0x40f749=0xce;}_0x14de07[_0xcaef('0x19')](_0x40f749);return _0x14de07[_0xcaef('0x1f')]('Content-Range',_0x2c0616+'-'+_0x49cd07+'/'+_0x2c9be7)[_0xcaef('0x1a')](_0x20f859);}return null;};}function patchUpdates(_0x19f801){return function(_0x45c528){try{jsonpatch['apply'](_0x45c528,_0x19f801,!![]);}catch(_0x256588){return BPromise[_0xcaef('0x20')](_0x256588);}return _0x45c528[_0xcaef('0x21')]();};}function saveUpdates(_0x3e51af,_0x10e9d0){return function(_0x184c47){if(_0x184c47){return _0x184c47[_0xcaef('0x22')](_0x3e51af)[_0xcaef('0x23')](function(_0x34a9ff){return _0x34a9ff;});}return null;};}function removeEntity(_0xb35aba,_0x975fed){return function(_0x58dec6){if(_0x58dec6){return _0x58dec6['destroy']()[_0xcaef('0x23')](function(){_0xb35aba['status'](0xcc)[_0xcaef('0x18')]();});}};}function handleEntityNotFound(_0xcb270b,_0x340021){return function(_0x165b43){if(!_0x165b43){_0xcb270b['sendStatus'](0x194);}return _0x165b43;};}function handleError(_0x745bac,_0x505157){_0x505157=_0x505157||0x1f4;return function(_0x454a2b){logger[_0xcaef('0x24')](_0x454a2b[_0xcaef('0x25')]);if(_0x454a2b['name']){delete _0x454a2b[_0xcaef('0x26')];}_0x745bac[_0xcaef('0x19')](_0x505157)['send'](_0x454a2b);};}exports[_0xcaef('0x27')]=function(_0x2a9d02,_0x5d5042){var _0x25d03d={},_0x2c79df={},_0x522723={'count':0x0,'rows':[]};var _0x25e3f9=_['map'](db[_0xcaef('0x28')][_0xcaef('0x29')],function(_0x3af140){return{'name':_0x3af140[_0xcaef('0x2a')],'type':_0x3af140[_0xcaef('0x2b')]['key']};});_0x2c79df['model']=_[_0xcaef('0x2c')](_0x25e3f9,'name');_0x2c79df[_0xcaef('0x2d')]=_[_0xcaef('0x2e')](_0x2a9d02[_0xcaef('0x2d')]);_0x2c79df[_0xcaef('0x2f')]=_['intersection'](_0x2c79df[_0xcaef('0x30')],_0x2c79df[_0xcaef('0x2d')]);_0x25d03d[_0xcaef('0x31')]=_[_0xcaef('0x32')](_0x2c79df['model'],qs[_0xcaef('0x33')](_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x33')]));_0x25d03d[_0xcaef('0x31')]=_0x25d03d[_0xcaef('0x31')][_0xcaef('0x34')]?_0x25d03d[_0xcaef('0x31')]:_0x2c79df[_0xcaef('0x30')];if(!_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x35')](_0xcaef('0x36'))){_0x25d03d[_0xcaef('0x1d')]=qs[_0xcaef('0x1d')](_0x2a9d02[_0xcaef('0x2d')]['limit']);_0x25d03d[_0xcaef('0x1b')]=qs[_0xcaef('0x1b')](_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x1b')]);}_0x25d03d[_0xcaef('0x37')]=qs[_0xcaef('0x38')](_0x2a9d02[_0xcaef('0x2d')]['sort']);_0x25d03d[_0xcaef('0x39')]=qs['filters'](_[_0xcaef('0x3a')](_0x2a9d02[_0xcaef('0x2d')],_0x2c79df[_0xcaef('0x2f')]),_0x25e3f9);if(_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x3b')]){_0x25d03d[_0xcaef('0x39')]=_[_0xcaef('0x3c')](_0x25d03d[_0xcaef('0x39')],{'$or':_['map'](_0x25e3f9,function(_0x23a6c8){if(_0x23a6c8[_0xcaef('0x2b')]!=='VIRTUAL'){var _0x324eb4={};_0x324eb4[_0x23a6c8[_0xcaef('0x26')]]={'$like':'%'+_0x2a9d02['query'][_0xcaef('0x3b')]+'%'};return _0x324eb4;}})});}_0x25d03d=_['merge']({},_0x25d03d,_0x2a9d02[_0xcaef('0x3d')]);var _0x5a721b={'where':_0x25d03d[_0xcaef('0x39')]};return db[_0xcaef('0x28')][_0xcaef('0x1e')](_0x5a721b)[_0xcaef('0x23')](function(_0x5c04d3){_0x522723[_0xcaef('0x1e')]=_0x5c04d3;if(_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x3e')]){_0x25d03d[_0xcaef('0x3f')]=[{'all':!![]}];}return db[_0xcaef('0x28')][_0xcaef('0x40')](_0x25d03d);})[_0xcaef('0x23')](function(_0x11ee58){_0x522723[_0xcaef('0x41')]=_0x11ee58;return _0x522723;})[_0xcaef('0x23')](respondWithFilteredResult(_0x5d5042,_0x25d03d))[_0xcaef('0x42')](handleError(_0x5d5042,null));};exports[_0xcaef('0x43')]=function(_0x2fe2ab,_0x47d8fc){var _0x397211={'raw':!![],'where':{'id':_0x2fe2ab[_0xcaef('0x44')]['id']}},_0x3c6f35={};_0x3c6f35[_0xcaef('0x30')]=_[_0xcaef('0x2e')](db['CmHopperBlack'][_0xcaef('0x29')]);_0x3c6f35[_0xcaef('0x2d')]=_[_0xcaef('0x2e')](_0x2fe2ab['query']);_0x3c6f35[_0xcaef('0x2f')]=_[_0xcaef('0x32')](_0x3c6f35[_0xcaef('0x30')],_0x3c6f35[_0xcaef('0x2d')]);_0x397211[_0xcaef('0x31')]=_[_0xcaef('0x32')](_0x3c6f35[_0xcaef('0x30')],qs[_0xcaef('0x33')](_0x2fe2ab[_0xcaef('0x2d')]['fields']));_0x397211[_0xcaef('0x31')]=_0x397211[_0xcaef('0x31')]['length']?_0x397211[_0xcaef('0x31')]:_0x3c6f35[_0xcaef('0x30')];if(_0x2fe2ab[_0xcaef('0x2d')][_0xcaef('0x3e')]){_0x397211[_0xcaef('0x3f')]=[{'all':!![]}];}_0x397211=_[_0xcaef('0x3c')]({},_0x397211,_0x2fe2ab[_0xcaef('0x3d')]);return db[_0xcaef('0x28')][_0xcaef('0x45')](_0x397211)[_0xcaef('0x23')](handleEntityNotFound(_0x47d8fc,null))[_0xcaef('0x23')](respondWithResult(_0x47d8fc,null))[_0xcaef('0x42')](handleError(_0x47d8fc,null));};exports[_0xcaef('0x22')]=function(_0x290586,_0x3e9219){if(_0x290586[_0xcaef('0x46')]['id']){delete _0x290586['body']['id'];}return db[_0xcaef('0x28')][_0xcaef('0x45')]({'where':{'id':_0x290586['params']['id']}})['then'](handleEntityNotFound(_0x3e9219,null))['then'](saveUpdates(_0x290586['body'],null))[_0xcaef('0x23')](respondWithResult(_0x3e9219,null))[_0xcaef('0x42')](handleError(_0x3e9219,null));};exports[_0xcaef('0x47')]=function(_0xe3303d,_0x52c7ce){return db[_0xcaef('0x28')][_0xcaef('0x45')]({'where':{'id':_0xe3303d[_0xcaef('0x44')]['id']}})['then'](handleEntityNotFound(_0x52c7ce,null))[_0xcaef('0x23')](removeEntity(_0x52c7ce,null))[_0xcaef('0x42')](handleError(_0x52c7ce,null));};exports[_0xcaef('0x48')]=function(_0x2ef8a7,_0x2f918e){return db[_0xcaef('0x28')][_0xcaef('0x48')]()[_0xcaef('0x23')](respondWithResult(_0x2f918e,null))['catch'](handleError(_0x2f918e,null));}; \ No newline at end of file +var _0x73cb=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','rawAttributes','find','update','body','describe','eml-format','rimraf'];(function(_0x198040,_0x48ee29){var _0x4de908=function(_0x4f6e55){while(--_0x4f6e55){_0x198040['push'](_0x198040['shift']());}};_0x4de908(++_0x48ee29);}(_0x73cb,0x94));var _0xb73c=function(_0x190e8f,_0x7e0305){_0x190e8f=_0x190e8f-0x0;var _0x1c2f66=_0x73cb[_0x190e8f];return _0x1c2f66;};'use strict';var emlformat=require(_0xb73c('0x0'));var rimraf=require(_0xb73c('0x1'));var zipdir=require(_0xb73c('0x2'));var jsonpatch=require(_0xb73c('0x3'));var rp=require('request-promise');var moment=require(_0xb73c('0x4'));var BPromise=require(_0xb73c('0x5'));var Mustache=require(_0xb73c('0x6'));var util=require(_0xb73c('0x7'));var path=require(_0xb73c('0x8'));var sox=require(_0xb73c('0x9'));var csv=require(_0xb73c('0xa'));var ejs=require(_0xb73c('0xb'));var fs=require('fs');var fs_extra=require(_0xb73c('0xc'));var _=require(_0xb73c('0xd'));var squel=require(_0xb73c('0xe'));var crypto=require(_0xb73c('0xf'));var jsforce=require(_0xb73c('0x10'));var deskjs=require(_0xb73c('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb73c('0x12'));var Papa=require('papaparse');var Redis=require(_0xb73c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb73c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb73c('0x15'));var logger=require(_0xb73c('0x16'))(_0xb73c('0x17'));var utils=require(_0xb73c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb73c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c28a9,_0x10308a){_0x10308a=_0x10308a||0xcc;return function(_0xbbbb7a){if(_0xbbbb7a){return _0x1c28a9['sendStatus'](_0x10308a);}return _0x1c28a9[_0xb73c('0x1a')](_0x10308a)[_0xb73c('0x1b')]();};}function respondWithResult(_0x488d56,_0x1423fc){_0x1423fc=_0x1423fc||0xc8;return function(_0x169754){if(_0x169754){return _0x488d56[_0xb73c('0x1a')](_0x1423fc)['json'](_0x169754);}};}function respondWithFilteredResult(_0x11325e,_0x29345e){return function(_0xad3a8e){if(_0xad3a8e){var _0x9151b0=typeof _0x29345e[_0xb73c('0x1c')]===_0xb73c('0x1d')&&typeof _0x29345e[_0xb73c('0x1e')]==='undefined';var _0x2b45b2=_0xad3a8e[_0xb73c('0x1f')];var _0x1c4e77=_0x9151b0?0x0:_0x29345e[_0xb73c('0x1c')];var _0xa86b4a=_0x9151b0?_0xad3a8e[_0xb73c('0x1f')]:_0x29345e[_0xb73c('0x1c')]+_0x29345e[_0xb73c('0x1e')];var _0x4c6893;if(_0xa86b4a>=_0x2b45b2){_0xa86b4a=_0x2b45b2;_0x4c6893=0xc8;}else{_0x4c6893=0xce;}_0x11325e['status'](_0x4c6893);return _0x11325e[_0xb73c('0x20')](_0xb73c('0x21'),_0x1c4e77+'-'+_0xa86b4a+'/'+_0x2b45b2)[_0xb73c('0x22')](_0xad3a8e);}return null;};}function patchUpdates(_0x159ed8){return function(_0x10648d){try{jsonpatch[_0xb73c('0x23')](_0x10648d,_0x159ed8,!![]);}catch(_0x4a7bbf){return BPromise[_0xb73c('0x24')](_0x4a7bbf);}return _0x10648d[_0xb73c('0x25')]();};}function saveUpdates(_0x3d3f3c,_0x10a443){return function(_0x228046){if(_0x228046){return _0x228046['update'](_0x3d3f3c)[_0xb73c('0x26')](function(_0x2c2acc){return _0x2c2acc;});}return null;};}function removeEntity(_0xd21a15,_0xa4bd15){return function(_0x5c62f7){if(_0x5c62f7){return _0x5c62f7[_0xb73c('0x27')]()['then'](function(){_0xd21a15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6ff116,_0x443d32){return function(_0x568147){if(!_0x568147){_0x6ff116[_0xb73c('0x28')](0x194);}return _0x568147;};}function handleError(_0x32da48,_0x4cd540){_0x4cd540=_0x4cd540||0x1f4;return function(_0x552fd7){logger[_0xb73c('0x29')](_0x552fd7[_0xb73c('0x2a')]);if(_0x552fd7[_0xb73c('0x2b')]){delete _0x552fd7[_0xb73c('0x2b')];}_0x32da48[_0xb73c('0x1a')](_0x4cd540)[_0xb73c('0x2c')](_0x552fd7);};}exports[_0xb73c('0x2d')]=function(_0x563d4b,_0x5ee453){var _0x21ca1d={},_0x1fd725={},_0x40aee8={'count':0x0,'rows':[]};var _0x325c7e=_[_0xb73c('0x2e')](db[_0xb73c('0x2f')]['rawAttributes'],function(_0x3214a8){return{'name':_0x3214a8[_0xb73c('0x30')],'type':_0x3214a8[_0xb73c('0x31')]['key']};});_0x1fd725[_0xb73c('0x32')]=_[_0xb73c('0x2e')](_0x325c7e,_0xb73c('0x2b'));_0x1fd725['query']=_[_0xb73c('0x33')](_0x563d4b[_0xb73c('0x34')]);_0x1fd725['filters']=_[_0xb73c('0x35')](_0x1fd725['model'],_0x1fd725[_0xb73c('0x34')]);_0x21ca1d[_0xb73c('0x36')]=_[_0xb73c('0x35')](_0x1fd725['model'],qs[_0xb73c('0x37')](_0x563d4b['query']['fields']));_0x21ca1d['attributes']=_0x21ca1d[_0xb73c('0x36')][_0xb73c('0x38')]?_0x21ca1d[_0xb73c('0x36')]:_0x1fd725['model'];if(!_0x563d4b[_0xb73c('0x34')]['hasOwnProperty'](_0xb73c('0x39'))){_0x21ca1d[_0xb73c('0x1e')]=qs[_0xb73c('0x1e')](_0x563d4b[_0xb73c('0x34')][_0xb73c('0x1e')]);_0x21ca1d[_0xb73c('0x1c')]=qs[_0xb73c('0x1c')](_0x563d4b[_0xb73c('0x34')]['offset']);}_0x21ca1d['order']=qs['sort'](_0x563d4b[_0xb73c('0x34')]['sort']);_0x21ca1d[_0xb73c('0x3a')]=qs[_0xb73c('0x3b')](_[_0xb73c('0x3c')](_0x563d4b[_0xb73c('0x34')],_0x1fd725[_0xb73c('0x3b')]),_0x325c7e);if(_0x563d4b[_0xb73c('0x34')][_0xb73c('0x3d')]){_0x21ca1d[_0xb73c('0x3a')]=_['merge'](_0x21ca1d[_0xb73c('0x3a')],{'$or':_['map'](_0x325c7e,function(_0x29d895){if(_0x29d895[_0xb73c('0x31')]!==_0xb73c('0x3e')){var _0x4b3af9={};_0x4b3af9[_0x29d895[_0xb73c('0x2b')]]={'$like':'%'+_0x563d4b[_0xb73c('0x34')]['filter']+'%'};return _0x4b3af9;}})});}_0x21ca1d=_[_0xb73c('0x3f')]({},_0x21ca1d,_0x563d4b[_0xb73c('0x40')]);var _0x241fb5={'where':_0x21ca1d[_0xb73c('0x3a')]};return db['CmHopperBlack'][_0xb73c('0x1f')](_0x241fb5)[_0xb73c('0x26')](function(_0x267d6d){_0x40aee8['count']=_0x267d6d;if(_0x563d4b[_0xb73c('0x34')][_0xb73c('0x41')]){_0x21ca1d['include']=[{'all':!![]}];}return db[_0xb73c('0x2f')][_0xb73c('0x42')](_0x21ca1d);})[_0xb73c('0x26')](function(_0x51f0b5){_0x40aee8['rows']=_0x51f0b5;return _0x40aee8;})[_0xb73c('0x26')](respondWithFilteredResult(_0x5ee453,_0x21ca1d))[_0xb73c('0x43')](handleError(_0x5ee453,null));};exports[_0xb73c('0x44')]=function(_0x3cb9cd,_0x2c0fc6){var _0x799639={'raw':!![],'where':{'id':_0x3cb9cd[_0xb73c('0x45')]['id']}},_0x3b8058={};_0x3b8058[_0xb73c('0x32')]=_[_0xb73c('0x33')](db['CmHopperBlack'][_0xb73c('0x46')]);_0x3b8058[_0xb73c('0x34')]=_[_0xb73c('0x33')](_0x3cb9cd[_0xb73c('0x34')]);_0x3b8058[_0xb73c('0x3b')]=_['intersection'](_0x3b8058[_0xb73c('0x32')],_0x3b8058[_0xb73c('0x34')]);_0x799639[_0xb73c('0x36')]=_[_0xb73c('0x35')](_0x3b8058[_0xb73c('0x32')],qs['fields'](_0x3cb9cd['query'][_0xb73c('0x37')]));_0x799639[_0xb73c('0x36')]=_0x799639[_0xb73c('0x36')]['length']?_0x799639[_0xb73c('0x36')]:_0x3b8058[_0xb73c('0x32')];if(_0x3cb9cd[_0xb73c('0x34')][_0xb73c('0x41')]){_0x799639['include']=[{'all':!![]}];}_0x799639=_[_0xb73c('0x3f')]({},_0x799639,_0x3cb9cd[_0xb73c('0x40')]);return db['CmHopperBlack'][_0xb73c('0x47')](_0x799639)[_0xb73c('0x26')](handleEntityNotFound(_0x2c0fc6,null))['then'](respondWithResult(_0x2c0fc6,null))['catch'](handleError(_0x2c0fc6,null));};exports[_0xb73c('0x48')]=function(_0x4cfd01,_0x40ec4c){if(_0x4cfd01[_0xb73c('0x49')]['id']){delete _0x4cfd01['body']['id'];}return db['CmHopperBlack'][_0xb73c('0x47')]({'where':{'id':_0x4cfd01[_0xb73c('0x45')]['id']}})[_0xb73c('0x26')](handleEntityNotFound(_0x40ec4c,null))['then'](saveUpdates(_0x4cfd01[_0xb73c('0x49')],null))[_0xb73c('0x26')](respondWithResult(_0x40ec4c,null))[_0xb73c('0x43')](handleError(_0x40ec4c,null));};exports['destroy']=function(_0x27961f,_0x59c278){return db['CmHopperBlack']['find']({'where':{'id':_0x27961f[_0xb73c('0x45')]['id']}})[_0xb73c('0x26')](handleEntityNotFound(_0x59c278,null))[_0xb73c('0x26')](removeEntity(_0x59c278,null))['catch'](handleError(_0x59c278,null));};exports[_0xb73c('0x4a')]=function(_0x1ef64e,_0x4c9162){return db[_0xb73c('0x2f')][_0xb73c('0x4a')]()[_0xb73c('0x26')](respondWithResult(_0x4c9162,null))[_0xb73c('0x43')](handleError(_0x4c9162,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f97df6c..f747ab3 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 _0xa67e=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','cm_hopper_black','util','../../config/logger','moment','bluebird'];(function(_0x511b07,_0x5b4a5c){var _0x1e691f=function(_0x80e8ea){while(--_0x80e8ea){_0x511b07['push'](_0x511b07['shift']());}};_0x1e691f(++_0x5b4a5c);}(_0xa67e,0x104));var _0xea67=function(_0x5da4f5,_0x3444aa){_0x5da4f5=_0x5da4f5-0x0;var _0x8973db=_0xa67e[_0x5da4f5];return _0x8973db;};'use strict';var _=require('lodash');var util=require(_0xea67('0x0'));var logger=require(_0xea67('0x1'))('api');var moment=require(_0xea67('0x2'));var BPromise=require(_0xea67('0x3'));var rp=require(_0xea67('0x4'));var fs=require('fs');var path=require(_0xea67('0x5'));var rimraf=require(_0xea67('0x6'));var config=require(_0xea67('0x7'));var attributes=require(_0xea67('0x8'));module['exports']=function(_0x1592ab,_0x2ad948){return _0x1592ab[_0xea67('0x9')]('CmHopperBlack',attributes,{'tableName':_0xea67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21b5=['request-promise','path','../../config/environment','exports','define','CmHopperBlack','lodash','util','../../config/logger','moment','bluebird'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x21b5,0xc1));var _0x521b=function(_0x468689,_0x191f43){_0x468689=_0x468689-0x0;var _0xcb61d2=_0x21b5[_0x468689];return _0xcb61d2;};'use strict';var _=require(_0x521b('0x0'));var util=require(_0x521b('0x1'));var logger=require(_0x521b('0x2'))('api');var moment=require(_0x521b('0x3'));var BPromise=require(_0x521b('0x4'));var rp=require(_0x521b('0x5'));var fs=require('fs');var path=require(_0x521b('0x6'));var rimraf=require('rimraf');var config=require(_0x521b('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x521b('0x8')]=function(_0x4c8892,_0x55c224){return _0x4c8892[_0x521b('0x9')](_0x521b('0xa'),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 0402561..1676afb 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 _0xa747=['CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','body','limit','then','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x529ff7,_0x1a3d1d){var _0x173526=function(_0x3a058d){while(--_0x3a058d){_0x529ff7['push'](_0x529ff7['shift']());}};_0x173526(++_0x1a3d1d);}(_0xa747,0x10f));var _0x7a74=function(_0x1a451c,_0x33b9ad){_0x1a451c=_0x1a451c-0x0;var _0x3dc0d8=_0xa747[_0x1a451c];return _0x3dc0d8;};'use strict';var _=require(_0x7a74('0x0'));var util=require('util');var moment=require(_0x7a74('0x1'));var BPromise=require(_0x7a74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a74('0x3'));var db=require(_0x7a74('0x4'))['db'];var utils=require(_0x7a74('0x5'));var logger=require(_0x7a74('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a74('0x7')][_0x7a74('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c2d25,_0x2ca958,_0x14cb31){return new BPromise(function(_0x3cac77,_0x4b0158){return client[_0x7a74('0x9')](_0x1c2d25,_0x14cb31)['then'](function(_0x37e537){logger[_0x7a74('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x2ca958,_0x7a74('0xb'));logger[_0x7a74('0xc')](_0x7a74('0xd'),_0x2ca958,_0x7a74('0xb'),JSON[_0x7a74('0xe')](_0x37e537));if(_0x37e537[_0x7a74('0xf')]){if(_0x37e537['error']['code']===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x2ca958,_0x37e537[_0x7a74('0xf')][_0x7a74('0x10')]);return _0x4b0158(_0x37e537['error'][_0x7a74('0x10')]);}logger['error'](_0x7a74('0x11'),_0x2ca958,_0x37e537[_0x7a74('0xf')][_0x7a74('0x10')]);return _0x3cac77(_0x37e537[_0x7a74('0xf')][_0x7a74('0x10')]);}else{logger[_0x7a74('0xa')](_0x7a74('0x11'),_0x2ca958,'request\x20sent');_0x3cac77(_0x37e537[_0x7a74('0x12')][_0x7a74('0x10')]);}})[_0x7a74('0x13')](function(_0x2c1926){logger[_0x7a74('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x2ca958,_0x2c1926);_0x4b0158(_0x2c1926);});});}exports[_0x7a74('0x14')]=function(_0x4e0e78){var _0x4fca2a=this;return new Promise(function(_0x21a851,_0x34fc66){return db[_0x7a74('0x15')][_0x7a74('0x16')]({'raw':_0x4e0e78[_0x7a74('0x17')]?_0x4e0e78[_0x7a74('0x17')][_0x7a74('0x18')]===undefined?!![]:![]:!![],'where':_0x4e0e78[_0x7a74('0x17')]?_0x4e0e78[_0x7a74('0x17')][_0x7a74('0x19')]||null:null,'attributes':_0x4e0e78[_0x7a74('0x17')]?_0x4e0e78['options'][_0x7a74('0x1a')]||null:null,'limit':_0x4e0e78[_0x7a74('0x17')]?_0x4e0e78[_0x7a74('0x17')]['limit']||null:null,'include':_0x4e0e78[_0x7a74('0x17')]?_0x4e0e78['options'][_0x7a74('0x1b')]?_[_0x7a74('0x1c')](_0x4e0e78[_0x7a74('0x17')][_0x7a74('0x1b')],function(_0x32346b){return{'model':db[_0x32346b[_0x7a74('0x1d')]],'as':_0x32346b['as'],'attributes':_0x32346b[_0x7a74('0x1a')],'include':_0x32346b[_0x7a74('0x1b')]?_['map'](_0x32346b['include'],function(_0x54e4bd){return{'model':db[_0x54e4bd[_0x7a74('0x1d')]],'as':_0x54e4bd['as'],'attributes':_0x54e4bd[_0x7a74('0x1a')],'include':_0x54e4bd[_0x7a74('0x1b')]?_[_0x7a74('0x1c')](_0x54e4bd[_0x7a74('0x1b')],function(_0x26560b){return{'model':db[_0x26560b[_0x7a74('0x1d')]],'as':_0x26560b['as'],'attributes':_0x26560b[_0x7a74('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e15c9){logger['info'](_0x7a74('0x14'),_0x4e0e78);logger['debug'](_0x7a74('0x14'),_0x4e0e78,JSON[_0x7a74('0xe')](_0x4e15c9));_0x21a851(_0x4e15c9);})[_0x7a74('0x13')](function(_0x45ea35){logger[_0x7a74('0xf')]('GetCmHopperBlack',_0x45ea35['message'],_0x4e0e78);_0x34fc66(_0x4fca2a[_0x7a74('0xf')](0x1f4,_0x45ea35[_0x7a74('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x1389f3){var _0x66671=this;return new Promise(function(_0xde7eea,_0x4f9289){return db['CmHopperBlack']['update'](_0x1389f3[_0x7a74('0x1e')],{'raw':_0x1389f3[_0x7a74('0x17')]?_0x1389f3['options'][_0x7a74('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1389f3[_0x7a74('0x17')]?_0x1389f3[_0x7a74('0x17')]['where']||null:null,'attributes':_0x1389f3['options']?_0x1389f3[_0x7a74('0x17')][_0x7a74('0x1a')]||null:null,'limit':_0x1389f3['options']?_0x1389f3[_0x7a74('0x17')][_0x7a74('0x1f')]||null:null})[_0x7a74('0x20')](function(_0x116512){logger[_0x7a74('0xa')](_0x7a74('0x21'),_0x1389f3);logger[_0x7a74('0xc')]('UpdateCmHopperBlack',_0x1389f3,JSON['stringify'](_0x116512));_0xde7eea(_0x116512);})[_0x7a74('0x13')](function(_0x556658){logger['error']('UpdateCmHopperBlack',_0x556658[_0x7a74('0x10')],_0x1389f3);_0x4f9289(_0x66671[_0x7a74('0xf')](0x1f4,_0x556658[_0x7a74('0x10')]));});});};exports[_0x7a74('0x22')]=function(_0x2fe8c6){var _0x5ede6e=this;return new Promise(function(_0x5210ac,_0xac18d3){return db['CmHopperBlack'][_0x7a74('0x23')]({'where':_0x2fe8c6['options']?_0x2fe8c6[_0x7a74('0x17')][_0x7a74('0x19')]||null:null})[_0x7a74('0x20')](function(_0x1c9ad6){logger['info']('DestroyCmHopperBlack',_0x2fe8c6);logger['debug'](_0x7a74('0x22'),_0x2fe8c6,JSON[_0x7a74('0xe')](_0x1c9ad6));_0x5210ac(_0x1c9ad6);})[_0x7a74('0x13')](function(_0x16f987){logger[_0x7a74('0xf')](_0x7a74('0x22'),_0x16f987['message'],_0x2fe8c6);_0xac18d3(_0x5ede6e['error'](0x1f4,_0x16f987[_0x7a74('0x10')]));});});}; \ No newline at end of file +var _0x7af5=['where','attributes','limit','include','map','model','then','UpdateCmHopperBlack','update','destroy','DestroyCmHopperBlack','lodash','util','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7af5,0xd7));var _0x57af=function(_0x5c5f9c,_0x4d252f){_0x5c5f9c=_0x5c5f9c-0x0;var _0x5ed888=_0x7af5[_0x5c5f9c];return _0x5ed888;};'use strict';var _=require(_0x57af('0x0'));var util=require(_0x57af('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x57af('0x2'));var fs=require('fs');var Redis=require(_0x57af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x57af('0x4'));var logger=require('../../config/logger')(_0x57af('0x5'));var config=require('../../config/environment');var jayson=require(_0x57af('0x6'));var client=jayson[_0x57af('0x7')][_0x57af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x242836,_0x253f67,_0x117a15){return new BPromise(function(_0x7d1bfd,_0xa0ae7e){return client['request'](_0x242836,_0x117a15)['then'](function(_0x402450){logger[_0x57af('0x9')](_0x57af('0xa'),_0x253f67,_0x57af('0xb'));logger[_0x57af('0xc')](_0x57af('0xd'),_0x253f67,_0x57af('0xb'),JSON[_0x57af('0xe')](_0x402450));if(_0x402450['error']){if(_0x402450[_0x57af('0xf')][_0x57af('0x10')]===0x1f4){logger[_0x57af('0xf')](_0x57af('0xa'),_0x253f67,_0x402450[_0x57af('0xf')]['message']);return _0xa0ae7e(_0x402450['error'][_0x57af('0x11')]);}logger[_0x57af('0xf')](_0x57af('0xa'),_0x253f67,_0x402450[_0x57af('0xf')][_0x57af('0x11')]);return _0x7d1bfd(_0x402450['error'][_0x57af('0x11')]);}else{logger[_0x57af('0x9')](_0x57af('0xa'),_0x253f67,_0x57af('0xb'));_0x7d1bfd(_0x402450[_0x57af('0x12')][_0x57af('0x11')]);}})[_0x57af('0x13')](function(_0x4b31bf){logger[_0x57af('0xf')](_0x57af('0xa'),_0x253f67,_0x4b31bf);_0xa0ae7e(_0x4b31bf);});});}exports[_0x57af('0x14')]=function(_0x3aab16){var _0x63b51d=this;return new Promise(function(_0x10b74f,_0x4cfa85){return db[_0x57af('0x15')]['findAll']({'raw':_0x3aab16[_0x57af('0x16')]?_0x3aab16['options']['raw']===undefined?!![]:![]:!![],'where':_0x3aab16[_0x57af('0x16')]?_0x3aab16['options'][_0x57af('0x17')]||null:null,'attributes':_0x3aab16[_0x57af('0x16')]?_0x3aab16[_0x57af('0x16')][_0x57af('0x18')]||null:null,'limit':_0x3aab16[_0x57af('0x16')]?_0x3aab16[_0x57af('0x16')][_0x57af('0x19')]||null:null,'include':_0x3aab16[_0x57af('0x16')]?_0x3aab16['options'][_0x57af('0x1a')]?_[_0x57af('0x1b')](_0x3aab16[_0x57af('0x16')][_0x57af('0x1a')],function(_0xf0065f){return{'model':db[_0xf0065f[_0x57af('0x1c')]],'as':_0xf0065f['as'],'attributes':_0xf0065f[_0x57af('0x18')],'include':_0xf0065f[_0x57af('0x1a')]?_['map'](_0xf0065f[_0x57af('0x1a')],function(_0x190e34){return{'model':db[_0x190e34[_0x57af('0x1c')]],'as':_0x190e34['as'],'attributes':_0x190e34[_0x57af('0x18')],'include':_0x190e34['include']?_[_0x57af('0x1b')](_0x190e34[_0x57af('0x1a')],function(_0x49db25){return{'model':db[_0x49db25[_0x57af('0x1c')]],'as':_0x49db25['as'],'attributes':_0x49db25[_0x57af('0x18')]};}):[]};}):[]};}):[]:[]})[_0x57af('0x1d')](function(_0x609ef9){logger[_0x57af('0x9')]('GetCmHopperBlack',_0x3aab16);logger['debug'](_0x57af('0x14'),_0x3aab16,JSON['stringify'](_0x609ef9));_0x10b74f(_0x609ef9);})[_0x57af('0x13')](function(_0x29e71d){logger[_0x57af('0xf')](_0x57af('0x14'),_0x29e71d[_0x57af('0x11')],_0x3aab16);_0x4cfa85(_0x63b51d[_0x57af('0xf')](0x1f4,_0x29e71d['message']));});});};exports[_0x57af('0x1e')]=function(_0x25a4be){var _0x48e8b6=this;return new Promise(function(_0x1c4df7,_0xf7ac7d){return db[_0x57af('0x15')][_0x57af('0x1f')](_0x25a4be['body'],{'raw':_0x25a4be[_0x57af('0x16')]?_0x25a4be['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25a4be[_0x57af('0x16')]?_0x25a4be[_0x57af('0x16')][_0x57af('0x17')]||null:null,'attributes':_0x25a4be[_0x57af('0x16')]?_0x25a4be[_0x57af('0x16')][_0x57af('0x18')]||null:null,'limit':_0x25a4be[_0x57af('0x16')]?_0x25a4be['options'][_0x57af('0x19')]||null:null})[_0x57af('0x1d')](function(_0x2a673e){logger[_0x57af('0x9')](_0x57af('0x1e'),_0x25a4be);logger['debug']('UpdateCmHopperBlack',_0x25a4be,JSON['stringify'](_0x2a673e));_0x1c4df7(_0x2a673e);})[_0x57af('0x13')](function(_0x4ee70b){logger[_0x57af('0xf')](_0x57af('0x1e'),_0x4ee70b[_0x57af('0x11')],_0x25a4be);_0xf7ac7d(_0x48e8b6[_0x57af('0xf')](0x1f4,_0x4ee70b[_0x57af('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0xc56e55){var _0x4c8744=this;return new Promise(function(_0xfa96d,_0x531a27){return db[_0x57af('0x15')][_0x57af('0x20')]({'where':_0xc56e55[_0x57af('0x16')]?_0xc56e55['options'][_0x57af('0x17')]||null:null})[_0x57af('0x1d')](function(_0x5938c6){logger[_0x57af('0x9')](_0x57af('0x21'),_0xc56e55);logger[_0x57af('0xc')]('DestroyCmHopperBlack',_0xc56e55,JSON[_0x57af('0xe')](_0x5938c6));_0xfa96d(_0x5938c6);})[_0x57af('0x13')](function(_0x34aae7){logger[_0x57af('0xf')](_0x57af('0x21'),_0x34aae7[_0x57af('0x11')],_0xc56e55);_0x531a27(_0x4c8744[_0x57af('0xf')](0x1f4,_0x34aae7['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 9a0e3f5..7a8dcd3 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 _0x82c4=['get','/describe','describe','show','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated'];(function(_0x572aa0,_0x4b9e53){var _0x217068=function(_0x16de5e){while(--_0x16de5e){_0x572aa0['push'](_0x572aa0['shift']());}};_0x217068(++_0x4b9e53);}(_0x82c4,0x1ca));var _0x482c=function(_0x17598a,_0x522cc6){_0x17598a=_0x17598a-0x0;var _0x4cd046=_0x82c4[_0x17598a];return _0x4cd046;};'use strict';var multer=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var path=require(_0x482c('0x2'));var timeout=require(_0x482c('0x3'));var express=require(_0x482c('0x4'));var router=express[_0x482c('0x5')]();var fs_extra=require(_0x482c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x482c('0x7'));var config=require('../../config/environment');var controller=require(_0x482c('0x8'));router['get']('/',auth[_0x482c('0x9')](),controller['index']);router[_0x482c('0xa')](_0x482c('0xb'),auth[_0x482c('0x9')](),controller[_0x482c('0xc')]);router[_0x482c('0xa')]('/:id',auth[_0x482c('0x9')](),controller[_0x482c('0xd')]);router[_0x482c('0xe')](_0x482c('0xf'),auth[_0x482c('0x9')](),controller[_0x482c('0x10')]);router['delete'](_0x482c('0xf'),auth[_0x482c('0x9')](),controller[_0x482c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x10753e,_0x3dba4b){var _0x108fa1=function(_0x3c4909){while(--_0x3c4909){_0x10753e['push'](_0x10753e['shift']());}};_0x108fa1(++_0x3dba4b);}(_0x2a07,0x74));var _0x72a0=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0x2a07[_0x553150];return _0x18193d;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller['update']);router[_0x72a0('0x11')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x12')]);module[_0x72a0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e30712d..56d0376 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 _0xff30=['diff','seconds','BOOLEAN','moment','STRING','DATE','INTEGER','endtime','setDataValue','followuptime'];(function(_0x2d1f3d,_0x25a1dd){var _0x51b0e9=function(_0x2e167b){while(--_0x2e167b){_0x2d1f3d['push'](_0x2d1f3d['shift']());}};_0x51b0e9(++_0x25a1dd);}(_0xff30,0xd5));var _0x0ff3=function(_0x2851f1,_0x12288f){_0x2851f1=_0x2851f1-0x0;var _0x13f884=_0xff30[_0x2851f1];return _0x13f884;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0ff3('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0ff3('0x1')]},'scheduledat':{'type':Sequelize[_0x0ff3('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0ff3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0ff3('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0ff3('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0ff3('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x0ff3('0x1')]},'originatecalleridname':{'type':Sequelize[_0x0ff3('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0ff3('0x1')]},'starttime':{'type':Sequelize[_0x0ff3('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x0ff3('0x2')]},'droptime':{'type':Sequelize[_0x0ff3('0x2')]},'endtime':{'type':Sequelize[_0x0ff3('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0ff3('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0ff3('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0ff3('0x1')]},'campaign':{'type':Sequelize[_0x0ff3('0x1')]},'campaigntype':{'type':Sequelize[_0x0ff3('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x0ff3('0x1')]},'disposition':{'type':Sequelize[_0x0ff3('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0ff3('0x1')]},'dispositionat':{'type':Sequelize[_0x0ff3('0x2')],'set':function(_0x343003){var _0x14f0be=this['getDataValue'](_0x0ff3('0x4'));if(_0x14f0be&&_0x343003){this[_0x0ff3('0x5')](_0x0ff3('0x6'),moment(_0x343003)[_0x0ff3('0x7')](moment(_0x14f0be),_0x0ff3('0x8')));}}},'amd':{'type':Sequelize[_0x0ff3('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0ff3('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0ff3('0x2')]},'callback':{'type':Sequelize[_0x0ff3('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x0ff3('0x1')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0ff3('0x2')]},'recallme':{'type':Sequelize[_0x0ff3('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0ff3('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0x0ff3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0ff3('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0ff3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcdb1=['sequelize','moment','exports','INTEGER','DATE','STRING','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN'];(function(_0x2449f5,_0x2987a7){var _0x463941=function(_0x8ae0d7){while(--_0x8ae0d7){_0x2449f5['push'](_0x2449f5['shift']());}};_0x463941(++_0x2987a7);}(_0xcdb1,0x12c));var _0x1cdb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcdb1[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1cdb('0x0'));var moment=require(_0x1cdb('0x1'));module[_0x1cdb('0x2')]={'state':{'type':Sequelize[_0x1cdb('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1cdb('0x4')]},'countbusyretry':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1cdb('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x1cdb('0x5')]},'calleridnum':{'type':Sequelize[_0x1cdb('0x5')]},'calleridname':{'type':Sequelize[_0x1cdb('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1cdb('0x4')]},'answertime':{'type':Sequelize[_0x1cdb('0x4')]},'droptime':{'type':Sequelize[_0x1cdb('0x4')]},'endtime':{'type':Sequelize[_0x1cdb('0x4')]},'ringtime':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1cdb('0x5')]},'campaigntype':{'type':Sequelize[_0x1cdb('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1cdb('0x5')]},'disposition':{'type':Sequelize[_0x1cdb('0x5')]},'secondDisposition':{'type':Sequelize[_0x1cdb('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x1cdb('0x4')],'set':function(_0x194b40){var _0x15ec63=this['getDataValue'](_0x1cdb('0x6'));if(_0x15ec63&&_0x194b40){this[_0x1cdb('0x7')](_0x1cdb('0x8'),moment(_0x194b40)[_0x1cdb('0x9')](moment(_0x15ec63),_0x1cdb('0xa')));}}},'amd':{'type':Sequelize[_0x1cdb('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1cdb('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1cdb('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x1cdb('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x1cdb('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1cdb('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1cdb('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1cdb('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1cdb('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1cdb('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 ce3bb24..0fc57ea 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 _0x7c09=['sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','noAnswerContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x59aa9c,_0x497c12){var _0x390c6c=function(_0x28144b){while(--_0x28144b){_0x59aa9c['push'](_0x59aa9c['shift']());}};_0x390c6c(++_0x497c12);}(_0x7c09,0x102));var _0x97c0=function(_0x49836f,_0xe56f3c){_0x49836f=_0x49836f-0x0;var _0x3e0202=_0x7c09[_0x49836f];return _0x3e0202;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];function respondWithStatusCode(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xcc;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0x18')](_0x9ca3c1);}return _0x39a3b4[_0x97c0('0x19')](_0x9ca3c1)[_0x97c0('0x1a')]();};}function respondWithResult(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0xc8;return function(_0x15b336){if(_0x15b336){return _0x514782[_0x97c0('0x19')](_0x3f2fc2)['json'](_0x15b336);}};}function respondWithFilteredResult(_0x42027d,_0x9ca6a8){return function(_0x379951){if(_0x379951){var _0x21e5f7=typeof _0x9ca6a8[_0x97c0('0x1b')]===_0x97c0('0x1c')&&typeof _0x9ca6a8['limit']===_0x97c0('0x1c');var _0x3ae7c4=_0x379951['count'];var _0x560ac0=_0x21e5f7?0x0:_0x9ca6a8[_0x97c0('0x1b')];var _0x179d43=_0x21e5f7?_0x379951[_0x97c0('0x1d')]:_0x9ca6a8[_0x97c0('0x1b')]+_0x9ca6a8[_0x97c0('0x1e')];var _0x4fed42;if(_0x179d43>=_0x3ae7c4){_0x179d43=_0x3ae7c4;_0x4fed42=0xc8;}else{_0x4fed42=0xce;}_0x42027d[_0x97c0('0x19')](_0x4fed42);return _0x42027d[_0x97c0('0x1f')](_0x97c0('0x20'),_0x560ac0+'-'+_0x179d43+'/'+_0x3ae7c4)['json'](_0x379951);}return null;};}function patchUpdates(_0x554122){return function(_0x2b74a2){try{jsonpatch[_0x97c0('0x21')](_0x2b74a2,_0x554122,!![]);}catch(_0x169f19){return BPromise['reject'](_0x169f19);}return _0x2b74a2[_0x97c0('0x22')]();};}function saveUpdates(_0x20bc4c,_0x31ffb7){return function(_0x272314){if(_0x272314){return _0x272314[_0x97c0('0x23')](_0x20bc4c)[_0x97c0('0x24')](function(_0x9dff60){return _0x9dff60;});}return null;};}function removeEntity(_0x5ac457,_0x60ab00){return function(_0x29b3aa){if(_0x29b3aa){return _0x29b3aa[_0x97c0('0x25')]()[_0x97c0('0x24')](function(){_0x5ac457['status'](0xcc)[_0x97c0('0x1a')]();});}};}function handleEntityNotFound(_0x14cada,_0x52a429){return function(_0x2ec9d6){if(!_0x2ec9d6){_0x14cada[_0x97c0('0x18')](0x194);}return _0x2ec9d6;};}function handleError(_0x447316,_0x4af5a5){_0x4af5a5=_0x4af5a5||0x1f4;return function(_0x4f11ba){logger['error'](_0x4f11ba[_0x97c0('0x26')]);if(_0x4f11ba[_0x97c0('0x27')]){delete _0x4f11ba[_0x97c0('0x27')];}_0x447316[_0x97c0('0x19')](_0x4af5a5)[_0x97c0('0x28')](_0x4f11ba);};}exports[_0x97c0('0x29')]=function(_0x4a3645,_0x10e47e){var _0x1c183f={},_0x325090={},_0x4ad645={'count':0x0,'rows':[]};var _0x14617c=_[_0x97c0('0x2a')](db[_0x97c0('0x2b')][_0x97c0('0x2c')],function(_0x2a7b2b){return{'name':_0x2a7b2b['fieldName'],'type':_0x2a7b2b['type'][_0x97c0('0x2d')]};});_0x325090[_0x97c0('0x2e')]=_[_0x97c0('0x2a')](_0x14617c,'name');_0x325090[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x4a3645['query']);_0x325090[_0x97c0('0x31')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],_0x325090[_0x97c0('0x2f')]);_0x1c183f[_0x97c0('0x33')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x1c183f[_0x97c0('0x33')]=_0x1c183f[_0x97c0('0x33')][_0x97c0('0x35')]?_0x1c183f[_0x97c0('0x33')]:_0x325090[_0x97c0('0x2e')];if(!_0x4a3645['query'][_0x97c0('0x36')](_0x97c0('0x37'))){_0x1c183f[_0x97c0('0x1e')]=qs[_0x97c0('0x1e')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x1e')]);_0x1c183f[_0x97c0('0x1b')]=qs[_0x97c0('0x1b')](_0x4a3645['query'][_0x97c0('0x1b')]);}_0x1c183f['order']=qs[_0x97c0('0x38')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x38')]);_0x1c183f[_0x97c0('0x39')]=qs[_0x97c0('0x31')](_[_0x97c0('0x3a')](_0x4a3645[_0x97c0('0x2f')],_0x325090[_0x97c0('0x31')]),_0x14617c);if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3b')]){_0x1c183f[_0x97c0('0x39')]=_['merge'](_0x1c183f[_0x97c0('0x39')],{'$or':_[_0x97c0('0x2a')](_0x14617c,function(_0x4d47b1){if(_0x4d47b1[_0x97c0('0x3c')]!==_0x97c0('0x3d')){var _0x2aeffc={};_0x2aeffc[_0x4d47b1[_0x97c0('0x27')]]={'$like':'%'+_0x4a3645['query'][_0x97c0('0x3b')]+'%'};return _0x2aeffc;}})});}_0x1c183f=_['merge']({},_0x1c183f,_0x4a3645[_0x97c0('0x3e')]);var _0x64cfcd={'where':_0x1c183f['where']};return db[_0x97c0('0x2b')][_0x97c0('0x1d')](_0x64cfcd)[_0x97c0('0x24')](function(_0xb13649){_0x4ad645[_0x97c0('0x1d')]=_0xb13649;if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x1c183f[_0x97c0('0x40')]=[{'all':!![]}];}return db[_0x97c0('0x2b')][_0x97c0('0x41')](_0x1c183f);})[_0x97c0('0x24')](function(_0x2cca4c){_0x4ad645[_0x97c0('0x42')]=_0x2cca4c;return _0x4ad645;})['then'](respondWithFilteredResult(_0x10e47e,_0x1c183f))[_0x97c0('0x43')](handleError(_0x10e47e,null));};exports[_0x97c0('0x44')]=function(_0x1dc6ff,_0x142421){var _0x312fce={'raw':!![],'where':{'id':_0x1dc6ff[_0x97c0('0x45')]['id']}},_0x375ebc={};_0x375ebc['model']=_['keys'](db[_0x97c0('0x2b')][_0x97c0('0x2c')]);_0x375ebc[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x1dc6ff[_0x97c0('0x2f')]);_0x375ebc['filters']=_['intersection'](_0x375ebc['model'],_0x375ebc[_0x97c0('0x2f')]);_0x312fce['attributes']=_['intersection'](_0x375ebc[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x312fce[_0x97c0('0x33')]=_0x312fce['attributes'][_0x97c0('0x35')]?_0x312fce[_0x97c0('0x33')]:_0x375ebc[_0x97c0('0x2e')];if(_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x312fce[_0x97c0('0x40')]=[{'all':!![]}];}_0x312fce=_[_0x97c0('0x46')]({},_0x312fce,_0x1dc6ff[_0x97c0('0x3e')]);return db[_0x97c0('0x2b')][_0x97c0('0x47')](_0x312fce)['then'](handleEntityNotFound(_0x142421,null))[_0x97c0('0x24')](respondWithResult(_0x142421,null))[_0x97c0('0x43')](handleError(_0x142421,null));};exports[_0x97c0('0x48')]=function(_0x276c98,_0x4ff0a5){return db['CmHopperFinal'][_0x97c0('0x48')]()[_0x97c0('0x24')](respondWithResult(_0x4ff0a5,null))[_0x97c0('0x43')](handleError(_0x4ff0a5,null));};exports['update']=function(_0x3e09d5,_0xac56ac){if(_0x3e09d5[_0x97c0('0x49')][_0x97c0('0x4a')]){delete _0x3e09d5[_0x97c0('0x49')]['uniqueid'];}return db[_0x97c0('0x2b')][_0x97c0('0x47')]({'where':{'uniqueid':_0x3e09d5[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0xac56ac,null))['then'](saveUpdates(_0x3e09d5[_0x97c0('0x49')],null))['then'](respondWithResult(_0xac56ac,null))['catch'](handleError(_0xac56ac,null));};exports[_0x97c0('0x4b')]=function(_0x20e2a5,_0x23c7ad,_0x53a255){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x20e2a5[_0x97c0('0x45')]['id']},'attributes':[[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x4f')))),'noSuchContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x50')))),'noAnswerContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x53')))),_0x97c0('0x54')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x55')))),_0x97c0('0x56')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x59')))),'reCallContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x97c0('0x5a')]]})[_0x97c0('0x24')](handleEntityNotFound(_0x23c7ad,null))[_0x97c0('0x24')](respondWithResult(_0x23c7ad,null))[_0x97c0('0x43')](handleError(_0x23c7ad,null));};exports[_0x97c0('0x5b')]=function(_0x2bb5d3,_0x52643e,_0x3349df){return db[_0x97c0('0x2b')][_0x97c0('0x41')]({'raw':![],'where':{'CampaignId':_0x2bb5d3[_0x97c0('0x45')]['id']},'attributes':[[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x200,\x201,\x20null'))),_0x97c0('0x5c')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x50')))),_0x97c0('0x5d')],[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x97c0('0x54')],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x55')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x59')))),_0x97c0('0x5e')],[db[_0x97c0('0x4c')]['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x5f')))),_0x97c0('0x5a')]]})['then'](handleEntityNotFound(_0x52643e,null))[_0x97c0('0x24')](respondWithResult(_0x52643e,null))[_0x97c0('0x43')](handleError(_0x52643e,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x4116c9,_0x30ffa8,_0x1cfe22){return db['VoiceQueue'][_0x97c0('0x47')]({'where':{'id':_0x4116c9[_0x97c0('0x45')]['id']}})[_0x97c0('0x24')](handleEntityNotFound(_0x30ffa8,null))[_0x97c0('0x24')](function(_0x4d40cd){var _0x4ee6a2;if(_0x4d40cd){_0x4ee6a2=squel['insert']()[_0x97c0('0x60')](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),_0x97c0('0x66'),_0x97c0('0x67'),'createdAt','updatedAt'],squel[_0x97c0('0x68')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x64'))[_0x97c0('0x69')](_0x97c0('0x6b'),'ContactId')['field'](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x6d'),'VoiceQueueId')[_0x97c0('0x69')]('NOW()',_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x74'),_0x4116c9['body']['state'][_0x97c0('0x73')]())[_0x97c0('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x97c0('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x97c0('0x68')]()[_0x97c0('0x69')]('phone')[_0x97c0('0x70')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]()))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9['params']['id'][_0x97c0('0x73')]())['where']('state\x20=\x204'))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')]['query'](_0x4ee6a2);}return[];})[_0x97c0('0x24')](respondWithResult(_0x30ffa8,null))[_0x97c0('0x43')](handleError(_0x30ffa8,null));};exports[_0x97c0('0x78')]=function(_0x5bb9de,_0x388ba1,_0x550a68){return db[_0x97c0('0x79')][_0x97c0('0x47')]({'where':{'id':_0x5bb9de[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x388ba1,null))[_0x97c0('0x24')](function(_0x44f6bc){var _0x37cdb3;if(_0x44f6bc){_0x37cdb3=squel[_0x97c0('0x7a')]()['into'](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),'ListId',_0x97c0('0x7b'),_0x97c0('0x6e'),'updatedAt'],squel['select']()[_0x97c0('0x69')](_0x97c0('0x7c'),_0x97c0('0x63'))['field']('NOW()',_0x97c0('0x64'))['field'](_0x97c0('0x6b'),_0x97c0('0x65'))[_0x97c0('0x69')](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x7d'),'CampaignId')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x74'),_0x5bb9de['body'][_0x97c0('0x7f')][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x80'))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x63'))[_0x97c0('0x70')](_0x97c0('0x61'))[_0x97c0('0x39')]('CampaignId\x20=\x20?',_0x5bb9de[_0x97c0('0x45')]['id']['toString']()))[_0x97c0('0x39')](_0x97c0('0x75'),squel[_0x97c0('0x68')]()['field'](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de['params']['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x81')))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')][_0x97c0('0x2f')](_0x37cdb3);}return[];})[_0x97c0('0x24')](respondWithResult(_0x388ba1,null))[_0x97c0('0x43')](handleError(_0x388ba1,null));};exports[_0x97c0('0x82')]=function(_0x3ebd11,_0x44b374,_0x493e62){return db[_0x97c0('0x83')][_0x97c0('0x84')]({'where':{'VoiceQueueId':_0x3ebd11[_0x97c0('0x49')]['VoiceQueueId'],'CampaignId':_0x3ebd11['body'][_0x97c0('0x7b')],'ContactId':_0x3ebd11[_0x97c0('0x49')][_0x97c0('0x65')]}})[_0x97c0('0x24')](handleEntityNotFound(_0x44b374,null))[_0x97c0('0x24')](function(_0x120d78){if(_0x120d78){return _0x120d78;}return null;})[_0x97c0('0x24')](respondWithResult(_0x44b374,null))[_0x97c0('0x43')](handleError(_0x44b374,null));}; \ No newline at end of file +var _0x7c09=['sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','noAnswerContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1ec612,_0x4ed134){var _0x319543=function(_0x551a83){while(--_0x551a83){_0x1ec612['push'](_0x1ec612['shift']());}};_0x319543(++_0x4ed134);}(_0x7c09,0x102));var _0x97c0=function(_0x313a89,_0x24416c){_0x313a89=_0x313a89-0x0;var _0x446c0d=_0x7c09[_0x313a89];return _0x446c0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];function respondWithStatusCode(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xcc;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0x18')](_0x9ca3c1);}return _0x39a3b4[_0x97c0('0x19')](_0x9ca3c1)[_0x97c0('0x1a')]();};}function respondWithResult(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0xc8;return function(_0x15b336){if(_0x15b336){return _0x514782[_0x97c0('0x19')](_0x3f2fc2)['json'](_0x15b336);}};}function respondWithFilteredResult(_0x42027d,_0x9ca6a8){return function(_0x379951){if(_0x379951){var _0x21e5f7=typeof _0x9ca6a8[_0x97c0('0x1b')]===_0x97c0('0x1c')&&typeof _0x9ca6a8['limit']===_0x97c0('0x1c');var _0x3ae7c4=_0x379951['count'];var _0x560ac0=_0x21e5f7?0x0:_0x9ca6a8[_0x97c0('0x1b')];var _0x179d43=_0x21e5f7?_0x379951[_0x97c0('0x1d')]:_0x9ca6a8[_0x97c0('0x1b')]+_0x9ca6a8[_0x97c0('0x1e')];var _0x4fed42;if(_0x179d43>=_0x3ae7c4){_0x179d43=_0x3ae7c4;_0x4fed42=0xc8;}else{_0x4fed42=0xce;}_0x42027d[_0x97c0('0x19')](_0x4fed42);return _0x42027d[_0x97c0('0x1f')](_0x97c0('0x20'),_0x560ac0+'-'+_0x179d43+'/'+_0x3ae7c4)['json'](_0x379951);}return null;};}function patchUpdates(_0x554122){return function(_0x2b74a2){try{jsonpatch[_0x97c0('0x21')](_0x2b74a2,_0x554122,!![]);}catch(_0x169f19){return BPromise['reject'](_0x169f19);}return _0x2b74a2[_0x97c0('0x22')]();};}function saveUpdates(_0x20bc4c,_0x31ffb7){return function(_0x272314){if(_0x272314){return _0x272314[_0x97c0('0x23')](_0x20bc4c)[_0x97c0('0x24')](function(_0x9dff60){return _0x9dff60;});}return null;};}function removeEntity(_0x5ac457,_0x60ab00){return function(_0x29b3aa){if(_0x29b3aa){return _0x29b3aa[_0x97c0('0x25')]()[_0x97c0('0x24')](function(){_0x5ac457['status'](0xcc)[_0x97c0('0x1a')]();});}};}function handleEntityNotFound(_0x14cada,_0x52a429){return function(_0x2ec9d6){if(!_0x2ec9d6){_0x14cada[_0x97c0('0x18')](0x194);}return _0x2ec9d6;};}function handleError(_0x447316,_0x4af5a5){_0x4af5a5=_0x4af5a5||0x1f4;return function(_0x4f11ba){logger['error'](_0x4f11ba[_0x97c0('0x26')]);if(_0x4f11ba[_0x97c0('0x27')]){delete _0x4f11ba[_0x97c0('0x27')];}_0x447316[_0x97c0('0x19')](_0x4af5a5)[_0x97c0('0x28')](_0x4f11ba);};}exports[_0x97c0('0x29')]=function(_0x4a3645,_0x10e47e){var _0x1c183f={},_0x325090={},_0x4ad645={'count':0x0,'rows':[]};var _0x14617c=_[_0x97c0('0x2a')](db[_0x97c0('0x2b')][_0x97c0('0x2c')],function(_0x2a7b2b){return{'name':_0x2a7b2b['fieldName'],'type':_0x2a7b2b['type'][_0x97c0('0x2d')]};});_0x325090[_0x97c0('0x2e')]=_[_0x97c0('0x2a')](_0x14617c,'name');_0x325090[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x4a3645['query']);_0x325090[_0x97c0('0x31')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],_0x325090[_0x97c0('0x2f')]);_0x1c183f[_0x97c0('0x33')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x1c183f[_0x97c0('0x33')]=_0x1c183f[_0x97c0('0x33')][_0x97c0('0x35')]?_0x1c183f[_0x97c0('0x33')]:_0x325090[_0x97c0('0x2e')];if(!_0x4a3645['query'][_0x97c0('0x36')](_0x97c0('0x37'))){_0x1c183f[_0x97c0('0x1e')]=qs[_0x97c0('0x1e')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x1e')]);_0x1c183f[_0x97c0('0x1b')]=qs[_0x97c0('0x1b')](_0x4a3645['query'][_0x97c0('0x1b')]);}_0x1c183f['order']=qs[_0x97c0('0x38')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x38')]);_0x1c183f[_0x97c0('0x39')]=qs[_0x97c0('0x31')](_[_0x97c0('0x3a')](_0x4a3645[_0x97c0('0x2f')],_0x325090[_0x97c0('0x31')]),_0x14617c);if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3b')]){_0x1c183f[_0x97c0('0x39')]=_['merge'](_0x1c183f[_0x97c0('0x39')],{'$or':_[_0x97c0('0x2a')](_0x14617c,function(_0x4d47b1){if(_0x4d47b1[_0x97c0('0x3c')]!==_0x97c0('0x3d')){var _0x2aeffc={};_0x2aeffc[_0x4d47b1[_0x97c0('0x27')]]={'$like':'%'+_0x4a3645['query'][_0x97c0('0x3b')]+'%'};return _0x2aeffc;}})});}_0x1c183f=_['merge']({},_0x1c183f,_0x4a3645[_0x97c0('0x3e')]);var _0x64cfcd={'where':_0x1c183f['where']};return db[_0x97c0('0x2b')][_0x97c0('0x1d')](_0x64cfcd)[_0x97c0('0x24')](function(_0xb13649){_0x4ad645[_0x97c0('0x1d')]=_0xb13649;if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x1c183f[_0x97c0('0x40')]=[{'all':!![]}];}return db[_0x97c0('0x2b')][_0x97c0('0x41')](_0x1c183f);})[_0x97c0('0x24')](function(_0x2cca4c){_0x4ad645[_0x97c0('0x42')]=_0x2cca4c;return _0x4ad645;})['then'](respondWithFilteredResult(_0x10e47e,_0x1c183f))[_0x97c0('0x43')](handleError(_0x10e47e,null));};exports[_0x97c0('0x44')]=function(_0x1dc6ff,_0x142421){var _0x312fce={'raw':!![],'where':{'id':_0x1dc6ff[_0x97c0('0x45')]['id']}},_0x375ebc={};_0x375ebc['model']=_['keys'](db[_0x97c0('0x2b')][_0x97c0('0x2c')]);_0x375ebc[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x1dc6ff[_0x97c0('0x2f')]);_0x375ebc['filters']=_['intersection'](_0x375ebc['model'],_0x375ebc[_0x97c0('0x2f')]);_0x312fce['attributes']=_['intersection'](_0x375ebc[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x312fce[_0x97c0('0x33')]=_0x312fce['attributes'][_0x97c0('0x35')]?_0x312fce[_0x97c0('0x33')]:_0x375ebc[_0x97c0('0x2e')];if(_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x312fce[_0x97c0('0x40')]=[{'all':!![]}];}_0x312fce=_[_0x97c0('0x46')]({},_0x312fce,_0x1dc6ff[_0x97c0('0x3e')]);return db[_0x97c0('0x2b')][_0x97c0('0x47')](_0x312fce)['then'](handleEntityNotFound(_0x142421,null))[_0x97c0('0x24')](respondWithResult(_0x142421,null))[_0x97c0('0x43')](handleError(_0x142421,null));};exports[_0x97c0('0x48')]=function(_0x276c98,_0x4ff0a5){return db['CmHopperFinal'][_0x97c0('0x48')]()[_0x97c0('0x24')](respondWithResult(_0x4ff0a5,null))[_0x97c0('0x43')](handleError(_0x4ff0a5,null));};exports['update']=function(_0x3e09d5,_0xac56ac){if(_0x3e09d5[_0x97c0('0x49')][_0x97c0('0x4a')]){delete _0x3e09d5[_0x97c0('0x49')]['uniqueid'];}return db[_0x97c0('0x2b')][_0x97c0('0x47')]({'where':{'uniqueid':_0x3e09d5[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0xac56ac,null))['then'](saveUpdates(_0x3e09d5[_0x97c0('0x49')],null))['then'](respondWithResult(_0xac56ac,null))['catch'](handleError(_0xac56ac,null));};exports[_0x97c0('0x4b')]=function(_0x20e2a5,_0x23c7ad,_0x53a255){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x20e2a5[_0x97c0('0x45')]['id']},'attributes':[[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x4f')))),'noSuchContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x50')))),'noAnswerContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x53')))),_0x97c0('0x54')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x55')))),_0x97c0('0x56')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x59')))),'reCallContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x97c0('0x5a')]]})[_0x97c0('0x24')](handleEntityNotFound(_0x23c7ad,null))[_0x97c0('0x24')](respondWithResult(_0x23c7ad,null))[_0x97c0('0x43')](handleError(_0x23c7ad,null));};exports[_0x97c0('0x5b')]=function(_0x2bb5d3,_0x52643e,_0x3349df){return db[_0x97c0('0x2b')][_0x97c0('0x41')]({'raw':![],'where':{'CampaignId':_0x2bb5d3[_0x97c0('0x45')]['id']},'attributes':[[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x200,\x201,\x20null'))),_0x97c0('0x5c')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x50')))),_0x97c0('0x5d')],[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x97c0('0x54')],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x55')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x59')))),_0x97c0('0x5e')],[db[_0x97c0('0x4c')]['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x5f')))),_0x97c0('0x5a')]]})['then'](handleEntityNotFound(_0x52643e,null))[_0x97c0('0x24')](respondWithResult(_0x52643e,null))[_0x97c0('0x43')](handleError(_0x52643e,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x4116c9,_0x30ffa8,_0x1cfe22){return db['VoiceQueue'][_0x97c0('0x47')]({'where':{'id':_0x4116c9[_0x97c0('0x45')]['id']}})[_0x97c0('0x24')](handleEntityNotFound(_0x30ffa8,null))[_0x97c0('0x24')](function(_0x4d40cd){var _0x4ee6a2;if(_0x4d40cd){_0x4ee6a2=squel['insert']()[_0x97c0('0x60')](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),_0x97c0('0x66'),_0x97c0('0x67'),'createdAt','updatedAt'],squel[_0x97c0('0x68')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x64'))[_0x97c0('0x69')](_0x97c0('0x6b'),'ContactId')['field'](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x6d'),'VoiceQueueId')[_0x97c0('0x69')]('NOW()',_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x74'),_0x4116c9['body']['state'][_0x97c0('0x73')]())[_0x97c0('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x97c0('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x97c0('0x68')]()[_0x97c0('0x69')]('phone')[_0x97c0('0x70')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]()))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9['params']['id'][_0x97c0('0x73')]())['where']('state\x20=\x204'))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')]['query'](_0x4ee6a2);}return[];})[_0x97c0('0x24')](respondWithResult(_0x30ffa8,null))[_0x97c0('0x43')](handleError(_0x30ffa8,null));};exports[_0x97c0('0x78')]=function(_0x5bb9de,_0x388ba1,_0x550a68){return db[_0x97c0('0x79')][_0x97c0('0x47')]({'where':{'id':_0x5bb9de[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x388ba1,null))[_0x97c0('0x24')](function(_0x44f6bc){var _0x37cdb3;if(_0x44f6bc){_0x37cdb3=squel[_0x97c0('0x7a')]()['into'](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),'ListId',_0x97c0('0x7b'),_0x97c0('0x6e'),'updatedAt'],squel['select']()[_0x97c0('0x69')](_0x97c0('0x7c'),_0x97c0('0x63'))['field']('NOW()',_0x97c0('0x64'))['field'](_0x97c0('0x6b'),_0x97c0('0x65'))[_0x97c0('0x69')](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x7d'),'CampaignId')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x74'),_0x5bb9de['body'][_0x97c0('0x7f')][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x80'))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x63'))[_0x97c0('0x70')](_0x97c0('0x61'))[_0x97c0('0x39')]('CampaignId\x20=\x20?',_0x5bb9de[_0x97c0('0x45')]['id']['toString']()))[_0x97c0('0x39')](_0x97c0('0x75'),squel[_0x97c0('0x68')]()['field'](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de['params']['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x81')))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')][_0x97c0('0x2f')](_0x37cdb3);}return[];})[_0x97c0('0x24')](respondWithResult(_0x388ba1,null))[_0x97c0('0x43')](handleError(_0x388ba1,null));};exports[_0x97c0('0x82')]=function(_0x3ebd11,_0x44b374,_0x493e62){return db[_0x97c0('0x83')][_0x97c0('0x84')]({'where':{'VoiceQueueId':_0x3ebd11[_0x97c0('0x49')]['VoiceQueueId'],'CampaignId':_0x3ebd11['body'][_0x97c0('0x7b')],'ContactId':_0x3ebd11[_0x97c0('0x49')][_0x97c0('0x65')]}})[_0x97c0('0x24')](handleEntityNotFound(_0x44b374,null))[_0x97c0('0x24')](function(_0x120d78){if(_0x120d78){return _0x120d78;}return null;})[_0x97c0('0x24')](respondWithResult(_0x44b374,null))[_0x97c0('0x43')](handleError(_0x44b374,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 3300448..ea6f782 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 _0x507f=['exports','define','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x507f,0x1cb));var _0xf507=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x507f[_0xb1cf84];return _0x4bad2e;};'use strict';var _=require(_0xf507('0x0'));var util=require(_0xf507('0x1'));var logger=require(_0xf507('0x2'))('api');var moment=require(_0xf507('0x3'));var BPromise=require(_0xf507('0x4'));var rp=require(_0xf507('0x5'));var fs=require('fs');var path=require(_0xf507('0x6'));var rimraf=require('rimraf');var config=require(_0xf507('0x7'));var attributes=require(_0xf507('0x8'));module[_0xf507('0x9')]=function(_0x222c1b,_0x4767bb){return _0x222c1b[_0xf507('0xa')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xf507('0xb'),'fields':[_0xf507('0xb')]},{'name':_0xf507('0xc'),'fields':[_0xf507('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e04=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define'];(function(_0x41273c,_0x4c0c04){var _0x453ce4=function(_0x5504e9){while(--_0x5504e9){_0x41273c['push'](_0x41273c['shift']());}};_0x453ce4(++_0x4c0c04);}(_0x1e04,0xc7));var _0x41e0=function(_0x29d221,_0x38b6a8){_0x29d221=_0x29d221-0x0;var _0x260f7f=_0x1e04[_0x29d221];return _0x260f7f;};'use strict';var _=require('lodash');var util=require(_0x41e0('0x0'));var logger=require('../../config/logger')(_0x41e0('0x1'));var moment=require(_0x41e0('0x2'));var BPromise=require(_0x41e0('0x3'));var rp=require(_0x41e0('0x4'));var fs=require('fs');var path=require(_0x41e0('0x5'));var rimraf=require(_0x41e0('0x6'));var config=require(_0x41e0('0x7'));var attributes=require(_0x41e0('0x8'));module[_0x41e0('0x9')]=function(_0x8adf28,_0x4e4586){return _0x8adf28[_0x41e0('0xa')](_0x41e0('0xb'),attributes,{'tableName':_0x41e0('0xc'),'paranoid':![],'indexes':[{'name':_0x41e0('0xd'),'fields':['calleridnum']},{'name':_0x41e0('0xe'),'fields':[_0x41e0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3ec2a05..bf45228 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1e2a8b,_0x25bbc5){var _0x10dd57=function(_0x1e2889){while(--_0x1e2889){_0x1e2a8b['push'](_0x1e2a8b['shift']());}};_0x10dd57(++_0x25bbc5);}(_0x7a54,0x106));var _0x47a5=function(_0x7f4ebd,_0x58c728){_0x7f4ebd=_0x7f4ebd-0x0;var _0x4162cb=_0x7a54[_0x7f4ebd];return _0x4162cb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5289cb,_0x3d2db4){var _0x452ad8=function(_0x31b32d){while(--_0x31b32d){_0x5289cb['push'](_0x5289cb['shift']());}};_0x452ad8(++_0x3d2db4);}(_0x7a54,0x106));var _0x47a5=function(_0x20b527,_0x1cd3c2){_0x20b527=_0x20b527-0x0;var _0x1844b8=_0x7a54[_0x20b527];return _0x1844b8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e1c570a..6a1869f 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 _0x4f7b=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x56f935,_0xbb3e13){var _0x25ff2f=function(_0x3d0fad){while(--_0x3d0fad){_0x56f935['push'](_0x56f935['shift']());}};_0x25ff2f(++_0xbb3e13);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x1e269c,_0x5976d7){_0x1e269c=_0x1e269c-0x0;var _0x52121f=_0x4f7b[_0x1e269c];return _0x52121f;};'use strict';var multer=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var path=require(_0xb4f7('0x2'));var timeout=require(_0xb4f7('0x3'));var express=require('express');var router=express[_0xb4f7('0x4')]();var fs_extra=require(_0xb4f7('0x5'));var auth=require(_0xb4f7('0x6'));var interaction=require(_0xb4f7('0x7'));var config=require(_0xb4f7('0x8'));var controller=require(_0xb4f7('0x9'));router[_0xb4f7('0xa')]('/',auth[_0xb4f7('0xb')](),controller['index']);router[_0xb4f7('0xa')]('/describe',auth[_0xb4f7('0xb')](),controller[_0xb4f7('0xc')]);router[_0xb4f7('0xa')]('/:id',auth[_0xb4f7('0xb')](),controller['show']);router[_0xb4f7('0xa')](_0xb4f7('0xd'),auth[_0xb4f7('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xb4f7('0xa')](_0xb4f7('0xe'),auth[_0xb4f7('0xb')](),controller[_0xb4f7('0xf')]);router[_0xb4f7('0x10')](_0xb4f7('0x11'),auth[_0xb4f7('0xb')](),controller[_0xb4f7('0x12')]);router['post'](_0xb4f7('0x13'),auth[_0xb4f7('0xb')](),controller[_0xb4f7('0x14')]);router[_0xb4f7('0x10')](_0xb4f7('0x15'),auth[_0xb4f7('0xb')](),controller['checkContactHopper']);router[_0xb4f7('0x16')]('/:id',auth[_0xb4f7('0xb')](),controller[_0xb4f7('0x17')]);module[_0xb4f7('0x18')]=router; \ No newline at end of file +var _0x6d3f=['moveContactsIvrCampaignHopperFinal','checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id'];(function(_0x3e16c4,_0x2f0624){var _0x505921=function(_0x2f9b7d){while(--_0x2f9b7d){_0x3e16c4['push'](_0x3e16c4['shift']());}};_0x505921(++_0x2f0624);}(_0x6d3f,0xe6));var _0xf6d3=function(_0x2876da,_0x55d0d8){_0x2876da=_0x2876da-0x0;var _0x569a2d=_0x6d3f[_0x2876da];return _0x569a2d;};'use strict';var multer=require(_0xf6d3('0x0'));var util=require(_0xf6d3('0x1'));var path=require(_0xf6d3('0x2'));var timeout=require(_0xf6d3('0x3'));var express=require(_0xf6d3('0x4'));var router=express[_0xf6d3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf6d3('0x6'));var interaction=require(_0xf6d3('0x7'));var config=require(_0xf6d3('0x8'));var controller=require(_0xf6d3('0x9'));router[_0xf6d3('0xa')]('/',auth[_0xf6d3('0xb')](),controller['index']);router[_0xf6d3('0xa')]('/describe',auth[_0xf6d3('0xb')](),controller[_0xf6d3('0xc')]);router[_0xf6d3('0xa')]('/:id',auth[_0xf6d3('0xb')](),controller[_0xf6d3('0xd')]);router[_0xf6d3('0xa')](_0xf6d3('0xe'),auth[_0xf6d3('0xb')](),controller[_0xf6d3('0xf')]);router['get'](_0xf6d3('0x10'),auth[_0xf6d3('0xb')](),controller[_0xf6d3('0x11')]);router['post'](_0xf6d3('0x12'),auth[_0xf6d3('0xb')](),controller[_0xf6d3('0x13')]);router[_0xf6d3('0x14')](_0xf6d3('0x15'),auth[_0xf6d3('0xb')](),controller[_0xf6d3('0x16')]);router[_0xf6d3('0x14')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0xf6d3('0x17')]);router[_0xf6d3('0x18')](_0xf6d3('0x19'),auth[_0xf6d3('0xb')](),controller[_0xf6d3('0x1a')]);module[_0xf6d3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 59f5818..b7cb380 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 _0xdf43=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xdf43,0x6c));var _0x3df4=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xdf43[_0x2261ce];return _0x524640;};'use strict';var Sequelize=require(_0x3df4('0x0'));module['exports']={'state':{'type':Sequelize[_0x3df4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x3df4('0x2')]},'scheduledat':{'type':Sequelize[_0x3df4('0x3')]},'countbusyretry':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x3df4('0x2')]},'originatecalleridname':{'type':Sequelize[_0x3df4('0x2')]},'calleridnum':{'type':Sequelize[_0x3df4('0x2')]},'calleridname':{'type':Sequelize[_0x3df4('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3df4('0x3')]},'answertime':{'type':Sequelize[_0x3df4('0x3')]},'droptime':{'type':Sequelize[_0x3df4('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3df4('0x2')]},'campaign':{'type':Sequelize[_0x3df4('0x2')]},'campaigntype':{'type':Sequelize[_0x3df4('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x3df4('0x2')]},'amd':{'type':Sequelize[_0x3df4('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3df4('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3df4('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3df4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3df4('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3df4('0x2')]}}; \ No newline at end of file +var _0xd0a2=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x1fe444,_0x15d367){var _0x55d1c2=function(_0x252b27){while(--_0x252b27){_0x1fe444['push'](_0x1fe444['shift']());}};_0x55d1c2(++_0x15d367);}(_0xd0a2,0x71));var _0x2d0a=function(_0x1a12c8,_0x2df4dc){_0x1a12c8=_0x1a12c8-0x0;var _0x305109=_0xd0a2[_0x1a12c8];return _0x305109;};'use strict';var Sequelize=require('sequelize');module[_0x2d0a('0x0')]={'state':{'type':Sequelize[_0x2d0a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x2d0a('0x2')]},'scheduledat':{'type':Sequelize[_0x2d0a('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2d0a('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2d0a('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2d0a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x2d0a('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2d0a('0x2')]},'calleridname':{'type':Sequelize[_0x2d0a('0x2')]},'starttime':{'type':Sequelize[_0x2d0a('0x3')]},'responsetime':{'type':Sequelize[_0x2d0a('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x2d0a('0x3')]},'endtime':{'type':Sequelize[_0x2d0a('0x3')]},'ringtime':{'type':Sequelize[_0x2d0a('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2d0a('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2d0a('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2d0a('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x2d0a('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x2d0a('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2d0a('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2d0a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2d0a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x2d0a('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2d0a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2d0a('0x1')],'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 3080a84..c6a349c 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 _0x645c=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','offset','count','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x48cce0,_0x366a85){var _0x3fc225=function(_0x2d3012){while(--_0x2d3012){_0x48cce0['push'](_0x48cce0['shift']());}};_0x3fc225(++_0x366a85);}(_0x645c,0xe6));var _0xc645=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x645c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc645('0x0'));var rimraf=require(_0xc645('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc645('0x2'));var rp=require(_0xc645('0x3'));var moment=require(_0xc645('0x4'));var BPromise=require(_0xc645('0x5'));var Mustache=require(_0xc645('0x6'));var util=require(_0xc645('0x7'));var path=require(_0xc645('0x8'));var sox=require(_0xc645('0x9'));var csv=require(_0xc645('0xa'));var ejs=require(_0xc645('0xb'));var fs=require('fs');var fs_extra=require(_0xc645('0xc'));var _=require('lodash');var squel=require(_0xc645('0xd'));var crypto=require(_0xc645('0xe'));var jsforce=require(_0xc645('0xf'));var deskjs=require(_0xc645('0x10'));var toCsv=require(_0xc645('0xa'));var querystring=require('querystring');var Papa=require(_0xc645('0x11'));var Redis=require(_0xc645('0x12'));var authService=require(_0xc645('0x13'));var qs=require(_0xc645('0x14'));var as=require(_0xc645('0x15'));var hardwareService=require(_0xc645('0x16'));var logger=require(_0xc645('0x17'))(_0xc645('0x18'));var utils=require(_0xc645('0x19'));var config=require(_0xc645('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xc645('0x1b'))['db'];function respondWithStatusCode(_0x9b625b,_0x4289c4){_0x4289c4=_0x4289c4||0xcc;return function(_0x2ab0d2){if(_0x2ab0d2){return _0x9b625b['sendStatus'](_0x4289c4);}return _0x9b625b[_0xc645('0x1c')](_0x4289c4)[_0xc645('0x1d')]();};}function respondWithResult(_0x2d3c99,_0x272552){_0x272552=_0x272552||0xc8;return function(_0x332a7a){if(_0x332a7a){return _0x2d3c99[_0xc645('0x1c')](_0x272552)['json'](_0x332a7a);}};}function respondWithFilteredResult(_0x49b787,_0x2a071d){return function(_0x321376){if(_0x321376){var _0x4e89c8=typeof _0x2a071d['offset']===_0xc645('0x1e')&&typeof _0x2a071d['limit']===_0xc645('0x1e');var _0x5796ae=_0x321376['count'];var _0x50e600=_0x4e89c8?0x0:_0x2a071d[_0xc645('0x1f')];var _0x4fac18=_0x4e89c8?_0x321376[_0xc645('0x20')]:_0x2a071d['offset']+_0x2a071d['limit'];var _0x1476ee;if(_0x4fac18>=_0x5796ae){_0x4fac18=_0x5796ae;_0x1476ee=0xc8;}else{_0x1476ee=0xce;}_0x49b787[_0xc645('0x1c')](_0x1476ee);return _0x49b787['set']('Content-Range',_0x50e600+'-'+_0x4fac18+'/'+_0x5796ae)['json'](_0x321376);}return null;};}function patchUpdates(_0x12712b){return function(_0x2ac031){try{jsonpatch[_0xc645('0x21')](_0x2ac031,_0x12712b,!![]);}catch(_0x532109){return BPromise[_0xc645('0x22')](_0x532109);}return _0x2ac031[_0xc645('0x23')]();};}function saveUpdates(_0xdf1759,_0x1f162b){return function(_0x1c38f0){if(_0x1c38f0){return _0x1c38f0[_0xc645('0x24')](_0xdf1759)['then'](function(_0xe9326b){return _0xe9326b;});}return null;};}function removeEntity(_0x3db9f2,_0x210ced){return function(_0x2b3077){if(_0x2b3077){return _0x2b3077[_0xc645('0x25')]()[_0xc645('0x26')](function(){_0x3db9f2['status'](0xcc)[_0xc645('0x1d')]();});}};}function handleEntityNotFound(_0x1e9350,_0x294f19){return function(_0x531f8f){if(!_0x531f8f){_0x1e9350[_0xc645('0x27')](0x194);}return _0x531f8f;};}function handleError(_0x2d9000,_0x3a72fa){_0x3a72fa=_0x3a72fa||0x1f4;return function(_0x52b848){logger[_0xc645('0x28')](_0x52b848[_0xc645('0x29')]);if(_0x52b848['name']){delete _0x52b848[_0xc645('0x2a')];}_0x2d9000[_0xc645('0x1c')](_0x3a72fa)[_0xc645('0x2b')](_0x52b848);};}exports[_0xc645('0x2c')]=function(_0x1cf0aa,_0x58e427){var _0x45b45c={},_0x2ac9c2={},_0x5b468f={'count':0x0,'rows':[]};var _0x2d6642=_[_0xc645('0x2d')](db[_0xc645('0x2e')][_0xc645('0x2f')],function(_0x4f2cbf){return{'name':_0x4f2cbf[_0xc645('0x30')],'type':_0x4f2cbf[_0xc645('0x31')][_0xc645('0x32')]};});_0x2ac9c2[_0xc645('0x33')]=_[_0xc645('0x2d')](_0x2d6642,'name');_0x2ac9c2[_0xc645('0x34')]=_['keys'](_0x1cf0aa[_0xc645('0x34')]);_0x2ac9c2[_0xc645('0x35')]=_[_0xc645('0x36')](_0x2ac9c2[_0xc645('0x33')],_0x2ac9c2[_0xc645('0x34')]);_0x45b45c[_0xc645('0x37')]=_[_0xc645('0x36')](_0x2ac9c2[_0xc645('0x33')],qs[_0xc645('0x38')](_0x1cf0aa[_0xc645('0x34')]['fields']));_0x45b45c['attributes']=_0x45b45c[_0xc645('0x37')][_0xc645('0x39')]?_0x45b45c['attributes']:_0x2ac9c2[_0xc645('0x33')];if(!_0x1cf0aa['query'][_0xc645('0x3a')](_0xc645('0x3b'))){_0x45b45c[_0xc645('0x3c')]=qs[_0xc645('0x3c')](_0x1cf0aa['query'][_0xc645('0x3c')]);_0x45b45c[_0xc645('0x1f')]=qs[_0xc645('0x1f')](_0x1cf0aa[_0xc645('0x34')][_0xc645('0x1f')]);}_0x45b45c[_0xc645('0x3d')]=qs[_0xc645('0x3e')](_0x1cf0aa['query'][_0xc645('0x3e')]);_0x45b45c['where']=qs[_0xc645('0x35')](_['pick'](_0x1cf0aa['query'],_0x2ac9c2[_0xc645('0x35')]),_0x2d6642);if(_0x1cf0aa['query'][_0xc645('0x3f')]){_0x45b45c[_0xc645('0x40')]=_[_0xc645('0x41')](_0x45b45c[_0xc645('0x40')],{'$or':_[_0xc645('0x2d')](_0x2d6642,function(_0x4754a8){if(_0x4754a8[_0xc645('0x31')]!==_0xc645('0x42')){var _0x117704={};_0x117704[_0x4754a8[_0xc645('0x2a')]]={'$like':'%'+_0x1cf0aa[_0xc645('0x34')][_0xc645('0x3f')]+'%'};return _0x117704;}})});}_0x45b45c=_[_0xc645('0x41')]({},_0x45b45c,_0x1cf0aa[_0xc645('0x43')]);var _0xbceaca={'where':_0x45b45c[_0xc645('0x40')]};return db[_0xc645('0x2e')][_0xc645('0x20')](_0xbceaca)['then'](function(_0x3d2d94){_0x5b468f[_0xc645('0x20')]=_0x3d2d94;if(_0x1cf0aa[_0xc645('0x34')][_0xc645('0x44')]){_0x45b45c[_0xc645('0x45')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x45b45c);})[_0xc645('0x26')](function(_0x3fc41a){_0x5b468f[_0xc645('0x46')]=_0x3fc41a;return _0x5b468f;})[_0xc645('0x26')](respondWithFilteredResult(_0x58e427,_0x45b45c))[_0xc645('0x47')](handleError(_0x58e427,null));};exports['show']=function(_0x580923,_0x4c2b1f){var _0xb8e864={'raw':!![],'where':{'id':_0x580923[_0xc645('0x48')]['id']}},_0x8ae29={};_0x8ae29[_0xc645('0x33')]=_[_0xc645('0x49')](db[_0xc645('0x2e')][_0xc645('0x2f')]);_0x8ae29[_0xc645('0x34')]=_[_0xc645('0x49')](_0x580923[_0xc645('0x34')]);_0x8ae29[_0xc645('0x35')]=_['intersection'](_0x8ae29[_0xc645('0x33')],_0x8ae29['query']);_0xb8e864[_0xc645('0x37')]=_['intersection'](_0x8ae29[_0xc645('0x33')],qs[_0xc645('0x38')](_0x580923[_0xc645('0x34')][_0xc645('0x38')]));_0xb8e864[_0xc645('0x37')]=_0xb8e864[_0xc645('0x37')][_0xc645('0x39')]?_0xb8e864['attributes']:_0x8ae29[_0xc645('0x33')];if(_0x580923['query'][_0xc645('0x44')]){_0xb8e864[_0xc645('0x45')]=[{'all':!![]}];}_0xb8e864=_['merge']({},_0xb8e864,_0x580923[_0xc645('0x43')]);return db[_0xc645('0x2e')][_0xc645('0x4a')](_0xb8e864)['then'](handleEntityNotFound(_0x4c2b1f,null))['then'](respondWithResult(_0x4c2b1f,null))[_0xc645('0x47')](handleError(_0x4c2b1f,null));};exports['create']=function(_0x8bdff3,_0x23aa90){return db[_0xc645('0x2e')]['create'](_0x8bdff3[_0xc645('0x4b')],{})[_0xc645('0x26')](respondWithResult(_0x23aa90,0xc9))[_0xc645('0x47')](handleError(_0x23aa90,null));};exports[_0xc645('0x4c')]=function(_0x23ed1f,_0x47e109){return db[_0xc645('0x2e')][_0xc645('0x4c')]()[_0xc645('0x26')](respondWithResult(_0x47e109,null))['catch'](handleError(_0x47e109,null));};exports[_0xc645('0x24')]=function(_0x3c08c4,_0x6e0d1f){if(_0x3c08c4[_0xc645('0x4b')][_0xc645('0x4d')]){delete _0x3c08c4[_0xc645('0x4b')][_0xc645('0x4d')];}return db[_0xc645('0x2e')][_0xc645('0x4a')]({'where':{'uniqueid':_0x3c08c4['params']['id']}})[_0xc645('0x26')](handleEntityNotFound(_0x6e0d1f,null))[_0xc645('0x26')](saveUpdates(_0x3c08c4[_0xc645('0x4b')],null))[_0xc645('0x26')](respondWithResult(_0x6e0d1f,null))[_0xc645('0x47')](handleError(_0x6e0d1f,null));}; \ No newline at end of file +var _0xdd78=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','keys','create','describe','update','body','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3d5219,_0x14e745){var _0x3283a1=function(_0x23a19c){while(--_0x23a19c){_0x3d5219['push'](_0x3d5219['shift']());}};_0x3283a1(++_0x14e745);}(_0xdd78,0x1da));var _0x8dd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd78[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8dd7('0x0'));var rimraf=require(_0x8dd7('0x1'));var zipdir=require(_0x8dd7('0x2'));var jsonpatch=require(_0x8dd7('0x3'));var rp=require(_0x8dd7('0x4'));var moment=require(_0x8dd7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8dd7('0x6'));var util=require(_0x8dd7('0x7'));var path=require(_0x8dd7('0x8'));var sox=require(_0x8dd7('0x9'));var csv=require(_0x8dd7('0xa'));var ejs=require(_0x8dd7('0xb'));var fs=require('fs');var fs_extra=require(_0x8dd7('0xc'));var _=require('lodash');var squel=require(_0x8dd7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8dd7('0xe'));var toCsv=require(_0x8dd7('0xa'));var querystring=require(_0x8dd7('0xf'));var Papa=require(_0x8dd7('0x10'));var Redis=require(_0x8dd7('0x11'));var authService=require(_0x8dd7('0x12'));var qs=require(_0x8dd7('0x13'));var as=require(_0x8dd7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8dd7('0x15'))(_0x8dd7('0x16'));var utils=require(_0x8dd7('0x17'));var config=require(_0x8dd7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8dd7('0x19'))['db'];function respondWithStatusCode(_0x11916c,_0x162c64){_0x162c64=_0x162c64||0xcc;return function(_0x365b50){if(_0x365b50){return _0x11916c['sendStatus'](_0x162c64);}return _0x11916c[_0x8dd7('0x1a')](_0x162c64)[_0x8dd7('0x1b')]();};}function respondWithResult(_0x4ae5b6,_0x1df5f6){_0x1df5f6=_0x1df5f6||0xc8;return function(_0x34ecfc){if(_0x34ecfc){return _0x4ae5b6[_0x8dd7('0x1a')](_0x1df5f6)[_0x8dd7('0x1c')](_0x34ecfc);}};}function respondWithFilteredResult(_0x4167bf,_0x1f16d0){return function(_0x5346a8){if(_0x5346a8){var _0x193684=typeof _0x1f16d0[_0x8dd7('0x1d')]==='undefined'&&typeof _0x1f16d0[_0x8dd7('0x1e')]===_0x8dd7('0x1f');var _0x1c4c84=_0x5346a8[_0x8dd7('0x20')];var _0x31ec93=_0x193684?0x0:_0x1f16d0['offset'];var _0x5b5695=_0x193684?_0x5346a8[_0x8dd7('0x20')]:_0x1f16d0['offset']+_0x1f16d0[_0x8dd7('0x1e')];var _0x28734e;if(_0x5b5695>=_0x1c4c84){_0x5b5695=_0x1c4c84;_0x28734e=0xc8;}else{_0x28734e=0xce;}_0x4167bf[_0x8dd7('0x1a')](_0x28734e);return _0x4167bf[_0x8dd7('0x21')]('Content-Range',_0x31ec93+'-'+_0x5b5695+'/'+_0x1c4c84)[_0x8dd7('0x1c')](_0x5346a8);}return null;};}function patchUpdates(_0x4efe25){return function(_0x1a0793){try{jsonpatch[_0x8dd7('0x22')](_0x1a0793,_0x4efe25,!![]);}catch(_0x4169d2){return BPromise['reject'](_0x4169d2);}return _0x1a0793[_0x8dd7('0x23')]();};}function saveUpdates(_0x2ed54c,_0x2d9b2a){return function(_0x5466b7){if(_0x5466b7){return _0x5466b7['update'](_0x2ed54c)[_0x8dd7('0x24')](function(_0x357621){return _0x357621;});}return null;};}function removeEntity(_0x5d7239,_0x1f2937){return function(_0x9e321c){if(_0x9e321c){return _0x9e321c['destroy']()[_0x8dd7('0x24')](function(){_0x5d7239[_0x8dd7('0x1a')](0xcc)[_0x8dd7('0x1b')]();});}};}function handleEntityNotFound(_0x59c89b,_0x340079){return function(_0x1fb90a){if(!_0x1fb90a){_0x59c89b[_0x8dd7('0x25')](0x194);}return _0x1fb90a;};}function handleError(_0x1fd2a8,_0x1cd9b4){_0x1cd9b4=_0x1cd9b4||0x1f4;return function(_0x20cfa5){logger[_0x8dd7('0x26')](_0x20cfa5[_0x8dd7('0x27')]);if(_0x20cfa5[_0x8dd7('0x28')]){delete _0x20cfa5[_0x8dd7('0x28')];}_0x1fd2a8[_0x8dd7('0x1a')](_0x1cd9b4)[_0x8dd7('0x29')](_0x20cfa5);};}exports[_0x8dd7('0x2a')]=function(_0x1470e9,_0x38261f){var _0x2bb34b={},_0x7a6ad6={},_0x5c7ad5={'count':0x0,'rows':[]};var _0x3f0b03=_[_0x8dd7('0x2b')](db['CmHopperHistory'][_0x8dd7('0x2c')],function(_0x260b68){return{'name':_0x260b68[_0x8dd7('0x2d')],'type':_0x260b68[_0x8dd7('0x2e')][_0x8dd7('0x2f')]};});_0x7a6ad6[_0x8dd7('0x30')]=_['map'](_0x3f0b03,_0x8dd7('0x28'));_0x7a6ad6[_0x8dd7('0x31')]=_['keys'](_0x1470e9[_0x8dd7('0x31')]);_0x7a6ad6[_0x8dd7('0x32')]=_[_0x8dd7('0x33')](_0x7a6ad6[_0x8dd7('0x30')],_0x7a6ad6[_0x8dd7('0x31')]);_0x2bb34b[_0x8dd7('0x34')]=_['intersection'](_0x7a6ad6[_0x8dd7('0x30')],qs[_0x8dd7('0x35')](_0x1470e9[_0x8dd7('0x31')]['fields']));_0x2bb34b[_0x8dd7('0x34')]=_0x2bb34b['attributes'][_0x8dd7('0x36')]?_0x2bb34b[_0x8dd7('0x34')]:_0x7a6ad6[_0x8dd7('0x30')];if(!_0x1470e9['query'][_0x8dd7('0x37')](_0x8dd7('0x38'))){_0x2bb34b[_0x8dd7('0x1e')]=qs[_0x8dd7('0x1e')](_0x1470e9['query'][_0x8dd7('0x1e')]);_0x2bb34b[_0x8dd7('0x1d')]=qs['offset'](_0x1470e9[_0x8dd7('0x31')][_0x8dd7('0x1d')]);}_0x2bb34b[_0x8dd7('0x39')]=qs[_0x8dd7('0x3a')](_0x1470e9['query'][_0x8dd7('0x3a')]);_0x2bb34b[_0x8dd7('0x3b')]=qs[_0x8dd7('0x32')](_[_0x8dd7('0x3c')](_0x1470e9[_0x8dd7('0x31')],_0x7a6ad6[_0x8dd7('0x32')]),_0x3f0b03);if(_0x1470e9[_0x8dd7('0x31')][_0x8dd7('0x3d')]){_0x2bb34b[_0x8dd7('0x3b')]=_[_0x8dd7('0x3e')](_0x2bb34b[_0x8dd7('0x3b')],{'$or':_[_0x8dd7('0x2b')](_0x3f0b03,function(_0x35eed8){if(_0x35eed8[_0x8dd7('0x2e')]!==_0x8dd7('0x3f')){var _0x451b1e={};_0x451b1e[_0x35eed8[_0x8dd7('0x28')]]={'$like':'%'+_0x1470e9[_0x8dd7('0x31')][_0x8dd7('0x3d')]+'%'};return _0x451b1e;}})});}_0x2bb34b=_[_0x8dd7('0x3e')]({},_0x2bb34b,_0x1470e9[_0x8dd7('0x40')]);var _0x2cd6c1={'where':_0x2bb34b[_0x8dd7('0x3b')]};return db[_0x8dd7('0x41')][_0x8dd7('0x20')](_0x2cd6c1)[_0x8dd7('0x24')](function(_0x54ec8e){_0x5c7ad5[_0x8dd7('0x20')]=_0x54ec8e;if(_0x1470e9['query'][_0x8dd7('0x42')]){_0x2bb34b[_0x8dd7('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x8dd7('0x44')](_0x2bb34b);})['then'](function(_0x3c790b){_0x5c7ad5[_0x8dd7('0x45')]=_0x3c790b;return _0x5c7ad5;})[_0x8dd7('0x24')](respondWithFilteredResult(_0x38261f,_0x2bb34b))[_0x8dd7('0x46')](handleError(_0x38261f,null));};exports[_0x8dd7('0x47')]=function(_0x2970d5,_0x45e851){var _0x1840ce={'raw':!![],'where':{'id':_0x2970d5[_0x8dd7('0x48')]['id']}},_0x178a31={};_0x178a31['model']=_['keys'](db[_0x8dd7('0x41')][_0x8dd7('0x2c')]);_0x178a31['query']=_[_0x8dd7('0x49')](_0x2970d5[_0x8dd7('0x31')]);_0x178a31[_0x8dd7('0x32')]=_[_0x8dd7('0x33')](_0x178a31[_0x8dd7('0x30')],_0x178a31[_0x8dd7('0x31')]);_0x1840ce[_0x8dd7('0x34')]=_[_0x8dd7('0x33')](_0x178a31[_0x8dd7('0x30')],qs[_0x8dd7('0x35')](_0x2970d5[_0x8dd7('0x31')][_0x8dd7('0x35')]));_0x1840ce[_0x8dd7('0x34')]=_0x1840ce[_0x8dd7('0x34')][_0x8dd7('0x36')]?_0x1840ce[_0x8dd7('0x34')]:_0x178a31[_0x8dd7('0x30')];if(_0x2970d5[_0x8dd7('0x31')][_0x8dd7('0x42')]){_0x1840ce[_0x8dd7('0x43')]=[{'all':!![]}];}_0x1840ce=_['merge']({},_0x1840ce,_0x2970d5[_0x8dd7('0x40')]);return db[_0x8dd7('0x41')]['find'](_0x1840ce)['then'](handleEntityNotFound(_0x45e851,null))[_0x8dd7('0x24')](respondWithResult(_0x45e851,null))['catch'](handleError(_0x45e851,null));};exports['create']=function(_0x5d290c,_0x4d5252){return db[_0x8dd7('0x41')][_0x8dd7('0x4a')](_0x5d290c['body'],{})[_0x8dd7('0x24')](respondWithResult(_0x4d5252,0xc9))[_0x8dd7('0x46')](handleError(_0x4d5252,null));};exports[_0x8dd7('0x4b')]=function(_0x11023c,_0x3b70f1){return db['CmHopperHistory'][_0x8dd7('0x4b')]()[_0x8dd7('0x24')](respondWithResult(_0x3b70f1,null))[_0x8dd7('0x46')](handleError(_0x3b70f1,null));};exports[_0x8dd7('0x4c')]=function(_0xe53f10,_0x5373aa){if(_0xe53f10[_0x8dd7('0x4d')][_0x8dd7('0x4e')]){delete _0xe53f10[_0x8dd7('0x4d')][_0x8dd7('0x4e')];}return db[_0x8dd7('0x41')][_0x8dd7('0x4f')]({'where':{'uniqueid':_0xe53f10['params']['id']}})[_0x8dd7('0x24')](handleEntityNotFound(_0x5373aa,null))[_0x8dd7('0x24')](saveUpdates(_0xe53f10[_0x8dd7('0x4d')],null))[_0x8dd7('0x24')](respondWithResult(_0x5373aa,null))[_0x8dd7('0x46')](handleError(_0x5373aa,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index bf2c4f1..a40c8d7 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 _0xcdd2=['exports','define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes'];(function(_0x20e5c3,_0x41470c){var _0x401520=function(_0x37f246){while(--_0x37f246){_0x20e5c3['push'](_0x20e5c3['shift']());}};_0x401520(++_0x41470c);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require(_0x2cdd('0x2'))(_0x2cdd('0x3'));var moment=require('moment');var BPromise=require(_0x2cdd('0x4'));var rp=require(_0x2cdd('0x5'));var fs=require('fs');var path=require(_0x2cdd('0x6'));var rimraf=require(_0x2cdd('0x7'));var config=require('../../config/environment');var attributes=require(_0x2cdd('0x8'));module[_0x2cdd('0x9')]=function(_0x5f3b53,_0x1cc1ac){return _0x5f3b53[_0x2cdd('0xa')](_0x2cdd('0xb'),attributes,{'tableName':_0x2cdd('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':'uniqueid','fields':[_0x2cdd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6017=['../../config/environment','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x6017,0xae));var _0x7601=function(_0x4f8673,_0x3e6b3b){_0x4f8673=_0x4f8673-0x0;var _0x28cd30=_0x6017[_0x4f8673];return _0x28cd30;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var logger=require(_0x7601('0x2'))('api');var moment=require(_0x7601('0x3'));var BPromise=require(_0x7601('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7601('0x5'));var rimraf=require('rimraf');var config=require(_0x7601('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x425bf9,_0xc62b2c){return _0x425bf9[_0x7601('0x7')](_0x7601('0x8'),attributes,{'tableName':_0x7601('0x9'),'paranoid':![],'indexes':[{'name':_0x7601('0xa'),'fields':['endtime']},{'name':_0x7601('0xb'),'fields':[_0x7601('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d1d6fb0..22766e6 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 _0x1109=['name','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','where','col','ivrAnswerCallsDay','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','COUNT','sequelize','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','GetVoiceQueueHopperHistory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1109,0x17d));var _0x9110=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x1109[_0x4c440b];return _0x2d48cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9110('0x0'));var BPromise=require('bluebird');var rs=require(_0x9110('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9110('0x2'))['db'];var utils=require(_0x9110('0x3'));var logger=require(_0x9110('0x4'))(_0x9110('0x5'));var config=require(_0x9110('0x6'));var jayson=require(_0x9110('0x7'));var client=jayson[_0x9110('0x8')][_0x9110('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35a4a8,_0x4a15c6,_0x5c125b){return new BPromise(function(_0x4d18a6,_0x3d40a9){return client[_0x9110('0xa')](_0x35a4a8,_0x5c125b)[_0x9110('0xb')](function(_0x4e7252){logger[_0x9110('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x4a15c6,'request\x20sent');logger[_0x9110('0xd')](_0x9110('0xe'),_0x4a15c6,_0x9110('0xf'),JSON[_0x9110('0x10')](_0x4e7252));if(_0x4e7252[_0x9110('0x11')]){if(_0x4e7252[_0x9110('0x11')][_0x9110('0x12')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4a15c6,_0x4e7252[_0x9110('0x11')]['message']);return _0x3d40a9(_0x4e7252['error'][_0x9110('0x13')]);}logger[_0x9110('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x4a15c6,_0x4e7252[_0x9110('0x11')]['message']);return _0x4d18a6(_0x4e7252[_0x9110('0x11')][_0x9110('0x13')]);}else{logger[_0x9110('0xc')](_0x9110('0x14'),_0x4a15c6,_0x9110('0xf'));_0x4d18a6(_0x4e7252[_0x9110('0x15')]['message']);}})['catch'](function(_0x3bffeb){logger[_0x9110('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x4a15c6,_0x3bffeb);_0x3d40a9(_0x3bffeb);});});}exports[_0x9110('0x16')]=function(_0x11dec4){var _0x1bcaf2=this;return new Promise(function(_0x3d21e5,_0x2d75d6){return db[_0x9110('0x17')][_0x9110('0x18')](_0x11dec4[_0x9110('0x19')],{'raw':_0x11dec4[_0x9110('0x1a')]?_0x11dec4[_0x9110('0x1a')][_0x9110('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3563c5){logger[_0x9110('0xc')](_0x9110('0x16'),_0x11dec4);logger[_0x9110('0xd')]('CreateCmHopperHistory',_0x11dec4,JSON[_0x9110('0x10')](_0x3563c5));_0x3d21e5(_0x3563c5);})['catch'](function(_0x5a17b0){logger[_0x9110('0x11')](_0x9110('0x16'),_0x5a17b0[_0x9110('0x13')],_0x11dec4);_0x2d75d6(_0x1bcaf2[_0x9110('0x11')](0x1f4,_0x5a17b0[_0x9110('0x13')]));});});};exports[_0x9110('0x1c')]=function(_0x34903c){var _0x2a6f17=this;return new Promise(function(_0x10759b,_0x5aa7a1){return db[_0x9110('0x17')][_0x9110('0x1d')]({'raw':_0x34903c['options']?_0x34903c[_0x9110('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x34903c[_0x9110('0x1a')]?_0x34903c[_0x9110('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x9110('0x1e'),db['sequelize']['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x9110('0x21')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db['sequelize']['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')](_0x9110('0x22')))),_0x9110('0x23')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')](_0x9110('0x24')))),_0x9110('0x25')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x26'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')](_0x9110('0x27')))),_0x9110('0x28')],[db[_0x9110('0x1f')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x9110('0x1f')]['literal'](_0x9110('0x29')))),_0x9110('0x2a')]]})[_0x9110('0xb')](function(_0x34d085){logger[_0x9110('0xc')](_0x9110('0x1c'),_0x34903c);logger[_0x9110('0xd')](_0x9110('0x1c'),_0x34903c,JSON[_0x9110('0x10')](_0x34d085));_0x10759b(_0x34d085);})[_0x9110('0x2b')](function(_0x20e8b2){logger['error'](_0x9110('0x1c'),_0x20e8b2['message'],_0x34903c);_0x5aa7a1(_0x2a6f17[_0x9110('0x11')](0x1f4,_0x20e8b2[_0x9110('0x13')]));});});};exports[_0x9110('0x2c')]=function(_0x3b582c){var _0x4579ce=this;return new Promise(function(_0x240eac,_0x411d29){return db[_0x9110('0x17')][_0x9110('0x1d')]({'raw':_0x3b582c[_0x9110('0x1a')]?_0x3b582c[_0x9110('0x1a')][_0x9110('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b582c[_0x9110('0x1a')]?_0x3b582c['options']['where']||null:null,'attributes':[['campaign',_0x9110('0x2d')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x9110('0x1f')]['fn']('IF',db['sequelize'][_0x9110('0x20')](_0x9110('0x2e')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')](_0x9110('0x2f')))),_0x9110('0x30')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')](_0x9110('0x31')))),_0x9110('0x32')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')](_0x9110('0x33')))),_0x9110('0x34')],[db['sequelize']['fn']('COUNT',db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')](_0x9110('0x35')))),_0x9110('0x36')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9110('0x37')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db['sequelize']['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x9110('0x38')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')](_0x9110('0x39')))),_0x9110('0x3a')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')]['literal'](_0x9110('0x3b')))),_0x9110('0x3c')],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x9110('0x1f')]['fn']('COUNT',db[_0x9110('0x1f')]['fn']('IF',db['sequelize'][_0x9110('0x20')](_0x9110('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0x9110('0x1f')]['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db[_0x9110('0x1f')]['literal'](_0x9110('0x3e')))),_0x9110('0x3f')],[db['sequelize']['fn'](_0x9110('0x1e'),db['sequelize']['fn']('IF',db[_0x9110('0x1f')][_0x9110('0x20')](_0x9110('0x40')))),_0x9110('0x41')]],'group':[_0x9110('0x42')]})[_0x9110('0xb')](function(_0x48d4df){logger['info'](_0x9110('0x2c'),_0x3b582c);logger['debug'](_0x9110('0x2c'),_0x3b582c,JSON['stringify'](_0x48d4df));_0x240eac(_0x48d4df);})['catch'](function(_0x25d800){logger[_0x9110('0x11')]('GetVoiceQueueHopperHistory',_0x25d800[_0x9110('0x13')],_0x3b582c);_0x411d29(_0x4579ce[_0x9110('0x11')](0x1f4,_0x25d800[_0x9110('0x13')]));});});};exports[_0x9110('0x43')]=function(_0x214b83){var _0x107130=this;return new Promise(function(_0x4bae4c,_0x43f009){return db['CmHopperHistory'][_0x9110('0x1d')]({'raw':_0x214b83['options']?_0x214b83[_0x9110('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x214b83['options']?_0x214b83[_0x9110('0x1a')][_0x9110('0x44')]||null:null,'attributes':[[_0x9110('0x42'),_0x9110('0x2d')],[db['sequelize']['fn']('COUNT',db[_0x9110('0x1f')][_0x9110('0x45')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x9110('0x1e'),db[_0x9110('0x1f')]['fn']('IF',db['sequelize'][_0x9110('0x20')](_0x9110('0x2f')))),_0x9110('0x46')]],'group':['campaign']})[_0x9110('0xb')](function(_0x5a0def){logger[_0x9110('0xc')](_0x9110('0x43'),_0x214b83);logger[_0x9110('0xd')](_0x9110('0x43'),_0x214b83,JSON[_0x9110('0x10')](_0x5a0def));_0x4bae4c(_0x5a0def);})['catch'](function(_0xa27acf){logger['error']('GetCampaignHopperHistory',_0xa27acf[_0x9110('0x13')],_0x214b83);_0x43f009(_0x107130[_0x9110('0x11')](0x1f4,_0xa27acf['message']));});});}; \ No newline at end of file +var _0xd243=['predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','stringify','AvgHandleTime','findAll','where','COUNT','col','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd243,0xaa));var _0x3d24=function(_0x119733,_0x226cff){_0x119733=_0x119733-0x0;var _0x2bc54d=_0xd243[_0x119733];return _0x2bc54d;};'use strict';var _=require(_0x3d24('0x0'));var util=require('util');var moment=require(_0x3d24('0x1'));var BPromise=require(_0x3d24('0x2'));var rs=require(_0x3d24('0x3'));var fs=require('fs');var Redis=require(_0x3d24('0x4'));var db=require(_0x3d24('0x5'))['db'];var utils=require(_0x3d24('0x6'));var logger=require(_0x3d24('0x7'))(_0x3d24('0x8'));var config=require(_0x3d24('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3d24('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x578d73,_0x14310e,_0x160724){return new BPromise(function(_0x1d12a2,_0x242763){return client[_0x3d24('0xb')](_0x578d73,_0x160724)['then'](function(_0x3e3bf0){logger[_0x3d24('0xc')](_0x3d24('0xd'),_0x14310e,'request\x20sent');logger[_0x3d24('0xe')](_0x3d24('0xf'),_0x14310e,_0x3d24('0x10'),JSON['stringify'](_0x3e3bf0));if(_0x3e3bf0[_0x3d24('0x11')]){if(_0x3e3bf0[_0x3d24('0x11')][_0x3d24('0x12')]===0x1f4){logger[_0x3d24('0x11')](_0x3d24('0xd'),_0x14310e,_0x3e3bf0[_0x3d24('0x11')][_0x3d24('0x13')]);return _0x242763(_0x3e3bf0[_0x3d24('0x11')][_0x3d24('0x13')]);}logger['error'](_0x3d24('0xd'),_0x14310e,_0x3e3bf0[_0x3d24('0x11')][_0x3d24('0x13')]);return _0x1d12a2(_0x3e3bf0['error'][_0x3d24('0x13')]);}else{logger[_0x3d24('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x14310e,_0x3d24('0x10'));_0x1d12a2(_0x3e3bf0[_0x3d24('0x14')][_0x3d24('0x13')]);}})[_0x3d24('0x15')](function(_0x3773bc){logger['error'](_0x3d24('0xd'),_0x14310e,_0x3773bc);_0x242763(_0x3773bc);});});}exports[_0x3d24('0x16')]=function(_0x164e90){var _0x4d014a=this;return new Promise(function(_0xec4088,_0x46860c){return db[_0x3d24('0x17')][_0x3d24('0x18')](_0x164e90[_0x3d24('0x19')],{'raw':_0x164e90[_0x3d24('0x1a')]?_0x164e90[_0x3d24('0x1a')][_0x3d24('0x1b')]===undefined?!![]:![]:!![]})[_0x3d24('0x1c')](function(_0x4db59b){logger[_0x3d24('0xc')](_0x3d24('0x16'),_0x164e90);logger[_0x3d24('0xe')](_0x3d24('0x16'),_0x164e90,JSON[_0x3d24('0x1d')](_0x4db59b));_0xec4088(_0x4db59b);})[_0x3d24('0x15')](function(_0x53c0dc){logger[_0x3d24('0x11')]('CreateCmHopperHistory',_0x53c0dc[_0x3d24('0x13')],_0x164e90);_0x46860c(_0x4d014a[_0x3d24('0x11')](0x1f4,_0x53c0dc['message']));});});};exports[_0x3d24('0x1e')]=function(_0x1f0b19){var _0x259fc1=this;return new Promise(function(_0x55b28d,_0x33d91d){return db[_0x3d24('0x17')][_0x3d24('0x1f')]({'raw':_0x1f0b19['options']?_0x1f0b19['options'][_0x3d24('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f0b19[_0x3d24('0x1a')]?_0x1f0b19['options'][_0x3d24('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3d24('0x21'),db['sequelize'][_0x3d24('0x22')]('id')),'predictiveIntervalTotalCalls'],[db[_0x3d24('0x23')]['fn']('COUNT',db[_0x3d24('0x23')]['fn']('IF',db['sequelize'][_0x3d24('0x24')](_0x3d24('0x25')))),_0x3d24('0x26')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db[_0x3d24('0x23')]['fn']('IF',db[_0x3d24('0x23')]['literal'](_0x3d24('0x27')))),_0x3d24('0x28')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db['sequelize']['fn']('IF',db[_0x3d24('0x23')][_0x3d24('0x24')](_0x3d24('0x29')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x3d24('0x23')]['fn']('AVG',db[_0x3d24('0x23')]['fn']('IF',db[_0x3d24('0x23')][_0x3d24('0x24')](_0x3d24('0x2a')))),_0x3d24('0x2b')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x2c'),db['sequelize']['fn']('IF',db[_0x3d24('0x23')]['literal'](_0x3d24('0x2d')))),_0x3d24('0x2e')]]})[_0x3d24('0x1c')](function(_0x58d574){logger[_0x3d24('0xc')](_0x3d24('0x1e'),_0x1f0b19);logger[_0x3d24('0xe')](_0x3d24('0x1e'),_0x1f0b19,JSON[_0x3d24('0x1d')](_0x58d574));_0x55b28d(_0x58d574);})[_0x3d24('0x15')](function(_0x52ba0a){logger[_0x3d24('0x11')](_0x3d24('0x1e'),_0x52ba0a[_0x3d24('0x13')],_0x1f0b19);_0x33d91d(_0x259fc1[_0x3d24('0x11')](0x1f4,_0x52ba0a[_0x3d24('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x23312a){var _0x371fd3=this;return new Promise(function(_0x54f73a,_0x5e6fa2){return db[_0x3d24('0x17')][_0x3d24('0x1f')]({'raw':_0x23312a[_0x3d24('0x1a')]?_0x23312a[_0x3d24('0x1a')][_0x3d24('0x1b')]===undefined?!![]:![]:!![],'where':_0x23312a[_0x3d24('0x1a')]?_0x23312a[_0x3d24('0x1a')][_0x3d24('0x20')]||null:null,'attributes':[['campaign',_0x3d24('0x2f')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db[_0x3d24('0x23')]['fn']('IF',db[_0x3d24('0x23')]['literal'](_0x3d24('0x30')))),_0x3d24('0x31')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x3d24('0x32')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db['sequelize']['fn']('IF',db[_0x3d24('0x23')][_0x3d24('0x24')](_0x3d24('0x25')))),_0x3d24('0x33')],[db['sequelize']['fn'](_0x3d24('0x21'),db[_0x3d24('0x23')]['fn']('IF',db[_0x3d24('0x23')][_0x3d24('0x24')](_0x3d24('0x34')))),_0x3d24('0x35')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db[_0x3d24('0x23')]['fn']('IF',db[_0x3d24('0x23')][_0x3d24('0x24')]('`state`\x20=\x208,\x201,\x20null'))),_0x3d24('0x36')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3d24('0x23')][_0x3d24('0x24')](_0x3d24('0x37')))),_0x3d24('0x38')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db['sequelize']['fn']('IF',db[_0x3d24('0x23')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3d24('0x39')],[db[_0x3d24('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3d24('0x24')](_0x3d24('0x3a')))),'outboundUnknownCallsDay'],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db[_0x3d24('0x23')]['fn']('IF',db[_0x3d24('0x23')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x3d24('0x3b')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db['sequelize']['fn']('IF',db[_0x3d24('0x23')][_0x3d24('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),_0x3d24('0x3c')],[db['sequelize']['fn'](_0x3d24('0x21'),db[_0x3d24('0x23')]['fn']('IF',db[_0x3d24('0x23')]['literal'](_0x3d24('0x3d')))),'outboundRejectCallsDay'],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db[_0x3d24('0x23')]['fn']('IF',db['sequelize'][_0x3d24('0x24')](_0x3d24('0x3e')))),'outboundAnswerAgiCallsDay'],[db[_0x3d24('0x23')]['fn']('COUNT',db[_0x3d24('0x23')]['fn']('IF',db[_0x3d24('0x23')]['literal'](_0x3d24('0x3f')))),_0x3d24('0x40')],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db[_0x3d24('0x23')]['fn']('IF',db[_0x3d24('0x23')][_0x3d24('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x3d24('0x41')]],'group':[_0x3d24('0x42')]})['then'](function(_0x3f5888){logger[_0x3d24('0xc')](_0x3d24('0x43'),_0x23312a);logger[_0x3d24('0xe')]('GetVoiceQueueHopperHistory',_0x23312a,JSON['stringify'](_0x3f5888));_0x54f73a(_0x3f5888);})[_0x3d24('0x15')](function(_0x192dde){logger[_0x3d24('0x11')](_0x3d24('0x43'),_0x192dde['message'],_0x23312a);_0x5e6fa2(_0x371fd3[_0x3d24('0x11')](0x1f4,_0x192dde[_0x3d24('0x13')]));});});};exports[_0x3d24('0x44')]=function(_0x2a94ad){var _0x2b0870=this;return new Promise(function(_0x1f5635,_0x57caea){return db[_0x3d24('0x17')][_0x3d24('0x1f')]({'raw':_0x2a94ad[_0x3d24('0x1a')]?_0x2a94ad[_0x3d24('0x1a')][_0x3d24('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a94ad[_0x3d24('0x1a')]?_0x2a94ad['options'][_0x3d24('0x20')]||null:null,'attributes':[[_0x3d24('0x42'),'name'],[db[_0x3d24('0x23')]['fn'](_0x3d24('0x21'),db[_0x3d24('0x23')][_0x3d24('0x22')]('id')),_0x3d24('0x45')],[db[_0x3d24('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3d24('0x23')][_0x3d24('0x24')](_0x3d24('0x25')))),_0x3d24('0x46')]],'group':[_0x3d24('0x42')]})[_0x3d24('0x1c')](function(_0x4405f6){logger[_0x3d24('0xc')]('GetCampaignHopperHistory',_0x2a94ad);logger[_0x3d24('0xe')](_0x3d24('0x44'),_0x2a94ad,JSON[_0x3d24('0x1d')](_0x4405f6));_0x1f5635(_0x4405f6);})[_0x3d24('0x15')](function(_0x5f5bfb){logger[_0x3d24('0x11')](_0x3d24('0x44'),_0x5f5bfb[_0x3d24('0x13')],_0x2a94ad);_0x57caea(_0x2b0870[_0x3d24('0x11')](0x1f4,_0x5f5bfb[_0x3d24('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 6bafc96..0e72ac3 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 _0xe9fb=['post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','show'];(function(_0x311aa6,_0x5c99d0){var _0x3039c5=function(_0x14518e){while(--_0x14518e){_0x311aa6['push'](_0x311aa6['shift']());}};_0x3039c5(++_0x5c99d0);}(_0xe9fb,0x6a));var _0xbe9f=function(_0x22655c,_0x539b9a){_0x22655c=_0x22655c-0x0;var _0x138bbc=_0xe9fb[_0x22655c];return _0x138bbc;};'use strict';var multer=require(_0xbe9f('0x0'));var util=require(_0xbe9f('0x1'));var path=require(_0xbe9f('0x2'));var timeout=require(_0xbe9f('0x3'));var express=require(_0xbe9f('0x4'));var router=express[_0xbe9f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbe9f('0x6'));var interaction=require(_0xbe9f('0x7'));var config=require(_0xbe9f('0x8'));var controller=require(_0xbe9f('0x9'));router[_0xbe9f('0xa')]('/',auth[_0xbe9f('0xb')](),controller[_0xbe9f('0xc')]);router['get']('/describe',auth[_0xbe9f('0xb')](),controller['describe']);router[_0xbe9f('0xa')]('/:id',auth[_0xbe9f('0xb')](),controller[_0xbe9f('0xd')]);router[_0xbe9f('0xe')]('/',auth[_0xbe9f('0xb')](),controller[_0xbe9f('0xf')]);router[_0xbe9f('0x10')](_0xbe9f('0x11'),auth[_0xbe9f('0xb')](),controller[_0xbe9f('0x12')]);module[_0xbe9f('0x13')]=router; \ No newline at end of file +var _0x58bd=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','exports','path','connect-timeout','express'];(function(_0x1dffb2,_0x38fba6){var _0x1fd396=function(_0x4fa541){while(--_0x4fa541){_0x1dffb2['push'](_0x1dffb2['shift']());}};_0x1fd396(++_0x38fba6);}(_0x58bd,0x10b));var _0xd58b=function(_0x2a0418,_0x1634b8){_0x2a0418=_0x2a0418-0x0;var _0x701cf0=_0x58bd[_0x2a0418];return _0x701cf0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd58b('0x0'));var timeout=require(_0xd58b('0x1'));var express=require(_0xd58b('0x2'));var router=express[_0xd58b('0x3')]();var fs_extra=require(_0xd58b('0x4'));var auth=require(_0xd58b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd58b('0x6'));var controller=require('./cmHopperHistory.controller');router[_0xd58b('0x7')]('/',auth[_0xd58b('0x8')](),controller['index']);router[_0xd58b('0x7')](_0xd58b('0x9'),auth[_0xd58b('0x8')](),controller[_0xd58b('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd58b('0xb')]);router[_0xd58b('0xc')]('/',auth[_0xd58b('0x8')](),controller[_0xd58b('0xd')]);router[_0xd58b('0xe')](_0xd58b('0xf'),auth['isAuthenticated'](),controller[_0xd58b('0x10')]);module[_0xd58b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 753d550..2be1902 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 _0xd4d1=['exports','STRING','name','sequelize'];(function(_0x109417,_0x45c6f3){var _0x11e088=function(_0x4eadbf){while(--_0x4eadbf){_0x109417['push'](_0x109417['shift']());}};_0x11e088(++_0x45c6f3);}(_0xd4d1,0x123));var _0x1d4d=function(_0x1057c4,_0x1c302d){_0x1057c4=_0x1057c4-0x0;var _0x2cb1bc=_0xd4d1[_0x1057c4];return _0x2cb1bc;};'use strict';var Sequelize=require(_0x1d4d('0x0'));module[_0x1d4d('0x1')]={'name':{'type':Sequelize[_0x1d4d('0x2')],'unique':_0x1d4d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d4d('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe198=['sequelize','exports','STRING'];(function(_0x24b3a5,_0x24d2ca){var _0x89d857=function(_0x4bfa43){while(--_0x4bfa43){_0x24b3a5['push'](_0x24b3a5['shift']());}};_0x89d857(++_0x24d2ca);}(_0xe198,0x6f));var _0x8e19=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe198[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x8e19('0x0'));module[_0x8e19('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8e19('0x2')]},'dialPrefix':{'type':Sequelize[_0x8e19('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 099aeb3..c8008b2 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 _0xb5c9=['query','filters','intersection','fields','attributes','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','findOne','Disposition','nolimit','order','rows','removeDispositions','addContacts','tags','join','isArray','omit','ids','success','push','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','hasOwnProperty','raw','ContactItemType','OrderBy','CmContact','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','select','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','ItemTypeId\x20=\x20?','toString','isEmpty','now','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sendStatus','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','INTEGER','BOOLEAN','defaultValue','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','getAgents','User','info','eml-format','rimraf','zip-dir','moment','bluebird','mustache','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','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model'];(function(_0x45b248,_0x1fd5a9){var _0x3c2880=function(_0x46ea13){while(--_0x46ea13){_0x45b248['push'](_0x45b248['shift']());}};_0x3c2880(++_0x1fd5a9);}(_0xb5c9,0x69));var _0x9b5c=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb5c9[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x9b5c('0x0'));var rimraf=require(_0x9b5c('0x1'));var zipdir=require(_0x9b5c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9b5c('0x3'));var BPromise=require(_0x9b5c('0x4'));var Mustache=require(_0x9b5c('0x5'));var util=require('util');var path=require(_0x9b5c('0x6'));var sox=require(_0x9b5c('0x7'));var csv=require(_0x9b5c('0x8'));var ejs=require(_0x9b5c('0x9'));var fs=require('fs');var fs_extra=require(_0x9b5c('0xa'));var _=require('lodash');var squel=require(_0x9b5c('0xb'));var crypto=require('crypto');var jsforce=require(_0x9b5c('0xc'));var deskjs=require(_0x9b5c('0xd'));var toCsv=require(_0x9b5c('0x8'));var querystring=require(_0x9b5c('0xe'));var Papa=require(_0x9b5c('0xf'));var Redis=require(_0x9b5c('0x10'));var authService=require(_0x9b5c('0x11'));var qs=require(_0x9b5c('0x12'));var as=require(_0x9b5c('0x13'));var hardwareService=require(_0x9b5c('0x14'));var logger=require(_0x9b5c('0x15'))(_0x9b5c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9b5c('0x17'));var db=require(_0x9b5c('0x18'))['db'];var csv_results;config[_0x9b5c('0x19')]=_[_0x9b5c('0x1a')](config[_0x9b5c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b5c('0x1b'))(new Redis(config[_0x9b5c('0x19')]));require(_0x9b5c('0x1c'))[_0x9b5c('0x1d')](socket);function respondWithStatusCode(_0x49b486,_0x3af00a){_0x3af00a=_0x3af00a||0xcc;return function(_0x5ea229){if(_0x5ea229){return _0x49b486['sendStatus'](_0x3af00a);}return _0x49b486[_0x9b5c('0x1e')](_0x3af00a)[_0x9b5c('0x1f')]();};}function respondWithResult(_0x2fd1f6,_0x4405dd){_0x4405dd=_0x4405dd||0xc8;return function(_0x1b6a4e){if(_0x1b6a4e){return _0x2fd1f6['status'](_0x4405dd)[_0x9b5c('0x20')](_0x1b6a4e);}};}function respondWithFilteredResult(_0x3187dc,_0x373036){return function(_0x5e12fa){if(_0x5e12fa){var _0x36762d=typeof _0x373036[_0x9b5c('0x21')]===_0x9b5c('0x22')&&typeof _0x373036[_0x9b5c('0x23')]===_0x9b5c('0x22');var _0x50a74f=_0x5e12fa[_0x9b5c('0x24')];var _0x3f5932=_0x36762d?0x0:_0x373036['offset'];var _0x3ad7bc=_0x36762d?_0x5e12fa[_0x9b5c('0x24')]:_0x373036[_0x9b5c('0x21')]+_0x373036[_0x9b5c('0x23')];var _0x46488c;if(_0x3ad7bc>=_0x50a74f){_0x3ad7bc=_0x50a74f;_0x46488c=0xc8;}else{_0x46488c=0xce;}_0x3187dc[_0x9b5c('0x1e')](_0x46488c);return _0x3187dc[_0x9b5c('0x25')](_0x9b5c('0x26'),_0x3f5932+'-'+_0x3ad7bc+'/'+_0x50a74f)[_0x9b5c('0x20')](_0x5e12fa);}return null;};}function patchUpdates(_0x3cbc81){return function(_0x7ef2f6){try{jsonpatch[_0x9b5c('0x27')](_0x7ef2f6,_0x3cbc81,!![]);}catch(_0x47dd46){return BPromise['reject'](_0x47dd46);}return _0x7ef2f6[_0x9b5c('0x28')]();};}function saveUpdates(_0x1d3bc4,_0x2c0703){return function(_0x5170c2){if(_0x5170c2){return _0x5170c2[_0x9b5c('0x29')](_0x1d3bc4)['then'](function(_0x2576b5){return _0x2576b5;});}return null;};}function removeEntity(_0x31fba1,_0x11e0dd){return function(_0x43cb6b){if(_0x43cb6b){return _0x43cb6b[_0x9b5c('0x2a')]()['then'](function(){var _0x1cb9fb=_0x43cb6b[_0x9b5c('0x2b')]({'plain':!![]});var _0x432fbd='Lists';return db[_0x9b5c('0x2c')]['destroy']({'where':{'type':_0x432fbd,'resourceId':_0x1cb9fb['id']}})[_0x9b5c('0x2d')](function(){return _0x43cb6b;});})[_0x9b5c('0x2d')](function(){_0x31fba1[_0x9b5c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3605ee,_0x4bfd40){return function(_0x1225b5){if(!_0x1225b5){_0x3605ee['sendStatus'](0x194);}return _0x1225b5;};}function handleError(_0x1b09da,_0x10a88f){_0x10a88f=_0x10a88f||0x1f4;return function(_0x176a81){logger[_0x9b5c('0x2e')](_0x176a81[_0x9b5c('0x2f')]);if(_0x176a81[_0x9b5c('0x30')]){delete _0x176a81[_0x9b5c('0x30')];}_0x1b09da[_0x9b5c('0x1e')](_0x10a88f)[_0x9b5c('0x31')](_0x176a81);};}exports[_0x9b5c('0x32')]=function(_0x83bf3d,_0x4c9402){var _0x5eba0b={},_0x4fff39={},_0x33353d={'count':0x0,'rows':[]};var _0x5fed85=_[_0x9b5c('0x33')](db[_0x9b5c('0x34')][_0x9b5c('0x35')],function(_0x3896ce){return{'name':_0x3896ce[_0x9b5c('0x36')],'type':_0x3896ce[_0x9b5c('0x37')][_0x9b5c('0x38')]};});_0x4fff39[_0x9b5c('0x39')]=_['map'](_0x5fed85,_0x9b5c('0x30'));_0x4fff39[_0x9b5c('0x3a')]=_['keys'](_0x83bf3d[_0x9b5c('0x3a')]);_0x4fff39[_0x9b5c('0x3b')]=_['intersection'](_0x4fff39[_0x9b5c('0x39')],_0x4fff39[_0x9b5c('0x3a')]);_0x5eba0b['attributes']=_[_0x9b5c('0x3c')](_0x4fff39['model'],qs[_0x9b5c('0x3d')](_0x83bf3d['query'][_0x9b5c('0x3d')]));_0x5eba0b[_0x9b5c('0x3e')]=_0x5eba0b[_0x9b5c('0x3e')]['length']?_0x5eba0b[_0x9b5c('0x3e')]:_0x4fff39[_0x9b5c('0x39')];if(!_0x83bf3d[_0x9b5c('0x3a')]['hasOwnProperty']('nolimit')){_0x5eba0b[_0x9b5c('0x23')]=qs[_0x9b5c('0x23')](_0x83bf3d[_0x9b5c('0x3a')][_0x9b5c('0x23')]);_0x5eba0b[_0x9b5c('0x21')]=qs[_0x9b5c('0x21')](_0x83bf3d['query'][_0x9b5c('0x21')]);}_0x5eba0b['order']=qs[_0x9b5c('0x3f')](_0x83bf3d[_0x9b5c('0x3a')][_0x9b5c('0x3f')]);_0x5eba0b['where']=qs[_0x9b5c('0x3b')](_[_0x9b5c('0x40')](_0x83bf3d['query'],_0x4fff39[_0x9b5c('0x3b')]),_0x5fed85);if(_0x83bf3d['query'][_0x9b5c('0x41')]){_0x5eba0b[_0x9b5c('0x42')]=_[_0x9b5c('0x43')](_0x5eba0b[_0x9b5c('0x42')],{'$or':_[_0x9b5c('0x33')](_0x5fed85,function(_0xdda5b8){if(_0xdda5b8[_0x9b5c('0x37')]!=='VIRTUAL'){var _0x868635={};_0x868635[_0xdda5b8['name']]={'$like':'%'+_0x83bf3d[_0x9b5c('0x3a')][_0x9b5c('0x41')]+'%'};return _0x868635;}})});}_0x5eba0b=_['merge']({},_0x5eba0b,_0x83bf3d[_0x9b5c('0x44')]);var _0x1766a7={'where':_0x5eba0b[_0x9b5c('0x42')]};return db[_0x9b5c('0x34')][_0x9b5c('0x24')](_0x1766a7)['then'](function(_0x487dca){_0x33353d['count']=_0x487dca;if(_0x83bf3d[_0x9b5c('0x3a')][_0x9b5c('0x45')]){_0x5eba0b[_0x9b5c('0x46')]=[{'all':!![]}];}return db[_0x9b5c('0x34')][_0x9b5c('0x47')](_0x5eba0b);})[_0x9b5c('0x2d')](function(_0x37aac7){_0x33353d['rows']=_0x37aac7;return _0x33353d;})['then'](respondWithFilteredResult(_0x4c9402,_0x5eba0b))['catch'](handleError(_0x4c9402,null));};exports[_0x9b5c('0x48')]=function(_0x596dfc,_0x46dd2b){var _0x11f56f={'raw':![],'where':{'id':_0x596dfc[_0x9b5c('0x49')]['id']}},_0x47dc60={};_0x47dc60[_0x9b5c('0x39')]=_[_0x9b5c('0x4a')](db[_0x9b5c('0x34')][_0x9b5c('0x35')]);_0x47dc60[_0x9b5c('0x3a')]=_['keys'](_0x596dfc[_0x9b5c('0x3a')]);_0x47dc60[_0x9b5c('0x3b')]=_['intersection'](_0x47dc60[_0x9b5c('0x39')],_0x47dc60[_0x9b5c('0x3a')]);_0x11f56f[_0x9b5c('0x3e')]=_[_0x9b5c('0x3c')](_0x47dc60[_0x9b5c('0x39')],qs['fields'](_0x596dfc[_0x9b5c('0x3a')][_0x9b5c('0x3d')]));_0x11f56f['attributes']=_0x11f56f[_0x9b5c('0x3e')][_0x9b5c('0x4b')]?_0x11f56f[_0x9b5c('0x3e')]:_0x47dc60[_0x9b5c('0x39')];if(_0x596dfc[_0x9b5c('0x3a')][_0x9b5c('0x45')]){_0x11f56f[_0x9b5c('0x46')]=[{'all':!![]}];}_0x11f56f=_[_0x9b5c('0x43')]({},_0x11f56f,_0x596dfc['options']);return db['CmList']['find'](_0x11f56f)[_0x9b5c('0x2d')](handleEntityNotFound(_0x46dd2b,null))[_0x9b5c('0x2d')](respondWithResult(_0x46dd2b,null))['catch'](handleError(_0x46dd2b,null));};exports[_0x9b5c('0x4c')]=function(_0x1239d5,_0x31d740){return db[_0x9b5c('0x34')][_0x9b5c('0x4c')](_0x1239d5[_0x9b5c('0x4d')],{})[_0x9b5c('0x2d')](function(_0x43c58d){var _0xd757f8=_0x1239d5[_0x9b5c('0x4e')][_0x9b5c('0x2b')]({'plain':!![]});if(!_0xd757f8)throw new Error(_0x9b5c('0x4f'));if(_0xd757f8[_0x9b5c('0x50')]===_0x9b5c('0x4e')){var _0x1b7253=_0x43c58d[_0x9b5c('0x2b')]({'plain':!![]});var _0x4f6adb=_0x9b5c('0x51');return db[_0x9b5c('0x52')][_0x9b5c('0x53')]({'where':{'name':_0x4f6adb,'userProfileId':_0xd757f8[_0x9b5c('0x54')]},'raw':!![]})[_0x9b5c('0x2d')](function(_0xe1c73a){if(_0xe1c73a&&_0xe1c73a['autoAssociation']===0x0){return db[_0x9b5c('0x2c')][_0x9b5c('0x4c')]({'name':_0x1b7253['name'],'resourceId':_0x1b7253['id'],'type':_0xe1c73a[_0x9b5c('0x30')],'sectionId':_0xe1c73a['id']},{})[_0x9b5c('0x2d')](function(){return _0x43c58d;});}else{return _0x43c58d;}})[_0x9b5c('0x55')](function(_0x38e959){logger['error'](_0x9b5c('0x56'),_0x38e959);throw _0x38e959;});}return _0x43c58d;})['then'](respondWithResult(_0x31d740,0xc9))[_0x9b5c('0x55')](handleError(_0x31d740,null));};exports[_0x9b5c('0x29')]=function(_0x115e95,_0x5756bb){if(_0x115e95[_0x9b5c('0x4d')]['id']){delete _0x115e95[_0x9b5c('0x4d')]['id'];}return db[_0x9b5c('0x34')]['find']({'where':{'id':_0x115e95[_0x9b5c('0x49')]['id']}})[_0x9b5c('0x2d')](handleEntityNotFound(_0x5756bb,null))['then'](saveUpdates(_0x115e95[_0x9b5c('0x4d')],null))[_0x9b5c('0x2d')](respondWithResult(_0x5756bb,null))[_0x9b5c('0x55')](handleError(_0x5756bb,null));};exports[_0x9b5c('0x2a')]=function(_0x14ae41,_0x511567){return db[_0x9b5c('0x34')][_0x9b5c('0x53')]({'where':{'id':_0x14ae41[_0x9b5c('0x49')]['id']}})['then'](handleEntityNotFound(_0x511567,null))[_0x9b5c('0x2d')](removeEntity(_0x511567,null))[_0x9b5c('0x55')](handleError(_0x511567,null));};exports[_0x9b5c('0x57')]=function(_0xa1b89,_0x1da4de){return db['CmList'][_0x9b5c('0x57')]()['then'](respondWithResult(_0x1da4de,null))[_0x9b5c('0x55')](handleError(_0x1da4de,null));};exports[_0x9b5c('0x58')]=function(_0x5d6f1a,_0x55c525,_0x41e971){if(_0x5d6f1a[_0x9b5c('0x4d')]['id']){delete _0x5d6f1a[_0x9b5c('0x4d')]['id'];}return db[_0x9b5c('0x34')][_0x9b5c('0x53')]({'where':{'id':_0x5d6f1a[_0x9b5c('0x49')]['id']}})[_0x9b5c('0x2d')](handleEntityNotFound(_0x55c525,null))['then'](function(_0x327512){if(_0x327512){_0x5d6f1a[_0x9b5c('0x4d')][_0x9b5c('0x59')]=_0x327512['id'];return db['Disposition'][_0x9b5c('0x4c')](_0x5d6f1a[_0x9b5c('0x4d')]);}})[_0x9b5c('0x2d')](respondWithResult(_0x55c525,null))['catch'](handleError(_0x55c525,null));};exports[_0x9b5c('0x5a')]=function(_0x17638c,_0x2999d7,_0x1d968d){var _0x2c2e2b={'raw':![],'where':{}};var _0xc87f0={};var _0x1a149a={'count':0x0,'rows':[]};return db[_0x9b5c('0x34')][_0x9b5c('0x5b')]({'where':{'id':_0x17638c['params']['id']}})[_0x9b5c('0x2d')](handleEntityNotFound(_0x2999d7,null))[_0x9b5c('0x2d')](function(_0x4b03a8){if(_0x4b03a8){_0xc87f0[_0x9b5c('0x39')]=_[_0x9b5c('0x4a')](db[_0x9b5c('0x5c')][_0x9b5c('0x35')]);_0xc87f0['query']=_['keys'](_0x17638c['query']);_0xc87f0[_0x9b5c('0x3b')]=_['intersection'](_0xc87f0[_0x9b5c('0x39')],_0xc87f0['query']);_0x2c2e2b[_0x9b5c('0x3e')]=_[_0x9b5c('0x3c')](_0xc87f0[_0x9b5c('0x39')],qs[_0x9b5c('0x3d')](_0x17638c['query']['fields']));_0x2c2e2b['attributes']=_0x2c2e2b[_0x9b5c('0x3e')][_0x9b5c('0x4b')]?_0x2c2e2b[_0x9b5c('0x3e')]:_0xc87f0[_0x9b5c('0x39')];if(!_0x17638c[_0x9b5c('0x3a')]['hasOwnProperty'](_0x9b5c('0x5d'))){_0x2c2e2b['limit']=qs['limit'](_0x17638c[_0x9b5c('0x3a')]['limit']);_0x2c2e2b[_0x9b5c('0x21')]=qs['offset'](_0x17638c[_0x9b5c('0x3a')][_0x9b5c('0x21')]);}_0x2c2e2b[_0x9b5c('0x5e')]=qs['sort'](_0x17638c[_0x9b5c('0x3a')]['sort']);_0x2c2e2b[_0x9b5c('0x42')]=qs[_0x9b5c('0x3b')](_['pick'](_0x17638c['query'],_0xc87f0[_0x9b5c('0x3b')]));_0x2c2e2b[_0x9b5c('0x42')][_0x9b5c('0x59')]=_0x4b03a8['id'];if(_0x17638c['query'][_0x9b5c('0x41')]){_0x2c2e2b[_0x9b5c('0x42')]=_[_0x9b5c('0x43')](_0x2c2e2b['where'],{'$or':_[_0x9b5c('0x33')](_0x2c2e2b['attributes'],function(_0x5806ca){var _0x565b91={};_0x565b91[_0x5806ca]={'$like':'%'+_0x17638c[_0x9b5c('0x3a')][_0x9b5c('0x41')]+'%'};return _0x565b91;})});}_0x2c2e2b=_[_0x9b5c('0x43')]({},_0x2c2e2b,_0x17638c[_0x9b5c('0x44')]);return db[_0x9b5c('0x5c')]['count']({'where':_0x2c2e2b[_0x9b5c('0x42')]})[_0x9b5c('0x2d')](function(_0x35e683){_0x1a149a['count']=_0x35e683;if(_0x17638c[_0x9b5c('0x3a')][_0x9b5c('0x45')]){_0x2c2e2b[_0x9b5c('0x46')]=[{'all':!![]}];}return db['Disposition'][_0x9b5c('0x47')](_0x2c2e2b);})[_0x9b5c('0x2d')](function(_0xdeb3da){_0x1a149a[_0x9b5c('0x5f')]=_0xdeb3da;return _0x1a149a;});}})['then'](respondWithFilteredResult(_0x2999d7,_0x2c2e2b))[_0x9b5c('0x55')](handleError(_0x2999d7,null));};exports[_0x9b5c('0x60')]=function(_0x21c8cc,_0x247f71,_0x4ce7db){return db[_0x9b5c('0x34')][_0x9b5c('0x53')]({'where':{'id':_0x21c8cc[_0x9b5c('0x49')]['id']}})[_0x9b5c('0x2d')](handleEntityNotFound(_0x247f71,null))[_0x9b5c('0x2d')](function(_0x5bff90){if(_0x5bff90){return _0x5bff90['removeDispositions'](_0x21c8cc[_0x9b5c('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x247f71,null))[_0x9b5c('0x55')](handleError(_0x247f71,null));};exports[_0x9b5c('0x61')]=function(_0x218fbb,_0x18a75a,_0x1dde02){return db[_0x9b5c('0x34')][_0x9b5c('0x53')]({'where':{'id':_0x218fbb[_0x9b5c('0x49')]['id']}})[_0x9b5c('0x2d')](handleEntityNotFound(_0x18a75a,null))[_0x9b5c('0x2d')](function(_0x496606){if(_0x496606){var _0x9d4595=[];var _0x383f1c={'success':[],'errors':[]};return db['CmContact'][_0x9b5c('0x57')]()[_0x9b5c('0x2d')](function(_0x498d4d){if(_0x218fbb[_0x9b5c('0x4d')][_0x9b5c('0x62')]&&_['isArray'](_0x218fbb[_0x9b5c('0x4d')][_0x9b5c('0x62')])){if(_0x218fbb[_0x9b5c('0x4d')]['tags'][_0x9b5c('0x4b')]){_0x218fbb[_0x9b5c('0x4d')][_0x9b5c('0x62')]=_0x218fbb['body'][_0x9b5c('0x62')][_0x9b5c('0x63')](';')+';';}else{_0x218fbb['body']['tags']=null;}}else{_0x218fbb[_0x9b5c('0x4d')][_0x9b5c('0x62')]=null;}if(_0x218fbb[_0x9b5c('0x4d')]&&_[_0x9b5c('0x64')](_0x218fbb[_0x9b5c('0x4d')])){for(var _0x4d590f=0x0;_0x4d590f<_0x218fbb['body'][_0x9b5c('0x4b')];_0x4d590f+=0x1){_0x218fbb[_0x9b5c('0x4d')][_0x4d590f]['ListId']=_0x218fbb['params']['id'];_0x9d4595['push'](_0x218fbb[_0x9b5c('0x4d')][_0x4d590f]);}return BPromise['each'](_0x9d4595,function(_0xb3aadc){return db['CmContact']['create'](_[_0x9b5c('0x65')](_0xb3aadc,[_0x9b5c('0x66'),'id'])||{},{'fields':_[_0x9b5c('0x4a')](_0x498d4d),'raw':!![]})['then'](function(_0x14f7fb){_0x383f1c[_0x9b5c('0x67')][_0x9b5c('0x68')](_0x14f7fb[_0x9b5c('0x69')]);})[_0x9b5c('0x55')](function(_0x47d8bc){_0x383f1c['errors'][_0x9b5c('0x68')]({'data':_0xb3aadc,'error':_0x47d8bc[_0x9b5c('0x6a')]});});})[_0x9b5c('0x2d')](function(_0x9ac5dc){return _0x383f1c;})[_0x9b5c('0x55')](function(_0x278a48){return _0x278a48;});}else{_0x18a75a['status'](0x190)['json']({'message':_0x9b5c('0x6b')});}});}})['then'](respondWithResult(_0x18a75a,null))['catch'](handleError(_0x18a75a,null));};exports[_0x9b5c('0x6c')]=function(_0x58d3bd,_0x2a9d33,_0x3c4b14){var _0x5d4fc7;return db[_0x9b5c('0x34')][_0x9b5c('0x53')]({'where':{'id':_0x58d3bd[_0x9b5c('0x49')]['id']},'include':[{'model':db[_0x9b5c('0x6d')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x2a9d33,null))[_0x9b5c('0x2d')](function(_0x2dbf7d){if(_0x2dbf7d){_0x5d4fc7=_0x2dbf7d;return db['CmContact'][_0x9b5c('0x35')];}})[_0x9b5c('0x2d')](function(_0x31683d){if(_0x31683d){var _0x1b0c65={};var _0x3bad86={};_0x3bad86[_0x9b5c('0x39')]=_[_0x9b5c('0x6e')](_[_0x9b5c('0x4a')](_0x31683d),_[_0x9b5c('0x33')](_0x5d4fc7[_0x9b5c('0x6f')],function(_0x1b89a6){return util[_0x9b5c('0x70')](_0x9b5c('0x71'),_0x1b89a6['id']);}));_0x3bad86[_0x9b5c('0x3a')]=_[_0x9b5c('0x4a')](_0x58d3bd[_0x9b5c('0x3a')]);_0x3bad86[_0x9b5c('0x3b')]=_[_0x9b5c('0x3c')](_0x3bad86[_0x9b5c('0x39')],_0x3bad86['query']);_0x1b0c65['attributes']=_['intersection'](_0x3bad86[_0x9b5c('0x39')],qs[_0x9b5c('0x3d')](_0x58d3bd[_0x9b5c('0x3a')]['fields']));_0x1b0c65['attributes']=_0x1b0c65['attributes'][_0x9b5c('0x4b')]?_0x1b0c65['attributes']:_0x3bad86[_0x9b5c('0x39')];if(!_0x58d3bd['query'][_0x9b5c('0x72')](_0x9b5c('0x5d'))){_0x1b0c65[_0x9b5c('0x23')]=qs['limit'](_0x58d3bd[_0x9b5c('0x3a')][_0x9b5c('0x23')]);_0x1b0c65[_0x9b5c('0x21')]=qs[_0x9b5c('0x21')](_0x58d3bd[_0x9b5c('0x3a')][_0x9b5c('0x21')]);}_0x1b0c65[_0x9b5c('0x5e')]=qs[_0x9b5c('0x3f')](_0x58d3bd[_0x9b5c('0x3a')][_0x9b5c('0x3f')]);_0x1b0c65['where']=qs[_0x9b5c('0x3b')](_[_0x9b5c('0x40')](_0x58d3bd[_0x9b5c('0x3a')],_0x3bad86[_0x9b5c('0x3b')]));_0x1b0c65[_0x9b5c('0x73')]=!![];if(_0x58d3bd[_0x9b5c('0x3a')][_0x9b5c('0x41')]){_0x1b0c65[_0x9b5c('0x42')]=_['merge'](_0x1b0c65[_0x9b5c('0x42')],{'$or':_[_0x9b5c('0x33')](_0x1b0c65[_0x9b5c('0x3e')],function(_0x5cfe44){var _0x4b07a4={};_0x4b07a4[_0x5cfe44]={'$like':'%'+_0x58d3bd[_0x9b5c('0x3a')][_0x9b5c('0x41')]+'%'};return _0x4b07a4;})});}_0x1b0c65=_[_0x9b5c('0x43')]({},_0x1b0c65,_0x58d3bd[_0x9b5c('0x44')]);return _0x5d4fc7[_0x9b5c('0x6c')](_0x1b0c65);}})['then'](respondWithResult(_0x2a9d33,null))[_0x9b5c('0x55')](handleError(_0x2a9d33,null));};exports['getContactsCsv']=function(_0x43b2de,_0x60df4f,_0x57bcc3){var _0x8fd523;var _0x18c8ff;var _0x17b4a7;var _0x4015e4=_0x43b2de[_0x9b5c('0x49')]['id'];csv_results=[];return db[_0x9b5c('0x74')][_0x9b5c('0x47')]({'attributes':['id',_0x9b5c('0x30')],'raw':!![],'order':[_0x9b5c('0x75')]})[_0x9b5c('0x2d')](function(_0x3da4bb){_0x8fd523=_0x3da4bb;var _0x2dc125=_[_0x9b5c('0x4a')](db[_0x9b5c('0x76')]['rawAttributes']);return db['CmCustomField'][_0x9b5c('0x47')]({'raw':!![],'attributes':['id',_0x9b5c('0x77')]})[_0x9b5c('0x2d')](function(_0x4bab8a){_0x18c8ff=_0x4bab8a;var _0x3687ff=squel['select']()[_0x9b5c('0x3d')](_0x2dc125)[_0x9b5c('0x78')](_0x9b5c('0x79'),'c')[_0x9b5c('0x42')](_0x9b5c('0x7a'),_0x4015e4)[_0x9b5c('0x42')](_0x9b5c('0x7b'))[_0x9b5c('0x7c')]();for(var _0x2c29a9=0x0;_0x2c29a9<_0x18c8ff[_0x9b5c('0x4b')];_0x2c29a9++){_0x3687ff[_0x9b5c('0x7d')](_0x9b5c('0x7e')+_0x18c8ff[_0x2c29a9]['id'],'customField_'+_0x18c8ff[_0x2c29a9][_0x9b5c('0x77')]);}for(var _0x2c29a9=0x0;_0x2c29a9<_0x8fd523[_0x9b5c('0x4b')];_0x2c29a9++){_0x3687ff[_0x9b5c('0x7d')](squel[_0x9b5c('0x7f')]()['field'](_0x9b5c('0x80'))[_0x9b5c('0x78')](_0x9b5c('0x81'))[_0x9b5c('0x42')]('ItemTypeId\x20=\x20?',_0x8fd523[_0x2c29a9]['id'])[_0x9b5c('0x42')](_0x9b5c('0x82')),_0x9b5c('0x83')+_0x8fd523[_0x2c29a9][_0x9b5c('0x30')]);_0x3687ff[_0x9b5c('0x7d')](squel[_0x9b5c('0x7f')]()[_0x9b5c('0x7d')]('description')[_0x9b5c('0x78')](_0x9b5c('0x81'))[_0x9b5c('0x42')](_0x9b5c('0x84'),_0x8fd523[_0x2c29a9]['id'])[_0x9b5c('0x42')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x8fd523[_0x2c29a9]['name']);}var _0x5423c5=[];_0x5423c5[_0x9b5c('0x68')](_0x3687ff[_0x9b5c('0x85')]());BPromise['each'](_0x5423c5,handleQuery)[_0x9b5c('0x2d')](function(_0x58dd09){handleQuery(_0x3687ff[_0x9b5c('0x85')]());var _0x4b30ae=csv_results[0x0];if(!_[_0x9b5c('0x86')](_0x4b30ae)){var _0x1498c3=toCsv(_0x4b30ae);var _0x496cde=Date[_0x9b5c('0x87')]();fs['writeFileSync'](util[_0x9b5c('0x70')]('/tmp/list_%d_%s.csv',_0x4015e4,_0x496cde),_0x1498c3);_0x60df4f['setHeader'](_0x9b5c('0x88'),_0x9b5c('0x89')+util[_0x9b5c('0x70')]('list_%d_%s.csv',_0x4015e4,_0x496cde));_0x60df4f['setHeader'](_0x9b5c('0x8a'),_0x9b5c('0x8b'));return _0x60df4f[_0x9b5c('0x8c')](util['format'](_0x9b5c('0x8d'),_0x4015e4,_0x496cde));}else{return _0x60df4f[_0x9b5c('0x8e')](0xcc);}});});});};exports[_0x9b5c('0x8f')]=function(_0x1baed3,_0x5d9afd,_0x5838b3){var _0x33b862;delete _0x1baed3[_0x9b5c('0x4d')]['id'];return db[_0x9b5c('0x34')][_0x9b5c('0x5b')]({'where':{'id':_0x1baed3[_0x9b5c('0x49')]['id']}})[_0x9b5c('0x2d')](handleEntityNotFound(_0x5d9afd,null))['then'](function(_0x2724ce){if(_0x2724ce){return db[_0x9b5c('0x90')][_0x9b5c('0x91')](function(_0x41841c){return db['CmCustomField'][_0x9b5c('0x4c')](_0x1baed3[_0x9b5c('0x4d')],{'transaction':_0x41841c})[_0x9b5c('0x2d')](function(_0x159b5a){_0x33b862=_0x159b5a;return _0x2724ce[_0x9b5c('0x92')](_0x159b5a,{'transaction':_0x41841c});})[_0x9b5c('0x2d')](function(){var _0x2f8789={'type':db['Sequelize'][_0x9b5c('0x93')],'transaction':_0x41841c};switch(_0x1baed3['body'][_0x9b5c('0x37')]){case _0x9b5c('0x94'):_0x2f8789[_0x9b5c('0x37')]=db['Sequelize']['TEXT'];break;case'number':_0x2f8789[_0x9b5c('0x37')]=db[_0x9b5c('0x95')][_0x9b5c('0x96')];break;case'switch':_0x2f8789['type']=db[_0x9b5c('0x95')][_0x9b5c('0x97')];_0x2f8789[_0x9b5c('0x98')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn']('cm_contacts',util['format'](_0x9b5c('0x99'),_0x33b862['id']),_0x2f8789);})['then'](function(){return _0x33b862;});});}})['then'](respondWithResult(_0x5d9afd,null))['catch'](handleError(_0x5d9afd,null));};exports['getCustomFields']=function(_0x24baea,_0x5721e4,_0xf25735){var _0x1f66d2={};var _0x16bab9={};var _0x119a9f;var _0x1434cb;return db[_0x9b5c('0x34')][_0x9b5c('0x5b')]({'where':{'id':_0x24baea[_0x9b5c('0x49')]['id']}})[_0x9b5c('0x2d')](handleEntityNotFound(_0x5721e4,null))[_0x9b5c('0x2d')](function(_0x3c7f6a){if(_0x3c7f6a){_0x119a9f=_0x3c7f6a;_0x16bab9['model']=_['keys'](db[_0x9b5c('0x6d')][_0x9b5c('0x35')]);_0x16bab9[_0x9b5c('0x3a')]=_[_0x9b5c('0x4a')](_0x24baea[_0x9b5c('0x3a')]);_0x16bab9[_0x9b5c('0x3b')]=_[_0x9b5c('0x3c')](_0x16bab9[_0x9b5c('0x39')],_0x16bab9['query']);_0x1f66d2[_0x9b5c('0x3e')]=_['intersection'](_0x16bab9[_0x9b5c('0x39')],qs[_0x9b5c('0x3d')](_0x24baea[_0x9b5c('0x3a')][_0x9b5c('0x3d')]));_0x1f66d2['attributes']=_0x1f66d2['attributes'][_0x9b5c('0x4b')]?_0x1f66d2[_0x9b5c('0x3e')]:_0x16bab9[_0x9b5c('0x39')];_0x1f66d2[_0x9b5c('0x5e')]=qs[_0x9b5c('0x3f')](_0x24baea[_0x9b5c('0x3a')]['sort']);_0x1f66d2[_0x9b5c('0x42')]=qs['filters'](_['pick'](_0x24baea[_0x9b5c('0x3a')],_0x16bab9[_0x9b5c('0x3b')]));_0x1f66d2[_0x9b5c('0x42')]=_[_0x9b5c('0x43')](_0x1f66d2[_0x9b5c('0x42')],{'$or':[{'ListId':_0x3c7f6a['id']},{'ListId':null}]});if(_0x24baea['query'][_0x9b5c('0x41')]){_0x1f66d2[_0x9b5c('0x42')]=_[_0x9b5c('0x43')](_0x1f66d2[_0x9b5c('0x42')],{'$or':_[_0x9b5c('0x33')](_0x1f66d2[_0x9b5c('0x3e')],function(_0x3b99df){var _0x5ae11c={};_0x5ae11c[_0x3b99df]={'$like':'%'+_0x24baea[_0x9b5c('0x3a')][_0x9b5c('0x41')]+'%'};return _0x5ae11c;})});}_0x1f66d2=_[_0x9b5c('0x43')]({},_0x1f66d2,_0x24baea[_0x9b5c('0x44')]);return db[_0x9b5c('0x6d')][_0x9b5c('0x9a')](_0x1f66d2);}})[_0x9b5c('0x2d')](respondWithResult(_0x5721e4,null))[_0x9b5c('0x55')](handleError(_0x5721e4,null));};exports[_0x9b5c('0x9b')]=function(_0x4e50ce,_0xb2e18f){return db['CmCustomField'][_0x9b5c('0x9a')]({'where':{'ListId':null}})[_0x9b5c('0x2d')](handleEntityNotFound(_0xb2e18f,null))[_0x9b5c('0x2d')](function(_0x259181){return _0x259181;})[_0x9b5c('0x2d')](respondWithResult(_0xb2e18f,null))[_0x9b5c('0x55')](handleError(_0xb2e18f,null));};exports[_0x9b5c('0x9c')]=function(_0x554403,_0x14d163,_0x479454){return db['CmList'][_0x9b5c('0x53')]({'where':{'id':_0x554403[_0x9b5c('0x49')]['id']}})[_0x9b5c('0x2d')](handleEntityNotFound(_0x14d163,null))[_0x9b5c('0x2d')](function(_0x1e3504){if(_0x1e3504){return _0x1e3504[_0x9b5c('0x9c')](_0x554403[_0x9b5c('0x4d')][_0x9b5c('0x66')],_[_0x9b5c('0x65')](_0x554403['body'],['ids','id'])||{})[_0x9b5c('0x9d')](function(_0x56c5cc){for(var _0x2c980c=0x0;_0x2c980c<_0x554403['body'][_0x9b5c('0x66')][_0x9b5c('0x4b')];_0x2c980c+=0x1){socket[_0x9b5c('0x9e')]('userCmList:save',{'UserId':Number(_0x554403[_0x9b5c('0x4d')]['ids'][_0x2c980c]),'CmListId':Number(_0x554403[_0x9b5c('0x49')]['id'])});}return _0x56c5cc;});}})[_0x9b5c('0x2d')](respondWithResult(_0x14d163,null))[_0x9b5c('0x55')](handleError(_0x14d163,null));};exports[_0x9b5c('0x9f')]=function(_0x12bc06,_0xb3f35d,_0x3e465d){return db[_0x9b5c('0x34')]['find']({'where':{'id':_0x12bc06['params']['id']}})['then'](handleEntityNotFound(_0xb3f35d,null))[_0x9b5c('0x2d')](function(_0x30b100){if(_0x30b100){return _0x30b100[_0x9b5c('0x9f')](_0x12bc06[_0x9b5c('0x3a')]['ids'])['then'](function(){if(_['isArray'](_0x12bc06[_0x9b5c('0x3a')][_0x9b5c('0x66')])){for(var _0x484b00=0x0;_0x484b00<_0x12bc06[_0x9b5c('0x3a')]['ids'][_0x9b5c('0x4b')];_0x484b00+=0x1){socket[_0x9b5c('0x9e')]('userCmList:remove',{'UserId':Number(_0x12bc06[_0x9b5c('0x3a')][_0x9b5c('0x66')][_0x484b00]),'CmListId':Number(_0x12bc06[_0x9b5c('0x49')]['id'])});}}else{socket[_0x9b5c('0x9e')]('userCmList:remove',{'UserId':Number(_0x12bc06[_0x9b5c('0x3a')]['ids']),'CmListId':Number(_0x12bc06[_0x9b5c('0x49')]['id'])});}});}})[_0x9b5c('0x2d')](respondWithStatusCode(_0xb3f35d,null))[_0x9b5c('0x55')](handleError(_0xb3f35d,null));};exports[_0x9b5c('0xa0')]=function(_0x38bc27,_0xcd8e0a,_0x22a890){var _0x3f84f8={};var _0x48e93a={};var _0x162f12;var _0x23250e;return db['CmList'][_0x9b5c('0x5b')]({'where':{'id':_0x38bc27['params']['id']}})[_0x9b5c('0x2d')](handleEntityNotFound(_0xcd8e0a,null))[_0x9b5c('0x2d')](function(_0x3fefa6){if(_0x3fefa6){_0x162f12=_0x3fefa6;_0x48e93a[_0x9b5c('0x39')]=_[_0x9b5c('0x4a')](db[_0x9b5c('0xa1')][_0x9b5c('0x35')]);_0x48e93a[_0x9b5c('0x3a')]=_[_0x9b5c('0x4a')](_0x38bc27[_0x9b5c('0x3a')]);_0x48e93a['filters']=_['intersection'](_0x48e93a['model'],_0x48e93a[_0x9b5c('0x3a')]);_0x3f84f8[_0x9b5c('0x3e')]=_['intersection'](_0x48e93a[_0x9b5c('0x39')],qs[_0x9b5c('0x3d')](_0x38bc27[_0x9b5c('0x3a')][_0x9b5c('0x3d')]));_0x3f84f8[_0x9b5c('0x3e')]=_0x3f84f8[_0x9b5c('0x3e')][_0x9b5c('0x4b')]?_0x3f84f8[_0x9b5c('0x3e')]:_0x48e93a[_0x9b5c('0x39')];_0x3f84f8[_0x9b5c('0x5e')]=qs['sort'](_0x38bc27[_0x9b5c('0x3a')]['sort']);_0x3f84f8[_0x9b5c('0x42')]=qs[_0x9b5c('0x3b')](_[_0x9b5c('0x40')](_0x38bc27[_0x9b5c('0x3a')],_0x48e93a[_0x9b5c('0x3b')]));if(_0x38bc27['query'][_0x9b5c('0x41')]){_0x3f84f8['where']=_[_0x9b5c('0x43')](_0x3f84f8[_0x9b5c('0x42')],{'$or':_[_0x9b5c('0x33')](_0x3f84f8[_0x9b5c('0x3e')],function(_0x368b03){var _0x457bec={};_0x457bec[_0x368b03]={'$like':'%'+_0x38bc27[_0x9b5c('0x3a')][_0x9b5c('0x41')]+'%'};return _0x457bec;})});}_0x3f84f8=_['merge']({},_0x3f84f8,_0x38bc27[_0x9b5c('0x44')]);return _0x162f12[_0x9b5c('0xa0')](_0x3f84f8);}})[_0x9b5c('0x2d')](function(_0x226c1f){if(_0x226c1f){_0x23250e=_0x226c1f['length'];if(!_0x38bc27[_0x9b5c('0x3a')][_0x9b5c('0x72')](_0x9b5c('0x5d'))){_0x3f84f8[_0x9b5c('0x23')]=qs['limit'](_0x38bc27[_0x9b5c('0x3a')][_0x9b5c('0x23')]);_0x3f84f8[_0x9b5c('0x21')]=qs[_0x9b5c('0x21')](_0x38bc27['query'][_0x9b5c('0x21')]);}return _0x162f12[_0x9b5c('0xa0')](_0x3f84f8);}})[_0x9b5c('0x2d')](function(_0x4d1139){if(_0x4d1139){return _0x4d1139?{'count':_0x23250e,'rows':_0x4d1139}:null;}})[_0x9b5c('0x2d')](respondWithResult(_0xcd8e0a,null))[_0x9b5c('0x55')](handleError(_0xcd8e0a,null));};function handleQuery(_0x36e56d){logger[_0x9b5c('0xa2')](_0x36e56d);return db[_0x9b5c('0x90')][_0x9b5c('0x3a')](_0x36e56d)['spread'](function(_0x1c0259){csv_results[_0x9b5c('0x68')](_0x1c0259);})[_0x9b5c('0x55')](function(_0x4e15e5){logger[_0x9b5c('0x2e')](_0x4e15e5[_0x9b5c('0x6a')]);});} \ No newline at end of file +var _0x178a=['ItemTypeId\x20=\x20?','description_additionalPhone_','each','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','spread','message','eml-format','rimraf','zip-dir','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/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','order','ids','addContacts','CmContact','tags','join','isArray','push','success','dataValues','errors','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','customField_','field','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description'];(function(_0x14ab58,_0x5a8c06){var _0x465140=function(_0x24b1cc){while(--_0x24b1cc){_0x14ab58['push'](_0x14ab58['shift']());}};_0x465140(++_0x5a8c06);}(_0x178a,0xcb));var _0xa178=function(_0x5c654f,_0x3b7a6a){_0x5c654f=_0x5c654f-0x0;var _0x3826f4=_0x178a[_0x5c654f];return _0x3826f4;};'use strict';var emlformat=require(_0xa178('0x0'));var rimraf=require(_0xa178('0x1'));var zipdir=require(_0xa178('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa178('0x3'));var moment=require(_0xa178('0x4'));var BPromise=require(_0xa178('0x5'));var Mustache=require(_0xa178('0x6'));var util=require(_0xa178('0x7'));var path=require(_0xa178('0x8'));var sox=require(_0xa178('0x9'));var csv=require(_0xa178('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa178('0xb'));var _=require(_0xa178('0xc'));var squel=require(_0xa178('0xd'));var crypto=require('crypto');var jsforce=require(_0xa178('0xe'));var deskjs=require(_0xa178('0xf'));var toCsv=require(_0xa178('0xa'));var querystring=require(_0xa178('0x10'));var Papa=require(_0xa178('0x11'));var Redis=require(_0xa178('0x12'));var authService=require(_0xa178('0x13'));var qs=require(_0xa178('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa178('0x15'));var logger=require('../../config/logger')(_0xa178('0x16'));var utils=require(_0xa178('0x17'));var config=require(_0xa178('0x18'));var licenseUtil=require(_0xa178('0x19'));var db=require(_0xa178('0x1a'))['db'];var csv_results;config['redis']=_[_0xa178('0x1b')](config[_0xa178('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xa178('0x1d'))(new Redis(config[_0xa178('0x1c')]));require(_0xa178('0x1e'))[_0xa178('0x1f')](socket);function respondWithStatusCode(_0x1dbcd8,_0x45d706){_0x45d706=_0x45d706||0xcc;return function(_0x2b9823){if(_0x2b9823){return _0x1dbcd8[_0xa178('0x20')](_0x45d706);}return _0x1dbcd8[_0xa178('0x21')](_0x45d706)[_0xa178('0x22')]();};}function respondWithResult(_0x2ec98a,_0x2a6b5f){_0x2a6b5f=_0x2a6b5f||0xc8;return function(_0x485a92){if(_0x485a92){return _0x2ec98a[_0xa178('0x21')](_0x2a6b5f)[_0xa178('0x23')](_0x485a92);}};}function respondWithFilteredResult(_0x5a21c1,_0x32906c){return function(_0x35a488){if(_0x35a488){var _0xb0a2a2=typeof _0x32906c[_0xa178('0x24')]==='undefined'&&typeof _0x32906c[_0xa178('0x25')]==='undefined';var _0x2f723f=_0x35a488[_0xa178('0x26')];var _0x18a82d=_0xb0a2a2?0x0:_0x32906c[_0xa178('0x24')];var _0x3cb7c8=_0xb0a2a2?_0x35a488[_0xa178('0x26')]:_0x32906c[_0xa178('0x24')]+_0x32906c['limit'];var _0x41172e;if(_0x3cb7c8>=_0x2f723f){_0x3cb7c8=_0x2f723f;_0x41172e=0xc8;}else{_0x41172e=0xce;}_0x5a21c1['status'](_0x41172e);return _0x5a21c1[_0xa178('0x27')](_0xa178('0x28'),_0x18a82d+'-'+_0x3cb7c8+'/'+_0x2f723f)['json'](_0x35a488);}return null;};}function patchUpdates(_0x28c8ae){return function(_0x427f77){try{jsonpatch[_0xa178('0x29')](_0x427f77,_0x28c8ae,!![]);}catch(_0x3fe595){return BPromise[_0xa178('0x2a')](_0x3fe595);}return _0x427f77[_0xa178('0x2b')]();};}function saveUpdates(_0xe69903,_0x51e324){return function(_0x48e8b0){if(_0x48e8b0){return _0x48e8b0[_0xa178('0x2c')](_0xe69903)['then'](function(_0x32a8ab){return _0x32a8ab;});}return null;};}function removeEntity(_0x25b62c,_0x27dbf1){return function(_0x56ec1e){if(_0x56ec1e){return _0x56ec1e[_0xa178('0x2d')]()[_0xa178('0x2e')](function(){var _0xdf1cbb=_0x56ec1e[_0xa178('0x2f')]({'plain':!![]});var _0x3edf6c='Lists';return db[_0xa178('0x30')][_0xa178('0x2d')]({'where':{'type':_0x3edf6c,'resourceId':_0xdf1cbb['id']}})[_0xa178('0x2e')](function(){return _0x56ec1e;});})[_0xa178('0x2e')](function(){_0x25b62c['status'](0xcc)[_0xa178('0x22')]();});}};}function handleEntityNotFound(_0x44560b,_0x45708d){return function(_0x26b90a){if(!_0x26b90a){_0x44560b[_0xa178('0x20')](0x194);}return _0x26b90a;};}function handleError(_0x473834,_0x56adbe){_0x56adbe=_0x56adbe||0x1f4;return function(_0x71a89){logger[_0xa178('0x31')](_0x71a89[_0xa178('0x32')]);if(_0x71a89[_0xa178('0x33')]){delete _0x71a89[_0xa178('0x33')];}_0x473834['status'](_0x56adbe)[_0xa178('0x34')](_0x71a89);};}exports[_0xa178('0x35')]=function(_0x529fa8,_0x19d2b5){var _0x1123a3={},_0x200ed4={},_0x37d748={'count':0x0,'rows':[]};var _0x2b5df1=_['map'](db[_0xa178('0x36')][_0xa178('0x37')],function(_0x3943a3){return{'name':_0x3943a3[_0xa178('0x38')],'type':_0x3943a3[_0xa178('0x39')][_0xa178('0x3a')]};});_0x200ed4[_0xa178('0x3b')]=_[_0xa178('0x3c')](_0x2b5df1,_0xa178('0x33'));_0x200ed4[_0xa178('0x3d')]=_[_0xa178('0x3e')](_0x529fa8[_0xa178('0x3d')]);_0x200ed4[_0xa178('0x3f')]=_[_0xa178('0x40')](_0x200ed4[_0xa178('0x3b')],_0x200ed4[_0xa178('0x3d')]);_0x1123a3[_0xa178('0x41')]=_[_0xa178('0x40')](_0x200ed4['model'],qs[_0xa178('0x42')](_0x529fa8['query'][_0xa178('0x42')]));_0x1123a3[_0xa178('0x41')]=_0x1123a3[_0xa178('0x41')][_0xa178('0x43')]?_0x1123a3[_0xa178('0x41')]:_0x200ed4[_0xa178('0x3b')];if(!_0x529fa8[_0xa178('0x3d')]['hasOwnProperty']('nolimit')){_0x1123a3[_0xa178('0x25')]=qs['limit'](_0x529fa8[_0xa178('0x3d')]['limit']);_0x1123a3[_0xa178('0x24')]=qs[_0xa178('0x24')](_0x529fa8[_0xa178('0x3d')][_0xa178('0x24')]);}_0x1123a3['order']=qs[_0xa178('0x44')](_0x529fa8['query'][_0xa178('0x44')]);_0x1123a3[_0xa178('0x45')]=qs[_0xa178('0x3f')](_[_0xa178('0x46')](_0x529fa8['query'],_0x200ed4[_0xa178('0x3f')]),_0x2b5df1);if(_0x529fa8[_0xa178('0x3d')][_0xa178('0x47')]){_0x1123a3[_0xa178('0x45')]=_['merge'](_0x1123a3['where'],{'$or':_[_0xa178('0x3c')](_0x2b5df1,function(_0x3e8c22){if(_0x3e8c22[_0xa178('0x39')]!==_0xa178('0x48')){var _0x43b123={};_0x43b123[_0x3e8c22[_0xa178('0x33')]]={'$like':'%'+_0x529fa8[_0xa178('0x3d')][_0xa178('0x47')]+'%'};return _0x43b123;}})});}_0x1123a3=_[_0xa178('0x49')]({},_0x1123a3,_0x529fa8[_0xa178('0x4a')]);var _0x36f2cc={'where':_0x1123a3[_0xa178('0x45')]};return db[_0xa178('0x36')][_0xa178('0x26')](_0x36f2cc)[_0xa178('0x2e')](function(_0xd72576){_0x37d748[_0xa178('0x26')]=_0xd72576;if(_0x529fa8[_0xa178('0x3d')]['includeAll']){_0x1123a3[_0xa178('0x4b')]=[{'all':!![]}];}return db[_0xa178('0x36')][_0xa178('0x4c')](_0x1123a3);})[_0xa178('0x2e')](function(_0xfe460c){_0x37d748[_0xa178('0x4d')]=_0xfe460c;return _0x37d748;})[_0xa178('0x2e')](respondWithFilteredResult(_0x19d2b5,_0x1123a3))[_0xa178('0x4e')](handleError(_0x19d2b5,null));};exports['show']=function(_0x8c7dd7,_0x3e3b8){var _0x18bb9a={'raw':![],'where':{'id':_0x8c7dd7['params']['id']}},_0x365b3b={};_0x365b3b[_0xa178('0x3b')]=_[_0xa178('0x3e')](db[_0xa178('0x36')][_0xa178('0x37')]);_0x365b3b[_0xa178('0x3d')]=_[_0xa178('0x3e')](_0x8c7dd7[_0xa178('0x3d')]);_0x365b3b[_0xa178('0x3f')]=_[_0xa178('0x40')](_0x365b3b[_0xa178('0x3b')],_0x365b3b[_0xa178('0x3d')]);_0x18bb9a['attributes']=_[_0xa178('0x40')](_0x365b3b[_0xa178('0x3b')],qs[_0xa178('0x42')](_0x8c7dd7[_0xa178('0x3d')][_0xa178('0x42')]));_0x18bb9a['attributes']=_0x18bb9a[_0xa178('0x41')][_0xa178('0x43')]?_0x18bb9a[_0xa178('0x41')]:_0x365b3b[_0xa178('0x3b')];if(_0x8c7dd7[_0xa178('0x3d')][_0xa178('0x4f')]){_0x18bb9a[_0xa178('0x4b')]=[{'all':!![]}];}_0x18bb9a=_[_0xa178('0x49')]({},_0x18bb9a,_0x8c7dd7['options']);return db[_0xa178('0x36')][_0xa178('0x50')](_0x18bb9a)['then'](handleEntityNotFound(_0x3e3b8,null))['then'](respondWithResult(_0x3e3b8,null))[_0xa178('0x4e')](handleError(_0x3e3b8,null));};exports['create']=function(_0x50ef7b,_0x5a1481){return db[_0xa178('0x36')][_0xa178('0x51')](_0x50ef7b[_0xa178('0x52')],{})['then'](function(_0xdd851d){var _0x267df2=_0x50ef7b[_0xa178('0x53')]['get']({'plain':!![]});if(!_0x267df2)throw new Error(_0xa178('0x54'));if(_0x267df2[_0xa178('0x55')]===_0xa178('0x53')){var _0x181cdb=_0xdd851d[_0xa178('0x2f')]({'plain':!![]});var _0x3df802=_0xa178('0x56');return db['UserProfileSection'][_0xa178('0x50')]({'where':{'name':_0x3df802,'userProfileId':_0x267df2[_0xa178('0x57')]},'raw':!![]})[_0xa178('0x2e')](function(_0xef1da2){if(_0xef1da2&&_0xef1da2[_0xa178('0x58')]===0x0){return db[_0xa178('0x30')][_0xa178('0x51')]({'name':_0x181cdb[_0xa178('0x33')],'resourceId':_0x181cdb['id'],'type':_0xef1da2['name'],'sectionId':_0xef1da2['id']},{})[_0xa178('0x2e')](function(){return _0xdd851d;});}else{return _0xdd851d;}})['catch'](function(_0x29fe5f){logger[_0xa178('0x31')](_0xa178('0x59'),_0x29fe5f);throw _0x29fe5f;});}return _0xdd851d;})[_0xa178('0x2e')](respondWithResult(_0x5a1481,0xc9))[_0xa178('0x4e')](handleError(_0x5a1481,null));};exports[_0xa178('0x2c')]=function(_0x31b802,_0x122cda){if(_0x31b802[_0xa178('0x52')]['id']){delete _0x31b802[_0xa178('0x52')]['id'];}return db['CmList'][_0xa178('0x50')]({'where':{'id':_0x31b802[_0xa178('0x5a')]['id']}})[_0xa178('0x2e')](handleEntityNotFound(_0x122cda,null))['then'](saveUpdates(_0x31b802[_0xa178('0x52')],null))[_0xa178('0x2e')](respondWithResult(_0x122cda,null))[_0xa178('0x4e')](handleError(_0x122cda,null));};exports[_0xa178('0x2d')]=function(_0x13ebce,_0x3bdeb4){return db[_0xa178('0x36')][_0xa178('0x50')]({'where':{'id':_0x13ebce[_0xa178('0x5a')]['id']}})[_0xa178('0x2e')](handleEntityNotFound(_0x3bdeb4,null))[_0xa178('0x2e')](removeEntity(_0x3bdeb4,null))['catch'](handleError(_0x3bdeb4,null));};exports[_0xa178('0x5b')]=function(_0x30ecf4,_0x4076ed){return db[_0xa178('0x36')][_0xa178('0x5b')]()['then'](respondWithResult(_0x4076ed,null))[_0xa178('0x4e')](handleError(_0x4076ed,null));};exports[_0xa178('0x5c')]=function(_0x280cd5,_0x4b613d,_0x2c628e){if(_0x280cd5[_0xa178('0x52')]['id']){delete _0x280cd5[_0xa178('0x52')]['id'];}return db[_0xa178('0x36')][_0xa178('0x50')]({'where':{'id':_0x280cd5['params']['id']}})['then'](handleEntityNotFound(_0x4b613d,null))[_0xa178('0x2e')](function(_0x4ac98c){if(_0x4ac98c){_0x280cd5[_0xa178('0x52')][_0xa178('0x5d')]=_0x4ac98c['id'];return db[_0xa178('0x5e')][_0xa178('0x51')](_0x280cd5[_0xa178('0x52')]);}})['then'](respondWithResult(_0x4b613d,null))[_0xa178('0x4e')](handleError(_0x4b613d,null));};exports[_0xa178('0x5f')]=function(_0x551f4c,_0x2c6d40,_0x13a909){var _0x4eb719={'raw':![],'where':{}};var _0x361506={};var _0x73adb0={'count':0x0,'rows':[]};return db[_0xa178('0x36')][_0xa178('0x60')]({'where':{'id':_0x551f4c['params']['id']}})['then'](handleEntityNotFound(_0x2c6d40,null))[_0xa178('0x2e')](function(_0x5162a4){if(_0x5162a4){_0x361506['model']=_[_0xa178('0x3e')](db[_0xa178('0x5e')][_0xa178('0x37')]);_0x361506['query']=_[_0xa178('0x3e')](_0x551f4c[_0xa178('0x3d')]);_0x361506['filters']=_[_0xa178('0x40')](_0x361506[_0xa178('0x3b')],_0x361506['query']);_0x4eb719[_0xa178('0x41')]=_[_0xa178('0x40')](_0x361506['model'],qs['fields'](_0x551f4c[_0xa178('0x3d')][_0xa178('0x42')]));_0x4eb719[_0xa178('0x41')]=_0x4eb719[_0xa178('0x41')]['length']?_0x4eb719[_0xa178('0x41')]:_0x361506['model'];if(!_0x551f4c[_0xa178('0x3d')][_0xa178('0x61')](_0xa178('0x62'))){_0x4eb719[_0xa178('0x25')]=qs['limit'](_0x551f4c[_0xa178('0x3d')][_0xa178('0x25')]);_0x4eb719['offset']=qs[_0xa178('0x24')](_0x551f4c['query']['offset']);}_0x4eb719[_0xa178('0x63')]=qs[_0xa178('0x44')](_0x551f4c[_0xa178('0x3d')][_0xa178('0x44')]);_0x4eb719['where']=qs[_0xa178('0x3f')](_['pick'](_0x551f4c['query'],_0x361506[_0xa178('0x3f')]));_0x4eb719['where'][_0xa178('0x5d')]=_0x5162a4['id'];if(_0x551f4c[_0xa178('0x3d')][_0xa178('0x47')]){_0x4eb719[_0xa178('0x45')]=_[_0xa178('0x49')](_0x4eb719[_0xa178('0x45')],{'$or':_[_0xa178('0x3c')](_0x4eb719[_0xa178('0x41')],function(_0x1a64ae){var _0x1ccffc={};_0x1ccffc[_0x1a64ae]={'$like':'%'+_0x551f4c[_0xa178('0x3d')]['filter']+'%'};return _0x1ccffc;})});}_0x4eb719=_[_0xa178('0x49')]({},_0x4eb719,_0x551f4c[_0xa178('0x4a')]);return db[_0xa178('0x5e')][_0xa178('0x26')]({'where':_0x4eb719[_0xa178('0x45')]})[_0xa178('0x2e')](function(_0x593780){_0x73adb0['count']=_0x593780;if(_0x551f4c[_0xa178('0x3d')][_0xa178('0x4f')]){_0x4eb719['include']=[{'all':!![]}];}return db[_0xa178('0x5e')]['findAll'](_0x4eb719);})[_0xa178('0x2e')](function(_0x5523a3){_0x73adb0[_0xa178('0x4d')]=_0x5523a3;return _0x73adb0;});}})[_0xa178('0x2e')](respondWithFilteredResult(_0x2c6d40,_0x4eb719))['catch'](handleError(_0x2c6d40,null));};exports['removeDispositions']=function(_0x59fe38,_0x1c1d81,_0x1ac458){return db[_0xa178('0x36')]['find']({'where':{'id':_0x59fe38['params']['id']}})[_0xa178('0x2e')](handleEntityNotFound(_0x1c1d81,null))[_0xa178('0x2e')](function(_0x1188c4){if(_0x1188c4){return _0x1188c4['removeDispositions'](_0x59fe38[_0xa178('0x3d')][_0xa178('0x64')]);}})[_0xa178('0x2e')](respondWithStatusCode(_0x1c1d81,null))['catch'](handleError(_0x1c1d81,null));};exports[_0xa178('0x65')]=function(_0x1e9ee2,_0x526572,_0x11f0c1){return db[_0xa178('0x36')][_0xa178('0x50')]({'where':{'id':_0x1e9ee2[_0xa178('0x5a')]['id']}})[_0xa178('0x2e')](handleEntityNotFound(_0x526572,null))[_0xa178('0x2e')](function(_0x55fec7){if(_0x55fec7){var _0x317b7d=[];var _0x414326={'success':[],'errors':[]};return db[_0xa178('0x66')]['describe']()[_0xa178('0x2e')](function(_0x5c4566){if(_0x1e9ee2[_0xa178('0x52')]['tags']&&_['isArray'](_0x1e9ee2[_0xa178('0x52')][_0xa178('0x67')])){if(_0x1e9ee2[_0xa178('0x52')][_0xa178('0x67')][_0xa178('0x43')]){_0x1e9ee2[_0xa178('0x52')][_0xa178('0x67')]=_0x1e9ee2[_0xa178('0x52')][_0xa178('0x67')][_0xa178('0x68')](';')+';';}else{_0x1e9ee2['body'][_0xa178('0x67')]=null;}}else{_0x1e9ee2['body'][_0xa178('0x67')]=null;}if(_0x1e9ee2['body']&&_[_0xa178('0x69')](_0x1e9ee2['body'])){for(var _0x170d24=0x0;_0x170d24<_0x1e9ee2[_0xa178('0x52')][_0xa178('0x43')];_0x170d24+=0x1){_0x1e9ee2[_0xa178('0x52')][_0x170d24][_0xa178('0x5d')]=_0x1e9ee2['params']['id'];_0x317b7d[_0xa178('0x6a')](_0x1e9ee2[_0xa178('0x52')][_0x170d24]);}return BPromise['each'](_0x317b7d,function(_0x73c4ba){return db[_0xa178('0x66')][_0xa178('0x51')](_['omit'](_0x73c4ba,['ids','id'])||{},{'fields':_['keys'](_0x5c4566),'raw':!![]})[_0xa178('0x2e')](function(_0x50bbdd){_0x414326[_0xa178('0x6b')][_0xa178('0x6a')](_0x50bbdd[_0xa178('0x6c')]);})[_0xa178('0x4e')](function(_0x3779ef){_0x414326[_0xa178('0x6d')]['push']({'data':_0x73c4ba,'error':_0x3779ef['message']});});})[_0xa178('0x2e')](function(_0x21b035){return _0x414326;})['catch'](function(_0x3e7a1a){return _0x3e7a1a;});}else{_0x526572[_0xa178('0x21')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xa178('0x2e')](respondWithResult(_0x526572,null))[_0xa178('0x4e')](handleError(_0x526572,null));};exports[_0xa178('0x6e')]=function(_0x29a9cc,_0x49800c,_0x44fc61){var _0xc16ba7;return db[_0xa178('0x36')][_0xa178('0x50')]({'where':{'id':_0x29a9cc[_0xa178('0x5a')]['id']},'include':[{'model':db[_0xa178('0x6f')],'as':_0xa178('0x70')}]})[_0xa178('0x2e')](handleEntityNotFound(_0x49800c,null))[_0xa178('0x2e')](function(_0x526424){if(_0x526424){_0xc16ba7=_0x526424;return db[_0xa178('0x66')]['rawAttributes'];}})['then'](function(_0x1fc582){if(_0x1fc582){var _0xdddb77={};var _0x1bfa3a={};_0x1bfa3a[_0xa178('0x3b')]=_['concat'](_[_0xa178('0x3e')](_0x1fc582),_[_0xa178('0x3c')](_0xc16ba7[_0xa178('0x70')],function(_0x68fa63){return util[_0xa178('0x71')](_0xa178('0x72'),_0x68fa63['id']);}));_0x1bfa3a[_0xa178('0x3d')]=_[_0xa178('0x3e')](_0x29a9cc[_0xa178('0x3d')]);_0x1bfa3a[_0xa178('0x3f')]=_[_0xa178('0x40')](_0x1bfa3a[_0xa178('0x3b')],_0x1bfa3a[_0xa178('0x3d')]);_0xdddb77[_0xa178('0x41')]=_[_0xa178('0x40')](_0x1bfa3a[_0xa178('0x3b')],qs[_0xa178('0x42')](_0x29a9cc['query'][_0xa178('0x42')]));_0xdddb77[_0xa178('0x41')]=_0xdddb77[_0xa178('0x41')][_0xa178('0x43')]?_0xdddb77['attributes']:_0x1bfa3a[_0xa178('0x3b')];if(!_0x29a9cc['query'][_0xa178('0x61')]('nolimit')){_0xdddb77['limit']=qs[_0xa178('0x25')](_0x29a9cc[_0xa178('0x3d')][_0xa178('0x25')]);_0xdddb77[_0xa178('0x24')]=qs[_0xa178('0x24')](_0x29a9cc['query'][_0xa178('0x24')]);}_0xdddb77['order']=qs[_0xa178('0x44')](_0x29a9cc[_0xa178('0x3d')]['sort']);_0xdddb77[_0xa178('0x45')]=qs[_0xa178('0x3f')](_['pick'](_0x29a9cc['query'],_0x1bfa3a[_0xa178('0x3f')]));_0xdddb77[_0xa178('0x73')]=!![];if(_0x29a9cc[_0xa178('0x3d')][_0xa178('0x47')]){_0xdddb77['where']=_[_0xa178('0x49')](_0xdddb77[_0xa178('0x45')],{'$or':_[_0xa178('0x3c')](_0xdddb77[_0xa178('0x41')],function(_0x30672d){var _0xf8cc89={};_0xf8cc89[_0x30672d]={'$like':'%'+_0x29a9cc['query'][_0xa178('0x47')]+'%'};return _0xf8cc89;})});}_0xdddb77=_[_0xa178('0x49')]({},_0xdddb77,_0x29a9cc['options']);return _0xc16ba7[_0xa178('0x6e')](_0xdddb77);}})['then'](respondWithResult(_0x49800c,null))[_0xa178('0x4e')](handleError(_0x49800c,null));};exports[_0xa178('0x74')]=function(_0x1e2c01,_0xd75efe,_0xbba418){var _0x44e33b;var _0x122e64;var _0xe8afc;var _0x34b100=_0x1e2c01[_0xa178('0x5a')]['id'];csv_results=[];return db[_0xa178('0x75')][_0xa178('0x4c')]({'attributes':['id',_0xa178('0x33')],'raw':!![],'order':[_0xa178('0x76')]})[_0xa178('0x2e')](function(_0x304367){_0x44e33b=_0x304367;var _0x4e38d4=_[_0xa178('0x3e')](db[_0xa178('0x66')]['rawAttributes']);return db['CmCustomField'][_0xa178('0x4c')]({'raw':!![],'attributes':['id',_0xa178('0x77')]})[_0xa178('0x2e')](function(_0x497ade){_0x122e64=_0x497ade;var _0x11e147=squel[_0xa178('0x78')]()[_0xa178('0x42')](_0x4e38d4)[_0xa178('0x79')](_0xa178('0x7a'),'c')[_0xa178('0x45')](_0xa178('0x7b'),_0x34b100)[_0xa178('0x45')](_0xa178('0x7c'))[_0xa178('0x7d')]();for(var _0x1443a9=0x0;_0x1443a9<_0x122e64[_0xa178('0x43')];_0x1443a9++){_0x11e147['field']('c.cf_'+_0x122e64[_0x1443a9]['id'],_0xa178('0x7e')+_0x122e64[_0x1443a9][_0xa178('0x77')]);}for(var _0x1443a9=0x0;_0x1443a9<_0x44e33b[_0xa178('0x43')];_0x1443a9++){_0x11e147['field'](squel['select']()[_0xa178('0x7f')](_0xa178('0x80'))[_0xa178('0x79')](_0xa178('0x81'))[_0xa178('0x45')]('ItemTypeId\x20=\x20?',_0x44e33b[_0x1443a9]['id'])[_0xa178('0x45')](_0xa178('0x82')),_0xa178('0x83')+_0x44e33b[_0x1443a9][_0xa178('0x33')]);_0x11e147[_0xa178('0x7f')](squel[_0xa178('0x78')]()[_0xa178('0x7f')](_0xa178('0x84'))[_0xa178('0x79')]('cm_contact_has_items')['where'](_0xa178('0x85'),_0x44e33b[_0x1443a9]['id'])[_0xa178('0x45')](_0xa178('0x82')),_0xa178('0x86')+_0x44e33b[_0x1443a9]['name']);}var _0x3c9c0e=[];_0x3c9c0e[_0xa178('0x6a')](_0x11e147['toString']());BPromise[_0xa178('0x87')](_0x3c9c0e,handleQuery)[_0xa178('0x2e')](function(_0x2db648){handleQuery(_0x11e147['toString']());var _0x8d2b67=csv_results[0x0];if(!_[_0xa178('0x88')](_0x8d2b67)){var _0x1d3e34=toCsv(_0x8d2b67);var _0x1e2a11=Date[_0xa178('0x89')]();fs[_0xa178('0x8a')](util[_0xa178('0x71')](_0xa178('0x8b'),_0x34b100,_0x1e2a11),_0x1d3e34);_0xd75efe[_0xa178('0x8c')](_0xa178('0x8d'),_0xa178('0x8e')+util[_0xa178('0x71')]('list_%d_%s.csv',_0x34b100,_0x1e2a11));_0xd75efe[_0xa178('0x8c')](_0xa178('0x8f'),_0xa178('0x90'));return _0xd75efe[_0xa178('0x91')](util['format'](_0xa178('0x8b'),_0x34b100,_0x1e2a11));}else{return _0xd75efe['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x10700a,_0x1ac65f,_0x18a23f){var _0x16e7e6;delete _0x10700a['body']['id'];return db[_0xa178('0x36')][_0xa178('0x60')]({'where':{'id':_0x10700a[_0xa178('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1ac65f,null))[_0xa178('0x2e')](function(_0x34efbc){if(_0x34efbc){return db[_0xa178('0x92')][_0xa178('0x93')](function(_0x3255f4){return db[_0xa178('0x6f')][_0xa178('0x51')](_0x10700a['body'],{'transaction':_0x3255f4})[_0xa178('0x2e')](function(_0x37f9e4){_0x16e7e6=_0x37f9e4;return _0x34efbc[_0xa178('0x94')](_0x37f9e4,{'transaction':_0x3255f4});})['then'](function(){var _0x4c5710={'type':db[_0xa178('0x95')][_0xa178('0x96')],'transaction':_0x3255f4};switch(_0x10700a['body'][_0xa178('0x39')]){case _0xa178('0x97'):_0x4c5710[_0xa178('0x39')]=db[_0xa178('0x95')]['TEXT'];break;case _0xa178('0x98'):_0x4c5710['type']=db['Sequelize']['INTEGER'];break;case _0xa178('0x99'):_0x4c5710[_0xa178('0x39')]=db[_0xa178('0x95')]['BOOLEAN'];_0x4c5710[_0xa178('0x9a')]=![];break;default:}return db[_0xa178('0x92')][_0xa178('0x9b')]['addColumn'](_0xa178('0x7a'),util[_0xa178('0x71')](_0xa178('0x9c'),_0x16e7e6['id']),_0x4c5710);})[_0xa178('0x2e')](function(){return _0x16e7e6;});});}})['then'](respondWithResult(_0x1ac65f,null))[_0xa178('0x4e')](handleError(_0x1ac65f,null));};exports[_0xa178('0x9d')]=function(_0x18585d,_0x565a22,_0x24bbf7){var _0x4df31e={};var _0x40cc32={};var _0x394ee6;var _0x540c79;return db[_0xa178('0x36')][_0xa178('0x60')]({'where':{'id':_0x18585d[_0xa178('0x5a')]['id']}})[_0xa178('0x2e')](handleEntityNotFound(_0x565a22,null))['then'](function(_0x1682ef){if(_0x1682ef){_0x394ee6=_0x1682ef;_0x40cc32[_0xa178('0x3b')]=_[_0xa178('0x3e')](db[_0xa178('0x6f')][_0xa178('0x37')]);_0x40cc32[_0xa178('0x3d')]=_['keys'](_0x18585d[_0xa178('0x3d')]);_0x40cc32[_0xa178('0x3f')]=_['intersection'](_0x40cc32[_0xa178('0x3b')],_0x40cc32[_0xa178('0x3d')]);_0x4df31e[_0xa178('0x41')]=_[_0xa178('0x40')](_0x40cc32['model'],qs[_0xa178('0x42')](_0x18585d[_0xa178('0x3d')][_0xa178('0x42')]));_0x4df31e[_0xa178('0x41')]=_0x4df31e['attributes']['length']?_0x4df31e[_0xa178('0x41')]:_0x40cc32[_0xa178('0x3b')];_0x4df31e[_0xa178('0x63')]=qs[_0xa178('0x44')](_0x18585d[_0xa178('0x3d')][_0xa178('0x44')]);_0x4df31e[_0xa178('0x45')]=qs['filters'](_[_0xa178('0x46')](_0x18585d[_0xa178('0x3d')],_0x40cc32[_0xa178('0x3f')]));_0x4df31e[_0xa178('0x45')]=_[_0xa178('0x49')](_0x4df31e[_0xa178('0x45')],{'$or':[{'ListId':_0x1682ef['id']},{'ListId':null}]});if(_0x18585d[_0xa178('0x3d')]['filter']){_0x4df31e[_0xa178('0x45')]=_['merge'](_0x4df31e[_0xa178('0x45')],{'$or':_[_0xa178('0x3c')](_0x4df31e[_0xa178('0x41')],function(_0x20f3a2){var _0x1469ce={};_0x1469ce[_0x20f3a2]={'$like':'%'+_0x18585d[_0xa178('0x3d')][_0xa178('0x47')]+'%'};return _0x1469ce;})});}_0x4df31e=_[_0xa178('0x49')]({},_0x4df31e,_0x18585d[_0xa178('0x4a')]);return db['CmCustomField'][_0xa178('0x9e')](_0x4df31e);}})[_0xa178('0x2e')](respondWithResult(_0x565a22,null))['catch'](handleError(_0x565a22,null));};exports[_0xa178('0x9f')]=function(_0xc5ff84,_0x586e14){return db[_0xa178('0x6f')]['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x586e14,null))[_0xa178('0x2e')](function(_0x4ea76d){return _0x4ea76d;})['then'](respondWithResult(_0x586e14,null))['catch'](handleError(_0x586e14,null));};exports[_0xa178('0xa0')]=function(_0x3f9d44,_0x2a6032,_0x55cd59){return db[_0xa178('0x36')][_0xa178('0x50')]({'where':{'id':_0x3f9d44['params']['id']}})[_0xa178('0x2e')](handleEntityNotFound(_0x2a6032,null))['then'](function(_0x482df3){if(_0x482df3){return _0x482df3['addAgents'](_0x3f9d44['body'][_0xa178('0x64')],_['omit'](_0x3f9d44[_0xa178('0x52')],[_0xa178('0x64'),'id'])||{})['spread'](function(_0x10e750){for(var _0x12e959=0x0;_0x12e959<_0x3f9d44[_0xa178('0x52')][_0xa178('0x64')]['length'];_0x12e959+=0x1){socket['emit'](_0xa178('0xa1'),{'UserId':Number(_0x3f9d44[_0xa178('0x52')][_0xa178('0x64')][_0x12e959]),'CmListId':Number(_0x3f9d44[_0xa178('0x5a')]['id'])});}return _0x10e750;});}})['then'](respondWithResult(_0x2a6032,null))[_0xa178('0x4e')](handleError(_0x2a6032,null));};exports[_0xa178('0xa2')]=function(_0x57505c,_0x49153c,_0x1bad99){return db[_0xa178('0x36')][_0xa178('0x50')]({'where':{'id':_0x57505c[_0xa178('0x5a')]['id']}})[_0xa178('0x2e')](handleEntityNotFound(_0x49153c,null))['then'](function(_0x102a5f){if(_0x102a5f){return _0x102a5f[_0xa178('0xa2')](_0x57505c[_0xa178('0x3d')][_0xa178('0x64')])['then'](function(){if(_[_0xa178('0x69')](_0x57505c[_0xa178('0x3d')][_0xa178('0x64')])){for(var _0x1aceed=0x0;_0x1aceed<_0x57505c[_0xa178('0x3d')][_0xa178('0x64')][_0xa178('0x43')];_0x1aceed+=0x1){socket[_0xa178('0xa3')](_0xa178('0xa4'),{'UserId':Number(_0x57505c[_0xa178('0x3d')][_0xa178('0x64')][_0x1aceed]),'CmListId':Number(_0x57505c[_0xa178('0x5a')]['id'])});}}else{socket[_0xa178('0xa3')](_0xa178('0xa4'),{'UserId':Number(_0x57505c[_0xa178('0x3d')][_0xa178('0x64')]),'CmListId':Number(_0x57505c['params']['id'])});}});}})[_0xa178('0x2e')](respondWithStatusCode(_0x49153c,null))[_0xa178('0x4e')](handleError(_0x49153c,null));};exports[_0xa178('0xa5')]=function(_0x5eb341,_0x23e9c2,_0x5aec03){var _0x5a9ceb={};var _0x2221ed={};var _0x545962;var _0xa43941;return db[_0xa178('0x36')][_0xa178('0x60')]({'where':{'id':_0x5eb341['params']['id']}})[_0xa178('0x2e')](handleEntityNotFound(_0x23e9c2,null))[_0xa178('0x2e')](function(_0x3052b0){if(_0x3052b0){_0x545962=_0x3052b0;_0x2221ed[_0xa178('0x3b')]=_[_0xa178('0x3e')](db['User']['rawAttributes']);_0x2221ed[_0xa178('0x3d')]=_[_0xa178('0x3e')](_0x5eb341[_0xa178('0x3d')]);_0x2221ed[_0xa178('0x3f')]=_[_0xa178('0x40')](_0x2221ed[_0xa178('0x3b')],_0x2221ed[_0xa178('0x3d')]);_0x5a9ceb[_0xa178('0x41')]=_['intersection'](_0x2221ed[_0xa178('0x3b')],qs[_0xa178('0x42')](_0x5eb341[_0xa178('0x3d')]['fields']));_0x5a9ceb[_0xa178('0x41')]=_0x5a9ceb[_0xa178('0x41')][_0xa178('0x43')]?_0x5a9ceb[_0xa178('0x41')]:_0x2221ed[_0xa178('0x3b')];_0x5a9ceb['order']=qs['sort'](_0x5eb341[_0xa178('0x3d')]['sort']);_0x5a9ceb[_0xa178('0x45')]=qs[_0xa178('0x3f')](_[_0xa178('0x46')](_0x5eb341['query'],_0x2221ed[_0xa178('0x3f')]));if(_0x5eb341[_0xa178('0x3d')]['filter']){_0x5a9ceb[_0xa178('0x45')]=_[_0xa178('0x49')](_0x5a9ceb[_0xa178('0x45')],{'$or':_[_0xa178('0x3c')](_0x5a9ceb[_0xa178('0x41')],function(_0x4f34a6){var _0x152c07={};_0x152c07[_0x4f34a6]={'$like':'%'+_0x5eb341['query'][_0xa178('0x47')]+'%'};return _0x152c07;})});}_0x5a9ceb=_[_0xa178('0x49')]({},_0x5a9ceb,_0x5eb341[_0xa178('0x4a')]);return _0x545962['getAgents'](_0x5a9ceb);}})['then'](function(_0xede61c){if(_0xede61c){_0xa43941=_0xede61c[_0xa178('0x43')];if(!_0x5eb341[_0xa178('0x3d')][_0xa178('0x61')]('nolimit')){_0x5a9ceb[_0xa178('0x25')]=qs[_0xa178('0x25')](_0x5eb341[_0xa178('0x3d')][_0xa178('0x25')]);_0x5a9ceb[_0xa178('0x24')]=qs['offset'](_0x5eb341[_0xa178('0x3d')][_0xa178('0x24')]);}return _0x545962['getAgents'](_0x5a9ceb);}})[_0xa178('0x2e')](function(_0x3d6656){if(_0x3d6656){return _0x3d6656?{'count':_0xa43941,'rows':_0x3d6656}:null;}})[_0xa178('0x2e')](respondWithResult(_0x23e9c2,null))[_0xa178('0x4e')](handleError(_0x23e9c2,null));};function handleQuery(_0x3930a6){logger['info'](_0x3930a6);return db[_0xa178('0x92')][_0xa178('0x3d')](_0x3930a6)[_0xa178('0xa6')](function(_0x1519f2){csv_results[_0xa178('0x6a')](_0x1519f2);})[_0xa178('0x4e')](function(_0x277d82){logger[_0xa178('0x31')](_0x277d82[_0xa178('0xa7')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 7027f7c..d082a13 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x28bb5a,_0xa2396d){var _0x4580a4=function(_0x1c1082){while(--_0x1c1082){_0x28bb5a['push'](_0x28bb5a['shift']());}};_0x4580a4(++_0xa2396d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x5a8026,_0x27f0de){_0x5a8026=_0x5a8026-0x0;var _0x2c56e4=_0xe14b[_0x5a8026];return _0x2c56e4;};'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 1d1a773..7373ef4 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 _0x4ea3=['CmList','cm_lists','lodash','util','../../config/logger','api','bluebird','path','./cmList.attributes','exports','define'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var moment=require('moment');var BPromise=require(_0x34ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ea('0x6'));module[_0x34ea('0x7')]=function(_0x962596,_0x123d48){return _0x962596[_0x34ea('0x8')](_0x34ea('0x9'),attributes,{'tableName':_0x34ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c81=['moment','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','api'];(function(_0x14aa02,_0x1a3202){var _0x12eaf4=function(_0xdb5f4d){while(--_0xdb5f4d){_0x14aa02['push'](_0x14aa02['shift']());}};_0x12eaf4(++_0x1a3202);}(_0x3c81,0x102));var _0x13c8=function(_0x258a57,_0x3ca5c7){_0x258a57=_0x258a57-0x0;var _0x30a767=_0x3c81[_0x258a57];return _0x30a767;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),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 9c2789b..69436bb 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 _0x3e81=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x497b08,_0x37fc63){var _0x39e605=function(_0x3f738b){while(--_0x3f738b){_0x497b08['push'](_0x497b08['shift']());}};_0x39e605(++_0x37fc63);}(_0x3e81,0x136));var _0x13e8=function(_0x569059,_0x490d98){_0x569059=_0x569059-0x0;var _0x4c2cfb=_0x3e81[_0x569059];return _0x4c2cfb;};'use strict';var _=require(_0x13e8('0x0'));var util=require(_0x13e8('0x1'));var moment=require(_0x13e8('0x2'));var BPromise=require(_0x13e8('0x3'));var rs=require(_0x13e8('0x4'));var fs=require('fs');var Redis=require(_0x13e8('0x5'));var db=require(_0x13e8('0x6'))['db'];var utils=require(_0x13e8('0x7'));var logger=require(_0x13e8('0x8'))('rpc');var config=require(_0x13e8('0x9'));var jayson=require(_0x13e8('0xa'));var client=jayson[_0x13e8('0xb')][_0x13e8('0xc')]({'port':0x232a});config[_0x13e8('0xd')]=_[_0x13e8('0xe')](config[_0x13e8('0xd')],{'host':_0x13e8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13e8('0xd')]));require(_0x13e8('0x10'))[_0x13e8('0x11')](socket);function respondWithRpcPromise(_0x3f8fe7,_0x3d5aa3,_0x131e35){return new BPromise(function(_0x5d25d4,_0x337f8e){return client[_0x13e8('0x12')](_0x3f8fe7,_0x131e35)[_0x13e8('0x13')](function(_0x1f199f){logger[_0x13e8('0x14')](_0x13e8('0x15'),_0x3d5aa3,_0x13e8('0x16'));logger[_0x13e8('0x17')](_0x13e8('0x18'),_0x3d5aa3,'request\x20sent',JSON['stringify'](_0x1f199f));if(_0x1f199f['error']){if(_0x1f199f[_0x13e8('0x19')][_0x13e8('0x1a')]===0x1f4){logger[_0x13e8('0x19')](_0x13e8('0x15'),_0x3d5aa3,_0x1f199f[_0x13e8('0x19')]['message']);return _0x337f8e(_0x1f199f[_0x13e8('0x19')][_0x13e8('0x1b')]);}logger[_0x13e8('0x19')](_0x13e8('0x15'),_0x3d5aa3,_0x1f199f[_0x13e8('0x19')][_0x13e8('0x1b')]);return _0x5d25d4(_0x1f199f[_0x13e8('0x19')][_0x13e8('0x1b')]);}else{logger['info'](_0x13e8('0x15'),_0x3d5aa3,'request\x20sent');_0x5d25d4(_0x1f199f[_0x13e8('0x1c')][_0x13e8('0x1b')]);}})['catch'](function(_0x3fa5d6){logger[_0x13e8('0x19')](_0x13e8('0x15'),_0x3d5aa3,_0x3fa5d6);_0x337f8e(_0x3fa5d6);});});} \ No newline at end of file +var _0x74ea=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x41bb67,_0xbe40bd){var _0xbd072a=function(_0xe6233f){while(--_0xe6233f){_0x41bb67['push'](_0x41bb67['shift']());}};_0xbd072a(++_0xbe40bd);}(_0x74ea,0x96));var _0xa74e=function(_0x230811,_0x5981b9){_0x230811=_0x230811-0x0;var _0x41c94d=_0x74ea[_0x230811];return _0x41c94d;};'use strict';var _=require(_0xa74e('0x0'));var util=require(_0xa74e('0x1'));var moment=require(_0xa74e('0x2'));var BPromise=require(_0xa74e('0x3'));var rs=require(_0xa74e('0x4'));var fs=require('fs');var Redis=require(_0xa74e('0x5'));var db=require(_0xa74e('0x6'))['db'];var utils=require(_0xa74e('0x7'));var logger=require(_0xa74e('0x8'))(_0xa74e('0x9'));var config=require(_0xa74e('0xa'));var jayson=require(_0xa74e('0xb'));var client=jayson[_0xa74e('0xc')][_0xa74e('0xd')]({'port':0x232a});config[_0xa74e('0xe')]=_[_0xa74e('0xf')](config[_0xa74e('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xa74e('0x10'))(new Redis(config[_0xa74e('0xe')]));require('./cmList.socket')[_0xa74e('0x11')](socket);function respondWithRpcPromise(_0x4803a5,_0x48802b,_0x32eaa3){return new BPromise(function(_0x22172c,_0x4e2800){return client[_0xa74e('0x12')](_0x4803a5,_0x32eaa3)[_0xa74e('0x13')](function(_0x435a58){logger[_0xa74e('0x14')](_0xa74e('0x15'),_0x48802b,_0xa74e('0x16'));logger[_0xa74e('0x17')](_0xa74e('0x18'),_0x48802b,_0xa74e('0x16'),JSON[_0xa74e('0x19')](_0x435a58));if(_0x435a58[_0xa74e('0x1a')]){if(_0x435a58[_0xa74e('0x1a')][_0xa74e('0x1b')]===0x1f4){logger['error'](_0xa74e('0x15'),_0x48802b,_0x435a58[_0xa74e('0x1a')][_0xa74e('0x1c')]);return _0x4e2800(_0x435a58[_0xa74e('0x1a')][_0xa74e('0x1c')]);}logger[_0xa74e('0x1a')](_0xa74e('0x15'),_0x48802b,_0x435a58[_0xa74e('0x1a')][_0xa74e('0x1c')]);return _0x22172c(_0x435a58[_0xa74e('0x1a')][_0xa74e('0x1c')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x48802b,_0xa74e('0x16'));_0x22172c(_0x435a58['result'][_0xa74e('0x1c')]);}})[_0xa74e('0x1d')](function(_0x492653){logger[_0xa74e('0x1a')](_0xa74e('0x15'),_0x48802b,_0x492653);_0x4e2800(_0x492653);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index b361c1f..fe53fea 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 _0x4ed3=['update','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0x47510,_0x20d6d6){var _0x31c366=function(_0x405f7b){while(--_0x405f7b){_0x47510['push'](_0x47510['shift']());}};_0x31c366(++_0x20d6d6);}(_0x4ed3,0x18d));var _0x34ed=function(_0xff6bbd,_0x34e0b6){_0xff6bbd=_0xff6bbd-0x0;var _0x2a2697=_0x4ed3[_0xff6bbd];return _0x2a2697;};'use strict';var CmListEvents=require(_0x34ed('0x0'));var events=[_0x34ed('0x1'),_0x34ed('0x2'),_0x34ed('0x3')];function createListener(_0x9e8c0e,_0x216481){return function(_0x187c91){_0x216481['emit'](_0x9e8c0e,_0x187c91);};}function removeListener(_0x5a77ac,_0x25f194){return function(){CmListEvents[_0x34ed('0x4')](_0x5a77ac,_0x25f194);};}exports[_0x34ed('0x5')]=function(_0xf4f052){for(var _0x3b9d43=0x0,_0x74b920=events[_0x34ed('0x6')];_0x3b9d43<_0x74b920;_0x3b9d43++){var _0x33b60f=events[_0x3b9d43];var _0x4d5330=createListener(_0x34ed('0x7')+_0x33b60f,_0xf4f052);CmListEvents['on'](_0x33b60f,_0x4d5330);}}; \ No newline at end of file +var _0xb682=['cmList:','save','remove','update','emit','removeListener','register','length'];(function(_0x228eaf,_0x3cc265){var _0x52d723=function(_0x17d038){while(--_0x17d038){_0x228eaf['push'](_0x228eaf['shift']());}};_0x52d723(++_0x3cc265);}(_0xb682,0x79));var _0x2b68=function(_0x1f68dd,_0x40414e){_0x1f68dd=_0x1f68dd-0x0;var _0x5b72c9=_0xb682[_0x1f68dd];return _0x5b72c9;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x2b68('0x0'),_0x2b68('0x1'),_0x2b68('0x2')];function createListener(_0x27c2e6,_0x1a6ced){return function(_0x4793e4){_0x1a6ced[_0x2b68('0x3')](_0x27c2e6,_0x4793e4);};}function removeListener(_0x2b54ca,_0x5836e){return function(){CmListEvents[_0x2b68('0x4')](_0x2b54ca,_0x5836e);};}exports[_0x2b68('0x5')]=function(_0x59c69c){for(var _0x4c9d31=0x0,_0xfc3d27=events[_0x2b68('0x6')];_0x4c9d31<_0xfc3d27;_0x4c9d31++){var _0x2fef79=events[_0x4c9d31];var _0x503e9d=createListener(_0x2b68('0x7')+_0x2fef79,_0x59c69c);CmListEvents['on'](_0x2fef79,_0x503e9d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a06d5c2..d75cfb0 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 _0xfb44=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','getGlobalCustomFields','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','post','create','addContacts','addCustomField','addAgents','/:id','update','delete','destroy','removeAgents','exports'];(function(_0x290a36,_0x561046){var _0xc59237=function(_0x5c0c52){while(--_0x5c0c52){_0x290a36['push'](_0x290a36['shift']());}};_0xc59237(++_0x561046);}(_0xfb44,0xd9));var _0x4fb4=function(_0x2dce55,_0x47808d){_0x2dce55=_0x2dce55-0x0;var _0x32c4ff=_0xfb44[_0x2dce55];return _0x32c4ff;};'use strict';var multer=require(_0x4fb4('0x0'));var util=require(_0x4fb4('0x1'));var path=require(_0x4fb4('0x2'));var timeout=require(_0x4fb4('0x3'));var express=require('express');var router=express[_0x4fb4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4fb4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4fb4('0x6'));var controller=require('./cmList.controller');router['get']('/',auth[_0x4fb4('0x7')](),controller[_0x4fb4('0x8')]);router[_0x4fb4('0x9')]('/describe',auth[_0x4fb4('0x7')](),controller[_0x4fb4('0xa')]);router[_0x4fb4('0x9')]('/global_fields',auth[_0x4fb4('0x7')](),controller[_0x4fb4('0xb')]);router[_0x4fb4('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4fb4('0x9')](_0x4fb4('0xc'),auth[_0x4fb4('0x7')](),controller[_0x4fb4('0xd')]);router[_0x4fb4('0x9')](_0x4fb4('0xe'),auth['isAuthenticated'](),controller[_0x4fb4('0xf')]);router['get'](_0x4fb4('0x10'),auth[_0x4fb4('0x7')](),controller[_0x4fb4('0x11')]);router[_0x4fb4('0x9')](_0x4fb4('0x12'),auth[_0x4fb4('0x7')](),controller['getCustomFields']);router['get'](_0x4fb4('0x13'),auth[_0x4fb4('0x7')](),controller['getAgents']);router[_0x4fb4('0x14')]('/',auth['isAuthenticated'](),controller[_0x4fb4('0x15')]);router['post']('/:id/dispositions',auth[_0x4fb4('0x7')](),controller['addDisposition']);router[_0x4fb4('0x14')](_0x4fb4('0xe'),auth[_0x4fb4('0x7')](),controller[_0x4fb4('0x16')]);router[_0x4fb4('0x14')]('/:id/fields',auth[_0x4fb4('0x7')](),controller[_0x4fb4('0x17')]);router['post'](_0x4fb4('0x13'),auth[_0x4fb4('0x7')](),controller[_0x4fb4('0x18')]);router['put'](_0x4fb4('0x19'),auth[_0x4fb4('0x7')](),controller[_0x4fb4('0x1a')]);router[_0x4fb4('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x4fb4('0x1c')]);router[_0x4fb4('0x1b')](_0x4fb4('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x4fb4('0x1b')](_0x4fb4('0x13'),auth[_0x4fb4('0x7')](),controller[_0x4fb4('0x1d')]);module[_0x4fb4('0x1e')]=router; \ No newline at end of file +var _0xcc8d=['isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','addCustomField','update','delete','destroy','removeDispositions','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe'];(function(_0x206a1a,_0x46d847){var _0x578099=function(_0x5475cf){while(--_0x5475cf){_0x206a1a['push'](_0x206a1a['shift']());}};_0x578099(++_0x46d847);}(_0xcc8d,0xbb));var _0xdcc8=function(_0x272d97,_0x3cb745){_0x272d97=_0x272d97-0x0;var _0x40fc01=_0xcc8d[_0x272d97];return _0x40fc01;};'use strict';var multer=require('multer');var util=require(_0xdcc8('0x0'));var path=require(_0xdcc8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdcc8('0x2')]();var fs_extra=require(_0xdcc8('0x3'));var auth=require(_0xdcc8('0x4'));var interaction=require(_0xdcc8('0x5'));var config=require(_0xdcc8('0x6'));var controller=require(_0xdcc8('0x7'));router[_0xdcc8('0x8')]('/',auth['isAuthenticated'](),controller[_0xdcc8('0x9')]);router[_0xdcc8('0x8')](_0xdcc8('0xa'),auth[_0xdcc8('0xb')](),controller[_0xdcc8('0xc')]);router['get'](_0xdcc8('0xd'),auth[_0xdcc8('0xb')](),controller[_0xdcc8('0xe')]);router[_0xdcc8('0x8')](_0xdcc8('0xf'),auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x10')]);router[_0xdcc8('0x8')](_0xdcc8('0x11'),auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x12')]);router[_0xdcc8('0x8')]('/:id/contacts',auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x13')]);router['get'](_0xdcc8('0x14'),auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x15')]);router[_0xdcc8('0x8')]('/:id/fields',auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x16')]);router['get'](_0xdcc8('0x17'),auth['isAuthenticated'](),controller[_0xdcc8('0x18')]);router[_0xdcc8('0x19')]('/',auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x1a')]);router[_0xdcc8('0x19')](_0xdcc8('0x11'),auth[_0xdcc8('0xb')](),controller['addDisposition']);router['post']('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0xdcc8('0x19')]('/:id/fields',auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x1b')]);router[_0xdcc8('0x19')](_0xdcc8('0x17'),auth[_0xdcc8('0xb')](),controller['addAgents']);router['put'](_0xdcc8('0xf'),auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x1c')]);router[_0xdcc8('0x1d')](_0xdcc8('0xf'),auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x1e')]);router[_0xdcc8('0x1d')](_0xdcc8('0x11'),auth[_0xdcc8('0xb')](),controller[_0xdcc8('0x1f')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xdcc8('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 9997282..4f4532d 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 _0xdddd=['exports','VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x35309e,_0x366ab7){var _0x5f5bf6=function(_0x449bca){while(--_0x449bca){_0x35309e['push'](_0x35309e['shift']());}};_0x5f5bf6(++_0x366ab7);}(_0xdddd,0x7c));var _0xdddd=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0xdddd[_0x18b344];return _0x5ef6bb;};'use strict';var Sequelize=require(_0xdddd('0x0'));module[_0xdddd('0x1')]={'name':{'type':Sequelize[_0xdddd('0x2')],'get':function(_0x1a0d4){return this[_0xdddd('0x3')]('field');}},'field':{'type':Sequelize[_0xdddd('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xdddd('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x4539=['VIRTUAL','getDataValue','field','STRING','exports'];(function(_0x9d9d58,_0x7bf873){var _0x51d4d3=function(_0x3e7528){while(--_0x3e7528){_0x9d9d58['push'](_0x9d9d58['shift']());}};_0x51d4d3(++_0x7bf873);}(_0x4539,0xf4));var _0x9453=function(_0x4d5c02,_0x4f7765){_0x4d5c02=_0x4d5c02-0x0;var _0x1c6f7f=_0x4539[_0x4d5c02];return _0x1c6f7f;};'use strict';var Sequelize=require('sequelize');module[_0x9453('0x0')]={'name':{'type':Sequelize[_0x9453('0x1')],'get':function(_0x41c16a){return this[_0x9453('0x2')](_0x9453('0x3'));}},'field':{'type':Sequelize[_0x9453('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index c68db73..ccb3538 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(_0x4d9e00,_0x5ba667){var _0x374fb5=function(_0x295ff9){while(--_0x295ff9){_0x4d9e00['push'](_0x4d9e00['shift']());}};_0x374fb5(++_0x5ba667);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x582174,_0x329efb){var _0x14c2b6=function(_0x4da3dd){while(--_0x4da3dd){_0x582174['push'](_0x582174['shift']());}};_0x14c2b6(++_0x329efb);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index cfff01c..a6cef84 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 _0xd19d=['./condition.attributes','Condition','tools_conditions','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x3270f3,_0x155358){var _0x102730=function(_0x8d90b0){while(--_0x8d90b0){_0x3270f3['push'](_0x3270f3['shift']());}};_0x102730(++_0x155358);}(_0xd19d,0x78));var _0xdd19=function(_0x30c67d,_0x12ee05){_0x30c67d=_0x30c67d-0x0;var _0x559751=_0xd19d[_0x30c67d];return _0x559751;};'use strict';var _=require('lodash');var util=require(_0xdd19('0x0'));var logger=require(_0xdd19('0x1'))('api');var moment=require(_0xdd19('0x2'));var BPromise=require(_0xdd19('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd19('0x4'));var rimraf=require('rimraf');var config=require(_0xdd19('0x5'));var attributes=require(_0xdd19('0x6'));module['exports']=function(_0x46bfc5,_0x3ff03e){return _0x46bfc5['define'](_0xdd19('0x7'),attributes,{'tableName':_0xdd19('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08f5=['moment','request-promise','path','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api'];(function(_0x5223b4,_0x578cb5){var _0x5467aa=function(_0x410fcc){while(--_0x410fcc){_0x5223b4['push'](_0x5223b4['shift']());}};_0x5467aa(++_0x578cb5);}(_0x08f5,0x172));var _0x508f=function(_0x2df2d0,_0x1d6ea8){_0x2df2d0=_0x2df2d0-0x0;var _0x3c4438=_0x08f5[_0x2df2d0];return _0x3c4438;};'use strict';var _=require(_0x508f('0x0'));var util=require(_0x508f('0x1'));var logger=require(_0x508f('0x2'))(_0x508f('0x3'));var moment=require(_0x508f('0x4'));var BPromise=require('bluebird');var rp=require(_0x508f('0x5'));var fs=require('fs');var path=require(_0x508f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0x508f('0x7')]=function(_0x2cfdb7,_0x2173b9){return _0x2cfdb7[_0x508f('0x8')](_0x508f('0x9'),attributes,{'tableName':_0x508f('0xa'),'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 754ae6e..e6c999a 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 _0xd600=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd600,0x79));var _0x0d60=function(_0x2ef9ef,_0x4d614c){_0x2ef9ef=_0x2ef9ef-0x0;var _0x15329a=_0xd600[_0x2ef9ef];return _0x15329a;};'use strict';var _=require(_0x0d60('0x0'));var util=require(_0x0d60('0x1'));var moment=require(_0x0d60('0x2'));var BPromise=require(_0x0d60('0x3'));var rs=require(_0x0d60('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d60('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d60('0x6'))(_0x0d60('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d60('0x8'));var client=jayson['client'][_0x0d60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x124f34,_0x3c6e14,_0x1d29a3){return new BPromise(function(_0x2f239a,_0x5e7f8f){return client['request'](_0x124f34,_0x1d29a3)[_0x0d60('0xa')](function(_0x15b10b){logger[_0x0d60('0xb')](_0x0d60('0xc'),_0x3c6e14,_0x0d60('0xd'));logger['debug'](_0x0d60('0xe'),_0x3c6e14,_0x0d60('0xd'),JSON['stringify'](_0x15b10b));if(_0x15b10b[_0x0d60('0xf')]){if(_0x15b10b[_0x0d60('0xf')][_0x0d60('0x10')]===0x1f4){logger[_0x0d60('0xf')](_0x0d60('0xc'),_0x3c6e14,_0x15b10b[_0x0d60('0xf')][_0x0d60('0x11')]);return _0x5e7f8f(_0x15b10b[_0x0d60('0xf')][_0x0d60('0x11')]);}logger['error'](_0x0d60('0xc'),_0x3c6e14,_0x15b10b[_0x0d60('0xf')][_0x0d60('0x11')]);return _0x2f239a(_0x15b10b[_0x0d60('0xf')][_0x0d60('0x11')]);}else{logger[_0x0d60('0xb')](_0x0d60('0xc'),_0x3c6e14,_0x0d60('0xd'));_0x2f239a(_0x15b10b[_0x0d60('0x12')][_0x0d60('0x11')]);}})[_0x0d60('0x13')](function(_0x41cbbf){logger[_0x0d60('0xf')](_0x0d60('0xc'),_0x3c6e14,_0x41cbbf);_0x5e7f8f(_0x41cbbf);});});} \ No newline at end of file +var _0x1be3=['debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s'];(function(_0x26e115,_0x50c38b){var _0x5452e5=function(_0x1d0443){while(--_0x1d0443){_0x26e115['push'](_0x26e115['shift']());}};_0x5452e5(++_0x50c38b);}(_0x1be3,0xb7));var _0x31be=function(_0x55b2a6,_0x287292){_0x55b2a6=_0x55b2a6-0x0;var _0x484272=_0x1be3[_0x55b2a6];return _0x484272;};'use strict';var _=require(_0x31be('0x0'));var util=require(_0x31be('0x1'));var moment=require(_0x31be('0x2'));var BPromise=require(_0x31be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31be('0x4'));var db=require(_0x31be('0x5'))['db'];var utils=require(_0x31be('0x6'));var logger=require(_0x31be('0x7'))(_0x31be('0x8'));var config=require(_0x31be('0x9'));var jayson=require(_0x31be('0xa'));var client=jayson[_0x31be('0xb')][_0x31be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfed0db,_0x362aed,_0x2c36cf){return new BPromise(function(_0x45fd4c,_0x2a0d5c){return client[_0x31be('0xd')](_0xfed0db,_0x2c36cf)[_0x31be('0xe')](function(_0x31c59c){logger[_0x31be('0xf')](_0x31be('0x10'),_0x362aed,'request\x20sent');logger[_0x31be('0x11')](_0x31be('0x12'),_0x362aed,_0x31be('0x13'),JSON[_0x31be('0x14')](_0x31c59c));if(_0x31c59c[_0x31be('0x15')]){if(_0x31c59c['error'][_0x31be('0x16')]===0x1f4){logger[_0x31be('0x15')](_0x31be('0x10'),_0x362aed,_0x31c59c[_0x31be('0x15')]['message']);return _0x2a0d5c(_0x31c59c['error'][_0x31be('0x17')]);}logger[_0x31be('0x15')](_0x31be('0x10'),_0x362aed,_0x31c59c['error']['message']);return _0x45fd4c(_0x31c59c[_0x31be('0x15')][_0x31be('0x17')]);}else{logger[_0x31be('0xf')](_0x31be('0x10'),_0x362aed,_0x31be('0x13'));_0x45fd4c(_0x31c59c['result'][_0x31be('0x17')]);}})[_0x31be('0x18')](function(_0x448773){logger[_0x31be('0x15')]('Condition,\x20%s,\x20%s',_0x362aed,_0x448773);_0x2a0d5c(_0x448773);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 83abc20..e2a7885 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 _0xb40e=['../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','path','Router','fs-extra','../../components/interaction/service'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xb40e,0x1e8));var _0xeb40=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xb40e[_0x1314d4];return _0x584ba5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb40('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeb40('0x1')]();var fs_extra=require(_0xeb40('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xeb40('0x3'));var config=require(_0xeb40('0x4'));var controller=require(_0xeb40('0x5'));router[_0xeb40('0x6')]('/:id',auth[_0xeb40('0x7')](),controller[_0xeb40('0x8')]);router[_0xeb40('0x9')](_0xeb40('0xa'),auth[_0xeb40('0x7')](),controller[_0xeb40('0xb')]);module['exports']=router; \ No newline at end of file +var _0xb728=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete'];(function(_0x27c3f0,_0x198aa2){var _0x11e51c=function(_0x2a48ec){while(--_0x2a48ec){_0x27c3f0['push'](_0x27c3f0['shift']());}};_0x11e51c(++_0x198aa2);}(_0xb728,0xe2));var _0x8b72=function(_0x4e79f6,_0x1d4e77){_0x4e79f6=_0x4e79f6-0x0;var _0x14004f=_0xb728[_0x4e79f6];return _0x14004f;};'use strict';var multer=require(_0x8b72('0x0'));var util=require(_0x8b72('0x1'));var path=require(_0x8b72('0x2'));var timeout=require(_0x8b72('0x3'));var express=require('express');var router=express[_0x8b72('0x4')]();var fs_extra=require(_0x8b72('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b72('0x6'));var config=require(_0x8b72('0x7'));var controller=require(_0x8b72('0x8'));router[_0x8b72('0x9')](_0x8b72('0xa'),auth[_0x8b72('0xb')](),controller[_0x8b72('0xc')]);router[_0x8b72('0xd')](_0x8b72('0xa'),auth[_0x8b72('0xb')](),controller['destroy']);module[_0x8b72('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 6223458..9ddee87 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 _0xb570=['name','INTEGER','exports','STRING'];(function(_0x10905e,_0x16f95c){var _0x537230=function(_0x4545bc){while(--_0x4545bc){_0x10905e['push'](_0x10905e['shift']());}};_0x537230(++_0x16f95c);}(_0xb570,0x166));var _0x0b57=function(_0x53da63,_0x4b1248){_0x53da63=_0x53da63-0x0;var _0x59296=_0xb570[_0x53da63];return _0x59296;};'use strict';var Sequelize=require('sequelize');module[_0x0b57('0x0')]={'name':{'type':Sequelize[_0x0b57('0x1')],'allowNull':![],'unique':_0x0b57('0x2')},'OrderBy':{'type':Sequelize[_0x0b57('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0b57('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xb9bf=['exports','STRING','INTEGER','sequelize'];(function(_0x2eeb8f,_0x3ed960){var _0x1057a6=function(_0x1b712f){while(--_0x1b712f){_0x2eeb8f['push'](_0x2eeb8f['shift']());}};_0x1057a6(++_0x3ed960);}(_0xb9bf,0xaf));var _0xfb9b=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xb9bf[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0xfb9b('0x0'));module[_0xfb9b('0x1')]={'name':{'type':Sequelize[_0xfb9b('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xfb9b('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index dc6ee62..5821735 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 _0x3423=['../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','ContactItemTypes','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','role','user','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','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'];(function(_0x5b459a,_0x72a5bd){var _0x35b0dd=function(_0x287f7d){while(--_0x287f7d){_0x5b459a['push'](_0x5b459a['shift']());}};_0x35b0dd(++_0x72a5bd);}(_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(){var _0x30ffc9=_0x26eb87['get']({'plain':!![]});var _0x51cf45=_0x3342('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x51cf45,'resourceId':_0x30ffc9['id']}})[_0x3342('0x21')](function(){return _0x26eb87;});})['then'](function(){_0xd2b87d[_0x3342('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524286,_0x55cddd){return function(_0x1497d9){if(!_0x1497d9){_0x524286[_0x3342('0x16')](0x194);}return _0x1497d9;};}function handleError(_0x1dd607,_0x5eef2b){_0x5eef2b=_0x5eef2b||0x1f4;return function(_0xc275a1){logger[_0x3342('0x24')](_0xc275a1[_0x3342('0x25')]);if(_0xc275a1[_0x3342('0x26')]){delete _0xc275a1['name'];}_0x1dd607[_0x3342('0x17')](_0x5eef2b)[_0x3342('0x27')](_0xc275a1);};}exports[_0x3342('0x28')]=function(_0x301114,_0xf82530){var _0x2cc691={},_0x135760={},_0x47b2a0={'count':0x0,'rows':[]};var _0x2e0bde=_['map'](db[_0x3342('0x29')][_0x3342('0x2a')],function(_0x508f87){return{'name':_0x508f87[_0x3342('0x2b')],'type':_0x508f87[_0x3342('0x2c')][_0x3342('0x2d')]};});_0x135760[_0x3342('0x2e')]=_['map'](_0x2e0bde,_0x3342('0x26'));_0x135760[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x301114[_0x3342('0x2f')]);_0x135760[_0x3342('0x31')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],_0x135760[_0x3342('0x2f')]);_0x2cc691[_0x3342('0x33')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],qs[_0x3342('0x34')](_0x301114['query']['fields']));_0x2cc691[_0x3342('0x33')]=_0x2cc691['attributes'][_0x3342('0x35')]?_0x2cc691[_0x3342('0x33')]:_0x135760[_0x3342('0x2e')];if(!_0x301114[_0x3342('0x2f')][_0x3342('0x36')](_0x3342('0x37'))){_0x2cc691[_0x3342('0x1c')]=qs['limit'](_0x301114[_0x3342('0x2f')][_0x3342('0x1c')]);_0x2cc691[_0x3342('0x19')]=qs[_0x3342('0x19')](_0x301114[_0x3342('0x2f')]['offset']);}_0x2cc691[_0x3342('0x38')]=qs['sort'](_0x301114[_0x3342('0x2f')][_0x3342('0x39')]);_0x2cc691[_0x3342('0x3a')]=qs[_0x3342('0x31')](_['pick'](_0x301114[_0x3342('0x2f')],_0x135760['filters']),_0x2e0bde);if(_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]){_0x2cc691[_0x3342('0x3a')]=_[_0x3342('0x3c')](_0x2cc691[_0x3342('0x3a')],{'$or':_[_0x3342('0x3d')](_0x2e0bde,function(_0x32ef9a){if(_0x32ef9a['type']!==_0x3342('0x3e')){var _0x355e83={};_0x355e83[_0x32ef9a['name']]={'$like':'%'+_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]+'%'};return _0x355e83;}})});}_0x2cc691=_['merge']({},_0x2cc691,_0x301114[_0x3342('0x3f')]);var _0x29f0a0={'where':_0x2cc691['where']};return db['ContactItemType']['count'](_0x29f0a0)[_0x3342('0x21')](function(_0x41e727){_0x47b2a0['count']=_0x41e727;if(_0x301114[_0x3342('0x2f')][_0x3342('0x40')]){_0x2cc691[_0x3342('0x41')]=[{'all':!![]}];}return db[_0x3342('0x29')][_0x3342('0x42')](_0x2cc691);})[_0x3342('0x21')](function(_0x34de7b){_0x47b2a0[_0x3342('0x43')]=_0x34de7b;return _0x47b2a0;})['then'](respondWithFilteredResult(_0xf82530,_0x2cc691))['catch'](handleError(_0xf82530,null));};exports[_0x3342('0x44')]=function(_0x7341fa,_0x474196){var _0xee717e={'raw':!![],'where':{'id':_0x7341fa[_0x3342('0x45')]['id']}},_0x717946={};_0x717946['model']=_[_0x3342('0x30')](db[_0x3342('0x29')][_0x3342('0x2a')]);_0x717946[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x7341fa[_0x3342('0x2f')]);_0x717946['filters']=_[_0x3342('0x32')](_0x717946['model'],_0x717946[_0x3342('0x2f')]);_0xee717e[_0x3342('0x33')]=_[_0x3342('0x32')](_0x717946[_0x3342('0x2e')],qs['fields'](_0x7341fa[_0x3342('0x2f')][_0x3342('0x34')]));_0xee717e['attributes']=_0xee717e[_0x3342('0x33')][_0x3342('0x35')]?_0xee717e[_0x3342('0x33')]:_0x717946[_0x3342('0x2e')];if(_0x7341fa['query'][_0x3342('0x40')]){_0xee717e[_0x3342('0x41')]=[{'all':!![]}];}_0xee717e=_['merge']({},_0xee717e,_0x7341fa[_0x3342('0x3f')]);return db['ContactItemType']['find'](_0xee717e)[_0x3342('0x21')](handleEntityNotFound(_0x474196,null))[_0x3342('0x21')](respondWithResult(_0x474196,null))[_0x3342('0x46')](handleError(_0x474196,null));};exports[_0x3342('0x47')]=function(_0x23925e,_0x171387){return db[_0x3342('0x29')]['create'](_0x23925e['body'],{})[_0x3342('0x21')](function(_0x5a9e40){var _0x26251c=_0x23925e['user']['get']({'plain':!![]});if(!_0x26251c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26251c[_0x3342('0x48')]===_0x3342('0x49')){var _0x29ccb6=_0x5a9e40[_0x3342('0x4a')]({'plain':!![]});var _0x5176d7=_0x3342('0x23');return db[_0x3342('0x4b')]['find']({'where':{'name':_0x5176d7,'userProfileId':_0x26251c[_0x3342('0x4c')]},'raw':!![]})[_0x3342('0x21')](function(_0x43c27a){if(_0x43c27a&&_0x43c27a['autoAssociation']===0x0){return db[_0x3342('0x4d')][_0x3342('0x47')]({'name':_0x29ccb6[_0x3342('0x26')],'resourceId':_0x29ccb6['id'],'type':_0x43c27a[_0x3342('0x26')],'sectionId':_0x43c27a['id']},{})[_0x3342('0x21')](function(){return _0x5a9e40;});}else{return _0x5a9e40;}})['catch'](function(_0x2699d2){logger[_0x3342('0x24')](_0x3342('0x4e'),_0x2699d2);throw _0x2699d2;});}return _0x5a9e40;})[_0x3342('0x21')](respondWithResult(_0x171387,0xc9))[_0x3342('0x46')](handleError(_0x171387,null));};exports[_0x3342('0x20')]=function(_0x3db07c,_0x47cf76){if(_0x3db07c[_0x3342('0x4f')]['id']){delete _0x3db07c['body']['id'];}return db[_0x3342('0x29')]['find']({'where':{'id':_0x3db07c[_0x3342('0x45')]['id']}})['then'](handleEntityNotFound(_0x47cf76,null))['then'](saveUpdates(_0x3db07c['body'],null))['then'](respondWithResult(_0x47cf76,null))[_0x3342('0x46')](handleError(_0x47cf76,null));};exports[_0x3342('0x22')]=function(_0x3cd098,_0x476973){return db[_0x3342('0x29')][_0x3342('0x50')]({'where':{'id':_0x3cd098[_0x3342('0x45')]['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x476973,null))[_0x3342('0x21')](db[_0x3342('0x51')][_0x3342('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3cd098['params']['id']}}))['then'](removeEntity(_0x476973,null))[_0x3342('0x46')](handleError(_0x476973,null));}; \ No newline at end of file +var _0x8f59=['index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','ContactItemType','includeAll','findAll','show','include','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','ContactItemTypes','end','stack','name','send'];(function(_0x13dbd8,_0x3e11de){var _0x42b769=function(_0x2c5f9e){while(--_0x2c5f9e){_0x13dbd8['push'](_0x13dbd8['shift']());}};_0x42b769(++_0x3e11de);}(_0x8f59,0x11d));var _0x98f5=function(_0x35f58d,_0x56c821){_0x35f58d=_0x35f58d-0x0;var _0xbca79b=_0x8f59[_0x35f58d];return _0xbca79b;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];function respondWithStatusCode(_0x259abe,_0x1f00e8){_0x1f00e8=_0x1f00e8||0xcc;return function(_0x160626){if(_0x160626){return _0x259abe[_0x98f5('0x18')](_0x1f00e8);}return _0x259abe[_0x98f5('0x19')](_0x1f00e8)['end']();};}function respondWithResult(_0x24a7a9,_0xbade31){_0xbade31=_0xbade31||0xc8;return function(_0x5b8bab){if(_0x5b8bab){return _0x24a7a9[_0x98f5('0x19')](_0xbade31)[_0x98f5('0x1a')](_0x5b8bab);}};}function respondWithFilteredResult(_0xaa951a,_0x4ae70d){return function(_0x2437e7){if(_0x2437e7){var _0xc7a49b=typeof _0x4ae70d[_0x98f5('0x1b')]==='undefined'&&typeof _0x4ae70d[_0x98f5('0x1c')]===_0x98f5('0x1d');var _0x574644=_0x2437e7[_0x98f5('0x1e')];var _0x51a567=_0xc7a49b?0x0:_0x4ae70d[_0x98f5('0x1b')];var _0x9e42dd=_0xc7a49b?_0x2437e7[_0x98f5('0x1e')]:_0x4ae70d[_0x98f5('0x1b')]+_0x4ae70d[_0x98f5('0x1c')];var _0xa4477c;if(_0x9e42dd>=_0x574644){_0x9e42dd=_0x574644;_0xa4477c=0xc8;}else{_0xa4477c=0xce;}_0xaa951a['status'](_0xa4477c);return _0xaa951a[_0x98f5('0x1f')]('Content-Range',_0x51a567+'-'+_0x9e42dd+'/'+_0x574644)[_0x98f5('0x1a')](_0x2437e7);}return null;};}function patchUpdates(_0x191f23){return function(_0x5deca0){try{jsonpatch[_0x98f5('0x20')](_0x5deca0,_0x191f23,!![]);}catch(_0x2933d1){return BPromise[_0x98f5('0x21')](_0x2933d1);}return _0x5deca0[_0x98f5('0x22')]();};}function saveUpdates(_0x3b2d9d,_0x3dc7c2){return function(_0x38b46d){if(_0x38b46d){return _0x38b46d['update'](_0x3b2d9d)[_0x98f5('0x23')](function(_0x49ee4e){return _0x49ee4e;});}return null;};}function removeEntity(_0xcb10d6,_0x495889){return function(_0x44bfbb){if(_0x44bfbb){return _0x44bfbb[_0x98f5('0x24')]()[_0x98f5('0x23')](function(){var _0x5c64e=_0x44bfbb[_0x98f5('0x25')]({'plain':!![]});var _0x18052d=_0x98f5('0x26');return db['UserProfileResource'][_0x98f5('0x24')]({'where':{'type':_0x18052d,'resourceId':_0x5c64e['id']}})[_0x98f5('0x23')](function(){return _0x44bfbb;});})['then'](function(){_0xcb10d6[_0x98f5('0x19')](0xcc)[_0x98f5('0x27')]();});}};}function handleEntityNotFound(_0x5b08c2,_0x214130){return function(_0x230d1b){if(!_0x230d1b){_0x5b08c2[_0x98f5('0x18')](0x194);}return _0x230d1b;};}function handleError(_0x17dcb2,_0x2b6993){_0x2b6993=_0x2b6993||0x1f4;return function(_0x576c4b){logger['error'](_0x576c4b[_0x98f5('0x28')]);if(_0x576c4b[_0x98f5('0x29')]){delete _0x576c4b[_0x98f5('0x29')];}_0x17dcb2[_0x98f5('0x19')](_0x2b6993)[_0x98f5('0x2a')](_0x576c4b);};}exports[_0x98f5('0x2b')]=function(_0x5e9d73,_0x29e1f5){var _0x6d7418={},_0x7a922b={},_0xd20823={'count':0x0,'rows':[]};var _0x1e7138=_[_0x98f5('0x2c')](db['ContactItemType'][_0x98f5('0x2d')],function(_0x4d4b5c){return{'name':_0x4d4b5c[_0x98f5('0x2e')],'type':_0x4d4b5c[_0x98f5('0x2f')]['key']};});_0x7a922b[_0x98f5('0x30')]=_[_0x98f5('0x2c')](_0x1e7138,_0x98f5('0x29'));_0x7a922b[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x5e9d73[_0x98f5('0x31')]);_0x7a922b[_0x98f5('0x33')]=_[_0x98f5('0x34')](_0x7a922b[_0x98f5('0x30')],_0x7a922b[_0x98f5('0x31')]);_0x6d7418[_0x98f5('0x35')]=_[_0x98f5('0x34')](_0x7a922b[_0x98f5('0x30')],qs[_0x98f5('0x36')](_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x36')]));_0x6d7418[_0x98f5('0x35')]=_0x6d7418[_0x98f5('0x35')][_0x98f5('0x37')]?_0x6d7418[_0x98f5('0x35')]:_0x7a922b['model'];if(!_0x5e9d73[_0x98f5('0x31')]['hasOwnProperty']('nolimit')){_0x6d7418[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x1c')]);_0x6d7418['offset']=qs[_0x98f5('0x1b')](_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x1b')]);}_0x6d7418['order']=qs[_0x98f5('0x38')](_0x5e9d73[_0x98f5('0x31')]['sort']);_0x6d7418[_0x98f5('0x39')]=qs[_0x98f5('0x33')](_[_0x98f5('0x3a')](_0x5e9d73['query'],_0x7a922b[_0x98f5('0x33')]),_0x1e7138);if(_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x3b')]){_0x6d7418[_0x98f5('0x39')]=_[_0x98f5('0x3c')](_0x6d7418['where'],{'$or':_['map'](_0x1e7138,function(_0x46cb30){if(_0x46cb30[_0x98f5('0x2f')]!==_0x98f5('0x3d')){var _0x3d7a4f={};_0x3d7a4f[_0x46cb30[_0x98f5('0x29')]]={'$like':'%'+_0x5e9d73[_0x98f5('0x31')]['filter']+'%'};return _0x3d7a4f;}})});}_0x6d7418=_['merge']({},_0x6d7418,_0x5e9d73[_0x98f5('0x3e')]);var _0xd74af2={'where':_0x6d7418[_0x98f5('0x39')]};return db[_0x98f5('0x3f')]['count'](_0xd74af2)['then'](function(_0x2dafcd){_0xd20823[_0x98f5('0x1e')]=_0x2dafcd;if(_0x5e9d73[_0x98f5('0x31')][_0x98f5('0x40')]){_0x6d7418['include']=[{'all':!![]}];}return db['ContactItemType'][_0x98f5('0x41')](_0x6d7418);})[_0x98f5('0x23')](function(_0x372c33){_0xd20823['rows']=_0x372c33;return _0xd20823;})[_0x98f5('0x23')](respondWithFilteredResult(_0x29e1f5,_0x6d7418))['catch'](handleError(_0x29e1f5,null));};exports[_0x98f5('0x42')]=function(_0x4ff7b0,_0x45d732){var _0x166e05={'raw':!![],'where':{'id':_0x4ff7b0['params']['id']}},_0x1b8d40={};_0x1b8d40[_0x98f5('0x30')]=_[_0x98f5('0x32')](db['ContactItemType'][_0x98f5('0x2d')]);_0x1b8d40[_0x98f5('0x31')]=_['keys'](_0x4ff7b0[_0x98f5('0x31')]);_0x1b8d40['filters']=_[_0x98f5('0x34')](_0x1b8d40[_0x98f5('0x30')],_0x1b8d40['query']);_0x166e05['attributes']=_['intersection'](_0x1b8d40['model'],qs[_0x98f5('0x36')](_0x4ff7b0['query'][_0x98f5('0x36')]));_0x166e05[_0x98f5('0x35')]=_0x166e05[_0x98f5('0x35')][_0x98f5('0x37')]?_0x166e05[_0x98f5('0x35')]:_0x1b8d40[_0x98f5('0x30')];if(_0x4ff7b0['query'][_0x98f5('0x40')]){_0x166e05[_0x98f5('0x43')]=[{'all':!![]}];}_0x166e05=_[_0x98f5('0x3c')]({},_0x166e05,_0x4ff7b0[_0x98f5('0x3e')]);return db[_0x98f5('0x3f')][_0x98f5('0x44')](_0x166e05)['then'](handleEntityNotFound(_0x45d732,null))[_0x98f5('0x23')](respondWithResult(_0x45d732,null))[_0x98f5('0x45')](handleError(_0x45d732,null));};exports[_0x98f5('0x46')]=function(_0x1d4b3b,_0x4a0cda){return db[_0x98f5('0x3f')][_0x98f5('0x46')](_0x1d4b3b[_0x98f5('0x47')],{})[_0x98f5('0x23')](function(_0x269861){var _0x4da817=_0x1d4b3b[_0x98f5('0x48')][_0x98f5('0x25')]({'plain':!![]});if(!_0x4da817)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4da817[_0x98f5('0x49')]==='user'){var _0x27ed57=_0x269861['get']({'plain':!![]});var _0x1bd2b9=_0x98f5('0x26');return db[_0x98f5('0x4a')]['find']({'where':{'name':_0x1bd2b9,'userProfileId':_0x4da817[_0x98f5('0x4b')]},'raw':!![]})[_0x98f5('0x23')](function(_0x1503fa){if(_0x1503fa&&_0x1503fa[_0x98f5('0x4c')]===0x0){return db[_0x98f5('0x4d')][_0x98f5('0x46')]({'name':_0x27ed57[_0x98f5('0x29')],'resourceId':_0x27ed57['id'],'type':_0x1503fa[_0x98f5('0x29')],'sectionId':_0x1503fa['id']},{})[_0x98f5('0x23')](function(){return _0x269861;});}else{return _0x269861;}})[_0x98f5('0x45')](function(_0x50343c){logger[_0x98f5('0x4e')](_0x98f5('0x4f'),_0x50343c);throw _0x50343c;});}return _0x269861;})[_0x98f5('0x23')](respondWithResult(_0x4a0cda,0xc9))[_0x98f5('0x45')](handleError(_0x4a0cda,null));};exports[_0x98f5('0x50')]=function(_0x23e955,_0x5c565d){if(_0x23e955[_0x98f5('0x47')]['id']){delete _0x23e955[_0x98f5('0x47')]['id'];}return db[_0x98f5('0x3f')][_0x98f5('0x44')]({'where':{'id':_0x23e955[_0x98f5('0x51')]['id']}})[_0x98f5('0x23')](handleEntityNotFound(_0x5c565d,null))['then'](saveUpdates(_0x23e955['body'],null))['then'](respondWithResult(_0x5c565d,null))[_0x98f5('0x45')](handleError(_0x5c565d,null));};exports[_0x98f5('0x24')]=function(_0x372c49,_0x1c5fb2){return db['ContactItemType'][_0x98f5('0x44')]({'where':{'id':_0x372c49['params']['id']}})[_0x98f5('0x23')](handleEntityNotFound(_0x1c5fb2,null))['then'](db['CmContactHasItem'][_0x98f5('0x50')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x372c49[_0x98f5('0x51')]['id']}}))[_0x98f5('0x23')](removeEntity(_0x1c5fb2,null))['catch'](handleError(_0x1c5fb2,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 13a7d78..bab22a1 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 _0xaa5d=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types'];(function(_0x5710fd,_0x232ba9){var _0x8355f=function(_0x4677b6){while(--_0x4677b6){_0x5710fd['push'](_0x5710fd['shift']());}};_0x8355f(++_0x232ba9);}(_0xaa5d,0x84));var _0xdaa5=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0xaa5d[_0x1559a5];return _0x17a783;};'use strict';var _=require(_0xdaa5('0x0'));var util=require(_0xdaa5('0x1'));var logger=require('../../config/logger')(_0xdaa5('0x2'));var moment=require('moment');var BPromise=require(_0xdaa5('0x3'));var rp=require(_0xdaa5('0x4'));var fs=require('fs');var path=require(_0xdaa5('0x5'));var rimraf=require('rimraf');var config=require(_0xdaa5('0x6'));var attributes=require(_0xdaa5('0x7'));module[_0xdaa5('0x8')]=function(_0x1eb369,_0x9d6905){return _0x1eb369[_0xdaa5('0x9')]('ContactItemType',attributes,{'tableName':_0xdaa5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9e8=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./contactItemType.attributes','tools_contact_item_types'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0xd9e8,0x1c2));var _0x8d9e=function(_0x192600,_0x29232a){_0x192600=_0x192600-0x0;var _0x534481=_0xd9e8[_0x192600];return _0x534481;};'use strict';var _=require(_0x8d9e('0x0'));var util=require('util');var logger=require(_0x8d9e('0x1'))(_0x8d9e('0x2'));var moment=require(_0x8d9e('0x3'));var BPromise=require(_0x8d9e('0x4'));var rp=require(_0x8d9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8d9e('0x6'));var attributes=require(_0x8d9e('0x7'));module['exports']=function(_0x4b44e8,_0x315f51){return _0x4b44e8['define']('ContactItemType',attributes,{'tableName':_0x8d9e('0x8'),'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 ffec656..003b6fd 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 _0x438a=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x438a,0x18b));var _0xa438=function(_0x543d6b,_0x59e222){_0x543d6b=_0x543d6b-0x0;var _0x22b6ca=_0x438a[_0x543d6b];return _0x22b6ca;};'use strict';var _=require(_0xa438('0x0'));var util=require(_0xa438('0x1'));var moment=require(_0xa438('0x2'));var BPromise=require(_0xa438('0x3'));var rs=require(_0xa438('0x4'));var fs=require('fs');var Redis=require(_0xa438('0x5'));var db=require(_0xa438('0x6'))['db'];var utils=require(_0xa438('0x7'));var logger=require(_0xa438('0x8'))(_0xa438('0x9'));var config=require(_0xa438('0xa'));var jayson=require(_0xa438('0xb'));var client=jayson[_0xa438('0xc')][_0xa438('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24fbed,_0x124b30,_0x12f794){return new BPromise(function(_0xccd60d,_0x21ad47){return client[_0xa438('0xe')](_0x24fbed,_0x12f794)[_0xa438('0xf')](function(_0x2d4c4a){logger['info']('ContactItemType,\x20%s,\x20%s',_0x124b30,_0xa438('0x10'));logger[_0xa438('0x11')](_0xa438('0x12'),_0x124b30,_0xa438('0x10'),JSON[_0xa438('0x13')](_0x2d4c4a));if(_0x2d4c4a[_0xa438('0x14')]){if(_0x2d4c4a['error'][_0xa438('0x15')]===0x1f4){logger['error'](_0xa438('0x16'),_0x124b30,_0x2d4c4a['error'][_0xa438('0x17')]);return _0x21ad47(_0x2d4c4a['error'][_0xa438('0x17')]);}logger[_0xa438('0x14')](_0xa438('0x16'),_0x124b30,_0x2d4c4a['error'][_0xa438('0x17')]);return _0xccd60d(_0x2d4c4a[_0xa438('0x14')][_0xa438('0x17')]);}else{logger[_0xa438('0x18')](_0xa438('0x16'),_0x124b30,_0xa438('0x10'));_0xccd60d(_0x2d4c4a[_0xa438('0x19')][_0xa438('0x17')]);}})[_0xa438('0x1a')](function(_0x1f113e){logger[_0xa438('0x14')](_0xa438('0x16'),_0x124b30,_0x1f113e);_0x21ad47(_0x1f113e);});});} \ No newline at end of file +var _0xe13a=['then','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2b84f7,_0x3eeb07){var _0x18f7f1=function(_0x165d2a){while(--_0x165d2a){_0x2b84f7['push'](_0x2b84f7['shift']());}};_0x18f7f1(++_0x3eeb07);}(_0xe13a,0x15f));var _0xae13=function(_0x38b53c,_0x2933f7){_0x38b53c=_0x38b53c-0x0;var _0x3bedac=_0xe13a[_0x38b53c];return _0x3bedac;};'use strict';var _=require(_0xae13('0x0'));var util=require('util');var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require(_0xae13('0x4'));var db=require(_0xae13('0x5'))['db'];var utils=require(_0xae13('0x6'));var logger=require('../../config/logger')(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4217f9,_0xb95b82,_0x27db12){return new BPromise(function(_0x52091a,_0x463ce8){return client['request'](_0x4217f9,_0x27db12)[_0xae13('0xa')](function(_0x3a1fdc){logger['info'](_0xae13('0xb'),_0xb95b82,_0xae13('0xc'));logger['debug'](_0xae13('0xd'),_0xb95b82,_0xae13('0xc'),JSON[_0xae13('0xe')](_0x3a1fdc));if(_0x3a1fdc[_0xae13('0xf')]){if(_0x3a1fdc[_0xae13('0xf')]['code']===0x1f4){logger[_0xae13('0xf')](_0xae13('0xb'),_0xb95b82,_0x3a1fdc[_0xae13('0xf')][_0xae13('0x10')]);return _0x463ce8(_0x3a1fdc[_0xae13('0xf')][_0xae13('0x10')]);}logger[_0xae13('0xf')]('ContactItemType,\x20%s,\x20%s',_0xb95b82,_0x3a1fdc[_0xae13('0xf')][_0xae13('0x10')]);return _0x52091a(_0x3a1fdc['error'][_0xae13('0x10')]);}else{logger[_0xae13('0x11')](_0xae13('0xb'),_0xb95b82,_0xae13('0xc'));_0x52091a(_0x3a1fdc['result']['message']);}})[_0xae13('0x12')](function(_0xd99045){logger['error'](_0xae13('0xb'),_0xb95b82,_0xd99045);_0x463ce8(_0xd99045);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index c0aa68b..8b19890 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 _0x3fff=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3fd519,_0x12e245){var _0x4a9f0f=function(_0x4cca4d){while(--_0x4cca4d){_0x3fd519['push'](_0x3fd519['shift']());}};_0x4a9f0f(++_0x12e245);}(_0x3fff,0x134));var _0xf3ff=function(_0x20f17f,_0x47be7f){_0x20f17f=_0x20f17f-0x0;var _0x4e2953=_0x3fff[_0x20f17f];return _0x4e2953;};'use strict';var multer=require('multer');var util=require(_0xf3ff('0x0'));var path=require(_0xf3ff('0x1'));var timeout=require('connect-timeout');var express=require(_0xf3ff('0x2'));var router=express[_0xf3ff('0x3')]();var fs_extra=require(_0xf3ff('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf3ff('0x5'));var config=require(_0xf3ff('0x6'));var controller=require(_0xf3ff('0x7'));router[_0xf3ff('0x8')]('/',auth[_0xf3ff('0x9')](),controller[_0xf3ff('0xa')]);router['get'](_0xf3ff('0xb'),auth[_0xf3ff('0x9')](),controller[_0xf3ff('0xc')]);router[_0xf3ff('0xd')]('/',auth[_0xf3ff('0x9')](),controller[_0xf3ff('0xe')]);router['put']('/:id',auth[_0xf3ff('0x9')](),controller[_0xf3ff('0xf')]);router[_0xf3ff('0x10')](_0xf3ff('0xb'),auth[_0xf3ff('0x9')](),controller[_0xf3ff('0x11')]);module[_0xf3ff('0x12')]=router; \ No newline at end of file +var _0x62fe=['../../config/environment','get','index','isAuthenticated','post','create','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1cc790,_0x87a16a){var _0x3ac4a7=function(_0x344f64){while(--_0x344f64){_0x1cc790['push'](_0x1cc790['shift']());}};_0x3ac4a7(++_0x87a16a);}(_0x62fe,0x106));var _0xe62f=function(_0x5c4a59,_0x11aaf1){_0x5c4a59=_0x5c4a59-0x0;var _0x216d7f=_0x62fe[_0x5c4a59];return _0x216d7f;};'use strict';var multer=require(_0xe62f('0x0'));var util=require(_0xe62f('0x1'));var path=require('path');var timeout=require(_0xe62f('0x2'));var express=require(_0xe62f('0x3'));var router=express[_0xe62f('0x4')]();var fs_extra=require(_0xe62f('0x5'));var auth=require(_0xe62f('0x6'));var interaction=require(_0xe62f('0x7'));var config=require(_0xe62f('0x8'));var controller=require('./contactItemType.controller');router[_0xe62f('0x9')]('/',auth['isAuthenticated'](),controller[_0xe62f('0xa')]);router[_0xe62f('0x9')]('/:id',auth[_0xe62f('0xb')](),controller['show']);router[_0xe62f('0xc')]('/',auth[_0xe62f('0xb')](),controller[_0xe62f('0xd')]);router[_0xe62f('0xe')](_0xe62f('0xf'),auth['isAuthenticated'](),controller[_0xe62f('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe62f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 86d1e83..ae378b4 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 _0x757a=['exports','STRING'];(function(_0x356261,_0x313d43){var _0x53269a=function(_0x4cc384){while(--_0x4cc384){_0x356261['push'](_0x356261['shift']());}};_0x53269a(++_0x313d43);}(_0x757a,0xde));var _0xa757=function(_0x23cfad,_0x3800d3){_0x23cfad=_0x23cfad-0x0;var _0x4d56ee=_0x757a[_0x23cfad];return _0x4d56ee;};'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 +var _0xbaf0=['name','exports','STRING'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 7122be5..bb43fcb 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 _0x3dc5=['params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','createdAt','updatedAt','omit','type','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','voice','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show'];(function(_0x4a5c75,_0x563f0b){var _0x49b598=function(_0x342f3d){while(--_0x342f3d){_0x4a5c75['push'](_0x4a5c75['shift']());}};_0x49b598(++_0x563f0b);}(_0x3dc5,0x12b));var _0x53dc=function(_0x436e41,_0x1599b9){_0x436e41=_0x436e41-0x0;var _0x1b84af=_0x3dc5[_0x436e41];return _0x1b84af;};'use strict';var emlformat=require(_0x53dc('0x0'));var rimraf=require(_0x53dc('0x1'));var zipdir=require(_0x53dc('0x2'));var jsonpatch=require(_0x53dc('0x3'));var rp=require(_0x53dc('0x4'));var moment=require('moment');var BPromise=require(_0x53dc('0x5'));var Mustache=require('mustache');var util=require(_0x53dc('0x6'));var path=require(_0x53dc('0x7'));var sox=require('sox');var csv=require(_0x53dc('0x8'));var ejs=require(_0x53dc('0x9'));var fs=require('fs');var fs_extra=require(_0x53dc('0xa'));var _=require('lodash');var squel=require(_0x53dc('0xb'));var crypto=require(_0x53dc('0xc'));var jsforce=require(_0x53dc('0xd'));var deskjs=require(_0x53dc('0xe'));var toCsv=require(_0x53dc('0x8'));var querystring=require(_0x53dc('0xf'));var Papa=require(_0x53dc('0x10'));var Redis=require('ioredis');var authService=require(_0x53dc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53dc('0x12'));var logger=require(_0x53dc('0x13'))('api');var utils=require(_0x53dc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x53dc('0x15'));var db=require('../../mysqldb')['db'];config[_0x53dc('0x16')]=_['defaults'](config[_0x53dc('0x16')],{'host':_0x53dc('0x17'),'port':0x18eb});var socket=require(_0x53dc('0x18'))(new Redis(config[_0x53dc('0x16')]));require('./dashboard.socket')[_0x53dc('0x19')](socket);function respondWithStatusCode(_0x14d1b1,_0x5a175e){_0x5a175e=_0x5a175e||0xcc;return function(_0x375468){if(_0x375468){return _0x14d1b1[_0x53dc('0x1a')](_0x5a175e);}return _0x14d1b1['status'](_0x5a175e)[_0x53dc('0x1b')]();};}function respondWithResult(_0x51ac75,_0x5284f3){_0x5284f3=_0x5284f3||0xc8;return function(_0x305470){if(_0x305470){return _0x51ac75[_0x53dc('0x1c')](_0x5284f3)['json'](_0x305470);}};}function respondWithFilteredResult(_0x5dcc68,_0x467568){return function(_0x477910){if(_0x477910){var _0x132a47=typeof _0x467568[_0x53dc('0x1d')]===_0x53dc('0x1e')&&typeof _0x467568[_0x53dc('0x1f')]===_0x53dc('0x1e');var _0x165cf8=_0x477910[_0x53dc('0x20')];var _0x5a5684=_0x132a47?0x0:_0x467568[_0x53dc('0x1d')];var _0x55b950=_0x132a47?_0x477910[_0x53dc('0x20')]:_0x467568[_0x53dc('0x1d')]+_0x467568[_0x53dc('0x1f')];var _0x1f40be;if(_0x55b950>=_0x165cf8){_0x55b950=_0x165cf8;_0x1f40be=0xc8;}else{_0x1f40be=0xce;}_0x5dcc68[_0x53dc('0x1c')](_0x1f40be);return _0x5dcc68[_0x53dc('0x21')](_0x53dc('0x22'),_0x5a5684+'-'+_0x55b950+'/'+_0x165cf8)['json'](_0x477910);}return null;};}function patchUpdates(_0x30eecc){return function(_0x568b53){try{jsonpatch[_0x53dc('0x23')](_0x568b53,_0x30eecc,!![]);}catch(_0x104b38){return BPromise[_0x53dc('0x24')](_0x104b38);}return _0x568b53['save']();};}function saveUpdates(_0xb32499,_0x2fa01e){return function(_0xfd1d12){if(_0xfd1d12){return _0xfd1d12[_0x53dc('0x25')](_0xb32499)[_0x53dc('0x26')](function(_0x158559){return _0x158559;});}return null;};}function removeEntity(_0x24bda0,_0x570704){return function(_0x36be8c){if(_0x36be8c){return _0x36be8c[_0x53dc('0x27')]()[_0x53dc('0x26')](function(){var _0x119b6a=_0x36be8c[_0x53dc('0x28')]({'plain':!![]});var _0x54c06a=_0x53dc('0x29');return db[_0x53dc('0x2a')][_0x53dc('0x27')]({'where':{'type':_0x54c06a,'resourceId':_0x119b6a['id']}})['then'](function(){return _0x36be8c;});})[_0x53dc('0x26')](function(){_0x24bda0[_0x53dc('0x1c')](0xcc)[_0x53dc('0x1b')]();});}};}function handleEntityNotFound(_0x9b6309,_0x25aeca){return function(_0x59e46b){if(!_0x59e46b){_0x9b6309['sendStatus'](0x194);}return _0x59e46b;};}function handleError(_0xf59227,_0x319ed9){_0x319ed9=_0x319ed9||0x1f4;return function(_0xaa1a5f){logger[_0x53dc('0x2b')](_0xaa1a5f['stack']);if(_0xaa1a5f['name']){delete _0xaa1a5f[_0x53dc('0x2c')];}_0xf59227[_0x53dc('0x1c')](_0x319ed9)[_0x53dc('0x2d')](_0xaa1a5f);};}exports[_0x53dc('0x2e')]=function(_0x39f491,_0x4a0b28){var _0x1f0adb={},_0x1ca2da={},_0x4ce5c5={'count':0x0,'rows':[]};var _0x27df49=_[_0x53dc('0x2f')](db[_0x53dc('0x30')][_0x53dc('0x31')],function(_0x3c4e2b){return{'name':_0x3c4e2b['fieldName'],'type':_0x3c4e2b['type'][_0x53dc('0x32')]};});_0x1ca2da[_0x53dc('0x33')]=_[_0x53dc('0x2f')](_0x27df49,_0x53dc('0x2c'));_0x1ca2da['query']=_[_0x53dc('0x34')](_0x39f491[_0x53dc('0x35')]);_0x1ca2da[_0x53dc('0x36')]=_[_0x53dc('0x37')](_0x1ca2da['model'],_0x1ca2da[_0x53dc('0x35')]);_0x1f0adb[_0x53dc('0x38')]=_[_0x53dc('0x37')](_0x1ca2da[_0x53dc('0x33')],qs[_0x53dc('0x39')](_0x39f491['query'][_0x53dc('0x39')]));_0x1f0adb[_0x53dc('0x38')]=_0x1f0adb['attributes'][_0x53dc('0x3a')]?_0x1f0adb[_0x53dc('0x38')]:_0x1ca2da['model'];if(!_0x39f491[_0x53dc('0x35')][_0x53dc('0x3b')](_0x53dc('0x3c'))){_0x1f0adb[_0x53dc('0x1f')]=qs[_0x53dc('0x1f')](_0x39f491['query']['limit']);_0x1f0adb[_0x53dc('0x1d')]=qs[_0x53dc('0x1d')](_0x39f491[_0x53dc('0x35')][_0x53dc('0x1d')]);}_0x1f0adb['order']=qs['sort'](_0x39f491[_0x53dc('0x35')][_0x53dc('0x3d')]);_0x1f0adb[_0x53dc('0x3e')]=qs[_0x53dc('0x36')](_[_0x53dc('0x3f')](_0x39f491[_0x53dc('0x35')],_0x1ca2da[_0x53dc('0x36')]),_0x27df49);if(_0x39f491['query']['filter']){_0x1f0adb[_0x53dc('0x3e')]=_[_0x53dc('0x40')](_0x1f0adb['where'],{'$or':_[_0x53dc('0x2f')](_0x27df49,function(_0x142e6b){if(_0x142e6b['type']!==_0x53dc('0x41')){var _0x42fa09={};_0x42fa09[_0x142e6b[_0x53dc('0x2c')]]={'$like':'%'+_0x39f491['query'][_0x53dc('0x42')]+'%'};return _0x42fa09;}})});}_0x1f0adb=_[_0x53dc('0x40')]({},_0x1f0adb,_0x39f491[_0x53dc('0x43')]);var _0x4591ef={'where':_0x1f0adb[_0x53dc('0x3e')]};return db['Dashboard']['count'](_0x4591ef)['then'](function(_0x5576fc){_0x4ce5c5[_0x53dc('0x20')]=_0x5576fc;if(_0x39f491[_0x53dc('0x35')][_0x53dc('0x44')]){_0x1f0adb['include']=[{'all':!![]}];}return db[_0x53dc('0x30')][_0x53dc('0x45')](_0x1f0adb);})[_0x53dc('0x26')](function(_0x1a26f5){_0x4ce5c5[_0x53dc('0x46')]=_0x1a26f5;return _0x4ce5c5;})[_0x53dc('0x26')](respondWithFilteredResult(_0x4a0b28,_0x1f0adb))[_0x53dc('0x47')](handleError(_0x4a0b28,null));};exports[_0x53dc('0x48')]=function(_0xa78a71,_0x32b58b){var _0x38810d={'raw':![],'where':{'id':_0xa78a71[_0x53dc('0x49')]['id']}},_0x509738={};_0x509738[_0x53dc('0x33')]=_['keys'](db['Dashboard'][_0x53dc('0x31')]);_0x509738[_0x53dc('0x35')]=_[_0x53dc('0x34')](_0xa78a71[_0x53dc('0x35')]);_0x509738[_0x53dc('0x36')]=_[_0x53dc('0x37')](_0x509738[_0x53dc('0x33')],_0x509738[_0x53dc('0x35')]);_0x38810d['attributes']=_[_0x53dc('0x37')](_0x509738['model'],qs[_0x53dc('0x39')](_0xa78a71[_0x53dc('0x35')]['fields']));_0x38810d[_0x53dc('0x38')]=_0x38810d[_0x53dc('0x38')][_0x53dc('0x3a')]?_0x38810d[_0x53dc('0x38')]:_0x509738['model'];if(_0xa78a71['query'][_0x53dc('0x44')]){_0x38810d['include']=[{'all':!![]}];}_0x38810d=_[_0x53dc('0x40')]({},_0x38810d,_0xa78a71[_0x53dc('0x43')]);return db[_0x53dc('0x30')][_0x53dc('0x4a')](_0x38810d)[_0x53dc('0x26')](handleEntityNotFound(_0x32b58b,null))['then'](respondWithResult(_0x32b58b,null))[_0x53dc('0x47')](handleError(_0x32b58b,null));};exports[_0x53dc('0x4b')]=function(_0x51c13b,_0x42ea99){return db[_0x53dc('0x30')][_0x53dc('0x4b')](_0x51c13b[_0x53dc('0x4c')],{})['then'](function(_0x549986){var _0x39335a=_0x51c13b[_0x53dc('0x4d')][_0x53dc('0x28')]({'plain':!![]});if(!_0x39335a)throw new Error(_0x53dc('0x4e'));if(_0x39335a['role']===_0x53dc('0x4d')){var _0x41ae23=_0x549986[_0x53dc('0x28')]({'plain':!![]});var _0x1a38c7=_0x53dc('0x29');return db[_0x53dc('0x4f')][_0x53dc('0x4a')]({'where':{'name':_0x1a38c7,'userProfileId':_0x39335a[_0x53dc('0x50')]},'raw':!![]})[_0x53dc('0x26')](function(_0x4e592e){if(_0x4e592e&&_0x4e592e[_0x53dc('0x51')]===0x0){return db[_0x53dc('0x2a')][_0x53dc('0x4b')]({'name':_0x41ae23[_0x53dc('0x2c')],'resourceId':_0x41ae23['id'],'type':_0x4e592e[_0x53dc('0x2c')],'sectionId':_0x4e592e['id']},{})[_0x53dc('0x26')](function(){return _0x549986;});}else{return _0x549986;}})[_0x53dc('0x47')](function(_0x376701){logger[_0x53dc('0x2b')](_0x53dc('0x52'),_0x376701);throw _0x376701;});}return _0x549986;})['then'](respondWithResult(_0x42ea99,0xc9))[_0x53dc('0x47')](handleError(_0x42ea99,null));};exports[_0x53dc('0x53')]=function(_0x1864a5,_0x3537e1){var _0x2ca96d={'where':{'id':_0x1864a5[_0x53dc('0x49')]['id']}},_0x1bb47e={};_0x1bb47e[_0x53dc('0x33')]=_[_0x53dc('0x34')](db[_0x53dc('0x30')][_0x53dc('0x31')]);_0x2ca96d[_0x53dc('0x38')]=_['intersection'](_0x1bb47e[_0x53dc('0x33')],qs['fields'](_0x1864a5[_0x53dc('0x35')][_0x53dc('0x39')]));_0x2ca96d[_0x53dc('0x38')]=_0x2ca96d['attributes'][_0x53dc('0x3a')]?_0x2ca96d[_0x53dc('0x38')]:_0x1bb47e['model'];if(_0x1864a5[_0x53dc('0x35')]['includeAll']){_0x2ca96d[_0x53dc('0x54')]=[{'all':!![]}];}_0x2ca96d=_[_0x53dc('0x40')]({},_0x2ca96d,_0x1864a5[_0x53dc('0x43')]);return db[_0x53dc('0x30')][_0x53dc('0x4a')](_0x2ca96d)[_0x53dc('0x26')](handleEntityNotFound(_0x3537e1,null))[_0x53dc('0x26')](function(_0x5a4123){if(_0x5a4123){var _0x5a9ed3=_0x5a4123[_0x53dc('0x28')]({'plain':!![]});_0x5a9ed3=qs['omit'](_0x5a9ed3,['id',_0x53dc('0x55'),_0x53dc('0x56')]);_0x1864a5[_0x53dc('0x4c')]=_[_0x53dc('0x57')](_0x1864a5[_0x53dc('0x4c')],['id','createdAt',_0x53dc('0x56')]);return db[_0x53dc('0x30')][_0x53dc('0x4b')](_['merge'](_0x5a9ed3,_0x1864a5[_0x53dc('0x4c')]),{'include':_0x1864a5[_0x53dc('0x35')][_0x53dc('0x44')]?[{'all':!![]}]:undefined})[_0x53dc('0x26')](function(_0x189299){var _0x3848d7=_0x1864a5[_0x53dc('0x4d')][_0x53dc('0x28')]({'plain':!![]});if(!_0x3848d7)throw new Error(_0x53dc('0x4e'));if(_0x3848d7['role']==='user'){var _0x2d1937=_0x189299[_0x53dc('0x28')]({'plain':!![]});var _0x31db6d=_0x53dc('0x29');return db[_0x53dc('0x4f')][_0x53dc('0x4a')]({'where':{'name':_0x31db6d,'userProfileId':_0x3848d7[_0x53dc('0x50')]},'raw':!![]})['then'](function(_0x588a97){if(_0x588a97&&_0x588a97['autoAssociation']===0x0){return db[_0x53dc('0x2a')][_0x53dc('0x4b')]({'name':_0x2d1937['name'],'resourceId':_0x2d1937['id'],'type':_0x588a97[_0x53dc('0x2c')],'sectionId':_0x588a97['id']},{})[_0x53dc('0x26')](function(){return _0x189299;});}else{return _0x189299;}})[_0x53dc('0x47')](function(_0x575d52){logger[_0x53dc('0x2b')](_0x53dc('0x52'),_0x575d52);throw _0x575d52;});}return _0x189299;});}})['then'](respondWithResult(_0x3537e1,0xc9))[_0x53dc('0x47')](handleError(_0x3537e1,null));};exports[_0x53dc('0x25')]=function(_0x306a6e,_0x28351d){if(_0x306a6e[_0x53dc('0x4c')]['id']){delete _0x306a6e[_0x53dc('0x4c')]['id'];}return db[_0x53dc('0x30')][_0x53dc('0x4a')]({'where':{'id':_0x306a6e[_0x53dc('0x49')]['id']}})[_0x53dc('0x26')](handleEntityNotFound(_0x28351d,null))['then'](saveUpdates(_0x306a6e[_0x53dc('0x4c')],null))[_0x53dc('0x26')](respondWithResult(_0x28351d,null))[_0x53dc('0x47')](handleError(_0x28351d,null));};exports[_0x53dc('0x27')]=function(_0x41974e,_0x415476){return db[_0x53dc('0x30')]['find']({'where':{'id':_0x41974e[_0x53dc('0x49')]['id']}})[_0x53dc('0x26')](handleEntityNotFound(_0x415476,null))[_0x53dc('0x26')](removeEntity(_0x415476,null))[_0x53dc('0x47')](handleError(_0x415476,null));};function widgetAttributes(_0x35cce6){try{switch(_0x35cce6[_0x53dc('0x58')]){case'iframe':return[{'name':'attrUrl','value':_0x35cce6['attrUrl']||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x0]?_0x35cce6[_0x53dc('0x59')][0x0][_0x53dc('0x5a')]:undefined)||_0x53dc('0x5b')}];case _0x53dc('0x5c'):return[{'name':_0x53dc('0x5d'),'value':_0x35cce6[_0x53dc('0x5d')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x0]?_0x35cce6[_0x53dc('0x59')][0x0][_0x53dc('0x5a')]:undefined)||''}];case _0x53dc('0x5e'):return[{'name':'attrHourFormat','value':_0x35cce6['attrHourFormat']||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x0]?_0x35cce6[_0x53dc('0x59')][0x0]['value']:undefined)||_0x53dc('0x5f')},{'name':_0x53dc('0x60'),'value':_0x35cce6[_0x53dc('0x60')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x1]?_0x35cce6[_0x53dc('0x59')][0x1][_0x53dc('0x5a')]:undefined)||_0x53dc('0x61')},{'name':_0x53dc('0x62'),'value':_0x35cce6[_0x53dc('0x62')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x2]?_0x35cce6[_0x53dc('0x59')][0x2][_0x53dc('0x5a')]:undefined)||0xc}];case _0x53dc('0x63'):return[{'name':_0x53dc('0x64'),'value':_0x35cce6[_0x53dc('0x64')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x0]?_0x35cce6[_0x53dc('0x59')][0x0][_0x53dc('0x5a')]:undefined)||_0x53dc('0x65')},{'name':_0x53dc('0x66'),'value':_0x35cce6[_0x53dc('0x66')]||(_0x35cce6['attrs']&&_0x35cce6[_0x53dc('0x59')][0x1]?_0x35cce6[_0x53dc('0x59')][0x1][_0x53dc('0x5a')]:undefined)||[]},{'name':'attrFontSize','value':_0x35cce6[_0x53dc('0x62')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6['attrs'][0x2]?_0x35cce6[_0x53dc('0x59')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x35cce6['attrChannel']||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x3]?_0x35cce6[_0x53dc('0x59')][0x3]['value']:undefined)||'voice'},{'name':_0x53dc('0x67'),'value':_0x35cce6[_0x53dc('0x67')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x4]?_0x35cce6[_0x53dc('0x59')][0x4]['value']:undefined)||''},{'name':_0x53dc('0x68'),'value':_0x35cce6[_0x53dc('0x68')]||(_0x35cce6['attrs']&&_0x35cce6[_0x53dc('0x59')][0x5]?_0x35cce6['attrs'][0x5]['value']:undefined)||''},{'name':_0x53dc('0x69'),'value':_0x35cce6[_0x53dc('0x69')]||(_0x35cce6['attrs']&&_0x35cce6[_0x53dc('0x59')][0x6]?_0x35cce6[_0x53dc('0x59')][0x6][_0x53dc('0x5a')]:undefined)||''},{'name':_0x53dc('0x6a'),'value':_0x35cce6['attrOpenchannelAccounts']||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6['attrs'][0x7]?_0x35cce6[_0x53dc('0x59')][0x7][_0x53dc('0x5a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x35cce6[_0x53dc('0x6b')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x8]?_0x35cce6[_0x53dc('0x59')][0x8][_0x53dc('0x5a')]:undefined)||''},{'name':_0x53dc('0x6c'),'value':_0x35cce6['attrChatWebsites']||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x9]?_0x35cce6[_0x53dc('0x59')][0x9][_0x53dc('0x5a')]:undefined)||''}];case _0x53dc('0x6d'):case'pie-chart':return[{'name':_0x53dc('0x6e'),'value':_0x35cce6['attrSerie1']||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x0]?_0x35cce6[_0x53dc('0x59')][0x0][_0x53dc('0x5a')]:undefined)||_0x53dc('0x65')},{'name':_0x53dc('0x6f'),'value':_0x35cce6[_0x53dc('0x6f')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6['attrs'][0x1]?_0x35cce6[_0x53dc('0x59')][0x1][_0x53dc('0x5a')]:undefined)||null},{'name':_0x53dc('0x70'),'value':_0x35cce6[_0x53dc('0x70')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x2]?_0x35cce6[_0x53dc('0x59')][0x2]['value']:undefined)||null},{'name':_0x53dc('0x66'),'value':_0x35cce6[_0x53dc('0x66')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6['attrs'][0x3]?_0x35cce6[_0x53dc('0x59')][0x3][_0x53dc('0x5a')]:undefined)||[]},{'name':_0x53dc('0x71'),'value':_0x35cce6['attrChannel']||(_0x35cce6['attrs']&&_0x35cce6['attrs'][0x4]?_0x35cce6[_0x53dc('0x59')][0x4][_0x53dc('0x5a')]:undefined)||_0x53dc('0x72')},{'name':_0x53dc('0x67'),'value':_0x35cce6['attrEmailAccounts']||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6['attrs'][0x5]?_0x35cce6[_0x53dc('0x59')][0x5][_0x53dc('0x5a')]:undefined)||''},{'name':_0x53dc('0x68'),'value':_0x35cce6[_0x53dc('0x68')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x6]?_0x35cce6['attrs'][0x6][_0x53dc('0x5a')]:undefined)||''},{'name':_0x53dc('0x69'),'value':_0x35cce6[_0x53dc('0x69')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x7]?_0x35cce6[_0x53dc('0x59')][0x7][_0x53dc('0x5a')]:undefined)||''},{'name':_0x53dc('0x6a'),'value':_0x35cce6[_0x53dc('0x6a')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x8]?_0x35cce6[_0x53dc('0x59')][0x8][_0x53dc('0x5a')]:undefined)||''},{'name':_0x53dc('0x6b'),'value':_0x35cce6[_0x53dc('0x6b')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x9]?_0x35cce6['attrs'][0x9][_0x53dc('0x5a')]:undefined)||''},{'name':_0x53dc('0x6c'),'value':_0x35cce6[_0x53dc('0x6c')]||(_0x35cce6['attrs']&&_0x35cce6['attrs'][0xa]?_0x35cce6[_0x53dc('0x59')][0xa][_0x53dc('0x5a')]:undefined)||''}];case _0x53dc('0x73'):return[{'name':_0x53dc('0x74'),'type':_0x35cce6['reportType']||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x0]?_0x35cce6[_0x53dc('0x59')][0x0][_0x53dc('0x58')]:undefined)||null,'value':_0x35cce6[_0x53dc('0x74')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6[_0x53dc('0x59')][0x0]?_0x35cce6['attrs'][0x0][_0x53dc('0x5a')]:undefined)||null},{'name':_0x53dc('0x75'),'value':_0x35cce6[_0x53dc('0x75')]||(_0x35cce6[_0x53dc('0x59')]&&_0x35cce6['attrs'][0x1]?_0x35cce6[_0x53dc('0x59')][0x1][_0x53dc('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x5d5d22){logger['error'](_0x53dc('0x76'),JSON[_0x53dc('0x77')](_0x5d5d22));return[];}}exports[_0x53dc('0x78')]=function(_0x19fba2,_0x38e850,_0x17f288){if(_0x19fba2[_0x53dc('0x4c')]['id']){delete _0x19fba2[_0x53dc('0x4c')]['id'];}return db[_0x53dc('0x30')]['find']({'where':{'id':_0x19fba2[_0x53dc('0x49')]['id']}})[_0x53dc('0x26')](handleEntityNotFound(_0x38e850,null))[_0x53dc('0x26')](function(_0x4b2ea9){if(_0x4b2ea9){_0x19fba2[_0x53dc('0x4c')][_0x53dc('0x79')]=_0x4b2ea9['id'];_0x19fba2[_0x53dc('0x4c')]['attrs']=widgetAttributes(_0x19fba2['body']);return db['DashboardItem'][_0x53dc('0x4b')](_0x19fba2['body']);}})[_0x53dc('0x26')](respondWithResult(_0x38e850,null))[_0x53dc('0x47')](handleError(_0x38e850,null));};exports[_0x53dc('0x7a')]=function(_0x4d8dfe,_0x176186,_0x17c4be){var _0x37c70d={};var _0x4a3fde={};var _0x1f72aa;var _0x4a0017;return db[_0x53dc('0x30')]['findOne']({'where':{'id':_0x4d8dfe[_0x53dc('0x49')]['id']}})[_0x53dc('0x26')](handleEntityNotFound(_0x176186,null))['then'](function(_0x487eb3){if(_0x487eb3){_0x1f72aa=_0x487eb3;_0x4a3fde[_0x53dc('0x33')]=_[_0x53dc('0x34')](db['DashboardItem']['rawAttributes']);_0x4a3fde['query']=_[_0x53dc('0x34')](_0x4d8dfe[_0x53dc('0x35')]);_0x4a3fde[_0x53dc('0x36')]=_[_0x53dc('0x37')](_0x4a3fde[_0x53dc('0x33')],_0x4a3fde['query']);_0x37c70d['attributes']=_['intersection'](_0x4a3fde[_0x53dc('0x33')],qs[_0x53dc('0x39')](_0x4d8dfe[_0x53dc('0x35')][_0x53dc('0x39')]));_0x37c70d[_0x53dc('0x38')]=_0x37c70d[_0x53dc('0x38')][_0x53dc('0x3a')]?_0x37c70d['attributes']:_0x4a3fde[_0x53dc('0x33')];_0x37c70d[_0x53dc('0x7b')]=qs[_0x53dc('0x3d')](_0x4d8dfe[_0x53dc('0x35')]['sort']);_0x37c70d[_0x53dc('0x3e')]=qs[_0x53dc('0x36')](_[_0x53dc('0x3f')](_0x4d8dfe[_0x53dc('0x35')],_0x4a3fde[_0x53dc('0x36')]));if(_0x4d8dfe[_0x53dc('0x35')][_0x53dc('0x42')]){_0x37c70d[_0x53dc('0x3e')]=_[_0x53dc('0x40')](_0x37c70d[_0x53dc('0x3e')],{'$or':_[_0x53dc('0x2f')](_0x37c70d[_0x53dc('0x38')],function(_0x31cc2f){var _0x376ff2={};_0x376ff2[_0x31cc2f]={'$like':'%'+_0x4d8dfe[_0x53dc('0x35')][_0x53dc('0x42')]+'%'};return _0x376ff2;})});}_0x37c70d=_['merge']({},_0x37c70d,_0x4d8dfe[_0x53dc('0x43')]);return _0x1f72aa[_0x53dc('0x7a')](_0x37c70d);}})[_0x53dc('0x26')](function(_0xd12a7a){if(_0xd12a7a){_0x4a0017=_0xd12a7a[_0x53dc('0x3a')];if(!_0x4d8dfe[_0x53dc('0x35')][_0x53dc('0x3b')](_0x53dc('0x3c'))){_0x37c70d['limit']=qs[_0x53dc('0x1f')](_0x4d8dfe[_0x53dc('0x35')]['limit']);_0x37c70d[_0x53dc('0x1d')]=qs[_0x53dc('0x1d')](_0x4d8dfe[_0x53dc('0x35')][_0x53dc('0x1d')]);}return _0x1f72aa[_0x53dc('0x7a')](_0x37c70d);}})[_0x53dc('0x26')](function(_0x5a21cf){if(_0x5a21cf){return _0x5a21cf?{'count':_0x4a0017,'rows':_0x5a21cf}:null;}})[_0x53dc('0x26')](respondWithResult(_0x176186,null))[_0x53dc('0x47')](handleError(_0x176186,null));}; \ No newline at end of file +var _0xb3bc=['type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x38f735,_0xec4a14){var _0x3cd312=function(_0x157ec4){while(--_0x157ec4){_0x38f735['push'](_0x38f735['shift']());}};_0x3cd312(++_0xec4a14);}(_0xb3bc,0x136));var _0xcb3b=function(_0x5e03d4,_0x56edf3){_0x5e03d4=_0x5e03d4-0x0;var _0x5d1b53=_0xb3bc[_0x5e03d4];return _0x5d1b53;};'use strict';var emlformat=require(_0xcb3b('0x0'));var rimraf=require(_0xcb3b('0x1'));var zipdir=require(_0xcb3b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb3b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcb3b('0x4'));var util=require(_0xcb3b('0x5'));var path=require(_0xcb3b('0x6'));var sox=require(_0xcb3b('0x7'));var csv=require(_0xcb3b('0x8'));var ejs=require(_0xcb3b('0x9'));var fs=require('fs');var fs_extra=require(_0xcb3b('0xa'));var _=require(_0xcb3b('0xb'));var squel=require(_0xcb3b('0xc'));var crypto=require(_0xcb3b('0xd'));var jsforce=require(_0xcb3b('0xe'));var deskjs=require(_0xcb3b('0xf'));var toCsv=require(_0xcb3b('0x8'));var querystring=require(_0xcb3b('0x10'));var Papa=require(_0xcb3b('0x11'));var Redis=require(_0xcb3b('0x12'));var authService=require(_0xcb3b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcb3b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb3b('0x15'))(_0xcb3b('0x16'));var utils=require(_0xcb3b('0x17'));var config=require(_0xcb3b('0x18'));var licenseUtil=require(_0xcb3b('0x19'));var db=require(_0xcb3b('0x1a'))['db'];config[_0xcb3b('0x1b')]=_[_0xcb3b('0x1c')](config[_0xcb3b('0x1b')],{'host':_0xcb3b('0x1d'),'port':0x18eb});var socket=require(_0xcb3b('0x1e'))(new Redis(config[_0xcb3b('0x1b')]));require(_0xcb3b('0x1f'))[_0xcb3b('0x20')](socket);function respondWithStatusCode(_0x3187ad,_0x484f0b){_0x484f0b=_0x484f0b||0xcc;return function(_0x2e8415){if(_0x2e8415){return _0x3187ad[_0xcb3b('0x21')](_0x484f0b);}return _0x3187ad[_0xcb3b('0x22')](_0x484f0b)[_0xcb3b('0x23')]();};}function respondWithResult(_0x1477b6,_0xa1f47c){_0xa1f47c=_0xa1f47c||0xc8;return function(_0x2e04fb){if(_0x2e04fb){return _0x1477b6[_0xcb3b('0x22')](_0xa1f47c)['json'](_0x2e04fb);}};}function respondWithFilteredResult(_0x2294e6,_0x3d7898){return function(_0x55cbd1){if(_0x55cbd1){var _0x5d45d4=typeof _0x3d7898['offset']==='undefined'&&typeof _0x3d7898[_0xcb3b('0x24')]==='undefined';var _0x1c2bca=_0x55cbd1[_0xcb3b('0x25')];var _0x56af90=_0x5d45d4?0x0:_0x3d7898[_0xcb3b('0x26')];var _0x493e87=_0x5d45d4?_0x55cbd1['count']:_0x3d7898[_0xcb3b('0x26')]+_0x3d7898[_0xcb3b('0x24')];var _0x259113;if(_0x493e87>=_0x1c2bca){_0x493e87=_0x1c2bca;_0x259113=0xc8;}else{_0x259113=0xce;}_0x2294e6[_0xcb3b('0x22')](_0x259113);return _0x2294e6[_0xcb3b('0x27')](_0xcb3b('0x28'),_0x56af90+'-'+_0x493e87+'/'+_0x1c2bca)[_0xcb3b('0x29')](_0x55cbd1);}return null;};}function patchUpdates(_0x32f4ce){return function(_0x353be4){try{jsonpatch[_0xcb3b('0x2a')](_0x353be4,_0x32f4ce,!![]);}catch(_0xeac554){return BPromise['reject'](_0xeac554);}return _0x353be4[_0xcb3b('0x2b')]();};}function saveUpdates(_0x2dfd44,_0x1abb88){return function(_0x337369){if(_0x337369){return _0x337369[_0xcb3b('0x2c')](_0x2dfd44)['then'](function(_0x1e938a){return _0x1e938a;});}return null;};}function removeEntity(_0xf280b3,_0x152522){return function(_0x559d7a){if(_0x559d7a){return _0x559d7a[_0xcb3b('0x2d')]()[_0xcb3b('0x2e')](function(){var _0x9f986d=_0x559d7a[_0xcb3b('0x2f')]({'plain':!![]});var _0x3def1e=_0xcb3b('0x30');return db[_0xcb3b('0x31')][_0xcb3b('0x2d')]({'where':{'type':_0x3def1e,'resourceId':_0x9f986d['id']}})[_0xcb3b('0x2e')](function(){return _0x559d7a;});})['then'](function(){_0xf280b3['status'](0xcc)[_0xcb3b('0x23')]();});}};}function handleEntityNotFound(_0x358fd9,_0x41784e){return function(_0x16a5eb){if(!_0x16a5eb){_0x358fd9['sendStatus'](0x194);}return _0x16a5eb;};}function handleError(_0xadd142,_0xd5f108){_0xd5f108=_0xd5f108||0x1f4;return function(_0x481f68){logger[_0xcb3b('0x32')](_0x481f68[_0xcb3b('0x33')]);if(_0x481f68[_0xcb3b('0x34')]){delete _0x481f68['name'];}_0xadd142[_0xcb3b('0x22')](_0xd5f108)[_0xcb3b('0x35')](_0x481f68);};}exports[_0xcb3b('0x36')]=function(_0x376390,_0x481d12){var _0x5407b4={},_0x4b547b={},_0x5caf19={'count':0x0,'rows':[]};var _0x47a33a=_['map'](db[_0xcb3b('0x37')][_0xcb3b('0x38')],function(_0xda5ca3){return{'name':_0xda5ca3['fieldName'],'type':_0xda5ca3['type'][_0xcb3b('0x39')]};});_0x4b547b['model']=_['map'](_0x47a33a,_0xcb3b('0x34'));_0x4b547b[_0xcb3b('0x3a')]=_[_0xcb3b('0x3b')](_0x376390[_0xcb3b('0x3a')]);_0x4b547b[_0xcb3b('0x3c')]=_[_0xcb3b('0x3d')](_0x4b547b[_0xcb3b('0x3e')],_0x4b547b['query']);_0x5407b4[_0xcb3b('0x3f')]=_['intersection'](_0x4b547b[_0xcb3b('0x3e')],qs[_0xcb3b('0x40')](_0x376390['query'][_0xcb3b('0x40')]));_0x5407b4[_0xcb3b('0x3f')]=_0x5407b4[_0xcb3b('0x3f')]['length']?_0x5407b4[_0xcb3b('0x3f')]:_0x4b547b['model'];if(!_0x376390[_0xcb3b('0x3a')][_0xcb3b('0x41')]('nolimit')){_0x5407b4[_0xcb3b('0x24')]=qs['limit'](_0x376390[_0xcb3b('0x3a')][_0xcb3b('0x24')]);_0x5407b4[_0xcb3b('0x26')]=qs[_0xcb3b('0x26')](_0x376390['query'][_0xcb3b('0x26')]);}_0x5407b4[_0xcb3b('0x42')]=qs[_0xcb3b('0x43')](_0x376390[_0xcb3b('0x3a')][_0xcb3b('0x43')]);_0x5407b4[_0xcb3b('0x44')]=qs['filters'](_[_0xcb3b('0x45')](_0x376390[_0xcb3b('0x3a')],_0x4b547b[_0xcb3b('0x3c')]),_0x47a33a);if(_0x376390[_0xcb3b('0x3a')][_0xcb3b('0x46')]){_0x5407b4[_0xcb3b('0x44')]=_[_0xcb3b('0x47')](_0x5407b4['where'],{'$or':_[_0xcb3b('0x48')](_0x47a33a,function(_0x1d74a0){if(_0x1d74a0['type']!==_0xcb3b('0x49')){var _0x4929ca={};_0x4929ca[_0x1d74a0[_0xcb3b('0x34')]]={'$like':'%'+_0x376390[_0xcb3b('0x3a')]['filter']+'%'};return _0x4929ca;}})});}_0x5407b4=_['merge']({},_0x5407b4,_0x376390[_0xcb3b('0x4a')]);var _0x265ca3={'where':_0x5407b4[_0xcb3b('0x44')]};return db['Dashboard'][_0xcb3b('0x25')](_0x265ca3)[_0xcb3b('0x2e')](function(_0x4032a8){_0x5caf19[_0xcb3b('0x25')]=_0x4032a8;if(_0x376390[_0xcb3b('0x3a')][_0xcb3b('0x4b')]){_0x5407b4[_0xcb3b('0x4c')]=[{'all':!![]}];}return db['Dashboard'][_0xcb3b('0x4d')](_0x5407b4);})[_0xcb3b('0x2e')](function(_0xfdec0d){_0x5caf19['rows']=_0xfdec0d;return _0x5caf19;})[_0xcb3b('0x2e')](respondWithFilteredResult(_0x481d12,_0x5407b4))['catch'](handleError(_0x481d12,null));};exports[_0xcb3b('0x4e')]=function(_0x299b7d,_0x44a8b3){var _0x532ab4={'raw':![],'where':{'id':_0x299b7d[_0xcb3b('0x4f')]['id']}},_0x11c68b={};_0x11c68b['model']=_[_0xcb3b('0x3b')](db[_0xcb3b('0x37')][_0xcb3b('0x38')]);_0x11c68b[_0xcb3b('0x3a')]=_[_0xcb3b('0x3b')](_0x299b7d[_0xcb3b('0x3a')]);_0x11c68b['filters']=_[_0xcb3b('0x3d')](_0x11c68b['model'],_0x11c68b[_0xcb3b('0x3a')]);_0x532ab4[_0xcb3b('0x3f')]=_['intersection'](_0x11c68b[_0xcb3b('0x3e')],qs[_0xcb3b('0x40')](_0x299b7d[_0xcb3b('0x3a')][_0xcb3b('0x40')]));_0x532ab4[_0xcb3b('0x3f')]=_0x532ab4[_0xcb3b('0x3f')][_0xcb3b('0x50')]?_0x532ab4[_0xcb3b('0x3f')]:_0x11c68b[_0xcb3b('0x3e')];if(_0x299b7d[_0xcb3b('0x3a')]['includeAll']){_0x532ab4[_0xcb3b('0x4c')]=[{'all':!![]}];}_0x532ab4=_['merge']({},_0x532ab4,_0x299b7d[_0xcb3b('0x4a')]);return db['Dashboard'][_0xcb3b('0x51')](_0x532ab4)[_0xcb3b('0x2e')](handleEntityNotFound(_0x44a8b3,null))[_0xcb3b('0x2e')](respondWithResult(_0x44a8b3,null))['catch'](handleError(_0x44a8b3,null));};exports[_0xcb3b('0x52')]=function(_0x455055,_0x5b02d5){return db[_0xcb3b('0x37')]['create'](_0x455055[_0xcb3b('0x53')],{})[_0xcb3b('0x2e')](function(_0x2d99ea){var _0x170ef3=_0x455055[_0xcb3b('0x54')]['get']({'plain':!![]});if(!_0x170ef3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x170ef3[_0xcb3b('0x55')]==='user'){var _0xeccb1d=_0x2d99ea[_0xcb3b('0x2f')]({'plain':!![]});var _0x35553a=_0xcb3b('0x30');return db[_0xcb3b('0x56')][_0xcb3b('0x51')]({'where':{'name':_0x35553a,'userProfileId':_0x170ef3[_0xcb3b('0x57')]},'raw':!![]})[_0xcb3b('0x2e')](function(_0x5d8c54){if(_0x5d8c54&&_0x5d8c54[_0xcb3b('0x58')]===0x0){return db[_0xcb3b('0x31')][_0xcb3b('0x52')]({'name':_0xeccb1d['name'],'resourceId':_0xeccb1d['id'],'type':_0x5d8c54[_0xcb3b('0x34')],'sectionId':_0x5d8c54['id']},{})[_0xcb3b('0x2e')](function(){return _0x2d99ea;});}else{return _0x2d99ea;}})['catch'](function(_0x57342a){logger[_0xcb3b('0x32')](_0xcb3b('0x59'),_0x57342a);throw _0x57342a;});}return _0x2d99ea;})[_0xcb3b('0x2e')](respondWithResult(_0x5b02d5,0xc9))[_0xcb3b('0x5a')](handleError(_0x5b02d5,null));};exports['clone']=function(_0x500f8f,_0xea89bc){var _0x14bb9d={'where':{'id':_0x500f8f['params']['id']}},_0x411c43={};_0x411c43[_0xcb3b('0x3e')]=_['keys'](db[_0xcb3b('0x37')][_0xcb3b('0x38')]);_0x14bb9d[_0xcb3b('0x3f')]=_[_0xcb3b('0x3d')](_0x411c43[_0xcb3b('0x3e')],qs[_0xcb3b('0x40')](_0x500f8f[_0xcb3b('0x3a')]['fields']));_0x14bb9d[_0xcb3b('0x3f')]=_0x14bb9d[_0xcb3b('0x3f')]['length']?_0x14bb9d[_0xcb3b('0x3f')]:_0x411c43[_0xcb3b('0x3e')];if(_0x500f8f['query'][_0xcb3b('0x4b')]){_0x14bb9d[_0xcb3b('0x4c')]=[{'all':!![]}];}_0x14bb9d=_[_0xcb3b('0x47')]({},_0x14bb9d,_0x500f8f[_0xcb3b('0x4a')]);return db[_0xcb3b('0x37')][_0xcb3b('0x51')](_0x14bb9d)[_0xcb3b('0x2e')](handleEntityNotFound(_0xea89bc,null))['then'](function(_0x45c171){if(_0x45c171){var _0x3f64b8=_0x45c171['get']({'plain':!![]});_0x3f64b8=qs['omit'](_0x3f64b8,['id',_0xcb3b('0x5b'),_0xcb3b('0x5c')]);_0x500f8f[_0xcb3b('0x53')]=_[_0xcb3b('0x5d')](_0x500f8f[_0xcb3b('0x53')],['id',_0xcb3b('0x5b'),_0xcb3b('0x5c')]);return db[_0xcb3b('0x37')][_0xcb3b('0x52')](_['merge'](_0x3f64b8,_0x500f8f[_0xcb3b('0x53')]),{'include':_0x500f8f[_0xcb3b('0x3a')][_0xcb3b('0x4b')]?[{'all':!![]}]:undefined})[_0xcb3b('0x2e')](function(_0x38d983){var _0x264a32=_0x500f8f[_0xcb3b('0x54')][_0xcb3b('0x2f')]({'plain':!![]});if(!_0x264a32)throw new Error(_0xcb3b('0x5e'));if(_0x264a32[_0xcb3b('0x55')]===_0xcb3b('0x54')){var _0x186255=_0x38d983[_0xcb3b('0x2f')]({'plain':!![]});var _0x7d0fef='CustomDashboards';return db['UserProfileSection'][_0xcb3b('0x51')]({'where':{'name':_0x7d0fef,'userProfileId':_0x264a32['userProfileId']},'raw':!![]})[_0xcb3b('0x2e')](function(_0x29ec43){if(_0x29ec43&&_0x29ec43[_0xcb3b('0x58')]===0x0){return db[_0xcb3b('0x31')][_0xcb3b('0x52')]({'name':_0x186255[_0xcb3b('0x34')],'resourceId':_0x186255['id'],'type':_0x29ec43[_0xcb3b('0x34')],'sectionId':_0x29ec43['id']},{})[_0xcb3b('0x2e')](function(){return _0x38d983;});}else{return _0x38d983;}})[_0xcb3b('0x5a')](function(_0x2067cf){logger[_0xcb3b('0x32')](_0xcb3b('0x59'),_0x2067cf);throw _0x2067cf;});}return _0x38d983;});}})['then'](respondWithResult(_0xea89bc,0xc9))[_0xcb3b('0x5a')](handleError(_0xea89bc,null));};exports['update']=function(_0x5ef82b,_0x2c4734){if(_0x5ef82b[_0xcb3b('0x53')]['id']){delete _0x5ef82b['body']['id'];}return db[_0xcb3b('0x37')]['find']({'where':{'id':_0x5ef82b[_0xcb3b('0x4f')]['id']}})[_0xcb3b('0x2e')](handleEntityNotFound(_0x2c4734,null))[_0xcb3b('0x2e')](saveUpdates(_0x5ef82b[_0xcb3b('0x53')],null))[_0xcb3b('0x2e')](respondWithResult(_0x2c4734,null))[_0xcb3b('0x5a')](handleError(_0x2c4734,null));};exports[_0xcb3b('0x2d')]=function(_0x17b737,_0x5ba04a){return db[_0xcb3b('0x37')][_0xcb3b('0x51')]({'where':{'id':_0x17b737['params']['id']}})[_0xcb3b('0x2e')](handleEntityNotFound(_0x5ba04a,null))[_0xcb3b('0x2e')](removeEntity(_0x5ba04a,null))[_0xcb3b('0x5a')](handleError(_0x5ba04a,null));};function widgetAttributes(_0x410e5a){try{switch(_0x410e5a[_0xcb3b('0x5f')]){case _0xcb3b('0x60'):return[{'name':_0xcb3b('0x61'),'value':_0x410e5a[_0xcb3b('0x61')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x0]?_0x410e5a[_0xcb3b('0x62')][0x0][_0xcb3b('0x63')]:undefined)||_0xcb3b('0x64')}];case _0xcb3b('0x65'):return[{'name':_0xcb3b('0x66'),'value':_0x410e5a['attrPath']||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x0]?_0x410e5a[_0xcb3b('0x62')][0x0][_0xcb3b('0x63')]:undefined)||''}];case _0xcb3b('0x67'):return[{'name':_0xcb3b('0x68'),'value':_0x410e5a[_0xcb3b('0x68')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x0]?_0x410e5a[_0xcb3b('0x62')][0x0][_0xcb3b('0x63')]:undefined)||_0xcb3b('0x69')},{'name':_0xcb3b('0x6a'),'value':_0x410e5a['attrTimezone']||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a['attrs'][0x1]?_0x410e5a['attrs'][0x1]['value']:undefined)||_0xcb3b('0x6b')},{'name':_0xcb3b('0x6c'),'value':_0x410e5a[_0xcb3b('0x6c')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x2]?_0x410e5a[_0xcb3b('0x62')][0x2][_0xcb3b('0x63')]:undefined)||0xc}];case _0xcb3b('0x6d'):return[{'name':_0xcb3b('0x6e'),'value':_0x410e5a[_0xcb3b('0x6e')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x0]?_0x410e5a[_0xcb3b('0x62')][0x0][_0xcb3b('0x63')]:undefined)||_0xcb3b('0x6f')},{'name':'attrVoiceQueues','value':_0x410e5a[_0xcb3b('0x70')]||(_0x410e5a['attrs']&&_0x410e5a[_0xcb3b('0x62')][0x1]?_0x410e5a[_0xcb3b('0x62')][0x1]['value']:undefined)||[]},{'name':_0xcb3b('0x6c'),'value':_0x410e5a[_0xcb3b('0x6c')]||(_0x410e5a['attrs']&&_0x410e5a[_0xcb3b('0x62')][0x2]?_0x410e5a[_0xcb3b('0x62')][0x2]['value']:undefined)||0x14},{'name':_0xcb3b('0x71'),'value':_0x410e5a[_0xcb3b('0x71')]||(_0x410e5a['attrs']&&_0x410e5a[_0xcb3b('0x62')][0x3]?_0x410e5a[_0xcb3b('0x62')][0x3][_0xcb3b('0x63')]:undefined)||_0xcb3b('0x72')},{'name':_0xcb3b('0x73'),'value':_0x410e5a[_0xcb3b('0x73')]||(_0x410e5a['attrs']&&_0x410e5a[_0xcb3b('0x62')][0x4]?_0x410e5a[_0xcb3b('0x62')][0x4][_0xcb3b('0x63')]:undefined)||''},{'name':_0xcb3b('0x74'),'value':_0x410e5a['attrFaxAccounts']||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x5]?_0x410e5a[_0xcb3b('0x62')][0x5]['value']:undefined)||''},{'name':_0xcb3b('0x75'),'value':_0x410e5a[_0xcb3b('0x75')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a['attrs'][0x6]?_0x410e5a[_0xcb3b('0x62')][0x6][_0xcb3b('0x63')]:undefined)||''},{'name':_0xcb3b('0x76'),'value':_0x410e5a['attrOpenchannelAccounts']||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x7]?_0x410e5a[_0xcb3b('0x62')][0x7][_0xcb3b('0x63')]:undefined)||''},{'name':_0xcb3b('0x77'),'value':_0x410e5a[_0xcb3b('0x77')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x8]?_0x410e5a[_0xcb3b('0x62')][0x8][_0xcb3b('0x63')]:undefined)||''},{'name':_0xcb3b('0x78'),'value':_0x410e5a[_0xcb3b('0x78')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a['attrs'][0x9]?_0x410e5a[_0xcb3b('0x62')][0x9]['value']:undefined)||''}];case _0xcb3b('0x79'):case'pie-chart':return[{'name':_0xcb3b('0x7a'),'value':_0x410e5a[_0xcb3b('0x7a')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x0]?_0x410e5a[_0xcb3b('0x62')][0x0][_0xcb3b('0x63')]:undefined)||_0xcb3b('0x6f')},{'name':_0xcb3b('0x7b'),'value':_0x410e5a['attrSerie2']||(_0x410e5a['attrs']&&_0x410e5a[_0xcb3b('0x62')][0x1]?_0x410e5a['attrs'][0x1][_0xcb3b('0x63')]:undefined)||null},{'name':_0xcb3b('0x7c'),'value':_0x410e5a[_0xcb3b('0x7c')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x2]?_0x410e5a['attrs'][0x2]['value']:undefined)||null},{'name':_0xcb3b('0x70'),'value':_0x410e5a[_0xcb3b('0x70')]||(_0x410e5a['attrs']&&_0x410e5a[_0xcb3b('0x62')][0x3]?_0x410e5a[_0xcb3b('0x62')][0x3][_0xcb3b('0x63')]:undefined)||[]},{'name':_0xcb3b('0x71'),'value':_0x410e5a[_0xcb3b('0x71')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x4]?_0x410e5a['attrs'][0x4][_0xcb3b('0x63')]:undefined)||_0xcb3b('0x72')},{'name':'attrEmailAccounts','value':_0x410e5a[_0xcb3b('0x73')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x5]?_0x410e5a['attrs'][0x5][_0xcb3b('0x63')]:undefined)||''},{'name':_0xcb3b('0x74'),'value':_0x410e5a[_0xcb3b('0x74')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x6]?_0x410e5a[_0xcb3b('0x62')][0x6][_0xcb3b('0x63')]:undefined)||''},{'name':_0xcb3b('0x75'),'value':_0x410e5a[_0xcb3b('0x75')]||(_0x410e5a['attrs']&&_0x410e5a[_0xcb3b('0x62')][0x7]?_0x410e5a[_0xcb3b('0x62')][0x7][_0xcb3b('0x63')]:undefined)||''},{'name':_0xcb3b('0x76'),'value':_0x410e5a[_0xcb3b('0x76')]||(_0x410e5a['attrs']&&_0x410e5a['attrs'][0x8]?_0x410e5a[_0xcb3b('0x62')][0x8][_0xcb3b('0x63')]:undefined)||''},{'name':_0xcb3b('0x77'),'value':_0x410e5a[_0xcb3b('0x77')]||(_0x410e5a['attrs']&&_0x410e5a[_0xcb3b('0x62')][0x9]?_0x410e5a[_0xcb3b('0x62')][0x9][_0xcb3b('0x63')]:undefined)||''},{'name':_0xcb3b('0x78'),'value':_0x410e5a[_0xcb3b('0x78')]||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a['attrs'][0xa]?_0x410e5a[_0xcb3b('0x62')][0xa][_0xcb3b('0x63')]:undefined)||''}];case _0xcb3b('0x7d'):return[{'name':_0xcb3b('0x7e'),'type':_0x410e5a['reportType']||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x0]?_0x410e5a[_0xcb3b('0x62')][0x0][_0xcb3b('0x5f')]:undefined)||null,'value':_0x410e5a['attrReport']||(_0x410e5a[_0xcb3b('0x62')]&&_0x410e5a[_0xcb3b('0x62')][0x0]?_0x410e5a['attrs'][0x0][_0xcb3b('0x63')]:undefined)||null},{'name':_0xcb3b('0x7f'),'value':_0x410e5a['attrRefresh']||(_0x410e5a['attrs']&&_0x410e5a['attrs'][0x1]?_0x410e5a[_0xcb3b('0x62')][0x1][_0xcb3b('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x3faa01){logger['error'](_0xcb3b('0x80'),JSON['stringify'](_0x3faa01));return[];}}exports[_0xcb3b('0x81')]=function(_0x204962,_0x25d50e,_0x21ef73){if(_0x204962[_0xcb3b('0x53')]['id']){delete _0x204962[_0xcb3b('0x53')]['id'];}return db[_0xcb3b('0x37')][_0xcb3b('0x51')]({'where':{'id':_0x204962[_0xcb3b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x25d50e,null))[_0xcb3b('0x2e')](function(_0x10ec4a){if(_0x10ec4a){_0x204962[_0xcb3b('0x53')][_0xcb3b('0x82')]=_0x10ec4a['id'];_0x204962[_0xcb3b('0x53')][_0xcb3b('0x62')]=widgetAttributes(_0x204962[_0xcb3b('0x53')]);return db[_0xcb3b('0x83')]['create'](_0x204962['body']);}})[_0xcb3b('0x2e')](respondWithResult(_0x25d50e,null))['catch'](handleError(_0x25d50e,null));};exports[_0xcb3b('0x84')]=function(_0x476e3e,_0x2fcc11,_0x26612f){var _0x2f5f73={};var _0x2a4d99={};var _0x577524;var _0xf6fc5e;return db[_0xcb3b('0x37')][_0xcb3b('0x85')]({'where':{'id':_0x476e3e['params']['id']}})[_0xcb3b('0x2e')](handleEntityNotFound(_0x2fcc11,null))['then'](function(_0x4a1380){if(_0x4a1380){_0x577524=_0x4a1380;_0x2a4d99[_0xcb3b('0x3e')]=_['keys'](db[_0xcb3b('0x83')][_0xcb3b('0x38')]);_0x2a4d99[_0xcb3b('0x3a')]=_[_0xcb3b('0x3b')](_0x476e3e['query']);_0x2a4d99[_0xcb3b('0x3c')]=_[_0xcb3b('0x3d')](_0x2a4d99[_0xcb3b('0x3e')],_0x2a4d99[_0xcb3b('0x3a')]);_0x2f5f73['attributes']=_[_0xcb3b('0x3d')](_0x2a4d99['model'],qs[_0xcb3b('0x40')](_0x476e3e['query']['fields']));_0x2f5f73[_0xcb3b('0x3f')]=_0x2f5f73[_0xcb3b('0x3f')][_0xcb3b('0x50')]?_0x2f5f73[_0xcb3b('0x3f')]:_0x2a4d99[_0xcb3b('0x3e')];_0x2f5f73[_0xcb3b('0x42')]=qs[_0xcb3b('0x43')](_0x476e3e['query'][_0xcb3b('0x43')]);_0x2f5f73['where']=qs[_0xcb3b('0x3c')](_[_0xcb3b('0x45')](_0x476e3e[_0xcb3b('0x3a')],_0x2a4d99[_0xcb3b('0x3c')]));if(_0x476e3e[_0xcb3b('0x3a')]['filter']){_0x2f5f73[_0xcb3b('0x44')]=_[_0xcb3b('0x47')](_0x2f5f73[_0xcb3b('0x44')],{'$or':_[_0xcb3b('0x48')](_0x2f5f73[_0xcb3b('0x3f')],function(_0x536d40){var _0x24ec80={};_0x24ec80[_0x536d40]={'$like':'%'+_0x476e3e[_0xcb3b('0x3a')]['filter']+'%'};return _0x24ec80;})});}_0x2f5f73=_[_0xcb3b('0x47')]({},_0x2f5f73,_0x476e3e[_0xcb3b('0x4a')]);return _0x577524[_0xcb3b('0x84')](_0x2f5f73);}})[_0xcb3b('0x2e')](function(_0x19a1ab){if(_0x19a1ab){_0xf6fc5e=_0x19a1ab[_0xcb3b('0x50')];if(!_0x476e3e[_0xcb3b('0x3a')][_0xcb3b('0x41')](_0xcb3b('0x86'))){_0x2f5f73[_0xcb3b('0x24')]=qs['limit'](_0x476e3e[_0xcb3b('0x3a')][_0xcb3b('0x24')]);_0x2f5f73[_0xcb3b('0x26')]=qs[_0xcb3b('0x26')](_0x476e3e['query']['offset']);}return _0x577524[_0xcb3b('0x84')](_0x2f5f73);}})[_0xcb3b('0x2e')](function(_0x5ac344){if(_0x5ac344){return _0x5ac344?{'count':_0xf6fc5e,'rows':_0x5ac344}:null;}})['then'](respondWithResult(_0x2fcc11,null))['catch'](handleError(_0x2fcc11,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 3a8de3b..06ff8e9 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 _0x1e8b=['hasOwnProperty','hook','../../mysqldb','Dashboard','save','remove','emit'];(function(_0x2bf574,_0x2c43d6){var _0x287d91=function(_0x1a27a4){while(--_0x1a27a4){_0x2bf574['push'](_0x2bf574['shift']());}};_0x287d91(++_0x2c43d6);}(_0x1e8b,0xf0));var _0xb1e8=function(_0x29b35c,_0x2001c5){_0x29b35c=_0x29b35c-0x0;var _0x5ab131=_0x1e8b[_0x29b35c];return _0x5ab131;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xb1e8('0x0'))['db'][_0xb1e8('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb1e8('0x2'),'afterUpdate':'update','afterDestroy':_0xb1e8('0x3')};function emitEvent(_0x1b40cc){return function(_0x432c60,_0x20bfb4,_0x4ee14f){DashboardEvents['emit'](_0x1b40cc+':'+_0x432c60['id'],_0x432c60);DashboardEvents[_0xb1e8('0x4')](_0x1b40cc,_0x432c60);_0x4ee14f(null);};}for(var e in events){if(events[_0xb1e8('0x5')](e)){var event=events[e];Dashboard[_0xb1e8('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xa151=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xfdc36a,_0x273706){var _0x2ff5b3=function(_0x152f51){while(--_0x152f51){_0xfdc36a['push'](_0xfdc36a['shift']());}};_0x2ff5b3(++_0x273706);}(_0xa151,0x13d));var _0x1a15=function(_0xad244b,_0x5ef418){_0xad244b=_0xad244b-0x0;var _0x362929=_0xa151[_0xad244b];return _0x362929;};'use strict';var EventEmitter=require(_0x1a15('0x0'));var Dashboard=require(_0x1a15('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1a15('0x2')](0x0);var events={'afterCreate':_0x1a15('0x3'),'afterUpdate':_0x1a15('0x4'),'afterDestroy':'remove'};function emitEvent(_0x10f7a8){return function(_0x31ad13,_0x2cdab4,_0x47e5c6){DashboardEvents[_0x1a15('0x5')](_0x10f7a8+':'+_0x31ad13['id'],_0x31ad13);DashboardEvents['emit'](_0x10f7a8,_0x31ad13);_0x47e5c6(null);};}for(var e in events){if(events[_0x1a15('0x6')](e)){var event=events[e];Dashboard[_0x1a15('0x7')](e,emitEvent(event));}}module[_0x1a15('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 67b32e9..d0dc8cf 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 _0x415e=['./dashboard.attributes','Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x328f74,_0xece85b){var _0x152f8e=function(_0x11550a){while(--_0x11550a){_0x328f74['push'](_0x328f74['shift']());}};_0x152f8e(++_0xece85b);}(_0x415e,0x1c6));var _0xe415=function(_0x20a270,_0x8b8437){_0x20a270=_0x20a270-0x0;var _0x49429a=_0x415e[_0x20a270];return _0x49429a;};'use strict';var _=require(_0xe415('0x0'));var util=require(_0xe415('0x1'));var logger=require(_0xe415('0x2'))('api');var moment=require(_0xe415('0x3'));var BPromise=require(_0xe415('0x4'));var rp=require(_0xe415('0x5'));var fs=require('fs');var path=require(_0xe415('0x6'));var rimraf=require(_0xe415('0x7'));var config=require('../../config/environment');var attributes=require(_0xe415('0x8'));module['exports']=function(_0x1f3996,_0x325844){return _0x1f3996['define'](_0xe415('0x9'),attributes,{'tableName':_0xe415('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fbb=['../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','moment','bluebird','path','rimraf'];(function(_0x19bb05,_0x255b97){var _0x23d4fe=function(_0xbf37d6){while(--_0xbf37d6){_0x19bb05['push'](_0x19bb05['shift']());}};_0x23d4fe(++_0x255b97);}(_0x6fbb,0x13b));var _0xb6fb=function(_0x11db88,_0x4e71b2){_0x11db88=_0x11db88-0x0;var _0x9a3658=_0x6fbb[_0x11db88];return _0x9a3658;};'use strict';var _=require(_0xb6fb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6fb('0x1'));var BPromise=require(_0xb6fb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6fb('0x3'));var rimraf=require(_0xb6fb('0x4'));var config=require(_0xb6fb('0x5'));var attributes=require(_0xb6fb('0x6'));module['exports']=function(_0x5807e7,_0x27b7ca){return _0x5807e7[_0xb6fb('0x7')](_0xb6fb('0x8'),attributes,{'tableName':_0xb6fb('0x9'),'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 94c48b6..6063b8c 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 _0xb218=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','Dashboard,\x20%s,\x20%s','message','catch','util','moment','bluebird'];(function(_0x4bbfbf,_0x583fda){var _0x376501=function(_0x47d122){while(--_0x47d122){_0x4bbfbf['push'](_0x4bbfbf['shift']());}};_0x376501(++_0x583fda);}(_0xb218,0x1bf));var _0x8b21=function(_0x5942c7,_0x5368ed){_0x5942c7=_0x5942c7-0x0;var _0x1e6f08=_0xb218[_0x5942c7];return _0x1e6f08;};'use strict';var _=require('lodash');var util=require(_0x8b21('0x0'));var moment=require(_0x8b21('0x1'));var BPromise=require(_0x8b21('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b21('0x3'));var db=require(_0x8b21('0x4'))['db'];var utils=require(_0x8b21('0x5'));var logger=require(_0x8b21('0x6'))(_0x8b21('0x7'));var config=require(_0x8b21('0x8'));var jayson=require(_0x8b21('0x9'));var client=jayson[_0x8b21('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x8b21('0xb')],{'host':_0x8b21('0xc'),'port':0x18eb});var socket=require(_0x8b21('0xd'))(new Redis(config[_0x8b21('0xb')]));require(_0x8b21('0xe'))[_0x8b21('0xf')](socket);function respondWithRpcPromise(_0xc4d1df,_0x57c4ee,_0x4ffa50){return new BPromise(function(_0x1cc03b,_0x9a08ba){return client[_0x8b21('0x10')](_0xc4d1df,_0x4ffa50)[_0x8b21('0x11')](function(_0x2e3a7c){logger['info']('Dashboard,\x20%s,\x20%s',_0x57c4ee,_0x8b21('0x12'));logger['debug'](_0x8b21('0x13'),_0x57c4ee,'request\x20sent',JSON[_0x8b21('0x14')](_0x2e3a7c));if(_0x2e3a7c['error']){if(_0x2e3a7c[_0x8b21('0x15')]['code']===0x1f4){logger[_0x8b21('0x15')](_0x8b21('0x16'),_0x57c4ee,_0x2e3a7c[_0x8b21('0x15')]['message']);return _0x9a08ba(_0x2e3a7c[_0x8b21('0x15')][_0x8b21('0x17')]);}logger[_0x8b21('0x15')]('Dashboard,\x20%s,\x20%s',_0x57c4ee,_0x2e3a7c['error'][_0x8b21('0x17')]);return _0x1cc03b(_0x2e3a7c['error'][_0x8b21('0x17')]);}else{logger['info'](_0x8b21('0x16'),_0x57c4ee,_0x8b21('0x12'));_0x1cc03b(_0x2e3a7c['result']['message']);}})[_0x8b21('0x18')](function(_0x342b6e){logger[_0x8b21('0x15')](_0x8b21('0x16'),_0x57c4ee,_0x342b6e);_0x9a08ba(_0x342b6e);});});} \ No newline at end of file +var _0x0389=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x39153b,_0x31e47e){var _0x124cf8=function(_0x3915ae){while(--_0x3915ae){_0x39153b['push'](_0x39153b['shift']());}};_0x124cf8(++_0x31e47e);}(_0x0389,0x175));var _0x9038=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x0389[_0x53afe9];return _0x396396;};'use strict';var _=require(_0x9038('0x0'));var util=require('util');var moment=require(_0x9038('0x1'));var BPromise=require(_0x9038('0x2'));var rs=require(_0x9038('0x3'));var fs=require('fs');var Redis=require(_0x9038('0x4'));var db=require(_0x9038('0x5'))['db'];var utils=require(_0x9038('0x6'));var logger=require(_0x9038('0x7'))('rpc');var config=require(_0x9038('0x8'));var jayson=require(_0x9038('0x9'));var client=jayson[_0x9038('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9038('0xb')],{'host':_0x9038('0xc'),'port':0x18eb});var socket=require(_0x9038('0xd'))(new Redis(config[_0x9038('0xb')]));require('./dashboard.socket')[_0x9038('0xe')](socket);function respondWithRpcPromise(_0x4f2c14,_0x500fa1,_0x381b51){return new BPromise(function(_0x1372e5,_0x503e3f){return client[_0x9038('0xf')](_0x4f2c14,_0x381b51)['then'](function(_0x3a3e30){logger[_0x9038('0x10')](_0x9038('0x11'),_0x500fa1,'request\x20sent');logger[_0x9038('0x12')](_0x9038('0x13'),_0x500fa1,_0x9038('0x14'),JSON[_0x9038('0x15')](_0x3a3e30));if(_0x3a3e30['error']){if(_0x3a3e30[_0x9038('0x16')][_0x9038('0x17')]===0x1f4){logger[_0x9038('0x16')](_0x9038('0x11'),_0x500fa1,_0x3a3e30['error']['message']);return _0x503e3f(_0x3a3e30['error'][_0x9038('0x18')]);}logger[_0x9038('0x16')](_0x9038('0x11'),_0x500fa1,_0x3a3e30[_0x9038('0x16')][_0x9038('0x18')]);return _0x1372e5(_0x3a3e30[_0x9038('0x16')][_0x9038('0x18')]);}else{logger[_0x9038('0x10')]('Dashboard,\x20%s,\x20%s',_0x500fa1,_0x9038('0x14'));_0x1372e5(_0x3a3e30[_0x9038('0x19')][_0x9038('0x18')]);}})[_0x9038('0x1a')](function(_0x1cbc93){logger['error'](_0x9038('0x11'),_0x500fa1,_0x1cbc93);_0x503e3f(_0x1cbc93);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5b81415..5266f5e 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 _0x00c5=['removeListener','register','length','dashboard:','save','remove','update'];(function(_0x5c2a43,_0x1b11f6){var _0x4d67ab=function(_0x2489c2){while(--_0x2489c2){_0x5c2a43['push'](_0x5c2a43['shift']());}};_0x4d67ab(++_0x1b11f6);}(_0x00c5,0x1b6));var _0x500c=function(_0x2a5da4,_0x3102d0){_0x2a5da4=_0x2a5da4-0x0;var _0x3ba3ed=_0x00c5[_0x2a5da4];return _0x3ba3ed;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x500c('0x0'),_0x500c('0x1'),_0x500c('0x2')];function createListener(_0x2f5a1b,_0x4dec34){return function(_0x2db81a){_0x4dec34['emit'](_0x2f5a1b,_0x2db81a);};}function removeListener(_0x43a14e,_0x21c361){return function(){DashboardEvents[_0x500c('0x3')](_0x43a14e,_0x21c361);};}exports[_0x500c('0x4')]=function(_0x5507a3){for(var _0x4f12d9=0x0,_0x407190=events[_0x500c('0x5')];_0x4f12d9<_0x407190;_0x4f12d9++){var _0x4fce3b=events[_0x4f12d9];var _0x3e2e3e=createListener(_0x500c('0x6')+_0x4fce3b,_0x5507a3);DashboardEvents['on'](_0x4fce3b,_0x3e2e3e);}}; \ No newline at end of file +var _0xde08=['removeListener','./dashboard.events','save','emit'];(function(_0x4fb683,_0x43736a){var _0x3b4599=function(_0xe1369f){while(--_0xe1369f){_0x4fb683['push'](_0x4fb683['shift']());}};_0x3b4599(++_0x43736a);}(_0xde08,0x1a5));var _0x8de0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde08[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0x8de0('0x0'));var events=[_0x8de0('0x1'),'remove','update'];function createListener(_0x253458,_0x374bb7){return function(_0x2b04fe){_0x374bb7[_0x8de0('0x2')](_0x253458,_0x2b04fe);};}function removeListener(_0x3c8fef,_0x169715){return function(){DashboardEvents[_0x8de0('0x3')](_0x3c8fef,_0x169715);};}exports['register']=function(_0x229392){for(var _0x30d58c=0x0,_0x1f17f0=events['length'];_0x30d58c<_0x1f17f0;_0x30d58c++){var _0x53cd7a=events[_0x30d58c];var _0x2dd3c5=createListener('dashboard:'+_0x53cd7a,_0x229392);DashboardEvents['on'](_0x53cd7a,_0x2dd3c5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 22903f8..fd04219 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 _0xbdf8=['index','/:id','isAuthenticated','/:id/items','getItems','post','/:id/clone','addItem','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xbdf8,0x1c5));var _0x8bdf=function(_0x217a72,_0x4e77a3){_0x217a72=_0x217a72-0x0;var _0x16c639=_0xbdf8[_0x217a72];return _0x16c639;};'use strict';var multer=require(_0x8bdf('0x0'));var util=require('util');var path=require(_0x8bdf('0x1'));var timeout=require(_0x8bdf('0x2'));var express=require('express');var router=express[_0x8bdf('0x3')]();var fs_extra=require(_0x8bdf('0x4'));var auth=require(_0x8bdf('0x5'));var interaction=require(_0x8bdf('0x6'));var config=require('../../config/environment');var controller=require(_0x8bdf('0x7'));router[_0x8bdf('0x8')]('/',auth['isAuthenticated'](),controller[_0x8bdf('0x9')]);router['get'](_0x8bdf('0xa'),auth[_0x8bdf('0xb')](),controller['show']);router[_0x8bdf('0x8')](_0x8bdf('0xc'),auth[_0x8bdf('0xb')](),controller[_0x8bdf('0xd')]);router[_0x8bdf('0xe')]('/',auth[_0x8bdf('0xb')](),controller['create']);router[_0x8bdf('0xe')](_0x8bdf('0xf'),auth[_0x8bdf('0xb')](),controller['clone']);router[_0x8bdf('0xe')]('/:id/items',auth['isAuthenticated'](),controller[_0x8bdf('0x10')]);router['put'](_0x8bdf('0xa'),auth[_0x8bdf('0xb')](),controller[_0x8bdf('0x11')]);router[_0x8bdf('0x12')](_0x8bdf('0xa'),auth['isAuthenticated'](),controller[_0x8bdf('0x13')]);module[_0x8bdf('0x14')]=router; \ No newline at end of file +var _0xc02e=['multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','/:id/items','getItems','post','/:id/clone','clone','addItem','put','/:id','delete'];(function(_0xf9ff09,_0x7e5d95){var _0x227db0=function(_0x1afd15){while(--_0x1afd15){_0xf9ff09['push'](_0xf9ff09['shift']());}};_0x227db0(++_0x7e5d95);}(_0xc02e,0x1ee));var _0xec02=function(_0x30affd,_0x31ef0f){_0x30affd=_0x30affd-0x0;var _0x3d2e25=_0xc02e[_0x30affd];return _0x3d2e25;};'use strict';var multer=require(_0xec02('0x0'));var util=require('util');var path=require(_0xec02('0x1'));var timeout=require('connect-timeout');var express=require(_0xec02('0x2'));var router=express['Router']();var fs_extra=require(_0xec02('0x3'));var auth=require(_0xec02('0x4'));var interaction=require(_0xec02('0x5'));var config=require(_0xec02('0x6'));var controller=require('./dashboard.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xec02('0x7')]);router[_0xec02('0x8')]('/:id',auth[_0xec02('0x9')](),controller['show']);router[_0xec02('0x8')](_0xec02('0xa'),auth[_0xec02('0x9')](),controller[_0xec02('0xb')]);router['post']('/',auth[_0xec02('0x9')](),controller['create']);router[_0xec02('0xc')](_0xec02('0xd'),auth[_0xec02('0x9')](),controller[_0xec02('0xe')]);router[_0xec02('0xc')](_0xec02('0xa'),auth[_0xec02('0x9')](),controller[_0xec02('0xf')]);router[_0xec02('0x10')](_0xec02('0x11'),auth[_0xec02('0x9')](),controller['update']);router[_0xec02('0x12')](_0xec02('0x11'),auth[_0xec02('0x9')](),controller['destroy']);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 69fb62b..ed1b43c 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 _0x7a54=['lodash','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x7a54,0x106));var _0x47a5=function(_0x2c2aef,_0x4ce4c6){_0x2c2aef=_0x2c2aef-0x0;var _0x498ae0=_0x7a54[_0x2c2aef];return _0x498ae0;};'use strict';var Sequelize=require(_0x47a5('0x0'));var squel=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));module['exports']={'title':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x47a5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x47a5('0x4')),'get':function(){try{return JSON[_0x47a5('0x5')](this[_0x47a5('0x6')](_0x47a5('0x7')));}catch(_0xfdf934){return[];}},'set':function(_0x545a97){try{this[_0x47a5('0x8')]('attrs',JSON[_0x47a5('0x9')](_0x545a97));}catch(_0x30e405){this['setDataValue'](_0x47a5('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x47a5('0xa')]},'col':{'type':Sequelize[_0x47a5('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47a5('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x47a5('0x3')]},'titleFontSize':{'type':Sequelize[_0x47a5('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xacf4=['lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xacf4,0xe7));var _0x4acf=function(_0xf65bf8,_0x494a66){_0xf65bf8=_0xf65bf8-0x0;var _0x2e4a66=_0xacf4[_0xf65bf8];return _0x2e4a66;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0x4acf('0x0'));module[_0x4acf('0x1')]={'title':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4acf('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4acf('0x3')](_0x4acf('0x4')),'get':function(){try{return JSON[_0x4acf('0x5')](this['getDataValue'](_0x4acf('0x6')));}catch(_0x2124c8){return[];}},'set':function(_0x4e0c43){try{this[_0x4acf('0x7')](_0x4acf('0x6'),JSON[_0x4acf('0x8')](_0x4e0c43));}catch(_0x45a5a4){this[_0x4acf('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x4acf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4acf('0x9')]},'col':{'type':Sequelize[_0x4acf('0x9')]},'background':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':_0x4acf('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 5a9de4c..8629bee 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 _0x4c9d=['0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','destroy','find','params','type','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone'];(function(_0x52c7f4,_0x2b3ad5){var _0x513d5b=function(_0x39bb23){while(--_0x39bb23){_0x52c7f4['push'](_0x52c7f4['shift']());}};_0x513d5b(++_0x2b3ad5);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4c9d[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xd4c9('0x0'));var rimraf=require(_0xd4c9('0x1'));var zipdir=require(_0xd4c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4c9('0x3'));var moment=require(_0xd4c9('0x4'));var BPromise=require(_0xd4c9('0x5'));var Mustache=require(_0xd4c9('0x6'));var util=require(_0xd4c9('0x7'));var path=require(_0xd4c9('0x8'));var sox=require(_0xd4c9('0x9'));var csv=require(_0xd4c9('0xa'));var ejs=require(_0xd4c9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd4c9('0xc'));var crypto=require(_0xd4c9('0xd'));var jsforce=require(_0xd4c9('0xe'));var deskjs=require(_0xd4c9('0xf'));var toCsv=require(_0xd4c9('0xa'));var querystring=require('querystring');var Papa=require(_0xd4c9('0x10'));var Redis=require(_0xd4c9('0x11'));var authService=require(_0xd4c9('0x12'));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(_0xd4c9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd4c9('0x14'));var db=require(_0xd4c9('0x15'))['db'];config[_0xd4c9('0x16')]=_['defaults'](config[_0xd4c9('0x16')],{'host':_0xd4c9('0x17'),'port':0x18eb});var socket=require(_0xd4c9('0x18'))(new Redis(config[_0xd4c9('0x16')]));require(_0xd4c9('0x19'))[_0xd4c9('0x1a')](socket);function respondWithStatusCode(_0x2f5f5d,_0x3d268a){_0x3d268a=_0x3d268a||0xcc;return function(_0x1e8953){if(_0x1e8953){return _0x2f5f5d[_0xd4c9('0x1b')](_0x3d268a);}return _0x2f5f5d[_0xd4c9('0x1c')](_0x3d268a)['end']();};}function respondWithResult(_0xf0246a,_0x39e486){_0x39e486=_0x39e486||0xc8;return function(_0x5ef24e){if(_0x5ef24e){return _0xf0246a[_0xd4c9('0x1c')](_0x39e486)[_0xd4c9('0x1d')](_0x5ef24e);}};}function respondWithFilteredResult(_0x4806bd,_0x4057d0){return function(_0x42fd51){if(_0x42fd51){var _0x3ca10b=typeof _0x4057d0[_0xd4c9('0x1e')]===_0xd4c9('0x1f')&&typeof _0x4057d0[_0xd4c9('0x20')]===_0xd4c9('0x1f');var _0x209dc6=_0x42fd51[_0xd4c9('0x21')];var _0x2b1e15=_0x3ca10b?0x0:_0x4057d0[_0xd4c9('0x1e')];var _0x5b70d6=_0x3ca10b?_0x42fd51['count']:_0x4057d0['offset']+_0x4057d0[_0xd4c9('0x20')];var _0x3edfc7;if(_0x5b70d6>=_0x209dc6){_0x5b70d6=_0x209dc6;_0x3edfc7=0xc8;}else{_0x3edfc7=0xce;}_0x4806bd[_0xd4c9('0x1c')](_0x3edfc7);return _0x4806bd[_0xd4c9('0x22')](_0xd4c9('0x23'),_0x2b1e15+'-'+_0x5b70d6+'/'+_0x209dc6)[_0xd4c9('0x1d')](_0x42fd51);}return null;};}function patchUpdates(_0x4cf000){return function(_0x3b9542){try{jsonpatch[_0xd4c9('0x24')](_0x3b9542,_0x4cf000,!![]);}catch(_0x1aa321){return BPromise[_0xd4c9('0x25')](_0x1aa321);}return _0x3b9542[_0xd4c9('0x26')]();};}function saveUpdates(_0x3edab5,_0x5e89fc){return function(_0x572d99){if(_0x572d99){return _0x572d99[_0xd4c9('0x27')](_0x3edab5)[_0xd4c9('0x28')](function(_0x154fdc){return _0x154fdc;});}return null;};}function removeEntity(_0x80466b,_0x52f8e4){return function(_0x423de2){if(_0x423de2){return _0x423de2['destroy']()[_0xd4c9('0x28')](function(){_0x80466b[_0xd4c9('0x1c')](0xcc)[_0xd4c9('0x29')]();});}};}function handleEntityNotFound(_0x2ded54,_0x105040){return function(_0x2417fb){if(!_0x2417fb){_0x2ded54[_0xd4c9('0x1b')](0x194);}return _0x2417fb;};}function handleError(_0x1dc82b,_0x222c78){_0x222c78=_0x222c78||0x1f4;return function(_0x5f38d1){logger[_0xd4c9('0x2a')](_0x5f38d1[_0xd4c9('0x2b')]);if(_0x5f38d1[_0xd4c9('0x2c')]){delete _0x5f38d1[_0xd4c9('0x2c')];}_0x1dc82b[_0xd4c9('0x1c')](_0x222c78)['send'](_0x5f38d1);};}exports[_0xd4c9('0x2d')]=function(_0x4bf1ca,_0x1da5d7){var _0x4fad8d={'raw':![],'where':{'id':_0x4bf1ca['params']['id']}},_0x1c394b={};_0x1c394b[_0xd4c9('0x2e')]=_[_0xd4c9('0x2f')](db[_0xd4c9('0x30')][_0xd4c9('0x31')]);_0x1c394b['query']=_[_0xd4c9('0x2f')](_0x4bf1ca[_0xd4c9('0x32')]);_0x1c394b[_0xd4c9('0x33')]=_[_0xd4c9('0x34')](_0x1c394b[_0xd4c9('0x2e')],_0x1c394b[_0xd4c9('0x32')]);_0x4fad8d['attributes']=_['intersection'](_0x1c394b[_0xd4c9('0x2e')],qs[_0xd4c9('0x35')](_0x4bf1ca[_0xd4c9('0x32')][_0xd4c9('0x35')]));_0x4fad8d['attributes']=_0x4fad8d[_0xd4c9('0x36')][_0xd4c9('0x37')]?_0x4fad8d[_0xd4c9('0x36')]:_0x1c394b[_0xd4c9('0x2e')];if(_0x4bf1ca[_0xd4c9('0x32')][_0xd4c9('0x38')]){_0x4fad8d[_0xd4c9('0x39')]=[{'all':!![]}];}_0x4fad8d=_[_0xd4c9('0x3a')]({},_0x4fad8d,_0x4bf1ca[_0xd4c9('0x3b')]);return db[_0xd4c9('0x30')]['find'](_0x4fad8d)[_0xd4c9('0x28')](handleEntityNotFound(_0x1da5d7,null))[_0xd4c9('0x28')](respondWithResult(_0x1da5d7,null))[_0xd4c9('0x3c')](handleError(_0x1da5d7,null));};exports[_0xd4c9('0x3d')]=function(_0x145bb3,_0x4bb6c4){return db['DashboardItem'][_0xd4c9('0x3e')]({'where':{'id':_0x145bb3[_0xd4c9('0x3f')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x4bb6c4,null))[_0xd4c9('0x28')](removeEntity(_0x4bb6c4,null))[_0xd4c9('0x3c')](handleError(_0x4bb6c4,null));};function widgetAttributes(_0x4b286d){try{switch(_0x4b286d[_0xd4c9('0x40')]){case'iframe':return[{'name':'attrUrl','value':_0x4b286d[_0xd4c9('0x41')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x0]?_0x4b286d['attrs'][0x0]['value']:undefined)||_0xd4c9('0x43')}];case _0xd4c9('0x44'):return[{'name':_0xd4c9('0x45'),'value':_0x4b286d['attrPath']||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x0]?_0x4b286d[_0xd4c9('0x42')][0x0][_0xd4c9('0x46')]:undefined)||''}];case'clock':return[{'name':_0xd4c9('0x47'),'value':_0x4b286d['attrHourFormat']||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x0]?_0x4b286d[_0xd4c9('0x42')][0x0][_0xd4c9('0x46')]:undefined)||_0xd4c9('0x48')},{'name':_0xd4c9('0x49'),'value':_0x4b286d['attrTimezone']||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x1]?_0x4b286d['attrs'][0x1]['value']:undefined)||_0xd4c9('0x4a')},{'name':_0xd4c9('0x4b'),'value':_0x4b286d[_0xd4c9('0x4b')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x2]?_0x4b286d[_0xd4c9('0x42')][0x2][_0xd4c9('0x46')]:undefined)||0xc}];case _0xd4c9('0x4c'):return[{'name':_0xd4c9('0x4d'),'value':_0x4b286d[_0xd4c9('0x4d')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x0]?_0x4b286d[_0xd4c9('0x42')][0x0]['value']:undefined)||_0xd4c9('0x4e')},{'name':_0xd4c9('0x4f'),'value':_0x4b286d[_0xd4c9('0x4f')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d['attrs'][0x1]?_0x4b286d[_0xd4c9('0x42')][0x1]['value']:undefined)||[]},{'name':_0xd4c9('0x4b'),'value':_0x4b286d[_0xd4c9('0x4b')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d['attrs'][0x2]?_0x4b286d['attrs'][0x2]['value']:undefined)||0x14},{'name':_0xd4c9('0x50'),'value':_0x4b286d[_0xd4c9('0x50')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x3]?_0x4b286d['attrs'][0x3][_0xd4c9('0x46')]:undefined)||_0xd4c9('0x51')},{'name':_0xd4c9('0x52'),'value':_0x4b286d['attrEmailAccounts']||(_0x4b286d['attrs']&&_0x4b286d[_0xd4c9('0x42')][0x4]?_0x4b286d[_0xd4c9('0x42')][0x4]['value']:undefined)||''},{'name':_0xd4c9('0x53'),'value':_0x4b286d['attrFaxAccounts']||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x5]?_0x4b286d[_0xd4c9('0x42')][0x5][_0xd4c9('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4b286d[_0xd4c9('0x54')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x6]?_0x4b286d[_0xd4c9('0x42')][0x6][_0xd4c9('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4b286d[_0xd4c9('0x55')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d['attrs'][0x7]?_0x4b286d[_0xd4c9('0x42')][0x7]['value']:undefined)||''},{'name':_0xd4c9('0x56'),'value':_0x4b286d[_0xd4c9('0x56')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x8]?_0x4b286d[_0xd4c9('0x42')][0x8][_0xd4c9('0x46')]:undefined)||''},{'name':_0xd4c9('0x57'),'value':_0x4b286d[_0xd4c9('0x57')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x9]?_0x4b286d[_0xd4c9('0x42')][0x9][_0xd4c9('0x46')]:undefined)||''}];case _0xd4c9('0x58'):case'pie-chart':return[{'name':_0xd4c9('0x59'),'value':_0x4b286d[_0xd4c9('0x59')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d['attrs'][0x0]?_0x4b286d[_0xd4c9('0x42')][0x0][_0xd4c9('0x46')]:undefined)||_0xd4c9('0x4e')},{'name':_0xd4c9('0x5a'),'value':_0x4b286d[_0xd4c9('0x5a')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x1]?_0x4b286d['attrs'][0x1][_0xd4c9('0x46')]:undefined)||null},{'name':_0xd4c9('0x5b'),'value':_0x4b286d[_0xd4c9('0x5b')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x2]?_0x4b286d['attrs'][0x2][_0xd4c9('0x46')]:undefined)||null},{'name':_0xd4c9('0x4f'),'value':_0x4b286d['attrVoiceQueues']||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x3]?_0x4b286d[_0xd4c9('0x42')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x4b286d[_0xd4c9('0x50')]||(_0x4b286d['attrs']&&_0x4b286d[_0xd4c9('0x42')][0x4]?_0x4b286d[_0xd4c9('0x42')][0x4][_0xd4c9('0x46')]:undefined)||_0xd4c9('0x51')},{'name':'attrEmailAccounts','value':_0x4b286d[_0xd4c9('0x52')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x5]?_0x4b286d[_0xd4c9('0x42')][0x5][_0xd4c9('0x46')]:undefined)||''},{'name':_0xd4c9('0x53'),'value':_0x4b286d[_0xd4c9('0x53')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d['attrs'][0x6]?_0x4b286d[_0xd4c9('0x42')][0x6][_0xd4c9('0x46')]:undefined)||''},{'name':_0xd4c9('0x54'),'value':_0x4b286d[_0xd4c9('0x54')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x7]?_0x4b286d[_0xd4c9('0x42')][0x7][_0xd4c9('0x46')]:undefined)||''},{'name':_0xd4c9('0x55'),'value':_0x4b286d[_0xd4c9('0x55')]||(_0x4b286d['attrs']&&_0x4b286d[_0xd4c9('0x42')][0x8]?_0x4b286d[_0xd4c9('0x42')][0x8][_0xd4c9('0x46')]:undefined)||''},{'name':_0xd4c9('0x56'),'value':_0x4b286d[_0xd4c9('0x56')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x9]?_0x4b286d['attrs'][0x9][_0xd4c9('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4b286d[_0xd4c9('0x57')]||(_0x4b286d['attrs']&&_0x4b286d[_0xd4c9('0x42')][0xa]?_0x4b286d[_0xd4c9('0x42')][0xa][_0xd4c9('0x46')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x4b286d[_0xd4c9('0x5c')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d['attrs'][0x0]?_0x4b286d['attrs'][0x0]['type']:undefined)||null,'value':_0x4b286d[_0xd4c9('0x5d')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x0]?_0x4b286d[_0xd4c9('0x42')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4b286d[_0xd4c9('0x5e')]||(_0x4b286d[_0xd4c9('0x42')]&&_0x4b286d[_0xd4c9('0x42')][0x1]?_0x4b286d[_0xd4c9('0x42')][0x1][_0xd4c9('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x50fec6){logger[_0xd4c9('0x2a')](_0xd4c9('0x5f'),JSON[_0xd4c9('0x60')](_0x50fec6));return[];}}exports[_0xd4c9('0x61')]=function(_0xd1a042,_0xd5d3e8){if(_0xd1a042[_0xd4c9('0x62')]){_0xd1a042[_0xd4c9('0x62')][_0xd4c9('0x42')]=widgetAttributes(_0xd1a042[_0xd4c9('0x62')]);}return db['DashboardItem'][_0xd4c9('0x61')](_0xd1a042[_0xd4c9('0x62')],{})['then'](respondWithResult(_0xd5d3e8,0xc9))['catch'](handleError(_0xd5d3e8,null));};exports[_0xd4c9('0x27')]=function(_0x283c17,_0x24efee){if(_0x283c17[_0xd4c9('0x62')]['id']){delete _0x283c17[_0xd4c9('0x62')]['id'];}_0x283c17['body'][_0xd4c9('0x42')]=widgetAttributes(_0x283c17[_0xd4c9('0x62')]);return db['DashboardItem'][_0xd4c9('0x3e')]({'where':{'id':_0x283c17['params']['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x24efee,null))[_0xd4c9('0x28')](saveUpdates(_0x283c17[_0xd4c9('0x62')],null))[_0xd4c9('0x28')](respondWithResult(_0x24efee,null))[_0xd4c9('0x3c')](handleError(_0x24efee,null));}; \ No newline at end of file +var _0xcf98=['length','includeAll','include','merge','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','error','stack','name','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields'];(function(_0x18a71e,_0x1887ec){var _0x6a2ef7=function(_0x195001){while(--_0x195001){_0x18a71e['push'](_0x18a71e['shift']());}};_0x6a2ef7(++_0x1887ec);}(_0xcf98,0x8d));var _0x8cf9=function(_0x48cd80,_0x1e9454){_0x48cd80=_0x48cd80-0x0;var _0x57bcc0=_0xcf98[_0x48cd80];return _0x57bcc0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cf9('0x0'));var zipdir=require(_0x8cf9('0x1'));var jsonpatch=require(_0x8cf9('0x2'));var rp=require(_0x8cf9('0x3'));var moment=require(_0x8cf9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8cf9('0x5'));var path=require(_0x8cf9('0x6'));var sox=require(_0x8cf9('0x7'));var csv=require(_0x8cf9('0x8'));var ejs=require(_0x8cf9('0x9'));var fs=require('fs');var fs_extra=require(_0x8cf9('0xa'));var _=require(_0x8cf9('0xb'));var squel=require(_0x8cf9('0xc'));var crypto=require(_0x8cf9('0xd'));var jsforce=require(_0x8cf9('0xe'));var deskjs=require(_0x8cf9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8cf9('0x10'));var Papa=require(_0x8cf9('0x11'));var Redis=require('ioredis');var authService=require(_0x8cf9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8cf9('0x13'));var hardwareService=require(_0x8cf9('0x14'));var logger=require(_0x8cf9('0x15'))(_0x8cf9('0x16'));var utils=require(_0x8cf9('0x17'));var config=require(_0x8cf9('0x18'));var licenseUtil=require(_0x8cf9('0x19'));var db=require('../../mysqldb')['db'];config[_0x8cf9('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8cf9('0x1b'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x8cf9('0x1c')](socket);function respondWithStatusCode(_0x133b59,_0xd1bc74){_0xd1bc74=_0xd1bc74||0xcc;return function(_0x5ed6aa){if(_0x5ed6aa){return _0x133b59[_0x8cf9('0x1d')](_0xd1bc74);}return _0x133b59[_0x8cf9('0x1e')](_0xd1bc74)['end']();};}function respondWithResult(_0x349187,_0xc13eeb){_0xc13eeb=_0xc13eeb||0xc8;return function(_0x2417d8){if(_0x2417d8){return _0x349187[_0x8cf9('0x1e')](_0xc13eeb)[_0x8cf9('0x1f')](_0x2417d8);}};}function respondWithFilteredResult(_0x160b9f,_0x21f397){return function(_0x21efd3){if(_0x21efd3){var _0x309866=typeof _0x21f397[_0x8cf9('0x20')]===_0x8cf9('0x21')&&typeof _0x21f397[_0x8cf9('0x22')]===_0x8cf9('0x21');var _0x44e6d7=_0x21efd3[_0x8cf9('0x23')];var _0x3a6a21=_0x309866?0x0:_0x21f397['offset'];var _0x4ee404=_0x309866?_0x21efd3[_0x8cf9('0x23')]:_0x21f397['offset']+_0x21f397[_0x8cf9('0x22')];var _0x44e646;if(_0x4ee404>=_0x44e6d7){_0x4ee404=_0x44e6d7;_0x44e646=0xc8;}else{_0x44e646=0xce;}_0x160b9f[_0x8cf9('0x1e')](_0x44e646);return _0x160b9f[_0x8cf9('0x24')](_0x8cf9('0x25'),_0x3a6a21+'-'+_0x4ee404+'/'+_0x44e6d7)[_0x8cf9('0x1f')](_0x21efd3);}return null;};}function patchUpdates(_0x207f32){return function(_0x57553f){try{jsonpatch['apply'](_0x57553f,_0x207f32,!![]);}catch(_0x17b252){return BPromise['reject'](_0x17b252);}return _0x57553f['save']();};}function saveUpdates(_0x29801b,_0x166fe2){return function(_0x49e94a){if(_0x49e94a){return _0x49e94a[_0x8cf9('0x26')](_0x29801b)['then'](function(_0x4d07fa){return _0x4d07fa;});}return null;};}function removeEntity(_0x1f3d2c,_0x122295){return function(_0x4fd970){if(_0x4fd970){return _0x4fd970[_0x8cf9('0x27')]()[_0x8cf9('0x28')](function(){_0x1f3d2c[_0x8cf9('0x1e')](0xcc)[_0x8cf9('0x29')]();});}};}function handleEntityNotFound(_0x475566,_0x500b8e){return function(_0x53b580){if(!_0x53b580){_0x475566[_0x8cf9('0x1d')](0x194);}return _0x53b580;};}function handleError(_0x30f245,_0x2a4466){_0x2a4466=_0x2a4466||0x1f4;return function(_0x9922a2){logger[_0x8cf9('0x2a')](_0x9922a2[_0x8cf9('0x2b')]);if(_0x9922a2[_0x8cf9('0x2c')]){delete _0x9922a2[_0x8cf9('0x2c')];}_0x30f245[_0x8cf9('0x1e')](_0x2a4466)['send'](_0x9922a2);};}exports['show']=function(_0x5ea5de,_0x5123d5){var _0x2716c8={'raw':![],'where':{'id':_0x5ea5de[_0x8cf9('0x2d')]['id']}},_0x2c2e6e={};_0x2c2e6e[_0x8cf9('0x2e')]=_['keys'](db[_0x8cf9('0x2f')][_0x8cf9('0x30')]);_0x2c2e6e[_0x8cf9('0x31')]=_[_0x8cf9('0x32')](_0x5ea5de[_0x8cf9('0x31')]);_0x2c2e6e[_0x8cf9('0x33')]=_[_0x8cf9('0x34')](_0x2c2e6e['model'],_0x2c2e6e['query']);_0x2716c8[_0x8cf9('0x35')]=_[_0x8cf9('0x34')](_0x2c2e6e[_0x8cf9('0x2e')],qs[_0x8cf9('0x36')](_0x5ea5de[_0x8cf9('0x31')][_0x8cf9('0x36')]));_0x2716c8['attributes']=_0x2716c8[_0x8cf9('0x35')][_0x8cf9('0x37')]?_0x2716c8[_0x8cf9('0x35')]:_0x2c2e6e[_0x8cf9('0x2e')];if(_0x5ea5de[_0x8cf9('0x31')][_0x8cf9('0x38')]){_0x2716c8[_0x8cf9('0x39')]=[{'all':!![]}];}_0x2716c8=_[_0x8cf9('0x3a')]({},_0x2716c8,_0x5ea5de['options']);return db[_0x8cf9('0x2f')][_0x8cf9('0x3b')](_0x2716c8)[_0x8cf9('0x28')](handleEntityNotFound(_0x5123d5,null))['then'](respondWithResult(_0x5123d5,null))[_0x8cf9('0x3c')](handleError(_0x5123d5,null));};exports['destroy']=function(_0x6cc09b,_0x5a8c30){return db[_0x8cf9('0x2f')]['find']({'where':{'id':_0x6cc09b[_0x8cf9('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5a8c30,null))[_0x8cf9('0x28')](removeEntity(_0x5a8c30,null))['catch'](handleError(_0x5a8c30,null));};function widgetAttributes(_0x4f318c){try{switch(_0x4f318c[_0x8cf9('0x3d')]){case'iframe':return[{'name':_0x8cf9('0x3e'),'value':_0x4f318c['attrUrl']||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c['attrs'][0x0]?_0x4f318c[_0x8cf9('0x3f')][0x0][_0x8cf9('0x40')]:undefined)||_0x8cf9('0x41')}];case _0x8cf9('0x42'):return[{'name':_0x8cf9('0x43'),'value':_0x4f318c[_0x8cf9('0x43')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x0]?_0x4f318c[_0x8cf9('0x3f')][0x0][_0x8cf9('0x40')]:undefined)||''}];case _0x8cf9('0x44'):return[{'name':_0x8cf9('0x45'),'value':_0x4f318c[_0x8cf9('0x45')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c['attrs'][0x0]?_0x4f318c[_0x8cf9('0x3f')][0x0][_0x8cf9('0x40')]:undefined)||_0x8cf9('0x46')},{'name':_0x8cf9('0x47'),'value':_0x4f318c[_0x8cf9('0x47')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x1]?_0x4f318c['attrs'][0x1][_0x8cf9('0x40')]:undefined)||_0x8cf9('0x48')},{'name':_0x8cf9('0x49'),'value':_0x4f318c[_0x8cf9('0x49')]||(_0x4f318c['attrs']&&_0x4f318c[_0x8cf9('0x3f')][0x2]?_0x4f318c[_0x8cf9('0x3f')][0x2][_0x8cf9('0x40')]:undefined)||0xc}];case _0x8cf9('0x4a'):return[{'name':_0x8cf9('0x4b'),'value':_0x4f318c[_0x8cf9('0x4b')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c['attrs'][0x0]?_0x4f318c[_0x8cf9('0x3f')][0x0][_0x8cf9('0x40')]:undefined)||_0x8cf9('0x4c')},{'name':_0x8cf9('0x4d'),'value':_0x4f318c['attrVoiceQueues']||(_0x4f318c['attrs']&&_0x4f318c[_0x8cf9('0x3f')][0x1]?_0x4f318c[_0x8cf9('0x3f')][0x1]['value']:undefined)||[]},{'name':_0x8cf9('0x49'),'value':_0x4f318c[_0x8cf9('0x49')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x2]?_0x4f318c[_0x8cf9('0x3f')][0x2][_0x8cf9('0x40')]:undefined)||0x14},{'name':'attrChannel','value':_0x4f318c[_0x8cf9('0x4e')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c['attrs'][0x3]?_0x4f318c[_0x8cf9('0x3f')][0x3][_0x8cf9('0x40')]:undefined)||_0x8cf9('0x4f')},{'name':'attrEmailAccounts','value':_0x4f318c[_0x8cf9('0x50')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c['attrs'][0x4]?_0x4f318c[_0x8cf9('0x3f')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x4f318c[_0x8cf9('0x51')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x5]?_0x4f318c[_0x8cf9('0x3f')][0x5][_0x8cf9('0x40')]:undefined)||''},{'name':_0x8cf9('0x52'),'value':_0x4f318c[_0x8cf9('0x52')]||(_0x4f318c['attrs']&&_0x4f318c[_0x8cf9('0x3f')][0x6]?_0x4f318c[_0x8cf9('0x3f')][0x6][_0x8cf9('0x40')]:undefined)||''},{'name':_0x8cf9('0x53'),'value':_0x4f318c['attrOpenchannelAccounts']||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x7]?_0x4f318c[_0x8cf9('0x3f')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4f318c['attrWhatsappAccounts']||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x8]?_0x4f318c['attrs'][0x8][_0x8cf9('0x40')]:undefined)||''},{'name':_0x8cf9('0x54'),'value':_0x4f318c[_0x8cf9('0x54')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x9]?_0x4f318c['attrs'][0x9][_0x8cf9('0x40')]:undefined)||''}];case _0x8cf9('0x55'):case _0x8cf9('0x56'):return[{'name':_0x8cf9('0x57'),'value':_0x4f318c[_0x8cf9('0x57')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x0]?_0x4f318c['attrs'][0x0][_0x8cf9('0x40')]:undefined)||_0x8cf9('0x4c')},{'name':_0x8cf9('0x58'),'value':_0x4f318c[_0x8cf9('0x58')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x1]?_0x4f318c[_0x8cf9('0x3f')][0x1][_0x8cf9('0x40')]:undefined)||null},{'name':_0x8cf9('0x59'),'value':_0x4f318c[_0x8cf9('0x59')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x2]?_0x4f318c[_0x8cf9('0x3f')][0x2]['value']:undefined)||null},{'name':_0x8cf9('0x4d'),'value':_0x4f318c[_0x8cf9('0x4d')]||(_0x4f318c['attrs']&&_0x4f318c[_0x8cf9('0x3f')][0x3]?_0x4f318c[_0x8cf9('0x3f')][0x3][_0x8cf9('0x40')]:undefined)||[]},{'name':_0x8cf9('0x4e'),'value':_0x4f318c[_0x8cf9('0x4e')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x4]?_0x4f318c[_0x8cf9('0x3f')][0x4][_0x8cf9('0x40')]:undefined)||_0x8cf9('0x4f')},{'name':_0x8cf9('0x50'),'value':_0x4f318c['attrEmailAccounts']||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c['attrs'][0x5]?_0x4f318c['attrs'][0x5][_0x8cf9('0x40')]:undefined)||''},{'name':_0x8cf9('0x51'),'value':_0x4f318c['attrFaxAccounts']||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x6]?_0x4f318c['attrs'][0x6][_0x8cf9('0x40')]:undefined)||''},{'name':_0x8cf9('0x52'),'value':_0x4f318c[_0x8cf9('0x52')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x7]?_0x4f318c[_0x8cf9('0x3f')][0x7]['value']:undefined)||''},{'name':_0x8cf9('0x53'),'value':_0x4f318c['attrOpenchannelAccounts']||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c['attrs'][0x8]?_0x4f318c['attrs'][0x8][_0x8cf9('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4f318c[_0x8cf9('0x5a')]||(_0x4f318c['attrs']&&_0x4f318c[_0x8cf9('0x3f')][0x9]?_0x4f318c[_0x8cf9('0x3f')][0x9]['value']:undefined)||''},{'name':_0x8cf9('0x54'),'value':_0x4f318c[_0x8cf9('0x54')]||(_0x4f318c['attrs']&&_0x4f318c['attrs'][0xa]?_0x4f318c[_0x8cf9('0x3f')][0xa][_0x8cf9('0x40')]:undefined)||''}];case'web-report':return[{'name':_0x8cf9('0x5b'),'type':_0x4f318c[_0x8cf9('0x5c')]||(_0x4f318c['attrs']&&_0x4f318c[_0x8cf9('0x3f')][0x0]?_0x4f318c[_0x8cf9('0x3f')][0x0]['type']:undefined)||null,'value':_0x4f318c['attrReport']||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x0]?_0x4f318c[_0x8cf9('0x3f')][0x0][_0x8cf9('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x4f318c[_0x8cf9('0x5d')]||(_0x4f318c[_0x8cf9('0x3f')]&&_0x4f318c[_0x8cf9('0x3f')][0x1]?_0x4f318c['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x312e9f){logger['error'](_0x8cf9('0x5e'),JSON[_0x8cf9('0x5f')](_0x312e9f));return[];}}exports[_0x8cf9('0x60')]=function(_0x3c4aca,_0x4e03b6){if(_0x3c4aca['body']){_0x3c4aca[_0x8cf9('0x61')][_0x8cf9('0x3f')]=widgetAttributes(_0x3c4aca['body']);}return db['DashboardItem'][_0x8cf9('0x60')](_0x3c4aca[_0x8cf9('0x61')],{})[_0x8cf9('0x28')](respondWithResult(_0x4e03b6,0xc9))[_0x8cf9('0x3c')](handleError(_0x4e03b6,null));};exports[_0x8cf9('0x26')]=function(_0x399587,_0x3bac96){if(_0x399587['body']['id']){delete _0x399587['body']['id'];}_0x399587['body'][_0x8cf9('0x3f')]=widgetAttributes(_0x399587['body']);return db['DashboardItem']['find']({'where':{'id':_0x399587['params']['id']}})[_0x8cf9('0x28')](handleEntityNotFound(_0x3bac96,null))[_0x8cf9('0x28')](saveUpdates(_0x399587[_0x8cf9('0x61')],null))[_0x8cf9('0x28')](respondWithResult(_0x3bac96,null))['catch'](handleError(_0x3bac96,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f89d26f..7e82349 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 _0x1a38=['events','../../mysqldb','DashboardItem','remove','emit','hasOwnProperty','hook','exports'];(function(_0x44c708,_0x346e58){var _0x577296=function(_0x1d3af3){while(--_0x1d3af3){_0x44c708['push'](_0x44c708['shift']());}};_0x577296(++_0x346e58);}(_0x1a38,0xb0));var _0x81a3=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0x1a38[_0x4429e0];return _0x51a5b3;};'use strict';var EventEmitter=require(_0x81a3('0x0'));var DashboardItem=require(_0x81a3('0x1'))['db'][_0x81a3('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x81a3('0x3')};function emitEvent(_0x2402ba){return function(_0x2faf46,_0x28fd86,_0x33a486){DashboardItemEvents[_0x81a3('0x4')](_0x2402ba+':'+_0x2faf46['id'],_0x2faf46);DashboardItemEvents[_0x81a3('0x4')](_0x2402ba,_0x2faf46);_0x33a486(null);};}for(var e in events){if(events[_0x81a3('0x5')](e)){var event=events[e];DashboardItem[_0x81a3('0x6')](e,emitEvent(event));}}module[_0x81a3('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x52ba=['../../mysqldb','DashboardItem','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x3c409e,_0x5e028b){var _0x1a1fde=function(_0x2f6929){while(--_0x2f6929){_0x3c409e['push'](_0x3c409e['shift']());}};_0x1a1fde(++_0x5e028b);}(_0x52ba,0x14f));var _0xa52b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x52ba[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xa52b('0x0'));var DashboardItem=require(_0xa52b('0x1'))['db'][_0xa52b('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa52b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa52b('0x4')};function emitEvent(_0x40a8b2){return function(_0x4ee12b,_0x57c938,_0xf76ca4){DashboardItemEvents[_0xa52b('0x5')](_0x40a8b2+':'+_0x4ee12b['id'],_0x4ee12b);DashboardItemEvents[_0xa52b('0x5')](_0x40a8b2,_0x4ee12b);_0xf76ca4(null);};}for(var e in events){if(events[_0xa52b('0x6')](e)){var event=events[e];DashboardItem[_0xa52b('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 2650cf5..6f00d75 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 _0xaba8=['../../config/logger','api','moment','request-promise','path','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xaba8,0x1af));var _0x8aba=function(_0x5a88b1,_0x501071){_0x5a88b1=_0x5a88b1-0x0;var _0x1f8615=_0xaba8[_0x5a88b1];return _0x1f8615;};'use strict';var _=require(_0x8aba('0x0'));var util=require('util');var logger=require(_0x8aba('0x1'))(_0x8aba('0x2'));var moment=require(_0x8aba('0x3'));var BPromise=require('bluebird');var rp=require(_0x8aba('0x4'));var fs=require('fs');var path=require(_0x8aba('0x5'));var rimraf=require(_0x8aba('0x6'));var config=require('../../config/environment');var attributes=require(_0x8aba('0x7'));module[_0x8aba('0x8')]=function(_0x421cbf,_0x896c12){return _0x421cbf[_0x8aba('0x9')](_0x8aba('0xa'),attributes,{'tableName':_0x8aba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cdb=['exports','DashboardItem','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x8cdb,0x138));var _0xb8cd=function(_0x423d83,_0x4087a9){_0x423d83=_0x423d83-0x0;var _0x43faaa=_0x8cdb[_0x423d83];return _0x43faaa;};'use strict';var _=require(_0xb8cd('0x0'));var util=require('util');var logger=require(_0xb8cd('0x1'))(_0xb8cd('0x2'));var moment=require(_0xb8cd('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8cd('0x4'));var fs=require('fs');var path=require(_0xb8cd('0x5'));var rimraf=require(_0xb8cd('0x6'));var config=require(_0xb8cd('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xb8cd('0x8')]=function(_0x572605,_0x17d9f2){return _0x572605['define'](_0xb8cd('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 2745fdf..136cd02 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 _0xc32a=['redis','defaults','localhost','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xc14e9b,_0x5c3047){var _0x48f298=function(_0x3ddc68){while(--_0x3ddc68){_0xc14e9b['push'](_0xc14e9b['shift']());}};_0x48f298(++_0x5c3047);}(_0xc32a,0xbf));var _0xac32=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0xc32a[_0x528575];return _0x3063b7;};'use strict';var _=require('lodash');var util=require(_0xac32('0x0'));var moment=require(_0xac32('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac32('0x2'))['db'];var utils=require(_0xac32('0x3'));var logger=require(_0xac32('0x4'))(_0xac32('0x5'));var config=require(_0xac32('0x6'));var jayson=require(_0xac32('0x7'));var client=jayson['client'][_0xac32('0x8')]({'port':0x232a});config[_0xac32('0x9')]=_[_0xac32('0xa')](config[_0xac32('0x9')],{'host':_0xac32('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac32('0x9')]));require('./dashboardItem.socket')[_0xac32('0xc')](socket);function respondWithRpcPromise(_0x259cdd,_0xbb4bdc,_0x20c1c5){return new BPromise(function(_0xdd84d8,_0x568281){return client[_0xac32('0xd')](_0x259cdd,_0x20c1c5)[_0xac32('0xe')](function(_0x58419f){logger[_0xac32('0xf')](_0xac32('0x10'),_0xbb4bdc,_0xac32('0x11'));logger[_0xac32('0x12')](_0xac32('0x13'),_0xbb4bdc,_0xac32('0x11'),JSON['stringify'](_0x58419f));if(_0x58419f[_0xac32('0x14')]){if(_0x58419f[_0xac32('0x14')][_0xac32('0x15')]===0x1f4){logger['error'](_0xac32('0x10'),_0xbb4bdc,_0x58419f[_0xac32('0x14')][_0xac32('0x16')]);return _0x568281(_0x58419f[_0xac32('0x14')][_0xac32('0x16')]);}logger[_0xac32('0x14')](_0xac32('0x10'),_0xbb4bdc,_0x58419f[_0xac32('0x14')][_0xac32('0x16')]);return _0xdd84d8(_0x58419f[_0xac32('0x14')]['message']);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0xbb4bdc,_0xac32('0x11'));_0xdd84d8(_0x58419f[_0xac32('0x17')]['message']);}})[_0xac32('0x18')](function(_0x101aa0){logger[_0xac32('0x14')]('DashboardItem,\x20%s,\x20%s',_0xbb4bdc,_0x101aa0);_0x568281(_0x101aa0);});});} \ No newline at end of file +var _0xb566=['./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0xb566,0x141));var _0x6b56=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xb566[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0x6b56('0x0'));var util=require('util');var moment=require(_0x6b56('0x1'));var BPromise=require(_0x6b56('0x2'));var rs=require(_0x6b56('0x3'));var fs=require('fs');var Redis=require(_0x6b56('0x4'));var db=require(_0x6b56('0x5'))['db'];var utils=require(_0x6b56('0x6'));var logger=require(_0x6b56('0x7'))('rpc');var config=require(_0x6b56('0x8'));var jayson=require(_0x6b56('0x9'));var client=jayson[_0x6b56('0xa')][_0x6b56('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x6b56('0xc'),'port':0x18eb});var socket=require(_0x6b56('0xd'))(new Redis(config[_0x6b56('0xe')]));require(_0x6b56('0xf'))[_0x6b56('0x10')](socket);function respondWithRpcPromise(_0x1fa0f4,_0x2ddf3f,_0x3ae73a){return new BPromise(function(_0x34bf99,_0xfc6af0){return client[_0x6b56('0x11')](_0x1fa0f4,_0x3ae73a)[_0x6b56('0x12')](function(_0x512577){logger['info'](_0x6b56('0x13'),_0x2ddf3f,'request\x20sent');logger[_0x6b56('0x14')](_0x6b56('0x15'),_0x2ddf3f,_0x6b56('0x16'),JSON[_0x6b56('0x17')](_0x512577));if(_0x512577['error']){if(_0x512577[_0x6b56('0x18')][_0x6b56('0x19')]===0x1f4){logger[_0x6b56('0x18')](_0x6b56('0x13'),_0x2ddf3f,_0x512577[_0x6b56('0x18')][_0x6b56('0x1a')]);return _0xfc6af0(_0x512577[_0x6b56('0x18')][_0x6b56('0x1a')]);}logger[_0x6b56('0x18')](_0x6b56('0x13'),_0x2ddf3f,_0x512577[_0x6b56('0x18')][_0x6b56('0x1a')]);return _0x34bf99(_0x512577[_0x6b56('0x18')][_0x6b56('0x1a')]);}else{logger['info'](_0x6b56('0x13'),_0x2ddf3f,_0x6b56('0x16'));_0x34bf99(_0x512577[_0x6b56('0x1b')]['message']);}})['catch'](function(_0x38d312){logger[_0x6b56('0x18')](_0x6b56('0x13'),_0x2ddf3f,_0x38d312);_0xfc6af0(_0x38d312);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3474bcc..29aa4c2 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 _0xa396=['remove','register','./dashboardItem.events'];(function(_0x5b9ebc,_0x296ad2){var _0x18f65c=function(_0x3cb6a4){while(--_0x3cb6a4){_0x5b9ebc['push'](_0x5b9ebc['shift']());}};_0x18f65c(++_0x296ad2);}(_0xa396,0xd4));var _0x6a39=function(_0x289fbe,_0x148173){_0x289fbe=_0x289fbe-0x0;var _0x34eb3e=_0xa396[_0x289fbe];return _0x34eb3e;};'use strict';var DashboardItemEvents=require(_0x6a39('0x0'));var events=['save',_0x6a39('0x1'),'update'];function createListener(_0x3d7999,_0x47c607){return function(_0x4b2f06){_0x47c607['emit'](_0x3d7999,_0x4b2f06);};}function removeListener(_0x525e34,_0x3475a4){return function(){DashboardItemEvents['removeListener'](_0x525e34,_0x3475a4);};}exports[_0x6a39('0x2')]=function(_0x406c43){for(var _0x37982d=0x0,_0x5f2492=events['length'];_0x37982d<_0x5f2492;_0x37982d++){var _0x361b8e=events[_0x37982d];var _0x393603=createListener('dashboardItem:'+_0x361b8e,_0x406c43);DashboardItemEvents['on'](_0x361b8e,_0x393603);}}; \ No newline at end of file +var _0xf2e8=['removeListener','register','dashboardItem:','remove','emit'];(function(_0xc6cd9,_0x24938f){var _0x39ca4b=function(_0x454857){while(--_0x454857){_0xc6cd9['push'](_0xc6cd9['shift']());}};_0x39ca4b(++_0x24938f);}(_0xf2e8,0x12a));var _0x8f2e=function(_0x58ac9a,_0x217a6d){_0x58ac9a=_0x58ac9a-0x0;var _0x18e1fd=_0xf2e8[_0x58ac9a];return _0x18e1fd;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x8f2e('0x0'),'update'];function createListener(_0x369071,_0x5975ad){return function(_0x245bf1){_0x5975ad[_0x8f2e('0x1')](_0x369071,_0x245bf1);};}function removeListener(_0x307478,_0x29ca73){return function(){DashboardItemEvents[_0x8f2e('0x2')](_0x307478,_0x29ca73);};}exports[_0x8f2e('0x3')]=function(_0x1ea47e){for(var _0x737233=0x0,_0x1720e5=events['length'];_0x737233<_0x1720e5;_0x737233++){var _0x40ee2a=events[_0x737233];var _0x959b7c=createListener(_0x8f2e('0x4')+_0x40ee2a,_0x1ea47e);DashboardItemEvents['on'](_0x40ee2a,_0x959b7c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 682737e..4841453 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 _0x3313=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','post','isAuthenticated','create','update','delete','destroy','multer'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x3313,0x167));var _0x3331=function(_0x391d41,_0x108917){_0x391d41=_0x391d41-0x0;var _0x225185=_0x3313[_0x391d41];return _0x225185;};'use strict';var multer=require(_0x3331('0x0'));var util=require(_0x3331('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3331('0x2')]();var fs_extra=require(_0x3331('0x3'));var auth=require(_0x3331('0x4'));var interaction=require(_0x3331('0x5'));var config=require(_0x3331('0x6'));var controller=require(_0x3331('0x7'));router['get'](_0x3331('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x3331('0x9')]('/',auth[_0x3331('0xa')](),controller[_0x3331('0xb')]);router['put'](_0x3331('0x8'),auth['isAuthenticated'](),controller[_0x3331('0xc')]);router[_0x3331('0xd')](_0x3331('0x8'),auth[_0x3331('0xa')](),controller[_0x3331('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3975=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x3975,0xe4));var _0x5397=function(_0x3ba6a0,_0xc81531){_0x3ba6a0=_0x3ba6a0-0x0;var _0x3faa26=_0x3975[_0x3ba6a0];return _0x3faa26;};'use strict';var multer=require(_0x5397('0x0'));var util=require(_0x5397('0x1'));var path=require(_0x5397('0x2'));var timeout=require('connect-timeout');var express=require(_0x5397('0x3'));var router=express[_0x5397('0x4')]();var fs_extra=require(_0x5397('0x5'));var auth=require(_0x5397('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5397('0x7'));var controller=require(_0x5397('0x8'));router['get'](_0x5397('0x9'),auth[_0x5397('0xa')](),controller['show']);router[_0x5397('0xb')]('/',auth[_0x5397('0xa')](),controller['create']);router[_0x5397('0xc')](_0x5397('0x9'),auth['isAuthenticated'](),controller[_0x5397('0xd')]);router[_0x5397('0xe')](_0x5397('0x9'),auth[_0x5397('0xa')](),controller[_0x5397('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 714c41e..eb831fa 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 _0xfae3=['sequelize','exports','STRING','ENUM','second','third','first'];(function(_0x20f5ea,_0x5146ef){var _0x3dee4f=function(_0x3c418f){while(--_0x3c418f){_0x20f5ea['push'](_0x20f5ea['shift']());}};_0x3dee4f(++_0x5146ef);}(_0xfae3,0x111));var _0x3fae=function(_0x5c879e,_0xe58074){_0x5c879e=_0x5c879e-0x0;var _0x30942b=_0xfae3[_0x5c879e];return _0x30942b;};'use strict';var Sequelize=require(_0x3fae('0x0'));module[_0x3fae('0x1')]={'name':{'type':Sequelize[_0x3fae('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3fae('0x3')]('first',_0x3fae('0x4'),_0x3fae('0x5')),'allowNull':![],'defaultValue':_0x3fae('0x6')},'description':{'type':Sequelize[_0x3fae('0x2')]}}; \ No newline at end of file +var _0x6334=['STRING','first','second','third','sequelize','exports'];(function(_0x5d9353,_0xaeaaba){var _0x13c550=function(_0x2c287a){while(--_0x2c287a){_0x5d9353['push'](_0x5d9353['shift']());}};_0x13c550(++_0xaeaaba);}(_0x6334,0x190));var _0x4633=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x6334[_0x3e531a];return _0x3c2574;};'use strict';var Sequelize=require(_0x4633('0x0'));module[_0x4633('0x1')]={'name':{'type':Sequelize[_0x4633('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x4633('0x3'),_0x4633('0x4'),_0x4633('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x4633('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 0d90ba0..01969fb 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 _0x5f41=['apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','includeAll','findAll','rows','params','merge','options','find','catch','create','body','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x49d699,_0x315afe){var _0x19cb80=function(_0x324433){while(--_0x324433){_0x49d699['push'](_0x49d699['shift']());}};_0x19cb80(++_0x315afe);}(_0x5f41,0x14c));var _0x15f4=function(_0x496941,_0x3b7348){_0x496941=_0x496941-0x0;var _0xe5d4fe=_0x5f41[_0x496941];return _0xe5d4fe;};'use strict';var emlformat=require(_0x15f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15f4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x15f4('0x3'));var csv=require(_0x15f4('0x4'));var ejs=require(_0x15f4('0x5'));var fs=require('fs');var fs_extra=require(_0x15f4('0x6'));var _=require('lodash');var squel=require(_0x15f4('0x7'));var crypto=require(_0x15f4('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x15f4('0x4'));var querystring=require(_0x15f4('0x9'));var Papa=require(_0x15f4('0xa'));var Redis=require(_0x15f4('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x15f4('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15f4('0xd'));var logger=require(_0x15f4('0xe'))(_0x15f4('0xf'));var utils=require(_0x15f4('0x10'));var config=require(_0x15f4('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52d5d1,_0x3a76e0){_0x3a76e0=_0x3a76e0||0xcc;return function(_0x55a176){if(_0x55a176){return _0x52d5d1[_0x15f4('0x12')](_0x3a76e0);}return _0x52d5d1[_0x15f4('0x13')](_0x3a76e0)[_0x15f4('0x14')]();};}function respondWithResult(_0x2eb78a,_0x3bd035){_0x3bd035=_0x3bd035||0xc8;return function(_0x34e686){if(_0x34e686){return _0x2eb78a[_0x15f4('0x13')](_0x3bd035)[_0x15f4('0x15')](_0x34e686);}};}function respondWithFilteredResult(_0x22e130,_0x48a599){return function(_0x25a178){if(_0x25a178){var _0xb0c380=typeof _0x48a599[_0x15f4('0x16')]===_0x15f4('0x17')&&typeof _0x48a599[_0x15f4('0x18')]===_0x15f4('0x17');var _0x168b3d=_0x25a178[_0x15f4('0x19')];var _0x1fac43=_0xb0c380?0x0:_0x48a599[_0x15f4('0x16')];var _0x230547=_0xb0c380?_0x25a178['count']:_0x48a599['offset']+_0x48a599[_0x15f4('0x18')];var _0x4c4cf7;if(_0x230547>=_0x168b3d){_0x230547=_0x168b3d;_0x4c4cf7=0xc8;}else{_0x4c4cf7=0xce;}_0x22e130[_0x15f4('0x13')](_0x4c4cf7);return _0x22e130[_0x15f4('0x1a')](_0x15f4('0x1b'),_0x1fac43+'-'+_0x230547+'/'+_0x168b3d)[_0x15f4('0x15')](_0x25a178);}return null;};}function patchUpdates(_0x51f9f5){return function(_0x2d1b64){try{jsonpatch[_0x15f4('0x1c')](_0x2d1b64,_0x51f9f5,!![]);}catch(_0x12094b){return BPromise[_0x15f4('0x1d')](_0x12094b);}return _0x2d1b64[_0x15f4('0x1e')]();};}function saveUpdates(_0x5032c4,_0x5f35ea){return function(_0x29f7b4){if(_0x29f7b4){return _0x29f7b4[_0x15f4('0x1f')](_0x5032c4)[_0x15f4('0x20')](function(_0x63818a){return _0x63818a;});}return null;};}function removeEntity(_0x2a2eeb,_0x3b9f91){return function(_0x53b390){if(_0x53b390){return _0x53b390[_0x15f4('0x21')]()['then'](function(){var _0x2946c6=_0x53b390[_0x15f4('0x22')]({'plain':!![]});var _0x4a4750=_0x15f4('0x23');return db[_0x15f4('0x24')][_0x15f4('0x21')]({'where':{'type':_0x4a4750,'resourceId':_0x2946c6['id']}})[_0x15f4('0x20')](function(){return _0x53b390;});})[_0x15f4('0x20')](function(){_0x2a2eeb[_0x15f4('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x426534,_0x5086af){return function(_0x50c255){if(!_0x50c255){_0x426534[_0x15f4('0x12')](0x194);}return _0x50c255;};}function handleError(_0x1f7dab,_0x8e3592){_0x8e3592=_0x8e3592||0x1f4;return function(_0x464166){logger[_0x15f4('0x25')](_0x464166[_0x15f4('0x26')]);if(_0x464166['name']){delete _0x464166[_0x15f4('0x27')];}_0x1f7dab[_0x15f4('0x13')](_0x8e3592)[_0x15f4('0x28')](_0x464166);};}exports[_0x15f4('0x29')]=function(_0x33d430,_0x151594){var _0x26a19d={},_0x448601={},_0x4bdace={'count':0x0,'rows':[]};var _0x15888a=_[_0x15f4('0x2a')](db[_0x15f4('0x2b')][_0x15f4('0x2c')],function(_0x3b0ea6){return{'name':_0x3b0ea6[_0x15f4('0x2d')],'type':_0x3b0ea6['type'][_0x15f4('0x2e')]};});_0x448601[_0x15f4('0x2f')]=_[_0x15f4('0x2a')](_0x15888a,_0x15f4('0x27'));_0x448601[_0x15f4('0x30')]=_[_0x15f4('0x31')](_0x33d430[_0x15f4('0x30')]);_0x448601[_0x15f4('0x32')]=_[_0x15f4('0x33')](_0x448601[_0x15f4('0x2f')],_0x448601['query']);_0x26a19d[_0x15f4('0x34')]=_[_0x15f4('0x33')](_0x448601[_0x15f4('0x2f')],qs[_0x15f4('0x35')](_0x33d430[_0x15f4('0x30')][_0x15f4('0x35')]));_0x26a19d[_0x15f4('0x34')]=_0x26a19d['attributes'][_0x15f4('0x36')]?_0x26a19d[_0x15f4('0x34')]:_0x448601['model'];if(!_0x33d430[_0x15f4('0x30')]['hasOwnProperty'](_0x15f4('0x37'))){_0x26a19d[_0x15f4('0x18')]=qs['limit'](_0x33d430[_0x15f4('0x30')][_0x15f4('0x18')]);_0x26a19d[_0x15f4('0x16')]=qs[_0x15f4('0x16')](_0x33d430['query']['offset']);}_0x26a19d['order']=qs[_0x15f4('0x38')](_0x33d430[_0x15f4('0x30')][_0x15f4('0x38')]);_0x26a19d[_0x15f4('0x39')]=qs[_0x15f4('0x32')](_['pick'](_0x33d430[_0x15f4('0x30')],_0x448601[_0x15f4('0x32')]),_0x15888a);if(_0x33d430[_0x15f4('0x30')][_0x15f4('0x3a')]){_0x26a19d[_0x15f4('0x39')]=_['merge'](_0x26a19d[_0x15f4('0x39')],{'$or':_[_0x15f4('0x2a')](_0x15888a,function(_0x2d75e4){if(_0x2d75e4['type']!=='VIRTUAL'){var _0x165671={};_0x165671[_0x2d75e4['name']]={'$like':'%'+_0x33d430[_0x15f4('0x30')][_0x15f4('0x3a')]+'%'};return _0x165671;}})});}_0x26a19d=_['merge']({},_0x26a19d,_0x33d430['options']);var _0x8cb58={'where':_0x26a19d[_0x15f4('0x39')]};return db['Disposition']['count'](_0x8cb58)[_0x15f4('0x20')](function(_0x4b67b9){_0x4bdace[_0x15f4('0x19')]=_0x4b67b9;if(_0x33d430[_0x15f4('0x30')][_0x15f4('0x3b')]){_0x26a19d['include']=[{'all':!![]}];}return db['Disposition'][_0x15f4('0x3c')](_0x26a19d);})[_0x15f4('0x20')](function(_0x1f8675){_0x4bdace[_0x15f4('0x3d')]=_0x1f8675;return _0x4bdace;})[_0x15f4('0x20')](respondWithFilteredResult(_0x151594,_0x26a19d))['catch'](handleError(_0x151594,null));};exports['show']=function(_0x499f37,_0x18fae3){var _0x5b408a={'raw':!![],'where':{'id':_0x499f37[_0x15f4('0x3e')]['id']}},_0x113d2d={};_0x113d2d['model']=_[_0x15f4('0x31')](db['Disposition']['rawAttributes']);_0x113d2d['query']=_[_0x15f4('0x31')](_0x499f37[_0x15f4('0x30')]);_0x113d2d[_0x15f4('0x32')]=_[_0x15f4('0x33')](_0x113d2d[_0x15f4('0x2f')],_0x113d2d[_0x15f4('0x30')]);_0x5b408a[_0x15f4('0x34')]=_[_0x15f4('0x33')](_0x113d2d[_0x15f4('0x2f')],qs[_0x15f4('0x35')](_0x499f37[_0x15f4('0x30')][_0x15f4('0x35')]));_0x5b408a['attributes']=_0x5b408a[_0x15f4('0x34')][_0x15f4('0x36')]?_0x5b408a[_0x15f4('0x34')]:_0x113d2d[_0x15f4('0x2f')];if(_0x499f37[_0x15f4('0x30')][_0x15f4('0x3b')]){_0x5b408a['include']=[{'all':!![]}];}_0x5b408a=_[_0x15f4('0x3f')]({},_0x5b408a,_0x499f37[_0x15f4('0x40')]);return db[_0x15f4('0x2b')][_0x15f4('0x41')](_0x5b408a)['then'](handleEntityNotFound(_0x18fae3,null))[_0x15f4('0x20')](respondWithResult(_0x18fae3,null))[_0x15f4('0x42')](handleError(_0x18fae3,null));};exports[_0x15f4('0x43')]=function(_0x357328,_0x36b520){return db[_0x15f4('0x2b')]['create'](_0x357328[_0x15f4('0x44')],{})['then'](function(_0x29b012){var _0x4cf472=_0x357328[_0x15f4('0x45')][_0x15f4('0x22')]({'plain':!![]});if(!_0x4cf472)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4cf472['role']===_0x15f4('0x45')){var _0x18fda6=_0x29b012[_0x15f4('0x22')]({'plain':!![]});var _0x310870=_0x15f4('0x23');return db['UserProfileSection'][_0x15f4('0x41')]({'where':{'name':_0x310870,'userProfileId':_0x4cf472[_0x15f4('0x46')]},'raw':!![]})['then'](function(_0x5984ed){if(_0x5984ed&&_0x5984ed['autoAssociation']===0x0){return db[_0x15f4('0x24')][_0x15f4('0x43')]({'name':_0x18fda6[_0x15f4('0x27')],'resourceId':_0x18fda6['id'],'type':_0x5984ed['name'],'sectionId':_0x5984ed['id']},{})['then'](function(){return _0x29b012;});}else{return _0x29b012;}})[_0x15f4('0x42')](function(_0x4fd405){logger[_0x15f4('0x25')](_0x15f4('0x47'),_0x4fd405);throw _0x4fd405;});}return _0x29b012;})[_0x15f4('0x20')](respondWithResult(_0x36b520,0xc9))[_0x15f4('0x42')](handleError(_0x36b520,null));};exports[_0x15f4('0x1f')]=function(_0xc0507c,_0x1152da){if(_0xc0507c['body']['id']){delete _0xc0507c[_0x15f4('0x44')]['id'];}return db[_0x15f4('0x2b')][_0x15f4('0x41')]({'where':{'id':_0xc0507c[_0x15f4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1152da,null))[_0x15f4('0x20')](saveUpdates(_0xc0507c['body'],null))[_0x15f4('0x20')](respondWithResult(_0x1152da,null))['catch'](handleError(_0x1152da,null));};exports[_0x15f4('0x21')]=function(_0x5e14c9,_0x54754b){return db[_0x15f4('0x2b')][_0x15f4('0x41')]({'where':{'id':_0x5e14c9['params']['id']}})[_0x15f4('0x20')](handleEntityNotFound(_0x54754b,null))[_0x15f4('0x20')](removeEntity(_0x54754b,null))[_0x15f4('0x42')](handleError(_0x54754b,null));}; \ No newline at end of file +var _0x46aa=['type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','Dispositions','UserProfileResource','error','name','index','Disposition','rawAttributes','fieldName'];(function(_0x15cf67,_0x4b7081){var _0x4545ff=function(_0x1c123f){while(--_0x1c123f){_0x15cf67['push'](_0x15cf67['shift']());}};_0x4545ff(++_0x4b7081);}(_0x46aa,0xcb));var _0xa46a=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46aa[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa46a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa46a('0x1'));var rp=require(_0xa46a('0x2'));var moment=require(_0xa46a('0x3'));var BPromise=require(_0xa46a('0x4'));var Mustache=require(_0xa46a('0x5'));var util=require(_0xa46a('0x6'));var path=require(_0xa46a('0x7'));var sox=require(_0xa46a('0x8'));var csv=require(_0xa46a('0x9'));var ejs=require(_0xa46a('0xa'));var fs=require('fs');var fs_extra=require(_0xa46a('0xb'));var _=require(_0xa46a('0xc'));var squel=require('squel');var crypto=require(_0xa46a('0xd'));var jsforce=require(_0xa46a('0xe'));var deskjs=require(_0xa46a('0xf'));var toCsv=require(_0xa46a('0x9'));var querystring=require('querystring');var Papa=require(_0xa46a('0x10'));var Redis=require(_0xa46a('0x11'));var authService=require(_0xa46a('0x12'));var qs=require(_0xa46a('0x13'));var as=require(_0xa46a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa46a('0x15'))(_0xa46a('0x16'));var utils=require('../../config/utils');var config=require(_0xa46a('0x17'));var licenseUtil=require(_0xa46a('0x18'));var db=require(_0xa46a('0x19'))['db'];function respondWithStatusCode(_0x3f9fe1,_0x2720c4){_0x2720c4=_0x2720c4||0xcc;return function(_0x2eda0b){if(_0x2eda0b){return _0x3f9fe1[_0xa46a('0x1a')](_0x2720c4);}return _0x3f9fe1[_0xa46a('0x1b')](_0x2720c4)[_0xa46a('0x1c')]();};}function respondWithResult(_0x35d9ef,_0x447e77){_0x447e77=_0x447e77||0xc8;return function(_0x29577b){if(_0x29577b){return _0x35d9ef[_0xa46a('0x1b')](_0x447e77)[_0xa46a('0x1d')](_0x29577b);}};}function respondWithFilteredResult(_0x43626e,_0x16bff4){return function(_0x362b80){if(_0x362b80){var _0x1bdd55=typeof _0x16bff4[_0xa46a('0x1e')]===_0xa46a('0x1f')&&typeof _0x16bff4[_0xa46a('0x20')]===_0xa46a('0x1f');var _0x4867c1=_0x362b80[_0xa46a('0x21')];var _0x4fdc40=_0x1bdd55?0x0:_0x16bff4[_0xa46a('0x1e')];var _0x529921=_0x1bdd55?_0x362b80[_0xa46a('0x21')]:_0x16bff4['offset']+_0x16bff4[_0xa46a('0x20')];var _0x56bd73;if(_0x529921>=_0x4867c1){_0x529921=_0x4867c1;_0x56bd73=0xc8;}else{_0x56bd73=0xce;}_0x43626e[_0xa46a('0x1b')](_0x56bd73);return _0x43626e[_0xa46a('0x22')]('Content-Range',_0x4fdc40+'-'+_0x529921+'/'+_0x4867c1)[_0xa46a('0x1d')](_0x362b80);}return null;};}function patchUpdates(_0x379a08){return function(_0x5d1dfc){try{jsonpatch[_0xa46a('0x23')](_0x5d1dfc,_0x379a08,!![]);}catch(_0x1c6c8f){return BPromise[_0xa46a('0x24')](_0x1c6c8f);}return _0x5d1dfc[_0xa46a('0x25')]();};}function saveUpdates(_0x441837,_0x3d491e){return function(_0x24bc6a){if(_0x24bc6a){return _0x24bc6a['update'](_0x441837)['then'](function(_0x4c0500){return _0x4c0500;});}return null;};}function removeEntity(_0x668e0f,_0xe2f0b5){return function(_0x437dee){if(_0x437dee){return _0x437dee[_0xa46a('0x26')]()[_0xa46a('0x27')](function(){var _0x3eaa47=_0x437dee[_0xa46a('0x28')]({'plain':!![]});var _0x202f91=_0xa46a('0x29');return db[_0xa46a('0x2a')][_0xa46a('0x26')]({'where':{'type':_0x202f91,'resourceId':_0x3eaa47['id']}})['then'](function(){return _0x437dee;});})[_0xa46a('0x27')](function(){_0x668e0f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ec51a,_0x344924){return function(_0x1c3c04){if(!_0x1c3c04){_0x2ec51a[_0xa46a('0x1a')](0x194);}return _0x1c3c04;};}function handleError(_0x375f1e,_0x4079aa){_0x4079aa=_0x4079aa||0x1f4;return function(_0xfeb33d){logger[_0xa46a('0x2b')](_0xfeb33d['stack']);if(_0xfeb33d['name']){delete _0xfeb33d[_0xa46a('0x2c')];}_0x375f1e[_0xa46a('0x1b')](_0x4079aa)['send'](_0xfeb33d);};}exports[_0xa46a('0x2d')]=function(_0x4f7ba5,_0x28780c){var _0x5a4219={},_0xe807b6={},_0x350fec={'count':0x0,'rows':[]};var _0x9235cb=_['map'](db[_0xa46a('0x2e')][_0xa46a('0x2f')],function(_0x313f62){return{'name':_0x313f62[_0xa46a('0x30')],'type':_0x313f62[_0xa46a('0x31')]['key']};});_0xe807b6['model']=_['map'](_0x9235cb,_0xa46a('0x2c'));_0xe807b6[_0xa46a('0x32')]=_[_0xa46a('0x33')](_0x4f7ba5[_0xa46a('0x32')]);_0xe807b6[_0xa46a('0x34')]=_[_0xa46a('0x35')](_0xe807b6[_0xa46a('0x36')],_0xe807b6[_0xa46a('0x32')]);_0x5a4219[_0xa46a('0x37')]=_[_0xa46a('0x35')](_0xe807b6[_0xa46a('0x36')],qs[_0xa46a('0x38')](_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x38')]));_0x5a4219[_0xa46a('0x37')]=_0x5a4219[_0xa46a('0x37')]['length']?_0x5a4219[_0xa46a('0x37')]:_0xe807b6['model'];if(!_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x39')](_0xa46a('0x3a'))){_0x5a4219[_0xa46a('0x20')]=qs[_0xa46a('0x20')](_0x4f7ba5['query'][_0xa46a('0x20')]);_0x5a4219['offset']=qs[_0xa46a('0x1e')](_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x1e')]);}_0x5a4219['order']=qs[_0xa46a('0x3b')](_0x4f7ba5[_0xa46a('0x32')]['sort']);_0x5a4219[_0xa46a('0x3c')]=qs['filters'](_[_0xa46a('0x3d')](_0x4f7ba5['query'],_0xe807b6[_0xa46a('0x34')]),_0x9235cb);if(_0x4f7ba5[_0xa46a('0x32')]['filter']){_0x5a4219[_0xa46a('0x3c')]=_[_0xa46a('0x3e')](_0x5a4219['where'],{'$or':_[_0xa46a('0x3f')](_0x9235cb,function(_0x3f48ba){if(_0x3f48ba[_0xa46a('0x31')]!==_0xa46a('0x40')){var _0x518732={};_0x518732[_0x3f48ba[_0xa46a('0x2c')]]={'$like':'%'+_0x4f7ba5[_0xa46a('0x32')]['filter']+'%'};return _0x518732;}})});}_0x5a4219=_[_0xa46a('0x3e')]({},_0x5a4219,_0x4f7ba5[_0xa46a('0x41')]);var _0x1bd8f2={'where':_0x5a4219[_0xa46a('0x3c')]};return db['Disposition'][_0xa46a('0x21')](_0x1bd8f2)['then'](function(_0x2ef5ef){_0x350fec[_0xa46a('0x21')]=_0x2ef5ef;if(_0x4f7ba5[_0xa46a('0x32')][_0xa46a('0x42')]){_0x5a4219[_0xa46a('0x43')]=[{'all':!![]}];}return db[_0xa46a('0x2e')][_0xa46a('0x44')](_0x5a4219);})[_0xa46a('0x27')](function(_0x27aca7){_0x350fec[_0xa46a('0x45')]=_0x27aca7;return _0x350fec;})[_0xa46a('0x27')](respondWithFilteredResult(_0x28780c,_0x5a4219))[_0xa46a('0x46')](handleError(_0x28780c,null));};exports[_0xa46a('0x47')]=function(_0x54bbfb,_0x1d5811){var _0x329015={'raw':!![],'where':{'id':_0x54bbfb['params']['id']}},_0x3cd4d1={};_0x3cd4d1[_0xa46a('0x36')]=_[_0xa46a('0x33')](db[_0xa46a('0x2e')]['rawAttributes']);_0x3cd4d1[_0xa46a('0x32')]=_['keys'](_0x54bbfb[_0xa46a('0x32')]);_0x3cd4d1[_0xa46a('0x34')]=_[_0xa46a('0x35')](_0x3cd4d1[_0xa46a('0x36')],_0x3cd4d1['query']);_0x329015['attributes']=_[_0xa46a('0x35')](_0x3cd4d1['model'],qs[_0xa46a('0x38')](_0x54bbfb[_0xa46a('0x32')][_0xa46a('0x38')]));_0x329015[_0xa46a('0x37')]=_0x329015['attributes'][_0xa46a('0x48')]?_0x329015[_0xa46a('0x37')]:_0x3cd4d1[_0xa46a('0x36')];if(_0x54bbfb['query'][_0xa46a('0x42')]){_0x329015[_0xa46a('0x43')]=[{'all':!![]}];}_0x329015=_[_0xa46a('0x3e')]({},_0x329015,_0x54bbfb['options']);return db[_0xa46a('0x2e')][_0xa46a('0x49')](_0x329015)['then'](handleEntityNotFound(_0x1d5811,null))[_0xa46a('0x27')](respondWithResult(_0x1d5811,null))[_0xa46a('0x46')](handleError(_0x1d5811,null));};exports[_0xa46a('0x4a')]=function(_0x1d0265,_0x2ba18a){return db[_0xa46a('0x2e')][_0xa46a('0x4a')](_0x1d0265['body'],{})[_0xa46a('0x27')](function(_0x1b28ad){var _0x25f44c=_0x1d0265[_0xa46a('0x4b')][_0xa46a('0x28')]({'plain':!![]});if(!_0x25f44c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25f44c[_0xa46a('0x4c')]===_0xa46a('0x4b')){var _0x2688b8=_0x1b28ad[_0xa46a('0x28')]({'plain':!![]});var _0x2609be=_0xa46a('0x29');return db[_0xa46a('0x4d')][_0xa46a('0x49')]({'where':{'name':_0x2609be,'userProfileId':_0x25f44c[_0xa46a('0x4e')]},'raw':!![]})[_0xa46a('0x27')](function(_0x2f1530){if(_0x2f1530&&_0x2f1530[_0xa46a('0x4f')]===0x0){return db[_0xa46a('0x2a')]['create']({'name':_0x2688b8[_0xa46a('0x2c')],'resourceId':_0x2688b8['id'],'type':_0x2f1530[_0xa46a('0x2c')],'sectionId':_0x2f1530['id']},{})['then'](function(){return _0x1b28ad;});}else{return _0x1b28ad;}})[_0xa46a('0x46')](function(_0x405b40){logger['error'](_0xa46a('0x50'),_0x405b40);throw _0x405b40;});}return _0x1b28ad;})[_0xa46a('0x27')](respondWithResult(_0x2ba18a,0xc9))[_0xa46a('0x46')](handleError(_0x2ba18a,null));};exports[_0xa46a('0x51')]=function(_0x1532d4,_0x223acd){if(_0x1532d4[_0xa46a('0x52')]['id']){delete _0x1532d4[_0xa46a('0x52')]['id'];}return db['Disposition']['find']({'where':{'id':_0x1532d4[_0xa46a('0x53')]['id']}})[_0xa46a('0x27')](handleEntityNotFound(_0x223acd,null))['then'](saveUpdates(_0x1532d4[_0xa46a('0x52')],null))[_0xa46a('0x27')](respondWithResult(_0x223acd,null))[_0xa46a('0x46')](handleError(_0x223acd,null));};exports[_0xa46a('0x26')]=function(_0x52971f,_0x33a255){return db['Disposition']['find']({'where':{'id':_0x52971f['params']['id']}})[_0xa46a('0x27')](handleEntityNotFound(_0x33a255,null))[_0xa46a('0x27')](removeEntity(_0x33a255,null))[_0xa46a('0x46')](handleError(_0x33a255,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c405a37..4ce8c96 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 _0xb7a7=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_chat','name','SmsAccountId'];(function(_0x218d6a,_0x5df04d){var _0x5d7b35=function(_0x330f02){while(--_0x330f02){_0x218d6a['push'](_0x218d6a['shift']());}};_0x5d7b35(++_0x5df04d);}(_0xb7a7,0x98));var _0x7b7a=function(_0x3c37c7,_0x2fc937){_0x3c37c7=_0x3c37c7-0x0;var _0xe7f010=_0xb7a7[_0x3c37c7];return _0xe7f010;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7b7a('0x0'))(_0x7b7a('0x1'));var moment=require(_0x7b7a('0x2'));var BPromise=require(_0x7b7a('0x3'));var rp=require(_0x7b7a('0x4'));var fs=require('fs');var path=require(_0x7b7a('0x5'));var rimraf=require(_0x7b7a('0x6'));var config=require(_0x7b7a('0x7'));var attributes=require(_0x7b7a('0x8'));module[_0x7b7a('0x9')]=function(_0x5e9b97,_0x423a3a){return _0x5e9b97[_0x7b7a('0xa')](_0x7b7a('0xb'),attributes,{'tableName':_0x7b7a('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0x7b7a('0xd'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x7b7a('0xe'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x7b7a('0xe'),_0x7b7a('0xf')]},{'unique':!![],'name':_0x7b7a('0x10'),'fields':[_0x7b7a('0xe'),_0x7b7a('0x11')]},{'unique':!![],'name':_0x7b7a('0x12'),'fields':['name',_0x7b7a('0x13')]},{'unique':!![],'name':_0x7b7a('0x14'),'fields':[_0x7b7a('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf384=['util','moment','request-promise','path','rimraf','./disposition.attributes','define','tools_dispositions','name_voice','ListId','name_chat','ChatWebsiteId','name_mail','name','MailAccountId','SmsAccountId','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x36dc3e,_0x2131a9){var _0x407506=function(_0x2536c2){while(--_0x2536c2){_0x36dc3e['push'](_0x36dc3e['shift']());}};_0x407506(++_0x2131a9);}(_0xf384,0x179));var _0x4f38=function(_0x337459,_0x5e1f69){_0x337459=_0x337459-0x0;var _0xb3bd67=_0xf384[_0x337459];return _0xb3bd67;};'use strict';var _=require(_0x4f38('0x0'));var util=require(_0x4f38('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4f38('0x2'));var BPromise=require('bluebird');var rp=require(_0x4f38('0x3'));var fs=require('fs');var path=require(_0x4f38('0x4'));var rimraf=require(_0x4f38('0x5'));var config=require('../../config/environment');var attributes=require(_0x4f38('0x6'));module['exports']=function(_0x182926,_0x1c96cc){return _0x182926[_0x4f38('0x7')]('Disposition',attributes,{'tableName':_0x4f38('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4f38('0x9'),'fields':['name',_0x4f38('0xa')]},{'unique':!![],'name':_0x4f38('0xb'),'fields':['name',_0x4f38('0xc')]},{'unique':!![],'name':_0x4f38('0xd'),'fields':[_0x4f38('0xe'),_0x4f38('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x4f38('0xe'),_0x4f38('0x10')]},{'unique':!![],'name':'name_fax','fields':[_0x4f38('0xe'),_0x4f38('0x11')]},{'unique':!![],'name':_0x4f38('0x12'),'fields':[_0x4f38('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0x4f38('0x13'),'fields':[_0x4f38('0xe'),_0x4f38('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index aed729b..12f3a10 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(_0x40d812,_0x3a38d0){var _0x48b260=function(_0x4a782a){while(--_0x4a782a){_0x40d812['push'](_0x40d812['shift']());}};_0x48b260(++_0x3a38d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x4e20df,_0x327f45){var _0x1a85e3=function(_0x3bf315){while(--_0x3bf315){_0x4e20df['push'](_0x4e20df['shift']());}};_0x1a85e3(++_0x327f45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 696330a..51677bc 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 _0x709c=['put','/:id','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x709c,0x17e));var _0xc709=function(_0x4f41cb,_0x5bdc04){_0x4f41cb=_0x4f41cb-0x0;var _0x3cf2ea=_0x709c[_0x4f41cb];return _0x3cf2ea;};'use strict';var multer=require('multer');var util=require(_0xc709('0x0'));var path=require('path');var timeout=require(_0xc709('0x1'));var express=require(_0xc709('0x2'));var router=express[_0xc709('0x3')]();var fs_extra=require(_0xc709('0x4'));var auth=require(_0xc709('0x5'));var interaction=require(_0xc709('0x6'));var config=require(_0xc709('0x7'));var controller=require('./disposition.controller');router[_0xc709('0x8')]('/',auth[_0xc709('0x9')](),controller[_0xc709('0xa')]);router['get']('/:id',auth[_0xc709('0x9')](),controller[_0xc709('0xb')]);router[_0xc709('0xc')]('/',auth['isAuthenticated'](),controller[_0xc709('0xd')]);router[_0xc709('0xe')](_0xc709('0xf'),auth[_0xc709('0x9')](),controller['update']);router[_0xc709('0x10')]('/:id',auth[_0xc709('0x9')](),controller['destroy']);module[_0xc709('0x11')]=router; \ No newline at end of file +var _0x9ab2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','destroy','exports','multer','util','connect-timeout','express'];(function(_0x2a4eb4,_0x4a3f9d){var _0x1663ed=function(_0x1a36c4){while(--_0x1a36c4){_0x2a4eb4['push'](_0x2a4eb4['shift']());}};_0x1663ed(++_0x4a3f9d);}(_0x9ab2,0x192));var _0x29ab=function(_0x310337,_0x138367){_0x310337=_0x310337-0x0;var _0x43af61=_0x9ab2[_0x310337];return _0x43af61;};'use strict';var multer=require(_0x29ab('0x0'));var util=require(_0x29ab('0x1'));var path=require('path');var timeout=require(_0x29ab('0x2'));var express=require(_0x29ab('0x3'));var router=express[_0x29ab('0x4')]();var fs_extra=require(_0x29ab('0x5'));var auth=require(_0x29ab('0x6'));var interaction=require(_0x29ab('0x7'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x29ab('0x8')]('/',auth[_0x29ab('0x9')](),controller['index']);router['get'](_0x29ab('0xa'),auth[_0x29ab('0x9')](),controller['show']);router[_0x29ab('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x29ab('0xa'),auth[_0x29ab('0x9')](),controller['update']);router['delete'](_0x29ab('0xa'),auth[_0x29ab('0x9')](),controller[_0x29ab('0xc')]);module[_0x29ab('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 7e2ee28..0683cf8 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 _0x07ef=['SIP','IAX','KHOMP','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','exports','STRING','ENUM','yes','localstationid','12000','14400','4800','9600','v17,v27,v29'];(function(_0x16960e,_0x169c9f){var _0x1c24ce=function(_0x58c97){while(--_0x58c97){_0x16960e['push'](_0x16960e['shift']());}};_0x1c24ce(++_0x169c9f);}(_0x07ef,0x1d9));var _0xf07e=function(_0x2bd1f5,_0x8db4ec){_0x2bd1f5=_0x2bd1f5-0x0;var _0x43a4b3=_0x07ef[_0x2bd1f5];return _0x43a4b3;};'use strict';var Sequelize=require(_0xf07e('0x0'));module[_0xf07e('0x1')]={'name':{'type':Sequelize[_0xf07e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xf07e('0x3')](_0xf07e('0x4'),'no'),'defaultValue':_0xf07e('0x4')},'headerinfo':{'type':Sequelize[_0xf07e('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xf07e('0x5')},'minrate':{'type':Sequelize['ENUM']('2400','4800','7200','9600',_0xf07e('0x6'),_0xf07e('0x7')),'defaultValue':_0xf07e('0x8')},'maxrate':{'type':Sequelize[_0xf07e('0x3')]('2400',_0xf07e('0x8'),'7200',_0xf07e('0x9'),_0xf07e('0x6'),_0xf07e('0x7')),'defaultValue':_0xf07e('0x7')},'modem':{'type':Sequelize[_0xf07e('0x2')],'defaultValue':_0xf07e('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xf07e('0xb'),_0xf07e('0xc'),'DADHI',_0xf07e('0xd')),'defaultValue':_0xf07e('0xb')},'key':{'type':Sequelize[_0xf07e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf07e('0xe')],'defaultValue':function(){return _0xf07e('0xf');}},'notificationSound':{'type':Sequelize[_0xf07e('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf07e('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf07e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf07e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf07e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf07e('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x479128){if(!_0x479128)this[_0xf07e('0x13')](_0xf07e('0x14'),null);this[_0xf07e('0x13')](_0xf07e('0x15'),_0x479128);}}}; \ No newline at end of file +var _0x29d1=['SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER'];(function(_0x1586ce,_0x4c9754){var _0x226709=function(_0x165e58){while(--_0x165e58){_0x1586ce['push'](_0x1586ce['shift']());}};_0x226709(++_0x4c9754);}(_0x29d1,0x1d6));var _0x129d=function(_0x2185e2,_0x4e23cd){_0x2185e2=_0x2185e2-0x0;var _0x415782=_0x29d1[_0x2185e2];return _0x415782;};'use strict';var Sequelize=require(_0x129d('0x0'));module['exports']={'name':{'type':Sequelize[_0x129d('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x129d('0x1')]},'ecm':{'type':Sequelize[_0x129d('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x129d('0x1')],'defaultValue':_0x129d('0x3')},'localstationid':{'type':Sequelize[_0x129d('0x1')],'unique':_0x129d('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x129d('0x5'),_0x129d('0x6'),_0x129d('0x7'),_0x129d('0x8'),_0x129d('0x9'),'14400'),'defaultValue':_0x129d('0x6')},'maxrate':{'type':Sequelize[_0x129d('0x2')]('2400',_0x129d('0x6'),_0x129d('0x7'),_0x129d('0x8'),_0x129d('0x9'),'14400'),'defaultValue':_0x129d('0xa')},'modem':{'type':Sequelize[_0x129d('0x1')],'defaultValue':_0x129d('0xb')},'gateway':{'type':Sequelize[_0x129d('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x129d('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x129d('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x129d('0x2')](_0x129d('0xd'),_0x129d('0xe'),_0x129d('0xf'),'KHOMP'),'defaultValue':_0x129d('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x129d('0x10')],'defaultValue':function(){return _0x129d('0x11');}},'notificationSound':{'type':Sequelize[_0x129d('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x129d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x129d('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x129d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x129d('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x129d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x129d('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x129d('0x12')],'defaultValue':![],'comment':_0x129d('0x14'),'set':function(_0x2fe787){if(!_0x2fe787)this[_0x129d('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x129d('0x16'),_0x2fe787);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index b9b137d..76f9bea 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 _0x92a5=['ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','stack','finally','json','getApplications','context','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','transaction','updateAccountApplications','VoiceExtension','omit','createdAt','updatedAt','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','out','filename','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','getInteractions','Contact','User','Owner','fullname','color','tag','addApplications','sequelize','Transaction'];(function(_0x3a364a,_0x3a33a4){var _0x47ffdf=function(_0x3191ed){while(--_0x3191ed){_0x3a364a['push'](_0x3a364a['shift']());}};_0x47ffdf(++_0x3a33a4);}(_0x92a5,0x1c2));var _0x592a=function(_0x23c1b0,_0x2ce460){_0x23c1b0=_0x23c1b0-0x0;var _0xcb6d9=_0x92a5[_0x23c1b0];return _0xcb6d9;};'use strict';var emlformat=require(_0x592a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x592a('0x1'));var rp=require('request-promise');var moment=require(_0x592a('0x2'));var BPromise=require(_0x592a('0x3'));var Mustache=require(_0x592a('0x4'));var util=require(_0x592a('0x5'));var path=require(_0x592a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x592a('0x7'));var fs=require('fs');var fs_extra=require(_0x592a('0x8'));var _=require('lodash');var squel=require(_0x592a('0x9'));var crypto=require(_0x592a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x592a('0xb'));var querystring=require(_0x592a('0xc'));var Papa=require(_0x592a('0xd'));var Redis=require(_0x592a('0xe'));var authService=require(_0x592a('0xf'));var qs=require(_0x592a('0x10'));var as=require(_0x592a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x592a('0x12'))(_0x592a('0x13'));var utils=require(_0x592a('0x14'));var config=require(_0x592a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x592a('0x16'))['db'];config[_0x592a('0x17')]=_[_0x592a('0x18')](config[_0x592a('0x17')],{'host':_0x592a('0x19'),'port':0x18eb});var socket=require(_0x592a('0x1a'))(new Redis(config['redis']));require(_0x592a('0x1b'))[_0x592a('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x592a('0x1d')][_0x592a('0x1e')]({'port':0x232c});var client9002=jayson[_0x592a('0x1d')][_0x592a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1723b3,_0x27485f,_0x10e4bc,_0x5dbeea){return new BPromise(function(_0x4d10b1,_0x2ee9f4){var _0x29c8f7=_0x5dbeea||client;return _0x29c8f7[_0x592a('0x1f')](_0x1723b3,_0x10e4bc)['then'](function(_0x13e542){logger['info'](_0x592a('0x20'),_0x27485f,_0x592a('0x21'));logger['debug'](_0x592a('0x22'),_0x27485f,_0x592a('0x21'),JSON[_0x592a('0x23')](_0x13e542));if(_0x13e542['error']){if(_0x13e542[_0x592a('0x24')]['code']===0x1f4){logger['error'](_0x592a('0x20'),_0x27485f,_0x13e542[_0x592a('0x24')][_0x592a('0x25')]);return _0x2ee9f4(_0x13e542[_0x592a('0x24')][_0x592a('0x25')]);}logger['error'](_0x592a('0x20'),_0x27485f,_0x13e542[_0x592a('0x24')][_0x592a('0x25')]);return _0x4d10b1(_0x13e542['error'][_0x592a('0x25')]);}else{logger[_0x592a('0x26')](_0x592a('0x20'),_0x27485f,_0x592a('0x21'));_0x4d10b1(_0x13e542['result'][_0x592a('0x25')]);}})[_0x592a('0x27')](function(_0x65a7d3){logger['error'](_0x592a('0x20'),_0x27485f,_0x65a7d3);_0x2ee9f4(_0x65a7d3);});});}function respondWithStatusCode(_0x2ebb81,_0x2255bb){_0x2255bb=_0x2255bb||0xcc;return function(_0x416fa9){if(_0x416fa9){return _0x2ebb81[_0x592a('0x28')](_0x2255bb);}return _0x2ebb81['status'](_0x2255bb)[_0x592a('0x29')]();};}function respondWithResult(_0x8eba03,_0x4cff43){_0x4cff43=_0x4cff43||0xc8;return function(_0x40fb3e){if(_0x40fb3e){return _0x8eba03[_0x592a('0x2a')](_0x4cff43)['json'](_0x40fb3e);}};}function respondWithFilteredResult(_0x183483,_0x38dc14){return function(_0x4cf539){if(_0x4cf539){var _0x4593af=typeof _0x38dc14[_0x592a('0x2b')]===_0x592a('0x2c')&&typeof _0x38dc14[_0x592a('0x2d')]===_0x592a('0x2c');var _0x275da5=_0x4cf539[_0x592a('0x2e')];var _0x205ab7=_0x4593af?0x0:_0x38dc14[_0x592a('0x2b')];var _0x2927dd=_0x4593af?_0x4cf539[_0x592a('0x2e')]:_0x38dc14['offset']+_0x38dc14[_0x592a('0x2d')];var _0x114a8a;if(_0x2927dd>=_0x275da5){_0x2927dd=_0x275da5;_0x114a8a=0xc8;}else{_0x114a8a=0xce;}_0x183483[_0x592a('0x2a')](_0x114a8a);return _0x183483[_0x592a('0x2f')](_0x592a('0x30'),_0x205ab7+'-'+_0x2927dd+'/'+_0x275da5)['json'](_0x4cf539);}return null;};}function patchUpdates(_0x48a805){return function(_0x2ab914){try{jsonpatch[_0x592a('0x31')](_0x2ab914,_0x48a805,!![]);}catch(_0x13cfda){return BPromise[_0x592a('0x32')](_0x13cfda);}return _0x2ab914[_0x592a('0x33')]();};}function saveUpdates(_0x367fb3,_0x504174){return function(_0x5e77c0){if(_0x5e77c0){return _0x5e77c0[_0x592a('0x34')](_0x367fb3)[_0x592a('0x35')](function(_0x447e25){return _0x447e25;});}return null;};}function removeEntity(_0x3d4689,_0x275b24){return function(_0x52dfbe){if(_0x52dfbe){return _0x52dfbe[_0x592a('0x36')]()['then'](function(){var _0xcb005e=_0x52dfbe[_0x592a('0x37')]({'plain':!![]});var _0x4e5903=_0x592a('0x38');return db[_0x592a('0x39')][_0x592a('0x36')]({'where':{'type':_0x4e5903,'resourceId':_0xcb005e['id']}})[_0x592a('0x35')](function(){return _0x52dfbe;});})[_0x592a('0x35')](function(){_0x3d4689[_0x592a('0x2a')](0xcc)[_0x592a('0x29')]();});}};}function handleEntityNotFound(_0x3848e6,_0x4604e9){return function(_0x5af2b1){if(!_0x5af2b1){_0x3848e6[_0x592a('0x28')](0x194);}return _0x5af2b1;};}function handleError(_0x3681db,_0x34132d){_0x34132d=_0x34132d||0x1f4;return function(_0x4dbd52){logger['error'](_0x4dbd52['stack']);if(_0x4dbd52[_0x592a('0x3a')]){delete _0x4dbd52[_0x592a('0x3a')];}_0x3681db[_0x592a('0x2a')](_0x34132d)[_0x592a('0x3b')](_0x4dbd52);};}exports[_0x592a('0x3c')]=function(_0x1849ab,_0x473d53){var _0x5df8ce={'include':[{'model':db[_0x592a('0x3d')],'as':_0x592a('0x3e')}]},_0x2dec1c={},_0x4ca8e0={'count':0x0,'rows':[]};var _0x4f5627=_['map'](db[_0x592a('0x3f')][_0x592a('0x40')],function(_0x43bf9a){return{'name':_0x43bf9a[_0x592a('0x41')],'type':_0x43bf9a[_0x592a('0x42')][_0x592a('0x43')]};});_0x2dec1c[_0x592a('0x44')]=_[_0x592a('0x45')](_0x4f5627,_0x592a('0x3a'));_0x2dec1c['query']=_['keys'](_0x1849ab[_0x592a('0x46')]);_0x2dec1c[_0x592a('0x47')]=_[_0x592a('0x48')](_0x2dec1c[_0x592a('0x44')],_0x2dec1c[_0x592a('0x46')]);_0x5df8ce['attributes']=_[_0x592a('0x48')](_0x2dec1c[_0x592a('0x44')],qs[_0x592a('0x49')](_0x1849ab[_0x592a('0x46')][_0x592a('0x49')]));_0x5df8ce[_0x592a('0x4a')]=_0x5df8ce[_0x592a('0x4a')][_0x592a('0x4b')]?_0x5df8ce['attributes']:_0x2dec1c['model'];if(!_0x1849ab[_0x592a('0x46')][_0x592a('0x4c')]('nolimit')){_0x5df8ce[_0x592a('0x2d')]=qs[_0x592a('0x2d')](_0x1849ab[_0x592a('0x46')]['limit']);_0x5df8ce[_0x592a('0x2b')]=qs[_0x592a('0x2b')](_0x1849ab[_0x592a('0x46')][_0x592a('0x2b')]);}_0x5df8ce[_0x592a('0x4d')]=qs['sort'](_0x1849ab[_0x592a('0x46')][_0x592a('0x4e')]);_0x5df8ce[_0x592a('0x4f')]=qs[_0x592a('0x47')](_[_0x592a('0x50')](_0x1849ab[_0x592a('0x46')],_0x2dec1c['filters']),_0x4f5627);if(_0x1849ab['query'][_0x592a('0x51')]){_0x5df8ce[_0x592a('0x4f')]=_[_0x592a('0x52')](_0x5df8ce[_0x592a('0x4f')],{'$or':_['map'](_0x4f5627,function(_0x47197c){if(_0x47197c['type']!==_0x592a('0x53')){var _0x570346={};_0x570346[_0x47197c[_0x592a('0x3a')]]={'$like':'%'+_0x1849ab[_0x592a('0x46')][_0x592a('0x51')]+'%'};return _0x570346;}})});}_0x5df8ce=_[_0x592a('0x52')]({},_0x5df8ce,_0x1849ab[_0x592a('0x54')]);var _0x29f0da={'where':_0x5df8ce[_0x592a('0x4f')]};return db[_0x592a('0x3f')][_0x592a('0x2e')](_0x29f0da)[_0x592a('0x35')](function(_0xd1ab65){_0x4ca8e0['count']=_0xd1ab65;if(_0x1849ab[_0x592a('0x46')][_0x592a('0x55')]){_0x5df8ce[_0x592a('0x56')]=[{'all':!![]}];}return db[_0x592a('0x3f')][_0x592a('0x57')](_0x5df8ce);})[_0x592a('0x35')](function(_0x4d4fa7){_0x4ca8e0[_0x592a('0x58')]=_0x4d4fa7;return _0x4ca8e0;})[_0x592a('0x35')](respondWithFilteredResult(_0x473d53,_0x5df8ce))[_0x592a('0x27')](handleError(_0x473d53,null));};exports[_0x592a('0x59')]=function(_0x2beb36,_0x350d26){var _0x14827f={'raw':![],'where':{'id':_0x2beb36[_0x592a('0x5a')]['id']},'include':[{'model':db[_0x592a('0x3d')],'as':_0x592a('0x3e')}]},_0xaa534c={};_0xaa534c['model']=_[_0x592a('0x5b')](db['FaxAccount']['rawAttributes']);_0xaa534c[_0x592a('0x46')]=_[_0x592a('0x5b')](_0x2beb36['query']);_0xaa534c['filters']=_[_0x592a('0x48')](_0xaa534c['model'],_0xaa534c[_0x592a('0x46')]);_0x14827f[_0x592a('0x4a')]=_[_0x592a('0x48')](_0xaa534c[_0x592a('0x44')],qs['fields'](_0x2beb36['query']['fields']));_0x14827f['attributes']=_0x14827f['attributes'][_0x592a('0x4b')]?_0x14827f[_0x592a('0x4a')]:_0xaa534c['model'];if(_0x2beb36[_0x592a('0x46')][_0x592a('0x55')]){_0x14827f[_0x592a('0x56')]=[{'all':!![]}];}_0x14827f=_[_0x592a('0x52')]({},_0x14827f,_0x2beb36[_0x592a('0x54')]);return db[_0x592a('0x3f')][_0x592a('0x5c')](_0x14827f)[_0x592a('0x35')](handleEntityNotFound(_0x350d26,null))[_0x592a('0x35')](respondWithResult(_0x350d26,null))['catch'](handleError(_0x350d26,null));};exports[_0x592a('0x5d')]=function(_0x13ec9a,_0x2d8ab0){return db[_0x592a('0x3f')]['create'](_0x13ec9a[_0x592a('0x5e')],{})['then'](function(_0x567809){var _0x3f2f40=_0x13ec9a[_0x592a('0x5f')][_0x592a('0x37')]({'plain':!![]});if(!_0x3f2f40)throw new Error(_0x592a('0x60'));if(_0x3f2f40[_0x592a('0x61')]===_0x592a('0x5f')){var _0x3867d6=_0x567809[_0x592a('0x37')]({'plain':!![]});var _0x2da04='FaxAccounts';return db['UserProfileSection'][_0x592a('0x5c')]({'where':{'name':_0x2da04,'userProfileId':_0x3f2f40['userProfileId']},'raw':!![]})[_0x592a('0x35')](function(_0x397534){if(_0x397534&&_0x397534[_0x592a('0x62')]===0x0){return db[_0x592a('0x39')][_0x592a('0x5d')]({'name':_0x3867d6['name'],'resourceId':_0x3867d6['id'],'type':_0x397534[_0x592a('0x3a')],'sectionId':_0x397534['id']},{})[_0x592a('0x35')](function(){return _0x567809;});}else{return _0x567809;}})[_0x592a('0x27')](function(_0x24cbcd){logger[_0x592a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24cbcd);throw _0x24cbcd;});}return _0x567809;})[_0x592a('0x35')](respondWithResult(_0x2d8ab0,0xc9))['catch'](handleError(_0x2d8ab0,null));};exports[_0x592a('0x34')]=function(_0x184a69,_0xaf8e6f){if(_0x184a69[_0x592a('0x5e')]['id']){delete _0x184a69[_0x592a('0x5e')]['id'];}return db[_0x592a('0x3f')][_0x592a('0x5c')]({'where':{'id':_0x184a69[_0x592a('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x592a('0x3e')}]})[_0x592a('0x35')](handleEntityNotFound(_0xaf8e6f,null))[_0x592a('0x35')](saveUpdates(_0x184a69['body'],null))[_0x592a('0x35')](respondWithResult(_0xaf8e6f,null))['catch'](handleError(_0xaf8e6f,null));};exports[_0x592a('0x36')]=function(_0x51803c,_0x35485b){return db[_0x592a('0x3f')][_0x592a('0x5c')]({'where':{'id':_0x51803c[_0x592a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x35485b,null))['then'](removeEntity(_0x35485b,null))['catch'](handleError(_0x35485b,null));};exports[_0x592a('0x63')]=function(_0x16cd68,_0x5b4628){return db[_0x592a('0x3f')][_0x592a('0x63')]()[_0x592a('0x35')](respondWithResult(_0x5b4628,null))[_0x592a('0x27')](handleError(_0x5b4628,null));};exports[_0x592a('0x64')]=function(_0x5d961d,_0x422d6b,_0x260069){if(_0x5d961d[_0x592a('0x5e')]['id']){delete _0x5d961d[_0x592a('0x5e')]['id'];}return db[_0x592a('0x3f')]['find']({'where':{'id':_0x5d961d['params']['id']}})['then'](handleEntityNotFound(_0x422d6b,null))['then'](function(_0x5e3af8){if(_0x5e3af8){_0x5d961d['body'][_0x592a('0x65')]=_0x5e3af8['id'];return db[_0x592a('0x66')]['create'](_0x5d961d[_0x592a('0x5e')]);}})[_0x592a('0x35')](respondWithResult(_0x422d6b,null))[_0x592a('0x27')](handleError(_0x422d6b,null));};exports[_0x592a('0x67')]=function(_0x509db5,_0x558eeb,_0x26bed){var _0x4d11d4={'raw':![],'where':{}};var _0x2fb1a2={};var _0x564f47={'count':0x0,'rows':[]};return db[_0x592a('0x3f')][_0x592a('0x68')]({'where':{'id':_0x509db5[_0x592a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x558eeb,null))[_0x592a('0x35')](function(_0x2a9f8e){if(_0x2a9f8e){_0x2fb1a2['model']=_[_0x592a('0x5b')](db[_0x592a('0x66')]['rawAttributes']);_0x2fb1a2[_0x592a('0x46')]=_[_0x592a('0x5b')](_0x509db5[_0x592a('0x46')]);_0x2fb1a2[_0x592a('0x47')]=_['intersection'](_0x2fb1a2[_0x592a('0x44')],_0x2fb1a2[_0x592a('0x46')]);_0x4d11d4[_0x592a('0x4a')]=_[_0x592a('0x48')](_0x2fb1a2[_0x592a('0x44')],qs[_0x592a('0x49')](_0x509db5[_0x592a('0x46')][_0x592a('0x49')]));_0x4d11d4[_0x592a('0x4a')]=_0x4d11d4['attributes']['length']?_0x4d11d4['attributes']:_0x2fb1a2[_0x592a('0x44')];if(!_0x509db5[_0x592a('0x46')][_0x592a('0x4c')](_0x592a('0x69'))){_0x4d11d4[_0x592a('0x2d')]=qs[_0x592a('0x2d')](_0x509db5[_0x592a('0x46')][_0x592a('0x2d')]);_0x4d11d4[_0x592a('0x2b')]=qs[_0x592a('0x2b')](_0x509db5['query']['offset']);}_0x4d11d4[_0x592a('0x4d')]=qs['sort'](_0x509db5[_0x592a('0x46')][_0x592a('0x4e')]);_0x4d11d4['where']=qs[_0x592a('0x47')](_[_0x592a('0x50')](_0x509db5[_0x592a('0x46')],_0x2fb1a2[_0x592a('0x47')]));_0x4d11d4['where'][_0x592a('0x65')]=_0x2a9f8e['id'];if(_0x509db5[_0x592a('0x46')][_0x592a('0x51')]){_0x4d11d4[_0x592a('0x4f')]=_['merge'](_0x4d11d4[_0x592a('0x4f')],{'$or':_[_0x592a('0x45')](_0x4d11d4[_0x592a('0x4a')],function(_0x5ed069){var _0x43348b={};_0x43348b[_0x5ed069]={'$like':'%'+_0x509db5['query']['filter']+'%'};return _0x43348b;})});}_0x4d11d4=_[_0x592a('0x52')]({},_0x4d11d4,_0x509db5[_0x592a('0x54')]);return db[_0x592a('0x66')]['count']({'where':_0x4d11d4[_0x592a('0x4f')]})[_0x592a('0x35')](function(_0x5490eb){_0x564f47[_0x592a('0x2e')]=_0x5490eb;if(_0x509db5['query'][_0x592a('0x55')]){_0x4d11d4[_0x592a('0x56')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4d11d4);})[_0x592a('0x35')](function(_0x48bb61){_0x564f47['rows']=_0x48bb61;return _0x564f47;});}})[_0x592a('0x35')](respondWithFilteredResult(_0x558eeb,_0x4d11d4))[_0x592a('0x27')](handleError(_0x558eeb,null));};exports[_0x592a('0x6a')]=function(_0x50c59d,_0x41ed4e,_0x36fa0d){return db[_0x592a('0x3f')][_0x592a('0x5c')]({'where':{'id':_0x50c59d[_0x592a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x41ed4e,null))[_0x592a('0x35')](function(_0x43147b){if(_0x43147b){return _0x43147b[_0x592a('0x6a')](_0x50c59d[_0x592a('0x46')]['ids']);}})[_0x592a('0x35')](respondWithStatusCode(_0x41ed4e,null))[_0x592a('0x27')](handleError(_0x41ed4e,null));};exports[_0x592a('0x6b')]=function(_0x2e2cf6,_0x45fa90,_0x4ef9ff){if(_0x2e2cf6[_0x592a('0x5e')]['id']){delete _0x2e2cf6[_0x592a('0x5e')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2e2cf6[_0x592a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x45fa90,null))[_0x592a('0x35')](function(_0x215941){if(_0x215941){_0x2e2cf6[_0x592a('0x5e')][_0x592a('0x65')]=_0x215941['id'];return db[_0x592a('0x6c')]['create'](_0x2e2cf6[_0x592a('0x5e')]);}})[_0x592a('0x35')](respondWithResult(_0x45fa90,null))['catch'](handleError(_0x45fa90,null));};exports[_0x592a('0x6d')]=function(_0x18b02d,_0x229d82,_0x15beb8){var _0x8c2595={'raw':![],'where':{}};var _0x5934dc={};var _0x3bd3ed={'count':0x0,'rows':[]};return db[_0x592a('0x3f')][_0x592a('0x68')]({'where':{'id':_0x18b02d[_0x592a('0x5a')]['id']}})[_0x592a('0x35')](handleEntityNotFound(_0x229d82,null))['then'](function(_0x2db424){if(_0x2db424){_0x5934dc[_0x592a('0x44')]=_[_0x592a('0x5b')](db['CannedAnswer']['rawAttributes']);_0x5934dc[_0x592a('0x46')]=_[_0x592a('0x5b')](_0x18b02d['query']);_0x5934dc[_0x592a('0x47')]=_['intersection'](_0x5934dc[_0x592a('0x44')],_0x5934dc[_0x592a('0x46')]);_0x8c2595[_0x592a('0x4a')]=_['intersection'](_0x5934dc['model'],qs[_0x592a('0x49')](_0x18b02d['query'][_0x592a('0x49')]));_0x8c2595['attributes']=_0x8c2595[_0x592a('0x4a')][_0x592a('0x4b')]?_0x8c2595['attributes']:_0x5934dc[_0x592a('0x44')];if(!_0x18b02d[_0x592a('0x46')]['hasOwnProperty'](_0x592a('0x69'))){_0x8c2595[_0x592a('0x2d')]=qs['limit'](_0x18b02d[_0x592a('0x46')]['limit']);_0x8c2595[_0x592a('0x2b')]=qs[_0x592a('0x2b')](_0x18b02d['query']['offset']);}_0x8c2595[_0x592a('0x4d')]=qs[_0x592a('0x4e')](_0x18b02d[_0x592a('0x46')][_0x592a('0x4e')]);_0x8c2595[_0x592a('0x4f')]=qs[_0x592a('0x47')](_['pick'](_0x18b02d[_0x592a('0x46')],_0x5934dc[_0x592a('0x47')]));_0x8c2595[_0x592a('0x4f')][_0x592a('0x65')]=_0x2db424['id'];if(_0x18b02d['query']['filter']){_0x8c2595[_0x592a('0x4f')]=_[_0x592a('0x52')](_0x8c2595[_0x592a('0x4f')],{'$or':_[_0x592a('0x45')](_0x8c2595['attributes'],function(_0x552c08){var _0x1f6332={};_0x1f6332[_0x552c08]={'$like':'%'+_0x18b02d[_0x592a('0x46')]['filter']+'%'};return _0x1f6332;})});}_0x8c2595=_['merge']({},_0x8c2595,_0x18b02d[_0x592a('0x54')]);return db[_0x592a('0x6c')][_0x592a('0x2e')]({'where':_0x8c2595[_0x592a('0x4f')]})[_0x592a('0x35')](function(_0x3447ca){_0x3bd3ed[_0x592a('0x2e')]=_0x3447ca;if(_0x18b02d[_0x592a('0x46')][_0x592a('0x55')]){_0x8c2595[_0x592a('0x56')]=[{'all':!![]}];}return db[_0x592a('0x6c')]['findAll'](_0x8c2595);})[_0x592a('0x35')](function(_0x2727f4){_0x3bd3ed[_0x592a('0x58')]=_0x2727f4;return _0x3bd3ed;});}})[_0x592a('0x35')](respondWithFilteredResult(_0x229d82,_0x8c2595))[_0x592a('0x27')](handleError(_0x229d82,null));};exports[_0x592a('0x6e')]=function(_0x4f8fbf,_0x4c5486,_0x429bf8){return db[_0x592a('0x3f')][_0x592a('0x5c')]({'where':{'id':_0x4f8fbf[_0x592a('0x5a')]['id']}})[_0x592a('0x35')](handleEntityNotFound(_0x4c5486,null))[_0x592a('0x35')](function(_0x1809eb){if(_0x1809eb){return _0x1809eb['removeAnswers'](_0x4f8fbf[_0x592a('0x46')][_0x592a('0x6f')]);}})[_0x592a('0x35')](respondWithStatusCode(_0x4c5486,null))[_0x592a('0x27')](handleError(_0x4c5486,null));};exports['addInteraction']=function(_0x5d2983,_0x5c4106,_0xa1f38f){return db[_0x592a('0x70')]['find']({'where':{'id':_0x5d2983[_0x592a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5c4106,null))[_0x592a('0x35')](function(_0x3096ac){if(_0x3096ac){return _0x3096ac['addInteraction'](_0x5d2983[_0x592a('0x5e')][_0x592a('0x6f')],_['omit'](_0x5d2983[_0x592a('0x5e')],[_0x592a('0x6f'),'id'])||{});}})[_0x592a('0x35')](respondWithResult(_0x5c4106,null))['catch'](handleError(_0x5c4106,null));};exports[_0x592a('0x71')]=function(_0xf4eee0,_0x5d7b50,_0x596ff4){var _0x3bd348={'raw':![],'where':{}};var _0x106407={};var _0x31a75c={'count':0x0,'rows':[]};return db[_0x592a('0x3f')][_0x592a('0x68')]({'where':{'id':_0xf4eee0['params']['id']}})['then'](handleEntityNotFound(_0x5d7b50,null))['then'](function(_0xfb2092){if(_0xfb2092){_0x106407['model']=_[_0x592a('0x5b')](db[_0x592a('0x70')]['rawAttributes']);_0x106407[_0x592a('0x46')]=_[_0x592a('0x5b')](_0xf4eee0[_0x592a('0x46')]);_0x106407[_0x592a('0x47')]=_[_0x592a('0x48')](_0x106407[_0x592a('0x44')],_0x106407[_0x592a('0x46')]);_0x3bd348[_0x592a('0x4a')]=_[_0x592a('0x48')](_0x106407[_0x592a('0x44')],qs[_0x592a('0x49')](_0xf4eee0[_0x592a('0x46')][_0x592a('0x49')]));_0x3bd348[_0x592a('0x4a')]=_0x3bd348[_0x592a('0x4a')][_0x592a('0x4b')]?_0x3bd348[_0x592a('0x4a')]:_0x106407[_0x592a('0x44')];if(!_0xf4eee0[_0x592a('0x46')][_0x592a('0x4c')](_0x592a('0x69'))){_0x3bd348[_0x592a('0x2d')]=qs[_0x592a('0x2d')](_0xf4eee0[_0x592a('0x46')]['limit']);_0x3bd348[_0x592a('0x2b')]=qs['offset'](_0xf4eee0[_0x592a('0x46')][_0x592a('0x2b')]);}_0x3bd348['order']=qs[_0x592a('0x4e')](_0xf4eee0['query'][_0x592a('0x4e')]);_0x3bd348[_0x592a('0x4f')]=qs[_0x592a('0x47')](_['pick'](_0xf4eee0[_0x592a('0x46')],_0x106407[_0x592a('0x47')]));_0x3bd348[_0x592a('0x4f')][_0x592a('0x65')]=_0xfb2092['id'];if(_0xf4eee0[_0x592a('0x46')]['filter']){_0x3bd348[_0x592a('0x4f')]=_[_0x592a('0x52')](_0x3bd348[_0x592a('0x4f')],{'$or':_[_0x592a('0x45')](_0x3bd348[_0x592a('0x4a')],function(_0x35dd0b){var _0xb975b1={};_0xb975b1[_0x35dd0b]={'$like':'%'+_0xf4eee0[_0x592a('0x46')][_0x592a('0x51')]+'%'};return _0xb975b1;})});}_0x3bd348=_['merge']({},_0x3bd348,_0xf4eee0[_0x592a('0x54')]);return db[_0x592a('0x70')]['count']({'where':_0x3bd348[_0x592a('0x4f')]})[_0x592a('0x35')](function(_0x211046){_0x31a75c[_0x592a('0x2e')]=_0x211046;if(_0xf4eee0['query'][_0x592a('0x55')]){_0x3bd348['include']=[{'model':db['CmContact'],'as':_0x592a('0x72'),'required':![]},{'model':db[_0x592a('0x73')],'as':_0x592a('0x74'),'attributes':[_0x592a('0x3a'),_0x592a('0x75'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x592a('0x76')],'where':_0xf4eee0[_0x592a('0x46')][_0x592a('0x77')]?{'id':_0xf4eee0[_0x592a('0x46')][_0x592a('0x77')]}:undefined,'required':_0xf4eee0[_0x592a('0x46')][_0x592a('0x77')]?!![]:![]}];}return db[_0x592a('0x70')][_0x592a('0x57')](_0x3bd348);})[_0x592a('0x35')](function(_0x43cf0e){_0x31a75c[_0x592a('0x58')]=_0x43cf0e;return _0x31a75c;});}})[_0x592a('0x35')](respondWithFilteredResult(_0x5d7b50,_0x3bd348))[_0x592a('0x27')](handleError(_0x5d7b50,null));};exports[_0x592a('0x78')]=function(_0x5f0ab6,_0x46072c){var _0x2ecbcb=_0x5f0ab6[_0x592a('0x5a')]['id'];var _0x371d96=_0x5f0ab6[_0x592a('0x5e')];var _0x2e43cf=0xc8;var _0xe90056=null;return db[_0x592a('0x79')]['transaction']({'isolationLevel':db['sequelize'][_0x592a('0x7a')][_0x592a('0x7b')][_0x592a('0x7c')]},function(_0x4b0821){return db[_0x592a('0x3f')]['findOne']({'where':{'id':_0x2ecbcb},'transaction':_0x4b0821})[_0x592a('0x35')](function(_0x27c570){if(_0x27c570){return db[_0x592a('0x7d')][_0x592a('0x36')]({'where':{'FaxAccountId':_0x2ecbcb},'transaction':_0x4b0821})[_0x592a('0x35')](function(){var _0x16003c=_[_0x592a('0x45')](_0x371d96,function(_0x13e814){_0x13e814['FaxAccountId']=_0x2ecbcb;return _0x13e814;});return db[_0x592a('0x7d')][_0x592a('0x7e')](_0x16003c,{'transaction':_0x4b0821});});}else{_0x2e43cf=0x194;_0xe90056=[];}});})['then'](function(){if(_0x2e43cf!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x2ecbcb},'order':_0x592a('0x7f')})[_0x592a('0x35')](function(_0x3dae23){_0xe90056=_0x3dae23;});}})[_0x592a('0x27')](function(_0x1a53dd){_0x2e43cf=0x1f4;logger['error'](_0x1a53dd[_0x592a('0x80')]);if(_0x1a53dd[_0x592a('0x3a')]){delete _0x1a53dd['name'];}_0xe90056=_0x1a53dd;})[_0x592a('0x81')](function(){if(_0xe90056===null){_0x46072c[_0x592a('0x28')](_0x2e43cf);}else{if(_0x2e43cf===0x1f4){_0x46072c[_0x592a('0x2a')](_0x2e43cf)[_0x592a('0x3b')](_0xe90056);}else{_0x46072c[_0x592a('0x2a')](_0x2e43cf)[_0x592a('0x82')](_0xe90056);}}});};exports[_0x592a('0x83')]=function(_0x5305da,_0x5eb23b,_0x1cf205){var _0x34eb22={};var _0x96164a={};var _0x11434d;var _0x1b99d7;return db['FaxAccount'][_0x592a('0x68')]({'where':{'id':_0x5305da[_0x592a('0x5a')]['id']}})[_0x592a('0x35')](handleEntityNotFound(_0x5eb23b,null))['then'](function(_0x3b84ed){if(_0x3b84ed){_0x11434d=_0x3b84ed;_0x96164a[_0x592a('0x44')]=_[_0x592a('0x5b')](db[_0x592a('0x7d')][_0x592a('0x40')]);_0x96164a['query']=_['keys'](_0x5305da[_0x592a('0x46')]);_0x96164a['filters']=_[_0x592a('0x48')](_0x96164a['model'],_0x96164a[_0x592a('0x46')]);_0x34eb22['attributes']=_[_0x592a('0x48')](_0x96164a['model'],qs[_0x592a('0x49')](_0x5305da[_0x592a('0x46')][_0x592a('0x49')]));_0x34eb22['attributes']=_0x34eb22[_0x592a('0x4a')][_0x592a('0x4b')]?_0x34eb22[_0x592a('0x4a')]:_0x96164a[_0x592a('0x44')];_0x34eb22['order']=qs[_0x592a('0x4e')](_0x5305da['query'][_0x592a('0x4e')]);_0x34eb22[_0x592a('0x4f')]=qs[_0x592a('0x47')](_[_0x592a('0x50')](_0x5305da[_0x592a('0x46')],_0x96164a['filters']));if(_0x5305da[_0x592a('0x46')][_0x592a('0x51')]){_0x34eb22[_0x592a('0x4f')]=_[_0x592a('0x52')](_0x34eb22[_0x592a('0x4f')],{'$or':_[_0x592a('0x45')](_0x34eb22[_0x592a('0x4a')],function(_0x14b7f0){var _0xb9d40c={};_0xb9d40c[_0x14b7f0]={'$like':'%'+_0x5305da[_0x592a('0x46')]['filter']+'%'};return _0xb9d40c;})});}_0x34eb22=_['merge']({},_0x34eb22,_0x5305da[_0x592a('0x54')]);return _0x11434d['getApplications'](_0x34eb22);}})[_0x592a('0x35')](function(_0x383e5d){if(_0x383e5d){_0x1b99d7=_0x383e5d[_0x592a('0x4b')];if(!_0x5305da[_0x592a('0x46')][_0x592a('0x4c')]('nolimit')){_0x34eb22[_0x592a('0x2d')]=qs[_0x592a('0x2d')](_0x5305da[_0x592a('0x46')][_0x592a('0x2d')]);_0x34eb22[_0x592a('0x2b')]=qs[_0x592a('0x2b')](_0x5305da[_0x592a('0x46')][_0x592a('0x2b')]);}return _0x11434d[_0x592a('0x83')](_0x34eb22);}})[_0x592a('0x35')](function(_0x43f2a7){if(_0x43f2a7){return _0x43f2a7?{'count':_0x1b99d7,'rows':_0x43f2a7}:null;}})[_0x592a('0x35')](respondWithResult(_0x5eb23b,null))['catch'](handleError(_0x5eb23b,null));};function Extension(_0x39ceaf,_0x1f1ddb,_0x4c6930,_0x2eb1a2){this[_0x592a('0x84')]='from-voip-provider';this[_0x592a('0x85')]=_0x39ceaf[_0x592a('0x86')];this[_0x592a('0x87')]=_0x2eb1a2;this[_0x592a('0x42')]=_0x592a('0x88');this['description']=_0x592a('0x89');this[_0x592a('0x65')]=_0x39ceaf['id'];this['priority']=_0x1f1ddb;this[_0x592a('0x8a')]=_0x4c6930;}function createExtensionsReciveFax(_0x15b7cd){var _0x182e62=0x1;var _0x2523ae=[];_0x2523ae[_0x592a('0x8b')](new Extension(_0x15b7cd,_0x182e62,'',_0x592a('0x8c')));_0x182e62+=0x1;_0x2523ae[_0x592a('0x8b')](new Extension(_0x15b7cd,_0x182e62,_0x592a('0x8d'),_0x592a('0x8e')));_0x182e62+=0x1;for(var _0x56d43f in _0x15b7cd){if(_0x15b7cd[_0x592a('0x4c')](_0x56d43f)&&(_0x56d43f===_0x592a('0x8f')||_0x56d43f===_0x592a('0x86')||_0x56d43f===_0x592a('0x90')||_0x56d43f===_0x592a('0x91')||_0x56d43f===_0x592a('0x92')||_0x56d43f==='maxrate'||_0x56d43f===_0x592a('0x93')||_0x56d43f===_0x592a('0x94')||_0x56d43f===_0x592a('0x95'))){_0x2523ae[_0x592a('0x8b')](new Extension(_0x15b7cd,_0x182e62,_0x592a('0x96')+_0x56d43f+')='+_0x15b7cd[_0x56d43f],'Set'));_0x182e62+=0x1;}}_0x2523ae['push'](new Extension(_0x15b7cd,_0x182e62,'6','Wait'));_0x182e62+=0x1;_0x2523ae[_0x592a('0x8b')](new Extension(_0x15b7cd,_0x182e62,'/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',_0x592a('0x97')));_0x182e62=0x0;return _0x2523ae;}exports[_0x592a('0x98')]=function(_0x256b94,_0x309978,_0x284e2c){var _0x58a60b;return db['sequelize'][_0x592a('0x99')](function(_0xc7c48f){return db[_0x592a('0x3f')][_0x592a('0x5d')](_0x256b94[_0x592a('0x5e')],{'transaction':_0xc7c48f})['then'](function(_0x14e77b){_0x58a60b=_0x14e77b['get']({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x58a60b),{'transaction':_0xc7c48f});});})[_0x592a('0x35')](function(){return _0x58a60b;})[_0x592a('0x35')](respondWithResult(_0x309978,null))[_0x592a('0x27')](handleError(_0x309978,null));};exports[_0x592a('0x9a')]=function(_0x2a420f,_0x1c2be8,_0x49accb){var _0x35d0fd;return db[_0x592a('0x79')][_0x592a('0x99')](function(_0x291d19){return db[_0x592a('0x3f')][_0x592a('0x34')](_0x2a420f[_0x592a('0x5e')],{'where':{'id':_0x2a420f[_0x592a('0x5e')]['id']},'transaction':_0x291d19})[_0x592a('0x35')](function(_0x137a82){return db[_0x592a('0x9b')]['destroy']({'where':{'FaxAccountId':_0x2a420f['body']['id']},'transaction':_0x291d19})[_0x592a('0x35')](function(_0x1cc02d){return db[_0x592a('0x9b')][_0x592a('0x7e')](createExtensionsReciveFax(_[_0x592a('0x9c')](_0x2a420f[_0x592a('0x5e')],['tech',_0x592a('0x43'),_0x592a('0x9d'),_0x592a('0x9e'),'TrunkId',_0x592a('0x9f')])),{'transaction':_0x291d19});});});})[_0x592a('0x35')](function(){return db[_0x592a('0x3f')]['findById'](_0x2a420f[_0x592a('0x5e')]['id']);})[_0x592a('0x35')](respondWithResult(_0x1c2be8,null))['catch'](handleError(_0x1c2be8,null));};exports['getMessages']=function(_0x26e165,_0xc1ef8c,_0x210bbf){var _0x961550={'raw':!![],'where':{}};var _0x15c71e={};var _0x2c658d={'count':0x0,'rows':[]};return db[_0x592a('0x3f')][_0x592a('0x68')]({'where':{'id':_0x26e165['params']['id']}})[_0x592a('0x35')](handleEntityNotFound(_0xc1ef8c,null))['then'](function(_0x55d98b){if(_0x55d98b){_0x15c71e[_0x592a('0x44')]=_[_0x592a('0x5b')](db[_0x592a('0xa0')]['rawAttributes']);_0x15c71e[_0x592a('0x46')]=_['keys'](_0x26e165[_0x592a('0x46')]);_0x15c71e['filters']=_['intersection'](_0x15c71e[_0x592a('0x44')],_0x15c71e['query']);_0x961550[_0x592a('0x4a')]=_[_0x592a('0x48')](_0x15c71e[_0x592a('0x44')],qs['fields'](_0x26e165[_0x592a('0x46')]['fields']));_0x961550['attributes']=_0x961550[_0x592a('0x4a')]['length']?_0x961550[_0x592a('0x4a')]:_0x15c71e['model'];if(!_0x26e165[_0x592a('0x46')][_0x592a('0x4c')](_0x592a('0x69'))){_0x961550['limit']=qs['limit'](_0x26e165[_0x592a('0x46')][_0x592a('0x2d')]);_0x961550[_0x592a('0x2b')]=qs[_0x592a('0x2b')](_0x26e165[_0x592a('0x46')][_0x592a('0x2b')]);}_0x961550[_0x592a('0x4d')]=qs['sort'](_0x26e165[_0x592a('0x46')][_0x592a('0x4e')]);_0x961550[_0x592a('0x4f')]=qs[_0x592a('0x47')](_[_0x592a('0x50')](_0x26e165[_0x592a('0x46')],_0x15c71e[_0x592a('0x47')]));_0x961550[_0x592a('0x4f')][_0x592a('0x65')]=_0x55d98b['id'];if(_0x26e165[_0x592a('0x46')][_0x592a('0x51')]){_0x961550[_0x592a('0x4f')]=_[_0x592a('0x52')](_0x961550['where'],{'$or':_[_0x592a('0x45')](_0x961550[_0x592a('0x4a')],function(_0x23aa0b){var _0x186703={};_0x186703[_0x23aa0b]={'$like':'%'+_0x26e165[_0x592a('0x46')][_0x592a('0x51')]+'%'};return _0x186703;})});}if(_0x26e165['query'][_0x592a('0xa1')]){var _0x409ff2=_0x26e165['query'][_0x592a('0xa1')][_0x592a('0xa2')](',');var _0x343002={};_0x343002[_0x409ff2[0x0]]={'$gte':moment(_0x409ff2[0x1])[_0x592a('0xa3')](_0x592a('0xa4'))};_0x961550[_0x592a('0x4f')]=_[_0x592a('0x52')](_0x961550['where'],_0x343002);}_0x961550=_['merge']({},_0x961550,_0x26e165[_0x592a('0x54')]);return db[_0x592a('0xa0')][_0x592a('0x2e')]({'where':_0x961550[_0x592a('0x4f')]})['then'](function(_0x58c484){_0x2c658d[_0x592a('0x2e')]=_0x58c484;if(_0x26e165[_0x592a('0x46')][_0x592a('0x55')]){_0x961550[_0x592a('0x56')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x961550);})['then'](function(_0x36396d){_0x2c658d[_0x592a('0x58')]=_0x36396d;return _0x2c658d;});}})[_0x592a('0x35')](respondWithFilteredResult(_0xc1ef8c,_0x961550))[_0x592a('0x27')](handleError(_0xc1ef8c,null));};exports['send']=function(_0x5cf972,_0x475b84,_0x84ce35){var _0x5cdbd2,_0x41244a={},_0x26e45d;if(_0x5cf972[_0x592a('0x5e')]['to']){_0x26e45d=_0x5cf972[_0x592a('0x5e')]['to'][0x0];}return db[_0x592a('0x3f')][_0x592a('0x5c')]({'where':{'id':_0x5cf972[_0x592a('0x5a')]['id']},'include':[{'model':db[_0x592a('0xa5')],'as':_0x592a('0xa6'),'include':[{'model':db[_0x592a('0xa7')],'as':_0x592a('0xa8'),'where':{'fax':_0x26e45d},'limit':0x1,'order':[['updatedAt',_0x592a('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x475b84,null))[_0x592a('0x35')](function(_0x10b6f2){_0x5cdbd2=_0x10b6f2;if(_0x5cf972[_0x592a('0x5e')][_0x592a('0xaa')]&&_0x5cf972['body'][_0x592a('0xaa')][_0x592a('0x4b')]){for(var _0x1932e8=0x0;_0x1932e8<_0x5cf972['body'][_0x592a('0xaa')][_0x592a('0x4b')];_0x1932e8+=0x1){_0x5cf972[_0x592a('0x5e')][_0x592a('0xaa')][_0x1932e8]={'filename':_0x5cf972['body'][_0x592a('0xaa')][_0x1932e8][_0x592a('0x3a')],'id':_0x5cf972[_0x592a('0x5e')]['attachments'][_0x1932e8]['id'],'path':path['join'](config['root'],_0x592a('0xab'),_0x5cf972[_0x592a('0x5e')][_0x592a('0xaa')][_0x1932e8][_0x592a('0xac')])};}}return respondWithRpcPromise(_0x592a('0xad'),_0x592a('0xad'),{'FaxAccountId':_[_0x592a('0xae')](_0x5cf972[_0x592a('0x5a')]['id'])?undefined:_0x5cf972[_0x592a('0x5a')]['id'],'path':_['isNil'](_0x5cf972[_0x592a('0x5e')][_0x592a('0xaa')][0x0][_0x592a('0x6')])?undefined:_0x5cf972['body'][_0x592a('0xaa')][0x0][_0x592a('0x6')],'fax':_['isNil'](_0x5cf972[_0x592a('0x5e')]['to'][0x0])?undefined:_0x5cf972[_0x592a('0x5e')]['to'][0x0]},client9002);})[_0x592a('0x35')](function(){if(_0x5cdbd2){if(_['isNil'](_0x5cf972['body']['from'])){_0x5cf972[_0x592a('0x5e')]['from']=util[_0x592a('0xa3')](_0x592a('0xaf'),_0x5cdbd2['name'],_0x5cdbd2[_0x592a('0xb0')]);}if(_0x5cdbd2[_0x592a('0xa6')]){if(_0x5cdbd2[_0x592a('0xa6')][_0x592a('0xa8')]['length']){return _0x5cdbd2['List'][_0x592a('0xa8')][0x0];}else{return db[_0x592a('0xa7')]['create'](_[_0x592a('0x18')](_0x5cf972[_0x592a('0x5e')],{'firstName':_0x5cf972['body']['to'][0x0],'phone':_0x5cf972['body']['to'][0x0],'fax':_0x5cf972[_0x592a('0x5e')]['to'][0x0],'ListId':_0x5cdbd2[_0x592a('0x9f')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x592a('0xb1'));}})[_0x592a('0x35')](function(_0x537ec6){if(_0x537ec6){return db[_0x592a('0x70')][_0x592a('0x5c')]({'where':{'ContactId':_0x537ec6['id'],'closed':![],'FaxAccountId':_0x5cdbd2['id']}})['then'](function(_0x1d6087){if(_0x1d6087){return[_0x1d6087,![]];}return db[_0x592a('0x70')][_0x592a('0x5d')]({'UserId':_0x5cf972[_0x592a('0x5f')]['id'],'ContactId':_0x537ec6['id'],'FaxAccountId':_0x5cdbd2['id'],'fax':_0x5cf972['body']['to'][0x0],'firstMsgDirection':_0x592a('0xb2'),'Messages':[_[_0x592a('0x52')](_0x5cf972['body'],{'read':![],'body':_0x5cf972[_0x592a('0x5e')][_0x592a('0xaa')][0x0][_0x592a('0xb3')],'FaxAccountId':_0x5cdbd2['id'],'UserId':_0x5cf972[_0x592a('0x5f')]['id'],'ContactId':_0x537ec6['id'],'AttachmentId':_0x5cf972[_0x592a('0x5e')][_0x592a('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x592a('0xa0')],'as':'Messages'}]})['then'](function(_0x5c184b){return[_0x5c184b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x592a('0xb4')](function(_0x380c56,_0x3864a7){if(_0x3864a7){return _0x380c56;}return db[_0x592a('0xa0')][_0x592a('0x5d')]({'direction':_0x592a('0xb2'),'read':![],'body':_0x5cf972[_0x592a('0x5e')][_0x592a('0xaa')][0x0][_0x592a('0xb3')],'FaxAccountId':_0x5cdbd2['id'],'FaxInteractionId':_0x380c56['id'],'UserId':_0x5cf972[_0x592a('0x5f')]['id'],'ContactId':_0x380c56[_0x592a('0xb5')],'AttachmentId':_0x5cf972[_0x592a('0x5e')][_0x592a('0xaa')][0x0]['id']})['then'](function(_0x38c43e){_0x380c56[_0x592a('0xb6')][_0x592a('0xb7')]=[];_0x380c56['dataValues'][_0x592a('0xb7')][_0x592a('0x8b')](_0x38c43e['dataValues']);return _0x380c56;});})['then'](function(_0xb61fb){respondWithRpcPromise(_0x592a('0xb8'),_0x592a('0xb8'),{'FaxAccountId':_[_0x592a('0xae')](_0x5cf972['params']['id'])?undefined:_0x5cf972[_0x592a('0x5a')]['id'],'path':_['isNil'](_0x5cf972['body'][_0x592a('0xaa')][0x0]['path'])?undefined:_0x5cf972[_0x592a('0x5e')][_0x592a('0xaa')][0x0][_0x592a('0x6')],'fax':_[_0x592a('0xae')](_0x5cf972['body']['to'][0x0])?undefined:_0x5cf972[_0x592a('0x5e')]['to'][0x0],'AttachmentId':_0x5cf972['body']['attachments'][0x0]['id']},client9002)[_0x592a('0x35')](function(_0x1918d5){logger[_0x592a('0x26')]('SendFaxRpc,\x20%s',_0x1918d5);})['catch'](function(_0x2ae620){logger[_0x592a('0x26')](_0x592a('0xb9'),_0x2ae620);});return _0xb61fb;})[_0x592a('0x35')](respondWithResult(_0x475b84,null))['catch'](handleError(_0x475b84,null));};exports['addAgents']=function(_0x4997a4,_0x41bf46,_0x29917a){return db['FaxAccount'][_0x592a('0x5c')]({'where':{'id':_0x4997a4[_0x592a('0x5a')]['id']}})[_0x592a('0x35')](handleEntityNotFound(_0x41bf46,null))[_0x592a('0x35')](function(_0x97fc4d){if(_0x97fc4d){return _0x97fc4d[_0x592a('0xba')](_0x4997a4[_0x592a('0x5e')][_0x592a('0x6f')],_[_0x592a('0x9c')](_0x4997a4[_0x592a('0x5e')],[_0x592a('0x6f'),'id'])||{})[_0x592a('0xb4')](function(_0x19af08){for(var _0x3060ce=0x0;_0x3060ce<_0x4997a4[_0x592a('0x5e')][_0x592a('0x6f')]['length'];_0x3060ce+=0x1){socket[_0x592a('0xbb')]('userFaxAccount:save',{'UserId':Number(_0x4997a4[_0x592a('0x5e')][_0x592a('0x6f')][_0x3060ce]),'FaxAccountId':Number(_0x4997a4[_0x592a('0x5a')]['id'])});}return _0x19af08;});}})[_0x592a('0x35')](respondWithResult(_0x41bf46,null))[_0x592a('0x27')](handleError(_0x41bf46,null));};exports['removeAgents']=function(_0x3ee915,_0x1810d8,_0x38621f){return db[_0x592a('0x3f')][_0x592a('0x5c')]({'where':{'id':_0x3ee915[_0x592a('0x5a')]['id']}})[_0x592a('0x35')](handleEntityNotFound(_0x1810d8,null))[_0x592a('0x35')](function(_0x38bdaf){if(_0x38bdaf){return _0x38bdaf[_0x592a('0xbc')](_0x3ee915[_0x592a('0x46')]['ids'])['then'](function(){if(_['isArray'](_0x3ee915[_0x592a('0x46')][_0x592a('0x6f')])){for(var _0x7e9e34=0x0;_0x7e9e34<_0x3ee915['query']['ids'][_0x592a('0x4b')];_0x7e9e34+=0x1){socket[_0x592a('0xbb')](_0x592a('0xbd'),{'UserId':Number(_0x3ee915[_0x592a('0x46')]['ids'][_0x7e9e34]),'FaxAccountId':Number(_0x3ee915[_0x592a('0x5a')]['id'])});}}else{socket[_0x592a('0xbb')]('userFaxAccount:remove',{'UserId':Number(_0x3ee915['query']['ids']),'FaxAccountId':Number(_0x3ee915[_0x592a('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1810d8,null))[_0x592a('0x27')](handleError(_0x1810d8,null));};exports[_0x592a('0xbe')]=function(_0x415156,_0x3c412a,_0x594c96){var _0x11299d={};var _0x52f7cb={};var _0x3ede7e;var _0x3643f5;return db[_0x592a('0x3f')][_0x592a('0x68')]({'where':{'id':_0x415156[_0x592a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3c412a,null))[_0x592a('0x35')](function(_0x216e5f){if(_0x216e5f){_0x3ede7e=_0x216e5f;_0x52f7cb[_0x592a('0x44')]=_['keys'](db['User'][_0x592a('0x40')]);_0x52f7cb[_0x592a('0x46')]=_[_0x592a('0x5b')](_0x415156[_0x592a('0x46')]);_0x52f7cb[_0x592a('0x47')]=_[_0x592a('0x48')](_0x52f7cb[_0x592a('0x44')],_0x52f7cb[_0x592a('0x46')]);_0x11299d[_0x592a('0x4a')]=_[_0x592a('0x48')](_0x52f7cb[_0x592a('0x44')],qs[_0x592a('0x49')](_0x415156[_0x592a('0x46')][_0x592a('0x49')]));_0x11299d[_0x592a('0x4a')]=_0x11299d[_0x592a('0x4a')][_0x592a('0x4b')]?_0x11299d['attributes']:_0x52f7cb[_0x592a('0x44')];_0x11299d['order']=qs[_0x592a('0x4e')](_0x415156[_0x592a('0x46')]['sort']);_0x11299d[_0x592a('0x4f')]=qs[_0x592a('0x47')](_['pick'](_0x415156[_0x592a('0x46')],_0x52f7cb[_0x592a('0x47')]));if(_0x415156[_0x592a('0x46')][_0x592a('0x51')]){_0x11299d[_0x592a('0x4f')]=_[_0x592a('0x52')](_0x11299d['where'],{'$or':_[_0x592a('0x45')](_0x11299d['attributes'],function(_0xee6af2){var _0x5c6203={};_0x5c6203[_0xee6af2]={'$like':'%'+_0x415156[_0x592a('0x46')][_0x592a('0x51')]+'%'};return _0x5c6203;})});}_0x11299d=_[_0x592a('0x52')]({},_0x11299d,_0x415156['options']);return _0x3ede7e[_0x592a('0xbe')](_0x11299d);}})[_0x592a('0x35')](function(_0x4aefd6){if(_0x4aefd6){_0x3643f5=_0x4aefd6[_0x592a('0x4b')];if(!_0x415156[_0x592a('0x46')][_0x592a('0x4c')]('nolimit')){_0x11299d['limit']=qs[_0x592a('0x2d')](_0x415156['query'][_0x592a('0x2d')]);_0x11299d[_0x592a('0x2b')]=qs[_0x592a('0x2b')](_0x415156['query']['offset']);}return _0x3ede7e[_0x592a('0xbe')](_0x11299d);}})[_0x592a('0x35')](function(_0x2aff){if(_0x2aff){return _0x2aff?{'count':_0x3643f5,'rows':_0x2aff}:null;}})['then'](respondWithResult(_0x3c412a,null))[_0x592a('0x27')](handleError(_0x3c412a,null));}; \ No newline at end of file +var _0x03b2=['List','Contacts','DESC','attachments','join','root','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','defaults','redis','./faxAccount.socket','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','findOne','nolimit','order','sort','options','include','removeDispositions','ids','CannedAnswer','getAnswers','rows','removeAnswers','FaxInteraction','addInteraction','omit','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','bulkCreate','priority','finally','getApplications','context','localstationid','system','description','appdata','push','CDR(type)=inbound-fax','Set','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList'];(function(_0x631577,_0x38e35d){var _0x517397=function(_0x4f9228){while(--_0x4f9228){_0x631577['push'](_0x631577['shift']());}};_0x517397(++_0x38e35d);}(_0x03b2,0x1a4));var _0x203b=function(_0xe672c8,_0x3ae505){_0xe672c8=_0xe672c8-0x0;var _0x104b7f=_0x03b2[_0xe672c8];return _0x104b7f;};'use strict';var emlformat=require(_0x203b('0x0'));var rimraf=require(_0x203b('0x1'));var zipdir=require(_0x203b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x203b('0x3'));var moment=require(_0x203b('0x4'));var BPromise=require(_0x203b('0x5'));var Mustache=require(_0x203b('0x6'));var util=require('util');var path=require(_0x203b('0x7'));var sox=require(_0x203b('0x8'));var csv=require(_0x203b('0x9'));var ejs=require(_0x203b('0xa'));var fs=require('fs');var fs_extra=require(_0x203b('0xb'));var _=require(_0x203b('0xc'));var squel=require(_0x203b('0xd'));var crypto=require('crypto');var jsforce=require(_0x203b('0xe'));var deskjs=require(_0x203b('0xf'));var toCsv=require(_0x203b('0x9'));var querystring=require(_0x203b('0x10'));var Papa=require(_0x203b('0x11'));var Redis=require(_0x203b('0x12'));var authService=require(_0x203b('0x13'));var qs=require(_0x203b('0x14'));var as=require(_0x203b('0x15'));var hardwareService=require(_0x203b('0x16'));var logger=require('../../config/logger')(_0x203b('0x17'));var utils=require('../../config/utils');var config=require(_0x203b('0x18'));var licenseUtil=require(_0x203b('0x19'));var db=require(_0x203b('0x1a'))['db'];config['redis']=_[_0x203b('0x1b')](config[_0x203b('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x203b('0x1c')]));require(_0x203b('0x1d'))[_0x203b('0x1e')](socket);var jayson=require(_0x203b('0x1f'));var client=jayson[_0x203b('0x20')][_0x203b('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1cead6,_0x32e837,_0x594715,_0x8e2cf4){return new BPromise(function(_0x413f2a,_0x12b3c1){var _0x488383=_0x8e2cf4||client;return _0x488383[_0x203b('0x22')](_0x1cead6,_0x594715)[_0x203b('0x23')](function(_0x38346e){logger['info'](_0x203b('0x24'),_0x32e837,_0x203b('0x25'));logger[_0x203b('0x26')](_0x203b('0x27'),_0x32e837,_0x203b('0x25'),JSON[_0x203b('0x28')](_0x38346e));if(_0x38346e[_0x203b('0x29')]){if(_0x38346e['error'][_0x203b('0x2a')]===0x1f4){logger[_0x203b('0x29')]('FaxAccount,\x20%s,\x20%s',_0x32e837,_0x38346e[_0x203b('0x29')][_0x203b('0x2b')]);return _0x12b3c1(_0x38346e[_0x203b('0x29')][_0x203b('0x2b')]);}logger[_0x203b('0x29')](_0x203b('0x24'),_0x32e837,_0x38346e[_0x203b('0x29')][_0x203b('0x2b')]);return _0x413f2a(_0x38346e[_0x203b('0x29')][_0x203b('0x2b')]);}else{logger[_0x203b('0x2c')](_0x203b('0x24'),_0x32e837,'request\x20sent');_0x413f2a(_0x38346e[_0x203b('0x2d')]['message']);}})[_0x203b('0x2e')](function(_0x26b652){logger[_0x203b('0x29')](_0x203b('0x24'),_0x32e837,_0x26b652);_0x12b3c1(_0x26b652);});});}function respondWithStatusCode(_0xb4692b,_0x3e9d94){_0x3e9d94=_0x3e9d94||0xcc;return function(_0x39d63b){if(_0x39d63b){return _0xb4692b['sendStatus'](_0x3e9d94);}return _0xb4692b[_0x203b('0x2f')](_0x3e9d94)['end']();};}function respondWithResult(_0x52a8e4,_0x3670fe){_0x3670fe=_0x3670fe||0xc8;return function(_0x5b28e3){if(_0x5b28e3){return _0x52a8e4[_0x203b('0x2f')](_0x3670fe)[_0x203b('0x30')](_0x5b28e3);}};}function respondWithFilteredResult(_0x98f45d,_0x2077d1){return function(_0x390140){if(_0x390140){var _0x4e212e=typeof _0x2077d1['offset']===_0x203b('0x31')&&typeof _0x2077d1[_0x203b('0x32')]===_0x203b('0x31');var _0x2d7210=_0x390140[_0x203b('0x33')];var _0x2222d4=_0x4e212e?0x0:_0x2077d1[_0x203b('0x34')];var _0x1333af=_0x4e212e?_0x390140[_0x203b('0x33')]:_0x2077d1[_0x203b('0x34')]+_0x2077d1[_0x203b('0x32')];var _0x280c85;if(_0x1333af>=_0x2d7210){_0x1333af=_0x2d7210;_0x280c85=0xc8;}else{_0x280c85=0xce;}_0x98f45d['status'](_0x280c85);return _0x98f45d['set'](_0x203b('0x35'),_0x2222d4+'-'+_0x1333af+'/'+_0x2d7210)[_0x203b('0x30')](_0x390140);}return null;};}function patchUpdates(_0x218970){return function(_0x12c796){try{jsonpatch[_0x203b('0x36')](_0x12c796,_0x218970,!![]);}catch(_0x5f184d){return BPromise[_0x203b('0x37')](_0x5f184d);}return _0x12c796[_0x203b('0x38')]();};}function saveUpdates(_0x15b550,_0x344fc2){return function(_0x1c62f5){if(_0x1c62f5){return _0x1c62f5[_0x203b('0x39')](_0x15b550)[_0x203b('0x23')](function(_0x60ef){return _0x60ef;});}return null;};}function removeEntity(_0x244a3f,_0x3bda3f){return function(_0xd371fe){if(_0xd371fe){return _0xd371fe[_0x203b('0x3a')]()[_0x203b('0x23')](function(){var _0x5b648d=_0xd371fe[_0x203b('0x3b')]({'plain':!![]});var _0x4616e6='FaxAccounts';return db[_0x203b('0x3c')][_0x203b('0x3a')]({'where':{'type':_0x4616e6,'resourceId':_0x5b648d['id']}})[_0x203b('0x23')](function(){return _0xd371fe;});})[_0x203b('0x23')](function(){_0x244a3f[_0x203b('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x132c13,_0x4cf84f){return function(_0x9346e1){if(!_0x9346e1){_0x132c13[_0x203b('0x3d')](0x194);}return _0x9346e1;};}function handleError(_0x443c01,_0x5d955b){_0x5d955b=_0x5d955b||0x1f4;return function(_0x57f9cc){logger[_0x203b('0x29')](_0x57f9cc[_0x203b('0x3e')]);if(_0x57f9cc[_0x203b('0x3f')]){delete _0x57f9cc[_0x203b('0x3f')];}_0x443c01[_0x203b('0x2f')](_0x5d955b)[_0x203b('0x40')](_0x57f9cc);};}exports['index']=function(_0x26a052,_0x581376){var _0x56cf4f={'include':[{'model':db[_0x203b('0x41')],'as':_0x203b('0x42')}]},_0x10e64a={},_0x17e0eb={'count':0x0,'rows':[]};var _0x1e5b73=_[_0x203b('0x43')](db[_0x203b('0x44')][_0x203b('0x45')],function(_0x3287e0){return{'name':_0x3287e0[_0x203b('0x46')],'type':_0x3287e0[_0x203b('0x47')][_0x203b('0x48')]};});_0x10e64a[_0x203b('0x49')]=_[_0x203b('0x43')](_0x1e5b73,'name');_0x10e64a[_0x203b('0x4a')]=_[_0x203b('0x4b')](_0x26a052['query']);_0x10e64a[_0x203b('0x4c')]=_[_0x203b('0x4d')](_0x10e64a[_0x203b('0x49')],_0x10e64a[_0x203b('0x4a')]);_0x56cf4f[_0x203b('0x4e')]=_[_0x203b('0x4d')](_0x10e64a[_0x203b('0x49')],qs[_0x203b('0x4f')](_0x26a052[_0x203b('0x4a')][_0x203b('0x4f')]));_0x56cf4f['attributes']=_0x56cf4f[_0x203b('0x4e')]['length']?_0x56cf4f[_0x203b('0x4e')]:_0x10e64a['model'];if(!_0x26a052[_0x203b('0x4a')][_0x203b('0x50')]('nolimit')){_0x56cf4f['limit']=qs[_0x203b('0x32')](_0x26a052['query'][_0x203b('0x32')]);_0x56cf4f[_0x203b('0x34')]=qs[_0x203b('0x34')](_0x26a052[_0x203b('0x4a')]['offset']);}_0x56cf4f['order']=qs['sort'](_0x26a052[_0x203b('0x4a')]['sort']);_0x56cf4f[_0x203b('0x51')]=qs[_0x203b('0x4c')](_[_0x203b('0x52')](_0x26a052[_0x203b('0x4a')],_0x10e64a['filters']),_0x1e5b73);if(_0x26a052[_0x203b('0x4a')][_0x203b('0x53')]){_0x56cf4f['where']=_[_0x203b('0x54')](_0x56cf4f[_0x203b('0x51')],{'$or':_[_0x203b('0x43')](_0x1e5b73,function(_0x211ab4){if(_0x211ab4[_0x203b('0x47')]!==_0x203b('0x55')){var _0x4583a3={};_0x4583a3[_0x211ab4[_0x203b('0x3f')]]={'$like':'%'+_0x26a052[_0x203b('0x4a')][_0x203b('0x53')]+'%'};return _0x4583a3;}})});}_0x56cf4f=_[_0x203b('0x54')]({},_0x56cf4f,_0x26a052['options']);var _0xcb8d3c={'where':_0x56cf4f['where']};return db[_0x203b('0x44')][_0x203b('0x33')](_0xcb8d3c)[_0x203b('0x23')](function(_0x3349bc){_0x17e0eb[_0x203b('0x33')]=_0x3349bc;if(_0x26a052[_0x203b('0x4a')][_0x203b('0x56')]){_0x56cf4f['include']=[{'all':!![]}];}return db['FaxAccount'][_0x203b('0x57')](_0x56cf4f);})[_0x203b('0x23')](function(_0x5909c0){_0x17e0eb['rows']=_0x5909c0;return _0x17e0eb;})['then'](respondWithFilteredResult(_0x581376,_0x56cf4f))['catch'](handleError(_0x581376,null));};exports[_0x203b('0x58')]=function(_0x5ed35c,_0x435a7a){var _0x72f013={'raw':![],'where':{'id':_0x5ed35c['params']['id']},'include':[{'model':db[_0x203b('0x41')],'as':_0x203b('0x42')}]},_0x2022cd={};_0x2022cd[_0x203b('0x49')]=_[_0x203b('0x4b')](db[_0x203b('0x44')][_0x203b('0x45')]);_0x2022cd[_0x203b('0x4a')]=_['keys'](_0x5ed35c['query']);_0x2022cd['filters']=_[_0x203b('0x4d')](_0x2022cd[_0x203b('0x49')],_0x2022cd[_0x203b('0x4a')]);_0x72f013[_0x203b('0x4e')]=_[_0x203b('0x4d')](_0x2022cd[_0x203b('0x49')],qs['fields'](_0x5ed35c['query'][_0x203b('0x4f')]));_0x72f013['attributes']=_0x72f013['attributes'][_0x203b('0x59')]?_0x72f013[_0x203b('0x4e')]:_0x2022cd[_0x203b('0x49')];if(_0x5ed35c['query'][_0x203b('0x56')]){_0x72f013['include']=[{'all':!![]}];}_0x72f013=_[_0x203b('0x54')]({},_0x72f013,_0x5ed35c['options']);return db['FaxAccount'][_0x203b('0x5a')](_0x72f013)[_0x203b('0x23')](handleEntityNotFound(_0x435a7a,null))['then'](respondWithResult(_0x435a7a,null))[_0x203b('0x2e')](handleError(_0x435a7a,null));};exports[_0x203b('0x5b')]=function(_0x165402,_0xaa6a1){return db[_0x203b('0x44')][_0x203b('0x5b')](_0x165402[_0x203b('0x5c')],{})[_0x203b('0x23')](function(_0xd32552){var _0xfa752d=_0x165402[_0x203b('0x5d')][_0x203b('0x3b')]({'plain':!![]});if(!_0xfa752d)throw new Error(_0x203b('0x5e'));if(_0xfa752d[_0x203b('0x5f')]===_0x203b('0x5d')){var _0x489157=_0xd32552[_0x203b('0x3b')]({'plain':!![]});var _0x438aa2=_0x203b('0x60');return db['UserProfileSection']['find']({'where':{'name':_0x438aa2,'userProfileId':_0xfa752d[_0x203b('0x61')]},'raw':!![]})[_0x203b('0x23')](function(_0x52ef43){if(_0x52ef43&&_0x52ef43[_0x203b('0x62')]===0x0){return db[_0x203b('0x3c')][_0x203b('0x5b')]({'name':_0x489157[_0x203b('0x3f')],'resourceId':_0x489157['id'],'type':_0x52ef43['name'],'sectionId':_0x52ef43['id']},{})[_0x203b('0x23')](function(){return _0xd32552;});}else{return _0xd32552;}})[_0x203b('0x2e')](function(_0x4ac4a7){logger[_0x203b('0x29')](_0x203b('0x63'),_0x4ac4a7);throw _0x4ac4a7;});}return _0xd32552;})['then'](respondWithResult(_0xaa6a1,0xc9))[_0x203b('0x2e')](handleError(_0xaa6a1,null));};exports[_0x203b('0x39')]=function(_0x4dc21b,_0x26aa07){if(_0x4dc21b[_0x203b('0x5c')]['id']){delete _0x4dc21b[_0x203b('0x5c')]['id'];}return db[_0x203b('0x44')][_0x203b('0x5a')]({'where':{'id':_0x4dc21b['params']['id']},'include':[{'model':db[_0x203b('0x41')],'as':'mandatoryDispositionPause'}]})[_0x203b('0x23')](handleEntityNotFound(_0x26aa07,null))[_0x203b('0x23')](saveUpdates(_0x4dc21b['body'],null))[_0x203b('0x23')](respondWithResult(_0x26aa07,null))[_0x203b('0x2e')](handleError(_0x26aa07,null));};exports[_0x203b('0x3a')]=function(_0x2c7835,_0x33cc1c){return db[_0x203b('0x44')][_0x203b('0x5a')]({'where':{'id':_0x2c7835[_0x203b('0x64')]['id']}})[_0x203b('0x23')](handleEntityNotFound(_0x33cc1c,null))[_0x203b('0x23')](removeEntity(_0x33cc1c,null))[_0x203b('0x2e')](handleError(_0x33cc1c,null));};exports[_0x203b('0x65')]=function(_0x47af68,_0x1ce083){return db['FaxAccount'][_0x203b('0x65')]()['then'](respondWithResult(_0x1ce083,null))['catch'](handleError(_0x1ce083,null));};exports[_0x203b('0x66')]=function(_0x50eeb3,_0x5505f1,_0x16d13f){if(_0x50eeb3['body']['id']){delete _0x50eeb3[_0x203b('0x5c')]['id'];}return db[_0x203b('0x44')]['find']({'where':{'id':_0x50eeb3[_0x203b('0x64')]['id']}})[_0x203b('0x23')](handleEntityNotFound(_0x5505f1,null))[_0x203b('0x23')](function(_0x13b404){if(_0x13b404){_0x50eeb3['body'][_0x203b('0x67')]=_0x13b404['id'];return db[_0x203b('0x68')][_0x203b('0x5b')](_0x50eeb3[_0x203b('0x5c')]);}})[_0x203b('0x23')](respondWithResult(_0x5505f1,null))[_0x203b('0x2e')](handleError(_0x5505f1,null));};exports['getDispositions']=function(_0x4ff3da,_0x44af45,_0x110dcd){var _0x2b3f13={'raw':![],'where':{}};var _0x3fb2f7={};var _0xf59e33={'count':0x0,'rows':[]};return db['FaxAccount'][_0x203b('0x69')]({'where':{'id':_0x4ff3da[_0x203b('0x64')]['id']}})[_0x203b('0x23')](handleEntityNotFound(_0x44af45,null))[_0x203b('0x23')](function(_0x1411c4){if(_0x1411c4){_0x3fb2f7[_0x203b('0x49')]=_[_0x203b('0x4b')](db['Disposition'][_0x203b('0x45')]);_0x3fb2f7[_0x203b('0x4a')]=_[_0x203b('0x4b')](_0x4ff3da['query']);_0x3fb2f7[_0x203b('0x4c')]=_['intersection'](_0x3fb2f7[_0x203b('0x49')],_0x3fb2f7[_0x203b('0x4a')]);_0x2b3f13['attributes']=_['intersection'](_0x3fb2f7[_0x203b('0x49')],qs['fields'](_0x4ff3da[_0x203b('0x4a')][_0x203b('0x4f')]));_0x2b3f13['attributes']=_0x2b3f13[_0x203b('0x4e')][_0x203b('0x59')]?_0x2b3f13['attributes']:_0x3fb2f7['model'];if(!_0x4ff3da['query']['hasOwnProperty'](_0x203b('0x6a'))){_0x2b3f13['limit']=qs[_0x203b('0x32')](_0x4ff3da['query']['limit']);_0x2b3f13[_0x203b('0x34')]=qs['offset'](_0x4ff3da['query'][_0x203b('0x34')]);}_0x2b3f13[_0x203b('0x6b')]=qs['sort'](_0x4ff3da['query'][_0x203b('0x6c')]);_0x2b3f13[_0x203b('0x51')]=qs[_0x203b('0x4c')](_['pick'](_0x4ff3da['query'],_0x3fb2f7[_0x203b('0x4c')]));_0x2b3f13[_0x203b('0x51')][_0x203b('0x67')]=_0x1411c4['id'];if(_0x4ff3da[_0x203b('0x4a')][_0x203b('0x53')]){_0x2b3f13['where']=_[_0x203b('0x54')](_0x2b3f13[_0x203b('0x51')],{'$or':_[_0x203b('0x43')](_0x2b3f13[_0x203b('0x4e')],function(_0x2977f4){var _0x145755={};_0x145755[_0x2977f4]={'$like':'%'+_0x4ff3da[_0x203b('0x4a')][_0x203b('0x53')]+'%'};return _0x145755;})});}_0x2b3f13=_['merge']({},_0x2b3f13,_0x4ff3da[_0x203b('0x6d')]);return db[_0x203b('0x68')][_0x203b('0x33')]({'where':_0x2b3f13[_0x203b('0x51')]})['then'](function(_0x5853f4){_0xf59e33[_0x203b('0x33')]=_0x5853f4;if(_0x4ff3da[_0x203b('0x4a')][_0x203b('0x56')]){_0x2b3f13[_0x203b('0x6e')]=[{'all':!![]}];}return db['Disposition'][_0x203b('0x57')](_0x2b3f13);})[_0x203b('0x23')](function(_0x51a65b){_0xf59e33['rows']=_0x51a65b;return _0xf59e33;});}})[_0x203b('0x23')](respondWithFilteredResult(_0x44af45,_0x2b3f13))['catch'](handleError(_0x44af45,null));};exports[_0x203b('0x6f')]=function(_0x1f6448,_0x5800f4,_0x9dec4e){return db[_0x203b('0x44')][_0x203b('0x5a')]({'where':{'id':_0x1f6448['params']['id']}})[_0x203b('0x23')](handleEntityNotFound(_0x5800f4,null))[_0x203b('0x23')](function(_0x3868b7){if(_0x3868b7){return _0x3868b7[_0x203b('0x6f')](_0x1f6448[_0x203b('0x4a')][_0x203b('0x70')]);}})[_0x203b('0x23')](respondWithStatusCode(_0x5800f4,null))[_0x203b('0x2e')](handleError(_0x5800f4,null));};exports['addAnswer']=function(_0x667036,_0x2d0e8d,_0x44c18b){if(_0x667036[_0x203b('0x5c')]['id']){delete _0x667036[_0x203b('0x5c')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x667036[_0x203b('0x64')]['id']}})[_0x203b('0x23')](handleEntityNotFound(_0x2d0e8d,null))[_0x203b('0x23')](function(_0x600a33){if(_0x600a33){_0x667036[_0x203b('0x5c')][_0x203b('0x67')]=_0x600a33['id'];return db[_0x203b('0x71')][_0x203b('0x5b')](_0x667036['body']);}})[_0x203b('0x23')](respondWithResult(_0x2d0e8d,null))[_0x203b('0x2e')](handleError(_0x2d0e8d,null));};exports[_0x203b('0x72')]=function(_0x3b2986,_0x564b7f,_0x27e0e5){var _0x51b9d2={'raw':![],'where':{}};var _0x44562e={};var _0x5c0cc2={'count':0x0,'rows':[]};return db[_0x203b('0x44')][_0x203b('0x69')]({'where':{'id':_0x3b2986[_0x203b('0x64')]['id']}})[_0x203b('0x23')](handleEntityNotFound(_0x564b7f,null))[_0x203b('0x23')](function(_0x42778a){if(_0x42778a){_0x44562e[_0x203b('0x49')]=_[_0x203b('0x4b')](db[_0x203b('0x71')][_0x203b('0x45')]);_0x44562e[_0x203b('0x4a')]=_['keys'](_0x3b2986[_0x203b('0x4a')]);_0x44562e['filters']=_[_0x203b('0x4d')](_0x44562e[_0x203b('0x49')],_0x44562e[_0x203b('0x4a')]);_0x51b9d2[_0x203b('0x4e')]=_[_0x203b('0x4d')](_0x44562e[_0x203b('0x49')],qs[_0x203b('0x4f')](_0x3b2986['query']['fields']));_0x51b9d2[_0x203b('0x4e')]=_0x51b9d2[_0x203b('0x4e')][_0x203b('0x59')]?_0x51b9d2[_0x203b('0x4e')]:_0x44562e[_0x203b('0x49')];if(!_0x3b2986[_0x203b('0x4a')][_0x203b('0x50')]('nolimit')){_0x51b9d2[_0x203b('0x32')]=qs['limit'](_0x3b2986['query'][_0x203b('0x32')]);_0x51b9d2[_0x203b('0x34')]=qs[_0x203b('0x34')](_0x3b2986['query']['offset']);}_0x51b9d2[_0x203b('0x6b')]=qs[_0x203b('0x6c')](_0x3b2986['query'][_0x203b('0x6c')]);_0x51b9d2[_0x203b('0x51')]=qs[_0x203b('0x4c')](_[_0x203b('0x52')](_0x3b2986[_0x203b('0x4a')],_0x44562e[_0x203b('0x4c')]));_0x51b9d2['where'][_0x203b('0x67')]=_0x42778a['id'];if(_0x3b2986[_0x203b('0x4a')][_0x203b('0x53')]){_0x51b9d2[_0x203b('0x51')]=_[_0x203b('0x54')](_0x51b9d2[_0x203b('0x51')],{'$or':_[_0x203b('0x43')](_0x51b9d2[_0x203b('0x4e')],function(_0x5a0f75){var _0x5f2e62={};_0x5f2e62[_0x5a0f75]={'$like':'%'+_0x3b2986[_0x203b('0x4a')][_0x203b('0x53')]+'%'};return _0x5f2e62;})});}_0x51b9d2=_[_0x203b('0x54')]({},_0x51b9d2,_0x3b2986['options']);return db[_0x203b('0x71')][_0x203b('0x33')]({'where':_0x51b9d2[_0x203b('0x51')]})[_0x203b('0x23')](function(_0x1cc0f4){_0x5c0cc2['count']=_0x1cc0f4;if(_0x3b2986[_0x203b('0x4a')]['includeAll']){_0x51b9d2[_0x203b('0x6e')]=[{'all':!![]}];}return db[_0x203b('0x71')][_0x203b('0x57')](_0x51b9d2);})[_0x203b('0x23')](function(_0x57ecdb){_0x5c0cc2[_0x203b('0x73')]=_0x57ecdb;return _0x5c0cc2;});}})[_0x203b('0x23')](respondWithFilteredResult(_0x564b7f,_0x51b9d2))[_0x203b('0x2e')](handleError(_0x564b7f,null));};exports[_0x203b('0x74')]=function(_0x2d20ac,_0x312ad3,_0x3bacb6){return db['FaxAccount'][_0x203b('0x5a')]({'where':{'id':_0x2d20ac[_0x203b('0x64')]['id']}})['then'](handleEntityNotFound(_0x312ad3,null))[_0x203b('0x23')](function(_0x3195a9){if(_0x3195a9){return _0x3195a9['removeAnswers'](_0x2d20ac['query'][_0x203b('0x70')]);}})[_0x203b('0x23')](respondWithStatusCode(_0x312ad3,null))[_0x203b('0x2e')](handleError(_0x312ad3,null));};exports['addInteraction']=function(_0x889ca5,_0x2d7e1e,_0x1604ab){return db[_0x203b('0x75')][_0x203b('0x5a')]({'where':{'id':_0x889ca5[_0x203b('0x64')]['id']}})['then'](handleEntityNotFound(_0x2d7e1e,null))[_0x203b('0x23')](function(_0x2c470b){if(_0x2c470b){return _0x2c470b[_0x203b('0x76')](_0x889ca5['body'][_0x203b('0x70')],_[_0x203b('0x77')](_0x889ca5[_0x203b('0x5c')],['ids','id'])||{});}})[_0x203b('0x23')](respondWithResult(_0x2d7e1e,null))[_0x203b('0x2e')](handleError(_0x2d7e1e,null));};exports['getInteractions']=function(_0x93caa6,_0x9f5c2a,_0x82d0e5){var _0x4c4149={'raw':![],'where':{}};var _0x4d108e={};var _0x13f2fc={'count':0x0,'rows':[]};return db['FaxAccount'][_0x203b('0x69')]({'where':{'id':_0x93caa6[_0x203b('0x64')]['id']}})[_0x203b('0x23')](handleEntityNotFound(_0x9f5c2a,null))[_0x203b('0x23')](function(_0x409773){if(_0x409773){_0x4d108e[_0x203b('0x49')]=_[_0x203b('0x4b')](db[_0x203b('0x75')]['rawAttributes']);_0x4d108e[_0x203b('0x4a')]=_[_0x203b('0x4b')](_0x93caa6[_0x203b('0x4a')]);_0x4d108e[_0x203b('0x4c')]=_[_0x203b('0x4d')](_0x4d108e[_0x203b('0x49')],_0x4d108e[_0x203b('0x4a')]);_0x4c4149[_0x203b('0x4e')]=_[_0x203b('0x4d')](_0x4d108e['model'],qs[_0x203b('0x4f')](_0x93caa6[_0x203b('0x4a')][_0x203b('0x4f')]));_0x4c4149['attributes']=_0x4c4149[_0x203b('0x4e')]['length']?_0x4c4149[_0x203b('0x4e')]:_0x4d108e[_0x203b('0x49')];if(!_0x93caa6[_0x203b('0x4a')]['hasOwnProperty'](_0x203b('0x6a'))){_0x4c4149[_0x203b('0x32')]=qs[_0x203b('0x32')](_0x93caa6[_0x203b('0x4a')][_0x203b('0x32')]);_0x4c4149[_0x203b('0x34')]=qs[_0x203b('0x34')](_0x93caa6['query'][_0x203b('0x34')]);}_0x4c4149[_0x203b('0x6b')]=qs[_0x203b('0x6c')](_0x93caa6[_0x203b('0x4a')][_0x203b('0x6c')]);_0x4c4149[_0x203b('0x51')]=qs[_0x203b('0x4c')](_['pick'](_0x93caa6[_0x203b('0x4a')],_0x4d108e[_0x203b('0x4c')]));_0x4c4149[_0x203b('0x51')][_0x203b('0x67')]=_0x409773['id'];if(_0x93caa6[_0x203b('0x4a')]['filter']){_0x4c4149[_0x203b('0x51')]=_[_0x203b('0x54')](_0x4c4149[_0x203b('0x51')],{'$or':_[_0x203b('0x43')](_0x4c4149['attributes'],function(_0x256dbb){var _0x4eb82a={};_0x4eb82a[_0x256dbb]={'$like':'%'+_0x93caa6[_0x203b('0x4a')][_0x203b('0x53')]+'%'};return _0x4eb82a;})});}_0x4c4149=_[_0x203b('0x54')]({},_0x4c4149,_0x93caa6['options']);return db['FaxInteraction'][_0x203b('0x33')]({'where':_0x4c4149[_0x203b('0x51')]})[_0x203b('0x23')](function(_0x25bd93){_0x13f2fc['count']=_0x25bd93;if(_0x93caa6['query'][_0x203b('0x56')]){_0x4c4149[_0x203b('0x6e')]=[{'model':db[_0x203b('0x78')],'as':_0x203b('0x79'),'required':![]},{'model':db[_0x203b('0x7a')],'as':_0x203b('0x7b'),'attributes':[_0x203b('0x3f'),'fullname',_0x203b('0x7c')],'required':![]},{'model':db[_0x203b('0x7d')],'as':_0x203b('0x7e'),'attributes':['id',_0x203b('0x3f'),_0x203b('0x7f')],'where':_0x93caa6[_0x203b('0x4a')]['tag']?{'id':_0x93caa6['query'][_0x203b('0x80')]}:undefined,'required':_0x93caa6[_0x203b('0x4a')]['tag']?!![]:![]}];}return db[_0x203b('0x75')][_0x203b('0x57')](_0x4c4149);})[_0x203b('0x23')](function(_0x29632f){_0x13f2fc[_0x203b('0x73')]=_0x29632f;return _0x13f2fc;});}})['then'](respondWithFilteredResult(_0x9f5c2a,_0x4c4149))[_0x203b('0x2e')](handleError(_0x9f5c2a,null));};exports[_0x203b('0x81')]=function(_0x124472,_0x3967ac){var _0x3cf70b=_0x124472['params']['id'];var _0x545996=_0x124472[_0x203b('0x5c')];var _0x5456e2=0xc8;var _0x242d21=null;return db['sequelize'][_0x203b('0x82')]({'isolationLevel':db[_0x203b('0x83')]['Transaction'][_0x203b('0x84')]['READ_COMMITTED']},function(_0x26b388){return db[_0x203b('0x44')][_0x203b('0x69')]({'where':{'id':_0x3cf70b},'transaction':_0x26b388})['then'](function(_0x36996b){if(_0x36996b){return db['FaxApplication'][_0x203b('0x3a')]({'where':{'FaxAccountId':_0x3cf70b},'transaction':_0x26b388})[_0x203b('0x23')](function(){var _0x481e6c=_[_0x203b('0x43')](_0x545996,function(_0x37ba3c){_0x37ba3c[_0x203b('0x67')]=_0x3cf70b;return _0x37ba3c;});return db['FaxApplication'][_0x203b('0x85')](_0x481e6c,{'transaction':_0x26b388});});}else{_0x5456e2=0x194;_0x242d21=[];}});})[_0x203b('0x23')](function(){if(_0x5456e2!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x3cf70b},'order':_0x203b('0x86')})[_0x203b('0x23')](function(_0x2e377a){_0x242d21=_0x2e377a;});}})['catch'](function(_0x394a88){_0x5456e2=0x1f4;logger['error'](_0x394a88['stack']);if(_0x394a88[_0x203b('0x3f')]){delete _0x394a88[_0x203b('0x3f')];}_0x242d21=_0x394a88;})[_0x203b('0x87')](function(){if(_0x242d21===null){_0x3967ac[_0x203b('0x3d')](_0x5456e2);}else{if(_0x5456e2===0x1f4){_0x3967ac[_0x203b('0x2f')](_0x5456e2)[_0x203b('0x40')](_0x242d21);}else{_0x3967ac['status'](_0x5456e2)[_0x203b('0x30')](_0x242d21);}}});};exports[_0x203b('0x88')]=function(_0xdcb824,_0x150d4e,_0x4b51e0){var _0x3fcd86={};var _0x1109fc={};var _0x418ec2;var _0x596ad2;return db[_0x203b('0x44')]['findOne']({'where':{'id':_0xdcb824['params']['id']}})['then'](handleEntityNotFound(_0x150d4e,null))['then'](function(_0xe5ffb9){if(_0xe5ffb9){_0x418ec2=_0xe5ffb9;_0x1109fc[_0x203b('0x49')]=_[_0x203b('0x4b')](db['FaxApplication'][_0x203b('0x45')]);_0x1109fc['query']=_[_0x203b('0x4b')](_0xdcb824[_0x203b('0x4a')]);_0x1109fc[_0x203b('0x4c')]=_[_0x203b('0x4d')](_0x1109fc[_0x203b('0x49')],_0x1109fc[_0x203b('0x4a')]);_0x3fcd86[_0x203b('0x4e')]=_[_0x203b('0x4d')](_0x1109fc[_0x203b('0x49')],qs[_0x203b('0x4f')](_0xdcb824['query'][_0x203b('0x4f')]));_0x3fcd86['attributes']=_0x3fcd86[_0x203b('0x4e')][_0x203b('0x59')]?_0x3fcd86['attributes']:_0x1109fc['model'];_0x3fcd86[_0x203b('0x6b')]=qs[_0x203b('0x6c')](_0xdcb824['query'][_0x203b('0x6c')]);_0x3fcd86[_0x203b('0x51')]=qs[_0x203b('0x4c')](_[_0x203b('0x52')](_0xdcb824['query'],_0x1109fc[_0x203b('0x4c')]));if(_0xdcb824[_0x203b('0x4a')][_0x203b('0x53')]){_0x3fcd86['where']=_[_0x203b('0x54')](_0x3fcd86[_0x203b('0x51')],{'$or':_[_0x203b('0x43')](_0x3fcd86['attributes'],function(_0x3bca43){var _0x540e94={};_0x540e94[_0x3bca43]={'$like':'%'+_0xdcb824[_0x203b('0x4a')][_0x203b('0x53')]+'%'};return _0x540e94;})});}_0x3fcd86=_[_0x203b('0x54')]({},_0x3fcd86,_0xdcb824[_0x203b('0x6d')]);return _0x418ec2[_0x203b('0x88')](_0x3fcd86);}})[_0x203b('0x23')](function(_0x592975){if(_0x592975){_0x596ad2=_0x592975['length'];if(!_0xdcb824['query'][_0x203b('0x50')](_0x203b('0x6a'))){_0x3fcd86[_0x203b('0x32')]=qs['limit'](_0xdcb824[_0x203b('0x4a')][_0x203b('0x32')]);_0x3fcd86[_0x203b('0x34')]=qs['offset'](_0xdcb824[_0x203b('0x4a')][_0x203b('0x34')]);}return _0x418ec2[_0x203b('0x88')](_0x3fcd86);}})[_0x203b('0x23')](function(_0x261158){if(_0x261158){return _0x261158?{'count':_0x596ad2,'rows':_0x261158}:null;}})[_0x203b('0x23')](respondWithResult(_0x150d4e,null))[_0x203b('0x2e')](handleError(_0x150d4e,null));};function Extension(_0x41df4a,_0x284598,_0x2e6b42,_0x59990b){this[_0x203b('0x89')]='from-voip-provider';this['exten']=_0x41df4a[_0x203b('0x8a')];this['app']=_0x59990b;this[_0x203b('0x47')]=_0x203b('0x8b');this[_0x203b('0x8c')]='Fax\x20Extension';this['FaxAccountId']=_0x41df4a['id'];this['priority']=_0x284598;this[_0x203b('0x8d')]=_0x2e6b42;}function createExtensionsReciveFax(_0x2f1c91){var _0x4a66ea=0x1;var _0x17e1df=[];_0x17e1df[_0x203b('0x8e')](new Extension(_0x2f1c91,_0x4a66ea,'','Answer'));_0x4a66ea+=0x1;_0x17e1df[_0x203b('0x8e')](new Extension(_0x2f1c91,_0x4a66ea,_0x203b('0x8f'),_0x203b('0x90')));_0x4a66ea+=0x1;for(var _0x47ce0d in _0x2f1c91){if(_0x2f1c91[_0x203b('0x50')](_0x47ce0d)&&(_0x47ce0d==='ecm'||_0x47ce0d===_0x203b('0x8a')||_0x47ce0d===_0x203b('0x91')||_0x47ce0d==='faxdetect'||_0x47ce0d===_0x203b('0x92')||_0x47ce0d===_0x203b('0x93')||_0x47ce0d===_0x203b('0x94')||_0x47ce0d===_0x203b('0x95')||_0x47ce0d===_0x203b('0x96'))){_0x17e1df[_0x203b('0x8e')](new Extension(_0x2f1c91,_0x4a66ea,_0x203b('0x97')+_0x47ce0d+')='+_0x2f1c91[_0x47ce0d],_0x203b('0x90')));_0x4a66ea+=0x1;}}_0x17e1df[_0x203b('0x8e')](new Extension(_0x2f1c91,_0x4a66ea,'6',_0x203b('0x98')));_0x4a66ea+=0x1;_0x17e1df[_0x203b('0x8e')](new Extension(_0x2f1c91,_0x4a66ea,'/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'));_0x4a66ea=0x0;return _0x17e1df;}exports[_0x203b('0x99')]=function(_0x389919,_0x1c46ff,_0x525a22){var _0x35e415;return db['sequelize']['transaction'](function(_0x475a1e){return db[_0x203b('0x44')][_0x203b('0x5b')](_0x389919[_0x203b('0x5c')],{'transaction':_0x475a1e})['then'](function(_0x2f7a7c){_0x35e415=_0x2f7a7c[_0x203b('0x3b')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x35e415),{'transaction':_0x475a1e});});})['then'](function(){return _0x35e415;})[_0x203b('0x23')](respondWithResult(_0x1c46ff,null))['catch'](handleError(_0x1c46ff,null));};exports[_0x203b('0x9a')]=function(_0x1c63bb,_0x5a7cb4,_0x141f66){var _0x2e68a6;return db['sequelize'][_0x203b('0x82')](function(_0xf43159){return db[_0x203b('0x44')]['update'](_0x1c63bb[_0x203b('0x5c')],{'where':{'id':_0x1c63bb[_0x203b('0x5c')]['id']},'transaction':_0xf43159})[_0x203b('0x23')](function(_0x563861){return db[_0x203b('0x9b')]['destroy']({'where':{'FaxAccountId':_0x1c63bb[_0x203b('0x5c')]['id']},'transaction':_0xf43159})['then'](function(_0x189d5d){return db[_0x203b('0x9b')][_0x203b('0x85')](createExtensionsReciveFax(_[_0x203b('0x77')](_0x1c63bb[_0x203b('0x5c')],[_0x203b('0x9c'),_0x203b('0x48'),_0x203b('0x9d'),_0x203b('0x9e'),_0x203b('0x9f'),'ListId'])),{'transaction':_0xf43159});});});})[_0x203b('0x23')](function(){return db[_0x203b('0x44')][_0x203b('0xa0')](_0x1c63bb[_0x203b('0x5c')]['id']);})['then'](respondWithResult(_0x5a7cb4,null))['catch'](handleError(_0x5a7cb4,null));};exports[_0x203b('0xa1')]=function(_0x59293b,_0x4e2dfd,_0x575226){var _0x8f7c6d={'raw':!![],'where':{}};var _0x356639={};var _0x477d15={'count':0x0,'rows':[]};return db[_0x203b('0x44')][_0x203b('0x69')]({'where':{'id':_0x59293b[_0x203b('0x64')]['id']}})[_0x203b('0x23')](handleEntityNotFound(_0x4e2dfd,null))[_0x203b('0x23')](function(_0x7c9e49){if(_0x7c9e49){_0x356639[_0x203b('0x49')]=_[_0x203b('0x4b')](db[_0x203b('0xa2')][_0x203b('0x45')]);_0x356639['query']=_[_0x203b('0x4b')](_0x59293b[_0x203b('0x4a')]);_0x356639['filters']=_[_0x203b('0x4d')](_0x356639[_0x203b('0x49')],_0x356639[_0x203b('0x4a')]);_0x8f7c6d[_0x203b('0x4e')]=_[_0x203b('0x4d')](_0x356639[_0x203b('0x49')],qs[_0x203b('0x4f')](_0x59293b[_0x203b('0x4a')][_0x203b('0x4f')]));_0x8f7c6d['attributes']=_0x8f7c6d[_0x203b('0x4e')]['length']?_0x8f7c6d['attributes']:_0x356639[_0x203b('0x49')];if(!_0x59293b[_0x203b('0x4a')]['hasOwnProperty']('nolimit')){_0x8f7c6d['limit']=qs[_0x203b('0x32')](_0x59293b[_0x203b('0x4a')][_0x203b('0x32')]);_0x8f7c6d[_0x203b('0x34')]=qs[_0x203b('0x34')](_0x59293b[_0x203b('0x4a')][_0x203b('0x34')]);}_0x8f7c6d['order']=qs[_0x203b('0x6c')](_0x59293b['query']['sort']);_0x8f7c6d[_0x203b('0x51')]=qs[_0x203b('0x4c')](_[_0x203b('0x52')](_0x59293b[_0x203b('0x4a')],_0x356639[_0x203b('0x4c')]));_0x8f7c6d[_0x203b('0x51')][_0x203b('0x67')]=_0x7c9e49['id'];if(_0x59293b[_0x203b('0x4a')][_0x203b('0x53')]){_0x8f7c6d[_0x203b('0x51')]=_[_0x203b('0x54')](_0x8f7c6d[_0x203b('0x51')],{'$or':_['map'](_0x8f7c6d['attributes'],function(_0x3c62e3){var _0x5d67f4={};_0x5d67f4[_0x3c62e3]={'$like':'%'+_0x59293b[_0x203b('0x4a')]['filter']+'%'};return _0x5d67f4;})});}if(_0x59293b[_0x203b('0x4a')][_0x203b('0xa3')]){var _0x844a0b=_0x59293b[_0x203b('0x4a')][_0x203b('0xa3')][_0x203b('0xa4')](',');var _0x1333dc={};_0x1333dc[_0x844a0b[0x0]]={'$gte':moment(_0x844a0b[0x1])[_0x203b('0xa5')](_0x203b('0xa6'))};_0x8f7c6d[_0x203b('0x51')]=_[_0x203b('0x54')](_0x8f7c6d[_0x203b('0x51')],_0x1333dc);}_0x8f7c6d=_[_0x203b('0x54')]({},_0x8f7c6d,_0x59293b[_0x203b('0x6d')]);return db[_0x203b('0xa2')]['count']({'where':_0x8f7c6d[_0x203b('0x51')]})[_0x203b('0x23')](function(_0x57174e){_0x477d15[_0x203b('0x33')]=_0x57174e;if(_0x59293b[_0x203b('0x4a')][_0x203b('0x56')]){_0x8f7c6d[_0x203b('0x6e')]=[{'all':!![]}];}return db['FaxMessage'][_0x203b('0x57')](_0x8f7c6d);})['then'](function(_0x4eed43){_0x477d15[_0x203b('0x73')]=_0x4eed43;return _0x477d15;});}})[_0x203b('0x23')](respondWithFilteredResult(_0x4e2dfd,_0x8f7c6d))[_0x203b('0x2e')](handleError(_0x4e2dfd,null));};exports['send']=function(_0x22ccca,_0x351aa8,_0x435446){var _0x10a6e0,_0x843b6b={},_0x532a8b;if(_0x22ccca[_0x203b('0x5c')]['to']){_0x532a8b=_0x22ccca[_0x203b('0x5c')]['to'][0x0];}return db[_0x203b('0x44')][_0x203b('0x5a')]({'where':{'id':_0x22ccca[_0x203b('0x64')]['id']},'include':[{'model':db[_0x203b('0xa7')],'as':_0x203b('0xa8'),'include':[{'model':db[_0x203b('0x78')],'as':_0x203b('0xa9'),'where':{'fax':_0x532a8b},'limit':0x1,'order':[[_0x203b('0x9e'),_0x203b('0xaa')]]}]}]})[_0x203b('0x23')](handleEntityNotFound(_0x351aa8,null))[_0x203b('0x23')](function(_0x34e49a){_0x10a6e0=_0x34e49a;if(_0x22ccca[_0x203b('0x5c')]['attachments']&&_0x22ccca[_0x203b('0x5c')][_0x203b('0xab')]['length']){for(var _0x58d933=0x0;_0x58d933<_0x22ccca[_0x203b('0x5c')][_0x203b('0xab')]['length'];_0x58d933+=0x1){_0x22ccca[_0x203b('0x5c')]['attachments'][_0x58d933]={'filename':_0x22ccca[_0x203b('0x5c')]['attachments'][_0x58d933][_0x203b('0x3f')],'id':_0x22ccca[_0x203b('0x5c')][_0x203b('0xab')][_0x58d933]['id'],'path':path[_0x203b('0xac')](config[_0x203b('0xad')],'server/files/attachments',_0x22ccca[_0x203b('0x5c')]['attachments'][_0x58d933]['basename'])};}}return respondWithRpcPromise(_0x203b('0xae'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x22ccca['params']['id'])?undefined:_0x22ccca[_0x203b('0x64')]['id'],'path':_[_0x203b('0xaf')](_0x22ccca['body'][_0x203b('0xab')][0x0][_0x203b('0x7')])?undefined:_0x22ccca[_0x203b('0x5c')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x22ccca[_0x203b('0x5c')]['to'][0x0])?undefined:_0x22ccca[_0x203b('0x5c')]['to'][0x0]},client9002);})['then'](function(){if(_0x10a6e0){if(_[_0x203b('0xaf')](_0x22ccca[_0x203b('0x5c')][_0x203b('0xb0')])){_0x22ccca[_0x203b('0x5c')]['from']=util[_0x203b('0xa5')](_0x203b('0xb1'),_0x10a6e0[_0x203b('0x3f')],_0x10a6e0[_0x203b('0xb2')]);}if(_0x10a6e0[_0x203b('0xa8')]){if(_0x10a6e0['List'][_0x203b('0xa9')][_0x203b('0x59')]){return _0x10a6e0['List'][_0x203b('0xa9')][0x0];}else{return db['CmContact']['create'](_[_0x203b('0x1b')](_0x22ccca['body'],{'firstName':_0x22ccca[_0x203b('0x5c')]['to'][0x0],'phone':_0x22ccca[_0x203b('0x5c')]['to'][0x0],'fax':_0x22ccca[_0x203b('0x5c')]['to'][0x0],'ListId':_0x10a6e0[_0x203b('0xb3')]}));}}else{throw new Error(_0x203b('0xb4'));}}else{throw new Error(_0x203b('0xb5'));}})[_0x203b('0x23')](function(_0x292d8c){if(_0x292d8c){return db[_0x203b('0x75')][_0x203b('0x5a')]({'where':{'ContactId':_0x292d8c['id'],'closed':![],'FaxAccountId':_0x10a6e0['id']}})[_0x203b('0x23')](function(_0x17c6c0){if(_0x17c6c0){return[_0x17c6c0,![]];}return db[_0x203b('0x75')][_0x203b('0x5b')]({'UserId':_0x22ccca[_0x203b('0x5d')]['id'],'ContactId':_0x292d8c['id'],'FaxAccountId':_0x10a6e0['id'],'fax':_0x22ccca[_0x203b('0x5c')]['to'][0x0],'firstMsgDirection':_0x203b('0xb6'),'Messages':[_[_0x203b('0x54')](_0x22ccca[_0x203b('0x5c')],{'read':![],'body':_0x22ccca[_0x203b('0x5c')][_0x203b('0xab')][0x0]['filename'],'FaxAccountId':_0x10a6e0['id'],'UserId':_0x22ccca['user']['id'],'ContactId':_0x292d8c['id'],'AttachmentId':_0x22ccca[_0x203b('0x5c')][_0x203b('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x203b('0xa2')],'as':_0x203b('0xb7')}]})[_0x203b('0x23')](function(_0x134459){return[_0x134459,!![]];});});}else{throw new Error(_0x203b('0xb8'));}})['spread'](function(_0x1e8a2c,_0x1fec47){if(_0x1fec47){return _0x1e8a2c;}return db['FaxMessage']['create']({'direction':_0x203b('0xb6'),'read':![],'body':_0x22ccca['body'][_0x203b('0xab')][0x0][_0x203b('0xb9')],'FaxAccountId':_0x10a6e0['id'],'FaxInteractionId':_0x1e8a2c['id'],'UserId':_0x22ccca['user']['id'],'ContactId':_0x1e8a2c[_0x203b('0xba')],'AttachmentId':_0x22ccca[_0x203b('0x5c')][_0x203b('0xab')][0x0]['id']})[_0x203b('0x23')](function(_0x28ebe6){_0x1e8a2c[_0x203b('0xbb')][_0x203b('0xb7')]=[];_0x1e8a2c[_0x203b('0xbb')][_0x203b('0xb7')][_0x203b('0x8e')](_0x28ebe6[_0x203b('0xbb')]);return _0x1e8a2c;});})[_0x203b('0x23')](function(_0x4d8a56){respondWithRpcPromise(_0x203b('0xbc'),_0x203b('0xbc'),{'FaxAccountId':_[_0x203b('0xaf')](_0x22ccca[_0x203b('0x64')]['id'])?undefined:_0x22ccca[_0x203b('0x64')]['id'],'path':_['isNil'](_0x22ccca[_0x203b('0x5c')][_0x203b('0xab')][0x0][_0x203b('0x7')])?undefined:_0x22ccca[_0x203b('0x5c')][_0x203b('0xab')][0x0][_0x203b('0x7')],'fax':_[_0x203b('0xaf')](_0x22ccca['body']['to'][0x0])?undefined:_0x22ccca['body']['to'][0x0],'AttachmentId':_0x22ccca[_0x203b('0x5c')]['attachments'][0x0]['id']},client9002)[_0x203b('0x23')](function(_0x1d5631){logger[_0x203b('0x2c')](_0x203b('0xbd'),_0x1d5631);})[_0x203b('0x2e')](function(_0x137d07){logger[_0x203b('0x2c')](_0x203b('0xbd'),_0x137d07);});return _0x4d8a56;})['then'](respondWithResult(_0x351aa8,null))[_0x203b('0x2e')](handleError(_0x351aa8,null));};exports[_0x203b('0xbe')]=function(_0x8028a1,_0xdbac30,_0x5093b3){return db[_0x203b('0x44')][_0x203b('0x5a')]({'where':{'id':_0x8028a1['params']['id']}})[_0x203b('0x23')](handleEntityNotFound(_0xdbac30,null))[_0x203b('0x23')](function(_0x8d5d0b){if(_0x8d5d0b){return _0x8d5d0b[_0x203b('0xbe')](_0x8028a1[_0x203b('0x5c')][_0x203b('0x70')],_['omit'](_0x8028a1[_0x203b('0x5c')],[_0x203b('0x70'),'id'])||{})['spread'](function(_0x1bf75a){for(var _0x24b312=0x0;_0x24b312<_0x8028a1[_0x203b('0x5c')][_0x203b('0x70')][_0x203b('0x59')];_0x24b312+=0x1){socket[_0x203b('0xbf')]('userFaxAccount:save',{'UserId':Number(_0x8028a1['body'][_0x203b('0x70')][_0x24b312]),'FaxAccountId':Number(_0x8028a1[_0x203b('0x64')]['id'])});}return _0x1bf75a;});}})[_0x203b('0x23')](respondWithResult(_0xdbac30,null))[_0x203b('0x2e')](handleError(_0xdbac30,null));};exports['removeAgents']=function(_0x35f715,_0x162064,_0x599e2a){return db['FaxAccount'][_0x203b('0x5a')]({'where':{'id':_0x35f715[_0x203b('0x64')]['id']}})[_0x203b('0x23')](handleEntityNotFound(_0x162064,null))[_0x203b('0x23')](function(_0x827cf5){if(_0x827cf5){return _0x827cf5[_0x203b('0xc0')](_0x35f715['query']['ids'])[_0x203b('0x23')](function(){if(_[_0x203b('0xc1')](_0x35f715[_0x203b('0x4a')]['ids'])){for(var _0x165e7c=0x0;_0x165e7c<_0x35f715[_0x203b('0x4a')][_0x203b('0x70')]['length'];_0x165e7c+=0x1){socket[_0x203b('0xbf')](_0x203b('0xc2'),{'UserId':Number(_0x35f715['query'][_0x203b('0x70')][_0x165e7c]),'FaxAccountId':Number(_0x35f715[_0x203b('0x64')]['id'])});}}else{socket['emit'](_0x203b('0xc2'),{'UserId':Number(_0x35f715[_0x203b('0x4a')][_0x203b('0x70')]),'FaxAccountId':Number(_0x35f715[_0x203b('0x64')]['id'])});}});}})[_0x203b('0x23')](respondWithStatusCode(_0x162064,null))[_0x203b('0x2e')](handleError(_0x162064,null));};exports[_0x203b('0xc3')]=function(_0xabb6a7,_0xa45d56,_0x29f9d4){var _0x428bba={};var _0x1d1b59={};var _0x270409;var _0x55793c;return db['FaxAccount'][_0x203b('0x69')]({'where':{'id':_0xabb6a7['params']['id']}})[_0x203b('0x23')](handleEntityNotFound(_0xa45d56,null))[_0x203b('0x23')](function(_0x3acec5){if(_0x3acec5){_0x270409=_0x3acec5;_0x1d1b59[_0x203b('0x49')]=_[_0x203b('0x4b')](db['User'][_0x203b('0x45')]);_0x1d1b59['query']=_['keys'](_0xabb6a7['query']);_0x1d1b59[_0x203b('0x4c')]=_[_0x203b('0x4d')](_0x1d1b59[_0x203b('0x49')],_0x1d1b59[_0x203b('0x4a')]);_0x428bba['attributes']=_[_0x203b('0x4d')](_0x1d1b59[_0x203b('0x49')],qs[_0x203b('0x4f')](_0xabb6a7[_0x203b('0x4a')]['fields']));_0x428bba[_0x203b('0x4e')]=_0x428bba[_0x203b('0x4e')][_0x203b('0x59')]?_0x428bba[_0x203b('0x4e')]:_0x1d1b59[_0x203b('0x49')];_0x428bba[_0x203b('0x6b')]=qs[_0x203b('0x6c')](_0xabb6a7[_0x203b('0x4a')]['sort']);_0x428bba['where']=qs[_0x203b('0x4c')](_[_0x203b('0x52')](_0xabb6a7[_0x203b('0x4a')],_0x1d1b59[_0x203b('0x4c')]));if(_0xabb6a7['query'][_0x203b('0x53')]){_0x428bba[_0x203b('0x51')]=_['merge'](_0x428bba[_0x203b('0x51')],{'$or':_[_0x203b('0x43')](_0x428bba[_0x203b('0x4e')],function(_0x327402){var _0x354793={};_0x354793[_0x327402]={'$like':'%'+_0xabb6a7['query'][_0x203b('0x53')]+'%'};return _0x354793;})});}_0x428bba=_['merge']({},_0x428bba,_0xabb6a7['options']);return _0x270409[_0x203b('0xc3')](_0x428bba);}})[_0x203b('0x23')](function(_0xac55ff){if(_0xac55ff){_0x55793c=_0xac55ff[_0x203b('0x59')];if(!_0xabb6a7[_0x203b('0x4a')]['hasOwnProperty'](_0x203b('0x6a'))){_0x428bba[_0x203b('0x32')]=qs['limit'](_0xabb6a7[_0x203b('0x4a')][_0x203b('0x32')]);_0x428bba[_0x203b('0x34')]=qs['offset'](_0xabb6a7['query'][_0x203b('0x34')]);}return _0x270409[_0x203b('0xc3')](_0x428bba);}})['then'](function(_0x44420e){if(_0x44420e){return _0x44420e?{'count':_0x55793c,'rows':_0x44420e}:null;}})[_0x203b('0x23')](respondWithResult(_0xa45d56,null))[_0x203b('0x2e')](handleError(_0xa45d56,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 7dcaf5b..489a9f2 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 _0xe174=['exports','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x457f7a,_0xb5f8d2){var _0x3ff173=function(_0x1dbb14){while(--_0x1dbb14){_0x457f7a['push'](_0x457f7a['shift']());}};_0x3ff173(++_0xb5f8d2);}(_0xe174,0x64));var _0x4e17=function(_0x2146dc,_0x5736a0){_0x2146dc=_0x2146dc-0x0;var _0x958647=_0xe174[_0x2146dc];return _0x958647;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x4e17('0x0'))['db'][_0x4e17('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4e17('0x2')](0x0);var events={'afterCreate':_0x4e17('0x3'),'afterUpdate':_0x4e17('0x4'),'afterDestroy':_0x4e17('0x5')};function emitEvent(_0x5405c6){return function(_0x3a1142,_0x3f8742,_0x137e40){FaxAccountEvents[_0x4e17('0x6')](_0x5405c6+':'+_0x3a1142['id'],_0x3a1142);FaxAccountEvents[_0x4e17('0x6')](_0x5405c6,_0x3a1142);_0x137e40(null);};}for(var e in events){if(events[_0x4e17('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x4e17('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xdb7b=['update','remove','emit','exports','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x16c1d9,_0x2a1270){var _0x85293b=function(_0x2c3479){while(--_0x2c3479){_0x16c1d9['push'](_0x16c1d9['shift']());}};_0x85293b(++_0x2a1270);}(_0xdb7b,0x8c));var _0xbdb7=function(_0x410cb2,_0x27ceb1){_0x410cb2=_0x410cb2-0x0;var _0xea9a66=_0xdb7b[_0x410cb2];return _0xea9a66;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xbdb7('0x0'))['db'][_0xbdb7('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xbdb7('0x2')](0x0);var events={'afterCreate':_0xbdb7('0x3'),'afterUpdate':_0xbdb7('0x4'),'afterDestroy':_0xbdb7('0x5')};function emitEvent(_0x11f28b){return function(_0x826bb7,_0x3deaf9,_0x4e6df){FaxAccountEvents[_0xbdb7('0x6')](_0x11f28b+':'+_0x826bb7['id'],_0x826bb7);FaxAccountEvents[_0xbdb7('0x6')](_0x11f28b,_0x826bb7);_0x4e6df(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xbdb7('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 8717b6f..227bf24 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 _0xfe09=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x18b0c3,_0xf7aa83){var _0x395709=function(_0x5871ec){while(--_0x5871ec){_0x18b0c3['push'](_0x18b0c3['shift']());}};_0x395709(++_0xf7aa83);}(_0xfe09,0x8a));var _0x9fe0=function(_0xc3b26f,_0x11345e){_0xc3b26f=_0xc3b26f-0x0;var _0x591362=_0xfe09[_0xc3b26f];return _0x591362;};'use strict';var _=require(_0x9fe0('0x0'));var util=require(_0x9fe0('0x1'));var logger=require(_0x9fe0('0x2'))(_0x9fe0('0x3'));var moment=require(_0x9fe0('0x4'));var BPromise=require(_0x9fe0('0x5'));var rp=require(_0x9fe0('0x6'));var fs=require('fs');var path=require(_0x9fe0('0x7'));var rimraf=require(_0x9fe0('0x8'));var config=require(_0x9fe0('0x9'));var attributes=require(_0x9fe0('0xa'));module[_0x9fe0('0xb')]=function(_0x3a647d,_0x5e2611){return _0x3a647d[_0x9fe0('0xc')](_0x9fe0('0xd'),attributes,{'tableName':_0x9fe0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd3a=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x32684f,_0x32e7d7){var _0x2de802=function(_0x161192){while(--_0x161192){_0x32684f['push'](_0x32684f['shift']());}};_0x2de802(++_0x32e7d7);}(_0xcd3a,0xb5));var _0xacd3=function(_0x688e59,_0x166fd8){_0x688e59=_0x688e59-0x0;var _0x398624=_0xcd3a[_0x688e59];return _0x398624;};'use strict';var _=require(_0xacd3('0x0'));var util=require('util');var logger=require(_0xacd3('0x1'))('api');var moment=require(_0xacd3('0x2'));var BPromise=require(_0xacd3('0x3'));var rp=require(_0xacd3('0x4'));var fs=require('fs');var path=require(_0xacd3('0x5'));var rimraf=require('rimraf');var config=require(_0xacd3('0x6'));var attributes=require(_0xacd3('0x7'));module[_0xacd3('0x8')]=function(_0x365572,_0x524ef9){return _0x365572[_0xacd3('0x9')](_0xacd3('0xa'),attributes,{'tableName':'fax_accounts','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 efd03b1..d71b831 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 _0x825f=['model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','Contacts','defaults','ListId','contact','FaxInteraction','create','Contact\x20not\x20found','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','startRouting','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','debug','error','code','message','info','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','map','include'];(function(_0x4f8ec5,_0x212462){var _0xfb7738=function(_0x366498){while(--_0x366498){_0x4f8ec5['push'](_0x4f8ec5['shift']());}};_0xfb7738(++_0x212462);}(_0x825f,0xe5));var _0xf825=function(_0x3c0ff0,_0x1ae2e9){_0x3c0ff0=_0x3c0ff0-0x0;var _0x342b46=_0x825f[_0x3c0ff0];return _0x342b46;};'use strict';var _=require(_0xf825('0x0'));var util=require(_0xf825('0x1'));var moment=require(_0xf825('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf825('0x3'));var db=require(_0xf825('0x4'))['db'];var utils=require(_0xf825('0x5'));var logger=require(_0xf825('0x6'))(_0xf825('0x7'));var config=require(_0xf825('0x8'));var jayson=require(_0xf825('0x9'));var client=jayson['client'][_0xf825('0xa')]({'port':0x232c});config[_0xf825('0xb')]=_['defaults'](config[_0xf825('0xb')],{'host':_0xf825('0xc'),'port':0x18eb});var socket=require(_0xf825('0xd'))(new Redis(config[_0xf825('0xb')]));require(_0xf825('0xe'))[_0xf825('0xf')](socket);function respondWithRpcPromise(_0x274dc3,_0x443185,_0x3be542){return new BPromise(function(_0xf90deb,_0x329ac3){return client[_0xf825('0x10')](_0x274dc3,_0x3be542)[_0xf825('0x11')](function(_0xd85ef){logger['info']('FaxAccount,\x20%s,\x20%s',_0x443185,_0xf825('0x12'));logger[_0xf825('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x443185,_0xf825('0x12'),JSON['stringify'](_0xd85ef));if(_0xd85ef[_0xf825('0x14')]){if(_0xd85ef['error'][_0xf825('0x15')]===0x1f4){logger[_0xf825('0x14')]('FaxAccount,\x20%s,\x20%s',_0x443185,_0xd85ef[_0xf825('0x14')][_0xf825('0x16')]);return _0x329ac3(_0xd85ef[_0xf825('0x14')][_0xf825('0x16')]);}logger[_0xf825('0x14')]('FaxAccount,\x20%s,\x20%s',_0x443185,_0xd85ef[_0xf825('0x14')]['message']);return _0xf90deb(_0xd85ef['error'][_0xf825('0x16')]);}else{logger[_0xf825('0x17')](_0xf825('0x18'),_0x443185,_0xf825('0x12'));_0xf90deb(_0xd85ef[_0xf825('0x19')][_0xf825('0x16')]);}})[_0xf825('0x1a')](function(_0x3fd43f){logger[_0xf825('0x14')](_0xf825('0x18'),_0x443185,_0x3fd43f);_0x329ac3(_0x3fd43f);});});}exports[_0xf825('0x1b')]=function(_0x2609e1){var _0x3adaa9=this;return new Promise(function(_0x3c562d,_0x54603a){return db[_0xf825('0x1c')][_0xf825('0x1d')]({'raw':_0x2609e1['options']?_0x2609e1[_0xf825('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2609e1[_0xf825('0x1e')]?_0x2609e1[_0xf825('0x1e')]['where']||null:null,'attributes':_0x2609e1['options']?_0x2609e1[_0xf825('0x1e')][_0xf825('0x1f')]||null:null,'limit':_0x2609e1[_0xf825('0x1e')]?_0x2609e1[_0xf825('0x1e')][_0xf825('0x20')]||null:null,'include':_0x2609e1[_0xf825('0x1e')]?_0x2609e1[_0xf825('0x1e')]['include']?_[_0xf825('0x21')](_0x2609e1[_0xf825('0x1e')][_0xf825('0x22')],function(_0x2cbf9f){return{'model':db[_0x2cbf9f[_0xf825('0x23')]],'as':_0x2cbf9f['as'],'attributes':_0x2cbf9f[_0xf825('0x1f')],'include':_0x2cbf9f[_0xf825('0x22')]?_[_0xf825('0x21')](_0x2cbf9f[_0xf825('0x22')],function(_0x553b2c){return{'model':db[_0x553b2c['model']],'as':_0x553b2c['as'],'attributes':_0x553b2c[_0xf825('0x1f')],'include':_0x553b2c[_0xf825('0x22')]?_['map'](_0x553b2c[_0xf825('0x22')],function(_0x2406e1){return{'model':db[_0x2406e1['model']],'as':_0x2406e1['as'],'attributes':_0x2406e1[_0xf825('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf825('0x11')](function(_0x231885){logger['info'](_0xf825('0x1b'),_0x2609e1);logger[_0xf825('0x13')]('GetFaxAccount',_0x2609e1,JSON['stringify'](_0x231885));_0x3c562d(_0x231885);})[_0xf825('0x1a')](function(_0x1609d5){logger['error'](_0xf825('0x1b'),_0x1609d5['message'],_0x2609e1);_0x54603a(_0x3adaa9[_0xf825('0x14')](0x1f4,_0x1609d5['message']));});});};exports[_0xf825('0x24')]=function(_0x48f207,_0x212012,_0x33ac53){var _0x207c64=this;return new Promise(function(_0x484a5a,_0x7c2f7e){var _0x3a67b2={'body':_0x48f207[_0xf825('0x25')],'channel':_0xf825('0x26')};var _0x35cd40=[];var _0x25b035=[];var _0x1ab047={};return db[_0xf825('0x27')][_0xf825('0x28')]()[_0xf825('0x11')](function(_0x1b3d61){if(!_0x1b3d61){throw new db[(_0xf825('0x29'))][(_0xf825('0x2a'))](_0xf825('0x2b'));}_0x35cd40=_[_0xf825('0x2c')](_[_0xf825('0x2d')](_0x1b3d61),[_0xf825('0x2e'),_0xf825('0x2f')]);_0x25b035=_[_0xf825('0x2c')](_[_0xf825('0x2d')](_0x1b3d61),['createdAt',_0xf825('0x2f'),_0xf825('0x30'),'ListId']);if(_0x48f207[_0xf825('0x25')]['id']){delete _0x48f207[_0xf825('0x25')]['id'];}if(_[_0xf825('0x31')](_0x48f207[_0xf825('0x25')]['from'])){throw new db['Sequelize']['ValidationError'](_0xf825('0x32'));}if(_[_0xf825('0x31')](_0x48f207[_0xf825('0x25')]['body'])||_0x48f207[_0xf825('0x25')]['body']===''){throw new db[(_0xf825('0x29'))]['ValidationError'](_0xf825('0x33'));}if(_['isNil'](_0x48f207['body']['mapKey'])){throw new db[(_0xf825('0x29'))][(_0xf825('0x2a'))](_0xf825('0x34')+_0x25b035);}if(!_[_0xf825('0x35')](_0x25b035,_0x48f207['body'][_0xf825('0x36')])){throw new db[(_0xf825('0x29'))][(_0xf825('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25b035);}_0x1ab047[_0x48f207[_0xf825('0x25')]['mapKey']]=_0x48f207[_0xf825('0x25')]['from'];})['then'](function(){return db[_0xf825('0x1c')][_0xf825('0x37')]({'where':{'id':_0x48f207[_0xf825('0x38')]['id']},'include':[{'model':db[_0xf825('0x39')],'as':_0xf825('0x3a'),'include':[{'model':db[_0xf825('0x27')],'as':'Contacts','where':_0x1ab047,'limit':0x1,'order':[[_0xf825('0x2f'),_0xf825('0x3b')]]}]},{'model':db[_0xf825('0x3c')],'as':_0xf825('0x3d')}]});})['then'](function(_0x1f2019){if(_0x1f2019&&_0x1f2019[_0xf825('0x3a')]){var _0x189557=_0x1f2019[_0xf825('0x3e')]({'plain':!![]});_0x3a67b2[_0xf825('0x38')]=_0x189557;_0x3a67b2[_0xf825('0x3f')]=_0x189557[_0xf825('0x3d')];_0x3a67b2[_0xf825('0x40')]=_0x189557[_0xf825('0x3a')];_0x3a67b2[_0xf825('0x3f')]=_[_0xf825('0x41')](_0x3a67b2[_0xf825('0x3f')],['priority'],[_0xf825('0x42')]);if(_0x3a67b2[_0xf825('0x38')]['Applications']){delete _0x3a67b2['account'][_0xf825('0x3d')];}if(_0x3a67b2[_0xf825('0x38')][_0xf825('0x3a')]&&_0x3a67b2[_0xf825('0x38')][_0xf825('0x3a')]['Contacts']['length']){return _0x3a67b2['account'][_0xf825('0x3a')][_0xf825('0x43')][0x0];}var _0x3d5654=_[_0xf825('0x44')](_0x48f207['body'],{'firstName':_0x48f207[_0xf825('0x25')]['from'],'ListId':_0x189557[_0xf825('0x45')]});_0x3d5654[_0x48f207[_0xf825('0x25')]['mapKey']]=_0x48f207[_0xf825('0x25')]['from'];return db[_0xf825('0x27')]['create'](_0x3d5654,{'fields':_0x35cd40,'raw':!![]});}})[_0xf825('0x11')](function(_0x68a6d5){_0x3a67b2[_0xf825('0x46')]=_0x68a6d5;if(_0x68a6d5){var _0x20dff1={'ContactId':_0x68a6d5['id'],'FaxAccountId':_0x48f207[_0xf825('0x38')]['id'],'fax':_0x68a6d5[_0xf825('0x26')]};return db[_0xf825('0x47')][_0xf825('0x37')]({'where':{'ContactId':_0x68a6d5['id'],'closed':![],'FaxAccountId':_0x48f207[_0xf825('0x38')]['id']}})['then'](function(_0x13dd8d){if(_0x13dd8d){return[_0x13dd8d,![]];}return db[_0xf825('0x47')][_0xf825('0x48')](_0x20dff1)[_0xf825('0x11')](function(_0x141e35){return[_0x141e35,!![]];});});}else{throw new Error(_0xf825('0x49'));}})['spread'](function(_0x4e9566,_0xb6a3c){var _0x20fc55=_0x4e9566[_0xf825('0x3e')]({'plain':!![]});if(_0xb6a3c){if(_0x3a67b2['account']['autoclose']){_0x3a67b2[_0xf825('0x3f')][_0xf825('0x4a')]({'id':0x0,'priority':_0x3a67b2[_0xf825('0x3f')][_0xf825('0x4b')]+0x1,'app':_0xf825('0x4c'),'appdata':_0xf825('0x4d'),'interval':_0xf825('0x4e')});}_0x20fc55[_0xf825('0x4f')]=!![];}else{_0x20fc55[_0xf825('0x4f')]=![];}_0x3a67b2[_0xf825('0x50')]=_0x20fc55;return db[_0xf825('0x51')][_0xf825('0x48')]({'body':_0x48f207[_0xf825('0x25')][_0xf825('0x25')],'FaxAccountId':_0x48f207['account']['id'],'FaxInteractionId':_0x4e9566['id'],'direction':'in','ContactId':_0x4e9566[_0xf825('0x52')],'AttachmentId':_0x48f207[_0xf825('0x25')][_0xf825('0x53')]});})[_0xf825('0x11')](function(_0x1091cb){_0x3a67b2['message']=_0x1091cb;if(_0x3a67b2[_0xf825('0x50')][_0xf825('0x54')]){return db[_0xf825('0x55')][_0xf825('0x37')]({'attributes':['id',_0xf825('0x56')],'where':{'id':_0x3a67b2[_0xf825('0x50')][_0xf825('0x54')]}})[_0xf825('0x11')](function(_0x5dc0f3){if(_0x5dc0f3){_0x3a67b2[_0xf825('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5dc0f3['name']+','+(_0x3a67b2['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xf825('0x57'),_0x3a67b2);});}return respondWithRpcPromise('Start',_0xf825('0x57'),_0x3a67b2);})[_0xf825('0x11')](function(_0x92dadd){_0x484a5a(_0x92dadd);})[_0xf825('0x1a')](function(_0x2ea71a){_0x7c2f7e(_0x207c64[_0xf825('0x14')](0x1f4,_0x2ea71a['message']));});});}; \ No newline at end of file +var _0xe5ab=['ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','FaxApplication','Applications','List','get','applications','orderBy','priority','account','length','create','contact','fax','FaxInteraction','find','Contact\x20not\x20found','spread','push','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','info','catch','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId'];(function(_0x527af0,_0x48264a){var _0x4be002=function(_0x5ab051){while(--_0x5ab051){_0x527af0['push'](_0x527af0['shift']());}};_0x4be002(++_0x48264a);}(_0xe5ab,0x19a));var _0xbe5a=function(_0x29522a,_0x4f99df){_0x29522a=_0x29522a-0x0;var _0x559433=_0xe5ab[_0x29522a];return _0x559433;};'use strict';var _=require(_0xbe5a('0x0'));var util=require(_0xbe5a('0x1'));var moment=require(_0xbe5a('0x2'));var BPromise=require(_0xbe5a('0x3'));var rs=require(_0xbe5a('0x4'));var fs=require('fs');var Redis=require(_0xbe5a('0x5'));var db=require(_0xbe5a('0x6'))['db'];var utils=require(_0xbe5a('0x7'));var logger=require(_0xbe5a('0x8'))(_0xbe5a('0x9'));var config=require('../../config/environment');var jayson=require(_0xbe5a('0xa'));var client=jayson[_0xbe5a('0xb')][_0xbe5a('0xc')]({'port':0x232c});config[_0xbe5a('0xd')]=_[_0xbe5a('0xe')](config['redis'],{'host':_0xbe5a('0xf'),'port':0x18eb});var socket=require(_0xbe5a('0x10'))(new Redis(config['redis']));require('./faxAccount.socket')[_0xbe5a('0x11')](socket);function respondWithRpcPromise(_0x5aeaee,_0x2c7925,_0x183297){return new BPromise(function(_0xcfcc0c,_0x6e3717){return client[_0xbe5a('0x12')](_0x5aeaee,_0x183297)[_0xbe5a('0x13')](function(_0x74c5b5){logger['info']('FaxAccount,\x20%s,\x20%s',_0x2c7925,'request\x20sent');logger[_0xbe5a('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2c7925,'request\x20sent',JSON[_0xbe5a('0x15')](_0x74c5b5));if(_0x74c5b5[_0xbe5a('0x16')]){if(_0x74c5b5[_0xbe5a('0x16')][_0xbe5a('0x17')]===0x1f4){logger[_0xbe5a('0x16')](_0xbe5a('0x18'),_0x2c7925,_0x74c5b5[_0xbe5a('0x16')][_0xbe5a('0x19')]);return _0x6e3717(_0x74c5b5['error'][_0xbe5a('0x19')]);}logger[_0xbe5a('0x16')](_0xbe5a('0x18'),_0x2c7925,_0x74c5b5[_0xbe5a('0x16')][_0xbe5a('0x19')]);return _0xcfcc0c(_0x74c5b5[_0xbe5a('0x16')]['message']);}else{logger['info'](_0xbe5a('0x18'),_0x2c7925,'request\x20sent');_0xcfcc0c(_0x74c5b5[_0xbe5a('0x1a')]['message']);}})['catch'](function(_0x735d3){logger[_0xbe5a('0x16')](_0xbe5a('0x18'),_0x2c7925,_0x735d3);_0x6e3717(_0x735d3);});});}exports[_0xbe5a('0x1b')]=function(_0x1dc2ca){var _0x5dd955=this;return new Promise(function(_0x5b5398,_0x5745d2){return db['FaxAccount'][_0xbe5a('0x1c')]({'raw':_0x1dc2ca['options']?_0x1dc2ca[_0xbe5a('0x1d')][_0xbe5a('0x1e')]===undefined?!![]:![]:!![],'where':_0x1dc2ca[_0xbe5a('0x1d')]?_0x1dc2ca[_0xbe5a('0x1d')][_0xbe5a('0x1f')]||null:null,'attributes':_0x1dc2ca[_0xbe5a('0x1d')]?_0x1dc2ca[_0xbe5a('0x1d')][_0xbe5a('0x20')]||null:null,'limit':_0x1dc2ca['options']?_0x1dc2ca[_0xbe5a('0x1d')][_0xbe5a('0x21')]||null:null,'include':_0x1dc2ca[_0xbe5a('0x1d')]?_0x1dc2ca[_0xbe5a('0x1d')]['include']?_['map'](_0x1dc2ca[_0xbe5a('0x1d')][_0xbe5a('0x22')],function(_0x590457){return{'model':db[_0x590457[_0xbe5a('0x23')]],'as':_0x590457['as'],'attributes':_0x590457[_0xbe5a('0x20')],'include':_0x590457[_0xbe5a('0x22')]?_[_0xbe5a('0x24')](_0x590457['include'],function(_0x3094c7){return{'model':db[_0x3094c7[_0xbe5a('0x23')]],'as':_0x3094c7['as'],'attributes':_0x3094c7[_0xbe5a('0x20')],'include':_0x3094c7[_0xbe5a('0x22')]?_[_0xbe5a('0x24')](_0x3094c7[_0xbe5a('0x22')],function(_0x404389){return{'model':db[_0x404389['model']],'as':_0x404389['as'],'attributes':_0x404389[_0xbe5a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43d2e0){logger[_0xbe5a('0x25')](_0xbe5a('0x1b'),_0x1dc2ca);logger['debug']('GetFaxAccount',_0x1dc2ca,JSON[_0xbe5a('0x15')](_0x43d2e0));_0x5b5398(_0x43d2e0);})[_0xbe5a('0x26')](function(_0x487816){logger[_0xbe5a('0x16')](_0xbe5a('0x1b'),_0x487816[_0xbe5a('0x19')],_0x1dc2ca);_0x5745d2(_0x5dd955[_0xbe5a('0x16')](0x1f4,_0x487816[_0xbe5a('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x57739a,_0x3ef3cf,_0x4e09af){var _0x3d303a=this;return new Promise(function(_0x54451b,_0x2344a0){var _0x1aca43={'body':_0x57739a[_0xbe5a('0x27')],'channel':'fax'};var _0x15f12c=[];var _0x3c632d=[];var _0x22deaf={};return db[_0xbe5a('0x28')][_0xbe5a('0x29')]()[_0xbe5a('0x13')](function(_0x94c9e8){if(!_0x94c9e8){throw new db[(_0xbe5a('0x2a'))][(_0xbe5a('0x2b'))](_0xbe5a('0x2c'));}_0x15f12c=_['difference'](_[_0xbe5a('0x2d')](_0x94c9e8),[_0xbe5a('0x2e'),_0xbe5a('0x2f')]);_0x3c632d=_[_0xbe5a('0x30')](_['keys'](_0x94c9e8),[_0xbe5a('0x2e'),'updatedAt',_0xbe5a('0x31'),_0xbe5a('0x32')]);if(_0x57739a[_0xbe5a('0x27')]['id']){delete _0x57739a[_0xbe5a('0x27')]['id'];}if(_['isNil'](_0x57739a[_0xbe5a('0x27')][_0xbe5a('0x33')])){throw new db['Sequelize'][(_0xbe5a('0x2b'))](_0xbe5a('0x34'));}if(_['isNil'](_0x57739a[_0xbe5a('0x27')][_0xbe5a('0x27')])||_0x57739a[_0xbe5a('0x27')][_0xbe5a('0x27')]===''){throw new db[(_0xbe5a('0x2a'))][(_0xbe5a('0x2b'))](_0xbe5a('0x35'));}if(_[_0xbe5a('0x36')](_0x57739a['body'][_0xbe5a('0x37')])){throw new db[(_0xbe5a('0x2a'))]['ValidationError'](_0xbe5a('0x38')+_0x3c632d);}if(!_[_0xbe5a('0x39')](_0x3c632d,_0x57739a[_0xbe5a('0x27')]['mapKey'])){throw new db[(_0xbe5a('0x2a'))][(_0xbe5a('0x2b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3c632d);}_0x22deaf[_0x57739a['body']['mapKey']]=_0x57739a[_0xbe5a('0x27')][_0xbe5a('0x33')];})[_0xbe5a('0x13')](function(){return db['FaxAccount']['find']({'where':{'id':_0x57739a['account']['id']},'include':[{'model':db[_0xbe5a('0x3a')],'as':'List','include':[{'model':db['CmContact'],'as':_0xbe5a('0x3b'),'where':_0x22deaf,'limit':0x1,'order':[[_0xbe5a('0x2f'),_0xbe5a('0x3c')]]}]},{'model':db[_0xbe5a('0x3d')],'as':_0xbe5a('0x3e')}]});})[_0xbe5a('0x13')](function(_0x5cab3e){if(_0x5cab3e&&_0x5cab3e[_0xbe5a('0x3f')]){var _0xda4184=_0x5cab3e[_0xbe5a('0x40')]({'plain':!![]});_0x1aca43['account']=_0xda4184;_0x1aca43['applications']=_0xda4184[_0xbe5a('0x3e')];_0x1aca43['list']=_0xda4184['List'];_0x1aca43[_0xbe5a('0x41')]=_[_0xbe5a('0x42')](_0x1aca43[_0xbe5a('0x41')],[_0xbe5a('0x43')],['asc']);if(_0x1aca43['account'][_0xbe5a('0x3e')]){delete _0x1aca43[_0xbe5a('0x44')]['Applications'];}if(_0x1aca43[_0xbe5a('0x44')][_0xbe5a('0x3f')]&&_0x1aca43['account'][_0xbe5a('0x3f')][_0xbe5a('0x3b')][_0xbe5a('0x45')]){return _0x1aca43['account'][_0xbe5a('0x3f')]['Contacts'][0x0];}var _0x5f4d35=_[_0xbe5a('0xe')](_0x57739a[_0xbe5a('0x27')],{'firstName':_0x57739a['body'][_0xbe5a('0x33')],'ListId':_0xda4184[_0xbe5a('0x32')]});_0x5f4d35[_0x57739a[_0xbe5a('0x27')][_0xbe5a('0x37')]]=_0x57739a[_0xbe5a('0x27')][_0xbe5a('0x33')];return db['CmContact'][_0xbe5a('0x46')](_0x5f4d35,{'fields':_0x15f12c,'raw':!![]});}})[_0xbe5a('0x13')](function(_0x438795){_0x1aca43[_0xbe5a('0x47')]=_0x438795;if(_0x438795){var _0x19f66c={'ContactId':_0x438795['id'],'FaxAccountId':_0x57739a[_0xbe5a('0x44')]['id'],'fax':_0x438795[_0xbe5a('0x48')]};return db[_0xbe5a('0x49')][_0xbe5a('0x4a')]({'where':{'ContactId':_0x438795['id'],'closed':![],'FaxAccountId':_0x57739a[_0xbe5a('0x44')]['id']}})['then'](function(_0x8bd5f7){if(_0x8bd5f7){return[_0x8bd5f7,![]];}return db['FaxInteraction'][_0xbe5a('0x46')](_0x19f66c)[_0xbe5a('0x13')](function(_0x1e5bbe){return[_0x1e5bbe,!![]];});});}else{throw new Error(_0xbe5a('0x4b'));}})[_0xbe5a('0x4c')](function(_0x3a14ad,_0x9f0682){var _0x3a6ace=_0x3a14ad[_0xbe5a('0x40')]({'plain':!![]});if(_0x9f0682){if(_0x1aca43[_0xbe5a('0x44')]['autoclose']){_0x1aca43[_0xbe5a('0x41')][_0xbe5a('0x4d')]({'id':0x0,'priority':_0x1aca43[_0xbe5a('0x41')][_0xbe5a('0x45')]+0x1,'app':_0xbe5a('0x4e'),'appdata':_0xbe5a('0x4f'),'interval':'*,*,*,*'});}_0x3a6ace[_0xbe5a('0x50')]=!![];}else{_0x3a6ace[_0xbe5a('0x50')]=![];}_0x1aca43[_0xbe5a('0x51')]=_0x3a6ace;return db[_0xbe5a('0x52')][_0xbe5a('0x46')]({'body':_0x57739a[_0xbe5a('0x27')][_0xbe5a('0x27')],'FaxAccountId':_0x57739a[_0xbe5a('0x44')]['id'],'FaxInteractionId':_0x3a14ad['id'],'direction':'in','ContactId':_0x3a14ad[_0xbe5a('0x53')],'AttachmentId':_0x57739a[_0xbe5a('0x27')][_0xbe5a('0x54')]});})[_0xbe5a('0x13')](function(_0x1e00fc){_0x1aca43[_0xbe5a('0x19')]=_0x1e00fc;if(_0x1aca43[_0xbe5a('0x51')][_0xbe5a('0x55')]){return db[_0xbe5a('0x56')][_0xbe5a('0x4a')]({'attributes':['id',_0xbe5a('0x57')],'where':{'id':_0x1aca43[_0xbe5a('0x51')][_0xbe5a('0x55')]}})[_0xbe5a('0x13')](function(_0x47880f){if(_0x47880f){_0x1aca43['applications'][_0xbe5a('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x47880f[_0xbe5a('0x57')]+','+(_0x1aca43[_0xbe5a('0x44')]['waitForTheAssignedAgent']||0xa),'interval':_0xbe5a('0x59')});}return respondWithRpcPromise(_0xbe5a('0x5a'),_0xbe5a('0x5b'),_0x1aca43);});}return respondWithRpcPromise(_0xbe5a('0x5a'),_0xbe5a('0x5b'),_0x1aca43);})['then'](function(_0x5f4582){_0x54451b(_0x5f4582);})['catch'](function(_0xd1c170){_0x2344a0(_0x3d303a[_0xbe5a('0x16')](0x1f4,_0xd1c170[_0xbe5a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1cc6817..4ff4298 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 _0x6b0c=['emit','removeListener','length','./faxAccount.events','save','remove','update'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x6b0c,0x153));var _0xc6b0=function(_0x3bb026,_0x5ba1aa){_0x3bb026=_0x3bb026-0x0;var _0x4708fd=_0x6b0c[_0x3bb026];return _0x4708fd;};'use strict';var FaxAccountEvents=require(_0xc6b0('0x0'));var events=[_0xc6b0('0x1'),_0xc6b0('0x2'),_0xc6b0('0x3')];function createListener(_0x2cab1c,_0x1c1c2d){return function(_0x5f2791){_0x1c1c2d[_0xc6b0('0x4')](_0x2cab1c,_0x5f2791);};}function removeListener(_0x315fce,_0x381f84){return function(){FaxAccountEvents[_0xc6b0('0x5')](_0x315fce,_0x381f84);};}exports['register']=function(_0xaaf127){for(var _0x2dbe97=0x0,_0x527db1=events[_0xc6b0('0x6')];_0x2dbe97<_0x527db1;_0x2dbe97++){var _0x2012bc=events[_0x2dbe97];var _0x80d95f=createListener('faxAccount:'+_0x2012bc,_0xaaf127);FaxAccountEvents['on'](_0x2012bc,_0x80d95f);}}; \ No newline at end of file +var _0x61d1=['update','emit','register','length','faxAccount:','save','remove'];(function(_0x288a60,_0x18f16b){var _0x12a6da=function(_0x4b0a4d){while(--_0x4b0a4d){_0x288a60['push'](_0x288a60['shift']());}};_0x12a6da(++_0x18f16b);}(_0x61d1,0x1c5));var _0x161d=function(_0x2deb15,_0x102a17){_0x2deb15=_0x2deb15-0x0;var _0x1abb33=_0x61d1[_0x2deb15];return _0x1abb33;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x161d('0x0'),_0x161d('0x1'),_0x161d('0x2')];function createListener(_0x4749d3,_0x3591aa){return function(_0x3301c1){_0x3591aa[_0x161d('0x3')](_0x4749d3,_0x3301c1);};}function removeListener(_0x43927f,_0x2406c3){return function(){FaxAccountEvents['removeListener'](_0x43927f,_0x2406c3);};}exports[_0x161d('0x4')]=function(_0x324aad){for(var _0x3ee3a8=0x0,_0x3b0e2a=events[_0x161d('0x5')];_0x3ee3a8<_0x3b0e2a;_0x3ee3a8++){var _0x3b3f40=events[_0x3ee3a8];var _0x21025e=createListener(_0x161d('0x6')+_0x3b3f40,_0x324aad);FaxAccountEvents['on'](_0x3b3f40,_0x21025e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 858600b..e156fd7 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x12fc29,_0x3fcbd6){var _0x59076c=function(_0x488e58){while(--_0x488e58){_0x12fc29['push'](_0x12fc29['shift']());}};_0x59076c(++_0x3fcbd6);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x59cf5a,_0x381c66){var _0x88c714=function(_0x2a7a93){while(--_0x2a7a93){_0x59cf5a['push'](_0x59cf5a['shift']());}};_0x88c714(++_0x381c66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index ff3b984..8f9ee1b 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 _0x6337=['INTEGER','noop','STRING','exports'];(function(_0xcffcbe,_0x143d81){var _0x447d0d=function(_0x5753c2){while(--_0x5753c2){_0xcffcbe['push'](_0xcffcbe['shift']());}};_0x447d0d(++_0x143d81);}(_0x6337,0x143));var _0x7633=function(_0xd99608,_0x19d8cc){_0xd99608=_0xd99608-0x0;var _0x487e29=_0x6337[_0xd99608];return _0x487e29;};'use strict';var Sequelize=require('sequelize');module[_0x7633('0x0')]={'priority':{'type':Sequelize[_0x7633('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7633('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7633('0x3')]},'interval':{'type':Sequelize[_0x7633('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6678=['*,*,*,*','sequelize','INTEGER','TEXT','STRING'];(function(_0x547865,_0x907c50){var _0x20ea55=function(_0x12d32a){while(--_0x12d32a){_0x547865['push'](_0x547865['shift']());}};_0x20ea55(++_0x907c50);}(_0x6678,0x1aa));var _0x8667=function(_0x187399,_0x40c56d){_0x187399=_0x187399-0x0;var _0x40fa92=_0x6678[_0x187399];return _0x40fa92;};'use strict';var Sequelize=require(_0x8667('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8667('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8667('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8667('0x3')],'defaultValue':_0x8667('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6f826e1..7b21909 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 _0x88a8=['reject','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','FaxApplication','include','catch','show','params','length','includeAll','options','create','body','update','find','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x88a8,0xc0));var _0x888a=function(_0x592966,_0x480d71){_0x592966=_0x592966-0x0;var _0x10bb86=_0x88a8[_0x592966];return _0x10bb86;};'use strict';var emlformat=require(_0x888a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x888a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x888a('0x2'));var moment=require('moment');var BPromise=require(_0x888a('0x3'));var Mustache=require(_0x888a('0x4'));var util=require(_0x888a('0x5'));var path=require(_0x888a('0x6'));var sox=require(_0x888a('0x7'));var csv=require('to-csv');var ejs=require(_0x888a('0x8'));var fs=require('fs');var fs_extra=require(_0x888a('0x9'));var _=require('lodash');var squel=require(_0x888a('0xa'));var crypto=require(_0x888a('0xb'));var jsforce=require(_0x888a('0xc'));var deskjs=require(_0x888a('0xd'));var toCsv=require(_0x888a('0xe'));var querystring=require(_0x888a('0xf'));var Papa=require('papaparse');var Redis=require(_0x888a('0x10'));var authService=require(_0x888a('0x11'));var qs=require(_0x888a('0x12'));var as=require(_0x888a('0x13'));var hardwareService=require(_0x888a('0x14'));var logger=require('../../config/logger')(_0x888a('0x15'));var utils=require(_0x888a('0x16'));var config=require(_0x888a('0x17'));var licenseUtil=require(_0x888a('0x18'));var db=require(_0x888a('0x19'))['db'];function respondWithStatusCode(_0x129a9a,_0xeb0c2f){_0xeb0c2f=_0xeb0c2f||0xcc;return function(_0x6fd068){if(_0x6fd068){return _0x129a9a['sendStatus'](_0xeb0c2f);}return _0x129a9a[_0x888a('0x1a')](_0xeb0c2f)[_0x888a('0x1b')]();};}function respondWithResult(_0x598f1d,_0x40522b){_0x40522b=_0x40522b||0xc8;return function(_0x27d42b){if(_0x27d42b){return _0x598f1d[_0x888a('0x1a')](_0x40522b)[_0x888a('0x1c')](_0x27d42b);}};}function respondWithFilteredResult(_0x2ca3b3,_0x2208d9){return function(_0x130dbe){if(_0x130dbe){var _0x4917c3=typeof _0x2208d9[_0x888a('0x1d')]===_0x888a('0x1e')&&typeof _0x2208d9['limit']===_0x888a('0x1e');var _0x535cd4=_0x130dbe[_0x888a('0x1f')];var _0x4ac56a=_0x4917c3?0x0:_0x2208d9[_0x888a('0x1d')];var _0x127c50=_0x4917c3?_0x130dbe['count']:_0x2208d9[_0x888a('0x1d')]+_0x2208d9[_0x888a('0x20')];var _0x24848a;if(_0x127c50>=_0x535cd4){_0x127c50=_0x535cd4;_0x24848a=0xc8;}else{_0x24848a=0xce;}_0x2ca3b3['status'](_0x24848a);return _0x2ca3b3[_0x888a('0x21')](_0x888a('0x22'),_0x4ac56a+'-'+_0x127c50+'/'+_0x535cd4)[_0x888a('0x1c')](_0x130dbe);}return null;};}function patchUpdates(_0x4d45ba){return function(_0x2349fe){try{jsonpatch[_0x888a('0x23')](_0x2349fe,_0x4d45ba,!![]);}catch(_0x577956){return BPromise[_0x888a('0x24')](_0x577956);}return _0x2349fe['save']();};}function saveUpdates(_0x2fd31a,_0x25b25e){return function(_0xd515f1){if(_0xd515f1){return _0xd515f1['update'](_0x2fd31a)['then'](function(_0x20efb5){return _0x20efb5;});}return null;};}function removeEntity(_0x3a582d,_0x6497c1){return function(_0x28e41f){if(_0x28e41f){return _0x28e41f[_0x888a('0x25')]()[_0x888a('0x26')](function(){_0x3a582d[_0x888a('0x1a')](0xcc)[_0x888a('0x1b')]();});}};}function handleEntityNotFound(_0x42bd8e,_0x3171b8){return function(_0x1e3fa1){if(!_0x1e3fa1){_0x42bd8e[_0x888a('0x27')](0x194);}return _0x1e3fa1;};}function handleError(_0x314ebe,_0x25a33a){_0x25a33a=_0x25a33a||0x1f4;return function(_0x23c403){logger[_0x888a('0x28')](_0x23c403[_0x888a('0x29')]);if(_0x23c403[_0x888a('0x2a')]){delete _0x23c403[_0x888a('0x2a')];}_0x314ebe['status'](_0x25a33a)[_0x888a('0x2b')](_0x23c403);};}exports[_0x888a('0x2c')]=function(_0x3d59e2,_0x4fe260){var _0x52024b={},_0x136c9b={},_0x1eca31={'count':0x0,'rows':[]};var _0x5143d8=_[_0x888a('0x2d')](db['FaxApplication'][_0x888a('0x2e')],function(_0x2507eb){return{'name':_0x2507eb[_0x888a('0x2f')],'type':_0x2507eb['type'][_0x888a('0x30')]};});_0x136c9b[_0x888a('0x31')]=_['map'](_0x5143d8,_0x888a('0x2a'));_0x136c9b['query']=_[_0x888a('0x32')](_0x3d59e2[_0x888a('0x33')]);_0x136c9b[_0x888a('0x34')]=_[_0x888a('0x35')](_0x136c9b[_0x888a('0x31')],_0x136c9b[_0x888a('0x33')]);_0x52024b[_0x888a('0x36')]=_[_0x888a('0x35')](_0x136c9b[_0x888a('0x31')],qs[_0x888a('0x37')](_0x3d59e2[_0x888a('0x33')]['fields']));_0x52024b['attributes']=_0x52024b[_0x888a('0x36')]['length']?_0x52024b['attributes']:_0x136c9b[_0x888a('0x31')];if(!_0x3d59e2[_0x888a('0x33')]['hasOwnProperty'](_0x888a('0x38'))){_0x52024b[_0x888a('0x20')]=qs['limit'](_0x3d59e2[_0x888a('0x33')][_0x888a('0x20')]);_0x52024b['offset']=qs[_0x888a('0x1d')](_0x3d59e2[_0x888a('0x33')][_0x888a('0x1d')]);}_0x52024b['order']=qs[_0x888a('0x39')](_0x3d59e2[_0x888a('0x33')][_0x888a('0x39')]);_0x52024b['where']=qs[_0x888a('0x34')](_[_0x888a('0x3a')](_0x3d59e2[_0x888a('0x33')],_0x136c9b[_0x888a('0x34')]),_0x5143d8);if(_0x3d59e2[_0x888a('0x33')][_0x888a('0x3b')]){_0x52024b[_0x888a('0x3c')]=_['merge'](_0x52024b[_0x888a('0x3c')],{'$or':_[_0x888a('0x2d')](_0x5143d8,function(_0x425c37){if(_0x425c37[_0x888a('0x3d')]!==_0x888a('0x3e')){var _0x4b8377={};_0x4b8377[_0x425c37[_0x888a('0x2a')]]={'$like':'%'+_0x3d59e2[_0x888a('0x33')][_0x888a('0x3b')]+'%'};return _0x4b8377;}})});}_0x52024b=_[_0x888a('0x3f')]({},_0x52024b,_0x3d59e2['options']);var _0x5682e8={'where':_0x52024b[_0x888a('0x3c')]};return db[_0x888a('0x40')][_0x888a('0x1f')](_0x5682e8)[_0x888a('0x26')](function(_0x3fb75e){_0x1eca31[_0x888a('0x1f')]=_0x3fb75e;if(_0x3d59e2[_0x888a('0x33')]['includeAll']){_0x52024b[_0x888a('0x41')]=[{'all':!![]}];}return db[_0x888a('0x40')]['findAll'](_0x52024b);})[_0x888a('0x26')](function(_0xc73a5b){_0x1eca31['rows']=_0xc73a5b;return _0x1eca31;})[_0x888a('0x26')](respondWithFilteredResult(_0x4fe260,_0x52024b))[_0x888a('0x42')](handleError(_0x4fe260,null));};exports[_0x888a('0x43')]=function(_0x7792e,_0x917933){var _0x19c6fc={'raw':!![],'where':{'id':_0x7792e[_0x888a('0x44')]['id']}},_0x44d64a={};_0x44d64a[_0x888a('0x31')]=_[_0x888a('0x32')](db[_0x888a('0x40')][_0x888a('0x2e')]);_0x44d64a[_0x888a('0x33')]=_[_0x888a('0x32')](_0x7792e[_0x888a('0x33')]);_0x44d64a['filters']=_[_0x888a('0x35')](_0x44d64a[_0x888a('0x31')],_0x44d64a['query']);_0x19c6fc['attributes']=_[_0x888a('0x35')](_0x44d64a[_0x888a('0x31')],qs[_0x888a('0x37')](_0x7792e[_0x888a('0x33')][_0x888a('0x37')]));_0x19c6fc[_0x888a('0x36')]=_0x19c6fc[_0x888a('0x36')][_0x888a('0x45')]?_0x19c6fc[_0x888a('0x36')]:_0x44d64a['model'];if(_0x7792e[_0x888a('0x33')][_0x888a('0x46')]){_0x19c6fc['include']=[{'all':!![]}];}_0x19c6fc=_[_0x888a('0x3f')]({},_0x19c6fc,_0x7792e[_0x888a('0x47')]);return db[_0x888a('0x40')]['find'](_0x19c6fc)[_0x888a('0x26')](handleEntityNotFound(_0x917933,null))[_0x888a('0x26')](respondWithResult(_0x917933,null))[_0x888a('0x42')](handleError(_0x917933,null));};exports[_0x888a('0x48')]=function(_0x1d79db,_0x48fdfd){return db['FaxApplication'][_0x888a('0x48')](_0x1d79db[_0x888a('0x49')],{})[_0x888a('0x26')](respondWithResult(_0x48fdfd,0xc9))[_0x888a('0x42')](handleError(_0x48fdfd,null));};exports[_0x888a('0x4a')]=function(_0x20e74d,_0x4590b9){if(_0x20e74d['body']['id']){delete _0x20e74d[_0x888a('0x49')]['id'];}return db['FaxApplication'][_0x888a('0x4b')]({'where':{'id':_0x20e74d[_0x888a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4590b9,null))[_0x888a('0x26')](saveUpdates(_0x20e74d['body'],null))['then'](respondWithResult(_0x4590b9,null))[_0x888a('0x42')](handleError(_0x4590b9,null));};exports['destroy']=function(_0x5770d5,_0x2f076c){return db[_0x888a('0x40')]['find']({'where':{'id':_0x5770d5['params']['id']}})[_0x888a('0x26')](handleEntityNotFound(_0x2f076c,null))[_0x888a('0x26')](removeEntity(_0x2f076c,null))[_0x888a('0x42')](handleError(_0x2f076c,null));}; \ No newline at end of file +var _0xa2db=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x204b1a,_0x16f610){var _0x28d9b5=function(_0x96e67e){while(--_0x96e67e){_0x204b1a['push'](_0x204b1a['shift']());}};_0x28d9b5(++_0x16f610);}(_0xa2db,0x122));var _0xba2d=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0xa2db[_0x2211ed];return _0x4d78cc;};'use strict';var emlformat=require(_0xba2d('0x0'));var rimraf=require(_0xba2d('0x1'));var zipdir=require(_0xba2d('0x2'));var jsonpatch=require(_0xba2d('0x3'));var rp=require(_0xba2d('0x4'));var moment=require(_0xba2d('0x5'));var BPromise=require(_0xba2d('0x6'));var Mustache=require(_0xba2d('0x7'));var util=require(_0xba2d('0x8'));var path=require(_0xba2d('0x9'));var sox=require(_0xba2d('0xa'));var csv=require('to-csv');var ejs=require(_0xba2d('0xb'));var fs=require('fs');var fs_extra=require(_0xba2d('0xc'));var _=require(_0xba2d('0xd'));var squel=require(_0xba2d('0xe'));var crypto=require('crypto');var jsforce=require(_0xba2d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xba2d('0x10'));var querystring=require('querystring');var Papa=require(_0xba2d('0x11'));var Redis=require('ioredis');var authService=require(_0xba2d('0x12'));var qs=require(_0xba2d('0x13'));var as=require(_0xba2d('0x14'));var hardwareService=require(_0xba2d('0x15'));var logger=require(_0xba2d('0x16'))('api');var utils=require(_0xba2d('0x17'));var config=require(_0xba2d('0x18'));var licenseUtil=require(_0xba2d('0x19'));var db=require(_0xba2d('0x1a'))['db'];function respondWithStatusCode(_0x524487,_0x4b04fd){_0x4b04fd=_0x4b04fd||0xcc;return function(_0x535814){if(_0x535814){return _0x524487[_0xba2d('0x1b')](_0x4b04fd);}return _0x524487[_0xba2d('0x1c')](_0x4b04fd)[_0xba2d('0x1d')]();};}function respondWithResult(_0x5c98ec,_0x9a2428){_0x9a2428=_0x9a2428||0xc8;return function(_0x20da95){if(_0x20da95){return _0x5c98ec[_0xba2d('0x1c')](_0x9a2428)['json'](_0x20da95);}};}function respondWithFilteredResult(_0x1808b3,_0x5a7416){return function(_0x246200){if(_0x246200){var _0x11df7d=typeof _0x5a7416[_0xba2d('0x1e')]==='undefined'&&typeof _0x5a7416[_0xba2d('0x1f')]===_0xba2d('0x20');var _0x22f757=_0x246200['count'];var _0x1f7477=_0x11df7d?0x0:_0x5a7416['offset'];var _0x452c5c=_0x11df7d?_0x246200[_0xba2d('0x21')]:_0x5a7416[_0xba2d('0x1e')]+_0x5a7416[_0xba2d('0x1f')];var _0x3c0f17;if(_0x452c5c>=_0x22f757){_0x452c5c=_0x22f757;_0x3c0f17=0xc8;}else{_0x3c0f17=0xce;}_0x1808b3['status'](_0x3c0f17);return _0x1808b3[_0xba2d('0x22')](_0xba2d('0x23'),_0x1f7477+'-'+_0x452c5c+'/'+_0x22f757)[_0xba2d('0x24')](_0x246200);}return null;};}function patchUpdates(_0x277fba){return function(_0x1fbc39){try{jsonpatch[_0xba2d('0x25')](_0x1fbc39,_0x277fba,!![]);}catch(_0x52487b){return BPromise[_0xba2d('0x26')](_0x52487b);}return _0x1fbc39[_0xba2d('0x27')]();};}function saveUpdates(_0x8bd6cf,_0x43e543){return function(_0x4b01a3){if(_0x4b01a3){return _0x4b01a3[_0xba2d('0x28')](_0x8bd6cf)[_0xba2d('0x29')](function(_0xc8b33c){return _0xc8b33c;});}return null;};}function removeEntity(_0xd2a62b,_0x57a33d){return function(_0x3d7ff3){if(_0x3d7ff3){return _0x3d7ff3['destroy']()['then'](function(){_0xd2a62b[_0xba2d('0x1c')](0xcc)[_0xba2d('0x1d')]();});}};}function handleEntityNotFound(_0x34344d,_0x3799e5){return function(_0x168db8){if(!_0x168db8){_0x34344d[_0xba2d('0x1b')](0x194);}return _0x168db8;};}function handleError(_0x331001,_0xc06c8e){_0xc06c8e=_0xc06c8e||0x1f4;return function(_0x542f98){logger[_0xba2d('0x2a')](_0x542f98[_0xba2d('0x2b')]);if(_0x542f98[_0xba2d('0x2c')]){delete _0x542f98[_0xba2d('0x2c')];}_0x331001['status'](_0xc06c8e)[_0xba2d('0x2d')](_0x542f98);};}exports['index']=function(_0x2b654b,_0x3e394b){var _0x211979={},_0x61a8cb={},_0x4fc062={'count':0x0,'rows':[]};var _0x5c986b=_[_0xba2d('0x2e')](db[_0xba2d('0x2f')][_0xba2d('0x30')],function(_0x3af165){return{'name':_0x3af165[_0xba2d('0x31')],'type':_0x3af165[_0xba2d('0x32')]['key']};});_0x61a8cb[_0xba2d('0x33')]=_['map'](_0x5c986b,_0xba2d('0x2c'));_0x61a8cb[_0xba2d('0x34')]=_[_0xba2d('0x35')](_0x2b654b['query']);_0x61a8cb[_0xba2d('0x36')]=_[_0xba2d('0x37')](_0x61a8cb['model'],_0x61a8cb[_0xba2d('0x34')]);_0x211979['attributes']=_[_0xba2d('0x37')](_0x61a8cb[_0xba2d('0x33')],qs['fields'](_0x2b654b[_0xba2d('0x34')][_0xba2d('0x38')]));_0x211979[_0xba2d('0x39')]=_0x211979[_0xba2d('0x39')][_0xba2d('0x3a')]?_0x211979['attributes']:_0x61a8cb[_0xba2d('0x33')];if(!_0x2b654b[_0xba2d('0x34')][_0xba2d('0x3b')](_0xba2d('0x3c'))){_0x211979[_0xba2d('0x1f')]=qs[_0xba2d('0x1f')](_0x2b654b[_0xba2d('0x34')]['limit']);_0x211979[_0xba2d('0x1e')]=qs[_0xba2d('0x1e')](_0x2b654b['query'][_0xba2d('0x1e')]);}_0x211979[_0xba2d('0x3d')]=qs[_0xba2d('0x3e')](_0x2b654b[_0xba2d('0x34')][_0xba2d('0x3e')]);_0x211979[_0xba2d('0x3f')]=qs[_0xba2d('0x36')](_[_0xba2d('0x40')](_0x2b654b[_0xba2d('0x34')],_0x61a8cb[_0xba2d('0x36')]),_0x5c986b);if(_0x2b654b['query'][_0xba2d('0x41')]){_0x211979[_0xba2d('0x3f')]=_['merge'](_0x211979[_0xba2d('0x3f')],{'$or':_['map'](_0x5c986b,function(_0x58f099){if(_0x58f099[_0xba2d('0x32')]!==_0xba2d('0x42')){var _0x290537={};_0x290537[_0x58f099['name']]={'$like':'%'+_0x2b654b[_0xba2d('0x34')][_0xba2d('0x41')]+'%'};return _0x290537;}})});}_0x211979=_[_0xba2d('0x43')]({},_0x211979,_0x2b654b[_0xba2d('0x44')]);var _0x55397d={'where':_0x211979[_0xba2d('0x3f')]};return db[_0xba2d('0x2f')][_0xba2d('0x21')](_0x55397d)['then'](function(_0x428ac0){_0x4fc062[_0xba2d('0x21')]=_0x428ac0;if(_0x2b654b[_0xba2d('0x34')]['includeAll']){_0x211979[_0xba2d('0x45')]=[{'all':!![]}];}return db[_0xba2d('0x2f')][_0xba2d('0x46')](_0x211979);})[_0xba2d('0x29')](function(_0x18e869){_0x4fc062[_0xba2d('0x47')]=_0x18e869;return _0x4fc062;})[_0xba2d('0x29')](respondWithFilteredResult(_0x3e394b,_0x211979))[_0xba2d('0x48')](handleError(_0x3e394b,null));};exports['show']=function(_0xd662cd,_0x592c8a){var _0x103f24={'raw':!![],'where':{'id':_0xd662cd[_0xba2d('0x49')]['id']}},_0x398f66={};_0x398f66['model']=_['keys'](db[_0xba2d('0x2f')]['rawAttributes']);_0x398f66[_0xba2d('0x34')]=_[_0xba2d('0x35')](_0xd662cd[_0xba2d('0x34')]);_0x398f66['filters']=_[_0xba2d('0x37')](_0x398f66['model'],_0x398f66[_0xba2d('0x34')]);_0x103f24[_0xba2d('0x39')]=_['intersection'](_0x398f66[_0xba2d('0x33')],qs[_0xba2d('0x38')](_0xd662cd[_0xba2d('0x34')][_0xba2d('0x38')]));_0x103f24['attributes']=_0x103f24[_0xba2d('0x39')]['length']?_0x103f24[_0xba2d('0x39')]:_0x398f66[_0xba2d('0x33')];if(_0xd662cd['query']['includeAll']){_0x103f24[_0xba2d('0x45')]=[{'all':!![]}];}_0x103f24=_['merge']({},_0x103f24,_0xd662cd[_0xba2d('0x44')]);return db['FaxApplication'][_0xba2d('0x4a')](_0x103f24)[_0xba2d('0x29')](handleEntityNotFound(_0x592c8a,null))['then'](respondWithResult(_0x592c8a,null))[_0xba2d('0x48')](handleError(_0x592c8a,null));};exports[_0xba2d('0x4b')]=function(_0x192bc0,_0x59865b){return db[_0xba2d('0x2f')][_0xba2d('0x4b')](_0x192bc0['body'],{})[_0xba2d('0x29')](respondWithResult(_0x59865b,0xc9))[_0xba2d('0x48')](handleError(_0x59865b,null));};exports['update']=function(_0xecc44a,_0x4b1468){if(_0xecc44a[_0xba2d('0x4c')]['id']){delete _0xecc44a[_0xba2d('0x4c')]['id'];}return db[_0xba2d('0x2f')][_0xba2d('0x4a')]({'where':{'id':_0xecc44a[_0xba2d('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b1468,null))[_0xba2d('0x29')](saveUpdates(_0xecc44a[_0xba2d('0x4c')],null))[_0xba2d('0x29')](respondWithResult(_0x4b1468,null))[_0xba2d('0x48')](handleError(_0x4b1468,null));};exports[_0xba2d('0x4d')]=function(_0x18bc6c,_0x2568a3){return db['FaxApplication'][_0xba2d('0x4a')]({'where':{'id':_0x18bc6c['params']['id']}})[_0xba2d('0x29')](handleEntityNotFound(_0x2568a3,null))[_0xba2d('0x29')](removeEntity(_0x2568a3,null))[_0xba2d('0x48')](handleError(_0x2568a3,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 7203022..c018a93 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 _0xf1ab=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4c9bee,_0x5400fc){var _0x443ad3=function(_0x1755fc){while(--_0x1755fc){_0x4c9bee['push'](_0x4c9bee['shift']());}};_0x443ad3(++_0x5400fc);}(_0xf1ab,0xdf));var _0xbf1a=function(_0x456b74,_0x5a9cc3){_0x456b74=_0x456b74-0x0;var _0x2104e2=_0xf1ab[_0x456b74];return _0x2104e2;};'use strict';var _=require(_0xbf1a('0x0'));var util=require(_0xbf1a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbf1a('0x2'));var BPromise=require(_0xbf1a('0x3'));var rp=require(_0xbf1a('0x4'));var fs=require('fs');var path=require(_0xbf1a('0x5'));var rimraf=require(_0xbf1a('0x6'));var config=require(_0xbf1a('0x7'));var attributes=require(_0xbf1a('0x8'));module['exports']=function(_0x35b54b,_0xc2e107){return _0x35b54b[_0xbf1a('0x9')](_0xbf1a('0xa'),attributes,{'tableName':_0xbf1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf1a('0xc'),'collate':_0xbf1a('0xd')});}; \ No newline at end of file +var _0xa85f=['rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','lodash','util','moment','bluebird','path'];(function(_0x4665d7,_0x344c5b){var _0x26ae0=function(_0x41ad6f){while(--_0x41ad6f){_0x4665d7['push'](_0x4665d7['shift']());}};_0x26ae0(++_0x344c5b);}(_0xa85f,0x8a));var _0xfa85=function(_0x566ab4,_0x207b47){_0x566ab4=_0x566ab4-0x0;var _0x24f135=_0xa85f[_0x566ab4];return _0x24f135;};'use strict';var _=require(_0xfa85('0x0'));var util=require(_0xfa85('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa85('0x2'));var BPromise=require(_0xfa85('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa85('0x4'));var rimraf=require(_0xfa85('0x5'));var config=require(_0xfa85('0x6'));var attributes=require(_0xfa85('0x7'));module[_0xfa85('0x8')]=function(_0xa0bbdc,_0x1304ea){return _0xa0bbdc[_0xfa85('0x9')]('FaxApplication',attributes,{'tableName':_0xfa85('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index df8a8b2..ac9ffed 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 _0x1976=['where','attributes','limit','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','update','body','options','raw'];(function(_0x4e12df,_0x3a8588){var _0x5822c3=function(_0x445446){while(--_0x445446){_0x4e12df['push'](_0x4e12df['shift']());}};_0x5822c3(++_0x3a8588);}(_0x1976,0x1e3));var _0x6197=function(_0x1577ab,_0x56288b){_0x1577ab=_0x1577ab-0x0;var _0x27402a=_0x1976[_0x1577ab];return _0x27402a;};'use strict';var _=require('lodash');var util=require(_0x6197('0x0'));var moment=require('moment');var BPromise=require(_0x6197('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6197('0x2'));var db=require(_0x6197('0x3'))['db'];var utils=require(_0x6197('0x4'));var logger=require(_0x6197('0x5'))(_0x6197('0x6'));var config=require('../../config/environment');var jayson=require(_0x6197('0x7'));var client=jayson[_0x6197('0x8')][_0x6197('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19c5c1,_0x15462b,_0x2fbcb3){return new BPromise(function(_0x196143,_0x46fe19){return client[_0x6197('0xa')](_0x19c5c1,_0x2fbcb3)[_0x6197('0xb')](function(_0x380a5d){logger[_0x6197('0xc')](_0x6197('0xd'),_0x15462b,_0x6197('0xe'));logger[_0x6197('0xf')](_0x6197('0x10'),_0x15462b,'request\x20sent',JSON[_0x6197('0x11')](_0x380a5d));if(_0x380a5d[_0x6197('0x12')]){if(_0x380a5d[_0x6197('0x12')]['code']===0x1f4){logger[_0x6197('0x12')](_0x6197('0xd'),_0x15462b,_0x380a5d['error'][_0x6197('0x13')]);return _0x46fe19(_0x380a5d[_0x6197('0x12')][_0x6197('0x13')]);}logger[_0x6197('0x12')](_0x6197('0xd'),_0x15462b,_0x380a5d[_0x6197('0x12')][_0x6197('0x13')]);return _0x196143(_0x380a5d[_0x6197('0x12')]['message']);}else{logger[_0x6197('0xc')](_0x6197('0xd'),_0x15462b,'request\x20sent');_0x196143(_0x380a5d[_0x6197('0x14')][_0x6197('0x13')]);}})[_0x6197('0x15')](function(_0x382abe){logger['error'](_0x6197('0xd'),_0x15462b,_0x382abe);_0x46fe19(_0x382abe);});});}exports[_0x6197('0x16')]=function(_0x143836){var _0x214049=this;return new Promise(function(_0x48024e,_0x24a557){return db['FaxApplication'][_0x6197('0x17')](_0x143836[_0x6197('0x18')],{'raw':_0x143836[_0x6197('0x19')]?_0x143836[_0x6197('0x19')][_0x6197('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x143836[_0x6197('0x19')]?_0x143836[_0x6197('0x19')][_0x6197('0x1b')]||null:null,'attributes':_0x143836[_0x6197('0x19')]?_0x143836[_0x6197('0x19')][_0x6197('0x1c')]||null:null,'limit':_0x143836[_0x6197('0x19')]?_0x143836['options'][_0x6197('0x1d')]||null:null})['then'](function(_0x43c582){logger['info'](_0x6197('0x16'),_0x143836);logger[_0x6197('0xf')](_0x6197('0x16'),_0x143836,JSON['stringify'](_0x43c582));_0x48024e(_0x43c582);})[_0x6197('0x15')](function(_0x5e779f){logger[_0x6197('0x12')](_0x6197('0x16'),_0x5e779f['message'],_0x143836);_0x24a557(_0x214049[_0x6197('0x12')](0x1f4,_0x5e779f[_0x6197('0x13')]));});});}; \ No newline at end of file +var _0x9fe3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','info','lodash','moment'];(function(_0x147b41,_0x44b107){var _0x10a115=function(_0x59a682){while(--_0x59a682){_0x147b41['push'](_0x147b41['shift']());}};_0x10a115(++_0x44b107);}(_0x9fe3,0x1b1));var _0x39fe=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x9fe3[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x39fe('0x0'));var util=require('util');var moment=require(_0x39fe('0x1'));var BPromise=require(_0x39fe('0x2'));var rs=require(_0x39fe('0x3'));var fs=require('fs');var Redis=require(_0x39fe('0x4'));var db=require(_0x39fe('0x5'))['db'];var utils=require(_0x39fe('0x6'));var logger=require(_0x39fe('0x7'))(_0x39fe('0x8'));var config=require(_0x39fe('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x39fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x418bc4,_0x42be6d,_0x228ecd){return new BPromise(function(_0x4fcd91,_0x32490c){return client[_0x39fe('0xb')](_0x418bc4,_0x228ecd)[_0x39fe('0xc')](function(_0x207175){logger['info'](_0x39fe('0xd'),_0x42be6d,_0x39fe('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x42be6d,_0x39fe('0xe'),JSON[_0x39fe('0xf')](_0x207175));if(_0x207175['error']){if(_0x207175['error']['code']===0x1f4){logger[_0x39fe('0x10')](_0x39fe('0xd'),_0x42be6d,_0x207175[_0x39fe('0x10')][_0x39fe('0x11')]);return _0x32490c(_0x207175[_0x39fe('0x10')]['message']);}logger[_0x39fe('0x10')]('FaxApplication,\x20%s,\x20%s',_0x42be6d,_0x207175[_0x39fe('0x10')][_0x39fe('0x11')]);return _0x4fcd91(_0x207175[_0x39fe('0x10')][_0x39fe('0x11')]);}else{logger['info'](_0x39fe('0xd'),_0x42be6d,_0x39fe('0xe'));_0x4fcd91(_0x207175[_0x39fe('0x12')][_0x39fe('0x11')]);}})[_0x39fe('0x13')](function(_0x1235d5){logger[_0x39fe('0x10')](_0x39fe('0xd'),_0x42be6d,_0x1235d5);_0x32490c(_0x1235d5);});});}exports[_0x39fe('0x14')]=function(_0x29a376){var _0x2049dd=this;return new Promise(function(_0x520904,_0x353580){return db[_0x39fe('0x15')]['update'](_0x29a376[_0x39fe('0x16')],{'raw':_0x29a376[_0x39fe('0x17')]?_0x29a376[_0x39fe('0x17')][_0x39fe('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29a376['options']?_0x29a376['options'][_0x39fe('0x19')]||null:null,'attributes':_0x29a376[_0x39fe('0x17')]?_0x29a376['options'][_0x39fe('0x1a')]||null:null,'limit':_0x29a376[_0x39fe('0x17')]?_0x29a376[_0x39fe('0x17')][_0x39fe('0x1b')]||null:null})['then'](function(_0x2f3778){logger[_0x39fe('0x1c')]('UpdateFaxApplication',_0x29a376);logger['debug'](_0x39fe('0x14'),_0x29a376,JSON[_0x39fe('0xf')](_0x2f3778));_0x520904(_0x2f3778);})['catch'](function(_0x36f775){logger[_0x39fe('0x10')](_0x39fe('0x14'),_0x36f775[_0x39fe('0x11')],_0x29a376);_0x353580(_0x2049dd[_0x39fe('0x10')](0x1f4,_0x36f775[_0x39fe('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 238c3e4..4794266 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 _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x4a9be7,_0x274e5e){var _0x2af3cb=function(_0x12d277){while(--_0x12d277){_0x4a9be7['push'](_0x4a9be7['shift']());}};_0x2af3cb(++_0x274e5e);}(_0x34b7,0x196));var _0x734b=function(_0xc06638,_0x68dc26){_0xc06638=_0xc06638-0x0;var _0x34e96c=_0x34b7[_0xc06638];return _0x34e96c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x27c151,_0x52c49b){var _0x5c4bf9=function(_0x45aaee){while(--_0x45aaee){_0x27c151['push'](_0x27c151['shift']());}};_0x5c4bf9(++_0x52c49b);}(_0xda3f,0xec));var _0xfda3=function(_0x2dd093,_0x3070d5){_0x2dd093=_0x2dd093-0x0;var _0x51a639=_0xda3f[_0x2dd093];return _0x51a639;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./faxApplication.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d00ae8c..5d81d1e 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 _0xaef5=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xaef5,0xe2));var _0x5aef=function(_0xfd8207,_0x51cc1c){_0xfd8207=_0xfd8207-0x0;var _0x3e5030=_0xaef5[_0xfd8207];return _0x3e5030;};'use strict';var Sequelize=require(_0x5aef('0x0'));module[_0x5aef('0x1')]={'closed':{'type':Sequelize[_0x5aef('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5aef('0x3')]},'disposition':{'type':Sequelize[_0x5aef('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5aef('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x5aef('0x5')]('in',_0x5aef('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5aef('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb4fc=['out','DATE','sequelize','BOOLEAN','STRING','ENUM'];(function(_0x137ae3,_0x4e93bf){var _0x3de34c=function(_0x3ecf5f){while(--_0x3ecf5f){_0x137ae3['push'](_0x137ae3['shift']());}};_0x3de34c(++_0x4e93bf);}(_0xb4fc,0x146));var _0xcb4f=function(_0x4eb4fe,_0x296c34){_0x4eb4fe=_0x4eb4fe-0x0;var _0x576eac=_0xb4fc[_0x4eb4fe];return _0x576eac;};'use strict';var Sequelize=require(_0xcb4f('0x0'));module['exports']={'closed':{'type':Sequelize[_0xcb4f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xcb4f('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcb4f('0x2')]},'note':{'type':Sequelize[_0xcb4f('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xcb4f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xcb4f('0x3')]('in',_0xcb4f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcb4f('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xcb4f('0x3')]('in',_0xcb4f('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index a039362..493038b 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 _0x8a8c=['catch','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','join','root','server','tmp','files','transcript-%d-%s.zip','push','Attachment','Messages','mkdirSync','pipe','createWriteStream','basename','resolve','log','unlinkSync','moment','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','name','index','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','user'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x8a8c,0x163));var _0xc8a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a8c[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xc8a8('0x0'));var BPromise=require('bluebird');var util=require(_0xc8a8('0x1'));var path=require(_0xc8a8('0x2'));var fs=require('fs');var _=require(_0xc8a8('0x3'));var Redis=require(_0xc8a8('0x4'));var interaction=require(_0xc8a8('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xc8a8('0x6'))(_0xc8a8('0x7'));var config=require(_0xc8a8('0x8'));var db=require(_0xc8a8('0x9'))['db'];config[_0xc8a8('0xa')]=_[_0xc8a8('0xb')](config[_0xc8a8('0xa')],{'host':_0xc8a8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc8a8('0xa')]));require(_0xc8a8('0xd'))['register'](socket);function respondWithStatusCode(_0x4f1d2d,_0x484745){_0x484745=_0x484745||0xcc;return function(_0x2d5698){if(_0x2d5698){return _0x4f1d2d[_0xc8a8('0xe')](_0x484745);}return _0x4f1d2d[_0xc8a8('0xf')](_0x484745)[_0xc8a8('0x10')]();};}function respondWithResult(_0x425578,_0x12a141){_0x12a141=_0x12a141||0xc8;return function(_0xc4b306){if(_0xc4b306){return _0x425578[_0xc8a8('0xf')](_0x12a141)[_0xc8a8('0x11')](_0xc4b306);}};}function respondWithFilteredResult(_0x223db6,_0x13d994){return function(_0x15619d){if(_0x15619d){var _0x3ce3a1=typeof _0x13d994[_0xc8a8('0x12')]==='undefined'&&typeof _0x13d994[_0xc8a8('0x13')]===_0xc8a8('0x14');var _0x28a2f5=_0x15619d[_0xc8a8('0x15')];var _0x47b7d8=_0x3ce3a1?0x0:_0x13d994[_0xc8a8('0x12')];var _0x1d2311=_0x3ce3a1?_0x15619d['count']:_0x13d994['offset']+_0x13d994[_0xc8a8('0x13')];var _0x3e39f8;if(_0x1d2311>=_0x28a2f5){_0x1d2311=_0x28a2f5;_0x3e39f8=0xc8;}else{_0x3e39f8=0xce;}_0x223db6[_0xc8a8('0xf')](_0x3e39f8);return _0x223db6['set'](_0xc8a8('0x16'),_0x47b7d8+'-'+_0x1d2311+'/'+_0x28a2f5)[_0xc8a8('0x11')](_0x15619d);}return null;};}function saveUpdates(_0x3abe3d){return function(_0x2f192b){if(_0x2f192b){return _0x2f192b[_0xc8a8('0x17')](_0x3abe3d)[_0xc8a8('0x18')](function(_0x31449e){return _0x31449e;});}return null;};}function removeEntity(_0x274fb2){return function(_0x10590a){if(_0x10590a){return _0x10590a[_0xc8a8('0x19')]()['then'](function(){_0x274fb2[_0xc8a8('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11020c){return function(_0x1e937b){if(!_0x1e937b){_0x11020c[_0xc8a8('0xe')](0x194);}return _0x1e937b;};}function handleError(_0x3d1a7d,_0x43732d){_0x43732d=_0x43732d||0x1f4;return function(_0x28b7aa){logger['error'](_0x28b7aa['stack']);if(_0x28b7aa['name']){delete _0x28b7aa[_0xc8a8('0x1a')];}_0x3d1a7d[_0xc8a8('0xf')](_0x43732d)['send'](_0x28b7aa);};}exports[_0xc8a8('0x1b')]=function(_0x41dde7,_0xc71570){var _0x219142={};var _0x362a0d=_['map'](db[_0xc8a8('0x1c')][_0xc8a8('0x1d')],function(_0xd42d2){return{'name':_0xd42d2[_0xc8a8('0x1e')],'type':_0xd42d2[_0xc8a8('0x1f')][_0xc8a8('0x20')]};});_0x219142=qs[_0xc8a8('0x21')](_0x362a0d,_0x41dde7);return interaction[_0xc8a8('0x22')](_0xc8a8('0x23'),_0x41dde7['query'],_0x41dde7[_0xc8a8('0x24')],_0x219142,_0x362a0d)[_0xc8a8('0x18')](respondWithFilteredResult(_0xc71570,_0x219142))[_0xc8a8('0x25')](handleError(_0xc71570,null));};exports[_0xc8a8('0x26')]=function(_0x20c980,_0x26137d){var _0x22a3f5={'raw':![],'where':{'id':_0x20c980[_0xc8a8('0x27')]['id']}},_0x134ee3={};_0x134ee3[_0xc8a8('0x28')]=_[_0xc8a8('0x29')](db[_0xc8a8('0x1c')][_0xc8a8('0x1d')]);_0x134ee3[_0xc8a8('0x2a')]=_['keys'](_0x20c980[_0xc8a8('0x2a')]);_0x134ee3[_0xc8a8('0x2b')]=_['intersection'](_0x134ee3['model'],_0x134ee3[_0xc8a8('0x2a')]);_0x22a3f5['attributes']=_[_0xc8a8('0x2c')](_0x134ee3[_0xc8a8('0x28')],qs[_0xc8a8('0x2d')](_0x20c980['query'][_0xc8a8('0x2d')]));_0x22a3f5[_0xc8a8('0x2e')]=_0x22a3f5['attributes'][_0xc8a8('0x2f')]?_0x22a3f5['attributes']:_0x134ee3[_0xc8a8('0x28')];if(_0x20c980[_0xc8a8('0x2a')][_0xc8a8('0x30')]){_0x22a3f5[_0xc8a8('0x31')]=[{'all':!![]}];}_0x22a3f5=_['merge']({},_0x22a3f5,_0x20c980[_0xc8a8('0x32')]);return db[_0xc8a8('0x1c')][_0xc8a8('0x33')](_0x22a3f5)[_0xc8a8('0x18')](handleEntityNotFound(_0x26137d,null))[_0xc8a8('0x18')](respondWithResult(_0x26137d,null))[_0xc8a8('0x25')](handleError(_0x26137d,null));};exports['create']=function(_0x601523,_0x4f1f2f){return db[_0xc8a8('0x1c')][_0xc8a8('0x34')](_0x601523['body'],{})['then'](respondWithResult(_0x4f1f2f,0xc9))[_0xc8a8('0x25')](handleError(_0x4f1f2f,null));};exports[_0xc8a8('0x17')]=function(_0x3ee3e9,_0x451bf1){if(_0x3ee3e9[_0xc8a8('0x35')]['id']){delete _0x3ee3e9[_0xc8a8('0x35')]['id'];}return db[_0xc8a8('0x1c')][_0xc8a8('0x33')]({'where':{'id':_0x3ee3e9[_0xc8a8('0x27')]['id']}})[_0xc8a8('0x18')](handleEntityNotFound(_0x451bf1,null))[_0xc8a8('0x18')](saveUpdates(_0x3ee3e9[_0xc8a8('0x35')],null))[_0xc8a8('0x18')](respondWithResult(_0x451bf1,null))[_0xc8a8('0x25')](handleError(_0x451bf1,null));};exports[_0xc8a8('0x19')]=function(_0x4933f5,_0x2b7f75){return db[_0xc8a8('0x1c')][_0xc8a8('0x33')]({'where':{'id':_0x4933f5[_0xc8a8('0x27')]['id']}})[_0xc8a8('0x18')](handleEntityNotFound(_0x2b7f75,null))[_0xc8a8('0x18')](removeEntity(_0x2b7f75,null))[_0xc8a8('0x25')](handleError(_0x2b7f75,null));};exports[_0xc8a8('0x36')]=function(_0x44db45,_0x37db1f){return db['FaxInteraction'][_0xc8a8('0x36')]()[_0xc8a8('0x18')](respondWithResult(_0x37db1f,null))['catch'](handleError(_0x37db1f,null));};exports[_0xc8a8('0x37')]=function(_0x47183b,_0x253e88){return db[_0xc8a8('0x38')][_0xc8a8('0x33')]({'where':{'id':_0x47183b[_0xc8a8('0x27')]['id']}})[_0xc8a8('0x18')](handleEntityNotFound(_0x253e88,null))[_0xc8a8('0x18')](function(_0x4090ed){if(_0x4090ed){return _0x4090ed['addMessage'](_0x47183b['body'][_0xc8a8('0x39')],_[_0xc8a8('0x3a')](_0x47183b[_0xc8a8('0x35')],['ids','id'])||{});}})[_0xc8a8('0x18')](respondWithResult(_0x253e88,null))[_0xc8a8('0x25')](handleError(_0x253e88,null));};exports[_0xc8a8('0x3b')]=function(_0x1b0122,_0x34fede){var _0x37dbc6={'raw':![],'where':{}};var _0x2b69ea={};var _0x464054={'count':0x0,'rows':[]};return db[_0xc8a8('0x1c')][_0xc8a8('0x3c')]({'where':{'id':_0x1b0122[_0xc8a8('0x27')]['id']}})[_0xc8a8('0x18')](handleEntityNotFound(_0x34fede,null))[_0xc8a8('0x18')](function(_0x4d4bdc){if(_0x4d4bdc){_0x2b69ea[_0xc8a8('0x28')]=_['keys'](db['FaxMessage'][_0xc8a8('0x1d')]);_0x2b69ea[_0xc8a8('0x2a')]=_['keys'](_0x1b0122[_0xc8a8('0x2a')]);_0x2b69ea['filters']=_[_0xc8a8('0x2c')](_0x2b69ea[_0xc8a8('0x28')],_0x2b69ea[_0xc8a8('0x2a')]);_0x37dbc6[_0xc8a8('0x2e')]=_[_0xc8a8('0x2c')](_0x2b69ea[_0xc8a8('0x28')],qs[_0xc8a8('0x2d')](_0x1b0122[_0xc8a8('0x2a')][_0xc8a8('0x2d')]));_0x37dbc6[_0xc8a8('0x2e')]=_0x37dbc6[_0xc8a8('0x2e')][_0xc8a8('0x2f')]?_0x37dbc6[_0xc8a8('0x2e')]:_0x2b69ea[_0xc8a8('0x28')];if(!_0x1b0122[_0xc8a8('0x2a')][_0xc8a8('0x3d')](_0xc8a8('0x3e'))){_0x37dbc6['limit']=qs[_0xc8a8('0x13')](_0x1b0122['query'][_0xc8a8('0x13')]);_0x37dbc6['offset']=qs[_0xc8a8('0x12')](_0x1b0122[_0xc8a8('0x2a')][_0xc8a8('0x12')]);}_0x37dbc6[_0xc8a8('0x3f')]=qs[_0xc8a8('0x40')](_0x1b0122[_0xc8a8('0x2a')][_0xc8a8('0x40')]);_0x37dbc6[_0xc8a8('0x41')]=qs[_0xc8a8('0x2b')](_[_0xc8a8('0x42')](_0x1b0122[_0xc8a8('0x2a')],_0x2b69ea[_0xc8a8('0x2b')]));_0x37dbc6[_0xc8a8('0x41')]['FaxInteractionId']=_0x4d4bdc['id'];if(_0x1b0122['query'][_0xc8a8('0x43')]){_0x37dbc6[_0xc8a8('0x41')]=_[_0xc8a8('0x44')](_0x37dbc6[_0xc8a8('0x41')],{'$or':_['map'](_0x37dbc6[_0xc8a8('0x2e')],function(_0x5dc445){var _0x50f5da={};_0x50f5da[_0x5dc445]={'$like':'%'+_0x1b0122[_0xc8a8('0x2a')][_0xc8a8('0x43')]+'%'};return _0x50f5da;})});}if(_0x1b0122[_0xc8a8('0x2a')][_0xc8a8('0x45')]){var _0x236a83=_0x1b0122[_0xc8a8('0x2a')][_0xc8a8('0x45')]['split'](',');var _0x2f71c4={};_0x2f71c4[_0x236a83[0x0]]={'$gte':moment(_0x236a83[0x1])[_0xc8a8('0x46')](_0xc8a8('0x47'))};_0x37dbc6[_0xc8a8('0x41')]=_[_0xc8a8('0x44')](_0x37dbc6[_0xc8a8('0x41')],_0x2f71c4);}_0x37dbc6=_[_0xc8a8('0x44')]({},_0x37dbc6,_0x1b0122[_0xc8a8('0x32')]);return db[_0xc8a8('0x38')][_0xc8a8('0x15')]({'where':_0x37dbc6[_0xc8a8('0x41')]})[_0xc8a8('0x18')](function(_0xcc0aff){_0x464054['count']=_0xcc0aff;if(_0x1b0122[_0xc8a8('0x2a')][_0xc8a8('0x30')]){_0x37dbc6[_0xc8a8('0x31')]=[{'all':!![]}];}return db[_0xc8a8('0x38')]['findAll'](_0x37dbc6);})['then'](function(_0x717a88){_0x464054[_0xc8a8('0x48')]=_0x717a88;return _0x464054;});}})['then'](respondWithFilteredResult(_0x34fede,_0x37dbc6))['catch'](handleError(_0x34fede,null));};exports[_0xc8a8('0x49')]=function(_0x4b0e0a,_0x47bc38){return db['FaxInteraction'][_0xc8a8('0x33')]({'where':{'id':_0x4b0e0a['params']['id']}})[_0xc8a8('0x18')](handleEntityNotFound(_0x47bc38,null))[_0xc8a8('0x18')](function(_0x4fa04e){if(_0x4fa04e){return _0x4fa04e[_0xc8a8('0x4a')](_0x4b0e0a['body'][_0xc8a8('0x39')],_[_0xc8a8('0x3a')](_0x4b0e0a[_0xc8a8('0x35')],[_0xc8a8('0x39'),'id'])||{})[_0xc8a8('0x4b')](function(){return db[_0xc8a8('0x4c')][_0xc8a8('0x22')]({'attributes':['id',_0xc8a8('0x1a'),_0xc8a8('0x4d')],'where':{'id':_0x4b0e0a[_0xc8a8('0x35')][_0xc8a8('0x39')]}});})[_0xc8a8('0x18')](function(_0x4d4ff6){socket[_0xc8a8('0x4e')]('faxInteractionTags:save',{'id':Number(_0x4b0e0a['params']['id']),'tags':_0x4d4ff6||[]});return{'id':Number(_0x4b0e0a[_0xc8a8('0x27')]['id']),'tags':_0x4d4ff6||[]};});}})[_0xc8a8('0x18')](respondWithResult(_0x47bc38,null))[_0xc8a8('0x25')](handleError(_0x47bc38,null));};exports[_0xc8a8('0x4f')]=function(_0x241d1b,_0x4fdb56){return db[_0xc8a8('0x1c')][_0xc8a8('0x33')]({'where':{'id':_0x241d1b['params']['id']}})[_0xc8a8('0x18')](handleEntityNotFound(_0x4fdb56,null))['then'](function(_0x3100c7){if(_0x3100c7){return _0x3100c7[_0xc8a8('0x4f')](_0x241d1b[_0xc8a8('0x2a')]['ids']);}})[_0xc8a8('0x18')](respondWithStatusCode(_0x4fdb56,null))[_0xc8a8('0x25')](handleError(_0x4fdb56,null));};exports[_0xc8a8('0x50')]=function(_0x25b1c7,_0x9ed152){var _0x4980da=moment()[_0xc8a8('0x51')]()['toString']();var _0x1aa44b=path[_0xc8a8('0x52')](config[_0xc8a8('0x53')],_0xc8a8('0x54'),'files',_0xc8a8('0x55'));var _0x5f5192=path[_0xc8a8('0x52')](config['root'],_0xc8a8('0x54'),_0xc8a8('0x56'),'attachments');var _0x23ce99=path['join'](_0x1aa44b,_0x4980da);var _0x3eb0b8=util[_0xc8a8('0x46')](_0xc8a8('0x57'),_0x25b1c7[_0xc8a8('0x27')]['id'],_0x4980da);var _0x47dc58=path[_0xc8a8('0x52')](_0x1aa44b,_0x3eb0b8);var _0x18db40=[];_0x18db40[_0xc8a8('0x58')]({'model':db[_0xc8a8('0x59')],'as':'Attachment','raw':!![]});var _0x56ce2a=[{'model':db[_0xc8a8('0x38')],'as':_0xc8a8('0x5a'),'attributes':['id',_0xc8a8('0x35'),'createdAt'],'include':_0x18db40}];return db[_0xc8a8('0x1c')]['find']({'where':{'id':_0x25b1c7['params']['id']},'include':_0x56ce2a})[_0xc8a8('0x18')](handleEntityNotFound(_0x9ed152,null))[_0xc8a8('0x18')](function(_0x1fcb32){if(_0x1fcb32&&_0x1fcb32[_0xc8a8('0x5a')]){var _0x28ea82=_0x1fcb32['get']({'plain':!![]});fs[_0xc8a8('0x5b')](_0x23ce99);for(var _0x3f4041=0x0;_0x3f4041<_0x28ea82[_0xc8a8('0x5a')][_0xc8a8('0x2f')];_0x3f4041++){var _0x4d2b0c=_0x28ea82[_0xc8a8('0x5a')][_0x3f4041][_0xc8a8('0x59')];if(_0x4d2b0c){var _0x405501=path[_0xc8a8('0x52')](_0x5f5192,_0x4d2b0c['basename']);if(fs['existsSync'](_0x405501)){fs['createReadStream'](_0x405501)[_0xc8a8('0x5c')](fs[_0xc8a8('0x5d')](path['join'](_0x23ce99,_0x4d2b0c[_0xc8a8('0x5e')])));}}}return BPromise[_0xc8a8('0x5f')]()['then'](function(){return new BPromise(function(_0x359f86,_0x53606a){zipdir(_0x23ce99,{'saveTo':_0x47dc58},function(_0xdcb2cc,_0x324b8b){if(_0xdcb2cc)return _0x53606a(_0xdcb2cc);return _0x359f86(_0x324b8b);});})['then'](function(){return new BPromise(function(_0x7be7d2,_0x59da96){rimraf(_0x23ce99,function(_0x430871){if(_0x430871)_0x59da96(_0x430871);return _0x7be7d2();});});})[_0xc8a8('0x18')](function(){return _0x9ed152[_0xc8a8('0x50')](_0x47dc58,_0x3eb0b8,function(_0x5715ca){if(_0x5715ca){console[_0xc8a8('0x60')]('err',_0x5715ca);}else{fs[_0xc8a8('0x61')](_0x47dc58);}});});});}else{return _0x9ed152[_0xc8a8('0xe')](0xc8);}})['catch'](handleError(_0x9ed152,null));}; \ No newline at end of file +var _0x2e37=['fax','user','catch','show','params','model','keys','rawAttributes','query','filters','fields','attributes','length','includeAll','include','merge','find','create','body','describe','addMessage','omit','ids','findOne','FaxMessage','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','push','Attachment','get','mkdirSync','Messages','basename','existsSync','createReadStream','createWriteStream','err','rimraf','zip-dir','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','offset','undefined','limit','count','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','FaxInteraction','fieldName','type','key','getOptions','findAll'];(function(_0x3fd108,_0x5d911f){var _0x4f943f=function(_0x12abdf){while(--_0x12abdf){_0x3fd108['push'](_0x3fd108['shift']());}};_0x4f943f(++_0x5d911f);}(_0x2e37,0x1d5));var _0x72e3=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x2e37[_0x4e93a9];return _0x43013c;};'use strict';var rimraf=require(_0x72e3('0x0'));var zipdir=require(_0x72e3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x72e3('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x72e3('0x3'));var interaction=require(_0x72e3('0x4'));var qs=require(_0x72e3('0x5'));var logger=require(_0x72e3('0x6'))(_0x72e3('0x7'));var config=require(_0x72e3('0x8'));var db=require('../../mysqldb')['db'];config[_0x72e3('0x9')]=_['defaults'](config[_0x72e3('0x9')],{'host':_0x72e3('0xa'),'port':0x18eb});var socket=require(_0x72e3('0xb'))(new Redis(config[_0x72e3('0x9')]));require(_0x72e3('0xc'))[_0x72e3('0xd')](socket);function respondWithStatusCode(_0x4af97e,_0x3017e5){_0x3017e5=_0x3017e5||0xcc;return function(_0x1f4b4f){if(_0x1f4b4f){return _0x4af97e['sendStatus'](_0x3017e5);}return _0x4af97e[_0x72e3('0xe')](_0x3017e5)['end']();};}function respondWithResult(_0x20095b,_0x2b077f){_0x2b077f=_0x2b077f||0xc8;return function(_0x25b273){if(_0x25b273){return _0x20095b['status'](_0x2b077f)['json'](_0x25b273);}};}function respondWithFilteredResult(_0x27b642,_0x7d8b12){return function(_0xf379c4){if(_0xf379c4){var _0x5b3878=typeof _0x7d8b12[_0x72e3('0xf')]===_0x72e3('0x10')&&typeof _0x7d8b12[_0x72e3('0x11')]===_0x72e3('0x10');var _0x5cf8b1=_0xf379c4[_0x72e3('0x12')];var _0x4335ff=_0x5b3878?0x0:_0x7d8b12[_0x72e3('0xf')];var _0x10fc97=_0x5b3878?_0xf379c4['count']:_0x7d8b12['offset']+_0x7d8b12[_0x72e3('0x11')];var _0x37e37f;if(_0x10fc97>=_0x5cf8b1){_0x10fc97=_0x5cf8b1;_0x37e37f=0xc8;}else{_0x37e37f=0xce;}_0x27b642[_0x72e3('0xe')](_0x37e37f);return _0x27b642[_0x72e3('0x13')](_0x72e3('0x14'),_0x4335ff+'-'+_0x10fc97+'/'+_0x5cf8b1)['json'](_0xf379c4);}return null;};}function saveUpdates(_0x40f314){return function(_0x165279){if(_0x165279){return _0x165279[_0x72e3('0x15')](_0x40f314)['then'](function(_0x106c12){return _0x106c12;});}return null;};}function removeEntity(_0x458856){return function(_0x3fcc37){if(_0x3fcc37){return _0x3fcc37[_0x72e3('0x16')]()[_0x72e3('0x17')](function(){_0x458856[_0x72e3('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe40a){return function(_0x36c589){if(!_0x36c589){_0x1fe40a[_0x72e3('0x18')](0x194);}return _0x36c589;};}function handleError(_0x2ec8ee,_0x3b0457){_0x3b0457=_0x3b0457||0x1f4;return function(_0x192a58){logger['error'](_0x192a58[_0x72e3('0x19')]);if(_0x192a58[_0x72e3('0x1a')]){delete _0x192a58[_0x72e3('0x1a')];}_0x2ec8ee[_0x72e3('0xe')](_0x3b0457)[_0x72e3('0x1b')](_0x192a58);};}exports[_0x72e3('0x1c')]=function(_0x368563,_0x417c8e){var _0x17d2b8={};var _0x3b00f0=_[_0x72e3('0x1d')](db[_0x72e3('0x1e')]['rawAttributes'],function(_0x23eb05){return{'name':_0x23eb05[_0x72e3('0x1f')],'type':_0x23eb05[_0x72e3('0x20')][_0x72e3('0x21')]};});_0x17d2b8=qs[_0x72e3('0x22')](_0x3b00f0,_0x368563);return interaction[_0x72e3('0x23')](_0x72e3('0x24'),_0x368563['query'],_0x368563[_0x72e3('0x25')],_0x17d2b8,_0x3b00f0)['then'](respondWithFilteredResult(_0x417c8e,_0x17d2b8))[_0x72e3('0x26')](handleError(_0x417c8e,null));};exports[_0x72e3('0x27')]=function(_0x167bf8,_0x5b39b2){var _0x38ae6f={'raw':![],'where':{'id':_0x167bf8[_0x72e3('0x28')]['id']}},_0x802916={};_0x802916[_0x72e3('0x29')]=_[_0x72e3('0x2a')](db[_0x72e3('0x1e')][_0x72e3('0x2b')]);_0x802916[_0x72e3('0x2c')]=_[_0x72e3('0x2a')](_0x167bf8[_0x72e3('0x2c')]);_0x802916[_0x72e3('0x2d')]=_['intersection'](_0x802916[_0x72e3('0x29')],_0x802916[_0x72e3('0x2c')]);_0x38ae6f['attributes']=_['intersection'](_0x802916[_0x72e3('0x29')],qs[_0x72e3('0x2e')](_0x167bf8['query'][_0x72e3('0x2e')]));_0x38ae6f[_0x72e3('0x2f')]=_0x38ae6f[_0x72e3('0x2f')][_0x72e3('0x30')]?_0x38ae6f['attributes']:_0x802916[_0x72e3('0x29')];if(_0x167bf8[_0x72e3('0x2c')][_0x72e3('0x31')]){_0x38ae6f[_0x72e3('0x32')]=[{'all':!![]}];}_0x38ae6f=_[_0x72e3('0x33')]({},_0x38ae6f,_0x167bf8['options']);return db['FaxInteraction'][_0x72e3('0x34')](_0x38ae6f)[_0x72e3('0x17')](handleEntityNotFound(_0x5b39b2,null))['then'](respondWithResult(_0x5b39b2,null))[_0x72e3('0x26')](handleError(_0x5b39b2,null));};exports[_0x72e3('0x35')]=function(_0x1544c1,_0xc26238){return db[_0x72e3('0x1e')][_0x72e3('0x35')](_0x1544c1['body'],{})[_0x72e3('0x17')](respondWithResult(_0xc26238,0xc9))[_0x72e3('0x26')](handleError(_0xc26238,null));};exports['update']=function(_0x2d4824,_0x2b219b){if(_0x2d4824['body']['id']){delete _0x2d4824[_0x72e3('0x36')]['id'];}return db[_0x72e3('0x1e')]['find']({'where':{'id':_0x2d4824[_0x72e3('0x28')]['id']}})[_0x72e3('0x17')](handleEntityNotFound(_0x2b219b,null))['then'](saveUpdates(_0x2d4824[_0x72e3('0x36')],null))[_0x72e3('0x17')](respondWithResult(_0x2b219b,null))[_0x72e3('0x26')](handleError(_0x2b219b,null));};exports[_0x72e3('0x16')]=function(_0x25812c,_0x4a52e3){return db[_0x72e3('0x1e')][_0x72e3('0x34')]({'where':{'id':_0x25812c[_0x72e3('0x28')]['id']}})[_0x72e3('0x17')](handleEntityNotFound(_0x4a52e3,null))[_0x72e3('0x17')](removeEntity(_0x4a52e3,null))[_0x72e3('0x26')](handleError(_0x4a52e3,null));};exports[_0x72e3('0x37')]=function(_0xfc2981,_0x167b02){return db[_0x72e3('0x1e')][_0x72e3('0x37')]()[_0x72e3('0x17')](respondWithResult(_0x167b02,null))[_0x72e3('0x26')](handleError(_0x167b02,null));};exports[_0x72e3('0x38')]=function(_0x225e97,_0xb4869){return db['FaxMessage']['find']({'where':{'id':_0x225e97[_0x72e3('0x28')]['id']}})[_0x72e3('0x17')](handleEntityNotFound(_0xb4869,null))['then'](function(_0x26e13e){if(_0x26e13e){return _0x26e13e['addMessage'](_0x225e97[_0x72e3('0x36')]['ids'],_[_0x72e3('0x39')](_0x225e97[_0x72e3('0x36')],[_0x72e3('0x3a'),'id'])||{});}})[_0x72e3('0x17')](respondWithResult(_0xb4869,null))[_0x72e3('0x26')](handleError(_0xb4869,null));};exports['getMessages']=function(_0x18aa00,_0x485c0b){var _0x5a4855={'raw':![],'where':{}};var _0x1e3bf2={};var _0x2a10f7={'count':0x0,'rows':[]};return db[_0x72e3('0x1e')][_0x72e3('0x3b')]({'where':{'id':_0x18aa00[_0x72e3('0x28')]['id']}})[_0x72e3('0x17')](handleEntityNotFound(_0x485c0b,null))['then'](function(_0x135606){if(_0x135606){_0x1e3bf2['model']=_[_0x72e3('0x2a')](db[_0x72e3('0x3c')][_0x72e3('0x2b')]);_0x1e3bf2[_0x72e3('0x2c')]=_[_0x72e3('0x2a')](_0x18aa00[_0x72e3('0x2c')]);_0x1e3bf2[_0x72e3('0x2d')]=_[_0x72e3('0x3d')](_0x1e3bf2[_0x72e3('0x29')],_0x1e3bf2[_0x72e3('0x2c')]);_0x5a4855[_0x72e3('0x2f')]=_[_0x72e3('0x3d')](_0x1e3bf2['model'],qs['fields'](_0x18aa00[_0x72e3('0x2c')][_0x72e3('0x2e')]));_0x5a4855[_0x72e3('0x2f')]=_0x5a4855[_0x72e3('0x2f')]['length']?_0x5a4855['attributes']:_0x1e3bf2[_0x72e3('0x29')];if(!_0x18aa00[_0x72e3('0x2c')][_0x72e3('0x3e')](_0x72e3('0x3f'))){_0x5a4855[_0x72e3('0x11')]=qs[_0x72e3('0x11')](_0x18aa00[_0x72e3('0x2c')]['limit']);_0x5a4855[_0x72e3('0xf')]=qs[_0x72e3('0xf')](_0x18aa00['query']['offset']);}_0x5a4855[_0x72e3('0x40')]=qs['sort'](_0x18aa00['query'][_0x72e3('0x41')]);_0x5a4855[_0x72e3('0x42')]=qs[_0x72e3('0x2d')](_[_0x72e3('0x43')](_0x18aa00[_0x72e3('0x2c')],_0x1e3bf2['filters']));_0x5a4855[_0x72e3('0x42')]['FaxInteractionId']=_0x135606['id'];if(_0x18aa00[_0x72e3('0x2c')][_0x72e3('0x44')]){_0x5a4855[_0x72e3('0x42')]=_[_0x72e3('0x33')](_0x5a4855[_0x72e3('0x42')],{'$or':_[_0x72e3('0x1d')](_0x5a4855[_0x72e3('0x2f')],function(_0x4b911b){var _0x3bb32f={};_0x3bb32f[_0x4b911b]={'$like':'%'+_0x18aa00['query']['filter']+'%'};return _0x3bb32f;})});}if(_0x18aa00[_0x72e3('0x2c')][_0x72e3('0x45')]){var _0x270bf6=_0x18aa00[_0x72e3('0x2c')][_0x72e3('0x45')][_0x72e3('0x46')](',');var _0x200951={};_0x200951[_0x270bf6[0x0]]={'$gte':moment(_0x270bf6[0x1])['format'](_0x72e3('0x47'))};_0x5a4855[_0x72e3('0x42')]=_[_0x72e3('0x33')](_0x5a4855['where'],_0x200951);}_0x5a4855=_[_0x72e3('0x33')]({},_0x5a4855,_0x18aa00[_0x72e3('0x48')]);return db[_0x72e3('0x3c')][_0x72e3('0x12')]({'where':_0x5a4855[_0x72e3('0x42')]})['then'](function(_0x44e8fc){_0x2a10f7[_0x72e3('0x12')]=_0x44e8fc;if(_0x18aa00[_0x72e3('0x2c')][_0x72e3('0x31')]){_0x5a4855[_0x72e3('0x32')]=[{'all':!![]}];}return db[_0x72e3('0x3c')][_0x72e3('0x23')](_0x5a4855);})[_0x72e3('0x17')](function(_0x455f3c){_0x2a10f7[_0x72e3('0x49')]=_0x455f3c;return _0x2a10f7;});}})[_0x72e3('0x17')](respondWithFilteredResult(_0x485c0b,_0x5a4855))[_0x72e3('0x26')](handleError(_0x485c0b,null));};exports[_0x72e3('0x4a')]=function(_0x4686df,_0x10e876){return db[_0x72e3('0x1e')][_0x72e3('0x34')]({'where':{'id':_0x4686df['params']['id']}})['then'](handleEntityNotFound(_0x10e876,null))[_0x72e3('0x17')](function(_0x53c7ec){if(_0x53c7ec){return _0x53c7ec[_0x72e3('0x4b')](_0x4686df[_0x72e3('0x36')][_0x72e3('0x3a')],_['omit'](_0x4686df[_0x72e3('0x36')],[_0x72e3('0x3a'),'id'])||{})[_0x72e3('0x4c')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x72e3('0x4d')],'where':{'id':_0x4686df[_0x72e3('0x36')][_0x72e3('0x3a')]}});})[_0x72e3('0x17')](function(_0x1cb9ae){socket['emit'](_0x72e3('0x4e'),{'id':Number(_0x4686df[_0x72e3('0x28')]['id']),'tags':_0x1cb9ae||[]});return{'id':Number(_0x4686df['params']['id']),'tags':_0x1cb9ae||[]};});}})[_0x72e3('0x17')](respondWithResult(_0x10e876,null))[_0x72e3('0x26')](handleError(_0x10e876,null));};exports[_0x72e3('0x4f')]=function(_0x5aea2f,_0x195d82){return db[_0x72e3('0x1e')][_0x72e3('0x34')]({'where':{'id':_0x5aea2f[_0x72e3('0x28')]['id']}})[_0x72e3('0x17')](handleEntityNotFound(_0x195d82,null))[_0x72e3('0x17')](function(_0x1ba9b7){if(_0x1ba9b7){return _0x1ba9b7[_0x72e3('0x4f')](_0x5aea2f[_0x72e3('0x2c')]['ids']);}})[_0x72e3('0x17')](respondWithStatusCode(_0x195d82,null))['catch'](handleError(_0x195d82,null));};exports[_0x72e3('0x50')]=function(_0x70308f,_0x64d92f){var _0x4bb60d=moment()[_0x72e3('0x51')]()[_0x72e3('0x52')]();var _0x5a5a31=path[_0x72e3('0x53')](config[_0x72e3('0x54')],'server',_0x72e3('0x55'),_0x72e3('0x56'));var _0x3e5b76=path['join'](config[_0x72e3('0x54')],_0x72e3('0x57'),_0x72e3('0x55'),_0x72e3('0x58'));var _0x22a77b=path[_0x72e3('0x53')](_0x5a5a31,_0x4bb60d);var _0x12da45=util[_0x72e3('0x59')](_0x72e3('0x5a'),_0x70308f[_0x72e3('0x28')]['id'],_0x4bb60d);var _0x3925f7=path['join'](_0x5a5a31,_0x12da45);var _0x8cd254=[];_0x8cd254[_0x72e3('0x5b')]({'model':db[_0x72e3('0x5c')],'as':'Attachment','raw':!![]});var _0x2caeee=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x72e3('0x36'),'createdAt'],'include':_0x8cd254}];return db[_0x72e3('0x1e')][_0x72e3('0x34')]({'where':{'id':_0x70308f[_0x72e3('0x28')]['id']},'include':_0x2caeee})[_0x72e3('0x17')](handleEntityNotFound(_0x64d92f,null))[_0x72e3('0x17')](function(_0x2b7598){if(_0x2b7598&&_0x2b7598['Messages']){var _0x9f7524=_0x2b7598[_0x72e3('0x5d')]({'plain':!![]});fs[_0x72e3('0x5e')](_0x22a77b);for(var _0x1893b4=0x0;_0x1893b4<_0x9f7524[_0x72e3('0x5f')]['length'];_0x1893b4++){var _0x2edd02=_0x9f7524[_0x72e3('0x5f')][_0x1893b4][_0x72e3('0x5c')];if(_0x2edd02){var _0x4d54bd=path[_0x72e3('0x53')](_0x3e5b76,_0x2edd02[_0x72e3('0x60')]);if(fs[_0x72e3('0x61')](_0x4d54bd)){fs[_0x72e3('0x62')](_0x4d54bd)['pipe'](fs[_0x72e3('0x63')](path[_0x72e3('0x53')](_0x22a77b,_0x2edd02[_0x72e3('0x60')])));}}}return BPromise['resolve']()[_0x72e3('0x17')](function(){return new BPromise(function(_0x4cb02c,_0x478adf){zipdir(_0x22a77b,{'saveTo':_0x3925f7},function(_0x3a8675,_0x14b8fe){if(_0x3a8675)return _0x478adf(_0x3a8675);return _0x4cb02c(_0x14b8fe);});})[_0x72e3('0x17')](function(){return new BPromise(function(_0x4f565d,_0x1a3faa){rimraf(_0x22a77b,function(_0x4526c5){if(_0x4526c5)_0x1a3faa(_0x4526c5);return _0x4f565d();});});})[_0x72e3('0x17')](function(){return _0x64d92f[_0x72e3('0x50')](_0x3925f7,_0x12da45,function(_0x2d3daf){if(_0x2d3daf){console['log'](_0x72e3('0x64'),_0x2d3daf);}else{fs['unlinkSync'](_0x3925f7);}});});});}else{return _0x64d92f[_0x72e3('0x18')](0xc8);}})[_0x72e3('0x26')](handleError(_0x64d92f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b95c1ab..9c7df09 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 _0x3168=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','findAll','setDataValue'];(function(_0x2261bc,_0x187107){var _0x331159=function(_0x11d020){while(--_0x11d020){_0x2261bc['push'](_0x2261bc['shift']());}};_0x331159(++_0x187107);}(_0x3168,0xcd));var _0x8316=function(_0x2d10f0,_0xbcac53){_0x2d10f0=_0x2d10f0-0x0;var _0x58952=_0x3168[_0x2d10f0];return _0x58952;};'use strict';var EventEmitter=require(_0x8316('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x8316('0x1')];var FaxMessage=require(_0x8316('0x2'))['db'][_0x8316('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8316('0x4')](0x0);var events={'afterCreate':_0x8316('0x5'),'afterUpdate':_0x8316('0x6'),'afterDestroy':_0x8316('0x7')};function emitEvent(_0x1ac798){return function(_0x458dd8,_0x105c83,_0x5b2c0d){_0x458dd8['getUsers']({'attributes':['id'],'raw':!![]})[_0x8316('0x8')](function(_0x71f1ca){_0x458dd8['setDataValue']('Users',_0x71f1ca['map'](function(_0x5deb44){return{'id':_0x5deb44['id']};}));return FaxMessage[_0x8316('0x9')]({'where':{'FaxInteractionId':_0x458dd8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x530600){_0x458dd8[_0x8316('0xa')](_0x8316('0xb'),_0x530600[_0x8316('0xc')]);FaxInteractionEvents[_0x8316('0xd')](_0x1ac798+':'+_0x458dd8['id'],_0x458dd8);FaxInteractionEvents[_0x8316('0xd')](_0x1ac798,_0x458dd8);_0x5b2c0d(null);})[_0x8316('0xe')](_0x5b2c0d(null));};}for(var e in events){if(events[_0x8316('0xf')](e)){var event=events[e];FaxInteraction[_0x8316('0x10')](e,emitEvent(event));}}module[_0x8316('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x07d4=['save','update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3dfeb9,_0x553ae6){var _0x5c79ca=function(_0x3e41a9){while(--_0x3e41a9){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x5c79ca(++_0x553ae6);}(_0x07d4,0x174));var _0x407d=function(_0x7de33e,_0x46a873){_0x7de33e=_0x7de33e-0x0;var _0x9b0f8=_0x07d4[_0x7de33e];return _0x9b0f8;};'use strict';var EventEmitter=require(_0x407d('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0x407d('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x407d('0x2')](0x0);var events={'afterCreate':_0x407d('0x3'),'afterUpdate':_0x407d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8589a){return function(_0x42d553,_0x37beda,_0x5d1d9f){_0x42d553['getUsers']({'attributes':['id'],'raw':!![]})[_0x407d('0x5')](function(_0x203c16){_0x42d553[_0x407d('0x6')](_0x407d('0x7'),_0x203c16[_0x407d('0x8')](function(_0xe0ddca){return{'id':_0xe0ddca['id']};}));return FaxMessage[_0x407d('0x9')]({'where':{'FaxInteractionId':_0x42d553['id'],'direction':'in','read':![]},'raw':!![]});})[_0x407d('0x5')](function(_0x618c8a){_0x42d553['setDataValue'](_0x407d('0xa'),_0x618c8a[_0x407d('0xb')]);FaxInteractionEvents[_0x407d('0xc')](_0x8589a+':'+_0x42d553['id'],_0x42d553);FaxInteractionEvents[_0x407d('0xc')](_0x8589a,_0x42d553);_0x5d1d9f(null);})['catch'](_0x5d1d9f(null));};}for(var e in events){if(events[_0x407d('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x407d('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 911fbc7..7ab1bda 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 _0x6946=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed'];(function(_0x5e24d7,_0x11218f){var _0x10063d=function(_0x39fc21){while(--_0x39fc21){_0x5e24d7['push'](_0x5e24d7['shift']());}};_0x10063d(++_0x11218f);}(_0x6946,0x1b3));var _0x6694=function(_0x1389da,_0x289f72){_0x1389da=_0x1389da-0x0;var _0x567186=_0x6946[_0x1389da];return _0x567186;};'use strict';var _=require(_0x6694('0x0'));var util=require(_0x6694('0x1'));var logger=require(_0x6694('0x2'))(_0x6694('0x3'));var moment=require(_0x6694('0x4'));var BPromise=require(_0x6694('0x5'));var rp=require(_0x6694('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6694('0x7'));var attributes=require(_0x6694('0x8'));module[_0x6694('0x9')]=function(_0x2b7543,_0x147626){return _0x2b7543[_0x6694('0xa')](_0x6694('0xb'),attributes,{'tableName':_0x6694('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1add39,_0x4a56ee,_0x534d59){if(_0x1add39[_0x6694('0xd')](_0x6694('0xe'))){_0x1add39[_0x6694('0xf')]=moment()[_0x6694('0x10')](_0x6694('0x11'));}_0x534d59(null,_0x1add39);}}});}; \ No newline at end of file +var _0x8796=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird'];(function(_0x4d3b41,_0x4281e1){var _0x2dc795=function(_0x106729){while(--_0x106729){_0x4d3b41['push'](_0x4d3b41['shift']());}};_0x2dc795(++_0x4281e1);}(_0x8796,0x1a0));var _0x6879=function(_0x791fde,_0x3e11a0){_0x791fde=_0x791fde-0x0;var _0x31692e=_0x8796[_0x791fde];return _0x31692e;};'use strict';var _=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var logger=require('../../config/logger')(_0x6879('0x2'));var moment=require('moment');var BPromise=require(_0x6879('0x3'));var rp=require(_0x6879('0x4'));var fs=require('fs');var path=require(_0x6879('0x5'));var rimraf=require(_0x6879('0x6'));var config=require(_0x6879('0x7'));var attributes=require(_0x6879('0x8'));module[_0x6879('0x9')]=function(_0x52fcb3,_0x332e81){return _0x52fcb3['define'](_0x6879('0xa'),attributes,{'tableName':_0x6879('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a4149,_0x4edd09,_0x302dd7){if(_0x5a4149['changed'](_0x6879('0xc'))){_0x5a4149[_0x6879('0xd')]=moment()['format'](_0x6879('0xe'));}_0x302dd7(null,_0x5a4149);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2f526a9..731f952 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 _0x58e1=['moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateFaxInteraction','body','options','raw','attributes','limit','debug','AddTagsToFaxInteraction','omit','spread','AddTags','catch','lodash','util'];(function(_0x3fe39e,_0x479f27){var _0x4e34f3=function(_0x55f2cf){while(--_0x55f2cf){_0x3fe39e['push'](_0x3fe39e['shift']());}};_0x4e34f3(++_0x479f27);}(_0x58e1,0x11e));var _0x158e=function(_0x4e413f,_0x266ab4){_0x4e413f=_0x4e413f-0x0;var _0x2eca8a=_0x58e1[_0x4e413f];return _0x2eca8a;};'use strict';var _=require(_0x158e('0x0'));var util=require(_0x158e('0x1'));var moment=require(_0x158e('0x2'));var BPromise=require('bluebird');var rs=require(_0x158e('0x3'));var fs=require('fs');var Redis=require(_0x158e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x158e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x158e('0x6'));var jayson=require(_0x158e('0x7'));var client=jayson[_0x158e('0x8')][_0x158e('0x9')]({'port':0x232a});config[_0x158e('0xa')]=_[_0x158e('0xb')](config[_0x158e('0xa')],{'host':_0x158e('0xc'),'port':0x18eb});var socket=require(_0x158e('0xd'))(new Redis(config[_0x158e('0xa')]));require(_0x158e('0xe'))['register'](socket);function respondWithRpcPromise(_0x2b1b1e,_0x2e5950,_0x2a8d43){return new BPromise(function(_0x51a7fb,_0x542039){return client[_0x158e('0xf')](_0x2b1b1e,_0x2a8d43)[_0x158e('0x10')](function(_0x51903d){logger[_0x158e('0x11')](_0x158e('0x12'),_0x2e5950,_0x158e('0x13'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2e5950,_0x158e('0x13'),JSON[_0x158e('0x14')](_0x51903d));if(_0x51903d['error']){if(_0x51903d[_0x158e('0x15')]['code']===0x1f4){logger[_0x158e('0x15')](_0x158e('0x12'),_0x2e5950,_0x51903d[_0x158e('0x15')][_0x158e('0x16')]);return _0x542039(_0x51903d[_0x158e('0x15')]['message']);}logger[_0x158e('0x15')](_0x158e('0x12'),_0x2e5950,_0x51903d[_0x158e('0x15')][_0x158e('0x16')]);return _0x51a7fb(_0x51903d['error'][_0x158e('0x16')]);}else{logger['info'](_0x158e('0x12'),_0x2e5950,_0x158e('0x13'));_0x51a7fb(_0x51903d[_0x158e('0x17')][_0x158e('0x16')]);}})['catch'](function(_0x412923){logger[_0x158e('0x15')](_0x158e('0x12'),_0x2e5950,_0x412923);_0x542039(_0x412923);});});}exports[_0x158e('0x18')]=function(_0x360f1a){var _0x20ae1f=this;return new Promise(function(_0x3bb61e,_0x363757){return db['FaxInteraction']['update'](_0x360f1a[_0x158e('0x19')],{'raw':_0x360f1a[_0x158e('0x1a')]?_0x360f1a[_0x158e('0x1a')][_0x158e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x360f1a['options']?_0x360f1a[_0x158e('0x1a')]['where']||null:null,'attributes':_0x360f1a[_0x158e('0x1a')]?_0x360f1a[_0x158e('0x1a')][_0x158e('0x1c')]||null:null,'limit':_0x360f1a[_0x158e('0x1a')]?_0x360f1a[_0x158e('0x1a')][_0x158e('0x1d')]||null:null})['then'](function(_0x3b8a24){logger[_0x158e('0x11')](_0x158e('0x18'),_0x360f1a);logger[_0x158e('0x1e')](_0x158e('0x18'),_0x360f1a,JSON['stringify'](_0x3b8a24));_0x3bb61e(_0x3b8a24);})['catch'](function(_0x2b5bdd){logger[_0x158e('0x15')](_0x158e('0x18'),_0x2b5bdd['message'],_0x360f1a);_0x363757(_0x20ae1f[_0x158e('0x15')](0x1f4,_0x2b5bdd[_0x158e('0x16')]));});});};exports[_0x158e('0x1f')]=function(_0x571e34){return new Promise(function(_0x4784d1,_0x2a4b83){return db['FaxInteraction']['find']({'where':_0x571e34[_0x158e('0x1a')]?_0x571e34[_0x158e('0x1a')]['where']||null:null})[_0x158e('0x10')](function(_0x225632){if(_0x225632){return _0x225632['addTags'](_0x571e34[_0x158e('0x19')]['ids'],_[_0x158e('0x20')](_0x571e34['body'],['ids','id'])||{});}})[_0x158e('0x21')](function(_0x3908ba){logger['info'](_0x158e('0x22'),_0x571e34);logger[_0x158e('0x1e')](_0x158e('0x22'),_0x571e34,JSON[_0x158e('0x14')](_0x3908ba));_0x4784d1(_0x3908ba);})[_0x158e('0x23')](function(_0x2ff2ee){logger[_0x158e('0x15')](_0x158e('0x22'),_0x2ff2ee[_0x158e('0x16')],_0x571e34);_0x2a4b83(_this[_0x158e('0x15')](0x1f4,_0x2ff2ee[_0x158e('0x16')]));});});}; \ No newline at end of file +var _0xc0b2=['stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','catch','FaxInteraction','body','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x3f0f0,_0x552059){var _0x2fec01=function(_0xbe2527){while(--_0xbe2527){_0x3f0f0['push'](_0x3f0f0['shift']());}};_0x2fec01(++_0x552059);}(_0xc0b2,0x8f));var _0x2c0b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc0b2[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x2c0b('0x0'));var util=require(_0x2c0b('0x1'));var moment=require(_0x2c0b('0x2'));var BPromise=require(_0x2c0b('0x3'));var rs=require(_0x2c0b('0x4'));var fs=require('fs');var Redis=require(_0x2c0b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c0b('0x6'));var logger=require(_0x2c0b('0x7'))('rpc');var config=require(_0x2c0b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2c0b('0x9')]['http']({'port':0x232a});config[_0x2c0b('0xa')]=_[_0x2c0b('0xb')](config[_0x2c0b('0xa')],{'host':_0x2c0b('0xc'),'port':0x18eb});var socket=require(_0x2c0b('0xd'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x2c0b('0xe')](socket);function respondWithRpcPromise(_0x5e9d82,_0xe1cf,_0xd4c31a){return new BPromise(function(_0x242dc1,_0x5333d5){return client[_0x2c0b('0xf')](_0x5e9d82,_0xd4c31a)[_0x2c0b('0x10')](function(_0x1171cc){logger[_0x2c0b('0x11')]('FaxInteraction,\x20%s,\x20%s',_0xe1cf,_0x2c0b('0x12'));logger[_0x2c0b('0x13')](_0x2c0b('0x14'),_0xe1cf,_0x2c0b('0x12'),JSON[_0x2c0b('0x15')](_0x1171cc));if(_0x1171cc[_0x2c0b('0x16')]){if(_0x1171cc[_0x2c0b('0x16')][_0x2c0b('0x17')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0xe1cf,_0x1171cc['error']['message']);return _0x5333d5(_0x1171cc[_0x2c0b('0x16')][_0x2c0b('0x18')]);}logger['error'](_0x2c0b('0x19'),_0xe1cf,_0x1171cc[_0x2c0b('0x16')]['message']);return _0x242dc1(_0x1171cc[_0x2c0b('0x16')][_0x2c0b('0x18')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0xe1cf,_0x2c0b('0x12'));_0x242dc1(_0x1171cc['result'][_0x2c0b('0x18')]);}})[_0x2c0b('0x1a')](function(_0x3978de){logger[_0x2c0b('0x16')]('FaxInteraction,\x20%s,\x20%s',_0xe1cf,_0x3978de);_0x5333d5(_0x3978de);});});}exports['UpdateFaxInteraction']=function(_0x2d9531){var _0x31569a=this;return new Promise(function(_0x34c433,_0x20b4b6){return db[_0x2c0b('0x1b')]['update'](_0x2d9531[_0x2c0b('0x1c')],{'raw':_0x2d9531[_0x2c0b('0x1d')]?_0x2d9531[_0x2c0b('0x1d')][_0x2c0b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d9531[_0x2c0b('0x1d')]?_0x2d9531[_0x2c0b('0x1d')][_0x2c0b('0x1f')]||null:null,'attributes':_0x2d9531[_0x2c0b('0x1d')]?_0x2d9531['options'][_0x2c0b('0x20')]||null:null,'limit':_0x2d9531[_0x2c0b('0x1d')]?_0x2d9531[_0x2c0b('0x1d')][_0x2c0b('0x21')]||null:null})['then'](function(_0x25bc20){logger['info'](_0x2c0b('0x22'),_0x2d9531);logger[_0x2c0b('0x13')](_0x2c0b('0x22'),_0x2d9531,JSON[_0x2c0b('0x15')](_0x25bc20));_0x34c433(_0x25bc20);})[_0x2c0b('0x1a')](function(_0x5efe0e){logger['error'](_0x2c0b('0x22'),_0x5efe0e[_0x2c0b('0x18')],_0x2d9531);_0x20b4b6(_0x31569a['error'](0x1f4,_0x5efe0e[_0x2c0b('0x18')]));});});};exports[_0x2c0b('0x23')]=function(_0x6c08ed){return new Promise(function(_0x4bafd2,_0x503a82){return db[_0x2c0b('0x1b')]['find']({'where':_0x6c08ed[_0x2c0b('0x1d')]?_0x6c08ed['options']['where']||null:null})[_0x2c0b('0x10')](function(_0x2f6ef2){if(_0x2f6ef2){return _0x2f6ef2[_0x2c0b('0x24')](_0x6c08ed['body'][_0x2c0b('0x25')],_[_0x2c0b('0x26')](_0x6c08ed[_0x2c0b('0x1c')],[_0x2c0b('0x25'),'id'])||{});}})[_0x2c0b('0x27')](function(_0x454c5d){logger[_0x2c0b('0x11')]('AddTags',_0x6c08ed);logger[_0x2c0b('0x13')](_0x2c0b('0x28'),_0x6c08ed,JSON[_0x2c0b('0x15')](_0x454c5d));_0x4bafd2(_0x454c5d);})[_0x2c0b('0x1a')](function(_0x140708){logger['error'](_0x2c0b('0x28'),_0x140708[_0x2c0b('0x18')],_0x6c08ed);_0x503a82(_this[_0x2c0b('0x16')](0x1f4,_0x140708[_0x2c0b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0cb729f..1f384ea 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 _0x92fe=['removeListener','register','faxInteraction:','./faxInteraction.events','save','remove','update','emit'];(function(_0x1691c3,_0x2d14d){var _0x5c123d=function(_0x1a1415){while(--_0x1a1415){_0x1691c3['push'](_0x1691c3['shift']());}};_0x5c123d(++_0x2d14d);}(_0x92fe,0x1f3));var _0xe92f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92fe[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0xe92f('0x0'));var events=[_0xe92f('0x1'),_0xe92f('0x2'),_0xe92f('0x3')];function createListener(_0x19559e,_0x439d44){return function(_0x54b005){_0x439d44[_0xe92f('0x4')](_0x19559e,_0x54b005);};}function removeListener(_0x68afb,_0x1680f9){return function(){FaxInteractionEvents[_0xe92f('0x5')](_0x68afb,_0x1680f9);};}exports[_0xe92f('0x6')]=function(_0x4f48f7){for(var _0x8a4ff9=0x0,_0x969a08=events['length'];_0x8a4ff9<_0x969a08;_0x8a4ff9++){var _0x5f06ed=events[_0x8a4ff9];var _0x50bd18=createListener(_0xe92f('0x7')+_0x5f06ed,_0x4f48f7);FaxInteractionEvents['on'](_0x5f06ed,_0x50bd18);}}; \ No newline at end of file +var _0x3a57=['remove','update','removeListener','register','length','./faxInteraction.events','save'];(function(_0x24b649,_0x20a649){var _0x3b0e0c=function(_0x39be31){while(--_0x39be31){_0x24b649['push'](_0x24b649['shift']());}};_0x3b0e0c(++_0x20a649);}(_0x3a57,0xc2));var _0x73a5=function(_0x2728f7,_0x28e105){_0x2728f7=_0x2728f7-0x0;var _0x57b1be=_0x3a57[_0x2728f7];return _0x57b1be;};'use strict';var FaxInteractionEvents=require(_0x73a5('0x0'));var events=[_0x73a5('0x1'),_0x73a5('0x2'),_0x73a5('0x3')];function createListener(_0x2b45cb,_0x10c6be){return function(_0x497d5b){_0x10c6be['emit'](_0x2b45cb,_0x497d5b);};}function removeListener(_0x4fa8d4,_0x415fbc){return function(){FaxInteractionEvents[_0x73a5('0x4')](_0x4fa8d4,_0x415fbc);};}exports[_0x73a5('0x5')]=function(_0x21300c){for(var _0x4b7286=0x0,_0x46a1ed=events[_0x73a5('0x6')];_0x4b7286<_0x46a1ed;_0x4b7286++){var _0x1833ac=events[_0x4b7286];var _0x32363a=createListener('faxInteraction:'+_0x1833ac,_0x21300c);FaxInteractionEvents['on'](_0x1833ac,_0x32363a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index eda4934..fa1499d 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 _0x0806=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','addTags','fax','faxinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0806,0x1ef));var _0x6080=function(_0x3cda6a,_0x2673c0){_0x3cda6a=_0x3cda6a-0x0;var _0x4eaec8=_0x0806[_0x3cda6a];return _0x4eaec8;};'use strict';var multer=require(_0x6080('0x0'));var util=require(_0x6080('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6080('0x2'));var router=express[_0x6080('0x3')]();var fs_extra=require(_0x6080('0x4'));var auth=require(_0x6080('0x5'));var interaction=require(_0x6080('0x6'));var config=require('../../config/environment');var controller=require(_0x6080('0x7'));router[_0x6080('0x8')]('/',auth[_0x6080('0x9')](),controller['index']);router[_0x6080('0x8')](_0x6080('0xa'),auth[_0x6080('0x9')](),controller[_0x6080('0xb')]);router[_0x6080('0x8')](_0x6080('0xc'),auth[_0x6080('0x9')](),controller[_0x6080('0xd')]);router[_0x6080('0x8')](_0x6080('0xe'),auth[_0x6080('0x9')](),controller[_0x6080('0xf')]);router['get'](_0x6080('0x10'),auth[_0x6080('0x9')](),controller[_0x6080('0x11')]);router[_0x6080('0x12')]('/',auth[_0x6080('0x9')](),controller[_0x6080('0x13')]);router[_0x6080('0x12')](_0x6080('0xe'),auth[_0x6080('0x9')](),controller[_0x6080('0x14')]);router[_0x6080('0x12')]('/:id/tags',auth[_0x6080('0x9')](),interaction[_0x6080('0x15')]('fax','faxinteraction:addtags'),controller[_0x6080('0x16')]);router['put']('/:id',auth[_0x6080('0x9')](),interaction[_0x6080('0x15')](_0x6080('0x17'),_0x6080('0x18')),controller[_0x6080('0x19')]);router[_0x6080('0x1a')](_0x6080('0xc'),auth['isAuthenticated'](),interaction[_0x6080('0x15')](_0x6080('0x17'),'faxinteraction:destroy'),controller[_0x6080('0x1b')]);router[_0x6080('0x1a')](_0x6080('0x1c'),auth[_0x6080('0x9')](),controller[_0x6080('0x1d')]);module[_0x6080('0x1e')]=router; \ No newline at end of file +var _0x2531=['isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','faxinteraction:addtags','addTags','tracked','fax','faxinteraction:update','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','describe','/:id'];(function(_0x3e34ac,_0x2a2e4c){var _0x374105=function(_0x4fb418){while(--_0x4fb418){_0x3e34ac['push'](_0x3e34ac['shift']());}};_0x374105(++_0x2a2e4c);}(_0x2531,0x79));var _0x1253=function(_0x5acd2c,_0x57c9db){_0x5acd2c=_0x5acd2c-0x0;var _0x2d8a74=_0x2531[_0x5acd2c];return _0x2d8a74;};'use strict';var multer=require(_0x1253('0x0'));var util=require('util');var path=require(_0x1253('0x1'));var timeout=require(_0x1253('0x2'));var express=require(_0x1253('0x3'));var router=express[_0x1253('0x4')]();var fs_extra=require(_0x1253('0x5'));var auth=require(_0x1253('0x6'));var interaction=require(_0x1253('0x7'));var config=require(_0x1253('0x8'));var controller=require(_0x1253('0x9'));router[_0x1253('0xa')]('/',auth['isAuthenticated'](),controller[_0x1253('0xb')]);router[_0x1253('0xa')](_0x1253('0xc'),auth['isAuthenticated'](),controller[_0x1253('0xd')]);router[_0x1253('0xa')](_0x1253('0xe'),auth[_0x1253('0xf')](),controller[_0x1253('0x10')]);router[_0x1253('0xa')](_0x1253('0x11'),auth[_0x1253('0xf')](),controller[_0x1253('0x12')]);router[_0x1253('0xa')](_0x1253('0x13'),auth[_0x1253('0xf')](),controller[_0x1253('0x14')]);router[_0x1253('0x15')]('/',auth['isAuthenticated'](),controller[_0x1253('0x16')]);router[_0x1253('0x15')](_0x1253('0x11'),auth[_0x1253('0xf')](),controller[_0x1253('0x17')]);router[_0x1253('0x15')](_0x1253('0x18'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x1253('0x19')),controller[_0x1253('0x1a')]);router['put'](_0x1253('0xe'),auth[_0x1253('0xf')](),interaction[_0x1253('0x1b')](_0x1253('0x1c'),_0x1253('0x1d')),controller[_0x1253('0x1e')]);router[_0x1253('0x1f')](_0x1253('0xe'),auth['isAuthenticated'](),interaction[_0x1253('0x1b')](_0x1253('0x1c'),'faxinteraction:destroy'),controller[_0x1253('0x20')]);router['delete'](_0x1253('0x18'),auth[_0x1253('0xf')](),controller['removeTags']);module[_0x1253('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ece33e5..3c0c384 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 _0x9de3=['sequelize','TEXT','medium','BOOLEAN','out','DATE'];(function(_0xdd3c42,_0x14e1d7){var _0x9bf118=function(_0x3c072e){while(--_0x3c072e){_0xdd3c42['push'](_0xdd3c42['shift']());}};_0x9bf118(++_0x14e1d7);}(_0x9de3,0xea));var _0x39de=function(_0x2d56e8,_0x5ad430){_0x2d56e8=_0x2d56e8-0x0;var _0x49cfef=_0x9de3[_0x2d56e8];return _0x49cfef;};'use strict';var Sequelize=require(_0x39de('0x0'));module['exports']={'body':{'type':Sequelize[_0x39de('0x1')](_0x39de('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x39de('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x39de('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x39de('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x39de('0x5')]}}; \ No newline at end of file +var _0x2821=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x1387ec,_0x4bee12){var _0x19ae5e=function(_0x5e08de){while(--_0x5e08de){_0x1387ec['push'](_0x1387ec['shift']());}};_0x19ae5e(++_0x4bee12);}(_0x2821,0x87));var _0x1282=function(_0x1b79ca,_0x51b93c){_0x1b79ca=_0x1b79ca-0x0;var _0x5651d6=_0x2821[_0x1b79ca];return _0x5651d6;};'use strict';var Sequelize=require(_0x1282('0x0'));module[_0x1282('0x1')]={'body':{'type':Sequelize[_0x1282('0x2')](_0x1282('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1282('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1282('0x5')]('in',_0x1282('0x6')),'defaultValue':_0x1282('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1282('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1282('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index fabcc47..bfb818c 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 _0x0c2f=['download','join','root','server','files','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','create','findOne','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId'];(function(_0x1fa082,_0x387dd3){var _0x16cb37=function(_0x3a47ec){while(--_0x3a47ec){_0x1fa082['push'](_0x1fa082['shift']());}};_0x16cb37(++_0x387dd3);}(_0x0c2f,0x99));var _0xf0c2=function(_0x38a653,_0x1a5872){_0x38a653=_0x38a653-0x0;var _0x370492=_0x0c2f[_0x38a653];return _0x370492;};'use strict';var emlformat=require(_0xf0c2('0x0'));var rimraf=require(_0xf0c2('0x1'));var zipdir=require(_0xf0c2('0x2'));var jsonpatch=require(_0xf0c2('0x3'));var rp=require('request-promise');var moment=require(_0xf0c2('0x4'));var BPromise=require(_0xf0c2('0x5'));var Mustache=require(_0xf0c2('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf0c2('0x7'));var csv=require(_0xf0c2('0x8'));var ejs=require(_0xf0c2('0x9'));var fs=require('fs');var fs_extra=require(_0xf0c2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf0c2('0xb'));var jsforce=require(_0xf0c2('0xc'));var deskjs=require(_0xf0c2('0xd'));var toCsv=require(_0xf0c2('0x8'));var querystring=require(_0xf0c2('0xe'));var Papa=require(_0xf0c2('0xf'));var Redis=require('ioredis');var authService=require(_0xf0c2('0x10'));var qs=require(_0xf0c2('0x11'));var as=require(_0xf0c2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0c2('0x13'))(_0xf0c2('0x14'));var utils=require(_0xf0c2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf0c2('0x16'));var db=require(_0xf0c2('0x17'))['db'];config[_0xf0c2('0x18')]=_[_0xf0c2('0x19')](config[_0xf0c2('0x18')],{'host':_0xf0c2('0x1a'),'port':0x18eb});var socket=require(_0xf0c2('0x1b'))(new Redis(config[_0xf0c2('0x18')]));require(_0xf0c2('0x1c'))[_0xf0c2('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf0c2('0x1e')][_0xf0c2('0x1f')]({'port':0x232c});var client9002=jayson[_0xf0c2('0x1e')][_0xf0c2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5b4fd1,_0x2e6c9c,_0x13bb8e,_0x3fcf3a){return new BPromise(function(_0xfbde41,_0x15a519){var _0x41ac46=_0x3fcf3a||client;return _0x41ac46[_0xf0c2('0x20')](_0x5b4fd1,_0x13bb8e)[_0xf0c2('0x21')](function(_0x13e6a3){logger['info'](_0xf0c2('0x22'),_0x2e6c9c,'request\x20sent');logger[_0xf0c2('0x23')](_0xf0c2('0x24'),_0x2e6c9c,'request\x20sent',JSON['stringify'](_0x13e6a3));if(_0x13e6a3[_0xf0c2('0x25')]){if(_0x13e6a3[_0xf0c2('0x25')]['code']===0x1f4){logger[_0xf0c2('0x25')](_0xf0c2('0x22'),_0x2e6c9c,_0x13e6a3[_0xf0c2('0x25')][_0xf0c2('0x26')]);return _0x15a519(_0x13e6a3[_0xf0c2('0x25')]['message']);}logger[_0xf0c2('0x25')](_0xf0c2('0x22'),_0x2e6c9c,_0x13e6a3[_0xf0c2('0x25')][_0xf0c2('0x26')]);return _0xfbde41(_0x13e6a3[_0xf0c2('0x25')][_0xf0c2('0x26')]);}else{logger[_0xf0c2('0x27')](_0xf0c2('0x22'),_0x2e6c9c,_0xf0c2('0x28'));_0xfbde41(_0x13e6a3['result'][_0xf0c2('0x26')]);}})[_0xf0c2('0x29')](function(_0x4119af){logger['error'](_0xf0c2('0x22'),_0x2e6c9c,_0x4119af);_0x15a519(_0x4119af);});});}function respondWithStatusCode(_0x18f502,_0x2b78eb){_0x2b78eb=_0x2b78eb||0xcc;return function(_0xa78a48){if(_0xa78a48){return _0x18f502[_0xf0c2('0x2a')](_0x2b78eb);}return _0x18f502['status'](_0x2b78eb)[_0xf0c2('0x2b')]();};}function respondWithResult(_0x3441a8,_0xd172b){_0xd172b=_0xd172b||0xc8;return function(_0x1f2421){if(_0x1f2421){return _0x3441a8[_0xf0c2('0x2c')](_0xd172b)[_0xf0c2('0x2d')](_0x1f2421);}};}function respondWithFilteredResult(_0x1172a5,_0x1e1902){return function(_0x36641c){if(_0x36641c){var _0x14d7bb=typeof _0x1e1902['offset']===_0xf0c2('0x2e')&&typeof _0x1e1902[_0xf0c2('0x2f')]===_0xf0c2('0x2e');var _0x3cf09c=_0x36641c[_0xf0c2('0x30')];var _0x531ae6=_0x14d7bb?0x0:_0x1e1902['offset'];var _0x47942c=_0x14d7bb?_0x36641c[_0xf0c2('0x30')]:_0x1e1902[_0xf0c2('0x31')]+_0x1e1902['limit'];var _0x2b1d56;if(_0x47942c>=_0x3cf09c){_0x47942c=_0x3cf09c;_0x2b1d56=0xc8;}else{_0x2b1d56=0xce;}_0x1172a5[_0xf0c2('0x2c')](_0x2b1d56);return _0x1172a5['set'](_0xf0c2('0x32'),_0x531ae6+'-'+_0x47942c+'/'+_0x3cf09c)[_0xf0c2('0x2d')](_0x36641c);}return null;};}function patchUpdates(_0xd37f74){return function(_0x16c47a){try{jsonpatch[_0xf0c2('0x33')](_0x16c47a,_0xd37f74,!![]);}catch(_0x2fe3a8){return BPromise[_0xf0c2('0x34')](_0x2fe3a8);}return _0x16c47a[_0xf0c2('0x35')]();};}function saveUpdates(_0x3c4723,_0x41bc91){return function(_0x46f806){if(_0x46f806){return _0x46f806[_0xf0c2('0x36')](_0x3c4723)[_0xf0c2('0x21')](function(_0x329f85){return _0x329f85;});}return null;};}function removeEntity(_0x356fd3,_0x2df46d){return function(_0x67786f){if(_0x67786f){return _0x67786f[_0xf0c2('0x37')]()[_0xf0c2('0x21')](function(){_0x356fd3[_0xf0c2('0x2c')](0xcc)[_0xf0c2('0x2b')]();});}};}function handleEntityNotFound(_0x180aec,_0x1f72e1){return function(_0x2206e0){if(!_0x2206e0){_0x180aec[_0xf0c2('0x2a')](0x194);}return _0x2206e0;};}function handleError(_0xd2d16a,_0x54d5e6){_0x54d5e6=_0x54d5e6||0x1f4;return function(_0x5eb446){logger[_0xf0c2('0x25')](_0x5eb446[_0xf0c2('0x38')]);if(_0x5eb446[_0xf0c2('0x39')]){delete _0x5eb446['name'];}_0xd2d16a[_0xf0c2('0x2c')](_0x54d5e6)[_0xf0c2('0x3a')](_0x5eb446);};}exports[_0xf0c2('0x3b')]=function(_0x253d5c,_0x2a1e4c){var _0x58e218={},_0x486faa={},_0x296757={'count':0x0,'rows':[]};var _0x2ead75=_[_0xf0c2('0x3c')](db[_0xf0c2('0x3d')][_0xf0c2('0x3e')],function(_0x4ccb0d){return{'name':_0x4ccb0d[_0xf0c2('0x3f')],'type':_0x4ccb0d[_0xf0c2('0x40')][_0xf0c2('0x41')]};});_0x486faa[_0xf0c2('0x42')]=_[_0xf0c2('0x3c')](_0x2ead75,'name');_0x486faa['query']=_[_0xf0c2('0x43')](_0x253d5c[_0xf0c2('0x44')]);_0x486faa['filters']=_[_0xf0c2('0x45')](_0x486faa['model'],_0x486faa[_0xf0c2('0x44')]);_0x58e218[_0xf0c2('0x46')]=_[_0xf0c2('0x45')](_0x486faa[_0xf0c2('0x42')],qs[_0xf0c2('0x47')](_0x253d5c[_0xf0c2('0x44')][_0xf0c2('0x47')]));_0x58e218['attributes']=_0x58e218['attributes'][_0xf0c2('0x48')]?_0x58e218[_0xf0c2('0x46')]:_0x486faa[_0xf0c2('0x42')];if(!_0x253d5c[_0xf0c2('0x44')][_0xf0c2('0x49')](_0xf0c2('0x4a'))){_0x58e218[_0xf0c2('0x2f')]=qs['limit'](_0x253d5c[_0xf0c2('0x44')][_0xf0c2('0x2f')]);_0x58e218['offset']=qs[_0xf0c2('0x31')](_0x253d5c[_0xf0c2('0x44')]['offset']);}_0x58e218[_0xf0c2('0x4b')]=qs[_0xf0c2('0x4c')](_0x253d5c[_0xf0c2('0x44')][_0xf0c2('0x4c')]);_0x58e218[_0xf0c2('0x4d')]=qs[_0xf0c2('0x4e')](_[_0xf0c2('0x4f')](_0x253d5c['query'],_0x486faa[_0xf0c2('0x4e')]),_0x2ead75);if(_0x253d5c[_0xf0c2('0x44')][_0xf0c2('0x50')]){_0x58e218['where']=_['merge'](_0x58e218[_0xf0c2('0x4d')],{'$or':_[_0xf0c2('0x3c')](_0x2ead75,function(_0x4f27be){if(_0x4f27be[_0xf0c2('0x40')]!==_0xf0c2('0x51')){var _0x4e0db9={};_0x4e0db9[_0x4f27be[_0xf0c2('0x39')]]={'$like':'%'+_0x253d5c[_0xf0c2('0x44')][_0xf0c2('0x50')]+'%'};return _0x4e0db9;}})});}_0x58e218=_[_0xf0c2('0x52')]({},_0x58e218,_0x253d5c[_0xf0c2('0x53')]);var _0x2939df={'where':_0x58e218[_0xf0c2('0x4d')]};return db[_0xf0c2('0x3d')][_0xf0c2('0x30')](_0x2939df)['then'](function(_0x10cf2a){_0x296757[_0xf0c2('0x30')]=_0x10cf2a;if(_0x253d5c[_0xf0c2('0x44')][_0xf0c2('0x54')]){_0x58e218[_0xf0c2('0x55')]=[{'all':!![]}];}return db[_0xf0c2('0x3d')][_0xf0c2('0x56')](_0x58e218);})[_0xf0c2('0x21')](function(_0x1610b9){_0x296757[_0xf0c2('0x57')]=_0x1610b9;return _0x296757;})[_0xf0c2('0x21')](respondWithFilteredResult(_0x2a1e4c,_0x58e218))['catch'](handleError(_0x2a1e4c,null));};exports[_0xf0c2('0x58')]=function(_0x348613,_0x494df4){var _0xfd0fc0={'raw':!![],'where':{'id':_0x348613[_0xf0c2('0x59')]['id']}},_0x37ef9c={};_0x37ef9c[_0xf0c2('0x42')]=_['keys'](db[_0xf0c2('0x3d')][_0xf0c2('0x3e')]);_0x37ef9c[_0xf0c2('0x44')]=_[_0xf0c2('0x43')](_0x348613[_0xf0c2('0x44')]);_0x37ef9c[_0xf0c2('0x4e')]=_[_0xf0c2('0x45')](_0x37ef9c[_0xf0c2('0x42')],_0x37ef9c[_0xf0c2('0x44')]);_0xfd0fc0[_0xf0c2('0x46')]=_['intersection'](_0x37ef9c[_0xf0c2('0x42')],qs[_0xf0c2('0x47')](_0x348613[_0xf0c2('0x44')]['fields']));_0xfd0fc0['attributes']=_0xfd0fc0['attributes'][_0xf0c2('0x48')]?_0xfd0fc0[_0xf0c2('0x46')]:_0x37ef9c[_0xf0c2('0x42')];if(_0x348613['query'][_0xf0c2('0x54')]){_0xfd0fc0['include']=[{'all':!![]}];}_0xfd0fc0=_[_0xf0c2('0x52')]({},_0xfd0fc0,_0x348613[_0xf0c2('0x53')]);return db[_0xf0c2('0x3d')][_0xf0c2('0x5a')](_0xfd0fc0)['then'](handleEntityNotFound(_0x494df4,null))[_0xf0c2('0x21')](respondWithResult(_0x494df4,null))['catch'](handleError(_0x494df4,null));};exports['update']=function(_0xbd4840,_0x4b77d0){if(_0xbd4840['body']['id']){delete _0xbd4840['body']['id'];}return db['FaxMessage'][_0xf0c2('0x5a')]({'where':{'id':_0xbd4840[_0xf0c2('0x59')]['id']}})[_0xf0c2('0x21')](handleEntityNotFound(_0x4b77d0,null))['then'](saveUpdates(_0xbd4840[_0xf0c2('0x5b')],null))[_0xf0c2('0x21')](respondWithResult(_0x4b77d0,null))[_0xf0c2('0x29')](handleError(_0x4b77d0,null));};exports[_0xf0c2('0x37')]=function(_0x36d2e8,_0x153e74){return db['FaxMessage'][_0xf0c2('0x5a')]({'where':{'id':_0x36d2e8[_0xf0c2('0x59')]['id']}})[_0xf0c2('0x21')](handleEntityNotFound(_0x153e74,null))[_0xf0c2('0x21')](removeEntity(_0x153e74,null))[_0xf0c2('0x29')](handleError(_0x153e74,null));};exports['describe']=function(_0x5d9532,_0x550eb6){return db['FaxMessage'][_0xf0c2('0x5c')]()[_0xf0c2('0x21')](respondWithResult(_0x550eb6,null))[_0xf0c2('0x29')](handleError(_0x550eb6,null));};var interaction_log=require('../../config/logger')(_0xf0c2('0x5d'));exports[_0xf0c2('0x5e')]=function(_0x11d944,_0x45dc09,_0x138f12){var _0x156f4c={'agent':{},'channel':_0xf0c2('0x5f')};if(_0x11d944[_0xf0c2('0x5b')]['id']){delete _0x11d944[_0xf0c2('0x5b')]['id'];}_0x11d944[_0xf0c2('0x5b')][_0xf0c2('0x60')]=!![];_0x11d944[_0xf0c2('0x5b')][_0xf0c2('0x61')]=moment()[_0xf0c2('0x62')](_0xf0c2('0x63'));_0x11d944[_0xf0c2('0x5b')][_0xf0c2('0x64')]=_0x11d944[_0xf0c2('0x5b')][_0xf0c2('0x64')]||_0x11d944[_0xf0c2('0x65')]['id'];_0x156f4c[_0xf0c2('0x66')]['id']=_0x11d944[_0xf0c2('0x5b')][_0xf0c2('0x64')];return db[_0xf0c2('0x3d')]['find']({'where':{'id':_0x11d944['params']['id'],'UserId':null}})[_0xf0c2('0x21')](handleEntityNotFound(_0x45dc09,null))[_0xf0c2('0x21')](saveUpdates(_0x11d944['body'],null))['then'](function(_0x50fdde){if(_0x50fdde){_0x156f4c[_0xf0c2('0x26')]=_0x50fdde[_0xf0c2('0x67')]({'plain':!![]});return db[_0xf0c2('0x68')][_0xf0c2('0x5a')]({'where':{'id':_0x50fdde[_0xf0c2('0x69')]}});}return null;})[_0xf0c2('0x21')](handleEntityNotFound(_0x45dc09,null))[_0xf0c2('0x21')](function(_0x12dfa4){if(_0x12dfa4){return _0x12dfa4[_0xf0c2('0x36')]({'UserId':_0x11d944[_0xf0c2('0x5b')][_0xf0c2('0x64')],'read1stAt':_[_0xf0c2('0x6a')](_0x12dfa4[_0xf0c2('0x6b')])?moment()[_0xf0c2('0x62')](_0xf0c2('0x63')):undefined});}return null;})[_0xf0c2('0x21')](function(_0x33bfe1){if(_0x33bfe1){_0x156f4c[_0xf0c2('0x6c')]=_0x33bfe1['get']({'plain':!![]});interaction_log[_0xf0c2('0x27')](_0xf0c2('0x6d'),_0x11d944[_0xf0c2('0x65')]['id'],_0x11d944[_0xf0c2('0x65')][_0xf0c2('0x39')],_0x11d944[_0xf0c2('0x65')][_0xf0c2('0x6e')],_0x156f4c[_0xf0c2('0x6c')]['id'],_0x11d944[_0xf0c2('0x5b')]?JSON[_0xf0c2('0x6f')](_0x11d944['body']):_0xf0c2('0x70'));return respondWithRpcPromise(_0xf0c2('0x71'),_0xf0c2('0x72'),_0x156f4c);}return null;})['then'](function(_0x41a675){var _0x42668e=_0xf0c2('0x73')+_0x41a675[_0xf0c2('0x26')][_0xf0c2('0x74')];return db[_0xf0c2('0x75')]['query'](_0x42668e,{'type':db[_0xf0c2('0x76')][_0xf0c2('0x77')][_0xf0c2('0x78')],'raw':!![]})[_0xf0c2('0x21')](function(_0xab8a59){return _0xab8a59;});})['then'](function(_0x3727fb){if(_0x3727fb){_0x156f4c[_0xf0c2('0x26')][_0xf0c2('0x79')]=_0x3727fb[0x0];if(!_0x11d944[_0xf0c2('0x5b')][_0xf0c2('0x64')])return;return db[_0xf0c2('0x7a')][_0xf0c2('0x5a')]({'where':{'id':_0x11d944[_0xf0c2('0x5b')]['UserId'],'role':_0xf0c2('0x66')},'attributes':['id',_0xf0c2('0x39'),_0xf0c2('0x7b'),_0xf0c2('0x7c'),_0xf0c2('0x7d')],'raw':!![]});}return null;})[_0xf0c2('0x21')](function(_0x588b98){if(!_0x588b98)return null;_0x156f4c[_0xf0c2('0x26')][_0xf0c2('0x66')]=_0x588b98;return _0x156f4c;})[_0xf0c2('0x21')](function(_0x142df6){if(_0x142df6){if(_0x11d944[_0xf0c2('0x5b')][_0xf0c2('0x7e')]){_0x156f4c[_0xf0c2('0x26')][_0xf0c2('0x7f')]=util[_0xf0c2('0x62')]('SIP/%s',_0x11d944['user'][_0xf0c2('0x39')]);_0x156f4c[_0xf0c2('0x26')][_0xf0c2('0x80')]=_0x156f4c[_0xf0c2('0x80')];_0x156f4c[_0xf0c2('0x26')]['motionChannel']=_0x156f4c[_0xf0c2('0x80')];_0x156f4c[_0xf0c2('0x26')][_0xf0c2('0x81')]=_0xf0c2('0x5e');return respondWithRpcPromise(_0xf0c2('0x82'),'EventManager',{'event':_0xf0c2('0x83'),'message':_0x156f4c[_0xf0c2('0x26')]},client9002)[_0xf0c2('0x21')](function(){return _0x156f4c;});}return _0x156f4c;}return null;})[_0xf0c2('0x21')](respondWithResult(_0x45dc09,null))[_0xf0c2('0x29')](handleError(_0x45dc09,null));};var interaction_log=require(_0xf0c2('0x13'))(_0xf0c2('0x5d'));exports[_0xf0c2('0x34')]=function(_0x5058a9,_0x272122,_0x3488d1){var _0x5c0488={'agent':{},'channel':_0xf0c2('0x5f')};if(_0x5058a9[_0xf0c2('0x5b')]['id']){delete _0x5058a9[_0xf0c2('0x5b')]['id'];}_0x5058a9['body'][_0xf0c2('0x64')]=_0x5058a9[_0xf0c2('0x5b')][_0xf0c2('0x64')]||_0x5058a9[_0xf0c2('0x65')]['id'];_0x5c0488[_0xf0c2('0x66')]['id']=_0x5058a9[_0xf0c2('0x5b')][_0xf0c2('0x64')];return db[_0xf0c2('0x3d')]['find']({'where':{'id':_0x5058a9[_0xf0c2('0x59')]['id'],'UserId':null}})[_0xf0c2('0x21')](handleEntityNotFound(_0x272122,null))[_0xf0c2('0x21')](function(_0x19ced0){if(_0x19ced0){_0x5c0488[_0xf0c2('0x26')]=_0x19ced0[_0xf0c2('0x67')]({'plain':!![]});return db['FaxInteraction'][_0xf0c2('0x5a')]({'where':{'id':_0x19ced0[_0xf0c2('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x272122,null))[_0xf0c2('0x21')](function(_0xe9ddf4){if(_0xe9ddf4){_0x5c0488[_0xf0c2('0x6c')]=_0xe9ddf4[_0xf0c2('0x67')]({'plain':!![]});interaction_log['info'](_0xf0c2('0x84'),_0x5058a9[_0xf0c2('0x65')]['id'],_0x5058a9['user']['name'],_0x5058a9['user'][_0xf0c2('0x6e')],_0x5c0488[_0xf0c2('0x6c')]['id'],_0x5058a9['body']?JSON[_0xf0c2('0x6f')](_0x5058a9['body']):_0xf0c2('0x70'));return respondWithRpcPromise(_0xf0c2('0x85'),_0xf0c2('0x86'),_0x5c0488);}return null;})[_0xf0c2('0x21')](function(_0x389fbf){var _0x5e349c=_0xf0c2('0x73')+_0x389fbf[_0xf0c2('0x26')][_0xf0c2('0x74')];return db[_0xf0c2('0x75')][_0xf0c2('0x44')](_0x5e349c,{'type':db['Sequelize'][_0xf0c2('0x77')][_0xf0c2('0x78')],'raw':!![]})[_0xf0c2('0x21')](function(_0x8032ac){return _0x8032ac;});})[_0xf0c2('0x21')](function(_0x1e6190){if(_0x1e6190){_0x5c0488['message'][_0xf0c2('0x79')]=_0x1e6190[0x0];if(!_0x5058a9[_0xf0c2('0x5b')][_0xf0c2('0x64')])return;return db[_0xf0c2('0x7a')][_0xf0c2('0x5a')]({'where':{'id':_0x5058a9['body'][_0xf0c2('0x64')],'role':_0xf0c2('0x66')},'attributes':['id',_0xf0c2('0x39'),_0xf0c2('0x7b'),_0xf0c2('0x7c'),_0xf0c2('0x7d')],'raw':!![]});}return null;})[_0xf0c2('0x21')](function(_0x3de4bf){if(!_0x3de4bf)return null;_0x5c0488[_0xf0c2('0x26')][_0xf0c2('0x66')]=_0x3de4bf;return _0x5c0488;})[_0xf0c2('0x21')](function(_0x55fb32){if(_0x55fb32){_0x55fb32[_0xf0c2('0x26')][_0xf0c2('0x7f')]=util[_0xf0c2('0x62')](_0xf0c2('0x87'),_0x5058a9[_0xf0c2('0x65')][_0xf0c2('0x39')]);_0x55fb32[_0xf0c2('0x26')][_0xf0c2('0x80')]=_0x5c0488[_0xf0c2('0x80')];_0x55fb32['message']['motionChannel']=_0x5c0488[_0xf0c2('0x80')];_0x55fb32[_0xf0c2('0x26')]['event']=_0xf0c2('0x34');respondWithRpcPromise('EventManager',_0xf0c2('0x82'),{'event':'rejectmessage','message':_0x55fb32[_0xf0c2('0x26')]},client9002);return _0x5c0488;}return null;})[_0xf0c2('0x21')](respondWithResult(_0x272122,null))[_0xf0c2('0x29')](handleError(_0x272122,null));};exports[_0xf0c2('0x88')]=function(_0x4b49b4,_0x3efdc2){var _0x5f0521;return db[_0xf0c2('0x3d')][_0xf0c2('0x88')](_0x4b49b4[_0xf0c2('0x5b')],{})[_0xf0c2('0x21')](function(_0x52b504){_0x5f0521=_0x52b504;return db['CmContact'][_0xf0c2('0x89')]({'where':{'id':_0x5f0521[_0xf0c2('0x74')]}});})['then'](function(_0xc9d0d2){if(_[_0xf0c2('0x6a')](_0xc9d0d2)){return;}else{_0x5f0521[_0xf0c2('0x5f')]=_0xc9d0d2[_0xf0c2('0x5f')];return db[_0xf0c2('0x8a')][_0xf0c2('0x89')]({'where':{'id':_0x5f0521['AttachmentId']}});}})['then'](function(_0x58bf1e){return respondWithRpcPromise(_0xf0c2('0x8b'),'SendFax',{'FaxAccountId':_['isNil'](_0x4b49b4[_0xf0c2('0x5b')])?undefined:_0x4b49b4[_0xf0c2('0x5b')]['FaxAccountId'],'path':_[_0xf0c2('0x6a')](_0x58bf1e)?undefined:util[_0xf0c2('0x62')](_0xf0c2('0x8c'),_0x58bf1e[_0xf0c2('0x8d')]),'fax':_[_0xf0c2('0x6a')](_0x5f0521[_0xf0c2('0x5f')])?undefined:_0x5f0521[_0xf0c2('0x5f')],'AttachmentId':_0x5f0521[_0xf0c2('0x8e')]},client9002);})['then'](respondWithResult(_0x3efdc2,0xc9))['catch'](handleError(_0x3efdc2,null));};exports[_0xf0c2('0x8f')]=function(_0x3f1a8a,_0x2e6099){var _0x187870=path[_0xf0c2('0x90')](config[_0xf0c2('0x91')],_0xf0c2('0x92'),_0xf0c2('0x93'),'attachments');return db[_0xf0c2('0x3d')][_0xf0c2('0x5a')]({'where':{'id':_0x3f1a8a[_0xf0c2('0x59')]['id']},'include':[{'model':db[_0xf0c2('0x8a')],'as':_0xf0c2('0x8a')}]})['then'](handleEntityNotFound(_0x2e6099,null))[_0xf0c2('0x21')](function(_0x3bc273){if(_0x3bc273){return _0x2e6099[_0xf0c2('0x8f')](path[_0xf0c2('0x90')](_0x187870,_0x3bc273[_0xf0c2('0x8a')]['basename']));}})['catch'](handleError(_0x2e6099,null));}; \ No newline at end of file +var _0x3ee9=['manual','interface','SIP/%s','channel','motionChannel','event','EventManager','../../config/logger','fax-interactions','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','rejectmessage','create','CmContact','isNil','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','server','attachments','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','client','http','request','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','name','send','index','map','FaxMessage','fieldName','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','include','rows','show','params','rawAttributes','filters','includeAll','options','update','body','find','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','FaxInteractionId','format','interaction','get','info','user','role','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal'];(function(_0x4fe3bd,_0x39d568){var _0x51de54=function(_0x5c2a0c){while(--_0x5c2a0c){_0x4fe3bd['push'](_0x4fe3bd['shift']());}};_0x51de54(++_0x39d568);}(_0x3ee9,0x136));var _0x93ee=function(_0x270075,_0x142657){_0x270075=_0x270075-0x0;var _0x24a211=_0x3ee9[_0x270075];return _0x24a211;};'use strict';var emlformat=require(_0x93ee('0x0'));var rimraf=require(_0x93ee('0x1'));var zipdir=require(_0x93ee('0x2'));var jsonpatch=require(_0x93ee('0x3'));var rp=require('request-promise');var moment=require(_0x93ee('0x4'));var BPromise=require(_0x93ee('0x5'));var Mustache=require(_0x93ee('0x6'));var util=require(_0x93ee('0x7'));var path=require(_0x93ee('0x8'));var sox=require(_0x93ee('0x9'));var csv=require(_0x93ee('0xa'));var ejs=require(_0x93ee('0xb'));var fs=require('fs');var fs_extra=require(_0x93ee('0xc'));var _=require(_0x93ee('0xd'));var squel=require(_0x93ee('0xe'));var crypto=require(_0x93ee('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x93ee('0xa'));var querystring=require(_0x93ee('0x10'));var Papa=require('papaparse');var Redis=require(_0x93ee('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x93ee('0x12'));var as=require(_0x93ee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x93ee('0x14'));var utils=require('../../config/utils');var config=require(_0x93ee('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x93ee('0x16'))['db'];config[_0x93ee('0x17')]=_[_0x93ee('0x18')](config[_0x93ee('0x17')],{'host':_0x93ee('0x19'),'port':0x18eb});var socket=require(_0x93ee('0x1a'))(new Redis(config[_0x93ee('0x17')]));require(_0x93ee('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x93ee('0x1c')][_0x93ee('0x1d')]({'port':0x232c});var client9002=jayson[_0x93ee('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x651e51,_0x148b41,_0x15c426,_0x83b627){return new BPromise(function(_0x565bea,_0x192c27){var _0x19b0f2=_0x83b627||client;return _0x19b0f2[_0x93ee('0x1e')](_0x651e51,_0x15c426)['then'](function(_0x1fb0c5){logger['info'](_0x93ee('0x1f'),_0x148b41,_0x93ee('0x20'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x148b41,_0x93ee('0x20'),JSON[_0x93ee('0x21')](_0x1fb0c5));if(_0x1fb0c5[_0x93ee('0x22')]){if(_0x1fb0c5[_0x93ee('0x22')][_0x93ee('0x23')]===0x1f4){logger[_0x93ee('0x22')](_0x93ee('0x1f'),_0x148b41,_0x1fb0c5[_0x93ee('0x22')][_0x93ee('0x24')]);return _0x192c27(_0x1fb0c5[_0x93ee('0x22')]['message']);}logger[_0x93ee('0x22')](_0x93ee('0x1f'),_0x148b41,_0x1fb0c5['error'][_0x93ee('0x24')]);return _0x565bea(_0x1fb0c5[_0x93ee('0x22')][_0x93ee('0x24')]);}else{logger['info'](_0x93ee('0x1f'),_0x148b41,'request\x20sent');_0x565bea(_0x1fb0c5[_0x93ee('0x25')]['message']);}})[_0x93ee('0x26')](function(_0x1f2f41){logger['error'](_0x93ee('0x1f'),_0x148b41,_0x1f2f41);_0x192c27(_0x1f2f41);});});}function respondWithStatusCode(_0x3de101,_0x33b8fe){_0x33b8fe=_0x33b8fe||0xcc;return function(_0x2757ad){if(_0x2757ad){return _0x3de101['sendStatus'](_0x33b8fe);}return _0x3de101[_0x93ee('0x27')](_0x33b8fe)[_0x93ee('0x28')]();};}function respondWithResult(_0x48b148,_0x4ee6a3){_0x4ee6a3=_0x4ee6a3||0xc8;return function(_0x5b2334){if(_0x5b2334){return _0x48b148[_0x93ee('0x27')](_0x4ee6a3)['json'](_0x5b2334);}};}function respondWithFilteredResult(_0xa1ff37,_0x59a30e){return function(_0x349bed){if(_0x349bed){var _0x4cd731=typeof _0x59a30e[_0x93ee('0x29')]===_0x93ee('0x2a')&&typeof _0x59a30e[_0x93ee('0x2b')]==='undefined';var _0x42724f=_0x349bed[_0x93ee('0x2c')];var _0x2bb174=_0x4cd731?0x0:_0x59a30e[_0x93ee('0x29')];var _0x36b3dc=_0x4cd731?_0x349bed[_0x93ee('0x2c')]:_0x59a30e[_0x93ee('0x29')]+_0x59a30e[_0x93ee('0x2b')];var _0x107687;if(_0x36b3dc>=_0x42724f){_0x36b3dc=_0x42724f;_0x107687=0xc8;}else{_0x107687=0xce;}_0xa1ff37['status'](_0x107687);return _0xa1ff37['set'](_0x93ee('0x2d'),_0x2bb174+'-'+_0x36b3dc+'/'+_0x42724f)[_0x93ee('0x2e')](_0x349bed);}return null;};}function patchUpdates(_0x5666cc){return function(_0x143cec){try{jsonpatch[_0x93ee('0x2f')](_0x143cec,_0x5666cc,!![]);}catch(_0xb0522d){return BPromise[_0x93ee('0x30')](_0xb0522d);}return _0x143cec[_0x93ee('0x31')]();};}function saveUpdates(_0x170762,_0x4b01c5){return function(_0x3d94d8){if(_0x3d94d8){return _0x3d94d8['update'](_0x170762)[_0x93ee('0x32')](function(_0xd995ac){return _0xd995ac;});}return null;};}function removeEntity(_0x4d0292,_0x388caf){return function(_0x218d79){if(_0x218d79){return _0x218d79[_0x93ee('0x33')]()[_0x93ee('0x32')](function(){_0x4d0292['status'](0xcc)[_0x93ee('0x28')]();});}};}function handleEntityNotFound(_0x34a301,_0x3a45f2){return function(_0x226d7e){if(!_0x226d7e){_0x34a301['sendStatus'](0x194);}return _0x226d7e;};}function handleError(_0x1a4d80,_0xb5b99c){_0xb5b99c=_0xb5b99c||0x1f4;return function(_0x599431){logger['error'](_0x599431['stack']);if(_0x599431[_0x93ee('0x34')]){delete _0x599431[_0x93ee('0x34')];}_0x1a4d80['status'](_0xb5b99c)[_0x93ee('0x35')](_0x599431);};}exports[_0x93ee('0x36')]=function(_0x1855ce,_0x237da5){var _0x1030fd={},_0x16a433={},_0xf43fc4={'count':0x0,'rows':[]};var _0x293c87=_[_0x93ee('0x37')](db[_0x93ee('0x38')]['rawAttributes'],function(_0x4b03c7){return{'name':_0x4b03c7[_0x93ee('0x39')],'type':_0x4b03c7['type']['key']};});_0x16a433[_0x93ee('0x3a')]=_[_0x93ee('0x37')](_0x293c87,_0x93ee('0x34'));_0x16a433[_0x93ee('0x3b')]=_[_0x93ee('0x3c')](_0x1855ce[_0x93ee('0x3b')]);_0x16a433['filters']=_['intersection'](_0x16a433[_0x93ee('0x3a')],_0x16a433[_0x93ee('0x3b')]);_0x1030fd[_0x93ee('0x3d')]=_[_0x93ee('0x3e')](_0x16a433['model'],qs[_0x93ee('0x3f')](_0x1855ce[_0x93ee('0x3b')][_0x93ee('0x3f')]));_0x1030fd['attributes']=_0x1030fd[_0x93ee('0x3d')]['length']?_0x1030fd[_0x93ee('0x3d')]:_0x16a433[_0x93ee('0x3a')];if(!_0x1855ce[_0x93ee('0x3b')][_0x93ee('0x40')](_0x93ee('0x41'))){_0x1030fd[_0x93ee('0x2b')]=qs[_0x93ee('0x2b')](_0x1855ce[_0x93ee('0x3b')][_0x93ee('0x2b')]);_0x1030fd['offset']=qs[_0x93ee('0x29')](_0x1855ce[_0x93ee('0x3b')]['offset']);}_0x1030fd['order']=qs[_0x93ee('0x42')](_0x1855ce[_0x93ee('0x3b')]['sort']);_0x1030fd[_0x93ee('0x43')]=qs['filters'](_['pick'](_0x1855ce[_0x93ee('0x3b')],_0x16a433['filters']),_0x293c87);if(_0x1855ce[_0x93ee('0x3b')][_0x93ee('0x44')]){_0x1030fd[_0x93ee('0x43')]=_[_0x93ee('0x45')](_0x1030fd['where'],{'$or':_[_0x93ee('0x37')](_0x293c87,function(_0x3c18ad){if(_0x3c18ad[_0x93ee('0x46')]!==_0x93ee('0x47')){var _0x2e08ea={};_0x2e08ea[_0x3c18ad[_0x93ee('0x34')]]={'$like':'%'+_0x1855ce[_0x93ee('0x3b')][_0x93ee('0x44')]+'%'};return _0x2e08ea;}})});}_0x1030fd=_['merge']({},_0x1030fd,_0x1855ce['options']);var _0x1a664b={'where':_0x1030fd[_0x93ee('0x43')]};return db['FaxMessage'][_0x93ee('0x2c')](_0x1a664b)[_0x93ee('0x32')](function(_0x5c80de){_0xf43fc4[_0x93ee('0x2c')]=_0x5c80de;if(_0x1855ce['query']['includeAll']){_0x1030fd[_0x93ee('0x48')]=[{'all':!![]}];}return db[_0x93ee('0x38')]['findAll'](_0x1030fd);})[_0x93ee('0x32')](function(_0x43559f){_0xf43fc4[_0x93ee('0x49')]=_0x43559f;return _0xf43fc4;})[_0x93ee('0x32')](respondWithFilteredResult(_0x237da5,_0x1030fd))[_0x93ee('0x26')](handleError(_0x237da5,null));};exports[_0x93ee('0x4a')]=function(_0xc8414a,_0x352c6f){var _0x27a5c5={'raw':!![],'where':{'id':_0xc8414a[_0x93ee('0x4b')]['id']}},_0x2ab75f={};_0x2ab75f['model']=_[_0x93ee('0x3c')](db[_0x93ee('0x38')][_0x93ee('0x4c')]);_0x2ab75f['query']=_['keys'](_0xc8414a[_0x93ee('0x3b')]);_0x2ab75f[_0x93ee('0x4d')]=_[_0x93ee('0x3e')](_0x2ab75f['model'],_0x2ab75f[_0x93ee('0x3b')]);_0x27a5c5[_0x93ee('0x3d')]=_[_0x93ee('0x3e')](_0x2ab75f[_0x93ee('0x3a')],qs['fields'](_0xc8414a[_0x93ee('0x3b')][_0x93ee('0x3f')]));_0x27a5c5[_0x93ee('0x3d')]=_0x27a5c5['attributes']['length']?_0x27a5c5[_0x93ee('0x3d')]:_0x2ab75f['model'];if(_0xc8414a[_0x93ee('0x3b')][_0x93ee('0x4e')]){_0x27a5c5[_0x93ee('0x48')]=[{'all':!![]}];}_0x27a5c5=_[_0x93ee('0x45')]({},_0x27a5c5,_0xc8414a[_0x93ee('0x4f')]);return db['FaxMessage']['find'](_0x27a5c5)[_0x93ee('0x32')](handleEntityNotFound(_0x352c6f,null))[_0x93ee('0x32')](respondWithResult(_0x352c6f,null))[_0x93ee('0x26')](handleError(_0x352c6f,null));};exports[_0x93ee('0x50')]=function(_0x7ab776,_0x47cf8f){if(_0x7ab776[_0x93ee('0x51')]['id']){delete _0x7ab776['body']['id'];}return db['FaxMessage'][_0x93ee('0x52')]({'where':{'id':_0x7ab776['params']['id']}})[_0x93ee('0x32')](handleEntityNotFound(_0x47cf8f,null))[_0x93ee('0x32')](saveUpdates(_0x7ab776[_0x93ee('0x51')],null))[_0x93ee('0x32')](respondWithResult(_0x47cf8f,null))[_0x93ee('0x26')](handleError(_0x47cf8f,null));};exports['destroy']=function(_0x56ed38,_0x36e47e){return db['FaxMessage']['find']({'where':{'id':_0x56ed38[_0x93ee('0x4b')]['id']}})[_0x93ee('0x32')](handleEntityNotFound(_0x36e47e,null))[_0x93ee('0x32')](removeEntity(_0x36e47e,null))['catch'](handleError(_0x36e47e,null));};exports['describe']=function(_0x1e7119,_0x2292bd){return db[_0x93ee('0x38')][_0x93ee('0x53')]()[_0x93ee('0x32')](respondWithResult(_0x2292bd,null))['catch'](handleError(_0x2292bd,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x93ee('0x54')]=function(_0x2d9dee,_0x1d0232,_0x59b73a){var _0x181477={'agent':{},'channel':'fax'};if(_0x2d9dee[_0x93ee('0x51')]['id']){delete _0x2d9dee[_0x93ee('0x51')]['id'];}_0x2d9dee['body'][_0x93ee('0x55')]=!![];_0x2d9dee['body'][_0x93ee('0x56')]=moment()['format'](_0x93ee('0x57'));_0x2d9dee[_0x93ee('0x51')][_0x93ee('0x58')]=_0x2d9dee[_0x93ee('0x51')]['UserId']||_0x2d9dee['user']['id'];_0x181477['agent']['id']=_0x2d9dee[_0x93ee('0x51')][_0x93ee('0x58')];return db[_0x93ee('0x38')][_0x93ee('0x52')]({'where':{'id':_0x2d9dee[_0x93ee('0x4b')]['id'],'UserId':null}})[_0x93ee('0x32')](handleEntityNotFound(_0x1d0232,null))[_0x93ee('0x32')](saveUpdates(_0x2d9dee[_0x93ee('0x51')],null))[_0x93ee('0x32')](function(_0x552d3f){if(_0x552d3f){_0x181477[_0x93ee('0x24')]=_0x552d3f['get']({'plain':!![]});return db['FaxInteraction'][_0x93ee('0x52')]({'where':{'id':_0x552d3f[_0x93ee('0x59')]}});}return null;})['then'](handleEntityNotFound(_0x1d0232,null))[_0x93ee('0x32')](function(_0x292401){if(_0x292401){return _0x292401[_0x93ee('0x50')]({'UserId':_0x2d9dee[_0x93ee('0x51')][_0x93ee('0x58')],'read1stAt':_['isNil'](_0x292401['read1stAt'])?moment()[_0x93ee('0x5a')](_0x93ee('0x57')):undefined});}return null;})['then'](function(_0xdd6be1){if(_0xdd6be1){_0x181477[_0x93ee('0x5b')]=_0xdd6be1[_0x93ee('0x5c')]({'plain':!![]});interaction_log[_0x93ee('0x5d')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d9dee[_0x93ee('0x5e')]['id'],_0x2d9dee[_0x93ee('0x5e')]['name'],_0x2d9dee[_0x93ee('0x5e')][_0x93ee('0x5f')],_0x181477[_0x93ee('0x5b')]['id'],_0x2d9dee['body']?JSON[_0x93ee('0x21')](_0x2d9dee[_0x93ee('0x51')]):'null');return respondWithRpcPromise(_0x93ee('0x60'),'acceptMessage',_0x181477);}return null;})[_0x93ee('0x32')](function(_0x3e8fc8){var _0x209701='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3e8fc8[_0x93ee('0x24')][_0x93ee('0x61')];return db[_0x93ee('0x62')][_0x93ee('0x3b')](_0x209701,{'type':db[_0x93ee('0x63')][_0x93ee('0x64')][_0x93ee('0x65')],'raw':!![]})[_0x93ee('0x32')](function(_0x2b802d){return _0x2b802d;});})['then'](function(_0x218b25){if(_0x218b25){_0x181477[_0x93ee('0x24')][_0x93ee('0x66')]=_0x218b25[0x0];if(!_0x2d9dee[_0x93ee('0x51')][_0x93ee('0x58')])return;return db[_0x93ee('0x67')]['find']({'where':{'id':_0x2d9dee[_0x93ee('0x51')][_0x93ee('0x58')],'role':_0x93ee('0x68')},'attributes':['id',_0x93ee('0x34'),_0x93ee('0x69'),'email',_0x93ee('0x6a')],'raw':!![]});}return null;})[_0x93ee('0x32')](function(_0x4e12af){if(!_0x4e12af)return null;_0x181477[_0x93ee('0x24')]['agent']=_0x4e12af;return _0x181477;})[_0x93ee('0x32')](function(_0x44b419){if(_0x44b419){if(_0x2d9dee[_0x93ee('0x51')][_0x93ee('0x6b')]){_0x181477[_0x93ee('0x24')][_0x93ee('0x6c')]=util[_0x93ee('0x5a')](_0x93ee('0x6d'),_0x2d9dee[_0x93ee('0x5e')][_0x93ee('0x34')]);_0x181477[_0x93ee('0x24')][_0x93ee('0x6e')]=_0x181477['channel'];_0x181477[_0x93ee('0x24')][_0x93ee('0x6f')]=_0x181477['channel'];_0x181477[_0x93ee('0x24')][_0x93ee('0x70')]=_0x93ee('0x54');return respondWithRpcPromise(_0x93ee('0x71'),'EventManager',{'event':'acceptmessage','message':_0x181477[_0x93ee('0x24')]},client9002)[_0x93ee('0x32')](function(){return _0x181477;});}return _0x181477;}return null;})['then'](respondWithResult(_0x1d0232,null))[_0x93ee('0x26')](handleError(_0x1d0232,null));};var interaction_log=require(_0x93ee('0x72'))(_0x93ee('0x73'));exports['reject']=function(_0x3f00f5,_0x23a7ad,_0x2ab188){var _0xe1c6bc={'agent':{},'channel':_0x93ee('0x74')};if(_0x3f00f5[_0x93ee('0x51')]['id']){delete _0x3f00f5[_0x93ee('0x51')]['id'];}_0x3f00f5[_0x93ee('0x51')]['UserId']=_0x3f00f5['body'][_0x93ee('0x58')]||_0x3f00f5[_0x93ee('0x5e')]['id'];_0xe1c6bc[_0x93ee('0x68')]['id']=_0x3f00f5[_0x93ee('0x51')]['UserId'];return db['FaxMessage'][_0x93ee('0x52')]({'where':{'id':_0x3f00f5['params']['id'],'UserId':null}})[_0x93ee('0x32')](handleEntityNotFound(_0x23a7ad,null))[_0x93ee('0x32')](function(_0x347736){if(_0x347736){_0xe1c6bc['message']=_0x347736[_0x93ee('0x5c')]({'plain':!![]});return db[_0x93ee('0x75')]['find']({'where':{'id':_0x347736[_0x93ee('0x59')]}});}return null;})[_0x93ee('0x32')](handleEntityNotFound(_0x23a7ad,null))[_0x93ee('0x32')](function(_0x503887){if(_0x503887){_0xe1c6bc['interaction']=_0x503887[_0x93ee('0x5c')]({'plain':!![]});interaction_log[_0x93ee('0x5d')](_0x93ee('0x76'),_0x3f00f5[_0x93ee('0x5e')]['id'],_0x3f00f5['user']['name'],_0x3f00f5[_0x93ee('0x5e')][_0x93ee('0x5f')],_0xe1c6bc['interaction']['id'],_0x3f00f5[_0x93ee('0x51')]?JSON[_0x93ee('0x21')](_0x3f00f5[_0x93ee('0x51')]):_0x93ee('0x77'));return respondWithRpcPromise(_0x93ee('0x78'),_0x93ee('0x79'),_0xe1c6bc);}return null;})[_0x93ee('0x32')](function(_0x29abab){var _0x5f589e=_0x93ee('0x7a')+_0x29abab[_0x93ee('0x24')][_0x93ee('0x61')];return db[_0x93ee('0x62')][_0x93ee('0x3b')](_0x5f589e,{'type':db[_0x93ee('0x63')]['QueryTypes'][_0x93ee('0x65')],'raw':!![]})['then'](function(_0x5e7b8c){return _0x5e7b8c;});})[_0x93ee('0x32')](function(_0x1ba6c4){if(_0x1ba6c4){_0xe1c6bc[_0x93ee('0x24')][_0x93ee('0x66')]=_0x1ba6c4[0x0];if(!_0x3f00f5[_0x93ee('0x51')][_0x93ee('0x58')])return;return db[_0x93ee('0x67')][_0x93ee('0x52')]({'where':{'id':_0x3f00f5[_0x93ee('0x51')][_0x93ee('0x58')],'role':_0x93ee('0x68')},'attributes':['id',_0x93ee('0x34'),_0x93ee('0x69'),_0x93ee('0x7b'),_0x93ee('0x6a')],'raw':!![]});}return null;})[_0x93ee('0x32')](function(_0x331a7e){if(!_0x331a7e)return null;_0xe1c6bc['message']['agent']=_0x331a7e;return _0xe1c6bc;})[_0x93ee('0x32')](function(_0x92cfcf){if(_0x92cfcf){_0x92cfcf['message'][_0x93ee('0x6c')]=util[_0x93ee('0x5a')](_0x93ee('0x6d'),_0x3f00f5[_0x93ee('0x5e')][_0x93ee('0x34')]);_0x92cfcf[_0x93ee('0x24')]['channel']=_0xe1c6bc[_0x93ee('0x6e')];_0x92cfcf[_0x93ee('0x24')][_0x93ee('0x6f')]=_0xe1c6bc[_0x93ee('0x6e')];_0x92cfcf[_0x93ee('0x24')][_0x93ee('0x70')]=_0x93ee('0x30');respondWithRpcPromise(_0x93ee('0x71'),_0x93ee('0x71'),{'event':_0x93ee('0x7c'),'message':_0x92cfcf[_0x93ee('0x24')]},client9002);return _0xe1c6bc;}return null;})[_0x93ee('0x32')](respondWithResult(_0x23a7ad,null))[_0x93ee('0x26')](handleError(_0x23a7ad,null));};exports['create']=function(_0x505409,_0xb7cc72){var _0x592c14;return db['FaxMessage'][_0x93ee('0x7d')](_0x505409[_0x93ee('0x51')],{})[_0x93ee('0x32')](function(_0x199f25){_0x592c14=_0x199f25;return db[_0x93ee('0x7e')]['findOne']({'where':{'id':_0x592c14[_0x93ee('0x61')]}});})[_0x93ee('0x32')](function(_0x806e69){if(_[_0x93ee('0x7f')](_0x806e69)){return;}else{_0x592c14['fax']=_0x806e69[_0x93ee('0x74')];return db[_0x93ee('0x80')][_0x93ee('0x81')]({'where':{'id':_0x592c14['AttachmentId']}});}})[_0x93ee('0x32')](function(_0x49991f){return respondWithRpcPromise(_0x93ee('0x82'),'SendFax',{'FaxAccountId':_[_0x93ee('0x7f')](_0x505409[_0x93ee('0x51')])?undefined:_0x505409[_0x93ee('0x51')][_0x93ee('0x83')],'path':_['isNil'](_0x49991f)?undefined:util['format'](_0x93ee('0x84'),_0x49991f[_0x93ee('0x85')]),'fax':_[_0x93ee('0x7f')](_0x592c14['fax'])?undefined:_0x592c14['fax'],'AttachmentId':_0x592c14[_0x93ee('0x86')]},client9002);})['then'](respondWithResult(_0xb7cc72,0xc9))[_0x93ee('0x26')](handleError(_0xb7cc72,null));};exports[_0x93ee('0x87')]=function(_0x165a84,_0x4535ea){var _0x5f4cc6=path[_0x93ee('0x88')](config['root'],_0x93ee('0x89'),'files',_0x93ee('0x8a'));return db['FaxMessage'][_0x93ee('0x52')]({'where':{'id':_0x165a84[_0x93ee('0x4b')]['id']},'include':[{'model':db[_0x93ee('0x80')],'as':'Attachment'}]})[_0x93ee('0x32')](handleEntityNotFound(_0x4535ea,null))[_0x93ee('0x32')](function(_0x5a31ff){if(_0x5a31ff){return _0x4535ea[_0x93ee('0x87')](path[_0x93ee('0x88')](_0x5f4cc6,_0x5a31ff[_0x93ee('0x80')][_0x93ee('0x85')]));}})[_0x93ee('0x26')](handleError(_0x4535ea,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6c25afd..b124933 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 _0x62f1=['remove','emit','hasOwnProperty','hook','events','FaxMessage','setMaxListeners','save','update'];(function(_0x490f1a,_0x4a69ad){var _0x388e32=function(_0x18f37a){while(--_0x18f37a){_0x490f1a['push'](_0x490f1a['shift']());}};_0x388e32(++_0x4a69ad);}(_0x62f1,0x112));var _0x162f=function(_0x4f3555,_0x40a06f){_0x4f3555=_0x4f3555-0x0;var _0x1c2142=_0x62f1[_0x4f3555];return _0x1c2142;};'use strict';var EventEmitter=require(_0x162f('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x162f('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x162f('0x2')](0x0);var events={'afterCreate':_0x162f('0x3'),'afterUpdate':_0x162f('0x4'),'afterDestroy':_0x162f('0x5')};function emitEvent(_0x364694){return function(_0x36ed0f,_0x223f35,_0xfc0863){FaxMessageEvents[_0x162f('0x6')](_0x364694+':'+_0x36ed0f['id'],_0x36ed0f);FaxMessageEvents['emit'](_0x364694,_0x36ed0f);_0xfc0863(null);};}for(var e in events){if(events[_0x162f('0x7')](e)){var event=events[e];FaxMessage[_0x162f('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xd4ad=['hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove','emit'];(function(_0x1fbf44,_0x17d120){var _0x3bc0c3=function(_0x15d0d8){while(--_0x15d0d8){_0x1fbf44['push'](_0x1fbf44['shift']());}};_0x3bc0c3(++_0x17d120);}(_0xd4ad,0x158));var _0xdd4a=function(_0xbdd306,_0x2731ef){_0xbdd306=_0xbdd306-0x0;var _0x19cbe0=_0xd4ad[_0xbdd306];return _0x19cbe0;};'use strict';var EventEmitter=require(_0xdd4a('0x0'));var FaxMessage=require(_0xdd4a('0x1'))['db'][_0xdd4a('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xdd4a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd4a('0x4'),'afterDestroy':_0xdd4a('0x5')};function emitEvent(_0x5911e5){return function(_0x587cf8,_0x13851c,_0x4775aa){FaxMessageEvents['emit'](_0x5911e5+':'+_0x587cf8['id'],_0x587cf8);FaxMessageEvents[_0xdd4a('0x6')](_0x5911e5,_0x587cf8);_0x4775aa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xdd4a('0x7')](e,emitEvent(event));}}module[_0xdd4a('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 06147da..c350432 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 _0x1619=['path','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2991a3,_0x226957){var _0x424f2a=function(_0x34973f){while(--_0x34973f){_0x2991a3['push'](_0x2991a3['shift']());}};_0x424f2a(++_0x226957);}(_0x1619,0xe2));var _0x9161=function(_0x4bf990,_0x1097a8){_0x4bf990=_0x4bf990-0x0;var _0x577888=_0x1619[_0x4bf990];return _0x577888;};'use strict';var _=require(_0x9161('0x0'));var util=require(_0x9161('0x1'));var logger=require(_0x9161('0x2'))('api');var moment=require(_0x9161('0x3'));var BPromise=require(_0x9161('0x4'));var rp=require(_0x9161('0x5'));var fs=require('fs');var path=require(_0x9161('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x9161('0x7')]=function(_0x1c4271,_0x39134b){return _0x1c4271[_0x9161('0x8')](_0x9161('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x9161('0xa'),'fields':[_0x9161('0xb')],'type':_0x9161('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54b64d,_0xbf14be,_0x38698f){var _0xfa4760=_0x1c4271['models'];var _0x4cf6f7=_0x54b64d[_0x9161('0xd')]({'plain':!![]});if(_0x4cf6f7[_0x9161('0xe')][_0x9161('0xf')]()==='in'||_0x4cf6f7[_0x9161('0xe')]['toLowerCase']()===_0x9161('0x10')&&!_0x4cf6f7[_0x9161('0x11')]&&!_[_0x9161('0x12')](_0x4cf6f7[_0x9161('0x13')])){_0xfa4760[_0x9161('0x14')]['findOne']({'where':{'id':_0x4cf6f7[_0x9161('0x15')]}})[_0x9161('0x16')](function(_0x47f9f7){if(_0x47f9f7){_0x47f9f7[_0x9161('0x17')]({'lastMsgAt':_0x4cf6f7[_0x9161('0x18')],'lastMsgDirection':_0x4cf6f7[_0x9161('0xe')][_0x9161('0xf')]()});}})[_0x9161('0x19')](function(_0x139de5){console[_0x9161('0x1a')](_0x139de5);});}_0x38698f();}},'charset':_0x9161('0x1b'),'collate':_0x9161('0x1c')});}; \ No newline at end of file +var _0x6660=['util','api','bluebird','path','rimraf','exports','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','error','utf8mb4','lodash'];(function(_0x58769c,_0x4867e4){var _0x55e63e=function(_0x349df7){while(--_0x349df7){_0x58769c['push'](_0x58769c['shift']());}};_0x55e63e(++_0x4867e4);}(_0x6660,0x1f3));var _0x0666=function(_0x46c752,_0x120bb4){_0x46c752=_0x46c752-0x0;var _0xd4a4fd=_0x6660[_0x46c752];return _0xd4a4fd;};'use strict';var _=require(_0x0666('0x0'));var util=require(_0x0666('0x1'));var logger=require('../../config/logger')(_0x0666('0x2'));var moment=require('moment');var BPromise=require(_0x0666('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0666('0x4'));var rimraf=require(_0x0666('0x5'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x0666('0x6')]=function(_0x1f6f47,_0x3b910f){return _0x1f6f47[_0x0666('0x7')](_0x0666('0x8'),attributes,{'tableName':_0x0666('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x0666('0xa')],'type':_0x0666('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4323bc,_0x24a7ab,_0x444acf){var _0x5d374a=_0x1f6f47['models'];var _0x1a5112=_0x4323bc[_0x0666('0xc')]({'plain':!![]});if(_0x1a5112[_0x0666('0xd')][_0x0666('0xe')]()==='in'||_0x1a5112['direction'][_0x0666('0xe')]()==='out'&&!_0x1a5112[_0x0666('0xf')]&&!_[_0x0666('0x10')](_0x1a5112[_0x0666('0x11')])){_0x5d374a[_0x0666('0x12')]['findOne']({'where':{'id':_0x1a5112[_0x0666('0x13')]}})[_0x0666('0x14')](function(_0x27ab73){if(_0x27ab73){_0x27ab73[_0x0666('0x15')]({'lastMsgAt':_0x1a5112[_0x0666('0x16')],'lastMsgDirection':_0x1a5112[_0x0666('0xd')][_0x0666('0xe')]()});}})['catch'](function(_0x582753){console[_0x0666('0x17')](_0x582753);});}_0x444acf();}},'charset':_0x0666('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 7ecbe15..cbd6fa0 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 _0x70e0=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','stringify','catch','update','raw','where','limit','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x4cb91b,_0x2d024c){var _0x668fb2=function(_0xf5e1e2){while(--_0xf5e1e2){_0x4cb91b['push'](_0x4cb91b['shift']());}};_0x668fb2(++_0x2d024c);}(_0x70e0,0x17b));var _0x070e=function(_0x320a4e,_0x68d610){_0x320a4e=_0x320a4e-0x0;var _0x3f2a82=_0x70e0[_0x320a4e];return _0x3f2a82;};'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});config['redis']=_['defaults'](config[_0x070e('0x9')],{'host':_0x070e('0xa'),'port':0x18eb});var socket=require(_0x070e('0xb'))(new Redis(config[_0x070e('0x9')]));require(_0x070e('0xc'))[_0x070e('0xd')](socket);function respondWithRpcPromise(_0x11ffa8,_0x4e99e6,_0x49b2fb){return new BPromise(function(_0x50f4eb,_0x2e3e5e){return client[_0x070e('0xe')](_0x11ffa8,_0x49b2fb)[_0x070e('0xf')](function(_0xa927a2){logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));logger[_0x070e('0x13')](_0x070e('0x14'),_0x4e99e6,_0x070e('0x12'),JSON['stringify'](_0xa927a2));if(_0xa927a2['error']){if(_0xa927a2[_0x070e('0x15')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x2e3e5e(_0xa927a2['error']['message']);}logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x50f4eb(_0xa927a2['error']['message']);}else{logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));_0x50f4eb(_0xa927a2[_0x070e('0x17')][_0x070e('0x16')]);}})['catch'](function(_0x3938b5){logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0x3938b5);_0x2e3e5e(_0x3938b5);});});}exports[_0x070e('0x18')]=function(_0x259893){var _0x5c16fd=this;return new Promise(function(_0x5b2f48,_0x4e958f){return db[_0x070e('0x19')][_0x070e('0x1a')](_0x259893[_0x070e('0x1b')],{'raw':_0x259893['options']?_0x259893[_0x070e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x070e('0xf')](function(_0x3f6985){logger[_0x070e('0x10')](_0x070e('0x18'),_0x259893);logger[_0x070e('0x13')](_0x070e('0x18'),_0x259893,JSON[_0x070e('0x1d')](_0x3f6985));_0x5b2f48(_0x3f6985);})[_0x070e('0x1e')](function(_0x595c7e){logger[_0x070e('0x15')](_0x070e('0x18'),_0x595c7e[_0x070e('0x16')],_0x259893);_0x4e958f(_0x5c16fd['error'](0x1f4,_0x595c7e[_0x070e('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x4a2dbd){var _0x2ccbd7=this;return new Promise(function(_0x25f6e,_0x41deb1){return db[_0x070e('0x19')][_0x070e('0x1f')](_0x4a2dbd['body'],{'raw':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x21')]||null:null,'attributes':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')]['attributes']||null:null,'limit':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x22')]||null:null})['then'](function(_0x5c5f0d){logger[_0x070e('0x10')](_0x070e('0x23'),_0x4a2dbd);logger[_0x070e('0x13')]('UpdateFaxMessage',_0x4a2dbd,JSON[_0x070e('0x1d')](_0x5c5f0d));_0x25f6e(_0x5c5f0d);})[_0x070e('0x1e')](function(_0x3a9425){logger[_0x070e('0x15')]('UpdateFaxMessage',_0x3a9425['message'],_0x4a2dbd);_0x41deb1(_0x2ccbd7['error'](0x1f4,_0x3a9425['message']));});});}; \ No newline at end of file +var _0xa8a8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa8a8,0xec));var _0x8a8a=function(_0x5ee92f,_0x590b3b){_0x5ee92f=_0x5ee92f-0x0;var _0x302341=_0xa8a8[_0x5ee92f];return _0x302341;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});config[_0x8a8a('0xd')]=_[_0x8a8a('0xe')](config[_0x8a8a('0xd')],{'host':_0x8a8a('0xf'),'port':0x18eb});var socket=require(_0x8a8a('0x10'))(new Redis(config[_0x8a8a('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3c01cd,_0x497b8a,_0x11788d){return new BPromise(function(_0x3d3a00,_0x532621){return client[_0x8a8a('0x11')](_0x3c01cd,_0x11788d)[_0x8a8a('0x12')](function(_0xb13fca){logger['info'](_0x8a8a('0x13'),_0x497b8a,_0x8a8a('0x14'));logger[_0x8a8a('0x15')](_0x8a8a('0x16'),_0x497b8a,'request\x20sent',JSON[_0x8a8a('0x17')](_0xb13fca));if(_0xb13fca['error']){if(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x19')]===0x1f4){logger[_0x8a8a('0x18')](_0x8a8a('0x13'),_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x532621(_0xb13fca[_0x8a8a('0x18')]['message']);}logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x3d3a00(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);}else{logger[_0x8a8a('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x8a8a('0x14'));_0x3d3a00(_0xb13fca[_0x8a8a('0x1c')][_0x8a8a('0x1a')]);}})[_0x8a8a('0x1d')](function(_0x299827){logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x299827);_0x532621(_0x299827);});});}exports['CreateFaxMessage']=function(_0x5181b2){var _0x4e3d0a=this;return new Promise(function(_0x4a6601,_0x3a9b2f){return db[_0x8a8a('0x1e')][_0x8a8a('0x1f')](_0x5181b2[_0x8a8a('0x20')],{'raw':_0x5181b2[_0x8a8a('0x21')]?_0x5181b2[_0x8a8a('0x21')][_0x8a8a('0x22')]===undefined?!![]:![]:!![]})[_0x8a8a('0x12')](function(_0x25d5d4){logger[_0x8a8a('0x1b')](_0x8a8a('0x23'),_0x5181b2);logger[_0x8a8a('0x15')](_0x8a8a('0x23'),_0x5181b2,JSON[_0x8a8a('0x17')](_0x25d5d4));_0x4a6601(_0x25d5d4);})[_0x8a8a('0x1d')](function(_0x545a38){logger[_0x8a8a('0x18')](_0x8a8a('0x23'),_0x545a38[_0x8a8a('0x1a')],_0x5181b2);_0x3a9b2f(_0x4e3d0a[_0x8a8a('0x18')](0x1f4,_0x545a38[_0x8a8a('0x1a')]));});});};exports[_0x8a8a('0x24')]=function(_0x3aa46d){var _0x5f4dcc=this;return new Promise(function(_0x31d21a,_0x38c1e0){return db[_0x8a8a('0x1e')]['update'](_0x3aa46d['body'],{'raw':_0x3aa46d[_0x8a8a('0x21')]?_0x3aa46d[_0x8a8a('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa46d['options']?_0x3aa46d['options'][_0x8a8a('0x25')]||null:null,'attributes':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x26')]||null:null,'limit':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x27')]||null:null})[_0x8a8a('0x12')](function(_0x8df0cb){logger[_0x8a8a('0x1b')](_0x8a8a('0x24'),_0x3aa46d);logger[_0x8a8a('0x15')](_0x8a8a('0x24'),_0x3aa46d,JSON['stringify'](_0x8df0cb));_0x31d21a(_0x8df0cb);})['catch'](function(_0x56e79e){logger[_0x8a8a('0x18')](_0x8a8a('0x24'),_0x56e79e['message'],_0x3aa46d);_0x38c1e0(_0x5f4dcc[_0x8a8a('0x18')](0x1f4,_0x56e79e[_0x8a8a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b2c22e3..6b38dfc 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 _0x47c9=['removeListener','register','length','save','update','emit'];(function(_0x300915,_0x320ae4){var _0x5887ed=function(_0x211c35){while(--_0x211c35){_0x300915['push'](_0x300915['shift']());}};_0x5887ed(++_0x320ae4);}(_0x47c9,0x12f));var _0x947c=function(_0xcb304c,_0x4bf637){_0xcb304c=_0xcb304c-0x0;var _0x5c0aa4=_0x47c9[_0xcb304c];return _0x5c0aa4;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x947c('0x0'),'remove',_0x947c('0x1')];function createListener(_0x202df0,_0x4faa23){return function(_0x50f089){_0x4faa23[_0x947c('0x2')](_0x202df0,_0x50f089);};}function removeListener(_0x54ab2e,_0x3dfc9d){return function(){FaxMessageEvents[_0x947c('0x3')](_0x54ab2e,_0x3dfc9d);};}exports[_0x947c('0x4')]=function(_0x4723c4){for(var _0x4ae33c=0x0,_0x4be8eb=events[_0x947c('0x5')];_0x4ae33c<_0x4be8eb;_0x4ae33c++){var _0x2c7c4c=events[_0x4ae33c];var _0x18501a=createListener('faxMessage:'+_0x2c7c4c,_0x4723c4);FaxMessageEvents['on'](_0x2c7c4c,_0x18501a);}}; \ No newline at end of file +var _0x29aa=['length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener','register'];(function(_0xd9635d,_0x54fb74){var _0x16823c=function(_0x4ef211){while(--_0x4ef211){_0xd9635d['push'](_0xd9635d['shift']());}};_0x16823c(++_0x54fb74);}(_0x29aa,0x1ca));var _0xa29a=function(_0x23507c,_0xe7e887){_0x23507c=_0x23507c-0x0;var _0x153748=_0x29aa[_0x23507c];return _0x153748;};'use strict';var FaxMessageEvents=require(_0xa29a('0x0'));var events=[_0xa29a('0x1'),_0xa29a('0x2'),'update'];function createListener(_0x513768,_0x3728cd){return function(_0x215986){_0x3728cd[_0xa29a('0x3')](_0x513768,_0x215986);};}function removeListener(_0x1be028,_0x2a80c7){return function(){FaxMessageEvents[_0xa29a('0x4')](_0x1be028,_0x2a80c7);};}exports[_0xa29a('0x5')]=function(_0x27542f){for(var _0x4e8dcf=0x0,_0x2ca28f=events[_0xa29a('0x6')];_0x4e8dcf<_0x2ca28f;_0x4e8dcf++){var _0x1a0b3a=events[_0x4e8dcf];var _0x1f8d36=createListener(_0xa29a('0x7')+_0x1a0b3a,_0x27542f);FaxMessageEvents['on'](_0x1a0b3a,_0x1f8d36);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c7044a6..3772db4 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 _0x1be1=['create','put','update','/:id/accept','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','faxmessage:create'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0x1be1,0x192));var _0x11be=function(_0x5a06f7,_0x13aa2b){_0x5a06f7=_0x5a06f7-0x0;var _0x39d952=_0x1be1[_0x5a06f7];return _0x39d952;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),interaction[_0x11be('0xe')]('fax',_0x11be('0xf')),controller[_0x11be('0x10')]);router[_0x11be('0x11')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x12')]);router['put'](_0x11be('0x13'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete'](_0x11be('0xa'),auth['isAuthenticated'](),controller[_0x11be('0x14')]);module[_0x11be('0x15')]=router; \ No newline at end of file +var _0x668b=['create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x668b,0x140));var _0xb668=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x668b[_0x503cd5];return _0x1fdf1e;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['get'](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0xe')]);router[_0xb668('0xa')](_0xb668('0xf'),auth[_0xb668('0x8')](),controller[_0xb668('0x10')]);router[_0xb668('0x11')]('/',auth['isAuthenticated'](),interaction[_0xb668('0x12')](_0xb668('0x13'),_0xb668('0x14')),controller[_0xb668('0x15')]);router[_0xb668('0x16')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x17')]);router[_0xb668('0x16')](_0xb668('0x18'),auth[_0xb668('0x8')](),controller[_0xb668('0x19')]);router[_0xb668('0x16')](_0xb668('0x1a'),auth[_0xb668('0x8')](),controller[_0xb668('0x1b')]);router[_0xb668('0x1c')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x1d')]);module[_0xb668('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index be9fc94..0ce16e7 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 _0x508b=['name','ENUM','beepall','roundrobin','INTEGER','exports'];(function(_0xfbf457,_0x23a8e7){var _0x53cddd=function(_0x1c872e){while(--_0x1c872e){_0xfbf457['push'](_0xfbf457['shift']());}};_0x53cddd(++_0x23a8e7);}(_0x508b,0x1c1));var _0xb508=function(_0x2b8d9e,_0x38f52a){_0x2b8d9e=_0x2b8d9e-0x0;var _0x380e14=_0x508b[_0x2b8d9e];return _0x380e14;};'use strict';var Sequelize=require('sequelize');module[_0xb508('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb508('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb508('0x2')]('rrmemory',_0xb508('0x3'),_0xb508('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb508('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xff39=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x412538,_0x29022f){var _0x1ed595=function(_0x5bb861){while(--_0x5bb861){_0x412538['push'](_0x412538['shift']());}};_0x1ed595(++_0x29022f);}(_0xff39,0x173));var _0x9ff3=function(_0x44f91e,_0x47e2eb){_0x44f91e=_0x44f91e-0x0;var _0x33a0bd=_0xff39[_0x44f91e];return _0x33a0bd;};'use strict';var Sequelize=require(_0x9ff3('0x0'));module[_0x9ff3('0x1')]={'name':{'type':Sequelize[_0x9ff3('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9ff3('0x2')]},'timeout':{'type':Sequelize[_0x9ff3('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9ff3('0x4')](_0x9ff3('0x5'),_0x9ff3('0x6'),_0x9ff3('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9ff3('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index cc03be5..add1a4a 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 _0x6217=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueue','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','order','FaxQueueId','UserFaxQueue','agent','faxPause','updatedAt','format','%s/%s','SIP','getTeams','addTeams','User','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','userFaxQueue:save','removeTeams','Team','ids','tq.TeamId','from','join','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','sendStatus','name','send','index','rawAttributes','type','key','model','map'];(function(_0x78f051,_0x2fcac1){var _0x10a8f9=function(_0x4ed88f){while(--_0x4ed88f){_0x78f051['push'](_0x78f051['shift']());}};_0x10a8f9(++_0x2fcac1);}(_0x6217,0xe3));var _0x7621=function(_0x2731f0,_0x126b1b){_0x2731f0=_0x2731f0-0x0;var _0x36a180=_0x6217[_0x2731f0];return _0x36a180;};'use strict';var emlformat=require(_0x7621('0x0'));var rimraf=require(_0x7621('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7621('0x2'));var rp=require(_0x7621('0x3'));var moment=require(_0x7621('0x4'));var BPromise=require(_0x7621('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7621('0x6'));var ejs=require(_0x7621('0x7'));var fs=require('fs');var fs_extra=require(_0x7621('0x8'));var _=require(_0x7621('0x9'));var squel=require(_0x7621('0xa'));var crypto=require(_0x7621('0xb'));var jsforce=require(_0x7621('0xc'));var deskjs=require(_0x7621('0xd'));var toCsv=require(_0x7621('0x6'));var querystring=require(_0x7621('0xe'));var Papa=require(_0x7621('0xf'));var Redis=require(_0x7621('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7621('0x11'));var as=require(_0x7621('0x12'));var hardwareService=require(_0x7621('0x13'));var logger=require('../../config/logger')(_0x7621('0x14'));var utils=require(_0x7621('0x15'));var config=require(_0x7621('0x16'));var licenseUtil=require(_0x7621('0x17'));var db=require(_0x7621('0x18'))['db'];config[_0x7621('0x19')]=_[_0x7621('0x1a')](config[_0x7621('0x19')],{'host':_0x7621('0x1b'),'port':0x18eb});var socket=require(_0x7621('0x1c'))(new Redis(config['redis']));require(_0x7621('0x1d'))[_0x7621('0x1e')](socket);function respondWithStatusCode(_0x27209e,_0x4bbe90){_0x4bbe90=_0x4bbe90||0xcc;return function(_0x4f372e){if(_0x4f372e){return _0x27209e['sendStatus'](_0x4bbe90);}return _0x27209e['status'](_0x4bbe90)['end']();};}function respondWithResult(_0x2f7cfc,_0x373499){_0x373499=_0x373499||0xc8;return function(_0x5229cc){if(_0x5229cc){return _0x2f7cfc[_0x7621('0x1f')](_0x373499)[_0x7621('0x20')](_0x5229cc);}};}function respondWithFilteredResult(_0x16fe59,_0x41ac76){return function(_0x2b8052){if(_0x2b8052){var _0x46fd89=typeof _0x41ac76[_0x7621('0x21')]===_0x7621('0x22')&&typeof _0x41ac76[_0x7621('0x23')]==='undefined';var _0x4f0291=_0x2b8052['count'];var _0x5d21dc=_0x46fd89?0x0:_0x41ac76[_0x7621('0x21')];var _0xfe64fd=_0x46fd89?_0x2b8052[_0x7621('0x24')]:_0x41ac76[_0x7621('0x21')]+_0x41ac76['limit'];var _0x49be3d;if(_0xfe64fd>=_0x4f0291){_0xfe64fd=_0x4f0291;_0x49be3d=0xc8;}else{_0x49be3d=0xce;}_0x16fe59[_0x7621('0x1f')](_0x49be3d);return _0x16fe59[_0x7621('0x25')](_0x7621('0x26'),_0x5d21dc+'-'+_0xfe64fd+'/'+_0x4f0291)[_0x7621('0x20')](_0x2b8052);}return null;};}function patchUpdates(_0x30db7f){return function(_0x1aedbb){try{jsonpatch[_0x7621('0x27')](_0x1aedbb,_0x30db7f,!![]);}catch(_0x1cf681){return BPromise[_0x7621('0x28')](_0x1cf681);}return _0x1aedbb['save']();};}function saveUpdates(_0x146f3c,_0x2f6fb4){return function(_0x3df884){if(_0x3df884){return _0x3df884[_0x7621('0x29')](_0x146f3c)['then'](function(_0x18c149){return _0x18c149;});}return null;};}function removeEntity(_0x8c3c96,_0x2a81b6){return function(_0x378a8c){if(_0x378a8c){return _0x378a8c[_0x7621('0x2a')]()[_0x7621('0x2b')](function(){var _0x215f24=_0x378a8c[_0x7621('0x2c')]({'plain':!![]});var _0x1a972e='FaxQueues';return db[_0x7621('0x2d')][_0x7621('0x2a')]({'where':{'type':_0x1a972e,'resourceId':_0x215f24['id']}})[_0x7621('0x2b')](function(){return _0x378a8c;});})[_0x7621('0x2b')](function(){_0x8c3c96[_0x7621('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34f581,_0x28c5b4){return function(_0x40de49){if(!_0x40de49){_0x34f581[_0x7621('0x2e')](0x194);}return _0x40de49;};}function handleError(_0x59ab16,_0xb68667){_0xb68667=_0xb68667||0x1f4;return function(_0x377075){logger['error'](_0x377075['stack']);if(_0x377075[_0x7621('0x2f')]){delete _0x377075[_0x7621('0x2f')];}_0x59ab16['status'](_0xb68667)[_0x7621('0x30')](_0x377075);};}exports[_0x7621('0x31')]=function(_0x24f042,_0x155f9d){var _0x532d90={},_0x40b78b={},_0x406f16={'count':0x0,'rows':[]};var _0x38ce8f=_['map'](db['FaxQueue'][_0x7621('0x32')],function(_0x131bf3){return{'name':_0x131bf3['fieldName'],'type':_0x131bf3[_0x7621('0x33')][_0x7621('0x34')]};});_0x40b78b[_0x7621('0x35')]=_[_0x7621('0x36')](_0x38ce8f,_0x7621('0x2f'));_0x40b78b[_0x7621('0x37')]=_[_0x7621('0x38')](_0x24f042['query']);_0x40b78b[_0x7621('0x39')]=_[_0x7621('0x3a')](_0x40b78b[_0x7621('0x35')],_0x40b78b[_0x7621('0x37')]);_0x532d90['attributes']=_[_0x7621('0x3a')](_0x40b78b[_0x7621('0x35')],qs[_0x7621('0x3b')](_0x24f042[_0x7621('0x37')]['fields']));_0x532d90[_0x7621('0x3c')]=_0x532d90[_0x7621('0x3c')][_0x7621('0x3d')]?_0x532d90[_0x7621('0x3c')]:_0x40b78b[_0x7621('0x35')];if(!_0x24f042['query'][_0x7621('0x3e')](_0x7621('0x3f'))){_0x532d90['limit']=qs[_0x7621('0x23')](_0x24f042[_0x7621('0x37')][_0x7621('0x23')]);_0x532d90[_0x7621('0x21')]=qs[_0x7621('0x21')](_0x24f042[_0x7621('0x37')][_0x7621('0x21')]);}_0x532d90['order']=qs[_0x7621('0x40')](_0x24f042[_0x7621('0x37')]['sort']);_0x532d90[_0x7621('0x41')]=qs[_0x7621('0x39')](_[_0x7621('0x42')](_0x24f042[_0x7621('0x37')],_0x40b78b['filters']),_0x38ce8f);if(_0x24f042['query'][_0x7621('0x43')]){_0x532d90[_0x7621('0x41')]=_[_0x7621('0x44')](_0x532d90[_0x7621('0x41')],{'$or':_[_0x7621('0x36')](_0x38ce8f,function(_0x50a9e9){if(_0x50a9e9[_0x7621('0x33')]!==_0x7621('0x45')){var _0x16bee2={};_0x16bee2[_0x50a9e9['name']]={'$like':'%'+_0x24f042[_0x7621('0x37')]['filter']+'%'};return _0x16bee2;}})});}_0x532d90=_['merge']({},_0x532d90,_0x24f042[_0x7621('0x46')]);var _0x4fbaac={'where':_0x532d90[_0x7621('0x41')]};return db[_0x7621('0x47')][_0x7621('0x24')](_0x4fbaac)[_0x7621('0x2b')](function(_0x5d055a){_0x406f16[_0x7621('0x24')]=_0x5d055a;if(_0x24f042[_0x7621('0x37')][_0x7621('0x48')]){_0x532d90[_0x7621('0x49')]=[{'all':!![]}];}return db[_0x7621('0x47')][_0x7621('0x4a')](_0x532d90);})[_0x7621('0x2b')](function(_0x1b3dc4){_0x406f16[_0x7621('0x4b')]=_0x1b3dc4;return _0x406f16;})[_0x7621('0x2b')](respondWithFilteredResult(_0x155f9d,_0x532d90))[_0x7621('0x4c')](handleError(_0x155f9d,null));};exports['show']=function(_0x2bbdfa,_0x509793){var _0x2ca396={'raw':!![],'where':{'id':_0x2bbdfa[_0x7621('0x4d')]['id']}},_0x365d47={};_0x365d47[_0x7621('0x35')]=_[_0x7621('0x38')](db[_0x7621('0x47')]['rawAttributes']);_0x365d47['query']=_[_0x7621('0x38')](_0x2bbdfa[_0x7621('0x37')]);_0x365d47[_0x7621('0x39')]=_['intersection'](_0x365d47[_0x7621('0x35')],_0x365d47[_0x7621('0x37')]);_0x2ca396[_0x7621('0x3c')]=_[_0x7621('0x3a')](_0x365d47['model'],qs['fields'](_0x2bbdfa[_0x7621('0x37')]['fields']));_0x2ca396[_0x7621('0x3c')]=_0x2ca396[_0x7621('0x3c')][_0x7621('0x3d')]?_0x2ca396['attributes']:_0x365d47['model'];if(_0x2bbdfa[_0x7621('0x37')][_0x7621('0x48')]){_0x2ca396[_0x7621('0x49')]=[{'all':!![]}];}_0x2ca396=_[_0x7621('0x44')]({},_0x2ca396,_0x2bbdfa[_0x7621('0x46')]);return db['FaxQueue'][_0x7621('0x4e')](_0x2ca396)['then'](handleEntityNotFound(_0x509793,null))['then'](respondWithResult(_0x509793,null))['catch'](handleError(_0x509793,null));};exports[_0x7621('0x4f')]=function(_0x3a6768,_0x5bff0b){return db[_0x7621('0x47')][_0x7621('0x4f')](_0x3a6768[_0x7621('0x50')],{})['then'](function(_0x41474e){var _0x1a96aa=_0x3a6768[_0x7621('0x51')][_0x7621('0x2c')]({'plain':!![]});if(!_0x1a96aa)throw new Error(_0x7621('0x52'));if(_0x1a96aa[_0x7621('0x53')]===_0x7621('0x51')){var _0xb3fcce=_0x41474e[_0x7621('0x2c')]({'plain':!![]});var _0x1aa400=_0x7621('0x54');return db[_0x7621('0x55')]['find']({'where':{'name':_0x1aa400,'userProfileId':_0x1a96aa[_0x7621('0x56')]},'raw':!![]})[_0x7621('0x2b')](function(_0x5a47c7){if(_0x5a47c7&&_0x5a47c7[_0x7621('0x57')]===0x0){return db[_0x7621('0x2d')]['create']({'name':_0xb3fcce[_0x7621('0x2f')],'resourceId':_0xb3fcce['id'],'type':_0x5a47c7[_0x7621('0x2f')],'sectionId':_0x5a47c7['id']},{})[_0x7621('0x2b')](function(){return _0x41474e;});}else{return _0x41474e;}})['catch'](function(_0x1e72a8){logger[_0x7621('0x58')](_0x7621('0x59'),_0x1e72a8);throw _0x1e72a8;});}return _0x41474e;})['then'](respondWithResult(_0x5bff0b,0xc9))[_0x7621('0x4c')](handleError(_0x5bff0b,null));};exports['update']=function(_0x4dcc72,_0x240a51){if(_0x4dcc72[_0x7621('0x50')]['id']){delete _0x4dcc72[_0x7621('0x50')]['id'];}return db['FaxQueue'][_0x7621('0x4e')]({'where':{'id':_0x4dcc72[_0x7621('0x4d')]['id']}})['then'](handleEntityNotFound(_0x240a51,null))[_0x7621('0x2b')](saveUpdates(_0x4dcc72['body'],null))['then'](respondWithResult(_0x240a51,null))[_0x7621('0x4c')](handleError(_0x240a51,null));};exports[_0x7621('0x2a')]=function(_0x2f007c,_0x49f2cf){return db[_0x7621('0x47')][_0x7621('0x4e')]({'where':{'id':_0x2f007c[_0x7621('0x4d')]['id']}})[_0x7621('0x2b')](handleEntityNotFound(_0x49f2cf,null))[_0x7621('0x2b')](removeEntity(_0x49f2cf,null))[_0x7621('0x4c')](handleError(_0x49f2cf,null));};exports['describe']=function(_0x14bb3e,_0x4f010f){return db[_0x7621('0x47')]['describe']()[_0x7621('0x2b')](respondWithResult(_0x4f010f,null))[_0x7621('0x4c')](handleError(_0x4f010f,null));};exports[_0x7621('0x5a')]=function(_0x24518d,_0x3a7eef,_0x4f3087){var _0x2aa05a={'raw':!![],'where':{}},_0x2b6a6c={},_0x34a556;return db[_0x7621('0x47')][_0x7621('0x5b')]({'where':{'id':_0x24518d[_0x7621('0x4d')]['id']}})[_0x7621('0x2b')](handleEntityNotFound(_0x3a7eef,null))[_0x7621('0x2b')](function(_0x5b9b8f){if(_0x5b9b8f){_0x34a556=_0x5b9b8f[_0x7621('0x2c')]({'plain':!![]});_0x2b6a6c[_0x7621('0x35')]=_[_0x7621('0x38')](db['UserFaxQueue'][_0x7621('0x32')]);_0x2b6a6c[_0x7621('0x37')]=_[_0x7621('0x38')](_0x24518d[_0x7621('0x37')]);_0x2b6a6c[_0x7621('0x39')]=_['intersection'](_0x2b6a6c['model'],_0x2b6a6c[_0x7621('0x37')]);_0x2aa05a[_0x7621('0x3c')]=_[_0x7621('0x3a')](_0x2b6a6c[_0x7621('0x35')],qs[_0x7621('0x3b')](_0x24518d['query'][_0x7621('0x3b')]));_0x2aa05a['attributes']=_0x2aa05a['attributes'][_0x7621('0x3d')]?_0x2aa05a[_0x7621('0x3c')]:_0x2b6a6c['model'];if(!_0x24518d[_0x7621('0x37')][_0x7621('0x3e')](_0x7621('0x3f'))){_0x2aa05a[_0x7621('0x23')]=qs[_0x7621('0x23')](_0x24518d[_0x7621('0x37')][_0x7621('0x23')]);_0x2aa05a[_0x7621('0x21')]=qs[_0x7621('0x21')](_0x24518d[_0x7621('0x37')][_0x7621('0x21')]);}_0x2aa05a[_0x7621('0x5c')]=qs[_0x7621('0x40')](_0x24518d[_0x7621('0x37')][_0x7621('0x40')]);_0x2aa05a[_0x7621('0x41')]=qs[_0x7621('0x39')](_['pick'](_0x24518d['query'],_0x2b6a6c[_0x7621('0x39')]));_0x2aa05a[_0x7621('0x41')][_0x7621('0x5d')]=_0x5b9b8f['id'];if(_0x24518d['query'][_0x7621('0x43')]){_0x2aa05a[_0x7621('0x41')]=_[_0x7621('0x44')](_0x2aa05a[_0x7621('0x41')],{'$or':_[_0x7621('0x36')](_0x2aa05a[_0x7621('0x3c')],function(_0x5296b6){var _0x47f4dd={};_0x47f4dd[_0x5296b6]={'$like':'%'+_0x24518d[_0x7621('0x37')][_0x7621('0x43')]+'%'};return _0x47f4dd;})});}_0x2aa05a=_[_0x7621('0x44')]({},_0x2aa05a,_0x24518d[_0x7621('0x46')]);return db[_0x7621('0x5e')][_0x7621('0x4a')](_0x2aa05a);}})[_0x7621('0x2b')](function(_0x592919){if(_0x592919){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x592919,'UserId'),'role':_0x7621('0x5f')},'attributes':['id',_0x7621('0x2f'),_0x7621('0x60'),_0x7621('0x61'),'createdAt']});}})['then'](function(_0x5bf9c2){if(_0x5bf9c2){return{'count':_0x5bf9c2[_0x7621('0x24')],'rows':_['map'](_0x5bf9c2[_0x7621('0x4b')],function(_0x535b63){return{'membername':_0x535b63[_0x7621('0x2f')],'UserId':_0x535b63['id'],'queue_name':_0x34a556[_0x7621('0x2f')],'FaxQueueId':_0x34a556['id'],'interface':util[_0x7621('0x62')](_0x7621('0x63'),_0x7621('0x64'),_0x535b63[_0x7621('0x2f')]),'penalty':0x0,'paused':_0x535b63[_0x7621('0x60')],'createdAt':_0x535b63['createdAt'],'updatedAt':_0x535b63[_0x7621('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7621('0x2b')](respondWithFilteredResult(_0x3a7eef,_0x2aa05a))['catch'](handleError(_0x3a7eef,null));};exports['getTeams']=function(_0x416c95,_0x4e79fb,_0xd2aedc){var _0x417a43={};var _0x373449={};var _0x4c999d;var _0x459b87;return db[_0x7621('0x47')]['findOne']({'where':{'id':_0x416c95[_0x7621('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4e79fb,null))[_0x7621('0x2b')](function(_0x30a2d8){if(_0x30a2d8){_0x4c999d=_0x30a2d8;_0x373449[_0x7621('0x35')]=_['keys'](db['Team'][_0x7621('0x32')]);_0x373449[_0x7621('0x37')]=_[_0x7621('0x38')](_0x416c95[_0x7621('0x37')]);_0x373449[_0x7621('0x39')]=_[_0x7621('0x3a')](_0x373449[_0x7621('0x35')],_0x373449[_0x7621('0x37')]);_0x417a43['attributes']=_[_0x7621('0x3a')](_0x373449['model'],qs[_0x7621('0x3b')](_0x416c95[_0x7621('0x37')][_0x7621('0x3b')]));_0x417a43[_0x7621('0x3c')]=_0x417a43[_0x7621('0x3c')][_0x7621('0x3d')]?_0x417a43['attributes']:_0x373449[_0x7621('0x35')];_0x417a43['order']=qs[_0x7621('0x40')](_0x416c95[_0x7621('0x37')][_0x7621('0x40')]);_0x417a43[_0x7621('0x41')]=qs[_0x7621('0x39')](_[_0x7621('0x42')](_0x416c95['query'],_0x373449[_0x7621('0x39')]));if(_0x416c95[_0x7621('0x37')][_0x7621('0x43')]){_0x417a43[_0x7621('0x41')]=_[_0x7621('0x44')](_0x417a43[_0x7621('0x41')],{'$or':_[_0x7621('0x36')](_0x417a43[_0x7621('0x3c')],function(_0x593297){var _0x125fcd={};_0x125fcd[_0x593297]={'$like':'%'+_0x416c95[_0x7621('0x37')][_0x7621('0x43')]+'%'};return _0x125fcd;})});}_0x417a43=_[_0x7621('0x44')]({},_0x417a43,_0x416c95['options']);return _0x4c999d[_0x7621('0x65')](_0x417a43);}})[_0x7621('0x2b')](function(_0x2ad671){if(_0x2ad671){_0x459b87=_0x2ad671[_0x7621('0x3d')];if(!_0x416c95[_0x7621('0x37')][_0x7621('0x3e')](_0x7621('0x3f'))){_0x417a43['limit']=qs[_0x7621('0x23')](_0x416c95['query'][_0x7621('0x23')]);_0x417a43[_0x7621('0x21')]=qs[_0x7621('0x21')](_0x416c95['query']['offset']);}return _0x4c999d[_0x7621('0x65')](_0x417a43);}})[_0x7621('0x2b')](function(_0x5b1765){if(_0x5b1765){return _0x5b1765?{'count':_0x459b87,'rows':_0x5b1765}:null;}})['then'](respondWithResult(_0x4e79fb,null))[_0x7621('0x4c')](handleError(_0x4e79fb,null));};exports[_0x7621('0x66')]=function(_0x3efef6,_0x26c75e,_0x4cde77){var _0x36106e=_0x3efef6['body']['ids'];return db['Team'][_0x7621('0x4a')]({'where':{'id':_0x36106e},'attributes':['id'],'include':[{'model':db[_0x7621('0x67')],'as':_0x7621('0x68'),'attributes':['id',_0x7621('0x2f'),_0x7621('0x69'),_0x7621('0x6a'),_0x7621('0x6b')],'raw':!![]}]})['then'](function(_0x12363c){if(_0x12363c){var _0x3af63d=_['flatMap'](_0x12363c,function(_0x6a3ee4){var _0x4874d3=_0x6a3ee4['get']({'plain':!![]});return _0x4874d3[_0x7621('0x68')];});return db['FaxQueue'][_0x7621('0x4e')]({'where':{'id':_0x3efef6[_0x7621('0x4d')]['id']}})['then'](function(_0x5d0c14){return db[_0x7621('0x6c')][_0x7621('0x6d')](function(_0x50ad34){return _0x5d0c14[_0x7621('0x66')](_0x36106e,{'transaction':_0x50ad34})['then'](function(){return BPromise[_0x7621('0x6e')](_0x3af63d,function(_0x2fc465){return db[_0x7621('0x5e')]['findOrCreate']({'where':{'UserId':_0x2fc465['id'],'FaxQueueId':_0x3efef6[_0x7621('0x4d')]['id']},'transaction':_0x50ad34});});})['then'](function(){_0x3af63d[_0x7621('0x6f')](function(_0x192bfc){socket['emit'](_0x7621('0x70'),{'UserId':_0x192bfc['id'],'FaxQueueId':_0x5d0c14['id']});});});});});}})[_0x7621('0x2b')](respondWithStatusCode(_0x26c75e,null))['catch'](handleError(_0x26c75e,null));};exports[_0x7621('0x71')]=function(_0xe97af0,_0x4b90ce,_0x34783a){return db[_0x7621('0x72')]['findAll']({'where':{'id':_0xe97af0[_0x7621('0x37')][_0x7621('0x73')]},'attributes':['id'],'include':[{'model':db[_0x7621('0x67')],'as':_0x7621('0x68'),'attributes':['id'],'raw':!![]}]})[_0x7621('0x2b')](handleEntityNotFound(_0x4b90ce,null))[_0x7621('0x2b')](function(_0xb7a471){var _0x2274e2=_[_0x7621('0x36')](_0xb7a471,'id');var _0x2cd719=[];var _0x1b9083=[];var _0x3be7e9=squel['select']();_0x3be7e9['field'](_0x7621('0x74'))[_0x7621('0x75')]('team_has_fax_queues','tq')[_0x7621('0x76')](_0x7621('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7621('0x41')](_0x7621('0x78'),_0xe97af0['params']['id']);for(var _0x414982=0x0;_0x414982<_0xb7a471['length'];_0x414982+=0x1){let _0x16bc1e=_0xb7a471[_0x414982];for(var _0x1d7433=0x0;_0x1d7433<_0x16bc1e[_0x7621('0x68')][_0x7621('0x3d')];_0x1d7433+=0x1){let _0x3995b1=_0x16bc1e[_0x7621('0x68')][_0x1d7433];var _0x4c645a=_0x3be7e9['clone']();_0x4c645a[_0x7621('0x41')](_0x7621('0x79'),_0x3995b1['id']);_0x1b9083[_0x7621('0x7a')](db[_0x7621('0x6c')][_0x7621('0x37')](_0x4c645a[_0x7621('0x7b')](),{'type':db[_0x7621('0x6c')][_0x7621('0x7c')][_0x7621('0x7d')]})[_0x7621('0x2b')](function(_0x287d5b){if(_0x287d5b[_0x7621('0x3d')]===0x1){return _0x3995b1['id'];}else{var _0x35e840=_[_0x7621('0x7e')](_[_0x7621('0x36')](_0x287d5b,_0x7621('0x7f')),function(_0x2a75e2){return _['includes'](_0x2274e2,_0x2a75e2);});if(_0x35e840){return _0x3995b1['id'];}}}));}}return BPromise[_0x7621('0x80')](_0x1b9083)['then'](function(_0x4c051c){_0x2cd719=_(_0x2cd719)[_0x7621('0x81')](_0x4c051c)[_0x7621('0x82')]()[_0x7621('0x83')]();return db[_0x7621('0x47')]['find']({'where':{'id':_0xe97af0['params']['id']}})['then'](function(_0x46f471){return db['sequelize']['transaction'](function(_0x5d0db4){return _0x46f471[_0x7621('0x71')](_0xe97af0[_0x7621('0x37')][_0x7621('0x73')],{'transaction':_0x5d0db4})[_0x7621('0x2b')](function(){if(!_[_0x7621('0x84')](_0x2cd719)){return _0x46f471[_0x7621('0x85')](_0x2cd719,{'transaction':_0x5d0db4});}})[_0x7621('0x2b')](function(){_0x2cd719[_0x7621('0x6f')](function(_0x1a31dd){socket['emit'](_0x7621('0x86'),{'UserId':_0x1a31dd,'FaxQueueId':_0x46f471['id']});});});});});});})[_0x7621('0x2b')](respondWithStatusCode(_0x4b90ce,null))[_0x7621('0x4c')](handleError(_0x4b90ce,null));};exports[_0x7621('0x87')]=function(_0x44aaf8,_0x4ba430,_0x2d74ec){return db['FaxQueue'][_0x7621('0x4e')]({'where':{'id':_0x44aaf8[_0x7621('0x4d')]['id']}})[_0x7621('0x2b')](handleEntityNotFound(_0x4ba430,null))[_0x7621('0x2b')](function(_0x178f33){if(_0x178f33){return _0x178f33[_0x7621('0x87')](_0x44aaf8[_0x7621('0x50')]['ids'],_[_0x7621('0x88')](_0x44aaf8['body'],[_0x7621('0x73'),'id'])||{})[_0x7621('0x89')](function(_0x3a2bae){for(var _0x1b3258=0x0;_0x1b3258<_0x44aaf8['body']['ids'][_0x7621('0x3d')];_0x1b3258+=0x1){socket[_0x7621('0x8a')](_0x7621('0x70'),{'UserId':Number(_0x44aaf8[_0x7621('0x50')][_0x7621('0x73')][_0x1b3258]),'FaxQueueId':Number(_0x44aaf8[_0x7621('0x4d')]['id'])});}return _0x3a2bae;});}})[_0x7621('0x2b')](respondWithResult(_0x4ba430,null))[_0x7621('0x4c')](handleError(_0x4ba430,null));};exports[_0x7621('0x85')]=function(_0x189426,_0xd261fd,_0x4f4895){return db[_0x7621('0x47')][_0x7621('0x4e')]({'where':{'id':_0x189426['params']['id']}})['then'](handleEntityNotFound(_0xd261fd,null))['then'](function(_0x12396e){if(_0x12396e){return _0x12396e[_0x7621('0x85')](_0x189426[_0x7621('0x37')][_0x7621('0x73')])['then'](function(){if(_[_0x7621('0x8b')](_0x189426[_0x7621('0x37')]['ids'])){for(var _0x4059d1=0x0;_0x4059d1<_0x189426['query'][_0x7621('0x73')][_0x7621('0x3d')];_0x4059d1+=0x1){socket[_0x7621('0x8a')](_0x7621('0x86'),{'UserId':Number(_0x189426[_0x7621('0x37')]['ids'][_0x4059d1]),'FaxQueueId':Number(_0x189426[_0x7621('0x4d')]['id'])});}}else{socket[_0x7621('0x8a')](_0x7621('0x86'),{'UserId':Number(_0x189426[_0x7621('0x37')][_0x7621('0x73')]),'FaxQueueId':Number(_0x189426[_0x7621('0x4d')]['id'])});}});}})[_0x7621('0x2b')](respondWithStatusCode(_0xd261fd,null))[_0x7621('0x4c')](handleError(_0xd261fd,null));};exports['getAgents']=function(_0x18e223,_0x5d0ca2,_0x34ab2f){var _0x37c7ed={};var _0x2ddce1={};var _0x35d1e9;var _0x22424f;return db[_0x7621('0x47')][_0x7621('0x5b')]({'where':{'id':_0x18e223[_0x7621('0x4d')]['id']}})[_0x7621('0x2b')](handleEntityNotFound(_0x5d0ca2,null))[_0x7621('0x2b')](function(_0x56b53f){if(_0x56b53f){_0x35d1e9=_0x56b53f;_0x2ddce1[_0x7621('0x35')]=_[_0x7621('0x38')](db[_0x7621('0x67')][_0x7621('0x32')]);_0x2ddce1[_0x7621('0x37')]=_['keys'](_0x18e223[_0x7621('0x37')]);_0x2ddce1[_0x7621('0x39')]=_[_0x7621('0x3a')](_0x2ddce1['model'],_0x2ddce1['query']);_0x37c7ed['attributes']=_[_0x7621('0x3a')](_0x2ddce1[_0x7621('0x35')],qs['fields'](_0x18e223['query'][_0x7621('0x3b')]));_0x37c7ed['attributes']=_0x37c7ed['attributes'][_0x7621('0x3d')]?_0x37c7ed['attributes']:_0x2ddce1[_0x7621('0x35')];_0x37c7ed['order']=qs[_0x7621('0x40')](_0x18e223[_0x7621('0x37')][_0x7621('0x40')]);_0x37c7ed[_0x7621('0x41')]=qs[_0x7621('0x39')](_[_0x7621('0x42')](_0x18e223[_0x7621('0x37')],_0x2ddce1['filters']));if(_0x18e223['query']['filter']){_0x37c7ed[_0x7621('0x41')]=_['merge'](_0x37c7ed[_0x7621('0x41')],{'$or':_['map'](_0x37c7ed['attributes'],function(_0x210389){var _0x4dd8aa={};_0x4dd8aa[_0x210389]={'$like':'%'+_0x18e223[_0x7621('0x37')][_0x7621('0x43')]+'%'};return _0x4dd8aa;})});}_0x37c7ed=_['merge']({},_0x37c7ed,_0x18e223[_0x7621('0x46')]);return _0x35d1e9[_0x7621('0x8c')](_0x37c7ed);}})[_0x7621('0x2b')](function(_0x498f87){if(_0x498f87){_0x22424f=_0x498f87[_0x7621('0x3d')];if(!_0x18e223['query']['hasOwnProperty'](_0x7621('0x3f'))){_0x37c7ed['limit']=qs[_0x7621('0x23')](_0x18e223[_0x7621('0x37')][_0x7621('0x23')]);_0x37c7ed[_0x7621('0x21')]=qs[_0x7621('0x21')](_0x18e223['query'][_0x7621('0x21')]);}return _0x35d1e9['getAgents'](_0x37c7ed);}})[_0x7621('0x2b')](function(_0x330c82){if(_0x330c82){return _0x330c82?{'count':_0x22424f,'rows':_0x330c82}:null;}})[_0x7621('0x2b')](respondWithResult(_0x5d0ca2,null))[_0x7621('0x4c')](handleError(_0x5d0ca2,null));}; \ No newline at end of file +var _0x469b=['get','UserProfileResource','then','error','name','index','map','FaxQueue','rawAttributes','type','key','model','keys','intersection','query','fields','attributes','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','hasOwnProperty','pick','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','faxPause','createdAt','format','%s/%s','updatedAt','Team','getTeams','ids','Agents','online','voicePause','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x469b,0x177));var _0xb469=function(_0x412686,_0x3fde24){_0x412686=_0x412686-0x0;var _0x18619e=_0x469b[_0x412686];return _0x18619e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb469('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb469('0x1'));var moment=require(_0xb469('0x2'));var BPromise=require(_0xb469('0x3'));var Mustache=require(_0xb469('0x4'));var util=require(_0xb469('0x5'));var path=require(_0xb469('0x6'));var sox=require('sox');var csv=require(_0xb469('0x7'));var ejs=require(_0xb469('0x8'));var fs=require('fs');var fs_extra=require(_0xb469('0x9'));var _=require('lodash');var squel=require(_0xb469('0xa'));var crypto=require(_0xb469('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb469('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb469('0xd'));var authService=require(_0xb469('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb469('0xf'))('api');var utils=require(_0xb469('0x10'));var config=require(_0xb469('0x11'));var licenseUtil=require(_0xb469('0x12'));var db=require('../../mysqldb')['db'];config[_0xb469('0x13')]=_[_0xb469('0x14')](config[_0xb469('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xb469('0x15'))(new Redis(config[_0xb469('0x13')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0xf66743,_0xf46213){_0xf46213=_0xf46213||0xcc;return function(_0x3c5c7a){if(_0x3c5c7a){return _0xf66743[_0xb469('0x16')](_0xf46213);}return _0xf66743[_0xb469('0x17')](_0xf46213)[_0xb469('0x18')]();};}function respondWithResult(_0x5d2649,_0x56c271){_0x56c271=_0x56c271||0xc8;return function(_0x5b5315){if(_0x5b5315){return _0x5d2649[_0xb469('0x17')](_0x56c271)[_0xb469('0x19')](_0x5b5315);}};}function respondWithFilteredResult(_0x29a8c5,_0x505cca){return function(_0x5aebe5){if(_0x5aebe5){var _0x1c2555=typeof _0x505cca[_0xb469('0x1a')]===_0xb469('0x1b')&&typeof _0x505cca[_0xb469('0x1c')]==='undefined';var _0x325509=_0x5aebe5[_0xb469('0x1d')];var _0x3d8dd6=_0x1c2555?0x0:_0x505cca[_0xb469('0x1a')];var _0xd469c9=_0x1c2555?_0x5aebe5['count']:_0x505cca[_0xb469('0x1a')]+_0x505cca[_0xb469('0x1c')];var _0x14a9dc;if(_0xd469c9>=_0x325509){_0xd469c9=_0x325509;_0x14a9dc=0xc8;}else{_0x14a9dc=0xce;}_0x29a8c5['status'](_0x14a9dc);return _0x29a8c5[_0xb469('0x1e')](_0xb469('0x1f'),_0x3d8dd6+'-'+_0xd469c9+'/'+_0x325509)[_0xb469('0x19')](_0x5aebe5);}return null;};}function patchUpdates(_0x286914){return function(_0x352454){try{jsonpatch[_0xb469('0x20')](_0x352454,_0x286914,!![]);}catch(_0x5ee1cc){return BPromise[_0xb469('0x21')](_0x5ee1cc);}return _0x352454[_0xb469('0x22')]();};}function saveUpdates(_0x184a71,_0x58ddb6){return function(_0x6647b4){if(_0x6647b4){return _0x6647b4['update'](_0x184a71)['then'](function(_0x1e4a3d){return _0x1e4a3d;});}return null;};}function removeEntity(_0x4d0707,_0xb87618){return function(_0x3c4c07){if(_0x3c4c07){return _0x3c4c07[_0xb469('0x23')]()['then'](function(){var _0xde9f75=_0x3c4c07[_0xb469('0x24')]({'plain':!![]});var _0x59da72='FaxQueues';return db[_0xb469('0x25')][_0xb469('0x23')]({'where':{'type':_0x59da72,'resourceId':_0xde9f75['id']}})[_0xb469('0x26')](function(){return _0x3c4c07;});})[_0xb469('0x26')](function(){_0x4d0707[_0xb469('0x17')](0xcc)[_0xb469('0x18')]();});}};}function handleEntityNotFound(_0x44b9f7,_0x3e6ce2){return function(_0x101927){if(!_0x101927){_0x44b9f7['sendStatus'](0x194);}return _0x101927;};}function handleError(_0x2dd72b,_0x4ad3b9){_0x4ad3b9=_0x4ad3b9||0x1f4;return function(_0x1fa74a){logger[_0xb469('0x27')](_0x1fa74a['stack']);if(_0x1fa74a['name']){delete _0x1fa74a[_0xb469('0x28')];}_0x2dd72b[_0xb469('0x17')](_0x4ad3b9)['send'](_0x1fa74a);};}exports[_0xb469('0x29')]=function(_0x3fe596,_0x47d226){var _0x5edf57={},_0x3f754d={},_0x30e14f={'count':0x0,'rows':[]};var _0x2010e2=_[_0xb469('0x2a')](db[_0xb469('0x2b')][_0xb469('0x2c')],function(_0x3ef106){return{'name':_0x3ef106['fieldName'],'type':_0x3ef106[_0xb469('0x2d')][_0xb469('0x2e')]};});_0x3f754d[_0xb469('0x2f')]=_[_0xb469('0x2a')](_0x2010e2,_0xb469('0x28'));_0x3f754d['query']=_[_0xb469('0x30')](_0x3fe596['query']);_0x3f754d['filters']=_[_0xb469('0x31')](_0x3f754d[_0xb469('0x2f')],_0x3f754d[_0xb469('0x32')]);_0x5edf57['attributes']=_[_0xb469('0x31')](_0x3f754d[_0xb469('0x2f')],qs['fields'](_0x3fe596['query'][_0xb469('0x33')]));_0x5edf57[_0xb469('0x34')]=_0x5edf57['attributes'][_0xb469('0x35')]?_0x5edf57[_0xb469('0x34')]:_0x3f754d[_0xb469('0x2f')];if(!_0x3fe596[_0xb469('0x32')]['hasOwnProperty'](_0xb469('0x36'))){_0x5edf57[_0xb469('0x1c')]=qs[_0xb469('0x1c')](_0x3fe596[_0xb469('0x32')][_0xb469('0x1c')]);_0x5edf57['offset']=qs['offset'](_0x3fe596[_0xb469('0x32')][_0xb469('0x1a')]);}_0x5edf57[_0xb469('0x37')]=qs[_0xb469('0x38')](_0x3fe596[_0xb469('0x32')][_0xb469('0x38')]);_0x5edf57[_0xb469('0x39')]=qs[_0xb469('0x3a')](_['pick'](_0x3fe596['query'],_0x3f754d[_0xb469('0x3a')]),_0x2010e2);if(_0x3fe596[_0xb469('0x32')][_0xb469('0x3b')]){_0x5edf57[_0xb469('0x39')]=_['merge'](_0x5edf57[_0xb469('0x39')],{'$or':_[_0xb469('0x2a')](_0x2010e2,function(_0x111c00){if(_0x111c00[_0xb469('0x2d')]!==_0xb469('0x3c')){var _0x312cce={};_0x312cce[_0x111c00[_0xb469('0x28')]]={'$like':'%'+_0x3fe596[_0xb469('0x32')][_0xb469('0x3b')]+'%'};return _0x312cce;}})});}_0x5edf57=_[_0xb469('0x3d')]({},_0x5edf57,_0x3fe596[_0xb469('0x3e')]);var _0x3d7d98={'where':_0x5edf57[_0xb469('0x39')]};return db[_0xb469('0x2b')]['count'](_0x3d7d98)['then'](function(_0x1fc84d){_0x30e14f[_0xb469('0x1d')]=_0x1fc84d;if(_0x3fe596[_0xb469('0x32')][_0xb469('0x3f')]){_0x5edf57[_0xb469('0x40')]=[{'all':!![]}];}return db[_0xb469('0x2b')][_0xb469('0x41')](_0x5edf57);})[_0xb469('0x26')](function(_0x3323a7){_0x30e14f[_0xb469('0x42')]=_0x3323a7;return _0x30e14f;})[_0xb469('0x26')](respondWithFilteredResult(_0x47d226,_0x5edf57))[_0xb469('0x43')](handleError(_0x47d226,null));};exports[_0xb469('0x44')]=function(_0x525c1f,_0x5e5137){var _0x5b5f42={'raw':!![],'where':{'id':_0x525c1f[_0xb469('0x45')]['id']}},_0x54f117={};_0x54f117[_0xb469('0x2f')]=_['keys'](db[_0xb469('0x2b')][_0xb469('0x2c')]);_0x54f117[_0xb469('0x32')]=_['keys'](_0x525c1f[_0xb469('0x32')]);_0x54f117[_0xb469('0x3a')]=_['intersection'](_0x54f117[_0xb469('0x2f')],_0x54f117['query']);_0x5b5f42[_0xb469('0x34')]=_[_0xb469('0x31')](_0x54f117[_0xb469('0x2f')],qs['fields'](_0x525c1f[_0xb469('0x32')]['fields']));_0x5b5f42[_0xb469('0x34')]=_0x5b5f42['attributes'][_0xb469('0x35')]?_0x5b5f42[_0xb469('0x34')]:_0x54f117['model'];if(_0x525c1f['query']['includeAll']){_0x5b5f42[_0xb469('0x40')]=[{'all':!![]}];}_0x5b5f42=_[_0xb469('0x3d')]({},_0x5b5f42,_0x525c1f['options']);return db[_0xb469('0x2b')]['find'](_0x5b5f42)[_0xb469('0x26')](handleEntityNotFound(_0x5e5137,null))[_0xb469('0x26')](respondWithResult(_0x5e5137,null))[_0xb469('0x43')](handleError(_0x5e5137,null));};exports[_0xb469('0x46')]=function(_0x4fc5a2,_0x3a243a){return db['FaxQueue'][_0xb469('0x46')](_0x4fc5a2[_0xb469('0x47')],{})[_0xb469('0x26')](function(_0x50bab5){var _0x267bec=_0x4fc5a2[_0xb469('0x48')][_0xb469('0x24')]({'plain':!![]});if(!_0x267bec)throw new Error(_0xb469('0x49'));if(_0x267bec[_0xb469('0x4a')]===_0xb469('0x48')){var _0x5ef712=_0x50bab5[_0xb469('0x24')]({'plain':!![]});var _0x4f1896=_0xb469('0x4b');return db[_0xb469('0x4c')][_0xb469('0x4d')]({'where':{'name':_0x4f1896,'userProfileId':_0x267bec[_0xb469('0x4e')]},'raw':!![]})[_0xb469('0x26')](function(_0x26742f){if(_0x26742f&&_0x26742f[_0xb469('0x4f')]===0x0){return db[_0xb469('0x25')][_0xb469('0x46')]({'name':_0x5ef712['name'],'resourceId':_0x5ef712['id'],'type':_0x26742f[_0xb469('0x28')],'sectionId':_0x26742f['id']},{})[_0xb469('0x26')](function(){return _0x50bab5;});}else{return _0x50bab5;}})[_0xb469('0x43')](function(_0x1e4664){logger[_0xb469('0x27')](_0xb469('0x50'),_0x1e4664);throw _0x1e4664;});}return _0x50bab5;})['then'](respondWithResult(_0x3a243a,0xc9))[_0xb469('0x43')](handleError(_0x3a243a,null));};exports[_0xb469('0x51')]=function(_0x21606f,_0x2a14ac){if(_0x21606f[_0xb469('0x47')]['id']){delete _0x21606f[_0xb469('0x47')]['id'];}return db[_0xb469('0x2b')][_0xb469('0x4d')]({'where':{'id':_0x21606f['params']['id']}})[_0xb469('0x26')](handleEntityNotFound(_0x2a14ac,null))[_0xb469('0x26')](saveUpdates(_0x21606f[_0xb469('0x47')],null))[_0xb469('0x26')](respondWithResult(_0x2a14ac,null))[_0xb469('0x43')](handleError(_0x2a14ac,null));};exports['destroy']=function(_0x49801d,_0x3128f1){return db[_0xb469('0x2b')][_0xb469('0x4d')]({'where':{'id':_0x49801d[_0xb469('0x45')]['id']}})[_0xb469('0x26')](handleEntityNotFound(_0x3128f1,null))[_0xb469('0x26')](removeEntity(_0x3128f1,null))[_0xb469('0x43')](handleError(_0x3128f1,null));};exports[_0xb469('0x52')]=function(_0x24e763,_0x2e59c6){return db[_0xb469('0x2b')][_0xb469('0x52')]()[_0xb469('0x26')](respondWithResult(_0x2e59c6,null))[_0xb469('0x43')](handleError(_0x2e59c6,null));};exports[_0xb469('0x53')]=function(_0x46118a,_0x4d9b50,_0x79ab20){var _0x2e211a={'raw':!![],'where':{}},_0x56250d={},_0x7dfa70;return db[_0xb469('0x2b')][_0xb469('0x54')]({'where':{'id':_0x46118a[_0xb469('0x45')]['id']}})[_0xb469('0x26')](handleEntityNotFound(_0x4d9b50,null))[_0xb469('0x26')](function(_0x2ca3d0){if(_0x2ca3d0){_0x7dfa70=_0x2ca3d0['get']({'plain':!![]});_0x56250d[_0xb469('0x2f')]=_[_0xb469('0x30')](db['UserFaxQueue'][_0xb469('0x2c')]);_0x56250d['query']=_[_0xb469('0x30')](_0x46118a['query']);_0x56250d[_0xb469('0x3a')]=_[_0xb469('0x31')](_0x56250d['model'],_0x56250d[_0xb469('0x32')]);_0x2e211a[_0xb469('0x34')]=_[_0xb469('0x31')](_0x56250d[_0xb469('0x2f')],qs['fields'](_0x46118a[_0xb469('0x32')]['fields']));_0x2e211a[_0xb469('0x34')]=_0x2e211a[_0xb469('0x34')][_0xb469('0x35')]?_0x2e211a[_0xb469('0x34')]:_0x56250d[_0xb469('0x2f')];if(!_0x46118a[_0xb469('0x32')][_0xb469('0x55')]('nolimit')){_0x2e211a[_0xb469('0x1c')]=qs['limit'](_0x46118a[_0xb469('0x32')]['limit']);_0x2e211a[_0xb469('0x1a')]=qs[_0xb469('0x1a')](_0x46118a['query'][_0xb469('0x1a')]);}_0x2e211a[_0xb469('0x37')]=qs[_0xb469('0x38')](_0x46118a[_0xb469('0x32')][_0xb469('0x38')]);_0x2e211a[_0xb469('0x39')]=qs[_0xb469('0x3a')](_[_0xb469('0x56')](_0x46118a['query'],_0x56250d[_0xb469('0x3a')]));_0x2e211a[_0xb469('0x39')][_0xb469('0x57')]=_0x2ca3d0['id'];if(_0x46118a[_0xb469('0x32')][_0xb469('0x3b')]){_0x2e211a[_0xb469('0x39')]=_[_0xb469('0x3d')](_0x2e211a[_0xb469('0x39')],{'$or':_[_0xb469('0x2a')](_0x2e211a[_0xb469('0x34')],function(_0x7424e4){var _0x15e09e={};_0x15e09e[_0x7424e4]={'$like':'%'+_0x46118a[_0xb469('0x32')]['filter']+'%'};return _0x15e09e;})});}_0x2e211a=_[_0xb469('0x3d')]({},_0x2e211a,_0x46118a[_0xb469('0x3e')]);return db[_0xb469('0x58')][_0xb469('0x41')](_0x2e211a);}})[_0xb469('0x26')](function(_0x50d1ed){if(_0x50d1ed){return db[_0xb469('0x59')][_0xb469('0x5a')]({'where':{'id':_[_0xb469('0x2a')](_0x50d1ed,_0xb469('0x5b')),'role':'agent'},'attributes':['id','name',_0xb469('0x5c'),'updatedAt',_0xb469('0x5d')]});}})['then'](function(_0x3ec3b9){if(_0x3ec3b9){return{'count':_0x3ec3b9[_0xb469('0x1d')],'rows':_[_0xb469('0x2a')](_0x3ec3b9['rows'],function(_0x4b8f5e){return{'membername':_0x4b8f5e[_0xb469('0x28')],'UserId':_0x4b8f5e['id'],'queue_name':_0x7dfa70[_0xb469('0x28')],'FaxQueueId':_0x7dfa70['id'],'interface':util[_0xb469('0x5e')](_0xb469('0x5f'),'SIP',_0x4b8f5e['name']),'penalty':0x0,'paused':_0x4b8f5e[_0xb469('0x5c')],'createdAt':_0x4b8f5e[_0xb469('0x5d')],'updatedAt':_0x4b8f5e[_0xb469('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb469('0x26')](respondWithFilteredResult(_0x4d9b50,_0x2e211a))[_0xb469('0x43')](handleError(_0x4d9b50,null));};exports['getTeams']=function(_0x45d8c5,_0x41ffa3,_0x27898b){var _0x3169f9={};var _0x5b3138={};var _0x445b82;var _0x30ddfd;return db[_0xb469('0x2b')][_0xb469('0x54')]({'where':{'id':_0x45d8c5[_0xb469('0x45')]['id']}})[_0xb469('0x26')](handleEntityNotFound(_0x41ffa3,null))[_0xb469('0x26')](function(_0x518574){if(_0x518574){_0x445b82=_0x518574;_0x5b3138['model']=_[_0xb469('0x30')](db[_0xb469('0x61')][_0xb469('0x2c')]);_0x5b3138['query']=_['keys'](_0x45d8c5['query']);_0x5b3138[_0xb469('0x3a')]=_['intersection'](_0x5b3138[_0xb469('0x2f')],_0x5b3138[_0xb469('0x32')]);_0x3169f9[_0xb469('0x34')]=_[_0xb469('0x31')](_0x5b3138[_0xb469('0x2f')],qs[_0xb469('0x33')](_0x45d8c5[_0xb469('0x32')][_0xb469('0x33')]));_0x3169f9[_0xb469('0x34')]=_0x3169f9[_0xb469('0x34')]['length']?_0x3169f9['attributes']:_0x5b3138[_0xb469('0x2f')];_0x3169f9['order']=qs[_0xb469('0x38')](_0x45d8c5['query'][_0xb469('0x38')]);_0x3169f9['where']=qs['filters'](_[_0xb469('0x56')](_0x45d8c5[_0xb469('0x32')],_0x5b3138['filters']));if(_0x45d8c5['query'][_0xb469('0x3b')]){_0x3169f9[_0xb469('0x39')]=_[_0xb469('0x3d')](_0x3169f9['where'],{'$or':_['map'](_0x3169f9[_0xb469('0x34')],function(_0x34f8e8){var _0x4be8fa={};_0x4be8fa[_0x34f8e8]={'$like':'%'+_0x45d8c5[_0xb469('0x32')][_0xb469('0x3b')]+'%'};return _0x4be8fa;})});}_0x3169f9=_['merge']({},_0x3169f9,_0x45d8c5['options']);return _0x445b82[_0xb469('0x62')](_0x3169f9);}})['then'](function(_0x22dbdd){if(_0x22dbdd){_0x30ddfd=_0x22dbdd[_0xb469('0x35')];if(!_0x45d8c5[_0xb469('0x32')]['hasOwnProperty'](_0xb469('0x36'))){_0x3169f9[_0xb469('0x1c')]=qs[_0xb469('0x1c')](_0x45d8c5[_0xb469('0x32')][_0xb469('0x1c')]);_0x3169f9[_0xb469('0x1a')]=qs[_0xb469('0x1a')](_0x45d8c5['query']['offset']);}return _0x445b82[_0xb469('0x62')](_0x3169f9);}})[_0xb469('0x26')](function(_0x34beb5){if(_0x34beb5){return _0x34beb5?{'count':_0x30ddfd,'rows':_0x34beb5}:null;}})[_0xb469('0x26')](respondWithResult(_0x41ffa3,null))['catch'](handleError(_0x41ffa3,null));};exports['addTeams']=function(_0x574b1a,_0x5c1d17,_0x52a156){var _0x5be36d=_0x574b1a[_0xb469('0x47')][_0xb469('0x63')];return db['Team'][_0xb469('0x41')]({'where':{'id':_0x5be36d},'attributes':['id'],'include':[{'model':db[_0xb469('0x59')],'as':_0xb469('0x64'),'attributes':['id','name',_0xb469('0x65'),_0xb469('0x66'),'interface'],'raw':!![]}]})[_0xb469('0x26')](function(_0x4adfdc){if(_0x4adfdc){var _0x251a4f=_['flatMap'](_0x4adfdc,function(_0x36e7af){var _0x334a11=_0x36e7af['get']({'plain':!![]});return _0x334a11['Agents'];});return db['FaxQueue'][_0xb469('0x4d')]({'where':{'id':_0x574b1a[_0xb469('0x45')]['id']}})['then'](function(_0x563024){return db[_0xb469('0x67')][_0xb469('0x68')](function(_0x28117a){return _0x563024['addTeams'](_0x5be36d,{'transaction':_0x28117a})[_0xb469('0x26')](function(){return BPromise['each'](_0x251a4f,function(_0xb9bc5){return db['UserFaxQueue'][_0xb469('0x69')]({'where':{'UserId':_0xb9bc5['id'],'FaxQueueId':_0x574b1a[_0xb469('0x45')]['id']},'transaction':_0x28117a});});})[_0xb469('0x26')](function(){_0x251a4f[_0xb469('0x6a')](function(_0x44ce52){socket[_0xb469('0x6b')](_0xb469('0x6c'),{'UserId':_0x44ce52['id'],'FaxQueueId':_0x563024['id']});});});});});}})[_0xb469('0x26')](respondWithStatusCode(_0x5c1d17,null))[_0xb469('0x43')](handleError(_0x5c1d17,null));};exports['removeTeams']=function(_0x38746b,_0x18232d,_0x3faaf2){return db[_0xb469('0x61')][_0xb469('0x41')]({'where':{'id':_0x38746b[_0xb469('0x32')][_0xb469('0x63')]},'attributes':['id'],'include':[{'model':db[_0xb469('0x59')],'as':_0xb469('0x64'),'attributes':['id'],'raw':!![]}]})[_0xb469('0x26')](handleEntityNotFound(_0x18232d,null))[_0xb469('0x26')](function(_0x44df44){var _0x7ca203=_[_0xb469('0x2a')](_0x44df44,'id');var _0x1b2cb8=[];var _0x3850fe=[];var _0x43cf4d=squel['select']();_0x43cf4d[_0xb469('0x6d')](_0xb469('0x6e'))[_0xb469('0x6f')](_0xb469('0x70'),'tq')[_0xb469('0x71')](_0xb469('0x72'),'ut',_0xb469('0x73'))[_0xb469('0x39')](_0xb469('0x74'),_0x38746b[_0xb469('0x45')]['id']);for(var _0x178d39=0x0;_0x178d39<_0x44df44['length'];_0x178d39+=0x1){let _0x208786=_0x44df44[_0x178d39];for(var _0x30e177=0x0;_0x30e177<_0x208786[_0xb469('0x64')][_0xb469('0x35')];_0x30e177+=0x1){let _0x5b3208=_0x208786[_0xb469('0x64')][_0x30e177];var _0x748f7e=_0x43cf4d['clone']();_0x748f7e[_0xb469('0x39')]('ut.UserId\x20=\x20?',_0x5b3208['id']);_0x3850fe[_0xb469('0x75')](db[_0xb469('0x67')][_0xb469('0x32')](_0x748f7e[_0xb469('0x76')](),{'type':db[_0xb469('0x67')][_0xb469('0x77')][_0xb469('0x78')]})['then'](function(_0x2bfb39){if(_0x2bfb39['length']===0x1){return _0x5b3208['id'];}else{var _0x5a8e80=_[_0xb469('0x79')](_['map'](_0x2bfb39,_0xb469('0x7a')),function(_0x347551){return _[_0xb469('0x7b')](_0x7ca203,_0x347551);});if(_0x5a8e80){return _0x5b3208['id'];}}}));}}return BPromise[_0xb469('0x7c')](_0x3850fe)[_0xb469('0x26')](function(_0x2bcb78){_0x1b2cb8=_(_0x1b2cb8)[_0xb469('0x7d')](_0x2bcb78)[_0xb469('0x7e')]()[_0xb469('0x7f')]();return db['FaxQueue'][_0xb469('0x4d')]({'where':{'id':_0x38746b[_0xb469('0x45')]['id']}})['then'](function(_0x52e633){return db['sequelize'][_0xb469('0x68')](function(_0xed4b6b){return _0x52e633[_0xb469('0x80')](_0x38746b[_0xb469('0x32')][_0xb469('0x63')],{'transaction':_0xed4b6b})[_0xb469('0x26')](function(){if(!_[_0xb469('0x81')](_0x1b2cb8)){return _0x52e633['removeAgents'](_0x1b2cb8,{'transaction':_0xed4b6b});}})[_0xb469('0x26')](function(){_0x1b2cb8[_0xb469('0x6a')](function(_0x188bed){socket['emit'](_0xb469('0x82'),{'UserId':_0x188bed,'FaxQueueId':_0x52e633['id']});});});});});});})[_0xb469('0x26')](respondWithStatusCode(_0x18232d,null))['catch'](handleError(_0x18232d,null));};exports[_0xb469('0x83')]=function(_0x12cfbc,_0x14c7d0,_0x22f90d){return db[_0xb469('0x2b')][_0xb469('0x4d')]({'where':{'id':_0x12cfbc[_0xb469('0x45')]['id']}})[_0xb469('0x26')](handleEntityNotFound(_0x14c7d0,null))[_0xb469('0x26')](function(_0x19a434){if(_0x19a434){return _0x19a434[_0xb469('0x83')](_0x12cfbc[_0xb469('0x47')][_0xb469('0x63')],_[_0xb469('0x84')](_0x12cfbc[_0xb469('0x47')],[_0xb469('0x63'),'id'])||{})[_0xb469('0x85')](function(_0x16e46d){for(var _0xad9c15=0x0;_0xad9c15<_0x12cfbc[_0xb469('0x47')]['ids'][_0xb469('0x35')];_0xad9c15+=0x1){socket['emit'](_0xb469('0x6c'),{'UserId':Number(_0x12cfbc[_0xb469('0x47')]['ids'][_0xad9c15]),'FaxQueueId':Number(_0x12cfbc[_0xb469('0x45')]['id'])});}return _0x16e46d;});}})[_0xb469('0x26')](respondWithResult(_0x14c7d0,null))[_0xb469('0x43')](handleError(_0x14c7d0,null));};exports['removeAgents']=function(_0x390555,_0x4614cf,_0x39655e){return db[_0xb469('0x2b')][_0xb469('0x4d')]({'where':{'id':_0x390555['params']['id']}})[_0xb469('0x26')](handleEntityNotFound(_0x4614cf,null))[_0xb469('0x26')](function(_0x5d0f41){if(_0x5d0f41){return _0x5d0f41[_0xb469('0x86')](_0x390555[_0xb469('0x32')][_0xb469('0x63')])[_0xb469('0x26')](function(){if(_[_0xb469('0x87')](_0x390555[_0xb469('0x32')][_0xb469('0x63')])){for(var _0x131039=0x0;_0x131039<_0x390555[_0xb469('0x32')][_0xb469('0x63')][_0xb469('0x35')];_0x131039+=0x1){socket['emit'](_0xb469('0x82'),{'UserId':Number(_0x390555['query']['ids'][_0x131039]),'FaxQueueId':Number(_0x390555[_0xb469('0x45')]['id'])});}}else{socket[_0xb469('0x6b')](_0xb469('0x82'),{'UserId':Number(_0x390555[_0xb469('0x32')]['ids']),'FaxQueueId':Number(_0x390555[_0xb469('0x45')]['id'])});}});}})[_0xb469('0x26')](respondWithStatusCode(_0x4614cf,null))[_0xb469('0x43')](handleError(_0x4614cf,null));};exports[_0xb469('0x88')]=function(_0x5cf6fe,_0x2136ed,_0x16e22b){var _0x42e398={};var _0x54ebe3={};var _0x486457;var _0x564e71;return db[_0xb469('0x2b')][_0xb469('0x54')]({'where':{'id':_0x5cf6fe[_0xb469('0x45')]['id']}})['then'](handleEntityNotFound(_0x2136ed,null))['then'](function(_0x113933){if(_0x113933){_0x486457=_0x113933;_0x54ebe3[_0xb469('0x2f')]=_['keys'](db[_0xb469('0x59')][_0xb469('0x2c')]);_0x54ebe3[_0xb469('0x32')]=_[_0xb469('0x30')](_0x5cf6fe[_0xb469('0x32')]);_0x54ebe3[_0xb469('0x3a')]=_['intersection'](_0x54ebe3[_0xb469('0x2f')],_0x54ebe3[_0xb469('0x32')]);_0x42e398[_0xb469('0x34')]=_['intersection'](_0x54ebe3[_0xb469('0x2f')],qs[_0xb469('0x33')](_0x5cf6fe['query'][_0xb469('0x33')]));_0x42e398['attributes']=_0x42e398['attributes'][_0xb469('0x35')]?_0x42e398[_0xb469('0x34')]:_0x54ebe3[_0xb469('0x2f')];_0x42e398[_0xb469('0x37')]=qs['sort'](_0x5cf6fe[_0xb469('0x32')][_0xb469('0x38')]);_0x42e398[_0xb469('0x39')]=qs[_0xb469('0x3a')](_[_0xb469('0x56')](_0x5cf6fe['query'],_0x54ebe3['filters']));if(_0x5cf6fe['query'][_0xb469('0x3b')]){_0x42e398[_0xb469('0x39')]=_[_0xb469('0x3d')](_0x42e398[_0xb469('0x39')],{'$or':_[_0xb469('0x2a')](_0x42e398[_0xb469('0x34')],function(_0x9c50ee){var _0x50bc88={};_0x50bc88[_0x9c50ee]={'$like':'%'+_0x5cf6fe[_0xb469('0x32')][_0xb469('0x3b')]+'%'};return _0x50bc88;})});}_0x42e398=_[_0xb469('0x3d')]({},_0x42e398,_0x5cf6fe[_0xb469('0x3e')]);return _0x486457[_0xb469('0x88')](_0x42e398);}})[_0xb469('0x26')](function(_0x35e05e){if(_0x35e05e){_0x564e71=_0x35e05e[_0xb469('0x35')];if(!_0x5cf6fe['query']['hasOwnProperty'](_0xb469('0x36'))){_0x42e398[_0xb469('0x1c')]=qs['limit'](_0x5cf6fe[_0xb469('0x32')][_0xb469('0x1c')]);_0x42e398[_0xb469('0x1a')]=qs[_0xb469('0x1a')](_0x5cf6fe['query'][_0xb469('0x1a')]);}return _0x486457[_0xb469('0x88')](_0x42e398);}})[_0xb469('0x26')](function(_0x507717){if(_0x507717){return _0x507717?{'count':_0x564e71,'rows':_0x507717}:null;}})[_0xb469('0x26')](respondWithResult(_0x2136ed,null))[_0xb469('0x43')](handleError(_0x2136ed,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 81cf69c..255a55c 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 _0x55ef=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xcba4b6,_0x1ecf6a){var _0x2bd8bf=function(_0x46812a){while(--_0x46812a){_0xcba4b6['push'](_0xcba4b6['shift']());}};_0x2bd8bf(++_0x1ecf6a);}(_0x55ef,0x135));var _0xf55e=function(_0x554112,_0x325a2a){_0x554112=_0x554112-0x0;var _0x952a74=_0x55ef[_0x554112];return _0x952a74;};'use strict';var EventEmitter=require(_0xf55e('0x0'));var FaxQueue=require(_0xf55e('0x1'))['db'][_0xf55e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf55e('0x3')](0x0);var events={'afterCreate':_0xf55e('0x4'),'afterUpdate':_0xf55e('0x5'),'afterDestroy':_0xf55e('0x6')};function emitEvent(_0x2d6257){return function(_0xd8c51f,_0x3fe761,_0x4877cf){FaxQueueEvents[_0xf55e('0x7')](_0x2d6257+':'+_0xd8c51f['id'],_0xd8c51f);FaxQueueEvents[_0xf55e('0x7')](_0x2d6257,_0xd8c51f);_0x4877cf(null);};}for(var e in events){if(events[_0xf55e('0x8')](e)){var event=events[e];FaxQueue[_0xf55e('0x9')](e,emitEvent(event));}}module[_0xf55e('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0x716c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x5aa3e6,_0x146de9){var _0x273969=function(_0x4ee601){while(--_0x4ee601){_0x5aa3e6['push'](_0x5aa3e6['shift']());}};_0x273969(++_0x146de9);}(_0x716c,0x1c7));var _0xc716=function(_0xbeccd6,_0x3410b9){_0xbeccd6=_0xbeccd6-0x0;var _0x514d06=_0x716c[_0xbeccd6];return _0x514d06;};'use strict';var EventEmitter=require(_0xc716('0x0'));var FaxQueue=require(_0xc716('0x1'))['db'][_0xc716('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc716('0x3')](0x0);var events={'afterCreate':_0xc716('0x4'),'afterUpdate':_0xc716('0x5'),'afterDestroy':_0xc716('0x6')};function emitEvent(_0x18ed3f){return function(_0x1682be,_0x2ff585,_0x365ded){FaxQueueEvents[_0xc716('0x7')](_0x18ed3f+':'+_0x1682be['id'],_0x1682be);FaxQueueEvents[_0xc716('0x7')](_0x18ed3f,_0x1682be);_0x365ded(null);};}for(var e in events){if(events[_0xc716('0x8')](e)){var event=events[e];FaxQueue[_0xc716('0x9')](e,emitEvent(event));}}module[_0xc716('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2e2ae1b..846a3b5 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 _0x9845=['define','fax_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x28c574,_0x3282b1){var _0x3f1093=function(_0x4b5b2d){while(--_0x4b5b2d){_0x28c574['push'](_0x28c574['shift']());}};_0x3f1093(++_0x3282b1);}(_0x9845,0x18e));var _0x5984=function(_0x2629f2,_0x2ac3de){_0x2629f2=_0x2629f2-0x0;var _0x5a59e4=_0x9845[_0x2629f2];return _0x5a59e4;};'use strict';var _=require(_0x5984('0x0'));var util=require('util');var logger=require(_0x5984('0x1'))(_0x5984('0x2'));var moment=require('moment');var BPromise=require(_0x5984('0x3'));var rp=require(_0x5984('0x4'));var fs=require('fs');var path=require(_0x5984('0x5'));var rimraf=require(_0x5984('0x6'));var config=require(_0x5984('0x7'));var attributes=require(_0x5984('0x8'));module[_0x5984('0x9')]=function(_0xc66913,_0x40d42f){return _0xc66913[_0x5984('0xa')]('FaxQueue',attributes,{'tableName':_0x5984('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fa2=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3a3b8d,_0x259d2a){var _0x5cc112=function(_0x2b8700){while(--_0x2b8700){_0x3a3b8d['push'](_0x3a3b8d['shift']());}};_0x5cc112(++_0x259d2a);}(_0x1fa2,0x87));var _0x21fa=function(_0x2b264c,_0x292ed0){_0x2b264c=_0x2b264c-0x0;var _0x4691a1=_0x1fa2[_0x2b264c];return _0x4691a1;};'use strict';var _=require(_0x21fa('0x0'));var util=require(_0x21fa('0x1'));var logger=require(_0x21fa('0x2'))(_0x21fa('0x3'));var moment=require(_0x21fa('0x4'));var BPromise=require(_0x21fa('0x5'));var rp=require(_0x21fa('0x6'));var fs=require('fs');var path=require(_0x21fa('0x7'));var rimraf=require(_0x21fa('0x8'));var config=require(_0x21fa('0x9'));var attributes=require(_0x21fa('0xa'));module[_0x21fa('0xb')]=function(_0x4dacab,_0xc092a3){return _0x4dacab[_0x21fa('0xc')]('FaxQueue',attributes,{'tableName':_0x21fa('0xd'),'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 ec3c2ad..421f191 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 _0x4cd8=['find','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','include','map','model','ShowFaxQueue'];(function(_0x478020,_0x181316){var _0x17bbc3=function(_0x4d80d1){while(--_0x4d80d1){_0x478020['push'](_0x478020['shift']());}};_0x17bbc3(++_0x181316);}(_0x4cd8,0x158));var _0x84cd=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x4cd8[_0x261e29];return _0x25ef43;};'use strict';var _=require(_0x84cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x84cd('0x1'));var rs=require(_0x84cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84cd('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x84cd('0x4'));var jayson=require(_0x84cd('0x5'));var client=jayson[_0x84cd('0x6')][_0x84cd('0x7')]({'port':0x232a});config['redis']=_[_0x84cd('0x8')](config[_0x84cd('0x9')],{'host':_0x84cd('0xa'),'port':0x18eb});var socket=require(_0x84cd('0xb'))(new Redis(config['redis']));require(_0x84cd('0xc'))[_0x84cd('0xd')](socket);function respondWithRpcPromise(_0x609d5,_0x2c7b38,_0x1cffb3){return new BPromise(function(_0xcc74da,_0x479605){return client[_0x84cd('0xe')](_0x609d5,_0x1cffb3)[_0x84cd('0xf')](function(_0x3454a2){logger[_0x84cd('0x10')]('FaxQueue,\x20%s,\x20%s',_0x2c7b38,'request\x20sent');logger[_0x84cd('0x11')](_0x84cd('0x12'),_0x2c7b38,'request\x20sent',JSON[_0x84cd('0x13')](_0x3454a2));if(_0x3454a2[_0x84cd('0x14')]){if(_0x3454a2['error'][_0x84cd('0x15')]===0x1f4){logger['error'](_0x84cd('0x16'),_0x2c7b38,_0x3454a2[_0x84cd('0x14')][_0x84cd('0x17')]);return _0x479605(_0x3454a2['error'][_0x84cd('0x17')]);}logger[_0x84cd('0x14')]('FaxQueue,\x20%s,\x20%s',_0x2c7b38,_0x3454a2[_0x84cd('0x14')][_0x84cd('0x17')]);return _0xcc74da(_0x3454a2['error'][_0x84cd('0x17')]);}else{logger[_0x84cd('0x10')](_0x84cd('0x16'),_0x2c7b38,'request\x20sent');_0xcc74da(_0x3454a2[_0x84cd('0x18')]['message']);}})[_0x84cd('0x19')](function(_0x954ddf){logger[_0x84cd('0x14')](_0x84cd('0x16'),_0x2c7b38,_0x954ddf);_0x479605(_0x954ddf);});});}exports[_0x84cd('0x1a')]=function(_0x4fa1d9){var _0x4543cc=this;return new Promise(function(_0x49b926,_0x98b57b){return db[_0x84cd('0x1b')][_0x84cd('0x1c')]({'raw':_0x4fa1d9[_0x84cd('0x1d')]?_0x4fa1d9[_0x84cd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4fa1d9['options']?_0x4fa1d9[_0x84cd('0x1d')][_0x84cd('0x1e')]||null:null,'attributes':_0x4fa1d9[_0x84cd('0x1d')]?_0x4fa1d9[_0x84cd('0x1d')][_0x84cd('0x1f')]||null:null,'limit':_0x4fa1d9[_0x84cd('0x1d')]?_0x4fa1d9[_0x84cd('0x1d')]['limit']||null:null,'include':_0x4fa1d9[_0x84cd('0x1d')]?_0x4fa1d9[_0x84cd('0x1d')][_0x84cd('0x20')]?_['map'](_0x4fa1d9['options'][_0x84cd('0x20')],function(_0x1df354){return{'model':db[_0x1df354['model']],'as':_0x1df354['as'],'attributes':_0x1df354['attributes'],'include':_0x1df354['include']?_[_0x84cd('0x21')](_0x1df354[_0x84cd('0x20')],function(_0x4ae75b){return{'model':db[_0x4ae75b[_0x84cd('0x22')]],'as':_0x4ae75b['as'],'attributes':_0x4ae75b[_0x84cd('0x1f')],'include':_0x4ae75b['include']?_[_0x84cd('0x21')](_0x4ae75b[_0x84cd('0x20')],function(_0x1805fb){return{'model':db[_0x1805fb['model']],'as':_0x1805fb['as'],'attributes':_0x1805fb[_0x84cd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x84cd('0xf')](function(_0x3b740c){logger[_0x84cd('0x10')](_0x84cd('0x1a'),_0x4fa1d9);logger[_0x84cd('0x11')](_0x84cd('0x1a'),_0x4fa1d9,JSON[_0x84cd('0x13')](_0x3b740c));_0x49b926(_0x3b740c);})[_0x84cd('0x19')](function(_0x526cc0){logger[_0x84cd('0x14')](_0x84cd('0x1a'),_0x526cc0[_0x84cd('0x17')],_0x4fa1d9);_0x98b57b(_0x4543cc[_0x84cd('0x14')](0x1f4,_0x526cc0['message']));});});};exports[_0x84cd('0x23')]=function(_0x571046){var _0xdae40d=this;return new Promise(function(_0x551d54,_0x56bb11){return db['FaxQueue'][_0x84cd('0x24')]({'raw':_0x571046[_0x84cd('0x1d')]?_0x571046[_0x84cd('0x1d')][_0x84cd('0x25')]===undefined?!![]:![]:!![],'where':_0x571046['options']?_0x571046[_0x84cd('0x1d')][_0x84cd('0x1e')]||null:null,'attributes':_0x571046['options']?_0x571046[_0x84cd('0x1d')][_0x84cd('0x1f')]||null:null,'include':_0x571046['options']?_0x571046[_0x84cd('0x1d')]['include']?_[_0x84cd('0x21')](_0x571046['options'][_0x84cd('0x20')],function(_0x52faf4){return{'model':db[_0x52faf4[_0x84cd('0x22')]],'as':_0x52faf4['as'],'attributes':_0x52faf4[_0x84cd('0x1f')],'include':_0x52faf4[_0x84cd('0x20')]?_[_0x84cd('0x21')](_0x52faf4[_0x84cd('0x20')],function(_0x35b2ed){return{'model':db[_0x35b2ed[_0x84cd('0x22')]],'as':_0x35b2ed['as'],'attributes':_0x35b2ed[_0x84cd('0x1f')],'include':_0x35b2ed['include']?_[_0x84cd('0x21')](_0x35b2ed[_0x84cd('0x20')],function(_0x342018){return{'model':db[_0x342018[_0x84cd('0x22')]],'as':_0x342018['as'],'attributes':_0x342018[_0x84cd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x84cd('0xf')](function(_0x2daabb){logger[_0x84cd('0x10')](_0x84cd('0x23'),_0x571046);logger[_0x84cd('0x11')]('ShowFaxQueue',_0x571046,JSON['stringify'](_0x2daabb));_0x551d54(_0x2daabb);})[_0x84cd('0x19')](function(_0x35b6e1){logger[_0x84cd('0x14')](_0x84cd('0x23'),_0x35b6e1[_0x84cd('0x17')],_0x571046);_0x56bb11(_0xdae40d['error'](0x1f4,_0x35b6e1[_0x84cd('0x17')]));});});}; \ No newline at end of file +var _0x77ed=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','map','include','model','attributes','ShowFaxQueue','lodash'];(function(_0x22ad14,_0x2ecc5f){var _0xb940bd=function(_0x56439e){while(--_0x56439e){_0x22ad14['push'](_0x22ad14['shift']());}};_0xb940bd(++_0x2ecc5f);}(_0x77ed,0x167));var _0xd77e=function(_0x1d8889,_0x3b7ad5){_0x1d8889=_0x1d8889-0x0;var _0x36138b=_0x77ed[_0x1d8889];return _0x36138b;};'use strict';var _=require(_0xd77e('0x0'));var util=require(_0xd77e('0x1'));var moment=require(_0xd77e('0x2'));var BPromise=require(_0xd77e('0x3'));var rs=require(_0xd77e('0x4'));var fs=require('fs');var Redis=require(_0xd77e('0x5'));var db=require(_0xd77e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd77e('0x7'))(_0xd77e('0x8'));var config=require(_0xd77e('0x9'));var jayson=require(_0xd77e('0xa'));var client=jayson[_0xd77e('0xb')]['http']({'port':0x232a});config['redis']=_[_0xd77e('0xc')](config[_0xd77e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd77e('0xe'))(new Redis(config[_0xd77e('0xd')]));require(_0xd77e('0xf'))[_0xd77e('0x10')](socket);function respondWithRpcPromise(_0x1a65f9,_0x2413a5,_0x1a66bf){return new BPromise(function(_0x1cc041,_0x554e6c){return client[_0xd77e('0x11')](_0x1a65f9,_0x1a66bf)[_0xd77e('0x12')](function(_0x5befc7){logger[_0xd77e('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2413a5,'request\x20sent');logger[_0xd77e('0x14')](_0xd77e('0x15'),_0x2413a5,_0xd77e('0x16'),JSON[_0xd77e('0x17')](_0x5befc7));if(_0x5befc7[_0xd77e('0x18')]){if(_0x5befc7[_0xd77e('0x18')][_0xd77e('0x19')]===0x1f4){logger[_0xd77e('0x18')](_0xd77e('0x1a'),_0x2413a5,_0x5befc7[_0xd77e('0x18')][_0xd77e('0x1b')]);return _0x554e6c(_0x5befc7[_0xd77e('0x18')][_0xd77e('0x1b')]);}logger[_0xd77e('0x18')]('FaxQueue,\x20%s,\x20%s',_0x2413a5,_0x5befc7['error']['message']);return _0x1cc041(_0x5befc7['error']['message']);}else{logger[_0xd77e('0x13')](_0xd77e('0x1a'),_0x2413a5,_0xd77e('0x16'));_0x1cc041(_0x5befc7[_0xd77e('0x1c')][_0xd77e('0x1b')]);}})[_0xd77e('0x1d')](function(_0x4882be){logger[_0xd77e('0x18')](_0xd77e('0x1a'),_0x2413a5,_0x4882be);_0x554e6c(_0x4882be);});});}exports[_0xd77e('0x1e')]=function(_0x106fce){var _0x278caa=this;return new Promise(function(_0x1ac3a2,_0x4e7a37){return db[_0xd77e('0x1f')]['findAll']({'raw':_0x106fce[_0xd77e('0x20')]?_0x106fce[_0xd77e('0x20')][_0xd77e('0x21')]===undefined?!![]:![]:!![],'where':_0x106fce[_0xd77e('0x20')]?_0x106fce[_0xd77e('0x20')][_0xd77e('0x22')]||null:null,'attributes':_0x106fce['options']?_0x106fce[_0xd77e('0x20')]['attributes']||null:null,'limit':_0x106fce[_0xd77e('0x20')]?_0x106fce[_0xd77e('0x20')]['limit']||null:null,'include':_0x106fce[_0xd77e('0x20')]?_0x106fce[_0xd77e('0x20')]['include']?_[_0xd77e('0x23')](_0x106fce[_0xd77e('0x20')][_0xd77e('0x24')],function(_0xb37821){return{'model':db[_0xb37821[_0xd77e('0x25')]],'as':_0xb37821['as'],'attributes':_0xb37821[_0xd77e('0x26')],'include':_0xb37821[_0xd77e('0x24')]?_[_0xd77e('0x23')](_0xb37821['include'],function(_0x30816b){return{'model':db[_0x30816b['model']],'as':_0x30816b['as'],'attributes':_0x30816b[_0xd77e('0x26')],'include':_0x30816b[_0xd77e('0x24')]?_[_0xd77e('0x23')](_0x30816b[_0xd77e('0x24')],function(_0x24bb26){return{'model':db[_0x24bb26[_0xd77e('0x25')]],'as':_0x24bb26['as'],'attributes':_0x24bb26[_0xd77e('0x26')]};}):[]};}):[]};}):[]:[]})[_0xd77e('0x12')](function(_0x2f2235){logger[_0xd77e('0x13')](_0xd77e('0x1e'),_0x106fce);logger['debug']('GetFaxQueue',_0x106fce,JSON['stringify'](_0x2f2235));_0x1ac3a2(_0x2f2235);})['catch'](function(_0x4deb1a){logger[_0xd77e('0x18')](_0xd77e('0x1e'),_0x4deb1a[_0xd77e('0x1b')],_0x106fce);_0x4e7a37(_0x278caa['error'](0x1f4,_0x4deb1a[_0xd77e('0x1b')]));});});};exports['ShowFaxQueue']=function(_0x35c59f){var _0x310375=this;return new Promise(function(_0x499989,_0xb283dd){return db[_0xd77e('0x1f')]['find']({'raw':_0x35c59f[_0xd77e('0x20')]?_0x35c59f[_0xd77e('0x20')][_0xd77e('0x21')]===undefined?!![]:![]:!![],'where':_0x35c59f[_0xd77e('0x20')]?_0x35c59f[_0xd77e('0x20')][_0xd77e('0x22')]||null:null,'attributes':_0x35c59f['options']?_0x35c59f[_0xd77e('0x20')][_0xd77e('0x26')]||null:null,'include':_0x35c59f['options']?_0x35c59f[_0xd77e('0x20')][_0xd77e('0x24')]?_['map'](_0x35c59f[_0xd77e('0x20')][_0xd77e('0x24')],function(_0x3b0797){return{'model':db[_0x3b0797['model']],'as':_0x3b0797['as'],'attributes':_0x3b0797[_0xd77e('0x26')],'include':_0x3b0797[_0xd77e('0x24')]?_[_0xd77e('0x23')](_0x3b0797['include'],function(_0x59ddac){return{'model':db[_0x59ddac[_0xd77e('0x25')]],'as':_0x59ddac['as'],'attributes':_0x59ddac['attributes'],'include':_0x59ddac[_0xd77e('0x24')]?_['map'](_0x59ddac[_0xd77e('0x24')],function(_0x3588fb){return{'model':db[_0x3588fb[_0xd77e('0x25')]],'as':_0x3588fb['as'],'attributes':_0x3588fb[_0xd77e('0x26')]};}):[]};}):[]};}):[]:[]})[_0xd77e('0x12')](function(_0x1201dd){logger[_0xd77e('0x13')](_0xd77e('0x27'),_0x35c59f);logger['debug'](_0xd77e('0x27'),_0x35c59f,JSON['stringify'](_0x1201dd));_0x499989(_0x1201dd);})[_0xd77e('0x1d')](function(_0x2381a9){logger[_0xd77e('0x18')]('ShowFaxQueue',_0x2381a9[_0xd77e('0x1b')],_0x35c59f);_0xb283dd(_0x310375[_0xd77e('0x18')](0x1f4,_0x2381a9[_0xd77e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 4e62344..8e73d5c 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 _0xa123=['length','faxQueue:','save','update','emit','removeListener','register'];(function(_0x1c2092,_0x34c981){var _0x23c77d=function(_0x5cef72){while(--_0x5cef72){_0x1c2092['push'](_0x1c2092['shift']());}};_0x23c77d(++_0x34c981);}(_0xa123,0x1c2));var _0x3a12=function(_0x225831,_0x3cc0d9){_0x225831=_0x225831-0x0;var _0x19341f=_0xa123[_0x225831];return _0x19341f;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x3a12('0x0'),'remove',_0x3a12('0x1')];function createListener(_0x22b4ae,_0x52e39d){return function(_0x34225e){_0x52e39d[_0x3a12('0x2')](_0x22b4ae,_0x34225e);};}function removeListener(_0x36d699,_0x540e72){return function(){FaxQueueEvents[_0x3a12('0x3')](_0x36d699,_0x540e72);};}exports[_0x3a12('0x4')]=function(_0x51723e){for(var _0x22dd8a=0x0,_0x2c3ce1=events[_0x3a12('0x5')];_0x22dd8a<_0x2c3ce1;_0x22dd8a++){var _0x4f90e8=events[_0x22dd8a];var _0x43da04=createListener(_0x3a12('0x6')+_0x4f90e8,_0x51723e);FaxQueueEvents['on'](_0x4f90e8,_0x43da04);}}; \ No newline at end of file +var _0x613d=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x36ac4b,_0x50e256){var _0x1df64d=function(_0x7e14e){while(--_0x7e14e){_0x36ac4b['push'](_0x36ac4b['shift']());}};_0x1df64d(++_0x50e256);}(_0x613d,0x177));var _0xd613=function(_0x1c7eaf,_0x1f7036){_0x1c7eaf=_0x1c7eaf-0x0;var _0x2a7d93=_0x613d[_0x1c7eaf];return _0x2a7d93;};'use strict';var FaxQueueEvents=require(_0xd613('0x0'));var events=[_0xd613('0x1'),_0xd613('0x2'),'update'];function createListener(_0x11f165,_0x42973d){return function(_0x2af6e7){_0x42973d['emit'](_0x11f165,_0x2af6e7);};}function removeListener(_0x47834d,_0x437799){return function(){FaxQueueEvents[_0xd613('0x3')](_0x47834d,_0x437799);};}exports[_0xd613('0x4')]=function(_0x16224b){for(var _0x17620b=0x0,_0x1b0c6c=events[_0xd613('0x5')];_0x17620b<_0x1b0c6c;_0x17620b++){var _0x371719=events[_0x17620b];var _0x50f748=createListener(_0xd613('0x6')+_0x371719,_0x16224b);FaxQueueEvents['on'](_0x371719,_0x50f748);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ce91d40..3434923 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 _0x3f8a=['delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','update'];(function(_0x61d2c5,_0x3841b8){var _0x4ee630=function(_0x56eb73){while(--_0x56eb73){_0x61d2c5['push'](_0x61d2c5['shift']());}};_0x4ee630(++_0x3841b8);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x507ccd,_0x54afc9){_0x507ccd=_0x507ccd-0x0;var _0x36887d=_0x3f8a[_0x507ccd];return _0x36887d;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xa')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router['get'](_0xa3f8('0x11'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);router[_0xa3f8('0xa')]('/:id/teams',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x13')]);router[_0xa3f8('0xa')](_0xa3f8('0x14'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x15')]);router[_0xa3f8('0x16')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x17')]);router[_0xa3f8('0x16')](_0xa3f8('0x18'),auth[_0xa3f8('0xb')](),controller['addTeams']);router[_0xa3f8('0x16')](_0xa3f8('0x14'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x19')]);router['put'](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x1a')]);router[_0xa3f8('0x1b')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x1c')]);router[_0xa3f8('0x1b')](_0xa3f8('0x18'),auth[_0xa3f8('0xb')](),controller['removeTeams']);router[_0xa3f8('0x1b')]('/:id/users',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x1d')]);module[_0xa3f8('0x1e')]=router; \ No newline at end of file +var _0xc6a2=['show','/:id/members','getMembers','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x6a621a,_0xf273aa){var _0x50bba5=function(_0x560de8){while(--_0x560de8){_0x6a621a['push'](_0x6a621a['shift']());}};_0x50bba5(++_0xf273aa);}(_0xc6a2,0x69));var _0x2c6a=function(_0x230e1e,_0x1f3496){_0x230e1e=_0x230e1e-0x0;var _0x396815=_0xc6a2[_0x230e1e];return _0x396815;};'use strict';var multer=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var path=require('path');var timeout=require(_0x2c6a('0x2'));var express=require(_0x2c6a('0x3'));var router=express[_0x2c6a('0x4')]();var fs_extra=require(_0x2c6a('0x5'));var auth=require(_0x2c6a('0x6'));var interaction=require(_0x2c6a('0x7'));var config=require(_0x2c6a('0x8'));var controller=require(_0x2c6a('0x9'));router[_0x2c6a('0xa')]('/',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xc')]);router[_0x2c6a('0xa')](_0x2c6a('0xd'),auth[_0x2c6a('0xb')](),controller['describe']);router[_0x2c6a('0xa')](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xf')]);router[_0x2c6a('0xa')](_0x2c6a('0x10'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x11')]);router['get']('/:id/teams',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x12')]);router[_0x2c6a('0xa')](_0x2c6a('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x2c6a('0x14')]('/',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x15')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x2c6a('0x16')]);router[_0x2c6a('0x14')](_0x2c6a('0x13'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x17')]);router[_0x2c6a('0x18')](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x19')]);router['delete'](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller['destroy']);router[_0x2c6a('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2c6a('0x1b')]);router[_0x2c6a('0x1a')](_0x2c6a('0x13'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x1c')]);module[_0x2c6a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index b0774d1..bad2acc 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 _0x6761=['moment','exports','STRING','DATE'];(function(_0x2dc80f,_0x2539da){var _0x321b57=function(_0xc086){while(--_0xc086){_0x2dc80f['push'](_0x2dc80f['shift']());}};_0x321b57(++_0x2539da);}(_0x6761,0xc0));var _0x1676=function(_0x3f4a89,_0x2546ab){_0x3f4a89=_0x3f4a89-0x0;var _0x1c6d0a=_0x6761[_0x3f4a89];return _0x1c6d0a;};'use strict';var moment=require(_0x1676('0x0'));var Sequelize=require('sequelize');module[_0x1676('0x1')]={'uniqueid':{'type':Sequelize[_0x1676('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1676('0x2')]},'joinAt':{'type':Sequelize[_0x1676('0x3')]},'leaveAt':{'type':Sequelize[_0x1676('0x3')]},'acceptAt':{'type':Sequelize[_0x1676('0x3')]},'exitAt':{'type':Sequelize[_0x1676('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x68c3=['moment','sequelize','exports','STRING','DATE'];(function(_0x525c8f,_0x2efa60){var _0x1690a1=function(_0x5d7113){while(--_0x5d7113){_0x525c8f['push'](_0x525c8f['shift']());}};_0x1690a1(++_0x2efa60);}(_0x68c3,0xdc));var _0x368c=function(_0x2d239f,_0x167856){_0x2d239f=_0x2d239f-0x0;var _0x1ca993=_0x68c3[_0x2d239f];return _0x1ca993;};'use strict';var moment=require(_0x368c('0x0'));var Sequelize=require(_0x368c('0x1'));module[_0x368c('0x2')]={'uniqueid':{'type':Sequelize[_0x368c('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x368c('0x4')]},'leaveAt':{'type':Sequelize[_0x368c('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x368c('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index d6479df..ff7d87f 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 _0x8b7c=['end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxQueueReport','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x1c075e,_0x575ba3){var _0x2a21a4=function(_0x1156af){while(--_0x1156af){_0x1c075e['push'](_0x1c075e['shift']());}};_0x2a21a4(++_0x575ba3);}(_0x8b7c,0x119));var _0xc8b7=function(_0x469a2d,_0x53bcbe){_0x469a2d=_0x469a2d-0x0;var _0x148147=_0x8b7c[_0x469a2d];return _0x148147;};'use strict';var emlformat=require(_0xc8b7('0x0'));var rimraf=require(_0xc8b7('0x1'));var zipdir=require(_0xc8b7('0x2'));var jsonpatch=require(_0xc8b7('0x3'));var rp=require(_0xc8b7('0x4'));var moment=require(_0xc8b7('0x5'));var BPromise=require(_0xc8b7('0x6'));var Mustache=require(_0xc8b7('0x7'));var util=require('util');var path=require(_0xc8b7('0x8'));var sox=require(_0xc8b7('0x9'));var csv=require(_0xc8b7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8b7('0xb'));var _=require(_0xc8b7('0xc'));var squel=require(_0xc8b7('0xd'));var crypto=require(_0xc8b7('0xe'));var jsforce=require(_0xc8b7('0xf'));var deskjs=require(_0xc8b7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc8b7('0x11'));var Papa=require('papaparse');var Redis=require(_0xc8b7('0x12'));var authService=require(_0xc8b7('0x13'));var qs=require(_0xc8b7('0x14'));var as=require(_0xc8b7('0x15'));var hardwareService=require(_0xc8b7('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc8b7('0x17'));var licenseUtil=require(_0xc8b7('0x18'));var db=require(_0xc8b7('0x19'))['db'];function respondWithStatusCode(_0x21ec4f,_0x5063ad){_0x5063ad=_0x5063ad||0xcc;return function(_0x5495e9){if(_0x5495e9){return _0x21ec4f['sendStatus'](_0x5063ad);}return _0x21ec4f[_0xc8b7('0x1a')](_0x5063ad)[_0xc8b7('0x1b')]();};}function respondWithResult(_0x38da92,_0x5c6e5b){_0x5c6e5b=_0x5c6e5b||0xc8;return function(_0x19d3ea){if(_0x19d3ea){return _0x38da92[_0xc8b7('0x1a')](_0x5c6e5b)[_0xc8b7('0x1c')](_0x19d3ea);}};}function respondWithFilteredResult(_0x1b7dc0,_0x3d189e){return function(_0x5d412e){if(_0x5d412e){var _0xb53183=typeof _0x3d189e[_0xc8b7('0x1d')]===_0xc8b7('0x1e')&&typeof _0x3d189e[_0xc8b7('0x1f')]===_0xc8b7('0x1e');var _0x186dbd=_0x5d412e[_0xc8b7('0x20')];var _0x485415=_0xb53183?0x0:_0x3d189e['offset'];var _0x1cf47c=_0xb53183?_0x5d412e[_0xc8b7('0x20')]:_0x3d189e[_0xc8b7('0x1d')]+_0x3d189e['limit'];var _0x5df9f7;if(_0x1cf47c>=_0x186dbd){_0x1cf47c=_0x186dbd;_0x5df9f7=0xc8;}else{_0x5df9f7=0xce;}_0x1b7dc0[_0xc8b7('0x1a')](_0x5df9f7);return _0x1b7dc0['set'](_0xc8b7('0x21'),_0x485415+'-'+_0x1cf47c+'/'+_0x186dbd)['json'](_0x5d412e);}return null;};}function patchUpdates(_0x462cce){return function(_0x3b39a3){try{jsonpatch['apply'](_0x3b39a3,_0x462cce,!![]);}catch(_0x298e69){return BPromise['reject'](_0x298e69);}return _0x3b39a3[_0xc8b7('0x22')]();};}function saveUpdates(_0x431163,_0x456eea){return function(_0x5e11cd){if(_0x5e11cd){return _0x5e11cd[_0xc8b7('0x23')](_0x431163)[_0xc8b7('0x24')](function(_0x4065d9){return _0x4065d9;});}return null;};}function removeEntity(_0x5b28ad,_0x3b0e47){return function(_0x191c12){if(_0x191c12){return _0x191c12[_0xc8b7('0x25')]()[_0xc8b7('0x24')](function(){_0x5b28ad[_0xc8b7('0x1a')](0xcc)[_0xc8b7('0x1b')]();});}};}function handleEntityNotFound(_0x2acda2,_0x1c119f){return function(_0x11f863){if(!_0x11f863){_0x2acda2[_0xc8b7('0x26')](0x194);}return _0x11f863;};}function handleError(_0x1439ee,_0x50a33d){_0x50a33d=_0x50a33d||0x1f4;return function(_0x28e65d){logger[_0xc8b7('0x27')](_0x28e65d[_0xc8b7('0x28')]);if(_0x28e65d[_0xc8b7('0x29')]){delete _0x28e65d[_0xc8b7('0x29')];}_0x1439ee[_0xc8b7('0x1a')](_0x50a33d)['send'](_0x28e65d);};}exports['index']=function(_0x16cc83,_0x13ac30){var _0x1eff90={},_0x2a2b25={},_0x24b0b1={'count':0x0,'rows':[]};var _0x17cae3=_[_0xc8b7('0x2a')](db['FaxQueueReport'][_0xc8b7('0x2b')],function(_0x3d6f00){return{'name':_0x3d6f00[_0xc8b7('0x2c')],'type':_0x3d6f00[_0xc8b7('0x2d')][_0xc8b7('0x2e')]};});_0x2a2b25[_0xc8b7('0x2f')]=_[_0xc8b7('0x2a')](_0x17cae3,_0xc8b7('0x29'));_0x2a2b25['query']=_[_0xc8b7('0x30')](_0x16cc83[_0xc8b7('0x31')]);_0x2a2b25[_0xc8b7('0x32')]=_[_0xc8b7('0x33')](_0x2a2b25[_0xc8b7('0x2f')],_0x2a2b25[_0xc8b7('0x31')]);_0x1eff90[_0xc8b7('0x34')]=_[_0xc8b7('0x33')](_0x2a2b25[_0xc8b7('0x2f')],qs[_0xc8b7('0x35')](_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x35')]));_0x1eff90[_0xc8b7('0x34')]=_0x1eff90['attributes']['length']?_0x1eff90[_0xc8b7('0x34')]:_0x2a2b25['model'];if(!_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x36')](_0xc8b7('0x37'))){_0x1eff90[_0xc8b7('0x1f')]=qs[_0xc8b7('0x1f')](_0x16cc83['query'][_0xc8b7('0x1f')]);_0x1eff90['offset']=qs[_0xc8b7('0x1d')](_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x1d')]);}_0x1eff90[_0xc8b7('0x38')]=qs[_0xc8b7('0x39')](_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x39')]);_0x1eff90[_0xc8b7('0x3a')]=qs[_0xc8b7('0x32')](_[_0xc8b7('0x3b')](_0x16cc83[_0xc8b7('0x31')],_0x2a2b25[_0xc8b7('0x32')]),_0x17cae3);if(_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x3c')]){_0x1eff90[_0xc8b7('0x3a')]=_[_0xc8b7('0x3d')](_0x1eff90['where'],{'$or':_[_0xc8b7('0x2a')](_0x17cae3,function(_0x4a7169){if(_0x4a7169[_0xc8b7('0x2d')]!==_0xc8b7('0x3e')){var _0x2c2cf4={};_0x2c2cf4[_0x4a7169[_0xc8b7('0x29')]]={'$like':'%'+_0x16cc83['query'][_0xc8b7('0x3c')]+'%'};return _0x2c2cf4;}})});}_0x1eff90=_[_0xc8b7('0x3d')]({},_0x1eff90,_0x16cc83[_0xc8b7('0x3f')]);var _0x31f1c4={'where':_0x1eff90['where']};return db['FaxQueueReport'][_0xc8b7('0x20')](_0x31f1c4)[_0xc8b7('0x24')](function(_0x3a9551){_0x24b0b1['count']=_0x3a9551;if(_0x16cc83['query'][_0xc8b7('0x40')]){_0x1eff90[_0xc8b7('0x41')]=[{'all':!![]}];}return db[_0xc8b7('0x42')][_0xc8b7('0x43')](_0x1eff90);})[_0xc8b7('0x24')](function(_0x3ab722){_0x24b0b1[_0xc8b7('0x44')]=_0x3ab722;return _0x24b0b1;})[_0xc8b7('0x24')](respondWithFilteredResult(_0x13ac30,_0x1eff90))[_0xc8b7('0x45')](handleError(_0x13ac30,null));};exports[_0xc8b7('0x46')]=function(_0x131ae2,_0x53beea){var _0xf33dae={'raw':!![],'where':{'id':_0x131ae2['params']['id']}},_0x3d86af={};_0x3d86af['model']=_[_0xc8b7('0x30')](db[_0xc8b7('0x42')]['rawAttributes']);_0x3d86af[_0xc8b7('0x31')]=_[_0xc8b7('0x30')](_0x131ae2[_0xc8b7('0x31')]);_0x3d86af[_0xc8b7('0x32')]=_[_0xc8b7('0x33')](_0x3d86af[_0xc8b7('0x2f')],_0x3d86af[_0xc8b7('0x31')]);_0xf33dae[_0xc8b7('0x34')]=_[_0xc8b7('0x33')](_0x3d86af[_0xc8b7('0x2f')],qs[_0xc8b7('0x35')](_0x131ae2['query']['fields']));_0xf33dae[_0xc8b7('0x34')]=_0xf33dae['attributes'][_0xc8b7('0x47')]?_0xf33dae[_0xc8b7('0x34')]:_0x3d86af[_0xc8b7('0x2f')];if(_0x131ae2[_0xc8b7('0x31')][_0xc8b7('0x40')]){_0xf33dae[_0xc8b7('0x41')]=[{'all':!![]}];}_0xf33dae=_[_0xc8b7('0x3d')]({},_0xf33dae,_0x131ae2['options']);return db[_0xc8b7('0x42')][_0xc8b7('0x48')](_0xf33dae)[_0xc8b7('0x24')](handleEntityNotFound(_0x53beea,null))[_0xc8b7('0x24')](respondWithResult(_0x53beea,null))[_0xc8b7('0x45')](handleError(_0x53beea,null));};exports[_0xc8b7('0x49')]=function(_0x32d826,_0xccb0da){return db[_0xc8b7('0x42')][_0xc8b7('0x49')](_0x32d826[_0xc8b7('0x4a')],{})[_0xc8b7('0x24')](respondWithResult(_0xccb0da,0xc9))[_0xc8b7('0x45')](handleError(_0xccb0da,null));};exports[_0xc8b7('0x23')]=function(_0x493681,_0x3bd1c8){if(_0x493681[_0xc8b7('0x4a')]['id']){delete _0x493681[_0xc8b7('0x4a')]['id'];}return db[_0xc8b7('0x42')][_0xc8b7('0x48')]({'where':{'id':_0x493681['params']['id']}})[_0xc8b7('0x24')](handleEntityNotFound(_0x3bd1c8,null))[_0xc8b7('0x24')](saveUpdates(_0x493681['body'],null))[_0xc8b7('0x24')](respondWithResult(_0x3bd1c8,null))[_0xc8b7('0x45')](handleError(_0x3bd1c8,null));};exports[_0xc8b7('0x25')]=function(_0x7941a1,_0xc72a6){return db[_0xc8b7('0x42')]['find']({'where':{'id':_0x7941a1[_0xc8b7('0x4b')]['id']}})[_0xc8b7('0x24')](handleEntityNotFound(_0xc72a6,null))['then'](removeEntity(_0xc72a6,null))[_0xc8b7('0x45')](handleError(_0xc72a6,null));};exports[_0xc8b7('0x4c')]=function(_0x538958,_0x47e42c){return db[_0xc8b7('0x42')]['describe']()['then'](respondWithResult(_0x47e42c,null))[_0xc8b7('0x45')](handleError(_0x47e42c,null));}; \ No newline at end of file +var _0x946e=['status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','FaxQueueReport','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5bae06,_0x179fe4){var _0x4fddaf=function(_0x382567){while(--_0x382567){_0x5bae06['push'](_0x5bae06['shift']());}};_0x4fddaf(++_0x179fe4);}(_0x946e,0x1d0));var _0xe946=function(_0x12cd26,_0x4bf06f){_0x12cd26=_0x12cd26-0x0;var _0x56ee53=_0x946e[_0x12cd26];return _0x56ee53;};'use strict';var emlformat=require(_0xe946('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe946('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe946('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe946('0x3'));var util=require(_0xe946('0x4'));var path=require(_0xe946('0x5'));var sox=require(_0xe946('0x6'));var csv=require(_0xe946('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe946('0x8'));var _=require(_0xe946('0x9'));var squel=require(_0xe946('0xa'));var crypto=require('crypto');var jsforce=require(_0xe946('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe946('0x7'));var querystring=require(_0xe946('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe946('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe946('0xe'))(_0xe946('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe946('0x10'));var db=require(_0xe946('0x11'))['db'];function respondWithStatusCode(_0x5d752c,_0x28cacf){_0x28cacf=_0x28cacf||0xcc;return function(_0x1cc263){if(_0x1cc263){return _0x5d752c[_0xe946('0x12')](_0x28cacf);}return _0x5d752c[_0xe946('0x13')](_0x28cacf)[_0xe946('0x14')]();};}function respondWithResult(_0x7c5262,_0x3eba3c){_0x3eba3c=_0x3eba3c||0xc8;return function(_0x5d0038){if(_0x5d0038){return _0x7c5262['status'](_0x3eba3c)[_0xe946('0x15')](_0x5d0038);}};}function respondWithFilteredResult(_0x2e66b8,_0x21af3e){return function(_0x551686){if(_0x551686){var _0x96f4f=typeof _0x21af3e[_0xe946('0x16')]===_0xe946('0x17')&&typeof _0x21af3e['limit']===_0xe946('0x17');var _0x1fbe13=_0x551686[_0xe946('0x18')];var _0x4d12f2=_0x96f4f?0x0:_0x21af3e[_0xe946('0x16')];var _0x3cde06=_0x96f4f?_0x551686['count']:_0x21af3e[_0xe946('0x16')]+_0x21af3e['limit'];var _0x1489f4;if(_0x3cde06>=_0x1fbe13){_0x3cde06=_0x1fbe13;_0x1489f4=0xc8;}else{_0x1489f4=0xce;}_0x2e66b8[_0xe946('0x13')](_0x1489f4);return _0x2e66b8['set'](_0xe946('0x19'),_0x4d12f2+'-'+_0x3cde06+'/'+_0x1fbe13)[_0xe946('0x15')](_0x551686);}return null;};}function patchUpdates(_0x407d54){return function(_0x957a6c){try{jsonpatch[_0xe946('0x1a')](_0x957a6c,_0x407d54,!![]);}catch(_0x29fa47){return BPromise[_0xe946('0x1b')](_0x29fa47);}return _0x957a6c[_0xe946('0x1c')]();};}function saveUpdates(_0x2c7c78,_0x21b7ce){return function(_0x5c0f83){if(_0x5c0f83){return _0x5c0f83[_0xe946('0x1d')](_0x2c7c78)[_0xe946('0x1e')](function(_0x3d3ba6){return _0x3d3ba6;});}return null;};}function removeEntity(_0x25dbfb,_0x169eec){return function(_0xc4d186){if(_0xc4d186){return _0xc4d186['destroy']()[_0xe946('0x1e')](function(){_0x25dbfb[_0xe946('0x13')](0xcc)[_0xe946('0x14')]();});}};}function handleEntityNotFound(_0xd3d3b7,_0x1d2323){return function(_0x1eda89){if(!_0x1eda89){_0xd3d3b7[_0xe946('0x12')](0x194);}return _0x1eda89;};}function handleError(_0x73d63d,_0x1655a1){_0x1655a1=_0x1655a1||0x1f4;return function(_0x562508){logger[_0xe946('0x1f')](_0x562508[_0xe946('0x20')]);if(_0x562508[_0xe946('0x21')]){delete _0x562508[_0xe946('0x21')];}_0x73d63d[_0xe946('0x13')](_0x1655a1)[_0xe946('0x22')](_0x562508);};}exports['index']=function(_0x20366d,_0x435aa9){var _0x422beb={},_0x25682f={},_0x468a19={'count':0x0,'rows':[]};var _0x1e41d2=_[_0xe946('0x23')](db[_0xe946('0x24')]['rawAttributes'],function(_0x2e5ab0){return{'name':_0x2e5ab0[_0xe946('0x25')],'type':_0x2e5ab0['type'][_0xe946('0x26')]};});_0x25682f[_0xe946('0x27')]=_[_0xe946('0x23')](_0x1e41d2,_0xe946('0x21'));_0x25682f['query']=_[_0xe946('0x28')](_0x20366d[_0xe946('0x29')]);_0x25682f[_0xe946('0x2a')]=_[_0xe946('0x2b')](_0x25682f[_0xe946('0x27')],_0x25682f['query']);_0x422beb[_0xe946('0x2c')]=_[_0xe946('0x2b')](_0x25682f[_0xe946('0x27')],qs[_0xe946('0x2d')](_0x20366d[_0xe946('0x29')]['fields']));_0x422beb[_0xe946('0x2c')]=_0x422beb['attributes']['length']?_0x422beb[_0xe946('0x2c')]:_0x25682f['model'];if(!_0x20366d[_0xe946('0x29')][_0xe946('0x2e')](_0xe946('0x2f'))){_0x422beb['limit']=qs['limit'](_0x20366d['query']['limit']);_0x422beb[_0xe946('0x16')]=qs['offset'](_0x20366d[_0xe946('0x29')][_0xe946('0x16')]);}_0x422beb['order']=qs[_0xe946('0x30')](_0x20366d[_0xe946('0x29')][_0xe946('0x30')]);_0x422beb[_0xe946('0x31')]=qs['filters'](_[_0xe946('0x32')](_0x20366d[_0xe946('0x29')],_0x25682f[_0xe946('0x2a')]),_0x1e41d2);if(_0x20366d[_0xe946('0x29')][_0xe946('0x33')]){_0x422beb['where']=_[_0xe946('0x34')](_0x422beb[_0xe946('0x31')],{'$or':_[_0xe946('0x23')](_0x1e41d2,function(_0x23f49f){if(_0x23f49f[_0xe946('0x35')]!==_0xe946('0x36')){var _0x37d650={};_0x37d650[_0x23f49f[_0xe946('0x21')]]={'$like':'%'+_0x20366d['query'][_0xe946('0x33')]+'%'};return _0x37d650;}})});}_0x422beb=_[_0xe946('0x34')]({},_0x422beb,_0x20366d[_0xe946('0x37')]);var _0x429dff={'where':_0x422beb[_0xe946('0x31')]};return db[_0xe946('0x24')][_0xe946('0x18')](_0x429dff)[_0xe946('0x1e')](function(_0x3e1e56){_0x468a19['count']=_0x3e1e56;if(_0x20366d[_0xe946('0x29')][_0xe946('0x38')]){_0x422beb[_0xe946('0x39')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xe946('0x3a')](_0x422beb);})['then'](function(_0x5e9829){_0x468a19[_0xe946('0x3b')]=_0x5e9829;return _0x468a19;})[_0xe946('0x1e')](respondWithFilteredResult(_0x435aa9,_0x422beb))[_0xe946('0x3c')](handleError(_0x435aa9,null));};exports['show']=function(_0x1fd508,_0x13f2ea){var _0x332903={'raw':!![],'where':{'id':_0x1fd508[_0xe946('0x3d')]['id']}},_0x589362={};_0x589362[_0xe946('0x27')]=_[_0xe946('0x28')](db[_0xe946('0x24')][_0xe946('0x3e')]);_0x589362[_0xe946('0x29')]=_['keys'](_0x1fd508[_0xe946('0x29')]);_0x589362['filters']=_[_0xe946('0x2b')](_0x589362[_0xe946('0x27')],_0x589362[_0xe946('0x29')]);_0x332903[_0xe946('0x2c')]=_['intersection'](_0x589362[_0xe946('0x27')],qs[_0xe946('0x2d')](_0x1fd508['query'][_0xe946('0x2d')]));_0x332903[_0xe946('0x2c')]=_0x332903[_0xe946('0x2c')][_0xe946('0x3f')]?_0x332903[_0xe946('0x2c')]:_0x589362[_0xe946('0x27')];if(_0x1fd508['query']['includeAll']){_0x332903[_0xe946('0x39')]=[{'all':!![]}];}_0x332903=_[_0xe946('0x34')]({},_0x332903,_0x1fd508[_0xe946('0x37')]);return db['FaxQueueReport'][_0xe946('0x40')](_0x332903)[_0xe946('0x1e')](handleEntityNotFound(_0x13f2ea,null))[_0xe946('0x1e')](respondWithResult(_0x13f2ea,null))['catch'](handleError(_0x13f2ea,null));};exports[_0xe946('0x41')]=function(_0x1e52bd,_0x5b0a43){return db[_0xe946('0x24')][_0xe946('0x41')](_0x1e52bd[_0xe946('0x42')],{})[_0xe946('0x1e')](respondWithResult(_0x5b0a43,0xc9))['catch'](handleError(_0x5b0a43,null));};exports['update']=function(_0x33031b,_0xb2f063){if(_0x33031b[_0xe946('0x42')]['id']){delete _0x33031b[_0xe946('0x42')]['id'];}return db['FaxQueueReport'][_0xe946('0x40')]({'where':{'id':_0x33031b[_0xe946('0x3d')]['id']}})['then'](handleEntityNotFound(_0xb2f063,null))[_0xe946('0x1e')](saveUpdates(_0x33031b[_0xe946('0x42')],null))['then'](respondWithResult(_0xb2f063,null))[_0xe946('0x3c')](handleError(_0xb2f063,null));};exports[_0xe946('0x43')]=function(_0x1c9e94,_0x3e3b63){return db[_0xe946('0x24')][_0xe946('0x40')]({'where':{'id':_0x1c9e94[_0xe946('0x3d')]['id']}})[_0xe946('0x1e')](handleEntityNotFound(_0x3e3b63,null))[_0xe946('0x1e')](removeEntity(_0x3e3b63,null))[_0xe946('0x3c')](handleError(_0x3e3b63,null));};exports[_0xe946('0x44')]=function(_0x1e6d7b,_0x54cfeb){return db[_0xe946('0x24')]['describe']()[_0xe946('0x1e')](respondWithResult(_0x54cfeb,null))[_0xe946('0x3c')](handleError(_0x54cfeb,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d46255c..6d9e77d 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 _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x2c0fe4,_0x3c60cc){var _0x19c3ed=function(_0x52ad20){while(--_0x52ad20){_0x2c0fe4['push'](_0x2c0fe4['shift']());}};_0x19c3ed(++_0x3c60cc);}(_0xe14b,0x93));var _0xbe14=function(_0x14e51e,_0x4da5a8){_0x14e51e=_0x14e51e-0x0;var _0x1186ed=_0xe14b[_0x14e51e];return _0x1186ed;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x3ff235,_0x428b4d){var _0x409302=function(_0x4ef822){while(--_0x4ef822){_0x3ff235['push'](_0x3ff235['shift']());}};_0x409302(++_0x428b4d);}(_0xe14b,0x93));var _0xbe14=function(_0xf66ac2,_0x4e4a4c){_0xf66ac2=_0xf66ac2-0x0;var _0x567ff1=_0xe14b[_0xf66ac2];return _0x567ff1;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b32d661..8c35a5c 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 _0xb40c=['FaxQueueReport','create','options','raw','stringify','UpdateFaxQueueReport','update','body','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport'];(function(_0x16b64b,_0x1b6804){var _0x32cc30=function(_0x1d9caa){while(--_0x1d9caa){_0x16b64b['push'](_0x16b64b['shift']());}};_0x32cc30(++_0x1b6804);}(_0xb40c,0xd1));var _0xcb40=function(_0x40b296,_0x285040){_0x40b296=_0x40b296-0x0;var _0x3d5022=_0xb40c[_0x40b296];return _0x3d5022;};'use strict';var _=require('lodash');var util=require(_0xcb40('0x0'));var moment=require(_0xcb40('0x1'));var BPromise=require(_0xcb40('0x2'));var rs=require(_0xcb40('0x3'));var fs=require('fs');var Redis=require(_0xcb40('0x4'));var db=require(_0xcb40('0x5'))['db'];var utils=require(_0xcb40('0x6'));var logger=require(_0xcb40('0x7'))('rpc');var config=require(_0xcb40('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcb40('0x9')][_0xcb40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130a43,_0x47f3f8,_0x147ee8){return new BPromise(function(_0x3870cf,_0x538563){return client[_0xcb40('0xb')](_0x130a43,_0x147ee8)[_0xcb40('0xc')](function(_0xe326b6){logger[_0xcb40('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x47f3f8,'request\x20sent');logger[_0xcb40('0xe')](_0xcb40('0xf'),_0x47f3f8,'request\x20sent',JSON['stringify'](_0xe326b6));if(_0xe326b6[_0xcb40('0x10')]){if(_0xe326b6[_0xcb40('0x10')]['code']===0x1f4){logger[_0xcb40('0x10')](_0xcb40('0x11'),_0x47f3f8,_0xe326b6['error'][_0xcb40('0x12')]);return _0x538563(_0xe326b6[_0xcb40('0x10')][_0xcb40('0x12')]);}logger[_0xcb40('0x10')](_0xcb40('0x11'),_0x47f3f8,_0xe326b6[_0xcb40('0x10')][_0xcb40('0x12')]);return _0x3870cf(_0xe326b6[_0xcb40('0x10')][_0xcb40('0x12')]);}else{logger[_0xcb40('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x47f3f8,'request\x20sent');_0x3870cf(_0xe326b6[_0xcb40('0x13')]['message']);}})[_0xcb40('0x14')](function(_0x418176){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x47f3f8,_0x418176);_0x538563(_0x418176);});});}exports[_0xcb40('0x15')]=function(_0x1d0f9b){var _0x211705=this;return new Promise(function(_0x5641ed,_0x5caa59){return db[_0xcb40('0x16')][_0xcb40('0x17')](_0x1d0f9b['body'],{'raw':_0x1d0f9b[_0xcb40('0x18')]?_0x1d0f9b[_0xcb40('0x18')][_0xcb40('0x19')]===undefined?!![]:![]:!![]})[_0xcb40('0xc')](function(_0x124ce7){logger[_0xcb40('0xd')]('CreateFaxQueueReport',_0x1d0f9b);logger['debug'](_0xcb40('0x15'),_0x1d0f9b,JSON[_0xcb40('0x1a')](_0x124ce7));_0x5641ed(_0x124ce7);})[_0xcb40('0x14')](function(_0x180cd3){logger[_0xcb40('0x10')](_0xcb40('0x15'),_0x180cd3[_0xcb40('0x12')],_0x1d0f9b);_0x5caa59(_0x211705['error'](0x1f4,_0x180cd3[_0xcb40('0x12')]));});});};exports[_0xcb40('0x1b')]=function(_0xab1ef){var _0x410868=this;return new Promise(function(_0xaa2c2d,_0x471500){return db['FaxQueueReport'][_0xcb40('0x1c')](_0xab1ef[_0xcb40('0x1d')],{'raw':_0xab1ef[_0xcb40('0x18')]?_0xab1ef[_0xcb40('0x18')][_0xcb40('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xab1ef['options']?_0xab1ef['options'][_0xcb40('0x1e')]||null:null,'attributes':_0xab1ef['options']?_0xab1ef[_0xcb40('0x18')][_0xcb40('0x1f')]||null:null,'limit':_0xab1ef[_0xcb40('0x18')]?_0xab1ef[_0xcb40('0x18')][_0xcb40('0x20')]||null:null})['then'](function(_0x40553d){logger[_0xcb40('0xd')]('UpdateFaxQueueReport',_0xab1ef);logger[_0xcb40('0xe')](_0xcb40('0x1b'),_0xab1ef,JSON[_0xcb40('0x1a')](_0x40553d));_0xaa2c2d(_0x40553d);})[_0xcb40('0x14')](function(_0x36d521){logger['error'](_0xcb40('0x1b'),_0x36d521[_0xcb40('0x12')],_0xab1ef);_0x471500(_0x410868[_0xcb40('0x10')](0x1f4,_0x36d521[_0xcb40('0x12')]));});});}; \ No newline at end of file +var _0x5440=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','stringify','UpdateFaxQueueReport','update','where','util','moment','bluebird'];(function(_0x3bc390,_0x319e8e){var _0x474ee9=function(_0x2a69fa){while(--_0x2a69fa){_0x3bc390['push'](_0x3bc390['shift']());}};_0x474ee9(++_0x319e8e);}(_0x5440,0xa5));var _0x0544=function(_0x1137b1,_0x59e97b){_0x1137b1=_0x1137b1-0x0;var _0x31a316=_0x5440[_0x1137b1];return _0x31a316;};'use strict';var _=require('lodash');var util=require(_0x0544('0x0'));var moment=require(_0x0544('0x1'));var BPromise=require(_0x0544('0x2'));var rs=require(_0x0544('0x3'));var fs=require('fs');var Redis=require(_0x0544('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0544('0x5'))(_0x0544('0x6'));var config=require(_0x0544('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0544('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12a186,_0x462748,_0x1dca16){return new BPromise(function(_0x4b7f6b,_0x10f95e){return client[_0x0544('0x9')](_0x12a186,_0x1dca16)[_0x0544('0xa')](function(_0xf3252e){logger[_0x0544('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x462748,_0x0544('0xc'));logger[_0x0544('0xd')](_0x0544('0xe'),_0x462748,'request\x20sent',JSON['stringify'](_0xf3252e));if(_0xf3252e[_0x0544('0xf')]){if(_0xf3252e['error']['code']===0x1f4){logger[_0x0544('0xf')](_0x0544('0x10'),_0x462748,_0xf3252e['error'][_0x0544('0x11')]);return _0x10f95e(_0xf3252e['error'][_0x0544('0x11')]);}logger[_0x0544('0xf')](_0x0544('0x10'),_0x462748,_0xf3252e['error'][_0x0544('0x11')]);return _0x4b7f6b(_0xf3252e[_0x0544('0xf')][_0x0544('0x11')]);}else{logger['info'](_0x0544('0x10'),_0x462748,_0x0544('0xc'));_0x4b7f6b(_0xf3252e[_0x0544('0x12')][_0x0544('0x11')]);}})[_0x0544('0x13')](function(_0x3b9e2b){logger[_0x0544('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x462748,_0x3b9e2b);_0x10f95e(_0x3b9e2b);});});}exports[_0x0544('0x14')]=function(_0x3f8a56){var _0x209457=this;return new Promise(function(_0x200d84,_0x2b4bf1){return db[_0x0544('0x15')]['create'](_0x3f8a56['body'],{'raw':_0x3f8a56[_0x0544('0x16')]?_0x3f8a56[_0x0544('0x16')][_0x0544('0x17')]===undefined?!![]:![]:!![]})[_0x0544('0xa')](function(_0xb4f7fa){logger['info']('CreateFaxQueueReport',_0x3f8a56);logger[_0x0544('0xd')](_0x0544('0x14'),_0x3f8a56,JSON[_0x0544('0x18')](_0xb4f7fa));_0x200d84(_0xb4f7fa);})[_0x0544('0x13')](function(_0x5da86c){logger[_0x0544('0xf')](_0x0544('0x14'),_0x5da86c[_0x0544('0x11')],_0x3f8a56);_0x2b4bf1(_0x209457[_0x0544('0xf')](0x1f4,_0x5da86c[_0x0544('0x11')]));});});};exports[_0x0544('0x19')]=function(_0x43b26e){var _0x2fff18=this;return new Promise(function(_0x5cc5df,_0x1278a4){return db['FaxQueueReport'][_0x0544('0x1a')](_0x43b26e['body'],{'raw':_0x43b26e[_0x0544('0x16')]?_0x43b26e[_0x0544('0x16')][_0x0544('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43b26e[_0x0544('0x16')]?_0x43b26e[_0x0544('0x16')][_0x0544('0x1b')]||null:null,'attributes':_0x43b26e[_0x0544('0x16')]?_0x43b26e[_0x0544('0x16')]['attributes']||null:null,'limit':_0x43b26e[_0x0544('0x16')]?_0x43b26e['options']['limit']||null:null})[_0x0544('0xa')](function(_0x2d65d4){logger[_0x0544('0xb')](_0x0544('0x19'),_0x43b26e);logger[_0x0544('0xd')](_0x0544('0x19'),_0x43b26e,JSON[_0x0544('0x18')](_0x2d65d4));_0x5cc5df(_0x2d65d4);})[_0x0544('0x13')](function(_0x263700){logger['error'](_0x0544('0x19'),_0x263700[_0x0544('0x11')],_0x43b26e);_0x1278a4(_0x2fff18[_0x0544('0xf')](0x1f4,_0x263700[_0x0544('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c1f68f3..703f17e 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 _0x3852=['./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3ebbf2,_0x29ffc3){var _0x5a666b=function(_0x483ef1){while(--_0x483ef1){_0x3ebbf2['push'](_0x3ebbf2['shift']());}};_0x5a666b(++_0x29ffc3);}(_0x3852,0xbf));var _0x2385=function(_0x3abd91,_0x24626c){_0x3abd91=_0x3abd91-0x0;var _0x448191=_0x3852[_0x3abd91];return _0x448191;};'use strict';var multer=require(_0x2385('0x0'));var util=require('util');var path=require(_0x2385('0x1'));var timeout=require(_0x2385('0x2'));var express=require('express');var router=express[_0x2385('0x3')]();var fs_extra=require(_0x2385('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2385('0x5'));var config=require(_0x2385('0x6'));var controller=require(_0x2385('0x7'));router[_0x2385('0x8')]('/',auth[_0x2385('0x9')](),controller[_0x2385('0xa')]);router[_0x2385('0x8')]('/describe',auth[_0x2385('0x9')](),controller[_0x2385('0xb')]);router[_0x2385('0x8')](_0x2385('0xc'),auth[_0x2385('0x9')](),controller[_0x2385('0xd')]);router[_0x2385('0xe')]('/',auth[_0x2385('0x9')](),controller['create']);router[_0x2385('0xf')]('/:id',auth[_0x2385('0x9')](),controller[_0x2385('0x10')]);router[_0x2385('0x11')]('/:id',auth[_0x2385('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfaf7=['/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','isAuthenticated','describe'];(function(_0x43073b,_0x1e36e8){var _0x506dab=function(_0x46fb8c){while(--_0x46fb8c){_0x43073b['push'](_0x43073b['shift']());}};_0x506dab(++_0x1e36e8);}(_0xfaf7,0x182));var _0x7faf=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xfaf7[_0x42bdad];return _0x122626;};'use strict';var multer=require(_0x7faf('0x0'));var util=require(_0x7faf('0x1'));var path=require(_0x7faf('0x2'));var timeout=require('connect-timeout');var express=require(_0x7faf('0x3'));var router=express[_0x7faf('0x4')]();var fs_extra=require(_0x7faf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7faf('0x6'));var config=require(_0x7faf('0x7'));var controller=require(_0x7faf('0x8'));router[_0x7faf('0x9')]('/',auth['isAuthenticated'](),controller[_0x7faf('0xa')]);router[_0x7faf('0x9')]('/describe',auth[_0x7faf('0xb')](),controller[_0x7faf('0xc')]);router[_0x7faf('0x9')](_0x7faf('0xd'),auth[_0x7faf('0xb')](),controller[_0x7faf('0xe')]);router[_0x7faf('0xf')]('/',auth[_0x7faf('0xb')](),controller[_0x7faf('0x10')]);router[_0x7faf('0x11')](_0x7faf('0xd'),auth['isAuthenticated'](),controller[_0x7faf('0x12')]);router['delete'](_0x7faf('0xd'),auth[_0x7faf('0xb')](),controller[_0x7faf('0x13')]);module[_0x7faf('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f08d48e..fe22a21 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xeb26d1,_0x301de1){var _0x4a4e2e=function(_0xa3dad1){while(--_0xa3dad1){_0xeb26d1['push'](_0xeb26d1['shift']());}};_0x4a4e2e(++_0x301de1);}(_0x54ef,0x112));var _0xf54e=function(_0x14b50a,_0x8ddea5){_0x14b50a=_0x14b50a-0x0;var _0x3ad6fc=_0x54ef[_0x14b50a];return _0x3ad6fc;};'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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x35f660,_0x432102){var _0x3f55ef=function(_0x54b4b1){while(--_0x54b4b1){_0x35f660['push'](_0x35f660['shift']());}};_0x3f55ef(++_0x432102);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x4b84[_0x5027b1];return _0x4a46cf;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d77c60b..db0446a 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 _0xed94=['error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xed94,0x15a));var _0x4ed9=function(_0x4e5e6c,_0x959eb4){_0x4e5e6c=_0x4e5e6c-0x0;var _0xcf9053=_0xed94[_0x4e5e6c];return _0xcf9053;};'use strict';var emlformat=require(_0x4ed9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ed9('0x1'));var jsonpatch=require(_0x4ed9('0x2'));var rp=require(_0x4ed9('0x3'));var moment=require(_0x4ed9('0x4'));var BPromise=require(_0x4ed9('0x5'));var Mustache=require(_0x4ed9('0x6'));var util=require('util');var path=require(_0x4ed9('0x7'));var sox=require(_0x4ed9('0x8'));var csv=require(_0x4ed9('0x9'));var ejs=require(_0x4ed9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ed9('0xb'));var squel=require(_0x4ed9('0xc'));var crypto=require(_0x4ed9('0xd'));var jsforce=require(_0x4ed9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4ed9('0x9'));var querystring=require(_0x4ed9('0xf'));var Papa=require(_0x4ed9('0x10'));var Redis=require(_0x4ed9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ed9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ed9('0x13'));var logger=require('../../config/logger')(_0x4ed9('0x14'));var utils=require(_0x4ed9('0x15'));var config=require(_0x4ed9('0x16'));var licenseUtil=require(_0x4ed9('0x17'));var db=require(_0x4ed9('0x18'))['db'];function respondWithStatusCode(_0x544d8f,_0x5ac190){_0x5ac190=_0x5ac190||0xcc;return function(_0x24799f){if(_0x24799f){return _0x544d8f[_0x4ed9('0x19')](_0x5ac190);}return _0x544d8f[_0x4ed9('0x1a')](_0x5ac190)[_0x4ed9('0x1b')]();};}function respondWithResult(_0x3576a7,_0x110ead){_0x110ead=_0x110ead||0xc8;return function(_0x1fcf41){if(_0x1fcf41){return _0x3576a7[_0x4ed9('0x1a')](_0x110ead)[_0x4ed9('0x1c')](_0x1fcf41);}};}function respondWithFilteredResult(_0x4704a4,_0x49fdad){return function(_0x322449){if(_0x322449){var _0x9afaa2=typeof _0x49fdad[_0x4ed9('0x1d')]===_0x4ed9('0x1e')&&typeof _0x49fdad[_0x4ed9('0x1f')]===_0x4ed9('0x1e');var _0x3841ef=_0x322449[_0x4ed9('0x20')];var _0x292557=_0x9afaa2?0x0:_0x49fdad[_0x4ed9('0x1d')];var _0xceda59=_0x9afaa2?_0x322449[_0x4ed9('0x20')]:_0x49fdad[_0x4ed9('0x1d')]+_0x49fdad[_0x4ed9('0x1f')];var _0x3d9de1;if(_0xceda59>=_0x3841ef){_0xceda59=_0x3841ef;_0x3d9de1=0xc8;}else{_0x3d9de1=0xce;}_0x4704a4['status'](_0x3d9de1);return _0x4704a4[_0x4ed9('0x21')](_0x4ed9('0x22'),_0x292557+'-'+_0xceda59+'/'+_0x3841ef)[_0x4ed9('0x1c')](_0x322449);}return null;};}function patchUpdates(_0x1e5c75){return function(_0x2d0940){try{jsonpatch[_0x4ed9('0x23')](_0x2d0940,_0x1e5c75,!![]);}catch(_0x52f7d8){return BPromise['reject'](_0x52f7d8);}return _0x2d0940[_0x4ed9('0x24')]();};}function saveUpdates(_0x1e7713,_0x4eac26){return function(_0x4f4c96){if(_0x4f4c96){return _0x4f4c96[_0x4ed9('0x25')](_0x1e7713)['then'](function(_0x268c9a){return _0x268c9a;});}return null;};}function removeEntity(_0xdb8eae,_0x39d6ca){return function(_0x341d02){if(_0x341d02){return _0x341d02[_0x4ed9('0x26')]()['then'](function(){_0xdb8eae[_0x4ed9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c424,_0x51f848){return function(_0x16bea6){if(!_0x16bea6){_0x48c424['sendStatus'](0x194);}return _0x16bea6;};}function handleError(_0x122d68,_0x1d98d2){_0x1d98d2=_0x1d98d2||0x1f4;return function(_0x5cf016){logger[_0x4ed9('0x27')](_0x5cf016[_0x4ed9('0x28')]);if(_0x5cf016['name']){delete _0x5cf016[_0x4ed9('0x29')];}_0x122d68[_0x4ed9('0x1a')](_0x1d98d2)[_0x4ed9('0x2a')](_0x5cf016);};}exports[_0x4ed9('0x2b')]=function(_0x3d9c5e,_0x582a3d){var _0x208454={},_0x32085e={},_0x5b10e3={'count':0x0,'rows':[]};var _0x2418f8=_[_0x4ed9('0x2c')](db[_0x4ed9('0x2d')][_0x4ed9('0x2e')],function(_0xa816){return{'name':_0xa816[_0x4ed9('0x2f')],'type':_0xa816[_0x4ed9('0x30')][_0x4ed9('0x31')]};});_0x32085e[_0x4ed9('0x32')]=_['map'](_0x2418f8,_0x4ed9('0x29'));_0x32085e[_0x4ed9('0x33')]=_[_0x4ed9('0x34')](_0x3d9c5e[_0x4ed9('0x33')]);_0x32085e['filters']=_['intersection'](_0x32085e[_0x4ed9('0x32')],_0x32085e['query']);_0x208454[_0x4ed9('0x35')]=_[_0x4ed9('0x36')](_0x32085e[_0x4ed9('0x32')],qs[_0x4ed9('0x37')](_0x3d9c5e['query']['fields']));_0x208454['attributes']=_0x208454[_0x4ed9('0x35')][_0x4ed9('0x38')]?_0x208454[_0x4ed9('0x35')]:_0x32085e[_0x4ed9('0x32')];if(!_0x3d9c5e[_0x4ed9('0x33')]['hasOwnProperty'](_0x4ed9('0x39'))){_0x208454[_0x4ed9('0x1f')]=qs[_0x4ed9('0x1f')](_0x3d9c5e['query']['limit']);_0x208454[_0x4ed9('0x1d')]=qs[_0x4ed9('0x1d')](_0x3d9c5e[_0x4ed9('0x33')][_0x4ed9('0x1d')]);}_0x208454[_0x4ed9('0x3a')]=qs[_0x4ed9('0x3b')](_0x3d9c5e['query'][_0x4ed9('0x3b')]);_0x208454[_0x4ed9('0x3c')]=qs[_0x4ed9('0x3d')](_[_0x4ed9('0x3e')](_0x3d9c5e[_0x4ed9('0x33')],_0x32085e[_0x4ed9('0x3d')]),_0x2418f8);if(_0x3d9c5e[_0x4ed9('0x33')][_0x4ed9('0x3f')]){_0x208454[_0x4ed9('0x3c')]=_[_0x4ed9('0x40')](_0x208454['where'],{'$or':_[_0x4ed9('0x2c')](_0x2418f8,function(_0x1fe0ba){if(_0x1fe0ba[_0x4ed9('0x30')]!==_0x4ed9('0x41')){var _0x65f921={};_0x65f921[_0x1fe0ba[_0x4ed9('0x29')]]={'$like':'%'+_0x3d9c5e[_0x4ed9('0x33')][_0x4ed9('0x3f')]+'%'};return _0x65f921;}})});}_0x208454=_[_0x4ed9('0x40')]({},_0x208454,_0x3d9c5e[_0x4ed9('0x42')]);var _0x22f840={'where':_0x208454[_0x4ed9('0x3c')]};return db[_0x4ed9('0x2d')][_0x4ed9('0x20')](_0x22f840)[_0x4ed9('0x43')](function(_0x168699){_0x5b10e3[_0x4ed9('0x20')]=_0x168699;if(_0x3d9c5e[_0x4ed9('0x33')]['includeAll']){_0x208454[_0x4ed9('0x44')]=[{'all':!![]}];}return db[_0x4ed9('0x2d')][_0x4ed9('0x45')](_0x208454);})['then'](function(_0x16405f){_0x5b10e3[_0x4ed9('0x46')]=_0x16405f;return _0x5b10e3;})[_0x4ed9('0x43')](respondWithFilteredResult(_0x582a3d,_0x208454))[_0x4ed9('0x47')](handleError(_0x582a3d,null));};exports['show']=function(_0x337b6c,_0x56977e){var _0x16c654={'raw':!![],'where':{'id':_0x337b6c['params']['id']}},_0x3ee66a={};_0x3ee66a['model']=_[_0x4ed9('0x34')](db[_0x4ed9('0x2d')]['rawAttributes']);_0x3ee66a[_0x4ed9('0x33')]=_[_0x4ed9('0x34')](_0x337b6c[_0x4ed9('0x33')]);_0x3ee66a['filters']=_[_0x4ed9('0x36')](_0x3ee66a[_0x4ed9('0x32')],_0x3ee66a['query']);_0x16c654[_0x4ed9('0x35')]=_['intersection'](_0x3ee66a[_0x4ed9('0x32')],qs[_0x4ed9('0x37')](_0x337b6c['query'][_0x4ed9('0x37')]));_0x16c654[_0x4ed9('0x35')]=_0x16c654[_0x4ed9('0x35')]['length']?_0x16c654[_0x4ed9('0x35')]:_0x3ee66a[_0x4ed9('0x32')];if(_0x337b6c['query']['includeAll']){_0x16c654[_0x4ed9('0x44')]=[{'all':!![]}];}_0x16c654=_[_0x4ed9('0x40')]({},_0x16c654,_0x337b6c['options']);return db['FaxTransferReport'][_0x4ed9('0x48')](_0x16c654)[_0x4ed9('0x43')](handleEntityNotFound(_0x56977e,null))[_0x4ed9('0x43')](respondWithResult(_0x56977e,null))['catch'](handleError(_0x56977e,null));};exports['create']=function(_0x5e66a2,_0x115462){return db[_0x4ed9('0x2d')][_0x4ed9('0x49')](_0x5e66a2[_0x4ed9('0x4a')],{})[_0x4ed9('0x43')](respondWithResult(_0x115462,0xc9))[_0x4ed9('0x47')](handleError(_0x115462,null));};exports[_0x4ed9('0x25')]=function(_0x1cd9c1,_0x2b4dc0){if(_0x1cd9c1[_0x4ed9('0x4a')]['id']){delete _0x1cd9c1['body']['id'];}return db[_0x4ed9('0x2d')]['find']({'where':{'id':_0x1cd9c1[_0x4ed9('0x4b')]['id']}})[_0x4ed9('0x43')](handleEntityNotFound(_0x2b4dc0,null))[_0x4ed9('0x43')](saveUpdates(_0x1cd9c1[_0x4ed9('0x4a')],null))[_0x4ed9('0x43')](respondWithResult(_0x2b4dc0,null))['catch'](handleError(_0x2b4dc0,null));};exports[_0x4ed9('0x26')]=function(_0x5aa632,_0x4c96ad){return db[_0x4ed9('0x2d')][_0x4ed9('0x48')]({'where':{'id':_0x5aa632[_0x4ed9('0x4b')]['id']}})[_0x4ed9('0x43')](handleEntityNotFound(_0x4c96ad,null))[_0x4ed9('0x43')](removeEntity(_0x4c96ad,null))['catch'](handleError(_0x4c96ad,null));};exports[_0x4ed9('0x4c')]=function(_0x597ae0,_0x15ee54){return db['FaxTransferReport']['describe']()[_0x4ed9('0x43')](respondWithResult(_0x15ee54,null))[_0x4ed9('0x47')](handleError(_0x15ee54,null));}; \ No newline at end of file +var _0x7be7=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch'];(function(_0x4d9f96,_0x207365){var _0x196f9c=function(_0x408298){while(--_0x408298){_0x4d9f96['push'](_0x4d9f96['shift']());}};_0x196f9c(++_0x207365);}(_0x7be7,0x95));var _0x77be=function(_0x4e415f,_0x53f2df){_0x4e415f=_0x4e415f-0x0;var _0xdef903=_0x7be7[_0x4e415f];return _0xdef903;};'use strict';var emlformat=require(_0x77be('0x0'));var rimraf=require(_0x77be('0x1'));var zipdir=require(_0x77be('0x2'));var jsonpatch=require(_0x77be('0x3'));var rp=require('request-promise');var moment=require(_0x77be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77be('0x5'));var util=require(_0x77be('0x6'));var path=require(_0x77be('0x7'));var sox=require('sox');var csv=require(_0x77be('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77be('0x9'));var _=require(_0x77be('0xa'));var squel=require(_0x77be('0xb'));var crypto=require(_0x77be('0xc'));var jsforce=require(_0x77be('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x77be('0x8'));var querystring=require('querystring');var Papa=require(_0x77be('0xe'));var Redis=require(_0x77be('0xf'));var authService=require(_0x77be('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x77be('0x11'));var hardwareService=require(_0x77be('0x12'));var logger=require('../../config/logger')(_0x77be('0x13'));var utils=require(_0x77be('0x14'));var config=require(_0x77be('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b7fa7,_0x329207){_0x329207=_0x329207||0xcc;return function(_0x5a8c21){if(_0x5a8c21){return _0x3b7fa7[_0x77be('0x16')](_0x329207);}return _0x3b7fa7[_0x77be('0x17')](_0x329207)[_0x77be('0x18')]();};}function respondWithResult(_0x5c92a9,_0x17dbea){_0x17dbea=_0x17dbea||0xc8;return function(_0x303823){if(_0x303823){return _0x5c92a9[_0x77be('0x17')](_0x17dbea)[_0x77be('0x19')](_0x303823);}};}function respondWithFilteredResult(_0x5b7997,_0x3ce996){return function(_0x59579d){if(_0x59579d){var _0x2bf5dd=typeof _0x3ce996[_0x77be('0x1a')]===_0x77be('0x1b')&&typeof _0x3ce996['limit']===_0x77be('0x1b');var _0xc29d2c=_0x59579d[_0x77be('0x1c')];var _0x813bf7=_0x2bf5dd?0x0:_0x3ce996[_0x77be('0x1a')];var _0x42e21d=_0x2bf5dd?_0x59579d[_0x77be('0x1c')]:_0x3ce996['offset']+_0x3ce996[_0x77be('0x1d')];var _0x58ae30;if(_0x42e21d>=_0xc29d2c){_0x42e21d=_0xc29d2c;_0x58ae30=0xc8;}else{_0x58ae30=0xce;}_0x5b7997['status'](_0x58ae30);return _0x5b7997[_0x77be('0x1e')](_0x77be('0x1f'),_0x813bf7+'-'+_0x42e21d+'/'+_0xc29d2c)[_0x77be('0x19')](_0x59579d);}return null;};}function patchUpdates(_0x248bc2){return function(_0x493188){try{jsonpatch[_0x77be('0x20')](_0x493188,_0x248bc2,!![]);}catch(_0x3ab431){return BPromise[_0x77be('0x21')](_0x3ab431);}return _0x493188[_0x77be('0x22')]();};}function saveUpdates(_0x225d9e,_0x424843){return function(_0x5099e1){if(_0x5099e1){return _0x5099e1[_0x77be('0x23')](_0x225d9e)[_0x77be('0x24')](function(_0x3ca784){return _0x3ca784;});}return null;};}function removeEntity(_0x26f677,_0x58fd39){return function(_0x10514a){if(_0x10514a){return _0x10514a[_0x77be('0x25')]()[_0x77be('0x24')](function(){_0x26f677[_0x77be('0x17')](0xcc)[_0x77be('0x18')]();});}};}function handleEntityNotFound(_0x7e0003,_0x4ccf17){return function(_0x484ca5){if(!_0x484ca5){_0x7e0003[_0x77be('0x16')](0x194);}return _0x484ca5;};}function handleError(_0x1be726,_0x379800){_0x379800=_0x379800||0x1f4;return function(_0x1597d0){logger[_0x77be('0x26')](_0x1597d0['stack']);if(_0x1597d0[_0x77be('0x27')]){delete _0x1597d0[_0x77be('0x27')];}_0x1be726[_0x77be('0x17')](_0x379800)['send'](_0x1597d0);};}exports[_0x77be('0x28')]=function(_0x498742,_0x5c17dc){var _0xae696f={},_0x2b7682={},_0x90557f={'count':0x0,'rows':[]};var _0x4d68af=_[_0x77be('0x29')](db[_0x77be('0x2a')][_0x77be('0x2b')],function(_0x141279){return{'name':_0x141279['fieldName'],'type':_0x141279[_0x77be('0x2c')][_0x77be('0x2d')]};});_0x2b7682[_0x77be('0x2e')]=_[_0x77be('0x29')](_0x4d68af,_0x77be('0x27'));_0x2b7682[_0x77be('0x2f')]=_[_0x77be('0x30')](_0x498742[_0x77be('0x2f')]);_0x2b7682['filters']=_['intersection'](_0x2b7682['model'],_0x2b7682['query']);_0xae696f[_0x77be('0x31')]=_[_0x77be('0x32')](_0x2b7682[_0x77be('0x2e')],qs[_0x77be('0x33')](_0x498742['query'][_0x77be('0x33')]));_0xae696f['attributes']=_0xae696f[_0x77be('0x31')][_0x77be('0x34')]?_0xae696f[_0x77be('0x31')]:_0x2b7682['model'];if(!_0x498742[_0x77be('0x2f')][_0x77be('0x35')](_0x77be('0x36'))){_0xae696f['limit']=qs[_0x77be('0x1d')](_0x498742[_0x77be('0x2f')][_0x77be('0x1d')]);_0xae696f[_0x77be('0x1a')]=qs[_0x77be('0x1a')](_0x498742[_0x77be('0x2f')][_0x77be('0x1a')]);}_0xae696f['order']=qs['sort'](_0x498742['query'][_0x77be('0x37')]);_0xae696f[_0x77be('0x38')]=qs[_0x77be('0x39')](_[_0x77be('0x3a')](_0x498742[_0x77be('0x2f')],_0x2b7682[_0x77be('0x39')]),_0x4d68af);if(_0x498742[_0x77be('0x2f')][_0x77be('0x3b')]){_0xae696f[_0x77be('0x38')]=_[_0x77be('0x3c')](_0xae696f[_0x77be('0x38')],{'$or':_[_0x77be('0x29')](_0x4d68af,function(_0x13501e){if(_0x13501e['type']!=='VIRTUAL'){var _0x25086f={};_0x25086f[_0x13501e[_0x77be('0x27')]]={'$like':'%'+_0x498742['query']['filter']+'%'};return _0x25086f;}})});}_0xae696f=_[_0x77be('0x3c')]({},_0xae696f,_0x498742[_0x77be('0x3d')]);var _0x1bad9a={'where':_0xae696f[_0x77be('0x38')]};return db['FaxTransferReport'][_0x77be('0x1c')](_0x1bad9a)['then'](function(_0x1bc4e2){_0x90557f['count']=_0x1bc4e2;if(_0x498742[_0x77be('0x2f')]['includeAll']){_0xae696f[_0x77be('0x3e')]=[{'all':!![]}];}return db[_0x77be('0x2a')][_0x77be('0x3f')](_0xae696f);})['then'](function(_0x1c5550){_0x90557f[_0x77be('0x40')]=_0x1c5550;return _0x90557f;})[_0x77be('0x24')](respondWithFilteredResult(_0x5c17dc,_0xae696f))['catch'](handleError(_0x5c17dc,null));};exports[_0x77be('0x41')]=function(_0x20144e,_0x463e84){var _0x43dc51={'raw':!![],'where':{'id':_0x20144e[_0x77be('0x42')]['id']}},_0x2ffdf0={};_0x2ffdf0[_0x77be('0x2e')]=_[_0x77be('0x30')](db[_0x77be('0x2a')][_0x77be('0x2b')]);_0x2ffdf0[_0x77be('0x2f')]=_[_0x77be('0x30')](_0x20144e[_0x77be('0x2f')]);_0x2ffdf0[_0x77be('0x39')]=_[_0x77be('0x32')](_0x2ffdf0[_0x77be('0x2e')],_0x2ffdf0[_0x77be('0x2f')]);_0x43dc51[_0x77be('0x31')]=_['intersection'](_0x2ffdf0['model'],qs[_0x77be('0x33')](_0x20144e['query'][_0x77be('0x33')]));_0x43dc51[_0x77be('0x31')]=_0x43dc51[_0x77be('0x31')][_0x77be('0x34')]?_0x43dc51[_0x77be('0x31')]:_0x2ffdf0[_0x77be('0x2e')];if(_0x20144e[_0x77be('0x2f')][_0x77be('0x43')]){_0x43dc51[_0x77be('0x3e')]=[{'all':!![]}];}_0x43dc51=_[_0x77be('0x3c')]({},_0x43dc51,_0x20144e[_0x77be('0x3d')]);return db['FaxTransferReport'][_0x77be('0x44')](_0x43dc51)[_0x77be('0x24')](handleEntityNotFound(_0x463e84,null))[_0x77be('0x24')](respondWithResult(_0x463e84,null))[_0x77be('0x45')](handleError(_0x463e84,null));};exports[_0x77be('0x46')]=function(_0x6d7d4d,_0x32ea9d){return db[_0x77be('0x2a')][_0x77be('0x46')](_0x6d7d4d[_0x77be('0x47')],{})[_0x77be('0x24')](respondWithResult(_0x32ea9d,0xc9))[_0x77be('0x45')](handleError(_0x32ea9d,null));};exports['update']=function(_0x3b3b59,_0x1f073b){if(_0x3b3b59[_0x77be('0x47')]['id']){delete _0x3b3b59[_0x77be('0x47')]['id'];}return db['FaxTransferReport'][_0x77be('0x44')]({'where':{'id':_0x3b3b59[_0x77be('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f073b,null))['then'](saveUpdates(_0x3b3b59[_0x77be('0x47')],null))[_0x77be('0x24')](respondWithResult(_0x1f073b,null))[_0x77be('0x45')](handleError(_0x1f073b,null));};exports[_0x77be('0x25')]=function(_0x3603fa,_0x5926e8){return db[_0x77be('0x2a')][_0x77be('0x44')]({'where':{'id':_0x3603fa[_0x77be('0x42')]['id']}})['then'](handleEntityNotFound(_0x5926e8,null))[_0x77be('0x24')](removeEntity(_0x5926e8,null))[_0x77be('0x45')](handleError(_0x5926e8,null));};exports['describe']=function(_0x1b8034,_0x533583){return db[_0x77be('0x2a')][_0x77be('0x48')]()[_0x77be('0x24')](respondWithResult(_0x533583,null))[_0x77be('0x45')](handleError(_0x533583,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1678d56..dc9adac 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 _0x7a69=['uniqueid','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x2d0322,_0x1e154c){var _0x11ca3e=function(_0x1cfec7){while(--_0x1cfec7){_0x2d0322['push'](_0x2d0322['shift']());}};_0x11ca3e(++_0x1e154c);}(_0x7a69,0x1c9));var _0x97a6=function(_0x5e28e1,_0x466ff5){_0x5e28e1=_0x5e28e1-0x0;var _0x15d436=_0x7a69[_0x5e28e1];return _0x15d436;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x97a6('0x0'))(_0x97a6('0x1'));var moment=require('moment');var BPromise=require(_0x97a6('0x2'));var rp=require(_0x97a6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97a6('0x4'));var config=require(_0x97a6('0x5'));var attributes=require(_0x97a6('0x6'));module[_0x97a6('0x7')]=function(_0x3a612b,_0x212c8e){return _0x3a612b[_0x97a6('0x8')](_0x97a6('0x9'),attributes,{'tableName':_0x97a6('0xa'),'paranoid':![],'indexes':[{'name':_0x97a6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x980c=['api','moment','request-promise','path','rimraf','../../config/environment','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0x3f6f54,_0x34e9ef){var _0x5ed5e1=function(_0x2e6f1d){while(--_0x2e6f1d){_0x3f6f54['push'](_0x3f6f54['shift']());}};_0x5ed5e1(++_0x34e9ef);}(_0x980c,0x1ab));var _0xc980=function(_0xc54c5e,_0x358d7f){_0xc54c5e=_0xc54c5e-0x0;var _0x40a98b=_0x980c[_0xc54c5e];return _0x40a98b;};'use strict';var _=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var logger=require('../../config/logger')(_0xc980('0x2'));var moment=require(_0xc980('0x3'));var BPromise=require('bluebird');var rp=require(_0xc980('0x4'));var fs=require('fs');var path=require(_0xc980('0x5'));var rimraf=require(_0xc980('0x6'));var config=require(_0xc980('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x32f150,_0x5f2700){return _0x32f150['define'](_0xc980('0x8'),attributes,{'tableName':_0xc980('0x9'),'paranoid':![],'indexes':[{'name':_0xc980('0xa'),'fields':[_0xc980('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 205dca0..6372bf4 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 _0x9f96=['moment','randomstring','../../config/utils','jayson/promise','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x28905f,_0x1a69fc){var _0x570145=function(_0x370649){while(--_0x370649){_0x28905f['push'](_0x28905f['shift']());}};_0x570145(++_0x1a69fc);}(_0x9f96,0x120));var _0x69f9=function(_0xd7d28d,_0x44b1a8){_0xd7d28d=_0xd7d28d-0x0;var _0x5ed9f7=_0x9f96[_0xd7d28d];return _0x5ed9f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x69f9('0x0'));var BPromise=require('bluebird');var rs=require(_0x69f9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x69f9('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x69f9('0x3'));var client=jayson['client'][_0x69f9('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x5adbb0,_0xcba2e5,_0x210ec3){return new BPromise(function(_0x11e211,_0x3d2127){return client['request'](_0x5adbb0,_0x210ec3)[_0x69f9('0x5')](function(_0x1bad64){logger[_0x69f9('0x6')](_0x69f9('0x7'),_0xcba2e5,_0x69f9('0x8'));logger[_0x69f9('0x9')](_0x69f9('0xa'),_0xcba2e5,'request\x20sent',JSON[_0x69f9('0xb')](_0x1bad64));if(_0x1bad64[_0x69f9('0xc')]){if(_0x1bad64[_0x69f9('0xc')][_0x69f9('0xd')]===0x1f4){logger[_0x69f9('0xc')](_0x69f9('0x7'),_0xcba2e5,_0x1bad64[_0x69f9('0xc')][_0x69f9('0xe')]);return _0x3d2127(_0x1bad64[_0x69f9('0xc')]['message']);}logger[_0x69f9('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0xcba2e5,_0x1bad64[_0x69f9('0xc')][_0x69f9('0xe')]);return _0x11e211(_0x1bad64[_0x69f9('0xc')][_0x69f9('0xe')]);}else{logger[_0x69f9('0x6')](_0x69f9('0x7'),_0xcba2e5,_0x69f9('0x8'));_0x11e211(_0x1bad64[_0x69f9('0xf')][_0x69f9('0xe')]);}})['catch'](function(_0x44d2b9){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xcba2e5,_0x44d2b9);_0x3d2127(_0x44d2b9);});});} \ No newline at end of file +var _0x445e=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f9e17,_0x127015){var _0x4fda50=function(_0x5c8ad4){while(--_0x5c8ad4){_0x1f9e17['push'](_0x1f9e17['shift']());}};_0x4fda50(++_0x127015);}(_0x445e,0x1d2));var _0xe445=function(_0x58530f,_0x32442f){_0x58530f=_0x58530f-0x0;var _0x4adc74=_0x445e[_0x58530f];return _0x4adc74;};'use strict';var _=require(_0xe445('0x0'));var util=require(_0xe445('0x1'));var moment=require(_0xe445('0x2'));var BPromise=require('bluebird');var rs=require(_0xe445('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe445('0x4'));var logger=require(_0xe445('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe445('0x6'));var client=jayson[_0xe445('0x7')][_0xe445('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11ebaf,_0x368649,_0x589c52){return new BPromise(function(_0x43528f,_0x59592e){return client['request'](_0x11ebaf,_0x589c52)[_0xe445('0x9')](function(_0x548aed){logger[_0xe445('0xa')](_0xe445('0xb'),_0x368649,_0xe445('0xc'));logger[_0xe445('0xd')](_0xe445('0xe'),_0x368649,_0xe445('0xc'),JSON[_0xe445('0xf')](_0x548aed));if(_0x548aed[_0xe445('0x10')]){if(_0x548aed[_0xe445('0x10')]['code']===0x1f4){logger[_0xe445('0x10')](_0xe445('0xb'),_0x368649,_0x548aed['error'][_0xe445('0x11')]);return _0x59592e(_0x548aed['error']['message']);}logger['error'](_0xe445('0xb'),_0x368649,_0x548aed['error'][_0xe445('0x11')]);return _0x43528f(_0x548aed[_0xe445('0x10')][_0xe445('0x11')]);}else{logger[_0xe445('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x368649,'request\x20sent');_0x43528f(_0x548aed[_0xe445('0x12')]['message']);}})[_0xe445('0x13')](function(_0x1e1fe5){logger[_0xe445('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x368649,_0x1e1fe5);_0x59592e(_0x1e1fe5);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8b143f4..216aaa2 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 _0xe498=['Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','index','describe','/:id','isAuthenticated','create','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x567a58,_0x36167d){var _0x5bfdf8=function(_0x1243c1){while(--_0x1243c1){_0x567a58['push'](_0x567a58['shift']());}};_0x5bfdf8(++_0x36167d);}(_0xe498,0x84));var _0x8e49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe498[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x8e49('0x0'));var path=require(_0x8e49('0x1'));var timeout=require(_0x8e49('0x2'));var express=require(_0x8e49('0x3'));var router=express[_0x8e49('0x4')]();var fs_extra=require(_0x8e49('0x5'));var auth=require(_0x8e49('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e49('0x7'));router[_0x8e49('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e49('0x9')]);router[_0x8e49('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8e49('0xa')]);router[_0x8e49('0x8')](_0x8e49('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8e49('0xc')](),controller[_0x8e49('0xd')]);router['put'](_0x8e49('0xb'),auth['isAuthenticated'](),controller[_0x8e49('0xe')]);router[_0x8e49('0xf')]('/:id',auth[_0x8e49('0xc')](),controller[_0x8e49('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9360=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete'];(function(_0x3d4978,_0xab5e78){var _0xa3458e=function(_0x43f0d8){while(--_0x43f0d8){_0x3d4978['push'](_0x3d4978['shift']());}};_0xa3458e(++_0xab5e78);}(_0x9360,0x133));var _0x0936=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9360[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x0936('0x0'));var util=require(_0x0936('0x1'));var path=require(_0x0936('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0936('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0936('0x4'));var interaction=require(_0x0936('0x5'));var config=require('../../config/environment');var controller=require(_0x0936('0x6'));router[_0x0936('0x7')]('/',auth[_0x0936('0x8')](),controller[_0x0936('0x9')]);router['get'](_0x0936('0xa'),auth['isAuthenticated'](),controller[_0x0936('0xb')]);router[_0x0936('0x7')](_0x0936('0xc'),auth[_0x0936('0x8')](),controller[_0x0936('0xd')]);router['post']('/',auth[_0x0936('0x8')](),controller[_0x0936('0xe')]);router['put'](_0x0936('0xc'),auth['isAuthenticated'](),controller[_0x0936('0xf')]);router[_0x0936('0x10')](_0x0936('0xc'),auth[_0x0936('0x8')](),controller['destroy']);module[_0x0936('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index de27758..13fb32b 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 _0x2131=['../../config/environment','./intDeskAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x1aef22,_0x2d27e9){var _0x70e233=function(_0x315224){while(--_0x315224){_0x1aef22['push'](_0x1aef22['shift']());}};_0x70e233(++_0x2d27e9);}(_0x2131,0x1c2));var _0x1213=function(_0x4a8072,_0x435bab){_0x4a8072=_0x4a8072-0x0;var _0x11a4fe=_0x2131[_0x4a8072];return _0x11a4fe;};'use strict';var multer=require(_0x1213('0x0'));var util=require('util');var path=require(_0x1213('0x1'));var timeout=require(_0x1213('0x2'));var express=require('express');var router=express[_0x1213('0x3')]();var fs_extra=require(_0x1213('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1213('0x5'));var config=require(_0x1213('0x6'));var controller=require(_0x1213('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1213('0x8')]);router[_0x1213('0x9')](_0x1213('0xa'),auth[_0x1213('0xb')](),controller[_0x1213('0xc')]);router[_0x1213('0x9')](_0x1213('0xd'),auth[_0x1213('0xb')](),controller[_0x1213('0xe')]);router[_0x1213('0x9')](_0x1213('0xf'),auth[_0x1213('0xb')](),controller[_0x1213('0x10')]);router[_0x1213('0x11')]('/',auth[_0x1213('0xb')](),controller[_0x1213('0x12')]);router[_0x1213('0x11')](_0x1213('0xd'),auth[_0x1213('0xb')](),controller[_0x1213('0x13')]);router[_0x1213('0x14')](_0x1213('0xa'),auth['isAuthenticated'](),controller[_0x1213('0x15')]);router[_0x1213('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1213('0x17')]=router; \ No newline at end of file +var _0x8fd5=['./intDeskAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x33be69,_0xead481){var _0x3f6bfb=function(_0xd366fe){while(--_0xd366fe){_0x33be69['push'](_0x33be69['shift']());}};_0x3f6bfb(++_0xead481);}(_0x8fd5,0x1af));var _0x58fd=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x8fd5[_0x5c4f6b];return _0x104c4e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x58fd('0x0'));var timeout=require('connect-timeout');var express=require(_0x58fd('0x1'));var router=express[_0x58fd('0x2')]();var fs_extra=require(_0x58fd('0x3'));var auth=require(_0x58fd('0x4'));var interaction=require(_0x58fd('0x5'));var config=require('../../config/environment');var controller=require(_0x58fd('0x6'));router['get']('/',auth[_0x58fd('0x7')](),controller[_0x58fd('0x8')]);router[_0x58fd('0x9')]('/:id',auth[_0x58fd('0x7')](),controller[_0x58fd('0xa')]);router['get'](_0x58fd('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x58fd('0x9')](_0x58fd('0xc'),auth['isAuthenticated'](),controller[_0x58fd('0xd')]);router[_0x58fd('0xe')]('/',auth[_0x58fd('0x7')](),controller[_0x58fd('0xf')]);router[_0x58fd('0xe')](_0x58fd('0xb'),auth[_0x58fd('0x7')](),controller[_0x58fd('0x10')]);router[_0x58fd('0x11')](_0x58fd('0x12'),auth[_0x58fd('0x7')](),controller[_0x58fd('0x13')]);router[_0x58fd('0x14')](_0x58fd('0x12'),auth[_0x58fd('0x7')](),controller[_0x58fd('0x15')]);module[_0x58fd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ea9e08b..a4868f5 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 _0x58a6=['STRING','ENUM','basic','newTab','sequelize','exports'];(function(_0x32e7d6,_0x682bc5){var _0x5427cf=function(_0x365c2d){while(--_0x365c2d){_0x32e7d6['push'](_0x32e7d6['shift']());}};_0x5427cf(++_0x682bc5);}(_0x58a6,0x1f0));var _0x658a=function(_0x4e72ec,_0x3d8a73){_0x4e72ec=_0x4e72ec-0x0;var _0x2bc3ee=_0x58a6[_0x4e72ec];return _0x2bc3ee;};'use strict';var Sequelize=require(_0x658a('0x0'));module[_0x658a('0x1')]={'name':{'type':Sequelize[_0x658a('0x2')]},'description':{'type':Sequelize[_0x658a('0x2')]},'username':{'type':Sequelize[_0x658a('0x2')]},'remoteUri':{'type':Sequelize[_0x658a('0x2')]},'authType':{'type':Sequelize[_0x658a('0x3')](_0x658a('0x4')),'defaultValue':_0x658a('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x658a('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x658a('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x658a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x658a('0x3')]('integrationTab',_0x658a('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x2f47=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x4a9561,_0x5a6aa8){var _0x75e931=function(_0x143877){while(--_0x143877){_0x4a9561['push'](_0x4a9561['shift']());}};_0x75e931(++_0x5a6aa8);}(_0x2f47,0xae));var _0x72f4=function(_0x5056b1,_0x212e63){_0x5056b1=_0x5056b1-0x0;var _0xa7b51=_0x2f47[_0x5056b1];return _0xa7b51;};'use strict';var Sequelize=require(_0x72f4('0x0'));module[_0x72f4('0x1')]={'name':{'type':Sequelize[_0x72f4('0x2')]},'description':{'type':Sequelize[_0x72f4('0x2')]},'username':{'type':Sequelize[_0x72f4('0x2')]},'remoteUri':{'type':Sequelize[_0x72f4('0x2')]},'authType':{'type':Sequelize[_0x72f4('0x3')](_0x72f4('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x72f4('0x2')]},'consumerSecret':{'type':Sequelize[_0x72f4('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x72f4('0x2')]},'serverUrl':{'type':Sequelize[_0x72f4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x72f4('0x3')](_0x72f4('0x5'),_0x72f4('0x6')),'defaultValue':_0x72f4('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index fedc5fc..422a60a 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 _0x9b69=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','DeskAccount','findAll','rows','show','params','find','catch','create','body','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','Subjects','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','format','basic','headers','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x9b69,0xd8));var _0x99b6=function(_0x135389,_0x2941f1){_0x135389=_0x135389-0x0;var _0x3ef5a0=_0x9b69[_0x135389];return _0x3ef5a0;};'use strict';var emlformat=require(_0x99b6('0x0'));var rimraf=require(_0x99b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99b6('0x2'));var rp=require(_0x99b6('0x3'));var moment=require(_0x99b6('0x4'));var BPromise=require(_0x99b6('0x5'));var Mustache=require(_0x99b6('0x6'));var util=require(_0x99b6('0x7'));var path=require(_0x99b6('0x8'));var sox=require(_0x99b6('0x9'));var csv=require(_0x99b6('0xa'));var ejs=require(_0x99b6('0xb'));var fs=require('fs');var fs_extra=require(_0x99b6('0xc'));var _=require(_0x99b6('0xd'));var squel=require(_0x99b6('0xe'));var crypto=require(_0x99b6('0xf'));var jsforce=require(_0x99b6('0x10'));var deskjs=require(_0x99b6('0x11'));var toCsv=require('to-csv');var querystring=require(_0x99b6('0x12'));var Papa=require(_0x99b6('0x13'));var Redis=require(_0x99b6('0x14'));var authService=require(_0x99b6('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x99b6('0x16'));var hardwareService=require(_0x99b6('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x99b6('0x18'));var config=require(_0x99b6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x99b6('0x1a'))['db'];var integrations=require(_0x99b6('0x1b'));function respondWithStatusCode(_0x39d8ba,_0xc9c4e3){_0xc9c4e3=_0xc9c4e3||0xcc;return function(_0x2f571a){if(_0x2f571a){return _0x39d8ba['sendStatus'](_0xc9c4e3);}return _0x39d8ba[_0x99b6('0x1c')](_0xc9c4e3)[_0x99b6('0x1d')]();};}function respondWithResult(_0x49f89a,_0x269406){_0x269406=_0x269406||0xc8;return function(_0x3ef1df){if(_0x3ef1df){return _0x49f89a[_0x99b6('0x1c')](_0x269406)['json'](_0x3ef1df);}};}function respondWithFilteredResult(_0x405928,_0x419f3f){return function(_0x528d31){if(_0x528d31){var _0x53049c=typeof _0x419f3f['offset']===_0x99b6('0x1e')&&typeof _0x419f3f['limit']==='undefined';var _0x2a5083=_0x528d31[_0x99b6('0x1f')];var _0x43de15=_0x53049c?0x0:_0x419f3f[_0x99b6('0x20')];var _0x5cdfde=_0x53049c?_0x528d31[_0x99b6('0x1f')]:_0x419f3f[_0x99b6('0x20')]+_0x419f3f[_0x99b6('0x21')];var _0xdfa076;if(_0x5cdfde>=_0x2a5083){_0x5cdfde=_0x2a5083;_0xdfa076=0xc8;}else{_0xdfa076=0xce;}_0x405928['status'](_0xdfa076);return _0x405928[_0x99b6('0x22')](_0x99b6('0x23'),_0x43de15+'-'+_0x5cdfde+'/'+_0x2a5083)['json'](_0x528d31);}return null;};}function patchUpdates(_0x2fcba0){return function(_0x53d447){try{jsonpatch['apply'](_0x53d447,_0x2fcba0,!![]);}catch(_0x19e25b){return BPromise[_0x99b6('0x24')](_0x19e25b);}return _0x53d447[_0x99b6('0x25')]();};}function saveUpdates(_0x51998e,_0x93c0b7){return function(_0x1a2972){if(_0x1a2972){return _0x1a2972[_0x99b6('0x26')](_0x51998e)[_0x99b6('0x27')](function(_0x509ce3){return _0x509ce3;});}return null;};}function removeEntity(_0x51adb7,_0x4ca512){return function(_0xe8239a){if(_0xe8239a){return _0xe8239a[_0x99b6('0x28')]()['then'](function(){_0x51adb7[_0x99b6('0x1c')](0xcc)[_0x99b6('0x1d')]();});}};}function handleEntityNotFound(_0x28a711,_0x2cbe3f){return function(_0x3b4e62){if(!_0x3b4e62){_0x28a711['sendStatus'](0x194);}return _0x3b4e62;};}function handleError(_0x241d88,_0x21436f){_0x21436f=_0x21436f||0x1f4;return function(_0x2debd3){logger[_0x99b6('0x29')](_0x2debd3['stack']);if(_0x2debd3[_0x99b6('0x2a')]){delete _0x2debd3[_0x99b6('0x2a')];}_0x241d88[_0x99b6('0x1c')](_0x21436f)[_0x99b6('0x2b')](_0x2debd3);};}exports['index']=function(_0x418887,_0x36d7c4){var _0x2057d9={},_0x4cdfe2={},_0x226df6={'count':0x0,'rows':[]};var _0x4bbc75=_[_0x99b6('0x2c')](db['DeskAccount'][_0x99b6('0x2d')],function(_0x48bf96){return{'name':_0x48bf96['fieldName'],'type':_0x48bf96[_0x99b6('0x2e')][_0x99b6('0x2f')]};});_0x4cdfe2[_0x99b6('0x30')]=_[_0x99b6('0x2c')](_0x4bbc75,'name');_0x4cdfe2[_0x99b6('0x31')]=_[_0x99b6('0x32')](_0x418887[_0x99b6('0x31')]);_0x4cdfe2[_0x99b6('0x33')]=_[_0x99b6('0x34')](_0x4cdfe2[_0x99b6('0x30')],_0x4cdfe2[_0x99b6('0x31')]);_0x2057d9[_0x99b6('0x35')]=_['intersection'](_0x4cdfe2[_0x99b6('0x30')],qs['fields'](_0x418887[_0x99b6('0x31')][_0x99b6('0x36')]));_0x2057d9[_0x99b6('0x35')]=_0x2057d9['attributes'][_0x99b6('0x37')]?_0x2057d9['attributes']:_0x4cdfe2['model'];if(!_0x418887[_0x99b6('0x31')][_0x99b6('0x38')](_0x99b6('0x39'))){_0x2057d9[_0x99b6('0x21')]=qs[_0x99b6('0x21')](_0x418887[_0x99b6('0x31')][_0x99b6('0x21')]);_0x2057d9[_0x99b6('0x20')]=qs[_0x99b6('0x20')](_0x418887[_0x99b6('0x31')][_0x99b6('0x20')]);}_0x2057d9[_0x99b6('0x3a')]=qs[_0x99b6('0x3b')](_0x418887[_0x99b6('0x31')][_0x99b6('0x3b')]);_0x2057d9[_0x99b6('0x3c')]=qs[_0x99b6('0x33')](_[_0x99b6('0x3d')](_0x418887[_0x99b6('0x31')],_0x4cdfe2['filters']),_0x4bbc75);if(_0x418887[_0x99b6('0x31')][_0x99b6('0x3e')]){_0x2057d9[_0x99b6('0x3c')]=_[_0x99b6('0x3f')](_0x2057d9['where'],{'$or':_['map'](_0x4bbc75,function(_0x26a5dc){if(_0x26a5dc[_0x99b6('0x2e')]!=='VIRTUAL'){var _0x1559aa={};_0x1559aa[_0x26a5dc['name']]={'$like':'%'+_0x418887[_0x99b6('0x31')][_0x99b6('0x3e')]+'%'};return _0x1559aa;}})});}_0x2057d9=_[_0x99b6('0x3f')]({},_0x2057d9,_0x418887[_0x99b6('0x40')]);var _0x171cb4={'where':_0x2057d9[_0x99b6('0x3c')]};return db['DeskAccount']['count'](_0x171cb4)[_0x99b6('0x27')](function(_0x5227e3){_0x226df6[_0x99b6('0x1f')]=_0x5227e3;if(_0x418887[_0x99b6('0x31')][_0x99b6('0x41')]){_0x2057d9[_0x99b6('0x42')]=[{'all':!![]}];}return db[_0x99b6('0x43')][_0x99b6('0x44')](_0x2057d9);})[_0x99b6('0x27')](function(_0x2b2d8a){_0x226df6[_0x99b6('0x45')]=_0x2b2d8a;return _0x226df6;})[_0x99b6('0x27')](respondWithFilteredResult(_0x36d7c4,_0x2057d9))['catch'](handleError(_0x36d7c4,null));};exports[_0x99b6('0x46')]=function(_0x9415c7,_0x16e27c){var _0x2e8f72={'raw':![],'where':{'id':_0x9415c7[_0x99b6('0x47')]['id']}},_0x5a4cc8={};_0x5a4cc8[_0x99b6('0x30')]=_[_0x99b6('0x32')](db[_0x99b6('0x43')]['rawAttributes']);_0x5a4cc8[_0x99b6('0x31')]=_[_0x99b6('0x32')](_0x9415c7['query']);_0x5a4cc8[_0x99b6('0x33')]=_[_0x99b6('0x34')](_0x5a4cc8[_0x99b6('0x30')],_0x5a4cc8[_0x99b6('0x31')]);_0x2e8f72['attributes']=_[_0x99b6('0x34')](_0x5a4cc8[_0x99b6('0x30')],qs['fields'](_0x9415c7['query'][_0x99b6('0x36')]));_0x2e8f72[_0x99b6('0x35')]=_0x2e8f72[_0x99b6('0x35')][_0x99b6('0x37')]?_0x2e8f72[_0x99b6('0x35')]:_0x5a4cc8[_0x99b6('0x30')];if(_0x9415c7[_0x99b6('0x31')][_0x99b6('0x41')]){_0x2e8f72[_0x99b6('0x42')]=[{'all':!![]}];}_0x2e8f72=_[_0x99b6('0x3f')]({},_0x2e8f72,_0x9415c7[_0x99b6('0x40')]);return db[_0x99b6('0x43')][_0x99b6('0x48')](_0x2e8f72)[_0x99b6('0x27')](handleEntityNotFound(_0x16e27c,null))[_0x99b6('0x27')](respondWithResult(_0x16e27c,null))[_0x99b6('0x49')](handleError(_0x16e27c,null));};exports['create']=function(_0x41eea9,_0x1d8951){return db[_0x99b6('0x43')][_0x99b6('0x4a')](_0x41eea9[_0x99b6('0x4b')],{})['then'](respondWithResult(_0x1d8951,0xc9))[_0x99b6('0x49')](handleError(_0x1d8951,null));};exports['update']=function(_0x359b47,_0x4d94d1){if(_0x359b47[_0x99b6('0x4b')]['id']){delete _0x359b47[_0x99b6('0x4b')]['id'];}return db[_0x99b6('0x43')][_0x99b6('0x48')]({'where':{'id':_0x359b47['params']['id']}})[_0x99b6('0x27')](handleEntityNotFound(_0x4d94d1,null))[_0x99b6('0x27')](saveUpdates(_0x359b47['body'],null))[_0x99b6('0x27')](respondWithResult(_0x4d94d1,null))['catch'](handleError(_0x4d94d1,null));};exports[_0x99b6('0x28')]=function(_0xa74524,_0x39a677){return db['DeskAccount'][_0x99b6('0x48')]({'where':{'id':_0xa74524[_0x99b6('0x47')]['id']}})[_0x99b6('0x27')](handleEntityNotFound(_0x39a677,null))[_0x99b6('0x27')](removeEntity(_0x39a677,null))['catch'](handleError(_0x39a677,null));};exports[_0x99b6('0x4c')]=function(_0x55e0db,_0x253c97,_0x371eb2){var _0x20e48b={};var _0x2cc780={};var _0x4ca019;var _0x778155;return db['DeskAccount']['findOne']({'where':{'id':_0x55e0db[_0x99b6('0x47')]['id']}})[_0x99b6('0x27')](handleEntityNotFound(_0x253c97,null))[_0x99b6('0x27')](function(_0x54038c){if(_0x54038c){_0x4ca019=_0x54038c;_0x2cc780[_0x99b6('0x30')]=_[_0x99b6('0x32')](db['DeskConfiguration']['rawAttributes']);_0x2cc780[_0x99b6('0x31')]=_['keys'](_0x55e0db[_0x99b6('0x31')]);_0x2cc780[_0x99b6('0x33')]=_[_0x99b6('0x34')](_0x2cc780[_0x99b6('0x30')],_0x2cc780[_0x99b6('0x31')]);_0x20e48b[_0x99b6('0x35')]=_['intersection'](_0x2cc780[_0x99b6('0x30')],qs[_0x99b6('0x36')](_0x55e0db[_0x99b6('0x31')][_0x99b6('0x36')]));_0x20e48b[_0x99b6('0x35')]=_0x20e48b[_0x99b6('0x35')][_0x99b6('0x37')]?_0x20e48b[_0x99b6('0x35')]:_0x2cc780[_0x99b6('0x30')];_0x20e48b[_0x99b6('0x3a')]=qs[_0x99b6('0x3b')](_0x55e0db[_0x99b6('0x31')][_0x99b6('0x3b')]);_0x20e48b['where']=qs['filters'](_['pick'](_0x55e0db[_0x99b6('0x31')],_0x2cc780[_0x99b6('0x33')]));if(_0x55e0db[_0x99b6('0x31')][_0x99b6('0x3e')]){_0x20e48b[_0x99b6('0x3c')]=_[_0x99b6('0x3f')](_0x20e48b['where'],{'$or':_[_0x99b6('0x2c')](_0x20e48b['attributes'],function(_0x18435c){var _0x1199e0={};_0x1199e0[_0x18435c]={'$like':'%'+_0x55e0db[_0x99b6('0x31')][_0x99b6('0x3e')]+'%'};return _0x1199e0;})});}_0x20e48b=_[_0x99b6('0x3f')]({},_0x20e48b,_0x55e0db[_0x99b6('0x40')]);return _0x4ca019[_0x99b6('0x4c')](_0x20e48b);}})[_0x99b6('0x27')](function(_0x2b8006){if(_0x2b8006){_0x778155=_0x2b8006[_0x99b6('0x37')];if(!_0x55e0db[_0x99b6('0x31')]['hasOwnProperty']('nolimit')){_0x20e48b['limit']=qs[_0x99b6('0x21')](_0x55e0db[_0x99b6('0x31')]['limit']);_0x20e48b[_0x99b6('0x20')]=qs[_0x99b6('0x20')](_0x55e0db[_0x99b6('0x31')][_0x99b6('0x20')]);}return _0x4ca019[_0x99b6('0x4c')](_0x20e48b);}})['then'](function(_0x402daf){if(_0x402daf){return _0x402daf?{'count':_0x778155,'rows':_0x402daf}:null;}})['then'](respondWithResult(_0x253c97,null))[_0x99b6('0x49')](handleError(_0x253c97,null));};exports[_0x99b6('0x4d')]=function(_0x38e022,_0x28524,_0xf4a0e7){if(_0x38e022[_0x99b6('0x4b')]['id']){delete _0x38e022['body']['id'];}return db[_0x99b6('0x43')][_0x99b6('0x4e')]({'where':{'id':_0x38e022[_0x99b6('0x47')]['id']}})[_0x99b6('0x27')](handleEntityNotFound(_0x28524,null))[_0x99b6('0x27')](function(_0x383ba9){if(_0x383ba9){_0x38e022[_0x99b6('0x4b')][_0x99b6('0x4f')]=_0x383ba9['id'];_0x38e022[_0x99b6('0x4b')]['Subjects']=integrations[_0x99b6('0x50')](_0x38e022[_0x99b6('0x4b')][_0x99b6('0x51')],_0x38e022[_0x99b6('0x4b')][_0x99b6('0x2e')]);_0x38e022['body'][_0x99b6('0x52')]=integrations[_0x99b6('0x53')](_0x38e022['body'][_0x99b6('0x51')],_0x38e022['body'][_0x99b6('0x2e')]);return db[_0x99b6('0x54')][_0x99b6('0x4a')](_0x38e022[_0x99b6('0x4b')],{'include':[{'model':db['DeskField'],'as':_0x99b6('0x55')},{'model':db[_0x99b6('0x56')],'as':_0x99b6('0x52')}]});}return null;})[_0x99b6('0x27')](respondWithResult(_0x28524,null))[_0x99b6('0x49')](handleError(_0x28524,null));};exports[_0x99b6('0x57')]=function(_0x2d56d4,_0x163620,_0x36c397){var _0x34e338=[{'name':'priority','label':_0x99b6('0x58'),'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 _0x203656='';return db['DeskAccount'][_0x99b6('0x4e')]({'where':{'id':_0x2d56d4['params']['id']},'attributes':['id',_0x99b6('0x59'),_0x99b6('0x5a'),'username',_0x99b6('0x5b'),_0x99b6('0x5c'),_0x99b6('0x5d'),'token',_0x99b6('0x5e')]})[_0x99b6('0x27')](handleEntityNotFound(_0x163620,null))[_0x99b6('0x27')](function(_0x28fd49){if(_0x28fd49){_0x203656=_0x28fd49[_0x99b6('0x59')];var _0x2f45d5=_0x203656[_0x99b6('0x5f')](-0x1);if(_0x2f45d5==='/'){_0x203656=_0x203656[_0x99b6('0x60')](0x0,_0x203656[_0x99b6('0x61')](_0x2f45d5));}var _0xe8da01={'method':_0x99b6('0x62'),'uri':util[_0x99b6('0x63')]('%s/custom_fields',_0x203656),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x28fd49[_0x99b6('0x5a')]===_0x99b6('0x64')){_0xe8da01[_0x99b6('0x65')]['Authorization']=util[_0x99b6('0x63')](_0x99b6('0x66'),new Buffer(util[_0x99b6('0x63')](_0x99b6('0x67'),_0x28fd49[_0x99b6('0x68')],_0x28fd49[_0x99b6('0x5b')]))[_0x99b6('0x69')](_0x99b6('0x6a')));}return rp(_0xe8da01)['then'](function(_0x39ea59){return _0x34e338[_0x99b6('0x6b')](_[_0x99b6('0x2c')](_0x39ea59[_0x99b6('0x6c')][_0x99b6('0x6d')],function(_0x208da5){return{'id':_0x208da5[_0x99b6('0x2a')],'name':_0x208da5[_0x99b6('0x2a')],'type':_0x208da5[_0x99b6('0x2e')],'active':_0x208da5[_0x99b6('0x6e')],'label':_0x208da5[_0x99b6('0x6f')],'custom':!![]};}));});}})[_0x99b6('0x27')](function(_0x5f4e9b){return{'count':_0x5f4e9b[_0x99b6('0x37')],'rows':_0x5f4e9b};})[_0x99b6('0x27')](respondWithResult(_0x163620,null))['catch'](function(_0xcdb099){var _0x3c69e6=_0x2d56d4[_0x99b6('0x31')][_0x99b6('0x70')]?0x1f4:_0xcdb099['statusCode']||0x1f4;logger[_0x99b6('0x29')](_0x99b6('0x71'),'getFields',_0x3c69e6,JSON[_0x99b6('0x72')](_0xcdb099));delete _0xcdb099[_0x99b6('0x2a')];if(_0x3c69e6===0x191){_0x3c69e6=0x190;}_0x163620[_0x99b6('0x1c')](_0x3c69e6)[_0x99b6('0x2b')](_0x2d56d4[_0x99b6('0x31')][_0x99b6('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0xcdb099['statusCode']}:_0xcdb099);});}; \ No newline at end of file +var _0x1d52=['priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Basic\x20%s','format','username','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','DeskAccount','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','pick','AccountId','getSubjects','Descriptions','DeskConfiguration','DeskField','Subjects'];(function(_0x2fcf6b,_0xd140ff){var _0x155073=function(_0x5a9157){while(--_0x5a9157){_0x2fcf6b['push'](_0x2fcf6b['shift']());}};_0x155073(++_0xd140ff);}(_0x1d52,0x98));var _0x21d5=function(_0x2b917d,_0x5c7ebb){_0x2b917d=_0x2b917d-0x0;var _0x422a29=_0x1d52[_0x2b917d];return _0x422a29;};'use strict';var emlformat=require(_0x21d5('0x0'));var rimraf=require(_0x21d5('0x1'));var zipdir=require(_0x21d5('0x2'));var jsonpatch=require(_0x21d5('0x3'));var rp=require(_0x21d5('0x4'));var moment=require(_0x21d5('0x5'));var BPromise=require(_0x21d5('0x6'));var Mustache=require(_0x21d5('0x7'));var util=require(_0x21d5('0x8'));var path=require(_0x21d5('0x9'));var sox=require(_0x21d5('0xa'));var csv=require(_0x21d5('0xb'));var ejs=require(_0x21d5('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21d5('0xd'));var squel=require(_0x21d5('0xe'));var crypto=require(_0x21d5('0xf'));var jsforce=require(_0x21d5('0x10'));var deskjs=require(_0x21d5('0x11'));var toCsv=require('to-csv');var querystring=require(_0x21d5('0x12'));var Papa=require(_0x21d5('0x13'));var Redis=require(_0x21d5('0x14'));var authService=require(_0x21d5('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x21d5('0x16'));var hardwareService=require(_0x21d5('0x17'));var logger=require(_0x21d5('0x18'))(_0x21d5('0x19'));var utils=require(_0x21d5('0x1a'));var config=require(_0x21d5('0x1b'));var licenseUtil=require(_0x21d5('0x1c'));var db=require(_0x21d5('0x1d'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x77f598,_0x1f22c4){_0x1f22c4=_0x1f22c4||0xcc;return function(_0x49c377){if(_0x49c377){return _0x77f598[_0x21d5('0x1e')](_0x1f22c4);}return _0x77f598[_0x21d5('0x1f')](_0x1f22c4)[_0x21d5('0x20')]();};}function respondWithResult(_0x938756,_0x301648){_0x301648=_0x301648||0xc8;return function(_0x5b705d){if(_0x5b705d){return _0x938756[_0x21d5('0x1f')](_0x301648)[_0x21d5('0x21')](_0x5b705d);}};}function respondWithFilteredResult(_0x41a198,_0x2b14bd){return function(_0x17fb6e){if(_0x17fb6e){var _0xa74471=typeof _0x2b14bd['offset']===_0x21d5('0x22')&&typeof _0x2b14bd[_0x21d5('0x23')]===_0x21d5('0x22');var _0x5b8a01=_0x17fb6e[_0x21d5('0x24')];var _0x4cee78=_0xa74471?0x0:_0x2b14bd['offset'];var _0x15ba2d=_0xa74471?_0x17fb6e['count']:_0x2b14bd['offset']+_0x2b14bd[_0x21d5('0x23')];var _0x48986a;if(_0x15ba2d>=_0x5b8a01){_0x15ba2d=_0x5b8a01;_0x48986a=0xc8;}else{_0x48986a=0xce;}_0x41a198['status'](_0x48986a);return _0x41a198[_0x21d5('0x25')](_0x21d5('0x26'),_0x4cee78+'-'+_0x15ba2d+'/'+_0x5b8a01)['json'](_0x17fb6e);}return null;};}function patchUpdates(_0x5ea315){return function(_0x80c3be){try{jsonpatch[_0x21d5('0x27')](_0x80c3be,_0x5ea315,!![]);}catch(_0x5bff94){return BPromise[_0x21d5('0x28')](_0x5bff94);}return _0x80c3be[_0x21d5('0x29')]();};}function saveUpdates(_0x58bd08,_0x5ddccd){return function(_0x573665){if(_0x573665){return _0x573665[_0x21d5('0x2a')](_0x58bd08)[_0x21d5('0x2b')](function(_0x1dd822){return _0x1dd822;});}return null;};}function removeEntity(_0x163ab7,_0x120a29){return function(_0x545eff){if(_0x545eff){return _0x545eff[_0x21d5('0x2c')]()['then'](function(){_0x163ab7[_0x21d5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33555d,_0x1f7b9c){return function(_0x5a0212){if(!_0x5a0212){_0x33555d[_0x21d5('0x1e')](0x194);}return _0x5a0212;};}function handleError(_0x2cfaed,_0x5f160e){_0x5f160e=_0x5f160e||0x1f4;return function(_0xa7b34c){logger[_0x21d5('0x2d')](_0xa7b34c[_0x21d5('0x2e')]);if(_0xa7b34c['name']){delete _0xa7b34c[_0x21d5('0x2f')];}_0x2cfaed[_0x21d5('0x1f')](_0x5f160e)[_0x21d5('0x30')](_0xa7b34c);};}exports['index']=function(_0x55b5f2,_0x4bdd69){var _0xb4930f={},_0x52d7c8={},_0x52d87f={'count':0x0,'rows':[]};var _0x407819=_[_0x21d5('0x31')](db[_0x21d5('0x32')][_0x21d5('0x33')],function(_0x523a49){return{'name':_0x523a49['fieldName'],'type':_0x523a49['type'][_0x21d5('0x34')]};});_0x52d7c8[_0x21d5('0x35')]=_[_0x21d5('0x31')](_0x407819,_0x21d5('0x2f'));_0x52d7c8['query']=_[_0x21d5('0x36')](_0x55b5f2[_0x21d5('0x37')]);_0x52d7c8[_0x21d5('0x38')]=_[_0x21d5('0x39')](_0x52d7c8[_0x21d5('0x35')],_0x52d7c8[_0x21d5('0x37')]);_0xb4930f[_0x21d5('0x3a')]=_[_0x21d5('0x39')](_0x52d7c8[_0x21d5('0x35')],qs[_0x21d5('0x3b')](_0x55b5f2[_0x21d5('0x37')][_0x21d5('0x3b')]));_0xb4930f[_0x21d5('0x3a')]=_0xb4930f[_0x21d5('0x3a')][_0x21d5('0x3c')]?_0xb4930f[_0x21d5('0x3a')]:_0x52d7c8[_0x21d5('0x35')];if(!_0x55b5f2[_0x21d5('0x37')][_0x21d5('0x3d')](_0x21d5('0x3e'))){_0xb4930f[_0x21d5('0x23')]=qs[_0x21d5('0x23')](_0x55b5f2[_0x21d5('0x37')][_0x21d5('0x23')]);_0xb4930f['offset']=qs[_0x21d5('0x3f')](_0x55b5f2[_0x21d5('0x37')][_0x21d5('0x3f')]);}_0xb4930f[_0x21d5('0x40')]=qs['sort'](_0x55b5f2[_0x21d5('0x37')][_0x21d5('0x41')]);_0xb4930f[_0x21d5('0x42')]=qs['filters'](_['pick'](_0x55b5f2[_0x21d5('0x37')],_0x52d7c8[_0x21d5('0x38')]),_0x407819);if(_0x55b5f2['query'][_0x21d5('0x43')]){_0xb4930f[_0x21d5('0x42')]=_[_0x21d5('0x44')](_0xb4930f['where'],{'$or':_['map'](_0x407819,function(_0x11fac4){if(_0x11fac4[_0x21d5('0x45')]!=='VIRTUAL'){var _0x48b24b={};_0x48b24b[_0x11fac4[_0x21d5('0x2f')]]={'$like':'%'+_0x55b5f2[_0x21d5('0x37')]['filter']+'%'};return _0x48b24b;}})});}_0xb4930f=_['merge']({},_0xb4930f,_0x55b5f2['options']);var _0x2cdb69={'where':_0xb4930f['where']};return db['DeskAccount']['count'](_0x2cdb69)[_0x21d5('0x2b')](function(_0x27faea){_0x52d87f[_0x21d5('0x24')]=_0x27faea;if(_0x55b5f2[_0x21d5('0x37')][_0x21d5('0x46')]){_0xb4930f[_0x21d5('0x47')]=[{'all':!![]}];}return db[_0x21d5('0x32')][_0x21d5('0x48')](_0xb4930f);})['then'](function(_0x15e563){_0x52d87f[_0x21d5('0x49')]=_0x15e563;return _0x52d87f;})['then'](respondWithFilteredResult(_0x4bdd69,_0xb4930f))[_0x21d5('0x4a')](handleError(_0x4bdd69,null));};exports[_0x21d5('0x4b')]=function(_0x44db0f,_0x26a008){var _0x49d1d9={'raw':![],'where':{'id':_0x44db0f[_0x21d5('0x4c')]['id']}},_0x51b038={};_0x51b038[_0x21d5('0x35')]=_[_0x21d5('0x36')](db['DeskAccount'][_0x21d5('0x33')]);_0x51b038[_0x21d5('0x37')]=_['keys'](_0x44db0f[_0x21d5('0x37')]);_0x51b038['filters']=_[_0x21d5('0x39')](_0x51b038[_0x21d5('0x35')],_0x51b038[_0x21d5('0x37')]);_0x49d1d9[_0x21d5('0x3a')]=_[_0x21d5('0x39')](_0x51b038[_0x21d5('0x35')],qs[_0x21d5('0x3b')](_0x44db0f['query'][_0x21d5('0x3b')]));_0x49d1d9[_0x21d5('0x3a')]=_0x49d1d9[_0x21d5('0x3a')][_0x21d5('0x3c')]?_0x49d1d9['attributes']:_0x51b038[_0x21d5('0x35')];if(_0x44db0f[_0x21d5('0x37')][_0x21d5('0x46')]){_0x49d1d9[_0x21d5('0x47')]=[{'all':!![]}];}_0x49d1d9=_['merge']({},_0x49d1d9,_0x44db0f[_0x21d5('0x4d')]);return db[_0x21d5('0x32')][_0x21d5('0x4e')](_0x49d1d9)[_0x21d5('0x2b')](handleEntityNotFound(_0x26a008,null))[_0x21d5('0x2b')](respondWithResult(_0x26a008,null))[_0x21d5('0x4a')](handleError(_0x26a008,null));};exports[_0x21d5('0x4f')]=function(_0x147ff8,_0x3aee1b){return db[_0x21d5('0x32')][_0x21d5('0x4f')](_0x147ff8[_0x21d5('0x50')],{})['then'](respondWithResult(_0x3aee1b,0xc9))[_0x21d5('0x4a')](handleError(_0x3aee1b,null));};exports[_0x21d5('0x2a')]=function(_0x2213b5,_0x1439d8){if(_0x2213b5[_0x21d5('0x50')]['id']){delete _0x2213b5['body']['id'];}return db['DeskAccount'][_0x21d5('0x4e')]({'where':{'id':_0x2213b5[_0x21d5('0x4c')]['id']}})[_0x21d5('0x2b')](handleEntityNotFound(_0x1439d8,null))[_0x21d5('0x2b')](saveUpdates(_0x2213b5['body'],null))[_0x21d5('0x2b')](respondWithResult(_0x1439d8,null))[_0x21d5('0x4a')](handleError(_0x1439d8,null));};exports[_0x21d5('0x2c')]=function(_0x20bbf7,_0x5368b3){return db[_0x21d5('0x32')][_0x21d5('0x4e')]({'where':{'id':_0x20bbf7['params']['id']}})[_0x21d5('0x2b')](handleEntityNotFound(_0x5368b3,null))['then'](removeEntity(_0x5368b3,null))[_0x21d5('0x4a')](handleError(_0x5368b3,null));};exports[_0x21d5('0x51')]=function(_0x31bf82,_0x4e4b77,_0x12890c){var _0x1751b8={};var _0x50b4e3={};var _0x4f7823;var _0x3e965b;return db[_0x21d5('0x32')][_0x21d5('0x52')]({'where':{'id':_0x31bf82['params']['id']}})['then'](handleEntityNotFound(_0x4e4b77,null))['then'](function(_0x3d7b27){if(_0x3d7b27){_0x4f7823=_0x3d7b27;_0x50b4e3[_0x21d5('0x35')]=_[_0x21d5('0x36')](db['DeskConfiguration'][_0x21d5('0x33')]);_0x50b4e3[_0x21d5('0x37')]=_[_0x21d5('0x36')](_0x31bf82[_0x21d5('0x37')]);_0x50b4e3[_0x21d5('0x38')]=_[_0x21d5('0x39')](_0x50b4e3['model'],_0x50b4e3[_0x21d5('0x37')]);_0x1751b8[_0x21d5('0x3a')]=_[_0x21d5('0x39')](_0x50b4e3[_0x21d5('0x35')],qs[_0x21d5('0x3b')](_0x31bf82[_0x21d5('0x37')]['fields']));_0x1751b8[_0x21d5('0x3a')]=_0x1751b8[_0x21d5('0x3a')]['length']?_0x1751b8[_0x21d5('0x3a')]:_0x50b4e3[_0x21d5('0x35')];_0x1751b8[_0x21d5('0x40')]=qs[_0x21d5('0x41')](_0x31bf82[_0x21d5('0x37')][_0x21d5('0x41')]);_0x1751b8[_0x21d5('0x42')]=qs[_0x21d5('0x38')](_[_0x21d5('0x53')](_0x31bf82[_0x21d5('0x37')],_0x50b4e3['filters']));if(_0x31bf82['query'][_0x21d5('0x43')]){_0x1751b8[_0x21d5('0x42')]=_['merge'](_0x1751b8['where'],{'$or':_['map'](_0x1751b8['attributes'],function(_0x542bde){var _0x20797a={};_0x20797a[_0x542bde]={'$like':'%'+_0x31bf82[_0x21d5('0x37')][_0x21d5('0x43')]+'%'};return _0x20797a;})});}_0x1751b8=_[_0x21d5('0x44')]({},_0x1751b8,_0x31bf82[_0x21d5('0x4d')]);return _0x4f7823[_0x21d5('0x51')](_0x1751b8);}})[_0x21d5('0x2b')](function(_0x3928be){if(_0x3928be){_0x3e965b=_0x3928be[_0x21d5('0x3c')];if(!_0x31bf82[_0x21d5('0x37')]['hasOwnProperty'](_0x21d5('0x3e'))){_0x1751b8[_0x21d5('0x23')]=qs[_0x21d5('0x23')](_0x31bf82[_0x21d5('0x37')][_0x21d5('0x23')]);_0x1751b8[_0x21d5('0x3f')]=qs[_0x21d5('0x3f')](_0x31bf82[_0x21d5('0x37')]['offset']);}return _0x4f7823['getConfigurations'](_0x1751b8);}})['then'](function(_0x230a09){if(_0x230a09){return _0x230a09?{'count':_0x3e965b,'rows':_0x230a09}:null;}})[_0x21d5('0x2b')](respondWithResult(_0x4e4b77,null))[_0x21d5('0x4a')](handleError(_0x4e4b77,null));};exports['addConfiguration']=function(_0x94f912,_0x48fc01,_0x347170){if(_0x94f912[_0x21d5('0x50')]['id']){delete _0x94f912[_0x21d5('0x50')]['id'];}return db[_0x21d5('0x32')][_0x21d5('0x52')]({'where':{'id':_0x94f912[_0x21d5('0x4c')]['id']}})[_0x21d5('0x2b')](handleEntityNotFound(_0x48fc01,null))[_0x21d5('0x2b')](function(_0x142655){if(_0x142655){_0x94f912[_0x21d5('0x50')][_0x21d5('0x54')]=_0x142655['id'];_0x94f912[_0x21d5('0x50')]['Subjects']=integrations[_0x21d5('0x55')](_0x94f912[_0x21d5('0x50')]['channel'],_0x94f912[_0x21d5('0x50')][_0x21d5('0x45')]);_0x94f912[_0x21d5('0x50')][_0x21d5('0x56')]=integrations['getDescriptions'](_0x94f912[_0x21d5('0x50')]['channel'],_0x94f912['body'][_0x21d5('0x45')]);return db[_0x21d5('0x57')]['create'](_0x94f912[_0x21d5('0x50')],{'include':[{'model':db[_0x21d5('0x58')],'as':_0x21d5('0x59')},{'model':db[_0x21d5('0x58')],'as':_0x21d5('0x56')}]});}return null;})[_0x21d5('0x2b')](respondWithResult(_0x48fc01,null))[_0x21d5('0x4a')](handleError(_0x48fc01,null));};exports['getFields']=function(_0x4b476d,_0x4961ff,_0x130795){var _0x3d24a7=[{'name':'priority','label':_0x21d5('0x5a'),'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 _0x2ad787='';return db[_0x21d5('0x32')][_0x21d5('0x52')]({'where':{'id':_0x4b476d[_0x21d5('0x4c')]['id']},'attributes':['id',_0x21d5('0x5b'),_0x21d5('0x5c'),'username',_0x21d5('0x5d'),_0x21d5('0x5e'),_0x21d5('0x5f'),_0x21d5('0x60'),_0x21d5('0x61')]})[_0x21d5('0x2b')](handleEntityNotFound(_0x4961ff,null))[_0x21d5('0x2b')](function(_0x29bdd6){if(_0x29bdd6){_0x2ad787=_0x29bdd6[_0x21d5('0x5b')];var _0xf4ab4e=_0x2ad787['slice'](-0x1);if(_0xf4ab4e==='/'){_0x2ad787=_0x2ad787[_0x21d5('0x62')](0x0,_0x2ad787[_0x21d5('0x63')](_0xf4ab4e));}var _0x3cdaa6={'method':_0x21d5('0x64'),'uri':util['format'](_0x21d5('0x65'),_0x2ad787),'headers':{'Content-Type':'application/json','Accept':_0x21d5('0x66')},'json':!![]};if(_0x29bdd6[_0x21d5('0x5c')]===_0x21d5('0x67')){_0x3cdaa6[_0x21d5('0x68')]['Authorization']=util['format'](_0x21d5('0x69'),new Buffer(util[_0x21d5('0x6a')]('%s:%s',_0x29bdd6[_0x21d5('0x6b')],_0x29bdd6[_0x21d5('0x5d')]))[_0x21d5('0x6c')](_0x21d5('0x6d')));}return rp(_0x3cdaa6)[_0x21d5('0x2b')](function(_0x482847){return _0x3d24a7[_0x21d5('0x6e')](_[_0x21d5('0x31')](_0x482847[_0x21d5('0x6f')][_0x21d5('0x70')],function(_0x255f28){return{'id':_0x255f28[_0x21d5('0x2f')],'name':_0x255f28[_0x21d5('0x2f')],'type':_0x255f28['type'],'active':_0x255f28[_0x21d5('0x71')],'label':_0x255f28[_0x21d5('0x72')],'custom':!![]};}));});}})['then'](function(_0x323754){return{'count':_0x323754['length'],'rows':_0x323754};})[_0x21d5('0x2b')](respondWithResult(_0x4961ff,null))[_0x21d5('0x4a')](function(_0x1c682f){var _0x39c8d5=_0x4b476d[_0x21d5('0x37')][_0x21d5('0x73')]?0x1f4:_0x1c682f[_0x21d5('0x74')]||0x1f4;logger['error'](_0x21d5('0x75'),_0x21d5('0x76'),_0x39c8d5,JSON[_0x21d5('0x77')](_0x1c682f));delete _0x1c682f[_0x21d5('0x2f')];if(_0x39c8d5===0x191){_0x39c8d5=0x190;}_0x4961ff['status'](_0x39c8d5)[_0x21d5('0x30')](_0x4b476d['query'][_0x21d5('0x73')]?{'message':_0x21d5('0x78'),'statusCode':_0x1c682f[_0x21d5('0x74')]}:_0x1c682f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 7d83fa2..d795a7e 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 _0x4ac3=['define','int_desk_accounts','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x315de8,_0x1776fd){var _0x35adf4=function(_0x2ffac7){while(--_0x2ffac7){_0x315de8['push'](_0x315de8['shift']());}};_0x35adf4(++_0x1776fd);}(_0x4ac3,0x124));var _0x34ac=function(_0x321370,_0x19ba69){_0x321370=_0x321370-0x0;var _0x5504c7=_0x4ac3[_0x321370];return _0x5504c7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x34ac('0x0'))(_0x34ac('0x1'));var moment=require(_0x34ac('0x2'));var BPromise=require(_0x34ac('0x3'));var rp=require(_0x34ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x34ac('0x5'));var config=require(_0x34ac('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x34ac('0x7')]=function(_0x2ca2a4,_0x45a444){return _0x2ca2a4[_0x34ac('0x8')]('DeskAccount',attributes,{'tableName':_0x34ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6022=['bluebird','request-promise','../../config/environment','../../components/integrations/configuration','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x3a77c1,_0xf7d5ec){var _0x36ddb1=function(_0x451a10){while(--_0x451a10){_0x3a77c1['push'](_0x3a77c1['shift']());}};_0x36ddb1(++_0xf7d5ec);}(_0x6022,0x7d));var _0x2602=function(_0x72d69d,_0x2698c5){_0x72d69d=_0x72d69d-0x0;var _0x578c9d=_0x6022[_0x72d69d];return _0x578c9d;};'use strict';var _=require(_0x2602('0x0'));var util=require(_0x2602('0x1'));var logger=require(_0x2602('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2602('0x3'));var rp=require(_0x2602('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2602('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x2602('0x6'));module['exports']=function(_0x18ddb6,_0x38ee0a){return _0x18ddb6['define']('DeskAccount',attributes,{'tableName':_0x2602('0x7'),'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 ba6f77d..5a05a69 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 _0x0f85=['ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount'];(function(_0x21add9,_0x323ca9){var _0x16d218=function(_0x5e59eb){while(--_0x5e59eb){_0x21add9['push'](_0x21add9['shift']());}};_0x16d218(++_0x323ca9);}(_0x0f85,0x77));var _0x50f8=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x0f85[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x50f8('0x0'));var util=require(_0x50f8('0x1'));var moment=require(_0x50f8('0x2'));var BPromise=require(_0x50f8('0x3'));var rs=require(_0x50f8('0x4'));var fs=require('fs');var Redis=require(_0x50f8('0x5'));var db=require(_0x50f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x50f8('0x7'))(_0x50f8('0x8'));var config=require(_0x50f8('0x9'));var jayson=require(_0x50f8('0xa'));var client=jayson[_0x50f8('0xb')][_0x50f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33c9b3,_0x50384b,_0x299e42){return new BPromise(function(_0x2618dc,_0x2bec52){return client[_0x50f8('0xd')](_0x33c9b3,_0x299e42)[_0x50f8('0xe')](function(_0x5e2910){logger[_0x50f8('0xf')](_0x50f8('0x10'),_0x50384b,_0x50f8('0x11'));logger[_0x50f8('0x12')](_0x50f8('0x13'),_0x50384b,_0x50f8('0x11'),JSON[_0x50f8('0x14')](_0x5e2910));if(_0x5e2910['error']){if(_0x5e2910[_0x50f8('0x15')][_0x50f8('0x16')]===0x1f4){logger[_0x50f8('0x15')](_0x50f8('0x10'),_0x50384b,_0x5e2910['error'][_0x50f8('0x17')]);return _0x2bec52(_0x5e2910[_0x50f8('0x15')][_0x50f8('0x17')]);}logger['error'](_0x50f8('0x10'),_0x50384b,_0x5e2910[_0x50f8('0x15')][_0x50f8('0x17')]);return _0x2618dc(_0x5e2910[_0x50f8('0x15')][_0x50f8('0x17')]);}else{logger['info'](_0x50f8('0x10'),_0x50384b,_0x50f8('0x11'));_0x2618dc(_0x5e2910[_0x50f8('0x18')][_0x50f8('0x17')]);}})[_0x50f8('0x19')](function(_0x1d926d){logger['error'](_0x50f8('0x10'),_0x50384b,_0x1d926d);_0x2bec52(_0x1d926d);});});}exports['GetDeskAccount']=function(_0x5e54f3){var _0x376804=this;return new Promise(function(_0x4d00cd,_0x2d3c7e){return db[_0x50f8('0x1a')][_0x50f8('0x1b')]({'raw':_0x5e54f3[_0x50f8('0x1c')]?_0x5e54f3['options'][_0x50f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e54f3['options']?_0x5e54f3[_0x50f8('0x1c')][_0x50f8('0x1e')]||null:null,'attributes':_0x5e54f3[_0x50f8('0x1c')]?_0x5e54f3[_0x50f8('0x1c')][_0x50f8('0x1f')]||null:null,'limit':_0x5e54f3[_0x50f8('0x1c')]?_0x5e54f3[_0x50f8('0x1c')][_0x50f8('0x20')]||null:null,'include':_0x5e54f3[_0x50f8('0x1c')]?_0x5e54f3[_0x50f8('0x1c')][_0x50f8('0x21')]?_[_0x50f8('0x22')](_0x5e54f3[_0x50f8('0x1c')]['include'],function(_0x2a7d1e){return{'model':db[_0x2a7d1e[_0x50f8('0x23')]],'as':_0x2a7d1e['as'],'attributes':_0x2a7d1e[_0x50f8('0x1f')],'include':_0x2a7d1e['include']?_[_0x50f8('0x22')](_0x2a7d1e[_0x50f8('0x21')],function(_0x54459d){return{'model':db[_0x54459d[_0x50f8('0x23')]],'as':_0x54459d['as'],'attributes':_0x54459d['attributes'],'include':_0x54459d['include']?_[_0x50f8('0x22')](_0x54459d[_0x50f8('0x21')],function(_0x56367c){return{'model':db[_0x56367c[_0x50f8('0x23')]],'as':_0x56367c['as'],'attributes':_0x56367c[_0x50f8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x50f8('0xe')](function(_0x221008){logger['info'](_0x50f8('0x24'),_0x5e54f3);logger['debug'](_0x50f8('0x24'),_0x5e54f3,JSON[_0x50f8('0x14')](_0x221008));_0x4d00cd(_0x221008);})['catch'](function(_0x4f039b){logger[_0x50f8('0x15')](_0x50f8('0x24'),_0x4f039b[_0x50f8('0x17')],_0x5e54f3);_0x2d3c7e(_0x376804[_0x50f8('0x15')](0x1f4,_0x4f039b[_0x50f8('0x17')]));});});};exports[_0x50f8('0x25')]=function(_0x400f78){var _0x3aa8cb=this;return new Promise(function(_0x1db28f,_0x117848){return db['DeskAccount'][_0x50f8('0x26')]({'raw':_0x400f78['options']?_0x400f78[_0x50f8('0x1c')][_0x50f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x400f78[_0x50f8('0x1c')]?_0x400f78[_0x50f8('0x1c')][_0x50f8('0x1e')]||null:null,'attributes':_0x400f78[_0x50f8('0x1c')]?_0x400f78[_0x50f8('0x1c')]['attributes']||null:null,'include':_0x400f78[_0x50f8('0x1c')]?_0x400f78[_0x50f8('0x1c')][_0x50f8('0x21')]?_[_0x50f8('0x22')](_0x400f78[_0x50f8('0x1c')]['include'],function(_0x711474){return{'model':db[_0x711474[_0x50f8('0x23')]],'as':_0x711474['as'],'attributes':_0x711474[_0x50f8('0x1f')],'include':_0x711474['include']?_[_0x50f8('0x22')](_0x711474['include'],function(_0x1606b7){return{'model':db[_0x1606b7['model']],'as':_0x1606b7['as'],'attributes':_0x1606b7[_0x50f8('0x1f')],'include':_0x1606b7[_0x50f8('0x21')]?_['map'](_0x1606b7[_0x50f8('0x21')],function(_0x1ac9fd){return{'model':db[_0x1ac9fd['model']],'as':_0x1ac9fd['as'],'attributes':_0x1ac9fd[_0x50f8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x50f8('0xe')](function(_0x351533){logger[_0x50f8('0xf')]('ShowDeskAccount',_0x400f78);logger[_0x50f8('0x12')](_0x50f8('0x25'),_0x400f78,JSON['stringify'](_0x351533));_0x1db28f(_0x351533);})[_0x50f8('0x19')](function(_0x59731d){logger['error'](_0x50f8('0x25'),_0x59731d['message'],_0x400f78);_0x117848(_0x3aa8cb[_0x50f8('0x15')](0x1f4,_0x59731d['message']));});});}; \ No newline at end of file +var _0xdbdd=['info','debug','ShowDeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','model','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdbdd,0x93));var _0xddbd=function(_0x3d7aaa,_0x122444){_0x3d7aaa=_0x3d7aaa-0x0;var _0x3a53b3=_0xdbdd[_0x3d7aaa];return _0x3a53b3;};'use strict';var _=require(_0xddbd('0x0'));var util=require(_0xddbd('0x1'));var moment=require(_0xddbd('0x2'));var BPromise=require(_0xddbd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddbd('0x4'));var db=require(_0xddbd('0x5'))['db'];var utils=require(_0xddbd('0x6'));var logger=require('../../config/logger')(_0xddbd('0x7'));var config=require(_0xddbd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xddbd('0x9')][_0xddbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eeda4,_0xac4e0f,_0x27b550){return new BPromise(function(_0x1bbcee,_0x6dc83d){return client[_0xddbd('0xb')](_0x5eeda4,_0x27b550)[_0xddbd('0xc')](function(_0x532cd1){logger['info'](_0xddbd('0xd'),_0xac4e0f,_0xddbd('0xe'));logger['debug'](_0xddbd('0xf'),_0xac4e0f,'request\x20sent',JSON[_0xddbd('0x10')](_0x532cd1));if(_0x532cd1[_0xddbd('0x11')]){if(_0x532cd1['error'][_0xddbd('0x12')]===0x1f4){logger['error'](_0xddbd('0xd'),_0xac4e0f,_0x532cd1[_0xddbd('0x11')]['message']);return _0x6dc83d(_0x532cd1[_0xddbd('0x11')]['message']);}logger[_0xddbd('0x11')](_0xddbd('0xd'),_0xac4e0f,_0x532cd1['error'][_0xddbd('0x13')]);return _0x1bbcee(_0x532cd1[_0xddbd('0x11')][_0xddbd('0x13')]);}else{logger['info'](_0xddbd('0xd'),_0xac4e0f,_0xddbd('0xe'));_0x1bbcee(_0x532cd1[_0xddbd('0x14')][_0xddbd('0x13')]);}})[_0xddbd('0x15')](function(_0x3c7a69){logger[_0xddbd('0x11')](_0xddbd('0xd'),_0xac4e0f,_0x3c7a69);_0x6dc83d(_0x3c7a69);});});}exports[_0xddbd('0x16')]=function(_0x404689){var _0x3e6a62=this;return new Promise(function(_0x2f1720,_0x20d77a){return db[_0xddbd('0x17')][_0xddbd('0x18')]({'raw':_0x404689['options']?_0x404689[_0xddbd('0x19')][_0xddbd('0x1a')]===undefined?!![]:![]:!![],'where':_0x404689['options']?_0x404689[_0xddbd('0x19')][_0xddbd('0x1b')]||null:null,'attributes':_0x404689['options']?_0x404689[_0xddbd('0x19')][_0xddbd('0x1c')]||null:null,'limit':_0x404689[_0xddbd('0x19')]?_0x404689[_0xddbd('0x19')][_0xddbd('0x1d')]||null:null,'include':_0x404689[_0xddbd('0x19')]?_0x404689[_0xddbd('0x19')]['include']?_[_0xddbd('0x1e')](_0x404689[_0xddbd('0x19')]['include'],function(_0x225706){return{'model':db[_0x225706[_0xddbd('0x1f')]],'as':_0x225706['as'],'attributes':_0x225706[_0xddbd('0x1c')],'include':_0x225706[_0xddbd('0x20')]?_['map'](_0x225706[_0xddbd('0x20')],function(_0x4afa00){return{'model':db[_0x4afa00[_0xddbd('0x1f')]],'as':_0x4afa00['as'],'attributes':_0x4afa00[_0xddbd('0x1c')],'include':_0x4afa00['include']?_[_0xddbd('0x1e')](_0x4afa00[_0xddbd('0x20')],function(_0x3b78e6){return{'model':db[_0x3b78e6[_0xddbd('0x1f')]],'as':_0x3b78e6['as'],'attributes':_0x3b78e6[_0xddbd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xddbd('0xc')](function(_0x54da88){logger[_0xddbd('0x21')](_0xddbd('0x16'),_0x404689);logger[_0xddbd('0x22')](_0xddbd('0x16'),_0x404689,JSON[_0xddbd('0x10')](_0x54da88));_0x2f1720(_0x54da88);})[_0xddbd('0x15')](function(_0x1ecdc5){logger['error']('GetDeskAccount',_0x1ecdc5[_0xddbd('0x13')],_0x404689);_0x20d77a(_0x3e6a62['error'](0x1f4,_0x1ecdc5[_0xddbd('0x13')]));});});};exports[_0xddbd('0x23')]=function(_0x4ff244){var _0x5dc96=this;return new Promise(function(_0x1ba3bd,_0x57027){return db['DeskAccount']['find']({'raw':_0x4ff244[_0xddbd('0x19')]?_0x4ff244[_0xddbd('0x19')][_0xddbd('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ff244['options']?_0x4ff244['options'][_0xddbd('0x1b')]||null:null,'attributes':_0x4ff244['options']?_0x4ff244[_0xddbd('0x19')]['attributes']||null:null,'include':_0x4ff244['options']?_0x4ff244[_0xddbd('0x19')]['include']?_[_0xddbd('0x1e')](_0x4ff244[_0xddbd('0x19')][_0xddbd('0x20')],function(_0x38463c){return{'model':db[_0x38463c[_0xddbd('0x1f')]],'as':_0x38463c['as'],'attributes':_0x38463c[_0xddbd('0x1c')],'include':_0x38463c[_0xddbd('0x20')]?_['map'](_0x38463c['include'],function(_0x20971a){return{'model':db[_0x20971a[_0xddbd('0x1f')]],'as':_0x20971a['as'],'attributes':_0x20971a['attributes'],'include':_0x20971a[_0xddbd('0x20')]?_[_0xddbd('0x1e')](_0x20971a[_0xddbd('0x20')],function(_0x40a006){return{'model':db[_0x40a006[_0xddbd('0x1f')]],'as':_0x40a006['as'],'attributes':_0x40a006[_0xddbd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xddbd('0xc')](function(_0x3af87b){logger[_0xddbd('0x21')]('ShowDeskAccount',_0x4ff244);logger['debug'](_0xddbd('0x23'),_0x4ff244,JSON['stringify'](_0x3af87b));_0x1ba3bd(_0x3af87b);})[_0xddbd('0x15')](function(_0x479638){logger[_0xddbd('0x11')]('ShowDeskAccount',_0x479638['message'],_0x4ff244);_0x57027(_0x5dc96[_0xddbd('0x11')](0x1f4,_0x479638['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 9f2e11d..1cceda1 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x5574d1,_0x1f161c){var _0x5c042a=function(_0x3011c6){while(--_0x3011c6){_0x5574d1['push'](_0x5574d1['shift']());}};_0x5c042a(++_0x1f161c);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=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(_0x5ec364,_0x640d14){var _0xd307f4=function(_0x1fcbdd){while(--_0x1fcbdd){_0x5ec364['push'](_0x5ec364['shift']());}};_0xd307f4(++_0x640d14);}(_0x008c,0x188));var _0xc008=function(_0x3df3c6,_0x496e1a){_0x3df3c6=_0x3df3c6-0x0;var _0x254c43=_0x008c[_0x3df3c6];return _0x254c43;};'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 3639776..dc24ec6 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 _0xee2a=['sequelize','exports','STRING'];(function(_0x51b8a6,_0x3cb235){var _0x42c8e7=function(_0x49ce93){while(--_0x49ce93){_0x51b8a6['push'](_0x51b8a6['shift']());}};_0x42c8e7(++_0x3cb235);}(_0xee2a,0xcf));var _0xaee2=function(_0x538335,_0x517073){_0x538335=_0x538335-0x0;var _0xafd88c=_0xee2a[_0x538335];return _0xafd88c;};'use strict';var Sequelize=require(_0xaee2('0x0'));module[_0xaee2('0x1')]={'name':{'type':Sequelize[_0xaee2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x063c=['sequelize','STRING'];(function(_0x2b2a50,_0x11393d){var _0x25562b=function(_0xe1aebc){while(--_0xe1aebc){_0x2b2a50['push'](_0x2b2a50['shift']());}};_0x25562b(++_0x11393d);}(_0x063c,0x1de));var _0xc063=function(_0x3a39a,_0x1ddf4d){_0x3a39a=_0x3a39a-0x0;var _0x78973d=_0x063c[_0x3a39a];return _0x78973d;};'use strict';var Sequelize=require(_0xc063('0x0'));module['exports']={'name':{'type':Sequelize[_0xc063('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f69070a..d123a8c 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 _0x31ba=['rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','DeskConfiguration','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','DeskField','sort','getSubjects','getDescriptions','Tag','getTags','setTags','ids'];(function(_0x303862,_0x20b5ab){var _0xe6f228=function(_0x41fc5a){while(--_0x41fc5a){_0x303862['push'](_0x303862['shift']());}};_0xe6f228(++_0x20b5ab);}(_0x31ba,0x102));var _0xa31b=function(_0x1c53e1,_0x2f11a8){_0x1c53e1=_0x1c53e1-0x0;var _0x1f5b1f=_0x31ba[_0x1c53e1];return _0x1f5b1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa31b('0x0'));var zipdir=require(_0xa31b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa31b('0x2'));var moment=require(_0xa31b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa31b('0x4'));var util=require(_0xa31b('0x5'));var path=require(_0xa31b('0x6'));var sox=require(_0xa31b('0x7'));var csv=require(_0xa31b('0x8'));var ejs=require(_0xa31b('0x9'));var fs=require('fs');var fs_extra=require(_0xa31b('0xa'));var _=require('lodash');var squel=require(_0xa31b('0xb'));var crypto=require(_0xa31b('0xc'));var jsforce=require(_0xa31b('0xd'));var deskjs=require(_0xa31b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa31b('0xf'));var Redis=require('ioredis');var authService=require(_0xa31b('0x10'));var qs=require(_0xa31b('0x11'));var as=require(_0xa31b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa31b('0x13'));var utils=require(_0xa31b('0x14'));var config=require(_0xa31b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa31b('0x16'))['db'];function respondWithStatusCode(_0x155a08,_0x301e1e){_0x301e1e=_0x301e1e||0xcc;return function(_0x356d25){if(_0x356d25){return _0x155a08[_0xa31b('0x17')](_0x301e1e);}return _0x155a08['status'](_0x301e1e)[_0xa31b('0x18')]();};}function respondWithResult(_0x1920c6,_0x46a7ad){_0x46a7ad=_0x46a7ad||0xc8;return function(_0x2246a8){if(_0x2246a8){return _0x1920c6[_0xa31b('0x19')](_0x46a7ad)[_0xa31b('0x1a')](_0x2246a8);}};}function respondWithFilteredResult(_0x21c4a1,_0x383bed){return function(_0x1f6542){if(_0x1f6542){var _0x225219=typeof _0x383bed['offset']===_0xa31b('0x1b')&&typeof _0x383bed[_0xa31b('0x1c')]===_0xa31b('0x1b');var _0x330453=_0x1f6542[_0xa31b('0x1d')];var _0x1fa90e=_0x225219?0x0:_0x383bed[_0xa31b('0x1e')];var _0x587c55=_0x225219?_0x1f6542[_0xa31b('0x1d')]:_0x383bed[_0xa31b('0x1e')]+_0x383bed[_0xa31b('0x1c')];var _0x4b612f;if(_0x587c55>=_0x330453){_0x587c55=_0x330453;_0x4b612f=0xc8;}else{_0x4b612f=0xce;}_0x21c4a1[_0xa31b('0x19')](_0x4b612f);return _0x21c4a1[_0xa31b('0x1f')](_0xa31b('0x20'),_0x1fa90e+'-'+_0x587c55+'/'+_0x330453)[_0xa31b('0x1a')](_0x1f6542);}return null;};}function patchUpdates(_0x11cf74){return function(_0x70a10a){try{jsonpatch['apply'](_0x70a10a,_0x11cf74,!![]);}catch(_0x181e70){return BPromise[_0xa31b('0x21')](_0x181e70);}return _0x70a10a[_0xa31b('0x22')]();};}function saveUpdates(_0x83cf8d,_0x59536a){return function(_0x15dfb0){if(_0x15dfb0){return _0x15dfb0[_0xa31b('0x23')](_0x83cf8d)[_0xa31b('0x24')](function(_0x453bf8){return _0x453bf8;});}return null;};}function removeEntity(_0x3bb237,_0x3f1b3a){return function(_0x587737){if(_0x587737){return _0x587737[_0xa31b('0x25')]()[_0xa31b('0x24')](function(){_0x3bb237[_0xa31b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x310f1d,_0x541266){return function(_0x1d6603){if(!_0x1d6603){_0x310f1d['sendStatus'](0x194);}return _0x1d6603;};}function handleError(_0x498438,_0x2b0dc2){_0x2b0dc2=_0x2b0dc2||0x1f4;return function(_0x117f50){logger[_0xa31b('0x26')](_0x117f50[_0xa31b('0x27')]);if(_0x117f50[_0xa31b('0x28')]){delete _0x117f50[_0xa31b('0x28')];}_0x498438[_0xa31b('0x19')](_0x2b0dc2)[_0xa31b('0x29')](_0x117f50);};}exports[_0xa31b('0x2a')]=function(_0x5f25fe,_0x356c5f){var _0x57ee17={},_0x3572e4={},_0x14ed5f={'count':0x0,'rows':[]};var _0x55ecbc=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x41db35){return{'name':_0x41db35[_0xa31b('0x2b')],'type':_0x41db35[_0xa31b('0x2c')][_0xa31b('0x2d')]};});_0x3572e4[_0xa31b('0x2e')]=_['map'](_0x55ecbc,'name');_0x3572e4[_0xa31b('0x2f')]=_[_0xa31b('0x30')](_0x5f25fe[_0xa31b('0x2f')]);_0x3572e4[_0xa31b('0x31')]=_[_0xa31b('0x32')](_0x3572e4['model'],_0x3572e4[_0xa31b('0x2f')]);_0x57ee17['attributes']=_[_0xa31b('0x32')](_0x3572e4[_0xa31b('0x2e')],qs[_0xa31b('0x33')](_0x5f25fe[_0xa31b('0x2f')]['fields']));_0x57ee17['attributes']=_0x57ee17[_0xa31b('0x34')][_0xa31b('0x35')]?_0x57ee17[_0xa31b('0x34')]:_0x3572e4[_0xa31b('0x2e')];if(!_0x5f25fe[_0xa31b('0x2f')][_0xa31b('0x36')](_0xa31b('0x37'))){_0x57ee17['limit']=qs[_0xa31b('0x1c')](_0x5f25fe[_0xa31b('0x2f')][_0xa31b('0x1c')]);_0x57ee17[_0xa31b('0x1e')]=qs['offset'](_0x5f25fe[_0xa31b('0x2f')][_0xa31b('0x1e')]);}_0x57ee17[_0xa31b('0x38')]=qs['sort'](_0x5f25fe[_0xa31b('0x2f')]['sort']);_0x57ee17['where']=qs[_0xa31b('0x31')](_[_0xa31b('0x39')](_0x5f25fe[_0xa31b('0x2f')],_0x3572e4[_0xa31b('0x31')]),_0x55ecbc);if(_0x5f25fe[_0xa31b('0x2f')][_0xa31b('0x3a')]){_0x57ee17[_0xa31b('0x3b')]=_[_0xa31b('0x3c')](_0x57ee17[_0xa31b('0x3b')],{'$or':_[_0xa31b('0x3d')](_0x55ecbc,function(_0x2f9fba){if(_0x2f9fba['type']!==_0xa31b('0x3e')){var _0x2016bb={};_0x2016bb[_0x2f9fba[_0xa31b('0x28')]]={'$like':'%'+_0x5f25fe['query'][_0xa31b('0x3a')]+'%'};return _0x2016bb;}})});}_0x57ee17=_[_0xa31b('0x3c')]({},_0x57ee17,_0x5f25fe[_0xa31b('0x3f')]);var _0x35fcf5={'where':_0x57ee17[_0xa31b('0x3b')]};return db['DeskConfiguration'][_0xa31b('0x1d')](_0x35fcf5)[_0xa31b('0x24')](function(_0x2b10a6){_0x14ed5f[_0xa31b('0x1d')]=_0x2b10a6;if(_0x5f25fe[_0xa31b('0x2f')][_0xa31b('0x40')]){_0x57ee17[_0xa31b('0x41')]=[{'all':!![]}];}return db[_0xa31b('0x42')][_0xa31b('0x43')](_0x57ee17);})[_0xa31b('0x24')](function(_0x19393a){_0x14ed5f[_0xa31b('0x44')]=_0x19393a;return _0x14ed5f;})['then'](respondWithFilteredResult(_0x356c5f,_0x57ee17))[_0xa31b('0x45')](handleError(_0x356c5f,null));};exports[_0xa31b('0x46')]=function(_0x35cf3a,_0x5a20a6){var _0x4b0da7={'raw':![],'where':{'id':_0x35cf3a[_0xa31b('0x47')]['id']}},_0x5b881c={};_0x5b881c[_0xa31b('0x2e')]=_[_0xa31b('0x30')](db[_0xa31b('0x42')][_0xa31b('0x48')]);_0x5b881c[_0xa31b('0x2f')]=_[_0xa31b('0x30')](_0x35cf3a[_0xa31b('0x2f')]);_0x5b881c[_0xa31b('0x31')]=_[_0xa31b('0x32')](_0x5b881c[_0xa31b('0x2e')],_0x5b881c[_0xa31b('0x2f')]);_0x4b0da7[_0xa31b('0x34')]=_['intersection'](_0x5b881c[_0xa31b('0x2e')],qs['fields'](_0x35cf3a[_0xa31b('0x2f')]['fields']));_0x4b0da7[_0xa31b('0x34')]=_0x4b0da7[_0xa31b('0x34')][_0xa31b('0x35')]?_0x4b0da7[_0xa31b('0x34')]:_0x5b881c[_0xa31b('0x2e')];if(_0x35cf3a[_0xa31b('0x2f')][_0xa31b('0x40')]){_0x4b0da7[_0xa31b('0x41')]=[{'all':!![]}];}_0x4b0da7=_['merge']({},_0x4b0da7,_0x35cf3a[_0xa31b('0x3f')]);return db['DeskConfiguration'][_0xa31b('0x49')](_0x4b0da7)[_0xa31b('0x24')](handleEntityNotFound(_0x5a20a6,null))[_0xa31b('0x24')](respondWithResult(_0x5a20a6,null))[_0xa31b('0x45')](handleError(_0x5a20a6,null));};exports[_0xa31b('0x4a')]=function(_0x55d1a5,_0x585147){return db[_0xa31b('0x42')]['create'](_0x55d1a5[_0xa31b('0x4b')],{})[_0xa31b('0x24')](respondWithResult(_0x585147,0xc9))['catch'](handleError(_0x585147,null));};exports['update']=function(_0x4d31ed,_0x6d9591){if(_0x4d31ed[_0xa31b('0x4b')]['id']){delete _0x4d31ed['body']['id'];}return db['DeskConfiguration'][_0xa31b('0x49')]({'where':{'id':_0x4d31ed[_0xa31b('0x47')]['id']}})['then'](handleEntityNotFound(_0x6d9591,null))['then'](saveUpdates(_0x4d31ed[_0xa31b('0x4b')],null))[_0xa31b('0x24')](respondWithResult(_0x6d9591,null))[_0xa31b('0x45')](handleError(_0x6d9591,null));};exports['destroy']=function(_0x1688f0,_0x1e8d90){return db[_0xa31b('0x42')][_0xa31b('0x49')]({'where':{'id':_0x1688f0[_0xa31b('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e8d90,null))[_0xa31b('0x24')](removeEntity(_0x1e8d90,null))[_0xa31b('0x45')](handleError(_0x1e8d90,null));};exports[_0xa31b('0x4c')]=function(_0xda1a01,_0x5bc97d,_0x1b54f8){var _0x6d726b={};var _0x1161c7={};var _0x16b235;var _0x181fa5;return db[_0xa31b('0x42')][_0xa31b('0x4d')]({'where':{'id':_0xda1a01[_0xa31b('0x47')]['id']}})[_0xa31b('0x24')](handleEntityNotFound(_0x5bc97d,null))[_0xa31b('0x24')](function(_0x39adda){if(_0x39adda){_0x16b235=_0x39adda;_0x1161c7[_0xa31b('0x2e')]=_[_0xa31b('0x30')](db[_0xa31b('0x4e')][_0xa31b('0x48')]);_0x1161c7[_0xa31b('0x2f')]=_[_0xa31b('0x30')](_0xda1a01[_0xa31b('0x2f')]);_0x1161c7[_0xa31b('0x31')]=_[_0xa31b('0x32')](_0x1161c7[_0xa31b('0x2e')],_0x1161c7['query']);_0x6d726b[_0xa31b('0x34')]=_[_0xa31b('0x32')](_0x1161c7[_0xa31b('0x2e')],qs['fields'](_0xda1a01[_0xa31b('0x2f')][_0xa31b('0x33')]));_0x6d726b['attributes']=_0x6d726b[_0xa31b('0x34')][_0xa31b('0x35')]?_0x6d726b['attributes']:_0x1161c7['model'];_0x6d726b[_0xa31b('0x38')]=qs[_0xa31b('0x4f')](_0xda1a01[_0xa31b('0x2f')]['sort']);_0x6d726b[_0xa31b('0x3b')]=qs[_0xa31b('0x31')](_[_0xa31b('0x39')](_0xda1a01[_0xa31b('0x2f')],_0x1161c7[_0xa31b('0x31')]));if(_0xda1a01[_0xa31b('0x2f')]['filter']){_0x6d726b[_0xa31b('0x3b')]=_[_0xa31b('0x3c')](_0x6d726b[_0xa31b('0x3b')],{'$or':_[_0xa31b('0x3d')](_0x6d726b[_0xa31b('0x34')],function(_0x5ca736){var _0x210a55={};_0x210a55[_0x5ca736]={'$like':'%'+_0xda1a01['query'][_0xa31b('0x3a')]+'%'};return _0x210a55;})});}_0x6d726b=_['merge']({},_0x6d726b,_0xda1a01['options']);return _0x16b235[_0xa31b('0x4c')](_0x6d726b);}})['then'](function(_0x24cb5a){if(_0x24cb5a){_0x181fa5=_0x24cb5a[_0xa31b('0x35')];if(!_0xda1a01[_0xa31b('0x2f')]['hasOwnProperty'](_0xa31b('0x37'))){_0x6d726b[_0xa31b('0x1c')]=qs[_0xa31b('0x1c')](_0xda1a01['query'][_0xa31b('0x1c')]);_0x6d726b['offset']=qs[_0xa31b('0x1e')](_0xda1a01[_0xa31b('0x2f')][_0xa31b('0x1e')]);}return _0x16b235[_0xa31b('0x4c')](_0x6d726b);}})[_0xa31b('0x24')](function(_0x16b230){if(_0x16b230){return _0x16b230?{'count':_0x181fa5,'rows':_0x16b230}:null;}})[_0xa31b('0x24')](respondWithResult(_0x5bc97d,null))[_0xa31b('0x45')](handleError(_0x5bc97d,null));};exports[_0xa31b('0x50')]=function(_0x4ebee6,_0x8b1160,_0x1703d3){var _0xac8c83={};var _0x110e5e={};var _0x531034;var _0x112baa;return db[_0xa31b('0x42')][_0xa31b('0x4d')]({'where':{'id':_0x4ebee6[_0xa31b('0x47')]['id']}})[_0xa31b('0x24')](handleEntityNotFound(_0x8b1160,null))[_0xa31b('0x24')](function(_0x4491f8){if(_0x4491f8){_0x531034=_0x4491f8;_0x110e5e['model']=_['keys'](db['DeskField'][_0xa31b('0x48')]);_0x110e5e[_0xa31b('0x2f')]=_['keys'](_0x4ebee6[_0xa31b('0x2f')]);_0x110e5e['filters']=_[_0xa31b('0x32')](_0x110e5e['model'],_0x110e5e[_0xa31b('0x2f')]);_0xac8c83[_0xa31b('0x34')]=_[_0xa31b('0x32')](_0x110e5e[_0xa31b('0x2e')],qs[_0xa31b('0x33')](_0x4ebee6[_0xa31b('0x2f')]['fields']));_0xac8c83['attributes']=_0xac8c83[_0xa31b('0x34')]['length']?_0xac8c83['attributes']:_0x110e5e[_0xa31b('0x2e')];_0xac8c83['order']=qs[_0xa31b('0x4f')](_0x4ebee6[_0xa31b('0x2f')][_0xa31b('0x4f')]);_0xac8c83['where']=qs['filters'](_[_0xa31b('0x39')](_0x4ebee6['query'],_0x110e5e[_0xa31b('0x31')]));if(_0x4ebee6[_0xa31b('0x2f')][_0xa31b('0x3a')]){_0xac8c83['where']=_[_0xa31b('0x3c')](_0xac8c83[_0xa31b('0x3b')],{'$or':_['map'](_0xac8c83[_0xa31b('0x34')],function(_0x3f4f8d){var _0x59a4fc={};_0x59a4fc[_0x3f4f8d]={'$like':'%'+_0x4ebee6['query']['filter']+'%'};return _0x59a4fc;})});}_0xac8c83=_['merge']({},_0xac8c83,_0x4ebee6[_0xa31b('0x3f')]);return _0x531034['getSubjects'](_0xac8c83);}})[_0xa31b('0x24')](function(_0xdf8e3f){if(_0xdf8e3f){_0x112baa=_0xdf8e3f['length'];if(!_0x4ebee6[_0xa31b('0x2f')][_0xa31b('0x36')](_0xa31b('0x37'))){_0xac8c83['limit']=qs[_0xa31b('0x1c')](_0x4ebee6[_0xa31b('0x2f')][_0xa31b('0x1c')]);_0xac8c83[_0xa31b('0x1e')]=qs[_0xa31b('0x1e')](_0x4ebee6[_0xa31b('0x2f')][_0xa31b('0x1e')]);}return _0x531034[_0xa31b('0x50')](_0xac8c83);}})[_0xa31b('0x24')](function(_0x320b0a){if(_0x320b0a){return _0x320b0a?{'count':_0x112baa,'rows':_0x320b0a}:null;}})['then'](respondWithResult(_0x8b1160,null))['catch'](handleError(_0x8b1160,null));};exports['getDescriptions']=function(_0x1ac62c,_0x3c7ace,_0x5f03ef){var _0x29db98={};var _0x4cdcd2={};var _0x4dd5e9;var _0x15a361;return db[_0xa31b('0x42')]['findOne']({'where':{'id':_0x1ac62c['params']['id']}})[_0xa31b('0x24')](handleEntityNotFound(_0x3c7ace,null))[_0xa31b('0x24')](function(_0xef88dc){if(_0xef88dc){_0x4dd5e9=_0xef88dc;_0x4cdcd2[_0xa31b('0x2e')]=_['keys'](db[_0xa31b('0x4e')][_0xa31b('0x48')]);_0x4cdcd2[_0xa31b('0x2f')]=_[_0xa31b('0x30')](_0x1ac62c[_0xa31b('0x2f')]);_0x4cdcd2[_0xa31b('0x31')]=_[_0xa31b('0x32')](_0x4cdcd2['model'],_0x4cdcd2[_0xa31b('0x2f')]);_0x29db98[_0xa31b('0x34')]=_[_0xa31b('0x32')](_0x4cdcd2['model'],qs['fields'](_0x1ac62c[_0xa31b('0x2f')][_0xa31b('0x33')]));_0x29db98[_0xa31b('0x34')]=_0x29db98[_0xa31b('0x34')][_0xa31b('0x35')]?_0x29db98[_0xa31b('0x34')]:_0x4cdcd2[_0xa31b('0x2e')];_0x29db98[_0xa31b('0x38')]=qs['sort'](_0x1ac62c[_0xa31b('0x2f')]['sort']);_0x29db98[_0xa31b('0x3b')]=qs[_0xa31b('0x31')](_['pick'](_0x1ac62c[_0xa31b('0x2f')],_0x4cdcd2[_0xa31b('0x31')]));if(_0x1ac62c[_0xa31b('0x2f')][_0xa31b('0x3a')]){_0x29db98[_0xa31b('0x3b')]=_[_0xa31b('0x3c')](_0x29db98[_0xa31b('0x3b')],{'$or':_[_0xa31b('0x3d')](_0x29db98[_0xa31b('0x34')],function(_0x675804){var _0x5c3880={};_0x5c3880[_0x675804]={'$like':'%'+_0x1ac62c[_0xa31b('0x2f')][_0xa31b('0x3a')]+'%'};return _0x5c3880;})});}_0x29db98=_['merge']({},_0x29db98,_0x1ac62c['options']);return _0x4dd5e9['getDescriptions'](_0x29db98);}})['then'](function(_0x4d1bdb){if(_0x4d1bdb){_0x15a361=_0x4d1bdb[_0xa31b('0x35')];if(!_0x1ac62c['query'][_0xa31b('0x36')]('nolimit')){_0x29db98[_0xa31b('0x1c')]=qs[_0xa31b('0x1c')](_0x1ac62c[_0xa31b('0x2f')]['limit']);_0x29db98['offset']=qs[_0xa31b('0x1e')](_0x1ac62c[_0xa31b('0x2f')]['offset']);}return _0x4dd5e9[_0xa31b('0x51')](_0x29db98);}})['then'](function(_0x5556ef){if(_0x5556ef){return _0x5556ef?{'count':_0x15a361,'rows':_0x5556ef}:null;}})['then'](respondWithResult(_0x3c7ace,null))[_0xa31b('0x45')](handleError(_0x3c7ace,null));};exports['getTags']=function(_0x852abf,_0x506112,_0x4cd9fc){var _0x302313={};var _0x2e5ff2={};var _0x1e8026;var _0x12ce92;return db[_0xa31b('0x42')][_0xa31b('0x4d')]({'where':{'id':_0x852abf['params']['id']}})[_0xa31b('0x24')](handleEntityNotFound(_0x506112,null))['then'](function(_0x118e7a){if(_0x118e7a){_0x1e8026=_0x118e7a;_0x2e5ff2[_0xa31b('0x2e')]=_[_0xa31b('0x30')](db[_0xa31b('0x52')]['rawAttributes']);_0x2e5ff2[_0xa31b('0x2f')]=_['keys'](_0x852abf[_0xa31b('0x2f')]);_0x2e5ff2[_0xa31b('0x31')]=_[_0xa31b('0x32')](_0x2e5ff2[_0xa31b('0x2e')],_0x2e5ff2[_0xa31b('0x2f')]);_0x302313[_0xa31b('0x34')]=_[_0xa31b('0x32')](_0x2e5ff2['model'],qs['fields'](_0x852abf[_0xa31b('0x2f')][_0xa31b('0x33')]));_0x302313[_0xa31b('0x34')]=_0x302313[_0xa31b('0x34')]['length']?_0x302313['attributes']:_0x2e5ff2['model'];_0x302313[_0xa31b('0x38')]=qs['sort'](_0x852abf[_0xa31b('0x2f')]['sort']);_0x302313[_0xa31b('0x3b')]=qs[_0xa31b('0x31')](_[_0xa31b('0x39')](_0x852abf['query'],_0x2e5ff2[_0xa31b('0x31')]));if(_0x852abf[_0xa31b('0x2f')]['filter']){_0x302313[_0xa31b('0x3b')]=_[_0xa31b('0x3c')](_0x302313[_0xa31b('0x3b')],{'$or':_[_0xa31b('0x3d')](_0x302313[_0xa31b('0x34')],function(_0x4d7440){var _0x4f435e={};_0x4f435e[_0x4d7440]={'$like':'%'+_0x852abf['query']['filter']+'%'};return _0x4f435e;})});}_0x302313=_[_0xa31b('0x3c')]({},_0x302313,_0x852abf[_0xa31b('0x3f')]);return _0x1e8026[_0xa31b('0x53')](_0x302313);}})[_0xa31b('0x24')](function(_0xc7b39d){if(_0xc7b39d){_0x12ce92=_0xc7b39d[_0xa31b('0x35')];if(!_0x852abf[_0xa31b('0x2f')][_0xa31b('0x36')](_0xa31b('0x37'))){_0x302313['limit']=qs['limit'](_0x852abf[_0xa31b('0x2f')][_0xa31b('0x1c')]);_0x302313['offset']=qs[_0xa31b('0x1e')](_0x852abf[_0xa31b('0x2f')]['offset']);}return _0x1e8026['getTags'](_0x302313);}})['then'](function(_0x67491f){if(_0x67491f){return _0x67491f?{'count':_0x12ce92,'rows':_0x67491f}:null;}})['then'](respondWithResult(_0x506112,null))[_0xa31b('0x45')](handleError(_0x506112,null));};exports[_0xa31b('0x54')]=function(_0x1e1ec8,_0x127274,_0x4209b8){if(_0x1e1ec8['body']['id']){delete _0x1e1ec8['body']['id'];}return db[_0xa31b('0x42')]['findOne']({'where':{'id':_0x1e1ec8[_0xa31b('0x47')]['id']}})[_0xa31b('0x24')](handleEntityNotFound(_0x127274,null))[_0xa31b('0x24')](function(_0x317924){if(_0x317924){return _0x317924[_0xa31b('0x54')](_0x1e1ec8['body'][_0xa31b('0x55')]||[]);}return null;})[_0xa31b('0x24')](respondWithResult(_0x127274,null))[_0xa31b('0x45')](handleError(_0x127274,null));}; \ No newline at end of file +var _0x8c53=['getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','DeskConfiguration','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','length','options','find','body','params','order','getFields','findOne','DeskField'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x8c53,0xab));var _0x38c5=function(_0x2d3a66,_0xfd9b70){_0x2d3a66=_0x2d3a66-0x0;var _0x2c6fec=_0x8c53[_0x2d3a66];return _0x2c6fec;};'use strict';var emlformat=require(_0x38c5('0x0'));var rimraf=require(_0x38c5('0x1'));var zipdir=require(_0x38c5('0x2'));var jsonpatch=require(_0x38c5('0x3'));var rp=require(_0x38c5('0x4'));var moment=require(_0x38c5('0x5'));var BPromise=require(_0x38c5('0x6'));var Mustache=require(_0x38c5('0x7'));var util=require(_0x38c5('0x8'));var path=require('path');var sox=require(_0x38c5('0x9'));var csv=require(_0x38c5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38c5('0xb'));var _=require(_0x38c5('0xc'));var squel=require(_0x38c5('0xd'));var crypto=require(_0x38c5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x38c5('0xf'));var toCsv=require(_0x38c5('0xa'));var querystring=require(_0x38c5('0x10'));var Papa=require(_0x38c5('0x11'));var Redis=require(_0x38c5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x38c5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38c5('0x14'));var logger=require(_0x38c5('0x15'))('api');var utils=require(_0x38c5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x38c5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xabee9e,_0x2544bb){_0x2544bb=_0x2544bb||0xcc;return function(_0x4ba7ee){if(_0x4ba7ee){return _0xabee9e[_0x38c5('0x18')](_0x2544bb);}return _0xabee9e[_0x38c5('0x19')](_0x2544bb)[_0x38c5('0x1a')]();};}function respondWithResult(_0x42bc78,_0xea2b7b){_0xea2b7b=_0xea2b7b||0xc8;return function(_0x1254f2){if(_0x1254f2){return _0x42bc78['status'](_0xea2b7b)['json'](_0x1254f2);}};}function respondWithFilteredResult(_0x3a97c2,_0x8d29ad){return function(_0x279843){if(_0x279843){var _0x2f6f5e=typeof _0x8d29ad[_0x38c5('0x1b')]==='undefined'&&typeof _0x8d29ad[_0x38c5('0x1c')]===_0x38c5('0x1d');var _0x54a81c=_0x279843[_0x38c5('0x1e')];var _0x294be3=_0x2f6f5e?0x0:_0x8d29ad['offset'];var _0x3df48c=_0x2f6f5e?_0x279843[_0x38c5('0x1e')]:_0x8d29ad[_0x38c5('0x1b')]+_0x8d29ad[_0x38c5('0x1c')];var _0x122fe1;if(_0x3df48c>=_0x54a81c){_0x3df48c=_0x54a81c;_0x122fe1=0xc8;}else{_0x122fe1=0xce;}_0x3a97c2[_0x38c5('0x19')](_0x122fe1);return _0x3a97c2[_0x38c5('0x1f')](_0x38c5('0x20'),_0x294be3+'-'+_0x3df48c+'/'+_0x54a81c)[_0x38c5('0x21')](_0x279843);}return null;};}function patchUpdates(_0x4a97eb){return function(_0x15cf57){try{jsonpatch[_0x38c5('0x22')](_0x15cf57,_0x4a97eb,!![]);}catch(_0x4de8eb){return BPromise[_0x38c5('0x23')](_0x4de8eb);}return _0x15cf57[_0x38c5('0x24')]();};}function saveUpdates(_0xfcd433,_0x1215ce){return function(_0x2e8032){if(_0x2e8032){return _0x2e8032[_0x38c5('0x25')](_0xfcd433)[_0x38c5('0x26')](function(_0x41c6a4){return _0x41c6a4;});}return null;};}function removeEntity(_0x57296c,_0x34278d){return function(_0x396081){if(_0x396081){return _0x396081[_0x38c5('0x27')]()['then'](function(){_0x57296c[_0x38c5('0x19')](0xcc)[_0x38c5('0x1a')]();});}};}function handleEntityNotFound(_0xc83bf1,_0xa9dc2f){return function(_0xaaeb7b){if(!_0xaaeb7b){_0xc83bf1['sendStatus'](0x194);}return _0xaaeb7b;};}function handleError(_0x3141e0,_0x596003){_0x596003=_0x596003||0x1f4;return function(_0x2f8566){logger[_0x38c5('0x28')](_0x2f8566['stack']);if(_0x2f8566[_0x38c5('0x29')]){delete _0x2f8566[_0x38c5('0x29')];}_0x3141e0['status'](_0x596003)['send'](_0x2f8566);};}exports[_0x38c5('0x2a')]=function(_0x3dd2fd,_0x5e2455){var _0x54285e={},_0x21681f={},_0x2f3825={'count':0x0,'rows':[]};var _0x5273aa=_[_0x38c5('0x2b')](db[_0x38c5('0x2c')]['rawAttributes'],function(_0x1231f8){return{'name':_0x1231f8[_0x38c5('0x2d')],'type':_0x1231f8['type'][_0x38c5('0x2e')]};});_0x21681f[_0x38c5('0x2f')]=_['map'](_0x5273aa,_0x38c5('0x29'));_0x21681f[_0x38c5('0x30')]=_[_0x38c5('0x31')](_0x3dd2fd['query']);_0x21681f[_0x38c5('0x32')]=_['intersection'](_0x21681f['model'],_0x21681f[_0x38c5('0x30')]);_0x54285e[_0x38c5('0x33')]=_[_0x38c5('0x34')](_0x21681f[_0x38c5('0x2f')],qs[_0x38c5('0x35')](_0x3dd2fd[_0x38c5('0x30')]['fields']));_0x54285e[_0x38c5('0x33')]=_0x54285e[_0x38c5('0x33')]['length']?_0x54285e[_0x38c5('0x33')]:_0x21681f[_0x38c5('0x2f')];if(!_0x3dd2fd[_0x38c5('0x30')][_0x38c5('0x36')](_0x38c5('0x37'))){_0x54285e['limit']=qs[_0x38c5('0x1c')](_0x3dd2fd[_0x38c5('0x30')][_0x38c5('0x1c')]);_0x54285e[_0x38c5('0x1b')]=qs[_0x38c5('0x1b')](_0x3dd2fd['query'][_0x38c5('0x1b')]);}_0x54285e['order']=qs[_0x38c5('0x38')](_0x3dd2fd[_0x38c5('0x30')][_0x38c5('0x38')]);_0x54285e[_0x38c5('0x39')]=qs[_0x38c5('0x32')](_[_0x38c5('0x3a')](_0x3dd2fd[_0x38c5('0x30')],_0x21681f[_0x38c5('0x32')]),_0x5273aa);if(_0x3dd2fd[_0x38c5('0x30')][_0x38c5('0x3b')]){_0x54285e[_0x38c5('0x39')]=_[_0x38c5('0x3c')](_0x54285e[_0x38c5('0x39')],{'$or':_[_0x38c5('0x2b')](_0x5273aa,function(_0x474e53){if(_0x474e53[_0x38c5('0x3d')]!==_0x38c5('0x3e')){var _0x2f7489={};_0x2f7489[_0x474e53[_0x38c5('0x29')]]={'$like':'%'+_0x3dd2fd[_0x38c5('0x30')][_0x38c5('0x3b')]+'%'};return _0x2f7489;}})});}_0x54285e=_[_0x38c5('0x3c')]({},_0x54285e,_0x3dd2fd['options']);var _0x334836={'where':_0x54285e[_0x38c5('0x39')]};return db['DeskConfiguration'][_0x38c5('0x1e')](_0x334836)[_0x38c5('0x26')](function(_0x15b35d){_0x2f3825['count']=_0x15b35d;if(_0x3dd2fd[_0x38c5('0x30')][_0x38c5('0x3f')]){_0x54285e[_0x38c5('0x40')]=[{'all':!![]}];}return db[_0x38c5('0x2c')][_0x38c5('0x41')](_0x54285e);})['then'](function(_0x5d0181){_0x2f3825[_0x38c5('0x42')]=_0x5d0181;return _0x2f3825;})[_0x38c5('0x26')](respondWithFilteredResult(_0x5e2455,_0x54285e))[_0x38c5('0x43')](handleError(_0x5e2455,null));};exports['show']=function(_0x548353,_0x184f6a){var _0x365f2d={'raw':![],'where':{'id':_0x548353['params']['id']}},_0x160dbd={};_0x160dbd['model']=_[_0x38c5('0x31')](db['DeskConfiguration'][_0x38c5('0x44')]);_0x160dbd[_0x38c5('0x30')]=_[_0x38c5('0x31')](_0x548353[_0x38c5('0x30')]);_0x160dbd[_0x38c5('0x32')]=_[_0x38c5('0x34')](_0x160dbd[_0x38c5('0x2f')],_0x160dbd[_0x38c5('0x30')]);_0x365f2d[_0x38c5('0x33')]=_[_0x38c5('0x34')](_0x160dbd[_0x38c5('0x2f')],qs['fields'](_0x548353['query'][_0x38c5('0x35')]));_0x365f2d[_0x38c5('0x33')]=_0x365f2d['attributes'][_0x38c5('0x45')]?_0x365f2d['attributes']:_0x160dbd[_0x38c5('0x2f')];if(_0x548353[_0x38c5('0x30')][_0x38c5('0x3f')]){_0x365f2d[_0x38c5('0x40')]=[{'all':!![]}];}_0x365f2d=_[_0x38c5('0x3c')]({},_0x365f2d,_0x548353[_0x38c5('0x46')]);return db[_0x38c5('0x2c')][_0x38c5('0x47')](_0x365f2d)[_0x38c5('0x26')](handleEntityNotFound(_0x184f6a,null))[_0x38c5('0x26')](respondWithResult(_0x184f6a,null))[_0x38c5('0x43')](handleError(_0x184f6a,null));};exports['create']=function(_0x483e78,_0x17a9ee){return db[_0x38c5('0x2c')]['create'](_0x483e78['body'],{})[_0x38c5('0x26')](respondWithResult(_0x17a9ee,0xc9))['catch'](handleError(_0x17a9ee,null));};exports[_0x38c5('0x25')]=function(_0x1f68df,_0x3fb27d){if(_0x1f68df['body']['id']){delete _0x1f68df[_0x38c5('0x48')]['id'];}return db['DeskConfiguration'][_0x38c5('0x47')]({'where':{'id':_0x1f68df[_0x38c5('0x49')]['id']}})['then'](handleEntityNotFound(_0x3fb27d,null))[_0x38c5('0x26')](saveUpdates(_0x1f68df['body'],null))[_0x38c5('0x26')](respondWithResult(_0x3fb27d,null))['catch'](handleError(_0x3fb27d,null));};exports[_0x38c5('0x27')]=function(_0x591ec4,_0xd02f52){return db['DeskConfiguration']['find']({'where':{'id':_0x591ec4[_0x38c5('0x49')]['id']}})[_0x38c5('0x26')](handleEntityNotFound(_0xd02f52,null))[_0x38c5('0x26')](removeEntity(_0xd02f52,null))[_0x38c5('0x43')](handleError(_0xd02f52,null));};exports['getFields']=function(_0x4eb52f,_0x42e582,_0x4fb052){var _0x49484d={};var _0x122669={};var _0x33a77c;var _0x1c7934;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4eb52f[_0x38c5('0x49')]['id']}})['then'](handleEntityNotFound(_0x42e582,null))[_0x38c5('0x26')](function(_0x1c63f5){if(_0x1c63f5){_0x33a77c=_0x1c63f5;_0x122669['model']=_[_0x38c5('0x31')](db['DeskField'][_0x38c5('0x44')]);_0x122669[_0x38c5('0x30')]=_[_0x38c5('0x31')](_0x4eb52f[_0x38c5('0x30')]);_0x122669['filters']=_[_0x38c5('0x34')](_0x122669[_0x38c5('0x2f')],_0x122669[_0x38c5('0x30')]);_0x49484d[_0x38c5('0x33')]=_[_0x38c5('0x34')](_0x122669[_0x38c5('0x2f')],qs[_0x38c5('0x35')](_0x4eb52f[_0x38c5('0x30')][_0x38c5('0x35')]));_0x49484d[_0x38c5('0x33')]=_0x49484d[_0x38c5('0x33')]['length']?_0x49484d['attributes']:_0x122669[_0x38c5('0x2f')];_0x49484d[_0x38c5('0x4a')]=qs[_0x38c5('0x38')](_0x4eb52f[_0x38c5('0x30')]['sort']);_0x49484d['where']=qs[_0x38c5('0x32')](_[_0x38c5('0x3a')](_0x4eb52f[_0x38c5('0x30')],_0x122669[_0x38c5('0x32')]));if(_0x4eb52f[_0x38c5('0x30')][_0x38c5('0x3b')]){_0x49484d[_0x38c5('0x39')]=_[_0x38c5('0x3c')](_0x49484d[_0x38c5('0x39')],{'$or':_[_0x38c5('0x2b')](_0x49484d[_0x38c5('0x33')],function(_0x1a3a7e){var _0x4113c3={};_0x4113c3[_0x1a3a7e]={'$like':'%'+_0x4eb52f[_0x38c5('0x30')][_0x38c5('0x3b')]+'%'};return _0x4113c3;})});}_0x49484d=_['merge']({},_0x49484d,_0x4eb52f[_0x38c5('0x46')]);return _0x33a77c[_0x38c5('0x4b')](_0x49484d);}})[_0x38c5('0x26')](function(_0x2272a4){if(_0x2272a4){_0x1c7934=_0x2272a4['length'];if(!_0x4eb52f[_0x38c5('0x30')]['hasOwnProperty']('nolimit')){_0x49484d[_0x38c5('0x1c')]=qs[_0x38c5('0x1c')](_0x4eb52f[_0x38c5('0x30')][_0x38c5('0x1c')]);_0x49484d['offset']=qs[_0x38c5('0x1b')](_0x4eb52f[_0x38c5('0x30')][_0x38c5('0x1b')]);}return _0x33a77c[_0x38c5('0x4b')](_0x49484d);}})[_0x38c5('0x26')](function(_0x15d201){if(_0x15d201){return _0x15d201?{'count':_0x1c7934,'rows':_0x15d201}:null;}})[_0x38c5('0x26')](respondWithResult(_0x42e582,null))['catch'](handleError(_0x42e582,null));};exports['getSubjects']=function(_0x2cb7bc,_0x72e62a,_0x4cf712){var _0x37a9f2={};var _0x2d7330={};var _0x3483e0;var _0x27ed8a;return db['DeskConfiguration'][_0x38c5('0x4c')]({'where':{'id':_0x2cb7bc[_0x38c5('0x49')]['id']}})[_0x38c5('0x26')](handleEntityNotFound(_0x72e62a,null))[_0x38c5('0x26')](function(_0x34a132){if(_0x34a132){_0x3483e0=_0x34a132;_0x2d7330[_0x38c5('0x2f')]=_[_0x38c5('0x31')](db[_0x38c5('0x4d')][_0x38c5('0x44')]);_0x2d7330['query']=_[_0x38c5('0x31')](_0x2cb7bc[_0x38c5('0x30')]);_0x2d7330['filters']=_['intersection'](_0x2d7330[_0x38c5('0x2f')],_0x2d7330[_0x38c5('0x30')]);_0x37a9f2['attributes']=_['intersection'](_0x2d7330['model'],qs[_0x38c5('0x35')](_0x2cb7bc['query']['fields']));_0x37a9f2[_0x38c5('0x33')]=_0x37a9f2[_0x38c5('0x33')][_0x38c5('0x45')]?_0x37a9f2[_0x38c5('0x33')]:_0x2d7330[_0x38c5('0x2f')];_0x37a9f2[_0x38c5('0x4a')]=qs[_0x38c5('0x38')](_0x2cb7bc[_0x38c5('0x30')]['sort']);_0x37a9f2[_0x38c5('0x39')]=qs[_0x38c5('0x32')](_[_0x38c5('0x3a')](_0x2cb7bc[_0x38c5('0x30')],_0x2d7330[_0x38c5('0x32')]));if(_0x2cb7bc['query'][_0x38c5('0x3b')]){_0x37a9f2[_0x38c5('0x39')]=_['merge'](_0x37a9f2['where'],{'$or':_[_0x38c5('0x2b')](_0x37a9f2[_0x38c5('0x33')],function(_0x368638){var _0x1adc39={};_0x1adc39[_0x368638]={'$like':'%'+_0x2cb7bc[_0x38c5('0x30')]['filter']+'%'};return _0x1adc39;})});}_0x37a9f2=_['merge']({},_0x37a9f2,_0x2cb7bc[_0x38c5('0x46')]);return _0x3483e0[_0x38c5('0x4e')](_0x37a9f2);}})[_0x38c5('0x26')](function(_0x598eb5){if(_0x598eb5){_0x27ed8a=_0x598eb5[_0x38c5('0x45')];if(!_0x2cb7bc[_0x38c5('0x30')][_0x38c5('0x36')](_0x38c5('0x37'))){_0x37a9f2['limit']=qs[_0x38c5('0x1c')](_0x2cb7bc[_0x38c5('0x30')]['limit']);_0x37a9f2[_0x38c5('0x1b')]=qs[_0x38c5('0x1b')](_0x2cb7bc[_0x38c5('0x30')][_0x38c5('0x1b')]);}return _0x3483e0[_0x38c5('0x4e')](_0x37a9f2);}})[_0x38c5('0x26')](function(_0x5c9755){if(_0x5c9755){return _0x5c9755?{'count':_0x27ed8a,'rows':_0x5c9755}:null;}})[_0x38c5('0x26')](respondWithResult(_0x72e62a,null))[_0x38c5('0x43')](handleError(_0x72e62a,null));};exports[_0x38c5('0x4f')]=function(_0x2fd34c,_0x36538d,_0x549bdc){var _0x67e74a={};var _0x4ea536={};var _0x30c3a9;var _0x1425c4;return db[_0x38c5('0x2c')]['findOne']({'where':{'id':_0x2fd34c[_0x38c5('0x49')]['id']}})[_0x38c5('0x26')](handleEntityNotFound(_0x36538d,null))[_0x38c5('0x26')](function(_0x421f5c){if(_0x421f5c){_0x30c3a9=_0x421f5c;_0x4ea536[_0x38c5('0x2f')]=_[_0x38c5('0x31')](db['DeskField'][_0x38c5('0x44')]);_0x4ea536['query']=_['keys'](_0x2fd34c[_0x38c5('0x30')]);_0x4ea536[_0x38c5('0x32')]=_[_0x38c5('0x34')](_0x4ea536[_0x38c5('0x2f')],_0x4ea536['query']);_0x67e74a[_0x38c5('0x33')]=_[_0x38c5('0x34')](_0x4ea536[_0x38c5('0x2f')],qs['fields'](_0x2fd34c[_0x38c5('0x30')][_0x38c5('0x35')]));_0x67e74a[_0x38c5('0x33')]=_0x67e74a[_0x38c5('0x33')][_0x38c5('0x45')]?_0x67e74a[_0x38c5('0x33')]:_0x4ea536[_0x38c5('0x2f')];_0x67e74a[_0x38c5('0x4a')]=qs[_0x38c5('0x38')](_0x2fd34c['query']['sort']);_0x67e74a['where']=qs[_0x38c5('0x32')](_[_0x38c5('0x3a')](_0x2fd34c[_0x38c5('0x30')],_0x4ea536['filters']));if(_0x2fd34c['query'][_0x38c5('0x3b')]){_0x67e74a[_0x38c5('0x39')]=_[_0x38c5('0x3c')](_0x67e74a['where'],{'$or':_['map'](_0x67e74a[_0x38c5('0x33')],function(_0x2b7f03){var _0x41a2dc={};_0x41a2dc[_0x2b7f03]={'$like':'%'+_0x2fd34c[_0x38c5('0x30')][_0x38c5('0x3b')]+'%'};return _0x41a2dc;})});}_0x67e74a=_[_0x38c5('0x3c')]({},_0x67e74a,_0x2fd34c[_0x38c5('0x46')]);return _0x30c3a9['getDescriptions'](_0x67e74a);}})['then'](function(_0x1cd70f){if(_0x1cd70f){_0x1425c4=_0x1cd70f[_0x38c5('0x45')];if(!_0x2fd34c[_0x38c5('0x30')]['hasOwnProperty']('nolimit')){_0x67e74a['limit']=qs[_0x38c5('0x1c')](_0x2fd34c[_0x38c5('0x30')][_0x38c5('0x1c')]);_0x67e74a['offset']=qs['offset'](_0x2fd34c['query']['offset']);}return _0x30c3a9[_0x38c5('0x4f')](_0x67e74a);}})[_0x38c5('0x26')](function(_0x5bc8bb){if(_0x5bc8bb){return _0x5bc8bb?{'count':_0x1425c4,'rows':_0x5bc8bb}:null;}})[_0x38c5('0x26')](respondWithResult(_0x36538d,null))[_0x38c5('0x43')](handleError(_0x36538d,null));};exports[_0x38c5('0x50')]=function(_0x58492a,_0x126ce8,_0x3bbd86){var _0x47651e={};var _0x5f305c={};var _0x1723b4;var _0x327689;return db[_0x38c5('0x2c')][_0x38c5('0x4c')]({'where':{'id':_0x58492a[_0x38c5('0x49')]['id']}})['then'](handleEntityNotFound(_0x126ce8,null))[_0x38c5('0x26')](function(_0x296335){if(_0x296335){_0x1723b4=_0x296335;_0x5f305c[_0x38c5('0x2f')]=_['keys'](db['Tag'][_0x38c5('0x44')]);_0x5f305c[_0x38c5('0x30')]=_[_0x38c5('0x31')](_0x58492a[_0x38c5('0x30')]);_0x5f305c[_0x38c5('0x32')]=_[_0x38c5('0x34')](_0x5f305c[_0x38c5('0x2f')],_0x5f305c[_0x38c5('0x30')]);_0x47651e[_0x38c5('0x33')]=_[_0x38c5('0x34')](_0x5f305c[_0x38c5('0x2f')],qs[_0x38c5('0x35')](_0x58492a['query'][_0x38c5('0x35')]));_0x47651e[_0x38c5('0x33')]=_0x47651e[_0x38c5('0x33')][_0x38c5('0x45')]?_0x47651e[_0x38c5('0x33')]:_0x5f305c['model'];_0x47651e['order']=qs[_0x38c5('0x38')](_0x58492a[_0x38c5('0x30')][_0x38c5('0x38')]);_0x47651e[_0x38c5('0x39')]=qs[_0x38c5('0x32')](_[_0x38c5('0x3a')](_0x58492a[_0x38c5('0x30')],_0x5f305c[_0x38c5('0x32')]));if(_0x58492a[_0x38c5('0x30')]['filter']){_0x47651e[_0x38c5('0x39')]=_['merge'](_0x47651e['where'],{'$or':_[_0x38c5('0x2b')](_0x47651e[_0x38c5('0x33')],function(_0x549cc6){var _0x5537a5={};_0x5537a5[_0x549cc6]={'$like':'%'+_0x58492a[_0x38c5('0x30')][_0x38c5('0x3b')]+'%'};return _0x5537a5;})});}_0x47651e=_[_0x38c5('0x3c')]({},_0x47651e,_0x58492a[_0x38c5('0x46')]);return _0x1723b4[_0x38c5('0x50')](_0x47651e);}})[_0x38c5('0x26')](function(_0x51f213){if(_0x51f213){_0x327689=_0x51f213[_0x38c5('0x45')];if(!_0x58492a[_0x38c5('0x30')]['hasOwnProperty']('nolimit')){_0x47651e[_0x38c5('0x1c')]=qs[_0x38c5('0x1c')](_0x58492a[_0x38c5('0x30')][_0x38c5('0x1c')]);_0x47651e['offset']=qs['offset'](_0x58492a[_0x38c5('0x30')][_0x38c5('0x1b')]);}return _0x1723b4[_0x38c5('0x50')](_0x47651e);}})[_0x38c5('0x26')](function(_0xcdbe4){if(_0xcdbe4){return _0xcdbe4?{'count':_0x327689,'rows':_0xcdbe4}:null;}})[_0x38c5('0x26')](respondWithResult(_0x126ce8,null))[_0x38c5('0x43')](handleError(_0x126ce8,null));};exports[_0x38c5('0x51')]=function(_0x51b2e0,_0x5c7563,_0x3e048e){if(_0x51b2e0[_0x38c5('0x48')]['id']){delete _0x51b2e0[_0x38c5('0x48')]['id'];}return db[_0x38c5('0x2c')][_0x38c5('0x4c')]({'where':{'id':_0x51b2e0[_0x38c5('0x49')]['id']}})[_0x38c5('0x26')](handleEntityNotFound(_0x5c7563,null))['then'](function(_0x2a50cb){if(_0x2a50cb){return _0x2a50cb['setTags'](_0x51b2e0['body'][_0x38c5('0x52')]||[]);}return null;})[_0x38c5('0x26')](respondWithResult(_0x5c7563,null))['catch'](handleError(_0x5c7563,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 299311a..31bdaaa 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 _0x484f=['../../config/environment','define','util','../../config/logger','path'];(function(_0x2680f8,_0x5c2089){var _0x398eb3=function(_0xe263c1){while(--_0xe263c1){_0x2680f8['push'](_0x2680f8['shift']());}};_0x398eb3(++_0x5c2089);}(_0x484f,0x115));var _0xf484=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x484f[_0x368e09];return _0x14b7df;};'use strict';var _=require('lodash');var util=require(_0xf484('0x0'));var logger=require(_0xf484('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf484('0x2'));var rimraf=require('rimraf');var config=require(_0xf484('0x3'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x39f92e,_0xcdec8a){return _0x39f92e[_0xf484('0x4')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf253=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intDeskConfiguration.attributes','define'];(function(_0x1b05e9,_0x2ce1a0){var _0x265db6=function(_0xa81099){while(--_0xa81099){_0x1b05e9['push'](_0x1b05e9['shift']());}};_0x265db6(++_0x2ce1a0);}(_0xf253,0xf2));var _0x3f25=function(_0xee3c05,_0x5c27c6){_0xee3c05=_0xee3c05-0x0;var _0x2b2f62=_0xf253[_0xee3c05];return _0x2b2f62;};'use strict';var _=require(_0x3f25('0x0'));var util=require(_0x3f25('0x1'));var logger=require(_0x3f25('0x2'))(_0x3f25('0x3'));var moment=require(_0x3f25('0x4'));var BPromise=require(_0x3f25('0x5'));var rp=require(_0x3f25('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3f25('0x7'));var attributes=require(_0x3f25('0x8'));module['exports']=function(_0x1a3884,_0x4321d1){return _0x1a3884[_0x3f25('0x9')](_0x3f25('0xa'),attributes,{'tableName':_0x3f25('0xb'),'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 09cea40..a384fee 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 _0x8a76=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8a76,0x17e));var _0x68a7=function(_0x17a950,_0x208a55){_0x17a950=_0x17a950-0x0;var _0x446fc1=_0x8a76[_0x17a950];return _0x446fc1;};'use strict';var _=require(_0x68a7('0x0'));var util=require('util');var moment=require(_0x68a7('0x1'));var BPromise=require(_0x68a7('0x2'));var rs=require(_0x68a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x68a7('0x4'));var logger=require(_0x68a7('0x5'))(_0x68a7('0x6'));var config=require(_0x68a7('0x7'));var jayson=require(_0x68a7('0x8'));var client=jayson[_0x68a7('0x9')][_0x68a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc65149,_0x37379b,_0x4d1d75){return new BPromise(function(_0x1712b8,_0x1a5f7f){return client[_0x68a7('0xb')](_0xc65149,_0x4d1d75)[_0x68a7('0xc')](function(_0x2b10b3){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x37379b,_0x68a7('0xd'));logger[_0x68a7('0xe')](_0x68a7('0xf'),_0x37379b,_0x68a7('0xd'),JSON['stringify'](_0x2b10b3));if(_0x2b10b3[_0x68a7('0x10')]){if(_0x2b10b3[_0x68a7('0x10')]['code']===0x1f4){logger[_0x68a7('0x10')](_0x68a7('0x11'),_0x37379b,_0x2b10b3['error'][_0x68a7('0x12')]);return _0x1a5f7f(_0x2b10b3['error']['message']);}logger[_0x68a7('0x10')](_0x68a7('0x11'),_0x37379b,_0x2b10b3['error']['message']);return _0x1712b8(_0x2b10b3[_0x68a7('0x10')]['message']);}else{logger[_0x68a7('0x13')](_0x68a7('0x11'),_0x37379b,_0x68a7('0xd'));_0x1712b8(_0x2b10b3[_0x68a7('0x14')][_0x68a7('0x12')]);}})[_0x68a7('0x15')](function(_0x3aa110){logger[_0x68a7('0x10')](_0x68a7('0x11'),_0x37379b,_0x3aa110);_0x1a5f7f(_0x3aa110);});});} \ No newline at end of file +var _0x6606=['randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x360e11,_0x2dda89){var _0x211da7=function(_0x5f2f46){while(--_0x5f2f46){_0x360e11['push'](_0x360e11['shift']());}};_0x211da7(++_0x2dda89);}(_0x6606,0x6a));var _0x6660=function(_0x1cf2a7,_0x8f97d4){_0x1cf2a7=_0x1cf2a7-0x0;var _0x2c38c7=_0x6606[_0x1cf2a7];return _0x2c38c7;};'use strict';var _=require(_0x6660('0x0'));var util=require(_0x6660('0x1'));var moment=require(_0x6660('0x2'));var BPromise=require(_0x6660('0x3'));var rs=require(_0x6660('0x4'));var fs=require('fs');var Redis=require(_0x6660('0x5'));var db=require(_0x6660('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6660('0x7'));var config=require('../../config/environment');var jayson=require(_0x6660('0x8'));var client=jayson[_0x6660('0x9')][_0x6660('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f00b1,_0x5e8f24,_0x392c58){return new BPromise(function(_0x59ca1c,_0x551000){return client[_0x6660('0xb')](_0x1f00b1,_0x392c58)[_0x6660('0xc')](function(_0x46a6ca){logger[_0x6660('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x5e8f24,'request\x20sent');logger['debug'](_0x6660('0xe'),_0x5e8f24,'request\x20sent',JSON[_0x6660('0xf')](_0x46a6ca));if(_0x46a6ca[_0x6660('0x10')]){if(_0x46a6ca[_0x6660('0x10')][_0x6660('0x11')]===0x1f4){logger['error'](_0x6660('0x12'),_0x5e8f24,_0x46a6ca['error'][_0x6660('0x13')]);return _0x551000(_0x46a6ca[_0x6660('0x10')][_0x6660('0x13')]);}logger[_0x6660('0x10')](_0x6660('0x12'),_0x5e8f24,_0x46a6ca['error'][_0x6660('0x13')]);return _0x59ca1c(_0x46a6ca[_0x6660('0x10')][_0x6660('0x13')]);}else{logger[_0x6660('0xd')](_0x6660('0x12'),_0x5e8f24,_0x6660('0x14'));_0x59ca1c(_0x46a6ca[_0x6660('0x15')][_0x6660('0x13')]);}})['catch'](function(_0x41d891){logger[_0x6660('0x10')](_0x6660('0x12'),_0x5e8f24,_0x41d891);_0x551000(_0x41d891);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 259bd1d..0d4532b 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 _0x9143=['get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','index'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9143,0x1a9));var _0x3914=function(_0x4dad8d,_0x11be26){_0x4dad8d=_0x4dad8d-0x0;var _0x6ce071=_0x9143[_0x4dad8d];return _0x6ce071;};'use strict';var multer=require(_0x3914('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3914('0x1'));var router=express['Router']();var fs_extra=require(_0x3914('0x2'));var auth=require(_0x3914('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3914('0x4'));var controller=require(_0x3914('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x3914('0x6')]);router[_0x3914('0x7')](_0x3914('0x8'),auth[_0x3914('0x9')](),controller[_0x3914('0xa')]);router[_0x3914('0xb')]('/',auth[_0x3914('0x9')](),controller[_0x3914('0xc')]);router[_0x3914('0xd')](_0x3914('0x8'),auth[_0x3914('0x9')](),controller[_0x3914('0xe')]);router[_0x3914('0xf')](_0x3914('0x8'),auth[_0x3914('0x9')](),controller[_0x3914('0x10')]);module[_0x3914('0x11')]=router; \ No newline at end of file +var _0x9da3=['./intDeskField.controller','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a612d,_0x4f747c){var _0x1fd742=function(_0x4d1cbb){while(--_0x4d1cbb){_0x3a612d['push'](_0x3a612d['shift']());}};_0x1fd742(++_0x4f747c);}(_0x9da3,0x187));var _0x39da=function(_0x554c4c,_0x2f3448){_0x554c4c=_0x554c4c-0x0;var _0x261c8c=_0x9da3[_0x554c4c];return _0x261c8c;};'use strict';var multer=require(_0x39da('0x0'));var util=require(_0x39da('0x1'));var path=require(_0x39da('0x2'));var timeout=require('connect-timeout');var express=require(_0x39da('0x3'));var router=express[_0x39da('0x4')]();var fs_extra=require(_0x39da('0x5'));var auth=require(_0x39da('0x6'));var interaction=require(_0x39da('0x7'));var config=require(_0x39da('0x8'));var controller=require(_0x39da('0x9'));router['get']('/',auth[_0x39da('0xa')](),controller[_0x39da('0xb')]);router['get'](_0x39da('0xc'),auth[_0x39da('0xa')](),controller[_0x39da('0xd')]);router['post']('/',auth[_0x39da('0xa')](),controller[_0x39da('0xe')]);router[_0x39da('0xf')](_0x39da('0xc'),auth[_0x39da('0xa')](),controller[_0x39da('0x10')]);router[_0x39da('0x11')](_0x39da('0xc'),auth[_0x39da('0xa')](),controller[_0x39da('0x12')]);module[_0x39da('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index a341141..8b20ed7 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 _0x231a=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0x231a,0x1b9));var _0xa231=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x231a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xa231('0x0')]={'type':{'type':Sequelize[_0xa231('0x1')](_0xa231('0x2'),_0xa231('0x3'),'customVariable',_0xa231('0x4'),_0xa231('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa231('0x6')]},'key':{'type':Sequelize[_0xa231('0x6')]},'keyType':{'type':Sequelize[_0xa231('0x1')](_0xa231('0x2'),'variable',_0xa231('0x7'))},'keyContent':{'type':Sequelize[_0xa231('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa231('0x6')]},'customField':{'type':Sequelize[_0xa231('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae19=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0xae19,0xf1));var _0x9ae1=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xae19[_0x19159a];return _0xa677f4;};'use strict';var Sequelize=require(_0x9ae1('0x0'));module[_0x9ae1('0x1')]={'type':{'type':Sequelize[_0x9ae1('0x2')](_0x9ae1('0x3'),_0x9ae1('0x4'),_0x9ae1('0x5'),'keyValue',_0x9ae1('0x6')),'defaultValue':_0x9ae1('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9ae1('0x7')]},'keyType':{'type':Sequelize[_0x9ae1('0x2')]('string',_0x9ae1('0x4'),_0x9ae1('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9ae1('0x7')]},'customField':{'type':Sequelize[_0x9ae1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9ae1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 76c7f5b..014e030 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 _0x196b=['includeAll','include','rows','params','keys','find','catch','create','update','body','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','reject','save','sendStatus','stack','send','index','map','DeskField','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','then'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x196b,0x9d));var _0xb196=function(_0x37eb6c,_0x19956e){_0x37eb6c=_0x37eb6c-0x0;var _0x6353f8=_0x196b[_0x37eb6c];return _0x6353f8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb196('0x0'));var jsonpatch=require(_0xb196('0x1'));var rp=require(_0xb196('0x2'));var moment=require(_0xb196('0x3'));var BPromise=require(_0xb196('0x4'));var Mustache=require(_0xb196('0x5'));var util=require(_0xb196('0x6'));var path=require(_0xb196('0x7'));var sox=require(_0xb196('0x8'));var csv=require('to-csv');var ejs=require(_0xb196('0x9'));var fs=require('fs');var fs_extra=require(_0xb196('0xa'));var _=require(_0xb196('0xb'));var squel=require(_0xb196('0xc'));var crypto=require('crypto');var jsforce=require(_0xb196('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb196('0xe'));var querystring=require(_0xb196('0xf'));var Papa=require(_0xb196('0x10'));var Redis=require(_0xb196('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb196('0x12'));var as=require(_0xb196('0x13'));var hardwareService=require(_0xb196('0x14'));var logger=require(_0xb196('0x15'))('api');var utils=require(_0xb196('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb196('0x17'));var db=require(_0xb196('0x18'))['db'];function respondWithStatusCode(_0x292915,_0x3deb0f){_0x3deb0f=_0x3deb0f||0xcc;return function(_0x30dd59){if(_0x30dd59){return _0x292915['sendStatus'](_0x3deb0f);}return _0x292915[_0xb196('0x19')](_0x3deb0f)[_0xb196('0x1a')]();};}function respondWithResult(_0x1473f3,_0x44b7fa){_0x44b7fa=_0x44b7fa||0xc8;return function(_0x184886){if(_0x184886){return _0x1473f3[_0xb196('0x19')](_0x44b7fa)[_0xb196('0x1b')](_0x184886);}};}function respondWithFilteredResult(_0x24b266,_0x5d059f){return function(_0x3e8cb1){if(_0x3e8cb1){var _0x411dc0=typeof _0x5d059f[_0xb196('0x1c')]===_0xb196('0x1d')&&typeof _0x5d059f['limit']===_0xb196('0x1d');var _0x32402f=_0x3e8cb1['count'];var _0x2a85c4=_0x411dc0?0x0:_0x5d059f[_0xb196('0x1c')];var _0x3f8adf=_0x411dc0?_0x3e8cb1[_0xb196('0x1e')]:_0x5d059f[_0xb196('0x1c')]+_0x5d059f['limit'];var _0x28d593;if(_0x3f8adf>=_0x32402f){_0x3f8adf=_0x32402f;_0x28d593=0xc8;}else{_0x28d593=0xce;}_0x24b266[_0xb196('0x19')](_0x28d593);return _0x24b266['set'](_0xb196('0x1f'),_0x2a85c4+'-'+_0x3f8adf+'/'+_0x32402f)[_0xb196('0x1b')](_0x3e8cb1);}return null;};}function patchUpdates(_0x2d0519){return function(_0x3f3ac2){try{jsonpatch['apply'](_0x3f3ac2,_0x2d0519,!![]);}catch(_0x5ba94d){return BPromise[_0xb196('0x20')](_0x5ba94d);}return _0x3f3ac2[_0xb196('0x21')]();};}function saveUpdates(_0x3d3f69,_0x290296){return function(_0x3839f0){if(_0x3839f0){return _0x3839f0['update'](_0x3d3f69)['then'](function(_0x585176){return _0x585176;});}return null;};}function removeEntity(_0x4deb2b,_0x342745){return function(_0x349c5e){if(_0x349c5e){return _0x349c5e['destroy']()['then'](function(){_0x4deb2b['status'](0xcc)[_0xb196('0x1a')]();});}};}function handleEntityNotFound(_0x8209ac,_0x2b9e84){return function(_0x925535){if(!_0x925535){_0x8209ac[_0xb196('0x22')](0x194);}return _0x925535;};}function handleError(_0x855ae2,_0x3b902f){_0x3b902f=_0x3b902f||0x1f4;return function(_0x1e2140){logger['error'](_0x1e2140[_0xb196('0x23')]);if(_0x1e2140['name']){delete _0x1e2140['name'];}_0x855ae2['status'](_0x3b902f)[_0xb196('0x24')](_0x1e2140);};}exports[_0xb196('0x25')]=function(_0x16dd6d,_0x3cf946){var _0x1a0049={},_0x50de49={},_0x205e5f={'count':0x0,'rows':[]};var _0x34a1ab=_[_0xb196('0x26')](db[_0xb196('0x27')][_0xb196('0x28')],function(_0x1988af){return{'name':_0x1988af['fieldName'],'type':_0x1988af[_0xb196('0x29')][_0xb196('0x2a')]};});_0x50de49[_0xb196('0x2b')]=_[_0xb196('0x26')](_0x34a1ab,_0xb196('0x2c'));_0x50de49[_0xb196('0x2d')]=_['keys'](_0x16dd6d[_0xb196('0x2d')]);_0x50de49[_0xb196('0x2e')]=_[_0xb196('0x2f')](_0x50de49[_0xb196('0x2b')],_0x50de49[_0xb196('0x2d')]);_0x1a0049[_0xb196('0x30')]=_[_0xb196('0x2f')](_0x50de49['model'],qs['fields'](_0x16dd6d[_0xb196('0x2d')][_0xb196('0x31')]));_0x1a0049[_0xb196('0x30')]=_0x1a0049[_0xb196('0x30')][_0xb196('0x32')]?_0x1a0049[_0xb196('0x30')]:_0x50de49['model'];if(!_0x16dd6d[_0xb196('0x2d')][_0xb196('0x33')](_0xb196('0x34'))){_0x1a0049['limit']=qs[_0xb196('0x35')](_0x16dd6d['query'][_0xb196('0x35')]);_0x1a0049[_0xb196('0x1c')]=qs[_0xb196('0x1c')](_0x16dd6d[_0xb196('0x2d')][_0xb196('0x1c')]);}_0x1a0049[_0xb196('0x36')]=qs['sort'](_0x16dd6d[_0xb196('0x2d')][_0xb196('0x37')]);_0x1a0049[_0xb196('0x38')]=qs['filters'](_['pick'](_0x16dd6d[_0xb196('0x2d')],_0x50de49['filters']),_0x34a1ab);if(_0x16dd6d[_0xb196('0x2d')][_0xb196('0x39')]){_0x1a0049[_0xb196('0x38')]=_[_0xb196('0x3a')](_0x1a0049[_0xb196('0x38')],{'$or':_['map'](_0x34a1ab,function(_0x148a99){if(_0x148a99[_0xb196('0x29')]!==_0xb196('0x3b')){var _0x38748d={};_0x38748d[_0x148a99['name']]={'$like':'%'+_0x16dd6d[_0xb196('0x2d')][_0xb196('0x39')]+'%'};return _0x38748d;}})});}_0x1a0049=_[_0xb196('0x3a')]({},_0x1a0049,_0x16dd6d[_0xb196('0x3c')]);var _0x42c8a4={'where':_0x1a0049[_0xb196('0x38')]};return db['DeskField'][_0xb196('0x1e')](_0x42c8a4)[_0xb196('0x3d')](function(_0x33a6c4){_0x205e5f[_0xb196('0x1e')]=_0x33a6c4;if(_0x16dd6d['query'][_0xb196('0x3e')]){_0x1a0049[_0xb196('0x3f')]=[{'all':!![]}];}return db[_0xb196('0x27')]['findAll'](_0x1a0049);})['then'](function(_0x390f7d){_0x205e5f[_0xb196('0x40')]=_0x390f7d;return _0x205e5f;})[_0xb196('0x3d')](respondWithFilteredResult(_0x3cf946,_0x1a0049))['catch'](handleError(_0x3cf946,null));};exports['show']=function(_0x357d9a,_0x1eb1f1){var _0x41f9ec={'raw':!![],'where':{'id':_0x357d9a[_0xb196('0x41')]['id']}},_0x12a460={};_0x12a460[_0xb196('0x2b')]=_[_0xb196('0x42')](db['DeskField'][_0xb196('0x28')]);_0x12a460[_0xb196('0x2d')]=_[_0xb196('0x42')](_0x357d9a[_0xb196('0x2d')]);_0x12a460[_0xb196('0x2e')]=_[_0xb196('0x2f')](_0x12a460[_0xb196('0x2b')],_0x12a460['query']);_0x41f9ec[_0xb196('0x30')]=_['intersection'](_0x12a460[_0xb196('0x2b')],qs[_0xb196('0x31')](_0x357d9a[_0xb196('0x2d')][_0xb196('0x31')]));_0x41f9ec[_0xb196('0x30')]=_0x41f9ec['attributes'][_0xb196('0x32')]?_0x41f9ec['attributes']:_0x12a460['model'];if(_0x357d9a[_0xb196('0x2d')][_0xb196('0x3e')]){_0x41f9ec[_0xb196('0x3f')]=[{'all':!![]}];}_0x41f9ec=_[_0xb196('0x3a')]({},_0x41f9ec,_0x357d9a[_0xb196('0x3c')]);return db[_0xb196('0x27')][_0xb196('0x43')](_0x41f9ec)[_0xb196('0x3d')](handleEntityNotFound(_0x1eb1f1,null))['then'](respondWithResult(_0x1eb1f1,null))[_0xb196('0x44')](handleError(_0x1eb1f1,null));};exports[_0xb196('0x45')]=function(_0x53d826,_0x312212){return db[_0xb196('0x27')][_0xb196('0x45')](_0x53d826['body'],{})[_0xb196('0x3d')](respondWithResult(_0x312212,0xc9))[_0xb196('0x44')](handleError(_0x312212,null));};exports[_0xb196('0x46')]=function(_0x5f2be5,_0x56d4a8){if(_0x5f2be5[_0xb196('0x47')]['id']){delete _0x5f2be5[_0xb196('0x47')]['id'];}return db[_0xb196('0x27')][_0xb196('0x43')]({'where':{'id':_0x5f2be5[_0xb196('0x41')]['id']}})[_0xb196('0x3d')](handleEntityNotFound(_0x56d4a8,null))[_0xb196('0x3d')](saveUpdates(_0x5f2be5[_0xb196('0x47')],null))[_0xb196('0x3d')](respondWithResult(_0x56d4a8,null))[_0xb196('0x44')](handleError(_0x56d4a8,null));};exports[_0xb196('0x48')]=function(_0x37bf20,_0x360418){return db[_0xb196('0x27')][_0xb196('0x43')]({'where':{'id':_0x37bf20[_0xb196('0x41')]['id']}})['then'](handleEntityNotFound(_0x360418,null))[_0xb196('0x3d')](removeEntity(_0x360418,null))[_0xb196('0x44')](handleError(_0x360418,null));}; \ No newline at end of file +var _0x4fb4=['attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','reject','save','update','then','sendStatus','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query'];(function(_0x6b4e41,_0x3ed208){var _0x346877=function(_0x5b5d0e){while(--_0x5b5d0e){_0x6b4e41['push'](_0x6b4e41['shift']());}};_0x346877(++_0x3ed208);}(_0x4fb4,0x190));var _0x44fb=function(_0x58d5e1,_0x5f2cb0){_0x58d5e1=_0x58d5e1-0x0;var _0x2a4311=_0x4fb4[_0x58d5e1];return _0x2a4311;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x44fb('0x0'));var zipdir=require(_0x44fb('0x1'));var jsonpatch=require(_0x44fb('0x2'));var rp=require(_0x44fb('0x3'));var moment=require(_0x44fb('0x4'));var BPromise=require(_0x44fb('0x5'));var Mustache=require('mustache');var util=require(_0x44fb('0x6'));var path=require(_0x44fb('0x7'));var sox=require(_0x44fb('0x8'));var csv=require(_0x44fb('0x9'));var ejs=require(_0x44fb('0xa'));var fs=require('fs');var fs_extra=require(_0x44fb('0xb'));var _=require(_0x44fb('0xc'));var squel=require(_0x44fb('0xd'));var crypto=require('crypto');var jsforce=require(_0x44fb('0xe'));var deskjs=require(_0x44fb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x44fb('0x10'));var Papa=require(_0x44fb('0x11'));var Redis=require(_0x44fb('0x12'));var authService=require(_0x44fb('0x13'));var qs=require(_0x44fb('0x14'));var as=require(_0x44fb('0x15'));var hardwareService=require(_0x44fb('0x16'));var logger=require(_0x44fb('0x17'))(_0x44fb('0x18'));var utils=require(_0x44fb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x44fb('0x1a'));var db=require(_0x44fb('0x1b'))['db'];function respondWithStatusCode(_0x40cb86,_0x103b56){_0x103b56=_0x103b56||0xcc;return function(_0x1c1cbc){if(_0x1c1cbc){return _0x40cb86['sendStatus'](_0x103b56);}return _0x40cb86[_0x44fb('0x1c')](_0x103b56)[_0x44fb('0x1d')]();};}function respondWithResult(_0x39fb83,_0x449150){_0x449150=_0x449150||0xc8;return function(_0x9a367d){if(_0x9a367d){return _0x39fb83['status'](_0x449150)[_0x44fb('0x1e')](_0x9a367d);}};}function respondWithFilteredResult(_0x18268c,_0x472658){return function(_0x147fe0){if(_0x147fe0){var _0x550b32=typeof _0x472658[_0x44fb('0x1f')]===_0x44fb('0x20')&&typeof _0x472658['limit']===_0x44fb('0x20');var _0x21886d=_0x147fe0[_0x44fb('0x21')];var _0x13cf75=_0x550b32?0x0:_0x472658[_0x44fb('0x1f')];var _0x22c2eb=_0x550b32?_0x147fe0[_0x44fb('0x21')]:_0x472658[_0x44fb('0x1f')]+_0x472658[_0x44fb('0x22')];var _0x1fc48c;if(_0x22c2eb>=_0x21886d){_0x22c2eb=_0x21886d;_0x1fc48c=0xc8;}else{_0x1fc48c=0xce;}_0x18268c['status'](_0x1fc48c);return _0x18268c['set']('Content-Range',_0x13cf75+'-'+_0x22c2eb+'/'+_0x21886d)[_0x44fb('0x1e')](_0x147fe0);}return null;};}function patchUpdates(_0xca80c){return function(_0x2dd412){try{jsonpatch['apply'](_0x2dd412,_0xca80c,!![]);}catch(_0x52507a){return BPromise[_0x44fb('0x23')](_0x52507a);}return _0x2dd412[_0x44fb('0x24')]();};}function saveUpdates(_0x5adc98,_0x558283){return function(_0x38e834){if(_0x38e834){return _0x38e834[_0x44fb('0x25')](_0x5adc98)[_0x44fb('0x26')](function(_0x4fc66d){return _0x4fc66d;});}return null;};}function removeEntity(_0x954b1d,_0x3563a6){return function(_0x1f3d5c){if(_0x1f3d5c){return _0x1f3d5c['destroy']()['then'](function(){_0x954b1d[_0x44fb('0x1c')](0xcc)[_0x44fb('0x1d')]();});}};}function handleEntityNotFound(_0x1c831e,_0x733c){return function(_0x5e7116){if(!_0x5e7116){_0x1c831e[_0x44fb('0x27')](0x194);}return _0x5e7116;};}function handleError(_0x3a7cd1,_0x4f4c64){_0x4f4c64=_0x4f4c64||0x1f4;return function(_0x5b6ce5){logger[_0x44fb('0x28')](_0x5b6ce5[_0x44fb('0x29')]);if(_0x5b6ce5[_0x44fb('0x2a')]){delete _0x5b6ce5[_0x44fb('0x2a')];}_0x3a7cd1[_0x44fb('0x1c')](_0x4f4c64)[_0x44fb('0x2b')](_0x5b6ce5);};}exports[_0x44fb('0x2c')]=function(_0x35652e,_0x6bd0b4){var _0x4f079d={},_0x48eb7d={},_0x587984={'count':0x0,'rows':[]};var _0x51b40e=_['map'](db[_0x44fb('0x2d')][_0x44fb('0x2e')],function(_0x5e3639){return{'name':_0x5e3639[_0x44fb('0x2f')],'type':_0x5e3639[_0x44fb('0x30')][_0x44fb('0x31')]};});_0x48eb7d[_0x44fb('0x32')]=_[_0x44fb('0x33')](_0x51b40e,'name');_0x48eb7d['query']=_[_0x44fb('0x34')](_0x35652e['query']);_0x48eb7d[_0x44fb('0x35')]=_[_0x44fb('0x36')](_0x48eb7d[_0x44fb('0x32')],_0x48eb7d[_0x44fb('0x37')]);_0x4f079d[_0x44fb('0x38')]=_[_0x44fb('0x36')](_0x48eb7d[_0x44fb('0x32')],qs[_0x44fb('0x39')](_0x35652e[_0x44fb('0x37')][_0x44fb('0x39')]));_0x4f079d[_0x44fb('0x38')]=_0x4f079d[_0x44fb('0x38')][_0x44fb('0x3a')]?_0x4f079d[_0x44fb('0x38')]:_0x48eb7d[_0x44fb('0x32')];if(!_0x35652e['query']['hasOwnProperty']('nolimit')){_0x4f079d[_0x44fb('0x22')]=qs[_0x44fb('0x22')](_0x35652e[_0x44fb('0x37')][_0x44fb('0x22')]);_0x4f079d['offset']=qs[_0x44fb('0x1f')](_0x35652e[_0x44fb('0x37')]['offset']);}_0x4f079d[_0x44fb('0x3b')]=qs['sort'](_0x35652e[_0x44fb('0x37')]['sort']);_0x4f079d[_0x44fb('0x3c')]=qs['filters'](_[_0x44fb('0x3d')](_0x35652e['query'],_0x48eb7d['filters']),_0x51b40e);if(_0x35652e[_0x44fb('0x37')][_0x44fb('0x3e')]){_0x4f079d[_0x44fb('0x3c')]=_[_0x44fb('0x3f')](_0x4f079d[_0x44fb('0x3c')],{'$or':_[_0x44fb('0x33')](_0x51b40e,function(_0x29e6c4){if(_0x29e6c4[_0x44fb('0x30')]!==_0x44fb('0x40')){var _0x2f761b={};_0x2f761b[_0x29e6c4['name']]={'$like':'%'+_0x35652e[_0x44fb('0x37')][_0x44fb('0x3e')]+'%'};return _0x2f761b;}})});}_0x4f079d=_[_0x44fb('0x3f')]({},_0x4f079d,_0x35652e[_0x44fb('0x41')]);var _0x22aa31={'where':_0x4f079d['where']};return db[_0x44fb('0x2d')][_0x44fb('0x21')](_0x22aa31)['then'](function(_0x52d454){_0x587984[_0x44fb('0x21')]=_0x52d454;if(_0x35652e[_0x44fb('0x37')][_0x44fb('0x42')]){_0x4f079d['include']=[{'all':!![]}];}return db[_0x44fb('0x2d')][_0x44fb('0x43')](_0x4f079d);})[_0x44fb('0x26')](function(_0x2bfb76){_0x587984[_0x44fb('0x44')]=_0x2bfb76;return _0x587984;})[_0x44fb('0x26')](respondWithFilteredResult(_0x6bd0b4,_0x4f079d))['catch'](handleError(_0x6bd0b4,null));};exports[_0x44fb('0x45')]=function(_0x537535,_0x40c590){var _0x10243b={'raw':!![],'where':{'id':_0x537535[_0x44fb('0x46')]['id']}},_0x2b66be={};_0x2b66be['model']=_[_0x44fb('0x34')](db[_0x44fb('0x2d')][_0x44fb('0x2e')]);_0x2b66be[_0x44fb('0x37')]=_[_0x44fb('0x34')](_0x537535['query']);_0x2b66be[_0x44fb('0x35')]=_[_0x44fb('0x36')](_0x2b66be[_0x44fb('0x32')],_0x2b66be[_0x44fb('0x37')]);_0x10243b['attributes']=_['intersection'](_0x2b66be[_0x44fb('0x32')],qs[_0x44fb('0x39')](_0x537535['query'][_0x44fb('0x39')]));_0x10243b['attributes']=_0x10243b['attributes']['length']?_0x10243b['attributes']:_0x2b66be[_0x44fb('0x32')];if(_0x537535[_0x44fb('0x37')][_0x44fb('0x42')]){_0x10243b[_0x44fb('0x47')]=[{'all':!![]}];}_0x10243b=_['merge']({},_0x10243b,_0x537535[_0x44fb('0x41')]);return db[_0x44fb('0x2d')][_0x44fb('0x48')](_0x10243b)[_0x44fb('0x26')](handleEntityNotFound(_0x40c590,null))[_0x44fb('0x26')](respondWithResult(_0x40c590,null))[_0x44fb('0x49')](handleError(_0x40c590,null));};exports[_0x44fb('0x4a')]=function(_0x15084d,_0x4d9e1c){return db[_0x44fb('0x2d')]['create'](_0x15084d['body'],{})[_0x44fb('0x26')](respondWithResult(_0x4d9e1c,0xc9))[_0x44fb('0x49')](handleError(_0x4d9e1c,null));};exports[_0x44fb('0x25')]=function(_0x543f14,_0x34fe03){if(_0x543f14[_0x44fb('0x4b')]['id']){delete _0x543f14[_0x44fb('0x4b')]['id'];}return db[_0x44fb('0x2d')][_0x44fb('0x48')]({'where':{'id':_0x543f14[_0x44fb('0x46')]['id']}})[_0x44fb('0x26')](handleEntityNotFound(_0x34fe03,null))['then'](saveUpdates(_0x543f14[_0x44fb('0x4b')],null))['then'](respondWithResult(_0x34fe03,null))[_0x44fb('0x49')](handleError(_0x34fe03,null));};exports['destroy']=function(_0x335437,_0x223013){return db[_0x44fb('0x2d')][_0x44fb('0x48')]({'where':{'id':_0x335437['params']['id']}})[_0x44fb('0x26')](handleEntityNotFound(_0x223013,null))[_0x44fb('0x26')](removeEntity(_0x223013,null))[_0x44fb('0x49')](handleError(_0x223013,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c3c7349..d4031e1 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 _0x1796=['request-promise','path','../../config/environment','./intDeskField.attributes','exports','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','bluebird'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x1796,0x159));var _0x6179=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x1796[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x6179('0x0'));var util=require('util');var logger=require(_0x6179('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6179('0x2'));var rp=require(_0x6179('0x3'));var fs=require('fs');var path=require(_0x6179('0x4'));var rimraf=require('rimraf');var config=require(_0x6179('0x5'));var attributes=require(_0x6179('0x6'));module[_0x6179('0x7')]=function(_0x1c9b41,_0x239ab8){return _0x1c9b41['define']('DeskField',attributes,{'tableName':_0x6179('0x8'),'paranoid':![],'indexes':[{'name':_0x6179('0x9'),'fields':[_0x6179('0xa'),_0x6179('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d6d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','idField'];(function(_0x12827b,_0x47989f){var _0x21bef8=function(_0x571877){while(--_0x571877){_0x12827b['push'](_0x12827b['shift']());}};_0x21bef8(++_0x47989f);}(_0x2d6d,0x69));var _0xd2d6=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x2d6d[_0x3fb9dd];return _0x20136a;};'use strict';var _=require(_0xd2d6('0x0'));var util=require(_0xd2d6('0x1'));var logger=require(_0xd2d6('0x2'))(_0xd2d6('0x3'));var moment=require(_0xd2d6('0x4'));var BPromise=require(_0xd2d6('0x5'));var rp=require(_0xd2d6('0x6'));var fs=require('fs');var path=require(_0xd2d6('0x7'));var rimraf=require(_0xd2d6('0x8'));var config=require(_0xd2d6('0x9'));var attributes=require(_0xd2d6('0xa'));module['exports']=function(_0x422fae,_0x3fb309){return _0x422fae[_0xd2d6('0xb')](_0xd2d6('0xc'),attributes,{'tableName':_0xd2d6('0xd'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xd2d6('0xe'),'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 4b9087c..55e0500 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 _0x534b=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','DeskField,\x20%s,\x20%s','message','result','catch'];(function(_0x43c987,_0x28c7cf){var _0x47740d=function(_0x26b671){while(--_0x26b671){_0x43c987['push'](_0x43c987['shift']());}};_0x47740d(++_0x28c7cf);}(_0x534b,0x69));var _0xb534=function(_0x2ce9af,_0x5a4c66){_0x2ce9af=_0x2ce9af-0x0;var _0x3623af=_0x534b[_0x2ce9af];return _0x3623af;};'use strict';var _=require(_0xb534('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb534('0x1'));var rs=require(_0xb534('0x2'));var fs=require('fs');var Redis=require(_0xb534('0x3'));var db=require(_0xb534('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb534('0x5'))(_0xb534('0x6'));var config=require(_0xb534('0x7'));var jayson=require(_0xb534('0x8'));var client=jayson[_0xb534('0x9')][_0xb534('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c7b2d,_0x548240,_0x143aae){return new BPromise(function(_0x361240,_0x50ca1e){return client[_0xb534('0xb')](_0x1c7b2d,_0x143aae)['then'](function(_0x116049){logger[_0xb534('0xc')]('DeskField,\x20%s,\x20%s',_0x548240,'request\x20sent');logger['debug'](_0xb534('0xd'),_0x548240,_0xb534('0xe'),JSON[_0xb534('0xf')](_0x116049));if(_0x116049[_0xb534('0x10')]){if(_0x116049[_0xb534('0x10')]['code']===0x1f4){logger['error'](_0xb534('0x11'),_0x548240,_0x116049[_0xb534('0x10')][_0xb534('0x12')]);return _0x50ca1e(_0x116049['error'][_0xb534('0x12')]);}logger[_0xb534('0x10')](_0xb534('0x11'),_0x548240,_0x116049[_0xb534('0x10')][_0xb534('0x12')]);return _0x361240(_0x116049[_0xb534('0x10')][_0xb534('0x12')]);}else{logger[_0xb534('0xc')](_0xb534('0x11'),_0x548240,_0xb534('0xe'));_0x361240(_0x116049[_0xb534('0x13')][_0xb534('0x12')]);}})[_0xb534('0x14')](function(_0x4c72b9){logger['error'](_0xb534('0x11'),_0x548240,_0x4c72b9);_0x50ca1e(_0x4c72b9);});});} \ No newline at end of file +var _0x1879=['../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','error','code','message','DeskField,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x5b1a1a,_0x3e7ecf){var _0x56385f=function(_0x20ae56){while(--_0x20ae56){_0x5b1a1a['push'](_0x5b1a1a['shift']());}};_0x56385f(++_0x3e7ecf);}(_0x1879,0x19a));var _0x9187=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x1879[_0x420d8d];return _0x4865d7;};'use strict';var _=require(_0x9187('0x0'));var util=require(_0x9187('0x1'));var moment=require(_0x9187('0x2'));var BPromise=require(_0x9187('0x3'));var rs=require(_0x9187('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9187('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9187('0x6'))(_0x9187('0x7'));var config=require(_0x9187('0x8'));var jayson=require(_0x9187('0x9'));var client=jayson[_0x9187('0xa')][_0x9187('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11b741,_0x19a6da,_0x1a4170){return new BPromise(function(_0x2af1c2,_0x27c41e){return client[_0x9187('0xc')](_0x11b741,_0x1a4170)['then'](function(_0x3be05f){logger['info']('DeskField,\x20%s,\x20%s',_0x19a6da,'request\x20sent');logger[_0x9187('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x19a6da,_0x9187('0xe'),JSON['stringify'](_0x3be05f));if(_0x3be05f[_0x9187('0xf')]){if(_0x3be05f['error'][_0x9187('0x10')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x19a6da,_0x3be05f[_0x9187('0xf')][_0x9187('0x11')]);return _0x27c41e(_0x3be05f[_0x9187('0xf')]['message']);}logger[_0x9187('0xf')](_0x9187('0x12'),_0x19a6da,_0x3be05f[_0x9187('0xf')][_0x9187('0x11')]);return _0x2af1c2(_0x3be05f[_0x9187('0xf')][_0x9187('0x11')]);}else{logger[_0x9187('0x13')]('DeskField,\x20%s,\x20%s',_0x19a6da,'request\x20sent');_0x2af1c2(_0x3be05f[_0x9187('0x14')]['message']);}})[_0x9187('0x15')](function(_0x237b42){logger[_0x9187('0xf')](_0x9187('0x12'),_0x19a6da,_0x237b42);_0x27c41e(_0x237b42);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b2668bd..bdcab62 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 _0xb3de=['addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0xb3de,0x1e2));var _0xeb3d=function(_0x25376c,_0x45e4da){_0x25376c=_0x25376c-0x0;var _0x244715=_0xb3de[_0x25376c];return _0x244715;};'use strict';var multer=require(_0xeb3d('0x0'));var util=require(_0xeb3d('0x1'));var path=require(_0xeb3d('0x2'));var timeout=require(_0xeb3d('0x3'));var express=require(_0xeb3d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb3d('0x5'));var interaction=require(_0xeb3d('0x6'));var config=require(_0xeb3d('0x7'));var controller=require(_0xeb3d('0x8'));router[_0xeb3d('0x9')]('/',auth['isAuthenticated'](),controller[_0xeb3d('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xeb3d('0x9')](_0xeb3d('0xb'),auth[_0xeb3d('0xc')](),controller[_0xeb3d('0xd')]);router['get'](_0xeb3d('0xe'),auth[_0xeb3d('0xc')](),controller[_0xeb3d('0xf')]);router['post']('/',auth[_0xeb3d('0xc')](),controller[_0xeb3d('0x10')]);router[_0xeb3d('0x11')](_0xeb3d('0xb'),auth['isAuthenticated'](),controller[_0xeb3d('0x12')]);router[_0xeb3d('0x13')]('/:id',auth[_0xeb3d('0xc')](),controller[_0xeb3d('0x14')]);router[_0xeb3d('0x15')](_0xeb3d('0x16'),auth[_0xeb3d('0xc')](),controller[_0xeb3d('0x17')]);module[_0xeb3d('0x18')]=router; \ No newline at end of file +var _0x6608=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0xfd086a,_0x1f5ef1){var _0x33461a=function(_0x14b241){while(--_0x14b241){_0xfd086a['push'](_0xfd086a['shift']());}};_0x33461a(++_0x1f5ef1);}(_0x6608,0xba));var _0x8660=function(_0xeef606,_0x90ce97){_0xeef606=_0xeef606-0x0;var _0x476dd2=_0x6608[_0xeef606];return _0x476dd2;};'use strict';var multer=require(_0x8660('0x0'));var util=require(_0x8660('0x1'));var path=require(_0x8660('0x2'));var timeout=require('connect-timeout');var express=require(_0x8660('0x3'));var router=express[_0x8660('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8660('0x5'));var interaction=require(_0x8660('0x6'));var config=require(_0x8660('0x7'));var controller=require(_0x8660('0x8'));router['get']('/',auth[_0x8660('0x9')](),controller[_0x8660('0xa')]);router[_0x8660('0xb')](_0x8660('0xc'),auth['isAuthenticated'](),controller[_0x8660('0xd')]);router[_0x8660('0xb')](_0x8660('0xe'),auth[_0x8660('0x9')](),controller[_0x8660('0xf')]);router[_0x8660('0xb')](_0x8660('0x10'),auth[_0x8660('0x9')](),controller[_0x8660('0x11')]);router[_0x8660('0x12')]('/',auth[_0x8660('0x9')](),controller[_0x8660('0x13')]);router[_0x8660('0x12')](_0x8660('0xe'),auth[_0x8660('0x9')](),controller[_0x8660('0x14')]);router[_0x8660('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8660('0x16')]);router[_0x8660('0x17')](_0x8660('0xc'),auth[_0x8660('0x9')](),controller[_0x8660('0x18')]);module[_0x8660('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 9b41a24..74a30c8 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 _0x8ba0=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2e7c7f,_0x406704){var _0x1760b3=function(_0x305392){while(--_0x305392){_0x2e7c7f['push'](_0x2e7c7f['shift']());}};_0x1760b3(++_0x406704);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x31fc54,_0x4f74e6){_0x31fc54=_0x31fc54-0x0;var _0x1a427b=_0x8ba0[_0x31fc54];return _0x1a427b;};'use strict';var Sequelize=require(_0x08ba('0x0'));module[_0x08ba('0x1')]={'name':{'type':Sequelize[_0x08ba('0x2')]},'username':{'type':Sequelize[_0x08ba('0x2')]},'password':{'type':Sequelize[_0x08ba('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x08ba('0x2')]},'clientSecret':{'type':Sequelize[_0x08ba('0x2')]},'serverUrl':{'type':Sequelize[_0x08ba('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x08ba('0x2')]},'modernAuthentication':{'type':Sequelize[_0x08ba('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x282a=['exports','STRING'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0x282a,0xa2));var _0xa282=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x282a[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require('sequelize');module[_0xa282('0x0')]={'name':{'type':Sequelize[_0xa282('0x1')]},'username':{'type':Sequelize[_0xa282('0x1')]},'password':{'type':Sequelize[_0xa282('0x1')]},'remoteUri':{'type':Sequelize[_0xa282('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa282('0x1')]},'clientSecret':{'type':Sequelize[_0xa282('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa282('0x1')]},'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 fefb4ac..3e46e0b 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 _0x6f24=['slice','substring','format','%s/api/data/v9.0/','getFields','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','modernAuthentication','CloudProvider','data5','access_token','data7','POST','/oauth2/token','GET','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','push','MetadataId','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','true','FalseOption','?$select=DisplayName,LogicalName','DisplayName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','params','length','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','sort','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field'];(function(_0x2638a5,_0x1e3076){var _0x2d9dd9=function(_0x11a294){while(--_0x11a294){_0x2638a5['push'](_0x2638a5['shift']());}};_0x2d9dd9(++_0x1e3076);}(_0x6f24,0x76));var _0x46f2=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x6f24[_0x4629ee];return _0x47fb5b;};'use strict';var rp=require(_0x46f2('0x0'));var util=require(_0x46f2('0x1'));var _=require('lodash');var qs=require(_0x46f2('0x2'));var logger=require(_0x46f2('0x3'))(_0x46f2('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0x46f2('0x5'));function respondWithResult(_0x5d4655,_0x5da2a8){_0x5da2a8=_0x5da2a8||0xc8;return function(_0x37b138){if(_0x37b138){return _0x5d4655[_0x46f2('0x6')](_0x5da2a8)[_0x46f2('0x7')](_0x37b138);}};}function respondWithFilteredResult(_0x20be4a,_0x51d8b6){return function(_0x12d539){if(_0x12d539){var _0xd8ec3d=typeof _0x51d8b6[_0x46f2('0x8')]==='undefined'&&typeof _0x51d8b6[_0x46f2('0x9')]===_0x46f2('0xa');var _0x364fc8=_0x12d539[_0x46f2('0xb')];var _0x588630=_0xd8ec3d?0x0:_0x51d8b6['offset'];var _0x42d435=_0xd8ec3d?_0x12d539[_0x46f2('0xb')]:_0x51d8b6[_0x46f2('0x8')]+_0x51d8b6[_0x46f2('0x9')];var _0x52b5ca;if(_0x42d435>=_0x364fc8){_0x42d435=_0x364fc8;_0x52b5ca=0xc8;}else{_0x52b5ca=0xce;}_0x20be4a[_0x46f2('0x6')](_0x52b5ca);return _0x20be4a[_0x46f2('0xc')](_0x46f2('0xd'),_0x588630+'-'+_0x42d435+'/'+_0x364fc8)[_0x46f2('0x7')](_0x12d539);}return null;};}function saveUpdates(_0x4fa24e){return function(_0x2e3a99){if(_0x2e3a99){return _0x2e3a99[_0x46f2('0xe')](_0x4fa24e)[_0x46f2('0xf')](function(_0x1f5010){return _0x1f5010;});}return null;};}function removeEntity(_0x336f68){return function(_0x115af5){if(_0x115af5){return _0x115af5[_0x46f2('0x10')]()[_0x46f2('0xf')](function(){_0x336f68[_0x46f2('0x6')](0xcc)[_0x46f2('0x11')]();});}};}function handleEntityNotFound(_0x19786c){return function(_0x1a63c){if(!_0x1a63c){_0x19786c[_0x46f2('0x12')](0x194);}return _0x1a63c;};}function handleError(_0x5c885d,_0x29a312){_0x29a312=_0x29a312||0x1f4;return function(_0x4125db){logger[_0x46f2('0x13')](_0x4125db[_0x46f2('0x14')]);if(_0x4125db[_0x46f2('0x15')]){delete _0x4125db[_0x46f2('0x15')];}_0x5c885d[_0x46f2('0x6')](_0x29a312)['send'](_0x4125db);};}exports[_0x46f2('0x16')]=function(_0x5a1380,_0x15ecb2){var _0x9587e2={},_0x48b5ea={},_0x5970a1={'count':0x0,'rows':[]};var _0x45ea96=_[_0x46f2('0x17')](db[_0x46f2('0x18')][_0x46f2('0x19')],function(_0x28dd7d){return{'name':_0x28dd7d[_0x46f2('0x1a')],'type':_0x28dd7d['type'][_0x46f2('0x1b')]};});_0x48b5ea['model']=_[_0x46f2('0x17')](_0x45ea96,'name');_0x48b5ea[_0x46f2('0x1c')]=_[_0x46f2('0x1d')](_0x5a1380[_0x46f2('0x1c')]);_0x48b5ea[_0x46f2('0x1e')]=_[_0x46f2('0x1f')](_0x48b5ea[_0x46f2('0x20')],_0x48b5ea['query']);_0x9587e2[_0x46f2('0x21')]=_[_0x46f2('0x1f')](_0x48b5ea[_0x46f2('0x20')],qs[_0x46f2('0x22')](_0x5a1380['query'][_0x46f2('0x22')]));_0x9587e2[_0x46f2('0x21')]=_0x9587e2[_0x46f2('0x21')]['length']?_0x9587e2[_0x46f2('0x21')]:_0x48b5ea['model'];if(!_0x5a1380['query'][_0x46f2('0x23')]('nolimit')){_0x9587e2[_0x46f2('0x9')]=qs[_0x46f2('0x9')](_0x5a1380['query']['limit']);_0x9587e2[_0x46f2('0x8')]=qs[_0x46f2('0x8')](_0x5a1380[_0x46f2('0x1c')]['offset']);}_0x9587e2[_0x46f2('0x24')]=qs['sort'](_0x5a1380[_0x46f2('0x1c')]['sort']);_0x9587e2[_0x46f2('0x25')]=qs[_0x46f2('0x1e')](_[_0x46f2('0x26')](_0x5a1380[_0x46f2('0x1c')],_0x48b5ea[_0x46f2('0x1e')]),_0x45ea96);if(_0x5a1380[_0x46f2('0x1c')][_0x46f2('0x27')]){_0x9587e2[_0x46f2('0x25')]=_[_0x46f2('0x28')](_0x9587e2[_0x46f2('0x25')],{'$or':_['map'](_0x45ea96,function(_0x1971a5){if(_0x1971a5[_0x46f2('0x29')]!==_0x46f2('0x2a')){var _0x2a4a1f={};_0x2a4a1f[_0x1971a5['name']]={'$like':'%'+_0x5a1380[_0x46f2('0x1c')][_0x46f2('0x27')]+'%'};return _0x2a4a1f;}})});}_0x9587e2=_[_0x46f2('0x28')]({},_0x9587e2,_0x5a1380['options']);var _0x2a379b={'where':_0x9587e2[_0x46f2('0x25')]};return db['Dynamics365Account'][_0x46f2('0xb')](_0x2a379b)[_0x46f2('0xf')](function(_0x12541d){_0x5970a1[_0x46f2('0xb')]=_0x12541d;if(_0x5a1380['query'][_0x46f2('0x2b')]){_0x9587e2[_0x46f2('0x2c')]=[{'all':!![]}];}return db[_0x46f2('0x18')][_0x46f2('0x2d')](_0x9587e2);})[_0x46f2('0xf')](function(_0x4406cf){_0x5970a1['rows']=_0x4406cf;return _0x5970a1;})['then'](respondWithFilteredResult(_0x15ecb2,_0x9587e2))[_0x46f2('0x2e')](handleError(_0x15ecb2,null));};exports['show']=function(_0x54fa91,_0x378ed5){var _0x274ce5={'raw':![],'where':{'id':_0x54fa91[_0x46f2('0x2f')]['id']}},_0x499a12={};_0x499a12[_0x46f2('0x20')]=_['keys'](db[_0x46f2('0x18')]['rawAttributes']);_0x499a12[_0x46f2('0x1c')]=_[_0x46f2('0x1d')](_0x54fa91[_0x46f2('0x1c')]);_0x499a12[_0x46f2('0x1e')]=_[_0x46f2('0x1f')](_0x499a12[_0x46f2('0x20')],_0x499a12['query']);_0x274ce5['attributes']=_['intersection'](_0x499a12[_0x46f2('0x20')],qs[_0x46f2('0x22')](_0x54fa91[_0x46f2('0x1c')][_0x46f2('0x22')]));_0x274ce5['attributes']=_0x274ce5[_0x46f2('0x21')][_0x46f2('0x30')]?_0x274ce5[_0x46f2('0x21')]:_0x499a12[_0x46f2('0x20')];if(_0x54fa91['query']['includeAll']){_0x274ce5[_0x46f2('0x2c')]=[{'all':!![]}];}_0x274ce5=_[_0x46f2('0x28')]({},_0x274ce5,_0x54fa91[_0x46f2('0x31')]);return db[_0x46f2('0x18')][_0x46f2('0x32')](_0x274ce5)[_0x46f2('0xf')](handleEntityNotFound(_0x378ed5,null))[_0x46f2('0xf')](respondWithResult(_0x378ed5,null))[_0x46f2('0x2e')](handleError(_0x378ed5,null));};exports[_0x46f2('0x33')]=function(_0x2b0768,_0x426b74){return db[_0x46f2('0x18')][_0x46f2('0x33')](_0x2b0768['body'],{})[_0x46f2('0xf')](respondWithResult(_0x426b74,0xc9))[_0x46f2('0x2e')](handleError(_0x426b74,null));};exports[_0x46f2('0xe')]=function(_0x5e3624,_0x1b5375){if(_0x5e3624[_0x46f2('0x34')]['id']){delete _0x5e3624[_0x46f2('0x34')]['id'];}return db[_0x46f2('0x18')][_0x46f2('0x32')]({'where':{'id':_0x5e3624['params']['id']}})['then'](handleEntityNotFound(_0x1b5375,null))[_0x46f2('0xf')](saveUpdates(_0x5e3624[_0x46f2('0x34')],null))[_0x46f2('0xf')](respondWithResult(_0x1b5375,null))[_0x46f2('0x2e')](handleError(_0x1b5375,null));};exports[_0x46f2('0x10')]=function(_0x1d90f1,_0x2d4487){return db[_0x46f2('0x18')][_0x46f2('0x32')]({'where':{'id':_0x1d90f1[_0x46f2('0x2f')]['id']}})[_0x46f2('0xf')](handleEntityNotFound(_0x2d4487,null))[_0x46f2('0xf')](removeEntity(_0x2d4487,null))[_0x46f2('0x2e')](handleError(_0x2d4487,null));};exports[_0x46f2('0x35')]=function(_0x3129d1,_0x5752b8){var _0x7b8bdb={};var _0x2feb28={};var _0x19416a;var _0x1967a6;return db['Dynamics365Account'][_0x46f2('0x36')]({'where':{'id':_0x3129d1['params']['id']}})[_0x46f2('0xf')](handleEntityNotFound(_0x5752b8,null))[_0x46f2('0xf')](function(_0x40c867){if(_0x40c867){_0x19416a=_0x40c867;_0x2feb28[_0x46f2('0x20')]=_[_0x46f2('0x1d')](db[_0x46f2('0x37')][_0x46f2('0x19')]);_0x2feb28['query']=_[_0x46f2('0x1d')](_0x3129d1['query']);_0x2feb28[_0x46f2('0x1e')]=_[_0x46f2('0x1f')](_0x2feb28[_0x46f2('0x20')],_0x2feb28[_0x46f2('0x1c')]);_0x7b8bdb['attributes']=_['intersection'](_0x2feb28[_0x46f2('0x20')],qs['fields'](_0x3129d1['query'][_0x46f2('0x22')]));_0x7b8bdb[_0x46f2('0x21')]=_0x7b8bdb[_0x46f2('0x21')]['length']?_0x7b8bdb[_0x46f2('0x21')]:_0x2feb28[_0x46f2('0x20')];_0x7b8bdb[_0x46f2('0x24')]=qs[_0x46f2('0x38')](_0x3129d1[_0x46f2('0x1c')][_0x46f2('0x38')]);_0x7b8bdb[_0x46f2('0x25')]=qs[_0x46f2('0x1e')](_[_0x46f2('0x26')](_0x3129d1[_0x46f2('0x1c')],_0x2feb28[_0x46f2('0x1e')]));if(_0x3129d1[_0x46f2('0x1c')]['filter']){_0x7b8bdb[_0x46f2('0x25')]=_[_0x46f2('0x28')](_0x7b8bdb[_0x46f2('0x25')],{'$or':_['map'](_0x7b8bdb[_0x46f2('0x21')],function(_0x184ab5){var _0x549349={};_0x549349[_0x184ab5]={'$like':'%'+_0x3129d1[_0x46f2('0x1c')][_0x46f2('0x27')]+'%'};return _0x549349;})});}_0x7b8bdb=_[_0x46f2('0x28')]({},_0x7b8bdb,_0x3129d1[_0x46f2('0x31')]);return _0x19416a[_0x46f2('0x35')](_0x7b8bdb);}})['then'](function(_0x46e052){if(_0x46e052){_0x1967a6=_0x46e052[_0x46f2('0x30')];if(!_0x3129d1[_0x46f2('0x1c')][_0x46f2('0x23')](_0x46f2('0x39'))){_0x7b8bdb[_0x46f2('0x9')]=qs['limit'](_0x3129d1['query'][_0x46f2('0x9')]);_0x7b8bdb[_0x46f2('0x8')]=qs['offset'](_0x3129d1[_0x46f2('0x1c')]['offset']);}return _0x19416a[_0x46f2('0x35')](_0x7b8bdb);}})[_0x46f2('0xf')](function(_0x46bf52){if(_0x46bf52){return _0x46bf52?{'count':_0x1967a6,'rows':_0x46bf52}:null;}})[_0x46f2('0xf')](respondWithResult(_0x5752b8,null))[_0x46f2('0x2e')](handleError(_0x5752b8,null));};exports[_0x46f2('0x3a')]=function(_0x5903ed,_0x14a9ca){if(_0x5903ed['body']['id']){delete _0x5903ed[_0x46f2('0x34')]['id'];}return db[_0x46f2('0x18')][_0x46f2('0x36')]({'where':{'id':_0x5903ed[_0x46f2('0x2f')]['id']}})[_0x46f2('0xf')](handleEntityNotFound(_0x14a9ca,null))[_0x46f2('0xf')](function(_0x46aa80){if(_0x46aa80){_0x5903ed['body']['AccountId']=_0x46aa80['id'];_0x5903ed[_0x46f2('0x34')][_0x46f2('0x3b')]=integrations['getSubjects'](_0x5903ed[_0x46f2('0x34')][_0x46f2('0x3c')],_0x5903ed[_0x46f2('0x34')][_0x46f2('0x29')]);_0x5903ed[_0x46f2('0x34')][_0x46f2('0x3d')]=integrations[_0x46f2('0x3e')](_0x5903ed['body']['channel'],_0x5903ed[_0x46f2('0x34')][_0x46f2('0x29')]);return db['Dynamics365Configuration'][_0x46f2('0x33')](_0x5903ed['body'],{'include':[{'model':db[_0x46f2('0x3f')],'as':_0x46f2('0x3b')},{'model':db['Dynamics365Field'],'as':_0x46f2('0x3d')}]});}return null;})[_0x46f2('0xf')](respondWithResult(_0x14a9ca,null))[_0x46f2('0x2e')](handleError(_0x14a9ca,null));};function sanitizeRemoteUri(_0x27a3b2){var _0x3562fb=_0x27a3b2[_0x46f2('0x40')](-0x1);if(_0x3562fb==='/')return _0x27a3b2[_0x46f2('0x41')](0x0,_0x27a3b2['lastIndexOf'](_0x3562fb));return _0x27a3b2;}function getWebApiUrl(_0x179b71){return util[_0x46f2('0x42')](_0x46f2('0x43'),_0x179b71);}exports[_0x46f2('0x44')]=function(_0x455a35,_0x28573b){var _0x9ab912=_0x455a35[_0x46f2('0x1c')]['ticketType'];var _0x5d52ab=_0x9ab912===_0x46f2('0x45')?_0x46f2('0x46'):'PhoneCall';var _0x11e10b='';var _0x1f2801='';var _0x54d689='';var _0x76b230='';var _0x47021e='';var _0x58502c='';var _0x325fb2='';var _0x33f3a1='';var _0x126dca=[_0x46f2('0x47'),_0x46f2('0x48'),_0x46f2('0x49'),_0x46f2('0x4a'),_0x46f2('0x4b'),_0x46f2('0x4c'),_0x46f2('0x4d'),'regardingobjectid',_0x46f2('0x4e'),_0x46f2('0x4f')];var _0x9db04e=['accountidname','accountidyominame',_0x46f2('0x50'),'billedserviceunits',_0x46f2('0x51'),'contactidyominame',_0x46f2('0x52'),_0x46f2('0x53'),_0x46f2('0x54'),'createdbyexternalpartyyominame',_0x46f2('0x55'),_0x46f2('0x56'),_0x46f2('0x57'),'createdonbehalfbyname',_0x46f2('0x58'),_0x46f2('0x59'),_0x46f2('0x5a'),_0x46f2('0x5b'),_0x46f2('0x5c'),_0x46f2('0x5d'),_0x46f2('0x5e'),_0x46f2('0x5f'),_0x46f2('0x60'),_0x46f2('0x61'),'firstresponsebykpiidname',_0x46f2('0x62'),'importsequencenumber',_0x46f2('0x63'),_0x46f2('0x64'),_0x46f2('0x65'),'masteridname','modifiedbyexternalpartyname',_0x46f2('0x66'),'modifiedbyname','modifiedbyyominame',_0x46f2('0x67'),_0x46f2('0x68'),'modifiedonbehalfbyyominame',_0x46f2('0x69'),_0x46f2('0x6a'),'numberofchildincidents',_0x46f2('0x6b'),_0x46f2('0x6c'),_0x46f2('0x6d'),_0x46f2('0x6e'),'owneridyominame',_0x46f2('0x6f'),_0x46f2('0x70'),_0x46f2('0x71'),'prioritycodename',_0x46f2('0x72'),_0x46f2('0x73'),_0x46f2('0x74'),'resolvebykpiidname',_0x46f2('0x75'),_0x46f2('0x76'),_0x46f2('0x77'),_0x46f2('0x78'),_0x46f2('0x79'),_0x46f2('0x7a'),_0x46f2('0x7b'),_0x46f2('0x7c'),_0x46f2('0x7d'),_0x46f2('0x7e'),_0x46f2('0x7f'),_0x46f2('0x80'),'transactioncurrencyidname',_0x46f2('0x81'),_0x46f2('0x82'),_0x46f2('0x83')];var _0x49b924=_0x126dca[_0x46f2('0x84')](_0x9db04e);return db[_0x46f2('0x18')][_0x46f2('0x36')]({'where':{'id':_0x455a35[_0x46f2('0x2f')]['id']},'attributes':['id',_0x46f2('0x85'),_0x46f2('0x86'),'remoteUri',_0x46f2('0x87'),_0x46f2('0x88'),'clientSecret',_0x46f2('0x89')],'include':[{'model':db[_0x46f2('0x8a')],'as':_0x46f2('0x8a'),'attributes':['id',_0x46f2('0x8b'),'data7']}]})[_0x46f2('0xf')](handleEntityNotFound(_0x28573b,null))[_0x46f2('0xf')](function(_0x404187){if(_0x404187){if(_0x404187['modernAuthentication']){_0x404187[_0x46f2('0x8c')]=_0x404187[_0x46f2('0x8a')][_0x46f2('0x8b')];_0x33f3a1=sanitizeRemoteUri(_0x404187[_0x46f2('0x8a')][_0x46f2('0x8d')]);_0x325fb2=getWebApiUrl(_0x33f3a1);return _0x404187;}_0x33f3a1=sanitizeRemoteUri(_0x404187['remoteUri']);_0x325fb2=getWebApiUrl(_0x33f3a1);var _0x587d43={'method':_0x46f2('0x8e'),'uri':'https://login.microsoftonline.com/'+_0x404187[_0x46f2('0x87')]+_0x46f2('0x8f'),'form':{'client_id':_0x404187[_0x46f2('0x88')],'resource':_0x33f3a1,'username':_0x404187['username'],'password':_0x404187['password'],'grant_type':'password','client_secret':_0x404187['clientSecret']},'json':!![]};return rp(_0x587d43);}})['then'](function(_0x6c4681){_0x58502c=_0x6c4681['access_token'];var _0x51fb03={'method':_0x46f2('0x90'),'uri':encodeURI(_0x325fb2+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x5d52ab+'\x27'),'headers':{'Authorization':_0x46f2('0x91')+_0x58502c,'If-None-Match':null,'OData-Version':_0x46f2('0x92')},'json':!![]};return rp(_0x51fb03);})[_0x46f2('0xf')](function(_0x3c64f1){var _0x5ddcdf=_0x3c64f1[_0x46f2('0x93')][0x0];var _0x46947a=_0x5ddcdf['MetadataId'];var _0x5dc1c7={'method':_0x46f2('0x90'),'uri':_0x325fb2+_0x46f2('0x94')+_0x46947a+_0x46f2('0x95'),'headers':{'Authorization':_0x46f2('0x91')+_0x58502c,'If-None-Match':null,'OData-Version':_0x46f2('0x92')},'json':!![]};return rp(_0x5dc1c7);})[_0x46f2('0xf')](function(_0x4f2cf6){_0x11e10b=_0x4f2cf6;_0x1f2801=_0x11e10b['Attributes'];_0x1f2801=_[_0x46f2('0x96')](_0x1f2801,function(_0x4d8105){return!_0x49b924[_0x46f2('0x97')](_0x4d8105[_0x46f2('0x98')]);});var _0x64eca5=[];var _0x42a0e5=[];_0x1f2801[_0x46f2('0x99')](function(_0x37b151){if(_0x37b151['@odata.type']){var _0x76677a=_0x37b151[_0x46f2('0x9a')][_0x46f2('0x41')](_0x37b151[_0x46f2('0x9a')][_0x46f2('0x9b')]('.')+0x1);if(_0x76677a==='PicklistAttributeMetadata'){_0x64eca5[_0x46f2('0x9c')](getSelectList(_0x325fb2,_0x9ab912,_0x42a0e5,_0x11e10b['MetadataId'],_0x37b151[_0x46f2('0x9d')],_0x58502c));}}});return Promise[_0x46f2('0x9e')](_0x64eca5);})['then'](function(_0x2f17dd){_0x54d689=_0x2f17dd[0x0];var _0x3463ae=[];var _0x38791f=[];_0x1f2801[_0x46f2('0x99')](function(_0x2f583d){if(!_['isNil'](_0x2f583d[_0x46f2('0x9a')])){var _0x5692f7=_0x2f583d[_0x46f2('0x9a')][_0x46f2('0x41')](_0x2f583d[_0x46f2('0x9a')][_0x46f2('0x9b')]('.')+0x1);if(_0x5692f7===_0x46f2('0x9f')){_0x3463ae[_0x46f2('0x9c')](getBooleanList(_0x325fb2,_0x9ab912,_0x38791f,_0x11e10b[_0x46f2('0x9d')],_0x2f583d[_0x46f2('0x9d')],_0x58502c));}}});return Promise['all'](_0x3463ae);})[_0x46f2('0xf')](function(_0x2a6e89){_0x76b230=_0x2a6e89[0x0];var _0x51a89c=[];var _0x4fe4a2=[];_0x1f2801[_0x46f2('0x99')](function(_0x3a0269){if(_0x3a0269[_0x46f2('0x9a')]){var _0x326baf=_0x3a0269[_0x46f2('0x9a')][_0x46f2('0x41')](_0x3a0269[_0x46f2('0x9a')]['lastIndexOf']('.')+0x1);if(_0x326baf===_0x46f2('0xa0')||_0x326baf===_0x46f2('0xa1')||_0x326baf===_0x46f2('0xa2')||_0x326baf===_0x46f2('0xa3')||_0x326baf==='MemoAttributeMetadata'||_0x326baf===_0x46f2('0xa4')||_0x326baf===_0x46f2('0xa5')||_0x326baf==='EntityNameAttributeMetadata'||_0x326baf==='StateAttributeMetadata'||_0x326baf===_0x46f2('0xa6')){_0x51a89c[_0x46f2('0x9c')](getInputList(_0x325fb2,_0x9ab912,_0x326baf,_0x4fe4a2,_0x11e10b[_0x46f2('0x9d')],_0x3a0269[_0x46f2('0x9d')],_0x58502c));}}});return Promise[_0x46f2('0x9e')](_0x51a89c);})['then'](function(_0x2548d5){_0x47021e=_0x2548d5[0x0];var _0x157c4a=_0x54d689[_0x46f2('0x84')](_0x76b230)[_0x46f2('0x84')](_0x47021e);var _0x5a66dd={'count':_0x157c4a[_0x46f2('0x30')],'rows':_0x157c4a};return _0x5a66dd;})[_0x46f2('0xf')](respondWithResult(_0x28573b,null))[_0x46f2('0x2e')](function(_0x9d6dd4){var _0x4056b3=_0x455a35[_0x46f2('0x1c')][_0x46f2('0xa7')]?0x1f4:_0x9d6dd4[_0x46f2('0xa8')]||0x1f4;logger[_0x46f2('0x13')](_0x9d6dd4[_0x46f2('0x14')]);delete _0x9d6dd4[_0x46f2('0x15')];if(_0x4056b3===0x191){_0x4056b3=0x190;}_0x28573b[_0x46f2('0x6')](_0x4056b3)['send'](_0x455a35[_0x46f2('0x1c')][_0x46f2('0xa7')]?{'message':_0x46f2('0xa9'),'statusCode':_0x9d6dd4['statusCode']}:_0x9d6dd4);});};function getSelectList(_0x387e30,_0x32ae89,_0x1bf98f,_0x31513b,_0x4c6bec,_0x1e955b){var _0x2c719b={'method':_0x46f2('0x90'),'uri':_0x387e30+_0x46f2('0x94')+_0x31513b+_0x46f2('0xaa')+_0x4c6bec+_0x46f2('0xab')+_0x46f2('0xac'),'headers':{'Authorization':_0x46f2('0x91')+_0x1e955b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2c719b)[_0x46f2('0xf')](function(_0xb45e0a){var _0xc5ac25=[];var _0x155d22=_0xb45e0a[_0x46f2('0xad')][_0x46f2('0xae')];_0x155d22['forEach'](function(_0x2afcdd){_0xc5ac25[_0x46f2('0x9c')]({'name':_0x2afcdd[_0x46f2('0xaf')][_0x46f2('0xb0')][_0x46f2('0xaf')],'value':String(_0x2afcdd[_0x46f2('0xb1')])});});var _0x4df563={'id':_0x32ae89+'_'+_0xb45e0a['LogicalName'],'name':_0xb45e0a['DisplayName'][_0x46f2('0xb0')]['Label'],'custom':![],'options':_0xc5ac25};_0x1bf98f['push'](_0x4df563);return _0x1bf98f;});}function getBooleanList(_0x4c3845,_0x3ce2d3,_0x37e0fb,_0x42bdd0,_0x454f50,_0x4020c6){var _0x5a3496={'method':_0x46f2('0x90'),'uri':_0x4c3845+_0x46f2('0x94')+_0x42bdd0+_0x46f2('0xaa')+_0x454f50+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x46f2('0x91')+_0x4020c6,'If-None-Match':null,'OData-Version':_0x46f2('0x92')},'json':!![]};return rp(_0x5a3496)[_0x46f2('0xf')](function(_0x2f41a){var _0x56a30c=[];_0x56a30c[_0x46f2('0x9c')]({'name':_0x2f41a['OptionSet']['TrueOption'][_0x46f2('0xaf')][_0x46f2('0xb0')][_0x46f2('0xaf')],'value':_0x46f2('0xb2')},{'name':_0x2f41a[_0x46f2('0xad')][_0x46f2('0xb3')]['Label']['UserLocalizedLabel'][_0x46f2('0xaf')],'value':'false'});var _0x3c71f2={'id':_0x3ce2d3+'_'+_0x2f41a['LogicalName'],'name':_0x2f41a['DisplayName'][_0x46f2('0xb0')]['Label'],'custom':![],'options':_0x56a30c};_0x37e0fb['push'](_0x3c71f2);return _0x37e0fb;});}function getInputList(_0x2196b6,_0x3abfdc,_0x401718,_0x49cdda,_0x2a6a8e,_0x168dcc,_0x122774){var _0x48385b={'method':_0x46f2('0x90'),'uri':_0x2196b6+'EntityDefinitions('+_0x2a6a8e+_0x46f2('0xaa')+_0x168dcc+')/Microsoft.Dynamics.CRM.'+_0x401718+_0x46f2('0xb4'),'headers':{'Authorization':_0x46f2('0x91')+_0x122774,'If-None-Match':null,'OData-Version':_0x46f2('0x92')},'json':!![]};return rp(_0x48385b)['then'](function(_0x4a5315){var _0x2cd9f7={'id':_0x3abfdc+'_'+_0x4a5315[_0x46f2('0x98')],'name':_0x4a5315[_0x46f2('0xb5')]['UserLocalizedLabel']?_0x4a5315[_0x46f2('0xb5')]['UserLocalizedLabel'][_0x46f2('0xaf')]:_0x4a5315['LogicalName'],'custom':![],'options':[]};_0x49cdda['push'](_0x2cd9f7);return _0x49cdda;});} \ No newline at end of file +var _0xd8c8=['DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','lodash','../../components/parsers/qs','../../config/logger','api','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','getConfigurations','Dynamics365Configuration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Field','slice','substring','%s/api/data/v9.0/','ticketType','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','entitlementidname','entityimage_timestamp','exchangerate','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','GET','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','push','forEach','isNil','lastIndexOf','BooleanAttributeMetadata','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','send','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0xd8c8,0xba));var _0x8d8c=function(_0x3ec62e,_0x3a5863){_0x3ec62e=_0x3ec62e-0x0;var _0x4529bb=_0xd8c8[_0x3ec62e];return _0x4529bb;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x8d8c('0x0'));var qs=require(_0x8d8c('0x1'));var logger=require(_0x8d8c('0x2'))(_0x8d8c('0x3'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x3d3b55,_0x27e4ba){_0x27e4ba=_0x27e4ba||0xc8;return function(_0x307f83){if(_0x307f83){return _0x3d3b55[_0x8d8c('0x4')](_0x27e4ba)[_0x8d8c('0x5')](_0x307f83);}};}function respondWithFilteredResult(_0x16021e,_0x1b21af){return function(_0x456db2){if(_0x456db2){var _0x517f31=typeof _0x1b21af[_0x8d8c('0x6')]===_0x8d8c('0x7')&&typeof _0x1b21af[_0x8d8c('0x8')]===_0x8d8c('0x7');var _0x33f178=_0x456db2[_0x8d8c('0x9')];var _0x3894f2=_0x517f31?0x0:_0x1b21af[_0x8d8c('0x6')];var _0x279889=_0x517f31?_0x456db2[_0x8d8c('0x9')]:_0x1b21af[_0x8d8c('0x6')]+_0x1b21af[_0x8d8c('0x8')];var _0x46dd93;if(_0x279889>=_0x33f178){_0x279889=_0x33f178;_0x46dd93=0xc8;}else{_0x46dd93=0xce;}_0x16021e['status'](_0x46dd93);return _0x16021e[_0x8d8c('0xa')](_0x8d8c('0xb'),_0x3894f2+'-'+_0x279889+'/'+_0x33f178)['json'](_0x456db2);}return null;};}function saveUpdates(_0x31694a){return function(_0x28368b){if(_0x28368b){return _0x28368b['update'](_0x31694a)[_0x8d8c('0xc')](function(_0xa890c7){return _0xa890c7;});}return null;};}function removeEntity(_0x43e066){return function(_0x29e1cf){if(_0x29e1cf){return _0x29e1cf[_0x8d8c('0xd')]()[_0x8d8c('0xc')](function(){_0x43e066[_0x8d8c('0x4')](0xcc)[_0x8d8c('0xe')]();});}};}function handleEntityNotFound(_0x4819c9){return function(_0xfc22dd){if(!_0xfc22dd){_0x4819c9[_0x8d8c('0xf')](0x194);}return _0xfc22dd;};}function handleError(_0x5f1bad,_0x51fb7f){_0x51fb7f=_0x51fb7f||0x1f4;return function(_0x457138){logger[_0x8d8c('0x10')](_0x457138[_0x8d8c('0x11')]);if(_0x457138[_0x8d8c('0x12')]){delete _0x457138[_0x8d8c('0x12')];}_0x5f1bad['status'](_0x51fb7f)['send'](_0x457138);};}exports[_0x8d8c('0x13')]=function(_0x54c3c4,_0x1a837a){var _0x50ae38={},_0x15e0bc={},_0x3dc5c1={'count':0x0,'rows':[]};var _0x5c831f=_[_0x8d8c('0x14')](db[_0x8d8c('0x15')][_0x8d8c('0x16')],function(_0x54b915){return{'name':_0x54b915[_0x8d8c('0x17')],'type':_0x54b915[_0x8d8c('0x18')][_0x8d8c('0x19')]};});_0x15e0bc['model']=_[_0x8d8c('0x14')](_0x5c831f,_0x8d8c('0x12'));_0x15e0bc['query']=_[_0x8d8c('0x1a')](_0x54c3c4[_0x8d8c('0x1b')]);_0x15e0bc[_0x8d8c('0x1c')]=_[_0x8d8c('0x1d')](_0x15e0bc[_0x8d8c('0x1e')],_0x15e0bc[_0x8d8c('0x1b')]);_0x50ae38[_0x8d8c('0x1f')]=_[_0x8d8c('0x1d')](_0x15e0bc[_0x8d8c('0x1e')],qs['fields'](_0x54c3c4[_0x8d8c('0x1b')][_0x8d8c('0x20')]));_0x50ae38[_0x8d8c('0x1f')]=_0x50ae38[_0x8d8c('0x1f')][_0x8d8c('0x21')]?_0x50ae38[_0x8d8c('0x1f')]:_0x15e0bc[_0x8d8c('0x1e')];if(!_0x54c3c4[_0x8d8c('0x1b')][_0x8d8c('0x22')]('nolimit')){_0x50ae38[_0x8d8c('0x8')]=qs[_0x8d8c('0x8')](_0x54c3c4[_0x8d8c('0x1b')][_0x8d8c('0x8')]);_0x50ae38[_0x8d8c('0x6')]=qs[_0x8d8c('0x6')](_0x54c3c4[_0x8d8c('0x1b')][_0x8d8c('0x6')]);}_0x50ae38[_0x8d8c('0x23')]=qs[_0x8d8c('0x24')](_0x54c3c4['query'][_0x8d8c('0x24')]);_0x50ae38['where']=qs['filters'](_[_0x8d8c('0x25')](_0x54c3c4['query'],_0x15e0bc[_0x8d8c('0x1c')]),_0x5c831f);if(_0x54c3c4[_0x8d8c('0x1b')]['filter']){_0x50ae38[_0x8d8c('0x26')]=_['merge'](_0x50ae38[_0x8d8c('0x26')],{'$or':_[_0x8d8c('0x14')](_0x5c831f,function(_0x28fead){if(_0x28fead[_0x8d8c('0x18')]!==_0x8d8c('0x27')){var _0x35252c={};_0x35252c[_0x28fead[_0x8d8c('0x12')]]={'$like':'%'+_0x54c3c4['query'][_0x8d8c('0x28')]+'%'};return _0x35252c;}})});}_0x50ae38=_[_0x8d8c('0x29')]({},_0x50ae38,_0x54c3c4[_0x8d8c('0x2a')]);var _0x171472={'where':_0x50ae38[_0x8d8c('0x26')]};return db[_0x8d8c('0x15')]['count'](_0x171472)[_0x8d8c('0xc')](function(_0x15aab7){_0x3dc5c1[_0x8d8c('0x9')]=_0x15aab7;if(_0x54c3c4['query'][_0x8d8c('0x2b')]){_0x50ae38['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x8d8c('0x2c')](_0x50ae38);})['then'](function(_0x23c0ef){_0x3dc5c1[_0x8d8c('0x2d')]=_0x23c0ef;return _0x3dc5c1;})['then'](respondWithFilteredResult(_0x1a837a,_0x50ae38))[_0x8d8c('0x2e')](handleError(_0x1a837a,null));};exports['show']=function(_0x3fae68,_0x38c852){var _0x57fa92={'raw':![],'where':{'id':_0x3fae68[_0x8d8c('0x2f')]['id']}},_0x4b594b={};_0x4b594b[_0x8d8c('0x1e')]=_[_0x8d8c('0x1a')](db['Dynamics365Account'][_0x8d8c('0x16')]);_0x4b594b[_0x8d8c('0x1b')]=_[_0x8d8c('0x1a')](_0x3fae68[_0x8d8c('0x1b')]);_0x4b594b[_0x8d8c('0x1c')]=_[_0x8d8c('0x1d')](_0x4b594b['model'],_0x4b594b[_0x8d8c('0x1b')]);_0x57fa92[_0x8d8c('0x1f')]=_[_0x8d8c('0x1d')](_0x4b594b['model'],qs['fields'](_0x3fae68[_0x8d8c('0x1b')][_0x8d8c('0x20')]));_0x57fa92[_0x8d8c('0x1f')]=_0x57fa92[_0x8d8c('0x1f')]['length']?_0x57fa92[_0x8d8c('0x1f')]:_0x4b594b[_0x8d8c('0x1e')];if(_0x3fae68[_0x8d8c('0x1b')][_0x8d8c('0x2b')]){_0x57fa92[_0x8d8c('0x30')]=[{'all':!![]}];}_0x57fa92=_['merge']({},_0x57fa92,_0x3fae68[_0x8d8c('0x2a')]);return db['Dynamics365Account']['find'](_0x57fa92)[_0x8d8c('0xc')](handleEntityNotFound(_0x38c852,null))[_0x8d8c('0xc')](respondWithResult(_0x38c852,null))[_0x8d8c('0x2e')](handleError(_0x38c852,null));};exports['create']=function(_0x3efc44,_0x5380eb){return db[_0x8d8c('0x15')][_0x8d8c('0x31')](_0x3efc44[_0x8d8c('0x32')],{})[_0x8d8c('0xc')](respondWithResult(_0x5380eb,0xc9))['catch'](handleError(_0x5380eb,null));};exports['update']=function(_0x2064d8,_0x54ebe1){if(_0x2064d8[_0x8d8c('0x32')]['id']){delete _0x2064d8['body']['id'];}return db[_0x8d8c('0x15')][_0x8d8c('0x33')]({'where':{'id':_0x2064d8['params']['id']}})[_0x8d8c('0xc')](handleEntityNotFound(_0x54ebe1,null))[_0x8d8c('0xc')](saveUpdates(_0x2064d8['body'],null))[_0x8d8c('0xc')](respondWithResult(_0x54ebe1,null))[_0x8d8c('0x2e')](handleError(_0x54ebe1,null));};exports[_0x8d8c('0xd')]=function(_0x43b5f8,_0x2f6061){return db[_0x8d8c('0x15')]['find']({'where':{'id':_0x43b5f8['params']['id']}})[_0x8d8c('0xc')](handleEntityNotFound(_0x2f6061,null))['then'](removeEntity(_0x2f6061,null))[_0x8d8c('0x2e')](handleError(_0x2f6061,null));};exports[_0x8d8c('0x34')]=function(_0x3de3bc,_0x3f37b8){var _0x59b8d0={};var _0x2180c0={};var _0x29284;var _0x3f3564;return db[_0x8d8c('0x15')]['findOne']({'where':{'id':_0x3de3bc[_0x8d8c('0x2f')]['id']}})[_0x8d8c('0xc')](handleEntityNotFound(_0x3f37b8,null))[_0x8d8c('0xc')](function(_0xba43da){if(_0xba43da){_0x29284=_0xba43da;_0x2180c0[_0x8d8c('0x1e')]=_['keys'](db[_0x8d8c('0x35')][_0x8d8c('0x16')]);_0x2180c0[_0x8d8c('0x1b')]=_[_0x8d8c('0x1a')](_0x3de3bc[_0x8d8c('0x1b')]);_0x2180c0[_0x8d8c('0x1c')]=_[_0x8d8c('0x1d')](_0x2180c0[_0x8d8c('0x1e')],_0x2180c0[_0x8d8c('0x1b')]);_0x59b8d0[_0x8d8c('0x1f')]=_[_0x8d8c('0x1d')](_0x2180c0[_0x8d8c('0x1e')],qs[_0x8d8c('0x20')](_0x3de3bc['query'][_0x8d8c('0x20')]));_0x59b8d0[_0x8d8c('0x1f')]=_0x59b8d0[_0x8d8c('0x1f')][_0x8d8c('0x21')]?_0x59b8d0[_0x8d8c('0x1f')]:_0x2180c0[_0x8d8c('0x1e')];_0x59b8d0[_0x8d8c('0x23')]=qs['sort'](_0x3de3bc[_0x8d8c('0x1b')][_0x8d8c('0x24')]);_0x59b8d0[_0x8d8c('0x26')]=qs['filters'](_[_0x8d8c('0x25')](_0x3de3bc[_0x8d8c('0x1b')],_0x2180c0['filters']));if(_0x3de3bc[_0x8d8c('0x1b')][_0x8d8c('0x28')]){_0x59b8d0[_0x8d8c('0x26')]=_[_0x8d8c('0x29')](_0x59b8d0[_0x8d8c('0x26')],{'$or':_[_0x8d8c('0x14')](_0x59b8d0[_0x8d8c('0x1f')],function(_0x992039){var _0x30349e={};_0x30349e[_0x992039]={'$like':'%'+_0x3de3bc[_0x8d8c('0x1b')]['filter']+'%'};return _0x30349e;})});}_0x59b8d0=_[_0x8d8c('0x29')]({},_0x59b8d0,_0x3de3bc[_0x8d8c('0x2a')]);return _0x29284[_0x8d8c('0x34')](_0x59b8d0);}})['then'](function(_0x5a7809){if(_0x5a7809){_0x3f3564=_0x5a7809['length'];if(!_0x3de3bc[_0x8d8c('0x1b')]['hasOwnProperty'](_0x8d8c('0x36'))){_0x59b8d0[_0x8d8c('0x8')]=qs[_0x8d8c('0x8')](_0x3de3bc[_0x8d8c('0x1b')][_0x8d8c('0x8')]);_0x59b8d0[_0x8d8c('0x6')]=qs[_0x8d8c('0x6')](_0x3de3bc[_0x8d8c('0x1b')][_0x8d8c('0x6')]);}return _0x29284[_0x8d8c('0x34')](_0x59b8d0);}})[_0x8d8c('0xc')](function(_0x21c1c2){if(_0x21c1c2){return _0x21c1c2?{'count':_0x3f3564,'rows':_0x21c1c2}:null;}})[_0x8d8c('0xc')](respondWithResult(_0x3f37b8,null))[_0x8d8c('0x2e')](handleError(_0x3f37b8,null));};exports[_0x8d8c('0x37')]=function(_0x4b2543,_0x518087){if(_0x4b2543['body']['id']){delete _0x4b2543[_0x8d8c('0x32')]['id'];}return db['Dynamics365Account'][_0x8d8c('0x38')]({'where':{'id':_0x4b2543[_0x8d8c('0x2f')]['id']}})[_0x8d8c('0xc')](handleEntityNotFound(_0x518087,null))[_0x8d8c('0xc')](function(_0x5e9d6e){if(_0x5e9d6e){_0x4b2543[_0x8d8c('0x32')][_0x8d8c('0x39')]=_0x5e9d6e['id'];_0x4b2543[_0x8d8c('0x32')][_0x8d8c('0x3a')]=integrations[_0x8d8c('0x3b')](_0x4b2543['body']['channel'],_0x4b2543[_0x8d8c('0x32')][_0x8d8c('0x18')]);_0x4b2543[_0x8d8c('0x32')][_0x8d8c('0x3c')]=integrations[_0x8d8c('0x3d')](_0x4b2543[_0x8d8c('0x32')]['channel'],_0x4b2543['body'][_0x8d8c('0x18')]);return db[_0x8d8c('0x35')][_0x8d8c('0x31')](_0x4b2543[_0x8d8c('0x32')],{'include':[{'model':db[_0x8d8c('0x3e')],'as':_0x8d8c('0x3a')},{'model':db[_0x8d8c('0x3e')],'as':'Descriptions'}]});}return null;})[_0x8d8c('0xc')](respondWithResult(_0x518087,null))[_0x8d8c('0x2e')](handleError(_0x518087,null));};function sanitizeRemoteUri(_0x887d5d){var _0x5d0593=_0x887d5d[_0x8d8c('0x3f')](-0x1);if(_0x5d0593==='/')return _0x887d5d[_0x8d8c('0x40')](0x0,_0x887d5d['lastIndexOf'](_0x5d0593));return _0x887d5d;}function getWebApiUrl(_0x19cb5e){return util['format'](_0x8d8c('0x41'),_0x19cb5e);}exports['getFields']=function(_0x3ba422,_0x272746){var _0x264844=_0x3ba422[_0x8d8c('0x1b')][_0x8d8c('0x42')];var _0x2d3ee3=_0x264844==='incident'?'Incident':_0x8d8c('0x43');var _0x729dc7='';var _0x44252b='';var _0x54226e='';var _0x247472='';var _0x3e857b='';var _0x4ab156='';var _0x1d6180='';var _0x38b2c9='';var _0x436500=[_0x8d8c('0x44'),_0x8d8c('0x45'),_0x8d8c('0x46'),_0x8d8c('0x47'),_0x8d8c('0x48'),_0x8d8c('0x49'),'phonenumber',_0x8d8c('0x4a'),_0x8d8c('0x4b'),_0x8d8c('0x4c')];var _0x427e7a=[_0x8d8c('0x4d'),_0x8d8c('0x4e'),_0x8d8c('0x4f'),'billedserviceunits',_0x8d8c('0x50'),_0x8d8c('0x51'),_0x8d8c('0x52'),'contractidname',_0x8d8c('0x53'),'createdbyexternalpartyyominame',_0x8d8c('0x54'),_0x8d8c('0x55'),'createdon',_0x8d8c('0x56'),'createdonbehalfbyyominame',_0x8d8c('0x57'),_0x8d8c('0x58'),'customeridyominame','emailaddress',_0x8d8c('0x59'),_0x8d8c('0x5a'),'entityimage_url','escalatedon',_0x8d8c('0x5b'),'firstresponsebykpiidname',_0x8d8c('0x5c'),_0x8d8c('0x5d'),'influencescore',_0x8d8c('0x5e'),_0x8d8c('0x5f'),'masteridname','modifiedbyexternalpartyname',_0x8d8c('0x60'),_0x8d8c('0x61'),_0x8d8c('0x62'),_0x8d8c('0x63'),_0x8d8c('0x64'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x8d8c('0x65'),_0x8d8c('0x66'),'onholdtime',_0x8d8c('0x67'),_0x8d8c('0x68'),_0x8d8c('0x69'),'owneridyominame',_0x8d8c('0x6a'),_0x8d8c('0x6b'),_0x8d8c('0x6c'),'prioritycodename',_0x8d8c('0x6d'),_0x8d8c('0x6e'),'resolveby',_0x8d8c('0x6f'),_0x8d8c('0x70'),_0x8d8c('0x71'),'responsiblecontactidyominame',_0x8d8c('0x72'),_0x8d8c('0x73'),_0x8d8c('0x74'),_0x8d8c('0x75'),'statecode',_0x8d8c('0x76'),_0x8d8c('0x77'),_0x8d8c('0x78'),_0x8d8c('0x79'),_0x8d8c('0x7a'),_0x8d8c('0x7b'),_0x8d8c('0x7c'),_0x8d8c('0x7d')];var _0x2ceeb5=_0x436500[_0x8d8c('0x7e')](_0x427e7a);return db[_0x8d8c('0x15')][_0x8d8c('0x38')]({'where':{'id':_0x3ba422[_0x8d8c('0x2f')]['id']},'attributes':['id','username',_0x8d8c('0x7f'),_0x8d8c('0x80'),_0x8d8c('0x81'),_0x8d8c('0x82'),_0x8d8c('0x83'),_0x8d8c('0x84')],'include':[{'model':db[_0x8d8c('0x85')],'as':_0x8d8c('0x85'),'attributes':['id',_0x8d8c('0x86'),_0x8d8c('0x87')]}]})[_0x8d8c('0xc')](handleEntityNotFound(_0x272746,null))[_0x8d8c('0xc')](function(_0x1fbe9c){if(_0x1fbe9c){if(_0x1fbe9c['modernAuthentication']){_0x1fbe9c['access_token']=_0x1fbe9c[_0x8d8c('0x85')][_0x8d8c('0x86')];_0x38b2c9=sanitizeRemoteUri(_0x1fbe9c[_0x8d8c('0x85')][_0x8d8c('0x87')]);_0x1d6180=getWebApiUrl(_0x38b2c9);return _0x1fbe9c;}_0x38b2c9=sanitizeRemoteUri(_0x1fbe9c['remoteUri']);_0x1d6180=getWebApiUrl(_0x38b2c9);var _0x2f5d02={'method':_0x8d8c('0x88'),'uri':_0x8d8c('0x89')+_0x1fbe9c[_0x8d8c('0x81')]+'/oauth2/token','form':{'client_id':_0x1fbe9c[_0x8d8c('0x82')],'resource':_0x38b2c9,'username':_0x1fbe9c['username'],'password':_0x1fbe9c[_0x8d8c('0x7f')],'grant_type':_0x8d8c('0x7f'),'client_secret':_0x1fbe9c[_0x8d8c('0x83')]},'json':!![]};return rp(_0x2f5d02);}})[_0x8d8c('0xc')](function(_0x4f02ce){_0x4ab156=_0x4f02ce['access_token'];var _0x2dbb2f={'method':_0x8d8c('0x8a'),'uri':encodeURI(_0x1d6180+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2d3ee3+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4ab156,'If-None-Match':null,'OData-Version':_0x8d8c('0x8b')},'json':!![]};return rp(_0x2dbb2f);})[_0x8d8c('0xc')](function(_0x2e7b62){var _0x2b8745=_0x2e7b62[_0x8d8c('0x8c')][0x0];var _0x4f418c=_0x2b8745[_0x8d8c('0x8d')];var _0x7b6781={'method':'GET','uri':_0x1d6180+_0x8d8c('0x8e')+_0x4f418c+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x4ab156,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x7b6781);})[_0x8d8c('0xc')](function(_0x329cc9){_0x729dc7=_0x329cc9;_0x44252b=_0x729dc7[_0x8d8c('0x8f')];_0x44252b=_[_0x8d8c('0x90')](_0x44252b,function(_0x1d59a4){return!_0x2ceeb5[_0x8d8c('0x91')](_0x1d59a4[_0x8d8c('0x92')]);});var _0x3f909e=[];var _0x5e3312=[];_0x44252b['forEach'](function(_0x2d69a5){if(_0x2d69a5[_0x8d8c('0x93')]){var _0x4bb7ca=_0x2d69a5['@odata.type'][_0x8d8c('0x40')](_0x2d69a5[_0x8d8c('0x93')]['lastIndexOf']('.')+0x1);if(_0x4bb7ca==='PicklistAttributeMetadata'){_0x3f909e[_0x8d8c('0x94')](getSelectList(_0x1d6180,_0x264844,_0x5e3312,_0x729dc7[_0x8d8c('0x8d')],_0x2d69a5[_0x8d8c('0x8d')],_0x4ab156));}}});return Promise['all'](_0x3f909e);})[_0x8d8c('0xc')](function(_0x583537){_0x54226e=_0x583537[0x0];var _0x444f6d=[];var _0x2b2574=[];_0x44252b[_0x8d8c('0x95')](function(_0x8733fe){if(!_[_0x8d8c('0x96')](_0x8733fe[_0x8d8c('0x93')])){var _0x1d5916=_0x8733fe[_0x8d8c('0x93')][_0x8d8c('0x40')](_0x8733fe[_0x8d8c('0x93')][_0x8d8c('0x97')]('.')+0x1);if(_0x1d5916===_0x8d8c('0x98')){_0x444f6d[_0x8d8c('0x94')](getBooleanList(_0x1d6180,_0x264844,_0x2b2574,_0x729dc7[_0x8d8c('0x8d')],_0x8733fe[_0x8d8c('0x8d')],_0x4ab156));}}});return Promise[_0x8d8c('0x99')](_0x444f6d);})[_0x8d8c('0xc')](function(_0x3ee42b){_0x247472=_0x3ee42b[0x0];var _0x5c6940=[];var _0x24d871=[];_0x44252b[_0x8d8c('0x95')](function(_0x2f7ac1){if(_0x2f7ac1[_0x8d8c('0x93')]){var _0x21e6d9=_0x2f7ac1[_0x8d8c('0x93')]['substring'](_0x2f7ac1['@odata.type'][_0x8d8c('0x97')]('.')+0x1);if(_0x21e6d9==='StringAttributeMetadata'||_0x21e6d9===_0x8d8c('0x9a')||_0x21e6d9===_0x8d8c('0x9b')||_0x21e6d9===_0x8d8c('0x9c')||_0x21e6d9==='MemoAttributeMetadata'||_0x21e6d9===_0x8d8c('0x9d')||_0x21e6d9==='StatusAttributeMetadata'||_0x21e6d9===_0x8d8c('0x9e')||_0x21e6d9===_0x8d8c('0x9f')||_0x21e6d9===_0x8d8c('0xa0')){_0x5c6940[_0x8d8c('0x94')](getInputList(_0x1d6180,_0x264844,_0x21e6d9,_0x24d871,_0x729dc7['MetadataId'],_0x2f7ac1[_0x8d8c('0x8d')],_0x4ab156));}}});return Promise[_0x8d8c('0x99')](_0x5c6940);})[_0x8d8c('0xc')](function(_0x79c412){_0x3e857b=_0x79c412[0x0];var _0x5bacda=_0x54226e[_0x8d8c('0x7e')](_0x247472)[_0x8d8c('0x7e')](_0x3e857b);var _0x52aac4={'count':_0x5bacda[_0x8d8c('0x21')],'rows':_0x5bacda};return _0x52aac4;})[_0x8d8c('0xc')](respondWithResult(_0x272746,null))[_0x8d8c('0x2e')](function(_0x12be26){var _0xaefb3=_0x3ba422[_0x8d8c('0x1b')][_0x8d8c('0xa1')]?0x1f4:_0x12be26['statusCode']||0x1f4;logger['error'](_0x12be26[_0x8d8c('0x11')]);delete _0x12be26[_0x8d8c('0x12')];if(_0xaefb3===0x191){_0xaefb3=0x190;}_0x272746[_0x8d8c('0x4')](_0xaefb3)[_0x8d8c('0xa2')](_0x3ba422['query'][_0x8d8c('0xa1')]?{'message':_0x8d8c('0xa3'),'statusCode':_0x12be26['statusCode']}:_0x12be26);});};function getSelectList(_0x450efc,_0x6a634,_0x4a462f,_0x4e01db,_0x2cafa7,_0x323858){var _0x29dd31={'method':'GET','uri':_0x450efc+_0x8d8c('0x8e')+_0x4e01db+_0x8d8c('0xa4')+_0x2cafa7+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x8d8c('0xa5'),'headers':{'Authorization':_0x8d8c('0xa6')+_0x323858,'If-None-Match':null,'OData-Version':_0x8d8c('0x8b')},'json':!![]};return rp(_0x29dd31)[_0x8d8c('0xc')](function(_0x586038){var _0x51f0ef=[];var _0x11ee07=_0x586038[_0x8d8c('0xa7')][_0x8d8c('0xa8')];_0x11ee07[_0x8d8c('0x95')](function(_0x11a644){_0x51f0ef['push']({'name':_0x11a644[_0x8d8c('0xa9')]['UserLocalizedLabel'][_0x8d8c('0xa9')],'value':String(_0x11a644['Value'])});});var _0x493d7c={'id':_0x6a634+'_'+_0x586038[_0x8d8c('0x92')],'name':_0x586038[_0x8d8c('0xaa')][_0x8d8c('0xab')]['Label'],'custom':![],'options':_0x51f0ef};_0x4a462f['push'](_0x493d7c);return _0x4a462f;});}function getBooleanList(_0x5995e9,_0x52331a,_0x2f109f,_0xb55773,_0x2fd3a9,_0x4289d5){var _0x3285f4={'method':_0x8d8c('0x8a'),'uri':_0x5995e9+'EntityDefinitions('+_0xb55773+_0x8d8c('0xa4')+_0x2fd3a9+_0x8d8c('0xac'),'headers':{'Authorization':_0x8d8c('0xa6')+_0x4289d5,'If-None-Match':null,'OData-Version':_0x8d8c('0x8b')},'json':!![]};return rp(_0x3285f4)['then'](function(_0x25c546){var _0x51dbc1=[];_0x51dbc1[_0x8d8c('0x94')]({'name':_0x25c546[_0x8d8c('0xa7')][_0x8d8c('0xad')]['Label'][_0x8d8c('0xab')][_0x8d8c('0xa9')],'value':_0x8d8c('0xae')},{'name':_0x25c546[_0x8d8c('0xa7')][_0x8d8c('0xaf')][_0x8d8c('0xa9')][_0x8d8c('0xab')][_0x8d8c('0xa9')],'value':_0x8d8c('0xb0')});var _0x4dd0e1={'id':_0x52331a+'_'+_0x25c546[_0x8d8c('0x92')],'name':_0x25c546[_0x8d8c('0xaa')][_0x8d8c('0xab')][_0x8d8c('0xa9')],'custom':![],'options':_0x51dbc1};_0x2f109f[_0x8d8c('0x94')](_0x4dd0e1);return _0x2f109f;});}function getInputList(_0x22f41f,_0x2add58,_0x5876e5,_0x54dc19,_0x54ebee,_0x313709,_0x39e0aa){var _0x1db82a={'method':_0x8d8c('0x8a'),'uri':_0x22f41f+_0x8d8c('0x8e')+_0x54ebee+_0x8d8c('0xa4')+_0x313709+_0x8d8c('0xb1')+_0x5876e5+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x8d8c('0xa6')+_0x39e0aa,'If-None-Match':null,'OData-Version':_0x8d8c('0x8b')},'json':!![]};return rp(_0x1db82a)[_0x8d8c('0xc')](function(_0x4ab5fc){var _0x573588={'id':_0x2add58+'_'+_0x4ab5fc[_0x8d8c('0x92')],'name':_0x4ab5fc[_0x8d8c('0xaa')]['UserLocalizedLabel']?_0x4ab5fc[_0x8d8c('0xaa')]['UserLocalizedLabel'][_0x8d8c('0xa9')]:_0x4ab5fc[_0x8d8c('0x92')],'custom':![],'options':[]};_0x54dc19[_0x8d8c('0x94')](_0x573588);return _0x54dc19;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 918bfce..d96b11e 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 5df9d65..d5d2f44 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 _0x6b37=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','include','map','model','attributes','find','where','ShowDynamics365Account','lodash'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0x6b37,0xd1));var _0x76b3=function(_0x2eebc2,_0x54ef7c){_0x2eebc2=_0x2eebc2-0x0;var _0x4153a1=_0x6b37[_0x2eebc2];return _0x4153a1;};'use strict';var _=require(_0x76b3('0x0'));var util=require(_0x76b3('0x1'));var moment=require(_0x76b3('0x2'));var BPromise=require(_0x76b3('0x3'));var rs=require(_0x76b3('0x4'));var fs=require('fs');var Redis=require(_0x76b3('0x5'));var db=require(_0x76b3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x76b3('0x7'))(_0x76b3('0x8'));var config=require(_0x76b3('0x9'));var jayson=require(_0x76b3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36c221,_0x42a16b,_0x27e08){return new BPromise(function(_0x1c387c,_0x405ac7){return client['request'](_0x36c221,_0x27e08)[_0x76b3('0xb')](function(_0x17a961){logger['info'](_0x76b3('0xc'),_0x42a16b,_0x76b3('0xd'));logger[_0x76b3('0xe')](_0x76b3('0xf'),_0x42a16b,'request\x20sent',JSON[_0x76b3('0x10')](_0x17a961));if(_0x17a961[_0x76b3('0x11')]){if(_0x17a961[_0x76b3('0x11')][_0x76b3('0x12')]===0x1f4){logger[_0x76b3('0x11')](_0x76b3('0xc'),_0x42a16b,_0x17a961['error'][_0x76b3('0x13')]);return _0x405ac7(_0x17a961[_0x76b3('0x11')]['message']);}logger[_0x76b3('0x11')](_0x76b3('0xc'),_0x42a16b,_0x17a961[_0x76b3('0x11')][_0x76b3('0x13')]);return _0x1c387c(_0x17a961[_0x76b3('0x11')][_0x76b3('0x13')]);}else{logger[_0x76b3('0x14')](_0x76b3('0xc'),_0x42a16b,_0x76b3('0xd'));_0x1c387c(_0x17a961[_0x76b3('0x15')][_0x76b3('0x13')]);}})[_0x76b3('0x16')](function(_0x4286f1){logger['error'](_0x76b3('0xc'),_0x42a16b,_0x4286f1);_0x405ac7(_0x4286f1);});});}exports[_0x76b3('0x17')]=function(_0x5f437e){var _0x45c661=this;return new Promise(function(_0x96993a,_0x4cc86c){return db[_0x76b3('0x18')][_0x76b3('0x19')]({'raw':_0x5f437e[_0x76b3('0x1a')]?_0x5f437e[_0x76b3('0x1a')][_0x76b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f437e['options']?_0x5f437e[_0x76b3('0x1a')]['where']||null:null,'attributes':_0x5f437e['options']?_0x5f437e['options']['attributes']||null:null,'limit':_0x5f437e['options']?_0x5f437e[_0x76b3('0x1a')]['limit']||null:null,'include':_0x5f437e[_0x76b3('0x1a')]?_0x5f437e[_0x76b3('0x1a')][_0x76b3('0x1c')]?_[_0x76b3('0x1d')](_0x5f437e[_0x76b3('0x1a')]['include'],function(_0x39b1e8){return{'model':db[_0x39b1e8[_0x76b3('0x1e')]],'as':_0x39b1e8['as'],'attributes':_0x39b1e8[_0x76b3('0x1f')],'include':_0x39b1e8[_0x76b3('0x1c')]?_[_0x76b3('0x1d')](_0x39b1e8[_0x76b3('0x1c')],function(_0x4fc0a3){return{'model':db[_0x4fc0a3[_0x76b3('0x1e')]],'as':_0x4fc0a3['as'],'attributes':_0x4fc0a3['attributes'],'include':_0x4fc0a3['include']?_[_0x76b3('0x1d')](_0x4fc0a3[_0x76b3('0x1c')],function(_0x3de51f){return{'model':db[_0x3de51f[_0x76b3('0x1e')]],'as':_0x3de51f['as'],'attributes':_0x3de51f[_0x76b3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x76b3('0xb')](function(_0x36655f){logger[_0x76b3('0x14')]('GetDynamics365Account',_0x5f437e);logger[_0x76b3('0xe')]('GetDynamics365Account',_0x5f437e,JSON['stringify'](_0x36655f));_0x96993a(_0x36655f);})[_0x76b3('0x16')](function(_0x308ee5){logger['error'](_0x76b3('0x17'),_0x308ee5[_0x76b3('0x13')],_0x5f437e);_0x4cc86c(_0x45c661['error'](0x1f4,_0x308ee5['message']));});});};exports['ShowDynamics365Account']=function(_0x40c5f8){var _0x1b7ac0=this;return new Promise(function(_0x3ef7f1,_0x2f5593){return db[_0x76b3('0x18')][_0x76b3('0x20')]({'raw':_0x40c5f8[_0x76b3('0x1a')]?_0x40c5f8[_0x76b3('0x1a')][_0x76b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x40c5f8[_0x76b3('0x1a')]?_0x40c5f8[_0x76b3('0x1a')][_0x76b3('0x21')]||null:null,'attributes':_0x40c5f8[_0x76b3('0x1a')]?_0x40c5f8[_0x76b3('0x1a')]['attributes']||null:null,'include':_0x40c5f8[_0x76b3('0x1a')]?_0x40c5f8[_0x76b3('0x1a')][_0x76b3('0x1c')]?_['map'](_0x40c5f8[_0x76b3('0x1a')][_0x76b3('0x1c')],function(_0x53bcb4){return{'model':db[_0x53bcb4[_0x76b3('0x1e')]],'as':_0x53bcb4['as'],'attributes':_0x53bcb4[_0x76b3('0x1f')],'include':_0x53bcb4[_0x76b3('0x1c')]?_[_0x76b3('0x1d')](_0x53bcb4[_0x76b3('0x1c')],function(_0x53b23d){return{'model':db[_0x53b23d['model']],'as':_0x53b23d['as'],'attributes':_0x53b23d[_0x76b3('0x1f')],'include':_0x53b23d[_0x76b3('0x1c')]?_[_0x76b3('0x1d')](_0x53b23d['include'],function(_0x54cd44){return{'model':db[_0x54cd44[_0x76b3('0x1e')]],'as':_0x54cd44['as'],'attributes':_0x54cd44[_0x76b3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42d286){logger['info']('ShowDynamics365Account',_0x40c5f8);logger[_0x76b3('0xe')](_0x76b3('0x22'),_0x40c5f8,JSON['stringify'](_0x42d286));_0x3ef7f1(_0x42d286);})[_0x76b3('0x16')](function(_0xe21a8b){logger[_0x76b3('0x11')](_0x76b3('0x22'),_0xe21a8b['message'],_0x40c5f8);_0x2f5593(_0x1b7ac0[_0x76b3('0x11')](0x1f4,_0xe21a8b[_0x76b3('0x13')]));});});}; \ No newline at end of file +var _0xd1a7=['error','code','message','result','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','catch','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x96fb66,_0x587078){var _0x108b88=function(_0x331e0e){while(--_0x331e0e){_0x96fb66['push'](_0x96fb66['shift']());}};_0x108b88(++_0x587078);}(_0xd1a7,0x1f2));var _0x7d1a=function(_0x53d46e,_0xd34d28){_0x53d46e=_0x53d46e-0x0;var _0x2dffc4=_0xd1a7[_0x53d46e];return _0x2dffc4;};'use strict';var _=require(_0x7d1a('0x0'));var util=require(_0x7d1a('0x1'));var moment=require(_0x7d1a('0x2'));var BPromise=require(_0x7d1a('0x3'));var rs=require(_0x7d1a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d1a('0x5'))['db'];var utils=require(_0x7d1a('0x6'));var logger=require('../../config/logger')(_0x7d1a('0x7'));var config=require(_0x7d1a('0x8'));var jayson=require(_0x7d1a('0x9'));var client=jayson[_0x7d1a('0xa')][_0x7d1a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c3fab,_0x43c171,_0x37f6df){return new BPromise(function(_0x13c5c5,_0x4acb22){return client[_0x7d1a('0xc')](_0x4c3fab,_0x37f6df)[_0x7d1a('0xd')](function(_0x4517ad){logger[_0x7d1a('0xe')](_0x7d1a('0xf'),_0x43c171,_0x7d1a('0x10'));logger[_0x7d1a('0x11')](_0x7d1a('0x12'),_0x43c171,_0x7d1a('0x10'),JSON[_0x7d1a('0x13')](_0x4517ad));if(_0x4517ad[_0x7d1a('0x14')]){if(_0x4517ad[_0x7d1a('0x14')][_0x7d1a('0x15')]===0x1f4){logger['error'](_0x7d1a('0xf'),_0x43c171,_0x4517ad[_0x7d1a('0x14')][_0x7d1a('0x16')]);return _0x4acb22(_0x4517ad['error'][_0x7d1a('0x16')]);}logger[_0x7d1a('0x14')](_0x7d1a('0xf'),_0x43c171,_0x4517ad[_0x7d1a('0x14')][_0x7d1a('0x16')]);return _0x13c5c5(_0x4517ad['error'][_0x7d1a('0x16')]);}else{logger[_0x7d1a('0xe')](_0x7d1a('0xf'),_0x43c171,'request\x20sent');_0x13c5c5(_0x4517ad[_0x7d1a('0x17')][_0x7d1a('0x16')]);}})['catch'](function(_0x3c8ba0){logger[_0x7d1a('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x43c171,_0x3c8ba0);_0x4acb22(_0x3c8ba0);});});}exports[_0x7d1a('0x18')]=function(_0xc6b787){var _0x15be36=this;return new Promise(function(_0xbfdfd8,_0x17bb6d){return db[_0x7d1a('0x19')]['findAll']({'raw':_0xc6b787[_0x7d1a('0x1a')]?_0xc6b787[_0x7d1a('0x1a')][_0x7d1a('0x1b')]===undefined?!![]:![]:!![],'where':_0xc6b787[_0x7d1a('0x1a')]?_0xc6b787[_0x7d1a('0x1a')][_0x7d1a('0x1c')]||null:null,'attributes':_0xc6b787[_0x7d1a('0x1a')]?_0xc6b787['options'][_0x7d1a('0x1d')]||null:null,'limit':_0xc6b787['options']?_0xc6b787[_0x7d1a('0x1a')][_0x7d1a('0x1e')]||null:null,'include':_0xc6b787[_0x7d1a('0x1a')]?_0xc6b787[_0x7d1a('0x1a')][_0x7d1a('0x1f')]?_[_0x7d1a('0x20')](_0xc6b787[_0x7d1a('0x1a')]['include'],function(_0x4d8d1d){return{'model':db[_0x4d8d1d['model']],'as':_0x4d8d1d['as'],'attributes':_0x4d8d1d[_0x7d1a('0x1d')],'include':_0x4d8d1d[_0x7d1a('0x1f')]?_[_0x7d1a('0x20')](_0x4d8d1d['include'],function(_0x5ba789){return{'model':db[_0x5ba789[_0x7d1a('0x21')]],'as':_0x5ba789['as'],'attributes':_0x5ba789['attributes'],'include':_0x5ba789[_0x7d1a('0x1f')]?_[_0x7d1a('0x20')](_0x5ba789[_0x7d1a('0x1f')],function(_0x5aa5c2){return{'model':db[_0x5aa5c2['model']],'as':_0x5aa5c2['as'],'attributes':_0x5aa5c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x7d1a('0xd')](function(_0x492345){logger[_0x7d1a('0xe')](_0x7d1a('0x18'),_0xc6b787);logger[_0x7d1a('0x11')]('GetDynamics365Account',_0xc6b787,JSON[_0x7d1a('0x13')](_0x492345));_0xbfdfd8(_0x492345);})[_0x7d1a('0x22')](function(_0x4dba71){logger[_0x7d1a('0x14')](_0x7d1a('0x18'),_0x4dba71[_0x7d1a('0x16')],_0xc6b787);_0x17bb6d(_0x15be36[_0x7d1a('0x14')](0x1f4,_0x4dba71['message']));});});};exports[_0x7d1a('0x23')]=function(_0x4175d3){var _0x21d6c8=this;return new Promise(function(_0x27f546,_0x19a1fe){return db[_0x7d1a('0x19')][_0x7d1a('0x24')]({'raw':_0x4175d3[_0x7d1a('0x1a')]?_0x4175d3['options'][_0x7d1a('0x1b')]===undefined?!![]:![]:!![],'where':_0x4175d3[_0x7d1a('0x1a')]?_0x4175d3[_0x7d1a('0x1a')]['where']||null:null,'attributes':_0x4175d3['options']?_0x4175d3['options'][_0x7d1a('0x1d')]||null:null,'include':_0x4175d3['options']?_0x4175d3[_0x7d1a('0x1a')][_0x7d1a('0x1f')]?_['map'](_0x4175d3[_0x7d1a('0x1a')][_0x7d1a('0x1f')],function(_0x18571e){return{'model':db[_0x18571e[_0x7d1a('0x21')]],'as':_0x18571e['as'],'attributes':_0x18571e['attributes'],'include':_0x18571e[_0x7d1a('0x1f')]?_[_0x7d1a('0x20')](_0x18571e[_0x7d1a('0x1f')],function(_0x1328f2){return{'model':db[_0x1328f2[_0x7d1a('0x21')]],'as':_0x1328f2['as'],'attributes':_0x1328f2[_0x7d1a('0x1d')],'include':_0x1328f2[_0x7d1a('0x1f')]?_[_0x7d1a('0x20')](_0x1328f2[_0x7d1a('0x1f')],function(_0x2df526){return{'model':db[_0x2df526['model']],'as':_0x2df526['as'],'attributes':_0x2df526[_0x7d1a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7d1a('0xd')](function(_0xc7ab8f){logger[_0x7d1a('0xe')](_0x7d1a('0x23'),_0x4175d3);logger[_0x7d1a('0x11')](_0x7d1a('0x23'),_0x4175d3,JSON[_0x7d1a('0x13')](_0xc7ab8f));_0x27f546(_0xc7ab8f);})[_0x7d1a('0x22')](function(_0x4a2f2f){logger[_0x7d1a('0x14')](_0x7d1a('0x23'),_0x4a2f2f[_0x7d1a('0x16')],_0x4175d3);_0x19a1fe(_0x21d6c8[_0x7d1a('0x14')](0x1f4,_0x4a2f2f[_0x7d1a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index afcd3cd..a811cb4 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 _0x57c3=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields'];(function(_0x17f59b,_0x1bc462){var _0x1bd4d8=function(_0xbe97ff){while(--_0xbe97ff){_0x17f59b['push'](_0x17f59b['shift']());}};_0x1bd4d8(++_0x1bc462);}(_0x57c3,0xc2));var _0x357c=function(_0x48f972,_0x4f3f1f){_0x48f972=_0x48f972-0x0;var _0x205413=_0x57c3[_0x48f972];return _0x205413;};'use strict';var multer=require(_0x357c('0x0'));var util=require(_0x357c('0x1'));var path=require(_0x357c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x357c('0x3'));var auth=require(_0x357c('0x4'));var interaction=require(_0x357c('0x5'));var config=require(_0x357c('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0x357c('0x7')]('/',auth['isAuthenticated'](),controller[_0x357c('0x8')]);router[_0x357c('0x7')](_0x357c('0x9'),auth[_0x357c('0xa')](),controller[_0x357c('0xb')]);router[_0x357c('0x7')](_0x357c('0xc'),auth['isAuthenticated'](),controller[_0x357c('0xd')]);router[_0x357c('0x7')](_0x357c('0xe'),auth[_0x357c('0xa')](),controller[_0x357c('0xf')]);router[_0x357c('0x7')](_0x357c('0x10'),auth[_0x357c('0xa')](),controller[_0x357c('0x11')]);router[_0x357c('0x12')]('/',auth[_0x357c('0xa')](),controller[_0x357c('0x13')]);router['put'](_0x357c('0x9'),auth[_0x357c('0xa')](),controller[_0x357c('0x14')]);router['delete']('/:id',auth[_0x357c('0xa')](),controller[_0x357c('0x15')]);module[_0x357c('0x16')]=router; \ No newline at end of file +var _0x9a28=['destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','/:id','show','/:id/fields','getFields','get','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x219b20,_0x4b1605){var _0x5bc9d1=function(_0x3bb3fe){while(--_0x3bb3fe){_0x219b20['push'](_0x219b20['shift']());}};_0x5bc9d1(++_0x4b1605);}(_0x9a28,0x16a));var _0x89a2=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x9a28[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x89a2('0x0'));var util=require(_0x89a2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x89a2('0x2'));var router=express[_0x89a2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x89a2('0x4'));var interaction=require(_0x89a2('0x5'));var config=require(_0x89a2('0x6'));var controller=require(_0x89a2('0x7'));router['get']('/',auth[_0x89a2('0x8')](),controller['index']);router['get'](_0x89a2('0x9'),auth['isAuthenticated'](),controller[_0x89a2('0xa')]);router['get'](_0x89a2('0xb'),auth['isAuthenticated'](),controller[_0x89a2('0xc')]);router[_0x89a2('0xd')](_0x89a2('0xe'),auth[_0x89a2('0x8')](),controller['getSubjects']);router[_0x89a2('0xd')](_0x89a2('0xf'),auth[_0x89a2('0x8')](),controller[_0x89a2('0x10')]);router[_0x89a2('0x11')]('/',auth['isAuthenticated'](),controller[_0x89a2('0x12')]);router[_0x89a2('0x13')](_0x89a2('0x9'),auth[_0x89a2('0x8')](),controller[_0x89a2('0x14')]);router[_0x89a2('0x15')]('/:id',auth[_0x89a2('0x8')](),controller[_0x89a2('0x16')]);module[_0x89a2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c08b4d6..392e956 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 _0xee28=['BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','contact','nothing'];(function(_0x2db9e5,_0x5c7696){var _0x7cfc6=function(_0x46e27a){while(--_0x46e27a){_0x2db9e5['push'](_0x2db9e5['shift']());}};_0x7cfc6(++_0x5c7696);}(_0xee28,0x7f));var _0x8ee2=function(_0x54a02e,_0x57e5df){_0x54a02e=_0x54a02e-0x0;var _0x32e842=_0xee28[_0x54a02e];return _0x32e842;};'use strict';var Sequelize=require(_0x8ee2('0x0'));module[_0x8ee2('0x1')]={'name':{'type':Sequelize[_0x8ee2('0x2')]},'description':{'type':Sequelize[_0x8ee2('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x8ee2('0x3'),_0x8ee2('0x4')),'defaultValue':_0x8ee2('0x3')},'moduleCreate':{'type':Sequelize[_0x8ee2('0x5')](_0x8ee2('0x6'),_0x8ee2('0x7')),'defaultValue':_0x8ee2('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8ee2('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x8ee2('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x09c3=['STRING','ENUM','incident','contact','nothing','BOOLEAN','sequelize'];(function(_0x2046dd,_0x40a9ab){var _0x2eb055=function(_0x1c65e8){while(--_0x1c65e8){_0x2046dd['push'](_0x2046dd['shift']());}};_0x2eb055(++_0x40a9ab);}(_0x09c3,0xa7));var _0x309c=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x09c3[_0x1f5a63];return _0x30bb7a;};'use strict';var Sequelize=require(_0x309c('0x0'));module['exports']={'name':{'type':Sequelize[_0x309c('0x1')]},'description':{'type':Sequelize[_0x309c('0x1')]},'ticketType':{'type':Sequelize[_0x309c('0x2')](_0x309c('0x3'),'phonecall'),'defaultValue':_0x309c('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0x309c('0x4'),_0x309c('0x5')),'defaultValue':_0x309c('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x309c('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x309c('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1cc9cd1..6cfb77d 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 _0xe5cd=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','filter','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes'];(function(_0x2bd184,_0x2cc971){var _0xb28dc1=function(_0x45a1f0){while(--_0x45a1f0){_0x2bd184['push'](_0x2bd184['shift']());}};_0xb28dc1(++_0x2cc971);}(_0xe5cd,0x76));var _0xde5c=function(_0x2be8bf,_0x3f52a7){_0x2be8bf=_0x2be8bf-0x0;var _0x45f42f=_0xe5cd[_0x2be8bf];return _0x45f42f;};'use strict';var emlformat=require(_0xde5c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde5c('0x1'));var jsonpatch=require(_0xde5c('0x2'));var rp=require(_0xde5c('0x3'));var moment=require(_0xde5c('0x4'));var BPromise=require(_0xde5c('0x5'));var Mustache=require(_0xde5c('0x6'));var util=require('util');var path=require(_0xde5c('0x7'));var sox=require(_0xde5c('0x8'));var csv=require(_0xde5c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde5c('0xa'));var _=require(_0xde5c('0xb'));var squel=require(_0xde5c('0xc'));var crypto=require(_0xde5c('0xd'));var jsforce=require(_0xde5c('0xe'));var deskjs=require(_0xde5c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xde5c('0x10'));var Papa=require(_0xde5c('0x11'));var Redis=require('ioredis');var authService=require(_0xde5c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde5c('0x13'));var hardwareService=require(_0xde5c('0x14'));var logger=require('../../config/logger')(_0xde5c('0x15'));var utils=require(_0xde5c('0x16'));var config=require(_0xde5c('0x17'));var licenseUtil=require(_0xde5c('0x18'));var db=require(_0xde5c('0x19'))['db'];function respondWithStatusCode(_0x587f60,_0x2ed391){_0x2ed391=_0x2ed391||0xcc;return function(_0x4749c6){if(_0x4749c6){return _0x587f60[_0xde5c('0x1a')](_0x2ed391);}return _0x587f60['status'](_0x2ed391)['end']();};}function respondWithResult(_0x1d7875,_0x48acda){_0x48acda=_0x48acda||0xc8;return function(_0x1689bd){if(_0x1689bd){return _0x1d7875['status'](_0x48acda)[_0xde5c('0x1b')](_0x1689bd);}};}function respondWithFilteredResult(_0x42f7e5,_0x31d82){return function(_0x18135b){if(_0x18135b){var _0x2cb9aa=typeof _0x31d82[_0xde5c('0x1c')]==='undefined'&&typeof _0x31d82[_0xde5c('0x1d')]===_0xde5c('0x1e');var _0x46ddcc=_0x18135b[_0xde5c('0x1f')];var _0x4bf903=_0x2cb9aa?0x0:_0x31d82[_0xde5c('0x1c')];var _0x51683b=_0x2cb9aa?_0x18135b['count']:_0x31d82[_0xde5c('0x1c')]+_0x31d82[_0xde5c('0x1d')];var _0x5aadf5;if(_0x51683b>=_0x46ddcc){_0x51683b=_0x46ddcc;_0x5aadf5=0xc8;}else{_0x5aadf5=0xce;}_0x42f7e5[_0xde5c('0x20')](_0x5aadf5);return _0x42f7e5[_0xde5c('0x21')]('Content-Range',_0x4bf903+'-'+_0x51683b+'/'+_0x46ddcc)[_0xde5c('0x1b')](_0x18135b);}return null;};}function patchUpdates(_0xd7ad1f){return function(_0x5868a0){try{jsonpatch[_0xde5c('0x22')](_0x5868a0,_0xd7ad1f,!![]);}catch(_0x4ce5e9){return BPromise['reject'](_0x4ce5e9);}return _0x5868a0[_0xde5c('0x23')]();};}function saveUpdates(_0x5a75a7,_0x44cf96){return function(_0x19073b){if(_0x19073b){return _0x19073b[_0xde5c('0x24')](_0x5a75a7)[_0xde5c('0x25')](function(_0x2bdac3){return _0x2bdac3;});}return null;};}function removeEntity(_0x374e28,_0x415e4f){return function(_0x4c40ec){if(_0x4c40ec){return _0x4c40ec[_0xde5c('0x26')]()[_0xde5c('0x25')](function(){_0x374e28[_0xde5c('0x20')](0xcc)[_0xde5c('0x27')]();});}};}function handleEntityNotFound(_0x3546ca,_0x5d396a){return function(_0x31fdc1){if(!_0x31fdc1){_0x3546ca[_0xde5c('0x1a')](0x194);}return _0x31fdc1;};}function handleError(_0x51924a,_0x57db52){_0x57db52=_0x57db52||0x1f4;return function(_0x297ec8){logger['error'](_0x297ec8[_0xde5c('0x28')]);if(_0x297ec8[_0xde5c('0x29')]){delete _0x297ec8[_0xde5c('0x29')];}_0x51924a[_0xde5c('0x20')](_0x57db52)[_0xde5c('0x2a')](_0x297ec8);};}exports[_0xde5c('0x2b')]=function(_0x13093f,_0x25aa95){var _0x3d8a2f={},_0x56c562={},_0xd6acd6={'count':0x0,'rows':[]};var _0x192348=_[_0xde5c('0x2c')](db['Dynamics365Configuration'][_0xde5c('0x2d')],function(_0x2cc1ac){return{'name':_0x2cc1ac['fieldName'],'type':_0x2cc1ac[_0xde5c('0x2e')][_0xde5c('0x2f')]};});_0x56c562[_0xde5c('0x30')]=_[_0xde5c('0x2c')](_0x192348,_0xde5c('0x29'));_0x56c562[_0xde5c('0x31')]=_[_0xde5c('0x32')](_0x13093f[_0xde5c('0x31')]);_0x56c562[_0xde5c('0x33')]=_[_0xde5c('0x34')](_0x56c562[_0xde5c('0x30')],_0x56c562[_0xde5c('0x31')]);_0x3d8a2f[_0xde5c('0x35')]=_[_0xde5c('0x34')](_0x56c562[_0xde5c('0x30')],qs[_0xde5c('0x36')](_0x13093f[_0xde5c('0x31')][_0xde5c('0x36')]));_0x3d8a2f[_0xde5c('0x35')]=_0x3d8a2f[_0xde5c('0x35')][_0xde5c('0x37')]?_0x3d8a2f[_0xde5c('0x35')]:_0x56c562['model'];if(!_0x13093f[_0xde5c('0x31')][_0xde5c('0x38')](_0xde5c('0x39'))){_0x3d8a2f[_0xde5c('0x1d')]=qs[_0xde5c('0x1d')](_0x13093f[_0xde5c('0x31')][_0xde5c('0x1d')]);_0x3d8a2f['offset']=qs['offset'](_0x13093f[_0xde5c('0x31')][_0xde5c('0x1c')]);}_0x3d8a2f[_0xde5c('0x3a')]=qs[_0xde5c('0x3b')](_0x13093f[_0xde5c('0x31')][_0xde5c('0x3b')]);_0x3d8a2f['where']=qs['filters'](_[_0xde5c('0x3c')](_0x13093f[_0xde5c('0x31')],_0x56c562[_0xde5c('0x33')]),_0x192348);if(_0x13093f[_0xde5c('0x31')]['filter']){_0x3d8a2f[_0xde5c('0x3d')]=_['merge'](_0x3d8a2f[_0xde5c('0x3d')],{'$or':_['map'](_0x192348,function(_0x4a52bb){if(_0x4a52bb[_0xde5c('0x2e')]!==_0xde5c('0x3e')){var _0x62c1eb={};_0x62c1eb[_0x4a52bb['name']]={'$like':'%'+_0x13093f[_0xde5c('0x31')]['filter']+'%'};return _0x62c1eb;}})});}_0x3d8a2f=_[_0xde5c('0x3f')]({},_0x3d8a2f,_0x13093f[_0xde5c('0x40')]);var _0x10df58={'where':_0x3d8a2f[_0xde5c('0x3d')]};return db[_0xde5c('0x41')][_0xde5c('0x1f')](_0x10df58)[_0xde5c('0x25')](function(_0x57262a){_0xd6acd6[_0xde5c('0x1f')]=_0x57262a;if(_0x13093f[_0xde5c('0x31')][_0xde5c('0x42')]){_0x3d8a2f[_0xde5c('0x43')]=[{'all':!![]}];}return db[_0xde5c('0x41')][_0xde5c('0x44')](_0x3d8a2f);})[_0xde5c('0x25')](function(_0x8bdfe7){_0xd6acd6[_0xde5c('0x45')]=_0x8bdfe7;return _0xd6acd6;})['then'](respondWithFilteredResult(_0x25aa95,_0x3d8a2f))[_0xde5c('0x46')](handleError(_0x25aa95,null));};exports[_0xde5c('0x47')]=function(_0x34113a,_0x3cb9d7){var _0x5921ef={'raw':![],'where':{'id':_0x34113a[_0xde5c('0x48')]['id']}},_0x36ba89={};_0x36ba89[_0xde5c('0x30')]=_[_0xde5c('0x32')](db['Dynamics365Configuration'][_0xde5c('0x2d')]);_0x36ba89[_0xde5c('0x31')]=_['keys'](_0x34113a[_0xde5c('0x31')]);_0x36ba89[_0xde5c('0x33')]=_[_0xde5c('0x34')](_0x36ba89[_0xde5c('0x30')],_0x36ba89[_0xde5c('0x31')]);_0x5921ef[_0xde5c('0x35')]=_[_0xde5c('0x34')](_0x36ba89[_0xde5c('0x30')],qs[_0xde5c('0x36')](_0x34113a[_0xde5c('0x31')][_0xde5c('0x36')]));_0x5921ef[_0xde5c('0x35')]=_0x5921ef[_0xde5c('0x35')][_0xde5c('0x37')]?_0x5921ef[_0xde5c('0x35')]:_0x36ba89[_0xde5c('0x30')];if(_0x34113a['query'][_0xde5c('0x42')]){_0x5921ef[_0xde5c('0x43')]=[{'all':!![]}];}_0x5921ef=_[_0xde5c('0x3f')]({},_0x5921ef,_0x34113a[_0xde5c('0x40')]);return db['Dynamics365Configuration'][_0xde5c('0x49')](_0x5921ef)['then'](handleEntityNotFound(_0x3cb9d7,null))[_0xde5c('0x25')](respondWithResult(_0x3cb9d7,null))[_0xde5c('0x46')](handleError(_0x3cb9d7,null));};exports[_0xde5c('0x4a')]=function(_0x4e1770,_0x2491df){return db[_0xde5c('0x41')]['create'](_0x4e1770['body'],{})[_0xde5c('0x25')](respondWithResult(_0x2491df,0xc9))['catch'](handleError(_0x2491df,null));};exports[_0xde5c('0x24')]=function(_0x2c03ba,_0x9e7a90){if(_0x2c03ba['body']['id']){delete _0x2c03ba['body']['id'];}return db[_0xde5c('0x41')]['find']({'where':{'id':_0x2c03ba[_0xde5c('0x48')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x9e7a90,null))[_0xde5c('0x25')](saveUpdates(_0x2c03ba[_0xde5c('0x4b')],null))[_0xde5c('0x25')](respondWithResult(_0x9e7a90,null))[_0xde5c('0x46')](handleError(_0x9e7a90,null));};exports[_0xde5c('0x26')]=function(_0x3c6537,_0x4b9117){return db[_0xde5c('0x41')]['find']({'where':{'id':_0x3c6537['params']['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x4b9117,null))[_0xde5c('0x25')](removeEntity(_0x4b9117,null))[_0xde5c('0x46')](handleError(_0x4b9117,null));};exports[_0xde5c('0x4c')]=function(_0xadf7af,_0x3e8510,_0xbf95d5){var _0xa15578={};var _0x132b84={};var _0x4b3dcf;var _0x130934;return db[_0xde5c('0x41')]['findOne']({'where':{'id':_0xadf7af[_0xde5c('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e8510,null))['then'](function(_0x532d88){if(_0x532d88){_0x4b3dcf=_0x532d88;_0x132b84['model']=_['keys'](db['Dynamics365Field'][_0xde5c('0x2d')]);_0x132b84['query']=_[_0xde5c('0x32')](_0xadf7af[_0xde5c('0x31')]);_0x132b84['filters']=_[_0xde5c('0x34')](_0x132b84[_0xde5c('0x30')],_0x132b84[_0xde5c('0x31')]);_0xa15578[_0xde5c('0x35')]=_[_0xde5c('0x34')](_0x132b84[_0xde5c('0x30')],qs[_0xde5c('0x36')](_0xadf7af[_0xde5c('0x31')][_0xde5c('0x36')]));_0xa15578[_0xde5c('0x35')]=_0xa15578[_0xde5c('0x35')]['length']?_0xa15578[_0xde5c('0x35')]:_0x132b84['model'];_0xa15578[_0xde5c('0x3a')]=qs[_0xde5c('0x3b')](_0xadf7af[_0xde5c('0x31')][_0xde5c('0x3b')]);_0xa15578[_0xde5c('0x3d')]=qs[_0xde5c('0x33')](_['pick'](_0xadf7af[_0xde5c('0x31')],_0x132b84[_0xde5c('0x33')]));if(_0xadf7af['query'][_0xde5c('0x4d')]){_0xa15578[_0xde5c('0x3d')]=_[_0xde5c('0x3f')](_0xa15578[_0xde5c('0x3d')],{'$or':_[_0xde5c('0x2c')](_0xa15578[_0xde5c('0x35')],function(_0x33b89f){var _0x4a866d={};_0x4a866d[_0x33b89f]={'$like':'%'+_0xadf7af[_0xde5c('0x31')]['filter']+'%'};return _0x4a866d;})});}_0xa15578=_[_0xde5c('0x3f')]({},_0xa15578,_0xadf7af[_0xde5c('0x40')]);return _0x4b3dcf[_0xde5c('0x4c')](_0xa15578);}})[_0xde5c('0x25')](function(_0x43b423){if(_0x43b423){_0x130934=_0x43b423[_0xde5c('0x37')];if(!_0xadf7af[_0xde5c('0x31')][_0xde5c('0x38')](_0xde5c('0x39'))){_0xa15578[_0xde5c('0x1d')]=qs[_0xde5c('0x1d')](_0xadf7af[_0xde5c('0x31')][_0xde5c('0x1d')]);_0xa15578[_0xde5c('0x1c')]=qs[_0xde5c('0x1c')](_0xadf7af[_0xde5c('0x31')][_0xde5c('0x1c')]);}return _0x4b3dcf[_0xde5c('0x4c')](_0xa15578);}})['then'](function(_0x1baa28){if(_0x1baa28){return _0x1baa28?{'count':_0x130934,'rows':_0x1baa28}:null;}})[_0xde5c('0x25')](respondWithResult(_0x3e8510,null))[_0xde5c('0x46')](handleError(_0x3e8510,null));};exports[_0xde5c('0x4e')]=function(_0xdb4375,_0x310994,_0x28a785){var _0x5c66e0={};var _0x3485f7={};var _0x2a9321;var _0x571c63;return db['Dynamics365Configuration'][_0xde5c('0x4f')]({'where':{'id':_0xdb4375[_0xde5c('0x48')]['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0x310994,null))[_0xde5c('0x25')](function(_0x5a12c5){if(_0x5a12c5){_0x2a9321=_0x5a12c5;_0x3485f7[_0xde5c('0x30')]=_[_0xde5c('0x32')](db[_0xde5c('0x50')][_0xde5c('0x2d')]);_0x3485f7[_0xde5c('0x31')]=_['keys'](_0xdb4375[_0xde5c('0x31')]);_0x3485f7[_0xde5c('0x33')]=_[_0xde5c('0x34')](_0x3485f7['model'],_0x3485f7[_0xde5c('0x31')]);_0x5c66e0[_0xde5c('0x35')]=_[_0xde5c('0x34')](_0x3485f7[_0xde5c('0x30')],qs[_0xde5c('0x36')](_0xdb4375['query'][_0xde5c('0x36')]));_0x5c66e0[_0xde5c('0x35')]=_0x5c66e0[_0xde5c('0x35')][_0xde5c('0x37')]?_0x5c66e0[_0xde5c('0x35')]:_0x3485f7['model'];_0x5c66e0[_0xde5c('0x3a')]=qs[_0xde5c('0x3b')](_0xdb4375['query'][_0xde5c('0x3b')]);_0x5c66e0['where']=qs[_0xde5c('0x33')](_[_0xde5c('0x3c')](_0xdb4375[_0xde5c('0x31')],_0x3485f7[_0xde5c('0x33')]));if(_0xdb4375[_0xde5c('0x31')]['filter']){_0x5c66e0['where']=_['merge'](_0x5c66e0[_0xde5c('0x3d')],{'$or':_['map'](_0x5c66e0['attributes'],function(_0x5e1ba7){var _0x319889={};_0x319889[_0x5e1ba7]={'$like':'%'+_0xdb4375[_0xde5c('0x31')][_0xde5c('0x4d')]+'%'};return _0x319889;})});}_0x5c66e0=_[_0xde5c('0x3f')]({},_0x5c66e0,_0xdb4375[_0xde5c('0x40')]);return _0x2a9321[_0xde5c('0x4e')](_0x5c66e0);}})[_0xde5c('0x25')](function(_0x54f3ea){if(_0x54f3ea){_0x571c63=_0x54f3ea[_0xde5c('0x37')];if(!_0xdb4375[_0xde5c('0x31')]['hasOwnProperty'](_0xde5c('0x39'))){_0x5c66e0[_0xde5c('0x1d')]=qs['limit'](_0xdb4375[_0xde5c('0x31')][_0xde5c('0x1d')]);_0x5c66e0[_0xde5c('0x1c')]=qs[_0xde5c('0x1c')](_0xdb4375['query']['offset']);}return _0x2a9321[_0xde5c('0x4e')](_0x5c66e0);}})[_0xde5c('0x25')](function(_0x236836){if(_0x236836){return _0x236836?{'count':_0x571c63,'rows':_0x236836}:null;}})[_0xde5c('0x25')](respondWithResult(_0x310994,null))[_0xde5c('0x46')](handleError(_0x310994,null));};exports[_0xde5c('0x51')]=function(_0x38748b,_0xeb9ac3,_0x45a081){var _0x5f135f={};var _0x64d333={};var _0x2a2ede;var _0x3fb01f;return db[_0xde5c('0x41')][_0xde5c('0x4f')]({'where':{'id':_0x38748b['params']['id']}})[_0xde5c('0x25')](handleEntityNotFound(_0xeb9ac3,null))[_0xde5c('0x25')](function(_0xefaba7){if(_0xefaba7){_0x2a2ede=_0xefaba7;_0x64d333['model']=_[_0xde5c('0x32')](db[_0xde5c('0x50')][_0xde5c('0x2d')]);_0x64d333[_0xde5c('0x31')]=_[_0xde5c('0x32')](_0x38748b['query']);_0x64d333['filters']=_[_0xde5c('0x34')](_0x64d333[_0xde5c('0x30')],_0x64d333[_0xde5c('0x31')]);_0x5f135f['attributes']=_['intersection'](_0x64d333[_0xde5c('0x30')],qs[_0xde5c('0x36')](_0x38748b['query'][_0xde5c('0x36')]));_0x5f135f[_0xde5c('0x35')]=_0x5f135f[_0xde5c('0x35')][_0xde5c('0x37')]?_0x5f135f['attributes']:_0x64d333['model'];_0x5f135f[_0xde5c('0x3a')]=qs[_0xde5c('0x3b')](_0x38748b[_0xde5c('0x31')][_0xde5c('0x3b')]);_0x5f135f['where']=qs[_0xde5c('0x33')](_[_0xde5c('0x3c')](_0x38748b[_0xde5c('0x31')],_0x64d333[_0xde5c('0x33')]));if(_0x38748b[_0xde5c('0x31')][_0xde5c('0x4d')]){_0x5f135f[_0xde5c('0x3d')]=_[_0xde5c('0x3f')](_0x5f135f[_0xde5c('0x3d')],{'$or':_[_0xde5c('0x2c')](_0x5f135f['attributes'],function(_0x2d0fea){var _0x16bf4f={};_0x16bf4f[_0x2d0fea]={'$like':'%'+_0x38748b[_0xde5c('0x31')][_0xde5c('0x4d')]+'%'};return _0x16bf4f;})});}_0x5f135f=_[_0xde5c('0x3f')]({},_0x5f135f,_0x38748b['options']);return _0x2a2ede['getDescriptions'](_0x5f135f);}})[_0xde5c('0x25')](function(_0x1593ee){if(_0x1593ee){_0x3fb01f=_0x1593ee[_0xde5c('0x37')];if(!_0x38748b['query']['hasOwnProperty'](_0xde5c('0x39'))){_0x5f135f['limit']=qs[_0xde5c('0x1d')](_0x38748b[_0xde5c('0x31')][_0xde5c('0x1d')]);_0x5f135f[_0xde5c('0x1c')]=qs[_0xde5c('0x1c')](_0x38748b[_0xde5c('0x31')][_0xde5c('0x1c')]);}return _0x2a2ede[_0xde5c('0x51')](_0x5f135f);}})[_0xde5c('0x25')](function(_0x4cc3c2){if(_0x4cc3c2){return _0x4cc3c2?{'count':_0x3fb01f,'rows':_0x4cc3c2}:null;}})[_0xde5c('0x25')](respondWithResult(_0xeb9ac3,null))[_0xde5c('0x46')](handleError(_0xeb9ac3,null));}; \ No newline at end of file +var _0xca97=['mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','pick','hasOwnProperty','nolimit','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x10af3b,_0x2a6953){var _0x44446a=function(_0x4200b2){while(--_0x4200b2){_0x10af3b['push'](_0x10af3b['shift']());}};_0x44446a(++_0x2a6953);}(_0xca97,0x9d));var _0x7ca9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xca97[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ca9('0x0'));var zipdir=require(_0x7ca9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ca9('0x2'));var moment=require(_0x7ca9('0x3'));var BPromise=require(_0x7ca9('0x4'));var Mustache=require(_0x7ca9('0x5'));var util=require(_0x7ca9('0x6'));var path=require(_0x7ca9('0x7'));var sox=require(_0x7ca9('0x8'));var csv=require(_0x7ca9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ca9('0xa'));var _=require(_0x7ca9('0xb'));var squel=require(_0x7ca9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7ca9('0xd'));var toCsv=require(_0x7ca9('0x9'));var querystring=require(_0x7ca9('0xe'));var Papa=require(_0x7ca9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7ca9('0x10'));var as=require(_0x7ca9('0x11'));var hardwareService=require(_0x7ca9('0x12'));var logger=require(_0x7ca9('0x13'))('api');var utils=require(_0x7ca9('0x14'));var config=require(_0x7ca9('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fd321,_0x2eb922){_0x2eb922=_0x2eb922||0xcc;return function(_0x3fdb9a){if(_0x3fdb9a){return _0x3fd321[_0x7ca9('0x16')](_0x2eb922);}return _0x3fd321[_0x7ca9('0x17')](_0x2eb922)[_0x7ca9('0x18')]();};}function respondWithResult(_0x3ae747,_0xd1e848){_0xd1e848=_0xd1e848||0xc8;return function(_0x2de850){if(_0x2de850){return _0x3ae747[_0x7ca9('0x17')](_0xd1e848)[_0x7ca9('0x19')](_0x2de850);}};}function respondWithFilteredResult(_0x4bfc25,_0x45fbf6){return function(_0x349c04){if(_0x349c04){var _0x4e1373=typeof _0x45fbf6[_0x7ca9('0x1a')]==='undefined'&&typeof _0x45fbf6[_0x7ca9('0x1b')]===_0x7ca9('0x1c');var _0x396ec5=_0x349c04[_0x7ca9('0x1d')];var _0xe0b1ef=_0x4e1373?0x0:_0x45fbf6['offset'];var _0x427734=_0x4e1373?_0x349c04['count']:_0x45fbf6[_0x7ca9('0x1a')]+_0x45fbf6[_0x7ca9('0x1b')];var _0x134111;if(_0x427734>=_0x396ec5){_0x427734=_0x396ec5;_0x134111=0xc8;}else{_0x134111=0xce;}_0x4bfc25['status'](_0x134111);return _0x4bfc25[_0x7ca9('0x1e')](_0x7ca9('0x1f'),_0xe0b1ef+'-'+_0x427734+'/'+_0x396ec5)[_0x7ca9('0x19')](_0x349c04);}return null;};}function patchUpdates(_0x33ef2e){return function(_0x2ddf9d){try{jsonpatch[_0x7ca9('0x20')](_0x2ddf9d,_0x33ef2e,!![]);}catch(_0x20bab2){return BPromise[_0x7ca9('0x21')](_0x20bab2);}return _0x2ddf9d[_0x7ca9('0x22')]();};}function saveUpdates(_0x38f2b1,_0x1276ed){return function(_0x393cd1){if(_0x393cd1){return _0x393cd1[_0x7ca9('0x23')](_0x38f2b1)[_0x7ca9('0x24')](function(_0x2395b6){return _0x2395b6;});}return null;};}function removeEntity(_0x10644a,_0x2b244f){return function(_0x1bad86){if(_0x1bad86){return _0x1bad86[_0x7ca9('0x25')]()[_0x7ca9('0x24')](function(){_0x10644a[_0x7ca9('0x17')](0xcc)[_0x7ca9('0x18')]();});}};}function handleEntityNotFound(_0x14b2d2,_0x3e6083){return function(_0x22d601){if(!_0x22d601){_0x14b2d2[_0x7ca9('0x16')](0x194);}return _0x22d601;};}function handleError(_0x544b5c,_0x7dc83){_0x7dc83=_0x7dc83||0x1f4;return function(_0x50d23b){logger[_0x7ca9('0x26')](_0x50d23b[_0x7ca9('0x27')]);if(_0x50d23b[_0x7ca9('0x28')]){delete _0x50d23b[_0x7ca9('0x28')];}_0x544b5c[_0x7ca9('0x17')](_0x7dc83)[_0x7ca9('0x29')](_0x50d23b);};}exports[_0x7ca9('0x2a')]=function(_0x4260f4,_0x1c0668){var _0x5b8220={},_0x3b984a={},_0x347b66={'count':0x0,'rows':[]};var _0x3f0feb=_['map'](db[_0x7ca9('0x2b')][_0x7ca9('0x2c')],function(_0x52aefb){return{'name':_0x52aefb[_0x7ca9('0x2d')],'type':_0x52aefb[_0x7ca9('0x2e')][_0x7ca9('0x2f')]};});_0x3b984a[_0x7ca9('0x30')]=_[_0x7ca9('0x31')](_0x3f0feb,_0x7ca9('0x28'));_0x3b984a[_0x7ca9('0x32')]=_['keys'](_0x4260f4['query']);_0x3b984a[_0x7ca9('0x33')]=_[_0x7ca9('0x34')](_0x3b984a[_0x7ca9('0x30')],_0x3b984a[_0x7ca9('0x32')]);_0x5b8220[_0x7ca9('0x35')]=_[_0x7ca9('0x34')](_0x3b984a['model'],qs['fields'](_0x4260f4[_0x7ca9('0x32')][_0x7ca9('0x36')]));_0x5b8220[_0x7ca9('0x35')]=_0x5b8220['attributes'][_0x7ca9('0x37')]?_0x5b8220['attributes']:_0x3b984a[_0x7ca9('0x30')];if(!_0x4260f4[_0x7ca9('0x32')]['hasOwnProperty']('nolimit')){_0x5b8220[_0x7ca9('0x1b')]=qs[_0x7ca9('0x1b')](_0x4260f4[_0x7ca9('0x32')]['limit']);_0x5b8220[_0x7ca9('0x1a')]=qs[_0x7ca9('0x1a')](_0x4260f4[_0x7ca9('0x32')][_0x7ca9('0x1a')]);}_0x5b8220[_0x7ca9('0x38')]=qs[_0x7ca9('0x39')](_0x4260f4['query'][_0x7ca9('0x39')]);_0x5b8220[_0x7ca9('0x3a')]=qs[_0x7ca9('0x33')](_['pick'](_0x4260f4[_0x7ca9('0x32')],_0x3b984a[_0x7ca9('0x33')]),_0x3f0feb);if(_0x4260f4['query'][_0x7ca9('0x3b')]){_0x5b8220[_0x7ca9('0x3a')]=_[_0x7ca9('0x3c')](_0x5b8220[_0x7ca9('0x3a')],{'$or':_['map'](_0x3f0feb,function(_0x222e27){if(_0x222e27[_0x7ca9('0x2e')]!==_0x7ca9('0x3d')){var _0x3cf760={};_0x3cf760[_0x222e27[_0x7ca9('0x28')]]={'$like':'%'+_0x4260f4[_0x7ca9('0x32')][_0x7ca9('0x3b')]+'%'};return _0x3cf760;}})});}_0x5b8220=_['merge']({},_0x5b8220,_0x4260f4[_0x7ca9('0x3e')]);var _0x3647f4={'where':_0x5b8220[_0x7ca9('0x3a')]};return db[_0x7ca9('0x2b')]['count'](_0x3647f4)[_0x7ca9('0x24')](function(_0x313583){_0x347b66[_0x7ca9('0x1d')]=_0x313583;if(_0x4260f4['query'][_0x7ca9('0x3f')]){_0x5b8220[_0x7ca9('0x40')]=[{'all':!![]}];}return db[_0x7ca9('0x2b')][_0x7ca9('0x41')](_0x5b8220);})[_0x7ca9('0x24')](function(_0x224cfd){_0x347b66['rows']=_0x224cfd;return _0x347b66;})[_0x7ca9('0x24')](respondWithFilteredResult(_0x1c0668,_0x5b8220))[_0x7ca9('0x42')](handleError(_0x1c0668,null));};exports[_0x7ca9('0x43')]=function(_0x3f5892,_0x1d36ee){var _0x401cb9={'raw':![],'where':{'id':_0x3f5892[_0x7ca9('0x44')]['id']}},_0x1d002d={};_0x1d002d[_0x7ca9('0x30')]=_[_0x7ca9('0x45')](db[_0x7ca9('0x2b')][_0x7ca9('0x2c')]);_0x1d002d['query']=_[_0x7ca9('0x45')](_0x3f5892[_0x7ca9('0x32')]);_0x1d002d[_0x7ca9('0x33')]=_['intersection'](_0x1d002d[_0x7ca9('0x30')],_0x1d002d['query']);_0x401cb9[_0x7ca9('0x35')]=_['intersection'](_0x1d002d[_0x7ca9('0x30')],qs[_0x7ca9('0x36')](_0x3f5892[_0x7ca9('0x32')][_0x7ca9('0x36')]));_0x401cb9[_0x7ca9('0x35')]=_0x401cb9[_0x7ca9('0x35')][_0x7ca9('0x37')]?_0x401cb9[_0x7ca9('0x35')]:_0x1d002d[_0x7ca9('0x30')];if(_0x3f5892[_0x7ca9('0x32')][_0x7ca9('0x3f')]){_0x401cb9[_0x7ca9('0x40')]=[{'all':!![]}];}_0x401cb9=_[_0x7ca9('0x3c')]({},_0x401cb9,_0x3f5892[_0x7ca9('0x3e')]);return db[_0x7ca9('0x2b')][_0x7ca9('0x46')](_0x401cb9)['then'](handleEntityNotFound(_0x1d36ee,null))[_0x7ca9('0x24')](respondWithResult(_0x1d36ee,null))[_0x7ca9('0x42')](handleError(_0x1d36ee,null));};exports[_0x7ca9('0x47')]=function(_0x37548e,_0x4d543f){return db[_0x7ca9('0x2b')][_0x7ca9('0x47')](_0x37548e[_0x7ca9('0x48')],{})[_0x7ca9('0x24')](respondWithResult(_0x4d543f,0xc9))[_0x7ca9('0x42')](handleError(_0x4d543f,null));};exports['update']=function(_0x4a8cfc,_0x12f6e6){if(_0x4a8cfc['body']['id']){delete _0x4a8cfc[_0x7ca9('0x48')]['id'];}return db[_0x7ca9('0x2b')][_0x7ca9('0x46')]({'where':{'id':_0x4a8cfc[_0x7ca9('0x44')]['id']}})[_0x7ca9('0x24')](handleEntityNotFound(_0x12f6e6,null))['then'](saveUpdates(_0x4a8cfc[_0x7ca9('0x48')],null))[_0x7ca9('0x24')](respondWithResult(_0x12f6e6,null))[_0x7ca9('0x42')](handleError(_0x12f6e6,null));};exports[_0x7ca9('0x25')]=function(_0x4764a3,_0x3caf1c){return db[_0x7ca9('0x2b')][_0x7ca9('0x46')]({'where':{'id':_0x4764a3['params']['id']}})[_0x7ca9('0x24')](handleEntityNotFound(_0x3caf1c,null))['then'](removeEntity(_0x3caf1c,null))['catch'](handleError(_0x3caf1c,null));};exports[_0x7ca9('0x49')]=function(_0x5910f6,_0x122fa8,_0x59a452){var _0x4893ae={};var _0x15ba5b={};var _0x1a25f2;var _0x4b9a09;return db[_0x7ca9('0x2b')][_0x7ca9('0x4a')]({'where':{'id':_0x5910f6['params']['id']}})['then'](handleEntityNotFound(_0x122fa8,null))[_0x7ca9('0x24')](function(_0x4f3b6d){if(_0x4f3b6d){_0x1a25f2=_0x4f3b6d;_0x15ba5b['model']=_['keys'](db[_0x7ca9('0x4b')][_0x7ca9('0x2c')]);_0x15ba5b[_0x7ca9('0x32')]=_[_0x7ca9('0x45')](_0x5910f6[_0x7ca9('0x32')]);_0x15ba5b[_0x7ca9('0x33')]=_[_0x7ca9('0x34')](_0x15ba5b[_0x7ca9('0x30')],_0x15ba5b['query']);_0x4893ae[_0x7ca9('0x35')]=_[_0x7ca9('0x34')](_0x15ba5b[_0x7ca9('0x30')],qs[_0x7ca9('0x36')](_0x5910f6[_0x7ca9('0x32')][_0x7ca9('0x36')]));_0x4893ae[_0x7ca9('0x35')]=_0x4893ae[_0x7ca9('0x35')][_0x7ca9('0x37')]?_0x4893ae[_0x7ca9('0x35')]:_0x15ba5b['model'];_0x4893ae[_0x7ca9('0x38')]=qs[_0x7ca9('0x39')](_0x5910f6[_0x7ca9('0x32')]['sort']);_0x4893ae[_0x7ca9('0x3a')]=qs[_0x7ca9('0x33')](_['pick'](_0x5910f6[_0x7ca9('0x32')],_0x15ba5b[_0x7ca9('0x33')]));if(_0x5910f6[_0x7ca9('0x32')][_0x7ca9('0x3b')]){_0x4893ae[_0x7ca9('0x3a')]=_['merge'](_0x4893ae['where'],{'$or':_[_0x7ca9('0x31')](_0x4893ae[_0x7ca9('0x35')],function(_0x468701){var _0xa413e={};_0xa413e[_0x468701]={'$like':'%'+_0x5910f6[_0x7ca9('0x32')][_0x7ca9('0x3b')]+'%'};return _0xa413e;})});}_0x4893ae=_[_0x7ca9('0x3c')]({},_0x4893ae,_0x5910f6['options']);return _0x1a25f2['getFields'](_0x4893ae);}})[_0x7ca9('0x24')](function(_0x326734){if(_0x326734){_0x4b9a09=_0x326734[_0x7ca9('0x37')];if(!_0x5910f6['query']['hasOwnProperty']('nolimit')){_0x4893ae[_0x7ca9('0x1b')]=qs[_0x7ca9('0x1b')](_0x5910f6[_0x7ca9('0x32')][_0x7ca9('0x1b')]);_0x4893ae[_0x7ca9('0x1a')]=qs[_0x7ca9('0x1a')](_0x5910f6[_0x7ca9('0x32')][_0x7ca9('0x1a')]);}return _0x1a25f2['getFields'](_0x4893ae);}})[_0x7ca9('0x24')](function(_0x41a46c){if(_0x41a46c){return _0x41a46c?{'count':_0x4b9a09,'rows':_0x41a46c}:null;}})[_0x7ca9('0x24')](respondWithResult(_0x122fa8,null))[_0x7ca9('0x42')](handleError(_0x122fa8,null));};exports[_0x7ca9('0x4c')]=function(_0x2948ba,_0x317f90,_0xe7207e){var _0x11737d={};var _0x338fdb={};var _0x3f479b;var _0x3bb21a;return db[_0x7ca9('0x2b')][_0x7ca9('0x4a')]({'where':{'id':_0x2948ba['params']['id']}})[_0x7ca9('0x24')](handleEntityNotFound(_0x317f90,null))[_0x7ca9('0x24')](function(_0x1d7406){if(_0x1d7406){_0x3f479b=_0x1d7406;_0x338fdb['model']=_[_0x7ca9('0x45')](db['Dynamics365Field'][_0x7ca9('0x2c')]);_0x338fdb['query']=_[_0x7ca9('0x45')](_0x2948ba[_0x7ca9('0x32')]);_0x338fdb[_0x7ca9('0x33')]=_[_0x7ca9('0x34')](_0x338fdb[_0x7ca9('0x30')],_0x338fdb[_0x7ca9('0x32')]);_0x11737d[_0x7ca9('0x35')]=_[_0x7ca9('0x34')](_0x338fdb[_0x7ca9('0x30')],qs[_0x7ca9('0x36')](_0x2948ba[_0x7ca9('0x32')][_0x7ca9('0x36')]));_0x11737d[_0x7ca9('0x35')]=_0x11737d[_0x7ca9('0x35')][_0x7ca9('0x37')]?_0x11737d['attributes']:_0x338fdb[_0x7ca9('0x30')];_0x11737d[_0x7ca9('0x38')]=qs[_0x7ca9('0x39')](_0x2948ba['query'][_0x7ca9('0x39')]);_0x11737d[_0x7ca9('0x3a')]=qs[_0x7ca9('0x33')](_[_0x7ca9('0x4d')](_0x2948ba['query'],_0x338fdb[_0x7ca9('0x33')]));if(_0x2948ba['query'][_0x7ca9('0x3b')]){_0x11737d[_0x7ca9('0x3a')]=_[_0x7ca9('0x3c')](_0x11737d[_0x7ca9('0x3a')],{'$or':_[_0x7ca9('0x31')](_0x11737d[_0x7ca9('0x35')],function(_0x3a8b3c){var _0x2c0904={};_0x2c0904[_0x3a8b3c]={'$like':'%'+_0x2948ba[_0x7ca9('0x32')]['filter']+'%'};return _0x2c0904;})});}_0x11737d=_[_0x7ca9('0x3c')]({},_0x11737d,_0x2948ba[_0x7ca9('0x3e')]);return _0x3f479b[_0x7ca9('0x4c')](_0x11737d);}})[_0x7ca9('0x24')](function(_0x15ce7f){if(_0x15ce7f){_0x3bb21a=_0x15ce7f[_0x7ca9('0x37')];if(!_0x2948ba[_0x7ca9('0x32')][_0x7ca9('0x4e')](_0x7ca9('0x4f'))){_0x11737d['limit']=qs['limit'](_0x2948ba['query']['limit']);_0x11737d['offset']=qs[_0x7ca9('0x1a')](_0x2948ba[_0x7ca9('0x32')][_0x7ca9('0x1a')]);}return _0x3f479b[_0x7ca9('0x4c')](_0x11737d);}})[_0x7ca9('0x24')](function(_0x3bc935){if(_0x3bc935){return _0x3bc935?{'count':_0x3bb21a,'rows':_0x3bc935}:null;}})[_0x7ca9('0x24')](respondWithResult(_0x317f90,null))['catch'](handleError(_0x317f90,null));};exports[_0x7ca9('0x50')]=function(_0x2cd1b0,_0x32a661,_0x5c7ae4){var _0x51f365={};var _0x20f73c={};var _0x39d748;var _0x4bada1;return db['Dynamics365Configuration'][_0x7ca9('0x4a')]({'where':{'id':_0x2cd1b0[_0x7ca9('0x44')]['id']}})[_0x7ca9('0x24')](handleEntityNotFound(_0x32a661,null))[_0x7ca9('0x24')](function(_0x29d906){if(_0x29d906){_0x39d748=_0x29d906;_0x20f73c['model']=_[_0x7ca9('0x45')](db[_0x7ca9('0x4b')][_0x7ca9('0x2c')]);_0x20f73c[_0x7ca9('0x32')]=_[_0x7ca9('0x45')](_0x2cd1b0['query']);_0x20f73c[_0x7ca9('0x33')]=_[_0x7ca9('0x34')](_0x20f73c[_0x7ca9('0x30')],_0x20f73c[_0x7ca9('0x32')]);_0x51f365['attributes']=_[_0x7ca9('0x34')](_0x20f73c[_0x7ca9('0x30')],qs[_0x7ca9('0x36')](_0x2cd1b0[_0x7ca9('0x32')][_0x7ca9('0x36')]));_0x51f365[_0x7ca9('0x35')]=_0x51f365['attributes'][_0x7ca9('0x37')]?_0x51f365['attributes']:_0x20f73c[_0x7ca9('0x30')];_0x51f365[_0x7ca9('0x38')]=qs[_0x7ca9('0x39')](_0x2cd1b0[_0x7ca9('0x32')]['sort']);_0x51f365[_0x7ca9('0x3a')]=qs[_0x7ca9('0x33')](_[_0x7ca9('0x4d')](_0x2cd1b0[_0x7ca9('0x32')],_0x20f73c['filters']));if(_0x2cd1b0[_0x7ca9('0x32')][_0x7ca9('0x3b')]){_0x51f365[_0x7ca9('0x3a')]=_['merge'](_0x51f365['where'],{'$or':_[_0x7ca9('0x31')](_0x51f365['attributes'],function(_0x2ab718){var _0x3a28f6={};_0x3a28f6[_0x2ab718]={'$like':'%'+_0x2cd1b0['query'][_0x7ca9('0x3b')]+'%'};return _0x3a28f6;})});}_0x51f365=_[_0x7ca9('0x3c')]({},_0x51f365,_0x2cd1b0[_0x7ca9('0x3e')]);return _0x39d748['getDescriptions'](_0x51f365);}})[_0x7ca9('0x24')](function(_0x45d682){if(_0x45d682){_0x4bada1=_0x45d682['length'];if(!_0x2cd1b0['query'][_0x7ca9('0x4e')]('nolimit')){_0x51f365['limit']=qs['limit'](_0x2cd1b0['query']['limit']);_0x51f365[_0x7ca9('0x1a')]=qs['offset'](_0x2cd1b0[_0x7ca9('0x32')][_0x7ca9('0x1a')]);}return _0x39d748[_0x7ca9('0x50')](_0x51f365);}})[_0x7ca9('0x24')](function(_0x116914){if(_0x116914){return _0x116914?{'count':_0x4bada1,'rows':_0x116914}:null;}})[_0x7ca9('0x24')](respondWithResult(_0x32a661,null))[_0x7ca9('0x42')](handleError(_0x32a661,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f53bf4d..beaa105 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x473946,_0x117248){var _0xbb9200=function(_0x58a5f9){while(--_0x58a5f9){_0x473946['push'](_0x473946['shift']());}};_0xbb9200(++_0x117248);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x36bc58,_0x27f03c){_0x36bc58=_0x36bc58-0x0;var _0x4a547e=_0xf3cd[_0x36bc58];return _0x4a547e;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x3e52aa,_0xeebc91){var _0x47be6a=function(_0x23e47d){while(--_0x23e47d){_0x3e52aa['push'](_0x3e52aa['shift']());}};_0x47be6a(++_0xeebc91);}(_0xdace,0xc5));var _0xedac=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0xdace[_0x17406e];return _0x2bfc5a;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('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 6d7d9ed..60e8d02 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 _0x2f91=['then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1f5352,_0x49667e){var _0x4a7d8f=function(_0x3fb4d6){while(--_0x3fb4d6){_0x1f5352['push'](_0x1f5352['shift']());}};_0x4a7d8f(++_0x49667e);}(_0x2f91,0x89));var _0x12f9=function(_0x5295c1,_0x579c5e){_0x5295c1=_0x5295c1-0x0;var _0x26b43d=_0x2f91[_0x5295c1];return _0x26b43d;};'use strict';var _=require(_0x12f9('0x0'));var util=require(_0x12f9('0x1'));var moment=require(_0x12f9('0x2'));var BPromise=require(_0x12f9('0x3'));var rs=require(_0x12f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12f9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x12f9('0x6'))(_0x12f9('0x7'));var config=require(_0x12f9('0x8'));var jayson=require(_0x12f9('0x9'));var client=jayson[_0x12f9('0xa')][_0x12f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c8944,_0x3adfc9,_0x37f4c5){return new BPromise(function(_0x1be8f5,_0x3ae3bc){return client[_0x12f9('0xc')](_0x1c8944,_0x37f4c5)[_0x12f9('0xd')](function(_0x78368f){logger[_0x12f9('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3adfc9,_0x12f9('0xf'));logger[_0x12f9('0x10')](_0x12f9('0x11'),_0x3adfc9,_0x12f9('0xf'),JSON[_0x12f9('0x12')](_0x78368f));if(_0x78368f['error']){if(_0x78368f[_0x12f9('0x13')][_0x12f9('0x14')]===0x1f4){logger['error'](_0x12f9('0x15'),_0x3adfc9,_0x78368f['error'][_0x12f9('0x16')]);return _0x3ae3bc(_0x78368f[_0x12f9('0x13')]['message']);}logger['error'](_0x12f9('0x15'),_0x3adfc9,_0x78368f['error']['message']);return _0x1be8f5(_0x78368f[_0x12f9('0x13')][_0x12f9('0x16')]);}else{logger['info'](_0x12f9('0x15'),_0x3adfc9,_0x12f9('0xf'));_0x1be8f5(_0x78368f[_0x12f9('0x17')][_0x12f9('0x16')]);}})[_0x12f9('0x18')](function(_0x371230){logger['error'](_0x12f9('0x15'),_0x3adfc9,_0x371230);_0x3ae3bc(_0x371230);});});} \ No newline at end of file +var _0x8414=['stringify','code','error','message','info','request\x20sent','result','catch','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x8414,0x12e));var _0x4841=function(_0x2142c8,_0x3001eb){_0x2142c8=_0x2142c8-0x0;var _0x4286e9=_0x8414[_0x2142c8];return _0x4286e9;};'use strict';var _=require(_0x4841('0x0'));var util=require(_0x4841('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4841('0x2'));var logger=require(_0x4841('0x3'))(_0x4841('0x4'));var config=require(_0x4841('0x5'));var jayson=require(_0x4841('0x6'));var client=jayson['client'][_0x4841('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5901c7,_0xa77fdb,_0x241bbe){return new BPromise(function(_0x7c6ee9,_0x4e19d4){return client[_0x4841('0x8')](_0x5901c7,_0x241bbe)[_0x4841('0x9')](function(_0x1f7db5){logger['info'](_0x4841('0xa'),_0xa77fdb,'request\x20sent');logger[_0x4841('0xb')](_0x4841('0xc'),_0xa77fdb,'request\x20sent',JSON[_0x4841('0xd')](_0x1f7db5));if(_0x1f7db5['error']){if(_0x1f7db5['error'][_0x4841('0xe')]===0x1f4){logger[_0x4841('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0xa77fdb,_0x1f7db5[_0x4841('0xf')][_0x4841('0x10')]);return _0x4e19d4(_0x1f7db5['error']['message']);}logger[_0x4841('0xf')](_0x4841('0xa'),_0xa77fdb,_0x1f7db5[_0x4841('0xf')][_0x4841('0x10')]);return _0x7c6ee9(_0x1f7db5[_0x4841('0xf')][_0x4841('0x10')]);}else{logger[_0x4841('0x11')](_0x4841('0xa'),_0xa77fdb,_0x4841('0x12'));_0x7c6ee9(_0x1f7db5[_0x4841('0x13')][_0x4841('0x10')]);}})[_0x4841('0x14')](function(_0x2f1ceb){logger[_0x4841('0xf')](_0x4841('0xa'),_0xa77fdb,_0x2f1ceb);_0x4e19d4(_0x2f1ceb);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 7925850..3fa951b 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 _0xa014=['fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express'];(function(_0x23db35,_0xfa66d5){var _0xfc84ed=function(_0x565ac8){while(--_0x565ac8){_0x23db35['push'](_0x23db35['shift']());}};_0xfc84ed(++_0xfa66d5);}(_0xa014,0x8d));var _0x4a01=function(_0x5526ed,_0x46044e){_0x5526ed=_0x5526ed-0x0;var _0x567c64=_0xa014[_0x5526ed];return _0x567c64;};'use strict';var multer=require(_0x4a01('0x0'));var util=require('util');var path=require(_0x4a01('0x1'));var timeout=require('connect-timeout');var express=require(_0x4a01('0x2'));var router=express['Router']();var fs_extra=require(_0x4a01('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4a01('0x4'));var config=require(_0x4a01('0x5'));var controller=require(_0x4a01('0x6'));router[_0x4a01('0x7')]('/',auth[_0x4a01('0x8')](),controller['index']);router[_0x4a01('0x7')](_0x4a01('0x9'),auth[_0x4a01('0x8')](),controller[_0x4a01('0xa')]);router[_0x4a01('0xb')]('/',auth['isAuthenticated'](),controller[_0x4a01('0xc')]);router[_0x4a01('0xd')]('/:id',auth[_0x4a01('0x8')](),controller[_0x4a01('0xe')]);router[_0x4a01('0xf')](_0x4a01('0x9'),auth[_0x4a01('0x8')](),controller[_0x4a01('0x10')]);module[_0x4a01('0x11')]=router; \ No newline at end of file +var _0xa22f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0xf40c61,_0x461b44){var _0x45579b=function(_0xc7c5c6){while(--_0xc7c5c6){_0xf40c61['push'](_0xf40c61['shift']());}};_0x45579b(++_0x461b44);}(_0xa22f,0xbb));var _0xfa22=function(_0x4054be,_0x238092){_0x4054be=_0x4054be-0x0;var _0x4bc9bb=_0xa22f[_0x4054be];return _0x4bc9bb;};'use strict';var multer=require(_0xfa22('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfa22('0x1'));var express=require(_0xfa22('0x2'));var router=express[_0xfa22('0x3')]();var fs_extra=require(_0xfa22('0x4'));var auth=require(_0xfa22('0x5'));var interaction=require(_0xfa22('0x6'));var config=require(_0xfa22('0x7'));var controller=require(_0xfa22('0x8'));router['get']('/',auth[_0xfa22('0x9')](),controller[_0xfa22('0xa')]);router['get'](_0xfa22('0xb'),auth[_0xfa22('0x9')](),controller[_0xfa22('0xc')]);router[_0xfa22('0xd')]('/',auth[_0xfa22('0x9')](),controller[_0xfa22('0xe')]);router['put'](_0xfa22('0xb'),auth['isAuthenticated'](),controller[_0xfa22('0xf')]);router[_0xfa22('0x10')]('/:id',auth[_0xfa22('0x9')](),controller[_0xfa22('0x11')]);module[_0xfa22('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2ebd29d..75ebff3 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 _0x33ac=['keyValue','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x455bbf,_0x487eb1){var _0x31cc6a=function(_0x510dd8){while(--_0x510dd8){_0x455bbf['push'](_0x455bbf['shift']());}};_0x31cc6a(++_0x487eb1);}(_0x33ac,0x1c8));var _0xc33a=function(_0x16d785,_0x2d0d5f){_0x16d785=_0x16d785-0x0;var _0x5e7d68=_0x33ac[_0x16d785];return _0x5e7d68;};'use strict';var Sequelize=require(_0xc33a('0x0'));module[_0xc33a('0x1')]={'type':{'type':Sequelize[_0xc33a('0x2')](_0xc33a('0x3'),'variable','customVariable',_0xc33a('0x4'),_0xc33a('0x5')),'defaultValue':_0xc33a('0x3')},'content':{'type':Sequelize[_0xc33a('0x6')]},'key':{'type':Sequelize[_0xc33a('0x6')]},'keyType':{'type':Sequelize[_0xc33a('0x2')]('string',_0xc33a('0x7'),_0xc33a('0x8'))},'keyContent':{'type':Sequelize[_0xc33a('0x6')]},'idField':{'type':Sequelize[_0xc33a('0x6')]},'nameField':{'type':Sequelize[_0xc33a('0x6')]},'customField':{'type':Sequelize[_0xc33a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc33a('0x6')]}}; \ No newline at end of file +var _0x0d6b=['exports','string','customVariable','picklist','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x244050,_0x40551b){var _0x2f9923=function(_0x20dac7){while(--_0x20dac7){_0x244050['push'](_0x244050['shift']());}};_0x2f9923(++_0x40551b);}(_0x0d6b,0x179));var _0xb0d6=function(_0x350527,_0x4917a8){_0x350527=_0x350527-0x0;var _0x4d5106=_0x0d6b[_0x350527];return _0x4d5106;};'use strict';var Sequelize=require(_0xb0d6('0x0'));module[_0xb0d6('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb0d6('0x2'),'variable',_0xb0d6('0x3'),'keyValue',_0xb0d6('0x4')),'defaultValue':_0xb0d6('0x2')},'content':{'type':Sequelize[_0xb0d6('0x5')]},'key':{'type':Sequelize[_0xb0d6('0x5')]},'keyType':{'type':Sequelize[_0xb0d6('0x6')](_0xb0d6('0x2'),_0xb0d6('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb0d6('0x5')]},'nameField':{'type':Sequelize[_0xb0d6('0x5')]},'customField':{'type':Sequelize[_0xb0d6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0d6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index a1f1dd3..a0b84f0 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 _0x1c66=['rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','error','name','index','rawAttributes','type','key','keys','filters','intersection','model','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','Dynamics365Field','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c66,0x8f));var _0x61c6=function(_0x4e1553,_0xebcc16){_0x4e1553=_0x4e1553-0x0;var _0x16df67=_0x1c66[_0x4e1553];return _0x16df67;};'use strict';var emlformat=require(_0x61c6('0x0'));var rimraf=require(_0x61c6('0x1'));var zipdir=require(_0x61c6('0x2'));var jsonpatch=require(_0x61c6('0x3'));var rp=require('request-promise');var moment=require(_0x61c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x61c6('0x5'));var util=require(_0x61c6('0x6'));var path=require(_0x61c6('0x7'));var sox=require(_0x61c6('0x8'));var csv=require(_0x61c6('0x9'));var ejs=require(_0x61c6('0xa'));var fs=require('fs');var fs_extra=require(_0x61c6('0xb'));var _=require(_0x61c6('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x61c6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61c6('0xe'));var Redis=require(_0x61c6('0xf'));var authService=require(_0x61c6('0x10'));var qs=require(_0x61c6('0x11'));var as=require(_0x61c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61c6('0x13'))(_0x61c6('0x14'));var utils=require(_0x61c6('0x15'));var config=require(_0x61c6('0x16'));var licenseUtil=require(_0x61c6('0x17'));var db=require(_0x61c6('0x18'))['db'];function respondWithStatusCode(_0x39af59,_0x895835){_0x895835=_0x895835||0xcc;return function(_0x4affb9){if(_0x4affb9){return _0x39af59[_0x61c6('0x19')](_0x895835);}return _0x39af59[_0x61c6('0x1a')](_0x895835)[_0x61c6('0x1b')]();};}function respondWithResult(_0x9565ce,_0x2edeec){_0x2edeec=_0x2edeec||0xc8;return function(_0x39d0c0){if(_0x39d0c0){return _0x9565ce[_0x61c6('0x1a')](_0x2edeec)[_0x61c6('0x1c')](_0x39d0c0);}};}function respondWithFilteredResult(_0x247e8f,_0x410ed1){return function(_0x4d1bb5){if(_0x4d1bb5){var _0x5549c0=typeof _0x410ed1[_0x61c6('0x1d')]===_0x61c6('0x1e')&&typeof _0x410ed1['limit']===_0x61c6('0x1e');var _0x452594=_0x4d1bb5[_0x61c6('0x1f')];var _0x190f23=_0x5549c0?0x0:_0x410ed1[_0x61c6('0x1d')];var _0x45f546=_0x5549c0?_0x4d1bb5[_0x61c6('0x1f')]:_0x410ed1[_0x61c6('0x1d')]+_0x410ed1[_0x61c6('0x20')];var _0x4e1819;if(_0x45f546>=_0x452594){_0x45f546=_0x452594;_0x4e1819=0xc8;}else{_0x4e1819=0xce;}_0x247e8f['status'](_0x4e1819);return _0x247e8f[_0x61c6('0x21')]('Content-Range',_0x190f23+'-'+_0x45f546+'/'+_0x452594)[_0x61c6('0x1c')](_0x4d1bb5);}return null;};}function patchUpdates(_0x44de2b){return function(_0x3e718e){try{jsonpatch[_0x61c6('0x22')](_0x3e718e,_0x44de2b,!![]);}catch(_0x31642b){return BPromise['reject'](_0x31642b);}return _0x3e718e[_0x61c6('0x23')]();};}function saveUpdates(_0x30fafa,_0x49aaf6){return function(_0x4f83b8){if(_0x4f83b8){return _0x4f83b8[_0x61c6('0x24')](_0x30fafa)['then'](function(_0x5a5534){return _0x5a5534;});}return null;};}function removeEntity(_0x19636b,_0x1debfe){return function(_0x2245e9){if(_0x2245e9){return _0x2245e9[_0x61c6('0x25')]()[_0x61c6('0x26')](function(){_0x19636b[_0x61c6('0x1a')](0xcc)[_0x61c6('0x1b')]();});}};}function handleEntityNotFound(_0x4130a3,_0x5c034b){return function(_0x22da4e){if(!_0x22da4e){_0x4130a3[_0x61c6('0x19')](0x194);}return _0x22da4e;};}function handleError(_0x2007db,_0x32fdb0){_0x32fdb0=_0x32fdb0||0x1f4;return function(_0x557764){logger[_0x61c6('0x27')](_0x557764['stack']);if(_0x557764[_0x61c6('0x28')]){delete _0x557764[_0x61c6('0x28')];}_0x2007db[_0x61c6('0x1a')](_0x32fdb0)['send'](_0x557764);};}exports[_0x61c6('0x29')]=function(_0x30ae70,_0x38bb13){var _0x4c2013={},_0x61750={},_0x576061={'count':0x0,'rows':[]};var _0x58a1d8=_['map'](db['Dynamics365Field'][_0x61c6('0x2a')],function(_0x5bc244){return{'name':_0x5bc244['fieldName'],'type':_0x5bc244[_0x61c6('0x2b')][_0x61c6('0x2c')]};});_0x61750['model']=_['map'](_0x58a1d8,_0x61c6('0x28'));_0x61750['query']=_[_0x61c6('0x2d')](_0x30ae70['query']);_0x61750[_0x61c6('0x2e')]=_[_0x61c6('0x2f')](_0x61750[_0x61c6('0x30')],_0x61750['query']);_0x4c2013[_0x61c6('0x31')]=_[_0x61c6('0x2f')](_0x61750['model'],qs['fields'](_0x30ae70[_0x61c6('0x32')][_0x61c6('0x33')]));_0x4c2013[_0x61c6('0x31')]=_0x4c2013[_0x61c6('0x31')][_0x61c6('0x34')]?_0x4c2013[_0x61c6('0x31')]:_0x61750[_0x61c6('0x30')];if(!_0x30ae70['query'][_0x61c6('0x35')](_0x61c6('0x36'))){_0x4c2013[_0x61c6('0x20')]=qs['limit'](_0x30ae70['query']['limit']);_0x4c2013[_0x61c6('0x1d')]=qs['offset'](_0x30ae70[_0x61c6('0x32')]['offset']);}_0x4c2013[_0x61c6('0x37')]=qs[_0x61c6('0x38')](_0x30ae70[_0x61c6('0x32')][_0x61c6('0x38')]);_0x4c2013[_0x61c6('0x39')]=qs['filters'](_['pick'](_0x30ae70[_0x61c6('0x32')],_0x61750[_0x61c6('0x2e')]),_0x58a1d8);if(_0x30ae70[_0x61c6('0x32')][_0x61c6('0x3a')]){_0x4c2013['where']=_[_0x61c6('0x3b')](_0x4c2013[_0x61c6('0x39')],{'$or':_['map'](_0x58a1d8,function(_0xd943fb){if(_0xd943fb[_0x61c6('0x2b')]!==_0x61c6('0x3c')){var _0x98a529={};_0x98a529[_0xd943fb[_0x61c6('0x28')]]={'$like':'%'+_0x30ae70[_0x61c6('0x32')][_0x61c6('0x3a')]+'%'};return _0x98a529;}})});}_0x4c2013=_[_0x61c6('0x3b')]({},_0x4c2013,_0x30ae70['options']);var _0x30e1cd={'where':_0x4c2013[_0x61c6('0x39')]};return db[_0x61c6('0x3d')][_0x61c6('0x1f')](_0x30e1cd)[_0x61c6('0x26')](function(_0x29664a){_0x576061[_0x61c6('0x1f')]=_0x29664a;if(_0x30ae70[_0x61c6('0x32')][_0x61c6('0x3e')]){_0x4c2013['include']=[{'all':!![]}];}return db[_0x61c6('0x3d')][_0x61c6('0x3f')](_0x4c2013);})['then'](function(_0xa40e0e){_0x576061[_0x61c6('0x40')]=_0xa40e0e;return _0x576061;})[_0x61c6('0x26')](respondWithFilteredResult(_0x38bb13,_0x4c2013))[_0x61c6('0x41')](handleError(_0x38bb13,null));};exports[_0x61c6('0x42')]=function(_0x5c315d,_0x326a2f){var _0x14b236={'raw':!![],'where':{'id':_0x5c315d[_0x61c6('0x43')]['id']}},_0x4d6f63={};_0x4d6f63[_0x61c6('0x30')]=_[_0x61c6('0x2d')](db[_0x61c6('0x3d')][_0x61c6('0x2a')]);_0x4d6f63[_0x61c6('0x32')]=_[_0x61c6('0x2d')](_0x5c315d[_0x61c6('0x32')]);_0x4d6f63[_0x61c6('0x2e')]=_[_0x61c6('0x2f')](_0x4d6f63[_0x61c6('0x30')],_0x4d6f63['query']);_0x14b236[_0x61c6('0x31')]=_[_0x61c6('0x2f')](_0x4d6f63[_0x61c6('0x30')],qs[_0x61c6('0x33')](_0x5c315d[_0x61c6('0x32')][_0x61c6('0x33')]));_0x14b236[_0x61c6('0x31')]=_0x14b236['attributes'][_0x61c6('0x34')]?_0x14b236[_0x61c6('0x31')]:_0x4d6f63[_0x61c6('0x30')];if(_0x5c315d['query']['includeAll']){_0x14b236[_0x61c6('0x44')]=[{'all':!![]}];}_0x14b236=_[_0x61c6('0x3b')]({},_0x14b236,_0x5c315d['options']);return db[_0x61c6('0x3d')][_0x61c6('0x45')](_0x14b236)[_0x61c6('0x26')](handleEntityNotFound(_0x326a2f,null))[_0x61c6('0x26')](respondWithResult(_0x326a2f,null))[_0x61c6('0x41')](handleError(_0x326a2f,null));};exports[_0x61c6('0x46')]=function(_0xf530bb,_0x4cece0){return db[_0x61c6('0x3d')]['create'](_0xf530bb[_0x61c6('0x47')],{})[_0x61c6('0x26')](respondWithResult(_0x4cece0,0xc9))[_0x61c6('0x41')](handleError(_0x4cece0,null));};exports[_0x61c6('0x24')]=function(_0x44bbfc,_0x5d3673){if(_0x44bbfc[_0x61c6('0x47')]['id']){delete _0x44bbfc[_0x61c6('0x47')]['id'];}return db[_0x61c6('0x3d')][_0x61c6('0x45')]({'where':{'id':_0x44bbfc['params']['id']}})[_0x61c6('0x26')](handleEntityNotFound(_0x5d3673,null))[_0x61c6('0x26')](saveUpdates(_0x44bbfc[_0x61c6('0x47')],null))[_0x61c6('0x26')](respondWithResult(_0x5d3673,null))[_0x61c6('0x41')](handleError(_0x5d3673,null));};exports[_0x61c6('0x25')]=function(_0x1abee9,_0x30cc52){return db[_0x61c6('0x3d')]['find']({'where':{'id':_0x1abee9[_0x61c6('0x43')]['id']}})[_0x61c6('0x26')](handleEntityNotFound(_0x30cc52,null))[_0x61c6('0x26')](removeEntity(_0x30cc52,null))[_0x61c6('0x41')](handleError(_0x30cc52,null));}; \ No newline at end of file +var _0x64fd=['show','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x3916a0,_0xd3383a){var _0xa7f61b=function(_0x3723f4){while(--_0x3723f4){_0x3916a0['push'](_0x3916a0['shift']());}};_0xa7f61b(++_0xd3383a);}(_0x64fd,0x1d8));var _0xd64f=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x64fd[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd64f('0x0'));var zipdir=require(_0xd64f('0x1'));var jsonpatch=require(_0xd64f('0x2'));var rp=require(_0xd64f('0x3'));var moment=require(_0xd64f('0x4'));var BPromise=require(_0xd64f('0x5'));var Mustache=require('mustache');var util=require(_0xd64f('0x6'));var path=require(_0xd64f('0x7'));var sox=require(_0xd64f('0x8'));var csv=require(_0xd64f('0x9'));var ejs=require(_0xd64f('0xa'));var fs=require('fs');var fs_extra=require(_0xd64f('0xb'));var _=require(_0xd64f('0xc'));var squel=require(_0xd64f('0xd'));var crypto=require(_0xd64f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd64f('0xf'));var toCsv=require(_0xd64f('0x9'));var querystring=require(_0xd64f('0x10'));var Papa=require('papaparse');var Redis=require(_0xd64f('0x11'));var authService=require(_0xd64f('0x12'));var qs=require(_0xd64f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd64f('0x14'));var logger=require(_0xd64f('0x15'))(_0xd64f('0x16'));var utils=require(_0xd64f('0x17'));var config=require(_0xd64f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x531894,_0x28c657){_0x28c657=_0x28c657||0xcc;return function(_0x1577d9){if(_0x1577d9){return _0x531894[_0xd64f('0x19')](_0x28c657);}return _0x531894[_0xd64f('0x1a')](_0x28c657)[_0xd64f('0x1b')]();};}function respondWithResult(_0x3a364d,_0x1cd8fd){_0x1cd8fd=_0x1cd8fd||0xc8;return function(_0x89b01c){if(_0x89b01c){return _0x3a364d[_0xd64f('0x1a')](_0x1cd8fd)[_0xd64f('0x1c')](_0x89b01c);}};}function respondWithFilteredResult(_0x37c8c3,_0x531bc5){return function(_0x5b01a7){if(_0x5b01a7){var _0x695a29=typeof _0x531bc5[_0xd64f('0x1d')]===_0xd64f('0x1e')&&typeof _0x531bc5['limit']===_0xd64f('0x1e');var _0x323c78=_0x5b01a7[_0xd64f('0x1f')];var _0x3cbd8d=_0x695a29?0x0:_0x531bc5[_0xd64f('0x1d')];var _0x38b19a=_0x695a29?_0x5b01a7[_0xd64f('0x1f')]:_0x531bc5[_0xd64f('0x1d')]+_0x531bc5['limit'];var _0x494af4;if(_0x38b19a>=_0x323c78){_0x38b19a=_0x323c78;_0x494af4=0xc8;}else{_0x494af4=0xce;}_0x37c8c3[_0xd64f('0x1a')](_0x494af4);return _0x37c8c3[_0xd64f('0x20')](_0xd64f('0x21'),_0x3cbd8d+'-'+_0x38b19a+'/'+_0x323c78)[_0xd64f('0x1c')](_0x5b01a7);}return null;};}function patchUpdates(_0x246e0e){return function(_0x4fdf81){try{jsonpatch[_0xd64f('0x22')](_0x4fdf81,_0x246e0e,!![]);}catch(_0x922a1c){return BPromise[_0xd64f('0x23')](_0x922a1c);}return _0x4fdf81[_0xd64f('0x24')]();};}function saveUpdates(_0x1ea4f8,_0x845506){return function(_0x2f465f){if(_0x2f465f){return _0x2f465f[_0xd64f('0x25')](_0x1ea4f8)[_0xd64f('0x26')](function(_0x5dcf77){return _0x5dcf77;});}return null;};}function removeEntity(_0x2e568d,_0x5a8a81){return function(_0x2bc79e){if(_0x2bc79e){return _0x2bc79e[_0xd64f('0x27')]()['then'](function(){_0x2e568d[_0xd64f('0x1a')](0xcc)[_0xd64f('0x1b')]();});}};}function handleEntityNotFound(_0x22a0ae,_0x46b572){return function(_0x3d0bd6){if(!_0x3d0bd6){_0x22a0ae[_0xd64f('0x19')](0x194);}return _0x3d0bd6;};}function handleError(_0x4e161c,_0x599691){_0x599691=_0x599691||0x1f4;return function(_0x3a3975){logger[_0xd64f('0x28')](_0x3a3975[_0xd64f('0x29')]);if(_0x3a3975[_0xd64f('0x2a')]){delete _0x3a3975['name'];}_0x4e161c[_0xd64f('0x1a')](_0x599691)[_0xd64f('0x2b')](_0x3a3975);};}exports[_0xd64f('0x2c')]=function(_0x3c77cc,_0x3e938e){var _0x38846f={},_0x4b64c0={},_0x1c9f1f={'count':0x0,'rows':[]};var _0x955120=_[_0xd64f('0x2d')](db[_0xd64f('0x2e')][_0xd64f('0x2f')],function(_0x2cf675){return{'name':_0x2cf675[_0xd64f('0x30')],'type':_0x2cf675[_0xd64f('0x31')][_0xd64f('0x32')]};});_0x4b64c0[_0xd64f('0x33')]=_['map'](_0x955120,_0xd64f('0x2a'));_0x4b64c0['query']=_[_0xd64f('0x34')](_0x3c77cc[_0xd64f('0x35')]);_0x4b64c0[_0xd64f('0x36')]=_[_0xd64f('0x37')](_0x4b64c0[_0xd64f('0x33')],_0x4b64c0['query']);_0x38846f['attributes']=_[_0xd64f('0x37')](_0x4b64c0[_0xd64f('0x33')],qs[_0xd64f('0x38')](_0x3c77cc[_0xd64f('0x35')][_0xd64f('0x38')]));_0x38846f[_0xd64f('0x39')]=_0x38846f[_0xd64f('0x39')][_0xd64f('0x3a')]?_0x38846f[_0xd64f('0x39')]:_0x4b64c0[_0xd64f('0x33')];if(!_0x3c77cc['query'][_0xd64f('0x3b')](_0xd64f('0x3c'))){_0x38846f[_0xd64f('0x3d')]=qs['limit'](_0x3c77cc[_0xd64f('0x35')][_0xd64f('0x3d')]);_0x38846f['offset']=qs[_0xd64f('0x1d')](_0x3c77cc['query']['offset']);}_0x38846f[_0xd64f('0x3e')]=qs[_0xd64f('0x3f')](_0x3c77cc['query'][_0xd64f('0x3f')]);_0x38846f['where']=qs['filters'](_[_0xd64f('0x40')](_0x3c77cc['query'],_0x4b64c0[_0xd64f('0x36')]),_0x955120);if(_0x3c77cc[_0xd64f('0x35')][_0xd64f('0x41')]){_0x38846f['where']=_[_0xd64f('0x42')](_0x38846f[_0xd64f('0x43')],{'$or':_['map'](_0x955120,function(_0x4d038e){if(_0x4d038e[_0xd64f('0x31')]!==_0xd64f('0x44')){var _0x431202={};_0x431202[_0x4d038e[_0xd64f('0x2a')]]={'$like':'%'+_0x3c77cc['query'][_0xd64f('0x41')]+'%'};return _0x431202;}})});}_0x38846f=_[_0xd64f('0x42')]({},_0x38846f,_0x3c77cc[_0xd64f('0x45')]);var _0x236021={'where':_0x38846f[_0xd64f('0x43')]};return db['Dynamics365Field'][_0xd64f('0x1f')](_0x236021)[_0xd64f('0x26')](function(_0x3e0ff6){_0x1c9f1f[_0xd64f('0x1f')]=_0x3e0ff6;if(_0x3c77cc['query'][_0xd64f('0x46')]){_0x38846f[_0xd64f('0x47')]=[{'all':!![]}];}return db[_0xd64f('0x2e')]['findAll'](_0x38846f);})[_0xd64f('0x26')](function(_0x1fddb7){_0x1c9f1f[_0xd64f('0x48')]=_0x1fddb7;return _0x1c9f1f;})[_0xd64f('0x26')](respondWithFilteredResult(_0x3e938e,_0x38846f))[_0xd64f('0x49')](handleError(_0x3e938e,null));};exports[_0xd64f('0x4a')]=function(_0x3b1d93,_0x47e6a6){var _0x577637={'raw':!![],'where':{'id':_0x3b1d93['params']['id']}},_0x177011={};_0x177011[_0xd64f('0x33')]=_[_0xd64f('0x34')](db[_0xd64f('0x2e')][_0xd64f('0x2f')]);_0x177011['query']=_['keys'](_0x3b1d93[_0xd64f('0x35')]);_0x177011[_0xd64f('0x36')]=_[_0xd64f('0x37')](_0x177011[_0xd64f('0x33')],_0x177011[_0xd64f('0x35')]);_0x577637['attributes']=_['intersection'](_0x177011[_0xd64f('0x33')],qs[_0xd64f('0x38')](_0x3b1d93[_0xd64f('0x35')]['fields']));_0x577637['attributes']=_0x577637[_0xd64f('0x39')]['length']?_0x577637['attributes']:_0x177011[_0xd64f('0x33')];if(_0x3b1d93[_0xd64f('0x35')][_0xd64f('0x46')]){_0x577637[_0xd64f('0x47')]=[{'all':!![]}];}_0x577637=_['merge']({},_0x577637,_0x3b1d93['options']);return db[_0xd64f('0x2e')]['find'](_0x577637)['then'](handleEntityNotFound(_0x47e6a6,null))[_0xd64f('0x26')](respondWithResult(_0x47e6a6,null))[_0xd64f('0x49')](handleError(_0x47e6a6,null));};exports[_0xd64f('0x4b')]=function(_0x3f1147,_0x5c6976){return db[_0xd64f('0x2e')][_0xd64f('0x4b')](_0x3f1147[_0xd64f('0x4c')],{})[_0xd64f('0x26')](respondWithResult(_0x5c6976,0xc9))[_0xd64f('0x49')](handleError(_0x5c6976,null));};exports[_0xd64f('0x25')]=function(_0xae372f,_0x33a8b5){if(_0xae372f['body']['id']){delete _0xae372f[_0xd64f('0x4c')]['id'];}return db['Dynamics365Field'][_0xd64f('0x4d')]({'where':{'id':_0xae372f['params']['id']}})['then'](handleEntityNotFound(_0x33a8b5,null))[_0xd64f('0x26')](saveUpdates(_0xae372f[_0xd64f('0x4c')],null))[_0xd64f('0x26')](respondWithResult(_0x33a8b5,null))[_0xd64f('0x49')](handleError(_0x33a8b5,null));};exports[_0xd64f('0x27')]=function(_0x41fb39,_0x1d9575){return db[_0xd64f('0x2e')]['find']({'where':{'id':_0x41fb39['params']['id']}})[_0xd64f('0x26')](handleEntityNotFound(_0x1d9575,null))[_0xd64f('0x26')](removeEntity(_0x1d9575,null))[_0xd64f('0x49')](handleError(_0x1d9575,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b8b2ec2..5fd9070 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 _0x0401=['api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3773d6,_0x696a75){var _0x4ce4c2=function(_0x3481ab){while(--_0x3481ab){_0x3773d6['push'](_0x3773d6['shift']());}};_0x4ce4c2(++_0x696a75);}(_0x0401,0x176));var _0x1040=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x0401[_0x24259d];return _0x5a701;};'use strict';var _=require(_0x1040('0x0'));var util=require(_0x1040('0x1'));var logger=require(_0x1040('0x2'))(_0x1040('0x3'));var moment=require('moment');var BPromise=require(_0x1040('0x4'));var rp=require(_0x1040('0x5'));var fs=require('fs');var path=require(_0x1040('0x6'));var rimraf=require(_0x1040('0x7'));var config=require('../../config/environment');var attributes=require(_0x1040('0x8'));module[_0x1040('0x9')]=function(_0x479186,_0x45f332){return _0x479186['define'](_0x1040('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x1040('0xb'),_0x1040('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6203=['exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x6203,0x1b5));var _0x3620=function(_0x2988de,_0x9350b1){_0x2988de=_0x2988de-0x0;var _0x5b2903=_0x6203[_0x2988de];return _0x5b2903;};'use strict';var _=require('lodash');var util=require(_0x3620('0x0'));var logger=require(_0x3620('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3620('0x2'));var rp=require(_0x3620('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3620('0x4'));var config=require(_0x3620('0x5'));var attributes=require(_0x3620('0x6'));module[_0x3620('0x7')]=function(_0xe09926,_0x5acaf1){return _0xe09926[_0x3620('0x8')]('Dynamics365Field',attributes,{'tableName':_0x3620('0x9'),'paranoid':![],'indexes':[{'name':_0x3620('0xa'),'fields':[_0x3620('0xb'),'FieldId'],'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 27e8255..624f662 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 _0x9d23=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x3b2d98,_0xaa0b26){var _0x256bf1=function(_0x1fe933){while(--_0x1fe933){_0x3b2d98['push'](_0x3b2d98['shift']());}};_0x256bf1(++_0xaa0b26);}(_0x9d23,0x6b));var _0x39d2=function(_0x20a74a,_0x9f11fd){_0x20a74a=_0x20a74a-0x0;var _0x5e5a2b=_0x9d23[_0x20a74a];return _0x5e5a2b;};'use strict';var _=require(_0x39d2('0x0'));var util=require(_0x39d2('0x1'));var moment=require(_0x39d2('0x2'));var BPromise=require(_0x39d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39d2('0x4'));var db=require(_0x39d2('0x5'))['db'];var utils=require(_0x39d2('0x6'));var logger=require('../../config/logger')(_0x39d2('0x7'));var config=require(_0x39d2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x39d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca362e,_0x14d56e,_0x5d30e7){return new BPromise(function(_0x5776f4,_0x19c4eb){return client['request'](_0xca362e,_0x5d30e7)['then'](function(_0x352a14){logger[_0x39d2('0xa')](_0x39d2('0xb'),_0x14d56e,_0x39d2('0xc'));logger[_0x39d2('0xd')](_0x39d2('0xe'),_0x14d56e,_0x39d2('0xc'),JSON[_0x39d2('0xf')](_0x352a14));if(_0x352a14[_0x39d2('0x10')]){if(_0x352a14[_0x39d2('0x10')][_0x39d2('0x11')]===0x1f4){logger['error'](_0x39d2('0xb'),_0x14d56e,_0x352a14[_0x39d2('0x10')][_0x39d2('0x12')]);return _0x19c4eb(_0x352a14[_0x39d2('0x10')][_0x39d2('0x12')]);}logger['error'](_0x39d2('0xb'),_0x14d56e,_0x352a14['error']['message']);return _0x5776f4(_0x352a14['error'][_0x39d2('0x12')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x14d56e,_0x39d2('0xc'));_0x5776f4(_0x352a14[_0x39d2('0x13')]['message']);}})['catch'](function(_0x531602){logger[_0x39d2('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x14d56e,_0x531602);_0x19c4eb(_0x531602);});});} \ No newline at end of file +var _0x09f1=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x09f1,0xe6));var _0x109f=function(_0x1b3ce3,_0x2e030a){_0x1b3ce3=_0x1b3ce3-0x0;var _0x25b48a=_0x09f1[_0x1b3ce3];return _0x25b48a;};'use strict';var _=require(_0x109f('0x0'));var util=require(_0x109f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x109f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x109f('0x3'));var logger=require(_0x109f('0x4'))(_0x109f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x109f('0x6')][_0x109f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5accf1,_0x88951e,_0x23622f){return new BPromise(function(_0x1a854a,_0xc3b7c){return client[_0x109f('0x8')](_0x5accf1,_0x23622f)[_0x109f('0x9')](function(_0x1cda0e){logger['info'](_0x109f('0xa'),_0x88951e,_0x109f('0xb'));logger[_0x109f('0xc')](_0x109f('0xd'),_0x88951e,_0x109f('0xb'),JSON['stringify'](_0x1cda0e));if(_0x1cda0e[_0x109f('0xe')]){if(_0x1cda0e['error'][_0x109f('0xf')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x88951e,_0x1cda0e[_0x109f('0xe')][_0x109f('0x10')]);return _0xc3b7c(_0x1cda0e[_0x109f('0xe')][_0x109f('0x10')]);}logger[_0x109f('0xe')](_0x109f('0xa'),_0x88951e,_0x1cda0e[_0x109f('0xe')]['message']);return _0x1a854a(_0x1cda0e[_0x109f('0xe')]['message']);}else{logger[_0x109f('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x88951e,_0x109f('0xb'));_0x1a854a(_0x1cda0e[_0x109f('0x12')]['message']);}})[_0x109f('0x13')](function(_0x5f133a){logger[_0x109f('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x88951e,_0x5f133a);_0xc3b7c(_0x5f133a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 54af2f4..51e224c 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 _0xe0df=['/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','show','isAuthenticated','getConfigurations','/:id/fields','post','create'];(function(_0x323cdd,_0x369714){var _0x24c2da=function(_0x5c9948){while(--_0x5c9948){_0x323cdd['push'](_0x323cdd['shift']());}};_0x24c2da(++_0x369714);}(_0xe0df,0x13f));var _0xfe0d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe0df[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xfe0d('0x0'));var util=require(_0xfe0d('0x1'));var path=require('path');var timeout=require(_0xfe0d('0x2'));var express=require(_0xfe0d('0x3'));var router=express[_0xfe0d('0x4')]();var fs_extra=require(_0xfe0d('0x5'));var auth=require(_0xfe0d('0x6'));var interaction=require(_0xfe0d('0x7'));var config=require(_0xfe0d('0x8'));var controller=require(_0xfe0d('0x9'));router[_0xfe0d('0xa')]('/',auth['isAuthenticated'](),controller[_0xfe0d('0xb')]);router[_0xfe0d('0xa')](_0xfe0d('0xc'),auth['isAuthenticated'](),controller[_0xfe0d('0xd')]);router[_0xfe0d('0xa')]('/:id/configurations',auth[_0xfe0d('0xe')](),controller[_0xfe0d('0xf')]);router[_0xfe0d('0xa')](_0xfe0d('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0xfe0d('0x11')]('/',auth[_0xfe0d('0xe')](),controller[_0xfe0d('0x12')]);router['post'](_0xfe0d('0x13'),auth[_0xfe0d('0xe')](),controller[_0xfe0d('0x14')]);router[_0xfe0d('0x15')](_0xfe0d('0xc'),auth[_0xfe0d('0xe')](),controller[_0xfe0d('0x16')]);router[_0xfe0d('0x17')](_0xfe0d('0xc'),auth[_0xfe0d('0xe')](),controller[_0xfe0d('0x18')]);module[_0xfe0d('0x19')]=router; \ No newline at end of file +var _0x5780=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x3ad171,_0x2d5bee){var _0x21c3c3=function(_0x5ccae3){while(--_0x5ccae3){_0x3ad171['push'](_0x3ad171['shift']());}};_0x21c3c3(++_0x2d5bee);}(_0x5780,0x128));var _0x0578=function(_0x422361,_0x67879e){_0x422361=_0x422361-0x0;var _0x113124=_0x5780[_0x422361];return _0x113124;};'use strict';var multer=require(_0x0578('0x0'));var util=require(_0x0578('0x1'));var path=require('path');var timeout=require(_0x0578('0x2'));var express=require('express');var router=express[_0x0578('0x3')]();var fs_extra=require(_0x0578('0x4'));var auth=require(_0x0578('0x5'));var interaction=require(_0x0578('0x6'));var config=require(_0x0578('0x7'));var controller=require(_0x0578('0x8'));router['get']('/',auth[_0x0578('0x9')](),controller[_0x0578('0xa')]);router[_0x0578('0xb')](_0x0578('0xc'),auth[_0x0578('0x9')](),controller[_0x0578('0xd')]);router[_0x0578('0xb')](_0x0578('0xe'),auth[_0x0578('0x9')](),controller[_0x0578('0xf')]);router[_0x0578('0xb')](_0x0578('0x10'),auth[_0x0578('0x9')](),controller[_0x0578('0x11')]);router[_0x0578('0x12')]('/',auth[_0x0578('0x9')](),controller[_0x0578('0x13')]);router['post'](_0x0578('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0578('0x14')]('/:id',auth[_0x0578('0x9')](),controller[_0x0578('0x15')]);router[_0x0578('0x16')](_0x0578('0xc'),auth[_0x0578('0x9')](),controller[_0x0578('0x17')]);module[_0x0578('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 542c59b..00d0df1 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 _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4678df,_0xd9fa62){var _0x25413a=function(_0x5b7d09){while(--_0x5b7d09){_0x4678df['push'](_0x4678df['shift']());}};_0x25413a(++_0xd9fa62);}(_0x66fa,0x117));var _0xa66f=function(_0x3547de,_0x98bc34){_0x3547de=_0x3547de-0x0;var _0x5723cc=_0x66fa[_0x3547de];return _0x5723cc;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4888=['exports','STRING','username'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4888,0x198));var _0x8488=function(_0x3c5bf1,_0x30bb33){_0x3c5bf1=_0x3c5bf1-0x0;var _0x2dc4d3=_0x4888[_0x3c5bf1];return _0x2dc4d3;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 8f59ef4..41c65fd 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 _0xede3=['undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','FreshdeskAccount','count','include','findAll','catch','show','fields','includeAll','find','body','params','FreshdeskConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Descriptions','channel','create','FreshdeskField','remoteUri','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','description','group','source','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xede3,0xc0));var _0x3ede=function(_0x29d655,_0x3df89d){_0x29d655=_0x29d655-0x0;var _0x41549b=_0xede3[_0x29d655];return _0x41549b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ede('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ede('0x1'));var rp=require(_0x3ede('0x2'));var moment=require(_0x3ede('0x3'));var BPromise=require(_0x3ede('0x4'));var Mustache=require(_0x3ede('0x5'));var util=require(_0x3ede('0x6'));var path=require(_0x3ede('0x7'));var sox=require(_0x3ede('0x8'));var csv=require(_0x3ede('0x9'));var ejs=require(_0x3ede('0xa'));var fs=require('fs');var fs_extra=require(_0x3ede('0xb'));var _=require(_0x3ede('0xc'));var squel=require(_0x3ede('0xd'));var crypto=require(_0x3ede('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3ede('0xf'));var toCsv=require(_0x3ede('0x9'));var querystring=require(_0x3ede('0x10'));var Papa=require('papaparse');var Redis=require(_0x3ede('0x11'));var authService=require(_0x3ede('0x12'));var qs=require(_0x3ede('0x13'));var as=require(_0x3ede('0x14'));var hardwareService=require(_0x3ede('0x15'));var logger=require('../../config/logger')(_0x3ede('0x16'));var utils=require(_0x3ede('0x17'));var config=require(_0x3ede('0x18'));var licenseUtil=require(_0x3ede('0x19'));var db=require(_0x3ede('0x1a'))['db'];var integrations=require(_0x3ede('0x1b'));function respondWithStatusCode(_0x3b2697,_0xf1a93b){_0xf1a93b=_0xf1a93b||0xcc;return function(_0x449111){if(_0x449111){return _0x3b2697[_0x3ede('0x1c')](_0xf1a93b);}return _0x3b2697[_0x3ede('0x1d')](_0xf1a93b)[_0x3ede('0x1e')]();};}function respondWithResult(_0x470bba,_0x5d2d69){_0x5d2d69=_0x5d2d69||0xc8;return function(_0x4e03a5){if(_0x4e03a5){return _0x470bba[_0x3ede('0x1d')](_0x5d2d69)['json'](_0x4e03a5);}};}function respondWithFilteredResult(_0x2ac4d5,_0x59c338){return function(_0x54ae57){if(_0x54ae57){var _0x18e11c=typeof _0x59c338[_0x3ede('0x1f')]===_0x3ede('0x20')&&typeof _0x59c338['limit']===_0x3ede('0x20');var _0x516539=_0x54ae57['count'];var _0x390421=_0x18e11c?0x0:_0x59c338[_0x3ede('0x1f')];var _0x1c0268=_0x18e11c?_0x54ae57['count']:_0x59c338[_0x3ede('0x1f')]+_0x59c338[_0x3ede('0x21')];var _0x4fdcc6;if(_0x1c0268>=_0x516539){_0x1c0268=_0x516539;_0x4fdcc6=0xc8;}else{_0x4fdcc6=0xce;}_0x2ac4d5['status'](_0x4fdcc6);return _0x2ac4d5['set'](_0x3ede('0x22'),_0x390421+'-'+_0x1c0268+'/'+_0x516539)['json'](_0x54ae57);}return null;};}function patchUpdates(_0x38ebd6){return function(_0x5a45ff){try{jsonpatch[_0x3ede('0x23')](_0x5a45ff,_0x38ebd6,!![]);}catch(_0x2de9f4){return BPromise[_0x3ede('0x24')](_0x2de9f4);}return _0x5a45ff[_0x3ede('0x25')]();};}function saveUpdates(_0x33b2d6,_0x472924){return function(_0x582d19){if(_0x582d19){return _0x582d19[_0x3ede('0x26')](_0x33b2d6)[_0x3ede('0x27')](function(_0x1e8384){return _0x1e8384;});}return null;};}function removeEntity(_0x19e9aa,_0x313699){return function(_0x10636f){if(_0x10636f){return _0x10636f[_0x3ede('0x28')]()[_0x3ede('0x27')](function(){_0x19e9aa[_0x3ede('0x1d')](0xcc)[_0x3ede('0x1e')]();});}};}function handleEntityNotFound(_0x553584,_0x5e3304){return function(_0x3765fe){if(!_0x3765fe){_0x553584[_0x3ede('0x1c')](0x194);}return _0x3765fe;};}function handleError(_0x248e17,_0x8e750c){_0x8e750c=_0x8e750c||0x1f4;return function(_0x1f0b36){logger[_0x3ede('0x29')](_0x1f0b36['stack']);if(_0x1f0b36[_0x3ede('0x2a')]){delete _0x1f0b36[_0x3ede('0x2a')];}_0x248e17[_0x3ede('0x1d')](_0x8e750c)['send'](_0x1f0b36);};}exports[_0x3ede('0x2b')]=function(_0x8daee8,_0x449e94){var _0x57cf8a={},_0x3d064a={},_0x481e4e={'count':0x0,'rows':[]};var _0x27c706=_[_0x3ede('0x2c')](db['FreshdeskAccount']['rawAttributes'],function(_0x319fd4){return{'name':_0x319fd4[_0x3ede('0x2d')],'type':_0x319fd4[_0x3ede('0x2e')][_0x3ede('0x2f')]};});_0x3d064a[_0x3ede('0x30')]=_[_0x3ede('0x2c')](_0x27c706,_0x3ede('0x2a'));_0x3d064a[_0x3ede('0x31')]=_[_0x3ede('0x32')](_0x8daee8[_0x3ede('0x31')]);_0x3d064a['filters']=_[_0x3ede('0x33')](_0x3d064a[_0x3ede('0x30')],_0x3d064a['query']);_0x57cf8a[_0x3ede('0x34')]=_[_0x3ede('0x33')](_0x3d064a[_0x3ede('0x30')],qs['fields'](_0x8daee8[_0x3ede('0x31')]['fields']));_0x57cf8a[_0x3ede('0x34')]=_0x57cf8a[_0x3ede('0x34')][_0x3ede('0x35')]?_0x57cf8a['attributes']:_0x3d064a['model'];if(!_0x8daee8[_0x3ede('0x31')][_0x3ede('0x36')](_0x3ede('0x37'))){_0x57cf8a[_0x3ede('0x21')]=qs[_0x3ede('0x21')](_0x8daee8['query'][_0x3ede('0x21')]);_0x57cf8a[_0x3ede('0x1f')]=qs[_0x3ede('0x1f')](_0x8daee8[_0x3ede('0x31')]['offset']);}_0x57cf8a[_0x3ede('0x38')]=qs[_0x3ede('0x39')](_0x8daee8[_0x3ede('0x31')]['sort']);_0x57cf8a['where']=qs[_0x3ede('0x3a')](_[_0x3ede('0x3b')](_0x8daee8[_0x3ede('0x31')],_0x3d064a[_0x3ede('0x3a')]),_0x27c706);if(_0x8daee8[_0x3ede('0x31')][_0x3ede('0x3c')]){_0x57cf8a[_0x3ede('0x3d')]=_['merge'](_0x57cf8a[_0x3ede('0x3d')],{'$or':_[_0x3ede('0x2c')](_0x27c706,function(_0xba1c37){if(_0xba1c37['type']!=='VIRTUAL'){var _0x5f0b05={};_0x5f0b05[_0xba1c37[_0x3ede('0x2a')]]={'$like':'%'+_0x8daee8[_0x3ede('0x31')][_0x3ede('0x3c')]+'%'};return _0x5f0b05;}})});}_0x57cf8a=_[_0x3ede('0x3e')]({},_0x57cf8a,_0x8daee8[_0x3ede('0x3f')]);var _0xe752e1={'where':_0x57cf8a[_0x3ede('0x3d')]};return db[_0x3ede('0x40')][_0x3ede('0x41')](_0xe752e1)['then'](function(_0xbd187d){_0x481e4e[_0x3ede('0x41')]=_0xbd187d;if(_0x8daee8[_0x3ede('0x31')]['includeAll']){_0x57cf8a[_0x3ede('0x42')]=[{'all':!![]}];}return db[_0x3ede('0x40')][_0x3ede('0x43')](_0x57cf8a);})[_0x3ede('0x27')](function(_0x59122d){_0x481e4e['rows']=_0x59122d;return _0x481e4e;})[_0x3ede('0x27')](respondWithFilteredResult(_0x449e94,_0x57cf8a))[_0x3ede('0x44')](handleError(_0x449e94,null));};exports[_0x3ede('0x45')]=function(_0x15bfbb,_0x507054){var _0x133c73={'raw':![],'where':{'id':_0x15bfbb['params']['id']}},_0x342bf7={};_0x342bf7['model']=_['keys'](db[_0x3ede('0x40')]['rawAttributes']);_0x342bf7['query']=_['keys'](_0x15bfbb[_0x3ede('0x31')]);_0x342bf7[_0x3ede('0x3a')]=_[_0x3ede('0x33')](_0x342bf7[_0x3ede('0x30')],_0x342bf7[_0x3ede('0x31')]);_0x133c73[_0x3ede('0x34')]=_['intersection'](_0x342bf7[_0x3ede('0x30')],qs['fields'](_0x15bfbb['query'][_0x3ede('0x46')]));_0x133c73[_0x3ede('0x34')]=_0x133c73[_0x3ede('0x34')]['length']?_0x133c73['attributes']:_0x342bf7[_0x3ede('0x30')];if(_0x15bfbb[_0x3ede('0x31')][_0x3ede('0x47')]){_0x133c73['include']=[{'all':!![]}];}_0x133c73=_[_0x3ede('0x3e')]({},_0x133c73,_0x15bfbb[_0x3ede('0x3f')]);return db[_0x3ede('0x40')][_0x3ede('0x48')](_0x133c73)[_0x3ede('0x27')](handleEntityNotFound(_0x507054,null))[_0x3ede('0x27')](respondWithResult(_0x507054,null))[_0x3ede('0x44')](handleError(_0x507054,null));};exports['create']=function(_0x56081d,_0x53916c){return db['FreshdeskAccount']['create'](_0x56081d[_0x3ede('0x49')],{})[_0x3ede('0x27')](respondWithResult(_0x53916c,0xc9))[_0x3ede('0x44')](handleError(_0x53916c,null));};exports[_0x3ede('0x26')]=function(_0x12f296,_0x1ebd75){if(_0x12f296[_0x3ede('0x49')]['id']){delete _0x12f296['body']['id'];}return db['FreshdeskAccount'][_0x3ede('0x48')]({'where':{'id':_0x12f296[_0x3ede('0x4a')]['id']}})[_0x3ede('0x27')](handleEntityNotFound(_0x1ebd75,null))[_0x3ede('0x27')](saveUpdates(_0x12f296[_0x3ede('0x49')],null))[_0x3ede('0x27')](respondWithResult(_0x1ebd75,null))['catch'](handleError(_0x1ebd75,null));};exports[_0x3ede('0x28')]=function(_0x7fbec6,_0xc55e01){return db[_0x3ede('0x40')][_0x3ede('0x48')]({'where':{'id':_0x7fbec6[_0x3ede('0x4a')]['id']}})[_0x3ede('0x27')](handleEntityNotFound(_0xc55e01,null))[_0x3ede('0x27')](removeEntity(_0xc55e01,null))['catch'](handleError(_0xc55e01,null));};exports['getConfigurations']=function(_0x573449,_0x284680,_0x6bdbee){var _0x14ccec={};var _0x20068f={};var _0x519daf;var _0x253773;return db[_0x3ede('0x40')]['findOne']({'where':{'id':_0x573449['params']['id']}})[_0x3ede('0x27')](handleEntityNotFound(_0x284680,null))['then'](function(_0x5a874f){if(_0x5a874f){_0x519daf=_0x5a874f;_0x20068f[_0x3ede('0x30')]=_[_0x3ede('0x32')](db[_0x3ede('0x4b')]['rawAttributes']);_0x20068f[_0x3ede('0x31')]=_['keys'](_0x573449['query']);_0x20068f[_0x3ede('0x3a')]=_[_0x3ede('0x33')](_0x20068f[_0x3ede('0x30')],_0x20068f['query']);_0x14ccec['attributes']=_['intersection'](_0x20068f[_0x3ede('0x30')],qs[_0x3ede('0x46')](_0x573449[_0x3ede('0x31')]['fields']));_0x14ccec['attributes']=_0x14ccec['attributes'][_0x3ede('0x35')]?_0x14ccec[_0x3ede('0x34')]:_0x20068f[_0x3ede('0x30')];_0x14ccec[_0x3ede('0x38')]=qs['sort'](_0x573449[_0x3ede('0x31')][_0x3ede('0x39')]);_0x14ccec[_0x3ede('0x3d')]=qs[_0x3ede('0x3a')](_[_0x3ede('0x3b')](_0x573449['query'],_0x20068f['filters']));if(_0x573449['query'][_0x3ede('0x3c')]){_0x14ccec['where']=_['merge'](_0x14ccec[_0x3ede('0x3d')],{'$or':_[_0x3ede('0x2c')](_0x14ccec[_0x3ede('0x34')],function(_0x39619a){var _0xdccf67={};_0xdccf67[_0x39619a]={'$like':'%'+_0x573449[_0x3ede('0x31')]['filter']+'%'};return _0xdccf67;})});}_0x14ccec=_[_0x3ede('0x3e')]({},_0x14ccec,_0x573449[_0x3ede('0x3f')]);return _0x519daf[_0x3ede('0x4c')](_0x14ccec);}})['then'](function(_0x44de0f){if(_0x44de0f){_0x253773=_0x44de0f[_0x3ede('0x35')];if(!_0x573449['query'][_0x3ede('0x36')](_0x3ede('0x37'))){_0x14ccec[_0x3ede('0x21')]=qs[_0x3ede('0x21')](_0x573449[_0x3ede('0x31')]['limit']);_0x14ccec[_0x3ede('0x1f')]=qs[_0x3ede('0x1f')](_0x573449[_0x3ede('0x31')]['offset']);}return _0x519daf['getConfigurations'](_0x14ccec);}})['then'](function(_0x1060dd){if(_0x1060dd){return _0x1060dd?{'count':_0x253773,'rows':_0x1060dd}:null;}})[_0x3ede('0x27')](respondWithResult(_0x284680,null))['catch'](handleError(_0x284680,null));};exports[_0x3ede('0x4d')]=function(_0x3c2eec,_0x28ba81,_0x48a2e7){if(_0x3c2eec['body']['id']){delete _0x3c2eec[_0x3ede('0x49')]['id'];}return db[_0x3ede('0x40')][_0x3ede('0x4e')]({'where':{'id':_0x3c2eec[_0x3ede('0x4a')]['id']}})[_0x3ede('0x27')](handleEntityNotFound(_0x28ba81,null))[_0x3ede('0x27')](function(_0x28c19e){if(_0x28c19e){_0x3c2eec[_0x3ede('0x49')][_0x3ede('0x4f')]=_0x28c19e['id'];_0x3c2eec[_0x3ede('0x49')]['Subjects']=integrations['getSubjects'](_0x3c2eec[_0x3ede('0x49')]['channel'],_0x3c2eec[_0x3ede('0x49')][_0x3ede('0x2e')]);_0x3c2eec[_0x3ede('0x49')][_0x3ede('0x50')]=integrations['getDescriptions'](_0x3c2eec['body'][_0x3ede('0x51')],_0x3c2eec[_0x3ede('0x49')]['type']);return db[_0x3ede('0x4b')][_0x3ede('0x52')](_0x3c2eec[_0x3ede('0x49')],{'include':[{'model':db[_0x3ede('0x53')],'as':'Subjects'},{'model':db[_0x3ede('0x53')],'as':'Descriptions'}]});}return null;})[_0x3ede('0x27')](respondWithResult(_0x28ba81,null))[_0x3ede('0x44')](handleError(_0x28ba81,null));};exports['getFields']=function(_0x569aa2,_0x2842df,_0x39205f){var _0x27e3c3='';return db[_0x3ede('0x40')]['findOne']({'where':{'id':_0x569aa2[_0x3ede('0x4a')]['id']},'attributes':['id','remoteUri','apiKey']})['then'](handleEntityNotFound(_0x2842df,null))['then'](function(_0x13c593){if(_0x13c593){_0x27e3c3=_0x13c593[_0x3ede('0x54')];var _0x1cea7d=_0x27e3c3[_0x3ede('0x55')](-0x1);if(_0x1cea7d==='/'){_0x27e3c3=_0x27e3c3['substring'](0x0,_0x27e3c3[_0x3ede('0x56')](_0x1cea7d));}return rp({'method':_0x3ede('0x57'),'uri':util[_0x3ede('0x58')](_0x3ede('0x59'),_0x27e3c3,_0x3ede('0x5a')),'headers':{'Authorization':util[_0x3ede('0x58')](_0x3ede('0x5b'),new Buffer(util[_0x3ede('0x58')](_0x3ede('0x5c'),_0x13c593[_0x3ede('0x5d')]))[_0x3ede('0x5e')](_0x3ede('0x5f')))},'json':!![]});}})[_0x3ede('0x27')](function(_0x4691d2){if(_0x4691d2){var _0x4fd768=['requester','subject','agent',_0x3ede('0x60'),'status','priority',_0x3ede('0x61'),_0x3ede('0x62'),_0x3ede('0x63'),'group',_0x3ede('0x64')];_[_0x3ede('0x65')](_0x4691d2,function(_0xa9e773){return _0x4fd768[_0x3ede('0x66')](_0xa9e773[_0x3ede('0x2a')])||!_0xa9e773[_0x3ede('0x67')]&&_0xa9e773[_0x3ede('0x2e')]!=='custom_text'&&_0xa9e773['type']!==_0x3ede('0x68');});return{'count':_0x4691d2[_0x3ede('0x35')],'rows':_[_0x3ede('0x2c')](_0x4691d2,function(_0x5aaa01){return{'id':_0x5aaa01[_0x3ede('0x2a')],'name':_0x5aaa01[_0x3ede('0x69')],'custom':!_0x5aaa01[_0x3ede('0x67')],'options':_0x5aaa01[_0x3ede('0x6a')]?_['map'](_0x5aaa01[_0x3ede('0x6a')],function(_0x4ea3b6){return{'name':_['capitalize'](_0x4ea3b6),'value':_0x4ea3b6};}):[]};})};}})[_0x3ede('0x27')](respondWithResult(_0x2842df,null))['catch'](function(_0x1996d9){var _0x130f11=_0x569aa2['query'][_0x3ede('0x6b')]?0x1f4:_0x1996d9[_0x3ede('0x6c')]||0x1f4;logger['error'](_0x3ede('0x6d'),_0x3ede('0x6e'),_0x130f11,JSON['stringify'](_0x1996d9));delete _0x1996d9[_0x3ede('0x2a')];if(_0x130f11===0x191){_0x130f11=0x190;}_0x2842df['status'](_0x130f11)['send'](_0x569aa2[_0x3ede('0x31')][_0x3ede('0x6b')]?{'message':_0x3ede('0x6f'),'statusCode':_0x1996d9[_0x3ede('0x6c')]}:_0x1996d9);});}; \ No newline at end of file +var _0x76dc=['apiKey','slice','lastIndexOf','format','%s/%s','Basic\x20%s','%s:X','toString','requester','subject','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','name','send','index','FreshdeskAccount','rawAttributes','fieldName','key','map','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri'];(function(_0x409085,_0x3e8c65){var _0x435512=function(_0x308df2){while(--_0x308df2){_0x409085['push'](_0x409085['shift']());}};_0x435512(++_0x3e8c65);}(_0x76dc,0x1f2));var _0xc76d=function(_0x410faa,_0x552765){_0x410faa=_0x410faa-0x0;var _0x5edab8=_0x76dc[_0x410faa];return _0x5edab8;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];var integrations=require(_0xc76d('0x17'));function respondWithStatusCode(_0x1722b3,_0x311814){_0x311814=_0x311814||0xcc;return function(_0x1a7b47){if(_0x1a7b47){return _0x1722b3[_0xc76d('0x18')](_0x311814);}return _0x1722b3[_0xc76d('0x19')](_0x311814)[_0xc76d('0x1a')]();};}function respondWithResult(_0x5cda20,_0x8696db){_0x8696db=_0x8696db||0xc8;return function(_0x2e9ec7){if(_0x2e9ec7){return _0x5cda20['status'](_0x8696db)[_0xc76d('0x1b')](_0x2e9ec7);}};}function respondWithFilteredResult(_0x2d23d2,_0x47a4ee){return function(_0x6f94e){if(_0x6f94e){var _0x5c680c=typeof _0x47a4ee[_0xc76d('0x1c')]==='undefined'&&typeof _0x47a4ee['limit']===_0xc76d('0x1d');var _0x31b032=_0x6f94e[_0xc76d('0x1e')];var _0x23f3ca=_0x5c680c?0x0:_0x47a4ee[_0xc76d('0x1c')];var _0x4b0402=_0x5c680c?_0x6f94e[_0xc76d('0x1e')]:_0x47a4ee[_0xc76d('0x1c')]+_0x47a4ee[_0xc76d('0x1f')];var _0x1c6d5b;if(_0x4b0402>=_0x31b032){_0x4b0402=_0x31b032;_0x1c6d5b=0xc8;}else{_0x1c6d5b=0xce;}_0x2d23d2[_0xc76d('0x19')](_0x1c6d5b);return _0x2d23d2['set'](_0xc76d('0x20'),_0x23f3ca+'-'+_0x4b0402+'/'+_0x31b032)[_0xc76d('0x1b')](_0x6f94e);}return null;};}function patchUpdates(_0x5dffde){return function(_0x455371){try{jsonpatch[_0xc76d('0x21')](_0x455371,_0x5dffde,!![]);}catch(_0x191e97){return BPromise[_0xc76d('0x22')](_0x191e97);}return _0x455371[_0xc76d('0x23')]();};}function saveUpdates(_0x3d357b,_0x42b89c){return function(_0x107fad){if(_0x107fad){return _0x107fad[_0xc76d('0x24')](_0x3d357b)[_0xc76d('0x25')](function(_0x15328d){return _0x15328d;});}return null;};}function removeEntity(_0x5de11f,_0x11b42f){return function(_0x17b46f){if(_0x17b46f){return _0x17b46f['destroy']()[_0xc76d('0x25')](function(){_0x5de11f[_0xc76d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x374b9e,_0x476aee){return function(_0x2cd06e){if(!_0x2cd06e){_0x374b9e[_0xc76d('0x18')](0x194);}return _0x2cd06e;};}function handleError(_0xfc4aea,_0x1949c4){_0x1949c4=_0x1949c4||0x1f4;return function(_0x89ee5){logger['error'](_0x89ee5['stack']);if(_0x89ee5[_0xc76d('0x26')]){delete _0x89ee5[_0xc76d('0x26')];}_0xfc4aea['status'](_0x1949c4)[_0xc76d('0x27')](_0x89ee5);};}exports[_0xc76d('0x28')]=function(_0x64899f,_0x49fa89){var _0x2039f4={},_0x5cf2e4={},_0x13b468={'count':0x0,'rows':[]};var _0x18a7fa=_['map'](db[_0xc76d('0x29')][_0xc76d('0x2a')],function(_0x9ab96c){return{'name':_0x9ab96c[_0xc76d('0x2b')],'type':_0x9ab96c['type'][_0xc76d('0x2c')]};});_0x5cf2e4['model']=_[_0xc76d('0x2d')](_0x18a7fa,'name');_0x5cf2e4[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x64899f['query']);_0x5cf2e4['filters']=_['intersection'](_0x5cf2e4['model'],_0x5cf2e4[_0xc76d('0x2e')]);_0x2039f4[_0xc76d('0x30')]=_[_0xc76d('0x31')](_0x5cf2e4[_0xc76d('0x32')],qs[_0xc76d('0x33')](_0x64899f['query'][_0xc76d('0x33')]));_0x2039f4['attributes']=_0x2039f4[_0xc76d('0x30')]['length']?_0x2039f4[_0xc76d('0x30')]:_0x5cf2e4[_0xc76d('0x32')];if(!_0x64899f[_0xc76d('0x2e')][_0xc76d('0x34')](_0xc76d('0x35'))){_0x2039f4['limit']=qs[_0xc76d('0x1f')](_0x64899f[_0xc76d('0x2e')][_0xc76d('0x1f')]);_0x2039f4['offset']=qs[_0xc76d('0x1c')](_0x64899f[_0xc76d('0x2e')][_0xc76d('0x1c')]);}_0x2039f4['order']=qs[_0xc76d('0x36')](_0x64899f[_0xc76d('0x2e')][_0xc76d('0x36')]);_0x2039f4[_0xc76d('0x37')]=qs[_0xc76d('0x38')](_[_0xc76d('0x39')](_0x64899f['query'],_0x5cf2e4['filters']),_0x18a7fa);if(_0x64899f[_0xc76d('0x2e')]['filter']){_0x2039f4[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x2039f4[_0xc76d('0x37')],{'$or':_[_0xc76d('0x2d')](_0x18a7fa,function(_0x57b9bc){if(_0x57b9bc['type']!==_0xc76d('0x3b')){var _0x20a456={};_0x20a456[_0x57b9bc[_0xc76d('0x26')]]={'$like':'%'+_0x64899f[_0xc76d('0x2e')][_0xc76d('0x3c')]+'%'};return _0x20a456;}})});}_0x2039f4=_['merge']({},_0x2039f4,_0x64899f[_0xc76d('0x3d')]);var _0xb264b0={'where':_0x2039f4[_0xc76d('0x37')]};return db[_0xc76d('0x29')][_0xc76d('0x1e')](_0xb264b0)[_0xc76d('0x25')](function(_0x10ba23){_0x13b468[_0xc76d('0x1e')]=_0x10ba23;if(_0x64899f[_0xc76d('0x2e')][_0xc76d('0x3e')]){_0x2039f4['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0xc76d('0x3f')](_0x2039f4);})[_0xc76d('0x25')](function(_0x1e5118){_0x13b468[_0xc76d('0x40')]=_0x1e5118;return _0x13b468;})['then'](respondWithFilteredResult(_0x49fa89,_0x2039f4))['catch'](handleError(_0x49fa89,null));};exports[_0xc76d('0x41')]=function(_0x13a895,_0x3e471e){var _0x15eb42={'raw':![],'where':{'id':_0x13a895[_0xc76d('0x42')]['id']}},_0x21c18f={};_0x21c18f[_0xc76d('0x32')]=_[_0xc76d('0x2f')](db['FreshdeskAccount'][_0xc76d('0x2a')]);_0x21c18f[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x13a895[_0xc76d('0x2e')]);_0x21c18f['filters']=_['intersection'](_0x21c18f['model'],_0x21c18f['query']);_0x15eb42['attributes']=_['intersection'](_0x21c18f['model'],qs[_0xc76d('0x33')](_0x13a895[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x15eb42[_0xc76d('0x30')]=_0x15eb42[_0xc76d('0x30')][_0xc76d('0x43')]?_0x15eb42[_0xc76d('0x30')]:_0x21c18f[_0xc76d('0x32')];if(_0x13a895['query'][_0xc76d('0x3e')]){_0x15eb42[_0xc76d('0x44')]=[{'all':!![]}];}_0x15eb42=_[_0xc76d('0x3a')]({},_0x15eb42,_0x13a895[_0xc76d('0x3d')]);return db[_0xc76d('0x29')][_0xc76d('0x45')](_0x15eb42)[_0xc76d('0x25')](handleEntityNotFound(_0x3e471e,null))[_0xc76d('0x25')](respondWithResult(_0x3e471e,null))[_0xc76d('0x46')](handleError(_0x3e471e,null));};exports['create']=function(_0x5b41d3,_0x144d09){return db[_0xc76d('0x29')][_0xc76d('0x47')](_0x5b41d3[_0xc76d('0x48')],{})[_0xc76d('0x25')](respondWithResult(_0x144d09,0xc9))['catch'](handleError(_0x144d09,null));};exports[_0xc76d('0x24')]=function(_0x1ede13,_0x5e48fe){if(_0x1ede13['body']['id']){delete _0x1ede13[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x29')]['find']({'where':{'id':_0x1ede13[_0xc76d('0x42')]['id']}})[_0xc76d('0x25')](handleEntityNotFound(_0x5e48fe,null))[_0xc76d('0x25')](saveUpdates(_0x1ede13[_0xc76d('0x48')],null))[_0xc76d('0x25')](respondWithResult(_0x5e48fe,null))[_0xc76d('0x46')](handleError(_0x5e48fe,null));};exports[_0xc76d('0x49')]=function(_0x10b1b0,_0x4452a8){return db[_0xc76d('0x29')]['find']({'where':{'id':_0x10b1b0[_0xc76d('0x42')]['id']}})[_0xc76d('0x25')](handleEntityNotFound(_0x4452a8,null))[_0xc76d('0x25')](removeEntity(_0x4452a8,null))['catch'](handleError(_0x4452a8,null));};exports[_0xc76d('0x4a')]=function(_0x1afc6c,_0x506b03,_0x366d43){var _0x488783={};var _0xe90d83={};var _0x12c972;var _0x316978;return db[_0xc76d('0x29')][_0xc76d('0x4b')]({'where':{'id':_0x1afc6c['params']['id']}})['then'](handleEntityNotFound(_0x506b03,null))['then'](function(_0x320483){if(_0x320483){_0x12c972=_0x320483;_0xe90d83[_0xc76d('0x32')]=_[_0xc76d('0x2f')](db[_0xc76d('0x4c')][_0xc76d('0x2a')]);_0xe90d83[_0xc76d('0x2e')]=_['keys'](_0x1afc6c[_0xc76d('0x2e')]);_0xe90d83[_0xc76d('0x38')]=_[_0xc76d('0x31')](_0xe90d83[_0xc76d('0x32')],_0xe90d83[_0xc76d('0x2e')]);_0x488783['attributes']=_[_0xc76d('0x31')](_0xe90d83[_0xc76d('0x32')],qs[_0xc76d('0x33')](_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x488783[_0xc76d('0x30')]=_0x488783['attributes'][_0xc76d('0x43')]?_0x488783[_0xc76d('0x30')]:_0xe90d83['model'];_0x488783['order']=qs[_0xc76d('0x36')](_0x1afc6c['query'][_0xc76d('0x36')]);_0x488783[_0xc76d('0x37')]=qs[_0xc76d('0x38')](_[_0xc76d('0x39')](_0x1afc6c[_0xc76d('0x2e')],_0xe90d83[_0xc76d('0x38')]));if(_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x3c')]){_0x488783[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x488783[_0xc76d('0x37')],{'$or':_[_0xc76d('0x2d')](_0x488783[_0xc76d('0x30')],function(_0x3afeb6){var _0x4cd7bf={};_0x4cd7bf[_0x3afeb6]={'$like':'%'+_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x3c')]+'%'};return _0x4cd7bf;})});}_0x488783=_[_0xc76d('0x3a')]({},_0x488783,_0x1afc6c[_0xc76d('0x3d')]);return _0x12c972[_0xc76d('0x4a')](_0x488783);}})['then'](function(_0x40e866){if(_0x40e866){_0x316978=_0x40e866[_0xc76d('0x43')];if(!_0x1afc6c['query']['hasOwnProperty']('nolimit')){_0x488783[_0xc76d('0x1f')]=qs[_0xc76d('0x1f')](_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x1f')]);_0x488783[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0x1afc6c[_0xc76d('0x2e')][_0xc76d('0x1c')]);}return _0x12c972['getConfigurations'](_0x488783);}})[_0xc76d('0x25')](function(_0x5e2f0d){if(_0x5e2f0d){return _0x5e2f0d?{'count':_0x316978,'rows':_0x5e2f0d}:null;}})['then'](respondWithResult(_0x506b03,null))[_0xc76d('0x46')](handleError(_0x506b03,null));};exports[_0xc76d('0x4d')]=function(_0x1a0182,_0x502bd8,_0x11b544){if(_0x1a0182['body']['id']){delete _0x1a0182['body']['id'];}return db['FreshdeskAccount'][_0xc76d('0x4b')]({'where':{'id':_0x1a0182[_0xc76d('0x42')]['id']}})['then'](handleEntityNotFound(_0x502bd8,null))[_0xc76d('0x25')](function(_0x382bc1){if(_0x382bc1){_0x1a0182[_0xc76d('0x48')][_0xc76d('0x4e')]=_0x382bc1['id'];_0x1a0182[_0xc76d('0x48')][_0xc76d('0x4f')]=integrations[_0xc76d('0x50')](_0x1a0182['body']['channel'],_0x1a0182['body'][_0xc76d('0x51')]);_0x1a0182[_0xc76d('0x48')][_0xc76d('0x52')]=integrations[_0xc76d('0x53')](_0x1a0182[_0xc76d('0x48')]['channel'],_0x1a0182[_0xc76d('0x48')][_0xc76d('0x51')]);return db[_0xc76d('0x4c')][_0xc76d('0x47')](_0x1a0182[_0xc76d('0x48')],{'include':[{'model':db[_0xc76d('0x54')],'as':_0xc76d('0x4f')},{'model':db[_0xc76d('0x54')],'as':'Descriptions'}]});}return null;})[_0xc76d('0x25')](respondWithResult(_0x502bd8,null))['catch'](handleError(_0x502bd8,null));};exports[_0xc76d('0x55')]=function(_0x40afa3,_0x35c60f,_0x55dd93){var _0x58c3ce='';return db[_0xc76d('0x29')]['findOne']({'where':{'id':_0x40afa3['params']['id']},'attributes':['id',_0xc76d('0x56'),_0xc76d('0x57')]})['then'](handleEntityNotFound(_0x35c60f,null))[_0xc76d('0x25')](function(_0x1062ea){if(_0x1062ea){_0x58c3ce=_0x1062ea['remoteUri'];var _0x2b6ea1=_0x58c3ce[_0xc76d('0x58')](-0x1);if(_0x2b6ea1==='/'){_0x58c3ce=_0x58c3ce['substring'](0x0,_0x58c3ce[_0xc76d('0x59')](_0x2b6ea1));}return rp({'method':'GET','uri':util[_0xc76d('0x5a')](_0xc76d('0x5b'),_0x58c3ce,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xc76d('0x5a')](_0xc76d('0x5c'),new Buffer(util['format'](_0xc76d('0x5d'),_0x1062ea[_0xc76d('0x57')]))[_0xc76d('0x5e')]('base64'))},'json':!![]});}})[_0xc76d('0x25')](function(_0x52bf73){if(_0x52bf73){var _0x5405dc=[_0xc76d('0x5f'),_0xc76d('0x60'),'agent',_0xc76d('0x61'),_0xc76d('0x19'),_0xc76d('0x62'),_0xc76d('0x63'),_0xc76d('0x64'),_0xc76d('0x65'),_0xc76d('0x63'),_0xc76d('0x66')];_[_0xc76d('0x67')](_0x52bf73,function(_0x1c4237){return _0x5405dc[_0xc76d('0x68')](_0x1c4237[_0xc76d('0x26')])||!_0x1c4237[_0xc76d('0x69')]&&_0x1c4237[_0xc76d('0x51')]!==_0xc76d('0x6a')&&_0x1c4237[_0xc76d('0x51')]!==_0xc76d('0x6b');});return{'count':_0x52bf73[_0xc76d('0x43')],'rows':_[_0xc76d('0x2d')](_0x52bf73,function(_0x1be72a){return{'id':_0x1be72a['name'],'name':_0x1be72a[_0xc76d('0x6c')],'custom':!_0x1be72a[_0xc76d('0x69')],'options':_0x1be72a[_0xc76d('0x6d')]?_[_0xc76d('0x2d')](_0x1be72a[_0xc76d('0x6d')],function(_0x15ad91){return{'name':_[_0xc76d('0x6e')](_0x15ad91),'value':_0x15ad91};}):[]};})};}})[_0xc76d('0x25')](respondWithResult(_0x35c60f,null))[_0xc76d('0x46')](function(_0x41d7cb){var _0x7210ee=_0x40afa3[_0xc76d('0x2e')][_0xc76d('0x6f')]?0x1f4:_0x41d7cb[_0xc76d('0x70')]||0x1f4;logger[_0xc76d('0x71')](_0xc76d('0x72'),_0xc76d('0x55'),_0x7210ee,JSON[_0xc76d('0x73')](_0x41d7cb));delete _0x41d7cb[_0xc76d('0x26')];if(_0x7210ee===0x191){_0x7210ee=0x190;}_0x35c60f[_0xc76d('0x19')](_0x7210ee)[_0xc76d('0x27')](_0x40afa3[_0xc76d('0x2e')][_0xc76d('0x6f')]?{'message':_0xc76d('0x74'),'statusCode':_0x41d7cb['statusCode']}:_0x41d7cb);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ff1b6f8..d628a3f 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 _0x6a7e=['api','bluebird','../../components/integrations/configuration','define','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x2b13bc,_0x45b308){var _0x48275b=function(_0x21d34a){while(--_0x21d34a){_0x2b13bc['push'](_0x2b13bc['shift']());}};_0x48275b(++_0x45b308);}(_0x6a7e,0xd5));var _0xe6a7=function(_0x14d7c9,_0x5d3e5e){_0x14d7c9=_0x14d7c9-0x0;var _0x2e9ede=_0x6a7e[_0x14d7c9];return _0x2e9ede;};'use strict';var _=require(_0xe6a7('0x0'));var util=require(_0xe6a7('0x1'));var logger=require(_0xe6a7('0x2'))(_0xe6a7('0x3'));var moment=require('moment');var BPromise=require(_0xe6a7('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('./intFreshdeskAccount.attributes');var integrations=require(_0xe6a7('0x5'));module['exports']=function(_0x10cd8d,_0x6b7ee1){return _0x10cd8d[_0xe6a7('0x6')]('FreshdeskAccount',attributes,{'tableName':_0xe6a7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46d5=['api','moment','request-promise','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x1058f7,_0x4fe464){var _0x422ecc=function(_0x496c6e){while(--_0x496c6e){_0x1058f7['push'](_0x1058f7['shift']());}};_0x422ecc(++_0x4fe464);}(_0x46d5,0x8d));var _0x546d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x46d5[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x546d('0x0'));var util=require(_0x546d('0x1'));var logger=require('../../config/logger')(_0x546d('0x2'));var moment=require(_0x546d('0x3'));var BPromise=require('bluebird');var rp=require(_0x546d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x546d('0x5'));var config=require('../../config/environment');var attributes=require(_0x546d('0x6'));var integrations=require(_0x546d('0x7'));module[_0x546d('0x8')]=function(_0x541e47,_0x3f7819){return _0x541e47['define'](_0x546d('0x9'),attributes,{'tableName':_0x546d('0xa'),'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 6b62cfe..30b20c0 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 _0x27b5=['then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','attributes','model','debug','find','ShowFreshdeskAccount','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x1f9b5e,_0x3be190){var _0x115027=function(_0x11ce45){while(--_0x11ce45){_0x1f9b5e['push'](_0x1f9b5e['shift']());}};_0x115027(++_0x3be190);}(_0x27b5,0x1a3));var _0x527b=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0x27b5[_0x3877c1];return _0x59056a;};'use strict';var _=require('lodash');var util=require(_0x527b('0x0'));var moment=require(_0x527b('0x1'));var BPromise=require(_0x527b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x527b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x527b('0x4'));var logger=require(_0x527b('0x5'))(_0x527b('0x6'));var config=require(_0x527b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x527b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x361d84,_0x394192,_0x978f74){return new BPromise(function(_0x314bff,_0x373ae9){return client[_0x527b('0x9')](_0x361d84,_0x978f74)[_0x527b('0xa')](function(_0x5d6b21){logger[_0x527b('0xb')](_0x527b('0xc'),_0x394192,_0x527b('0xd'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x394192,_0x527b('0xd'),JSON[_0x527b('0xe')](_0x5d6b21));if(_0x5d6b21[_0x527b('0xf')]){if(_0x5d6b21[_0x527b('0xf')]['code']===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x394192,_0x5d6b21[_0x527b('0xf')]['message']);return _0x373ae9(_0x5d6b21[_0x527b('0xf')]['message']);}logger[_0x527b('0xf')](_0x527b('0xc'),_0x394192,_0x5d6b21[_0x527b('0xf')][_0x527b('0x10')]);return _0x314bff(_0x5d6b21[_0x527b('0xf')][_0x527b('0x10')]);}else{logger[_0x527b('0xb')](_0x527b('0xc'),_0x394192,_0x527b('0xd'));_0x314bff(_0x5d6b21[_0x527b('0x11')]['message']);}})[_0x527b('0x12')](function(_0x1a8ef9){logger[_0x527b('0xf')](_0x527b('0xc'),_0x394192,_0x1a8ef9);_0x373ae9(_0x1a8ef9);});});}exports[_0x527b('0x13')]=function(_0x1e0957){var _0x18bbf1=this;return new Promise(function(_0x10ef0b,_0x118f9e){return db[_0x527b('0x14')][_0x527b('0x15')]({'raw':_0x1e0957[_0x527b('0x16')]?_0x1e0957[_0x527b('0x16')][_0x527b('0x17')]===undefined?!![]:![]:!![],'where':_0x1e0957['options']?_0x1e0957['options'][_0x527b('0x18')]||null:null,'attributes':_0x1e0957[_0x527b('0x16')]?_0x1e0957[_0x527b('0x16')]['attributes']||null:null,'limit':_0x1e0957[_0x527b('0x16')]?_0x1e0957[_0x527b('0x16')][_0x527b('0x19')]||null:null,'include':_0x1e0957[_0x527b('0x16')]?_0x1e0957[_0x527b('0x16')][_0x527b('0x1a')]?_[_0x527b('0x1b')](_0x1e0957[_0x527b('0x16')][_0x527b('0x1a')],function(_0x4e21b0){return{'model':db[_0x4e21b0['model']],'as':_0x4e21b0['as'],'attributes':_0x4e21b0[_0x527b('0x1c')],'include':_0x4e21b0[_0x527b('0x1a')]?_[_0x527b('0x1b')](_0x4e21b0['include'],function(_0x32fee1){return{'model':db[_0x32fee1[_0x527b('0x1d')]],'as':_0x32fee1['as'],'attributes':_0x32fee1[_0x527b('0x1c')],'include':_0x32fee1[_0x527b('0x1a')]?_[_0x527b('0x1b')](_0x32fee1[_0x527b('0x1a')],function(_0x50ecec){return{'model':db[_0x50ecec['model']],'as':_0x50ecec['as'],'attributes':_0x50ecec[_0x527b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x527b('0xa')](function(_0x4eba15){logger[_0x527b('0xb')](_0x527b('0x13'),_0x1e0957);logger[_0x527b('0x1e')](_0x527b('0x13'),_0x1e0957,JSON['stringify'](_0x4eba15));_0x10ef0b(_0x4eba15);})[_0x527b('0x12')](function(_0x163abe){logger['error'](_0x527b('0x13'),_0x163abe[_0x527b('0x10')],_0x1e0957);_0x118f9e(_0x18bbf1[_0x527b('0xf')](0x1f4,_0x163abe['message']));});});};exports['ShowFreshdeskAccount']=function(_0x59f1aa){var _0x3b7a52=this;return new Promise(function(_0x134d8c,_0x5708c4){return db['FreshdeskAccount'][_0x527b('0x1f')]({'raw':_0x59f1aa[_0x527b('0x16')]?_0x59f1aa[_0x527b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x59f1aa[_0x527b('0x16')]?_0x59f1aa[_0x527b('0x16')][_0x527b('0x18')]||null:null,'attributes':_0x59f1aa['options']?_0x59f1aa['options'][_0x527b('0x1c')]||null:null,'include':_0x59f1aa[_0x527b('0x16')]?_0x59f1aa[_0x527b('0x16')][_0x527b('0x1a')]?_['map'](_0x59f1aa['options']['include'],function(_0x1484bb){return{'model':db[_0x1484bb[_0x527b('0x1d')]],'as':_0x1484bb['as'],'attributes':_0x1484bb[_0x527b('0x1c')],'include':_0x1484bb[_0x527b('0x1a')]?_['map'](_0x1484bb[_0x527b('0x1a')],function(_0x47e62e){return{'model':db[_0x47e62e[_0x527b('0x1d')]],'as':_0x47e62e['as'],'attributes':_0x47e62e['attributes'],'include':_0x47e62e[_0x527b('0x1a')]?_[_0x527b('0x1b')](_0x47e62e[_0x527b('0x1a')],function(_0x579979){return{'model':db[_0x579979[_0x527b('0x1d')]],'as':_0x579979['as'],'attributes':_0x579979[_0x527b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x527b('0xa')](function(_0x1fa425){logger['info']('ShowFreshdeskAccount',_0x59f1aa);logger[_0x527b('0x1e')]('ShowFreshdeskAccount',_0x59f1aa,JSON[_0x527b('0xe')](_0x1fa425));_0x134d8c(_0x1fa425);})[_0x527b('0x12')](function(_0xa97b94){logger[_0x527b('0xf')](_0x527b('0x20'),_0xa97b94[_0x527b('0x10')],_0x59f1aa);_0x5708c4(_0x3b7a52['error'](0x1f4,_0xa97b94[_0x527b('0x10')]));});});}; \ No newline at end of file +var _0x5a78=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5a78,0x19b));var _0x85a7=function(_0x216ca2,_0x50830e){_0x216ca2=_0x216ca2-0x0;var _0x5693d0=_0x5a78[_0x216ca2];return _0x5693d0;};'use strict';var _=require(_0x85a7('0x0'));var util=require(_0x85a7('0x1'));var moment=require(_0x85a7('0x2'));var BPromise=require(_0x85a7('0x3'));var rs=require(_0x85a7('0x4'));var fs=require('fs');var Redis=require(_0x85a7('0x5'));var db=require(_0x85a7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x85a7('0x7'))(_0x85a7('0x8'));var config=require(_0x85a7('0x9'));var jayson=require(_0x85a7('0xa'));var client=jayson[_0x85a7('0xb')][_0x85a7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x559dc4,_0x984ed4,_0x377ccb){return new BPromise(function(_0x371901,_0x6c7207){return client[_0x85a7('0xd')](_0x559dc4,_0x377ccb)[_0x85a7('0xe')](function(_0x5eb30a){logger[_0x85a7('0xf')](_0x85a7('0x10'),_0x984ed4,_0x85a7('0x11'));logger[_0x85a7('0x12')](_0x85a7('0x13'),_0x984ed4,_0x85a7('0x11'),JSON[_0x85a7('0x14')](_0x5eb30a));if(_0x5eb30a[_0x85a7('0x15')]){if(_0x5eb30a[_0x85a7('0x15')][_0x85a7('0x16')]===0x1f4){logger[_0x85a7('0x15')](_0x85a7('0x10'),_0x984ed4,_0x5eb30a['error'][_0x85a7('0x17')]);return _0x6c7207(_0x5eb30a[_0x85a7('0x15')][_0x85a7('0x17')]);}logger[_0x85a7('0x15')](_0x85a7('0x10'),_0x984ed4,_0x5eb30a[_0x85a7('0x15')][_0x85a7('0x17')]);return _0x371901(_0x5eb30a[_0x85a7('0x15')]['message']);}else{logger[_0x85a7('0xf')](_0x85a7('0x10'),_0x984ed4,'request\x20sent');_0x371901(_0x5eb30a[_0x85a7('0x18')][_0x85a7('0x17')]);}})['catch'](function(_0xb7cb38){logger['error'](_0x85a7('0x10'),_0x984ed4,_0xb7cb38);_0x6c7207(_0xb7cb38);});});}exports[_0x85a7('0x19')]=function(_0x95e275){var _0x3ba1a5=this;return new Promise(function(_0x4c8517,_0x361ed4){return db[_0x85a7('0x1a')][_0x85a7('0x1b')]({'raw':_0x95e275[_0x85a7('0x1c')]?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x1d')]===undefined?!![]:![]:!![],'where':_0x95e275['options']?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x1e')]||null:null,'attributes':_0x95e275['options']?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x1f')]||null:null,'limit':_0x95e275['options']?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x20')]||null:null,'include':_0x95e275[_0x85a7('0x1c')]?_0x95e275[_0x85a7('0x1c')][_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x95e275['options'][_0x85a7('0x21')],function(_0x570f38){return{'model':db[_0x570f38[_0x85a7('0x23')]],'as':_0x570f38['as'],'attributes':_0x570f38[_0x85a7('0x1f')],'include':_0x570f38[_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x570f38['include'],function(_0x5423c5){return{'model':db[_0x5423c5[_0x85a7('0x23')]],'as':_0x5423c5['as'],'attributes':_0x5423c5['attributes'],'include':_0x5423c5[_0x85a7('0x21')]?_['map'](_0x5423c5['include'],function(_0x2d0003){return{'model':db[_0x2d0003['model']],'as':_0x2d0003['as'],'attributes':_0x2d0003[_0x85a7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34aae7){logger[_0x85a7('0xf')](_0x85a7('0x19'),_0x95e275);logger[_0x85a7('0x12')](_0x85a7('0x19'),_0x95e275,JSON[_0x85a7('0x14')](_0x34aae7));_0x4c8517(_0x34aae7);})[_0x85a7('0x24')](function(_0x3550b5){logger[_0x85a7('0x15')](_0x85a7('0x19'),_0x3550b5['message'],_0x95e275);_0x361ed4(_0x3ba1a5[_0x85a7('0x15')](0x1f4,_0x3550b5['message']));});});};exports[_0x85a7('0x25')]=function(_0x554175){var _0x48877e=this;return new Promise(function(_0x4030c2,_0x99be5a){return db[_0x85a7('0x1a')][_0x85a7('0x26')]({'raw':_0x554175[_0x85a7('0x1c')]?_0x554175[_0x85a7('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x554175['options']?_0x554175[_0x85a7('0x1c')][_0x85a7('0x1e')]||null:null,'attributes':_0x554175[_0x85a7('0x1c')]?_0x554175[_0x85a7('0x1c')]['attributes']||null:null,'include':_0x554175[_0x85a7('0x1c')]?_0x554175['options'][_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x554175[_0x85a7('0x1c')]['include'],function(_0x1fe1e5){return{'model':db[_0x1fe1e5[_0x85a7('0x23')]],'as':_0x1fe1e5['as'],'attributes':_0x1fe1e5[_0x85a7('0x1f')],'include':_0x1fe1e5[_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x1fe1e5['include'],function(_0x39e7ac){return{'model':db[_0x39e7ac[_0x85a7('0x23')]],'as':_0x39e7ac['as'],'attributes':_0x39e7ac['attributes'],'include':_0x39e7ac[_0x85a7('0x21')]?_[_0x85a7('0x22')](_0x39e7ac[_0x85a7('0x21')],function(_0x4b443a){return{'model':db[_0x4b443a[_0x85a7('0x23')]],'as':_0x4b443a['as'],'attributes':_0x4b443a[_0x85a7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x85a7('0xe')](function(_0x4def00){logger[_0x85a7('0xf')](_0x85a7('0x25'),_0x554175);logger[_0x85a7('0x12')](_0x85a7('0x25'),_0x554175,JSON['stringify'](_0x4def00));_0x4030c2(_0x4def00);})[_0x85a7('0x24')](function(_0x2f39b9){logger[_0x85a7('0x15')](_0x85a7('0x25'),_0x2f39b9['message'],_0x554175);_0x99be5a(_0x48877e[_0x85a7('0x15')](0x1f4,_0x2f39b9[_0x85a7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 523d37a..7779a72 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 _0xd849=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','exports','multer','util'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0xd849,0x1d9));var _0x9d84=function(_0x1d4391,_0x16b6ca){_0x1d4391=_0x1d4391-0x0;var _0x51ddfb=_0xd849[_0x1d4391];return _0x51ddfb;};'use strict';var multer=require(_0x9d84('0x0'));var util=require(_0x9d84('0x1'));var path=require(_0x9d84('0x2'));var timeout=require(_0x9d84('0x3'));var express=require(_0x9d84('0x4'));var router=express[_0x9d84('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9d84('0x6'));var interaction=require(_0x9d84('0x7'));var config=require('../../config/environment');var controller=require(_0x9d84('0x8'));router[_0x9d84('0x9')]('/',auth[_0x9d84('0xa')](),controller[_0x9d84('0xb')]);router[_0x9d84('0x9')](_0x9d84('0xc'),auth[_0x9d84('0xa')](),controller[_0x9d84('0xd')]);router[_0x9d84('0x9')]('/:id/fields',auth[_0x9d84('0xa')](),controller['getFields']);router[_0x9d84('0x9')](_0x9d84('0xe'),auth['isAuthenticated'](),controller[_0x9d84('0xf')]);router[_0x9d84('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9d84('0x10')]);router['get'](_0x9d84('0x11'),auth['isAuthenticated'](),controller[_0x9d84('0x12')]);router['post']('/',auth[_0x9d84('0xa')](),controller[_0x9d84('0x13')]);router[_0x9d84('0x14')](_0x9d84('0x11'),auth[_0x9d84('0xa')](),controller[_0x9d84('0x15')]);router[_0x9d84('0x16')](_0x9d84('0xc'),auth[_0x9d84('0xa')](),controller[_0x9d84('0x17')]);router['delete']('/:id',auth[_0x9d84('0xa')](),controller['destroy']);module[_0x9d84('0x18')]=router; \ No newline at end of file +var _0xcff3=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer'];(function(_0xad0877,_0x22837e){var _0x13f4bd=function(_0x2c7ad2){while(--_0x2c7ad2){_0xad0877['push'](_0xad0877['shift']());}};_0x13f4bd(++_0x22837e);}(_0xcff3,0xdf));var _0x3cff=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xcff3[_0x2d8d69];return _0x39ae22;};'use strict';var multer=require(_0x3cff('0x0'));var util=require(_0x3cff('0x1'));var path=require(_0x3cff('0x2'));var timeout=require(_0x3cff('0x3'));var express=require(_0x3cff('0x4'));var router=express[_0x3cff('0x5')]();var fs_extra=require(_0x3cff('0x6'));var auth=require(_0x3cff('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3cff('0x8'));var controller=require(_0x3cff('0x9'));router[_0x3cff('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3cff('0xb'),auth[_0x3cff('0xc')](),controller[_0x3cff('0xd')]);router[_0x3cff('0xa')](_0x3cff('0xe'),auth[_0x3cff('0xc')](),controller['getFields']);router[_0x3cff('0xa')](_0x3cff('0xf'),auth[_0x3cff('0xc')](),controller[_0x3cff('0x10')]);router[_0x3cff('0xa')](_0x3cff('0x11'),auth['isAuthenticated'](),controller[_0x3cff('0x12')]);router['get'](_0x3cff('0x13'),auth['isAuthenticated'](),controller[_0x3cff('0x14')]);router[_0x3cff('0x15')]('/',auth[_0x3cff('0xc')](),controller['create']);router['post'](_0x3cff('0x13'),auth[_0x3cff('0xc')](),controller[_0x3cff('0x16')]);router[_0x3cff('0x17')](_0x3cff('0xb'),auth['isAuthenticated'](),controller[_0x3cff('0x18')]);router[_0x3cff('0x19')](_0x3cff('0xb'),auth[_0x3cff('0xc')](),controller[_0x3cff('0x1a')]);module[_0x3cff('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b7b95c6..c891c05 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 _0xa0b0=['sequelize','exports','STRING'];(function(_0x4f091e,_0x7fad8d){var _0x1af6f5=function(_0x8e8605){while(--_0x8e8605){_0x4f091e['push'](_0x4f091e['shift']());}};_0x1af6f5(++_0x7fad8d);}(_0xa0b0,0x111));var _0x0a0b=function(_0x35b521,_0x141277){_0x35b521=_0x35b521-0x0;var _0x4a3fb6=_0xa0b0[_0x35b521];return _0x4a3fb6;};'use strict';var Sequelize=require(_0x0a0b('0x0'));module[_0x0a0b('0x1')]={'name':{'type':Sequelize[_0x0a0b('0x2')]},'description':{'type':Sequelize[_0x0a0b('0x2')]}}; \ No newline at end of file +var _0x0c9a=['exports','sequelize'];(function(_0x20e840,_0x301861){var _0x4a10b4=function(_0x130065){while(--_0x130065){_0x20e840['push'](_0x20e840['shift']());}};_0x4a10b4(++_0x301861);}(_0x0c9a,0x193));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa0c9('0x0'));module[_0xa0c9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 0658087..be05668 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 _0xecad=['getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','mustache','util','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/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','findOne','FreshdeskField','sort','filter'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xecad,0x1f3));var _0xdeca=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0xecad[_0xe89d97];return _0x1b6e5d;};'use strict';var emlformat=require(_0xdeca('0x0'));var rimraf=require(_0xdeca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdeca('0x2'));var moment=require(_0xdeca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdeca('0x4'));var util=require(_0xdeca('0x5'));var path=require(_0xdeca('0x6'));var sox=require(_0xdeca('0x7'));var csv=require(_0xdeca('0x8'));var ejs=require(_0xdeca('0x9'));var fs=require('fs');var fs_extra=require(_0xdeca('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdeca('0xb'));var jsforce=require(_0xdeca('0xc'));var deskjs=require(_0xdeca('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdeca('0xe'));var Papa=require(_0xdeca('0xf'));var Redis=require(_0xdeca('0x10'));var authService=require(_0xdeca('0x11'));var qs=require(_0xdeca('0x12'));var as=require(_0xdeca('0x13'));var hardwareService=require(_0xdeca('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xdeca('0x15'));var config=require(_0xdeca('0x16'));var licenseUtil=require(_0xdeca('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12eb96,_0x5cd7a5){_0x5cd7a5=_0x5cd7a5||0xcc;return function(_0x2629b9){if(_0x2629b9){return _0x12eb96['sendStatus'](_0x5cd7a5);}return _0x12eb96['status'](_0x5cd7a5)[_0xdeca('0x18')]();};}function respondWithResult(_0x444aa3,_0x4fa551){_0x4fa551=_0x4fa551||0xc8;return function(_0x5476d9){if(_0x5476d9){return _0x444aa3[_0xdeca('0x19')](_0x4fa551)[_0xdeca('0x1a')](_0x5476d9);}};}function respondWithFilteredResult(_0x269107,_0x5d587b){return function(_0x47fe37){if(_0x47fe37){var _0xeac4b7=typeof _0x5d587b[_0xdeca('0x1b')]===_0xdeca('0x1c')&&typeof _0x5d587b['limit']==='undefined';var _0x4ffc87=_0x47fe37[_0xdeca('0x1d')];var _0x1f3c63=_0xeac4b7?0x0:_0x5d587b['offset'];var _0x2b6764=_0xeac4b7?_0x47fe37[_0xdeca('0x1d')]:_0x5d587b[_0xdeca('0x1b')]+_0x5d587b['limit'];var _0x33b12b;if(_0x2b6764>=_0x4ffc87){_0x2b6764=_0x4ffc87;_0x33b12b=0xc8;}else{_0x33b12b=0xce;}_0x269107[_0xdeca('0x19')](_0x33b12b);return _0x269107['set']('Content-Range',_0x1f3c63+'-'+_0x2b6764+'/'+_0x4ffc87)[_0xdeca('0x1a')](_0x47fe37);}return null;};}function patchUpdates(_0x2f56f7){return function(_0x3d2f46){try{jsonpatch[_0xdeca('0x1e')](_0x3d2f46,_0x2f56f7,!![]);}catch(_0xd27172){return BPromise['reject'](_0xd27172);}return _0x3d2f46['save']();};}function saveUpdates(_0x3e1603,_0x575c4c){return function(_0x17d18b){if(_0x17d18b){return _0x17d18b[_0xdeca('0x1f')](_0x3e1603)[_0xdeca('0x20')](function(_0x241d34){return _0x241d34;});}return null;};}function removeEntity(_0x537335,_0x5bef36){return function(_0x409c12){if(_0x409c12){return _0x409c12[_0xdeca('0x21')]()[_0xdeca('0x20')](function(){_0x537335['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x127274,_0xb31f81){return function(_0x2f9c50){if(!_0x2f9c50){_0x127274[_0xdeca('0x22')](0x194);}return _0x2f9c50;};}function handleError(_0xbff57a,_0x8a0e0b){_0x8a0e0b=_0x8a0e0b||0x1f4;return function(_0x2051e0){logger[_0xdeca('0x23')](_0x2051e0[_0xdeca('0x24')]);if(_0x2051e0[_0xdeca('0x25')]){delete _0x2051e0['name'];}_0xbff57a[_0xdeca('0x19')](_0x8a0e0b)[_0xdeca('0x26')](_0x2051e0);};}exports[_0xdeca('0x27')]=function(_0x52e365,_0x35a3f1){var _0xdd01a7={},_0x3ad4e4={},_0x4e4ca6={'count':0x0,'rows':[]};var _0x587876=_[_0xdeca('0x28')](db[_0xdeca('0x29')][_0xdeca('0x2a')],function(_0x283018){return{'name':_0x283018['fieldName'],'type':_0x283018['type'][_0xdeca('0x2b')]};});_0x3ad4e4['model']=_[_0xdeca('0x28')](_0x587876,_0xdeca('0x25'));_0x3ad4e4[_0xdeca('0x2c')]=_[_0xdeca('0x2d')](_0x52e365['query']);_0x3ad4e4[_0xdeca('0x2e')]=_[_0xdeca('0x2f')](_0x3ad4e4['model'],_0x3ad4e4[_0xdeca('0x2c')]);_0xdd01a7['attributes']=_[_0xdeca('0x2f')](_0x3ad4e4[_0xdeca('0x30')],qs['fields'](_0x52e365[_0xdeca('0x2c')][_0xdeca('0x31')]));_0xdd01a7[_0xdeca('0x32')]=_0xdd01a7[_0xdeca('0x32')][_0xdeca('0x33')]?_0xdd01a7['attributes']:_0x3ad4e4[_0xdeca('0x30')];if(!_0x52e365['query'][_0xdeca('0x34')](_0xdeca('0x35'))){_0xdd01a7[_0xdeca('0x36')]=qs['limit'](_0x52e365[_0xdeca('0x2c')]['limit']);_0xdd01a7[_0xdeca('0x1b')]=qs[_0xdeca('0x1b')](_0x52e365['query'][_0xdeca('0x1b')]);}_0xdd01a7[_0xdeca('0x37')]=qs['sort'](_0x52e365[_0xdeca('0x2c')]['sort']);_0xdd01a7[_0xdeca('0x38')]=qs['filters'](_[_0xdeca('0x39')](_0x52e365[_0xdeca('0x2c')],_0x3ad4e4[_0xdeca('0x2e')]),_0x587876);if(_0x52e365[_0xdeca('0x2c')]['filter']){_0xdd01a7[_0xdeca('0x38')]=_[_0xdeca('0x3a')](_0xdd01a7[_0xdeca('0x38')],{'$or':_[_0xdeca('0x28')](_0x587876,function(_0x158310){if(_0x158310[_0xdeca('0x3b')]!==_0xdeca('0x3c')){var _0x2bf28b={};_0x2bf28b[_0x158310[_0xdeca('0x25')]]={'$like':'%'+_0x52e365['query']['filter']+'%'};return _0x2bf28b;}})});}_0xdd01a7=_[_0xdeca('0x3a')]({},_0xdd01a7,_0x52e365[_0xdeca('0x3d')]);var _0x4ff6ef={'where':_0xdd01a7[_0xdeca('0x38')]};return db['FreshdeskConfiguration'][_0xdeca('0x1d')](_0x4ff6ef)[_0xdeca('0x20')](function(_0x44623f){_0x4e4ca6[_0xdeca('0x1d')]=_0x44623f;if(_0x52e365[_0xdeca('0x2c')][_0xdeca('0x3e')]){_0xdd01a7[_0xdeca('0x3f')]=[{'all':!![]}];}return db[_0xdeca('0x29')][_0xdeca('0x40')](_0xdd01a7);})[_0xdeca('0x20')](function(_0x2742d6){_0x4e4ca6[_0xdeca('0x41')]=_0x2742d6;return _0x4e4ca6;})[_0xdeca('0x20')](respondWithFilteredResult(_0x35a3f1,_0xdd01a7))[_0xdeca('0x42')](handleError(_0x35a3f1,null));};exports['show']=function(_0x294746,_0x176e6f){var _0x109f37={'raw':![],'where':{'id':_0x294746[_0xdeca('0x43')]['id']}},_0x59595e={};_0x59595e['model']=_[_0xdeca('0x2d')](db['FreshdeskConfiguration'][_0xdeca('0x2a')]);_0x59595e[_0xdeca('0x2c')]=_[_0xdeca('0x2d')](_0x294746[_0xdeca('0x2c')]);_0x59595e['filters']=_[_0xdeca('0x2f')](_0x59595e[_0xdeca('0x30')],_0x59595e['query']);_0x109f37[_0xdeca('0x32')]=_[_0xdeca('0x2f')](_0x59595e[_0xdeca('0x30')],qs[_0xdeca('0x31')](_0x294746['query']['fields']));_0x109f37[_0xdeca('0x32')]=_0x109f37['attributes']['length']?_0x109f37[_0xdeca('0x32')]:_0x59595e[_0xdeca('0x30')];if(_0x294746[_0xdeca('0x2c')][_0xdeca('0x3e')]){_0x109f37[_0xdeca('0x3f')]=[{'all':!![]}];}_0x109f37=_[_0xdeca('0x3a')]({},_0x109f37,_0x294746[_0xdeca('0x3d')]);return db[_0xdeca('0x29')][_0xdeca('0x44')](_0x109f37)['then'](handleEntityNotFound(_0x176e6f,null))['then'](respondWithResult(_0x176e6f,null))[_0xdeca('0x42')](handleError(_0x176e6f,null));};exports[_0xdeca('0x45')]=function(_0x4ab0c9,_0x3ac548){return db['FreshdeskConfiguration'][_0xdeca('0x45')](_0x4ab0c9['body'],{})[_0xdeca('0x20')](respondWithResult(_0x3ac548,0xc9))[_0xdeca('0x42')](handleError(_0x3ac548,null));};exports['update']=function(_0x2bfaed,_0x3ee86b){if(_0x2bfaed[_0xdeca('0x46')]['id']){delete _0x2bfaed['body']['id'];}return db['FreshdeskConfiguration'][_0xdeca('0x44')]({'where':{'id':_0x2bfaed[_0xdeca('0x43')]['id']}})[_0xdeca('0x20')](handleEntityNotFound(_0x3ee86b,null))[_0xdeca('0x20')](saveUpdates(_0x2bfaed[_0xdeca('0x46')],null))[_0xdeca('0x20')](respondWithResult(_0x3ee86b,null))[_0xdeca('0x42')](handleError(_0x3ee86b,null));};exports[_0xdeca('0x21')]=function(_0xf75365,_0xbc21c6){return db[_0xdeca('0x29')]['find']({'where':{'id':_0xf75365['params']['id']}})[_0xdeca('0x20')](handleEntityNotFound(_0xbc21c6,null))[_0xdeca('0x20')](removeEntity(_0xbc21c6,null))[_0xdeca('0x42')](handleError(_0xbc21c6,null));};exports['getFields']=function(_0xadd951,_0x394d4d,_0x5cdd51){var _0x16167a={};var _0xdaa09={};var _0x159707;var _0x45dcae;return db['FreshdeskConfiguration'][_0xdeca('0x47')]({'where':{'id':_0xadd951['params']['id']}})['then'](handleEntityNotFound(_0x394d4d,null))[_0xdeca('0x20')](function(_0x42cda3){if(_0x42cda3){_0x159707=_0x42cda3;_0xdaa09[_0xdeca('0x30')]=_[_0xdeca('0x2d')](db[_0xdeca('0x48')][_0xdeca('0x2a')]);_0xdaa09[_0xdeca('0x2c')]=_[_0xdeca('0x2d')](_0xadd951[_0xdeca('0x2c')]);_0xdaa09[_0xdeca('0x2e')]=_[_0xdeca('0x2f')](_0xdaa09[_0xdeca('0x30')],_0xdaa09[_0xdeca('0x2c')]);_0x16167a[_0xdeca('0x32')]=_[_0xdeca('0x2f')](_0xdaa09[_0xdeca('0x30')],qs[_0xdeca('0x31')](_0xadd951['query']['fields']));_0x16167a[_0xdeca('0x32')]=_0x16167a[_0xdeca('0x32')][_0xdeca('0x33')]?_0x16167a['attributes']:_0xdaa09[_0xdeca('0x30')];_0x16167a[_0xdeca('0x37')]=qs[_0xdeca('0x49')](_0xadd951[_0xdeca('0x2c')][_0xdeca('0x49')]);_0x16167a[_0xdeca('0x38')]=qs[_0xdeca('0x2e')](_[_0xdeca('0x39')](_0xadd951['query'],_0xdaa09[_0xdeca('0x2e')]));if(_0xadd951[_0xdeca('0x2c')][_0xdeca('0x4a')]){_0x16167a[_0xdeca('0x38')]=_['merge'](_0x16167a[_0xdeca('0x38')],{'$or':_['map'](_0x16167a['attributes'],function(_0x4cc315){var _0x34509c={};_0x34509c[_0x4cc315]={'$like':'%'+_0xadd951[_0xdeca('0x2c')]['filter']+'%'};return _0x34509c;})});}_0x16167a=_[_0xdeca('0x3a')]({},_0x16167a,_0xadd951[_0xdeca('0x3d')]);return _0x159707[_0xdeca('0x4b')](_0x16167a);}})[_0xdeca('0x20')](function(_0x1d5817){if(_0x1d5817){_0x45dcae=_0x1d5817[_0xdeca('0x33')];if(!_0xadd951[_0xdeca('0x2c')][_0xdeca('0x34')](_0xdeca('0x35'))){_0x16167a[_0xdeca('0x36')]=qs[_0xdeca('0x36')](_0xadd951[_0xdeca('0x2c')][_0xdeca('0x36')]);_0x16167a[_0xdeca('0x1b')]=qs[_0xdeca('0x1b')](_0xadd951[_0xdeca('0x2c')][_0xdeca('0x1b')]);}return _0x159707[_0xdeca('0x4b')](_0x16167a);}})[_0xdeca('0x20')](function(_0x3d5646){if(_0x3d5646){return _0x3d5646?{'count':_0x45dcae,'rows':_0x3d5646}:null;}})[_0xdeca('0x20')](respondWithResult(_0x394d4d,null))[_0xdeca('0x42')](handleError(_0x394d4d,null));};exports['getSubjects']=function(_0x5cc13e,_0x42d320,_0x5ec18a){var _0x371524={};var _0xd7db7={};var _0x19fea2;var _0x1924fc;return db[_0xdeca('0x29')][_0xdeca('0x47')]({'where':{'id':_0x5cc13e[_0xdeca('0x43')]['id']}})[_0xdeca('0x20')](handleEntityNotFound(_0x42d320,null))['then'](function(_0x56ef5a){if(_0x56ef5a){_0x19fea2=_0x56ef5a;_0xd7db7['model']=_[_0xdeca('0x2d')](db[_0xdeca('0x48')]['rawAttributes']);_0xd7db7[_0xdeca('0x2c')]=_['keys'](_0x5cc13e[_0xdeca('0x2c')]);_0xd7db7[_0xdeca('0x2e')]=_['intersection'](_0xd7db7[_0xdeca('0x30')],_0xd7db7[_0xdeca('0x2c')]);_0x371524[_0xdeca('0x32')]=_[_0xdeca('0x2f')](_0xd7db7[_0xdeca('0x30')],qs[_0xdeca('0x31')](_0x5cc13e['query'][_0xdeca('0x31')]));_0x371524[_0xdeca('0x32')]=_0x371524['attributes']['length']?_0x371524['attributes']:_0xd7db7[_0xdeca('0x30')];_0x371524[_0xdeca('0x37')]=qs['sort'](_0x5cc13e['query'][_0xdeca('0x49')]);_0x371524[_0xdeca('0x38')]=qs[_0xdeca('0x2e')](_[_0xdeca('0x39')](_0x5cc13e[_0xdeca('0x2c')],_0xd7db7[_0xdeca('0x2e')]));if(_0x5cc13e[_0xdeca('0x2c')][_0xdeca('0x4a')]){_0x371524['where']=_[_0xdeca('0x3a')](_0x371524[_0xdeca('0x38')],{'$or':_[_0xdeca('0x28')](_0x371524[_0xdeca('0x32')],function(_0xb6873){var _0x20650e={};_0x20650e[_0xb6873]={'$like':'%'+_0x5cc13e[_0xdeca('0x2c')][_0xdeca('0x4a')]+'%'};return _0x20650e;})});}_0x371524=_['merge']({},_0x371524,_0x5cc13e[_0xdeca('0x3d')]);return _0x19fea2[_0xdeca('0x4c')](_0x371524);}})['then'](function(_0x97a7cc){if(_0x97a7cc){_0x1924fc=_0x97a7cc['length'];if(!_0x5cc13e[_0xdeca('0x2c')][_0xdeca('0x34')](_0xdeca('0x35'))){_0x371524[_0xdeca('0x36')]=qs['limit'](_0x5cc13e[_0xdeca('0x2c')]['limit']);_0x371524[_0xdeca('0x1b')]=qs[_0xdeca('0x1b')](_0x5cc13e[_0xdeca('0x2c')][_0xdeca('0x1b')]);}return _0x19fea2[_0xdeca('0x4c')](_0x371524);}})[_0xdeca('0x20')](function(_0x44af09){if(_0x44af09){return _0x44af09?{'count':_0x1924fc,'rows':_0x44af09}:null;}})[_0xdeca('0x20')](respondWithResult(_0x42d320,null))['catch'](handleError(_0x42d320,null));};exports['getDescriptions']=function(_0x476d01,_0x1f43bd,_0x62049e){var _0x496ee5={};var _0x610b3f={};var _0x40b211;var _0x4cf825;return db[_0xdeca('0x29')][_0xdeca('0x47')]({'where':{'id':_0x476d01[_0xdeca('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f43bd,null))['then'](function(_0x54c598){if(_0x54c598){_0x40b211=_0x54c598;_0x610b3f['model']=_[_0xdeca('0x2d')](db['FreshdeskField'][_0xdeca('0x2a')]);_0x610b3f['query']=_[_0xdeca('0x2d')](_0x476d01['query']);_0x610b3f['filters']=_[_0xdeca('0x2f')](_0x610b3f['model'],_0x610b3f[_0xdeca('0x2c')]);_0x496ee5['attributes']=_[_0xdeca('0x2f')](_0x610b3f[_0xdeca('0x30')],qs[_0xdeca('0x31')](_0x476d01[_0xdeca('0x2c')][_0xdeca('0x31')]));_0x496ee5['attributes']=_0x496ee5[_0xdeca('0x32')][_0xdeca('0x33')]?_0x496ee5['attributes']:_0x610b3f[_0xdeca('0x30')];_0x496ee5[_0xdeca('0x37')]=qs[_0xdeca('0x49')](_0x476d01[_0xdeca('0x2c')][_0xdeca('0x49')]);_0x496ee5[_0xdeca('0x38')]=qs[_0xdeca('0x2e')](_[_0xdeca('0x39')](_0x476d01[_0xdeca('0x2c')],_0x610b3f[_0xdeca('0x2e')]));if(_0x476d01[_0xdeca('0x2c')]['filter']){_0x496ee5[_0xdeca('0x38')]=_[_0xdeca('0x3a')](_0x496ee5[_0xdeca('0x38')],{'$or':_['map'](_0x496ee5[_0xdeca('0x32')],function(_0x4ea4ce){var _0x5b7e6b={};_0x5b7e6b[_0x4ea4ce]={'$like':'%'+_0x476d01[_0xdeca('0x2c')]['filter']+'%'};return _0x5b7e6b;})});}_0x496ee5=_['merge']({},_0x496ee5,_0x476d01[_0xdeca('0x3d')]);return _0x40b211['getDescriptions'](_0x496ee5);}})[_0xdeca('0x20')](function(_0x59620d){if(_0x59620d){_0x4cf825=_0x59620d['length'];if(!_0x476d01[_0xdeca('0x2c')][_0xdeca('0x34')]('nolimit')){_0x496ee5[_0xdeca('0x36')]=qs['limit'](_0x476d01[_0xdeca('0x2c')][_0xdeca('0x36')]);_0x496ee5[_0xdeca('0x1b')]=qs[_0xdeca('0x1b')](_0x476d01[_0xdeca('0x2c')][_0xdeca('0x1b')]);}return _0x40b211[_0xdeca('0x4d')](_0x496ee5);}})[_0xdeca('0x20')](function(_0x4c0e30){if(_0x4c0e30){return _0x4c0e30?{'count':_0x4cf825,'rows':_0x4c0e30}:null;}})[_0xdeca('0x20')](respondWithResult(_0x1f43bd,null))[_0xdeca('0x42')](handleError(_0x1f43bd,null));};exports['getTags']=function(_0x1b7c06,_0x562bd0,_0x105c3){var _0x41170b={};var _0x1f1976={};var _0x2c8ac5;var _0x37e634;return db['FreshdeskConfiguration'][_0xdeca('0x47')]({'where':{'id':_0x1b7c06['params']['id']}})['then'](handleEntityNotFound(_0x562bd0,null))[_0xdeca('0x20')](function(_0x1f21af){if(_0x1f21af){_0x2c8ac5=_0x1f21af;_0x1f1976['model']=_['keys'](db[_0xdeca('0x4e')][_0xdeca('0x2a')]);_0x1f1976['query']=_['keys'](_0x1b7c06[_0xdeca('0x2c')]);_0x1f1976[_0xdeca('0x2e')]=_[_0xdeca('0x2f')](_0x1f1976[_0xdeca('0x30')],_0x1f1976[_0xdeca('0x2c')]);_0x41170b[_0xdeca('0x32')]=_[_0xdeca('0x2f')](_0x1f1976['model'],qs[_0xdeca('0x31')](_0x1b7c06[_0xdeca('0x2c')][_0xdeca('0x31')]));_0x41170b[_0xdeca('0x32')]=_0x41170b[_0xdeca('0x32')]['length']?_0x41170b['attributes']:_0x1f1976['model'];_0x41170b[_0xdeca('0x37')]=qs['sort'](_0x1b7c06[_0xdeca('0x2c')][_0xdeca('0x49')]);_0x41170b[_0xdeca('0x38')]=qs[_0xdeca('0x2e')](_[_0xdeca('0x39')](_0x1b7c06[_0xdeca('0x2c')],_0x1f1976[_0xdeca('0x2e')]));if(_0x1b7c06[_0xdeca('0x2c')][_0xdeca('0x4a')]){_0x41170b[_0xdeca('0x38')]=_['merge'](_0x41170b[_0xdeca('0x38')],{'$or':_[_0xdeca('0x28')](_0x41170b[_0xdeca('0x32')],function(_0x403972){var _0x75bcd6={};_0x75bcd6[_0x403972]={'$like':'%'+_0x1b7c06['query'][_0xdeca('0x4a')]+'%'};return _0x75bcd6;})});}_0x41170b=_['merge']({},_0x41170b,_0x1b7c06[_0xdeca('0x3d')]);return _0x2c8ac5[_0xdeca('0x4f')](_0x41170b);}})[_0xdeca('0x20')](function(_0x2a7b79){if(_0x2a7b79){_0x37e634=_0x2a7b79[_0xdeca('0x33')];if(!_0x1b7c06[_0xdeca('0x2c')]['hasOwnProperty'](_0xdeca('0x35'))){_0x41170b[_0xdeca('0x36')]=qs['limit'](_0x1b7c06[_0xdeca('0x2c')][_0xdeca('0x36')]);_0x41170b[_0xdeca('0x1b')]=qs['offset'](_0x1b7c06['query'][_0xdeca('0x1b')]);}return _0x2c8ac5[_0xdeca('0x4f')](_0x41170b);}})[_0xdeca('0x20')](function(_0x5d9785){if(_0x5d9785){return _0x5d9785?{'count':_0x37e634,'rows':_0x5d9785}:null;}})['then'](respondWithResult(_0x562bd0,null))[_0xdeca('0x42')](handleError(_0x562bd0,null));};exports[_0xdeca('0x50')]=function(_0x4d11a3,_0x142d95,_0x15a92d){if(_0x4d11a3[_0xdeca('0x46')]['id']){delete _0x4d11a3[_0xdeca('0x46')]['id'];}return db[_0xdeca('0x29')][_0xdeca('0x47')]({'where':{'id':_0x4d11a3['params']['id']}})[_0xdeca('0x20')](handleEntityNotFound(_0x142d95,null))[_0xdeca('0x20')](function(_0x28f88a){if(_0x28f88a){return _0x28f88a[_0xdeca('0x50')](_0x4d11a3[_0xdeca('0x46')][_0xdeca('0x51')]||[]);}return null;})[_0xdeca('0x20')](respondWithResult(_0x142d95,null))[_0xdeca('0x42')](handleError(_0x142d95,null));}; \ No newline at end of file +var _0xe074=['index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','filter','options','FreshdeskConfiguration','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','order','getSubjects','getDescriptions','FreshdeskField','hasOwnProperty','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','apply','save','update','then','destroy','end','error','stack','name','send'];(function(_0x2078ad,_0x5daf66){var _0xdaf9a2=function(_0x4dd23b){while(--_0x4dd23b){_0x2078ad['push'](_0x2078ad['shift']());}};_0xdaf9a2(++_0x5daf66);}(_0xe074,0x124));var _0x4e07=function(_0x1516f8,_0x255054){_0x1516f8=_0x1516f8-0x0;var _0x2e3aed=_0xe074[_0x1516f8];return _0x2e3aed;};'use strict';var emlformat=require(_0x4e07('0x0'));var rimraf=require(_0x4e07('0x1'));var zipdir=require(_0x4e07('0x2'));var jsonpatch=require(_0x4e07('0x3'));var rp=require(_0x4e07('0x4'));var moment=require('moment');var BPromise=require(_0x4e07('0x5'));var Mustache=require(_0x4e07('0x6'));var util=require(_0x4e07('0x7'));var path=require(_0x4e07('0x8'));var sox=require('sox');var csv=require(_0x4e07('0x9'));var ejs=require(_0x4e07('0xa'));var fs=require('fs');var fs_extra=require(_0x4e07('0xb'));var _=require(_0x4e07('0xc'));var squel=require(_0x4e07('0xd'));var crypto=require(_0x4e07('0xe'));var jsforce=require(_0x4e07('0xf'));var deskjs=require(_0x4e07('0x10'));var toCsv=require(_0x4e07('0x9'));var querystring=require(_0x4e07('0x11'));var Papa=require(_0x4e07('0x12'));var Redis=require(_0x4e07('0x13'));var authService=require(_0x4e07('0x14'));var qs=require(_0x4e07('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4e07('0x16'));var utils=require(_0x4e07('0x17'));var config=require(_0x4e07('0x18'));var licenseUtil=require(_0x4e07('0x19'));var db=require(_0x4e07('0x1a'))['db'];function respondWithStatusCode(_0x15931d,_0x55cb4e){_0x55cb4e=_0x55cb4e||0xcc;return function(_0x31912d){if(_0x31912d){return _0x15931d[_0x4e07('0x1b')](_0x55cb4e);}return _0x15931d[_0x4e07('0x1c')](_0x55cb4e)['end']();};}function respondWithResult(_0xadfeb4,_0x18f244){_0x18f244=_0x18f244||0xc8;return function(_0x1a96e4){if(_0x1a96e4){return _0xadfeb4[_0x4e07('0x1c')](_0x18f244)[_0x4e07('0x1d')](_0x1a96e4);}};}function respondWithFilteredResult(_0x3a9f09,_0x1bb428){return function(_0x115918){if(_0x115918){var _0x4dcc09=typeof _0x1bb428['offset']===_0x4e07('0x1e')&&typeof _0x1bb428['limit']===_0x4e07('0x1e');var _0x3d147f=_0x115918['count'];var _0x19cb94=_0x4dcc09?0x0:_0x1bb428[_0x4e07('0x1f')];var _0x5c9d58=_0x4dcc09?_0x115918[_0x4e07('0x20')]:_0x1bb428['offset']+_0x1bb428[_0x4e07('0x21')];var _0x4b5035;if(_0x5c9d58>=_0x3d147f){_0x5c9d58=_0x3d147f;_0x4b5035=0xc8;}else{_0x4b5035=0xce;}_0x3a9f09[_0x4e07('0x1c')](_0x4b5035);return _0x3a9f09['set']('Content-Range',_0x19cb94+'-'+_0x5c9d58+'/'+_0x3d147f)[_0x4e07('0x1d')](_0x115918);}return null;};}function patchUpdates(_0x279bc8){return function(_0x53f5d0){try{jsonpatch[_0x4e07('0x22')](_0x53f5d0,_0x279bc8,!![]);}catch(_0x3df513){return BPromise['reject'](_0x3df513);}return _0x53f5d0[_0x4e07('0x23')]();};}function saveUpdates(_0x107741,_0x5f3831){return function(_0x473eb1){if(_0x473eb1){return _0x473eb1[_0x4e07('0x24')](_0x107741)[_0x4e07('0x25')](function(_0x246aa7){return _0x246aa7;});}return null;};}function removeEntity(_0x212fa8,_0x5b91f5){return function(_0xa2dec){if(_0xa2dec){return _0xa2dec[_0x4e07('0x26')]()['then'](function(){_0x212fa8[_0x4e07('0x1c')](0xcc)[_0x4e07('0x27')]();});}};}function handleEntityNotFound(_0x4d1d4a,_0x3a7164){return function(_0x45e307){if(!_0x45e307){_0x4d1d4a[_0x4e07('0x1b')](0x194);}return _0x45e307;};}function handleError(_0x28337b,_0x2f6c18){_0x2f6c18=_0x2f6c18||0x1f4;return function(_0x5e7100){logger[_0x4e07('0x28')](_0x5e7100[_0x4e07('0x29')]);if(_0x5e7100[_0x4e07('0x2a')]){delete _0x5e7100[_0x4e07('0x2a')];}_0x28337b['status'](_0x2f6c18)[_0x4e07('0x2b')](_0x5e7100);};}exports[_0x4e07('0x2c')]=function(_0x469141,_0x2028e3){var _0x40da84={},_0x22f740={},_0x380e6b={'count':0x0,'rows':[]};var _0x59ac82=_[_0x4e07('0x2d')](db['FreshdeskConfiguration'][_0x4e07('0x2e')],function(_0x399ccf){return{'name':_0x399ccf[_0x4e07('0x2f')],'type':_0x399ccf[_0x4e07('0x30')]['key']};});_0x22f740[_0x4e07('0x31')]=_[_0x4e07('0x2d')](_0x59ac82,'name');_0x22f740[_0x4e07('0x32')]=_[_0x4e07('0x33')](_0x469141[_0x4e07('0x32')]);_0x22f740[_0x4e07('0x34')]=_[_0x4e07('0x35')](_0x22f740[_0x4e07('0x31')],_0x22f740[_0x4e07('0x32')]);_0x40da84[_0x4e07('0x36')]=_[_0x4e07('0x35')](_0x22f740[_0x4e07('0x31')],qs[_0x4e07('0x37')](_0x469141[_0x4e07('0x32')]['fields']));_0x40da84[_0x4e07('0x36')]=_0x40da84['attributes'][_0x4e07('0x38')]?_0x40da84['attributes']:_0x22f740[_0x4e07('0x31')];if(!_0x469141['query']['hasOwnProperty'](_0x4e07('0x39'))){_0x40da84['limit']=qs[_0x4e07('0x21')](_0x469141[_0x4e07('0x32')][_0x4e07('0x21')]);_0x40da84[_0x4e07('0x1f')]=qs[_0x4e07('0x1f')](_0x469141[_0x4e07('0x32')]['offset']);}_0x40da84['order']=qs[_0x4e07('0x3a')](_0x469141[_0x4e07('0x32')][_0x4e07('0x3a')]);_0x40da84[_0x4e07('0x3b')]=qs[_0x4e07('0x34')](_[_0x4e07('0x3c')](_0x469141[_0x4e07('0x32')],_0x22f740[_0x4e07('0x34')]),_0x59ac82);if(_0x469141[_0x4e07('0x32')]['filter']){_0x40da84[_0x4e07('0x3b')]=_[_0x4e07('0x3d')](_0x40da84[_0x4e07('0x3b')],{'$or':_['map'](_0x59ac82,function(_0x3bc027){if(_0x3bc027['type']!=='VIRTUAL'){var _0x5be13f={};_0x5be13f[_0x3bc027['name']]={'$like':'%'+_0x469141['query'][_0x4e07('0x3e')]+'%'};return _0x5be13f;}})});}_0x40da84=_[_0x4e07('0x3d')]({},_0x40da84,_0x469141[_0x4e07('0x3f')]);var _0x13204b={'where':_0x40da84['where']};return db[_0x4e07('0x40')][_0x4e07('0x20')](_0x13204b)['then'](function(_0x12c25b){_0x380e6b[_0x4e07('0x20')]=_0x12c25b;if(_0x469141[_0x4e07('0x32')]['includeAll']){_0x40da84[_0x4e07('0x41')]=[{'all':!![]}];}return db[_0x4e07('0x40')][_0x4e07('0x42')](_0x40da84);})[_0x4e07('0x25')](function(_0x2d7d35){_0x380e6b[_0x4e07('0x43')]=_0x2d7d35;return _0x380e6b;})[_0x4e07('0x25')](respondWithFilteredResult(_0x2028e3,_0x40da84))[_0x4e07('0x44')](handleError(_0x2028e3,null));};exports[_0x4e07('0x45')]=function(_0xf8d9,_0x254467){var _0x43e6b7={'raw':![],'where':{'id':_0xf8d9[_0x4e07('0x46')]['id']}},_0x4360ad={};_0x4360ad[_0x4e07('0x31')]=_[_0x4e07('0x33')](db[_0x4e07('0x40')][_0x4e07('0x2e')]);_0x4360ad[_0x4e07('0x32')]=_[_0x4e07('0x33')](_0xf8d9[_0x4e07('0x32')]);_0x4360ad[_0x4e07('0x34')]=_['intersection'](_0x4360ad['model'],_0x4360ad[_0x4e07('0x32')]);_0x43e6b7[_0x4e07('0x36')]=_[_0x4e07('0x35')](_0x4360ad['model'],qs[_0x4e07('0x37')](_0xf8d9[_0x4e07('0x32')][_0x4e07('0x37')]));_0x43e6b7[_0x4e07('0x36')]=_0x43e6b7[_0x4e07('0x36')][_0x4e07('0x38')]?_0x43e6b7['attributes']:_0x4360ad['model'];if(_0xf8d9[_0x4e07('0x32')]['includeAll']){_0x43e6b7[_0x4e07('0x41')]=[{'all':!![]}];}_0x43e6b7=_[_0x4e07('0x3d')]({},_0x43e6b7,_0xf8d9[_0x4e07('0x3f')]);return db[_0x4e07('0x40')][_0x4e07('0x47')](_0x43e6b7)[_0x4e07('0x25')](handleEntityNotFound(_0x254467,null))[_0x4e07('0x25')](respondWithResult(_0x254467,null))['catch'](handleError(_0x254467,null));};exports[_0x4e07('0x48')]=function(_0x48effa,_0x5d4d45){return db[_0x4e07('0x40')][_0x4e07('0x48')](_0x48effa[_0x4e07('0x49')],{})[_0x4e07('0x25')](respondWithResult(_0x5d4d45,0xc9))[_0x4e07('0x44')](handleError(_0x5d4d45,null));};exports[_0x4e07('0x24')]=function(_0x3eb8a8,_0x3fa1fd){if(_0x3eb8a8[_0x4e07('0x49')]['id']){delete _0x3eb8a8[_0x4e07('0x49')]['id'];}return db[_0x4e07('0x40')][_0x4e07('0x47')]({'where':{'id':_0x3eb8a8['params']['id']}})[_0x4e07('0x25')](handleEntityNotFound(_0x3fa1fd,null))[_0x4e07('0x25')](saveUpdates(_0x3eb8a8[_0x4e07('0x49')],null))[_0x4e07('0x25')](respondWithResult(_0x3fa1fd,null))[_0x4e07('0x44')](handleError(_0x3fa1fd,null));};exports[_0x4e07('0x26')]=function(_0x324c41,_0x40bee6){return db['FreshdeskConfiguration'][_0x4e07('0x47')]({'where':{'id':_0x324c41[_0x4e07('0x46')]['id']}})['then'](handleEntityNotFound(_0x40bee6,null))[_0x4e07('0x25')](removeEntity(_0x40bee6,null))['catch'](handleError(_0x40bee6,null));};exports[_0x4e07('0x4a')]=function(_0x84f114,_0x26dd25,_0x4b8dd6){var _0xf3efd={};var _0x3e7cd3={};var _0x4d36d5;var _0x23a4bc;return db[_0x4e07('0x40')][_0x4e07('0x4b')]({'where':{'id':_0x84f114['params']['id']}})[_0x4e07('0x25')](handleEntityNotFound(_0x26dd25,null))[_0x4e07('0x25')](function(_0x4a5286){if(_0x4a5286){_0x4d36d5=_0x4a5286;_0x3e7cd3['model']=_[_0x4e07('0x33')](db['FreshdeskField'][_0x4e07('0x2e')]);_0x3e7cd3[_0x4e07('0x32')]=_[_0x4e07('0x33')](_0x84f114[_0x4e07('0x32')]);_0x3e7cd3[_0x4e07('0x34')]=_[_0x4e07('0x35')](_0x3e7cd3['model'],_0x3e7cd3[_0x4e07('0x32')]);_0xf3efd['attributes']=_[_0x4e07('0x35')](_0x3e7cd3[_0x4e07('0x31')],qs['fields'](_0x84f114[_0x4e07('0x32')][_0x4e07('0x37')]));_0xf3efd[_0x4e07('0x36')]=_0xf3efd[_0x4e07('0x36')][_0x4e07('0x38')]?_0xf3efd[_0x4e07('0x36')]:_0x3e7cd3['model'];_0xf3efd[_0x4e07('0x4c')]=qs[_0x4e07('0x3a')](_0x84f114[_0x4e07('0x32')][_0x4e07('0x3a')]);_0xf3efd[_0x4e07('0x3b')]=qs['filters'](_[_0x4e07('0x3c')](_0x84f114[_0x4e07('0x32')],_0x3e7cd3['filters']));if(_0x84f114[_0x4e07('0x32')][_0x4e07('0x3e')]){_0xf3efd[_0x4e07('0x3b')]=_[_0x4e07('0x3d')](_0xf3efd[_0x4e07('0x3b')],{'$or':_['map'](_0xf3efd[_0x4e07('0x36')],function(_0xb80b40){var _0x4f3e5d={};_0x4f3e5d[_0xb80b40]={'$like':'%'+_0x84f114[_0x4e07('0x32')][_0x4e07('0x3e')]+'%'};return _0x4f3e5d;})});}_0xf3efd=_[_0x4e07('0x3d')]({},_0xf3efd,_0x84f114[_0x4e07('0x3f')]);return _0x4d36d5[_0x4e07('0x4a')](_0xf3efd);}})['then'](function(_0x4cb6eb){if(_0x4cb6eb){_0x23a4bc=_0x4cb6eb['length'];if(!_0x84f114['query']['hasOwnProperty'](_0x4e07('0x39'))){_0xf3efd['limit']=qs[_0x4e07('0x21')](_0x84f114[_0x4e07('0x32')][_0x4e07('0x21')]);_0xf3efd[_0x4e07('0x1f')]=qs[_0x4e07('0x1f')](_0x84f114[_0x4e07('0x32')]['offset']);}return _0x4d36d5[_0x4e07('0x4a')](_0xf3efd);}})[_0x4e07('0x25')](function(_0x320b21){if(_0x320b21){return _0x320b21?{'count':_0x23a4bc,'rows':_0x320b21}:null;}})['then'](respondWithResult(_0x26dd25,null))[_0x4e07('0x44')](handleError(_0x26dd25,null));};exports['getSubjects']=function(_0x23ef1f,_0x48d25d,_0x4b0d2e){var _0x438be2={};var _0x3c9064={};var _0x341151;var _0x3d136c;return db[_0x4e07('0x40')]['findOne']({'where':{'id':_0x23ef1f[_0x4e07('0x46')]['id']}})[_0x4e07('0x25')](handleEntityNotFound(_0x48d25d,null))[_0x4e07('0x25')](function(_0x345929){if(_0x345929){_0x341151=_0x345929;_0x3c9064['model']=_[_0x4e07('0x33')](db['FreshdeskField'][_0x4e07('0x2e')]);_0x3c9064[_0x4e07('0x32')]=_[_0x4e07('0x33')](_0x23ef1f[_0x4e07('0x32')]);_0x3c9064[_0x4e07('0x34')]=_[_0x4e07('0x35')](_0x3c9064['model'],_0x3c9064[_0x4e07('0x32')]);_0x438be2[_0x4e07('0x36')]=_['intersection'](_0x3c9064[_0x4e07('0x31')],qs['fields'](_0x23ef1f[_0x4e07('0x32')][_0x4e07('0x37')]));_0x438be2[_0x4e07('0x36')]=_0x438be2[_0x4e07('0x36')][_0x4e07('0x38')]?_0x438be2[_0x4e07('0x36')]:_0x3c9064['model'];_0x438be2[_0x4e07('0x4c')]=qs['sort'](_0x23ef1f[_0x4e07('0x32')][_0x4e07('0x3a')]);_0x438be2['where']=qs[_0x4e07('0x34')](_[_0x4e07('0x3c')](_0x23ef1f[_0x4e07('0x32')],_0x3c9064[_0x4e07('0x34')]));if(_0x23ef1f[_0x4e07('0x32')][_0x4e07('0x3e')]){_0x438be2[_0x4e07('0x3b')]=_[_0x4e07('0x3d')](_0x438be2[_0x4e07('0x3b')],{'$or':_[_0x4e07('0x2d')](_0x438be2[_0x4e07('0x36')],function(_0x445dfe){var _0x56e67c={};_0x56e67c[_0x445dfe]={'$like':'%'+_0x23ef1f[_0x4e07('0x32')]['filter']+'%'};return _0x56e67c;})});}_0x438be2=_[_0x4e07('0x3d')]({},_0x438be2,_0x23ef1f[_0x4e07('0x3f')]);return _0x341151['getSubjects'](_0x438be2);}})[_0x4e07('0x25')](function(_0x5ff6d0){if(_0x5ff6d0){_0x3d136c=_0x5ff6d0['length'];if(!_0x23ef1f[_0x4e07('0x32')]['hasOwnProperty'](_0x4e07('0x39'))){_0x438be2['limit']=qs[_0x4e07('0x21')](_0x23ef1f[_0x4e07('0x32')][_0x4e07('0x21')]);_0x438be2[_0x4e07('0x1f')]=qs[_0x4e07('0x1f')](_0x23ef1f[_0x4e07('0x32')][_0x4e07('0x1f')]);}return _0x341151[_0x4e07('0x4d')](_0x438be2);}})[_0x4e07('0x25')](function(_0x4005f5){if(_0x4005f5){return _0x4005f5?{'count':_0x3d136c,'rows':_0x4005f5}:null;}})['then'](respondWithResult(_0x48d25d,null))['catch'](handleError(_0x48d25d,null));};exports[_0x4e07('0x4e')]=function(_0x45a760,_0x4ef630,_0x2623e7){var _0x3a1fa6={};var _0x4d92b0={};var _0x461d54;var _0x38d886;return db[_0x4e07('0x40')][_0x4e07('0x4b')]({'where':{'id':_0x45a760[_0x4e07('0x46')]['id']}})[_0x4e07('0x25')](handleEntityNotFound(_0x4ef630,null))[_0x4e07('0x25')](function(_0x220b05){if(_0x220b05){_0x461d54=_0x220b05;_0x4d92b0[_0x4e07('0x31')]=_[_0x4e07('0x33')](db[_0x4e07('0x4f')][_0x4e07('0x2e')]);_0x4d92b0['query']=_[_0x4e07('0x33')](_0x45a760[_0x4e07('0x32')]);_0x4d92b0['filters']=_[_0x4e07('0x35')](_0x4d92b0[_0x4e07('0x31')],_0x4d92b0[_0x4e07('0x32')]);_0x3a1fa6[_0x4e07('0x36')]=_[_0x4e07('0x35')](_0x4d92b0[_0x4e07('0x31')],qs[_0x4e07('0x37')](_0x45a760['query']['fields']));_0x3a1fa6[_0x4e07('0x36')]=_0x3a1fa6[_0x4e07('0x36')][_0x4e07('0x38')]?_0x3a1fa6[_0x4e07('0x36')]:_0x4d92b0[_0x4e07('0x31')];_0x3a1fa6[_0x4e07('0x4c')]=qs[_0x4e07('0x3a')](_0x45a760['query'][_0x4e07('0x3a')]);_0x3a1fa6['where']=qs[_0x4e07('0x34')](_[_0x4e07('0x3c')](_0x45a760[_0x4e07('0x32')],_0x4d92b0[_0x4e07('0x34')]));if(_0x45a760[_0x4e07('0x32')][_0x4e07('0x3e')]){_0x3a1fa6[_0x4e07('0x3b')]=_[_0x4e07('0x3d')](_0x3a1fa6[_0x4e07('0x3b')],{'$or':_['map'](_0x3a1fa6[_0x4e07('0x36')],function(_0x5a302b){var _0x5df9cf={};_0x5df9cf[_0x5a302b]={'$like':'%'+_0x45a760['query'][_0x4e07('0x3e')]+'%'};return _0x5df9cf;})});}_0x3a1fa6=_[_0x4e07('0x3d')]({},_0x3a1fa6,_0x45a760['options']);return _0x461d54[_0x4e07('0x4e')](_0x3a1fa6);}})[_0x4e07('0x25')](function(_0x16daad){if(_0x16daad){_0x38d886=_0x16daad[_0x4e07('0x38')];if(!_0x45a760['query'][_0x4e07('0x50')]('nolimit')){_0x3a1fa6[_0x4e07('0x21')]=qs['limit'](_0x45a760[_0x4e07('0x32')]['limit']);_0x3a1fa6['offset']=qs['offset'](_0x45a760[_0x4e07('0x32')][_0x4e07('0x1f')]);}return _0x461d54[_0x4e07('0x4e')](_0x3a1fa6);}})[_0x4e07('0x25')](function(_0xe25871){if(_0xe25871){return _0xe25871?{'count':_0x38d886,'rows':_0xe25871}:null;}})[_0x4e07('0x25')](respondWithResult(_0x4ef630,null))['catch'](handleError(_0x4ef630,null));};exports['getTags']=function(_0x4b59e8,_0x5ca99d,_0x354590){var _0x13a474={};var _0x3e7166={};var _0x3421fa;var _0x2c3661;return db[_0x4e07('0x40')][_0x4e07('0x4b')]({'where':{'id':_0x4b59e8[_0x4e07('0x46')]['id']}})[_0x4e07('0x25')](handleEntityNotFound(_0x5ca99d,null))['then'](function(_0xf18131){if(_0xf18131){_0x3421fa=_0xf18131;_0x3e7166[_0x4e07('0x31')]=_['keys'](db['Tag'][_0x4e07('0x2e')]);_0x3e7166[_0x4e07('0x32')]=_[_0x4e07('0x33')](_0x4b59e8[_0x4e07('0x32')]);_0x3e7166[_0x4e07('0x34')]=_[_0x4e07('0x35')](_0x3e7166[_0x4e07('0x31')],_0x3e7166[_0x4e07('0x32')]);_0x13a474['attributes']=_[_0x4e07('0x35')](_0x3e7166[_0x4e07('0x31')],qs[_0x4e07('0x37')](_0x4b59e8['query'][_0x4e07('0x37')]));_0x13a474['attributes']=_0x13a474[_0x4e07('0x36')][_0x4e07('0x38')]?_0x13a474[_0x4e07('0x36')]:_0x3e7166['model'];_0x13a474[_0x4e07('0x4c')]=qs[_0x4e07('0x3a')](_0x4b59e8[_0x4e07('0x32')]['sort']);_0x13a474[_0x4e07('0x3b')]=qs[_0x4e07('0x34')](_['pick'](_0x4b59e8[_0x4e07('0x32')],_0x3e7166['filters']));if(_0x4b59e8['query'][_0x4e07('0x3e')]){_0x13a474[_0x4e07('0x3b')]=_['merge'](_0x13a474[_0x4e07('0x3b')],{'$or':_['map'](_0x13a474['attributes'],function(_0x206972){var _0x31a54a={};_0x31a54a[_0x206972]={'$like':'%'+_0x4b59e8['query'][_0x4e07('0x3e')]+'%'};return _0x31a54a;})});}_0x13a474=_[_0x4e07('0x3d')]({},_0x13a474,_0x4b59e8[_0x4e07('0x3f')]);return _0x3421fa[_0x4e07('0x51')](_0x13a474);}})['then'](function(_0x39582a){if(_0x39582a){_0x2c3661=_0x39582a['length'];if(!_0x4b59e8[_0x4e07('0x32')][_0x4e07('0x50')](_0x4e07('0x39'))){_0x13a474[_0x4e07('0x21')]=qs[_0x4e07('0x21')](_0x4b59e8[_0x4e07('0x32')][_0x4e07('0x21')]);_0x13a474[_0x4e07('0x1f')]=qs[_0x4e07('0x1f')](_0x4b59e8['query']['offset']);}return _0x3421fa[_0x4e07('0x51')](_0x13a474);}})['then'](function(_0x2dc54a){if(_0x2dc54a){return _0x2dc54a?{'count':_0x2c3661,'rows':_0x2dc54a}:null;}})[_0x4e07('0x25')](respondWithResult(_0x5ca99d,null))[_0x4e07('0x44')](handleError(_0x5ca99d,null));};exports[_0x4e07('0x52')]=function(_0x1fdb0c,_0x118a5c,_0xb37b78){if(_0x1fdb0c[_0x4e07('0x49')]['id']){delete _0x1fdb0c[_0x4e07('0x49')]['id'];}return db[_0x4e07('0x40')][_0x4e07('0x4b')]({'where':{'id':_0x1fdb0c[_0x4e07('0x46')]['id']}})[_0x4e07('0x25')](handleEntityNotFound(_0x118a5c,null))[_0x4e07('0x25')](function(_0x4188ab){if(_0x4188ab){return _0x4188ab[_0x4e07('0x52')](_0x1fdb0c[_0x4e07('0x49')][_0x4e07('0x53')]||[]);}return null;})['then'](respondWithResult(_0x118a5c,null))[_0x4e07('0x44')](handleError(_0x118a5c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5fd648b..34d9ca6 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 _0x71c3=['path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2c183c,_0x4883bf){var _0xc66563=function(_0x2f9026){while(--_0x2f9026){_0x2c183c['push'](_0x2c183c['shift']());}};_0xc66563(++_0x4883bf);}(_0x71c3,0x1ce));var _0x371c=function(_0x249941,_0x4cb3ae){_0x249941=_0x249941-0x0;var _0x40f2a6=_0x71c3[_0x249941];return _0x40f2a6;};'use strict';var _=require(_0x371c('0x0'));var util=require(_0x371c('0x1'));var logger=require(_0x371c('0x2'))(_0x371c('0x3'));var moment=require('moment');var BPromise=require(_0x371c('0x4'));var rp=require(_0x371c('0x5'));var fs=require('fs');var path=require(_0x371c('0x6'));var rimraf=require('rimraf');var config=require(_0x371c('0x7'));var attributes=require(_0x371c('0x8'));module[_0x371c('0x9')]=function(_0x37e34d,_0x2a2234){return _0x37e34d['define'](_0x371c('0xa'),attributes,{'tableName':_0x371c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef2=['path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','bluebird','request-promise'];(function(_0x171f3e,_0x2a6be7){var _0x8a0679=function(_0x1deb47){while(--_0x1deb47){_0x171f3e['push'](_0x171f3e['shift']());}};_0x8a0679(++_0x2a6be7);}(_0x8ef2,0x70));var _0x28ef=function(_0x13ef4f,_0x268dae){_0x13ef4f=_0x13ef4f-0x0;var _0x568fa4=_0x8ef2[_0x13ef4f];return _0x568fa4;};'use strict';var _=require('lodash');var util=require(_0x28ef('0x0'));var logger=require(_0x28ef('0x1'))(_0x28ef('0x2'));var moment=require('moment');var BPromise=require(_0x28ef('0x3'));var rp=require(_0x28ef('0x4'));var fs=require('fs');var path=require(_0x28ef('0x5'));var rimraf=require(_0x28ef('0x6'));var config=require(_0x28ef('0x7'));var attributes=require(_0x28ef('0x8'));module[_0x28ef('0x9')]=function(_0x44594b,_0x5ea041){return _0x44594b[_0x28ef('0xa')](_0x28ef('0xb'),attributes,{'tableName':_0x28ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index fe5bc99..e65ec4b 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 _0xe790=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../config/logger','jayson/promise','client','http'];(function(_0x5866b7,_0x3ffc7d){var _0x510fed=function(_0x84b2e3){while(--_0x84b2e3){_0x5866b7['push'](_0x5866b7['shift']());}};_0x510fed(++_0x3ffc7d);}(_0xe790,0x127));var _0x0e79=function(_0x255a7c,_0x531eaf){_0x255a7c=_0x255a7c-0x0;var _0x2f2b2f=_0xe790[_0x255a7c];return _0x2f2b2f;};'use strict';var _=require(_0x0e79('0x0'));var util=require(_0x0e79('0x1'));var moment=require(_0x0e79('0x2'));var BPromise=require(_0x0e79('0x3'));var rs=require(_0x0e79('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e79('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0e79('0x6'));var client=jayson[_0x0e79('0x7')][_0x0e79('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c55ad,_0x23e534,_0x59657f){return new BPromise(function(_0x4d1ff0,_0x107218){return client[_0x0e79('0x9')](_0x5c55ad,_0x59657f)[_0x0e79('0xa')](function(_0x494663){logger[_0x0e79('0xb')](_0x0e79('0xc'),_0x23e534,_0x0e79('0xd'));logger[_0x0e79('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x23e534,'request\x20sent',JSON[_0x0e79('0xf')](_0x494663));if(_0x494663[_0x0e79('0x10')]){if(_0x494663['error'][_0x0e79('0x11')]===0x1f4){logger['error'](_0x0e79('0xc'),_0x23e534,_0x494663[_0x0e79('0x10')]['message']);return _0x107218(_0x494663['error']['message']);}logger['error'](_0x0e79('0xc'),_0x23e534,_0x494663[_0x0e79('0x10')]['message']);return _0x4d1ff0(_0x494663[_0x0e79('0x10')][_0x0e79('0x12')]);}else{logger[_0x0e79('0xb')](_0x0e79('0xc'),_0x23e534,_0x0e79('0xd'));_0x4d1ff0(_0x494663['result'][_0x0e79('0x12')]);}})['catch'](function(_0x4aff5a){logger[_0x0e79('0x10')](_0x0e79('0xc'),_0x23e534,_0x4aff5a);_0x107218(_0x4aff5a);});});} \ No newline at end of file +var _0x5b49=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x5b49,0x16c));var _0x95b4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x5b49[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x95b4('0x0'));var util=require(_0x95b4('0x1'));var moment=require(_0x95b4('0x2'));var BPromise=require(_0x95b4('0x3'));var rs=require(_0x95b4('0x4'));var fs=require('fs');var Redis=require(_0x95b4('0x5'));var db=require(_0x95b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x95b4('0x7'))(_0x95b4('0x8'));var config=require(_0x95b4('0x9'));var jayson=require(_0x95b4('0xa'));var client=jayson[_0x95b4('0xb')][_0x95b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31f37a,_0x5d75d8,_0x297d3b){return new BPromise(function(_0x4ce687,_0x16bd46){return client['request'](_0x31f37a,_0x297d3b)[_0x95b4('0xd')](function(_0x1293c9){logger[_0x95b4('0xe')](_0x95b4('0xf'),_0x5d75d8,_0x95b4('0x10'));logger[_0x95b4('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5d75d8,_0x95b4('0x10'),JSON[_0x95b4('0x12')](_0x1293c9));if(_0x1293c9[_0x95b4('0x13')]){if(_0x1293c9[_0x95b4('0x13')]['code']===0x1f4){logger[_0x95b4('0x13')](_0x95b4('0xf'),_0x5d75d8,_0x1293c9[_0x95b4('0x13')][_0x95b4('0x14')]);return _0x16bd46(_0x1293c9[_0x95b4('0x13')]['message']);}logger[_0x95b4('0x13')](_0x95b4('0xf'),_0x5d75d8,_0x1293c9[_0x95b4('0x13')][_0x95b4('0x14')]);return _0x4ce687(_0x1293c9[_0x95b4('0x13')][_0x95b4('0x14')]);}else{logger[_0x95b4('0xe')](_0x95b4('0xf'),_0x5d75d8,_0x95b4('0x10'));_0x4ce687(_0x1293c9[_0x95b4('0x15')][_0x95b4('0x14')]);}})[_0x95b4('0x16')](function(_0x32cda2){logger[_0x95b4('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5d75d8,_0x32cda2);_0x16bd46(_0x32cda2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9a8eb3f..d3559ce 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 _0x7055=['Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','create','multer','util','connect-timeout','express'];(function(_0x2f5259,_0x352194){var _0x898f85=function(_0x249caf){while(--_0x249caf){_0x2f5259['push'](_0x2f5259['shift']());}};_0x898f85(++_0x352194);}(_0x7055,0x6c));var _0x5705=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0x7055[_0x2136d5];return _0x3bee2e;};'use strict';var multer=require(_0x5705('0x0'));var util=require(_0x5705('0x1'));var path=require('path');var timeout=require(_0x5705('0x2'));var express=require(_0x5705('0x3'));var router=express[_0x5705('0x4')]();var fs_extra=require(_0x5705('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5705('0x6'));var config=require('../../config/environment');var controller=require(_0x5705('0x7'));router[_0x5705('0x8')]('/',auth[_0x5705('0x9')](),controller[_0x5705('0xa')]);router[_0x5705('0x8')](_0x5705('0xb'),auth[_0x5705('0x9')](),controller[_0x5705('0xc')]);router['post']('/',auth[_0x5705('0x9')](),controller[_0x5705('0xd')]);router['put'](_0x5705('0xb'),auth[_0x5705('0x9')](),controller['update']);router['delete'](_0x5705('0xb'),auth[_0x5705('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd3c3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1ebde3,_0x227a1d){var _0x585314=function(_0x20b378){while(--_0x20b378){_0x1ebde3['push'](_0x1ebde3['shift']());}};_0x585314(++_0x227a1d);}(_0xd3c3,0x1bb));var _0x3d3c=function(_0x305b11,_0x41eaff){_0x305b11=_0x305b11-0x0;var _0x2fc1e5=_0xd3c3[_0x305b11];return _0x2fc1e5;};'use strict';var multer=require(_0x3d3c('0x0'));var util=require(_0x3d3c('0x1'));var path=require(_0x3d3c('0x2'));var timeout=require(_0x3d3c('0x3'));var express=require(_0x3d3c('0x4'));var router=express['Router']();var fs_extra=require(_0x3d3c('0x5'));var auth=require(_0x3d3c('0x6'));var interaction=require(_0x3d3c('0x7'));var config=require(_0x3d3c('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x3d3c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3d3c('0x9')](_0x3d3c('0xa'),auth[_0x3d3c('0xb')](),controller['show']);router['post']('/',auth[_0x3d3c('0xb')](),controller[_0x3d3c('0xc')]);router[_0x3d3c('0xd')](_0x3d3c('0xa'),auth[_0x3d3c('0xb')](),controller['update']);router[_0x3d3c('0xe')](_0x3d3c('0xa'),auth[_0x3d3c('0xb')](),controller[_0x3d3c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a4f800e..ccb3554 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 _0x1048=['keyValue','picklist','STRING','string','sequelize','exports','ENUM','variable','customVariable'];(function(_0x5714cc,_0x42739b){var _0x3cad24=function(_0x270da3){while(--_0x270da3){_0x5714cc['push'](_0x5714cc['shift']());}};_0x3cad24(++_0x42739b);}(_0x1048,0x16c));var _0x8104=function(_0x5c1209,_0x20cf38){_0x5c1209=_0x5c1209-0x0;var _0x5c8dfa=_0x1048[_0x5c1209];return _0x5c8dfa;};'use strict';var Sequelize=require(_0x8104('0x0'));module[_0x8104('0x1')]={'type':{'type':Sequelize[_0x8104('0x2')]('string',_0x8104('0x3'),_0x8104('0x4'),_0x8104('0x5'),_0x8104('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8104('0x7')]},'keyType':{'type':Sequelize[_0x8104('0x2')](_0x8104('0x8'),'variable',_0x8104('0x4'))},'keyContent':{'type':Sequelize[_0x8104('0x7')]},'idField':{'type':Sequelize[_0x8104('0x7')]},'nameField':{'type':Sequelize[_0x8104('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8104('0x7')]}}; \ No newline at end of file +var _0xc486=['picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x27def7,_0x3f0835){var _0x581cbc=function(_0x5b8ae4){while(--_0x5b8ae4){_0x27def7['push'](_0x27def7['shift']());}};_0x581cbc(++_0x3f0835);}(_0xc486,0xd7));var _0x6c48=function(_0x5b84ff,_0x47e637){_0x5b84ff=_0x5b84ff-0x0;var _0xf145d9=_0xc486[_0x5b84ff];return _0xf145d9;};'use strict';var Sequelize=require(_0x6c48('0x0'));module[_0x6c48('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x6c48('0x2'),_0x6c48('0x3'),_0x6c48('0x4'),_0x6c48('0x5')),'defaultValue':_0x6c48('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6c48('0x7')]},'keyType':{'type':Sequelize[_0x6c48('0x8')](_0x6c48('0x6'),_0x6c48('0x2'),_0x6c48('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6c48('0x7')]},'nameField':{'type':Sequelize[_0x6c48('0x7')]},'customField':{'type':Sequelize[_0x6c48('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 258d529..2a24e44 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 _0xee5b=['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','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash'];(function(_0x5db800,_0x9c38a4){var _0x2195d9=function(_0x14ff60){while(--_0x14ff60){_0x5db800['push'](_0x5db800['shift']());}};_0x2195d9(++_0x9c38a4);}(_0xee5b,0x1f4));var _0xbee5=function(_0x18b9d1,_0x402d8c){_0x18b9d1=_0x18b9d1-0x0;var _0x36483d=_0xee5b[_0x18b9d1];return _0x36483d;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];function respondWithStatusCode(_0xcef158,_0x48f771){_0x48f771=_0x48f771||0xcc;return function(_0x14e032){if(_0x14e032){return _0xcef158['sendStatus'](_0x48f771);}return _0xcef158[_0xbee5('0x17')](_0x48f771)[_0xbee5('0x18')]();};}function respondWithResult(_0x8a268f,_0x593ecb){_0x593ecb=_0x593ecb||0xc8;return function(_0x5092f2){if(_0x5092f2){return _0x8a268f[_0xbee5('0x17')](_0x593ecb)['json'](_0x5092f2);}};}function respondWithFilteredResult(_0x40afcb,_0x5426c9){return function(_0x1a24bd){if(_0x1a24bd){var _0x141878=typeof _0x5426c9[_0xbee5('0x19')]==='undefined'&&typeof _0x5426c9[_0xbee5('0x1a')]===_0xbee5('0x1b');var _0x5a0ae5=_0x1a24bd[_0xbee5('0x1c')];var _0x538460=_0x141878?0x0:_0x5426c9[_0xbee5('0x19')];var _0x3c3f4e=_0x141878?_0x1a24bd[_0xbee5('0x1c')]:_0x5426c9[_0xbee5('0x19')]+_0x5426c9[_0xbee5('0x1a')];var _0xa50ec9;if(_0x3c3f4e>=_0x5a0ae5){_0x3c3f4e=_0x5a0ae5;_0xa50ec9=0xc8;}else{_0xa50ec9=0xce;}_0x40afcb[_0xbee5('0x17')](_0xa50ec9);return _0x40afcb[_0xbee5('0x1d')](_0xbee5('0x1e'),_0x538460+'-'+_0x3c3f4e+'/'+_0x5a0ae5)[_0xbee5('0x1f')](_0x1a24bd);}return null;};}function patchUpdates(_0x35d7d3){return function(_0x40a06){try{jsonpatch[_0xbee5('0x20')](_0x40a06,_0x35d7d3,!![]);}catch(_0x47af8e){return BPromise['reject'](_0x47af8e);}return _0x40a06[_0xbee5('0x21')]();};}function saveUpdates(_0x48bfb5,_0x205491){return function(_0x117cb3){if(_0x117cb3){return _0x117cb3[_0xbee5('0x22')](_0x48bfb5)[_0xbee5('0x23')](function(_0x3f23c5){return _0x3f23c5;});}return null;};}function removeEntity(_0xb665df,_0x359ccf){return function(_0x3cfa8d){if(_0x3cfa8d){return _0x3cfa8d[_0xbee5('0x24')]()['then'](function(){_0xb665df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x519473,_0x50d774){return function(_0x1af3de){if(!_0x1af3de){_0x519473[_0xbee5('0x25')](0x194);}return _0x1af3de;};}function handleError(_0x3b84c8,_0x28c74d){_0x28c74d=_0x28c74d||0x1f4;return function(_0x169042){logger[_0xbee5('0x26')](_0x169042[_0xbee5('0x27')]);if(_0x169042['name']){delete _0x169042[_0xbee5('0x28')];}_0x3b84c8[_0xbee5('0x17')](_0x28c74d)[_0xbee5('0x29')](_0x169042);};}exports[_0xbee5('0x2a')]=function(_0x1a8bcc,_0x5f0419){var _0x21b993={},_0x15ffb1={},_0xb7a077={'count':0x0,'rows':[]};var _0x136a00=_[_0xbee5('0x2b')](db[_0xbee5('0x2c')][_0xbee5('0x2d')],function(_0x36e8bb){return{'name':_0x36e8bb[_0xbee5('0x2e')],'type':_0x36e8bb['type'][_0xbee5('0x2f')]};});_0x15ffb1['model']=_[_0xbee5('0x2b')](_0x136a00,'name');_0x15ffb1[_0xbee5('0x30')]=_['keys'](_0x1a8bcc[_0xbee5('0x30')]);_0x15ffb1['filters']=_[_0xbee5('0x31')](_0x15ffb1[_0xbee5('0x32')],_0x15ffb1[_0xbee5('0x30')]);_0x21b993[_0xbee5('0x33')]=_['intersection'](_0x15ffb1[_0xbee5('0x32')],qs[_0xbee5('0x34')](_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x34')]));_0x21b993['attributes']=_0x21b993[_0xbee5('0x33')][_0xbee5('0x35')]?_0x21b993[_0xbee5('0x33')]:_0x15ffb1[_0xbee5('0x32')];if(!_0x1a8bcc['query'][_0xbee5('0x36')](_0xbee5('0x37'))){_0x21b993[_0xbee5('0x1a')]=qs[_0xbee5('0x1a')](_0x1a8bcc['query'][_0xbee5('0x1a')]);_0x21b993['offset']=qs[_0xbee5('0x19')](_0x1a8bcc['query']['offset']);}_0x21b993['order']=qs[_0xbee5('0x38')](_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x38')]);_0x21b993[_0xbee5('0x39')]=qs[_0xbee5('0x3a')](_[_0xbee5('0x3b')](_0x1a8bcc[_0xbee5('0x30')],_0x15ffb1[_0xbee5('0x3a')]),_0x136a00);if(_0x1a8bcc['query'][_0xbee5('0x3c')]){_0x21b993['where']=_[_0xbee5('0x3d')](_0x21b993[_0xbee5('0x39')],{'$or':_[_0xbee5('0x2b')](_0x136a00,function(_0x49d700){if(_0x49d700['type']!==_0xbee5('0x3e')){var _0x4eb1f8={};_0x4eb1f8[_0x49d700['name']]={'$like':'%'+_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x3c')]+'%'};return _0x4eb1f8;}})});}_0x21b993=_[_0xbee5('0x3d')]({},_0x21b993,_0x1a8bcc[_0xbee5('0x3f')]);var _0x5a2b14={'where':_0x21b993[_0xbee5('0x39')]};return db[_0xbee5('0x2c')][_0xbee5('0x1c')](_0x5a2b14)[_0xbee5('0x23')](function(_0xdcd148){_0xb7a077[_0xbee5('0x1c')]=_0xdcd148;if(_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x40')]){_0x21b993[_0xbee5('0x41')]=[{'all':!![]}];}return db[_0xbee5('0x2c')]['findAll'](_0x21b993);})[_0xbee5('0x23')](function(_0x371015){_0xb7a077['rows']=_0x371015;return _0xb7a077;})[_0xbee5('0x23')](respondWithFilteredResult(_0x5f0419,_0x21b993))[_0xbee5('0x42')](handleError(_0x5f0419,null));};exports[_0xbee5('0x43')]=function(_0x56e3d0,_0x4dad75){var _0x4cfe54={'raw':!![],'where':{'id':_0x56e3d0[_0xbee5('0x44')]['id']}},_0x4b4641={};_0x4b4641[_0xbee5('0x32')]=_[_0xbee5('0x45')](db[_0xbee5('0x2c')][_0xbee5('0x2d')]);_0x4b4641[_0xbee5('0x30')]=_[_0xbee5('0x45')](_0x56e3d0[_0xbee5('0x30')]);_0x4b4641[_0xbee5('0x3a')]=_['intersection'](_0x4b4641['model'],_0x4b4641[_0xbee5('0x30')]);_0x4cfe54['attributes']=_[_0xbee5('0x31')](_0x4b4641[_0xbee5('0x32')],qs['fields'](_0x56e3d0[_0xbee5('0x30')][_0xbee5('0x34')]));_0x4cfe54['attributes']=_0x4cfe54['attributes'][_0xbee5('0x35')]?_0x4cfe54[_0xbee5('0x33')]:_0x4b4641['model'];if(_0x56e3d0[_0xbee5('0x30')][_0xbee5('0x40')]){_0x4cfe54['include']=[{'all':!![]}];}_0x4cfe54=_[_0xbee5('0x3d')]({},_0x4cfe54,_0x56e3d0[_0xbee5('0x3f')]);return db[_0xbee5('0x2c')][_0xbee5('0x46')](_0x4cfe54)[_0xbee5('0x23')](handleEntityNotFound(_0x4dad75,null))[_0xbee5('0x23')](respondWithResult(_0x4dad75,null))[_0xbee5('0x42')](handleError(_0x4dad75,null));};exports['create']=function(_0xd9173,_0x34f01d){return db[_0xbee5('0x2c')][_0xbee5('0x47')](_0xd9173['body'],{})[_0xbee5('0x23')](respondWithResult(_0x34f01d,0xc9))[_0xbee5('0x42')](handleError(_0x34f01d,null));};exports[_0xbee5('0x22')]=function(_0x4aa21a,_0x44d4b1){if(_0x4aa21a[_0xbee5('0x48')]['id']){delete _0x4aa21a['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x4aa21a[_0xbee5('0x44')]['id']}})['then'](handleEntityNotFound(_0x44d4b1,null))[_0xbee5('0x23')](saveUpdates(_0x4aa21a[_0xbee5('0x48')],null))[_0xbee5('0x23')](respondWithResult(_0x44d4b1,null))[_0xbee5('0x42')](handleError(_0x44d4b1,null));};exports[_0xbee5('0x24')]=function(_0x296fc8,_0x55e654){return db[_0xbee5('0x2c')][_0xbee5('0x46')]({'where':{'id':_0x296fc8[_0xbee5('0x44')]['id']}})[_0xbee5('0x23')](handleEntityNotFound(_0x55e654,null))['then'](removeEntity(_0x55e654,null))[_0xbee5('0x42')](handleError(_0x55e654,null));}; \ No newline at end of file +var _0x9099=['to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','stack','name','index','FreshdeskField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','update','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x5cf345,_0x33ba5a){var _0x876039=function(_0x523b90){while(--_0x523b90){_0x5cf345['push'](_0x5cf345['shift']());}};_0x876039(++_0x33ba5a);}(_0x9099,0x1ac));var _0x9909=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0x9099[_0x8560d3];return _0x33b1b5;};'use strict';var emlformat=require(_0x9909('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9909('0x1'));var jsonpatch=require(_0x9909('0x2'));var rp=require(_0x9909('0x3'));var moment=require(_0x9909('0x4'));var BPromise=require(_0x9909('0x5'));var Mustache=require(_0x9909('0x6'));var util=require(_0x9909('0x7'));var path=require(_0x9909('0x8'));var sox=require(_0x9909('0x9'));var csv=require(_0x9909('0xa'));var ejs=require(_0x9909('0xb'));var fs=require('fs');var fs_extra=require(_0x9909('0xc'));var _=require(_0x9909('0xd'));var squel=require(_0x9909('0xe'));var crypto=require('crypto');var jsforce=require(_0x9909('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9909('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9909('0x11'));var as=require(_0x9909('0x12'));var hardwareService=require(_0x9909('0x13'));var logger=require('../../config/logger')(_0x9909('0x14'));var utils=require('../../config/utils');var config=require(_0x9909('0x15'));var licenseUtil=require(_0x9909('0x16'));var db=require(_0x9909('0x17'))['db'];function respondWithStatusCode(_0x3ba080,_0x1c69bb){_0x1c69bb=_0x1c69bb||0xcc;return function(_0x5cc11e){if(_0x5cc11e){return _0x3ba080[_0x9909('0x18')](_0x1c69bb);}return _0x3ba080[_0x9909('0x19')](_0x1c69bb)[_0x9909('0x1a')]();};}function respondWithResult(_0xef3295,_0x1c2668){_0x1c2668=_0x1c2668||0xc8;return function(_0x38c2e3){if(_0x38c2e3){return _0xef3295[_0x9909('0x19')](_0x1c2668)['json'](_0x38c2e3);}};}function respondWithFilteredResult(_0x33a8e3,_0x55e800){return function(_0x1f32cc){if(_0x1f32cc){var _0x5bd7e7=typeof _0x55e800[_0x9909('0x1b')]===_0x9909('0x1c')&&typeof _0x55e800[_0x9909('0x1d')]==='undefined';var _0x9a16a6=_0x1f32cc[_0x9909('0x1e')];var _0x180929=_0x5bd7e7?0x0:_0x55e800[_0x9909('0x1b')];var _0x1106e5=_0x5bd7e7?_0x1f32cc[_0x9909('0x1e')]:_0x55e800[_0x9909('0x1b')]+_0x55e800['limit'];var _0x1b038f;if(_0x1106e5>=_0x9a16a6){_0x1106e5=_0x9a16a6;_0x1b038f=0xc8;}else{_0x1b038f=0xce;}_0x33a8e3[_0x9909('0x19')](_0x1b038f);return _0x33a8e3['set'](_0x9909('0x1f'),_0x180929+'-'+_0x1106e5+'/'+_0x9a16a6)[_0x9909('0x20')](_0x1f32cc);}return null;};}function patchUpdates(_0x20c236){return function(_0x1553ae){try{jsonpatch[_0x9909('0x21')](_0x1553ae,_0x20c236,!![]);}catch(_0x222cd9){return BPromise[_0x9909('0x22')](_0x222cd9);}return _0x1553ae['save']();};}function saveUpdates(_0x112727,_0x319c31){return function(_0x4a626b){if(_0x4a626b){return _0x4a626b['update'](_0x112727)[_0x9909('0x23')](function(_0x176593){return _0x176593;});}return null;};}function removeEntity(_0xdd5088,_0x19e66b){return function(_0x2f15fa){if(_0x2f15fa){return _0x2f15fa['destroy']()['then'](function(){_0xdd5088[_0x9909('0x19')](0xcc)[_0x9909('0x1a')]();});}};}function handleEntityNotFound(_0x614308,_0x1c7ee5){return function(_0x52be17){if(!_0x52be17){_0x614308[_0x9909('0x18')](0x194);}return _0x52be17;};}function handleError(_0x2886e2,_0x28c750){_0x28c750=_0x28c750||0x1f4;return function(_0x4578a3){logger['error'](_0x4578a3[_0x9909('0x24')]);if(_0x4578a3[_0x9909('0x25')]){delete _0x4578a3[_0x9909('0x25')];}_0x2886e2[_0x9909('0x19')](_0x28c750)['send'](_0x4578a3);};}exports[_0x9909('0x26')]=function(_0x175d52,_0x277bec){var _0x315032={},_0x26267b={},_0x43f368={'count':0x0,'rows':[]};var _0x427530=_['map'](db[_0x9909('0x27')][_0x9909('0x28')],function(_0x87ac8a){return{'name':_0x87ac8a[_0x9909('0x29')],'type':_0x87ac8a[_0x9909('0x2a')]['key']};});_0x26267b[_0x9909('0x2b')]=_[_0x9909('0x2c')](_0x427530,_0x9909('0x25'));_0x26267b[_0x9909('0x2d')]=_[_0x9909('0x2e')](_0x175d52[_0x9909('0x2d')]);_0x26267b[_0x9909('0x2f')]=_[_0x9909('0x30')](_0x26267b['model'],_0x26267b['query']);_0x315032[_0x9909('0x31')]=_[_0x9909('0x30')](_0x26267b['model'],qs[_0x9909('0x32')](_0x175d52[_0x9909('0x2d')][_0x9909('0x32')]));_0x315032[_0x9909('0x31')]=_0x315032[_0x9909('0x31')][_0x9909('0x33')]?_0x315032[_0x9909('0x31')]:_0x26267b['model'];if(!_0x175d52[_0x9909('0x2d')][_0x9909('0x34')](_0x9909('0x35'))){_0x315032[_0x9909('0x1d')]=qs[_0x9909('0x1d')](_0x175d52['query'][_0x9909('0x1d')]);_0x315032[_0x9909('0x1b')]=qs['offset'](_0x175d52[_0x9909('0x2d')][_0x9909('0x1b')]);}_0x315032[_0x9909('0x36')]=qs[_0x9909('0x37')](_0x175d52[_0x9909('0x2d')][_0x9909('0x37')]);_0x315032['where']=qs[_0x9909('0x2f')](_[_0x9909('0x38')](_0x175d52[_0x9909('0x2d')],_0x26267b[_0x9909('0x2f')]),_0x427530);if(_0x175d52[_0x9909('0x2d')][_0x9909('0x39')]){_0x315032[_0x9909('0x3a')]=_[_0x9909('0x3b')](_0x315032[_0x9909('0x3a')],{'$or':_[_0x9909('0x2c')](_0x427530,function(_0x31fd11){if(_0x31fd11[_0x9909('0x2a')]!==_0x9909('0x3c')){var _0x3facb7={};_0x3facb7[_0x31fd11[_0x9909('0x25')]]={'$like':'%'+_0x175d52[_0x9909('0x2d')][_0x9909('0x39')]+'%'};return _0x3facb7;}})});}_0x315032=_[_0x9909('0x3b')]({},_0x315032,_0x175d52[_0x9909('0x3d')]);var _0x1294b4={'where':_0x315032[_0x9909('0x3a')]};return db[_0x9909('0x27')][_0x9909('0x1e')](_0x1294b4)['then'](function(_0x4cef49){_0x43f368[_0x9909('0x1e')]=_0x4cef49;if(_0x175d52['query']['includeAll']){_0x315032[_0x9909('0x3e')]=[{'all':!![]}];}return db[_0x9909('0x27')][_0x9909('0x3f')](_0x315032);})[_0x9909('0x23')](function(_0x556fad){_0x43f368[_0x9909('0x40')]=_0x556fad;return _0x43f368;})[_0x9909('0x23')](respondWithFilteredResult(_0x277bec,_0x315032))[_0x9909('0x41')](handleError(_0x277bec,null));};exports['show']=function(_0x41429d,_0x2f2a80){var _0x345ba0={'raw':!![],'where':{'id':_0x41429d[_0x9909('0x42')]['id']}},_0x4b0a4c={};_0x4b0a4c[_0x9909('0x2b')]=_[_0x9909('0x2e')](db[_0x9909('0x27')][_0x9909('0x28')]);_0x4b0a4c[_0x9909('0x2d')]=_[_0x9909('0x2e')](_0x41429d[_0x9909('0x2d')]);_0x4b0a4c['filters']=_[_0x9909('0x30')](_0x4b0a4c[_0x9909('0x2b')],_0x4b0a4c['query']);_0x345ba0[_0x9909('0x31')]=_[_0x9909('0x30')](_0x4b0a4c['model'],qs['fields'](_0x41429d[_0x9909('0x2d')][_0x9909('0x32')]));_0x345ba0[_0x9909('0x31')]=_0x345ba0[_0x9909('0x31')][_0x9909('0x33')]?_0x345ba0[_0x9909('0x31')]:_0x4b0a4c[_0x9909('0x2b')];if(_0x41429d[_0x9909('0x2d')][_0x9909('0x43')]){_0x345ba0[_0x9909('0x3e')]=[{'all':!![]}];}_0x345ba0=_['merge']({},_0x345ba0,_0x41429d[_0x9909('0x3d')]);return db[_0x9909('0x27')][_0x9909('0x44')](_0x345ba0)[_0x9909('0x23')](handleEntityNotFound(_0x2f2a80,null))['then'](respondWithResult(_0x2f2a80,null))['catch'](handleError(_0x2f2a80,null));};exports[_0x9909('0x45')]=function(_0x5addf7,_0x266957){return db[_0x9909('0x27')][_0x9909('0x45')](_0x5addf7['body'],{})[_0x9909('0x23')](respondWithResult(_0x266957,0xc9))[_0x9909('0x41')](handleError(_0x266957,null));};exports[_0x9909('0x46')]=function(_0x54152c,_0x271984){if(_0x54152c[_0x9909('0x47')]['id']){delete _0x54152c[_0x9909('0x47')]['id'];}return db[_0x9909('0x27')][_0x9909('0x44')]({'where':{'id':_0x54152c[_0x9909('0x42')]['id']}})[_0x9909('0x23')](handleEntityNotFound(_0x271984,null))['then'](saveUpdates(_0x54152c[_0x9909('0x47')],null))[_0x9909('0x23')](respondWithResult(_0x271984,null))['catch'](handleError(_0x271984,null));};exports[_0x9909('0x48')]=function(_0x240947,_0x3d105f){return db[_0x9909('0x27')][_0x9909('0x44')]({'where':{'id':_0x240947['params']['id']}})[_0x9909('0x23')](handleEntityNotFound(_0x3d105f,null))['then'](removeEntity(_0x3d105f,null))[_0x9909('0x41')](handleError(_0x3d105f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 4f3c8bc..da51648 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 _0xdc53=['rimraf','exports','define','FreshdeskField','freshdesk_unique_index','idField','lodash','util','api','moment','bluebird','path'];(function(_0x188b32,_0xdba9d4){var _0x46643a=function(_0x4f566a){while(--_0x4f566a){_0x188b32['push'](_0x188b32['shift']());}};_0x46643a(++_0xdba9d4);}(_0xdc53,0xa2));var _0x3dc5=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xdc53[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0x3dc5('0x0'));var util=require(_0x3dc5('0x1'));var logger=require('../../config/logger')(_0x3dc5('0x2'));var moment=require(_0x3dc5('0x3'));var BPromise=require(_0x3dc5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dc5('0x5'));var rimraf=require(_0x3dc5('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x3dc5('0x7')]=function(_0x251722,_0x417c22){return _0x251722[_0x3dc5('0x8')](_0x3dc5('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x3dc5('0xa'),'fields':[_0x3dc5('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa43d=['api','request-promise','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','util','../../config/logger'];(function(_0x42868d,_0x165917){var _0xd29bb1=function(_0x252969){while(--_0x252969){_0x42868d['push'](_0x42868d['shift']());}};_0xd29bb1(++_0x165917);}(_0xa43d,0x172));var _0xda43=function(_0x128241,_0x277491){_0x128241=_0x128241-0x0;var _0x27cbc5=_0xa43d[_0x128241];return _0x27cbc5;};'use strict';var _=require('lodash');var util=require(_0xda43('0x0'));var logger=require(_0xda43('0x1'))(_0xda43('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xda43('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda43('0x4'));var config=require('../../config/environment');var attributes=require(_0xda43('0x5'));module[_0xda43('0x6')]=function(_0x3f188b,_0x16a8ed){return _0x3f188b[_0xda43('0x7')](_0xda43('0x8'),attributes,{'tableName':_0xda43('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xda43('0xa'),_0xda43('0xb')],'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 6384452..ae8826e 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 _0xffef=['request','then','info','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskField,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1ae27a,_0x270e8c){var _0x3f552d=function(_0x34d6c3){while(--_0x34d6c3){_0x1ae27a['push'](_0x1ae27a['shift']());}};_0x3f552d(++_0x270e8c);}(_0xffef,0xd9));var _0xfffe=function(_0x28f816,_0x1302d6){_0x28f816=_0x28f816-0x0;var _0x486015=_0xffef[_0x28f816];return _0x486015;};'use strict';var _=require(_0xfffe('0x0'));var util=require(_0xfffe('0x1'));var moment=require(_0xfffe('0x2'));var BPromise=require(_0xfffe('0x3'));var rs=require(_0xfffe('0x4'));var fs=require('fs');var Redis=require(_0xfffe('0x5'));var db=require(_0xfffe('0x6'))['db'];var utils=require(_0xfffe('0x7'));var logger=require(_0xfffe('0x8'))(_0xfffe('0x9'));var config=require(_0xfffe('0xa'));var jayson=require(_0xfffe('0xb'));var client=jayson['client'][_0xfffe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29e291,_0x24df64,_0x5269df){return new BPromise(function(_0x41dac4,_0x1a8c46){return client[_0xfffe('0xd')](_0x29e291,_0x5269df)[_0xfffe('0xe')](function(_0x2ba7aa){logger[_0xfffe('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x24df64,_0xfffe('0x10'));logger['debug'](_0xfffe('0x11'),_0x24df64,_0xfffe('0x10'),JSON[_0xfffe('0x12')](_0x2ba7aa));if(_0x2ba7aa[_0xfffe('0x13')]){if(_0x2ba7aa[_0xfffe('0x13')]['code']===0x1f4){logger[_0xfffe('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x24df64,_0x2ba7aa[_0xfffe('0x13')][_0xfffe('0x14')]);return _0x1a8c46(_0x2ba7aa['error'][_0xfffe('0x14')]);}logger[_0xfffe('0x13')](_0xfffe('0x15'),_0x24df64,_0x2ba7aa[_0xfffe('0x13')][_0xfffe('0x14')]);return _0x41dac4(_0x2ba7aa[_0xfffe('0x13')][_0xfffe('0x14')]);}else{logger['info'](_0xfffe('0x15'),_0x24df64,_0xfffe('0x10'));_0x41dac4(_0x2ba7aa['result'][_0xfffe('0x14')]);}})[_0xfffe('0x16')](function(_0x4d300a){logger[_0xfffe('0x13')](_0xfffe('0x15'),_0x24df64,_0x4d300a);_0x1a8c46(_0x4d300a);});});} \ No newline at end of file +var _0xf61e=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x20d6cb,_0x376f38){var _0x1f9930=function(_0x253c05){while(--_0x253c05){_0x20d6cb['push'](_0x20d6cb['shift']());}};_0x1f9930(++_0x376f38);}(_0xf61e,0xe2));var _0xef61=function(_0x4d8070,_0x50bbd0){_0x4d8070=_0x4d8070-0x0;var _0x5ad65e=_0xf61e[_0x4d8070];return _0x5ad65e;};'use strict';var _=require('lodash');var util=require(_0xef61('0x0'));var moment=require('moment');var BPromise=require(_0xef61('0x1'));var rs=require(_0xef61('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef61('0x3'))['db'];var utils=require(_0xef61('0x4'));var logger=require(_0xef61('0x5'))(_0xef61('0x6'));var config=require(_0xef61('0x7'));var jayson=require(_0xef61('0x8'));var client=jayson[_0xef61('0x9')][_0xef61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58fad1,_0x152ff5,_0x3ea016){return new BPromise(function(_0x4b2f6a,_0x224c00){return client[_0xef61('0xb')](_0x58fad1,_0x3ea016)[_0xef61('0xc')](function(_0x458d14){logger[_0xef61('0xd')](_0xef61('0xe'),_0x152ff5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x152ff5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x458d14));if(_0x458d14[_0xef61('0x13')]){if(_0x458d14['error'][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x152ff5,_0x458d14[_0xef61('0x13')][_0xef61('0x15')]);return _0x224c00(_0x458d14['error']['message']);}logger[_0xef61('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x152ff5,_0x458d14[_0xef61('0x13')][_0xef61('0x15')]);return _0x4b2f6a(_0x458d14['error'][_0xef61('0x15')]);}else{logger['info'](_0xef61('0xe'),_0x152ff5,'request\x20sent');_0x4b2f6a(_0x458d14[_0xef61('0x16')]['message']);}})[_0xef61('0x17')](function(_0x3ae09e){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x152ff5,_0x3ae09e);_0x224c00(_0x3ae09e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 05f1a48..9ee7206 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 _0xc788=['getConfigurations','post','addConfiguration','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0xf32536,_0x246a47){var _0x118d9d=function(_0x1a7b18){while(--_0x1a7b18){_0xf32536['push'](_0xf32536['shift']());}};_0x118d9d(++_0x246a47);}(_0xc788,0xc4));var _0x8c78=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xc788[_0x4c445a];return _0x2f611c;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/fields',auth[_0x8c78('0x9')](),controller['getFields']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),controller['create']);router[_0x8c78('0xf')](_0x8c78('0xd'),auth['isAuthenticated'](),controller[_0x8c78('0x10')]);router['put']('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x11')]);router[_0x8c78('0x12')](_0x8c78('0xb'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x13')]);module[_0x8c78('0x14')]=router; \ No newline at end of file +var _0x5ec6=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x5ec6,0x7f));var _0x65ec=function(_0x2f7c1a,_0x5575e6){_0x2f7c1a=_0x2f7c1a-0x0;var _0x3d71dd=_0x5ec6[_0x2f7c1a];return _0x3d71dd;};'use strict';var multer=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var path=require(_0x65ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x65ec('0x3'));var router=express['Router']();var fs_extra=require(_0x65ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x65ec('0x5'));var config=require('../../config/environment');var controller=require(_0x65ec('0x6'));router['get']('/',auth[_0x65ec('0x7')](),controller[_0x65ec('0x8')]);router['get'](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller['show']);router[_0x65ec('0xa')](_0x65ec('0xb'),auth[_0x65ec('0x7')](),controller['getConfigurations']);router['get'](_0x65ec('0xc'),auth['isAuthenticated'](),controller[_0x65ec('0xd')]);router[_0x65ec('0xe')]('/',auth['isAuthenticated'](),controller[_0x65ec('0xf')]);router[_0x65ec('0xe')]('/:id/configurations',auth[_0x65ec('0x7')](),controller[_0x65ec('0x10')]);router['put'](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller[_0x65ec('0x11')]);router[_0x65ec('0x12')](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller[_0x65ec('0x13')]);module[_0x65ec('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 707dd54..2689f41 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 _0xe5af=['exports','STRING','username','remoteUri'];(function(_0x139fac,_0x313efc){var _0x31cbf7=function(_0x515f1b){while(--_0x515f1b){_0x139fac['push'](_0x139fac['shift']());}};_0x31cbf7(++_0x313efc);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2f61a5,_0x4e1710){_0x2f61a5=_0x2f61a5-0x0;var _0x33642a=_0xe5af[_0x2f61a5];return _0x33642a;};'use strict';var Sequelize=require('sequelize');module[_0xfe5a('0x0')]={'name':{'type':Sequelize[_0xfe5a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfe5a('0x1')],'unique':_0xfe5a('0x2')},'apiKey':{'type':Sequelize[_0xfe5a('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfe5a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1399=['exports','STRING','username','remoteUri','sequelize'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x1399,0x16c));var _0x9139=function(_0x87d340,_0x2a3e68){_0x87d340=_0x87d340-0x0;var _0x2588cc=_0x1399[_0x87d340];return _0x2588cc;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'apiKey':{'type':Sequelize[_0x9139('0x2')]},'remoteUri':{'type':Sequelize[_0x9139('0x2')],'unique':_0x9139('0x4')},'serverUrl':{'type':Sequelize[_0x9139('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 0dfd059..e1e2d3f 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 _0xf8f4=['intersection','find','catch','create','body','getConfigurations','FreshsalesConfiguration','order','pick','options','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','apiKey','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','FreshsalesAccount','includeAll','include','findAll','rows','show','params'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0xf8f4,0x1e9));var _0x4f8f=function(_0xbe48c2,_0x3db103){_0xbe48c2=_0xbe48c2-0x0;var _0x39a679=_0xf8f4[_0xbe48c2];return _0x39a679;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f8f('0x0'));var zipdir=require(_0x4f8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f8f('0x2'));var moment=require(_0x4f8f('0x3'));var BPromise=require(_0x4f8f('0x4'));var Mustache=require(_0x4f8f('0x5'));var util=require(_0x4f8f('0x6'));var path=require(_0x4f8f('0x7'));var sox=require(_0x4f8f('0x8'));var csv=require(_0x4f8f('0x9'));var ejs=require(_0x4f8f('0xa'));var fs=require('fs');var fs_extra=require(_0x4f8f('0xb'));var _=require(_0x4f8f('0xc'));var squel=require(_0x4f8f('0xd'));var crypto=require(_0x4f8f('0xe'));var jsforce=require(_0x4f8f('0xf'));var deskjs=require(_0x4f8f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4f8f('0x11'));var Papa=require(_0x4f8f('0x12'));var Redis=require(_0x4f8f('0x13'));var authService=require(_0x4f8f('0x14'));var qs=require(_0x4f8f('0x15'));var as=require(_0x4f8f('0x16'));var hardwareService=require(_0x4f8f('0x17'));var logger=require(_0x4f8f('0x18'))(_0x4f8f('0x19'));var utils=require(_0x4f8f('0x1a'));var config=require(_0x4f8f('0x1b'));var licenseUtil=require(_0x4f8f('0x1c'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4f8f('0x1d'));function respondWithStatusCode(_0x5cbd54,_0x22e088){_0x22e088=_0x22e088||0xcc;return function(_0x17f8b7){if(_0x17f8b7){return _0x5cbd54[_0x4f8f('0x1e')](_0x22e088);}return _0x5cbd54[_0x4f8f('0x1f')](_0x22e088)[_0x4f8f('0x20')]();};}function respondWithResult(_0x2c6dd5,_0x40aa46){_0x40aa46=_0x40aa46||0xc8;return function(_0x76a202){if(_0x76a202){return _0x2c6dd5[_0x4f8f('0x1f')](_0x40aa46)[_0x4f8f('0x21')](_0x76a202);}};}function respondWithFilteredResult(_0x56a531,_0x4adcf7){return function(_0x4dbc34){if(_0x4dbc34){var _0x3ba010=typeof _0x4adcf7[_0x4f8f('0x22')]==='undefined'&&typeof _0x4adcf7[_0x4f8f('0x23')]===_0x4f8f('0x24');var _0x32a7b5=_0x4dbc34['count'];var _0x546465=_0x3ba010?0x0:_0x4adcf7[_0x4f8f('0x22')];var _0x57bb54=_0x3ba010?_0x4dbc34[_0x4f8f('0x25')]:_0x4adcf7['offset']+_0x4adcf7[_0x4f8f('0x23')];var _0x5d80e0;if(_0x57bb54>=_0x32a7b5){_0x57bb54=_0x32a7b5;_0x5d80e0=0xc8;}else{_0x5d80e0=0xce;}_0x56a531[_0x4f8f('0x1f')](_0x5d80e0);return _0x56a531[_0x4f8f('0x26')](_0x4f8f('0x27'),_0x546465+'-'+_0x57bb54+'/'+_0x32a7b5)[_0x4f8f('0x21')](_0x4dbc34);}return null;};}function patchUpdates(_0x1f13ab){return function(_0x45eee9){try{jsonpatch[_0x4f8f('0x28')](_0x45eee9,_0x1f13ab,!![]);}catch(_0x282959){return BPromise[_0x4f8f('0x29')](_0x282959);}return _0x45eee9[_0x4f8f('0x2a')]();};}function saveUpdates(_0x57e200,_0x30fc47){return function(_0x374cd1){if(_0x374cd1){return _0x374cd1[_0x4f8f('0x2b')](_0x57e200)[_0x4f8f('0x2c')](function(_0x50a03d){return _0x50a03d;});}return null;};}function removeEntity(_0x54e033,_0x4e7142){return function(_0x43fbb2){if(_0x43fbb2){return _0x43fbb2[_0x4f8f('0x2d')]()[_0x4f8f('0x2c')](function(){_0x54e033[_0x4f8f('0x1f')](0xcc)[_0x4f8f('0x20')]();});}};}function handleEntityNotFound(_0x548a2e,_0x2d654f){return function(_0x110baa){if(!_0x110baa){_0x548a2e[_0x4f8f('0x1e')](0x194);}return _0x110baa;};}function handleError(_0x4931f5,_0x5f0af6){_0x5f0af6=_0x5f0af6||0x1f4;return function(_0x1b72f8){logger['error'](_0x1b72f8[_0x4f8f('0x2e')]);if(_0x1b72f8[_0x4f8f('0x2f')]){delete _0x1b72f8[_0x4f8f('0x2f')];}_0x4931f5[_0x4f8f('0x1f')](_0x5f0af6)[_0x4f8f('0x30')](_0x1b72f8);};}exports[_0x4f8f('0x31')]=function(_0x4e43d3,_0x3392fa){var _0x5abbf0={},_0x1d5cc9={},_0x3ad7b5={'count':0x0,'rows':[]};var _0x3f48e7=_[_0x4f8f('0x32')](db['FreshsalesAccount'][_0x4f8f('0x33')],function(_0x1bc246){return{'name':_0x1bc246[_0x4f8f('0x34')],'type':_0x1bc246[_0x4f8f('0x35')][_0x4f8f('0x36')]};});_0x1d5cc9[_0x4f8f('0x37')]=_['map'](_0x3f48e7,_0x4f8f('0x2f'));_0x1d5cc9[_0x4f8f('0x38')]=_[_0x4f8f('0x39')](_0x4e43d3[_0x4f8f('0x38')]);_0x1d5cc9[_0x4f8f('0x3a')]=_['intersection'](_0x1d5cc9[_0x4f8f('0x37')],_0x1d5cc9[_0x4f8f('0x38')]);_0x5abbf0[_0x4f8f('0x3b')]=_['intersection'](_0x1d5cc9[_0x4f8f('0x37')],qs['fields'](_0x4e43d3[_0x4f8f('0x38')][_0x4f8f('0x3c')]));_0x5abbf0[_0x4f8f('0x3b')]=_0x5abbf0[_0x4f8f('0x3b')][_0x4f8f('0x3d')]?_0x5abbf0['attributes']:_0x1d5cc9[_0x4f8f('0x37')];if(!_0x4e43d3['query'][_0x4f8f('0x3e')](_0x4f8f('0x3f'))){_0x5abbf0['limit']=qs[_0x4f8f('0x23')](_0x4e43d3[_0x4f8f('0x38')]['limit']);_0x5abbf0[_0x4f8f('0x22')]=qs['offset'](_0x4e43d3['query'][_0x4f8f('0x22')]);}_0x5abbf0['order']=qs[_0x4f8f('0x40')](_0x4e43d3[_0x4f8f('0x38')][_0x4f8f('0x40')]);_0x5abbf0['where']=qs[_0x4f8f('0x3a')](_['pick'](_0x4e43d3[_0x4f8f('0x38')],_0x1d5cc9[_0x4f8f('0x3a')]),_0x3f48e7);if(_0x4e43d3[_0x4f8f('0x38')][_0x4f8f('0x41')]){_0x5abbf0['where']=_[_0x4f8f('0x42')](_0x5abbf0[_0x4f8f('0x43')],{'$or':_['map'](_0x3f48e7,function(_0x5dd3f2){if(_0x5dd3f2[_0x4f8f('0x35')]!==_0x4f8f('0x44')){var _0x5ea0d2={};_0x5ea0d2[_0x5dd3f2[_0x4f8f('0x2f')]]={'$like':'%'+_0x4e43d3[_0x4f8f('0x38')]['filter']+'%'};return _0x5ea0d2;}})});}_0x5abbf0=_['merge']({},_0x5abbf0,_0x4e43d3['options']);var _0x417bd2={'where':_0x5abbf0[_0x4f8f('0x43')]};return db[_0x4f8f('0x45')][_0x4f8f('0x25')](_0x417bd2)[_0x4f8f('0x2c')](function(_0x26e2e9){_0x3ad7b5[_0x4f8f('0x25')]=_0x26e2e9;if(_0x4e43d3['query'][_0x4f8f('0x46')]){_0x5abbf0[_0x4f8f('0x47')]=[{'all':!![]}];}return db[_0x4f8f('0x45')][_0x4f8f('0x48')](_0x5abbf0);})['then'](function(_0x1c7f9d){_0x3ad7b5[_0x4f8f('0x49')]=_0x1c7f9d;return _0x3ad7b5;})[_0x4f8f('0x2c')](respondWithFilteredResult(_0x3392fa,_0x5abbf0))['catch'](handleError(_0x3392fa,null));};exports[_0x4f8f('0x4a')]=function(_0x1eb98a,_0x2ab86a){var _0xa01d90={'raw':![],'where':{'id':_0x1eb98a[_0x4f8f('0x4b')]['id']}},_0x2672db={};_0x2672db[_0x4f8f('0x37')]=_[_0x4f8f('0x39')](db[_0x4f8f('0x45')]['rawAttributes']);_0x2672db[_0x4f8f('0x38')]=_[_0x4f8f('0x39')](_0x1eb98a['query']);_0x2672db['filters']=_[_0x4f8f('0x4c')](_0x2672db[_0x4f8f('0x37')],_0x2672db[_0x4f8f('0x38')]);_0xa01d90['attributes']=_[_0x4f8f('0x4c')](_0x2672db['model'],qs[_0x4f8f('0x3c')](_0x1eb98a['query'][_0x4f8f('0x3c')]));_0xa01d90[_0x4f8f('0x3b')]=_0xa01d90[_0x4f8f('0x3b')][_0x4f8f('0x3d')]?_0xa01d90[_0x4f8f('0x3b')]:_0x2672db[_0x4f8f('0x37')];if(_0x1eb98a[_0x4f8f('0x38')][_0x4f8f('0x46')]){_0xa01d90[_0x4f8f('0x47')]=[{'all':!![]}];}_0xa01d90=_[_0x4f8f('0x42')]({},_0xa01d90,_0x1eb98a['options']);return db[_0x4f8f('0x45')][_0x4f8f('0x4d')](_0xa01d90)[_0x4f8f('0x2c')](handleEntityNotFound(_0x2ab86a,null))['then'](respondWithResult(_0x2ab86a,null))[_0x4f8f('0x4e')](handleError(_0x2ab86a,null));};exports[_0x4f8f('0x4f')]=function(_0x59bec7,_0x3226cc){return db['FreshsalesAccount'][_0x4f8f('0x4f')](_0x59bec7['body'],{})[_0x4f8f('0x2c')](respondWithResult(_0x3226cc,0xc9))[_0x4f8f('0x4e')](handleError(_0x3226cc,null));};exports['update']=function(_0xc89dcc,_0x2c91ec){if(_0xc89dcc['body']['id']){delete _0xc89dcc[_0x4f8f('0x50')]['id'];}return db['FreshsalesAccount'][_0x4f8f('0x4d')]({'where':{'id':_0xc89dcc[_0x4f8f('0x4b')]['id']}})[_0x4f8f('0x2c')](handleEntityNotFound(_0x2c91ec,null))['then'](saveUpdates(_0xc89dcc[_0x4f8f('0x50')],null))[_0x4f8f('0x2c')](respondWithResult(_0x2c91ec,null))['catch'](handleError(_0x2c91ec,null));};exports[_0x4f8f('0x2d')]=function(_0x1cc054,_0x453ae4){return db['FreshsalesAccount'][_0x4f8f('0x4d')]({'where':{'id':_0x1cc054[_0x4f8f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x453ae4,null))['then'](removeEntity(_0x453ae4,null))[_0x4f8f('0x4e')](handleError(_0x453ae4,null));};exports[_0x4f8f('0x51')]=function(_0x11d0eb,_0x1ecd05,_0x3f001c){var _0x1b9aa6={};var _0x90ae1={};var _0x18b8c9;var _0x35d25a;return db[_0x4f8f('0x45')]['findOne']({'where':{'id':_0x11d0eb[_0x4f8f('0x4b')]['id']}})[_0x4f8f('0x2c')](handleEntityNotFound(_0x1ecd05,null))['then'](function(_0x1e30a8){if(_0x1e30a8){_0x18b8c9=_0x1e30a8;_0x90ae1[_0x4f8f('0x37')]=_[_0x4f8f('0x39')](db[_0x4f8f('0x52')][_0x4f8f('0x33')]);_0x90ae1[_0x4f8f('0x38')]=_[_0x4f8f('0x39')](_0x11d0eb[_0x4f8f('0x38')]);_0x90ae1[_0x4f8f('0x3a')]=_[_0x4f8f('0x4c')](_0x90ae1[_0x4f8f('0x37')],_0x90ae1[_0x4f8f('0x38')]);_0x1b9aa6['attributes']=_['intersection'](_0x90ae1[_0x4f8f('0x37')],qs[_0x4f8f('0x3c')](_0x11d0eb['query'][_0x4f8f('0x3c')]));_0x1b9aa6[_0x4f8f('0x3b')]=_0x1b9aa6[_0x4f8f('0x3b')][_0x4f8f('0x3d')]?_0x1b9aa6[_0x4f8f('0x3b')]:_0x90ae1[_0x4f8f('0x37')];_0x1b9aa6[_0x4f8f('0x53')]=qs[_0x4f8f('0x40')](_0x11d0eb[_0x4f8f('0x38')]['sort']);_0x1b9aa6['where']=qs[_0x4f8f('0x3a')](_[_0x4f8f('0x54')](_0x11d0eb['query'],_0x90ae1['filters']));if(_0x11d0eb[_0x4f8f('0x38')][_0x4f8f('0x41')]){_0x1b9aa6[_0x4f8f('0x43')]=_[_0x4f8f('0x42')](_0x1b9aa6['where'],{'$or':_[_0x4f8f('0x32')](_0x1b9aa6[_0x4f8f('0x3b')],function(_0x4baf8b){var _0x14f08e={};_0x14f08e[_0x4baf8b]={'$like':'%'+_0x11d0eb[_0x4f8f('0x38')][_0x4f8f('0x41')]+'%'};return _0x14f08e;})});}_0x1b9aa6=_[_0x4f8f('0x42')]({},_0x1b9aa6,_0x11d0eb[_0x4f8f('0x55')]);return _0x18b8c9[_0x4f8f('0x51')](_0x1b9aa6);}})['then'](function(_0x3ab707){if(_0x3ab707){_0x35d25a=_0x3ab707[_0x4f8f('0x3d')];if(!_0x11d0eb['query'][_0x4f8f('0x3e')]('nolimit')){_0x1b9aa6[_0x4f8f('0x23')]=qs[_0x4f8f('0x23')](_0x11d0eb[_0x4f8f('0x38')]['limit']);_0x1b9aa6[_0x4f8f('0x22')]=qs[_0x4f8f('0x22')](_0x11d0eb[_0x4f8f('0x38')][_0x4f8f('0x22')]);}return _0x18b8c9[_0x4f8f('0x51')](_0x1b9aa6);}})[_0x4f8f('0x2c')](function(_0x39950d){if(_0x39950d){return _0x39950d?{'count':_0x35d25a,'rows':_0x39950d}:null;}})[_0x4f8f('0x2c')](respondWithResult(_0x1ecd05,null))[_0x4f8f('0x4e')](handleError(_0x1ecd05,null));};exports[_0x4f8f('0x56')]=function(_0x437760,_0x2b34dc,_0x348eb5){if(_0x437760[_0x4f8f('0x50')]['id']){delete _0x437760[_0x4f8f('0x50')]['id'];}return db[_0x4f8f('0x45')][_0x4f8f('0x57')]({'where':{'id':_0x437760[_0x4f8f('0x4b')]['id']}})[_0x4f8f('0x2c')](handleEntityNotFound(_0x2b34dc,null))[_0x4f8f('0x2c')](function(_0x427536){if(_0x427536){_0x437760[_0x4f8f('0x50')][_0x4f8f('0x58')]=_0x427536['id'];_0x437760[_0x4f8f('0x50')][_0x4f8f('0x59')]=integrations['getSubjects'](_0x437760[_0x4f8f('0x50')][_0x4f8f('0x5a')],_0x437760[_0x4f8f('0x50')][_0x4f8f('0x35')]);_0x437760['body'][_0x4f8f('0x5b')]=integrations[_0x4f8f('0x5c')](_0x437760['body'][_0x4f8f('0x5a')],_0x437760[_0x4f8f('0x50')][_0x4f8f('0x35')]);return db[_0x4f8f('0x52')]['create'](_0x437760[_0x4f8f('0x50')],{'include':[{'model':db[_0x4f8f('0x5d')],'as':_0x4f8f('0x59')},{'model':db['FreshsalesField'],'as':_0x4f8f('0x5b')}]});}return null;})[_0x4f8f('0x2c')](respondWithResult(_0x2b34dc,null))[_0x4f8f('0x4e')](handleError(_0x2b34dc,null));};exports['getFields']=function(_0x2f366f,_0x2b1bd2,_0x1bf446){var _0x5752a5='';var _0x5a5129='';return db['FreshsalesAccount'][_0x4f8f('0x57')]({'where':{'id':_0x2f366f[_0x4f8f('0x4b')]['id']},'attributes':['id','username','remoteUri',_0x4f8f('0x5e')]})[_0x4f8f('0x2c')](handleEntityNotFound(_0x2b1bd2,null))['then'](function(_0x41675d){if(_0x41675d){_0x5a5129=_0x41675d[_0x4f8f('0x5f')];_0x5752a5=_0x41675d['remoteUri'];var _0x4db22c=_0x41675d[_0x4f8f('0x60')][_0x4f8f('0x61')](-0x1);if(_0x4db22c==='/'){_0x5752a5=_0x5752a5[_0x4f8f('0x62')](0x0,_0x5752a5[_0x4f8f('0x63')](_0x4db22c));}return rp({'method':'GET','uri':util[_0x4f8f('0x64')](_0x4f8f('0x65'),_0x5752a5,_0x4f8f('0x66')),'headers':{'Authorization':_0x4f8f('0x67')+_0x41675d[_0x4f8f('0x5e')]},'json':!![]});}})[_0x4f8f('0x2c')](function(_0x415a8c){if(_0x415a8c){var _0x46b66d=_0x415a8c[_0x4f8f('0x68')];var _0x476686=![];var _0x68cd18=null;for(_0x68cd18=0x0;_0x68cd18<_0x46b66d['length'];_0x68cd18++){if(_0x46b66d[_0x68cd18][_0x4f8f('0x69')]===_0x5a5129){_0x476686=!![];}}if(_0x476686){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4f8f('0x6a')});}}})[_0x4f8f('0x2c')](respondWithResult(_0x2b1bd2,null))['catch'](function(_0x53d411){var _0x437ebc=_0x2f366f[_0x4f8f('0x38')][_0x4f8f('0x6b')]?0x1f4:_0x53d411['statusCode']||0x1f4;logger[_0x4f8f('0x6c')](_0x4f8f('0x6d'),'getFields',_0x437ebc,JSON[_0x4f8f('0x6e')](_0x53d411));delete _0x53d411['name'];if(_0x437ebc===0x191){_0x437ebc=0x190;}_0x2b1bd2[_0x4f8f('0x1f')](_0x437ebc)[_0x4f8f('0x30')](_0x2f366f['query'][_0x4f8f('0x6b')]?{'message':_0x4f8f('0x6f'),'statusCode':_0x53d411[_0x4f8f('0x70')]}:_0x53d411);});}; \ No newline at end of file +var _0xc549=['stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesAccount','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','intersection','catch','body','find','getConfigurations','findOne','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','create','FreshsalesField','remoteUri','username','substring','lastIndexOf','format','%s%s','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xc549,0x66));var _0x9c54=function(_0x3f79e6,_0x5f162e){_0x3f79e6=_0x3f79e6-0x0;var _0x317f51=_0xc549[_0x3f79e6];return _0x317f51;};'use strict';var emlformat=require(_0x9c54('0x0'));var rimraf=require(_0x9c54('0x1'));var zipdir=require(_0x9c54('0x2'));var jsonpatch=require(_0x9c54('0x3'));var rp=require(_0x9c54('0x4'));var moment=require('moment');var BPromise=require(_0x9c54('0x5'));var Mustache=require(_0x9c54('0x6'));var util=require('util');var path=require(_0x9c54('0x7'));var sox=require(_0x9c54('0x8'));var csv=require(_0x9c54('0x9'));var ejs=require(_0x9c54('0xa'));var fs=require('fs');var fs_extra=require(_0x9c54('0xb'));var _=require(_0x9c54('0xc'));var squel=require(_0x9c54('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9c54('0x9'));var querystring=require(_0x9c54('0xe'));var Papa=require(_0x9c54('0xf'));var Redis=require(_0x9c54('0x10'));var authService=require(_0x9c54('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9c54('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c54('0x13'))(_0x9c54('0x14'));var utils=require(_0x9c54('0x15'));var config=require(_0x9c54('0x16'));var licenseUtil=require(_0x9c54('0x17'));var db=require(_0x9c54('0x18'))['db'];var integrations=require(_0x9c54('0x19'));function respondWithStatusCode(_0x31f078,_0x1db881){_0x1db881=_0x1db881||0xcc;return function(_0x3402f2){if(_0x3402f2){return _0x31f078[_0x9c54('0x1a')](_0x1db881);}return _0x31f078[_0x9c54('0x1b')](_0x1db881)[_0x9c54('0x1c')]();};}function respondWithResult(_0x41ddaa,_0x1001c4){_0x1001c4=_0x1001c4||0xc8;return function(_0x4e29db){if(_0x4e29db){return _0x41ddaa[_0x9c54('0x1b')](_0x1001c4)[_0x9c54('0x1d')](_0x4e29db);}};}function respondWithFilteredResult(_0x4fcecb,_0x4c9227){return function(_0x9e7f39){if(_0x9e7f39){var _0x33f104=typeof _0x4c9227[_0x9c54('0x1e')]===_0x9c54('0x1f')&&typeof _0x4c9227[_0x9c54('0x20')]===_0x9c54('0x1f');var _0x384d1e=_0x9e7f39[_0x9c54('0x21')];var _0x32095e=_0x33f104?0x0:_0x4c9227['offset'];var _0x341723=_0x33f104?_0x9e7f39[_0x9c54('0x21')]:_0x4c9227[_0x9c54('0x1e')]+_0x4c9227[_0x9c54('0x20')];var _0x5f08a4;if(_0x341723>=_0x384d1e){_0x341723=_0x384d1e;_0x5f08a4=0xc8;}else{_0x5f08a4=0xce;}_0x4fcecb[_0x9c54('0x1b')](_0x5f08a4);return _0x4fcecb[_0x9c54('0x22')](_0x9c54('0x23'),_0x32095e+'-'+_0x341723+'/'+_0x384d1e)[_0x9c54('0x1d')](_0x9e7f39);}return null;};}function patchUpdates(_0x262d63){return function(_0x141ed5){try{jsonpatch[_0x9c54('0x24')](_0x141ed5,_0x262d63,!![]);}catch(_0x395fdf){return BPromise[_0x9c54('0x25')](_0x395fdf);}return _0x141ed5[_0x9c54('0x26')]();};}function saveUpdates(_0x5d5740,_0x245636){return function(_0x2c7133){if(_0x2c7133){return _0x2c7133[_0x9c54('0x27')](_0x5d5740)[_0x9c54('0x28')](function(_0x323d17){return _0x323d17;});}return null;};}function removeEntity(_0x483865,_0x2b9b6d){return function(_0x3eb330){if(_0x3eb330){return _0x3eb330[_0x9c54('0x29')]()[_0x9c54('0x28')](function(){_0x483865[_0x9c54('0x1b')](0xcc)[_0x9c54('0x1c')]();});}};}function handleEntityNotFound(_0x17fcb4,_0x408665){return function(_0x17694e){if(!_0x17694e){_0x17fcb4[_0x9c54('0x1a')](0x194);}return _0x17694e;};}function handleError(_0x21d40a,_0x5b5047){_0x5b5047=_0x5b5047||0x1f4;return function(_0x15a0eb){logger[_0x9c54('0x2a')](_0x15a0eb[_0x9c54('0x2b')]);if(_0x15a0eb[_0x9c54('0x2c')]){delete _0x15a0eb[_0x9c54('0x2c')];}_0x21d40a[_0x9c54('0x1b')](_0x5b5047)[_0x9c54('0x2d')](_0x15a0eb);};}exports['index']=function(_0x35365a,_0x46b1c2){var _0xa0c537={},_0x4de091={},_0x2bc86e={'count':0x0,'rows':[]};var _0x1bb54e=_[_0x9c54('0x2e')](db[_0x9c54('0x2f')]['rawAttributes'],function(_0x2d7e0a){return{'name':_0x2d7e0a['fieldName'],'type':_0x2d7e0a[_0x9c54('0x30')][_0x9c54('0x31')]};});_0x4de091[_0x9c54('0x32')]=_[_0x9c54('0x2e')](_0x1bb54e,_0x9c54('0x2c'));_0x4de091[_0x9c54('0x33')]=_[_0x9c54('0x34')](_0x35365a[_0x9c54('0x33')]);_0x4de091[_0x9c54('0x35')]=_['intersection'](_0x4de091['model'],_0x4de091[_0x9c54('0x33')]);_0xa0c537['attributes']=_['intersection'](_0x4de091['model'],qs[_0x9c54('0x36')](_0x35365a['query']['fields']));_0xa0c537[_0x9c54('0x37')]=_0xa0c537[_0x9c54('0x37')][_0x9c54('0x38')]?_0xa0c537[_0x9c54('0x37')]:_0x4de091[_0x9c54('0x32')];if(!_0x35365a[_0x9c54('0x33')][_0x9c54('0x39')]('nolimit')){_0xa0c537[_0x9c54('0x20')]=qs[_0x9c54('0x20')](_0x35365a[_0x9c54('0x33')][_0x9c54('0x20')]);_0xa0c537[_0x9c54('0x1e')]=qs[_0x9c54('0x1e')](_0x35365a[_0x9c54('0x33')][_0x9c54('0x1e')]);}_0xa0c537['order']=qs[_0x9c54('0x3a')](_0x35365a['query'][_0x9c54('0x3a')]);_0xa0c537[_0x9c54('0x3b')]=qs['filters'](_[_0x9c54('0x3c')](_0x35365a[_0x9c54('0x33')],_0x4de091[_0x9c54('0x35')]),_0x1bb54e);if(_0x35365a[_0x9c54('0x33')]['filter']){_0xa0c537[_0x9c54('0x3b')]=_['merge'](_0xa0c537['where'],{'$or':_[_0x9c54('0x2e')](_0x1bb54e,function(_0x58e113){if(_0x58e113[_0x9c54('0x30')]!==_0x9c54('0x3d')){var _0x220fd0={};_0x220fd0[_0x58e113[_0x9c54('0x2c')]]={'$like':'%'+_0x35365a[_0x9c54('0x33')][_0x9c54('0x3e')]+'%'};return _0x220fd0;}})});}_0xa0c537=_[_0x9c54('0x3f')]({},_0xa0c537,_0x35365a[_0x9c54('0x40')]);var _0x33ff6a={'where':_0xa0c537[_0x9c54('0x3b')]};return db[_0x9c54('0x2f')][_0x9c54('0x21')](_0x33ff6a)[_0x9c54('0x28')](function(_0x2108d0){_0x2bc86e[_0x9c54('0x21')]=_0x2108d0;if(_0x35365a[_0x9c54('0x33')][_0x9c54('0x41')]){_0xa0c537[_0x9c54('0x42')]=[{'all':!![]}];}return db[_0x9c54('0x2f')][_0x9c54('0x43')](_0xa0c537);})[_0x9c54('0x28')](function(_0x2617c7){_0x2bc86e['rows']=_0x2617c7;return _0x2bc86e;})['then'](respondWithFilteredResult(_0x46b1c2,_0xa0c537))['catch'](handleError(_0x46b1c2,null));};exports[_0x9c54('0x44')]=function(_0x5a32d4,_0x479c6c){var _0x1061ce={'raw':![],'where':{'id':_0x5a32d4[_0x9c54('0x45')]['id']}},_0x127dc8={};_0x127dc8[_0x9c54('0x32')]=_['keys'](db[_0x9c54('0x2f')][_0x9c54('0x46')]);_0x127dc8[_0x9c54('0x33')]=_['keys'](_0x5a32d4[_0x9c54('0x33')]);_0x127dc8['filters']=_[_0x9c54('0x47')](_0x127dc8[_0x9c54('0x32')],_0x127dc8[_0x9c54('0x33')]);_0x1061ce[_0x9c54('0x37')]=_['intersection'](_0x127dc8[_0x9c54('0x32')],qs[_0x9c54('0x36')](_0x5a32d4['query']['fields']));_0x1061ce['attributes']=_0x1061ce[_0x9c54('0x37')]['length']?_0x1061ce[_0x9c54('0x37')]:_0x127dc8[_0x9c54('0x32')];if(_0x5a32d4['query'][_0x9c54('0x41')]){_0x1061ce[_0x9c54('0x42')]=[{'all':!![]}];}_0x1061ce=_[_0x9c54('0x3f')]({},_0x1061ce,_0x5a32d4[_0x9c54('0x40')]);return db[_0x9c54('0x2f')]['find'](_0x1061ce)[_0x9c54('0x28')](handleEntityNotFound(_0x479c6c,null))[_0x9c54('0x28')](respondWithResult(_0x479c6c,null))[_0x9c54('0x48')](handleError(_0x479c6c,null));};exports['create']=function(_0x47d44e,_0x1cf631){return db[_0x9c54('0x2f')]['create'](_0x47d44e[_0x9c54('0x49')],{})[_0x9c54('0x28')](respondWithResult(_0x1cf631,0xc9))[_0x9c54('0x48')](handleError(_0x1cf631,null));};exports[_0x9c54('0x27')]=function(_0x5c0f0b,_0x3eabbb){if(_0x5c0f0b[_0x9c54('0x49')]['id']){delete _0x5c0f0b[_0x9c54('0x49')]['id'];}return db[_0x9c54('0x2f')][_0x9c54('0x4a')]({'where':{'id':_0x5c0f0b[_0x9c54('0x45')]['id']}})['then'](handleEntityNotFound(_0x3eabbb,null))[_0x9c54('0x28')](saveUpdates(_0x5c0f0b['body'],null))[_0x9c54('0x28')](respondWithResult(_0x3eabbb,null))[_0x9c54('0x48')](handleError(_0x3eabbb,null));};exports[_0x9c54('0x29')]=function(_0x1b779c,_0x3a89f7){return db[_0x9c54('0x2f')][_0x9c54('0x4a')]({'where':{'id':_0x1b779c['params']['id']}})[_0x9c54('0x28')](handleEntityNotFound(_0x3a89f7,null))['then'](removeEntity(_0x3a89f7,null))[_0x9c54('0x48')](handleError(_0x3a89f7,null));};exports[_0x9c54('0x4b')]=function(_0x3eac5e,_0x3e0f83,_0x42e315){var _0x3857d4={};var _0x1b0e49={};var _0x5a1df0;var _0x7071eb;return db[_0x9c54('0x2f')][_0x9c54('0x4c')]({'where':{'id':_0x3eac5e[_0x9c54('0x45')]['id']}})[_0x9c54('0x28')](handleEntityNotFound(_0x3e0f83,null))[_0x9c54('0x28')](function(_0x384a7d){if(_0x384a7d){_0x5a1df0=_0x384a7d;_0x1b0e49[_0x9c54('0x32')]=_[_0x9c54('0x34')](db['FreshsalesConfiguration'][_0x9c54('0x46')]);_0x1b0e49[_0x9c54('0x33')]=_['keys'](_0x3eac5e[_0x9c54('0x33')]);_0x1b0e49[_0x9c54('0x35')]=_[_0x9c54('0x47')](_0x1b0e49['model'],_0x1b0e49['query']);_0x3857d4['attributes']=_[_0x9c54('0x47')](_0x1b0e49[_0x9c54('0x32')],qs[_0x9c54('0x36')](_0x3eac5e['query'][_0x9c54('0x36')]));_0x3857d4[_0x9c54('0x37')]=_0x3857d4[_0x9c54('0x37')][_0x9c54('0x38')]?_0x3857d4['attributes']:_0x1b0e49[_0x9c54('0x32')];_0x3857d4['order']=qs['sort'](_0x3eac5e[_0x9c54('0x33')][_0x9c54('0x3a')]);_0x3857d4[_0x9c54('0x3b')]=qs[_0x9c54('0x35')](_[_0x9c54('0x3c')](_0x3eac5e[_0x9c54('0x33')],_0x1b0e49['filters']));if(_0x3eac5e['query']['filter']){_0x3857d4[_0x9c54('0x3b')]=_[_0x9c54('0x3f')](_0x3857d4[_0x9c54('0x3b')],{'$or':_[_0x9c54('0x2e')](_0x3857d4[_0x9c54('0x37')],function(_0x17dc85){var _0x3831c={};_0x3831c[_0x17dc85]={'$like':'%'+_0x3eac5e[_0x9c54('0x33')][_0x9c54('0x3e')]+'%'};return _0x3831c;})});}_0x3857d4=_['merge']({},_0x3857d4,_0x3eac5e['options']);return _0x5a1df0[_0x9c54('0x4b')](_0x3857d4);}})[_0x9c54('0x28')](function(_0x5ec5fc){if(_0x5ec5fc){_0x7071eb=_0x5ec5fc[_0x9c54('0x38')];if(!_0x3eac5e[_0x9c54('0x33')][_0x9c54('0x39')](_0x9c54('0x4d'))){_0x3857d4[_0x9c54('0x20')]=qs[_0x9c54('0x20')](_0x3eac5e[_0x9c54('0x33')][_0x9c54('0x20')]);_0x3857d4[_0x9c54('0x1e')]=qs[_0x9c54('0x1e')](_0x3eac5e[_0x9c54('0x33')][_0x9c54('0x1e')]);}return _0x5a1df0['getConfigurations'](_0x3857d4);}})[_0x9c54('0x28')](function(_0x2851a9){if(_0x2851a9){return _0x2851a9?{'count':_0x7071eb,'rows':_0x2851a9}:null;}})['then'](respondWithResult(_0x3e0f83,null))['catch'](handleError(_0x3e0f83,null));};exports[_0x9c54('0x4e')]=function(_0x26db96,_0x1c3ad8,_0x471458){if(_0x26db96[_0x9c54('0x49')]['id']){delete _0x26db96[_0x9c54('0x49')]['id'];}return db[_0x9c54('0x2f')][_0x9c54('0x4c')]({'where':{'id':_0x26db96[_0x9c54('0x45')]['id']}})[_0x9c54('0x28')](handleEntityNotFound(_0x1c3ad8,null))[_0x9c54('0x28')](function(_0x2eb043){if(_0x2eb043){_0x26db96['body'][_0x9c54('0x4f')]=_0x2eb043['id'];_0x26db96[_0x9c54('0x49')]['Subjects']=integrations[_0x9c54('0x50')](_0x26db96[_0x9c54('0x49')][_0x9c54('0x51')],_0x26db96[_0x9c54('0x49')]['type']);_0x26db96[_0x9c54('0x49')][_0x9c54('0x52')]=integrations[_0x9c54('0x53')](_0x26db96[_0x9c54('0x49')]['channel'],_0x26db96[_0x9c54('0x49')][_0x9c54('0x30')]);return db[_0x9c54('0x54')][_0x9c54('0x55')](_0x26db96[_0x9c54('0x49')],{'include':[{'model':db[_0x9c54('0x56')],'as':'Subjects'},{'model':db[_0x9c54('0x56')],'as':_0x9c54('0x52')}]});}return null;})['then'](respondWithResult(_0x1c3ad8,null))[_0x9c54('0x48')](handleError(_0x1c3ad8,null));};exports['getFields']=function(_0x5c9627,_0x192d1e,_0x362275){var _0x45aa46='';var _0xb52eb2='';return db[_0x9c54('0x2f')][_0x9c54('0x4c')]({'where':{'id':_0x5c9627['params']['id']},'attributes':['id','username',_0x9c54('0x57'),'apiKey']})[_0x9c54('0x28')](handleEntityNotFound(_0x192d1e,null))[_0x9c54('0x28')](function(_0x7f26a8){if(_0x7f26a8){_0xb52eb2=_0x7f26a8[_0x9c54('0x58')];_0x45aa46=_0x7f26a8['remoteUri'];var _0x3ebfe9=_0x7f26a8[_0x9c54('0x57')]['slice'](-0x1);if(_0x3ebfe9==='/'){_0x45aa46=_0x45aa46[_0x9c54('0x59')](0x0,_0x45aa46[_0x9c54('0x5a')](_0x3ebfe9));}return rp({'method':'GET','uri':util[_0x9c54('0x5b')](_0x9c54('0x5c'),_0x45aa46,'/api/selector/owners'),'headers':{'Authorization':_0x9c54('0x5d')+_0x7f26a8['apiKey']},'json':!![]});}})[_0x9c54('0x28')](function(_0x41f20f){if(_0x41f20f){var _0x322d03=_0x41f20f[_0x9c54('0x5e')];var _0x125caf=![];var _0xf0c005=null;for(_0xf0c005=0x0;_0xf0c005<_0x322d03[_0x9c54('0x38')];_0xf0c005++){if(_0x322d03[_0xf0c005]['email']===_0xb52eb2){_0x125caf=!![];}}if(_0x125caf){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9c54('0x5f')});}}})[_0x9c54('0x28')](respondWithResult(_0x192d1e,null))[_0x9c54('0x48')](function(_0x2a7113){var _0x554b3c=_0x5c9627[_0x9c54('0x33')][_0x9c54('0x60')]?0x1f4:_0x2a7113[_0x9c54('0x61')]||0x1f4;logger[_0x9c54('0x2a')](_0x9c54('0x62'),_0x9c54('0x63'),_0x554b3c,JSON[_0x9c54('0x64')](_0x2a7113));delete _0x2a7113['name'];if(_0x554b3c===0x191){_0x554b3c=0x190;}_0x192d1e[_0x9c54('0x1b')](_0x554b3c)[_0x9c54('0x2d')](_0x5c9627[_0x9c54('0x33')][_0x9c54('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0x2a7113[_0x9c54('0x61')]}:_0x2a7113);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2dbedd4..d3cbefd 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 _0xa6b0=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x30851f,_0x4fff33){var _0x35123d=function(_0x2b09a4){while(--_0x2b09a4){_0x30851f['push'](_0x30851f['shift']());}};_0x35123d(++_0x4fff33);}(_0xa6b0,0xaf));var _0x0a6b=function(_0xacd9ad,_0x38f9b5){_0xacd9ad=_0xacd9ad-0x0;var _0x4c1ae2=_0xa6b0[_0xacd9ad];return _0x4c1ae2;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));var integrations=require(_0x0a6b('0x8'));module[_0x0a6b('0x9')]=function(_0x3b6967,_0x1b5fb5){return _0x3b6967[_0x0a6b('0xa')](_0x0a6b('0xb'),attributes,{'tableName':_0x0a6b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33af=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x33af,0xec));var _0xf33a=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0x33af[_0x9b2bb0];return _0x2cdb3b;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));var integrations=require(_0xf33a('0x8'));module['exports']=function(_0xc0dd13,_0x384b14){return _0xc0dd13[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index f7c41f2..b34ebb7 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 _0x7a54=['http','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','then','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x36585d,_0x5da28e){var _0xd1ade7=function(_0x59a4aa){while(--_0x59a4aa){_0x36585d['push'](_0x36585d['shift']());}};_0xd1ade7(++_0x5da28e);}(_0x7a54,0x106));var _0x47a5=function(_0x33b288,_0x2b1cdd){_0x33b288=_0x33b288-0x0;var _0x48a485=_0x7a54[_0x33b288];return _0x48a485;};'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')]('FreshsalesAccount,\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['GetFreshsalesAccount']=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,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x1261=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshsalesAccount','options','raw','limit','include','map','model','attributes','stringify','ShowFreshsalesAccount','FreshsalesAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5eeadc,_0x17f42c){var _0x19781b=function(_0x188ed3){while(--_0x188ed3){_0x5eeadc['push'](_0x5eeadc['shift']());}};_0x19781b(++_0x17f42c);}(_0x1261,0x144));var _0x1126=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x1261[_0x5c4e16];return _0x36044a;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['FreshsalesAccount']['findAll']({'raw':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options'][_0x1126('0x17')]===undefined?!![]:![]:!![],'where':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49[_0x1126('0x16')]['where']||null:null,'attributes':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options']['attributes']||null:null,'limit':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49[_0x1126('0x16')][_0x1126('0x18')]||null:null,'include':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options'][_0x1126('0x19')]?_[_0x1126('0x1a')](_0x4a7b49['options'][_0x1126('0x19')],function(_0x59cd8e){return{'model':db[_0x59cd8e['model']],'as':_0x59cd8e['as'],'attributes':_0x59cd8e['attributes'],'include':_0x59cd8e[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x59cd8e[_0x1126('0x19')],function(_0x34bcf1){return{'model':db[_0x34bcf1[_0x1126('0x1b')]],'as':_0x34bcf1['as'],'attributes':_0x34bcf1[_0x1126('0x1c')],'include':_0x34bcf1[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x34bcf1['include'],function(_0x35eec3){return{'model':db[_0x35eec3[_0x1126('0x1b')]],'as':_0x35eec3['as'],'attributes':_0x35eec3[_0x1126('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x541bc9){logger[_0x1126('0xd')](_0x1126('0x15'),_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x1d')](_0x541bc9));_0x22ae0b(_0x541bc9);})['catch'](function(_0x3fa694){logger['error'](_0x1126('0x15'),_0x3fa694['message'],_0x4a7b49);_0x2b2487(_0x4d2b38[_0x1126('0x11')](0x1f4,_0x3fa694['message']));});});};exports[_0x1126('0x1e')]=function(_0x5f2611){var _0x5252e0=this;return new Promise(function(_0x4a53ab,_0x17646e){return db[_0x1126('0x1f')][_0x1126('0x20')]({'raw':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x17')]===undefined?!![]:![]:!![],'where':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x21')]||null:null,'attributes':_0x5f2611[_0x1126('0x16')]?_0x5f2611[_0x1126('0x16')]['attributes']||null:null,'include':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x19')]?_[_0x1126('0x1a')](_0x5f2611[_0x1126('0x16')]['include'],function(_0x145314){return{'model':db[_0x145314[_0x1126('0x1b')]],'as':_0x145314['as'],'attributes':_0x145314[_0x1126('0x1c')],'include':_0x145314[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x145314['include'],function(_0x2a0dfe){return{'model':db[_0x2a0dfe[_0x1126('0x1b')]],'as':_0x2a0dfe['as'],'attributes':_0x2a0dfe[_0x1126('0x1c')],'include':_0x2a0dfe[_0x1126('0x19')]?_['map'](_0x2a0dfe['include'],function(_0x22827a){return{'model':db[_0x22827a[_0x1126('0x1b')]],'as':_0x22827a['as'],'attributes':_0x22827a['attributes']};}):[]};}):[]};}):[]:[]})[_0x1126('0xc')](function(_0xf3c21b){logger[_0x1126('0xd')]('ShowFreshsalesAccount',_0x5f2611);logger['debug'](_0x1126('0x1e'),_0x5f2611,JSON[_0x1126('0x1d')](_0xf3c21b));_0x4a53ab(_0xf3c21b);})[_0x1126('0x14')](function(_0x156554){logger['error'](_0x1126('0x1e'),_0x156554['message'],_0x5f2611);_0x17646e(_0x5252e0[_0x1126('0x11')](0x1f4,_0x156554[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 04d8a08..3090cd4 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 _0x560b=['post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','/:id/descriptions','getDescriptions','getFields'];(function(_0x1be8b5,_0x155b31){var _0x1d785d=function(_0x54e47d){while(--_0x54e47d){_0x1be8b5['push'](_0x1be8b5['shift']());}};_0x1d785d(++_0x155b31);}(_0x560b,0x6b));var _0xb560=function(_0x1b3150,_0x527084){_0x1b3150=_0x1b3150-0x0;var _0x159b25=_0x560b[_0x1b3150];return _0x159b25;};'use strict';var multer=require(_0xb560('0x0'));var util=require(_0xb560('0x1'));var path=require(_0xb560('0x2'));var timeout=require(_0xb560('0x3'));var express=require(_0xb560('0x4'));var router=express[_0xb560('0x5')]();var fs_extra=require(_0xb560('0x6'));var auth=require(_0xb560('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb560('0x8'));var controller=require(_0xb560('0x9'));router['get']('/',auth[_0xb560('0xa')](),controller[_0xb560('0xb')]);router[_0xb560('0xc')]('/:id',auth[_0xb560('0xa')](),controller[_0xb560('0xd')]);router[_0xb560('0xc')](_0xb560('0xe'),auth[_0xb560('0xa')](),controller['getSubjects']);router[_0xb560('0xc')](_0xb560('0xf'),auth[_0xb560('0xa')](),controller[_0xb560('0x10')]);router[_0xb560('0xc')]('/:id/fields',auth[_0xb560('0xa')](),controller[_0xb560('0x11')]);router[_0xb560('0x12')]('/',auth[_0xb560('0xa')](),controller[_0xb560('0x13')]);router['put']('/:id',auth[_0xb560('0xa')](),controller[_0xb560('0x14')]);router[_0xb560('0x15')](_0xb560('0x16'),auth[_0xb560('0xa')](),controller[_0xb560('0x17')]);module[_0xb560('0x18')]=router; \ No newline at end of file +var _0xfb89=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/descriptions','getDescriptions','/:id/fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfb89,0x159));var _0x9fb8=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0xfb89[_0x3cb30b];return _0x2ca717;};'use strict';var multer=require(_0x9fb8('0x0'));var util=require(_0x9fb8('0x1'));var path=require(_0x9fb8('0x2'));var timeout=require(_0x9fb8('0x3'));var express=require(_0x9fb8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9fb8('0x5'));var interaction=require(_0x9fb8('0x6'));var config=require(_0x9fb8('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x9fb8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9fb8('0x8')](_0x9fb8('0x9'),auth[_0x9fb8('0xa')](),controller[_0x9fb8('0xb')]);router[_0x9fb8('0x8')]('/:id/subjects',auth[_0x9fb8('0xa')](),controller['getSubjects']);router[_0x9fb8('0x8')](_0x9fb8('0xc'),auth[_0x9fb8('0xa')](),controller[_0x9fb8('0xd')]);router[_0x9fb8('0x8')](_0x9fb8('0xe'),auth[_0x9fb8('0xa')](),controller['getFields']);router['post']('/',auth[_0x9fb8('0xa')](),controller[_0x9fb8('0xf')]);router[_0x9fb8('0x10')]('/:id',auth[_0x9fb8('0xa')](),controller[_0x9fb8('0x11')]);router[_0x9fb8('0x12')](_0x9fb8('0x9'),auth[_0x9fb8('0xa')](),controller['destroy']);module[_0x9fb8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index e84ad04..0a0717a 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 _0x9fcf=['sequelize','exports','STRING'];(function(_0x28aad1,_0x5ca3b1){var _0x251733=function(_0x33150b){while(--_0x33150b){_0x28aad1['push'](_0x28aad1['shift']());}};_0x251733(++_0x5ca3b1);}(_0x9fcf,0xc9));var _0xf9fc=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x9fcf[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0xf9fc('0x0'));module[_0xf9fc('0x1')]={'name':{'type':Sequelize[_0xf9fc('0x2')]},'description':{'type':Sequelize[_0xf9fc('0x2')]}}; \ No newline at end of file +var _0xf9be=['exports','STRING','sequelize'];(function(_0x5840bc,_0xe8dd90){var _0xe0300a=function(_0x4d17de){while(--_0x4d17de){_0x5840bc['push'](_0x5840bc['shift']());}};_0xe0300a(++_0xe8dd90);}(_0xf9be,0x104));var _0xef9b=function(_0x389213,_0x14a50d){_0x389213=_0x389213-0x0;var _0x4ad6ca=_0xf9be[_0x389213];return _0x4ad6ca;};'use strict';var Sequelize=require(_0xef9b('0x0'));module[_0xef9b('0x1')]={'name':{'type':Sequelize[_0xef9b('0x2')]},'description':{'type':Sequelize[_0xef9b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d739c32..438daa4 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 _0x4c28=['getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','merge','find','create','body','getSubjects','FreshsalesField','pick','nolimit','getDescriptions','findOne'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4c28,0x145));var _0x84c2=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0x4c28[_0x256422];return _0x55dddc;};'use strict';var emlformat=require(_0x84c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84c2('0x1'));var jsonpatch=require(_0x84c2('0x2'));var rp=require(_0x84c2('0x3'));var moment=require(_0x84c2('0x4'));var BPromise=require(_0x84c2('0x5'));var Mustache=require(_0x84c2('0x6'));var util=require(_0x84c2('0x7'));var path=require('path');var sox=require(_0x84c2('0x8'));var csv=require(_0x84c2('0x9'));var ejs=require(_0x84c2('0xa'));var fs=require('fs');var fs_extra=require(_0x84c2('0xb'));var _=require('lodash');var squel=require(_0x84c2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x84c2('0x9'));var querystring=require(_0x84c2('0xd'));var Papa=require(_0x84c2('0xe'));var Redis=require(_0x84c2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x84c2('0x10'));var as=require(_0x84c2('0x11'));var hardwareService=require(_0x84c2('0x12'));var logger=require('../../config/logger')(_0x84c2('0x13'));var utils=require(_0x84c2('0x14'));var config=require(_0x84c2('0x15'));var licenseUtil=require(_0x84c2('0x16'));var db=require(_0x84c2('0x17'))['db'];function respondWithStatusCode(_0x426fcd,_0x59be86){_0x59be86=_0x59be86||0xcc;return function(_0x2b8f3a){if(_0x2b8f3a){return _0x426fcd[_0x84c2('0x18')](_0x59be86);}return _0x426fcd['status'](_0x59be86)[_0x84c2('0x19')]();};}function respondWithResult(_0x2170d0,_0x2ada88){_0x2ada88=_0x2ada88||0xc8;return function(_0x2ceee6){if(_0x2ceee6){return _0x2170d0[_0x84c2('0x1a')](_0x2ada88)[_0x84c2('0x1b')](_0x2ceee6);}};}function respondWithFilteredResult(_0x10ca3c,_0x5a7ea7){return function(_0x580c17){if(_0x580c17){var _0x28f94f=typeof _0x5a7ea7['offset']===_0x84c2('0x1c')&&typeof _0x5a7ea7[_0x84c2('0x1d')]==='undefined';var _0x246c1e=_0x580c17[_0x84c2('0x1e')];var _0x39da21=_0x28f94f?0x0:_0x5a7ea7[_0x84c2('0x1f')];var _0x5f0706=_0x28f94f?_0x580c17[_0x84c2('0x1e')]:_0x5a7ea7['offset']+_0x5a7ea7[_0x84c2('0x1d')];var _0x2a8efe;if(_0x5f0706>=_0x246c1e){_0x5f0706=_0x246c1e;_0x2a8efe=0xc8;}else{_0x2a8efe=0xce;}_0x10ca3c[_0x84c2('0x1a')](_0x2a8efe);return _0x10ca3c[_0x84c2('0x20')](_0x84c2('0x21'),_0x39da21+'-'+_0x5f0706+'/'+_0x246c1e)[_0x84c2('0x1b')](_0x580c17);}return null;};}function patchUpdates(_0x2b0ee3){return function(_0x476aad){try{jsonpatch['apply'](_0x476aad,_0x2b0ee3,!![]);}catch(_0x4975b0){return BPromise[_0x84c2('0x22')](_0x4975b0);}return _0x476aad[_0x84c2('0x23')]();};}function saveUpdates(_0x93dbbe,_0x5964a1){return function(_0x384aae){if(_0x384aae){return _0x384aae[_0x84c2('0x24')](_0x93dbbe)[_0x84c2('0x25')](function(_0xf5c9e1){return _0xf5c9e1;});}return null;};}function removeEntity(_0x1d8f76,_0x531ca3){return function(_0x3718db){if(_0x3718db){return _0x3718db[_0x84c2('0x26')]()[_0x84c2('0x25')](function(){_0x1d8f76[_0x84c2('0x1a')](0xcc)[_0x84c2('0x19')]();});}};}function handleEntityNotFound(_0x19bb5c,_0x9aae51){return function(_0x1bccf6){if(!_0x1bccf6){_0x19bb5c[_0x84c2('0x18')](0x194);}return _0x1bccf6;};}function handleError(_0x43f9e5,_0x56d1cf){_0x56d1cf=_0x56d1cf||0x1f4;return function(_0x56af0a){logger['error'](_0x56af0a[_0x84c2('0x27')]);if(_0x56af0a[_0x84c2('0x28')]){delete _0x56af0a['name'];}_0x43f9e5[_0x84c2('0x1a')](_0x56d1cf)[_0x84c2('0x29')](_0x56af0a);};}exports[_0x84c2('0x2a')]=function(_0x3a6cb1,_0x558323){var _0x2fa04b={},_0x38a74a={},_0x4c99ae={'count':0x0,'rows':[]};var _0x2984b7=_[_0x84c2('0x2b')](db[_0x84c2('0x2c')][_0x84c2('0x2d')],function(_0x4f8d50){return{'name':_0x4f8d50['fieldName'],'type':_0x4f8d50[_0x84c2('0x2e')][_0x84c2('0x2f')]};});_0x38a74a['model']=_[_0x84c2('0x2b')](_0x2984b7,_0x84c2('0x28'));_0x38a74a[_0x84c2('0x30')]=_[_0x84c2('0x31')](_0x3a6cb1[_0x84c2('0x30')]);_0x38a74a[_0x84c2('0x32')]=_['intersection'](_0x38a74a[_0x84c2('0x33')],_0x38a74a[_0x84c2('0x30')]);_0x2fa04b[_0x84c2('0x34')]=_['intersection'](_0x38a74a[_0x84c2('0x33')],qs[_0x84c2('0x35')](_0x3a6cb1[_0x84c2('0x30')][_0x84c2('0x35')]));_0x2fa04b[_0x84c2('0x34')]=_0x2fa04b[_0x84c2('0x34')][_0x84c2('0x36')]?_0x2fa04b['attributes']:_0x38a74a[_0x84c2('0x33')];if(!_0x3a6cb1[_0x84c2('0x30')][_0x84c2('0x37')]('nolimit')){_0x2fa04b[_0x84c2('0x1d')]=qs[_0x84c2('0x1d')](_0x3a6cb1[_0x84c2('0x30')][_0x84c2('0x1d')]);_0x2fa04b[_0x84c2('0x1f')]=qs[_0x84c2('0x1f')](_0x3a6cb1[_0x84c2('0x30')][_0x84c2('0x1f')]);}_0x2fa04b[_0x84c2('0x38')]=qs['sort'](_0x3a6cb1[_0x84c2('0x30')][_0x84c2('0x39')]);_0x2fa04b[_0x84c2('0x3a')]=qs[_0x84c2('0x32')](_['pick'](_0x3a6cb1[_0x84c2('0x30')],_0x38a74a['filters']),_0x2984b7);if(_0x3a6cb1[_0x84c2('0x30')]['filter']){_0x2fa04b[_0x84c2('0x3a')]=_['merge'](_0x2fa04b[_0x84c2('0x3a')],{'$or':_[_0x84c2('0x2b')](_0x2984b7,function(_0x2b3a40){if(_0x2b3a40[_0x84c2('0x2e')]!==_0x84c2('0x3b')){var _0x4f29f3={};_0x4f29f3[_0x2b3a40['name']]={'$like':'%'+_0x3a6cb1[_0x84c2('0x30')][_0x84c2('0x3c')]+'%'};return _0x4f29f3;}})});}_0x2fa04b=_['merge']({},_0x2fa04b,_0x3a6cb1[_0x84c2('0x3d')]);var _0x3def7c={'where':_0x2fa04b['where']};return db[_0x84c2('0x2c')][_0x84c2('0x1e')](_0x3def7c)[_0x84c2('0x25')](function(_0x368a79){_0x4c99ae[_0x84c2('0x1e')]=_0x368a79;if(_0x3a6cb1['query'][_0x84c2('0x3e')]){_0x2fa04b[_0x84c2('0x3f')]=[{'all':!![]}];}return db[_0x84c2('0x2c')][_0x84c2('0x40')](_0x2fa04b);})['then'](function(_0x5eda5e){_0x4c99ae[_0x84c2('0x41')]=_0x5eda5e;return _0x4c99ae;})[_0x84c2('0x25')](respondWithFilteredResult(_0x558323,_0x2fa04b))[_0x84c2('0x42')](handleError(_0x558323,null));};exports[_0x84c2('0x43')]=function(_0x1ad555,_0x58d91){var _0x50c720={'raw':![],'where':{'id':_0x1ad555[_0x84c2('0x44')]['id']}},_0x378bcc={};_0x378bcc[_0x84c2('0x33')]=_['keys'](db[_0x84c2('0x2c')][_0x84c2('0x2d')]);_0x378bcc[_0x84c2('0x30')]=_[_0x84c2('0x31')](_0x1ad555[_0x84c2('0x30')]);_0x378bcc[_0x84c2('0x32')]=_[_0x84c2('0x45')](_0x378bcc[_0x84c2('0x33')],_0x378bcc['query']);_0x50c720[_0x84c2('0x34')]=_[_0x84c2('0x45')](_0x378bcc['model'],qs[_0x84c2('0x35')](_0x1ad555[_0x84c2('0x30')]['fields']));_0x50c720['attributes']=_0x50c720[_0x84c2('0x34')][_0x84c2('0x36')]?_0x50c720[_0x84c2('0x34')]:_0x378bcc[_0x84c2('0x33')];if(_0x1ad555['query'][_0x84c2('0x3e')]){_0x50c720['include']=[{'all':!![]}];}_0x50c720=_[_0x84c2('0x46')]({},_0x50c720,_0x1ad555['options']);return db[_0x84c2('0x2c')][_0x84c2('0x47')](_0x50c720)[_0x84c2('0x25')](handleEntityNotFound(_0x58d91,null))[_0x84c2('0x25')](respondWithResult(_0x58d91,null))[_0x84c2('0x42')](handleError(_0x58d91,null));};exports[_0x84c2('0x48')]=function(_0x3177cb,_0x1b1c3b){return db['FreshsalesConfiguration'][_0x84c2('0x48')](_0x3177cb[_0x84c2('0x49')],{})[_0x84c2('0x25')](respondWithResult(_0x1b1c3b,0xc9))[_0x84c2('0x42')](handleError(_0x1b1c3b,null));};exports[_0x84c2('0x24')]=function(_0x3b31a0,_0x69bb52){if(_0x3b31a0[_0x84c2('0x49')]['id']){delete _0x3b31a0[_0x84c2('0x49')]['id'];}return db[_0x84c2('0x2c')]['find']({'where':{'id':_0x3b31a0[_0x84c2('0x44')]['id']}})['then'](handleEntityNotFound(_0x69bb52,null))[_0x84c2('0x25')](saveUpdates(_0x3b31a0[_0x84c2('0x49')],null))[_0x84c2('0x25')](respondWithResult(_0x69bb52,null))['catch'](handleError(_0x69bb52,null));};exports['destroy']=function(_0x5252a3,_0x24e919){return db[_0x84c2('0x2c')][_0x84c2('0x47')]({'where':{'id':_0x5252a3[_0x84c2('0x44')]['id']}})[_0x84c2('0x25')](handleEntityNotFound(_0x24e919,null))[_0x84c2('0x25')](removeEntity(_0x24e919,null))['catch'](handleError(_0x24e919,null));};exports[_0x84c2('0x4a')]=function(_0x10e82b,_0x4de0af,_0x1b19da){var _0x5e62fc={};var _0xcbbc67={};var _0x30ebef;var _0x1d5fbf;return db[_0x84c2('0x2c')]['findOne']({'where':{'id':_0x10e82b['params']['id']}})[_0x84c2('0x25')](handleEntityNotFound(_0x4de0af,null))[_0x84c2('0x25')](function(_0x475eee){if(_0x475eee){_0x30ebef=_0x475eee;_0xcbbc67['model']=_[_0x84c2('0x31')](db[_0x84c2('0x4b')][_0x84c2('0x2d')]);_0xcbbc67[_0x84c2('0x30')]=_[_0x84c2('0x31')](_0x10e82b[_0x84c2('0x30')]);_0xcbbc67[_0x84c2('0x32')]=_['intersection'](_0xcbbc67[_0x84c2('0x33')],_0xcbbc67[_0x84c2('0x30')]);_0x5e62fc[_0x84c2('0x34')]=_[_0x84c2('0x45')](_0xcbbc67[_0x84c2('0x33')],qs[_0x84c2('0x35')](_0x10e82b[_0x84c2('0x30')][_0x84c2('0x35')]));_0x5e62fc['attributes']=_0x5e62fc[_0x84c2('0x34')]['length']?_0x5e62fc[_0x84c2('0x34')]:_0xcbbc67['model'];_0x5e62fc['order']=qs[_0x84c2('0x39')](_0x10e82b[_0x84c2('0x30')]['sort']);_0x5e62fc[_0x84c2('0x3a')]=qs[_0x84c2('0x32')](_[_0x84c2('0x4c')](_0x10e82b[_0x84c2('0x30')],_0xcbbc67[_0x84c2('0x32')]));if(_0x10e82b['query']['filter']){_0x5e62fc[_0x84c2('0x3a')]=_[_0x84c2('0x46')](_0x5e62fc[_0x84c2('0x3a')],{'$or':_[_0x84c2('0x2b')](_0x5e62fc[_0x84c2('0x34')],function(_0x1d0745){var _0x6daa2c={};_0x6daa2c[_0x1d0745]={'$like':'%'+_0x10e82b['query'][_0x84c2('0x3c')]+'%'};return _0x6daa2c;})});}_0x5e62fc=_[_0x84c2('0x46')]({},_0x5e62fc,_0x10e82b[_0x84c2('0x3d')]);return _0x30ebef[_0x84c2('0x4a')](_0x5e62fc);}})[_0x84c2('0x25')](function(_0x47816){if(_0x47816){_0x1d5fbf=_0x47816[_0x84c2('0x36')];if(!_0x10e82b[_0x84c2('0x30')][_0x84c2('0x37')](_0x84c2('0x4d'))){_0x5e62fc['limit']=qs['limit'](_0x10e82b[_0x84c2('0x30')]['limit']);_0x5e62fc[_0x84c2('0x1f')]=qs[_0x84c2('0x1f')](_0x10e82b['query']['offset']);}return _0x30ebef[_0x84c2('0x4a')](_0x5e62fc);}})[_0x84c2('0x25')](function(_0x4f71c6){if(_0x4f71c6){return _0x4f71c6?{'count':_0x1d5fbf,'rows':_0x4f71c6}:null;}})[_0x84c2('0x25')](respondWithResult(_0x4de0af,null))[_0x84c2('0x42')](handleError(_0x4de0af,null));};exports[_0x84c2('0x4e')]=function(_0x3c3923,_0xe56053,_0x3a509a){var _0x2813da={};var _0xf6f2d3={};var _0x3b3bc8;var _0x54342c;return db[_0x84c2('0x2c')][_0x84c2('0x4f')]({'where':{'id':_0x3c3923[_0x84c2('0x44')]['id']}})['then'](handleEntityNotFound(_0xe56053,null))['then'](function(_0x22b724){if(_0x22b724){_0x3b3bc8=_0x22b724;_0xf6f2d3[_0x84c2('0x33')]=_[_0x84c2('0x31')](db[_0x84c2('0x4b')][_0x84c2('0x2d')]);_0xf6f2d3[_0x84c2('0x30')]=_[_0x84c2('0x31')](_0x3c3923[_0x84c2('0x30')]);_0xf6f2d3['filters']=_[_0x84c2('0x45')](_0xf6f2d3[_0x84c2('0x33')],_0xf6f2d3[_0x84c2('0x30')]);_0x2813da[_0x84c2('0x34')]=_['intersection'](_0xf6f2d3['model'],qs[_0x84c2('0x35')](_0x3c3923[_0x84c2('0x30')][_0x84c2('0x35')]));_0x2813da['attributes']=_0x2813da['attributes'][_0x84c2('0x36')]?_0x2813da[_0x84c2('0x34')]:_0xf6f2d3[_0x84c2('0x33')];_0x2813da[_0x84c2('0x38')]=qs[_0x84c2('0x39')](_0x3c3923['query']['sort']);_0x2813da[_0x84c2('0x3a')]=qs[_0x84c2('0x32')](_[_0x84c2('0x4c')](_0x3c3923['query'],_0xf6f2d3['filters']));if(_0x3c3923[_0x84c2('0x30')][_0x84c2('0x3c')]){_0x2813da['where']=_[_0x84c2('0x46')](_0x2813da[_0x84c2('0x3a')],{'$or':_[_0x84c2('0x2b')](_0x2813da[_0x84c2('0x34')],function(_0x7289f5){var _0x1d39a4={};_0x1d39a4[_0x7289f5]={'$like':'%'+_0x3c3923[_0x84c2('0x30')]['filter']+'%'};return _0x1d39a4;})});}_0x2813da=_[_0x84c2('0x46')]({},_0x2813da,_0x3c3923[_0x84c2('0x3d')]);return _0x3b3bc8[_0x84c2('0x4e')](_0x2813da);}})[_0x84c2('0x25')](function(_0x7d7872){if(_0x7d7872){_0x54342c=_0x7d7872['length'];if(!_0x3c3923[_0x84c2('0x30')][_0x84c2('0x37')]('nolimit')){_0x2813da['limit']=qs['limit'](_0x3c3923[_0x84c2('0x30')][_0x84c2('0x1d')]);_0x2813da[_0x84c2('0x1f')]=qs[_0x84c2('0x1f')](_0x3c3923[_0x84c2('0x30')][_0x84c2('0x1f')]);}return _0x3b3bc8[_0x84c2('0x4e')](_0x2813da);}})[_0x84c2('0x25')](function(_0xe65f37){if(_0xe65f37){return _0xe65f37?{'count':_0x54342c,'rows':_0xe65f37}:null;}})[_0x84c2('0x25')](respondWithResult(_0xe56053,null))[_0x84c2('0x42')](handleError(_0xe56053,null));};exports[_0x84c2('0x50')]=function(_0x31eeab,_0x34d453,_0x12882c){var _0x4b282a={};var _0x27283d={};var _0x31fb46;var _0x5377c4;return db[_0x84c2('0x2c')]['findOne']({'where':{'id':_0x31eeab[_0x84c2('0x44')]['id']}})[_0x84c2('0x25')](handleEntityNotFound(_0x34d453,null))[_0x84c2('0x25')](function(_0x2e76d9){if(_0x2e76d9){_0x31fb46=_0x2e76d9;_0x27283d[_0x84c2('0x33')]=_['keys'](db['FreshsalesField'][_0x84c2('0x2d')]);_0x27283d[_0x84c2('0x30')]=_['keys'](_0x31eeab['query']);_0x27283d['filters']=_['intersection'](_0x27283d['model'],_0x27283d[_0x84c2('0x30')]);_0x4b282a[_0x84c2('0x34')]=_['intersection'](_0x27283d['model'],qs['fields'](_0x31eeab[_0x84c2('0x30')][_0x84c2('0x35')]));_0x4b282a[_0x84c2('0x34')]=_0x4b282a['attributes']['length']?_0x4b282a[_0x84c2('0x34')]:_0x27283d[_0x84c2('0x33')];_0x4b282a[_0x84c2('0x38')]=qs[_0x84c2('0x39')](_0x31eeab[_0x84c2('0x30')][_0x84c2('0x39')]);_0x4b282a[_0x84c2('0x3a')]=qs[_0x84c2('0x32')](_[_0x84c2('0x4c')](_0x31eeab[_0x84c2('0x30')],_0x27283d[_0x84c2('0x32')]));if(_0x31eeab['query'][_0x84c2('0x3c')]){_0x4b282a[_0x84c2('0x3a')]=_[_0x84c2('0x46')](_0x4b282a['where'],{'$or':_[_0x84c2('0x2b')](_0x4b282a['attributes'],function(_0x546b12){var _0x2fc12d={};_0x2fc12d[_0x546b12]={'$like':'%'+_0x31eeab['query'][_0x84c2('0x3c')]+'%'};return _0x2fc12d;})});}_0x4b282a=_[_0x84c2('0x46')]({},_0x4b282a,_0x31eeab[_0x84c2('0x3d')]);return _0x31fb46[_0x84c2('0x50')](_0x4b282a);}})[_0x84c2('0x25')](function(_0x57f623){if(_0x57f623){_0x5377c4=_0x57f623[_0x84c2('0x36')];if(!_0x31eeab[_0x84c2('0x30')][_0x84c2('0x37')]('nolimit')){_0x4b282a[_0x84c2('0x1d')]=qs[_0x84c2('0x1d')](_0x31eeab[_0x84c2('0x30')][_0x84c2('0x1d')]);_0x4b282a[_0x84c2('0x1f')]=qs[_0x84c2('0x1f')](_0x31eeab[_0x84c2('0x30')][_0x84c2('0x1f')]);}return _0x31fb46[_0x84c2('0x50')](_0x4b282a);}})[_0x84c2('0x25')](function(_0x1b97ce){if(_0x1b97ce){return _0x1b97ce?{'count':_0x5377c4,'rows':_0x1b97ce}:null;}})[_0x84c2('0x25')](respondWithResult(_0x34d453,null))[_0x84c2('0x42')](handleError(_0x34d453,null));}; \ No newline at end of file +var _0xb7ae=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','end','sendStatus','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','FreshsalesField','nolimit','getSubjects','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','crypto'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xb7ae,0x131));var _0xeb7a=function(_0x2c18ae,_0x28e490){_0x2c18ae=_0x2c18ae-0x0;var _0x3798db=_0xb7ae[_0x2c18ae];return _0x3798db;};'use strict';var emlformat=require(_0xeb7a('0x0'));var rimraf=require(_0xeb7a('0x1'));var zipdir=require(_0xeb7a('0x2'));var jsonpatch=require(_0xeb7a('0x3'));var rp=require('request-promise');var moment=require(_0xeb7a('0x4'));var BPromise=require(_0xeb7a('0x5'));var Mustache=require(_0xeb7a('0x6'));var util=require(_0xeb7a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeb7a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb7a('0x9'));var squel=require('squel');var crypto=require(_0xeb7a('0xa'));var jsforce=require(_0xeb7a('0xb'));var deskjs=require(_0xeb7a('0xc'));var toCsv=require(_0xeb7a('0x8'));var querystring=require(_0xeb7a('0xd'));var Papa=require(_0xeb7a('0xe'));var Redis=require(_0xeb7a('0xf'));var authService=require(_0xeb7a('0x10'));var qs=require(_0xeb7a('0x11'));var as=require(_0xeb7a('0x12'));var hardwareService=require(_0xeb7a('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xeb7a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb7a('0x15'))['db'];function respondWithStatusCode(_0x52c4ab,_0x19faa7){_0x19faa7=_0x19faa7||0xcc;return function(_0x51d950){if(_0x51d950){return _0x52c4ab['sendStatus'](_0x19faa7);}return _0x52c4ab[_0xeb7a('0x16')](_0x19faa7)['end']();};}function respondWithResult(_0x240689,_0x6954df){_0x6954df=_0x6954df||0xc8;return function(_0x2a8952){if(_0x2a8952){return _0x240689[_0xeb7a('0x16')](_0x6954df)[_0xeb7a('0x17')](_0x2a8952);}};}function respondWithFilteredResult(_0x44d921,_0x1033fd){return function(_0x385370){if(_0x385370){var _0x465682=typeof _0x1033fd[_0xeb7a('0x18')]==='undefined'&&typeof _0x1033fd[_0xeb7a('0x19')]===_0xeb7a('0x1a');var _0x456423=_0x385370[_0xeb7a('0x1b')];var _0x338333=_0x465682?0x0:_0x1033fd[_0xeb7a('0x18')];var _0x39ccdc=_0x465682?_0x385370['count']:_0x1033fd[_0xeb7a('0x18')]+_0x1033fd['limit'];var _0x3f6afa;if(_0x39ccdc>=_0x456423){_0x39ccdc=_0x456423;_0x3f6afa=0xc8;}else{_0x3f6afa=0xce;}_0x44d921[_0xeb7a('0x16')](_0x3f6afa);return _0x44d921[_0xeb7a('0x1c')](_0xeb7a('0x1d'),_0x338333+'-'+_0x39ccdc+'/'+_0x456423)['json'](_0x385370);}return null;};}function patchUpdates(_0x5667f6){return function(_0x33cc44){try{jsonpatch['apply'](_0x33cc44,_0x5667f6,!![]);}catch(_0x1e19da){return BPromise['reject'](_0x1e19da);}return _0x33cc44[_0xeb7a('0x1e')]();};}function saveUpdates(_0x244a05,_0x12ce1f){return function(_0x22710e){if(_0x22710e){return _0x22710e[_0xeb7a('0x1f')](_0x244a05)[_0xeb7a('0x20')](function(_0x34723b){return _0x34723b;});}return null;};}function removeEntity(_0x286c47,_0xa3e3a4){return function(_0xd68e04){if(_0xd68e04){return _0xd68e04['destroy']()[_0xeb7a('0x20')](function(){_0x286c47[_0xeb7a('0x16')](0xcc)[_0xeb7a('0x21')]();});}};}function handleEntityNotFound(_0x1041da,_0x3afa3d){return function(_0x5e5385){if(!_0x5e5385){_0x1041da[_0xeb7a('0x22')](0x194);}return _0x5e5385;};}function handleError(_0x4cbefd,_0x26b643){_0x26b643=_0x26b643||0x1f4;return function(_0x13ee6b){logger[_0xeb7a('0x23')](_0x13ee6b[_0xeb7a('0x24')]);if(_0x13ee6b[_0xeb7a('0x25')]){delete _0x13ee6b[_0xeb7a('0x25')];}_0x4cbefd[_0xeb7a('0x16')](_0x26b643)[_0xeb7a('0x26')](_0x13ee6b);};}exports[_0xeb7a('0x27')]=function(_0x1ede73,_0x403a41){var _0x51c046={},_0x2e76d8={},_0x1f0fed={'count':0x0,'rows':[]};var _0x109ede=_[_0xeb7a('0x28')](db[_0xeb7a('0x29')]['rawAttributes'],function(_0x5e2493){return{'name':_0x5e2493[_0xeb7a('0x2a')],'type':_0x5e2493[_0xeb7a('0x2b')]['key']};});_0x2e76d8[_0xeb7a('0x2c')]=_[_0xeb7a('0x28')](_0x109ede,_0xeb7a('0x25'));_0x2e76d8['query']=_[_0xeb7a('0x2d')](_0x1ede73['query']);_0x2e76d8[_0xeb7a('0x2e')]=_[_0xeb7a('0x2f')](_0x2e76d8[_0xeb7a('0x2c')],_0x2e76d8[_0xeb7a('0x30')]);_0x51c046[_0xeb7a('0x31')]=_[_0xeb7a('0x2f')](_0x2e76d8[_0xeb7a('0x2c')],qs[_0xeb7a('0x32')](_0x1ede73[_0xeb7a('0x30')][_0xeb7a('0x32')]));_0x51c046['attributes']=_0x51c046['attributes'][_0xeb7a('0x33')]?_0x51c046[_0xeb7a('0x31')]:_0x2e76d8[_0xeb7a('0x2c')];if(!_0x1ede73['query'][_0xeb7a('0x34')]('nolimit')){_0x51c046[_0xeb7a('0x19')]=qs[_0xeb7a('0x19')](_0x1ede73[_0xeb7a('0x30')][_0xeb7a('0x19')]);_0x51c046[_0xeb7a('0x18')]=qs[_0xeb7a('0x18')](_0x1ede73[_0xeb7a('0x30')][_0xeb7a('0x18')]);}_0x51c046[_0xeb7a('0x35')]=qs[_0xeb7a('0x36')](_0x1ede73[_0xeb7a('0x30')][_0xeb7a('0x36')]);_0x51c046['where']=qs['filters'](_[_0xeb7a('0x37')](_0x1ede73[_0xeb7a('0x30')],_0x2e76d8['filters']),_0x109ede);if(_0x1ede73[_0xeb7a('0x30')]['filter']){_0x51c046[_0xeb7a('0x38')]=_['merge'](_0x51c046[_0xeb7a('0x38')],{'$or':_[_0xeb7a('0x28')](_0x109ede,function(_0x11d8d7){if(_0x11d8d7['type']!==_0xeb7a('0x39')){var _0x10aa16={};_0x10aa16[_0x11d8d7[_0xeb7a('0x25')]]={'$like':'%'+_0x1ede73[_0xeb7a('0x30')][_0xeb7a('0x3a')]+'%'};return _0x10aa16;}})});}_0x51c046=_[_0xeb7a('0x3b')]({},_0x51c046,_0x1ede73[_0xeb7a('0x3c')]);var _0x4f77df={'where':_0x51c046[_0xeb7a('0x38')]};return db[_0xeb7a('0x29')]['count'](_0x4f77df)[_0xeb7a('0x20')](function(_0x223204){_0x1f0fed[_0xeb7a('0x1b')]=_0x223204;if(_0x1ede73['query'][_0xeb7a('0x3d')]){_0x51c046[_0xeb7a('0x3e')]=[{'all':!![]}];}return db[_0xeb7a('0x29')][_0xeb7a('0x3f')](_0x51c046);})[_0xeb7a('0x20')](function(_0x1985b8){_0x1f0fed[_0xeb7a('0x40')]=_0x1985b8;return _0x1f0fed;})[_0xeb7a('0x20')](respondWithFilteredResult(_0x403a41,_0x51c046))[_0xeb7a('0x41')](handleError(_0x403a41,null));};exports[_0xeb7a('0x42')]=function(_0x2d1986,_0xef1a37){var _0x2e8f93={'raw':![],'where':{'id':_0x2d1986[_0xeb7a('0x43')]['id']}},_0x25c174={};_0x25c174[_0xeb7a('0x2c')]=_[_0xeb7a('0x2d')](db[_0xeb7a('0x29')][_0xeb7a('0x44')]);_0x25c174['query']=_[_0xeb7a('0x2d')](_0x2d1986['query']);_0x25c174['filters']=_[_0xeb7a('0x2f')](_0x25c174[_0xeb7a('0x2c')],_0x25c174['query']);_0x2e8f93[_0xeb7a('0x31')]=_['intersection'](_0x25c174['model'],qs[_0xeb7a('0x32')](_0x2d1986['query'][_0xeb7a('0x32')]));_0x2e8f93['attributes']=_0x2e8f93[_0xeb7a('0x31')][_0xeb7a('0x33')]?_0x2e8f93[_0xeb7a('0x31')]:_0x25c174[_0xeb7a('0x2c')];if(_0x2d1986[_0xeb7a('0x30')][_0xeb7a('0x3d')]){_0x2e8f93[_0xeb7a('0x3e')]=[{'all':!![]}];}_0x2e8f93=_[_0xeb7a('0x3b')]({},_0x2e8f93,_0x2d1986[_0xeb7a('0x3c')]);return db[_0xeb7a('0x29')][_0xeb7a('0x45')](_0x2e8f93)[_0xeb7a('0x20')](handleEntityNotFound(_0xef1a37,null))[_0xeb7a('0x20')](respondWithResult(_0xef1a37,null))[_0xeb7a('0x41')](handleError(_0xef1a37,null));};exports[_0xeb7a('0x46')]=function(_0x16bd2d,_0x50e59e){return db[_0xeb7a('0x29')]['create'](_0x16bd2d[_0xeb7a('0x47')],{})[_0xeb7a('0x20')](respondWithResult(_0x50e59e,0xc9))[_0xeb7a('0x41')](handleError(_0x50e59e,null));};exports['update']=function(_0x378394,_0x5a3148){if(_0x378394[_0xeb7a('0x47')]['id']){delete _0x378394[_0xeb7a('0x47')]['id'];}return db[_0xeb7a('0x29')][_0xeb7a('0x45')]({'where':{'id':_0x378394[_0xeb7a('0x43')]['id']}})[_0xeb7a('0x20')](handleEntityNotFound(_0x5a3148,null))['then'](saveUpdates(_0x378394[_0xeb7a('0x47')],null))[_0xeb7a('0x20')](respondWithResult(_0x5a3148,null))['catch'](handleError(_0x5a3148,null));};exports[_0xeb7a('0x48')]=function(_0x1c27c7,_0x16db52){return db[_0xeb7a('0x29')][_0xeb7a('0x45')]({'where':{'id':_0x1c27c7[_0xeb7a('0x43')]['id']}})['then'](handleEntityNotFound(_0x16db52,null))[_0xeb7a('0x20')](removeEntity(_0x16db52,null))[_0xeb7a('0x41')](handleError(_0x16db52,null));};exports['getSubjects']=function(_0x3e53e2,_0x3576c7,_0x139c54){var _0xa8a1a8={};var _0x18753b={};var _0x197a7f;var _0x3970b6;return db[_0xeb7a('0x29')]['findOne']({'where':{'id':_0x3e53e2[_0xeb7a('0x43')]['id']}})[_0xeb7a('0x20')](handleEntityNotFound(_0x3576c7,null))[_0xeb7a('0x20')](function(_0x193cbc){if(_0x193cbc){_0x197a7f=_0x193cbc;_0x18753b[_0xeb7a('0x2c')]=_[_0xeb7a('0x2d')](db[_0xeb7a('0x49')][_0xeb7a('0x44')]);_0x18753b[_0xeb7a('0x30')]=_[_0xeb7a('0x2d')](_0x3e53e2['query']);_0x18753b['filters']=_[_0xeb7a('0x2f')](_0x18753b[_0xeb7a('0x2c')],_0x18753b[_0xeb7a('0x30')]);_0xa8a1a8[_0xeb7a('0x31')]=_['intersection'](_0x18753b[_0xeb7a('0x2c')],qs[_0xeb7a('0x32')](_0x3e53e2[_0xeb7a('0x30')]['fields']));_0xa8a1a8[_0xeb7a('0x31')]=_0xa8a1a8[_0xeb7a('0x31')]['length']?_0xa8a1a8['attributes']:_0x18753b[_0xeb7a('0x2c')];_0xa8a1a8[_0xeb7a('0x35')]=qs[_0xeb7a('0x36')](_0x3e53e2[_0xeb7a('0x30')][_0xeb7a('0x36')]);_0xa8a1a8[_0xeb7a('0x38')]=qs[_0xeb7a('0x2e')](_[_0xeb7a('0x37')](_0x3e53e2[_0xeb7a('0x30')],_0x18753b['filters']));if(_0x3e53e2[_0xeb7a('0x30')][_0xeb7a('0x3a')]){_0xa8a1a8[_0xeb7a('0x38')]=_[_0xeb7a('0x3b')](_0xa8a1a8['where'],{'$or':_[_0xeb7a('0x28')](_0xa8a1a8['attributes'],function(_0x1a7f91){var _0x500303={};_0x500303[_0x1a7f91]={'$like':'%'+_0x3e53e2[_0xeb7a('0x30')][_0xeb7a('0x3a')]+'%'};return _0x500303;})});}_0xa8a1a8=_[_0xeb7a('0x3b')]({},_0xa8a1a8,_0x3e53e2[_0xeb7a('0x3c')]);return _0x197a7f['getSubjects'](_0xa8a1a8);}})[_0xeb7a('0x20')](function(_0x3af933){if(_0x3af933){_0x3970b6=_0x3af933[_0xeb7a('0x33')];if(!_0x3e53e2[_0xeb7a('0x30')]['hasOwnProperty'](_0xeb7a('0x4a'))){_0xa8a1a8[_0xeb7a('0x19')]=qs['limit'](_0x3e53e2[_0xeb7a('0x30')]['limit']);_0xa8a1a8[_0xeb7a('0x18')]=qs['offset'](_0x3e53e2[_0xeb7a('0x30')][_0xeb7a('0x18')]);}return _0x197a7f[_0xeb7a('0x4b')](_0xa8a1a8);}})[_0xeb7a('0x20')](function(_0x48f61a){if(_0x48f61a){return _0x48f61a?{'count':_0x3970b6,'rows':_0x48f61a}:null;}})['then'](respondWithResult(_0x3576c7,null))[_0xeb7a('0x41')](handleError(_0x3576c7,null));};exports[_0xeb7a('0x4c')]=function(_0x337296,_0x2945d3,_0x16ed67){var _0x2d6398={};var _0x5f5310={};var _0x1498e6;var _0x27f74c;return db[_0xeb7a('0x29')][_0xeb7a('0x4d')]({'where':{'id':_0x337296[_0xeb7a('0x43')]['id']}})[_0xeb7a('0x20')](handleEntityNotFound(_0x2945d3,null))[_0xeb7a('0x20')](function(_0x42acb9){if(_0x42acb9){_0x1498e6=_0x42acb9;_0x5f5310[_0xeb7a('0x2c')]=_[_0xeb7a('0x2d')](db[_0xeb7a('0x49')]['rawAttributes']);_0x5f5310['query']=_['keys'](_0x337296[_0xeb7a('0x30')]);_0x5f5310['filters']=_[_0xeb7a('0x2f')](_0x5f5310['model'],_0x5f5310[_0xeb7a('0x30')]);_0x2d6398[_0xeb7a('0x31')]=_['intersection'](_0x5f5310[_0xeb7a('0x2c')],qs[_0xeb7a('0x32')](_0x337296[_0xeb7a('0x30')][_0xeb7a('0x32')]));_0x2d6398[_0xeb7a('0x31')]=_0x2d6398['attributes'][_0xeb7a('0x33')]?_0x2d6398[_0xeb7a('0x31')]:_0x5f5310[_0xeb7a('0x2c')];_0x2d6398[_0xeb7a('0x35')]=qs[_0xeb7a('0x36')](_0x337296[_0xeb7a('0x30')][_0xeb7a('0x36')]);_0x2d6398[_0xeb7a('0x38')]=qs[_0xeb7a('0x2e')](_[_0xeb7a('0x37')](_0x337296[_0xeb7a('0x30')],_0x5f5310['filters']));if(_0x337296[_0xeb7a('0x30')][_0xeb7a('0x3a')]){_0x2d6398[_0xeb7a('0x38')]=_[_0xeb7a('0x3b')](_0x2d6398[_0xeb7a('0x38')],{'$or':_[_0xeb7a('0x28')](_0x2d6398[_0xeb7a('0x31')],function(_0x9f993c){var _0x3fe655={};_0x3fe655[_0x9f993c]={'$like':'%'+_0x337296[_0xeb7a('0x30')]['filter']+'%'};return _0x3fe655;})});}_0x2d6398=_[_0xeb7a('0x3b')]({},_0x2d6398,_0x337296[_0xeb7a('0x3c')]);return _0x1498e6[_0xeb7a('0x4c')](_0x2d6398);}})['then'](function(_0x322d55){if(_0x322d55){_0x27f74c=_0x322d55[_0xeb7a('0x33')];if(!_0x337296[_0xeb7a('0x30')][_0xeb7a('0x34')](_0xeb7a('0x4a'))){_0x2d6398['limit']=qs[_0xeb7a('0x19')](_0x337296[_0xeb7a('0x30')][_0xeb7a('0x19')]);_0x2d6398['offset']=qs[_0xeb7a('0x18')](_0x337296[_0xeb7a('0x30')]['offset']);}return _0x1498e6['getDescriptions'](_0x2d6398);}})[_0xeb7a('0x20')](function(_0x1067c2){if(_0x1067c2){return _0x1067c2?{'count':_0x27f74c,'rows':_0x1067c2}:null;}})[_0xeb7a('0x20')](respondWithResult(_0x2945d3,null))[_0xeb7a('0x41')](handleError(_0x2945d3,null));};exports[_0xeb7a('0x4e')]=function(_0x4ded8,_0x158b54,_0x14696a){var _0xb435cd={};var _0x32929f={};var _0x298cb9;var _0x4e1777;return db[_0xeb7a('0x29')][_0xeb7a('0x4d')]({'where':{'id':_0x4ded8['params']['id']}})['then'](handleEntityNotFound(_0x158b54,null))[_0xeb7a('0x20')](function(_0x810ade){if(_0x810ade){_0x298cb9=_0x810ade;_0x32929f[_0xeb7a('0x2c')]=_[_0xeb7a('0x2d')](db[_0xeb7a('0x49')]['rawAttributes']);_0x32929f[_0xeb7a('0x30')]=_[_0xeb7a('0x2d')](_0x4ded8[_0xeb7a('0x30')]);_0x32929f[_0xeb7a('0x2e')]=_[_0xeb7a('0x2f')](_0x32929f[_0xeb7a('0x2c')],_0x32929f[_0xeb7a('0x30')]);_0xb435cd[_0xeb7a('0x31')]=_[_0xeb7a('0x2f')](_0x32929f['model'],qs['fields'](_0x4ded8['query'][_0xeb7a('0x32')]));_0xb435cd['attributes']=_0xb435cd[_0xeb7a('0x31')][_0xeb7a('0x33')]?_0xb435cd[_0xeb7a('0x31')]:_0x32929f[_0xeb7a('0x2c')];_0xb435cd['order']=qs[_0xeb7a('0x36')](_0x4ded8[_0xeb7a('0x30')][_0xeb7a('0x36')]);_0xb435cd[_0xeb7a('0x38')]=qs[_0xeb7a('0x2e')](_[_0xeb7a('0x37')](_0x4ded8[_0xeb7a('0x30')],_0x32929f['filters']));if(_0x4ded8[_0xeb7a('0x30')][_0xeb7a('0x3a')]){_0xb435cd[_0xeb7a('0x38')]=_['merge'](_0xb435cd[_0xeb7a('0x38')],{'$or':_[_0xeb7a('0x28')](_0xb435cd[_0xeb7a('0x31')],function(_0x28568c){var _0x3075c0={};_0x3075c0[_0x28568c]={'$like':'%'+_0x4ded8[_0xeb7a('0x30')][_0xeb7a('0x3a')]+'%'};return _0x3075c0;})});}_0xb435cd=_[_0xeb7a('0x3b')]({},_0xb435cd,_0x4ded8['options']);return _0x298cb9['getFields'](_0xb435cd);}})['then'](function(_0x4c9e46){if(_0x4c9e46){_0x4e1777=_0x4c9e46[_0xeb7a('0x33')];if(!_0x4ded8[_0xeb7a('0x30')][_0xeb7a('0x34')](_0xeb7a('0x4a'))){_0xb435cd[_0xeb7a('0x19')]=qs[_0xeb7a('0x19')](_0x4ded8[_0xeb7a('0x30')][_0xeb7a('0x19')]);_0xb435cd[_0xeb7a('0x18')]=qs['offset'](_0x4ded8[_0xeb7a('0x30')][_0xeb7a('0x18')]);}return _0x298cb9['getFields'](_0xb435cd);}})[_0xeb7a('0x20')](function(_0x4ab093){if(_0x4ab093){return _0x4ab093?{'count':_0x4e1777,'rows':_0x4ab093}:null;}})[_0xeb7a('0x20')](respondWithResult(_0x158b54,null))[_0xeb7a('0x41')](handleError(_0x158b54,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 89b1dc6..a2561fd 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 _0x3fac=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x3a19d4,_0x3f19a4){var _0x5b858b=function(_0x4ddce5){while(--_0x4ddce5){_0x3a19d4['push'](_0x3a19d4['shift']());}};_0x5b858b(++_0x3f19a4);}(_0x3fac,0x168));var _0xc3fa=function(_0x5c9a5a,_0x4c8a5b){_0x5c9a5a=_0x5c9a5a-0x0;var _0x567c0e=_0x3fac[_0x5c9a5a];return _0x567c0e;};'use strict';var _=require(_0xc3fa('0x0'));var util=require(_0xc3fa('0x1'));var logger=require(_0xc3fa('0x2'))(_0xc3fa('0x3'));var moment=require(_0xc3fa('0x4'));var BPromise=require(_0xc3fa('0x5'));var rp=require(_0xc3fa('0x6'));var fs=require('fs');var path=require(_0xc3fa('0x7'));var rimraf=require(_0xc3fa('0x8'));var config=require(_0xc3fa('0x9'));var attributes=require(_0xc3fa('0xa'));module[_0xc3fa('0xb')]=function(_0x2cb148,_0x341ade){return _0x2cb148[_0xc3fa('0xc')](_0xc3fa('0xd'),attributes,{'tableName':_0xc3fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47dc=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x373ec4,_0x1cfce0){var _0x5b33b4=function(_0x237756){while(--_0x237756){_0x373ec4['push'](_0x373ec4['shift']());}};_0x5b33b4(++_0x1cfce0);}(_0x47dc,0x104));var _0xc47d=function(_0x3a4539,_0x213a26){_0x3a4539=_0x3a4539-0x0;var _0x3d0b4e=_0x47dc[_0x3a4539];return _0x3d0b4e;};'use strict';var _=require(_0xc47d('0x0'));var util=require('util');var logger=require(_0xc47d('0x1'))(_0xc47d('0x2'));var moment=require(_0xc47d('0x3'));var BPromise=require(_0xc47d('0x4'));var rp=require(_0xc47d('0x5'));var fs=require('fs');var path=require(_0xc47d('0x6'));var rimraf=require(_0xc47d('0x7'));var config=require(_0xc47d('0x8'));var attributes=require(_0xc47d('0x9'));module['exports']=function(_0x360e0f,_0x41ad56){return _0x360e0f[_0xc47d('0xa')](_0xc47d('0xb'),attributes,{'tableName':_0xc47d('0xc'),'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 4e99520..70acd85 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 _0xefab=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0xefab,0x1b5));var _0xbefa=function(_0xc9c8ca,_0xbc7ae3){_0xc9c8ca=_0xc9c8ca-0x0;var _0x59fc76=_0xefab[_0xc9c8ca];return _0x59fc76;};'use strict';var _=require(_0xbefa('0x0'));var util=require(_0xbefa('0x1'));var moment=require(_0xbefa('0x2'));var BPromise=require(_0xbefa('0x3'));var rs=require(_0xbefa('0x4'));var fs=require('fs');var Redis=require(_0xbefa('0x5'));var db=require(_0xbefa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbefa('0x7'))('rpc');var config=require(_0xbefa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbefa('0x9')][_0xbefa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bf7a3,_0x54c408,_0x502557){return new BPromise(function(_0x195247,_0x4581f1){return client['request'](_0x1bf7a3,_0x502557)[_0xbefa('0xb')](function(_0x6f66f9){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x54c408,_0xbefa('0xc'));logger[_0xbefa('0xd')](_0xbefa('0xe'),_0x54c408,'request\x20sent',JSON[_0xbefa('0xf')](_0x6f66f9));if(_0x6f66f9[_0xbefa('0x10')]){if(_0x6f66f9['error'][_0xbefa('0x11')]===0x1f4){logger[_0xbefa('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x54c408,_0x6f66f9[_0xbefa('0x10')][_0xbefa('0x12')]);return _0x4581f1(_0x6f66f9[_0xbefa('0x10')][_0xbefa('0x12')]);}logger[_0xbefa('0x10')](_0xbefa('0x13'),_0x54c408,_0x6f66f9['error'][_0xbefa('0x12')]);return _0x195247(_0x6f66f9[_0xbefa('0x10')]['message']);}else{logger['info'](_0xbefa('0x13'),_0x54c408,_0xbefa('0xc'));_0x195247(_0x6f66f9[_0xbefa('0x14')][_0xbefa('0x12')]);}})[_0xbefa('0x15')](function(_0x3c1c64){logger['error'](_0xbefa('0x13'),_0x54c408,_0x3c1c64);_0x4581f1(_0x3c1c64);});});} \ No newline at end of file +var _0xdec0=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x57f621,_0x3cf0a2){var _0x463fd2=function(_0x14d808){while(--_0x14d808){_0x57f621['push'](_0x57f621['shift']());}};_0x463fd2(++_0x3cf0a2);}(_0xdec0,0x90));var _0x0dec=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0xdec0[_0x3e85a4];return _0x21e7d1;};'use strict';var _=require(_0x0dec('0x0'));var util=require(_0x0dec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0dec('0x2'));var fs=require('fs');var Redis=require(_0x0dec('0x3'));var db=require(_0x0dec('0x4'))['db'];var utils=require(_0x0dec('0x5'));var logger=require(_0x0dec('0x6'))(_0x0dec('0x7'));var config=require(_0x0dec('0x8'));var jayson=require(_0x0dec('0x9'));var client=jayson[_0x0dec('0xa')][_0x0dec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32a1ee,_0x1b2ff3,_0x1dd6c9){return new BPromise(function(_0x5a4c9f,_0x4516e2){return client['request'](_0x32a1ee,_0x1dd6c9)[_0x0dec('0xc')](function(_0x4f6a27){logger[_0x0dec('0xd')](_0x0dec('0xe'),_0x1b2ff3,_0x0dec('0xf'));logger[_0x0dec('0x10')](_0x0dec('0x11'),_0x1b2ff3,'request\x20sent',JSON[_0x0dec('0x12')](_0x4f6a27));if(_0x4f6a27[_0x0dec('0x13')]){if(_0x4f6a27[_0x0dec('0x13')][_0x0dec('0x14')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b2ff3,_0x4f6a27['error']['message']);return _0x4516e2(_0x4f6a27[_0x0dec('0x13')][_0x0dec('0x15')]);}logger['error'](_0x0dec('0xe'),_0x1b2ff3,_0x4f6a27[_0x0dec('0x13')][_0x0dec('0x15')]);return _0x5a4c9f(_0x4f6a27[_0x0dec('0x13')][_0x0dec('0x15')]);}else{logger[_0x0dec('0xd')](_0x0dec('0xe'),_0x1b2ff3,'request\x20sent');_0x5a4c9f(_0x4f6a27[_0x0dec('0x16')][_0x0dec('0x15')]);}})[_0x0dec('0x17')](function(_0x39eda0){logger[_0x0dec('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b2ff3,_0x39eda0);_0x4516e2(_0x39eda0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 994e48e..265c14e 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 _0xcb91=['get','index','isAuthenticated','show','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller'];(function(_0x337554,_0x418be3){var _0x23460e=function(_0x22a027){while(--_0x22a027){_0x337554['push'](_0x337554['shift']());}};_0x23460e(++_0x418be3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xcb91[_0x43f881];return _0x365c14;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['post']('/',auth[_0x1cb9('0x9')](),controller['create']);router['put'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xe')]);module[_0x1cb9('0xf')]=router; \ No newline at end of file +var _0xec56=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0xc355be,_0x580c3e){var _0x3acf74=function(_0x4eedce){while(--_0x4eedce){_0xc355be['push'](_0xc355be['shift']());}};_0x3acf74(++_0x580c3e);}(_0xec56,0x1bd));var _0x6ec5=function(_0x53c298,_0x25781e){_0x53c298=_0x53c298-0x0;var _0x5f5752=_0xec56[_0x53c298];return _0x5f5752;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0xe')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router[_0x6ec5('0x10')]('/:id',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x12')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x13')]);module[_0x6ec5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9219568..ee5fb64 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 _0xc37f=['string','variable','picklist','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xc37f,0x130));var _0xfc37=function(_0x232ef3,_0x58d1c1){_0x232ef3=_0x232ef3-0x0;var _0x1cb733=_0xc37f[_0x232ef3];return _0x1cb733;};'use strict';var Sequelize=require(_0xfc37('0x0'));module[_0xfc37('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfc37('0x2'),_0xfc37('0x3'),'customVariable','keyValue',_0xfc37('0x4')),'defaultValue':_0xfc37('0x2')},'content':{'type':Sequelize[_0xfc37('0x5')]},'key':{'type':Sequelize[_0xfc37('0x5')]},'keyType':{'type':Sequelize[_0xfc37('0x6')](_0xfc37('0x2'),'variable',_0xfc37('0x7'))},'keyContent':{'type':Sequelize[_0xfc37('0x5')]},'idField':{'type':Sequelize[_0xfc37('0x5')]},'nameField':{'type':Sequelize[_0xfc37('0x5')]},'customField':{'type':Sequelize[_0xfc37('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd12e=['customVariable','keyValue','picklist','STRING','ENUM','string','variable','BOOLEAN','sequelize','exports'];(function(_0x4898bf,_0x18a5c1){var _0x2d48a9=function(_0x40ad2c){while(--_0x40ad2c){_0x4898bf['push'](_0x4898bf['shift']());}};_0x2d48a9(++_0x18a5c1);}(_0xd12e,0x184));var _0xed12=function(_0x239829,_0x16527d){_0x239829=_0x239829-0x0;var _0xab3c82=_0xd12e[_0x239829];return _0xab3c82;};'use strict';var Sequelize=require(_0xed12('0x0'));module[_0xed12('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xed12('0x2'),_0xed12('0x3'),_0xed12('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xed12('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xed12('0x6')](_0xed12('0x7'),_0xed12('0x8'),_0xed12('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xed12('0x5')]},'nameField':{'type':Sequelize[_0xed12('0x5')]},'customField':{'type':Sequelize[_0xed12('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xed12('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 2efa67c..22be321 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 _0x439e=['filter','VIRTUAL','options','FreshsalesField','include','findAll','rows','catch','show','params','includeAll','merge','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','count','limit','set','apply','reject','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x439e,0xa0));var _0xe439=function(_0x1ed2e2,_0x1adca1){_0x1ed2e2=_0x1ed2e2-0x0;var _0x446b98=_0x439e[_0x1ed2e2];return _0x446b98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe439('0x0'));var zipdir=require(_0xe439('0x1'));var jsonpatch=require(_0xe439('0x2'));var rp=require(_0xe439('0x3'));var moment=require('moment');var BPromise=require(_0xe439('0x4'));var Mustache=require(_0xe439('0x5'));var util=require(_0xe439('0x6'));var path=require(_0xe439('0x7'));var sox=require(_0xe439('0x8'));var csv=require(_0xe439('0x9'));var ejs=require(_0xe439('0xa'));var fs=require('fs');var fs_extra=require(_0xe439('0xb'));var _=require(_0xe439('0xc'));var squel=require(_0xe439('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe439('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe439('0xf'));var Papa=require(_0xe439('0x10'));var Redis=require('ioredis');var authService=require(_0xe439('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe439('0x12'));var logger=require(_0xe439('0x13'))('api');var utils=require(_0xe439('0x14'));var config=require(_0xe439('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe439('0x16'))['db'];function respondWithStatusCode(_0x114c24,_0x78c12){_0x78c12=_0x78c12||0xcc;return function(_0x2ee2aa){if(_0x2ee2aa){return _0x114c24[_0xe439('0x17')](_0x78c12);}return _0x114c24[_0xe439('0x18')](_0x78c12)[_0xe439('0x19')]();};}function respondWithResult(_0x1d32f1,_0x4d7746){_0x4d7746=_0x4d7746||0xc8;return function(_0x4fac50){if(_0x4fac50){return _0x1d32f1['status'](_0x4d7746)['json'](_0x4fac50);}};}function respondWithFilteredResult(_0x23a8d9,_0x141b7e){return function(_0x2f18cb){if(_0x2f18cb){var _0x496c83=typeof _0x141b7e[_0xe439('0x1a')]==='undefined'&&typeof _0x141b7e['limit']==='undefined';var _0x51ee59=_0x2f18cb['count'];var _0x205edf=_0x496c83?0x0:_0x141b7e[_0xe439('0x1a')];var _0x53e3ba=_0x496c83?_0x2f18cb[_0xe439('0x1b')]:_0x141b7e[_0xe439('0x1a')]+_0x141b7e[_0xe439('0x1c')];var _0x5302b1;if(_0x53e3ba>=_0x51ee59){_0x53e3ba=_0x51ee59;_0x5302b1=0xc8;}else{_0x5302b1=0xce;}_0x23a8d9[_0xe439('0x18')](_0x5302b1);return _0x23a8d9[_0xe439('0x1d')]('Content-Range',_0x205edf+'-'+_0x53e3ba+'/'+_0x51ee59)['json'](_0x2f18cb);}return null;};}function patchUpdates(_0x3bbea8){return function(_0x2e1dec){try{jsonpatch[_0xe439('0x1e')](_0x2e1dec,_0x3bbea8,!![]);}catch(_0x1f753b){return BPromise[_0xe439('0x1f')](_0x1f753b);}return _0x2e1dec['save']();};}function saveUpdates(_0xa9ba13,_0x4a0801){return function(_0x2a74d7){if(_0x2a74d7){return _0x2a74d7[_0xe439('0x20')](_0xa9ba13)['then'](function(_0x1c0cd7){return _0x1c0cd7;});}return null;};}function removeEntity(_0x4c5e6b,_0x1338e0){return function(_0x47a3e9){if(_0x47a3e9){return _0x47a3e9['destroy']()[_0xe439('0x21')](function(){_0x4c5e6b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a4f6f,_0x45f439){return function(_0x457741){if(!_0x457741){_0x3a4f6f[_0xe439('0x17')](0x194);}return _0x457741;};}function handleError(_0x2e2015,_0x3c1ca0){_0x3c1ca0=_0x3c1ca0||0x1f4;return function(_0x5376f3){logger[_0xe439('0x22')](_0x5376f3[_0xe439('0x23')]);if(_0x5376f3[_0xe439('0x24')]){delete _0x5376f3['name'];}_0x2e2015['status'](_0x3c1ca0)[_0xe439('0x25')](_0x5376f3);};}exports['index']=function(_0x45f3cc,_0x420849){var _0x352374={},_0x543bac={},_0x297b43={'count':0x0,'rows':[]};var _0x5f4690=_[_0xe439('0x26')](db['FreshsalesField'][_0xe439('0x27')],function(_0x40fbfd){return{'name':_0x40fbfd[_0xe439('0x28')],'type':_0x40fbfd[_0xe439('0x29')]['key']};});_0x543bac[_0xe439('0x2a')]=_[_0xe439('0x26')](_0x5f4690,_0xe439('0x24'));_0x543bac['query']=_[_0xe439('0x2b')](_0x45f3cc[_0xe439('0x2c')]);_0x543bac[_0xe439('0x2d')]=_[_0xe439('0x2e')](_0x543bac[_0xe439('0x2a')],_0x543bac[_0xe439('0x2c')]);_0x352374[_0xe439('0x2f')]=_[_0xe439('0x2e')](_0x543bac[_0xe439('0x2a')],qs[_0xe439('0x30')](_0x45f3cc[_0xe439('0x2c')]['fields']));_0x352374[_0xe439('0x2f')]=_0x352374[_0xe439('0x2f')][_0xe439('0x31')]?_0x352374[_0xe439('0x2f')]:_0x543bac['model'];if(!_0x45f3cc[_0xe439('0x2c')][_0xe439('0x32')](_0xe439('0x33'))){_0x352374[_0xe439('0x1c')]=qs[_0xe439('0x1c')](_0x45f3cc[_0xe439('0x2c')][_0xe439('0x1c')]);_0x352374[_0xe439('0x1a')]=qs[_0xe439('0x1a')](_0x45f3cc[_0xe439('0x2c')][_0xe439('0x1a')]);}_0x352374[_0xe439('0x34')]=qs['sort'](_0x45f3cc[_0xe439('0x2c')][_0xe439('0x35')]);_0x352374[_0xe439('0x36')]=qs[_0xe439('0x2d')](_[_0xe439('0x37')](_0x45f3cc[_0xe439('0x2c')],_0x543bac[_0xe439('0x2d')]),_0x5f4690);if(_0x45f3cc[_0xe439('0x2c')][_0xe439('0x38')]){_0x352374[_0xe439('0x36')]=_['merge'](_0x352374[_0xe439('0x36')],{'$or':_[_0xe439('0x26')](_0x5f4690,function(_0x1d1e16){if(_0x1d1e16[_0xe439('0x29')]!==_0xe439('0x39')){var _0xbc1bf2={};_0xbc1bf2[_0x1d1e16[_0xe439('0x24')]]={'$like':'%'+_0x45f3cc[_0xe439('0x2c')][_0xe439('0x38')]+'%'};return _0xbc1bf2;}})});}_0x352374=_['merge']({},_0x352374,_0x45f3cc[_0xe439('0x3a')]);var _0x4eca69={'where':_0x352374[_0xe439('0x36')]};return db[_0xe439('0x3b')][_0xe439('0x1b')](_0x4eca69)[_0xe439('0x21')](function(_0x1ba6bb){_0x297b43[_0xe439('0x1b')]=_0x1ba6bb;if(_0x45f3cc[_0xe439('0x2c')]['includeAll']){_0x352374[_0xe439('0x3c')]=[{'all':!![]}];}return db[_0xe439('0x3b')][_0xe439('0x3d')](_0x352374);})[_0xe439('0x21')](function(_0x5edba4){_0x297b43[_0xe439('0x3e')]=_0x5edba4;return _0x297b43;})[_0xe439('0x21')](respondWithFilteredResult(_0x420849,_0x352374))[_0xe439('0x3f')](handleError(_0x420849,null));};exports[_0xe439('0x40')]=function(_0x32586e,_0x2a32ec){var _0x1f65b3={'raw':!![],'where':{'id':_0x32586e[_0xe439('0x41')]['id']}},_0x57d9f2={};_0x57d9f2[_0xe439('0x2a')]=_[_0xe439('0x2b')](db[_0xe439('0x3b')]['rawAttributes']);_0x57d9f2[_0xe439('0x2c')]=_['keys'](_0x32586e[_0xe439('0x2c')]);_0x57d9f2[_0xe439('0x2d')]=_['intersection'](_0x57d9f2['model'],_0x57d9f2[_0xe439('0x2c')]);_0x1f65b3[_0xe439('0x2f')]=_[_0xe439('0x2e')](_0x57d9f2[_0xe439('0x2a')],qs['fields'](_0x32586e['query'][_0xe439('0x30')]));_0x1f65b3['attributes']=_0x1f65b3[_0xe439('0x2f')][_0xe439('0x31')]?_0x1f65b3['attributes']:_0x57d9f2['model'];if(_0x32586e[_0xe439('0x2c')][_0xe439('0x42')]){_0x1f65b3['include']=[{'all':!![]}];}_0x1f65b3=_[_0xe439('0x43')]({},_0x1f65b3,_0x32586e[_0xe439('0x3a')]);return db[_0xe439('0x3b')]['find'](_0x1f65b3)[_0xe439('0x21')](handleEntityNotFound(_0x2a32ec,null))['then'](respondWithResult(_0x2a32ec,null))[_0xe439('0x3f')](handleError(_0x2a32ec,null));};exports[_0xe439('0x44')]=function(_0x75cd2a,_0x2f04b0){return db[_0xe439('0x3b')]['create'](_0x75cd2a[_0xe439('0x45')],{})['then'](respondWithResult(_0x2f04b0,0xc9))[_0xe439('0x3f')](handleError(_0x2f04b0,null));};exports[_0xe439('0x20')]=function(_0x183939,_0x47d578){if(_0x183939[_0xe439('0x45')]['id']){delete _0x183939['body']['id'];}return db[_0xe439('0x3b')][_0xe439('0x46')]({'where':{'id':_0x183939[_0xe439('0x41')]['id']}})['then'](handleEntityNotFound(_0x47d578,null))[_0xe439('0x21')](saveUpdates(_0x183939[_0xe439('0x45')],null))['then'](respondWithResult(_0x47d578,null))[_0xe439('0x3f')](handleError(_0x47d578,null));};exports[_0xe439('0x47')]=function(_0x13f43a,_0x512627){return db[_0xe439('0x3b')][_0xe439('0x46')]({'where':{'id':_0x13f43a['params']['id']}})[_0xe439('0x21')](handleEntityNotFound(_0x512627,null))[_0xe439('0x21')](removeEntity(_0x512627,null))[_0xe439('0x3f')](handleError(_0x512627,null));}; \ No newline at end of file +var _0x5857=['offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','keys','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x53f5ec,_0x34bca9){var _0x4e2d6a=function(_0x31d64d){while(--_0x31d64d){_0x53f5ec['push'](_0x53f5ec['shift']());}};_0x4e2d6a(++_0x34bca9);}(_0x5857,0x150));var _0x7585=function(_0xd0c1,_0x597b51){_0xd0c1=_0xd0c1-0x0;var _0x500443=_0x5857[_0xd0c1];return _0x500443;};'use strict';var emlformat=require(_0x7585('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7585('0x1'));var rp=require(_0x7585('0x2'));var moment=require(_0x7585('0x3'));var BPromise=require(_0x7585('0x4'));var Mustache=require(_0x7585('0x5'));var util=require(_0x7585('0x6'));var path=require(_0x7585('0x7'));var sox=require(_0x7585('0x8'));var csv=require(_0x7585('0x9'));var ejs=require(_0x7585('0xa'));var fs=require('fs');var fs_extra=require(_0x7585('0xb'));var _=require('lodash');var squel=require(_0x7585('0xc'));var crypto=require('crypto');var jsforce=require(_0x7585('0xd'));var deskjs=require(_0x7585('0xe'));var toCsv=require(_0x7585('0x9'));var querystring=require('querystring');var Papa=require(_0x7585('0xf'));var Redis=require(_0x7585('0x10'));var authService=require(_0x7585('0x11'));var qs=require(_0x7585('0x12'));var as=require(_0x7585('0x13'));var hardwareService=require(_0x7585('0x14'));var logger=require('../../config/logger')(_0x7585('0x15'));var utils=require(_0x7585('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7585('0x17'));var db=require(_0x7585('0x18'))['db'];function respondWithStatusCode(_0x2c1f9b,_0xd1bc1a){_0xd1bc1a=_0xd1bc1a||0xcc;return function(_0x31ec4d){if(_0x31ec4d){return _0x2c1f9b[_0x7585('0x19')](_0xd1bc1a);}return _0x2c1f9b[_0x7585('0x1a')](_0xd1bc1a)[_0x7585('0x1b')]();};}function respondWithResult(_0x230251,_0x580e87){_0x580e87=_0x580e87||0xc8;return function(_0x345eaf){if(_0x345eaf){return _0x230251['status'](_0x580e87)[_0x7585('0x1c')](_0x345eaf);}};}function respondWithFilteredResult(_0x2cfcfd,_0x22bfc7){return function(_0x30d669){if(_0x30d669){var _0xf7ff66=typeof _0x22bfc7[_0x7585('0x1d')]===_0x7585('0x1e')&&typeof _0x22bfc7['limit']===_0x7585('0x1e');var _0x4be402=_0x30d669[_0x7585('0x1f')];var _0x2a6020=_0xf7ff66?0x0:_0x22bfc7['offset'];var _0x4c3fe6=_0xf7ff66?_0x30d669[_0x7585('0x1f')]:_0x22bfc7['offset']+_0x22bfc7[_0x7585('0x20')];var _0x2fcc79;if(_0x4c3fe6>=_0x4be402){_0x4c3fe6=_0x4be402;_0x2fcc79=0xc8;}else{_0x2fcc79=0xce;}_0x2cfcfd[_0x7585('0x1a')](_0x2fcc79);return _0x2cfcfd[_0x7585('0x21')](_0x7585('0x22'),_0x2a6020+'-'+_0x4c3fe6+'/'+_0x4be402)[_0x7585('0x1c')](_0x30d669);}return null;};}function patchUpdates(_0x564f8){return function(_0x1aa5ff){try{jsonpatch[_0x7585('0x23')](_0x1aa5ff,_0x564f8,!![]);}catch(_0x76a6af){return BPromise[_0x7585('0x24')](_0x76a6af);}return _0x1aa5ff['save']();};}function saveUpdates(_0x47ae6f,_0x3dd4d6){return function(_0x181418){if(_0x181418){return _0x181418[_0x7585('0x25')](_0x47ae6f)[_0x7585('0x26')](function(_0x1fc467){return _0x1fc467;});}return null;};}function removeEntity(_0x1f4366,_0x3e12c3){return function(_0x3f47d3){if(_0x3f47d3){return _0x3f47d3[_0x7585('0x27')]()[_0x7585('0x26')](function(){_0x1f4366[_0x7585('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x326c21,_0x598b3f){return function(_0x26401a){if(!_0x26401a){_0x326c21[_0x7585('0x19')](0x194);}return _0x26401a;};}function handleError(_0x2c0523,_0x2eefa8){_0x2eefa8=_0x2eefa8||0x1f4;return function(_0x43fc81){logger['error'](_0x43fc81[_0x7585('0x28')]);if(_0x43fc81[_0x7585('0x29')]){delete _0x43fc81['name'];}_0x2c0523['status'](_0x2eefa8)[_0x7585('0x2a')](_0x43fc81);};}exports[_0x7585('0x2b')]=function(_0x173b7c,_0x4c30f9){var _0x515e50={},_0x19c2ae={},_0x156fff={'count':0x0,'rows':[]};var _0x4d0989=_[_0x7585('0x2c')](db[_0x7585('0x2d')][_0x7585('0x2e')],function(_0x5bd050){return{'name':_0x5bd050[_0x7585('0x2f')],'type':_0x5bd050[_0x7585('0x30')][_0x7585('0x31')]};});_0x19c2ae[_0x7585('0x32')]=_[_0x7585('0x2c')](_0x4d0989,_0x7585('0x29'));_0x19c2ae['query']=_['keys'](_0x173b7c[_0x7585('0x33')]);_0x19c2ae[_0x7585('0x34')]=_[_0x7585('0x35')](_0x19c2ae['model'],_0x19c2ae[_0x7585('0x33')]);_0x515e50[_0x7585('0x36')]=_[_0x7585('0x35')](_0x19c2ae[_0x7585('0x32')],qs[_0x7585('0x37')](_0x173b7c['query'][_0x7585('0x37')]));_0x515e50[_0x7585('0x36')]=_0x515e50['attributes'][_0x7585('0x38')]?_0x515e50['attributes']:_0x19c2ae[_0x7585('0x32')];if(!_0x173b7c[_0x7585('0x33')]['hasOwnProperty']('nolimit')){_0x515e50[_0x7585('0x20')]=qs[_0x7585('0x20')](_0x173b7c[_0x7585('0x33')][_0x7585('0x20')]);_0x515e50[_0x7585('0x1d')]=qs[_0x7585('0x1d')](_0x173b7c['query']['offset']);}_0x515e50[_0x7585('0x39')]=qs[_0x7585('0x3a')](_0x173b7c['query'][_0x7585('0x3a')]);_0x515e50[_0x7585('0x3b')]=qs[_0x7585('0x34')](_['pick'](_0x173b7c[_0x7585('0x33')],_0x19c2ae[_0x7585('0x34')]),_0x4d0989);if(_0x173b7c['query']['filter']){_0x515e50[_0x7585('0x3b')]=_['merge'](_0x515e50[_0x7585('0x3b')],{'$or':_[_0x7585('0x2c')](_0x4d0989,function(_0x4740d1){if(_0x4740d1[_0x7585('0x30')]!==_0x7585('0x3c')){var _0x5ad3f5={};_0x5ad3f5[_0x4740d1[_0x7585('0x29')]]={'$like':'%'+_0x173b7c[_0x7585('0x33')][_0x7585('0x3d')]+'%'};return _0x5ad3f5;}})});}_0x515e50=_[_0x7585('0x3e')]({},_0x515e50,_0x173b7c[_0x7585('0x3f')]);var _0x185783={'where':_0x515e50[_0x7585('0x3b')]};return db['FreshsalesField'][_0x7585('0x1f')](_0x185783)[_0x7585('0x26')](function(_0x21b22f){_0x156fff[_0x7585('0x1f')]=_0x21b22f;if(_0x173b7c[_0x7585('0x33')]['includeAll']){_0x515e50[_0x7585('0x40')]=[{'all':!![]}];}return db[_0x7585('0x2d')][_0x7585('0x41')](_0x515e50);})[_0x7585('0x26')](function(_0x4cd842){_0x156fff['rows']=_0x4cd842;return _0x156fff;})[_0x7585('0x26')](respondWithFilteredResult(_0x4c30f9,_0x515e50))[_0x7585('0x42')](handleError(_0x4c30f9,null));};exports[_0x7585('0x43')]=function(_0x4f75ee,_0x461969){var _0x172404={'raw':!![],'where':{'id':_0x4f75ee[_0x7585('0x44')]['id']}},_0x36599b={};_0x36599b['model']=_['keys'](db[_0x7585('0x2d')][_0x7585('0x2e')]);_0x36599b[_0x7585('0x33')]=_[_0x7585('0x45')](_0x4f75ee[_0x7585('0x33')]);_0x36599b[_0x7585('0x34')]=_[_0x7585('0x35')](_0x36599b[_0x7585('0x32')],_0x36599b[_0x7585('0x33')]);_0x172404[_0x7585('0x36')]=_[_0x7585('0x35')](_0x36599b['model'],qs[_0x7585('0x37')](_0x4f75ee[_0x7585('0x33')]['fields']));_0x172404['attributes']=_0x172404[_0x7585('0x36')][_0x7585('0x38')]?_0x172404[_0x7585('0x36')]:_0x36599b[_0x7585('0x32')];if(_0x4f75ee[_0x7585('0x33')]['includeAll']){_0x172404[_0x7585('0x40')]=[{'all':!![]}];}_0x172404=_['merge']({},_0x172404,_0x4f75ee[_0x7585('0x3f')]);return db[_0x7585('0x2d')]['find'](_0x172404)['then'](handleEntityNotFound(_0x461969,null))[_0x7585('0x26')](respondWithResult(_0x461969,null))[_0x7585('0x42')](handleError(_0x461969,null));};exports[_0x7585('0x46')]=function(_0x58d0f0,_0x4dc4a0){return db[_0x7585('0x2d')][_0x7585('0x46')](_0x58d0f0[_0x7585('0x47')],{})['then'](respondWithResult(_0x4dc4a0,0xc9))[_0x7585('0x42')](handleError(_0x4dc4a0,null));};exports['update']=function(_0x1cfb28,_0x49a766){if(_0x1cfb28[_0x7585('0x47')]['id']){delete _0x1cfb28['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x1cfb28['params']['id']}})['then'](handleEntityNotFound(_0x49a766,null))[_0x7585('0x26')](saveUpdates(_0x1cfb28[_0x7585('0x47')],null))[_0x7585('0x26')](respondWithResult(_0x49a766,null))[_0x7585('0x42')](handleError(_0x49a766,null));};exports['destroy']=function(_0x18093b,_0x2dc9e7){return db[_0x7585('0x2d')][_0x7585('0x48')]({'where':{'id':_0x18093b[_0x7585('0x44')]['id']}})[_0x7585('0x26')](handleEntityNotFound(_0x2dc9e7,null))[_0x7585('0x26')](removeEntity(_0x2dc9e7,null))[_0x7585('0x42')](handleError(_0x2dc9e7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 035fc15..a0d42eb 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 _0xe77c=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','moment'];(function(_0x2441a3,_0xf3c5aa){var _0x443847=function(_0x3515a8){while(--_0x3515a8){_0x2441a3['push'](_0x2441a3['shift']());}};_0x443847(++_0xf3c5aa);}(_0xe77c,0x176));var _0xce77=function(_0x67b075,_0x43557d){_0x67b075=_0x67b075-0x0;var _0x39d030=_0xe77c[_0x67b075];return _0x39d030;};'use strict';var _=require(_0xce77('0x0'));var util=require(_0xce77('0x1'));var logger=require(_0xce77('0x2'))('api');var moment=require(_0xce77('0x3'));var BPromise=require(_0xce77('0x4'));var rp=require(_0xce77('0x5'));var fs=require('fs');var path=require(_0xce77('0x6'));var rimraf=require(_0xce77('0x7'));var config=require(_0xce77('0x8'));var attributes=require(_0xce77('0x9'));module['exports']=function(_0x5aea39,_0xed47c5){return _0x5aea39['define'](_0xce77('0xa'),attributes,{'tableName':_0xce77('0xb'),'paranoid':![],'indexes':[{'name':_0xce77('0xc'),'fields':['idField',_0xce77('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9158=['idField','FieldId','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields'];(function(_0x2e48d5,_0x192618){var _0x4464ee=function(_0x186918){while(--_0x186918){_0x2e48d5['push'](_0x2e48d5['shift']());}};_0x4464ee(++_0x192618);}(_0x9158,0x16e));var _0x8915=function(_0x4e10db,_0x5d7a85){_0x4e10db=_0x4e10db-0x0;var _0x119921=_0x9158[_0x4e10db];return _0x119921;};'use strict';var _=require(_0x8915('0x0'));var util=require(_0x8915('0x1'));var logger=require(_0x8915('0x2'))('api');var moment=require(_0x8915('0x3'));var BPromise=require('bluebird');var rp=require(_0x8915('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8915('0x5'));var attributes=require(_0x8915('0x6'));module[_0x8915('0x7')]=function(_0x2cad3f,_0x455248){return _0x2cad3f[_0x8915('0x8')](_0x8915('0x9'),attributes,{'tableName':_0x8915('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x8915('0xb'),_0x8915('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index dee0bad..78e106a 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 _0x2bd8=['info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x468f31,_0x5a6cef){var _0x4b0a42=function(_0x18b651){while(--_0x18b651){_0x468f31['push'](_0x468f31['shift']());}};_0x4b0a42(++_0x5a6cef);}(_0x2bd8,0x130));var _0x82bd=function(_0xa248ac,_0x48272a){_0xa248ac=_0xa248ac-0x0;var _0x1ede04=_0x2bd8[_0xa248ac];return _0x1ede04;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){return client[_0x82bd('0xb')](_0x19dbb1,_0x226f60)['then'](function(_0x4a9b2c){logger['info'](_0x82bd('0xc'),_0x77d7a9,'request\x20sent');logger['debug'](_0x82bd('0xd'),_0x77d7a9,'request\x20sent',JSON['stringify'](_0x4a9b2c));if(_0x4a9b2c[_0x82bd('0xe')]){if(_0x4a9b2c[_0x82bd('0xe')]['code']===0x1f4){logger[_0x82bd('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x4a9b2c[_0x82bd('0xe')]['message']);return _0x4dc3a6(_0x4a9b2c[_0x82bd('0xe')][_0x82bd('0xf')]);}logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x4a9b2c['error'][_0x82bd('0xf')]);return _0x1f7463(_0x4a9b2c[_0x82bd('0xe')]['message']);}else{logger[_0x82bd('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x82bd('0x11'));_0x1f7463(_0x4a9b2c[_0x82bd('0x12')][_0x82bd('0xf')]);}})[_0x82bd('0x13')](function(_0x209081){logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x209081);_0x4dc3a6(_0x209081);});});} \ No newline at end of file +var _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x606534,_0x15e57e){var _0x164be5=function(_0x52151c){while(--_0x52151c){_0x606534['push'](_0x606534['shift']());}};_0x164be5(++_0x15e57e);}(_0x5496,0x175));var _0x6549=function(_0x3909e4,_0x553e53){_0x3909e4=_0x3909e4-0x0;var _0x4628a9=_0x5496[_0x3909e4];return _0x4628a9;};'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')]('FreshsalesField,\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')]('FreshsalesField,\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']('FreshsalesField,\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);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 7a1882f..fe0bfc8 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(_0xae9e19,_0x4052ad){var _0x56e48b=function(_0x480352){while(--_0x480352){_0xae9e19['push'](_0xae9e19['shift']());}};_0x56e48b(++_0x4052ad);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x38967b,_0x393abe){var _0x46b21d=function(_0x42388d){while(--_0x42388d){_0x38967b['push'](_0x38967b['shift']());}};_0x46b21d(++_0x393abe);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index d12b75f..0b369e2 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 _0x39d7=['newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x163052,_0x143517){var _0x1a6661=function(_0x4d072b){while(--_0x4d072b){_0x163052['push'](_0x163052['shift']());}};_0x1a6661(++_0x143517);}(_0x39d7,0x12d));var _0x739d=function(_0x886693,_0x541621){_0x886693=_0x886693-0x0;var _0x8d7e2f=_0x39d7[_0x886693];return _0x8d7e2f;};'use strict';var Sequelize=require(_0x739d('0x0'));module[_0x739d('0x1')]={'name':{'type':Sequelize[_0x739d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x739d('0x2')],'unique':_0x739d('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x739d('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x739d('0x2')]},'serverUrl':{'type':Sequelize[_0x739d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x739d('0x4')]('integrationTab',_0x739d('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xb145=['username','ENUM','integrationTab','exports','STRING'];(function(_0x1b9b95,_0x826896){var _0x14e10a=function(_0x143258){while(--_0x143258){_0x1b9b95['push'](_0x1b9b95['shift']());}};_0x14e10a(++_0x826896);}(_0xb145,0xa3));var _0x5b14=function(_0x4c3e69,_0x24446f){_0x4c3e69=_0x4c3e69-0x0;var _0x989e93=_0xb145[_0x4c3e69];return _0x989e93;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'remoteUri':{'type':Sequelize[_0x5b14('0x1')]},'password':{'type':Sequelize[_0x5b14('0x1')]},'clientId':{'type':Sequelize[_0x5b14('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x5b14('0x1')]},'serverUrl':{'type':Sequelize[_0x5b14('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5b14('0x3')](_0x5b14('0x4'),'newTab'),'defaultValue':_0x5b14('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 2212e4f..d298072 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 _0x01f6=['statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','name','send','map','SalesforceAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','filter','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','Subjects','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','IsRecurrence','Description','string','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','false','test'];(function(_0x354172,_0x46613e){var _0x4a4e51=function(_0x339e94){while(--_0x339e94){_0x354172['push'](_0x354172['shift']());}};_0x4a4e51(++_0x46613e);}(_0x01f6,0x173));var _0x601f=function(_0x25e2bc,_0x27d1ef){_0x25e2bc=_0x25e2bc-0x0;var _0x5152d3=_0x01f6[_0x25e2bc];return _0x5152d3;};'use strict';var emlformat=require(_0x601f('0x0'));var rimraf=require(_0x601f('0x1'));var zipdir=require(_0x601f('0x2'));var jsonpatch=require(_0x601f('0x3'));var rp=require('request-promise');var moment=require(_0x601f('0x4'));var BPromise=require(_0x601f('0x5'));var Mustache=require(_0x601f('0x6'));var util=require(_0x601f('0x7'));var path=require(_0x601f('0x8'));var sox=require(_0x601f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x601f('0xa'));var _=require(_0x601f('0xb'));var squel=require(_0x601f('0xc'));var crypto=require(_0x601f('0xd'));var jsforce=require(_0x601f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x601f('0xf'));var querystring=require(_0x601f('0x10'));var Papa=require(_0x601f('0x11'));var Redis=require(_0x601f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x601f('0x13'));var as=require(_0x601f('0x14'));var hardwareService=require(_0x601f('0x15'));var logger=require(_0x601f('0x16'))(_0x601f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x601f('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x601f('0x19'));function respondWithStatusCode(_0x2234ba,_0x40fa5f){_0x40fa5f=_0x40fa5f||0xcc;return function(_0x298f05){if(_0x298f05){return _0x2234ba[_0x601f('0x1a')](_0x40fa5f);}return _0x2234ba[_0x601f('0x1b')](_0x40fa5f)[_0x601f('0x1c')]();};}function respondWithResult(_0x556302,_0x30c052){_0x30c052=_0x30c052||0xc8;return function(_0x2ee9ec){if(_0x2ee9ec){return _0x556302['status'](_0x30c052)[_0x601f('0x1d')](_0x2ee9ec);}};}function respondWithFilteredResult(_0x52c1ac,_0x5b1d75){return function(_0x507981){if(_0x507981){var _0x3c9a39=typeof _0x5b1d75[_0x601f('0x1e')]===_0x601f('0x1f')&&typeof _0x5b1d75[_0x601f('0x20')]==='undefined';var _0x1c8be9=_0x507981['count'];var _0x54a2b9=_0x3c9a39?0x0:_0x5b1d75[_0x601f('0x1e')];var _0x4b311c=_0x3c9a39?_0x507981[_0x601f('0x21')]:_0x5b1d75[_0x601f('0x1e')]+_0x5b1d75[_0x601f('0x20')];var _0x2e4434;if(_0x4b311c>=_0x1c8be9){_0x4b311c=_0x1c8be9;_0x2e4434=0xc8;}else{_0x2e4434=0xce;}_0x52c1ac['status'](_0x2e4434);return _0x52c1ac[_0x601f('0x22')]('Content-Range',_0x54a2b9+'-'+_0x4b311c+'/'+_0x1c8be9)[_0x601f('0x1d')](_0x507981);}return null;};}function patchUpdates(_0x6c03df){return function(_0x4d67bd){try{jsonpatch['apply'](_0x4d67bd,_0x6c03df,!![]);}catch(_0x40b5a6){return BPromise[_0x601f('0x23')](_0x40b5a6);}return _0x4d67bd['save']();};}function saveUpdates(_0x3ecbc1,_0x536252){return function(_0x1f84d4){if(_0x1f84d4){return _0x1f84d4[_0x601f('0x24')](_0x3ecbc1)[_0x601f('0x25')](function(_0x3469eb){return _0x3469eb;});}return null;};}function removeEntity(_0x3c8583,_0x5f204d){return function(_0x5cd88b){if(_0x5cd88b){return _0x5cd88b[_0x601f('0x26')]()[_0x601f('0x25')](function(){_0x3c8583[_0x601f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c9cef,_0x4534f7){return function(_0xe2e32b){if(!_0xe2e32b){_0x5c9cef['sendStatus'](0x194);}return _0xe2e32b;};}function handleError(_0x228072,_0xdddef0){_0xdddef0=_0xdddef0||0x1f4;return function(_0x2e35ca){logger[_0x601f('0x27')](_0x2e35ca['stack']);if(_0x2e35ca[_0x601f('0x28')]){delete _0x2e35ca[_0x601f('0x28')];}_0x228072[_0x601f('0x1b')](_0xdddef0)[_0x601f('0x29')](_0x2e35ca);};}exports['index']=function(_0x54da36,_0x3eef22){var _0x273c8f={},_0x592dd2={},_0x2d6447={'count':0x0,'rows':[]};var _0x35f894=_[_0x601f('0x2a')](db[_0x601f('0x2b')][_0x601f('0x2c')],function(_0x147816){return{'name':_0x147816[_0x601f('0x2d')],'type':_0x147816['type']['key']};});_0x592dd2[_0x601f('0x2e')]=_[_0x601f('0x2a')](_0x35f894,_0x601f('0x28'));_0x592dd2['query']=_[_0x601f('0x2f')](_0x54da36[_0x601f('0x30')]);_0x592dd2[_0x601f('0x31')]=_[_0x601f('0x32')](_0x592dd2[_0x601f('0x2e')],_0x592dd2[_0x601f('0x30')]);_0x273c8f['attributes']=_['intersection'](_0x592dd2[_0x601f('0x2e')],qs['fields'](_0x54da36[_0x601f('0x30')][_0x601f('0x33')]));_0x273c8f[_0x601f('0x34')]=_0x273c8f['attributes'][_0x601f('0x35')]?_0x273c8f[_0x601f('0x34')]:_0x592dd2['model'];if(!_0x54da36['query'][_0x601f('0x36')](_0x601f('0x37'))){_0x273c8f[_0x601f('0x20')]=qs[_0x601f('0x20')](_0x54da36['query'][_0x601f('0x20')]);_0x273c8f[_0x601f('0x1e')]=qs['offset'](_0x54da36[_0x601f('0x30')][_0x601f('0x1e')]);}_0x273c8f[_0x601f('0x38')]=qs[_0x601f('0x39')](_0x54da36[_0x601f('0x30')][_0x601f('0x39')]);_0x273c8f[_0x601f('0x3a')]=qs[_0x601f('0x31')](_['pick'](_0x54da36['query'],_0x592dd2[_0x601f('0x31')]),_0x35f894);if(_0x54da36[_0x601f('0x30')]['filter']){_0x273c8f[_0x601f('0x3a')]=_[_0x601f('0x3b')](_0x273c8f[_0x601f('0x3a')],{'$or':_[_0x601f('0x2a')](_0x35f894,function(_0x17e30e){if(_0x17e30e[_0x601f('0x3c')]!==_0x601f('0x3d')){var _0x29cf1a={};_0x29cf1a[_0x17e30e[_0x601f('0x28')]]={'$like':'%'+_0x54da36[_0x601f('0x30')]['filter']+'%'};return _0x29cf1a;}})});}_0x273c8f=_['merge']({},_0x273c8f,_0x54da36[_0x601f('0x3e')]);var _0x193a34={'where':_0x273c8f[_0x601f('0x3a')]};return db[_0x601f('0x2b')][_0x601f('0x21')](_0x193a34)[_0x601f('0x25')](function(_0x16d7fc){_0x2d6447[_0x601f('0x21')]=_0x16d7fc;if(_0x54da36[_0x601f('0x30')][_0x601f('0x3f')]){_0x273c8f[_0x601f('0x40')]=[{'all':!![]}];}return db[_0x601f('0x2b')]['findAll'](_0x273c8f);})[_0x601f('0x25')](function(_0x264280){_0x2d6447[_0x601f('0x41')]=_0x264280;return _0x2d6447;})['then'](respondWithFilteredResult(_0x3eef22,_0x273c8f))[_0x601f('0x42')](handleError(_0x3eef22,null));};exports[_0x601f('0x43')]=function(_0xbddca8,_0x2e56f7){var _0x17947d={'raw':![],'where':{'id':_0xbddca8[_0x601f('0x44')]['id']}},_0x3fac6c={};_0x3fac6c[_0x601f('0x2e')]=_['keys'](db[_0x601f('0x2b')][_0x601f('0x2c')]);_0x3fac6c[_0x601f('0x30')]=_['keys'](_0xbddca8['query']);_0x3fac6c[_0x601f('0x31')]=_[_0x601f('0x32')](_0x3fac6c[_0x601f('0x2e')],_0x3fac6c[_0x601f('0x30')]);_0x17947d[_0x601f('0x34')]=_[_0x601f('0x32')](_0x3fac6c['model'],qs[_0x601f('0x33')](_0xbddca8[_0x601f('0x30')]['fields']));_0x17947d['attributes']=_0x17947d[_0x601f('0x34')]['length']?_0x17947d[_0x601f('0x34')]:_0x3fac6c[_0x601f('0x2e')];if(_0xbddca8['query'][_0x601f('0x3f')]){_0x17947d['include']=[{'all':!![]}];}_0x17947d=_[_0x601f('0x3b')]({},_0x17947d,_0xbddca8['options']);return db['SalesforceAccount'][_0x601f('0x45')](_0x17947d)['then'](handleEntityNotFound(_0x2e56f7,null))[_0x601f('0x25')](respondWithResult(_0x2e56f7,null))[_0x601f('0x42')](handleError(_0x2e56f7,null));};exports[_0x601f('0x46')]=function(_0x526704,_0x3ffdd7){return db[_0x601f('0x2b')]['create'](_0x526704[_0x601f('0x47')],{})['then'](respondWithResult(_0x3ffdd7,0xc9))[_0x601f('0x42')](handleError(_0x3ffdd7,null));};exports[_0x601f('0x24')]=function(_0x51661e,_0x433a1a){if(_0x51661e[_0x601f('0x47')]['id']){delete _0x51661e[_0x601f('0x47')]['id'];}return db[_0x601f('0x2b')][_0x601f('0x45')]({'where':{'id':_0x51661e['params']['id']}})[_0x601f('0x25')](handleEntityNotFound(_0x433a1a,null))[_0x601f('0x25')](saveUpdates(_0x51661e[_0x601f('0x47')],null))[_0x601f('0x25')](respondWithResult(_0x433a1a,null))[_0x601f('0x42')](handleError(_0x433a1a,null));};exports['destroy']=function(_0x4437a0,_0x47167b){return db[_0x601f('0x2b')][_0x601f('0x45')]({'where':{'id':_0x4437a0[_0x601f('0x44')]['id']}})[_0x601f('0x25')](handleEntityNotFound(_0x47167b,null))[_0x601f('0x25')](removeEntity(_0x47167b,null))[_0x601f('0x42')](handleError(_0x47167b,null));};exports[_0x601f('0x48')]=function(_0x102c32,_0x2e5aa7,_0x18a1c7){var _0x135d92={};var _0x470550={};var _0x4775a1;var _0x323032;return db[_0x601f('0x2b')][_0x601f('0x49')]({'where':{'id':_0x102c32['params']['id']}})[_0x601f('0x25')](handleEntityNotFound(_0x2e5aa7,null))[_0x601f('0x25')](function(_0x11b7d2){if(_0x11b7d2){_0x4775a1=_0x11b7d2;_0x470550[_0x601f('0x2e')]=_[_0x601f('0x2f')](db[_0x601f('0x4a')]['rawAttributes']);_0x470550[_0x601f('0x30')]=_[_0x601f('0x2f')](_0x102c32[_0x601f('0x30')]);_0x470550[_0x601f('0x31')]=_[_0x601f('0x32')](_0x470550[_0x601f('0x2e')],_0x470550[_0x601f('0x30')]);_0x135d92[_0x601f('0x34')]=_['intersection'](_0x470550[_0x601f('0x2e')],qs['fields'](_0x102c32[_0x601f('0x30')]['fields']));_0x135d92[_0x601f('0x34')]=_0x135d92[_0x601f('0x34')][_0x601f('0x35')]?_0x135d92['attributes']:_0x470550['model'];_0x135d92[_0x601f('0x38')]=qs[_0x601f('0x39')](_0x102c32[_0x601f('0x30')][_0x601f('0x39')]);_0x135d92[_0x601f('0x3a')]=qs[_0x601f('0x31')](_['pick'](_0x102c32[_0x601f('0x30')],_0x470550['filters']));if(_0x102c32['query'][_0x601f('0x4b')]){_0x135d92[_0x601f('0x3a')]=_[_0x601f('0x3b')](_0x135d92[_0x601f('0x3a')],{'$or':_[_0x601f('0x2a')](_0x135d92[_0x601f('0x34')],function(_0x2b3b15){var _0x416493={};_0x416493[_0x2b3b15]={'$like':'%'+_0x102c32[_0x601f('0x30')][_0x601f('0x4b')]+'%'};return _0x416493;})});}_0x135d92=_[_0x601f('0x3b')]({},_0x135d92,_0x102c32[_0x601f('0x3e')]);return _0x4775a1['getConfigurations'](_0x135d92);}})[_0x601f('0x25')](function(_0x5aa1de){if(_0x5aa1de){_0x323032=_0x5aa1de[_0x601f('0x35')];if(!_0x102c32[_0x601f('0x30')][_0x601f('0x36')]('nolimit')){_0x135d92[_0x601f('0x20')]=qs[_0x601f('0x20')](_0x102c32[_0x601f('0x30')][_0x601f('0x20')]);_0x135d92[_0x601f('0x1e')]=qs['offset'](_0x102c32[_0x601f('0x30')][_0x601f('0x1e')]);}return _0x4775a1[_0x601f('0x48')](_0x135d92);}})[_0x601f('0x25')](function(_0x510175){if(_0x510175){return _0x510175?{'count':_0x323032,'rows':_0x510175}:null;}})[_0x601f('0x25')](respondWithResult(_0x2e5aa7,null))[_0x601f('0x42')](handleError(_0x2e5aa7,null));};exports[_0x601f('0x4c')]=function(_0x3d9ed6,_0x50290e,_0x1bea2b){if(_0x3d9ed6[_0x601f('0x47')]['id']){delete _0x3d9ed6[_0x601f('0x47')]['id'];}return db['SalesforceAccount'][_0x601f('0x49')]({'where':{'id':_0x3d9ed6[_0x601f('0x44')]['id']}})[_0x601f('0x25')](handleEntityNotFound(_0x50290e,null))[_0x601f('0x25')](function(_0x2567bd){if(_0x2567bd){_0x3d9ed6[_0x601f('0x47')][_0x601f('0x4d')]=_0x2567bd['id'];_0x3d9ed6[_0x601f('0x47')]['Subjects']=integrations[_0x601f('0x4e')](_0x3d9ed6[_0x601f('0x47')]['channel'],_0x3d9ed6['body'][_0x601f('0x3c')]);_0x3d9ed6[_0x601f('0x47')][_0x601f('0x4f')]=integrations[_0x601f('0x50')](_0x3d9ed6[_0x601f('0x47')][_0x601f('0x51')],_0x3d9ed6[_0x601f('0x47')]['type']);return db[_0x601f('0x4a')][_0x601f('0x46')](_0x3d9ed6[_0x601f('0x47')],{'include':[{'model':db[_0x601f('0x52')],'as':_0x601f('0x53')},{'model':db['SalesforceField'],'as':_0x601f('0x4f')}]});}return null;})[_0x601f('0x25')](respondWithResult(_0x50290e,null))[_0x601f('0x42')](handleError(_0x50290e,null));};exports['getFields']=function(_0x42f024,_0x1d3eea,_0x59292d){var _0x260262;var _0x2b5c3e='';var _0x372330='Task';return db[_0x601f('0x2b')]['findOne']({'where':{'id':_0x42f024[_0x601f('0x44')]['id']},'attributes':['id',_0x601f('0x54'),_0x601f('0x55'),_0x601f('0x56'),_0x601f('0x57'),_0x601f('0x58'),_0x601f('0x59')]})[_0x601f('0x25')](handleEntityNotFound(_0x1d3eea,null))[_0x601f('0x25')](function(_0xca9c59){if(_0xca9c59){_0x2b5c3e=_0xca9c59[_0x601f('0x54')];var _0x33616b=_0x2b5c3e[_0x601f('0x5a')](-0x1);if(_0x33616b==='/'){_0x2b5c3e=_0x2b5c3e[_0x601f('0x5b')](0x0,_0x2b5c3e['lastIndexOf'](_0x33616b));}_0x260262=new jsforce[(_0x601f('0x5c'))]({'oauth2':{'loginUrl':_0x2b5c3e,'clientId':_0xca9c59[_0x601f('0x55')],'clientSecret':_0xca9c59[_0x601f('0x56')]}});return _0x260262[_0x601f('0x5d')](_0xca9c59[_0x601f('0x57')],_0xca9c59[_0x601f('0x58')][_0x601f('0x5e')](_0xca9c59[_0x601f('0x59')]));}})['then'](function(_0x5979f9){if(_0x5979f9){if(!_[_0x601f('0x5f')](_0x42f024['query'][_0x601f('0x60')])){_0x372330=_0x42f024[_0x601f('0x30')][_0x601f('0x60')];}return _0x260262[_0x601f('0x61')](_0x372330)['describe']();}})[_0x601f('0x25')](function(_0x527c18){var _0x3d3862=[_0x601f('0x62'),_0x601f('0x63'),'IsReminderSet',_0x601f('0x64'),'Subject',_0x601f('0x65')];var _0x4d5048=[_0x601f('0x66'),'int','picklist',_0x601f('0x67'),_0x601f('0x68'),_0x601f('0x69'),_0x601f('0x6a')];if(_0x527c18){_[_0x601f('0x6b')](_0x527c18['fields'],function(_0x188bef){return _0x3d3862[_0x601f('0x6c')](_0x188bef['name'])||!_0x4d5048['includes'](_0x188bef[_0x601f('0x3c')]);});return{'count':_0x527c18[_0x601f('0x33')][_0x601f('0x35')],'rows':_[_0x601f('0x2a')](_0x527c18[_0x601f('0x33')],function(_0x57b15){return{'id':_0x57b15[_0x601f('0x28')],'name':_0x57b15[_0x601f('0x6d')],'custom':_0x57b15[_0x601f('0x6e')],'options':_0x57b15['picklistValues']['length']>0x0?_['map'](_0x57b15[_0x601f('0x6f')],function(_0x4eec6e){return{'name':_0x4eec6e[_0x601f('0x6d')],'value':_0x4eec6e['value']};}):_0x57b15[_0x601f('0x3c')]==_0x601f('0x67')?[{'name':_0x601f('0x70'),'value':_0x601f('0x71')},{'name':_0x601f('0x72'),'value':_0x601f('0x73')}]:[]};})};}})[_0x601f('0x25')](respondWithResult(_0x1d3eea,null))[_0x601f('0x42')](function(_0x2e6e44){var _0x449e24=_0x42f024[_0x601f('0x30')][_0x601f('0x74')]?0x1f4:_0x2e6e44[_0x601f('0x75')]||0x1f4;logger[_0x601f('0x27')](_0x601f('0x76'),_0x601f('0x77'),_0x449e24,JSON[_0x601f('0x78')](_0x2e6e44));delete _0x2e6e44[_0x601f('0x28')];if(_0x449e24===0x191){_0x449e24=0x190;}_0x1d3eea[_0x601f('0x1b')](_0x449e24)[_0x601f('0x29')](_0x42f024['query']['test']?{'message':_0x601f('0x79'),'statusCode':_0x2e6e44['statusCode']}:_0x2e6e44);});}; \ No newline at end of file +var _0x75f2=['OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','email','textarea','phone','remove','includes','label','custom','picklistValues','value','boolean','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','clientSecret','login','isNil','ticketType','sobject','describe'];(function(_0xf71f8d,_0x4659cc){var _0x3088e4=function(_0x29f0f5){while(--_0x29f0f5){_0xf71f8d['push'](_0xf71f8d['shift']());}};_0x3088e4(++_0x4659cc);}(_0x75f2,0x10c));var _0x275f=function(_0x659c09,_0x464d40){_0x659c09=_0x659c09-0x0;var _0x2b2f69=_0x75f2[_0x659c09];return _0x2b2f69;};'use strict';var emlformat=require(_0x275f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x275f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x275f('0x2'));var moment=require(_0x275f('0x3'));var BPromise=require(_0x275f('0x4'));var Mustache=require('mustache');var util=require(_0x275f('0x5'));var path=require('path');var sox=require(_0x275f('0x6'));var csv=require(_0x275f('0x7'));var ejs=require(_0x275f('0x8'));var fs=require('fs');var fs_extra=require(_0x275f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x275f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x275f('0xb'));var toCsv=require(_0x275f('0x7'));var querystring=require('querystring');var Papa=require(_0x275f('0xc'));var Redis=require(_0x275f('0xd'));var authService=require(_0x275f('0xe'));var qs=require(_0x275f('0xf'));var as=require(_0x275f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x275f('0x11'))(_0x275f('0x12'));var utils=require('../../config/utils');var config=require(_0x275f('0x13'));var licenseUtil=require(_0x275f('0x14'));var db=require(_0x275f('0x15'))['db'];var integrations=require(_0x275f('0x16'));function respondWithStatusCode(_0x434737,_0x21cac5){_0x21cac5=_0x21cac5||0xcc;return function(_0x566662){if(_0x566662){return _0x434737[_0x275f('0x17')](_0x21cac5);}return _0x434737[_0x275f('0x18')](_0x21cac5)['end']();};}function respondWithResult(_0x3ab1d6,_0x2d3c35){_0x2d3c35=_0x2d3c35||0xc8;return function(_0x2e1d88){if(_0x2e1d88){return _0x3ab1d6[_0x275f('0x18')](_0x2d3c35)[_0x275f('0x19')](_0x2e1d88);}};}function respondWithFilteredResult(_0x16479a,_0x54adc9){return function(_0x1246a8){if(_0x1246a8){var _0x431a88=typeof _0x54adc9[_0x275f('0x1a')]==='undefined'&&typeof _0x54adc9['limit']===_0x275f('0x1b');var _0x26e022=_0x1246a8[_0x275f('0x1c')];var _0x3a2fd1=_0x431a88?0x0:_0x54adc9[_0x275f('0x1a')];var _0x34a4b0=_0x431a88?_0x1246a8[_0x275f('0x1c')]:_0x54adc9['offset']+_0x54adc9[_0x275f('0x1d')];var _0x473394;if(_0x34a4b0>=_0x26e022){_0x34a4b0=_0x26e022;_0x473394=0xc8;}else{_0x473394=0xce;}_0x16479a['status'](_0x473394);return _0x16479a[_0x275f('0x1e')](_0x275f('0x1f'),_0x3a2fd1+'-'+_0x34a4b0+'/'+_0x26e022)['json'](_0x1246a8);}return null;};}function patchUpdates(_0x387ef6){return function(_0x12cc21){try{jsonpatch['apply'](_0x12cc21,_0x387ef6,!![]);}catch(_0x556591){return BPromise['reject'](_0x556591);}return _0x12cc21['save']();};}function saveUpdates(_0x471802,_0x121f21){return function(_0x5e97b4){if(_0x5e97b4){return _0x5e97b4[_0x275f('0x20')](_0x471802)[_0x275f('0x21')](function(_0xf89f92){return _0xf89f92;});}return null;};}function removeEntity(_0x5f2d6d,_0xb9862f){return function(_0x3a7ac6){if(_0x3a7ac6){return _0x3a7ac6['destroy']()['then'](function(){_0x5f2d6d[_0x275f('0x18')](0xcc)[_0x275f('0x22')]();});}};}function handleEntityNotFound(_0x4821c3,_0xb77b72){return function(_0x42434b){if(!_0x42434b){_0x4821c3[_0x275f('0x17')](0x194);}return _0x42434b;};}function handleError(_0x2b61a7,_0x1e5b2d){_0x1e5b2d=_0x1e5b2d||0x1f4;return function(_0x49885b){logger['error'](_0x49885b[_0x275f('0x23')]);if(_0x49885b['name']){delete _0x49885b[_0x275f('0x24')];}_0x2b61a7[_0x275f('0x18')](_0x1e5b2d)[_0x275f('0x25')](_0x49885b);};}exports[_0x275f('0x26')]=function(_0x7babfe,_0x37ae36){var _0x5558d0={},_0x2ad429={},_0x1249a5={'count':0x0,'rows':[]};var _0x19b0c6=_[_0x275f('0x27')](db[_0x275f('0x28')][_0x275f('0x29')],function(_0x4ae1f5){return{'name':_0x4ae1f5['fieldName'],'type':_0x4ae1f5[_0x275f('0x2a')][_0x275f('0x2b')]};});_0x2ad429[_0x275f('0x2c')]=_[_0x275f('0x27')](_0x19b0c6,_0x275f('0x24'));_0x2ad429[_0x275f('0x2d')]=_['keys'](_0x7babfe['query']);_0x2ad429['filters']=_['intersection'](_0x2ad429['model'],_0x2ad429[_0x275f('0x2d')]);_0x5558d0[_0x275f('0x2e')]=_[_0x275f('0x2f')](_0x2ad429['model'],qs[_0x275f('0x30')](_0x7babfe['query'][_0x275f('0x30')]));_0x5558d0[_0x275f('0x2e')]=_0x5558d0[_0x275f('0x2e')][_0x275f('0x31')]?_0x5558d0[_0x275f('0x2e')]:_0x2ad429[_0x275f('0x2c')];if(!_0x7babfe[_0x275f('0x2d')][_0x275f('0x32')](_0x275f('0x33'))){_0x5558d0[_0x275f('0x1d')]=qs[_0x275f('0x1d')](_0x7babfe[_0x275f('0x2d')]['limit']);_0x5558d0[_0x275f('0x1a')]=qs[_0x275f('0x1a')](_0x7babfe['query'][_0x275f('0x1a')]);}_0x5558d0[_0x275f('0x34')]=qs[_0x275f('0x35')](_0x7babfe[_0x275f('0x2d')][_0x275f('0x35')]);_0x5558d0[_0x275f('0x36')]=qs[_0x275f('0x37')](_[_0x275f('0x38')](_0x7babfe[_0x275f('0x2d')],_0x2ad429[_0x275f('0x37')]),_0x19b0c6);if(_0x7babfe[_0x275f('0x2d')][_0x275f('0x39')]){_0x5558d0[_0x275f('0x36')]=_[_0x275f('0x3a')](_0x5558d0['where'],{'$or':_['map'](_0x19b0c6,function(_0x1f342e){if(_0x1f342e[_0x275f('0x2a')]!==_0x275f('0x3b')){var _0x4bc13c={};_0x4bc13c[_0x1f342e[_0x275f('0x24')]]={'$like':'%'+_0x7babfe[_0x275f('0x2d')][_0x275f('0x39')]+'%'};return _0x4bc13c;}})});}_0x5558d0=_['merge']({},_0x5558d0,_0x7babfe[_0x275f('0x3c')]);var _0x3b36e3={'where':_0x5558d0[_0x275f('0x36')]};return db['SalesforceAccount']['count'](_0x3b36e3)[_0x275f('0x21')](function(_0x4767a7){_0x1249a5[_0x275f('0x1c')]=_0x4767a7;if(_0x7babfe[_0x275f('0x2d')][_0x275f('0x3d')]){_0x5558d0['include']=[{'all':!![]}];}return db[_0x275f('0x28')][_0x275f('0x3e')](_0x5558d0);})[_0x275f('0x21')](function(_0xfc5b11){_0x1249a5[_0x275f('0x3f')]=_0xfc5b11;return _0x1249a5;})[_0x275f('0x21')](respondWithFilteredResult(_0x37ae36,_0x5558d0))[_0x275f('0x40')](handleError(_0x37ae36,null));};exports[_0x275f('0x41')]=function(_0x1f2487,_0x1b7e14){var _0x519d7e={'raw':![],'where':{'id':_0x1f2487[_0x275f('0x42')]['id']}},_0x16222b={};_0x16222b[_0x275f('0x2c')]=_[_0x275f('0x43')](db[_0x275f('0x28')]['rawAttributes']);_0x16222b[_0x275f('0x2d')]=_[_0x275f('0x43')](_0x1f2487[_0x275f('0x2d')]);_0x16222b[_0x275f('0x37')]=_[_0x275f('0x2f')](_0x16222b[_0x275f('0x2c')],_0x16222b[_0x275f('0x2d')]);_0x519d7e[_0x275f('0x2e')]=_[_0x275f('0x2f')](_0x16222b[_0x275f('0x2c')],qs[_0x275f('0x30')](_0x1f2487[_0x275f('0x2d')][_0x275f('0x30')]));_0x519d7e[_0x275f('0x2e')]=_0x519d7e['attributes'][_0x275f('0x31')]?_0x519d7e[_0x275f('0x2e')]:_0x16222b[_0x275f('0x2c')];if(_0x1f2487[_0x275f('0x2d')][_0x275f('0x3d')]){_0x519d7e[_0x275f('0x44')]=[{'all':!![]}];}_0x519d7e=_[_0x275f('0x3a')]({},_0x519d7e,_0x1f2487[_0x275f('0x3c')]);return db[_0x275f('0x28')][_0x275f('0x45')](_0x519d7e)[_0x275f('0x21')](handleEntityNotFound(_0x1b7e14,null))[_0x275f('0x21')](respondWithResult(_0x1b7e14,null))[_0x275f('0x40')](handleError(_0x1b7e14,null));};exports[_0x275f('0x46')]=function(_0x3ea94e,_0x4af67e){return db[_0x275f('0x28')][_0x275f('0x46')](_0x3ea94e[_0x275f('0x47')],{})[_0x275f('0x21')](respondWithResult(_0x4af67e,0xc9))[_0x275f('0x40')](handleError(_0x4af67e,null));};exports['update']=function(_0x397beb,_0x5d6820){if(_0x397beb[_0x275f('0x47')]['id']){delete _0x397beb[_0x275f('0x47')]['id'];}return db[_0x275f('0x28')][_0x275f('0x45')]({'where':{'id':_0x397beb[_0x275f('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d6820,null))[_0x275f('0x21')](saveUpdates(_0x397beb['body'],null))[_0x275f('0x21')](respondWithResult(_0x5d6820,null))[_0x275f('0x40')](handleError(_0x5d6820,null));};exports['destroy']=function(_0x3deb91,_0x18b851){return db['SalesforceAccount'][_0x275f('0x45')]({'where':{'id':_0x3deb91[_0x275f('0x42')]['id']}})[_0x275f('0x21')](handleEntityNotFound(_0x18b851,null))[_0x275f('0x21')](removeEntity(_0x18b851,null))['catch'](handleError(_0x18b851,null));};exports[_0x275f('0x48')]=function(_0x20854b,_0x1469b7,_0x4884be){var _0x50ccc2={};var _0x2ba92d={};var _0x5afdd1;var _0x4d4353;return db['SalesforceAccount'][_0x275f('0x49')]({'where':{'id':_0x20854b['params']['id']}})[_0x275f('0x21')](handleEntityNotFound(_0x1469b7,null))[_0x275f('0x21')](function(_0x261062){if(_0x261062){_0x5afdd1=_0x261062;_0x2ba92d[_0x275f('0x2c')]=_[_0x275f('0x43')](db[_0x275f('0x4a')][_0x275f('0x29')]);_0x2ba92d['query']=_[_0x275f('0x43')](_0x20854b[_0x275f('0x2d')]);_0x2ba92d[_0x275f('0x37')]=_[_0x275f('0x2f')](_0x2ba92d['model'],_0x2ba92d[_0x275f('0x2d')]);_0x50ccc2[_0x275f('0x2e')]=_[_0x275f('0x2f')](_0x2ba92d[_0x275f('0x2c')],qs[_0x275f('0x30')](_0x20854b[_0x275f('0x2d')][_0x275f('0x30')]));_0x50ccc2[_0x275f('0x2e')]=_0x50ccc2['attributes']['length']?_0x50ccc2['attributes']:_0x2ba92d['model'];_0x50ccc2['order']=qs['sort'](_0x20854b['query'][_0x275f('0x35')]);_0x50ccc2[_0x275f('0x36')]=qs[_0x275f('0x37')](_[_0x275f('0x38')](_0x20854b[_0x275f('0x2d')],_0x2ba92d['filters']));if(_0x20854b[_0x275f('0x2d')][_0x275f('0x39')]){_0x50ccc2['where']=_[_0x275f('0x3a')](_0x50ccc2[_0x275f('0x36')],{'$or':_[_0x275f('0x27')](_0x50ccc2['attributes'],function(_0x314fdd){var _0x3a66ff={};_0x3a66ff[_0x314fdd]={'$like':'%'+_0x20854b[_0x275f('0x2d')][_0x275f('0x39')]+'%'};return _0x3a66ff;})});}_0x50ccc2=_[_0x275f('0x3a')]({},_0x50ccc2,_0x20854b['options']);return _0x5afdd1[_0x275f('0x48')](_0x50ccc2);}})[_0x275f('0x21')](function(_0x8ce64){if(_0x8ce64){_0x4d4353=_0x8ce64['length'];if(!_0x20854b['query']['hasOwnProperty'](_0x275f('0x33'))){_0x50ccc2[_0x275f('0x1d')]=qs[_0x275f('0x1d')](_0x20854b[_0x275f('0x2d')][_0x275f('0x1d')]);_0x50ccc2['offset']=qs['offset'](_0x20854b[_0x275f('0x2d')]['offset']);}return _0x5afdd1[_0x275f('0x48')](_0x50ccc2);}})[_0x275f('0x21')](function(_0x5a3c28){if(_0x5a3c28){return _0x5a3c28?{'count':_0x4d4353,'rows':_0x5a3c28}:null;}})['then'](respondWithResult(_0x1469b7,null))[_0x275f('0x40')](handleError(_0x1469b7,null));};exports['addConfiguration']=function(_0x55111c,_0x85e9f5,_0x5df8a2){if(_0x55111c[_0x275f('0x47')]['id']){delete _0x55111c['body']['id'];}return db[_0x275f('0x28')][_0x275f('0x49')]({'where':{'id':_0x55111c[_0x275f('0x42')]['id']}})[_0x275f('0x21')](handleEntityNotFound(_0x85e9f5,null))[_0x275f('0x21')](function(_0x40dbb3){if(_0x40dbb3){_0x55111c[_0x275f('0x47')][_0x275f('0x4b')]=_0x40dbb3['id'];_0x55111c[_0x275f('0x47')][_0x275f('0x4c')]=integrations[_0x275f('0x4d')](_0x55111c[_0x275f('0x47')][_0x275f('0x4e')],_0x55111c['body']['type']);_0x55111c[_0x275f('0x47')][_0x275f('0x4f')]=integrations['getDescriptions'](_0x55111c[_0x275f('0x47')]['channel'],_0x55111c[_0x275f('0x47')][_0x275f('0x2a')]);return db['SalesforceConfiguration'][_0x275f('0x46')](_0x55111c[_0x275f('0x47')],{'include':[{'model':db[_0x275f('0x50')],'as':'Subjects'},{'model':db[_0x275f('0x50')],'as':_0x275f('0x4f')}]});}return null;})['then'](respondWithResult(_0x85e9f5,null))[_0x275f('0x40')](handleError(_0x85e9f5,null));};exports[_0x275f('0x51')]=function(_0x2d6e05,_0x2dad92,_0x40c2cf){var _0x1e63c3;var _0x2497e2='';var _0x1e9ffe=_0x275f('0x52');return db[_0x275f('0x28')][_0x275f('0x49')]({'where':{'id':_0x2d6e05[_0x275f('0x42')]['id']},'attributes':['id',_0x275f('0x53'),'clientId','clientSecret',_0x275f('0x54'),_0x275f('0x55'),_0x275f('0x56')]})[_0x275f('0x21')](handleEntityNotFound(_0x2dad92,null))[_0x275f('0x21')](function(_0x5a86de){if(_0x5a86de){_0x2497e2=_0x5a86de['remoteUri'];var _0x344673=_0x2497e2[_0x275f('0x57')](-0x1);if(_0x344673==='/'){_0x2497e2=_0x2497e2[_0x275f('0x58')](0x0,_0x2497e2[_0x275f('0x59')](_0x344673));}_0x1e63c3=new jsforce[(_0x275f('0x5a'))]({'oauth2':{'loginUrl':_0x2497e2,'clientId':_0x5a86de[_0x275f('0x5b')],'clientSecret':_0x5a86de[_0x275f('0x5c')]}});return _0x1e63c3[_0x275f('0x5d')](_0x5a86de['username'],_0x5a86de[_0x275f('0x55')]['concat'](_0x5a86de[_0x275f('0x56')]));}})[_0x275f('0x21')](function(_0xd015ba){if(_0xd015ba){if(!_[_0x275f('0x5e')](_0x2d6e05[_0x275f('0x2d')][_0x275f('0x5f')])){_0x1e9ffe=_0x2d6e05[_0x275f('0x2d')][_0x275f('0x5f')];}return _0x1e63c3[_0x275f('0x60')](_0x1e9ffe)[_0x275f('0x61')]();}})[_0x275f('0x21')](function(_0xf2c7c5){var _0x39adb2=[_0x275f('0x62'),_0x275f('0x63'),_0x275f('0x64'),_0x275f('0x65'),_0x275f('0x66'),_0x275f('0x67')];var _0x351a2b=[_0x275f('0x68'),'int','picklist','boolean',_0x275f('0x69'),_0x275f('0x6a'),_0x275f('0x6b')];if(_0xf2c7c5){_[_0x275f('0x6c')](_0xf2c7c5[_0x275f('0x30')],function(_0x66eff9){return _0x39adb2[_0x275f('0x6d')](_0x66eff9['name'])||!_0x351a2b[_0x275f('0x6d')](_0x66eff9['type']);});return{'count':_0xf2c7c5[_0x275f('0x30')]['length'],'rows':_[_0x275f('0x27')](_0xf2c7c5[_0x275f('0x30')],function(_0x26a7be){return{'id':_0x26a7be[_0x275f('0x24')],'name':_0x26a7be[_0x275f('0x6e')],'custom':_0x26a7be[_0x275f('0x6f')],'options':_0x26a7be[_0x275f('0x70')]['length']>0x0?_[_0x275f('0x27')](_0x26a7be['picklistValues'],function(_0x5093db){return{'name':_0x5093db['label'],'value':_0x5093db[_0x275f('0x71')]};}):_0x26a7be[_0x275f('0x2a')]==_0x275f('0x72')?[{'name':'True','value':_0x275f('0x73')},{'name':_0x275f('0x74'),'value':_0x275f('0x75')}]:[]};})};}})[_0x275f('0x21')](respondWithResult(_0x2dad92,null))['catch'](function(_0x1431c7){var _0x51eb61=_0x2d6e05[_0x275f('0x2d')][_0x275f('0x76')]?0x1f4:_0x1431c7[_0x275f('0x77')]||0x1f4;logger['error'](_0x275f('0x78'),_0x275f('0x51'),_0x51eb61,JSON[_0x275f('0x79')](_0x1431c7));delete _0x1431c7['name'];if(_0x51eb61===0x191){_0x51eb61=0x190;}_0x2dad92[_0x275f('0x18')](_0x51eb61)[_0x275f('0x25')](_0x2d6e05[_0x275f('0x2d')][_0x275f('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x1431c7['statusCode']}:_0x1431c7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a6e2f61..6fb663a 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 _0xef60=['../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceAccount.attributes'];(function(_0x304c79,_0x3caf92){var _0x20afac=function(_0x2e6fff){while(--_0x2e6fff){_0x304c79['push'](_0x304c79['shift']());}};_0x20afac(++_0x3caf92);}(_0xef60,0xa0));var _0x0ef6=function(_0x1290fa,_0x20f8f0){_0x1290fa=_0x1290fa-0x0;var _0x80a856=_0xef60[_0x1290fa];return _0x80a856;};'use strict';var _=require(_0x0ef6('0x0'));var util=require(_0x0ef6('0x1'));var logger=require(_0x0ef6('0x2'))(_0x0ef6('0x3'));var moment=require(_0x0ef6('0x4'));var BPromise=require(_0x0ef6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ef6('0x6'));var rimraf=require(_0x0ef6('0x7'));var config=require('../../config/environment');var attributes=require(_0x0ef6('0x8'));var integrations=require(_0x0ef6('0x9'));module['exports']=function(_0x1d664b,_0x45cf86){return _0x1d664b[_0x0ef6('0xa')](_0x0ef6('0xb'),attributes,{'tableName':_0x0ef6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c73=['moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','../../config/logger','api'];(function(_0x198f82,_0x4b55fc){var _0x196ed1=function(_0x3a498b){while(--_0x3a498b){_0x198f82['push'](_0x198f82['shift']());}};_0x196ed1(++_0x4b55fc);}(_0x5c73,0x135));var _0x35c7=function(_0x4d129e,_0x31e137){_0x4d129e=_0x4d129e-0x0;var _0x3a1dab=_0x5c73[_0x4d129e];return _0x3a1dab;};'use strict';var _=require(_0x35c7('0x0'));var util=require('util');var logger=require(_0x35c7('0x1'))(_0x35c7('0x2'));var moment=require(_0x35c7('0x3'));var BPromise=require(_0x35c7('0x4'));var rp=require(_0x35c7('0x5'));var fs=require('fs');var path=require(_0x35c7('0x6'));var rimraf=require(_0x35c7('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x35c7('0x8'));module[_0x35c7('0x9')]=function(_0x165030,_0x86cb8e){return _0x165030[_0x35c7('0xa')](_0x35c7('0xb'),attributes,{'tableName':'int_salesforce_accounts','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 85861f5..3f6253b 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 _0xa7cb=['stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowSalesforceAccount','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0xa7cb,0xdf));var _0xba7c=function(_0x5e7d0c,_0x56ba7b){_0x5e7d0c=_0x5e7d0c-0x0;var _0xc24371=_0xa7cb[_0x5e7d0c];return _0xc24371;};'use strict';var _=require(_0xba7c('0x0'));var util=require(_0xba7c('0x1'));var moment=require(_0xba7c('0x2'));var BPromise=require(_0xba7c('0x3'));var rs=require(_0xba7c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xba7c('0x5'));var logger=require('../../config/logger')(_0xba7c('0x6'));var config=require('../../config/environment');var jayson=require(_0xba7c('0x7'));var client=jayson[_0xba7c('0x8')][_0xba7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a825c,_0xec1104,_0x18768b){return new BPromise(function(_0x3338d6,_0x418e95){return client['request'](_0x3a825c,_0x18768b)[_0xba7c('0xa')](function(_0x57c2a3){logger[_0xba7c('0xb')](_0xba7c('0xc'),_0xec1104,_0xba7c('0xd'));logger['debug'](_0xba7c('0xe'),_0xec1104,'request\x20sent',JSON[_0xba7c('0xf')](_0x57c2a3));if(_0x57c2a3[_0xba7c('0x10')]){if(_0x57c2a3[_0xba7c('0x10')][_0xba7c('0x11')]===0x1f4){logger[_0xba7c('0x10')](_0xba7c('0xc'),_0xec1104,_0x57c2a3[_0xba7c('0x10')][_0xba7c('0x12')]);return _0x418e95(_0x57c2a3['error'][_0xba7c('0x12')]);}logger[_0xba7c('0x10')](_0xba7c('0xc'),_0xec1104,_0x57c2a3[_0xba7c('0x10')]['message']);return _0x3338d6(_0x57c2a3[_0xba7c('0x10')]['message']);}else{logger['info'](_0xba7c('0xc'),_0xec1104,'request\x20sent');_0x3338d6(_0x57c2a3[_0xba7c('0x13')][_0xba7c('0x12')]);}})[_0xba7c('0x14')](function(_0x360413){logger[_0xba7c('0x10')](_0xba7c('0xc'),_0xec1104,_0x360413);_0x418e95(_0x360413);});});}exports[_0xba7c('0x15')]=function(_0x45e2ed){var _0x14006a=this;return new Promise(function(_0x312dce,_0xff9d1f){return db[_0xba7c('0x16')][_0xba7c('0x17')]({'raw':_0x45e2ed[_0xba7c('0x18')]?_0x45e2ed[_0xba7c('0x18')][_0xba7c('0x19')]===undefined?!![]:![]:!![],'where':_0x45e2ed[_0xba7c('0x18')]?_0x45e2ed[_0xba7c('0x18')][_0xba7c('0x1a')]||null:null,'attributes':_0x45e2ed[_0xba7c('0x18')]?_0x45e2ed[_0xba7c('0x18')]['attributes']||null:null,'limit':_0x45e2ed[_0xba7c('0x18')]?_0x45e2ed[_0xba7c('0x18')][_0xba7c('0x1b')]||null:null,'include':_0x45e2ed['options']?_0x45e2ed[_0xba7c('0x18')]['include']?_['map'](_0x45e2ed['options'][_0xba7c('0x1c')],function(_0x2a29bc){return{'model':db[_0x2a29bc[_0xba7c('0x1d')]],'as':_0x2a29bc['as'],'attributes':_0x2a29bc[_0xba7c('0x1e')],'include':_0x2a29bc[_0xba7c('0x1c')]?_[_0xba7c('0x1f')](_0x2a29bc[_0xba7c('0x1c')],function(_0x1af563){return{'model':db[_0x1af563[_0xba7c('0x1d')]],'as':_0x1af563['as'],'attributes':_0x1af563[_0xba7c('0x1e')],'include':_0x1af563[_0xba7c('0x1c')]?_[_0xba7c('0x1f')](_0x1af563[_0xba7c('0x1c')],function(_0x68579){return{'model':db[_0x68579[_0xba7c('0x1d')]],'as':_0x68579['as'],'attributes':_0x68579[_0xba7c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xba7c('0xa')](function(_0x2c6247){logger[_0xba7c('0xb')](_0xba7c('0x15'),_0x45e2ed);logger['debug']('GetSalesforceAccount',_0x45e2ed,JSON[_0xba7c('0xf')](_0x2c6247));_0x312dce(_0x2c6247);})[_0xba7c('0x14')](function(_0x25891b){logger[_0xba7c('0x10')](_0xba7c('0x15'),_0x25891b['message'],_0x45e2ed);_0xff9d1f(_0x14006a[_0xba7c('0x10')](0x1f4,_0x25891b[_0xba7c('0x12')]));});});};exports[_0xba7c('0x20')]=function(_0x5c1627){var _0x29c34e=this;return new Promise(function(_0x202614,_0x29f35c){return db[_0xba7c('0x16')]['find']({'raw':_0x5c1627[_0xba7c('0x18')]?_0x5c1627[_0xba7c('0x18')][_0xba7c('0x19')]===undefined?!![]:![]:!![],'where':_0x5c1627[_0xba7c('0x18')]?_0x5c1627['options']['where']||null:null,'attributes':_0x5c1627[_0xba7c('0x18')]?_0x5c1627[_0xba7c('0x18')]['attributes']||null:null,'include':_0x5c1627[_0xba7c('0x18')]?_0x5c1627[_0xba7c('0x18')]['include']?_['map'](_0x5c1627[_0xba7c('0x18')][_0xba7c('0x1c')],function(_0x1cb9b8){return{'model':db[_0x1cb9b8[_0xba7c('0x1d')]],'as':_0x1cb9b8['as'],'attributes':_0x1cb9b8[_0xba7c('0x1e')],'include':_0x1cb9b8[_0xba7c('0x1c')]?_[_0xba7c('0x1f')](_0x1cb9b8['include'],function(_0x38d786){return{'model':db[_0x38d786[_0xba7c('0x1d')]],'as':_0x38d786['as'],'attributes':_0x38d786[_0xba7c('0x1e')],'include':_0x38d786[_0xba7c('0x1c')]?_[_0xba7c('0x1f')](_0x38d786[_0xba7c('0x1c')],function(_0x50c66e){return{'model':db[_0x50c66e['model']],'as':_0x50c66e['as'],'attributes':_0x50c66e[_0xba7c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xba7c('0xa')](function(_0x411479){logger[_0xba7c('0xb')]('ShowSalesforceAccount',_0x5c1627);logger[_0xba7c('0x21')](_0xba7c('0x20'),_0x5c1627,JSON[_0xba7c('0xf')](_0x411479));_0x202614(_0x411479);})[_0xba7c('0x14')](function(_0x3e430e){logger[_0xba7c('0x10')](_0xba7c('0x20'),_0x3e430e[_0xba7c('0x12')],_0x5c1627);_0x29f35c(_0x29c34e['error'](0x1f4,_0x3e430e[_0xba7c('0x12')]));});});}; \ No newline at end of file +var _0xb4d7=['SalesforceAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowSalesforceAccount','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount'];(function(_0x2c33ca,_0x35a1f3){var _0x26d249=function(_0x25f828){while(--_0x25f828){_0x2c33ca['push'](_0x2c33ca['shift']());}};_0x26d249(++_0x35a1f3);}(_0xb4d7,0x71));var _0x7b4d=function(_0x391a97,_0xc663cb){_0x391a97=_0x391a97-0x0;var _0x2504ec=_0xb4d7[_0x391a97];return _0x2504ec;};'use strict';var _=require(_0x7b4d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7b4d('0x1'));var fs=require('fs');var Redis=require(_0x7b4d('0x2'));var db=require(_0x7b4d('0x3'))['db'];var utils=require(_0x7b4d('0x4'));var logger=require(_0x7b4d('0x5'))(_0x7b4d('0x6'));var config=require(_0x7b4d('0x7'));var jayson=require(_0x7b4d('0x8'));var client=jayson[_0x7b4d('0x9')][_0x7b4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5101d5,_0x4516f1,_0x4d4486){return new BPromise(function(_0x2cf94d,_0x29ad62){return client['request'](_0x5101d5,_0x4d4486)[_0x7b4d('0xb')](function(_0x475d79){logger[_0x7b4d('0xc')](_0x7b4d('0xd'),_0x4516f1,_0x7b4d('0xe'));logger[_0x7b4d('0xf')](_0x7b4d('0x10'),_0x4516f1,_0x7b4d('0xe'),JSON[_0x7b4d('0x11')](_0x475d79));if(_0x475d79[_0x7b4d('0x12')]){if(_0x475d79[_0x7b4d('0x12')][_0x7b4d('0x13')]===0x1f4){logger[_0x7b4d('0x12')](_0x7b4d('0xd'),_0x4516f1,_0x475d79['error'][_0x7b4d('0x14')]);return _0x29ad62(_0x475d79[_0x7b4d('0x12')][_0x7b4d('0x14')]);}logger[_0x7b4d('0x12')](_0x7b4d('0xd'),_0x4516f1,_0x475d79['error'][_0x7b4d('0x14')]);return _0x2cf94d(_0x475d79[_0x7b4d('0x12')][_0x7b4d('0x14')]);}else{logger['info'](_0x7b4d('0xd'),_0x4516f1,_0x7b4d('0xe'));_0x2cf94d(_0x475d79['result'][_0x7b4d('0x14')]);}})[_0x7b4d('0x15')](function(_0x23ffc2){logger[_0x7b4d('0x12')](_0x7b4d('0xd'),_0x4516f1,_0x23ffc2);_0x29ad62(_0x23ffc2);});});}exports[_0x7b4d('0x16')]=function(_0x4c4886){var _0x4b2939=this;return new Promise(function(_0x5f1e71,_0x513971){return db[_0x7b4d('0x17')][_0x7b4d('0x18')]({'raw':_0x4c4886[_0x7b4d('0x19')]?_0x4c4886['options'][_0x7b4d('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c4886[_0x7b4d('0x19')]?_0x4c4886[_0x7b4d('0x19')][_0x7b4d('0x1b')]||null:null,'attributes':_0x4c4886['options']?_0x4c4886[_0x7b4d('0x19')][_0x7b4d('0x1c')]||null:null,'limit':_0x4c4886[_0x7b4d('0x19')]?_0x4c4886[_0x7b4d('0x19')]['limit']||null:null,'include':_0x4c4886[_0x7b4d('0x19')]?_0x4c4886['options'][_0x7b4d('0x1d')]?_[_0x7b4d('0x1e')](_0x4c4886[_0x7b4d('0x19')][_0x7b4d('0x1d')],function(_0x3448f9){return{'model':db[_0x3448f9[_0x7b4d('0x1f')]],'as':_0x3448f9['as'],'attributes':_0x3448f9[_0x7b4d('0x1c')],'include':_0x3448f9[_0x7b4d('0x1d')]?_[_0x7b4d('0x1e')](_0x3448f9['include'],function(_0x377649){return{'model':db[_0x377649[_0x7b4d('0x1f')]],'as':_0x377649['as'],'attributes':_0x377649[_0x7b4d('0x1c')],'include':_0x377649[_0x7b4d('0x1d')]?_[_0x7b4d('0x1e')](_0x377649[_0x7b4d('0x1d')],function(_0x2db07d){return{'model':db[_0x2db07d[_0x7b4d('0x1f')]],'as':_0x2db07d['as'],'attributes':_0x2db07d[_0x7b4d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7b4d('0xb')](function(_0x50e2a3){logger[_0x7b4d('0xc')](_0x7b4d('0x16'),_0x4c4886);logger[_0x7b4d('0xf')](_0x7b4d('0x16'),_0x4c4886,JSON['stringify'](_0x50e2a3));_0x5f1e71(_0x50e2a3);})[_0x7b4d('0x15')](function(_0x3e9fcd){logger['error'](_0x7b4d('0x16'),_0x3e9fcd[_0x7b4d('0x14')],_0x4c4886);_0x513971(_0x4b2939[_0x7b4d('0x12')](0x1f4,_0x3e9fcd['message']));});});};exports['ShowSalesforceAccount']=function(_0x16fbf5){var _0xfe1d06=this;return new Promise(function(_0x37f3a5,_0x32dc65){return db[_0x7b4d('0x17')][_0x7b4d('0x20')]({'raw':_0x16fbf5[_0x7b4d('0x19')]?_0x16fbf5['options']['raw']===undefined?!![]:![]:!![],'where':_0x16fbf5[_0x7b4d('0x19')]?_0x16fbf5[_0x7b4d('0x19')][_0x7b4d('0x1b')]||null:null,'attributes':_0x16fbf5[_0x7b4d('0x19')]?_0x16fbf5[_0x7b4d('0x19')]['attributes']||null:null,'include':_0x16fbf5[_0x7b4d('0x19')]?_0x16fbf5[_0x7b4d('0x19')][_0x7b4d('0x1d')]?_[_0x7b4d('0x1e')](_0x16fbf5[_0x7b4d('0x19')][_0x7b4d('0x1d')],function(_0x93caf6){return{'model':db[_0x93caf6[_0x7b4d('0x1f')]],'as':_0x93caf6['as'],'attributes':_0x93caf6['attributes'],'include':_0x93caf6['include']?_[_0x7b4d('0x1e')](_0x93caf6['include'],function(_0x11e204){return{'model':db[_0x11e204['model']],'as':_0x11e204['as'],'attributes':_0x11e204[_0x7b4d('0x1c')],'include':_0x11e204[_0x7b4d('0x1d')]?_[_0x7b4d('0x1e')](_0x11e204[_0x7b4d('0x1d')],function(_0x33585c){return{'model':db[_0x33585c[_0x7b4d('0x1f')]],'as':_0x33585c['as'],'attributes':_0x33585c[_0x7b4d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7b4d('0xb')](function(_0x3659f3){logger[_0x7b4d('0xc')](_0x7b4d('0x21'),_0x16fbf5);logger[_0x7b4d('0xf')](_0x7b4d('0x21'),_0x16fbf5,JSON[_0x7b4d('0x11')](_0x3659f3));_0x37f3a5(_0x3659f3);})[_0x7b4d('0x15')](function(_0x49e847){logger[_0x7b4d('0x12')](_0x7b4d('0x21'),_0x49e847[_0x7b4d('0x14')],_0x16fbf5);_0x32dc65(_0xfe1d06[_0x7b4d('0x12')](0x1f4,_0x49e847[_0x7b4d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5b1b988..45b13da 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x106b17,_0x5c6c80){var _0x45c7a2=function(_0x47abed){while(--_0x47abed){_0x106b17['push'](_0x106b17['shift']());}};_0x45c7a2(++_0x5c6c80);}(_0x2ef3,0xba));var _0x32ef=function(_0x344e76,_0x16fa11){_0x344e76=_0x344e76-0x0;var _0x37db83=_0x2ef3[_0x344e76];return _0x37db83;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +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(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xdb28,0x106));var _0x8db2=function(_0x2b7443,_0x2c3f6f){_0x2b7443=_0x2b7443-0x0;var _0x3d30ee=_0xdb28[_0x2b7443];return _0x3d30ee;};'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 a2c09f9..e739435 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 _0x85f8=['contact_lead','contact','lead','account_contact_lead','account','nothing','STRING','sequelize','exports','Task','ENUM'];(function(_0x4bf5f2,_0x48040d){var _0x9d49ee=function(_0x2344e7){while(--_0x2344e7){_0x4bf5f2['push'](_0x4bf5f2['shift']());}};_0x9d49ee(++_0x48040d);}(_0x85f8,0x10f));var _0x885f=function(_0x20c480,_0x346eb1){_0x20c480=_0x20c480-0x0;var _0x345d56=_0x85f8[_0x20c480];return _0x345d56;};'use strict';var Sequelize=require(_0x885f('0x0'));module[_0x885f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x885f('0x2'),'Case'),'defaultValue':_0x885f('0x2')},'moduleSearch':{'type':Sequelize[_0x885f('0x3')](_0x885f('0x4'),_0x885f('0x5'),_0x885f('0x6'),_0x885f('0x7'),_0x885f('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x885f('0x3')](_0x885f('0x9'),'contact',_0x885f('0x6'),'account'),'defaultValue':_0x885f('0x6')},'leadId':{'type':Sequelize[_0x885f('0xa')]},'additionalSearchAccount':{'type':Sequelize[_0x885f('0xa')]},'additionalSearchContact':{'type':Sequelize[_0x885f('0xa')]},'additionalSearchLead':{'type':Sequelize[_0x885f('0xa')]}}; \ No newline at end of file +var _0x82aa=['account','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead'];(function(_0x3579ca,_0x10f283){var _0x98db7f=function(_0x37300a){while(--_0x37300a){_0x3579ca['push'](_0x3579ca['shift']());}};_0x98db7f(++_0x10f283);}(_0x82aa,0xff));var _0xa82a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x82aa[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xa82a('0x0'));module[_0xa82a('0x1')]={'name':{'type':Sequelize[_0xa82a('0x2')]},'description':{'type':Sequelize[_0xa82a('0x2')]},'ticketType':{'type':Sequelize[_0xa82a('0x3')](_0xa82a('0x4'),_0xa82a('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xa82a('0x3')](_0xa82a('0x6'),_0xa82a('0x7'),_0xa82a('0x8'),'account_contact_lead',_0xa82a('0x9')),'defaultValue':_0xa82a('0x6')},'moduleCreate':{'type':Sequelize[_0xa82a('0x3')](_0xa82a('0xa'),_0xa82a('0x7'),_0xa82a('0x8'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa82a('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xa82a('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xa82a('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xa82a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 272e90c..121d6db 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 _0x4ce6=['filters','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','intersection','length','options','find','create','body','destroy','findOne','getFields','getSubjects','getDescriptions','SalesforceField','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','count','limit','apply','reject','save','then','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','keys'];(function(_0xbb1add,_0x489d26){var _0x1620b1=function(_0x2b43c3){while(--_0x2b43c3){_0xbb1add['push'](_0xbb1add['shift']());}};_0x1620b1(++_0x489d26);}(_0x4ce6,0x108));var _0x64ce=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0x4ce6[_0x3474ac];return _0x5345ec;};'use strict';var emlformat=require(_0x64ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x64ce('0x1'));var jsonpatch=require(_0x64ce('0x2'));var rp=require(_0x64ce('0x3'));var moment=require(_0x64ce('0x4'));var BPromise=require(_0x64ce('0x5'));var Mustache=require(_0x64ce('0x6'));var util=require('util');var path=require(_0x64ce('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x64ce('0x8'));var fs=require('fs');var fs_extra=require(_0x64ce('0x9'));var _=require('lodash');var squel=require(_0x64ce('0xa'));var crypto=require(_0x64ce('0xb'));var jsforce=require(_0x64ce('0xc'));var deskjs=require(_0x64ce('0xd'));var toCsv=require(_0x64ce('0xe'));var querystring=require(_0x64ce('0xf'));var Papa=require(_0x64ce('0x10'));var Redis=require(_0x64ce('0x11'));var authService=require(_0x64ce('0x12'));var qs=require(_0x64ce('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64ce('0x14'));var logger=require(_0x64ce('0x15'))(_0x64ce('0x16'));var utils=require(_0x64ce('0x17'));var config=require(_0x64ce('0x18'));var licenseUtil=require(_0x64ce('0x19'));var db=require(_0x64ce('0x1a'))['db'];function respondWithStatusCode(_0x321f24,_0x4dbb9e){_0x4dbb9e=_0x4dbb9e||0xcc;return function(_0x17be05){if(_0x17be05){return _0x321f24['sendStatus'](_0x4dbb9e);}return _0x321f24['status'](_0x4dbb9e)[_0x64ce('0x1b')]();};}function respondWithResult(_0x498d55,_0xedcfa5){_0xedcfa5=_0xedcfa5||0xc8;return function(_0x22e852){if(_0x22e852){return _0x498d55[_0x64ce('0x1c')](_0xedcfa5)[_0x64ce('0x1d')](_0x22e852);}};}function respondWithFilteredResult(_0x3579a3,_0x235a82){return function(_0x476a31){if(_0x476a31){var _0x42df9a=typeof _0x235a82[_0x64ce('0x1e')]==='undefined'&&typeof _0x235a82['limit']==='undefined';var _0x3eca89=_0x476a31[_0x64ce('0x1f')];var _0x1f6fd4=_0x42df9a?0x0:_0x235a82[_0x64ce('0x1e')];var _0x38d441=_0x42df9a?_0x476a31[_0x64ce('0x1f')]:_0x235a82[_0x64ce('0x1e')]+_0x235a82[_0x64ce('0x20')];var _0xafcce4;if(_0x38d441>=_0x3eca89){_0x38d441=_0x3eca89;_0xafcce4=0xc8;}else{_0xafcce4=0xce;}_0x3579a3[_0x64ce('0x1c')](_0xafcce4);return _0x3579a3['set']('Content-Range',_0x1f6fd4+'-'+_0x38d441+'/'+_0x3eca89)[_0x64ce('0x1d')](_0x476a31);}return null;};}function patchUpdates(_0x17a36b){return function(_0x4f8dc2){try{jsonpatch[_0x64ce('0x21')](_0x4f8dc2,_0x17a36b,!![]);}catch(_0x3a8d29){return BPromise[_0x64ce('0x22')](_0x3a8d29);}return _0x4f8dc2[_0x64ce('0x23')]();};}function saveUpdates(_0x2b5f89,_0x1aa495){return function(_0x34a7f7){if(_0x34a7f7){return _0x34a7f7['update'](_0x2b5f89)[_0x64ce('0x24')](function(_0x36c332){return _0x36c332;});}return null;};}function removeEntity(_0x4f9107,_0x1aec1f){return function(_0x9729cf){if(_0x9729cf){return _0x9729cf['destroy']()[_0x64ce('0x24')](function(){_0x4f9107[_0x64ce('0x1c')](0xcc)[_0x64ce('0x1b')]();});}};}function handleEntityNotFound(_0x33feb3,_0x2826f6){return function(_0x2e941c){if(!_0x2e941c){_0x33feb3['sendStatus'](0x194);}return _0x2e941c;};}function handleError(_0x618946,_0x3b77c7){_0x3b77c7=_0x3b77c7||0x1f4;return function(_0x5415de){logger[_0x64ce('0x25')](_0x5415de[_0x64ce('0x26')]);if(_0x5415de['name']){delete _0x5415de[_0x64ce('0x27')];}_0x618946[_0x64ce('0x1c')](_0x3b77c7)[_0x64ce('0x28')](_0x5415de);};}exports['index']=function(_0x24181c,_0x1fd112){var _0x23d5a0={},_0x3e7a52={},_0x2fa80d={'count':0x0,'rows':[]};var _0x46c19b=_[_0x64ce('0x29')](db[_0x64ce('0x2a')][_0x64ce('0x2b')],function(_0x2f8b6b){return{'name':_0x2f8b6b[_0x64ce('0x2c')],'type':_0x2f8b6b[_0x64ce('0x2d')]['key']};});_0x3e7a52[_0x64ce('0x2e')]=_['map'](_0x46c19b,_0x64ce('0x27'));_0x3e7a52['query']=_[_0x64ce('0x2f')](_0x24181c['query']);_0x3e7a52[_0x64ce('0x30')]=_['intersection'](_0x3e7a52['model'],_0x3e7a52['query']);_0x23d5a0[_0x64ce('0x31')]=_['intersection'](_0x3e7a52['model'],qs[_0x64ce('0x32')](_0x24181c[_0x64ce('0x33')][_0x64ce('0x32')]));_0x23d5a0[_0x64ce('0x31')]=_0x23d5a0[_0x64ce('0x31')]['length']?_0x23d5a0[_0x64ce('0x31')]:_0x3e7a52[_0x64ce('0x2e')];if(!_0x24181c[_0x64ce('0x33')][_0x64ce('0x34')](_0x64ce('0x35'))){_0x23d5a0['limit']=qs[_0x64ce('0x20')](_0x24181c[_0x64ce('0x33')][_0x64ce('0x20')]);_0x23d5a0['offset']=qs[_0x64ce('0x1e')](_0x24181c[_0x64ce('0x33')][_0x64ce('0x1e')]);}_0x23d5a0[_0x64ce('0x36')]=qs[_0x64ce('0x37')](_0x24181c[_0x64ce('0x33')][_0x64ce('0x37')]);_0x23d5a0[_0x64ce('0x38')]=qs['filters'](_[_0x64ce('0x39')](_0x24181c['query'],_0x3e7a52['filters']),_0x46c19b);if(_0x24181c[_0x64ce('0x33')]['filter']){_0x23d5a0[_0x64ce('0x38')]=_[_0x64ce('0x3a')](_0x23d5a0[_0x64ce('0x38')],{'$or':_['map'](_0x46c19b,function(_0x3460ae){if(_0x3460ae[_0x64ce('0x2d')]!=='VIRTUAL'){var _0x1a640a={};_0x1a640a[_0x3460ae['name']]={'$like':'%'+_0x24181c[_0x64ce('0x33')][_0x64ce('0x3b')]+'%'};return _0x1a640a;}})});}_0x23d5a0=_[_0x64ce('0x3a')]({},_0x23d5a0,_0x24181c['options']);var _0xdce6d7={'where':_0x23d5a0['where']};return db[_0x64ce('0x2a')][_0x64ce('0x1f')](_0xdce6d7)[_0x64ce('0x24')](function(_0x1eed7f){_0x2fa80d[_0x64ce('0x1f')]=_0x1eed7f;if(_0x24181c['query'][_0x64ce('0x3c')]){_0x23d5a0[_0x64ce('0x3d')]=[{'all':!![]}];}return db[_0x64ce('0x2a')]['findAll'](_0x23d5a0);})[_0x64ce('0x24')](function(_0x824143){_0x2fa80d[_0x64ce('0x3e')]=_0x824143;return _0x2fa80d;})['then'](respondWithFilteredResult(_0x1fd112,_0x23d5a0))[_0x64ce('0x3f')](handleError(_0x1fd112,null));};exports[_0x64ce('0x40')]=function(_0x456fef,_0x132499){var _0x422211={'raw':![],'where':{'id':_0x456fef[_0x64ce('0x41')]['id']}},_0x48043b={};_0x48043b['model']=_[_0x64ce('0x2f')](db[_0x64ce('0x2a')][_0x64ce('0x2b')]);_0x48043b[_0x64ce('0x33')]=_['keys'](_0x456fef[_0x64ce('0x33')]);_0x48043b[_0x64ce('0x30')]=_[_0x64ce('0x42')](_0x48043b['model'],_0x48043b['query']);_0x422211[_0x64ce('0x31')]=_[_0x64ce('0x42')](_0x48043b[_0x64ce('0x2e')],qs[_0x64ce('0x32')](_0x456fef['query'][_0x64ce('0x32')]));_0x422211[_0x64ce('0x31')]=_0x422211[_0x64ce('0x31')][_0x64ce('0x43')]?_0x422211[_0x64ce('0x31')]:_0x48043b[_0x64ce('0x2e')];if(_0x456fef['query'][_0x64ce('0x3c')]){_0x422211['include']=[{'all':!![]}];}_0x422211=_[_0x64ce('0x3a')]({},_0x422211,_0x456fef[_0x64ce('0x44')]);return db[_0x64ce('0x2a')][_0x64ce('0x45')](_0x422211)[_0x64ce('0x24')](handleEntityNotFound(_0x132499,null))[_0x64ce('0x24')](respondWithResult(_0x132499,null))[_0x64ce('0x3f')](handleError(_0x132499,null));};exports[_0x64ce('0x46')]=function(_0x5711f8,_0x40df30){return db['SalesforceConfiguration'][_0x64ce('0x46')](_0x5711f8[_0x64ce('0x47')],{})[_0x64ce('0x24')](respondWithResult(_0x40df30,0xc9))[_0x64ce('0x3f')](handleError(_0x40df30,null));};exports['update']=function(_0x3f565e,_0x1b739c){if(_0x3f565e['body']['id']){delete _0x3f565e[_0x64ce('0x47')]['id'];}return db[_0x64ce('0x2a')][_0x64ce('0x45')]({'where':{'id':_0x3f565e[_0x64ce('0x41')]['id']}})['then'](handleEntityNotFound(_0x1b739c,null))[_0x64ce('0x24')](saveUpdates(_0x3f565e[_0x64ce('0x47')],null))[_0x64ce('0x24')](respondWithResult(_0x1b739c,null))[_0x64ce('0x3f')](handleError(_0x1b739c,null));};exports[_0x64ce('0x48')]=function(_0x4cf1e2,_0x9c65da){return db['SalesforceConfiguration'][_0x64ce('0x45')]({'where':{'id':_0x4cf1e2['params']['id']}})[_0x64ce('0x24')](handleEntityNotFound(_0x9c65da,null))['then'](removeEntity(_0x9c65da,null))[_0x64ce('0x3f')](handleError(_0x9c65da,null));};exports['getFields']=function(_0x4d4e3c,_0x12cde5,_0x158cdd){var _0x266ec2={};var _0xbe7de2={};var _0x27d4fe;var _0xe747bf;return db[_0x64ce('0x2a')][_0x64ce('0x49')]({'where':{'id':_0x4d4e3c[_0x64ce('0x41')]['id']}})[_0x64ce('0x24')](handleEntityNotFound(_0x12cde5,null))[_0x64ce('0x24')](function(_0x4bd73e){if(_0x4bd73e){_0x27d4fe=_0x4bd73e;_0xbe7de2[_0x64ce('0x2e')]=_[_0x64ce('0x2f')](db['SalesforceField'][_0x64ce('0x2b')]);_0xbe7de2[_0x64ce('0x33')]=_[_0x64ce('0x2f')](_0x4d4e3c[_0x64ce('0x33')]);_0xbe7de2['filters']=_[_0x64ce('0x42')](_0xbe7de2[_0x64ce('0x2e')],_0xbe7de2[_0x64ce('0x33')]);_0x266ec2['attributes']=_[_0x64ce('0x42')](_0xbe7de2[_0x64ce('0x2e')],qs['fields'](_0x4d4e3c['query'][_0x64ce('0x32')]));_0x266ec2[_0x64ce('0x31')]=_0x266ec2[_0x64ce('0x31')][_0x64ce('0x43')]?_0x266ec2[_0x64ce('0x31')]:_0xbe7de2['model'];_0x266ec2[_0x64ce('0x36')]=qs[_0x64ce('0x37')](_0x4d4e3c['query'][_0x64ce('0x37')]);_0x266ec2[_0x64ce('0x38')]=qs[_0x64ce('0x30')](_[_0x64ce('0x39')](_0x4d4e3c['query'],_0xbe7de2['filters']));if(_0x4d4e3c[_0x64ce('0x33')]['filter']){_0x266ec2[_0x64ce('0x38')]=_['merge'](_0x266ec2[_0x64ce('0x38')],{'$or':_['map'](_0x266ec2[_0x64ce('0x31')],function(_0x3dffac){var _0x522ce3={};_0x522ce3[_0x3dffac]={'$like':'%'+_0x4d4e3c[_0x64ce('0x33')][_0x64ce('0x3b')]+'%'};return _0x522ce3;})});}_0x266ec2=_['merge']({},_0x266ec2,_0x4d4e3c[_0x64ce('0x44')]);return _0x27d4fe[_0x64ce('0x4a')](_0x266ec2);}})['then'](function(_0x46197e){if(_0x46197e){_0xe747bf=_0x46197e[_0x64ce('0x43')];if(!_0x4d4e3c[_0x64ce('0x33')][_0x64ce('0x34')](_0x64ce('0x35'))){_0x266ec2[_0x64ce('0x20')]=qs['limit'](_0x4d4e3c[_0x64ce('0x33')][_0x64ce('0x20')]);_0x266ec2[_0x64ce('0x1e')]=qs[_0x64ce('0x1e')](_0x4d4e3c[_0x64ce('0x33')][_0x64ce('0x1e')]);}return _0x27d4fe[_0x64ce('0x4a')](_0x266ec2);}})['then'](function(_0x1a1386){if(_0x1a1386){return _0x1a1386?{'count':_0xe747bf,'rows':_0x1a1386}:null;}})[_0x64ce('0x24')](respondWithResult(_0x12cde5,null))[_0x64ce('0x3f')](handleError(_0x12cde5,null));};exports[_0x64ce('0x4b')]=function(_0x4f594d,_0x3c4897,_0x2ad20b){var _0x492d88={};var _0x4415ff={};var _0xe42d2f;var _0x26b859;return db[_0x64ce('0x2a')][_0x64ce('0x49')]({'where':{'id':_0x4f594d[_0x64ce('0x41')]['id']}})[_0x64ce('0x24')](handleEntityNotFound(_0x3c4897,null))['then'](function(_0x360f6e){if(_0x360f6e){_0xe42d2f=_0x360f6e;_0x4415ff['model']=_['keys'](db['SalesforceField'][_0x64ce('0x2b')]);_0x4415ff[_0x64ce('0x33')]=_[_0x64ce('0x2f')](_0x4f594d[_0x64ce('0x33')]);_0x4415ff['filters']=_[_0x64ce('0x42')](_0x4415ff['model'],_0x4415ff['query']);_0x492d88[_0x64ce('0x31')]=_[_0x64ce('0x42')](_0x4415ff[_0x64ce('0x2e')],qs['fields'](_0x4f594d['query'][_0x64ce('0x32')]));_0x492d88['attributes']=_0x492d88[_0x64ce('0x31')][_0x64ce('0x43')]?_0x492d88[_0x64ce('0x31')]:_0x4415ff[_0x64ce('0x2e')];_0x492d88[_0x64ce('0x36')]=qs[_0x64ce('0x37')](_0x4f594d[_0x64ce('0x33')][_0x64ce('0x37')]);_0x492d88[_0x64ce('0x38')]=qs[_0x64ce('0x30')](_['pick'](_0x4f594d[_0x64ce('0x33')],_0x4415ff[_0x64ce('0x30')]));if(_0x4f594d[_0x64ce('0x33')][_0x64ce('0x3b')]){_0x492d88[_0x64ce('0x38')]=_[_0x64ce('0x3a')](_0x492d88[_0x64ce('0x38')],{'$or':_[_0x64ce('0x29')](_0x492d88[_0x64ce('0x31')],function(_0x27feb3){var _0x2fd593={};_0x2fd593[_0x27feb3]={'$like':'%'+_0x4f594d['query']['filter']+'%'};return _0x2fd593;})});}_0x492d88=_['merge']({},_0x492d88,_0x4f594d[_0x64ce('0x44')]);return _0xe42d2f[_0x64ce('0x4b')](_0x492d88);}})[_0x64ce('0x24')](function(_0x5e850b){if(_0x5e850b){_0x26b859=_0x5e850b[_0x64ce('0x43')];if(!_0x4f594d['query'][_0x64ce('0x34')]('nolimit')){_0x492d88[_0x64ce('0x20')]=qs['limit'](_0x4f594d[_0x64ce('0x33')]['limit']);_0x492d88['offset']=qs[_0x64ce('0x1e')](_0x4f594d[_0x64ce('0x33')][_0x64ce('0x1e')]);}return _0xe42d2f[_0x64ce('0x4b')](_0x492d88);}})[_0x64ce('0x24')](function(_0xb0e1a2){if(_0xb0e1a2){return _0xb0e1a2?{'count':_0x26b859,'rows':_0xb0e1a2}:null;}})['then'](respondWithResult(_0x3c4897,null))[_0x64ce('0x3f')](handleError(_0x3c4897,null));};exports[_0x64ce('0x4c')]=function(_0x2f0fd8,_0x1d1f2a,_0x3c751e){var _0x580fc0={};var _0xa7ec2d={};var _0x5ecee3;var _0x4f4105;return db[_0x64ce('0x2a')]['findOne']({'where':{'id':_0x2f0fd8['params']['id']}})[_0x64ce('0x24')](handleEntityNotFound(_0x1d1f2a,null))[_0x64ce('0x24')](function(_0x40f67e){if(_0x40f67e){_0x5ecee3=_0x40f67e;_0xa7ec2d[_0x64ce('0x2e')]=_[_0x64ce('0x2f')](db[_0x64ce('0x4d')][_0x64ce('0x2b')]);_0xa7ec2d[_0x64ce('0x33')]=_[_0x64ce('0x2f')](_0x2f0fd8[_0x64ce('0x33')]);_0xa7ec2d[_0x64ce('0x30')]=_[_0x64ce('0x42')](_0xa7ec2d[_0x64ce('0x2e')],_0xa7ec2d[_0x64ce('0x33')]);_0x580fc0[_0x64ce('0x31')]=_['intersection'](_0xa7ec2d[_0x64ce('0x2e')],qs[_0x64ce('0x32')](_0x2f0fd8[_0x64ce('0x33')][_0x64ce('0x32')]));_0x580fc0[_0x64ce('0x31')]=_0x580fc0[_0x64ce('0x31')][_0x64ce('0x43')]?_0x580fc0[_0x64ce('0x31')]:_0xa7ec2d[_0x64ce('0x2e')];_0x580fc0[_0x64ce('0x36')]=qs[_0x64ce('0x37')](_0x2f0fd8['query']['sort']);_0x580fc0[_0x64ce('0x38')]=qs[_0x64ce('0x30')](_[_0x64ce('0x39')](_0x2f0fd8['query'],_0xa7ec2d[_0x64ce('0x30')]));if(_0x2f0fd8[_0x64ce('0x33')][_0x64ce('0x3b')]){_0x580fc0[_0x64ce('0x38')]=_[_0x64ce('0x3a')](_0x580fc0['where'],{'$or':_[_0x64ce('0x29')](_0x580fc0['attributes'],function(_0x57d6fc){var _0x4674a9={};_0x4674a9[_0x57d6fc]={'$like':'%'+_0x2f0fd8[_0x64ce('0x33')][_0x64ce('0x3b')]+'%'};return _0x4674a9;})});}_0x580fc0=_[_0x64ce('0x3a')]({},_0x580fc0,_0x2f0fd8[_0x64ce('0x44')]);return _0x5ecee3[_0x64ce('0x4c')](_0x580fc0);}})[_0x64ce('0x24')](function(_0x4f6b93){if(_0x4f6b93){_0x4f4105=_0x4f6b93[_0x64ce('0x43')];if(!_0x2f0fd8[_0x64ce('0x33')]['hasOwnProperty'](_0x64ce('0x35'))){_0x580fc0['limit']=qs[_0x64ce('0x20')](_0x2f0fd8[_0x64ce('0x33')]['limit']);_0x580fc0[_0x64ce('0x1e')]=qs[_0x64ce('0x1e')](_0x2f0fd8['query'][_0x64ce('0x1e')]);}return _0x5ecee3[_0x64ce('0x4c')](_0x580fc0);}})['then'](function(_0x5cb403){if(_0x5cb403){return _0x5cb403?{'count':_0x4f4105,'rows':_0x5cb403}:null;}})['then'](respondWithResult(_0x1d1f2a,null))[_0x64ce('0x3f')](handleError(_0x1d1f2a,null));}; \ No newline at end of file +var _0x1d7e=['Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','keys','options','create','update','body','find','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count'];(function(_0x4353cd,_0x3c8895){var _0x4eb363=function(_0x282194){while(--_0x282194){_0x4353cd['push'](_0x4353cd['shift']());}};_0x4eb363(++_0x3c8895);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x1d7e[_0x49ca18];return _0x145d54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1d7('0x0'));var zipdir=require(_0xe1d7('0x1'));var jsonpatch=require(_0xe1d7('0x2'));var rp=require('request-promise');var moment=require(_0xe1d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1d7('0x4'));var util=require(_0xe1d7('0x5'));var path=require(_0xe1d7('0x6'));var sox=require(_0xe1d7('0x7'));var csv=require(_0xe1d7('0x8'));var ejs=require(_0xe1d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xa'));var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x8'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var licenseUtil=require(_0xe1d7('0x15'));var db=require(_0xe1d7('0x16'))['db'];function respondWithStatusCode(_0x207502,_0x455a7a){_0x455a7a=_0x455a7a||0xcc;return function(_0x445994){if(_0x445994){return _0x207502[_0xe1d7('0x17')](_0x455a7a);}return _0x207502['status'](_0x455a7a)[_0xe1d7('0x18')]();};}function respondWithResult(_0x247286,_0x156a3f){_0x156a3f=_0x156a3f||0xc8;return function(_0x3d3d8d){if(_0x3d3d8d){return _0x247286[_0xe1d7('0x19')](_0x156a3f)[_0xe1d7('0x1a')](_0x3d3d8d);}};}function respondWithFilteredResult(_0x3c1923,_0x565278){return function(_0x391f55){if(_0x391f55){var _0x328898=typeof _0x565278[_0xe1d7('0x1b')]==='undefined'&&typeof _0x565278[_0xe1d7('0x1c')]===_0xe1d7('0x1d');var _0x800c15=_0x391f55[_0xe1d7('0x1e')];var _0x1dc61f=_0x328898?0x0:_0x565278[_0xe1d7('0x1b')];var _0xdad949=_0x328898?_0x391f55[_0xe1d7('0x1e')]:_0x565278[_0xe1d7('0x1b')]+_0x565278[_0xe1d7('0x1c')];var _0x2035e7;if(_0xdad949>=_0x800c15){_0xdad949=_0x800c15;_0x2035e7=0xc8;}else{_0x2035e7=0xce;}_0x3c1923[_0xe1d7('0x19')](_0x2035e7);return _0x3c1923['set'](_0xe1d7('0x1f'),_0x1dc61f+'-'+_0xdad949+'/'+_0x800c15)[_0xe1d7('0x1a')](_0x391f55);}return null;};}function patchUpdates(_0x1e9a1e){return function(_0x3e25e8){try{jsonpatch[_0xe1d7('0x20')](_0x3e25e8,_0x1e9a1e,!![]);}catch(_0x5f2053){return BPromise[_0xe1d7('0x21')](_0x5f2053);}return _0x3e25e8[_0xe1d7('0x22')]();};}function saveUpdates(_0x111e52,_0x13867a){return function(_0x33ac20){if(_0x33ac20){return _0x33ac20['update'](_0x111e52)[_0xe1d7('0x23')](function(_0x370c92){return _0x370c92;});}return null;};}function removeEntity(_0x2572ec,_0x3bc5c1){return function(_0x25e3c9){if(_0x25e3c9){return _0x25e3c9[_0xe1d7('0x24')]()[_0xe1d7('0x23')](function(){_0x2572ec[_0xe1d7('0x19')](0xcc)[_0xe1d7('0x18')]();});}};}function handleEntityNotFound(_0x2e47f7,_0x55446d){return function(_0x672bed){if(!_0x672bed){_0x2e47f7[_0xe1d7('0x17')](0x194);}return _0x672bed;};}function handleError(_0x3abcb3,_0x4fea12){_0x4fea12=_0x4fea12||0x1f4;return function(_0x11dde2){logger[_0xe1d7('0x25')](_0x11dde2[_0xe1d7('0x26')]);if(_0x11dde2[_0xe1d7('0x27')]){delete _0x11dde2[_0xe1d7('0x27')];}_0x3abcb3[_0xe1d7('0x19')](_0x4fea12)[_0xe1d7('0x28')](_0x11dde2);};}exports['index']=function(_0x3e8ca3,_0x4a3344){var _0xbc38f3={},_0x264481={},_0x48d17e={'count':0x0,'rows':[]};var _0x565f3a=_[_0xe1d7('0x29')](db[_0xe1d7('0x2a')][_0xe1d7('0x2b')],function(_0x329506){return{'name':_0x329506[_0xe1d7('0x2c')],'type':_0x329506['type'][_0xe1d7('0x2d')]};});_0x264481[_0xe1d7('0x2e')]=_[_0xe1d7('0x29')](_0x565f3a,_0xe1d7('0x27'));_0x264481[_0xe1d7('0x2f')]=_['keys'](_0x3e8ca3[_0xe1d7('0x2f')]);_0x264481[_0xe1d7('0x30')]=_[_0xe1d7('0x31')](_0x264481[_0xe1d7('0x2e')],_0x264481[_0xe1d7('0x2f')]);_0xbc38f3[_0xe1d7('0x32')]=_[_0xe1d7('0x31')](_0x264481[_0xe1d7('0x2e')],qs['fields'](_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0xbc38f3[_0xe1d7('0x32')]=_0xbc38f3['attributes'][_0xe1d7('0x34')]?_0xbc38f3[_0xe1d7('0x32')]:_0x264481[_0xe1d7('0x2e')];if(!_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x35')](_0xe1d7('0x36'))){_0xbc38f3['limit']=qs[_0xe1d7('0x1c')](_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x1c')]);_0xbc38f3[_0xe1d7('0x1b')]=qs[_0xe1d7('0x1b')](_0x3e8ca3[_0xe1d7('0x2f')]['offset']);}_0xbc38f3[_0xe1d7('0x37')]=qs[_0xe1d7('0x38')](_0x3e8ca3[_0xe1d7('0x2f')]['sort']);_0xbc38f3[_0xe1d7('0x39')]=qs[_0xe1d7('0x30')](_[_0xe1d7('0x3a')](_0x3e8ca3['query'],_0x264481[_0xe1d7('0x30')]),_0x565f3a);if(_0x3e8ca3['query'][_0xe1d7('0x3b')]){_0xbc38f3[_0xe1d7('0x39')]=_['merge'](_0xbc38f3[_0xe1d7('0x39')],{'$or':_[_0xe1d7('0x29')](_0x565f3a,function(_0x412688){if(_0x412688['type']!==_0xe1d7('0x3c')){var _0xcf5b78={};_0xcf5b78[_0x412688['name']]={'$like':'%'+_0x3e8ca3[_0xe1d7('0x2f')]['filter']+'%'};return _0xcf5b78;}})});}_0xbc38f3=_[_0xe1d7('0x3d')]({},_0xbc38f3,_0x3e8ca3['options']);var _0x637d0e={'where':_0xbc38f3[_0xe1d7('0x39')]};return db[_0xe1d7('0x2a')][_0xe1d7('0x1e')](_0x637d0e)[_0xe1d7('0x23')](function(_0x285cc8){_0x48d17e[_0xe1d7('0x1e')]=_0x285cc8;if(_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x3e')]){_0xbc38f3['include']=[{'all':!![]}];}return db[_0xe1d7('0x2a')]['findAll'](_0xbc38f3);})[_0xe1d7('0x23')](function(_0xf92029){_0x48d17e[_0xe1d7('0x3f')]=_0xf92029;return _0x48d17e;})[_0xe1d7('0x23')](respondWithFilteredResult(_0x4a3344,_0xbc38f3))[_0xe1d7('0x40')](handleError(_0x4a3344,null));};exports[_0xe1d7('0x41')]=function(_0x12eeb1,_0x5c9bb3){var _0x26d1b0={'raw':![],'where':{'id':_0x12eeb1[_0xe1d7('0x42')]['id']}},_0x2841ce={};_0x2841ce[_0xe1d7('0x2e')]=_[_0xe1d7('0x43')](db[_0xe1d7('0x2a')]['rawAttributes']);_0x2841ce[_0xe1d7('0x2f')]=_[_0xe1d7('0x43')](_0x12eeb1[_0xe1d7('0x2f')]);_0x2841ce['filters']=_[_0xe1d7('0x31')](_0x2841ce[_0xe1d7('0x2e')],_0x2841ce[_0xe1d7('0x2f')]);_0x26d1b0[_0xe1d7('0x32')]=_[_0xe1d7('0x31')](_0x2841ce['model'],qs[_0xe1d7('0x33')](_0x12eeb1[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0x26d1b0[_0xe1d7('0x32')]=_0x26d1b0[_0xe1d7('0x32')][_0xe1d7('0x34')]?_0x26d1b0[_0xe1d7('0x32')]:_0x2841ce[_0xe1d7('0x2e')];if(_0x12eeb1[_0xe1d7('0x2f')][_0xe1d7('0x3e')]){_0x26d1b0['include']=[{'all':!![]}];}_0x26d1b0=_[_0xe1d7('0x3d')]({},_0x26d1b0,_0x12eeb1[_0xe1d7('0x44')]);return db[_0xe1d7('0x2a')]['find'](_0x26d1b0)['then'](handleEntityNotFound(_0x5c9bb3,null))[_0xe1d7('0x23')](respondWithResult(_0x5c9bb3,null))[_0xe1d7('0x40')](handleError(_0x5c9bb3,null));};exports[_0xe1d7('0x45')]=function(_0x3310fe,_0x21ac67){return db['SalesforceConfiguration'][_0xe1d7('0x45')](_0x3310fe['body'],{})[_0xe1d7('0x23')](respondWithResult(_0x21ac67,0xc9))[_0xe1d7('0x40')](handleError(_0x21ac67,null));};exports[_0xe1d7('0x46')]=function(_0x32e4a3,_0xd48848){if(_0x32e4a3['body']['id']){delete _0x32e4a3[_0xe1d7('0x47')]['id'];}return db[_0xe1d7('0x2a')][_0xe1d7('0x48')]({'where':{'id':_0x32e4a3['params']['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0xd48848,null))[_0xe1d7('0x23')](saveUpdates(_0x32e4a3[_0xe1d7('0x47')],null))['then'](respondWithResult(_0xd48848,null))[_0xe1d7('0x40')](handleError(_0xd48848,null));};exports['destroy']=function(_0x3bbbb0,_0x2b53e1){return db[_0xe1d7('0x2a')]['find']({'where':{'id':_0x3bbbb0['params']['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0x2b53e1,null))[_0xe1d7('0x23')](removeEntity(_0x2b53e1,null))[_0xe1d7('0x40')](handleError(_0x2b53e1,null));};exports[_0xe1d7('0x49')]=function(_0x51184f,_0x166ffd,_0x162f29){var _0x13b990={};var _0x421b83={};var _0x59b758;var _0x9b6dcd;return db[_0xe1d7('0x2a')][_0xe1d7('0x4a')]({'where':{'id':_0x51184f[_0xe1d7('0x42')]['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0x166ffd,null))['then'](function(_0x347a4c){if(_0x347a4c){_0x59b758=_0x347a4c;_0x421b83[_0xe1d7('0x2e')]=_[_0xe1d7('0x43')](db[_0xe1d7('0x4b')]['rawAttributes']);_0x421b83[_0xe1d7('0x2f')]=_['keys'](_0x51184f[_0xe1d7('0x2f')]);_0x421b83[_0xe1d7('0x30')]=_[_0xe1d7('0x31')](_0x421b83[_0xe1d7('0x2e')],_0x421b83['query']);_0x13b990[_0xe1d7('0x32')]=_[_0xe1d7('0x31')](_0x421b83['model'],qs[_0xe1d7('0x33')](_0x51184f[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0x13b990[_0xe1d7('0x32')]=_0x13b990[_0xe1d7('0x32')][_0xe1d7('0x34')]?_0x13b990[_0xe1d7('0x32')]:_0x421b83[_0xe1d7('0x2e')];_0x13b990[_0xe1d7('0x37')]=qs[_0xe1d7('0x38')](_0x51184f['query']['sort']);_0x13b990['where']=qs[_0xe1d7('0x30')](_[_0xe1d7('0x3a')](_0x51184f[_0xe1d7('0x2f')],_0x421b83['filters']));if(_0x51184f['query'][_0xe1d7('0x3b')]){_0x13b990[_0xe1d7('0x39')]=_['merge'](_0x13b990['where'],{'$or':_[_0xe1d7('0x29')](_0x13b990[_0xe1d7('0x32')],function(_0x447e24){var _0x2b64f3={};_0x2b64f3[_0x447e24]={'$like':'%'+_0x51184f[_0xe1d7('0x2f')][_0xe1d7('0x3b')]+'%'};return _0x2b64f3;})});}_0x13b990=_['merge']({},_0x13b990,_0x51184f['options']);return _0x59b758[_0xe1d7('0x49')](_0x13b990);}})['then'](function(_0x3d4297){if(_0x3d4297){_0x9b6dcd=_0x3d4297['length'];if(!_0x51184f['query'][_0xe1d7('0x35')]('nolimit')){_0x13b990[_0xe1d7('0x1c')]=qs['limit'](_0x51184f[_0xe1d7('0x2f')][_0xe1d7('0x1c')]);_0x13b990[_0xe1d7('0x1b')]=qs[_0xe1d7('0x1b')](_0x51184f[_0xe1d7('0x2f')][_0xe1d7('0x1b')]);}return _0x59b758[_0xe1d7('0x49')](_0x13b990);}})[_0xe1d7('0x23')](function(_0x4f703e){if(_0x4f703e){return _0x4f703e?{'count':_0x9b6dcd,'rows':_0x4f703e}:null;}})[_0xe1d7('0x23')](respondWithResult(_0x166ffd,null))[_0xe1d7('0x40')](handleError(_0x166ffd,null));};exports[_0xe1d7('0x4c')]=function(_0x37c397,_0x5f5452,_0xd37645){var _0x45547b={};var _0x591813={};var _0x1f41c0;var _0x5b99fd;return db[_0xe1d7('0x2a')]['findOne']({'where':{'id':_0x37c397['params']['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0x5f5452,null))[_0xe1d7('0x23')](function(_0x1a905b){if(_0x1a905b){_0x1f41c0=_0x1a905b;_0x591813[_0xe1d7('0x2e')]=_[_0xe1d7('0x43')](db[_0xe1d7('0x4b')][_0xe1d7('0x2b')]);_0x591813[_0xe1d7('0x2f')]=_[_0xe1d7('0x43')](_0x37c397['query']);_0x591813[_0xe1d7('0x30')]=_[_0xe1d7('0x31')](_0x591813['model'],_0x591813[_0xe1d7('0x2f')]);_0x45547b[_0xe1d7('0x32')]=_[_0xe1d7('0x31')](_0x591813[_0xe1d7('0x2e')],qs['fields'](_0x37c397[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0x45547b[_0xe1d7('0x32')]=_0x45547b[_0xe1d7('0x32')][_0xe1d7('0x34')]?_0x45547b[_0xe1d7('0x32')]:_0x591813[_0xe1d7('0x2e')];_0x45547b['order']=qs[_0xe1d7('0x38')](_0x37c397[_0xe1d7('0x2f')][_0xe1d7('0x38')]);_0x45547b[_0xe1d7('0x39')]=qs[_0xe1d7('0x30')](_[_0xe1d7('0x3a')](_0x37c397['query'],_0x591813['filters']));if(_0x37c397[_0xe1d7('0x2f')]['filter']){_0x45547b[_0xe1d7('0x39')]=_[_0xe1d7('0x3d')](_0x45547b['where'],{'$or':_['map'](_0x45547b[_0xe1d7('0x32')],function(_0x548343){var _0x3deb57={};_0x3deb57[_0x548343]={'$like':'%'+_0x37c397[_0xe1d7('0x2f')]['filter']+'%'};return _0x3deb57;})});}_0x45547b=_['merge']({},_0x45547b,_0x37c397[_0xe1d7('0x44')]);return _0x1f41c0['getSubjects'](_0x45547b);}})[_0xe1d7('0x23')](function(_0x36dc64){if(_0x36dc64){_0x5b99fd=_0x36dc64[_0xe1d7('0x34')];if(!_0x37c397[_0xe1d7('0x2f')]['hasOwnProperty'](_0xe1d7('0x36'))){_0x45547b[_0xe1d7('0x1c')]=qs[_0xe1d7('0x1c')](_0x37c397[_0xe1d7('0x2f')][_0xe1d7('0x1c')]);_0x45547b[_0xe1d7('0x1b')]=qs['offset'](_0x37c397['query'][_0xe1d7('0x1b')]);}return _0x1f41c0[_0xe1d7('0x4c')](_0x45547b);}})[_0xe1d7('0x23')](function(_0x2f974a){if(_0x2f974a){return _0x2f974a?{'count':_0x5b99fd,'rows':_0x2f974a}:null;}})['then'](respondWithResult(_0x5f5452,null))['catch'](handleError(_0x5f5452,null));};exports[_0xe1d7('0x4d')]=function(_0x31ea79,_0x3e47b4,_0x322f65){var _0x340b61={};var _0x6b0a88={};var _0x332aaf;var _0x3958ed;return db['SalesforceConfiguration'][_0xe1d7('0x4a')]({'where':{'id':_0x31ea79['params']['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0x3e47b4,null))[_0xe1d7('0x23')](function(_0xd97e20){if(_0xd97e20){_0x332aaf=_0xd97e20;_0x6b0a88[_0xe1d7('0x2e')]=_[_0xe1d7('0x43')](db['SalesforceField'][_0xe1d7('0x2b')]);_0x6b0a88['query']=_[_0xe1d7('0x43')](_0x31ea79[_0xe1d7('0x2f')]);_0x6b0a88[_0xe1d7('0x30')]=_['intersection'](_0x6b0a88[_0xe1d7('0x2e')],_0x6b0a88['query']);_0x340b61[_0xe1d7('0x32')]=_[_0xe1d7('0x31')](_0x6b0a88['model'],qs['fields'](_0x31ea79[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0x340b61[_0xe1d7('0x32')]=_0x340b61[_0xe1d7('0x32')][_0xe1d7('0x34')]?_0x340b61[_0xe1d7('0x32')]:_0x6b0a88[_0xe1d7('0x2e')];_0x340b61[_0xe1d7('0x37')]=qs[_0xe1d7('0x38')](_0x31ea79[_0xe1d7('0x2f')]['sort']);_0x340b61[_0xe1d7('0x39')]=qs[_0xe1d7('0x30')](_['pick'](_0x31ea79[_0xe1d7('0x2f')],_0x6b0a88[_0xe1d7('0x30')]));if(_0x31ea79[_0xe1d7('0x2f')][_0xe1d7('0x3b')]){_0x340b61[_0xe1d7('0x39')]=_['merge'](_0x340b61[_0xe1d7('0x39')],{'$or':_[_0xe1d7('0x29')](_0x340b61[_0xe1d7('0x32')],function(_0x35a973){var _0x22ded3={};_0x22ded3[_0x35a973]={'$like':'%'+_0x31ea79[_0xe1d7('0x2f')][_0xe1d7('0x3b')]+'%'};return _0x22ded3;})});}_0x340b61=_['merge']({},_0x340b61,_0x31ea79[_0xe1d7('0x44')]);return _0x332aaf['getDescriptions'](_0x340b61);}})['then'](function(_0x34adc0){if(_0x34adc0){_0x3958ed=_0x34adc0[_0xe1d7('0x34')];if(!_0x31ea79['query'][_0xe1d7('0x35')]('nolimit')){_0x340b61[_0xe1d7('0x1c')]=qs[_0xe1d7('0x1c')](_0x31ea79[_0xe1d7('0x2f')][_0xe1d7('0x1c')]);_0x340b61[_0xe1d7('0x1b')]=qs[_0xe1d7('0x1b')](_0x31ea79['query'][_0xe1d7('0x1b')]);}return _0x332aaf[_0xe1d7('0x4d')](_0x340b61);}})[_0xe1d7('0x23')](function(_0x3350e9){if(_0x3350e9){return _0x3350e9?{'count':_0x3958ed,'rows':_0x3350e9}:null;}})[_0xe1d7('0x23')](respondWithResult(_0x3e47b4,null))[_0xe1d7('0x40')](handleError(_0x3e47b4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f11beb5..6089ae7 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 _0xbc30=['lodash','../../config/logger','moment','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xbc30,0xc8));var _0x0bc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0bc3('0x0'));var util=require('util');var logger=require(_0x0bc3('0x1'))('api');var moment=require(_0x0bc3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bc3('0x3'));var rimraf=require(_0x0bc3('0x4'));var config=require(_0x0bc3('0x5'));var attributes=require(_0x0bc3('0x6'));module[_0x0bc3('0x7')]=function(_0x245742,_0x3e5dcd){return _0x245742[_0x0bc3('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x0bc3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x845d=['api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x1cae1d,_0x252ba9){var _0x5d074e=function(_0x1f40bb){while(--_0x1f40bb){_0x1cae1d['push'](_0x1cae1d['shift']());}};_0x5d074e(++_0x252ba9);}(_0x845d,0x1ce));var _0xd845=function(_0x84c6d6,_0xb17a3c){_0x84c6d6=_0x84c6d6-0x0;var _0x3dc6e5=_0x845d[_0x84c6d6];return _0x3dc6e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd845('0x0'));var moment=require(_0xd845('0x1'));var BPromise=require(_0xd845('0x2'));var rp=require(_0xd845('0x3'));var fs=require('fs');var path=require(_0xd845('0x4'));var rimraf=require('rimraf');var config=require(_0xd845('0x5'));var attributes=require(_0xd845('0x6'));module[_0xd845('0x7')]=function(_0x30b10b,_0x27db32){return _0x30b10b[_0xd845('0x8')](_0xd845('0x9'),attributes,{'tableName':_0xd845('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index be91772..07d3ab5 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 _0x616f=['http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xe9d651,_0x3b094a){var _0x809c52=function(_0x1cf692){while(--_0x1cf692){_0xe9d651['push'](_0xe9d651['shift']());}};_0x809c52(++_0x3b094a);}(_0x616f,0x1f0));var _0xf616=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0x616f[_0x130209];return _0x155fb7;};'use strict';var _=require(_0xf616('0x0'));var util=require(_0xf616('0x1'));var moment=require(_0xf616('0x2'));var BPromise=require(_0xf616('0x3'));var rs=require(_0xf616('0x4'));var fs=require('fs');var Redis=require(_0xf616('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf616('0x6'));var logger=require(_0xf616('0x7'))(_0xf616('0x8'));var config=require(_0xf616('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf616('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2484bb,_0x1bc68c,_0x210e27){return new BPromise(function(_0x36fd1c,_0x1b56f5){return client[_0xf616('0xb')](_0x2484bb,_0x210e27)[_0xf616('0xc')](function(_0x50ee72){logger[_0xf616('0xd')](_0xf616('0xe'),_0x1bc68c,'request\x20sent');logger[_0xf616('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1bc68c,_0xf616('0x10'),JSON[_0xf616('0x11')](_0x50ee72));if(_0x50ee72['error']){if(_0x50ee72['error'][_0xf616('0x12')]===0x1f4){logger[_0xf616('0x13')](_0xf616('0xe'),_0x1bc68c,_0x50ee72[_0xf616('0x13')][_0xf616('0x14')]);return _0x1b56f5(_0x50ee72[_0xf616('0x13')][_0xf616('0x14')]);}logger[_0xf616('0x13')](_0xf616('0xe'),_0x1bc68c,_0x50ee72[_0xf616('0x13')][_0xf616('0x14')]);return _0x36fd1c(_0x50ee72[_0xf616('0x13')][_0xf616('0x14')]);}else{logger[_0xf616('0xd')](_0xf616('0xe'),_0x1bc68c,_0xf616('0x10'));_0x36fd1c(_0x50ee72[_0xf616('0x15')]['message']);}})['catch'](function(_0x1fa4d9){logger[_0xf616('0x13')](_0xf616('0xe'),_0x1bc68c,_0x1fa4d9);_0x1b56f5(_0x1fa4d9);});});} \ No newline at end of file +var _0x3aae=['stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x240217,_0x1e885f){var _0x52dfbe=function(_0x40b69e){while(--_0x40b69e){_0x240217['push'](_0x240217['shift']());}};_0x52dfbe(++_0x1e885f);}(_0x3aae,0xa1));var _0xe3aa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3aae[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe3aa('0x0'));var BPromise=require(_0xe3aa('0x1'));var rs=require(_0xe3aa('0x2'));var fs=require('fs');var Redis=require(_0xe3aa('0x3'));var db=require(_0xe3aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3aa('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe3aa('0x6'));var client=jayson[_0xe3aa('0x7')][_0xe3aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10441a,_0x24ade1,_0x13eb9d){return new BPromise(function(_0x42776a,_0x500d89){return client[_0xe3aa('0x9')](_0x10441a,_0x13eb9d)[_0xe3aa('0xa')](function(_0x41bddb){logger[_0xe3aa('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x24ade1,_0xe3aa('0xc'));logger[_0xe3aa('0xd')](_0xe3aa('0xe'),_0x24ade1,_0xe3aa('0xc'),JSON[_0xe3aa('0xf')](_0x41bddb));if(_0x41bddb[_0xe3aa('0x10')]){if(_0x41bddb[_0xe3aa('0x10')][_0xe3aa('0x11')]===0x1f4){logger[_0xe3aa('0x10')](_0xe3aa('0x12'),_0x24ade1,_0x41bddb[_0xe3aa('0x10')][_0xe3aa('0x13')]);return _0x500d89(_0x41bddb[_0xe3aa('0x10')][_0xe3aa('0x13')]);}logger['error'](_0xe3aa('0x12'),_0x24ade1,_0x41bddb[_0xe3aa('0x10')]['message']);return _0x42776a(_0x41bddb[_0xe3aa('0x10')][_0xe3aa('0x13')]);}else{logger['info'](_0xe3aa('0x12'),_0x24ade1,'request\x20sent');_0x42776a(_0x41bddb[_0xe3aa('0x14')][_0xe3aa('0x13')]);}})[_0xe3aa('0x15')](function(_0x49d9f0){logger[_0xe3aa('0x10')](_0xe3aa('0x12'),_0x24ade1,_0x49d9f0);_0x500d89(_0x49d9f0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4ec68d6..fb2c76b 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 _0x0c44=['create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','isAuthenticated','show','post'];(function(_0x1f782d,_0x5906b8){var _0x228cce=function(_0x3036cc){while(--_0x3036cc){_0x1f782d['push'](_0x1f782d['shift']());}};_0x228cce(++_0x5906b8);}(_0x0c44,0x1d9));var _0x40c4=function(_0x59d22d,_0xafcff7){_0x59d22d=_0x59d22d-0x0;var _0x44b1e2=_0x0c44[_0x59d22d];return _0x44b1e2;};'use strict';var multer=require(_0x40c4('0x0'));var util=require(_0x40c4('0x1'));var path=require('path');var timeout=require(_0x40c4('0x2'));var express=require('express');var router=express[_0x40c4('0x3')]();var fs_extra=require(_0x40c4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x40c4('0x5'));var config=require(_0x40c4('0x6'));var controller=require(_0x40c4('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x40c4('0x8')](_0x40c4('0x9'),auth[_0x40c4('0xa')](),controller[_0x40c4('0xb')]);router[_0x40c4('0xc')]('/',auth['isAuthenticated'](),controller[_0x40c4('0xd')]);router['put'](_0x40c4('0x9'),auth[_0x40c4('0xa')](),controller[_0x40c4('0xe')]);router[_0x40c4('0xf')](_0x40c4('0x9'),auth[_0x40c4('0xa')](),controller[_0x40c4('0x10')]);module[_0x40c4('0x11')]=router; \ No newline at end of file +var _0x6254=['create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','get','show'];(function(_0x27ca72,_0x1e17d0){var _0xec08b2=function(_0x11e470){while(--_0x11e470){_0x27ca72['push'](_0x27ca72['shift']());}};_0xec08b2(++_0x1e17d0);}(_0x6254,0x1ab));var _0x4625=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0x6254[_0x17784a];return _0x41aded;};'use strict';var multer=require(_0x4625('0x0'));var util=require(_0x4625('0x1'));var path=require(_0x4625('0x2'));var timeout=require(_0x4625('0x3'));var express=require(_0x4625('0x4'));var router=express[_0x4625('0x5')]();var fs_extra=require(_0x4625('0x6'));var auth=require(_0x4625('0x7'));var interaction=require(_0x4625('0x8'));var config=require(_0x4625('0x9'));var controller=require(_0x4625('0xa'));router['get']('/',auth[_0x4625('0xb')](),controller['index']);router[_0x4625('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x4625('0xd')]);router['post']('/',auth[_0x4625('0xb')](),controller[_0x4625('0xe')]);router[_0x4625('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x4625('0x10')]);router[_0x4625('0x11')](_0x4625('0x12'),auth[_0x4625('0xb')](),controller[_0x4625('0x13')]);module[_0x4625('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index f49c670..6cea41f 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 _0x6261=['keyValue','picklist','STRING','ENUM','string','variable','customVariable'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x6261,0x100));var _0x1626=function(_0x14d3c0,_0x57ec6f){_0x14d3c0=_0x14d3c0-0x0;var _0x24199f=_0x6261[_0x14d3c0];return _0x24199f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x1626('0x0'),_0x1626('0x1'),_0x1626('0x2'),_0x1626('0x3'),_0x1626('0x4')),'defaultValue':_0x1626('0x0')},'content':{'type':Sequelize[_0x1626('0x5')]},'key':{'type':Sequelize[_0x1626('0x5')]},'keyType':{'type':Sequelize[_0x1626('0x6')](_0x1626('0x0'),_0x1626('0x1'),_0x1626('0x2'))},'keyContent':{'type':Sequelize[_0x1626('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34e7=['picklist','STRING','variable','ENUM','string','customVariable'];(function(_0x15af8c,_0x3af296){var _0x5b057a=function(_0x22e6ab){while(--_0x22e6ab){_0x15af8c['push'](_0x15af8c['shift']());}};_0x5b057a(++_0x3af296);}(_0x34e7,0x7b));var _0x734e=function(_0x24b532,_0x275e05){_0x24b532=_0x24b532-0x0;var _0x5f5d2c=_0x34e7[_0x24b532];return _0x5f5d2c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x734e('0x0')](_0x734e('0x1'),'variable',_0x734e('0x2'),'keyValue',_0x734e('0x3')),'defaultValue':_0x734e('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x734e('0x4')]},'keyType':{'type':Sequelize[_0x734e('0x0')](_0x734e('0x1'),_0x734e('0x5'),_0x734e('0x2'))},'keyContent':{'type':Sequelize[_0x734e('0x4')]},'idField':{'type':Sequelize[_0x734e('0x4')]},'variableName':{'type':Sequelize[_0x734e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2e157b3..4080e27 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 _0xb057=['rows','catch','find','create','body','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll'];(function(_0x91e24e,_0x2eddb3){var _0x642ebd=function(_0x4b53c7){while(--_0x4b53c7){_0x91e24e['push'](_0x91e24e['shift']());}};_0x642ebd(++_0x2eddb3);}(_0xb057,0x95));var _0x7b05=function(_0x5a4813,_0x122be0){_0x5a4813=_0x5a4813-0x0;var _0x4c4086=_0xb057[_0x5a4813];return _0x4c4086;};'use strict';var emlformat=require(_0x7b05('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b05('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b05('0x2'));var BPromise=require(_0x7b05('0x3'));var Mustache=require('mustache');var util=require(_0x7b05('0x4'));var path=require(_0x7b05('0x5'));var sox=require(_0x7b05('0x6'));var csv=require(_0x7b05('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b05('0x8'));var squel=require(_0x7b05('0x9'));var crypto=require(_0x7b05('0xa'));var jsforce=require(_0x7b05('0xb'));var deskjs=require(_0x7b05('0xc'));var toCsv=require(_0x7b05('0x7'));var querystring=require('querystring');var Papa=require(_0x7b05('0xd'));var Redis=require('ioredis');var authService=require(_0x7b05('0xe'));var qs=require(_0x7b05('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b05('0x10'));var logger=require(_0x7b05('0x11'))(_0x7b05('0x12'));var utils=require(_0x7b05('0x13'));var config=require(_0x7b05('0x14'));var licenseUtil=require(_0x7b05('0x15'));var db=require(_0x7b05('0x16'))['db'];function respondWithStatusCode(_0x57a281,_0x1fe309){_0x1fe309=_0x1fe309||0xcc;return function(_0x4475d5){if(_0x4475d5){return _0x57a281[_0x7b05('0x17')](_0x1fe309);}return _0x57a281[_0x7b05('0x18')](_0x1fe309)['end']();};}function respondWithResult(_0x1afdac,_0x57b9fd){_0x57b9fd=_0x57b9fd||0xc8;return function(_0x116e57){if(_0x116e57){return _0x1afdac[_0x7b05('0x18')](_0x57b9fd)[_0x7b05('0x19')](_0x116e57);}};}function respondWithFilteredResult(_0x5b8334,_0x1d65a9){return function(_0x3f509e){if(_0x3f509e){var _0x1e6346=typeof _0x1d65a9[_0x7b05('0x1a')]===_0x7b05('0x1b')&&typeof _0x1d65a9[_0x7b05('0x1c')]===_0x7b05('0x1b');var _0x874870=_0x3f509e[_0x7b05('0x1d')];var _0x4616d4=_0x1e6346?0x0:_0x1d65a9[_0x7b05('0x1a')];var _0xe695ab=_0x1e6346?_0x3f509e['count']:_0x1d65a9[_0x7b05('0x1a')]+_0x1d65a9[_0x7b05('0x1c')];var _0x507824;if(_0xe695ab>=_0x874870){_0xe695ab=_0x874870;_0x507824=0xc8;}else{_0x507824=0xce;}_0x5b8334[_0x7b05('0x18')](_0x507824);return _0x5b8334['set'](_0x7b05('0x1e'),_0x4616d4+'-'+_0xe695ab+'/'+_0x874870)[_0x7b05('0x19')](_0x3f509e);}return null;};}function patchUpdates(_0xc20784){return function(_0x4d1872){try{jsonpatch[_0x7b05('0x1f')](_0x4d1872,_0xc20784,!![]);}catch(_0x2a5e84){return BPromise[_0x7b05('0x20')](_0x2a5e84);}return _0x4d1872[_0x7b05('0x21')]();};}function saveUpdates(_0x529526,_0x3fdf77){return function(_0x4a4946){if(_0x4a4946){return _0x4a4946[_0x7b05('0x22')](_0x529526)[_0x7b05('0x23')](function(_0x294c93){return _0x294c93;});}return null;};}function removeEntity(_0x55e7e4,_0x3b337b){return function(_0x4e98f4){if(_0x4e98f4){return _0x4e98f4[_0x7b05('0x24')]()[_0x7b05('0x23')](function(){_0x55e7e4[_0x7b05('0x18')](0xcc)[_0x7b05('0x25')]();});}};}function handleEntityNotFound(_0x32ad0f,_0x2c42f0){return function(_0x15002e){if(!_0x15002e){_0x32ad0f[_0x7b05('0x17')](0x194);}return _0x15002e;};}function handleError(_0x476db3,_0x78552d){_0x78552d=_0x78552d||0x1f4;return function(_0x2e8436){logger[_0x7b05('0x26')](_0x2e8436['stack']);if(_0x2e8436['name']){delete _0x2e8436[_0x7b05('0x27')];}_0x476db3[_0x7b05('0x18')](_0x78552d)[_0x7b05('0x28')](_0x2e8436);};}exports[_0x7b05('0x29')]=function(_0x179d36,_0x51bce5){var _0x56df0e={},_0x483373={},_0x2a7a09={'count':0x0,'rows':[]};var _0x3f5f3a=_['map'](db[_0x7b05('0x2a')][_0x7b05('0x2b')],function(_0x480945){return{'name':_0x480945[_0x7b05('0x2c')],'type':_0x480945[_0x7b05('0x2d')][_0x7b05('0x2e')]};});_0x483373[_0x7b05('0x2f')]=_['map'](_0x3f5f3a,_0x7b05('0x27'));_0x483373['query']=_[_0x7b05('0x30')](_0x179d36[_0x7b05('0x31')]);_0x483373[_0x7b05('0x32')]=_[_0x7b05('0x33')](_0x483373[_0x7b05('0x2f')],_0x483373['query']);_0x56df0e['attributes']=_[_0x7b05('0x33')](_0x483373[_0x7b05('0x2f')],qs[_0x7b05('0x34')](_0x179d36[_0x7b05('0x31')]['fields']));_0x56df0e['attributes']=_0x56df0e[_0x7b05('0x35')][_0x7b05('0x36')]?_0x56df0e[_0x7b05('0x35')]:_0x483373[_0x7b05('0x2f')];if(!_0x179d36[_0x7b05('0x31')]['hasOwnProperty'](_0x7b05('0x37'))){_0x56df0e['limit']=qs[_0x7b05('0x1c')](_0x179d36[_0x7b05('0x31')]['limit']);_0x56df0e[_0x7b05('0x1a')]=qs[_0x7b05('0x1a')](_0x179d36['query'][_0x7b05('0x1a')]);}_0x56df0e[_0x7b05('0x38')]=qs[_0x7b05('0x39')](_0x179d36[_0x7b05('0x31')][_0x7b05('0x39')]);_0x56df0e[_0x7b05('0x3a')]=qs['filters'](_[_0x7b05('0x3b')](_0x179d36[_0x7b05('0x31')],_0x483373[_0x7b05('0x32')]),_0x3f5f3a);if(_0x179d36[_0x7b05('0x31')][_0x7b05('0x3c')]){_0x56df0e[_0x7b05('0x3a')]=_[_0x7b05('0x3d')](_0x56df0e[_0x7b05('0x3a')],{'$or':_[_0x7b05('0x3e')](_0x3f5f3a,function(_0x48cbe4){if(_0x48cbe4[_0x7b05('0x2d')]!=='VIRTUAL'){var _0x23a7b0={};_0x23a7b0[_0x48cbe4[_0x7b05('0x27')]]={'$like':'%'+_0x179d36[_0x7b05('0x31')][_0x7b05('0x3c')]+'%'};return _0x23a7b0;}})});}_0x56df0e=_[_0x7b05('0x3d')]({},_0x56df0e,_0x179d36[_0x7b05('0x3f')]);var _0x8b91be={'where':_0x56df0e[_0x7b05('0x3a')]};return db[_0x7b05('0x2a')][_0x7b05('0x1d')](_0x8b91be)[_0x7b05('0x23')](function(_0x4f7330){_0x2a7a09[_0x7b05('0x1d')]=_0x4f7330;if(_0x179d36[_0x7b05('0x31')][_0x7b05('0x40')]){_0x56df0e[_0x7b05('0x41')]=[{'all':!![]}];}return db[_0x7b05('0x2a')][_0x7b05('0x42')](_0x56df0e);})[_0x7b05('0x23')](function(_0x33ee92){_0x2a7a09[_0x7b05('0x43')]=_0x33ee92;return _0x2a7a09;})[_0x7b05('0x23')](respondWithFilteredResult(_0x51bce5,_0x56df0e))[_0x7b05('0x44')](handleError(_0x51bce5,null));};exports['show']=function(_0x33144e,_0x474bc5){var _0x3fb63c={'raw':!![],'where':{'id':_0x33144e['params']['id']}},_0x26b2fc={};_0x26b2fc['model']=_[_0x7b05('0x30')](db['SalesforceField'][_0x7b05('0x2b')]);_0x26b2fc[_0x7b05('0x31')]=_['keys'](_0x33144e[_0x7b05('0x31')]);_0x26b2fc[_0x7b05('0x32')]=_[_0x7b05('0x33')](_0x26b2fc[_0x7b05('0x2f')],_0x26b2fc[_0x7b05('0x31')]);_0x3fb63c[_0x7b05('0x35')]=_[_0x7b05('0x33')](_0x26b2fc['model'],qs['fields'](_0x33144e[_0x7b05('0x31')][_0x7b05('0x34')]));_0x3fb63c[_0x7b05('0x35')]=_0x3fb63c[_0x7b05('0x35')]['length']?_0x3fb63c[_0x7b05('0x35')]:_0x26b2fc[_0x7b05('0x2f')];if(_0x33144e[_0x7b05('0x31')][_0x7b05('0x40')]){_0x3fb63c[_0x7b05('0x41')]=[{'all':!![]}];}_0x3fb63c=_[_0x7b05('0x3d')]({},_0x3fb63c,_0x33144e[_0x7b05('0x3f')]);return db[_0x7b05('0x2a')][_0x7b05('0x45')](_0x3fb63c)['then'](handleEntityNotFound(_0x474bc5,null))[_0x7b05('0x23')](respondWithResult(_0x474bc5,null))[_0x7b05('0x44')](handleError(_0x474bc5,null));};exports[_0x7b05('0x46')]=function(_0x4d1160,_0x125cf0){return db[_0x7b05('0x2a')][_0x7b05('0x46')](_0x4d1160['body'],{})[_0x7b05('0x23')](respondWithResult(_0x125cf0,0xc9))['catch'](handleError(_0x125cf0,null));};exports[_0x7b05('0x22')]=function(_0x561287,_0x11c273){if(_0x561287[_0x7b05('0x47')]['id']){delete _0x561287[_0x7b05('0x47')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x561287['params']['id']}})[_0x7b05('0x23')](handleEntityNotFound(_0x11c273,null))[_0x7b05('0x23')](saveUpdates(_0x561287[_0x7b05('0x47')],null))[_0x7b05('0x23')](respondWithResult(_0x11c273,null))[_0x7b05('0x44')](handleError(_0x11c273,null));};exports['destroy']=function(_0x1b8f5b,_0x4af7b2){return db[_0x7b05('0x2a')]['find']({'where':{'id':_0x1b8f5b['params']['id']}})[_0x7b05('0x23')](handleEntityNotFound(_0x4af7b2,null))[_0x7b05('0x23')](removeEntity(_0x4af7b2,null))['catch'](handleError(_0x4af7b2,null));}; \ No newline at end of file +var _0x6f4e=['filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SalesforceField','rows','catch','show','params','keys','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query'];(function(_0xddb2f7,_0x21c409){var _0x5bd2bb=function(_0x54d5a5){while(--_0x54d5a5){_0xddb2f7['push'](_0xddb2f7['shift']());}};_0x5bd2bb(++_0x21c409);}(_0x6f4e,0xab));var _0xe6f4=function(_0x3866d7,_0x23e0b3){_0x3866d7=_0x3866d7-0x0;var _0x4da53f=_0x6f4e[_0x3866d7];return _0x4da53f;};'use strict';var emlformat=require(_0xe6f4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6f4('0x1'));var rp=require(_0xe6f4('0x2'));var moment=require(_0xe6f4('0x3'));var BPromise=require(_0xe6f4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe6f4('0x5'));var csv=require('to-csv');var ejs=require(_0xe6f4('0x6'));var fs=require('fs');var fs_extra=require(_0xe6f4('0x7'));var _=require(_0xe6f4('0x8'));var squel=require(_0xe6f4('0x9'));var crypto=require('crypto');var jsforce=require(_0xe6f4('0xa'));var deskjs=require(_0xe6f4('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe6f4('0xc'));var Redis=require(_0xe6f4('0xd'));var authService=require(_0xe6f4('0xe'));var qs=require(_0xe6f4('0xf'));var as=require(_0xe6f4('0x10'));var hardwareService=require(_0xe6f4('0x11'));var logger=require('../../config/logger')(_0xe6f4('0x12'));var utils=require(_0xe6f4('0x13'));var config=require(_0xe6f4('0x14'));var licenseUtil=require(_0xe6f4('0x15'));var db=require(_0xe6f4('0x16'))['db'];function respondWithStatusCode(_0x3f81c5,_0x337974){_0x337974=_0x337974||0xcc;return function(_0x4c8b94){if(_0x4c8b94){return _0x3f81c5['sendStatus'](_0x337974);}return _0x3f81c5[_0xe6f4('0x17')](_0x337974)['end']();};}function respondWithResult(_0x458b17,_0x87c614){_0x87c614=_0x87c614||0xc8;return function(_0x57f8eb){if(_0x57f8eb){return _0x458b17[_0xe6f4('0x17')](_0x87c614)[_0xe6f4('0x18')](_0x57f8eb);}};}function respondWithFilteredResult(_0x5b71ef,_0x459c4e){return function(_0x34e82f){if(_0x34e82f){var _0x34f7c5=typeof _0x459c4e['offset']==='undefined'&&typeof _0x459c4e['limit']===_0xe6f4('0x19');var _0x44c148=_0x34e82f[_0xe6f4('0x1a')];var _0x4b93b3=_0x34f7c5?0x0:_0x459c4e[_0xe6f4('0x1b')];var _0x184b01=_0x34f7c5?_0x34e82f[_0xe6f4('0x1a')]:_0x459c4e[_0xe6f4('0x1b')]+_0x459c4e[_0xe6f4('0x1c')];var _0x51c024;if(_0x184b01>=_0x44c148){_0x184b01=_0x44c148;_0x51c024=0xc8;}else{_0x51c024=0xce;}_0x5b71ef['status'](_0x51c024);return _0x5b71ef['set'](_0xe6f4('0x1d'),_0x4b93b3+'-'+_0x184b01+'/'+_0x44c148)['json'](_0x34e82f);}return null;};}function patchUpdates(_0x3c3910){return function(_0x191679){try{jsonpatch[_0xe6f4('0x1e')](_0x191679,_0x3c3910,!![]);}catch(_0x13b094){return BPromise[_0xe6f4('0x1f')](_0x13b094);}return _0x191679[_0xe6f4('0x20')]();};}function saveUpdates(_0x12ac9b,_0x1cbd86){return function(_0x21b762){if(_0x21b762){return _0x21b762[_0xe6f4('0x21')](_0x12ac9b)[_0xe6f4('0x22')](function(_0x675327){return _0x675327;});}return null;};}function removeEntity(_0x225e52,_0x507562){return function(_0xa339f8){if(_0xa339f8){return _0xa339f8[_0xe6f4('0x23')]()[_0xe6f4('0x22')](function(){_0x225e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd74a,_0x94bcf4){return function(_0x22ce30){if(!_0x22ce30){_0x2cd74a[_0xe6f4('0x24')](0x194);}return _0x22ce30;};}function handleError(_0x2f212b,_0x19c8a3){_0x19c8a3=_0x19c8a3||0x1f4;return function(_0x387868){logger[_0xe6f4('0x25')](_0x387868[_0xe6f4('0x26')]);if(_0x387868[_0xe6f4('0x27')]){delete _0x387868[_0xe6f4('0x27')];}_0x2f212b[_0xe6f4('0x17')](_0x19c8a3)[_0xe6f4('0x28')](_0x387868);};}exports[_0xe6f4('0x29')]=function(_0xcc1b6c,_0x559f82){var _0xdd174d={},_0x2adaa7={},_0x4a422f={'count':0x0,'rows':[]};var _0x22b162=_[_0xe6f4('0x2a')](db['SalesforceField'][_0xe6f4('0x2b')],function(_0x4eeb9f){return{'name':_0x4eeb9f[_0xe6f4('0x2c')],'type':_0x4eeb9f[_0xe6f4('0x2d')][_0xe6f4('0x2e')]};});_0x2adaa7['model']=_[_0xe6f4('0x2a')](_0x22b162,_0xe6f4('0x27'));_0x2adaa7[_0xe6f4('0x2f')]=_['keys'](_0xcc1b6c[_0xe6f4('0x2f')]);_0x2adaa7[_0xe6f4('0x30')]=_[_0xe6f4('0x31')](_0x2adaa7[_0xe6f4('0x32')],_0x2adaa7[_0xe6f4('0x2f')]);_0xdd174d[_0xe6f4('0x33')]=_['intersection'](_0x2adaa7[_0xe6f4('0x32')],qs[_0xe6f4('0x34')](_0xcc1b6c[_0xe6f4('0x2f')][_0xe6f4('0x34')]));_0xdd174d[_0xe6f4('0x33')]=_0xdd174d[_0xe6f4('0x33')][_0xe6f4('0x35')]?_0xdd174d['attributes']:_0x2adaa7['model'];if(!_0xcc1b6c['query'][_0xe6f4('0x36')]('nolimit')){_0xdd174d[_0xe6f4('0x1c')]=qs[_0xe6f4('0x1c')](_0xcc1b6c[_0xe6f4('0x2f')][_0xe6f4('0x1c')]);_0xdd174d[_0xe6f4('0x1b')]=qs['offset'](_0xcc1b6c[_0xe6f4('0x2f')][_0xe6f4('0x1b')]);}_0xdd174d[_0xe6f4('0x37')]=qs['sort'](_0xcc1b6c[_0xe6f4('0x2f')]['sort']);_0xdd174d[_0xe6f4('0x38')]=qs[_0xe6f4('0x30')](_[_0xe6f4('0x39')](_0xcc1b6c[_0xe6f4('0x2f')],_0x2adaa7[_0xe6f4('0x30')]),_0x22b162);if(_0xcc1b6c[_0xe6f4('0x2f')][_0xe6f4('0x3a')]){_0xdd174d[_0xe6f4('0x38')]=_[_0xe6f4('0x3b')](_0xdd174d[_0xe6f4('0x38')],{'$or':_['map'](_0x22b162,function(_0x383591){if(_0x383591[_0xe6f4('0x2d')]!==_0xe6f4('0x3c')){var _0x4ae988={};_0x4ae988[_0x383591[_0xe6f4('0x27')]]={'$like':'%'+_0xcc1b6c['query'][_0xe6f4('0x3a')]+'%'};return _0x4ae988;}})});}_0xdd174d=_[_0xe6f4('0x3b')]({},_0xdd174d,_0xcc1b6c[_0xe6f4('0x3d')]);var _0x527d3f={'where':_0xdd174d['where']};return db['SalesforceField'][_0xe6f4('0x1a')](_0x527d3f)[_0xe6f4('0x22')](function(_0x3bc27a){_0x4a422f[_0xe6f4('0x1a')]=_0x3bc27a;if(_0xcc1b6c['query'][_0xe6f4('0x3e')]){_0xdd174d[_0xe6f4('0x3f')]=[{'all':!![]}];}return db[_0xe6f4('0x40')]['findAll'](_0xdd174d);})['then'](function(_0x328536){_0x4a422f[_0xe6f4('0x41')]=_0x328536;return _0x4a422f;})[_0xe6f4('0x22')](respondWithFilteredResult(_0x559f82,_0xdd174d))[_0xe6f4('0x42')](handleError(_0x559f82,null));};exports[_0xe6f4('0x43')]=function(_0x17b29b,_0x2e6e02){var _0xd51f75={'raw':!![],'where':{'id':_0x17b29b[_0xe6f4('0x44')]['id']}},_0x57dd57={};_0x57dd57[_0xe6f4('0x32')]=_[_0xe6f4('0x45')](db[_0xe6f4('0x40')][_0xe6f4('0x2b')]);_0x57dd57[_0xe6f4('0x2f')]=_[_0xe6f4('0x45')](_0x17b29b[_0xe6f4('0x2f')]);_0x57dd57['filters']=_['intersection'](_0x57dd57[_0xe6f4('0x32')],_0x57dd57[_0xe6f4('0x2f')]);_0xd51f75[_0xe6f4('0x33')]=_[_0xe6f4('0x31')](_0x57dd57[_0xe6f4('0x32')],qs['fields'](_0x17b29b[_0xe6f4('0x2f')][_0xe6f4('0x34')]));_0xd51f75[_0xe6f4('0x33')]=_0xd51f75['attributes']['length']?_0xd51f75[_0xe6f4('0x33')]:_0x57dd57[_0xe6f4('0x32')];if(_0x17b29b['query'][_0xe6f4('0x3e')]){_0xd51f75[_0xe6f4('0x3f')]=[{'all':!![]}];}_0xd51f75=_['merge']({},_0xd51f75,_0x17b29b['options']);return db[_0xe6f4('0x40')][_0xe6f4('0x46')](_0xd51f75)[_0xe6f4('0x22')](handleEntityNotFound(_0x2e6e02,null))[_0xe6f4('0x22')](respondWithResult(_0x2e6e02,null))[_0xe6f4('0x42')](handleError(_0x2e6e02,null));};exports[_0xe6f4('0x47')]=function(_0xfa36be,_0x1e312a){return db['SalesforceField'][_0xe6f4('0x47')](_0xfa36be[_0xe6f4('0x48')],{})[_0xe6f4('0x22')](respondWithResult(_0x1e312a,0xc9))[_0xe6f4('0x42')](handleError(_0x1e312a,null));};exports[_0xe6f4('0x21')]=function(_0x2b50ec,_0x58fe5d){if(_0x2b50ec[_0xe6f4('0x48')]['id']){delete _0x2b50ec[_0xe6f4('0x48')]['id'];}return db[_0xe6f4('0x40')]['find']({'where':{'id':_0x2b50ec[_0xe6f4('0x44')]['id']}})[_0xe6f4('0x22')](handleEntityNotFound(_0x58fe5d,null))['then'](saveUpdates(_0x2b50ec['body'],null))[_0xe6f4('0x22')](respondWithResult(_0x58fe5d,null))['catch'](handleError(_0x58fe5d,null));};exports[_0xe6f4('0x23')]=function(_0xe7f0e1,_0x21c16c){return db[_0xe6f4('0x40')][_0xe6f4('0x46')]({'where':{'id':_0xe7f0e1[_0xe6f4('0x44')]['id']}})[_0xe6f4('0x22')](handleEntityNotFound(_0x21c16c,null))[_0xe6f4('0x22')](removeEntity(_0x21c16c,null))['catch'](handleError(_0x21c16c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ae4c01e..95b5ed4 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 _0x3f97=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3171ef,_0x50dbf9){var _0x248202=function(_0x2ddca7){while(--_0x2ddca7){_0x3171ef['push'](_0x3171ef['shift']());}};_0x248202(++_0x50dbf9);}(_0x3f97,0xf6));var _0x73f9=function(_0x3fae5f,_0x209c3a){_0x3fae5f=_0x3fae5f-0x0;var _0x7e4d7d=_0x3f97[_0x3fae5f];return _0x7e4d7d;};'use strict';var _=require(_0x73f9('0x0'));var util=require(_0x73f9('0x1'));var logger=require(_0x73f9('0x2'))('api');var moment=require(_0x73f9('0x3'));var BPromise=require(_0x73f9('0x4'));var rp=require(_0x73f9('0x5'));var fs=require('fs');var path=require(_0x73f9('0x6'));var rimraf=require(_0x73f9('0x7'));var config=require(_0x73f9('0x8'));var attributes=require(_0x73f9('0x9'));module[_0x73f9('0xa')]=function(_0x1a5f12,_0x48360d){return _0x1a5f12[_0x73f9('0xb')](_0x73f9('0xc'),attributes,{'tableName':_0x73f9('0xd'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x73f9('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe87=['request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x460afa,_0x3f8bb6){var _0x224a4e=function(_0x465079){while(--_0x465079){_0x460afa['push'](_0x460afa['shift']());}};_0x224a4e(++_0x3f8bb6);}(_0xbe87,0x1ca));var _0x7be8=function(_0x5a4805,_0x25413b){_0x5a4805=_0x5a4805-0x0;var _0x492346=_0xbe87[_0x5a4805];return _0x492346;};'use strict';var _=require(_0x7be8('0x0'));var util=require(_0x7be8('0x1'));var logger=require(_0x7be8('0x2'))(_0x7be8('0x3'));var moment=require(_0x7be8('0x4'));var BPromise=require(_0x7be8('0x5'));var rp=require(_0x7be8('0x6'));var fs=require('fs');var path=require(_0x7be8('0x7'));var rimraf=require('rimraf');var config=require(_0x7be8('0x8'));var attributes=require(_0x7be8('0x9'));module[_0x7be8('0xa')]=function(_0x3458c7,_0x178a57){return _0x3458c7[_0x7be8('0xb')](_0x7be8('0xc'),attributes,{'tableName':_0x7be8('0xd'),'paranoid':![],'indexes':[{'name':_0x7be8('0xe'),'fields':[_0x7be8('0xf'),'FieldId'],'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 3700998..df0d870 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 _0xbbb6=['request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s'];(function(_0x3dcb7f,_0x1a0c78){var _0x23966d=function(_0x37fc76){while(--_0x37fc76){_0x3dcb7f['push'](_0x3dcb7f['shift']());}};_0x23966d(++_0x1a0c78);}(_0xbbb6,0x70));var _0x6bbb=function(_0x4e0fa4,_0x130453){_0x4e0fa4=_0x4e0fa4-0x0;var _0x19640b=_0xbbb6[_0x4e0fa4];return _0x19640b;};'use strict';var _=require(_0x6bbb('0x0'));var util=require(_0x6bbb('0x1'));var moment=require(_0x6bbb('0x2'));var BPromise=require('bluebird');var rs=require(_0x6bbb('0x3'));var fs=require('fs');var Redis=require(_0x6bbb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6bbb('0x5'));var logger=require('../../config/logger')(_0x6bbb('0x6'));var config=require(_0x6bbb('0x7'));var jayson=require(_0x6bbb('0x8'));var client=jayson[_0x6bbb('0x9')][_0x6bbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d6c42,_0x262460,_0x2bfb0a){return new BPromise(function(_0x3f1fc1,_0x4d3062){return client[_0x6bbb('0xb')](_0x5d6c42,_0x2bfb0a)[_0x6bbb('0xc')](function(_0x58fe6b){logger['info'](_0x6bbb('0xd'),_0x262460,_0x6bbb('0xe'));logger['debug'](_0x6bbb('0xf'),_0x262460,_0x6bbb('0xe'),JSON[_0x6bbb('0x10')](_0x58fe6b));if(_0x58fe6b[_0x6bbb('0x11')]){if(_0x58fe6b[_0x6bbb('0x11')]['code']===0x1f4){logger[_0x6bbb('0x11')]('SalesforceField,\x20%s,\x20%s',_0x262460,_0x58fe6b[_0x6bbb('0x11')][_0x6bbb('0x12')]);return _0x4d3062(_0x58fe6b[_0x6bbb('0x11')][_0x6bbb('0x12')]);}logger['error'](_0x6bbb('0xd'),_0x262460,_0x58fe6b[_0x6bbb('0x11')][_0x6bbb('0x12')]);return _0x3f1fc1(_0x58fe6b['error'][_0x6bbb('0x12')]);}else{logger[_0x6bbb('0x13')]('SalesforceField,\x20%s,\x20%s',_0x262460,'request\x20sent');_0x3f1fc1(_0x58fe6b[_0x6bbb('0x14')][_0x6bbb('0x12')]);}})['catch'](function(_0x15c464){logger[_0x6bbb('0x11')]('SalesforceField,\x20%s,\x20%s',_0x262460,_0x15c464);_0x4d3062(_0x15c464);});});} \ No newline at end of file +var _0x3139=['request\x20sent','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2206d2,_0x3c09ec){var _0x9d1f13=function(_0x2f1bbd){while(--_0x2f1bbd){_0x2206d2['push'](_0x2206d2['shift']());}};_0x9d1f13(++_0x3c09ec);}(_0x3139,0x1ba));var _0x9313=function(_0x260742,_0x2f50bc){_0x260742=_0x260742-0x0;var _0x82818c=_0x3139[_0x260742];return _0x82818c;};'use strict';var _=require('lodash');var util=require(_0x9313('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9313('0x1'));var fs=require('fs');var Redis=require(_0x9313('0x2'));var db=require(_0x9313('0x3'))['db'];var utils=require(_0x9313('0x4'));var logger=require(_0x9313('0x5'))(_0x9313('0x6'));var config=require(_0x9313('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9313('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18d3e4,_0x2896ac,_0x186520){return new BPromise(function(_0x28b795,_0x5b020f){return client[_0x9313('0x9')](_0x18d3e4,_0x186520)[_0x9313('0xa')](function(_0x98c349){logger[_0x9313('0xb')](_0x9313('0xc'),_0x2896ac,'request\x20sent');logger[_0x9313('0xd')](_0x9313('0xe'),_0x2896ac,'request\x20sent',JSON[_0x9313('0xf')](_0x98c349));if(_0x98c349[_0x9313('0x10')]){if(_0x98c349[_0x9313('0x10')]['code']===0x1f4){logger[_0x9313('0x10')]('SalesforceField,\x20%s,\x20%s',_0x2896ac,_0x98c349[_0x9313('0x10')][_0x9313('0x11')]);return _0x5b020f(_0x98c349[_0x9313('0x10')]['message']);}logger[_0x9313('0x10')](_0x9313('0xc'),_0x2896ac,_0x98c349[_0x9313('0x10')]['message']);return _0x28b795(_0x98c349['error'][_0x9313('0x11')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x2896ac,_0x9313('0x12'));_0x28b795(_0x98c349['result'][_0x9313('0x11')]);}})[_0x9313('0x13')](function(_0x4dc532){logger[_0x9313('0x10')]('SalesforceField,\x20%s,\x20%s',_0x2896ac,_0x4dc532);_0x5b020f(_0x4dc532);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 139af42..95a1aa4 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 _0x4ee2=['post','create','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x4b1629,_0x561638){var _0x5cd450=function(_0x1a008d){while(--_0x1a008d){_0x4b1629['push'](_0x4b1629['shift']());}};_0x5cd450(++_0x561638);}(_0x4ee2,0x140));var _0x24ee=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x4ee2[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x24ee('0x0'));var util=require(_0x24ee('0x1'));var path=require(_0x24ee('0x2'));var timeout=require(_0x24ee('0x3'));var express=require(_0x24ee('0x4'));var router=express[_0x24ee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x24ee('0x6'));var interaction=require(_0x24ee('0x7'));var config=require(_0x24ee('0x8'));var controller=require(_0x24ee('0x9'));router[_0x24ee('0xa')]('/',auth['isAuthenticated'](),controller[_0x24ee('0xb')]);router['get']('/:id',auth[_0x24ee('0xc')](),controller[_0x24ee('0xd')]);router[_0x24ee('0xa')](_0x24ee('0xe'),auth[_0x24ee('0xc')](),controller[_0x24ee('0xf')]);router[_0x24ee('0xa')](_0x24ee('0x10'),auth[_0x24ee('0xc')](),controller[_0x24ee('0x11')]);router[_0x24ee('0x12')]('/',auth[_0x24ee('0xc')](),controller[_0x24ee('0x13')]);router[_0x24ee('0x12')]('/:id/configurations',auth[_0x24ee('0xc')](),controller[_0x24ee('0x14')]);router[_0x24ee('0x15')](_0x24ee('0x16'),auth[_0x24ee('0xc')](),controller[_0x24ee('0x17')]);router['delete'](_0x24ee('0x16'),auth[_0x24ee('0xc')](),controller[_0x24ee('0x18')]);module[_0x24ee('0x19')]=router; \ No newline at end of file +var _0xd93e=['isAuthenticated','index','get','/:id','getConfigurations','/:id/fields','getFields','create','post','put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x267cf4,_0xcbcf72){var _0x4824cf=function(_0x3e53d6){while(--_0x3e53d6){_0x267cf4['push'](_0x267cf4['shift']());}};_0x4824cf(++_0xcbcf72);}(_0xd93e,0x15d));var _0xed93=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xd93e[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0xed93('0x0'));var util=require(_0xed93('0x1'));var path=require(_0xed93('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xed93('0x3')]();var fs_extra=require(_0xed93('0x4'));var auth=require(_0xed93('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed93('0x6'));var controller=require(_0xed93('0x7'));router['get']('/',auth[_0xed93('0x8')](),controller[_0xed93('0x9')]);router[_0xed93('0xa')](_0xed93('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0xed93('0x8')](),controller[_0xed93('0xc')]);router[_0xed93('0xa')](_0xed93('0xd'),auth['isAuthenticated'](),controller[_0xed93('0xe')]);router['post']('/',auth[_0xed93('0x8')](),controller[_0xed93('0xf')]);router[_0xed93('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xed93('0x11')](_0xed93('0xb'),auth[_0xed93('0x8')](),controller[_0xed93('0x12')]);router['delete'](_0xed93('0xb'),auth[_0xed93('0x8')](),controller[_0xed93('0x13')]);module[_0xed93('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c91c059..b8d80fd 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 _0x59bd=['exports','STRING','username','remoteUri','sequelize'];(function(_0x49b72a,_0xa494ae){var _0x26dd11=function(_0x49704a){while(--_0x49704a){_0x49b72a['push'](_0x49b72a['shift']());}};_0x26dd11(++_0xa494ae);}(_0x59bd,0x112));var _0xd59b=function(_0x4b1380,_0x2120bc){_0x4b1380=_0x4b1380-0x0;var _0x10915f=_0x59bd[_0x4b1380];return _0x10915f;};'use strict';var Sequelize=require(_0xd59b('0x0'));module[_0xd59b('0x1')]={'name':{'type':Sequelize[_0xd59b('0x2')]},'description':{'type':Sequelize[_0xd59b('0x2')]},'username':{'type':Sequelize[_0xd59b('0x2')],'unique':_0xd59b('0x3')},'password':{'type':Sequelize[_0xd59b('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd59b('0x2')],'unique':_0xd59b('0x4')},'serverUrl':{'type':Sequelize[_0xd59b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd91b=['STRING','username','remoteUri','sequelize','exports'];(function(_0x56fc5a,_0x10daf4){var _0x60271c=function(_0x321e94){while(--_0x321e94){_0x56fc5a['push'](_0x56fc5a['shift']());}};_0x60271c(++_0x10daf4);}(_0xd91b,0x166));var _0xbd91=function(_0x5533d3,_0x28627e){_0x5533d3=_0x5533d3-0x0;var _0xa5a2c4=_0xd91b[_0x5533d3];return _0xa5a2c4;};'use strict';var Sequelize=require(_0xbd91('0x0'));module[_0xbd91('0x1')]={'name':{'type':Sequelize[_0xbd91('0x2')]},'description':{'type':Sequelize[_0xbd91('0x2')]},'username':{'type':Sequelize[_0xbd91('0x2')],'unique':_0xbd91('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbd91('0x2')]},'remoteUri':{'type':Sequelize[_0xbd91('0x2')],'unique':_0xbd91('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index e2c604c..62f89a5 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 _0xab7a=['sys_updated_on','number','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','business_stc','additional_assignee_list','description','close_notes','follow_up','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','upon_approval','correlation_id','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','password','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','channel','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','Descriptions','made_sla','hold_reason','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xab7a,0x107));var _0xaab7=function(_0x1eb837,_0x24429f){_0x1eb837=_0x1eb837-0x0;var _0x4ed333=_0xab7a[_0x1eb837];return _0x4ed333;};'use strict';var emlformat=require(_0xaab7('0x0'));var rimraf=require(_0xaab7('0x1'));var zipdir=require(_0xaab7('0x2'));var jsonpatch=require(_0xaab7('0x3'));var rp=require(_0xaab7('0x4'));var moment=require('moment');var BPromise=require(_0xaab7('0x5'));var Mustache=require(_0xaab7('0x6'));var util=require(_0xaab7('0x7'));var path=require(_0xaab7('0x8'));var sox=require(_0xaab7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaab7('0xa'));var squel=require(_0xaab7('0xb'));var crypto=require(_0xaab7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaab7('0xd'));var querystring=require('querystring');var Papa=require(_0xaab7('0xe'));var Redis=require(_0xaab7('0xf'));var authService=require(_0xaab7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaab7('0x11'));var hardwareService=require(_0xaab7('0x12'));var logger=require(_0xaab7('0x13'))(_0xaab7('0x14'));var utils=require(_0xaab7('0x15'));var config=require(_0xaab7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaab7('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1de2e3,_0x1d2480){_0x1d2480=_0x1d2480||0xcc;return function(_0x3a84e5){if(_0x3a84e5){return _0x1de2e3[_0xaab7('0x18')](_0x1d2480);}return _0x1de2e3[_0xaab7('0x19')](_0x1d2480)['end']();};}function respondWithResult(_0x40038a,_0x391481){_0x391481=_0x391481||0xc8;return function(_0x135bae){if(_0x135bae){return _0x40038a[_0xaab7('0x19')](_0x391481)[_0xaab7('0x1a')](_0x135bae);}};}function respondWithFilteredResult(_0x55b9eb,_0x2a2d91){return function(_0x1ace93){if(_0x1ace93){var _0x57baf0=typeof _0x2a2d91[_0xaab7('0x1b')]===_0xaab7('0x1c')&&typeof _0x2a2d91['limit']===_0xaab7('0x1c');var _0x587f39=_0x1ace93[_0xaab7('0x1d')];var _0x562d32=_0x57baf0?0x0:_0x2a2d91[_0xaab7('0x1b')];var _0x4dcd2d=_0x57baf0?_0x1ace93[_0xaab7('0x1d')]:_0x2a2d91[_0xaab7('0x1b')]+_0x2a2d91['limit'];var _0x3648ed;if(_0x4dcd2d>=_0x587f39){_0x4dcd2d=_0x587f39;_0x3648ed=0xc8;}else{_0x3648ed=0xce;}_0x55b9eb[_0xaab7('0x19')](_0x3648ed);return _0x55b9eb[_0xaab7('0x1e')](_0xaab7('0x1f'),_0x562d32+'-'+_0x4dcd2d+'/'+_0x587f39)['json'](_0x1ace93);}return null;};}function patchUpdates(_0xe5b52b){return function(_0xdfac4f){try{jsonpatch[_0xaab7('0x20')](_0xdfac4f,_0xe5b52b,!![]);}catch(_0x2977b6){return BPromise['reject'](_0x2977b6);}return _0xdfac4f[_0xaab7('0x21')]();};}function saveUpdates(_0x53b07b,_0xb34c0b){return function(_0x86e14){if(_0x86e14){return _0x86e14[_0xaab7('0x22')](_0x53b07b)[_0xaab7('0x23')](function(_0x5efd34){return _0x5efd34;});}return null;};}function removeEntity(_0xacff26,_0x5a07b0){return function(_0x3f58b3){if(_0x3f58b3){return _0x3f58b3[_0xaab7('0x24')]()[_0xaab7('0x23')](function(){_0xacff26[_0xaab7('0x19')](0xcc)[_0xaab7('0x25')]();});}};}function handleEntityNotFound(_0x57c4a6,_0xc1e12b){return function(_0x456ea1){if(!_0x456ea1){_0x57c4a6[_0xaab7('0x18')](0x194);}return _0x456ea1;};}function handleError(_0x2fbea7,_0x49eef3){_0x49eef3=_0x49eef3||0x1f4;return function(_0x43e0a5){logger[_0xaab7('0x26')](_0x43e0a5['stack']);if(_0x43e0a5[_0xaab7('0x27')]){delete _0x43e0a5[_0xaab7('0x27')];}_0x2fbea7[_0xaab7('0x19')](_0x49eef3)[_0xaab7('0x28')](_0x43e0a5);};}exports['index']=function(_0x560aeb,_0x55a1fb){var _0x595da9={},_0x241dac={},_0x356579={'count':0x0,'rows':[]};var _0x45cbf1=_[_0xaab7('0x29')](db[_0xaab7('0x2a')][_0xaab7('0x2b')],function(_0x24e393){return{'name':_0x24e393[_0xaab7('0x2c')],'type':_0x24e393['type'][_0xaab7('0x2d')]};});_0x241dac[_0xaab7('0x2e')]=_[_0xaab7('0x29')](_0x45cbf1,_0xaab7('0x27'));_0x241dac[_0xaab7('0x2f')]=_[_0xaab7('0x30')](_0x560aeb['query']);_0x241dac['filters']=_[_0xaab7('0x31')](_0x241dac[_0xaab7('0x2e')],_0x241dac[_0xaab7('0x2f')]);_0x595da9[_0xaab7('0x32')]=_['intersection'](_0x241dac[_0xaab7('0x2e')],qs[_0xaab7('0x33')](_0x560aeb[_0xaab7('0x2f')]['fields']));_0x595da9[_0xaab7('0x32')]=_0x595da9[_0xaab7('0x32')]['length']?_0x595da9[_0xaab7('0x32')]:_0x241dac[_0xaab7('0x2e')];if(!_0x560aeb[_0xaab7('0x2f')][_0xaab7('0x34')](_0xaab7('0x35'))){_0x595da9[_0xaab7('0x36')]=qs[_0xaab7('0x36')](_0x560aeb['query'][_0xaab7('0x36')]);_0x595da9[_0xaab7('0x1b')]=qs[_0xaab7('0x1b')](_0x560aeb['query'][_0xaab7('0x1b')]);}_0x595da9[_0xaab7('0x37')]=qs[_0xaab7('0x38')](_0x560aeb['query'][_0xaab7('0x38')]);_0x595da9['where']=qs[_0xaab7('0x39')](_[_0xaab7('0x3a')](_0x560aeb[_0xaab7('0x2f')],_0x241dac['filters']),_0x45cbf1);if(_0x560aeb[_0xaab7('0x2f')][_0xaab7('0x3b')]){_0x595da9[_0xaab7('0x3c')]=_[_0xaab7('0x3d')](_0x595da9['where'],{'$or':_[_0xaab7('0x29')](_0x45cbf1,function(_0x376019){if(_0x376019[_0xaab7('0x3e')]!==_0xaab7('0x3f')){var _0x43d420={};_0x43d420[_0x376019[_0xaab7('0x27')]]={'$like':'%'+_0x560aeb[_0xaab7('0x2f')][_0xaab7('0x3b')]+'%'};return _0x43d420;}})});}_0x595da9=_['merge']({},_0x595da9,_0x560aeb[_0xaab7('0x40')]);var _0x40ed1c={'where':_0x595da9['where']};return db[_0xaab7('0x2a')][_0xaab7('0x1d')](_0x40ed1c)['then'](function(_0x22724f){_0x356579[_0xaab7('0x1d')]=_0x22724f;if(_0x560aeb['query']['includeAll']){_0x595da9[_0xaab7('0x41')]=[{'all':!![]}];}return db[_0xaab7('0x2a')]['findAll'](_0x595da9);})['then'](function(_0x43c50c){_0x356579[_0xaab7('0x42')]=_0x43c50c;return _0x356579;})[_0xaab7('0x23')](respondWithFilteredResult(_0x55a1fb,_0x595da9))[_0xaab7('0x43')](handleError(_0x55a1fb,null));};exports[_0xaab7('0x44')]=function(_0x3aab14,_0x14d649){var _0x5f1229={'raw':![],'where':{'id':_0x3aab14[_0xaab7('0x45')]['id']}},_0x247b9b={};_0x247b9b[_0xaab7('0x2e')]=_[_0xaab7('0x30')](db[_0xaab7('0x2a')]['rawAttributes']);_0x247b9b['query']=_['keys'](_0x3aab14[_0xaab7('0x2f')]);_0x247b9b[_0xaab7('0x39')]=_[_0xaab7('0x31')](_0x247b9b[_0xaab7('0x2e')],_0x247b9b['query']);_0x5f1229['attributes']=_[_0xaab7('0x31')](_0x247b9b[_0xaab7('0x2e')],qs[_0xaab7('0x33')](_0x3aab14[_0xaab7('0x2f')][_0xaab7('0x33')]));_0x5f1229[_0xaab7('0x32')]=_0x5f1229[_0xaab7('0x32')][_0xaab7('0x46')]?_0x5f1229['attributes']:_0x247b9b[_0xaab7('0x2e')];if(_0x3aab14[_0xaab7('0x2f')][_0xaab7('0x47')]){_0x5f1229[_0xaab7('0x41')]=[{'all':!![]}];}_0x5f1229=_[_0xaab7('0x3d')]({},_0x5f1229,_0x3aab14['options']);return db[_0xaab7('0x2a')][_0xaab7('0x48')](_0x5f1229)[_0xaab7('0x23')](handleEntityNotFound(_0x14d649,null))[_0xaab7('0x23')](respondWithResult(_0x14d649,null))[_0xaab7('0x43')](handleError(_0x14d649,null));};exports[_0xaab7('0x49')]=function(_0x2e7635,_0x2bf031){return db[_0xaab7('0x2a')][_0xaab7('0x49')](_0x2e7635[_0xaab7('0x4a')],{})[_0xaab7('0x23')](respondWithResult(_0x2bf031,0xc9))['catch'](handleError(_0x2bf031,null));};exports[_0xaab7('0x22')]=function(_0x14cfdf,_0x5b3571){if(_0x14cfdf[_0xaab7('0x4a')]['id']){delete _0x14cfdf[_0xaab7('0x4a')]['id'];}return db[_0xaab7('0x2a')][_0xaab7('0x48')]({'where':{'id':_0x14cfdf['params']['id']}})[_0xaab7('0x23')](handleEntityNotFound(_0x5b3571,null))[_0xaab7('0x23')](saveUpdates(_0x14cfdf[_0xaab7('0x4a')],null))[_0xaab7('0x23')](respondWithResult(_0x5b3571,null))[_0xaab7('0x43')](handleError(_0x5b3571,null));};exports[_0xaab7('0x24')]=function(_0x4fe586,_0x531629){return db[_0xaab7('0x2a')][_0xaab7('0x48')]({'where':{'id':_0x4fe586[_0xaab7('0x45')]['id']}})['then'](handleEntityNotFound(_0x531629,null))['then'](removeEntity(_0x531629,null))[_0xaab7('0x43')](handleError(_0x531629,null));};exports[_0xaab7('0x4b')]=function(_0x16d8ab,_0x2f3157,_0x35e9cd){var _0x4611a7={};var _0x288bd4={};var _0x3afb9f;var _0x3aa367;return db[_0xaab7('0x2a')][_0xaab7('0x4c')]({'where':{'id':_0x16d8ab[_0xaab7('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f3157,null))['then'](function(_0x532a1b){if(_0x532a1b){_0x3afb9f=_0x532a1b;_0x288bd4[_0xaab7('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0xaab7('0x2b')]);_0x288bd4[_0xaab7('0x2f')]=_[_0xaab7('0x30')](_0x16d8ab['query']);_0x288bd4[_0xaab7('0x39')]=_['intersection'](_0x288bd4['model'],_0x288bd4[_0xaab7('0x2f')]);_0x4611a7[_0xaab7('0x32')]=_[_0xaab7('0x31')](_0x288bd4['model'],qs[_0xaab7('0x33')](_0x16d8ab[_0xaab7('0x2f')]['fields']));_0x4611a7['attributes']=_0x4611a7[_0xaab7('0x32')][_0xaab7('0x46')]?_0x4611a7[_0xaab7('0x32')]:_0x288bd4[_0xaab7('0x2e')];_0x4611a7['order']=qs[_0xaab7('0x38')](_0x16d8ab[_0xaab7('0x2f')][_0xaab7('0x38')]);_0x4611a7[_0xaab7('0x3c')]=qs[_0xaab7('0x39')](_['pick'](_0x16d8ab[_0xaab7('0x2f')],_0x288bd4[_0xaab7('0x39')]));if(_0x16d8ab[_0xaab7('0x2f')][_0xaab7('0x3b')]){_0x4611a7[_0xaab7('0x3c')]=_['merge'](_0x4611a7[_0xaab7('0x3c')],{'$or':_[_0xaab7('0x29')](_0x4611a7[_0xaab7('0x32')],function(_0x17ccf3){var _0x58f848={};_0x58f848[_0x17ccf3]={'$like':'%'+_0x16d8ab[_0xaab7('0x2f')][_0xaab7('0x3b')]+'%'};return _0x58f848;})});}_0x4611a7=_[_0xaab7('0x3d')]({},_0x4611a7,_0x16d8ab['options']);return _0x3afb9f['getConfigurations'](_0x4611a7);}})[_0xaab7('0x23')](function(_0x3615c3){if(_0x3615c3){_0x3aa367=_0x3615c3[_0xaab7('0x46')];if(!_0x16d8ab[_0xaab7('0x2f')]['hasOwnProperty'](_0xaab7('0x35'))){_0x4611a7['limit']=qs[_0xaab7('0x36')](_0x16d8ab[_0xaab7('0x2f')][_0xaab7('0x36')]);_0x4611a7[_0xaab7('0x1b')]=qs[_0xaab7('0x1b')](_0x16d8ab[_0xaab7('0x2f')][_0xaab7('0x1b')]);}return _0x3afb9f[_0xaab7('0x4b')](_0x4611a7);}})[_0xaab7('0x23')](function(_0x20ca09){if(_0x20ca09){return _0x20ca09?{'count':_0x3aa367,'rows':_0x20ca09}:null;}})[_0xaab7('0x23')](respondWithResult(_0x2f3157,null))[_0xaab7('0x43')](handleError(_0x2f3157,null));};exports[_0xaab7('0x4d')]=function(_0x18ac85,_0x3ff3ce,_0x3c8b59){if(_0x18ac85[_0xaab7('0x4a')]['id']){delete _0x18ac85[_0xaab7('0x4a')]['id'];}return db[_0xaab7('0x2a')][_0xaab7('0x4c')]({'where':{'id':_0x18ac85[_0xaab7('0x45')]['id']}})[_0xaab7('0x23')](handleEntityNotFound(_0x3ff3ce,null))[_0xaab7('0x23')](function(_0x2458fa){if(_0x2458fa){_0x18ac85[_0xaab7('0x4a')][_0xaab7('0x4e')]=_0x2458fa['id'];_0x18ac85[_0xaab7('0x4a')]['Subjects']=integrations['getSubjects'](_0x18ac85[_0xaab7('0x4a')][_0xaab7('0x4f')],_0x18ac85['body'][_0xaab7('0x3e')]);_0x18ac85[_0xaab7('0x4a')]['Descriptions']=integrations[_0xaab7('0x50')](_0x18ac85[_0xaab7('0x4a')][_0xaab7('0x4f')],_0x18ac85['body'][_0xaab7('0x3e')]);return db[_0xaab7('0x51')][_0xaab7('0x49')](_0x18ac85[_0xaab7('0x4a')],{'include':[{'model':db[_0xaab7('0x52')],'as':_0xaab7('0x53')},{'model':db[_0xaab7('0x52')],'as':_0xaab7('0x54')}]});}return null;})[_0xaab7('0x23')](respondWithResult(_0x3ff3ce,null))['catch'](handleError(_0x3ff3ce,null));};exports['getFields']=function(_0x2fed2a,_0x5807ec,_0x375649){var _0x2c815d=[_0xaab7('0x55'),_0xaab7('0x56'),'knowledge','subcategory',_0xaab7('0x57'),_0xaab7('0x58'),_0xaab7('0x59'),_0xaab7('0x5a'),_0xaab7('0x5b')];var _0x235141=[_0xaab7('0x5c'),_0xaab7('0x55'),_0xaab7('0x5d'),_0xaab7('0x5e'),'upon_reject',_0xaab7('0x5f'),'child_incidents',_0xaab7('0x56'),'approval_history',_0xaab7('0x60'),'resolved_by',_0xaab7('0x61'),_0xaab7('0x62'),'user_input',_0xaab7('0x63'),_0xaab7('0x64'),_0xaab7('0x65'),_0xaab7('0x66'),_0xaab7('0x67'),_0xaab7('0x37'),_0xaab7('0x68'),_0xaab7('0x69'),_0xaab7('0x6a'),_0xaab7('0x6b'),'impact',_0xaab7('0x6c'),_0xaab7('0x6d'),_0xaab7('0x6e'),_0xaab7('0x6f'),_0xaab7('0x70'),_0xaab7('0x71'),_0xaab7('0x72'),_0xaab7('0x73'),'opened_at',_0xaab7('0x74'),'group_list','work_end',_0xaab7('0x75'),_0xaab7('0x76'),_0xaab7('0x77'),_0xaab7('0x78'),'subcategory',_0xaab7('0x79'),_0xaab7('0x7a'),_0xaab7('0x57'),_0xaab7('0x7b'),'delivery_task',_0xaab7('0x7c'),'assignment_group',_0xaab7('0x7d'),_0xaab7('0x7e'),_0xaab7('0x7f'),'calendar_duration',_0xaab7('0x58'),'sys_class_name',_0xaab7('0x80'),'closed_by',_0xaab7('0x81'),'parent_incident','sys_id',_0xaab7('0x82'),_0xaab7('0x83'),_0xaab7('0x59'),_0xaab7('0x84'),_0xaab7('0x85'),'company',_0xaab7('0x86'),_0xaab7('0x87'),_0xaab7('0x88'),'severity',_0xaab7('0x89'),_0xaab7('0x8a'),_0xaab7('0x8b'),_0xaab7('0x8c'),'due_date',_0xaab7('0x8d'),_0xaab7('0x8e'),'sys_tags','escalation',_0xaab7('0x8f'),_0xaab7('0x90'),'location','category'];var _0xb1f7a7='';var _0x25cbb5='';var _0x523b95=[];var _0x2e6b36='';var _0xc591f7='';var _0x589953=[];var _0x19fc5c='';var _0x10954a='';var _0x13f404={};var _0x344b00='';return db[_0xaab7('0x2a')][_0xaab7('0x4c')]({'where':{'id':_0x2fed2a[_0xaab7('0x45')]['id']},'attributes':['id',_0xaab7('0x91'),'password',_0xaab7('0x92'),_0xaab7('0x93'),_0xaab7('0x94')]})[_0xaab7('0x23')](handleEntityNotFound(_0x5807ec,null))[_0xaab7('0x23')](function(_0x1ba980){if(_0x1ba980){_0x344b00=_0x1ba980[_0xaab7('0x93')];var _0x4674de=_0x344b00[_0xaab7('0x95')](-0x1);if(_0x4674de==='/'){_0x344b00=_0x344b00[_0xaab7('0x96')](0x0,_0x344b00[_0xaab7('0x97')](_0x4674de));}_0x10954a=util[_0xaab7('0x98')](_0xaab7('0x99'),_0x344b00);_0x19fc5c=util[_0xaab7('0x98')]('%s/api/now/table/',_0x344b00);_0x13f404={'user':_0x1ba980[_0xaab7('0x91')],'pass':_0x1ba980[_0xaab7('0x9a')]};var _0x1b7006={'method':_0xaab7('0x9b'),'uri':_0x10954a+'incident?sysparm_display_value=all','auth':_0x13f404,'json':!![]};return rp(_0x1b7006);}})[_0xaab7('0x23')](function(_0x194b2b){if(_0x194b2b[_0xaab7('0x9c')][_0xaab7('0x46')]>0x0){_0xb1f7a7=_0x194b2b['result'];}console[_0xaab7('0x9d')](_0xaab7('0x9e'),_0xb1f7a7);_0x589953=[];_0x25cbb5=Object[_0xaab7('0x9f')]([],_0xb1f7a7);_[_0xaab7('0xa0')](_0x25cbb5,function(_0x40b670){return!_0x2c815d[_0xaab7('0xa1')](_0x40b670['name']);});_0x25cbb5[_0xaab7('0xa2')](function(_0x50d58e){var _0x539143=createFieldObject(_0x19fc5c,_0x13f404,_0x50d58e[_0xaab7('0xa3')],_0x50d58e['name'],_0x50d58e[_0xaab7('0xa4')],![]);_0x589953[_0xaab7('0xa5')](_0x539143);});return Promise[_0xaab7('0xa6')](_0x589953);})[_0xaab7('0x23')](function(_0x99b079){_0x523b95=_0x99b079;_0x2e6b36=Object['assign']([],_0xb1f7a7);console[_0xaab7('0x9d')](_0xaab7('0xa7'),_0xb1f7a7);_[_0xaab7('0xa0')](_0x2e6b36,function(_0x241cff){return _0x235141[_0xaab7('0xa1')](_0x241cff['name']);});console['log'](_0xaab7('0xa8'),_0x2e6b36);_0x589953=[];_0x2e6b36['forEach'](function(_0xff4d91){var _0x2dfe24=createFieldObject(_0x19fc5c,_0x13f404,_0xff4d91[_0xaab7('0xa3')],_0xff4d91[_0xaab7('0x27')],_0xff4d91[_0xaab7('0xa4')],!![]);_0x589953[_0xaab7('0xa5')](_0x2dfe24);});return Promise[_0xaab7('0xa6')](_0x589953);})[_0xaab7('0x23')](function(_0x4baeef){_0xc591f7=_0x4baeef;var _0x349daa=_0x523b95['concat'](_0xc591f7);return{'count':_0x349daa['length'],'rows':_0x349daa};})[_0xaab7('0x23')](respondWithResult(_0x5807ec,null))[_0xaab7('0x43')](function(_0x3b8106){console[_0xaab7('0x9d')](_0xaab7('0xa9')+_0x3b8106);var _0x2e24a6=_0x2fed2a[_0xaab7('0x2f')][_0xaab7('0xaa')]?0x1f4:_0x3b8106['statusCode']||0x1f4;logger['error'](_0x3b8106['stack']);delete _0x3b8106['name'];if(_0x2e24a6===0x191){_0x2e24a6=0x190;}_0x5807ec[_0xaab7('0x19')](_0x2e24a6)[_0xaab7('0x28')](_0x2fed2a[_0xaab7('0x2f')][_0xaab7('0xaa')]?{'message':_0xaab7('0xab'),'statusCode':_0x3b8106[_0xaab7('0xac')]}:_0x3b8106);});};function createFieldObject(_0x18419c,_0x196e1f,_0x11a525,_0x4f308d,_0x11bf6b,_0x31d270){return new Promise(function(_0x351631,_0x1fa6b0){var _0x372817={'id':_0x4f308d,'name':_0x11bf6b,'custom':_0x31d270};if(_0x11a525===_0xaab7('0xad')){_0x372817['options']=[{'name':_0xaab7('0xae'),'value':'true'},{'name':_0xaab7('0xaf'),'value':_0xaab7('0xb0')}];_0x351631(_0x372817);}else{var _0x2157e1={'method':'GET','uri':_0x18419c+_0xaab7('0xb1')+_0x4f308d,'auth':_0x196e1f,'json':!![]};return rp(_0x2157e1)['then'](function(_0x59b90d){var _0xec65d8=[];if(_0x59b90d[_0xaab7('0x9c')][_0xaab7('0x46')]>0x0){_0x59b90d[_0xaab7('0x9c')][_0xaab7('0xa2')](function(_0x34850a){if(_0x34850a[_0xaab7('0xb2')]==='false'){var _0x7e615b={'name':_0x34850a['label'],'value':_0x34850a['value']};_0xec65d8[_0xaab7('0xa5')](_0x7e615b);}});}_0x372817[_0xaab7('0x40')]=_0xec65d8;if(_0x372817[_0xaab7('0x40')][_0xaab7('0x46')]>0x0){_0x351631(_0x372817);}else{if(_0x31d270==![]){_0x351631();}else{_0x351631(_0x372817);}}});}});} \ No newline at end of file +var _0x763e=['business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','reopened_time','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','remove','includes','forEach','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','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','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','includeAll','rows','catch','params','include','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','caused_by','watch_list','sys_updated_on','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','impact','active','work_notes_list'];(function(_0x4fa92b,_0x7d972){var _0x2a6579=function(_0x1642a3){while(--_0x1642a3){_0x4fa92b['push'](_0x4fa92b['shift']());}};_0x2a6579(++_0x7d972);}(_0x763e,0x1b2));var _0xe763=function(_0x256118,_0x1193e7){_0x256118=_0x256118-0x0;var _0x4f5506=_0x763e[_0x256118];return _0x4f5506;};'use strict';var emlformat=require(_0xe763('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe763('0x1'));var jsonpatch=require(_0xe763('0x2'));var rp=require(_0xe763('0x3'));var moment=require(_0xe763('0x4'));var BPromise=require(_0xe763('0x5'));var Mustache=require(_0xe763('0x6'));var util=require(_0xe763('0x7'));var path=require(_0xe763('0x8'));var sox=require(_0xe763('0x9'));var csv=require(_0xe763('0xa'));var ejs=require(_0xe763('0xb'));var fs=require('fs');var fs_extra=require(_0xe763('0xc'));var _=require(_0xe763('0xd'));var squel=require(_0xe763('0xe'));var crypto=require('crypto');var jsforce=require(_0xe763('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe763('0xa'));var querystring=require('querystring');var Papa=require(_0xe763('0x10'));var Redis=require(_0xe763('0x11'));var authService=require(_0xe763('0x12'));var qs=require(_0xe763('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe763('0x14'));var logger=require('../../config/logger')(_0xe763('0x15'));var utils=require(_0xe763('0x16'));var config=require(_0xe763('0x17'));var licenseUtil=require(_0xe763('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3070cc,_0x34a459){_0x34a459=_0x34a459||0xcc;return function(_0x18a901){if(_0x18a901){return _0x3070cc[_0xe763('0x19')](_0x34a459);}return _0x3070cc[_0xe763('0x1a')](_0x34a459)[_0xe763('0x1b')]();};}function respondWithResult(_0x22d827,_0x2ec491){_0x2ec491=_0x2ec491||0xc8;return function(_0x10d883){if(_0x10d883){return _0x22d827[_0xe763('0x1a')](_0x2ec491)[_0xe763('0x1c')](_0x10d883);}};}function respondWithFilteredResult(_0x9548,_0x20684c){return function(_0x3f394b){if(_0x3f394b){var _0xce4702=typeof _0x20684c[_0xe763('0x1d')]==='undefined'&&typeof _0x20684c['limit']===_0xe763('0x1e');var _0x11d7be=_0x3f394b['count'];var _0x2b0c93=_0xce4702?0x0:_0x20684c[_0xe763('0x1d')];var _0x24b6c7=_0xce4702?_0x3f394b[_0xe763('0x1f')]:_0x20684c[_0xe763('0x1d')]+_0x20684c[_0xe763('0x20')];var _0x70cc30;if(_0x24b6c7>=_0x11d7be){_0x24b6c7=_0x11d7be;_0x70cc30=0xc8;}else{_0x70cc30=0xce;}_0x9548['status'](_0x70cc30);return _0x9548[_0xe763('0x21')](_0xe763('0x22'),_0x2b0c93+'-'+_0x24b6c7+'/'+_0x11d7be)[_0xe763('0x1c')](_0x3f394b);}return null;};}function patchUpdates(_0x57626){return function(_0x44a792){try{jsonpatch[_0xe763('0x23')](_0x44a792,_0x57626,!![]);}catch(_0xb9699d){return BPromise[_0xe763('0x24')](_0xb9699d);}return _0x44a792['save']();};}function saveUpdates(_0x506133,_0x113fc1){return function(_0x108d54){if(_0x108d54){return _0x108d54[_0xe763('0x25')](_0x506133)[_0xe763('0x26')](function(_0x26d3cc){return _0x26d3cc;});}return null;};}function removeEntity(_0x573fd3,_0x17ed7f){return function(_0x387a5c){if(_0x387a5c){return _0x387a5c[_0xe763('0x27')]()[_0xe763('0x26')](function(){_0x573fd3[_0xe763('0x1a')](0xcc)[_0xe763('0x1b')]();});}};}function handleEntityNotFound(_0x241090,_0x355532){return function(_0x43b8d1){if(!_0x43b8d1){_0x241090[_0xe763('0x19')](0x194);}return _0x43b8d1;};}function handleError(_0x949c52,_0x472cb1){_0x472cb1=_0x472cb1||0x1f4;return function(_0x5a9eee){logger[_0xe763('0x28')](_0x5a9eee[_0xe763('0x29')]);if(_0x5a9eee[_0xe763('0x2a')]){delete _0x5a9eee[_0xe763('0x2a')];}_0x949c52['status'](_0x472cb1)[_0xe763('0x2b')](_0x5a9eee);};}exports[_0xe763('0x2c')]=function(_0x4abf17,_0x5a95f1){var _0x5dacc4={},_0x3b9d39={},_0xa7f802={'count':0x0,'rows':[]};var _0x350b15=_[_0xe763('0x2d')](db['ServicenowAccount'][_0xe763('0x2e')],function(_0x2bcb8c){return{'name':_0x2bcb8c['fieldName'],'type':_0x2bcb8c[_0xe763('0x2f')][_0xe763('0x30')]};});_0x3b9d39['model']=_[_0xe763('0x2d')](_0x350b15,_0xe763('0x2a'));_0x3b9d39[_0xe763('0x31')]=_[_0xe763('0x32')](_0x4abf17[_0xe763('0x31')]);_0x3b9d39[_0xe763('0x33')]=_['intersection'](_0x3b9d39[_0xe763('0x34')],_0x3b9d39['query']);_0x5dacc4[_0xe763('0x35')]=_[_0xe763('0x36')](_0x3b9d39['model'],qs['fields'](_0x4abf17['query'][_0xe763('0x37')]));_0x5dacc4[_0xe763('0x35')]=_0x5dacc4[_0xe763('0x35')][_0xe763('0x38')]?_0x5dacc4[_0xe763('0x35')]:_0x3b9d39['model'];if(!_0x4abf17[_0xe763('0x31')][_0xe763('0x39')]('nolimit')){_0x5dacc4[_0xe763('0x20')]=qs[_0xe763('0x20')](_0x4abf17['query'][_0xe763('0x20')]);_0x5dacc4[_0xe763('0x1d')]=qs['offset'](_0x4abf17[_0xe763('0x31')][_0xe763('0x1d')]);}_0x5dacc4[_0xe763('0x3a')]=qs['sort'](_0x4abf17[_0xe763('0x31')][_0xe763('0x3b')]);_0x5dacc4[_0xe763('0x3c')]=qs[_0xe763('0x33')](_[_0xe763('0x3d')](_0x4abf17['query'],_0x3b9d39[_0xe763('0x33')]),_0x350b15);if(_0x4abf17[_0xe763('0x31')][_0xe763('0x3e')]){_0x5dacc4['where']=_[_0xe763('0x3f')](_0x5dacc4[_0xe763('0x3c')],{'$or':_[_0xe763('0x2d')](_0x350b15,function(_0x4a6905){if(_0x4a6905['type']!==_0xe763('0x40')){var _0x3daea6={};_0x3daea6[_0x4a6905['name']]={'$like':'%'+_0x4abf17[_0xe763('0x31')]['filter']+'%'};return _0x3daea6;}})});}_0x5dacc4=_[_0xe763('0x3f')]({},_0x5dacc4,_0x4abf17[_0xe763('0x41')]);var _0x5cae9c={'where':_0x5dacc4[_0xe763('0x3c')]};return db[_0xe763('0x42')][_0xe763('0x1f')](_0x5cae9c)[_0xe763('0x26')](function(_0x16e4da){_0xa7f802[_0xe763('0x1f')]=_0x16e4da;if(_0x4abf17[_0xe763('0x31')][_0xe763('0x43')]){_0x5dacc4['include']=[{'all':!![]}];}return db[_0xe763('0x42')]['findAll'](_0x5dacc4);})[_0xe763('0x26')](function(_0x1503b8){_0xa7f802[_0xe763('0x44')]=_0x1503b8;return _0xa7f802;})[_0xe763('0x26')](respondWithFilteredResult(_0x5a95f1,_0x5dacc4))[_0xe763('0x45')](handleError(_0x5a95f1,null));};exports['show']=function(_0x2ed93e,_0x1f5922){var _0x23667a={'raw':![],'where':{'id':_0x2ed93e[_0xe763('0x46')]['id']}},_0x39d8f4={};_0x39d8f4['model']=_[_0xe763('0x32')](db[_0xe763('0x42')][_0xe763('0x2e')]);_0x39d8f4[_0xe763('0x31')]=_[_0xe763('0x32')](_0x2ed93e[_0xe763('0x31')]);_0x39d8f4[_0xe763('0x33')]=_[_0xe763('0x36')](_0x39d8f4[_0xe763('0x34')],_0x39d8f4[_0xe763('0x31')]);_0x23667a[_0xe763('0x35')]=_['intersection'](_0x39d8f4['model'],qs[_0xe763('0x37')](_0x2ed93e[_0xe763('0x31')]['fields']));_0x23667a[_0xe763('0x35')]=_0x23667a[_0xe763('0x35')][_0xe763('0x38')]?_0x23667a[_0xe763('0x35')]:_0x39d8f4['model'];if(_0x2ed93e[_0xe763('0x31')]['includeAll']){_0x23667a[_0xe763('0x47')]=[{'all':!![]}];}_0x23667a=_[_0xe763('0x3f')]({},_0x23667a,_0x2ed93e[_0xe763('0x41')]);return db[_0xe763('0x42')]['find'](_0x23667a)[_0xe763('0x26')](handleEntityNotFound(_0x1f5922,null))[_0xe763('0x26')](respondWithResult(_0x1f5922,null))[_0xe763('0x45')](handleError(_0x1f5922,null));};exports[_0xe763('0x48')]=function(_0x144934,_0x32aa15){return db[_0xe763('0x42')]['create'](_0x144934[_0xe763('0x49')],{})[_0xe763('0x26')](respondWithResult(_0x32aa15,0xc9))[_0xe763('0x45')](handleError(_0x32aa15,null));};exports[_0xe763('0x25')]=function(_0x216f6d,_0x537f2e){if(_0x216f6d[_0xe763('0x49')]['id']){delete _0x216f6d['body']['id'];}return db[_0xe763('0x42')]['find']({'where':{'id':_0x216f6d[_0xe763('0x46')]['id']}})[_0xe763('0x26')](handleEntityNotFound(_0x537f2e,null))[_0xe763('0x26')](saveUpdates(_0x216f6d[_0xe763('0x49')],null))[_0xe763('0x26')](respondWithResult(_0x537f2e,null))[_0xe763('0x45')](handleError(_0x537f2e,null));};exports[_0xe763('0x27')]=function(_0x41ecd3,_0x28f087){return db['ServicenowAccount']['find']({'where':{'id':_0x41ecd3[_0xe763('0x46')]['id']}})[_0xe763('0x26')](handleEntityNotFound(_0x28f087,null))[_0xe763('0x26')](removeEntity(_0x28f087,null))['catch'](handleError(_0x28f087,null));};exports[_0xe763('0x4a')]=function(_0x15726b,_0x35db1f,_0x409b61){var _0x84f69c={};var _0x14d357={};var _0x2e94dd;var _0x49803f;return db['ServicenowAccount'][_0xe763('0x4b')]({'where':{'id':_0x15726b[_0xe763('0x46')]['id']}})['then'](handleEntityNotFound(_0x35db1f,null))[_0xe763('0x26')](function(_0x1af0db){if(_0x1af0db){_0x2e94dd=_0x1af0db;_0x14d357[_0xe763('0x34')]=_[_0xe763('0x32')](db[_0xe763('0x4c')]['rawAttributes']);_0x14d357[_0xe763('0x31')]=_[_0xe763('0x32')](_0x15726b['query']);_0x14d357[_0xe763('0x33')]=_[_0xe763('0x36')](_0x14d357[_0xe763('0x34')],_0x14d357[_0xe763('0x31')]);_0x84f69c['attributes']=_[_0xe763('0x36')](_0x14d357['model'],qs['fields'](_0x15726b['query'][_0xe763('0x37')]));_0x84f69c['attributes']=_0x84f69c[_0xe763('0x35')]['length']?_0x84f69c[_0xe763('0x35')]:_0x14d357[_0xe763('0x34')];_0x84f69c[_0xe763('0x3a')]=qs[_0xe763('0x3b')](_0x15726b['query'][_0xe763('0x3b')]);_0x84f69c[_0xe763('0x3c')]=qs['filters'](_[_0xe763('0x3d')](_0x15726b[_0xe763('0x31')],_0x14d357['filters']));if(_0x15726b[_0xe763('0x31')][_0xe763('0x3e')]){_0x84f69c['where']=_[_0xe763('0x3f')](_0x84f69c[_0xe763('0x3c')],{'$or':_[_0xe763('0x2d')](_0x84f69c['attributes'],function(_0x22be44){var _0x2d1717={};_0x2d1717[_0x22be44]={'$like':'%'+_0x15726b[_0xe763('0x31')][_0xe763('0x3e')]+'%'};return _0x2d1717;})});}_0x84f69c=_[_0xe763('0x3f')]({},_0x84f69c,_0x15726b[_0xe763('0x41')]);return _0x2e94dd['getConfigurations'](_0x84f69c);}})[_0xe763('0x26')](function(_0x3f7206){if(_0x3f7206){_0x49803f=_0x3f7206[_0xe763('0x38')];if(!_0x15726b[_0xe763('0x31')]['hasOwnProperty']('nolimit')){_0x84f69c[_0xe763('0x20')]=qs[_0xe763('0x20')](_0x15726b[_0xe763('0x31')][_0xe763('0x20')]);_0x84f69c[_0xe763('0x1d')]=qs[_0xe763('0x1d')](_0x15726b[_0xe763('0x31')][_0xe763('0x1d')]);}return _0x2e94dd['getConfigurations'](_0x84f69c);}})['then'](function(_0x22263b){if(_0x22263b){return _0x22263b?{'count':_0x49803f,'rows':_0x22263b}:null;}})[_0xe763('0x26')](respondWithResult(_0x35db1f,null))[_0xe763('0x45')](handleError(_0x35db1f,null));};exports[_0xe763('0x4d')]=function(_0x5cdbc7,_0x5cc863,_0x3c946e){if(_0x5cdbc7['body']['id']){delete _0x5cdbc7[_0xe763('0x49')]['id'];}return db[_0xe763('0x42')]['findOne']({'where':{'id':_0x5cdbc7[_0xe763('0x46')]['id']}})[_0xe763('0x26')](handleEntityNotFound(_0x5cc863,null))[_0xe763('0x26')](function(_0x5ae0d5){if(_0x5ae0d5){_0x5cdbc7['body'][_0xe763('0x4e')]=_0x5ae0d5['id'];_0x5cdbc7[_0xe763('0x49')][_0xe763('0x4f')]=integrations[_0xe763('0x50')](_0x5cdbc7[_0xe763('0x49')]['channel'],_0x5cdbc7[_0xe763('0x49')][_0xe763('0x2f')]);_0x5cdbc7[_0xe763('0x49')][_0xe763('0x51')]=integrations[_0xe763('0x52')](_0x5cdbc7[_0xe763('0x49')][_0xe763('0x53')],_0x5cdbc7[_0xe763('0x49')][_0xe763('0x2f')]);return db[_0xe763('0x4c')][_0xe763('0x48')](_0x5cdbc7[_0xe763('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0xe763('0x4f')},{'model':db[_0xe763('0x54')],'as':_0xe763('0x51')}]});}return null;})[_0xe763('0x26')](respondWithResult(_0x5cc863,null))['catch'](handleError(_0x5cc863,null));};exports['getFields']=function(_0x2abbdc,_0x58331,_0x2a0a9e){var _0x1d9e94=[_0xe763('0x55'),_0xe763('0x56'),_0xe763('0x57'),_0xe763('0x58'),_0xe763('0x59'),'notify',_0xe763('0x5a'),_0xe763('0x5b'),_0xe763('0x5c')];var _0xc35c73=['parent',_0xe763('0x55'),_0xe763('0x5d'),_0xe763('0x5e'),'upon_reject',_0xe763('0x5f'),'child_incidents',_0xe763('0x56'),'approval_history',_0xe763('0x60'),_0xe763('0x61'),'sys_updated_by',_0xe763('0x62'),_0xe763('0x63'),_0xe763('0x64'),_0xe763('0x65'),_0xe763('0x66'),_0xe763('0x67'),_0xe763('0x57'),_0xe763('0x3a'),_0xe763('0x68'),'closed_at',_0xe763('0x69'),'delivery_plan',_0xe763('0x6a'),_0xe763('0x6b'),_0xe763('0x6c'),_0xe763('0x6d'),_0xe763('0x6e'),_0xe763('0x6f'),_0xe763('0x70'),_0xe763('0x71'),_0xe763('0x72'),'opened_at',_0xe763('0x73'),_0xe763('0x74'),'work_end',_0xe763('0x75'),'resolved_at',_0xe763('0x76'),'approval_set',_0xe763('0x58'),_0xe763('0x77'),_0xe763('0x78'),'close_code',_0xe763('0x79'),_0xe763('0x7a'),_0xe763('0x7b'),'assignment_group',_0xe763('0x7c'),_0xe763('0x7d'),_0xe763('0x7e'),_0xe763('0x7f'),'notify',_0xe763('0x80'),_0xe763('0x81'),_0xe763('0x82'),_0xe763('0x83'),_0xe763('0x84'),'sys_id',_0xe763('0x85'),_0xe763('0x86'),'incident_state',_0xe763('0x87'),_0xe763('0x88'),_0xe763('0x89'),_0xe763('0x8a'),_0xe763('0x8b'),_0xe763('0x8c'),_0xe763('0x5b'),'comments',_0xe763('0x8d'),_0xe763('0x8e'),'comments_and_work_notes',_0xe763('0x8f'),_0xe763('0x90'),_0xe763('0x91'),_0xe763('0x92'),_0xe763('0x93'),_0xe763('0x94'),_0xe763('0x95'),_0xe763('0x96'),_0xe763('0x5c')];var _0x497fbf='';var _0x250899='';var _0x2d6fb5=[];var _0x1ef76a='';var _0x19cdfa='';var _0x37c7c2=[];var _0x33e33b='';var _0x2d0250='';var _0x15d6c5={};var _0x177abf='';return db[_0xe763('0x42')]['findOne']({'where':{'id':_0x2abbdc[_0xe763('0x46')]['id']},'attributes':['id',_0xe763('0x97'),_0xe763('0x98'),'email',_0xe763('0x99'),'serverUrl']})[_0xe763('0x26')](handleEntityNotFound(_0x58331,null))[_0xe763('0x26')](function(_0x492c09){if(_0x492c09){_0x177abf=_0x492c09[_0xe763('0x99')];var _0x414c64=_0x177abf[_0xe763('0x9a')](-0x1);if(_0x414c64==='/'){_0x177abf=_0x177abf['substring'](0x0,_0x177abf[_0xe763('0x9b')](_0x414c64));}_0x2d0250=util['format'](_0xe763('0x9c'),_0x177abf);_0x33e33b=util[_0xe763('0x9d')](_0xe763('0x9e'),_0x177abf);_0x15d6c5={'user':_0x492c09[_0xe763('0x97')],'pass':_0x492c09[_0xe763('0x98')]};var _0x106fdf={'method':_0xe763('0x9f'),'uri':_0x2d0250+_0xe763('0xa0'),'auth':_0x15d6c5,'json':!![]};return rp(_0x106fdf);}})[_0xe763('0x26')](function(_0x1209d9){if(_0x1209d9[_0xe763('0xa1')][_0xe763('0x38')]>0x0){_0x497fbf=_0x1209d9[_0xe763('0xa1')];}console[_0xe763('0xa2')]('incident\x20table\x20objects',_0x497fbf);_0x37c7c2=[];_0x250899=Object['assign']([],_0x497fbf);_[_0xe763('0xa3')](_0x250899,function(_0x172d1f){return!_0x1d9e94[_0xe763('0xa4')](_0x172d1f['name']);});_0x250899[_0xe763('0xa5')](function(_0xad4646){var _0x5977fa=createFieldObject(_0x33e33b,_0x15d6c5,_0xad4646['internalType'],_0xad4646['name'],_0xad4646['label'],![]);_0x37c7c2[_0xe763('0xa6')](_0x5977fa);});return Promise[_0xe763('0xa7')](_0x37c7c2);})[_0xe763('0x26')](function(_0x5d8ba5){_0x2d6fb5=_0x5d8ba5;_0x1ef76a=Object[_0xe763('0xa8')]([],_0x497fbf);console['log'](_0xe763('0xa9'),_0x497fbf);_[_0xe763('0xa3')](_0x1ef76a,function(_0x370c20){return _0xc35c73[_0xe763('0xa4')](_0x370c20[_0xe763('0x2a')]);});console[_0xe763('0xa2')](_0xe763('0xaa'),_0x1ef76a);_0x37c7c2=[];_0x1ef76a[_0xe763('0xa5')](function(_0x1d8b78){var _0xda91a3=createFieldObject(_0x33e33b,_0x15d6c5,_0x1d8b78['internalType'],_0x1d8b78[_0xe763('0x2a')],_0x1d8b78['label'],!![]);_0x37c7c2[_0xe763('0xa6')](_0xda91a3);});return Promise[_0xe763('0xa7')](_0x37c7c2);})[_0xe763('0x26')](function(_0x57182c){_0x19cdfa=_0x57182c;var _0x99e897=_0x2d6fb5[_0xe763('0xab')](_0x19cdfa);return{'count':_0x99e897[_0xe763('0x38')],'rows':_0x99e897};})['then'](respondWithResult(_0x58331,null))[_0xe763('0x45')](function(_0x2649a1){console[_0xe763('0xa2')](_0xe763('0xac')+_0x2649a1);var _0x5bdc84=_0x2abbdc[_0xe763('0x31')][_0xe763('0xad')]?0x1f4:_0x2649a1[_0xe763('0xae')]||0x1f4;logger[_0xe763('0x28')](_0x2649a1[_0xe763('0x29')]);delete _0x2649a1['name'];if(_0x5bdc84===0x191){_0x5bdc84=0x190;}_0x58331['status'](_0x5bdc84)[_0xe763('0x2b')](_0x2abbdc[_0xe763('0x31')][_0xe763('0xad')]?{'message':_0xe763('0xaf'),'statusCode':_0x2649a1[_0xe763('0xae')]}:_0x2649a1);});};function createFieldObject(_0x5a2ec9,_0x152efc,_0x419463,_0x21c70e,_0x406fc5,_0x4cac40){return new Promise(function(_0x5ee2b0,_0x414bec){var _0x277c4b={'id':_0x21c70e,'name':_0x406fc5,'custom':_0x4cac40};if(_0x419463==='boolean'){_0x277c4b[_0xe763('0x41')]=[{'name':'True','value':_0xe763('0xb0')},{'name':'False','value':_0xe763('0xb1')}];_0x5ee2b0(_0x277c4b);}else{var _0x461cb0={'method':_0xe763('0x9f'),'uri':_0x5a2ec9+_0xe763('0xb2')+_0x21c70e,'auth':_0x152efc,'json':!![]};return rp(_0x461cb0)['then'](function(_0x231583){var _0x5a96a1=[];if(_0x231583['result'][_0xe763('0x38')]>0x0){_0x231583[_0xe763('0xa1')]['forEach'](function(_0x1e2a65){if(_0x1e2a65[_0xe763('0xb3')]===_0xe763('0xb1')){var _0x4a7f54={'name':_0x1e2a65['label'],'value':_0x1e2a65[_0xe763('0xb4')]};_0x5a96a1['push'](_0x4a7f54);}});}_0x277c4b[_0xe763('0x41')]=_0x5a96a1;if(_0x277c4b['options'][_0xe763('0x38')]>0x0){_0x5ee2b0(_0x277c4b);}else{if(_0x4cac40==![]){_0x5ee2b0();}else{_0x5ee2b0(_0x277c4b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9e892db..0f608b8 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 _0x5d58=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','bluebird'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x5d58,0x187));var _0x85d5=function(_0x21c16d,_0x178ae9){_0x21c16d=_0x21c16d-0x0;var _0x1e8c8d=_0x5d58[_0x21c16d];return _0x1e8c8d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x85d5('0x4'));module[_0x85d5('0x5')]=function(_0x578fad,_0x46e7b4){return _0x578fad['define'](_0x85d5('0x6'),attributes,{'tableName':_0x85d5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','exports','int_servicenow_accounts'];(function(_0x1e53b2,_0x1a32f8){var _0x267a07=function(_0x58d7a4){while(--_0x58d7a4){_0x1e53b2['push'](_0x1e53b2['shift']());}};_0x267a07(++_0x1a32f8);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xfdbd[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xdfdb('0xa')]=function(_0x41bd5e,_0x489f19){return _0x41bd5e['define']('ServicenowAccount',attributes,{'tableName':_0xdfdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index a238339..35ef03e 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 _0xdf5f=['rpc','../../config/environment','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','GetServicenowAccount','stringify','ShowServicenowAccount','find','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x36daf3,_0x2ea0dd){var _0x3e4e26=function(_0x31999a){while(--_0x31999a){_0x36daf3['push'](_0x36daf3['shift']());}};_0x3e4e26(++_0x2ea0dd);}(_0xdf5f,0x157));var _0xfdf5=function(_0x5b5f0d,_0x4575f0){_0x5b5f0d=_0x5b5f0d-0x0;var _0x5b7c7a=_0xdf5f[_0x5b5f0d];return _0x5b7c7a;};'use strict';var _=require(_0xfdf5('0x0'));var util=require(_0xfdf5('0x1'));var moment=require('moment');var BPromise=require(_0xfdf5('0x2'));var rs=require(_0xfdf5('0x3'));var fs=require('fs');var Redis=require(_0xfdf5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdf5('0x5'));var logger=require(_0xfdf5('0x6'))(_0xfdf5('0x7'));var config=require(_0xfdf5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfdf5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e0ea8,_0x34cbe3,_0x22eca1){return new BPromise(function(_0x3b735b,_0x1e1609){return client[_0xfdf5('0xa')](_0x5e0ea8,_0x22eca1)['then'](function(_0x44e562){logger['info'](_0xfdf5('0xb'),_0x34cbe3,_0xfdf5('0xc'));logger[_0xfdf5('0xd')](_0xfdf5('0xe'),_0x34cbe3,'request\x20sent',JSON['stringify'](_0x44e562));if(_0x44e562[_0xfdf5('0xf')]){if(_0x44e562[_0xfdf5('0xf')][_0xfdf5('0x10')]===0x1f4){logger[_0xfdf5('0xf')](_0xfdf5('0xb'),_0x34cbe3,_0x44e562[_0xfdf5('0xf')][_0xfdf5('0x11')]);return _0x1e1609(_0x44e562['error']['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x34cbe3,_0x44e562[_0xfdf5('0xf')][_0xfdf5('0x11')]);return _0x3b735b(_0x44e562['error'][_0xfdf5('0x11')]);}else{logger[_0xfdf5('0x12')](_0xfdf5('0xb'),_0x34cbe3,'request\x20sent');_0x3b735b(_0x44e562[_0xfdf5('0x13')][_0xfdf5('0x11')]);}})[_0xfdf5('0x14')](function(_0x2adcf7){logger['error'](_0xfdf5('0xb'),_0x34cbe3,_0x2adcf7);_0x1e1609(_0x2adcf7);});});}exports['GetServicenowAccount']=function(_0x359359){var _0x41a11b=this;return new Promise(function(_0x31f28e,_0x52e988){return db[_0xfdf5('0x15')][_0xfdf5('0x16')]({'raw':_0x359359[_0xfdf5('0x17')]?_0x359359[_0xfdf5('0x17')][_0xfdf5('0x18')]===undefined?!![]:![]:!![],'where':_0x359359[_0xfdf5('0x17')]?_0x359359['options'][_0xfdf5('0x19')]||null:null,'attributes':_0x359359[_0xfdf5('0x17')]?_0x359359[_0xfdf5('0x17')][_0xfdf5('0x1a')]||null:null,'limit':_0x359359['options']?_0x359359['options']['limit']||null:null,'include':_0x359359['options']?_0x359359[_0xfdf5('0x17')][_0xfdf5('0x1b')]?_[_0xfdf5('0x1c')](_0x359359[_0xfdf5('0x17')][_0xfdf5('0x1b')],function(_0x882a3f){return{'model':db[_0x882a3f[_0xfdf5('0x1d')]],'as':_0x882a3f['as'],'attributes':_0x882a3f['attributes'],'include':_0x882a3f[_0xfdf5('0x1b')]?_[_0xfdf5('0x1c')](_0x882a3f['include'],function(_0x171b5e){return{'model':db[_0x171b5e[_0xfdf5('0x1d')]],'as':_0x171b5e['as'],'attributes':_0x171b5e[_0xfdf5('0x1a')],'include':_0x171b5e['include']?_['map'](_0x171b5e['include'],function(_0x311416){return{'model':db[_0x311416[_0xfdf5('0x1d')]],'as':_0x311416['as'],'attributes':_0x311416['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3baa99){logger[_0xfdf5('0x12')](_0xfdf5('0x1e'),_0x359359);logger[_0xfdf5('0xd')](_0xfdf5('0x1e'),_0x359359,JSON[_0xfdf5('0x1f')](_0x3baa99));_0x31f28e(_0x3baa99);})['catch'](function(_0x1967a1){logger[_0xfdf5('0xf')](_0xfdf5('0x1e'),_0x1967a1[_0xfdf5('0x11')],_0x359359);_0x52e988(_0x41a11b['error'](0x1f4,_0x1967a1[_0xfdf5('0x11')]));});});};exports[_0xfdf5('0x20')]=function(_0x557c2f){var _0x32a532=this;return new Promise(function(_0x30d124,_0x5376c8){return db['ServicenowAccount'][_0xfdf5('0x21')]({'raw':_0x557c2f['options']?_0x557c2f[_0xfdf5('0x17')][_0xfdf5('0x18')]===undefined?!![]:![]:!![],'where':_0x557c2f[_0xfdf5('0x17')]?_0x557c2f[_0xfdf5('0x17')]['where']||null:null,'attributes':_0x557c2f[_0xfdf5('0x17')]?_0x557c2f[_0xfdf5('0x17')][_0xfdf5('0x1a')]||null:null,'include':_0x557c2f[_0xfdf5('0x17')]?_0x557c2f[_0xfdf5('0x17')][_0xfdf5('0x1b')]?_['map'](_0x557c2f['options'][_0xfdf5('0x1b')],function(_0xf13f32){return{'model':db[_0xf13f32[_0xfdf5('0x1d')]],'as':_0xf13f32['as'],'attributes':_0xf13f32[_0xfdf5('0x1a')],'include':_0xf13f32['include']?_[_0xfdf5('0x1c')](_0xf13f32[_0xfdf5('0x1b')],function(_0x39c2cc){return{'model':db[_0x39c2cc['model']],'as':_0x39c2cc['as'],'attributes':_0x39c2cc[_0xfdf5('0x1a')],'include':_0x39c2cc['include']?_[_0xfdf5('0x1c')](_0x39c2cc['include'],function(_0x3af445){return{'model':db[_0x3af445[_0xfdf5('0x1d')]],'as':_0x3af445['as'],'attributes':_0x3af445[_0xfdf5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfdf5('0x22')](function(_0x5e867d){logger[_0xfdf5('0x12')](_0xfdf5('0x20'),_0x557c2f);logger[_0xfdf5('0xd')](_0xfdf5('0x20'),_0x557c2f,JSON['stringify'](_0x5e867d));_0x30d124(_0x5e867d);})[_0xfdf5('0x14')](function(_0x2b9108){logger[_0xfdf5('0xf')](_0xfdf5('0x20'),_0x2b9108[_0xfdf5('0x11')],_0x557c2f);_0x5376c8(_0x32a532['error'](0x1f4,_0x2b9108['message']));});});}; \ No newline at end of file +var _0x2868=['include','map','model','GetServicenowAccount','debug','find','raw','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ServicenowAccount','options','where','attributes'];(function(_0x500ab9,_0x52eb20){var _0x5db2c3=function(_0x7c8b17){while(--_0x7c8b17){_0x500ab9['push'](_0x500ab9['shift']());}};_0x5db2c3(++_0x52eb20);}(_0x2868,0x17e));var _0x8286=function(_0x24fff2,_0x45952b){_0x24fff2=_0x24fff2-0x0;var _0x28794a=_0x2868[_0x24fff2];return _0x28794a;};'use strict';var _=require(_0x8286('0x0'));var util=require(_0x8286('0x1'));var moment=require(_0x8286('0x2'));var BPromise=require(_0x8286('0x3'));var rs=require(_0x8286('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8286('0x5'));var logger=require(_0x8286('0x6'))(_0x8286('0x7'));var config=require('../../config/environment');var jayson=require(_0x8286('0x8'));var client=jayson[_0x8286('0x9')][_0x8286('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123459,_0x58cbb3,_0x3c65c8){return new BPromise(function(_0x3fdc94,_0x16dd47){return client[_0x8286('0xb')](_0x123459,_0x3c65c8)[_0x8286('0xc')](function(_0x45417c){logger[_0x8286('0xd')](_0x8286('0xe'),_0x58cbb3,_0x8286('0xf'));logger['debug'](_0x8286('0x10'),_0x58cbb3,'request\x20sent',JSON[_0x8286('0x11')](_0x45417c));if(_0x45417c['error']){if(_0x45417c[_0x8286('0x12')]['code']===0x1f4){logger[_0x8286('0x12')](_0x8286('0xe'),_0x58cbb3,_0x45417c[_0x8286('0x12')]['message']);return _0x16dd47(_0x45417c[_0x8286('0x12')][_0x8286('0x13')]);}logger[_0x8286('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x58cbb3,_0x45417c[_0x8286('0x12')]['message']);return _0x3fdc94(_0x45417c[_0x8286('0x12')][_0x8286('0x13')]);}else{logger['info'](_0x8286('0xe'),_0x58cbb3,'request\x20sent');_0x3fdc94(_0x45417c[_0x8286('0x14')]['message']);}})[_0x8286('0x15')](function(_0x33acab){logger[_0x8286('0x12')](_0x8286('0xe'),_0x58cbb3,_0x33acab);_0x16dd47(_0x33acab);});});}exports['GetServicenowAccount']=function(_0xde7dc){var _0x16c63e=this;return new Promise(function(_0x54ba54,_0x20f2cb){return db[_0x8286('0x16')]['findAll']({'raw':_0xde7dc[_0x8286('0x17')]?_0xde7dc[_0x8286('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xde7dc[_0x8286('0x17')]?_0xde7dc[_0x8286('0x17')][_0x8286('0x18')]||null:null,'attributes':_0xde7dc['options']?_0xde7dc['options'][_0x8286('0x19')]||null:null,'limit':_0xde7dc['options']?_0xde7dc[_0x8286('0x17')]['limit']||null:null,'include':_0xde7dc[_0x8286('0x17')]?_0xde7dc[_0x8286('0x17')][_0x8286('0x1a')]?_[_0x8286('0x1b')](_0xde7dc[_0x8286('0x17')][_0x8286('0x1a')],function(_0x13f651){return{'model':db[_0x13f651[_0x8286('0x1c')]],'as':_0x13f651['as'],'attributes':_0x13f651[_0x8286('0x19')],'include':_0x13f651[_0x8286('0x1a')]?_['map'](_0x13f651['include'],function(_0x4db0c3){return{'model':db[_0x4db0c3['model']],'as':_0x4db0c3['as'],'attributes':_0x4db0c3['attributes'],'include':_0x4db0c3[_0x8286('0x1a')]?_['map'](_0x4db0c3['include'],function(_0x1e68ea){return{'model':db[_0x1e68ea[_0x8286('0x1c')]],'as':_0x1e68ea['as'],'attributes':_0x1e68ea[_0x8286('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8286('0xc')](function(_0x1266ae){logger[_0x8286('0xd')](_0x8286('0x1d'),_0xde7dc);logger[_0x8286('0x1e')](_0x8286('0x1d'),_0xde7dc,JSON[_0x8286('0x11')](_0x1266ae));_0x54ba54(_0x1266ae);})[_0x8286('0x15')](function(_0xf0e9f5){logger['error']('GetServicenowAccount',_0xf0e9f5['message'],_0xde7dc);_0x20f2cb(_0x16c63e[_0x8286('0x12')](0x1f4,_0xf0e9f5[_0x8286('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x54b1e9){var _0x57d6ca=this;return new Promise(function(_0x2cd92a,_0x3604f6){return db[_0x8286('0x16')][_0x8286('0x1f')]({'raw':_0x54b1e9[_0x8286('0x17')]?_0x54b1e9[_0x8286('0x17')][_0x8286('0x20')]===undefined?!![]:![]:!![],'where':_0x54b1e9['options']?_0x54b1e9['options'][_0x8286('0x18')]||null:null,'attributes':_0x54b1e9[_0x8286('0x17')]?_0x54b1e9['options'][_0x8286('0x19')]||null:null,'include':_0x54b1e9[_0x8286('0x17')]?_0x54b1e9[_0x8286('0x17')][_0x8286('0x1a')]?_['map'](_0x54b1e9[_0x8286('0x17')][_0x8286('0x1a')],function(_0x20fb2f){return{'model':db[_0x20fb2f['model']],'as':_0x20fb2f['as'],'attributes':_0x20fb2f[_0x8286('0x19')],'include':_0x20fb2f[_0x8286('0x1a')]?_['map'](_0x20fb2f[_0x8286('0x1a')],function(_0x3d7897){return{'model':db[_0x3d7897[_0x8286('0x1c')]],'as':_0x3d7897['as'],'attributes':_0x3d7897[_0x8286('0x19')],'include':_0x3d7897[_0x8286('0x1a')]?_[_0x8286('0x1b')](_0x3d7897[_0x8286('0x1a')],function(_0x259d0a){return{'model':db[_0x259d0a[_0x8286('0x1c')]],'as':_0x259d0a['as'],'attributes':_0x259d0a[_0x8286('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8286('0xc')](function(_0x3e8b73){logger['info']('ShowServicenowAccount',_0x54b1e9);logger[_0x8286('0x1e')](_0x8286('0x21'),_0x54b1e9,JSON[_0x8286('0x11')](_0x3e8b73));_0x2cd92a(_0x3e8b73);})[_0x8286('0x15')](function(_0x20adc8){logger[_0x8286('0x12')](_0x8286('0x21'),_0x20adc8[_0x8286('0x13')],_0x54b1e9);_0x3604f6(_0x57d6ca[_0x8286('0x12')](0x1f4,_0x20adc8[_0x8286('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8d6c3e2..4d814b7 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 _0x323b=['getSubjects','/:id/descriptions','isAuthenticated','getDescriptions','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x323b,0xe2));var _0xb323=function(_0x25b372,_0x5ce232){_0x25b372=_0x25b372-0x0;var _0x5e601e=_0x323b[_0x25b372];return _0x5e601e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb323('0x0'));var timeout=require(_0xb323('0x1'));var express=require(_0xb323('0x2'));var router=express[_0xb323('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb323('0x4'));var config=require(_0xb323('0x5'));var controller=require(_0xb323('0x6'));router[_0xb323('0x7')]('/',auth['isAuthenticated'](),controller[_0xb323('0x8')]);router[_0xb323('0x7')](_0xb323('0x9'),auth['isAuthenticated'](),controller[_0xb323('0xa')]);router[_0xb323('0x7')](_0xb323('0xb'),auth['isAuthenticated'](),controller[_0xb323('0xc')]);router['get'](_0xb323('0xd'),auth['isAuthenticated'](),controller[_0xb323('0xe')]);router['get'](_0xb323('0xf'),auth[_0xb323('0x10')](),controller[_0xb323('0x11')]);router[_0xb323('0x12')]('/',auth[_0xb323('0x10')](),controller[_0xb323('0x13')]);router[_0xb323('0x14')](_0xb323('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xb323('0x15')](_0xb323('0x9'),auth[_0xb323('0x10')](),controller[_0xb323('0x16')]);module[_0xb323('0x17')]=router; \ No newline at end of file +var _0xf8f2=['getSubjects','/:id/descriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xf8f2,0x1e3));var _0x2f8f=function(_0x2d08e1,_0x4f0f49){_0x2d08e1=_0x2d08e1-0x0;var _0x4e3398=_0xf8f2[_0x2d08e1];return _0x4e3398;};'use strict';var multer=require(_0x2f8f('0x0'));var util=require('util');var path=require(_0x2f8f('0x1'));var timeout=require(_0x2f8f('0x2'));var express=require(_0x2f8f('0x3'));var router=express[_0x2f8f('0x4')]();var fs_extra=require(_0x2f8f('0x5'));var auth=require(_0x2f8f('0x6'));var interaction=require(_0x2f8f('0x7'));var config=require(_0x2f8f('0x8'));var controller=require(_0x2f8f('0x9'));router[_0x2f8f('0xa')]('/',auth[_0x2f8f('0xb')](),controller[_0x2f8f('0xc')]);router[_0x2f8f('0xa')](_0x2f8f('0xd'),auth[_0x2f8f('0xb')](),controller[_0x2f8f('0xe')]);router[_0x2f8f('0xa')](_0x2f8f('0xf'),auth[_0x2f8f('0xb')](),controller[_0x2f8f('0x10')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x2f8f('0x11')]);router['get'](_0x2f8f('0x12'),auth[_0x2f8f('0xb')](),controller['getDescriptions']);router[_0x2f8f('0x13')]('/',auth[_0x2f8f('0xb')](),controller[_0x2f8f('0x14')]);router['put'](_0x2f8f('0xd'),auth[_0x2f8f('0xb')](),controller[_0x2f8f('0x15')]);router[_0x2f8f('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x2f8f('0x17')]);module[_0x2f8f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index c53c179..f794e46 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 _0x6260=['sequelize','exports','STRING'];(function(_0x99a389,_0x1736ba){var _0x633fcc=function(_0x172a79){while(--_0x172a79){_0x99a389['push'](_0x99a389['shift']());}};_0x633fcc(++_0x1736ba);}(_0x6260,0x78));var _0x0626=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x6260[_0x38854e];return _0x3f8415;};'use strict';var Sequelize=require(_0x0626('0x0'));module[_0x0626('0x1')]={'name':{'type':Sequelize[_0x0626('0x2')]},'description':{'type':Sequelize[_0x0626('0x2')]}}; \ No newline at end of file +var _0xcd43=['sequelize','STRING'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xcd43,0xf2));var _0x3cd4=function(_0x2caed0,_0x307868){_0x2caed0=_0x2caed0-0x0;var _0x3d88ad=_0xcd43[_0x2caed0];return _0x3d88ad;};'use strict';var Sequelize=require(_0x3cd4('0x0'));module['exports']={'name':{'type':Sequelize[_0x3cd4('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index f311fc8..6c8199c 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 _0x56d5=['query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','rawAttributes','filters','includeAll','find','create','body','params','getFields','findOne','ServicenowField','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','ServicenowConfiguration','key','name'];(function(_0x34a10c,_0x7ce96a){var _0x3015ab=function(_0x159266){while(--_0x159266){_0x34a10c['push'](_0x34a10c['shift']());}};_0x3015ab(++_0x7ce96a);}(_0x56d5,0xbf));var _0x556d=function(_0x194712,_0x2b8d54){_0x194712=_0x194712-0x0;var _0x43b4fc=_0x56d5[_0x194712];return _0x43b4fc;};'use strict';var emlformat=require(_0x556d('0x0'));var rimraf=require(_0x556d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x556d('0x2'));var rp=require(_0x556d('0x3'));var moment=require(_0x556d('0x4'));var BPromise=require(_0x556d('0x5'));var Mustache=require(_0x556d('0x6'));var util=require('util');var path=require(_0x556d('0x7'));var sox=require(_0x556d('0x8'));var csv=require(_0x556d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x556d('0xa'));var _=require(_0x556d('0xb'));var squel=require(_0x556d('0xc'));var crypto=require(_0x556d('0xd'));var jsforce=require(_0x556d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x556d('0xf'));var Papa=require(_0x556d('0x10'));var Redis=require('ioredis');var authService=require(_0x556d('0x11'));var qs=require(_0x556d('0x12'));var as=require(_0x556d('0x13'));var hardwareService=require(_0x556d('0x14'));var logger=require(_0x556d('0x15'))('api');var utils=require(_0x556d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x556d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5928a6,_0x5acf37){_0x5acf37=_0x5acf37||0xcc;return function(_0x206b2e){if(_0x206b2e){return _0x5928a6[_0x556d('0x18')](_0x5acf37);}return _0x5928a6[_0x556d('0x19')](_0x5acf37)[_0x556d('0x1a')]();};}function respondWithResult(_0x107021,_0xd4e86c){_0xd4e86c=_0xd4e86c||0xc8;return function(_0x1c01a9){if(_0x1c01a9){return _0x107021['status'](_0xd4e86c)['json'](_0x1c01a9);}};}function respondWithFilteredResult(_0x2bfe5f,_0x399866){return function(_0x3c60f1){if(_0x3c60f1){var _0x439311=typeof _0x399866[_0x556d('0x1b')]==='undefined'&&typeof _0x399866[_0x556d('0x1c')]===_0x556d('0x1d');var _0x198ac2=_0x3c60f1[_0x556d('0x1e')];var _0x2c6ecd=_0x439311?0x0:_0x399866[_0x556d('0x1b')];var _0x29bd88=_0x439311?_0x3c60f1[_0x556d('0x1e')]:_0x399866[_0x556d('0x1b')]+_0x399866[_0x556d('0x1c')];var _0x5aa2e0;if(_0x29bd88>=_0x198ac2){_0x29bd88=_0x198ac2;_0x5aa2e0=0xc8;}else{_0x5aa2e0=0xce;}_0x2bfe5f[_0x556d('0x19')](_0x5aa2e0);return _0x2bfe5f[_0x556d('0x1f')](_0x556d('0x20'),_0x2c6ecd+'-'+_0x29bd88+'/'+_0x198ac2)['json'](_0x3c60f1);}return null;};}function patchUpdates(_0x2771f6){return function(_0x2697c2){try{jsonpatch[_0x556d('0x21')](_0x2697c2,_0x2771f6,!![]);}catch(_0xffa032){return BPromise['reject'](_0xffa032);}return _0x2697c2[_0x556d('0x22')]();};}function saveUpdates(_0x284679,_0x4b9dd6){return function(_0x472ebf){if(_0x472ebf){return _0x472ebf[_0x556d('0x23')](_0x284679)[_0x556d('0x24')](function(_0x7dce6a){return _0x7dce6a;});}return null;};}function removeEntity(_0x7d1466,_0x7297fb){return function(_0x30cc03){if(_0x30cc03){return _0x30cc03[_0x556d('0x25')]()[_0x556d('0x24')](function(){_0x7d1466['status'](0xcc)[_0x556d('0x1a')]();});}};}function handleEntityNotFound(_0x171cc1,_0x4c3bff){return function(_0x21c4c4){if(!_0x21c4c4){_0x171cc1[_0x556d('0x18')](0x194);}return _0x21c4c4;};}function handleError(_0x1491e5,_0x584152){_0x584152=_0x584152||0x1f4;return function(_0x421e6c){logger[_0x556d('0x26')](_0x421e6c[_0x556d('0x27')]);if(_0x421e6c['name']){delete _0x421e6c['name'];}_0x1491e5[_0x556d('0x19')](_0x584152)[_0x556d('0x28')](_0x421e6c);};}exports[_0x556d('0x29')]=function(_0x28684d,_0x2bf96b){var _0x17e8f1={},_0x4c3952={},_0x27c520={'count':0x0,'rows':[]};var _0x5b55df=_[_0x556d('0x2a')](db[_0x556d('0x2b')]['rawAttributes'],function(_0x2c044a){return{'name':_0x2c044a['fieldName'],'type':_0x2c044a['type'][_0x556d('0x2c')]};});_0x4c3952['model']=_[_0x556d('0x2a')](_0x5b55df,_0x556d('0x2d'));_0x4c3952[_0x556d('0x2e')]=_[_0x556d('0x2f')](_0x28684d[_0x556d('0x2e')]);_0x4c3952['filters']=_['intersection'](_0x4c3952[_0x556d('0x30')],_0x4c3952[_0x556d('0x2e')]);_0x17e8f1[_0x556d('0x31')]=_[_0x556d('0x32')](_0x4c3952['model'],qs[_0x556d('0x33')](_0x28684d['query']['fields']));_0x17e8f1[_0x556d('0x31')]=_0x17e8f1['attributes'][_0x556d('0x34')]?_0x17e8f1[_0x556d('0x31')]:_0x4c3952[_0x556d('0x30')];if(!_0x28684d[_0x556d('0x2e')][_0x556d('0x35')]('nolimit')){_0x17e8f1['limit']=qs['limit'](_0x28684d[_0x556d('0x2e')]['limit']);_0x17e8f1[_0x556d('0x1b')]=qs[_0x556d('0x1b')](_0x28684d[_0x556d('0x2e')][_0x556d('0x1b')]);}_0x17e8f1['order']=qs[_0x556d('0x36')](_0x28684d['query'][_0x556d('0x36')]);_0x17e8f1[_0x556d('0x37')]=qs['filters'](_[_0x556d('0x38')](_0x28684d[_0x556d('0x2e')],_0x4c3952['filters']),_0x5b55df);if(_0x28684d[_0x556d('0x2e')][_0x556d('0x39')]){_0x17e8f1[_0x556d('0x37')]=_[_0x556d('0x3a')](_0x17e8f1[_0x556d('0x37')],{'$or':_['map'](_0x5b55df,function(_0x17ad01){if(_0x17ad01[_0x556d('0x3b')]!=='VIRTUAL'){var _0x242f76={};_0x242f76[_0x17ad01[_0x556d('0x2d')]]={'$like':'%'+_0x28684d[_0x556d('0x2e')]['filter']+'%'};return _0x242f76;}})});}_0x17e8f1=_[_0x556d('0x3a')]({},_0x17e8f1,_0x28684d[_0x556d('0x3c')]);var _0x55180c={'where':_0x17e8f1[_0x556d('0x37')]};return db[_0x556d('0x2b')][_0x556d('0x1e')](_0x55180c)[_0x556d('0x24')](function(_0x5a8aea){_0x27c520[_0x556d('0x1e')]=_0x5a8aea;if(_0x28684d[_0x556d('0x2e')]['includeAll']){_0x17e8f1[_0x556d('0x3d')]=[{'all':!![]}];}return db[_0x556d('0x2b')][_0x556d('0x3e')](_0x17e8f1);})[_0x556d('0x24')](function(_0x5d53e2){_0x27c520[_0x556d('0x3f')]=_0x5d53e2;return _0x27c520;})['then'](respondWithFilteredResult(_0x2bf96b,_0x17e8f1))[_0x556d('0x40')](handleError(_0x2bf96b,null));};exports['show']=function(_0x2b80c9,_0xd13d81){var _0xc29035={'raw':![],'where':{'id':_0x2b80c9['params']['id']}},_0x241435={};_0x241435[_0x556d('0x30')]=_[_0x556d('0x2f')](db[_0x556d('0x2b')][_0x556d('0x41')]);_0x241435['query']=_[_0x556d('0x2f')](_0x2b80c9[_0x556d('0x2e')]);_0x241435[_0x556d('0x42')]=_['intersection'](_0x241435[_0x556d('0x30')],_0x241435['query']);_0xc29035[_0x556d('0x31')]=_[_0x556d('0x32')](_0x241435[_0x556d('0x30')],qs[_0x556d('0x33')](_0x2b80c9[_0x556d('0x2e')]['fields']));_0xc29035[_0x556d('0x31')]=_0xc29035[_0x556d('0x31')]['length']?_0xc29035[_0x556d('0x31')]:_0x241435['model'];if(_0x2b80c9[_0x556d('0x2e')][_0x556d('0x43')]){_0xc29035[_0x556d('0x3d')]=[{'all':!![]}];}_0xc29035=_[_0x556d('0x3a')]({},_0xc29035,_0x2b80c9['options']);return db[_0x556d('0x2b')][_0x556d('0x44')](_0xc29035)[_0x556d('0x24')](handleEntityNotFound(_0xd13d81,null))[_0x556d('0x24')](respondWithResult(_0xd13d81,null))[_0x556d('0x40')](handleError(_0xd13d81,null));};exports[_0x556d('0x45')]=function(_0x29d80b,_0x5d0add){return db[_0x556d('0x2b')][_0x556d('0x45')](_0x29d80b['body'],{})[_0x556d('0x24')](respondWithResult(_0x5d0add,0xc9))[_0x556d('0x40')](handleError(_0x5d0add,null));};exports['update']=function(_0x1a4730,_0x5c7848){if(_0x1a4730[_0x556d('0x46')]['id']){delete _0x1a4730[_0x556d('0x46')]['id'];}return db[_0x556d('0x2b')][_0x556d('0x44')]({'where':{'id':_0x1a4730[_0x556d('0x47')]['id']}})[_0x556d('0x24')](handleEntityNotFound(_0x5c7848,null))[_0x556d('0x24')](saveUpdates(_0x1a4730[_0x556d('0x46')],null))[_0x556d('0x24')](respondWithResult(_0x5c7848,null))[_0x556d('0x40')](handleError(_0x5c7848,null));};exports[_0x556d('0x25')]=function(_0x2557e4,_0x247b5d){return db[_0x556d('0x2b')][_0x556d('0x44')]({'where':{'id':_0x2557e4[_0x556d('0x47')]['id']}})[_0x556d('0x24')](handleEntityNotFound(_0x247b5d,null))[_0x556d('0x24')](removeEntity(_0x247b5d,null))['catch'](handleError(_0x247b5d,null));};exports[_0x556d('0x48')]=function(_0x5a4ab2,_0xcef0ef,_0x418274){var _0x58f97b={};var _0x5e043d={};var _0x13666b;var _0xae5f38;return db[_0x556d('0x2b')][_0x556d('0x49')]({'where':{'id':_0x5a4ab2[_0x556d('0x47')]['id']}})['then'](handleEntityNotFound(_0xcef0ef,null))['then'](function(_0x2e3ddb){if(_0x2e3ddb){_0x13666b=_0x2e3ddb;_0x5e043d[_0x556d('0x30')]=_[_0x556d('0x2f')](db[_0x556d('0x4a')][_0x556d('0x41')]);_0x5e043d[_0x556d('0x2e')]=_[_0x556d('0x2f')](_0x5a4ab2['query']);_0x5e043d['filters']=_[_0x556d('0x32')](_0x5e043d[_0x556d('0x30')],_0x5e043d[_0x556d('0x2e')]);_0x58f97b[_0x556d('0x31')]=_[_0x556d('0x32')](_0x5e043d['model'],qs[_0x556d('0x33')](_0x5a4ab2['query'][_0x556d('0x33')]));_0x58f97b['attributes']=_0x58f97b[_0x556d('0x31')][_0x556d('0x34')]?_0x58f97b[_0x556d('0x31')]:_0x5e043d[_0x556d('0x30')];_0x58f97b[_0x556d('0x4b')]=qs[_0x556d('0x36')](_0x5a4ab2[_0x556d('0x2e')][_0x556d('0x36')]);_0x58f97b['where']=qs[_0x556d('0x42')](_[_0x556d('0x38')](_0x5a4ab2['query'],_0x5e043d['filters']));if(_0x5a4ab2['query'][_0x556d('0x39')]){_0x58f97b[_0x556d('0x37')]=_[_0x556d('0x3a')](_0x58f97b[_0x556d('0x37')],{'$or':_['map'](_0x58f97b[_0x556d('0x31')],function(_0x1ff5b1){var _0x1cb8ef={};_0x1cb8ef[_0x1ff5b1]={'$like':'%'+_0x5a4ab2['query'][_0x556d('0x39')]+'%'};return _0x1cb8ef;})});}_0x58f97b=_['merge']({},_0x58f97b,_0x5a4ab2['options']);return _0x13666b[_0x556d('0x48')](_0x58f97b);}})[_0x556d('0x24')](function(_0xa2aca4){if(_0xa2aca4){_0xae5f38=_0xa2aca4[_0x556d('0x34')];if(!_0x5a4ab2[_0x556d('0x2e')][_0x556d('0x35')](_0x556d('0x4c'))){_0x58f97b[_0x556d('0x1c')]=qs[_0x556d('0x1c')](_0x5a4ab2[_0x556d('0x2e')][_0x556d('0x1c')]);_0x58f97b['offset']=qs[_0x556d('0x1b')](_0x5a4ab2[_0x556d('0x2e')][_0x556d('0x1b')]);}return _0x13666b['getFields'](_0x58f97b);}})[_0x556d('0x24')](function(_0x3ba671){if(_0x3ba671){return _0x3ba671?{'count':_0xae5f38,'rows':_0x3ba671}:null;}})[_0x556d('0x24')](respondWithResult(_0xcef0ef,null))['catch'](handleError(_0xcef0ef,null));};exports[_0x556d('0x4d')]=function(_0x2c9648,_0x3f2ee0,_0x343338){var _0x3b1393={};var _0x27c06b={};var _0x314236;var _0x4a5dd2;return db[_0x556d('0x2b')][_0x556d('0x49')]({'where':{'id':_0x2c9648['params']['id']}})[_0x556d('0x24')](handleEntityNotFound(_0x3f2ee0,null))[_0x556d('0x24')](function(_0x42b67b){if(_0x42b67b){_0x314236=_0x42b67b;_0x27c06b[_0x556d('0x30')]=_['keys'](db[_0x556d('0x4a')][_0x556d('0x41')]);_0x27c06b['query']=_['keys'](_0x2c9648['query']);_0x27c06b[_0x556d('0x42')]=_['intersection'](_0x27c06b[_0x556d('0x30')],_0x27c06b['query']);_0x3b1393['attributes']=_[_0x556d('0x32')](_0x27c06b[_0x556d('0x30')],qs['fields'](_0x2c9648[_0x556d('0x2e')][_0x556d('0x33')]));_0x3b1393[_0x556d('0x31')]=_0x3b1393[_0x556d('0x31')][_0x556d('0x34')]?_0x3b1393[_0x556d('0x31')]:_0x27c06b[_0x556d('0x30')];_0x3b1393[_0x556d('0x4b')]=qs[_0x556d('0x36')](_0x2c9648[_0x556d('0x2e')][_0x556d('0x36')]);_0x3b1393[_0x556d('0x37')]=qs['filters'](_[_0x556d('0x38')](_0x2c9648[_0x556d('0x2e')],_0x27c06b[_0x556d('0x42')]));if(_0x2c9648['query'][_0x556d('0x39')]){_0x3b1393[_0x556d('0x37')]=_[_0x556d('0x3a')](_0x3b1393[_0x556d('0x37')],{'$or':_[_0x556d('0x2a')](_0x3b1393[_0x556d('0x31')],function(_0x3ed79f){var _0xa29f19={};_0xa29f19[_0x3ed79f]={'$like':'%'+_0x2c9648['query'][_0x556d('0x39')]+'%'};return _0xa29f19;})});}_0x3b1393=_[_0x556d('0x3a')]({},_0x3b1393,_0x2c9648[_0x556d('0x3c')]);return _0x314236[_0x556d('0x4d')](_0x3b1393);}})[_0x556d('0x24')](function(_0x12283b){if(_0x12283b){_0x4a5dd2=_0x12283b[_0x556d('0x34')];if(!_0x2c9648['query']['hasOwnProperty'](_0x556d('0x4c'))){_0x3b1393[_0x556d('0x1c')]=qs[_0x556d('0x1c')](_0x2c9648['query']['limit']);_0x3b1393[_0x556d('0x1b')]=qs[_0x556d('0x1b')](_0x2c9648[_0x556d('0x2e')]['offset']);}return _0x314236[_0x556d('0x4d')](_0x3b1393);}})['then'](function(_0x2558f6){if(_0x2558f6){return _0x2558f6?{'count':_0x4a5dd2,'rows':_0x2558f6}:null;}})['then'](respondWithResult(_0x3f2ee0,null))[_0x556d('0x40')](handleError(_0x3f2ee0,null));};exports[_0x556d('0x4e')]=function(_0x3e96a5,_0x2f632a,_0x4a61a8){var _0x308819={};var _0x431bb2={};var _0x29d842;var _0x1f5e50;return db[_0x556d('0x2b')]['findOne']({'where':{'id':_0x3e96a5[_0x556d('0x47')]['id']}})[_0x556d('0x24')](handleEntityNotFound(_0x2f632a,null))[_0x556d('0x24')](function(_0x253eed){if(_0x253eed){_0x29d842=_0x253eed;_0x431bb2[_0x556d('0x30')]=_[_0x556d('0x2f')](db[_0x556d('0x4a')][_0x556d('0x41')]);_0x431bb2[_0x556d('0x2e')]=_[_0x556d('0x2f')](_0x3e96a5['query']);_0x431bb2['filters']=_[_0x556d('0x32')](_0x431bb2[_0x556d('0x30')],_0x431bb2['query']);_0x308819['attributes']=_[_0x556d('0x32')](_0x431bb2[_0x556d('0x30')],qs[_0x556d('0x33')](_0x3e96a5[_0x556d('0x2e')]['fields']));_0x308819['attributes']=_0x308819[_0x556d('0x31')][_0x556d('0x34')]?_0x308819[_0x556d('0x31')]:_0x431bb2[_0x556d('0x30')];_0x308819[_0x556d('0x4b')]=qs['sort'](_0x3e96a5['query'][_0x556d('0x36')]);_0x308819[_0x556d('0x37')]=qs['filters'](_[_0x556d('0x38')](_0x3e96a5[_0x556d('0x2e')],_0x431bb2[_0x556d('0x42')]));if(_0x3e96a5[_0x556d('0x2e')][_0x556d('0x39')]){_0x308819['where']=_[_0x556d('0x3a')](_0x308819[_0x556d('0x37')],{'$or':_['map'](_0x308819[_0x556d('0x31')],function(_0x2b9afb){var _0x56d25e={};_0x56d25e[_0x2b9afb]={'$like':'%'+_0x3e96a5[_0x556d('0x2e')]['filter']+'%'};return _0x56d25e;})});}_0x308819=_['merge']({},_0x308819,_0x3e96a5[_0x556d('0x3c')]);return _0x29d842['getDescriptions'](_0x308819);}})[_0x556d('0x24')](function(_0x5e05df){if(_0x5e05df){_0x1f5e50=_0x5e05df[_0x556d('0x34')];if(!_0x3e96a5[_0x556d('0x2e')][_0x556d('0x35')](_0x556d('0x4c'))){_0x308819['limit']=qs[_0x556d('0x1c')](_0x3e96a5[_0x556d('0x2e')]['limit']);_0x308819[_0x556d('0x1b')]=qs['offset'](_0x3e96a5[_0x556d('0x2e')][_0x556d('0x1b')]);}return _0x29d842[_0x556d('0x4e')](_0x308819);}})[_0x556d('0x24')](function(_0xf559f4){if(_0xf559f4){return _0xf559f4?{'count':_0x1f5e50,'rows':_0xf559f4}:null;}})['then'](respondWithResult(_0x2f632a,null))[_0x556d('0x40')](handleError(_0x2f632a,null));}; \ No newline at end of file +var _0x449a=['mustache','sox','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','pick','getSubjects','ServicenowField','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x1324ab,_0x2fb712){var _0x28ebc1=function(_0x335919){while(--_0x335919){_0x1324ab['push'](_0x1324ab['shift']());}};_0x28ebc1(++_0x2fb712);}(_0x449a,0x1d0));var _0xa449=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x449a[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require(_0xa449('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa449('0x1'));var jsonpatch=require(_0xa449('0x2'));var rp=require(_0xa449('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa449('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa449('0x5'));var csv=require(_0xa449('0x6'));var ejs=require(_0xa449('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa449('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xa449('0x6'));var querystring=require(_0xa449('0x9'));var Papa=require(_0xa449('0xa'));var Redis=require(_0xa449('0xb'));var authService=require(_0xa449('0xc'));var qs=require(_0xa449('0xd'));var as=require(_0xa449('0xe'));var hardwareService=require(_0xa449('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xa449('0x10'));var config=require(_0xa449('0x11'));var licenseUtil=require(_0xa449('0x12'));var db=require(_0xa449('0x13'))['db'];function respondWithStatusCode(_0x15ab1e,_0x502e5a){_0x502e5a=_0x502e5a||0xcc;return function(_0x5acc7b){if(_0x5acc7b){return _0x15ab1e[_0xa449('0x14')](_0x502e5a);}return _0x15ab1e[_0xa449('0x15')](_0x502e5a)[_0xa449('0x16')]();};}function respondWithResult(_0x3294ce,_0x2cc90f){_0x2cc90f=_0x2cc90f||0xc8;return function(_0x3aebbe){if(_0x3aebbe){return _0x3294ce[_0xa449('0x15')](_0x2cc90f)[_0xa449('0x17')](_0x3aebbe);}};}function respondWithFilteredResult(_0x220ac7,_0x5186e4){return function(_0xa7901b){if(_0xa7901b){var _0x4b2cd0=typeof _0x5186e4[_0xa449('0x18')]==='undefined'&&typeof _0x5186e4[_0xa449('0x19')]===_0xa449('0x1a');var _0x5b60ed=_0xa7901b[_0xa449('0x1b')];var _0x2ffbac=_0x4b2cd0?0x0:_0x5186e4[_0xa449('0x18')];var _0x2026c8=_0x4b2cd0?_0xa7901b[_0xa449('0x1b')]:_0x5186e4[_0xa449('0x18')]+_0x5186e4[_0xa449('0x19')];var _0x44e9e0;if(_0x2026c8>=_0x5b60ed){_0x2026c8=_0x5b60ed;_0x44e9e0=0xc8;}else{_0x44e9e0=0xce;}_0x220ac7[_0xa449('0x15')](_0x44e9e0);return _0x220ac7[_0xa449('0x1c')](_0xa449('0x1d'),_0x2ffbac+'-'+_0x2026c8+'/'+_0x5b60ed)[_0xa449('0x17')](_0xa7901b);}return null;};}function patchUpdates(_0x2444e5){return function(_0x2a1357){try{jsonpatch['apply'](_0x2a1357,_0x2444e5,!![]);}catch(_0x45c43e){return BPromise[_0xa449('0x1e')](_0x45c43e);}return _0x2a1357[_0xa449('0x1f')]();};}function saveUpdates(_0x108816,_0x2ea02f){return function(_0x3b1127){if(_0x3b1127){return _0x3b1127[_0xa449('0x20')](_0x108816)[_0xa449('0x21')](function(_0x3a7b7f){return _0x3a7b7f;});}return null;};}function removeEntity(_0x3ed637,_0x33ee36){return function(_0x3ffdbb){if(_0x3ffdbb){return _0x3ffdbb[_0xa449('0x22')]()['then'](function(){_0x3ed637[_0xa449('0x15')](0xcc)[_0xa449('0x16')]();});}};}function handleEntityNotFound(_0x566ea4,_0x87cb1f){return function(_0x271962){if(!_0x271962){_0x566ea4[_0xa449('0x14')](0x194);}return _0x271962;};}function handleError(_0x377b19,_0x5cd3b8){_0x5cd3b8=_0x5cd3b8||0x1f4;return function(_0x19978e){logger[_0xa449('0x23')](_0x19978e[_0xa449('0x24')]);if(_0x19978e[_0xa449('0x25')]){delete _0x19978e[_0xa449('0x25')];}_0x377b19[_0xa449('0x15')](_0x5cd3b8)[_0xa449('0x26')](_0x19978e);};}exports[_0xa449('0x27')]=function(_0x1be67f,_0x394b5c){var _0x2c2669={},_0x5f702b={},_0x17dd81={'count':0x0,'rows':[]};var _0xdb32fa=_[_0xa449('0x28')](db[_0xa449('0x29')][_0xa449('0x2a')],function(_0x67ba17){return{'name':_0x67ba17['fieldName'],'type':_0x67ba17[_0xa449('0x2b')][_0xa449('0x2c')]};});_0x5f702b[_0xa449('0x2d')]=_[_0xa449('0x28')](_0xdb32fa,_0xa449('0x25'));_0x5f702b[_0xa449('0x2e')]=_[_0xa449('0x2f')](_0x1be67f[_0xa449('0x2e')]);_0x5f702b[_0xa449('0x30')]=_[_0xa449('0x31')](_0x5f702b[_0xa449('0x2d')],_0x5f702b[_0xa449('0x2e')]);_0x2c2669[_0xa449('0x32')]=_[_0xa449('0x31')](_0x5f702b['model'],qs[_0xa449('0x33')](_0x1be67f[_0xa449('0x2e')][_0xa449('0x33')]));_0x2c2669['attributes']=_0x2c2669[_0xa449('0x32')][_0xa449('0x34')]?_0x2c2669[_0xa449('0x32')]:_0x5f702b['model'];if(!_0x1be67f[_0xa449('0x2e')][_0xa449('0x35')]('nolimit')){_0x2c2669[_0xa449('0x19')]=qs[_0xa449('0x19')](_0x1be67f[_0xa449('0x2e')][_0xa449('0x19')]);_0x2c2669['offset']=qs[_0xa449('0x18')](_0x1be67f[_0xa449('0x2e')][_0xa449('0x18')]);}_0x2c2669[_0xa449('0x36')]=qs[_0xa449('0x37')](_0x1be67f['query']['sort']);_0x2c2669[_0xa449('0x38')]=qs['filters'](_['pick'](_0x1be67f[_0xa449('0x2e')],_0x5f702b[_0xa449('0x30')]),_0xdb32fa);if(_0x1be67f[_0xa449('0x2e')]['filter']){_0x2c2669[_0xa449('0x38')]=_['merge'](_0x2c2669[_0xa449('0x38')],{'$or':_[_0xa449('0x28')](_0xdb32fa,function(_0x54d1cc){if(_0x54d1cc[_0xa449('0x2b')]!==_0xa449('0x39')){var _0x5de5a2={};_0x5de5a2[_0x54d1cc['name']]={'$like':'%'+_0x1be67f['query'][_0xa449('0x3a')]+'%'};return _0x5de5a2;}})});}_0x2c2669=_[_0xa449('0x3b')]({},_0x2c2669,_0x1be67f[_0xa449('0x3c')]);var _0x2f2593={'where':_0x2c2669[_0xa449('0x38')]};return db['ServicenowConfiguration'][_0xa449('0x1b')](_0x2f2593)[_0xa449('0x21')](function(_0x73f3b7){_0x17dd81['count']=_0x73f3b7;if(_0x1be67f[_0xa449('0x2e')][_0xa449('0x3d')]){_0x2c2669[_0xa449('0x3e')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xa449('0x3f')](_0x2c2669);})['then'](function(_0x2c71cf){_0x17dd81[_0xa449('0x40')]=_0x2c71cf;return _0x17dd81;})['then'](respondWithFilteredResult(_0x394b5c,_0x2c2669))[_0xa449('0x41')](handleError(_0x394b5c,null));};exports[_0xa449('0x42')]=function(_0x20bfd8,_0x10bcb3){var _0x984c15={'raw':![],'where':{'id':_0x20bfd8[_0xa449('0x43')]['id']}},_0x3c221c={};_0x3c221c[_0xa449('0x2d')]=_[_0xa449('0x2f')](db['ServicenowConfiguration']['rawAttributes']);_0x3c221c[_0xa449('0x2e')]=_[_0xa449('0x2f')](_0x20bfd8[_0xa449('0x2e')]);_0x3c221c[_0xa449('0x30')]=_[_0xa449('0x31')](_0x3c221c[_0xa449('0x2d')],_0x3c221c[_0xa449('0x2e')]);_0x984c15['attributes']=_['intersection'](_0x3c221c[_0xa449('0x2d')],qs[_0xa449('0x33')](_0x20bfd8[_0xa449('0x2e')]['fields']));_0x984c15[_0xa449('0x32')]=_0x984c15[_0xa449('0x32')][_0xa449('0x34')]?_0x984c15[_0xa449('0x32')]:_0x3c221c[_0xa449('0x2d')];if(_0x20bfd8[_0xa449('0x2e')][_0xa449('0x3d')]){_0x984c15['include']=[{'all':!![]}];}_0x984c15=_[_0xa449('0x3b')]({},_0x984c15,_0x20bfd8['options']);return db['ServicenowConfiguration'][_0xa449('0x44')](_0x984c15)[_0xa449('0x21')](handleEntityNotFound(_0x10bcb3,null))[_0xa449('0x21')](respondWithResult(_0x10bcb3,null))[_0xa449('0x41')](handleError(_0x10bcb3,null));};exports[_0xa449('0x45')]=function(_0xe53366,_0x52b870){return db[_0xa449('0x29')]['create'](_0xe53366[_0xa449('0x46')],{})[_0xa449('0x21')](respondWithResult(_0x52b870,0xc9))['catch'](handleError(_0x52b870,null));};exports[_0xa449('0x20')]=function(_0x131996,_0x382aea){if(_0x131996[_0xa449('0x46')]['id']){delete _0x131996[_0xa449('0x46')]['id'];}return db[_0xa449('0x29')]['find']({'where':{'id':_0x131996[_0xa449('0x43')]['id']}})[_0xa449('0x21')](handleEntityNotFound(_0x382aea,null))['then'](saveUpdates(_0x131996[_0xa449('0x46')],null))[_0xa449('0x21')](respondWithResult(_0x382aea,null))[_0xa449('0x41')](handleError(_0x382aea,null));};exports[_0xa449('0x22')]=function(_0x1e27ce,_0x4a9abe){return db[_0xa449('0x29')][_0xa449('0x44')]({'where':{'id':_0x1e27ce[_0xa449('0x43')]['id']}})[_0xa449('0x21')](handleEntityNotFound(_0x4a9abe,null))[_0xa449('0x21')](removeEntity(_0x4a9abe,null))['catch'](handleError(_0x4a9abe,null));};exports[_0xa449('0x47')]=function(_0x38d399,_0x33a2a2,_0x2407cd){var _0x260680={};var _0xabf5b1={};var _0x4a6dfc;var _0x2de30d;return db[_0xa449('0x29')][_0xa449('0x48')]({'where':{'id':_0x38d399[_0xa449('0x43')]['id']}})[_0xa449('0x21')](handleEntityNotFound(_0x33a2a2,null))[_0xa449('0x21')](function(_0x54633f){if(_0x54633f){_0x4a6dfc=_0x54633f;_0xabf5b1[_0xa449('0x2d')]=_[_0xa449('0x2f')](db['ServicenowField'][_0xa449('0x2a')]);_0xabf5b1[_0xa449('0x2e')]=_['keys'](_0x38d399[_0xa449('0x2e')]);_0xabf5b1[_0xa449('0x30')]=_[_0xa449('0x31')](_0xabf5b1['model'],_0xabf5b1[_0xa449('0x2e')]);_0x260680[_0xa449('0x32')]=_[_0xa449('0x31')](_0xabf5b1[_0xa449('0x2d')],qs[_0xa449('0x33')](_0x38d399[_0xa449('0x2e')][_0xa449('0x33')]));_0x260680['attributes']=_0x260680['attributes'][_0xa449('0x34')]?_0x260680[_0xa449('0x32')]:_0xabf5b1[_0xa449('0x2d')];_0x260680['order']=qs[_0xa449('0x37')](_0x38d399['query'][_0xa449('0x37')]);_0x260680[_0xa449('0x38')]=qs[_0xa449('0x30')](_[_0xa449('0x49')](_0x38d399['query'],_0xabf5b1[_0xa449('0x30')]));if(_0x38d399[_0xa449('0x2e')][_0xa449('0x3a')]){_0x260680[_0xa449('0x38')]=_['merge'](_0x260680[_0xa449('0x38')],{'$or':_[_0xa449('0x28')](_0x260680[_0xa449('0x32')],function(_0x264263){var _0x2983a0={};_0x2983a0[_0x264263]={'$like':'%'+_0x38d399['query']['filter']+'%'};return _0x2983a0;})});}_0x260680=_['merge']({},_0x260680,_0x38d399[_0xa449('0x3c')]);return _0x4a6dfc[_0xa449('0x47')](_0x260680);}})[_0xa449('0x21')](function(_0x547a37){if(_0x547a37){_0x2de30d=_0x547a37[_0xa449('0x34')];if(!_0x38d399['query'][_0xa449('0x35')]('nolimit')){_0x260680[_0xa449('0x19')]=qs[_0xa449('0x19')](_0x38d399[_0xa449('0x2e')][_0xa449('0x19')]);_0x260680['offset']=qs['offset'](_0x38d399[_0xa449('0x2e')][_0xa449('0x18')]);}return _0x4a6dfc[_0xa449('0x47')](_0x260680);}})[_0xa449('0x21')](function(_0x1f2e94){if(_0x1f2e94){return _0x1f2e94?{'count':_0x2de30d,'rows':_0x1f2e94}:null;}})[_0xa449('0x21')](respondWithResult(_0x33a2a2,null))[_0xa449('0x41')](handleError(_0x33a2a2,null));};exports[_0xa449('0x4a')]=function(_0x308b37,_0x7ea798,_0x3a8bf1){var _0x4ac584={};var _0x3b62ae={};var _0x34c676;var _0x56bae2;return db[_0xa449('0x29')][_0xa449('0x48')]({'where':{'id':_0x308b37['params']['id']}})['then'](handleEntityNotFound(_0x7ea798,null))['then'](function(_0x3d2587){if(_0x3d2587){_0x34c676=_0x3d2587;_0x3b62ae[_0xa449('0x2d')]=_[_0xa449('0x2f')](db[_0xa449('0x4b')][_0xa449('0x2a')]);_0x3b62ae[_0xa449('0x2e')]=_[_0xa449('0x2f')](_0x308b37[_0xa449('0x2e')]);_0x3b62ae[_0xa449('0x30')]=_[_0xa449('0x31')](_0x3b62ae[_0xa449('0x2d')],_0x3b62ae[_0xa449('0x2e')]);_0x4ac584['attributes']=_['intersection'](_0x3b62ae['model'],qs['fields'](_0x308b37['query'][_0xa449('0x33')]));_0x4ac584[_0xa449('0x32')]=_0x4ac584[_0xa449('0x32')][_0xa449('0x34')]?_0x4ac584[_0xa449('0x32')]:_0x3b62ae[_0xa449('0x2d')];_0x4ac584[_0xa449('0x36')]=qs['sort'](_0x308b37[_0xa449('0x2e')][_0xa449('0x37')]);_0x4ac584[_0xa449('0x38')]=qs['filters'](_['pick'](_0x308b37['query'],_0x3b62ae[_0xa449('0x30')]));if(_0x308b37['query'][_0xa449('0x3a')]){_0x4ac584[_0xa449('0x38')]=_[_0xa449('0x3b')](_0x4ac584['where'],{'$or':_[_0xa449('0x28')](_0x4ac584[_0xa449('0x32')],function(_0x2dff37){var _0x53f930={};_0x53f930[_0x2dff37]={'$like':'%'+_0x308b37[_0xa449('0x2e')][_0xa449('0x3a')]+'%'};return _0x53f930;})});}_0x4ac584=_[_0xa449('0x3b')]({},_0x4ac584,_0x308b37[_0xa449('0x3c')]);return _0x34c676[_0xa449('0x4a')](_0x4ac584);}})[_0xa449('0x21')](function(_0x2317b5){if(_0x2317b5){_0x56bae2=_0x2317b5[_0xa449('0x34')];if(!_0x308b37[_0xa449('0x2e')][_0xa449('0x35')](_0xa449('0x4c'))){_0x4ac584[_0xa449('0x19')]=qs[_0xa449('0x19')](_0x308b37[_0xa449('0x2e')][_0xa449('0x19')]);_0x4ac584[_0xa449('0x18')]=qs['offset'](_0x308b37[_0xa449('0x2e')]['offset']);}return _0x34c676[_0xa449('0x4a')](_0x4ac584);}})[_0xa449('0x21')](function(_0x56da41){if(_0x56da41){return _0x56da41?{'count':_0x56bae2,'rows':_0x56da41}:null;}})[_0xa449('0x21')](respondWithResult(_0x7ea798,null))[_0xa449('0x41')](handleError(_0x7ea798,null));};exports[_0xa449('0x4d')]=function(_0x103472,_0x568ad1,_0x25dcfa){var _0x40d942={};var _0x23b43b={};var _0x65186a;var _0x151919;return db[_0xa449('0x29')][_0xa449('0x48')]({'where':{'id':_0x103472[_0xa449('0x43')]['id']}})['then'](handleEntityNotFound(_0x568ad1,null))['then'](function(_0x25e41f){if(_0x25e41f){_0x65186a=_0x25e41f;_0x23b43b[_0xa449('0x2d')]=_[_0xa449('0x2f')](db[_0xa449('0x4b')][_0xa449('0x2a')]);_0x23b43b[_0xa449('0x2e')]=_['keys'](_0x103472[_0xa449('0x2e')]);_0x23b43b['filters']=_[_0xa449('0x31')](_0x23b43b[_0xa449('0x2d')],_0x23b43b[_0xa449('0x2e')]);_0x40d942[_0xa449('0x32')]=_['intersection'](_0x23b43b['model'],qs[_0xa449('0x33')](_0x103472['query'][_0xa449('0x33')]));_0x40d942['attributes']=_0x40d942[_0xa449('0x32')]['length']?_0x40d942['attributes']:_0x23b43b[_0xa449('0x2d')];_0x40d942[_0xa449('0x36')]=qs[_0xa449('0x37')](_0x103472[_0xa449('0x2e')]['sort']);_0x40d942['where']=qs[_0xa449('0x30')](_[_0xa449('0x49')](_0x103472[_0xa449('0x2e')],_0x23b43b['filters']));if(_0x103472[_0xa449('0x2e')][_0xa449('0x3a')]){_0x40d942[_0xa449('0x38')]=_[_0xa449('0x3b')](_0x40d942['where'],{'$or':_['map'](_0x40d942[_0xa449('0x32')],function(_0x4095b3){var _0x375ea4={};_0x375ea4[_0x4095b3]={'$like':'%'+_0x103472[_0xa449('0x2e')][_0xa449('0x3a')]+'%'};return _0x375ea4;})});}_0x40d942=_[_0xa449('0x3b')]({},_0x40d942,_0x103472[_0xa449('0x3c')]);return _0x65186a[_0xa449('0x4d')](_0x40d942);}})[_0xa449('0x21')](function(_0x736fcb){if(_0x736fcb){_0x151919=_0x736fcb[_0xa449('0x34')];if(!_0x103472[_0xa449('0x2e')][_0xa449('0x35')](_0xa449('0x4c'))){_0x40d942[_0xa449('0x19')]=qs[_0xa449('0x19')](_0x103472[_0xa449('0x2e')][_0xa449('0x19')]);_0x40d942[_0xa449('0x18')]=qs[_0xa449('0x18')](_0x103472[_0xa449('0x2e')][_0xa449('0x18')]);}return _0x65186a[_0xa449('0x4d')](_0x40d942);}})[_0xa449('0x21')](function(_0x658e39){if(_0x658e39){return _0x658e39?{'count':_0x151919,'rows':_0x658e39}:null;}})[_0xa449('0x21')](respondWithResult(_0x568ad1,null))[_0xa449('0x41')](handleError(_0x568ad1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 48f89cb..718e69e 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 _0x70e3=['./intServicenowConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x16f775,_0x45b10f){var _0x17d9e2=function(_0x3d2ccf){while(--_0x3d2ccf){_0x16f775['push'](_0x16f775['shift']());}};_0x17d9e2(++_0x45b10f);}(_0x70e3,0x9d));var _0x370e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x70e3[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x370e('0x0'));var util=require(_0x370e('0x1'));var logger=require(_0x370e('0x2'))(_0x370e('0x3'));var moment=require('moment');var BPromise=require(_0x370e('0x4'));var rp=require(_0x370e('0x5'));var fs=require('fs');var path=require(_0x370e('0x6'));var rimraf=require('rimraf');var config=require(_0x370e('0x7'));var attributes=require(_0x370e('0x8'));module[_0x370e('0x9')]=function(_0x2b99d1,_0x47c815){return _0x2b99d1[_0x370e('0xa')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ffd=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','define'];(function(_0x2b8810,_0x55efdb){var _0x4c0f41=function(_0x3104cd){while(--_0x3104cd){_0x2b8810['push'](_0x2b8810['shift']());}};_0x4c0f41(++_0x55efdb);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x303766,_0x5bd8b5){_0x303766=_0x303766-0x0;var _0x28bedf=_0x9ffd[_0x303766];return _0x28bedf;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'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 3ddc9b3..6317e71 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 _0x8e50=['rpc','../../config/environment','jayson/promise','client','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x8e50,0x1ae));var _0x08e5=function(_0x104aea,_0x541bf1){_0x104aea=_0x104aea-0x0;var _0x472ade=_0x8e50[_0x104aea];return _0x472ade;};'use strict';var _=require('lodash');var util=require(_0x08e5('0x0'));var moment=require(_0x08e5('0x1'));var BPromise=require(_0x08e5('0x2'));var rs=require(_0x08e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08e5('0x4'))['db'];var utils=require(_0x08e5('0x5'));var logger=require(_0x08e5('0x6'))(_0x08e5('0x7'));var config=require(_0x08e5('0x8'));var jayson=require(_0x08e5('0x9'));var client=jayson[_0x08e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x541192,_0x38994f,_0x702103){return new BPromise(function(_0x4c9258,_0x17fc3e){return client[_0x08e5('0xb')](_0x541192,_0x702103)['then'](function(_0x2e1c15){logger[_0x08e5('0xc')](_0x08e5('0xd'),_0x38994f,_0x08e5('0xe'));logger[_0x08e5('0xf')](_0x08e5('0x10'),_0x38994f,_0x08e5('0xe'),JSON[_0x08e5('0x11')](_0x2e1c15));if(_0x2e1c15[_0x08e5('0x12')]){if(_0x2e1c15[_0x08e5('0x12')][_0x08e5('0x13')]===0x1f4){logger[_0x08e5('0x12')](_0x08e5('0xd'),_0x38994f,_0x2e1c15['error'][_0x08e5('0x14')]);return _0x17fc3e(_0x2e1c15[_0x08e5('0x12')]['message']);}logger[_0x08e5('0x12')](_0x08e5('0xd'),_0x38994f,_0x2e1c15[_0x08e5('0x12')][_0x08e5('0x14')]);return _0x4c9258(_0x2e1c15[_0x08e5('0x12')]['message']);}else{logger['info'](_0x08e5('0xd'),_0x38994f,_0x08e5('0xe'));_0x4c9258(_0x2e1c15[_0x08e5('0x15')][_0x08e5('0x14')]);}})[_0x08e5('0x16')](function(_0x1302d8){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x38994f,_0x1302d8);_0x17fc3e(_0x1302d8);});});} \ No newline at end of file +var _0xd114=['jayson/promise','client','request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0xd114,0x157));var _0x4d11=function(_0x36c271,_0x3d3a3a){_0x36c271=_0x36c271-0x0;var _0xf42e19=_0xd114[_0x36c271];return _0xf42e19;};'use strict';var _=require(_0x4d11('0x0'));var util=require(_0x4d11('0x1'));var moment=require(_0x4d11('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d11('0x3'));var db=require(_0x4d11('0x4'))['db'];var utils=require(_0x4d11('0x5'));var logger=require(_0x4d11('0x6'))(_0x4d11('0x7'));var config=require(_0x4d11('0x8'));var jayson=require(_0x4d11('0x9'));var client=jayson[_0x4d11('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d50b2,_0x2775bc,_0xd4f991){return new BPromise(function(_0x44be54,_0x539720){return client[_0x4d11('0xb')](_0x5d50b2,_0xd4f991)[_0x4d11('0xc')](function(_0x3009f6){logger[_0x4d11('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2775bc,'request\x20sent');logger[_0x4d11('0xe')](_0x4d11('0xf'),_0x2775bc,_0x4d11('0x10'),JSON['stringify'](_0x3009f6));if(_0x3009f6['error']){if(_0x3009f6[_0x4d11('0x11')][_0x4d11('0x12')]===0x1f4){logger[_0x4d11('0x11')](_0x4d11('0x13'),_0x2775bc,_0x3009f6['error'][_0x4d11('0x14')]);return _0x539720(_0x3009f6['error'][_0x4d11('0x14')]);}logger[_0x4d11('0x11')](_0x4d11('0x13'),_0x2775bc,_0x3009f6[_0x4d11('0x11')][_0x4d11('0x14')]);return _0x44be54(_0x3009f6[_0x4d11('0x11')]['message']);}else{logger['info'](_0x4d11('0x13'),_0x2775bc,_0x4d11('0x10'));_0x44be54(_0x3009f6['result']['message']);}})[_0x4d11('0x15')](function(_0x4b88c2){logger[_0x4d11('0x11')](_0x4d11('0x13'),_0x2775bc,_0x4b88c2);_0x539720(_0x4b88c2);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b17fb75..b876a5d 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 _0xe6cb=['delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x2c1a6f,_0x147410){var _0x266ce4=function(_0x4491cb){while(--_0x4491cb){_0x2c1a6f['push'](_0x2c1a6f['shift']());}};_0x266ce4(++_0x147410);}(_0xe6cb,0xad));var _0xbe6c=function(_0x5af25e,_0x1afd15){_0x5af25e=_0x5af25e-0x0;var _0x4e29b1=_0xe6cb[_0x5af25e];return _0x4e29b1;};'use strict';var multer=require(_0xbe6c('0x0'));var util=require(_0xbe6c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe6c('0x2'));var router=express[_0xbe6c('0x3')]();var fs_extra=require(_0xbe6c('0x4'));var auth=require(_0xbe6c('0x5'));var interaction=require(_0xbe6c('0x6'));var config=require(_0xbe6c('0x7'));var controller=require(_0xbe6c('0x8'));router[_0xbe6c('0x9')]('/',auth[_0xbe6c('0xa')](),controller[_0xbe6c('0xb')]);router['get'](_0xbe6c('0xc'),auth['isAuthenticated'](),controller[_0xbe6c('0xd')]);router[_0xbe6c('0xe')]('/',auth[_0xbe6c('0xa')](),controller['create']);router[_0xbe6c('0xf')](_0xbe6c('0xc'),auth[_0xbe6c('0xa')](),controller[_0xbe6c('0x10')]);router[_0xbe6c('0x11')](_0xbe6c('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe6c('0x12')]=router; \ No newline at end of file +var _0x9601=['../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x213162,_0x5c85fd){var _0xa66f17=function(_0x48b4a3){while(--_0x48b4a3){_0x213162['push'](_0x213162['shift']());}};_0xa66f17(++_0x5c85fd);}(_0x9601,0x91));var _0x1960=function(_0x21bb28,_0x28330c){_0x21bb28=_0x21bb28-0x0;var _0x369804=_0x9601[_0x21bb28];return _0x369804;};'use strict';var multer=require(_0x1960('0x0'));var util=require(_0x1960('0x1'));var path=require(_0x1960('0x2'));var timeout=require(_0x1960('0x3'));var express=require(_0x1960('0x4'));var router=express[_0x1960('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1960('0x6'));var interaction=require(_0x1960('0x7'));var config=require(_0x1960('0x8'));var controller=require('./intServicenowField.controller');router[_0x1960('0x9')]('/',auth[_0x1960('0xa')](),controller['index']);router[_0x1960('0x9')](_0x1960('0xb'),auth[_0x1960('0xa')](),controller[_0x1960('0xc')]);router['post']('/',auth[_0x1960('0xa')](),controller[_0x1960('0xd')]);router[_0x1960('0xe')](_0x1960('0xb'),auth['isAuthenticated'](),controller[_0x1960('0xf')]);router[_0x1960('0x10')]('/:id',auth[_0x1960('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index d75c74d..59c8a70 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 _0x3029=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x56c620,_0x14e7da){var _0x33b8cc=function(_0x12d9b6){while(--_0x12d9b6){_0x56c620['push'](_0x56c620['shift']());}};_0x33b8cc(++_0x14e7da);}(_0x3029,0x190));var _0x9302=function(_0x554b96,_0xa7f28){_0x554b96=_0x554b96-0x0;var _0xe445a8=_0x3029[_0x554b96];return _0xe445a8;};'use strict';var Sequelize=require('sequelize');module[_0x9302('0x0')]={'type':{'type':Sequelize[_0x9302('0x1')](_0x9302('0x2'),_0x9302('0x3'),_0x9302('0x4'),_0x9302('0x5'),'picklist'),'defaultValue':_0x9302('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9302('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x9302('0x3'),_0x9302('0x4'))},'keyContent':{'type':Sequelize[_0x9302('0x6')]},'idField':{'type':Sequelize[_0x9302('0x6')]},'nameField':{'type':Sequelize[_0x9302('0x6')]},'customField':{'type':Sequelize[_0x9302('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9302('0x6')]}}; \ No newline at end of file +var _0xefe9=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x96e2de,_0x2e9230){var _0x3345b6=function(_0x32e462){while(--_0x32e462){_0x96e2de['push'](_0x96e2de['shift']());}};_0x3345b6(++_0x2e9230);}(_0xefe9,0x123));var _0x9efe=function(_0x56922f,_0x2a69ef){_0x56922f=_0x56922f-0x0;var _0x1afa72=_0xefe9[_0x56922f];return _0x1afa72;};'use strict';var Sequelize=require('sequelize');module[_0x9efe('0x0')]={'type':{'type':Sequelize[_0x9efe('0x1')](_0x9efe('0x2'),_0x9efe('0x3'),_0x9efe('0x4'),_0x9efe('0x5'),_0x9efe('0x6')),'defaultValue':_0x9efe('0x2')},'content':{'type':Sequelize[_0x9efe('0x7')]},'key':{'type':Sequelize[_0x9efe('0x7')]},'keyType':{'type':Sequelize[_0x9efe('0x1')](_0x9efe('0x2'),_0x9efe('0x3'),_0x9efe('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9efe('0x7')]},'customField':{'type':Sequelize[_0x9efe('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 62b750a..3769192 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 _0xb4df=['util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','ServicenowField','count','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x1a1346,_0x492657){var _0x1ce2c9=function(_0x465c83){while(--_0x465c83){_0x1a1346['push'](_0x1a1346['shift']());}};_0x1ce2c9(++_0x492657);}(_0xb4df,0x8a));var _0xfb4d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb4df[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0xfb4d('0x0'));var rimraf=require(_0xfb4d('0x1'));var zipdir=require(_0xfb4d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb4d('0x3'));var moment=require('moment');var BPromise=require(_0xfb4d('0x4'));var Mustache=require(_0xfb4d('0x5'));var util=require(_0xfb4d('0x6'));var path=require(_0xfb4d('0x7'));var sox=require(_0xfb4d('0x8'));var csv=require(_0xfb4d('0x9'));var ejs=require(_0xfb4d('0xa'));var fs=require('fs');var fs_extra=require(_0xfb4d('0xb'));var _=require('lodash');var squel=require(_0xfb4d('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb4d('0xd'));var deskjs=require(_0xfb4d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfb4d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb4d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfb4d('0x11'));var hardwareService=require(_0xfb4d('0x12'));var logger=require(_0xfb4d('0x13'))(_0xfb4d('0x14'));var utils=require('../../config/utils');var config=require(_0xfb4d('0x15'));var licenseUtil=require(_0xfb4d('0x16'));var db=require(_0xfb4d('0x17'))['db'];function respondWithStatusCode(_0x2fa3d8,_0x2c405e){_0x2c405e=_0x2c405e||0xcc;return function(_0x401780){if(_0x401780){return _0x2fa3d8['sendStatus'](_0x2c405e);}return _0x2fa3d8[_0xfb4d('0x18')](_0x2c405e)[_0xfb4d('0x19')]();};}function respondWithResult(_0x4441bb,_0x381e8b){_0x381e8b=_0x381e8b||0xc8;return function(_0x540c8e){if(_0x540c8e){return _0x4441bb['status'](_0x381e8b)[_0xfb4d('0x1a')](_0x540c8e);}};}function respondWithFilteredResult(_0x426bec,_0x24b0e3){return function(_0x20a478){if(_0x20a478){var _0x2fdfd1=typeof _0x24b0e3[_0xfb4d('0x1b')]===_0xfb4d('0x1c')&&typeof _0x24b0e3[_0xfb4d('0x1d')]===_0xfb4d('0x1c');var _0x301d03=_0x20a478['count'];var _0x58163b=_0x2fdfd1?0x0:_0x24b0e3[_0xfb4d('0x1b')];var _0x2ddd06=_0x2fdfd1?_0x20a478['count']:_0x24b0e3[_0xfb4d('0x1b')]+_0x24b0e3[_0xfb4d('0x1d')];var _0x400d63;if(_0x2ddd06>=_0x301d03){_0x2ddd06=_0x301d03;_0x400d63=0xc8;}else{_0x400d63=0xce;}_0x426bec[_0xfb4d('0x18')](_0x400d63);return _0x426bec[_0xfb4d('0x1e')](_0xfb4d('0x1f'),_0x58163b+'-'+_0x2ddd06+'/'+_0x301d03)[_0xfb4d('0x1a')](_0x20a478);}return null;};}function patchUpdates(_0x7a637d){return function(_0x413b27){try{jsonpatch['apply'](_0x413b27,_0x7a637d,!![]);}catch(_0x3b8cf2){return BPromise[_0xfb4d('0x20')](_0x3b8cf2);}return _0x413b27[_0xfb4d('0x21')]();};}function saveUpdates(_0x190db1,_0x1a5aed){return function(_0x263c84){if(_0x263c84){return _0x263c84[_0xfb4d('0x22')](_0x190db1)[_0xfb4d('0x23')](function(_0x1b3acd){return _0x1b3acd;});}return null;};}function removeEntity(_0x494129,_0xbff434){return function(_0x434093){if(_0x434093){return _0x434093[_0xfb4d('0x24')]()[_0xfb4d('0x23')](function(){_0x494129[_0xfb4d('0x18')](0xcc)[_0xfb4d('0x19')]();});}};}function handleEntityNotFound(_0x18b98d,_0x5d7269){return function(_0x1fb9ec){if(!_0x1fb9ec){_0x18b98d[_0xfb4d('0x25')](0x194);}return _0x1fb9ec;};}function handleError(_0x499067,_0x4dfb64){_0x4dfb64=_0x4dfb64||0x1f4;return function(_0x370a8a){logger[_0xfb4d('0x26')](_0x370a8a[_0xfb4d('0x27')]);if(_0x370a8a[_0xfb4d('0x28')]){delete _0x370a8a[_0xfb4d('0x28')];}_0x499067['status'](_0x4dfb64)['send'](_0x370a8a);};}exports[_0xfb4d('0x29')]=function(_0x5c0d8e,_0x2f5b40){var _0x264e5e={},_0x1bdff0={},_0x264ddf={'count':0x0,'rows':[]};var _0x4e2115=_[_0xfb4d('0x2a')](db['ServicenowField'][_0xfb4d('0x2b')],function(_0xb1c66a){return{'name':_0xb1c66a['fieldName'],'type':_0xb1c66a[_0xfb4d('0x2c')]['key']};});_0x1bdff0[_0xfb4d('0x2d')]=_[_0xfb4d('0x2a')](_0x4e2115,_0xfb4d('0x28'));_0x1bdff0['query']=_[_0xfb4d('0x2e')](_0x5c0d8e[_0xfb4d('0x2f')]);_0x1bdff0[_0xfb4d('0x30')]=_[_0xfb4d('0x31')](_0x1bdff0[_0xfb4d('0x2d')],_0x1bdff0[_0xfb4d('0x2f')]);_0x264e5e[_0xfb4d('0x32')]=_[_0xfb4d('0x31')](_0x1bdff0[_0xfb4d('0x2d')],qs[_0xfb4d('0x33')](_0x5c0d8e['query'][_0xfb4d('0x33')]));_0x264e5e[_0xfb4d('0x32')]=_0x264e5e[_0xfb4d('0x32')]['length']?_0x264e5e[_0xfb4d('0x32')]:_0x1bdff0[_0xfb4d('0x2d')];if(!_0x5c0d8e[_0xfb4d('0x2f')][_0xfb4d('0x34')]('nolimit')){_0x264e5e[_0xfb4d('0x1d')]=qs['limit'](_0x5c0d8e[_0xfb4d('0x2f')][_0xfb4d('0x1d')]);_0x264e5e[_0xfb4d('0x1b')]=qs[_0xfb4d('0x1b')](_0x5c0d8e[_0xfb4d('0x2f')]['offset']);}_0x264e5e[_0xfb4d('0x35')]=qs[_0xfb4d('0x36')](_0x5c0d8e['query'][_0xfb4d('0x36')]);_0x264e5e['where']=qs[_0xfb4d('0x30')](_[_0xfb4d('0x37')](_0x5c0d8e[_0xfb4d('0x2f')],_0x1bdff0[_0xfb4d('0x30')]),_0x4e2115);if(_0x5c0d8e[_0xfb4d('0x2f')]['filter']){_0x264e5e[_0xfb4d('0x38')]=_[_0xfb4d('0x39')](_0x264e5e[_0xfb4d('0x38')],{'$or':_[_0xfb4d('0x2a')](_0x4e2115,function(_0x46c0b2){if(_0x46c0b2[_0xfb4d('0x2c')]!==_0xfb4d('0x3a')){var _0x9feacc={};_0x9feacc[_0x46c0b2[_0xfb4d('0x28')]]={'$like':'%'+_0x5c0d8e['query'][_0xfb4d('0x3b')]+'%'};return _0x9feacc;}})});}_0x264e5e=_[_0xfb4d('0x39')]({},_0x264e5e,_0x5c0d8e[_0xfb4d('0x3c')]);var _0x200d77={'where':_0x264e5e['where']};return db[_0xfb4d('0x3d')][_0xfb4d('0x3e')](_0x200d77)[_0xfb4d('0x23')](function(_0x58792e){_0x264ddf[_0xfb4d('0x3e')]=_0x58792e;if(_0x5c0d8e['query'][_0xfb4d('0x3f')]){_0x264e5e[_0xfb4d('0x40')]=[{'all':!![]}];}return db[_0xfb4d('0x3d')][_0xfb4d('0x41')](_0x264e5e);})['then'](function(_0x4b8f07){_0x264ddf[_0xfb4d('0x42')]=_0x4b8f07;return _0x264ddf;})[_0xfb4d('0x23')](respondWithFilteredResult(_0x2f5b40,_0x264e5e))[_0xfb4d('0x43')](handleError(_0x2f5b40,null));};exports['show']=function(_0x1b8219,_0xdef8ac){var _0x547085={'raw':!![],'where':{'id':_0x1b8219[_0xfb4d('0x44')]['id']}},_0x899ff={};_0x899ff[_0xfb4d('0x2d')]=_[_0xfb4d('0x2e')](db[_0xfb4d('0x3d')][_0xfb4d('0x2b')]);_0x899ff['query']=_[_0xfb4d('0x2e')](_0x1b8219[_0xfb4d('0x2f')]);_0x899ff['filters']=_[_0xfb4d('0x31')](_0x899ff['model'],_0x899ff[_0xfb4d('0x2f')]);_0x547085[_0xfb4d('0x32')]=_[_0xfb4d('0x31')](_0x899ff['model'],qs['fields'](_0x1b8219[_0xfb4d('0x2f')][_0xfb4d('0x33')]));_0x547085[_0xfb4d('0x32')]=_0x547085['attributes']['length']?_0x547085[_0xfb4d('0x32')]:_0x899ff[_0xfb4d('0x2d')];if(_0x1b8219[_0xfb4d('0x2f')]['includeAll']){_0x547085['include']=[{'all':!![]}];}_0x547085=_[_0xfb4d('0x39')]({},_0x547085,_0x1b8219['options']);return db[_0xfb4d('0x3d')][_0xfb4d('0x45')](_0x547085)[_0xfb4d('0x23')](handleEntityNotFound(_0xdef8ac,null))['then'](respondWithResult(_0xdef8ac,null))[_0xfb4d('0x43')](handleError(_0xdef8ac,null));};exports[_0xfb4d('0x46')]=function(_0x53725a,_0x596f8e){return db[_0xfb4d('0x3d')][_0xfb4d('0x46')](_0x53725a[_0xfb4d('0x47')],{})[_0xfb4d('0x23')](respondWithResult(_0x596f8e,0xc9))[_0xfb4d('0x43')](handleError(_0x596f8e,null));};exports[_0xfb4d('0x22')]=function(_0x5ac9ca,_0x235a3a){if(_0x5ac9ca[_0xfb4d('0x47')]['id']){delete _0x5ac9ca[_0xfb4d('0x47')]['id'];}return db[_0xfb4d('0x3d')][_0xfb4d('0x45')]({'where':{'id':_0x5ac9ca['params']['id']}})['then'](handleEntityNotFound(_0x235a3a,null))[_0xfb4d('0x23')](saveUpdates(_0x5ac9ca[_0xfb4d('0x47')],null))['then'](respondWithResult(_0x235a3a,null))[_0xfb4d('0x43')](handleError(_0x235a3a,null));};exports[_0xfb4d('0x24')]=function(_0x28c019,_0x577df2){return db[_0xfb4d('0x3d')][_0xfb4d('0x45')]({'where':{'id':_0x28c019[_0xfb4d('0x44')]['id']}})[_0xfb4d('0x23')](handleEntityNotFound(_0x577df2,null))[_0xfb4d('0x23')](removeEntity(_0x577df2,null))['catch'](handleError(_0x577df2,null));}; \ No newline at end of file +var _0x4ed4=['where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','keys','find','create','body','params','destroy','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','ServicenowField','fieldName','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x4ed4,0xab));var _0x44ed=function(_0x233c20,_0x39082d){_0x233c20=_0x233c20-0x0;var _0x296971=_0x4ed4[_0x233c20];return _0x296971;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x44ed('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44ed('0x1'));var rp=require('request-promise');var moment=require(_0x44ed('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x44ed('0x3'));var util=require(_0x44ed('0x4'));var path=require(_0x44ed('0x5'));var sox=require(_0x44ed('0x6'));var csv=require(_0x44ed('0x7'));var ejs=require(_0x44ed('0x8'));var fs=require('fs');var fs_extra=require(_0x44ed('0x9'));var _=require(_0x44ed('0xa'));var squel=require(_0x44ed('0xb'));var crypto=require('crypto');var jsforce=require(_0x44ed('0xc'));var deskjs=require(_0x44ed('0xd'));var toCsv=require(_0x44ed('0x7'));var querystring=require('querystring');var Papa=require(_0x44ed('0xe'));var Redis=require(_0x44ed('0xf'));var authService=require(_0x44ed('0x10'));var qs=require(_0x44ed('0x11'));var as=require(_0x44ed('0x12'));var hardwareService=require(_0x44ed('0x13'));var logger=require(_0x44ed('0x14'))(_0x44ed('0x15'));var utils=require(_0x44ed('0x16'));var config=require(_0x44ed('0x17'));var licenseUtil=require(_0x44ed('0x18'));var db=require(_0x44ed('0x19'))['db'];function respondWithStatusCode(_0x5c3a76,_0x5dedac){_0x5dedac=_0x5dedac||0xcc;return function(_0x35cb38){if(_0x35cb38){return _0x5c3a76[_0x44ed('0x1a')](_0x5dedac);}return _0x5c3a76['status'](_0x5dedac)[_0x44ed('0x1b')]();};}function respondWithResult(_0x282104,_0x516309){_0x516309=_0x516309||0xc8;return function(_0x39a308){if(_0x39a308){return _0x282104[_0x44ed('0x1c')](_0x516309)[_0x44ed('0x1d')](_0x39a308);}};}function respondWithFilteredResult(_0x57c042,_0x2c4b2a){return function(_0x482c4f){if(_0x482c4f){var _0x4eabd0=typeof _0x2c4b2a[_0x44ed('0x1e')]===_0x44ed('0x1f')&&typeof _0x2c4b2a[_0x44ed('0x20')]===_0x44ed('0x1f');var _0xcc8f9b=_0x482c4f[_0x44ed('0x21')];var _0xe39696=_0x4eabd0?0x0:_0x2c4b2a[_0x44ed('0x1e')];var _0x22d38e=_0x4eabd0?_0x482c4f[_0x44ed('0x21')]:_0x2c4b2a[_0x44ed('0x1e')]+_0x2c4b2a[_0x44ed('0x20')];var _0x576322;if(_0x22d38e>=_0xcc8f9b){_0x22d38e=_0xcc8f9b;_0x576322=0xc8;}else{_0x576322=0xce;}_0x57c042[_0x44ed('0x1c')](_0x576322);return _0x57c042[_0x44ed('0x22')](_0x44ed('0x23'),_0xe39696+'-'+_0x22d38e+'/'+_0xcc8f9b)[_0x44ed('0x1d')](_0x482c4f);}return null;};}function patchUpdates(_0x45bdd8){return function(_0x325ada){try{jsonpatch[_0x44ed('0x24')](_0x325ada,_0x45bdd8,!![]);}catch(_0x1c9a96){return BPromise[_0x44ed('0x25')](_0x1c9a96);}return _0x325ada[_0x44ed('0x26')]();};}function saveUpdates(_0x2794e0,_0x880741){return function(_0x5d5752){if(_0x5d5752){return _0x5d5752[_0x44ed('0x27')](_0x2794e0)[_0x44ed('0x28')](function(_0x388b71){return _0x388b71;});}return null;};}function removeEntity(_0x46daa2,_0x49ef53){return function(_0x56f4b5){if(_0x56f4b5){return _0x56f4b5['destroy']()[_0x44ed('0x28')](function(){_0x46daa2[_0x44ed('0x1c')](0xcc)[_0x44ed('0x1b')]();});}};}function handleEntityNotFound(_0x5591a1,_0x41dd17){return function(_0x1c91f0){if(!_0x1c91f0){_0x5591a1[_0x44ed('0x1a')](0x194);}return _0x1c91f0;};}function handleError(_0xa38cd1,_0x3a408d){_0x3a408d=_0x3a408d||0x1f4;return function(_0x38d8a2){logger['error'](_0x38d8a2['stack']);if(_0x38d8a2['name']){delete _0x38d8a2[_0x44ed('0x29')];}_0xa38cd1['status'](_0x3a408d)[_0x44ed('0x2a')](_0x38d8a2);};}exports['index']=function(_0x5cc51d,_0x1002f4){var _0x2b638f={},_0x14cc64={},_0x4ce739={'count':0x0,'rows':[]};var _0x526f86=_['map'](db[_0x44ed('0x2b')]['rawAttributes'],function(_0x5df2cb){return{'name':_0x5df2cb[_0x44ed('0x2c')],'type':_0x5df2cb[_0x44ed('0x2d')][_0x44ed('0x2e')]};});_0x14cc64[_0x44ed('0x2f')]=_[_0x44ed('0x30')](_0x526f86,_0x44ed('0x29'));_0x14cc64[_0x44ed('0x31')]=_['keys'](_0x5cc51d[_0x44ed('0x31')]);_0x14cc64['filters']=_[_0x44ed('0x32')](_0x14cc64[_0x44ed('0x2f')],_0x14cc64['query']);_0x2b638f[_0x44ed('0x33')]=_[_0x44ed('0x32')](_0x14cc64[_0x44ed('0x2f')],qs[_0x44ed('0x34')](_0x5cc51d[_0x44ed('0x31')][_0x44ed('0x34')]));_0x2b638f[_0x44ed('0x33')]=_0x2b638f[_0x44ed('0x33')][_0x44ed('0x35')]?_0x2b638f['attributes']:_0x14cc64[_0x44ed('0x2f')];if(!_0x5cc51d[_0x44ed('0x31')]['hasOwnProperty'](_0x44ed('0x36'))){_0x2b638f[_0x44ed('0x20')]=qs[_0x44ed('0x20')](_0x5cc51d[_0x44ed('0x31')][_0x44ed('0x20')]);_0x2b638f[_0x44ed('0x1e')]=qs[_0x44ed('0x1e')](_0x5cc51d[_0x44ed('0x31')][_0x44ed('0x1e')]);}_0x2b638f[_0x44ed('0x37')]=qs[_0x44ed('0x38')](_0x5cc51d[_0x44ed('0x31')][_0x44ed('0x38')]);_0x2b638f[_0x44ed('0x39')]=qs['filters'](_[_0x44ed('0x3a')](_0x5cc51d[_0x44ed('0x31')],_0x14cc64[_0x44ed('0x3b')]),_0x526f86);if(_0x5cc51d['query'][_0x44ed('0x3c')]){_0x2b638f[_0x44ed('0x39')]=_[_0x44ed('0x3d')](_0x2b638f['where'],{'$or':_[_0x44ed('0x30')](_0x526f86,function(_0xf55a3a){if(_0xf55a3a[_0x44ed('0x2d')]!==_0x44ed('0x3e')){var _0x4661d6={};_0x4661d6[_0xf55a3a[_0x44ed('0x29')]]={'$like':'%'+_0x5cc51d[_0x44ed('0x31')][_0x44ed('0x3c')]+'%'};return _0x4661d6;}})});}_0x2b638f=_[_0x44ed('0x3d')]({},_0x2b638f,_0x5cc51d[_0x44ed('0x3f')]);var _0x3b590c={'where':_0x2b638f[_0x44ed('0x39')]};return db[_0x44ed('0x2b')]['count'](_0x3b590c)[_0x44ed('0x28')](function(_0x2b7334){_0x4ce739[_0x44ed('0x21')]=_0x2b7334;if(_0x5cc51d['query'][_0x44ed('0x40')]){_0x2b638f[_0x44ed('0x41')]=[{'all':!![]}];}return db[_0x44ed('0x2b')]['findAll'](_0x2b638f);})[_0x44ed('0x28')](function(_0x16ea1d){_0x4ce739[_0x44ed('0x42')]=_0x16ea1d;return _0x4ce739;})[_0x44ed('0x28')](respondWithFilteredResult(_0x1002f4,_0x2b638f))[_0x44ed('0x43')](handleError(_0x1002f4,null));};exports[_0x44ed('0x44')]=function(_0x197600,_0x479ea4){var _0x5025c1={'raw':!![],'where':{'id':_0x197600['params']['id']}},_0x4ef7d7={};_0x4ef7d7[_0x44ed('0x2f')]=_['keys'](db['ServicenowField'][_0x44ed('0x45')]);_0x4ef7d7[_0x44ed('0x31')]=_[_0x44ed('0x46')](_0x197600['query']);_0x4ef7d7[_0x44ed('0x3b')]=_[_0x44ed('0x32')](_0x4ef7d7[_0x44ed('0x2f')],_0x4ef7d7[_0x44ed('0x31')]);_0x5025c1[_0x44ed('0x33')]=_[_0x44ed('0x32')](_0x4ef7d7[_0x44ed('0x2f')],qs[_0x44ed('0x34')](_0x197600[_0x44ed('0x31')]['fields']));_0x5025c1['attributes']=_0x5025c1[_0x44ed('0x33')][_0x44ed('0x35')]?_0x5025c1[_0x44ed('0x33')]:_0x4ef7d7[_0x44ed('0x2f')];if(_0x197600['query'][_0x44ed('0x40')]){_0x5025c1[_0x44ed('0x41')]=[{'all':!![]}];}_0x5025c1=_[_0x44ed('0x3d')]({},_0x5025c1,_0x197600['options']);return db[_0x44ed('0x2b')][_0x44ed('0x47')](_0x5025c1)[_0x44ed('0x28')](handleEntityNotFound(_0x479ea4,null))[_0x44ed('0x28')](respondWithResult(_0x479ea4,null))[_0x44ed('0x43')](handleError(_0x479ea4,null));};exports[_0x44ed('0x48')]=function(_0x532d3a,_0x5b119d){return db[_0x44ed('0x2b')][_0x44ed('0x48')](_0x532d3a[_0x44ed('0x49')],{})[_0x44ed('0x28')](respondWithResult(_0x5b119d,0xc9))['catch'](handleError(_0x5b119d,null));};exports[_0x44ed('0x27')]=function(_0xa5ba9d,_0x19e5f0){if(_0xa5ba9d[_0x44ed('0x49')]['id']){delete _0xa5ba9d['body']['id'];}return db[_0x44ed('0x2b')]['find']({'where':{'id':_0xa5ba9d[_0x44ed('0x4a')]['id']}})[_0x44ed('0x28')](handleEntityNotFound(_0x19e5f0,null))[_0x44ed('0x28')](saveUpdates(_0xa5ba9d[_0x44ed('0x49')],null))['then'](respondWithResult(_0x19e5f0,null))[_0x44ed('0x43')](handleError(_0x19e5f0,null));};exports[_0x44ed('0x4b')]=function(_0x26e6ff,_0x146c1d){return db['ServicenowField']['find']({'where':{'id':_0x26e6ff[_0x44ed('0x4a')]['id']}})[_0x44ed('0x28')](handleEntityNotFound(_0x146c1d,null))[_0x44ed('0x28')](removeEntity(_0x146c1d,null))[_0x44ed('0x43')](handleError(_0x146c1d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a2ae8d8..fa06029 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 _0xfef1=['path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xfef1,0x179));var _0x1fef=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfef1[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1fef('0x0'));var util=require(_0x1fef('0x1'));var logger=require(_0x1fef('0x2'))(_0x1fef('0x3'));var moment=require(_0x1fef('0x4'));var BPromise=require(_0x1fef('0x5'));var rp=require(_0x1fef('0x6'));var fs=require('fs');var path=require(_0x1fef('0x7'));var rimraf=require(_0x1fef('0x8'));var config=require('../../config/environment');var attributes=require(_0x1fef('0x9'));module[_0x1fef('0xa')]=function(_0x49903a,_0x4aef55){return _0x49903a[_0x1fef('0xb')](_0x1fef('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x1fef('0xd'),'fields':[_0x1fef('0xe'),_0x1fef('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbad1=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField'];(function(_0x1fa623,_0x2318de){var _0x3b05bf=function(_0x207d6f){while(--_0x207d6f){_0x1fa623['push'](_0x1fa623['shift']());}};_0x3b05bf(++_0x2318de);}(_0xbad1,0xc4));var _0x1bad=function(_0x466a1a,_0x37933b){_0x466a1a=_0x466a1a-0x0;var _0x577165=_0xbad1[_0x466a1a];return _0x577165;};'use strict';var _=require(_0x1bad('0x0'));var util=require(_0x1bad('0x1'));var logger=require(_0x1bad('0x2'))(_0x1bad('0x3'));var moment=require(_0x1bad('0x4'));var BPromise=require(_0x1bad('0x5'));var rp=require(_0x1bad('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1bad('0x7'));var config=require(_0x1bad('0x8'));var attributes=require(_0x1bad('0x9'));module[_0x1bad('0xa')]=function(_0x25cf7b,_0x46dba9){return _0x25cf7b['define'](_0x1bad('0xb'),attributes,{'tableName':_0x1bad('0xc'),'paranoid':![],'indexes':[{'name':_0x1bad('0xd'),'fields':[_0x1bad('0xe'),_0x1bad('0xf')],'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 c2afca1..baf61ba 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xda3f,0xec));var _0xfda3=function(_0x5753f1,_0x2f9745){_0x5753f1=_0x5753f1-0x0;var _0x35ca59=_0xda3f[_0x5753f1];return _0x35ca59;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5670dd,_0x30fb92){var _0x5da688=function(_0x4cf8ef){while(--_0x4cf8ef){_0x5670dd['push'](_0x5670dd['shift']());}};_0x5da688(++_0x30fb92);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4f093a,_0x3cad8f){_0x4f093a=_0x4f093a-0x0;var _0x40d90d=_0xb43b[_0x4f093a];return _0x40d90d;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\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/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index f28bb19..3dbd426 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(_0x1d195c,_0x47d30b){var _0x4bdc6d=function(_0x576206){while(--_0x576206){_0x1d195c['push'](_0x1d195c['shift']());}};_0x4bdc6d(++_0x47d30b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x56df83,_0x57fcaf){var _0x378b49=function(_0x1532e6){while(--_0x1532e6){_0x56df83['push'](_0x56df83['shift']());}};_0x378b49(++_0x57fcaf);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 4a2f28e..ad036da 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(_0x199397,_0x10eeb1){var _0x5b7e85=function(_0x3b61f5){while(--_0x3b61f5){_0x199397['push'](_0x199397['shift']());}};_0x5b7e85(++_0x10eeb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x19eea1,_0x3f0164){var _0x2d3f46=function(_0x423dff){while(--_0x423dff){_0x19eea1['push'](_0x19eea1['shift']());}};_0x2d3f46(++_0x3f0164);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 e74e902..fc1d1a8 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 _0x4e6d=['PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','stringify','Calls','values','module_fields','remove','includes','label','endsWith','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SugarcrmAccount','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','/service/v4_1/rest.php','login','JSON'];(function(_0x5d8c74,_0x5f546d){var _0x7ebdf4=function(_0x35ca5f){while(--_0x35ca5f){_0x5d8c74['push'](_0x5d8c74['shift']());}};_0x7ebdf4(++_0x5f546d);}(_0x4e6d,0x10a));var _0xd4e6=function(_0xd43e1d,_0x26a204){_0xd43e1d=_0xd43e1d-0x0;var _0x5c7332=_0x4e6d[_0xd43e1d];return _0x5c7332;};'use strict';var emlformat=require(_0xd4e6('0x0'));var rimraf=require(_0xd4e6('0x1'));var zipdir=require(_0xd4e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4e6('0x3'));var moment=require(_0xd4e6('0x4'));var BPromise=require(_0xd4e6('0x5'));var Mustache=require(_0xd4e6('0x6'));var util=require(_0xd4e6('0x7'));var path=require(_0xd4e6('0x8'));var sox=require(_0xd4e6('0x9'));var csv=require('to-csv');var ejs=require(_0xd4e6('0xa'));var fs=require('fs');var fs_extra=require(_0xd4e6('0xb'));var _=require(_0xd4e6('0xc'));var squel=require(_0xd4e6('0xd'));var crypto=require(_0xd4e6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd4e6('0xf'));var toCsv=require(_0xd4e6('0x10'));var querystring=require(_0xd4e6('0x11'));var Papa=require('papaparse');var Redis=require(_0xd4e6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd4e6('0x13'));var as=require(_0xd4e6('0x14'));var hardwareService=require(_0xd4e6('0x15'));var logger=require(_0xd4e6('0x16'))(_0xd4e6('0x17'));var utils=require(_0xd4e6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd4e6('0x19'));var db=require(_0xd4e6('0x1a'))['db'];var integrations=require(_0xd4e6('0x1b'));function respondWithStatusCode(_0x96a21c,_0x41fdb6){_0x41fdb6=_0x41fdb6||0xcc;return function(_0x3a5b24){if(_0x3a5b24){return _0x96a21c['sendStatus'](_0x41fdb6);}return _0x96a21c[_0xd4e6('0x1c')](_0x41fdb6)['end']();};}function respondWithResult(_0x3a4abf,_0x5f0c43){_0x5f0c43=_0x5f0c43||0xc8;return function(_0x4b7bde){if(_0x4b7bde){return _0x3a4abf[_0xd4e6('0x1c')](_0x5f0c43)[_0xd4e6('0x1d')](_0x4b7bde);}};}function respondWithFilteredResult(_0x5240ef,_0x5407bf){return function(_0x1aefc9){if(_0x1aefc9){var _0x5e8e76=typeof _0x5407bf[_0xd4e6('0x1e')]===_0xd4e6('0x1f')&&typeof _0x5407bf[_0xd4e6('0x20')]===_0xd4e6('0x1f');var _0x9bb6de=_0x1aefc9[_0xd4e6('0x21')];var _0x3e84b7=_0x5e8e76?0x0:_0x5407bf['offset'];var _0x4e14ed=_0x5e8e76?_0x1aefc9[_0xd4e6('0x21')]:_0x5407bf[_0xd4e6('0x1e')]+_0x5407bf[_0xd4e6('0x20')];var _0x5b63b3;if(_0x4e14ed>=_0x9bb6de){_0x4e14ed=_0x9bb6de;_0x5b63b3=0xc8;}else{_0x5b63b3=0xce;}_0x5240ef[_0xd4e6('0x1c')](_0x5b63b3);return _0x5240ef[_0xd4e6('0x22')](_0xd4e6('0x23'),_0x3e84b7+'-'+_0x4e14ed+'/'+_0x9bb6de)[_0xd4e6('0x1d')](_0x1aefc9);}return null;};}function patchUpdates(_0x2ec7bf){return function(_0x14838){try{jsonpatch[_0xd4e6('0x24')](_0x14838,_0x2ec7bf,!![]);}catch(_0x1a32a0){return BPromise[_0xd4e6('0x25')](_0x1a32a0);}return _0x14838[_0xd4e6('0x26')]();};}function saveUpdates(_0x2e4562,_0x5ddca9){return function(_0x1438c4){if(_0x1438c4){return _0x1438c4[_0xd4e6('0x27')](_0x2e4562)[_0xd4e6('0x28')](function(_0x42899f){return _0x42899f;});}return null;};}function removeEntity(_0x43cef0,_0x410061){return function(_0x56537a){if(_0x56537a){return _0x56537a[_0xd4e6('0x29')]()[_0xd4e6('0x28')](function(){_0x43cef0[_0xd4e6('0x1c')](0xcc)[_0xd4e6('0x2a')]();});}};}function handleEntityNotFound(_0x536fc1,_0x4b05b4){return function(_0x25eefb){if(!_0x25eefb){_0x536fc1[_0xd4e6('0x2b')](0x194);}return _0x25eefb;};}function handleError(_0x17a5a4,_0x3ab477){_0x3ab477=_0x3ab477||0x1f4;return function(_0x11f327){logger[_0xd4e6('0x2c')](_0x11f327[_0xd4e6('0x2d')]);if(_0x11f327[_0xd4e6('0x2e')]){delete _0x11f327[_0xd4e6('0x2e')];}_0x17a5a4[_0xd4e6('0x1c')](_0x3ab477)['send'](_0x11f327);};}exports[_0xd4e6('0x2f')]=function(_0x2d9b60,_0x11dafd){var _0x358545={},_0x130dce={},_0x511f8a={'count':0x0,'rows':[]};var _0x399b23=_['map'](db['SugarcrmAccount'][_0xd4e6('0x30')],function(_0x4d9a2c){return{'name':_0x4d9a2c[_0xd4e6('0x31')],'type':_0x4d9a2c['type'][_0xd4e6('0x32')]};});_0x130dce[_0xd4e6('0x33')]=_[_0xd4e6('0x34')](_0x399b23,_0xd4e6('0x2e'));_0x130dce[_0xd4e6('0x35')]=_[_0xd4e6('0x36')](_0x2d9b60[_0xd4e6('0x35')]);_0x130dce[_0xd4e6('0x37')]=_[_0xd4e6('0x38')](_0x130dce[_0xd4e6('0x33')],_0x130dce[_0xd4e6('0x35')]);_0x358545[_0xd4e6('0x39')]=_[_0xd4e6('0x38')](_0x130dce[_0xd4e6('0x33')],qs[_0xd4e6('0x3a')](_0x2d9b60[_0xd4e6('0x35')]['fields']));_0x358545['attributes']=_0x358545[_0xd4e6('0x39')][_0xd4e6('0x3b')]?_0x358545[_0xd4e6('0x39')]:_0x130dce['model'];if(!_0x2d9b60[_0xd4e6('0x35')][_0xd4e6('0x3c')](_0xd4e6('0x3d'))){_0x358545[_0xd4e6('0x20')]=qs[_0xd4e6('0x20')](_0x2d9b60[_0xd4e6('0x35')][_0xd4e6('0x20')]);_0x358545[_0xd4e6('0x1e')]=qs[_0xd4e6('0x1e')](_0x2d9b60['query'][_0xd4e6('0x1e')]);}_0x358545[_0xd4e6('0x3e')]=qs[_0xd4e6('0x3f')](_0x2d9b60[_0xd4e6('0x35')][_0xd4e6('0x3f')]);_0x358545[_0xd4e6('0x40')]=qs[_0xd4e6('0x37')](_[_0xd4e6('0x41')](_0x2d9b60[_0xd4e6('0x35')],_0x130dce[_0xd4e6('0x37')]),_0x399b23);if(_0x2d9b60[_0xd4e6('0x35')][_0xd4e6('0x42')]){_0x358545[_0xd4e6('0x40')]=_[_0xd4e6('0x43')](_0x358545[_0xd4e6('0x40')],{'$or':_[_0xd4e6('0x34')](_0x399b23,function(_0x14f00a){if(_0x14f00a[_0xd4e6('0x44')]!==_0xd4e6('0x45')){var _0x5da96b={};_0x5da96b[_0x14f00a['name']]={'$like':'%'+_0x2d9b60[_0xd4e6('0x35')][_0xd4e6('0x42')]+'%'};return _0x5da96b;}})});}_0x358545=_[_0xd4e6('0x43')]({},_0x358545,_0x2d9b60[_0xd4e6('0x46')]);var _0x452a66={'where':_0x358545[_0xd4e6('0x40')]};return db[_0xd4e6('0x47')][_0xd4e6('0x21')](_0x452a66)[_0xd4e6('0x28')](function(_0xbd63ef){_0x511f8a[_0xd4e6('0x21')]=_0xbd63ef;if(_0x2d9b60[_0xd4e6('0x35')]['includeAll']){_0x358545[_0xd4e6('0x48')]=[{'all':!![]}];}return db[_0xd4e6('0x47')][_0xd4e6('0x49')](_0x358545);})['then'](function(_0x4797a8){_0x511f8a[_0xd4e6('0x4a')]=_0x4797a8;return _0x511f8a;})['then'](respondWithFilteredResult(_0x11dafd,_0x358545))[_0xd4e6('0x4b')](handleError(_0x11dafd,null));};exports[_0xd4e6('0x4c')]=function(_0x528a19,_0x4ac9f4){var _0x2b50f4={'raw':![],'where':{'id':_0x528a19[_0xd4e6('0x4d')]['id']}},_0xee309c={};_0xee309c[_0xd4e6('0x33')]=_[_0xd4e6('0x36')](db[_0xd4e6('0x47')][_0xd4e6('0x30')]);_0xee309c[_0xd4e6('0x35')]=_['keys'](_0x528a19[_0xd4e6('0x35')]);_0xee309c[_0xd4e6('0x37')]=_['intersection'](_0xee309c[_0xd4e6('0x33')],_0xee309c[_0xd4e6('0x35')]);_0x2b50f4[_0xd4e6('0x39')]=_['intersection'](_0xee309c[_0xd4e6('0x33')],qs[_0xd4e6('0x3a')](_0x528a19['query'][_0xd4e6('0x3a')]));_0x2b50f4[_0xd4e6('0x39')]=_0x2b50f4['attributes'][_0xd4e6('0x3b')]?_0x2b50f4[_0xd4e6('0x39')]:_0xee309c['model'];if(_0x528a19[_0xd4e6('0x35')]['includeAll']){_0x2b50f4[_0xd4e6('0x48')]=[{'all':!![]}];}_0x2b50f4=_[_0xd4e6('0x43')]({},_0x2b50f4,_0x528a19['options']);return db[_0xd4e6('0x47')]['find'](_0x2b50f4)[_0xd4e6('0x28')](handleEntityNotFound(_0x4ac9f4,null))['then'](respondWithResult(_0x4ac9f4,null))[_0xd4e6('0x4b')](handleError(_0x4ac9f4,null));};exports[_0xd4e6('0x4e')]=function(_0x2160a4,_0x43b656){return db['SugarcrmAccount']['create'](_0x2160a4['body'],{})['then'](respondWithResult(_0x43b656,0xc9))[_0xd4e6('0x4b')](handleError(_0x43b656,null));};exports[_0xd4e6('0x27')]=function(_0xa66b78,_0x4b102c){if(_0xa66b78[_0xd4e6('0x4f')]['id']){delete _0xa66b78[_0xd4e6('0x4f')]['id'];}return db['SugarcrmAccount'][_0xd4e6('0x50')]({'where':{'id':_0xa66b78['params']['id']}})[_0xd4e6('0x28')](handleEntityNotFound(_0x4b102c,null))[_0xd4e6('0x28')](saveUpdates(_0xa66b78[_0xd4e6('0x4f')],null))[_0xd4e6('0x28')](respondWithResult(_0x4b102c,null))[_0xd4e6('0x4b')](handleError(_0x4b102c,null));};exports['destroy']=function(_0x262c2d,_0x205df4){return db[_0xd4e6('0x47')][_0xd4e6('0x50')]({'where':{'id':_0x262c2d[_0xd4e6('0x4d')]['id']}})[_0xd4e6('0x28')](handleEntityNotFound(_0x205df4,null))[_0xd4e6('0x28')](removeEntity(_0x205df4,null))[_0xd4e6('0x4b')](handleError(_0x205df4,null));};exports[_0xd4e6('0x51')]=function(_0x373f4c,_0x291491,_0x2f3710){var _0x479983={};var _0xc3ad65={};var _0x491861;var _0x6d71e2;return db[_0xd4e6('0x47')][_0xd4e6('0x52')]({'where':{'id':_0x373f4c['params']['id']}})[_0xd4e6('0x28')](handleEntityNotFound(_0x291491,null))['then'](function(_0x8ec018){if(_0x8ec018){_0x491861=_0x8ec018;_0xc3ad65[_0xd4e6('0x33')]=_[_0xd4e6('0x36')](db['SugarcrmConfiguration'][_0xd4e6('0x30')]);_0xc3ad65[_0xd4e6('0x35')]=_[_0xd4e6('0x36')](_0x373f4c[_0xd4e6('0x35')]);_0xc3ad65[_0xd4e6('0x37')]=_[_0xd4e6('0x38')](_0xc3ad65['model'],_0xc3ad65[_0xd4e6('0x35')]);_0x479983[_0xd4e6('0x39')]=_[_0xd4e6('0x38')](_0xc3ad65[_0xd4e6('0x33')],qs['fields'](_0x373f4c[_0xd4e6('0x35')][_0xd4e6('0x3a')]));_0x479983[_0xd4e6('0x39')]=_0x479983['attributes'][_0xd4e6('0x3b')]?_0x479983[_0xd4e6('0x39')]:_0xc3ad65[_0xd4e6('0x33')];_0x479983[_0xd4e6('0x3e')]=qs[_0xd4e6('0x3f')](_0x373f4c[_0xd4e6('0x35')]['sort']);_0x479983[_0xd4e6('0x40')]=qs['filters'](_[_0xd4e6('0x41')](_0x373f4c[_0xd4e6('0x35')],_0xc3ad65[_0xd4e6('0x37')]));if(_0x373f4c[_0xd4e6('0x35')]['filter']){_0x479983[_0xd4e6('0x40')]=_[_0xd4e6('0x43')](_0x479983['where'],{'$or':_[_0xd4e6('0x34')](_0x479983[_0xd4e6('0x39')],function(_0x861942){var _0x4dccca={};_0x4dccca[_0x861942]={'$like':'%'+_0x373f4c[_0xd4e6('0x35')][_0xd4e6('0x42')]+'%'};return _0x4dccca;})});}_0x479983=_[_0xd4e6('0x43')]({},_0x479983,_0x373f4c[_0xd4e6('0x46')]);return _0x491861[_0xd4e6('0x51')](_0x479983);}})[_0xd4e6('0x28')](function(_0x8056fa){if(_0x8056fa){_0x6d71e2=_0x8056fa['length'];if(!_0x373f4c['query'][_0xd4e6('0x3c')](_0xd4e6('0x3d'))){_0x479983['limit']=qs[_0xd4e6('0x20')](_0x373f4c[_0xd4e6('0x35')][_0xd4e6('0x20')]);_0x479983[_0xd4e6('0x1e')]=qs[_0xd4e6('0x1e')](_0x373f4c[_0xd4e6('0x35')]['offset']);}return _0x491861['getConfigurations'](_0x479983);}})[_0xd4e6('0x28')](function(_0xacfbcf){if(_0xacfbcf){return _0xacfbcf?{'count':_0x6d71e2,'rows':_0xacfbcf}:null;}})['then'](respondWithResult(_0x291491,null))[_0xd4e6('0x4b')](handleError(_0x291491,null));};exports[_0xd4e6('0x53')]=function(_0x47d07a,_0x3e8b83,_0x866183){if(_0x47d07a[_0xd4e6('0x4f')]['id']){delete _0x47d07a[_0xd4e6('0x4f')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x47d07a[_0xd4e6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e8b83,null))['then'](function(_0x629079){if(_0x629079){_0x47d07a[_0xd4e6('0x4f')][_0xd4e6('0x54')]=_0x629079['id'];_0x47d07a[_0xd4e6('0x4f')][_0xd4e6('0x55')]=integrations['getSubjects'](_0x47d07a[_0xd4e6('0x4f')][_0xd4e6('0x56')],_0x47d07a[_0xd4e6('0x4f')][_0xd4e6('0x44')]);_0x47d07a['body'][_0xd4e6('0x57')]=integrations[_0xd4e6('0x58')](_0x47d07a[_0xd4e6('0x4f')][_0xd4e6('0x56')],_0x47d07a[_0xd4e6('0x4f')]['type']);return db[_0xd4e6('0x59')][_0xd4e6('0x4e')](_0x47d07a[_0xd4e6('0x4f')],{'include':[{'model':db['SugarcrmField'],'as':_0xd4e6('0x55')},{'model':db[_0xd4e6('0x5a')],'as':_0xd4e6('0x57')}]});}return null;})['then'](respondWithResult(_0x3e8b83,null))[_0xd4e6('0x4b')](handleError(_0x3e8b83,null));};exports[_0xd4e6('0x5b')]=function(_0x11df4d,_0x49d2fc,_0x2b929c){var _0x543d89='';var _0x50975a=['id',_0xd4e6('0x2e'),_0xd4e6('0x5c'),_0xd4e6('0x5d'),'description',_0xd4e6('0x5e'),'duration_hours',_0xd4e6('0x5f'),_0xd4e6('0x60'),'parent_type',_0xd4e6('0x61'),_0xd4e6('0x62')];return db[_0xd4e6('0x47')][_0xd4e6('0x52')]({'where':{'id':_0x11df4d[_0xd4e6('0x4d')]['id']},'attributes':['id',_0xd4e6('0x63'),_0xd4e6('0x64'),'remoteUri']})['then'](handleEntityNotFound(_0x49d2fc,null))[_0xd4e6('0x28')](function(_0x16409b){if(_0x16409b){_0x543d89=_0x16409b[_0xd4e6('0x65')];var _0x5b1313=_0x543d89[_0xd4e6('0x66')](-0x1);if(_0x5b1313==='/'){_0x543d89=_0x543d89[_0xd4e6('0x67')](0x0,_0x543d89['lastIndexOf'](_0x5b1313));}return rp({'method':_0xd4e6('0x68'),'uri':util[_0xd4e6('0x69')]('%s%s',_0x543d89,_0xd4e6('0x6a')),'json':!![],'form':{'method':_0xd4e6('0x6b'),'input_type':_0xd4e6('0x6c'),'response_type':_0xd4e6('0x6c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x16409b[_0xd4e6('0x63')],'password':_0x16409b['password'],'encryption':_0xd4e6('0x6d')},'application':_0xd4e6('0x6e')})}});}})[_0xd4e6('0x28')](function(_0x22c091){if(_0x22c091&&_0x22c091[_0xd4e6('0x2e')]!==_0xd4e6('0x6f')&&_0x22c091[_0xd4e6('0x2e')]!==_0xd4e6('0x70')){return rp({'method':_0xd4e6('0x68'),'uri':util['format'](_0xd4e6('0x71'),_0x543d89,_0xd4e6('0x6a')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xd4e6('0x6c'),'rest_data':JSON[_0xd4e6('0x72')]({'session':_0x22c091['id'],'module_name':_0xd4e6('0x73')})}})[_0xd4e6('0x28')](function(_0x9ec0eb){if(_0x9ec0eb){var _0x1364a2=_[_0xd4e6('0x74')](_0x9ec0eb[_0xd4e6('0x75')]);_[_0xd4e6('0x76')](_0x1364a2,function(_0x176f4d){return _0x50975a[_0xd4e6('0x77')](_0x176f4d[_0xd4e6('0x2e')]);});return{'count':_0x1364a2[_0xd4e6('0x3b')],'rows':_[_0xd4e6('0x34')](_0x1364a2,function(_0x9a7072){return{'id':_0x9a7072['name'],'name':_0x9a7072[_0xd4e6('0x78')],'custom':_[_0xd4e6('0x79')](_0x9a7072['name'],'_c')?!![]:![],'options':_0x9a7072[_0xd4e6('0x46')]?_[_0xd4e6('0x34')](_['values'](_0x9a7072['options']),function(_0x25cc4e){return{'name':_0x25cc4e['value'],'value':_0x25cc4e[_0xd4e6('0x2e')]};}):[]};})};}})[_0xd4e6('0x28')](respondWithResult(_0x49d2fc,null))[_0xd4e6('0x4b')](function(_0x2ddcf4){var _0x55e823=_0x11df4d[_0xd4e6('0x35')]['test']?0x1f4:_0x2ddcf4['statusCode']||0x1f4;logger[_0xd4e6('0x2c')]('getFields,\x20%s,\x20%s,\x20%s',_0xd4e6('0x5b'),_0x55e823,JSON[_0xd4e6('0x72')](_0x2ddcf4));delete _0x2ddcf4[_0xd4e6('0x2e')];if(_0x55e823===0x191){_0x55e823=0x190;}_0x49d2fc['status'](_0x55e823)[_0xd4e6('0x7a')](_0x11df4d[_0xd4e6('0x35')]['test']?{'message':_0xd4e6('0x7b'),'statusCode':_0x2ddcf4[_0xd4e6('0x7c')]}:_0x2ddcf4);});}else{var _0xe26ab3=0x1f4;_0x49d2fc[_0xd4e6('0x1c')](_0xe26ab3)['send']({'message':_0xd4e6('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x960b=['../../config/logger','../../config/utils','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','sort','pick','filter','merge','where','VIRTUAL','options','SugarcrmAccount','findAll','catch','show','keys','includeAll','include','find','create','body','params','getConfigurations','findOne','length','order','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','SugarcrmConfiguration','Subjects','SugarcrmField','Descriptions','assigned_user_id','created_by','description','date_start','parent_id','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','Calls','values','module_fields','remove','includes','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5c0ce7,_0x2075b0){var _0x428a6c=function(_0x335b9a){while(--_0x335b9a){_0x5c0ce7['push'](_0x5c0ce7['shift']());}};_0x428a6c(++_0x2075b0);}(_0x960b,0x1cc));var _0xb960=function(_0x551805,_0x27c4f5){_0x551805=_0x551805-0x0;var _0x213b38=_0x960b[_0x551805];return _0x213b38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb960('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb960('0x1'));var rp=require(_0xb960('0x2'));var moment=require('moment');var BPromise=require(_0xb960('0x3'));var Mustache=require(_0xb960('0x4'));var util=require(_0xb960('0x5'));var path=require(_0xb960('0x6'));var sox=require(_0xb960('0x7'));var csv=require(_0xb960('0x8'));var ejs=require(_0xb960('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb960('0xa'));var squel=require(_0xb960('0xb'));var crypto=require('crypto');var jsforce=require(_0xb960('0xc'));var deskjs=require(_0xb960('0xd'));var toCsv=require(_0xb960('0x8'));var querystring=require(_0xb960('0xe'));var Papa=require(_0xb960('0xf'));var Redis=require(_0xb960('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb960('0x11'));var as=require(_0xb960('0x12'));var hardwareService=require(_0xb960('0x13'));var logger=require(_0xb960('0x14'))('api');var utils=require(_0xb960('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb960('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x27da12,_0x497a53){_0x497a53=_0x497a53||0xcc;return function(_0x43ab2d){if(_0x43ab2d){return _0x27da12[_0xb960('0x17')](_0x497a53);}return _0x27da12['status'](_0x497a53)['end']();};}function respondWithResult(_0x55b078,_0xd498c0){_0xd498c0=_0xd498c0||0xc8;return function(_0x6bdb91){if(_0x6bdb91){return _0x55b078['status'](_0xd498c0)[_0xb960('0x18')](_0x6bdb91);}};}function respondWithFilteredResult(_0x1a2814,_0x54d593){return function(_0x57bca9){if(_0x57bca9){var _0x4dcd77=typeof _0x54d593[_0xb960('0x19')]===_0xb960('0x1a')&&typeof _0x54d593['limit']==='undefined';var _0x18d2b5=_0x57bca9[_0xb960('0x1b')];var _0x3cb198=_0x4dcd77?0x0:_0x54d593[_0xb960('0x19')];var _0x16b3cf=_0x4dcd77?_0x57bca9['count']:_0x54d593['offset']+_0x54d593[_0xb960('0x1c')];var _0x5b4b76;if(_0x16b3cf>=_0x18d2b5){_0x16b3cf=_0x18d2b5;_0x5b4b76=0xc8;}else{_0x5b4b76=0xce;}_0x1a2814[_0xb960('0x1d')](_0x5b4b76);return _0x1a2814[_0xb960('0x1e')](_0xb960('0x1f'),_0x3cb198+'-'+_0x16b3cf+'/'+_0x18d2b5)[_0xb960('0x18')](_0x57bca9);}return null;};}function patchUpdates(_0x5b44b7){return function(_0x25f6f2){try{jsonpatch['apply'](_0x25f6f2,_0x5b44b7,!![]);}catch(_0x208fc0){return BPromise[_0xb960('0x20')](_0x208fc0);}return _0x25f6f2[_0xb960('0x21')]();};}function saveUpdates(_0x217ea9,_0x283d9a){return function(_0x5c18b1){if(_0x5c18b1){return _0x5c18b1[_0xb960('0x22')](_0x217ea9)[_0xb960('0x23')](function(_0x3a512c){return _0x3a512c;});}return null;};}function removeEntity(_0x2e497b,_0x395f95){return function(_0x106fa1){if(_0x106fa1){return _0x106fa1[_0xb960('0x24')]()[_0xb960('0x23')](function(){_0x2e497b['status'](0xcc)[_0xb960('0x25')]();});}};}function handleEntityNotFound(_0x25c7e8,_0x2e4840){return function(_0x3a0e1c){if(!_0x3a0e1c){_0x25c7e8[_0xb960('0x17')](0x194);}return _0x3a0e1c;};}function handleError(_0x336224,_0x49e1b0){_0x49e1b0=_0x49e1b0||0x1f4;return function(_0x37f707){logger[_0xb960('0x26')](_0x37f707[_0xb960('0x27')]);if(_0x37f707[_0xb960('0x28')]){delete _0x37f707[_0xb960('0x28')];}_0x336224[_0xb960('0x1d')](_0x49e1b0)[_0xb960('0x29')](_0x37f707);};}exports[_0xb960('0x2a')]=function(_0x1d00bf,_0x2fe8c9){var _0x5caeae={},_0x3e93ba={},_0x3837c7={'count':0x0,'rows':[]};var _0x2f7cef=_[_0xb960('0x2b')](db['SugarcrmAccount'][_0xb960('0x2c')],function(_0x53b909){return{'name':_0x53b909[_0xb960('0x2d')],'type':_0x53b909[_0xb960('0x2e')]['key']};});_0x3e93ba[_0xb960('0x2f')]=_[_0xb960('0x2b')](_0x2f7cef,_0xb960('0x28'));_0x3e93ba['query']=_['keys'](_0x1d00bf[_0xb960('0x30')]);_0x3e93ba[_0xb960('0x31')]=_[_0xb960('0x32')](_0x3e93ba[_0xb960('0x2f')],_0x3e93ba[_0xb960('0x30')]);_0x5caeae[_0xb960('0x33')]=_['intersection'](_0x3e93ba[_0xb960('0x2f')],qs[_0xb960('0x34')](_0x1d00bf['query'][_0xb960('0x34')]));_0x5caeae[_0xb960('0x33')]=_0x5caeae[_0xb960('0x33')]['length']?_0x5caeae['attributes']:_0x3e93ba[_0xb960('0x2f')];if(!_0x1d00bf[_0xb960('0x30')]['hasOwnProperty']('nolimit')){_0x5caeae['limit']=qs[_0xb960('0x1c')](_0x1d00bf['query']['limit']);_0x5caeae[_0xb960('0x19')]=qs[_0xb960('0x19')](_0x1d00bf[_0xb960('0x30')][_0xb960('0x19')]);}_0x5caeae['order']=qs[_0xb960('0x35')](_0x1d00bf['query'][_0xb960('0x35')]);_0x5caeae['where']=qs['filters'](_[_0xb960('0x36')](_0x1d00bf['query'],_0x3e93ba[_0xb960('0x31')]),_0x2f7cef);if(_0x1d00bf[_0xb960('0x30')][_0xb960('0x37')]){_0x5caeae['where']=_[_0xb960('0x38')](_0x5caeae[_0xb960('0x39')],{'$or':_['map'](_0x2f7cef,function(_0x2961a6){if(_0x2961a6['type']!==_0xb960('0x3a')){var _0x3fd695={};_0x3fd695[_0x2961a6[_0xb960('0x28')]]={'$like':'%'+_0x1d00bf[_0xb960('0x30')][_0xb960('0x37')]+'%'};return _0x3fd695;}})});}_0x5caeae=_[_0xb960('0x38')]({},_0x5caeae,_0x1d00bf[_0xb960('0x3b')]);var _0xc328b9={'where':_0x5caeae['where']};return db['SugarcrmAccount'][_0xb960('0x1b')](_0xc328b9)[_0xb960('0x23')](function(_0x436b58){_0x3837c7[_0xb960('0x1b')]=_0x436b58;if(_0x1d00bf[_0xb960('0x30')]['includeAll']){_0x5caeae['include']=[{'all':!![]}];}return db[_0xb960('0x3c')][_0xb960('0x3d')](_0x5caeae);})['then'](function(_0x28459e){_0x3837c7['rows']=_0x28459e;return _0x3837c7;})[_0xb960('0x23')](respondWithFilteredResult(_0x2fe8c9,_0x5caeae))[_0xb960('0x3e')](handleError(_0x2fe8c9,null));};exports[_0xb960('0x3f')]=function(_0x4ea99e,_0x506f3c){var _0x3b5623={'raw':![],'where':{'id':_0x4ea99e['params']['id']}},_0x2beaa7={};_0x2beaa7[_0xb960('0x2f')]=_[_0xb960('0x40')](db[_0xb960('0x3c')][_0xb960('0x2c')]);_0x2beaa7[_0xb960('0x30')]=_[_0xb960('0x40')](_0x4ea99e[_0xb960('0x30')]);_0x2beaa7[_0xb960('0x31')]=_['intersection'](_0x2beaa7['model'],_0x2beaa7[_0xb960('0x30')]);_0x3b5623[_0xb960('0x33')]=_[_0xb960('0x32')](_0x2beaa7[_0xb960('0x2f')],qs[_0xb960('0x34')](_0x4ea99e[_0xb960('0x30')][_0xb960('0x34')]));_0x3b5623['attributes']=_0x3b5623[_0xb960('0x33')]['length']?_0x3b5623['attributes']:_0x2beaa7['model'];if(_0x4ea99e['query'][_0xb960('0x41')]){_0x3b5623[_0xb960('0x42')]=[{'all':!![]}];}_0x3b5623=_['merge']({},_0x3b5623,_0x4ea99e['options']);return db[_0xb960('0x3c')][_0xb960('0x43')](_0x3b5623)['then'](handleEntityNotFound(_0x506f3c,null))[_0xb960('0x23')](respondWithResult(_0x506f3c,null))[_0xb960('0x3e')](handleError(_0x506f3c,null));};exports['create']=function(_0x27096b,_0x4e746a){return db[_0xb960('0x3c')][_0xb960('0x44')](_0x27096b[_0xb960('0x45')],{})['then'](respondWithResult(_0x4e746a,0xc9))[_0xb960('0x3e')](handleError(_0x4e746a,null));};exports[_0xb960('0x22')]=function(_0x4966e4,_0x1ea305){if(_0x4966e4[_0xb960('0x45')]['id']){delete _0x4966e4['body']['id'];}return db[_0xb960('0x3c')][_0xb960('0x43')]({'where':{'id':_0x4966e4[_0xb960('0x46')]['id']}})[_0xb960('0x23')](handleEntityNotFound(_0x1ea305,null))['then'](saveUpdates(_0x4966e4[_0xb960('0x45')],null))[_0xb960('0x23')](respondWithResult(_0x1ea305,null))[_0xb960('0x3e')](handleError(_0x1ea305,null));};exports[_0xb960('0x24')]=function(_0x353950,_0x39e1a0){return db[_0xb960('0x3c')][_0xb960('0x43')]({'where':{'id':_0x353950[_0xb960('0x46')]['id']}})['then'](handleEntityNotFound(_0x39e1a0,null))[_0xb960('0x23')](removeEntity(_0x39e1a0,null))[_0xb960('0x3e')](handleError(_0x39e1a0,null));};exports[_0xb960('0x47')]=function(_0xdf634e,_0x36fdab,_0x449746){var _0x181828={};var _0x27ddb8={};var _0x592cee;var _0x45f630;return db[_0xb960('0x3c')][_0xb960('0x48')]({'where':{'id':_0xdf634e['params']['id']}})[_0xb960('0x23')](handleEntityNotFound(_0x36fdab,null))[_0xb960('0x23')](function(_0x4426be){if(_0x4426be){_0x592cee=_0x4426be;_0x27ddb8[_0xb960('0x2f')]=_[_0xb960('0x40')](db['SugarcrmConfiguration'][_0xb960('0x2c')]);_0x27ddb8[_0xb960('0x30')]=_['keys'](_0xdf634e[_0xb960('0x30')]);_0x27ddb8['filters']=_['intersection'](_0x27ddb8[_0xb960('0x2f')],_0x27ddb8['query']);_0x181828[_0xb960('0x33')]=_[_0xb960('0x32')](_0x27ddb8[_0xb960('0x2f')],qs[_0xb960('0x34')](_0xdf634e[_0xb960('0x30')][_0xb960('0x34')]));_0x181828['attributes']=_0x181828['attributes'][_0xb960('0x49')]?_0x181828[_0xb960('0x33')]:_0x27ddb8[_0xb960('0x2f')];_0x181828[_0xb960('0x4a')]=qs['sort'](_0xdf634e[_0xb960('0x30')][_0xb960('0x35')]);_0x181828[_0xb960('0x39')]=qs[_0xb960('0x31')](_[_0xb960('0x36')](_0xdf634e[_0xb960('0x30')],_0x27ddb8[_0xb960('0x31')]));if(_0xdf634e[_0xb960('0x30')][_0xb960('0x37')]){_0x181828[_0xb960('0x39')]=_['merge'](_0x181828['where'],{'$or':_['map'](_0x181828[_0xb960('0x33')],function(_0x42afb6){var _0x2ae73e={};_0x2ae73e[_0x42afb6]={'$like':'%'+_0xdf634e[_0xb960('0x30')][_0xb960('0x37')]+'%'};return _0x2ae73e;})});}_0x181828=_['merge']({},_0x181828,_0xdf634e['options']);return _0x592cee[_0xb960('0x47')](_0x181828);}})[_0xb960('0x23')](function(_0xa8af5a){if(_0xa8af5a){_0x45f630=_0xa8af5a[_0xb960('0x49')];if(!_0xdf634e[_0xb960('0x30')][_0xb960('0x4b')](_0xb960('0x4c'))){_0x181828[_0xb960('0x1c')]=qs[_0xb960('0x1c')](_0xdf634e[_0xb960('0x30')]['limit']);_0x181828['offset']=qs[_0xb960('0x19')](_0xdf634e[_0xb960('0x30')][_0xb960('0x19')]);}return _0x592cee[_0xb960('0x47')](_0x181828);}})[_0xb960('0x23')](function(_0x54ed89){if(_0x54ed89){return _0x54ed89?{'count':_0x45f630,'rows':_0x54ed89}:null;}})[_0xb960('0x23')](respondWithResult(_0x36fdab,null))[_0xb960('0x3e')](handleError(_0x36fdab,null));};exports[_0xb960('0x4d')]=function(_0x1c1ab7,_0x377b46,_0x208860){if(_0x1c1ab7['body']['id']){delete _0x1c1ab7[_0xb960('0x45')]['id'];}return db[_0xb960('0x3c')][_0xb960('0x48')]({'where':{'id':_0x1c1ab7['params']['id']}})[_0xb960('0x23')](handleEntityNotFound(_0x377b46,null))[_0xb960('0x23')](function(_0x1e0fd6){if(_0x1e0fd6){_0x1c1ab7[_0xb960('0x45')][_0xb960('0x4e')]=_0x1e0fd6['id'];_0x1c1ab7['body']['Subjects']=integrations[_0xb960('0x4f')](_0x1c1ab7['body']['channel'],_0x1c1ab7[_0xb960('0x45')][_0xb960('0x2e')]);_0x1c1ab7[_0xb960('0x45')]['Descriptions']=integrations['getDescriptions'](_0x1c1ab7[_0xb960('0x45')][_0xb960('0x50')],_0x1c1ab7[_0xb960('0x45')][_0xb960('0x2e')]);return db[_0xb960('0x51')][_0xb960('0x44')](_0x1c1ab7['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xb960('0x52')},{'model':db[_0xb960('0x53')],'as':_0xb960('0x54')}]});}return null;})[_0xb960('0x23')](respondWithResult(_0x377b46,null))[_0xb960('0x3e')](handleError(_0x377b46,null));};exports['getFields']=function(_0x5a5a69,_0x7e7db5,_0x21a443){var _0x470b41='';var _0x2e9bcd=['id',_0xb960('0x28'),_0xb960('0x55'),_0xb960('0x56'),_0xb960('0x57'),_0xb960('0x58'),'duration_hours','duration_minutes',_0xb960('0x59'),'parent_type',_0xb960('0x5a'),_0xb960('0x5b')];return db[_0xb960('0x3c')][_0xb960('0x48')]({'where':{'id':_0x5a5a69[_0xb960('0x46')]['id']},'attributes':['id',_0xb960('0x5c'),_0xb960('0x5d'),_0xb960('0x5e')]})[_0xb960('0x23')](handleEntityNotFound(_0x7e7db5,null))[_0xb960('0x23')](function(_0x1d3bc8){if(_0x1d3bc8){_0x470b41=_0x1d3bc8[_0xb960('0x5e')];var _0x138bac=_0x470b41[_0xb960('0x5f')](-0x1);if(_0x138bac==='/'){_0x470b41=_0x470b41['substring'](0x0,_0x470b41[_0xb960('0x60')](_0x138bac));}return rp({'method':_0xb960('0x61'),'uri':util[_0xb960('0x62')](_0xb960('0x63'),_0x470b41,_0xb960('0x64')),'json':!![],'form':{'method':_0xb960('0x65'),'input_type':_0xb960('0x66'),'response_type':_0xb960('0x66'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1d3bc8[_0xb960('0x5c')],'password':_0x1d3bc8[_0xb960('0x5d')],'encryption':_0xb960('0x67')},'application':_0xb960('0x68')})}});}})[_0xb960('0x23')](function(_0x342103){if(_0x342103&&_0x342103[_0xb960('0x28')]!==_0xb960('0x69')&&_0x342103[_0xb960('0x28')]!==_0xb960('0x6a')){return rp({'method':_0xb960('0x61'),'uri':util['format'](_0xb960('0x63'),_0x470b41,_0xb960('0x64')),'json':!![],'form':{'method':_0xb960('0x6b'),'input_type':_0xb960('0x66'),'response_type':_0xb960('0x66'),'rest_data':JSON[_0xb960('0x6c')]({'session':_0x342103['id'],'module_name':_0xb960('0x6d')})}})[_0xb960('0x23')](function(_0x50050d){if(_0x50050d){var _0x5be0e2=_[_0xb960('0x6e')](_0x50050d[_0xb960('0x6f')]);_[_0xb960('0x70')](_0x5be0e2,function(_0x531d84){return _0x2e9bcd[_0xb960('0x71')](_0x531d84[_0xb960('0x28')]);});return{'count':_0x5be0e2[_0xb960('0x49')],'rows':_[_0xb960('0x2b')](_0x5be0e2,function(_0x2063b7){return{'id':_0x2063b7['name'],'name':_0x2063b7['label'],'custom':_[_0xb960('0x72')](_0x2063b7['name'],'_c')?!![]:![],'options':_0x2063b7[_0xb960('0x3b')]?_[_0xb960('0x2b')](_[_0xb960('0x6e')](_0x2063b7[_0xb960('0x3b')]),function(_0x32c79c){return{'name':_0x32c79c[_0xb960('0x73')],'value':_0x32c79c['name']};}):[]};})};}})[_0xb960('0x23')](respondWithResult(_0x7e7db5,null))[_0xb960('0x3e')](function(_0x389c26){var _0x5d8d15=_0x5a5a69[_0xb960('0x30')]['test']?0x1f4:_0x389c26[_0xb960('0x74')]||0x1f4;logger[_0xb960('0x26')](_0xb960('0x75'),_0xb960('0x76'),_0x5d8d15,JSON[_0xb960('0x6c')](_0x389c26));delete _0x389c26[_0xb960('0x28')];if(_0x5d8d15===0x191){_0x5d8d15=0x190;}_0x7e7db5[_0xb960('0x1d')](_0x5d8d15)[_0xb960('0x29')](_0x5a5a69['query']['test']?{'message':_0xb960('0x77'),'statusCode':_0x389c26['statusCode']}:_0x389c26);});}else{var _0x525ceb=0x1f4;_0x7e7db5['status'](_0x525ceb)[_0xb960('0x29')]({'message':_0xb960('0x77'),'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 98dc995..5cbefec 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 _0x3a26=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','int_sugarcrm_accounts'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x3a26,0x129));var _0x63a2=function(_0x470fe2,_0x3075ec){_0x470fe2=_0x470fe2-0x0;var _0x1a08e4=_0x3a26[_0x470fe2];return _0x1a08e4;};'use strict';var _=require(_0x63a2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x63a2('0x1'));var moment=require(_0x63a2('0x2'));var BPromise=require(_0x63a2('0x3'));var rp=require(_0x63a2('0x4'));var fs=require('fs');var path=require(_0x63a2('0x5'));var rimraf=require('rimraf');var config=require(_0x63a2('0x6'));var attributes=require(_0x63a2('0x7'));var integrations=require(_0x63a2('0x8'));module['exports']=function(_0x47023e,_0xd6eecd){return _0x47023e[_0x63a2('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x63a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa56=['path','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','int_sugarcrm_accounts','util','../../config/logger','moment','bluebird'];(function(_0x341c71,_0x34a496){var _0x592c44=function(_0x3811f5){while(--_0x3811f5){_0x341c71['push'](_0x341c71['shift']());}};_0x592c44(++_0x34a496);}(_0xaa56,0x1ac));var _0x6aa5=function(_0x271063,_0x25e55e){_0x271063=_0x271063-0x0;var _0x4d8367=_0xaa56[_0x271063];return _0x4d8367;};'use strict';var _=require('lodash');var util=require(_0x6aa5('0x0'));var logger=require(_0x6aa5('0x1'))('api');var moment=require(_0x6aa5('0x2'));var BPromise=require(_0x6aa5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6aa5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6aa5('0x5'));var integrations=require(_0x6aa5('0x6'));module[_0x6aa5('0x7')]=function(_0x13a9ef,_0x52b40a){return _0x13a9ef['define']('SugarcrmAccount',attributes,{'tableName':_0x6aa5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index eb7e6bf..2655065 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 _0xcb06=['find','where','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetSugarcrmAccount','options','raw','limit','include','map','model','attributes','ShowSugarcrmAccount','SugarcrmAccount'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcb06,0x6c));var _0x6cb0=function(_0x187efb,_0xcaa75){_0x187efb=_0x187efb-0x0;var _0x4d72f9=_0xcb06[_0x187efb];return _0x4d72f9;};'use strict';var _=require('lodash');var util=require(_0x6cb0('0x0'));var moment=require(_0x6cb0('0x1'));var BPromise=require(_0x6cb0('0x2'));var rs=require(_0x6cb0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6cb0('0x4'));var logger=require(_0x6cb0('0x5'))(_0x6cb0('0x6'));var config=require(_0x6cb0('0x7'));var jayson=require(_0x6cb0('0x8'));var client=jayson[_0x6cb0('0x9')][_0x6cb0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c6551,_0x24249b,_0x5c70b2){return new BPromise(function(_0x4cf25b,_0x5de46f){return client[_0x6cb0('0xb')](_0x5c6551,_0x5c70b2)[_0x6cb0('0xc')](function(_0x21276e){logger[_0x6cb0('0xd')](_0x6cb0('0xe'),_0x24249b,'request\x20sent');logger[_0x6cb0('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x24249b,_0x6cb0('0x10'),JSON['stringify'](_0x21276e));if(_0x21276e['error']){if(_0x21276e[_0x6cb0('0x11')][_0x6cb0('0x12')]===0x1f4){logger[_0x6cb0('0x11')](_0x6cb0('0xe'),_0x24249b,_0x21276e[_0x6cb0('0x11')][_0x6cb0('0x13')]);return _0x5de46f(_0x21276e['error'][_0x6cb0('0x13')]);}logger['error'](_0x6cb0('0xe'),_0x24249b,_0x21276e[_0x6cb0('0x11')][_0x6cb0('0x13')]);return _0x4cf25b(_0x21276e[_0x6cb0('0x11')]['message']);}else{logger[_0x6cb0('0xd')](_0x6cb0('0xe'),_0x24249b,_0x6cb0('0x10'));_0x4cf25b(_0x21276e[_0x6cb0('0x14')][_0x6cb0('0x13')]);}})[_0x6cb0('0x15')](function(_0x1b0fbc){logger[_0x6cb0('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x24249b,_0x1b0fbc);_0x5de46f(_0x1b0fbc);});});}exports[_0x6cb0('0x16')]=function(_0x526bde){var _0x5b97d1=this;return new Promise(function(_0x1c222a,_0x420bf3){return db['SugarcrmAccount']['findAll']({'raw':_0x526bde[_0x6cb0('0x17')]?_0x526bde[_0x6cb0('0x17')][_0x6cb0('0x18')]===undefined?!![]:![]:!![],'where':_0x526bde['options']?_0x526bde[_0x6cb0('0x17')]['where']||null:null,'attributes':_0x526bde[_0x6cb0('0x17')]?_0x526bde[_0x6cb0('0x17')]['attributes']||null:null,'limit':_0x526bde[_0x6cb0('0x17')]?_0x526bde[_0x6cb0('0x17')][_0x6cb0('0x19')]||null:null,'include':_0x526bde['options']?_0x526bde[_0x6cb0('0x17')][_0x6cb0('0x1a')]?_[_0x6cb0('0x1b')](_0x526bde['options']['include'],function(_0x56d0c8){return{'model':db[_0x56d0c8[_0x6cb0('0x1c')]],'as':_0x56d0c8['as'],'attributes':_0x56d0c8[_0x6cb0('0x1d')],'include':_0x56d0c8[_0x6cb0('0x1a')]?_[_0x6cb0('0x1b')](_0x56d0c8[_0x6cb0('0x1a')],function(_0x1521c6){return{'model':db[_0x1521c6['model']],'as':_0x1521c6['as'],'attributes':_0x1521c6[_0x6cb0('0x1d')],'include':_0x1521c6[_0x6cb0('0x1a')]?_['map'](_0x1521c6['include'],function(_0x29d1d2){return{'model':db[_0x29d1d2[_0x6cb0('0x1c')]],'as':_0x29d1d2['as'],'attributes':_0x29d1d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x6cb0('0xc')](function(_0x1eb391){logger['info'](_0x6cb0('0x16'),_0x526bde);logger['debug'](_0x6cb0('0x16'),_0x526bde,JSON['stringify'](_0x1eb391));_0x1c222a(_0x1eb391);})['catch'](function(_0x476c35){logger[_0x6cb0('0x11')]('GetSugarcrmAccount',_0x476c35[_0x6cb0('0x13')],_0x526bde);_0x420bf3(_0x5b97d1[_0x6cb0('0x11')](0x1f4,_0x476c35[_0x6cb0('0x13')]));});});};exports[_0x6cb0('0x1e')]=function(_0x275330){var _0x102f67=this;return new Promise(function(_0x3c06d7,_0xc1fd38){return db[_0x6cb0('0x1f')][_0x6cb0('0x20')]({'raw':_0x275330[_0x6cb0('0x17')]?_0x275330[_0x6cb0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x275330[_0x6cb0('0x17')]?_0x275330[_0x6cb0('0x17')][_0x6cb0('0x21')]||null:null,'attributes':_0x275330['options']?_0x275330[_0x6cb0('0x17')][_0x6cb0('0x1d')]||null:null,'include':_0x275330['options']?_0x275330[_0x6cb0('0x17')][_0x6cb0('0x1a')]?_[_0x6cb0('0x1b')](_0x275330[_0x6cb0('0x17')][_0x6cb0('0x1a')],function(_0x404aa4){return{'model':db[_0x404aa4[_0x6cb0('0x1c')]],'as':_0x404aa4['as'],'attributes':_0x404aa4['attributes'],'include':_0x404aa4[_0x6cb0('0x1a')]?_[_0x6cb0('0x1b')](_0x404aa4[_0x6cb0('0x1a')],function(_0x46c06e){return{'model':db[_0x46c06e['model']],'as':_0x46c06e['as'],'attributes':_0x46c06e['attributes'],'include':_0x46c06e['include']?_[_0x6cb0('0x1b')](_0x46c06e['include'],function(_0x349360){return{'model':db[_0x349360[_0x6cb0('0x1c')]],'as':_0x349360['as'],'attributes':_0x349360[_0x6cb0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6cb0('0xc')](function(_0x1ee70d){logger[_0x6cb0('0xd')]('ShowSugarcrmAccount',_0x275330);logger[_0x6cb0('0xf')](_0x6cb0('0x1e'),_0x275330,JSON[_0x6cb0('0x22')](_0x1ee70d));_0x3c06d7(_0x1ee70d);})['catch'](function(_0x3ca5d7){logger['error'](_0x6cb0('0x1e'),_0x3ca5d7[_0x6cb0('0x13')],_0x275330);_0xc1fd38(_0x102f67[_0x6cb0('0x11')](0x1f4,_0x3ca5d7[_0x6cb0('0x13')]));});});}; \ No newline at end of file +var _0xceca=['code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','include','model','map','where','then','ShowSugarcrmAccount','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1c7abf,_0x4964f1){var _0x42d357=function(_0x4b179e){while(--_0x4b179e){_0x1c7abf['push'](_0x1c7abf['shift']());}};_0x42d357(++_0x4964f1);}(_0xceca,0x142));var _0xacec=function(_0x190d47,_0x596418){_0x190d47=_0x190d47-0x0;var _0x3cea5f=_0xceca[_0x190d47];return _0x3cea5f;};'use strict';var _=require(_0xacec('0x0'));var util=require('util');var moment=require(_0xacec('0x1'));var BPromise=require('bluebird');var rs=require(_0xacec('0x2'));var fs=require('fs');var Redis=require(_0xacec('0x3'));var db=require(_0xacec('0x4'))['db'];var utils=require(_0xacec('0x5'));var logger=require(_0xacec('0x6'))(_0xacec('0x7'));var config=require(_0xacec('0x8'));var jayson=require(_0xacec('0x9'));var client=jayson['client'][_0xacec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b7b26,_0x3d0550,_0x1ad805){return new BPromise(function(_0x36e039,_0x41bf91){return client[_0xacec('0xb')](_0x3b7b26,_0x1ad805)['then'](function(_0xb1870b){logger[_0xacec('0xc')](_0xacec('0xd'),_0x3d0550,_0xacec('0xe'));logger[_0xacec('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x3d0550,'request\x20sent',JSON[_0xacec('0x10')](_0xb1870b));if(_0xb1870b[_0xacec('0x11')]){if(_0xb1870b[_0xacec('0x11')][_0xacec('0x12')]===0x1f4){logger[_0xacec('0x11')](_0xacec('0xd'),_0x3d0550,_0xb1870b[_0xacec('0x11')][_0xacec('0x13')]);return _0x41bf91(_0xb1870b[_0xacec('0x11')]['message']);}logger[_0xacec('0x11')](_0xacec('0xd'),_0x3d0550,_0xb1870b[_0xacec('0x11')]['message']);return _0x36e039(_0xb1870b[_0xacec('0x11')][_0xacec('0x13')]);}else{logger[_0xacec('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x3d0550,'request\x20sent');_0x36e039(_0xb1870b[_0xacec('0x14')][_0xacec('0x13')]);}})['catch'](function(_0x420e3b){logger[_0xacec('0x11')](_0xacec('0xd'),_0x3d0550,_0x420e3b);_0x41bf91(_0x420e3b);});});}exports[_0xacec('0x15')]=function(_0xa61f99){var _0x3fd5ed=this;return new Promise(function(_0x259cd2,_0x1c2cd6){return db[_0xacec('0x16')][_0xacec('0x17')]({'raw':_0xa61f99[_0xacec('0x18')]?_0xa61f99[_0xacec('0x18')][_0xacec('0x19')]===undefined?!![]:![]:!![],'where':_0xa61f99[_0xacec('0x18')]?_0xa61f99[_0xacec('0x18')]['where']||null:null,'attributes':_0xa61f99[_0xacec('0x18')]?_0xa61f99[_0xacec('0x18')][_0xacec('0x1a')]||null:null,'limit':_0xa61f99[_0xacec('0x18')]?_0xa61f99[_0xacec('0x18')]['limit']||null:null,'include':_0xa61f99['options']?_0xa61f99[_0xacec('0x18')][_0xacec('0x1b')]?_['map'](_0xa61f99[_0xacec('0x18')][_0xacec('0x1b')],function(_0x2444f1){return{'model':db[_0x2444f1[_0xacec('0x1c')]],'as':_0x2444f1['as'],'attributes':_0x2444f1[_0xacec('0x1a')],'include':_0x2444f1[_0xacec('0x1b')]?_[_0xacec('0x1d')](_0x2444f1[_0xacec('0x1b')],function(_0x2f056a){return{'model':db[_0x2f056a[_0xacec('0x1c')]],'as':_0x2f056a['as'],'attributes':_0x2f056a[_0xacec('0x1a')],'include':_0x2f056a[_0xacec('0x1b')]?_[_0xacec('0x1d')](_0x2f056a[_0xacec('0x1b')],function(_0x5adc50){return{'model':db[_0x5adc50[_0xacec('0x1c')]],'as':_0x5adc50['as'],'attributes':_0x5adc50[_0xacec('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c26a4){logger[_0xacec('0xc')](_0xacec('0x15'),_0xa61f99);logger[_0xacec('0xf')](_0xacec('0x15'),_0xa61f99,JSON['stringify'](_0x5c26a4));_0x259cd2(_0x5c26a4);})['catch'](function(_0x49ee02){logger['error']('GetSugarcrmAccount',_0x49ee02[_0xacec('0x13')],_0xa61f99);_0x1c2cd6(_0x3fd5ed[_0xacec('0x11')](0x1f4,_0x49ee02[_0xacec('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x45d828){var _0x361fda=this;return new Promise(function(_0x30b529,_0x7a5b9f){return db[_0xacec('0x16')]['find']({'raw':_0x45d828['options']?_0x45d828['options']['raw']===undefined?!![]:![]:!![],'where':_0x45d828['options']?_0x45d828[_0xacec('0x18')][_0xacec('0x1e')]||null:null,'attributes':_0x45d828[_0xacec('0x18')]?_0x45d828[_0xacec('0x18')][_0xacec('0x1a')]||null:null,'include':_0x45d828[_0xacec('0x18')]?_0x45d828['options']['include']?_[_0xacec('0x1d')](_0x45d828[_0xacec('0x18')][_0xacec('0x1b')],function(_0x176976){return{'model':db[_0x176976[_0xacec('0x1c')]],'as':_0x176976['as'],'attributes':_0x176976['attributes'],'include':_0x176976['include']?_[_0xacec('0x1d')](_0x176976[_0xacec('0x1b')],function(_0x102710){return{'model':db[_0x102710[_0xacec('0x1c')]],'as':_0x102710['as'],'attributes':_0x102710[_0xacec('0x1a')],'include':_0x102710[_0xacec('0x1b')]?_[_0xacec('0x1d')](_0x102710[_0xacec('0x1b')],function(_0x50201f){return{'model':db[_0x50201f[_0xacec('0x1c')]],'as':_0x50201f['as'],'attributes':_0x50201f['attributes']};}):[]};}):[]};}):[]:[]})[_0xacec('0x1f')](function(_0x1423e8){logger[_0xacec('0xc')](_0xacec('0x20'),_0x45d828);logger[_0xacec('0xf')](_0xacec('0x20'),_0x45d828,JSON[_0xacec('0x10')](_0x1423e8));_0x30b529(_0x1423e8);})[_0xacec('0x21')](function(_0x1bd7c7){logger[_0xacec('0x11')](_0xacec('0x20'),_0x1bd7c7[_0xacec('0x13')],_0x45d828);_0x7a5b9f(_0x361fda['error'](0x1f4,_0x1bd7c7[_0xacec('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index c54786c..0852b1c 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 _0x2aec=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','destroy','exports','multer'];(function(_0x366711,_0x2970b3){var _0x1980b1=function(_0x474b14){while(--_0x474b14){_0x366711['push'](_0x366711['shift']());}};_0x1980b1(++_0x2970b3);}(_0x2aec,0x13f));var _0xc2ae=function(_0x538a47,_0x30b94d){_0x538a47=_0x538a47-0x0;var _0x60f392=_0x2aec[_0x538a47];return _0x60f392;};'use strict';var multer=require(_0xc2ae('0x0'));var util=require('util');var path=require(_0xc2ae('0x1'));var timeout=require(_0xc2ae('0x2'));var express=require(_0xc2ae('0x3'));var router=express[_0xc2ae('0x4')]();var fs_extra=require(_0xc2ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc2ae('0x6'));var config=require(_0xc2ae('0x7'));var controller=require(_0xc2ae('0x8'));router[_0xc2ae('0x9')]('/',auth[_0xc2ae('0xa')](),controller[_0xc2ae('0xb')]);router['get'](_0xc2ae('0xc'),auth[_0xc2ae('0xa')](),controller[_0xc2ae('0xd')]);router['get']('/:id/fields',auth[_0xc2ae('0xa')](),controller['getFields']);router[_0xc2ae('0x9')](_0xc2ae('0xe'),auth[_0xc2ae('0xa')](),controller[_0xc2ae('0xf')]);router['get'](_0xc2ae('0x10'),auth[_0xc2ae('0xa')](),controller[_0xc2ae('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc2ae('0xc'),auth[_0xc2ae('0xa')](),controller['update']);router['delete'](_0xc2ae('0xc'),auth[_0xc2ae('0xa')](),controller[_0xc2ae('0x12')]);module[_0xc2ae('0x13')]=router; \ No newline at end of file +var _0x5c5c=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x4563a1,_0x789818){var _0x216e63=function(_0x1cdad5){while(--_0x1cdad5){_0x4563a1['push'](_0x4563a1['shift']());}};_0x216e63(++_0x789818);}(_0x5c5c,0xd2));var _0xc5c5=function(_0x10f6b1,_0x570e97){_0x10f6b1=_0x10f6b1-0x0;var _0xdba098=_0x5c5c[_0x10f6b1];return _0xdba098;};'use strict';var multer=require(_0xc5c5('0x0'));var util=require(_0xc5c5('0x1'));var path=require(_0xc5c5('0x2'));var timeout=require(_0xc5c5('0x3'));var express=require('express');var router=express[_0xc5c5('0x4')]();var fs_extra=require(_0xc5c5('0x5'));var auth=require(_0xc5c5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc5c5('0x7'));var controller=require(_0xc5c5('0x8'));router[_0xc5c5('0x9')]('/',auth[_0xc5c5('0xa')](),controller[_0xc5c5('0xb')]);router[_0xc5c5('0x9')](_0xc5c5('0xc'),auth[_0xc5c5('0xa')](),controller[_0xc5c5('0xd')]);router['get'](_0xc5c5('0xe'),auth['isAuthenticated'](),controller[_0xc5c5('0xf')]);router[_0xc5c5('0x9')](_0xc5c5('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xc5c5('0x9')](_0xc5c5('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xc5c5('0xa')](),controller[_0xc5c5('0x12')]);router['put'](_0xc5c5('0xc'),auth[_0xc5c5('0xa')](),controller[_0xc5c5('0x13')]);router['delete'](_0xc5c5('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 13a9fb7..d8f1beb 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 _0x079b=['exports','STRING','sequelize'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x079b,0x107));var _0xb079=function(_0x3e9650,_0x15c3d9){_0x3e9650=_0x3e9650-0x0;var _0x2921f7=_0x079b[_0x3e9650];return _0x2921f7;};'use strict';var Sequelize=require(_0xb079('0x0'));module[_0xb079('0x1')]={'name':{'type':Sequelize[_0xb079('0x2')]},'description':{'type':Sequelize[_0xb079('0x2')]}}; \ No newline at end of file +var _0x1b47=['STRING','sequelize','exports'];(function(_0x3f5038,_0x10cacd){var _0x140dbb=function(_0x5c1d29){while(--_0x5c1d29){_0x3f5038['push'](_0x3f5038['shift']());}};_0x140dbb(++_0x10cacd);}(_0x1b47,0x1b4));var _0x71b4=function(_0xee95aa,_0x56bc39){_0xee95aa=_0xee95aa-0x0;var _0x301db2=_0x1b47[_0xee95aa];return _0x301db2;};'use strict';var Sequelize=require(_0x71b4('0x0'));module[_0x71b4('0x1')]={'name':{'type':Sequelize[_0x71b4('0x2')]},'description':{'type':Sequelize[_0x71b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 4dc6f7c..ee99391 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 _0x14bc=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','SugarcrmField','getDescriptions','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x8a507a,_0x55b391){var _0xe00cd5=function(_0x500aaf){while(--_0x500aaf){_0x8a507a['push'](_0x8a507a['shift']());}};_0xe00cd5(++_0x55b391);}(_0x14bc,0x1e0));var _0xc14b=function(_0x199644,_0x32e91c){_0x199644=_0x199644-0x0;var _0x167d39=_0x14bc[_0x199644];return _0x167d39;};'use strict';var emlformat=require(_0xc14b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc14b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc14b('0x2'));var BPromise=require(_0xc14b('0x3'));var Mustache=require(_0xc14b('0x4'));var util=require(_0xc14b('0x5'));var path=require(_0xc14b('0x6'));var sox=require(_0xc14b('0x7'));var csv=require(_0xc14b('0x8'));var ejs=require(_0xc14b('0x9'));var fs=require('fs');var fs_extra=require(_0xc14b('0xa'));var _=require('lodash');var squel=require(_0xc14b('0xb'));var crypto=require(_0xc14b('0xc'));var jsforce=require(_0xc14b('0xd'));var deskjs=require(_0xc14b('0xe'));var toCsv=require(_0xc14b('0x8'));var querystring=require(_0xc14b('0xf'));var Papa=require(_0xc14b('0x10'));var Redis=require(_0xc14b('0x11'));var authService=require(_0xc14b('0x12'));var qs=require(_0xc14b('0x13'));var as=require(_0xc14b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc14b('0x15'));var utils=require(_0xc14b('0x16'));var config=require(_0xc14b('0x17'));var licenseUtil=require(_0xc14b('0x18'));var db=require(_0xc14b('0x19'))['db'];function respondWithStatusCode(_0x47209d,_0x4ee497){_0x4ee497=_0x4ee497||0xcc;return function(_0x2e7824){if(_0x2e7824){return _0x47209d[_0xc14b('0x1a')](_0x4ee497);}return _0x47209d[_0xc14b('0x1b')](_0x4ee497)[_0xc14b('0x1c')]();};}function respondWithResult(_0x1849aa,_0x569e2f){_0x569e2f=_0x569e2f||0xc8;return function(_0x26f49f){if(_0x26f49f){return _0x1849aa[_0xc14b('0x1b')](_0x569e2f)['json'](_0x26f49f);}};}function respondWithFilteredResult(_0x4b9913,_0x198a56){return function(_0x478f60){if(_0x478f60){var _0xd349bc=typeof _0x198a56[_0xc14b('0x1d')]===_0xc14b('0x1e')&&typeof _0x198a56[_0xc14b('0x1f')]===_0xc14b('0x1e');var _0x4fa55b=_0x478f60[_0xc14b('0x20')];var _0x38a0a2=_0xd349bc?0x0:_0x198a56[_0xc14b('0x1d')];var _0x3e2f1b=_0xd349bc?_0x478f60[_0xc14b('0x20')]:_0x198a56[_0xc14b('0x1d')]+_0x198a56[_0xc14b('0x1f')];var _0xb31691;if(_0x3e2f1b>=_0x4fa55b){_0x3e2f1b=_0x4fa55b;_0xb31691=0xc8;}else{_0xb31691=0xce;}_0x4b9913[_0xc14b('0x1b')](_0xb31691);return _0x4b9913[_0xc14b('0x21')](_0xc14b('0x22'),_0x38a0a2+'-'+_0x3e2f1b+'/'+_0x4fa55b)[_0xc14b('0x23')](_0x478f60);}return null;};}function patchUpdates(_0x163e24){return function(_0x4cadee){try{jsonpatch[_0xc14b('0x24')](_0x4cadee,_0x163e24,!![]);}catch(_0x736dc4){return BPromise[_0xc14b('0x25')](_0x736dc4);}return _0x4cadee['save']();};}function saveUpdates(_0x184aeb,_0x5087fd){return function(_0x518cb7){if(_0x518cb7){return _0x518cb7[_0xc14b('0x26')](_0x184aeb)[_0xc14b('0x27')](function(_0x222b59){return _0x222b59;});}return null;};}function removeEntity(_0x35308a,_0x539bf6){return function(_0x2a2e99){if(_0x2a2e99){return _0x2a2e99[_0xc14b('0x28')]()[_0xc14b('0x27')](function(){_0x35308a[_0xc14b('0x1b')](0xcc)[_0xc14b('0x1c')]();});}};}function handleEntityNotFound(_0x1d21e8,_0x437761){return function(_0x3a6689){if(!_0x3a6689){_0x1d21e8['sendStatus'](0x194);}return _0x3a6689;};}function handleError(_0x5d5cff,_0x1734b9){_0x1734b9=_0x1734b9||0x1f4;return function(_0x387754){logger[_0xc14b('0x29')](_0x387754[_0xc14b('0x2a')]);if(_0x387754[_0xc14b('0x2b')]){delete _0x387754['name'];}_0x5d5cff[_0xc14b('0x1b')](_0x1734b9)['send'](_0x387754);};}exports[_0xc14b('0x2c')]=function(_0x32699e,_0x4bc666){var _0x5c3fa7={},_0x36235d={},_0x4da9e0={'count':0x0,'rows':[]};var _0x519371=_[_0xc14b('0x2d')](db[_0xc14b('0x2e')]['rawAttributes'],function(_0x2e1f24){return{'name':_0x2e1f24[_0xc14b('0x2f')],'type':_0x2e1f24[_0xc14b('0x30')][_0xc14b('0x31')]};});_0x36235d[_0xc14b('0x32')]=_[_0xc14b('0x2d')](_0x519371,_0xc14b('0x2b'));_0x36235d[_0xc14b('0x33')]=_[_0xc14b('0x34')](_0x32699e[_0xc14b('0x33')]);_0x36235d[_0xc14b('0x35')]=_[_0xc14b('0x36')](_0x36235d[_0xc14b('0x32')],_0x36235d[_0xc14b('0x33')]);_0x5c3fa7['attributes']=_[_0xc14b('0x36')](_0x36235d[_0xc14b('0x32')],qs[_0xc14b('0x37')](_0x32699e[_0xc14b('0x33')][_0xc14b('0x37')]));_0x5c3fa7['attributes']=_0x5c3fa7[_0xc14b('0x38')][_0xc14b('0x39')]?_0x5c3fa7[_0xc14b('0x38')]:_0x36235d[_0xc14b('0x32')];if(!_0x32699e[_0xc14b('0x33')][_0xc14b('0x3a')](_0xc14b('0x3b'))){_0x5c3fa7[_0xc14b('0x1f')]=qs[_0xc14b('0x1f')](_0x32699e[_0xc14b('0x33')][_0xc14b('0x1f')]);_0x5c3fa7['offset']=qs[_0xc14b('0x1d')](_0x32699e[_0xc14b('0x33')][_0xc14b('0x1d')]);}_0x5c3fa7[_0xc14b('0x3c')]=qs[_0xc14b('0x3d')](_0x32699e[_0xc14b('0x33')][_0xc14b('0x3d')]);_0x5c3fa7['where']=qs[_0xc14b('0x35')](_[_0xc14b('0x3e')](_0x32699e[_0xc14b('0x33')],_0x36235d[_0xc14b('0x35')]),_0x519371);if(_0x32699e[_0xc14b('0x33')][_0xc14b('0x3f')]){_0x5c3fa7[_0xc14b('0x40')]=_[_0xc14b('0x41')](_0x5c3fa7[_0xc14b('0x40')],{'$or':_[_0xc14b('0x2d')](_0x519371,function(_0x45decd){if(_0x45decd[_0xc14b('0x30')]!==_0xc14b('0x42')){var _0x518ce0={};_0x518ce0[_0x45decd['name']]={'$like':'%'+_0x32699e[_0xc14b('0x33')][_0xc14b('0x3f')]+'%'};return _0x518ce0;}})});}_0x5c3fa7=_[_0xc14b('0x41')]({},_0x5c3fa7,_0x32699e[_0xc14b('0x43')]);var _0x18da24={'where':_0x5c3fa7[_0xc14b('0x40')]};return db[_0xc14b('0x2e')][_0xc14b('0x20')](_0x18da24)[_0xc14b('0x27')](function(_0x521ac8){_0x4da9e0[_0xc14b('0x20')]=_0x521ac8;if(_0x32699e[_0xc14b('0x33')][_0xc14b('0x44')]){_0x5c3fa7[_0xc14b('0x45')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xc14b('0x46')](_0x5c3fa7);})['then'](function(_0x1f1db2){_0x4da9e0[_0xc14b('0x47')]=_0x1f1db2;return _0x4da9e0;})[_0xc14b('0x27')](respondWithFilteredResult(_0x4bc666,_0x5c3fa7))[_0xc14b('0x48')](handleError(_0x4bc666,null));};exports[_0xc14b('0x49')]=function(_0x2562e7,_0x2941e6){var _0x5025e1={'raw':![],'where':{'id':_0x2562e7[_0xc14b('0x4a')]['id']}},_0x3f66a0={};_0x3f66a0[_0xc14b('0x32')]=_[_0xc14b('0x34')](db[_0xc14b('0x2e')][_0xc14b('0x4b')]);_0x3f66a0[_0xc14b('0x33')]=_[_0xc14b('0x34')](_0x2562e7['query']);_0x3f66a0[_0xc14b('0x35')]=_['intersection'](_0x3f66a0[_0xc14b('0x32')],_0x3f66a0[_0xc14b('0x33')]);_0x5025e1[_0xc14b('0x38')]=_[_0xc14b('0x36')](_0x3f66a0['model'],qs[_0xc14b('0x37')](_0x2562e7[_0xc14b('0x33')][_0xc14b('0x37')]));_0x5025e1[_0xc14b('0x38')]=_0x5025e1[_0xc14b('0x38')][_0xc14b('0x39')]?_0x5025e1[_0xc14b('0x38')]:_0x3f66a0[_0xc14b('0x32')];if(_0x2562e7[_0xc14b('0x33')]['includeAll']){_0x5025e1[_0xc14b('0x45')]=[{'all':!![]}];}_0x5025e1=_['merge']({},_0x5025e1,_0x2562e7[_0xc14b('0x43')]);return db['SugarcrmConfiguration'][_0xc14b('0x4c')](_0x5025e1)[_0xc14b('0x27')](handleEntityNotFound(_0x2941e6,null))[_0xc14b('0x27')](respondWithResult(_0x2941e6,null))[_0xc14b('0x48')](handleError(_0x2941e6,null));};exports[_0xc14b('0x4d')]=function(_0x5b7192,_0x29e430){return db[_0xc14b('0x2e')][_0xc14b('0x4d')](_0x5b7192[_0xc14b('0x4e')],{})[_0xc14b('0x27')](respondWithResult(_0x29e430,0xc9))['catch'](handleError(_0x29e430,null));};exports['update']=function(_0x1be7fc,_0x1d5a60){if(_0x1be7fc[_0xc14b('0x4e')]['id']){delete _0x1be7fc['body']['id'];}return db[_0xc14b('0x2e')]['find']({'where':{'id':_0x1be7fc[_0xc14b('0x4a')]['id']}})[_0xc14b('0x27')](handleEntityNotFound(_0x1d5a60,null))[_0xc14b('0x27')](saveUpdates(_0x1be7fc[_0xc14b('0x4e')],null))[_0xc14b('0x27')](respondWithResult(_0x1d5a60,null))[_0xc14b('0x48')](handleError(_0x1d5a60,null));};exports[_0xc14b('0x28')]=function(_0x13a3d5,_0x4d91b2){return db[_0xc14b('0x2e')][_0xc14b('0x4c')]({'where':{'id':_0x13a3d5[_0xc14b('0x4a')]['id']}})[_0xc14b('0x27')](handleEntityNotFound(_0x4d91b2,null))[_0xc14b('0x27')](removeEntity(_0x4d91b2,null))[_0xc14b('0x48')](handleError(_0x4d91b2,null));};exports[_0xc14b('0x4f')]=function(_0x153185,_0x185e0f,_0x194839){var _0x247eaf={};var _0x34c8b1={};var _0x46acd5;var _0x2ba56e;return db[_0xc14b('0x2e')][_0xc14b('0x50')]({'where':{'id':_0x153185['params']['id']}})[_0xc14b('0x27')](handleEntityNotFound(_0x185e0f,null))['then'](function(_0x490604){if(_0x490604){_0x46acd5=_0x490604;_0x34c8b1[_0xc14b('0x32')]=_[_0xc14b('0x34')](db[_0xc14b('0x51')]['rawAttributes']);_0x34c8b1[_0xc14b('0x33')]=_[_0xc14b('0x34')](_0x153185[_0xc14b('0x33')]);_0x34c8b1[_0xc14b('0x35')]=_[_0xc14b('0x36')](_0x34c8b1[_0xc14b('0x32')],_0x34c8b1['query']);_0x247eaf[_0xc14b('0x38')]=_[_0xc14b('0x36')](_0x34c8b1['model'],qs['fields'](_0x153185[_0xc14b('0x33')]['fields']));_0x247eaf[_0xc14b('0x38')]=_0x247eaf[_0xc14b('0x38')]['length']?_0x247eaf[_0xc14b('0x38')]:_0x34c8b1['model'];_0x247eaf[_0xc14b('0x3c')]=qs['sort'](_0x153185['query'][_0xc14b('0x3d')]);_0x247eaf[_0xc14b('0x40')]=qs[_0xc14b('0x35')](_[_0xc14b('0x3e')](_0x153185['query'],_0x34c8b1[_0xc14b('0x35')]));if(_0x153185['query'][_0xc14b('0x3f')]){_0x247eaf[_0xc14b('0x40')]=_[_0xc14b('0x41')](_0x247eaf[_0xc14b('0x40')],{'$or':_['map'](_0x247eaf[_0xc14b('0x38')],function(_0x42d8d0){var _0x379a5b={};_0x379a5b[_0x42d8d0]={'$like':'%'+_0x153185[_0xc14b('0x33')][_0xc14b('0x3f')]+'%'};return _0x379a5b;})});}_0x247eaf=_['merge']({},_0x247eaf,_0x153185['options']);return _0x46acd5['getFields'](_0x247eaf);}})[_0xc14b('0x27')](function(_0x216f7d){if(_0x216f7d){_0x2ba56e=_0x216f7d[_0xc14b('0x39')];if(!_0x153185[_0xc14b('0x33')][_0xc14b('0x3a')](_0xc14b('0x3b'))){_0x247eaf[_0xc14b('0x1f')]=qs['limit'](_0x153185[_0xc14b('0x33')][_0xc14b('0x1f')]);_0x247eaf[_0xc14b('0x1d')]=qs[_0xc14b('0x1d')](_0x153185['query'][_0xc14b('0x1d')]);}return _0x46acd5[_0xc14b('0x4f')](_0x247eaf);}})[_0xc14b('0x27')](function(_0x4cf033){if(_0x4cf033){return _0x4cf033?{'count':_0x2ba56e,'rows':_0x4cf033}:null;}})[_0xc14b('0x27')](respondWithResult(_0x185e0f,null))[_0xc14b('0x48')](handleError(_0x185e0f,null));};exports['getSubjects']=function(_0x3e595f,_0x2881d8,_0xff8482){var _0x51d48c={};var _0x118aa2={};var _0x5544b2;var _0x5d16bc;return db['SugarcrmConfiguration'][_0xc14b('0x50')]({'where':{'id':_0x3e595f[_0xc14b('0x4a')]['id']}})[_0xc14b('0x27')](handleEntityNotFound(_0x2881d8,null))['then'](function(_0x1e87eb){if(_0x1e87eb){_0x5544b2=_0x1e87eb;_0x118aa2['model']=_[_0xc14b('0x34')](db[_0xc14b('0x51')][_0xc14b('0x4b')]);_0x118aa2[_0xc14b('0x33')]=_['keys'](_0x3e595f['query']);_0x118aa2[_0xc14b('0x35')]=_[_0xc14b('0x36')](_0x118aa2[_0xc14b('0x32')],_0x118aa2[_0xc14b('0x33')]);_0x51d48c['attributes']=_[_0xc14b('0x36')](_0x118aa2[_0xc14b('0x32')],qs[_0xc14b('0x37')](_0x3e595f[_0xc14b('0x33')][_0xc14b('0x37')]));_0x51d48c[_0xc14b('0x38')]=_0x51d48c[_0xc14b('0x38')][_0xc14b('0x39')]?_0x51d48c['attributes']:_0x118aa2[_0xc14b('0x32')];_0x51d48c[_0xc14b('0x3c')]=qs[_0xc14b('0x3d')](_0x3e595f[_0xc14b('0x33')][_0xc14b('0x3d')]);_0x51d48c[_0xc14b('0x40')]=qs['filters'](_[_0xc14b('0x3e')](_0x3e595f['query'],_0x118aa2[_0xc14b('0x35')]));if(_0x3e595f['query'][_0xc14b('0x3f')]){_0x51d48c['where']=_[_0xc14b('0x41')](_0x51d48c[_0xc14b('0x40')],{'$or':_[_0xc14b('0x2d')](_0x51d48c[_0xc14b('0x38')],function(_0x57888e){var _0x4f2637={};_0x4f2637[_0x57888e]={'$like':'%'+_0x3e595f[_0xc14b('0x33')]['filter']+'%'};return _0x4f2637;})});}_0x51d48c=_[_0xc14b('0x41')]({},_0x51d48c,_0x3e595f[_0xc14b('0x43')]);return _0x5544b2['getSubjects'](_0x51d48c);}})[_0xc14b('0x27')](function(_0x150005){if(_0x150005){_0x5d16bc=_0x150005['length'];if(!_0x3e595f[_0xc14b('0x33')]['hasOwnProperty']('nolimit')){_0x51d48c[_0xc14b('0x1f')]=qs['limit'](_0x3e595f[_0xc14b('0x33')]['limit']);_0x51d48c['offset']=qs[_0xc14b('0x1d')](_0x3e595f[_0xc14b('0x33')][_0xc14b('0x1d')]);}return _0x5544b2['getSubjects'](_0x51d48c);}})[_0xc14b('0x27')](function(_0x2d4ae8){if(_0x2d4ae8){return _0x2d4ae8?{'count':_0x5d16bc,'rows':_0x2d4ae8}:null;}})[_0xc14b('0x27')](respondWithResult(_0x2881d8,null))[_0xc14b('0x48')](handleError(_0x2881d8,null));};exports[_0xc14b('0x52')]=function(_0x2de9c9,_0x55dec7,_0x170467){var _0x204ef5={};var _0x3ec122={};var _0x1081ad;var _0x222a15;return db[_0xc14b('0x2e')][_0xc14b('0x50')]({'where':{'id':_0x2de9c9[_0xc14b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x55dec7,null))[_0xc14b('0x27')](function(_0x55cc41){if(_0x55cc41){_0x1081ad=_0x55cc41;_0x3ec122[_0xc14b('0x32')]=_[_0xc14b('0x34')](db[_0xc14b('0x51')][_0xc14b('0x4b')]);_0x3ec122[_0xc14b('0x33')]=_[_0xc14b('0x34')](_0x2de9c9[_0xc14b('0x33')]);_0x3ec122[_0xc14b('0x35')]=_['intersection'](_0x3ec122['model'],_0x3ec122['query']);_0x204ef5[_0xc14b('0x38')]=_[_0xc14b('0x36')](_0x3ec122[_0xc14b('0x32')],qs[_0xc14b('0x37')](_0x2de9c9['query'][_0xc14b('0x37')]));_0x204ef5[_0xc14b('0x38')]=_0x204ef5[_0xc14b('0x38')]['length']?_0x204ef5['attributes']:_0x3ec122[_0xc14b('0x32')];_0x204ef5['order']=qs[_0xc14b('0x3d')](_0x2de9c9[_0xc14b('0x33')][_0xc14b('0x3d')]);_0x204ef5[_0xc14b('0x40')]=qs['filters'](_[_0xc14b('0x3e')](_0x2de9c9[_0xc14b('0x33')],_0x3ec122['filters']));if(_0x2de9c9[_0xc14b('0x33')][_0xc14b('0x3f')]){_0x204ef5[_0xc14b('0x40')]=_['merge'](_0x204ef5['where'],{'$or':_['map'](_0x204ef5[_0xc14b('0x38')],function(_0x392bf4){var _0x260e6c={};_0x260e6c[_0x392bf4]={'$like':'%'+_0x2de9c9['query'][_0xc14b('0x3f')]+'%'};return _0x260e6c;})});}_0x204ef5=_[_0xc14b('0x41')]({},_0x204ef5,_0x2de9c9['options']);return _0x1081ad[_0xc14b('0x52')](_0x204ef5);}})[_0xc14b('0x27')](function(_0x29b998){if(_0x29b998){_0x222a15=_0x29b998[_0xc14b('0x39')];if(!_0x2de9c9[_0xc14b('0x33')][_0xc14b('0x3a')](_0xc14b('0x3b'))){_0x204ef5[_0xc14b('0x1f')]=qs[_0xc14b('0x1f')](_0x2de9c9[_0xc14b('0x33')][_0xc14b('0x1f')]);_0x204ef5[_0xc14b('0x1d')]=qs[_0xc14b('0x1d')](_0x2de9c9['query']['offset']);}return _0x1081ad[_0xc14b('0x52')](_0x204ef5);}})['then'](function(_0x4ab308){if(_0x4ab308){return _0x4ab308?{'count':_0x222a15,'rows':_0x4ab308}:null;}})['then'](respondWithResult(_0x55dec7,null))[_0xc14b('0x48')](handleError(_0x55dec7,null));}; \ No newline at end of file +var _0xdaad=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','name','send','index','map','SugarcrmConfiguration','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll','options','find','catch','create','body','destroy','getFields','findOne','SugarcrmField','rawAttributes','pick','getSubjects','nolimit','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdaad,0x17e));var _0xddaa=function(_0x292ba8,_0x2545c5){_0x292ba8=_0x292ba8-0x0;var _0x499565=_0xdaad[_0x292ba8];return _0x499565;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xddaa('0x0'));var zipdir=require(_0xddaa('0x1'));var jsonpatch=require(_0xddaa('0x2'));var rp=require(_0xddaa('0x3'));var moment=require(_0xddaa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xddaa('0x5'));var util=require(_0xddaa('0x6'));var path=require('path');var sox=require(_0xddaa('0x7'));var csv=require(_0xddaa('0x8'));var ejs=require(_0xddaa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xddaa('0xa'));var squel=require(_0xddaa('0xb'));var crypto=require(_0xddaa('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xddaa('0xd'));var toCsv=require('to-csv');var querystring=require(_0xddaa('0xe'));var Papa=require(_0xddaa('0xf'));var Redis=require(_0xddaa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xddaa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddaa('0x12'));var logger=require(_0xddaa('0x13'))(_0xddaa('0x14'));var utils=require(_0xddaa('0x15'));var config=require(_0xddaa('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4797a2,_0x36f243){_0x36f243=_0x36f243||0xcc;return function(_0xbeb9ee){if(_0xbeb9ee){return _0x4797a2[_0xddaa('0x17')](_0x36f243);}return _0x4797a2['status'](_0x36f243)['end']();};}function respondWithResult(_0x1eb7c1,_0x12f35f){_0x12f35f=_0x12f35f||0xc8;return function(_0x3e814d){if(_0x3e814d){return _0x1eb7c1[_0xddaa('0x18')](_0x12f35f)[_0xddaa('0x19')](_0x3e814d);}};}function respondWithFilteredResult(_0x5e0e76,_0x1b4f52){return function(_0x3d4d2a){if(_0x3d4d2a){var _0x43b204=typeof _0x1b4f52[_0xddaa('0x1a')]===_0xddaa('0x1b')&&typeof _0x1b4f52[_0xddaa('0x1c')]===_0xddaa('0x1b');var _0x37428e=_0x3d4d2a[_0xddaa('0x1d')];var _0x5cd35b=_0x43b204?0x0:_0x1b4f52['offset'];var _0x326803=_0x43b204?_0x3d4d2a['count']:_0x1b4f52[_0xddaa('0x1a')]+_0x1b4f52[_0xddaa('0x1c')];var _0x39dc06;if(_0x326803>=_0x37428e){_0x326803=_0x37428e;_0x39dc06=0xc8;}else{_0x39dc06=0xce;}_0x5e0e76[_0xddaa('0x18')](_0x39dc06);return _0x5e0e76[_0xddaa('0x1e')]('Content-Range',_0x5cd35b+'-'+_0x326803+'/'+_0x37428e)[_0xddaa('0x19')](_0x3d4d2a);}return null;};}function patchUpdates(_0x4c29de){return function(_0x334999){try{jsonpatch[_0xddaa('0x1f')](_0x334999,_0x4c29de,!![]);}catch(_0x48f8ef){return BPromise[_0xddaa('0x20')](_0x48f8ef);}return _0x334999[_0xddaa('0x21')]();};}function saveUpdates(_0x581780,_0x3a49b7){return function(_0x1632cb){if(_0x1632cb){return _0x1632cb[_0xddaa('0x22')](_0x581780)[_0xddaa('0x23')](function(_0x23652c){return _0x23652c;});}return null;};}function removeEntity(_0x5f2761,_0x504157){return function(_0xbc7820){if(_0xbc7820){return _0xbc7820['destroy']()[_0xddaa('0x23')](function(){_0x5f2761[_0xddaa('0x18')](0xcc)[_0xddaa('0x24')]();});}};}function handleEntityNotFound(_0x5c0eba,_0x1c1d50){return function(_0x1d73cd){if(!_0x1d73cd){_0x5c0eba[_0xddaa('0x17')](0x194);}return _0x1d73cd;};}function handleError(_0x2d62fb,_0x4afaa5){_0x4afaa5=_0x4afaa5||0x1f4;return function(_0x19248f){logger[_0xddaa('0x25')](_0x19248f['stack']);if(_0x19248f[_0xddaa('0x26')]){delete _0x19248f[_0xddaa('0x26')];}_0x2d62fb['status'](_0x4afaa5)[_0xddaa('0x27')](_0x19248f);};}exports[_0xddaa('0x28')]=function(_0x235638,_0x521661){var _0x3a305e={},_0x163c6a={},_0x1c0a9d={'count':0x0,'rows':[]};var _0x36fa7e=_[_0xddaa('0x29')](db[_0xddaa('0x2a')]['rawAttributes'],function(_0x334d12){return{'name':_0x334d12[_0xddaa('0x2b')],'type':_0x334d12[_0xddaa('0x2c')]['key']};});_0x163c6a[_0xddaa('0x2d')]=_[_0xddaa('0x29')](_0x36fa7e,_0xddaa('0x26'));_0x163c6a['query']=_[_0xddaa('0x2e')](_0x235638[_0xddaa('0x2f')]);_0x163c6a['filters']=_[_0xddaa('0x30')](_0x163c6a[_0xddaa('0x2d')],_0x163c6a['query']);_0x3a305e[_0xddaa('0x31')]=_[_0xddaa('0x30')](_0x163c6a[_0xddaa('0x2d')],qs[_0xddaa('0x32')](_0x235638[_0xddaa('0x2f')][_0xddaa('0x32')]));_0x3a305e[_0xddaa('0x31')]=_0x3a305e['attributes'][_0xddaa('0x33')]?_0x3a305e[_0xddaa('0x31')]:_0x163c6a[_0xddaa('0x2d')];if(!_0x235638[_0xddaa('0x2f')][_0xddaa('0x34')]('nolimit')){_0x3a305e[_0xddaa('0x1c')]=qs[_0xddaa('0x1c')](_0x235638[_0xddaa('0x2f')]['limit']);_0x3a305e[_0xddaa('0x1a')]=qs[_0xddaa('0x1a')](_0x235638['query'][_0xddaa('0x1a')]);}_0x3a305e[_0xddaa('0x35')]=qs[_0xddaa('0x36')](_0x235638[_0xddaa('0x2f')]['sort']);_0x3a305e[_0xddaa('0x37')]=qs[_0xddaa('0x38')](_['pick'](_0x235638[_0xddaa('0x2f')],_0x163c6a['filters']),_0x36fa7e);if(_0x235638[_0xddaa('0x2f')][_0xddaa('0x39')]){_0x3a305e['where']=_[_0xddaa('0x3a')](_0x3a305e['where'],{'$or':_[_0xddaa('0x29')](_0x36fa7e,function(_0x58f7e9){if(_0x58f7e9['type']!==_0xddaa('0x3b')){var _0x1fef15={};_0x1fef15[_0x58f7e9[_0xddaa('0x26')]]={'$like':'%'+_0x235638[_0xddaa('0x2f')][_0xddaa('0x39')]+'%'};return _0x1fef15;}})});}_0x3a305e=_['merge']({},_0x3a305e,_0x235638['options']);var _0x49e82b={'where':_0x3a305e[_0xddaa('0x37')]};return db[_0xddaa('0x2a')]['count'](_0x49e82b)[_0xddaa('0x23')](function(_0x1d71ae){_0x1c0a9d[_0xddaa('0x1d')]=_0x1d71ae;if(_0x235638['query']['includeAll']){_0x3a305e['include']=[{'all':!![]}];}return db[_0xddaa('0x2a')][_0xddaa('0x3c')](_0x3a305e);})[_0xddaa('0x23')](function(_0x3f9ba6){_0x1c0a9d[_0xddaa('0x3d')]=_0x3f9ba6;return _0x1c0a9d;})[_0xddaa('0x23')](respondWithFilteredResult(_0x521661,_0x3a305e))['catch'](handleError(_0x521661,null));};exports[_0xddaa('0x3e')]=function(_0x32aeaf,_0x54f6b1){var _0x1d3f5e={'raw':![],'where':{'id':_0x32aeaf[_0xddaa('0x3f')]['id']}},_0x372c61={};_0x372c61[_0xddaa('0x2d')]=_[_0xddaa('0x2e')](db[_0xddaa('0x2a')]['rawAttributes']);_0x372c61[_0xddaa('0x2f')]=_['keys'](_0x32aeaf[_0xddaa('0x2f')]);_0x372c61[_0xddaa('0x38')]=_[_0xddaa('0x30')](_0x372c61[_0xddaa('0x2d')],_0x372c61[_0xddaa('0x2f')]);_0x1d3f5e['attributes']=_[_0xddaa('0x30')](_0x372c61[_0xddaa('0x2d')],qs['fields'](_0x32aeaf['query'][_0xddaa('0x32')]));_0x1d3f5e[_0xddaa('0x31')]=_0x1d3f5e[_0xddaa('0x31')][_0xddaa('0x33')]?_0x1d3f5e[_0xddaa('0x31')]:_0x372c61['model'];if(_0x32aeaf['query'][_0xddaa('0x40')]){_0x1d3f5e['include']=[{'all':!![]}];}_0x1d3f5e=_[_0xddaa('0x3a')]({},_0x1d3f5e,_0x32aeaf[_0xddaa('0x41')]);return db['SugarcrmConfiguration'][_0xddaa('0x42')](_0x1d3f5e)[_0xddaa('0x23')](handleEntityNotFound(_0x54f6b1,null))['then'](respondWithResult(_0x54f6b1,null))[_0xddaa('0x43')](handleError(_0x54f6b1,null));};exports['create']=function(_0x387449,_0x5b4126){return db[_0xddaa('0x2a')][_0xddaa('0x44')](_0x387449['body'],{})[_0xddaa('0x23')](respondWithResult(_0x5b4126,0xc9))['catch'](handleError(_0x5b4126,null));};exports[_0xddaa('0x22')]=function(_0x25dd47,_0x1b4866){if(_0x25dd47[_0xddaa('0x45')]['id']){delete _0x25dd47['body']['id'];}return db[_0xddaa('0x2a')]['find']({'where':{'id':_0x25dd47['params']['id']}})['then'](handleEntityNotFound(_0x1b4866,null))[_0xddaa('0x23')](saveUpdates(_0x25dd47[_0xddaa('0x45')],null))[_0xddaa('0x23')](respondWithResult(_0x1b4866,null))[_0xddaa('0x43')](handleError(_0x1b4866,null));};exports[_0xddaa('0x46')]=function(_0x2eb4d8,_0x3e0ccf){return db[_0xddaa('0x2a')][_0xddaa('0x42')]({'where':{'id':_0x2eb4d8[_0xddaa('0x3f')]['id']}})[_0xddaa('0x23')](handleEntityNotFound(_0x3e0ccf,null))[_0xddaa('0x23')](removeEntity(_0x3e0ccf,null))[_0xddaa('0x43')](handleError(_0x3e0ccf,null));};exports[_0xddaa('0x47')]=function(_0x229de0,_0x22620e,_0x415f0d){var _0x5e5bcc={};var _0x12ee86={};var _0x59707b;var _0x5cf0fa;return db['SugarcrmConfiguration'][_0xddaa('0x48')]({'where':{'id':_0x229de0[_0xddaa('0x3f')]['id']}})[_0xddaa('0x23')](handleEntityNotFound(_0x22620e,null))[_0xddaa('0x23')](function(_0xe15e7){if(_0xe15e7){_0x59707b=_0xe15e7;_0x12ee86[_0xddaa('0x2d')]=_[_0xddaa('0x2e')](db[_0xddaa('0x49')][_0xddaa('0x4a')]);_0x12ee86[_0xddaa('0x2f')]=_[_0xddaa('0x2e')](_0x229de0['query']);_0x12ee86['filters']=_[_0xddaa('0x30')](_0x12ee86[_0xddaa('0x2d')],_0x12ee86[_0xddaa('0x2f')]);_0x5e5bcc[_0xddaa('0x31')]=_[_0xddaa('0x30')](_0x12ee86[_0xddaa('0x2d')],qs['fields'](_0x229de0['query'][_0xddaa('0x32')]));_0x5e5bcc[_0xddaa('0x31')]=_0x5e5bcc[_0xddaa('0x31')][_0xddaa('0x33')]?_0x5e5bcc['attributes']:_0x12ee86['model'];_0x5e5bcc[_0xddaa('0x35')]=qs[_0xddaa('0x36')](_0x229de0[_0xddaa('0x2f')][_0xddaa('0x36')]);_0x5e5bcc[_0xddaa('0x37')]=qs['filters'](_[_0xddaa('0x4b')](_0x229de0[_0xddaa('0x2f')],_0x12ee86[_0xddaa('0x38')]));if(_0x229de0[_0xddaa('0x2f')][_0xddaa('0x39')]){_0x5e5bcc['where']=_[_0xddaa('0x3a')](_0x5e5bcc[_0xddaa('0x37')],{'$or':_[_0xddaa('0x29')](_0x5e5bcc[_0xddaa('0x31')],function(_0x292cc2){var _0xb3621a={};_0xb3621a[_0x292cc2]={'$like':'%'+_0x229de0[_0xddaa('0x2f')][_0xddaa('0x39')]+'%'};return _0xb3621a;})});}_0x5e5bcc=_[_0xddaa('0x3a')]({},_0x5e5bcc,_0x229de0[_0xddaa('0x41')]);return _0x59707b[_0xddaa('0x47')](_0x5e5bcc);}})[_0xddaa('0x23')](function(_0x546ba8){if(_0x546ba8){_0x5cf0fa=_0x546ba8['length'];if(!_0x229de0[_0xddaa('0x2f')][_0xddaa('0x34')]('nolimit')){_0x5e5bcc[_0xddaa('0x1c')]=qs[_0xddaa('0x1c')](_0x229de0[_0xddaa('0x2f')][_0xddaa('0x1c')]);_0x5e5bcc[_0xddaa('0x1a')]=qs[_0xddaa('0x1a')](_0x229de0[_0xddaa('0x2f')][_0xddaa('0x1a')]);}return _0x59707b[_0xddaa('0x47')](_0x5e5bcc);}})['then'](function(_0x2eaf2b){if(_0x2eaf2b){return _0x2eaf2b?{'count':_0x5cf0fa,'rows':_0x2eaf2b}:null;}})['then'](respondWithResult(_0x22620e,null))['catch'](handleError(_0x22620e,null));};exports[_0xddaa('0x4c')]=function(_0x50b188,_0x46fad3,_0x323098){var _0x109dcb={};var _0xc52f07={};var _0x30854c;var _0x1678cd;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x50b188[_0xddaa('0x3f')]['id']}})[_0xddaa('0x23')](handleEntityNotFound(_0x46fad3,null))[_0xddaa('0x23')](function(_0x1ada30){if(_0x1ada30){_0x30854c=_0x1ada30;_0xc52f07['model']=_[_0xddaa('0x2e')](db[_0xddaa('0x49')][_0xddaa('0x4a')]);_0xc52f07[_0xddaa('0x2f')]=_[_0xddaa('0x2e')](_0x50b188[_0xddaa('0x2f')]);_0xc52f07[_0xddaa('0x38')]=_['intersection'](_0xc52f07[_0xddaa('0x2d')],_0xc52f07[_0xddaa('0x2f')]);_0x109dcb[_0xddaa('0x31')]=_[_0xddaa('0x30')](_0xc52f07[_0xddaa('0x2d')],qs['fields'](_0x50b188[_0xddaa('0x2f')][_0xddaa('0x32')]));_0x109dcb['attributes']=_0x109dcb[_0xddaa('0x31')][_0xddaa('0x33')]?_0x109dcb[_0xddaa('0x31')]:_0xc52f07[_0xddaa('0x2d')];_0x109dcb['order']=qs[_0xddaa('0x36')](_0x50b188[_0xddaa('0x2f')][_0xddaa('0x36')]);_0x109dcb[_0xddaa('0x37')]=qs['filters'](_[_0xddaa('0x4b')](_0x50b188['query'],_0xc52f07[_0xddaa('0x38')]));if(_0x50b188[_0xddaa('0x2f')][_0xddaa('0x39')]){_0x109dcb['where']=_[_0xddaa('0x3a')](_0x109dcb['where'],{'$or':_['map'](_0x109dcb[_0xddaa('0x31')],function(_0x5c4665){var _0x33c601={};_0x33c601[_0x5c4665]={'$like':'%'+_0x50b188[_0xddaa('0x2f')]['filter']+'%'};return _0x33c601;})});}_0x109dcb=_[_0xddaa('0x3a')]({},_0x109dcb,_0x50b188[_0xddaa('0x41')]);return _0x30854c[_0xddaa('0x4c')](_0x109dcb);}})[_0xddaa('0x23')](function(_0x1f8fd7){if(_0x1f8fd7){_0x1678cd=_0x1f8fd7['length'];if(!_0x50b188['query'][_0xddaa('0x34')](_0xddaa('0x4d'))){_0x109dcb[_0xddaa('0x1c')]=qs[_0xddaa('0x1c')](_0x50b188[_0xddaa('0x2f')][_0xddaa('0x1c')]);_0x109dcb[_0xddaa('0x1a')]=qs[_0xddaa('0x1a')](_0x50b188['query'][_0xddaa('0x1a')]);}return _0x30854c['getSubjects'](_0x109dcb);}})['then'](function(_0x1a60d8){if(_0x1a60d8){return _0x1a60d8?{'count':_0x1678cd,'rows':_0x1a60d8}:null;}})['then'](respondWithResult(_0x46fad3,null))['catch'](handleError(_0x46fad3,null));};exports[_0xddaa('0x4e')]=function(_0x457f16,_0x3cc747,_0x67a3b0){var _0x45b4bf={};var _0x267c9e={};var _0x3343b5;var _0x50fcd2;return db[_0xddaa('0x2a')][_0xddaa('0x48')]({'where':{'id':_0x457f16[_0xddaa('0x3f')]['id']}})[_0xddaa('0x23')](handleEntityNotFound(_0x3cc747,null))[_0xddaa('0x23')](function(_0x322e52){if(_0x322e52){_0x3343b5=_0x322e52;_0x267c9e[_0xddaa('0x2d')]=_['keys'](db[_0xddaa('0x49')][_0xddaa('0x4a')]);_0x267c9e[_0xddaa('0x2f')]=_[_0xddaa('0x2e')](_0x457f16['query']);_0x267c9e[_0xddaa('0x38')]=_[_0xddaa('0x30')](_0x267c9e[_0xddaa('0x2d')],_0x267c9e[_0xddaa('0x2f')]);_0x45b4bf[_0xddaa('0x31')]=_['intersection'](_0x267c9e[_0xddaa('0x2d')],qs['fields'](_0x457f16[_0xddaa('0x2f')][_0xddaa('0x32')]));_0x45b4bf[_0xddaa('0x31')]=_0x45b4bf[_0xddaa('0x31')][_0xddaa('0x33')]?_0x45b4bf[_0xddaa('0x31')]:_0x267c9e['model'];_0x45b4bf[_0xddaa('0x35')]=qs[_0xddaa('0x36')](_0x457f16[_0xddaa('0x2f')][_0xddaa('0x36')]);_0x45b4bf[_0xddaa('0x37')]=qs[_0xddaa('0x38')](_[_0xddaa('0x4b')](_0x457f16[_0xddaa('0x2f')],_0x267c9e[_0xddaa('0x38')]));if(_0x457f16['query'][_0xddaa('0x39')]){_0x45b4bf[_0xddaa('0x37')]=_[_0xddaa('0x3a')](_0x45b4bf[_0xddaa('0x37')],{'$or':_[_0xddaa('0x29')](_0x45b4bf[_0xddaa('0x31')],function(_0x259456){var _0x13c5c9={};_0x13c5c9[_0x259456]={'$like':'%'+_0x457f16[_0xddaa('0x2f')][_0xddaa('0x39')]+'%'};return _0x13c5c9;})});}_0x45b4bf=_[_0xddaa('0x3a')]({},_0x45b4bf,_0x457f16['options']);return _0x3343b5['getDescriptions'](_0x45b4bf);}})[_0xddaa('0x23')](function(_0x150ff5){if(_0x150ff5){_0x50fcd2=_0x150ff5[_0xddaa('0x33')];if(!_0x457f16[_0xddaa('0x2f')]['hasOwnProperty'](_0xddaa('0x4d'))){_0x45b4bf['limit']=qs['limit'](_0x457f16['query']['limit']);_0x45b4bf[_0xddaa('0x1a')]=qs[_0xddaa('0x1a')](_0x457f16[_0xddaa('0x2f')][_0xddaa('0x1a')]);}return _0x3343b5[_0xddaa('0x4e')](_0x45b4bf);}})[_0xddaa('0x23')](function(_0x47ae29){if(_0x47ae29){return _0x47ae29?{'count':_0x50fcd2,'rows':_0x47ae29}:null;}})[_0xddaa('0x23')](respondWithResult(_0x3cc747,null))[_0xddaa('0x43')](handleError(_0x3cc747,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 30e8ebe..cd28ab2 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 _0x99b1=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x2ec546,_0x33ce0a){var _0x226d5d=function(_0x47bea5){while(--_0x47bea5){_0x2ec546['push'](_0x2ec546['shift']());}};_0x226d5d(++_0x33ce0a);}(_0x99b1,0x1bd));var _0x199b=function(_0x730cca,_0x4f1b33){_0x730cca=_0x730cca-0x0;var _0x5cc535=_0x99b1[_0x730cca];return _0x5cc535;};'use strict';var _=require(_0x199b('0x0'));var util=require(_0x199b('0x1'));var logger=require(_0x199b('0x2'))(_0x199b('0x3'));var moment=require(_0x199b('0x4'));var BPromise=require('bluebird');var rp=require(_0x199b('0x5'));var fs=require('fs');var path=require(_0x199b('0x6'));var rimraf=require(_0x199b('0x7'));var config=require(_0x199b('0x8'));var attributes=require(_0x199b('0x9'));module[_0x199b('0xa')]=function(_0x39f546,_0x19782d){return _0x39f546[_0x199b('0xb')](_0x199b('0xc'),attributes,{'tableName':_0x199b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34dd=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','request-promise','path','../../config/environment'];(function(_0x2107f0,_0x3afad6){var _0x5bb38c=function(_0x3ff0e5){while(--_0x3ff0e5){_0x2107f0['push'](_0x2107f0['shift']());}};_0x5bb38c(++_0x3afad6);}(_0x34dd,0x195));var _0xd34d=function(_0x3b9450,_0x318ec7){_0x3b9450=_0x3b9450-0x0;var _0x3d6501=_0x34dd[_0x3b9450];return _0x3d6501;};'use strict';var _=require('lodash');var util=require(_0xd34d('0x0'));var logger=require(_0xd34d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd34d('0x2'));var fs=require('fs');var path=require(_0xd34d('0x3'));var rimraf=require('rimraf');var config=require(_0xd34d('0x4'));var attributes=require(_0xd34d('0x5'));module[_0xd34d('0x6')]=function(_0x566d83,_0x4ea83e){return _0x566d83[_0xd34d('0x7')](_0xd34d('0x8'),attributes,{'tableName':_0xd34d('0x9'),'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 4bd26e0..9eb19e8 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 _0x82ed=['then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x2b3632,_0x5aa6b1){var _0x110d6c=function(_0x211fe8){while(--_0x211fe8){_0x2b3632['push'](_0x2b3632['shift']());}};_0x110d6c(++_0x5aa6b1);}(_0x82ed,0x17c));var _0xd82e=function(_0x1c73b1,_0x5c6f36){_0x1c73b1=_0x1c73b1-0x0;var _0x4b9c7c=_0x82ed[_0x1c73b1];return _0x4b9c7c;};'use strict';var _=require(_0xd82e('0x0'));var util=require(_0xd82e('0x1'));var moment=require(_0xd82e('0x2'));var BPromise=require(_0xd82e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd82e('0x4'));var db=require(_0xd82e('0x5'))['db'];var utils=require(_0xd82e('0x6'));var logger=require(_0xd82e('0x7'))(_0xd82e('0x8'));var config=require(_0xd82e('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x160520,_0x287f89,_0xa1e280){return new BPromise(function(_0x23c63c,_0x4beae5){return client[_0xd82e('0xa')](_0x160520,_0xa1e280)[_0xd82e('0xb')](function(_0xce4465){logger['info'](_0xd82e('0xc'),_0x287f89,_0xd82e('0xd'));logger[_0xd82e('0xe')](_0xd82e('0xf'),_0x287f89,'request\x20sent',JSON[_0xd82e('0x10')](_0xce4465));if(_0xce4465[_0xd82e('0x11')]){if(_0xce4465[_0xd82e('0x11')][_0xd82e('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x287f89,_0xce4465[_0xd82e('0x11')][_0xd82e('0x13')]);return _0x4beae5(_0xce4465['error'][_0xd82e('0x13')]);}logger[_0xd82e('0x11')](_0xd82e('0xc'),_0x287f89,_0xce4465[_0xd82e('0x11')]['message']);return _0x23c63c(_0xce4465[_0xd82e('0x11')][_0xd82e('0x13')]);}else{logger[_0xd82e('0x14')](_0xd82e('0xc'),_0x287f89,_0xd82e('0xd'));_0x23c63c(_0xce4465[_0xd82e('0x15')]['message']);}})[_0xd82e('0x16')](function(_0x1b714d){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x287f89,_0x1b714d);_0x4beae5(_0x1b714d);});});} \ No newline at end of file +var _0x8cec=['error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2f8159,_0x55805e){var _0x16782e=function(_0x1ca02b){while(--_0x1ca02b){_0x2f8159['push'](_0x2f8159['shift']());}};_0x16782e(++_0x55805e);}(_0x8cec,0xe0));var _0xc8ce=function(_0x23ccd8,_0x13da70){_0x23ccd8=_0x23ccd8-0x0;var _0x2f1fd8=_0x8cec[_0x23ccd8];return _0x2f1fd8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc8ce('0x0'));var BPromise=require(_0xc8ce('0x1'));var rs=require(_0xc8ce('0x2'));var fs=require('fs');var Redis=require(_0xc8ce('0x3'));var db=require(_0xc8ce('0x4'))['db'];var utils=require(_0xc8ce('0x5'));var logger=require('../../config/logger')(_0xc8ce('0x6'));var config=require(_0xc8ce('0x7'));var jayson=require(_0xc8ce('0x8'));var client=jayson[_0xc8ce('0x9')][_0xc8ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36ce6d,_0x4a22f7,_0x25e081){return new BPromise(function(_0x507d34,_0x5bddcd){return client[_0xc8ce('0xb')](_0x36ce6d,_0x25e081)[_0xc8ce('0xc')](function(_0x23cae3){logger[_0xc8ce('0xd')](_0xc8ce('0xe'),_0x4a22f7,_0xc8ce('0xf'));logger[_0xc8ce('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4a22f7,_0xc8ce('0xf'),JSON[_0xc8ce('0x11')](_0x23cae3));if(_0x23cae3[_0xc8ce('0x12')]){if(_0x23cae3[_0xc8ce('0x12')][_0xc8ce('0x13')]===0x1f4){logger[_0xc8ce('0x12')](_0xc8ce('0xe'),_0x4a22f7,_0x23cae3['error'][_0xc8ce('0x14')]);return _0x5bddcd(_0x23cae3[_0xc8ce('0x12')]['message']);}logger[_0xc8ce('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a22f7,_0x23cae3[_0xc8ce('0x12')][_0xc8ce('0x14')]);return _0x507d34(_0x23cae3['error'][_0xc8ce('0x14')]);}else{logger['info'](_0xc8ce('0xe'),_0x4a22f7,_0xc8ce('0xf'));_0x507d34(_0x23cae3[_0xc8ce('0x15')][_0xc8ce('0x14')]);}})['catch'](function(_0x4b5f50){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a22f7,_0x4b5f50);_0x5bddcd(_0x4b5f50);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 6b5e2e2..03a56e0 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 _0xd597=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports'];(function(_0x598b37,_0x39e238){var _0x344326=function(_0xf02d63){while(--_0xf02d63){_0x598b37['push'](_0x598b37['shift']());}};_0x344326(++_0x39e238);}(_0xd597,0x190));var _0x7d59=function(_0x282302,_0x4912ae){_0x282302=_0x282302-0x0;var _0x5d61ae=_0xd597[_0x282302];return _0x5d61ae;};'use strict';var multer=require(_0x7d59('0x0'));var util=require(_0x7d59('0x1'));var path=require(_0x7d59('0x2'));var timeout=require('connect-timeout');var express=require(_0x7d59('0x3'));var router=express[_0x7d59('0x4')]();var fs_extra=require(_0x7d59('0x5'));var auth=require(_0x7d59('0x6'));var interaction=require(_0x7d59('0x7'));var config=require(_0x7d59('0x8'));var controller=require(_0x7d59('0x9'));router[_0x7d59('0xa')]('/',auth[_0x7d59('0xb')](),controller[_0x7d59('0xc')]);router[_0x7d59('0xa')](_0x7d59('0xd'),auth[_0x7d59('0xb')](),controller[_0x7d59('0xe')]);router[_0x7d59('0xf')]('/',auth[_0x7d59('0xb')](),controller[_0x7d59('0x10')]);router[_0x7d59('0x11')](_0x7d59('0xd'),auth[_0x7d59('0xb')](),controller['update']);router['delete'](_0x7d59('0xd'),auth['isAuthenticated'](),controller[_0x7d59('0x12')]);module[_0x7d59('0x13')]=router; \ No newline at end of file +var _0xa1c0=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','/:id','isAuthenticated','create','update'];(function(_0xc4e81c,_0x1894bf){var _0x11e9d9=function(_0xee2867){while(--_0xee2867){_0xc4e81c['push'](_0xc4e81c['shift']());}};_0x11e9d9(++_0x1894bf);}(_0xa1c0,0x1c5));var _0x0a1c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa1c0[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x0a1c('0x0'));var path=require(_0x0a1c('0x1'));var timeout=require(_0x0a1c('0x2'));var express=require(_0x0a1c('0x3'));var router=express[_0x0a1c('0x4')]();var fs_extra=require(_0x0a1c('0x5'));var auth=require(_0x0a1c('0x6'));var interaction=require(_0x0a1c('0x7'));var config=require(_0x0a1c('0x8'));var controller=require(_0x0a1c('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0a1c('0xa')](_0x0a1c('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0a1c('0xc')](),controller[_0x0a1c('0xd')]);router['put'](_0x0a1c('0xb'),auth['isAuthenticated'](),controller[_0x0a1c('0xe')]);router[_0x0a1c('0xf')]('/:id',auth[_0x0a1c('0xc')](),controller[_0x0a1c('0x10')]);module[_0x0a1c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8dea878..cdf4c38 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 _0x8894=['keyValue','picklist','string','STRING','variable','BOOLEAN','sequelize','ENUM','customVariable'];(function(_0x13d765,_0x41b11f){var _0x2d237f=function(_0x3f57b6){while(--_0x3f57b6){_0x13d765['push'](_0x13d765['shift']());}};_0x2d237f(++_0x41b11f);}(_0x8894,0xf0));var _0x4889=function(_0x41046c,_0x4a7742){_0x41046c=_0x41046c-0x0;var _0x2ddd3f=_0x8894[_0x41046c];return _0x2ddd3f;};'use strict';var Sequelize=require(_0x4889('0x0'));module['exports']={'type':{'type':Sequelize[_0x4889('0x1')]('string','variable',_0x4889('0x2'),_0x4889('0x3'),_0x4889('0x4')),'defaultValue':_0x4889('0x5')},'content':{'type':Sequelize[_0x4889('0x6')]},'key':{'type':Sequelize[_0x4889('0x6')]},'keyType':{'type':Sequelize[_0x4889('0x1')](_0x4889('0x5'),_0x4889('0x7'),_0x4889('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4889('0x6')]},'nameField':{'type':Sequelize[_0x4889('0x6')]},'customField':{'type':Sequelize[_0x4889('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4889('0x6')]}}; \ No newline at end of file +var _0x122d=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x240611,_0x114055){var _0x95cbe2=function(_0x5c12d2){while(--_0x5c12d2){_0x240611['push'](_0x240611['shift']());}};_0x95cbe2(++_0x114055);}(_0x122d,0x11b));var _0xd122=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x122d[_0x1dc24d];return _0x5d7fb2;};'use strict';var Sequelize=require(_0xd122('0x0'));module[_0xd122('0x1')]={'type':{'type':Sequelize[_0xd122('0x2')](_0xd122('0x3'),_0xd122('0x4'),_0xd122('0x5'),_0xd122('0x6'),'picklist'),'defaultValue':_0xd122('0x3')},'content':{'type':Sequelize[_0xd122('0x7')]},'key':{'type':Sequelize[_0xd122('0x7')]},'keyType':{'type':Sequelize[_0xd122('0x2')](_0xd122('0x3'),_0xd122('0x4'),_0xd122('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd122('0x7')]},'customField':{'type':Sequelize[_0xd122('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd122('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 25ee488..35ef640 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 _0x23ea=['findAll','rows','show','params','length','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x5cf7cc,_0x292efc){var _0x5b739f=function(_0xf14879){while(--_0xf14879){_0x5cf7cc['push'](_0x5cf7cc['shift']());}};_0x5b739f(++_0x292efc);}(_0x23ea,0xa1));var _0xa23e=function(_0x3c9f56,_0x198760){_0x3c9f56=_0x3c9f56-0x0;var _0x33f1be=_0x23ea[_0x3c9f56];return _0x33f1be;};'use strict';var emlformat=require(_0xa23e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa23e('0x1'));var jsonpatch=require(_0xa23e('0x2'));var rp=require(_0xa23e('0x3'));var moment=require(_0xa23e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa23e('0x5'));var util=require(_0xa23e('0x6'));var path=require(_0xa23e('0x7'));var sox=require(_0xa23e('0x8'));var csv=require(_0xa23e('0x9'));var ejs=require(_0xa23e('0xa'));var fs=require('fs');var fs_extra=require(_0xa23e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa23e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa23e('0xd'));var toCsv=require(_0xa23e('0x9'));var querystring=require('querystring');var Papa=require(_0xa23e('0xe'));var Redis=require(_0xa23e('0xf'));var authService=require(_0xa23e('0x10'));var qs=require(_0xa23e('0x11'));var as=require(_0xa23e('0x12'));var hardwareService=require(_0xa23e('0x13'));var logger=require(_0xa23e('0x14'))(_0xa23e('0x15'));var utils=require(_0xa23e('0x16'));var config=require(_0xa23e('0x17'));var licenseUtil=require(_0xa23e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1edd92,_0x4bb176){_0x4bb176=_0x4bb176||0xcc;return function(_0x50b72b){if(_0x50b72b){return _0x1edd92['sendStatus'](_0x4bb176);}return _0x1edd92['status'](_0x4bb176)['end']();};}function respondWithResult(_0x5e4e2c,_0x20c039){_0x20c039=_0x20c039||0xc8;return function(_0x2d11da){if(_0x2d11da){return _0x5e4e2c[_0xa23e('0x19')](_0x20c039)[_0xa23e('0x1a')](_0x2d11da);}};}function respondWithFilteredResult(_0x4e23da,_0x1d4a59){return function(_0x33760b){if(_0x33760b){var _0x87dd1c=typeof _0x1d4a59[_0xa23e('0x1b')]==='undefined'&&typeof _0x1d4a59[_0xa23e('0x1c')]===_0xa23e('0x1d');var _0x4897d3=_0x33760b['count'];var _0x5b37ed=_0x87dd1c?0x0:_0x1d4a59[_0xa23e('0x1b')];var _0x52f307=_0x87dd1c?_0x33760b[_0xa23e('0x1e')]:_0x1d4a59[_0xa23e('0x1b')]+_0x1d4a59[_0xa23e('0x1c')];var _0x4d99df;if(_0x52f307>=_0x4897d3){_0x52f307=_0x4897d3;_0x4d99df=0xc8;}else{_0x4d99df=0xce;}_0x4e23da[_0xa23e('0x19')](_0x4d99df);return _0x4e23da[_0xa23e('0x1f')](_0xa23e('0x20'),_0x5b37ed+'-'+_0x52f307+'/'+_0x4897d3)['json'](_0x33760b);}return null;};}function patchUpdates(_0x31afbb){return function(_0x1f5400){try{jsonpatch[_0xa23e('0x21')](_0x1f5400,_0x31afbb,!![]);}catch(_0x407271){return BPromise[_0xa23e('0x22')](_0x407271);}return _0x1f5400['save']();};}function saveUpdates(_0x8f9982,_0x47b6bb){return function(_0x3e17ed){if(_0x3e17ed){return _0x3e17ed[_0xa23e('0x23')](_0x8f9982)[_0xa23e('0x24')](function(_0x3887ac){return _0x3887ac;});}return null;};}function removeEntity(_0x2237b3,_0x40a053){return function(_0x2d9293){if(_0x2d9293){return _0x2d9293[_0xa23e('0x25')]()['then'](function(){_0x2237b3['status'](0xcc)[_0xa23e('0x26')]();});}};}function handleEntityNotFound(_0x8b9949,_0x3b3acb){return function(_0x377575){if(!_0x377575){_0x8b9949[_0xa23e('0x27')](0x194);}return _0x377575;};}function handleError(_0x25bea9,_0x338723){_0x338723=_0x338723||0x1f4;return function(_0x40758a){logger[_0xa23e('0x28')](_0x40758a[_0xa23e('0x29')]);if(_0x40758a[_0xa23e('0x2a')]){delete _0x40758a['name'];}_0x25bea9[_0xa23e('0x19')](_0x338723)['send'](_0x40758a);};}exports[_0xa23e('0x2b')]=function(_0x2316d6,_0x4db762){var _0xf19d2e={},_0x343673={},_0xf1143c={'count':0x0,'rows':[]};var _0x457786=_[_0xa23e('0x2c')](db[_0xa23e('0x2d')][_0xa23e('0x2e')],function(_0x31c558){return{'name':_0x31c558[_0xa23e('0x2f')],'type':_0x31c558['type'][_0xa23e('0x30')]};});_0x343673[_0xa23e('0x31')]=_[_0xa23e('0x2c')](_0x457786,'name');_0x343673['query']=_[_0xa23e('0x32')](_0x2316d6[_0xa23e('0x33')]);_0x343673[_0xa23e('0x34')]=_[_0xa23e('0x35')](_0x343673['model'],_0x343673[_0xa23e('0x33')]);_0xf19d2e['attributes']=_['intersection'](_0x343673[_0xa23e('0x31')],qs[_0xa23e('0x36')](_0x2316d6['query'][_0xa23e('0x36')]));_0xf19d2e[_0xa23e('0x37')]=_0xf19d2e[_0xa23e('0x37')]['length']?_0xf19d2e['attributes']:_0x343673[_0xa23e('0x31')];if(!_0x2316d6[_0xa23e('0x33')][_0xa23e('0x38')]('nolimit')){_0xf19d2e[_0xa23e('0x1c')]=qs[_0xa23e('0x1c')](_0x2316d6[_0xa23e('0x33')][_0xa23e('0x1c')]);_0xf19d2e[_0xa23e('0x1b')]=qs[_0xa23e('0x1b')](_0x2316d6[_0xa23e('0x33')][_0xa23e('0x1b')]);}_0xf19d2e[_0xa23e('0x39')]=qs[_0xa23e('0x3a')](_0x2316d6[_0xa23e('0x33')][_0xa23e('0x3a')]);_0xf19d2e['where']=qs[_0xa23e('0x34')](_['pick'](_0x2316d6['query'],_0x343673['filters']),_0x457786);if(_0x2316d6['query'][_0xa23e('0x3b')]){_0xf19d2e[_0xa23e('0x3c')]=_[_0xa23e('0x3d')](_0xf19d2e[_0xa23e('0x3c')],{'$or':_[_0xa23e('0x2c')](_0x457786,function(_0x15050c){if(_0x15050c[_0xa23e('0x3e')]!==_0xa23e('0x3f')){var _0x5b02e2={};_0x5b02e2[_0x15050c[_0xa23e('0x2a')]]={'$like':'%'+_0x2316d6[_0xa23e('0x33')][_0xa23e('0x3b')]+'%'};return _0x5b02e2;}})});}_0xf19d2e=_[_0xa23e('0x3d')]({},_0xf19d2e,_0x2316d6[_0xa23e('0x40')]);var _0x33b5db={'where':_0xf19d2e['where']};return db[_0xa23e('0x2d')][_0xa23e('0x1e')](_0x33b5db)[_0xa23e('0x24')](function(_0x4235ab){_0xf1143c[_0xa23e('0x1e')]=_0x4235ab;if(_0x2316d6[_0xa23e('0x33')][_0xa23e('0x41')]){_0xf19d2e[_0xa23e('0x42')]=[{'all':!![]}];}return db[_0xa23e('0x2d')][_0xa23e('0x43')](_0xf19d2e);})['then'](function(_0x14ffe3){_0xf1143c[_0xa23e('0x44')]=_0x14ffe3;return _0xf1143c;})[_0xa23e('0x24')](respondWithFilteredResult(_0x4db762,_0xf19d2e))['catch'](handleError(_0x4db762,null));};exports[_0xa23e('0x45')]=function(_0x1153f4,_0x2cd40b){var _0x278ddd={'raw':!![],'where':{'id':_0x1153f4[_0xa23e('0x46')]['id']}},_0x3796a9={};_0x3796a9[_0xa23e('0x31')]=_[_0xa23e('0x32')](db['SugarcrmField'][_0xa23e('0x2e')]);_0x3796a9[_0xa23e('0x33')]=_['keys'](_0x1153f4[_0xa23e('0x33')]);_0x3796a9[_0xa23e('0x34')]=_[_0xa23e('0x35')](_0x3796a9['model'],_0x3796a9[_0xa23e('0x33')]);_0x278ddd['attributes']=_[_0xa23e('0x35')](_0x3796a9[_0xa23e('0x31')],qs[_0xa23e('0x36')](_0x1153f4[_0xa23e('0x33')][_0xa23e('0x36')]));_0x278ddd['attributes']=_0x278ddd[_0xa23e('0x37')][_0xa23e('0x47')]?_0x278ddd[_0xa23e('0x37')]:_0x3796a9[_0xa23e('0x31')];if(_0x1153f4[_0xa23e('0x33')][_0xa23e('0x41')]){_0x278ddd[_0xa23e('0x42')]=[{'all':!![]}];}_0x278ddd=_['merge']({},_0x278ddd,_0x1153f4[_0xa23e('0x40')]);return db['SugarcrmField'][_0xa23e('0x48')](_0x278ddd)[_0xa23e('0x24')](handleEntityNotFound(_0x2cd40b,null))[_0xa23e('0x24')](respondWithResult(_0x2cd40b,null))[_0xa23e('0x49')](handleError(_0x2cd40b,null));};exports[_0xa23e('0x4a')]=function(_0x2a109e,_0x1e316e){return db[_0xa23e('0x2d')][_0xa23e('0x4a')](_0x2a109e[_0xa23e('0x4b')],{})[_0xa23e('0x24')](respondWithResult(_0x1e316e,0xc9))[_0xa23e('0x49')](handleError(_0x1e316e,null));};exports[_0xa23e('0x23')]=function(_0x5ef6b0,_0x4716d7){if(_0x5ef6b0[_0xa23e('0x4b')]['id']){delete _0x5ef6b0[_0xa23e('0x4b')]['id'];}return db['SugarcrmField'][_0xa23e('0x48')]({'where':{'id':_0x5ef6b0['params']['id']}})['then'](handleEntityNotFound(_0x4716d7,null))[_0xa23e('0x24')](saveUpdates(_0x5ef6b0['body'],null))[_0xa23e('0x24')](respondWithResult(_0x4716d7,null))[_0xa23e('0x49')](handleError(_0x4716d7,null));};exports[_0xa23e('0x25')]=function(_0x39a6f7,_0x325853){return db['SugarcrmField'][_0xa23e('0x48')]({'where':{'id':_0x39a6f7[_0xa23e('0x46')]['id']}})[_0xa23e('0x24')](handleEntityNotFound(_0x325853,null))[_0xa23e('0x24')](removeEntity(_0x325853,null))['catch'](handleError(_0x325853,null));}; \ No newline at end of file +var _0xbd66=['include','findAll','catch','show','params','keys','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0xbd66,0xe9));var _0x6bd6=function(_0x5b7310,_0x322e1d){_0x5b7310=_0x5b7310-0x0;var _0x34f6ee=_0xbd66[_0x5b7310];return _0x34f6ee;};'use strict';var emlformat=require(_0x6bd6('0x0'));var rimraf=require(_0x6bd6('0x1'));var zipdir=require(_0x6bd6('0x2'));var jsonpatch=require(_0x6bd6('0x3'));var rp=require(_0x6bd6('0x4'));var moment=require('moment');var BPromise=require(_0x6bd6('0x5'));var Mustache=require(_0x6bd6('0x6'));var util=require(_0x6bd6('0x7'));var path=require(_0x6bd6('0x8'));var sox=require(_0x6bd6('0x9'));var csv=require(_0x6bd6('0xa'));var ejs=require(_0x6bd6('0xb'));var fs=require('fs');var fs_extra=require(_0x6bd6('0xc'));var _=require('lodash');var squel=require(_0x6bd6('0xd'));var crypto=require(_0x6bd6('0xe'));var jsforce=require(_0x6bd6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6bd6('0xa'));var querystring=require(_0x6bd6('0x10'));var Papa=require(_0x6bd6('0x11'));var Redis=require(_0x6bd6('0x12'));var authService=require(_0x6bd6('0x13'));var qs=require(_0x6bd6('0x14'));var as=require(_0x6bd6('0x15'));var hardwareService=require(_0x6bd6('0x16'));var logger=require(_0x6bd6('0x17'))(_0x6bd6('0x18'));var utils=require('../../config/utils');var config=require(_0x6bd6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4eb42c,_0x39e8ec){_0x39e8ec=_0x39e8ec||0xcc;return function(_0x3d4231){if(_0x3d4231){return _0x4eb42c['sendStatus'](_0x39e8ec);}return _0x4eb42c[_0x6bd6('0x1a')](_0x39e8ec)['end']();};}function respondWithResult(_0x149212,_0x278ce7){_0x278ce7=_0x278ce7||0xc8;return function(_0x4a9bb4){if(_0x4a9bb4){return _0x149212[_0x6bd6('0x1a')](_0x278ce7)['json'](_0x4a9bb4);}};}function respondWithFilteredResult(_0x3a1838,_0x20883c){return function(_0x3ef171){if(_0x3ef171){var _0x1e1b4c=typeof _0x20883c[_0x6bd6('0x1b')]==='undefined'&&typeof _0x20883c[_0x6bd6('0x1c')]===_0x6bd6('0x1d');var _0x1621bf=_0x3ef171['count'];var _0x1f356f=_0x1e1b4c?0x0:_0x20883c[_0x6bd6('0x1b')];var _0x3195dc=_0x1e1b4c?_0x3ef171[_0x6bd6('0x1e')]:_0x20883c[_0x6bd6('0x1b')]+_0x20883c['limit'];var _0x1203ed;if(_0x3195dc>=_0x1621bf){_0x3195dc=_0x1621bf;_0x1203ed=0xc8;}else{_0x1203ed=0xce;}_0x3a1838[_0x6bd6('0x1a')](_0x1203ed);return _0x3a1838[_0x6bd6('0x1f')](_0x6bd6('0x20'),_0x1f356f+'-'+_0x3195dc+'/'+_0x1621bf)[_0x6bd6('0x21')](_0x3ef171);}return null;};}function patchUpdates(_0x25ef4e){return function(_0x30aca3){try{jsonpatch[_0x6bd6('0x22')](_0x30aca3,_0x25ef4e,!![]);}catch(_0x1cdcc9){return BPromise[_0x6bd6('0x23')](_0x1cdcc9);}return _0x30aca3[_0x6bd6('0x24')]();};}function saveUpdates(_0x1d574a,_0x5a81b2){return function(_0x3db094){if(_0x3db094){return _0x3db094[_0x6bd6('0x25')](_0x1d574a)[_0x6bd6('0x26')](function(_0x3bb5fb){return _0x3bb5fb;});}return null;};}function removeEntity(_0x13515f,_0x14e241){return function(_0x181ba0){if(_0x181ba0){return _0x181ba0[_0x6bd6('0x27')]()['then'](function(){_0x13515f['status'](0xcc)[_0x6bd6('0x28')]();});}};}function handleEntityNotFound(_0x31a5e4,_0x46d13f){return function(_0x1c90ec){if(!_0x1c90ec){_0x31a5e4[_0x6bd6('0x29')](0x194);}return _0x1c90ec;};}function handleError(_0x24c275,_0x19f85e){_0x19f85e=_0x19f85e||0x1f4;return function(_0x2d3b21){logger[_0x6bd6('0x2a')](_0x2d3b21[_0x6bd6('0x2b')]);if(_0x2d3b21[_0x6bd6('0x2c')]){delete _0x2d3b21['name'];}_0x24c275[_0x6bd6('0x1a')](_0x19f85e)['send'](_0x2d3b21);};}exports[_0x6bd6('0x2d')]=function(_0x1a953a,_0x3b6820){var _0x251e4c={},_0x2e156d={},_0x281dbb={'count':0x0,'rows':[]};var _0x3a7f52=_['map'](db[_0x6bd6('0x2e')][_0x6bd6('0x2f')],function(_0x27edb1){return{'name':_0x27edb1[_0x6bd6('0x30')],'type':_0x27edb1[_0x6bd6('0x31')][_0x6bd6('0x32')]};});_0x2e156d[_0x6bd6('0x33')]=_[_0x6bd6('0x34')](_0x3a7f52,'name');_0x2e156d[_0x6bd6('0x35')]=_['keys'](_0x1a953a['query']);_0x2e156d[_0x6bd6('0x36')]=_[_0x6bd6('0x37')](_0x2e156d[_0x6bd6('0x33')],_0x2e156d[_0x6bd6('0x35')]);_0x251e4c[_0x6bd6('0x38')]=_['intersection'](_0x2e156d[_0x6bd6('0x33')],qs[_0x6bd6('0x39')](_0x1a953a[_0x6bd6('0x35')][_0x6bd6('0x39')]));_0x251e4c[_0x6bd6('0x38')]=_0x251e4c[_0x6bd6('0x38')][_0x6bd6('0x3a')]?_0x251e4c[_0x6bd6('0x38')]:_0x2e156d[_0x6bd6('0x33')];if(!_0x1a953a['query'][_0x6bd6('0x3b')](_0x6bd6('0x3c'))){_0x251e4c[_0x6bd6('0x1c')]=qs['limit'](_0x1a953a[_0x6bd6('0x35')]['limit']);_0x251e4c[_0x6bd6('0x1b')]=qs[_0x6bd6('0x1b')](_0x1a953a[_0x6bd6('0x35')]['offset']);}_0x251e4c[_0x6bd6('0x3d')]=qs['sort'](_0x1a953a[_0x6bd6('0x35')]['sort']);_0x251e4c[_0x6bd6('0x3e')]=qs['filters'](_['pick'](_0x1a953a[_0x6bd6('0x35')],_0x2e156d[_0x6bd6('0x36')]),_0x3a7f52);if(_0x1a953a['query'][_0x6bd6('0x3f')]){_0x251e4c[_0x6bd6('0x3e')]=_['merge'](_0x251e4c[_0x6bd6('0x3e')],{'$or':_['map'](_0x3a7f52,function(_0x29151f){if(_0x29151f[_0x6bd6('0x31')]!==_0x6bd6('0x40')){var _0x46737f={};_0x46737f[_0x29151f['name']]={'$like':'%'+_0x1a953a[_0x6bd6('0x35')][_0x6bd6('0x3f')]+'%'};return _0x46737f;}})});}_0x251e4c=_[_0x6bd6('0x41')]({},_0x251e4c,_0x1a953a[_0x6bd6('0x42')]);var _0x4443f2={'where':_0x251e4c['where']};return db[_0x6bd6('0x2e')][_0x6bd6('0x1e')](_0x4443f2)[_0x6bd6('0x26')](function(_0x550361){_0x281dbb[_0x6bd6('0x1e')]=_0x550361;if(_0x1a953a[_0x6bd6('0x35')]['includeAll']){_0x251e4c[_0x6bd6('0x43')]=[{'all':!![]}];}return db[_0x6bd6('0x2e')][_0x6bd6('0x44')](_0x251e4c);})[_0x6bd6('0x26')](function(_0x404a28){_0x281dbb['rows']=_0x404a28;return _0x281dbb;})[_0x6bd6('0x26')](respondWithFilteredResult(_0x3b6820,_0x251e4c))[_0x6bd6('0x45')](handleError(_0x3b6820,null));};exports[_0x6bd6('0x46')]=function(_0x430b3c,_0x224b31){var _0x44ec5f={'raw':!![],'where':{'id':_0x430b3c[_0x6bd6('0x47')]['id']}},_0x3e2644={};_0x3e2644['model']=_['keys'](db[_0x6bd6('0x2e')][_0x6bd6('0x2f')]);_0x3e2644[_0x6bd6('0x35')]=_[_0x6bd6('0x48')](_0x430b3c[_0x6bd6('0x35')]);_0x3e2644[_0x6bd6('0x36')]=_['intersection'](_0x3e2644[_0x6bd6('0x33')],_0x3e2644[_0x6bd6('0x35')]);_0x44ec5f[_0x6bd6('0x38')]=_[_0x6bd6('0x37')](_0x3e2644[_0x6bd6('0x33')],qs[_0x6bd6('0x39')](_0x430b3c[_0x6bd6('0x35')][_0x6bd6('0x39')]));_0x44ec5f[_0x6bd6('0x38')]=_0x44ec5f[_0x6bd6('0x38')][_0x6bd6('0x3a')]?_0x44ec5f['attributes']:_0x3e2644[_0x6bd6('0x33')];if(_0x430b3c[_0x6bd6('0x35')]['includeAll']){_0x44ec5f['include']=[{'all':!![]}];}_0x44ec5f=_[_0x6bd6('0x41')]({},_0x44ec5f,_0x430b3c['options']);return db[_0x6bd6('0x2e')]['find'](_0x44ec5f)[_0x6bd6('0x26')](handleEntityNotFound(_0x224b31,null))[_0x6bd6('0x26')](respondWithResult(_0x224b31,null))['catch'](handleError(_0x224b31,null));};exports[_0x6bd6('0x49')]=function(_0x2f9d45,_0x48592a){return db[_0x6bd6('0x2e')][_0x6bd6('0x49')](_0x2f9d45[_0x6bd6('0x4a')],{})[_0x6bd6('0x26')](respondWithResult(_0x48592a,0xc9))[_0x6bd6('0x45')](handleError(_0x48592a,null));};exports[_0x6bd6('0x25')]=function(_0x2fbbea,_0x38026e){if(_0x2fbbea[_0x6bd6('0x4a')]['id']){delete _0x2fbbea['body']['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x2fbbea[_0x6bd6('0x47')]['id']}})[_0x6bd6('0x26')](handleEntityNotFound(_0x38026e,null))['then'](saveUpdates(_0x2fbbea[_0x6bd6('0x4a')],null))['then'](respondWithResult(_0x38026e,null))[_0x6bd6('0x45')](handleError(_0x38026e,null));};exports[_0x6bd6('0x27')]=function(_0x43b11a,_0x23cc74){return db[_0x6bd6('0x2e')]['find']({'where':{'id':_0x43b11a['params']['id']}})[_0x6bd6('0x26')](handleEntityNotFound(_0x23cc74,null))[_0x6bd6('0x26')](removeEntity(_0x23cc74,null))[_0x6bd6('0x45')](handleError(_0x23cc74,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 1176d54..40a80b3 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 _0xcf28=['exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x16dcc2,_0x1323f2){var _0x41d2ef=function(_0x4b3085){while(--_0x4b3085){_0x16dcc2['push'](_0x16dcc2['shift']());}};_0x41d2ef(++_0x1323f2);}(_0xcf28,0xd3));var _0x8cf2=function(_0x25e793,_0x4d96dc){_0x25e793=_0x25e793-0x0;var _0x50a201=_0xcf28[_0x25e793];return _0x50a201;};'use strict';var _=require('lodash');var util=require(_0x8cf2('0x0'));var logger=require(_0x8cf2('0x1'))(_0x8cf2('0x2'));var moment=require(_0x8cf2('0x3'));var BPromise=require(_0x8cf2('0x4'));var rp=require(_0x8cf2('0x5'));var fs=require('fs');var path=require(_0x8cf2('0x6'));var rimraf=require(_0x8cf2('0x7'));var config=require(_0x8cf2('0x8'));var attributes=require(_0x8cf2('0x9'));module[_0x8cf2('0xa')]=function(_0x366dfe,_0x5221a4){return _0x366dfe[_0x8cf2('0xb')](_0x8cf2('0xc'),attributes,{'tableName':_0x8cf2('0xd'),'paranoid':![],'indexes':[{'name':_0x8cf2('0xe'),'fields':[_0x8cf2('0xf'),_0x8cf2('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd5e=['FieldId','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x45a478,_0x19426c){var _0xee055=function(_0x37f602){while(--_0x37f602){_0x45a478['push'](_0x45a478['shift']());}};_0xee055(++_0x19426c);}(_0xdd5e,0x97));var _0xedd5=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xdd5e[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xedd5('0x0'))(_0xedd5('0x1'));var moment=require(_0xedd5('0x2'));var BPromise=require(_0xedd5('0x3'));var rp=require(_0xedd5('0x4'));var fs=require('fs');var path=require(_0xedd5('0x5'));var rimraf=require('rimraf');var config=require(_0xedd5('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0xedd5('0x7')]=function(_0x57460e,_0x2fe45b){return _0x57460e[_0xedd5('0x8')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0xedd5('0x9')],'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 0fe9ddb..a316a13 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 _0x2b1e=['../../config/logger','rpc','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x2b1e,0x1f2));var _0xe2b1=function(_0x32c0c4,_0x2d15ec){_0x32c0c4=_0x32c0c4-0x0;var _0x5b9b73=_0x2b1e[_0x32c0c4];return _0x5b9b73;};'use strict';var _=require('lodash');var util=require(_0xe2b1('0x0'));var moment=require('moment');var BPromise=require(_0xe2b1('0x1'));var rs=require(_0xe2b1('0x2'));var fs=require('fs');var Redis=require(_0xe2b1('0x3'));var db=require(_0xe2b1('0x4'))['db'];var utils=require(_0xe2b1('0x5'));var logger=require(_0xe2b1('0x6'))(_0xe2b1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe2b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444234,_0x31e5f4,_0x3a3f6d){return new BPromise(function(_0x22c507,_0x54b349){return client[_0xe2b1('0x9')](_0x444234,_0x3a3f6d)[_0xe2b1('0xa')](function(_0x1be5a0){logger[_0xe2b1('0xb')](_0xe2b1('0xc'),_0x31e5f4,_0xe2b1('0xd'));logger['debug'](_0xe2b1('0xe'),_0x31e5f4,_0xe2b1('0xd'),JSON[_0xe2b1('0xf')](_0x1be5a0));if(_0x1be5a0[_0xe2b1('0x10')]){if(_0x1be5a0[_0xe2b1('0x10')][_0xe2b1('0x11')]===0x1f4){logger[_0xe2b1('0x10')](_0xe2b1('0xc'),_0x31e5f4,_0x1be5a0['error']['message']);return _0x54b349(_0x1be5a0[_0xe2b1('0x10')][_0xe2b1('0x12')]);}logger[_0xe2b1('0x10')](_0xe2b1('0xc'),_0x31e5f4,_0x1be5a0['error']['message']);return _0x22c507(_0x1be5a0[_0xe2b1('0x10')]['message']);}else{logger[_0xe2b1('0xb')](_0xe2b1('0xc'),_0x31e5f4,_0xe2b1('0xd'));_0x22c507(_0x1be5a0[_0xe2b1('0x13')][_0xe2b1('0x12')]);}})[_0xe2b1('0x14')](function(_0x2d6884){logger[_0xe2b1('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x31e5f4,_0x2d6884);_0x54b349(_0x2d6884);});});} \ No newline at end of file +var _0xcb21=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xcb21,0xc7));var _0x1cb2=function(_0x4e29f1,_0x3da155){_0x4e29f1=_0x4e29f1-0x0;var _0x4bc72f=_0xcb21[_0x4e29f1];return _0x4bc72f;};'use strict';var _=require(_0x1cb2('0x0'));var util=require(_0x1cb2('0x1'));var moment=require(_0x1cb2('0x2'));var BPromise=require(_0x1cb2('0x3'));var rs=require(_0x1cb2('0x4'));var fs=require('fs');var Redis=require(_0x1cb2('0x5'));var db=require(_0x1cb2('0x6'))['db'];var utils=require(_0x1cb2('0x7'));var logger=require(_0x1cb2('0x8'))(_0x1cb2('0x9'));var config=require(_0x1cb2('0xa'));var jayson=require(_0x1cb2('0xb'));var client=jayson[_0x1cb2('0xc')][_0x1cb2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x540d6d,_0x2d5699,_0x5df309){return new BPromise(function(_0x547853,_0x3b54d8){return client[_0x1cb2('0xe')](_0x540d6d,_0x5df309)[_0x1cb2('0xf')](function(_0x1632c2){logger[_0x1cb2('0x10')](_0x1cb2('0x11'),_0x2d5699,_0x1cb2('0x12'));logger[_0x1cb2('0x13')](_0x1cb2('0x14'),_0x2d5699,_0x1cb2('0x12'),JSON[_0x1cb2('0x15')](_0x1632c2));if(_0x1632c2['error']){if(_0x1632c2[_0x1cb2('0x16')][_0x1cb2('0x17')]===0x1f4){logger[_0x1cb2('0x16')](_0x1cb2('0x11'),_0x2d5699,_0x1632c2[_0x1cb2('0x16')]['message']);return _0x3b54d8(_0x1632c2[_0x1cb2('0x16')][_0x1cb2('0x18')]);}logger[_0x1cb2('0x16')](_0x1cb2('0x11'),_0x2d5699,_0x1632c2[_0x1cb2('0x16')]['message']);return _0x547853(_0x1632c2['error']['message']);}else{logger[_0x1cb2('0x10')](_0x1cb2('0x11'),_0x2d5699,'request\x20sent');_0x547853(_0x1632c2['result'][_0x1cb2('0x18')]);}})[_0x1cb2('0x19')](function(_0x6ac27e){logger[_0x1cb2('0x16')](_0x1cb2('0x11'),_0x2d5699,_0x6ac27e);_0x3b54d8(_0x6ac27e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 690679c..cddbd2e 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 _0xfd28=['put','/:id','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x279b90,_0x15a882){var _0x5135aa=function(_0x144f62){while(--_0x144f62){_0x279b90['push'](_0x279b90['shift']());}};_0x5135aa(++_0x15a882);}(_0xfd28,0x148));var _0x8fd2=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0xfd28[_0x1f7413];return _0x2d2775;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['get'](_0x8fd2('0xd'),auth['isAuthenticated'](),controller[_0x8fd2('0xe')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xf')]('/:id/configurations',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x10')]);router[_0x8fd2('0x11')](_0x8fd2('0x12'),auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x13')]);router[_0x8fd2('0x14')](_0x8fd2('0x12'),auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x15')]);module[_0x8fd2('0x16')]=router; \ No newline at end of file +var _0x62ec=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','getFields','post','create','/:id/configurations','/:id'];(function(_0x3b89d5,_0x3ce186){var _0x5192e1=function(_0x1287f4){while(--_0x1287f4){_0x3b89d5['push'](_0x3b89d5['shift']());}};_0x5192e1(++_0x3ce186);}(_0x62ec,0xca));var _0xc62e=function(_0x599fa4,_0x36a365){_0x599fa4=_0x599fa4-0x0;var _0x342fd3=_0x62ec[_0x599fa4];return _0x342fd3;};'use strict';var multer=require('multer');var util=require(_0xc62e('0x0'));var path=require('path');var timeout=require(_0xc62e('0x1'));var express=require(_0xc62e('0x2'));var router=express[_0xc62e('0x3')]();var fs_extra=require(_0xc62e('0x4'));var auth=require(_0xc62e('0x5'));var interaction=require(_0xc62e('0x6'));var config=require(_0xc62e('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xc62e('0x8')]('/',auth[_0xc62e('0x9')](),controller[_0xc62e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc62e('0xb')]);router[_0xc62e('0x8')]('/:id/configurations',auth[_0xc62e('0x9')](),controller[_0xc62e('0xc')]);router['get']('/:id/fields',auth[_0xc62e('0x9')](),controller[_0xc62e('0xd')]);router[_0xc62e('0xe')]('/',auth['isAuthenticated'](),controller[_0xc62e('0xf')]);router[_0xc62e('0xe')](_0xc62e('0x10'),auth[_0xc62e('0x9')](),controller['addConfiguration']);router['put'](_0xc62e('0x11'),auth[_0xc62e('0x9')](),controller[_0xc62e('0x12')]);router[_0xc62e('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xc62e('0x14')]);module[_0xc62e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 51946bc..13e8b36 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 _0x2093=['STRING','HelpDesk','sequelize'];(function(_0x417892,_0x4c810b){var _0x4f1b13=function(_0x29d0a6){while(--_0x29d0a6){_0x417892['push'](_0x417892['shift']());}};_0x4f1b13(++_0x4c810b);}(_0x2093,0x1d3));var _0x3209=function(_0x16dfee,_0x1dba0b){_0x16dfee=_0x16dfee-0x0;var _0x3ced82=_0x2093[_0x16dfee];return _0x3ced82;};'use strict';var Sequelize=require(_0x3209('0x0'));module['exports']={'name':{'type':Sequelize[_0x3209('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3209('0x1')]},'username':{'type':Sequelize[_0x3209('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3209('0x1')],'allowNull':![],'defaultValue':_0x3209('0x2')},'remoteUri':{'type':Sequelize[_0x3209('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2e19=['exports','STRING','sequelize'];(function(_0x4034e6,_0x2ac3d5){var _0x429e4b=function(_0x2a395c){while(--_0x2a395c){_0x4034e6['push'](_0x4034e6['shift']());}};_0x429e4b(++_0x2ac3d5);}(_0x2e19,0xf5));var _0x92e1=function(_0x1f7e05,_0x26a3a1){_0x1f7e05=_0x1f7e05-0x0;var _0x15bc3e=_0x2e19[_0x1f7e05];return _0x15bc3e;};'use strict';var Sequelize=require(_0x92e1('0x0'));module[_0x92e1('0x1')]={'name':{'type':Sequelize[_0x92e1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x92e1('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x92e1('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x92e1('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 434819f..9cf1f8f 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 _0x1b9b=['%s/webservice.php','GET','getchallenge','success','login','result','token','describe','sessionName','reference','remove','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','find','create','body','params','findOne','VtigerConfiguration','pick','getConfigurations','AccountId','getSubjects','channel','Descriptions','VtigerField','Subjects','md5','getFields','username','description','remoteUri','serverUrl','accessKey','substring'];(function(_0x4df33e,_0x35ded4){var _0xbc3318=function(_0x5032a2){while(--_0x5032a2){_0x4df33e['push'](_0x4df33e['shift']());}};_0xbc3318(++_0x35ded4);}(_0x1b9b,0x89));var _0xb1b9=function(_0x41ea94,_0x19f5c4){_0x41ea94=_0x41ea94-0x0;var _0x1d3faa=_0x1b9b[_0x41ea94];return _0x1d3faa;};'use strict';var emlformat=require(_0xb1b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1b9('0x1'));var jsonpatch=require(_0xb1b9('0x2'));var rp=require(_0xb1b9('0x3'));var moment=require(_0xb1b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb1b9('0x5'));var util=require(_0xb1b9('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb1b9('0x7'));var fs=require('fs');var fs_extra=require(_0xb1b9('0x8'));var _=require('lodash');var squel=require(_0xb1b9('0x9'));var crypto=require(_0xb1b9('0xa'));var jsforce=require(_0xb1b9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb1b9('0xc'));var querystring=require(_0xb1b9('0xd'));var Papa=require(_0xb1b9('0xe'));var Redis=require('ioredis');var authService=require(_0xb1b9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb1b9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1b9('0x11'))(_0xb1b9('0x12'));var utils=require(_0xb1b9('0x13'));var config=require(_0xb1b9('0x14'));var licenseUtil=require(_0xb1b9('0x15'));var db=require(_0xb1b9('0x16'))['db'];var integrations=require(_0xb1b9('0x17'));function respondWithStatusCode(_0x2fcc30,_0x517373){_0x517373=_0x517373||0xcc;return function(_0x32eb65){if(_0x32eb65){return _0x2fcc30[_0xb1b9('0x18')](_0x517373);}return _0x2fcc30[_0xb1b9('0x19')](_0x517373)['end']();};}function respondWithResult(_0xa8eab5,_0x391749){_0x391749=_0x391749||0xc8;return function(_0x2b3e71){if(_0x2b3e71){return _0xa8eab5[_0xb1b9('0x19')](_0x391749)[_0xb1b9('0x1a')](_0x2b3e71);}};}function respondWithFilteredResult(_0x2c2a2b,_0x5a5431){return function(_0x10316f){if(_0x10316f){var _0x4cfdfe=typeof _0x5a5431[_0xb1b9('0x1b')]===_0xb1b9('0x1c')&&typeof _0x5a5431[_0xb1b9('0x1d')]===_0xb1b9('0x1c');var _0x5aa4ed=_0x10316f[_0xb1b9('0x1e')];var _0xc5660a=_0x4cfdfe?0x0:_0x5a5431[_0xb1b9('0x1b')];var _0x4cec86=_0x4cfdfe?_0x10316f[_0xb1b9('0x1e')]:_0x5a5431[_0xb1b9('0x1b')]+_0x5a5431[_0xb1b9('0x1d')];var _0x3fb2ff;if(_0x4cec86>=_0x5aa4ed){_0x4cec86=_0x5aa4ed;_0x3fb2ff=0xc8;}else{_0x3fb2ff=0xce;}_0x2c2a2b[_0xb1b9('0x19')](_0x3fb2ff);return _0x2c2a2b['set']('Content-Range',_0xc5660a+'-'+_0x4cec86+'/'+_0x5aa4ed)['json'](_0x10316f);}return null;};}function patchUpdates(_0x3a2831){return function(_0x27c7f0){try{jsonpatch[_0xb1b9('0x1f')](_0x27c7f0,_0x3a2831,!![]);}catch(_0x31b067){return BPromise[_0xb1b9('0x20')](_0x31b067);}return _0x27c7f0[_0xb1b9('0x21')]();};}function saveUpdates(_0x51d4e2,_0x57a8be){return function(_0x1ae945){if(_0x1ae945){return _0x1ae945[_0xb1b9('0x22')](_0x51d4e2)[_0xb1b9('0x23')](function(_0x58f630){return _0x58f630;});}return null;};}function removeEntity(_0x3d20f3,_0xa3d102){return function(_0x50c2a7){if(_0x50c2a7){return _0x50c2a7[_0xb1b9('0x24')]()['then'](function(){_0x3d20f3[_0xb1b9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36970e,_0x578116){return function(_0x326e8f){if(!_0x326e8f){_0x36970e[_0xb1b9('0x18')](0x194);}return _0x326e8f;};}function handleError(_0x3925ee,_0xf08444){_0xf08444=_0xf08444||0x1f4;return function(_0x60a509){logger['error'](_0x60a509[_0xb1b9('0x25')]);if(_0x60a509[_0xb1b9('0x26')]){delete _0x60a509[_0xb1b9('0x26')];}_0x3925ee[_0xb1b9('0x19')](_0xf08444)[_0xb1b9('0x27')](_0x60a509);};}exports[_0xb1b9('0x28')]=function(_0xcdf0cd,_0x4c2187){var _0x493871={},_0x59d433={},_0x435bb0={'count':0x0,'rows':[]};var _0x1fe1cd=_[_0xb1b9('0x29')](db[_0xb1b9('0x2a')][_0xb1b9('0x2b')],function(_0x376f0f){return{'name':_0x376f0f[_0xb1b9('0x2c')],'type':_0x376f0f[_0xb1b9('0x2d')][_0xb1b9('0x2e')]};});_0x59d433[_0xb1b9('0x2f')]=_[_0xb1b9('0x29')](_0x1fe1cd,_0xb1b9('0x26'));_0x59d433['query']=_[_0xb1b9('0x30')](_0xcdf0cd[_0xb1b9('0x31')]);_0x59d433[_0xb1b9('0x32')]=_[_0xb1b9('0x33')](_0x59d433['model'],_0x59d433[_0xb1b9('0x31')]);_0x493871[_0xb1b9('0x34')]=_[_0xb1b9('0x33')](_0x59d433[_0xb1b9('0x2f')],qs[_0xb1b9('0x35')](_0xcdf0cd[_0xb1b9('0x31')][_0xb1b9('0x35')]));_0x493871['attributes']=_0x493871[_0xb1b9('0x34')][_0xb1b9('0x36')]?_0x493871[_0xb1b9('0x34')]:_0x59d433['model'];if(!_0xcdf0cd[_0xb1b9('0x31')][_0xb1b9('0x37')](_0xb1b9('0x38'))){_0x493871['limit']=qs['limit'](_0xcdf0cd[_0xb1b9('0x31')][_0xb1b9('0x1d')]);_0x493871[_0xb1b9('0x1b')]=qs[_0xb1b9('0x1b')](_0xcdf0cd['query'][_0xb1b9('0x1b')]);}_0x493871[_0xb1b9('0x39')]=qs[_0xb1b9('0x3a')](_0xcdf0cd[_0xb1b9('0x31')][_0xb1b9('0x3a')]);_0x493871[_0xb1b9('0x3b')]=qs['filters'](_['pick'](_0xcdf0cd[_0xb1b9('0x31')],_0x59d433[_0xb1b9('0x32')]),_0x1fe1cd);if(_0xcdf0cd[_0xb1b9('0x31')][_0xb1b9('0x3c')]){_0x493871[_0xb1b9('0x3b')]=_[_0xb1b9('0x3d')](_0x493871[_0xb1b9('0x3b')],{'$or':_[_0xb1b9('0x29')](_0x1fe1cd,function(_0x385c2c){if(_0x385c2c[_0xb1b9('0x2d')]!==_0xb1b9('0x3e')){var _0x1f2518={};_0x1f2518[_0x385c2c[_0xb1b9('0x26')]]={'$like':'%'+_0xcdf0cd[_0xb1b9('0x31')]['filter']+'%'};return _0x1f2518;}})});}_0x493871=_['merge']({},_0x493871,_0xcdf0cd[_0xb1b9('0x3f')]);var _0x30c96e={'where':_0x493871[_0xb1b9('0x3b')]};return db[_0xb1b9('0x2a')][_0xb1b9('0x1e')](_0x30c96e)[_0xb1b9('0x23')](function(_0x2b2db6){_0x435bb0['count']=_0x2b2db6;if(_0xcdf0cd[_0xb1b9('0x31')][_0xb1b9('0x40')]){_0x493871[_0xb1b9('0x41')]=[{'all':!![]}];}return db[_0xb1b9('0x2a')]['findAll'](_0x493871);})[_0xb1b9('0x23')](function(_0xe7ad2a){_0x435bb0['rows']=_0xe7ad2a;return _0x435bb0;})[_0xb1b9('0x23')](respondWithFilteredResult(_0x4c2187,_0x493871))[_0xb1b9('0x42')](handleError(_0x4c2187,null));};exports['show']=function(_0xf74e27,_0x3d1f39){var _0x38516c={'raw':![],'where':{'id':_0xf74e27['params']['id']}},_0x4befbe={};_0x4befbe[_0xb1b9('0x2f')]=_[_0xb1b9('0x30')](db[_0xb1b9('0x2a')]['rawAttributes']);_0x4befbe[_0xb1b9('0x31')]=_[_0xb1b9('0x30')](_0xf74e27[_0xb1b9('0x31')]);_0x4befbe['filters']=_['intersection'](_0x4befbe[_0xb1b9('0x2f')],_0x4befbe[_0xb1b9('0x31')]);_0x38516c[_0xb1b9('0x34')]=_['intersection'](_0x4befbe['model'],qs['fields'](_0xf74e27[_0xb1b9('0x31')][_0xb1b9('0x35')]));_0x38516c[_0xb1b9('0x34')]=_0x38516c[_0xb1b9('0x34')][_0xb1b9('0x36')]?_0x38516c[_0xb1b9('0x34')]:_0x4befbe[_0xb1b9('0x2f')];if(_0xf74e27[_0xb1b9('0x31')][_0xb1b9('0x40')]){_0x38516c[_0xb1b9('0x41')]=[{'all':!![]}];}_0x38516c=_[_0xb1b9('0x3d')]({},_0x38516c,_0xf74e27[_0xb1b9('0x3f')]);return db[_0xb1b9('0x2a')][_0xb1b9('0x43')](_0x38516c)['then'](handleEntityNotFound(_0x3d1f39,null))[_0xb1b9('0x23')](respondWithResult(_0x3d1f39,null))[_0xb1b9('0x42')](handleError(_0x3d1f39,null));};exports[_0xb1b9('0x44')]=function(_0x3f712e,_0x176889){return db[_0xb1b9('0x2a')][_0xb1b9('0x44')](_0x3f712e[_0xb1b9('0x45')],{})['then'](respondWithResult(_0x176889,0xc9))[_0xb1b9('0x42')](handleError(_0x176889,null));};exports[_0xb1b9('0x22')]=function(_0x480f50,_0x15cf0b){if(_0x480f50[_0xb1b9('0x45')]['id']){delete _0x480f50[_0xb1b9('0x45')]['id'];}return db[_0xb1b9('0x2a')][_0xb1b9('0x43')]({'where':{'id':_0x480f50[_0xb1b9('0x46')]['id']}})[_0xb1b9('0x23')](handleEntityNotFound(_0x15cf0b,null))['then'](saveUpdates(_0x480f50[_0xb1b9('0x45')],null))['then'](respondWithResult(_0x15cf0b,null))[_0xb1b9('0x42')](handleError(_0x15cf0b,null));};exports[_0xb1b9('0x24')]=function(_0x2cf274,_0x533885){return db[_0xb1b9('0x2a')]['find']({'where':{'id':_0x2cf274[_0xb1b9('0x46')]['id']}})[_0xb1b9('0x23')](handleEntityNotFound(_0x533885,null))[_0xb1b9('0x23')](removeEntity(_0x533885,null))[_0xb1b9('0x42')](handleError(_0x533885,null));};exports['getConfigurations']=function(_0x1c4dc5,_0x19e406,_0x1f9279){var _0xdabe4b={};var _0x125b5f={};var _0x1dad0a;var _0x23ff66;return db[_0xb1b9('0x2a')][_0xb1b9('0x47')]({'where':{'id':_0x1c4dc5[_0xb1b9('0x46')]['id']}})[_0xb1b9('0x23')](handleEntityNotFound(_0x19e406,null))[_0xb1b9('0x23')](function(_0x398bd1){if(_0x398bd1){_0x1dad0a=_0x398bd1;_0x125b5f[_0xb1b9('0x2f')]=_[_0xb1b9('0x30')](db[_0xb1b9('0x48')][_0xb1b9('0x2b')]);_0x125b5f[_0xb1b9('0x31')]=_['keys'](_0x1c4dc5['query']);_0x125b5f[_0xb1b9('0x32')]=_['intersection'](_0x125b5f['model'],_0x125b5f['query']);_0xdabe4b[_0xb1b9('0x34')]=_[_0xb1b9('0x33')](_0x125b5f[_0xb1b9('0x2f')],qs['fields'](_0x1c4dc5[_0xb1b9('0x31')][_0xb1b9('0x35')]));_0xdabe4b[_0xb1b9('0x34')]=_0xdabe4b[_0xb1b9('0x34')]['length']?_0xdabe4b[_0xb1b9('0x34')]:_0x125b5f['model'];_0xdabe4b[_0xb1b9('0x39')]=qs[_0xb1b9('0x3a')](_0x1c4dc5[_0xb1b9('0x31')][_0xb1b9('0x3a')]);_0xdabe4b['where']=qs[_0xb1b9('0x32')](_[_0xb1b9('0x49')](_0x1c4dc5['query'],_0x125b5f[_0xb1b9('0x32')]));if(_0x1c4dc5[_0xb1b9('0x31')][_0xb1b9('0x3c')]){_0xdabe4b[_0xb1b9('0x3b')]=_['merge'](_0xdabe4b['where'],{'$or':_[_0xb1b9('0x29')](_0xdabe4b[_0xb1b9('0x34')],function(_0x41077d){var _0x5c4cf5={};_0x5c4cf5[_0x41077d]={'$like':'%'+_0x1c4dc5[_0xb1b9('0x31')][_0xb1b9('0x3c')]+'%'};return _0x5c4cf5;})});}_0xdabe4b=_[_0xb1b9('0x3d')]({},_0xdabe4b,_0x1c4dc5[_0xb1b9('0x3f')]);return _0x1dad0a[_0xb1b9('0x4a')](_0xdabe4b);}})[_0xb1b9('0x23')](function(_0x54f5f4){if(_0x54f5f4){_0x23ff66=_0x54f5f4[_0xb1b9('0x36')];if(!_0x1c4dc5['query'][_0xb1b9('0x37')](_0xb1b9('0x38'))){_0xdabe4b[_0xb1b9('0x1d')]=qs[_0xb1b9('0x1d')](_0x1c4dc5[_0xb1b9('0x31')]['limit']);_0xdabe4b[_0xb1b9('0x1b')]=qs[_0xb1b9('0x1b')](_0x1c4dc5[_0xb1b9('0x31')]['offset']);}return _0x1dad0a[_0xb1b9('0x4a')](_0xdabe4b);}})[_0xb1b9('0x23')](function(_0x3650c1){if(_0x3650c1){return _0x3650c1?{'count':_0x23ff66,'rows':_0x3650c1}:null;}})[_0xb1b9('0x23')](respondWithResult(_0x19e406,null))[_0xb1b9('0x42')](handleError(_0x19e406,null));};exports['addConfiguration']=function(_0x38087b,_0x5418b3,_0x448b81){if(_0x38087b[_0xb1b9('0x45')]['id']){delete _0x38087b[_0xb1b9('0x45')]['id'];}return db[_0xb1b9('0x2a')][_0xb1b9('0x47')]({'where':{'id':_0x38087b[_0xb1b9('0x46')]['id']}})[_0xb1b9('0x23')](handleEntityNotFound(_0x5418b3,null))[_0xb1b9('0x23')](function(_0x4e0711){if(_0x4e0711){_0x38087b['body'][_0xb1b9('0x4b')]=_0x4e0711['id'];_0x38087b[_0xb1b9('0x45')]['Subjects']=integrations[_0xb1b9('0x4c')](_0x38087b['body'][_0xb1b9('0x4d')],_0x38087b[_0xb1b9('0x45')][_0xb1b9('0x2d')]);_0x38087b['body'][_0xb1b9('0x4e')]=integrations['getDescriptions'](_0x38087b[_0xb1b9('0x45')][_0xb1b9('0x4d')],_0x38087b[_0xb1b9('0x45')]['type']);return db[_0xb1b9('0x48')][_0xb1b9('0x44')](_0x38087b[_0xb1b9('0x45')],{'include':[{'model':db[_0xb1b9('0x4f')],'as':_0xb1b9('0x50')},{'model':db[_0xb1b9('0x4f')],'as':_0xb1b9('0x4e')}]});}return null;})[_0xb1b9('0x23')](respondWithResult(_0x5418b3,null))[_0xb1b9('0x42')](handleError(_0x5418b3,null));};var md5=require(_0xb1b9('0x51'));exports[_0xb1b9('0x52')]=function(_0x409a39,_0x224024,_0x65ae60){var _0xc810c6=null;var _0x18dac3=null;var _0x547e00=null;var _0xaedfa8=null;var _0x498a93='';return db['VtigerAccount'][_0xb1b9('0x47')]({'where':{'id':_0x409a39[_0xb1b9('0x46')]['id']},'attributes':['id',_0xb1b9('0x26'),_0xb1b9('0x53'),_0xb1b9('0x54'),'moduleName',_0xb1b9('0x55'),_0xb1b9('0x56'),_0xb1b9('0x57')]})[_0xb1b9('0x23')](handleEntityNotFound(_0x224024,null))['then'](function(_0x5857e8){if(_0x5857e8){_0xc810c6=_0x5857e8['username'];_0x18dac3=_0x5857e8[_0xb1b9('0x57')];_0x547e00=_0x5857e8['moduleName'];_0x498a93=_0x5857e8[_0xb1b9('0x55')];var _0x33d6c7=_0x498a93['slice'](-0x1);if(_0x33d6c7==='/'){_0x498a93=_0x498a93[_0xb1b9('0x58')](0x0,_0x498a93['lastIndexOf'](_0x33d6c7));}_0xaedfa8=util['format'](_0xb1b9('0x59'),_0x498a93);var _0x10a4f7={'method':_0xb1b9('0x5a'),'uri':_0xaedfa8,'qs':{'operation':_0xb1b9('0x5b'),'username':_0x5857e8[_0xb1b9('0x53')]},'json':!![]};return rp(_0x10a4f7);}})[_0xb1b9('0x23')](function(_0x2ba7bc){if(_0x2ba7bc[_0xb1b9('0x5c')]){var _0x3e2bd7={'method':'POST','uri':_0xaedfa8,'form':{'operation':_0xb1b9('0x5d'),'username':_0xc810c6,'accessKey':md5(_0x2ba7bc[_0xb1b9('0x5e')][_0xb1b9('0x5f')]+_0x18dac3)},'json':!![]};return rp(_0x3e2bd7);}})[_0xb1b9('0x23')](function(_0x37ab1b){if(_0x37ab1b[_0xb1b9('0x5c')]){var _0x1d2348={'method':'GET','uri':_0xaedfa8,'qs':{'operation':_0xb1b9('0x60'),'username':_0xc810c6,'sessionName':_0x37ab1b[_0xb1b9('0x5e')][_0xb1b9('0x61')],'elementType':_0x547e00},'json':!![]};return rp(_0x1d2348);}})[_0xb1b9('0x23')](function(_0x74cec2){if(_0x74cec2[_0xb1b9('0x5c')]){var _0x4c5bd5=['autogenerated',_0xb1b9('0x62'),'owner'];_[_0xb1b9('0x63')](_0x74cec2[_0xb1b9('0x5e')][_0xb1b9('0x35')],function(_0x8c9b88){return _0x4c5bd5['includes'](_0x8c9b88[_0xb1b9('0x2d')]['name']);});_['remove'](_0x74cec2[_0xb1b9('0x5e')]['fields'],function(_0x3887cd){return _0x3887cd[_0xb1b9('0x64')]===_0xb1b9('0x65');});return{'count':_0x74cec2[_0xb1b9('0x5e')]['fields']['length'],'rows':_[_0xb1b9('0x29')](_0x74cec2[_0xb1b9('0x5e')][_0xb1b9('0x35')],function(_0x375691){return{'id':_0x375691['name'],'name':_0x375691[_0xb1b9('0x66')],'custom':_['startsWith'](_0x375691['name'],_0xb1b9('0x67'))?!![]:![],'options':_0x375691[_0xb1b9('0x2d')]['name']===_0xb1b9('0x68')&&_0x375691[_0xb1b9('0x2d')]['picklistValues'][_0xb1b9('0x36')]>0x0?_['map'](_0x375691['type'][_0xb1b9('0x69')],function(_0x2caa17){return{'name':_0x2caa17[_0xb1b9('0x66')],'value':_0x2caa17[_0xb1b9('0x6a')]};}):[]};})};}})[_0xb1b9('0x23')](respondWithResult(_0x224024,null))[_0xb1b9('0x42')](function(_0x5c465d){console[_0xb1b9('0x6b')](_0xb1b9('0x6c')+_0x5c465d);var _0x574529=_0x409a39[_0xb1b9('0x31')][_0xb1b9('0x6d')]?0x1f4:_0x5c465d[_0xb1b9('0x6e')]||0x1f4;logger[_0xb1b9('0x6f')]('getFields,\x20%s,\x20%s,\x20%s',_0xb1b9('0x52'),_0x574529,JSON['stringify'](_0x5c465d));delete _0x5c465d[_0xb1b9('0x26')];if(_0x574529===0x191){_0x574529=0x190;}_0x224024['status'](_0x574529)[_0xb1b9('0x27')](_0x409a39[_0xb1b9('0x31')][_0xb1b9('0x6d')]?{'message':_0xb1b9('0x70'),'statusCode':_0x5c465d[_0xb1b9('0x6e')]}:_0x5c465d);});}; \ No newline at end of file +var _0xfdbb=['filter','where','merge','includeAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','options','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','username','description','remoteUri','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','success','GET','result','autogenerated','reference','includes','remove','editable','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','end','sendStatus','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x3afdd2,_0x36d310){var _0x20d74e=function(_0x27609a){while(--_0x27609a){_0x3afdd2['push'](_0x3afdd2['shift']());}};_0x20d74e(++_0x36d310);}(_0xfdbb,0x12a));var _0xbfdb=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xfdbb[_0x5774be];return _0x4914b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbfdb('0x0'));var zipdir=require(_0xbfdb('0x1'));var jsonpatch=require(_0xbfdb('0x2'));var rp=require(_0xbfdb('0x3'));var moment=require(_0xbfdb('0x4'));var BPromise=require(_0xbfdb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbfdb('0x6'));var sox=require(_0xbfdb('0x7'));var csv=require('to-csv');var ejs=require(_0xbfdb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfdb('0x9'));var _=require('lodash');var squel=require(_0xbfdb('0xa'));var crypto=require(_0xbfdb('0xb'));var jsforce=require(_0xbfdb('0xc'));var deskjs=require(_0xbfdb('0xd'));var toCsv=require(_0xbfdb('0xe'));var querystring=require(_0xbfdb('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbfdb('0x10'));var qs=require(_0xbfdb('0x11'));var as=require(_0xbfdb('0x12'));var hardwareService=require(_0xbfdb('0x13'));var logger=require(_0xbfdb('0x14'))('api');var utils=require(_0xbfdb('0x15'));var config=require(_0xbfdb('0x16'));var licenseUtil=require(_0xbfdb('0x17'));var db=require(_0xbfdb('0x18'))['db'];var integrations=require(_0xbfdb('0x19'));function respondWithStatusCode(_0x32b9a8,_0xdcf60d){_0xdcf60d=_0xdcf60d||0xcc;return function(_0x5886b1){if(_0x5886b1){return _0x32b9a8['sendStatus'](_0xdcf60d);}return _0x32b9a8[_0xbfdb('0x1a')](_0xdcf60d)['end']();};}function respondWithResult(_0x127441,_0x14932d){_0x14932d=_0x14932d||0xc8;return function(_0xa736fe){if(_0xa736fe){return _0x127441['status'](_0x14932d)['json'](_0xa736fe);}};}function respondWithFilteredResult(_0x480d1b,_0x5d6f3d){return function(_0x3a2ac0){if(_0x3a2ac0){var _0x587a7=typeof _0x5d6f3d[_0xbfdb('0x1b')]===_0xbfdb('0x1c')&&typeof _0x5d6f3d['limit']===_0xbfdb('0x1c');var _0x5d8487=_0x3a2ac0[_0xbfdb('0x1d')];var _0x1e4b3e=_0x587a7?0x0:_0x5d6f3d[_0xbfdb('0x1b')];var _0x4ef7e3=_0x587a7?_0x3a2ac0[_0xbfdb('0x1d')]:_0x5d6f3d['offset']+_0x5d6f3d[_0xbfdb('0x1e')];var _0x513eb0;if(_0x4ef7e3>=_0x5d8487){_0x4ef7e3=_0x5d8487;_0x513eb0=0xc8;}else{_0x513eb0=0xce;}_0x480d1b[_0xbfdb('0x1a')](_0x513eb0);return _0x480d1b[_0xbfdb('0x1f')](_0xbfdb('0x20'),_0x1e4b3e+'-'+_0x4ef7e3+'/'+_0x5d8487)[_0xbfdb('0x21')](_0x3a2ac0);}return null;};}function patchUpdates(_0x42dbce){return function(_0x2ebe28){try{jsonpatch[_0xbfdb('0x22')](_0x2ebe28,_0x42dbce,!![]);}catch(_0x5c5df3){return BPromise[_0xbfdb('0x23')](_0x5c5df3);}return _0x2ebe28['save']();};}function saveUpdates(_0x4ea200,_0x3211a6){return function(_0x1c3ad9){if(_0x1c3ad9){return _0x1c3ad9['update'](_0x4ea200)[_0xbfdb('0x24')](function(_0x3ef715){return _0x3ef715;});}return null;};}function removeEntity(_0x5f15de,_0x33cadf){return function(_0x11ec09){if(_0x11ec09){return _0x11ec09[_0xbfdb('0x25')]()[_0xbfdb('0x24')](function(){_0x5f15de[_0xbfdb('0x1a')](0xcc)[_0xbfdb('0x26')]();});}};}function handleEntityNotFound(_0x54c09c,_0x5940e0){return function(_0x31b41c){if(!_0x31b41c){_0x54c09c[_0xbfdb('0x27')](0x194);}return _0x31b41c;};}function handleError(_0x45dda4,_0x1b6479){_0x1b6479=_0x1b6479||0x1f4;return function(_0x28e3fe){logger[_0xbfdb('0x28')](_0x28e3fe[_0xbfdb('0x29')]);if(_0x28e3fe[_0xbfdb('0x2a')]){delete _0x28e3fe[_0xbfdb('0x2a')];}_0x45dda4[_0xbfdb('0x1a')](_0x1b6479)[_0xbfdb('0x2b')](_0x28e3fe);};}exports[_0xbfdb('0x2c')]=function(_0x3b2cd2,_0x491c79){var _0x2298b4={},_0x2f83f3={},_0x49bbf4={'count':0x0,'rows':[]};var _0xc85e1b=_[_0xbfdb('0x2d')](db[_0xbfdb('0x2e')][_0xbfdb('0x2f')],function(_0x49b547){return{'name':_0x49b547[_0xbfdb('0x30')],'type':_0x49b547[_0xbfdb('0x31')][_0xbfdb('0x32')]};});_0x2f83f3[_0xbfdb('0x33')]=_[_0xbfdb('0x2d')](_0xc85e1b,'name');_0x2f83f3[_0xbfdb('0x34')]=_['keys'](_0x3b2cd2[_0xbfdb('0x34')]);_0x2f83f3[_0xbfdb('0x35')]=_['intersection'](_0x2f83f3[_0xbfdb('0x33')],_0x2f83f3[_0xbfdb('0x34')]);_0x2298b4[_0xbfdb('0x36')]=_[_0xbfdb('0x37')](_0x2f83f3[_0xbfdb('0x33')],qs['fields'](_0x3b2cd2[_0xbfdb('0x34')][_0xbfdb('0x38')]));_0x2298b4[_0xbfdb('0x36')]=_0x2298b4[_0xbfdb('0x36')][_0xbfdb('0x39')]?_0x2298b4[_0xbfdb('0x36')]:_0x2f83f3[_0xbfdb('0x33')];if(!_0x3b2cd2[_0xbfdb('0x34')][_0xbfdb('0x3a')]('nolimit')){_0x2298b4[_0xbfdb('0x1e')]=qs['limit'](_0x3b2cd2[_0xbfdb('0x34')][_0xbfdb('0x1e')]);_0x2298b4[_0xbfdb('0x1b')]=qs['offset'](_0x3b2cd2[_0xbfdb('0x34')][_0xbfdb('0x1b')]);}_0x2298b4[_0xbfdb('0x3b')]=qs[_0xbfdb('0x3c')](_0x3b2cd2[_0xbfdb('0x34')]['sort']);_0x2298b4['where']=qs[_0xbfdb('0x35')](_[_0xbfdb('0x3d')](_0x3b2cd2[_0xbfdb('0x34')],_0x2f83f3[_0xbfdb('0x35')]),_0xc85e1b);if(_0x3b2cd2[_0xbfdb('0x34')][_0xbfdb('0x3e')]){_0x2298b4['where']=_['merge'](_0x2298b4[_0xbfdb('0x3f')],{'$or':_[_0xbfdb('0x2d')](_0xc85e1b,function(_0x4f577e){if(_0x4f577e[_0xbfdb('0x31')]!=='VIRTUAL'){var _0x59ad46={};_0x59ad46[_0x4f577e[_0xbfdb('0x2a')]]={'$like':'%'+_0x3b2cd2['query'][_0xbfdb('0x3e')]+'%'};return _0x59ad46;}})});}_0x2298b4=_[_0xbfdb('0x40')]({},_0x2298b4,_0x3b2cd2['options']);var _0xcaa46={'where':_0x2298b4['where']};return db[_0xbfdb('0x2e')][_0xbfdb('0x1d')](_0xcaa46)[_0xbfdb('0x24')](function(_0x4052d7){_0x49bbf4[_0xbfdb('0x1d')]=_0x4052d7;if(_0x3b2cd2['query'][_0xbfdb('0x41')]){_0x2298b4['include']=[{'all':!![]}];}return db[_0xbfdb('0x2e')]['findAll'](_0x2298b4);})[_0xbfdb('0x24')](function(_0x4684db){_0x49bbf4[_0xbfdb('0x42')]=_0x4684db;return _0x49bbf4;})[_0xbfdb('0x24')](respondWithFilteredResult(_0x491c79,_0x2298b4))[_0xbfdb('0x43')](handleError(_0x491c79,null));};exports['show']=function(_0x57709c,_0x2d006f){var _0x5f26b1={'raw':![],'where':{'id':_0x57709c['params']['id']}},_0x3e1581={};_0x3e1581[_0xbfdb('0x33')]=_[_0xbfdb('0x44')](db['VtigerAccount'][_0xbfdb('0x2f')]);_0x3e1581[_0xbfdb('0x34')]=_[_0xbfdb('0x44')](_0x57709c['query']);_0x3e1581[_0xbfdb('0x35')]=_['intersection'](_0x3e1581[_0xbfdb('0x33')],_0x3e1581[_0xbfdb('0x34')]);_0x5f26b1[_0xbfdb('0x36')]=_[_0xbfdb('0x37')](_0x3e1581[_0xbfdb('0x33')],qs[_0xbfdb('0x38')](_0x57709c[_0xbfdb('0x34')]['fields']));_0x5f26b1[_0xbfdb('0x36')]=_0x5f26b1['attributes']['length']?_0x5f26b1[_0xbfdb('0x36')]:_0x3e1581[_0xbfdb('0x33')];if(_0x57709c[_0xbfdb('0x34')][_0xbfdb('0x41')]){_0x5f26b1[_0xbfdb('0x45')]=[{'all':!![]}];}_0x5f26b1=_[_0xbfdb('0x40')]({},_0x5f26b1,_0x57709c['options']);return db['VtigerAccount'][_0xbfdb('0x46')](_0x5f26b1)[_0xbfdb('0x24')](handleEntityNotFound(_0x2d006f,null))[_0xbfdb('0x24')](respondWithResult(_0x2d006f,null))['catch'](handleError(_0x2d006f,null));};exports[_0xbfdb('0x47')]=function(_0x689153,_0x1b8ab4){return db[_0xbfdb('0x2e')][_0xbfdb('0x47')](_0x689153[_0xbfdb('0x48')],{})[_0xbfdb('0x24')](respondWithResult(_0x1b8ab4,0xc9))[_0xbfdb('0x43')](handleError(_0x1b8ab4,null));};exports['update']=function(_0x29655e,_0x9e0ee5){if(_0x29655e[_0xbfdb('0x48')]['id']){delete _0x29655e['body']['id'];}return db['VtigerAccount'][_0xbfdb('0x46')]({'where':{'id':_0x29655e[_0xbfdb('0x49')]['id']}})['then'](handleEntityNotFound(_0x9e0ee5,null))['then'](saveUpdates(_0x29655e[_0xbfdb('0x48')],null))[_0xbfdb('0x24')](respondWithResult(_0x9e0ee5,null))['catch'](handleError(_0x9e0ee5,null));};exports[_0xbfdb('0x25')]=function(_0x3f57d8,_0x2159aa){return db[_0xbfdb('0x2e')]['find']({'where':{'id':_0x3f57d8[_0xbfdb('0x49')]['id']}})[_0xbfdb('0x24')](handleEntityNotFound(_0x2159aa,null))[_0xbfdb('0x24')](removeEntity(_0x2159aa,null))[_0xbfdb('0x43')](handleError(_0x2159aa,null));};exports[_0xbfdb('0x4a')]=function(_0x47f809,_0x8eb4af,_0x430ee4){var _0x3b6a80={};var _0x2a6419={};var _0x148263;var _0x4d26a2;return db[_0xbfdb('0x2e')][_0xbfdb('0x4b')]({'where':{'id':_0x47f809['params']['id']}})[_0xbfdb('0x24')](handleEntityNotFound(_0x8eb4af,null))[_0xbfdb('0x24')](function(_0x3f4b0c){if(_0x3f4b0c){_0x148263=_0x3f4b0c;_0x2a6419[_0xbfdb('0x33')]=_[_0xbfdb('0x44')](db[_0xbfdb('0x4c')][_0xbfdb('0x2f')]);_0x2a6419[_0xbfdb('0x34')]=_[_0xbfdb('0x44')](_0x47f809[_0xbfdb('0x34')]);_0x2a6419[_0xbfdb('0x35')]=_[_0xbfdb('0x37')](_0x2a6419[_0xbfdb('0x33')],_0x2a6419[_0xbfdb('0x34')]);_0x3b6a80[_0xbfdb('0x36')]=_['intersection'](_0x2a6419[_0xbfdb('0x33')],qs[_0xbfdb('0x38')](_0x47f809[_0xbfdb('0x34')][_0xbfdb('0x38')]));_0x3b6a80[_0xbfdb('0x36')]=_0x3b6a80[_0xbfdb('0x36')]['length']?_0x3b6a80['attributes']:_0x2a6419['model'];_0x3b6a80[_0xbfdb('0x3b')]=qs[_0xbfdb('0x3c')](_0x47f809[_0xbfdb('0x34')][_0xbfdb('0x3c')]);_0x3b6a80[_0xbfdb('0x3f')]=qs[_0xbfdb('0x35')](_['pick'](_0x47f809['query'],_0x2a6419[_0xbfdb('0x35')]));if(_0x47f809['query']['filter']){_0x3b6a80[_0xbfdb('0x3f')]=_[_0xbfdb('0x40')](_0x3b6a80[_0xbfdb('0x3f')],{'$or':_['map'](_0x3b6a80[_0xbfdb('0x36')],function(_0x511ab0){var _0x338d3f={};_0x338d3f[_0x511ab0]={'$like':'%'+_0x47f809[_0xbfdb('0x34')][_0xbfdb('0x3e')]+'%'};return _0x338d3f;})});}_0x3b6a80=_[_0xbfdb('0x40')]({},_0x3b6a80,_0x47f809[_0xbfdb('0x4d')]);return _0x148263[_0xbfdb('0x4a')](_0x3b6a80);}})[_0xbfdb('0x24')](function(_0x34a112){if(_0x34a112){_0x4d26a2=_0x34a112[_0xbfdb('0x39')];if(!_0x47f809['query'][_0xbfdb('0x3a')](_0xbfdb('0x4e'))){_0x3b6a80[_0xbfdb('0x1e')]=qs[_0xbfdb('0x1e')](_0x47f809[_0xbfdb('0x34')][_0xbfdb('0x1e')]);_0x3b6a80[_0xbfdb('0x1b')]=qs['offset'](_0x47f809[_0xbfdb('0x34')][_0xbfdb('0x1b')]);}return _0x148263['getConfigurations'](_0x3b6a80);}})[_0xbfdb('0x24')](function(_0x457c6f){if(_0x457c6f){return _0x457c6f?{'count':_0x4d26a2,'rows':_0x457c6f}:null;}})[_0xbfdb('0x24')](respondWithResult(_0x8eb4af,null))[_0xbfdb('0x43')](handleError(_0x8eb4af,null));};exports[_0xbfdb('0x4f')]=function(_0x4278b3,_0xe42d11,_0x27a715){if(_0x4278b3['body']['id']){delete _0x4278b3['body']['id'];}return db[_0xbfdb('0x2e')][_0xbfdb('0x4b')]({'where':{'id':_0x4278b3[_0xbfdb('0x49')]['id']}})[_0xbfdb('0x24')](handleEntityNotFound(_0xe42d11,null))[_0xbfdb('0x24')](function(_0x567448){if(_0x567448){_0x4278b3[_0xbfdb('0x48')][_0xbfdb('0x50')]=_0x567448['id'];_0x4278b3[_0xbfdb('0x48')][_0xbfdb('0x51')]=integrations[_0xbfdb('0x52')](_0x4278b3['body'][_0xbfdb('0x53')],_0x4278b3[_0xbfdb('0x48')][_0xbfdb('0x31')]);_0x4278b3['body'][_0xbfdb('0x54')]=integrations['getDescriptions'](_0x4278b3[_0xbfdb('0x48')][_0xbfdb('0x53')],_0x4278b3[_0xbfdb('0x48')][_0xbfdb('0x31')]);return db['VtigerConfiguration']['create'](_0x4278b3[_0xbfdb('0x48')],{'include':[{'model':db[_0xbfdb('0x55')],'as':'Subjects'},{'model':db[_0xbfdb('0x55')],'as':_0xbfdb('0x54')}]});}return null;})[_0xbfdb('0x24')](respondWithResult(_0xe42d11,null))[_0xbfdb('0x43')](handleError(_0xe42d11,null));};var md5=require(_0xbfdb('0x56'));exports['getFields']=function(_0x3910c8,_0xa1484d,_0x15c57c){var _0x312a64=null;var _0x2fd9d3=null;var _0x3a6d0=null;var _0x1c6e53=null;var _0xfe4ccc='';return db[_0xbfdb('0x2e')][_0xbfdb('0x4b')]({'where':{'id':_0x3910c8[_0xbfdb('0x49')]['id']},'attributes':['id',_0xbfdb('0x2a'),_0xbfdb('0x57'),_0xbfdb('0x58'),'moduleName',_0xbfdb('0x59'),'serverUrl',_0xbfdb('0x5a')]})['then'](handleEntityNotFound(_0xa1484d,null))['then'](function(_0x349494){if(_0x349494){_0x312a64=_0x349494[_0xbfdb('0x57')];_0x2fd9d3=_0x349494['accessKey'];_0x3a6d0=_0x349494[_0xbfdb('0x5b')];_0xfe4ccc=_0x349494[_0xbfdb('0x59')];var _0x5aa6cb=_0xfe4ccc[_0xbfdb('0x5c')](-0x1);if(_0x5aa6cb==='/'){_0xfe4ccc=_0xfe4ccc[_0xbfdb('0x5d')](0x0,_0xfe4ccc[_0xbfdb('0x5e')](_0x5aa6cb));}_0x1c6e53=util[_0xbfdb('0x5f')](_0xbfdb('0x60'),_0xfe4ccc);var _0x2ad4f1={'method':'GET','uri':_0x1c6e53,'qs':{'operation':_0xbfdb('0x61'),'username':_0x349494[_0xbfdb('0x57')]},'json':!![]};return rp(_0x2ad4f1);}})['then'](function(_0x3c6bc0){if(_0x3c6bc0['success']){var _0x2b2a22={'method':_0xbfdb('0x62'),'uri':_0x1c6e53,'form':{'operation':'login','username':_0x312a64,'accessKey':md5(_0x3c6bc0['result']['token']+_0x2fd9d3)},'json':!![]};return rp(_0x2b2a22);}})[_0xbfdb('0x24')](function(_0x365eeb){if(_0x365eeb[_0xbfdb('0x63')]){var _0x1faff4={'method':_0xbfdb('0x64'),'uri':_0x1c6e53,'qs':{'operation':'describe','username':_0x312a64,'sessionName':_0x365eeb[_0xbfdb('0x65')]['sessionName'],'elementType':_0x3a6d0},'json':!![]};return rp(_0x1faff4);}})[_0xbfdb('0x24')](function(_0x2d06e5){if(_0x2d06e5['success']){var _0x56f95c=[_0xbfdb('0x66'),_0xbfdb('0x67'),'owner'];_['remove'](_0x2d06e5[_0xbfdb('0x65')][_0xbfdb('0x38')],function(_0x50caca){return _0x56f95c[_0xbfdb('0x68')](_0x50caca[_0xbfdb('0x31')][_0xbfdb('0x2a')]);});_[_0xbfdb('0x69')](_0x2d06e5['result']['fields'],function(_0x197487){return _0x197487[_0xbfdb('0x6a')]==='false';});return{'count':_0x2d06e5['result'][_0xbfdb('0x38')][_0xbfdb('0x39')],'rows':_[_0xbfdb('0x2d')](_0x2d06e5[_0xbfdb('0x65')][_0xbfdb('0x38')],function(_0xd0d2c8){return{'id':_0xd0d2c8[_0xbfdb('0x2a')],'name':_0xd0d2c8[_0xbfdb('0x6b')],'custom':_['startsWith'](_0xd0d2c8[_0xbfdb('0x2a')],_0xbfdb('0x6c'))?!![]:![],'options':_0xd0d2c8[_0xbfdb('0x31')]['name']===_0xbfdb('0x6d')&&_0xd0d2c8[_0xbfdb('0x31')]['picklistValues'][_0xbfdb('0x39')]>0x0?_[_0xbfdb('0x2d')](_0xd0d2c8[_0xbfdb('0x31')][_0xbfdb('0x6e')],function(_0x6db8eb){return{'name':_0x6db8eb[_0xbfdb('0x6b')],'value':_0x6db8eb[_0xbfdb('0x6f')]};}):[]};})};}})[_0xbfdb('0x24')](respondWithResult(_0xa1484d,null))[_0xbfdb('0x43')](function(_0x56f5dc){console[_0xbfdb('0x70')](_0xbfdb('0x71')+_0x56f5dc);var _0x137a54=_0x3910c8['query'][_0xbfdb('0x72')]?0x1f4:_0x56f5dc[_0xbfdb('0x73')]||0x1f4;logger[_0xbfdb('0x28')](_0xbfdb('0x74'),_0xbfdb('0x75'),_0x137a54,JSON[_0xbfdb('0x76')](_0x56f5dc));delete _0x56f5dc[_0xbfdb('0x2a')];if(_0x137a54===0x191){_0x137a54=0x190;}_0xa1484d[_0xbfdb('0x1a')](_0x137a54)[_0xbfdb('0x2b')](_0x3910c8[_0xbfdb('0x34')][_0xbfdb('0x72')]?{'message':_0xbfdb('0x77'),'statusCode':_0x56f5dc[_0xbfdb('0x73')]}:_0x56f5dc);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 09730a9..aad960d 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 _0xc24f=['../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes'];(function(_0x5eb472,_0x426f96){var _0x2045ae=function(_0x1c1975){while(--_0x1c1975){_0x5eb472['push'](_0x5eb472['shift']());}};_0x2045ae(++_0x426f96);}(_0xc24f,0x197));var _0xfc24=function(_0x378ae8,_0x43d7da){_0x378ae8=_0x378ae8-0x0;var _0x9454ff=_0xc24f[_0x378ae8];return _0x9454ff;};'use strict';var _=require(_0xfc24('0x0'));var util=require(_0xfc24('0x1'));var logger=require(_0xfc24('0x2'))(_0xfc24('0x3'));var moment=require('moment');var BPromise=require(_0xfc24('0x4'));var rp=require(_0xfc24('0x5'));var fs=require('fs');var path=require(_0xfc24('0x6'));var rimraf=require('rimraf');var config=require(_0xfc24('0x7'));var attributes=require(_0xfc24('0x8'));var integrations=require(_0xfc24('0x9'));module[_0xfc24('0xa')]=function(_0x513232,_0x2d0532){return _0x513232['define'](_0xfc24('0xb'),attributes,{'tableName':_0xfc24('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x759e=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x759e,0xd1));var _0xe759=function(_0x467942,_0x53e978){_0x467942=_0x467942-0x0;var _0x345e36=_0x759e[_0x467942];return _0x345e36;};'use strict';var _=require(_0xe759('0x0'));var util=require(_0xe759('0x1'));var logger=require('../../config/logger')(_0xe759('0x2'));var moment=require(_0xe759('0x3'));var BPromise=require(_0xe759('0x4'));var rp=require(_0xe759('0x5'));var fs=require('fs');var path=require(_0xe759('0x6'));var rimraf=require(_0xe759('0x7'));var config=require(_0xe759('0x8'));var attributes=require(_0xe759('0x9'));var integrations=require(_0xe759('0xa'));module[_0xe759('0xb')]=function(_0x4bf712,_0x59057f){return _0x4bf712[_0xe759('0xc')](_0xe759('0xd'),attributes,{'tableName':_0xe759('0xe'),'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 24efa18..822506c 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 _0x3f8c=['jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','debug','catch','find','raw','ShowVtigerAccount','moment','bluebird','randomstring','ioredis'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x3f8c,0x104));var _0xc3f8=function(_0x478ef3,_0x27e07c){_0x478ef3=_0x478ef3-0x0;var _0x59597e=_0x3f8c[_0x478ef3];return _0x59597e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')]({'raw':_0x2e7c0f['options']?_0x2e7c0f[_0xc3f8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x16')]||null:null,'attributes':_0x2e7c0f['options']?_0x2e7c0f['options'][_0xc3f8('0x17')]||null:null,'limit':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x18')]||null:null,'include':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2e7c0f['options']['include'],function(_0x4b83f0){return{'model':db[_0x4b83f0[_0xc3f8('0x1b')]],'as':_0x4b83f0['as'],'attributes':_0x4b83f0['attributes'],'include':_0x4b83f0[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4b83f0['include'],function(_0x4569c2){return{'model':db[_0x4569c2[_0xc3f8('0x1b')]],'as':_0x4569c2['as'],'attributes':_0x4569c2[_0xc3f8('0x17')],'include':_0x4569c2[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4569c2[_0xc3f8('0x19')],function(_0xf1d460){return{'model':db[_0xf1d460[_0xc3f8('0x1b')]],'as':_0xf1d460['as'],'attributes':_0xf1d460[_0xc3f8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x22c8e6){logger[_0xc3f8('0x9')](_0xc3f8('0x12'),_0x2e7c0f);logger[_0xc3f8('0x1c')]('GetVtigerAccount',_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x22c8e6));_0xb4ab67(_0x22c8e6);})[_0xc3f8('0x1d')](function(_0x218029){logger['error'](_0xc3f8('0x12'),_0x218029['message'],_0x2e7c0f);_0x47a185(_0x35500f[_0xc3f8('0xe')](0x1f4,_0x218029[_0xc3f8('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x48b32e){var _0x21a225=this;return new Promise(function(_0x25df65,_0xd32b09){return db[_0xc3f8('0x13')][_0xc3f8('0x1e')]({'raw':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x1f')]===undefined?!![]:![]:!![],'where':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['where']||null:null,'attributes':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x17')]||null:null,'include':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['include']?_['map'](_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x19')],function(_0x76ef00){return{'model':db[_0x76ef00[_0xc3f8('0x1b')]],'as':_0x76ef00['as'],'attributes':_0x76ef00[_0xc3f8('0x17')],'include':_0x76ef00['include']?_[_0xc3f8('0x1a')](_0x76ef00[_0xc3f8('0x19')],function(_0x2ba6aa){return{'model':db[_0x2ba6aa['model']],'as':_0x2ba6aa['as'],'attributes':_0x2ba6aa[_0xc3f8('0x17')],'include':_0x2ba6aa[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2ba6aa['include'],function(_0x21a725){return{'model':db[_0x21a725[_0xc3f8('0x1b')]],'as':_0x21a725['as'],'attributes':_0x21a725['attributes']};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x84d5d2){logger[_0xc3f8('0x9')](_0xc3f8('0x20'),_0x48b32e);logger[_0xc3f8('0x1c')](_0xc3f8('0x20'),_0x48b32e,JSON['stringify'](_0x84d5d2));_0x25df65(_0x84d5d2);})[_0xc3f8('0x1d')](function(_0x2e4880){logger[_0xc3f8('0xe')](_0xc3f8('0x20'),_0x2e4880[_0xc3f8('0x10')],_0x48b32e);_0xd32b09(_0x21a225['error'](0x1f4,_0x2e4880[_0xc3f8('0x10')]));});});}; \ No newline at end of file +var _0x97c1=['error','message','result','catch','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetVtigerAccount','debug','find','where','ShowVtigerAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3b2e1f,_0x48a2e1){var _0x1d9a9c=function(_0x2d03a0){while(--_0x2d03a0){_0x3b2e1f['push'](_0x3b2e1f['shift']());}};_0x1d9a9c(++_0x48a2e1);}(_0x97c1,0xdf));var _0x197c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x97c1[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});}exports['GetVtigerAccount']=function(_0x372311){var _0x47aaa9=this;return new Promise(function(_0x50ac52,_0x1725d9){return db[_0x197c('0x13')][_0x197c('0x14')]({'raw':_0x372311[_0x197c('0x15')]?_0x372311['options'][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')]['where']||null:null,'attributes':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x17')]||null:null,'limit':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x18')]||null:null,'include':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x372311[_0x197c('0x15')][_0x197c('0x19')],function(_0x174942){return{'model':db[_0x174942[_0x197c('0x1b')]],'as':_0x174942['as'],'attributes':_0x174942[_0x197c('0x17')],'include':_0x174942[_0x197c('0x19')]?_['map'](_0x174942[_0x197c('0x19')],function(_0x2911dd){return{'model':db[_0x2911dd[_0x197c('0x1b')]],'as':_0x2911dd['as'],'attributes':_0x2911dd['attributes'],'include':_0x2911dd[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x2911dd['include'],function(_0x5e7bc9){return{'model':db[_0x5e7bc9[_0x197c('0x1b')]],'as':_0x5e7bc9['as'],'attributes':_0x5e7bc9['attributes']};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x14b0aa){logger[_0x197c('0xa')](_0x197c('0x1d'),_0x372311);logger[_0x197c('0x1e')](_0x197c('0x1d'),_0x372311,JSON[_0x197c('0xe')](_0x14b0aa));_0x50ac52(_0x14b0aa);})[_0x197c('0x12')](function(_0x4422d1){logger['error']('GetVtigerAccount',_0x4422d1['message'],_0x372311);_0x1725d9(_0x47aaa9['error'](0x1f4,_0x4422d1[_0x197c('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x252cde){var _0x35dbf3=this;return new Promise(function(_0x58bc60,_0x422ac6){return db['VtigerAccount'][_0x197c('0x1f')]({'raw':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x20')]||null:null,'attributes':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')]['attributes']||null:null,'include':_0x252cde['options']?_0x252cde[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x252cde[_0x197c('0x15')][_0x197c('0x19')],function(_0x1cb7e8){return{'model':db[_0x1cb7e8[_0x197c('0x1b')]],'as':_0x1cb7e8['as'],'attributes':_0x1cb7e8['attributes'],'include':_0x1cb7e8['include']?_[_0x197c('0x1a')](_0x1cb7e8[_0x197c('0x19')],function(_0x4d085b){return{'model':db[_0x4d085b['model']],'as':_0x4d085b['as'],'attributes':_0x4d085b[_0x197c('0x17')],'include':_0x4d085b[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x4d085b[_0x197c('0x19')],function(_0x45095c){return{'model':db[_0x45095c[_0x197c('0x1b')]],'as':_0x45095c['as'],'attributes':_0x45095c[_0x197c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x44ce68){logger['info'](_0x197c('0x21'),_0x252cde);logger[_0x197c('0x1e')](_0x197c('0x21'),_0x252cde,JSON[_0x197c('0xe')](_0x44ce68));_0x58bc60(_0x44ce68);})[_0x197c('0x12')](function(_0x151e2f){logger['error'](_0x197c('0x21'),_0x151e2f[_0x197c('0x10')],_0x252cde);_0x422ac6(_0x35dbf3[_0x197c('0xf')](0x1f4,_0x151e2f['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 5433faa..f45c977 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 _0x1486=['../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3c5c3e,_0x4f6f26){var _0x4f8e4e=function(_0x4ac9c5){while(--_0x4ac9c5){_0x3c5c3e['push'](_0x3c5c3e['shift']());}};_0x4f8e4e(++_0x4f6f26);}(_0x1486,0x1dd));var _0x6148=function(_0x2040d4,_0x413148){_0x2040d4=_0x2040d4-0x0;var _0x176ee0=_0x1486[_0x2040d4];return _0x176ee0;};'use strict';var multer=require(_0x6148('0x0'));var util=require(_0x6148('0x1'));var path=require(_0x6148('0x2'));var timeout=require('connect-timeout');var express=require(_0x6148('0x3'));var router=express['Router']();var fs_extra=require(_0x6148('0x4'));var auth=require(_0x6148('0x5'));var interaction=require(_0x6148('0x6'));var config=require(_0x6148('0x7'));var controller=require(_0x6148('0x8'));router[_0x6148('0x9')]('/',auth[_0x6148('0xa')](),controller['index']);router[_0x6148('0x9')]('/:id',auth[_0x6148('0xa')](),controller[_0x6148('0xb')]);router[_0x6148('0x9')]('/:id/fields',auth[_0x6148('0xa')](),controller[_0x6148('0xc')]);router[_0x6148('0x9')](_0x6148('0xd'),auth[_0x6148('0xa')](),controller['getSubjects']);router[_0x6148('0x9')](_0x6148('0xe'),auth[_0x6148('0xa')](),controller[_0x6148('0xf')]);router[_0x6148('0x10')]('/',auth[_0x6148('0xa')](),controller[_0x6148('0x11')]);router[_0x6148('0x12')](_0x6148('0x13'),auth[_0x6148('0xa')](),controller['update']);router[_0x6148('0x14')](_0x6148('0x13'),auth[_0x6148('0xa')](),controller['destroy']);module[_0x6148('0x15')]=router; \ No newline at end of file +var _0xa412=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x29ad21,_0x1f9ed7){var _0x45fdcc=function(_0x360c46){while(--_0x360c46){_0x29ad21['push'](_0x29ad21['shift']());}};_0x45fdcc(++_0x1f9ed7);}(_0xa412,0xfc));var _0x2a41=function(_0x5be301,_0x2a1c51){_0x5be301=_0x5be301-0x0;var _0xa2f12b=_0xa412[_0x5be301];return _0xa2f12b;};'use strict';var multer=require(_0x2a41('0x0'));var util=require(_0x2a41('0x1'));var path=require(_0x2a41('0x2'));var timeout=require(_0x2a41('0x3'));var express=require(_0x2a41('0x4'));var router=express[_0x2a41('0x5')]();var fs_extra=require(_0x2a41('0x6'));var auth=require(_0x2a41('0x7'));var interaction=require(_0x2a41('0x8'));var config=require(_0x2a41('0x9'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x2a41('0xa')](),controller[_0x2a41('0xb')]);router[_0x2a41('0xc')]('/:id',auth[_0x2a41('0xa')](),controller[_0x2a41('0xd')]);router[_0x2a41('0xc')](_0x2a41('0xe'),auth[_0x2a41('0xa')](),controller[_0x2a41('0xf')]);router[_0x2a41('0xc')](_0x2a41('0x10'),auth[_0x2a41('0xa')](),controller[_0x2a41('0x11')]);router[_0x2a41('0xc')](_0x2a41('0x12'),auth[_0x2a41('0xa')](),controller[_0x2a41('0x13')]);router[_0x2a41('0x14')]('/',auth[_0x2a41('0xa')](),controller[_0x2a41('0x15')]);router[_0x2a41('0x16')](_0x2a41('0x17'),auth[_0x2a41('0xa')](),controller[_0x2a41('0x18')]);router[_0x2a41('0x19')](_0x2a41('0x17'),auth[_0x2a41('0xa')](),controller[_0x2a41('0x1a')]);module[_0x2a41('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index acf723d..e6ffebf 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 _0xf41a=['STRING','sequelize','exports'];(function(_0x34944a,_0x1e947c){var _0x1f287c=function(_0x3fc658){while(--_0x3fc658){_0x34944a['push'](_0x34944a['shift']());}};_0x1f287c(++_0x1e947c);}(_0xf41a,0xc1));var _0xaf41=function(_0x1a2d37,_0x19cd85){_0x1a2d37=_0x1a2d37-0x0;var _0x4d5e76=_0xf41a[_0x1a2d37];return _0x4d5e76;};'use strict';var Sequelize=require(_0xaf41('0x0'));module[_0xaf41('0x1')]={'name':{'type':Sequelize[_0xaf41('0x2')]},'description':{'type':Sequelize[_0xaf41('0x2')]}}; \ No newline at end of file +var _0x423d=['STRING','sequelize'];(function(_0x4a2f70,_0x4051ec){var _0x1538b6=function(_0x519cdd){while(--_0x519cdd){_0x4a2f70['push'](_0x4a2f70['shift']());}};_0x1538b6(++_0x4051ec);}(_0x423d,0x8f));var _0xd423=function(_0x14856e,_0x3cab87){_0x14856e=_0x14856e-0x0;var _0x596e91=_0x423d[_0x14856e];return _0x596e91;};'use strict';var Sequelize=require(_0xd423('0x0'));module['exports']={'name':{'type':Sequelize[_0xd423('0x1')]},'description':{'type':Sequelize[_0xd423('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 572569a..35e46fa 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 _0x211a=['options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','pick','getFields','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x2a2849,_0x4340fa){var _0x10fc47=function(_0x5ec51c){while(--_0x5ec51c){_0x2a2849['push'](_0x2a2849['shift']());}};_0x10fc47(++_0x4340fa);}(_0x211a,0x64));var _0xa211=function(_0x49e5ff,_0x3f1460){_0x49e5ff=_0x49e5ff-0x0;var _0x211eac=_0x211a[_0x49e5ff];return _0x211eac;};'use strict';var emlformat=require(_0xa211('0x0'));var rimraf=require(_0xa211('0x1'));var zipdir=require(_0xa211('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa211('0x3'));var moment=require('moment');var BPromise=require(_0xa211('0x4'));var Mustache=require(_0xa211('0x5'));var util=require(_0xa211('0x6'));var path=require(_0xa211('0x7'));var sox=require(_0xa211('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa211('0x9'));var _=require(_0xa211('0xa'));var squel=require('squel');var crypto=require(_0xa211('0xb'));var jsforce=require(_0xa211('0xc'));var deskjs=require(_0xa211('0xd'));var toCsv=require(_0xa211('0xe'));var querystring=require('querystring');var Papa=require(_0xa211('0xf'));var Redis=require(_0xa211('0x10'));var authService=require(_0xa211('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa211('0x12'));var hardwareService=require(_0xa211('0x13'));var logger=require(_0xa211('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa211('0x15'));var db=require(_0xa211('0x16'))['db'];function respondWithStatusCode(_0x2199a5,_0x3c8937){_0x3c8937=_0x3c8937||0xcc;return function(_0x2a6918){if(_0x2a6918){return _0x2199a5['sendStatus'](_0x3c8937);}return _0x2199a5[_0xa211('0x17')](_0x3c8937)['end']();};}function respondWithResult(_0x1d1af6,_0x2abdbf){_0x2abdbf=_0x2abdbf||0xc8;return function(_0x165e08){if(_0x165e08){return _0x1d1af6[_0xa211('0x17')](_0x2abdbf)[_0xa211('0x18')](_0x165e08);}};}function respondWithFilteredResult(_0x27b2f9,_0x22c8b9){return function(_0x4e7e81){if(_0x4e7e81){var _0x5cc1a6=typeof _0x22c8b9[_0xa211('0x19')]===_0xa211('0x1a')&&typeof _0x22c8b9[_0xa211('0x1b')]===_0xa211('0x1a');var _0x41ee49=_0x4e7e81[_0xa211('0x1c')];var _0x388809=_0x5cc1a6?0x0:_0x22c8b9['offset'];var _0x5ccab8=_0x5cc1a6?_0x4e7e81[_0xa211('0x1c')]:_0x22c8b9[_0xa211('0x19')]+_0x22c8b9[_0xa211('0x1b')];var _0x5a2223;if(_0x5ccab8>=_0x41ee49){_0x5ccab8=_0x41ee49;_0x5a2223=0xc8;}else{_0x5a2223=0xce;}_0x27b2f9[_0xa211('0x17')](_0x5a2223);return _0x27b2f9[_0xa211('0x1d')](_0xa211('0x1e'),_0x388809+'-'+_0x5ccab8+'/'+_0x41ee49)[_0xa211('0x18')](_0x4e7e81);}return null;};}function patchUpdates(_0xb9d10f){return function(_0x6f5c2c){try{jsonpatch[_0xa211('0x1f')](_0x6f5c2c,_0xb9d10f,!![]);}catch(_0x4364c4){return BPromise[_0xa211('0x20')](_0x4364c4);}return _0x6f5c2c[_0xa211('0x21')]();};}function saveUpdates(_0x492817,_0x1304d7){return function(_0x1f7e39){if(_0x1f7e39){return _0x1f7e39[_0xa211('0x22')](_0x492817)[_0xa211('0x23')](function(_0x1ddeda){return _0x1ddeda;});}return null;};}function removeEntity(_0x106a87,_0x3ce919){return function(_0x4de90d){if(_0x4de90d){return _0x4de90d[_0xa211('0x24')]()['then'](function(){_0x106a87['status'](0xcc)[_0xa211('0x25')]();});}};}function handleEntityNotFound(_0x8e04ec,_0x5a65e3){return function(_0x40e61d){if(!_0x40e61d){_0x8e04ec[_0xa211('0x26')](0x194);}return _0x40e61d;};}function handleError(_0x4a8c3b,_0x47fffe){_0x47fffe=_0x47fffe||0x1f4;return function(_0x5d49f1){logger[_0xa211('0x27')](_0x5d49f1[_0xa211('0x28')]);if(_0x5d49f1[_0xa211('0x29')]){delete _0x5d49f1[_0xa211('0x29')];}_0x4a8c3b[_0xa211('0x17')](_0x47fffe)[_0xa211('0x2a')](_0x5d49f1);};}exports[_0xa211('0x2b')]=function(_0x231c49,_0x50db0c){var _0x4dd5b0={},_0x1be3e8={},_0x458fed={'count':0x0,'rows':[]};var _0x2f9b8e=_['map'](db[_0xa211('0x2c')][_0xa211('0x2d')],function(_0x46e05d){return{'name':_0x46e05d[_0xa211('0x2e')],'type':_0x46e05d[_0xa211('0x2f')][_0xa211('0x30')]};});_0x1be3e8[_0xa211('0x31')]=_[_0xa211('0x32')](_0x2f9b8e,_0xa211('0x29'));_0x1be3e8[_0xa211('0x33')]=_[_0xa211('0x34')](_0x231c49[_0xa211('0x33')]);_0x1be3e8[_0xa211('0x35')]=_[_0xa211('0x36')](_0x1be3e8[_0xa211('0x31')],_0x1be3e8['query']);_0x4dd5b0[_0xa211('0x37')]=_[_0xa211('0x36')](_0x1be3e8[_0xa211('0x31')],qs[_0xa211('0x38')](_0x231c49[_0xa211('0x33')][_0xa211('0x38')]));_0x4dd5b0['attributes']=_0x4dd5b0[_0xa211('0x37')][_0xa211('0x39')]?_0x4dd5b0[_0xa211('0x37')]:_0x1be3e8[_0xa211('0x31')];if(!_0x231c49[_0xa211('0x33')][_0xa211('0x3a')](_0xa211('0x3b'))){_0x4dd5b0[_0xa211('0x1b')]=qs[_0xa211('0x1b')](_0x231c49[_0xa211('0x33')][_0xa211('0x1b')]);_0x4dd5b0[_0xa211('0x19')]=qs[_0xa211('0x19')](_0x231c49[_0xa211('0x33')][_0xa211('0x19')]);}_0x4dd5b0[_0xa211('0x3c')]=qs['sort'](_0x231c49['query'][_0xa211('0x3d')]);_0x4dd5b0[_0xa211('0x3e')]=qs[_0xa211('0x35')](_['pick'](_0x231c49['query'],_0x1be3e8[_0xa211('0x35')]),_0x2f9b8e);if(_0x231c49[_0xa211('0x33')][_0xa211('0x3f')]){_0x4dd5b0[_0xa211('0x3e')]=_[_0xa211('0x40')](_0x4dd5b0['where'],{'$or':_['map'](_0x2f9b8e,function(_0x17e1ef){if(_0x17e1ef['type']!==_0xa211('0x41')){var _0x2edc65={};_0x2edc65[_0x17e1ef[_0xa211('0x29')]]={'$like':'%'+_0x231c49[_0xa211('0x33')][_0xa211('0x3f')]+'%'};return _0x2edc65;}})});}_0x4dd5b0=_[_0xa211('0x40')]({},_0x4dd5b0,_0x231c49[_0xa211('0x42')]);var _0x21bd7e={'where':_0x4dd5b0['where']};return db[_0xa211('0x2c')][_0xa211('0x1c')](_0x21bd7e)[_0xa211('0x23')](function(_0x56b49d){_0x458fed[_0xa211('0x1c')]=_0x56b49d;if(_0x231c49[_0xa211('0x33')][_0xa211('0x43')]){_0x4dd5b0[_0xa211('0x44')]=[{'all':!![]}];}return db[_0xa211('0x2c')][_0xa211('0x45')](_0x4dd5b0);})[_0xa211('0x23')](function(_0x570378){_0x458fed[_0xa211('0x46')]=_0x570378;return _0x458fed;})['then'](respondWithFilteredResult(_0x50db0c,_0x4dd5b0))[_0xa211('0x47')](handleError(_0x50db0c,null));};exports[_0xa211('0x48')]=function(_0x1703c9,_0x4d36ce){var _0x2c96ae={'raw':![],'where':{'id':_0x1703c9[_0xa211('0x49')]['id']}},_0x2491df={};_0x2491df[_0xa211('0x31')]=_[_0xa211('0x34')](db[_0xa211('0x2c')][_0xa211('0x2d')]);_0x2491df[_0xa211('0x33')]=_[_0xa211('0x34')](_0x1703c9[_0xa211('0x33')]);_0x2491df['filters']=_['intersection'](_0x2491df[_0xa211('0x31')],_0x2491df[_0xa211('0x33')]);_0x2c96ae['attributes']=_[_0xa211('0x36')](_0x2491df[_0xa211('0x31')],qs['fields'](_0x1703c9[_0xa211('0x33')]['fields']));_0x2c96ae[_0xa211('0x37')]=_0x2c96ae[_0xa211('0x37')][_0xa211('0x39')]?_0x2c96ae[_0xa211('0x37')]:_0x2491df[_0xa211('0x31')];if(_0x1703c9[_0xa211('0x33')][_0xa211('0x43')]){_0x2c96ae[_0xa211('0x44')]=[{'all':!![]}];}_0x2c96ae=_['merge']({},_0x2c96ae,_0x1703c9['options']);return db[_0xa211('0x2c')][_0xa211('0x4a')](_0x2c96ae)[_0xa211('0x23')](handleEntityNotFound(_0x4d36ce,null))['then'](respondWithResult(_0x4d36ce,null))['catch'](handleError(_0x4d36ce,null));};exports[_0xa211('0x4b')]=function(_0x54f812,_0x5b164c){return db[_0xa211('0x2c')][_0xa211('0x4b')](_0x54f812[_0xa211('0x4c')],{})['then'](respondWithResult(_0x5b164c,0xc9))['catch'](handleError(_0x5b164c,null));};exports[_0xa211('0x22')]=function(_0x25032c,_0x127d90){if(_0x25032c['body']['id']){delete _0x25032c[_0xa211('0x4c')]['id'];}return db['VtigerConfiguration'][_0xa211('0x4a')]({'where':{'id':_0x25032c[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x127d90,null))['then'](saveUpdates(_0x25032c['body'],null))['then'](respondWithResult(_0x127d90,null))[_0xa211('0x47')](handleError(_0x127d90,null));};exports['destroy']=function(_0xf01f29,_0x4970c1){return db[_0xa211('0x2c')]['find']({'where':{'id':_0xf01f29[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x4970c1,null))[_0xa211('0x23')](removeEntity(_0x4970c1,null))[_0xa211('0x47')](handleError(_0x4970c1,null));};exports['getFields']=function(_0xab622b,_0x16a5b9,_0x3a2b88){var _0x376418={};var _0x2b715e={};var _0x11d688;var _0x8c5788;return db[_0xa211('0x2c')][_0xa211('0x4d')]({'where':{'id':_0xab622b[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x16a5b9,null))[_0xa211('0x23')](function(_0x339cf7){if(_0x339cf7){_0x11d688=_0x339cf7;_0x2b715e[_0xa211('0x31')]=_['keys'](db['VtigerField'][_0xa211('0x2d')]);_0x2b715e[_0xa211('0x33')]=_['keys'](_0xab622b['query']);_0x2b715e[_0xa211('0x35')]=_[_0xa211('0x36')](_0x2b715e[_0xa211('0x31')],_0x2b715e['query']);_0x376418[_0xa211('0x37')]=_[_0xa211('0x36')](_0x2b715e[_0xa211('0x31')],qs[_0xa211('0x38')](_0xab622b[_0xa211('0x33')][_0xa211('0x38')]));_0x376418[_0xa211('0x37')]=_0x376418[_0xa211('0x37')][_0xa211('0x39')]?_0x376418[_0xa211('0x37')]:_0x2b715e[_0xa211('0x31')];_0x376418[_0xa211('0x3c')]=qs[_0xa211('0x3d')](_0xab622b[_0xa211('0x33')][_0xa211('0x3d')]);_0x376418[_0xa211('0x3e')]=qs['filters'](_[_0xa211('0x4e')](_0xab622b['query'],_0x2b715e[_0xa211('0x35')]));if(_0xab622b[_0xa211('0x33')][_0xa211('0x3f')]){_0x376418['where']=_[_0xa211('0x40')](_0x376418[_0xa211('0x3e')],{'$or':_[_0xa211('0x32')](_0x376418[_0xa211('0x37')],function(_0x1cc68f){var _0x571f54={};_0x571f54[_0x1cc68f]={'$like':'%'+_0xab622b[_0xa211('0x33')][_0xa211('0x3f')]+'%'};return _0x571f54;})});}_0x376418=_['merge']({},_0x376418,_0xab622b[_0xa211('0x42')]);return _0x11d688[_0xa211('0x4f')](_0x376418);}})[_0xa211('0x23')](function(_0x5623b9){if(_0x5623b9){_0x8c5788=_0x5623b9[_0xa211('0x39')];if(!_0xab622b[_0xa211('0x33')][_0xa211('0x3a')]('nolimit')){_0x376418[_0xa211('0x1b')]=qs[_0xa211('0x1b')](_0xab622b[_0xa211('0x33')][_0xa211('0x1b')]);_0x376418[_0xa211('0x19')]=qs[_0xa211('0x19')](_0xab622b['query'][_0xa211('0x19')]);}return _0x11d688[_0xa211('0x4f')](_0x376418);}})[_0xa211('0x23')](function(_0x524333){if(_0x524333){return _0x524333?{'count':_0x8c5788,'rows':_0x524333}:null;}})['then'](respondWithResult(_0x16a5b9,null))[_0xa211('0x47')](handleError(_0x16a5b9,null));};exports[_0xa211('0x50')]=function(_0x559f60,_0x3489d5,_0x28e3b2){var _0x224279={};var _0x2c4976={};var _0x1c7f03;var _0x2d57b5;return db['VtigerConfiguration'][_0xa211('0x4d')]({'where':{'id':_0x559f60[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x3489d5,null))[_0xa211('0x23')](function(_0x395a3c){if(_0x395a3c){_0x1c7f03=_0x395a3c;_0x2c4976['model']=_[_0xa211('0x34')](db[_0xa211('0x51')][_0xa211('0x2d')]);_0x2c4976[_0xa211('0x33')]=_[_0xa211('0x34')](_0x559f60['query']);_0x2c4976[_0xa211('0x35')]=_['intersection'](_0x2c4976[_0xa211('0x31')],_0x2c4976[_0xa211('0x33')]);_0x224279[_0xa211('0x37')]=_[_0xa211('0x36')](_0x2c4976[_0xa211('0x31')],qs[_0xa211('0x38')](_0x559f60[_0xa211('0x33')][_0xa211('0x38')]));_0x224279[_0xa211('0x37')]=_0x224279[_0xa211('0x37')][_0xa211('0x39')]?_0x224279[_0xa211('0x37')]:_0x2c4976[_0xa211('0x31')];_0x224279['order']=qs[_0xa211('0x3d')](_0x559f60[_0xa211('0x33')][_0xa211('0x3d')]);_0x224279['where']=qs[_0xa211('0x35')](_['pick'](_0x559f60['query'],_0x2c4976[_0xa211('0x35')]));if(_0x559f60[_0xa211('0x33')][_0xa211('0x3f')]){_0x224279[_0xa211('0x3e')]=_[_0xa211('0x40')](_0x224279[_0xa211('0x3e')],{'$or':_['map'](_0x224279[_0xa211('0x37')],function(_0x168a88){var _0x58288b={};_0x58288b[_0x168a88]={'$like':'%'+_0x559f60[_0xa211('0x33')][_0xa211('0x3f')]+'%'};return _0x58288b;})});}_0x224279=_[_0xa211('0x40')]({},_0x224279,_0x559f60['options']);return _0x1c7f03[_0xa211('0x50')](_0x224279);}})[_0xa211('0x23')](function(_0x544829){if(_0x544829){_0x2d57b5=_0x544829[_0xa211('0x39')];if(!_0x559f60['query']['hasOwnProperty'](_0xa211('0x3b'))){_0x224279[_0xa211('0x1b')]=qs[_0xa211('0x1b')](_0x559f60[_0xa211('0x33')][_0xa211('0x1b')]);_0x224279[_0xa211('0x19')]=qs['offset'](_0x559f60[_0xa211('0x33')][_0xa211('0x19')]);}return _0x1c7f03[_0xa211('0x50')](_0x224279);}})[_0xa211('0x23')](function(_0x2e1fbd){if(_0x2e1fbd){return _0x2e1fbd?{'count':_0x2d57b5,'rows':_0x2e1fbd}:null;}})['then'](respondWithResult(_0x3489d5,null))['catch'](handleError(_0x3489d5,null));};exports['getDescriptions']=function(_0x414f4c,_0x264472,_0x439bd4){var _0x5552dd={};var _0xa9a10d={};var _0x29f0fa;var _0x330383;return db[_0xa211('0x2c')][_0xa211('0x4d')]({'where':{'id':_0x414f4c[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x264472,null))[_0xa211('0x23')](function(_0x24a59b){if(_0x24a59b){_0x29f0fa=_0x24a59b;_0xa9a10d[_0xa211('0x31')]=_[_0xa211('0x34')](db[_0xa211('0x51')][_0xa211('0x2d')]);_0xa9a10d[_0xa211('0x33')]=_[_0xa211('0x34')](_0x414f4c[_0xa211('0x33')]);_0xa9a10d[_0xa211('0x35')]=_[_0xa211('0x36')](_0xa9a10d['model'],_0xa9a10d[_0xa211('0x33')]);_0x5552dd[_0xa211('0x37')]=_['intersection'](_0xa9a10d[_0xa211('0x31')],qs[_0xa211('0x38')](_0x414f4c[_0xa211('0x33')][_0xa211('0x38')]));_0x5552dd['attributes']=_0x5552dd[_0xa211('0x37')][_0xa211('0x39')]?_0x5552dd[_0xa211('0x37')]:_0xa9a10d['model'];_0x5552dd[_0xa211('0x3c')]=qs[_0xa211('0x3d')](_0x414f4c[_0xa211('0x33')]['sort']);_0x5552dd['where']=qs[_0xa211('0x35')](_[_0xa211('0x4e')](_0x414f4c[_0xa211('0x33')],_0xa9a10d[_0xa211('0x35')]));if(_0x414f4c[_0xa211('0x33')][_0xa211('0x3f')]){_0x5552dd[_0xa211('0x3e')]=_[_0xa211('0x40')](_0x5552dd[_0xa211('0x3e')],{'$or':_['map'](_0x5552dd[_0xa211('0x37')],function(_0xaf00fd){var _0x482f52={};_0x482f52[_0xaf00fd]={'$like':'%'+_0x414f4c['query'][_0xa211('0x3f')]+'%'};return _0x482f52;})});}_0x5552dd=_[_0xa211('0x40')]({},_0x5552dd,_0x414f4c[_0xa211('0x42')]);return _0x29f0fa[_0xa211('0x52')](_0x5552dd);}})[_0xa211('0x23')](function(_0x29a27d){if(_0x29a27d){_0x330383=_0x29a27d[_0xa211('0x39')];if(!_0x414f4c['query'][_0xa211('0x3a')](_0xa211('0x3b'))){_0x5552dd[_0xa211('0x1b')]=qs[_0xa211('0x1b')](_0x414f4c[_0xa211('0x33')][_0xa211('0x1b')]);_0x5552dd['offset']=qs[_0xa211('0x19')](_0x414f4c[_0xa211('0x33')]['offset']);}return _0x29f0fa[_0xa211('0x52')](_0x5552dd);}})[_0xa211('0x23')](function(_0x4c09fd){if(_0x4c09fd){return _0x4c09fd?{'count':_0x330383,'rows':_0x4c09fd}:null;}})[_0xa211('0x23')](respondWithResult(_0x264472,null))[_0xa211('0x47')](handleError(_0x264472,null));}; \ No newline at end of file +var _0x6a11=['attributes','intersection','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','destroy','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','set','Content-Range','reject','update','then','end','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','model','keys','query','filters'];(function(_0x23ef7e,_0x2648ea){var _0x450f62=function(_0x433584){while(--_0x433584){_0x23ef7e['push'](_0x23ef7e['shift']());}};_0x450f62(++_0x2648ea);}(_0x6a11,0xc0));var _0x16a1=function(_0x4e7d5c,_0x3e911d){_0x4e7d5c=_0x4e7d5c-0x0;var _0x563307=_0x6a11[_0x4e7d5c];return _0x563307;};'use strict';var emlformat=require(_0x16a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16a1('0x1'));var jsonpatch=require(_0x16a1('0x2'));var rp=require(_0x16a1('0x3'));var moment=require(_0x16a1('0x4'));var BPromise=require(_0x16a1('0x5'));var Mustache=require(_0x16a1('0x6'));var util=require(_0x16a1('0x7'));var path=require(_0x16a1('0x8'));var sox=require('sox');var csv=require(_0x16a1('0x9'));var ejs=require(_0x16a1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x16a1('0xb'));var squel=require(_0x16a1('0xc'));var crypto=require(_0x16a1('0xd'));var jsforce=require(_0x16a1('0xe'));var deskjs=require(_0x16a1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x16a1('0x10'));var Papa=require(_0x16a1('0x11'));var Redis=require(_0x16a1('0x12'));var authService=require(_0x16a1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x16a1('0x14'));var hardwareService=require(_0x16a1('0x15'));var logger=require(_0x16a1('0x16'))(_0x16a1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x16a1('0x18'));var db=require(_0x16a1('0x19'))['db'];function respondWithStatusCode(_0x528b80,_0x598872){_0x598872=_0x598872||0xcc;return function(_0x1af4c9){if(_0x1af4c9){return _0x528b80[_0x16a1('0x1a')](_0x598872);}return _0x528b80[_0x16a1('0x1b')](_0x598872)['end']();};}function respondWithResult(_0x40b3be,_0x2da38c){_0x2da38c=_0x2da38c||0xc8;return function(_0xb4ec9){if(_0xb4ec9){return _0x40b3be['status'](_0x2da38c)[_0x16a1('0x1c')](_0xb4ec9);}};}function respondWithFilteredResult(_0x999548,_0x573b40){return function(_0x1ad88c){if(_0x1ad88c){var _0x47ca75=typeof _0x573b40['offset']==='undefined'&&typeof _0x573b40['limit']===_0x16a1('0x1d');var _0x40f08c=_0x1ad88c['count'];var _0x4d4ee6=_0x47ca75?0x0:_0x573b40[_0x16a1('0x1e')];var _0x3513d0=_0x47ca75?_0x1ad88c[_0x16a1('0x1f')]:_0x573b40[_0x16a1('0x1e')]+_0x573b40['limit'];var _0x554bae;if(_0x3513d0>=_0x40f08c){_0x3513d0=_0x40f08c;_0x554bae=0xc8;}else{_0x554bae=0xce;}_0x999548['status'](_0x554bae);return _0x999548[_0x16a1('0x20')](_0x16a1('0x21'),_0x4d4ee6+'-'+_0x3513d0+'/'+_0x40f08c)[_0x16a1('0x1c')](_0x1ad88c);}return null;};}function patchUpdates(_0x4a9a94){return function(_0x4876ce){try{jsonpatch['apply'](_0x4876ce,_0x4a9a94,!![]);}catch(_0x258640){return BPromise[_0x16a1('0x22')](_0x258640);}return _0x4876ce['save']();};}function saveUpdates(_0x189a42,_0x380710){return function(_0x45e132){if(_0x45e132){return _0x45e132[_0x16a1('0x23')](_0x189a42)['then'](function(_0x923b7){return _0x923b7;});}return null;};}function removeEntity(_0x3d82c9,_0x55d1af){return function(_0x4a0514){if(_0x4a0514){return _0x4a0514['destroy']()[_0x16a1('0x24')](function(){_0x3d82c9[_0x16a1('0x1b')](0xcc)[_0x16a1('0x25')]();});}};}function handleEntityNotFound(_0x22dc94,_0x4bd6cb){return function(_0x5483c7){if(!_0x5483c7){_0x22dc94[_0x16a1('0x1a')](0x194);}return _0x5483c7;};}function handleError(_0x584fc0,_0x56ee2a){_0x56ee2a=_0x56ee2a||0x1f4;return function(_0x4e9b2a){logger[_0x16a1('0x26')](_0x4e9b2a[_0x16a1('0x27')]);if(_0x4e9b2a[_0x16a1('0x28')]){delete _0x4e9b2a[_0x16a1('0x28')];}_0x584fc0[_0x16a1('0x1b')](_0x56ee2a)[_0x16a1('0x29')](_0x4e9b2a);};}exports[_0x16a1('0x2a')]=function(_0x185cf4,_0x4c53e7){var _0x2a0476={},_0xd15085={},_0x416582={'count':0x0,'rows':[]};var _0x458999=_[_0x16a1('0x2b')](db[_0x16a1('0x2c')][_0x16a1('0x2d')],function(_0x2ec850){return{'name':_0x2ec850['fieldName'],'type':_0x2ec850[_0x16a1('0x2e')]['key']};});_0xd15085[_0x16a1('0x2f')]=_[_0x16a1('0x2b')](_0x458999,_0x16a1('0x28'));_0xd15085['query']=_[_0x16a1('0x30')](_0x185cf4[_0x16a1('0x31')]);_0xd15085[_0x16a1('0x32')]=_['intersection'](_0xd15085[_0x16a1('0x2f')],_0xd15085[_0x16a1('0x31')]);_0x2a0476[_0x16a1('0x33')]=_[_0x16a1('0x34')](_0xd15085[_0x16a1('0x2f')],qs['fields'](_0x185cf4[_0x16a1('0x31')]['fields']));_0x2a0476[_0x16a1('0x33')]=_0x2a0476[_0x16a1('0x33')][_0x16a1('0x35')]?_0x2a0476[_0x16a1('0x33')]:_0xd15085[_0x16a1('0x2f')];if(!_0x185cf4[_0x16a1('0x31')][_0x16a1('0x36')]('nolimit')){_0x2a0476[_0x16a1('0x37')]=qs[_0x16a1('0x37')](_0x185cf4[_0x16a1('0x31')]['limit']);_0x2a0476[_0x16a1('0x1e')]=qs[_0x16a1('0x1e')](_0x185cf4['query']['offset']);}_0x2a0476[_0x16a1('0x38')]=qs[_0x16a1('0x39')](_0x185cf4[_0x16a1('0x31')]['sort']);_0x2a0476[_0x16a1('0x3a')]=qs[_0x16a1('0x32')](_['pick'](_0x185cf4[_0x16a1('0x31')],_0xd15085[_0x16a1('0x32')]),_0x458999);if(_0x185cf4[_0x16a1('0x31')][_0x16a1('0x3b')]){_0x2a0476[_0x16a1('0x3a')]=_['merge'](_0x2a0476[_0x16a1('0x3a')],{'$or':_['map'](_0x458999,function(_0x58540e){if(_0x58540e['type']!==_0x16a1('0x3c')){var _0x92485e={};_0x92485e[_0x58540e[_0x16a1('0x28')]]={'$like':'%'+_0x185cf4[_0x16a1('0x31')][_0x16a1('0x3b')]+'%'};return _0x92485e;}})});}_0x2a0476=_[_0x16a1('0x3d')]({},_0x2a0476,_0x185cf4[_0x16a1('0x3e')]);var _0x18c086={'where':_0x2a0476[_0x16a1('0x3a')]};return db[_0x16a1('0x2c')][_0x16a1('0x1f')](_0x18c086)[_0x16a1('0x24')](function(_0x1336c8){_0x416582[_0x16a1('0x1f')]=_0x1336c8;if(_0x185cf4['query'][_0x16a1('0x3f')]){_0x2a0476['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x16a1('0x40')](_0x2a0476);})[_0x16a1('0x24')](function(_0x2c0ea6){_0x416582[_0x16a1('0x41')]=_0x2c0ea6;return _0x416582;})[_0x16a1('0x24')](respondWithFilteredResult(_0x4c53e7,_0x2a0476))[_0x16a1('0x42')](handleError(_0x4c53e7,null));};exports[_0x16a1('0x43')]=function(_0x19cdf4,_0x4c7df5){var _0xf27e61={'raw':![],'where':{'id':_0x19cdf4[_0x16a1('0x44')]['id']}},_0x51fd42={};_0x51fd42[_0x16a1('0x2f')]=_['keys'](db[_0x16a1('0x2c')][_0x16a1('0x2d')]);_0x51fd42[_0x16a1('0x31')]=_[_0x16a1('0x30')](_0x19cdf4['query']);_0x51fd42[_0x16a1('0x32')]=_[_0x16a1('0x34')](_0x51fd42[_0x16a1('0x2f')],_0x51fd42[_0x16a1('0x31')]);_0xf27e61['attributes']=_[_0x16a1('0x34')](_0x51fd42[_0x16a1('0x2f')],qs['fields'](_0x19cdf4['query'][_0x16a1('0x45')]));_0xf27e61[_0x16a1('0x33')]=_0xf27e61[_0x16a1('0x33')]['length']?_0xf27e61[_0x16a1('0x33')]:_0x51fd42[_0x16a1('0x2f')];if(_0x19cdf4['query'][_0x16a1('0x3f')]){_0xf27e61[_0x16a1('0x46')]=[{'all':!![]}];}_0xf27e61=_['merge']({},_0xf27e61,_0x19cdf4[_0x16a1('0x3e')]);return db[_0x16a1('0x2c')][_0x16a1('0x47')](_0xf27e61)[_0x16a1('0x24')](handleEntityNotFound(_0x4c7df5,null))[_0x16a1('0x24')](respondWithResult(_0x4c7df5,null))[_0x16a1('0x42')](handleError(_0x4c7df5,null));};exports[_0x16a1('0x48')]=function(_0x37d260,_0x471ac3){return db['VtigerConfiguration'][_0x16a1('0x48')](_0x37d260[_0x16a1('0x49')],{})[_0x16a1('0x24')](respondWithResult(_0x471ac3,0xc9))[_0x16a1('0x42')](handleError(_0x471ac3,null));};exports[_0x16a1('0x23')]=function(_0x45a774,_0xad8f85){if(_0x45a774['body']['id']){delete _0x45a774[_0x16a1('0x49')]['id'];}return db[_0x16a1('0x2c')][_0x16a1('0x47')]({'where':{'id':_0x45a774[_0x16a1('0x44')]['id']}})[_0x16a1('0x24')](handleEntityNotFound(_0xad8f85,null))[_0x16a1('0x24')](saveUpdates(_0x45a774[_0x16a1('0x49')],null))[_0x16a1('0x24')](respondWithResult(_0xad8f85,null))[_0x16a1('0x42')](handleError(_0xad8f85,null));};exports[_0x16a1('0x4a')]=function(_0x218610,_0x1fc9f0){return db[_0x16a1('0x2c')][_0x16a1('0x47')]({'where':{'id':_0x218610[_0x16a1('0x44')]['id']}})[_0x16a1('0x24')](handleEntityNotFound(_0x1fc9f0,null))[_0x16a1('0x24')](removeEntity(_0x1fc9f0,null))[_0x16a1('0x42')](handleError(_0x1fc9f0,null));};exports[_0x16a1('0x4b')]=function(_0x9e2e3,_0x578901,_0x4f1bb3){var _0x5c726d={};var _0x73af65={};var _0xb6f3aa;var _0x1cdced;return db[_0x16a1('0x2c')][_0x16a1('0x4c')]({'where':{'id':_0x9e2e3[_0x16a1('0x44')]['id']}})[_0x16a1('0x24')](handleEntityNotFound(_0x578901,null))[_0x16a1('0x24')](function(_0x4b3287){if(_0x4b3287){_0xb6f3aa=_0x4b3287;_0x73af65[_0x16a1('0x2f')]=_[_0x16a1('0x30')](db[_0x16a1('0x4d')]['rawAttributes']);_0x73af65['query']=_[_0x16a1('0x30')](_0x9e2e3[_0x16a1('0x31')]);_0x73af65[_0x16a1('0x32')]=_['intersection'](_0x73af65['model'],_0x73af65[_0x16a1('0x31')]);_0x5c726d[_0x16a1('0x33')]=_[_0x16a1('0x34')](_0x73af65[_0x16a1('0x2f')],qs[_0x16a1('0x45')](_0x9e2e3[_0x16a1('0x31')][_0x16a1('0x45')]));_0x5c726d[_0x16a1('0x33')]=_0x5c726d['attributes'][_0x16a1('0x35')]?_0x5c726d['attributes']:_0x73af65[_0x16a1('0x2f')];_0x5c726d[_0x16a1('0x38')]=qs[_0x16a1('0x39')](_0x9e2e3[_0x16a1('0x31')][_0x16a1('0x39')]);_0x5c726d['where']=qs[_0x16a1('0x32')](_[_0x16a1('0x4e')](_0x9e2e3[_0x16a1('0x31')],_0x73af65[_0x16a1('0x32')]));if(_0x9e2e3[_0x16a1('0x31')][_0x16a1('0x3b')]){_0x5c726d['where']=_[_0x16a1('0x3d')](_0x5c726d[_0x16a1('0x3a')],{'$or':_[_0x16a1('0x2b')](_0x5c726d[_0x16a1('0x33')],function(_0x4a88b4){var _0x83176f={};_0x83176f[_0x4a88b4]={'$like':'%'+_0x9e2e3[_0x16a1('0x31')]['filter']+'%'};return _0x83176f;})});}_0x5c726d=_[_0x16a1('0x3d')]({},_0x5c726d,_0x9e2e3[_0x16a1('0x3e')]);return _0xb6f3aa[_0x16a1('0x4b')](_0x5c726d);}})['then'](function(_0x37bdec){if(_0x37bdec){_0x1cdced=_0x37bdec[_0x16a1('0x35')];if(!_0x9e2e3['query'][_0x16a1('0x36')]('nolimit')){_0x5c726d[_0x16a1('0x37')]=qs[_0x16a1('0x37')](_0x9e2e3[_0x16a1('0x31')]['limit']);_0x5c726d[_0x16a1('0x1e')]=qs[_0x16a1('0x1e')](_0x9e2e3[_0x16a1('0x31')][_0x16a1('0x1e')]);}return _0xb6f3aa[_0x16a1('0x4b')](_0x5c726d);}})[_0x16a1('0x24')](function(_0x5668cc){if(_0x5668cc){return _0x5668cc?{'count':_0x1cdced,'rows':_0x5668cc}:null;}})[_0x16a1('0x24')](respondWithResult(_0x578901,null))[_0x16a1('0x42')](handleError(_0x578901,null));};exports[_0x16a1('0x4f')]=function(_0x435a97,_0x1c724a,_0xfeabcf){var _0x5e92af={};var _0x5b570b={};var _0x4f1c34;var _0x5efdff;return db['VtigerConfiguration'][_0x16a1('0x4c')]({'where':{'id':_0x435a97[_0x16a1('0x44')]['id']}})[_0x16a1('0x24')](handleEntityNotFound(_0x1c724a,null))['then'](function(_0x1c0d0f){if(_0x1c0d0f){_0x4f1c34=_0x1c0d0f;_0x5b570b[_0x16a1('0x2f')]=_[_0x16a1('0x30')](db[_0x16a1('0x4d')][_0x16a1('0x2d')]);_0x5b570b['query']=_[_0x16a1('0x30')](_0x435a97[_0x16a1('0x31')]);_0x5b570b[_0x16a1('0x32')]=_['intersection'](_0x5b570b[_0x16a1('0x2f')],_0x5b570b[_0x16a1('0x31')]);_0x5e92af[_0x16a1('0x33')]=_[_0x16a1('0x34')](_0x5b570b[_0x16a1('0x2f')],qs['fields'](_0x435a97['query']['fields']));_0x5e92af[_0x16a1('0x33')]=_0x5e92af[_0x16a1('0x33')][_0x16a1('0x35')]?_0x5e92af[_0x16a1('0x33')]:_0x5b570b[_0x16a1('0x2f')];_0x5e92af['order']=qs['sort'](_0x435a97[_0x16a1('0x31')][_0x16a1('0x39')]);_0x5e92af[_0x16a1('0x3a')]=qs['filters'](_['pick'](_0x435a97[_0x16a1('0x31')],_0x5b570b[_0x16a1('0x32')]));if(_0x435a97[_0x16a1('0x31')]['filter']){_0x5e92af['where']=_['merge'](_0x5e92af['where'],{'$or':_[_0x16a1('0x2b')](_0x5e92af[_0x16a1('0x33')],function(_0x5ee75a){var _0x471161={};_0x471161[_0x5ee75a]={'$like':'%'+_0x435a97[_0x16a1('0x31')][_0x16a1('0x3b')]+'%'};return _0x471161;})});}_0x5e92af=_['merge']({},_0x5e92af,_0x435a97[_0x16a1('0x3e')]);return _0x4f1c34['getSubjects'](_0x5e92af);}})[_0x16a1('0x24')](function(_0x18377f){if(_0x18377f){_0x5efdff=_0x18377f['length'];if(!_0x435a97[_0x16a1('0x31')][_0x16a1('0x36')]('nolimit')){_0x5e92af[_0x16a1('0x37')]=qs[_0x16a1('0x37')](_0x435a97[_0x16a1('0x31')][_0x16a1('0x37')]);_0x5e92af['offset']=qs[_0x16a1('0x1e')](_0x435a97[_0x16a1('0x31')][_0x16a1('0x1e')]);}return _0x4f1c34['getSubjects'](_0x5e92af);}})[_0x16a1('0x24')](function(_0x240d4f){if(_0x240d4f){return _0x240d4f?{'count':_0x5efdff,'rows':_0x240d4f}:null;}})[_0x16a1('0x24')](respondWithResult(_0x1c724a,null))[_0x16a1('0x42')](handleError(_0x1c724a,null));};exports[_0x16a1('0x50')]=function(_0xcaff99,_0x23a047,_0xaca96e){var _0x1b4403={};var _0x40db7a={};var _0x597b20;var _0x47fc64;return db[_0x16a1('0x2c')][_0x16a1('0x4c')]({'where':{'id':_0xcaff99[_0x16a1('0x44')]['id']}})[_0x16a1('0x24')](handleEntityNotFound(_0x23a047,null))['then'](function(_0x263b6b){if(_0x263b6b){_0x597b20=_0x263b6b;_0x40db7a[_0x16a1('0x2f')]=_[_0x16a1('0x30')](db['VtigerField']['rawAttributes']);_0x40db7a[_0x16a1('0x31')]=_[_0x16a1('0x30')](_0xcaff99['query']);_0x40db7a[_0x16a1('0x32')]=_[_0x16a1('0x34')](_0x40db7a['model'],_0x40db7a[_0x16a1('0x31')]);_0x1b4403[_0x16a1('0x33')]=_['intersection'](_0x40db7a[_0x16a1('0x2f')],qs['fields'](_0xcaff99[_0x16a1('0x31')][_0x16a1('0x45')]));_0x1b4403[_0x16a1('0x33')]=_0x1b4403[_0x16a1('0x33')]['length']?_0x1b4403[_0x16a1('0x33')]:_0x40db7a['model'];_0x1b4403[_0x16a1('0x38')]=qs[_0x16a1('0x39')](_0xcaff99[_0x16a1('0x31')][_0x16a1('0x39')]);_0x1b4403[_0x16a1('0x3a')]=qs[_0x16a1('0x32')](_['pick'](_0xcaff99[_0x16a1('0x31')],_0x40db7a[_0x16a1('0x32')]));if(_0xcaff99[_0x16a1('0x31')][_0x16a1('0x3b')]){_0x1b4403[_0x16a1('0x3a')]=_['merge'](_0x1b4403[_0x16a1('0x3a')],{'$or':_[_0x16a1('0x2b')](_0x1b4403[_0x16a1('0x33')],function(_0x51744b){var _0x5dba55={};_0x5dba55[_0x51744b]={'$like':'%'+_0xcaff99[_0x16a1('0x31')][_0x16a1('0x3b')]+'%'};return _0x5dba55;})});}_0x1b4403=_[_0x16a1('0x3d')]({},_0x1b4403,_0xcaff99[_0x16a1('0x3e')]);return _0x597b20[_0x16a1('0x50')](_0x1b4403);}})['then'](function(_0x1e33cf){if(_0x1e33cf){_0x47fc64=_0x1e33cf[_0x16a1('0x35')];if(!_0xcaff99[_0x16a1('0x31')]['hasOwnProperty']('nolimit')){_0x1b4403['limit']=qs['limit'](_0xcaff99['query'][_0x16a1('0x37')]);_0x1b4403[_0x16a1('0x1e')]=qs[_0x16a1('0x1e')](_0xcaff99[_0x16a1('0x31')]['offset']);}return _0x597b20[_0x16a1('0x50')](_0x1b4403);}})[_0x16a1('0x24')](function(_0x28179c){if(_0x28179c){return _0x28179c?{'count':_0x47fc64,'rows':_0x28179c}:null;}})[_0x16a1('0x24')](respondWithResult(_0x23a047,null))[_0x16a1('0x42')](handleError(_0x23a047,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f2baaf1..06604eb 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 _0x791b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','int_vtiger_configurations','lodash'];(function(_0x12d39e,_0xc9c7c7){var _0x1bd418=function(_0x1182a5){while(--_0x1182a5){_0x12d39e['push'](_0x12d39e['shift']());}};_0x1bd418(++_0xc9c7c7);}(_0x791b,0x153));var _0xb791=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x791b[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xb791('0x0'));var util=require('util');var logger=require(_0xb791('0x1'))(_0xb791('0x2'));var moment=require(_0xb791('0x3'));var BPromise=require(_0xb791('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb791('0x5'));var rimraf=require(_0xb791('0x6'));var config=require(_0xb791('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x57a392,_0x43a0d0){return _0x57a392[_0xb791('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xb791('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07c4=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api'];(function(_0x196995,_0x2575dd){var _0x1ff73a=function(_0x4b6aeb){while(--_0x4b6aeb){_0x196995['push'](_0x196995['shift']());}};_0x1ff73a(++_0x2575dd);}(_0x07c4,0x8d));var _0x407c=function(_0x22caee,_0x232f93){_0x22caee=_0x22caee-0x0;var _0x3b3694=_0x07c4[_0x22caee];return _0x3b3694;};'use strict';var _=require('lodash');var util=require(_0x407c('0x0'));var logger=require(_0x407c('0x1'))(_0x407c('0x2'));var moment=require(_0x407c('0x3'));var BPromise=require(_0x407c('0x4'));var rp=require(_0x407c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x407c('0x6'));var config=require(_0x407c('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x407c('0x8')]=function(_0x35bae3,_0x29af53){return _0x35bae3[_0x407c('0x9')](_0x407c('0xa'),attributes,{'tableName':_0x407c('0xb'),'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 50977fb..8fa19b2 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 _0x758f=['then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','VtigerConfiguration,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x421239,_0x1dcea3){var _0x5b878c=function(_0x2717bf){while(--_0x2717bf){_0x421239['push'](_0x421239['shift']());}};_0x5b878c(++_0x1dcea3);}(_0x758f,0x83));var _0xf758=function(_0x1aa6c4,_0x1ecfc7){_0x1aa6c4=_0x1aa6c4-0x0;var _0x3a522d=_0x758f[_0x1aa6c4];return _0x3a522d;};'use strict';var _=require(_0xf758('0x0'));var util=require(_0xf758('0x1'));var moment=require(_0xf758('0x2'));var BPromise=require(_0xf758('0x3'));var rs=require(_0xf758('0x4'));var fs=require('fs');var Redis=require(_0xf758('0x5'));var db=require(_0xf758('0x6'))['db'];var utils=require(_0xf758('0x7'));var logger=require(_0xf758('0x8'))(_0xf758('0x9'));var config=require(_0xf758('0xa'));var jayson=require(_0xf758('0xb'));var client=jayson['client'][_0xf758('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2106d5,_0x393778,_0x8b48f0){return new BPromise(function(_0x5346fa,_0x182e63){return client['request'](_0x2106d5,_0x8b48f0)[_0xf758('0xd')](function(_0x47194a){logger[_0xf758('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x393778,'request\x20sent');logger[_0xf758('0xf')](_0xf758('0x10'),_0x393778,'request\x20sent',JSON['stringify'](_0x47194a));if(_0x47194a[_0xf758('0x11')]){if(_0x47194a[_0xf758('0x11')][_0xf758('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x393778,_0x47194a[_0xf758('0x11')][_0xf758('0x13')]);return _0x182e63(_0x47194a[_0xf758('0x11')][_0xf758('0x13')]);}logger[_0xf758('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x393778,_0x47194a['error'][_0xf758('0x13')]);return _0x5346fa(_0x47194a[_0xf758('0x11')]['message']);}else{logger[_0xf758('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x393778,_0xf758('0x14'));_0x5346fa(_0x47194a[_0xf758('0x15')][_0xf758('0x13')]);}})[_0xf758('0x16')](function(_0x5d912a){logger['error'](_0xf758('0x17'),_0x393778,_0x5d912a);_0x182e63(_0x5d912a);});});} \ No newline at end of file +var _0x2b4b=['../../config/environment','jayson/promise','client','request','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1b8aaf,_0x894b62){var _0x5b4758=function(_0x35201a){while(--_0x35201a){_0x1b8aaf['push'](_0x1b8aaf['shift']());}};_0x5b4758(++_0x894b62);}(_0x2b4b,0x140));var _0xb2b4=function(_0x3eb310,_0x1ef0d4){_0x3eb310=_0x3eb310-0x0;var _0x4329ed=_0x2b4b[_0x3eb310];return _0x4329ed;};'use strict';var _=require(_0xb2b4('0x0'));var util=require(_0xb2b4('0x1'));var moment=require(_0xb2b4('0x2'));var BPromise=require(_0xb2b4('0x3'));var rs=require(_0xb2b4('0x4'));var fs=require('fs');var Redis=require(_0xb2b4('0x5'));var db=require(_0xb2b4('0x6'))['db'];var utils=require(_0xb2b4('0x7'));var logger=require(_0xb2b4('0x8'))(_0xb2b4('0x9'));var config=require(_0xb2b4('0xa'));var jayson=require(_0xb2b4('0xb'));var client=jayson[_0xb2b4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x106940,_0x19ac01,_0x341452){return new BPromise(function(_0x5c443b,_0x43c974){return client[_0xb2b4('0xd')](_0x106940,_0x341452)['then'](function(_0x4c03e7){logger['info'](_0xb2b4('0xe'),_0x19ac01,'request\x20sent');logger[_0xb2b4('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x19ac01,_0xb2b4('0x10'),JSON[_0xb2b4('0x11')](_0x4c03e7));if(_0x4c03e7['error']){if(_0x4c03e7[_0xb2b4('0x12')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x19ac01,_0x4c03e7[_0xb2b4('0x12')][_0xb2b4('0x13')]);return _0x43c974(_0x4c03e7[_0xb2b4('0x12')][_0xb2b4('0x13')]);}logger['error'](_0xb2b4('0xe'),_0x19ac01,_0x4c03e7[_0xb2b4('0x12')]['message']);return _0x5c443b(_0x4c03e7['error'][_0xb2b4('0x13')]);}else{logger[_0xb2b4('0x14')](_0xb2b4('0xe'),_0x19ac01,_0xb2b4('0x10'));_0x5c443b(_0x4c03e7['result'][_0xb2b4('0x13')]);}})[_0xb2b4('0x15')](function(_0x5f3803){logger[_0xb2b4('0x12')](_0xb2b4('0xe'),_0x19ac01,_0x5f3803);_0x43c974(_0x5f3803);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e93e1e8..bf0f80b 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 _0x9c6c=['./intVtigerField.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3b44fd,_0x1b969b){var _0x5c0cbc=function(_0x19760c){while(--_0x19760c){_0x3b44fd['push'](_0x3b44fd['shift']());}};_0x5c0cbc(++_0x1b969b);}(_0x9c6c,0x14f));var _0xc9c6=function(_0x156d6c,_0x438278){_0x156d6c=_0x156d6c-0x0;var _0x25f442=_0x9c6c[_0x156d6c];return _0x25f442;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc9c6('0x0'));var timeout=require(_0xc9c6('0x1'));var express=require(_0xc9c6('0x2'));var router=express[_0xc9c6('0x3')]();var fs_extra=require(_0xc9c6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc9c6('0x5'));var config=require(_0xc9c6('0x6'));var controller=require(_0xc9c6('0x7'));router[_0xc9c6('0x8')]('/',auth[_0xc9c6('0x9')](),controller[_0xc9c6('0xa')]);router[_0xc9c6('0x8')]('/:id',auth[_0xc9c6('0x9')](),controller[_0xc9c6('0xb')]);router[_0xc9c6('0xc')]('/',auth[_0xc9c6('0x9')](),controller[_0xc9c6('0xd')]);router[_0xc9c6('0xe')](_0xc9c6('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xc9c6('0x10')]('/:id',auth[_0xc9c6('0x9')](),controller[_0xc9c6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0a5e=['post','create','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x1d2989,_0xa649c5){var _0x34b839=function(_0x2977dd){while(--_0x2977dd){_0x1d2989['push'](_0x1d2989['shift']());}};_0x34b839(++_0xa649c5);}(_0x0a5e,0x145));var _0xe0a5=function(_0x28be72,_0x4708fc){_0x28be72=_0x28be72-0x0;var _0x2afc8d=_0x0a5e[_0x28be72];return _0x2afc8d;};'use strict';var multer=require('multer');var util=require(_0xe0a5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe0a5('0x1'));var router=express['Router']();var fs_extra=require(_0xe0a5('0x2'));var auth=require(_0xe0a5('0x3'));var interaction=require(_0xe0a5('0x4'));var config=require('../../config/environment');var controller=require(_0xe0a5('0x5'));router[_0xe0a5('0x6')]('/',auth['isAuthenticated'](),controller[_0xe0a5('0x7')]);router[_0xe0a5('0x6')](_0xe0a5('0x8'),auth[_0xe0a5('0x9')](),controller[_0xe0a5('0xa')]);router[_0xe0a5('0xb')]('/',auth[_0xe0a5('0x9')](),controller[_0xe0a5('0xc')]);router['put'](_0xe0a5('0x8'),auth[_0xe0a5('0x9')](),controller['update']);router[_0xe0a5('0xd')]('/:id',auth[_0xe0a5('0x9')](),controller[_0xe0a5('0xe')]);module[_0xe0a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 2fa3cfa..a6a7f1e 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 _0x08d3=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x5ccd1d,_0x5ef695){var _0x3e5bf0=function(_0x4cc74f){while(--_0x4cc74f){_0x5ccd1d['push'](_0x5ccd1d['shift']());}};_0x3e5bf0(++_0x5ef695);}(_0x08d3,0x110));var _0x308d=function(_0x530a7f,_0x404520){_0x530a7f=_0x530a7f-0x0;var _0x1f1869=_0x08d3[_0x530a7f];return _0x1f1869;};'use strict';var Sequelize=require('sequelize');module[_0x308d('0x0')]={'type':{'type':Sequelize[_0x308d('0x1')](_0x308d('0x2'),_0x308d('0x3'),_0x308d('0x4'),'keyValue',_0x308d('0x5')),'defaultValue':_0x308d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x308d('0x6')]},'keyType':{'type':Sequelize[_0x308d('0x1')](_0x308d('0x2'),_0x308d('0x3'),_0x308d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x308d('0x6')]},'nameField':{'type':Sequelize[_0x308d('0x6')]},'customField':{'type':Sequelize[_0x308d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x308d('0x6')]}}; \ No newline at end of file +var _0x322f=['sequelize','exports','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x389e52,_0x34f69b){var _0x4fd089=function(_0x4e4dc7){while(--_0x4e4dc7){_0x389e52['push'](_0x389e52['shift']());}};_0x4fd089(++_0x34f69b);}(_0x322f,0xa2));var _0xf322=function(_0x59f4b6,_0x3186c4){_0x59f4b6=_0x59f4b6-0x0;var _0x39434b=_0x322f[_0x59f4b6];return _0x39434b;};'use strict';var Sequelize=require(_0xf322('0x0'));module[_0xf322('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf322('0x2'),'variable',_0xf322('0x3'),_0xf322('0x4'),_0xf322('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf322('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf322('0x2'),_0xf322('0x7'),_0xf322('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf322('0x6')]},'nameField':{'type':Sequelize[_0xf322('0x6')]},'customField':{'type':Sequelize[_0xf322('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf322('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 933003b..10d6277 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 _0xbdf7=['query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','VtigerField','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','update','destroy','error','name','send','index','map','rawAttributes','key','model'];(function(_0x5469d8,_0x29000a){var _0x4f5f36=function(_0x52c56d){while(--_0x52c56d){_0x5469d8['push'](_0x5469d8['shift']());}};_0x4f5f36(++_0x29000a);}(_0xbdf7,0x1ec));var _0x7bdf=function(_0x41367e,_0x23ea8f){_0x41367e=_0x41367e-0x0;var _0x570087=_0xbdf7[_0x41367e];return _0x570087;};'use strict';var emlformat=require(_0x7bdf('0x0'));var rimraf=require(_0x7bdf('0x1'));var zipdir=require(_0x7bdf('0x2'));var jsonpatch=require(_0x7bdf('0x3'));var rp=require(_0x7bdf('0x4'));var moment=require('moment');var BPromise=require(_0x7bdf('0x5'));var Mustache=require(_0x7bdf('0x6'));var util=require(_0x7bdf('0x7'));var path=require(_0x7bdf('0x8'));var sox=require('sox');var csv=require(_0x7bdf('0x9'));var ejs=require(_0x7bdf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bdf('0xb'));var squel=require(_0x7bdf('0xc'));var crypto=require(_0x7bdf('0xd'));var jsforce=require(_0x7bdf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7bdf('0xf'));var Papa=require(_0x7bdf('0x10'));var Redis=require(_0x7bdf('0x11'));var authService=require(_0x7bdf('0x12'));var qs=require(_0x7bdf('0x13'));var as=require(_0x7bdf('0x14'));var hardwareService=require(_0x7bdf('0x15'));var logger=require(_0x7bdf('0x16'))(_0x7bdf('0x17'));var utils=require(_0x7bdf('0x18'));var config=require(_0x7bdf('0x19'));var licenseUtil=require(_0x7bdf('0x1a'));var db=require(_0x7bdf('0x1b'))['db'];function respondWithStatusCode(_0x264e33,_0x36f2d2){_0x36f2d2=_0x36f2d2||0xcc;return function(_0x424e6a){if(_0x424e6a){return _0x264e33[_0x7bdf('0x1c')](_0x36f2d2);}return _0x264e33[_0x7bdf('0x1d')](_0x36f2d2)[_0x7bdf('0x1e')]();};}function respondWithResult(_0x40de19,_0x3f70cb){_0x3f70cb=_0x3f70cb||0xc8;return function(_0x45f881){if(_0x45f881){return _0x40de19['status'](_0x3f70cb)['json'](_0x45f881);}};}function respondWithFilteredResult(_0x151fd2,_0x85de5){return function(_0x4c22c3){if(_0x4c22c3){var _0x4357eb=typeof _0x85de5[_0x7bdf('0x1f')]===_0x7bdf('0x20')&&typeof _0x85de5['limit']===_0x7bdf('0x20');var _0x580744=_0x4c22c3[_0x7bdf('0x21')];var _0x36602f=_0x4357eb?0x0:_0x85de5['offset'];var _0x26a05e=_0x4357eb?_0x4c22c3[_0x7bdf('0x21')]:_0x85de5[_0x7bdf('0x1f')]+_0x85de5['limit'];var _0x28e822;if(_0x26a05e>=_0x580744){_0x26a05e=_0x580744;_0x28e822=0xc8;}else{_0x28e822=0xce;}_0x151fd2[_0x7bdf('0x1d')](_0x28e822);return _0x151fd2['set'](_0x7bdf('0x22'),_0x36602f+'-'+_0x26a05e+'/'+_0x580744)[_0x7bdf('0x23')](_0x4c22c3);}return null;};}function patchUpdates(_0x46c17e){return function(_0x38860f){try{jsonpatch[_0x7bdf('0x24')](_0x38860f,_0x46c17e,!![]);}catch(_0x38671b){return BPromise['reject'](_0x38671b);}return _0x38860f['save']();};}function saveUpdates(_0x53cf07,_0x488342){return function(_0x2d5745){if(_0x2d5745){return _0x2d5745[_0x7bdf('0x25')](_0x53cf07)['then'](function(_0x59cdf8){return _0x59cdf8;});}return null;};}function removeEntity(_0x2dafbb,_0x4512a7){return function(_0x425003){if(_0x425003){return _0x425003[_0x7bdf('0x26')]()['then'](function(){_0x2dafbb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52faa0,_0x38e193){return function(_0x987140){if(!_0x987140){_0x52faa0[_0x7bdf('0x1c')](0x194);}return _0x987140;};}function handleError(_0x2b33fa,_0x33ed40){_0x33ed40=_0x33ed40||0x1f4;return function(_0x5efb7f){logger[_0x7bdf('0x27')](_0x5efb7f['stack']);if(_0x5efb7f['name']){delete _0x5efb7f[_0x7bdf('0x28')];}_0x2b33fa[_0x7bdf('0x1d')](_0x33ed40)[_0x7bdf('0x29')](_0x5efb7f);};}exports[_0x7bdf('0x2a')]=function(_0x5a6974,_0x459e57){var _0xdd7751={},_0x5ba5d5={},_0xfb4f4b={'count':0x0,'rows':[]};var _0x25cb82=_[_0x7bdf('0x2b')](db['VtigerField'][_0x7bdf('0x2c')],function(_0x4c1bf9){return{'name':_0x4c1bf9['fieldName'],'type':_0x4c1bf9['type'][_0x7bdf('0x2d')]};});_0x5ba5d5[_0x7bdf('0x2e')]=_[_0x7bdf('0x2b')](_0x25cb82,_0x7bdf('0x28'));_0x5ba5d5[_0x7bdf('0x2f')]=_[_0x7bdf('0x30')](_0x5a6974['query']);_0x5ba5d5[_0x7bdf('0x31')]=_[_0x7bdf('0x32')](_0x5ba5d5[_0x7bdf('0x2e')],_0x5ba5d5[_0x7bdf('0x2f')]);_0xdd7751['attributes']=_[_0x7bdf('0x32')](_0x5ba5d5[_0x7bdf('0x2e')],qs['fields'](_0x5a6974[_0x7bdf('0x2f')][_0x7bdf('0x33')]));_0xdd7751[_0x7bdf('0x34')]=_0xdd7751[_0x7bdf('0x34')]['length']?_0xdd7751[_0x7bdf('0x34')]:_0x5ba5d5[_0x7bdf('0x2e')];if(!_0x5a6974[_0x7bdf('0x2f')][_0x7bdf('0x35')](_0x7bdf('0x36'))){_0xdd7751[_0x7bdf('0x37')]=qs['limit'](_0x5a6974[_0x7bdf('0x2f')][_0x7bdf('0x37')]);_0xdd7751[_0x7bdf('0x1f')]=qs[_0x7bdf('0x1f')](_0x5a6974[_0x7bdf('0x2f')][_0x7bdf('0x1f')]);}_0xdd7751[_0x7bdf('0x38')]=qs[_0x7bdf('0x39')](_0x5a6974['query'][_0x7bdf('0x39')]);_0xdd7751[_0x7bdf('0x3a')]=qs[_0x7bdf('0x31')](_[_0x7bdf('0x3b')](_0x5a6974[_0x7bdf('0x2f')],_0x5ba5d5[_0x7bdf('0x31')]),_0x25cb82);if(_0x5a6974[_0x7bdf('0x2f')][_0x7bdf('0x3c')]){_0xdd7751['where']=_[_0x7bdf('0x3d')](_0xdd7751['where'],{'$or':_[_0x7bdf('0x2b')](_0x25cb82,function(_0x875d36){if(_0x875d36[_0x7bdf('0x3e')]!==_0x7bdf('0x3f')){var _0x20e77d={};_0x20e77d[_0x875d36[_0x7bdf('0x28')]]={'$like':'%'+_0x5a6974[_0x7bdf('0x2f')][_0x7bdf('0x3c')]+'%'};return _0x20e77d;}})});}_0xdd7751=_[_0x7bdf('0x3d')]({},_0xdd7751,_0x5a6974[_0x7bdf('0x40')]);var _0x50efb4={'where':_0xdd7751[_0x7bdf('0x3a')]};return db['VtigerField'][_0x7bdf('0x21')](_0x50efb4)[_0x7bdf('0x41')](function(_0x12e0a8){_0xfb4f4b[_0x7bdf('0x21')]=_0x12e0a8;if(_0x5a6974[_0x7bdf('0x2f')][_0x7bdf('0x42')]){_0xdd7751[_0x7bdf('0x43')]=[{'all':!![]}];}return db[_0x7bdf('0x44')][_0x7bdf('0x45')](_0xdd7751);})[_0x7bdf('0x41')](function(_0x446ce0){_0xfb4f4b[_0x7bdf('0x46')]=_0x446ce0;return _0xfb4f4b;})[_0x7bdf('0x41')](respondWithFilteredResult(_0x459e57,_0xdd7751))[_0x7bdf('0x47')](handleError(_0x459e57,null));};exports[_0x7bdf('0x48')]=function(_0x4b044f,_0x43380c){var _0x5db3e3={'raw':!![],'where':{'id':_0x4b044f[_0x7bdf('0x49')]['id']}},_0x2d0037={};_0x2d0037['model']=_['keys'](db['VtigerField']['rawAttributes']);_0x2d0037['query']=_['keys'](_0x4b044f[_0x7bdf('0x2f')]);_0x2d0037[_0x7bdf('0x31')]=_[_0x7bdf('0x32')](_0x2d0037[_0x7bdf('0x2e')],_0x2d0037[_0x7bdf('0x2f')]);_0x5db3e3['attributes']=_[_0x7bdf('0x32')](_0x2d0037[_0x7bdf('0x2e')],qs['fields'](_0x4b044f[_0x7bdf('0x2f')]['fields']));_0x5db3e3[_0x7bdf('0x34')]=_0x5db3e3[_0x7bdf('0x34')]['length']?_0x5db3e3['attributes']:_0x2d0037[_0x7bdf('0x2e')];if(_0x4b044f[_0x7bdf('0x2f')]['includeAll']){_0x5db3e3[_0x7bdf('0x43')]=[{'all':!![]}];}_0x5db3e3=_['merge']({},_0x5db3e3,_0x4b044f[_0x7bdf('0x40')]);return db[_0x7bdf('0x44')][_0x7bdf('0x4a')](_0x5db3e3)[_0x7bdf('0x41')](handleEntityNotFound(_0x43380c,null))[_0x7bdf('0x41')](respondWithResult(_0x43380c,null))[_0x7bdf('0x47')](handleError(_0x43380c,null));};exports[_0x7bdf('0x4b')]=function(_0x5a7b65,_0x46c1a5){return db[_0x7bdf('0x44')][_0x7bdf('0x4b')](_0x5a7b65[_0x7bdf('0x4c')],{})[_0x7bdf('0x41')](respondWithResult(_0x46c1a5,0xc9))[_0x7bdf('0x47')](handleError(_0x46c1a5,null));};exports[_0x7bdf('0x25')]=function(_0x5f4e99,_0x5eefe5){if(_0x5f4e99['body']['id']){delete _0x5f4e99[_0x7bdf('0x4c')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x5f4e99['params']['id']}})['then'](handleEntityNotFound(_0x5eefe5,null))[_0x7bdf('0x41')](saveUpdates(_0x5f4e99['body'],null))[_0x7bdf('0x41')](respondWithResult(_0x5eefe5,null))[_0x7bdf('0x47')](handleError(_0x5eefe5,null));};exports['destroy']=function(_0xfabd27,_0x418a56){return db[_0x7bdf('0x44')][_0x7bdf('0x4a')]({'where':{'id':_0xfabd27['params']['id']}})[_0x7bdf('0x41')](handleEntityNotFound(_0x418a56,null))[_0x7bdf('0x41')](removeEntity(_0x418a56,null))[_0x7bdf('0x47')](handleError(_0x418a56,null));}; \ No newline at end of file +var _0x4f17=['filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','end','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x46b0b7,_0x4996cf){var _0xd2942b=function(_0xd4eeec){while(--_0xd4eeec){_0x46b0b7['push'](_0x46b0b7['shift']());}};_0xd2942b(++_0x4996cf);}(_0x4f17,0x9e));var _0x74f1=function(_0x481af3,_0x483fac){_0x481af3=_0x481af3-0x0;var _0x3354ea=_0x4f17[_0x481af3];return _0x3354ea;};'use strict';var emlformat=require(_0x74f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74f1('0x1'));var jsonpatch=require(_0x74f1('0x2'));var rp=require('request-promise');var moment=require(_0x74f1('0x3'));var BPromise=require(_0x74f1('0x4'));var Mustache=require(_0x74f1('0x5'));var util=require(_0x74f1('0x6'));var path=require(_0x74f1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x74f1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74f1('0x9'));var squel=require('squel');var crypto=require(_0x74f1('0xa'));var jsforce=require(_0x74f1('0xb'));var deskjs=require(_0x74f1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x74f1('0xd'));var Papa=require('papaparse');var Redis=require(_0x74f1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x74f1('0xf'));var as=require(_0x74f1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x74f1('0x11'));var utils=require(_0x74f1('0x12'));var config=require(_0x74f1('0x13'));var licenseUtil=require(_0x74f1('0x14'));var db=require(_0x74f1('0x15'))['db'];function respondWithStatusCode(_0x2b91bc,_0x467e15){_0x467e15=_0x467e15||0xcc;return function(_0x3a2ce6){if(_0x3a2ce6){return _0x2b91bc[_0x74f1('0x16')](_0x467e15);}return _0x2b91bc[_0x74f1('0x17')](_0x467e15)['end']();};}function respondWithResult(_0xf135d0,_0x4e156f){_0x4e156f=_0x4e156f||0xc8;return function(_0x41488b){if(_0x41488b){return _0xf135d0['status'](_0x4e156f)[_0x74f1('0x18')](_0x41488b);}};}function respondWithFilteredResult(_0x17762d,_0x373b73){return function(_0x1016a7){if(_0x1016a7){var _0x33b851=typeof _0x373b73['offset']===_0x74f1('0x19')&&typeof _0x373b73[_0x74f1('0x1a')]==='undefined';var _0x387937=_0x1016a7[_0x74f1('0x1b')];var _0x520aae=_0x33b851?0x0:_0x373b73[_0x74f1('0x1c')];var _0x29de10=_0x33b851?_0x1016a7[_0x74f1('0x1b')]:_0x373b73[_0x74f1('0x1c')]+_0x373b73[_0x74f1('0x1a')];var _0x4a10ab;if(_0x29de10>=_0x387937){_0x29de10=_0x387937;_0x4a10ab=0xc8;}else{_0x4a10ab=0xce;}_0x17762d[_0x74f1('0x17')](_0x4a10ab);return _0x17762d[_0x74f1('0x1d')](_0x74f1('0x1e'),_0x520aae+'-'+_0x29de10+'/'+_0x387937)[_0x74f1('0x18')](_0x1016a7);}return null;};}function patchUpdates(_0x227fa9){return function(_0x27ae4b){try{jsonpatch['apply'](_0x27ae4b,_0x227fa9,!![]);}catch(_0x551f9a){return BPromise['reject'](_0x551f9a);}return _0x27ae4b[_0x74f1('0x1f')]();};}function saveUpdates(_0x132a81,_0x3d4c18){return function(_0x749f27){if(_0x749f27){return _0x749f27[_0x74f1('0x20')](_0x132a81)[_0x74f1('0x21')](function(_0x34701f){return _0x34701f;});}return null;};}function removeEntity(_0x26cba4,_0x2c336b){return function(_0x15a96a){if(_0x15a96a){return _0x15a96a[_0x74f1('0x22')]()['then'](function(){_0x26cba4['status'](0xcc)[_0x74f1('0x23')]();});}};}function handleEntityNotFound(_0x24e730,_0xad169c){return function(_0x1b9554){if(!_0x1b9554){_0x24e730[_0x74f1('0x16')](0x194);}return _0x1b9554;};}function handleError(_0xddbb89,_0xd079b5){_0xd079b5=_0xd079b5||0x1f4;return function(_0x5c1fa0){logger[_0x74f1('0x24')](_0x5c1fa0[_0x74f1('0x25')]);if(_0x5c1fa0['name']){delete _0x5c1fa0[_0x74f1('0x26')];}_0xddbb89['status'](_0xd079b5)['send'](_0x5c1fa0);};}exports[_0x74f1('0x27')]=function(_0x37894a,_0x365a2f){var _0x27c47e={},_0x115abf={},_0x176340={'count':0x0,'rows':[]};var _0x19390c=_[_0x74f1('0x28')](db[_0x74f1('0x29')][_0x74f1('0x2a')],function(_0xd226be){return{'name':_0xd226be[_0x74f1('0x2b')],'type':_0xd226be[_0x74f1('0x2c')]['key']};});_0x115abf[_0x74f1('0x2d')]=_[_0x74f1('0x28')](_0x19390c,_0x74f1('0x26'));_0x115abf[_0x74f1('0x2e')]=_['keys'](_0x37894a[_0x74f1('0x2e')]);_0x115abf['filters']=_[_0x74f1('0x2f')](_0x115abf[_0x74f1('0x2d')],_0x115abf[_0x74f1('0x2e')]);_0x27c47e[_0x74f1('0x30')]=_['intersection'](_0x115abf[_0x74f1('0x2d')],qs['fields'](_0x37894a[_0x74f1('0x2e')][_0x74f1('0x31')]));_0x27c47e[_0x74f1('0x30')]=_0x27c47e[_0x74f1('0x30')][_0x74f1('0x32')]?_0x27c47e[_0x74f1('0x30')]:_0x115abf[_0x74f1('0x2d')];if(!_0x37894a[_0x74f1('0x2e')][_0x74f1('0x33')]('nolimit')){_0x27c47e[_0x74f1('0x1a')]=qs[_0x74f1('0x1a')](_0x37894a['query'][_0x74f1('0x1a')]);_0x27c47e[_0x74f1('0x1c')]=qs[_0x74f1('0x1c')](_0x37894a[_0x74f1('0x2e')][_0x74f1('0x1c')]);}_0x27c47e[_0x74f1('0x34')]=qs['sort'](_0x37894a[_0x74f1('0x2e')][_0x74f1('0x35')]);_0x27c47e[_0x74f1('0x36')]=qs[_0x74f1('0x37')](_[_0x74f1('0x38')](_0x37894a[_0x74f1('0x2e')],_0x115abf[_0x74f1('0x37')]),_0x19390c);if(_0x37894a[_0x74f1('0x2e')][_0x74f1('0x39')]){_0x27c47e[_0x74f1('0x36')]=_['merge'](_0x27c47e[_0x74f1('0x36')],{'$or':_['map'](_0x19390c,function(_0x353266){if(_0x353266[_0x74f1('0x2c')]!=='VIRTUAL'){var _0xa9b443={};_0xa9b443[_0x353266[_0x74f1('0x26')]]={'$like':'%'+_0x37894a['query'][_0x74f1('0x39')]+'%'};return _0xa9b443;}})});}_0x27c47e=_[_0x74f1('0x3a')]({},_0x27c47e,_0x37894a['options']);var _0x3693cc={'where':_0x27c47e[_0x74f1('0x36')]};return db[_0x74f1('0x29')][_0x74f1('0x1b')](_0x3693cc)[_0x74f1('0x21')](function(_0x42c0b2){_0x176340['count']=_0x42c0b2;if(_0x37894a['query'][_0x74f1('0x3b')]){_0x27c47e[_0x74f1('0x3c')]=[{'all':!![]}];}return db[_0x74f1('0x29')][_0x74f1('0x3d')](_0x27c47e);})[_0x74f1('0x21')](function(_0x465bad){_0x176340[_0x74f1('0x3e')]=_0x465bad;return _0x176340;})[_0x74f1('0x21')](respondWithFilteredResult(_0x365a2f,_0x27c47e))[_0x74f1('0x3f')](handleError(_0x365a2f,null));};exports[_0x74f1('0x40')]=function(_0x4c8bea,_0x55e7ca){var _0x44edeb={'raw':!![],'where':{'id':_0x4c8bea[_0x74f1('0x41')]['id']}},_0x4ae128={};_0x4ae128[_0x74f1('0x2d')]=_[_0x74f1('0x42')](db['VtigerField'][_0x74f1('0x2a')]);_0x4ae128[_0x74f1('0x2e')]=_[_0x74f1('0x42')](_0x4c8bea[_0x74f1('0x2e')]);_0x4ae128[_0x74f1('0x37')]=_[_0x74f1('0x2f')](_0x4ae128[_0x74f1('0x2d')],_0x4ae128[_0x74f1('0x2e')]);_0x44edeb['attributes']=_['intersection'](_0x4ae128[_0x74f1('0x2d')],qs['fields'](_0x4c8bea[_0x74f1('0x2e')][_0x74f1('0x31')]));_0x44edeb[_0x74f1('0x30')]=_0x44edeb[_0x74f1('0x30')][_0x74f1('0x32')]?_0x44edeb[_0x74f1('0x30')]:_0x4ae128[_0x74f1('0x2d')];if(_0x4c8bea['query'][_0x74f1('0x3b')]){_0x44edeb[_0x74f1('0x3c')]=[{'all':!![]}];}_0x44edeb=_[_0x74f1('0x3a')]({},_0x44edeb,_0x4c8bea[_0x74f1('0x43')]);return db[_0x74f1('0x29')]['find'](_0x44edeb)[_0x74f1('0x21')](handleEntityNotFound(_0x55e7ca,null))[_0x74f1('0x21')](respondWithResult(_0x55e7ca,null))[_0x74f1('0x3f')](handleError(_0x55e7ca,null));};exports[_0x74f1('0x44')]=function(_0x133dd9,_0x2f362c){return db[_0x74f1('0x29')][_0x74f1('0x44')](_0x133dd9[_0x74f1('0x45')],{})['then'](respondWithResult(_0x2f362c,0xc9))[_0x74f1('0x3f')](handleError(_0x2f362c,null));};exports[_0x74f1('0x20')]=function(_0x26199c,_0x4b0a12){if(_0x26199c['body']['id']){delete _0x26199c[_0x74f1('0x45')]['id'];}return db[_0x74f1('0x29')][_0x74f1('0x46')]({'where':{'id':_0x26199c[_0x74f1('0x41')]['id']}})[_0x74f1('0x21')](handleEntityNotFound(_0x4b0a12,null))[_0x74f1('0x21')](saveUpdates(_0x26199c[_0x74f1('0x45')],null))[_0x74f1('0x21')](respondWithResult(_0x4b0a12,null))['catch'](handleError(_0x4b0a12,null));};exports[_0x74f1('0x22')]=function(_0x2c8906,_0xe025a4){return db[_0x74f1('0x29')][_0x74f1('0x46')]({'where':{'id':_0x2c8906[_0x74f1('0x41')]['id']}})['then'](handleEntityNotFound(_0xe025a4,null))[_0x74f1('0x21')](removeEntity(_0xe025a4,null))[_0x74f1('0x3f')](handleError(_0xe025a4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 22d1ed2..6f6548f 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 _0x6a1b=['util','../../config/logger','api','moment','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x6a1b,0x15d));var _0xb6a1=function(_0x5660d5,_0x235c27){_0x5660d5=_0x5660d5-0x0;var _0x2a144d=_0x6a1b[_0x5660d5];return _0x2a144d;};'use strict';var _=require(_0xb6a1('0x0'));var util=require(_0xb6a1('0x1'));var logger=require(_0xb6a1('0x2'))(_0xb6a1('0x3'));var moment=require(_0xb6a1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb6a1('0x5'));var config=require(_0xb6a1('0x6'));var attributes=require(_0xb6a1('0x7'));module[_0xb6a1('0x8')]=function(_0x5458c3,_0x448029){return _0x5458c3[_0xb6a1('0x9')](_0xb6a1('0xa'),attributes,{'tableName':_0xb6a1('0xb'),'paranoid':![],'indexes':[{'name':_0xb6a1('0xc'),'fields':['idField',_0xb6a1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9396=['VtigerField','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','./intVtigerField.attributes','exports','define'];(function(_0x1da792,_0x5aec5a){var _0x3f9c76=function(_0x209f22){while(--_0x209f22){_0x1da792['push'](_0x1da792['shift']());}};_0x3f9c76(++_0x5aec5a);}(_0x9396,0x79));var _0x6939=function(_0x168a88,_0x3cc193){_0x168a88=_0x168a88-0x0;var _0x40943b=_0x9396[_0x168a88];return _0x40943b;};'use strict';var _=require(_0x6939('0x0'));var util=require(_0x6939('0x1'));var logger=require(_0x6939('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6939('0x3'));var fs=require('fs');var path=require(_0x6939('0x4'));var rimraf=require(_0x6939('0x5'));var config=require('../../config/environment');var attributes=require(_0x6939('0x6'));module[_0x6939('0x7')]=function(_0x2d28b1,_0x449e5b){return _0x2d28b1[_0x6939('0x8')](_0x6939('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x6939('0xa'),'fields':[_0x6939('0xb'),_0x6939('0xc')],'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 37d9b6b..575c8c3 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 _0xed36=['jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x54d3b9,_0x257828){var _0x38af1e=function(_0xed7ffa){while(--_0xed7ffa){_0x54d3b9['push'](_0x54d3b9['shift']());}};_0x38af1e(++_0x257828);}(_0xed36,0x118));var _0x6ed3=function(_0x24c4a2,_0x4a54e3){_0x24c4a2=_0x24c4a2-0x0;var _0x5758e7=_0xed36[_0x24c4a2];return _0x5758e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ed3('0x0'));var BPromise=require(_0x6ed3('0x1'));var rs=require(_0x6ed3('0x2'));var fs=require('fs');var Redis=require(_0x6ed3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6ed3('0x4'));var config=require('../../config/environment');var jayson=require(_0x6ed3('0x5'));var client=jayson[_0x6ed3('0x6')][_0x6ed3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x273560,_0x1550fb,_0x53c6ee){return new BPromise(function(_0x1a3e93,_0x3c3d6b){return client[_0x6ed3('0x8')](_0x273560,_0x53c6ee)[_0x6ed3('0x9')](function(_0x26034f){logger[_0x6ed3('0xa')](_0x6ed3('0xb'),_0x1550fb,'request\x20sent');logger[_0x6ed3('0xc')](_0x6ed3('0xd'),_0x1550fb,'request\x20sent',JSON['stringify'](_0x26034f));if(_0x26034f[_0x6ed3('0xe')]){if(_0x26034f[_0x6ed3('0xe')][_0x6ed3('0xf')]===0x1f4){logger['error'](_0x6ed3('0xb'),_0x1550fb,_0x26034f[_0x6ed3('0xe')]['message']);return _0x3c3d6b(_0x26034f[_0x6ed3('0xe')][_0x6ed3('0x10')]);}logger['error'](_0x6ed3('0xb'),_0x1550fb,_0x26034f['error'][_0x6ed3('0x10')]);return _0x1a3e93(_0x26034f['error']['message']);}else{logger[_0x6ed3('0xa')](_0x6ed3('0xb'),_0x1550fb,_0x6ed3('0x11'));_0x1a3e93(_0x26034f['result'][_0x6ed3('0x10')]);}})[_0x6ed3('0x12')](function(_0x5dee25){logger[_0x6ed3('0xe')](_0x6ed3('0xb'),_0x1550fb,_0x5dee25);_0x3c3d6b(_0x5dee25);});});} \ No newline at end of file +var _0x569b=['client','request','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','VtigerField,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x589cc9,_0x2e29ba){var _0x37b3aa=function(_0x3c87c5){while(--_0x3c87c5){_0x589cc9['push'](_0x589cc9['shift']());}};_0x37b3aa(++_0x2e29ba);}(_0x569b,0x173));var _0xb569=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x569b[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xb569('0x0'));var util=require(_0xb569('0x1'));var moment=require('moment');var BPromise=require(_0xb569('0x2'));var rs=require(_0xb569('0x3'));var fs=require('fs');var Redis=require(_0xb569('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb569('0x5'));var logger=require(_0xb569('0x6'))('rpc');var config=require(_0xb569('0x7'));var jayson=require(_0xb569('0x8'));var client=jayson[_0xb569('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbee933,_0x36f3c1,_0x356854){return new BPromise(function(_0x1b8cb9,_0x56519d){return client[_0xb569('0xa')](_0xbee933,_0x356854)['then'](function(_0x180969){logger[_0xb569('0xb')]('VtigerField,\x20%s,\x20%s',_0x36f3c1,'request\x20sent');logger[_0xb569('0xc')](_0xb569('0xd'),_0x36f3c1,_0xb569('0xe'),JSON['stringify'](_0x180969));if(_0x180969['error']){if(_0x180969['error'][_0xb569('0xf')]===0x1f4){logger[_0xb569('0x10')](_0xb569('0x11'),_0x36f3c1,_0x180969[_0xb569('0x10')][_0xb569('0x12')]);return _0x56519d(_0x180969[_0xb569('0x10')][_0xb569('0x12')]);}logger['error'](_0xb569('0x11'),_0x36f3c1,_0x180969[_0xb569('0x10')][_0xb569('0x12')]);return _0x1b8cb9(_0x180969[_0xb569('0x10')]['message']);}else{logger[_0xb569('0xb')](_0xb569('0x11'),_0x36f3c1,_0xb569('0xe'));_0x1b8cb9(_0x180969[_0xb569('0x13')]['message']);}})['catch'](function(_0x543aed){logger[_0xb569('0x10')]('VtigerField,\x20%s,\x20%s',_0x36f3c1,_0x543aed);_0x56519d(_0x543aed);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 49d0165..99acc01 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 _0xf539=['/:id/fields','getFields','post','create','put','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations'];(function(_0x30ff38,_0x2c8756){var _0x3d950a=function(_0x2280f0){while(--_0x2280f0){_0x30ff38['push'](_0x30ff38['shift']());}};_0x3d950a(++_0x2c8756);}(_0xf539,0x180));var _0x9f53=function(_0x2ab10e,_0x3937f3){_0x2ab10e=_0x2ab10e-0x0;var _0x286704=_0xf539[_0x2ab10e];return _0x286704;};'use strict';var multer=require(_0x9f53('0x0'));var util=require(_0x9f53('0x1'));var path=require(_0x9f53('0x2'));var timeout=require(_0x9f53('0x3'));var express=require('express');var router=express[_0x9f53('0x4')]();var fs_extra=require(_0x9f53('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f53('0x6'));var config=require(_0x9f53('0x7'));var controller=require(_0x9f53('0x8'));router['get']('/',auth[_0x9f53('0x9')](),controller[_0x9f53('0xa')]);router[_0x9f53('0xb')](_0x9f53('0xc'),auth[_0x9f53('0x9')](),controller[_0x9f53('0xd')]);router[_0x9f53('0xb')]('/:id/configurations',auth[_0x9f53('0x9')](),controller[_0x9f53('0xe')]);router[_0x9f53('0xb')](_0x9f53('0xf'),auth[_0x9f53('0x9')](),controller[_0x9f53('0x10')]);router[_0x9f53('0x11')]('/',auth[_0x9f53('0x9')](),controller[_0x9f53('0x12')]);router['post']('/:id/configurations',auth[_0x9f53('0x9')](),controller['addConfiguration']);router[_0x9f53('0x13')]('/:id',auth[_0x9f53('0x9')](),controller['update']);router[_0x9f53('0x14')](_0x9f53('0xc'),auth[_0x9f53('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb8cd=['/:id','isAuthenticated','getConfigurations','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','index'];(function(_0x135382,_0x536f72){var _0x377bd8=function(_0x3c50b9){while(--_0x3c50b9){_0x135382['push'](_0x135382['shift']());}};_0x377bd8(++_0x536f72);}(_0xb8cd,0x1d9));var _0xdb8c=function(_0xc56c3,_0x3f6ba2){_0xc56c3=_0xc56c3-0x0;var _0x6fabbb=_0xb8cd[_0xc56c3];return _0x6fabbb;};'use strict';var multer=require(_0xdb8c('0x0'));var util=require(_0xdb8c('0x1'));var path=require(_0xdb8c('0x2'));var timeout=require(_0xdb8c('0x3'));var express=require(_0xdb8c('0x4'));var router=express['Router']();var fs_extra=require(_0xdb8c('0x5'));var auth=require(_0xdb8c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdb8c('0x7'));var controller=require(_0xdb8c('0x8'));router[_0xdb8c('0x9')]('/',auth['isAuthenticated'](),controller[_0xdb8c('0xa')]);router[_0xdb8c('0x9')](_0xdb8c('0xb'),auth[_0xdb8c('0xc')](),controller['show']);router[_0xdb8c('0x9')]('/:id/configurations',auth[_0xdb8c('0xc')](),controller[_0xdb8c('0xd')]);router[_0xdb8c('0x9')]('/:id/fields',auth[_0xdb8c('0xc')](),controller['getFields']);router[_0xdb8c('0xe')]('/',auth[_0xdb8c('0xc')](),controller[_0xdb8c('0xf')]);router[_0xdb8c('0xe')](_0xdb8c('0x10'),auth[_0xdb8c('0xc')](),controller[_0xdb8c('0x11')]);router[_0xdb8c('0x12')](_0xdb8c('0xb'),auth[_0xdb8c('0xc')](),controller[_0xdb8c('0x13')]);router[_0xdb8c('0x14')](_0xdb8c('0xb'),auth[_0xdb8c('0xc')](),controller['destroy']);module[_0xdb8c('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 d3b670a..912d107 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 _0xef4d=['username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xef4d,0x165));var _0xdef4=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xef4d[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require(_0xdef4('0x0'));module[_0xdef4('0x1')]={'name':{'type':Sequelize[_0xdef4('0x2')]},'description':{'type':Sequelize[_0xdef4('0x2')]},'username':{'type':Sequelize[_0xdef4('0x2')],'unique':_0xdef4('0x3')},'password':{'type':Sequelize[_0xdef4('0x2')]},'token':{'type':Sequelize[_0xdef4('0x2')]},'remoteUri':{'type':Sequelize[_0xdef4('0x2')],'unique':_0xdef4('0x4')},'authType':{'type':Sequelize[_0xdef4('0x5')](_0xdef4('0x6'),_0xdef4('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xdef4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdef4('0x5')](_0xdef4('0x8'),_0xdef4('0x9')),'defaultValue':_0xdef4('0x8')}}; \ No newline at end of file +var _0xfdbd=['username','ENUM','token','password','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x463f29,_0x552bca){var _0x28d735=function(_0x2f92ab){while(--_0x2f92ab){_0x463f29['push'](_0x463f29['shift']());}};_0x28d735(++_0x552bca);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x475923,_0x25d9ec){_0x475923=_0x475923-0x0;var _0x374030=_0xfdbd[_0x475923];return _0x374030;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'username':{'type':Sequelize[_0xdfdb('0x2')],'unique':_0xdfdb('0x3')},'password':{'type':Sequelize[_0xdfdb('0x2')]},'token':{'type':Sequelize[_0xdfdb('0x2')]},'remoteUri':{'type':Sequelize[_0xdfdb('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xdfdb('0x4')]('password',_0xdfdb('0x5')),'defaultValue':_0xdfdb('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xdfdb('0x7')),'defaultValue':_0xdfdb('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index dcf89ac..a7a18ee 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 _0x0bb5=['offset','limit','undefined','count','set','json','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','ZendeskAccount','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','username','password','authType','remoteUri','substring','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status'];(function(_0x17d165,_0x275007){var _0xe19dd0=function(_0x195a73){while(--_0x195a73){_0x17d165['push'](_0x17d165['shift']());}};_0xe19dd0(++_0x275007);}(_0x0bb5,0x148));var _0x50bb=function(_0x27b730,_0x39ae1d){_0x27b730=_0x27b730-0x0;var _0x44f9ed=_0x0bb5[_0x27b730];return _0x44f9ed;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x50bb('0x19'));function respondWithStatusCode(_0x58837d,_0x283f04){_0x283f04=_0x283f04||0xcc;return function(_0xd8ab27){if(_0xd8ab27){return _0x58837d[_0x50bb('0x1a')](_0x283f04);}return _0x58837d['status'](_0x283f04)[_0x50bb('0x1b')]();};}function respondWithResult(_0x309986,_0x3094f2){_0x3094f2=_0x3094f2||0xc8;return function(_0x5244b0){if(_0x5244b0){return _0x309986[_0x50bb('0x1c')](_0x3094f2)['json'](_0x5244b0);}};}function respondWithFilteredResult(_0x21befa,_0x3e1a51){return function(_0x253073){if(_0x253073){var _0x42ffab=typeof _0x3e1a51[_0x50bb('0x1d')]==='undefined'&&typeof _0x3e1a51[_0x50bb('0x1e')]===_0x50bb('0x1f');var _0x4b1f5f=_0x253073[_0x50bb('0x20')];var _0x4796ec=_0x42ffab?0x0:_0x3e1a51[_0x50bb('0x1d')];var _0x431ed4=_0x42ffab?_0x253073['count']:_0x3e1a51['offset']+_0x3e1a51[_0x50bb('0x1e')];var _0x1499dc;if(_0x431ed4>=_0x4b1f5f){_0x431ed4=_0x4b1f5f;_0x1499dc=0xc8;}else{_0x1499dc=0xce;}_0x21befa[_0x50bb('0x1c')](_0x1499dc);return _0x21befa[_0x50bb('0x21')]('Content-Range',_0x4796ec+'-'+_0x431ed4+'/'+_0x4b1f5f)[_0x50bb('0x22')](_0x253073);}return null;};}function patchUpdates(_0x32bfc3){return function(_0x4020a0){try{jsonpatch['apply'](_0x4020a0,_0x32bfc3,!![]);}catch(_0x3104c8){return BPromise[_0x50bb('0x23')](_0x3104c8);}return _0x4020a0[_0x50bb('0x24')]();};}function saveUpdates(_0x4825f8,_0x1dbba2){return function(_0x4cc7f9){if(_0x4cc7f9){return _0x4cc7f9[_0x50bb('0x25')](_0x4825f8)[_0x50bb('0x26')](function(_0x1a2a0b){return _0x1a2a0b;});}return null;};}function removeEntity(_0x2ee87a,_0x846311){return function(_0x342078){if(_0x342078){return _0x342078['destroy']()[_0x50bb('0x26')](function(){_0x2ee87a[_0x50bb('0x1c')](0xcc)[_0x50bb('0x1b')]();});}};}function handleEntityNotFound(_0x3462c1,_0x5234d7){return function(_0x75fea6){if(!_0x75fea6){_0x3462c1['sendStatus'](0x194);}return _0x75fea6;};}function handleError(_0x55e87b,_0x2befd9){_0x2befd9=_0x2befd9||0x1f4;return function(_0x491632){logger['error'](_0x491632[_0x50bb('0x27')]);if(_0x491632[_0x50bb('0x28')]){delete _0x491632[_0x50bb('0x28')];}_0x55e87b[_0x50bb('0x1c')](_0x2befd9)[_0x50bb('0x29')](_0x491632);};}exports[_0x50bb('0x2a')]=function(_0x41a8ad,_0x41d479){var _0x4f7514={},_0x44ce86={},_0x461cf3={'count':0x0,'rows':[]};var _0x15ee2e=_[_0x50bb('0x2b')](db['ZendeskAccount'][_0x50bb('0x2c')],function(_0x1a62fb){return{'name':_0x1a62fb[_0x50bb('0x2d')],'type':_0x1a62fb[_0x50bb('0x2e')][_0x50bb('0x2f')]};});_0x44ce86[_0x50bb('0x30')]=_[_0x50bb('0x2b')](_0x15ee2e,_0x50bb('0x28'));_0x44ce86[_0x50bb('0x31')]=_[_0x50bb('0x32')](_0x41a8ad[_0x50bb('0x31')]);_0x44ce86[_0x50bb('0x33')]=_['intersection'](_0x44ce86[_0x50bb('0x30')],_0x44ce86[_0x50bb('0x31')]);_0x4f7514[_0x50bb('0x34')]=_[_0x50bb('0x35')](_0x44ce86[_0x50bb('0x30')],qs[_0x50bb('0x36')](_0x41a8ad[_0x50bb('0x31')][_0x50bb('0x36')]));_0x4f7514[_0x50bb('0x34')]=_0x4f7514[_0x50bb('0x34')][_0x50bb('0x37')]?_0x4f7514['attributes']:_0x44ce86[_0x50bb('0x30')];if(!_0x41a8ad[_0x50bb('0x31')][_0x50bb('0x38')](_0x50bb('0x39'))){_0x4f7514[_0x50bb('0x1e')]=qs[_0x50bb('0x1e')](_0x41a8ad['query']['limit']);_0x4f7514[_0x50bb('0x1d')]=qs['offset'](_0x41a8ad[_0x50bb('0x31')][_0x50bb('0x1d')]);}_0x4f7514[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x41a8ad[_0x50bb('0x31')]['sort']);_0x4f7514[_0x50bb('0x3c')]=qs['filters'](_[_0x50bb('0x3d')](_0x41a8ad[_0x50bb('0x31')],_0x44ce86[_0x50bb('0x33')]),_0x15ee2e);if(_0x41a8ad['query']['filter']){_0x4f7514[_0x50bb('0x3c')]=_[_0x50bb('0x3e')](_0x4f7514[_0x50bb('0x3c')],{'$or':_[_0x50bb('0x2b')](_0x15ee2e,function(_0x51750b){if(_0x51750b[_0x50bb('0x2e')]!=='VIRTUAL'){var _0x52059b={};_0x52059b[_0x51750b[_0x50bb('0x28')]]={'$like':'%'+_0x41a8ad['query'][_0x50bb('0x3f')]+'%'};return _0x52059b;}})});}_0x4f7514=_[_0x50bb('0x3e')]({},_0x4f7514,_0x41a8ad[_0x50bb('0x40')]);var _0x1f156e={'where':_0x4f7514[_0x50bb('0x3c')]};return db[_0x50bb('0x41')][_0x50bb('0x20')](_0x1f156e)[_0x50bb('0x26')](function(_0x46039a){_0x461cf3[_0x50bb('0x20')]=_0x46039a;if(_0x41a8ad['query']['includeAll']){_0x4f7514[_0x50bb('0x42')]=[{'all':!![]}];}return db[_0x50bb('0x41')][_0x50bb('0x43')](_0x4f7514);})[_0x50bb('0x26')](function(_0x5e8085){_0x461cf3[_0x50bb('0x44')]=_0x5e8085;return _0x461cf3;})['then'](respondWithFilteredResult(_0x41d479,_0x4f7514))[_0x50bb('0x45')](handleError(_0x41d479,null));};exports[_0x50bb('0x46')]=function(_0x379944,_0x40748d){var _0x1c438b={'raw':![],'where':{'id':_0x379944[_0x50bb('0x47')]['id']}},_0x355726={};_0x355726[_0x50bb('0x30')]=_[_0x50bb('0x32')](db[_0x50bb('0x41')][_0x50bb('0x2c')]);_0x355726[_0x50bb('0x31')]=_[_0x50bb('0x32')](_0x379944[_0x50bb('0x31')]);_0x355726[_0x50bb('0x33')]=_[_0x50bb('0x35')](_0x355726['model'],_0x355726[_0x50bb('0x31')]);_0x1c438b['attributes']=_[_0x50bb('0x35')](_0x355726[_0x50bb('0x30')],qs[_0x50bb('0x36')](_0x379944[_0x50bb('0x31')][_0x50bb('0x36')]));_0x1c438b[_0x50bb('0x34')]=_0x1c438b[_0x50bb('0x34')][_0x50bb('0x37')]?_0x1c438b[_0x50bb('0x34')]:_0x355726[_0x50bb('0x30')];if(_0x379944[_0x50bb('0x31')][_0x50bb('0x48')]){_0x1c438b[_0x50bb('0x42')]=[{'all':!![]}];}_0x1c438b=_[_0x50bb('0x3e')]({},_0x1c438b,_0x379944['options']);return db[_0x50bb('0x41')]['find'](_0x1c438b)[_0x50bb('0x26')](handleEntityNotFound(_0x40748d,null))[_0x50bb('0x26')](respondWithResult(_0x40748d,null))[_0x50bb('0x45')](handleError(_0x40748d,null));};exports[_0x50bb('0x49')]=function(_0x650e91,_0x39ac1a){return db[_0x50bb('0x41')][_0x50bb('0x49')](_0x650e91['body'],{})[_0x50bb('0x26')](respondWithResult(_0x39ac1a,0xc9))[_0x50bb('0x45')](handleError(_0x39ac1a,null));};exports[_0x50bb('0x25')]=function(_0x13afe2,_0x3659c4){if(_0x13afe2['body']['id']){delete _0x13afe2[_0x50bb('0x4a')]['id'];}return db[_0x50bb('0x41')][_0x50bb('0x4b')]({'where':{'id':_0x13afe2[_0x50bb('0x47')]['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x3659c4,null))['then'](saveUpdates(_0x13afe2['body'],null))[_0x50bb('0x26')](respondWithResult(_0x3659c4,null))['catch'](handleError(_0x3659c4,null));};exports[_0x50bb('0x4c')]=function(_0x57ee0e,_0x4316e4){return db[_0x50bb('0x41')][_0x50bb('0x4b')]({'where':{'id':_0x57ee0e['params']['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x4316e4,null))[_0x50bb('0x26')](removeEntity(_0x4316e4,null))['catch'](handleError(_0x4316e4,null));};exports[_0x50bb('0x4d')]=function(_0x1dff6a,_0x8d62af,_0x3c525c){var _0x55a4a6={};var _0x33e71f={};var _0x46b51e;var _0x2e0032;return db[_0x50bb('0x41')][_0x50bb('0x4e')]({'where':{'id':_0x1dff6a['params']['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x8d62af,null))['then'](function(_0x38a775){if(_0x38a775){_0x46b51e=_0x38a775;_0x33e71f['model']=_['keys'](db[_0x50bb('0x4f')]['rawAttributes']);_0x33e71f['query']=_[_0x50bb('0x32')](_0x1dff6a[_0x50bb('0x31')]);_0x33e71f[_0x50bb('0x33')]=_[_0x50bb('0x35')](_0x33e71f[_0x50bb('0x30')],_0x33e71f[_0x50bb('0x31')]);_0x55a4a6[_0x50bb('0x34')]=_[_0x50bb('0x35')](_0x33e71f['model'],qs['fields'](_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x36')]));_0x55a4a6[_0x50bb('0x34')]=_0x55a4a6[_0x50bb('0x34')][_0x50bb('0x37')]?_0x55a4a6[_0x50bb('0x34')]:_0x33e71f[_0x50bb('0x30')];_0x55a4a6['order']=qs[_0x50bb('0x3b')](_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x3b')]);_0x55a4a6[_0x50bb('0x3c')]=qs[_0x50bb('0x33')](_['pick'](_0x1dff6a[_0x50bb('0x31')],_0x33e71f[_0x50bb('0x33')]));if(_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x3f')]){_0x55a4a6[_0x50bb('0x3c')]=_['merge'](_0x55a4a6[_0x50bb('0x3c')],{'$or':_['map'](_0x55a4a6['attributes'],function(_0x170761){var _0x3057f2={};_0x3057f2[_0x170761]={'$like':'%'+_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x3f')]+'%'};return _0x3057f2;})});}_0x55a4a6=_[_0x50bb('0x3e')]({},_0x55a4a6,_0x1dff6a[_0x50bb('0x40')]);return _0x46b51e[_0x50bb('0x4d')](_0x55a4a6);}})[_0x50bb('0x26')](function(_0x330299){if(_0x330299){_0x2e0032=_0x330299[_0x50bb('0x37')];if(!_0x1dff6a[_0x50bb('0x31')]['hasOwnProperty'](_0x50bb('0x39'))){_0x55a4a6['limit']=qs[_0x50bb('0x1e')](_0x1dff6a[_0x50bb('0x31')]['limit']);_0x55a4a6[_0x50bb('0x1d')]=qs[_0x50bb('0x1d')](_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x1d')]);}return _0x46b51e[_0x50bb('0x4d')](_0x55a4a6);}})[_0x50bb('0x26')](function(_0x2b7df6){if(_0x2b7df6){return _0x2b7df6?{'count':_0x2e0032,'rows':_0x2b7df6}:null;}})[_0x50bb('0x26')](respondWithResult(_0x8d62af,null))['catch'](handleError(_0x8d62af,null));};exports[_0x50bb('0x50')]=function(_0x2dc832,_0x3b17c8,_0x4a226d){if(_0x2dc832[_0x50bb('0x4a')]['id']){delete _0x2dc832[_0x50bb('0x4a')]['id'];}return db[_0x50bb('0x41')][_0x50bb('0x4e')]({'where':{'id':_0x2dc832[_0x50bb('0x47')]['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x3b17c8,null))['then'](function(_0xf47641){if(_0xf47641){_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x51')]=_0xf47641['id'];_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x52')]=integrations[_0x50bb('0x53')](_0x2dc832['body'][_0x50bb('0x54')],_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x2e')]);_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x55')]=integrations[_0x50bb('0x56')](_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x54')],_0x2dc832[_0x50bb('0x4a')]['type']);return db[_0x50bb('0x4f')][_0x50bb('0x49')](_0x2dc832[_0x50bb('0x4a')],{'include':[{'model':db[_0x50bb('0x57')],'as':_0x50bb('0x52')},{'model':db[_0x50bb('0x57')],'as':_0x50bb('0x55')}]});}return null;})[_0x50bb('0x26')](respondWithResult(_0x3b17c8,null))[_0x50bb('0x45')](handleError(_0x3b17c8,null));};exports['getFields']=function(_0x58ad41,_0x5babbc,_0x4159ad){var _0x5ba597='';return db['ZendeskAccount'][_0x50bb('0x4e')]({'where':{'id':_0x58ad41[_0x50bb('0x47')]['id']},'attributes':['id',_0x50bb('0x58'),_0x50bb('0x59'),'token',_0x50bb('0x5a'),_0x50bb('0x5b')]})['then'](handleEntityNotFound(_0x5babbc,null))[_0x50bb('0x26')](function(_0x51e64f){if(_0x51e64f){_0x5ba597=_0x51e64f[_0x50bb('0x5b')];var _0x239a82=_0x5ba597['slice'](-0x1);if(_0x239a82==='/'){_0x5ba597=_0x5ba597[_0x50bb('0x5c')](0x0,_0x5ba597['lastIndexOf'](_0x239a82));}var _0x8f5df6={'method':_0x50bb('0x5d'),'uri':util['format'](_0x50bb('0x5e'),_0x5ba597,_0x50bb('0x5f')),'json':!![]};switch(_0x51e64f[_0x50bb('0x5a')]){case'password':_0x8f5df6[_0x50bb('0x60')]={'Authorization':util[_0x50bb('0x61')](_0x50bb('0x62'),new Buffer(util[_0x50bb('0x61')]('%s:%s',_0x51e64f[_0x50bb('0x58')],_0x51e64f[_0x50bb('0x59')]))['toString']('base64'))};break;case _0x50bb('0x63'):_0x8f5df6[_0x50bb('0x60')]={'Authorization':util['format'](_0x50bb('0x62'),new Buffer(util[_0x50bb('0x61')](_0x50bb('0x64'),_0x51e64f[_0x50bb('0x58')],_0x51e64f[_0x50bb('0x63')]))['toString']('base64'))};break;default:throw new db[(_0x50bb('0x65'))][(_0x50bb('0x66'))](_0x50bb('0x67'));}return rp(_0x8f5df6);}})[_0x50bb('0x26')](function(_0x4b51d4){if(_0x4b51d4){var _0x1975f7=['subject',_0x50bb('0x68'),_0x50bb('0x69'),_0x50bb('0x6a')];_[_0x50bb('0x6b')](_0x4b51d4[_0x50bb('0x5f')],function(_0x217170){return _0x1975f7[_0x50bb('0x6c')](_0x217170['type']);});return{'count':_0x4b51d4[_0x50bb('0x5f')][_0x50bb('0x37')],'rows':_[_0x50bb('0x2b')](_0x4b51d4[_0x50bb('0x5f')],function(_0x5d2dc4){return{'id':_0x5d2dc4['id'],'name':_0x5d2dc4[_0x50bb('0x6d')]>0x7?_0x5d2dc4[_0x50bb('0x6e')]:_0x5d2dc4['type'],'custom':_0x5d2dc4[_0x50bb('0x6d')]>0x7?!![]:![],'options':_0x5d2dc4[_0x50bb('0x6f')]?_0x5d2dc4[_0x50bb('0x6f')]:_0x5d2dc4[_0x50bb('0x70')]?_0x5d2dc4[_0x50bb('0x70')]:[]};})};}})['then'](respondWithResult(_0x5babbc,null))['catch'](function(_0x145cf8){var _0x47e80f=_0x58ad41[_0x50bb('0x31')][_0x50bb('0x71')]?0x1f4:_0x145cf8['statusCode']||0x1f4;logger['error'](_0x50bb('0x72'),_0x50bb('0x73'),_0x47e80f,JSON[_0x50bb('0x74')](_0x145cf8));delete _0x145cf8['name'];if(_0x47e80f===0x191){_0x47e80f=0x190;}_0x5babbc[_0x50bb('0x1c')](_0x47e80f)[_0x50bb('0x29')](_0x58ad41[_0x50bb('0x31')][_0x50bb('0x71')]?{'message':_0x50bb('0x75'),'statusCode':_0x145cf8[_0x50bb('0x76')]}:_0x145cf8);});}; \ No newline at end of file +var _0x2e54=['position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params','intersection','options','create','body','find','getConfigurations','findOne','ZendeskConfiguration','length','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','format','%s/%s','Basic\x20%s','%s:%s','headers','%s/token:%s','toString','Sequelize','ValidationError','subject','description','group','assignee','remove','ticket_fields'];(function(_0x525067,_0x128b80){var _0x21ab1a=function(_0x26298){while(--_0x26298){_0x525067['push'](_0x525067['shift']());}};_0x21ab1a(++_0x128b80);}(_0x2e54,0x1dd));var _0x42e5=function(_0x451b75,_0x5c632d){_0x451b75=_0x451b75-0x0;var _0x1c96ed=_0x2e54[_0x451b75];return _0x1c96ed;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];var integrations=require(_0x42e5('0x18'));function respondWithStatusCode(_0x4530ba,_0x41598d){_0x41598d=_0x41598d||0xcc;return function(_0x144fb4){if(_0x144fb4){return _0x4530ba[_0x42e5('0x19')](_0x41598d);}return _0x4530ba[_0x42e5('0x1a')](_0x41598d)[_0x42e5('0x1b')]();};}function respondWithResult(_0x447648,_0x23957f){_0x23957f=_0x23957f||0xc8;return function(_0x51b2f4){if(_0x51b2f4){return _0x447648[_0x42e5('0x1a')](_0x23957f)[_0x42e5('0x1c')](_0x51b2f4);}};}function respondWithFilteredResult(_0x4034bd,_0x388300){return function(_0x2f4999){if(_0x2f4999){var _0x263a3d=typeof _0x388300[_0x42e5('0x1d')]===_0x42e5('0x1e')&&typeof _0x388300[_0x42e5('0x1f')]===_0x42e5('0x1e');var _0x22655f=_0x2f4999[_0x42e5('0x20')];var _0x11550e=_0x263a3d?0x0:_0x388300[_0x42e5('0x1d')];var _0x54fcfc=_0x263a3d?_0x2f4999[_0x42e5('0x20')]:_0x388300['offset']+_0x388300['limit'];var _0x14d16d;if(_0x54fcfc>=_0x22655f){_0x54fcfc=_0x22655f;_0x14d16d=0xc8;}else{_0x14d16d=0xce;}_0x4034bd[_0x42e5('0x1a')](_0x14d16d);return _0x4034bd['set'](_0x42e5('0x21'),_0x11550e+'-'+_0x54fcfc+'/'+_0x22655f)[_0x42e5('0x1c')](_0x2f4999);}return null;};}function patchUpdates(_0x1c2169){return function(_0x3fde76){try{jsonpatch[_0x42e5('0x22')](_0x3fde76,_0x1c2169,!![]);}catch(_0xa6825e){return BPromise[_0x42e5('0x23')](_0xa6825e);}return _0x3fde76['save']();};}function saveUpdates(_0x4da508,_0x283d44){return function(_0x52d319){if(_0x52d319){return _0x52d319[_0x42e5('0x24')](_0x4da508)[_0x42e5('0x25')](function(_0x37d10e){return _0x37d10e;});}return null;};}function removeEntity(_0x49490f,_0x32380f){return function(_0x5d6b24){if(_0x5d6b24){return _0x5d6b24[_0x42e5('0x26')]()[_0x42e5('0x25')](function(){_0x49490f[_0x42e5('0x1a')](0xcc)[_0x42e5('0x1b')]();});}};}function handleEntityNotFound(_0x4638bc,_0x4f52b2){return function(_0x4fb147){if(!_0x4fb147){_0x4638bc[_0x42e5('0x19')](0x194);}return _0x4fb147;};}function handleError(_0x534a26,_0x56f812){_0x56f812=_0x56f812||0x1f4;return function(_0x1b60be){logger['error'](_0x1b60be[_0x42e5('0x27')]);if(_0x1b60be[_0x42e5('0x28')]){delete _0x1b60be[_0x42e5('0x28')];}_0x534a26[_0x42e5('0x1a')](_0x56f812)[_0x42e5('0x29')](_0x1b60be);};}exports[_0x42e5('0x2a')]=function(_0x59a46b,_0x3e2ea5){var _0x201d9e={},_0x39f763={},_0x2c53d4={'count':0x0,'rows':[]};var _0x1d22ba=_[_0x42e5('0x2b')](db[_0x42e5('0x2c')][_0x42e5('0x2d')],function(_0x5a4930){return{'name':_0x5a4930[_0x42e5('0x2e')],'type':_0x5a4930[_0x42e5('0x2f')][_0x42e5('0x30')]};});_0x39f763[_0x42e5('0x31')]=_['map'](_0x1d22ba,_0x42e5('0x28'));_0x39f763[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x59a46b[_0x42e5('0x32')]);_0x39f763['filters']=_['intersection'](_0x39f763[_0x42e5('0x31')],_0x39f763['query']);_0x201d9e[_0x42e5('0x34')]=_['intersection'](_0x39f763[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x59a46b[_0x42e5('0x32')]['fields']));_0x201d9e[_0x42e5('0x34')]=_0x201d9e[_0x42e5('0x34')]['length']?_0x201d9e[_0x42e5('0x34')]:_0x39f763['model'];if(!_0x59a46b[_0x42e5('0x32')][_0x42e5('0x36')](_0x42e5('0x37'))){_0x201d9e[_0x42e5('0x1f')]=qs[_0x42e5('0x1f')](_0x59a46b[_0x42e5('0x32')][_0x42e5('0x1f')]);_0x201d9e['offset']=qs['offset'](_0x59a46b[_0x42e5('0x32')][_0x42e5('0x1d')]);}_0x201d9e[_0x42e5('0x38')]=qs['sort'](_0x59a46b['query']['sort']);_0x201d9e['where']=qs[_0x42e5('0x39')](_[_0x42e5('0x3a')](_0x59a46b[_0x42e5('0x32')],_0x39f763[_0x42e5('0x39')]),_0x1d22ba);if(_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3b')]){_0x201d9e[_0x42e5('0x3c')]=_[_0x42e5('0x3d')](_0x201d9e['where'],{'$or':_[_0x42e5('0x2b')](_0x1d22ba,function(_0x587832){if(_0x587832[_0x42e5('0x2f')]!==_0x42e5('0x3e')){var _0x340caf={};_0x340caf[_0x587832[_0x42e5('0x28')]]={'$like':'%'+_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3b')]+'%'};return _0x340caf;}})});}_0x201d9e=_[_0x42e5('0x3d')]({},_0x201d9e,_0x59a46b['options']);var _0x20f372={'where':_0x201d9e[_0x42e5('0x3c')]};return db['ZendeskAccount'][_0x42e5('0x20')](_0x20f372)['then'](function(_0x53b0bd){_0x2c53d4['count']=_0x53b0bd;if(_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3f')]){_0x201d9e[_0x42e5('0x40')]=[{'all':!![]}];}return db[_0x42e5('0x2c')][_0x42e5('0x41')](_0x201d9e);})[_0x42e5('0x25')](function(_0x1fbde){_0x2c53d4['rows']=_0x1fbde;return _0x2c53d4;})[_0x42e5('0x25')](respondWithFilteredResult(_0x3e2ea5,_0x201d9e))[_0x42e5('0x42')](handleError(_0x3e2ea5,null));};exports['show']=function(_0x398b73,_0x1c697a){var _0x5db771={'raw':![],'where':{'id':_0x398b73[_0x42e5('0x43')]['id']}},_0x33054f={};_0x33054f[_0x42e5('0x31')]=_[_0x42e5('0x33')](db[_0x42e5('0x2c')]['rawAttributes']);_0x33054f[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x398b73[_0x42e5('0x32')]);_0x33054f[_0x42e5('0x39')]=_['intersection'](_0x33054f[_0x42e5('0x31')],_0x33054f[_0x42e5('0x32')]);_0x5db771[_0x42e5('0x34')]=_[_0x42e5('0x44')](_0x33054f[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x398b73[_0x42e5('0x32')][_0x42e5('0x35')]));_0x5db771['attributes']=_0x5db771[_0x42e5('0x34')]['length']?_0x5db771['attributes']:_0x33054f[_0x42e5('0x31')];if(_0x398b73[_0x42e5('0x32')][_0x42e5('0x3f')]){_0x5db771[_0x42e5('0x40')]=[{'all':!![]}];}_0x5db771=_[_0x42e5('0x3d')]({},_0x5db771,_0x398b73[_0x42e5('0x45')]);return db[_0x42e5('0x2c')]['find'](_0x5db771)[_0x42e5('0x25')](handleEntityNotFound(_0x1c697a,null))[_0x42e5('0x25')](respondWithResult(_0x1c697a,null))[_0x42e5('0x42')](handleError(_0x1c697a,null));};exports[_0x42e5('0x46')]=function(_0x1086b2,_0xc8de4d){return db[_0x42e5('0x2c')][_0x42e5('0x46')](_0x1086b2['body'],{})[_0x42e5('0x25')](respondWithResult(_0xc8de4d,0xc9))[_0x42e5('0x42')](handleError(_0xc8de4d,null));};exports[_0x42e5('0x24')]=function(_0x48757e,_0x2ab52a){if(_0x48757e[_0x42e5('0x47')]['id']){delete _0x48757e[_0x42e5('0x47')]['id'];}return db[_0x42e5('0x2c')][_0x42e5('0x48')]({'where':{'id':_0x48757e['params']['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x2ab52a,null))['then'](saveUpdates(_0x48757e[_0x42e5('0x47')],null))[_0x42e5('0x25')](respondWithResult(_0x2ab52a,null))[_0x42e5('0x42')](handleError(_0x2ab52a,null));};exports['destroy']=function(_0x50f59c,_0x4f0639){return db[_0x42e5('0x2c')][_0x42e5('0x48')]({'where':{'id':_0x50f59c[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x4f0639,null))['then'](removeEntity(_0x4f0639,null))[_0x42e5('0x42')](handleError(_0x4f0639,null));};exports[_0x42e5('0x49')]=function(_0x18cedc,_0x504110,_0x34e169){var _0x5070aa={};var _0x319088={};var _0x2583cd;var _0x53e29b;return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x18cedc[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x504110,null))[_0x42e5('0x25')](function(_0x3f043f){if(_0x3f043f){_0x2583cd=_0x3f043f;_0x319088[_0x42e5('0x31')]=_[_0x42e5('0x33')](db[_0x42e5('0x4b')][_0x42e5('0x2d')]);_0x319088['query']=_[_0x42e5('0x33')](_0x18cedc[_0x42e5('0x32')]);_0x319088[_0x42e5('0x39')]=_[_0x42e5('0x44')](_0x319088[_0x42e5('0x31')],_0x319088['query']);_0x5070aa[_0x42e5('0x34')]=_[_0x42e5('0x44')](_0x319088[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x18cedc['query']['fields']));_0x5070aa['attributes']=_0x5070aa[_0x42e5('0x34')][_0x42e5('0x4c')]?_0x5070aa['attributes']:_0x319088[_0x42e5('0x31')];_0x5070aa[_0x42e5('0x38')]=qs[_0x42e5('0x4d')](_0x18cedc[_0x42e5('0x32')][_0x42e5('0x4d')]);_0x5070aa[_0x42e5('0x3c')]=qs[_0x42e5('0x39')](_[_0x42e5('0x3a')](_0x18cedc[_0x42e5('0x32')],_0x319088['filters']));if(_0x18cedc[_0x42e5('0x32')]['filter']){_0x5070aa[_0x42e5('0x3c')]=_[_0x42e5('0x3d')](_0x5070aa[_0x42e5('0x3c')],{'$or':_[_0x42e5('0x2b')](_0x5070aa[_0x42e5('0x34')],function(_0x3b46d2){var _0x248cb8={};_0x248cb8[_0x3b46d2]={'$like':'%'+_0x18cedc[_0x42e5('0x32')][_0x42e5('0x3b')]+'%'};return _0x248cb8;})});}_0x5070aa=_[_0x42e5('0x3d')]({},_0x5070aa,_0x18cedc[_0x42e5('0x45')]);return _0x2583cd['getConfigurations'](_0x5070aa);}})[_0x42e5('0x25')](function(_0x4ff58c){if(_0x4ff58c){_0x53e29b=_0x4ff58c[_0x42e5('0x4c')];if(!_0x18cedc['query'][_0x42e5('0x36')](_0x42e5('0x37'))){_0x5070aa['limit']=qs[_0x42e5('0x1f')](_0x18cedc[_0x42e5('0x32')]['limit']);_0x5070aa[_0x42e5('0x1d')]=qs[_0x42e5('0x1d')](_0x18cedc['query'][_0x42e5('0x1d')]);}return _0x2583cd[_0x42e5('0x49')](_0x5070aa);}})[_0x42e5('0x25')](function(_0x57814b){if(_0x57814b){return _0x57814b?{'count':_0x53e29b,'rows':_0x57814b}:null;}})[_0x42e5('0x25')](respondWithResult(_0x504110,null))[_0x42e5('0x42')](handleError(_0x504110,null));};exports[_0x42e5('0x4e')]=function(_0x78394d,_0x57368e,_0x42db50){if(_0x78394d['body']['id']){delete _0x78394d[_0x42e5('0x47')]['id'];}return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x78394d[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x57368e,null))[_0x42e5('0x25')](function(_0x15ff42){if(_0x15ff42){_0x78394d['body'][_0x42e5('0x4f')]=_0x15ff42['id'];_0x78394d[_0x42e5('0x47')][_0x42e5('0x50')]=integrations[_0x42e5('0x51')](_0x78394d[_0x42e5('0x47')][_0x42e5('0x52')],_0x78394d[_0x42e5('0x47')][_0x42e5('0x2f')]);_0x78394d[_0x42e5('0x47')]['Descriptions']=integrations[_0x42e5('0x53')](_0x78394d[_0x42e5('0x47')][_0x42e5('0x52')],_0x78394d[_0x42e5('0x47')]['type']);return db[_0x42e5('0x4b')][_0x42e5('0x46')](_0x78394d[_0x42e5('0x47')],{'include':[{'model':db[_0x42e5('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x42e5('0x25')](respondWithResult(_0x57368e,null))[_0x42e5('0x42')](handleError(_0x57368e,null));};exports[_0x42e5('0x55')]=function(_0x2ce1d4,_0xb198d,_0x14d111){var _0x1cfe79='';return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x2ce1d4['params']['id']},'attributes':['id',_0x42e5('0x56'),_0x42e5('0x57'),_0x42e5('0x58'),_0x42e5('0x59'),_0x42e5('0x5a')]})[_0x42e5('0x25')](handleEntityNotFound(_0xb198d,null))[_0x42e5('0x25')](function(_0x147613){if(_0x147613){_0x1cfe79=_0x147613['remoteUri'];var _0x548f8a=_0x1cfe79[_0x42e5('0x5b')](-0x1);if(_0x548f8a==='/'){_0x1cfe79=_0x1cfe79[_0x42e5('0x5c')](0x0,_0x1cfe79['lastIndexOf'](_0x548f8a));}var _0x4b9559={'method':'GET','uri':util[_0x42e5('0x5d')](_0x42e5('0x5e'),_0x1cfe79,'ticket_fields'),'json':!![]};switch(_0x147613[_0x42e5('0x59')]){case _0x42e5('0x57'):_0x4b9559['headers']={'Authorization':util[_0x42e5('0x5d')](_0x42e5('0x5f'),new Buffer(util['format'](_0x42e5('0x60'),_0x147613['username'],_0x147613['password']))['toString']('base64'))};break;case _0x42e5('0x58'):_0x4b9559[_0x42e5('0x61')]={'Authorization':util['format'](_0x42e5('0x5f'),new Buffer(util[_0x42e5('0x5d')](_0x42e5('0x62'),_0x147613[_0x42e5('0x56')],_0x147613[_0x42e5('0x58')]))[_0x42e5('0x63')]('base64'))};break;default:throw new db[(_0x42e5('0x64'))][(_0x42e5('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x4b9559);}})['then'](function(_0x2faf9b){if(_0x2faf9b){var _0xfa822e=[_0x42e5('0x66'),_0x42e5('0x67'),_0x42e5('0x68'),_0x42e5('0x69')];_[_0x42e5('0x6a')](_0x2faf9b['ticket_fields'],function(_0x5a1b63){return _0xfa822e['includes'](_0x5a1b63['type']);});return{'count':_0x2faf9b[_0x42e5('0x6b')][_0x42e5('0x4c')],'rows':_['map'](_0x2faf9b[_0x42e5('0x6b')],function(_0x5debb1){return{'id':_0x5debb1['id'],'name':_0x5debb1[_0x42e5('0x6c')]>0x7?_0x5debb1[_0x42e5('0x6d')]:_0x5debb1[_0x42e5('0x2f')],'custom':_0x5debb1[_0x42e5('0x6c')]>0x7?!![]:![],'options':_0x5debb1[_0x42e5('0x6e')]?_0x5debb1[_0x42e5('0x6e')]:_0x5debb1[_0x42e5('0x6f')]?_0x5debb1[_0x42e5('0x6f')]:[]};})};}})[_0x42e5('0x25')](respondWithResult(_0xb198d,null))[_0x42e5('0x42')](function(_0x1ee9b2){var _0x78573b=_0x2ce1d4[_0x42e5('0x32')][_0x42e5('0x70')]?0x1f4:_0x1ee9b2[_0x42e5('0x71')]||0x1f4;logger[_0x42e5('0x72')](_0x42e5('0x73'),_0x42e5('0x55'),_0x78573b,JSON['stringify'](_0x1ee9b2));delete _0x1ee9b2[_0x42e5('0x28')];if(_0x78573b===0x191){_0x78573b=0x190;}_0xb198d[_0x42e5('0x1a')](_0x78573b)[_0x42e5('0x29')](_0x2ce1d4[_0x42e5('0x32')][_0x42e5('0x70')]?{'message':_0x42e5('0x74'),'statusCode':_0x1ee9b2[_0x42e5('0x71')]}:_0x1ee9b2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 6bd0f52..36fc849 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 _0x7fab=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x487d6e,_0x590ce7){var _0x3d0a2e=function(_0x4d559f){while(--_0x4d559f){_0x487d6e['push'](_0x487d6e['shift']());}};_0x3d0a2e(++_0x590ce7);}(_0x7fab,0x1b0));var _0xb7fa=function(_0x49d21f,_0x6e7f5){_0x49d21f=_0x49d21f-0x0;var _0x1b93f2=_0x7fab[_0x49d21f];return _0x1b93f2;};'use strict';var _=require(_0xb7fa('0x0'));var util=require(_0xb7fa('0x1'));var logger=require(_0xb7fa('0x2'))('api');var moment=require(_0xb7fa('0x3'));var BPromise=require(_0xb7fa('0x4'));var rp=require(_0xb7fa('0x5'));var fs=require('fs');var path=require(_0xb7fa('0x6'));var rimraf=require(_0xb7fa('0x7'));var config=require(_0xb7fa('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xb7fa('0x9'));module[_0xb7fa('0xa')]=function(_0x2a290e,_0x1b7c85){return _0x2a290e[_0xb7fa('0xb')](_0xb7fa('0xc'),attributes,{'tableName':_0xb7fa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50cf=['moment','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x50cf,0x1eb));var _0xf50c=function(_0xbaaf16,_0x17c366){_0xbaaf16=_0xbaaf16-0x0;var _0x545a3e=_0x50cf[_0xbaaf16];return _0x545a3e;};'use strict';var _=require(_0xf50c('0x0'));var util=require('util');var logger=require(_0xf50c('0x1'))(_0xf50c('0x2'));var moment=require(_0xf50c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf50c('0x4'));var fs=require('fs');var path=require(_0xf50c('0x5'));var rimraf=require('rimraf');var config=require(_0xf50c('0x6'));var attributes=require(_0xf50c('0x7'));var integrations=require(_0xf50c('0x8'));module[_0xf50c('0x9')]=function(_0x112442,_0x193fe8){return _0x112442[_0xf50c('0xa')](_0xf50c('0xb'),attributes,{'tableName':_0xf50c('0xc'),'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 d493948..6c0d9e2 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 _0x0327=['message','GetZendeskAccount','ZendeskAccount','findAll','options','limit','include','map','model','attributes','catch','find','raw','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s'];(function(_0x3e8568,_0x37cce1){var _0x1987ab=function(_0xde8eb3){while(--_0xde8eb3){_0x3e8568['push'](_0x3e8568['shift']());}};_0x1987ab(++_0x37cce1);}(_0x0327,0x18f));var _0x7032=function(_0x4f4eeb,_0x49438b){_0x4f4eeb=_0x4f4eeb-0x0;var _0x387115=_0x0327[_0x4f4eeb];return _0x387115;};'use strict';var _=require(_0x7032('0x0'));var util=require(_0x7032('0x1'));var moment=require(_0x7032('0x2'));var BPromise=require(_0x7032('0x3'));var rs=require(_0x7032('0x4'));var fs=require('fs');var Redis=require(_0x7032('0x5'));var db=require(_0x7032('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7032('0x7'))('rpc');var config=require(_0x7032('0x8'));var jayson=require(_0x7032('0x9'));var client=jayson[_0x7032('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300af4,_0x2306ee,_0x356ee7){return new BPromise(function(_0x1d4df5,_0x5b2c3b){return client[_0x7032('0xb')](_0x300af4,_0x356ee7)[_0x7032('0xc')](function(_0x5ccab1){logger[_0x7032('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x2306ee,_0x7032('0xe'));logger[_0x7032('0xf')](_0x7032('0x10'),_0x2306ee,_0x7032('0xe'),JSON[_0x7032('0x11')](_0x5ccab1));if(_0x5ccab1[_0x7032('0x12')]){if(_0x5ccab1['error'][_0x7032('0x13')]===0x1f4){logger[_0x7032('0x12')](_0x7032('0x14'),_0x2306ee,_0x5ccab1[_0x7032('0x12')]['message']);return _0x5b2c3b(_0x5ccab1['error'][_0x7032('0x15')]);}logger['error'](_0x7032('0x14'),_0x2306ee,_0x5ccab1[_0x7032('0x12')][_0x7032('0x15')]);return _0x1d4df5(_0x5ccab1['error'][_0x7032('0x15')]);}else{logger['info'](_0x7032('0x14'),_0x2306ee,_0x7032('0xe'));_0x1d4df5(_0x5ccab1['result'][_0x7032('0x15')]);}})['catch'](function(_0x2fd532){logger[_0x7032('0x12')](_0x7032('0x14'),_0x2306ee,_0x2fd532);_0x5b2c3b(_0x2fd532);});});}exports[_0x7032('0x16')]=function(_0x51ac03){var _0x40447f=this;return new Promise(function(_0x42dcde,_0x1a6056){return db[_0x7032('0x17')][_0x7032('0x18')]({'raw':_0x51ac03['options']?_0x51ac03['options']['raw']===undefined?!![]:![]:!![],'where':_0x51ac03[_0x7032('0x19')]?_0x51ac03[_0x7032('0x19')]['where']||null:null,'attributes':_0x51ac03[_0x7032('0x19')]?_0x51ac03['options']['attributes']||null:null,'limit':_0x51ac03[_0x7032('0x19')]?_0x51ac03[_0x7032('0x19')][_0x7032('0x1a')]||null:null,'include':_0x51ac03[_0x7032('0x19')]?_0x51ac03[_0x7032('0x19')][_0x7032('0x1b')]?_[_0x7032('0x1c')](_0x51ac03[_0x7032('0x19')][_0x7032('0x1b')],function(_0x328327){return{'model':db[_0x328327[_0x7032('0x1d')]],'as':_0x328327['as'],'attributes':_0x328327[_0x7032('0x1e')],'include':_0x328327[_0x7032('0x1b')]?_[_0x7032('0x1c')](_0x328327[_0x7032('0x1b')],function(_0x140553){return{'model':db[_0x140553['model']],'as':_0x140553['as'],'attributes':_0x140553[_0x7032('0x1e')],'include':_0x140553[_0x7032('0x1b')]?_['map'](_0x140553[_0x7032('0x1b')],function(_0x2c84e8){return{'model':db[_0x2c84e8[_0x7032('0x1d')]],'as':_0x2c84e8['as'],'attributes':_0x2c84e8['attributes']};}):[]};}):[]};}):[]:[]})[_0x7032('0xc')](function(_0x11ce60){logger[_0x7032('0xd')](_0x7032('0x16'),_0x51ac03);logger[_0x7032('0xf')]('GetZendeskAccount',_0x51ac03,JSON[_0x7032('0x11')](_0x11ce60));_0x42dcde(_0x11ce60);})[_0x7032('0x1f')](function(_0x4ec8d3){logger[_0x7032('0x12')]('GetZendeskAccount',_0x4ec8d3['message'],_0x51ac03);_0x1a6056(_0x40447f[_0x7032('0x12')](0x1f4,_0x4ec8d3[_0x7032('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x14a1c0){var _0x2e3298=this;return new Promise(function(_0xbee935,_0x1f34a0){return db['ZendeskAccount'][_0x7032('0x20')]({'raw':_0x14a1c0[_0x7032('0x19')]?_0x14a1c0[_0x7032('0x19')][_0x7032('0x21')]===undefined?!![]:![]:!![],'where':_0x14a1c0[_0x7032('0x19')]?_0x14a1c0['options']['where']||null:null,'attributes':_0x14a1c0['options']?_0x14a1c0[_0x7032('0x19')][_0x7032('0x1e')]||null:null,'include':_0x14a1c0[_0x7032('0x19')]?_0x14a1c0['options'][_0x7032('0x1b')]?_['map'](_0x14a1c0[_0x7032('0x19')][_0x7032('0x1b')],function(_0x3b9904){return{'model':db[_0x3b9904[_0x7032('0x1d')]],'as':_0x3b9904['as'],'attributes':_0x3b9904[_0x7032('0x1e')],'include':_0x3b9904[_0x7032('0x1b')]?_[_0x7032('0x1c')](_0x3b9904['include'],function(_0x51205e){return{'model':db[_0x51205e[_0x7032('0x1d')]],'as':_0x51205e['as'],'attributes':_0x51205e[_0x7032('0x1e')],'include':_0x51205e[_0x7032('0x1b')]?_[_0x7032('0x1c')](_0x51205e['include'],function(_0xe4840){return{'model':db[_0xe4840[_0x7032('0x1d')]],'as':_0xe4840['as'],'attributes':_0xe4840['attributes']};}):[]};}):[]};}):[]:[]})[_0x7032('0xc')](function(_0x63699a){logger[_0x7032('0xd')](_0x7032('0x22'),_0x14a1c0);logger[_0x7032('0xf')](_0x7032('0x22'),_0x14a1c0,JSON['stringify'](_0x63699a));_0xbee935(_0x63699a);})[_0x7032('0x1f')](function(_0x2c9f1e){logger[_0x7032('0x12')](_0x7032('0x22'),_0x2c9f1e['message'],_0x14a1c0);_0x1f34a0(_0x2e3298[_0x7032('0x12')](0x1f4,_0x2c9f1e[_0x7032('0x15')]));});});}; \ No newline at end of file +var _0x1751=['attributes','GetZendeskAccount','find','ShowZendeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','limit','include','map','model'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x1751,0x76));var _0x1175=function(_0x59896b,_0x4f40de){_0x59896b=_0x59896b-0x0;var _0x47f3c8=_0x1751[_0x59896b];return _0x47f3c8;};'use strict';var _=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var moment=require(_0x1175('0x2'));var BPromise=require(_0x1175('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1175('0x4'));var db=require(_0x1175('0x5'))['db'];var utils=require(_0x1175('0x6'));var logger=require(_0x1175('0x7'))(_0x1175('0x8'));var config=require(_0x1175('0x9'));var jayson=require(_0x1175('0xa'));var client=jayson[_0x1175('0xb')][_0x1175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3300e9,_0x403f1a,_0x37c744){return new BPromise(function(_0x434f79,_0xf4d43d){return client[_0x1175('0xd')](_0x3300e9,_0x37c744)[_0x1175('0xe')](function(_0x470b89){logger[_0x1175('0xf')](_0x1175('0x10'),_0x403f1a,_0x1175('0x11'));logger[_0x1175('0x12')](_0x1175('0x13'),_0x403f1a,_0x1175('0x11'),JSON[_0x1175('0x14')](_0x470b89));if(_0x470b89[_0x1175('0x15')]){if(_0x470b89[_0x1175('0x15')]['code']===0x1f4){logger['error'](_0x1175('0x10'),_0x403f1a,_0x470b89[_0x1175('0x15')]['message']);return _0xf4d43d(_0x470b89[_0x1175('0x15')][_0x1175('0x16')]);}logger[_0x1175('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x403f1a,_0x470b89[_0x1175('0x15')][_0x1175('0x16')]);return _0x434f79(_0x470b89[_0x1175('0x15')]['message']);}else{logger[_0x1175('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x403f1a,_0x1175('0x11'));_0x434f79(_0x470b89[_0x1175('0x17')][_0x1175('0x16')]);}})[_0x1175('0x18')](function(_0x5c1a14){logger[_0x1175('0x15')](_0x1175('0x10'),_0x403f1a,_0x5c1a14);_0xf4d43d(_0x5c1a14);});});}exports['GetZendeskAccount']=function(_0x50e563){var _0x40b685=this;return new Promise(function(_0x5eee28,_0x8be461){return db[_0x1175('0x19')][_0x1175('0x1a')]({'raw':_0x50e563['options']?_0x50e563[_0x1175('0x1b')][_0x1175('0x1c')]===undefined?!![]:![]:!![],'where':_0x50e563[_0x1175('0x1b')]?_0x50e563[_0x1175('0x1b')][_0x1175('0x1d')]||null:null,'attributes':_0x50e563[_0x1175('0x1b')]?_0x50e563['options']['attributes']||null:null,'limit':_0x50e563[_0x1175('0x1b')]?_0x50e563[_0x1175('0x1b')][_0x1175('0x1e')]||null:null,'include':_0x50e563[_0x1175('0x1b')]?_0x50e563[_0x1175('0x1b')][_0x1175('0x1f')]?_[_0x1175('0x20')](_0x50e563['options'][_0x1175('0x1f')],function(_0xd73499){return{'model':db[_0xd73499[_0x1175('0x21')]],'as':_0xd73499['as'],'attributes':_0xd73499[_0x1175('0x22')],'include':_0xd73499[_0x1175('0x1f')]?_[_0x1175('0x20')](_0xd73499[_0x1175('0x1f')],function(_0x5a3dc9){return{'model':db[_0x5a3dc9[_0x1175('0x21')]],'as':_0x5a3dc9['as'],'attributes':_0x5a3dc9[_0x1175('0x22')],'include':_0x5a3dc9[_0x1175('0x1f')]?_['map'](_0x5a3dc9['include'],function(_0x5c8ff6){return{'model':db[_0x5c8ff6[_0x1175('0x21')]],'as':_0x5c8ff6['as'],'attributes':_0x5c8ff6[_0x1175('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1175('0xe')](function(_0x5e4ac6){logger['info']('GetZendeskAccount',_0x50e563);logger['debug'](_0x1175('0x23'),_0x50e563,JSON[_0x1175('0x14')](_0x5e4ac6));_0x5eee28(_0x5e4ac6);})[_0x1175('0x18')](function(_0x1e29d0){logger['error']('GetZendeskAccount',_0x1e29d0[_0x1175('0x16')],_0x50e563);_0x8be461(_0x40b685[_0x1175('0x15')](0x1f4,_0x1e29d0['message']));});});};exports['ShowZendeskAccount']=function(_0x5b6bfb){var _0x4234c6=this;return new Promise(function(_0x305939,_0x594f11){return db[_0x1175('0x19')][_0x1175('0x24')]({'raw':_0x5b6bfb[_0x1175('0x1b')]?_0x5b6bfb[_0x1175('0x1b')][_0x1175('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b6bfb[_0x1175('0x1b')]?_0x5b6bfb['options'][_0x1175('0x1d')]||null:null,'attributes':_0x5b6bfb[_0x1175('0x1b')]?_0x5b6bfb[_0x1175('0x1b')][_0x1175('0x22')]||null:null,'include':_0x5b6bfb['options']?_0x5b6bfb[_0x1175('0x1b')]['include']?_[_0x1175('0x20')](_0x5b6bfb[_0x1175('0x1b')][_0x1175('0x1f')],function(_0x3ca650){return{'model':db[_0x3ca650[_0x1175('0x21')]],'as':_0x3ca650['as'],'attributes':_0x3ca650[_0x1175('0x22')],'include':_0x3ca650['include']?_['map'](_0x3ca650['include'],function(_0x106839){return{'model':db[_0x106839[_0x1175('0x21')]],'as':_0x106839['as'],'attributes':_0x106839[_0x1175('0x22')],'include':_0x106839[_0x1175('0x1f')]?_[_0x1175('0x20')](_0x106839[_0x1175('0x1f')],function(_0x50ab22){return{'model':db[_0x50ab22['model']],'as':_0x50ab22['as'],'attributes':_0x50ab22[_0x1175('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1175('0xe')](function(_0x203afa){logger['info'](_0x1175('0x25'),_0x5b6bfb);logger[_0x1175('0x12')](_0x1175('0x25'),_0x5b6bfb,JSON['stringify'](_0x203afa));_0x305939(_0x203afa);})['catch'](function(_0x57650d){logger[_0x1175('0x15')]('ShowZendeskAccount',_0x57650d[_0x1175('0x16')],_0x5b6bfb);_0x594f11(_0x4234c6[_0x1175('0x15')](0x1f4,_0x57650d[_0x1175('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index ed00a0c..3f6beb1 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 _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4de895,_0x1128ad){var _0x43de60=function(_0x3c2b73){while(--_0x3c2b73){_0x4de895['push'](_0x4de895['shift']());}};_0x43de60(++_0x1128ad);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xe5b5[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('0x1b')]=router; \ No newline at end of file +var _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x197385,_0x26bc49){var _0x4db795=function(_0x428fe9){while(--_0x428fe9){_0x197385['push'](_0x197385['shift']());}};_0x4db795(++_0x26bc49);}(_0xea28,0x13a));var _0x8ea2=function(_0x4552b4,_0x1b77c9){_0x4552b4=_0x4552b4-0x0;var _0x5e4527=_0xea28[_0x4552b4];return _0x5e4527;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index ffb083f..769e745 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 _0x77f4=['sequelize','exports','STRING'];(function(_0x32603d,_0x3849a9){var _0x43bfa1=function(_0x110b96){while(--_0x110b96){_0x32603d['push'](_0x32603d['shift']());}};_0x43bfa1(++_0x3849a9);}(_0x77f4,0x1ce));var _0x477f=function(_0x2742bf,_0x594b73){_0x2742bf=_0x2742bf-0x0;var _0x13ffc8=_0x77f4[_0x2742bf];return _0x13ffc8;};'use strict';var Sequelize=require(_0x477f('0x0'));module[_0x477f('0x1')]={'name':{'type':Sequelize[_0x477f('0x2')]},'description':{'type':Sequelize[_0x477f('0x2')]}}; \ No newline at end of file +var _0x3189=['exports','STRING','sequelize'];(function(_0x55dc6f,_0x33b9fa){var _0x110fb1=function(_0x44ebd7){while(--_0x44ebd7){_0x55dc6f['push'](_0x55dc6f['shift']());}};_0x110fb1(++_0x33b9fa);}(_0x3189,0xbc));var _0x9318=function(_0x5f1751,_0x46d689){_0x5f1751=_0x5f1751-0x0;var _0x39672d=_0x3189[_0x5f1751];return _0x39672d;};'use strict';var Sequelize=require(_0x9318('0x0'));module[_0x9318('0x1')]={'name':{'type':Sequelize[_0x9318('0x2')]},'description':{'type':Sequelize[_0x9318('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d92d2d8..d9bef77 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 _0x710b=['end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','send','map','ZendeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','catch','destroy','getFields','ZendeskField','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x542d9d,_0x2fe897){var _0x59c46f=function(_0xfddf2f){while(--_0xfddf2f){_0x542d9d['push'](_0x542d9d['shift']());}};_0x59c46f(++_0x2fe897);}(_0x710b,0x8b));var _0xb710=function(_0x2003ca,_0x327d9b){_0x2003ca=_0x2003ca-0x0;var _0xeaa6c9=_0x710b[_0x2003ca];return _0xeaa6c9;};'use strict';var emlformat=require(_0xb710('0x0'));var rimraf=require(_0xb710('0x1'));var zipdir=require(_0xb710('0x2'));var jsonpatch=require(_0xb710('0x3'));var rp=require(_0xb710('0x4'));var moment=require('moment');var BPromise=require(_0xb710('0x5'));var Mustache=require('mustache');var util=require(_0xb710('0x6'));var path=require(_0xb710('0x7'));var sox=require('sox');var csv=require(_0xb710('0x8'));var ejs=require(_0xb710('0x9'));var fs=require('fs');var fs_extra=require(_0xb710('0xa'));var _=require(_0xb710('0xb'));var squel=require(_0xb710('0xc'));var crypto=require('crypto');var jsforce=require(_0xb710('0xd'));var deskjs=require(_0xb710('0xe'));var toCsv=require(_0xb710('0x8'));var querystring=require(_0xb710('0xf'));var Papa=require(_0xb710('0x10'));var Redis=require(_0xb710('0x11'));var authService=require(_0xb710('0x12'));var qs=require(_0xb710('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb710('0x14'));var logger=require(_0xb710('0x15'))(_0xb710('0x16'));var utils=require('../../config/utils');var config=require(_0xb710('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb710('0x18'))['db'];function respondWithStatusCode(_0x5c55f5,_0x50ef4f){_0x50ef4f=_0x50ef4f||0xcc;return function(_0x31222b){if(_0x31222b){return _0x5c55f5[_0xb710('0x19')](_0x50ef4f);}return _0x5c55f5[_0xb710('0x1a')](_0x50ef4f)[_0xb710('0x1b')]();};}function respondWithResult(_0x4a61ef,_0x319f9d){_0x319f9d=_0x319f9d||0xc8;return function(_0x3953ae){if(_0x3953ae){return _0x4a61ef[_0xb710('0x1a')](_0x319f9d)[_0xb710('0x1c')](_0x3953ae);}};}function respondWithFilteredResult(_0x193afc,_0x264298){return function(_0x469c9b){if(_0x469c9b){var _0x274333=typeof _0x264298[_0xb710('0x1d')]===_0xb710('0x1e')&&typeof _0x264298[_0xb710('0x1f')]===_0xb710('0x1e');var _0x1f87bc=_0x469c9b[_0xb710('0x20')];var _0x336d23=_0x274333?0x0:_0x264298[_0xb710('0x1d')];var _0x202555=_0x274333?_0x469c9b[_0xb710('0x20')]:_0x264298[_0xb710('0x1d')]+_0x264298[_0xb710('0x1f')];var _0xb7e4c2;if(_0x202555>=_0x1f87bc){_0x202555=_0x1f87bc;_0xb7e4c2=0xc8;}else{_0xb7e4c2=0xce;}_0x193afc[_0xb710('0x1a')](_0xb7e4c2);return _0x193afc['set'](_0xb710('0x21'),_0x336d23+'-'+_0x202555+'/'+_0x1f87bc)[_0xb710('0x1c')](_0x469c9b);}return null;};}function patchUpdates(_0x53c22c){return function(_0x4cb9e6){try{jsonpatch[_0xb710('0x22')](_0x4cb9e6,_0x53c22c,!![]);}catch(_0x51f663){return BPromise[_0xb710('0x23')](_0x51f663);}return _0x4cb9e6['save']();};}function saveUpdates(_0x28b320,_0x754b87){return function(_0x32616c){if(_0x32616c){return _0x32616c[_0xb710('0x24')](_0x28b320)[_0xb710('0x25')](function(_0x520bd8){return _0x520bd8;});}return null;};}function removeEntity(_0x2ccd94,_0x4afe12){return function(_0x4de27f){if(_0x4de27f){return _0x4de27f['destroy']()['then'](function(){_0x2ccd94[_0xb710('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1c1c,_0x174ea3){return function(_0x2d378f){if(!_0x2d378f){_0x5b1c1c[_0xb710('0x19')](0x194);}return _0x2d378f;};}function handleError(_0x2368c0,_0x44b97c){_0x44b97c=_0x44b97c||0x1f4;return function(_0x2858d3){logger[_0xb710('0x26')](_0x2858d3['stack']);if(_0x2858d3[_0xb710('0x27')]){delete _0x2858d3[_0xb710('0x27')];}_0x2368c0['status'](_0x44b97c)[_0xb710('0x28')](_0x2858d3);};}exports['index']=function(_0x3881c3,_0x240e25){var _0x48bae={},_0x26c69b={},_0x43c912={'count':0x0,'rows':[]};var _0x8c1638=_[_0xb710('0x29')](db[_0xb710('0x2a')][_0xb710('0x2b')],function(_0x46f44d){return{'name':_0x46f44d['fieldName'],'type':_0x46f44d[_0xb710('0x2c')]['key']};});_0x26c69b[_0xb710('0x2d')]=_[_0xb710('0x29')](_0x8c1638,'name');_0x26c69b[_0xb710('0x2e')]=_[_0xb710('0x2f')](_0x3881c3['query']);_0x26c69b[_0xb710('0x30')]=_[_0xb710('0x31')](_0x26c69b[_0xb710('0x2d')],_0x26c69b[_0xb710('0x2e')]);_0x48bae['attributes']=_['intersection'](_0x26c69b['model'],qs[_0xb710('0x32')](_0x3881c3[_0xb710('0x2e')][_0xb710('0x32')]));_0x48bae[_0xb710('0x33')]=_0x48bae[_0xb710('0x33')][_0xb710('0x34')]?_0x48bae['attributes']:_0x26c69b['model'];if(!_0x3881c3['query'][_0xb710('0x35')](_0xb710('0x36'))){_0x48bae['limit']=qs[_0xb710('0x1f')](_0x3881c3['query'][_0xb710('0x1f')]);_0x48bae[_0xb710('0x1d')]=qs[_0xb710('0x1d')](_0x3881c3[_0xb710('0x2e')][_0xb710('0x1d')]);}_0x48bae[_0xb710('0x37')]=qs[_0xb710('0x38')](_0x3881c3['query'][_0xb710('0x38')]);_0x48bae[_0xb710('0x39')]=qs[_0xb710('0x30')](_[_0xb710('0x3a')](_0x3881c3[_0xb710('0x2e')],_0x26c69b[_0xb710('0x30')]),_0x8c1638);if(_0x3881c3['query'][_0xb710('0x3b')]){_0x48bae[_0xb710('0x39')]=_[_0xb710('0x3c')](_0x48bae['where'],{'$or':_[_0xb710('0x29')](_0x8c1638,function(_0x39e955){if(_0x39e955[_0xb710('0x2c')]!==_0xb710('0x3d')){var _0x5ae416={};_0x5ae416[_0x39e955[_0xb710('0x27')]]={'$like':'%'+_0x3881c3['query']['filter']+'%'};return _0x5ae416;}})});}_0x48bae=_[_0xb710('0x3c')]({},_0x48bae,_0x3881c3[_0xb710('0x3e')]);var _0x4e59ca={'where':_0x48bae['where']};return db[_0xb710('0x2a')][_0xb710('0x20')](_0x4e59ca)[_0xb710('0x25')](function(_0x1328fa){_0x43c912[_0xb710('0x20')]=_0x1328fa;if(_0x3881c3[_0xb710('0x2e')][_0xb710('0x3f')]){_0x48bae['include']=[{'all':!![]}];}return db[_0xb710('0x2a')][_0xb710('0x40')](_0x48bae);})[_0xb710('0x25')](function(_0x103e30){_0x43c912[_0xb710('0x41')]=_0x103e30;return _0x43c912;})[_0xb710('0x25')](respondWithFilteredResult(_0x240e25,_0x48bae))['catch'](handleError(_0x240e25,null));};exports[_0xb710('0x42')]=function(_0x1b7968,_0x58512b){var _0x475caf={'raw':![],'where':{'id':_0x1b7968[_0xb710('0x43')]['id']}},_0x4e4d8d={};_0x4e4d8d['model']=_[_0xb710('0x2f')](db['ZendeskConfiguration'][_0xb710('0x2b')]);_0x4e4d8d[_0xb710('0x2e')]=_[_0xb710('0x2f')](_0x1b7968[_0xb710('0x2e')]);_0x4e4d8d[_0xb710('0x30')]=_[_0xb710('0x31')](_0x4e4d8d[_0xb710('0x2d')],_0x4e4d8d[_0xb710('0x2e')]);_0x475caf[_0xb710('0x33')]=_[_0xb710('0x31')](_0x4e4d8d[_0xb710('0x2d')],qs[_0xb710('0x32')](_0x1b7968[_0xb710('0x2e')][_0xb710('0x32')]));_0x475caf['attributes']=_0x475caf['attributes']['length']?_0x475caf[_0xb710('0x33')]:_0x4e4d8d[_0xb710('0x2d')];if(_0x1b7968[_0xb710('0x2e')][_0xb710('0x3f')]){_0x475caf[_0xb710('0x44')]=[{'all':!![]}];}_0x475caf=_[_0xb710('0x3c')]({},_0x475caf,_0x1b7968['options']);return db[_0xb710('0x2a')][_0xb710('0x45')](_0x475caf)[_0xb710('0x25')](handleEntityNotFound(_0x58512b,null))[_0xb710('0x25')](respondWithResult(_0x58512b,null))['catch'](handleError(_0x58512b,null));};exports['create']=function(_0x5de38e,_0x1adcb6){return db[_0xb710('0x2a')][_0xb710('0x46')](_0x5de38e[_0xb710('0x47')],{})[_0xb710('0x25')](respondWithResult(_0x1adcb6,0xc9))[_0xb710('0x48')](handleError(_0x1adcb6,null));};exports[_0xb710('0x24')]=function(_0x4230df,_0x3c42ce){if(_0x4230df['body']['id']){delete _0x4230df[_0xb710('0x47')]['id'];}return db['ZendeskConfiguration'][_0xb710('0x45')]({'where':{'id':_0x4230df['params']['id']}})[_0xb710('0x25')](handleEntityNotFound(_0x3c42ce,null))['then'](saveUpdates(_0x4230df[_0xb710('0x47')],null))[_0xb710('0x25')](respondWithResult(_0x3c42ce,null))['catch'](handleError(_0x3c42ce,null));};exports[_0xb710('0x49')]=function(_0x363d24,_0x44e7ba){return db[_0xb710('0x2a')][_0xb710('0x45')]({'where':{'id':_0x363d24['params']['id']}})[_0xb710('0x25')](handleEntityNotFound(_0x44e7ba,null))[_0xb710('0x25')](removeEntity(_0x44e7ba,null))[_0xb710('0x48')](handleError(_0x44e7ba,null));};exports[_0xb710('0x4a')]=function(_0x384953,_0x422441,_0x48f334){var _0x29f833={};var _0x1dc791={};var _0x51aeaf;var _0x220cc3;return db[_0xb710('0x2a')]['findOne']({'where':{'id':_0x384953[_0xb710('0x43')]['id']}})[_0xb710('0x25')](handleEntityNotFound(_0x422441,null))[_0xb710('0x25')](function(_0xa86ccf){if(_0xa86ccf){_0x51aeaf=_0xa86ccf;_0x1dc791[_0xb710('0x2d')]=_['keys'](db[_0xb710('0x4b')]['rawAttributes']);_0x1dc791[_0xb710('0x2e')]=_[_0xb710('0x2f')](_0x384953['query']);_0x1dc791[_0xb710('0x30')]=_[_0xb710('0x31')](_0x1dc791[_0xb710('0x2d')],_0x1dc791[_0xb710('0x2e')]);_0x29f833[_0xb710('0x33')]=_['intersection'](_0x1dc791[_0xb710('0x2d')],qs['fields'](_0x384953[_0xb710('0x2e')]['fields']));_0x29f833['attributes']=_0x29f833[_0xb710('0x33')]['length']?_0x29f833[_0xb710('0x33')]:_0x1dc791[_0xb710('0x2d')];_0x29f833[_0xb710('0x37')]=qs[_0xb710('0x38')](_0x384953[_0xb710('0x2e')][_0xb710('0x38')]);_0x29f833[_0xb710('0x39')]=qs[_0xb710('0x30')](_[_0xb710('0x3a')](_0x384953[_0xb710('0x2e')],_0x1dc791[_0xb710('0x30')]));if(_0x384953['query'][_0xb710('0x3b')]){_0x29f833[_0xb710('0x39')]=_[_0xb710('0x3c')](_0x29f833[_0xb710('0x39')],{'$or':_['map'](_0x29f833[_0xb710('0x33')],function(_0x23cc05){var _0x444dfb={};_0x444dfb[_0x23cc05]={'$like':'%'+_0x384953[_0xb710('0x2e')][_0xb710('0x3b')]+'%'};return _0x444dfb;})});}_0x29f833=_[_0xb710('0x3c')]({},_0x29f833,_0x384953[_0xb710('0x3e')]);return _0x51aeaf[_0xb710('0x4a')](_0x29f833);}})[_0xb710('0x25')](function(_0x13eef5){if(_0x13eef5){_0x220cc3=_0x13eef5[_0xb710('0x34')];if(!_0x384953[_0xb710('0x2e')]['hasOwnProperty'](_0xb710('0x36'))){_0x29f833['limit']=qs[_0xb710('0x1f')](_0x384953[_0xb710('0x2e')]['limit']);_0x29f833[_0xb710('0x1d')]=qs[_0xb710('0x1d')](_0x384953['query'][_0xb710('0x1d')]);}return _0x51aeaf[_0xb710('0x4a')](_0x29f833);}})[_0xb710('0x25')](function(_0x1182b0){if(_0x1182b0){return _0x1182b0?{'count':_0x220cc3,'rows':_0x1182b0}:null;}})[_0xb710('0x25')](respondWithResult(_0x422441,null))[_0xb710('0x48')](handleError(_0x422441,null));};exports['getSubjects']=function(_0x2e22b5,_0x3e4a41,_0x3191eb){var _0x507a46={};var _0x1947af={};var _0x18860e;var _0x1063a9;return db[_0xb710('0x2a')][_0xb710('0x4c')]({'where':{'id':_0x2e22b5[_0xb710('0x43')]['id']}})[_0xb710('0x25')](handleEntityNotFound(_0x3e4a41,null))[_0xb710('0x25')](function(_0x16ef7f){if(_0x16ef7f){_0x18860e=_0x16ef7f;_0x1947af[_0xb710('0x2d')]=_[_0xb710('0x2f')](db['ZendeskField'][_0xb710('0x2b')]);_0x1947af[_0xb710('0x2e')]=_[_0xb710('0x2f')](_0x2e22b5[_0xb710('0x2e')]);_0x1947af[_0xb710('0x30')]=_[_0xb710('0x31')](_0x1947af[_0xb710('0x2d')],_0x1947af['query']);_0x507a46[_0xb710('0x33')]=_[_0xb710('0x31')](_0x1947af[_0xb710('0x2d')],qs['fields'](_0x2e22b5[_0xb710('0x2e')]['fields']));_0x507a46['attributes']=_0x507a46['attributes']['length']?_0x507a46[_0xb710('0x33')]:_0x1947af[_0xb710('0x2d')];_0x507a46['order']=qs[_0xb710('0x38')](_0x2e22b5[_0xb710('0x2e')][_0xb710('0x38')]);_0x507a46[_0xb710('0x39')]=qs[_0xb710('0x30')](_[_0xb710('0x3a')](_0x2e22b5[_0xb710('0x2e')],_0x1947af[_0xb710('0x30')]));if(_0x2e22b5['query']['filter']){_0x507a46[_0xb710('0x39')]=_[_0xb710('0x3c')](_0x507a46[_0xb710('0x39')],{'$or':_['map'](_0x507a46['attributes'],function(_0x1e6747){var _0x35ee44={};_0x35ee44[_0x1e6747]={'$like':'%'+_0x2e22b5[_0xb710('0x2e')][_0xb710('0x3b')]+'%'};return _0x35ee44;})});}_0x507a46=_[_0xb710('0x3c')]({},_0x507a46,_0x2e22b5[_0xb710('0x3e')]);return _0x18860e[_0xb710('0x4d')](_0x507a46);}})['then'](function(_0x476f5e){if(_0x476f5e){_0x1063a9=_0x476f5e[_0xb710('0x34')];if(!_0x2e22b5[_0xb710('0x2e')][_0xb710('0x35')]('nolimit')){_0x507a46[_0xb710('0x1f')]=qs[_0xb710('0x1f')](_0x2e22b5[_0xb710('0x2e')][_0xb710('0x1f')]);_0x507a46[_0xb710('0x1d')]=qs[_0xb710('0x1d')](_0x2e22b5['query'][_0xb710('0x1d')]);}return _0x18860e[_0xb710('0x4d')](_0x507a46);}})[_0xb710('0x25')](function(_0x19712d){if(_0x19712d){return _0x19712d?{'count':_0x1063a9,'rows':_0x19712d}:null;}})[_0xb710('0x25')](respondWithResult(_0x3e4a41,null))[_0xb710('0x48')](handleError(_0x3e4a41,null));};exports['getDescriptions']=function(_0x331f68,_0x5675c3,_0xd22b50){var _0x39eb0b={};var _0x25df8b={};var _0x4e0a42;var _0x36a0c5;return db[_0xb710('0x2a')]['findOne']({'where':{'id':_0x331f68[_0xb710('0x43')]['id']}})['then'](handleEntityNotFound(_0x5675c3,null))[_0xb710('0x25')](function(_0x3bdd70){if(_0x3bdd70){_0x4e0a42=_0x3bdd70;_0x25df8b['model']=_['keys'](db[_0xb710('0x4b')][_0xb710('0x2b')]);_0x25df8b[_0xb710('0x2e')]=_['keys'](_0x331f68['query']);_0x25df8b[_0xb710('0x30')]=_[_0xb710('0x31')](_0x25df8b['model'],_0x25df8b[_0xb710('0x2e')]);_0x39eb0b[_0xb710('0x33')]=_[_0xb710('0x31')](_0x25df8b[_0xb710('0x2d')],qs[_0xb710('0x32')](_0x331f68[_0xb710('0x2e')][_0xb710('0x32')]));_0x39eb0b[_0xb710('0x33')]=_0x39eb0b[_0xb710('0x33')]['length']?_0x39eb0b[_0xb710('0x33')]:_0x25df8b[_0xb710('0x2d')];_0x39eb0b['order']=qs[_0xb710('0x38')](_0x331f68['query'][_0xb710('0x38')]);_0x39eb0b['where']=qs[_0xb710('0x30')](_[_0xb710('0x3a')](_0x331f68[_0xb710('0x2e')],_0x25df8b['filters']));if(_0x331f68[_0xb710('0x2e')]['filter']){_0x39eb0b[_0xb710('0x39')]=_[_0xb710('0x3c')](_0x39eb0b[_0xb710('0x39')],{'$or':_[_0xb710('0x29')](_0x39eb0b[_0xb710('0x33')],function(_0x870247){var _0x53b031={};_0x53b031[_0x870247]={'$like':'%'+_0x331f68[_0xb710('0x2e')][_0xb710('0x3b')]+'%'};return _0x53b031;})});}_0x39eb0b=_[_0xb710('0x3c')]({},_0x39eb0b,_0x331f68[_0xb710('0x3e')]);return _0x4e0a42[_0xb710('0x4e')](_0x39eb0b);}})[_0xb710('0x25')](function(_0x46eb27){if(_0x46eb27){_0x36a0c5=_0x46eb27[_0xb710('0x34')];if(!_0x331f68[_0xb710('0x2e')][_0xb710('0x35')](_0xb710('0x36'))){_0x39eb0b[_0xb710('0x1f')]=qs['limit'](_0x331f68[_0xb710('0x2e')]['limit']);_0x39eb0b[_0xb710('0x1d')]=qs['offset'](_0x331f68[_0xb710('0x2e')]['offset']);}return _0x4e0a42['getDescriptions'](_0x39eb0b);}})[_0xb710('0x25')](function(_0x41cb94){if(_0x41cb94){return _0x41cb94?{'count':_0x36a0c5,'rows':_0x41cb94}:null;}})[_0xb710('0x25')](respondWithResult(_0x5675c3,null))[_0xb710('0x48')](handleError(_0x5675c3,null));};exports[_0xb710('0x4f')]=function(_0x4ee5cd,_0x454aa6,_0x26c390){var _0x2aba02={};var _0x2e0419={};var _0x1e8041;var _0x2ff163;return db[_0xb710('0x2a')][_0xb710('0x4c')]({'where':{'id':_0x4ee5cd[_0xb710('0x43')]['id']}})[_0xb710('0x25')](handleEntityNotFound(_0x454aa6,null))[_0xb710('0x25')](function(_0x1dd3d6){if(_0x1dd3d6){_0x1e8041=_0x1dd3d6;_0x2e0419['model']=_[_0xb710('0x2f')](db[_0xb710('0x50')][_0xb710('0x2b')]);_0x2e0419[_0xb710('0x2e')]=_[_0xb710('0x2f')](_0x4ee5cd[_0xb710('0x2e')]);_0x2e0419[_0xb710('0x30')]=_[_0xb710('0x31')](_0x2e0419[_0xb710('0x2d')],_0x2e0419[_0xb710('0x2e')]);_0x2aba02[_0xb710('0x33')]=_[_0xb710('0x31')](_0x2e0419['model'],qs[_0xb710('0x32')](_0x4ee5cd[_0xb710('0x2e')]['fields']));_0x2aba02['attributes']=_0x2aba02['attributes'][_0xb710('0x34')]?_0x2aba02[_0xb710('0x33')]:_0x2e0419[_0xb710('0x2d')];_0x2aba02[_0xb710('0x37')]=qs[_0xb710('0x38')](_0x4ee5cd[_0xb710('0x2e')]['sort']);_0x2aba02[_0xb710('0x39')]=qs[_0xb710('0x30')](_[_0xb710('0x3a')](_0x4ee5cd[_0xb710('0x2e')],_0x2e0419[_0xb710('0x30')]));if(_0x4ee5cd[_0xb710('0x2e')][_0xb710('0x3b')]){_0x2aba02[_0xb710('0x39')]=_['merge'](_0x2aba02[_0xb710('0x39')],{'$or':_[_0xb710('0x29')](_0x2aba02[_0xb710('0x33')],function(_0x52fef9){var _0x514937={};_0x514937[_0x52fef9]={'$like':'%'+_0x4ee5cd[_0xb710('0x2e')][_0xb710('0x3b')]+'%'};return _0x514937;})});}_0x2aba02=_[_0xb710('0x3c')]({},_0x2aba02,_0x4ee5cd[_0xb710('0x3e')]);return _0x1e8041[_0xb710('0x4f')](_0x2aba02);}})[_0xb710('0x25')](function(_0x272397){if(_0x272397){_0x2ff163=_0x272397[_0xb710('0x34')];if(!_0x4ee5cd[_0xb710('0x2e')][_0xb710('0x35')]('nolimit')){_0x2aba02[_0xb710('0x1f')]=qs[_0xb710('0x1f')](_0x4ee5cd['query']['limit']);_0x2aba02[_0xb710('0x1d')]=qs[_0xb710('0x1d')](_0x4ee5cd[_0xb710('0x2e')][_0xb710('0x1d')]);}return _0x1e8041[_0xb710('0x4f')](_0x2aba02);}})[_0xb710('0x25')](function(_0x3d737e){if(_0x3d737e){return _0x3d737e?{'count':_0x2ff163,'rows':_0x3d737e}:null;}})['then'](respondWithResult(_0x454aa6,null))[_0xb710('0x48')](handleError(_0x454aa6,null));};exports['setTags']=function(_0xfac10d,_0x2e622e,_0x5d7bd8){if(_0xfac10d['body']['id']){delete _0xfac10d[_0xb710('0x47')]['id'];}return db[_0xb710('0x2a')]['findOne']({'where':{'id':_0xfac10d[_0xb710('0x43')]['id']}})[_0xb710('0x25')](handleEntityNotFound(_0x2e622e,null))[_0xb710('0x25')](function(_0x5343c5){if(_0x5343c5){return _0x5343c5[_0xb710('0x51')](_0xfac10d['body'][_0xb710('0x52')]||[]);}return null;})['then'](respondWithResult(_0x2e622e,null))[_0xb710('0x48')](handleError(_0x2e622e,null));}; \ No newline at end of file +var _0x3a12=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','setTags','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','error','stack','name','ZendeskConfiguration','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','then'];(function(_0x1f20c8,_0x533951){var _0x168072=function(_0x4f3e26){while(--_0x4f3e26){_0x1f20c8['push'](_0x1f20c8['shift']());}};_0x168072(++_0x533951);}(_0x3a12,0xb7));var _0x23a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a12[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23a1('0x0'));var zipdir=require(_0x23a1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23a1('0x2'));var moment=require(_0x23a1('0x3'));var BPromise=require(_0x23a1('0x4'));var Mustache=require('mustache');var util=require(_0x23a1('0x5'));var path=require(_0x23a1('0x6'));var sox=require(_0x23a1('0x7'));var csv=require(_0x23a1('0x8'));var ejs=require(_0x23a1('0x9'));var fs=require('fs');var fs_extra=require(_0x23a1('0xa'));var _=require('lodash');var squel=require(_0x23a1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23a1('0xc'));var toCsv=require(_0x23a1('0x8'));var querystring=require(_0x23a1('0xd'));var Papa=require(_0x23a1('0xe'));var Redis=require(_0x23a1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x23a1('0x10'));var as=require(_0x23a1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23a1('0x12'))(_0x23a1('0x13'));var utils=require(_0x23a1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x23a1('0x15'));var db=require(_0x23a1('0x16'))['db'];function respondWithStatusCode(_0x589696,_0x41e06c){_0x41e06c=_0x41e06c||0xcc;return function(_0x3ff330){if(_0x3ff330){return _0x589696[_0x23a1('0x17')](_0x41e06c);}return _0x589696['status'](_0x41e06c)[_0x23a1('0x18')]();};}function respondWithResult(_0x1a5cbb,_0x3c1364){_0x3c1364=_0x3c1364||0xc8;return function(_0x498e5b){if(_0x498e5b){return _0x1a5cbb[_0x23a1('0x19')](_0x3c1364)[_0x23a1('0x1a')](_0x498e5b);}};}function respondWithFilteredResult(_0x1bd6ef,_0x1ceab7){return function(_0x4e5584){if(_0x4e5584){var _0x1f8d1c=typeof _0x1ceab7[_0x23a1('0x1b')]===_0x23a1('0x1c')&&typeof _0x1ceab7['limit']==='undefined';var _0x491acd=_0x4e5584[_0x23a1('0x1d')];var _0x2b192b=_0x1f8d1c?0x0:_0x1ceab7[_0x23a1('0x1b')];var _0x48de0d=_0x1f8d1c?_0x4e5584[_0x23a1('0x1d')]:_0x1ceab7[_0x23a1('0x1b')]+_0x1ceab7[_0x23a1('0x1e')];var _0x57ead8;if(_0x48de0d>=_0x491acd){_0x48de0d=_0x491acd;_0x57ead8=0xc8;}else{_0x57ead8=0xce;}_0x1bd6ef['status'](_0x57ead8);return _0x1bd6ef[_0x23a1('0x1f')](_0x23a1('0x20'),_0x2b192b+'-'+_0x48de0d+'/'+_0x491acd)[_0x23a1('0x1a')](_0x4e5584);}return null;};}function patchUpdates(_0x951e38){return function(_0x3b282f){try{jsonpatch[_0x23a1('0x21')](_0x3b282f,_0x951e38,!![]);}catch(_0x5c9699){return BPromise['reject'](_0x5c9699);}return _0x3b282f[_0x23a1('0x22')]();};}function saveUpdates(_0x56fb32,_0x1daa6e){return function(_0x314411){if(_0x314411){return _0x314411['update'](_0x56fb32)['then'](function(_0x2f98f6){return _0x2f98f6;});}return null;};}function removeEntity(_0x1a417b,_0x497069){return function(_0x3e9e8b){if(_0x3e9e8b){return _0x3e9e8b[_0x23a1('0x23')]()['then'](function(){_0x1a417b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dacb0,_0x1faa18){return function(_0x2ce643){if(!_0x2ce643){_0x4dacb0[_0x23a1('0x17')](0x194);}return _0x2ce643;};}function handleError(_0x595be7,_0x450eb7){_0x450eb7=_0x450eb7||0x1f4;return function(_0x1a1ce1){logger[_0x23a1('0x24')](_0x1a1ce1[_0x23a1('0x25')]);if(_0x1a1ce1[_0x23a1('0x26')]){delete _0x1a1ce1[_0x23a1('0x26')];}_0x595be7[_0x23a1('0x19')](_0x450eb7)['send'](_0x1a1ce1);};}exports['index']=function(_0x21a00a,_0x4eb55a){var _0x3bb503={},_0x5d0af8={},_0x53d741={'count':0x0,'rows':[]};var _0x473254=_['map'](db[_0x23a1('0x27')]['rawAttributes'],function(_0x4d89ee){return{'name':_0x4d89ee[_0x23a1('0x28')],'type':_0x4d89ee[_0x23a1('0x29')][_0x23a1('0x2a')]};});_0x5d0af8['model']=_['map'](_0x473254,_0x23a1('0x26'));_0x5d0af8[_0x23a1('0x2b')]=_[_0x23a1('0x2c')](_0x21a00a['query']);_0x5d0af8[_0x23a1('0x2d')]=_['intersection'](_0x5d0af8['model'],_0x5d0af8[_0x23a1('0x2b')]);_0x3bb503[_0x23a1('0x2e')]=_[_0x23a1('0x2f')](_0x5d0af8[_0x23a1('0x30')],qs[_0x23a1('0x31')](_0x21a00a[_0x23a1('0x2b')]['fields']));_0x3bb503[_0x23a1('0x2e')]=_0x3bb503[_0x23a1('0x2e')][_0x23a1('0x32')]?_0x3bb503[_0x23a1('0x2e')]:_0x5d0af8[_0x23a1('0x30')];if(!_0x21a00a[_0x23a1('0x2b')][_0x23a1('0x33')](_0x23a1('0x34'))){_0x3bb503[_0x23a1('0x1e')]=qs[_0x23a1('0x1e')](_0x21a00a[_0x23a1('0x2b')]['limit']);_0x3bb503[_0x23a1('0x1b')]=qs['offset'](_0x21a00a[_0x23a1('0x2b')][_0x23a1('0x1b')]);}_0x3bb503['order']=qs[_0x23a1('0x35')](_0x21a00a[_0x23a1('0x2b')][_0x23a1('0x35')]);_0x3bb503[_0x23a1('0x36')]=qs[_0x23a1('0x2d')](_[_0x23a1('0x37')](_0x21a00a['query'],_0x5d0af8[_0x23a1('0x2d')]),_0x473254);if(_0x21a00a['query'][_0x23a1('0x38')]){_0x3bb503[_0x23a1('0x36')]=_[_0x23a1('0x39')](_0x3bb503[_0x23a1('0x36')],{'$or':_[_0x23a1('0x3a')](_0x473254,function(_0x52b1a4){if(_0x52b1a4[_0x23a1('0x29')]!=='VIRTUAL'){var _0x382c7d={};_0x382c7d[_0x52b1a4[_0x23a1('0x26')]]={'$like':'%'+_0x21a00a[_0x23a1('0x2b')][_0x23a1('0x38')]+'%'};return _0x382c7d;}})});}_0x3bb503=_[_0x23a1('0x39')]({},_0x3bb503,_0x21a00a['options']);var _0x2b64a5={'where':_0x3bb503['where']};return db[_0x23a1('0x27')][_0x23a1('0x1d')](_0x2b64a5)[_0x23a1('0x3b')](function(_0x104dba){_0x53d741[_0x23a1('0x1d')]=_0x104dba;if(_0x21a00a[_0x23a1('0x2b')][_0x23a1('0x3c')]){_0x3bb503[_0x23a1('0x3d')]=[{'all':!![]}];}return db[_0x23a1('0x27')][_0x23a1('0x3e')](_0x3bb503);})[_0x23a1('0x3b')](function(_0x2ef1c7){_0x53d741[_0x23a1('0x3f')]=_0x2ef1c7;return _0x53d741;})[_0x23a1('0x3b')](respondWithFilteredResult(_0x4eb55a,_0x3bb503))[_0x23a1('0x40')](handleError(_0x4eb55a,null));};exports[_0x23a1('0x41')]=function(_0x48a354,_0x1ae5fe){var _0x30eaa4={'raw':![],'where':{'id':_0x48a354[_0x23a1('0x42')]['id']}},_0x2e6da4={};_0x2e6da4[_0x23a1('0x30')]=_['keys'](db['ZendeskConfiguration'][_0x23a1('0x43')]);_0x2e6da4[_0x23a1('0x2b')]=_['keys'](_0x48a354[_0x23a1('0x2b')]);_0x2e6da4['filters']=_['intersection'](_0x2e6da4['model'],_0x2e6da4[_0x23a1('0x2b')]);_0x30eaa4[_0x23a1('0x2e')]=_['intersection'](_0x2e6da4[_0x23a1('0x30')],qs[_0x23a1('0x31')](_0x48a354[_0x23a1('0x2b')][_0x23a1('0x31')]));_0x30eaa4['attributes']=_0x30eaa4[_0x23a1('0x2e')]['length']?_0x30eaa4[_0x23a1('0x2e')]:_0x2e6da4[_0x23a1('0x30')];if(_0x48a354[_0x23a1('0x2b')]['includeAll']){_0x30eaa4[_0x23a1('0x3d')]=[{'all':!![]}];}_0x30eaa4=_[_0x23a1('0x39')]({},_0x30eaa4,_0x48a354[_0x23a1('0x44')]);return db[_0x23a1('0x27')][_0x23a1('0x45')](_0x30eaa4)[_0x23a1('0x3b')](handleEntityNotFound(_0x1ae5fe,null))['then'](respondWithResult(_0x1ae5fe,null))['catch'](handleError(_0x1ae5fe,null));};exports[_0x23a1('0x46')]=function(_0x3f0484,_0x55bb94){return db[_0x23a1('0x27')][_0x23a1('0x46')](_0x3f0484[_0x23a1('0x47')],{})['then'](respondWithResult(_0x55bb94,0xc9))[_0x23a1('0x40')](handleError(_0x55bb94,null));};exports[_0x23a1('0x48')]=function(_0x468a98,_0x550ce9){if(_0x468a98[_0x23a1('0x47')]['id']){delete _0x468a98[_0x23a1('0x47')]['id'];}return db[_0x23a1('0x27')][_0x23a1('0x45')]({'where':{'id':_0x468a98['params']['id']}})[_0x23a1('0x3b')](handleEntityNotFound(_0x550ce9,null))['then'](saveUpdates(_0x468a98['body'],null))[_0x23a1('0x3b')](respondWithResult(_0x550ce9,null))['catch'](handleError(_0x550ce9,null));};exports[_0x23a1('0x23')]=function(_0x614532,_0xefc299){return db['ZendeskConfiguration'][_0x23a1('0x45')]({'where':{'id':_0x614532[_0x23a1('0x42')]['id']}})[_0x23a1('0x3b')](handleEntityNotFound(_0xefc299,null))[_0x23a1('0x3b')](removeEntity(_0xefc299,null))['catch'](handleError(_0xefc299,null));};exports[_0x23a1('0x49')]=function(_0x2e1f57,_0x222d5b,_0x59e03a){var _0x1bf071={};var _0x5c4550={};var _0x39c549;var _0x5e2621;return db[_0x23a1('0x27')][_0x23a1('0x4a')]({'where':{'id':_0x2e1f57['params']['id']}})[_0x23a1('0x3b')](handleEntityNotFound(_0x222d5b,null))['then'](function(_0x29e153){if(_0x29e153){_0x39c549=_0x29e153;_0x5c4550[_0x23a1('0x30')]=_[_0x23a1('0x2c')](db[_0x23a1('0x4b')]['rawAttributes']);_0x5c4550[_0x23a1('0x2b')]=_[_0x23a1('0x2c')](_0x2e1f57['query']);_0x5c4550[_0x23a1('0x2d')]=_[_0x23a1('0x2f')](_0x5c4550['model'],_0x5c4550[_0x23a1('0x2b')]);_0x1bf071[_0x23a1('0x2e')]=_[_0x23a1('0x2f')](_0x5c4550[_0x23a1('0x30')],qs[_0x23a1('0x31')](_0x2e1f57[_0x23a1('0x2b')]['fields']));_0x1bf071[_0x23a1('0x2e')]=_0x1bf071['attributes'][_0x23a1('0x32')]?_0x1bf071['attributes']:_0x5c4550[_0x23a1('0x30')];_0x1bf071[_0x23a1('0x4c')]=qs[_0x23a1('0x35')](_0x2e1f57['query'][_0x23a1('0x35')]);_0x1bf071[_0x23a1('0x36')]=qs[_0x23a1('0x2d')](_[_0x23a1('0x37')](_0x2e1f57['query'],_0x5c4550[_0x23a1('0x2d')]));if(_0x2e1f57['query'][_0x23a1('0x38')]){_0x1bf071[_0x23a1('0x36')]=_[_0x23a1('0x39')](_0x1bf071[_0x23a1('0x36')],{'$or':_['map'](_0x1bf071[_0x23a1('0x2e')],function(_0x194f1e){var _0x3bb5dc={};_0x3bb5dc[_0x194f1e]={'$like':'%'+_0x2e1f57[_0x23a1('0x2b')][_0x23a1('0x38')]+'%'};return _0x3bb5dc;})});}_0x1bf071=_[_0x23a1('0x39')]({},_0x1bf071,_0x2e1f57[_0x23a1('0x44')]);return _0x39c549['getFields'](_0x1bf071);}})[_0x23a1('0x3b')](function(_0x4674f9){if(_0x4674f9){_0x5e2621=_0x4674f9[_0x23a1('0x32')];if(!_0x2e1f57[_0x23a1('0x2b')][_0x23a1('0x33')](_0x23a1('0x34'))){_0x1bf071[_0x23a1('0x1e')]=qs[_0x23a1('0x1e')](_0x2e1f57['query']['limit']);_0x1bf071[_0x23a1('0x1b')]=qs[_0x23a1('0x1b')](_0x2e1f57[_0x23a1('0x2b')]['offset']);}return _0x39c549['getFields'](_0x1bf071);}})[_0x23a1('0x3b')](function(_0x47c8d8){if(_0x47c8d8){return _0x47c8d8?{'count':_0x5e2621,'rows':_0x47c8d8}:null;}})[_0x23a1('0x3b')](respondWithResult(_0x222d5b,null))[_0x23a1('0x40')](handleError(_0x222d5b,null));};exports[_0x23a1('0x4d')]=function(_0x32b847,_0x3de816,_0x4900c2){var _0x48348b={};var _0x376c71={};var _0x45391f;var _0x5c1294;return db[_0x23a1('0x27')][_0x23a1('0x4a')]({'where':{'id':_0x32b847[_0x23a1('0x42')]['id']}})[_0x23a1('0x3b')](handleEntityNotFound(_0x3de816,null))[_0x23a1('0x3b')](function(_0x30fe2b){if(_0x30fe2b){_0x45391f=_0x30fe2b;_0x376c71[_0x23a1('0x30')]=_[_0x23a1('0x2c')](db['ZendeskField']['rawAttributes']);_0x376c71[_0x23a1('0x2b')]=_[_0x23a1('0x2c')](_0x32b847[_0x23a1('0x2b')]);_0x376c71['filters']=_['intersection'](_0x376c71[_0x23a1('0x30')],_0x376c71[_0x23a1('0x2b')]);_0x48348b['attributes']=_[_0x23a1('0x2f')](_0x376c71[_0x23a1('0x30')],qs[_0x23a1('0x31')](_0x32b847[_0x23a1('0x2b')][_0x23a1('0x31')]));_0x48348b[_0x23a1('0x2e')]=_0x48348b[_0x23a1('0x2e')]['length']?_0x48348b['attributes']:_0x376c71[_0x23a1('0x30')];_0x48348b[_0x23a1('0x4c')]=qs[_0x23a1('0x35')](_0x32b847['query'][_0x23a1('0x35')]);_0x48348b[_0x23a1('0x36')]=qs[_0x23a1('0x2d')](_[_0x23a1('0x37')](_0x32b847[_0x23a1('0x2b')],_0x376c71['filters']));if(_0x32b847[_0x23a1('0x2b')][_0x23a1('0x38')]){_0x48348b[_0x23a1('0x36')]=_[_0x23a1('0x39')](_0x48348b['where'],{'$or':_[_0x23a1('0x3a')](_0x48348b[_0x23a1('0x2e')],function(_0x77c35a){var _0x4543e1={};_0x4543e1[_0x77c35a]={'$like':'%'+_0x32b847[_0x23a1('0x2b')][_0x23a1('0x38')]+'%'};return _0x4543e1;})});}_0x48348b=_[_0x23a1('0x39')]({},_0x48348b,_0x32b847[_0x23a1('0x44')]);return _0x45391f[_0x23a1('0x4d')](_0x48348b);}})[_0x23a1('0x3b')](function(_0x1ab9b2){if(_0x1ab9b2){_0x5c1294=_0x1ab9b2[_0x23a1('0x32')];if(!_0x32b847[_0x23a1('0x2b')]['hasOwnProperty'](_0x23a1('0x34'))){_0x48348b[_0x23a1('0x1e')]=qs[_0x23a1('0x1e')](_0x32b847['query'][_0x23a1('0x1e')]);_0x48348b['offset']=qs[_0x23a1('0x1b')](_0x32b847[_0x23a1('0x2b')]['offset']);}return _0x45391f[_0x23a1('0x4d')](_0x48348b);}})[_0x23a1('0x3b')](function(_0x3cd507){if(_0x3cd507){return _0x3cd507?{'count':_0x5c1294,'rows':_0x3cd507}:null;}})['then'](respondWithResult(_0x3de816,null))[_0x23a1('0x40')](handleError(_0x3de816,null));};exports[_0x23a1('0x4e')]=function(_0x5c6ac1,_0x400a36,_0x1e5a2c){var _0xfcc7b0={};var _0x5e2cca={};var _0x21222b;var _0x20c5cc;return db[_0x23a1('0x27')][_0x23a1('0x4a')]({'where':{'id':_0x5c6ac1[_0x23a1('0x42')]['id']}})[_0x23a1('0x3b')](handleEntityNotFound(_0x400a36,null))[_0x23a1('0x3b')](function(_0xba880a){if(_0xba880a){_0x21222b=_0xba880a;_0x5e2cca['model']=_['keys'](db[_0x23a1('0x4b')][_0x23a1('0x43')]);_0x5e2cca[_0x23a1('0x2b')]=_['keys'](_0x5c6ac1[_0x23a1('0x2b')]);_0x5e2cca[_0x23a1('0x2d')]=_[_0x23a1('0x2f')](_0x5e2cca[_0x23a1('0x30')],_0x5e2cca[_0x23a1('0x2b')]);_0xfcc7b0['attributes']=_[_0x23a1('0x2f')](_0x5e2cca[_0x23a1('0x30')],qs[_0x23a1('0x31')](_0x5c6ac1['query']['fields']));_0xfcc7b0['attributes']=_0xfcc7b0[_0x23a1('0x2e')][_0x23a1('0x32')]?_0xfcc7b0[_0x23a1('0x2e')]:_0x5e2cca[_0x23a1('0x30')];_0xfcc7b0['order']=qs[_0x23a1('0x35')](_0x5c6ac1[_0x23a1('0x2b')][_0x23a1('0x35')]);_0xfcc7b0[_0x23a1('0x36')]=qs[_0x23a1('0x2d')](_['pick'](_0x5c6ac1[_0x23a1('0x2b')],_0x5e2cca[_0x23a1('0x2d')]));if(_0x5c6ac1['query'][_0x23a1('0x38')]){_0xfcc7b0[_0x23a1('0x36')]=_['merge'](_0xfcc7b0['where'],{'$or':_[_0x23a1('0x3a')](_0xfcc7b0[_0x23a1('0x2e')],function(_0x189d74){var _0x28b8ed={};_0x28b8ed[_0x189d74]={'$like':'%'+_0x5c6ac1[_0x23a1('0x2b')][_0x23a1('0x38')]+'%'};return _0x28b8ed;})});}_0xfcc7b0=_[_0x23a1('0x39')]({},_0xfcc7b0,_0x5c6ac1[_0x23a1('0x44')]);return _0x21222b[_0x23a1('0x4e')](_0xfcc7b0);}})[_0x23a1('0x3b')](function(_0x1caf19){if(_0x1caf19){_0x20c5cc=_0x1caf19[_0x23a1('0x32')];if(!_0x5c6ac1['query'][_0x23a1('0x33')]('nolimit')){_0xfcc7b0['limit']=qs['limit'](_0x5c6ac1[_0x23a1('0x2b')][_0x23a1('0x1e')]);_0xfcc7b0['offset']=qs['offset'](_0x5c6ac1[_0x23a1('0x2b')][_0x23a1('0x1b')]);}return _0x21222b[_0x23a1('0x4e')](_0xfcc7b0);}})[_0x23a1('0x3b')](function(_0x3439b6){if(_0x3439b6){return _0x3439b6?{'count':_0x20c5cc,'rows':_0x3439b6}:null;}})[_0x23a1('0x3b')](respondWithResult(_0x400a36,null))[_0x23a1('0x40')](handleError(_0x400a36,null));};exports[_0x23a1('0x4f')]=function(_0x2ac089,_0x535f22,_0x3f348e){var _0xa2239d={};var _0x1a2d12={};var _0x79927d;var _0x3affa1;return db['ZendeskConfiguration'][_0x23a1('0x4a')]({'where':{'id':_0x2ac089[_0x23a1('0x42')]['id']}})[_0x23a1('0x3b')](handleEntityNotFound(_0x535f22,null))['then'](function(_0x1ef3a9){if(_0x1ef3a9){_0x79927d=_0x1ef3a9;_0x1a2d12[_0x23a1('0x30')]=_[_0x23a1('0x2c')](db['Tag']['rawAttributes']);_0x1a2d12[_0x23a1('0x2b')]=_[_0x23a1('0x2c')](_0x2ac089[_0x23a1('0x2b')]);_0x1a2d12[_0x23a1('0x2d')]=_[_0x23a1('0x2f')](_0x1a2d12[_0x23a1('0x30')],_0x1a2d12[_0x23a1('0x2b')]);_0xa2239d[_0x23a1('0x2e')]=_[_0x23a1('0x2f')](_0x1a2d12[_0x23a1('0x30')],qs[_0x23a1('0x31')](_0x2ac089[_0x23a1('0x2b')][_0x23a1('0x31')]));_0xa2239d[_0x23a1('0x2e')]=_0xa2239d[_0x23a1('0x2e')]['length']?_0xa2239d['attributes']:_0x1a2d12[_0x23a1('0x30')];_0xa2239d[_0x23a1('0x4c')]=qs[_0x23a1('0x35')](_0x2ac089[_0x23a1('0x2b')][_0x23a1('0x35')]);_0xa2239d[_0x23a1('0x36')]=qs['filters'](_[_0x23a1('0x37')](_0x2ac089[_0x23a1('0x2b')],_0x1a2d12[_0x23a1('0x2d')]));if(_0x2ac089[_0x23a1('0x2b')][_0x23a1('0x38')]){_0xa2239d[_0x23a1('0x36')]=_[_0x23a1('0x39')](_0xa2239d[_0x23a1('0x36')],{'$or':_[_0x23a1('0x3a')](_0xa2239d[_0x23a1('0x2e')],function(_0x142b8d){var _0x332645={};_0x332645[_0x142b8d]={'$like':'%'+_0x2ac089['query']['filter']+'%'};return _0x332645;})});}_0xa2239d=_['merge']({},_0xa2239d,_0x2ac089[_0x23a1('0x44')]);return _0x79927d[_0x23a1('0x4f')](_0xa2239d);}})['then'](function(_0x360848){if(_0x360848){_0x3affa1=_0x360848[_0x23a1('0x32')];if(!_0x2ac089[_0x23a1('0x2b')][_0x23a1('0x33')](_0x23a1('0x34'))){_0xa2239d[_0x23a1('0x1e')]=qs[_0x23a1('0x1e')](_0x2ac089[_0x23a1('0x2b')][_0x23a1('0x1e')]);_0xa2239d[_0x23a1('0x1b')]=qs[_0x23a1('0x1b')](_0x2ac089['query']['offset']);}return _0x79927d['getTags'](_0xa2239d);}})[_0x23a1('0x3b')](function(_0x21f822){if(_0x21f822){return _0x21f822?{'count':_0x3affa1,'rows':_0x21f822}:null;}})['then'](respondWithResult(_0x535f22,null))[_0x23a1('0x40')](handleError(_0x535f22,null));};exports[_0x23a1('0x50')]=function(_0x67ab3,_0x571ed3,_0x1b1d9a){if(_0x67ab3[_0x23a1('0x47')]['id']){delete _0x67ab3['body']['id'];}return db[_0x23a1('0x27')][_0x23a1('0x4a')]({'where':{'id':_0x67ab3[_0x23a1('0x42')]['id']}})[_0x23a1('0x3b')](handleEntityNotFound(_0x571ed3,null))[_0x23a1('0x3b')](function(_0x5a6db0){if(_0x5a6db0){return _0x5a6db0[_0x23a1('0x50')](_0x67ab3[_0x23a1('0x47')]['ids']||[]);}return null;})[_0x23a1('0x3b')](respondWithResult(_0x571ed3,null))[_0x23a1('0x40')](handleError(_0x571ed3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 982ae34..6c9087f 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 _0xb03e=['int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x5bd4fc,_0x4fbd8c){var _0x14b56e=function(_0x361e5c){while(--_0x361e5c){_0x5bd4fc['push'](_0x5bd4fc['shift']());}};_0x14b56e(++_0x4fbd8c);}(_0xb03e,0x1eb));var _0xeb03=function(_0x38c313,_0x1424b7){_0x38c313=_0x38c313-0x0;var _0x325397=_0xb03e[_0x38c313];return _0x325397;};'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 +var _0xa5fa=['exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x175ea7,_0x37a68e){var _0x4b1437=function(_0x574aeb){while(--_0x574aeb){_0x175ea7['push'](_0x175ea7['shift']());}};_0x4b1437(++_0x37a68e);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x37e6a2,_0x58a3e4){_0x37e6a2=_0x37e6a2-0x0;var _0x4c2938=_0xa5fa[_0x37e6a2];return _0x4c2938;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var logger=require(_0xaa5f('0x1'))(_0xaa5f('0x2'));var moment=require(_0xaa5f('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa5f('0x4'));var fs=require('fs');var path=require(_0xaa5f('0x5'));var rimraf=require('rimraf');var config=require(_0xaa5f('0x6'));var attributes=require(_0xaa5f('0x7'));module[_0xaa5f('0x8')]=function(_0x20744d,_0x3d1489){return _0x20744d[_0xaa5f('0x9')](_0xaa5f('0xa'),attributes,{'tableName':_0xaa5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index e56a151..16ec840 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 _0x8834=['http','then','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','ZendeskConfiguration,\x20%s,\x20%s','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x28cbea,_0x59442e){var _0x174d6b=function(_0x2ccaf3){while(--_0x2ccaf3){_0x28cbea['push'](_0x28cbea['shift']());}};_0x174d6b(++_0x59442e);}(_0x8834,0x12a));var _0x4883=function(_0x128be,_0x547569){_0x128be=_0x128be-0x0;var _0x319af3=_0x8834[_0x128be];return _0x319af3;};'use strict';var _=require(_0x4883('0x0'));var util=require(_0x4883('0x1'));var moment=require('moment');var BPromise=require(_0x4883('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4883('0x3'));var db=require(_0x4883('0x4'))['db'];var utils=require(_0x4883('0x5'));var logger=require(_0x4883('0x6'))(_0x4883('0x7'));var config=require('../../config/environment');var jayson=require(_0x4883('0x8'));var client=jayson[_0x4883('0x9')][_0x4883('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27531c,_0x286e25,_0x5a9db0){return new BPromise(function(_0xe9f69f,_0x44b9e1){return client['request'](_0x27531c,_0x5a9db0)[_0x4883('0xb')](function(_0x21871f){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x286e25,'request\x20sent');logger[_0x4883('0xc')](_0x4883('0xd'),_0x286e25,_0x4883('0xe'),JSON[_0x4883('0xf')](_0x21871f));if(_0x21871f[_0x4883('0x10')]){if(_0x21871f[_0x4883('0x10')][_0x4883('0x11')]===0x1f4){logger[_0x4883('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x286e25,_0x21871f[_0x4883('0x10')][_0x4883('0x12')]);return _0x44b9e1(_0x21871f['error'][_0x4883('0x12')]);}logger[_0x4883('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x286e25,_0x21871f['error'][_0x4883('0x12')]);return _0xe9f69f(_0x21871f[_0x4883('0x10')][_0x4883('0x12')]);}else{logger[_0x4883('0x13')](_0x4883('0x14'),_0x286e25,_0x4883('0xe'));_0xe9f69f(_0x21871f[_0x4883('0x15')][_0x4883('0x12')]);}})['catch'](function(_0x5822b2){logger[_0x4883('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x286e25,_0x5822b2);_0x44b9e1(_0x5822b2);});});} \ No newline at end of file +var _0xf849=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x544aa4,_0x591c48){var _0xfde89e=function(_0x3abccd){while(--_0x3abccd){_0x544aa4['push'](_0x544aa4['shift']());}};_0xfde89e(++_0x591c48);}(_0xf849,0x14c));var _0x9f84=function(_0x29bef7,_0x5127f0){_0x29bef7=_0x29bef7-0x0;var _0x1ba0c1=_0xf849[_0x29bef7];return _0x1ba0c1;};'use strict';var _=require(_0x9f84('0x0'));var util=require('util');var moment=require(_0x9f84('0x1'));var BPromise=require(_0x9f84('0x2'));var rs=require(_0x9f84('0x3'));var fs=require('fs');var Redis=require(_0x9f84('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f84('0x5'));var logger=require(_0x9f84('0x6'))(_0x9f84('0x7'));var config=require(_0x9f84('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9f84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x134376,_0x33b7ce,_0x4eb4fc){return new BPromise(function(_0x27d62a,_0x1b02ad){return client['request'](_0x134376,_0x4eb4fc)[_0x9f84('0xa')](function(_0x20fd17){logger[_0x9f84('0xb')](_0x9f84('0xc'),_0x33b7ce,_0x9f84('0xd'));logger['debug'](_0x9f84('0xe'),_0x33b7ce,'request\x20sent',JSON['stringify'](_0x20fd17));if(_0x20fd17[_0x9f84('0xf')]){if(_0x20fd17[_0x9f84('0xf')]['code']===0x1f4){logger[_0x9f84('0xf')](_0x9f84('0xc'),_0x33b7ce,_0x20fd17['error'][_0x9f84('0x10')]);return _0x1b02ad(_0x20fd17['error'][_0x9f84('0x10')]);}logger[_0x9f84('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x33b7ce,_0x20fd17[_0x9f84('0xf')]['message']);return _0x27d62a(_0x20fd17[_0x9f84('0xf')][_0x9f84('0x10')]);}else{logger[_0x9f84('0xb')](_0x9f84('0xc'),_0x33b7ce,'request\x20sent');_0x27d62a(_0x20fd17[_0x9f84('0x11')][_0x9f84('0x10')]);}})[_0x9f84('0x12')](function(_0x4b21ed){logger[_0x9f84('0xf')](_0x9f84('0xc'),_0x33b7ce,_0x4b21ed);_0x1b02ad(_0x4b21ed);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index fc21c18..96a421f 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 _0xf82f=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show','create','put','update','delete','exports','multer','util','path'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0xf82f,0x8d));var _0xff82=function(_0x47927b,_0x374f23){_0x47927b=_0x47927b-0x0;var _0x5dc8d1=_0xf82f[_0x47927b];return _0x5dc8d1;};'use strict';var multer=require(_0xff82('0x0'));var util=require(_0xff82('0x1'));var path=require(_0xff82('0x2'));var timeout=require(_0xff82('0x3'));var express=require(_0xff82('0x4'));var router=express['Router']();var fs_extra=require(_0xff82('0x5'));var auth=require(_0xff82('0x6'));var interaction=require(_0xff82('0x7'));var config=require(_0xff82('0x8'));var controller=require(_0xff82('0x9'));router[_0xff82('0xa')]('/',auth[_0xff82('0xb')](),controller['index']);router['get']('/:id',auth[_0xff82('0xb')](),controller[_0xff82('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff82('0xd')]);router[_0xff82('0xe')]('/:id',auth[_0xff82('0xb')](),controller[_0xff82('0xf')]);router[_0xff82('0x10')]('/:id',auth[_0xff82('0xb')](),controller['destroy']);module[_0xff82('0x11')]=router; \ No newline at end of file +var _0x7fb3=['/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','update','delete'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7fb3,0x66));var _0x37fb=function(_0x3382e5,_0x4bfaa8){_0x3382e5=_0x3382e5-0x0;var _0x5efe1a=_0x7fb3[_0x3382e5];return _0x5efe1a;};'use strict';var multer=require(_0x37fb('0x0'));var util=require(_0x37fb('0x1'));var path=require(_0x37fb('0x2'));var timeout=require(_0x37fb('0x3'));var express=require(_0x37fb('0x4'));var router=express[_0x37fb('0x5')]();var fs_extra=require(_0x37fb('0x6'));var auth=require(_0x37fb('0x7'));var interaction=require(_0x37fb('0x8'));var config=require(_0x37fb('0x9'));var controller=require('./intZendeskField.controller');router[_0x37fb('0xa')]('/',auth[_0x37fb('0xb')](),controller[_0x37fb('0xc')]);router[_0x37fb('0xa')]('/:id',auth[_0x37fb('0xb')](),controller[_0x37fb('0xd')]);router[_0x37fb('0xe')]('/',auth[_0x37fb('0xb')](),controller[_0x37fb('0xf')]);router['put']('/:id',auth[_0x37fb('0xb')](),controller[_0x37fb('0x10')]);router[_0x37fb('0x11')](_0x37fb('0x12'),auth['isAuthenticated'](),controller[_0x37fb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 17b814f..9d1d0a4 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 _0xe723=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3a213b,_0x29fdac){var _0x3898ac=function(_0x422588){while(--_0x422588){_0x3a213b['push'](_0x3a213b['shift']());}};_0x3898ac(++_0x29fdac);}(_0xe723,0x111));var _0x3e72=function(_0x3ec2e1,_0x5d8f00){_0x3ec2e1=_0x3ec2e1-0x0;var _0x10ae56=_0xe723[_0x3ec2e1];return _0x10ae56;};'use strict';var Sequelize=require(_0x3e72('0x0'));module[_0x3e72('0x1')]={'type':{'type':Sequelize[_0x3e72('0x2')](_0x3e72('0x3'),_0x3e72('0x4'),_0x3e72('0x5'),_0x3e72('0x6'),_0x3e72('0x7')),'defaultValue':_0x3e72('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3e72('0x8')]},'keyType':{'type':Sequelize[_0x3e72('0x2')](_0x3e72('0x3'),_0x3e72('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x3e72('0x8')]},'idField':{'type':Sequelize[_0x3e72('0x8')]},'nameField':{'type':Sequelize[_0x3e72('0x8')]},'customField':{'type':Sequelize[_0x3e72('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda13=['STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x24c15f,_0x638804){var _0x2c05e6=function(_0x2c5c3e){while(--_0x2c5c3e){_0x24c15f['push'](_0x24c15f['shift']());}};_0x2c05e6(++_0x638804);}(_0xda13,0x14a));var _0x3da1=function(_0x59481b,_0x4c7624){_0x59481b=_0x59481b-0x0;var _0x55e559=_0xda13[_0x59481b];return _0x55e559;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3da1('0x0')](_0x3da1('0x1'),_0x3da1('0x2'),_0x3da1('0x3'),_0x3da1('0x4'),_0x3da1('0x5')),'defaultValue':_0x3da1('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3da1('0x6')]},'keyType':{'type':Sequelize[_0x3da1('0x0')](_0x3da1('0x1'),_0x3da1('0x2'),_0x3da1('0x3'))},'keyContent':{'type':Sequelize[_0x3da1('0x6')]},'idField':{'type':Sequelize[_0x3da1('0x6')]},'nameField':{'type':Sequelize[_0x3da1('0x6')]},'customField':{'type':Sequelize[_0x3da1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3da1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index cd49f5a..cfbe065 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 _0x33e1=['attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','keys','intersection','fields'];(function(_0x5c2970,_0x435383){var _0x3f6d7a=function(_0xb438c1){while(--_0xb438c1){_0x5c2970['push'](_0x5c2970['shift']());}};_0x3f6d7a(++_0x435383);}(_0x33e1,0x142));var _0x133e=function(_0x5a8a7a,_0x2a385d){_0x5a8a7a=_0x5a8a7a-0x0;var _0x422f42=_0x33e1[_0x5a8a7a];return _0x422f42;};'use strict';var emlformat=require(_0x133e('0x0'));var rimraf=require(_0x133e('0x1'));var zipdir=require(_0x133e('0x2'));var jsonpatch=require(_0x133e('0x3'));var rp=require(_0x133e('0x4'));var moment=require('moment');var BPromise=require(_0x133e('0x5'));var Mustache=require(_0x133e('0x6'));var util=require(_0x133e('0x7'));var path=require(_0x133e('0x8'));var sox=require(_0x133e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x133e('0xa'));var squel=require(_0x133e('0xb'));var crypto=require(_0x133e('0xc'));var jsforce=require(_0x133e('0xd'));var deskjs=require(_0x133e('0xe'));var toCsv=require(_0x133e('0xf'));var querystring=require(_0x133e('0x10'));var Papa=require(_0x133e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x133e('0x12'));var logger=require(_0x133e('0x13'))(_0x133e('0x14'));var utils=require(_0x133e('0x15'));var config=require(_0x133e('0x16'));var licenseUtil=require(_0x133e('0x17'));var db=require(_0x133e('0x18'))['db'];function respondWithStatusCode(_0x2192f0,_0x256005){_0x256005=_0x256005||0xcc;return function(_0x12714d){if(_0x12714d){return _0x2192f0['sendStatus'](_0x256005);}return _0x2192f0[_0x133e('0x19')](_0x256005)[_0x133e('0x1a')]();};}function respondWithResult(_0x37bd40,_0x227a1f){_0x227a1f=_0x227a1f||0xc8;return function(_0x1fd2d8){if(_0x1fd2d8){return _0x37bd40[_0x133e('0x19')](_0x227a1f)['json'](_0x1fd2d8);}};}function respondWithFilteredResult(_0x4e1547,_0x3bbb5f){return function(_0x5722ed){if(_0x5722ed){var _0xd593e4=typeof _0x3bbb5f['offset']===_0x133e('0x1b')&&typeof _0x3bbb5f['limit']==='undefined';var _0x4aca5f=_0x5722ed[_0x133e('0x1c')];var _0x276902=_0xd593e4?0x0:_0x3bbb5f[_0x133e('0x1d')];var _0x5aeafa=_0xd593e4?_0x5722ed[_0x133e('0x1c')]:_0x3bbb5f[_0x133e('0x1d')]+_0x3bbb5f[_0x133e('0x1e')];var _0x1832a1;if(_0x5aeafa>=_0x4aca5f){_0x5aeafa=_0x4aca5f;_0x1832a1=0xc8;}else{_0x1832a1=0xce;}_0x4e1547[_0x133e('0x19')](_0x1832a1);return _0x4e1547[_0x133e('0x1f')](_0x133e('0x20'),_0x276902+'-'+_0x5aeafa+'/'+_0x4aca5f)['json'](_0x5722ed);}return null;};}function patchUpdates(_0x16073d){return function(_0xf4d9f9){try{jsonpatch[_0x133e('0x21')](_0xf4d9f9,_0x16073d,!![]);}catch(_0x2ce1d9){return BPromise[_0x133e('0x22')](_0x2ce1d9);}return _0xf4d9f9[_0x133e('0x23')]();};}function saveUpdates(_0x49ddb0,_0x1cda65){return function(_0x185033){if(_0x185033){return _0x185033[_0x133e('0x24')](_0x49ddb0)[_0x133e('0x25')](function(_0x52f229){return _0x52f229;});}return null;};}function removeEntity(_0x1948d3,_0x39fb43){return function(_0x5f3f50){if(_0x5f3f50){return _0x5f3f50[_0x133e('0x26')]()[_0x133e('0x25')](function(){_0x1948d3[_0x133e('0x19')](0xcc)[_0x133e('0x1a')]();});}};}function handleEntityNotFound(_0x4431f3,_0x3a2ce6){return function(_0x34e802){if(!_0x34e802){_0x4431f3['sendStatus'](0x194);}return _0x34e802;};}function handleError(_0x43a283,_0x3d9107){_0x3d9107=_0x3d9107||0x1f4;return function(_0x7b5d55){logger['error'](_0x7b5d55[_0x133e('0x27')]);if(_0x7b5d55[_0x133e('0x28')]){delete _0x7b5d55[_0x133e('0x28')];}_0x43a283[_0x133e('0x19')](_0x3d9107)[_0x133e('0x29')](_0x7b5d55);};}exports[_0x133e('0x2a')]=function(_0x241029,_0x46462a){var _0xe420fa={},_0x279970={},_0x440777={'count':0x0,'rows':[]};var _0x448940=_[_0x133e('0x2b')](db[_0x133e('0x2c')][_0x133e('0x2d')],function(_0x4a14fd){return{'name':_0x4a14fd['fieldName'],'type':_0x4a14fd[_0x133e('0x2e')][_0x133e('0x2f')]};});_0x279970[_0x133e('0x30')]=_[_0x133e('0x2b')](_0x448940,_0x133e('0x28'));_0x279970[_0x133e('0x31')]=_[_0x133e('0x32')](_0x241029[_0x133e('0x31')]);_0x279970['filters']=_[_0x133e('0x33')](_0x279970['model'],_0x279970[_0x133e('0x31')]);_0xe420fa['attributes']=_[_0x133e('0x33')](_0x279970['model'],qs[_0x133e('0x34')](_0x241029[_0x133e('0x31')][_0x133e('0x34')]));_0xe420fa[_0x133e('0x35')]=_0xe420fa['attributes']['length']?_0xe420fa[_0x133e('0x35')]:_0x279970['model'];if(!_0x241029['query'][_0x133e('0x36')](_0x133e('0x37'))){_0xe420fa[_0x133e('0x1e')]=qs[_0x133e('0x1e')](_0x241029['query'][_0x133e('0x1e')]);_0xe420fa[_0x133e('0x1d')]=qs[_0x133e('0x1d')](_0x241029[_0x133e('0x31')][_0x133e('0x1d')]);}_0xe420fa[_0x133e('0x38')]=qs[_0x133e('0x39')](_0x241029[_0x133e('0x31')]['sort']);_0xe420fa[_0x133e('0x3a')]=qs[_0x133e('0x3b')](_[_0x133e('0x3c')](_0x241029[_0x133e('0x31')],_0x279970['filters']),_0x448940);if(_0x241029['query'][_0x133e('0x3d')]){_0xe420fa[_0x133e('0x3a')]=_[_0x133e('0x3e')](_0xe420fa[_0x133e('0x3a')],{'$or':_[_0x133e('0x2b')](_0x448940,function(_0x15772e){if(_0x15772e[_0x133e('0x2e')]!==_0x133e('0x3f')){var _0x4699df={};_0x4699df[_0x15772e[_0x133e('0x28')]]={'$like':'%'+_0x241029[_0x133e('0x31')][_0x133e('0x3d')]+'%'};return _0x4699df;}})});}_0xe420fa=_[_0x133e('0x3e')]({},_0xe420fa,_0x241029[_0x133e('0x40')]);var _0x1e28e9={'where':_0xe420fa[_0x133e('0x3a')]};return db[_0x133e('0x2c')][_0x133e('0x1c')](_0x1e28e9)[_0x133e('0x25')](function(_0xca1b4){_0x440777[_0x133e('0x1c')]=_0xca1b4;if(_0x241029['query']['includeAll']){_0xe420fa[_0x133e('0x41')]=[{'all':!![]}];}return db[_0x133e('0x2c')][_0x133e('0x42')](_0xe420fa);})['then'](function(_0x36c66b){_0x440777[_0x133e('0x43')]=_0x36c66b;return _0x440777;})[_0x133e('0x25')](respondWithFilteredResult(_0x46462a,_0xe420fa))[_0x133e('0x44')](handleError(_0x46462a,null));};exports[_0x133e('0x45')]=function(_0x328ae9,_0x515369){var _0x185c7f={'raw':!![],'where':{'id':_0x328ae9[_0x133e('0x46')]['id']}},_0x46a6f3={};_0x46a6f3[_0x133e('0x30')]=_[_0x133e('0x32')](db[_0x133e('0x2c')][_0x133e('0x2d')]);_0x46a6f3[_0x133e('0x31')]=_[_0x133e('0x32')](_0x328ae9[_0x133e('0x31')]);_0x46a6f3[_0x133e('0x3b')]=_[_0x133e('0x33')](_0x46a6f3[_0x133e('0x30')],_0x46a6f3[_0x133e('0x31')]);_0x185c7f[_0x133e('0x35')]=_[_0x133e('0x33')](_0x46a6f3[_0x133e('0x30')],qs[_0x133e('0x34')](_0x328ae9[_0x133e('0x31')][_0x133e('0x34')]));_0x185c7f[_0x133e('0x35')]=_0x185c7f[_0x133e('0x35')][_0x133e('0x47')]?_0x185c7f[_0x133e('0x35')]:_0x46a6f3[_0x133e('0x30')];if(_0x328ae9[_0x133e('0x31')]['includeAll']){_0x185c7f[_0x133e('0x41')]=[{'all':!![]}];}_0x185c7f=_[_0x133e('0x3e')]({},_0x185c7f,_0x328ae9[_0x133e('0x40')]);return db[_0x133e('0x2c')][_0x133e('0x48')](_0x185c7f)['then'](handleEntityNotFound(_0x515369,null))[_0x133e('0x25')](respondWithResult(_0x515369,null))[_0x133e('0x44')](handleError(_0x515369,null));};exports['create']=function(_0x300d1c,_0x4168b1){return db['ZendeskField'][_0x133e('0x49')](_0x300d1c[_0x133e('0x4a')],{})[_0x133e('0x25')](respondWithResult(_0x4168b1,0xc9))[_0x133e('0x44')](handleError(_0x4168b1,null));};exports['update']=function(_0x3d091f,_0x4cb5f8){if(_0x3d091f[_0x133e('0x4a')]['id']){delete _0x3d091f['body']['id'];}return db[_0x133e('0x2c')]['find']({'where':{'id':_0x3d091f[_0x133e('0x46')]['id']}})[_0x133e('0x25')](handleEntityNotFound(_0x4cb5f8,null))['then'](saveUpdates(_0x3d091f[_0x133e('0x4a')],null))['then'](respondWithResult(_0x4cb5f8,null))[_0x133e('0x44')](handleError(_0x4cb5f8,null));};exports[_0x133e('0x26')]=function(_0x17a988,_0xd7ef21){return db[_0x133e('0x2c')][_0x133e('0x48')]({'where':{'id':_0x17a988[_0x133e('0x46')]['id']}})[_0x133e('0x25')](handleEntityNotFound(_0xd7ef21,null))[_0x133e('0x25')](removeEntity(_0xd7ef21,null))[_0x133e('0x44')](handleError(_0xd7ef21,null));}; \ No newline at end of file +var _0xeda6=['limit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','merge','catch','create','body','find','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','name','index','ZendeskField','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields'];(function(_0x141ef1,_0x1c7a40){var _0x4aabdc=function(_0x234dd4){while(--_0x234dd4){_0x141ef1['push'](_0x141ef1['shift']());}};_0x4aabdc(++_0x1c7a40);}(_0xeda6,0xa3));var _0x6eda=function(_0x58941a,_0x37cb8f){_0x58941a=_0x58941a-0x0;var _0x24298f=_0xeda6[_0x58941a];return _0x24298f;};'use strict';var emlformat=require(_0x6eda('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6eda('0x1'));var moment=require(_0x6eda('0x2'));var BPromise=require(_0x6eda('0x3'));var Mustache=require(_0x6eda('0x4'));var util=require('util');var path=require(_0x6eda('0x5'));var sox=require(_0x6eda('0x6'));var csv=require(_0x6eda('0x7'));var ejs=require(_0x6eda('0x8'));var fs=require('fs');var fs_extra=require(_0x6eda('0x9'));var _=require('lodash');var squel=require(_0x6eda('0xa'));var crypto=require(_0x6eda('0xb'));var jsforce=require(_0x6eda('0xc'));var deskjs=require(_0x6eda('0xd'));var toCsv=require(_0x6eda('0x7'));var querystring=require(_0x6eda('0xe'));var Papa=require(_0x6eda('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6eda('0x10'));var as=require(_0x6eda('0x11'));var hardwareService=require(_0x6eda('0x12'));var logger=require(_0x6eda('0x13'))(_0x6eda('0x14'));var utils=require('../../config/utils');var config=require(_0x6eda('0x15'));var licenseUtil=require(_0x6eda('0x16'));var db=require(_0x6eda('0x17'))['db'];function respondWithStatusCode(_0x21f937,_0xb0be51){_0xb0be51=_0xb0be51||0xcc;return function(_0x504285){if(_0x504285){return _0x21f937[_0x6eda('0x18')](_0xb0be51);}return _0x21f937['status'](_0xb0be51)['end']();};}function respondWithResult(_0x26e1b0,_0x511509){_0x511509=_0x511509||0xc8;return function(_0x107435){if(_0x107435){return _0x26e1b0[_0x6eda('0x19')](_0x511509)['json'](_0x107435);}};}function respondWithFilteredResult(_0x750ba5,_0x2ea35a){return function(_0x57f78e){if(_0x57f78e){var _0x554eb5=typeof _0x2ea35a[_0x6eda('0x1a')]===_0x6eda('0x1b')&&typeof _0x2ea35a['limit']===_0x6eda('0x1b');var _0x4e9721=_0x57f78e[_0x6eda('0x1c')];var _0x27f2c2=_0x554eb5?0x0:_0x2ea35a[_0x6eda('0x1a')];var _0x436714=_0x554eb5?_0x57f78e[_0x6eda('0x1c')]:_0x2ea35a['offset']+_0x2ea35a['limit'];var _0x371b84;if(_0x436714>=_0x4e9721){_0x436714=_0x4e9721;_0x371b84=0xc8;}else{_0x371b84=0xce;}_0x750ba5[_0x6eda('0x19')](_0x371b84);return _0x750ba5[_0x6eda('0x1d')](_0x6eda('0x1e'),_0x27f2c2+'-'+_0x436714+'/'+_0x4e9721)['json'](_0x57f78e);}return null;};}function patchUpdates(_0x4e7376){return function(_0x589159){try{jsonpatch[_0x6eda('0x1f')](_0x589159,_0x4e7376,!![]);}catch(_0x5994a9){return BPromise[_0x6eda('0x20')](_0x5994a9);}return _0x589159[_0x6eda('0x21')]();};}function saveUpdates(_0xd99aac,_0xea3bd2){return function(_0x3bd29d){if(_0x3bd29d){return _0x3bd29d[_0x6eda('0x22')](_0xd99aac)['then'](function(_0x154c6d){return _0x154c6d;});}return null;};}function removeEntity(_0xb812fc,_0x152ebe){return function(_0x246826){if(_0x246826){return _0x246826[_0x6eda('0x23')]()[_0x6eda('0x24')](function(){_0xb812fc[_0x6eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f5945,_0x3fa8eb){return function(_0x207f01){if(!_0x207f01){_0x5f5945['sendStatus'](0x194);}return _0x207f01;};}function handleError(_0x1ae451,_0x57fbfe){_0x57fbfe=_0x57fbfe||0x1f4;return function(_0x4663c9){logger['error'](_0x4663c9['stack']);if(_0x4663c9[_0x6eda('0x25')]){delete _0x4663c9[_0x6eda('0x25')];}_0x1ae451[_0x6eda('0x19')](_0x57fbfe)['send'](_0x4663c9);};}exports[_0x6eda('0x26')]=function(_0xc90194,_0x5c7f51){var _0xf24b76={},_0xb022d1={},_0x26ab6f={'count':0x0,'rows':[]};var _0xab8fe6=_['map'](db[_0x6eda('0x27')][_0x6eda('0x28')],function(_0x45cba1){return{'name':_0x45cba1['fieldName'],'type':_0x45cba1['type'][_0x6eda('0x29')]};});_0xb022d1[_0x6eda('0x2a')]=_[_0x6eda('0x2b')](_0xab8fe6,_0x6eda('0x25'));_0xb022d1['query']=_[_0x6eda('0x2c')](_0xc90194[_0x6eda('0x2d')]);_0xb022d1[_0x6eda('0x2e')]=_[_0x6eda('0x2f')](_0xb022d1[_0x6eda('0x2a')],_0xb022d1[_0x6eda('0x2d')]);_0xf24b76[_0x6eda('0x30')]=_['intersection'](_0xb022d1[_0x6eda('0x2a')],qs[_0x6eda('0x31')](_0xc90194[_0x6eda('0x2d')][_0x6eda('0x31')]));_0xf24b76[_0x6eda('0x30')]=_0xf24b76[_0x6eda('0x30')]['length']?_0xf24b76[_0x6eda('0x30')]:_0xb022d1['model'];if(!_0xc90194[_0x6eda('0x2d')]['hasOwnProperty']('nolimit')){_0xf24b76[_0x6eda('0x32')]=qs['limit'](_0xc90194[_0x6eda('0x2d')][_0x6eda('0x32')]);_0xf24b76[_0x6eda('0x1a')]=qs[_0x6eda('0x1a')](_0xc90194[_0x6eda('0x2d')]['offset']);}_0xf24b76[_0x6eda('0x33')]=qs[_0x6eda('0x34')](_0xc90194[_0x6eda('0x2d')]['sort']);_0xf24b76['where']=qs['filters'](_[_0x6eda('0x35')](_0xc90194['query'],_0xb022d1[_0x6eda('0x2e')]),_0xab8fe6);if(_0xc90194[_0x6eda('0x2d')][_0x6eda('0x36')]){_0xf24b76[_0x6eda('0x37')]=_['merge'](_0xf24b76[_0x6eda('0x37')],{'$or':_[_0x6eda('0x2b')](_0xab8fe6,function(_0x5b728c){if(_0x5b728c[_0x6eda('0x38')]!==_0x6eda('0x39')){var _0x21370d={};_0x21370d[_0x5b728c[_0x6eda('0x25')]]={'$like':'%'+_0xc90194[_0x6eda('0x2d')][_0x6eda('0x36')]+'%'};return _0x21370d;}})});}_0xf24b76=_['merge']({},_0xf24b76,_0xc90194[_0x6eda('0x3a')]);var _0xca94bb={'where':_0xf24b76['where']};return db[_0x6eda('0x27')][_0x6eda('0x1c')](_0xca94bb)[_0x6eda('0x24')](function(_0x1b32d8){_0x26ab6f[_0x6eda('0x1c')]=_0x1b32d8;if(_0xc90194[_0x6eda('0x2d')][_0x6eda('0x3b')]){_0xf24b76['include']=[{'all':!![]}];}return db[_0x6eda('0x27')][_0x6eda('0x3c')](_0xf24b76);})[_0x6eda('0x24')](function(_0x4d9573){_0x26ab6f[_0x6eda('0x3d')]=_0x4d9573;return _0x26ab6f;})[_0x6eda('0x24')](respondWithFilteredResult(_0x5c7f51,_0xf24b76))['catch'](handleError(_0x5c7f51,null));};exports[_0x6eda('0x3e')]=function(_0x5811b1,_0x34da56){var _0x23a4ba={'raw':!![],'where':{'id':_0x5811b1[_0x6eda('0x3f')]['id']}},_0x2c9eac={};_0x2c9eac[_0x6eda('0x2a')]=_[_0x6eda('0x2c')](db['ZendeskField'][_0x6eda('0x28')]);_0x2c9eac[_0x6eda('0x2d')]=_[_0x6eda('0x2c')](_0x5811b1[_0x6eda('0x2d')]);_0x2c9eac['filters']=_[_0x6eda('0x2f')](_0x2c9eac[_0x6eda('0x2a')],_0x2c9eac[_0x6eda('0x2d')]);_0x23a4ba[_0x6eda('0x30')]=_[_0x6eda('0x2f')](_0x2c9eac['model'],qs[_0x6eda('0x31')](_0x5811b1[_0x6eda('0x2d')][_0x6eda('0x31')]));_0x23a4ba[_0x6eda('0x30')]=_0x23a4ba[_0x6eda('0x30')][_0x6eda('0x40')]?_0x23a4ba[_0x6eda('0x30')]:_0x2c9eac['model'];if(_0x5811b1[_0x6eda('0x2d')]['includeAll']){_0x23a4ba[_0x6eda('0x41')]=[{'all':!![]}];}_0x23a4ba=_[_0x6eda('0x42')]({},_0x23a4ba,_0x5811b1[_0x6eda('0x3a')]);return db['ZendeskField']['find'](_0x23a4ba)[_0x6eda('0x24')](handleEntityNotFound(_0x34da56,null))['then'](respondWithResult(_0x34da56,null))[_0x6eda('0x43')](handleError(_0x34da56,null));};exports[_0x6eda('0x44')]=function(_0x2ce92f,_0x5a0a8b){return db[_0x6eda('0x27')][_0x6eda('0x44')](_0x2ce92f['body'],{})[_0x6eda('0x24')](respondWithResult(_0x5a0a8b,0xc9))['catch'](handleError(_0x5a0a8b,null));};exports[_0x6eda('0x22')]=function(_0x603b80,_0x97d251){if(_0x603b80[_0x6eda('0x45')]['id']){delete _0x603b80[_0x6eda('0x45')]['id'];}return db[_0x6eda('0x27')][_0x6eda('0x46')]({'where':{'id':_0x603b80[_0x6eda('0x3f')]['id']}})[_0x6eda('0x24')](handleEntityNotFound(_0x97d251,null))[_0x6eda('0x24')](saveUpdates(_0x603b80['body'],null))[_0x6eda('0x24')](respondWithResult(_0x97d251,null))[_0x6eda('0x43')](handleError(_0x97d251,null));};exports[_0x6eda('0x23')]=function(_0xd0db49,_0x5d2d9b){return db['ZendeskField']['find']({'where':{'id':_0xd0db49[_0x6eda('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5d2d9b,null))[_0x6eda('0x24')](removeEntity(_0x5d2d9b,null))[_0x6eda('0x43')](handleError(_0x5d2d9b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 68156ef..a02bd9f 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 _0xbcf5=['ZendeskField','zendesk_unique_index','idField','lodash','../../config/logger','bluebird','path','./intZendeskField.attributes','define'];(function(_0x551a99,_0x243360){var _0x4e1719=function(_0x42b90d){while(--_0x42b90d){_0x551a99['push'](_0x551a99['shift']());}};_0x4e1719(++_0x243360);}(_0xbcf5,0x16b));var _0x5bcf=function(_0x22ffaf,_0x3c3246){_0x22ffaf=_0x22ffaf-0x0;var _0x1424cb=_0xbcf5[_0x22ffaf];return _0x1424cb;};'use strict';var _=require(_0x5bcf('0x0'));var util=require('util');var logger=require(_0x5bcf('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5bcf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bcf('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5bcf('0x4'));module['exports']=function(_0x132dee,_0x281a82){return _0x132dee[_0x5bcf('0x5')](_0x5bcf('0x6'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x5bcf('0x7'),'fields':[_0x5bcf('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc205=['idField','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index'];(function(_0x24ea1c,_0x482238){var _0x23710c=function(_0x15c574){while(--_0x15c574){_0x24ea1c['push'](_0x24ea1c['shift']());}};_0x23710c(++_0x482238);}(_0xc205,0x1eb));var _0x5c20=function(_0x356097,_0x2886d5){_0x356097=_0x356097-0x0;var _0x41cb02=_0xc205[_0x356097];return _0x41cb02;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c20('0x0'))(_0x5c20('0x1'));var moment=require(_0x5c20('0x2'));var BPromise=require(_0x5c20('0x3'));var rp=require(_0x5c20('0x4'));var fs=require('fs');var path=require(_0x5c20('0x5'));var rimraf=require(_0x5c20('0x6'));var config=require(_0x5c20('0x7'));var attributes=require(_0x5c20('0x8'));module[_0x5c20('0x9')]=function(_0x33b218,_0x2cd8be){return _0x33b218[_0x5c20('0xa')](_0x5c20('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x5c20('0xc'),'fields':[_0x5c20('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index c98486f..1ec00ba 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 _0xf8ee=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment'];(function(_0xfa2f68,_0x23836e){var _0x252d9a=function(_0x285e61){while(--_0x285e61){_0xfa2f68['push'](_0xfa2f68['shift']());}};_0x252d9a(++_0x23836e);}(_0xf8ee,0x7c));var _0xef8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf8ee[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xef8e('0x0'));var moment=require(_0xef8e('0x1'));var BPromise=require(_0xef8e('0x2'));var rs=require(_0xef8e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef8e('0x4'))['db'];var utils=require(_0xef8e('0x5'));var logger=require(_0xef8e('0x6'))('rpc');var config=require(_0xef8e('0x7'));var jayson=require(_0xef8e('0x8'));var client=jayson['client'][_0xef8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3533c6,_0x2de185,_0x574b90){return new BPromise(function(_0x2eec4c,_0x7af420){return client[_0xef8e('0xa')](_0x3533c6,_0x574b90)[_0xef8e('0xb')](function(_0x51e27d){logger[_0xef8e('0xc')](_0xef8e('0xd'),_0x2de185,_0xef8e('0xe'));logger[_0xef8e('0xf')](_0xef8e('0x10'),_0x2de185,_0xef8e('0xe'),JSON[_0xef8e('0x11')](_0x51e27d));if(_0x51e27d[_0xef8e('0x12')]){if(_0x51e27d[_0xef8e('0x12')][_0xef8e('0x13')]===0x1f4){logger['error'](_0xef8e('0xd'),_0x2de185,_0x51e27d[_0xef8e('0x12')][_0xef8e('0x14')]);return _0x7af420(_0x51e27d[_0xef8e('0x12')]['message']);}logger['error'](_0xef8e('0xd'),_0x2de185,_0x51e27d['error'][_0xef8e('0x14')]);return _0x2eec4c(_0x51e27d[_0xef8e('0x12')][_0xef8e('0x14')]);}else{logger[_0xef8e('0xc')](_0xef8e('0xd'),_0x2de185,'request\x20sent');_0x2eec4c(_0x51e27d['result'][_0xef8e('0x14')]);}})['catch'](function(_0x1130f4){logger['error'](_0xef8e('0xd'),_0x2de185,_0x1130f4);_0x7af420(_0x1130f4);});});} \ No newline at end of file +var _0xc54f=['../../config/environment','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils','rpc'];(function(_0xf5c8c1,_0x58a82a){var _0xc5116e=function(_0x20a292){while(--_0x20a292){_0xf5c8c1['push'](_0xf5c8c1['shift']());}};_0xc5116e(++_0x58a82a);}(_0xc54f,0x80));var _0xfc54=function(_0x3082e2,_0x37cdcf){_0x3082e2=_0x3082e2-0x0;var _0x450368=_0xc54f[_0x3082e2];return _0x450368;};'use strict';var _=require(_0xfc54('0x0'));var util=require('util');var moment=require(_0xfc54('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc54('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc54('0x3'));var logger=require('../../config/logger')(_0xfc54('0x4'));var config=require(_0xfc54('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfc54('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x431984,_0x52d810,_0x5b9bec){return new BPromise(function(_0x3944e9,_0x86586f){return client['request'](_0x431984,_0x5b9bec)[_0xfc54('0x7')](function(_0x546280){logger[_0xfc54('0x8')](_0xfc54('0x9'),_0x52d810,_0xfc54('0xa'));logger[_0xfc54('0xb')](_0xfc54('0xc'),_0x52d810,_0xfc54('0xa'),JSON[_0xfc54('0xd')](_0x546280));if(_0x546280[_0xfc54('0xe')]){if(_0x546280['error'][_0xfc54('0xf')]===0x1f4){logger[_0xfc54('0xe')](_0xfc54('0x9'),_0x52d810,_0x546280['error'][_0xfc54('0x10')]);return _0x86586f(_0x546280['error'][_0xfc54('0x10')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x52d810,_0x546280['error']['message']);return _0x3944e9(_0x546280['error'][_0xfc54('0x10')]);}else{logger[_0xfc54('0x8')]('ZendeskField,\x20%s,\x20%s',_0x52d810,_0xfc54('0xa'));_0x3944e9(_0x546280[_0xfc54('0x11')][_0xfc54('0x10')]);}})[_0xfc54('0x12')](function(_0x27c26e){logger[_0xfc54('0xe')](_0xfc54('0x9'),_0x52d810,_0x27c26e);_0x86586f(_0x27c26e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a88e81b..67b0e20 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 _0x4263=['addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x23597f,_0x1e34ac){var _0x237f67=function(_0x46f9b8){while(--_0x46f9b8){_0x23597f['push'](_0x23597f['shift']());}};_0x237f67(++_0x1e34ac);}(_0x4263,0xdc));var _0x3426=function(_0x2a4bc0,_0x4b2c3c){_0x2a4bc0=_0x2a4bc0-0x0;var _0x20f5fc=_0x4263[_0x2a4bc0];return _0x20f5fc;};'use strict';var multer=require(_0x3426('0x0'));var util=require(_0x3426('0x1'));var path=require(_0x3426('0x2'));var timeout=require(_0x3426('0x3'));var express=require(_0x3426('0x4'));var router=express[_0x3426('0x5')]();var fs_extra=require(_0x3426('0x6'));var auth=require(_0x3426('0x7'));var interaction=require(_0x3426('0x8'));var config=require('../../config/environment');var controller=require(_0x3426('0x9'));router[_0x3426('0xa')]('/',auth['isAuthenticated'](),controller[_0x3426('0xb')]);router[_0x3426('0xa')](_0x3426('0xc'),auth[_0x3426('0xd')](),controller[_0x3426('0xe')]);router[_0x3426('0xa')](_0x3426('0xf'),auth[_0x3426('0xd')](),controller[_0x3426('0x10')]);router[_0x3426('0xa')](_0x3426('0x11'),auth['isAuthenticated'](),controller['getFields']);router[_0x3426('0x12')]('/',auth[_0x3426('0xd')](),controller[_0x3426('0x13')]);router[_0x3426('0x12')](_0x3426('0xf'),auth[_0x3426('0xd')](),controller[_0x3426('0x14')]);router[_0x3426('0x15')]('/:id',auth[_0x3426('0xd')](),controller[_0x3426('0x16')]);router[_0x3426('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc7a5=['/:id','show','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x157f58,_0x44475e){var _0x4f08e5=function(_0xfe1638){while(--_0xfe1638){_0x157f58['push'](_0x157f58['shift']());}};_0x4f08e5(++_0x44475e);}(_0xc7a5,0xdd));var _0x5c7a=function(_0x3b35f8,_0x125e3d){_0x3b35f8=_0x3b35f8-0x0;var _0x2a9b03=_0xc7a5[_0x3b35f8];return _0x2a9b03;};'use strict';var multer=require(_0x5c7a('0x0'));var util=require(_0x5c7a('0x1'));var path=require(_0x5c7a('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c7a('0x3'));var router=express['Router']();var fs_extra=require(_0x5c7a('0x4'));var auth=require(_0x5c7a('0x5'));var interaction=require(_0x5c7a('0x6'));var config=require(_0x5c7a('0x7'));var controller=require(_0x5c7a('0x8'));router[_0x5c7a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c7a('0x9')](_0x5c7a('0xa'),auth['isAuthenticated'](),controller[_0x5c7a('0xb')]);router['get']('/:id/configurations',auth[_0x5c7a('0xc')](),controller['getConfigurations']);router[_0x5c7a('0x9')](_0x5c7a('0xd'),auth['isAuthenticated'](),controller[_0x5c7a('0xe')]);router[_0x5c7a('0xf')]('/',auth[_0x5c7a('0xc')](),controller[_0x5c7a('0x10')]);router[_0x5c7a('0xf')](_0x5c7a('0x11'),auth[_0x5c7a('0xc')](),controller[_0x5c7a('0x12')]);router[_0x5c7a('0x13')](_0x5c7a('0xa'),auth[_0x5c7a('0xc')](),controller[_0x5c7a('0x14')]);router['delete'](_0x5c7a('0xa'),auth[_0x5c7a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a4fee10..1c04c0d 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 _0x9c44=['STRING'];(function(_0x59f066,_0x3d8a42){var _0x21187c=function(_0x17a6ee){while(--_0x17a6ee){_0x59f066['push'](_0x59f066['shift']());}};_0x21187c(++_0x3d8a42);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')]},'description':{'type':Sequelize[_0x49c4('0x0')]},'host':{'type':Sequelize[_0x49c4('0x0')]},'zone':{'type':Sequelize[_0x49c4('0x0')]},'clientId':{'type':Sequelize[_0x49c4('0x0')]},'clientSecret':{'type':Sequelize[_0x49c4('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x49c4('0x0')]}}; \ No newline at end of file +var _0x41bb=['exports','STRING','sequelize'];(function(_0x5182f9,_0x4acf0c){var _0x4c9fad=function(_0x453b0e){while(--_0x453b0e){_0x5182f9['push'](_0x5182f9['shift']());}};_0x4c9fad(++_0x4acf0c);}(_0x41bb,0xc5));var _0xb41b=function(_0x5a6b0c,_0xf16f75){_0x5a6b0c=_0x5a6b0c-0x0;var _0x47ed68=_0x41bb[_0x5a6b0c];return _0x47ed68;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb41b('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xb41b('0x2')]},'clientId':{'type':Sequelize[_0xb41b('0x2')]},'clientSecret':{'type':Sequelize[_0xb41b('0x2')]},'serverUrl':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb41b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5ecee13..e7c9109 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 _0xb75c=['refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','com','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','ZohoAccount','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','findAll','rows','catch','show','rawAttributes','fields','includeAll','include','options','find','create','body','params','getConfigurations','ZohoConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token'];(function(_0x3ff352,_0x257e04){var _0x5f184c=function(_0x3e36eb){while(--_0x3e36eb){_0x3ff352['push'](_0x3ff352['shift']());}};_0x5f184c(++_0x257e04);}(_0xb75c,0x1b8));var _0xcb75=function(_0xe4b102,_0x269fe6){_0xe4b102=_0xe4b102-0x0;var _0x44db7c=_0xb75c[_0xe4b102];return _0x44db7c;};'use strict';var emlformat=require(_0xcb75('0x0'));var rimraf=require(_0xcb75('0x1'));var zipdir=require(_0xcb75('0x2'));var jsonpatch=require(_0xcb75('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcb75('0x4'));var Mustache=require(_0xcb75('0x5'));var util=require(_0xcb75('0x6'));var path=require(_0xcb75('0x7'));var sox=require('sox');var csv=require(_0xcb75('0x8'));var ejs=require(_0xcb75('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcb75('0xa'));var jsforce=require(_0xcb75('0xb'));var deskjs=require(_0xcb75('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcb75('0xd'));var Papa=require('papaparse');var Redis=require(_0xcb75('0xe'));var authService=require(_0xcb75('0xf'));var qs=require(_0xcb75('0x10'));var as=require(_0xcb75('0x11'));var hardwareService=require(_0xcb75('0x12'));var logger=require('../../config/logger')(_0xcb75('0x13'));var utils=require(_0xcb75('0x14'));var config=require(_0xcb75('0x15'));var licenseUtil=require(_0xcb75('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x376bdb,_0xe23033){_0xe23033=_0xe23033||0xcc;return function(_0x20acd7){if(_0x20acd7){return _0x376bdb['sendStatus'](_0xe23033);}return _0x376bdb[_0xcb75('0x17')](_0xe23033)['end']();};}function respondWithResult(_0x21cda5,_0x4a8e30){_0x4a8e30=_0x4a8e30||0xc8;return function(_0x5f4401){if(_0x5f4401){return _0x21cda5['status'](_0x4a8e30)['json'](_0x5f4401);}};}function respondWithFilteredResult(_0x4643f6,_0x2b7f63){return function(_0x3a5cbf){if(_0x3a5cbf){var _0x3f64a9=typeof _0x2b7f63[_0xcb75('0x18')]==='undefined'&&typeof _0x2b7f63[_0xcb75('0x19')]===_0xcb75('0x1a');var _0x54406a=_0x3a5cbf[_0xcb75('0x1b')];var _0xaf9c09=_0x3f64a9?0x0:_0x2b7f63[_0xcb75('0x18')];var _0x113352=_0x3f64a9?_0x3a5cbf[_0xcb75('0x1b')]:_0x2b7f63['offset']+_0x2b7f63['limit'];var _0x3ceb9a;if(_0x113352>=_0x54406a){_0x113352=_0x54406a;_0x3ceb9a=0xc8;}else{_0x3ceb9a=0xce;}_0x4643f6[_0xcb75('0x17')](_0x3ceb9a);return _0x4643f6[_0xcb75('0x1c')](_0xcb75('0x1d'),_0xaf9c09+'-'+_0x113352+'/'+_0x54406a)[_0xcb75('0x1e')](_0x3a5cbf);}return null;};}function patchUpdates(_0x31b36a){return function(_0x3a06d6){try{jsonpatch[_0xcb75('0x1f')](_0x3a06d6,_0x31b36a,!![]);}catch(_0x3c4bbb){return BPromise[_0xcb75('0x20')](_0x3c4bbb);}return _0x3a06d6[_0xcb75('0x21')]();};}function saveUpdates(_0x16cd8f,_0x1b5d23){return function(_0x20b52c){if(_0x20b52c){return _0x20b52c[_0xcb75('0x22')](_0x16cd8f)[_0xcb75('0x23')](function(_0x25ef5e){return _0x25ef5e;});}return null;};}function removeEntity(_0x1b3eda,_0x2f779a){return function(_0x31bf93){if(_0x31bf93){return _0x31bf93[_0xcb75('0x24')]()['then'](function(){_0x1b3eda['status'](0xcc)[_0xcb75('0x25')]();});}};}function handleEntityNotFound(_0x486b51,_0x1f2792){return function(_0x551a18){if(!_0x551a18){_0x486b51['sendStatus'](0x194);}return _0x551a18;};}function handleError(_0x13fc49,_0x583634){_0x583634=_0x583634||0x1f4;return function(_0x4b6c6d){logger[_0xcb75('0x26')](_0x4b6c6d[_0xcb75('0x27')]);if(_0x4b6c6d['name']){delete _0x4b6c6d[_0xcb75('0x28')];}_0x13fc49[_0xcb75('0x17')](_0x583634)[_0xcb75('0x29')](_0x4b6c6d);};}exports[_0xcb75('0x2a')]=function(_0x1a64fe,_0x250713){var _0x3d70a1={},_0xbfc0a5={},_0x20697f={'count':0x0,'rows':[]};var _0x46f05c=_['map'](db[_0xcb75('0x2b')]['rawAttributes'],function(_0x342f18){return{'name':_0x342f18[_0xcb75('0x2c')],'type':_0x342f18[_0xcb75('0x2d')][_0xcb75('0x2e')]};});_0xbfc0a5['model']=_[_0xcb75('0x2f')](_0x46f05c,'name');_0xbfc0a5[_0xcb75('0x30')]=_[_0xcb75('0x31')](_0x1a64fe[_0xcb75('0x30')]);_0xbfc0a5[_0xcb75('0x32')]=_[_0xcb75('0x33')](_0xbfc0a5[_0xcb75('0x34')],_0xbfc0a5[_0xcb75('0x30')]);_0x3d70a1[_0xcb75('0x35')]=_['intersection'](_0xbfc0a5[_0xcb75('0x34')],qs['fields'](_0x1a64fe[_0xcb75('0x30')]['fields']));_0x3d70a1[_0xcb75('0x35')]=_0x3d70a1[_0xcb75('0x35')][_0xcb75('0x36')]?_0x3d70a1['attributes']:_0xbfc0a5[_0xcb75('0x34')];if(!_0x1a64fe[_0xcb75('0x30')][_0xcb75('0x37')](_0xcb75('0x38'))){_0x3d70a1[_0xcb75('0x19')]=qs[_0xcb75('0x19')](_0x1a64fe[_0xcb75('0x30')][_0xcb75('0x19')]);_0x3d70a1['offset']=qs[_0xcb75('0x18')](_0x1a64fe[_0xcb75('0x30')][_0xcb75('0x18')]);}_0x3d70a1[_0xcb75('0x39')]=qs[_0xcb75('0x3a')](_0x1a64fe[_0xcb75('0x30')][_0xcb75('0x3a')]);_0x3d70a1[_0xcb75('0x3b')]=qs[_0xcb75('0x32')](_[_0xcb75('0x3c')](_0x1a64fe[_0xcb75('0x30')],_0xbfc0a5[_0xcb75('0x32')]),_0x46f05c);if(_0x1a64fe['query'][_0xcb75('0x3d')]){_0x3d70a1['where']=_[_0xcb75('0x3e')](_0x3d70a1[_0xcb75('0x3b')],{'$or':_[_0xcb75('0x2f')](_0x46f05c,function(_0x26cc69){if(_0x26cc69[_0xcb75('0x2d')]!=='VIRTUAL'){var _0x547fc5={};_0x547fc5[_0x26cc69[_0xcb75('0x28')]]={'$like':'%'+_0x1a64fe[_0xcb75('0x30')][_0xcb75('0x3d')]+'%'};return _0x547fc5;}})});}_0x3d70a1=_[_0xcb75('0x3e')]({},_0x3d70a1,_0x1a64fe['options']);var _0x4e84f5={'where':_0x3d70a1[_0xcb75('0x3b')]};return db['ZohoAccount']['count'](_0x4e84f5)[_0xcb75('0x23')](function(_0x223d22){_0x20697f[_0xcb75('0x1b')]=_0x223d22;if(_0x1a64fe[_0xcb75('0x30')]['includeAll']){_0x3d70a1['include']=[{'all':!![]}];}return db[_0xcb75('0x2b')][_0xcb75('0x3f')](_0x3d70a1);})['then'](function(_0x4031ca){_0x20697f[_0xcb75('0x40')]=_0x4031ca;return _0x20697f;})[_0xcb75('0x23')](respondWithFilteredResult(_0x250713,_0x3d70a1))[_0xcb75('0x41')](handleError(_0x250713,null));};exports[_0xcb75('0x42')]=function(_0xf1b104,_0x1f6e0d){var _0x4612c9={'raw':![],'where':{'id':_0xf1b104['params']['id']}},_0x4cab74={};_0x4cab74[_0xcb75('0x34')]=_[_0xcb75('0x31')](db[_0xcb75('0x2b')][_0xcb75('0x43')]);_0x4cab74['query']=_[_0xcb75('0x31')](_0xf1b104[_0xcb75('0x30')]);_0x4cab74['filters']=_[_0xcb75('0x33')](_0x4cab74[_0xcb75('0x34')],_0x4cab74[_0xcb75('0x30')]);_0x4612c9[_0xcb75('0x35')]=_[_0xcb75('0x33')](_0x4cab74[_0xcb75('0x34')],qs['fields'](_0xf1b104[_0xcb75('0x30')][_0xcb75('0x44')]));_0x4612c9['attributes']=_0x4612c9[_0xcb75('0x35')]['length']?_0x4612c9[_0xcb75('0x35')]:_0x4cab74['model'];if(_0xf1b104[_0xcb75('0x30')][_0xcb75('0x45')]){_0x4612c9[_0xcb75('0x46')]=[{'all':!![]}];}_0x4612c9=_[_0xcb75('0x3e')]({},_0x4612c9,_0xf1b104[_0xcb75('0x47')]);return db[_0xcb75('0x2b')][_0xcb75('0x48')](_0x4612c9)[_0xcb75('0x23')](handleEntityNotFound(_0x1f6e0d,null))[_0xcb75('0x23')](respondWithResult(_0x1f6e0d,null))['catch'](handleError(_0x1f6e0d,null));};exports[_0xcb75('0x49')]=function(_0x46633a,_0x1b4aed){return db[_0xcb75('0x2b')][_0xcb75('0x49')](_0x46633a[_0xcb75('0x4a')],{})[_0xcb75('0x23')](respondWithResult(_0x1b4aed,0xc9))[_0xcb75('0x41')](handleError(_0x1b4aed,null));};exports['update']=function(_0xa87b9b,_0x325c0a){if(_0xa87b9b[_0xcb75('0x4a')]['id']){delete _0xa87b9b[_0xcb75('0x4a')]['id'];}return db[_0xcb75('0x2b')]['find']({'where':{'id':_0xa87b9b[_0xcb75('0x4b')]['id']}})[_0xcb75('0x23')](handleEntityNotFound(_0x325c0a,null))['then'](saveUpdates(_0xa87b9b[_0xcb75('0x4a')],null))[_0xcb75('0x23')](respondWithResult(_0x325c0a,null))[_0xcb75('0x41')](handleError(_0x325c0a,null));};exports[_0xcb75('0x24')]=function(_0xcfb06d,_0x4061fd){return db['ZohoAccount'][_0xcb75('0x48')]({'where':{'id':_0xcfb06d[_0xcb75('0x4b')]['id']}})[_0xcb75('0x23')](handleEntityNotFound(_0x4061fd,null))[_0xcb75('0x23')](removeEntity(_0x4061fd,null))['catch'](handleError(_0x4061fd,null));};exports[_0xcb75('0x4c')]=function(_0x41fc70,_0x45ea5d,_0x34992c){var _0x1e6521={};var _0x1f174a={};var _0xe3ac74;var _0x4da490;return db[_0xcb75('0x2b')]['findOne']({'where':{'id':_0x41fc70['params']['id']}})[_0xcb75('0x23')](handleEntityNotFound(_0x45ea5d,null))[_0xcb75('0x23')](function(_0x13b14a){if(_0x13b14a){_0xe3ac74=_0x13b14a;_0x1f174a[_0xcb75('0x34')]=_[_0xcb75('0x31')](db[_0xcb75('0x4d')][_0xcb75('0x43')]);_0x1f174a[_0xcb75('0x30')]=_['keys'](_0x41fc70[_0xcb75('0x30')]);_0x1f174a['filters']=_[_0xcb75('0x33')](_0x1f174a[_0xcb75('0x34')],_0x1f174a[_0xcb75('0x30')]);_0x1e6521[_0xcb75('0x35')]=_['intersection'](_0x1f174a[_0xcb75('0x34')],qs['fields'](_0x41fc70['query']['fields']));_0x1e6521['attributes']=_0x1e6521[_0xcb75('0x35')][_0xcb75('0x36')]?_0x1e6521['attributes']:_0x1f174a[_0xcb75('0x34')];_0x1e6521[_0xcb75('0x39')]=qs[_0xcb75('0x3a')](_0x41fc70[_0xcb75('0x30')][_0xcb75('0x3a')]);_0x1e6521[_0xcb75('0x3b')]=qs['filters'](_[_0xcb75('0x3c')](_0x41fc70[_0xcb75('0x30')],_0x1f174a[_0xcb75('0x32')]));if(_0x41fc70['query'][_0xcb75('0x3d')]){_0x1e6521[_0xcb75('0x3b')]=_[_0xcb75('0x3e')](_0x1e6521[_0xcb75('0x3b')],{'$or':_[_0xcb75('0x2f')](_0x1e6521[_0xcb75('0x35')],function(_0xa592f1){var _0x187fa5={};_0x187fa5[_0xa592f1]={'$like':'%'+_0x41fc70[_0xcb75('0x30')][_0xcb75('0x3d')]+'%'};return _0x187fa5;})});}_0x1e6521=_['merge']({},_0x1e6521,_0x41fc70['options']);return _0xe3ac74['getConfigurations'](_0x1e6521);}})['then'](function(_0x74ff9d){if(_0x74ff9d){_0x4da490=_0x74ff9d['length'];if(!_0x41fc70[_0xcb75('0x30')][_0xcb75('0x37')]('nolimit')){_0x1e6521['limit']=qs['limit'](_0x41fc70[_0xcb75('0x30')][_0xcb75('0x19')]);_0x1e6521['offset']=qs[_0xcb75('0x18')](_0x41fc70['query'][_0xcb75('0x18')]);}return _0xe3ac74['getConfigurations'](_0x1e6521);}})['then'](function(_0x3211b7){if(_0x3211b7){return _0x3211b7?{'count':_0x4da490,'rows':_0x3211b7}:null;}})[_0xcb75('0x23')](respondWithResult(_0x45ea5d,null))[_0xcb75('0x41')](handleError(_0x45ea5d,null));};exports['addConfiguration']=function(_0x552070,_0x426c1b,_0x43feaf){if(_0x552070['body']['id']){delete _0x552070[_0xcb75('0x4a')]['id'];}return db[_0xcb75('0x2b')][_0xcb75('0x4e')]({'where':{'id':_0x552070[_0xcb75('0x4b')]['id']}})[_0xcb75('0x23')](handleEntityNotFound(_0x426c1b,null))['then'](function(_0x140499){if(_0x140499){_0x552070[_0xcb75('0x4a')][_0xcb75('0x4f')]=_0x140499['id'];_0x552070[_0xcb75('0x4a')][_0xcb75('0x50')]=integrations['getSubjects'](_0x552070['body']['channel'],_0x552070['body']['type']);_0x552070[_0xcb75('0x4a')][_0xcb75('0x51')]=integrations[_0xcb75('0x52')](_0x552070[_0xcb75('0x4a')][_0xcb75('0x53')],_0x552070['body'][_0xcb75('0x2d')]);return db['ZohoConfiguration']['create'](_0x552070[_0xcb75('0x4a')],{'include':[{'model':db[_0xcb75('0x54')],'as':_0xcb75('0x50')},{'model':db[_0xcb75('0x54')],'as':_0xcb75('0x51')}]});}return null;})[_0xcb75('0x23')](respondWithResult(_0x426c1b,null))[_0xcb75('0x41')](handleError(_0x426c1b,null));};function getAccessToken(_0x203a00){return new Promise(function(_0x4b6ec3,_0x48d7b2){var _0x490565;switch(_0x203a00[_0xcb75('0x55')]){case'US':_0x490565=_0xcb75('0x56');break;case'AU':_0x490565=_0xcb75('0x57');break;case'EU':_0x490565=_0xcb75('0x58');break;case'IN':_0x490565='https://accounts.zoho.in';break;case'CN':_0x490565=_0xcb75('0x59');break;default:_0x490565=_0xcb75('0x58');break;}var _0x3740df={'method':_0xcb75('0x5a'),'uri':_0x490565+_0xcb75('0x5b'),'qs':{'refresh_token':_0x203a00[_0xcb75('0x5c')],'client_id':_0x203a00[_0xcb75('0x5d')],'client_secret':_0x203a00[_0xcb75('0x5e')],'grant_type':_0xcb75('0x5f')},'json':!![]};return rp(_0x3740df)[_0xcb75('0x23')](function(_0x18e96a){if(_0x18e96a['access_token']){_0x4b6ec3(_0x18e96a[_0xcb75('0x60')]);}else{_0x48d7b2(_0xcb75('0x61'));}})['catch'](function(_0x1bd5ca){_0x48d7b2(_0x1bd5ca);});});}exports[_0xcb75('0x62')]=function(_0x2411d6,_0x534c7b,_0x4ee88e){var _0x27adfc,_0x6e8bf5,_0x103c8b,_0x420be4,_0x564d63;return db['ZohoAccount'][_0xcb75('0x4e')]({'where':{'id':_0x2411d6['params']['id']},'attributes':['id',_0xcb75('0x63'),'zone',_0xcb75('0x5d'),_0xcb75('0x5e'),'serverUrl',_0xcb75('0x64'),_0xcb75('0x5c')]})[_0xcb75('0x23')](handleEntityNotFound(_0x534c7b,null))[_0xcb75('0x23')](function(_0x3d5690){_0x564d63=_0x3d5690;_0x27adfc=_0x564d63['host'];_0x6e8bf5=_0x27adfc==='zoho.eu'?'eu':_0xcb75('0x65');_0x103c8b=_0x564d63[_0xcb75('0x66')];var _0x2f8b00=_0x103c8b[_0xcb75('0x67')](-0x1);if(_0x2f8b00==='/'||_0x2f8b00==='\x5c'||_0x2f8b00===':'){_0x103c8b=_0x103c8b['substring'](0x0,_0x103c8b[_0xcb75('0x68')](_0x2f8b00));}if(!_0x564d63[_0xcb75('0x5c')]){throw new Error(_0xcb75('0x69'));}return getAccessToken(_0x564d63);})[_0xcb75('0x23')](function(_0x5ee256){if(_0x5ee256){return rp({'method':_0xcb75('0x6a'),'uri':util['format'](_0xcb75('0x6b'),_0x6e8bf5),'qs':{'module':_0xcb75('0x6c')},'headers':{'Authorization':_0xcb75('0x6d')+_0x5ee256},'json':!![]});}})['then'](function(_0x23966c){if(_0x23966c){if(_0x23966c[_0xcb75('0x6e')]&&_0x23966c['response']['error']){throw new Error(_0x23966c['response'][_0xcb75('0x26')][_0xcb75('0x6f')]);}var _0x15a58c=[];var _0x46c58d=[];var _0x447586=[_0xcb75('0x70'),_0xcb75('0x71'),_0xcb75('0x72'),_0xcb75('0x73'),_0xcb75('0x74'),_0xcb75('0x75'),'Call_Start_Time',_0xcb75('0x76')];_0x46c58d=_[_0xcb75('0x77')](_0x23966c[_0xcb75('0x44')],function(_0x290585){return _0x447586[_0xcb75('0x78')](_0x290585[_0xcb75('0x79')]);});for(var _0x5e11f5=0x0;_0x5e11f5<_0x46c58d['length'];_0x5e11f5++){if(_0x46c58d[_0x5e11f5][_0xcb75('0x7a')]===![]){_0x15a58c[_0xcb75('0x7b')]({'id':_0x46c58d[_0x5e11f5]['id'],'name':_0x46c58d[_0x5e11f5]['display_label'],'custom':_0x46c58d[_0x5e11f5][_0xcb75('0x7c')],'options':_0x46c58d[_0x5e11f5][_0xcb75('0x7d')]===_0xcb75('0x7e')&&_0x46c58d[_0x5e11f5]['pick_list_values']['length']>-0x1?_[_0xcb75('0x2f')](_0x46c58d[_0x5e11f5][_0xcb75('0x7f')],function(_0xe8841f){return{'name':_0xe8841f,'value':_0xe8841f};}):[]});}}return{'count':_0x15a58c[_0xcb75('0x36')],'rows':_0x15a58c};}else{return{'count':0x0,'rows':[]};}})[_0xcb75('0x23')](respondWithResult(_0x534c7b,null))[_0xcb75('0x41')](function(_0x2e659e){var _0x263533=_0x2411d6[_0xcb75('0x30')][_0xcb75('0x80')]?0x1f4:_0x2e659e[_0xcb75('0x81')]||0x1f4;logger[_0xcb75('0x26')](_0xcb75('0x82'),_0xcb75('0x62'),_0x263533,JSON[_0xcb75('0x83')](_0x2e659e));delete _0x2e659e[_0xcb75('0x28')];if(_0x263533===0x191){_0x263533=0x190;}_0x534c7b['status'](_0x263533)[_0xcb75('0x29')](_0x2411d6[_0xcb75('0x30')][_0xcb75('0x80')]?{'message':_0xcb75('0x84'),'statusCode':_0x2e659e[_0xcb75('0x81')]}:_0x2e659e);});}; \ No newline at end of file +var _0xbca6=['lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','WhoId','Call_Result','Call_Type','includes','system_mandatory','push','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','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','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','options','where','ZohoAccount','include','rows','catch','show','params','intersection','includeAll','create','body','find','destroy','getConfigurations','findOne','filter','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','zoho.eu','com','substring'];(function(_0x3a5da5,_0x58eaa0){var _0x2de0e5=function(_0x2f1d09){while(--_0x2f1d09){_0x3a5da5['push'](_0x3a5da5['shift']());}};_0x2de0e5(++_0x58eaa0);}(_0xbca6,0x9c));var _0x6bca=function(_0x53cba4,_0x8a94a4){_0x53cba4=_0x53cba4-0x0;var _0x287d18=_0xbca6[_0x53cba4];return _0x287d18;};'use strict';var emlformat=require(_0x6bca('0x0'));var rimraf=require(_0x6bca('0x1'));var zipdir=require(_0x6bca('0x2'));var jsonpatch=require(_0x6bca('0x3'));var rp=require(_0x6bca('0x4'));var moment=require(_0x6bca('0x5'));var BPromise=require(_0x6bca('0x6'));var Mustache=require(_0x6bca('0x7'));var util=require(_0x6bca('0x8'));var path=require(_0x6bca('0x9'));var sox=require(_0x6bca('0xa'));var csv=require(_0x6bca('0xb'));var ejs=require(_0x6bca('0xc'));var fs=require('fs');var fs_extra=require(_0x6bca('0xd'));var _=require(_0x6bca('0xe'));var squel=require(_0x6bca('0xf'));var crypto=require(_0x6bca('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x6bca('0x11'));var toCsv=require(_0x6bca('0xb'));var querystring=require(_0x6bca('0x12'));var Papa=require(_0x6bca('0x13'));var Redis=require(_0x6bca('0x14'));var authService=require(_0x6bca('0x15'));var qs=require(_0x6bca('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bca('0x17'))(_0x6bca('0x18'));var utils=require(_0x6bca('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6bca('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6bca('0x1b'));function respondWithStatusCode(_0x2b53f1,_0x507561){_0x507561=_0x507561||0xcc;return function(_0x177120){if(_0x177120){return _0x2b53f1[_0x6bca('0x1c')](_0x507561);}return _0x2b53f1[_0x6bca('0x1d')](_0x507561)['end']();};}function respondWithResult(_0x24cc11,_0x545e44){_0x545e44=_0x545e44||0xc8;return function(_0x161a23){if(_0x161a23){return _0x24cc11[_0x6bca('0x1d')](_0x545e44)[_0x6bca('0x1e')](_0x161a23);}};}function respondWithFilteredResult(_0x3facf7,_0x1ff7c7){return function(_0x193130){if(_0x193130){var _0x36014e=typeof _0x1ff7c7[_0x6bca('0x1f')]===_0x6bca('0x20')&&typeof _0x1ff7c7[_0x6bca('0x21')]===_0x6bca('0x20');var _0x47c7ae=_0x193130[_0x6bca('0x22')];var _0x33632e=_0x36014e?0x0:_0x1ff7c7['offset'];var _0x5c43ff=_0x36014e?_0x193130['count']:_0x1ff7c7['offset']+_0x1ff7c7['limit'];var _0x134f9d;if(_0x5c43ff>=_0x47c7ae){_0x5c43ff=_0x47c7ae;_0x134f9d=0xc8;}else{_0x134f9d=0xce;}_0x3facf7[_0x6bca('0x1d')](_0x134f9d);return _0x3facf7[_0x6bca('0x23')](_0x6bca('0x24'),_0x33632e+'-'+_0x5c43ff+'/'+_0x47c7ae)[_0x6bca('0x1e')](_0x193130);}return null;};}function patchUpdates(_0x193c45){return function(_0xfb7a16){try{jsonpatch[_0x6bca('0x25')](_0xfb7a16,_0x193c45,!![]);}catch(_0x2e5ed0){return BPromise[_0x6bca('0x26')](_0x2e5ed0);}return _0xfb7a16[_0x6bca('0x27')]();};}function saveUpdates(_0x1c6a80,_0x3ad6c1){return function(_0x71e477){if(_0x71e477){return _0x71e477[_0x6bca('0x28')](_0x1c6a80)[_0x6bca('0x29')](function(_0x3fcc4c){return _0x3fcc4c;});}return null;};}function removeEntity(_0x4f672d,_0x3fc164){return function(_0x290f10){if(_0x290f10){return _0x290f10['destroy']()[_0x6bca('0x29')](function(){_0x4f672d[_0x6bca('0x1d')](0xcc)[_0x6bca('0x2a')]();});}};}function handleEntityNotFound(_0x26b66c,_0x17f2a0){return function(_0x2e09fb){if(!_0x2e09fb){_0x26b66c[_0x6bca('0x1c')](0x194);}return _0x2e09fb;};}function handleError(_0x441e25,_0x3f0a32){_0x3f0a32=_0x3f0a32||0x1f4;return function(_0x35cab1){logger[_0x6bca('0x2b')](_0x35cab1[_0x6bca('0x2c')]);if(_0x35cab1['name']){delete _0x35cab1[_0x6bca('0x2d')];}_0x441e25[_0x6bca('0x1d')](_0x3f0a32)[_0x6bca('0x2e')](_0x35cab1);};}exports['index']=function(_0x58aee6,_0x1007d4){var _0x45da73={},_0x4328b3={},_0x131f08={'count':0x0,'rows':[]};var _0x1f2834=_['map'](db['ZohoAccount'][_0x6bca('0x2f')],function(_0xcb907d){return{'name':_0xcb907d['fieldName'],'type':_0xcb907d[_0x6bca('0x30')][_0x6bca('0x31')]};});_0x4328b3[_0x6bca('0x32')]=_[_0x6bca('0x33')](_0x1f2834,_0x6bca('0x2d'));_0x4328b3[_0x6bca('0x34')]=_[_0x6bca('0x35')](_0x58aee6[_0x6bca('0x34')]);_0x4328b3[_0x6bca('0x36')]=_['intersection'](_0x4328b3[_0x6bca('0x32')],_0x4328b3[_0x6bca('0x34')]);_0x45da73[_0x6bca('0x37')]=_['intersection'](_0x4328b3['model'],qs[_0x6bca('0x38')](_0x58aee6['query'][_0x6bca('0x38')]));_0x45da73[_0x6bca('0x37')]=_0x45da73[_0x6bca('0x37')][_0x6bca('0x39')]?_0x45da73[_0x6bca('0x37')]:_0x4328b3['model'];if(!_0x58aee6[_0x6bca('0x34')][_0x6bca('0x3a')](_0x6bca('0x3b'))){_0x45da73[_0x6bca('0x21')]=qs['limit'](_0x58aee6[_0x6bca('0x34')]['limit']);_0x45da73[_0x6bca('0x1f')]=qs[_0x6bca('0x1f')](_0x58aee6[_0x6bca('0x34')]['offset']);}_0x45da73[_0x6bca('0x3c')]=qs['sort'](_0x58aee6[_0x6bca('0x34')][_0x6bca('0x3d')]);_0x45da73['where']=qs[_0x6bca('0x36')](_[_0x6bca('0x3e')](_0x58aee6[_0x6bca('0x34')],_0x4328b3['filters']),_0x1f2834);if(_0x58aee6[_0x6bca('0x34')]['filter']){_0x45da73['where']=_[_0x6bca('0x3f')](_0x45da73['where'],{'$or':_['map'](_0x1f2834,function(_0x382446){if(_0x382446['type']!==_0x6bca('0x40')){var _0x1477ad={};_0x1477ad[_0x382446[_0x6bca('0x2d')]]={'$like':'%'+_0x58aee6[_0x6bca('0x34')]['filter']+'%'};return _0x1477ad;}})});}_0x45da73=_[_0x6bca('0x3f')]({},_0x45da73,_0x58aee6[_0x6bca('0x41')]);var _0x5dfc58={'where':_0x45da73[_0x6bca('0x42')]};return db[_0x6bca('0x43')][_0x6bca('0x22')](_0x5dfc58)[_0x6bca('0x29')](function(_0x366210){_0x131f08[_0x6bca('0x22')]=_0x366210;if(_0x58aee6[_0x6bca('0x34')]['includeAll']){_0x45da73[_0x6bca('0x44')]=[{'all':!![]}];}return db[_0x6bca('0x43')]['findAll'](_0x45da73);})['then'](function(_0x526269){_0x131f08[_0x6bca('0x45')]=_0x526269;return _0x131f08;})['then'](respondWithFilteredResult(_0x1007d4,_0x45da73))[_0x6bca('0x46')](handleError(_0x1007d4,null));};exports[_0x6bca('0x47')]=function(_0x5d408c,_0x21cf9e){var _0x2c4037={'raw':![],'where':{'id':_0x5d408c[_0x6bca('0x48')]['id']}},_0xe9c6f3={};_0xe9c6f3[_0x6bca('0x32')]=_[_0x6bca('0x35')](db['ZohoAccount'][_0x6bca('0x2f')]);_0xe9c6f3[_0x6bca('0x34')]=_['keys'](_0x5d408c[_0x6bca('0x34')]);_0xe9c6f3[_0x6bca('0x36')]=_['intersection'](_0xe9c6f3[_0x6bca('0x32')],_0xe9c6f3[_0x6bca('0x34')]);_0x2c4037[_0x6bca('0x37')]=_[_0x6bca('0x49')](_0xe9c6f3['model'],qs[_0x6bca('0x38')](_0x5d408c['query']['fields']));_0x2c4037[_0x6bca('0x37')]=_0x2c4037[_0x6bca('0x37')][_0x6bca('0x39')]?_0x2c4037['attributes']:_0xe9c6f3['model'];if(_0x5d408c[_0x6bca('0x34')][_0x6bca('0x4a')]){_0x2c4037['include']=[{'all':!![]}];}_0x2c4037=_[_0x6bca('0x3f')]({},_0x2c4037,_0x5d408c[_0x6bca('0x41')]);return db['ZohoAccount']['find'](_0x2c4037)[_0x6bca('0x29')](handleEntityNotFound(_0x21cf9e,null))['then'](respondWithResult(_0x21cf9e,null))[_0x6bca('0x46')](handleError(_0x21cf9e,null));};exports[_0x6bca('0x4b')]=function(_0x29319b,_0x189e19){return db[_0x6bca('0x43')]['create'](_0x29319b[_0x6bca('0x4c')],{})[_0x6bca('0x29')](respondWithResult(_0x189e19,0xc9))[_0x6bca('0x46')](handleError(_0x189e19,null));};exports[_0x6bca('0x28')]=function(_0x263bc2,_0x258cad){if(_0x263bc2[_0x6bca('0x4c')]['id']){delete _0x263bc2['body']['id'];}return db[_0x6bca('0x43')][_0x6bca('0x4d')]({'where':{'id':_0x263bc2[_0x6bca('0x48')]['id']}})[_0x6bca('0x29')](handleEntityNotFound(_0x258cad,null))['then'](saveUpdates(_0x263bc2['body'],null))['then'](respondWithResult(_0x258cad,null))[_0x6bca('0x46')](handleError(_0x258cad,null));};exports[_0x6bca('0x4e')]=function(_0x1871bc,_0x1210b2){return db['ZohoAccount']['find']({'where':{'id':_0x1871bc[_0x6bca('0x48')]['id']}})['then'](handleEntityNotFound(_0x1210b2,null))[_0x6bca('0x29')](removeEntity(_0x1210b2,null))[_0x6bca('0x46')](handleError(_0x1210b2,null));};exports[_0x6bca('0x4f')]=function(_0x2581ae,_0x3e068b,_0x312baa){var _0x477367={};var _0x3ff46a={};var _0x1fe1e0;var _0x34b2ce;return db[_0x6bca('0x43')][_0x6bca('0x50')]({'where':{'id':_0x2581ae['params']['id']}})[_0x6bca('0x29')](handleEntityNotFound(_0x3e068b,null))[_0x6bca('0x29')](function(_0x5463cc){if(_0x5463cc){_0x1fe1e0=_0x5463cc;_0x3ff46a[_0x6bca('0x32')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x3ff46a[_0x6bca('0x34')]=_[_0x6bca('0x35')](_0x2581ae[_0x6bca('0x34')]);_0x3ff46a[_0x6bca('0x36')]=_[_0x6bca('0x49')](_0x3ff46a[_0x6bca('0x32')],_0x3ff46a[_0x6bca('0x34')]);_0x477367['attributes']=_[_0x6bca('0x49')](_0x3ff46a[_0x6bca('0x32')],qs['fields'](_0x2581ae['query'][_0x6bca('0x38')]));_0x477367['attributes']=_0x477367[_0x6bca('0x37')][_0x6bca('0x39')]?_0x477367['attributes']:_0x3ff46a[_0x6bca('0x32')];_0x477367[_0x6bca('0x3c')]=qs[_0x6bca('0x3d')](_0x2581ae[_0x6bca('0x34')][_0x6bca('0x3d')]);_0x477367[_0x6bca('0x42')]=qs[_0x6bca('0x36')](_['pick'](_0x2581ae[_0x6bca('0x34')],_0x3ff46a[_0x6bca('0x36')]));if(_0x2581ae['query'][_0x6bca('0x51')]){_0x477367[_0x6bca('0x42')]=_[_0x6bca('0x3f')](_0x477367['where'],{'$or':_[_0x6bca('0x33')](_0x477367[_0x6bca('0x37')],function(_0x5e17ca){var _0x187e1f={};_0x187e1f[_0x5e17ca]={'$like':'%'+_0x2581ae[_0x6bca('0x34')]['filter']+'%'};return _0x187e1f;})});}_0x477367=_[_0x6bca('0x3f')]({},_0x477367,_0x2581ae[_0x6bca('0x41')]);return _0x1fe1e0[_0x6bca('0x4f')](_0x477367);}})[_0x6bca('0x29')](function(_0x58d769){if(_0x58d769){_0x34b2ce=_0x58d769[_0x6bca('0x39')];if(!_0x2581ae[_0x6bca('0x34')]['hasOwnProperty'](_0x6bca('0x3b'))){_0x477367['limit']=qs[_0x6bca('0x21')](_0x2581ae[_0x6bca('0x34')][_0x6bca('0x21')]);_0x477367[_0x6bca('0x1f')]=qs[_0x6bca('0x1f')](_0x2581ae['query'][_0x6bca('0x1f')]);}return _0x1fe1e0[_0x6bca('0x4f')](_0x477367);}})[_0x6bca('0x29')](function(_0x25183c){if(_0x25183c){return _0x25183c?{'count':_0x34b2ce,'rows':_0x25183c}:null;}})[_0x6bca('0x29')](respondWithResult(_0x3e068b,null))[_0x6bca('0x46')](handleError(_0x3e068b,null));};exports[_0x6bca('0x52')]=function(_0x2fe017,_0x164c2a,_0x42fa91){if(_0x2fe017[_0x6bca('0x4c')]['id']){delete _0x2fe017[_0x6bca('0x4c')]['id'];}return db[_0x6bca('0x43')][_0x6bca('0x50')]({'where':{'id':_0x2fe017[_0x6bca('0x48')]['id']}})[_0x6bca('0x29')](handleEntityNotFound(_0x164c2a,null))['then'](function(_0x7d8873){if(_0x7d8873){_0x2fe017[_0x6bca('0x4c')][_0x6bca('0x53')]=_0x7d8873['id'];_0x2fe017[_0x6bca('0x4c')][_0x6bca('0x54')]=integrations[_0x6bca('0x55')](_0x2fe017['body']['channel'],_0x2fe017[_0x6bca('0x4c')][_0x6bca('0x30')]);_0x2fe017[_0x6bca('0x4c')][_0x6bca('0x56')]=integrations[_0x6bca('0x57')](_0x2fe017['body'][_0x6bca('0x58')],_0x2fe017[_0x6bca('0x4c')][_0x6bca('0x30')]);return db[_0x6bca('0x59')][_0x6bca('0x4b')](_0x2fe017[_0x6bca('0x4c')],{'include':[{'model':db[_0x6bca('0x5a')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x6bca('0x56')}]});}return null;})['then'](respondWithResult(_0x164c2a,null))[_0x6bca('0x46')](handleError(_0x164c2a,null));};function getAccessToken(_0x2b0391){return new Promise(function(_0x50a1bb,_0x5a2349){var _0x119111;switch(_0x2b0391['zone']){case'US':_0x119111=_0x6bca('0x5b');break;case'AU':_0x119111=_0x6bca('0x5c');break;case'EU':_0x119111='https://accounts.zoho.eu';break;case'IN':_0x119111=_0x6bca('0x5d');break;case'CN':_0x119111=_0x6bca('0x5e');break;default:_0x119111=_0x6bca('0x5f');break;}var _0x10b58b={'method':_0x6bca('0x60'),'uri':_0x119111+_0x6bca('0x61'),'qs':{'refresh_token':_0x2b0391[_0x6bca('0x62')],'client_id':_0x2b0391[_0x6bca('0x63')],'client_secret':_0x2b0391[_0x6bca('0x64')],'grant_type':_0x6bca('0x65')},'json':!![]};return rp(_0x10b58b)[_0x6bca('0x29')](function(_0x154961){if(_0x154961[_0x6bca('0x66')]){_0x50a1bb(_0x154961[_0x6bca('0x66')]);}else{_0x5a2349('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x8a31b5){_0x5a2349(_0x8a31b5);});});}exports[_0x6bca('0x67')]=function(_0x2ad47c,_0x57edbc,_0x4c37de){var _0x3e3214,_0x3e4541,_0xacc07d,_0xb8723e,_0x5e07ce;return db[_0x6bca('0x43')][_0x6bca('0x50')]({'where':{'id':_0x2ad47c['params']['id']},'attributes':['id',_0x6bca('0x68'),_0x6bca('0x69'),_0x6bca('0x63'),_0x6bca('0x64'),_0x6bca('0x6a'),'code',_0x6bca('0x62')]})[_0x6bca('0x29')](handleEntityNotFound(_0x57edbc,null))[_0x6bca('0x29')](function(_0x102c8c){_0x5e07ce=_0x102c8c;_0x3e3214=_0x5e07ce[_0x6bca('0x68')];_0x3e4541=_0x3e3214===_0x6bca('0x6b')?'eu':_0x6bca('0x6c');_0xacc07d=_0x5e07ce['serverUrl'];var _0x40677c=_0xacc07d['slice'](-0x1);if(_0x40677c==='/'||_0x40677c==='\x5c'||_0x40677c===':'){_0xacc07d=_0xacc07d[_0x6bca('0x6d')](0x0,_0xacc07d[_0x6bca('0x6e')](_0x40677c));}if(!_0x5e07ce[_0x6bca('0x62')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5e07ce);})[_0x6bca('0x29')](function(_0x5d3529){if(_0x5d3529){return rp({'method':_0x6bca('0x6f'),'uri':util[_0x6bca('0x70')](_0x6bca('0x71'),_0x3e4541),'qs':{'module':_0x6bca('0x72')},'headers':{'Authorization':_0x6bca('0x73')+_0x5d3529},'json':!![]});}})['then'](function(_0x40a48e){if(_0x40a48e){if(_0x40a48e[_0x6bca('0x74')]&&_0x40a48e[_0x6bca('0x74')][_0x6bca('0x2b')]){throw new Error(_0x40a48e[_0x6bca('0x74')]['error'][_0x6bca('0x75')]);}var _0x14a84c=[];var _0xbdf67c=[];var _0x2b24a1=[_0x6bca('0x76'),'Subject',_0x6bca('0x77'),_0x6bca('0x78'),'Call_Duration',_0x6bca('0x79'),'Call_Start_Time',_0x6bca('0x7a')];_0xbdf67c=_['remove'](_0x40a48e['fields'],function(_0x41be02){return _0x2b24a1[_0x6bca('0x7b')](_0x41be02['api_name']);});for(var _0x4fcf1b=0x0;_0x4fcf1b<_0xbdf67c['length'];_0x4fcf1b++){if(_0xbdf67c[_0x4fcf1b][_0x6bca('0x7c')]===![]){_0x14a84c[_0x6bca('0x7d')]({'id':_0xbdf67c[_0x4fcf1b]['id'],'name':_0xbdf67c[_0x4fcf1b]['display_label'],'custom':_0xbdf67c[_0x4fcf1b][_0x6bca('0x7e')],'options':_0xbdf67c[_0x4fcf1b]['data_type']===_0x6bca('0x7f')&&_0xbdf67c[_0x4fcf1b][_0x6bca('0x80')][_0x6bca('0x39')]>-0x1?_['map'](_0xbdf67c[_0x4fcf1b][_0x6bca('0x80')],function(_0x11a7bd){return{'name':_0x11a7bd,'value':_0x11a7bd};}):[]});}}return{'count':_0x14a84c[_0x6bca('0x39')],'rows':_0x14a84c};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x57edbc,null))[_0x6bca('0x46')](function(_0x4ffd14){var _0x2ad41c=_0x2ad47c[_0x6bca('0x34')][_0x6bca('0x81')]?0x1f4:_0x4ffd14[_0x6bca('0x82')]||0x1f4;logger[_0x6bca('0x2b')](_0x6bca('0x83'),'getFields',_0x2ad41c,JSON['stringify'](_0x4ffd14));delete _0x4ffd14[_0x6bca('0x2d')];if(_0x2ad41c===0x191){_0x2ad41c=0x190;}_0x57edbc[_0x6bca('0x1d')](_0x2ad41c)[_0x6bca('0x2e')](_0x2ad47c[_0x6bca('0x34')][_0x6bca('0x81')]?{'message':_0x6bca('0x84'),'statusCode':_0x4ffd14['statusCode']}:_0x4ffd14);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 163e468..ae74d77 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 _0x462f=['https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','serverUrl','clientId','https://accounts.zoho.com','refreshToken','lodash','util','api','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x462f,0x1cb));var _0xf462=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x462f[_0x93942f];return _0x23fcd8;};'use strict';var _=require(_0xf462('0x0'));var util=require(_0xf462('0x1'));var logger=require('../../config/logger')(_0xf462('0x2'));var moment=require('moment');var BPromise=require(_0xf462('0x3'));var rp=require(_0xf462('0x4'));var fs=require('fs');var path=require(_0xf462('0x5'));var rimraf=require(_0xf462('0x6'));var config=require('../../config/environment');var attributes=require(_0xf462('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xf462('0x8')]=function(_0x191bd0,_0x3d0e5e){return _0x191bd0[_0xf462('0x9')](_0xf462('0xa'),attributes,{'tableName':_0xf462('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x28f6a1,_0x562311,_0x3b0079){if(_0x28f6a1[_0xf462('0xc')](_0xf462('0xd'))||_0x28f6a1[_0xf462('0xc')]('serverUrl')||_0x28f6a1[_0xf462('0xc')]('clientId')||_0x28f6a1[_0xf462('0xc')](_0xf462('0xe'))||_0x28f6a1[_0xf462('0xc')]('code')||_0x28f6a1['changed']('host')){var _0x515dea,_0x4ec7e7;_0x515dea=_0x28f6a1['serverUrl'];var _0x385a09=_0x515dea[_0xf462('0xf')](-0x1);if(_0x385a09==='/'||_0x385a09==='\x5c'||_0x385a09===':'){_0x515dea=_0x515dea[_0xf462('0x10')](0x0,_0x515dea[_0xf462('0x11')](_0x385a09));}switch(_0x28f6a1['zone']){case'US':_0x4ec7e7='https://accounts.zoho.com';break;case'AU':_0x4ec7e7=_0xf462('0x12');break;case'IN':_0x4ec7e7=_0xf462('0x13');break;case'CN':_0x4ec7e7=_0xf462('0x14');break;default:_0x4ec7e7=_0xf462('0x15');break;}var _0x317153={'method':_0xf462('0x16'),'uri':_0x4ec7e7+_0xf462('0x17'),'form':{'grant_type':_0xf462('0x18'),'client_id':_0x28f6a1['clientId'],'client_secret':_0x28f6a1[_0xf462('0xe')],'redirect_uri':_0x28f6a1['serverUrl'],'code':_0x28f6a1[_0xf462('0x19')]},'headers':{'Content-Type':_0xf462('0x1a')}};return rp(_0x317153)[_0xf462('0x1b')](function(_0x3e2998){var _0xf63d0c=JSON['parse'](_0x3e2998);if(_0xf63d0c[_0xf462('0x1c')]){_0x28f6a1['refreshToken']=_0xf63d0c[_0xf462('0x1c')];logger['info'](util[_0xf462('0x1d')](_0xf462('0x1e'),_0x28f6a1[_0xf462('0x1f')],_0x28f6a1['id']));}else{logger[_0xf462('0x20')](util[_0xf462('0x1d')](_0xf462('0x21'),_0x28f6a1[_0xf462('0x1f')],_0x28f6a1['id']),util[_0xf462('0x22')](_0xf63d0c,{'showHidden':![],'depth':null}));}return _0x3b0079(null,_0x562311);})[_0xf462('0x23')](function(_0x419a72){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x28f6a1[_0xf462('0x1f')],_0x28f6a1['id']),util[_0xf462('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x3b0079(_0x419a72);});}else{return _0x3b0079(null,_0x562311);}},'beforeUpdate':function(_0x42f406,_0x536ac5,_0x5f5b34){if(_0x42f406['changed'](_0xf462('0xd'))||_0x42f406[_0xf462('0xc')](_0xf462('0x24'))||_0x42f406[_0xf462('0xc')](_0xf462('0x25'))||_0x42f406[_0xf462('0xc')]('clientSecret')||_0x42f406[_0xf462('0xc')](_0xf462('0x19'))||_0x42f406[_0xf462('0xc')]('host')){var _0x5b2f4c,_0x2dc9e9;_0x5b2f4c=_0x42f406['serverUrl'];var _0x13a96d=_0x5b2f4c[_0xf462('0xf')](-0x1);if(_0x13a96d==='/'||_0x13a96d==='\x5c'||_0x13a96d===':'){_0x5b2f4c=_0x5b2f4c['substring'](0x0,_0x5b2f4c['lastIndexOf'](_0x13a96d));}switch(_0x42f406['zone']){case'US':_0x2dc9e9=_0xf462('0x26');break;case'AU':_0x2dc9e9=_0xf462('0x12');break;case'IN':_0x2dc9e9=_0xf462('0x13');break;case'CN':_0x2dc9e9=_0xf462('0x14');break;default:_0x2dc9e9=_0xf462('0x15');break;}var _0xc2515d={'method':_0xf462('0x16'),'uri':_0x2dc9e9+'/oauth/v2/token','form':{'grant_type':_0xf462('0x18'),'client_id':_0x42f406[_0xf462('0x25')],'client_secret':_0x42f406[_0xf462('0xe')],'redirect_uri':_0x42f406[_0xf462('0x24')],'code':_0x42f406[_0xf462('0x19')]},'headers':{'Content-Type':_0xf462('0x1a')}};return rp(_0xc2515d)[_0xf462('0x1b')](function(_0x4b5864){var _0x48eece=JSON['parse'](_0x4b5864);if(_0x48eece['refresh_token']){_0x42f406[_0xf462('0x27')]=_0x48eece[_0xf462('0x1c')];logger['info'](util[_0xf462('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x42f406[_0xf462('0x1f')],_0x42f406['id']));}else{logger[_0xf462('0x20')](util[_0xf462('0x1d')](_0xf462('0x21'),_0x42f406['name'],_0x42f406['id']),util['inspect'](_0x48eece,{'showHidden':![],'depth':null}));}return _0x5f5b34(null,_0x536ac5);})[_0xf462('0x23')](function(_0x42aefc){logger[_0xf462('0x20')](util[_0xf462('0x1d')](_0xf462('0x21'),_0x42f406['name'],_0x42f406['id']),util[_0xf462('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x5f5b34(_0x42aefc);});}else{return _0x5f5b34(null,_0x536ac5);}}}});}; \ No newline at end of file +var _0x57cd=['substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','moment','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','host','slice'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x57cd,0xe5));var _0xd57c=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0x57cd[_0x216d45];return _0xbaac0b;};'use strict';var _=require('lodash');var util=require(_0xd57c('0x0'));var logger=require(_0xd57c('0x1'))('api');var moment=require(_0xd57c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd57c('0x3'));var rimraf=require(_0xd57c('0x4'));var config=require('../../config/environment');var attributes=require(_0xd57c('0x5'));var integrations=require(_0xd57c('0x6'));module['exports']=function(_0x39dc7c,_0x4a772f){return _0x39dc7c[_0xd57c('0x7')](_0xd57c('0x8'),attributes,{'tableName':_0xd57c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f83e8,_0x59aa3d,_0x1f044a){if(_0x4f83e8['changed'](_0xd57c('0xa'))||_0x4f83e8[_0xd57c('0xb')](_0xd57c('0xc'))||_0x4f83e8[_0xd57c('0xb')](_0xd57c('0xd'))||_0x4f83e8[_0xd57c('0xb')](_0xd57c('0xe'))||_0x4f83e8['changed']('code')||_0x4f83e8[_0xd57c('0xb')](_0xd57c('0xf'))){var _0x3ec7cc,_0x481a69;_0x3ec7cc=_0x4f83e8['serverUrl'];var _0x52901f=_0x3ec7cc[_0xd57c('0x10')](-0x1);if(_0x52901f==='/'||_0x52901f==='\x5c'||_0x52901f===':'){_0x3ec7cc=_0x3ec7cc[_0xd57c('0x11')](0x0,_0x3ec7cc[_0xd57c('0x12')](_0x52901f));}switch(_0x4f83e8[_0xd57c('0xa')]){case'US':_0x481a69=_0xd57c('0x13');break;case'AU':_0x481a69=_0xd57c('0x14');break;case'IN':_0x481a69=_0xd57c('0x15');break;case'CN':_0x481a69=_0xd57c('0x16');break;default:_0x481a69=_0xd57c('0x17');break;}var _0x806090={'method':_0xd57c('0x18'),'uri':_0x481a69+_0xd57c('0x19'),'form':{'grant_type':_0xd57c('0x1a'),'client_id':_0x4f83e8[_0xd57c('0xd')],'client_secret':_0x4f83e8['clientSecret'],'redirect_uri':_0x4f83e8[_0xd57c('0xc')],'code':_0x4f83e8[_0xd57c('0x1b')]},'headers':{'Content-Type':_0xd57c('0x1c')}};return rp(_0x806090)[_0xd57c('0x1d')](function(_0x3281c7){var _0xa85888=JSON[_0xd57c('0x1e')](_0x3281c7);if(_0xa85888[_0xd57c('0x1f')]){_0x4f83e8[_0xd57c('0x20')]=_0xa85888[_0xd57c('0x1f')];logger[_0xd57c('0x21')](util[_0xd57c('0x22')](_0xd57c('0x23'),_0x4f83e8[_0xd57c('0x24')],_0x4f83e8['id']));}else{logger[_0xd57c('0x25')](util[_0xd57c('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4f83e8[_0xd57c('0x24')],_0x4f83e8['id']),util[_0xd57c('0x26')](_0xa85888,{'showHidden':![],'depth':null}));}return _0x1f044a(null,_0x59aa3d);})[_0xd57c('0x27')](function(_0x6d6f9b){logger['error'](util['format'](_0xd57c('0x28'),_0x4f83e8[_0xd57c('0x24')],_0x4f83e8['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1f044a(_0x6d6f9b);});}else{return _0x1f044a(null,_0x59aa3d);}},'beforeUpdate':function(_0x5d653c,_0x1f3e91,_0x2bad2d){if(_0x5d653c['changed']('zone')||_0x5d653c['changed'](_0xd57c('0xc'))||_0x5d653c[_0xd57c('0xb')](_0xd57c('0xd'))||_0x5d653c[_0xd57c('0xb')](_0xd57c('0xe'))||_0x5d653c[_0xd57c('0xb')](_0xd57c('0x1b'))||_0x5d653c[_0xd57c('0xb')](_0xd57c('0xf'))){var _0x2747e5,_0x9ff707;_0x2747e5=_0x5d653c['serverUrl'];var _0x5805b5=_0x2747e5[_0xd57c('0x10')](-0x1);if(_0x5805b5==='/'||_0x5805b5==='\x5c'||_0x5805b5===':'){_0x2747e5=_0x2747e5['substring'](0x0,_0x2747e5['lastIndexOf'](_0x5805b5));}switch(_0x5d653c[_0xd57c('0xa')]){case'US':_0x9ff707=_0xd57c('0x13');break;case'AU':_0x9ff707=_0xd57c('0x14');break;case'IN':_0x9ff707=_0xd57c('0x15');break;case'CN':_0x9ff707=_0xd57c('0x16');break;default:_0x9ff707=_0xd57c('0x17');break;}var _0x287ab1={'method':'POST','uri':_0x9ff707+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x5d653c[_0xd57c('0xd')],'client_secret':_0x5d653c[_0xd57c('0xe')],'redirect_uri':_0x5d653c[_0xd57c('0xc')],'code':_0x5d653c['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x287ab1)['then'](function(_0x308383){var _0x16f576=JSON[_0xd57c('0x1e')](_0x308383);if(_0x16f576['refresh_token']){_0x5d653c[_0xd57c('0x20')]=_0x16f576[_0xd57c('0x1f')];logger[_0xd57c('0x21')](util['format'](_0xd57c('0x23'),_0x5d653c['name'],_0x5d653c['id']));}else{logger[_0xd57c('0x25')](util[_0xd57c('0x22')](_0xd57c('0x28'),_0x5d653c[_0xd57c('0x24')],_0x5d653c['id']),util['inspect'](_0x16f576,{'showHidden':![],'depth':null}));}return _0x2bad2d(null,_0x1f3e91);})[_0xd57c('0x27')](function(_0x291fb1){logger['error'](util[_0xd57c('0x22')](_0xd57c('0x28'),_0x5d653c[_0xd57c('0x24')],_0x5d653c['id']),util[_0xd57c('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x2bad2d(_0x291fb1);});}else{return _0x2bad2d(null,_0x1f3e91);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b94f4fc..5590b7c 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 _0x75ea=['error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','limit','map','include','model','attributes','then','info','find','raw','where','ShowZohoAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x3185af,_0x58ae43){var _0x1c4e3c=function(_0x54b09e){while(--_0x54b09e){_0x3185af['push'](_0x3185af['shift']());}};_0x1c4e3c(++_0x58ae43);}(_0x75ea,0x7d));var _0xa75e=function(_0x566c5a,_0x14e8c2){_0x566c5a=_0x566c5a-0x0;var _0x40ca3c=_0x75ea[_0x566c5a];return _0x40ca3c;};'use strict';var _=require(_0xa75e('0x0'));var util=require(_0xa75e('0x1'));var moment=require('moment');var BPromise=require(_0xa75e('0x2'));var rs=require(_0xa75e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa75e('0x4'))['db'];var utils=require(_0xa75e('0x5'));var logger=require(_0xa75e('0x6'))(_0xa75e('0x7'));var config=require(_0xa75e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa75e('0x9')][_0xa75e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f666f,_0x2c71ef,_0x148a23){return new BPromise(function(_0x31a28d,_0x351164){return client['request'](_0x1f666f,_0x148a23)['then'](function(_0x560baa){logger['info'](_0xa75e('0xb'),_0x2c71ef,'request\x20sent');logger[_0xa75e('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2c71ef,_0xa75e('0xd'),JSON[_0xa75e('0xe')](_0x560baa));if(_0x560baa['error']){if(_0x560baa[_0xa75e('0xf')][_0xa75e('0x10')]===0x1f4){logger[_0xa75e('0xf')](_0xa75e('0xb'),_0x2c71ef,_0x560baa[_0xa75e('0xf')][_0xa75e('0x11')]);return _0x351164(_0x560baa[_0xa75e('0xf')][_0xa75e('0x11')]);}logger[_0xa75e('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2c71ef,_0x560baa[_0xa75e('0xf')]['message']);return _0x31a28d(_0x560baa[_0xa75e('0xf')][_0xa75e('0x11')]);}else{logger['info'](_0xa75e('0xb'),_0x2c71ef,_0xa75e('0xd'));_0x31a28d(_0x560baa[_0xa75e('0x12')]['message']);}})[_0xa75e('0x13')](function(_0x315fde){logger[_0xa75e('0xf')](_0xa75e('0xb'),_0x2c71ef,_0x315fde);_0x351164(_0x315fde);});});}exports[_0xa75e('0x14')]=function(_0x71fd71){var _0x34c0c2=this;return new Promise(function(_0x44a786,_0x5812ba){return db[_0xa75e('0x15')][_0xa75e('0x16')]({'raw':_0x71fd71[_0xa75e('0x17')]?_0x71fd71['options']['raw']===undefined?!![]:![]:!![],'where':_0x71fd71[_0xa75e('0x17')]?_0x71fd71['options']['where']||null:null,'attributes':_0x71fd71['options']?_0x71fd71[_0xa75e('0x17')]['attributes']||null:null,'limit':_0x71fd71[_0xa75e('0x17')]?_0x71fd71['options'][_0xa75e('0x18')]||null:null,'include':_0x71fd71[_0xa75e('0x17')]?_0x71fd71[_0xa75e('0x17')]['include']?_[_0xa75e('0x19')](_0x71fd71[_0xa75e('0x17')][_0xa75e('0x1a')],function(_0x4e64aa){return{'model':db[_0x4e64aa[_0xa75e('0x1b')]],'as':_0x4e64aa['as'],'attributes':_0x4e64aa[_0xa75e('0x1c')],'include':_0x4e64aa[_0xa75e('0x1a')]?_[_0xa75e('0x19')](_0x4e64aa[_0xa75e('0x1a')],function(_0x29c9df){return{'model':db[_0x29c9df[_0xa75e('0x1b')]],'as':_0x29c9df['as'],'attributes':_0x29c9df[_0xa75e('0x1c')],'include':_0x29c9df[_0xa75e('0x1a')]?_['map'](_0x29c9df['include'],function(_0x278e4a){return{'model':db[_0x278e4a[_0xa75e('0x1b')]],'as':_0x278e4a['as'],'attributes':_0x278e4a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa75e('0x1d')](function(_0x316197){logger[_0xa75e('0x1e')](_0xa75e('0x14'),_0x71fd71);logger[_0xa75e('0xc')](_0xa75e('0x14'),_0x71fd71,JSON['stringify'](_0x316197));_0x44a786(_0x316197);})[_0xa75e('0x13')](function(_0x15241f){logger[_0xa75e('0xf')](_0xa75e('0x14'),_0x15241f[_0xa75e('0x11')],_0x71fd71);_0x5812ba(_0x34c0c2['error'](0x1f4,_0x15241f[_0xa75e('0x11')]));});});};exports['ShowZohoAccount']=function(_0x5799d8){var _0xf86d31=this;return new Promise(function(_0x2a6c74,_0x207be3){return db[_0xa75e('0x15')][_0xa75e('0x1f')]({'raw':_0x5799d8[_0xa75e('0x17')]?_0x5799d8[_0xa75e('0x17')][_0xa75e('0x20')]===undefined?!![]:![]:!![],'where':_0x5799d8[_0xa75e('0x17')]?_0x5799d8[_0xa75e('0x17')][_0xa75e('0x21')]||null:null,'attributes':_0x5799d8[_0xa75e('0x17')]?_0x5799d8[_0xa75e('0x17')]['attributes']||null:null,'include':_0x5799d8[_0xa75e('0x17')]?_0x5799d8[_0xa75e('0x17')][_0xa75e('0x1a')]?_[_0xa75e('0x19')](_0x5799d8[_0xa75e('0x17')][_0xa75e('0x1a')],function(_0x5c1200){return{'model':db[_0x5c1200['model']],'as':_0x5c1200['as'],'attributes':_0x5c1200['attributes'],'include':_0x5c1200[_0xa75e('0x1a')]?_['map'](_0x5c1200['include'],function(_0x2824d0){return{'model':db[_0x2824d0['model']],'as':_0x2824d0['as'],'attributes':_0x2824d0[_0xa75e('0x1c')],'include':_0x2824d0[_0xa75e('0x1a')]?_[_0xa75e('0x19')](_0x2824d0[_0xa75e('0x1a')],function(_0x4a9356){return{'model':db[_0x4a9356[_0xa75e('0x1b')]],'as':_0x4a9356['as'],'attributes':_0x4a9356[_0xa75e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa75e('0x1d')](function(_0x5f3d8f){logger['info'](_0xa75e('0x22'),_0x5799d8);logger[_0xa75e('0xc')]('ShowZohoAccount',_0x5799d8,JSON[_0xa75e('0xe')](_0x5f3d8f));_0x2a6c74(_0x5f3d8f);})[_0xa75e('0x13')](function(_0x582d73){logger[_0xa75e('0xf')](_0xa75e('0x22'),_0x582d73['message'],_0x5799d8);_0x207be3(_0xf86d31[_0xa75e('0xf')](0x1f4,_0x582d73[_0xa75e('0x11')]));});});}; \ No newline at end of file +var _0x8b0e=['attributes','include','map','model','stringify','ShowZohoAccount','ZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetZohoAccount','options','raw','where'];(function(_0x28e103,_0x4e7e89){var _0xb2f152=function(_0x4e7100){while(--_0x4e7100){_0x28e103['push'](_0x28e103['shift']());}};_0xb2f152(++_0x4e7e89);}(_0x8b0e,0x166));var _0xe8b0=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0x8b0e[_0x291aaf];return _0x5571e6;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var moment=require(_0xe8b0('0x2'));var BPromise=require(_0xe8b0('0x3'));var rs=require(_0xe8b0('0x4'));var fs=require('fs');var Redis=require(_0xe8b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8b0('0x6'));var logger=require('../../config/logger')(_0xe8b0('0x7'));var config=require(_0xe8b0('0x8'));var jayson=require(_0xe8b0('0x9'));var client=jayson[_0xe8b0('0xa')][_0xe8b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35fe3d,_0x25faf7,_0x2e56f4){return new BPromise(function(_0x59f3a4,_0x103966){return client[_0xe8b0('0xc')](_0x35fe3d,_0x2e56f4)[_0xe8b0('0xd')](function(_0x82589f){logger[_0xe8b0('0xe')](_0xe8b0('0xf'),_0x25faf7,_0xe8b0('0x10'));logger[_0xe8b0('0x11')](_0xe8b0('0x12'),_0x25faf7,'request\x20sent',JSON['stringify'](_0x82589f));if(_0x82589f[_0xe8b0('0x13')]){if(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x14')]===0x1f4){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);return _0x103966(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}logger[_0xe8b0('0x13')](_0xe8b0('0xf'),_0x25faf7,_0x82589f['error'][_0xe8b0('0x15')]);return _0x59f3a4(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}else{logger['info'](_0xe8b0('0xf'),_0x25faf7,'request\x20sent');_0x59f3a4(_0x82589f['result']['message']);}})[_0xe8b0('0x16')](function(_0x3818a7){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x3818a7);_0x103966(_0x3818a7);});});}exports[_0xe8b0('0x17')]=function(_0x1345b3){var _0x27da42=this;return new Promise(function(_0x34f3b2,_0x17af0c){return db['ZohoAccount']['findAll']({'raw':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')][_0xe8b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')][_0xe8b0('0x1a')]||null:null,'attributes':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')][_0xe8b0('0x1b')]||null:null,'limit':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')]['limit']||null:null,'include':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')][_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x1345b3['options'][_0xe8b0('0x1c')],function(_0x292f81){return{'model':db[_0x292f81['model']],'as':_0x292f81['as'],'attributes':_0x292f81[_0xe8b0('0x1b')],'include':_0x292f81[_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x292f81[_0xe8b0('0x1c')],function(_0x58c536){return{'model':db[_0x58c536[_0xe8b0('0x1e')]],'as':_0x58c536['as'],'attributes':_0x58c536[_0xe8b0('0x1b')],'include':_0x58c536[_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x58c536[_0xe8b0('0x1c')],function(_0x2ba170){return{'model':db[_0x2ba170[_0xe8b0('0x1e')]],'as':_0x2ba170['as'],'attributes':_0x2ba170[_0xe8b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe8b0('0xd')](function(_0x168430){logger[_0xe8b0('0xe')]('GetZohoAccount',_0x1345b3);logger['debug'](_0xe8b0('0x17'),_0x1345b3,JSON[_0xe8b0('0x1f')](_0x168430));_0x34f3b2(_0x168430);})[_0xe8b0('0x16')](function(_0x3d80d7){logger[_0xe8b0('0x13')]('GetZohoAccount',_0x3d80d7[_0xe8b0('0x15')],_0x1345b3);_0x17af0c(_0x27da42['error'](0x1f4,_0x3d80d7[_0xe8b0('0x15')]));});});};exports[_0xe8b0('0x20')]=function(_0x3bee1b){var _0x180f65=this;return new Promise(function(_0x573275,_0x3b0c2d){return db[_0xe8b0('0x21')][_0xe8b0('0x22')]({'raw':_0x3bee1b[_0xe8b0('0x18')]?_0x3bee1b[_0xe8b0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3bee1b[_0xe8b0('0x18')]?_0x3bee1b['options'][_0xe8b0('0x1a')]||null:null,'attributes':_0x3bee1b[_0xe8b0('0x18')]?_0x3bee1b[_0xe8b0('0x18')][_0xe8b0('0x1b')]||null:null,'include':_0x3bee1b['options']?_0x3bee1b[_0xe8b0('0x18')][_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x3bee1b[_0xe8b0('0x18')][_0xe8b0('0x1c')],function(_0x42dc7e){return{'model':db[_0x42dc7e[_0xe8b0('0x1e')]],'as':_0x42dc7e['as'],'attributes':_0x42dc7e[_0xe8b0('0x1b')],'include':_0x42dc7e[_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x42dc7e[_0xe8b0('0x1c')],function(_0xd6da13){return{'model':db[_0xd6da13[_0xe8b0('0x1e')]],'as':_0xd6da13['as'],'attributes':_0xd6da13[_0xe8b0('0x1b')],'include':_0xd6da13[_0xe8b0('0x1c')]?_['map'](_0xd6da13[_0xe8b0('0x1c')],function(_0x2b3c7c){return{'model':db[_0x2b3c7c['model']],'as':_0x2b3c7c['as'],'attributes':_0x2b3c7c[_0xe8b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe8b0('0xd')](function(_0x17b733){logger[_0xe8b0('0xe')]('ShowZohoAccount',_0x3bee1b);logger['debug'](_0xe8b0('0x20'),_0x3bee1b,JSON['stringify'](_0x17b733));_0x573275(_0x17b733);})[_0xe8b0('0x16')](function(_0x296510){logger['error'](_0xe8b0('0x20'),_0x296510[_0xe8b0('0x15')],_0x3bee1b);_0x3b0c2d(_0x180f65['error'](0x1f4,_0x296510['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index b726dd9..1cfa150 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 _0x0fcc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0xa121e,_0xfea98c){var _0x2c3743=function(_0x3c252f){while(--_0x3c252f){_0xa121e['push'](_0xa121e['shift']());}};_0x2c3743(++_0xfea98c);}(_0x0fcc,0x127));var _0xc0fc=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0x0fcc[_0x3f94f9];return _0x46f84f;};'use strict';var multer=require(_0xc0fc('0x0'));var util=require(_0xc0fc('0x1'));var path=require(_0xc0fc('0x2'));var timeout=require(_0xc0fc('0x3'));var express=require(_0xc0fc('0x4'));var router=express[_0xc0fc('0x5')]();var fs_extra=require(_0xc0fc('0x6'));var auth=require(_0xc0fc('0x7'));var interaction=require(_0xc0fc('0x8'));var config=require(_0xc0fc('0x9'));var controller=require(_0xc0fc('0xa'));router[_0xc0fc('0xb')]('/',auth[_0xc0fc('0xc')](),controller[_0xc0fc('0xd')]);router['get'](_0xc0fc('0xe'),auth[_0xc0fc('0xc')](),controller[_0xc0fc('0xf')]);router[_0xc0fc('0xb')](_0xc0fc('0x10'),auth[_0xc0fc('0xc')](),controller['getFields']);router['get'](_0xc0fc('0x11'),auth[_0xc0fc('0xc')](),controller[_0xc0fc('0x12')]);router[_0xc0fc('0xb')](_0xc0fc('0x13'),auth[_0xc0fc('0xc')](),controller['getDescriptions']);router[_0xc0fc('0x14')]('/',auth[_0xc0fc('0xc')](),controller[_0xc0fc('0x15')]);router['put']('/:id',auth[_0xc0fc('0xc')](),controller[_0xc0fc('0x16')]);router[_0xc0fc('0x17')]('/:id',auth[_0xc0fc('0xc')](),controller[_0xc0fc('0x18')]);module['exports']=router; \ No newline at end of file +var _0xa972=['/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','getFields','getSubjects'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0xa972,0xd6));var _0x2a97=function(_0xa756a8,_0x414f4b){_0xa756a8=_0xa756a8-0x0;var _0x117428=_0xa972[_0xa756a8];return _0x117428;};'use strict';var multer=require(_0x2a97('0x0'));var util=require(_0x2a97('0x1'));var path=require(_0x2a97('0x2'));var timeout=require(_0x2a97('0x3'));var express=require(_0x2a97('0x4'));var router=express[_0x2a97('0x5')]();var fs_extra=require(_0x2a97('0x6'));var auth=require(_0x2a97('0x7'));var interaction=require(_0x2a97('0x8'));var config=require(_0x2a97('0x9'));var controller=require(_0x2a97('0xa'));router[_0x2a97('0xb')]('/',auth[_0x2a97('0xc')](),controller['index']);router['get'](_0x2a97('0xd'),auth[_0x2a97('0xc')](),controller['show']);router[_0x2a97('0xb')]('/:id/fields',auth[_0x2a97('0xc')](),controller[_0x2a97('0xe')]);router[_0x2a97('0xb')]('/:id/subjects',auth[_0x2a97('0xc')](),controller[_0x2a97('0xf')]);router['get'](_0x2a97('0x10'),auth[_0x2a97('0xc')](),controller[_0x2a97('0x11')]);router[_0x2a97('0x12')]('/',auth[_0x2a97('0xc')](),controller['create']);router[_0x2a97('0x13')](_0x2a97('0xd'),auth[_0x2a97('0xc')](),controller[_0x2a97('0x14')]);router['delete'](_0x2a97('0xd'),auth[_0x2a97('0xc')](),controller[_0x2a97('0x15')]);module[_0x2a97('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 977309a..77c80f9 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 _0x975f=['ENUM','lead','contact','nothing','contact_lead','exports','STRING'];(function(_0x33e83c,_0x418faa){var _0x5c6b12=function(_0x4f669d){while(--_0x4f669d){_0x33e83c['push'](_0x33e83c['shift']());}};_0x5c6b12(++_0x418faa);}(_0x975f,0x1e1));var _0xf975=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x975f[_0x521929];return _0x632436;};'use strict';var Sequelize=require('sequelize');module[_0xf975('0x0')]={'name':{'type':Sequelize[_0xf975('0x1')]},'moduleCreate':{'type':Sequelize[_0xf975('0x2')](_0xf975('0x3'),_0xf975('0x4'),_0xf975('0x5')),'defaultValue':_0xf975('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xf975('0x6'),_0xf975('0x4'),_0xf975('0x3')),'defaultValue':_0xf975('0x6')},'description':{'type':Sequelize[_0xf975('0x1')]}}; \ No newline at end of file +var _0x19a7=['nothing','contact_lead','ENUM'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x19a7,0x1bb));var _0x719a=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x19a7[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x719a('0x0')]('lead','contact',_0x719a('0x1')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x719a('0x0')](_0x719a('0x2'),'contact','lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b0b88c4..2e846cb 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 _0x713e=['update','then','error','stack','name','index','ZohoConfiguration','key','model','map','query','keys','filters','intersection','attributes','length','order','sort','pick','filter','where','merge','type','options','includeAll','findAll','catch','show','params','rawAttributes','fields','include','find','body','destroy','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save'];(function(_0x21586b,_0x512f74){var _0x3d4780=function(_0xc845b6){while(--_0xc845b6){_0x21586b['push'](_0x21586b['shift']());}};_0x3d4780(++_0x512f74);}(_0x713e,0x15e));var _0xe713=function(_0x3a0631,_0x2d8a7e){_0x3a0631=_0x3a0631-0x0;var _0x44bdf0=_0x713e[_0x3a0631];return _0x44bdf0;};'use strict';var emlformat=require(_0xe713('0x0'));var rimraf=require(_0xe713('0x1'));var zipdir=require(_0xe713('0x2'));var jsonpatch=require(_0xe713('0x3'));var rp=require(_0xe713('0x4'));var moment=require(_0xe713('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe713('0x6'));var util=require('util');var path=require(_0xe713('0x7'));var sox=require(_0xe713('0x8'));var csv=require(_0xe713('0x9'));var ejs=require(_0xe713('0xa'));var fs=require('fs');var fs_extra=require(_0xe713('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe713('0xc'));var deskjs=require(_0xe713('0xd'));var toCsv=require(_0xe713('0x9'));var querystring=require(_0xe713('0xe'));var Papa=require(_0xe713('0xf'));var Redis=require(_0xe713('0x10'));var authService=require(_0xe713('0x11'));var qs=require(_0xe713('0x12'));var as=require(_0xe713('0x13'));var hardwareService=require(_0xe713('0x14'));var logger=require(_0xe713('0x15'))('api');var utils=require(_0xe713('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe713('0x17'))['db'];function respondWithStatusCode(_0xaf3b56,_0x573373){_0x573373=_0x573373||0xcc;return function(_0x2d9721){if(_0x2d9721){return _0xaf3b56[_0xe713('0x18')](_0x573373);}return _0xaf3b56[_0xe713('0x19')](_0x573373)[_0xe713('0x1a')]();};}function respondWithResult(_0x1b8b65,_0x32b0de){_0x32b0de=_0x32b0de||0xc8;return function(_0x5489b8){if(_0x5489b8){return _0x1b8b65[_0xe713('0x19')](_0x32b0de)[_0xe713('0x1b')](_0x5489b8);}};}function respondWithFilteredResult(_0x16d3ba,_0x564bc6){return function(_0x5ed4c1){if(_0x5ed4c1){var _0x523b54=typeof _0x564bc6[_0xe713('0x1c')]===_0xe713('0x1d')&&typeof _0x564bc6[_0xe713('0x1e')]===_0xe713('0x1d');var _0x2b988c=_0x5ed4c1[_0xe713('0x1f')];var _0x26b163=_0x523b54?0x0:_0x564bc6[_0xe713('0x1c')];var _0x388488=_0x523b54?_0x5ed4c1[_0xe713('0x1f')]:_0x564bc6[_0xe713('0x1c')]+_0x564bc6[_0xe713('0x1e')];var _0x5c9379;if(_0x388488>=_0x2b988c){_0x388488=_0x2b988c;_0x5c9379=0xc8;}else{_0x5c9379=0xce;}_0x16d3ba['status'](_0x5c9379);return _0x16d3ba[_0xe713('0x20')]('Content-Range',_0x26b163+'-'+_0x388488+'/'+_0x2b988c)[_0xe713('0x1b')](_0x5ed4c1);}return null;};}function patchUpdates(_0xb4849a){return function(_0x356164){try{jsonpatch[_0xe713('0x21')](_0x356164,_0xb4849a,!![]);}catch(_0x5e8077){return BPromise['reject'](_0x5e8077);}return _0x356164[_0xe713('0x22')]();};}function saveUpdates(_0x2bc3c8,_0x32fd5d){return function(_0x255563){if(_0x255563){return _0x255563[_0xe713('0x23')](_0x2bc3c8)[_0xe713('0x24')](function(_0x43633e){return _0x43633e;});}return null;};}function removeEntity(_0x4350ee,_0x55619f){return function(_0xde7b8b){if(_0xde7b8b){return _0xde7b8b['destroy']()[_0xe713('0x24')](function(){_0x4350ee['status'](0xcc)[_0xe713('0x1a')]();});}};}function handleEntityNotFound(_0x5b2c64,_0x41277b){return function(_0x5e1fab){if(!_0x5e1fab){_0x5b2c64['sendStatus'](0x194);}return _0x5e1fab;};}function handleError(_0x49591d,_0xe04314){_0xe04314=_0xe04314||0x1f4;return function(_0x4c5420){logger[_0xe713('0x25')](_0x4c5420[_0xe713('0x26')]);if(_0x4c5420[_0xe713('0x27')]){delete _0x4c5420[_0xe713('0x27')];}_0x49591d[_0xe713('0x19')](_0xe04314)['send'](_0x4c5420);};}exports[_0xe713('0x28')]=function(_0xc7984e,_0x599f08){var _0x31fdbb={},_0x4810b7={},_0x82822b={'count':0x0,'rows':[]};var _0x9857=_['map'](db[_0xe713('0x29')]['rawAttributes'],function(_0x462c5d){return{'name':_0x462c5d['fieldName'],'type':_0x462c5d['type'][_0xe713('0x2a')]};});_0x4810b7[_0xe713('0x2b')]=_[_0xe713('0x2c')](_0x9857,_0xe713('0x27'));_0x4810b7[_0xe713('0x2d')]=_[_0xe713('0x2e')](_0xc7984e[_0xe713('0x2d')]);_0x4810b7[_0xe713('0x2f')]=_[_0xe713('0x30')](_0x4810b7['model'],_0x4810b7[_0xe713('0x2d')]);_0x31fdbb[_0xe713('0x31')]=_[_0xe713('0x30')](_0x4810b7[_0xe713('0x2b')],qs['fields'](_0xc7984e[_0xe713('0x2d')]['fields']));_0x31fdbb[_0xe713('0x31')]=_0x31fdbb['attributes'][_0xe713('0x32')]?_0x31fdbb['attributes']:_0x4810b7['model'];if(!_0xc7984e[_0xe713('0x2d')]['hasOwnProperty']('nolimit')){_0x31fdbb['limit']=qs['limit'](_0xc7984e['query']['limit']);_0x31fdbb[_0xe713('0x1c')]=qs[_0xe713('0x1c')](_0xc7984e[_0xe713('0x2d')][_0xe713('0x1c')]);}_0x31fdbb[_0xe713('0x33')]=qs[_0xe713('0x34')](_0xc7984e[_0xe713('0x2d')][_0xe713('0x34')]);_0x31fdbb['where']=qs[_0xe713('0x2f')](_[_0xe713('0x35')](_0xc7984e[_0xe713('0x2d')],_0x4810b7[_0xe713('0x2f')]),_0x9857);if(_0xc7984e[_0xe713('0x2d')][_0xe713('0x36')]){_0x31fdbb[_0xe713('0x37')]=_[_0xe713('0x38')](_0x31fdbb[_0xe713('0x37')],{'$or':_[_0xe713('0x2c')](_0x9857,function(_0x546471){if(_0x546471[_0xe713('0x39')]!=='VIRTUAL'){var _0x274da6={};_0x274da6[_0x546471[_0xe713('0x27')]]={'$like':'%'+_0xc7984e[_0xe713('0x2d')][_0xe713('0x36')]+'%'};return _0x274da6;}})});}_0x31fdbb=_[_0xe713('0x38')]({},_0x31fdbb,_0xc7984e[_0xe713('0x3a')]);var _0x91f8c0={'where':_0x31fdbb['where']};return db[_0xe713('0x29')][_0xe713('0x1f')](_0x91f8c0)[_0xe713('0x24')](function(_0x1a3fef){_0x82822b[_0xe713('0x1f')]=_0x1a3fef;if(_0xc7984e[_0xe713('0x2d')][_0xe713('0x3b')]){_0x31fdbb['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0xe713('0x3c')](_0x31fdbb);})[_0xe713('0x24')](function(_0x1f8ae5){_0x82822b['rows']=_0x1f8ae5;return _0x82822b;})['then'](respondWithFilteredResult(_0x599f08,_0x31fdbb))[_0xe713('0x3d')](handleError(_0x599f08,null));};exports[_0xe713('0x3e')]=function(_0x486cde,_0x3d29db){var _0x426d29={'raw':![],'where':{'id':_0x486cde[_0xe713('0x3f')]['id']}},_0x46089d={};_0x46089d[_0xe713('0x2b')]=_[_0xe713('0x2e')](db[_0xe713('0x29')][_0xe713('0x40')]);_0x46089d['query']=_[_0xe713('0x2e')](_0x486cde[_0xe713('0x2d')]);_0x46089d['filters']=_[_0xe713('0x30')](_0x46089d[_0xe713('0x2b')],_0x46089d[_0xe713('0x2d')]);_0x426d29[_0xe713('0x31')]=_[_0xe713('0x30')](_0x46089d[_0xe713('0x2b')],qs[_0xe713('0x41')](_0x486cde['query'][_0xe713('0x41')]));_0x426d29[_0xe713('0x31')]=_0x426d29['attributes'][_0xe713('0x32')]?_0x426d29[_0xe713('0x31')]:_0x46089d[_0xe713('0x2b')];if(_0x486cde['query']['includeAll']){_0x426d29[_0xe713('0x42')]=[{'all':!![]}];}_0x426d29=_[_0xe713('0x38')]({},_0x426d29,_0x486cde['options']);return db[_0xe713('0x29')][_0xe713('0x43')](_0x426d29)[_0xe713('0x24')](handleEntityNotFound(_0x3d29db,null))[_0xe713('0x24')](respondWithResult(_0x3d29db,null))['catch'](handleError(_0x3d29db,null));};exports['create']=function(_0x20547a,_0x20c6a6){return db[_0xe713('0x29')]['create'](_0x20547a[_0xe713('0x44')],{})[_0xe713('0x24')](respondWithResult(_0x20c6a6,0xc9))[_0xe713('0x3d')](handleError(_0x20c6a6,null));};exports[_0xe713('0x23')]=function(_0x4f7de4,_0x1f0cee){if(_0x4f7de4[_0xe713('0x44')]['id']){delete _0x4f7de4[_0xe713('0x44')]['id'];}return db[_0xe713('0x29')][_0xe713('0x43')]({'where':{'id':_0x4f7de4[_0xe713('0x3f')]['id']}})[_0xe713('0x24')](handleEntityNotFound(_0x1f0cee,null))[_0xe713('0x24')](saveUpdates(_0x4f7de4['body'],null))[_0xe713('0x24')](respondWithResult(_0x1f0cee,null))[_0xe713('0x3d')](handleError(_0x1f0cee,null));};exports[_0xe713('0x45')]=function(_0x1ba218,_0x1ee4ef){return db[_0xe713('0x29')][_0xe713('0x43')]({'where':{'id':_0x1ba218[_0xe713('0x3f')]['id']}})[_0xe713('0x24')](handleEntityNotFound(_0x1ee4ef,null))[_0xe713('0x24')](removeEntity(_0x1ee4ef,null))[_0xe713('0x3d')](handleError(_0x1ee4ef,null));};exports[_0xe713('0x46')]=function(_0x5e3076,_0x53f93b,_0x399a0c){var _0x1b9425={};var _0xbc4442={};var _0x9f3731;var _0x4d72f2;return db[_0xe713('0x29')][_0xe713('0x47')]({'where':{'id':_0x5e3076[_0xe713('0x3f')]['id']}})[_0xe713('0x24')](handleEntityNotFound(_0x53f93b,null))[_0xe713('0x24')](function(_0x3f4034){if(_0x3f4034){_0x9f3731=_0x3f4034;_0xbc4442[_0xe713('0x2b')]=_[_0xe713('0x2e')](db[_0xe713('0x48')]['rawAttributes']);_0xbc4442[_0xe713('0x2d')]=_[_0xe713('0x2e')](_0x5e3076[_0xe713('0x2d')]);_0xbc4442[_0xe713('0x2f')]=_['intersection'](_0xbc4442[_0xe713('0x2b')],_0xbc4442[_0xe713('0x2d')]);_0x1b9425[_0xe713('0x31')]=_[_0xe713('0x30')](_0xbc4442[_0xe713('0x2b')],qs[_0xe713('0x41')](_0x5e3076['query'][_0xe713('0x41')]));_0x1b9425['attributes']=_0x1b9425[_0xe713('0x31')][_0xe713('0x32')]?_0x1b9425[_0xe713('0x31')]:_0xbc4442[_0xe713('0x2b')];_0x1b9425[_0xe713('0x33')]=qs[_0xe713('0x34')](_0x5e3076[_0xe713('0x2d')][_0xe713('0x34')]);_0x1b9425[_0xe713('0x37')]=qs[_0xe713('0x2f')](_[_0xe713('0x35')](_0x5e3076['query'],_0xbc4442[_0xe713('0x2f')]));if(_0x5e3076[_0xe713('0x2d')][_0xe713('0x36')]){_0x1b9425['where']=_[_0xe713('0x38')](_0x1b9425[_0xe713('0x37')],{'$or':_['map'](_0x1b9425[_0xe713('0x31')],function(_0x35e6ea){var _0x358c21={};_0x358c21[_0x35e6ea]={'$like':'%'+_0x5e3076[_0xe713('0x2d')][_0xe713('0x36')]+'%'};return _0x358c21;})});}_0x1b9425=_['merge']({},_0x1b9425,_0x5e3076[_0xe713('0x3a')]);return _0x9f3731[_0xe713('0x46')](_0x1b9425);}})['then'](function(_0x4f37fb){if(_0x4f37fb){_0x4d72f2=_0x4f37fb[_0xe713('0x32')];if(!_0x5e3076['query'][_0xe713('0x49')]('nolimit')){_0x1b9425[_0xe713('0x1e')]=qs[_0xe713('0x1e')](_0x5e3076['query']['limit']);_0x1b9425[_0xe713('0x1c')]=qs['offset'](_0x5e3076[_0xe713('0x2d')][_0xe713('0x1c')]);}return _0x9f3731[_0xe713('0x46')](_0x1b9425);}})[_0xe713('0x24')](function(_0x3e8010){if(_0x3e8010){return _0x3e8010?{'count':_0x4d72f2,'rows':_0x3e8010}:null;}})[_0xe713('0x24')](respondWithResult(_0x53f93b,null))[_0xe713('0x3d')](handleError(_0x53f93b,null));};exports[_0xe713('0x4a')]=function(_0x57481d,_0x1931af,_0x1e9925){var _0x1b2429={};var _0xcbc240={};var _0xf990e0;var _0x3324ff;return db[_0xe713('0x29')][_0xe713('0x47')]({'where':{'id':_0x57481d['params']['id']}})[_0xe713('0x24')](handleEntityNotFound(_0x1931af,null))[_0xe713('0x24')](function(_0x128a9d){if(_0x128a9d){_0xf990e0=_0x128a9d;_0xcbc240[_0xe713('0x2b')]=_[_0xe713('0x2e')](db[_0xe713('0x48')][_0xe713('0x40')]);_0xcbc240['query']=_[_0xe713('0x2e')](_0x57481d[_0xe713('0x2d')]);_0xcbc240[_0xe713('0x2f')]=_[_0xe713('0x30')](_0xcbc240[_0xe713('0x2b')],_0xcbc240[_0xe713('0x2d')]);_0x1b2429[_0xe713('0x31')]=_[_0xe713('0x30')](_0xcbc240['model'],qs[_0xe713('0x41')](_0x57481d[_0xe713('0x2d')][_0xe713('0x41')]));_0x1b2429[_0xe713('0x31')]=_0x1b2429[_0xe713('0x31')][_0xe713('0x32')]?_0x1b2429[_0xe713('0x31')]:_0xcbc240[_0xe713('0x2b')];_0x1b2429[_0xe713('0x33')]=qs[_0xe713('0x34')](_0x57481d[_0xe713('0x2d')][_0xe713('0x34')]);_0x1b2429[_0xe713('0x37')]=qs[_0xe713('0x2f')](_[_0xe713('0x35')](_0x57481d['query'],_0xcbc240[_0xe713('0x2f')]));if(_0x57481d['query'][_0xe713('0x36')]){_0x1b2429[_0xe713('0x37')]=_[_0xe713('0x38')](_0x1b2429[_0xe713('0x37')],{'$or':_['map'](_0x1b2429[_0xe713('0x31')],function(_0x5b777e){var _0x4b063c={};_0x4b063c[_0x5b777e]={'$like':'%'+_0x57481d['query']['filter']+'%'};return _0x4b063c;})});}_0x1b2429=_['merge']({},_0x1b2429,_0x57481d[_0xe713('0x3a')]);return _0xf990e0[_0xe713('0x4a')](_0x1b2429);}})[_0xe713('0x24')](function(_0x528603){if(_0x528603){_0x3324ff=_0x528603[_0xe713('0x32')];if(!_0x57481d[_0xe713('0x2d')][_0xe713('0x49')](_0xe713('0x4b'))){_0x1b2429[_0xe713('0x1e')]=qs['limit'](_0x57481d['query'][_0xe713('0x1e')]);_0x1b2429[_0xe713('0x1c')]=qs[_0xe713('0x1c')](_0x57481d[_0xe713('0x2d')][_0xe713('0x1c')]);}return _0xf990e0[_0xe713('0x4a')](_0x1b2429);}})[_0xe713('0x24')](function(_0x4db893){if(_0x4db893){return _0x4db893?{'count':_0x3324ff,'rows':_0x4db893}:null;}})[_0xe713('0x24')](respondWithResult(_0x1931af,null))[_0xe713('0x3d')](handleError(_0x1931af,null));};exports[_0xe713('0x4c')]=function(_0x50acdc,_0x3e14a3,_0x2c45be){var _0x37371f={};var _0x3de4ce={};var _0x580c51;var _0x3575f7;return db['ZohoConfiguration'][_0xe713('0x47')]({'where':{'id':_0x50acdc['params']['id']}})[_0xe713('0x24')](handleEntityNotFound(_0x3e14a3,null))[_0xe713('0x24')](function(_0x43a05c){if(_0x43a05c){_0x580c51=_0x43a05c;_0x3de4ce[_0xe713('0x2b')]=_['keys'](db['ZohoField'][_0xe713('0x40')]);_0x3de4ce[_0xe713('0x2d')]=_['keys'](_0x50acdc[_0xe713('0x2d')]);_0x3de4ce['filters']=_['intersection'](_0x3de4ce[_0xe713('0x2b')],_0x3de4ce[_0xe713('0x2d')]);_0x37371f[_0xe713('0x31')]=_[_0xe713('0x30')](_0x3de4ce[_0xe713('0x2b')],qs['fields'](_0x50acdc[_0xe713('0x2d')][_0xe713('0x41')]));_0x37371f['attributes']=_0x37371f['attributes']['length']?_0x37371f[_0xe713('0x31')]:_0x3de4ce[_0xe713('0x2b')];_0x37371f[_0xe713('0x33')]=qs[_0xe713('0x34')](_0x50acdc[_0xe713('0x2d')][_0xe713('0x34')]);_0x37371f[_0xe713('0x37')]=qs[_0xe713('0x2f')](_[_0xe713('0x35')](_0x50acdc[_0xe713('0x2d')],_0x3de4ce[_0xe713('0x2f')]));if(_0x50acdc['query'][_0xe713('0x36')]){_0x37371f['where']=_[_0xe713('0x38')](_0x37371f[_0xe713('0x37')],{'$or':_[_0xe713('0x2c')](_0x37371f[_0xe713('0x31')],function(_0x2a734f){var _0x20b459={};_0x20b459[_0x2a734f]={'$like':'%'+_0x50acdc[_0xe713('0x2d')]['filter']+'%'};return _0x20b459;})});}_0x37371f=_[_0xe713('0x38')]({},_0x37371f,_0x50acdc[_0xe713('0x3a')]);return _0x580c51['getDescriptions'](_0x37371f);}})['then'](function(_0x3e0569){if(_0x3e0569){_0x3575f7=_0x3e0569[_0xe713('0x32')];if(!_0x50acdc[_0xe713('0x2d')]['hasOwnProperty']('nolimit')){_0x37371f[_0xe713('0x1e')]=qs[_0xe713('0x1e')](_0x50acdc['query'][_0xe713('0x1e')]);_0x37371f[_0xe713('0x1c')]=qs['offset'](_0x50acdc[_0xe713('0x2d')][_0xe713('0x1c')]);}return _0x580c51[_0xe713('0x4c')](_0x37371f);}})[_0xe713('0x24')](function(_0x274d2e){if(_0x274d2e){return _0x274d2e?{'count':_0x3575f7,'rows':_0x274d2e}:null;}})[_0xe713('0x24')](respondWithResult(_0x3e14a3,null))[_0xe713('0x3d')](handleError(_0x3e14a3,null));}; \ No newline at end of file +var _0x7f81=['order','sort','pick','filter','where','options','findAll','catch','show','keys','include','merge','find','create','body','params','destroy','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7f81,0x14a));var _0x17f8=function(_0x5f306c,_0x2e3186){_0x5f306c=_0x5f306c-0x0;var _0x3db0e2=_0x7f81[_0x5f306c];return _0x3db0e2;};'use strict';var emlformat=require(_0x17f8('0x0'));var rimraf=require(_0x17f8('0x1'));var zipdir=require(_0x17f8('0x2'));var jsonpatch=require(_0x17f8('0x3'));var rp=require('request-promise');var moment=require(_0x17f8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x17f8('0x5'));var util=require(_0x17f8('0x6'));var path=require(_0x17f8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x17f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x17f8('0x9'));var squel=require(_0x17f8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x17f8('0xb'));var querystring=require(_0x17f8('0xc'));var Papa=require(_0x17f8('0xd'));var Redis=require(_0x17f8('0xe'));var authService=require(_0x17f8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x17f8('0x10'));var hardwareService=require(_0x17f8('0x11'));var logger=require(_0x17f8('0x12'))(_0x17f8('0x13'));var utils=require('../../config/utils');var config=require(_0x17f8('0x14'));var licenseUtil=require(_0x17f8('0x15'));var db=require(_0x17f8('0x16'))['db'];function respondWithStatusCode(_0x17e5d8,_0x48461b){_0x48461b=_0x48461b||0xcc;return function(_0x2990ea){if(_0x2990ea){return _0x17e5d8[_0x17f8('0x17')](_0x48461b);}return _0x17e5d8[_0x17f8('0x18')](_0x48461b)[_0x17f8('0x19')]();};}function respondWithResult(_0x18bd17,_0x240d04){_0x240d04=_0x240d04||0xc8;return function(_0x24b998){if(_0x24b998){return _0x18bd17[_0x17f8('0x18')](_0x240d04)[_0x17f8('0x1a')](_0x24b998);}};}function respondWithFilteredResult(_0x551fda,_0x4964f8){return function(_0x5d4115){if(_0x5d4115){var _0x49241c=typeof _0x4964f8[_0x17f8('0x1b')]===_0x17f8('0x1c')&&typeof _0x4964f8[_0x17f8('0x1d')]===_0x17f8('0x1c');var _0x3b43bc=_0x5d4115[_0x17f8('0x1e')];var _0x1147c9=_0x49241c?0x0:_0x4964f8[_0x17f8('0x1b')];var _0x1ec63a=_0x49241c?_0x5d4115[_0x17f8('0x1e')]:_0x4964f8[_0x17f8('0x1b')]+_0x4964f8[_0x17f8('0x1d')];var _0x255791;if(_0x1ec63a>=_0x3b43bc){_0x1ec63a=_0x3b43bc;_0x255791=0xc8;}else{_0x255791=0xce;}_0x551fda[_0x17f8('0x18')](_0x255791);return _0x551fda['set'](_0x17f8('0x1f'),_0x1147c9+'-'+_0x1ec63a+'/'+_0x3b43bc)[_0x17f8('0x1a')](_0x5d4115);}return null;};}function patchUpdates(_0x407f7f){return function(_0x2ab500){try{jsonpatch[_0x17f8('0x20')](_0x2ab500,_0x407f7f,!![]);}catch(_0x395d0c){return BPromise[_0x17f8('0x21')](_0x395d0c);}return _0x2ab500[_0x17f8('0x22')]();};}function saveUpdates(_0x574ede,_0x337591){return function(_0x39d90e){if(_0x39d90e){return _0x39d90e[_0x17f8('0x23')](_0x574ede)[_0x17f8('0x24')](function(_0x43787e){return _0x43787e;});}return null;};}function removeEntity(_0x578a8a,_0x281080){return function(_0x8d78){if(_0x8d78){return _0x8d78['destroy']()[_0x17f8('0x24')](function(){_0x578a8a[_0x17f8('0x18')](0xcc)[_0x17f8('0x19')]();});}};}function handleEntityNotFound(_0x3053e9,_0x2eb3ea){return function(_0x4d288d){if(!_0x4d288d){_0x3053e9[_0x17f8('0x17')](0x194);}return _0x4d288d;};}function handleError(_0x5646aa,_0x2a7904){_0x2a7904=_0x2a7904||0x1f4;return function(_0x17027e){logger['error'](_0x17027e[_0x17f8('0x25')]);if(_0x17027e[_0x17f8('0x26')]){delete _0x17027e[_0x17f8('0x26')];}_0x5646aa[_0x17f8('0x18')](_0x2a7904)[_0x17f8('0x27')](_0x17027e);};}exports[_0x17f8('0x28')]=function(_0x2289e3,_0x3766d0){var _0x519842={},_0x34e2d9={},_0x194ea5={'count':0x0,'rows':[]};var _0x2b78c3=_[_0x17f8('0x29')](db[_0x17f8('0x2a')][_0x17f8('0x2b')],function(_0x24a92d){return{'name':_0x24a92d['fieldName'],'type':_0x24a92d[_0x17f8('0x2c')][_0x17f8('0x2d')]};});_0x34e2d9[_0x17f8('0x2e')]=_[_0x17f8('0x29')](_0x2b78c3,'name');_0x34e2d9['query']=_['keys'](_0x2289e3['query']);_0x34e2d9[_0x17f8('0x2f')]=_[_0x17f8('0x30')](_0x34e2d9[_0x17f8('0x2e')],_0x34e2d9[_0x17f8('0x31')]);_0x519842[_0x17f8('0x32')]=_[_0x17f8('0x30')](_0x34e2d9['model'],qs[_0x17f8('0x33')](_0x2289e3[_0x17f8('0x31')][_0x17f8('0x33')]));_0x519842['attributes']=_0x519842[_0x17f8('0x32')][_0x17f8('0x34')]?_0x519842[_0x17f8('0x32')]:_0x34e2d9[_0x17f8('0x2e')];if(!_0x2289e3[_0x17f8('0x31')][_0x17f8('0x35')](_0x17f8('0x36'))){_0x519842['limit']=qs[_0x17f8('0x1d')](_0x2289e3['query'][_0x17f8('0x1d')]);_0x519842['offset']=qs[_0x17f8('0x1b')](_0x2289e3['query'][_0x17f8('0x1b')]);}_0x519842[_0x17f8('0x37')]=qs[_0x17f8('0x38')](_0x2289e3[_0x17f8('0x31')][_0x17f8('0x38')]);_0x519842['where']=qs[_0x17f8('0x2f')](_[_0x17f8('0x39')](_0x2289e3[_0x17f8('0x31')],_0x34e2d9[_0x17f8('0x2f')]),_0x2b78c3);if(_0x2289e3['query'][_0x17f8('0x3a')]){_0x519842[_0x17f8('0x3b')]=_['merge'](_0x519842[_0x17f8('0x3b')],{'$or':_['map'](_0x2b78c3,function(_0x18da79){if(_0x18da79['type']!=='VIRTUAL'){var _0x5f3007={};_0x5f3007[_0x18da79[_0x17f8('0x26')]]={'$like':'%'+_0x2289e3[_0x17f8('0x31')][_0x17f8('0x3a')]+'%'};return _0x5f3007;}})});}_0x519842=_['merge']({},_0x519842,_0x2289e3[_0x17f8('0x3c')]);var _0x152af8={'where':_0x519842['where']};return db[_0x17f8('0x2a')]['count'](_0x152af8)['then'](function(_0x11637f){_0x194ea5[_0x17f8('0x1e')]=_0x11637f;if(_0x2289e3[_0x17f8('0x31')]['includeAll']){_0x519842['include']=[{'all':!![]}];}return db[_0x17f8('0x2a')][_0x17f8('0x3d')](_0x519842);})['then'](function(_0x5a5761){_0x194ea5['rows']=_0x5a5761;return _0x194ea5;})[_0x17f8('0x24')](respondWithFilteredResult(_0x3766d0,_0x519842))[_0x17f8('0x3e')](handleError(_0x3766d0,null));};exports[_0x17f8('0x3f')]=function(_0xf8aac4,_0xebd57){var _0x4150c1={'raw':![],'where':{'id':_0xf8aac4['params']['id']}},_0xa01e8b={};_0xa01e8b[_0x17f8('0x2e')]=_[_0x17f8('0x40')](db[_0x17f8('0x2a')]['rawAttributes']);_0xa01e8b[_0x17f8('0x31')]=_[_0x17f8('0x40')](_0xf8aac4[_0x17f8('0x31')]);_0xa01e8b[_0x17f8('0x2f')]=_[_0x17f8('0x30')](_0xa01e8b['model'],_0xa01e8b[_0x17f8('0x31')]);_0x4150c1[_0x17f8('0x32')]=_['intersection'](_0xa01e8b[_0x17f8('0x2e')],qs[_0x17f8('0x33')](_0xf8aac4[_0x17f8('0x31')][_0x17f8('0x33')]));_0x4150c1[_0x17f8('0x32')]=_0x4150c1[_0x17f8('0x32')][_0x17f8('0x34')]?_0x4150c1[_0x17f8('0x32')]:_0xa01e8b['model'];if(_0xf8aac4[_0x17f8('0x31')]['includeAll']){_0x4150c1[_0x17f8('0x41')]=[{'all':!![]}];}_0x4150c1=_[_0x17f8('0x42')]({},_0x4150c1,_0xf8aac4['options']);return db[_0x17f8('0x2a')][_0x17f8('0x43')](_0x4150c1)['then'](handleEntityNotFound(_0xebd57,null))[_0x17f8('0x24')](respondWithResult(_0xebd57,null))[_0x17f8('0x3e')](handleError(_0xebd57,null));};exports[_0x17f8('0x44')]=function(_0x40e868,_0x5998c7){return db[_0x17f8('0x2a')][_0x17f8('0x44')](_0x40e868[_0x17f8('0x45')],{})['then'](respondWithResult(_0x5998c7,0xc9))[_0x17f8('0x3e')](handleError(_0x5998c7,null));};exports[_0x17f8('0x23')]=function(_0x549660,_0x51efb9){if(_0x549660[_0x17f8('0x45')]['id']){delete _0x549660[_0x17f8('0x45')]['id'];}return db[_0x17f8('0x2a')][_0x17f8('0x43')]({'where':{'id':_0x549660[_0x17f8('0x46')]['id']}})[_0x17f8('0x24')](handleEntityNotFound(_0x51efb9,null))[_0x17f8('0x24')](saveUpdates(_0x549660[_0x17f8('0x45')],null))[_0x17f8('0x24')](respondWithResult(_0x51efb9,null))['catch'](handleError(_0x51efb9,null));};exports[_0x17f8('0x47')]=function(_0x559247,_0x3d0355){return db['ZohoConfiguration'][_0x17f8('0x43')]({'where':{'id':_0x559247[_0x17f8('0x46')]['id']}})[_0x17f8('0x24')](handleEntityNotFound(_0x3d0355,null))[_0x17f8('0x24')](removeEntity(_0x3d0355,null))[_0x17f8('0x3e')](handleError(_0x3d0355,null));};exports[_0x17f8('0x48')]=function(_0x3f6c23,_0x37659c,_0xfad97e){var _0x41be57={};var _0xc58350={};var _0x4aa592;var _0x337190;return db[_0x17f8('0x2a')][_0x17f8('0x49')]({'where':{'id':_0x3f6c23[_0x17f8('0x46')]['id']}})[_0x17f8('0x24')](handleEntityNotFound(_0x37659c,null))[_0x17f8('0x24')](function(_0xd50240){if(_0xd50240){_0x4aa592=_0xd50240;_0xc58350[_0x17f8('0x2e')]=_['keys'](db[_0x17f8('0x4a')][_0x17f8('0x2b')]);_0xc58350[_0x17f8('0x31')]=_[_0x17f8('0x40')](_0x3f6c23['query']);_0xc58350['filters']=_[_0x17f8('0x30')](_0xc58350[_0x17f8('0x2e')],_0xc58350[_0x17f8('0x31')]);_0x41be57[_0x17f8('0x32')]=_['intersection'](_0xc58350[_0x17f8('0x2e')],qs['fields'](_0x3f6c23[_0x17f8('0x31')][_0x17f8('0x33')]));_0x41be57[_0x17f8('0x32')]=_0x41be57[_0x17f8('0x32')][_0x17f8('0x34')]?_0x41be57[_0x17f8('0x32')]:_0xc58350[_0x17f8('0x2e')];_0x41be57[_0x17f8('0x37')]=qs[_0x17f8('0x38')](_0x3f6c23[_0x17f8('0x31')]['sort']);_0x41be57[_0x17f8('0x3b')]=qs['filters'](_[_0x17f8('0x39')](_0x3f6c23[_0x17f8('0x31')],_0xc58350['filters']));if(_0x3f6c23[_0x17f8('0x31')]['filter']){_0x41be57[_0x17f8('0x3b')]=_[_0x17f8('0x42')](_0x41be57[_0x17f8('0x3b')],{'$or':_[_0x17f8('0x29')](_0x41be57[_0x17f8('0x32')],function(_0x52b1f8){var _0x358463={};_0x358463[_0x52b1f8]={'$like':'%'+_0x3f6c23[_0x17f8('0x31')][_0x17f8('0x3a')]+'%'};return _0x358463;})});}_0x41be57=_['merge']({},_0x41be57,_0x3f6c23[_0x17f8('0x3c')]);return _0x4aa592[_0x17f8('0x48')](_0x41be57);}})[_0x17f8('0x24')](function(_0x454e96){if(_0x454e96){_0x337190=_0x454e96[_0x17f8('0x34')];if(!_0x3f6c23[_0x17f8('0x31')][_0x17f8('0x35')](_0x17f8('0x36'))){_0x41be57[_0x17f8('0x1d')]=qs['limit'](_0x3f6c23[_0x17f8('0x31')][_0x17f8('0x1d')]);_0x41be57[_0x17f8('0x1b')]=qs[_0x17f8('0x1b')](_0x3f6c23[_0x17f8('0x31')][_0x17f8('0x1b')]);}return _0x4aa592[_0x17f8('0x48')](_0x41be57);}})[_0x17f8('0x24')](function(_0x444d47){if(_0x444d47){return _0x444d47?{'count':_0x337190,'rows':_0x444d47}:null;}})['then'](respondWithResult(_0x37659c,null))[_0x17f8('0x3e')](handleError(_0x37659c,null));};exports[_0x17f8('0x4b')]=function(_0x4f1033,_0xa29669,_0x34539d){var _0x357dbb={};var _0x33a337={};var _0x485af0;var _0x1c5023;return db[_0x17f8('0x2a')][_0x17f8('0x49')]({'where':{'id':_0x4f1033[_0x17f8('0x46')]['id']}})[_0x17f8('0x24')](handleEntityNotFound(_0xa29669,null))['then'](function(_0x50bb55){if(_0x50bb55){_0x485af0=_0x50bb55;_0x33a337['model']=_['keys'](db[_0x17f8('0x4a')][_0x17f8('0x2b')]);_0x33a337[_0x17f8('0x31')]=_['keys'](_0x4f1033['query']);_0x33a337['filters']=_['intersection'](_0x33a337[_0x17f8('0x2e')],_0x33a337[_0x17f8('0x31')]);_0x357dbb[_0x17f8('0x32')]=_[_0x17f8('0x30')](_0x33a337['model'],qs['fields'](_0x4f1033[_0x17f8('0x31')]['fields']));_0x357dbb[_0x17f8('0x32')]=_0x357dbb['attributes']['length']?_0x357dbb[_0x17f8('0x32')]:_0x33a337[_0x17f8('0x2e')];_0x357dbb[_0x17f8('0x37')]=qs[_0x17f8('0x38')](_0x4f1033[_0x17f8('0x31')][_0x17f8('0x38')]);_0x357dbb['where']=qs[_0x17f8('0x2f')](_[_0x17f8('0x39')](_0x4f1033[_0x17f8('0x31')],_0x33a337[_0x17f8('0x2f')]));if(_0x4f1033[_0x17f8('0x31')][_0x17f8('0x3a')]){_0x357dbb['where']=_[_0x17f8('0x42')](_0x357dbb[_0x17f8('0x3b')],{'$or':_[_0x17f8('0x29')](_0x357dbb[_0x17f8('0x32')],function(_0x3a972f){var _0x5a22b4={};_0x5a22b4[_0x3a972f]={'$like':'%'+_0x4f1033[_0x17f8('0x31')][_0x17f8('0x3a')]+'%'};return _0x5a22b4;})});}_0x357dbb=_[_0x17f8('0x42')]({},_0x357dbb,_0x4f1033[_0x17f8('0x3c')]);return _0x485af0['getSubjects'](_0x357dbb);}})[_0x17f8('0x24')](function(_0x324b42){if(_0x324b42){_0x1c5023=_0x324b42[_0x17f8('0x34')];if(!_0x4f1033[_0x17f8('0x31')][_0x17f8('0x35')](_0x17f8('0x36'))){_0x357dbb[_0x17f8('0x1d')]=qs['limit'](_0x4f1033['query'][_0x17f8('0x1d')]);_0x357dbb['offset']=qs[_0x17f8('0x1b')](_0x4f1033[_0x17f8('0x31')][_0x17f8('0x1b')]);}return _0x485af0[_0x17f8('0x4b')](_0x357dbb);}})['then'](function(_0x5df68a){if(_0x5df68a){return _0x5df68a?{'count':_0x1c5023,'rows':_0x5df68a}:null;}})['then'](respondWithResult(_0xa29669,null))[_0x17f8('0x3e')](handleError(_0xa29669,null));};exports[_0x17f8('0x4c')]=function(_0x225e0d,_0x3de24a,_0x579dac){var _0x41e467={};var _0x459d6e={};var _0x2983f9;var _0x5bd6b3;return db[_0x17f8('0x2a')][_0x17f8('0x49')]({'where':{'id':_0x225e0d[_0x17f8('0x46')]['id']}})[_0x17f8('0x24')](handleEntityNotFound(_0x3de24a,null))[_0x17f8('0x24')](function(_0x427934){if(_0x427934){_0x2983f9=_0x427934;_0x459d6e[_0x17f8('0x2e')]=_[_0x17f8('0x40')](db[_0x17f8('0x4a')][_0x17f8('0x2b')]);_0x459d6e[_0x17f8('0x31')]=_[_0x17f8('0x40')](_0x225e0d['query']);_0x459d6e[_0x17f8('0x2f')]=_[_0x17f8('0x30')](_0x459d6e[_0x17f8('0x2e')],_0x459d6e[_0x17f8('0x31')]);_0x41e467[_0x17f8('0x32')]=_['intersection'](_0x459d6e[_0x17f8('0x2e')],qs[_0x17f8('0x33')](_0x225e0d[_0x17f8('0x31')][_0x17f8('0x33')]));_0x41e467['attributes']=_0x41e467['attributes'][_0x17f8('0x34')]?_0x41e467[_0x17f8('0x32')]:_0x459d6e[_0x17f8('0x2e')];_0x41e467[_0x17f8('0x37')]=qs['sort'](_0x225e0d[_0x17f8('0x31')]['sort']);_0x41e467[_0x17f8('0x3b')]=qs[_0x17f8('0x2f')](_[_0x17f8('0x39')](_0x225e0d[_0x17f8('0x31')],_0x459d6e['filters']));if(_0x225e0d[_0x17f8('0x31')][_0x17f8('0x3a')]){_0x41e467[_0x17f8('0x3b')]=_[_0x17f8('0x42')](_0x41e467['where'],{'$or':_[_0x17f8('0x29')](_0x41e467['attributes'],function(_0x1b2bbd){var _0x5bfd8f={};_0x5bfd8f[_0x1b2bbd]={'$like':'%'+_0x225e0d[_0x17f8('0x31')][_0x17f8('0x3a')]+'%'};return _0x5bfd8f;})});}_0x41e467=_[_0x17f8('0x42')]({},_0x41e467,_0x225e0d[_0x17f8('0x3c')]);return _0x2983f9[_0x17f8('0x4c')](_0x41e467);}})[_0x17f8('0x24')](function(_0x39cbbd){if(_0x39cbbd){_0x5bd6b3=_0x39cbbd[_0x17f8('0x34')];if(!_0x225e0d[_0x17f8('0x31')][_0x17f8('0x35')](_0x17f8('0x36'))){_0x41e467[_0x17f8('0x1d')]=qs[_0x17f8('0x1d')](_0x225e0d['query'][_0x17f8('0x1d')]);_0x41e467[_0x17f8('0x1b')]=qs['offset'](_0x225e0d[_0x17f8('0x31')][_0x17f8('0x1b')]);}return _0x2983f9['getDescriptions'](_0x41e467);}})['then'](function(_0x59772){if(_0x59772){return _0x59772?{'count':_0x5bd6b3,'rows':_0x59772}:null;}})['then'](respondWithResult(_0x3de24a,null))['catch'](handleError(_0x3de24a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 36442d1..d91908a 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 _0xaf6b=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x3917a8,_0xa82e69){var _0x3f14ae=function(_0x140842){while(--_0x140842){_0x3917a8['push'](_0x3917a8['shift']());}};_0x3f14ae(++_0xa82e69);}(_0xaf6b,0x19e));var _0xbaf6=function(_0x50a959,_0x376640){_0x50a959=_0x50a959-0x0;var _0x3bd030=_0xaf6b[_0x50a959];return _0x3bd030;};'use strict';var _=require(_0xbaf6('0x0'));var util=require('util');var logger=require(_0xbaf6('0x1'))(_0xbaf6('0x2'));var moment=require(_0xbaf6('0x3'));var BPromise=require(_0xbaf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaf6('0x5'));var rimraf=require(_0xbaf6('0x6'));var config=require(_0xbaf6('0x7'));var attributes=require(_0xbaf6('0x8'));module[_0xbaf6('0x9')]=function(_0x3534d0,_0x8f2e08){return _0x3534d0[_0xbaf6('0xa')]('ZohoConfiguration',attributes,{'tableName':_0xbaf6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7418=['../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x26dc7f,_0x3d6977){var _0x44c839=function(_0x453b8e){while(--_0x453b8e){_0x26dc7f['push'](_0x26dc7f['shift']());}};_0x44c839(++_0x3d6977);}(_0x7418,0x1b6));var _0x8741=function(_0x1f777a,_0x1f3b0e){_0x1f777a=_0x1f777a-0x0;var _0x449023=_0x7418[_0x1f777a];return _0x449023;};'use strict';var _=require('lodash');var util=require(_0x8741('0x0'));var logger=require(_0x8741('0x1'))(_0x8741('0x2'));var moment=require(_0x8741('0x3'));var BPromise=require(_0x8741('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8741('0x5'));var config=require(_0x8741('0x6'));var attributes=require(_0x8741('0x7'));module[_0x8741('0x8')]=function(_0x4e602a,_0x376187){return _0x4e602a[_0x8741('0x9')](_0x8741('0xa'),attributes,{'tableName':_0x8741('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 87d4baf..aa1567c 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 _0xf9c7=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x29dd5e,_0x1ad7e0){var _0x2fb32b=function(_0x30a923){while(--_0x30a923){_0x29dd5e['push'](_0x29dd5e['shift']());}};_0x2fb32b(++_0x1ad7e0);}(_0xf9c7,0x77));var _0x7f9c=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0xf9c7[_0x56608c];return _0x3c7fb0;};'use strict';var _=require(_0x7f9c('0x0'));var util=require(_0x7f9c('0x1'));var moment=require(_0x7f9c('0x2'));var BPromise=require(_0x7f9c('0x3'));var rs=require(_0x7f9c('0x4'));var fs=require('fs');var Redis=require(_0x7f9c('0x5'));var db=require(_0x7f9c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f9c('0x7'))(_0x7f9c('0x8'));var config=require(_0x7f9c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7f9c('0xa')][_0x7f9c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22b469,_0x4a7e89,_0x63c7c){return new BPromise(function(_0x57078f,_0x2de244){return client[_0x7f9c('0xc')](_0x22b469,_0x63c7c)[_0x7f9c('0xd')](function(_0x2d5771){logger[_0x7f9c('0xe')](_0x7f9c('0xf'),_0x4a7e89,_0x7f9c('0x10'));logger[_0x7f9c('0x11')](_0x7f9c('0x12'),_0x4a7e89,_0x7f9c('0x10'),JSON['stringify'](_0x2d5771));if(_0x2d5771[_0x7f9c('0x13')]){if(_0x2d5771[_0x7f9c('0x13')][_0x7f9c('0x14')]===0x1f4){logger['error'](_0x7f9c('0xf'),_0x4a7e89,_0x2d5771[_0x7f9c('0x13')][_0x7f9c('0x15')]);return _0x2de244(_0x2d5771[_0x7f9c('0x13')][_0x7f9c('0x15')]);}logger[_0x7f9c('0x13')](_0x7f9c('0xf'),_0x4a7e89,_0x2d5771['error'][_0x7f9c('0x15')]);return _0x57078f(_0x2d5771[_0x7f9c('0x13')][_0x7f9c('0x15')]);}else{logger[_0x7f9c('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x4a7e89,_0x7f9c('0x10'));_0x57078f(_0x2d5771[_0x7f9c('0x16')]['message']);}})['catch'](function(_0x2fc8ef){logger['error'](_0x7f9c('0xf'),_0x4a7e89,_0x2fc8ef);_0x2de244(_0x2fc8ef);});});} \ No newline at end of file +var _0x6a4a=['message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s'];(function(_0xa9af6d,_0x3ca4ba){var _0x1e7a7e=function(_0x55f66d){while(--_0x55f66d){_0xa9af6d['push'](_0xa9af6d['shift']());}};_0x1e7a7e(++_0x3ca4ba);}(_0x6a4a,0xb3));var _0xa6a4=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x6a4a[_0x16629d];return _0x56ccee;};'use strict';var _=require('lodash');var util=require(_0xa6a4('0x0'));var moment=require(_0xa6a4('0x1'));var BPromise=require(_0xa6a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6a4('0x3'))['db'];var utils=require(_0xa6a4('0x4'));var logger=require('../../config/logger')(_0xa6a4('0x5'));var config=require(_0xa6a4('0x6'));var jayson=require(_0xa6a4('0x7'));var client=jayson[_0xa6a4('0x8')][_0xa6a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13a44e,_0x524b3e,_0x246c74){return new BPromise(function(_0x58dc81,_0x41620f){return client[_0xa6a4('0xa')](_0x13a44e,_0x246c74)[_0xa6a4('0xb')](function(_0x1dc470){logger[_0xa6a4('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x524b3e,_0xa6a4('0xd'));logger[_0xa6a4('0xe')](_0xa6a4('0xf'),_0x524b3e,'request\x20sent',JSON['stringify'](_0x1dc470));if(_0x1dc470[_0xa6a4('0x10')]){if(_0x1dc470[_0xa6a4('0x10')][_0xa6a4('0x11')]===0x1f4){logger['error'](_0xa6a4('0x12'),_0x524b3e,_0x1dc470['error'][_0xa6a4('0x13')]);return _0x41620f(_0x1dc470['error']['message']);}logger['error'](_0xa6a4('0x12'),_0x524b3e,_0x1dc470[_0xa6a4('0x10')]['message']);return _0x58dc81(_0x1dc470[_0xa6a4('0x10')][_0xa6a4('0x13')]);}else{logger[_0xa6a4('0xc')](_0xa6a4('0x12'),_0x524b3e,'request\x20sent');_0x58dc81(_0x1dc470[_0xa6a4('0x14')][_0xa6a4('0x13')]);}})[_0xa6a4('0x15')](function(_0x63f10e){logger[_0xa6a4('0x10')](_0xa6a4('0x12'),_0x524b3e,_0x63f10e);_0x41620f(_0x63f10e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 22d2ed6..66d5137 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 _0x08f6=['show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','/:id','isAuthenticated'];(function(_0x2ff94b,_0x142d74){var _0x52cd01=function(_0x2ed3fc){while(--_0x2ed3fc){_0x2ff94b['push'](_0x2ff94b['shift']());}};_0x52cd01(++_0x142d74);}(_0x08f6,0x1a7));var _0x608f=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0x08f6[_0x4a8418];return _0x390174;};'use strict';var multer=require('multer');var util=require(_0x608f('0x0'));var path=require(_0x608f('0x1'));var timeout=require(_0x608f('0x2'));var express=require('express');var router=express[_0x608f('0x3')]();var fs_extra=require(_0x608f('0x4'));var auth=require(_0x608f('0x5'));var interaction=require(_0x608f('0x6'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x608f('0x7'),auth[_0x608f('0x8')](),controller[_0x608f('0x9')]);router[_0x608f('0xa')]('/',auth[_0x608f('0x8')](),controller[_0x608f('0xb')]);router[_0x608f('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x608f('0xd')]);router[_0x608f('0xe')](_0x608f('0x7'),auth[_0x608f('0x8')](),controller[_0x608f('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9069=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x9069,0x103));var _0x9906=function(_0x31c981,_0x18c6c0){_0x31c981=_0x31c981-0x0;var _0x44c461=_0x9069[_0x31c981];return _0x44c461;};'use strict';var multer=require(_0x9906('0x0'));var util=require(_0x9906('0x1'));var path=require(_0x9906('0x2'));var timeout=require(_0x9906('0x3'));var express=require(_0x9906('0x4'));var router=express[_0x9906('0x5')]();var fs_extra=require(_0x9906('0x6'));var auth=require(_0x9906('0x7'));var interaction=require(_0x9906('0x8'));var config=require(_0x9906('0x9'));var controller=require(_0x9906('0xa'));router[_0x9906('0xb')]('/',auth[_0x9906('0xc')](),controller[_0x9906('0xd')]);router[_0x9906('0xb')]('/:id',auth[_0x9906('0xc')](),controller[_0x9906('0xe')]);router[_0x9906('0xf')]('/',auth[_0x9906('0xc')](),controller[_0x9906('0x10')]);router[_0x9906('0x11')](_0x9906('0x12'),auth[_0x9906('0xc')](),controller[_0x9906('0x13')]);router['delete'](_0x9906('0x12'),auth[_0x9906('0xc')](),controller[_0x9906('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e30e6a0..9b7cd8b 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 _0xa385=['string','variable','customVariable','STRING','BOOLEAN','exports','ENUM'];(function(_0x5361ee,_0x512372){var _0x16b02e=function(_0x17583c){while(--_0x17583c){_0x5361ee['push'](_0x5361ee['shift']());}};_0x16b02e(++_0x512372);}(_0xa385,0x7c));var _0x5a38=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xa385[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require('sequelize');module[_0x5a38('0x0')]={'type':{'type':Sequelize[_0x5a38('0x1')](_0x5a38('0x2'),_0x5a38('0x3'),_0x5a38('0x4'),'keyValue','picklist'),'defaultValue':_0x5a38('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5a38('0x1')](_0x5a38('0x2'),_0x5a38('0x3'),_0x5a38('0x4'))},'keyContent':{'type':Sequelize[_0x5a38('0x5')]},'idField':{'type':Sequelize[_0x5a38('0x5')]},'nameField':{'type':Sequelize[_0x5a38('0x5')]},'customField':{'type':Sequelize[_0x5a38('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a38('0x5')]}}; \ No newline at end of file +var _0xbf37=['picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x4ec7cd,_0x5f4679){var _0x17d539=function(_0x4470c5){while(--_0x4470c5){_0x4ec7cd['push'](_0x4ec7cd['shift']());}};_0x17d539(++_0x5f4679);}(_0xbf37,0xb8));var _0x7bf3=function(_0x509795,_0x3d637c){_0x509795=_0x509795-0x0;var _0x5b206c=_0xbf37[_0x509795];return _0x5b206c;};'use strict';var Sequelize=require(_0x7bf3('0x0'));module['exports']={'type':{'type':Sequelize[_0x7bf3('0x1')](_0x7bf3('0x2'),_0x7bf3('0x3'),_0x7bf3('0x4'),'keyValue',_0x7bf3('0x5')),'defaultValue':_0x7bf3('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7bf3('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x7bf3('0x2'),_0x7bf3('0x3'),_0x7bf3('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7bf3('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7bf3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 572cc5b..475836c 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 _0x2539=['apply','reject','update','then','destroy','stack','name','index','map','ZohoField','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','keys','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0xdc28de,_0x1c5aba){var _0x2acdc3=function(_0x28bf21){while(--_0x28bf21){_0xdc28de['push'](_0xdc28de['shift']());}};_0x2acdc3(++_0x1c5aba);}(_0x2539,0x147));var _0x9253=function(_0x334614,_0x13e2c3){_0x334614=_0x334614-0x0;var _0x5c1bc2=_0x2539[_0x334614];return _0x5c1bc2;};'use strict';var emlformat=require(_0x9253('0x0'));var rimraf=require(_0x9253('0x1'));var zipdir=require(_0x9253('0x2'));var jsonpatch=require(_0x9253('0x3'));var rp=require(_0x9253('0x4'));var moment=require(_0x9253('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9253('0x6'));var util=require(_0x9253('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9253('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9253('0x9'));var _=require('lodash');var squel=require(_0x9253('0xa'));var crypto=require(_0x9253('0xb'));var jsforce=require(_0x9253('0xc'));var deskjs=require(_0x9253('0xd'));var toCsv=require(_0x9253('0x8'));var querystring=require(_0x9253('0xe'));var Papa=require(_0x9253('0xf'));var Redis=require('ioredis');var authService=require(_0x9253('0x10'));var qs=require(_0x9253('0x11'));var as=require(_0x9253('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9253('0x13'))('api');var utils=require(_0x9253('0x14'));var config=require(_0x9253('0x15'));var licenseUtil=require(_0x9253('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x507b7c,_0x44ca29){_0x44ca29=_0x44ca29||0xcc;return function(_0x5d467d){if(_0x5d467d){return _0x507b7c[_0x9253('0x17')](_0x44ca29);}return _0x507b7c[_0x9253('0x18')](_0x44ca29)[_0x9253('0x19')]();};}function respondWithResult(_0x4cbcbf,_0x216b26){_0x216b26=_0x216b26||0xc8;return function(_0x2039a9){if(_0x2039a9){return _0x4cbcbf[_0x9253('0x18')](_0x216b26)[_0x9253('0x1a')](_0x2039a9);}};}function respondWithFilteredResult(_0x201d8e,_0x509648){return function(_0x3ee459){if(_0x3ee459){var _0x7690e3=typeof _0x509648[_0x9253('0x1b')]===_0x9253('0x1c')&&typeof _0x509648['limit']==='undefined';var _0x832680=_0x3ee459[_0x9253('0x1d')];var _0x237fb7=_0x7690e3?0x0:_0x509648[_0x9253('0x1b')];var _0x35d4d3=_0x7690e3?_0x3ee459[_0x9253('0x1d')]:_0x509648[_0x9253('0x1b')]+_0x509648[_0x9253('0x1e')];var _0x455e94;if(_0x35d4d3>=_0x832680){_0x35d4d3=_0x832680;_0x455e94=0xc8;}else{_0x455e94=0xce;}_0x201d8e['status'](_0x455e94);return _0x201d8e[_0x9253('0x1f')](_0x9253('0x20'),_0x237fb7+'-'+_0x35d4d3+'/'+_0x832680)['json'](_0x3ee459);}return null;};}function patchUpdates(_0x1bfdef){return function(_0x577600){try{jsonpatch[_0x9253('0x21')](_0x577600,_0x1bfdef,!![]);}catch(_0x1fd368){return BPromise[_0x9253('0x22')](_0x1fd368);}return _0x577600['save']();};}function saveUpdates(_0x291262,_0x39e2ff){return function(_0x255d09){if(_0x255d09){return _0x255d09[_0x9253('0x23')](_0x291262)[_0x9253('0x24')](function(_0x341e14){return _0x341e14;});}return null;};}function removeEntity(_0x30ffdd,_0x1f47eb){return function(_0x38f21c){if(_0x38f21c){return _0x38f21c[_0x9253('0x25')]()[_0x9253('0x24')](function(){_0x30ffdd[_0x9253('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4c89,_0x5d91f2){return function(_0x1531a9){if(!_0x1531a9){_0x5a4c89[_0x9253('0x17')](0x194);}return _0x1531a9;};}function handleError(_0x265144,_0x1ccbff){_0x1ccbff=_0x1ccbff||0x1f4;return function(_0x48a1cb){logger['error'](_0x48a1cb[_0x9253('0x26')]);if(_0x48a1cb['name']){delete _0x48a1cb[_0x9253('0x27')];}_0x265144[_0x9253('0x18')](_0x1ccbff)['send'](_0x48a1cb);};}exports[_0x9253('0x28')]=function(_0x1cc400,_0x2e0ea8){var _0x5bc897={},_0x5d30b9={},_0x129641={'count':0x0,'rows':[]};var _0x493eb3=_[_0x9253('0x29')](db[_0x9253('0x2a')]['rawAttributes'],function(_0x1be7dd){return{'name':_0x1be7dd[_0x9253('0x2b')],'type':_0x1be7dd[_0x9253('0x2c')][_0x9253('0x2d')]};});_0x5d30b9[_0x9253('0x2e')]=_[_0x9253('0x29')](_0x493eb3,'name');_0x5d30b9['query']=_['keys'](_0x1cc400['query']);_0x5d30b9[_0x9253('0x2f')]=_[_0x9253('0x30')](_0x5d30b9[_0x9253('0x2e')],_0x5d30b9[_0x9253('0x31')]);_0x5bc897['attributes']=_[_0x9253('0x30')](_0x5d30b9[_0x9253('0x2e')],qs[_0x9253('0x32')](_0x1cc400[_0x9253('0x31')][_0x9253('0x32')]));_0x5bc897['attributes']=_0x5bc897[_0x9253('0x33')][_0x9253('0x34')]?_0x5bc897[_0x9253('0x33')]:_0x5d30b9[_0x9253('0x2e')];if(!_0x1cc400[_0x9253('0x31')][_0x9253('0x35')](_0x9253('0x36'))){_0x5bc897[_0x9253('0x1e')]=qs[_0x9253('0x1e')](_0x1cc400[_0x9253('0x31')][_0x9253('0x1e')]);_0x5bc897['offset']=qs[_0x9253('0x1b')](_0x1cc400[_0x9253('0x31')][_0x9253('0x1b')]);}_0x5bc897[_0x9253('0x37')]=qs[_0x9253('0x38')](_0x1cc400[_0x9253('0x31')][_0x9253('0x38')]);_0x5bc897[_0x9253('0x39')]=qs[_0x9253('0x2f')](_[_0x9253('0x3a')](_0x1cc400[_0x9253('0x31')],_0x5d30b9[_0x9253('0x2f')]),_0x493eb3);if(_0x1cc400[_0x9253('0x31')][_0x9253('0x3b')]){_0x5bc897[_0x9253('0x39')]=_['merge'](_0x5bc897[_0x9253('0x39')],{'$or':_[_0x9253('0x29')](_0x493eb3,function(_0x598b8d){if(_0x598b8d[_0x9253('0x2c')]!=='VIRTUAL'){var _0x468985={};_0x468985[_0x598b8d[_0x9253('0x27')]]={'$like':'%'+_0x1cc400['query'][_0x9253('0x3b')]+'%'};return _0x468985;}})});}_0x5bc897=_[_0x9253('0x3c')]({},_0x5bc897,_0x1cc400['options']);var _0x30080a={'where':_0x5bc897[_0x9253('0x39')]};return db['ZohoField'][_0x9253('0x1d')](_0x30080a)[_0x9253('0x24')](function(_0xcf00a7){_0x129641[_0x9253('0x1d')]=_0xcf00a7;if(_0x1cc400[_0x9253('0x31')][_0x9253('0x3d')]){_0x5bc897[_0x9253('0x3e')]=[{'all':!![]}];}return db[_0x9253('0x2a')][_0x9253('0x3f')](_0x5bc897);})[_0x9253('0x24')](function(_0x3ad211){_0x129641[_0x9253('0x40')]=_0x3ad211;return _0x129641;})[_0x9253('0x24')](respondWithFilteredResult(_0x2e0ea8,_0x5bc897))['catch'](handleError(_0x2e0ea8,null));};exports['show']=function(_0x2ccd84,_0x20a70c){var _0x5b5afe={'raw':!![],'where':{'id':_0x2ccd84['params']['id']}},_0x2bf2c0={};_0x2bf2c0[_0x9253('0x2e')]=_[_0x9253('0x41')](db['ZohoField']['rawAttributes']);_0x2bf2c0['query']=_[_0x9253('0x41')](_0x2ccd84['query']);_0x2bf2c0[_0x9253('0x2f')]=_[_0x9253('0x30')](_0x2bf2c0[_0x9253('0x2e')],_0x2bf2c0[_0x9253('0x31')]);_0x5b5afe['attributes']=_[_0x9253('0x30')](_0x2bf2c0['model'],qs[_0x9253('0x32')](_0x2ccd84[_0x9253('0x31')]['fields']));_0x5b5afe[_0x9253('0x33')]=_0x5b5afe[_0x9253('0x33')][_0x9253('0x34')]?_0x5b5afe['attributes']:_0x2bf2c0[_0x9253('0x2e')];if(_0x2ccd84['query']['includeAll']){_0x5b5afe[_0x9253('0x3e')]=[{'all':!![]}];}_0x5b5afe=_[_0x9253('0x3c')]({},_0x5b5afe,_0x2ccd84[_0x9253('0x42')]);return db[_0x9253('0x2a')][_0x9253('0x43')](_0x5b5afe)[_0x9253('0x24')](handleEntityNotFound(_0x20a70c,null))[_0x9253('0x24')](respondWithResult(_0x20a70c,null))[_0x9253('0x44')](handleError(_0x20a70c,null));};exports[_0x9253('0x45')]=function(_0x5cc3b9,_0x51c086){return db[_0x9253('0x2a')][_0x9253('0x45')](_0x5cc3b9[_0x9253('0x46')],{})[_0x9253('0x24')](respondWithResult(_0x51c086,0xc9))[_0x9253('0x44')](handleError(_0x51c086,null));};exports[_0x9253('0x23')]=function(_0x16bd23,_0x11bad7){if(_0x16bd23[_0x9253('0x46')]['id']){delete _0x16bd23['body']['id'];}return db[_0x9253('0x2a')][_0x9253('0x43')]({'where':{'id':_0x16bd23[_0x9253('0x47')]['id']}})['then'](handleEntityNotFound(_0x11bad7,null))[_0x9253('0x24')](saveUpdates(_0x16bd23[_0x9253('0x46')],null))[_0x9253('0x24')](respondWithResult(_0x11bad7,null))[_0x9253('0x44')](handleError(_0x11bad7,null));};exports['destroy']=function(_0x129375,_0x13fd11){return db[_0x9253('0x2a')]['find']({'where':{'id':_0x129375[_0x9253('0x47')]['id']}})[_0x9253('0x24')](handleEntityNotFound(_0x13fd11,null))['then'](removeEntity(_0x13fd11,null))[_0x9253('0x44')](handleError(_0x13fd11,null));}; \ No newline at end of file +var _0x595c=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','count','limit','set','reject','update','then','status','end','sendStatus','error','stack','name','index','ZohoField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','params','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring'];(function(_0x579fa6,_0x1c2a0a){var _0x137798=function(_0x4fa6db){while(--_0x4fa6db){_0x579fa6['push'](_0x579fa6['shift']());}};_0x137798(++_0x1c2a0a);}(_0x595c,0x147));var _0xc595=function(_0x829494,_0x5168e3){_0x829494=_0x829494-0x0;var _0x2e9fe0=_0x595c[_0x829494];return _0x2e9fe0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc595('0x0'));var zipdir=require(_0xc595('0x1'));var jsonpatch=require(_0xc595('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc595('0x3'));var util=require(_0xc595('0x4'));var path=require(_0xc595('0x5'));var sox=require(_0xc595('0x6'));var csv=require('to-csv');var ejs=require(_0xc595('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc595('0x8'));var squel=require(_0xc595('0x9'));var crypto=require(_0xc595('0xa'));var jsforce=require(_0xc595('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc595('0xc'));var Papa=require(_0xc595('0xd'));var Redis=require('ioredis');var authService=require(_0xc595('0xe'));var qs=require(_0xc595('0xf'));var as=require(_0xc595('0x10'));var hardwareService=require(_0xc595('0x11'));var logger=require('../../config/logger')(_0xc595('0x12'));var utils=require('../../config/utils');var config=require(_0xc595('0x13'));var licenseUtil=require(_0xc595('0x14'));var db=require(_0xc595('0x15'))['db'];function respondWithStatusCode(_0x35461f,_0x394f8c){_0x394f8c=_0x394f8c||0xcc;return function(_0x404070){if(_0x404070){return _0x35461f['sendStatus'](_0x394f8c);}return _0x35461f['status'](_0x394f8c)['end']();};}function respondWithResult(_0x5db16b,_0x562fdf){_0x562fdf=_0x562fdf||0xc8;return function(_0x19ca04){if(_0x19ca04){return _0x5db16b['status'](_0x562fdf)[_0xc595('0x16')](_0x19ca04);}};}function respondWithFilteredResult(_0x38aaba,_0x19ff21){return function(_0x445c6d){if(_0x445c6d){var _0x55d28a=typeof _0x19ff21[_0xc595('0x17')]===_0xc595('0x18')&&typeof _0x19ff21['limit']===_0xc595('0x18');var _0x1196d4=_0x445c6d[_0xc595('0x19')];var _0x45b7d6=_0x55d28a?0x0:_0x19ff21[_0xc595('0x17')];var _0x2c5707=_0x55d28a?_0x445c6d[_0xc595('0x19')]:_0x19ff21[_0xc595('0x17')]+_0x19ff21[_0xc595('0x1a')];var _0xb6b083;if(_0x2c5707>=_0x1196d4){_0x2c5707=_0x1196d4;_0xb6b083=0xc8;}else{_0xb6b083=0xce;}_0x38aaba['status'](_0xb6b083);return _0x38aaba[_0xc595('0x1b')]('Content-Range',_0x45b7d6+'-'+_0x2c5707+'/'+_0x1196d4)['json'](_0x445c6d);}return null;};}function patchUpdates(_0x47128c){return function(_0x2938f7){try{jsonpatch['apply'](_0x2938f7,_0x47128c,!![]);}catch(_0x1427c3){return BPromise[_0xc595('0x1c')](_0x1427c3);}return _0x2938f7['save']();};}function saveUpdates(_0x3f8e98,_0x153b9e){return function(_0x3fa811){if(_0x3fa811){return _0x3fa811[_0xc595('0x1d')](_0x3f8e98)['then'](function(_0x21f8d5){return _0x21f8d5;});}return null;};}function removeEntity(_0x3d5af2,_0x3bd8e5){return function(_0x2cdc9a){if(_0x2cdc9a){return _0x2cdc9a['destroy']()[_0xc595('0x1e')](function(){_0x3d5af2[_0xc595('0x1f')](0xcc)[_0xc595('0x20')]();});}};}function handleEntityNotFound(_0x40fe41,_0x261701){return function(_0x13d954){if(!_0x13d954){_0x40fe41[_0xc595('0x21')](0x194);}return _0x13d954;};}function handleError(_0xc99206,_0x26b3ce){_0x26b3ce=_0x26b3ce||0x1f4;return function(_0x27fa92){logger[_0xc595('0x22')](_0x27fa92[_0xc595('0x23')]);if(_0x27fa92[_0xc595('0x24')]){delete _0x27fa92[_0xc595('0x24')];}_0xc99206[_0xc595('0x1f')](_0x26b3ce)['send'](_0x27fa92);};}exports[_0xc595('0x25')]=function(_0x127dc1,_0x49a1c8){var _0x3b2ae8={},_0x35e5b7={},_0x584100={'count':0x0,'rows':[]};var _0xf8af6d=_['map'](db[_0xc595('0x26')][_0xc595('0x27')],function(_0x42e0c0){return{'name':_0x42e0c0[_0xc595('0x28')],'type':_0x42e0c0['type'][_0xc595('0x29')]};});_0x35e5b7['model']=_['map'](_0xf8af6d,_0xc595('0x24'));_0x35e5b7[_0xc595('0x2a')]=_[_0xc595('0x2b')](_0x127dc1['query']);_0x35e5b7[_0xc595('0x2c')]=_[_0xc595('0x2d')](_0x35e5b7[_0xc595('0x2e')],_0x35e5b7[_0xc595('0x2a')]);_0x3b2ae8[_0xc595('0x2f')]=_[_0xc595('0x2d')](_0x35e5b7['model'],qs['fields'](_0x127dc1[_0xc595('0x2a')]['fields']));_0x3b2ae8[_0xc595('0x2f')]=_0x3b2ae8[_0xc595('0x2f')][_0xc595('0x30')]?_0x3b2ae8[_0xc595('0x2f')]:_0x35e5b7[_0xc595('0x2e')];if(!_0x127dc1[_0xc595('0x2a')]['hasOwnProperty'](_0xc595('0x31'))){_0x3b2ae8[_0xc595('0x1a')]=qs[_0xc595('0x1a')](_0x127dc1[_0xc595('0x2a')][_0xc595('0x1a')]);_0x3b2ae8[_0xc595('0x17')]=qs['offset'](_0x127dc1[_0xc595('0x2a')][_0xc595('0x17')]);}_0x3b2ae8[_0xc595('0x32')]=qs[_0xc595('0x33')](_0x127dc1[_0xc595('0x2a')]['sort']);_0x3b2ae8[_0xc595('0x34')]=qs[_0xc595('0x2c')](_[_0xc595('0x35')](_0x127dc1[_0xc595('0x2a')],_0x35e5b7[_0xc595('0x2c')]),_0xf8af6d);if(_0x127dc1[_0xc595('0x2a')][_0xc595('0x36')]){_0x3b2ae8[_0xc595('0x34')]=_[_0xc595('0x37')](_0x3b2ae8['where'],{'$or':_['map'](_0xf8af6d,function(_0x188ffb){if(_0x188ffb[_0xc595('0x38')]!=='VIRTUAL'){var _0xef6bf9={};_0xef6bf9[_0x188ffb[_0xc595('0x24')]]={'$like':'%'+_0x127dc1['query'][_0xc595('0x36')]+'%'};return _0xef6bf9;}})});}_0x3b2ae8=_['merge']({},_0x3b2ae8,_0x127dc1['options']);var _0x3bdfe6={'where':_0x3b2ae8[_0xc595('0x34')]};return db[_0xc595('0x26')][_0xc595('0x19')](_0x3bdfe6)[_0xc595('0x1e')](function(_0x5125a0){_0x584100[_0xc595('0x19')]=_0x5125a0;if(_0x127dc1[_0xc595('0x2a')][_0xc595('0x39')]){_0x3b2ae8[_0xc595('0x3a')]=[{'all':!![]}];}return db[_0xc595('0x26')]['findAll'](_0x3b2ae8);})[_0xc595('0x1e')](function(_0x11210c){_0x584100[_0xc595('0x3b')]=_0x11210c;return _0x584100;})[_0xc595('0x1e')](respondWithFilteredResult(_0x49a1c8,_0x3b2ae8))[_0xc595('0x3c')](handleError(_0x49a1c8,null));};exports[_0xc595('0x3d')]=function(_0xafc785,_0x423267){var _0x266e2c={'raw':!![],'where':{'id':_0xafc785[_0xc595('0x3e')]['id']}},_0x2ba6c6={};_0x2ba6c6[_0xc595('0x2e')]=_[_0xc595('0x2b')](db[_0xc595('0x26')][_0xc595('0x27')]);_0x2ba6c6['query']=_[_0xc595('0x2b')](_0xafc785[_0xc595('0x2a')]);_0x2ba6c6[_0xc595('0x2c')]=_['intersection'](_0x2ba6c6['model'],_0x2ba6c6[_0xc595('0x2a')]);_0x266e2c[_0xc595('0x2f')]=_['intersection'](_0x2ba6c6[_0xc595('0x2e')],qs['fields'](_0xafc785[_0xc595('0x2a')]['fields']));_0x266e2c[_0xc595('0x2f')]=_0x266e2c[_0xc595('0x2f')][_0xc595('0x30')]?_0x266e2c[_0xc595('0x2f')]:_0x2ba6c6['model'];if(_0xafc785[_0xc595('0x2a')][_0xc595('0x39')]){_0x266e2c['include']=[{'all':!![]}];}_0x266e2c=_[_0xc595('0x37')]({},_0x266e2c,_0xafc785[_0xc595('0x3f')]);return db[_0xc595('0x26')][_0xc595('0x40')](_0x266e2c)[_0xc595('0x1e')](handleEntityNotFound(_0x423267,null))[_0xc595('0x1e')](respondWithResult(_0x423267,null))[_0xc595('0x3c')](handleError(_0x423267,null));};exports[_0xc595('0x41')]=function(_0x13c754,_0x525b36){return db[_0xc595('0x26')]['create'](_0x13c754[_0xc595('0x42')],{})[_0xc595('0x1e')](respondWithResult(_0x525b36,0xc9))[_0xc595('0x3c')](handleError(_0x525b36,null));};exports[_0xc595('0x1d')]=function(_0x138cea,_0x34db4c){if(_0x138cea[_0xc595('0x42')]['id']){delete _0x138cea[_0xc595('0x42')]['id'];}return db[_0xc595('0x26')]['find']({'where':{'id':_0x138cea['params']['id']}})[_0xc595('0x1e')](handleEntityNotFound(_0x34db4c,null))[_0xc595('0x1e')](saveUpdates(_0x138cea[_0xc595('0x42')],null))[_0xc595('0x1e')](respondWithResult(_0x34db4c,null))[_0xc595('0x3c')](handleError(_0x34db4c,null));};exports[_0xc595('0x43')]=function(_0x2ec635,_0x5a8667){return db[_0xc595('0x26')][_0xc595('0x40')]({'where':{'id':_0x2ec635[_0xc595('0x3e')]['id']}})[_0xc595('0x1e')](handleEntityNotFound(_0x5a8667,null))[_0xc595('0x1e')](removeEntity(_0x5a8667,null))[_0xc595('0x3c')](handleError(_0x5a8667,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 2981fc7..9b7af9c 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 _0x57ca=['moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','util','../../config/logger'];(function(_0x2d0cfb,_0x4f5148){var _0x2315bf=function(_0x27677c){while(--_0x27677c){_0x2d0cfb['push'](_0x2d0cfb['shift']());}};_0x2315bf(++_0x4f5148);}(_0x57ca,0x108));var _0xa57c=function(_0x2023fd,_0x4dce9a){_0x2023fd=_0x2023fd-0x0;var _0x40eb6d=_0x57ca[_0x2023fd];return _0x40eb6d;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('0xb'),'paranoid':![],'indexes':[{'name':_0xa57c('0xc'),'fields':['idField',_0xa57c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId'];(function(_0x4edeee,_0x591186){var _0x277532=function(_0xea2bae){while(--_0xea2bae){_0x4edeee['push'](_0x4edeee['shift']());}};_0x277532(++_0x591186);}(_0x5fab,0x177));var _0xb5fa=function(_0x191c34,_0x1fa270){_0x191c34=_0x191c34-0x0;var _0x43433b=_0x5fab[_0x191c34];return _0x43433b;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['idField',_0xb5fa('0xe')],'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 343289e..7cc425c 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 _0xc6af=['message','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x491e1a,_0x305a7c){var _0x142458=function(_0x2e10ca){while(--_0x2e10ca){_0x491e1a['push'](_0x491e1a['shift']());}};_0x142458(++_0x305a7c);}(_0xc6af,0xec));var _0xfc6a=function(_0x2323f3,_0x511b57){_0x2323f3=_0x2323f3-0x0;var _0x34e1ae=_0xc6af[_0x2323f3];return _0x34e1ae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc6a('0x0'));var BPromise=require(_0xfc6a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc6a('0x2'))['db'];var utils=require(_0xfc6a('0x3'));var logger=require(_0xfc6a('0x4'))('rpc');var config=require(_0xfc6a('0x5'));var jayson=require(_0xfc6a('0x6'));var client=jayson[_0xfc6a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea411,_0x417dd7,_0x18d25a){return new BPromise(function(_0x4f2ebd,_0x1436a4){return client[_0xfc6a('0x8')](_0x4ea411,_0x18d25a)[_0xfc6a('0x9')](function(_0x2160f5){logger[_0xfc6a('0xa')](_0xfc6a('0xb'),_0x417dd7,'request\x20sent');logger['debug'](_0xfc6a('0xc'),_0x417dd7,_0xfc6a('0xd'),JSON['stringify'](_0x2160f5));if(_0x2160f5['error']){if(_0x2160f5[_0xfc6a('0xe')][_0xfc6a('0xf')]===0x1f4){logger['error'](_0xfc6a('0xb'),_0x417dd7,_0x2160f5['error']['message']);return _0x1436a4(_0x2160f5['error'][_0xfc6a('0x10')]);}logger[_0xfc6a('0xe')](_0xfc6a('0xb'),_0x417dd7,_0x2160f5[_0xfc6a('0xe')][_0xfc6a('0x10')]);return _0x4f2ebd(_0x2160f5['error'][_0xfc6a('0x10')]);}else{logger[_0xfc6a('0xa')](_0xfc6a('0xb'),_0x417dd7,'request\x20sent');_0x4f2ebd(_0x2160f5['result'][_0xfc6a('0x10')]);}})[_0xfc6a('0x11')](function(_0x7d9375){logger[_0xfc6a('0xe')](_0xfc6a('0xb'),_0x417dd7,_0x7d9375);_0x1436a4(_0x7d9375);});});} \ No newline at end of file +var _0xccad=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x8506df,_0x23a65f){var _0x42f5d7=function(_0x137f0f){while(--_0x137f0f){_0x8506df['push'](_0x8506df['shift']());}};_0x42f5d7(++_0x23a65f);}(_0xccad,0xd1));var _0xdcca=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xccad[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xdcca('0x0'));var util=require(_0xdcca('0x1'));var moment=require(_0xdcca('0x2'));var BPromise=require(_0xdcca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcca('0x4'));var db=require(_0xdcca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcca('0x6'))(_0xdcca('0x7'));var config=require('../../config/environment');var jayson=require(_0xdcca('0x8'));var client=jayson[_0xdcca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29f2d,_0x2b9a46,_0xb19a33){return new BPromise(function(_0x2faf05,_0x1db795){return client[_0xdcca('0xa')](_0x29f2d,_0xb19a33)[_0xdcca('0xb')](function(_0x1708e6){logger[_0xdcca('0xc')](_0xdcca('0xd'),_0x2b9a46,_0xdcca('0xe'));logger[_0xdcca('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x2b9a46,_0xdcca('0xe'),JSON[_0xdcca('0x10')](_0x1708e6));if(_0x1708e6[_0xdcca('0x11')]){if(_0x1708e6['error'][_0xdcca('0x12')]===0x1f4){logger[_0xdcca('0x11')](_0xdcca('0xd'),_0x2b9a46,_0x1708e6['error'][_0xdcca('0x13')]);return _0x1db795(_0x1708e6['error'][_0xdcca('0x13')]);}logger[_0xdcca('0x11')](_0xdcca('0xd'),_0x2b9a46,_0x1708e6[_0xdcca('0x11')][_0xdcca('0x13')]);return _0x2faf05(_0x1708e6['error'][_0xdcca('0x13')]);}else{logger['info'](_0xdcca('0xd'),_0x2b9a46,'request\x20sent');_0x2faf05(_0x1708e6[_0xdcca('0x14')][_0xdcca('0x13')]);}})[_0xdcca('0x15')](function(_0x31fca7){logger['error'](_0xdcca('0xd'),_0x2b9a46,_0x31fca7);_0x1db795(_0x31fca7);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index bc1f4d5..1d400f0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x187d72,_0xa3a82){var _0x3b3fea=function(_0x45ee56){while(--_0x45ee56){_0x187d72['push'](_0x187d72['shift']());}};_0x3b3fea(++_0xa3a82);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1aa8fc,_0x288358){var _0x1d2273=function(_0x172917){while(--_0x172917){_0x1aa8fc['push'](_0x1aa8fc['shift']());}};_0x1d2273(++_0x288358);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9a496d3..3f9acc2 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 _0x3cbd=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x3cbd,0x1c0));var _0xd3cb=function(_0x3ea61c,_0x42150f){_0x3ea61c=_0x3ea61c-0x0;var _0x5a9497=_0x3cbd[_0x3ea61c];return _0x5a9497;};'use strict';var Sequelize=require('sequelize');module[_0xd3cb('0x0')]={'name':{'type':Sequelize[_0xd3cb('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xd3cb('0x1')],'allowNull':![],'unique':_0xd3cb('0x2')},'main':{'type':Sequelize[_0xd3cb('0x1')],'defaultValue':_0xd3cb('0x3')},'filename':{'type':Sequelize[_0xd3cb('0x1')]},'path':{'type':Sequelize[_0xd3cb('0x1')]},'type':{'type':Sequelize[_0xd3cb('0x1')]},'size':{'type':Sequelize[_0xd3cb('0x4')]},'active':{'type':Sequelize[_0xd3cb('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xd3cb('0x1')]},'logo':{'type':Sequelize[_0xd3cb('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xd3cb('0x6')},'description':{'type':Sequelize[_0xd3cb('0x1')]},'title':{'type':Sequelize[_0xd3cb('0x1')]},'remoteUri':{'type':Sequelize[_0xd3cb('0x1')]},'link':{'type':Sequelize[_0xd3cb('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xaab2=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x110d68,_0x31e3d4){var _0x261ed4=function(_0x496220){while(--_0x496220){_0x110d68['push'](_0x110d68['shift']());}};_0x261ed4(++_0x31e3d4);}(_0xaab2,0xf3));var _0x2aab=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xaab2[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x2aab('0x0'));module[_0x2aab('0x1')]={'name':{'type':Sequelize[_0x2aab('0x2')],'allowNull':![],'unique':_0x2aab('0x3')},'version':{'type':Sequelize[_0x2aab('0x2')],'allowNull':![],'unique':_0x2aab('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x2aab('0x4')},'filename':{'type':Sequelize[_0x2aab('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2aab('0x2')]},'size':{'type':Sequelize[_0x2aab('0x5')]},'active':{'type':Sequelize[_0x2aab('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x2aab('0x2')]},'logo':{'type':Sequelize[_0x2aab('0x2')]},'state':{'type':Sequelize[_0x2aab('0x2')],'unique':_0x2aab('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x2aab('0x2')]},'remoteUri':{'type':Sequelize[_0x2aab('0x2')]},'link':{'type':Sequelize[_0x2aab('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 b3e767e..8aaf807 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 _0xfcf0=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','keys','query','filters'];(function(_0x2a6a31,_0x33778f){var _0x3cc0f8=function(_0x383258){while(--_0x383258){_0x2a6a31['push'](_0x2a6a31['shift']());}};_0x3cc0f8(++_0x33778f);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xfcf0[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));}; \ No newline at end of file +var _0xc6ac=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','Integration','rawAttributes','fieldName'];(function(_0x17f9f4,_0x212dda){var _0x4dc32c=function(_0x1ed46d){while(--_0x1ed46d){_0x17f9f4['push'](_0x17f9f4['shift']());}};_0x4dc32c(++_0x212dda);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x14e801,_0x507a08){_0x14e801=_0x14e801-0x0;var _0x157fee=_0xc6ac[_0x14e801];return _0x157fee;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['Integration'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2d96f7c..8506dd0 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 _0x2549=['./integration.attributes','exports','define','Integration','integrations','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0xd120d3,_0x2eab13){var _0x1c8d80=function(_0x398429){while(--_0x398429){_0xd120d3['push'](_0xd120d3['shift']());}};_0x1c8d80(++_0x2eab13);}(_0x2549,0xaa));var _0x9254=function(_0x43e953,_0x434b65){_0x43e953=_0x43e953-0x0;var _0x1d1ef8=_0x2549[_0x43e953];return _0x1d1ef8;};'use strict';var _=require('lodash');var util=require(_0x9254('0x0'));var logger=require(_0x9254('0x1'))(_0x9254('0x2'));var moment=require(_0x9254('0x3'));var BPromise=require('bluebird');var rp=require(_0x9254('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9254('0x5'));var config=require('../../config/environment');var attributes=require(_0x9254('0x6'));module[_0x9254('0x7')]=function(_0x4a80cb,_0x5b2f31){return _0x4a80cb[_0x9254('0x8')](_0x9254('0x9'),attributes,{'tableName':_0x9254('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9517=['request-promise','path','rimraf','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9517,0x19a));var _0x7951=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9517[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7951('0x0'));var util=require(_0x7951('0x1'));var logger=require(_0x7951('0x2'))(_0x7951('0x3'));var moment=require(_0x7951('0x4'));var BPromise=require(_0x7951('0x5'));var rp=require(_0x7951('0x6'));var fs=require('fs');var path=require(_0x7951('0x7'));var rimraf=require(_0x7951('0x8'));var config=require('../../config/environment');var attributes=require(_0x7951('0x9'));module[_0x7951('0xa')]=function(_0x501cef,_0x3ae0c1){return _0x501cef[_0x7951('0xb')]('Integration',attributes,{'tableName':_0x7951('0xc'),'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 6ed0c93..4f01197 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 _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x144556,_0x5ca316){var _0x1bb692=function(_0x50af98){while(--_0x50af98){_0x144556['push'](_0x144556['shift']());}};_0x1bb692(++_0x5ca316);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x678532,_0x5073c2){_0x678532=_0x678532-0x0;var _0x1d3937=_0xd7d1[_0x678532];return _0x1d3937;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file +var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1f60c0,_0xff0692){var _0x30c8c0=function(_0x33453f){while(--_0x33453f){_0x1f60c0['push'](_0x1f60c0['shift']());}};_0x30c8c0(++_0xff0692);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6d38[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a48d0eb..f353975 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1e2f6b,_0x9dd727){var _0x3e6e83=function(_0x1180f6){while(--_0x1180f6){_0x1e2f6b['push'](_0x1e2f6b['shift']());}};_0x3e6e83(++_0x9dd727);}(_0x57ca,0x108));var _0xa57c=function(_0x150656,_0x6382ef){_0x150656=_0x150656-0x0;var _0x52d5f1=_0x57ca[_0x150656];return _0x52d5f1;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file +var _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x512a8c,_0x4f00b6){var _0x59af19=function(_0x1692c7){while(--_0x1692c7){_0x512a8c['push'](_0x512a8c['shift']());}};_0x59af19(++_0x4f00b6);}(_0x2542,0x169));var _0x2254=function(_0x4d6c45,_0x5edd7b){_0x4d6c45=_0x4d6c45-0x0;var _0x446677=_0x2542[_0x4d6c45];return _0x446677;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1304b95..54403ae 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 _0xd0c8=['STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x25ddad,_0x352018){var _0x234a1f=function(_0x5c6744){while(--_0x5c6744){_0x25ddad['push'](_0x25ddad['shift']());}};_0x234a1f(++_0x352018);}(_0xd0c8,0x128));var _0x8d0c=function(_0x4ab721,_0x3152cc){_0x4ab721=_0x4ab721-0x0;var _0x336ec9=_0xd0c8[_0x4ab721];return _0x336ec9;};'use strict';var Sequelize=require(_0x8d0c('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x8d0c('0x1')]},'ticketId':{'type':Sequelize[_0x8d0c('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8d0c('0x1')]},'queue':{'type':Sequelize[_0x8d0c('0x1')]},'interface':{'type':Sequelize[_0x8d0c('0x1')]},'membername':{'type':Sequelize[_0x8d0c('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x8d0c('0x2')]},'holdtime':{'type':Sequelize[_0x8d0c('0x3')]},'agentcomplete':{'type':Sequelize[_0x8d0c('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8d0c('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x8d0c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8d0c('0x3')]},'reason':{'type':Sequelize[_0x8d0c('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x8d0c('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8d0c('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x8d0c('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x8d0c('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8d0c('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8d0c('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x8d0c('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8d0c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x8d0c('0x1')]},'destcalleridnum':{'type':Sequelize[_0x8d0c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x8d0c('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8d0c('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x8d0c('0x1')]},'destexten':{'type':Sequelize[_0x8d0c('0x1')]},'destpriority':{'type':Sequelize[_0x8d0c('0x1')]},'destuniqueid':{'type':Sequelize[_0x8d0c('0x1')]},'messageId':{'type':Sequelize[_0x8d0c('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x8d0c('0x1')]},'from':{'type':Sequelize[_0x8d0c('0x1')]},'to':{'type':Sequelize[_0x8d0c('0x1')]},'cc':{'type':Sequelize[_0x8d0c('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x8d0c('0x5')]},'text':{'type':Sequelize[_0x8d0c('0x5')]},'status':{'type':Sequelize[_0x8d0c('0x6')](_0x8d0c('0x7'),_0x8d0c('0x8'),_0x8d0c('0x9'),_0x8d0c('0xa'))},'url':{'type':Sequelize[_0x8d0c('0x1')]},'app':{'type':Sequelize[_0x8d0c('0x1')]},'appdata':{'type':Sequelize[_0x8d0c('0x1')]},'projectId':{'type':Sequelize[_0x8d0c('0x3')]}}; \ No newline at end of file +var _0xe3ca=['DATE','BOOLEAN','TEXT','ENUM','SENDING','FAILED','sequelize','STRING','INTEGER'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0xe3ca,0x96));var _0xae3c=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xe3ca[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0xae3c('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xae3c('0x1')]},'ticketId':{'type':Sequelize[_0xae3c('0x1')]},'integrationId':{'type':Sequelize[_0xae3c('0x2')]},'contacts':{'type':Sequelize[_0xae3c('0x1')]},'uniqueid':{'type':Sequelize[_0xae3c('0x1')]},'calleridnum':{'type':Sequelize[_0xae3c('0x1')]},'calleridname':{'type':Sequelize[_0xae3c('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xae3c('0x1')]},'agentcalledAt':{'type':Sequelize[_0xae3c('0x3')]},'agentconnectAt':{'type':Sequelize[_0xae3c('0x3')]},'holdtime':{'type':Sequelize[_0xae3c('0x2')]},'agentcomplete':{'type':Sequelize[_0xae3c('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xae3c('0x2')]},'agentacw':{'type':Sequelize[_0xae3c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xae3c('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xae3c('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xae3c('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xae3c('0x3')]},'lastevent':{'type':Sequelize[_0xae3c('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xae3c('0x2')]},'channelstatedesc':{'type':Sequelize[_0xae3c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xae3c('0x1')]},'connectedlinename':{'type':Sequelize[_0xae3c('0x1')]},'language':{'type':Sequelize[_0xae3c('0x1')]},'accountcode':{'type':Sequelize[_0xae3c('0x1')]},'context':{'type':Sequelize[_0xae3c('0x1')]},'exten':{'type':Sequelize[_0xae3c('0x1')]},'priority':{'type':Sequelize[_0xae3c('0x1')]},'destchannel':{'type':Sequelize[_0xae3c('0x1')]},'destchannelstate':{'type':Sequelize[_0xae3c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xae3c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xae3c('0x1')]},'destcalleridname':{'type':Sequelize[_0xae3c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xae3c('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xae3c('0x1')]},'destaccountcode':{'type':Sequelize[_0xae3c('0x1')]},'destcontext':{'type':Sequelize[_0xae3c('0x1')]},'destexten':{'type':Sequelize[_0xae3c('0x1')]},'destpriority':{'type':Sequelize[_0xae3c('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xae3c('0x1')]},'to':{'type':Sequelize[_0xae3c('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xae3c('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xae3c('0x6')]('SENT',_0xae3c('0x7'),'RECEIVED',_0xae3c('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xae3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8eead1f..67bb81c 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 _0x7718=['json','apply','reject','save','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','IntegrationReport','include','rows','catch','show','params','includeAll','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x4c6eb0,_0x3301b0){var _0x417e51=function(_0x884a0d){while(--_0x884a0d){_0x4c6eb0['push'](_0x4c6eb0['shift']());}};_0x417e51(++_0x3301b0);}(_0x7718,0x1f3));var _0x8771=function(_0x218f85,_0x33824e){_0x218f85=_0x218f85-0x0;var _0x35da76=_0x7718[_0x218f85];return _0x35da76;};'use strict';var emlformat=require(_0x8771('0x0'));var rimraf=require(_0x8771('0x1'));var zipdir=require(_0x8771('0x2'));var jsonpatch=require(_0x8771('0x3'));var rp=require(_0x8771('0x4'));var moment=require(_0x8771('0x5'));var BPromise=require(_0x8771('0x6'));var Mustache=require(_0x8771('0x7'));var util=require('util');var path=require(_0x8771('0x8'));var sox=require(_0x8771('0x9'));var csv=require(_0x8771('0xa'));var ejs=require(_0x8771('0xb'));var fs=require('fs');var fs_extra=require(_0x8771('0xc'));var _=require('lodash');var squel=require(_0x8771('0xd'));var crypto=require(_0x8771('0xe'));var jsforce=require(_0x8771('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8771('0xa'));var querystring=require(_0x8771('0x10'));var Papa=require('papaparse');var Redis=require(_0x8771('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8771('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8771('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8771('0x14'));var config=require(_0x8771('0x15'));var licenseUtil=require(_0x8771('0x16'));var db=require(_0x8771('0x17'))['db'];function respondWithStatusCode(_0x1b2aad,_0x40d1c6){_0x40d1c6=_0x40d1c6||0xcc;return function(_0x160948){if(_0x160948){return _0x1b2aad[_0x8771('0x18')](_0x40d1c6);}return _0x1b2aad[_0x8771('0x19')](_0x40d1c6)[_0x8771('0x1a')]();};}function respondWithResult(_0x332a8c,_0x460fb1){_0x460fb1=_0x460fb1||0xc8;return function(_0x3b20c8){if(_0x3b20c8){return _0x332a8c[_0x8771('0x19')](_0x460fb1)['json'](_0x3b20c8);}};}function respondWithFilteredResult(_0xcbd980,_0x2b4f20){return function(_0x468871){if(_0x468871){var _0x5cc909=typeof _0x2b4f20[_0x8771('0x1b')]===_0x8771('0x1c')&&typeof _0x2b4f20[_0x8771('0x1d')]==='undefined';var _0x3aa81a=_0x468871[_0x8771('0x1e')];var _0x1aa37b=_0x5cc909?0x0:_0x2b4f20[_0x8771('0x1b')];var _0x4251b0=_0x5cc909?_0x468871[_0x8771('0x1e')]:_0x2b4f20[_0x8771('0x1b')]+_0x2b4f20[_0x8771('0x1d')];var _0xeaed45;if(_0x4251b0>=_0x3aa81a){_0x4251b0=_0x3aa81a;_0xeaed45=0xc8;}else{_0xeaed45=0xce;}_0xcbd980[_0x8771('0x19')](_0xeaed45);return _0xcbd980[_0x8771('0x1f')](_0x8771('0x20'),_0x1aa37b+'-'+_0x4251b0+'/'+_0x3aa81a)[_0x8771('0x21')](_0x468871);}return null;};}function patchUpdates(_0x758bf5){return function(_0x5b17b5){try{jsonpatch[_0x8771('0x22')](_0x5b17b5,_0x758bf5,!![]);}catch(_0x2fc82b){return BPromise[_0x8771('0x23')](_0x2fc82b);}return _0x5b17b5[_0x8771('0x24')]();};}function saveUpdates(_0x1d9d31,_0xe0efa3){return function(_0x3f6367){if(_0x3f6367){return _0x3f6367['update'](_0x1d9d31)['then'](function(_0x4fc9c8){return _0x4fc9c8;});}return null;};}function removeEntity(_0x389845,_0x2db7b8){return function(_0x215b34){if(_0x215b34){return _0x215b34[_0x8771('0x25')]()[_0x8771('0x26')](function(){_0x389845[_0x8771('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x485ab5,_0x5ec902){return function(_0x4b433b){if(!_0x4b433b){_0x485ab5['sendStatus'](0x194);}return _0x4b433b;};}function handleError(_0x9c058b,_0x42b7d9){_0x42b7d9=_0x42b7d9||0x1f4;return function(_0x1b8672){logger[_0x8771('0x27')](_0x1b8672['stack']);if(_0x1b8672[_0x8771('0x28')]){delete _0x1b8672[_0x8771('0x28')];}_0x9c058b[_0x8771('0x19')](_0x42b7d9)[_0x8771('0x29')](_0x1b8672);};}exports[_0x8771('0x2a')]=function(_0x198b9a,_0x5e7292){var _0x3561cd={},_0x516a58={},_0x68dc38={'count':0x0,'rows':[]};var _0xc2f8aa=_[_0x8771('0x2b')](db['IntegrationReport'][_0x8771('0x2c')],function(_0x1fbeb7){return{'name':_0x1fbeb7[_0x8771('0x2d')],'type':_0x1fbeb7[_0x8771('0x2e')][_0x8771('0x2f')]};});_0x516a58[_0x8771('0x30')]=_[_0x8771('0x2b')](_0xc2f8aa,_0x8771('0x28'));_0x516a58[_0x8771('0x31')]=_[_0x8771('0x32')](_0x198b9a[_0x8771('0x31')]);_0x516a58[_0x8771('0x33')]=_[_0x8771('0x34')](_0x516a58[_0x8771('0x30')],_0x516a58[_0x8771('0x31')]);_0x3561cd[_0x8771('0x35')]=_[_0x8771('0x34')](_0x516a58[_0x8771('0x30')],qs[_0x8771('0x36')](_0x198b9a[_0x8771('0x31')][_0x8771('0x36')]));_0x3561cd['attributes']=_0x3561cd[_0x8771('0x35')][_0x8771('0x37')]?_0x3561cd[_0x8771('0x35')]:_0x516a58[_0x8771('0x30')];if(!_0x198b9a['query'][_0x8771('0x38')](_0x8771('0x39'))){_0x3561cd['limit']=qs['limit'](_0x198b9a[_0x8771('0x31')][_0x8771('0x1d')]);_0x3561cd[_0x8771('0x1b')]=qs[_0x8771('0x1b')](_0x198b9a[_0x8771('0x31')][_0x8771('0x1b')]);}_0x3561cd[_0x8771('0x3a')]=qs['sort'](_0x198b9a[_0x8771('0x31')][_0x8771('0x3b')]);_0x3561cd['where']=qs[_0x8771('0x33')](_['pick'](_0x198b9a[_0x8771('0x31')],_0x516a58[_0x8771('0x33')]),_0xc2f8aa);if(_0x198b9a[_0x8771('0x31')][_0x8771('0x3c')]){_0x3561cd[_0x8771('0x3d')]=_['merge'](_0x3561cd[_0x8771('0x3d')],{'$or':_['map'](_0xc2f8aa,function(_0x3fa331){if(_0x3fa331[_0x8771('0x2e')]!=='VIRTUAL'){var _0xc9a33b={};_0xc9a33b[_0x3fa331['name']]={'$like':'%'+_0x198b9a[_0x8771('0x31')][_0x8771('0x3c')]+'%'};return _0xc9a33b;}})});}_0x3561cd=_[_0x8771('0x3e')]({},_0x3561cd,_0x198b9a['options']);var _0x525ee4={'where':_0x3561cd[_0x8771('0x3d')]};return db[_0x8771('0x3f')][_0x8771('0x1e')](_0x525ee4)['then'](function(_0x1b49ce){_0x68dc38[_0x8771('0x1e')]=_0x1b49ce;if(_0x198b9a[_0x8771('0x31')]['includeAll']){_0x3561cd[_0x8771('0x40')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x3561cd);})['then'](function(_0x255843){_0x68dc38[_0x8771('0x41')]=_0x255843;return _0x68dc38;})[_0x8771('0x26')](respondWithFilteredResult(_0x5e7292,_0x3561cd))[_0x8771('0x42')](handleError(_0x5e7292,null));};exports[_0x8771('0x43')]=function(_0x5fa8f1,_0x936df9){var _0x26e61c={'raw':![],'where':{'id':_0x5fa8f1[_0x8771('0x44')]['id']}},_0x1e7f33={};_0x1e7f33[_0x8771('0x30')]=_[_0x8771('0x32')](db[_0x8771('0x3f')][_0x8771('0x2c')]);_0x1e7f33[_0x8771('0x31')]=_['keys'](_0x5fa8f1[_0x8771('0x31')]);_0x1e7f33[_0x8771('0x33')]=_[_0x8771('0x34')](_0x1e7f33['model'],_0x1e7f33[_0x8771('0x31')]);_0x26e61c[_0x8771('0x35')]=_[_0x8771('0x34')](_0x1e7f33[_0x8771('0x30')],qs[_0x8771('0x36')](_0x5fa8f1['query'][_0x8771('0x36')]));_0x26e61c[_0x8771('0x35')]=_0x26e61c[_0x8771('0x35')]['length']?_0x26e61c[_0x8771('0x35')]:_0x1e7f33[_0x8771('0x30')];if(_0x5fa8f1[_0x8771('0x31')][_0x8771('0x45')]){_0x26e61c[_0x8771('0x40')]=[{'all':!![]}];}_0x26e61c=_[_0x8771('0x3e')]({},_0x26e61c,_0x5fa8f1[_0x8771('0x46')]);return db['IntegrationReport'][_0x8771('0x47')](_0x26e61c)['then'](handleEntityNotFound(_0x936df9,null))['then'](respondWithResult(_0x936df9,null))[_0x8771('0x42')](handleError(_0x936df9,null));};exports[_0x8771('0x48')]=function(_0x165870,_0xde4fa6){return db['IntegrationReport'][_0x8771('0x48')](_0x165870[_0x8771('0x49')],{})[_0x8771('0x26')](respondWithResult(_0xde4fa6,0xc9))[_0x8771('0x42')](handleError(_0xde4fa6,null));};exports[_0x8771('0x4a')]=function(_0x522c1a,_0x459e8e){if(_0x522c1a[_0x8771('0x49')]['id']){delete _0x522c1a['body']['id'];}return db[_0x8771('0x3f')][_0x8771('0x47')]({'where':{'id':_0x522c1a[_0x8771('0x44')]['id']}})[_0x8771('0x26')](handleEntityNotFound(_0x459e8e,null))[_0x8771('0x26')](saveUpdates(_0x522c1a[_0x8771('0x49')],null))[_0x8771('0x26')](respondWithResult(_0x459e8e,null))[_0x8771('0x42')](handleError(_0x459e8e,null));};exports['destroy']=function(_0x4a9a80,_0x3ebc8b){return db['IntegrationReport'][_0x8771('0x47')]({'where':{'id':_0x4a9a80['params']['id']}})[_0x8771('0x26')](handleEntityNotFound(_0x3ebc8b,null))['then'](removeEntity(_0x3ebc8b,null))[_0x8771('0x42')](handleError(_0x3ebc8b,null));};exports[_0x8771('0x4b')]=function(_0x15641b,_0x62d952){return db[_0x8771('0x3f')][_0x8771('0x4b')]()[_0x8771('0x26')](respondWithResult(_0x62d952,null))[_0x8771('0x42')](handleError(_0x62d952,null));}; \ No newline at end of file +var _0xb312=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','params','keys','create','body','describe','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x26425a,_0x1b4d6f){var _0x12802a=function(_0x5db8a7){while(--_0x5db8a7){_0x26425a['push'](_0x26425a['shift']());}};_0x12802a(++_0x1b4d6f);}(_0xb312,0x142));var _0x2b31=function(_0x1311a3,_0x2c9bf3){_0x1311a3=_0x1311a3-0x0;var _0x472928=_0xb312[_0x1311a3];return _0x472928;};'use strict';var emlformat=require(_0x2b31('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b31('0x1'));var rp=require(_0x2b31('0x2'));var moment=require(_0x2b31('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2b31('0x4'));var path=require(_0x2b31('0x5'));var sox=require(_0x2b31('0x6'));var csv=require(_0x2b31('0x7'));var ejs=require(_0x2b31('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b31('0x9'));var squel=require(_0x2b31('0xa'));var crypto=require(_0x2b31('0xb'));var jsforce=require(_0x2b31('0xc'));var deskjs=require(_0x2b31('0xd'));var toCsv=require(_0x2b31('0x7'));var querystring=require(_0x2b31('0xe'));var Papa=require('papaparse');var Redis=require(_0x2b31('0xf'));var authService=require(_0x2b31('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2b31('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b31('0x12'))('api');var utils=require(_0x2b31('0x13'));var config=require(_0x2b31('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b31('0x15'))['db'];function respondWithStatusCode(_0x3ae11a,_0x17c5e8){_0x17c5e8=_0x17c5e8||0xcc;return function(_0x4c3fe3){if(_0x4c3fe3){return _0x3ae11a[_0x2b31('0x16')](_0x17c5e8);}return _0x3ae11a[_0x2b31('0x17')](_0x17c5e8)['end']();};}function respondWithResult(_0xd03cd5,_0x5f3433){_0x5f3433=_0x5f3433||0xc8;return function(_0x481578){if(_0x481578){return _0xd03cd5[_0x2b31('0x17')](_0x5f3433)['json'](_0x481578);}};}function respondWithFilteredResult(_0x8739f8,_0xd4d493){return function(_0x3e2272){if(_0x3e2272){var _0x48111f=typeof _0xd4d493[_0x2b31('0x18')]===_0x2b31('0x19')&&typeof _0xd4d493[_0x2b31('0x1a')]===_0x2b31('0x19');var _0x5c0adc=_0x3e2272['count'];var _0x31172c=_0x48111f?0x0:_0xd4d493[_0x2b31('0x18')];var _0x302143=_0x48111f?_0x3e2272[_0x2b31('0x1b')]:_0xd4d493[_0x2b31('0x18')]+_0xd4d493['limit'];var _0x45db2f;if(_0x302143>=_0x5c0adc){_0x302143=_0x5c0adc;_0x45db2f=0xc8;}else{_0x45db2f=0xce;}_0x8739f8[_0x2b31('0x17')](_0x45db2f);return _0x8739f8[_0x2b31('0x1c')](_0x2b31('0x1d'),_0x31172c+'-'+_0x302143+'/'+_0x5c0adc)['json'](_0x3e2272);}return null;};}function patchUpdates(_0x52a622){return function(_0x4c56bb){try{jsonpatch[_0x2b31('0x1e')](_0x4c56bb,_0x52a622,!![]);}catch(_0x47d672){return BPromise['reject'](_0x47d672);}return _0x4c56bb[_0x2b31('0x1f')]();};}function saveUpdates(_0x2891b0,_0x3b001a){return function(_0x273d3b){if(_0x273d3b){return _0x273d3b[_0x2b31('0x20')](_0x2891b0)[_0x2b31('0x21')](function(_0x30a614){return _0x30a614;});}return null;};}function removeEntity(_0x87cfb6,_0x37a41b){return function(_0xcec05f){if(_0xcec05f){return _0xcec05f[_0x2b31('0x22')]()['then'](function(){_0x87cfb6[_0x2b31('0x17')](0xcc)[_0x2b31('0x23')]();});}};}function handleEntityNotFound(_0x31b62c,_0x16daa7){return function(_0x33977e){if(!_0x33977e){_0x31b62c[_0x2b31('0x16')](0x194);}return _0x33977e;};}function handleError(_0x24ff97,_0x3cbad2){_0x3cbad2=_0x3cbad2||0x1f4;return function(_0x355868){logger['error'](_0x355868[_0x2b31('0x24')]);if(_0x355868[_0x2b31('0x25')]){delete _0x355868['name'];}_0x24ff97[_0x2b31('0x17')](_0x3cbad2)['send'](_0x355868);};}exports[_0x2b31('0x26')]=function(_0x3a295e,_0x722f52){var _0x119efa={},_0x5eeac4={},_0x3b852c={'count':0x0,'rows':[]};var _0x433f61=_[_0x2b31('0x27')](db[_0x2b31('0x28')][_0x2b31('0x29')],function(_0x58103c){return{'name':_0x58103c[_0x2b31('0x2a')],'type':_0x58103c[_0x2b31('0x2b')]['key']};});_0x5eeac4[_0x2b31('0x2c')]=_[_0x2b31('0x27')](_0x433f61,_0x2b31('0x25'));_0x5eeac4[_0x2b31('0x2d')]=_['keys'](_0x3a295e[_0x2b31('0x2d')]);_0x5eeac4[_0x2b31('0x2e')]=_[_0x2b31('0x2f')](_0x5eeac4[_0x2b31('0x2c')],_0x5eeac4['query']);_0x119efa[_0x2b31('0x30')]=_[_0x2b31('0x2f')](_0x5eeac4[_0x2b31('0x2c')],qs[_0x2b31('0x31')](_0x3a295e[_0x2b31('0x2d')][_0x2b31('0x31')]));_0x119efa[_0x2b31('0x30')]=_0x119efa[_0x2b31('0x30')][_0x2b31('0x32')]?_0x119efa[_0x2b31('0x30')]:_0x5eeac4['model'];if(!_0x3a295e['query'][_0x2b31('0x33')](_0x2b31('0x34'))){_0x119efa[_0x2b31('0x1a')]=qs[_0x2b31('0x1a')](_0x3a295e['query'][_0x2b31('0x1a')]);_0x119efa['offset']=qs['offset'](_0x3a295e[_0x2b31('0x2d')]['offset']);}_0x119efa[_0x2b31('0x35')]=qs[_0x2b31('0x36')](_0x3a295e[_0x2b31('0x2d')][_0x2b31('0x36')]);_0x119efa[_0x2b31('0x37')]=qs[_0x2b31('0x2e')](_['pick'](_0x3a295e['query'],_0x5eeac4['filters']),_0x433f61);if(_0x3a295e[_0x2b31('0x2d')][_0x2b31('0x38')]){_0x119efa[_0x2b31('0x37')]=_[_0x2b31('0x39')](_0x119efa[_0x2b31('0x37')],{'$or':_[_0x2b31('0x27')](_0x433f61,function(_0x53431f){if(_0x53431f[_0x2b31('0x2b')]!=='VIRTUAL'){var _0x24d608={};_0x24d608[_0x53431f[_0x2b31('0x25')]]={'$like':'%'+_0x3a295e[_0x2b31('0x2d')]['filter']+'%'};return _0x24d608;}})});}_0x119efa=_[_0x2b31('0x39')]({},_0x119efa,_0x3a295e[_0x2b31('0x3a')]);var _0x814e03={'where':_0x119efa[_0x2b31('0x37')]};return db['IntegrationReport'][_0x2b31('0x1b')](_0x814e03)[_0x2b31('0x21')](function(_0x156e36){_0x3b852c[_0x2b31('0x1b')]=_0x156e36;if(_0x3a295e[_0x2b31('0x2d')][_0x2b31('0x3b')]){_0x119efa[_0x2b31('0x3c')]=[{'all':!![]}];}return db[_0x2b31('0x28')][_0x2b31('0x3d')](_0x119efa);})[_0x2b31('0x21')](function(_0x18578f){_0x3b852c['rows']=_0x18578f;return _0x3b852c;})['then'](respondWithFilteredResult(_0x722f52,_0x119efa))[_0x2b31('0x3e')](handleError(_0x722f52,null));};exports['show']=function(_0xc4f49b,_0x16e8a5){var _0xa5c16e={'raw':![],'where':{'id':_0xc4f49b[_0x2b31('0x3f')]['id']}},_0x11dcaa={};_0x11dcaa['model']=_[_0x2b31('0x40')](db['IntegrationReport'][_0x2b31('0x29')]);_0x11dcaa[_0x2b31('0x2d')]=_[_0x2b31('0x40')](_0xc4f49b[_0x2b31('0x2d')]);_0x11dcaa[_0x2b31('0x2e')]=_[_0x2b31('0x2f')](_0x11dcaa[_0x2b31('0x2c')],_0x11dcaa[_0x2b31('0x2d')]);_0xa5c16e[_0x2b31('0x30')]=_[_0x2b31('0x2f')](_0x11dcaa['model'],qs[_0x2b31('0x31')](_0xc4f49b[_0x2b31('0x2d')][_0x2b31('0x31')]));_0xa5c16e[_0x2b31('0x30')]=_0xa5c16e['attributes'][_0x2b31('0x32')]?_0xa5c16e[_0x2b31('0x30')]:_0x11dcaa[_0x2b31('0x2c')];if(_0xc4f49b[_0x2b31('0x2d')]['includeAll']){_0xa5c16e[_0x2b31('0x3c')]=[{'all':!![]}];}_0xa5c16e=_[_0x2b31('0x39')]({},_0xa5c16e,_0xc4f49b['options']);return db[_0x2b31('0x28')]['find'](_0xa5c16e)[_0x2b31('0x21')](handleEntityNotFound(_0x16e8a5,null))[_0x2b31('0x21')](respondWithResult(_0x16e8a5,null))[_0x2b31('0x3e')](handleError(_0x16e8a5,null));};exports[_0x2b31('0x41')]=function(_0x47fe32,_0x10df98){return db[_0x2b31('0x28')][_0x2b31('0x41')](_0x47fe32[_0x2b31('0x42')],{})[_0x2b31('0x21')](respondWithResult(_0x10df98,0xc9))['catch'](handleError(_0x10df98,null));};exports[_0x2b31('0x20')]=function(_0x223991,_0x5963f1){if(_0x223991[_0x2b31('0x42')]['id']){delete _0x223991[_0x2b31('0x42')]['id'];}return db[_0x2b31('0x28')]['find']({'where':{'id':_0x223991[_0x2b31('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5963f1,null))[_0x2b31('0x21')](saveUpdates(_0x223991[_0x2b31('0x42')],null))[_0x2b31('0x21')](respondWithResult(_0x5963f1,null))[_0x2b31('0x3e')](handleError(_0x5963f1,null));};exports[_0x2b31('0x22')]=function(_0x3c82fe,_0x437c09){return db[_0x2b31('0x28')]['find']({'where':{'id':_0x3c82fe[_0x2b31('0x3f')]['id']}})[_0x2b31('0x21')](handleEntityNotFound(_0x437c09,null))[_0x2b31('0x21')](removeEntity(_0x437c09,null))[_0x2b31('0x3e')](handleError(_0x437c09,null));};exports[_0x2b31('0x43')]=function(_0xb800a1,_0x3a3198){return db['IntegrationReport'][_0x2b31('0x43')]()[_0x2b31('0x21')](respondWithResult(_0x3a3198,null))[_0x2b31('0x3e')](handleError(_0x3a3198,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 01a8586..91e338a 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 _0x4859=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x4859,0x82));var _0x9485=function(_0x33b688,_0x17eb2d){_0x33b688=_0x33b688-0x0;var _0x638751=_0x4859[_0x33b688];return _0x638751;};'use strict';var _=require('lodash');var util=require(_0x9485('0x0'));var logger=require(_0x9485('0x1'))(_0x9485('0x2'));var moment=require('moment');var BPromise=require(_0x9485('0x3'));var rp=require(_0x9485('0x4'));var fs=require('fs');var path=require(_0x9485('0x5'));var rimraf=require(_0x9485('0x6'));var config=require(_0x9485('0x7'));var attributes=require(_0x9485('0x8'));module['exports']=function(_0x145e4b,_0x9dbf64){return _0x145e4b['define'](_0x9485('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x921f=['../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','api','moment','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x921f,0x69));var _0xf921=function(_0x519c97,_0x8f157e){_0x519c97=_0x519c97-0x0;var _0x3815eb=_0x921f[_0x519c97];return _0x3815eb;};'use strict';var _=require(_0xf921('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf921('0x1'));var moment=require(_0xf921('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf921('0x3'));var rimraf=require(_0xf921('0x4'));var config=require(_0xf921('0x5'));var attributes=require(_0xf921('0x6'));module['exports']=function(_0x54fd83,_0x376cfa){return _0x54fd83[_0xf921('0x7')](_0xf921('0x8'),attributes,{'tableName':_0xf921('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 0524229..6e663ca 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x48483e,_0x3304d8){var _0x26684a=function(_0x38c618){while(--_0x38c618){_0x48483e['push'](_0x48483e['shift']());}};_0x26684a(++_0x3304d8);}(_0x326f,0xd1));var _0xf326=function(_0x3d432f,_0x3ad173){_0x3d432f=_0x3d432f-0x0;var _0x5bf56e=_0x326f[_0x3d432f];return _0x5bf56e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b55e4,_0x4ecad8){var _0x272e1e=function(_0x558833){while(--_0x558833){_0x1b55e4['push'](_0x1b55e4['shift']());}};_0x272e1e(++_0x4ecad8);}(_0x0295,0x1f0));var _0x5029=function(_0x208cf0,_0x486665){_0x208cf0=_0x208cf0-0x0;var _0x372d0d=_0x0295[_0x208cf0];return _0x372d0d;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index b69a709..ad7ed53 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 _0x39d4=['post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','index','get','/:id','isAuthenticated','show','getIntervals','create'];(function(_0x34ef8e,_0x5a9507){var _0x339bf3=function(_0x33cd72){while(--_0x33cd72){_0x34ef8e['push'](_0x34ef8e['shift']());}};_0x339bf3(++_0x5a9507);}(_0x39d4,0x9e));var _0x439d=function(_0x38d7d5,_0x143ee9){_0x38d7d5=_0x38d7d5-0x0;var _0x2fc0fe=_0x39d4[_0x38d7d5];return _0x2fc0fe;};'use strict';var multer=require(_0x439d('0x0'));var util=require(_0x439d('0x1'));var path=require(_0x439d('0x2'));var timeout=require(_0x439d('0x3'));var express=require(_0x439d('0x4'));var router=express[_0x439d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x439d('0x6'));var interaction=require(_0x439d('0x7'));var config=require(_0x439d('0x8'));var controller=require(_0x439d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x439d('0xa')]);router[_0x439d('0xb')](_0x439d('0xc'),auth[_0x439d('0xd')](),controller[_0x439d('0xe')]);router['get']('/:id/sub_intervals',auth[_0x439d('0xd')](),controller[_0x439d('0xf')]);router['post']('/',auth[_0x439d('0xd')](),controller[_0x439d('0x10')]);router[_0x439d('0x11')](_0x439d('0x12'),auth['isAuthenticated'](),controller[_0x439d('0x13')]);router[_0x439d('0x11')](_0x439d('0x14'),auth['isAuthenticated'](),controller[_0x439d('0x15')]);router[_0x439d('0x16')](_0x439d('0xc'),auth[_0x439d('0xd')](),controller['update']);router['delete'](_0x439d('0xc'),auth[_0x439d('0xd')](),controller[_0x439d('0x17')]);module[_0x439d('0x18')]=router; \ No newline at end of file +var _0xa6bb=['Router','../../components/interaction/service','../../config/environment','./interval.controller','get','/:id','isAuthenticated','/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x2dbc35,_0x1efafa){var _0x589a4b=function(_0x5340de){while(--_0x5340de){_0x2dbc35['push'](_0x2dbc35['shift']());}};_0x589a4b(++_0x1efafa);}(_0xa6bb,0x12c));var _0xba6b=function(_0x2d20f0,_0x539454){_0x2d20f0=_0x2d20f0-0x0;var _0x582505=_0xa6bb[_0x2d20f0];return _0x582505;};'use strict';var multer=require('multer');var util=require(_0xba6b('0x0'));var path=require(_0xba6b('0x1'));var timeout=require(_0xba6b('0x2'));var express=require(_0xba6b('0x3'));var router=express[_0xba6b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba6b('0x5'));var config=require(_0xba6b('0x6'));var controller=require(_0xba6b('0x7'));router[_0xba6b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xba6b('0x8')](_0xba6b('0x9'),auth[_0xba6b('0xa')](),controller['show']);router['get'](_0xba6b('0xb'),auth[_0xba6b('0xa')](),controller[_0xba6b('0xc')]);router[_0xba6b('0xd')]('/',auth[_0xba6b('0xa')](),controller['create']);router[_0xba6b('0xd')](_0xba6b('0xb'),auth[_0xba6b('0xa')](),controller['addInterval']);router[_0xba6b('0xd')](_0xba6b('0xe'),auth[_0xba6b('0xa')](),controller[_0xba6b('0xf')]);router['put'](_0xba6b('0x9'),auth['isAuthenticated'](),controller[_0xba6b('0x10')]);router[_0xba6b('0x11')](_0xba6b('0x9'),auth[_0xba6b('0xa')](),controller[_0xba6b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 4a46a18..80d7c9b 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 _0xba61=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba61,0xc5));var _0x1ba6=function(_0x22672b,_0x30ace3){_0x22672b=_0x22672b-0x0;var _0x36f803=_0xba61[_0x22672b];return _0x36f803;};'use strict';var Sequelize=require(_0x1ba6('0x0'));module[_0x1ba6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1ba6('0x2')]},'interval':{'type':Sequelize[_0x1ba6('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x603f=['STRING','exports'];(function(_0x3b0459,_0xaaecd7){var _0x11a2cf=function(_0x536aef){while(--_0x536aef){_0x3b0459['push'](_0x3b0459['shift']());}};_0x11a2cf(++_0xaaecd7);}(_0x603f,0x177));var _0xf603=function(_0x204970,_0x2e8f37){_0x204970=_0x204970-0x0;var _0x43dc1f=_0x603f[_0x204970];return _0x43dc1f;};'use strict';var Sequelize=require('sequelize');module[_0xf603('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf603('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 6ee95e0..8b81b11 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 _0xa218=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','limit','count','offset','set','Content-Range','reject','save','then','destroy','get','sendStatus','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Interval','includeAll','include','catch','show','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','IntervalId','getIntervals','addIntervals','findOne','sequelize','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x4259a3,_0x2f9e82){var _0x5dfed4=function(_0x443519){while(--_0x443519){_0x4259a3['push'](_0x4259a3['shift']());}};_0x5dfed4(++_0x2f9e82);}(_0xa218,0x9e));var _0x8a21=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa218[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a21('0x0'));var zipdir=require(_0x8a21('0x1'));var jsonpatch=require(_0x8a21('0x2'));var rp=require(_0x8a21('0x3'));var moment=require(_0x8a21('0x4'));var BPromise=require(_0x8a21('0x5'));var Mustache=require(_0x8a21('0x6'));var util=require(_0x8a21('0x7'));var path=require(_0x8a21('0x8'));var sox=require('sox');var csv=require(_0x8a21('0x9'));var ejs=require(_0x8a21('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8a21('0xb'));var crypto=require(_0x8a21('0xc'));var jsforce=require(_0x8a21('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8a21('0x9'));var querystring=require(_0x8a21('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8a21('0xf'));var qs=require(_0x8a21('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a21('0x11'));var logger=require(_0x8a21('0x12'))(_0x8a21('0x13'));var utils=require(_0x8a21('0x14'));var config=require(_0x8a21('0x15'));var licenseUtil=require(_0x8a21('0x16'));var db=require(_0x8a21('0x17'))['db'];var extensions=require(_0x8a21('0x18'));function respondWithStatusCode(_0x3af8ef,_0x4f8716){_0x4f8716=_0x4f8716||0xcc;return function(_0x3e3061){if(_0x3e3061){return _0x3af8ef['sendStatus'](_0x4f8716);}return _0x3af8ef[_0x8a21('0x19')](_0x4f8716)[_0x8a21('0x1a')]();};}function respondWithResult(_0x382cc0,_0x1e3c62){_0x1e3c62=_0x1e3c62||0xc8;return function(_0x4621d0){if(_0x4621d0){return _0x382cc0[_0x8a21('0x19')](_0x1e3c62)[_0x8a21('0x1b')](_0x4621d0);}};}function respondWithFilteredResult(_0x70d0cb,_0xe851d){return function(_0x206e9e){if(_0x206e9e){var _0x539893=typeof _0xe851d['offset']==='undefined'&&typeof _0xe851d[_0x8a21('0x1c')]==='undefined';var _0xa76860=_0x206e9e[_0x8a21('0x1d')];var _0x477483=_0x539893?0x0:_0xe851d[_0x8a21('0x1e')];var _0x271069=_0x539893?_0x206e9e['count']:_0xe851d[_0x8a21('0x1e')]+_0xe851d[_0x8a21('0x1c')];var _0x156bad;if(_0x271069>=_0xa76860){_0x271069=_0xa76860;_0x156bad=0xc8;}else{_0x156bad=0xce;}_0x70d0cb[_0x8a21('0x19')](_0x156bad);return _0x70d0cb[_0x8a21('0x1f')](_0x8a21('0x20'),_0x477483+'-'+_0x271069+'/'+_0xa76860)[_0x8a21('0x1b')](_0x206e9e);}return null;};}function patchUpdates(_0xdc3ced){return function(_0x936964){try{jsonpatch['apply'](_0x936964,_0xdc3ced,!![]);}catch(_0x1a1836){return BPromise[_0x8a21('0x21')](_0x1a1836);}return _0x936964[_0x8a21('0x22')]();};}function saveUpdates(_0x18e085,_0x165e40){return function(_0x8d5fec){if(_0x8d5fec){return _0x8d5fec['update'](_0x18e085)[_0x8a21('0x23')](function(_0x547d7c){return _0x547d7c;});}return null;};}function removeEntity(_0x27f8f4,_0x2f088c){return function(_0x20de51){if(_0x20de51){return _0x20de51[_0x8a21('0x24')]()[_0x8a21('0x23')](function(){var _0x2a4d20=_0x20de51[_0x8a21('0x25')]({'plain':!![]});var _0x150379='Intervals';return db['UserProfileResource'][_0x8a21('0x24')]({'where':{'type':_0x150379,'resourceId':_0x2a4d20['id']}})[_0x8a21('0x23')](function(){return _0x20de51;});})[_0x8a21('0x23')](function(){_0x27f8f4[_0x8a21('0x19')](0xcc)[_0x8a21('0x1a')]();});}};}function handleEntityNotFound(_0xf8639b,_0x324b6a){return function(_0x1aada){if(!_0x1aada){_0xf8639b[_0x8a21('0x26')](0x194);}return _0x1aada;};}function handleError(_0x5ad75f,_0x2f287a){_0x2f287a=_0x2f287a||0x1f4;return function(_0xe4acd9){logger['error'](_0xe4acd9['stack']);if(_0xe4acd9[_0x8a21('0x27')]){delete _0xe4acd9[_0x8a21('0x27')];}_0x5ad75f[_0x8a21('0x19')](_0x2f287a)[_0x8a21('0x28')](_0xe4acd9);};}exports[_0x8a21('0x29')]=function(_0x1ef499,_0x356e6f){var _0x39ee0a={},_0x3184d0={},_0x805dd2={'count':0x0,'rows':[]};var _0x4828fb=_[_0x8a21('0x2a')](db['Interval'][_0x8a21('0x2b')],function(_0x4485e5){return{'name':_0x4485e5[_0x8a21('0x2c')],'type':_0x4485e5['type'][_0x8a21('0x2d')]};});_0x3184d0['model']=_[_0x8a21('0x2a')](_0x4828fb,_0x8a21('0x27'));_0x3184d0[_0x8a21('0x2e')]=_[_0x8a21('0x2f')](_0x1ef499[_0x8a21('0x2e')]);_0x3184d0[_0x8a21('0x30')]=_[_0x8a21('0x31')](_0x3184d0[_0x8a21('0x32')],_0x3184d0[_0x8a21('0x2e')]);_0x39ee0a['attributes']=_[_0x8a21('0x31')](_0x3184d0[_0x8a21('0x32')],qs[_0x8a21('0x33')](_0x1ef499[_0x8a21('0x2e')][_0x8a21('0x33')]));_0x39ee0a[_0x8a21('0x34')]=_0x39ee0a[_0x8a21('0x34')]['length']?_0x39ee0a[_0x8a21('0x34')]:_0x3184d0['model'];if(!_0x1ef499[_0x8a21('0x2e')][_0x8a21('0x35')](_0x8a21('0x36'))){_0x39ee0a[_0x8a21('0x1c')]=qs[_0x8a21('0x1c')](_0x1ef499[_0x8a21('0x2e')][_0x8a21('0x1c')]);_0x39ee0a[_0x8a21('0x1e')]=qs['offset'](_0x1ef499[_0x8a21('0x2e')][_0x8a21('0x1e')]);}_0x39ee0a[_0x8a21('0x37')]=qs[_0x8a21('0x38')](_0x1ef499[_0x8a21('0x2e')]['sort']);_0x39ee0a[_0x8a21('0x39')]=qs[_0x8a21('0x30')](_[_0x8a21('0x3a')](_0x1ef499[_0x8a21('0x2e')],_0x3184d0[_0x8a21('0x30')]),_0x4828fb);if(_0x1ef499[_0x8a21('0x2e')][_0x8a21('0x3b')]){_0x39ee0a[_0x8a21('0x39')]=_[_0x8a21('0x3c')](_0x39ee0a[_0x8a21('0x39')],{'$or':_[_0x8a21('0x2a')](_0x4828fb,function(_0x46beae){if(_0x46beae['type']!==_0x8a21('0x3d')){var _0x1b1382={};_0x1b1382[_0x46beae[_0x8a21('0x27')]]={'$like':'%'+_0x1ef499[_0x8a21('0x2e')][_0x8a21('0x3b')]+'%'};return _0x1b1382;}})});}_0x39ee0a=_['merge']({},_0x39ee0a,_0x1ef499['options']);var _0x36600d={'where':_0x39ee0a['where']};return db[_0x8a21('0x3e')][_0x8a21('0x1d')](_0x36600d)['then'](function(_0x15b624){_0x805dd2[_0x8a21('0x1d')]=_0x15b624;if(_0x1ef499[_0x8a21('0x2e')][_0x8a21('0x3f')]){_0x39ee0a[_0x8a21('0x40')]=[{'all':!![]}];}return db[_0x8a21('0x3e')]['findAll'](_0x39ee0a);})[_0x8a21('0x23')](function(_0x11934a){_0x805dd2['rows']=_0x11934a;return _0x805dd2;})[_0x8a21('0x23')](respondWithFilteredResult(_0x356e6f,_0x39ee0a))[_0x8a21('0x41')](handleError(_0x356e6f,null));};exports[_0x8a21('0x42')]=function(_0x51a86a,_0x314d8b){var _0x3411b2={'raw':!![],'where':{'id':_0x51a86a['params']['id']}},_0x3d5c93={};_0x3d5c93[_0x8a21('0x32')]=_['keys'](db[_0x8a21('0x3e')][_0x8a21('0x2b')]);_0x3d5c93[_0x8a21('0x2e')]=_[_0x8a21('0x2f')](_0x51a86a['query']);_0x3d5c93[_0x8a21('0x30')]=_[_0x8a21('0x31')](_0x3d5c93[_0x8a21('0x32')],_0x3d5c93[_0x8a21('0x2e')]);_0x3411b2[_0x8a21('0x34')]=_[_0x8a21('0x31')](_0x3d5c93[_0x8a21('0x32')],qs[_0x8a21('0x33')](_0x51a86a['query'][_0x8a21('0x33')]));_0x3411b2[_0x8a21('0x34')]=_0x3411b2['attributes'][_0x8a21('0x43')]?_0x3411b2[_0x8a21('0x34')]:_0x3d5c93[_0x8a21('0x32')];if(_0x51a86a[_0x8a21('0x2e')][_0x8a21('0x3f')]){_0x3411b2[_0x8a21('0x40')]=[{'all':!![]}];}_0x3411b2=_[_0x8a21('0x3c')]({},_0x3411b2,_0x51a86a[_0x8a21('0x44')]);return db[_0x8a21('0x3e')][_0x8a21('0x45')](_0x3411b2)[_0x8a21('0x23')](handleEntityNotFound(_0x314d8b,null))[_0x8a21('0x23')](respondWithResult(_0x314d8b,null))[_0x8a21('0x41')](handleError(_0x314d8b,null));};exports[_0x8a21('0x46')]=function(_0x5d6887,_0x3f466c){return db[_0x8a21('0x3e')][_0x8a21('0x46')](_0x5d6887[_0x8a21('0x47')],{})['then'](function(_0x4c571c){var _0x28fca3=_0x5d6887[_0x8a21('0x48')]['get']({'plain':!![]});if(!_0x28fca3)throw new Error(_0x8a21('0x49'));if(_0x28fca3[_0x8a21('0x4a')]===_0x8a21('0x48')){var _0x3eba2c=_0x4c571c['get']({'plain':!![]});var _0x4a5aea=_0x8a21('0x4b');return db['UserProfileSection'][_0x8a21('0x45')]({'where':{'name':_0x4a5aea,'userProfileId':_0x28fca3[_0x8a21('0x4c')]},'raw':!![]})[_0x8a21('0x23')](function(_0x7545a7){if(_0x7545a7&&_0x7545a7[_0x8a21('0x4d')]===0x0){return db[_0x8a21('0x4e')]['create']({'name':_0x3eba2c['name'],'resourceId':_0x3eba2c['id'],'type':_0x7545a7[_0x8a21('0x27')],'sectionId':_0x7545a7['id']},{})[_0x8a21('0x23')](function(){return _0x4c571c;});}else{return _0x4c571c;}})[_0x8a21('0x41')](function(_0x29d3bb){logger[_0x8a21('0x4f')](_0x8a21('0x50'),_0x29d3bb);throw _0x29d3bb;});}return _0x4c571c;})['then'](respondWithResult(_0x3f466c,0xc9))['catch'](handleError(_0x3f466c,null));};exports[_0x8a21('0x51')]=function(_0x4649f1,_0x1e7498){if(_0x4649f1[_0x8a21('0x47')]['id']){delete _0x4649f1[_0x8a21('0x47')]['id'];}return db['Interval'][_0x8a21('0x45')]({'where':{'id':_0x4649f1[_0x8a21('0x52')]['id']}})[_0x8a21('0x23')](handleEntityNotFound(_0x1e7498,null))[_0x8a21('0x23')](saveUpdates(_0x4649f1[_0x8a21('0x47')],null))['then'](respondWithResult(_0x1e7498,null))[_0x8a21('0x41')](handleError(_0x1e7498,null));};exports[_0x8a21('0x24')]=function(_0x26c55a,_0x2af3b1){return db['Interval'][_0x8a21('0x45')]({'where':{'id':_0x26c55a['params']['id']}})[_0x8a21('0x23')](handleEntityNotFound(_0x2af3b1,null))[_0x8a21('0x23')](removeEntity(_0x2af3b1,null))[_0x8a21('0x41')](handleError(_0x2af3b1,null));};exports['addInterval']=function(_0xd04bf,_0x4581c0,_0x16eb80){if(_0xd04bf[_0x8a21('0x47')]['id']){delete _0xd04bf['body']['id'];}return db['Interval'][_0x8a21('0x45')]({'where':{'id':_0xd04bf[_0x8a21('0x52')]['id']}})[_0x8a21('0x23')](handleEntityNotFound(_0x4581c0,null))[_0x8a21('0x23')](function(_0x4fe2fb){if(_0x4fe2fb){_0xd04bf[_0x8a21('0x47')][_0x8a21('0x53')]=_0x4fe2fb['id'];return db[_0x8a21('0x3e')][_0x8a21('0x46')](_0xd04bf[_0x8a21('0x47')]);}})[_0x8a21('0x23')](respondWithResult(_0x4581c0,null))[_0x8a21('0x41')](handleError(_0x4581c0,null));};exports[_0x8a21('0x54')]=function(_0x4af237,_0x48950f,_0x3d9e24){var _0x4b19a9={};var _0x3981f1={};var _0x100f9e;var _0x46180a;return db[_0x8a21('0x3e')]['findOne']({'where':{'id':_0x4af237[_0x8a21('0x52')]['id']}})[_0x8a21('0x23')](handleEntityNotFound(_0x48950f,null))[_0x8a21('0x23')](function(_0x171c0c){if(_0x171c0c){_0x100f9e=_0x171c0c;_0x3981f1['model']=_[_0x8a21('0x2f')](db[_0x8a21('0x3e')][_0x8a21('0x2b')]);_0x3981f1[_0x8a21('0x2e')]=_['keys'](_0x4af237[_0x8a21('0x2e')]);_0x3981f1[_0x8a21('0x30')]=_[_0x8a21('0x31')](_0x3981f1[_0x8a21('0x32')],_0x3981f1['query']);_0x4b19a9[_0x8a21('0x34')]=_[_0x8a21('0x31')](_0x3981f1[_0x8a21('0x32')],qs[_0x8a21('0x33')](_0x4af237[_0x8a21('0x2e')][_0x8a21('0x33')]));_0x4b19a9[_0x8a21('0x34')]=_0x4b19a9[_0x8a21('0x34')]['length']?_0x4b19a9[_0x8a21('0x34')]:_0x3981f1[_0x8a21('0x32')];_0x4b19a9[_0x8a21('0x37')]=qs[_0x8a21('0x38')](_0x4af237[_0x8a21('0x2e')]['sort']);_0x4b19a9['where']=qs[_0x8a21('0x30')](_['pick'](_0x4af237['query'],_0x3981f1[_0x8a21('0x30')]));if(_0x4af237[_0x8a21('0x2e')][_0x8a21('0x3b')]){_0x4b19a9[_0x8a21('0x39')]=_['merge'](_0x4b19a9[_0x8a21('0x39')],{'$or':_[_0x8a21('0x2a')](_0x4b19a9[_0x8a21('0x34')],function(_0x29d525){var _0x36cc08={};_0x36cc08[_0x29d525]={'$like':'%'+_0x4af237[_0x8a21('0x2e')][_0x8a21('0x3b')]+'%'};return _0x36cc08;})});}_0x4b19a9=_['merge']({},_0x4b19a9,_0x4af237['options']);return _0x100f9e[_0x8a21('0x54')](_0x4b19a9);}})[_0x8a21('0x23')](function(_0x1038bc){if(_0x1038bc){_0x46180a=_0x1038bc['length'];if(!_0x4af237[_0x8a21('0x2e')][_0x8a21('0x35')]('nolimit')){_0x4b19a9[_0x8a21('0x1c')]=qs[_0x8a21('0x1c')](_0x4af237['query'][_0x8a21('0x1c')]);_0x4b19a9[_0x8a21('0x1e')]=qs['offset'](_0x4af237[_0x8a21('0x2e')][_0x8a21('0x1e')]);}return _0x100f9e[_0x8a21('0x54')](_0x4b19a9);}})[_0x8a21('0x23')](function(_0x14f88e){if(_0x14f88e){return _0x14f88e?{'count':_0x46180a,'rows':_0x14f88e}:null;}})[_0x8a21('0x23')](respondWithResult(_0x48950f,null))[_0x8a21('0x41')](handleError(_0x48950f,null));};exports[_0x8a21('0x55')]=function(_0x4f76c1,_0x545077,_0x780f9e){return db[_0x8a21('0x3e')][_0x8a21('0x56')]({'where':{'id':_0x4f76c1[_0x8a21('0x52')]['id']}})[_0x8a21('0x23')](handleEntityNotFound(_0x545077,null))[_0x8a21('0x23')](function(_0x5781d3){if(_0x5781d3){return db[_0x8a21('0x57')]['transaction'](function(_0x57606b){return db[_0x8a21('0x3e')]['destroy']({'where':{'IntervalId':_0x4f76c1[_0x8a21('0x52')]['id']},'transaction':_0x57606b})[_0x8a21('0x23')](function(_0x13881c){var _0x4085b1=_['map'](_0x4f76c1[_0x8a21('0x47')],function(_0x305e09){delete _0x305e09['id'];_0x305e09[_0x8a21('0x53')]=_0x4f76c1[_0x8a21('0x52')]['id'];return _0x305e09;});return db['Interval'][_0x8a21('0x58')](_0x4085b1,{'transaction':_0x57606b});});})['then'](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x4f76c1[_0x8a21('0x52')]['id']}});});}})[_0x8a21('0x23')](respondWithResult(_0x545077,null))[_0x8a21('0x41')](handleError(_0x545077,null));}; \ No newline at end of file +var _0x8b6c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','index','map','Interval','rawAttributes','type','key','model','keys','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','catch','show','fields','length','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite'];(function(_0x20a753,_0x22651c){var _0x14cd14=function(_0x4d0fde){while(--_0x4d0fde){_0x20a753['push'](_0x20a753['shift']());}};_0x14cd14(++_0x22651c);}(_0x8b6c,0x9c));var _0xc8b6=function(_0x3c01be,_0xc8b4dc){_0x3c01be=_0x3c01be-0x0;var _0x4369c2=_0x8b6c[_0x3c01be];return _0x4369c2;};'use strict';var emlformat=require(_0xc8b6('0x0'));var rimraf=require(_0xc8b6('0x1'));var zipdir=require(_0xc8b6('0x2'));var jsonpatch=require(_0xc8b6('0x3'));var rp=require(_0xc8b6('0x4'));var moment=require(_0xc8b6('0x5'));var BPromise=require(_0xc8b6('0x6'));var Mustache=require('mustache');var util=require(_0xc8b6('0x7'));var path=require(_0xc8b6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc8b6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8b6('0xa'));var squel=require(_0xc8b6('0xb'));var crypto=require(_0xc8b6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc8b6('0xd'));var toCsv=require(_0xc8b6('0xe'));var querystring=require(_0xc8b6('0xf'));var Papa=require(_0xc8b6('0x10'));var Redis=require(_0xc8b6('0x11'));var authService=require(_0xc8b6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8b6('0x13'));var logger=require(_0xc8b6('0x14'))(_0xc8b6('0x15'));var utils=require('../../config/utils');var config=require(_0xc8b6('0x16'));var licenseUtil=require(_0xc8b6('0x17'));var db=require(_0xc8b6('0x18'))['db'];var extensions=require(_0xc8b6('0x19'));function respondWithStatusCode(_0x4aeb2c,_0x561971){_0x561971=_0x561971||0xcc;return function(_0x260374){if(_0x260374){return _0x4aeb2c[_0xc8b6('0x1a')](_0x561971);}return _0x4aeb2c[_0xc8b6('0x1b')](_0x561971)[_0xc8b6('0x1c')]();};}function respondWithResult(_0x2e1f79,_0x449d32){_0x449d32=_0x449d32||0xc8;return function(_0x564e87){if(_0x564e87){return _0x2e1f79[_0xc8b6('0x1b')](_0x449d32)[_0xc8b6('0x1d')](_0x564e87);}};}function respondWithFilteredResult(_0x1aadcf,_0x1fe569){return function(_0xf5f87d){if(_0xf5f87d){var _0x3f5079=typeof _0x1fe569[_0xc8b6('0x1e')]===_0xc8b6('0x1f')&&typeof _0x1fe569[_0xc8b6('0x20')]===_0xc8b6('0x1f');var _0x5949e0=_0xf5f87d[_0xc8b6('0x21')];var _0x3d3ac1=_0x3f5079?0x0:_0x1fe569[_0xc8b6('0x1e')];var _0x48524b=_0x3f5079?_0xf5f87d[_0xc8b6('0x21')]:_0x1fe569['offset']+_0x1fe569[_0xc8b6('0x20')];var _0x575c5f;if(_0x48524b>=_0x5949e0){_0x48524b=_0x5949e0;_0x575c5f=0xc8;}else{_0x575c5f=0xce;}_0x1aadcf[_0xc8b6('0x1b')](_0x575c5f);return _0x1aadcf[_0xc8b6('0x22')](_0xc8b6('0x23'),_0x3d3ac1+'-'+_0x48524b+'/'+_0x5949e0)[_0xc8b6('0x1d')](_0xf5f87d);}return null;};}function patchUpdates(_0x46bbcc){return function(_0x2110a2){try{jsonpatch['apply'](_0x2110a2,_0x46bbcc,!![]);}catch(_0x76d7b6){return BPromise[_0xc8b6('0x24')](_0x76d7b6);}return _0x2110a2[_0xc8b6('0x25')]();};}function saveUpdates(_0x1f8008,_0x32f9b5){return function(_0x17546a){if(_0x17546a){return _0x17546a[_0xc8b6('0x26')](_0x1f8008)[_0xc8b6('0x27')](function(_0x2a48d2){return _0x2a48d2;});}return null;};}function removeEntity(_0x2df11a,_0xd98316){return function(_0x23827b){if(_0x23827b){return _0x23827b[_0xc8b6('0x28')]()[_0xc8b6('0x27')](function(){var _0x5aff11=_0x23827b[_0xc8b6('0x29')]({'plain':!![]});var _0x1e1ed4=_0xc8b6('0x2a');return db[_0xc8b6('0x2b')]['destroy']({'where':{'type':_0x1e1ed4,'resourceId':_0x5aff11['id']}})[_0xc8b6('0x27')](function(){return _0x23827b;});})[_0xc8b6('0x27')](function(){_0x2df11a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x143c1c,_0x1a77e8){return function(_0x1072ec){if(!_0x1072ec){_0x143c1c[_0xc8b6('0x1a')](0x194);}return _0x1072ec;};}function handleError(_0x2db8f1,_0x504ff7){_0x504ff7=_0x504ff7||0x1f4;return function(_0x47bcf8){logger[_0xc8b6('0x2c')](_0x47bcf8[_0xc8b6('0x2d')]);if(_0x47bcf8[_0xc8b6('0x2e')]){delete _0x47bcf8[_0xc8b6('0x2e')];}_0x2db8f1['status'](_0x504ff7)['send'](_0x47bcf8);};}exports[_0xc8b6('0x2f')]=function(_0x5706a0,_0x4de106){var _0x1a3715={},_0x2da5b4={},_0x2077b4={'count':0x0,'rows':[]};var _0x4683ee=_[_0xc8b6('0x30')](db[_0xc8b6('0x31')][_0xc8b6('0x32')],function(_0x294e6c){return{'name':_0x294e6c['fieldName'],'type':_0x294e6c[_0xc8b6('0x33')][_0xc8b6('0x34')]};});_0x2da5b4[_0xc8b6('0x35')]=_[_0xc8b6('0x30')](_0x4683ee,_0xc8b6('0x2e'));_0x2da5b4['query']=_[_0xc8b6('0x36')](_0x5706a0['query']);_0x2da5b4['filters']=_[_0xc8b6('0x37')](_0x2da5b4[_0xc8b6('0x35')],_0x2da5b4[_0xc8b6('0x38')]);_0x1a3715[_0xc8b6('0x39')]=_['intersection'](_0x2da5b4['model'],qs['fields'](_0x5706a0[_0xc8b6('0x38')]['fields']));_0x1a3715[_0xc8b6('0x39')]=_0x1a3715[_0xc8b6('0x39')]['length']?_0x1a3715[_0xc8b6('0x39')]:_0x2da5b4[_0xc8b6('0x35')];if(!_0x5706a0[_0xc8b6('0x38')][_0xc8b6('0x3a')](_0xc8b6('0x3b'))){_0x1a3715[_0xc8b6('0x20')]=qs[_0xc8b6('0x20')](_0x5706a0[_0xc8b6('0x38')]['limit']);_0x1a3715['offset']=qs['offset'](_0x5706a0[_0xc8b6('0x38')][_0xc8b6('0x1e')]);}_0x1a3715[_0xc8b6('0x3c')]=qs[_0xc8b6('0x3d')](_0x5706a0[_0xc8b6('0x38')][_0xc8b6('0x3d')]);_0x1a3715[_0xc8b6('0x3e')]=qs[_0xc8b6('0x3f')](_['pick'](_0x5706a0[_0xc8b6('0x38')],_0x2da5b4[_0xc8b6('0x3f')]),_0x4683ee);if(_0x5706a0[_0xc8b6('0x38')][_0xc8b6('0x40')]){_0x1a3715[_0xc8b6('0x3e')]=_['merge'](_0x1a3715['where'],{'$or':_['map'](_0x4683ee,function(_0x5dded2){if(_0x5dded2['type']!==_0xc8b6('0x41')){var _0x2d96cd={};_0x2d96cd[_0x5dded2[_0xc8b6('0x2e')]]={'$like':'%'+_0x5706a0[_0xc8b6('0x38')]['filter']+'%'};return _0x2d96cd;}})});}_0x1a3715=_[_0xc8b6('0x42')]({},_0x1a3715,_0x5706a0[_0xc8b6('0x43')]);var _0x4f6f2f={'where':_0x1a3715[_0xc8b6('0x3e')]};return db[_0xc8b6('0x31')][_0xc8b6('0x21')](_0x4f6f2f)[_0xc8b6('0x27')](function(_0x4704b4){_0x2077b4[_0xc8b6('0x21')]=_0x4704b4;if(_0x5706a0[_0xc8b6('0x38')]['includeAll']){_0x1a3715[_0xc8b6('0x44')]=[{'all':!![]}];}return db[_0xc8b6('0x31')][_0xc8b6('0x45')](_0x1a3715);})[_0xc8b6('0x27')](function(_0x361f74){_0x2077b4['rows']=_0x361f74;return _0x2077b4;})[_0xc8b6('0x27')](respondWithFilteredResult(_0x4de106,_0x1a3715))[_0xc8b6('0x46')](handleError(_0x4de106,null));};exports[_0xc8b6('0x47')]=function(_0x5d217b,_0x3ec2ee){var _0x12de89={'raw':!![],'where':{'id':_0x5d217b['params']['id']}},_0x3e64de={};_0x3e64de['model']=_[_0xc8b6('0x36')](db[_0xc8b6('0x31')][_0xc8b6('0x32')]);_0x3e64de[_0xc8b6('0x38')]=_[_0xc8b6('0x36')](_0x5d217b[_0xc8b6('0x38')]);_0x3e64de[_0xc8b6('0x3f')]=_[_0xc8b6('0x37')](_0x3e64de[_0xc8b6('0x35')],_0x3e64de[_0xc8b6('0x38')]);_0x12de89['attributes']=_[_0xc8b6('0x37')](_0x3e64de['model'],qs['fields'](_0x5d217b[_0xc8b6('0x38')][_0xc8b6('0x48')]));_0x12de89['attributes']=_0x12de89[_0xc8b6('0x39')][_0xc8b6('0x49')]?_0x12de89[_0xc8b6('0x39')]:_0x3e64de[_0xc8b6('0x35')];if(_0x5d217b['query'][_0xc8b6('0x4a')]){_0x12de89[_0xc8b6('0x44')]=[{'all':!![]}];}_0x12de89=_[_0xc8b6('0x42')]({},_0x12de89,_0x5d217b['options']);return db['Interval'][_0xc8b6('0x4b')](_0x12de89)['then'](handleEntityNotFound(_0x3ec2ee,null))['then'](respondWithResult(_0x3ec2ee,null))[_0xc8b6('0x46')](handleError(_0x3ec2ee,null));};exports[_0xc8b6('0x4c')]=function(_0x78e49a,_0x5ede09){return db[_0xc8b6('0x31')][_0xc8b6('0x4c')](_0x78e49a[_0xc8b6('0x4d')],{})['then'](function(_0x37dd96){var _0x2152a9=_0x78e49a[_0xc8b6('0x4e')]['get']({'plain':!![]});if(!_0x2152a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2152a9[_0xc8b6('0x4f')]===_0xc8b6('0x4e')){var _0x74f4f0=_0x37dd96[_0xc8b6('0x29')]({'plain':!![]});var _0x1c9d0b=_0xc8b6('0x2a');return db[_0xc8b6('0x50')][_0xc8b6('0x4b')]({'where':{'name':_0x1c9d0b,'userProfileId':_0x2152a9[_0xc8b6('0x51')]},'raw':!![]})[_0xc8b6('0x27')](function(_0x1270b5){if(_0x1270b5&&_0x1270b5[_0xc8b6('0x52')]===0x0){return db[_0xc8b6('0x2b')]['create']({'name':_0x74f4f0['name'],'resourceId':_0x74f4f0['id'],'type':_0x1270b5['name'],'sectionId':_0x1270b5['id']},{})[_0xc8b6('0x27')](function(){return _0x37dd96;});}else{return _0x37dd96;}})[_0xc8b6('0x46')](function(_0x38e4a2){logger[_0xc8b6('0x2c')](_0xc8b6('0x53'),_0x38e4a2);throw _0x38e4a2;});}return _0x37dd96;})['then'](respondWithResult(_0x5ede09,0xc9))[_0xc8b6('0x46')](handleError(_0x5ede09,null));};exports['update']=function(_0x359815,_0x317ce9){if(_0x359815[_0xc8b6('0x4d')]['id']){delete _0x359815[_0xc8b6('0x4d')]['id'];}return db[_0xc8b6('0x31')]['find']({'where':{'id':_0x359815[_0xc8b6('0x54')]['id']}})[_0xc8b6('0x27')](handleEntityNotFound(_0x317ce9,null))[_0xc8b6('0x27')](saveUpdates(_0x359815['body'],null))['then'](respondWithResult(_0x317ce9,null))[_0xc8b6('0x46')](handleError(_0x317ce9,null));};exports[_0xc8b6('0x28')]=function(_0x2963a7,_0x2e5bcc){return db[_0xc8b6('0x31')][_0xc8b6('0x4b')]({'where':{'id':_0x2963a7[_0xc8b6('0x54')]['id']}})[_0xc8b6('0x27')](handleEntityNotFound(_0x2e5bcc,null))[_0xc8b6('0x27')](removeEntity(_0x2e5bcc,null))['catch'](handleError(_0x2e5bcc,null));};exports['addInterval']=function(_0x3c1eb1,_0x529356,_0x50892c){if(_0x3c1eb1[_0xc8b6('0x4d')]['id']){delete _0x3c1eb1['body']['id'];}return db['Interval'][_0xc8b6('0x4b')]({'where':{'id':_0x3c1eb1[_0xc8b6('0x54')]['id']}})[_0xc8b6('0x27')](handleEntityNotFound(_0x529356,null))[_0xc8b6('0x27')](function(_0x486e4b){if(_0x486e4b){_0x3c1eb1['body'][_0xc8b6('0x55')]=_0x486e4b['id'];return db['Interval']['create'](_0x3c1eb1[_0xc8b6('0x4d')]);}})[_0xc8b6('0x27')](respondWithResult(_0x529356,null))['catch'](handleError(_0x529356,null));};exports['getIntervals']=function(_0x4ccb64,_0x55988c,_0x816a43){var _0x5710e9={};var _0x27c412={};var _0x41fb72;var _0x115c9d;return db[_0xc8b6('0x31')]['findOne']({'where':{'id':_0x4ccb64['params']['id']}})[_0xc8b6('0x27')](handleEntityNotFound(_0x55988c,null))[_0xc8b6('0x27')](function(_0x28a69f){if(_0x28a69f){_0x41fb72=_0x28a69f;_0x27c412[_0xc8b6('0x35')]=_[_0xc8b6('0x36')](db[_0xc8b6('0x31')][_0xc8b6('0x32')]);_0x27c412[_0xc8b6('0x38')]=_['keys'](_0x4ccb64['query']);_0x27c412[_0xc8b6('0x3f')]=_[_0xc8b6('0x37')](_0x27c412[_0xc8b6('0x35')],_0x27c412[_0xc8b6('0x38')]);_0x5710e9['attributes']=_[_0xc8b6('0x37')](_0x27c412[_0xc8b6('0x35')],qs[_0xc8b6('0x48')](_0x4ccb64[_0xc8b6('0x38')][_0xc8b6('0x48')]));_0x5710e9[_0xc8b6('0x39')]=_0x5710e9[_0xc8b6('0x39')][_0xc8b6('0x49')]?_0x5710e9['attributes']:_0x27c412['model'];_0x5710e9['order']=qs[_0xc8b6('0x3d')](_0x4ccb64['query']['sort']);_0x5710e9[_0xc8b6('0x3e')]=qs['filters'](_['pick'](_0x4ccb64['query'],_0x27c412[_0xc8b6('0x3f')]));if(_0x4ccb64['query']['filter']){_0x5710e9[_0xc8b6('0x3e')]=_[_0xc8b6('0x42')](_0x5710e9[_0xc8b6('0x3e')],{'$or':_[_0xc8b6('0x30')](_0x5710e9['attributes'],function(_0x2e52d2){var _0x2ff8e5={};_0x2ff8e5[_0x2e52d2]={'$like':'%'+_0x4ccb64[_0xc8b6('0x38')][_0xc8b6('0x40')]+'%'};return _0x2ff8e5;})});}_0x5710e9=_[_0xc8b6('0x42')]({},_0x5710e9,_0x4ccb64[_0xc8b6('0x43')]);return _0x41fb72[_0xc8b6('0x56')](_0x5710e9);}})['then'](function(_0x412f6f){if(_0x412f6f){_0x115c9d=_0x412f6f[_0xc8b6('0x49')];if(!_0x4ccb64[_0xc8b6('0x38')][_0xc8b6('0x3a')](_0xc8b6('0x3b'))){_0x5710e9[_0xc8b6('0x20')]=qs[_0xc8b6('0x20')](_0x4ccb64[_0xc8b6('0x38')]['limit']);_0x5710e9['offset']=qs[_0xc8b6('0x1e')](_0x4ccb64[_0xc8b6('0x38')][_0xc8b6('0x1e')]);}return _0x41fb72[_0xc8b6('0x56')](_0x5710e9);}})[_0xc8b6('0x27')](function(_0x62ddce){if(_0x62ddce){return _0x62ddce?{'count':_0x115c9d,'rows':_0x62ddce}:null;}})[_0xc8b6('0x27')](respondWithResult(_0x55988c,null))['catch'](handleError(_0x55988c,null));};exports['addIntervals']=function(_0x84ce,_0x1e8892,_0x2e660f){return db[_0xc8b6('0x31')][_0xc8b6('0x57')]({'where':{'id':_0x84ce[_0xc8b6('0x54')]['id']}})['then'](handleEntityNotFound(_0x1e8892,null))[_0xc8b6('0x27')](function(_0x56c304){if(_0x56c304){return db[_0xc8b6('0x58')][_0xc8b6('0x59')](function(_0x41190a){return db['Interval'][_0xc8b6('0x28')]({'where':{'IntervalId':_0x84ce[_0xc8b6('0x54')]['id']},'transaction':_0x41190a})['then'](function(_0x308777){var _0x447d12=_['map'](_0x84ce['body'],function(_0x273b5d){delete _0x273b5d['id'];_0x273b5d['IntervalId']=_0x84ce[_0xc8b6('0x54')]['id'];return _0x273b5d;});return db[_0xc8b6('0x31')][_0xc8b6('0x5a')](_0x447d12,{'transaction':_0x41190a});});})[_0xc8b6('0x27')](function(){return db['Interval'][_0xc8b6('0x45')]({'where':{'IntervalId':_0x84ce[_0xc8b6('0x54')]['id']}});});}})[_0xc8b6('0x27')](respondWithResult(_0x1e8892,null))[_0xc8b6('0x46')](handleError(_0x1e8892,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 06d8d98..b92283e 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 _0xd745=['Interval','rewrite','string','getIntervals','then','all','map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define'];(function(_0x510c06,_0x3dd341){var _0x2e22e4=function(_0x311a8e){while(--_0x311a8e){_0x510c06['push'](_0x510c06['shift']());}};_0x2e22e4(++_0x3dd341);}(_0xd745,0xe5));var _0x5d74=function(_0x1e87ab,_0x1a6762){_0x1e87ab=_0x1e87ab-0x0;var _0x3b3804=_0xd745[_0x1e87ab];return _0x3b3804;};'use strict';var attributes=require(_0x5d74('0x0'));var extensions=require(_0x5d74('0x1'));var iftime=require(_0x5d74('0x2'))['iftime'];module[_0x5d74('0x3')]=function(_0x38db94){return _0x38db94[_0x5d74('0x4')](_0x5d74('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x561b4e){extensions[_0x5d74('0x6')](_0x38db94,_0x561b4e);},'afterBulkCreate':function(_0x1a3411,_0x5b3809,_0x563672){_0x563672();extensions['rewrite'](_0x38db94,_0x1a3411[0x0]);},'afterUpdate':function(_0x16c0f9){extensions['rewrite'](_0x38db94,_0x16c0f9);},'afterDestroy':function(_0x11198a){extensions['rewrite'](_0x38db94,_0x11198a);}},'instanceMethods':{'ifTime':function(_0x45c7e7=undefined,_0x3ca1f9=new Date()){if(typeof this['interval']===_0x5d74('0x7')){return iftime(this['interval'],_0x45c7e7,_0x3ca1f9);}else{return this[_0x5d74('0x8')]()[_0x5d74('0x9')](function(_0x5bc6a9){return Promise[_0x5d74('0xa')](_0x5bc6a9[_0x5d74('0xb')](function(_0x4aa8c6){return _0x4aa8c6[_0x5d74('0xc')](_0x45c7e7,_0x3ca1f9);}));})[_0x5d74('0x9')](function(_0x1298d3){return _0x1298d3['reduce'](function(_0x2845a8,_0x2e0a8d){return _0x2845a8||_0x2e0a8d;},![]);});}}}});}; \ No newline at end of file +var _0xe70c=['../../utils/iftime','iftime','Interval','rewrite','interval','string','getIntervals','then','map','ifTime','../../components/extensions/rewrite'];(function(_0x364c22,_0x120c52){var _0x3c51e0=function(_0xfb795d){while(--_0xfb795d){_0x364c22['push'](_0x364c22['shift']());}};_0x3c51e0(++_0x120c52);}(_0xe70c,0x13e));var _0xce70=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xe70c[_0x110c3d];return _0x226d67;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xce70('0x0'));var iftime=require(_0xce70('0x1'))[_0xce70('0x2')];module['exports']=function(_0x18df86){return _0x18df86['define'](_0xce70('0x3'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x30e20e){extensions[_0xce70('0x4')](_0x18df86,_0x30e20e);},'afterBulkCreate':function(_0x5bac62,_0x742369,_0x3e2575){_0x3e2575();extensions[_0xce70('0x4')](_0x18df86,_0x5bac62[0x0]);},'afterUpdate':function(_0x783e){extensions[_0xce70('0x4')](_0x18df86,_0x783e);},'afterDestroy':function(_0x1c572e){extensions[_0xce70('0x4')](_0x18df86,_0x1c572e);}},'instanceMethods':{'ifTime':function(_0x1fc71d=undefined,_0x545eab=new Date()){if(typeof this[_0xce70('0x5')]===_0xce70('0x6')){return iftime(this[_0xce70('0x5')],_0x1fc71d,_0x545eab);}else{return this[_0xce70('0x7')]()[_0xce70('0x8')](function(_0x43bff2){return Promise['all'](_0x43bff2[_0xce70('0x9')](function(_0x2a2bad){return _0x2a2bad[_0xce70('0xa')](_0x1fc71d,_0x545eab);}));})[_0xce70('0x8')](function(_0x59a678){return _0x59a678['reduce'](function(_0x126d66,_0x2d5a44){return _0x126d66||_0x2d5a44;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5fda70e..dbd0a97 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 _0x0060=['attributes','limit','include','map','model','info','GetInterval','debug','stringify','catch','message','error','ShowInterval','then','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','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','reduce','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','Interval','findAll','options','where'];(function(_0x6a65b3,_0x993a00){var _0x5aecf1=function(_0x341b0c){while(--_0x341b0c){_0x6a65b3['push'](_0x6a65b3['shift']());}};_0x5aecf1(++_0x993a00);}(_0x0060,0x1a4));var _0x0006=function(_0x3d3b05,_0x334c57){_0x3d3b05=_0x3d3b05-0x0;var _0x2c6ca3=_0x0060[_0x3d3b05];return _0x2c6ca3;};'use strict';var _=require(_0x0006('0x0'));var util=require(_0x0006('0x1'));var db=require(_0x0006('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x0006('0x3')];var logger=require(_0x0006('0x4'))(_0x0006('0x5'));exports['GetInterval']=function(_0x5ca8bb){var _0x1bdc19=this;return new Promise(function(_0x3b9586,_0x2ee44a){return db[_0x0006('0x6')][_0x0006('0x7')]({'raw':_0x5ca8bb[_0x0006('0x8')]?_0x5ca8bb[_0x0006('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x5ca8bb[_0x0006('0x8')]?_0x5ca8bb[_0x0006('0x8')][_0x0006('0x9')]||null:null,'attributes':_0x5ca8bb[_0x0006('0x8')]?_0x5ca8bb[_0x0006('0x8')][_0x0006('0xa')]||null:null,'limit':_0x5ca8bb[_0x0006('0x8')]?_0x5ca8bb['options'][_0x0006('0xb')]||null:null,'include':_0x5ca8bb[_0x0006('0x8')]?_0x5ca8bb[_0x0006('0x8')][_0x0006('0xc')]?_[_0x0006('0xd')](_0x5ca8bb[_0x0006('0x8')]['include'],function(_0xaa7b1){return{'model':db[_0xaa7b1['model']],'as':_0xaa7b1['as'],'attributes':_0xaa7b1[_0x0006('0xa')],'include':_0xaa7b1[_0x0006('0xc')]?_['map'](_0xaa7b1['include'],function(_0x1a1c96){return{'model':db[_0x1a1c96[_0x0006('0xe')]],'as':_0x1a1c96['as'],'attributes':_0x1a1c96['attributes'],'include':_0x1a1c96[_0x0006('0xc')]?_['map'](_0x1a1c96[_0x0006('0xc')],function(_0x569491){return{'model':db[_0x569491[_0x0006('0xe')]],'as':_0x569491['as'],'attributes':_0x569491[_0x0006('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe329e1){logger[_0x0006('0xf')](_0x0006('0x10'),_0x5ca8bb);logger[_0x0006('0x11')](_0x0006('0x10'),_0x5ca8bb,JSON[_0x0006('0x12')](_0xe329e1));_0x3b9586(_0xe329e1);})[_0x0006('0x13')](function(_0x30c6a0){logger['error'](_0x0006('0x10'),_0x30c6a0[_0x0006('0x14')],_0x5ca8bb);_0x2ee44a(_0x1bdc19[_0x0006('0x15')](0x1f4,_0x30c6a0['message']));});});};exports[_0x0006('0x16')]=function(_0x54a5ad){var _0x2e8b72=this;return new Promise(function(_0x57427e,_0x24d95e){return db[_0x0006('0x6')]['find']({'raw':_0x54a5ad['options']?_0x54a5ad[_0x0006('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x54a5ad[_0x0006('0x8')]?_0x54a5ad[_0x0006('0x8')][_0x0006('0x9')]||null:null,'attributes':_0x54a5ad[_0x0006('0x8')]?_0x54a5ad[_0x0006('0x8')][_0x0006('0xa')]||null:null,'include':_0x54a5ad['options']?_0x54a5ad[_0x0006('0x8')][_0x0006('0xc')]?_[_0x0006('0xd')](_0x54a5ad[_0x0006('0x8')]['include'],function(_0x50a061){return{'model':db[_0x50a061[_0x0006('0xe')]],'as':_0x50a061['as'],'attributes':_0x50a061[_0x0006('0xa')],'include':_0x50a061[_0x0006('0xc')]?_[_0x0006('0xd')](_0x50a061[_0x0006('0xc')],function(_0x435fe9){return{'model':db[_0x435fe9[_0x0006('0xe')]],'as':_0x435fe9['as'],'attributes':_0x435fe9[_0x0006('0xa')],'include':_0x435fe9['include']?_['map'](_0x435fe9[_0x0006('0xc')],function(_0x39e419){return{'model':db[_0x39e419['model']],'as':_0x39e419['as'],'attributes':_0x39e419[_0x0006('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0006('0x17')](function(_0x5a5c89){logger[_0x0006('0xf')](_0x0006('0x16'),_0x54a5ad);logger[_0x0006('0x11')](_0x0006('0x16'),_0x54a5ad,JSON[_0x0006('0x12')](_0x5a5c89));_0x57427e(_0x5a5c89);})[_0x0006('0x13')](function(_0x20662b){logger['error'](_0x0006('0x16'),_0x20662b[_0x0006('0x14')],_0x54a5ad);_0x24d95e(_0x2e8b72[_0x0006('0x15')](0x1f4,_0x20662b['message']));});});};function checkArrayOfIntervals(_0x3c9e6c,_0x140eba){var _0x48892e=[];return db[_0x0006('0x6')][_0x0006('0x7')]({'where':{'id':_0x3c9e6c}})[_0x0006('0x17')](function(_0x56506c){_0x48892e=_0x56506c;return Promise['all'](_0x48892e[_0x0006('0xd')](function(_0x58229c){return _0x58229c[_0x0006('0x18')](_0x140eba);}));})[_0x0006('0x17')](function(_0x38019d){var _0x9c04a5=_0x38019d['reduce'](function(_0x558c9a,_0x356923){return _0x558c9a||_0x356923;},![]);logger[_0x0006('0xf')](util[_0x0006('0x19')](_0x0006('0x1a'),_0x48892e['map'](function(_0x1bd46c){return _0x1bd46c[_0x0006('0x1b')];})['join'](',\x20'),_0x48892e['map'](function(_0x931b40){return _0x931b40['id'];})[_0x0006('0x1c')](',\x20')));return _0x9c04a5;});}function checkSingleInterval(_0x52c73b,_0x2e547){return db[_0x0006('0x6')][_0x0006('0x1d')](_0x52c73b)[_0x0006('0x17')](function(_0x41dcb9){if(_0x41dcb9){logger[_0x0006('0xf')](util[_0x0006('0x19')](_0x0006('0x1e'),_0x41dcb9[_0x0006('0x1b')],_0x41dcb9['id']));return _0x41dcb9[_0x0006('0x18')](_0x2e547);}});}exports[_0x0006('0x1f')]=function(_0x4e3680){var _0x4a34a0=_0x4e3680[_0x0006('0x20')];var _0x2f4f7=Array[_0x0006('0x21')](_0x4e3680[_0x0006('0x22')])?_0x4e3680[_0x0006('0x22')]:typeof _0x4e3680[_0x0006('0x22')]===_0x0006('0x23')?[_0x4e3680['intervals']]:[];var _0x56aa5c=_0x4e3680[_0x0006('0x24')]||undefined;var _0x4c9576=![];if(_0x2f4f7[_0x0006('0x25')]){logger[_0x0006('0xf')](util[_0x0006('0x19')](_0x0006('0x26'),_0x2f4f7['join'](';\x20')));}if(_0x56aa5c){logger[_0x0006('0xf')](util[_0x0006('0x19')](_0x0006('0x27'),_0x56aa5c));}logger['debug'](_0x0006('0x28'),_0x4c9576);logger['silly']('IntervalIftime',_0x4e3680);return Promise[_0x0006('0x29')]()[_0x0006('0x17')](function(){if(Array[_0x0006('0x21')](_0x4a34a0)){return checkArrayOfIntervals(_0x4a34a0,_0x56aa5c);}else if(_0x4a34a0){return checkSingleInterval(_0x4a34a0,_0x56aa5c);}})[_0x0006('0x17')](function(_0x3df5a2){var _0x6f7345=_0x2f4f7[_0x0006('0x2a')](function(_0x312aae,_0x41b4e0){return _0x312aae||iftime(_0x41b4e0,_0x56aa5c);},![]);_0x4c9576=_0x3df5a2||_0x6f7345;return _0x4c9576;})[_0x0006('0x13')](function(_0xb149db){logger[_0x0006('0x15')](_0x0006('0x1f'),_0x4e3680,_0xb149db);throw this[_0x0006('0x15')](0x1f4,_0xb149db[_0x0006('0x14')]);});}; \ No newline at end of file +var _0xc835=['stringify','message','error','ShowInterval','find','where','catch','findAll','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','name','IntervalIftime','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','isArray','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','options','raw','map','include','model','attributes','then','info','debug'];(function(_0x56db7d,_0x485243){var _0xcfec0=function(_0x65a4de){while(--_0x65a4de){_0x56db7d['push'](_0x56db7d['shift']());}};_0xcfec0(++_0x485243);}(_0xc835,0xcb));var _0x5c83=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xc835[_0x26f1b2];return _0x1624a4;};'use strict';var _=require(_0x5c83('0x0'));var util=require(_0x5c83('0x1'));var db=require(_0x5c83('0x2'))['db'];var iftime=require(_0x5c83('0x3'))[_0x5c83('0x4')];var logger=require(_0x5c83('0x5'))('rpc');exports[_0x5c83('0x6')]=function(_0x2e9e7d){var _0x47b5e0=this;return new Promise(function(_0xead04c,_0x4d46cb){return db[_0x5c83('0x7')]['findAll']({'raw':_0x2e9e7d[_0x5c83('0x8')]?_0x2e9e7d[_0x5c83('0x8')][_0x5c83('0x9')]===undefined?!![]:![]:!![],'where':_0x2e9e7d[_0x5c83('0x8')]?_0x2e9e7d[_0x5c83('0x8')]['where']||null:null,'attributes':_0x2e9e7d['options']?_0x2e9e7d[_0x5c83('0x8')]['attributes']||null:null,'limit':_0x2e9e7d[_0x5c83('0x8')]?_0x2e9e7d[_0x5c83('0x8')]['limit']||null:null,'include':_0x2e9e7d[_0x5c83('0x8')]?_0x2e9e7d[_0x5c83('0x8')]['include']?_[_0x5c83('0xa')](_0x2e9e7d[_0x5c83('0x8')][_0x5c83('0xb')],function(_0x19f416){return{'model':db[_0x19f416[_0x5c83('0xc')]],'as':_0x19f416['as'],'attributes':_0x19f416[_0x5c83('0xd')],'include':_0x19f416['include']?_[_0x5c83('0xa')](_0x19f416[_0x5c83('0xb')],function(_0x175fcd){return{'model':db[_0x175fcd[_0x5c83('0xc')]],'as':_0x175fcd['as'],'attributes':_0x175fcd[_0x5c83('0xd')],'include':_0x175fcd[_0x5c83('0xb')]?_['map'](_0x175fcd['include'],function(_0xa8f9b4){return{'model':db[_0xa8f9b4['model']],'as':_0xa8f9b4['as'],'attributes':_0xa8f9b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c83('0xe')](function(_0x24b221){logger[_0x5c83('0xf')](_0x5c83('0x6'),_0x2e9e7d);logger[_0x5c83('0x10')](_0x5c83('0x6'),_0x2e9e7d,JSON[_0x5c83('0x11')](_0x24b221));_0xead04c(_0x24b221);})['catch'](function(_0x45abfb){logger['error'](_0x5c83('0x6'),_0x45abfb[_0x5c83('0x12')],_0x2e9e7d);_0x4d46cb(_0x47b5e0[_0x5c83('0x13')](0x1f4,_0x45abfb[_0x5c83('0x12')]));});});};exports[_0x5c83('0x14')]=function(_0x484b96){var _0x161759=this;return new Promise(function(_0x3c1b3b,_0x3dd98e){return db[_0x5c83('0x7')][_0x5c83('0x15')]({'raw':_0x484b96[_0x5c83('0x8')]?_0x484b96[_0x5c83('0x8')][_0x5c83('0x9')]===undefined?!![]:![]:!![],'where':_0x484b96[_0x5c83('0x8')]?_0x484b96[_0x5c83('0x8')][_0x5c83('0x16')]||null:null,'attributes':_0x484b96['options']?_0x484b96[_0x5c83('0x8')][_0x5c83('0xd')]||null:null,'include':_0x484b96[_0x5c83('0x8')]?_0x484b96[_0x5c83('0x8')][_0x5c83('0xb')]?_[_0x5c83('0xa')](_0x484b96['options'][_0x5c83('0xb')],function(_0x45640a){return{'model':db[_0x45640a[_0x5c83('0xc')]],'as':_0x45640a['as'],'attributes':_0x45640a['attributes'],'include':_0x45640a[_0x5c83('0xb')]?_['map'](_0x45640a[_0x5c83('0xb')],function(_0x1eca48){return{'model':db[_0x1eca48[_0x5c83('0xc')]],'as':_0x1eca48['as'],'attributes':_0x1eca48['attributes'],'include':_0x1eca48[_0x5c83('0xb')]?_[_0x5c83('0xa')](_0x1eca48[_0x5c83('0xb')],function(_0x548da4){return{'model':db[_0x548da4[_0x5c83('0xc')]],'as':_0x548da4['as'],'attributes':_0x548da4[_0x5c83('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x157c5a){logger[_0x5c83('0xf')](_0x5c83('0x14'),_0x484b96);logger[_0x5c83('0x10')](_0x5c83('0x14'),_0x484b96,JSON[_0x5c83('0x11')](_0x157c5a));_0x3c1b3b(_0x157c5a);})[_0x5c83('0x17')](function(_0x36c180){logger[_0x5c83('0x13')](_0x5c83('0x14'),_0x36c180[_0x5c83('0x12')],_0x484b96);_0x3dd98e(_0x161759['error'](0x1f4,_0x36c180[_0x5c83('0x12')]));});});};function checkArrayOfIntervals(_0x5a822a,_0x322084){var _0x2a7007=[];return db[_0x5c83('0x7')][_0x5c83('0x18')]({'where':{'id':_0x5a822a}})['then'](function(_0x251e4f){_0x2a7007=_0x251e4f;return Promise[_0x5c83('0x19')](_0x2a7007[_0x5c83('0xa')](function(_0x11fc58){return _0x11fc58[_0x5c83('0x1a')](_0x322084);}));})[_0x5c83('0xe')](function(_0x58e820){var _0x286c37=_0x58e820[_0x5c83('0x1b')](function(_0x108e88,_0x30c08c){return _0x108e88||_0x30c08c;},![]);logger[_0x5c83('0xf')](util[_0x5c83('0x1c')](_0x5c83('0x1d'),_0x2a7007[_0x5c83('0xa')](function(_0x30b30d){return _0x30b30d['name'];})['join'](',\x20'),_0x2a7007[_0x5c83('0xa')](function(_0x55c61b){return _0x55c61b['id'];})[_0x5c83('0x1e')](',\x20')));return _0x286c37;});}function checkSingleInterval(_0x87a2c2,_0x1ef86a){return db['Interval'][_0x5c83('0x1f')](_0x87a2c2)[_0x5c83('0xe')](function(_0x21c603){if(_0x21c603){logger[_0x5c83('0xf')](util[_0x5c83('0x1c')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x21c603[_0x5c83('0x20')],_0x21c603['id']));return _0x21c603[_0x5c83('0x1a')](_0x1ef86a);}});}exports[_0x5c83('0x21')]=function(_0x584b46){var _0x4a57bb=_0x584b46['intervalIds'];var _0x5e445b=Array['isArray'](_0x584b46[_0x5c83('0x22')])?_0x584b46[_0x5c83('0x22')]:typeof _0x584b46[_0x5c83('0x22')]===_0x5c83('0x23')?[_0x584b46[_0x5c83('0x22')]]:[];var _0x9baa77=_0x584b46[_0x5c83('0x24')]||undefined;var _0x311204=![];if(_0x5e445b[_0x5c83('0x25')]){logger[_0x5c83('0xf')](util['format'](_0x5c83('0x26'),_0x5e445b[_0x5c83('0x1e')](';\x20')));}if(_0x9baa77){logger[_0x5c83('0xf')](util['format'](_0x5c83('0x27'),_0x9baa77));}logger['debug'](_0x5c83('0x28'),_0x311204);logger[_0x5c83('0x29')]('IntervalIftime',_0x584b46);return Promise[_0x5c83('0x2a')]()['then'](function(){if(Array[_0x5c83('0x2b')](_0x4a57bb)){return checkArrayOfIntervals(_0x4a57bb,_0x9baa77);}else if(_0x4a57bb){return checkSingleInterval(_0x4a57bb,_0x9baa77);}})[_0x5c83('0xe')](function(_0x46165f){var _0x42b818=_0x5e445b[_0x5c83('0x1b')](function(_0x491fe2,_0x1f019a){return _0x491fe2||iftime(_0x1f019a,_0x9baa77);},![]);_0x311204=_0x46165f||_0x42b818;return _0x311204;})[_0x5c83('0x17')](function(_0x358f55){logger['error'](_0x5c83('0x21'),_0x584b46,_0x358f55);throw this[_0x5c83('0x13')](0x1f4,_0x358f55[_0x5c83('0x12')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index a6fda31..98e0742 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb10b,0x12a));var _0xbb10=function(_0x19d422,_0xcb97a4){_0x19d422=_0x19d422-0x0;var _0x27576b=_0xb10b[_0x19d422];return _0x27576b;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x35a2cf,_0x546be1){var _0x1f4d43=function(_0x36200c){while(--_0x36200c){_0x35a2cf['push'](_0x35a2cf['shift']());}};_0x1f4d43(++_0x546be1);}(_0x2032,0xd9));var _0x2203=function(_0x1d5baa,_0x35d7f1){_0x1d5baa=_0x1d5baa-0x0;var _0x4bde50=_0x2032[_0x1d5baa];return _0x4bde50;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3ebb4cc..41ce32b 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 _0xfba8=['customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','data','end','status','statusCode','error','json','api.jira','write','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken'];(function(_0x2aff58,_0x310486){var _0x3628dd=function(_0x5258da){while(--_0x5258da){_0x2aff58['push'](_0x2aff58['shift']());}};_0x3628dd(++_0x310486);}(_0xfba8,0x1cb));var _0x8fba=function(_0x2d25a3,_0x2664bf){_0x2d25a3=_0x2d25a3-0x0;var _0x520004=_0xfba8[_0x2d25a3];return _0x520004;};'use strict';var BPromise=require(_0x8fba('0x0'));var https=require(_0x8fba('0x1'));var logger=require(_0x8fba('0x2'))(_0x8fba('0x3'));var USERNAME=_0x8fba('0x4');var PASSWORD=_0x8fba('0x5');function openIssue(_0x239925,_0x321dee){var _0xfd877b={'fields':{'project':{'key':_0x239925[_0x8fba('0x6')]||_0x8fba('0x7')},'summary':(_0x239925['summary']||_0x8fba('0x8'))+_0x8fba('0x9')+_0x239925['ip'],'description':_0x239925[_0x8fba('0xa')]||JSON[_0x8fba('0xb')](_0x239925),'issuetype':{'name':_0x239925[_0x8fba('0xc')]||_0x8fba('0xd')}}};_0xfd877b[_0x8fba('0xe')][_0x8fba('0xf')]=_0x239925[_0x8fba('0x10')];_0xfd877b[_0x8fba('0xe')][_0x8fba('0x11')]=_0x239925[_0x8fba('0x12')];_0xfd877b[_0x8fba('0xe')][_0x8fba('0x13')]=_0x239925[_0x8fba('0x14')];_0xfd877b[_0x8fba('0xe')][_0x8fba('0x15')]=_0x239925[_0x8fba('0x16')];_0xfd877b[_0x8fba('0xe')]['customfield_11504']=_0x239925[_0x8fba('0x17')];_0xfd877b[_0x8fba('0xe')][_0x8fba('0x18')]=_0x239925['ip'];var _0x5e6039={'host':_0x8fba('0x19'),'port':0x1bb,'path':_0x8fba('0x1a'),'method':_0x8fba('0x1b'),'timeout':0x4e20,'headers':{'Content-Type':_0x8fba('0x1c'),'Authorization':_0x8fba('0x1d')+new Buffer(USERNAME+':'+PASSWORD)[_0x8fba('0x1e')](_0x8fba('0x1f'))}};var _0x29a590=JSON[_0x8fba('0xb')](_0xfd877b);var _0x556954=https['request'](_0x5e6039,function(_0x3403fb){_0x3403fb[_0x8fba('0x20')](_0x8fba('0x21'));var _0x40908f='';_0x3403fb['on'](_0x8fba('0x22'),function(_0x126b32){_0x40908f+=_0x126b32;});_0x3403fb['on'](_0x8fba('0x23'),function(){if(_0x321dee){return _0x321dee[_0x8fba('0x24')](_0x3403fb[_0x8fba('0x25')])['json'](JSON['parse'](_0x40908f));}});});_0x556954['on'](_0x8fba('0x26'),function(_0x595c18){if(_0x321dee){return _0x321dee[_0x8fba('0x24')](0x1f4)[_0x8fba('0x27')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x8fba('0x28')}]});}});_0x556954[_0x8fba('0x29')](_0x29a590);_0x556954[_0x8fba('0x23')]();}exports[_0x8fba('0x2a')]=openIssue;exports['send']=function(_0x2bbd87,_0x4c4b4e){_0x2bbd87[_0x8fba('0x2b')]['ip']=_0x2bbd87['headers'][_0x8fba('0x2c')]||_0x2bbd87[_0x8fba('0x2d')][_0x8fba('0x2e')]||_0x2bbd87[_0x8fba('0x2f')][_0x8fba('0x2e')]||_0x2bbd87[_0x8fba('0x2d')][_0x8fba('0x2f')][_0x8fba('0x2e')];return openIssue(_0x2bbd87[_0x8fba('0x2b')],_0x4c4b4e);}; \ No newline at end of file +var _0xfc22=['fields','customfield_11500','email','customfield_11501','newToken','customfield_11503','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','request','setEncoding','utf8','data','statusCode','json','error','status','api.jira','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug'];(function(_0x4eca49,_0xbd2b38){var _0x31bf0a=function(_0x1b27eb){while(--_0x1b27eb){_0x4eca49['push'](_0x4eca49['shift']());}};_0x31bf0a(++_0xbd2b38);}(_0xfc22,0x77));var _0x2fc2=function(_0x34ef21,_0x3758de){_0x34ef21=_0x34ef21-0x0;var _0x424188=_0xfc22[_0x34ef21];return _0x424188;};'use strict';var BPromise=require(_0x2fc2('0x0'));var https=require(_0x2fc2('0x1'));var logger=require(_0x2fc2('0x2'))('api');var USERNAME=_0x2fc2('0x3');var PASSWORD=_0x2fc2('0x4');function openIssue(_0x425363,_0xa7b76b){var _0x5a369e={'fields':{'project':{'key':_0x425363[_0x2fc2('0x5')]||_0x2fc2('0x6')},'summary':(_0x425363[_0x2fc2('0x7')]||'Report')+_0x2fc2('0x8')+_0x425363['ip'],'description':_0x425363[_0x2fc2('0x9')]||JSON[_0x2fc2('0xa')](_0x425363),'issuetype':{'name':_0x425363[_0x2fc2('0xb')]||_0x2fc2('0xc')}}};_0x5a369e[_0x2fc2('0xd')][_0x2fc2('0xe')]=_0x425363[_0x2fc2('0xf')];_0x5a369e[_0x2fc2('0xd')][_0x2fc2('0x10')]=_0x425363['oldToken'];_0x5a369e[_0x2fc2('0xd')]['customfield_11502']=_0x425363[_0x2fc2('0x11')];_0x5a369e[_0x2fc2('0xd')][_0x2fc2('0x12')]=_0x425363[_0x2fc2('0x13')];_0x5a369e[_0x2fc2('0xd')]['customfield_11504']=_0x425363[_0x2fc2('0x14')];_0x5a369e[_0x2fc2('0xd')]['customfield_10102']=_0x425363['ip'];var _0x5a3d4a={'host':_0x2fc2('0x15'),'port':0x1bb,'path':_0x2fc2('0x16'),'method':_0x2fc2('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x2fc2('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x2fc2('0x19')]('base64')}};var _0x3d7d15=JSON[_0x2fc2('0xa')](_0x5a369e);var _0x226ede=https[_0x2fc2('0x1a')](_0x5a3d4a,function(_0x3176ca){_0x3176ca[_0x2fc2('0x1b')](_0x2fc2('0x1c'));var _0xa62166='';_0x3176ca['on'](_0x2fc2('0x1d'),function(_0xea4fe0){_0xa62166+=_0xea4fe0;});_0x3176ca['on']('end',function(){if(_0xa7b76b){return _0xa7b76b['status'](_0x3176ca[_0x2fc2('0x1e')])[_0x2fc2('0x1f')](JSON['parse'](_0xa62166));}});});_0x226ede['on'](_0x2fc2('0x20'),function(_0x227ef1){if(_0xa7b76b){return _0xa7b76b[_0x2fc2('0x21')](0x1f4)[_0x2fc2('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x2fc2('0x22')}]});}});_0x226ede['write'](_0x3d7d15);_0x226ede[_0x2fc2('0x23')]();}exports[_0x2fc2('0x24')]=openIssue;exports[_0x2fc2('0x25')]=function(_0x15ec45,_0x5f0007){_0x15ec45[_0x2fc2('0x26')]['ip']=_0x15ec45[_0x2fc2('0x27')][_0x2fc2('0x28')]||_0x15ec45[_0x2fc2('0x29')][_0x2fc2('0x2a')]||_0x15ec45[_0x2fc2('0x2b')][_0x2fc2('0x2a')]||_0x15ec45[_0x2fc2('0x29')][_0x2fc2('0x2b')]['remoteAddress'];return openIssue(_0x15ec45[_0x2fc2('0x26')],_0x5f0007);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index fe559be..671489c 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 _0x5ff3=['/:id','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0xfd0ab1,_0x59786e){var _0x30689e=function(_0x484c8b){while(--_0x484c8b){_0xfd0ab1['push'](_0xfd0ab1['shift']());}};_0x30689e(++_0x59786e);}(_0x5ff3,0x17d));var _0x35ff=function(_0x11addf,_0x110920){_0x11addf=_0x11addf-0x0;var _0x30a5a2=_0x5ff3[_0x11addf];return _0x30a5a2;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var fs_extra=require(_0x35ff('0x3'));var auth=require(_0x35ff('0x4'));var interaction=require(_0x35ff('0x5'));var config=require('../../config/environment');var controller=require(_0x35ff('0x6'));router[_0x35ff('0x7')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0x7')]('/describe',auth[_0x35ff('0x8')](),controller['describe']);router[_0x35ff('0x7')](_0x35ff('0xa'),auth[_0x35ff('0x8')](),controller['show']);router[_0x35ff('0xb')]('/',auth['isAuthenticated'](),controller[_0x35ff('0xc')]);router[_0x35ff('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xf')]);module[_0x35ff('0x10')]=router; \ No newline at end of file +var _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0xa5d896,_0x263a1d){var _0x1c31f8=function(_0x5d9824){while(--_0x5d9824){_0xa5d896['push'](_0xa5d896['shift']());}};_0x1c31f8(++_0x263a1d);}(_0x0a9a,0x183));var _0xa0a9=function(_0x25624a,_0x645bea){_0x25624a=_0x25624a-0x0;var _0x5a998a=_0x0a9a[_0x25624a];return _0x5a998a;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 935ea02..b67a599 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x4f108f,_0x34b9a2){_0x4f108f=_0x4f108f-0x0;var _0x15834e=_0x7a54[_0x4f108f];return _0x15834e;};'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(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7a54,0x106));var _0x47a5=function(_0x8f894c,_0xe4c04a){_0x8f894c=_0x8f894c-0x0;var _0x4a8cc2=_0x7a54[_0x8f894c];return _0x4a8cc2;};'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 7d71041..0f65f1b 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 _0xb138=['filters','pick','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where'];(function(_0x42b927,_0x41e04c){var _0xeefddc=function(_0x255cab){while(--_0x255cab){_0x42b927['push'](_0x42b927['shift']());}};_0xeefddc(++_0x41e04c);}(_0xb138,0x1dd));var _0x8b13=function(_0x42599b,_0x4e61b0){_0x42599b=_0x42599b-0x0;var _0x356357=_0xb138[_0x42599b];return _0x356357;};'use strict';var emlformat=require(_0x8b13('0x0'));var rimraf=require(_0x8b13('0x1'));var zipdir=require(_0x8b13('0x2'));var jsonpatch=require(_0x8b13('0x3'));var rp=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var BPromise=require(_0x8b13('0x6'));var Mustache=require('mustache');var util=require(_0x8b13('0x7'));var path=require(_0x8b13('0x8'));var sox=require(_0x8b13('0x9'));var csv=require('to-csv');var ejs=require(_0x8b13('0xa'));var fs=require('fs');var fs_extra=require(_0x8b13('0xb'));var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xf'));var querystring=require(_0x8b13('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x11'));var qs=require(_0x8b13('0x12'));var as=require(_0x8b13('0x13'));var hardwareService=require(_0x8b13('0x14'));var logger=require(_0x8b13('0x15'))('api');var utils=require(_0x8b13('0x16'));var config=require(_0x8b13('0x17'));var licenseUtil=require(_0x8b13('0x18'));var db=require(_0x8b13('0x19'))['db'];function respondWithStatusCode(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xcc;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['sendStatus'](_0x1893b1);}return _0xb227e0[_0x8b13('0x1a')](_0x1893b1)[_0x8b13('0x1b')]();};}function respondWithResult(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0xc8;return function(_0x479773){if(_0x479773){return _0x5f12b5[_0x8b13('0x1a')](_0x51a935)[_0x8b13('0x1c')](_0x479773);}};}function respondWithFilteredResult(_0xf29086,_0x2c615a){return function(_0x13f956){if(_0x13f956){var _0x542357=typeof _0x2c615a[_0x8b13('0x1d')]===_0x8b13('0x1e')&&typeof _0x2c615a[_0x8b13('0x1f')]===_0x8b13('0x1e');var _0x3eed21=_0x13f956[_0x8b13('0x20')];var _0x10fbde=_0x542357?0x0:_0x2c615a[_0x8b13('0x1d')];var _0x4989d3=_0x542357?_0x13f956['count']:_0x2c615a[_0x8b13('0x1d')]+_0x2c615a[_0x8b13('0x1f')];var _0x14a8ac;if(_0x4989d3>=_0x3eed21){_0x4989d3=_0x3eed21;_0x14a8ac=0xc8;}else{_0x14a8ac=0xce;}_0xf29086[_0x8b13('0x1a')](_0x14a8ac);return _0xf29086[_0x8b13('0x21')](_0x8b13('0x22'),_0x10fbde+'-'+_0x4989d3+'/'+_0x3eed21)['json'](_0x13f956);}return null;};}function patchUpdates(_0x1e8a48){return function(_0x3c4d4f){try{jsonpatch[_0x8b13('0x23')](_0x3c4d4f,_0x1e8a48,!![]);}catch(_0x54a309){return BPromise['reject'](_0x54a309);}return _0x3c4d4f[_0x8b13('0x24')]();};}function saveUpdates(_0xcb7621,_0x4f9902){return function(_0x3187ed){if(_0x3187ed){return _0x3187ed[_0x8b13('0x25')](_0xcb7621)[_0x8b13('0x26')](function(_0x213280){return _0x213280;});}return null;};}function removeEntity(_0xc05d5c,_0x583639){return function(_0x339271){if(_0x339271){return _0x339271[_0x8b13('0x27')]()['then'](function(){_0xc05d5c[_0x8b13('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420772,_0x325d68){return function(_0x54786a){if(!_0x54786a){_0x420772[_0x8b13('0x28')](0x194);}return _0x54786a;};}function handleError(_0x3223d8,_0x4f8e58){_0x4f8e58=_0x4f8e58||0x1f4;return function(_0x134c5e){logger[_0x8b13('0x29')](_0x134c5e[_0x8b13('0x2a')]);if(_0x134c5e[_0x8b13('0x2b')]){delete _0x134c5e[_0x8b13('0x2b')];}_0x3223d8['status'](_0x4f8e58)[_0x8b13('0x2c')](_0x134c5e);};}exports[_0x8b13('0x2d')]=function(_0x3475d8,_0x1511bf){var _0x114b01={},_0x2bb51d={},_0x5ab161={'count':0x0,'rows':[]};var _0x35fdca=_[_0x8b13('0x2e')](db[_0x8b13('0x2f')][_0x8b13('0x30')],function(_0x23fde7){return{'name':_0x23fde7[_0x8b13('0x31')],'type':_0x23fde7[_0x8b13('0x32')][_0x8b13('0x33')]};});_0x2bb51d[_0x8b13('0x34')]=_['map'](_0x35fdca,_0x8b13('0x2b'));_0x2bb51d[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x3475d8[_0x8b13('0x35')]);_0x2bb51d['filters']=_['intersection'](_0x2bb51d[_0x8b13('0x34')],_0x2bb51d['query']);_0x114b01['attributes']=_[_0x8b13('0x37')](_0x2bb51d['model'],qs[_0x8b13('0x38')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x38')]));_0x114b01[_0x8b13('0x39')]=_0x114b01[_0x8b13('0x39')][_0x8b13('0x3a')]?_0x114b01[_0x8b13('0x39')]:_0x2bb51d[_0x8b13('0x34')];if(!_0x3475d8[_0x8b13('0x35')][_0x8b13('0x3b')]('nolimit')){_0x114b01[_0x8b13('0x1f')]=qs[_0x8b13('0x1f')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1f')]);_0x114b01[_0x8b13('0x1d')]=qs[_0x8b13('0x1d')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1d')]);}_0x114b01['order']=qs[_0x8b13('0x3c')](_0x3475d8['query'][_0x8b13('0x3c')]);_0x114b01[_0x8b13('0x3d')]=qs[_0x8b13('0x3e')](_[_0x8b13('0x3f')](_0x3475d8[_0x8b13('0x35')],_0x2bb51d[_0x8b13('0x3e')]),_0x35fdca);if(_0x3475d8['query']['filter']){_0x114b01[_0x8b13('0x3d')]=_['merge'](_0x114b01[_0x8b13('0x3d')],{'$or':_['map'](_0x35fdca,function(_0x590a23){if(_0x590a23[_0x8b13('0x32')]!==_0x8b13('0x40')){var _0x2bc877={};_0x2bc877[_0x590a23[_0x8b13('0x2b')]]={'$like':'%'+_0x3475d8['query']['filter']+'%'};return _0x2bc877;}})});}_0x114b01=_[_0x8b13('0x41')]({},_0x114b01,_0x3475d8['options']);var _0x6ba2f3={'where':_0x114b01[_0x8b13('0x3d')]};return db['JscriptyAnswerReport'][_0x8b13('0x20')](_0x6ba2f3)[_0x8b13('0x26')](function(_0x35c1d6){_0x5ab161[_0x8b13('0x20')]=_0x35c1d6;if(_0x3475d8[_0x8b13('0x35')][_0x8b13('0x42')]){_0x114b01[_0x8b13('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x114b01);})['then'](function(_0x3eb3c5){_0x5ab161[_0x8b13('0x44')]=_0x3eb3c5;return _0x5ab161;})[_0x8b13('0x26')](respondWithFilteredResult(_0x1511bf,_0x114b01))[_0x8b13('0x45')](handleError(_0x1511bf,null));};exports[_0x8b13('0x46')]=function(_0x271507,_0x492f7d){var _0x4342db={'raw':!![],'where':{'id':_0x271507[_0x8b13('0x47')]['id']}},_0x50e535={};_0x50e535['model']=_[_0x8b13('0x36')](db[_0x8b13('0x2f')][_0x8b13('0x30')]);_0x50e535[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x271507[_0x8b13('0x35')]);_0x50e535[_0x8b13('0x3e')]=_['intersection'](_0x50e535['model'],_0x50e535['query']);_0x4342db[_0x8b13('0x39')]=_[_0x8b13('0x37')](_0x50e535[_0x8b13('0x34')],qs[_0x8b13('0x38')](_0x271507['query']['fields']));_0x4342db[_0x8b13('0x39')]=_0x4342db['attributes'][_0x8b13('0x3a')]?_0x4342db[_0x8b13('0x39')]:_0x50e535[_0x8b13('0x34')];if(_0x271507[_0x8b13('0x35')][_0x8b13('0x42')]){_0x4342db['include']=[{'all':!![]}];}_0x4342db=_[_0x8b13('0x41')]({},_0x4342db,_0x271507[_0x8b13('0x48')]);return db[_0x8b13('0x2f')][_0x8b13('0x49')](_0x4342db)[_0x8b13('0x26')](handleEntityNotFound(_0x492f7d,null))[_0x8b13('0x26')](respondWithResult(_0x492f7d,null))[_0x8b13('0x45')](handleError(_0x492f7d,null));};exports[_0x8b13('0x4a')]=function(_0x3e192b,_0x518298){return db[_0x8b13('0x2f')]['create'](_0x3e192b[_0x8b13('0x4b')],{})[_0x8b13('0x26')](respondWithResult(_0x518298,0xc9))[_0x8b13('0x45')](handleError(_0x518298,null));};exports['update']=function(_0x148efb,_0x35f612){if(_0x148efb[_0x8b13('0x4b')]['id']){delete _0x148efb[_0x8b13('0x4b')]['id'];}return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x148efb[_0x8b13('0x47')]['id']}})['then'](handleEntityNotFound(_0x35f612,null))[_0x8b13('0x26')](saveUpdates(_0x148efb['body'],null))[_0x8b13('0x26')](respondWithResult(_0x35f612,null))[_0x8b13('0x45')](handleError(_0x35f612,null));};exports[_0x8b13('0x27')]=function(_0x435867,_0x2be640){return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x435867[_0x8b13('0x47')]['id']}})[_0x8b13('0x26')](handleEntityNotFound(_0x2be640,null))[_0x8b13('0x26')](removeEntity(_0x2be640,null))[_0x8b13('0x45')](handleError(_0x2be640,null));};exports[_0x8b13('0x4c')]=function(_0xd55f3b,_0x2bdfae){return db[_0x8b13('0x2f')][_0x8b13('0x4c')]()[_0x8b13('0x26')](respondWithResult(_0x2bdfae,null))['catch'](handleError(_0x2bdfae,null));}; \ No newline at end of file +var _0x425d=['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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x425d,0x1e0));var _0xd425=function(_0x3d5d27,_0x5477ac){_0x3d5d27=_0x3d5d27-0x0;var _0x4dcacc=_0x425d[_0x3d5d27];return _0x4dcacc;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x1908a5,_0x2afcdb){return function(_0x400dd7){if(!_0x400dd7){_0x1908a5[_0xd425('0x1d')](0x194);}return _0x400dd7;};}function handleError(_0x577e4b,_0x12f951){_0x12f951=_0x12f951||0x1f4;return function(_0x177de2){logger[_0xd425('0x2b')](_0x177de2['stack']);if(_0x177de2[_0xd425('0x2c')]){delete _0x177de2[_0xd425('0x2c')];}_0x577e4b[_0xd425('0x1f')](_0x12f951)[_0xd425('0x2d')](_0x177de2);};}exports[_0xd425('0x2e')]=function(_0x185d7e,_0x2fd17a){var _0x37b63c={},_0x24da23={},_0x1cac61={'count':0x0,'rows':[]};var _0x482ba6=_[_0xd425('0x2f')](db[_0xd425('0x30')][_0xd425('0x31')],function(_0x3695dd){return{'name':_0x3695dd[_0xd425('0x32')],'type':_0x3695dd[_0xd425('0x33')][_0xd425('0x34')]};});_0x24da23[_0xd425('0x35')]=_[_0xd425('0x2f')](_0x482ba6,_0xd425('0x2c'));_0x24da23[_0xd425('0x36')]=_['keys'](_0x185d7e[_0xd425('0x36')]);_0x24da23[_0xd425('0x37')]=_[_0xd425('0x38')](_0x24da23[_0xd425('0x35')],_0x24da23[_0xd425('0x36')]);_0x37b63c['attributes']=_[_0xd425('0x38')](_0x24da23[_0xd425('0x35')],qs['fields'](_0x185d7e['query']['fields']));_0x37b63c[_0xd425('0x39')]=_0x37b63c[_0xd425('0x39')][_0xd425('0x3a')]?_0x37b63c[_0xd425('0x39')]:_0x24da23['model'];if(!_0x185d7e[_0xd425('0x36')][_0xd425('0x3b')](_0xd425('0x3c'))){_0x37b63c[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x185d7e[_0xd425('0x36')][_0xd425('0x23')]);_0x37b63c['offset']=qs[_0xd425('0x21')](_0x185d7e['query'][_0xd425('0x21')]);}_0x37b63c[_0xd425('0x3d')]=qs[_0xd425('0x3e')](_0x185d7e['query'][_0xd425('0x3e')]);_0x37b63c[_0xd425('0x3f')]=qs[_0xd425('0x37')](_[_0xd425('0x40')](_0x185d7e['query'],_0x24da23[_0xd425('0x37')]),_0x482ba6);if(_0x185d7e[_0xd425('0x36')]['filter']){_0x37b63c['where']=_['merge'](_0x37b63c[_0xd425('0x3f')],{'$or':_[_0xd425('0x2f')](_0x482ba6,function(_0x1f30c1){if(_0x1f30c1['type']!=='VIRTUAL'){var _0x58ebb1={};_0x58ebb1[_0x1f30c1[_0xd425('0x2c')]]={'$like':'%'+_0x185d7e[_0xd425('0x36')][_0xd425('0x41')]+'%'};return _0x58ebb1;}})});}_0x37b63c=_[_0xd425('0x42')]({},_0x37b63c,_0x185d7e[_0xd425('0x43')]);var _0x14f3be={'where':_0x37b63c[_0xd425('0x3f')]};return db['JscriptyAnswerReport'][_0xd425('0x24')](_0x14f3be)[_0xd425('0x2a')](function(_0x1d82ec){_0x1cac61['count']=_0x1d82ec;if(_0x185d7e[_0xd425('0x36')][_0xd425('0x44')]){_0x37b63c[_0xd425('0x45')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd425('0x46')](_0x37b63c);})[_0xd425('0x2a')](function(_0x1c5ba6){_0x1cac61[_0xd425('0x47')]=_0x1c5ba6;return _0x1cac61;})['then'](respondWithFilteredResult(_0x2fd17a,_0x37b63c))[_0xd425('0x48')](handleError(_0x2fd17a,null));};exports[_0xd425('0x49')]=function(_0x2b1149,_0x41b25e){var _0x3f24fb={'raw':!![],'where':{'id':_0x2b1149[_0xd425('0x4a')]['id']}},_0x2f6bf7={};_0x2f6bf7['model']=_[_0xd425('0x4b')](db[_0xd425('0x30')]['rawAttributes']);_0x2f6bf7[_0xd425('0x36')]=_['keys'](_0x2b1149['query']);_0x2f6bf7[_0xd425('0x37')]=_['intersection'](_0x2f6bf7[_0xd425('0x35')],_0x2f6bf7['query']);_0x3f24fb[_0xd425('0x39')]=_[_0xd425('0x38')](_0x2f6bf7[_0xd425('0x35')],qs[_0xd425('0x4c')](_0x2b1149[_0xd425('0x36')]['fields']));_0x3f24fb[_0xd425('0x39')]=_0x3f24fb['attributes'][_0xd425('0x3a')]?_0x3f24fb['attributes']:_0x2f6bf7[_0xd425('0x35')];if(_0x2b1149[_0xd425('0x36')][_0xd425('0x44')]){_0x3f24fb[_0xd425('0x45')]=[{'all':!![]}];}_0x3f24fb=_[_0xd425('0x42')]({},_0x3f24fb,_0x2b1149['options']);return db[_0xd425('0x30')][_0xd425('0x4d')](_0x3f24fb)[_0xd425('0x2a')](handleEntityNotFound(_0x41b25e,null))[_0xd425('0x2a')](respondWithResult(_0x41b25e,null))[_0xd425('0x48')](handleError(_0x41b25e,null));};exports['create']=function(_0x440dc5,_0x177704){return db[_0xd425('0x30')][_0xd425('0x4e')](_0x440dc5[_0xd425('0x4f')],{})[_0xd425('0x2a')](respondWithResult(_0x177704,0xc9))['catch'](handleError(_0x177704,null));};exports[_0xd425('0x29')]=function(_0x128cb3,_0x5bfac6){if(_0x128cb3[_0xd425('0x4f')]['id']){delete _0x128cb3[_0xd425('0x4f')]['id'];}return db[_0xd425('0x30')][_0xd425('0x4d')]({'where':{'id':_0x128cb3['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5bfac6,null))[_0xd425('0x2a')](saveUpdates(_0x128cb3[_0xd425('0x4f')],null))[_0xd425('0x2a')](respondWithResult(_0x5bfac6,null))[_0xd425('0x48')](handleError(_0x5bfac6,null));};exports['destroy']=function(_0x4be6fa,_0x381bdb){return db['JscriptyAnswerReport'][_0xd425('0x4d')]({'where':{'id':_0x4be6fa[_0xd425('0x4a')]['id']}})['then'](handleEntityNotFound(_0x381bdb,null))[_0xd425('0x2a')](removeEntity(_0x381bdb,null))['catch'](handleError(_0x381bdb,null));};exports['describe']=function(_0x39f588,_0x111905){return db[_0xd425('0x30')][_0xd425('0x50')]()[_0xd425('0x2a')](respondWithResult(_0x111905,null))[_0xd425('0x48')](handleError(_0x111905,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 8400a3c..5f224f2 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 _0xd79b=['rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','request-promise','path'];(function(_0x4fe36d,_0x12806b){var _0x3eb48f=function(_0x2c7eac){while(--_0x2c7eac){_0x4fe36d['push'](_0x4fe36d['shift']());}};_0x3eb48f(++_0x12806b);}(_0xd79b,0x1c2));var _0xbd79=function(_0x98b357,_0x8a11b7){_0x98b357=_0x98b357-0x0;var _0x57f3f7=_0xd79b[_0x98b357];return _0x57f3f7;};'use strict';var _=require(_0xbd79('0x0'));var util=require(_0xbd79('0x1'));var logger=require('../../config/logger')(_0xbd79('0x2'));var moment=require(_0xbd79('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd79('0x4'));var fs=require('fs');var path=require(_0xbd79('0x5'));var rimraf=require(_0xbd79('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd79('0x7'));module[_0xbd79('0x8')]=function(_0x3986c0,_0x39dfa6){return _0x3986c0[_0xbd79('0x9')](_0xbd79('0xa'),attributes,{'tableName':_0xbd79('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87e1=['bluebird','request-promise','define','JscriptyAnswerReport','lodash','util','../../config/logger'];(function(_0x5659da,_0x684c97){var _0x3040cf=function(_0x2cbad7){while(--_0x2cbad7){_0x5659da['push'](_0x5659da['shift']());}};_0x3040cf(++_0x684c97);}(_0x87e1,0x89));var _0x187e=function(_0x3f889c,_0x1c16af){_0x3f889c=_0x3f889c-0x0;var _0x5edf2a=_0x87e1[_0x3f889c];return _0x5edf2a;};'use strict';var _=require(_0x187e('0x0'));var util=require(_0x187e('0x1'));var logger=require(_0x187e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x187e('0x3'));var rp=require(_0x187e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x2103db,_0xfecd7f){return _0x2103db[_0x187e('0x5')](_0x187e('0x6'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 65d2a77..4504892 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 _0x17ca=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3b25a0,_0x3b0386){var _0x46ae66=function(_0x11cb1c){while(--_0x11cb1c){_0x3b25a0['push'](_0x3b25a0['shift']());}};_0x46ae66(++_0x3b0386);}(_0x17ca,0x6a));var _0xa17c=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0x17ca[_0x770f7];return _0xe797c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa17c('0x0'));var rs=require(_0xa17c('0x1'));var fs=require('fs');var Redis=require(_0xa17c('0x2'));var db=require(_0xa17c('0x3'))['db'];var utils=require(_0xa17c('0x4'));var logger=require(_0xa17c('0x5'))(_0xa17c('0x6'));var config=require(_0xa17c('0x7'));var jayson=require(_0xa17c('0x8'));var client=jayson[_0xa17c('0x9')][_0xa17c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e3379,_0x34d5da,_0x24a1b0){return new BPromise(function(_0x1bae74,_0x73e681){return client[_0xa17c('0xb')](_0x3e3379,_0x24a1b0)[_0xa17c('0xc')](function(_0xdc8d1a){logger[_0xa17c('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x34d5da,_0xa17c('0xe'));logger[_0xa17c('0xf')](_0xa17c('0x10'),_0x34d5da,_0xa17c('0xe'),JSON[_0xa17c('0x11')](_0xdc8d1a));if(_0xdc8d1a[_0xa17c('0x12')]){if(_0xdc8d1a['error'][_0xa17c('0x13')]===0x1f4){logger[_0xa17c('0x12')](_0xa17c('0x14'),_0x34d5da,_0xdc8d1a[_0xa17c('0x12')][_0xa17c('0x15')]);return _0x73e681(_0xdc8d1a[_0xa17c('0x12')][_0xa17c('0x15')]);}logger[_0xa17c('0x12')](_0xa17c('0x14'),_0x34d5da,_0xdc8d1a[_0xa17c('0x12')]['message']);return _0x1bae74(_0xdc8d1a[_0xa17c('0x12')][_0xa17c('0x15')]);}else{logger[_0xa17c('0xd')](_0xa17c('0x14'),_0x34d5da,'request\x20sent');_0x1bae74(_0xdc8d1a[_0xa17c('0x16')][_0xa17c('0x15')]);}})[_0xa17c('0x17')](function(_0x1656d8){logger['error'](_0xa17c('0x14'),_0x34d5da,_0x1656d8);_0x73e681(_0x1656d8);});});} \ No newline at end of file +var _0xd7f4=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x31791a,_0xd68d5e){var _0x3c64fd=function(_0x21ffbc){while(--_0x21ffbc){_0x31791a['push'](_0x31791a['shift']());}};_0x3c64fd(++_0xd68d5e);}(_0xd7f4,0x83));var _0x4d7f=function(_0x31b31f,_0x1025df){_0x31b31f=_0x31b31f-0x0;var _0x58388f=_0xd7f4[_0x31b31f];return _0x58388f;};'use strict';var _=require(_0x4d7f('0x0'));var util=require(_0x4d7f('0x1'));var moment=require(_0x4d7f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d7f('0x3'));var db=require(_0x4d7f('0x4'))['db'];var utils=require(_0x4d7f('0x5'));var logger=require(_0x4d7f('0x6'))(_0x4d7f('0x7'));var config=require(_0x4d7f('0x8'));var jayson=require(_0x4d7f('0x9'));var client=jayson[_0x4d7f('0xa')][_0x4d7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3752fb,_0xd308c,_0xdcbf83){return new BPromise(function(_0x3d2770,_0x13f0ab){return client['request'](_0x3752fb,_0xdcbf83)[_0x4d7f('0xc')](function(_0x3664a0){logger[_0x4d7f('0xd')](_0x4d7f('0xe'),_0xd308c,_0x4d7f('0xf'));logger[_0x4d7f('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0xd308c,_0x4d7f('0xf'),JSON[_0x4d7f('0x11')](_0x3664a0));if(_0x3664a0['error']){if(_0x3664a0[_0x4d7f('0x12')]['code']===0x1f4){logger[_0x4d7f('0x12')](_0x4d7f('0xe'),_0xd308c,_0x3664a0['error'][_0x4d7f('0x13')]);return _0x13f0ab(_0x3664a0[_0x4d7f('0x12')][_0x4d7f('0x13')]);}logger[_0x4d7f('0x12')](_0x4d7f('0xe'),_0xd308c,_0x3664a0['error'][_0x4d7f('0x13')]);return _0x3d2770(_0x3664a0[_0x4d7f('0x12')][_0x4d7f('0x13')]);}else{logger[_0x4d7f('0xd')](_0x4d7f('0xe'),_0xd308c,_0x4d7f('0xf'));_0x3d2770(_0x3664a0[_0x4d7f('0x14')]['message']);}})[_0x4d7f('0x15')](function(_0x181cfc){logger['error'](_0x4d7f('0xe'),_0xd308c,_0x181cfc);_0x13f0ab(_0x181cfc);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f22449a..98c804d 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 _0xd86d=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','update','delete','destroy','exports'];(function(_0xe8e2b3,_0x4c5348){var _0x545fa0=function(_0x20d935){while(--_0x20d935){_0xe8e2b3['push'](_0xe8e2b3['shift']());}};_0x545fa0(++_0x4c5348);}(_0xd86d,0x15e));var _0xdd86=function(_0xc1b5d0,_0x36ef3c){_0xc1b5d0=_0xc1b5d0-0x0;var _0x3faf7e=_0xd86d[_0xc1b5d0];return _0x3faf7e;};'use strict';var multer=require('multer');var util=require(_0xdd86('0x0'));var path=require('path');var timeout=require(_0xdd86('0x1'));var express=require('express');var router=express[_0xdd86('0x2')]();var fs_extra=require(_0xdd86('0x3'));var auth=require(_0xdd86('0x4'));var interaction=require(_0xdd86('0x5'));var config=require(_0xdd86('0x6'));var controller=require(_0xdd86('0x7'));router[_0xdd86('0x8')]('/',auth[_0xdd86('0x9')](),controller[_0xdd86('0xa')]);router['get'](_0xdd86('0xb'),auth[_0xdd86('0x9')](),controller[_0xdd86('0xc')]);router[_0xdd86('0x8')]('/:id/sessions',auth[_0xdd86('0x9')](),controller['getSessions']);router['get'](_0xdd86('0xd'),auth['isAuthenticated'](),controller[_0xdd86('0xe')]);router['get'](_0xdd86('0xf'),auth[_0xdd86('0x9')](),timeout(_0xdd86('0x10')),controller[_0xdd86('0x11')]);router[_0xdd86('0x12')]('/',auth[_0xdd86('0x9')](),controller[_0xdd86('0x13')]);router['post'](_0xdd86('0x14'),auth[_0xdd86('0x9')](),controller['clone']);router['put'](_0xdd86('0xb'),auth[_0xdd86('0x9')](),controller[_0xdd86('0x15')]);router[_0xdd86('0x16')](_0xdd86('0xb'),auth[_0xdd86('0x9')](),controller[_0xdd86('0x17')]);module[_0xdd86('0x18')]=router; \ No newline at end of file +var _0x8ba7=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','clone','put','update','delete','destroy'];(function(_0x3cc5b9,_0x1af0cc){var _0x48ff18=function(_0x378dfd){while(--_0x378dfd){_0x3cc5b9['push'](_0x3cc5b9['shift']());}};_0x48ff18(++_0x1af0cc);}(_0x8ba7,0x139));var _0x78ba=function(_0x284d82,_0x21d029){_0x284d82=_0x284d82-0x0;var _0x4adaa4=_0x8ba7[_0x284d82];return _0x4adaa4;};'use strict';var multer=require(_0x78ba('0x0'));var util=require(_0x78ba('0x1'));var path=require(_0x78ba('0x2'));var timeout=require(_0x78ba('0x3'));var express=require(_0x78ba('0x4'));var router=express[_0x78ba('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x78ba('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x78ba('0x7'));var controller=require(_0x78ba('0x8'));router[_0x78ba('0x9')]('/',auth[_0x78ba('0xa')](),controller[_0x78ba('0xb')]);router['get'](_0x78ba('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x78ba('0x9')](_0x78ba('0xd'),auth[_0x78ba('0xa')](),controller['getSessions']);router[_0x78ba('0x9')](_0x78ba('0xe'),auth[_0x78ba('0xa')](),controller[_0x78ba('0xf')]);router[_0x78ba('0x9')]('/:id/summary',auth[_0x78ba('0xa')](),timeout(_0x78ba('0x10')),controller[_0x78ba('0x11')]);router[_0x78ba('0x12')]('/',auth[_0x78ba('0xa')](),controller['create']);router['post'](_0x78ba('0x13'),auth[_0x78ba('0xa')](),controller[_0x78ba('0x14')]);router[_0x78ba('0x15')]('/:id',auth[_0x78ba('0xa')](),controller[_0x78ba('0x16')]);router[_0x78ba('0x17')]('/:id',auth[_0x78ba('0xa')](),controller[_0x78ba('0x18')]);module[_0x78ba('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ab7fe2b..8d6aad0 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 _0x594f=['description','BOOLEAN','lodash','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','isString','format','getDataValue'];(function(_0x2ef2c5,_0x249f30){var _0x11a799=function(_0x13da56){while(--_0x13da56){_0x2ef2c5['push'](_0x2ef2c5['shift']());}};_0x11a799(++_0x249f30);}(_0x594f,0x147));var _0xf594=function(_0x51b4bb,_0x4a1f1e){_0x51b4bb=_0x51b4bb-0x0;var _0x234460=_0x594f[_0x51b4bb];return _0x234460;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf594('0x0'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xf594('0x1')],'unique':_0xf594('0x2')},'description':{'type':Sequelize[_0xf594('0x1')]},'formData':{'type':Sequelize[_0xf594('0x3')](_0xf594('0x4')),'set':function(_0x394e36){if(_[_0xf594('0x5')](_0x394e36)){this[_0xf594('0x6')](_0xf594('0x7'),JSON['stringify'](_0x394e36));}else if(_[_0xf594('0x8')](_0x394e36)){this[_0xf594('0x6')]('formData',_0x394e36);}else{this['setDataValue'](_0xf594('0x7'),util[_0xf594('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf594('0xa')](_0xf594('0x2'))||'',this[_0xf594('0xa')](_0xf594('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf594('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xd5cb=['BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd5cb,0x9a));var _0xbd5c=function(_0x52a40e,_0x3bb380){_0x52a40e=_0x52a40e-0x0;var _0x1d9281=_0xd5cb[_0x52a40e];return _0x1d9281;};'use strict';var Sequelize=require(_0xbd5c('0x0'));var _=require(_0xbd5c('0x1'));var util=require(_0xbd5c('0x2'));module[_0xbd5c('0x3')]={'name':{'type':Sequelize[_0xbd5c('0x4')],'unique':_0xbd5c('0x5')},'description':{'type':Sequelize[_0xbd5c('0x4')]},'formData':{'type':Sequelize[_0xbd5c('0x6')](_0xbd5c('0x7')),'set':function(_0x2bcd24){if(_['isObjectLike'](_0x2bcd24)){this['setDataValue'](_0xbd5c('0x8'),JSON[_0xbd5c('0x9')](_0x2bcd24));}else if(_[_0xbd5c('0xa')](_0x2bcd24)){this[_0xbd5c('0xb')](_0xbd5c('0x8'),_0x2bcd24);}else{this[_0xbd5c('0xb')](_0xbd5c('0x8'),util[_0xbd5c('0xc')](_0xbd5c('0xd'),this['getDataValue'](_0xbd5c('0x5'))||'',this[_0xbd5c('0xe')](_0xbd5c('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xbd5c('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index bbe6e58..003f0da 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 _0x056b=['merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','body','getSessions','hasOwnProperty','ProjectId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','nolimit','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','Projects','error','stack','name','index','map','JscriptyProject','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x056b,0xb6));var _0xb056=function(_0x120ab8,_0x577eb9){_0x120ab8=_0x120ab8-0x0;var _0x597e51=_0x056b[_0x120ab8];return _0x597e51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];function respondWithStatusCode(_0x5d8306,_0x49c5ec){_0x49c5ec=_0x49c5ec||0xcc;return function(_0xf3e80f){if(_0xf3e80f){return _0x5d8306[_0xb056('0x1b')](_0x49c5ec);}return _0x5d8306['status'](_0x49c5ec)[_0xb056('0x1c')]();};}function respondWithResult(_0x34611b,_0xf1c2e9){_0xf1c2e9=_0xf1c2e9||0xc8;return function(_0x1197e5){if(_0x1197e5){return _0x34611b[_0xb056('0x1d')](_0xf1c2e9)[_0xb056('0x1e')](_0x1197e5);}};}function respondWithFilteredResult(_0x179e49,_0x4b838e){return function(_0x162146){if(_0x162146){var _0x43565e=typeof _0x4b838e[_0xb056('0x1f')]===_0xb056('0x20')&&typeof _0x4b838e['limit']===_0xb056('0x20');var _0x4e501a=_0x162146[_0xb056('0x21')];var _0x311eb9=_0x43565e?0x0:_0x4b838e['offset'];var _0x29c77e=_0x43565e?_0x162146['count']:_0x4b838e[_0xb056('0x1f')]+_0x4b838e[_0xb056('0x22')];var _0x5e4bd9;if(_0x29c77e>=_0x4e501a){_0x29c77e=_0x4e501a;_0x5e4bd9=0xc8;}else{_0x5e4bd9=0xce;}_0x179e49[_0xb056('0x1d')](_0x5e4bd9);return _0x179e49['set'](_0xb056('0x23'),_0x311eb9+'-'+_0x29c77e+'/'+_0x4e501a)[_0xb056('0x1e')](_0x162146);}return null;};}function patchUpdates(_0x457b54){return function(_0x33dd35){try{jsonpatch['apply'](_0x33dd35,_0x457b54,!![]);}catch(_0x1db585){return BPromise['reject'](_0x1db585);}return _0x33dd35[_0xb056('0x24')]();};}function saveUpdates(_0x5dea90,_0x324ce6){return function(_0x40ac2d){if(_0x40ac2d){return _0x40ac2d[_0xb056('0x25')](_0x5dea90)[_0xb056('0x26')](function(_0x36e539){return _0x36e539;});}return null;};}function removeEntity(_0x4bb6c0,_0x4e66c3){return function(_0x1016da){if(_0x1016da){return _0x1016da[_0xb056('0x27')]()[_0xb056('0x26')](function(){var _0x1bd6ac=_0x1016da['get']({'plain':!![]});var _0x44a14f=_0xb056('0x28');return db['UserProfileResource'][_0xb056('0x27')]({'where':{'type':_0x44a14f,'resourceId':_0x1bd6ac['id']}})[_0xb056('0x26')](function(){return _0x1016da;});})[_0xb056('0x26')](function(){_0x4bb6c0[_0xb056('0x1d')](0xcc)[_0xb056('0x1c')]();});}};}function handleEntityNotFound(_0x4024d7,_0x211898){return function(_0x2042f1){if(!_0x2042f1){_0x4024d7['sendStatus'](0x194);}return _0x2042f1;};}function handleError(_0x29fbc1,_0x51b06b){_0x51b06b=_0x51b06b||0x1f4;return function(_0x3d83d3){logger[_0xb056('0x29')](_0x3d83d3[_0xb056('0x2a')]);if(_0x3d83d3['name']){delete _0x3d83d3[_0xb056('0x2b')];}_0x29fbc1[_0xb056('0x1d')](_0x51b06b)['send'](_0x3d83d3);};}exports[_0xb056('0x2c')]=function(_0x43aa63,_0x329eaa){var _0x1fad05={},_0x3ce984={},_0x4ebca5={'count':0x0,'rows':[]};var _0x87f31e=_[_0xb056('0x2d')](db[_0xb056('0x2e')][_0xb056('0x2f')],function(_0x103482){return{'name':_0x103482['fieldName'],'type':_0x103482[_0xb056('0x30')][_0xb056('0x31')]};});_0x3ce984[_0xb056('0x32')]=_[_0xb056('0x2d')](_0x87f31e,_0xb056('0x2b'));_0x3ce984[_0xb056('0x33')]=_[_0xb056('0x34')](_0x43aa63[_0xb056('0x33')]);_0x3ce984['filters']=_[_0xb056('0x35')](_0x3ce984['model'],_0x3ce984[_0xb056('0x33')]);_0x1fad05['attributes']=_['intersection'](_0x3ce984[_0xb056('0x32')],qs[_0xb056('0x36')](_0x43aa63[_0xb056('0x33')][_0xb056('0x36')]));_0x1fad05[_0xb056('0x37')]=_0x1fad05[_0xb056('0x37')][_0xb056('0x38')]?_0x1fad05['attributes']:_0x3ce984[_0xb056('0x32')];if(!_0x43aa63[_0xb056('0x33')]['hasOwnProperty']('nolimit')){_0x1fad05[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x43aa63[_0xb056('0x33')]['limit']);_0x1fad05[_0xb056('0x1f')]=qs[_0xb056('0x1f')](_0x43aa63[_0xb056('0x33')][_0xb056('0x1f')]);}_0x1fad05[_0xb056('0x39')]=qs[_0xb056('0x3a')](_0x43aa63[_0xb056('0x33')][_0xb056('0x3a')]);_0x1fad05[_0xb056('0x3b')]=qs[_0xb056('0x3c')](_[_0xb056('0x3d')](_0x43aa63[_0xb056('0x33')],_0x3ce984['filters']),_0x87f31e);if(_0x43aa63[_0xb056('0x33')]['filter']){_0x1fad05[_0xb056('0x3b')]=_[_0xb056('0x3e')](_0x1fad05[_0xb056('0x3b')],{'$or':_[_0xb056('0x2d')](_0x87f31e,function(_0x460f28){if(_0x460f28[_0xb056('0x30')]!==_0xb056('0x3f')){var _0x42b54f={};_0x42b54f[_0x460f28['name']]={'$like':'%'+_0x43aa63[_0xb056('0x33')][_0xb056('0x40')]+'%'};return _0x42b54f;}})});}_0x1fad05=_[_0xb056('0x3e')]({},_0x1fad05,_0x43aa63[_0xb056('0x41')]);var _0x134db7={'where':_0x1fad05['where']};return db[_0xb056('0x2e')][_0xb056('0x21')](_0x134db7)[_0xb056('0x26')](function(_0x216f72){_0x4ebca5[_0xb056('0x21')]=_0x216f72;if(_0x43aa63[_0xb056('0x33')]['includeAll']){_0x1fad05[_0xb056('0x42')]=[{'all':!![]}];}return db['JscriptyProject'][_0xb056('0x43')](_0x1fad05);})[_0xb056('0x26')](function(_0x21d98e){_0x4ebca5[_0xb056('0x44')]=_0x21d98e;return _0x4ebca5;})[_0xb056('0x26')](respondWithFilteredResult(_0x329eaa,_0x1fad05))[_0xb056('0x45')](handleError(_0x329eaa,null));};exports[_0xb056('0x46')]=function(_0x248819,_0x2c8b61){var _0x149341={'raw':![],'where':{'id':_0x248819[_0xb056('0x47')]['id']}},_0x4fa3c5={};_0x4fa3c5[_0xb056('0x32')]=_[_0xb056('0x34')](db['JscriptyProject'][_0xb056('0x2f')]);_0x4fa3c5[_0xb056('0x33')]=_['keys'](_0x248819['query']);_0x4fa3c5[_0xb056('0x3c')]=_[_0xb056('0x35')](_0x4fa3c5[_0xb056('0x32')],_0x4fa3c5[_0xb056('0x33')]);_0x149341['attributes']=_['intersection'](_0x4fa3c5['model'],qs['fields'](_0x248819['query']['fields']));_0x149341[_0xb056('0x37')]=_0x149341['attributes'][_0xb056('0x38')]?_0x149341[_0xb056('0x37')]:_0x4fa3c5[_0xb056('0x32')];if(_0x248819[_0xb056('0x33')][_0xb056('0x48')]){_0x149341[_0xb056('0x42')]=[{'all':!![]}];}_0x149341=_[_0xb056('0x3e')]({},_0x149341,_0x248819[_0xb056('0x41')]);return db['JscriptyProject'][_0xb056('0x49')](_0x149341)[_0xb056('0x26')](handleEntityNotFound(_0x2c8b61,null))['then'](respondWithResult(_0x2c8b61,null))[_0xb056('0x45')](handleError(_0x2c8b61,null));};exports[_0xb056('0x4a')]=function(_0xe40439,_0x2f2d22){return db[_0xb056('0x2e')][_0xb056('0x4a')](_0xe40439['body'],{})[_0xb056('0x26')](function(_0x5e2224){var _0x132268=_0xe40439[_0xb056('0x4b')][_0xb056('0x4c')]({'plain':!![]});if(!_0x132268)throw new Error(_0xb056('0x4d'));if(_0x132268[_0xb056('0x4e')]===_0xb056('0x4b')){var _0x2b6733=_0x5e2224[_0xb056('0x4c')]({'plain':!![]});var _0x5a3bbf=_0xb056('0x28');return db[_0xb056('0x4f')][_0xb056('0x49')]({'where':{'name':_0x5a3bbf,'userProfileId':_0x132268[_0xb056('0x50')]},'raw':!![]})[_0xb056('0x26')](function(_0x35acab){if(_0x35acab&&_0x35acab[_0xb056('0x51')]===0x0){return db[_0xb056('0x52')]['create']({'name':_0x2b6733[_0xb056('0x2b')],'resourceId':_0x2b6733['id'],'type':_0x35acab[_0xb056('0x2b')],'sectionId':_0x35acab['id']},{})[_0xb056('0x26')](function(){return _0x5e2224;});}else{return _0x5e2224;}})[_0xb056('0x45')](function(_0x1a5170){logger[_0xb056('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a5170);throw _0x1a5170;});}return _0x5e2224;})[_0xb056('0x26')](respondWithResult(_0x2f2d22,0xc9))[_0xb056('0x45')](handleError(_0x2f2d22,null));};exports[_0xb056('0x53')]=function(_0x536d85,_0x37c64c){var _0x5119c0={'where':{'id':_0x536d85[_0xb056('0x47')]['id']}},_0x3ad85e={};_0x3ad85e[_0xb056('0x32')]=_[_0xb056('0x34')](db['JscriptyProject'][_0xb056('0x2f')]);_0x5119c0[_0xb056('0x37')]=_['intersection'](_0x3ad85e[_0xb056('0x32')],qs[_0xb056('0x36')](_0x536d85[_0xb056('0x33')][_0xb056('0x36')]));_0x5119c0[_0xb056('0x37')]=_0x5119c0['attributes'][_0xb056('0x38')]?_0x5119c0[_0xb056('0x37')]:_0x3ad85e[_0xb056('0x32')];if(_0x536d85[_0xb056('0x33')][_0xb056('0x48')]){_0x5119c0[_0xb056('0x42')]=[{'all':!![]}];}_0x5119c0=_[_0xb056('0x3e')]({},_0x5119c0,_0x536d85[_0xb056('0x41')]);return db[_0xb056('0x2e')][_0xb056('0x49')](_0x5119c0)[_0xb056('0x26')](handleEntityNotFound(_0x37c64c,null))[_0xb056('0x26')](function(_0x2ab5a8){if(_0x2ab5a8){var _0x3f9964=_0x2ab5a8[_0xb056('0x4c')]({'plain':!![]});_0x3f9964=qs[_0xb056('0x54')](_0x3f9964,['id',_0xb056('0x55'),_0xb056('0x56')]);_0x536d85[_0xb056('0x57')]=_[_0xb056('0x54')](_0x536d85[_0xb056('0x57')],['id','createdAt',_0xb056('0x56')]);return db[_0xb056('0x2e')][_0xb056('0x4a')](_[_0xb056('0x3e')](_0x3f9964,_0x536d85[_0xb056('0x57')]),{'include':_0x536d85[_0xb056('0x33')][_0xb056('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x5b03df){var _0x30441e=_0x536d85[_0xb056('0x4b')][_0xb056('0x4c')]({'plain':!![]});if(!_0x30441e)throw new Error(_0xb056('0x4d'));if(_0x30441e[_0xb056('0x4e')]==='user'){var _0x44e1e9=_0x5b03df[_0xb056('0x4c')]({'plain':!![]});var _0x7471b3=_0xb056('0x28');return db['UserProfileSection'][_0xb056('0x49')]({'where':{'name':_0x7471b3,'userProfileId':_0x30441e[_0xb056('0x50')]},'raw':!![]})[_0xb056('0x26')](function(_0x5e419e){if(_0x5e419e&&_0x5e419e[_0xb056('0x51')]===0x0){return db[_0xb056('0x52')][_0xb056('0x4a')]({'name':_0x44e1e9['name'],'resourceId':_0x44e1e9['id'],'type':_0x5e419e[_0xb056('0x2b')],'sectionId':_0x5e419e['id']},{})[_0xb056('0x26')](function(){return _0x5b03df;});}else{return _0x5b03df;}})[_0xb056('0x45')](function(_0x5bf8ce){logger[_0xb056('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf8ce);throw _0x5bf8ce;});}return _0x5b03df;});}})[_0xb056('0x26')](respondWithResult(_0x37c64c,0xc9))[_0xb056('0x45')](handleError(_0x37c64c,null));};exports[_0xb056('0x25')]=function(_0x556a93,_0x45d347){if(_0x556a93[_0xb056('0x57')]['id']){delete _0x556a93['body']['id'];}return db[_0xb056('0x2e')][_0xb056('0x49')]({'where':{'id':_0x556a93[_0xb056('0x47')]['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x45d347,null))[_0xb056('0x26')](saveUpdates(_0x556a93['body'],null))['then'](respondWithResult(_0x45d347,null))[_0xb056('0x45')](handleError(_0x45d347,null));};exports['destroy']=function(_0x2d9b20,_0x5971dd){return db[_0xb056('0x2e')][_0xb056('0x49')]({'where':{'id':_0x2d9b20[_0xb056('0x47')]['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x5971dd,null))['then'](removeEntity(_0x5971dd,null))['catch'](handleError(_0x5971dd,null));};exports[_0xb056('0x58')]=function(_0x1e14e1,_0x3b3bbf,_0x21e16a){var _0x47e509={'raw':!![],'where':{}};var _0x2d2c20={};var _0x4d2233={'count':0x0,'rows':[]};return db[_0xb056('0x2e')]['findOne']({'where':{'id':_0x1e14e1[_0xb056('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b3bbf,null))[_0xb056('0x26')](function(_0x443a2e){if(_0x443a2e){_0x2d2c20[_0xb056('0x32')]=_[_0xb056('0x34')](db['JscriptySessionReport'][_0xb056('0x2f')]);_0x2d2c20['query']=_[_0xb056('0x34')](_0x1e14e1[_0xb056('0x33')]);_0x2d2c20[_0xb056('0x3c')]=_[_0xb056('0x35')](_0x2d2c20[_0xb056('0x32')],_0x2d2c20[_0xb056('0x33')]);_0x47e509[_0xb056('0x37')]=_[_0xb056('0x35')](_0x2d2c20[_0xb056('0x32')],qs[_0xb056('0x36')](_0x1e14e1[_0xb056('0x33')][_0xb056('0x36')]));_0x47e509['attributes']=_0x47e509['attributes'][_0xb056('0x38')]?_0x47e509['attributes']:_0x2d2c20[_0xb056('0x32')];if(!_0x1e14e1['query'][_0xb056('0x59')]('nolimit')){_0x47e509['limit']=qs['limit'](_0x1e14e1[_0xb056('0x33')]['limit']);_0x47e509['offset']=qs[_0xb056('0x1f')](_0x1e14e1[_0xb056('0x33')][_0xb056('0x1f')]);}_0x47e509['order']=qs['sort'](_0x1e14e1['query'][_0xb056('0x3a')]);_0x47e509[_0xb056('0x3b')]=qs[_0xb056('0x3c')](_[_0xb056('0x3d')](_0x1e14e1[_0xb056('0x33')],_0x2d2c20[_0xb056('0x3c')]));_0x47e509[_0xb056('0x3b')][_0xb056('0x5a')]=_0x443a2e['id'];if(_0x1e14e1[_0xb056('0x33')][_0xb056('0x40')]){_0x47e509[_0xb056('0x3b')]=_[_0xb056('0x3e')](_0x47e509[_0xb056('0x3b')],{'$or':_[_0xb056('0x2d')](_0x47e509['attributes'],function(_0x5def29){var _0x18feb4={};_0x18feb4[_0x5def29]={'$like':'%'+_0x1e14e1['query'][_0xb056('0x40')]+'%'};return _0x18feb4;})});}_0x47e509=_[_0xb056('0x3e')]({},_0x47e509,_0x1e14e1[_0xb056('0x41')]);return db[_0xb056('0x5b')]['count']({'where':_0x47e509['where']})[_0xb056('0x26')](function(_0x13a0f1){_0x4d2233[_0xb056('0x21')]=_0x13a0f1;if(_0x1e14e1['query']['includeAll']){_0x47e509[_0xb056('0x42')]=[{'all':!![]}];}return db[_0xb056('0x5b')]['findAll'](_0x47e509);})[_0xb056('0x26')](function(_0x456588){_0x4d2233[_0xb056('0x44')]=_0x456588;return _0x4d2233;});}})[_0xb056('0x26')](respondWithFilteredResult(_0x3b3bbf,_0x47e509))[_0xb056('0x45')](handleError(_0x3b3bbf,null));};exports[_0xb056('0x5c')]=function(_0xb96f3c,_0x27b31f,_0x141634){var _0x416d33={'raw':!![],'where':{}};var _0xfad362={};var _0x5a7a61={'count':0x0,'rows':[]};return db[_0xb056('0x2e')][_0xb056('0x5d')]({'where':{'id':_0xb96f3c[_0xb056('0x47')]['id']}})['then'](handleEntityNotFound(_0x27b31f,null))[_0xb056('0x26')](function(_0x4dc495){if(_0x4dc495){_0xfad362['model']=_[_0xb056('0x34')](db[_0xb056('0x5e')][_0xb056('0x2f')]);_0xfad362['query']=_['keys'](_0xb96f3c[_0xb056('0x33')]);_0xfad362[_0xb056('0x3c')]=_['intersection'](_0xfad362[_0xb056('0x32')],_0xfad362['query']);_0x416d33[_0xb056('0x37')]=_[_0xb056('0x35')](_0xfad362['model'],qs['fields'](_0xb96f3c[_0xb056('0x33')][_0xb056('0x36')]));_0x416d33['attributes']=_0x416d33[_0xb056('0x37')]['length']?_0x416d33['attributes']:_0xfad362[_0xb056('0x32')];if(!_0xb96f3c[_0xb056('0x33')][_0xb056('0x59')](_0xb056('0x5f'))){_0x416d33[_0xb056('0x22')]=qs[_0xb056('0x22')](_0xb96f3c['query'][_0xb056('0x22')]);_0x416d33['offset']=qs[_0xb056('0x1f')](_0xb96f3c[_0xb056('0x33')]['offset']);}_0x416d33[_0xb056('0x39')]=qs[_0xb056('0x3a')](_0xb96f3c['query'][_0xb056('0x3a')]);_0x416d33['where']=qs[_0xb056('0x3c')](_['pick'](_0xb96f3c[_0xb056('0x33')],_0xfad362[_0xb056('0x3c')]));_0x416d33['where'][_0xb056('0x5a')]=_0x4dc495['id'];if(_0xb96f3c['query'][_0xb056('0x40')]){_0x416d33[_0xb056('0x3b')]=_[_0xb056('0x3e')](_0x416d33[_0xb056('0x3b')],{'$or':_[_0xb056('0x2d')](_0x416d33[_0xb056('0x37')],function(_0x1bac84){var _0x3eb03c={};_0x3eb03c[_0x1bac84]={'$like':'%'+_0xb96f3c['query'][_0xb056('0x40')]+'%'};return _0x3eb03c;})});}_0x416d33=_['merge']({},_0x416d33,_0xb96f3c['options']);return db['JscriptyAnswerReport'][_0xb056('0x21')]({'where':_0x416d33[_0xb056('0x3b')]})[_0xb056('0x26')](function(_0x2811c4){_0x5a7a61['count']=_0x2811c4;if(_0xb96f3c[_0xb056('0x33')][_0xb056('0x48')]){_0x416d33[_0xb056('0x42')]=[{'all':!![]}];}return db[_0xb056('0x5e')][_0xb056('0x43')](_0x416d33);})['then'](function(_0x9257a8){_0x5a7a61[_0xb056('0x44')]=_0x9257a8;return _0x5a7a61;});}})[_0xb056('0x26')](respondWithFilteredResult(_0x27b31f,_0x416d33))['catch'](handleError(_0x27b31f,null));};function char(_0x526035){return'number'===typeof _0x526035?String['fromCharCode']['apply'](null,arguments):_0x526035;}function needsEncapsulation(_0x5021d2){return!!_0x5021d2&&(_0x5021d2[_0xb056('0x60')]()[_0xb056('0x61')](char(0xd))>=0x0||_0x5021d2[_0xb056('0x60')]()[_0xb056('0x61')](char(0xa))>=0x0||_0x5021d2[_0xb056('0x60')]()[_0xb056('0x61')](char(0x2c))>=0x0||_0x5021d2['toString']()[_0xb056('0x61')](char(0x22))>=0x0);}function encapsulate(_0x1c38f1){var _0x14158f=char(0x22),_0x3e4ba5='\x5c'+char(0x22),_0x1ff1e7=_0x1c38f1[_0xb056('0x60')]()[_0xb056('0x62')](new RegExp(_0x14158f,'g'),_0x3e4ba5);return _0x14158f+_0x1ff1e7+_0x14158f;}exports[_0xb056('0x63')]=function(_0x10ffb8,_0x239950,_0x4a184c){var _0x57c9d3,_0x5270c8;var _0x406887={'where':{'ProjectId':_0x10ffb8['params']['id']}};if(_0x10ffb8[_0xb056('0x33')][_0xb056('0x64')]){_0x406887[_0xb056('0x3b')][_0xb056('0x65')]=JSON[_0xb056('0x66')](_0x10ffb8[_0xb056('0x33')][_0xb056('0x64')]);}return db[_0xb056('0x5b')][_0xb056('0x43')](_0x406887)['then'](handleEntityNotFound(_0x239950,null))[_0xb056('0x26')](function(_0x141dbb){if(_0x141dbb){_0x57c9d3=_0x141dbb;return db[_0xb056('0x67')][_0xb056('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x57c9d3,'id')},'ProjectId':_0x10ffb8['params']['id']},'order':_0xb056('0x68')});}})[_0xb056('0x26')](handleEntityNotFound(_0x239950,null))[_0xb056('0x26')](function(_0x1a3666){if(_0x1a3666){_0x5270c8=_0x1a3666;var _0x8b923b={};for(var _0x8d8f12=0x0,_0x1b1800=_0x5270c8['length'];_0x8d8f12<_0x1b1800;_0x8d8f12++){if(!_0x8b923b[_0xb056('0x59')](_0x5270c8[_0x8d8f12]['questionId'])){_0x8b923b[_0x5270c8[_0x8d8f12][_0xb056('0x69')]]=needsEncapsulation(_0x5270c8[_0x8d8f12][_0xb056('0x6a')])?encapsulate(_0x5270c8[_0x8d8f12]['question']):_0x5270c8[_0x8d8f12][_0xb056('0x6a')];}}var _0x545030=[],_0x155e14={};for(var _0x45f7c9=0x0,_0x930dfc=_0x57c9d3[_0xb056('0x38')];_0x45f7c9<_0x930dfc;_0x45f7c9++){_0x155e14={'ProjectId':_0x10ffb8[_0xb056('0x47')]['id'],'SessionId':_0x57c9d3[_0x45f7c9]['id'],'StartTime':moment(_0x57c9d3[_0x45f7c9]['starttime'])[_0xb056('0x6b')](_0xb056('0x6c'))};for(var _0xa95d7b=0x0,_0xca6cf7=_0x5270c8[_0xb056('0x38')];_0xa95d7b<_0xca6cf7;_0xa95d7b++){if(_0x5270c8[_0xa95d7b][_0xb056('0x6d')]==_0x57c9d3[_0x45f7c9]['id']&&_0x8b923b[_0xb056('0x59')](_0x5270c8[_0xa95d7b][_0xb056('0x69')])){_0x155e14[_0x8b923b[_0x5270c8[_0xa95d7b][_0xb056('0x69')]]]=_0x5270c8[_0xa95d7b][_0xb056('0x6e')];}}for(var _0x62da08 in _0x8b923b){if(!_0x155e14[_0xb056('0x59')](_0x8b923b[_0x62da08])){_0x155e14[_0x8b923b[_0x62da08]]=null;}}_0x545030[_0xb056('0x6f')](_0x155e14);}return _0x545030;}})[_0xb056('0x26')](function(_0x3837af){if(!_[_0xb056('0x70')](_0x3837af)){var _0x10e3b2=toCsv(_0x3837af);var _0x5431a1=Date[_0xb056('0x71')]();fs[_0xb056('0x72')](util['format'](_0xb056('0x73'),_0x10ffb8[_0xb056('0x47')]['id'],_0x5431a1),_0x10e3b2);_0x239950[_0xb056('0x74')](_0xb056('0x75'),_0xb056('0x76')+util[_0xb056('0x6b')](_0xb056('0x77'),_0x10ffb8[_0xb056('0x47')]['id'],_0x5431a1));_0x239950[_0xb056('0x74')](_0xb056('0x78'),_0xb056('0x79'));return _0x239950['download'](util['format'](_0xb056('0x73'),_0x10ffb8['params']['id'],_0x5431a1));}else{return _0x239950[_0xb056('0x1b')](0xcc);}})[_0xb056('0x45')](handleError(_0x239950,null));}; \ No newline at end of file +var _0x55e6=['json','apply','reject','save','update','destroy','get','Projects','UserProfileResource','then','sendStatus','stack','name','send','map','JscriptyProject','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','getSessions','JscriptySessionReport','rawAttributes','getAnswers','findOne','JscriptyAnswerReport','ProjectId','fromCharCode','indexOf','toString','getSummary','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x3eaf1d,_0x3c0d2a){var _0x35b471=function(_0x1d3e48){while(--_0x1d3e48){_0x3eaf1d['push'](_0x3eaf1d['shift']());}};_0x35b471(++_0x3c0d2a);}(_0x55e6,0xca));var _0x655e=function(_0x9dc3da,_0x428053){_0x9dc3da=_0x9dc3da-0x0;var _0x301d9e=_0x55e6[_0x9dc3da];return _0x301d9e;};'use strict';var emlformat=require(_0x655e('0x0'));var rimraf=require(_0x655e('0x1'));var zipdir=require(_0x655e('0x2'));var jsonpatch=require(_0x655e('0x3'));var rp=require(_0x655e('0x4'));var moment=require(_0x655e('0x5'));var BPromise=require(_0x655e('0x6'));var Mustache=require(_0x655e('0x7'));var util=require(_0x655e('0x8'));var path=require(_0x655e('0x9'));var sox=require(_0x655e('0xa'));var csv=require('to-csv');var ejs=require(_0x655e('0xb'));var fs=require('fs');var fs_extra=require(_0x655e('0xc'));var _=require('lodash');var squel=require(_0x655e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x655e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x655e('0xf'));var qs=require(_0x655e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x655e('0x11'))('api');var utils=require(_0x655e('0x12'));var config=require(_0x655e('0x13'));var licenseUtil=require(_0x655e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450974,_0x4b2504){_0x4b2504=_0x4b2504||0xcc;return function(_0x183137){if(_0x183137){return _0x450974['sendStatus'](_0x4b2504);}return _0x450974[_0x655e('0x15')](_0x4b2504)[_0x655e('0x16')]();};}function respondWithResult(_0x2df699,_0x3448da){_0x3448da=_0x3448da||0xc8;return function(_0x2cf396){if(_0x2cf396){return _0x2df699[_0x655e('0x15')](_0x3448da)['json'](_0x2cf396);}};}function respondWithFilteredResult(_0x452d91,_0x491c53){return function(_0x307f00){if(_0x307f00){var _0x5f40df=typeof _0x491c53[_0x655e('0x17')]===_0x655e('0x18')&&typeof _0x491c53[_0x655e('0x19')]===_0x655e('0x18');var _0x3e4a70=_0x307f00[_0x655e('0x1a')];var _0x2d0dbe=_0x5f40df?0x0:_0x491c53['offset'];var _0x4abb09=_0x5f40df?_0x307f00[_0x655e('0x1a')]:_0x491c53[_0x655e('0x17')]+_0x491c53[_0x655e('0x19')];var _0x4e6402;if(_0x4abb09>=_0x3e4a70){_0x4abb09=_0x3e4a70;_0x4e6402=0xc8;}else{_0x4e6402=0xce;}_0x452d91[_0x655e('0x15')](_0x4e6402);return _0x452d91['set'](_0x655e('0x1b'),_0x2d0dbe+'-'+_0x4abb09+'/'+_0x3e4a70)[_0x655e('0x1c')](_0x307f00);}return null;};}function patchUpdates(_0x4414f9){return function(_0x38e482){try{jsonpatch[_0x655e('0x1d')](_0x38e482,_0x4414f9,!![]);}catch(_0x420bc9){return BPromise[_0x655e('0x1e')](_0x420bc9);}return _0x38e482[_0x655e('0x1f')]();};}function saveUpdates(_0x29c65f,_0xf06dc9){return function(_0x882155){if(_0x882155){return _0x882155[_0x655e('0x20')](_0x29c65f)['then'](function(_0x5881bf){return _0x5881bf;});}return null;};}function removeEntity(_0x366dae,_0x5b59db){return function(_0x52a491){if(_0x52a491){return _0x52a491[_0x655e('0x21')]()['then'](function(){var _0x1fa1a1=_0x52a491[_0x655e('0x22')]({'plain':!![]});var _0x5441d7=_0x655e('0x23');return db[_0x655e('0x24')]['destroy']({'where':{'type':_0x5441d7,'resourceId':_0x1fa1a1['id']}})[_0x655e('0x25')](function(){return _0x52a491;});})[_0x655e('0x25')](function(){_0x366dae[_0x655e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39db40,_0x2e09ec){return function(_0x46f849){if(!_0x46f849){_0x39db40[_0x655e('0x26')](0x194);}return _0x46f849;};}function handleError(_0x1325c7,_0x46b56a){_0x46b56a=_0x46b56a||0x1f4;return function(_0x8c1de){logger['error'](_0x8c1de[_0x655e('0x27')]);if(_0x8c1de[_0x655e('0x28')]){delete _0x8c1de[_0x655e('0x28')];}_0x1325c7[_0x655e('0x15')](_0x46b56a)[_0x655e('0x29')](_0x8c1de);};}exports['index']=function(_0x5393ff,_0xd97eb9){var _0x2fe966={},_0xd7a8ee={},_0x307a91={'count':0x0,'rows':[]};var _0x45b326=_[_0x655e('0x2a')](db[_0x655e('0x2b')]['rawAttributes'],function(_0xfcd557){return{'name':_0xfcd557[_0x655e('0x2c')],'type':_0xfcd557[_0x655e('0x2d')][_0x655e('0x2e')]};});_0xd7a8ee[_0x655e('0x2f')]=_[_0x655e('0x2a')](_0x45b326,'name');_0xd7a8ee[_0x655e('0x30')]=_['keys'](_0x5393ff[_0x655e('0x30')]);_0xd7a8ee['filters']=_[_0x655e('0x31')](_0xd7a8ee[_0x655e('0x2f')],_0xd7a8ee[_0x655e('0x30')]);_0x2fe966[_0x655e('0x32')]=_[_0x655e('0x31')](_0xd7a8ee[_0x655e('0x2f')],qs[_0x655e('0x33')](_0x5393ff['query'][_0x655e('0x33')]));_0x2fe966['attributes']=_0x2fe966[_0x655e('0x32')]['length']?_0x2fe966['attributes']:_0xd7a8ee[_0x655e('0x2f')];if(!_0x5393ff[_0x655e('0x30')][_0x655e('0x34')](_0x655e('0x35'))){_0x2fe966['limit']=qs[_0x655e('0x19')](_0x5393ff[_0x655e('0x30')][_0x655e('0x19')]);_0x2fe966['offset']=qs[_0x655e('0x17')](_0x5393ff['query']['offset']);}_0x2fe966[_0x655e('0x36')]=qs[_0x655e('0x37')](_0x5393ff[_0x655e('0x30')][_0x655e('0x37')]);_0x2fe966[_0x655e('0x38')]=qs[_0x655e('0x39')](_[_0x655e('0x3a')](_0x5393ff[_0x655e('0x30')],_0xd7a8ee[_0x655e('0x39')]),_0x45b326);if(_0x5393ff['query'][_0x655e('0x3b')]){_0x2fe966[_0x655e('0x38')]=_[_0x655e('0x3c')](_0x2fe966['where'],{'$or':_[_0x655e('0x2a')](_0x45b326,function(_0x4e4116){if(_0x4e4116[_0x655e('0x2d')]!==_0x655e('0x3d')){var _0x3e2e23={};_0x3e2e23[_0x4e4116['name']]={'$like':'%'+_0x5393ff[_0x655e('0x30')][_0x655e('0x3b')]+'%'};return _0x3e2e23;}})});}_0x2fe966=_['merge']({},_0x2fe966,_0x5393ff[_0x655e('0x3e')]);var _0x325bd3={'where':_0x2fe966[_0x655e('0x38')]};return db['JscriptyProject'][_0x655e('0x1a')](_0x325bd3)[_0x655e('0x25')](function(_0x775afe){_0x307a91['count']=_0x775afe;if(_0x5393ff[_0x655e('0x30')][_0x655e('0x3f')]){_0x2fe966['include']=[{'all':!![]}];}return db[_0x655e('0x2b')][_0x655e('0x40')](_0x2fe966);})[_0x655e('0x25')](function(_0xe67f55){_0x307a91[_0x655e('0x41')]=_0xe67f55;return _0x307a91;})['then'](respondWithFilteredResult(_0xd97eb9,_0x2fe966))[_0x655e('0x42')](handleError(_0xd97eb9,null));};exports[_0x655e('0x43')]=function(_0x3ed865,_0x1329b8){var _0x25e60c={'raw':![],'where':{'id':_0x3ed865[_0x655e('0x44')]['id']}},_0x15d8c7={};_0x15d8c7['model']=_['keys'](db[_0x655e('0x2b')]['rawAttributes']);_0x15d8c7['query']=_[_0x655e('0x45')](_0x3ed865[_0x655e('0x30')]);_0x15d8c7[_0x655e('0x39')]=_[_0x655e('0x31')](_0x15d8c7[_0x655e('0x2f')],_0x15d8c7[_0x655e('0x30')]);_0x25e60c[_0x655e('0x32')]=_[_0x655e('0x31')](_0x15d8c7[_0x655e('0x2f')],qs['fields'](_0x3ed865['query'][_0x655e('0x33')]));_0x25e60c[_0x655e('0x32')]=_0x25e60c[_0x655e('0x32')][_0x655e('0x46')]?_0x25e60c[_0x655e('0x32')]:_0x15d8c7[_0x655e('0x2f')];if(_0x3ed865[_0x655e('0x30')]['includeAll']){_0x25e60c[_0x655e('0x47')]=[{'all':!![]}];}_0x25e60c=_[_0x655e('0x3c')]({},_0x25e60c,_0x3ed865[_0x655e('0x3e')]);return db[_0x655e('0x2b')]['find'](_0x25e60c)[_0x655e('0x25')](handleEntityNotFound(_0x1329b8,null))[_0x655e('0x25')](respondWithResult(_0x1329b8,null))[_0x655e('0x42')](handleError(_0x1329b8,null));};exports[_0x655e('0x48')]=function(_0x38f0f0,_0x38a624){return db['JscriptyProject'][_0x655e('0x48')](_0x38f0f0[_0x655e('0x49')],{})[_0x655e('0x25')](function(_0x56fb0f){var _0x316227=_0x38f0f0['user'][_0x655e('0x22')]({'plain':!![]});if(!_0x316227)throw new Error(_0x655e('0x4a'));if(_0x316227['role']===_0x655e('0x4b')){var _0x26248a=_0x56fb0f[_0x655e('0x22')]({'plain':!![]});var _0x57a3c7=_0x655e('0x23');return db[_0x655e('0x4c')][_0x655e('0x4d')]({'where':{'name':_0x57a3c7,'userProfileId':_0x316227[_0x655e('0x4e')]},'raw':!![]})[_0x655e('0x25')](function(_0x2afbcf){if(_0x2afbcf&&_0x2afbcf['autoAssociation']===0x0){return db['UserProfileResource'][_0x655e('0x48')]({'name':_0x26248a[_0x655e('0x28')],'resourceId':_0x26248a['id'],'type':_0x2afbcf[_0x655e('0x28')],'sectionId':_0x2afbcf['id']},{})[_0x655e('0x25')](function(){return _0x56fb0f;});}else{return _0x56fb0f;}})[_0x655e('0x42')](function(_0x51b14c){logger['error'](_0x655e('0x4f'),_0x51b14c);throw _0x51b14c;});}return _0x56fb0f;})[_0x655e('0x25')](respondWithResult(_0x38a624,0xc9))[_0x655e('0x42')](handleError(_0x38a624,null));};exports[_0x655e('0x50')]=function(_0x416be5,_0x527e13){var _0xc56414={'where':{'id':_0x416be5[_0x655e('0x44')]['id']}},_0x20ee71={};_0x20ee71[_0x655e('0x2f')]=_[_0x655e('0x45')](db['JscriptyProject']['rawAttributes']);_0xc56414[_0x655e('0x32')]=_[_0x655e('0x31')](_0x20ee71[_0x655e('0x2f')],qs[_0x655e('0x33')](_0x416be5['query'][_0x655e('0x33')]));_0xc56414[_0x655e('0x32')]=_0xc56414[_0x655e('0x32')][_0x655e('0x46')]?_0xc56414[_0x655e('0x32')]:_0x20ee71[_0x655e('0x2f')];if(_0x416be5[_0x655e('0x30')][_0x655e('0x3f')]){_0xc56414['include']=[{'all':!![]}];}_0xc56414=_[_0x655e('0x3c')]({},_0xc56414,_0x416be5[_0x655e('0x3e')]);return db[_0x655e('0x2b')]['find'](_0xc56414)['then'](handleEntityNotFound(_0x527e13,null))[_0x655e('0x25')](function(_0x34dd11){if(_0x34dd11){var _0x5c65f1=_0x34dd11['get']({'plain':!![]});_0x5c65f1=qs[_0x655e('0x51')](_0x5c65f1,['id',_0x655e('0x52'),_0x655e('0x53')]);_0x416be5[_0x655e('0x49')]=_['omit'](_0x416be5[_0x655e('0x49')],['id',_0x655e('0x52'),_0x655e('0x53')]);return db['JscriptyProject'][_0x655e('0x48')](_[_0x655e('0x3c')](_0x5c65f1,_0x416be5[_0x655e('0x49')]),{'include':_0x416be5[_0x655e('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x655e('0x25')](function(_0x9af34d){var _0x90c919=_0x416be5['user'][_0x655e('0x22')]({'plain':!![]});if(!_0x90c919)throw new Error(_0x655e('0x4a'));if(_0x90c919['role']===_0x655e('0x4b')){var _0x194def=_0x9af34d[_0x655e('0x22')]({'plain':!![]});var _0x3bc3f5='Projects';return db[_0x655e('0x4c')][_0x655e('0x4d')]({'where':{'name':_0x3bc3f5,'userProfileId':_0x90c919[_0x655e('0x4e')]},'raw':!![]})[_0x655e('0x25')](function(_0x32ac8c){if(_0x32ac8c&&_0x32ac8c[_0x655e('0x54')]===0x0){return db[_0x655e('0x24')][_0x655e('0x48')]({'name':_0x194def['name'],'resourceId':_0x194def['id'],'type':_0x32ac8c[_0x655e('0x28')],'sectionId':_0x32ac8c['id']},{})[_0x655e('0x25')](function(){return _0x9af34d;});}else{return _0x9af34d;}})[_0x655e('0x42')](function(_0x4a2464){logger['error'](_0x655e('0x4f'),_0x4a2464);throw _0x4a2464;});}return _0x9af34d;});}})['then'](respondWithResult(_0x527e13,0xc9))[_0x655e('0x42')](handleError(_0x527e13,null));};exports[_0x655e('0x20')]=function(_0x50e2c3,_0x57f884){if(_0x50e2c3[_0x655e('0x49')]['id']){delete _0x50e2c3[_0x655e('0x49')]['id'];}return db[_0x655e('0x2b')][_0x655e('0x4d')]({'where':{'id':_0x50e2c3[_0x655e('0x44')]['id']}})[_0x655e('0x25')](handleEntityNotFound(_0x57f884,null))['then'](saveUpdates(_0x50e2c3['body'],null))['then'](respondWithResult(_0x57f884,null))['catch'](handleError(_0x57f884,null));};exports['destroy']=function(_0x403b42,_0x1b482a){return db[_0x655e('0x2b')][_0x655e('0x4d')]({'where':{'id':_0x403b42['params']['id']}})[_0x655e('0x25')](handleEntityNotFound(_0x1b482a,null))['then'](removeEntity(_0x1b482a,null))[_0x655e('0x42')](handleError(_0x1b482a,null));};exports[_0x655e('0x55')]=function(_0x2770f0,_0x14ad78,_0x52202c){var _0x1d8fef={'raw':!![],'where':{}};var _0x40ac34={};var _0x162820={'count':0x0,'rows':[]};return db[_0x655e('0x2b')]['findOne']({'where':{'id':_0x2770f0[_0x655e('0x44')]['id']}})[_0x655e('0x25')](handleEntityNotFound(_0x14ad78,null))[_0x655e('0x25')](function(_0x1bc7eb){if(_0x1bc7eb){_0x40ac34[_0x655e('0x2f')]=_[_0x655e('0x45')](db[_0x655e('0x56')][_0x655e('0x57')]);_0x40ac34[_0x655e('0x30')]=_[_0x655e('0x45')](_0x2770f0['query']);_0x40ac34[_0x655e('0x39')]=_[_0x655e('0x31')](_0x40ac34[_0x655e('0x2f')],_0x40ac34[_0x655e('0x30')]);_0x1d8fef[_0x655e('0x32')]=_['intersection'](_0x40ac34['model'],qs[_0x655e('0x33')](_0x2770f0[_0x655e('0x30')][_0x655e('0x33')]));_0x1d8fef[_0x655e('0x32')]=_0x1d8fef[_0x655e('0x32')][_0x655e('0x46')]?_0x1d8fef[_0x655e('0x32')]:_0x40ac34[_0x655e('0x2f')];if(!_0x2770f0[_0x655e('0x30')][_0x655e('0x34')]('nolimit')){_0x1d8fef[_0x655e('0x19')]=qs[_0x655e('0x19')](_0x2770f0[_0x655e('0x30')][_0x655e('0x19')]);_0x1d8fef['offset']=qs[_0x655e('0x17')](_0x2770f0[_0x655e('0x30')]['offset']);}_0x1d8fef['order']=qs[_0x655e('0x37')](_0x2770f0['query'][_0x655e('0x37')]);_0x1d8fef[_0x655e('0x38')]=qs[_0x655e('0x39')](_[_0x655e('0x3a')](_0x2770f0['query'],_0x40ac34['filters']));_0x1d8fef[_0x655e('0x38')]['ProjectId']=_0x1bc7eb['id'];if(_0x2770f0[_0x655e('0x30')][_0x655e('0x3b')]){_0x1d8fef['where']=_[_0x655e('0x3c')](_0x1d8fef[_0x655e('0x38')],{'$or':_['map'](_0x1d8fef[_0x655e('0x32')],function(_0x20c8bc){var _0x397455={};_0x397455[_0x20c8bc]={'$like':'%'+_0x2770f0['query'][_0x655e('0x3b')]+'%'};return _0x397455;})});}_0x1d8fef=_[_0x655e('0x3c')]({},_0x1d8fef,_0x2770f0[_0x655e('0x3e')]);return db[_0x655e('0x56')]['count']({'where':_0x1d8fef['where']})[_0x655e('0x25')](function(_0x50a420){_0x162820[_0x655e('0x1a')]=_0x50a420;if(_0x2770f0[_0x655e('0x30')][_0x655e('0x3f')]){_0x1d8fef[_0x655e('0x47')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1d8fef);})['then'](function(_0x50732a){_0x162820[_0x655e('0x41')]=_0x50732a;return _0x162820;});}})[_0x655e('0x25')](respondWithFilteredResult(_0x14ad78,_0x1d8fef))[_0x655e('0x42')](handleError(_0x14ad78,null));};exports[_0x655e('0x58')]=function(_0x27434c,_0xd6b259,_0x44cc1c){var _0x4e4cfb={'raw':!![],'where':{}};var _0x1d4909={};var _0x475939={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x655e('0x59')]({'where':{'id':_0x27434c[_0x655e('0x44')]['id']}})['then'](handleEntityNotFound(_0xd6b259,null))[_0x655e('0x25')](function(_0x3ebe09){if(_0x3ebe09){_0x1d4909[_0x655e('0x2f')]=_[_0x655e('0x45')](db[_0x655e('0x5a')]['rawAttributes']);_0x1d4909[_0x655e('0x30')]=_['keys'](_0x27434c[_0x655e('0x30')]);_0x1d4909[_0x655e('0x39')]=_[_0x655e('0x31')](_0x1d4909[_0x655e('0x2f')],_0x1d4909[_0x655e('0x30')]);_0x4e4cfb[_0x655e('0x32')]=_[_0x655e('0x31')](_0x1d4909[_0x655e('0x2f')],qs[_0x655e('0x33')](_0x27434c[_0x655e('0x30')][_0x655e('0x33')]));_0x4e4cfb[_0x655e('0x32')]=_0x4e4cfb[_0x655e('0x32')]['length']?_0x4e4cfb[_0x655e('0x32')]:_0x1d4909['model'];if(!_0x27434c['query'][_0x655e('0x34')]('nolimit')){_0x4e4cfb[_0x655e('0x19')]=qs['limit'](_0x27434c[_0x655e('0x30')][_0x655e('0x19')]);_0x4e4cfb[_0x655e('0x17')]=qs[_0x655e('0x17')](_0x27434c[_0x655e('0x30')]['offset']);}_0x4e4cfb[_0x655e('0x36')]=qs['sort'](_0x27434c[_0x655e('0x30')]['sort']);_0x4e4cfb[_0x655e('0x38')]=qs[_0x655e('0x39')](_[_0x655e('0x3a')](_0x27434c[_0x655e('0x30')],_0x1d4909['filters']));_0x4e4cfb[_0x655e('0x38')][_0x655e('0x5b')]=_0x3ebe09['id'];if(_0x27434c['query']['filter']){_0x4e4cfb[_0x655e('0x38')]=_['merge'](_0x4e4cfb[_0x655e('0x38')],{'$or':_[_0x655e('0x2a')](_0x4e4cfb[_0x655e('0x32')],function(_0x272803){var _0x68ef23={};_0x68ef23[_0x272803]={'$like':'%'+_0x27434c[_0x655e('0x30')]['filter']+'%'};return _0x68ef23;})});}_0x4e4cfb=_[_0x655e('0x3c')]({},_0x4e4cfb,_0x27434c[_0x655e('0x3e')]);return db['JscriptyAnswerReport']['count']({'where':_0x4e4cfb['where']})[_0x655e('0x25')](function(_0x58b45c){_0x475939[_0x655e('0x1a')]=_0x58b45c;if(_0x27434c[_0x655e('0x30')][_0x655e('0x3f')]){_0x4e4cfb[_0x655e('0x47')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x655e('0x40')](_0x4e4cfb);})[_0x655e('0x25')](function(_0xa1e06b){_0x475939['rows']=_0xa1e06b;return _0x475939;});}})['then'](respondWithFilteredResult(_0xd6b259,_0x4e4cfb))[_0x655e('0x42')](handleError(_0xd6b259,null));};function char(_0x38e571){return'number'===typeof _0x38e571?String[_0x655e('0x5c')]['apply'](null,arguments):_0x38e571;}function needsEncapsulation(_0x51394b){return!!_0x51394b&&(_0x51394b['toString']()[_0x655e('0x5d')](char(0xd))>=0x0||_0x51394b[_0x655e('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x51394b[_0x655e('0x5e')]()['indexOf'](char(0x2c))>=0x0||_0x51394b[_0x655e('0x5e')]()[_0x655e('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x524986){var _0x9abc11=char(0x22),_0x33ccc3='\x5c'+char(0x22),_0x1ad822=_0x524986[_0x655e('0x5e')]()['replace'](new RegExp(_0x9abc11,'g'),_0x33ccc3);return _0x9abc11+_0x1ad822+_0x9abc11;}exports[_0x655e('0x5f')]=function(_0x4e0528,_0x5969fa,_0x274a96){var _0x5ec7ff,_0x59e669;var _0x3deefe={'where':{'ProjectId':_0x4e0528[_0x655e('0x44')]['id']}};if(_0x4e0528[_0x655e('0x30')]['startTime']){_0x3deefe[_0x655e('0x38')][_0x655e('0x60')]=JSON['parse'](_0x4e0528[_0x655e('0x30')][_0x655e('0x61')]);}return db[_0x655e('0x56')][_0x655e('0x40')](_0x3deefe)[_0x655e('0x25')](handleEntityNotFound(_0x5969fa,null))[_0x655e('0x25')](function(_0x5f0284){if(_0x5f0284){_0x5ec7ff=_0x5f0284;return db[_0x655e('0x62')]['findAll']({'where':{'SessionId':{'$in':_[_0x655e('0x2a')](_0x5ec7ff,'id')},'ProjectId':_0x4e0528[_0x655e('0x44')]['id']},'order':_0x655e('0x63')});}})[_0x655e('0x25')](handleEntityNotFound(_0x5969fa,null))[_0x655e('0x25')](function(_0xdb2b62){if(_0xdb2b62){_0x59e669=_0xdb2b62;var _0x524e0f={};for(var _0x5ed01b=0x0,_0x607aaf=_0x59e669['length'];_0x5ed01b<_0x607aaf;_0x5ed01b++){if(!_0x524e0f['hasOwnProperty'](_0x59e669[_0x5ed01b][_0x655e('0x64')])){_0x524e0f[_0x59e669[_0x5ed01b][_0x655e('0x64')]]=needsEncapsulation(_0x59e669[_0x5ed01b][_0x655e('0x65')])?encapsulate(_0x59e669[_0x5ed01b][_0x655e('0x65')]):_0x59e669[_0x5ed01b]['question'];}}var _0x5c2b66=[],_0x32b08b={};for(var _0x8a546d=0x0,_0x449b63=_0x5ec7ff['length'];_0x8a546d<_0x449b63;_0x8a546d++){_0x32b08b={'ProjectId':_0x4e0528['params']['id'],'SessionId':_0x5ec7ff[_0x8a546d]['id'],'StartTime':moment(_0x5ec7ff[_0x8a546d][_0x655e('0x60')])[_0x655e('0x66')](_0x655e('0x67'))};for(var _0x1b4ea2=0x0,_0x12f689=_0x59e669['length'];_0x1b4ea2<_0x12f689;_0x1b4ea2++){if(_0x59e669[_0x1b4ea2]['SessionId']==_0x5ec7ff[_0x8a546d]['id']&&_0x524e0f[_0x655e('0x34')](_0x59e669[_0x1b4ea2]['questionId'])){_0x32b08b[_0x524e0f[_0x59e669[_0x1b4ea2][_0x655e('0x64')]]]=_0x59e669[_0x1b4ea2]['answer'];}}for(var _0x4b73e0 in _0x524e0f){if(!_0x32b08b[_0x655e('0x34')](_0x524e0f[_0x4b73e0])){_0x32b08b[_0x524e0f[_0x4b73e0]]=null;}}_0x5c2b66[_0x655e('0x68')](_0x32b08b);}return _0x5c2b66;}})[_0x655e('0x25')](function(_0x2259fc){if(!_[_0x655e('0x69')](_0x2259fc)){var _0x409e0f=toCsv(_0x2259fc);var _0x30f4e7=Date[_0x655e('0x6a')]();fs[_0x655e('0x6b')](util[_0x655e('0x66')](_0x655e('0x6c'),_0x4e0528['params']['id'],_0x30f4e7),_0x409e0f);_0x5969fa[_0x655e('0x6d')]('Content-disposition',_0x655e('0x6e')+util[_0x655e('0x66')](_0x655e('0x6f'),_0x4e0528['params']['id'],_0x30f4e7));_0x5969fa[_0x655e('0x6d')](_0x655e('0x70'),_0x655e('0x71'));return _0x5969fa[_0x655e('0x72')](util['format'](_0x655e('0x6c'),_0x4e0528['params']['id'],_0x30f4e7));}else{return _0x5969fa['sendStatus'](0xcc);}})[_0x655e('0x42')](handleError(_0x5969fa,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 11847e4..797c92c 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 _0x21d1=['JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x2b78de,_0x547dd0){var _0x29f987=function(_0x423471){while(--_0x423471){_0x2b78de['push'](_0x2b78de['shift']());}};_0x29f987(++_0x547dd0);}(_0x21d1,0x1c9));var _0x121d=function(_0x3c07a4,_0x429ba8){_0x3c07a4=_0x3c07a4-0x0;var _0x4c1b41=_0x21d1[_0x3c07a4];return _0x4c1b41;};'use strict';var _=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var logger=require(_0x121d('0x2'))(_0x121d('0x3'));var moment=require(_0x121d('0x4'));var BPromise=require(_0x121d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x121d('0x6'));var config=require(_0x121d('0x7'));var attributes=require(_0x121d('0x8'));module[_0x121d('0x9')]=function(_0x2f3987,_0x4c47ee){return _0x2f3987[_0x121d('0xa')](_0x121d('0xb'),attributes,{'tableName':_0x121d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9b0=['../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util'];(function(_0x499950,_0x232f39){var _0x308b5f=function(_0x43f4e6){while(--_0x43f4e6){_0x499950['push'](_0x499950['shift']());}};_0x308b5f(++_0x232f39);}(_0xc9b0,0x143));var _0x0c9b=function(_0x228f09,_0x34843c){_0x228f09=_0x228f09-0x0;var _0x27499e=_0xc9b0[_0x228f09];return _0x27499e;};'use strict';var _=require(_0x0c9b('0x0'));var util=require(_0x0c9b('0x1'));var logger=require(_0x0c9b('0x2'))(_0x0c9b('0x3'));var moment=require(_0x0c9b('0x4'));var BPromise=require(_0x0c9b('0x5'));var rp=require(_0x0c9b('0x6'));var fs=require('fs');var path=require(_0x0c9b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0c9b('0x8'));module[_0x0c9b('0x9')]=function(_0x192da5,_0x368518){return _0x192da5[_0x0c9b('0xa')](_0x0c9b('0xb'),attributes,{'tableName':_0x0c9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 151fc3f..8216b35 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xdb50e1,_0x112a80){var _0x2a50fc=function(_0xd47d89){while(--_0xd47d89){_0xdb50e1['push'](_0xdb50e1['shift']());}};_0x2a50fc(++_0x112a80);}(_0xf4eb,0xec));var _0xbf4e=function(_0x385ee5,_0x341dcf){_0x385ee5=_0x385ee5-0x0;var _0x630f23=_0xf4eb[_0x385ee5];return _0x630f23;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1c69d9,_0x459cbf){var _0x1e2b8f=function(_0x14ec90){while(--_0x14ec90){_0x1c69d9['push'](_0x1c69d9['shift']());}};_0x1e2b8f(++_0x459cbf);}(_0x70e0,0x17b));var _0x070e=function(_0x2fff23,_0x4e97f9){_0x2fff23=_0x2fff23-0x0;var _0x42d24e=_0x70e0[_0x2fff23];return _0x42d24e;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 50dcfd3..3a30fdb 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 _0xd1aa=['/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get','describe'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xd1aa,0x66));var _0xad1a=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xd1aa[_0x119280];return _0x481797;};'use strict';var multer=require(_0xad1a('0x0'));var util=require('util');var path=require(_0xad1a('0x1'));var timeout=require(_0xad1a('0x2'));var express=require(_0xad1a('0x3'));var router=express[_0xad1a('0x4')]();var fs_extra=require(_0xad1a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xad1a('0x6'));var config=require('../../config/environment');var controller=require(_0xad1a('0x7'));router['get']('/',auth[_0xad1a('0x8')](),controller[_0xad1a('0x9')]);router[_0xad1a('0xa')]('/describe',auth[_0xad1a('0x8')](),controller[_0xad1a('0xb')]);router[_0xad1a('0xa')](_0xad1a('0xc'),auth['isAuthenticated'](),controller[_0xad1a('0xd')]);router[_0xad1a('0xe')]('/',auth[_0xad1a('0x8')](),controller['create']);router['put'](_0xad1a('0xc'),auth[_0xad1a('0x8')](),controller[_0xad1a('0xf')]);router[_0xad1a('0x10')]('/:id',auth[_0xad1a('0x8')](),controller[_0xad1a('0x11')]);module[_0xad1a('0x12')]=router; \ No newline at end of file +var _0x5d7b=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','create','put','destroy','exports','multer','path','connect-timeout'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x5d7b,0x173));var _0xb5d7=function(_0x53c493,_0x425909){_0x53c493=_0x53c493-0x0;var _0x1478ab=_0x5d7b[_0x53c493];return _0x1478ab;};'use strict';var multer=require(_0xb5d7('0x0'));var util=require('util');var path=require(_0xb5d7('0x1'));var timeout=require(_0xb5d7('0x2'));var express=require(_0xb5d7('0x3'));var router=express[_0xb5d7('0x4')]();var fs_extra=require(_0xb5d7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb5d7('0x6'));var config=require(_0xb5d7('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0xb5d7('0x8')]('/',auth[_0xb5d7('0x9')](),controller['index']);router[_0xb5d7('0x8')]('/describe',auth[_0xb5d7('0x9')](),controller[_0xb5d7('0xa')]);router[_0xb5d7('0x8')](_0xb5d7('0xb'),auth[_0xb5d7('0x9')](),controller[_0xb5d7('0xc')]);router['post']('/',auth[_0xb5d7('0x9')](),controller[_0xb5d7('0xd')]);router[_0xb5d7('0xe')](_0xb5d7('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb5d7('0xb'),auth['isAuthenticated'](),controller[_0xb5d7('0xf')]);module[_0xb5d7('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 7bb7bfa..acac695 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x188ebc,_0x7f6ebd){_0x188ebc=_0x188ebc-0x0;var _0x307135=_0x7a54[_0x188ebc];return _0x307135;};'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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x775d0b,_0x51843c){_0x775d0b=_0x775d0b-0x0;var _0x3b2c45=_0x7a54[_0x775d0b];return _0x3b2c45;};'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 874981e..320efc6 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 _0x66dd=['length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','update','then','error','stack','name','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','attributes','fields'];(function(_0x589589,_0x484d80){var _0x1ae411=function(_0x193408){while(--_0x193408){_0x589589['push'](_0x589589['shift']());}};_0x1ae411(++_0x484d80);}(_0x66dd,0x129));var _0xd66d=function(_0x106bf9,_0x4a6b46){_0x106bf9=_0x106bf9-0x0;var _0x342031=_0x66dd[_0x106bf9];return _0x342031;};'use strict';var emlformat=require(_0xd66d('0x0'));var rimraf=require(_0xd66d('0x1'));var zipdir=require(_0xd66d('0x2'));var jsonpatch=require(_0xd66d('0x3'));var rp=require(_0xd66d('0x4'));var moment=require(_0xd66d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd66d('0x6'));var sox=require(_0xd66d('0x7'));var csv=require(_0xd66d('0x8'));var ejs=require(_0xd66d('0x9'));var fs=require('fs');var fs_extra=require(_0xd66d('0xa'));var _=require('lodash');var squel=require(_0xd66d('0xb'));var crypto=require(_0xd66d('0xc'));var jsforce=require(_0xd66d('0xd'));var deskjs=require(_0xd66d('0xe'));var toCsv=require(_0xd66d('0x8'));var querystring=require(_0xd66d('0xf'));var Papa=require('papaparse');var Redis=require(_0xd66d('0x10'));var authService=require(_0xd66d('0x11'));var qs=require(_0xd66d('0x12'));var as=require(_0xd66d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd66d('0x14'));var utils=require('../../config/utils');var config=require(_0xd66d('0x15'));var licenseUtil=require(_0xd66d('0x16'));var db=require(_0xd66d('0x17'))['db'];function respondWithStatusCode(_0x3292b4,_0x105072){_0x105072=_0x105072||0xcc;return function(_0x4d713b){if(_0x4d713b){return _0x3292b4['sendStatus'](_0x105072);}return _0x3292b4[_0xd66d('0x18')](_0x105072)[_0xd66d('0x19')]();};}function respondWithResult(_0xf50480,_0x5e25b5){_0x5e25b5=_0x5e25b5||0xc8;return function(_0x47a56a){if(_0x47a56a){return _0xf50480['status'](_0x5e25b5)[_0xd66d('0x1a')](_0x47a56a);}};}function respondWithFilteredResult(_0x156c10,_0xd204cf){return function(_0x53547){if(_0x53547){var _0x53ef65=typeof _0xd204cf[_0xd66d('0x1b')]===_0xd66d('0x1c')&&typeof _0xd204cf['limit']===_0xd66d('0x1c');var _0x3555ed=_0x53547[_0xd66d('0x1d')];var _0x572863=_0x53ef65?0x0:_0xd204cf[_0xd66d('0x1b')];var _0x2e976b=_0x53ef65?_0x53547[_0xd66d('0x1d')]:_0xd204cf['offset']+_0xd204cf['limit'];var _0x3b78d0;if(_0x2e976b>=_0x3555ed){_0x2e976b=_0x3555ed;_0x3b78d0=0xc8;}else{_0x3b78d0=0xce;}_0x156c10[_0xd66d('0x18')](_0x3b78d0);return _0x156c10[_0xd66d('0x1e')](_0xd66d('0x1f'),_0x572863+'-'+_0x2e976b+'/'+_0x3555ed)[_0xd66d('0x1a')](_0x53547);}return null;};}function patchUpdates(_0x4a6b83){return function(_0x18839d){try{jsonpatch['apply'](_0x18839d,_0x4a6b83,!![]);}catch(_0x36c8bf){return BPromise['reject'](_0x36c8bf);}return _0x18839d['save']();};}function saveUpdates(_0x381d92,_0x5a8cd1){return function(_0x52e0f0){if(_0x52e0f0){return _0x52e0f0[_0xd66d('0x20')](_0x381d92)[_0xd66d('0x21')](function(_0x212772){return _0x212772;});}return null;};}function removeEntity(_0x4d8340,_0x33fdda){return function(_0x2ebc4a){if(_0x2ebc4a){return _0x2ebc4a['destroy']()[_0xd66d('0x21')](function(){_0x4d8340[_0xd66d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28f01f,_0x1c6fb0){return function(_0x2c12e8){if(!_0x2c12e8){_0x28f01f['sendStatus'](0x194);}return _0x2c12e8;};}function handleError(_0x152010,_0x2d90b8){_0x2d90b8=_0x2d90b8||0x1f4;return function(_0x3c2828){logger[_0xd66d('0x22')](_0x3c2828[_0xd66d('0x23')]);if(_0x3c2828[_0xd66d('0x24')]){delete _0x3c2828['name'];}_0x152010[_0xd66d('0x18')](_0x2d90b8)['send'](_0x3c2828);};}exports['index']=function(_0x1f3ab7,_0x40d57c){var _0x32341b={},_0xec0625={},_0xb0f11a={'count':0x0,'rows':[]};var _0x4e9da5=_[_0xd66d('0x25')](db[_0xd66d('0x26')]['rawAttributes'],function(_0x33d112){return{'name':_0x33d112[_0xd66d('0x27')],'type':_0x33d112[_0xd66d('0x28')][_0xd66d('0x29')]};});_0xec0625[_0xd66d('0x2a')]=_['map'](_0x4e9da5,'name');_0xec0625[_0xd66d('0x2b')]=_[_0xd66d('0x2c')](_0x1f3ab7[_0xd66d('0x2b')]);_0xec0625[_0xd66d('0x2d')]=_['intersection'](_0xec0625[_0xd66d('0x2a')],_0xec0625[_0xd66d('0x2b')]);_0x32341b[_0xd66d('0x2e')]=_['intersection'](_0xec0625[_0xd66d('0x2a')],qs[_0xd66d('0x2f')](_0x1f3ab7[_0xd66d('0x2b')][_0xd66d('0x2f')]));_0x32341b[_0xd66d('0x2e')]=_0x32341b['attributes'][_0xd66d('0x30')]?_0x32341b[_0xd66d('0x2e')]:_0xec0625[_0xd66d('0x2a')];if(!_0x1f3ab7[_0xd66d('0x2b')][_0xd66d('0x31')]('nolimit')){_0x32341b[_0xd66d('0x32')]=qs[_0xd66d('0x32')](_0x1f3ab7[_0xd66d('0x2b')]['limit']);_0x32341b[_0xd66d('0x1b')]=qs['offset'](_0x1f3ab7[_0xd66d('0x2b')][_0xd66d('0x1b')]);}_0x32341b[_0xd66d('0x33')]=qs[_0xd66d('0x34')](_0x1f3ab7[_0xd66d('0x2b')][_0xd66d('0x34')]);_0x32341b[_0xd66d('0x35')]=qs['filters'](_['pick'](_0x1f3ab7['query'],_0xec0625['filters']),_0x4e9da5);if(_0x1f3ab7[_0xd66d('0x2b')][_0xd66d('0x36')]){_0x32341b[_0xd66d('0x35')]=_[_0xd66d('0x37')](_0x32341b[_0xd66d('0x35')],{'$or':_[_0xd66d('0x25')](_0x4e9da5,function(_0x589ea8){if(_0x589ea8[_0xd66d('0x28')]!==_0xd66d('0x38')){var _0x48016a={};_0x48016a[_0x589ea8[_0xd66d('0x24')]]={'$like':'%'+_0x1f3ab7[_0xd66d('0x2b')]['filter']+'%'};return _0x48016a;}})});}_0x32341b=_['merge']({},_0x32341b,_0x1f3ab7[_0xd66d('0x39')]);var _0xff9740={'where':_0x32341b[_0xd66d('0x35')]};return db['JscriptyQuestionReport'][_0xd66d('0x1d')](_0xff9740)[_0xd66d('0x21')](function(_0x135d75){_0xb0f11a[_0xd66d('0x1d')]=_0x135d75;if(_0x1f3ab7[_0xd66d('0x2b')][_0xd66d('0x3a')]){_0x32341b[_0xd66d('0x3b')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x32341b);})[_0xd66d('0x21')](function(_0x4db80b){_0xb0f11a['rows']=_0x4db80b;return _0xb0f11a;})[_0xd66d('0x21')](respondWithFilteredResult(_0x40d57c,_0x32341b))[_0xd66d('0x3c')](handleError(_0x40d57c,null));};exports[_0xd66d('0x3d')]=function(_0x4e72fb,_0x3f82cb){var _0xb25bbd={'raw':!![],'where':{'id':_0x4e72fb[_0xd66d('0x3e')]['id']}},_0x322ac8={};_0x322ac8[_0xd66d('0x2a')]=_[_0xd66d('0x2c')](db[_0xd66d('0x26')][_0xd66d('0x3f')]);_0x322ac8[_0xd66d('0x2b')]=_['keys'](_0x4e72fb[_0xd66d('0x2b')]);_0x322ac8[_0xd66d('0x2d')]=_[_0xd66d('0x40')](_0x322ac8[_0xd66d('0x2a')],_0x322ac8['query']);_0xb25bbd[_0xd66d('0x2e')]=_['intersection'](_0x322ac8['model'],qs[_0xd66d('0x2f')](_0x4e72fb[_0xd66d('0x2b')][_0xd66d('0x2f')]));_0xb25bbd['attributes']=_0xb25bbd['attributes'][_0xd66d('0x30')]?_0xb25bbd[_0xd66d('0x2e')]:_0x322ac8[_0xd66d('0x2a')];if(_0x4e72fb[_0xd66d('0x2b')]['includeAll']){_0xb25bbd[_0xd66d('0x3b')]=[{'all':!![]}];}_0xb25bbd=_['merge']({},_0xb25bbd,_0x4e72fb[_0xd66d('0x39')]);return db[_0xd66d('0x26')][_0xd66d('0x41')](_0xb25bbd)['then'](handleEntityNotFound(_0x3f82cb,null))[_0xd66d('0x21')](respondWithResult(_0x3f82cb,null))[_0xd66d('0x3c')](handleError(_0x3f82cb,null));};exports['create']=function(_0xa38c13,_0x5d2cfc){return db[_0xd66d('0x26')][_0xd66d('0x42')](_0xa38c13[_0xd66d('0x43')],{})[_0xd66d('0x21')](respondWithResult(_0x5d2cfc,0xc9))[_0xd66d('0x3c')](handleError(_0x5d2cfc,null));};exports[_0xd66d('0x20')]=function(_0xeff7f,_0x44769f){if(_0xeff7f['body']['id']){delete _0xeff7f[_0xd66d('0x43')]['id'];}return db[_0xd66d('0x26')][_0xd66d('0x41')]({'where':{'id':_0xeff7f[_0xd66d('0x3e')]['id']}})[_0xd66d('0x21')](handleEntityNotFound(_0x44769f,null))[_0xd66d('0x21')](saveUpdates(_0xeff7f[_0xd66d('0x43')],null))[_0xd66d('0x21')](respondWithResult(_0x44769f,null))[_0xd66d('0x3c')](handleError(_0x44769f,null));};exports['destroy']=function(_0x27a956,_0x41b237){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x27a956['params']['id']}})['then'](handleEntityNotFound(_0x41b237,null))['then'](removeEntity(_0x41b237,null))[_0xd66d('0x3c')](handleError(_0x41b237,null));};exports[_0xd66d('0x44')]=function(_0x3ef66d,_0x1b1286){return db[_0xd66d('0x26')][_0xd66d('0x44')]()[_0xd66d('0x21')](respondWithResult(_0x1b1286,null))[_0xd66d('0x3c')](handleError(_0x1b1286,null));}; \ No newline at end of file +var _0x3f54=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','JscriptyQuestionReport','length','find','create','body'];(function(_0x3fc699,_0x505f09){var _0x58379a=function(_0x49448f){while(--_0x49448f){_0x3fc699['push'](_0x3fc699['shift']());}};_0x58379a(++_0x505f09);}(_0x3f54,0x139));var _0x43f5=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x3f54[_0x21d0c3];return _0x4df18e;};'use strict';var emlformat=require(_0x43f5('0x0'));var rimraf=require(_0x43f5('0x1'));var zipdir=require(_0x43f5('0x2'));var jsonpatch=require(_0x43f5('0x3'));var rp=require(_0x43f5('0x4'));var moment=require('moment');var BPromise=require(_0x43f5('0x5'));var Mustache=require(_0x43f5('0x6'));var util=require(_0x43f5('0x7'));var path=require(_0x43f5('0x8'));var sox=require(_0x43f5('0x9'));var csv=require(_0x43f5('0xa'));var ejs=require(_0x43f5('0xb'));var fs=require('fs');var fs_extra=require(_0x43f5('0xc'));var _=require(_0x43f5('0xd'));var squel=require(_0x43f5('0xe'));var crypto=require(_0x43f5('0xf'));var jsforce=require(_0x43f5('0x10'));var deskjs=require(_0x43f5('0x11'));var toCsv=require(_0x43f5('0xa'));var querystring=require(_0x43f5('0x12'));var Papa=require(_0x43f5('0x13'));var Redis=require(_0x43f5('0x14'));var authService=require(_0x43f5('0x15'));var qs=require(_0x43f5('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43f5('0x17'));var logger=require(_0x43f5('0x18'))(_0x43f5('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x43f5('0x1a'));var db=require(_0x43f5('0x1b'))['db'];function respondWithStatusCode(_0x46e12e,_0x36658a){_0x36658a=_0x36658a||0xcc;return function(_0x5460fa){if(_0x5460fa){return _0x46e12e[_0x43f5('0x1c')](_0x36658a);}return _0x46e12e[_0x43f5('0x1d')](_0x36658a)['end']();};}function respondWithResult(_0x4f8f19,_0x5edce8){_0x5edce8=_0x5edce8||0xc8;return function(_0xf316b5){if(_0xf316b5){return _0x4f8f19[_0x43f5('0x1d')](_0x5edce8)[_0x43f5('0x1e')](_0xf316b5);}};}function respondWithFilteredResult(_0x512287,_0x362240){return function(_0x3b5ff8){if(_0x3b5ff8){var _0x2f6492=typeof _0x362240[_0x43f5('0x1f')]===_0x43f5('0x20')&&typeof _0x362240[_0x43f5('0x21')]==='undefined';var _0x356054=_0x3b5ff8[_0x43f5('0x22')];var _0x3eddf9=_0x2f6492?0x0:_0x362240['offset'];var _0x339d4=_0x2f6492?_0x3b5ff8[_0x43f5('0x22')]:_0x362240[_0x43f5('0x1f')]+_0x362240[_0x43f5('0x21')];var _0x52cad5;if(_0x339d4>=_0x356054){_0x339d4=_0x356054;_0x52cad5=0xc8;}else{_0x52cad5=0xce;}_0x512287[_0x43f5('0x1d')](_0x52cad5);return _0x512287[_0x43f5('0x23')](_0x43f5('0x24'),_0x3eddf9+'-'+_0x339d4+'/'+_0x356054)[_0x43f5('0x1e')](_0x3b5ff8);}return null;};}function patchUpdates(_0x56e941){return function(_0x22bd4b){try{jsonpatch[_0x43f5('0x25')](_0x22bd4b,_0x56e941,!![]);}catch(_0x4d0bed){return BPromise[_0x43f5('0x26')](_0x4d0bed);}return _0x22bd4b[_0x43f5('0x27')]();};}function saveUpdates(_0x1e846d,_0x59ce1c){return function(_0x5491ec){if(_0x5491ec){return _0x5491ec[_0x43f5('0x28')](_0x1e846d)[_0x43f5('0x29')](function(_0x4926ea){return _0x4926ea;});}return null;};}function removeEntity(_0x474252,_0x428109){return function(_0x5c3df7){if(_0x5c3df7){return _0x5c3df7[_0x43f5('0x2a')]()['then'](function(){_0x474252['status'](0xcc)[_0x43f5('0x2b')]();});}};}function handleEntityNotFound(_0x51eec7,_0x689c85){return function(_0x4aacaa){if(!_0x4aacaa){_0x51eec7['sendStatus'](0x194);}return _0x4aacaa;};}function handleError(_0x1dba07,_0x21b262){_0x21b262=_0x21b262||0x1f4;return function(_0x505441){logger['error'](_0x505441['stack']);if(_0x505441[_0x43f5('0x2c')]){delete _0x505441[_0x43f5('0x2c')];}_0x1dba07[_0x43f5('0x1d')](_0x21b262)['send'](_0x505441);};}exports['index']=function(_0x198d74,_0x25113b){var _0x21c0e2={},_0x1dc80f={},_0x398bbd={'count':0x0,'rows':[]};var _0x2558ee=_[_0x43f5('0x2d')](db['JscriptyQuestionReport'][_0x43f5('0x2e')],function(_0x135758){return{'name':_0x135758[_0x43f5('0x2f')],'type':_0x135758[_0x43f5('0x30')][_0x43f5('0x31')]};});_0x1dc80f[_0x43f5('0x32')]=_['map'](_0x2558ee,_0x43f5('0x2c'));_0x1dc80f[_0x43f5('0x33')]=_[_0x43f5('0x34')](_0x198d74[_0x43f5('0x33')]);_0x1dc80f['filters']=_[_0x43f5('0x35')](_0x1dc80f['model'],_0x1dc80f[_0x43f5('0x33')]);_0x21c0e2[_0x43f5('0x36')]=_[_0x43f5('0x35')](_0x1dc80f[_0x43f5('0x32')],qs[_0x43f5('0x37')](_0x198d74['query'][_0x43f5('0x37')]));_0x21c0e2[_0x43f5('0x36')]=_0x21c0e2[_0x43f5('0x36')]['length']?_0x21c0e2['attributes']:_0x1dc80f[_0x43f5('0x32')];if(!_0x198d74[_0x43f5('0x33')][_0x43f5('0x38')](_0x43f5('0x39'))){_0x21c0e2[_0x43f5('0x21')]=qs[_0x43f5('0x21')](_0x198d74[_0x43f5('0x33')][_0x43f5('0x21')]);_0x21c0e2[_0x43f5('0x1f')]=qs[_0x43f5('0x1f')](_0x198d74[_0x43f5('0x33')]['offset']);}_0x21c0e2['order']=qs['sort'](_0x198d74[_0x43f5('0x33')][_0x43f5('0x3a')]);_0x21c0e2['where']=qs['filters'](_[_0x43f5('0x3b')](_0x198d74[_0x43f5('0x33')],_0x1dc80f[_0x43f5('0x3c')]),_0x2558ee);if(_0x198d74['query'][_0x43f5('0x3d')]){_0x21c0e2[_0x43f5('0x3e')]=_['merge'](_0x21c0e2[_0x43f5('0x3e')],{'$or':_[_0x43f5('0x2d')](_0x2558ee,function(_0x3dc8a4){if(_0x3dc8a4[_0x43f5('0x30')]!==_0x43f5('0x3f')){var _0x12aed0={};_0x12aed0[_0x3dc8a4[_0x43f5('0x2c')]]={'$like':'%'+_0x198d74['query'][_0x43f5('0x3d')]+'%'};return _0x12aed0;}})});}_0x21c0e2=_[_0x43f5('0x40')]({},_0x21c0e2,_0x198d74[_0x43f5('0x41')]);var _0x1c3c84={'where':_0x21c0e2[_0x43f5('0x3e')]};return db['JscriptyQuestionReport']['count'](_0x1c3c84)[_0x43f5('0x29')](function(_0x88110c){_0x398bbd[_0x43f5('0x22')]=_0x88110c;if(_0x198d74[_0x43f5('0x33')][_0x43f5('0x42')]){_0x21c0e2['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x43f5('0x43')](_0x21c0e2);})['then'](function(_0x5e57a7){_0x398bbd[_0x43f5('0x44')]=_0x5e57a7;return _0x398bbd;})['then'](respondWithFilteredResult(_0x25113b,_0x21c0e2))[_0x43f5('0x45')](handleError(_0x25113b,null));};exports[_0x43f5('0x46')]=function(_0x474e13,_0x4fd061){var _0x493f10={'raw':!![],'where':{'id':_0x474e13[_0x43f5('0x47')]['id']}},_0x1b063e={};_0x1b063e[_0x43f5('0x32')]=_[_0x43f5('0x34')](db[_0x43f5('0x48')][_0x43f5('0x2e')]);_0x1b063e['query']=_['keys'](_0x474e13['query']);_0x1b063e[_0x43f5('0x3c')]=_[_0x43f5('0x35')](_0x1b063e['model'],_0x1b063e['query']);_0x493f10[_0x43f5('0x36')]=_['intersection'](_0x1b063e['model'],qs[_0x43f5('0x37')](_0x474e13[_0x43f5('0x33')][_0x43f5('0x37')]));_0x493f10[_0x43f5('0x36')]=_0x493f10['attributes'][_0x43f5('0x49')]?_0x493f10[_0x43f5('0x36')]:_0x1b063e['model'];if(_0x474e13[_0x43f5('0x33')]['includeAll']){_0x493f10['include']=[{'all':!![]}];}_0x493f10=_[_0x43f5('0x40')]({},_0x493f10,_0x474e13[_0x43f5('0x41')]);return db[_0x43f5('0x48')][_0x43f5('0x4a')](_0x493f10)[_0x43f5('0x29')](handleEntityNotFound(_0x4fd061,null))[_0x43f5('0x29')](respondWithResult(_0x4fd061,null))[_0x43f5('0x45')](handleError(_0x4fd061,null));};exports[_0x43f5('0x4b')]=function(_0x3976f0,_0x2f06be){return db['JscriptyQuestionReport'][_0x43f5('0x4b')](_0x3976f0[_0x43f5('0x4c')],{})['then'](respondWithResult(_0x2f06be,0xc9))[_0x43f5('0x45')](handleError(_0x2f06be,null));};exports[_0x43f5('0x28')]=function(_0x49934e,_0x4f139c){if(_0x49934e[_0x43f5('0x4c')]['id']){delete _0x49934e[_0x43f5('0x4c')]['id'];}return db[_0x43f5('0x48')][_0x43f5('0x4a')]({'where':{'id':_0x49934e[_0x43f5('0x47')]['id']}})[_0x43f5('0x29')](handleEntityNotFound(_0x4f139c,null))['then'](saveUpdates(_0x49934e[_0x43f5('0x4c')],null))['then'](respondWithResult(_0x4f139c,null))[_0x43f5('0x45')](handleError(_0x4f139c,null));};exports[_0x43f5('0x2a')]=function(_0x2d03f7,_0x40b9f2){return db[_0x43f5('0x48')]['find']({'where':{'id':_0x2d03f7['params']['id']}})[_0x43f5('0x29')](handleEntityNotFound(_0x40b9f2,null))['then'](removeEntity(_0x40b9f2,null))[_0x43f5('0x45')](handleError(_0x40b9f2,null));};exports['describe']=function(_0x272b9b,_0x3cffa2){return db['JscriptyQuestionReport'][_0x43f5('0x4d')]()[_0x43f5('0x29')](respondWithResult(_0x3cffa2,null))['catch'](handleError(_0x3cffa2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a3d6c17..fdd8d22 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 _0x7dfa=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x11a4a8,_0x4eb10f){var _0x30dc6c=function(_0x59e1d4){while(--_0x59e1d4){_0x11a4a8['push'](_0x11a4a8['shift']());}};_0x30dc6c(++_0x4eb10f);}(_0x7dfa,0xa3));var _0xa7df=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0x7dfa[_0x47adb8];return _0x4689a8;};'use strict';var _=require(_0xa7df('0x0'));var util=require('util');var logger=require(_0xa7df('0x1'))('api');var moment=require(_0xa7df('0x2'));var BPromise=require(_0xa7df('0x3'));var rp=require(_0xa7df('0x4'));var fs=require('fs');var path=require(_0xa7df('0x5'));var rimraf=require(_0xa7df('0x6'));var config=require(_0xa7df('0x7'));var attributes=require(_0xa7df('0x8'));module[_0xa7df('0x9')]=function(_0x29c8e5,_0x4e4742){return _0x29c8e5['define'](_0xa7df('0xa'),attributes,{'tableName':_0xa7df('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1226=['exports','JscriptyQuestionReport','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2762fa,_0x534fbb){var _0x392135=function(_0x3a7511){while(--_0x3a7511){_0x2762fa['push'](_0x2762fa['shift']());}};_0x392135(++_0x534fbb);}(_0x1226,0x11a));var _0x6122=function(_0x146f54,_0x174199){_0x146f54=_0x146f54-0x0;var _0x5cf865=_0x1226[_0x146f54];return _0x5cf865;};'use strict';var _=require(_0x6122('0x0'));var util=require(_0x6122('0x1'));var logger=require(_0x6122('0x2'))('api');var moment=require(_0x6122('0x3'));var BPromise=require(_0x6122('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6122('0x5'));var rimraf=require(_0x6122('0x6'));var config=require(_0x6122('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x6122('0x8')]=function(_0xcdff5c,_0x6c2e39){return _0xcdff5c['define'](_0x6122('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index df5d6ab..a0f86f8 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 _0xf27e=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info'];(function(_0x19d742,_0x94b459){var _0x276e8f=function(_0x1c50a1){while(--_0x1c50a1){_0x19d742['push'](_0x19d742['shift']());}};_0x276e8f(++_0x94b459);}(_0xf27e,0xdb));var _0xef27=function(_0x5e0253,_0x5355fd){_0x5e0253=_0x5e0253-0x0;var _0x3a5b2e=_0xf27e[_0x5e0253];return _0x3a5b2e;};'use strict';var _=require(_0xef27('0x0'));var util=require(_0xef27('0x1'));var moment=require(_0xef27('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef27('0x3'));var db=require(_0xef27('0x4'))['db'];var utils=require(_0xef27('0x5'));var logger=require(_0xef27('0x6'))(_0xef27('0x7'));var config=require(_0xef27('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xef27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x149a55,_0x3ee6e9,_0x4db3e5){return new BPromise(function(_0x409a2b,_0x3867b6){return client[_0xef27('0xa')](_0x149a55,_0x4db3e5)['then'](function(_0x252b6b){logger[_0xef27('0xb')](_0xef27('0xc'),_0x3ee6e9,_0xef27('0xd'));logger[_0xef27('0xe')](_0xef27('0xf'),_0x3ee6e9,_0xef27('0xd'),JSON[_0xef27('0x10')](_0x252b6b));if(_0x252b6b[_0xef27('0x11')]){if(_0x252b6b[_0xef27('0x11')][_0xef27('0x12')]===0x1f4){logger[_0xef27('0x11')](_0xef27('0xc'),_0x3ee6e9,_0x252b6b['error'][_0xef27('0x13')]);return _0x3867b6(_0x252b6b[_0xef27('0x11')]['message']);}logger[_0xef27('0x11')](_0xef27('0xc'),_0x3ee6e9,_0x252b6b[_0xef27('0x11')][_0xef27('0x13')]);return _0x409a2b(_0x252b6b[_0xef27('0x11')][_0xef27('0x13')]);}else{logger[_0xef27('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3ee6e9,_0xef27('0xd'));_0x409a2b(_0x252b6b['result'][_0xef27('0x13')]);}})[_0xef27('0x14')](function(_0x1b8111){logger[_0xef27('0x11')](_0xef27('0xc'),_0x3ee6e9,_0x1b8111);_0x3867b6(_0x1b8111);});});} \ No newline at end of file +var _0x5714=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5d07b0,_0x217cc0){var _0x2c70e7=function(_0xcd20ef){while(--_0xcd20ef){_0x5d07b0['push'](_0x5d07b0['shift']());}};_0x2c70e7(++_0x217cc0);}(_0x5714,0xc9));var _0x4571=function(_0x5a2173,_0x5e9c8c){_0x5a2173=_0x5a2173-0x0;var _0x1ab9e8=_0x5714[_0x5a2173];return _0x1ab9e8;};'use strict';var _=require(_0x4571('0x0'));var util=require('util');var moment=require(_0x4571('0x1'));var BPromise=require(_0x4571('0x2'));var rs=require(_0x4571('0x3'));var fs=require('fs');var Redis=require(_0x4571('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4571('0x5'));var logger=require(_0x4571('0x6'))(_0x4571('0x7'));var config=require(_0x4571('0x8'));var jayson=require(_0x4571('0x9'));var client=jayson[_0x4571('0xa')][_0x4571('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6aaf0b,_0x3e4772,_0x54df9d){return new BPromise(function(_0x511631,_0x54dd2f){return client[_0x4571('0xc')](_0x6aaf0b,_0x54df9d)['then'](function(_0x558fc0){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3e4772,_0x4571('0xd'));logger[_0x4571('0xe')](_0x4571('0xf'),_0x3e4772,_0x4571('0xd'),JSON[_0x4571('0x10')](_0x558fc0));if(_0x558fc0['error']){if(_0x558fc0['error']['code']===0x1f4){logger[_0x4571('0x11')](_0x4571('0x12'),_0x3e4772,_0x558fc0[_0x4571('0x11')][_0x4571('0x13')]);return _0x54dd2f(_0x558fc0[_0x4571('0x11')][_0x4571('0x13')]);}logger[_0x4571('0x11')](_0x4571('0x12'),_0x3e4772,_0x558fc0['error']['message']);return _0x511631(_0x558fc0['error'][_0x4571('0x13')]);}else{logger[_0x4571('0x14')](_0x4571('0x12'),_0x3e4772,'request\x20sent');_0x511631(_0x558fc0[_0x4571('0x15')][_0x4571('0x13')]);}})[_0x4571('0x16')](function(_0xe53570){logger[_0x4571('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3e4772,_0xe53570);_0x54dd2f(_0xe53570);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 5582c7e..800cc0c 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 _0x31ac=['../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','create','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x31ac,0x10b));var _0xc31a=function(_0x2f4c8d,_0x43aa55){_0x2f4c8d=_0x2f4c8d-0x0;var _0x5c7f16=_0x31ac[_0x2f4c8d];return _0x5c7f16;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc31a('0x0'));var timeout=require(_0xc31a('0x1'));var express=require(_0xc31a('0x2'));var router=express[_0xc31a('0x3')]();var fs_extra=require(_0xc31a('0x4'));var auth=require(_0xc31a('0x5'));var interaction=require(_0xc31a('0x6'));var config=require('../../config/environment');var controller=require(_0xc31a('0x7'));router[_0xc31a('0x8')]('/',auth[_0xc31a('0x9')](),controller[_0xc31a('0xa')]);router['get'](_0xc31a('0xb'),auth[_0xc31a('0x9')](),controller[_0xc31a('0xc')]);router['get'](_0xc31a('0xd'),auth[_0xc31a('0x9')](),controller[_0xc31a('0xe')]);router['get'](_0xc31a('0xf'),auth[_0xc31a('0x9')](),controller[_0xc31a('0x10')]);router['post']('/',auth[_0xc31a('0x9')](),controller[_0xc31a('0x11')]);router[_0xc31a('0x12')](_0xc31a('0xd'),auth[_0xc31a('0x9')](),controller[_0xc31a('0x13')]);router['delete'](_0xc31a('0xd'),auth[_0xc31a('0x9')](),controller['destroy']);module[_0xc31a('0x14')]=router; \ No newline at end of file +var _0xc5d5=['update','delete','destroy','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getQuestions','post','create'];(function(_0x467648,_0x5ea4ad){var _0x1a72ab=function(_0x2b1e64){while(--_0x2b1e64){_0x467648['push'](_0x467648['shift']());}};_0x1a72ab(++_0x5ea4ad);}(_0xc5d5,0xad));var _0x5c5d=function(_0x3449ad,_0x4acbe3){_0x3449ad=_0x3449ad-0x0;var _0x54ebc8=_0xc5d5[_0x3449ad];return _0x54ebc8;};'use strict';var multer=require(_0x5c5d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5c5d('0x1'));var express=require(_0x5c5d('0x2'));var router=express[_0x5c5d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5c5d('0x4'));var config=require(_0x5c5d('0x5'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x5c5d('0x6')](),controller[_0x5c5d('0x7')]);router[_0x5c5d('0x8')]('/describe',auth[_0x5c5d('0x6')](),controller['describe']);router['get'](_0x5c5d('0x9'),auth[_0x5c5d('0x6')](),controller[_0x5c5d('0xa')]);router[_0x5c5d('0x8')]('/:id/questions',auth[_0x5c5d('0x6')](),controller[_0x5c5d('0xb')]);router[_0x5c5d('0xc')]('/',auth[_0x5c5d('0x6')](),controller[_0x5c5d('0xd')]);router['put'](_0x5c5d('0x9'),auth[_0x5c5d('0x6')](),controller[_0x5c5d('0xe')]);router[_0x5c5d('0xf')]('/:id',auth[_0x5c5d('0x6')](),controller[_0x5c5d('0x10')]);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 a1746cf..e07ca6c 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 _0xad33=['endtime','format','STRING','BOOLEAN','sequelize','exports','setDataValue','starttime'];(function(_0xb34d04,_0x3d321b){var _0x48b5b9=function(_0x561d62){while(--_0x561d62){_0xb34d04['push'](_0xb34d04['shift']());}};_0x48b5b9(++_0x3d321b);}(_0xad33,0x6c));var _0x3ad3=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0xad33[_0x547ff4];return _0xe41057;};'use strict';var moment=require('moment');var Sequelize=require(_0x3ad3('0x0'));module[_0x3ad3('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x203e74){this[_0x3ad3('0x2')](_0x3ad3('0x3'),_0x203e74);this[_0x3ad3('0x2')](_0x3ad3('0x4'),moment()[_0x3ad3('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x3ad3('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3ad3('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3ad3('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x3ad3('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xe4f9=['moment','DATE','endtime','format','STRING','BOOLEAN'];(function(_0x47698e,_0x4224d6){var _0x4600dd=function(_0x56350f){while(--_0x56350f){_0x47698e['push'](_0x47698e['shift']());}};_0x4600dd(++_0x4224d6);}(_0xe4f9,0xa8));var _0x9e4f=function(_0x47057b,_0x283375){_0x47057b=_0x47057b-0x0;var _0x2390fb=_0xe4f9[_0x47057b];return _0x2390fb;};'use strict';var moment=require(_0x9e4f('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x9e4f('0x1')],'set':function(_0xbe6329){this['setDataValue']('starttime',_0xbe6329);this['setDataValue'](_0x9e4f('0x2'),moment()[_0x9e4f('0x3')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x9e4f('0x4')]},'projectname':{'type':Sequelize[_0x9e4f('0x4')]},'queue':{'type':Sequelize[_0x9e4f('0x4')]},'uniqueid':{'type':Sequelize[_0x9e4f('0x4')]},'calleridname':{'type':Sequelize[_0x9e4f('0x4')]},'calleridnum':{'type':Sequelize[_0x9e4f('0x4')]},'completed':{'type':Sequelize[_0x9e4f('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 0810712..25dc07f 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 _0x78c5=['apply','reject','save','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','update','body','destroy','describe','getQuestions','findOne','keys','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x78c5,0x1c5));var _0x578c=function(_0x4618da,_0x27c024){_0x4618da=_0x4618da-0x0;var _0xede04a=_0x78c5[_0x4618da];return _0xede04a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x578c('0x0'));var zipdir=require(_0x578c('0x1'));var jsonpatch=require(_0x578c('0x2'));var rp=require(_0x578c('0x3'));var moment=require(_0x578c('0x4'));var BPromise=require(_0x578c('0x5'));var Mustache=require(_0x578c('0x6'));var util=require('util');var path=require(_0x578c('0x7'));var sox=require(_0x578c('0x8'));var csv=require(_0x578c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x578c('0xa'));var _=require('lodash');var squel=require(_0x578c('0xb'));var crypto=require(_0x578c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x578c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x578c('0xe'));var Papa=require('papaparse');var Redis=require(_0x578c('0xf'));var authService=require(_0x578c('0x10'));var qs=require(_0x578c('0x11'));var as=require(_0x578c('0x12'));var hardwareService=require(_0x578c('0x13'));var logger=require(_0x578c('0x14'))(_0x578c('0x15'));var utils=require(_0x578c('0x16'));var config=require(_0x578c('0x17'));var licenseUtil=require(_0x578c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x493944,_0x5593d4){_0x5593d4=_0x5593d4||0xcc;return function(_0x26b835){if(_0x26b835){return _0x493944['sendStatus'](_0x5593d4);}return _0x493944[_0x578c('0x19')](_0x5593d4)[_0x578c('0x1a')]();};}function respondWithResult(_0x48a1a5,_0x4284ec){_0x4284ec=_0x4284ec||0xc8;return function(_0x5a1f9){if(_0x5a1f9){return _0x48a1a5[_0x578c('0x19')](_0x4284ec)[_0x578c('0x1b')](_0x5a1f9);}};}function respondWithFilteredResult(_0x13cb2f,_0x171f6c){return function(_0xa7f263){if(_0xa7f263){var _0x3c2525=typeof _0x171f6c[_0x578c('0x1c')]===_0x578c('0x1d')&&typeof _0x171f6c[_0x578c('0x1e')]===_0x578c('0x1d');var _0x4978a9=_0xa7f263[_0x578c('0x1f')];var _0x3671e5=_0x3c2525?0x0:_0x171f6c['offset'];var _0x2dde09=_0x3c2525?_0xa7f263[_0x578c('0x1f')]:_0x171f6c['offset']+_0x171f6c[_0x578c('0x1e')];var _0x4d978a;if(_0x2dde09>=_0x4978a9){_0x2dde09=_0x4978a9;_0x4d978a=0xc8;}else{_0x4d978a=0xce;}_0x13cb2f[_0x578c('0x19')](_0x4d978a);return _0x13cb2f[_0x578c('0x20')]('Content-Range',_0x3671e5+'-'+_0x2dde09+'/'+_0x4978a9)[_0x578c('0x1b')](_0xa7f263);}return null;};}function patchUpdates(_0x205cb8){return function(_0x1bec16){try{jsonpatch[_0x578c('0x21')](_0x1bec16,_0x205cb8,!![]);}catch(_0x4fa3fa){return BPromise[_0x578c('0x22')](_0x4fa3fa);}return _0x1bec16[_0x578c('0x23')]();};}function saveUpdates(_0x42e451,_0x3d7eac){return function(_0x44971d){if(_0x44971d){return _0x44971d['update'](_0x42e451)['then'](function(_0x4b8c73){return _0x4b8c73;});}return null;};}function removeEntity(_0x546884,_0xe26474){return function(_0x12664c){if(_0x12664c){return _0x12664c['destroy']()[_0x578c('0x24')](function(){_0x546884[_0x578c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x950a49,_0x21a8a0){return function(_0x3c9b4d){if(!_0x3c9b4d){_0x950a49[_0x578c('0x25')](0x194);}return _0x3c9b4d;};}function handleError(_0x3683c6,_0x1162d3){_0x1162d3=_0x1162d3||0x1f4;return function(_0x5b8827){logger[_0x578c('0x26')](_0x5b8827[_0x578c('0x27')]);if(_0x5b8827[_0x578c('0x28')]){delete _0x5b8827[_0x578c('0x28')];}_0x3683c6[_0x578c('0x19')](_0x1162d3)[_0x578c('0x29')](_0x5b8827);};}exports[_0x578c('0x2a')]=function(_0x18f24a,_0xa41c1c){var _0x3a30ab={},_0x338cee={},_0x49073b={'count':0x0,'rows':[]};var _0xc20f67=_[_0x578c('0x2b')](db[_0x578c('0x2c')]['rawAttributes'],function(_0x365df2){return{'name':_0x365df2['fieldName'],'type':_0x365df2[_0x578c('0x2d')]['key']};});_0x338cee[_0x578c('0x2e')]=_['map'](_0xc20f67,_0x578c('0x28'));_0x338cee[_0x578c('0x2f')]=_['keys'](_0x18f24a[_0x578c('0x2f')]);_0x338cee[_0x578c('0x30')]=_[_0x578c('0x31')](_0x338cee['model'],_0x338cee[_0x578c('0x2f')]);_0x3a30ab['attributes']=_[_0x578c('0x31')](_0x338cee[_0x578c('0x2e')],qs[_0x578c('0x32')](_0x18f24a[_0x578c('0x2f')]['fields']));_0x3a30ab[_0x578c('0x33')]=_0x3a30ab[_0x578c('0x33')][_0x578c('0x34')]?_0x3a30ab[_0x578c('0x33')]:_0x338cee[_0x578c('0x2e')];if(!_0x18f24a['query'][_0x578c('0x35')](_0x578c('0x36'))){_0x3a30ab['limit']=qs['limit'](_0x18f24a[_0x578c('0x2f')][_0x578c('0x1e')]);_0x3a30ab[_0x578c('0x1c')]=qs[_0x578c('0x1c')](_0x18f24a[_0x578c('0x2f')]['offset']);}_0x3a30ab[_0x578c('0x37')]=qs[_0x578c('0x38')](_0x18f24a['query']['sort']);_0x3a30ab[_0x578c('0x39')]=qs[_0x578c('0x30')](_[_0x578c('0x3a')](_0x18f24a[_0x578c('0x2f')],_0x338cee[_0x578c('0x30')]),_0xc20f67);if(_0x18f24a[_0x578c('0x2f')]['filter']){_0x3a30ab['where']=_['merge'](_0x3a30ab[_0x578c('0x39')],{'$or':_[_0x578c('0x2b')](_0xc20f67,function(_0x4e40db){if(_0x4e40db[_0x578c('0x2d')]!==_0x578c('0x3b')){var _0x25a38c={};_0x25a38c[_0x4e40db[_0x578c('0x28')]]={'$like':'%'+_0x18f24a[_0x578c('0x2f')][_0x578c('0x3c')]+'%'};return _0x25a38c;}})});}_0x3a30ab=_[_0x578c('0x3d')]({},_0x3a30ab,_0x18f24a[_0x578c('0x3e')]);var _0x380713={'where':_0x3a30ab['where']};return db[_0x578c('0x2c')][_0x578c('0x1f')](_0x380713)[_0x578c('0x24')](function(_0x38c3e8){_0x49073b[_0x578c('0x1f')]=_0x38c3e8;if(_0x18f24a[_0x578c('0x2f')][_0x578c('0x3f')]){_0x3a30ab['include']=[{'all':!![]}];}return db[_0x578c('0x2c')][_0x578c('0x40')](_0x3a30ab);})[_0x578c('0x24')](function(_0x3760ab){_0x49073b[_0x578c('0x41')]=_0x3760ab;return _0x49073b;})['then'](respondWithFilteredResult(_0xa41c1c,_0x3a30ab))['catch'](handleError(_0xa41c1c,null));};exports[_0x578c('0x42')]=function(_0x16a5a8,_0x596563){var _0x47d90c={'raw':!![],'where':{'id':_0x16a5a8[_0x578c('0x43')]['id']}},_0x370d9d={};_0x370d9d[_0x578c('0x2e')]=_['keys'](db[_0x578c('0x2c')][_0x578c('0x44')]);_0x370d9d['query']=_['keys'](_0x16a5a8[_0x578c('0x2f')]);_0x370d9d[_0x578c('0x30')]=_[_0x578c('0x31')](_0x370d9d[_0x578c('0x2e')],_0x370d9d['query']);_0x47d90c[_0x578c('0x33')]=_[_0x578c('0x31')](_0x370d9d[_0x578c('0x2e')],qs[_0x578c('0x32')](_0x16a5a8['query'][_0x578c('0x32')]));_0x47d90c['attributes']=_0x47d90c['attributes'][_0x578c('0x34')]?_0x47d90c[_0x578c('0x33')]:_0x370d9d['model'];if(_0x16a5a8[_0x578c('0x2f')][_0x578c('0x3f')]){_0x47d90c[_0x578c('0x45')]=[{'all':!![]}];}_0x47d90c=_[_0x578c('0x3d')]({},_0x47d90c,_0x16a5a8[_0x578c('0x3e')]);return db[_0x578c('0x2c')][_0x578c('0x46')](_0x47d90c)['then'](handleEntityNotFound(_0x596563,null))[_0x578c('0x24')](respondWithResult(_0x596563,null))[_0x578c('0x47')](handleError(_0x596563,null));};exports[_0x578c('0x48')]=function(_0x18a1ef,_0x49fd91){return db[_0x578c('0x2c')][_0x578c('0x48')](_0x18a1ef['body'],{})[_0x578c('0x24')](respondWithResult(_0x49fd91,0xc9))['catch'](handleError(_0x49fd91,null));};exports[_0x578c('0x49')]=function(_0x5d7e89,_0x1e38d0){if(_0x5d7e89[_0x578c('0x4a')]['id']){delete _0x5d7e89[_0x578c('0x4a')]['id'];}return db['JscriptySessionReport'][_0x578c('0x46')]({'where':{'id':_0x5d7e89['params']['id']}})[_0x578c('0x24')](handleEntityNotFound(_0x1e38d0,null))[_0x578c('0x24')](saveUpdates(_0x5d7e89[_0x578c('0x4a')],null))['then'](respondWithResult(_0x1e38d0,null))[_0x578c('0x47')](handleError(_0x1e38d0,null));};exports[_0x578c('0x4b')]=function(_0x445443,_0x4750f7){return db['JscriptySessionReport']['find']({'where':{'id':_0x445443[_0x578c('0x43')]['id']}})[_0x578c('0x24')](handleEntityNotFound(_0x4750f7,null))[_0x578c('0x24')](removeEntity(_0x4750f7,null))['catch'](handleError(_0x4750f7,null));};exports[_0x578c('0x4c')]=function(_0x53847b,_0x272a31){return db['JscriptySessionReport']['describe']()[_0x578c('0x24')](respondWithResult(_0x272a31,null))[_0x578c('0x47')](handleError(_0x272a31,null));};exports[_0x578c('0x4d')]=function(_0x43ed09,_0x3c4671,_0x343665){var _0x2d0f31={'raw':!![],'where':{}};var _0x389358={};var _0x493e52={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x578c('0x4e')]({'where':{'id':_0x43ed09[_0x578c('0x43')]['id']}})[_0x578c('0x24')](handleEntityNotFound(_0x3c4671,null))[_0x578c('0x24')](function(_0x53d556){if(_0x53d556){_0x389358['model']=_[_0x578c('0x4f')](db[_0x578c('0x50')][_0x578c('0x44')]);_0x389358[_0x578c('0x2f')]=_['keys'](_0x43ed09[_0x578c('0x2f')]);_0x389358['filters']=_[_0x578c('0x31')](_0x389358[_0x578c('0x2e')],_0x389358[_0x578c('0x2f')]);_0x2d0f31[_0x578c('0x33')]=_[_0x578c('0x31')](_0x389358[_0x578c('0x2e')],qs['fields'](_0x43ed09[_0x578c('0x2f')]['fields']));_0x2d0f31[_0x578c('0x33')]=_0x2d0f31[_0x578c('0x33')]['length']?_0x2d0f31[_0x578c('0x33')]:_0x389358['model'];if(!_0x43ed09[_0x578c('0x2f')][_0x578c('0x35')]('nolimit')){_0x2d0f31[_0x578c('0x1e')]=qs[_0x578c('0x1e')](_0x43ed09[_0x578c('0x2f')][_0x578c('0x1e')]);_0x2d0f31['offset']=qs[_0x578c('0x1c')](_0x43ed09[_0x578c('0x2f')]['offset']);}_0x2d0f31[_0x578c('0x37')]=qs[_0x578c('0x38')](_0x43ed09['query'][_0x578c('0x38')]);_0x2d0f31['where']=qs[_0x578c('0x30')](_[_0x578c('0x3a')](_0x43ed09['query'],_0x389358[_0x578c('0x30')]));_0x2d0f31[_0x578c('0x39')]['SessionId']=_0x53d556['id'];if(_0x43ed09[_0x578c('0x2f')][_0x578c('0x3c')]){_0x2d0f31['where']=_['merge'](_0x2d0f31[_0x578c('0x39')],{'$or':_[_0x578c('0x2b')](_0x2d0f31[_0x578c('0x33')],function(_0x5d3d12){var _0x533b76={};_0x533b76[_0x5d3d12]={'$like':'%'+_0x43ed09['query'][_0x578c('0x3c')]+'%'};return _0x533b76;})});}_0x2d0f31=_[_0x578c('0x3d')]({},_0x2d0f31,_0x43ed09[_0x578c('0x3e')]);return db[_0x578c('0x50')][_0x578c('0x1f')]({'where':_0x2d0f31['where']})[_0x578c('0x24')](function(_0x5ea716){_0x493e52[_0x578c('0x1f')]=_0x5ea716;if(_0x43ed09[_0x578c('0x2f')][_0x578c('0x3f')]){_0x2d0f31[_0x578c('0x45')]=[{'all':!![]}];}return db[_0x578c('0x50')]['findAll'](_0x2d0f31);})[_0x578c('0x24')](function(_0x3d3aec){_0x493e52['rows']=_0x3d3aec;return _0x493e52;});}})[_0x578c('0x24')](respondWithFilteredResult(_0x3c4671,_0x2d0f31))[_0x578c('0x47')](handleError(_0x3c4671,null));}; \ No newline at end of file +var _0x721d=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','options','find','body','params','describe','getQuestions','sort','pick','SessionId','JscriptyQuestionReport','eml-format','rimraf','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','map','JscriptySessionReport','rawAttributes'];(function(_0x262432,_0x165b09){var _0x5f176f=function(_0x1e2094){while(--_0x1e2094){_0x262432['push'](_0x262432['shift']());}};_0x5f176f(++_0x165b09);}(_0x721d,0x18e));var _0xd721=function(_0x3475f4,_0x7b1a5c){_0x3475f4=_0x3475f4-0x0;var _0x5521e0=_0x721d[_0x3475f4];return _0x5521e0;};'use strict';var emlformat=require(_0xd721('0x0'));var rimraf=require(_0xd721('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd721('0x2'));var Mustache=require(_0xd721('0x3'));var util=require('util');var path=require(_0xd721('0x4'));var sox=require('sox');var csv=require(_0xd721('0x5'));var ejs=require(_0xd721('0x6'));var fs=require('fs');var fs_extra=require(_0xd721('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd721('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd721('0x5'));var querystring=require(_0xd721('0x9'));var Papa=require(_0xd721('0xa'));var Redis=require('ioredis');var authService=require(_0xd721('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xd721('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd721('0xd'))(_0xd721('0xe'));var utils=require(_0xd721('0xf'));var config=require(_0xd721('0x10'));var licenseUtil=require(_0xd721('0x11'));var db=require(_0xd721('0x12'))['db'];function respondWithStatusCode(_0x28530c,_0x1b2e9b){_0x1b2e9b=_0x1b2e9b||0xcc;return function(_0x1b5ec1){if(_0x1b5ec1){return _0x28530c[_0xd721('0x13')](_0x1b2e9b);}return _0x28530c[_0xd721('0x14')](_0x1b2e9b)[_0xd721('0x15')]();};}function respondWithResult(_0x2e59b6,_0x504f9b){_0x504f9b=_0x504f9b||0xc8;return function(_0x25495a){if(_0x25495a){return _0x2e59b6[_0xd721('0x14')](_0x504f9b)['json'](_0x25495a);}};}function respondWithFilteredResult(_0x575491,_0x56a0b6){return function(_0x3f2628){if(_0x3f2628){var _0x2903d8=typeof _0x56a0b6['offset']===_0xd721('0x16')&&typeof _0x56a0b6[_0xd721('0x17')]==='undefined';var _0x3189f7=_0x3f2628[_0xd721('0x18')];var _0x364f0c=_0x2903d8?0x0:_0x56a0b6[_0xd721('0x19')];var _0x595fec=_0x2903d8?_0x3f2628[_0xd721('0x18')]:_0x56a0b6[_0xd721('0x19')]+_0x56a0b6[_0xd721('0x17')];var _0x56a8ab;if(_0x595fec>=_0x3189f7){_0x595fec=_0x3189f7;_0x56a8ab=0xc8;}else{_0x56a8ab=0xce;}_0x575491[_0xd721('0x14')](_0x56a8ab);return _0x575491[_0xd721('0x1a')](_0xd721('0x1b'),_0x364f0c+'-'+_0x595fec+'/'+_0x3189f7)[_0xd721('0x1c')](_0x3f2628);}return null;};}function patchUpdates(_0x3c2c09){return function(_0x7de2fd){try{jsonpatch['apply'](_0x7de2fd,_0x3c2c09,!![]);}catch(_0x403683){return BPromise[_0xd721('0x1d')](_0x403683);}return _0x7de2fd[_0xd721('0x1e')]();};}function saveUpdates(_0x3b5c08,_0x4e8f06){return function(_0x600de2){if(_0x600de2){return _0x600de2[_0xd721('0x1f')](_0x3b5c08)[_0xd721('0x20')](function(_0x10a831){return _0x10a831;});}return null;};}function removeEntity(_0x81ba92,_0x3dc203){return function(_0x4c0796){if(_0x4c0796){return _0x4c0796[_0xd721('0x21')]()[_0xd721('0x20')](function(){_0x81ba92[_0xd721('0x14')](0xcc)[_0xd721('0x15')]();});}};}function handleEntityNotFound(_0x25f483,_0x2046fd){return function(_0x42ad89){if(!_0x42ad89){_0x25f483['sendStatus'](0x194);}return _0x42ad89;};}function handleError(_0x61ae7d,_0x2fb042){_0x2fb042=_0x2fb042||0x1f4;return function(_0x26698e){logger[_0xd721('0x22')](_0x26698e[_0xd721('0x23')]);if(_0x26698e['name']){delete _0x26698e[_0xd721('0x24')];}_0x61ae7d['status'](_0x2fb042)['send'](_0x26698e);};}exports['index']=function(_0x3f4f22,_0x1ed460){var _0x1293f2={},_0x246319={},_0x5b1f1a={'count':0x0,'rows':[]};var _0x7192d9=_[_0xd721('0x25')](db[_0xd721('0x26')][_0xd721('0x27')],function(_0x5f544b){return{'name':_0x5f544b[_0xd721('0x28')],'type':_0x5f544b[_0xd721('0x29')][_0xd721('0x2a')]};});_0x246319[_0xd721('0x2b')]=_[_0xd721('0x25')](_0x7192d9,_0xd721('0x24'));_0x246319[_0xd721('0x2c')]=_[_0xd721('0x2d')](_0x3f4f22[_0xd721('0x2c')]);_0x246319[_0xd721('0x2e')]=_[_0xd721('0x2f')](_0x246319[_0xd721('0x2b')],_0x246319[_0xd721('0x2c')]);_0x1293f2[_0xd721('0x30')]=_[_0xd721('0x2f')](_0x246319[_0xd721('0x2b')],qs[_0xd721('0x31')](_0x3f4f22['query'][_0xd721('0x31')]));_0x1293f2['attributes']=_0x1293f2['attributes'][_0xd721('0x32')]?_0x1293f2[_0xd721('0x30')]:_0x246319[_0xd721('0x2b')];if(!_0x3f4f22[_0xd721('0x2c')][_0xd721('0x33')](_0xd721('0x34'))){_0x1293f2[_0xd721('0x17')]=qs[_0xd721('0x17')](_0x3f4f22[_0xd721('0x2c')][_0xd721('0x17')]);_0x1293f2[_0xd721('0x19')]=qs[_0xd721('0x19')](_0x3f4f22['query'][_0xd721('0x19')]);}_0x1293f2[_0xd721('0x35')]=qs['sort'](_0x3f4f22[_0xd721('0x2c')]['sort']);_0x1293f2[_0xd721('0x36')]=qs[_0xd721('0x2e')](_['pick'](_0x3f4f22[_0xd721('0x2c')],_0x246319['filters']),_0x7192d9);if(_0x3f4f22['query']['filter']){_0x1293f2[_0xd721('0x36')]=_[_0xd721('0x37')](_0x1293f2[_0xd721('0x36')],{'$or':_['map'](_0x7192d9,function(_0x4266db){if(_0x4266db[_0xd721('0x29')]!==_0xd721('0x38')){var _0x198adf={};_0x198adf[_0x4266db[_0xd721('0x24')]]={'$like':'%'+_0x3f4f22[_0xd721('0x2c')][_0xd721('0x39')]+'%'};return _0x198adf;}})});}_0x1293f2=_[_0xd721('0x37')]({},_0x1293f2,_0x3f4f22['options']);var _0x50de09={'where':_0x1293f2[_0xd721('0x36')]};return db[_0xd721('0x26')][_0xd721('0x18')](_0x50de09)[_0xd721('0x20')](function(_0x53ca77){_0x5b1f1a[_0xd721('0x18')]=_0x53ca77;if(_0x3f4f22[_0xd721('0x2c')][_0xd721('0x3a')]){_0x1293f2[_0xd721('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd721('0x3c')](_0x1293f2);})['then'](function(_0x55a36b){_0x5b1f1a[_0xd721('0x3d')]=_0x55a36b;return _0x5b1f1a;})[_0xd721('0x20')](respondWithFilteredResult(_0x1ed460,_0x1293f2))[_0xd721('0x3e')](handleError(_0x1ed460,null));};exports['show']=function(_0x4af84d,_0x173702){var _0x2eab84={'raw':!![],'where':{'id':_0x4af84d['params']['id']}},_0x58c1b8={};_0x58c1b8[_0xd721('0x2b')]=_[_0xd721('0x2d')](db[_0xd721('0x26')][_0xd721('0x27')]);_0x58c1b8[_0xd721('0x2c')]=_[_0xd721('0x2d')](_0x4af84d['query']);_0x58c1b8[_0xd721('0x2e')]=_['intersection'](_0x58c1b8[_0xd721('0x2b')],_0x58c1b8[_0xd721('0x2c')]);_0x2eab84['attributes']=_[_0xd721('0x2f')](_0x58c1b8[_0xd721('0x2b')],qs['fields'](_0x4af84d[_0xd721('0x2c')][_0xd721('0x31')]));_0x2eab84['attributes']=_0x2eab84[_0xd721('0x30')]['length']?_0x2eab84[_0xd721('0x30')]:_0x58c1b8['model'];if(_0x4af84d[_0xd721('0x2c')]['includeAll']){_0x2eab84[_0xd721('0x3b')]=[{'all':!![]}];}_0x2eab84=_[_0xd721('0x37')]({},_0x2eab84,_0x4af84d[_0xd721('0x3f')]);return db[_0xd721('0x26')][_0xd721('0x40')](_0x2eab84)[_0xd721('0x20')](handleEntityNotFound(_0x173702,null))['then'](respondWithResult(_0x173702,null))[_0xd721('0x3e')](handleError(_0x173702,null));};exports['create']=function(_0x96316c,_0x45b69f){return db[_0xd721('0x26')]['create'](_0x96316c[_0xd721('0x41')],{})[_0xd721('0x20')](respondWithResult(_0x45b69f,0xc9))[_0xd721('0x3e')](handleError(_0x45b69f,null));};exports[_0xd721('0x1f')]=function(_0x27a372,_0x3a33cc){if(_0x27a372[_0xd721('0x41')]['id']){delete _0x27a372['body']['id'];}return db['JscriptySessionReport'][_0xd721('0x40')]({'where':{'id':_0x27a372[_0xd721('0x42')]['id']}})[_0xd721('0x20')](handleEntityNotFound(_0x3a33cc,null))[_0xd721('0x20')](saveUpdates(_0x27a372[_0xd721('0x41')],null))[_0xd721('0x20')](respondWithResult(_0x3a33cc,null))[_0xd721('0x3e')](handleError(_0x3a33cc,null));};exports[_0xd721('0x21')]=function(_0x3252e7,_0x49c3ac){return db['JscriptySessionReport'][_0xd721('0x40')]({'where':{'id':_0x3252e7['params']['id']}})[_0xd721('0x20')](handleEntityNotFound(_0x49c3ac,null))[_0xd721('0x20')](removeEntity(_0x49c3ac,null))['catch'](handleError(_0x49c3ac,null));};exports[_0xd721('0x43')]=function(_0x2ed978,_0x8feb7){return db['JscriptySessionReport'][_0xd721('0x43')]()['then'](respondWithResult(_0x8feb7,null))[_0xd721('0x3e')](handleError(_0x8feb7,null));};exports[_0xd721('0x44')]=function(_0x3efc79,_0xd6ffbe,_0x4b481d){var _0x470f57={'raw':!![],'where':{}};var _0xbde533={};var _0x1587a1={'count':0x0,'rows':[]};return db[_0xd721('0x26')]['findOne']({'where':{'id':_0x3efc79['params']['id']}})['then'](handleEntityNotFound(_0xd6ffbe,null))[_0xd721('0x20')](function(_0x4fe7c7){if(_0x4fe7c7){_0xbde533['model']=_[_0xd721('0x2d')](db['JscriptyQuestionReport']['rawAttributes']);_0xbde533[_0xd721('0x2c')]=_[_0xd721('0x2d')](_0x3efc79[_0xd721('0x2c')]);_0xbde533['filters']=_[_0xd721('0x2f')](_0xbde533[_0xd721('0x2b')],_0xbde533['query']);_0x470f57['attributes']=_['intersection'](_0xbde533['model'],qs[_0xd721('0x31')](_0x3efc79[_0xd721('0x2c')][_0xd721('0x31')]));_0x470f57[_0xd721('0x30')]=_0x470f57[_0xd721('0x30')][_0xd721('0x32')]?_0x470f57[_0xd721('0x30')]:_0xbde533[_0xd721('0x2b')];if(!_0x3efc79[_0xd721('0x2c')][_0xd721('0x33')](_0xd721('0x34'))){_0x470f57[_0xd721('0x17')]=qs[_0xd721('0x17')](_0x3efc79[_0xd721('0x2c')][_0xd721('0x17')]);_0x470f57[_0xd721('0x19')]=qs['offset'](_0x3efc79[_0xd721('0x2c')][_0xd721('0x19')]);}_0x470f57[_0xd721('0x35')]=qs[_0xd721('0x45')](_0x3efc79[_0xd721('0x2c')][_0xd721('0x45')]);_0x470f57[_0xd721('0x36')]=qs[_0xd721('0x2e')](_[_0xd721('0x46')](_0x3efc79['query'],_0xbde533['filters']));_0x470f57[_0xd721('0x36')][_0xd721('0x47')]=_0x4fe7c7['id'];if(_0x3efc79[_0xd721('0x2c')][_0xd721('0x39')]){_0x470f57[_0xd721('0x36')]=_['merge'](_0x470f57[_0xd721('0x36')],{'$or':_[_0xd721('0x25')](_0x470f57[_0xd721('0x30')],function(_0x1e5cdd){var _0x1d9879={};_0x1d9879[_0x1e5cdd]={'$like':'%'+_0x3efc79[_0xd721('0x2c')][_0xd721('0x39')]+'%'};return _0x1d9879;})});}_0x470f57=_[_0xd721('0x37')]({},_0x470f57,_0x3efc79[_0xd721('0x3f')]);return db['JscriptyQuestionReport'][_0xd721('0x18')]({'where':_0x470f57[_0xd721('0x36')]})['then'](function(_0x34084e){_0x1587a1[_0xd721('0x18')]=_0x34084e;if(_0x3efc79['query'][_0xd721('0x3a')]){_0x470f57['include']=[{'all':!![]}];}return db[_0xd721('0x48')]['findAll'](_0x470f57);})[_0xd721('0x20')](function(_0x352d90){_0x1587a1[_0xd721('0x3d')]=_0x352d90;return _0x1587a1;});}})['then'](respondWithFilteredResult(_0xd6ffbe,_0x470f57))['catch'](handleError(_0xd6ffbe,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a6a7fef..c174338 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 _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x563eb4,_0x29bbae){var _0x97db86=function(_0x5f144f){while(--_0x5f144f){_0x563eb4['push'](_0x563eb4['shift']());}};_0x97db86(++_0x29bbae);}(_0xfcf0,0x138));var _0x0fcf=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xfcf0[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44e8=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x1b41a0,_0x24e232){var _0x5e5e27=function(_0x33c16f){while(--_0x33c16f){_0x1b41a0['push'](_0x1b41a0['shift']());}};_0x5e5e27(++_0x24e232);}(_0x44e8,0xd7));var _0x844e=function(_0x74b3e6,_0x29324e){_0x74b3e6=_0x74b3e6-0x0;var _0x1e9729=_0x44e8[_0x74b3e6];return _0x1e9729;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x844e('0x1'));var moment=require(_0x844e('0x2'));var BPromise=require(_0x844e('0x3'));var rp=require(_0x844e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var attributes=require(_0x844e('0x7'));module[_0x844e('0x8')]=function(_0x5c8f67,_0x2f6539){return _0x5c8f67[_0x844e('0x9')](_0x844e('0xa'),attributes,{'tableName':_0x844e('0xb'),'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 8fff321..f5d1071 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 _0xdf55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0xdf55,0x83));var _0x5df5=function(_0x22377a,_0x3397cb){_0x22377a=_0x22377a-0x0;var _0x36f105=_0xdf55[_0x22377a];return _0x36f105;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});} \ No newline at end of file +var _0x77d4=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x77d4,0x108));var _0x477d=function(_0x495c52,_0x53c0cc){_0x495c52=_0x495c52-0x0;var _0x2b4bb2=_0x77d4[_0x495c52];return _0x2b4bb2;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a87b81f..eb58d43 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 _0xf4e1=['../../components/interaction/service','../../config/environment','./license.controller','get','/:id','isAuthenticated','/download_log_file','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x43145c,_0x4ea1b4){var _0x2cee86=function(_0x5141d3){while(--_0x5141d3){_0x43145c['push'](_0x43145c['shift']());}};_0x2cee86(++_0x4ea1b4);}(_0xf4e1,0x1c2));var _0x1f4e=function(_0x601156,_0x37de11){_0x601156=_0x601156-0x0;var _0x5a8e2a=_0xf4e1[_0x601156];return _0x5a8e2a;};'use strict';var multer=require(_0x1f4e('0x0'));var util=require('util');var path=require(_0x1f4e('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f4e('0x2'));var router=express[_0x1f4e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f4e('0x4'));var interaction=require(_0x1f4e('0x5'));var config=require(_0x1f4e('0x6'));var controller=require(_0x1f4e('0x7'));router[_0x1f4e('0x8')]('/',controller['index']);router['put'](_0x1f4e('0x9'),auth[_0x1f4e('0xa')](),controller['update']);router[_0x1f4e('0x8')](_0x1f4e('0xb'),auth[_0x1f4e('0xa')](),controller['downloadLogFile']);module[_0x1f4e('0xc')]=router; \ No newline at end of file +var _0x4b66=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','update','/download_log_file','isAuthenticated'];(function(_0x3d075a,_0x507f04){var _0x418be1=function(_0x19c75b){while(--_0x19c75b){_0x3d075a['push'](_0x3d075a['shift']());}};_0x418be1(++_0x507f04);}(_0x4b66,0x1dc));var _0x64b6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4b66[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x64b6('0x0'));var util=require(_0x64b6('0x1'));var path=require(_0x64b6('0x2'));var timeout=require(_0x64b6('0x3'));var express=require(_0x64b6('0x4'));var router=express[_0x64b6('0x5')]();var fs_extra=require(_0x64b6('0x6'));var auth=require(_0x64b6('0x7'));var interaction=require(_0x64b6('0x8'));var config=require(_0x64b6('0x9'));var controller=require(_0x64b6('0xa'));router[_0x64b6('0xb')]('/',controller[_0x64b6('0xc')]);router[_0x64b6('0xd')](_0x64b6('0xe'),auth['isAuthenticated'](),controller[_0x64b6('0xf')]);router[_0x64b6('0xb')](_0x64b6('0x10'),auth[_0x64b6('0x11')](),controller['downloadLogFile']);module[_0x64b6('0x12')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index fb4178e..7309629 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 _0x4fac=['STRING','sequelize','exports','TEXT'];(function(_0x33ef8d,_0x4b4736){var _0x3e5270=function(_0x3f2396){while(--_0x3f2396){_0x33ef8d['push'](_0x33ef8d['shift']());}};_0x3e5270(++_0x4b4736);}(_0x4fac,0x119));var _0xc4fa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4fac[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xc4fa('0x0'));module[_0xc4fa('0x1')]={'license':{'type':Sequelize[_0xc4fa('0x2')]},'data1':{'type':Sequelize[_0xc4fa('0x3')]},'data2':{'type':Sequelize[_0xc4fa('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd787=['STRING','INTEGER','sequelize','TEXT'];(function(_0x28effe,_0x5599e7){var _0x477a1a=function(_0x5cf78b){while(--_0x5cf78b){_0x28effe['push'](_0x28effe['shift']());}};_0x477a1a(++_0x5599e7);}(_0xd787,0x82));var _0x7d78=function(_0x4664f2,_0x1669d3){_0x4664f2=_0x4664f2-0x0;var _0x18c3f3=_0xd787[_0x4664f2];return _0x18c3f3;};'use strict';var Sequelize=require(_0x7d78('0x0'));module['exports']={'license':{'type':Sequelize[_0x7d78('0x1')]},'data1':{'type':Sequelize[_0x7d78('0x2')]},'data2':{'type':Sequelize[_0x7d78('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x7d78('0x3')],'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 eacd97f..6b36bee 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 _0x7a63=['xcally','Content-disposition','attachment;\x20filename=','text/plain','eml-format','request-promise','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','then','sendStatus','stack','name','send','index','rawAttributes','query','keys','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','downloadLogFile','join','/var'];(function(_0x4e8ba9,_0x2650e1){var _0x538f28=function(_0x2531bb){while(--_0x2531bb){_0x4e8ba9['push'](_0x4e8ba9['shift']());}};_0x538f28(++_0x2650e1);}(_0x7a63,0x7c));var _0x37a6=function(_0x143b0f,_0x17b46e){_0x143b0f=_0x143b0f-0x0;var _0x46f47d=_0x7a63[_0x143b0f];return _0x46f47d;};'use strict';var emlformat=require(_0x37a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x37a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x37a6('0x2'));var util=require(_0x37a6('0x3'));var path=require('path');var sox=require(_0x37a6('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37a6('0x5'));var _=require('lodash');var squel=require(_0x37a6('0x6'));var crypto=require(_0x37a6('0x7'));var jsforce=require(_0x37a6('0x8'));var deskjs=require(_0x37a6('0x9'));var toCsv=require(_0x37a6('0xa'));var querystring=require(_0x37a6('0xb'));var Papa=require('papaparse');var Redis=require(_0x37a6('0xc'));var authService=require(_0x37a6('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x37a6('0xe'))(_0x37a6('0xf'));var utils=require(_0x37a6('0x10'));var config=require(_0x37a6('0x11'));var licenseUtil=require(_0x37a6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27f277,_0x5ba285){_0x5ba285=_0x5ba285||0xcc;return function(_0x3cecca){if(_0x3cecca){return _0x27f277['sendStatus'](_0x5ba285);}return _0x27f277[_0x37a6('0x13')](_0x5ba285)[_0x37a6('0x14')]();};}function respondWithResult(_0x9216a,_0x3c770f){_0x3c770f=_0x3c770f||0xc8;return function(_0x34b617){if(_0x34b617){return _0x9216a[_0x37a6('0x13')](_0x3c770f)[_0x37a6('0x15')](_0x34b617);}};}function respondWithFilteredResult(_0x1674ab,_0x580ad0){return function(_0x33deb0){if(_0x33deb0){var _0x5e1dc4=typeof _0x580ad0[_0x37a6('0x16')]==='undefined'&&typeof _0x580ad0[_0x37a6('0x17')]===_0x37a6('0x18');var _0x2bb337=_0x33deb0[_0x37a6('0x19')];var _0x494f7b=_0x5e1dc4?0x0:_0x580ad0[_0x37a6('0x16')];var _0x165e21=_0x5e1dc4?_0x33deb0[_0x37a6('0x19')]:_0x580ad0[_0x37a6('0x16')]+_0x580ad0[_0x37a6('0x17')];var _0x214922;if(_0x165e21>=_0x2bb337){_0x165e21=_0x2bb337;_0x214922=0xc8;}else{_0x214922=0xce;}_0x1674ab[_0x37a6('0x13')](_0x214922);return _0x1674ab['set'](_0x37a6('0x1a'),_0x494f7b+'-'+_0x165e21+'/'+_0x2bb337)[_0x37a6('0x15')](_0x33deb0);}return null;};}function patchUpdates(_0x17cb9b){return function(_0x34c704){try{jsonpatch[_0x37a6('0x1b')](_0x34c704,_0x17cb9b,!![]);}catch(_0x3be542){return BPromise['reject'](_0x3be542);}return _0x34c704['save']();};}function saveUpdates(_0x3de550,_0x54aaba){return function(_0x4b5c83){if(_0x4b5c83){return _0x4b5c83[_0x37a6('0x1c')](_0x3de550)[_0x37a6('0x1d')](function(_0x2268a){return _0x2268a;});}return null;};}function removeEntity(_0x115618,_0x2b6174){return function(_0x19417c){if(_0x19417c){return _0x19417c['destroy']()[_0x37a6('0x1d')](function(){_0x115618[_0x37a6('0x13')](0xcc)[_0x37a6('0x14')]();});}};}function handleEntityNotFound(_0x23e05c,_0x3df2a9){return function(_0x3b1fea){if(!_0x3b1fea){_0x23e05c[_0x37a6('0x1e')](0x194);}return _0x3b1fea;};}function handleError(_0x5a113e,_0x599b62){_0x599b62=_0x599b62||0x1f4;return function(_0x5eb9c9){logger['error'](_0x5eb9c9[_0x37a6('0x1f')]);if(_0x5eb9c9[_0x37a6('0x20')]){delete _0x5eb9c9[_0x37a6('0x20')];}_0x5a113e[_0x37a6('0x13')](_0x599b62)[_0x37a6('0x21')](_0x5eb9c9);};}var utilLicense=require(_0x37a6('0x12'));exports[_0x37a6('0x22')]=function(_0x480ddd,_0x36e2f1){var _0x2b3f80={'raw':!![],'where':{'id':0x1}},_0x21ea65={};_0x21ea65['model']=_['keys'](db['License'][_0x37a6('0x23')]);_0x21ea65[_0x37a6('0x24')]=_[_0x37a6('0x25')](_0x480ddd[_0x37a6('0x24')]);_0x21ea65['filters']=_[_0x37a6('0x26')](_0x21ea65[_0x37a6('0x27')],_0x21ea65[_0x37a6('0x24')]);_0x2b3f80[_0x37a6('0x28')]=_['intersection'](_0x21ea65[_0x37a6('0x27')],qs[_0x37a6('0x29')](_0x480ddd[_0x37a6('0x24')][_0x37a6('0x29')]));_0x2b3f80[_0x37a6('0x28')]=_0x2b3f80[_0x37a6('0x28')][_0x37a6('0x2a')]?_0x2b3f80[_0x37a6('0x28')]:_0x21ea65[_0x37a6('0x27')];_0x2b3f80=_[_0x37a6('0x2b')]({},_0x2b3f80,_0x480ddd[_0x37a6('0x2c')]);return utilLicense[_0x37a6('0x2d')](_0x2b3f80)[_0x37a6('0x1d')](respondWithResult(_0x36e2f1,null))[_0x37a6('0x2e')](handleError(_0x36e2f1,null));};exports[_0x37a6('0x1c')]=function(_0x29bae5,_0x5186fa){if(_0x29bae5[_0x37a6('0x2f')]['id']){delete _0x29bae5['body']['id'];}return db['License'][_0x37a6('0x30')]({'where':{'id':_0x29bae5[_0x37a6('0x31')]['id']}})[_0x37a6('0x1d')](handleEntityNotFound(_0x5186fa,null))[_0x37a6('0x1d')](function(_0x21dd41){var _0x194ce8=_0x21dd41['get']({'plain':!![]});return utilLicense[_0x37a6('0x32')](_0x194ce8,_0x29bae5[_0x37a6('0x2f')][_0x37a6('0x33')]);})[_0x37a6('0x1d')](function(_0x292e60){if(!_0x292e60[_0x37a6('0x34')]){return saveUpdates(_0x29bae5[_0x37a6('0x2f')],null);}return _0x292e60;})['then'](respondWithResult(_0x5186fa,null))[_0x37a6('0x2e')](handleError(_0x5186fa,null));};exports[_0x37a6('0x35')]=function(_0x4396b8,_0x366b82){var _0x51e9af='license-info.log';var _0x41f446=path[_0x37a6('0x36')](_0x37a6('0x37'),'log',_0x37a6('0x38'),_0x51e9af);_0x366b82['setHeader'](_0x37a6('0x39'),_0x37a6('0x3a')+_0x51e9af);_0x366b82['set']('Content-Type',_0x37a6('0x3b'));_0x366b82['download'](_0x41f446);}; \ No newline at end of file +var _0x08db=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','catch','body','find','params','get','checkLicense','demo','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','set','text/plain','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x443450,_0x3eef44){var _0x31e6a1=function(_0x279b95){while(--_0x279b95){_0x443450['push'](_0x443450['shift']());}};_0x31e6a1(++_0x3eef44);}(_0x08db,0xd8));var _0xb08d=function(_0x251d43,_0xd5a05a){_0x251d43=_0x251d43-0x0;var _0x3d7759=_0x08db[_0x251d43];return _0x3d7759;};'use strict';var emlformat=require(_0xb08d('0x0'));var rimraf=require(_0xb08d('0x1'));var zipdir=require(_0xb08d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb08d('0x3'));var moment=require(_0xb08d('0x4'));var BPromise=require(_0xb08d('0x5'));var Mustache=require(_0xb08d('0x6'));var util=require(_0xb08d('0x7'));var path=require(_0xb08d('0x8'));var sox=require(_0xb08d('0x9'));var csv=require(_0xb08d('0xa'));var ejs=require(_0xb08d('0xb'));var fs=require('fs');var fs_extra=require(_0xb08d('0xc'));var _=require(_0xb08d('0xd'));var squel=require('squel');var crypto=require(_0xb08d('0xe'));var jsforce=require(_0xb08d('0xf'));var deskjs=require(_0xb08d('0x10'));var toCsv=require(_0xb08d('0xa'));var querystring=require(_0xb08d('0x11'));var Papa=require(_0xb08d('0x12'));var Redis=require('ioredis');var authService=require(_0xb08d('0x13'));var qs=require(_0xb08d('0x14'));var as=require(_0xb08d('0x15'));var hardwareService=require(_0xb08d('0x16'));var logger=require(_0xb08d('0x17'))(_0xb08d('0x18'));var utils=require(_0xb08d('0x19'));var config=require(_0xb08d('0x1a'));var licenseUtil=require(_0xb08d('0x1b'));var db=require(_0xb08d('0x1c'))['db'];function respondWithStatusCode(_0x44bae5,_0x12dc9d){_0x12dc9d=_0x12dc9d||0xcc;return function(_0x582bb5){if(_0x582bb5){return _0x44bae5[_0xb08d('0x1d')](_0x12dc9d);}return _0x44bae5[_0xb08d('0x1e')](_0x12dc9d)[_0xb08d('0x1f')]();};}function respondWithResult(_0x3dbe66,_0x347d4e){_0x347d4e=_0x347d4e||0xc8;return function(_0x36e35b){if(_0x36e35b){return _0x3dbe66[_0xb08d('0x1e')](_0x347d4e)['json'](_0x36e35b);}};}function respondWithFilteredResult(_0x2ea5c6,_0x46d25f){return function(_0x14f767){if(_0x14f767){var _0x3264d8=typeof _0x46d25f[_0xb08d('0x20')]===_0xb08d('0x21')&&typeof _0x46d25f[_0xb08d('0x22')]==='undefined';var _0x402d89=_0x14f767[_0xb08d('0x23')];var _0x58a609=_0x3264d8?0x0:_0x46d25f[_0xb08d('0x20')];var _0x381a06=_0x3264d8?_0x14f767['count']:_0x46d25f[_0xb08d('0x20')]+_0x46d25f['limit'];var _0xda7021;if(_0x381a06>=_0x402d89){_0x381a06=_0x402d89;_0xda7021=0xc8;}else{_0xda7021=0xce;}_0x2ea5c6[_0xb08d('0x1e')](_0xda7021);return _0x2ea5c6['set'](_0xb08d('0x24'),_0x58a609+'-'+_0x381a06+'/'+_0x402d89)['json'](_0x14f767);}return null;};}function patchUpdates(_0x58e5e3){return function(_0x2bbd8f){try{jsonpatch[_0xb08d('0x25')](_0x2bbd8f,_0x58e5e3,!![]);}catch(_0x3ebcd7){return BPromise[_0xb08d('0x26')](_0x3ebcd7);}return _0x2bbd8f['save']();};}function saveUpdates(_0x2eb510,_0x4e0990){return function(_0x552713){if(_0x552713){return _0x552713[_0xb08d('0x27')](_0x2eb510)[_0xb08d('0x28')](function(_0x223893){return _0x223893;});}return null;};}function removeEntity(_0x1f68b5,_0x370ae4){return function(_0x1ca85b){if(_0x1ca85b){return _0x1ca85b['destroy']()['then'](function(){_0x1f68b5[_0xb08d('0x1e')](0xcc)[_0xb08d('0x1f')]();});}};}function handleEntityNotFound(_0x8dc9d8,_0x10128a){return function(_0x17e3fb){if(!_0x17e3fb){_0x8dc9d8['sendStatus'](0x194);}return _0x17e3fb;};}function handleError(_0x2983b5,_0x9483c6){_0x9483c6=_0x9483c6||0x1f4;return function(_0x35dadb){logger[_0xb08d('0x29')](_0x35dadb[_0xb08d('0x2a')]);if(_0x35dadb[_0xb08d('0x2b')]){delete _0x35dadb['name'];}_0x2983b5[_0xb08d('0x1e')](_0x9483c6)[_0xb08d('0x2c')](_0x35dadb);};}var utilLicense=require('../../config/license/util');exports[_0xb08d('0x2d')]=function(_0x531888,_0xc6c6fa){var _0x143828={'raw':!![],'where':{'id':0x1}},_0x4aae89={};_0x4aae89['model']=_[_0xb08d('0x2e')](db[_0xb08d('0x2f')][_0xb08d('0x30')]);_0x4aae89[_0xb08d('0x31')]=_[_0xb08d('0x2e')](_0x531888[_0xb08d('0x31')]);_0x4aae89[_0xb08d('0x32')]=_[_0xb08d('0x33')](_0x4aae89[_0xb08d('0x34')],_0x4aae89['query']);_0x143828[_0xb08d('0x35')]=_['intersection'](_0x4aae89[_0xb08d('0x34')],qs[_0xb08d('0x36')](_0x531888[_0xb08d('0x31')][_0xb08d('0x36')]));_0x143828['attributes']=_0x143828['attributes'][_0xb08d('0x37')]?_0x143828[_0xb08d('0x35')]:_0x4aae89[_0xb08d('0x34')];_0x143828=_[_0xb08d('0x38')]({},_0x143828,_0x531888[_0xb08d('0x39')]);return utilLicense['getLicense'](_0x143828)[_0xb08d('0x28')](respondWithResult(_0xc6c6fa,null))[_0xb08d('0x3a')](handleError(_0xc6c6fa,null));};exports[_0xb08d('0x27')]=function(_0x160be8,_0xe8c642){if(_0x160be8[_0xb08d('0x3b')]['id']){delete _0x160be8['body']['id'];}return db[_0xb08d('0x2f')][_0xb08d('0x3c')]({'where':{'id':_0x160be8[_0xb08d('0x3d')]['id']}})[_0xb08d('0x28')](handleEntityNotFound(_0xe8c642,null))[_0xb08d('0x28')](function(_0x34d68c){var _0x1272e6=_0x34d68c[_0xb08d('0x3e')]({'plain':!![]});return utilLicense[_0xb08d('0x3f')](_0x1272e6,_0x160be8[_0xb08d('0x3b')]['key']);})[_0xb08d('0x28')](function(_0x39b201){if(!_0x39b201[_0xb08d('0x40')]){return saveUpdates(_0x160be8[_0xb08d('0x3b')],null);}return _0x39b201;})[_0xb08d('0x28')](respondWithResult(_0xe8c642,null))['catch'](handleError(_0xe8c642,null));};exports[_0xb08d('0x41')]=function(_0x4c824a,_0x3993e9){var _0x15a9ef=_0xb08d('0x42');var _0x50c4de=path[_0xb08d('0x43')](_0xb08d('0x44'),_0xb08d('0x45'),_0xb08d('0x46'),_0x15a9ef);_0x3993e9['setHeader'](_0xb08d('0x47'),'attachment;\x20filename='+_0x15a9ef);_0x3993e9[_0xb08d('0x48')]('Content-Type',_0xb08d('0x49'));_0x3993e9['download'](_0x50c4de);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7f5a0f0..ef8c6a6 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 _0x58b2=['./license.attributes','License','license','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x253541,_0x516818){var _0x4fdbaf=function(_0x5816c2){while(--_0x5816c2){_0x253541['push'](_0x253541['shift']());}};_0x4fdbaf(++_0x516818);}(_0x58b2,0xd5));var _0x258b=function(_0x18c44d,_0x33976d){_0x18c44d=_0x18c44d-0x0;var _0x71abcf=_0x58b2[_0x18c44d];return _0x71abcf;};'use strict';var _=require(_0x258b('0x0'));var util=require(_0x258b('0x1'));var logger=require('../../config/logger')(_0x258b('0x2'));var moment=require(_0x258b('0x3'));var BPromise=require('bluebird');var rp=require(_0x258b('0x4'));var fs=require('fs');var path=require(_0x258b('0x5'));var rimraf=require('rimraf');var config=require(_0x258b('0x6'));var attributes=require(_0x258b('0x7'));module['exports']=function(_0x8da836,_0x61b608){return _0x8da836['define'](_0x258b('0x8'),attributes,{'tableName':_0x258b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c94=['../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0x9c94,0x1e2));var _0x49c9=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x9c94[_0x1bc013];return _0x55df36;};'use strict';var _=require(_0x49c9('0x0'));var util=require(_0x49c9('0x1'));var logger=require(_0x49c9('0x2'))(_0x49c9('0x3'));var moment=require(_0x49c9('0x4'));var BPromise=require('bluebird');var rp=require(_0x49c9('0x5'));var fs=require('fs');var path=require(_0x49c9('0x6'));var rimraf=require(_0x49c9('0x7'));var config=require(_0x49c9('0x8'));var attributes=require(_0x49c9('0x9'));module[_0x49c9('0xa')]=function(_0x328a02,_0x4c4ab3){return _0x328a02[_0x49c9('0xb')](_0x49c9('0xc'),attributes,{'tableName':_0x49c9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index a8f1f8b..f1e2a06 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 _0x10e8=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x10e8,0x13a));var _0x810e=function(_0x2bd453,_0x322572){_0x2bd453=_0x2bd453-0x0;var _0x36c295=_0x10e8[_0x2bd453];return _0x36c295;};'use strict';var _=require(_0x810e('0x0'));var util=require(_0x810e('0x1'));var moment=require(_0x810e('0x2'));var BPromise=require(_0x810e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x810e('0x4'));var db=require(_0x810e('0x5'))['db'];var utils=require(_0x810e('0x6'));var logger=require(_0x810e('0x7'))('rpc');var config=require(_0x810e('0x8'));var jayson=require(_0x810e('0x9'));var client=jayson[_0x810e('0xa')][_0x810e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2abc04,_0x55e377,_0x1f36c2){return new BPromise(function(_0x21b280,_0x120c0f){return client['request'](_0x2abc04,_0x1f36c2)['then'](function(_0xc8e8fc){logger[_0x810e('0xc')](_0x810e('0xd'),_0x55e377,_0x810e('0xe'));logger[_0x810e('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x55e377,'request\x20sent',JSON[_0x810e('0x10')](_0xc8e8fc));if(_0xc8e8fc[_0x810e('0x11')]){if(_0xc8e8fc[_0x810e('0x11')]['code']===0x1f4){logger['error'](_0x810e('0xd'),_0x55e377,_0xc8e8fc['error']['message']);return _0x120c0f(_0xc8e8fc[_0x810e('0x11')]['message']);}logger['error'](_0x810e('0xd'),_0x55e377,_0xc8e8fc['error'][_0x810e('0x12')]);return _0x21b280(_0xc8e8fc[_0x810e('0x11')][_0x810e('0x12')]);}else{logger[_0x810e('0xc')](_0x810e('0xd'),_0x55e377,_0x810e('0xe'));_0x21b280(_0xc8e8fc[_0x810e('0x13')][_0x810e('0x12')]);}})[_0x810e('0x14')](function(_0x11f8e5){logger[_0x810e('0x11')](_0x810e('0xd'),_0x55e377,_0x11f8e5);_0x120c0f(_0x11f8e5);});});} \ No newline at end of file +var _0xb9cd=['stringify','error','code','License,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xb9cd,0xed));var _0xdb9c=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0xb9cd[_0x575b72];return _0x561c57;};'use strict';var _=require('lodash');var util=require(_0xdb9c('0x0'));var moment=require(_0xdb9c('0x1'));var BPromise=require(_0xdb9c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb9c('0x3'));var db=require(_0xdb9c('0x4'))['db'];var utils=require(_0xdb9c('0x5'));var logger=require(_0xdb9c('0x6'))(_0xdb9c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb9c('0x8')][_0xdb9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3903b8,_0x164646,_0x555217){return new BPromise(function(_0x34fab6,_0x28f588){return client[_0xdb9c('0xa')](_0x3903b8,_0x555217)[_0xdb9c('0xb')](function(_0x5e93da){logger['info']('License,\x20%s,\x20%s',_0x164646,'request\x20sent');logger[_0xdb9c('0xc')](_0xdb9c('0xd'),_0x164646,_0xdb9c('0xe'),JSON[_0xdb9c('0xf')](_0x5e93da));if(_0x5e93da[_0xdb9c('0x10')]){if(_0x5e93da[_0xdb9c('0x10')][_0xdb9c('0x11')]===0x1f4){logger[_0xdb9c('0x10')](_0xdb9c('0x12'),_0x164646,_0x5e93da[_0xdb9c('0x10')]['message']);return _0x28f588(_0x5e93da[_0xdb9c('0x10')]['message']);}logger[_0xdb9c('0x10')]('License,\x20%s,\x20%s',_0x164646,_0x5e93da[_0xdb9c('0x10')][_0xdb9c('0x13')]);return _0x34fab6(_0x5e93da[_0xdb9c('0x10')][_0xdb9c('0x13')]);}else{logger['info'](_0xdb9c('0x12'),_0x164646,'request\x20sent');_0x34fab6(_0x5e93da[_0xdb9c('0x14')][_0xdb9c('0x13')]);}})['catch'](function(_0xbf0b64){logger['error'](_0xdb9c('0x12'),_0x164646,_0xbf0b64);_0x28f588(_0xbf0b64);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index cf676eb..13d8f06 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 _0x4005=['addApplications','/:id/send','send','/:id/users','put','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post','/:id/canned_answers','create','addInteraction'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x4005,0x17c));var _0x5400=function(_0x4a09bf,_0x45b7c0){_0x4a09bf=_0x4a09bf-0x0;var _0x5cbad8=_0x4005[_0x4a09bf];return _0x5cbad8;};'use strict';var multer=require(_0x5400('0x0'));var util=require('util');var path=require(_0x5400('0x1'));var timeout=require(_0x5400('0x2'));var express=require(_0x5400('0x3'));var router=express[_0x5400('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5400('0x5'));var config=require(_0x5400('0x6'));var controller=require(_0x5400('0x7'));router[_0x5400('0x8')]('/',auth[_0x5400('0x9')](),controller[_0x5400('0xa')]);router['get'](_0x5400('0xb'),auth[_0x5400('0x9')](),controller['describe']);router[_0x5400('0x8')](_0x5400('0xc'),auth['isAuthenticated'](),controller[_0x5400('0xd')]);router[_0x5400('0x8')](_0x5400('0xe'),auth[_0x5400('0x9')](),controller['getDispositions']);router[_0x5400('0x8')]('/:id/canned_answers',auth[_0x5400('0x9')](),controller[_0x5400('0xf')]);router[_0x5400('0x8')](_0x5400('0x10'),auth['isAuthenticated'](),controller[_0x5400('0x11')]);router['get'](_0x5400('0x12'),auth[_0x5400('0x9')](),controller['getSmtp']);router['get'](_0x5400('0x13'),auth[_0x5400('0x9')](),controller['getInteractions']);router[_0x5400('0x8')](_0x5400('0x14'),auth[_0x5400('0x9')](),controller[_0x5400('0x15')]);router['get'](_0x5400('0x16'),auth[_0x5400('0x9')](),controller[_0x5400('0x17')]);router[_0x5400('0x8')]('/:id/verify',auth[_0x5400('0x9')](),controller[_0x5400('0x18')]);router['get']('/:id/users',auth[_0x5400('0x9')](),controller[_0x5400('0x19')]);router[_0x5400('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x5400('0x1a')](_0x5400('0x1b'),auth[_0x5400('0x9')](),controller['addAnswer']);router[_0x5400('0x1a')]('/',auth['isAuthenticated'](),controller[_0x5400('0x1c')]);router[_0x5400('0x1a')]('/:id/in_servers',auth[_0x5400('0x9')](),controller['addImap']);router[_0x5400('0x1a')](_0x5400('0x12'),auth['isAuthenticated'](),controller['addSmtp']);router['post'](_0x5400('0x13'),auth[_0x5400('0x9')](),controller[_0x5400('0x1d')]);router[_0x5400('0x1a')]('/:id/applications',auth[_0x5400('0x9')](),controller[_0x5400('0x1e')]);router[_0x5400('0x1a')](_0x5400('0x1f'),auth[_0x5400('0x9')](),controller[_0x5400('0x20')]);router[_0x5400('0x1a')](_0x5400('0x21'),auth['isAuthenticated'](),controller['addAgents']);router[_0x5400('0x22')](_0x5400('0xc'),auth[_0x5400('0x9')](),controller['update']);router[_0x5400('0x23')](_0x5400('0xe'),auth[_0x5400('0x9')](),controller[_0x5400('0x24')]);router['delete']('/:id/canned_answers',auth[_0x5400('0x9')](),controller['removeAnswers']);router[_0x5400('0x23')]('/:id/in_servers',auth[_0x5400('0x9')](),controller[_0x5400('0x25')]);router[_0x5400('0x23')](_0x5400('0x12'),auth[_0x5400('0x9')](),controller[_0x5400('0x26')]);router[_0x5400('0x23')](_0x5400('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x5400('0x23')](_0x5400('0x21'),auth[_0x5400('0x9')](),controller[_0x5400('0x27')]);module[_0x5400('0x28')]=router; \ No newline at end of file +var _0x20b1=['verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','create','/:id/in_servers','addImap','addSmtp','addApplications','/:id/send','addAgents','put','/:id','update','removeDispositions','removeAnswers','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','isAuthenticated','describe','show','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0x20b1,0xb6));var _0x120b=function(_0x408b99,_0x1c2264){_0x408b99=_0x408b99-0x0;var _0x30d984=_0x20b1[_0x408b99];return _0x30d984;};'use strict';var multer=require(_0x120b('0x0'));var util=require(_0x120b('0x1'));var path=require(_0x120b('0x2'));var timeout=require(_0x120b('0x3'));var express=require('express');var router=express[_0x120b('0x4')]();var fs_extra=require(_0x120b('0x5'));var auth=require(_0x120b('0x6'));var interaction=require(_0x120b('0x7'));var config=require(_0x120b('0x8'));var controller=require(_0x120b('0x9'));router[_0x120b('0xa')]('/',auth['isAuthenticated'](),controller[_0x120b('0xb')]);router[_0x120b('0xa')]('/describe',auth[_0x120b('0xc')](),controller[_0x120b('0xd')]);router[_0x120b('0xa')]('/:id',auth[_0x120b('0xc')](),controller[_0x120b('0xe')]);router['get']('/:id/dispositions',auth[_0x120b('0xc')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x120b('0xc')](),controller[_0x120b('0xf')]);router[_0x120b('0xa')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x120b('0x10')]);router[_0x120b('0xa')](_0x120b('0x11'),auth['isAuthenticated'](),controller[_0x120b('0x12')]);router[_0x120b('0xa')](_0x120b('0x13'),auth[_0x120b('0xc')](),controller[_0x120b('0x14')]);router[_0x120b('0xa')](_0x120b('0x15'),auth['isAuthenticated'](),controller[_0x120b('0x16')]);router[_0x120b('0xa')](_0x120b('0x17'),auth['isAuthenticated'](),controller[_0x120b('0x18')]);router[_0x120b('0xa')](_0x120b('0x19'),auth[_0x120b('0xc')](),controller[_0x120b('0x1a')]);router['get'](_0x120b('0x1b'),auth['isAuthenticated'](),controller[_0x120b('0x1c')]);router[_0x120b('0x1d')](_0x120b('0x1e'),auth[_0x120b('0xc')](),controller[_0x120b('0x1f')]);router['post'](_0x120b('0x20'),auth[_0x120b('0xc')](),controller[_0x120b('0x21')]);router[_0x120b('0x1d')]('/',auth[_0x120b('0xc')](),controller[_0x120b('0x22')]);router[_0x120b('0x1d')](_0x120b('0x23'),auth['isAuthenticated'](),controller[_0x120b('0x24')]);router[_0x120b('0x1d')](_0x120b('0x11'),auth[_0x120b('0xc')](),controller[_0x120b('0x25')]);router['post'](_0x120b('0x13'),auth[_0x120b('0xc')](),controller['addInteraction']);router[_0x120b('0x1d')](_0x120b('0x15'),auth[_0x120b('0xc')](),controller[_0x120b('0x26')]);router[_0x120b('0x1d')](_0x120b('0x27'),auth[_0x120b('0xc')](),controller['send']);router[_0x120b('0x1d')](_0x120b('0x1b'),auth['isAuthenticated'](),controller[_0x120b('0x28')]);router[_0x120b('0x29')](_0x120b('0x2a'),auth['isAuthenticated'](),controller[_0x120b('0x2b')]);router['delete'](_0x120b('0x1e'),auth[_0x120b('0xc')](),controller[_0x120b('0x2c')]);router['delete'](_0x120b('0x20'),auth[_0x120b('0xc')](),controller[_0x120b('0x2d')]);router[_0x120b('0x2e')](_0x120b('0x23'),auth['isAuthenticated'](),controller[_0x120b('0x2f')]);router[_0x120b('0x2e')](_0x120b('0x11'),auth[_0x120b('0xc')](),controller[_0x120b('0x30')]);router[_0x120b('0x2e')](_0x120b('0x2a'),auth[_0x120b('0xc')](),controller[_0x120b('0x31')]);router[_0x120b('0x2e')](_0x120b('0x1b'),auth[_0x120b('0xc')](),controller[_0x120b('0x32')]);module[_0x120b('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 10ed23e..04a00be 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 _0xa421=['UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x529b01,_0x2974dc){var _0x5b27bd=function(_0x2518b3){while(--_0x2518b3){_0x529b01['push'](_0x529b01['shift']());}};_0x5b27bd(++_0x2974dc);}(_0xa421,0x1b4));var _0x1a42=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xa421[_0x10004e];return _0x5af990;};'use strict';var Sequelize=require(_0x1a42('0x0'));module[_0x1a42('0x1')]={'description':{'type':Sequelize[_0x1a42('0x2')]},'name':{'type':Sequelize[_0x1a42('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1a42('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1a42('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1a42('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1a42('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1a42('0x2')],'allowNull':![],'defaultValue':_0x1a42('0x4')},'fontSize':{'type':Sequelize[_0x1a42('0x5')](0x2)[_0x1a42('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1a42('0x7');}},'notificationSound':{'type':Sequelize[_0x1a42('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a42('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a42('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a42('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a42('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a42('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x47f5f3){if(!_0x47f5f3)this[_0x1a42('0x8')](_0x1a42('0x9'),null);this[_0x1a42('0x8')](_0x1a42('0xa'),_0x47f5f3);}},'provider':{'type':Sequelize[_0x1a42('0xb')](_0x1a42('0xc'),_0x1a42('0xd'),_0x1a42('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x1a42('0xf')](_0x1a42('0x10')))return'custom';return this['getDataValue'](_0x1a42('0x10'));},'set':function(_0x227508){if(_0x227508==='custom')_0x227508=null;return this['setDataValue'](_0x1a42('0x10'),_0x227508);}}}; \ No newline at end of file +var _0x391c=['UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x20777a,_0x3962ab){var _0x52ee5d=function(_0x5e8cb9){while(--_0x5e8cb9){_0x20777a['push'](_0x20777a['shift']());}};_0x52ee5d(++_0x3962ab);}(_0x391c,0xc1));var _0xc391=function(_0x35e9e3,_0x2fc4dd){_0x35e9e3=_0x35e9e3-0x0;var _0x5f0e97=_0x391c[_0x35e9e3];return _0x5f0e97;};'use strict';var Sequelize=require(_0xc391('0x0'));module['exports']={'description':{'type':Sequelize[_0xc391('0x1')]},'name':{'type':Sequelize[_0xc391('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc391('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc391('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc391('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc391('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc391('0x1')],'allowNull':![],'defaultValue':_0xc391('0x3')},'fontSize':{'type':Sequelize[_0xc391('0x4')](0x2)[_0xc391('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc391('0x6')],'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[_0xc391('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc391('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc391('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc391('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc391('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc391('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc391('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xc391('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xc391('0x2')],'defaultValue':![],'comment':_0xc391('0x8'),'set':function(_0x1e5464){if(!_0x1e5464)this[_0xc391('0x9')]('mandatoryDispositionPauseId',null);this[_0xc391('0x9')](_0xc391('0xa'),_0x1e5464);}},'provider':{'type':Sequelize[_0xc391('0xb')](_0xc391('0xc'),'hotmail',_0xc391('0xd'),_0xc391('0xe')),'defaultValue':null,'get':function(){if(!this[_0xc391('0xf')](_0xc391('0x10')))return _0xc391('0x11');return this[_0xc391('0xf')](_0xc391('0x10'));},'set':function(_0x40296c){if(_0x40296c==='custom')_0x40296c=null;return this[_0xc391('0x9')](_0xc391('0x10'),_0x40296c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f75f2ad..e45bc86 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 _0x6640=['status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Smtp','index','MailServerIn','Imap','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','body','provider','custom','Mail\x20Account\x20not\x20found','MailServerOut','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','merge','removeDispositions','addAnswer','getAnswers','CannedAnswer','ids','key','email','ListId','active','description','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','color','tag','sequelize','Transaction','MailApplication','bulkCreate','finally','getApplications','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','CmContact','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','Contacts','messageId','attach','out','Interaction','Messages','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus'];(function(_0x34bcfa,_0x463600){var _0x3734cd=function(_0x1f329b){while(--_0x1f329b){_0x34bcfa['push'](_0x34bcfa['shift']());}};_0x3734cd(++_0x463600);}(_0x6640,0xa7));var _0x0664=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x6640[_0x4a0e68];return _0x4fb274;};'use strict';var moment=require(_0x0664('0x0'));var BPromise=require(_0x0664('0x1'));var util=require(_0x0664('0x2'));var path=require(_0x0664('0x3'));var _=require(_0x0664('0x4'));var juice=require(_0x0664('0x5'));var Redis=require(_0x0664('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x0664('0x7'))(_0x0664('0x8'));var config=require(_0x0664('0x9'));var db=require(_0x0664('0xa'))['db'];config['redis']=_[_0x0664('0xb')](config[_0x0664('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0664('0xd'))(new Redis(config[_0x0664('0xc')]));require(_0x0664('0xe'))['register'](socket);var jayson=require(_0x0664('0xf'));var client=jayson[_0x0664('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x46f98f,_0x19d3eb,_0x847b55,_0x28d114){return new BPromise(function(_0x2bc373,_0x3f1436){var _0x181e4b=_0x28d114||client;return _0x181e4b[_0x0664('0x11')](_0x46f98f,_0x847b55)[_0x0664('0x12')](function(_0x5cf00a){logger[_0x0664('0x13')](_0x0664('0x14'),_0x19d3eb,_0x0664('0x15'));logger[_0x0664('0x16')](_0x0664('0x17'),_0x19d3eb,_0x0664('0x15'),JSON[_0x0664('0x18')](_0x5cf00a));if(_0x5cf00a[_0x0664('0x19')]){if(_0x5cf00a[_0x0664('0x19')]['code']===0x1f4){logger[_0x0664('0x19')]('MailAccount,\x20%s,\x20%s',_0x19d3eb,_0x5cf00a[_0x0664('0x19')][_0x0664('0x1a')]);return _0x3f1436(_0x5cf00a[_0x0664('0x19')][_0x0664('0x1a')]);}logger[_0x0664('0x19')]('MailAccount,\x20%s,\x20%s',_0x19d3eb,_0x5cf00a[_0x0664('0x19')]['message']);return _0x2bc373(_0x5cf00a[_0x0664('0x19')][_0x0664('0x1a')]);}else{logger[_0x0664('0x13')](_0x0664('0x14'),_0x19d3eb,_0x0664('0x15'));_0x2bc373(_0x5cf00a[_0x0664('0x1b')][_0x0664('0x1a')]);}})['catch'](function(_0x2688dc){logger[_0x0664('0x19')]('MailAccount,\x20%s,\x20%s',_0x19d3eb,_0x2688dc);_0x3f1436(_0x2688dc);});});}function respondWithStatusCode(_0x47bc8d,_0x16267c){_0x16267c=_0x16267c||0xcc;return function(_0x13884d){if(_0x13884d){return _0x47bc8d[_0x0664('0x1c')](_0x16267c);}return _0x47bc8d[_0x0664('0x1d')](_0x16267c)['end']();};}function respondWithResult(_0x1c18ba,_0x3a41c6){_0x3a41c6=_0x3a41c6||0xc8;return function(_0x46f9a0){if(_0x46f9a0){return _0x1c18ba[_0x0664('0x1d')](_0x3a41c6)[_0x0664('0x1e')](_0x46f9a0);}};}function respondWithFilteredResult(_0x302012,_0x40acf0){return function(_0x4f2c85){if(_0x4f2c85){var _0x263b11=typeof _0x40acf0[_0x0664('0x1f')]===_0x0664('0x20')&&typeof _0x40acf0['limit']===_0x0664('0x20');var _0x62c859=_0x4f2c85[_0x0664('0x21')];var _0x230f89=_0x263b11?0x0:_0x40acf0[_0x0664('0x1f')];var _0x4eee8c=_0x263b11?_0x4f2c85[_0x0664('0x21')]:_0x40acf0[_0x0664('0x1f')]+_0x40acf0[_0x0664('0x22')];var _0x2b1b6d;if(_0x4eee8c>=_0x62c859){_0x4eee8c=_0x62c859;_0x2b1b6d=0xc8;}else{_0x2b1b6d=0xce;}_0x302012[_0x0664('0x1d')](_0x2b1b6d);return _0x302012[_0x0664('0x23')](_0x0664('0x24'),_0x230f89+'-'+_0x4eee8c+'/'+_0x62c859)[_0x0664('0x1e')](_0x4f2c85);}return null;};}function saveUpdates(_0x2813c6){return function(_0x374c61){if(_0x374c61){return _0x374c61[_0x0664('0x25')](_0x2813c6)[_0x0664('0x12')](function(_0xb2c9dd){return _0xb2c9dd;});}return null;};}function removeEntity(_0x11a957){return function(_0x28cdd5){if(_0x28cdd5){return _0x28cdd5[_0x0664('0x26')]()[_0x0664('0x12')](function(){var _0xc0ea0=_0x28cdd5['get']({'plain':!![]});var _0x5187ed=_0x0664('0x27');return db[_0x0664('0x28')][_0x0664('0x26')]({'where':{'type':_0x5187ed,'resourceId':_0xc0ea0['id']}})[_0x0664('0x12')](function(){return _0x28cdd5;});})['then'](function(){_0x11a957[_0x0664('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25a70b){return function(_0x31b968){if(!_0x31b968){_0x25a70b[_0x0664('0x1c')](0x194);}return _0x31b968;};}function handleError(_0x6efb97,_0x4aeb9f){_0x4aeb9f=_0x4aeb9f||0x1f4;return function(_0x322a1f){logger[_0x0664('0x19')](_0x322a1f[_0x0664('0x29')]);if(_0x322a1f['name']){delete _0x322a1f[_0x0664('0x2a')];}_0x6efb97[_0x0664('0x1d')](_0x4aeb9f)[_0x0664('0x2b')](_0x322a1f);};}function getImapHost(_0x37b237){switch(_0x37b237){case _0x0664('0x2c'):return _0x0664('0x2d');case _0x0664('0x2e'):return'imap.mail.yahoo.com';case _0x0664('0x2f'):return _0x0664('0x30');case _0x0664('0x31'):return _0x0664('0x32');}throw new Error(_0x0664('0x33'),_0x37b237);}function getSmtpHost(_0x354c4d){switch(_0x354c4d){case _0x0664('0x2c'):return _0x0664('0x34');case _0x0664('0x2e'):return _0x0664('0x35');case _0x0664('0x2f'):return _0x0664('0x36');case'outlook365':return _0x0664('0x37');}throw new Error(_0x0664('0x33'),_0x354c4d);}function getAuthenticationOptions(_0x485a0b,_0xa0dc71){var _0x2d4cf3={};var _0x398303={};if(_0x485a0b){_0x2d4cf3[_0x0664('0x38')]=_0x398303[_0x0664('0x38')]=_0xa0dc71[_0x0664('0x39')];_0x2d4cf3[_0x0664('0x3a')]=_0x398303[_0x0664('0x3b')]=_0xa0dc71[_0x0664('0x3a')];if(_0xa0dc71['modernAuthentication']){_0x2d4cf3['modernAuthentication']=_0x398303[_0x0664('0x3c')]=!![];_0x2d4cf3[_0x0664('0x3d')]=_0x398303['CloudProviderId']=_0xa0dc71['CloudProviderId'];_0x2d4cf3[_0x0664('0x3a')]=_0x398303[_0x0664('0x3b')]=null;}else{_0x2d4cf3[_0x0664('0x3d')]=_0x398303[_0x0664('0x3d')]=null;}_0x2d4cf3[_0x0664('0x3e')]=getImapHost(_0x485a0b);_0x2d4cf3[_0x0664('0x3f')]=0x3e1;_0x398303[_0x0664('0x3e')]=getSmtpHost(_0x485a0b);_0x398303[_0x0664('0x3f')]=0x24b;_0x398303[_0x0664('0x40')]=![];_0x2d4cf3[_0x0664('0x41')]=_0x398303[_0x0664('0x41')]=null;}else{if(_0xa0dc71[_0x0664('0x42')]){_0x2d4cf3[_0x0664('0x38')]=_0x398303[_0x0664('0x38')]=_0xa0dc71[_0x0664('0x39')];_0x2d4cf3[_0x0664('0x3a')]=_0x398303[_0x0664('0x3b')]=_0xa0dc71['password'];}else{_0x2d4cf3[_0x0664('0x42')]=_0x398303['authentication']=![];_0x2d4cf3[_0x0664('0x38')]=_0x398303[_0x0664('0x38')]=null;_0x2d4cf3[_0x0664('0x3a')]=_0x398303[_0x0664('0x3b')]=null;}_0x2d4cf3[_0x0664('0x3e')]=_0xa0dc71['Imap'][_0x0664('0x3e')];_0x2d4cf3[_0x0664('0x3f')]=_0xa0dc71['Imap'][_0x0664('0x3f')];_0x398303[_0x0664('0x3e')]=_0xa0dc71[_0x0664('0x43')][_0x0664('0x3e')];_0x398303[_0x0664('0x3f')]=_0xa0dc71[_0x0664('0x43')][_0x0664('0x3f')];}return{'Imap':_0x2d4cf3,'Smtp':_0x398303};}exports[_0x0664('0x44')]=function(_0x511e8e,_0x498f8e){var _0x21ed5a={'include':[{'model':db[_0x0664('0x45')],'as':_0x0664('0x46')},{'model':db['MailServerOut'],'as':_0x0664('0x43')},{'model':db[_0x0664('0x47')],'as':_0x0664('0x48')}]},_0x4031bd={},_0xc3ad41={'count':0x0,'rows':[]};var _0x50cc39=_[_0x0664('0x49')](db[_0x0664('0x4a')][_0x0664('0x4b')],function(_0x5bf470){return{'name':_0x5bf470[_0x0664('0x4c')],'type':_0x5bf470['type']['key']};});_0x4031bd[_0x0664('0x4d')]=_[_0x0664('0x49')](_0x50cc39,_0x0664('0x2a'));_0x4031bd[_0x0664('0x4e')]=_[_0x0664('0x4f')](_0x511e8e[_0x0664('0x4e')]);_0x4031bd['filters']=_['intersection'](_0x4031bd[_0x0664('0x4d')],_0x4031bd[_0x0664('0x4e')]);_0x21ed5a[_0x0664('0x50')]=_[_0x0664('0x51')](_0x4031bd[_0x0664('0x4d')],qs['fields'](_0x511e8e[_0x0664('0x4e')][_0x0664('0x52')]));_0x21ed5a[_0x0664('0x50')]=_0x21ed5a[_0x0664('0x50')][_0x0664('0x53')]?_0x21ed5a[_0x0664('0x50')]:_0x4031bd[_0x0664('0x4d')];if(!_0x511e8e['query'][_0x0664('0x54')](_0x0664('0x55'))){_0x21ed5a[_0x0664('0x22')]=qs[_0x0664('0x22')](_0x511e8e[_0x0664('0x4e')][_0x0664('0x22')]);_0x21ed5a[_0x0664('0x1f')]=qs[_0x0664('0x1f')](_0x511e8e[_0x0664('0x4e')][_0x0664('0x1f')]);}_0x21ed5a['order']=qs[_0x0664('0x56')](_0x511e8e['query'][_0x0664('0x56')]);_0x21ed5a[_0x0664('0x57')]=qs['filters'](_[_0x0664('0x58')](_0x511e8e['query'],_0x4031bd[_0x0664('0x59')]),_0x50cc39);if(_0x511e8e[_0x0664('0x4e')][_0x0664('0x5a')]){_0x21ed5a['where']=_['merge'](_0x21ed5a[_0x0664('0x57')],{'$or':_['map'](_0x50cc39,function(_0x33e1de){if(_0x33e1de[_0x0664('0x5b')]!==_0x0664('0x5c')){var _0x384068={};_0x384068[_0x33e1de[_0x0664('0x2a')]]={'$like':'%'+_0x511e8e['query']['filter']+'%'};return _0x384068;}})});}_0x21ed5a=_['merge']({},_0x21ed5a,_0x511e8e[_0x0664('0x5d')]);var _0x4f6c41={'where':_0x21ed5a[_0x0664('0x57')]};return db['MailAccount'][_0x0664('0x21')](_0x4f6c41)['then'](function(_0x546e2a){_0xc3ad41[_0x0664('0x21')]=_0x546e2a;if(_0x511e8e[_0x0664('0x4e')][_0x0664('0x5e')]){_0x21ed5a['include']=[{'all':!![]}];}return db[_0x0664('0x4a')][_0x0664('0x5f')](_0x21ed5a);})[_0x0664('0x12')](function(_0x321111){_0xc3ad41[_0x0664('0x60')]=_0x321111;return _0xc3ad41;})[_0x0664('0x12')](respondWithFilteredResult(_0x498f8e,_0x21ed5a))['catch'](handleError(_0x498f8e,null));};exports[_0x0664('0x61')]=function(_0x8e4ea9,_0x10ec4f){var _0x2c867d={'raw':![],'where':{'id':_0x8e4ea9[_0x0664('0x62')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x0664('0x43')},{'model':db[_0x0664('0x47')],'as':_0x0664('0x48')}]},_0x2c14f6={};_0x2c14f6['model']=_['keys'](db[_0x0664('0x4a')]['rawAttributes']);_0x2c14f6[_0x0664('0x4e')]=_[_0x0664('0x4f')](_0x8e4ea9[_0x0664('0x4e')]);_0x2c14f6[_0x0664('0x59')]=_[_0x0664('0x51')](_0x2c14f6[_0x0664('0x4d')],_0x2c14f6[_0x0664('0x4e')]);_0x2c867d[_0x0664('0x50')]=_[_0x0664('0x51')](_0x2c14f6[_0x0664('0x4d')],qs[_0x0664('0x52')](_0x8e4ea9[_0x0664('0x4e')]['fields']));_0x2c867d[_0x0664('0x50')]=_0x2c867d[_0x0664('0x50')]['length']?_0x2c867d['attributes']:_0x2c14f6['model'];if(_0x8e4ea9['query']['includeAll']){_0x2c867d[_0x0664('0x63')]=[{'all':!![]}];}_0x2c867d=_['merge']({},_0x2c867d,_0x8e4ea9[_0x0664('0x5d')]);return db[_0x0664('0x4a')][_0x0664('0x64')](_0x2c867d)[_0x0664('0x12')](handleEntityNotFound(_0x10ec4f,null))[_0x0664('0x12')](respondWithResult(_0x10ec4f,null))[_0x0664('0x65')](handleError(_0x10ec4f,null));};exports[_0x0664('0x25')]=function(_0x586195,_0x2f9c98){if(_0x586195[_0x0664('0x66')]['id']){delete _0x586195[_0x0664('0x66')]['id'];}var _0x1d6314=_0x586195[_0x0664('0x66')][_0x0664('0x67')]===_0x0664('0x68')?null:_0x586195['body'][_0x0664('0x67')];var _0x3c5a3d=_0x586195['body'][_0x0664('0x46')]||{};var _0x2a6e6f=_0x586195[_0x0664('0x66')]['Smtp']||{};if(_0x1d6314){_0x3c5a3d[_0x0664('0x3e')]=getImapHost(_0x1d6314);_0x3c5a3d['port']=0x3e1;_0x2a6e6f['host']=getSmtpHost(_0x1d6314);_0x2a6e6f[_0x0664('0x3f')]=0x24b;_0x2a6e6f[_0x0664('0x40')]=![];}if(_0x2a6e6f[_0x0664('0x3c')]){_0x2a6e6f[_0x0664('0x40')]=![];}else{_0x2a6e6f['CloudProviderId']=null;}if(!_0x3c5a3d['modernAuthentication'])_0x3c5a3d[_0x0664('0x3d')]=null;_0x586195[_0x0664('0x66')]['Imap']=_0x3c5a3d;_0x586195[_0x0664('0x66')][_0x0664('0x43')]=_0x2a6e6f;return db[_0x0664('0x4a')][_0x0664('0x64')]({'where':{'id':_0x586195['params']['id']},'include':[{'model':db[_0x0664('0x45')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x0664('0x43')},{'model':db[_0x0664('0x47')],'as':_0x0664('0x48')}]})[_0x0664('0x12')](handleEntityNotFound(_0x2f9c98,null))['then'](function(_0xaa5564){if(!_0xaa5564)throw new Error(_0x0664('0x69'));if(_0xaa5564[_0x0664('0x41')])delete _0x586195['body']['Imap'];return _0xaa5564;})[_0x0664('0x12')](saveUpdates(_0x586195[_0x0664('0x66')],null))[_0x0664('0x12')](function(_0x584018){if(!_0x586195['body'][_0x0664('0x46')])return _0x584018;return db[_0x0664('0x45')][_0x0664('0x25')](_0x586195[_0x0664('0x66')]['Imap'],{'where':{'MailAccountId':_0x584018['id']}})['then'](function(){return _0x584018;});})[_0x0664('0x12')](function(_0xd6e6cf){if(!_0x586195[_0x0664('0x66')][_0x0664('0x43')])return _0xd6e6cf;return db[_0x0664('0x6a')][_0x0664('0x25')](_0x586195[_0x0664('0x66')][_0x0664('0x43')],{'where':{'MailAccountId':_0xd6e6cf['id']}})['then'](function(){return _0xd6e6cf;});})[_0x0664('0x12')](respondWithResult(_0x2f9c98,null))[_0x0664('0x65')](handleError(_0x2f9c98,null));};exports[_0x0664('0x6b')]=function(_0x76c832,_0x55b528){return db[_0x0664('0x4a')][_0x0664('0x6b')]()[_0x0664('0x12')](respondWithResult(_0x55b528,null))['catch'](handleError(_0x55b528,null));};exports[_0x0664('0x6c')]=function(_0x52db6d,_0x2fd4f4){if(_0x52db6d[_0x0664('0x66')]['id']){delete _0x52db6d[_0x0664('0x66')]['id'];}return db[_0x0664('0x4a')][_0x0664('0x64')]({'where':{'id':_0x52db6d['params']['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x2fd4f4,null))['then'](function(_0x1f1ac0){if(_0x1f1ac0){_0x52db6d['body'][_0x0664('0x6d')]=_0x1f1ac0['id'];return db[_0x0664('0x6e')][_0x0664('0x6f')](_0x52db6d[_0x0664('0x66')]);}})[_0x0664('0x12')](respondWithResult(_0x2fd4f4,null))['catch'](handleError(_0x2fd4f4,null));};exports[_0x0664('0x70')]=function(_0x179672,_0x3019b4){var _0x2b6071={'raw':![],'where':{}};var _0x5f157f={};var _0x11a421={'count':0x0,'rows':[]};return db[_0x0664('0x4a')][_0x0664('0x71')]({'where':{'id':_0x179672['params']['id']}})['then'](handleEntityNotFound(_0x3019b4,null))['then'](function(_0x20416c){if(_0x20416c){_0x5f157f[_0x0664('0x4d')]=_['keys'](db['Disposition']['rawAttributes']);_0x5f157f[_0x0664('0x4e')]=_['keys'](_0x179672[_0x0664('0x4e')]);_0x5f157f[_0x0664('0x59')]=_['intersection'](_0x5f157f[_0x0664('0x4d')],_0x5f157f['query']);_0x2b6071[_0x0664('0x50')]=_[_0x0664('0x51')](_0x5f157f[_0x0664('0x4d')],qs['fields'](_0x179672[_0x0664('0x4e')][_0x0664('0x52')]));_0x2b6071[_0x0664('0x50')]=_0x2b6071[_0x0664('0x50')]['length']?_0x2b6071['attributes']:_0x5f157f[_0x0664('0x4d')];if(!_0x179672[_0x0664('0x4e')][_0x0664('0x54')]('nolimit')){_0x2b6071[_0x0664('0x22')]=qs[_0x0664('0x22')](_0x179672[_0x0664('0x4e')][_0x0664('0x22')]);_0x2b6071['offset']=qs['offset'](_0x179672['query'][_0x0664('0x1f')]);}_0x2b6071[_0x0664('0x72')]=qs['sort'](_0x179672[_0x0664('0x4e')][_0x0664('0x56')]);_0x2b6071[_0x0664('0x57')]=qs[_0x0664('0x59')](_[_0x0664('0x58')](_0x179672[_0x0664('0x4e')],_0x5f157f[_0x0664('0x59')]));_0x2b6071[_0x0664('0x57')]['MailAccountId']=_0x20416c['id'];if(_0x179672[_0x0664('0x4e')][_0x0664('0x5a')]){_0x2b6071[_0x0664('0x57')]=_['merge'](_0x2b6071[_0x0664('0x57')],{'$or':_[_0x0664('0x49')](_0x2b6071[_0x0664('0x50')],function(_0x4c4fb2){var _0x3d97a8={};_0x3d97a8[_0x4c4fb2]={'$like':'%'+_0x179672[_0x0664('0x4e')][_0x0664('0x5a')]+'%'};return _0x3d97a8;})});}_0x2b6071=_[_0x0664('0x73')]({},_0x2b6071,_0x179672[_0x0664('0x5d')]);return db[_0x0664('0x6e')][_0x0664('0x21')]({'where':_0x2b6071[_0x0664('0x57')]})[_0x0664('0x12')](function(_0x34b2b8){_0x11a421[_0x0664('0x21')]=_0x34b2b8;if(_0x179672[_0x0664('0x4e')][_0x0664('0x5e')]){_0x2b6071[_0x0664('0x63')]=[{'all':!![]}];}return db[_0x0664('0x6e')][_0x0664('0x5f')](_0x2b6071);})['then'](function(_0x23bc0c){_0x11a421[_0x0664('0x60')]=_0x23bc0c;return _0x11a421;});}})[_0x0664('0x12')](respondWithFilteredResult(_0x3019b4,_0x2b6071))[_0x0664('0x65')](handleError(_0x3019b4,null));};exports[_0x0664('0x74')]=function(_0x115b4a,_0x200b2c){return db[_0x0664('0x4a')][_0x0664('0x64')]({'where':{'id':_0x115b4a['params']['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x200b2c,null))['then'](function(_0x30f89e){if(_0x30f89e){return _0x30f89e[_0x0664('0x74')](_0x115b4a[_0x0664('0x4e')]['ids']);}})[_0x0664('0x12')](respondWithStatusCode(_0x200b2c,null))[_0x0664('0x65')](handleError(_0x200b2c,null));};exports[_0x0664('0x75')]=function(_0x50cb65,_0x2329dc){if(_0x50cb65[_0x0664('0x66')]['id']){delete _0x50cb65['body']['id'];}return db[_0x0664('0x4a')][_0x0664('0x64')]({'where':{'id':_0x50cb65['params']['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x2329dc,null))['then'](function(_0x1340c1){if(_0x1340c1){_0x50cb65[_0x0664('0x66')][_0x0664('0x6d')]=_0x1340c1['id'];return db['CannedAnswer'][_0x0664('0x6f')](_0x50cb65[_0x0664('0x66')]);}})[_0x0664('0x12')](respondWithResult(_0x2329dc,null))[_0x0664('0x65')](handleError(_0x2329dc,null));};exports[_0x0664('0x76')]=function(_0x2b20db,_0x500921){var _0x8dc33e={'raw':![],'where':{}};var _0x1e5d7d={};var _0x25e1cc={'count':0x0,'rows':[]};return db[_0x0664('0x4a')][_0x0664('0x71')]({'where':{'id':_0x2b20db[_0x0664('0x62')]['id']}})['then'](handleEntityNotFound(_0x500921,null))[_0x0664('0x12')](function(_0x564ac5){if(_0x564ac5){_0x1e5d7d[_0x0664('0x4d')]=_[_0x0664('0x4f')](db['CannedAnswer']['rawAttributes']);_0x1e5d7d['query']=_['keys'](_0x2b20db[_0x0664('0x4e')]);_0x1e5d7d[_0x0664('0x59')]=_['intersection'](_0x1e5d7d[_0x0664('0x4d')],_0x1e5d7d[_0x0664('0x4e')]);_0x8dc33e[_0x0664('0x50')]=_[_0x0664('0x51')](_0x1e5d7d[_0x0664('0x4d')],qs['fields'](_0x2b20db[_0x0664('0x4e')][_0x0664('0x52')]));_0x8dc33e['attributes']=_0x8dc33e[_0x0664('0x50')][_0x0664('0x53')]?_0x8dc33e[_0x0664('0x50')]:_0x1e5d7d[_0x0664('0x4d')];if(!_0x2b20db[_0x0664('0x4e')][_0x0664('0x54')]('nolimit')){_0x8dc33e[_0x0664('0x22')]=qs[_0x0664('0x22')](_0x2b20db[_0x0664('0x4e')]['limit']);_0x8dc33e[_0x0664('0x1f')]=qs['offset'](_0x2b20db[_0x0664('0x4e')][_0x0664('0x1f')]);}_0x8dc33e[_0x0664('0x72')]=qs[_0x0664('0x56')](_0x2b20db[_0x0664('0x4e')]['sort']);_0x8dc33e[_0x0664('0x57')]=qs[_0x0664('0x59')](_[_0x0664('0x58')](_0x2b20db[_0x0664('0x4e')],_0x1e5d7d[_0x0664('0x59')]));_0x8dc33e[_0x0664('0x57')]['MailAccountId']=_0x564ac5['id'];if(_0x2b20db[_0x0664('0x4e')][_0x0664('0x5a')]){_0x8dc33e['where']=_[_0x0664('0x73')](_0x8dc33e[_0x0664('0x57')],{'$or':_['map'](_0x8dc33e['attributes'],function(_0x4dd5e6){var _0x50c8bf={};_0x50c8bf[_0x4dd5e6]={'$like':'%'+_0x2b20db[_0x0664('0x4e')]['filter']+'%'};return _0x50c8bf;})});}_0x8dc33e=_[_0x0664('0x73')]({},_0x8dc33e,_0x2b20db[_0x0664('0x5d')]);return db[_0x0664('0x77')][_0x0664('0x21')]({'where':_0x8dc33e['where']})[_0x0664('0x12')](function(_0x46bfcf){_0x25e1cc[_0x0664('0x21')]=_0x46bfcf;if(_0x2b20db['query']['includeAll']){_0x8dc33e[_0x0664('0x63')]=[{'all':!![]}];}return db[_0x0664('0x77')][_0x0664('0x5f')](_0x8dc33e);})[_0x0664('0x12')](function(_0x5db617){_0x25e1cc['rows']=_0x5db617;return _0x25e1cc;});}})[_0x0664('0x12')](respondWithFilteredResult(_0x500921,_0x8dc33e))[_0x0664('0x65')](handleError(_0x500921,null));};exports['removeAnswers']=function(_0x300dbf,_0x101d60){return db[_0x0664('0x4a')]['find']({'where':{'id':_0x300dbf[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x101d60,null))[_0x0664('0x12')](function(_0x179df4){if(_0x179df4){return _0x179df4['removeAnswers'](_0x300dbf['query'][_0x0664('0x78')]);}})[_0x0664('0x12')](respondWithStatusCode(_0x101d60,null))['catch'](handleError(_0x101d60,null));};exports[_0x0664('0x6f')]=function(_0x2af8cb,_0x2dcd97){var _0x216699={'name':_0x2af8cb[_0x0664('0x66')][_0x0664('0x2a')],'key':_0x2af8cb[_0x0664('0x66')][_0x0664('0x79')],'provider':_0x2af8cb[_0x0664('0x66')]['provider']===_0x0664('0x68')?null:_0x2af8cb[_0x0664('0x66')]['provider'],'email':_0x2af8cb[_0x0664('0x66')][_0x0664('0x7a')],'ListId':_0x2af8cb[_0x0664('0x66')][_0x0664('0x7b')],'active':!_['isNil'](_0x2af8cb[_0x0664('0x66')]['active'])?_0x2af8cb[_0x0664('0x66')][_0x0664('0x7c')]:!![],'description':_0x2af8cb['body'][_0x0664('0x7d')]||null};var _0x4570af=getAuthenticationOptions(_0x216699[_0x0664('0x67')],_0x2af8cb[_0x0664('0x66')]);_0x216699[_0x0664('0x46')]=_0x4570af[_0x0664('0x46')];_0x216699['Smtp']=_0x4570af[_0x0664('0x43')];return db[_0x0664('0x4a')][_0x0664('0x6f')](_0x216699,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x0664('0x46')}]})[_0x0664('0x12')](function(_0x4278c6){var _0x220ae5=_0x2af8cb[_0x0664('0x38')][_0x0664('0x7e')]({'plain':!![]});if(!_0x220ae5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x220ae5[_0x0664('0x7f')]===_0x0664('0x38')){var _0xff2049=_0x4278c6['get']({'plain':!![]});return db[_0x0664('0x80')][_0x0664('0x64')]({'where':{'name':'MailAccounts','userProfileId':_0x220ae5[_0x0664('0x81')]},'raw':!![]})[_0x0664('0x12')](function(_0x3d7662){if(_0x3d7662&&_0x3d7662[_0x0664('0x82')]===0x0){return db['UserProfileResource'][_0x0664('0x6f')]({'name':_0xff2049['name'],'resourceId':_0xff2049['id'],'type':_0x3d7662[_0x0664('0x2a')],'sectionId':_0x3d7662['id']},{})[_0x0664('0x12')](function(){return _0x4278c6;});}else{return _0x4278c6;}})[_0x0664('0x65')](function(_0x294722){logger[_0x0664('0x19')](_0x0664('0x83'),_0x294722);throw _0x294722;});}return _0x4278c6;})[_0x0664('0x12')](respondWithResult(_0x2dcd97,0xc9))['catch'](handleError(_0x2dcd97,null));};exports[_0x0664('0x84')]=function(_0x548ed3,_0x26744a){return db['MailAccount']['findOne']({'where':{'id':_0x548ed3[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x26744a,null))[_0x0664('0x12')](function(_0x13e28c){if(_0x13e28c){return _0x13e28c['getImap']();}return null;})['then'](respondWithResult(_0x26744a,null))['catch'](handleError(_0x26744a,null));};exports['addImap']=function(_0x47300e,_0x57f6ae){if(_0x47300e[_0x0664('0x66')]['id']){delete _0x47300e['body']['id'];}return db[_0x0664('0x4a')]['find']({'where':{'id':_0x47300e['params']['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x57f6ae,null))['then'](function(_0x418540){if(_0x418540){_0x47300e[_0x0664('0x66')][_0x0664('0x6d')]=_0x418540['id'];return db[_0x0664('0x45')]['create'](_0x47300e[_0x0664('0x66')]);}})[_0x0664('0x12')](respondWithResult(_0x57f6ae,null))[_0x0664('0x65')](handleError(_0x57f6ae,null));};exports[_0x0664('0x85')]=function(_0x38a7d6,_0x3671c3){return db[_0x0664('0x4a')][_0x0664('0x71')]({'where':{'id':_0x38a7d6[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x3671c3,null))[_0x0664('0x12')](function(_0x35ddc6){if(_0x35ddc6){return _0x35ddc6[_0x0664('0x86')](null);}return null;})[_0x0664('0x12')](respondWithStatusCode(_0x3671c3,null))[_0x0664('0x65')](handleError(_0x3671c3,null));};exports[_0x0664('0x87')]=function(_0x5198fb,_0x367ae6){return db[_0x0664('0x4a')][_0x0664('0x71')]({'where':{'id':_0x5198fb[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x367ae6,null))[_0x0664('0x12')](function(_0x2039e2){if(_0x2039e2){return _0x2039e2[_0x0664('0x87')]();}return null;})[_0x0664('0x12')](respondWithResult(_0x367ae6,null))[_0x0664('0x65')](handleError(_0x367ae6,null));};exports[_0x0664('0x88')]=function(_0x1cd965,_0x14c708){if(_0x1cd965[_0x0664('0x66')]['id']){delete _0x1cd965[_0x0664('0x66')]['id'];}return db['MailAccount'][_0x0664('0x64')]({'where':{'id':_0x1cd965[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x14c708,null))['then'](function(_0x7ef032){if(_0x7ef032){_0x1cd965['body'][_0x0664('0x6d')]=_0x7ef032['id'];return db[_0x0664('0x6a')]['create'](_0x1cd965['body']);}})[_0x0664('0x12')](respondWithResult(_0x14c708,null))[_0x0664('0x65')](handleError(_0x14c708,null));};exports[_0x0664('0x89')]=function(_0x1cf5a6,_0x361226){return db['MailAccount'][_0x0664('0x71')]({'where':{'id':_0x1cf5a6['params']['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x361226,null))[_0x0664('0x12')](function(_0x72b325){if(_0x72b325){return _0x72b325[_0x0664('0x8a')](null);}return null;})[_0x0664('0x12')](respondWithStatusCode(_0x361226,null))[_0x0664('0x65')](handleError(_0x361226,null));};exports[_0x0664('0x8b')]=function(_0x492c0a,_0x1056b2){return db['MailInteraction'][_0x0664('0x64')]({'where':{'id':_0x492c0a[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x1056b2,null))[_0x0664('0x12')](function(_0x49ad86){if(_0x49ad86){return _0x49ad86[_0x0664('0x8b')](_0x492c0a[_0x0664('0x66')][_0x0664('0x78')],_['omit'](_0x492c0a[_0x0664('0x66')],[_0x0664('0x78'),'id'])||{});}})[_0x0664('0x12')](respondWithResult(_0x1056b2,null))['catch'](handleError(_0x1056b2,null));};exports[_0x0664('0x8c')]=function(_0x58f15b,_0x9127b0){var _0x305a8e={'raw':![],'where':{}};var _0x81e3fb={};var _0x449e9d={'count':0x0,'rows':[]};return db[_0x0664('0x4a')][_0x0664('0x71')]({'where':{'id':_0x58f15b['params']['id']}})['then'](handleEntityNotFound(_0x9127b0,null))[_0x0664('0x12')](function(_0x405e77){if(_0x405e77){_0x81e3fb[_0x0664('0x4d')]=_[_0x0664('0x4f')](db[_0x0664('0x8d')][_0x0664('0x4b')]);_0x81e3fb['query']=_['keys'](_0x58f15b['query']);_0x81e3fb[_0x0664('0x59')]=_[_0x0664('0x51')](_0x81e3fb[_0x0664('0x4d')],_0x81e3fb['query']);_0x305a8e[_0x0664('0x50')]=_[_0x0664('0x51')](_0x81e3fb[_0x0664('0x4d')],qs[_0x0664('0x52')](_0x58f15b[_0x0664('0x4e')][_0x0664('0x52')]));_0x305a8e[_0x0664('0x50')]=_0x305a8e[_0x0664('0x50')]['length']?_0x305a8e['attributes']:_0x81e3fb['model'];if(!_0x58f15b[_0x0664('0x4e')][_0x0664('0x54')](_0x0664('0x55'))){_0x305a8e[_0x0664('0x22')]=qs[_0x0664('0x22')](_0x58f15b[_0x0664('0x4e')]['limit']);_0x305a8e['offset']=qs[_0x0664('0x1f')](_0x58f15b[_0x0664('0x4e')][_0x0664('0x1f')]);}_0x305a8e[_0x0664('0x72')]=qs[_0x0664('0x56')](_0x58f15b[_0x0664('0x4e')]['sort']);_0x305a8e['where']=qs[_0x0664('0x59')](_['pick'](_0x58f15b[_0x0664('0x4e')],_0x81e3fb[_0x0664('0x59')]));_0x305a8e[_0x0664('0x57')][_0x0664('0x6d')]=_0x405e77['id'];if(_0x58f15b['query']['filter']){_0x305a8e['where']=_[_0x0664('0x73')](_0x305a8e[_0x0664('0x57')],{'$or':_[_0x0664('0x49')](_0x305a8e[_0x0664('0x50')],function(_0x233af6){var _0x44dcb6={};_0x44dcb6[_0x233af6]={'$like':'%'+_0x58f15b[_0x0664('0x4e')][_0x0664('0x5a')]+'%'};return _0x44dcb6;})});}_0x305a8e=_[_0x0664('0x73')]({},_0x305a8e,_0x58f15b[_0x0664('0x5d')]);return db['MailInteraction'][_0x0664('0x21')]({'where':_0x305a8e['where']})['then'](function(_0x4ca9c1){_0x449e9d[_0x0664('0x21')]=_0x4ca9c1;if(_0x58f15b[_0x0664('0x4e')][_0x0664('0x5e')]){_0x305a8e[_0x0664('0x63')]=[{'model':db['CmContact'],'as':_0x0664('0x8e'),'required':![]},{'model':db[_0x0664('0x8f')],'as':_0x0664('0x90'),'attributes':[_0x0664('0x2a'),_0x0664('0x91'),_0x0664('0x92')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0664('0x2a'),_0x0664('0x93')],'where':_0x58f15b[_0x0664('0x4e')][_0x0664('0x94')]?{'id':_0x58f15b[_0x0664('0x4e')][_0x0664('0x94')]}:undefined,'required':_0x58f15b['query'][_0x0664('0x94')]?!![]:![]}];}return db['MailInteraction'][_0x0664('0x5f')](_0x305a8e);})[_0x0664('0x12')](function(_0x4bcb83){_0x449e9d[_0x0664('0x60')]=_0x4bcb83;return _0x449e9d;});}})[_0x0664('0x12')](respondWithFilteredResult(_0x9127b0,_0x305a8e))['catch'](handleError(_0x9127b0,null));};exports['addApplications']=function addApplications(_0x435dc1,_0x4a8246){var _0x1e9726=_0x435dc1[_0x0664('0x62')]['id'];var _0x2dbe54=_0x435dc1[_0x0664('0x66')];var _0x1e2026=0xc8;var _0xbb368e=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x0664('0x95')][_0x0664('0x96')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x448328){return db[_0x0664('0x4a')][_0x0664('0x71')]({'where':{'id':_0x1e9726},'transaction':_0x448328})[_0x0664('0x12')](function(_0x2899ff){if(_0x2899ff){return db[_0x0664('0x97')][_0x0664('0x26')]({'where':{'MailAccountId':_0x1e9726},'transaction':_0x448328})['then'](function(){var _0x3d709c=_[_0x0664('0x49')](_0x2dbe54,function(_0x5e7e88){_0x5e7e88['MailAccountId']=_0x1e9726;return _0x5e7e88;});return db[_0x0664('0x97')][_0x0664('0x98')](_0x3d709c,{'transaction':_0x448328});});}else{_0x1e2026=0x194;_0xbb368e=[];}});})[_0x0664('0x12')](function(){if(_0x1e2026!==0x194){return db[_0x0664('0x97')]['findAndCountAll']({'where':{'MailAccountId':_0x1e9726},'order':'priority'})[_0x0664('0x12')](function(_0x5c3e46){_0xbb368e=_0x5c3e46;});}})['catch'](function(_0x569b08){_0x1e2026=0x1f4;logger[_0x0664('0x19')](_0x569b08[_0x0664('0x29')]);if(_0x569b08[_0x0664('0x2a')]){delete _0x569b08[_0x0664('0x2a')];}_0xbb368e=_0x569b08;})[_0x0664('0x99')](function(){if(_0xbb368e===null){_0x4a8246[_0x0664('0x1c')](_0x1e2026);}else{if(_0x1e2026===0x1f4){_0x4a8246[_0x0664('0x1d')](_0x1e2026)['send'](_0xbb368e);}else{_0x4a8246[_0x0664('0x1d')](_0x1e2026)[_0x0664('0x1e')](_0xbb368e);}}});};exports['getApplications']=function(_0x2a7413,_0xe1bfe9){var _0xb7607a={};var _0xeb13bb={};var _0x2e2819;var _0x5d2a9f;return db[_0x0664('0x4a')][_0x0664('0x71')]({'where':{'id':_0x2a7413[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0xe1bfe9,null))[_0x0664('0x12')](function(_0xa59d33){if(_0xa59d33){_0x2e2819=_0xa59d33;_0xeb13bb[_0x0664('0x4d')]=_[_0x0664('0x4f')](db['MailApplication']['rawAttributes']);_0xeb13bb[_0x0664('0x4e')]=_[_0x0664('0x4f')](_0x2a7413['query']);_0xeb13bb['filters']=_[_0x0664('0x51')](_0xeb13bb[_0x0664('0x4d')],_0xeb13bb[_0x0664('0x4e')]);_0xb7607a[_0x0664('0x50')]=_[_0x0664('0x51')](_0xeb13bb[_0x0664('0x4d')],qs['fields'](_0x2a7413[_0x0664('0x4e')][_0x0664('0x52')]));_0xb7607a['attributes']=_0xb7607a[_0x0664('0x50')][_0x0664('0x53')]?_0xb7607a[_0x0664('0x50')]:_0xeb13bb[_0x0664('0x4d')];_0xb7607a[_0x0664('0x72')]=qs[_0x0664('0x56')](_0x2a7413[_0x0664('0x4e')][_0x0664('0x56')]);_0xb7607a[_0x0664('0x57')]=qs[_0x0664('0x59')](_['pick'](_0x2a7413['query'],_0xeb13bb[_0x0664('0x59')]));if(_0x2a7413['query'][_0x0664('0x5a')]){_0xb7607a['where']=_[_0x0664('0x73')](_0xb7607a[_0x0664('0x57')],{'$or':_[_0x0664('0x49')](_0xb7607a['attributes'],function(_0x2cc228){var _0x2177f2={};_0x2177f2[_0x2cc228]={'$like':'%'+_0x2a7413[_0x0664('0x4e')][_0x0664('0x5a')]+'%'};return _0x2177f2;})});}_0xb7607a=_['merge']({},_0xb7607a,_0x2a7413[_0x0664('0x5d')]);return _0x2e2819[_0x0664('0x9a')](_0xb7607a);}})[_0x0664('0x12')](function(_0x3bfbd0){if(_0x3bfbd0){_0x5d2a9f=_0x3bfbd0['length'];if(!_0x2a7413['query'][_0x0664('0x54')](_0x0664('0x55'))){_0xb7607a['limit']=qs[_0x0664('0x22')](_0x2a7413[_0x0664('0x4e')][_0x0664('0x22')]);_0xb7607a[_0x0664('0x1f')]=qs[_0x0664('0x1f')](_0x2a7413['query'][_0x0664('0x1f')]);}return _0x2e2819['getApplications'](_0xb7607a);}})[_0x0664('0x12')](function(_0x321acf){if(_0x321acf){return _0x321acf?{'count':_0x5d2a9f,'rows':_0x321acf}:null;}})[_0x0664('0x12')](respondWithResult(_0xe1bfe9,null))['catch'](handleError(_0xe1bfe9,null));};exports['getMessages']=function(_0x2375a8,_0xc3a99e){var _0x5c994b={'raw':!![],'where':{}};var _0x21966b={};var _0x43a4b6={'count':0x0,'rows':[]};return db[_0x0664('0x4a')]['findOne']({'where':{'id':_0x2375a8['params']['id']}})[_0x0664('0x12')](handleEntityNotFound(_0xc3a99e,null))[_0x0664('0x12')](function(_0x2987a6){if(_0x2987a6){_0x21966b[_0x0664('0x4d')]=_[_0x0664('0x4f')](db['MailMessage'][_0x0664('0x4b')]);_0x21966b[_0x0664('0x4e')]=_[_0x0664('0x4f')](_0x2375a8['query']);_0x21966b[_0x0664('0x59')]=_[_0x0664('0x51')](_0x21966b[_0x0664('0x4d')],_0x21966b[_0x0664('0x4e')]);_0x5c994b[_0x0664('0x50')]=_[_0x0664('0x51')](_0x21966b[_0x0664('0x4d')],qs[_0x0664('0x52')](_0x2375a8['query'][_0x0664('0x52')]));_0x5c994b[_0x0664('0x50')]=_0x5c994b[_0x0664('0x50')][_0x0664('0x53')]?_0x5c994b[_0x0664('0x50')]:_0x21966b[_0x0664('0x4d')];if(!_0x2375a8[_0x0664('0x4e')][_0x0664('0x54')](_0x0664('0x55'))){_0x5c994b[_0x0664('0x22')]=qs[_0x0664('0x22')](_0x2375a8[_0x0664('0x4e')][_0x0664('0x22')]);_0x5c994b['offset']=qs['offset'](_0x2375a8['query'][_0x0664('0x1f')]);}_0x5c994b[_0x0664('0x72')]=qs['sort'](_0x2375a8[_0x0664('0x4e')][_0x0664('0x56')]);_0x5c994b[_0x0664('0x57')]=qs[_0x0664('0x59')](_[_0x0664('0x58')](_0x2375a8['query'],_0x21966b[_0x0664('0x59')]));_0x5c994b['where'][_0x0664('0x6d')]=_0x2987a6['id'];if(_0x2375a8['query']['filter']){_0x5c994b[_0x0664('0x57')]=_[_0x0664('0x73')](_0x5c994b[_0x0664('0x57')],{'$or':_[_0x0664('0x49')](_0x5c994b[_0x0664('0x50')],function(_0x2aa27d){var _0x10f49a={};_0x10f49a[_0x2aa27d]={'$like':'%'+_0x2375a8['query']['filter']+'%'};return _0x10f49a;})});}if(_0x2375a8[_0x0664('0x4e')][_0x0664('0x9b')]){var _0x519013=_0x2375a8[_0x0664('0x4e')][_0x0664('0x9b')][_0x0664('0x9c')](',');var _0x4d11fe={};_0x4d11fe[_0x519013[0x0]]={'$gte':moment(_0x519013[0x1])['format'](_0x0664('0x9d'))};_0x5c994b[_0x0664('0x57')]=_[_0x0664('0x73')](_0x5c994b[_0x0664('0x57')],_0x4d11fe);}_0x5c994b=_[_0x0664('0x73')]({},_0x5c994b,_0x2375a8[_0x0664('0x5d')]);return db['MailMessage']['count']({'where':_0x5c994b['where']})[_0x0664('0x12')](function(_0x23246b){_0x43a4b6[_0x0664('0x21')]=_0x23246b;if(_0x2375a8[_0x0664('0x4e')][_0x0664('0x5e')]){_0x5c994b[_0x0664('0x63')]=[{'all':!![]}];}return db[_0x0664('0x9e')][_0x0664('0x5f')](_0x5c994b);})[_0x0664('0x12')](function(_0x201fba){if(_0x2375a8[_0x0664('0x4e')][_0x0664('0x9f')]==='true'){for(var _0x7d60c8=0x0;_0x7d60c8<_0x201fba[_0x0664('0x53')];_0x7d60c8++){_0x201fba[_0x7d60c8][_0x0664('0x66')]=juice(_0x201fba[_0x7d60c8][_0x0664('0x66')]);}}_0x43a4b6[_0x0664('0x60')]=_0x201fba;return _0x43a4b6;});}})[_0x0664('0x12')](respondWithFilteredResult(_0xc3a99e,_0x5c994b))['catch'](handleError(_0xc3a99e,null));};exports['send']=function(_0x581115,_0x351f84){var _0x4bb6f3,_0x19b17a={},_0xd1f2d3;if(_0x581115[_0x0664('0x66')]['to']){_0xd1f2d3=_0x581115['body']['to'][_0x0664('0x9c')](',')[0x0];}return db[_0x0664('0x4a')][_0x0664('0x64')]({'where':{'id':_0x581115[_0x0664('0x62')]['id']},'include':[{'model':db[_0x0664('0xa0')],'as':_0x0664('0xa1'),'include':[{'model':db[_0x0664('0xa2')],'as':'Contacts','where':{'email':_0xd1f2d3},'limit':0x1,'order':[[_0x0664('0xa3'),_0x0664('0xa4')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0664('0xa5')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x351f84,null))[_0x0664('0x12')](function(_0x490143){if(!_0x490143)return;_0x4bb6f3=_0x490143;if(!_0x490143['Smtp'])throw new Error(_0x0664('0xa6'));if(_[_0x0664('0xa7')](_0x581115['body'][_0x0664('0xa8')])){_0x581115[_0x0664('0x66')][_0x0664('0xa8')]=util[_0x0664('0xa9')](_0x0664('0xaa'),_0x490143['name'],_0x490143[_0x0664('0x7a')]||_0x490143[_0x0664('0x43')][_0x0664('0x38')]);}if(_0x581115[_0x0664('0x66')][_0x0664('0xab')]&&_0x581115[_0x0664('0x66')][_0x0664('0xab')][_0x0664('0x53')]){for(var _0x2675c2=0x0;_0x2675c2<_0x581115[_0x0664('0x66')][_0x0664('0xab')][_0x0664('0x53')];_0x2675c2+=0x1){_0x581115[_0x0664('0x66')]['attachments'][_0x2675c2]={'filename':_0x581115[_0x0664('0x66')]['attachments'][_0x2675c2][_0x0664('0x2a')],'path':path[_0x0664('0xac')](config[_0x0664('0xad')],_0x0664('0xae'),_0x581115[_0x0664('0x66')]['attachments'][_0x2675c2][_0x0664('0xaf')])};}}var _0x40ea7d=_0x490143[_0x0664('0xb0')]();return respondWithRpcPromise('SendMail',_0x0664('0xb1'),{'account':_0x40ea7d,'message':_0x581115[_0x0664('0x66')]});})[_0x0664('0x12')](function(_0x2f6c02){if(!_0x2f6c02)return;_0x19b17a=_0x2f6c02;if(!_0x4bb6f3[_0x0664('0xa1')])throw new Error(_0x0664('0xb2'));if(_0x4bb6f3['List'][_0x0664('0xb3')]['length'])return _0x4bb6f3[_0x0664('0xa1')]['Contacts'][0x0];return db['CmContact']['create'](_[_0x0664('0xb')](_0x581115[_0x0664('0x66')],{'firstName':_0x581115[_0x0664('0x66')]['to'],'email':_0x581115['body']['to'],'phone':_0x581115['body']['to'],'ListId':_0x4bb6f3[_0x0664('0x7b')]}));})[_0x0664('0x12')](function(_0x4ccb39){if(!_0x4ccb39)return;var _0x411064={'UserId':_0x581115[_0x0664('0x38')]['id'],'ContactId':_0x4ccb39['id'],'MailAccountId':_0x4bb6f3['id'],'inReplyTo':_0x19b17a[_0x0664('0xb4')],'to':_0x581115[_0x0664('0x66')][_0x0664('0xa8')],'cc':_0x581115[_0x0664('0x66')]['cc'],'subject':_0x581115[_0x0664('0x66')]['subject'],'attach':_0x581115[_0x0664('0x66')][_0x0664('0xb5')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x0664('0xa9')](_0x0664('0x9d')),'lastMsgDirection':_0x0664('0xb6'),'Messages':[_[_0x0664('0x73')](_0x581115[_0x0664('0x66')],{'messageId':_0x19b17a[_0x0664('0xb4')],'sentAt':moment()[_0x0664('0xa9')](_0x0664('0x9d')),'read':!![],'MailAccountId':_0x4bb6f3['id'],'UserId':_0x581115[_0x0664('0x38')]['id'],'ContactId':_0x4ccb39['id']})]};if(_0x581115[_0x0664('0x66')][_0x0664('0xb7')]){_0x411064=_[_0x0664('0x73')](_0x411064,_0x581115['body']['Interaction']);}return db[_0x0664('0x8d')][_0x0664('0x6f')](_0x411064,{'include':[{'model':db['MailMessage'],'as':_0x0664('0xb8')}]});})[_0x0664('0x12')](respondWithResult(_0x351f84,null))[_0x0664('0x65')](handleError(_0x351f84,null));};exports['verifySmtp']=function(_0x4ff38d,_0x151fa5){return db['MailAccount']['find']({'where':{'id':_0x4ff38d[_0x0664('0x62')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x0664('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x0664('0x12')](handleEntityNotFound(_0x151fa5,null))[_0x0664('0x12')](function(_0x4721bc){if(!_0x4721bc[_0x0664('0x43')])return;var _0x58fe90=_0x4721bc[_0x0664('0xb0')]();return respondWithRpcPromise(_0x0664('0xb9'),'verifySmtp',{'account':_0x58fe90});})[_0x0664('0x12')](respondWithResult(_0x151fa5,null))[_0x0664('0x65')](handleError(_0x151fa5,null));};exports[_0x0664('0x26')]=function(_0x45ad25,_0x25ebfa){return db['MailAccount'][_0x0664('0x64')]({'where':{'id':_0x45ad25[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x25ebfa,null))[_0x0664('0x12')](function(_0x3c0200){if(_0x3c0200&&_0x3c0200[_0x0664('0x41')]){throw new db['Sequelize'][(_0x0664('0xba'))](_0x0664('0xbb'));}return _0x3c0200;})['then'](removeEntity(_0x25ebfa,null))[_0x0664('0x65')](handleError(_0x25ebfa,null));};exports[_0x0664('0xbc')]=function(_0x26c7e2,_0x5bcee5){return db[_0x0664('0x4a')][_0x0664('0x64')]({'where':{'id':_0x26c7e2[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x5bcee5,null))[_0x0664('0x12')](function(_0x5c27d3){if(_0x5c27d3){return _0x5c27d3[_0x0664('0xbc')](_0x26c7e2[_0x0664('0x66')][_0x0664('0x78')],_[_0x0664('0xbd')](_0x26c7e2[_0x0664('0x66')],['ids','id'])||{})['spread'](function(_0x400ebd){for(var _0x1572e5=0x0;_0x1572e5<_0x26c7e2['body'][_0x0664('0x78')][_0x0664('0x53')];_0x1572e5+=0x1){socket[_0x0664('0xbe')](_0x0664('0xbf'),{'UserId':Number(_0x26c7e2[_0x0664('0x66')][_0x0664('0x78')][_0x1572e5]),'MailAccountId':Number(_0x26c7e2[_0x0664('0x62')]['id'])});}return _0x400ebd;});}})[_0x0664('0x12')](respondWithResult(_0x5bcee5,null))[_0x0664('0x65')](handleError(_0x5bcee5,null));};exports['removeAgents']=function(_0x151fe9,_0xea4b6a){return db[_0x0664('0x4a')]['find']({'where':{'id':_0x151fe9[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0xea4b6a,null))[_0x0664('0x12')](function(_0x48990e){if(_0x48990e){return _0x48990e[_0x0664('0xc0')](_0x151fe9[_0x0664('0x4e')][_0x0664('0x78')])[_0x0664('0x12')](function(){if(_[_0x0664('0xc1')](_0x151fe9[_0x0664('0x4e')][_0x0664('0x78')])){for(var _0x5d19c4=0x0;_0x5d19c4<_0x151fe9[_0x0664('0x4e')]['ids'][_0x0664('0x53')];_0x5d19c4+=0x1){socket['emit'](_0x0664('0xc2'),{'UserId':Number(_0x151fe9['query'][_0x0664('0x78')][_0x5d19c4]),'MailAccountId':Number(_0x151fe9[_0x0664('0x62')]['id'])});}}else{socket['emit'](_0x0664('0xc2'),{'UserId':Number(_0x151fe9[_0x0664('0x4e')]['ids']),'MailAccountId':Number(_0x151fe9[_0x0664('0x62')]['id'])});}});}})[_0x0664('0x12')](respondWithStatusCode(_0xea4b6a,null))[_0x0664('0x65')](handleError(_0xea4b6a,null));};exports[_0x0664('0xc3')]=function(_0x3459a4,_0x247b84){var _0x218bd0={};var _0xf3b7d0={};var _0x3b3d51;var _0x56d20c;return db[_0x0664('0x4a')][_0x0664('0x71')]({'where':{'id':_0x3459a4[_0x0664('0x62')]['id']}})[_0x0664('0x12')](handleEntityNotFound(_0x247b84,null))[_0x0664('0x12')](function(_0x1d0734){if(_0x1d0734){_0x3b3d51=_0x1d0734;_0xf3b7d0[_0x0664('0x4d')]=_[_0x0664('0x4f')](db[_0x0664('0x8f')][_0x0664('0x4b')]);_0xf3b7d0[_0x0664('0x4e')]=_[_0x0664('0x4f')](_0x3459a4[_0x0664('0x4e')]);_0xf3b7d0[_0x0664('0x59')]=_[_0x0664('0x51')](_0xf3b7d0[_0x0664('0x4d')],_0xf3b7d0['query']);_0x218bd0[_0x0664('0x50')]=_['intersection'](_0xf3b7d0['model'],qs[_0x0664('0x52')](_0x3459a4['query'][_0x0664('0x52')]));_0x218bd0[_0x0664('0x50')]=_0x218bd0[_0x0664('0x50')][_0x0664('0x53')]?_0x218bd0[_0x0664('0x50')]:_0xf3b7d0[_0x0664('0x4d')];_0x218bd0[_0x0664('0x72')]=qs[_0x0664('0x56')](_0x3459a4[_0x0664('0x4e')]['sort']);_0x218bd0[_0x0664('0x57')]=qs[_0x0664('0x59')](_[_0x0664('0x58')](_0x3459a4[_0x0664('0x4e')],_0xf3b7d0[_0x0664('0x59')]));if(_0x3459a4[_0x0664('0x4e')]['filter']){_0x218bd0[_0x0664('0x57')]=_[_0x0664('0x73')](_0x218bd0['where'],{'$or':_[_0x0664('0x49')](_0x218bd0['attributes'],function(_0x4a9133){var _0x1c4973={};_0x1c4973[_0x4a9133]={'$like':'%'+_0x3459a4[_0x0664('0x4e')][_0x0664('0x5a')]+'%'};return _0x1c4973;})});}_0x218bd0=_[_0x0664('0x73')]({},_0x218bd0,_0x3459a4['options']);return _0x3b3d51[_0x0664('0xc3')](_0x218bd0);}})[_0x0664('0x12')](function(_0x340d31){if(_0x340d31){_0x56d20c=_0x340d31[_0x0664('0x53')];if(!_0x3459a4[_0x0664('0x4e')]['hasOwnProperty'](_0x0664('0x55'))){_0x218bd0['limit']=qs[_0x0664('0x22')](_0x3459a4['query'][_0x0664('0x22')]);_0x218bd0[_0x0664('0x1f')]=qs[_0x0664('0x1f')](_0x3459a4[_0x0664('0x4e')]['offset']);}return _0x3b3d51[_0x0664('0xc3')](_0x218bd0);}})[_0x0664('0x12')](function(_0x350174){if(_0x350174){return _0x350174?{'count':_0x56d20c,'rows':_0x350174}:null;}})[_0x0664('0x12')](respondWithResult(_0x247b84,null))['catch'](handleError(_0x247b84,null));}; \ No newline at end of file +var _0x8d83=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','nolimit','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','split','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','subject','attach','out','Interaction','Messages','getSmtpOptions','verifySmtp','Sequelize','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','register','jayson/promise','http','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','destroy','get','MailAccounts','then','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','service','authentication','Imap','port','Smtp','MailServerIn','MailServerOut','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','MailAccount','includeAll','findAll','show','params','Pause','body','provider','custom','secure','find','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','catch','addDisposition','MailAccountId','Disposition','getDispositions','findOne','pick','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','create','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x16042e,_0x167460){var _0x2f2564=function(_0x3aeac6){while(--_0x3aeac6){_0x16042e['push'](_0x16042e['shift']());}};_0x2f2564(++_0x167460);}(_0x8d83,0x1dc));var _0x38d8=function(_0x16c188,_0x2a06aa){_0x16c188=_0x16c188-0x0;var _0x3a646b=_0x8d83[_0x16c188];return _0x3a646b;};'use strict';var moment=require('moment');var BPromise=require(_0x38d8('0x0'));var util=require(_0x38d8('0x1'));var path=require(_0x38d8('0x2'));var _=require(_0x38d8('0x3'));var juice=require(_0x38d8('0x4'));var Redis=require(_0x38d8('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x38d8('0x6'))(_0x38d8('0x7'));var config=require('../../config/environment');var db=require(_0x38d8('0x8'))['db'];config['redis']=_[_0x38d8('0x9')](config['redis'],{'host':_0x38d8('0xa'),'port':0x18eb});var socket=require(_0x38d8('0xb'))(new Redis(config[_0x38d8('0xc')]));require(_0x38d8('0xd'))[_0x38d8('0xe')](socket);var jayson=require(_0x38d8('0xf'));var client=jayson['client'][_0x38d8('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x460626,_0x578236,_0xe4352e,_0x98b8c1){return new BPromise(function(_0x145b81,_0x11b77a){var _0xf24222=_0x98b8c1||client;return _0xf24222[_0x38d8('0x11')](_0x460626,_0xe4352e)['then'](function(_0x775279){logger[_0x38d8('0x12')](_0x38d8('0x13'),_0x578236,'request\x20sent');logger[_0x38d8('0x14')](_0x38d8('0x15'),_0x578236,_0x38d8('0x16'),JSON[_0x38d8('0x17')](_0x775279));if(_0x775279[_0x38d8('0x18')]){if(_0x775279[_0x38d8('0x18')][_0x38d8('0x19')]===0x1f4){logger[_0x38d8('0x18')](_0x38d8('0x13'),_0x578236,_0x775279['error'][_0x38d8('0x1a')]);return _0x11b77a(_0x775279[_0x38d8('0x18')]['message']);}logger[_0x38d8('0x18')](_0x38d8('0x13'),_0x578236,_0x775279[_0x38d8('0x18')]['message']);return _0x145b81(_0x775279[_0x38d8('0x18')][_0x38d8('0x1a')]);}else{logger[_0x38d8('0x12')](_0x38d8('0x13'),_0x578236,_0x38d8('0x16'));_0x145b81(_0x775279[_0x38d8('0x1b')][_0x38d8('0x1a')]);}})['catch'](function(_0x2b8c22){logger[_0x38d8('0x18')](_0x38d8('0x13'),_0x578236,_0x2b8c22);_0x11b77a(_0x2b8c22);});});}function respondWithStatusCode(_0x4aae48,_0x34e534){_0x34e534=_0x34e534||0xcc;return function(_0x20f6e8){if(_0x20f6e8){return _0x4aae48[_0x38d8('0x1c')](_0x34e534);}return _0x4aae48[_0x38d8('0x1d')](_0x34e534)[_0x38d8('0x1e')]();};}function respondWithResult(_0x521f9b,_0xf29a05){_0xf29a05=_0xf29a05||0xc8;return function(_0x46036d){if(_0x46036d){return _0x521f9b[_0x38d8('0x1d')](_0xf29a05)[_0x38d8('0x1f')](_0x46036d);}};}function respondWithFilteredResult(_0x91e474,_0x2aaeec){return function(_0x55ae9c){if(_0x55ae9c){var _0x283bc1=typeof _0x2aaeec['offset']==='undefined'&&typeof _0x2aaeec[_0x38d8('0x20')]===_0x38d8('0x21');var _0x55462e=_0x55ae9c[_0x38d8('0x22')];var _0x4df540=_0x283bc1?0x0:_0x2aaeec[_0x38d8('0x23')];var _0x29dd9f=_0x283bc1?_0x55ae9c[_0x38d8('0x22')]:_0x2aaeec[_0x38d8('0x23')]+_0x2aaeec[_0x38d8('0x20')];var _0x1dd02c;if(_0x29dd9f>=_0x55462e){_0x29dd9f=_0x55462e;_0x1dd02c=0xc8;}else{_0x1dd02c=0xce;}_0x91e474['status'](_0x1dd02c);return _0x91e474[_0x38d8('0x24')](_0x38d8('0x25'),_0x4df540+'-'+_0x29dd9f+'/'+_0x55462e)[_0x38d8('0x1f')](_0x55ae9c);}return null;};}function saveUpdates(_0x45622e){return function(_0xf00e76){if(_0xf00e76){return _0xf00e76[_0x38d8('0x26')](_0x45622e)['then'](function(_0xcb74b7){return _0xcb74b7;});}return null;};}function removeEntity(_0x23beb5){return function(_0x232229){if(_0x232229){return _0x232229[_0x38d8('0x27')]()['then'](function(){var _0xb4ac5a=_0x232229[_0x38d8('0x28')]({'plain':!![]});var _0x3d4328=_0x38d8('0x29');return db['UserProfileResource'][_0x38d8('0x27')]({'where':{'type':_0x3d4328,'resourceId':_0xb4ac5a['id']}})[_0x38d8('0x2a')](function(){return _0x232229;});})[_0x38d8('0x2a')](function(){_0x23beb5[_0x38d8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d9f80){return function(_0x5a0558){if(!_0x5a0558){_0x2d9f80[_0x38d8('0x1c')](0x194);}return _0x5a0558;};}function handleError(_0x24a6c4,_0x513a5d){_0x513a5d=_0x513a5d||0x1f4;return function(_0x2bcf36){logger[_0x38d8('0x18')](_0x2bcf36['stack']);if(_0x2bcf36[_0x38d8('0x2b')]){delete _0x2bcf36[_0x38d8('0x2b')];}_0x24a6c4[_0x38d8('0x1d')](_0x513a5d)[_0x38d8('0x2c')](_0x2bcf36);};}function getImapHost(_0x343b43){switch(_0x343b43){case _0x38d8('0x2d'):return _0x38d8('0x2e');case _0x38d8('0x2f'):return _0x38d8('0x30');case'hotmail':return _0x38d8('0x31');case _0x38d8('0x32'):return _0x38d8('0x33');}throw new Error(_0x38d8('0x34'),_0x343b43);}function getSmtpHost(_0x4edcb9){switch(_0x4edcb9){case'gmail':return _0x38d8('0x35');case'yahoo':return'smtp.mail.yahoo.com';case'hotmail':return'smtp-mail.outlook.com';case'outlook365':return'smtp.office365.com';}throw new Error(_0x38d8('0x34'),_0x4edcb9);}function getAuthenticationOptions(_0x312566,_0x35e7b8){var _0x3bcf09={};var _0x211137={};if(_0x312566){_0x3bcf09[_0x38d8('0x36')]=_0x211137[_0x38d8('0x36')]=_0x35e7b8[_0x38d8('0x37')];_0x3bcf09[_0x38d8('0x38')]=_0x211137['pass']=_0x35e7b8[_0x38d8('0x38')];if(_0x35e7b8['modernAuthentication']){_0x3bcf09[_0x38d8('0x39')]=_0x211137['modernAuthentication']=!![];_0x3bcf09['CloudProviderId']=_0x211137[_0x38d8('0x3a')]=_0x35e7b8[_0x38d8('0x3a')];_0x3bcf09[_0x38d8('0x38')]=_0x211137[_0x38d8('0x3b')]=null;}else{_0x3bcf09[_0x38d8('0x3a')]=_0x211137[_0x38d8('0x3a')]=null;}_0x3bcf09[_0x38d8('0x3c')]=getImapHost(_0x312566);_0x3bcf09['port']=0x3e1;_0x211137[_0x38d8('0x3c')]=getSmtpHost(_0x312566);_0x211137['port']=0x24b;_0x211137['secure']=![];_0x3bcf09[_0x38d8('0x3d')]=_0x211137[_0x38d8('0x3d')]=null;}else{if(_0x35e7b8['authentication']){_0x3bcf09[_0x38d8('0x36')]=_0x211137[_0x38d8('0x36')]=_0x35e7b8[_0x38d8('0x37')];_0x3bcf09[_0x38d8('0x38')]=_0x211137[_0x38d8('0x3b')]=_0x35e7b8['password'];}else{_0x3bcf09['authentication']=_0x211137[_0x38d8('0x3e')]=![];_0x3bcf09['user']=_0x211137['user']=null;_0x3bcf09[_0x38d8('0x38')]=_0x211137[_0x38d8('0x3b')]=null;}_0x3bcf09[_0x38d8('0x3c')]=_0x35e7b8[_0x38d8('0x3f')][_0x38d8('0x3c')];_0x3bcf09[_0x38d8('0x40')]=_0x35e7b8[_0x38d8('0x3f')][_0x38d8('0x40')];_0x211137[_0x38d8('0x3c')]=_0x35e7b8[_0x38d8('0x41')][_0x38d8('0x3c')];_0x211137[_0x38d8('0x40')]=_0x35e7b8[_0x38d8('0x41')][_0x38d8('0x40')];}return{'Imap':_0x3bcf09,'Smtp':_0x211137};}exports['index']=function(_0x19f684,_0x5b4ad2){var _0x101aa3={'include':[{'model':db[_0x38d8('0x42')],'as':'Imap'},{'model':db[_0x38d8('0x43')],'as':_0x38d8('0x41')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x409c94={},_0x438502={'count':0x0,'rows':[]};var _0x22c1c2=_[_0x38d8('0x44')](db['MailAccount'][_0x38d8('0x45')],function(_0x504cac){return{'name':_0x504cac[_0x38d8('0x46')],'type':_0x504cac['type'][_0x38d8('0x47')]};});_0x409c94['model']=_[_0x38d8('0x44')](_0x22c1c2,_0x38d8('0x2b'));_0x409c94[_0x38d8('0x48')]=_[_0x38d8('0x49')](_0x19f684['query']);_0x409c94[_0x38d8('0x4a')]=_[_0x38d8('0x4b')](_0x409c94[_0x38d8('0x4c')],_0x409c94['query']);_0x101aa3['attributes']=_[_0x38d8('0x4b')](_0x409c94[_0x38d8('0x4c')],qs['fields'](_0x19f684['query'][_0x38d8('0x4d')]));_0x101aa3[_0x38d8('0x4e')]=_0x101aa3[_0x38d8('0x4e')][_0x38d8('0x4f')]?_0x101aa3[_0x38d8('0x4e')]:_0x409c94[_0x38d8('0x4c')];if(!_0x19f684[_0x38d8('0x48')][_0x38d8('0x50')]('nolimit')){_0x101aa3[_0x38d8('0x20')]=qs[_0x38d8('0x20')](_0x19f684[_0x38d8('0x48')][_0x38d8('0x20')]);_0x101aa3[_0x38d8('0x23')]=qs[_0x38d8('0x23')](_0x19f684[_0x38d8('0x48')][_0x38d8('0x23')]);}_0x101aa3[_0x38d8('0x51')]=qs[_0x38d8('0x52')](_0x19f684[_0x38d8('0x48')][_0x38d8('0x52')]);_0x101aa3[_0x38d8('0x53')]=qs[_0x38d8('0x4a')](_['pick'](_0x19f684['query'],_0x409c94[_0x38d8('0x4a')]),_0x22c1c2);if(_0x19f684[_0x38d8('0x48')][_0x38d8('0x54')]){_0x101aa3[_0x38d8('0x53')]=_[_0x38d8('0x55')](_0x101aa3[_0x38d8('0x53')],{'$or':_[_0x38d8('0x44')](_0x22c1c2,function(_0x41743a){if(_0x41743a[_0x38d8('0x56')]!==_0x38d8('0x57')){var _0x1e2134={};_0x1e2134[_0x41743a[_0x38d8('0x2b')]]={'$like':'%'+_0x19f684[_0x38d8('0x48')][_0x38d8('0x54')]+'%'};return _0x1e2134;}})});}_0x101aa3=_[_0x38d8('0x55')]({},_0x101aa3,_0x19f684[_0x38d8('0x58')]);var _0x3d8f68={'where':_0x101aa3[_0x38d8('0x53')]};return db[_0x38d8('0x59')][_0x38d8('0x22')](_0x3d8f68)[_0x38d8('0x2a')](function(_0x22060d){_0x438502[_0x38d8('0x22')]=_0x22060d;if(_0x19f684[_0x38d8('0x48')][_0x38d8('0x5a')]){_0x101aa3['include']=[{'all':!![]}];}return db['MailAccount'][_0x38d8('0x5b')](_0x101aa3);})[_0x38d8('0x2a')](function(_0x237be4){_0x438502['rows']=_0x237be4;return _0x438502;})[_0x38d8('0x2a')](respondWithFilteredResult(_0x5b4ad2,_0x101aa3))['catch'](handleError(_0x5b4ad2,null));};exports[_0x38d8('0x5c')]=function(_0x2a2f71,_0x471d4a){var _0x5725ee={'raw':![],'where':{'id':_0x2a2f71[_0x38d8('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x38d8('0x3f')},{'model':db[_0x38d8('0x43')],'as':_0x38d8('0x41')},{'model':db[_0x38d8('0x5e')],'as':'mandatoryDispositionPause'}]},_0x38fa92={};_0x38fa92[_0x38d8('0x4c')]=_[_0x38d8('0x49')](db['MailAccount'][_0x38d8('0x45')]);_0x38fa92['query']=_[_0x38d8('0x49')](_0x2a2f71[_0x38d8('0x48')]);_0x38fa92['filters']=_[_0x38d8('0x4b')](_0x38fa92[_0x38d8('0x4c')],_0x38fa92['query']);_0x5725ee[_0x38d8('0x4e')]=_[_0x38d8('0x4b')](_0x38fa92[_0x38d8('0x4c')],qs[_0x38d8('0x4d')](_0x2a2f71[_0x38d8('0x48')][_0x38d8('0x4d')]));_0x5725ee[_0x38d8('0x4e')]=_0x5725ee['attributes'][_0x38d8('0x4f')]?_0x5725ee[_0x38d8('0x4e')]:_0x38fa92[_0x38d8('0x4c')];if(_0x2a2f71[_0x38d8('0x48')][_0x38d8('0x5a')]){_0x5725ee['include']=[{'all':!![]}];}_0x5725ee=_[_0x38d8('0x55')]({},_0x5725ee,_0x2a2f71[_0x38d8('0x58')]);return db['MailAccount']['find'](_0x5725ee)[_0x38d8('0x2a')](handleEntityNotFound(_0x471d4a,null))[_0x38d8('0x2a')](respondWithResult(_0x471d4a,null))['catch'](handleError(_0x471d4a,null));};exports[_0x38d8('0x26')]=function(_0x3c2aee,_0x33b0cc){if(_0x3c2aee[_0x38d8('0x5f')]['id']){delete _0x3c2aee[_0x38d8('0x5f')]['id'];}var _0x3dac0a=_0x3c2aee['body'][_0x38d8('0x60')]===_0x38d8('0x61')?null:_0x3c2aee[_0x38d8('0x5f')][_0x38d8('0x60')];var _0x5813e4=_0x3c2aee['body'][_0x38d8('0x3f')]||{};var _0x536317=_0x3c2aee[_0x38d8('0x5f')][_0x38d8('0x41')]||{};if(_0x3dac0a){_0x5813e4['host']=getImapHost(_0x3dac0a);_0x5813e4[_0x38d8('0x40')]=0x3e1;_0x536317[_0x38d8('0x3c')]=getSmtpHost(_0x3dac0a);_0x536317['port']=0x24b;_0x536317['secure']=![];}if(_0x536317[_0x38d8('0x39')]){_0x536317[_0x38d8('0x62')]=![];}else{_0x536317['CloudProviderId']=null;}if(!_0x5813e4[_0x38d8('0x39')])_0x5813e4[_0x38d8('0x3a')]=null;_0x3c2aee[_0x38d8('0x5f')]['Imap']=_0x5813e4;_0x3c2aee[_0x38d8('0x5f')]['Smtp']=_0x536317;return db['MailAccount'][_0x38d8('0x63')]({'where':{'id':_0x3c2aee[_0x38d8('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x38d8('0x43')],'as':_0x38d8('0x41')},{'model':db[_0x38d8('0x5e')],'as':_0x38d8('0x64')}]})[_0x38d8('0x2a')](handleEntityNotFound(_0x33b0cc,null))[_0x38d8('0x2a')](function(_0x36a521){if(!_0x36a521)throw new Error(_0x38d8('0x65'));if(_0x36a521[_0x38d8('0x3d')])delete _0x3c2aee['body'][_0x38d8('0x3f')];return _0x36a521;})['then'](saveUpdates(_0x3c2aee['body'],null))['then'](function(_0x546e9a){if(!_0x3c2aee[_0x38d8('0x5f')][_0x38d8('0x3f')])return _0x546e9a;return db[_0x38d8('0x42')][_0x38d8('0x26')](_0x3c2aee['body'][_0x38d8('0x3f')],{'where':{'MailAccountId':_0x546e9a['id']}})['then'](function(){return _0x546e9a;});})['then'](function(_0x3ed254){if(!_0x3c2aee[_0x38d8('0x5f')][_0x38d8('0x41')])return _0x3ed254;return db[_0x38d8('0x43')][_0x38d8('0x26')](_0x3c2aee[_0x38d8('0x5f')][_0x38d8('0x41')],{'where':{'MailAccountId':_0x3ed254['id']}})[_0x38d8('0x2a')](function(){return _0x3ed254;});})[_0x38d8('0x2a')](respondWithResult(_0x33b0cc,null))['catch'](handleError(_0x33b0cc,null));};exports['describe']=function(_0x2ef90a,_0x1d86e3){return db[_0x38d8('0x59')][_0x38d8('0x66')]()[_0x38d8('0x2a')](respondWithResult(_0x1d86e3,null))[_0x38d8('0x67')](handleError(_0x1d86e3,null));};exports[_0x38d8('0x68')]=function(_0x27013f,_0x4ea03f){if(_0x27013f[_0x38d8('0x5f')]['id']){delete _0x27013f[_0x38d8('0x5f')]['id'];}return db[_0x38d8('0x59')][_0x38d8('0x63')]({'where':{'id':_0x27013f[_0x38d8('0x5d')]['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x4ea03f,null))[_0x38d8('0x2a')](function(_0x170eaa){if(_0x170eaa){_0x27013f['body'][_0x38d8('0x69')]=_0x170eaa['id'];return db[_0x38d8('0x6a')]['create'](_0x27013f[_0x38d8('0x5f')]);}})[_0x38d8('0x2a')](respondWithResult(_0x4ea03f,null))[_0x38d8('0x67')](handleError(_0x4ea03f,null));};exports[_0x38d8('0x6b')]=function(_0x500abe,_0x27dc90){var _0x5f4723={'raw':![],'where':{}};var _0x2a2402={};var _0x70be3b={'count':0x0,'rows':[]};return db[_0x38d8('0x59')][_0x38d8('0x6c')]({'where':{'id':_0x500abe[_0x38d8('0x5d')]['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x27dc90,null))[_0x38d8('0x2a')](function(_0x2f4343){if(_0x2f4343){_0x2a2402[_0x38d8('0x4c')]=_[_0x38d8('0x49')](db[_0x38d8('0x6a')][_0x38d8('0x45')]);_0x2a2402[_0x38d8('0x48')]=_[_0x38d8('0x49')](_0x500abe[_0x38d8('0x48')]);_0x2a2402[_0x38d8('0x4a')]=_[_0x38d8('0x4b')](_0x2a2402['model'],_0x2a2402[_0x38d8('0x48')]);_0x5f4723[_0x38d8('0x4e')]=_[_0x38d8('0x4b')](_0x2a2402[_0x38d8('0x4c')],qs[_0x38d8('0x4d')](_0x500abe['query'][_0x38d8('0x4d')]));_0x5f4723['attributes']=_0x5f4723[_0x38d8('0x4e')]['length']?_0x5f4723['attributes']:_0x2a2402[_0x38d8('0x4c')];if(!_0x500abe['query']['hasOwnProperty']('nolimit')){_0x5f4723[_0x38d8('0x20')]=qs[_0x38d8('0x20')](_0x500abe[_0x38d8('0x48')][_0x38d8('0x20')]);_0x5f4723[_0x38d8('0x23')]=qs['offset'](_0x500abe['query'][_0x38d8('0x23')]);}_0x5f4723[_0x38d8('0x51')]=qs[_0x38d8('0x52')](_0x500abe[_0x38d8('0x48')][_0x38d8('0x52')]);_0x5f4723[_0x38d8('0x53')]=qs[_0x38d8('0x4a')](_[_0x38d8('0x6d')](_0x500abe[_0x38d8('0x48')],_0x2a2402[_0x38d8('0x4a')]));_0x5f4723[_0x38d8('0x53')][_0x38d8('0x69')]=_0x2f4343['id'];if(_0x500abe[_0x38d8('0x48')]['filter']){_0x5f4723[_0x38d8('0x53')]=_['merge'](_0x5f4723[_0x38d8('0x53')],{'$or':_['map'](_0x5f4723[_0x38d8('0x4e')],function(_0x2e8021){var _0x4fd8c0={};_0x4fd8c0[_0x2e8021]={'$like':'%'+_0x500abe['query'][_0x38d8('0x54')]+'%'};return _0x4fd8c0;})});}_0x5f4723=_['merge']({},_0x5f4723,_0x500abe[_0x38d8('0x58')]);return db['Disposition']['count']({'where':_0x5f4723[_0x38d8('0x53')]})[_0x38d8('0x2a')](function(_0x1d4754){_0x70be3b[_0x38d8('0x22')]=_0x1d4754;if(_0x500abe['query'][_0x38d8('0x5a')]){_0x5f4723[_0x38d8('0x6e')]=[{'all':!![]}];}return db[_0x38d8('0x6a')][_0x38d8('0x5b')](_0x5f4723);})[_0x38d8('0x2a')](function(_0x3b1f9d){_0x70be3b['rows']=_0x3b1f9d;return _0x70be3b;});}})['then'](respondWithFilteredResult(_0x27dc90,_0x5f4723))['catch'](handleError(_0x27dc90,null));};exports[_0x38d8('0x6f')]=function(_0x4e6af1,_0x2e0931){return db[_0x38d8('0x59')][_0x38d8('0x63')]({'where':{'id':_0x4e6af1['params']['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x2e0931,null))[_0x38d8('0x2a')](function(_0x145c73){if(_0x145c73){return _0x145c73[_0x38d8('0x6f')](_0x4e6af1[_0x38d8('0x48')][_0x38d8('0x70')]);}})[_0x38d8('0x2a')](respondWithStatusCode(_0x2e0931,null))[_0x38d8('0x67')](handleError(_0x2e0931,null));};exports[_0x38d8('0x71')]=function(_0x3c8fd1,_0x44e673){if(_0x3c8fd1[_0x38d8('0x5f')]['id']){delete _0x3c8fd1[_0x38d8('0x5f')]['id'];}return db[_0x38d8('0x59')][_0x38d8('0x63')]({'where':{'id':_0x3c8fd1[_0x38d8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x44e673,null))['then'](function(_0x578d4c){if(_0x578d4c){_0x3c8fd1[_0x38d8('0x5f')][_0x38d8('0x69')]=_0x578d4c['id'];return db[_0x38d8('0x72')]['create'](_0x3c8fd1[_0x38d8('0x5f')]);}})[_0x38d8('0x2a')](respondWithResult(_0x44e673,null))[_0x38d8('0x67')](handleError(_0x44e673,null));};exports[_0x38d8('0x73')]=function(_0x52731f,_0x5e743f){var _0x349f4f={'raw':![],'where':{}};var _0x30168b={};var _0x5b58dd={'count':0x0,'rows':[]};return db[_0x38d8('0x59')][_0x38d8('0x6c')]({'where':{'id':_0x52731f['params']['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x5e743f,null))['then'](function(_0xb85f5e){if(_0xb85f5e){_0x30168b[_0x38d8('0x4c')]=_[_0x38d8('0x49')](db[_0x38d8('0x72')][_0x38d8('0x45')]);_0x30168b['query']=_['keys'](_0x52731f['query']);_0x30168b[_0x38d8('0x4a')]=_['intersection'](_0x30168b[_0x38d8('0x4c')],_0x30168b[_0x38d8('0x48')]);_0x349f4f[_0x38d8('0x4e')]=_[_0x38d8('0x4b')](_0x30168b['model'],qs['fields'](_0x52731f[_0x38d8('0x48')][_0x38d8('0x4d')]));_0x349f4f[_0x38d8('0x4e')]=_0x349f4f[_0x38d8('0x4e')][_0x38d8('0x4f')]?_0x349f4f[_0x38d8('0x4e')]:_0x30168b[_0x38d8('0x4c')];if(!_0x52731f[_0x38d8('0x48')][_0x38d8('0x50')]('nolimit')){_0x349f4f[_0x38d8('0x20')]=qs['limit'](_0x52731f[_0x38d8('0x48')][_0x38d8('0x20')]);_0x349f4f[_0x38d8('0x23')]=qs['offset'](_0x52731f['query']['offset']);}_0x349f4f[_0x38d8('0x51')]=qs[_0x38d8('0x52')](_0x52731f[_0x38d8('0x48')][_0x38d8('0x52')]);_0x349f4f[_0x38d8('0x53')]=qs['filters'](_[_0x38d8('0x6d')](_0x52731f[_0x38d8('0x48')],_0x30168b[_0x38d8('0x4a')]));_0x349f4f[_0x38d8('0x53')][_0x38d8('0x69')]=_0xb85f5e['id'];if(_0x52731f['query'][_0x38d8('0x54')]){_0x349f4f[_0x38d8('0x53')]=_[_0x38d8('0x55')](_0x349f4f['where'],{'$or':_[_0x38d8('0x44')](_0x349f4f[_0x38d8('0x4e')],function(_0x43e654){var _0xda7201={};_0xda7201[_0x43e654]={'$like':'%'+_0x52731f[_0x38d8('0x48')][_0x38d8('0x54')]+'%'};return _0xda7201;})});}_0x349f4f=_[_0x38d8('0x55')]({},_0x349f4f,_0x52731f[_0x38d8('0x58')]);return db[_0x38d8('0x72')][_0x38d8('0x22')]({'where':_0x349f4f['where']})['then'](function(_0x3b8067){_0x5b58dd[_0x38d8('0x22')]=_0x3b8067;if(_0x52731f['query'][_0x38d8('0x5a')]){_0x349f4f[_0x38d8('0x6e')]=[{'all':!![]}];}return db[_0x38d8('0x72')][_0x38d8('0x5b')](_0x349f4f);})[_0x38d8('0x2a')](function(_0x1a410a){_0x5b58dd[_0x38d8('0x74')]=_0x1a410a;return _0x5b58dd;});}})[_0x38d8('0x2a')](respondWithFilteredResult(_0x5e743f,_0x349f4f))[_0x38d8('0x67')](handleError(_0x5e743f,null));};exports[_0x38d8('0x75')]=function(_0x28ec9d,_0x59920e){return db[_0x38d8('0x59')]['find']({'where':{'id':_0x28ec9d[_0x38d8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x59920e,null))['then'](function(_0x209c56){if(_0x209c56){return _0x209c56[_0x38d8('0x75')](_0x28ec9d[_0x38d8('0x48')][_0x38d8('0x70')]);}})[_0x38d8('0x2a')](respondWithStatusCode(_0x59920e,null))['catch'](handleError(_0x59920e,null));};exports[_0x38d8('0x76')]=function(_0x345cd7,_0x5e88b0){var _0x182d0c={'name':_0x345cd7[_0x38d8('0x5f')][_0x38d8('0x2b')],'key':_0x345cd7[_0x38d8('0x5f')][_0x38d8('0x47')],'provider':_0x345cd7[_0x38d8('0x5f')][_0x38d8('0x60')]===_0x38d8('0x61')?null:_0x345cd7[_0x38d8('0x5f')]['provider'],'email':_0x345cd7['body']['email'],'ListId':_0x345cd7[_0x38d8('0x5f')]['ListId'],'active':!_[_0x38d8('0x77')](_0x345cd7[_0x38d8('0x5f')]['active'])?_0x345cd7[_0x38d8('0x5f')][_0x38d8('0x78')]:!![],'description':_0x345cd7[_0x38d8('0x5f')][_0x38d8('0x79')]||null};var _0x1de4a7=getAuthenticationOptions(_0x182d0c['provider'],_0x345cd7[_0x38d8('0x5f')]);_0x182d0c[_0x38d8('0x3f')]=_0x1de4a7[_0x38d8('0x3f')];_0x182d0c[_0x38d8('0x41')]=_0x1de4a7[_0x38d8('0x41')];return db['MailAccount'][_0x38d8('0x76')](_0x182d0c,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x38d8('0x42')],'as':_0x38d8('0x3f')}]})[_0x38d8('0x2a')](function(_0x169eae){var _0xbd8f1a=_0x345cd7[_0x38d8('0x36')]['get']({'plain':!![]});if(!_0xbd8f1a)throw new Error(_0x38d8('0x7a'));if(_0xbd8f1a[_0x38d8('0x7b')]==='user'){var _0x17e270=_0x169eae[_0x38d8('0x28')]({'plain':!![]});return db[_0x38d8('0x7c')][_0x38d8('0x63')]({'where':{'name':_0x38d8('0x29'),'userProfileId':_0xbd8f1a[_0x38d8('0x7d')]},'raw':!![]})[_0x38d8('0x2a')](function(_0x4410cf){if(_0x4410cf&&_0x4410cf[_0x38d8('0x7e')]===0x0){return db[_0x38d8('0x7f')]['create']({'name':_0x17e270[_0x38d8('0x2b')],'resourceId':_0x17e270['id'],'type':_0x4410cf['name'],'sectionId':_0x4410cf['id']},{})['then'](function(){return _0x169eae;});}else{return _0x169eae;}})[_0x38d8('0x67')](function(_0x190bea){logger[_0x38d8('0x18')](_0x38d8('0x80'),_0x190bea);throw _0x190bea;});}return _0x169eae;})[_0x38d8('0x2a')](respondWithResult(_0x5e88b0,0xc9))[_0x38d8('0x67')](handleError(_0x5e88b0,null));};exports[_0x38d8('0x81')]=function(_0x272207,_0xedffba){return db[_0x38d8('0x59')][_0x38d8('0x6c')]({'where':{'id':_0x272207[_0x38d8('0x5d')]['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0xedffba,null))[_0x38d8('0x2a')](function(_0x545eb8){if(_0x545eb8){return _0x545eb8[_0x38d8('0x81')]();}return null;})[_0x38d8('0x2a')](respondWithResult(_0xedffba,null))[_0x38d8('0x67')](handleError(_0xedffba,null));};exports[_0x38d8('0x82')]=function(_0x572b1d,_0x43e43c){if(_0x572b1d[_0x38d8('0x5f')]['id']){delete _0x572b1d[_0x38d8('0x5f')]['id'];}return db[_0x38d8('0x59')][_0x38d8('0x63')]({'where':{'id':_0x572b1d[_0x38d8('0x5d')]['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x43e43c,null))[_0x38d8('0x2a')](function(_0x515dbc){if(_0x515dbc){_0x572b1d[_0x38d8('0x5f')][_0x38d8('0x69')]=_0x515dbc['id'];return db[_0x38d8('0x42')][_0x38d8('0x76')](_0x572b1d[_0x38d8('0x5f')]);}})['then'](respondWithResult(_0x43e43c,null))[_0x38d8('0x67')](handleError(_0x43e43c,null));};exports[_0x38d8('0x83')]=function(_0x3641bc,_0x2ade35){return db['MailAccount'][_0x38d8('0x6c')]({'where':{'id':_0x3641bc[_0x38d8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2ade35,null))['then'](function(_0x2a3b47){if(_0x2a3b47){return _0x2a3b47[_0x38d8('0x84')](null);}return null;})[_0x38d8('0x2a')](respondWithStatusCode(_0x2ade35,null))['catch'](handleError(_0x2ade35,null));};exports[_0x38d8('0x85')]=function(_0x1fd792,_0x56571e){return db[_0x38d8('0x59')][_0x38d8('0x6c')]({'where':{'id':_0x1fd792[_0x38d8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x56571e,null))[_0x38d8('0x2a')](function(_0x2c4377){if(_0x2c4377){return _0x2c4377[_0x38d8('0x85')]();}return null;})[_0x38d8('0x2a')](respondWithResult(_0x56571e,null))[_0x38d8('0x67')](handleError(_0x56571e,null));};exports['addSmtp']=function(_0x56967c,_0x597f26){if(_0x56967c[_0x38d8('0x5f')]['id']){delete _0x56967c['body']['id'];}return db['MailAccount'][_0x38d8('0x63')]({'where':{'id':_0x56967c['params']['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x597f26,null))[_0x38d8('0x2a')](function(_0x4908f7){if(_0x4908f7){_0x56967c[_0x38d8('0x5f')][_0x38d8('0x69')]=_0x4908f7['id'];return db[_0x38d8('0x43')][_0x38d8('0x76')](_0x56967c[_0x38d8('0x5f')]);}})[_0x38d8('0x2a')](respondWithResult(_0x597f26,null))['catch'](handleError(_0x597f26,null));};exports[_0x38d8('0x86')]=function(_0x102791,_0x3d577d){return db[_0x38d8('0x59')][_0x38d8('0x6c')]({'where':{'id':_0x102791['params']['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x3d577d,null))[_0x38d8('0x2a')](function(_0x22428e){if(_0x22428e){return _0x22428e[_0x38d8('0x87')](null);}return null;})[_0x38d8('0x2a')](respondWithStatusCode(_0x3d577d,null))[_0x38d8('0x67')](handleError(_0x3d577d,null));};exports[_0x38d8('0x88')]=function(_0x494926,_0x1ebf3b){return db[_0x38d8('0x89')][_0x38d8('0x63')]({'where':{'id':_0x494926[_0x38d8('0x5d')]['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x1ebf3b,null))['then'](function(_0x11ecf5){if(_0x11ecf5){return _0x11ecf5[_0x38d8('0x88')](_0x494926['body'][_0x38d8('0x70')],_[_0x38d8('0x8a')](_0x494926['body'],[_0x38d8('0x70'),'id'])||{});}})[_0x38d8('0x2a')](respondWithResult(_0x1ebf3b,null))[_0x38d8('0x67')](handleError(_0x1ebf3b,null));};exports['getInteractions']=function(_0xc0fd44,_0x5d8af3){var _0x36ac16={'raw':![],'where':{}};var _0x153709={};var _0x10d738={'count':0x0,'rows':[]};return db[_0x38d8('0x59')][_0x38d8('0x6c')]({'where':{'id':_0xc0fd44['params']['id']}})['then'](handleEntityNotFound(_0x5d8af3,null))[_0x38d8('0x2a')](function(_0x1ffaf3){if(_0x1ffaf3){_0x153709[_0x38d8('0x4c')]=_[_0x38d8('0x49')](db[_0x38d8('0x89')][_0x38d8('0x45')]);_0x153709[_0x38d8('0x48')]=_[_0x38d8('0x49')](_0xc0fd44['query']);_0x153709['filters']=_['intersection'](_0x153709[_0x38d8('0x4c')],_0x153709[_0x38d8('0x48')]);_0x36ac16[_0x38d8('0x4e')]=_[_0x38d8('0x4b')](_0x153709['model'],qs[_0x38d8('0x4d')](_0xc0fd44[_0x38d8('0x48')]['fields']));_0x36ac16['attributes']=_0x36ac16[_0x38d8('0x4e')][_0x38d8('0x4f')]?_0x36ac16[_0x38d8('0x4e')]:_0x153709[_0x38d8('0x4c')];if(!_0xc0fd44[_0x38d8('0x48')][_0x38d8('0x50')](_0x38d8('0x8b'))){_0x36ac16[_0x38d8('0x20')]=qs[_0x38d8('0x20')](_0xc0fd44[_0x38d8('0x48')][_0x38d8('0x20')]);_0x36ac16[_0x38d8('0x23')]=qs[_0x38d8('0x23')](_0xc0fd44[_0x38d8('0x48')]['offset']);}_0x36ac16[_0x38d8('0x51')]=qs[_0x38d8('0x52')](_0xc0fd44[_0x38d8('0x48')][_0x38d8('0x52')]);_0x36ac16[_0x38d8('0x53')]=qs[_0x38d8('0x4a')](_[_0x38d8('0x6d')](_0xc0fd44[_0x38d8('0x48')],_0x153709['filters']));_0x36ac16[_0x38d8('0x53')][_0x38d8('0x69')]=_0x1ffaf3['id'];if(_0xc0fd44['query'][_0x38d8('0x54')]){_0x36ac16[_0x38d8('0x53')]=_['merge'](_0x36ac16['where'],{'$or':_[_0x38d8('0x44')](_0x36ac16[_0x38d8('0x4e')],function(_0xfd738d){var _0x1b00eb={};_0x1b00eb[_0xfd738d]={'$like':'%'+_0xc0fd44[_0x38d8('0x48')][_0x38d8('0x54')]+'%'};return _0x1b00eb;})});}_0x36ac16=_[_0x38d8('0x55')]({},_0x36ac16,_0xc0fd44[_0x38d8('0x58')]);return db[_0x38d8('0x89')][_0x38d8('0x22')]({'where':_0x36ac16['where']})[_0x38d8('0x2a')](function(_0x5b6d9d){_0x10d738['count']=_0x5b6d9d;if(_0xc0fd44[_0x38d8('0x48')][_0x38d8('0x5a')]){_0x36ac16[_0x38d8('0x6e')]=[{'model':db['CmContact'],'as':_0x38d8('0x8c'),'required':![]},{'model':db[_0x38d8('0x8d')],'as':_0x38d8('0x8e'),'attributes':[_0x38d8('0x2b'),_0x38d8('0x8f'),'internal'],'required':![]},{'model':db[_0x38d8('0x90')],'as':_0x38d8('0x91'),'attributes':['id',_0x38d8('0x2b'),_0x38d8('0x92')],'where':_0xc0fd44[_0x38d8('0x48')]['tag']?{'id':_0xc0fd44[_0x38d8('0x48')][_0x38d8('0x93')]}:undefined,'required':_0xc0fd44[_0x38d8('0x48')][_0x38d8('0x93')]?!![]:![]}];}return db[_0x38d8('0x89')][_0x38d8('0x5b')](_0x36ac16);})[_0x38d8('0x2a')](function(_0x24ef85){_0x10d738[_0x38d8('0x74')]=_0x24ef85;return _0x10d738;});}})['then'](respondWithFilteredResult(_0x5d8af3,_0x36ac16))[_0x38d8('0x67')](handleError(_0x5d8af3,null));};exports[_0x38d8('0x94')]=function addApplications(_0x25f906,_0x45ed6e){var _0xc83e=_0x25f906['params']['id'];var _0x580c6f=_0x25f906['body'];var _0x750fa1=0xc8;var _0x12c39c=null;return db[_0x38d8('0x95')]['transaction']({'isolationLevel':db['sequelize'][_0x38d8('0x96')][_0x38d8('0x97')][_0x38d8('0x98')]},function(_0xf0740c){return db['MailAccount'][_0x38d8('0x6c')]({'where':{'id':_0xc83e},'transaction':_0xf0740c})[_0x38d8('0x2a')](function(_0x5e0d6){if(_0x5e0d6){return db[_0x38d8('0x99')][_0x38d8('0x27')]({'where':{'MailAccountId':_0xc83e},'transaction':_0xf0740c})[_0x38d8('0x2a')](function(){var _0x5991c4=_[_0x38d8('0x44')](_0x580c6f,function(_0x24db76){_0x24db76['MailAccountId']=_0xc83e;return _0x24db76;});return db[_0x38d8('0x99')][_0x38d8('0x9a')](_0x5991c4,{'transaction':_0xf0740c});});}else{_0x750fa1=0x194;_0x12c39c=[];}});})[_0x38d8('0x2a')](function(){if(_0x750fa1!==0x194){return db['MailApplication'][_0x38d8('0x9b')]({'where':{'MailAccountId':_0xc83e},'order':_0x38d8('0x9c')})[_0x38d8('0x2a')](function(_0x3edd7f){_0x12c39c=_0x3edd7f;});}})[_0x38d8('0x67')](function(_0xb4eef2){_0x750fa1=0x1f4;logger[_0x38d8('0x18')](_0xb4eef2[_0x38d8('0x9d')]);if(_0xb4eef2[_0x38d8('0x2b')]){delete _0xb4eef2[_0x38d8('0x2b')];}_0x12c39c=_0xb4eef2;})[_0x38d8('0x9e')](function(){if(_0x12c39c===null){_0x45ed6e[_0x38d8('0x1c')](_0x750fa1);}else{if(_0x750fa1===0x1f4){_0x45ed6e[_0x38d8('0x1d')](_0x750fa1)[_0x38d8('0x2c')](_0x12c39c);}else{_0x45ed6e['status'](_0x750fa1)['json'](_0x12c39c);}}});};exports[_0x38d8('0x9f')]=function(_0x2f7ea8,_0x50060d){var _0x45c5a5={};var _0x2964e2={};var _0xc5ec4c;var _0x2986f2;return db['MailAccount']['findOne']({'where':{'id':_0x2f7ea8[_0x38d8('0x5d')]['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x50060d,null))[_0x38d8('0x2a')](function(_0x1b8b51){if(_0x1b8b51){_0xc5ec4c=_0x1b8b51;_0x2964e2[_0x38d8('0x4c')]=_['keys'](db[_0x38d8('0x99')][_0x38d8('0x45')]);_0x2964e2[_0x38d8('0x48')]=_['keys'](_0x2f7ea8[_0x38d8('0x48')]);_0x2964e2['filters']=_[_0x38d8('0x4b')](_0x2964e2[_0x38d8('0x4c')],_0x2964e2['query']);_0x45c5a5[_0x38d8('0x4e')]=_['intersection'](_0x2964e2[_0x38d8('0x4c')],qs[_0x38d8('0x4d')](_0x2f7ea8['query'][_0x38d8('0x4d')]));_0x45c5a5[_0x38d8('0x4e')]=_0x45c5a5[_0x38d8('0x4e')][_0x38d8('0x4f')]?_0x45c5a5[_0x38d8('0x4e')]:_0x2964e2['model'];_0x45c5a5[_0x38d8('0x51')]=qs['sort'](_0x2f7ea8[_0x38d8('0x48')][_0x38d8('0x52')]);_0x45c5a5[_0x38d8('0x53')]=qs[_0x38d8('0x4a')](_[_0x38d8('0x6d')](_0x2f7ea8[_0x38d8('0x48')],_0x2964e2[_0x38d8('0x4a')]));if(_0x2f7ea8[_0x38d8('0x48')]['filter']){_0x45c5a5['where']=_[_0x38d8('0x55')](_0x45c5a5[_0x38d8('0x53')],{'$or':_[_0x38d8('0x44')](_0x45c5a5[_0x38d8('0x4e')],function(_0x58c7fc){var _0x5baced={};_0x5baced[_0x58c7fc]={'$like':'%'+_0x2f7ea8[_0x38d8('0x48')][_0x38d8('0x54')]+'%'};return _0x5baced;})});}_0x45c5a5=_[_0x38d8('0x55')]({},_0x45c5a5,_0x2f7ea8['options']);return _0xc5ec4c[_0x38d8('0x9f')](_0x45c5a5);}})[_0x38d8('0x2a')](function(_0x450207){if(_0x450207){_0x2986f2=_0x450207[_0x38d8('0x4f')];if(!_0x2f7ea8[_0x38d8('0x48')][_0x38d8('0x50')](_0x38d8('0x8b'))){_0x45c5a5[_0x38d8('0x20')]=qs['limit'](_0x2f7ea8[_0x38d8('0x48')][_0x38d8('0x20')]);_0x45c5a5['offset']=qs[_0x38d8('0x23')](_0x2f7ea8[_0x38d8('0x48')]['offset']);}return _0xc5ec4c[_0x38d8('0x9f')](_0x45c5a5);}})['then'](function(_0xf5fd21){if(_0xf5fd21){return _0xf5fd21?{'count':_0x2986f2,'rows':_0xf5fd21}:null;}})[_0x38d8('0x2a')](respondWithResult(_0x50060d,null))[_0x38d8('0x67')](handleError(_0x50060d,null));};exports[_0x38d8('0xa0')]=function(_0x510786,_0x1842d9){var _0x24eb76={'raw':!![],'where':{}};var _0xd5921c={};var _0x5dd0fc={'count':0x0,'rows':[]};return db['MailAccount'][_0x38d8('0x6c')]({'where':{'id':_0x510786['params']['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x1842d9,null))[_0x38d8('0x2a')](function(_0x2bfd20){if(_0x2bfd20){_0xd5921c['model']=_[_0x38d8('0x49')](db[_0x38d8('0xa1')]['rawAttributes']);_0xd5921c['query']=_[_0x38d8('0x49')](_0x510786[_0x38d8('0x48')]);_0xd5921c[_0x38d8('0x4a')]=_[_0x38d8('0x4b')](_0xd5921c[_0x38d8('0x4c')],_0xd5921c[_0x38d8('0x48')]);_0x24eb76[_0x38d8('0x4e')]=_[_0x38d8('0x4b')](_0xd5921c[_0x38d8('0x4c')],qs[_0x38d8('0x4d')](_0x510786[_0x38d8('0x48')][_0x38d8('0x4d')]));_0x24eb76[_0x38d8('0x4e')]=_0x24eb76['attributes'][_0x38d8('0x4f')]?_0x24eb76[_0x38d8('0x4e')]:_0xd5921c[_0x38d8('0x4c')];if(!_0x510786[_0x38d8('0x48')][_0x38d8('0x50')](_0x38d8('0x8b'))){_0x24eb76[_0x38d8('0x20')]=qs[_0x38d8('0x20')](_0x510786[_0x38d8('0x48')][_0x38d8('0x20')]);_0x24eb76[_0x38d8('0x23')]=qs[_0x38d8('0x23')](_0x510786[_0x38d8('0x48')][_0x38d8('0x23')]);}_0x24eb76[_0x38d8('0x51')]=qs[_0x38d8('0x52')](_0x510786[_0x38d8('0x48')]['sort']);_0x24eb76[_0x38d8('0x53')]=qs[_0x38d8('0x4a')](_[_0x38d8('0x6d')](_0x510786[_0x38d8('0x48')],_0xd5921c['filters']));_0x24eb76['where'][_0x38d8('0x69')]=_0x2bfd20['id'];if(_0x510786[_0x38d8('0x48')][_0x38d8('0x54')]){_0x24eb76[_0x38d8('0x53')]=_[_0x38d8('0x55')](_0x24eb76[_0x38d8('0x53')],{'$or':_[_0x38d8('0x44')](_0x24eb76['attributes'],function(_0x2ece92){var _0x5e3ca8={};_0x5e3ca8[_0x2ece92]={'$like':'%'+_0x510786['query'][_0x38d8('0x54')]+'%'};return _0x5e3ca8;})});}if(_0x510786['query'][_0x38d8('0xa2')]){var _0x237f48=_0x510786['query'][_0x38d8('0xa2')]['split'](',');var _0xad463a={};_0xad463a[_0x237f48[0x0]]={'$gte':moment(_0x237f48[0x1])[_0x38d8('0xa3')](_0x38d8('0xa4'))};_0x24eb76[_0x38d8('0x53')]=_[_0x38d8('0x55')](_0x24eb76['where'],_0xad463a);}_0x24eb76=_[_0x38d8('0x55')]({},_0x24eb76,_0x510786['options']);return db['MailMessage']['count']({'where':_0x24eb76[_0x38d8('0x53')]})[_0x38d8('0x2a')](function(_0x3bbcc2){_0x5dd0fc[_0x38d8('0x22')]=_0x3bbcc2;if(_0x510786[_0x38d8('0x48')][_0x38d8('0x5a')]){_0x24eb76[_0x38d8('0x6e')]=[{'all':!![]}];}return db[_0x38d8('0xa1')]['findAll'](_0x24eb76);})['then'](function(_0xe46f83){if(_0x510786[_0x38d8('0x48')]['inlineCss']==='true'){for(var _0x4139ed=0x0;_0x4139ed<_0xe46f83[_0x38d8('0x4f')];_0x4139ed++){_0xe46f83[_0x4139ed]['body']=juice(_0xe46f83[_0x4139ed][_0x38d8('0x5f')]);}}_0x5dd0fc['rows']=_0xe46f83;return _0x5dd0fc;});}})[_0x38d8('0x2a')](respondWithFilteredResult(_0x1842d9,_0x24eb76))[_0x38d8('0x67')](handleError(_0x1842d9,null));};exports[_0x38d8('0x2c')]=function(_0x3fb810,_0x5abb0d){var _0x3c3518,_0x398def={},_0x19c007;if(_0x3fb810[_0x38d8('0x5f')]['to']){_0x19c007=_0x3fb810[_0x38d8('0x5f')]['to'][_0x38d8('0xa5')](',')[0x0];}return db['MailAccount'][_0x38d8('0x63')]({'where':{'id':_0x3fb810['params']['id']},'include':[{'model':db[_0x38d8('0xa6')],'as':_0x38d8('0xa7'),'include':[{'model':db[_0x38d8('0xa8')],'as':_0x38d8('0xa9'),'where':{'email':_0x19c007},'limit':0x1,'order':[[_0x38d8('0xaa'),_0x38d8('0xab')]]}]},{'model':db[_0x38d8('0x43')],'as':_0x38d8('0x41'),'raw':!![],'include':[{'model':db[_0x38d8('0xac')],'as':_0x38d8('0xac'),'raw':!![]}]}]})[_0x38d8('0x2a')](handleEntityNotFound(_0x5abb0d,null))[_0x38d8('0x2a')](function(_0x1dcf9b){if(!_0x1dcf9b)return;_0x3c3518=_0x1dcf9b;if(!_0x1dcf9b[_0x38d8('0x41')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x38d8('0x77')](_0x3fb810['body'][_0x38d8('0xad')])){_0x3fb810[_0x38d8('0x5f')][_0x38d8('0xad')]=util[_0x38d8('0xa3')](_0x38d8('0xae'),_0x1dcf9b[_0x38d8('0x2b')],_0x1dcf9b[_0x38d8('0xaf')]||_0x1dcf9b[_0x38d8('0x41')]['user']);}if(_0x3fb810[_0x38d8('0x5f')][_0x38d8('0xb0')]&&_0x3fb810[_0x38d8('0x5f')]['attachments']['length']){for(var _0x2f8420=0x0;_0x2f8420<_0x3fb810[_0x38d8('0x5f')][_0x38d8('0xb0')][_0x38d8('0x4f')];_0x2f8420+=0x1){_0x3fb810[_0x38d8('0x5f')][_0x38d8('0xb0')][_0x2f8420]={'filename':_0x3fb810[_0x38d8('0x5f')][_0x38d8('0xb0')][_0x2f8420]['name'],'path':path[_0x38d8('0xb1')](config[_0x38d8('0xb2')],_0x38d8('0xb3'),_0x3fb810[_0x38d8('0x5f')][_0x38d8('0xb0')][_0x2f8420][_0x38d8('0xb4')])};}}var _0x35bcfa=_0x1dcf9b['getSmtpOptions']();return respondWithRpcPromise(_0x38d8('0xb5'),_0x38d8('0xb6'),{'account':_0x35bcfa,'message':_0x3fb810[_0x38d8('0x5f')]});})[_0x38d8('0x2a')](function(_0x4ef5dd){if(!_0x4ef5dd)return;_0x398def=_0x4ef5dd;if(!_0x3c3518['List'])throw new Error(_0x38d8('0xb7'));if(_0x3c3518['List'][_0x38d8('0xa9')][_0x38d8('0x4f')])return _0x3c3518[_0x38d8('0xa7')]['Contacts'][0x0];return db[_0x38d8('0xa8')][_0x38d8('0x76')](_['defaults'](_0x3fb810[_0x38d8('0x5f')],{'firstName':_0x3fb810['body']['to'],'email':_0x3fb810[_0x38d8('0x5f')]['to'],'phone':_0x3fb810[_0x38d8('0x5f')]['to'],'ListId':_0x3c3518['ListId']}));})[_0x38d8('0x2a')](function(_0xa7bc73){if(!_0xa7bc73)return;var _0x1807fb={'UserId':_0x3fb810[_0x38d8('0x36')]['id'],'ContactId':_0xa7bc73['id'],'MailAccountId':_0x3c3518['id'],'inReplyTo':_0x398def['messageId'],'to':_0x3fb810[_0x38d8('0x5f')][_0x38d8('0xad')],'cc':_0x3fb810[_0x38d8('0x5f')]['cc'],'subject':_0x3fb810['body'][_0x38d8('0xb8')],'attach':_0x3fb810['body'][_0x38d8('0xb9')],'firstMsgDirection':_0x38d8('0xba'),'lastMsgAt':moment()[_0x38d8('0xa3')](_0x38d8('0xa4')),'lastMsgDirection':_0x38d8('0xba'),'Messages':[_[_0x38d8('0x55')](_0x3fb810[_0x38d8('0x5f')],{'messageId':_0x398def['messageId'],'sentAt':moment()[_0x38d8('0xa3')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3c3518['id'],'UserId':_0x3fb810['user']['id'],'ContactId':_0xa7bc73['id']})]};if(_0x3fb810['body'][_0x38d8('0xbb')]){_0x1807fb=_[_0x38d8('0x55')](_0x1807fb,_0x3fb810['body']['Interaction']);}return db['MailInteraction'][_0x38d8('0x76')](_0x1807fb,{'include':[{'model':db[_0x38d8('0xa1')],'as':_0x38d8('0xbc')}]});})[_0x38d8('0x2a')](respondWithResult(_0x5abb0d,null))['catch'](handleError(_0x5abb0d,null));};exports['verifySmtp']=function(_0x570d8d,_0x2b0552){return db['MailAccount'][_0x38d8('0x63')]({'where':{'id':_0x570d8d[_0x38d8('0x5d')]['id']},'include':[{'model':db[_0x38d8('0x43')],'as':_0x38d8('0x41'),'raw':!![],'include':[{'model':db[_0x38d8('0xac')],'as':'CloudProvider','raw':!![]}]}]})[_0x38d8('0x2a')](handleEntityNotFound(_0x2b0552,null))['then'](function(_0x5d4af3){if(!_0x5d4af3[_0x38d8('0x41')])return;var _0x51956b=_0x5d4af3[_0x38d8('0xbd')]();return respondWithRpcPromise('VerifySmtp',_0x38d8('0xbe'),{'account':_0x51956b});})[_0x38d8('0x2a')](respondWithResult(_0x2b0552,null))[_0x38d8('0x67')](handleError(_0x2b0552,null));};exports[_0x38d8('0x27')]=function(_0x430f3f,_0xa56f9b){return db[_0x38d8('0x59')]['find']({'where':{'id':_0x430f3f[_0x38d8('0x5d')]['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0xa56f9b,null))[_0x38d8('0x2a')](function(_0x58b763){if(_0x58b763&&_0x58b763[_0x38d8('0x3d')]){throw new db[(_0x38d8('0xbf'))][(_0x38d8('0xc0'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x58b763;})[_0x38d8('0x2a')](removeEntity(_0xa56f9b,null))['catch'](handleError(_0xa56f9b,null));};exports['addAgents']=function(_0xf5b330,_0x297a50){return db[_0x38d8('0x59')][_0x38d8('0x63')]({'where':{'id':_0xf5b330[_0x38d8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x297a50,null))[_0x38d8('0x2a')](function(_0x2904ad){if(_0x2904ad){return _0x2904ad[_0x38d8('0xc1')](_0xf5b330['body'][_0x38d8('0x70')],_[_0x38d8('0x8a')](_0xf5b330[_0x38d8('0x5f')],[_0x38d8('0x70'),'id'])||{})['spread'](function(_0x2034a1){for(var _0x5bed4c=0x0;_0x5bed4c<_0xf5b330['body'][_0x38d8('0x70')][_0x38d8('0x4f')];_0x5bed4c+=0x1){socket[_0x38d8('0xc2')](_0x38d8('0xc3'),{'UserId':Number(_0xf5b330[_0x38d8('0x5f')]['ids'][_0x5bed4c]),'MailAccountId':Number(_0xf5b330[_0x38d8('0x5d')]['id'])});}return _0x2034a1;});}})[_0x38d8('0x2a')](respondWithResult(_0x297a50,null))['catch'](handleError(_0x297a50,null));};exports[_0x38d8('0xc4')]=function(_0x8b6f08,_0x3ca0b9){return db[_0x38d8('0x59')][_0x38d8('0x63')]({'where':{'id':_0x8b6f08['params']['id']}})[_0x38d8('0x2a')](handleEntityNotFound(_0x3ca0b9,null))[_0x38d8('0x2a')](function(_0x185309){if(_0x185309){return _0x185309['removeAgents'](_0x8b6f08[_0x38d8('0x48')][_0x38d8('0x70')])[_0x38d8('0x2a')](function(){if(_[_0x38d8('0xc5')](_0x8b6f08[_0x38d8('0x48')][_0x38d8('0x70')])){for(var _0x32fed2=0x0;_0x32fed2<_0x8b6f08[_0x38d8('0x48')][_0x38d8('0x70')][_0x38d8('0x4f')];_0x32fed2+=0x1){socket[_0x38d8('0xc2')]('userMailAccount:remove',{'UserId':Number(_0x8b6f08[_0x38d8('0x48')][_0x38d8('0x70')][_0x32fed2]),'MailAccountId':Number(_0x8b6f08['params']['id'])});}}else{socket[_0x38d8('0xc2')](_0x38d8('0xc6'),{'UserId':Number(_0x8b6f08['query'][_0x38d8('0x70')]),'MailAccountId':Number(_0x8b6f08[_0x38d8('0x5d')]['id'])});}});}})[_0x38d8('0x2a')](respondWithStatusCode(_0x3ca0b9,null))['catch'](handleError(_0x3ca0b9,null));};exports[_0x38d8('0xc7')]=function(_0xe8503e,_0x372610){var _0x2ddfe0={};var _0x43b70f={};var _0x2ea133;var _0x153357;return db[_0x38d8('0x59')]['findOne']({'where':{'id':_0xe8503e[_0x38d8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x372610,null))['then'](function(_0xeb9106){if(_0xeb9106){_0x2ea133=_0xeb9106;_0x43b70f[_0x38d8('0x4c')]=_[_0x38d8('0x49')](db['User']['rawAttributes']);_0x43b70f[_0x38d8('0x48')]=_[_0x38d8('0x49')](_0xe8503e[_0x38d8('0x48')]);_0x43b70f[_0x38d8('0x4a')]=_[_0x38d8('0x4b')](_0x43b70f[_0x38d8('0x4c')],_0x43b70f[_0x38d8('0x48')]);_0x2ddfe0[_0x38d8('0x4e')]=_[_0x38d8('0x4b')](_0x43b70f[_0x38d8('0x4c')],qs[_0x38d8('0x4d')](_0xe8503e[_0x38d8('0x48')]['fields']));_0x2ddfe0[_0x38d8('0x4e')]=_0x2ddfe0[_0x38d8('0x4e')]['length']?_0x2ddfe0[_0x38d8('0x4e')]:_0x43b70f[_0x38d8('0x4c')];_0x2ddfe0[_0x38d8('0x51')]=qs['sort'](_0xe8503e['query']['sort']);_0x2ddfe0['where']=qs[_0x38d8('0x4a')](_[_0x38d8('0x6d')](_0xe8503e[_0x38d8('0x48')],_0x43b70f[_0x38d8('0x4a')]));if(_0xe8503e[_0x38d8('0x48')]['filter']){_0x2ddfe0[_0x38d8('0x53')]=_[_0x38d8('0x55')](_0x2ddfe0[_0x38d8('0x53')],{'$or':_[_0x38d8('0x44')](_0x2ddfe0[_0x38d8('0x4e')],function(_0x15e356){var _0x1f923a={};_0x1f923a[_0x15e356]={'$like':'%'+_0xe8503e['query']['filter']+'%'};return _0x1f923a;})});}_0x2ddfe0=_[_0x38d8('0x55')]({},_0x2ddfe0,_0xe8503e['options']);return _0x2ea133[_0x38d8('0xc7')](_0x2ddfe0);}})['then'](function(_0x457ef1){if(_0x457ef1){_0x153357=_0x457ef1['length'];if(!_0xe8503e[_0x38d8('0x48')][_0x38d8('0x50')](_0x38d8('0x8b'))){_0x2ddfe0['limit']=qs[_0x38d8('0x20')](_0xe8503e[_0x38d8('0x48')][_0x38d8('0x20')]);_0x2ddfe0[_0x38d8('0x23')]=qs['offset'](_0xe8503e['query'][_0x38d8('0x23')]);}return _0x2ea133['getAgents'](_0x2ddfe0);}})[_0x38d8('0x2a')](function(_0x46b573){if(_0x46b573){return _0x46b573?{'count':_0x153357,'rows':_0x46b573}:null;}})[_0x38d8('0x2a')](respondWithResult(_0x372610,null))[_0x38d8('0x67')](handleError(_0x372610,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b204404..c2daaf8 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 _0x524e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','MailAccount'];(function(_0x5beda5,_0x1ea9cb){var _0x2e420f=function(_0x19fbf7){while(--_0x19fbf7){_0x5beda5['push'](_0x5beda5['shift']());}};_0x2e420f(++_0x1ea9cb);}(_0x524e,0x15e));var _0xe524=function(_0xdac35a,_0x5b1723){_0xdac35a=_0xdac35a-0x0;var _0x19438d=_0x524e[_0xdac35a];return _0x19438d;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0xe524('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe524('0x1')](0x0);var events={'afterCreate':_0xe524('0x2'),'afterUpdate':_0xe524('0x3'),'afterDestroy':_0xe524('0x4')};function emitEvent(_0x379eb1){return function(_0xabd694,_0x32c90b,_0x10d37a){MailAccountEvents[_0xe524('0x5')](_0x379eb1+':'+_0xabd694['id'],_0xabd694);MailAccountEvents['emit'](_0x379eb1,_0xabd694);_0x10d37a(null);};}for(var e in events){if(events[_0xe524('0x6')](e)){var event=events[e];MailAccount[_0xe524('0x7')](e,emitEvent(event));}}module[_0xe524('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x5a99=['emit','hook','exports','events','../../mysqldb','MailAccount','save','update','remove'];(function(_0x42e988,_0xd8abe0){var _0x5ce1fb=function(_0x2531bc){while(--_0x2531bc){_0x42e988['push'](_0x42e988['shift']());}};_0x5ce1fb(++_0xd8abe0);}(_0x5a99,0xc9));var _0x95a9=function(_0x3676f3,_0x2fa525){_0x3676f3=_0x3676f3-0x0;var _0x102bd5=_0x5a99[_0x3676f3];return _0x102bd5;};'use strict';var EventEmitter=require(_0x95a9('0x0'));var MailAccount=require(_0x95a9('0x1'))['db'][_0x95a9('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x95a9('0x3'),'afterUpdate':_0x95a9('0x4'),'afterDestroy':_0x95a9('0x5')};function emitEvent(_0x475a71){return function(_0x4b30e2,_0x2c8e52,_0x3ff50a){MailAccountEvents[_0x95a9('0x6')](_0x475a71+':'+_0x4b30e2['id'],_0x4b30e2);MailAccountEvents[_0x95a9('0x6')](_0x475a71,_0x4b30e2);_0x3ff50a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x95a9('0x7')](e,emitEvent(event));}}module[_0x95a9('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 8e2aef0..f66bbce 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 _0x5f57=['host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','provider','custom'];(function(_0x1d7636,_0x477d46){var _0x382f4e=function(_0x5de667){while(--_0x5de667){_0x1d7636['push'](_0x1d7636['shift']());}};_0x382f4e(++_0x477d46);}(_0x5f57,0x186));var _0x75f5=function(_0x512c5e,_0x4a888b){_0x512c5e=_0x512c5e-0x0;var _0x30befd=_0x5f57[_0x512c5e];return _0x30befd;};'use strict';var attributes=require(_0x75f5('0x0'));module[_0x75f5('0x1')]=function(_0x454d68){return _0x454d68[_0x75f5('0x2')](_0x75f5('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x486801=this;var _0x5b94ae={'id':_0x486801['id'],'tls':{'rejectUnauthorized':![]}};if(_0x486801[_0x75f5('0x4')]!==_0x75f5('0x5')){_0x5b94ae['service']=_0x486801[_0x75f5('0x4')];}else{_0x5b94ae[_0x75f5('0x6')]=_0x486801[_0x75f5('0x7')]['host'];_0x5b94ae[_0x75f5('0x8')]=_0x486801[_0x75f5('0x7')][_0x75f5('0x8')];_0x5b94ae[_0x75f5('0x9')]=_0x486801[_0x75f5('0x7')][_0x75f5('0x9')];}if(_0x486801[_0x75f5('0x7')][_0x75f5('0xa')]){if(_0x486801[_0x75f5('0x7')][_0x75f5('0xb')]){if(!_0x486801[_0x75f5('0x7')][_0x75f5('0xc')])throw new Error(_0x75f5('0xd'));_0x5b94ae[_0x75f5('0xe')]={'type':'OAuth2','user':_0x486801['Smtp'][_0x75f5('0xf')],'accessToken':_0x486801['Smtp'][_0x75f5('0xc')][_0x75f5('0x10')]};}else{_0x5b94ae['auth']={'user':_0x486801[_0x75f5('0x7')][_0x75f5('0xf')],'pass':_0x486801['Smtp'][_0x75f5('0x11')]};}}return _0x5b94ae;}}});}; \ No newline at end of file +var _0xa244=['Smtp','port','secure','authentication','modernAuthentication','CloudProvider','auth','OAuth2','user','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa244,0xc8));var _0x4a24=function(_0x2a960f,_0x5aab73){_0x2a960f=_0x2a960f-0x0;var _0x5027df=_0xa244[_0x2a960f];return _0x5027df;};'use strict';var attributes=require(_0x4a24('0x0'));module[_0x4a24('0x1')]=function(_0xd01d8a){return _0xd01d8a[_0x4a24('0x2')](_0x4a24('0x3'),attributes,{'tableName':_0x4a24('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2049ab=this;var _0xfdd617={'id':_0x2049ab['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2049ab[_0x4a24('0x5')]!==_0x4a24('0x6')){_0xfdd617[_0x4a24('0x7')]=_0x2049ab[_0x4a24('0x5')];}else{_0xfdd617[_0x4a24('0x8')]=_0x2049ab[_0x4a24('0x9')]['host'];_0xfdd617[_0x4a24('0xa')]=_0x2049ab['Smtp']['port'];_0xfdd617[_0x4a24('0xb')]=_0x2049ab[_0x4a24('0x9')]['secure'];}if(_0x2049ab['Smtp'][_0x4a24('0xc')]){if(_0x2049ab['Smtp'][_0x4a24('0xd')]){if(!_0x2049ab[_0x4a24('0x9')][_0x4a24('0xe')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0xfdd617[_0x4a24('0xf')]={'type':_0x4a24('0x10'),'user':_0x2049ab['Smtp'][_0x4a24('0x11')],'accessToken':_0x2049ab[_0x4a24('0x9')][_0x4a24('0xe')]['data5']};}else{_0xfdd617[_0x4a24('0xf')]={'user':_0x2049ab[_0x4a24('0x9')][_0x4a24('0x11')],'pass':_0x2049ab['Smtp'][_0x4a24('0x12')]};}}return _0xfdd617;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 5014ca6..59cb1fe 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 _0xadb5=['ShowMailAccount','smtp','setDataValue','getSmtpOptions','body','mail','difference','rawAttributes','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','Smtp','account','list','applications','orderBy','priority','asc','autoclose','push','length','close','from','then','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','interaction','get','created','attachments','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify'];(function(_0x3fa7d7,_0x4cbb0d){var _0x49b77a=function(_0x330888){while(--_0x330888){_0x3fa7d7['push'](_0x3fa7d7['shift']());}};_0x49b77a(++_0x4cbb0d);}(_0xadb5,0xad));var _0x5adb=function(_0x3a80b1,_0x4d93fd){_0x3a80b1=_0x3a80b1-0x0;var _0x3db01d=_0xadb5[_0x3a80b1];return _0x3db01d;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var BPromise=require('bluebird');var rs=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var db=require(_0x5adb('0x3'))['db'];var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var jayson=require(_0x5adb('0x6'));var client=jayson['client'][_0x5adb('0x7')]({'port':0x232c});config[_0x5adb('0x8')]=_[_0x5adb('0x9')](config[_0x5adb('0x8')],{'host':_0x5adb('0xa'),'port':0x18eb});var socket=require(_0x5adb('0xb'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xc'))[_0x5adb('0xd')](socket);function respondWithRpcPromise(_0x7293ab,_0x34f59d,_0x336bad){return new BPromise(function(_0x129f5a,_0x275428){return client['request'](_0x7293ab,_0x336bad)['then'](function(_0x1a8f66){logger[_0x5adb('0xe')](_0x5adb('0xf'),_0x34f59d,'request\x20sent');logger[_0x5adb('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x34f59d,_0x5adb('0x11'),JSON['stringify'](_0x1a8f66));if(_0x1a8f66[_0x5adb('0x12')]){if(_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x13')]===0x1f4){logger['error'](_0x5adb('0xf'),_0x34f59d,_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x14')]);return _0x275428(_0x1a8f66['error'][_0x5adb('0x14')]);}logger['error'](_0x5adb('0xf'),_0x34f59d,_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x14')]);return _0x129f5a(_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x14')]);}else{logger[_0x5adb('0xe')](_0x5adb('0xf'),_0x34f59d,_0x5adb('0x11'));_0x129f5a(_0x1a8f66[_0x5adb('0x15')]['message']);}})[_0x5adb('0x16')](function(_0x5de028){logger[_0x5adb('0x12')]('MailAccount,\x20%s,\x20%s',_0x34f59d,_0x5de028);_0x275428(_0x5de028);});});}exports[_0x5adb('0x17')]=function(_0x50e84f){var _0x5e218c=this;return new Promise(function(_0x1fbaa5,_0x1bed20){return db[_0x5adb('0x18')][_0x5adb('0x19')]({'raw':_0x50e84f[_0x5adb('0x1a')]?_0x50e84f['options'][_0x5adb('0x1b')]===undefined?!![]:![]:!![],'where':_0x50e84f['options']?_0x50e84f['options'][_0x5adb('0x1c')]||null:null,'attributes':_0x50e84f[_0x5adb('0x1a')]?_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1d')]||null:null,'limit':_0x50e84f[_0x5adb('0x1a')]?_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1e')]||null:null,'include':_0x50e84f['options']?_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1f')]?_[_0x5adb('0x20')](_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1f')],function(_0x49f203){return{'model':db[_0x49f203[_0x5adb('0x21')]],'as':_0x49f203['as'],'attributes':_0x49f203[_0x5adb('0x1d')],'include':_0x49f203['include']?_[_0x5adb('0x20')](_0x49f203[_0x5adb('0x1f')],function(_0x1a0acd){return{'model':db[_0x1a0acd['model']],'as':_0x1a0acd['as'],'attributes':_0x1a0acd[_0x5adb('0x1d')],'include':_0x1a0acd[_0x5adb('0x1f')]?_[_0x5adb('0x20')](_0x1a0acd[_0x5adb('0x1f')],function(_0x36459b){return{'model':db[_0x36459b[_0x5adb('0x21')]],'as':_0x36459b['as'],'attributes':_0x36459b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d457e){logger[_0x5adb('0xe')](_0x5adb('0x17'),_0x50e84f);logger[_0x5adb('0x10')](_0x5adb('0x17'),_0x50e84f,JSON[_0x5adb('0x22')](_0x5d457e));_0x1fbaa5(_0x5d457e);})['catch'](function(_0x11ec2a){logger[_0x5adb('0x12')](_0x5adb('0x17'),_0x11ec2a[_0x5adb('0x14')],_0x50e84f);_0x1bed20(_0x5e218c[_0x5adb('0x12')](0x1f4,_0x11ec2a[_0x5adb('0x14')]));});});};exports[_0x5adb('0x23')]=function(_0x28bf1f){var _0x138bf6=this;return new Promise(function(_0x260295,_0x4790f1){return db[_0x5adb('0x18')]['find']({'raw':_0x28bf1f[_0x5adb('0x1a')]?_0x28bf1f[_0x5adb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x28bf1f[_0x5adb('0x1a')]?_0x28bf1f[_0x5adb('0x1a')][_0x5adb('0x1c')]||null:null,'attributes':_0x28bf1f['options']?_0x28bf1f[_0x5adb('0x1a')][_0x5adb('0x1d')]||null:null,'include':_0x28bf1f['options']?_0x28bf1f['options'][_0x5adb('0x1f')]?_['map'](_0x28bf1f[_0x5adb('0x1a')][_0x5adb('0x1f')],function(_0x3c2b07){return{'model':db[_0x3c2b07[_0x5adb('0x21')]],'as':_0x3c2b07['as'],'attributes':_0x3c2b07[_0x5adb('0x1d')],'include':_0x3c2b07['include']?_[_0x5adb('0x20')](_0x3c2b07[_0x5adb('0x1f')],function(_0x1c3a5c){return{'model':db[_0x1c3a5c['model']],'as':_0x1c3a5c['as'],'attributes':_0x1c3a5c['attributes'],'include':_0x1c3a5c[_0x5adb('0x1f')]?_[_0x5adb('0x20')](_0x1c3a5c['include'],function(_0x2355bc){return{'model':db[_0x2355bc['model']],'as':_0x2355bc['as'],'attributes':_0x2355bc[_0x5adb('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11cb37){if(_0x28bf1f['options'][_0x5adb('0x24')]===!![])_0x11cb37[_0x5adb('0x25')]('smtpOptions',_0x11cb37[_0x5adb('0x26')]());logger['info'](_0x5adb('0x23'),_0x28bf1f);logger[_0x5adb('0x10')](_0x5adb('0x23'),_0x28bf1f,JSON['stringify'](_0x11cb37));_0x260295(_0x11cb37);})[_0x5adb('0x16')](function(_0x2b3b0b){logger[_0x5adb('0x12')](_0x5adb('0x23'),_0x2b3b0b[_0x5adb('0x14')],_0x28bf1f);_0x4790f1(_0x138bf6['error'](0x1f4,_0x2b3b0b['message']));});});};exports['NotifyMailAccount']=function(_0x599999){var _0x427c71=this;return new Promise(function(_0x2fbe14,_0x3a104a){var _0x399489={'body':_0x599999[_0x5adb('0x27')],'channel':_0x5adb('0x28')};var _0x2c69a8=_[_0x5adb('0x29')](_['keys'](db['CmContact'][_0x5adb('0x2a')]),['createdAt',_0x5adb('0x2b'),_0x5adb('0x2c'),_0x5adb('0x2d')]);var _0x121714=![];if(_0x599999[_0x5adb('0x27')]['id']){delete _0x599999['body']['id'];}if(_[_0x5adb('0x2e')](_0x599999[_0x5adb('0x27')]['from'])){return _0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x5adb('0x2f')));}if(_['isNil'](_0x599999[_0x5adb('0x27')][_0x5adb('0x27')])||_0x599999[_0x5adb('0x27')][_0x5adb('0x27')]===''){return _0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x5adb('0x30')));}if(_[_0x5adb('0x2e')](_0x599999['body']['mapKey'])){return _0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x5adb('0x31')+_0x2c69a8));}if(!_[_0x5adb('0x32')](_0x2c69a8,_0x599999[_0x5adb('0x27')]['mapKey'])){return _0x3a104a(_0x427c71['error'](0x1f4,_0x5adb('0x33')+_0x2c69a8));}var _0x4d7d86={};_0x4d7d86[_0x599999[_0x5adb('0x27')][_0x5adb('0x34')]]=_0x599999[_0x5adb('0x27')]['from'];return db[_0x5adb('0x18')][_0x5adb('0x35')]({'where':{'id':_0x599999['account']['id']},'include':[{'model':db[_0x5adb('0x36')],'as':_0x5adb('0x37'),'include':[{'model':db[_0x5adb('0x38')],'as':_0x5adb('0x39'),'where':_0x4d7d86,'limit':0x1,'order':[[_0x5adb('0x2b'),_0x5adb('0x3a')]]}]},{'model':db[_0x5adb('0x3b')],'as':_0x5adb('0x3c')},{'model':db['MailServerOut'],'as':_0x5adb('0x3d'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x3cd211){if(_0x3cd211&&_0x3cd211[_0x5adb('0x37')]){var _0x207a81=_0x3cd211['get']({'plain':!![]});_0x399489[_0x5adb('0x3e')]=_['omit'](_0x207a81,[_0x5adb('0x3c'),_0x5adb('0x37')]);_0x399489[_0x5adb('0x3e')]['smtpOptions']=_0x3cd211[_0x5adb('0x26')]();_0x399489['applications']=_0x207a81[_0x5adb('0x3c')];_0x399489[_0x5adb('0x3f')]=_0x207a81['List'];_0x399489[_0x5adb('0x40')]=_[_0x5adb('0x41')](_0x399489[_0x5adb('0x40')],[_0x5adb('0x42')],[_0x5adb('0x43')]);if(_0x399489['account']&&_0x399489[_0x5adb('0x3e')][_0x5adb('0x44')]){_0x399489[_0x5adb('0x40')][_0x5adb('0x45')]({'id':0x0,'priority':_0x399489['applications'][_0x5adb('0x46')]+0x1,'app':_0x5adb('0x47'),'appdata':_0x5adb('0x44'),'interval':'*,*,*,*'});}if(_0x399489[_0x5adb('0x3e')][_0x5adb('0x3c')]){delete _0x399489[_0x5adb('0x3e')][_0x5adb('0x3c')];}if(_0x399489['account'][_0x5adb('0x37')]){delete _0x399489[_0x5adb('0x3e')][_0x5adb('0x37')];}if(_0x207a81[_0x5adb('0x37')][_0x5adb('0x39')]['length']){return _0x207a81[_0x5adb('0x37')]['Contacts'][0x0];}var _0x2b790d=_['defaults'](_0x599999[_0x5adb('0x27')],{'firstName':_0x599999[_0x5adb('0x27')][_0x5adb('0x48')],'ListId':_0x207a81[_0x5adb('0x2d')]});_0x2b790d[_0x599999['body'][_0x5adb('0x34')]]=_0x599999[_0x5adb('0x27')][_0x5adb('0x48')];return db['CmContact']['create'](_0x2b790d);}else{throw new Error('List\x20not\x20found');}})[_0x5adb('0x49')](function(_0x31a1f9){_0x399489[_0x5adb('0x4a')]=_0x31a1f9;if(_0x31a1f9){if(!_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')]){_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')]=rs[_0x5adb('0x4c')]()+'\x20'+_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x48')];}var _0x511746={'ContactId':_0x31a1f9['id'],'MailAccountId':_0x599999['account']['id'],'inReplyTo':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')],'to':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x48')],'cc':_0x599999[_0x5adb('0x27')]['message']['cc'],'subject':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4d')],'attach':_0x599999['body'][_0x5adb('0x14')][_0x5adb('0x4e')],'lastMsgAt':moment()[_0x5adb('0x4f')](_0x5adb('0x50')),'lastMsgDirection':'in'};return db[_0x5adb('0x51')][_0x5adb('0x35')]({'where':{'closed':![],'MailAccountId':_0x599999['account']['id']},'include':[{'model':db[_0x5adb('0x52')],'as':_0x5adb('0x53'),'attributes':[_0x5adb('0x4b')],'where':{'messageId':_0x599999['body'][_0x5adb('0x14')][_0x5adb('0x54')]}}]})[_0x5adb('0x49')](function(_0x4f6107){if(_0x4f6107){return[_0x4f6107,![]];}return db[_0x5adb('0x51')]['create'](_0x511746)[_0x5adb('0x49')](function(_0x1e7e3a){return[_0x1e7e3a,!![]];});});}else{throw new Error(_0x5adb('0x55'));}})['spread'](function(_0x192b1f,_0x3627d1){if(_0x192b1f){_0x121714=_0x3627d1;if(!_0x3627d1){return _0x192b1f['update']({'inReplyTo':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')],'to':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x48')],'cc':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['cc'],'subject':_0x599999[_0x5adb('0x27')]['message']['subject'],'attach':_0x192b1f[_0x5adb('0x4e')]?_0x192b1f['attach']:_0x599999['body']['message'][_0x5adb('0x4e')],'substatus':null,'substatusAt':moment()[_0x5adb('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x5adb('0x4f')](_0x5adb('0x50')),'lastMsgDirection':'in'});}else{return _0x192b1f;}}})[_0x5adb('0x49')](function(_0xf6ef8a){_0x399489[_0x5adb('0x56')]=_0xf6ef8a[_0x5adb('0x57')]({'plain':!![]});_0x399489[_0x5adb('0x56')][_0x5adb('0x58')]=_0x121714;return db['MailMessage']['create']({'body':_0x599999['body'][_0x5adb('0x27')],'MailAccountId':_0x599999[_0x5adb('0x3e')]['id'],'MailInteractionId':_0xf6ef8a['id'],'direction':'in','ContactId':_0x399489[_0x5adb('0x4a')]['id'],'messageId':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')],'from':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['from'],'to':_0x599999['body'][_0x5adb('0x14')]['to'],'cc':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['cc'],'subject':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4d')],'attach':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4e')],'Attachments':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x59')],'originTo':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['originTo'],'originCc':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['originCc'],'bcc':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x5a')],'ChatWebsiteId':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x5b')]||null,'originChannel':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x5c')]||_0x5adb('0x5d'),'ChatOfflineMessageId':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x5adb('0x5f')}]});})[_0x5adb('0x49')](function(_0x2362b8){_0x399489['message']=_0x2362b8;if(_0x399489['interaction'][_0x5adb('0x60')]){return db['User'][_0x5adb('0x35')]({'attributes':['id',_0x5adb('0x61')],'where':{'id':_0x399489[_0x5adb('0x56')]['UserId']}})[_0x5adb('0x49')](function(_0x288e4f){if(_0x288e4f){_0x399489[_0x5adb('0x40')][_0x5adb('0x62')]({'id':0x0,'priority':0x0,'app':_0x5adb('0x63'),'appdata':_0x288e4f['name']+','+(_0x399489[_0x5adb('0x3e')][_0x5adb('0x64')]||0xa),'interval':_0x5adb('0x65')});}return respondWithRpcPromise(_0x5adb('0x66'),'startRouting',_0x399489);});}return respondWithRpcPromise(_0x5adb('0x66'),_0x5adb('0x67'),_0x399489);})[_0x5adb('0x49')](function(_0x1e9cd1){_0x2fbe14(_0x1e9cd1);})[_0x5adb('0x16')](function(_0x20faf6){_0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x20faf6['message']));});});}; \ No newline at end of file +var _0x5f2f=['Attachments','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailAccount','options','where','limit','include','model','attributes','map','MailAccount','find','raw','then','smtp','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','applications','Applications','priority','asc','autoclose','push','close','Contacts','length','create','messageId','subject','format','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','attachments','originCc','originChannel','Email','ChatOfflineMessageId','Attachment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ae5f2,_0x1a737f){_0x2ae5f2=_0x2ae5f2-0x0;var _0xf44fef=_0x5f2f[_0x2ae5f2];return _0xf44fef;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var BPromise=require(_0xf5f2('0x2'));var rs=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var db=require(_0xf5f2('0x5'))['db'];var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5f2('0x8')][_0xf5f2('0x9')]({'port':0x232c});config[_0xf5f2('0xa')]=_[_0xf5f2('0xb')](config[_0xf5f2('0xa')],{'host':_0xf5f2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0xa')]));require(_0xf5f2('0xd'))[_0xf5f2('0xe')](socket);function respondWithRpcPromise(_0x56a69f,_0x375da4,_0x15dd7c){return new BPromise(function(_0x218ae3,_0x4e0e6b){return client[_0xf5f2('0xf')](_0x56a69f,_0x15dd7c)['then'](function(_0x53fb33){logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,'request\x20sent');logger[_0xf5f2('0x12')](_0xf5f2('0x13'),_0x375da4,_0xf5f2('0x14'),JSON[_0xf5f2('0x15')](_0x53fb33));if(_0x53fb33[_0xf5f2('0x16')]){if(_0x53fb33[_0xf5f2('0x16')]['code']===0x1f4){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x4e0e6b(_0x53fb33[_0xf5f2('0x16')]['message']);}logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x218ae3(_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);}else{logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,_0xf5f2('0x14'));_0x218ae3(_0x53fb33[_0xf5f2('0x18')][_0xf5f2('0x17')]);}})[_0xf5f2('0x19')](function(_0x4ff59b){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x4ff59b);_0x4e0e6b(_0x4ff59b);});});}exports[_0xf5f2('0x1a')]=function(_0x1bf655){var _0x56acc5=this;return new Promise(function(_0x34706d,_0x47101e){return db['MailAccount']['findAll']({'raw':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1c')]||null:null,'attributes':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['attributes']||null:null,'limit':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1d')]||null:null,'include':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['include']?_['map'](_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')],'include':_0x294414[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x294414[_0xf5f2('0x1e')],function(_0x198c73){return{'model':db[_0x198c73[_0xf5f2('0x1f')]],'as':_0x198c73['as'],'attributes':_0x198c73['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22c826){logger[_0xf5f2('0x10')](_0xf5f2('0x1a'),_0x1bf655);logger['debug']('GetMailAccount',_0x1bf655,JSON[_0xf5f2('0x15')](_0x22c826));_0x34706d(_0x22c826);})[_0xf5f2('0x19')](function(_0x17394a){logger[_0xf5f2('0x16')](_0xf5f2('0x1a'),_0x17394a['message'],_0x1bf655);_0x47101e(_0x56acc5['error'](0x1f4,_0x17394a[_0xf5f2('0x17')]));});});};exports['ShowMailAccount']=function(_0xb744b9){var _0x58a4df=this;return new Promise(function(_0x45b643,_0x31087c){return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'raw':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x24')]===undefined?!![]:![]:!![],'where':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9['options'][_0xf5f2('0x1c')]||null:null,'attributes':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null,'include':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')]?_['map'](_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes'],'include':_0x2e3cca[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x2e3cca[_0xf5f2('0x1e')],function(_0x4ec8fb){return{'model':db[_0x4ec8fb[_0xf5f2('0x1f')]],'as':_0x4ec8fb['as'],'attributes':_0x4ec8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x25')](function(_0x566c47){if(_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x26')]===!![])_0x566c47['setDataValue'](_0xf5f2('0x27'),_0x566c47[_0xf5f2('0x28')]());logger[_0xf5f2('0x10')](_0xf5f2('0x29'),_0xb744b9);logger['debug']('ShowMailAccount',_0xb744b9,JSON[_0xf5f2('0x15')](_0x566c47));_0x45b643(_0x566c47);})[_0xf5f2('0x19')](function(_0x22b20c){logger[_0xf5f2('0x16')](_0xf5f2('0x29'),_0x22b20c[_0xf5f2('0x17')],_0xb744b9);_0x31087c(_0x58a4df[_0xf5f2('0x16')](0x1f4,_0x22b20c['message']));});});};exports[_0xf5f2('0x2a')]=function(_0x3b4ea6){var _0x536501=this;return new Promise(function(_0xc6a1ae,_0x3f3895){var _0x71b0e7={'body':_0x3b4ea6[_0xf5f2('0x2b')],'channel':_0xf5f2('0x2c')};var _0x3b6372=_[_0xf5f2('0x2d')](_[_0xf5f2('0x2e')](db['CmContact'][_0xf5f2('0x2f')]),[_0xf5f2('0x30'),_0xf5f2('0x31'),'CompanyId','ListId']);var _0x59eb00=![];if(_0x3b4ea6[_0xf5f2('0x2b')]['id']){delete _0x3b4ea6[_0xf5f2('0x2b')]['id'];}if(_['isNil'](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x33')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')])||_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')]===''){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x35')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501['error'](0x1f4,_0xf5f2('0x37')+_0x3b6372));}if(!_['includes'](_0x3b6372,_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x38')+_0x3b6372));}var _0x31bf0e={};_0x31bf0e[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'where':{'id':_0x3b4ea6[_0xf5f2('0x39')]['id']},'include':[{'model':db[_0xf5f2('0x3a')],'as':_0xf5f2('0x3b'),'include':[{'model':db[_0xf5f2('0x3c')],'as':'Contacts','where':_0x31bf0e,'limit':0x1,'order':[[_0xf5f2('0x31'),_0xf5f2('0x3d')]]}]},{'model':db[_0xf5f2('0x3e')],'as':'Applications'},{'model':db[_0xf5f2('0x3f')],'as':_0xf5f2('0x40'),'include':[{'model':db[_0xf5f2('0x41')],'as':'CloudProvider'}]}]})['then'](function(_0x7bb942){if(_0x7bb942&&_0x7bb942[_0xf5f2('0x3b')]){var _0x5db519=_0x7bb942[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7['account']=_[_0xf5f2('0x43')](_0x5db519,['Applications',_0xf5f2('0x3b')]);_0x71b0e7['account'][_0xf5f2('0x27')]=_0x7bb942[_0xf5f2('0x28')]();_0x71b0e7[_0xf5f2('0x44')]=_0x5db519[_0xf5f2('0x45')];_0x71b0e7['list']=_0x5db519[_0xf5f2('0x3b')];_0x71b0e7[_0xf5f2('0x44')]=_['orderBy'](_0x71b0e7['applications'],[_0xf5f2('0x46')],[_0xf5f2('0x47')]);if(_0x71b0e7['account']&&_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x48')]){_0x71b0e7[_0xf5f2('0x44')][_0xf5f2('0x49')]({'id':0x0,'priority':_0x71b0e7['applications']['length']+0x1,'app':_0xf5f2('0x4a'),'appdata':_0xf5f2('0x48'),'interval':'*,*,*,*'});}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')]){delete _0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')];}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x3b')]){delete _0x71b0e7[_0xf5f2('0x39')]['List'];}if(_0x5db519['List'][_0xf5f2('0x4b')][_0xf5f2('0x4c')]){return _0x5db519[_0xf5f2('0x3b')][_0xf5f2('0x4b')][0x0];}var _0x21b0d3=_['defaults'](_0x3b4ea6[_0xf5f2('0x2b')],{'firstName':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')],'ListId':_0x5db519['ListId']});_0x21b0d3[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x3c')][_0xf5f2('0x4d')](_0x21b0d3);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x756f1f){_0x71b0e7['contact']=_0x756f1f;if(_0x756f1f){if(!_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['messageId']){_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4e')]=rs['generate']()+'\x20'+_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')];}var _0x4579f4={'ContactId':_0x756f1f['id'],'MailAccountId':_0x3b4ea6['account']['id'],'inReplyTo':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'cc':_0x3b4ea6[_0xf5f2('0x2b')]['message']['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['attach'],'lastMsgAt':moment()[_0xf5f2('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xf5f2('0x23')]({'where':{'closed':![],'MailAccountId':_0x3b4ea6['account']['id']},'include':[{'model':db[_0xf5f2('0x51')],'as':_0xf5f2('0x52'),'attributes':[_0xf5f2('0x4e')],'where':{'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x53')]}}]})[_0xf5f2('0x25')](function(_0x1ec682){if(_0x1ec682){return[_0x1ec682,![]];}return db[_0xf5f2('0x54')][_0xf5f2('0x4d')](_0x4579f4)[_0xf5f2('0x25')](function(_0x158768){return[_0x158768,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf5f2('0x55')](function(_0x2d171d,_0xb39a6e){if(_0x2d171d){_0x59eb00=_0xb39a6e;if(!_0xb39a6e){return _0x2d171d[_0xf5f2('0x56')]({'inReplyTo':_0x3b4ea6['body'][_0xf5f2('0x17')]['messageId'],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['from'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x2d171d['attach']?_0x2d171d[_0xf5f2('0x57')]:_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x57')],'substatus':null,'substatusAt':moment()[_0xf5f2('0x50')](_0xf5f2('0x58')),'lastMsgAt':moment()['format'](_0xf5f2('0x58')),'lastMsgDirection':'in'});}else{return _0x2d171d;}}})[_0xf5f2('0x25')](function(_0x4800fe){_0x71b0e7[_0xf5f2('0x59')]=_0x4800fe[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7[_0xf5f2('0x59')]['created']=_0x59eb00;return db['MailMessage']['create']({'body':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')],'MailAccountId':_0x3b4ea6[_0xf5f2('0x39')]['id'],'MailInteractionId':_0x4800fe['id'],'direction':'in','ContactId':_0x71b0e7[_0xf5f2('0x5a')]['id'],'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'from':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['to'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6['body']['message']['attach'],'Attachments':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5b')],'originTo':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['originTo'],'originCc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5c')],'bcc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['bcc'],'ChatWebsiteId':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['ChatWebsiteId']||null,'originChannel':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5d')]||_0xf5f2('0x5e'),'ChatOfflineMessageId':_0x3b4ea6['body'][_0xf5f2('0x17')][_0xf5f2('0x5f')]||null},{'include':[{'model':db[_0xf5f2('0x60')],'as':_0xf5f2('0x61')}]});})[_0xf5f2('0x25')](function(_0x4f47e1){_0x71b0e7['message']=_0x4f47e1;if(_0x71b0e7[_0xf5f2('0x59')][_0xf5f2('0x62')]){return db[_0xf5f2('0x63')][_0xf5f2('0x23')]({'attributes':['id','name'],'where':{'id':_0x71b0e7['interaction'][_0xf5f2('0x62')]}})['then'](function(_0x4c4420){if(_0x4c4420){_0x71b0e7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf5f2('0x64'),'appdata':_0x4c4420[_0xf5f2('0x65')]+','+(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x66')]||0xa),'interval':_0xf5f2('0x67')});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);})[_0xf5f2('0x25')](function(_0x9afb3c){_0xc6a1ae(_0x9afb3c);})[_0xf5f2('0x19')](function(_0x1ba503){_0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0x1ba503[_0xf5f2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b1243a9..9ce57f0 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 _0xe4e7=['./mailAccount.events','save','remove','update','removeListener','register','length','mailAccount:'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0xe4e7,0x78));var _0x7e4e=function(_0x5c1b05,_0x213768){_0x5c1b05=_0x5c1b05-0x0;var _0x1a65e7=_0xe4e7[_0x5c1b05];return _0x1a65e7;};'use strict';var MailAccountEvents=require(_0x7e4e('0x0'));var events=[_0x7e4e('0x1'),_0x7e4e('0x2'),_0x7e4e('0x3')];function createListener(_0x1e69da,_0x30e2d4){return function(_0x4ef71e){_0x30e2d4['emit'](_0x1e69da,_0x4ef71e);};}function removeListener(_0x5eec43,_0x358713){return function(){MailAccountEvents[_0x7e4e('0x4')](_0x5eec43,_0x358713);};}exports[_0x7e4e('0x5')]=function(_0x377f01){for(var _0x4290ea=0x0,_0x1bb676=events[_0x7e4e('0x6')];_0x4290ea<_0x1bb676;_0x4290ea++){var _0x354bc0=events[_0x4290ea];var _0x3bd511=createListener(_0x7e4e('0x7')+_0x354bc0,_0x377f01);MailAccountEvents['on'](_0x354bc0,_0x3bd511);}}; \ No newline at end of file +var _0xc281=['save','remove','update','emit','removeListener','register','mailAccount:'];(function(_0x521fd7,_0x4af0a7){var _0x2667ee=function(_0x1d3ee8){while(--_0x1d3ee8){_0x521fd7['push'](_0x521fd7['shift']());}};_0x2667ee(++_0x4af0a7);}(_0xc281,0x1c7));var _0x1c28=function(_0x2b1b19,_0x2eac02){_0x2b1b19=_0x2b1b19-0x0;var _0x511f69=_0xc281[_0x2b1b19];return _0x511f69;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x1c28('0x0'),_0x1c28('0x1'),_0x1c28('0x2')];function createListener(_0xe379ce,_0x37e1f5){return function(_0x28b96d){_0x37e1f5[_0x1c28('0x3')](_0xe379ce,_0x28b96d);};}function removeListener(_0x4fcb94,_0x170974){return function(){MailAccountEvents[_0x1c28('0x4')](_0x4fcb94,_0x170974);};}exports[_0x1c28('0x5')]=function(_0x4bc56d){for(var _0x71e150=0x0,_0x194aa3=events['length'];_0x71e150<_0x194aa3;_0x71e150++){var _0x446cdc=events[_0x71e150];var _0x2778ab=createListener(_0x1c28('0x6')+_0x446cdc,_0x4bc56d);MailAccountEvents['on'](_0x446cdc,_0x2778ab);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5bcf549..464928e 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 _0x8c5a=['/:id','isAuthenticated','show','put','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','./mailApplication.controller'];(function(_0x22fa9c,_0x1bcb4f){var _0x469074=function(_0x1658e0){while(--_0x1658e0){_0x22fa9c['push'](_0x22fa9c['shift']());}};_0x469074(++_0x1bcb4f);}(_0x8c5a,0x186));var _0xa8c5=function(_0x12131b,_0x465a73){_0x12131b=_0x12131b-0x0;var _0x344993=_0x8c5a[_0x12131b];return _0x344993;};'use strict';var multer=require('multer');var util=require(_0xa8c5('0x0'));var path=require(_0xa8c5('0x1'));var timeout=require(_0xa8c5('0x2'));var express=require('express');var router=express[_0xa8c5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa8c5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa8c5('0x5'));router['get'](_0xa8c5('0x6'),auth[_0xa8c5('0x7')](),controller[_0xa8c5('0x8')]);router[_0xa8c5('0x9')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa8c5('0xa')](_0xa8c5('0x6'),auth[_0xa8c5('0x7')](),controller['destroy']);module[_0xa8c5('0xb')]=router; \ No newline at end of file +var _0xfcf0=['path','connect-timeout','express','Router','../../components/auth/service','./mailApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy','exports','multer','util'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xfcf0,0x1ae));var _0x0fcf=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xfcf0[_0x585d81];return _0x1aca0d;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require(_0x0fcf('0x2'));var timeout=require(_0x0fcf('0x3'));var express=require(_0x0fcf('0x4'));var router=express[_0x0fcf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0fcf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0fcf('0x7'));router[_0x0fcf('0x8')]('/:id',auth[_0x0fcf('0x9')](),controller[_0x0fcf('0xa')]);router[_0x0fcf('0xb')](_0x0fcf('0xc'),auth[_0x0fcf('0x9')](),controller[_0x0fcf('0xd')]);router['delete'](_0x0fcf('0xc'),auth[_0x0fcf('0x9')](),controller[_0x0fcf('0xe')]);module[_0x0fcf('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 1c67922..08b8b2c 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 _0x3695=['INTEGER','STRING','sequelize'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0x3695,0x1df));var _0x5369=function(_0x45a1bd,_0x511fe2){_0x45a1bd=_0x45a1bd-0x0;var _0xf3d0a9=_0x3695[_0x45a1bd];return _0xf3d0a9;};'use strict';var Sequelize=require(_0x5369('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5369('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5369('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xba04=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xba04,0x1d3));var _0x4ba0=function(_0x319bb0,_0x1d87dd){_0x319bb0=_0x319bb0-0x0;var _0x1ab6d1=_0xba04[_0x319bb0];return _0x1ab6d1;};'use strict';var Sequelize=require(_0x4ba0('0x0'));module[_0x4ba0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4ba0('0x2')},'appdata':{'type':Sequelize[_0x4ba0('0x3')]()},'description':{'type':Sequelize[_0x4ba0('0x4')]},'interval':{'type':Sequelize[_0x4ba0('0x4')],'defaultValue':_0x4ba0('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7da0209..9ee961c 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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x488a0d,_0x3b5878){var _0x467447=function(_0x36106b){while(--_0x36106b){_0x488a0d['push'](_0x488a0d['shift']());}};_0x467447(++_0x3b5878);}(_0x54ef,0x112));var _0xf54e=function(_0x76108d,_0x46add9){_0x76108d=_0x76108d-0x0;var _0x59814c=_0x54ef[_0x76108d];return _0x59814c;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file +var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','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','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x22f4e1,_0x18c57c){var _0x49498f=function(_0x331331){while(--_0x331331){_0x22f4e1['push'](_0x22f4e1['shift']());}};_0x49498f(++_0x18c57c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 9e2946e..cee4cf0 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 _0xb16e=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','./mailApplication.attributes','exports'];(function(_0x53972e,_0x275c){var _0xc48fcf=function(_0x1130de){while(--_0x1130de){_0x53972e['push'](_0x53972e['shift']());}};_0xc48fcf(++_0x275c);}(_0xb16e,0x1a8));var _0xeb16=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0xb16e[_0x337a10];return _0x575f98;};'use strict';var _=require('lodash');var util=require(_0xeb16('0x0'));var logger=require(_0xeb16('0x1'))(_0xeb16('0x2'));var moment=require(_0xeb16('0x3'));var BPromise=require(_0xeb16('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb16('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeb16('0x6'));module[_0xeb16('0x7')]=function(_0x7dc783,_0x2f9098){return _0x7dc783['define'](_0xeb16('0x8'),attributes,{'tableName':_0xeb16('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb16('0xa'),'collate':_0xeb16('0xb')});}; \ No newline at end of file +var _0x710b=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','util','../../config/logger','api','moment','request-promise'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x710b,0x133));var _0xb710=function(_0x30927f,_0x1a6b55){_0x30927f=_0x30927f-0x0;var _0x4dd593=_0x710b[_0x30927f];return _0x4dd593;};'use strict';var _=require('lodash');var util=require(_0xb710('0x0'));var logger=require(_0xb710('0x1'))(_0xb710('0x2'));var moment=require(_0xb710('0x3'));var BPromise=require('bluebird');var rp=require(_0xb710('0x4'));var fs=require('fs');var path=require(_0xb710('0x5'));var rimraf=require(_0xb710('0x6'));var config=require(_0xb710('0x7'));var attributes=require(_0xb710('0x8'));module[_0xb710('0x9')]=function(_0x3c8cde,_0x590b37){return _0x3c8cde[_0xb710('0xa')]('MailApplication',attributes,{'tableName':_0xb710('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb710('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a9211ac..edbb2f0 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 _0x33b1=['jayson/promise','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','update','body','options','where','attributes','limit','then','stringify','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x444c0c,_0x32c3e0){var _0x10f030=function(_0x3b7a04){while(--_0x3b7a04){_0x444c0c['push'](_0x444c0c['shift']());}};_0x10f030(++_0x32c3e0);}(_0x33b1,0x124));var _0x133b=function(_0x14b0cf,_0x223b28){_0x14b0cf=_0x14b0cf-0x0;var _0x601755=_0x33b1[_0x14b0cf];return _0x601755;};'use strict';var _=require('lodash');var util=require(_0x133b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x133b('0x1'));var fs=require('fs');var Redis=require(_0x133b('0x2'));var db=require(_0x133b('0x3'))['db'];var utils=require(_0x133b('0x4'));var logger=require(_0x133b('0x5'))(_0x133b('0x6'));var config=require(_0x133b('0x7'));var jayson=require(_0x133b('0x8'));var client=jayson['client'][_0x133b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4298d0,_0x19e829,_0x554e91){return new BPromise(function(_0x567e66,_0x28214b){return client[_0x133b('0xa')](_0x4298d0,_0x554e91)['then'](function(_0x1e9ad7){logger[_0x133b('0xb')](_0x133b('0xc'),_0x19e829,_0x133b('0xd'));logger[_0x133b('0xe')](_0x133b('0xf'),_0x19e829,_0x133b('0xd'),JSON['stringify'](_0x1e9ad7));if(_0x1e9ad7[_0x133b('0x10')]){if(_0x1e9ad7[_0x133b('0x10')][_0x133b('0x11')]===0x1f4){logger['error'](_0x133b('0xc'),_0x19e829,_0x1e9ad7[_0x133b('0x10')]['message']);return _0x28214b(_0x1e9ad7['error']['message']);}logger[_0x133b('0x10')](_0x133b('0xc'),_0x19e829,_0x1e9ad7[_0x133b('0x10')][_0x133b('0x12')]);return _0x567e66(_0x1e9ad7[_0x133b('0x10')][_0x133b('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x19e829,'request\x20sent');_0x567e66(_0x1e9ad7[_0x133b('0x13')][_0x133b('0x12')]);}})[_0x133b('0x14')](function(_0xba97df){logger[_0x133b('0x10')](_0x133b('0xc'),_0x19e829,_0xba97df);_0x28214b(_0xba97df);});});}exports[_0x133b('0x15')]=function(_0x5f4c44){var _0x17d2c1=this;return new Promise(function(_0x812ba,_0x3920e5){return db['MailApplication'][_0x133b('0x16')](_0x5f4c44[_0x133b('0x17')],{'raw':_0x5f4c44['options']?_0x5f4c44[_0x133b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f4c44[_0x133b('0x18')]?_0x5f4c44[_0x133b('0x18')][_0x133b('0x19')]||null:null,'attributes':_0x5f4c44[_0x133b('0x18')]?_0x5f4c44[_0x133b('0x18')][_0x133b('0x1a')]||null:null,'limit':_0x5f4c44[_0x133b('0x18')]?_0x5f4c44[_0x133b('0x18')][_0x133b('0x1b')]||null:null})[_0x133b('0x1c')](function(_0x43aabf){logger[_0x133b('0xb')](_0x133b('0x15'),_0x5f4c44);logger[_0x133b('0xe')](_0x133b('0x15'),_0x5f4c44,JSON[_0x133b('0x1d')](_0x43aabf));_0x812ba(_0x43aabf);})['catch'](function(_0x436a7f){logger['error'](_0x133b('0x15'),_0x436a7f[_0x133b('0x12')],_0x5f4c44);_0x3920e5(_0x17d2c1['error'](0x1f4,_0x436a7f[_0x133b('0x12')]));});});}; \ No newline at end of file +var _0x5077=['error','MailApplication,\x20%s,\x20%s','message','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','info','debug','UpdateMailApplication','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x248538,_0x344482){var _0xe4cab2=function(_0x429ff8){while(--_0x429ff8){_0x248538['push'](_0x248538['shift']());}};_0xe4cab2(++_0x344482);}(_0x5077,0x8c));var _0x7507=function(_0x318ef0,_0x45ba88){_0x318ef0=_0x318ef0-0x0;var _0x232e8c=_0x5077[_0x318ef0];return _0x232e8c;};'use strict';var _=require(_0x7507('0x0'));var util=require(_0x7507('0x1'));var moment=require('moment');var BPromise=require(_0x7507('0x2'));var rs=require(_0x7507('0x3'));var fs=require('fs');var Redis=require(_0x7507('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7507('0x5'))(_0x7507('0x6'));var config=require(_0x7507('0x7'));var jayson=require(_0x7507('0x8'));var client=jayson[_0x7507('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1984c8,_0x17d428,_0xd42fba){return new BPromise(function(_0x146a74,_0x20a45b){return client[_0x7507('0xa')](_0x1984c8,_0xd42fba)[_0x7507('0xb')](function(_0x4ae193){logger['info']('MailApplication,\x20%s,\x20%s',_0x17d428,_0x7507('0xc'));logger['debug'](_0x7507('0xd'),_0x17d428,_0x7507('0xc'),JSON[_0x7507('0xe')](_0x4ae193));if(_0x4ae193[_0x7507('0xf')]){if(_0x4ae193['error']['code']===0x1f4){logger['error'](_0x7507('0x10'),_0x17d428,_0x4ae193[_0x7507('0xf')][_0x7507('0x11')]);return _0x20a45b(_0x4ae193[_0x7507('0xf')]['message']);}logger[_0x7507('0xf')]('MailApplication,\x20%s,\x20%s',_0x17d428,_0x4ae193[_0x7507('0xf')]['message']);return _0x146a74(_0x4ae193[_0x7507('0xf')][_0x7507('0x11')]);}else{logger['info'](_0x7507('0x10'),_0x17d428,_0x7507('0xc'));_0x146a74(_0x4ae193[_0x7507('0x12')][_0x7507('0x11')]);}})[_0x7507('0x13')](function(_0x99a93d){logger[_0x7507('0xf')](_0x7507('0x10'),_0x17d428,_0x99a93d);_0x20a45b(_0x99a93d);});});}exports['UpdateMailApplication']=function(_0x5acda7){var _0x321fa4=this;return new Promise(function(_0x3bff09,_0x539079){return db[_0x7507('0x14')][_0x7507('0x15')](_0x5acda7[_0x7507('0x16')],{'raw':_0x5acda7[_0x7507('0x17')]?_0x5acda7[_0x7507('0x17')][_0x7507('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5acda7[_0x7507('0x17')]?_0x5acda7[_0x7507('0x17')][_0x7507('0x19')]||null:null,'attributes':_0x5acda7['options']?_0x5acda7[_0x7507('0x17')][_0x7507('0x1a')]||null:null,'limit':_0x5acda7[_0x7507('0x17')]?_0x5acda7[_0x7507('0x17')][_0x7507('0x1b')]||null:null})[_0x7507('0xb')](function(_0x1e26ed){logger[_0x7507('0x1c')]('UpdateMailApplication',_0x5acda7);logger[_0x7507('0x1d')](_0x7507('0x1e'),_0x5acda7,JSON[_0x7507('0xe')](_0x1e26ed));_0x3bff09(_0x1e26ed);})[_0x7507('0x13')](function(_0x6ca435){logger[_0x7507('0xf')](_0x7507('0x1e'),_0x6ca435[_0x7507('0x11')],_0x5acda7);_0x539079(_0x321fa4[_0x7507('0xf')](0x1f4,_0x6ca435[_0x7507('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 5970700..6377920 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 _0x4482=['delete','removeTags','exports','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','put','mail','mailinteraction:update','destroy'];(function(_0x4c91da,_0x4bbebb){var _0x172d2a=function(_0x3465b2){while(--_0x3465b2){_0x4c91da['push'](_0x4c91da['shift']());}};_0x172d2a(++_0x4bbebb);}(_0x4482,0xff));var _0x2448=function(_0x53a3ff,_0x8e6819){_0x53a3ff=_0x53a3ff-0x0;var _0x4fb860=_0x4482[_0x53a3ff];return _0x4fb860;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x2448('0x0'));var interaction=require('../../components/interaction/service');var controller=require(_0x2448('0x1'));router[_0x2448('0x2')]('/',auth[_0x2448('0x3')](),controller['index']);router['get'](_0x2448('0x4'),auth['isAuthenticated'](),controller['describe']);router[_0x2448('0x2')](_0x2448('0x5'),auth[_0x2448('0x3')](),controller[_0x2448('0x6')]);router[_0x2448('0x2')](_0x2448('0x7'),auth['isAuthenticated'](),controller[_0x2448('0x8')]);router[_0x2448('0x2')]('/:id/download',auth[_0x2448('0x3')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2448('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2448('0xa')]);router[_0x2448('0x9')](_0x2448('0xb'),auth[_0x2448('0x3')](),interaction[_0x2448('0xc')]('mail',_0x2448('0xd')),controller['addTags']);router[_0x2448('0xe')](_0x2448('0x5'),auth[_0x2448('0x3')](),interaction[_0x2448('0xc')](_0x2448('0xf'),_0x2448('0x10')),controller['update']);router['delete'](_0x2448('0x5'),auth[_0x2448('0x3')](),interaction['tracked'](_0x2448('0xf'),'mailinteraction:destroy'),controller[_0x2448('0x11')]);router[_0x2448('0x12')](_0x2448('0xb'),auth[_0x2448('0x3')](),controller[_0x2448('0x13')]);module[_0x2448('0x14')]=router; \ No newline at end of file +var _0xfbb4=['tracked','mailinteraction:addtags','addTags','update','delete','/:id','mail','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags'];(function(_0x23deae,_0xe3bbec){var _0x1a23b2=function(_0x1d84ff){while(--_0x1d84ff){_0x23deae['push'](_0x23deae['shift']());}};_0x1a23b2(++_0xe3bbec);}(_0xfbb4,0xad));var _0x4fbb=function(_0x231ab3,_0x349523){_0x231ab3=_0x231ab3-0x0;var _0x40890e=_0xfbb4[_0x231ab3];return _0x40890e;};'use strict';var express=require(_0x4fbb('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4fbb('0x1'));var controller=require(_0x4fbb('0x2'));router[_0x4fbb('0x3')]('/',auth[_0x4fbb('0x4')](),controller[_0x4fbb('0x5')]);router[_0x4fbb('0x3')](_0x4fbb('0x6'),auth[_0x4fbb('0x4')](),controller[_0x4fbb('0x7')]);router['get']('/:id',auth[_0x4fbb('0x4')](),controller[_0x4fbb('0x8')]);router['get']('/:id/messages',auth[_0x4fbb('0x4')](),controller[_0x4fbb('0x9')]);router[_0x4fbb('0x3')](_0x4fbb('0xa'),auth[_0x4fbb('0x4')](),controller[_0x4fbb('0xb')]);router[_0x4fbb('0xc')]('/',auth[_0x4fbb('0x4')](),controller['create']);router[_0x4fbb('0xc')](_0x4fbb('0xd'),auth['isAuthenticated'](),controller[_0x4fbb('0xe')]);router[_0x4fbb('0xc')](_0x4fbb('0xf'),auth[_0x4fbb('0x4')](),interaction[_0x4fbb('0x10')]('mail',_0x4fbb('0x11')),controller[_0x4fbb('0x12')]);router['put']('/:id',auth[_0x4fbb('0x4')](),interaction[_0x4fbb('0x10')]('mail','mailinteraction:update'),controller[_0x4fbb('0x13')]);router[_0x4fbb('0x14')](_0x4fbb('0x15'),auth['isAuthenticated'](),interaction[_0x4fbb('0x10')](_0x4fbb('0x16'),_0x4fbb('0x17')),controller[_0x4fbb('0x18')]);router[_0x4fbb('0x14')]('/:id/tags',auth[_0x4fbb('0x4')](),controller[_0x4fbb('0x19')]);module[_0x4fbb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index dc96c20..e6d23ef 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 _0x75d4=['long','ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x4c6cf1,_0x453d0d){var _0x56e813=function(_0x3e8319){while(--_0x3e8319){_0x4c6cf1['push'](_0x4c6cf1['shift']());}};_0x56e813(++_0x453d0d);}(_0x75d4,0x93));var _0x475d=function(_0x1701ec,_0x2fce5b){_0x1701ec=_0x1701ec-0x0;var _0x111555=_0x75d4[_0x1701ec];return _0x111555;};'use strict';var Sequelize=require(_0x475d('0x0'));var iconv=require('iconv');module[_0x475d('0x1')]={'closed':{'type':Sequelize[_0x475d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x475d('0x3')]},'disposition':{'type':Sequelize[_0x475d('0x4')]},'secondDisposition':{'type':Sequelize[_0x475d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x475d('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x475d('0x5')](_0x475d('0x6'))},'subject':{'type':Sequelize[_0x475d('0x5')]()},'attach':{'type':Sequelize[_0x475d('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x475d('0x3')]},'substatus':{'type':Sequelize[_0x475d('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x475d('0x7')]('in',_0x475d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x475d('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x475d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x36aa=['iconv','exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x42bdae,_0x3a0692){var _0x48287c=function(_0x42e36f){while(--_0x42e36f){_0x42bdae['push'](_0x42bdae['shift']());}};_0x48287c(++_0x3a0692);}(_0x36aa,0x1b8));var _0xa36a=function(_0xd4f20d,_0x3dff87){_0xd4f20d=_0xd4f20d-0x0;var _0x45384c=_0x36aa[_0xd4f20d];return _0x45384c;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xa36a('0x0'));module[_0xa36a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa36a('0x2')]},'disposition':{'type':Sequelize[_0xa36a('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa36a('0x3')]},'note':{'type':Sequelize[_0xa36a('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xa36a('0x3')]},'cc':{'type':Sequelize[_0xa36a('0x4')](_0xa36a('0x5'))},'subject':{'type':Sequelize[_0xa36a('0x4')]()},'attach':{'type':Sequelize[_0xa36a('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa36a('0x2')]},'substatus':{'type':Sequelize[_0xa36a('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa36a('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa36a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ac1bd43..4eab7a0 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 _0xe226=['attachments','push','Attachment','Attachments','Messages','bcc','subject','createdAt','mkdirSync','each','from','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','redis','defaults','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','findAll','query','catch','show','params','model','keys','MailInteraction','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','rows','addTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip'];(function(_0x2a7622,_0x1e8526){var _0x2d5a1f=function(_0xf30bba){while(--_0xf30bba){_0x2a7622['push'](_0x2a7622['shift']());}};_0x2d5a1f(++_0x1e8526);}(_0xe226,0x8a));var _0x6e22=function(_0x26518b,_0x50be7e){_0x26518b=_0x26518b-0x0;var _0x4a28a2=_0xe226[_0x26518b];return _0x4a28a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e22('0x0'));var zipdir=require(_0x6e22('0x1'));var moment=require('moment');var BPromise=require(_0x6e22('0x2'));var util=require(_0x6e22('0x3'));var path=require(_0x6e22('0x4'));var fs=require('fs');var _=require(_0x6e22('0x5'));var juice=require('juice');var Redis=require(_0x6e22('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x6e22('0x7'));var logger=require(_0x6e22('0x8'))(_0x6e22('0x9'));var config=require(_0x6e22('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x6e22('0xb'));config[_0x6e22('0xc')]=_[_0x6e22('0xd')](config[_0x6e22('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')[_0x6e22('0xe')](socket);function respondWithStatusCode(_0x18c48b,_0x2d88d5){_0x2d88d5=_0x2d88d5||0xcc;return function(_0x32bef5){if(_0x32bef5){return _0x18c48b[_0x6e22('0xf')](_0x2d88d5);}return _0x18c48b[_0x6e22('0x10')](_0x2d88d5)[_0x6e22('0x11')]();};}function respondWithResult(_0x1cd817,_0x8d5faa){_0x8d5faa=_0x8d5faa||0xc8;return function(_0x26d6e1){if(_0x26d6e1){return _0x1cd817[_0x6e22('0x10')](_0x8d5faa)[_0x6e22('0x12')](_0x26d6e1);}};}function respondWithFilteredResult(_0x1d1795,_0x4e1ddf){return function(_0x51f618){if(_0x51f618){var _0x51292d=typeof _0x4e1ddf[_0x6e22('0x13')]===_0x6e22('0x14')&&typeof _0x4e1ddf[_0x6e22('0x15')]===_0x6e22('0x14');var _0x277f86=_0x51f618['count'];var _0x2363e2=_0x51292d?0x0:_0x4e1ddf[_0x6e22('0x13')];var _0x14b721=_0x51292d?_0x51f618[_0x6e22('0x16')]:_0x4e1ddf['offset']+_0x4e1ddf[_0x6e22('0x15')];var _0x111e5c;if(_0x14b721>=_0x277f86){_0x14b721=_0x277f86;_0x111e5c=0xc8;}else{_0x111e5c=0xce;}_0x1d1795[_0x6e22('0x10')](_0x111e5c);return _0x1d1795[_0x6e22('0x17')](_0x6e22('0x18'),_0x2363e2+'-'+_0x14b721+'/'+_0x277f86)[_0x6e22('0x12')](_0x51f618);}return null;};}function saveUpdates(_0x2c4fc7){return function(_0x136062){if(_0x136062){return _0x136062[_0x6e22('0x19')](_0x2c4fc7)[_0x6e22('0x1a')](function(_0x23d174){return _0x23d174;});}return null;};}function removeEntity(_0x593f4e){return function(_0x5832fa){if(_0x5832fa){return _0x5832fa[_0x6e22('0x1b')]()['then'](function(){_0x593f4e['status'](0xcc)[_0x6e22('0x11')]();});}};}function handleEntityNotFound(_0x13e462){return function(_0x3ebca7){if(!_0x3ebca7){_0x13e462[_0x6e22('0xf')](0x194);}return _0x3ebca7;};}function handleError(_0x83ebe0,_0x26d869){_0x26d869=_0x26d869||0x1f4;return function(_0x12bcc8){logger[_0x6e22('0x1c')](_0x12bcc8['stack']);if(_0x12bcc8[_0x6e22('0x1d')]){delete _0x12bcc8[_0x6e22('0x1d')];}_0x83ebe0[_0x6e22('0x10')](_0x26d869)[_0x6e22('0x1e')](_0x12bcc8);};}exports[_0x6e22('0x1f')]=function(_0x435fec,_0x37f1b9){var _0x2ed9a9={};var _0x488cea=_[_0x6e22('0x20')](db['MailInteraction'][_0x6e22('0x21')],function(_0x4c4d95){return{'name':_0x4c4d95['fieldName'],'type':_0x4c4d95[_0x6e22('0x22')][_0x6e22('0x23')]};});_0x2ed9a9=qs['getOptions'](_0x488cea,_0x435fec);return interaction[_0x6e22('0x24')]('mail',_0x435fec[_0x6e22('0x25')],_0x435fec['user'],_0x2ed9a9,_0x488cea)['then'](respondWithFilteredResult(_0x37f1b9,_0x2ed9a9))[_0x6e22('0x26')](handleError(_0x37f1b9,null));};exports[_0x6e22('0x27')]=function(_0xf08c38,_0x4cd9b2){var _0x22894f={'raw':![],'where':{'id':_0xf08c38[_0x6e22('0x28')]['id']}},_0x4214dc={};_0x4214dc[_0x6e22('0x29')]=_[_0x6e22('0x2a')](db[_0x6e22('0x2b')][_0x6e22('0x21')]);_0x4214dc[_0x6e22('0x25')]=_['keys'](_0xf08c38[_0x6e22('0x25')]);_0x4214dc[_0x6e22('0x2c')]=_[_0x6e22('0x2d')](_0x4214dc[_0x6e22('0x29')],_0x4214dc[_0x6e22('0x25')]);_0x22894f[_0x6e22('0x2e')]=_[_0x6e22('0x2d')](_0x4214dc[_0x6e22('0x29')],qs[_0x6e22('0x2f')](_0xf08c38[_0x6e22('0x25')][_0x6e22('0x2f')]));_0x22894f[_0x6e22('0x2e')]=_0x22894f['attributes'][_0x6e22('0x30')]?_0x22894f[_0x6e22('0x2e')]:_0x4214dc['model'];if(_0xf08c38['query']['includeAll']){_0x22894f[_0x6e22('0x31')]=[{'all':!![]}];}_0x22894f=_[_0x6e22('0x32')]({},_0x22894f,_0xf08c38[_0x6e22('0x33')]);return db[_0x6e22('0x2b')][_0x6e22('0x34')](_0x22894f)[_0x6e22('0x1a')](handleEntityNotFound(_0x4cd9b2,null))[_0x6e22('0x1a')](respondWithResult(_0x4cd9b2,null))[_0x6e22('0x26')](handleError(_0x4cd9b2,null));};exports[_0x6e22('0x35')]=function(_0x21dffd,_0x45c3b4){return db[_0x6e22('0x2b')]['create'](_0x21dffd[_0x6e22('0x36')],{})['then'](respondWithResult(_0x45c3b4,0xc9))[_0x6e22('0x26')](handleError(_0x45c3b4,null));};exports[_0x6e22('0x19')]=function(_0x33fa83,_0x450d34){if(_0x33fa83['body']['id']){delete _0x33fa83[_0x6e22('0x36')]['id'];}return db[_0x6e22('0x2b')][_0x6e22('0x34')]({'where':{'id':_0x33fa83[_0x6e22('0x28')]['id']}})['then'](handleEntityNotFound(_0x450d34,null))['then'](saveUpdates(_0x33fa83[_0x6e22('0x36')],null))[_0x6e22('0x1a')](respondWithResult(_0x450d34,null))[_0x6e22('0x26')](handleError(_0x450d34,null));};exports[_0x6e22('0x1b')]=function(_0x26554e,_0x25d069){return db[_0x6e22('0x2b')][_0x6e22('0x34')]({'where':{'id':_0x26554e[_0x6e22('0x28')]['id']}})[_0x6e22('0x1a')](handleEntityNotFound(_0x25d069,null))[_0x6e22('0x1a')](removeEntity(_0x25d069,null))[_0x6e22('0x26')](handleError(_0x25d069,null));};exports[_0x6e22('0x37')]=function(_0x36c8f4,_0x43b127){return db[_0x6e22('0x2b')][_0x6e22('0x37')]()[_0x6e22('0x1a')](respondWithResult(_0x43b127,null))[_0x6e22('0x26')](handleError(_0x43b127,null));};exports[_0x6e22('0x38')]=function(_0x1a46b6,_0x3866cd){return db['MailMessage'][_0x6e22('0x34')]({'where':{'id':_0x1a46b6['params']['id']}})[_0x6e22('0x1a')](handleEntityNotFound(_0x3866cd,null))[_0x6e22('0x1a')](function(_0x2a5d09){if(_0x2a5d09){return _0x2a5d09['addMessage'](_0x1a46b6[_0x6e22('0x36')][_0x6e22('0x39')],_[_0x6e22('0x3a')](_0x1a46b6[_0x6e22('0x36')],[_0x6e22('0x39'),'id'])||{});}})['then'](respondWithResult(_0x3866cd,null))['catch'](handleError(_0x3866cd,null));};exports[_0x6e22('0x3b')]=function(_0x440b6e,_0x52f73f){var _0x5c4005={'raw':![],'where':{}};var _0x4fd331={};var _0x4db85f={'count':0x0,'rows':[]};return db['MailInteraction'][_0x6e22('0x3c')]({'where':{'id':_0x440b6e[_0x6e22('0x28')]['id']}})['then'](handleEntityNotFound(_0x52f73f,null))[_0x6e22('0x1a')](function(_0x4d8eb6){if(_0x4d8eb6){_0x4fd331['model']=_[_0x6e22('0x2a')](db[_0x6e22('0x3d')]['rawAttributes']);_0x4fd331['query']=_[_0x6e22('0x2a')](_0x440b6e[_0x6e22('0x25')]);_0x4fd331['filters']=_[_0x6e22('0x2d')](_0x4fd331[_0x6e22('0x29')],_0x4fd331['query']);_0x5c4005['attributes']=_[_0x6e22('0x2d')](_0x4fd331[_0x6e22('0x29')],qs[_0x6e22('0x2f')](_0x440b6e[_0x6e22('0x25')][_0x6e22('0x2f')]));_0x5c4005[_0x6e22('0x2e')]=_0x5c4005['attributes'][_0x6e22('0x30')]?_0x5c4005[_0x6e22('0x2e')]:_0x4fd331[_0x6e22('0x29')];if(!_0x440b6e['query'][_0x6e22('0x3e')](_0x6e22('0x3f'))){_0x5c4005['limit']=qs['limit'](_0x440b6e[_0x6e22('0x25')][_0x6e22('0x15')]);_0x5c4005['offset']=qs[_0x6e22('0x13')](_0x440b6e['query'][_0x6e22('0x13')]);}_0x5c4005['order']=qs[_0x6e22('0x40')](_0x440b6e[_0x6e22('0x25')]['sort']);_0x5c4005[_0x6e22('0x41')]=qs['filters'](_[_0x6e22('0x42')](_0x440b6e[_0x6e22('0x25')],_0x4fd331[_0x6e22('0x2c')]));_0x5c4005[_0x6e22('0x41')][_0x6e22('0x43')]=_0x4d8eb6['id'];if(_0x440b6e[_0x6e22('0x25')]['filter']){_0x5c4005[_0x6e22('0x41')]=_['merge'](_0x5c4005[_0x6e22('0x41')],{'$or':_[_0x6e22('0x20')](_0x5c4005[_0x6e22('0x2e')],function(_0x8e2122){var _0x99ef21={};_0x99ef21[_0x8e2122]={'$like':'%'+_0x440b6e[_0x6e22('0x25')][_0x6e22('0x44')]+'%'};return _0x99ef21;})});}if(_0x440b6e[_0x6e22('0x25')][_0x6e22('0x45')]){var _0x1bde58=_0x440b6e[_0x6e22('0x25')][_0x6e22('0x45')][_0x6e22('0x46')](',');var _0x150a94={};_0x150a94[_0x1bde58[0x0]]={'$gte':moment(_0x1bde58[0x1])[_0x6e22('0x47')](_0x6e22('0x48'))};_0x5c4005[_0x6e22('0x41')]=_['merge'](_0x5c4005[_0x6e22('0x41')],_0x150a94);}_0x5c4005=_[_0x6e22('0x32')]({},_0x5c4005,_0x440b6e[_0x6e22('0x33')]);return db['MailMessage'][_0x6e22('0x16')]({'where':_0x5c4005['where']})['then'](function(_0x1a1150){_0x4db85f['count']=_0x1a1150;if(_0x440b6e['query'][_0x6e22('0x49')]){_0x5c4005[_0x6e22('0x31')]=[{'all':!![]}];}return db[_0x6e22('0x3d')]['findAll'](_0x5c4005);})[_0x6e22('0x1a')](function(_0x2049db){if(_0x440b6e['query'][_0x6e22('0x4a')]===_0x6e22('0x4b')){for(var _0x3a332d=0x0;_0x3a332d<_0x2049db[_0x6e22('0x30')];_0x3a332d++){_0x2049db[_0x3a332d][_0x6e22('0x36')]=juice(_0x2049db[_0x3a332d][_0x6e22('0x36')]);}}_0x4db85f[_0x6e22('0x4c')]=_0x2049db;return _0x4db85f;});}})['then'](respondWithFilteredResult(_0x52f73f,_0x5c4005))[_0x6e22('0x26')](handleError(_0x52f73f,null));};exports[_0x6e22('0x4d')]=function(_0x3c963a,_0x32dce5){return db[_0x6e22('0x2b')][_0x6e22('0x34')]({'where':{'id':_0x3c963a['params']['id']}})[_0x6e22('0x1a')](handleEntityNotFound(_0x32dce5,null))[_0x6e22('0x1a')](function(_0x4e08b9){if(_0x4e08b9){return _0x4e08b9['setTags'](_0x3c963a[_0x6e22('0x36')][_0x6e22('0x39')],_[_0x6e22('0x3a')](_0x3c963a['body'],[_0x6e22('0x39'),'id'])||{})[_0x6e22('0x4e')](function(){return db[_0x6e22('0x4f')][_0x6e22('0x24')]({'attributes':['id',_0x6e22('0x1d'),'color'],'where':{'id':_0x3c963a[_0x6e22('0x36')][_0x6e22('0x39')]}});})[_0x6e22('0x1a')](function(_0x368a6e){socket[_0x6e22('0x50')](_0x6e22('0x51'),{'id':Number(_0x3c963a[_0x6e22('0x28')]['id']),'tags':_0x368a6e||[]});return{'id':Number(_0x3c963a['params']['id']),'tags':_0x368a6e||[]};});}})['then'](respondWithResult(_0x32dce5,null))[_0x6e22('0x26')](handleError(_0x32dce5,null));};exports[_0x6e22('0x52')]=function(_0x2ae81c,_0x145e87){return db[_0x6e22('0x2b')]['find']({'where':{'id':_0x2ae81c[_0x6e22('0x28')]['id']}})[_0x6e22('0x1a')](handleEntityNotFound(_0x145e87,null))['then'](function(_0x55340e){if(_0x55340e){return _0x55340e[_0x6e22('0x52')](_0x2ae81c[_0x6e22('0x25')][_0x6e22('0x39')]);}})[_0x6e22('0x1a')](respondWithStatusCode(_0x145e87,null))[_0x6e22('0x26')](handleError(_0x145e87,null));};exports[_0x6e22('0x53')]=function(_0x3541ab,_0x23c59c){var _0x55188d=moment()[_0x6e22('0x54')]()[_0x6e22('0x55')]();var _0x554f11=path['join'](config[_0x6e22('0x56')],_0x6e22('0x57'),_0x6e22('0x58'),_0x6e22('0x59'));var _0x52c3f1=path[_0x6e22('0x5a')](config[_0x6e22('0x56')],_0x6e22('0x57'),_0x6e22('0x58'),'attachments');var _0xcb5de6=path[_0x6e22('0x5a')](_0x554f11,_0x55188d);var _0x5e4905=util['format'](_0x6e22('0x5b'),_0x3541ab[_0x6e22('0x28')]['id'],_0x55188d);var _0x4ead15=path['join'](_0x554f11,_0x5e4905);var _0x221f10=[];if(_0x3541ab[_0x6e22('0x25')][_0x6e22('0x5c')]){_0x221f10[_0x6e22('0x5d')]({'model':db[_0x6e22('0x5e')],'as':_0x6e22('0x5f'),'raw':!![]});}var _0x1de9ea=[{'model':db[_0x6e22('0x3d')],'as':_0x6e22('0x60'),'attributes':['id',_0x6e22('0x36'),'from','to','cc',_0x6e22('0x61'),_0x6e22('0x62'),_0x6e22('0x63')],'where':{'secret':![]},'order':qs[_0x6e22('0x40')]('id'),'include':_0x221f10}];return db[_0x6e22('0x2b')]['find']({'where':{'id':_0x3541ab[_0x6e22('0x28')]['id']},'include':_0x1de9ea})['then'](handleEntityNotFound(_0x23c59c,null))[_0x6e22('0x1a')](function(_0x3d01db){if(_0x3d01db&&_0x3d01db[_0x6e22('0x60')]){var _0x291c34=_0x3d01db['get']({'plain':!![]});fs[_0x6e22('0x64')](_0xcb5de6);return BPromise[_0x6e22('0x65')](_0x291c34['Messages'],function(_0x46eeb3,_0x210c48){var _0xe57a5c={'from':_0x46eeb3[_0x6e22('0x66')],'to':_0x46eeb3['to']||_0x6e22('0x67'),'subject':_0x46eeb3[_0x6e22('0x62')],'html':htmlEntities[_0x6e22('0x68')](_0x46eeb3[_0x6e22('0x36')]),'headers':{'Date':moment(_0x46eeb3[_0x6e22('0x63')])[_0x6e22('0x47')](_0x6e22('0x69'))},'attachments':[]};if(_0x46eeb3['cc']){_0xe57a5c['headers']['Cc']=_0x46eeb3['cc'];}if(_0x46eeb3[_0x6e22('0x61')]){_0xe57a5c[_0x6e22('0x6a')][_0x6e22('0x6b')]=_0x46eeb3[_0x6e22('0x61')];}return new BPromise(function(_0x4ab423,_0xd22fb5){if(_0x46eeb3[_0x6e22('0x5f')]){for(var _0x277e53=0x0;_0x277e53<_0x46eeb3[_0x6e22('0x5f')][_0x6e22('0x30')];_0x277e53++){var _0x311b34=_0x46eeb3['Attachments'][_0x277e53];var _0x17a18a=path['join'](_0x52c3f1,_0x311b34[_0x6e22('0x6c')]);if(fs[_0x6e22('0x6d')](_0x17a18a)){_0xe57a5c[_0x6e22('0x5c')][_0x6e22('0x5d')]({'name':_0x311b34['name'],'contentType':_0x311b34[_0x6e22('0x22')],'data':fs[_0x6e22('0x6e')](_0x17a18a)});}}}emlformat[_0x6e22('0x6f')](_0xe57a5c,function(_0x3e191c,_0x337025){if(_0x3e191c)return _0xd22fb5(_0x3e191c);fs[_0x6e22('0x70')](path[_0x6e22('0x5a')](_0xcb5de6,util['format'](_0x6e22('0x71'),_0x210c48)),_0x337025);return _0x4ab423(_0x337025);});});})[_0x6e22('0x1a')](function(){return new BPromise(function(_0x1e548d,_0x57e8b5){zipdir(_0xcb5de6,{'saveTo':_0x4ead15},function(_0x160a3f,_0x35f99e){if(_0x160a3f)return _0x57e8b5(_0x160a3f);return _0x1e548d(_0x35f99e);});})['then'](function(){return new BPromise(function(_0x4310da,_0x56ab8a){rimraf(_0xcb5de6,function(_0x5224a4){if(_0x5224a4)_0x56ab8a(_0x5224a4);return _0x4310da();});});})['then'](function(){return _0x23c59c['download'](_0x4ead15,_0x5e4905,function(_0x12f264){if(!_0x12f264)fs[_0x6e22('0x72')](_0x4ead15);});});});}else{return _0x23c59c[_0x6e22('0xf')](0xc8);}})[_0x6e22('0x26')](handleError(_0x23c59c,null));}; \ No newline at end of file +var _0x7414=['createdAt','get','each','from','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','limit','undefined','count','offset','set','json','destroy','then','stack','send','index','map','MailInteraction','rawAttributes','type','key','getOptions','findAll','query','user','catch','model','keys','filters','intersection','fields','includeAll','include','options','find','create','body','update','params','describe','MailMessage','addMessage','ids','omit','getMessages','findOne','attributes','length','hasOwnProperty','sort','pick','MailInteractionId','where','filter','$gte','split','format','merge','true','addTags','setTags','Tag','name','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','join','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','subject'];(function(_0x40149a,_0x1ef61b){var _0x579db4=function(_0x3e929e){while(--_0x3e929e){_0x40149a['push'](_0x40149a['shift']());}};_0x579db4(++_0x1ef61b);}(_0x7414,0xf1));var _0x4741=function(_0xcf06b3,_0x5de4bf){_0xcf06b3=_0xcf06b3-0x0;var _0x2ce005=_0x7414[_0xcf06b3];return _0x2ce005;};'use strict';var emlformat=require(_0x4741('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4741('0x1'));var moment=require(_0x4741('0x2'));var BPromise=require('bluebird');var util=require(_0x4741('0x3'));var path=require(_0x4741('0x4'));var fs=require('fs');var _=require(_0x4741('0x5'));var juice=require(_0x4741('0x6'));var Redis=require(_0x4741('0x7'));var interaction=require(_0x4741('0x8'));var qs=require(_0x4741('0x9'));var logger=require('../../config/logger')(_0x4741('0xa'));var config=require(_0x4741('0xb'));var db=require(_0x4741('0xc'))['db'];var htmlEntities=require(_0x4741('0xd'));config[_0x4741('0xe')]=_[_0x4741('0xf')](config[_0x4741('0xe')],{'host':_0x4741('0x10'),'port':0x18eb});var socket=require(_0x4741('0x11'))(new Redis(config['redis']));require(_0x4741('0x12'))[_0x4741('0x13')](socket);function respondWithStatusCode(_0x2acb7b,_0xdd0d8b){_0xdd0d8b=_0xdd0d8b||0xcc;return function(_0x2bf4e6){if(_0x2bf4e6){return _0x2acb7b[_0x4741('0x14')](_0xdd0d8b);}return _0x2acb7b[_0x4741('0x15')](_0xdd0d8b)[_0x4741('0x16')]();};}function respondWithResult(_0x4efedb,_0x3d88d4){_0x3d88d4=_0x3d88d4||0xc8;return function(_0x20cfdd){if(_0x20cfdd){return _0x4efedb[_0x4741('0x15')](_0x3d88d4)['json'](_0x20cfdd);}};}function respondWithFilteredResult(_0x3ad535,_0x32c424){return function(_0x1be50d){if(_0x1be50d){var _0x524f44=typeof _0x32c424['offset']==='undefined'&&typeof _0x32c424[_0x4741('0x17')]===_0x4741('0x18');var _0x1c2c4c=_0x1be50d[_0x4741('0x19')];var _0x505291=_0x524f44?0x0:_0x32c424[_0x4741('0x1a')];var _0x388660=_0x524f44?_0x1be50d['count']:_0x32c424[_0x4741('0x1a')]+_0x32c424[_0x4741('0x17')];var _0x4f092e;if(_0x388660>=_0x1c2c4c){_0x388660=_0x1c2c4c;_0x4f092e=0xc8;}else{_0x4f092e=0xce;}_0x3ad535[_0x4741('0x15')](_0x4f092e);return _0x3ad535[_0x4741('0x1b')]('Content-Range',_0x505291+'-'+_0x388660+'/'+_0x1c2c4c)[_0x4741('0x1c')](_0x1be50d);}return null;};}function saveUpdates(_0x59c9fd){return function(_0x4911d2){if(_0x4911d2){return _0x4911d2['update'](_0x59c9fd)['then'](function(_0x2cc0e2){return _0x2cc0e2;});}return null;};}function removeEntity(_0x39c079){return function(_0x30cb9e){if(_0x30cb9e){return _0x30cb9e[_0x4741('0x1d')]()[_0x4741('0x1e')](function(){_0x39c079[_0x4741('0x15')](0xcc)[_0x4741('0x16')]();});}};}function handleEntityNotFound(_0x4e1fe3){return function(_0xa108cc){if(!_0xa108cc){_0x4e1fe3[_0x4741('0x14')](0x194);}return _0xa108cc;};}function handleError(_0x2dd322,_0x558467){_0x558467=_0x558467||0x1f4;return function(_0x53d198){logger['error'](_0x53d198[_0x4741('0x1f')]);if(_0x53d198['name']){delete _0x53d198['name'];}_0x2dd322[_0x4741('0x15')](_0x558467)[_0x4741('0x20')](_0x53d198);};}exports[_0x4741('0x21')]=function(_0x1f7a0f,_0x5ef75a){var _0x281ddb={};var _0x478f9c=_[_0x4741('0x22')](db[_0x4741('0x23')][_0x4741('0x24')],function(_0x1bd3e9){return{'name':_0x1bd3e9['fieldName'],'type':_0x1bd3e9[_0x4741('0x25')][_0x4741('0x26')]};});_0x281ddb=qs[_0x4741('0x27')](_0x478f9c,_0x1f7a0f);return interaction[_0x4741('0x28')]('mail',_0x1f7a0f[_0x4741('0x29')],_0x1f7a0f[_0x4741('0x2a')],_0x281ddb,_0x478f9c)[_0x4741('0x1e')](respondWithFilteredResult(_0x5ef75a,_0x281ddb))[_0x4741('0x2b')](handleError(_0x5ef75a,null));};exports['show']=function(_0x2088a2,_0x1581ec){var _0x478130={'raw':![],'where':{'id':_0x2088a2['params']['id']}},_0x40f488={};_0x40f488[_0x4741('0x2c')]=_[_0x4741('0x2d')](db[_0x4741('0x23')]['rawAttributes']);_0x40f488[_0x4741('0x29')]=_[_0x4741('0x2d')](_0x2088a2['query']);_0x40f488[_0x4741('0x2e')]=_[_0x4741('0x2f')](_0x40f488[_0x4741('0x2c')],_0x40f488[_0x4741('0x29')]);_0x478130['attributes']=_['intersection'](_0x40f488[_0x4741('0x2c')],qs[_0x4741('0x30')](_0x2088a2[_0x4741('0x29')][_0x4741('0x30')]));_0x478130['attributes']=_0x478130['attributes']['length']?_0x478130['attributes']:_0x40f488['model'];if(_0x2088a2[_0x4741('0x29')][_0x4741('0x31')]){_0x478130[_0x4741('0x32')]=[{'all':!![]}];}_0x478130=_['merge']({},_0x478130,_0x2088a2[_0x4741('0x33')]);return db[_0x4741('0x23')][_0x4741('0x34')](_0x478130)['then'](handleEntityNotFound(_0x1581ec,null))['then'](respondWithResult(_0x1581ec,null))[_0x4741('0x2b')](handleError(_0x1581ec,null));};exports['create']=function(_0x305e16,_0x25607c){return db[_0x4741('0x23')][_0x4741('0x35')](_0x305e16[_0x4741('0x36')],{})['then'](respondWithResult(_0x25607c,0xc9))[_0x4741('0x2b')](handleError(_0x25607c,null));};exports[_0x4741('0x37')]=function(_0x18466e,_0x4284f7){if(_0x18466e[_0x4741('0x36')]['id']){delete _0x18466e['body']['id'];}return db[_0x4741('0x23')][_0x4741('0x34')]({'where':{'id':_0x18466e['params']['id']}})['then'](handleEntityNotFound(_0x4284f7,null))[_0x4741('0x1e')](saveUpdates(_0x18466e[_0x4741('0x36')],null))[_0x4741('0x1e')](respondWithResult(_0x4284f7,null))[_0x4741('0x2b')](handleError(_0x4284f7,null));};exports[_0x4741('0x1d')]=function(_0x14c892,_0x2f261a){return db['MailInteraction'][_0x4741('0x34')]({'where':{'id':_0x14c892[_0x4741('0x38')]['id']}})[_0x4741('0x1e')](handleEntityNotFound(_0x2f261a,null))[_0x4741('0x1e')](removeEntity(_0x2f261a,null))['catch'](handleError(_0x2f261a,null));};exports[_0x4741('0x39')]=function(_0x5a454c,_0x182d63){return db[_0x4741('0x23')]['describe']()['then'](respondWithResult(_0x182d63,null))[_0x4741('0x2b')](handleError(_0x182d63,null));};exports['addMessage']=function(_0x2faef1,_0x4524fa){return db[_0x4741('0x3a')][_0x4741('0x34')]({'where':{'id':_0x2faef1['params']['id']}})[_0x4741('0x1e')](handleEntityNotFound(_0x4524fa,null))[_0x4741('0x1e')](function(_0x1161de){if(_0x1161de){return _0x1161de[_0x4741('0x3b')](_0x2faef1['body'][_0x4741('0x3c')],_[_0x4741('0x3d')](_0x2faef1[_0x4741('0x36')],[_0x4741('0x3c'),'id'])||{});}})[_0x4741('0x1e')](respondWithResult(_0x4524fa,null))[_0x4741('0x2b')](handleError(_0x4524fa,null));};exports[_0x4741('0x3e')]=function(_0x165e3b,_0x2a0a78){var _0x580a23={'raw':![],'where':{}};var _0x1ba003={};var _0x2ee729={'count':0x0,'rows':[]};return db[_0x4741('0x23')][_0x4741('0x3f')]({'where':{'id':_0x165e3b[_0x4741('0x38')]['id']}})[_0x4741('0x1e')](handleEntityNotFound(_0x2a0a78,null))[_0x4741('0x1e')](function(_0x16db16){if(_0x16db16){_0x1ba003[_0x4741('0x2c')]=_[_0x4741('0x2d')](db[_0x4741('0x3a')][_0x4741('0x24')]);_0x1ba003[_0x4741('0x29')]=_['keys'](_0x165e3b['query']);_0x1ba003[_0x4741('0x2e')]=_[_0x4741('0x2f')](_0x1ba003[_0x4741('0x2c')],_0x1ba003[_0x4741('0x29')]);_0x580a23[_0x4741('0x40')]=_['intersection'](_0x1ba003['model'],qs[_0x4741('0x30')](_0x165e3b[_0x4741('0x29')][_0x4741('0x30')]));_0x580a23[_0x4741('0x40')]=_0x580a23[_0x4741('0x40')][_0x4741('0x41')]?_0x580a23[_0x4741('0x40')]:_0x1ba003[_0x4741('0x2c')];if(!_0x165e3b[_0x4741('0x29')][_0x4741('0x42')]('nolimit')){_0x580a23[_0x4741('0x17')]=qs['limit'](_0x165e3b['query'][_0x4741('0x17')]);_0x580a23['offset']=qs[_0x4741('0x1a')](_0x165e3b['query'][_0x4741('0x1a')]);}_0x580a23['order']=qs[_0x4741('0x43')](_0x165e3b['query'][_0x4741('0x43')]);_0x580a23['where']=qs['filters'](_[_0x4741('0x44')](_0x165e3b['query'],_0x1ba003[_0x4741('0x2e')]));_0x580a23['where'][_0x4741('0x45')]=_0x16db16['id'];if(_0x165e3b[_0x4741('0x29')]['filter']){_0x580a23[_0x4741('0x46')]=_['merge'](_0x580a23['where'],{'$or':_[_0x4741('0x22')](_0x580a23[_0x4741('0x40')],function(_0x3d57cf){var _0x2469d0={};_0x2469d0[_0x3d57cf]={'$like':'%'+_0x165e3b[_0x4741('0x29')][_0x4741('0x47')]+'%'};return _0x2469d0;})});}if(_0x165e3b['query'][_0x4741('0x48')]){var _0x252992=_0x165e3b['query'][_0x4741('0x48')][_0x4741('0x49')](',');var _0x1007bf={};_0x1007bf[_0x252992[0x0]]={'$gte':moment(_0x252992[0x1])[_0x4741('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x580a23[_0x4741('0x46')]=_['merge'](_0x580a23['where'],_0x1007bf);}_0x580a23=_[_0x4741('0x4b')]({},_0x580a23,_0x165e3b['options']);return db[_0x4741('0x3a')]['count']({'where':_0x580a23[_0x4741('0x46')]})[_0x4741('0x1e')](function(_0x5ccbdc){_0x2ee729['count']=_0x5ccbdc;if(_0x165e3b[_0x4741('0x29')][_0x4741('0x31')]){_0x580a23[_0x4741('0x32')]=[{'all':!![]}];}return db[_0x4741('0x3a')][_0x4741('0x28')](_0x580a23);})[_0x4741('0x1e')](function(_0x4155b9){if(_0x165e3b[_0x4741('0x29')]['inlineCss']===_0x4741('0x4c')){for(var _0x155d3d=0x0;_0x155d3d<_0x4155b9[_0x4741('0x41')];_0x155d3d++){_0x4155b9[_0x155d3d][_0x4741('0x36')]=juice(_0x4155b9[_0x155d3d][_0x4741('0x36')]);}}_0x2ee729['rows']=_0x4155b9;return _0x2ee729;});}})['then'](respondWithFilteredResult(_0x2a0a78,_0x580a23))[_0x4741('0x2b')](handleError(_0x2a0a78,null));};exports[_0x4741('0x4d')]=function(_0x5c00fc,_0x2325bb){return db[_0x4741('0x23')][_0x4741('0x34')]({'where':{'id':_0x5c00fc[_0x4741('0x38')]['id']}})[_0x4741('0x1e')](handleEntityNotFound(_0x2325bb,null))['then'](function(_0x4b0fab){if(_0x4b0fab){return _0x4b0fab[_0x4741('0x4e')](_0x5c00fc['body']['ids'],_['omit'](_0x5c00fc['body'],['ids','id'])||{})['spread'](function(){return db[_0x4741('0x4f')][_0x4741('0x28')]({'attributes':['id',_0x4741('0x50'),'color'],'where':{'id':_0x5c00fc[_0x4741('0x36')][_0x4741('0x3c')]}});})['then'](function(_0x5c5ee9){socket[_0x4741('0x51')](_0x4741('0x52'),{'id':Number(_0x5c00fc[_0x4741('0x38')]['id']),'tags':_0x5c5ee9||[]});return{'id':Number(_0x5c00fc[_0x4741('0x38')]['id']),'tags':_0x5c5ee9||[]};});}})[_0x4741('0x1e')](respondWithResult(_0x2325bb,null))['catch'](handleError(_0x2325bb,null));};exports[_0x4741('0x53')]=function(_0x1e761a,_0x5233c3){return db[_0x4741('0x23')]['find']({'where':{'id':_0x1e761a['params']['id']}})[_0x4741('0x1e')](handleEntityNotFound(_0x5233c3,null))[_0x4741('0x1e')](function(_0x4d337c){if(_0x4d337c){return _0x4d337c[_0x4741('0x53')](_0x1e761a[_0x4741('0x29')][_0x4741('0x3c')]);}})['then'](respondWithStatusCode(_0x5233c3,null))[_0x4741('0x2b')](handleError(_0x5233c3,null));};exports[_0x4741('0x54')]=function(_0x3893c2,_0x4d5372){var _0x18e755=moment()[_0x4741('0x55')]()[_0x4741('0x56')]();var _0xbbbd1c=path['join'](config[_0x4741('0x57')],_0x4741('0x58'),_0x4741('0x59'),'tmp');var _0x370571=path[_0x4741('0x5a')](config['root'],_0x4741('0x58'),_0x4741('0x59'),_0x4741('0x5b'));var _0x3cee1a=path[_0x4741('0x5a')](_0xbbbd1c,_0x18e755);var _0x56bbeb=util['format'](_0x4741('0x5c'),_0x3893c2[_0x4741('0x38')]['id'],_0x18e755);var _0xb6c4d3=path[_0x4741('0x5a')](_0xbbbd1c,_0x56bbeb);var _0x4d7257=[];if(_0x3893c2[_0x4741('0x29')][_0x4741('0x5b')]){_0x4d7257[_0x4741('0x5d')]({'model':db[_0x4741('0x5e')],'as':_0x4741('0x5f'),'raw':!![]});}var _0x22b368=[{'model':db[_0x4741('0x3a')],'as':_0x4741('0x60'),'attributes':['id',_0x4741('0x36'),'from','to','cc','bcc',_0x4741('0x61'),_0x4741('0x62')],'where':{'secret':![]},'order':qs[_0x4741('0x43')]('id'),'include':_0x4d7257}];return db['MailInteraction']['find']({'where':{'id':_0x3893c2[_0x4741('0x38')]['id']},'include':_0x22b368})[_0x4741('0x1e')](handleEntityNotFound(_0x4d5372,null))['then'](function(_0x292193){if(_0x292193&&_0x292193['Messages']){var _0x124656=_0x292193[_0x4741('0x63')]({'plain':!![]});fs['mkdirSync'](_0x3cee1a);return BPromise[_0x4741('0x64')](_0x124656[_0x4741('0x60')],function(_0x27d495,_0x3f1ce1){var _0x3959e4={'from':_0x27d495[_0x4741('0x65')],'to':_0x27d495['to']||_0x4741('0x66'),'subject':_0x27d495[_0x4741('0x61')],'html':htmlEntities['decode'](_0x27d495[_0x4741('0x36')]),'headers':{'Date':moment(_0x27d495[_0x4741('0x62')])[_0x4741('0x4a')](_0x4741('0x67'))},'attachments':[]};if(_0x27d495['cc']){_0x3959e4[_0x4741('0x68')]['Cc']=_0x27d495['cc'];}if(_0x27d495['bcc']){_0x3959e4[_0x4741('0x68')][_0x4741('0x69')]=_0x27d495['bcc'];}return new BPromise(function(_0x1d5c82,_0x37761b){if(_0x27d495[_0x4741('0x5f')]){for(var _0x172587=0x0;_0x172587<_0x27d495[_0x4741('0x5f')][_0x4741('0x41')];_0x172587++){var _0x485549=_0x27d495[_0x4741('0x5f')][_0x172587];var _0x47d122=path[_0x4741('0x5a')](_0x370571,_0x485549[_0x4741('0x6a')]);if(fs[_0x4741('0x6b')](_0x47d122)){_0x3959e4[_0x4741('0x5b')]['push']({'name':_0x485549['name'],'contentType':_0x485549['type'],'data':fs[_0x4741('0x6c')](_0x47d122)});}}}emlformat[_0x4741('0x6d')](_0x3959e4,function(_0x4579dc,_0x304750){if(_0x4579dc)return _0x37761b(_0x4579dc);fs[_0x4741('0x6e')](path[_0x4741('0x5a')](_0x3cee1a,util[_0x4741('0x4a')](_0x4741('0x6f'),_0x3f1ce1)),_0x304750);return _0x1d5c82(_0x304750);});});})[_0x4741('0x1e')](function(){return new BPromise(function(_0x5c8ffb,_0x6336c3){zipdir(_0x3cee1a,{'saveTo':_0xb6c4d3},function(_0x2b550a,_0x187107){if(_0x2b550a)return _0x6336c3(_0x2b550a);return _0x5c8ffb(_0x187107);});})[_0x4741('0x1e')](function(){return new BPromise(function(_0x1942b9,_0x5158b0){rimraf(_0x3cee1a,function(_0x1871ec){if(_0x1871ec)_0x5158b0(_0x1871ec);return _0x1942b9();});});})['then'](function(){return _0x4d5372[_0x4741('0x54')](_0xb6c4d3,_0x56bbeb,function(_0x1edf7c){if(!_0x1edf7c)fs[_0x4741('0x70')](_0xb6c4d3);});});});}else{return _0x4d5372[_0x4741('0x14')](0xc8);}})[_0x4741('0x2b')](handleError(_0x4d5372,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 17d0666..ba69276 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 _0x61e2=['exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook'];(function(_0x54f192,_0x2b713b){var _0x3c7d1d=function(_0x396290){while(--_0x396290){_0x54f192['push'](_0x54f192['shift']());}};_0x3c7d1d(++_0x2b713b);}(_0x61e2,0xc7));var _0x261e=function(_0x21293b,_0x180235){_0x21293b=_0x21293b-0x0;var _0x1df041=_0x61e2[_0x21293b];return _0x1df041;};'use strict';var EventEmitter=require(_0x261e('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x261e('0x1')];var MailMessage=require(_0x261e('0x2'))['db'][_0x261e('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x261e('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x261e('0x5'),'afterDestroy':_0x261e('0x6')};function emitEvent(_0xf90f12){return function(_0x2dda42,_0x2b55ae,_0x373800){_0x2dda42[_0x261e('0x7')]({'attributes':['id'],'raw':!![]})[_0x261e('0x8')](function(_0x16d754){_0x2dda42[_0x261e('0x9')](_0x261e('0xa'),_0x16d754[_0x261e('0xb')](function(_0x1314ac){return{'id':_0x1314ac['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2dda42['id'],'direction':'in','read':![]},'raw':!![]});})[_0x261e('0x8')](function(_0x4826fb){_0x2dda42[_0x261e('0x9')]('unreadMessages',_0x4826fb[_0x261e('0xc')]);MailInteractionEvents[_0x261e('0xd')](_0xf90f12+':'+_0x2dda42['id'],_0x2dda42);MailInteractionEvents['emit'](_0xf90f12,_0x2dda42);_0x373800(null);})[_0x261e('0xe')](_0x373800(null));};}for(var e in events){if(events[_0x261e('0xf')](e)){var event=events[e];MailInteraction[_0x261e('0x10')](e,emitEvent(event));}}module[_0x261e('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x2f96=['catch','hook','exports','MailInteraction','../../mysqldb','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x4ef5b3,_0x409086){var _0xf3715=function(_0x42c641){while(--_0x42c641){_0x4ef5b3['push'](_0x4ef5b3['shift']());}};_0xf3715(++_0x409086);}(_0x2f96,0x1b3));var _0x62f9=function(_0x5d9b5c,_0x37a133){_0x5d9b5c=_0x5d9b5c-0x0;var _0x1f6a8b=_0x2f96[_0x5d9b5c];return _0x1f6a8b;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x62f9('0x0')];var MailMessage=require(_0x62f9('0x1'))['db'][_0x62f9('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x62f9('0x3'),'afterUpdate':_0x62f9('0x4'),'afterDestroy':_0x62f9('0x5')};function emitEvent(_0x1ae9dd){return function(_0x419e5,_0x20c891,_0x3af56f){_0x419e5[_0x62f9('0x6')]({'attributes':['id'],'raw':!![]})[_0x62f9('0x7')](function(_0x5a7975){_0x419e5[_0x62f9('0x8')](_0x62f9('0x9'),_0x5a7975[_0x62f9('0xa')](function(_0x17ae4f){return{'id':_0x17ae4f['id']};}));return MailMessage[_0x62f9('0xb')]({'where':{'MailInteractionId':_0x419e5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x62f9('0x7')](function(_0x5057c5){_0x419e5[_0x62f9('0x8')](_0x62f9('0xc'),_0x5057c5[_0x62f9('0xd')]);MailInteractionEvents[_0x62f9('0xe')](_0x1ae9dd+':'+_0x419e5['id'],_0x419e5);MailInteractionEvents[_0x62f9('0xe')](_0x1ae9dd,_0x419e5);_0x3af56f(null);})[_0x62f9('0xf')](_0x3af56f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x62f9('0x10')](e,emitEvent(event));}}module[_0x62f9('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index cee0bf5..3cb8915 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 _0xd737=['substatus','format','models','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','fti_mail_interactions','subject','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed'];(function(_0x4a7a17,_0x3948c0){var _0x28509e=function(_0x288617){while(--_0x288617){_0x4a7a17['push'](_0x4a7a17['shift']());}};_0x28509e(++_0x3948c0);}(_0xd737,0xbe));var _0x7d73=function(_0x130719,_0x2a7018){_0x130719=_0x130719-0x0;var _0x159865=_0xd737[_0x130719];return _0x159865;};'use strict';var _=require(_0x7d73('0x0'));var util=require(_0x7d73('0x1'));var logger=require(_0x7d73('0x2'))(_0x7d73('0x3'));var moment=require(_0x7d73('0x4'));var BPromise=require('bluebird');var rp=require(_0x7d73('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d73('0x6'));var config=require(_0x7d73('0x7'));var attributes=require(_0x7d73('0x8'));module[_0x7d73('0x9')]=function(_0x2bee27,_0x44d7fa){return _0x2bee27[_0x7d73('0xa')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7d73('0xb'),'fields':[_0x7d73('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x429400,_0x46c6fc,_0x534498){if(_0x429400['substatus']){_0x429400[_0x7d73('0xd')]=moment()['format'](_0x7d73('0xe'));}if(_0x429400[_0x7d73('0xf')]){_0x429400[_0x7d73('0x10')]=moment()['format'](_0x7d73('0xe'));}_0x534498(null,_0x46c6fc);},'beforeUpdate':function(_0x2412a9,_0x5e778e,_0x8c9775){if(_0x2412a9[_0x7d73('0x11')](_0x7d73('0x12'))){_0x2412a9[_0x7d73('0xd')]=_0x2412a9[_0x7d73('0x12')]?moment()[_0x7d73('0x13')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2412a9[_0x7d73('0x11')](_0x7d73('0xf'))){_0x2412a9['closedAt']=moment()[_0x7d73('0x13')](_0x7d73('0xe'));_0x2412a9[_0x7d73('0x12')]=null;_0x2412a9[_0x7d73('0xd')]=null;}_0x8c9775(null,_0x2412a9);},'afterUpdate':function(_0x4e2b16,_0x579fae,_0x1919a0){var _0x3cf687=_0x2bee27[_0x7d73('0x14')];var _0x18740e=_0x4e2b16['get']({'plain':!![]});if(_0x18740e[_0x7d73('0xf')]){return _0x3cf687[_0x7d73('0x15')][_0x7d73('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x18740e['id']}})[_0x7d73('0x17')](function(){_0x1919a0();})[_0x7d73('0x18')](function(_0x5a0812){_0x1919a0(_0x5a0812);});}else{_0x1919a0();}}},'charset':'utf8mb4','collate':_0x7d73('0x19')});}; \ No newline at end of file +var _0xedb7=['models','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','format'];(function(_0x4bd74f,_0x2478fd){var _0x4696bd=function(_0x3aed85){while(--_0x3aed85){_0x4bd74f['push'](_0x4bd74f['shift']());}};_0x4696bd(++_0x2478fd);}(_0xedb7,0x9c));var _0x7edb=function(_0x4e8244,_0x144fa8){_0x4e8244=_0x4e8244-0x0;var _0x3c0693=_0xedb7[_0x4e8244];return _0x3c0693;};'use strict';var _=require(_0x7edb('0x0'));var util=require(_0x7edb('0x1'));var logger=require(_0x7edb('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7edb('0x3'));var fs=require('fs');var path=require(_0x7edb('0x4'));var rimraf=require('rimraf');var config=require(_0x7edb('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x7edb('0x6')]=function(_0xe57b7e,_0x85c2a8){return _0xe57b7e[_0x7edb('0x7')](_0x7edb('0x8'),attributes,{'tableName':_0x7edb('0x9'),'paranoid':![],'indexes':[{'name':_0x7edb('0xa'),'fields':[_0x7edb('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x13480a,_0x5eb250,_0x2ebb3c){if(_0x13480a[_0x7edb('0xc')]){_0x13480a[_0x7edb('0xd')]=moment()['format'](_0x7edb('0xe'));}if(_0x13480a[_0x7edb('0xf')]){_0x13480a[_0x7edb('0x10')]=moment()['format'](_0x7edb('0xe'));}_0x2ebb3c(null,_0x5eb250);},'beforeUpdate':function(_0x3f8221,_0x5d7fb0,_0x17dcf5){if(_0x3f8221[_0x7edb('0x11')](_0x7edb('0xc'))){_0x3f8221[_0x7edb('0xd')]=_0x3f8221['substatus']?moment()[_0x7edb('0x12')](_0x7edb('0xe')):null;}if(_0x3f8221[_0x7edb('0x11')]('closed')){_0x3f8221['closedAt']=moment()[_0x7edb('0x12')](_0x7edb('0xe'));_0x3f8221[_0x7edb('0xc')]=null;_0x3f8221[_0x7edb('0xd')]=null;}_0x17dcf5(null,_0x3f8221);},'afterUpdate':function(_0x20c875,_0x803f1e,_0x43bd47){var _0x3a902a=_0xe57b7e[_0x7edb('0x13')];var _0x30d6d2=_0x20c875['get']({'plain':!![]});if(_0x30d6d2[_0x7edb('0xf')]){return _0x3a902a[_0x7edb('0x14')][_0x7edb('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x30d6d2['id']}})[_0x7edb('0x16')](function(){_0x43bd47();})[_0x7edb('0x17')](function(_0x37951f){_0x43bd47(_0x37951f);});}else{_0x43bd47();}}},'charset':'utf8mb4','collate':_0x7edb('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 59d91ee..63fe4fe 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 _0x4c0c=['./mailInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','update','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','MailInteraction','find','addTags','body','omit','ids','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x3a3016,_0x2af3c3){var _0x17c4af=function(_0x4b7532){while(--_0x4b7532){_0x3a3016['push'](_0x3a3016['shift']());}};_0x17c4af(++_0x2af3c3);}(_0x4c0c,0xef));var _0xc4c0=function(_0x1ddc7d,_0x10674b){_0x1ddc7d=_0x1ddc7d-0x0;var _0x593fff=_0x4c0c[_0x1ddc7d];return _0x593fff;};'use strict';var _=require(_0xc4c0('0x0'));var util=require(_0xc4c0('0x1'));var moment=require('moment');var BPromise=require(_0xc4c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4c0('0x3'));var db=require(_0xc4c0('0x4'))['db'];var utils=require(_0xc4c0('0x5'));var logger=require(_0xc4c0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc4c0('0x7'));var client=jayson[_0xc4c0('0x8')]['http']({'port':0x232a});config['redis']=_[_0xc4c0('0x9')](config[_0xc4c0('0xa')],{'host':_0xc4c0('0xb'),'port':0x18eb});var socket=require(_0xc4c0('0xc'))(new Redis(config['redis']));require(_0xc4c0('0xd'))[_0xc4c0('0xe')](socket);function respondWithRpcPromise(_0x573ad9,_0x1cff15,_0x2ed144){return new BPromise(function(_0x3368fe,_0x4fabd1){return client[_0xc4c0('0xf')](_0x573ad9,_0x2ed144)[_0xc4c0('0x10')](function(_0xa35e0e){logger[_0xc4c0('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1cff15,_0xc4c0('0x12'));logger[_0xc4c0('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1cff15,_0xc4c0('0x12'),JSON[_0xc4c0('0x14')](_0xa35e0e));if(_0xa35e0e[_0xc4c0('0x15')]){if(_0xa35e0e[_0xc4c0('0x15')][_0xc4c0('0x16')]===0x1f4){logger[_0xc4c0('0x15')](_0xc4c0('0x17'),_0x1cff15,_0xa35e0e[_0xc4c0('0x15')][_0xc4c0('0x18')]);return _0x4fabd1(_0xa35e0e['error'][_0xc4c0('0x18')]);}logger[_0xc4c0('0x15')](_0xc4c0('0x17'),_0x1cff15,_0xa35e0e[_0xc4c0('0x15')]['message']);return _0x3368fe(_0xa35e0e[_0xc4c0('0x15')][_0xc4c0('0x18')]);}else{logger[_0xc4c0('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1cff15,_0xc4c0('0x12'));_0x3368fe(_0xa35e0e[_0xc4c0('0x19')][_0xc4c0('0x18')]);}})[_0xc4c0('0x1a')](function(_0x968a77){logger[_0xc4c0('0x15')](_0xc4c0('0x17'),_0x1cff15,_0x968a77);_0x4fabd1(_0x968a77);});});}exports['UpdateMailInteraction']=function(_0x5a43aa){var _0x2a6e08=this;return new Promise(function(_0x11bab6,_0x311594){return db['MailInteraction'][_0xc4c0('0x1b')](_0x5a43aa['body'],{'raw':_0x5a43aa[_0xc4c0('0x1c')]?_0x5a43aa[_0xc4c0('0x1c')][_0xc4c0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a43aa[_0xc4c0('0x1c')]?_0x5a43aa['options'][_0xc4c0('0x1e')]||null:null,'attributes':_0x5a43aa['options']?_0x5a43aa['options'][_0xc4c0('0x1f')]||null:null,'limit':_0x5a43aa['options']?_0x5a43aa[_0xc4c0('0x1c')][_0xc4c0('0x20')]||null:null})[_0xc4c0('0x10')](function(_0x386dab){logger[_0xc4c0('0x11')](_0xc4c0('0x21'),_0x5a43aa);logger['debug']('UpdateMailInteraction',_0x5a43aa,JSON[_0xc4c0('0x14')](_0x386dab));_0x11bab6(_0x386dab);})[_0xc4c0('0x1a')](function(_0x4ab590){logger['error'](_0xc4c0('0x21'),_0x4ab590['message'],_0x5a43aa);_0x311594(_0x2a6e08['error'](0x1f4,_0x4ab590[_0xc4c0('0x18')]));});});};exports[_0xc4c0('0x22')]=function(_0x74b5f){return new Promise(function(_0xb42392,_0x5727a2){return db[_0xc4c0('0x23')][_0xc4c0('0x24')]({'where':_0x74b5f[_0xc4c0('0x1c')]?_0x74b5f[_0xc4c0('0x1c')][_0xc4c0('0x1e')]||null:null})['then'](function(_0x2b37d3){if(_0x2b37d3){return _0x2b37d3[_0xc4c0('0x25')](_0x74b5f[_0xc4c0('0x26')]['ids'],_[_0xc4c0('0x27')](_0x74b5f[_0xc4c0('0x26')],[_0xc4c0('0x28'),'id'])||{});}})['spread'](function(_0x58a62d){logger[_0xc4c0('0x11')](_0xc4c0('0x29'),_0x74b5f);logger['debug'](_0xc4c0('0x29'),_0x74b5f,JSON[_0xc4c0('0x14')](_0x58a62d));_0xb42392(_0x58a62d);})['catch'](function(_0x589e7f){logger['error']('AddTags',_0x589e7f[_0xc4c0('0x18')],_0x74b5f);_0x5727a2(_this[_0xc4c0('0x15')](0x1f4,_0x589e7f[_0xc4c0('0x18')]));});});}; \ No newline at end of file +var _0x649e=['where','attributes','limit','UpdateMailInteraction','stringify','AddTagsToMailInteraction','body','ids','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','MailInteraction','update','options','raw'];(function(_0x2b0dce,_0x26646e){var _0x2c1196=function(_0x7a1542){while(--_0x7a1542){_0x2b0dce['push'](_0x2b0dce['shift']());}};_0x2c1196(++_0x26646e);}(_0x649e,0xdd));var _0xe649=function(_0x181bfd,_0x16dd8c){_0x181bfd=_0x181bfd-0x0;var _0x1f37c6=_0x649e[_0x181bfd];return _0x1f37c6;};'use strict';var _=require(_0xe649('0x0'));var util=require(_0xe649('0x1'));var moment=require(_0xe649('0x2'));var BPromise=require(_0xe649('0x3'));var rs=require(_0xe649('0x4'));var fs=require('fs');var Redis=require(_0xe649('0x5'));var db=require(_0xe649('0x6'))['db'];var utils=require(_0xe649('0x7'));var logger=require(_0xe649('0x8'))('rpc');var config=require(_0xe649('0x9'));var jayson=require(_0xe649('0xa'));var client=jayson[_0xe649('0xb')]['http']({'port':0x232a});config[_0xe649('0xc')]=_[_0xe649('0xd')](config[_0xe649('0xc')],{'host':_0xe649('0xe'),'port':0x18eb});var socket=require(_0xe649('0xf'))(new Redis(config[_0xe649('0xc')]));require(_0xe649('0x10'))[_0xe649('0x11')](socket);function respondWithRpcPromise(_0x48f631,_0x529405,_0x3b9880){return new BPromise(function(_0x4d27d1,_0x5aa502){return client['request'](_0x48f631,_0x3b9880)[_0xe649('0x12')](function(_0x340763){logger[_0xe649('0x13')](_0xe649('0x14'),_0x529405,_0xe649('0x15'));logger['debug'](_0xe649('0x16'),_0x529405,'request\x20sent',JSON['stringify'](_0x340763));if(_0x340763[_0xe649('0x17')]){if(_0x340763[_0xe649('0x17')]['code']===0x1f4){logger[_0xe649('0x17')]('MailInteraction,\x20%s,\x20%s',_0x529405,_0x340763[_0xe649('0x17')][_0xe649('0x18')]);return _0x5aa502(_0x340763[_0xe649('0x17')][_0xe649('0x18')]);}logger[_0xe649('0x17')](_0xe649('0x14'),_0x529405,_0x340763[_0xe649('0x17')][_0xe649('0x18')]);return _0x4d27d1(_0x340763[_0xe649('0x17')][_0xe649('0x18')]);}else{logger[_0xe649('0x13')](_0xe649('0x14'),_0x529405,'request\x20sent');_0x4d27d1(_0x340763[_0xe649('0x19')][_0xe649('0x18')]);}})[_0xe649('0x1a')](function(_0x1da5e4){logger[_0xe649('0x17')]('MailInteraction,\x20%s,\x20%s',_0x529405,_0x1da5e4);_0x5aa502(_0x1da5e4);});});}exports['UpdateMailInteraction']=function(_0x4cd929){var _0x5d6c3c=this;return new Promise(function(_0x7c1952,_0x382eb8){return db[_0xe649('0x1b')][_0xe649('0x1c')](_0x4cd929['body'],{'raw':_0x4cd929[_0xe649('0x1d')]?_0x4cd929[_0xe649('0x1d')][_0xe649('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cd929[_0xe649('0x1d')]?_0x4cd929[_0xe649('0x1d')][_0xe649('0x1f')]||null:null,'attributes':_0x4cd929[_0xe649('0x1d')]?_0x4cd929[_0xe649('0x1d')][_0xe649('0x20')]||null:null,'limit':_0x4cd929[_0xe649('0x1d')]?_0x4cd929['options'][_0xe649('0x21')]||null:null})[_0xe649('0x12')](function(_0x1f8c96){logger[_0xe649('0x13')](_0xe649('0x22'),_0x4cd929);logger['debug']('UpdateMailInteraction',_0x4cd929,JSON[_0xe649('0x23')](_0x1f8c96));_0x7c1952(_0x1f8c96);})['catch'](function(_0x4a42c4){logger['error']('UpdateMailInteraction',_0x4a42c4[_0xe649('0x18')],_0x4cd929);_0x382eb8(_0x5d6c3c['error'](0x1f4,_0x4a42c4[_0xe649('0x18')]));});});};exports[_0xe649('0x24')]=function(_0x5db1d9){return new Promise(function(_0x4405b8,_0x4b42d2){return db['MailInteraction']['find']({'where':_0x5db1d9[_0xe649('0x1d')]?_0x5db1d9[_0xe649('0x1d')]['where']||null:null})[_0xe649('0x12')](function(_0x4fcaa6){if(_0x4fcaa6){return _0x4fcaa6['addTags'](_0x5db1d9[_0xe649('0x25')][_0xe649('0x26')],_['omit'](_0x5db1d9[_0xe649('0x25')],[_0xe649('0x26'),'id'])||{});}})[_0xe649('0x27')](function(_0x3e8471){logger['info'](_0xe649('0x28'),_0x5db1d9);logger[_0xe649('0x29')]('AddTags',_0x5db1d9,JSON[_0xe649('0x23')](_0x3e8471));_0x4405b8(_0x3e8471);})[_0xe649('0x1a')](function(_0x3eb079){logger['error']('AddTags',_0x3eb079[_0xe649('0x18')],_0x5db1d9);_0x4b42d2(_this['error'](0x1f4,_0x3eb079[_0xe649('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 4eecb8d..f01a9a6 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 _0xe437=['./mailInteraction.events','save','update','emit','removeListener','register','mailInteraction:'];(function(_0x38dda2,_0x22a108){var _0x3b68fc=function(_0x346829){while(--_0x346829){_0x38dda2['push'](_0x38dda2['shift']());}};_0x3b68fc(++_0x22a108);}(_0xe437,0xa1));var _0x7e43=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0xe437[_0x90a39a];return _0x2b62f7;};'use strict';var MailInteractionEvents=require(_0x7e43('0x0'));var events=[_0x7e43('0x1'),'remove',_0x7e43('0x2')];function createListener(_0x3fc770,_0x420e2f){return function(_0x30beb0){_0x420e2f[_0x7e43('0x3')](_0x3fc770,_0x30beb0);};}function removeListener(_0x1d04cd,_0x22cd80){return function(){MailInteractionEvents[_0x7e43('0x4')](_0x1d04cd,_0x22cd80);};}exports[_0x7e43('0x5')]=function(_0x473a48){for(var _0x3d1da3=0x0,_0x1f52ad=events['length'];_0x3d1da3<_0x1f52ad;_0x3d1da3++){var _0x42b9fb=events[_0x3d1da3];var _0x1f2ead=createListener(_0x7e43('0x6')+_0x42b9fb,_0x473a48);MailInteractionEvents['on'](_0x42b9fb,_0x1f2ead);}}; \ No newline at end of file +var _0xc8de=['./mailInteraction.events','update','emit','removeListener','length','mailInteraction:'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xc8de,0xa2));var _0xec8d=function(_0x5a9e9e,_0x64ade7){_0x5a9e9e=_0x5a9e9e-0x0;var _0x12c008=_0xc8de[_0x5a9e9e];return _0x12c008;};'use strict';var MailInteractionEvents=require(_0xec8d('0x0'));var events=['save','remove',_0xec8d('0x1')];function createListener(_0x1f5211,_0x41d29c){return function(_0x2a6228){_0x41d29c[_0xec8d('0x2')](_0x1f5211,_0x2a6228);};}function removeListener(_0x26d62b,_0x48168e){return function(){MailInteractionEvents[_0xec8d('0x3')](_0x26d62b,_0x48168e);};}exports['register']=function(_0x96e7f7){for(var _0x3bc079=0x0,_0x2f0c11=events[_0xec8d('0x4')];_0x3bc079<_0x2f0c11;_0x3bc079++){var _0x2efb9c=events[_0x3bc079];var _0x254343=createListener(_0xec8d('0x5')+_0x2efb9c,_0x96e7f7);MailInteractionEvents['on'](_0x2efb9c,_0x254343);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 93464c7..54bcba3 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mailmessage:create','create','put','update','/:id/accept','/:id/reject','delete','destroy','multer','util','path','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe706,0xa3));var _0x6e70=function(_0xbae21b,_0x449cfb){_0xbae21b=_0xbae21b-0x0;var _0x10f16f=_0xe706[_0xbae21b];return _0x10f16f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')]('/',auth[_0x6e70('0xb')](),interaction['tracked']('mail',_0x6e70('0x14')),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')](_0x6e70('0x18'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x6e70('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x6e70('0x1a')](_0x6e70('0xf'),auth['isAuthenticated'](),controller[_0x6e70('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x5e49=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','/describe','isAuthenticated','/:id','show','/:id/download','download','post','mail','create','put','update','/:id/accept','accept','reject'];(function(_0x2e6811,_0x452e1c){var _0x5989f3=function(_0x1813ac){while(--_0x1813ac){_0x2e6811['push'](_0x2e6811['shift']());}};_0x5989f3(++_0x452e1c);}(_0x5e49,0x152));var _0x95e4=function(_0x4bff6a,_0x2a1966){_0x4bff6a=_0x4bff6a-0x0;var _0x126338=_0x5e49[_0x4bff6a];return _0x126338;};'use strict';var multer=require(_0x95e4('0x0'));var util=require(_0x95e4('0x1'));var path=require(_0x95e4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x95e4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x95e4('0x4'));var interaction=require(_0x95e4('0x5'));var config=require('../../config/environment');var controller=require(_0x95e4('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x95e4('0x7')](_0x95e4('0x8'),auth[_0x95e4('0x9')](),controller['describe']);router['get'](_0x95e4('0xa'),auth[_0x95e4('0x9')](),controller[_0x95e4('0xb')]);router[_0x95e4('0x7')](_0x95e4('0xc'),auth['isAuthenticated'](),controller[_0x95e4('0xd')]);router[_0x95e4('0xe')]('/',auth[_0x95e4('0x9')](),interaction['tracked'](_0x95e4('0xf'),'mailmessage:create'),controller[_0x95e4('0x10')]);router[_0x95e4('0x11')](_0x95e4('0xa'),auth['isAuthenticated'](),controller[_0x95e4('0x12')]);router[_0x95e4('0x11')](_0x95e4('0x13'),auth[_0x95e4('0x9')](),controller[_0x95e4('0x14')]);router[_0x95e4('0x11')]('/:id/reject',auth['isAuthenticated'](),controller[_0x95e4('0x15')]);router['delete'](_0x95e4('0xa'),auth[_0x95e4('0x9')](),controller[_0x95e4('0x16')]);module[_0x95e4('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index dc48899..d039e86 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 _0x1755=['STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out'];(function(_0x42c86a,_0x16b79a){var _0x10874b=function(_0x1db90a){while(--_0x1db90a){_0x42c86a['push'](_0x42c86a['shift']());}};_0x10874b(++_0x16b79a);}(_0x1755,0x11d));var _0x5175=function(_0x3e58ea,_0x4b89b9){_0x3e58ea=_0x3e58ea-0x0;var _0x5f0739=_0x1755[_0x3e58ea];return _0x5f0739;};'use strict';var Sequelize=require(_0x5175('0x0'));var _=require(_0x5175('0x1'));module[_0x5175('0x2')]={'body':{'type':Sequelize[_0x5175('0x3')](_0x5175('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5175('0x3')](_0x5175('0x5'))},'read':{'type':Sequelize[_0x5175('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5175('0x7')]('in',_0x5175('0x8')),'defaultValue':_0x5175('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5175('0x9')](0x1fe)},'from':{'type':Sequelize[_0x5175('0x9')]},'to':{'type':Sequelize[_0x5175('0x3')]('long')},'cc':{'type':Sequelize[_0x5175('0x3')](_0x5175('0x4'))},'bcc':{'type':Sequelize[_0x5175('0x3')](_0x5175('0x4'))},'subject':{'type':Sequelize[_0x5175('0x3')]},'sentAt':{'type':Sequelize[_0x5175('0xa')]},'attach':{'type':Sequelize[_0x5175('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5175('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x5175('0x3')](_0x5175('0x4'))},'originCc':{'type':Sequelize[_0x5175('0x3')]('long')},'originChannel':{'type':Sequelize[_0x5175('0x7')](_0x5175('0xc'),_0x5175('0xd')),'defaultValue':_0x5175('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x89e0=['ENUM','out','STRING','INTEGER','DATE','Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN'];(function(_0x105d73,_0x5d8e97){var _0x290653=function(_0x3d1dd8){while(--_0x3d1dd8){_0x105d73['push'](_0x105d73['shift']());}};_0x290653(++_0x5d8e97);}(_0x89e0,0x1cd));var _0x089e=function(_0x5706fb,_0xacfe3c){_0x5706fb=_0x5706fb-0x0;var _0x21799d=_0x89e0[_0x5706fb];return _0x21799d;};'use strict';var Sequelize=require(_0x089e('0x0'));var _=require(_0x089e('0x1'));module[_0x089e('0x2')]={'body':{'type':Sequelize[_0x089e('0x3')](_0x089e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x089e('0x3')](_0x089e('0x5'))},'read':{'type':Sequelize[_0x089e('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x089e('0x7')]('in','out'),'defaultValue':_0x089e('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x089e('0x9')](0x1fe)},'from':{'type':Sequelize[_0x089e('0x9')]},'to':{'type':Sequelize[_0x089e('0x3')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x089e('0x3')](_0x089e('0x4'))},'subject':{'type':Sequelize[_0x089e('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x089e('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x089e('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x089e('0xb')]},'originTo':{'type':Sequelize[_0x089e('0x3')](_0x089e('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x089e('0x4'))},'originChannel':{'type':Sequelize[_0x089e('0x7')](_0x089e('0xc'),'Chat'),'defaultValue':_0x089e('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 89ccba6..c6c6320 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 _0xed9e=['push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','rawAttributes','includeAll','find','update','body','params','describe','direction','secret','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','MailServerOut','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','create','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','UserId','agent','MailInteraction','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','contact','User','event','download','unix','toString','files','server','message-%s.eml','bcc','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync'];(function(_0x1c57a5,_0x433064){var _0x3dadb9=function(_0x5cf957){while(--_0x5cf957){_0x1c57a5['push'](_0x1c57a5['shift']());}};_0x3dadb9(++_0x433064);}(_0xed9e,0x138));var _0xeed9=function(_0x49d0e3,_0x359aed){_0x49d0e3=_0x49d0e3-0x0;var _0x26d388=_0xed9e[_0x49d0e3];return _0x26d388;};'use strict';var emlformat=require(_0xeed9('0x0'));var moment=require(_0xeed9('0x1'));var BPromise=require(_0xeed9('0x2'));var util=require('util');var path=require(_0xeed9('0x3'));var fs=require('fs');var _=require(_0xeed9('0x4'));var Redis=require(_0xeed9('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0xeed9('0x6'))(_0xeed9('0x7'));var interaction_log=require(_0xeed9('0x6'))(_0xeed9('0x8'));var config=require('../../config/environment');var db=require(_0xeed9('0x9'))['db'];config[_0xeed9('0xa')]=_[_0xeed9('0xb')](config[_0xeed9('0xa')],{'host':_0xeed9('0xc'),'port':0x18eb});var socket=require(_0xeed9('0xd'))(new Redis(config[_0xeed9('0xa')]));var htmlEntities=require(_0xeed9('0xe'));require(_0xeed9('0xf'))[_0xeed9('0x10')](socket);var jayson=require(_0xeed9('0x11'));var client=jayson[_0xeed9('0x12')]['http']({'port':0x232c});var client9003=jayson[_0xeed9('0x12')][_0xeed9('0x13')]({'port':0x232b});var client9002=jayson[_0xeed9('0x12')][_0xeed9('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x3d0883,_0x215b37,_0x1fd3c6,_0x1182d9){return new BPromise(function(_0x2aad6c,_0x3512ef){var _0x535f94=_0x1182d9||client;return _0x535f94[_0xeed9('0x14')](_0x3d0883,_0x1fd3c6)[_0xeed9('0x15')](function(_0x5e01fe){logger['info'](_0xeed9('0x16'),_0x215b37,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x215b37,_0xeed9('0x17'),JSON[_0xeed9('0x18')](_0x5e01fe));if(_0x5e01fe['error']){if(_0x5e01fe['error'][_0xeed9('0x19')]===0x1f4){logger[_0xeed9('0x1a')]('MailMessage,\x20%s,\x20%s',_0x215b37,_0x5e01fe[_0xeed9('0x1a')][_0xeed9('0x1b')]);return _0x3512ef(_0x5e01fe['error'][_0xeed9('0x1b')]);}logger[_0xeed9('0x1a')](_0xeed9('0x16'),_0x215b37,_0x5e01fe['error'][_0xeed9('0x1b')]);return _0x2aad6c(_0x5e01fe[_0xeed9('0x1a')][_0xeed9('0x1b')]);}else{logger[_0xeed9('0x1c')](_0xeed9('0x16'),_0x215b37,_0xeed9('0x17'));_0x2aad6c(_0x5e01fe[_0xeed9('0x1d')][_0xeed9('0x1b')]);}})[_0xeed9('0x1e')](function(_0x3ff6a2){logger[_0xeed9('0x1a')](_0xeed9('0x16'),_0x215b37,_0x3ff6a2);_0x3512ef(_0x3ff6a2);});});}function respondWithResult(_0x20c190,_0x40a2ae){_0x40a2ae=_0x40a2ae||0xc8;return function(_0x37bba4){if(_0x37bba4){return _0x20c190[_0xeed9('0x1f')](_0x40a2ae)[_0xeed9('0x20')](_0x37bba4);}};}function respondWithFilteredResult(_0xe582f0,_0x3db415){return function(_0x19e762){if(_0x19e762){var _0x2a58e9=typeof _0x3db415[_0xeed9('0x21')]===_0xeed9('0x22')&&typeof _0x3db415[_0xeed9('0x23')]==='undefined';var _0x34c65e=_0x19e762[_0xeed9('0x24')];var _0x246e17=_0x2a58e9?0x0:_0x3db415[_0xeed9('0x21')];var _0x29c58b=_0x2a58e9?_0x19e762[_0xeed9('0x24')]:_0x3db415[_0xeed9('0x21')]+_0x3db415[_0xeed9('0x23')];var _0x41ad8e;if(_0x29c58b>=_0x34c65e){_0x29c58b=_0x34c65e;_0x41ad8e=0xc8;}else{_0x41ad8e=0xce;}_0xe582f0[_0xeed9('0x1f')](_0x41ad8e);return _0xe582f0[_0xeed9('0x25')](_0xeed9('0x26'),_0x246e17+'-'+_0x29c58b+'/'+_0x34c65e)[_0xeed9('0x20')](_0x19e762);}return null;};}function saveUpdates(_0x53ebb0){return function(_0x5b2c19){if(_0x5b2c19){return _0x5b2c19['update'](_0x53ebb0)[_0xeed9('0x15')](function(_0x25d71f){return _0x25d71f;});}return null;};}function removeEntity(_0x448b69){return function(_0x463afc){if(_0x463afc){return _0x463afc[_0xeed9('0x27')]()['then'](function(){_0x448b69[_0xeed9('0x1f')](0xcc)[_0xeed9('0x28')]();});}};}function handleEntityNotFound(_0x3b1405){return function(_0x1f719f){if(!_0x1f719f){_0x3b1405[_0xeed9('0x29')](0x194);}return _0x1f719f;};}function handleError(_0x1ba2ac,_0x5d951a){_0x5d951a=_0x5d951a||0x1f4;return function(_0x548866){logger[_0xeed9('0x1a')](_0x548866[_0xeed9('0x2a')]);if(_0x548866['name']){delete _0x548866[_0xeed9('0x2b')];}_0x1ba2ac[_0xeed9('0x1f')](_0x5d951a)[_0xeed9('0x2c')](_0x548866);};}exports[_0xeed9('0x2d')]=function(_0x50f9e3,_0x1b2209){var _0x504a99={},_0x20c25a={},_0x2d9275={'count':0x0,'rows':[]};var _0x1f7944=_[_0xeed9('0x2e')](db[_0xeed9('0x2f')]['rawAttributes'],function(_0x16c87e){return{'name':_0x16c87e[_0xeed9('0x30')],'type':_0x16c87e[_0xeed9('0x31')]['key']};});_0x20c25a['model']=_[_0xeed9('0x2e')](_0x1f7944,_0xeed9('0x2b'));_0x20c25a[_0xeed9('0x32')]=_[_0xeed9('0x33')](_0x50f9e3['query']);_0x20c25a[_0xeed9('0x34')]=_['intersection'](_0x20c25a[_0xeed9('0x35')],_0x20c25a[_0xeed9('0x32')]);_0x504a99[_0xeed9('0x36')]=_[_0xeed9('0x37')](_0x20c25a[_0xeed9('0x35')],qs[_0xeed9('0x38')](_0x50f9e3[_0xeed9('0x32')][_0xeed9('0x38')]));_0x504a99[_0xeed9('0x36')]=_0x504a99[_0xeed9('0x36')][_0xeed9('0x39')]?_0x504a99[_0xeed9('0x36')]:_0x20c25a[_0xeed9('0x35')];if(!_0x50f9e3[_0xeed9('0x32')][_0xeed9('0x3a')](_0xeed9('0x3b'))){_0x504a99[_0xeed9('0x23')]=qs['limit'](_0x50f9e3[_0xeed9('0x32')][_0xeed9('0x23')]);_0x504a99[_0xeed9('0x21')]=qs[_0xeed9('0x21')](_0x50f9e3[_0xeed9('0x32')][_0xeed9('0x21')]);}_0x504a99[_0xeed9('0x3c')]=qs[_0xeed9('0x3d')](_0x50f9e3[_0xeed9('0x32')][_0xeed9('0x3d')]);_0x504a99[_0xeed9('0x3e')]=qs[_0xeed9('0x34')](_['pick'](_0x50f9e3[_0xeed9('0x32')],_0x20c25a[_0xeed9('0x34')]),_0x1f7944);if(_0x50f9e3[_0xeed9('0x32')]['filter']){_0x504a99[_0xeed9('0x3e')]=_[_0xeed9('0x3f')](_0x504a99[_0xeed9('0x3e')],{'$or':_[_0xeed9('0x2e')](_0x1f7944,function(_0x541f7b){if(_0x541f7b['type']!==_0xeed9('0x40')){var _0x135991={};_0x135991[_0x541f7b[_0xeed9('0x2b')]]={'$like':'%'+_0x50f9e3[_0xeed9('0x32')][_0xeed9('0x41')]+'%'};return _0x135991;}})});}_0x504a99=_['merge']({},_0x504a99,_0x50f9e3[_0xeed9('0x42')]);var _0x283e56={'where':_0x504a99['where']};return db[_0xeed9('0x2f')]['count'](_0x283e56)[_0xeed9('0x15')](function(_0x1edec0){_0x2d9275['count']=_0x1edec0;if(_0x50f9e3['query']['includeAll']){_0x504a99[_0xeed9('0x43')]=[{'all':!![]}];}return db[_0xeed9('0x2f')][_0xeed9('0x44')](_0x504a99);})['then'](function(_0x193c77){_0x2d9275[_0xeed9('0x45')]=_0x193c77;return _0x2d9275;})[_0xeed9('0x15')](respondWithFilteredResult(_0x1b2209,_0x504a99))[_0xeed9('0x1e')](handleError(_0x1b2209,null));};exports[_0xeed9('0x46')]=function(_0x564a36,_0x3e9798){var _0x3f9db4={'raw':!![],'where':{'id':_0x564a36['params']['id']}},_0x37bfd5={};_0x37bfd5[_0xeed9('0x35')]=_[_0xeed9('0x33')](db[_0xeed9('0x2f')][_0xeed9('0x47')]);_0x37bfd5[_0xeed9('0x32')]=_[_0xeed9('0x33')](_0x564a36[_0xeed9('0x32')]);_0x37bfd5[_0xeed9('0x34')]=_[_0xeed9('0x37')](_0x37bfd5[_0xeed9('0x35')],_0x37bfd5[_0xeed9('0x32')]);_0x3f9db4[_0xeed9('0x36')]=_[_0xeed9('0x37')](_0x37bfd5[_0xeed9('0x35')],qs[_0xeed9('0x38')](_0x564a36[_0xeed9('0x32')][_0xeed9('0x38')]));_0x3f9db4['attributes']=_0x3f9db4[_0xeed9('0x36')][_0xeed9('0x39')]?_0x3f9db4[_0xeed9('0x36')]:_0x37bfd5[_0xeed9('0x35')];if(_0x564a36['query'][_0xeed9('0x48')]){_0x3f9db4[_0xeed9('0x43')]=[{'all':!![]}];}_0x3f9db4=_['merge']({},_0x3f9db4,_0x564a36[_0xeed9('0x42')]);return db['MailMessage'][_0xeed9('0x49')](_0x3f9db4)[_0xeed9('0x15')](handleEntityNotFound(_0x3e9798,null))[_0xeed9('0x15')](respondWithResult(_0x3e9798,null))[_0xeed9('0x1e')](handleError(_0x3e9798,null));};exports[_0xeed9('0x4a')]=function(_0x569d6d,_0x351dc5){if(_0x569d6d[_0xeed9('0x4b')]['id']){delete _0x569d6d[_0xeed9('0x4b')]['id'];}return db[_0xeed9('0x2f')][_0xeed9('0x49')]({'where':{'id':_0x569d6d[_0xeed9('0x4c')]['id']}})[_0xeed9('0x15')](handleEntityNotFound(_0x351dc5,null))[_0xeed9('0x15')](saveUpdates(_0x569d6d['body'],null))[_0xeed9('0x15')](respondWithResult(_0x351dc5,null))[_0xeed9('0x1e')](handleError(_0x351dc5,null));};exports[_0xeed9('0x27')]=function(_0x36956e,_0x1faaed){return db['MailMessage'][_0xeed9('0x49')]({'where':{'id':_0x36956e[_0xeed9('0x4c')]['id']}})[_0xeed9('0x15')](handleEntityNotFound(_0x1faaed,null))['then'](removeEntity(_0x1faaed,null))[_0xeed9('0x1e')](handleError(_0x1faaed,null));};exports[_0xeed9('0x4d')]=function(_0x2bbbdc,_0x69e8c9){return db[_0xeed9('0x2f')][_0xeed9('0x4d')]()[_0xeed9('0x15')](respondWithResult(_0x69e8c9,null))['catch'](handleError(_0x69e8c9,null));};exports['create']=function(_0x43b388,_0x2c103a){return db[_0xeed9('0x2f')]['create'](_0x43b388['body'])[_0xeed9('0x15')](function(_0x595f78){if(_0x595f78){if(_0x595f78[_0xeed9('0x4e')]==='out'&&!_0x595f78[_0xeed9('0x4f')]){var _0x534f3f,_0xdf5f95,_0x34a1c0;if(_0x43b388['body']['to']){_0xdf5f95=_0x43b388[_0xeed9('0x4b')]['to']['split'](',')[0x0];}return db[_0xeed9('0x50')][_0xeed9('0x51')]({'where':{'id':_0x595f78[_0xeed9('0x52')]},'include':[{'model':db[_0xeed9('0x53')],'as':'List','include':[{'model':db[_0xeed9('0x54')],'as':_0xeed9('0x55'),'where':{'email':_0xdf5f95},'limit':0x1,'order':[[_0xeed9('0x56'),'DESC']]}]},{'model':db[_0xeed9('0x57')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xeed9('0x58')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x27e1e4){_0x534f3f=_0x27e1e4;if(!_0x534f3f||!_0x534f3f['Smtp'])return;var _0x34bb06=_0x534f3f[_0xeed9('0x59')]();if(_0x43b388[_0xeed9('0x4b')][_0xeed9('0x5a')]&&_0x43b388[_0xeed9('0x4b')]['attachments'][_0xeed9('0x39')]){for(var _0x2f9460=0x0;_0x2f9460<_0x43b388[_0xeed9('0x4b')][_0xeed9('0x5a')][_0xeed9('0x39')];_0x2f9460+=0x1){_0x43b388[_0xeed9('0x4b')]['attachments'][_0x2f9460]={'filename':_0x43b388['body'][_0xeed9('0x5a')][_0x2f9460][_0xeed9('0x2b')],'path':path[_0xeed9('0x5b')](config[_0xeed9('0x5c')],_0xeed9('0x5d'),_0x43b388[_0xeed9('0x4b')][_0xeed9('0x5a')][_0x2f9460][_0xeed9('0x5e')])};}}_0x34a1c0={'account':_0x34bb06,'message':_0x43b388['body']};return;})[_0xeed9('0x15')](function(){if(_0x534f3f['List']){if(_0x534f3f[_0xeed9('0x5f')][_0xeed9('0x55')]['length']){return _0x534f3f[_0xeed9('0x5f')]['Contacts'][0x0];}else{return db[_0xeed9('0x54')][_0xeed9('0x60')](_[_0xeed9('0xb')](_0x43b388[_0xeed9('0x4b')],{'firstName':_0x43b388[_0xeed9('0x4b')]['to'],'email':_0x43b388[_0xeed9('0x4b')]['to'],'phone':_0x43b388[_0xeed9('0x4b')]['to'],'ListId':_0x534f3f[_0xeed9('0x61')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x34a1c0){return respondWithRpcPromise(_0xeed9('0x62'),_0xeed9('0x63'),_0x34a1c0,client9003)['then'](function(_0x894965){return _0x595f78[_0xeed9('0x4a')]({'read':!![],'messageId':_0x894965['messageId'],'sentAt':moment()[_0xeed9('0x64')](_0xeed9('0x65'))});})['catch'](function(_0x5670fd){logger[_0xeed9('0x1a')]('%s',JSON[_0xeed9('0x18')](_0x5670fd));return _0x595f78;});}return _0x595f78;});}return _0x595f78;}})[_0xeed9('0x15')](respondWithResult(_0x2c103a,0xc9))[_0xeed9('0x1e')](handleError(_0x2c103a,null));};exports[_0xeed9('0x66')]=function(_0xd13944,_0x2e15d2){var _0x48244f={'agent':{},'channel':_0xeed9('0x67')};if(_0xd13944['body']['id']){delete _0xd13944[_0xeed9('0x4b')]['id'];}_0xd13944[_0xeed9('0x4b')]['read']=!![];_0xd13944[_0xeed9('0x4b')]['readAt']=moment()['format'](_0xeed9('0x65'));_0xd13944[_0xeed9('0x4b')][_0xeed9('0x68')]=_0xd13944['body']['UserId']||_0xd13944['user']['id'];_0x48244f[_0xeed9('0x69')]['id']=_0xd13944[_0xeed9('0x4b')]['UserId'];return db[_0xeed9('0x2f')][_0xeed9('0x49')]({'where':{'id':_0xd13944[_0xeed9('0x4c')]['id'],'UserId':null}})[_0xeed9('0x15')](handleEntityNotFound(_0x2e15d2,null))[_0xeed9('0x15')](saveUpdates(_0xd13944[_0xeed9('0x4b')],null))[_0xeed9('0x15')](function(_0x2d7f1a){if(_0x2d7f1a){_0x48244f[_0xeed9('0x1b')]=_0x2d7f1a['get']({'plain':!![]});return db[_0xeed9('0x6a')][_0xeed9('0x49')]({'where':{'id':_0x2d7f1a['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2e15d2,null))[_0xeed9('0x15')](function(_0x52010f){if(_0x52010f){return _0x52010f[_0xeed9('0x4a')]({'UserId':_0xd13944[_0xeed9('0x4b')][_0xeed9('0x68')],'read1stAt':_[_0xeed9('0x6b')](_0x52010f['read1stAt'])?moment()[_0xeed9('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xeed9('0x15')](function(_0x119dd0){if(_0x119dd0){_0x48244f[_0xeed9('0x6c')]=_0x119dd0['get']({'plain':!![]});interaction_log['info'](_0xeed9('0x6d'),_0xd13944[_0xeed9('0x6e')]['id'],_0xd13944[_0xeed9('0x6e')]['name'],_0xd13944[_0xeed9('0x6e')][_0xeed9('0x6f')],_0x48244f['interaction']['id'],_0xd13944[_0xeed9('0x4b')]?JSON['stringify'](_0xd13944[_0xeed9('0x4b')]):_0xeed9('0x70'));return respondWithRpcPromise('AcceptMessage',_0xeed9('0x71'),_0x48244f);}return null;})[_0xeed9('0x15')](function(_0x41594e){var _0x1c4725='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x41594e[_0xeed9('0x1b')][_0xeed9('0x72')];return db[_0xeed9('0x73')][_0xeed9('0x32')](_0x1c4725,{'type':db[_0xeed9('0x74')][_0xeed9('0x75')]['SELECT'],'raw':!![]})[_0xeed9('0x15')](function(_0x1c0f59){return _0x1c0f59;});})[_0xeed9('0x15')](function(_0x35d600){if(_0x35d600){_0x48244f[_0xeed9('0x1b')]['contact']=_0x35d600[0x0];if(!_0xd13944[_0xeed9('0x4b')][_0xeed9('0x68')])return;return db['User']['find']({'where':{'id':_0xd13944[_0xeed9('0x4b')]['UserId'],'role':_0xeed9('0x69')},'attributes':['id','name',_0xeed9('0x76'),_0xeed9('0x77'),'internal'],'raw':!![]});}return null;})[_0xeed9('0x15')](function(_0x5c7d36){if(!_0x5c7d36)return null;_0x48244f[_0xeed9('0x1b')][_0xeed9('0x69')]=_0x5c7d36;return _0x48244f;})['then'](function(_0xb7f771){if(_0xb7f771){if(_0xd13944[_0xeed9('0x4b')][_0xeed9('0x78')]){_0x48244f[_0xeed9('0x1b')][_0xeed9('0x79')]=util['format'](_0xeed9('0x7a'),_0xd13944[_0xeed9('0x6e')][_0xeed9('0x2b')]);_0x48244f['message'][_0xeed9('0x7b')]=_0x48244f[_0xeed9('0x7b')];_0x48244f['message'][_0xeed9('0x7c')]=_0x48244f[_0xeed9('0x7b')];_0x48244f[_0xeed9('0x1b')]['event']=_0xeed9('0x66');_0x48244f[_0xeed9('0x1b')][_0xeed9('0x4b')]=htmlToText['fromString'](_0x48244f[_0xeed9('0x1b')]['body']);return respondWithRpcPromise(_0xeed9('0x7d'),_0xeed9('0x7d'),{'event':'acceptmessage','message':_0x48244f[_0xeed9('0x1b')]},client9002)[_0xeed9('0x15')](function(){return _0x48244f;});}return _0x48244f;}return null;})['then'](respondWithResult(_0x2e15d2,null))[_0xeed9('0x1e')](handleError(_0x2e15d2,null));};exports[_0xeed9('0x7e')]=function(_0x12ac9e,_0x4bc6ce){var _0x56b424={'agent':{},'channel':'mail'};if(_0x12ac9e[_0xeed9('0x4b')]['id']){delete _0x12ac9e['body']['id'];}_0x12ac9e[_0xeed9('0x4b')][_0xeed9('0x68')]=_0x12ac9e[_0xeed9('0x4b')][_0xeed9('0x68')]||_0x12ac9e[_0xeed9('0x6e')]['id'];_0x56b424[_0xeed9('0x69')]['id']=_0x12ac9e[_0xeed9('0x4b')]['UserId'];return db[_0xeed9('0x2f')][_0xeed9('0x49')]({'where':{'id':_0x12ac9e[_0xeed9('0x4c')]['id'],'UserId':null}})[_0xeed9('0x15')](handleEntityNotFound(_0x4bc6ce,null))[_0xeed9('0x15')](function(_0x6c8fd5){if(_0x6c8fd5){_0x56b424['message']=_0x6c8fd5['get']({'plain':!![]});return db[_0xeed9('0x6a')][_0xeed9('0x49')]({'where':{'id':_0x6c8fd5[_0xeed9('0x7f')]}});}return null;})[_0xeed9('0x15')](handleEntityNotFound(_0x4bc6ce,null))[_0xeed9('0x15')](function(_0xd6d81a){if(_0xd6d81a){_0x56b424[_0xeed9('0x6c')]=_0xd6d81a['get']({'plain':!![]});interaction_log[_0xeed9('0x1c')](_0xeed9('0x80'),_0x12ac9e[_0xeed9('0x6e')]['id'],_0x12ac9e['user']['name'],_0x12ac9e[_0xeed9('0x6e')]['role'],_0x56b424[_0xeed9('0x6c')]['id'],_0x12ac9e[_0xeed9('0x4b')]?JSON[_0xeed9('0x18')](_0x12ac9e[_0xeed9('0x4b')]):_0xeed9('0x70'));return respondWithRpcPromise(_0xeed9('0x81'),_0xeed9('0x82'),_0x56b424);}return null;})[_0xeed9('0x15')](function(_0x172576){var _0x2b38b2=_0xeed9('0x83')+_0x172576[_0xeed9('0x1b')][_0xeed9('0x72')];return db['sequelize'][_0xeed9('0x32')](_0x2b38b2,{'type':db[_0xeed9('0x74')][_0xeed9('0x75')][_0xeed9('0x84')],'raw':!![]})[_0xeed9('0x15')](function(_0x7e3a33){return _0x7e3a33;});})[_0xeed9('0x15')](function(_0x29803d){if(_0x29803d){_0x56b424[_0xeed9('0x1b')][_0xeed9('0x85')]=_0x29803d[0x0];if(!_0x12ac9e[_0xeed9('0x4b')][_0xeed9('0x68')])return;return db[_0xeed9('0x86')]['find']({'where':{'id':_0x12ac9e[_0xeed9('0x4b')]['UserId'],'role':_0xeed9('0x69')},'attributes':['id',_0xeed9('0x2b'),'fullname',_0xeed9('0x77'),'internal'],'raw':!![]});}return null;})[_0xeed9('0x15')](function(_0x29014d){if(!_0x29014d)return null;_0x56b424[_0xeed9('0x1b')][_0xeed9('0x69')]=_0x29014d;return _0x56b424;})[_0xeed9('0x15')](function(_0x545837){if(_0x545837){_0x545837[_0xeed9('0x1b')][_0xeed9('0x79')]=util[_0xeed9('0x64')]('SIP/%s',_0x12ac9e[_0xeed9('0x6e')][_0xeed9('0x2b')]);_0x545837[_0xeed9('0x1b')][_0xeed9('0x7b')]=_0x56b424[_0xeed9('0x7b')];_0x545837[_0xeed9('0x1b')]['motionChannel']=_0x56b424[_0xeed9('0x7b')];_0x545837['message'][_0xeed9('0x87')]=_0xeed9('0x7e');_0x545837[_0xeed9('0x1b')][_0xeed9('0x4b')]=htmlToText['fromString'](_0x56b424['message']['body']);respondWithRpcPromise(_0xeed9('0x7d'),_0xeed9('0x7d'),{'event':'rejectmessage','message':_0x545837[_0xeed9('0x1b')]},client9002);return _0x56b424;}return null;})[_0xeed9('0x15')](respondWithResult(_0x4bc6ce,null))['catch'](handleError(_0x4bc6ce,null));};exports[_0xeed9('0x88')]=function(_0x45966e,_0x40957c){var _0x405b78=moment()[_0xeed9('0x89')]()[_0xeed9('0x8a')]();var _0x4530c0=path[_0xeed9('0x5b')](config[_0xeed9('0x5c')],'server',_0xeed9('0x8b'),'tmp');var _0x2b5ba2=path['join'](config[_0xeed9('0x5c')],_0xeed9('0x8c'),_0xeed9('0x8b'),_0xeed9('0x5a'));var _0x8df298=util[_0xeed9('0x64')](_0xeed9('0x8d'),_0x405b78);return db[_0xeed9('0x2f')]['find']({'where':{'id':_0x45966e[_0xeed9('0x4c')]['id']},'attributes':['id',_0xeed9('0x4b'),'from','to','cc',_0xeed9('0x8e'),'subject',_0xeed9('0x8f')],'include':_0x45966e[_0xeed9('0x32')][_0xeed9('0x5a')]?[{'model':db[_0xeed9('0x90')],'as':_0xeed9('0x91')}]:undefined})[_0xeed9('0x15')](handleEntityNotFound(_0x40957c,null))[_0xeed9('0x15')](function(_0x1c7a7f){if(_0x1c7a7f){var _0x229d18=_0x1c7a7f;var _0x2c64be={'from':_0x229d18['from'],'to':_0x229d18['to'],'subject':_0x229d18[_0xeed9('0x92')],'html':htmlEntities['decode'](_0x229d18[_0xeed9('0x4b')]),'headers':{'Date':moment(_0x229d18[_0xeed9('0x8f')])[_0xeed9('0x64')](_0xeed9('0x93'))},'attachments':[]};if(_0x1c7a7f['cc']){_0x2c64be['headers']['Cc']=_0x1c7a7f['cc'];}if(_0x1c7a7f[_0xeed9('0x8e')]){_0x2c64be['headers'][_0xeed9('0x94')]=_0x1c7a7f[_0xeed9('0x8e')];}return new BPromise(function(_0x3262d5,_0x14d21a){if(_0x1c7a7f[_0xeed9('0x91')]){for(var _0x48c61b=0x0;_0x48c61b<_0x1c7a7f[_0xeed9('0x91')][_0xeed9('0x39')];_0x48c61b++){var _0x18fef7=_0x1c7a7f[_0xeed9('0x91')][_0x48c61b];var _0x251eba=path['join'](_0x2b5ba2,_0x18fef7[_0xeed9('0x5e')]);if(fs[_0xeed9('0x95')](_0x251eba)){_0x2c64be[_0xeed9('0x5a')][_0xeed9('0x96')]({'name':_0x18fef7['name'],'contentType':_0x18fef7[_0xeed9('0x31')],'data':fs['readFileSync'](_0x251eba)});}}}emlformat[_0xeed9('0x97')](_0x2c64be,function(_0x2bae8a,_0x4e562e){if(_0x2bae8a)return _0x14d21a(_0x2bae8a);fs[_0xeed9('0x98')](path['join'](_0x4530c0,_0x8df298),_0x4e562e);return _0x3262d5(_0x4e562e);});});}})[_0xeed9('0x15')](function(_0x160c71){if(_0x160c71){return _0x40957c[_0xeed9('0x88')](path[_0xeed9('0x5b')](_0x4530c0,_0x8df298),_0x8df298,function(_0x733700){if(!_0x733700)fs[_0xeed9('0x99')](path[_0xeed9('0x5b')](_0x4530c0,_0x8df298));});}})[_0xeed9('0x1e')](handleError(_0x40957c,null));}; \ No newline at end of file +var _0x354b=['Sequelize','internal','reject','rejectmessage','download','server','tmp','message-%s.eml','bcc','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','readFileSync','writeFileSync','join','unlinkSync','eml-format','moment','path','lodash','../../components/parsers/qs','../../config/logger','api','mail-interactions','defaults','localhost','socket.io-emitter','redis','html-entities','./mailMessage.socket','client','http','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','sendStatus','send','index','map','MailMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','where','name','options','includeAll','include','rows','show','fields','find','update','body','params','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','user','agent','UserId','get','MailInteractionId','isNil','info','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','MailInteraction','interaction','rejectMessage'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x354b,0x149));var _0xb354=function(_0x3394b4,_0x4d8898){_0x3394b4=_0x3394b4-0x0;var _0x2acad2=_0x354b[_0x3394b4];return _0x2acad2;};'use strict';var emlformat=require(_0xb354('0x0'));var moment=require(_0xb354('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xb354('0x2'));var fs=require('fs');var _=require(_0xb354('0x3'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0xb354('0x4'));var logger=require(_0xb354('0x5'))(_0xb354('0x6'));var interaction_log=require(_0xb354('0x5'))(_0xb354('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xb354('0x8')](config['redis'],{'host':_0xb354('0x9'),'port':0x18eb});var socket=require(_0xb354('0xa'))(new Redis(config[_0xb354('0xb')]));var htmlEntities=require(_0xb354('0xc'));require(_0xb354('0xd'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xb354('0xe')][_0xb354('0xf')]({'port':0x232c});var client9003=jayson[_0xb354('0xe')][_0xb354('0xf')]({'port':0x232b});var client9002=jayson[_0xb354('0xe')][_0xb354('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x15fd00,_0xd0deeb,_0x4e56a8,_0x4ee4ea){return new BPromise(function(_0xd089e8,_0x5a45db){var _0x5d66b8=_0x4ee4ea||client;return _0x5d66b8[_0xb354('0x10')](_0x15fd00,_0x4e56a8)['then'](function(_0x220205){logger['info'](_0xb354('0x11'),_0xd0deeb,_0xb354('0x12'));logger[_0xb354('0x13')](_0xb354('0x14'),_0xd0deeb,_0xb354('0x12'),JSON['stringify'](_0x220205));if(_0x220205[_0xb354('0x15')]){if(_0x220205[_0xb354('0x15')][_0xb354('0x16')]===0x1f4){logger[_0xb354('0x15')](_0xb354('0x11'),_0xd0deeb,_0x220205[_0xb354('0x15')][_0xb354('0x17')]);return _0x5a45db(_0x220205[_0xb354('0x15')][_0xb354('0x17')]);}logger[_0xb354('0x15')](_0xb354('0x11'),_0xd0deeb,_0x220205[_0xb354('0x15')][_0xb354('0x17')]);return _0xd089e8(_0x220205['error']['message']);}else{logger['info'](_0xb354('0x11'),_0xd0deeb,_0xb354('0x12'));_0xd089e8(_0x220205[_0xb354('0x18')][_0xb354('0x17')]);}})[_0xb354('0x19')](function(_0x17a8c3){logger[_0xb354('0x15')](_0xb354('0x11'),_0xd0deeb,_0x17a8c3);_0x5a45db(_0x17a8c3);});});}function respondWithResult(_0x196439,_0x597d00){_0x597d00=_0x597d00||0xc8;return function(_0x1dd470){if(_0x1dd470){return _0x196439[_0xb354('0x1a')](_0x597d00)[_0xb354('0x1b')](_0x1dd470);}};}function respondWithFilteredResult(_0x266c76,_0xbc64e8){return function(_0x2b758c){if(_0x2b758c){var _0x1e1c53=typeof _0xbc64e8[_0xb354('0x1c')]==='undefined'&&typeof _0xbc64e8[_0xb354('0x1d')]===_0xb354('0x1e');var _0x5603c8=_0x2b758c[_0xb354('0x1f')];var _0xe5a0fe=_0x1e1c53?0x0:_0xbc64e8['offset'];var _0x3d017c=_0x1e1c53?_0x2b758c[_0xb354('0x1f')]:_0xbc64e8[_0xb354('0x1c')]+_0xbc64e8[_0xb354('0x1d')];var _0x24b311;if(_0x3d017c>=_0x5603c8){_0x3d017c=_0x5603c8;_0x24b311=0xc8;}else{_0x24b311=0xce;}_0x266c76[_0xb354('0x1a')](_0x24b311);return _0x266c76[_0xb354('0x20')](_0xb354('0x21'),_0xe5a0fe+'-'+_0x3d017c+'/'+_0x5603c8)[_0xb354('0x1b')](_0x2b758c);}return null;};}function saveUpdates(_0x207e3a){return function(_0x1081c0){if(_0x1081c0){return _0x1081c0['update'](_0x207e3a)[_0xb354('0x22')](function(_0x32f0a3){return _0x32f0a3;});}return null;};}function removeEntity(_0xdb4859){return function(_0x2d221d){if(_0x2d221d){return _0x2d221d[_0xb354('0x23')]()[_0xb354('0x22')](function(){_0xdb4859['status'](0xcc)[_0xb354('0x24')]();});}};}function handleEntityNotFound(_0x450243){return function(_0x5173b0){if(!_0x5173b0){_0x450243[_0xb354('0x25')](0x194);}return _0x5173b0;};}function handleError(_0xc1e573,_0x37618d){_0x37618d=_0x37618d||0x1f4;return function(_0x209fc8){logger['error'](_0x209fc8['stack']);if(_0x209fc8['name']){delete _0x209fc8['name'];}_0xc1e573[_0xb354('0x1a')](_0x37618d)[_0xb354('0x26')](_0x209fc8);};}exports[_0xb354('0x27')]=function(_0x43f616,_0xbae165){var _0x3fa1f4={},_0x473fc4={},_0x15b65c={'count':0x0,'rows':[]};var _0x3b0f17=_[_0xb354('0x28')](db[_0xb354('0x29')][_0xb354('0x2a')],function(_0x3cc51a){return{'name':_0x3cc51a['fieldName'],'type':_0x3cc51a[_0xb354('0x2b')][_0xb354('0x2c')]};});_0x473fc4[_0xb354('0x2d')]=_[_0xb354('0x28')](_0x3b0f17,'name');_0x473fc4[_0xb354('0x2e')]=_[_0xb354('0x2f')](_0x43f616['query']);_0x473fc4[_0xb354('0x30')]=_[_0xb354('0x31')](_0x473fc4[_0xb354('0x2d')],_0x473fc4['query']);_0x3fa1f4[_0xb354('0x32')]=_[_0xb354('0x31')](_0x473fc4[_0xb354('0x2d')],qs['fields'](_0x43f616[_0xb354('0x2e')]['fields']));_0x3fa1f4['attributes']=_0x3fa1f4[_0xb354('0x32')][_0xb354('0x33')]?_0x3fa1f4[_0xb354('0x32')]:_0x473fc4['model'];if(!_0x43f616[_0xb354('0x2e')][_0xb354('0x34')](_0xb354('0x35'))){_0x3fa1f4[_0xb354('0x1d')]=qs[_0xb354('0x1d')](_0x43f616[_0xb354('0x2e')][_0xb354('0x1d')]);_0x3fa1f4[_0xb354('0x1c')]=qs[_0xb354('0x1c')](_0x43f616[_0xb354('0x2e')][_0xb354('0x1c')]);}_0x3fa1f4['order']=qs[_0xb354('0x36')](_0x43f616[_0xb354('0x2e')][_0xb354('0x36')]);_0x3fa1f4['where']=qs[_0xb354('0x30')](_['pick'](_0x43f616['query'],_0x473fc4[_0xb354('0x30')]),_0x3b0f17);if(_0x43f616[_0xb354('0x2e')][_0xb354('0x37')]){_0x3fa1f4['where']=_[_0xb354('0x38')](_0x3fa1f4[_0xb354('0x39')],{'$or':_[_0xb354('0x28')](_0x3b0f17,function(_0x1246d2){if(_0x1246d2[_0xb354('0x2b')]!=='VIRTUAL'){var _0x20eee9={};_0x20eee9[_0x1246d2[_0xb354('0x3a')]]={'$like':'%'+_0x43f616[_0xb354('0x2e')]['filter']+'%'};return _0x20eee9;}})});}_0x3fa1f4=_[_0xb354('0x38')]({},_0x3fa1f4,_0x43f616[_0xb354('0x3b')]);var _0x536ead={'where':_0x3fa1f4[_0xb354('0x39')]};return db['MailMessage']['count'](_0x536ead)[_0xb354('0x22')](function(_0x465971){_0x15b65c[_0xb354('0x1f')]=_0x465971;if(_0x43f616[_0xb354('0x2e')][_0xb354('0x3c')]){_0x3fa1f4[_0xb354('0x3d')]=[{'all':!![]}];}return db[_0xb354('0x29')]['findAll'](_0x3fa1f4);})[_0xb354('0x22')](function(_0xb9ab3e){_0x15b65c[_0xb354('0x3e')]=_0xb9ab3e;return _0x15b65c;})[_0xb354('0x22')](respondWithFilteredResult(_0xbae165,_0x3fa1f4))[_0xb354('0x19')](handleError(_0xbae165,null));};exports[_0xb354('0x3f')]=function(_0x3f6313,_0x578895){var _0x1605e3={'raw':!![],'where':{'id':_0x3f6313['params']['id']}},_0x1ee043={};_0x1ee043[_0xb354('0x2d')]=_[_0xb354('0x2f')](db[_0xb354('0x29')][_0xb354('0x2a')]);_0x1ee043[_0xb354('0x2e')]=_['keys'](_0x3f6313[_0xb354('0x2e')]);_0x1ee043[_0xb354('0x30')]=_[_0xb354('0x31')](_0x1ee043[_0xb354('0x2d')],_0x1ee043[_0xb354('0x2e')]);_0x1605e3[_0xb354('0x32')]=_['intersection'](_0x1ee043[_0xb354('0x2d')],qs[_0xb354('0x40')](_0x3f6313[_0xb354('0x2e')]['fields']));_0x1605e3['attributes']=_0x1605e3[_0xb354('0x32')][_0xb354('0x33')]?_0x1605e3[_0xb354('0x32')]:_0x1ee043[_0xb354('0x2d')];if(_0x3f6313['query'][_0xb354('0x3c')]){_0x1605e3['include']=[{'all':!![]}];}_0x1605e3=_[_0xb354('0x38')]({},_0x1605e3,_0x3f6313[_0xb354('0x3b')]);return db[_0xb354('0x29')][_0xb354('0x41')](_0x1605e3)[_0xb354('0x22')](handleEntityNotFound(_0x578895,null))[_0xb354('0x22')](respondWithResult(_0x578895,null))['catch'](handleError(_0x578895,null));};exports[_0xb354('0x42')]=function(_0x30caea,_0x370f6c){if(_0x30caea[_0xb354('0x43')]['id']){delete _0x30caea[_0xb354('0x43')]['id'];}return db[_0xb354('0x29')]['find']({'where':{'id':_0x30caea['params']['id']}})['then'](handleEntityNotFound(_0x370f6c,null))[_0xb354('0x22')](saveUpdates(_0x30caea[_0xb354('0x43')],null))[_0xb354('0x22')](respondWithResult(_0x370f6c,null))['catch'](handleError(_0x370f6c,null));};exports[_0xb354('0x23')]=function(_0x2b8f48,_0x44e388){return db[_0xb354('0x29')][_0xb354('0x41')]({'where':{'id':_0x2b8f48[_0xb354('0x44')]['id']}})[_0xb354('0x22')](handleEntityNotFound(_0x44e388,null))['then'](removeEntity(_0x44e388,null))['catch'](handleError(_0x44e388,null));};exports[_0xb354('0x45')]=function(_0x5015c4,_0x1d43a5){return db[_0xb354('0x29')][_0xb354('0x45')]()['then'](respondWithResult(_0x1d43a5,null))[_0xb354('0x19')](handleError(_0x1d43a5,null));};exports[_0xb354('0x46')]=function(_0x4611b6,_0x275f9a){return db[_0xb354('0x29')][_0xb354('0x46')](_0x4611b6[_0xb354('0x43')])['then'](function(_0x408561){if(_0x408561){if(_0x408561[_0xb354('0x47')]===_0xb354('0x48')&&!_0x408561[_0xb354('0x49')]){var _0x3240b7,_0x1dd792,_0x586c58;if(_0x4611b6[_0xb354('0x43')]['to']){_0x1dd792=_0x4611b6[_0xb354('0x43')]['to'][_0xb354('0x4a')](',')[0x0];}return db[_0xb354('0x4b')]['findOne']({'where':{'id':_0x408561[_0xb354('0x4c')]},'include':[{'model':db[_0xb354('0x4d')],'as':_0xb354('0x4e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x1dd792},'limit':0x1,'order':[[_0xb354('0x4f'),_0xb354('0x50')]]}]},{'model':db[_0xb354('0x51')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xb354('0x52')],'as':_0xb354('0x52'),'raw':!![]}]}]})['then'](function(_0x18db9e){_0x3240b7=_0x18db9e;if(!_0x3240b7||!_0x3240b7[_0xb354('0x53')])return;var _0x538e8c=_0x3240b7[_0xb354('0x54')]();if(_0x4611b6[_0xb354('0x43')][_0xb354('0x55')]&&_0x4611b6[_0xb354('0x43')][_0xb354('0x55')][_0xb354('0x33')]){for(var _0x525324=0x0;_0x525324<_0x4611b6[_0xb354('0x43')][_0xb354('0x55')][_0xb354('0x33')];_0x525324+=0x1){_0x4611b6[_0xb354('0x43')][_0xb354('0x55')][_0x525324]={'filename':_0x4611b6[_0xb354('0x43')][_0xb354('0x55')][_0x525324][_0xb354('0x3a')],'path':path['join'](config[_0xb354('0x56')],_0xb354('0x57'),_0x4611b6[_0xb354('0x43')][_0xb354('0x55')][_0x525324][_0xb354('0x58')])};}}_0x586c58={'account':_0x538e8c,'message':_0x4611b6[_0xb354('0x43')]};return;})[_0xb354('0x22')](function(){if(_0x3240b7['List']){if(_0x3240b7['List'][_0xb354('0x59')][_0xb354('0x33')]){return _0x3240b7['List'][_0xb354('0x59')][0x0];}else{return db['CmContact']['create'](_[_0xb354('0x8')](_0x4611b6[_0xb354('0x43')],{'firstName':_0x4611b6[_0xb354('0x43')]['to'],'email':_0x4611b6[_0xb354('0x43')]['to'],'phone':_0x4611b6['body']['to'],'ListId':_0x3240b7[_0xb354('0x5a')]}));}}else{throw new Error(_0xb354('0x5b'));}})[_0xb354('0x22')](function(){if(_0x586c58){return respondWithRpcPromise(_0xb354('0x5c'),_0xb354('0x5d'),_0x586c58,client9003)[_0xb354('0x22')](function(_0x9abacc){return _0x408561[_0xb354('0x42')]({'read':!![],'messageId':_0x9abacc[_0xb354('0x5e')],'sentAt':moment()[_0xb354('0x5f')](_0xb354('0x60'))});})[_0xb354('0x19')](function(_0x583ba5){logger['error']('%s',JSON[_0xb354('0x61')](_0x583ba5));return _0x408561;});}return _0x408561;});}return _0x408561;}})[_0xb354('0x22')](respondWithResult(_0x275f9a,0xc9))[_0xb354('0x19')](handleError(_0x275f9a,null));};exports[_0xb354('0x62')]=function(_0x54514a,_0x22ce24){var _0xfb9a37={'agent':{},'channel':_0xb354('0x63')};if(_0x54514a[_0xb354('0x43')]['id']){delete _0x54514a['body']['id'];}_0x54514a[_0xb354('0x43')][_0xb354('0x64')]=!![];_0x54514a[_0xb354('0x43')][_0xb354('0x65')]=moment()[_0xb354('0x5f')](_0xb354('0x60'));_0x54514a[_0xb354('0x43')]['UserId']=_0x54514a[_0xb354('0x43')]['UserId']||_0x54514a[_0xb354('0x66')]['id'];_0xfb9a37[_0xb354('0x67')]['id']=_0x54514a[_0xb354('0x43')][_0xb354('0x68')];return db['MailMessage']['find']({'where':{'id':_0x54514a[_0xb354('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22ce24,null))['then'](saveUpdates(_0x54514a[_0xb354('0x43')],null))[_0xb354('0x22')](function(_0x24f4b3){if(_0x24f4b3){_0xfb9a37['message']=_0x24f4b3[_0xb354('0x69')]({'plain':!![]});return db['MailInteraction'][_0xb354('0x41')]({'where':{'id':_0x24f4b3[_0xb354('0x6a')]}});}return null;})[_0xb354('0x22')](handleEntityNotFound(_0x22ce24,null))[_0xb354('0x22')](function(_0x7882d8){if(_0x7882d8){return _0x7882d8[_0xb354('0x42')]({'UserId':_0x54514a[_0xb354('0x43')]['UserId'],'read1stAt':_[_0xb354('0x6b')](_0x7882d8['read1stAt'])?moment()['format'](_0xb354('0x60')):undefined});}return null;})[_0xb354('0x22')](function(_0x2460a1){if(_0x2460a1){_0xfb9a37['interaction']=_0x2460a1[_0xb354('0x69')]({'plain':!![]});interaction_log[_0xb354('0x6c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54514a[_0xb354('0x66')]['id'],_0x54514a[_0xb354('0x66')][_0xb354('0x3a')],_0x54514a[_0xb354('0x66')][_0xb354('0x6d')],_0xfb9a37['interaction']['id'],_0x54514a['body']?JSON[_0xb354('0x61')](_0x54514a['body']):_0xb354('0x6e'));return respondWithRpcPromise(_0xb354('0x6f'),_0xb354('0x70'),_0xfb9a37);}return null;})['then'](function(_0x3d07b7){var _0xa45f53=_0xb354('0x71')+_0x3d07b7[_0xb354('0x17')][_0xb354('0x72')];return db[_0xb354('0x73')][_0xb354('0x2e')](_0xa45f53,{'type':db['Sequelize'][_0xb354('0x74')][_0xb354('0x75')],'raw':!![]})['then'](function(_0x320a3e){return _0x320a3e;});})[_0xb354('0x22')](function(_0x57cdc7){if(_0x57cdc7){_0xfb9a37['message'][_0xb354('0x76')]=_0x57cdc7[0x0];if(!_0x54514a[_0xb354('0x43')][_0xb354('0x68')])return;return db[_0xb354('0x77')][_0xb354('0x41')]({'where':{'id':_0x54514a[_0xb354('0x43')][_0xb354('0x68')],'role':_0xb354('0x67')},'attributes':['id',_0xb354('0x3a'),_0xb354('0x78'),_0xb354('0x79'),'internal'],'raw':!![]});}return null;})[_0xb354('0x22')](function(_0x2f40b6){if(!_0x2f40b6)return null;_0xfb9a37[_0xb354('0x17')][_0xb354('0x67')]=_0x2f40b6;return _0xfb9a37;})[_0xb354('0x22')](function(_0x484641){if(_0x484641){if(_0x54514a[_0xb354('0x43')][_0xb354('0x7a')]){_0xfb9a37[_0xb354('0x17')][_0xb354('0x7b')]=util[_0xb354('0x5f')](_0xb354('0x7c'),_0x54514a[_0xb354('0x66')][_0xb354('0x3a')]);_0xfb9a37[_0xb354('0x17')][_0xb354('0x7d')]=_0xfb9a37['channel'];_0xfb9a37[_0xb354('0x17')][_0xb354('0x7e')]=_0xfb9a37['channel'];_0xfb9a37[_0xb354('0x17')][_0xb354('0x7f')]=_0xb354('0x62');_0xfb9a37['message'][_0xb354('0x43')]=htmlToText[_0xb354('0x80')](_0xfb9a37[_0xb354('0x17')][_0xb354('0x43')]);return respondWithRpcPromise(_0xb354('0x81'),'EventManager',{'event':'acceptmessage','message':_0xfb9a37['message']},client9002)[_0xb354('0x22')](function(){return _0xfb9a37;});}return _0xfb9a37;}return null;})[_0xb354('0x22')](respondWithResult(_0x22ce24,null))[_0xb354('0x19')](handleError(_0x22ce24,null));};exports['reject']=function(_0x1a6661,_0x295d8b){var _0x18f663={'agent':{},'channel':_0xb354('0x63')};if(_0x1a6661[_0xb354('0x43')]['id']){delete _0x1a6661[_0xb354('0x43')]['id'];}_0x1a6661[_0xb354('0x43')]['UserId']=_0x1a6661['body']['UserId']||_0x1a6661[_0xb354('0x66')]['id'];_0x18f663[_0xb354('0x67')]['id']=_0x1a6661[_0xb354('0x43')][_0xb354('0x68')];return db[_0xb354('0x29')]['find']({'where':{'id':_0x1a6661[_0xb354('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x295d8b,null))[_0xb354('0x22')](function(_0x6aa62e){if(_0x6aa62e){_0x18f663[_0xb354('0x17')]=_0x6aa62e[_0xb354('0x69')]({'plain':!![]});return db[_0xb354('0x82')][_0xb354('0x41')]({'where':{'id':_0x6aa62e['MailInteractionId']}});}return null;})[_0xb354('0x22')](handleEntityNotFound(_0x295d8b,null))['then'](function(_0x4f1aeb){if(_0x4f1aeb){_0x18f663[_0xb354('0x83')]=_0x4f1aeb[_0xb354('0x69')]({'plain':!![]});interaction_log[_0xb354('0x6c')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a6661['user']['id'],_0x1a6661[_0xb354('0x66')][_0xb354('0x3a')],_0x1a6661['user'][_0xb354('0x6d')],_0x18f663[_0xb354('0x83')]['id'],_0x1a6661[_0xb354('0x43')]?JSON[_0xb354('0x61')](_0x1a6661[_0xb354('0x43')]):_0xb354('0x6e'));return respondWithRpcPromise('RejectMessage',_0xb354('0x84'),_0x18f663);}return null;})[_0xb354('0x22')](function(_0x4f8f13){var _0x33e86e=_0xb354('0x71')+_0x4f8f13[_0xb354('0x17')][_0xb354('0x72')];return db['sequelize']['query'](_0x33e86e,{'type':db[_0xb354('0x85')][_0xb354('0x74')][_0xb354('0x75')],'raw':!![]})[_0xb354('0x22')](function(_0x372450){return _0x372450;});})['then'](function(_0x1c21d8){if(_0x1c21d8){_0x18f663[_0xb354('0x17')][_0xb354('0x76')]=_0x1c21d8[0x0];if(!_0x1a6661[_0xb354('0x43')][_0xb354('0x68')])return;return db['User'][_0xb354('0x41')]({'where':{'id':_0x1a6661[_0xb354('0x43')][_0xb354('0x68')],'role':_0xb354('0x67')},'attributes':['id',_0xb354('0x3a'),_0xb354('0x78'),_0xb354('0x79'),_0xb354('0x86')],'raw':!![]});}return null;})[_0xb354('0x22')](function(_0x54f6d4){if(!_0x54f6d4)return null;_0x18f663['message']['agent']=_0x54f6d4;return _0x18f663;})['then'](function(_0x5750d5){if(_0x5750d5){_0x5750d5['message'][_0xb354('0x7b')]=util['format'](_0xb354('0x7c'),_0x1a6661[_0xb354('0x66')][_0xb354('0x3a')]);_0x5750d5[_0xb354('0x17')][_0xb354('0x7d')]=_0x18f663[_0xb354('0x7d')];_0x5750d5['message'][_0xb354('0x7e')]=_0x18f663[_0xb354('0x7d')];_0x5750d5[_0xb354('0x17')][_0xb354('0x7f')]=_0xb354('0x87');_0x5750d5[_0xb354('0x17')][_0xb354('0x43')]=htmlToText[_0xb354('0x80')](_0x18f663['message'][_0xb354('0x43')]);respondWithRpcPromise(_0xb354('0x81'),_0xb354('0x81'),{'event':_0xb354('0x88'),'message':_0x5750d5['message']},client9002);return _0x18f663;}return null;})[_0xb354('0x22')](respondWithResult(_0x295d8b,null))['catch'](handleError(_0x295d8b,null));};exports[_0xb354('0x89')]=function(_0x5c7ebc,_0x305287){var _0x8e725f=moment()['unix']()['toString']();var _0xe68320=path['join'](config[_0xb354('0x56')],_0xb354('0x8a'),'files',_0xb354('0x8b'));var _0xe25e34=path['join'](config[_0xb354('0x56')],'server','files',_0xb354('0x55'));var _0x5c4159=util[_0xb354('0x5f')](_0xb354('0x8c'),_0x8e725f);return db[_0xb354('0x29')][_0xb354('0x41')]({'where':{'id':_0x5c7ebc['params']['id']},'attributes':['id',_0xb354('0x43'),'from','to','cc',_0xb354('0x8d'),_0xb354('0x8e'),_0xb354('0x8f')],'include':_0x5c7ebc[_0xb354('0x2e')]['attachments']?[{'model':db[_0xb354('0x90')],'as':'Attachments'}]:undefined})[_0xb354('0x22')](handleEntityNotFound(_0x305287,null))[_0xb354('0x22')](function(_0x148f7d){if(_0x148f7d){var _0x24dc23=_0x148f7d;var _0x61d9ee={'from':_0x24dc23[_0xb354('0x91')],'to':_0x24dc23['to'],'subject':_0x24dc23[_0xb354('0x8e')],'html':htmlEntities['decode'](_0x24dc23['body']),'headers':{'Date':moment(_0x24dc23[_0xb354('0x8f')])[_0xb354('0x5f')](_0xb354('0x92'))},'attachments':[]};if(_0x148f7d['cc']){_0x61d9ee[_0xb354('0x93')]['Cc']=_0x148f7d['cc'];}if(_0x148f7d[_0xb354('0x8d')]){_0x61d9ee[_0xb354('0x93')][_0xb354('0x94')]=_0x148f7d[_0xb354('0x8d')];}return new BPromise(function(_0x50771a,_0x398e05){if(_0x148f7d['Attachments']){for(var _0x48e213=0x0;_0x48e213<_0x148f7d[_0xb354('0x95')][_0xb354('0x33')];_0x48e213++){var _0x2db837=_0x148f7d[_0xb354('0x95')][_0x48e213];var _0x329f96=path['join'](_0xe25e34,_0x2db837[_0xb354('0x58')]);if(fs['existsSync'](_0x329f96)){_0x61d9ee['attachments']['push']({'name':_0x2db837[_0xb354('0x3a')],'contentType':_0x2db837[_0xb354('0x2b')],'data':fs[_0xb354('0x96')](_0x329f96)});}}}emlformat['build'](_0x61d9ee,function(_0x58ffeb,_0x5dd695){if(_0x58ffeb)return _0x398e05(_0x58ffeb);fs[_0xb354('0x97')](path[_0xb354('0x98')](_0xe68320,_0x5c4159),_0x5dd695);return _0x50771a(_0x5dd695);});});}})[_0xb354('0x22')](function(_0x59de91){if(_0x59de91){return _0x305287[_0xb354('0x89')](path[_0xb354('0x98')](_0xe68320,_0x5c4159),_0x5c4159,function(_0x3447cd){if(!_0x3447cd)fs[_0xb354('0x99')](path['join'](_0xe68320,_0x5c4159));});}})[_0xb354('0x19')](handleError(_0x305287,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f24ea9c..4b77daf 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 _0x5f98=['MailMessage','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4d9b80,_0x3deb54){var _0x3e6b70=function(_0x31e86f){while(--_0x31e86f){_0x4d9b80['push'](_0x4d9b80['shift']());}};_0x3e6b70(++_0x3deb54);}(_0x5f98,0xb5));var _0x85f9=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x5f98[_0x1a36a5];return _0x746243;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x85f9('0x0'))['db'][_0x85f9('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x85f9('0x2'),'afterDestroy':'remove'};function emitEvent(_0x28ea92){return function(_0x267697,_0x197c7d,_0x372a09){MailMessageEvents[_0x85f9('0x3')](_0x28ea92+':'+_0x267697['id'],_0x267697);MailMessageEvents[_0x85f9('0x3')](_0x28ea92,_0x267697);_0x372a09(null);};}for(var e in events){if(events[_0x85f9('0x4')](e)){var event=events[e];MailMessage[_0x85f9('0x5')](e,emitEvent(event));}}module[_0x85f9('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x0dab=['exports','events','../../mysqldb','MailMessage','save','update','remove','hasOwnProperty','hook'];(function(_0x376c8a,_0x296fba){var _0xa054be=function(_0x4b30eb){while(--_0x4b30eb){_0x376c8a['push'](_0x376c8a['shift']());}};_0xa054be(++_0x296fba);}(_0x0dab,0x1de));var _0xb0da=function(_0xf1c3f7,_0x28bd7f){_0xf1c3f7=_0xf1c3f7-0x0;var _0x557bfc=_0x0dab[_0xf1c3f7];return _0x557bfc;};'use strict';var EventEmitter=require(_0xb0da('0x0'));var MailMessage=require(_0xb0da('0x1'))['db'][_0xb0da('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb0da('0x3'),'afterUpdate':_0xb0da('0x4'),'afterDestroy':_0xb0da('0x5')};function emitEvent(_0x42f0a2){return function(_0x320e78,_0x547468,_0x2081cb){MailMessageEvents['emit'](_0x42f0a2+':'+_0x320e78['id'],_0x320e78);MailMessageEvents['emit'](_0x42f0a2,_0x320e78);_0x2081cb(null);};}for(var e in events){if(events[_0xb0da('0x6')](e)){var event=events[e];MailMessage[_0xb0da('0x7')](e,emitEvent(event));}}module[_0xb0da('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 854f024..18c50b5 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 _0xd847=['then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','MailInteractionId'];(function(_0x4d8e5f,_0x1253e0){var _0xfde571=function(_0x104ec3){while(--_0x104ec3){_0x4d8e5f['push'](_0x4d8e5f['shift']());}};_0xfde571(++_0x1253e0);}(_0xd847,0x13b));var _0x7d84=function(_0x3010ff,_0x480d8e){_0x3010ff=_0x3010ff-0x0;var _0x1bd6e1=_0xd847[_0x3010ff];return _0x1bd6e1;};'use strict';var _=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var logger=require('../../config/logger')(_0x7d84('0x2'));var moment=require(_0x7d84('0x3'));var BPromise=require(_0x7d84('0x4'));var rp=require(_0x7d84('0x5'));var htmlToText=require(_0x7d84('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d84('0x7'));var config=require(_0x7d84('0x8'));var attributes=require(_0x7d84('0x9'));module[_0x7d84('0xa')]=function(_0x6632e3,_0x55554a){return _0x6632e3['define']('MailMessage',attributes,{'tableName':_0x7d84('0xb'),'paranoid':![],'indexes':[{'name':_0x7d84('0xc'),'fields':[_0x7d84('0xc')]},{'name':_0x7d84('0xd'),'fields':[_0x7d84('0xe'),_0x7d84('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e09b9,_0x4cfd71,_0x4f294e){if(_0x1e09b9[_0x7d84('0x10')]){_0x1e09b9[_0x7d84('0xe')]=htmlToText[_0x7d84('0x11')](_0x1e09b9[_0x7d84('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4f294e(null,_0x4cfd71);},'afterCreate':function(_0x24b458,_0x191b31,_0x3080c0){var _0x8fcfeb=_0x6632e3['models'];var _0x44e727=_0x24b458[_0x7d84('0x12')]({'plain':!![]});if(_0x44e727[_0x7d84('0x13')][_0x7d84('0x14')]()==='in'||_0x44e727[_0x7d84('0x13')]['toLowerCase']()===_0x7d84('0x15')&&!_0x44e727['secret']&&!_[_0x7d84('0x16')](_0x44e727[_0x7d84('0x17')])){_0x8fcfeb[_0x7d84('0x18')]['findOne']({'where':{'id':_0x44e727[_0x7d84('0x19')]}})[_0x7d84('0x1a')](function(_0x38b0a2){if(_0x38b0a2){_0x38b0a2[_0x7d84('0x1b')]({'lastMsgAt':_0x44e727[_0x7d84('0x1c')],'lastMsgDirection':_0x44e727[_0x7d84('0x13')]['toLowerCase']()});}})[_0x7d84('0x1d')](function(_0x2e824b){console['error'](_0x2e824b);});}_0x3080c0();}},'charset':'utf8mb4','collate':_0x7d84('0x1e')});}; \ No newline at end of file +var _0x0bca=['fromString','body','models','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','then','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'];(function(_0x277c61,_0x1e94dc){var _0x29d059=function(_0x196746){while(--_0x196746){_0x277c61['push'](_0x277c61['shift']());}};_0x29d059(++_0x1e94dc);}(_0x0bca,0x191));var _0xa0bc=function(_0x450e22,_0x3ba125){_0x450e22=_0x450e22-0x0;var _0x5e3b1d=_0x0bca[_0x450e22];return _0x5e3b1d;};'use strict';var _=require(_0xa0bc('0x0'));var util=require('util');var logger=require(_0xa0bc('0x1'))(_0xa0bc('0x2'));var moment=require(_0xa0bc('0x3'));var BPromise=require(_0xa0bc('0x4'));var rp=require(_0xa0bc('0x5'));var htmlToText=require(_0xa0bc('0x6'));var fs=require('fs');var path=require(_0xa0bc('0x7'));var rimraf=require(_0xa0bc('0x8'));var config=require(_0xa0bc('0x9'));var attributes=require(_0xa0bc('0xa'));module['exports']=function(_0x375922,_0xd6e708){return _0x375922[_0xa0bc('0xb')](_0xa0bc('0xc'),attributes,{'tableName':_0xa0bc('0xd'),'paranoid':![],'indexes':[{'name':_0xa0bc('0xe'),'fields':['messageId']},{'name':_0xa0bc('0xf'),'fields':[_0xa0bc('0x10'),_0xa0bc('0x11')],'type':_0xa0bc('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x581f23,_0x26ab0c,_0x39a56e){if(_0x581f23['body']){_0x581f23[_0xa0bc('0x10')]=htmlToText[_0xa0bc('0x13')](_0x581f23[_0xa0bc('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x39a56e(null,_0x26ab0c);},'afterCreate':function(_0x237791,_0x37ff07,_0x4ed6b6){var _0x5837d5=_0x375922[_0xa0bc('0x15')];var _0x284230=_0x237791['get']({'plain':!![]});if(_0x284230[_0xa0bc('0x16')][_0xa0bc('0x17')]()==='in'||_0x284230['direction'][_0xa0bc('0x17')]()==='out'&&!_0x284230[_0xa0bc('0x18')]&&!_[_0xa0bc('0x19')](_0x284230[_0xa0bc('0x1a')])){_0x5837d5[_0xa0bc('0x1b')][_0xa0bc('0x1c')]({'where':{'id':_0x284230['MailInteractionId']}})[_0xa0bc('0x1d')](function(_0xf202dd){if(_0xf202dd){_0xf202dd['update']({'lastMsgAt':_0x284230[_0xa0bc('0x1e')],'lastMsgDirection':_0x284230['direction'][_0xa0bc('0x17')]()});}})[_0xa0bc('0x1f')](function(_0x162bcd){console[_0xa0bc('0x20')](_0x162bcd);});}_0x4ed6b6();}},'charset':_0xa0bc('0x21'),'collate':_0xa0bc('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 6e59a8f..f7bdf04 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 _0xab40=['raw','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','register','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateMailMessage','MailMessage','create','options'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xab40,0xcd));var _0x0ab4=function(_0x3e881f,_0x1198a7){_0x3e881f=_0x3e881f-0x0;var _0x13011b=_0xab40[_0x3e881f];return _0x13011b;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});config[_0x0ab4('0x8')]=_[_0x0ab4('0x9')](config[_0x0ab4('0x8')],{'host':_0x0ab4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0x0ab4('0xb')](socket);function respondWithRpcPromise(_0x30e726,_0x40e4d1,_0x464f7e){return new BPromise(function(_0x413d9b,_0x24c6c1){return client[_0x0ab4('0xc')](_0x30e726,_0x464f7e)[_0x0ab4('0xd')](function(_0x4e1708){logger['info'](_0x0ab4('0xe'),_0x40e4d1,'request\x20sent');logger[_0x0ab4('0xf')](_0x0ab4('0x10'),_0x40e4d1,_0x0ab4('0x11'),JSON[_0x0ab4('0x12')](_0x4e1708));if(_0x4e1708[_0x0ab4('0x13')]){if(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x14')]===0x1f4){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x24c6c1(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);}logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x413d9b(_0x4e1708[_0x0ab4('0x13')]['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x40e4d1,_0x0ab4('0x11'));_0x413d9b(_0x4e1708[_0x0ab4('0x16')][_0x0ab4('0x15')]);}})['catch'](function(_0x1e3fe2){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x1e3fe2);_0x24c6c1(_0x1e3fe2);});});}exports[_0x0ab4('0x17')]=function(_0x4e7852){var _0x4ff836=this;return new Promise(function(_0xdb0797,_0x5b1ed5){return db[_0x0ab4('0x18')][_0x0ab4('0x19')](_0x4e7852['body'],{'raw':_0x4e7852[_0x0ab4('0x1a')]?_0x4e7852[_0x0ab4('0x1a')][_0x0ab4('0x1b')]===undefined?!![]:![]:!![]})[_0x0ab4('0xd')](function(_0x12d06d){logger['info']('CreateMailMessage',_0x4e7852);logger[_0x0ab4('0xf')](_0x0ab4('0x17'),_0x4e7852,JSON[_0x0ab4('0x12')](_0x12d06d));_0xdb0797(_0x12d06d);})[_0x0ab4('0x1c')](function(_0x4e4b80){logger[_0x0ab4('0x13')](_0x0ab4('0x17'),_0x4e4b80[_0x0ab4('0x15')],_0x4e7852);_0x5b1ed5(_0x4ff836['error'](0x1f4,_0x4e4b80['message']));});});}; \ No newline at end of file +var _0xfef3=['raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0xfef3,0x118));var _0x3fef=function(_0x2bb9b3,_0x1d2c25){_0x2bb9b3=_0x2bb9b3-0x0;var _0x601b6=_0xfef3[_0x2bb9b3];return _0x601b6;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});config[_0x3fef('0x9')]=_[_0x3fef('0xa')](config[_0x3fef('0x9')],{'host':_0x3fef('0xb'),'port':0x18eb});var socket=require(_0x3fef('0xc'))(new Redis(config[_0x3fef('0x9')]));require(_0x3fef('0xd'))[_0x3fef('0xe')](socket);function respondWithRpcPromise(_0x307586,_0x67cdd8,_0x16252b){return new BPromise(function(_0x1a7ef7,_0x7cc5b){return client['request'](_0x307586,_0x16252b)[_0x3fef('0xf')](function(_0x3560d9){logger[_0x3fef('0x10')]('MailMessage,\x20%s,\x20%s',_0x67cdd8,_0x3fef('0x11'));logger['debug'](_0x3fef('0x12'),_0x67cdd8,_0x3fef('0x11'),JSON[_0x3fef('0x13')](_0x3560d9));if(_0x3560d9['error']){if(_0x3560d9[_0x3fef('0x14')]['code']===0x1f4){logger[_0x3fef('0x14')](_0x3fef('0x15'),_0x67cdd8,_0x3560d9['error'][_0x3fef('0x16')]);return _0x7cc5b(_0x3560d9[_0x3fef('0x14')][_0x3fef('0x16')]);}logger[_0x3fef('0x14')](_0x3fef('0x15'),_0x67cdd8,_0x3560d9[_0x3fef('0x14')]['message']);return _0x1a7ef7(_0x3560d9[_0x3fef('0x14')][_0x3fef('0x16')]);}else{logger[_0x3fef('0x10')](_0x3fef('0x15'),_0x67cdd8,_0x3fef('0x11'));_0x1a7ef7(_0x3560d9[_0x3fef('0x17')]['message']);}})[_0x3fef('0x18')](function(_0x3eb287){logger['error'](_0x3fef('0x15'),_0x67cdd8,_0x3eb287);_0x7cc5b(_0x3eb287);});});}exports[_0x3fef('0x19')]=function(_0x42e095){var _0x218f91=this;return new Promise(function(_0x245332,_0x2b5226){return db[_0x3fef('0x1a')][_0x3fef('0x1b')](_0x42e095[_0x3fef('0x1c')],{'raw':_0x42e095[_0x3fef('0x1d')]?_0x42e095[_0x3fef('0x1d')][_0x3fef('0x1e')]===undefined?!![]:![]:!![]})[_0x3fef('0xf')](function(_0x39a8ea){logger[_0x3fef('0x10')]('CreateMailMessage',_0x42e095);logger['debug']('CreateMailMessage',_0x42e095,JSON[_0x3fef('0x13')](_0x39a8ea));_0x245332(_0x39a8ea);})[_0x3fef('0x18')](function(_0xa16dc){logger['error'](_0x3fef('0x19'),_0xa16dc['message'],_0x42e095);_0x2b5226(_0x218f91[_0x3fef('0x14')](0x1f4,_0xa16dc[_0x3fef('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 8875f7d..46d47e2 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 _0x5b05=['update','emit','removeListener','length','save','remove'];(function(_0x5569f1,_0x5ee797){var _0x29214f=function(_0x1240f6){while(--_0x1240f6){_0x5569f1['push'](_0x5569f1['shift']());}};_0x29214f(++_0x5ee797);}(_0x5b05,0x190));var _0x55b0=function(_0x1ac495,_0x343f0a){_0x1ac495=_0x1ac495-0x0;var _0xa58131=_0x5b05[_0x1ac495];return _0xa58131;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x55b0('0x0'),_0x55b0('0x1'),_0x55b0('0x2')];function createListener(_0x4148d8,_0x28c785){return function(_0x2925fe){_0x28c785[_0x55b0('0x3')](_0x4148d8,_0x2925fe);};}function removeListener(_0x43a880,_0x2cbf51){return function(){MailMessageEvents[_0x55b0('0x4')](_0x43a880,_0x2cbf51);};}exports['register']=function(_0x569adf){for(var _0x129898=0x0,_0xe0c407=events[_0x55b0('0x5')];_0x129898<_0xe0c407;_0x129898++){var _0x355e20=events[_0x129898];var _0xdf375f=createListener('mailMessage:'+_0x355e20,_0x569adf);MailMessageEvents['on'](_0x355e20,_0xdf375f);}}; \ No newline at end of file +var _0x1f16=['update','register','length','mailMessage:','./mailMessage.events','remove'];(function(_0x165c3e,_0x11ae73){var _0x328128=function(_0x10c3a6){while(--_0x10c3a6){_0x165c3e['push'](_0x165c3e['shift']());}};_0x328128(++_0x11ae73);}(_0x1f16,0x190));var _0x61f1=function(_0x2ff5aa,_0x4d251f){_0x2ff5aa=_0x2ff5aa-0x0;var _0x366c91=_0x1f16[_0x2ff5aa];return _0x366c91;};'use strict';var MailMessageEvents=require(_0x61f1('0x0'));var events=['save',_0x61f1('0x1'),_0x61f1('0x2')];function createListener(_0x507f0b,_0x4667f1){return function(_0x5e6804){_0x4667f1['emit'](_0x507f0b,_0x5e6804);};}function removeListener(_0x2d8a3d,_0x545155){return function(){MailMessageEvents['removeListener'](_0x2d8a3d,_0x545155);};}exports[_0x61f1('0x3')]=function(_0x31ccf6){for(var _0x16b91d=0x0,_0x56ea8f=events[_0x61f1('0x4')];_0x16b91d<_0x56ea8f;_0x16b91d++){var _0x526b5c=events[_0x16b91d];var _0x19c904=createListener(_0x61f1('0x5')+_0x526b5c,_0x31ccf6);MailMessageEvents['on'](_0x526b5c,_0x19c904);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6638cdb..92ad7e6 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 _0xdf40=['/:id/teams','getTeams','post','create','addAgents','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','getMembers'];(function(_0x1b4bdc,_0x11f92c){var _0x246255=function(_0x52ca0b){while(--_0x52ca0b){_0x1b4bdc['push'](_0x1b4bdc['shift']());}};_0x246255(++_0x11f92c);}(_0xdf40,0x168));var _0x0df4=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0xdf40[_0xdd0313];return _0x2bd7e8;};'use strict';var multer=require(_0x0df4('0x0'));var util=require(_0x0df4('0x1'));var path=require(_0x0df4('0x2'));var timeout=require(_0x0df4('0x3'));var express=require(_0x0df4('0x4'));var router=express[_0x0df4('0x5')]();var fs_extra=require(_0x0df4('0x6'));var auth=require(_0x0df4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0df4('0x8'));var controller=require(_0x0df4('0x9'));router[_0x0df4('0xa')]('/',auth[_0x0df4('0xb')](),controller[_0x0df4('0xc')]);router['get']('/describe',auth[_0x0df4('0xb')](),controller[_0x0df4('0xd')]);router['get'](_0x0df4('0xe'),auth['isAuthenticated'](),controller[_0x0df4('0xf')]);router[_0x0df4('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x0df4('0x10')]);router['get'](_0x0df4('0x11'),auth[_0x0df4('0xb')](),controller[_0x0df4('0x12')]);router[_0x0df4('0xa')]('/:id/users',auth[_0x0df4('0xb')](),controller['getAgents']);router[_0x0df4('0x13')]('/',auth[_0x0df4('0xb')](),controller[_0x0df4('0x14')]);router[_0x0df4('0x13')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x0df4('0x13')]('/:id/users',auth[_0x0df4('0xb')](),controller[_0x0df4('0x15')]);router['put']('/:id',auth[_0x0df4('0xb')](),controller[_0x0df4('0x16')]);router[_0x0df4('0x17')](_0x0df4('0xe'),auth[_0x0df4('0xb')](),controller[_0x0df4('0x18')]);router[_0x0df4('0x17')](_0x0df4('0x11'),auth['isAuthenticated'](),controller[_0x0df4('0x19')]);router[_0x0df4('0x17')](_0x0df4('0x1a'),auth[_0x0df4('0xb')](),controller[_0x0df4('0x1b')]);module[_0x0df4('0x1c')]=router; \ No newline at end of file +var _0x91a1=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','update','delete','/:id','removeTeams'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x91a1,0xb0));var _0x191a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91a1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x191a('0x0'));var util=require(_0x191a('0x1'));var path=require(_0x191a('0x2'));var timeout=require(_0x191a('0x3'));var express=require(_0x191a('0x4'));var router=express[_0x191a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x191a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x191a('0x7'));var controller=require('./mailQueue.controller');router[_0x191a('0x8')]('/',auth[_0x191a('0x9')](),controller[_0x191a('0xa')]);router[_0x191a('0x8')](_0x191a('0xb'),auth[_0x191a('0x9')](),controller[_0x191a('0xc')]);router[_0x191a('0x8')]('/:id',auth[_0x191a('0x9')](),controller[_0x191a('0xd')]);router[_0x191a('0x8')](_0x191a('0xe'),auth[_0x191a('0x9')](),controller[_0x191a('0xf')]);router[_0x191a('0x8')](_0x191a('0x10'),auth[_0x191a('0x9')](),controller[_0x191a('0x11')]);router[_0x191a('0x8')](_0x191a('0x12'),auth[_0x191a('0x9')](),controller['getAgents']);router['post']('/',auth[_0x191a('0x9')](),controller[_0x191a('0x13')]);router[_0x191a('0x14')](_0x191a('0x10'),auth[_0x191a('0x9')](),controller[_0x191a('0x15')]);router[_0x191a('0x14')]('/:id/users',auth[_0x191a('0x9')](),controller[_0x191a('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x191a('0x17')]);router[_0x191a('0x18')](_0x191a('0x19'),auth[_0x191a('0x9')](),controller['destroy']);router[_0x191a('0x18')](_0x191a('0x10'),auth[_0x191a('0x9')](),controller[_0x191a('0x1a')]);router[_0x191a('0x18')](_0x191a('0x12'),auth[_0x191a('0x9')](),controller[_0x191a('0x1b')]);module[_0x191a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 3b60f45..e6213b5 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 _0x089d=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3c9373,_0x4feb18){var _0x170f07=function(_0x136773){while(--_0x136773){_0x3c9373['push'](_0x3c9373['shift']());}};_0x170f07(++_0x4feb18);}(_0x089d,0x89));var _0xd089=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x089d[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require('sequelize');module[_0xd089('0x0')]={'name':{'type':Sequelize[_0xd089('0x1')],'unique':_0xd089('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd089('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd089('0x4')](_0xd089('0x5'),_0xd089('0x6'),_0xd089('0x7'))}}; \ No newline at end of file +var _0xa7ae=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0xa7ae,0xb6));var _0xea7a=function(_0x548d3a,_0x58876c){_0x548d3a=_0x548d3a-0x0;var _0x40aa5d=_0xa7ae[_0x548d3a];return _0x40aa5d;};'use strict';var Sequelize=require(_0xea7a('0x0'));module['exports']={'name':{'type':Sequelize[_0xea7a('0x1')],'unique':_0xea7a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea7a('0x1')]},'timeout':{'type':Sequelize[_0xea7a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea7a('0x4')](_0xea7a('0x5'),_0xea7a('0x6'),_0xea7a('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1a5e6c2..49e5cdb 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 _0xcf76=['squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','sort','where','filter','merge','VIRTUAL','count','includeAll','include','rows','show','params','fields','length','options','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserMailQueue','rawAttributes','hasOwnProperty','nolimit','order','pick','User','findAndCountAll','UserId','mailPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','findAll','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','TeamId','includes','union','compact','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x15f343,_0x31875c){var _0x37db9d=function(_0x12a58a){while(--_0x12a58a){_0x15f343['push'](_0x15f343['shift']());}};_0x37db9d(++_0x31875c);}(_0xcf76,0x10d));var _0x6cf7=function(_0x9eefd0,_0x40d55f){_0x9eefd0=_0x9eefd0-0x0;var _0x399fe3=_0xcf76[_0x9eefd0];return _0x399fe3;};'use strict';var emlformat=require(_0x6cf7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cf7('0x1'));var jsonpatch=require(_0x6cf7('0x2'));var rp=require(_0x6cf7('0x3'));var moment=require(_0x6cf7('0x4'));var BPromise=require(_0x6cf7('0x5'));var Mustache=require(_0x6cf7('0x6'));var util=require(_0x6cf7('0x7'));var path=require(_0x6cf7('0x8'));var sox=require(_0x6cf7('0x9'));var csv=require(_0x6cf7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cf7('0xb'));var _=require(_0x6cf7('0xc'));var squel=require(_0x6cf7('0xd'));var crypto=require('crypto');var jsforce=require(_0x6cf7('0xe'));var deskjs=require(_0x6cf7('0xf'));var toCsv=require(_0x6cf7('0xa'));var querystring=require(_0x6cf7('0x10'));var Papa=require(_0x6cf7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf7('0x12'));var as=require(_0x6cf7('0x13'));var hardwareService=require(_0x6cf7('0x14'));var logger=require(_0x6cf7('0x15'))(_0x6cf7('0x16'));var utils=require('../../config/utils');var config=require(_0x6cf7('0x17'));var licenseUtil=require(_0x6cf7('0x18'));var db=require('../../mysqldb')['db'];config[_0x6cf7('0x19')]=_[_0x6cf7('0x1a')](config[_0x6cf7('0x19')],{'host':_0x6cf7('0x1b'),'port':0x18eb});var socket=require(_0x6cf7('0x1c'))(new Redis(config[_0x6cf7('0x19')]));require('./mailQueue.socket')[_0x6cf7('0x1d')](socket);function respondWithStatusCode(_0x332d8b,_0x18eb26){_0x18eb26=_0x18eb26||0xcc;return function(_0x1a7371){if(_0x1a7371){return _0x332d8b[_0x6cf7('0x1e')](_0x18eb26);}return _0x332d8b['status'](_0x18eb26)[_0x6cf7('0x1f')]();};}function respondWithResult(_0x464d70,_0x2830b3){_0x2830b3=_0x2830b3||0xc8;return function(_0x58c1b2){if(_0x58c1b2){return _0x464d70[_0x6cf7('0x20')](_0x2830b3)['json'](_0x58c1b2);}};}function respondWithFilteredResult(_0x32fffe,_0x7fed2b){return function(_0xd6b9c0){if(_0xd6b9c0){var _0x3b4a54=typeof _0x7fed2b[_0x6cf7('0x21')]==='undefined'&&typeof _0x7fed2b[_0x6cf7('0x22')]==='undefined';var _0x338b30=_0xd6b9c0['count'];var _0x11601b=_0x3b4a54?0x0:_0x7fed2b[_0x6cf7('0x21')];var _0x1ade3=_0x3b4a54?_0xd6b9c0['count']:_0x7fed2b[_0x6cf7('0x21')]+_0x7fed2b['limit'];var _0x52ce90;if(_0x1ade3>=_0x338b30){_0x1ade3=_0x338b30;_0x52ce90=0xc8;}else{_0x52ce90=0xce;}_0x32fffe['status'](_0x52ce90);return _0x32fffe[_0x6cf7('0x23')](_0x6cf7('0x24'),_0x11601b+'-'+_0x1ade3+'/'+_0x338b30)[_0x6cf7('0x25')](_0xd6b9c0);}return null;};}function patchUpdates(_0x155307){return function(_0x235745){try{jsonpatch[_0x6cf7('0x26')](_0x235745,_0x155307,!![]);}catch(_0x14eb05){return BPromise[_0x6cf7('0x27')](_0x14eb05);}return _0x235745[_0x6cf7('0x28')]();};}function saveUpdates(_0x43607a,_0x676090){return function(_0x222ed3){if(_0x222ed3){return _0x222ed3[_0x6cf7('0x29')](_0x43607a)[_0x6cf7('0x2a')](function(_0x29c840){return _0x29c840;});}return null;};}function removeEntity(_0x4b44f7,_0x59203c){return function(_0x2d8b64){if(_0x2d8b64){return _0x2d8b64[_0x6cf7('0x2b')]()['then'](function(){var _0x2f0507=_0x2d8b64[_0x6cf7('0x2c')]({'plain':!![]});var _0x3ff34f=_0x6cf7('0x2d');return db[_0x6cf7('0x2e')][_0x6cf7('0x2b')]({'where':{'type':_0x3ff34f,'resourceId':_0x2f0507['id']}})[_0x6cf7('0x2a')](function(){return _0x2d8b64;});})[_0x6cf7('0x2a')](function(){_0x4b44f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de623,_0x9256f8){return function(_0xcaab36){if(!_0xcaab36){_0x5de623[_0x6cf7('0x1e')](0x194);}return _0xcaab36;};}function handleError(_0x28a148,_0xdd870){_0xdd870=_0xdd870||0x1f4;return function(_0x1a7e0d){logger[_0x6cf7('0x2f')](_0x1a7e0d[_0x6cf7('0x30')]);if(_0x1a7e0d[_0x6cf7('0x31')]){delete _0x1a7e0d['name'];}_0x28a148[_0x6cf7('0x20')](_0xdd870)[_0x6cf7('0x32')](_0x1a7e0d);};}exports[_0x6cf7('0x33')]=function(_0x11e713,_0x31b4af){var _0xc7a2da={},_0x5bce87={},_0x590ea9={'count':0x0,'rows':[]};var _0x28c955=_[_0x6cf7('0x34')](db[_0x6cf7('0x35')]['rawAttributes'],function(_0x351a5b){return{'name':_0x351a5b[_0x6cf7('0x36')],'type':_0x351a5b[_0x6cf7('0x37')][_0x6cf7('0x38')]};});_0x5bce87[_0x6cf7('0x39')]=_[_0x6cf7('0x34')](_0x28c955,'name');_0x5bce87[_0x6cf7('0x3a')]=_[_0x6cf7('0x3b')](_0x11e713[_0x6cf7('0x3a')]);_0x5bce87[_0x6cf7('0x3c')]=_[_0x6cf7('0x3d')](_0x5bce87[_0x6cf7('0x39')],_0x5bce87[_0x6cf7('0x3a')]);_0xc7a2da[_0x6cf7('0x3e')]=_['intersection'](_0x5bce87['model'],qs['fields'](_0x11e713['query']['fields']));_0xc7a2da['attributes']=_0xc7a2da[_0x6cf7('0x3e')]['length']?_0xc7a2da[_0x6cf7('0x3e')]:_0x5bce87[_0x6cf7('0x39')];if(!_0x11e713[_0x6cf7('0x3a')]['hasOwnProperty']('nolimit')){_0xc7a2da[_0x6cf7('0x22')]=qs[_0x6cf7('0x22')](_0x11e713[_0x6cf7('0x3a')][_0x6cf7('0x22')]);_0xc7a2da[_0x6cf7('0x21')]=qs[_0x6cf7('0x21')](_0x11e713[_0x6cf7('0x3a')][_0x6cf7('0x21')]);}_0xc7a2da['order']=qs['sort'](_0x11e713['query'][_0x6cf7('0x3f')]);_0xc7a2da[_0x6cf7('0x40')]=qs[_0x6cf7('0x3c')](_['pick'](_0x11e713[_0x6cf7('0x3a')],_0x5bce87['filters']),_0x28c955);if(_0x11e713[_0x6cf7('0x3a')][_0x6cf7('0x41')]){_0xc7a2da[_0x6cf7('0x40')]=_[_0x6cf7('0x42')](_0xc7a2da['where'],{'$or':_[_0x6cf7('0x34')](_0x28c955,function(_0x527bc0){if(_0x527bc0[_0x6cf7('0x37')]!==_0x6cf7('0x43')){var _0x351d11={};_0x351d11[_0x527bc0[_0x6cf7('0x31')]]={'$like':'%'+_0x11e713['query']['filter']+'%'};return _0x351d11;}})});}_0xc7a2da=_[_0x6cf7('0x42')]({},_0xc7a2da,_0x11e713['options']);var _0x1e2cc2={'where':_0xc7a2da['where']};return db[_0x6cf7('0x35')][_0x6cf7('0x44')](_0x1e2cc2)[_0x6cf7('0x2a')](function(_0x4702d9){_0x590ea9['count']=_0x4702d9;if(_0x11e713[_0x6cf7('0x3a')][_0x6cf7('0x45')]){_0xc7a2da[_0x6cf7('0x46')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0xc7a2da);})[_0x6cf7('0x2a')](function(_0x4ba428){_0x590ea9[_0x6cf7('0x47')]=_0x4ba428;return _0x590ea9;})['then'](respondWithFilteredResult(_0x31b4af,_0xc7a2da))['catch'](handleError(_0x31b4af,null));};exports[_0x6cf7('0x48')]=function(_0x421dd9,_0x482002){var _0x45ac5a={'raw':!![],'where':{'id':_0x421dd9[_0x6cf7('0x49')]['id']}},_0x4b291c={};_0x4b291c['model']=_['keys'](db['MailQueue']['rawAttributes']);_0x4b291c['query']=_[_0x6cf7('0x3b')](_0x421dd9[_0x6cf7('0x3a')]);_0x4b291c[_0x6cf7('0x3c')]=_[_0x6cf7('0x3d')](_0x4b291c[_0x6cf7('0x39')],_0x4b291c[_0x6cf7('0x3a')]);_0x45ac5a[_0x6cf7('0x3e')]=_[_0x6cf7('0x3d')](_0x4b291c[_0x6cf7('0x39')],qs[_0x6cf7('0x4a')](_0x421dd9[_0x6cf7('0x3a')][_0x6cf7('0x4a')]));_0x45ac5a[_0x6cf7('0x3e')]=_0x45ac5a['attributes'][_0x6cf7('0x4b')]?_0x45ac5a['attributes']:_0x4b291c[_0x6cf7('0x39')];if(_0x421dd9[_0x6cf7('0x3a')][_0x6cf7('0x45')]){_0x45ac5a['include']=[{'all':!![]}];}_0x45ac5a=_[_0x6cf7('0x42')]({},_0x45ac5a,_0x421dd9[_0x6cf7('0x4c')]);return db[_0x6cf7('0x35')][_0x6cf7('0x4d')](_0x45ac5a)[_0x6cf7('0x2a')](handleEntityNotFound(_0x482002,null))[_0x6cf7('0x2a')](respondWithResult(_0x482002,null))['catch'](handleError(_0x482002,null));};exports[_0x6cf7('0x4e')]=function(_0x1724d7,_0xb8f1ee){return db[_0x6cf7('0x35')][_0x6cf7('0x4e')](_0x1724d7['body'],{})['then'](function(_0x49fee2){var _0x55ef74=_0x1724d7['user'][_0x6cf7('0x2c')]({'plain':!![]});if(!_0x55ef74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55ef74[_0x6cf7('0x4f')]===_0x6cf7('0x50')){var _0x216a23=_0x49fee2[_0x6cf7('0x2c')]({'plain':!![]});var _0x52ff27=_0x6cf7('0x2d');return db[_0x6cf7('0x51')][_0x6cf7('0x4d')]({'where':{'name':_0x52ff27,'userProfileId':_0x55ef74[_0x6cf7('0x52')]},'raw':!![]})[_0x6cf7('0x2a')](function(_0x1414e0){if(_0x1414e0&&_0x1414e0[_0x6cf7('0x53')]===0x0){return db[_0x6cf7('0x2e')][_0x6cf7('0x4e')]({'name':_0x216a23['name'],'resourceId':_0x216a23['id'],'type':_0x1414e0['name'],'sectionId':_0x1414e0['id']},{})[_0x6cf7('0x2a')](function(){return _0x49fee2;});}else{return _0x49fee2;}})[_0x6cf7('0x54')](function(_0x48cce3){logger[_0x6cf7('0x2f')](_0x6cf7('0x55'),_0x48cce3);throw _0x48cce3;});}return _0x49fee2;})[_0x6cf7('0x2a')](respondWithResult(_0xb8f1ee,0xc9))['catch'](handleError(_0xb8f1ee,null));};exports['update']=function(_0x559579,_0x15517c){if(_0x559579[_0x6cf7('0x56')]['id']){delete _0x559579[_0x6cf7('0x56')]['id'];}return db[_0x6cf7('0x35')][_0x6cf7('0x4d')]({'where':{'id':_0x559579[_0x6cf7('0x49')]['id']}})[_0x6cf7('0x2a')](handleEntityNotFound(_0x15517c,null))['then'](saveUpdates(_0x559579[_0x6cf7('0x56')],null))[_0x6cf7('0x2a')](respondWithResult(_0x15517c,null))[_0x6cf7('0x54')](handleError(_0x15517c,null));};exports[_0x6cf7('0x2b')]=function(_0xd612ee,_0x4d128a){return db['MailQueue'][_0x6cf7('0x4d')]({'where':{'id':_0xd612ee[_0x6cf7('0x49')]['id']}})[_0x6cf7('0x2a')](handleEntityNotFound(_0x4d128a,null))[_0x6cf7('0x2a')](removeEntity(_0x4d128a,null))[_0x6cf7('0x54')](handleError(_0x4d128a,null));};exports[_0x6cf7('0x57')]=function(_0x5b3bd3,_0x596f81){return db['MailQueue'][_0x6cf7('0x57')]()[_0x6cf7('0x2a')](respondWithResult(_0x596f81,null))[_0x6cf7('0x54')](handleError(_0x596f81,null));};exports['getMembers']=function(_0x481c6a,_0x2d2f16,_0x52a44e){var _0x2c9853={'raw':!![],'where':{}},_0x1f06e9={},_0x53aab8;return db['MailQueue'][_0x6cf7('0x58')]({'where':{'id':_0x481c6a['params']['id']}})[_0x6cf7('0x2a')](handleEntityNotFound(_0x2d2f16,null))[_0x6cf7('0x2a')](function(_0xafb8d3){if(_0xafb8d3){_0x53aab8=_0xafb8d3['get']({'plain':!![]});_0x1f06e9[_0x6cf7('0x39')]=_['keys'](db[_0x6cf7('0x59')][_0x6cf7('0x5a')]);_0x1f06e9[_0x6cf7('0x3a')]=_[_0x6cf7('0x3b')](_0x481c6a[_0x6cf7('0x3a')]);_0x1f06e9[_0x6cf7('0x3c')]=_[_0x6cf7('0x3d')](_0x1f06e9[_0x6cf7('0x39')],_0x1f06e9[_0x6cf7('0x3a')]);_0x2c9853['attributes']=_[_0x6cf7('0x3d')](_0x1f06e9[_0x6cf7('0x39')],qs['fields'](_0x481c6a['query'][_0x6cf7('0x4a')]));_0x2c9853[_0x6cf7('0x3e')]=_0x2c9853[_0x6cf7('0x3e')][_0x6cf7('0x4b')]?_0x2c9853['attributes']:_0x1f06e9['model'];if(!_0x481c6a[_0x6cf7('0x3a')][_0x6cf7('0x5b')](_0x6cf7('0x5c'))){_0x2c9853[_0x6cf7('0x22')]=qs[_0x6cf7('0x22')](_0x481c6a['query'][_0x6cf7('0x22')]);_0x2c9853[_0x6cf7('0x21')]=qs[_0x6cf7('0x21')](_0x481c6a[_0x6cf7('0x3a')][_0x6cf7('0x21')]);}_0x2c9853[_0x6cf7('0x5d')]=qs[_0x6cf7('0x3f')](_0x481c6a[_0x6cf7('0x3a')][_0x6cf7('0x3f')]);_0x2c9853['where']=qs[_0x6cf7('0x3c')](_[_0x6cf7('0x5e')](_0x481c6a['query'],_0x1f06e9[_0x6cf7('0x3c')]));_0x2c9853[_0x6cf7('0x40')]['MailQueueId']=_0xafb8d3['id'];if(_0x481c6a['query']['filter']){_0x2c9853[_0x6cf7('0x40')]=_[_0x6cf7('0x42')](_0x2c9853[_0x6cf7('0x40')],{'$or':_[_0x6cf7('0x34')](_0x2c9853[_0x6cf7('0x3e')],function(_0x382c93){var _0x2e9f70={};_0x2e9f70[_0x382c93]={'$like':'%'+_0x481c6a[_0x6cf7('0x3a')][_0x6cf7('0x41')]+'%'};return _0x2e9f70;})});}_0x2c9853=_[_0x6cf7('0x42')]({},_0x2c9853,_0x481c6a['options']);return db[_0x6cf7('0x59')]['findAll'](_0x2c9853);}})[_0x6cf7('0x2a')](function(_0x2a51ef){if(_0x2a51ef){return db[_0x6cf7('0x5f')][_0x6cf7('0x60')]({'where':{'id':_['map'](_0x2a51ef,_0x6cf7('0x61')),'role':'agent'},'attributes':['id','name',_0x6cf7('0x62'),'updatedAt',_0x6cf7('0x63')]});}})[_0x6cf7('0x2a')](function(_0x1c28ab){if(_0x1c28ab){return{'count':_0x1c28ab[_0x6cf7('0x44')],'rows':_[_0x6cf7('0x34')](_0x1c28ab[_0x6cf7('0x47')],function(_0x23de6){return{'membername':_0x23de6[_0x6cf7('0x31')],'UserId':_0x23de6['id'],'queue_name':_0x53aab8[_0x6cf7('0x31')],'MailQueueId':_0x53aab8['id'],'interface':util[_0x6cf7('0x64')](_0x6cf7('0x65'),_0x6cf7('0x66'),_0x23de6[_0x6cf7('0x31')]),'penalty':0x0,'paused':_0x23de6['mailPause'],'createdAt':_0x23de6['createdAt'],'updatedAt':_0x23de6[_0x6cf7('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6cf7('0x2a')](respondWithFilteredResult(_0x2d2f16,_0x2c9853))[_0x6cf7('0x54')](handleError(_0x2d2f16,null));};exports['getTeams']=function(_0x34e050,_0x3b668a,_0x12598a){var _0x21ebd3={};var _0x7b32fd={};var _0x6e7f19;var _0x505c6c;return db['MailQueue'][_0x6cf7('0x58')]({'where':{'id':_0x34e050[_0x6cf7('0x49')]['id']}})[_0x6cf7('0x2a')](handleEntityNotFound(_0x3b668a,null))[_0x6cf7('0x2a')](function(_0x30a47b){if(_0x30a47b){_0x6e7f19=_0x30a47b;_0x7b32fd[_0x6cf7('0x39')]=_[_0x6cf7('0x3b')](db[_0x6cf7('0x68')]['rawAttributes']);_0x7b32fd[_0x6cf7('0x3a')]=_[_0x6cf7('0x3b')](_0x34e050['query']);_0x7b32fd[_0x6cf7('0x3c')]=_[_0x6cf7('0x3d')](_0x7b32fd['model'],_0x7b32fd[_0x6cf7('0x3a')]);_0x21ebd3[_0x6cf7('0x3e')]=_['intersection'](_0x7b32fd[_0x6cf7('0x39')],qs[_0x6cf7('0x4a')](_0x34e050[_0x6cf7('0x3a')][_0x6cf7('0x4a')]));_0x21ebd3[_0x6cf7('0x3e')]=_0x21ebd3[_0x6cf7('0x3e')][_0x6cf7('0x4b')]?_0x21ebd3[_0x6cf7('0x3e')]:_0x7b32fd[_0x6cf7('0x39')];_0x21ebd3[_0x6cf7('0x5d')]=qs[_0x6cf7('0x3f')](_0x34e050['query'][_0x6cf7('0x3f')]);_0x21ebd3[_0x6cf7('0x40')]=qs[_0x6cf7('0x3c')](_['pick'](_0x34e050[_0x6cf7('0x3a')],_0x7b32fd[_0x6cf7('0x3c')]));if(_0x34e050[_0x6cf7('0x3a')]['filter']){_0x21ebd3[_0x6cf7('0x40')]=_[_0x6cf7('0x42')](_0x21ebd3[_0x6cf7('0x40')],{'$or':_[_0x6cf7('0x34')](_0x21ebd3[_0x6cf7('0x3e')],function(_0x4fa34a){var _0x4cb98a={};_0x4cb98a[_0x4fa34a]={'$like':'%'+_0x34e050[_0x6cf7('0x3a')][_0x6cf7('0x41')]+'%'};return _0x4cb98a;})});}_0x21ebd3=_[_0x6cf7('0x42')]({},_0x21ebd3,_0x34e050['options']);return _0x6e7f19[_0x6cf7('0x69')](_0x21ebd3);}})[_0x6cf7('0x2a')](function(_0x4fb96d){if(_0x4fb96d){_0x505c6c=_0x4fb96d['length'];if(!_0x34e050['query'][_0x6cf7('0x5b')]('nolimit')){_0x21ebd3['limit']=qs[_0x6cf7('0x22')](_0x34e050[_0x6cf7('0x3a')][_0x6cf7('0x22')]);_0x21ebd3['offset']=qs[_0x6cf7('0x21')](_0x34e050[_0x6cf7('0x3a')][_0x6cf7('0x21')]);}return _0x6e7f19['getTeams'](_0x21ebd3);}})['then'](function(_0x54b2bf){if(_0x54b2bf){return _0x54b2bf?{'count':_0x505c6c,'rows':_0x54b2bf}:null;}})[_0x6cf7('0x2a')](respondWithResult(_0x3b668a,null))[_0x6cf7('0x54')](handleError(_0x3b668a,null));};exports[_0x6cf7('0x6a')]=function(_0x933087,_0x1cdeed,_0x3d0fed){var _0x24d2ac=_0x933087[_0x6cf7('0x56')][_0x6cf7('0x6b')];return db[_0x6cf7('0x68')][_0x6cf7('0x6c')]({'where':{'id':_0x24d2ac},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6cf7('0x6d'),'attributes':['id','name','online',_0x6cf7('0x6e'),_0x6cf7('0x6f')],'raw':!![]}]})['then'](function(_0x36074e){if(_0x36074e){var _0x3ad890=_[_0x6cf7('0x70')](_0x36074e,function(_0x337cd0){var _0x458a47=_0x337cd0['get']({'plain':!![]});return _0x458a47[_0x6cf7('0x6d')];});return db[_0x6cf7('0x35')][_0x6cf7('0x4d')]({'where':{'id':_0x933087[_0x6cf7('0x49')]['id']}})['then'](function(_0x21375d){return db[_0x6cf7('0x71')]['transaction'](function(_0x11ef0e){return _0x21375d[_0x6cf7('0x6a')](_0x24d2ac,{'transaction':_0x11ef0e})['then'](function(){return BPromise[_0x6cf7('0x72')](_0x3ad890,function(_0x4f332b){return db[_0x6cf7('0x59')][_0x6cf7('0x73')]({'where':{'UserId':_0x4f332b['id'],'MailQueueId':_0x933087[_0x6cf7('0x49')]['id']},'transaction':_0x11ef0e});});})[_0x6cf7('0x2a')](function(){_0x3ad890[_0x6cf7('0x74')](function(_0x3098df){socket[_0x6cf7('0x75')](_0x6cf7('0x76'),{'UserId':_0x3098df['id'],'MailQueueId':_0x21375d['id']});});});});});}})['then'](respondWithStatusCode(_0x1cdeed,null))[_0x6cf7('0x54')](handleError(_0x1cdeed,null));};exports[_0x6cf7('0x77')]=function(_0x8f0ca9,_0x30d3aa,_0x25d7d3){return db[_0x6cf7('0x68')]['findAll']({'where':{'id':_0x8f0ca9[_0x6cf7('0x3a')][_0x6cf7('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6cf7('0x2a')](handleEntityNotFound(_0x30d3aa,null))['then'](function(_0xd3f34){var _0x24f2c6=_[_0x6cf7('0x34')](_0xd3f34,'id');var _0x5875ce=[];var _0x119477=[];var _0xcf1a64=squel['select']();_0xcf1a64[_0x6cf7('0x78')]('tq.TeamId')['from'](_0x6cf7('0x79'),'tq')['join'](_0x6cf7('0x7a'),'ut',_0x6cf7('0x7b'))[_0x6cf7('0x40')](_0x6cf7('0x7c'),_0x8f0ca9[_0x6cf7('0x49')]['id']);for(var _0x216395=0x0;_0x216395<_0xd3f34['length'];_0x216395+=0x1){let _0x8d9ec9=_0xd3f34[_0x216395];for(var _0x1def91=0x0;_0x1def91<_0x8d9ec9[_0x6cf7('0x6d')][_0x6cf7('0x4b')];_0x1def91+=0x1){let _0x55caec=_0x8d9ec9[_0x6cf7('0x6d')][_0x1def91];var _0x8d60e6=_0xcf1a64[_0x6cf7('0x7d')]();_0x8d60e6[_0x6cf7('0x40')](_0x6cf7('0x7e'),_0x55caec['id']);_0x119477[_0x6cf7('0x7f')](db[_0x6cf7('0x71')][_0x6cf7('0x3a')](_0x8d60e6['toString'](),{'type':db[_0x6cf7('0x71')]['QueryTypes'][_0x6cf7('0x80')]})['then'](function(_0x2ef440){if(_0x2ef440[_0x6cf7('0x4b')]===0x1){return _0x55caec['id'];}else{var _0x125bd9=_['every'](_[_0x6cf7('0x34')](_0x2ef440,_0x6cf7('0x81')),function(_0x1ab25d){return _[_0x6cf7('0x82')](_0x24f2c6,_0x1ab25d);});if(_0x125bd9){return _0x55caec['id'];}}}));}}return BPromise['all'](_0x119477)[_0x6cf7('0x2a')](function(_0x1ed703){_0x5875ce=_(_0x5875ce)[_0x6cf7('0x83')](_0x1ed703)[_0x6cf7('0x84')]()['value']();return db['MailQueue'][_0x6cf7('0x4d')]({'where':{'id':_0x8f0ca9['params']['id']}})[_0x6cf7('0x2a')](function(_0x4a9ec2){return db[_0x6cf7('0x71')][_0x6cf7('0x85')](function(_0x587b13){return _0x4a9ec2[_0x6cf7('0x77')](_0x8f0ca9['query'][_0x6cf7('0x6b')],{'transaction':_0x587b13})[_0x6cf7('0x2a')](function(){if(!_[_0x6cf7('0x86')](_0x5875ce)){return _0x4a9ec2[_0x6cf7('0x87')](_0x5875ce,{'transaction':_0x587b13});}})[_0x6cf7('0x2a')](function(){_0x5875ce[_0x6cf7('0x74')](function(_0x13b08e){socket[_0x6cf7('0x75')](_0x6cf7('0x88'),{'UserId':_0x13b08e,'MailQueueId':_0x4a9ec2['id']});});});});});});})[_0x6cf7('0x2a')](respondWithStatusCode(_0x30d3aa,null))[_0x6cf7('0x54')](handleError(_0x30d3aa,null));};exports['addAgents']=function(_0x19f28d,_0x4547b7,_0x39e09b){return db['MailQueue'][_0x6cf7('0x4d')]({'where':{'id':_0x19f28d[_0x6cf7('0x49')]['id']}})[_0x6cf7('0x2a')](handleEntityNotFound(_0x4547b7,null))[_0x6cf7('0x2a')](function(_0x5a2d9e){if(_0x5a2d9e){return _0x5a2d9e[_0x6cf7('0x89')](_0x19f28d[_0x6cf7('0x56')][_0x6cf7('0x6b')],_[_0x6cf7('0x8a')](_0x19f28d[_0x6cf7('0x56')],['ids','id'])||{})[_0x6cf7('0x8b')](function(_0x5eb599){for(var _0xab62bf=0x0;_0xab62bf<_0x19f28d[_0x6cf7('0x56')][_0x6cf7('0x6b')][_0x6cf7('0x4b')];_0xab62bf+=0x1){socket[_0x6cf7('0x75')](_0x6cf7('0x76'),{'UserId':Number(_0x19f28d[_0x6cf7('0x56')][_0x6cf7('0x6b')][_0xab62bf]),'MailQueueId':Number(_0x19f28d[_0x6cf7('0x49')]['id'])});}return _0x5eb599;});}})['then'](respondWithResult(_0x4547b7,null))[_0x6cf7('0x54')](handleError(_0x4547b7,null));};exports['removeAgents']=function(_0x29db43,_0x29f6ee,_0x3819cd){return db[_0x6cf7('0x35')][_0x6cf7('0x4d')]({'where':{'id':_0x29db43[_0x6cf7('0x49')]['id']}})[_0x6cf7('0x2a')](handleEntityNotFound(_0x29f6ee,null))[_0x6cf7('0x2a')](function(_0x30a1f0){if(_0x30a1f0){return _0x30a1f0['removeAgents'](_0x29db43['query'][_0x6cf7('0x6b')])['then'](function(){if(_['isArray'](_0x29db43[_0x6cf7('0x3a')][_0x6cf7('0x6b')])){for(var _0x25f740=0x0;_0x25f740<_0x29db43['query'][_0x6cf7('0x6b')][_0x6cf7('0x4b')];_0x25f740+=0x1){socket[_0x6cf7('0x75')]('userMailQueue:remove',{'UserId':Number(_0x29db43[_0x6cf7('0x3a')]['ids'][_0x25f740]),'MailQueueId':Number(_0x29db43[_0x6cf7('0x49')]['id'])});}}else{socket[_0x6cf7('0x75')](_0x6cf7('0x88'),{'UserId':Number(_0x29db43[_0x6cf7('0x3a')][_0x6cf7('0x6b')]),'MailQueueId':Number(_0x29db43[_0x6cf7('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x29f6ee,null))[_0x6cf7('0x54')](handleError(_0x29f6ee,null));};exports[_0x6cf7('0x8c')]=function(_0x2c991f,_0x21a81f,_0x56cac8){var _0x2491a2={};var _0x1a39ec={};var _0x195787;var _0x40959c;return db[_0x6cf7('0x35')][_0x6cf7('0x58')]({'where':{'id':_0x2c991f['params']['id']}})['then'](handleEntityNotFound(_0x21a81f,null))[_0x6cf7('0x2a')](function(_0x3c3cc0){if(_0x3c3cc0){_0x195787=_0x3c3cc0;_0x1a39ec['model']=_[_0x6cf7('0x3b')](db[_0x6cf7('0x5f')]['rawAttributes']);_0x1a39ec['query']=_[_0x6cf7('0x3b')](_0x2c991f['query']);_0x1a39ec[_0x6cf7('0x3c')]=_[_0x6cf7('0x3d')](_0x1a39ec[_0x6cf7('0x39')],_0x1a39ec['query']);_0x2491a2[_0x6cf7('0x3e')]=_['intersection'](_0x1a39ec['model'],qs[_0x6cf7('0x4a')](_0x2c991f['query'][_0x6cf7('0x4a')]));_0x2491a2[_0x6cf7('0x3e')]=_0x2491a2[_0x6cf7('0x3e')][_0x6cf7('0x4b')]?_0x2491a2[_0x6cf7('0x3e')]:_0x1a39ec[_0x6cf7('0x39')];_0x2491a2[_0x6cf7('0x5d')]=qs[_0x6cf7('0x3f')](_0x2c991f[_0x6cf7('0x3a')][_0x6cf7('0x3f')]);_0x2491a2[_0x6cf7('0x40')]=qs['filters'](_['pick'](_0x2c991f['query'],_0x1a39ec['filters']));if(_0x2c991f[_0x6cf7('0x3a')]['filter']){_0x2491a2[_0x6cf7('0x40')]=_['merge'](_0x2491a2['where'],{'$or':_[_0x6cf7('0x34')](_0x2491a2[_0x6cf7('0x3e')],function(_0x527570){var _0x17ae38={};_0x17ae38[_0x527570]={'$like':'%'+_0x2c991f[_0x6cf7('0x3a')][_0x6cf7('0x41')]+'%'};return _0x17ae38;})});}_0x2491a2=_[_0x6cf7('0x42')]({},_0x2491a2,_0x2c991f[_0x6cf7('0x4c')]);return _0x195787[_0x6cf7('0x8c')](_0x2491a2);}})[_0x6cf7('0x2a')](function(_0x31ceee){if(_0x31ceee){_0x40959c=_0x31ceee['length'];if(!_0x2c991f['query'][_0x6cf7('0x5b')]('nolimit')){_0x2491a2[_0x6cf7('0x22')]=qs[_0x6cf7('0x22')](_0x2c991f[_0x6cf7('0x3a')][_0x6cf7('0x22')]);_0x2491a2[_0x6cf7('0x21')]=qs[_0x6cf7('0x21')](_0x2c991f[_0x6cf7('0x3a')]['offset']);}return _0x195787[_0x6cf7('0x8c')](_0x2491a2);}})[_0x6cf7('0x2a')](function(_0x236505){if(_0x236505){return _0x236505?{'count':_0x40959c,'rows':_0x236505}:null;}})[_0x6cf7('0x2a')](respondWithResult(_0x21a81f,null))[_0x6cf7('0x54')](handleError(_0x21a81f,null));}; \ No newline at end of file +var _0xcc2e=['key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','show','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','keys','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','format','SIP','createdAt','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userMailQueue:save','select','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','Agents','push','QueryTypes','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','forEach','userMailQueue:remove','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','map','MailQueue','rawAttributes','type'];(function(_0x834bb6,_0x1c5e35){var _0xa35d00=function(_0x14aeb3){while(--_0x14aeb3){_0x834bb6['push'](_0x834bb6['shift']());}};_0xa35d00(++_0x1c5e35);}(_0xcc2e,0xdd));var _0xecc2=function(_0x55f97e,_0x334a92){_0x55f97e=_0x55f97e-0x0;var _0x56e528=_0xcc2e[_0x55f97e];return _0x56e528;};'use strict';var emlformat=require(_0xecc2('0x0'));var rimraf=require(_0xecc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecc2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xecc2('0x3'));var Mustache=require(_0xecc2('0x4'));var util=require(_0xecc2('0x5'));var path=require(_0xecc2('0x6'));var sox=require(_0xecc2('0x7'));var csv=require(_0xecc2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecc2('0x9'));var squel=require(_0xecc2('0xa'));var crypto=require(_0xecc2('0xb'));var jsforce=require(_0xecc2('0xc'));var deskjs=require(_0xecc2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xecc2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xecc2('0xf'));var as=require(_0xecc2('0x10'));var hardwareService=require(_0xecc2('0x11'));var logger=require(_0xecc2('0x12'))(_0xecc2('0x13'));var utils=require(_0xecc2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xecc2('0x15'));var db=require(_0xecc2('0x16'))['db'];config['redis']=_[_0xecc2('0x17')](config[_0xecc2('0x18')],{'host':_0xecc2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecc2('0x18')]));require(_0xecc2('0x1a'))[_0xecc2('0x1b')](socket);function respondWithStatusCode(_0x16867c,_0x4657b5){_0x4657b5=_0x4657b5||0xcc;return function(_0x4f30c1){if(_0x4f30c1){return _0x16867c[_0xecc2('0x1c')](_0x4657b5);}return _0x16867c[_0xecc2('0x1d')](_0x4657b5)[_0xecc2('0x1e')]();};}function respondWithResult(_0x117a94,_0x28ff74){_0x28ff74=_0x28ff74||0xc8;return function(_0x250c34){if(_0x250c34){return _0x117a94['status'](_0x28ff74)[_0xecc2('0x1f')](_0x250c34);}};}function respondWithFilteredResult(_0x11a868,_0x5c5bb0){return function(_0x56dc66){if(_0x56dc66){var _0x5bc598=typeof _0x5c5bb0[_0xecc2('0x20')]===_0xecc2('0x21')&&typeof _0x5c5bb0[_0xecc2('0x22')]===_0xecc2('0x21');var _0x2d44d6=_0x56dc66[_0xecc2('0x23')];var _0x521be7=_0x5bc598?0x0:_0x5c5bb0[_0xecc2('0x20')];var _0x338a03=_0x5bc598?_0x56dc66[_0xecc2('0x23')]:_0x5c5bb0[_0xecc2('0x20')]+_0x5c5bb0[_0xecc2('0x22')];var _0x22b6bb;if(_0x338a03>=_0x2d44d6){_0x338a03=_0x2d44d6;_0x22b6bb=0xc8;}else{_0x22b6bb=0xce;}_0x11a868['status'](_0x22b6bb);return _0x11a868[_0xecc2('0x24')](_0xecc2('0x25'),_0x521be7+'-'+_0x338a03+'/'+_0x2d44d6)['json'](_0x56dc66);}return null;};}function patchUpdates(_0x4f01d0){return function(_0x333a60){try{jsonpatch[_0xecc2('0x26')](_0x333a60,_0x4f01d0,!![]);}catch(_0x7d29b3){return BPromise[_0xecc2('0x27')](_0x7d29b3);}return _0x333a60[_0xecc2('0x28')]();};}function saveUpdates(_0x1d18fe,_0x2a60aa){return function(_0x165af2){if(_0x165af2){return _0x165af2[_0xecc2('0x29')](_0x1d18fe)[_0xecc2('0x2a')](function(_0xb28430){return _0xb28430;});}return null;};}function removeEntity(_0x5054f4,_0x277413){return function(_0x5e0501){if(_0x5e0501){return _0x5e0501[_0xecc2('0x2b')]()['then'](function(){var _0x33eb11=_0x5e0501[_0xecc2('0x2c')]({'plain':!![]});var _0xadcbad=_0xecc2('0x2d');return db[_0xecc2('0x2e')]['destroy']({'where':{'type':_0xadcbad,'resourceId':_0x33eb11['id']}})[_0xecc2('0x2a')](function(){return _0x5e0501;});})[_0xecc2('0x2a')](function(){_0x5054f4[_0xecc2('0x1d')](0xcc)[_0xecc2('0x1e')]();});}};}function handleEntityNotFound(_0x29b6a3,_0x2b8d71){return function(_0x2a9b46){if(!_0x2a9b46){_0x29b6a3[_0xecc2('0x1c')](0x194);}return _0x2a9b46;};}function handleError(_0x5ba4ee,_0x42f4e1){_0x42f4e1=_0x42f4e1||0x1f4;return function(_0x10805b){logger[_0xecc2('0x2f')](_0x10805b[_0xecc2('0x30')]);if(_0x10805b[_0xecc2('0x31')]){delete _0x10805b[_0xecc2('0x31')];}_0x5ba4ee[_0xecc2('0x1d')](_0x42f4e1)[_0xecc2('0x32')](_0x10805b);};}exports['index']=function(_0x5cbfaf,_0xae01b7){var _0x4a9ec6={},_0x196ce1={},_0x54dd35={'count':0x0,'rows':[]};var _0xe98388=_[_0xecc2('0x33')](db[_0xecc2('0x34')][_0xecc2('0x35')],function(_0x518c02){return{'name':_0x518c02['fieldName'],'type':_0x518c02[_0xecc2('0x36')][_0xecc2('0x37')]};});_0x196ce1[_0xecc2('0x38')]=_['map'](_0xe98388,_0xecc2('0x31'));_0x196ce1[_0xecc2('0x39')]=_['keys'](_0x5cbfaf['query']);_0x196ce1['filters']=_[_0xecc2('0x3a')](_0x196ce1[_0xecc2('0x38')],_0x196ce1[_0xecc2('0x39')]);_0x4a9ec6[_0xecc2('0x3b')]=_['intersection'](_0x196ce1['model'],qs['fields'](_0x5cbfaf[_0xecc2('0x39')][_0xecc2('0x3c')]));_0x4a9ec6['attributes']=_0x4a9ec6['attributes']['length']?_0x4a9ec6[_0xecc2('0x3b')]:_0x196ce1[_0xecc2('0x38')];if(!_0x5cbfaf[_0xecc2('0x39')][_0xecc2('0x3d')](_0xecc2('0x3e'))){_0x4a9ec6['limit']=qs[_0xecc2('0x22')](_0x5cbfaf[_0xecc2('0x39')]['limit']);_0x4a9ec6[_0xecc2('0x20')]=qs[_0xecc2('0x20')](_0x5cbfaf['query'][_0xecc2('0x20')]);}_0x4a9ec6[_0xecc2('0x3f')]=qs[_0xecc2('0x40')](_0x5cbfaf['query'][_0xecc2('0x40')]);_0x4a9ec6[_0xecc2('0x41')]=qs[_0xecc2('0x42')](_[_0xecc2('0x43')](_0x5cbfaf['query'],_0x196ce1['filters']),_0xe98388);if(_0x5cbfaf[_0xecc2('0x39')]['filter']){_0x4a9ec6[_0xecc2('0x41')]=_[_0xecc2('0x44')](_0x4a9ec6['where'],{'$or':_['map'](_0xe98388,function(_0x5c6960){if(_0x5c6960[_0xecc2('0x36')]!==_0xecc2('0x45')){var _0x20563d={};_0x20563d[_0x5c6960[_0xecc2('0x31')]]={'$like':'%'+_0x5cbfaf[_0xecc2('0x39')][_0xecc2('0x46')]+'%'};return _0x20563d;}})});}_0x4a9ec6=_[_0xecc2('0x44')]({},_0x4a9ec6,_0x5cbfaf[_0xecc2('0x47')]);var _0x577b5b={'where':_0x4a9ec6['where']};return db[_0xecc2('0x34')]['count'](_0x577b5b)['then'](function(_0x5ba489){_0x54dd35[_0xecc2('0x23')]=_0x5ba489;if(_0x5cbfaf[_0xecc2('0x39')]['includeAll']){_0x4a9ec6['include']=[{'all':!![]}];}return db[_0xecc2('0x34')][_0xecc2('0x48')](_0x4a9ec6);})[_0xecc2('0x2a')](function(_0x287a99){_0x54dd35[_0xecc2('0x49')]=_0x287a99;return _0x54dd35;})[_0xecc2('0x2a')](respondWithFilteredResult(_0xae01b7,_0x4a9ec6))['catch'](handleError(_0xae01b7,null));};exports[_0xecc2('0x4a')]=function(_0x5688ad,_0x57a293){var _0x58fcd1={'raw':!![],'where':{'id':_0x5688ad['params']['id']}},_0x1de9ca={};_0x1de9ca[_0xecc2('0x38')]=_['keys'](db[_0xecc2('0x34')][_0xecc2('0x35')]);_0x1de9ca[_0xecc2('0x39')]=_['keys'](_0x5688ad[_0xecc2('0x39')]);_0x1de9ca[_0xecc2('0x42')]=_[_0xecc2('0x3a')](_0x1de9ca['model'],_0x1de9ca[_0xecc2('0x39')]);_0x58fcd1['attributes']=_[_0xecc2('0x3a')](_0x1de9ca[_0xecc2('0x38')],qs[_0xecc2('0x3c')](_0x5688ad['query'][_0xecc2('0x3c')]));_0x58fcd1[_0xecc2('0x3b')]=_0x58fcd1[_0xecc2('0x3b')][_0xecc2('0x4b')]?_0x58fcd1[_0xecc2('0x3b')]:_0x1de9ca[_0xecc2('0x38')];if(_0x5688ad[_0xecc2('0x39')]['includeAll']){_0x58fcd1[_0xecc2('0x4c')]=[{'all':!![]}];}_0x58fcd1=_['merge']({},_0x58fcd1,_0x5688ad[_0xecc2('0x47')]);return db[_0xecc2('0x34')][_0xecc2('0x4d')](_0x58fcd1)[_0xecc2('0x2a')](handleEntityNotFound(_0x57a293,null))[_0xecc2('0x2a')](respondWithResult(_0x57a293,null))[_0xecc2('0x4e')](handleError(_0x57a293,null));};exports[_0xecc2('0x4f')]=function(_0x5cf363,_0x3bb5c8){return db[_0xecc2('0x34')]['create'](_0x5cf363[_0xecc2('0x50')],{})[_0xecc2('0x2a')](function(_0x41141d){var _0x29c09b=_0x5cf363[_0xecc2('0x51')]['get']({'plain':!![]});if(!_0x29c09b)throw new Error(_0xecc2('0x52'));if(_0x29c09b[_0xecc2('0x53')]===_0xecc2('0x51')){var _0x25d1d2=_0x41141d[_0xecc2('0x2c')]({'plain':!![]});var _0x53d709=_0xecc2('0x2d');return db['UserProfileSection'][_0xecc2('0x4d')]({'where':{'name':_0x53d709,'userProfileId':_0x29c09b[_0xecc2('0x54')]},'raw':!![]})[_0xecc2('0x2a')](function(_0x4a9cf4){if(_0x4a9cf4&&_0x4a9cf4[_0xecc2('0x55')]===0x0){return db[_0xecc2('0x2e')][_0xecc2('0x4f')]({'name':_0x25d1d2[_0xecc2('0x31')],'resourceId':_0x25d1d2['id'],'type':_0x4a9cf4[_0xecc2('0x31')],'sectionId':_0x4a9cf4['id']},{})[_0xecc2('0x2a')](function(){return _0x41141d;});}else{return _0x41141d;}})[_0xecc2('0x4e')](function(_0x1a4ec3){logger[_0xecc2('0x2f')](_0xecc2('0x56'),_0x1a4ec3);throw _0x1a4ec3;});}return _0x41141d;})['then'](respondWithResult(_0x3bb5c8,0xc9))[_0xecc2('0x4e')](handleError(_0x3bb5c8,null));};exports[_0xecc2('0x29')]=function(_0x45a5d6,_0x2325d3){if(_0x45a5d6[_0xecc2('0x50')]['id']){delete _0x45a5d6[_0xecc2('0x50')]['id'];}return db[_0xecc2('0x34')]['find']({'where':{'id':_0x45a5d6['params']['id']}})[_0xecc2('0x2a')](handleEntityNotFound(_0x2325d3,null))[_0xecc2('0x2a')](saveUpdates(_0x45a5d6[_0xecc2('0x50')],null))[_0xecc2('0x2a')](respondWithResult(_0x2325d3,null))[_0xecc2('0x4e')](handleError(_0x2325d3,null));};exports[_0xecc2('0x2b')]=function(_0x537032,_0x1be6a0){return db[_0xecc2('0x34')]['find']({'where':{'id':_0x537032[_0xecc2('0x57')]['id']}})[_0xecc2('0x2a')](handleEntityNotFound(_0x1be6a0,null))['then'](removeEntity(_0x1be6a0,null))[_0xecc2('0x4e')](handleError(_0x1be6a0,null));};exports['describe']=function(_0x1555e9,_0x43430d){return db[_0xecc2('0x34')]['describe']()[_0xecc2('0x2a')](respondWithResult(_0x43430d,null))[_0xecc2('0x4e')](handleError(_0x43430d,null));};exports[_0xecc2('0x58')]=function(_0x409f28,_0x14f9de,_0x4fc3c0){var _0x48eaad={'raw':!![],'where':{}},_0x2fcbc6={},_0x510185;return db[_0xecc2('0x34')][_0xecc2('0x59')]({'where':{'id':_0x409f28[_0xecc2('0x57')]['id']}})[_0xecc2('0x2a')](handleEntityNotFound(_0x14f9de,null))[_0xecc2('0x2a')](function(_0x24adba){if(_0x24adba){_0x510185=_0x24adba[_0xecc2('0x2c')]({'plain':!![]});_0x2fcbc6['model']=_[_0xecc2('0x5a')](db[_0xecc2('0x5b')]['rawAttributes']);_0x2fcbc6[_0xecc2('0x39')]=_[_0xecc2('0x5a')](_0x409f28[_0xecc2('0x39')]);_0x2fcbc6['filters']=_[_0xecc2('0x3a')](_0x2fcbc6[_0xecc2('0x38')],_0x2fcbc6[_0xecc2('0x39')]);_0x48eaad[_0xecc2('0x3b')]=_[_0xecc2('0x3a')](_0x2fcbc6['model'],qs[_0xecc2('0x3c')](_0x409f28[_0xecc2('0x39')][_0xecc2('0x3c')]));_0x48eaad['attributes']=_0x48eaad[_0xecc2('0x3b')][_0xecc2('0x4b')]?_0x48eaad[_0xecc2('0x3b')]:_0x2fcbc6[_0xecc2('0x38')];if(!_0x409f28[_0xecc2('0x39')][_0xecc2('0x3d')]('nolimit')){_0x48eaad['limit']=qs[_0xecc2('0x22')](_0x409f28['query'][_0xecc2('0x22')]);_0x48eaad[_0xecc2('0x20')]=qs['offset'](_0x409f28[_0xecc2('0x39')][_0xecc2('0x20')]);}_0x48eaad[_0xecc2('0x3f')]=qs[_0xecc2('0x40')](_0x409f28[_0xecc2('0x39')][_0xecc2('0x40')]);_0x48eaad[_0xecc2('0x41')]=qs[_0xecc2('0x42')](_['pick'](_0x409f28['query'],_0x2fcbc6['filters']));_0x48eaad['where'][_0xecc2('0x5c')]=_0x24adba['id'];if(_0x409f28[_0xecc2('0x39')][_0xecc2('0x46')]){_0x48eaad[_0xecc2('0x41')]=_['merge'](_0x48eaad[_0xecc2('0x41')],{'$or':_[_0xecc2('0x33')](_0x48eaad[_0xecc2('0x3b')],function(_0x33b110){var _0x74dbed={};_0x74dbed[_0x33b110]={'$like':'%'+_0x409f28[_0xecc2('0x39')]['filter']+'%'};return _0x74dbed;})});}_0x48eaad=_['merge']({},_0x48eaad,_0x409f28['options']);return db[_0xecc2('0x5b')][_0xecc2('0x48')](_0x48eaad);}})[_0xecc2('0x2a')](function(_0x495adc){if(_0x495adc){return db[_0xecc2('0x5d')][_0xecc2('0x5e')]({'where':{'id':_[_0xecc2('0x33')](_0x495adc,_0xecc2('0x5f')),'role':'agent'},'attributes':['id',_0xecc2('0x31'),_0xecc2('0x60'),_0xecc2('0x61'),'createdAt']});}})['then'](function(_0x2e4309){if(_0x2e4309){return{'count':_0x2e4309[_0xecc2('0x23')],'rows':_[_0xecc2('0x33')](_0x2e4309[_0xecc2('0x49')],function(_0x16b789){return{'membername':_0x16b789['name'],'UserId':_0x16b789['id'],'queue_name':_0x510185[_0xecc2('0x31')],'MailQueueId':_0x510185['id'],'interface':util[_0xecc2('0x62')]('%s/%s',_0xecc2('0x63'),_0x16b789['name']),'penalty':0x0,'paused':_0x16b789[_0xecc2('0x60')],'createdAt':_0x16b789[_0xecc2('0x64')],'updatedAt':_0x16b789['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xecc2('0x2a')](respondWithFilteredResult(_0x14f9de,_0x48eaad))[_0xecc2('0x4e')](handleError(_0x14f9de,null));};exports['getTeams']=function(_0x4ef879,_0x7777bf,_0x248ca0){var _0x10dd65={};var _0x1f889d={};var _0x4e2013;var _0x1540c3;return db[_0xecc2('0x34')][_0xecc2('0x59')]({'where':{'id':_0x4ef879[_0xecc2('0x57')]['id']}})[_0xecc2('0x2a')](handleEntityNotFound(_0x7777bf,null))[_0xecc2('0x2a')](function(_0x2f2230){if(_0x2f2230){_0x4e2013=_0x2f2230;_0x1f889d['model']=_[_0xecc2('0x5a')](db[_0xecc2('0x65')][_0xecc2('0x35')]);_0x1f889d[_0xecc2('0x39')]=_[_0xecc2('0x5a')](_0x4ef879[_0xecc2('0x39')]);_0x1f889d[_0xecc2('0x42')]=_['intersection'](_0x1f889d['model'],_0x1f889d['query']);_0x10dd65[_0xecc2('0x3b')]=_[_0xecc2('0x3a')](_0x1f889d['model'],qs['fields'](_0x4ef879[_0xecc2('0x39')][_0xecc2('0x3c')]));_0x10dd65[_0xecc2('0x3b')]=_0x10dd65[_0xecc2('0x3b')][_0xecc2('0x4b')]?_0x10dd65[_0xecc2('0x3b')]:_0x1f889d[_0xecc2('0x38')];_0x10dd65[_0xecc2('0x3f')]=qs[_0xecc2('0x40')](_0x4ef879[_0xecc2('0x39')][_0xecc2('0x40')]);_0x10dd65[_0xecc2('0x41')]=qs[_0xecc2('0x42')](_[_0xecc2('0x43')](_0x4ef879[_0xecc2('0x39')],_0x1f889d[_0xecc2('0x42')]));if(_0x4ef879['query']['filter']){_0x10dd65[_0xecc2('0x41')]=_[_0xecc2('0x44')](_0x10dd65['where'],{'$or':_['map'](_0x10dd65[_0xecc2('0x3b')],function(_0x2952f0){var _0x3f34ae={};_0x3f34ae[_0x2952f0]={'$like':'%'+_0x4ef879[_0xecc2('0x39')][_0xecc2('0x46')]+'%'};return _0x3f34ae;})});}_0x10dd65=_[_0xecc2('0x44')]({},_0x10dd65,_0x4ef879[_0xecc2('0x47')]);return _0x4e2013[_0xecc2('0x66')](_0x10dd65);}})[_0xecc2('0x2a')](function(_0x172236){if(_0x172236){_0x1540c3=_0x172236['length'];if(!_0x4ef879[_0xecc2('0x39')]['hasOwnProperty'](_0xecc2('0x3e'))){_0x10dd65['limit']=qs[_0xecc2('0x22')](_0x4ef879[_0xecc2('0x39')]['limit']);_0x10dd65[_0xecc2('0x20')]=qs[_0xecc2('0x20')](_0x4ef879[_0xecc2('0x39')]['offset']);}return _0x4e2013[_0xecc2('0x66')](_0x10dd65);}})[_0xecc2('0x2a')](function(_0x15d3cc){if(_0x15d3cc){return _0x15d3cc?{'count':_0x1540c3,'rows':_0x15d3cc}:null;}})[_0xecc2('0x2a')](respondWithResult(_0x7777bf,null))[_0xecc2('0x4e')](handleError(_0x7777bf,null));};exports[_0xecc2('0x67')]=function(_0x472b0f,_0xabd6cc,_0x4f7759){var _0x151c7=_0x472b0f[_0xecc2('0x50')][_0xecc2('0x68')];return db[_0xecc2('0x65')][_0xecc2('0x48')]({'where':{'id':_0x151c7},'attributes':['id'],'include':[{'model':db[_0xecc2('0x5d')],'as':'Agents','attributes':['id','name',_0xecc2('0x69'),_0xecc2('0x6a'),_0xecc2('0x6b')],'raw':!![]}]})[_0xecc2('0x2a')](function(_0x4d6cb6){if(_0x4d6cb6){var _0x3c341d=_[_0xecc2('0x6c')](_0x4d6cb6,function(_0x2ccb0c){var _0x80e836=_0x2ccb0c[_0xecc2('0x2c')]({'plain':!![]});return _0x80e836['Agents'];});return db[_0xecc2('0x34')][_0xecc2('0x4d')]({'where':{'id':_0x472b0f[_0xecc2('0x57')]['id']}})['then'](function(_0xd76047){return db[_0xecc2('0x6d')][_0xecc2('0x6e')](function(_0x593f43){return _0xd76047[_0xecc2('0x67')](_0x151c7,{'transaction':_0x593f43})[_0xecc2('0x2a')](function(){return BPromise[_0xecc2('0x6f')](_0x3c341d,function(_0x2fdd62){return db[_0xecc2('0x5b')]['findOrCreate']({'where':{'UserId':_0x2fdd62['id'],'MailQueueId':_0x472b0f[_0xecc2('0x57')]['id']},'transaction':_0x593f43});});})[_0xecc2('0x2a')](function(){_0x3c341d['forEach'](function(_0x5e7671){socket[_0xecc2('0x70')](_0xecc2('0x71'),{'UserId':_0x5e7671['id'],'MailQueueId':_0xd76047['id']});});});});});}})[_0xecc2('0x2a')](respondWithStatusCode(_0xabd6cc,null))[_0xecc2('0x4e')](handleError(_0xabd6cc,null));};exports['removeTeams']=function(_0x53fde7,_0x5e9303,_0xad4d0d){return db[_0xecc2('0x65')][_0xecc2('0x48')]({'where':{'id':_0x53fde7[_0xecc2('0x39')][_0xecc2('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xecc2('0x2a')](handleEntityNotFound(_0x5e9303,null))['then'](function(_0x4aa515){var _0x157074=_[_0xecc2('0x33')](_0x4aa515,'id');var _0x15bfbf=[];var _0x38c5ce=[];var _0x241504=squel[_0xecc2('0x72')]();_0x241504['field'](_0xecc2('0x73'))['from'](_0xecc2('0x74'),'tq')[_0xecc2('0x75')](_0xecc2('0x76'),'ut',_0xecc2('0x77'))[_0xecc2('0x41')](_0xecc2('0x78'),_0x53fde7[_0xecc2('0x57')]['id']);for(var _0x5ca4a9=0x0;_0x5ca4a9<_0x4aa515[_0xecc2('0x4b')];_0x5ca4a9+=0x1){let _0x2e7a14=_0x4aa515[_0x5ca4a9];for(var _0x1e39ad=0x0;_0x1e39ad<_0x2e7a14[_0xecc2('0x79')]['length'];_0x1e39ad+=0x1){let _0x15e5c8=_0x2e7a14[_0xecc2('0x79')][_0x1e39ad];var _0x5179b8=_0x241504['clone']();_0x5179b8[_0xecc2('0x41')]('ut.UserId\x20=\x20?',_0x15e5c8['id']);_0x38c5ce[_0xecc2('0x7a')](db[_0xecc2('0x6d')]['query'](_0x5179b8['toString'](),{'type':db[_0xecc2('0x6d')][_0xecc2('0x7b')]['SELECT']})[_0xecc2('0x2a')](function(_0x2c5ca4){if(_0x2c5ca4[_0xecc2('0x4b')]===0x1){return _0x15e5c8['id'];}else{var _0x85dfbc=_[_0xecc2('0x7c')](_[_0xecc2('0x33')](_0x2c5ca4,_0xecc2('0x7d')),function(_0x21322c){return _[_0xecc2('0x7e')](_0x157074,_0x21322c);});if(_0x85dfbc){return _0x15e5c8['id'];}}}));}}return BPromise[_0xecc2('0x7f')](_0x38c5ce)[_0xecc2('0x2a')](function(_0x282198){_0x15bfbf=_(_0x15bfbf)[_0xecc2('0x80')](_0x282198)['compact']()[_0xecc2('0x81')]();return db[_0xecc2('0x34')][_0xecc2('0x4d')]({'where':{'id':_0x53fde7[_0xecc2('0x57')]['id']}})['then'](function(_0x5a6310){return db[_0xecc2('0x6d')][_0xecc2('0x6e')](function(_0x92db61){return _0x5a6310[_0xecc2('0x82')](_0x53fde7['query']['ids'],{'transaction':_0x92db61})[_0xecc2('0x2a')](function(){if(!_[_0xecc2('0x83')](_0x15bfbf)){return _0x5a6310[_0xecc2('0x84')](_0x15bfbf,{'transaction':_0x92db61});}})['then'](function(){_0x15bfbf[_0xecc2('0x85')](function(_0x702385){socket[_0xecc2('0x70')](_0xecc2('0x86'),{'UserId':_0x702385,'MailQueueId':_0x5a6310['id']});});});});});});})[_0xecc2('0x2a')](respondWithStatusCode(_0x5e9303,null))[_0xecc2('0x4e')](handleError(_0x5e9303,null));};exports['addAgents']=function(_0x5b7a60,_0x3d37fc,_0x575689){return db[_0xecc2('0x34')][_0xecc2('0x4d')]({'where':{'id':_0x5b7a60[_0xecc2('0x57')]['id']}})[_0xecc2('0x2a')](handleEntityNotFound(_0x3d37fc,null))['then'](function(_0xd60fe1){if(_0xd60fe1){return _0xd60fe1['addAgents'](_0x5b7a60[_0xecc2('0x50')][_0xecc2('0x68')],_['omit'](_0x5b7a60['body'],[_0xecc2('0x68'),'id'])||{})[_0xecc2('0x87')](function(_0xa862bf){for(var _0x295ffd=0x0;_0x295ffd<_0x5b7a60['body'][_0xecc2('0x68')][_0xecc2('0x4b')];_0x295ffd+=0x1){socket[_0xecc2('0x70')](_0xecc2('0x71'),{'UserId':Number(_0x5b7a60[_0xecc2('0x50')][_0xecc2('0x68')][_0x295ffd]),'MailQueueId':Number(_0x5b7a60[_0xecc2('0x57')]['id'])});}return _0xa862bf;});}})['then'](respondWithResult(_0x3d37fc,null))[_0xecc2('0x4e')](handleError(_0x3d37fc,null));};exports[_0xecc2('0x84')]=function(_0x4a8026,_0xe02f79,_0x1131e3){return db[_0xecc2('0x34')][_0xecc2('0x4d')]({'where':{'id':_0x4a8026[_0xecc2('0x57')]['id']}})['then'](handleEntityNotFound(_0xe02f79,null))[_0xecc2('0x2a')](function(_0x101014){if(_0x101014){return _0x101014['removeAgents'](_0x4a8026[_0xecc2('0x39')][_0xecc2('0x68')])[_0xecc2('0x2a')](function(){if(_[_0xecc2('0x88')](_0x4a8026[_0xecc2('0x39')]['ids'])){for(var _0x5eec4b=0x0;_0x5eec4b<_0x4a8026[_0xecc2('0x39')]['ids']['length'];_0x5eec4b+=0x1){socket[_0xecc2('0x70')](_0xecc2('0x86'),{'UserId':Number(_0x4a8026[_0xecc2('0x39')]['ids'][_0x5eec4b]),'MailQueueId':Number(_0x4a8026[_0xecc2('0x57')]['id'])});}}else{socket[_0xecc2('0x70')](_0xecc2('0x86'),{'UserId':Number(_0x4a8026[_0xecc2('0x39')][_0xecc2('0x68')]),'MailQueueId':Number(_0x4a8026[_0xecc2('0x57')]['id'])});}});}})[_0xecc2('0x2a')](respondWithStatusCode(_0xe02f79,null))[_0xecc2('0x4e')](handleError(_0xe02f79,null));};exports[_0xecc2('0x89')]=function(_0x16dd88,_0x3407fa,_0x235c8a){var _0x5aaa0b={};var _0x30de3d={};var _0x26087d;var _0x1a4a67;return db[_0xecc2('0x34')]['findOne']({'where':{'id':_0x16dd88[_0xecc2('0x57')]['id']}})[_0xecc2('0x2a')](handleEntityNotFound(_0x3407fa,null))[_0xecc2('0x2a')](function(_0x2b396b){if(_0x2b396b){_0x26087d=_0x2b396b;_0x30de3d[_0xecc2('0x38')]=_[_0xecc2('0x5a')](db[_0xecc2('0x5d')][_0xecc2('0x35')]);_0x30de3d[_0xecc2('0x39')]=_[_0xecc2('0x5a')](_0x16dd88[_0xecc2('0x39')]);_0x30de3d[_0xecc2('0x42')]=_[_0xecc2('0x3a')](_0x30de3d['model'],_0x30de3d['query']);_0x5aaa0b['attributes']=_['intersection'](_0x30de3d['model'],qs[_0xecc2('0x3c')](_0x16dd88[_0xecc2('0x39')][_0xecc2('0x3c')]));_0x5aaa0b[_0xecc2('0x3b')]=_0x5aaa0b[_0xecc2('0x3b')]['length']?_0x5aaa0b[_0xecc2('0x3b')]:_0x30de3d['model'];_0x5aaa0b['order']=qs[_0xecc2('0x40')](_0x16dd88['query'][_0xecc2('0x40')]);_0x5aaa0b[_0xecc2('0x41')]=qs[_0xecc2('0x42')](_[_0xecc2('0x43')](_0x16dd88['query'],_0x30de3d['filters']));if(_0x16dd88[_0xecc2('0x39')][_0xecc2('0x46')]){_0x5aaa0b['where']=_['merge'](_0x5aaa0b[_0xecc2('0x41')],{'$or':_['map'](_0x5aaa0b[_0xecc2('0x3b')],function(_0x46d829){var _0x5e6b8d={};_0x5e6b8d[_0x46d829]={'$like':'%'+_0x16dd88[_0xecc2('0x39')][_0xecc2('0x46')]+'%'};return _0x5e6b8d;})});}_0x5aaa0b=_[_0xecc2('0x44')]({},_0x5aaa0b,_0x16dd88[_0xecc2('0x47')]);return _0x26087d[_0xecc2('0x89')](_0x5aaa0b);}})['then'](function(_0x58102b){if(_0x58102b){_0x1a4a67=_0x58102b[_0xecc2('0x4b')];if(!_0x16dd88[_0xecc2('0x39')][_0xecc2('0x3d')](_0xecc2('0x3e'))){_0x5aaa0b[_0xecc2('0x22')]=qs['limit'](_0x16dd88['query'][_0xecc2('0x22')]);_0x5aaa0b[_0xecc2('0x20')]=qs[_0xecc2('0x20')](_0x16dd88[_0xecc2('0x39')][_0xecc2('0x20')]);}return _0x26087d[_0xecc2('0x89')](_0x5aaa0b);}})['then'](function(_0x217c66){if(_0x217c66){return _0x217c66?{'count':_0x1a4a67,'rows':_0x217c66}:null;}})['then'](respondWithResult(_0x3407fa,null))['catch'](handleError(_0x3407fa,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 449b8e7..229f29a 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 _0x02ca=['events','MailQueue','setMaxListeners','save','update','remove','emit','exports'];(function(_0x379e64,_0x348013){var _0x33992e=function(_0x2b1bc7){while(--_0x2b1bc7){_0x379e64['push'](_0x379e64['shift']());}};_0x33992e(++_0x348013);}(_0x02ca,0x78));var _0xa02c=function(_0x1fa6dd,_0x4b6663){_0x1fa6dd=_0x1fa6dd-0x0;var _0x175d2d=_0x02ca[_0x1fa6dd];return _0x175d2d;};'use strict';var EventEmitter=require(_0xa02c('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xa02c('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa02c('0x2')](0x0);var events={'afterCreate':_0xa02c('0x3'),'afterUpdate':_0xa02c('0x4'),'afterDestroy':_0xa02c('0x5')};function emitEvent(_0x46230c){return function(_0x2a9ed3,_0x3c8d63,_0xe1b365){MailQueueEvents[_0xa02c('0x6')](_0x46230c+':'+_0x2a9ed3['id'],_0x2a9ed3);MailQueueEvents[_0xa02c('0x6')](_0x46230c,_0x2a9ed3);_0xe1b365(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xa02c('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xc14e=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x120a2c,_0x4ef6b3){var _0x1fd625=function(_0x108c31){while(--_0x108c31){_0x120a2c['push'](_0x120a2c['shift']());}};_0x1fd625(++_0x4ef6b3);}(_0xc14e,0x1c2));var _0xec14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc14e[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xec14('0x0'));var MailQueue=require(_0xec14('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xec14('0x2')](0x0);var events={'afterCreate':_0xec14('0x3'),'afterUpdate':_0xec14('0x4'),'afterDestroy':'remove'};function emitEvent(_0x118603){return function(_0x5520cb,_0x4a356d,_0x18743d){MailQueueEvents[_0xec14('0x5')](_0x118603+':'+_0x5520cb['id'],_0x5520cb);MailQueueEvents[_0xec14('0x5')](_0x118603,_0x5520cb);_0x18743d(null);};}for(var e in events){if(events[_0xec14('0x6')](e)){var event=events[e];MailQueue['hook'](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 72d407d..f94c228 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 _0x050f=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','mail_queues','lodash','util','api','bluebird'];(function(_0x2b0af7,_0x4d41e2){var _0x35ed55=function(_0x3489d){while(--_0x3489d){_0x2b0af7['push'](_0x2b0af7['shift']());}};_0x35ed55(++_0x4d41e2);}(_0x050f,0x125));var _0xf050=function(_0x14807c,_0xddec5b){_0x14807c=_0x14807c-0x0;var _0x333d8d=_0x050f[_0x14807c];return _0x333d8d;};'use strict';var _=require(_0xf050('0x0'));var util=require(_0xf050('0x1'));var logger=require('../../config/logger')(_0xf050('0x2'));var moment=require('moment');var BPromise=require(_0xf050('0x3'));var rp=require(_0xf050('0x4'));var fs=require('fs');var path=require(_0xf050('0x5'));var rimraf=require(_0xf050('0x6'));var config=require(_0xf050('0x7'));var attributes=require(_0xf050('0x8'));module[_0xf050('0x9')]=function(_0x345284,_0x208638){return _0x345284['define']('MailQueue',attributes,{'tableName':_0xf050('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97ee=['exports','define','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x33fc3e,_0x309d82){var _0x4e9e62=function(_0x2039dd){while(--_0x2039dd){_0x33fc3e['push'](_0x33fc3e['shift']());}};_0x4e9e62(++_0x309d82);}(_0x97ee,0x1b5));var _0xe97e=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x97ee[_0xda464c];return _0x19e222;};'use strict';var _=require(_0xe97e('0x0'));var util=require(_0xe97e('0x1'));var logger=require(_0xe97e('0x2'))(_0xe97e('0x3'));var moment=require(_0xe97e('0x4'));var BPromise=require(_0xe97e('0x5'));var rp=require(_0xe97e('0x6'));var fs=require('fs');var path=require(_0xe97e('0x7'));var rimraf=require(_0xe97e('0x8'));var config=require(_0xe97e('0x9'));var attributes=require(_0xe97e('0xa'));module[_0xe97e('0xb')]=function(_0x3f7888,_0x16f522){return _0x3f7888[_0xe97e('0xc')](_0xe97e('0xd'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 16ebf6b..d3ec182 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 _0x8b88=['then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailQueue','findAll','options','raw','attributes','include','map','model','info','stringify','catch','ShowMailQueue','MailQueue','find','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','request'];(function(_0x32b8f7,_0x1d5f1c){var _0x50207d=function(_0x69f635){while(--_0x69f635){_0x32b8f7['push'](_0x32b8f7['shift']());}};_0x50207d(++_0x1d5f1c);}(_0x8b88,0x14f));var _0x88b8=function(_0x5c90cf,_0x1c5c30){_0x5c90cf=_0x5c90cf-0x0;var _0x49254d=_0x8b88[_0x5c90cf];return _0x49254d;};'use strict';var _=require('lodash');var util=require(_0x88b8('0x0'));var moment=require('moment');var BPromise=require(_0x88b8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88b8('0x2'));var db=require(_0x88b8('0x3'))['db'];var utils=require(_0x88b8('0x4'));var logger=require(_0x88b8('0x5'))(_0x88b8('0x6'));var config=require(_0x88b8('0x7'));var jayson=require(_0x88b8('0x8'));var client=jayson[_0x88b8('0x9')][_0x88b8('0xa')]({'port':0x232a});config[_0x88b8('0xb')]=_[_0x88b8('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x88b8('0xd'))(new Redis(config[_0x88b8('0xb')]));require(_0x88b8('0xe'))['register'](socket);function respondWithRpcPromise(_0x2650c0,_0x301cb3,_0x1edf61){return new BPromise(function(_0x5559a4,_0x73bdd4){return client[_0x88b8('0xf')](_0x2650c0,_0x1edf61)[_0x88b8('0x10')](function(_0x51b6f2){logger['info'](_0x88b8('0x11'),_0x301cb3,_0x88b8('0x12'));logger[_0x88b8('0x13')](_0x88b8('0x14'),_0x301cb3,'request\x20sent',JSON['stringify'](_0x51b6f2));if(_0x51b6f2[_0x88b8('0x15')]){if(_0x51b6f2['error'][_0x88b8('0x16')]===0x1f4){logger[_0x88b8('0x15')]('MailQueue,\x20%s,\x20%s',_0x301cb3,_0x51b6f2[_0x88b8('0x15')][_0x88b8('0x17')]);return _0x73bdd4(_0x51b6f2[_0x88b8('0x15')]['message']);}logger['error'](_0x88b8('0x11'),_0x301cb3,_0x51b6f2['error'][_0x88b8('0x17')]);return _0x5559a4(_0x51b6f2[_0x88b8('0x15')][_0x88b8('0x17')]);}else{logger['info'](_0x88b8('0x11'),_0x301cb3,_0x88b8('0x12'));_0x5559a4(_0x51b6f2[_0x88b8('0x18')][_0x88b8('0x17')]);}})['catch'](function(_0x416633){logger[_0x88b8('0x15')](_0x88b8('0x11'),_0x301cb3,_0x416633);_0x73bdd4(_0x416633);});});}exports[_0x88b8('0x19')]=function(_0x3f412c){var _0x2cc7df=this;return new Promise(function(_0x2fc8f6,_0x4c38ef){return db['MailQueue'][_0x88b8('0x1a')]({'raw':_0x3f412c[_0x88b8('0x1b')]?_0x3f412c[_0x88b8('0x1b')][_0x88b8('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f412c[_0x88b8('0x1b')]?_0x3f412c[_0x88b8('0x1b')]['where']||null:null,'attributes':_0x3f412c[_0x88b8('0x1b')]?_0x3f412c[_0x88b8('0x1b')][_0x88b8('0x1d')]||null:null,'limit':_0x3f412c[_0x88b8('0x1b')]?_0x3f412c[_0x88b8('0x1b')]['limit']||null:null,'include':_0x3f412c[_0x88b8('0x1b')]?_0x3f412c['options'][_0x88b8('0x1e')]?_[_0x88b8('0x1f')](_0x3f412c['options'][_0x88b8('0x1e')],function(_0x4a90b2){return{'model':db[_0x4a90b2[_0x88b8('0x20')]],'as':_0x4a90b2['as'],'attributes':_0x4a90b2[_0x88b8('0x1d')],'include':_0x4a90b2[_0x88b8('0x1e')]?_[_0x88b8('0x1f')](_0x4a90b2[_0x88b8('0x1e')],function(_0x1139b9){return{'model':db[_0x1139b9['model']],'as':_0x1139b9['as'],'attributes':_0x1139b9['attributes'],'include':_0x1139b9['include']?_['map'](_0x1139b9['include'],function(_0x52f459){return{'model':db[_0x52f459[_0x88b8('0x20')]],'as':_0x52f459['as'],'attributes':_0x52f459[_0x88b8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x88b8('0x10')](function(_0x5e9585){logger[_0x88b8('0x21')](_0x88b8('0x19'),_0x3f412c);logger['debug'](_0x88b8('0x19'),_0x3f412c,JSON[_0x88b8('0x22')](_0x5e9585));_0x2fc8f6(_0x5e9585);})[_0x88b8('0x23')](function(_0x165235){logger[_0x88b8('0x15')](_0x88b8('0x19'),_0x165235[_0x88b8('0x17')],_0x3f412c);_0x4c38ef(_0x2cc7df[_0x88b8('0x15')](0x1f4,_0x165235[_0x88b8('0x17')]));});});};exports[_0x88b8('0x24')]=function(_0x4bc2b6){var _0x39030c=this;return new Promise(function(_0x13c800,_0x1a156a){return db[_0x88b8('0x25')][_0x88b8('0x26')]({'raw':_0x4bc2b6[_0x88b8('0x1b')]?_0x4bc2b6[_0x88b8('0x1b')][_0x88b8('0x1c')]===undefined?!![]:![]:!![],'where':_0x4bc2b6[_0x88b8('0x1b')]?_0x4bc2b6[_0x88b8('0x1b')]['where']||null:null,'attributes':_0x4bc2b6[_0x88b8('0x1b')]?_0x4bc2b6[_0x88b8('0x1b')]['attributes']||null:null,'include':_0x4bc2b6[_0x88b8('0x1b')]?_0x4bc2b6[_0x88b8('0x1b')][_0x88b8('0x1e')]?_['map'](_0x4bc2b6[_0x88b8('0x1b')]['include'],function(_0x56f034){return{'model':db[_0x56f034[_0x88b8('0x20')]],'as':_0x56f034['as'],'attributes':_0x56f034['attributes'],'include':_0x56f034[_0x88b8('0x1e')]?_[_0x88b8('0x1f')](_0x56f034[_0x88b8('0x1e')],function(_0x36be10){return{'model':db[_0x36be10[_0x88b8('0x20')]],'as':_0x36be10['as'],'attributes':_0x36be10[_0x88b8('0x1d')],'include':_0x36be10[_0x88b8('0x1e')]?_[_0x88b8('0x1f')](_0x36be10['include'],function(_0x9291c2){return{'model':db[_0x9291c2[_0x88b8('0x20')]],'as':_0x9291c2['as'],'attributes':_0x9291c2[_0x88b8('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x407351){logger[_0x88b8('0x21')](_0x88b8('0x24'),_0x4bc2b6);logger[_0x88b8('0x13')](_0x88b8('0x24'),_0x4bc2b6,JSON['stringify'](_0x407351));_0x13c800(_0x407351);})[_0x88b8('0x23')](function(_0x545780){logger[_0x88b8('0x15')](_0x88b8('0x24'),_0x545780['message'],_0x4bc2b6);_0x1a156a(_0x39030c['error'](0x1f4,_0x545780[_0x88b8('0x17')]));});});}; \ No newline at end of file +var _0x41d2=['code','message','info','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailQueue.socket','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x28d450,_0x38ab23){var _0x1f4263=function(_0x41167d){while(--_0x41167d){_0x28d450['push'](_0x28d450['shift']());}};_0x1f4263(++_0x38ab23);}(_0x41d2,0x138));var _0x241d=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x41d2[_0xcd0918];return _0x250704;};'use strict';var _=require(_0x241d('0x0'));var util=require(_0x241d('0x1'));var moment=require(_0x241d('0x2'));var BPromise=require(_0x241d('0x3'));var rs=require(_0x241d('0x4'));var fs=require('fs');var Redis=require(_0x241d('0x5'));var db=require(_0x241d('0x6'))['db'];var utils=require(_0x241d('0x7'));var logger=require(_0x241d('0x8'))(_0x241d('0x9'));var config=require('../../config/environment');var jayson=require(_0x241d('0xa'));var client=jayson[_0x241d('0xb')][_0x241d('0xc')]({'port':0x232a});config['redis']=_[_0x241d('0xd')](config[_0x241d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x241d('0xf'))(new Redis(config[_0x241d('0xe')]));require(_0x241d('0x10'))['register'](socket);function respondWithRpcPromise(_0x3d3da5,_0x37ba17,_0x2e943c){return new BPromise(function(_0xbae080,_0x60d8c9){return client[_0x241d('0x11')](_0x3d3da5,_0x2e943c)['then'](function(_0x16944f){logger['info'](_0x241d('0x12'),_0x37ba17,_0x241d('0x13'));logger[_0x241d('0x14')](_0x241d('0x15'),_0x37ba17,'request\x20sent',JSON[_0x241d('0x16')](_0x16944f));if(_0x16944f['error']){if(_0x16944f[_0x241d('0x17')][_0x241d('0x18')]===0x1f4){logger[_0x241d('0x17')](_0x241d('0x12'),_0x37ba17,_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);return _0x60d8c9(_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);}logger['error'](_0x241d('0x12'),_0x37ba17,_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);return _0xbae080(_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);}else{logger[_0x241d('0x1a')]('MailQueue,\x20%s,\x20%s',_0x37ba17,'request\x20sent');_0xbae080(_0x16944f[_0x241d('0x1b')][_0x241d('0x19')]);}})[_0x241d('0x1c')](function(_0xe34e86){logger[_0x241d('0x17')]('MailQueue,\x20%s,\x20%s',_0x37ba17,_0xe34e86);_0x60d8c9(_0xe34e86);});});}exports[_0x241d('0x1d')]=function(_0x421ce0){var _0x20f8d2=this;return new Promise(function(_0x3a7f50,_0x1e2274){return db['MailQueue'][_0x241d('0x1e')]({'raw':_0x421ce0['options']?_0x421ce0[_0x241d('0x1f')][_0x241d('0x20')]===undefined?!![]:![]:!![],'where':_0x421ce0[_0x241d('0x1f')]?_0x421ce0[_0x241d('0x1f')][_0x241d('0x21')]||null:null,'attributes':_0x421ce0[_0x241d('0x1f')]?_0x421ce0[_0x241d('0x1f')][_0x241d('0x22')]||null:null,'limit':_0x421ce0[_0x241d('0x1f')]?_0x421ce0['options'][_0x241d('0x23')]||null:null,'include':_0x421ce0['options']?_0x421ce0[_0x241d('0x1f')]['include']?_[_0x241d('0x24')](_0x421ce0[_0x241d('0x1f')][_0x241d('0x25')],function(_0x314bd8){return{'model':db[_0x314bd8[_0x241d('0x26')]],'as':_0x314bd8['as'],'attributes':_0x314bd8[_0x241d('0x22')],'include':_0x314bd8[_0x241d('0x25')]?_[_0x241d('0x24')](_0x314bd8['include'],function(_0x3ec710){return{'model':db[_0x3ec710[_0x241d('0x26')]],'as':_0x3ec710['as'],'attributes':_0x3ec710['attributes'],'include':_0x3ec710['include']?_[_0x241d('0x24')](_0x3ec710[_0x241d('0x25')],function(_0x5d93df){return{'model':db[_0x5d93df[_0x241d('0x26')]],'as':_0x5d93df['as'],'attributes':_0x5d93df[_0x241d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x241d('0x27')](function(_0xe721a6){logger[_0x241d('0x1a')]('GetMailQueue',_0x421ce0);logger['debug'](_0x241d('0x1d'),_0x421ce0,JSON[_0x241d('0x16')](_0xe721a6));_0x3a7f50(_0xe721a6);})[_0x241d('0x1c')](function(_0x13180e){logger[_0x241d('0x17')](_0x241d('0x1d'),_0x13180e[_0x241d('0x19')],_0x421ce0);_0x1e2274(_0x20f8d2['error'](0x1f4,_0x13180e[_0x241d('0x19')]));});});};exports[_0x241d('0x28')]=function(_0x3957d4){var _0x1f6126=this;return new Promise(function(_0x5b1312,_0x201002){return db['MailQueue'][_0x241d('0x29')]({'raw':_0x3957d4[_0x241d('0x1f')]?_0x3957d4[_0x241d('0x1f')][_0x241d('0x20')]===undefined?!![]:![]:!![],'where':_0x3957d4[_0x241d('0x1f')]?_0x3957d4[_0x241d('0x1f')][_0x241d('0x21')]||null:null,'attributes':_0x3957d4['options']?_0x3957d4['options'][_0x241d('0x22')]||null:null,'include':_0x3957d4['options']?_0x3957d4[_0x241d('0x1f')]['include']?_[_0x241d('0x24')](_0x3957d4[_0x241d('0x1f')][_0x241d('0x25')],function(_0x57ba0c){return{'model':db[_0x57ba0c['model']],'as':_0x57ba0c['as'],'attributes':_0x57ba0c[_0x241d('0x22')],'include':_0x57ba0c['include']?_['map'](_0x57ba0c['include'],function(_0x5cafd1){return{'model':db[_0x5cafd1[_0x241d('0x26')]],'as':_0x5cafd1['as'],'attributes':_0x5cafd1[_0x241d('0x22')],'include':_0x5cafd1[_0x241d('0x25')]?_[_0x241d('0x24')](_0x5cafd1[_0x241d('0x25')],function(_0x420bcf){return{'model':db[_0x420bcf['model']],'as':_0x420bcf['as'],'attributes':_0x420bcf['attributes']};}):[]};}):[]};}):[]:[]})[_0x241d('0x27')](function(_0x3846fa){logger[_0x241d('0x1a')]('ShowMailQueue',_0x3957d4);logger[_0x241d('0x14')](_0x241d('0x28'),_0x3957d4,JSON[_0x241d('0x16')](_0x3846fa));_0x5b1312(_0x3846fa);})[_0x241d('0x1c')](function(_0x2f6c59){logger[_0x241d('0x17')](_0x241d('0x28'),_0x2f6c59[_0x241d('0x19')],_0x3957d4);_0x201002(_0x1f6126[_0x241d('0x17')](0x1f4,_0x2f6c59['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0952344..c118e16 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 _0x4a65=['register','length','mailQueue:','save','remove','update','removeListener'];(function(_0xc4f1f0,_0x1bfb65){var _0x1322a3=function(_0x2c346e){while(--_0x2c346e){_0xc4f1f0['push'](_0xc4f1f0['shift']());}};_0x1322a3(++_0x1bfb65);}(_0x4a65,0x16f));var _0x54a6=function(_0x497e59,_0x3347f0){_0x497e59=_0x497e59-0x0;var _0x52cad8=_0x4a65[_0x497e59];return _0x52cad8;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x54a6('0x0'),_0x54a6('0x1'),_0x54a6('0x2')];function createListener(_0x924cbf,_0x261317){return function(_0x21c48b){_0x261317['emit'](_0x924cbf,_0x21c48b);};}function removeListener(_0x10aeda,_0x1b9f30){return function(){MailQueueEvents[_0x54a6('0x3')](_0x10aeda,_0x1b9f30);};}exports[_0x54a6('0x4')]=function(_0x1ecc17){for(var _0xc9e68a=0x0,_0x2b6544=events[_0x54a6('0x5')];_0xc9e68a<_0x2b6544;_0xc9e68a++){var _0x40e769=events[_0xc9e68a];var _0xb61d06=createListener(_0x54a6('0x6')+_0x40e769,_0x1ecc17);MailQueueEvents['on'](_0x40e769,_0xb61d06);}}; \ No newline at end of file +var _0x7de9=['update','register','length','mailQueue:','save'];(function(_0x5dddc0,_0x27de4c){var _0x58a374=function(_0x53e10e){while(--_0x53e10e){_0x5dddc0['push'](_0x5dddc0['shift']());}};_0x58a374(++_0x27de4c);}(_0x7de9,0xdb));var _0x97de=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x7de9[_0x45d55e];return _0x29812a;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x97de('0x0'),'remove',_0x97de('0x1')];function createListener(_0x3cceaf,_0x40ebe6){return function(_0x312cdf){_0x40ebe6['emit'](_0x3cceaf,_0x312cdf);};}function removeListener(_0x427dca,_0xb1f8f1){return function(){MailQueueEvents['removeListener'](_0x427dca,_0xb1f8f1);};}exports[_0x97de('0x2')]=function(_0x1d2541){for(var _0x54a522=0x0,_0x1d77c2=events[_0x97de('0x3')];_0x54a522<_0x1d77c2;_0x54a522++){var _0x57162b=events[_0x54a522];var _0x2e978b=createListener(_0x97de('0x4')+_0x57162b,_0x1d2541);MailQueueEvents['on'](_0x57162b,_0x2e978b);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b292e81..fa10992 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 _0xe1e3=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout'];(function(_0x1ddbd0,_0x226a99){var _0x29cf60=function(_0x2f0e6d){while(--_0x2f0e6d){_0x1ddbd0['push'](_0x1ddbd0['shift']());}};_0x29cf60(++_0x226a99);}(_0xe1e3,0xba));var _0x3e1e=function(_0x406ce4,_0x559898){_0x406ce4=_0x406ce4-0x0;var _0x227ae3=_0xe1e3[_0x406ce4];return _0x227ae3;};'use strict';var multer=require(_0x3e1e('0x0'));var util=require('util');var path=require(_0x3e1e('0x1'));var timeout=require(_0x3e1e('0x2'));var express=require(_0x3e1e('0x3'));var router=express[_0x3e1e('0x4')]();var fs_extra=require(_0x3e1e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3e1e('0x6'));var config=require(_0x3e1e('0x7'));var controller=require(_0x3e1e('0x8'));router['get']('/',auth[_0x3e1e('0x9')](),controller[_0x3e1e('0xa')]);router[_0x3e1e('0xb')](_0x3e1e('0xc'),auth[_0x3e1e('0x9')](),controller[_0x3e1e('0xd')]);router['get'](_0x3e1e('0xe'),auth[_0x3e1e('0x9')](),controller[_0x3e1e('0xf')]);router[_0x3e1e('0x10')]('/',auth[_0x3e1e('0x9')](),controller[_0x3e1e('0x11')]);router[_0x3e1e('0x12')](_0x3e1e('0xe'),auth[_0x3e1e('0x9')](),controller['update']);router[_0x3e1e('0x13')](_0x3e1e('0xe'),auth[_0x3e1e('0x9')](),controller[_0x3e1e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8618=['create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x8618,0xcc));var _0x8861=function(_0x5ae011,_0x53e516){_0x5ae011=_0x5ae011-0x0;var _0x473db4=_0x8618[_0x5ae011];return _0x473db4;};'use strict';var multer=require('multer');var util=require(_0x8861('0x0'));var path=require(_0x8861('0x1'));var timeout=require(_0x8861('0x2'));var express=require(_0x8861('0x3'));var router=express[_0x8861('0x4')]();var fs_extra=require(_0x8861('0x5'));var auth=require(_0x8861('0x6'));var interaction=require(_0x8861('0x7'));var config=require(_0x8861('0x8'));var controller=require(_0x8861('0x9'));router[_0x8861('0xa')]('/',auth[_0x8861('0xb')](),controller[_0x8861('0xc')]);router[_0x8861('0xa')](_0x8861('0xd'),auth[_0x8861('0xb')](),controller['describe']);router[_0x8861('0xa')](_0x8861('0xe'),auth[_0x8861('0xb')](),controller['show']);router[_0x8861('0xf')]('/',auth[_0x8861('0xb')](),controller[_0x8861('0x10')]);router['put'](_0x8861('0xe'),auth[_0x8861('0xb')](),controller[_0x8861('0x11')]);router[_0x8861('0x12')]('/:id',auth[_0x8861('0xb')](),controller['destroy']);module[_0x8861('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 22a612c..543a8ca 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 _0x49d6=['sequelize','exports','DATE','STRING','moment'];(function(_0x51a58e,_0x29a792){var _0x709af6=function(_0x22506b){while(--_0x22506b){_0x51a58e['push'](_0x51a58e['shift']());}};_0x709af6(++_0x29a792);}(_0x49d6,0x108));var _0x649d=function(_0x240178,_0x228dc7){_0x240178=_0x240178-0x0;var _0x559bee=_0x49d6[_0x240178];return _0x559bee;};'use strict';var moment=require(_0x649d('0x0'));var Sequelize=require(_0x649d('0x1'));module[_0x649d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x649d('0x3')]},'leaveAt':{'type':Sequelize[_0x649d('0x3')]},'acceptAt':{'type':Sequelize[_0x649d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x649d('0x4')]}}; \ No newline at end of file +var _0x0263=['DATE','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0263,0x75));var _0x3026=function(_0x30069f,_0x40ca7c){_0x30069f=_0x30069f-0x0;var _0x36729d=_0x0263[_0x30069f];return _0x36729d;};'use strict';var moment=require('moment');var Sequelize=require(_0x3026('0x0'));module[_0x3026('0x1')]={'uniqueid':{'type':Sequelize[_0x3026('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3026('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3026('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3026('0x3')]},'reason':{'type':Sequelize[_0x3026('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index deecedc..3070024 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 _0xadb5=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','MailQueueReport','fieldName','type','key','model','query','keys'];(function(_0x1abbf4,_0x2f199d){var _0x4c28d9=function(_0x1c5316){while(--_0x1c5316){_0x1abbf4['push'](_0x1abbf4['shift']());}};_0x4c28d9(++_0x2f199d);}(_0xadb5,0xad));var _0x5adb=function(_0x1fc2f8,_0x5f19fc){_0x1fc2f8=_0x1fc2f8-0x0;var _0x3f6d74=_0xadb5[_0x1fc2f8];return _0x3f6d74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['MailQueueReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['MailQueueReport'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['MailQueueReport'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));};exports['describe']=function(_0x36b847,_0x3a5703){return db[_0x5adb('0x2a')][_0x5adb('0x49')]()['then'](respondWithResult(_0x3a5703,null))[_0x5adb('0x42')](handleError(_0x3a5703,null));}; \ No newline at end of file +var _0xeb3b=['destroy','error','stack','name','send','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','MailQueueReport','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','then'];(function(_0x864f7a,_0x2547f9){var _0x570603=function(_0x5b205e){while(--_0x5b205e){_0x864f7a['push'](_0x864f7a['shift']());}};_0x570603(++_0x2547f9);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0xeb3b[_0x21de89];return _0x290b7e;};'use strict';var emlformat=require(_0xbeb3('0x0'));var rimraf=require(_0xbeb3('0x1'));var zipdir=require(_0xbeb3('0x2'));var jsonpatch=require(_0xbeb3('0x3'));var rp=require(_0xbeb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbeb3('0x5'));var util=require('util');var path=require(_0xbeb3('0x6'));var sox=require('sox');var csv=require(_0xbeb3('0x7'));var ejs=require(_0xbeb3('0x8'));var fs=require('fs');var fs_extra=require(_0xbeb3('0x9'));var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x7'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];function respondWithStatusCode(_0x19868e,_0x313296){_0x313296=_0x313296||0xcc;return function(_0x5b9ace){if(_0x5b9ace){return _0x19868e['sendStatus'](_0x313296);}return _0x19868e[_0xbeb3('0x19')](_0x313296)[_0xbeb3('0x1a')]();};}function respondWithResult(_0x5f521b,_0x4dfb28){_0x4dfb28=_0x4dfb28||0xc8;return function(_0xed9879){if(_0xed9879){return _0x5f521b[_0xbeb3('0x19')](_0x4dfb28)[_0xbeb3('0x1b')](_0xed9879);}};}function respondWithFilteredResult(_0x43d58a,_0x26daf2){return function(_0x535836){if(_0x535836){var _0x1aeaee=typeof _0x26daf2['offset']===_0xbeb3('0x1c')&&typeof _0x26daf2['limit']==='undefined';var _0x4f8481=_0x535836[_0xbeb3('0x1d')];var _0x44a4bb=_0x1aeaee?0x0:_0x26daf2[_0xbeb3('0x1e')];var _0x10b15d=_0x1aeaee?_0x535836['count']:_0x26daf2[_0xbeb3('0x1e')]+_0x26daf2[_0xbeb3('0x1f')];var _0xe2cc47;if(_0x10b15d>=_0x4f8481){_0x10b15d=_0x4f8481;_0xe2cc47=0xc8;}else{_0xe2cc47=0xce;}_0x43d58a['status'](_0xe2cc47);return _0x43d58a['set'](_0xbeb3('0x20'),_0x44a4bb+'-'+_0x10b15d+'/'+_0x4f8481)['json'](_0x535836);}return null;};}function patchUpdates(_0x1d917b){return function(_0x50b005){try{jsonpatch['apply'](_0x50b005,_0x1d917b,!![]);}catch(_0xfa2736){return BPromise[_0xbeb3('0x21')](_0xfa2736);}return _0x50b005[_0xbeb3('0x22')]();};}function saveUpdates(_0x4bd89e,_0x301899){return function(_0x18ea0f){if(_0x18ea0f){return _0x18ea0f['update'](_0x4bd89e)[_0xbeb3('0x23')](function(_0x366bdb){return _0x366bdb;});}return null;};}function removeEntity(_0x55a59d,_0xfc384a){return function(_0x278fe4){if(_0x278fe4){return _0x278fe4[_0xbeb3('0x24')]()[_0xbeb3('0x23')](function(){_0x55a59d[_0xbeb3('0x19')](0xcc)[_0xbeb3('0x1a')]();});}};}function handleEntityNotFound(_0x84921a,_0x340581){return function(_0x46fe17){if(!_0x46fe17){_0x84921a['sendStatus'](0x194);}return _0x46fe17;};}function handleError(_0x4e695e,_0x1f36b9){_0x1f36b9=_0x1f36b9||0x1f4;return function(_0x520116){logger[_0xbeb3('0x25')](_0x520116[_0xbeb3('0x26')]);if(_0x520116[_0xbeb3('0x27')]){delete _0x520116[_0xbeb3('0x27')];}_0x4e695e['status'](_0x1f36b9)[_0xbeb3('0x28')](_0x520116);};}exports['index']=function(_0x26cd8f,_0xab301c){var _0x5bd93d={},_0x483198={},_0x9b8f13={'count':0x0,'rows':[]};var _0x585c6f=_['map'](db['MailQueueReport']['rawAttributes'],function(_0xf5dbaf){return{'name':_0xf5dbaf['fieldName'],'type':_0xf5dbaf[_0xbeb3('0x29')][_0xbeb3('0x2a')]};});_0x483198[_0xbeb3('0x2b')]=_[_0xbeb3('0x2c')](_0x585c6f,_0xbeb3('0x27'));_0x483198[_0xbeb3('0x2d')]=_[_0xbeb3('0x2e')](_0x26cd8f[_0xbeb3('0x2d')]);_0x483198[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x483198['model'],_0x483198[_0xbeb3('0x2d')]);_0x5bd93d[_0xbeb3('0x31')]=_['intersection'](_0x483198[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0x5bd93d['attributes']=_0x5bd93d[_0xbeb3('0x31')][_0xbeb3('0x33')]?_0x5bd93d[_0xbeb3('0x31')]:_0x483198[_0xbeb3('0x2b')];if(!_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x34')](_0xbeb3('0x35'))){_0x5bd93d[_0xbeb3('0x1f')]=qs[_0xbeb3('0x1f')](_0x26cd8f['query'][_0xbeb3('0x1f')]);_0x5bd93d['offset']=qs[_0xbeb3('0x1e')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x1e')]);}_0x5bd93d[_0xbeb3('0x36')]=qs[_0xbeb3('0x37')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x37')]);_0x5bd93d[_0xbeb3('0x38')]=qs['filters'](_[_0xbeb3('0x39')](_0x26cd8f['query'],_0x483198['filters']),_0x585c6f);if(_0x26cd8f['query'][_0xbeb3('0x3a')]){_0x5bd93d[_0xbeb3('0x38')]=_[_0xbeb3('0x3b')](_0x5bd93d[_0xbeb3('0x38')],{'$or':_[_0xbeb3('0x2c')](_0x585c6f,function(_0x40f166){if(_0x40f166['type']!==_0xbeb3('0x3c')){var _0x40de8d={};_0x40de8d[_0x40f166[_0xbeb3('0x27')]]={'$like':'%'+_0x26cd8f['query']['filter']+'%'};return _0x40de8d;}})});}_0x5bd93d=_['merge']({},_0x5bd93d,_0x26cd8f[_0xbeb3('0x3d')]);var _0x2a8860={'where':_0x5bd93d[_0xbeb3('0x38')]};return db['MailQueueReport'][_0xbeb3('0x1d')](_0x2a8860)['then'](function(_0x1b6700){_0x9b8f13[_0xbeb3('0x1d')]=_0x1b6700;if(_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x3e')]){_0x5bd93d['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xbeb3('0x3f')](_0x5bd93d);})[_0xbeb3('0x23')](function(_0x3d4262){_0x9b8f13[_0xbeb3('0x40')]=_0x3d4262;return _0x9b8f13;})[_0xbeb3('0x23')](respondWithFilteredResult(_0xab301c,_0x5bd93d))[_0xbeb3('0x41')](handleError(_0xab301c,null));};exports[_0xbeb3('0x42')]=function(_0x4606a6,_0x5758c6){var _0xfcb57f={'raw':!![],'where':{'id':_0x4606a6[_0xbeb3('0x43')]['id']}},_0x39f2d2={};_0x39f2d2[_0xbeb3('0x2b')]=_[_0xbeb3('0x2e')](db[_0xbeb3('0x44')][_0xbeb3('0x45')]);_0x39f2d2['query']=_[_0xbeb3('0x2e')](_0x4606a6[_0xbeb3('0x2d')]);_0x39f2d2[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],_0x39f2d2[_0xbeb3('0x2d')]);_0xfcb57f[_0xbeb3('0x31')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x4606a6[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0xfcb57f[_0xbeb3('0x31')]=_0xfcb57f['attributes'][_0xbeb3('0x33')]?_0xfcb57f[_0xbeb3('0x31')]:_0x39f2d2[_0xbeb3('0x2b')];if(_0x4606a6['query']['includeAll']){_0xfcb57f[_0xbeb3('0x46')]=[{'all':!![]}];}_0xfcb57f=_[_0xbeb3('0x3b')]({},_0xfcb57f,_0x4606a6[_0xbeb3('0x3d')]);return db[_0xbeb3('0x44')]['find'](_0xfcb57f)[_0xbeb3('0x23')](handleEntityNotFound(_0x5758c6,null))['then'](respondWithResult(_0x5758c6,null))['catch'](handleError(_0x5758c6,null));};exports[_0xbeb3('0x47')]=function(_0x393e60,_0x1ff297){return db[_0xbeb3('0x44')]['create'](_0x393e60[_0xbeb3('0x48')],{})[_0xbeb3('0x23')](respondWithResult(_0x1ff297,0xc9))[_0xbeb3('0x41')](handleError(_0x1ff297,null));};exports['update']=function(_0x3f93ab,_0x58c49f){if(_0x3f93ab['body']['id']){delete _0x3f93ab[_0xbeb3('0x48')]['id'];}return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x3f93ab['params']['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x58c49f,null))[_0xbeb3('0x23')](saveUpdates(_0x3f93ab[_0xbeb3('0x48')],null))['then'](respondWithResult(_0x58c49f,null))[_0xbeb3('0x41')](handleError(_0x58c49f,null));};exports['destroy']=function(_0x39605b,_0x4d8e21){return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x39605b[_0xbeb3('0x43')]['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x4d8e21,null))[_0xbeb3('0x23')](removeEntity(_0x4d8e21,null))[_0xbeb3('0x41')](handleError(_0x4d8e21,null));};exports[_0xbeb3('0x4a')]=function(_0x168434,_0x49fded){return db[_0xbeb3('0x44')][_0xbeb3('0x4a')]()[_0xbeb3('0x23')](respondWithResult(_0x49fded,null))[_0xbeb3('0x41')](handleError(_0x49fded,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 44bcb09..e472f1c 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 _0xcb27=['moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x49df47,_0x42b818){var _0xa635ef=function(_0x109070){while(--_0x109070){_0x49df47['push'](_0x49df47['shift']());}};_0xa635ef(++_0x42b818);}(_0xcb27,0x19d));var _0x7cb2=function(_0x507ccf,_0xef94c0){_0x507ccf=_0x507ccf-0x0;var _0x3261d1=_0xcb27[_0x507ccf];return _0x3261d1;};'use strict';var _=require(_0x7cb2('0x0'));var util=require('util');var logger=require(_0x7cb2('0x1'))(_0x7cb2('0x2'));var moment=require(_0x7cb2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cb2('0x4'));var rimraf=require(_0x7cb2('0x5'));var config=require(_0x7cb2('0x6'));var attributes=require(_0x7cb2('0x7'));module[_0x7cb2('0x8')]=function(_0x5ce213,_0x327c91){return _0x5ce213[_0x7cb2('0x9')](_0x7cb2('0xa'),attributes,{'tableName':_0x7cb2('0xb'),'paranoid':![],'indexes':[{'name':_0x7cb2('0xc'),'fields':[_0x7cb2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c27=['rimraf','../../config/environment','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0x9c27,0x158));var _0x79c2=function(_0x4a9b0e,_0x13ae85){_0x4a9b0e=_0x4a9b0e-0x0;var _0x4e83a9=_0x9c27[_0x4a9b0e];return _0x4e83a9;};'use strict';var _=require(_0x79c2('0x0'));var util=require(_0x79c2('0x1'));var logger=require(_0x79c2('0x2'))(_0x79c2('0x3'));var moment=require(_0x79c2('0x4'));var BPromise=require(_0x79c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79c2('0x6'));var rimraf=require(_0x79c2('0x7'));var config=require(_0x79c2('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0x79c2('0x9')]=function(_0x1281e0,_0x58eb19){return _0x1281e0[_0x79c2('0xa')]('MailQueueReport',attributes,{'tableName':_0x79c2('0xb'),'paranoid':![],'indexes':[{'name':_0x79c2('0xc'),'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 03d456b..14b2d48 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x49a5c6,_0x1758e4){var _0x3f8dc2=function(_0x1ab3c4){while(--_0x1ab3c4){_0x49a5c6['push'](_0x49a5c6['shift']());}};_0x3f8dc2(++_0x1758e4);}(_0xdb28,0x106));var _0x8db2=function(_0x10a0ac,_0x14721f){_0x10a0ac=_0x10a0ac-0x0;var _0x530a36=_0xdb28[_0x10a0ac];return _0x530a36;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +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(_0x149f2d,_0x552d3d){var _0x2e65ef=function(_0x37d47e){while(--_0x37d47e){_0x149f2d['push'](_0x149f2d['shift']());}};_0x2e65ef(++_0x552d3d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c6851ce..b332c68 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x57a634,_0x266a81){var _0x4c47cb=function(_0x4ddfda){while(--_0x4ddfda){_0x57a634['push'](_0x57a634['shift']());}};_0x4c47cb(++_0x266a81);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x33dc0f,_0x12b378){var _0x1b1014=function(_0x5b6f08){while(--_0x5b6f08){_0x33dc0f['push'](_0x33dc0f['shift']());}};_0x1b1014(++_0x12b378);}(_0xe706,0xa3));var _0x6e70=function(_0x4b3e49,_0x9e566c){_0x4b3e49=_0x4b3e49-0x0;var _0x57e339=_0xe706[_0x4b3e49];return _0x57e339;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 5dc4c4f..066c207 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 _0x244c=['INBOX','exports','STRING','BOOLEAN','INTEGER'];(function(_0x45e60e,_0x529bef){var _0x5717a5=function(_0x38d070){while(--_0x38d070){_0x45e60e['push'](_0x45e60e['shift']());}};_0x5717a5(++_0x529bef);}(_0x244c,0x1f0));var _0xc244=function(_0x133473,_0x2b4c9a){_0x133473=_0x133473-0x0;var _0x5bffe3=_0x244c[_0x133473];return _0x5bffe3;};'use strict';var Sequelize=require('sequelize');module[_0xc244('0x0')]={'description':{'type':Sequelize[_0xc244('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xc244('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc244('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc244('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc244('0x1')],'defaultValue':_0xc244('0x4')},'connTimeout':{'type':Sequelize[_0xc244('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc244('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xc244('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3bef=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x3bef,0x8f));var _0xf3be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bef[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf3be('0x0'));module[_0xf3be('0x1')]={'description':{'type':Sequelize[_0xf3be('0x2')]},'host':{'type':Sequelize[_0xf3be('0x2')]},'authentication':{'type':Sequelize[_0xf3be('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf3be('0x2')]},'password':{'type':Sequelize[_0xf3be('0x2')]},'port':{'type':Sequelize[_0xf3be('0x4')]},'tls':{'type':Sequelize[_0xf3be('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf3be('0x2')],'defaultValue':_0xf3be('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf3be('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xf3be('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c4172aa..972f763 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 _0xe65f=['define','mail_servers_in','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./mailServerIn.attributes'];(function(_0x2460a5,_0x25293f){var _0x3f1a96=function(_0x4c540d){while(--_0x4c540d){_0x2460a5['push'](_0x2460a5['shift']());}};_0x3f1a96(++_0x25293f);}(_0xe65f,0xe8));var _0xfe65=function(_0x5185c6,_0x4e7c65){_0x5185c6=_0x5185c6-0x0;var _0x1a9c19=_0xe65f[_0x5185c6];return _0x1a9c19;};'use strict';var _=require(_0xfe65('0x0'));var util=require('util');var logger=require(_0xfe65('0x1'))(_0xfe65('0x2'));var moment=require(_0xfe65('0x3'));var BPromise=require(_0xfe65('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe65('0x5'));var rimraf=require(_0xfe65('0x6'));var config=require('../../config/environment');var attributes=require(_0xfe65('0x7'));module['exports']=function(_0x5d2c82,_0x4a78e7){return _0x5d2c82[_0xfe65('0x8')]('MailServerIn',attributes,{'tableName':_0xfe65('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['define','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x01d9,0x176));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))('api');var moment=require(_0x901d('0x3'));var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x901d('0x9')]=function(_0xb50f13,_0x381563){return _0xb50f13[_0x901d('0xa')]('MailServerIn',attributes,{'tableName':_0x901d('0xb'),'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 bacd0f3..6c555f3 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 _0xd420=['MailServerIn','findAll','options','raw','where','limit','include','map','attributes','model','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetMailServerIn'];(function(_0x5e2156,_0x1897a8){var _0x1c7d28=function(_0x52c4b3){while(--_0x52c4b3){_0x5e2156['push'](_0x5e2156['shift']());}};_0x1c7d28(++_0x1897a8);}(_0xd420,0x1d9));var _0x0d42=function(_0x38efc5,_0x7ce9ca){_0x38efc5=_0x38efc5-0x0;var _0x15754a=_0xd420[_0x38efc5];return _0x15754a;};'use strict';var _=require(_0x0d42('0x0'));var util=require(_0x0d42('0x1'));var moment=require('moment');var BPromise=require(_0x0d42('0x2'));var rs=require(_0x0d42('0x3'));var fs=require('fs');var Redis=require(_0x0d42('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d42('0x5'));var logger=require(_0x0d42('0x6'))(_0x0d42('0x7'));var config=require(_0x0d42('0x8'));var jayson=require(_0x0d42('0x9'));var client=jayson[_0x0d42('0xa')][_0x0d42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46be19,_0x2649d5,_0x494507){return new BPromise(function(_0x3fa332,_0x55063e){return client['request'](_0x46be19,_0x494507)['then'](function(_0x54ea8b){logger['info'](_0x0d42('0xc'),_0x2649d5,_0x0d42('0xd'));logger[_0x0d42('0xe')](_0x0d42('0xf'),_0x2649d5,_0x0d42('0xd'),JSON[_0x0d42('0x10')](_0x54ea8b));if(_0x54ea8b['error']){if(_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x12')]===0x1f4){logger[_0x0d42('0x11')](_0x0d42('0xc'),_0x2649d5,_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x13')]);return _0x55063e(_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x13')]);}logger[_0x0d42('0x11')](_0x0d42('0xc'),_0x2649d5,_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x13')]);return _0x3fa332(_0x54ea8b['error'][_0x0d42('0x13')]);}else{logger[_0x0d42('0x14')](_0x0d42('0xc'),_0x2649d5,_0x0d42('0xd'));_0x3fa332(_0x54ea8b['result'][_0x0d42('0x13')]);}})['catch'](function(_0x132c4e){logger[_0x0d42('0x11')]('MailServerIn,\x20%s,\x20%s',_0x2649d5,_0x132c4e);_0x55063e(_0x132c4e);});});}exports[_0x0d42('0x15')]=function(_0x28b5b8){var _0x20cda7=this;return new Promise(function(_0x3a51cc,_0xfc9e3b){return db[_0x0d42('0x16')][_0x0d42('0x17')]({'raw':_0x28b5b8[_0x0d42('0x18')]?_0x28b5b8[_0x0d42('0x18')][_0x0d42('0x19')]===undefined?!![]:![]:!![],'where':_0x28b5b8[_0x0d42('0x18')]?_0x28b5b8['options'][_0x0d42('0x1a')]||null:null,'attributes':_0x28b5b8[_0x0d42('0x18')]?_0x28b5b8[_0x0d42('0x18')]['attributes']||null:null,'limit':_0x28b5b8['options']?_0x28b5b8[_0x0d42('0x18')][_0x0d42('0x1b')]||null:null,'include':_0x28b5b8[_0x0d42('0x18')]?_0x28b5b8[_0x0d42('0x18')][_0x0d42('0x1c')]?_[_0x0d42('0x1d')](_0x28b5b8[_0x0d42('0x18')][_0x0d42('0x1c')],function(_0x5abfa9){return{'model':db[_0x5abfa9['model']],'as':_0x5abfa9['as'],'attributes':_0x5abfa9[_0x0d42('0x1e')],'include':_0x5abfa9[_0x0d42('0x1c')]?_[_0x0d42('0x1d')](_0x5abfa9[_0x0d42('0x1c')],function(_0x494982){return{'model':db[_0x494982[_0x0d42('0x1f')]],'as':_0x494982['as'],'attributes':_0x494982[_0x0d42('0x1e')],'include':_0x494982[_0x0d42('0x1c')]?_[_0x0d42('0x1d')](_0x494982['include'],function(_0x273387){return{'model':db[_0x273387[_0x0d42('0x1f')]],'as':_0x273387['as'],'attributes':_0x273387[_0x0d42('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d42('0x20')](function(_0x4ec447){logger[_0x0d42('0x14')](_0x0d42('0x15'),_0x28b5b8);logger[_0x0d42('0xe')](_0x0d42('0x15'),_0x28b5b8,JSON['stringify'](_0x4ec447));_0x3a51cc(_0x4ec447);})['catch'](function(_0x17978d){logger[_0x0d42('0x11')](_0x0d42('0x15'),_0x17978d[_0x0d42('0x13')],_0x28b5b8);_0xfc9e3b(_0x20cda7[_0x0d42('0x11')](0x1f4,_0x17978d[_0x0d42('0x13')]));});});}; \ No newline at end of file +var _0x1109=['request\x20sent','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','model','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x1109,0x17d));var _0x9110=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0x1109[_0x11f0e3];return _0x2892e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9110('0x0'));var BPromise=require('bluebird');var rs=require(_0x9110('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9110('0x2'))['db'];var utils=require(_0x9110('0x3'));var logger=require(_0x9110('0x4'))(_0x9110('0x5'));var config=require(_0x9110('0x6'));var jayson=require(_0x9110('0x7'));var client=jayson[_0x9110('0x8')][_0x9110('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35a4a8,_0x4a15c6,_0x5c125b){return new BPromise(function(_0x4d18a6,_0x3d40a9){return client[_0x9110('0xa')](_0x35a4a8,_0x5c125b)[_0x9110('0xb')](function(_0x4e7252){logger[_0x9110('0xc')]('MailServerIn,\x20%s,\x20%s',_0x4a15c6,'request\x20sent');logger[_0x9110('0xd')](_0x9110('0xe'),_0x4a15c6,_0x9110('0xf'),JSON[_0x9110('0x10')](_0x4e7252));if(_0x4e7252[_0x9110('0x11')]){if(_0x4e7252[_0x9110('0x11')][_0x9110('0x12')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x4a15c6,_0x4e7252[_0x9110('0x11')]['message']);return _0x3d40a9(_0x4e7252['error'][_0x9110('0x13')]);}logger[_0x9110('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4a15c6,_0x4e7252[_0x9110('0x11')]['message']);return _0x4d18a6(_0x4e7252[_0x9110('0x11')][_0x9110('0x13')]);}else{logger[_0x9110('0xc')](_0x9110('0x14'),_0x4a15c6,_0x9110('0xf'));_0x4d18a6(_0x4e7252[_0x9110('0x15')]['message']);}})['catch'](function(_0x3bffeb){logger[_0x9110('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4a15c6,_0x3bffeb);_0x3d40a9(_0x3bffeb);});});}exports[_0x9110('0x16')]=function(_0x11dec4){var _0x1bcaf2=this;return new Promise(function(_0x3d21e5,_0x2d75d6){return db[_0x9110('0x17')][_0x9110('0x18')]({'raw':_0x11dec4[_0x9110('0x19')]?_0x11dec4[_0x9110('0x19')][_0x9110('0x1a')]===undefined?!![]:![]:!![],'where':_0x11dec4[_0x9110('0x19')]?_0x11dec4['options'][_0x9110('0x1b')]||null:null,'attributes':_0x11dec4[_0x9110('0x19')]?_0x11dec4[_0x9110('0x19')][_0x9110('0x1c')]||null:null,'limit':_0x11dec4['options']?_0x11dec4[_0x9110('0x19')]['limit']||null:null,'include':_0x11dec4['options']?_0x11dec4[_0x9110('0x19')][_0x9110('0x1d')]?_[_0x9110('0x1e')](_0x11dec4[_0x9110('0x19')][_0x9110('0x1d')],function(_0x2acb7e){return{'model':db[_0x2acb7e[_0x9110('0x1f')]],'as':_0x2acb7e['as'],'attributes':_0x2acb7e[_0x9110('0x1c')],'include':_0x2acb7e[_0x9110('0x1d')]?_['map'](_0x2acb7e[_0x9110('0x1d')],function(_0x472c10){return{'model':db[_0x472c10['model']],'as':_0x472c10['as'],'attributes':_0x472c10[_0x9110('0x1c')],'include':_0x472c10['include']?_[_0x9110('0x1e')](_0x472c10[_0x9110('0x1d')],function(_0x5ad783){return{'model':db[_0x5ad783['model']],'as':_0x5ad783['as'],'attributes':_0x5ad783[_0x9110('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5216cc){logger['info'](_0x9110('0x16'),_0x11dec4);logger[_0x9110('0xd')](_0x9110('0x16'),_0x11dec4,JSON[_0x9110('0x10')](_0x5216cc));_0x3d21e5(_0x5216cc);})[_0x9110('0x20')](function(_0x5803fc){logger[_0x9110('0x11')](_0x9110('0x16'),_0x5803fc[_0x9110('0x13')],_0x11dec4);_0x2d75d6(_0x1bcaf2['error'](0x1f4,_0x5803fc[_0x9110('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index bbf9a86..37b93de 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x33ad47,_0x332479){_0x33ad47=_0x33ad47-0x0;var _0x3c7ae0=_0x7a54[_0x33ad47];return _0x3c7ae0;};'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 f33c22d..14895fa 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 _0xf45e=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x1efd75,_0x1560d8){var _0x2b84b2=function(_0x2c3d43){while(--_0x2c3d43){_0x1efd75['push'](_0x1efd75['shift']());}};_0x2b84b2(++_0x1560d8);}(_0xf45e,0x115));var _0xef45=function(_0x290159,_0x5945a9){_0x290159=_0x290159-0x0;var _0x106e3d=_0xf45e[_0x290159];return _0x106e3d;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'description':{'type':Sequelize[_0xef45('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xef45('0x1')]},'pass':{'type':Sequelize[_0xef45('0x1')]},'port':{'type':Sequelize[_0xef45('0x2')]},'secure':{'type':Sequelize[_0xef45('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xef45('0x1')]},'authentication':{'type':Sequelize[_0xef45('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xef45('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0bb5=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0bb5,0x148));var _0x50bb=function(_0xc356a6,_0x5abbf2){_0xc356a6=_0xc356a6-0x0;var _0x16dfd5=_0x0bb5[_0xc356a6];return _0x16dfd5;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x50bb('0x2')]},'pass':{'type':Sequelize[_0x50bb('0x2')]},'port':{'type':Sequelize[_0x50bb('0x3')]},'secure':{'type':Sequelize[_0x50bb('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x50bb('0x2')]},'authentication':{'type':Sequelize[_0x50bb('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x50bb('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e4ccf1c..a1fae3c 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 _0x371c=['merge','map','type','VIRTUAL','options','count','includeAll','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','MailServerOut','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0x371c,0x199));var _0xc371=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x371c[_0x1b828b];return _0x98da1a;};'use strict';var emlformat=require(_0xc371('0x0'));var rimraf=require(_0xc371('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc371('0x2'));var rp=require(_0xc371('0x3'));var moment=require(_0xc371('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc371('0x5'));var util=require(_0xc371('0x6'));var path=require(_0xc371('0x7'));var sox=require(_0xc371('0x8'));var csv=require(_0xc371('0x9'));var ejs=require(_0xc371('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc371('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc371('0xc'));var deskjs=require(_0xc371('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc371('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc371('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc371('0x10'))(_0xc371('0x11'));var utils=require(_0xc371('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc371('0x13'));var db=require(_0xc371('0x14'))['db'];function respondWithStatusCode(_0x512327,_0x1468dc){_0x1468dc=_0x1468dc||0xcc;return function(_0x1b2066){if(_0x1b2066){return _0x512327[_0xc371('0x15')](_0x1468dc);}return _0x512327['status'](_0x1468dc)['end']();};}function respondWithResult(_0x28f4d2,_0x594d11){_0x594d11=_0x594d11||0xc8;return function(_0x34edcb){if(_0x34edcb){return _0x28f4d2[_0xc371('0x16')](_0x594d11)[_0xc371('0x17')](_0x34edcb);}};}function respondWithFilteredResult(_0x102958,_0x20fac1){return function(_0x19fba4){if(_0x19fba4){var _0x209b67=typeof _0x20fac1[_0xc371('0x18')]===_0xc371('0x19')&&typeof _0x20fac1['limit']===_0xc371('0x19');var _0x36d78d=_0x19fba4['count'];var _0x2d2d34=_0x209b67?0x0:_0x20fac1['offset'];var _0x26d650=_0x209b67?_0x19fba4['count']:_0x20fac1['offset']+_0x20fac1[_0xc371('0x1a')];var _0x196521;if(_0x26d650>=_0x36d78d){_0x26d650=_0x36d78d;_0x196521=0xc8;}else{_0x196521=0xce;}_0x102958[_0xc371('0x16')](_0x196521);return _0x102958[_0xc371('0x1b')](_0xc371('0x1c'),_0x2d2d34+'-'+_0x26d650+'/'+_0x36d78d)[_0xc371('0x17')](_0x19fba4);}return null;};}function patchUpdates(_0xd2180d){return function(_0x547ee6){try{jsonpatch[_0xc371('0x1d')](_0x547ee6,_0xd2180d,!![]);}catch(_0x3c37d1){return BPromise[_0xc371('0x1e')](_0x3c37d1);}return _0x547ee6['save']();};}function saveUpdates(_0x587632,_0x28ceb5){return function(_0x12c7bd){if(_0x12c7bd){return _0x12c7bd[_0xc371('0x1f')](_0x587632)[_0xc371('0x20')](function(_0x4adef5){return _0x4adef5;});}return null;};}function removeEntity(_0x26ae46,_0x5c7bfe){return function(_0xe3a3fe){if(_0xe3a3fe){return _0xe3a3fe[_0xc371('0x21')]()[_0xc371('0x20')](function(){_0x26ae46[_0xc371('0x16')](0xcc)[_0xc371('0x22')]();});}};}function handleEntityNotFound(_0x3145e4,_0x449606){return function(_0x1d1991){if(!_0x1d1991){_0x3145e4[_0xc371('0x15')](0x194);}return _0x1d1991;};}function handleError(_0x27ce35,_0x411da3){_0x411da3=_0x411da3||0x1f4;return function(_0x50913f){logger[_0xc371('0x23')](_0x50913f['stack']);if(_0x50913f['name']){delete _0x50913f[_0xc371('0x24')];}_0x27ce35[_0xc371('0x16')](_0x411da3)['send'](_0x50913f);};}exports[_0xc371('0x25')]=function(_0x402dd9,_0xeb5720){var _0x4d8b95={},_0x3d362e={},_0x114dfa={'count':0x0,'rows':[]};var _0x1e38a4=_['map'](db[_0xc371('0x26')][_0xc371('0x27')],function(_0x37c3b9){return{'name':_0x37c3b9['fieldName'],'type':_0x37c3b9['type']['key']};});_0x3d362e['model']=_['map'](_0x1e38a4,_0xc371('0x24'));_0x3d362e['query']=_[_0xc371('0x28')](_0x402dd9[_0xc371('0x29')]);_0x3d362e[_0xc371('0x2a')]=_[_0xc371('0x2b')](_0x3d362e[_0xc371('0x2c')],_0x3d362e[_0xc371('0x29')]);_0x4d8b95['attributes']=_[_0xc371('0x2b')](_0x3d362e['model'],qs['fields'](_0x402dd9[_0xc371('0x29')][_0xc371('0x2d')]));_0x4d8b95[_0xc371('0x2e')]=_0x4d8b95[_0xc371('0x2e')][_0xc371('0x2f')]?_0x4d8b95[_0xc371('0x2e')]:_0x3d362e[_0xc371('0x2c')];if(!_0x402dd9[_0xc371('0x29')]['hasOwnProperty'](_0xc371('0x30'))){_0x4d8b95['limit']=qs[_0xc371('0x1a')](_0x402dd9[_0xc371('0x29')][_0xc371('0x1a')]);_0x4d8b95[_0xc371('0x18')]=qs['offset'](_0x402dd9[_0xc371('0x29')][_0xc371('0x18')]);}_0x4d8b95['order']=qs[_0xc371('0x31')](_0x402dd9[_0xc371('0x29')][_0xc371('0x31')]);_0x4d8b95[_0xc371('0x32')]=qs[_0xc371('0x2a')](_[_0xc371('0x33')](_0x402dd9[_0xc371('0x29')],_0x3d362e[_0xc371('0x2a')]),_0x1e38a4);if(_0x402dd9[_0xc371('0x29')][_0xc371('0x34')]){_0x4d8b95[_0xc371('0x32')]=_[_0xc371('0x35')](_0x4d8b95[_0xc371('0x32')],{'$or':_[_0xc371('0x36')](_0x1e38a4,function(_0x517ddb){if(_0x517ddb[_0xc371('0x37')]!==_0xc371('0x38')){var _0x2a5b3a={};_0x2a5b3a[_0x517ddb[_0xc371('0x24')]]={'$like':'%'+_0x402dd9[_0xc371('0x29')][_0xc371('0x34')]+'%'};return _0x2a5b3a;}})});}_0x4d8b95=_['merge']({},_0x4d8b95,_0x402dd9[_0xc371('0x39')]);var _0x239a2c={'where':_0x4d8b95[_0xc371('0x32')]};return db[_0xc371('0x26')][_0xc371('0x3a')](_0x239a2c)[_0xc371('0x20')](function(_0x54df2a){_0x114dfa[_0xc371('0x3a')]=_0x54df2a;if(_0x402dd9[_0xc371('0x29')][_0xc371('0x3b')]){_0x4d8b95['include']=[{'all':!![]}];}return db[_0xc371('0x26')]['findAll'](_0x4d8b95);})[_0xc371('0x20')](function(_0xe3d936){_0x114dfa['rows']=_0xe3d936;return _0x114dfa;})['then'](respondWithFilteredResult(_0xeb5720,_0x4d8b95))[_0xc371('0x3c')](handleError(_0xeb5720,null));};exports[_0xc371('0x3d')]=function(_0x5d878d,_0x515c27){var _0x52a6a9={'raw':!![],'where':{'id':_0x5d878d[_0xc371('0x3e')]['id']}},_0x5c13b5={};_0x5c13b5['model']=_[_0xc371('0x28')](db[_0xc371('0x26')]['rawAttributes']);_0x5c13b5[_0xc371('0x29')]=_[_0xc371('0x28')](_0x5d878d[_0xc371('0x29')]);_0x5c13b5['filters']=_['intersection'](_0x5c13b5[_0xc371('0x2c')],_0x5c13b5[_0xc371('0x29')]);_0x52a6a9[_0xc371('0x2e')]=_[_0xc371('0x2b')](_0x5c13b5[_0xc371('0x2c')],qs[_0xc371('0x2d')](_0x5d878d[_0xc371('0x29')][_0xc371('0x2d')]));_0x52a6a9['attributes']=_0x52a6a9[_0xc371('0x2e')][_0xc371('0x2f')]?_0x52a6a9['attributes']:_0x5c13b5['model'];if(_0x5d878d[_0xc371('0x29')][_0xc371('0x3b')]){_0x52a6a9['include']=[{'all':!![]}];}_0x52a6a9=_[_0xc371('0x35')]({},_0x52a6a9,_0x5d878d['options']);return db[_0xc371('0x26')][_0xc371('0x3f')](_0x52a6a9)[_0xc371('0x20')](handleEntityNotFound(_0x515c27,null))[_0xc371('0x20')](respondWithResult(_0x515c27,null))['catch'](handleError(_0x515c27,null));};exports[_0xc371('0x40')]=function(_0x40d54e,_0x10cf32){return db[_0xc371('0x26')]['create'](_0x40d54e[_0xc371('0x41')],{})[_0xc371('0x20')](respondWithResult(_0x10cf32,0xc9))['catch'](handleError(_0x10cf32,null));};exports[_0xc371('0x1f')]=function(_0x399724,_0x4a2a96){if(_0x399724[_0xc371('0x41')]['id']){delete _0x399724[_0xc371('0x41')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x399724[_0xc371('0x3e')]['id']}})[_0xc371('0x20')](handleEntityNotFound(_0x4a2a96,null))[_0xc371('0x20')](saveUpdates(_0x399724[_0xc371('0x41')],null))[_0xc371('0x20')](respondWithResult(_0x4a2a96,null))['catch'](handleError(_0x4a2a96,null));};exports[_0xc371('0x21')]=function(_0x52d2fc,_0x3112fd){return db[_0xc371('0x26')]['find']({'where':{'id':_0x52d2fc['params']['id']}})[_0xc371('0x20')](handleEntityNotFound(_0x3112fd,null))[_0xc371('0x20')](removeEntity(_0x3112fd,null))[_0xc371('0x3c')](handleError(_0x3112fd,null));}; \ No newline at end of file +var _0xdefa=['merge','findAll','rows','catch','show','params','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','index','MailServerOut','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter'];(function(_0x45c58e,_0x377824){var _0x37ed79=function(_0x569db3){while(--_0x569db3){_0x45c58e['push'](_0x45c58e['shift']());}};_0x37ed79(++_0x377824);}(_0xdefa,0x1c1));var _0xadef=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdefa[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xadef('0x0'));var rimraf=require(_0xadef('0x1'));var zipdir=require(_0xadef('0x2'));var jsonpatch=require(_0xadef('0x3'));var rp=require(_0xadef('0x4'));var moment=require('moment');var BPromise=require(_0xadef('0x5'));var Mustache=require(_0xadef('0x6'));var util=require(_0xadef('0x7'));var path=require('path');var sox=require(_0xadef('0x8'));var csv=require(_0xadef('0x9'));var ejs=require(_0xadef('0xa'));var fs=require('fs');var fs_extra=require(_0xadef('0xb'));var _=require(_0xadef('0xc'));var squel=require(_0xadef('0xd'));var crypto=require(_0xadef('0xe'));var jsforce=require(_0xadef('0xf'));var deskjs=require(_0xadef('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xadef('0x11'));var Redis=require(_0xadef('0x12'));var authService=require(_0xadef('0x13'));var qs=require(_0xadef('0x14'));var as=require(_0xadef('0x15'));var hardwareService=require(_0xadef('0x16'));var logger=require(_0xadef('0x17'))(_0xadef('0x18'));var utils=require('../../config/utils');var config=require(_0xadef('0x19'));var licenseUtil=require(_0xadef('0x1a'));var db=require(_0xadef('0x1b'))['db'];function respondWithStatusCode(_0x33b6e8,_0x14fa2e){_0x14fa2e=_0x14fa2e||0xcc;return function(_0x823bf6){if(_0x823bf6){return _0x33b6e8['sendStatus'](_0x14fa2e);}return _0x33b6e8[_0xadef('0x1c')](_0x14fa2e)[_0xadef('0x1d')]();};}function respondWithResult(_0x424b2a,_0x4c409a){_0x4c409a=_0x4c409a||0xc8;return function(_0x48e867){if(_0x48e867){return _0x424b2a[_0xadef('0x1c')](_0x4c409a)[_0xadef('0x1e')](_0x48e867);}};}function respondWithFilteredResult(_0x1c289e,_0x939f7b){return function(_0x5fc055){if(_0x5fc055){var _0x205112=typeof _0x939f7b[_0xadef('0x1f')]==='undefined'&&typeof _0x939f7b[_0xadef('0x20')]===_0xadef('0x21');var _0x30a329=_0x5fc055[_0xadef('0x22')];var _0x1b4737=_0x205112?0x0:_0x939f7b[_0xadef('0x1f')];var _0x4afa90=_0x205112?_0x5fc055[_0xadef('0x22')]:_0x939f7b[_0xadef('0x1f')]+_0x939f7b[_0xadef('0x20')];var _0x320eab;if(_0x4afa90>=_0x30a329){_0x4afa90=_0x30a329;_0x320eab=0xc8;}else{_0x320eab=0xce;}_0x1c289e['status'](_0x320eab);return _0x1c289e[_0xadef('0x23')](_0xadef('0x24'),_0x1b4737+'-'+_0x4afa90+'/'+_0x30a329)['json'](_0x5fc055);}return null;};}function patchUpdates(_0x75cf8e){return function(_0x4e289d){try{jsonpatch['apply'](_0x4e289d,_0x75cf8e,!![]);}catch(_0x3ad3b9){return BPromise[_0xadef('0x25')](_0x3ad3b9);}return _0x4e289d[_0xadef('0x26')]();};}function saveUpdates(_0x451121,_0x390245){return function(_0x51773d){if(_0x51773d){return _0x51773d['update'](_0x451121)[_0xadef('0x27')](function(_0x1c6a9c){return _0x1c6a9c;});}return null;};}function removeEntity(_0x17c5bd,_0x23b053){return function(_0x3f45cc){if(_0x3f45cc){return _0x3f45cc[_0xadef('0x28')]()[_0xadef('0x27')](function(){_0x17c5bd[_0xadef('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x118c68,_0xfe054d){return function(_0x474f2a){if(!_0x474f2a){_0x118c68[_0xadef('0x29')](0x194);}return _0x474f2a;};}function handleError(_0x120103,_0x390cb1){_0x390cb1=_0x390cb1||0x1f4;return function(_0x3ddb5b){logger[_0xadef('0x2a')](_0x3ddb5b[_0xadef('0x2b')]);if(_0x3ddb5b['name']){delete _0x3ddb5b['name'];}_0x120103[_0xadef('0x1c')](_0x390cb1)['send'](_0x3ddb5b);};}exports[_0xadef('0x2c')]=function(_0x114789,_0x37550f){var _0xa149fd={},_0x42ac07={},_0x28114e={'count':0x0,'rows':[]};var _0x222f4a=_['map'](db[_0xadef('0x2d')][_0xadef('0x2e')],function(_0x5c9ad3){return{'name':_0x5c9ad3[_0xadef('0x2f')],'type':_0x5c9ad3[_0xadef('0x30')]['key']};});_0x42ac07[_0xadef('0x31')]=_[_0xadef('0x32')](_0x222f4a,'name');_0x42ac07[_0xadef('0x33')]=_[_0xadef('0x34')](_0x114789[_0xadef('0x33')]);_0x42ac07[_0xadef('0x35')]=_[_0xadef('0x36')](_0x42ac07[_0xadef('0x31')],_0x42ac07[_0xadef('0x33')]);_0xa149fd[_0xadef('0x37')]=_[_0xadef('0x36')](_0x42ac07[_0xadef('0x31')],qs[_0xadef('0x38')](_0x114789[_0xadef('0x33')][_0xadef('0x38')]));_0xa149fd[_0xadef('0x37')]=_0xa149fd[_0xadef('0x37')][_0xadef('0x39')]?_0xa149fd[_0xadef('0x37')]:_0x42ac07[_0xadef('0x31')];if(!_0x114789['query'][_0xadef('0x3a')]('nolimit')){_0xa149fd[_0xadef('0x20')]=qs['limit'](_0x114789[_0xadef('0x33')][_0xadef('0x20')]);_0xa149fd['offset']=qs['offset'](_0x114789['query'][_0xadef('0x1f')]);}_0xa149fd[_0xadef('0x3b')]=qs['sort'](_0x114789[_0xadef('0x33')]['sort']);_0xa149fd[_0xadef('0x3c')]=qs[_0xadef('0x35')](_['pick'](_0x114789[_0xadef('0x33')],_0x42ac07[_0xadef('0x35')]),_0x222f4a);if(_0x114789[_0xadef('0x33')][_0xadef('0x3d')]){_0xa149fd[_0xadef('0x3c')]=_[_0xadef('0x3e')](_0xa149fd['where'],{'$or':_[_0xadef('0x32')](_0x222f4a,function(_0x2ca165){if(_0x2ca165[_0xadef('0x30')]!=='VIRTUAL'){var _0x4f78e0={};_0x4f78e0[_0x2ca165['name']]={'$like':'%'+_0x114789[_0xadef('0x33')][_0xadef('0x3d')]+'%'};return _0x4f78e0;}})});}_0xa149fd=_[_0xadef('0x3e')]({},_0xa149fd,_0x114789['options']);var _0x179ffd={'where':_0xa149fd['where']};return db[_0xadef('0x2d')][_0xadef('0x22')](_0x179ffd)[_0xadef('0x27')](function(_0x2210e4){_0x28114e['count']=_0x2210e4;if(_0x114789[_0xadef('0x33')]['includeAll']){_0xa149fd['include']=[{'all':!![]}];}return db[_0xadef('0x2d')][_0xadef('0x3f')](_0xa149fd);})['then'](function(_0x53029a){_0x28114e[_0xadef('0x40')]=_0x53029a;return _0x28114e;})['then'](respondWithFilteredResult(_0x37550f,_0xa149fd))[_0xadef('0x41')](handleError(_0x37550f,null));};exports[_0xadef('0x42')]=function(_0x3fdda0,_0x56a3d4){var _0x5bf0ce={'raw':!![],'where':{'id':_0x3fdda0[_0xadef('0x43')]['id']}},_0x2ca208={};_0x2ca208['model']=_[_0xadef('0x34')](db['MailServerOut'][_0xadef('0x2e')]);_0x2ca208[_0xadef('0x33')]=_[_0xadef('0x34')](_0x3fdda0[_0xadef('0x33')]);_0x2ca208[_0xadef('0x35')]=_[_0xadef('0x36')](_0x2ca208[_0xadef('0x31')],_0x2ca208[_0xadef('0x33')]);_0x5bf0ce[_0xadef('0x37')]=_[_0xadef('0x36')](_0x2ca208[_0xadef('0x31')],qs[_0xadef('0x38')](_0x3fdda0[_0xadef('0x33')]['fields']));_0x5bf0ce['attributes']=_0x5bf0ce[_0xadef('0x37')][_0xadef('0x39')]?_0x5bf0ce['attributes']:_0x2ca208['model'];if(_0x3fdda0['query'][_0xadef('0x44')]){_0x5bf0ce[_0xadef('0x45')]=[{'all':!![]}];}_0x5bf0ce=_['merge']({},_0x5bf0ce,_0x3fdda0['options']);return db['MailServerOut'][_0xadef('0x46')](_0x5bf0ce)[_0xadef('0x27')](handleEntityNotFound(_0x56a3d4,null))['then'](respondWithResult(_0x56a3d4,null))['catch'](handleError(_0x56a3d4,null));};exports[_0xadef('0x47')]=function(_0x40bb97,_0x286033){return db[_0xadef('0x2d')][_0xadef('0x47')](_0x40bb97['body'],{})[_0xadef('0x27')](respondWithResult(_0x286033,0xc9))['catch'](handleError(_0x286033,null));};exports['update']=function(_0x4f5c1b,_0x1c633f){if(_0x4f5c1b[_0xadef('0x48')]['id']){delete _0x4f5c1b[_0xadef('0x48')]['id'];}return db[_0xadef('0x2d')][_0xadef('0x46')]({'where':{'id':_0x4f5c1b['params']['id']}})[_0xadef('0x27')](handleEntityNotFound(_0x1c633f,null))[_0xadef('0x27')](saveUpdates(_0x4f5c1b['body'],null))[_0xadef('0x27')](respondWithResult(_0x1c633f,null))['catch'](handleError(_0x1c633f,null));};exports[_0xadef('0x28')]=function(_0x1cef81,_0x1629f4){return db[_0xadef('0x2d')][_0xadef('0x46')]({'where':{'id':_0x1cef81['params']['id']}})['then'](handleEntityNotFound(_0x1629f4,null))[_0xadef('0x27')](removeEntity(_0x1629f4,null))[_0xadef('0x41')](handleError(_0x1629f4,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 43e2fc8..b82910c 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 _0x9601=['./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','api','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9601,0xec));var _0x1960=function(_0x3978df,_0x53d738){_0x3978df=_0x3978df-0x0;var _0x136d20=_0x9601[_0x3978df];return _0x136d20;};'use strict';var _=require(_0x1960('0x0'));var util=require(_0x1960('0x1'));var logger=require('../../config/logger')(_0x1960('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1960('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1960('0x4'));module[_0x1960('0x5')]=function(_0x109e46,_0x2de109){return _0x109e46[_0x1960('0x6')](_0x1960('0x7'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83b8=['../../config/environment','exports','mail_servers_out','util','../../config/logger','bluebird','request-promise','path'];(function(_0x274756,_0x5ac551){var _0x586d3b=function(_0x5517c6){while(--_0x5517c6){_0x274756['push'](_0x274756['shift']());}};_0x586d3b(++_0x5ac551);}(_0x83b8,0x83));var _0x883b=function(_0x1ab3d7,_0x4703f2){_0x1ab3d7=_0x1ab3d7-0x0;var _0x2129d0=_0x83b8[_0x1ab3d7];return _0x2129d0;};'use strict';var _=require('lodash');var util=require(_0x883b('0x0'));var logger=require(_0x883b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x883b('0x2'));var rp=require(_0x883b('0x3'));var fs=require('fs');var path=require(_0x883b('0x4'));var rimraf=require('rimraf');var config=require(_0x883b('0x5'));var attributes=require('./mailServerOut.attributes');module[_0x883b('0x6')]=function(_0x231b45,_0x3c28f5){return _0x231b45['define']('MailServerOut',attributes,{'tableName':_0x883b('0x7'),'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 6a3a6f0..a005bc6 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4af5d9,_0x1198c8){var _0xf6a1fd=function(_0x4db7a7){while(--_0x4db7a7){_0x4af5d9['push'](_0x4af5d9['shift']());}};_0xf6a1fd(++_0x1198c8);}(_0xadb5,0xad));var _0x5adb=function(_0x23bdea,_0x5c00ad){_0x23bdea=_0x23bdea-0x0;var _0x1fadf0=_0xadb5[_0x23bdea];return _0x1fadf0;};'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']('MailServerOut,\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','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xd7e92f,_0x364491){var _0x126d1a=function(_0x13d4bf){while(--_0x13d4bf){_0xd7e92f['push'](_0xd7e92f['shift']());}};_0x126d1a(++_0x364491);}(_0x2ef3,0xba));var _0x32ef=function(_0x56f8fd,_0x52f188){_0x56f8fd=_0x56f8fd-0x0;var _0x364376=_0x2ef3[_0x56f8fd];return _0x364376;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0a5dc51..8fdc50a 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 _0xc3f9=['destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','/:id','show','post','create','delete'];(function(_0x56b878,_0x4be9aa){var _0x32b9ec=function(_0x1511ea){while(--_0x1511ea){_0x56b878['push'](_0x56b878['shift']());}};_0x32b9ec(++_0x4be9aa);}(_0xc3f9,0x112));var _0x9c3f=function(_0x34b930,_0x4b5012){_0x34b930=_0x34b930-0x0;var _0x1cae80=_0xc3f9[_0x34b930];return _0x1cae80;};'use strict';var multer=require(_0x9c3f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9c3f('0x1'));var router=express[_0x9c3f('0x2')]();var fs_extra=require(_0x9c3f('0x3'));var auth=require(_0x9c3f('0x4'));var interaction=require(_0x9c3f('0x5'));var config=require(_0x9c3f('0x6'));var controller=require(_0x9c3f('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x9c3f('0x8')](),controller['describe']);router['get'](_0x9c3f('0x9'),auth[_0x9c3f('0x8')](),controller[_0x9c3f('0xa')]);router[_0x9c3f('0xb')]('/',auth[_0x9c3f('0x8')](),controller[_0x9c3f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9c3f('0xd')](_0x9c3f('0x9'),auth['isAuthenticated'](),controller[_0x9c3f('0xe')]);module[_0x9c3f('0xf')]=router; \ No newline at end of file +var _0xed13=['destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x299e1e,_0x20eab5){var _0x3757dc=function(_0x211535){while(--_0x211535){_0x299e1e['push'](_0x299e1e['shift']());}};_0x3757dc(++_0x20eab5);}(_0xed13,0xa3));var _0x3ed1=function(_0x4b67c9,_0x58f091){_0x4b67c9=_0x4b67c9-0x0;var _0x4fd11f=_0xed13[_0x4b67c9];return _0x4fd11f;};'use strict';var multer=require(_0x3ed1('0x0'));var util=require('util');var path=require(_0x3ed1('0x1'));var timeout=require(_0x3ed1('0x2'));var express=require(_0x3ed1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3ed1('0x4'));var config=require(_0x3ed1('0x5'));var controller=require(_0x3ed1('0x6'));router[_0x3ed1('0x7')]('/',auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x9')]);router[_0x3ed1('0x7')](_0x3ed1('0xa'),auth['isAuthenticated'](),controller[_0x3ed1('0xb')]);router[_0x3ed1('0x7')](_0x3ed1('0xc'),auth['isAuthenticated'](),controller[_0x3ed1('0xd')]);router['post']('/',auth[_0x3ed1('0x8')](),controller['create']);router[_0x3ed1('0xe')](_0x3ed1('0xc'),auth['isAuthenticated'](),controller[_0x3ed1('0xf')]);router[_0x3ed1('0x10')]('/:id',auth[_0x3ed1('0x8')](),controller[_0x3ed1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index df930c7..b0de6ec 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 _0x06f4=['name','STRING','sequelize','exports'];(function(_0x16afb4,_0x2806ff){var _0x8a53be=function(_0x13f5e2){while(--_0x13f5e2){_0x16afb4['push'](_0x16afb4['shift']());}};_0x8a53be(++_0x2806ff);}(_0x06f4,0x136));var _0x406f=function(_0x46beac,_0x126772){_0x46beac=_0x46beac-0x0;var _0x494b20=_0x06f4[_0x46beac];return _0x494b20;};'use strict';var Sequelize=require(_0x406f('0x0'));module[_0x406f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x406f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x406f('0x3')]}}; \ No newline at end of file +var _0x9fe7=['exports','name','sequelize'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0x9fe7,0x1df));var _0x79fe=function(_0x1d2d04,_0x231c57){_0x1d2d04=_0x1d2d04-0x0;var _0x3d405f=_0x9fe7[_0x1d2d04];return _0x3d405f;};'use strict';var Sequelize=require(_0x79fe('0x0'));module[_0x79fe('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x79fe('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 28339d2..1b46243 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 _0x1358=['model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','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','../../mysqldb','end','json','offset','limit','undefined','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','status','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1358,0x67));var _0x8135=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1358[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x8135('0x0'));var rimraf=require(_0x8135('0x1'));var zipdir=require(_0x8135('0x2'));var jsonpatch=require(_0x8135('0x3'));var rp=require('request-promise');var moment=require(_0x8135('0x4'));var BPromise=require(_0x8135('0x5'));var Mustache=require(_0x8135('0x6'));var util=require('util');var path=require(_0x8135('0x7'));var sox=require(_0x8135('0x8'));var csv=require(_0x8135('0x9'));var ejs=require(_0x8135('0xa'));var fs=require('fs');var fs_extra=require(_0x8135('0xb'));var _=require(_0x8135('0xc'));var squel=require(_0x8135('0xd'));var crypto=require(_0x8135('0xe'));var jsforce=require(_0x8135('0xf'));var deskjs=require(_0x8135('0x10'));var toCsv=require(_0x8135('0x9'));var querystring=require(_0x8135('0x11'));var Papa=require(_0x8135('0x12'));var Redis=require('ioredis');var authService=require(_0x8135('0x13'));var qs=require(_0x8135('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8135('0x15'));var logger=require(_0x8135('0x16'))(_0x8135('0x17'));var utils=require(_0x8135('0x18'));var config=require(_0x8135('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8135('0x1a'))['db'];function respondWithStatusCode(_0x25b827,_0x2ad7dc){_0x2ad7dc=_0x2ad7dc||0xcc;return function(_0x5bce10){if(_0x5bce10){return _0x25b827['sendStatus'](_0x2ad7dc);}return _0x25b827['status'](_0x2ad7dc)[_0x8135('0x1b')]();};}function respondWithResult(_0x2a56d8,_0x1362d9){_0x1362d9=_0x1362d9||0xc8;return function(_0x2d45aa){if(_0x2d45aa){return _0x2a56d8['status'](_0x1362d9)[_0x8135('0x1c')](_0x2d45aa);}};}function respondWithFilteredResult(_0x4eaabd,_0x26eb70){return function(_0xc9553c){if(_0xc9553c){var _0x443562=typeof _0x26eb70[_0x8135('0x1d')]==='undefined'&&typeof _0x26eb70[_0x8135('0x1e')]===_0x8135('0x1f');var _0x242fdf=_0xc9553c['count'];var _0x3b64be=_0x443562?0x0:_0x26eb70[_0x8135('0x1d')];var _0x50aa2e=_0x443562?_0xc9553c['count']:_0x26eb70[_0x8135('0x1d')]+_0x26eb70[_0x8135('0x1e')];var _0x149743;if(_0x50aa2e>=_0x242fdf){_0x50aa2e=_0x242fdf;_0x149743=0xc8;}else{_0x149743=0xce;}_0x4eaabd['status'](_0x149743);return _0x4eaabd[_0x8135('0x20')](_0x8135('0x21'),_0x3b64be+'-'+_0x50aa2e+'/'+_0x242fdf)['json'](_0xc9553c);}return null;};}function patchUpdates(_0xcac0e4){return function(_0xc6e5ad){try{jsonpatch['apply'](_0xc6e5ad,_0xcac0e4,!![]);}catch(_0x83f13e){return BPromise[_0x8135('0x22')](_0x83f13e);}return _0xc6e5ad[_0x8135('0x23')]();};}function saveUpdates(_0xe8a241,_0x5365a0){return function(_0x25426b){if(_0x25426b){return _0x25426b[_0x8135('0x24')](_0xe8a241)[_0x8135('0x25')](function(_0x337f63){return _0x337f63;});}return null;};}function removeEntity(_0x26244f,_0x2a5e8b){return function(_0x54d4d8){if(_0x54d4d8){return _0x54d4d8[_0x8135('0x26')]()['then'](function(){_0x26244f['status'](0xcc)[_0x8135('0x1b')]();});}};}function handleEntityNotFound(_0x361b81,_0x49335b){return function(_0xb25e92){if(!_0xb25e92){_0x361b81[_0x8135('0x27')](0x194);}return _0xb25e92;};}function handleError(_0x143df5,_0x2665da){_0x2665da=_0x2665da||0x1f4;return function(_0x88305b){logger[_0x8135('0x28')](_0x88305b['stack']);if(_0x88305b[_0x8135('0x29')]){delete _0x88305b[_0x8135('0x29')];}_0x143df5[_0x8135('0x2a')](_0x2665da)['send'](_0x88305b);};}exports[_0x8135('0x2b')]=function(_0x1b5f3e,_0x495421){var _0x59b7e0={},_0x21a6d6={},_0x423f6a={'count':0x0,'rows':[]};var _0x151a1e=_[_0x8135('0x2c')](db[_0x8135('0x2d')][_0x8135('0x2e')],function(_0xfc02b2){return{'name':_0xfc02b2[_0x8135('0x2f')],'type':_0xfc02b2[_0x8135('0x30')][_0x8135('0x31')]};});_0x21a6d6['model']=_[_0x8135('0x2c')](_0x151a1e,'name');_0x21a6d6[_0x8135('0x32')]=_[_0x8135('0x33')](_0x1b5f3e[_0x8135('0x32')]);_0x21a6d6[_0x8135('0x34')]=_['intersection'](_0x21a6d6[_0x8135('0x35')],_0x21a6d6[_0x8135('0x32')]);_0x59b7e0[_0x8135('0x36')]=_[_0x8135('0x37')](_0x21a6d6[_0x8135('0x35')],qs[_0x8135('0x38')](_0x1b5f3e[_0x8135('0x32')][_0x8135('0x38')]));_0x59b7e0[_0x8135('0x36')]=_0x59b7e0[_0x8135('0x36')][_0x8135('0x39')]?_0x59b7e0[_0x8135('0x36')]:_0x21a6d6[_0x8135('0x35')];if(!_0x1b5f3e[_0x8135('0x32')][_0x8135('0x3a')](_0x8135('0x3b'))){_0x59b7e0[_0x8135('0x1e')]=qs[_0x8135('0x1e')](_0x1b5f3e[_0x8135('0x32')][_0x8135('0x1e')]);_0x59b7e0[_0x8135('0x1d')]=qs['offset'](_0x1b5f3e[_0x8135('0x32')][_0x8135('0x1d')]);}_0x59b7e0['order']=qs[_0x8135('0x3c')](_0x1b5f3e[_0x8135('0x32')][_0x8135('0x3c')]);_0x59b7e0[_0x8135('0x3d')]=qs[_0x8135('0x34')](_['pick'](_0x1b5f3e[_0x8135('0x32')],_0x21a6d6['filters']),_0x151a1e);if(_0x1b5f3e[_0x8135('0x32')][_0x8135('0x3e')]){_0x59b7e0['where']=_[_0x8135('0x3f')](_0x59b7e0['where'],{'$or':_[_0x8135('0x2c')](_0x151a1e,function(_0x2f7ffb){if(_0x2f7ffb[_0x8135('0x30')]!==_0x8135('0x40')){var _0x73bf24={};_0x73bf24[_0x2f7ffb['name']]={'$like':'%'+_0x1b5f3e[_0x8135('0x32')]['filter']+'%'};return _0x73bf24;}})});}_0x59b7e0=_[_0x8135('0x3f')]({},_0x59b7e0,_0x1b5f3e['options']);var _0x2545e7={'where':_0x59b7e0['where']};return db[_0x8135('0x2d')]['count'](_0x2545e7)[_0x8135('0x25')](function(_0x398e84){_0x423f6a[_0x8135('0x41')]=_0x398e84;if(_0x1b5f3e[_0x8135('0x32')][_0x8135('0x42')]){_0x59b7e0[_0x8135('0x43')]=[{'all':!![]}];}return db['MailSubstatus'][_0x8135('0x44')](_0x59b7e0);})[_0x8135('0x25')](function(_0x437d37){_0x423f6a[_0x8135('0x45')]=_0x437d37;return _0x423f6a;})[_0x8135('0x25')](respondWithFilteredResult(_0x495421,_0x59b7e0))[_0x8135('0x46')](handleError(_0x495421,null));};exports[_0x8135('0x47')]=function(_0x47b5eb,_0x5899ed){var _0x4bd539={'raw':!![],'where':{'id':_0x47b5eb[_0x8135('0x48')]['id']}},_0x3f84a2={};_0x3f84a2[_0x8135('0x35')]=_[_0x8135('0x33')](db['MailSubstatus'][_0x8135('0x2e')]);_0x3f84a2[_0x8135('0x32')]=_[_0x8135('0x33')](_0x47b5eb[_0x8135('0x32')]);_0x3f84a2[_0x8135('0x34')]=_[_0x8135('0x37')](_0x3f84a2[_0x8135('0x35')],_0x3f84a2[_0x8135('0x32')]);_0x4bd539[_0x8135('0x36')]=_[_0x8135('0x37')](_0x3f84a2[_0x8135('0x35')],qs[_0x8135('0x38')](_0x47b5eb[_0x8135('0x32')][_0x8135('0x38')]));_0x4bd539[_0x8135('0x36')]=_0x4bd539[_0x8135('0x36')][_0x8135('0x39')]?_0x4bd539[_0x8135('0x36')]:_0x3f84a2[_0x8135('0x35')];if(_0x47b5eb['query']['includeAll']){_0x4bd539[_0x8135('0x43')]=[{'all':!![]}];}_0x4bd539=_[_0x8135('0x3f')]({},_0x4bd539,_0x47b5eb[_0x8135('0x49')]);return db[_0x8135('0x2d')][_0x8135('0x4a')](_0x4bd539)[_0x8135('0x25')](handleEntityNotFound(_0x5899ed,null))[_0x8135('0x25')](respondWithResult(_0x5899ed,null))[_0x8135('0x46')](handleError(_0x5899ed,null));};exports[_0x8135('0x4b')]=function(_0x3e2fd0,_0xa72a13){return db['MailSubstatus'][_0x8135('0x4b')](_0x3e2fd0[_0x8135('0x4c')],{})[_0x8135('0x25')](respondWithResult(_0xa72a13,0xc9))[_0x8135('0x46')](handleError(_0xa72a13,null));};exports['update']=function(_0x2852f8,_0x3f32ea){if(_0x2852f8[_0x8135('0x4c')]['id']){delete _0x2852f8[_0x8135('0x4c')]['id'];}return db[_0x8135('0x2d')][_0x8135('0x4a')]({'where':{'id':_0x2852f8[_0x8135('0x48')]['id']}})[_0x8135('0x25')](handleEntityNotFound(_0x3f32ea,null))['then'](saveUpdates(_0x2852f8[_0x8135('0x4c')],null))[_0x8135('0x25')](respondWithResult(_0x3f32ea,null))[_0x8135('0x46')](handleError(_0x3f32ea,null));};exports[_0x8135('0x26')]=function(_0x56c5ef,_0x3033b7){return db[_0x8135('0x2d')][_0x8135('0x4a')]({'where':{'id':_0x56c5ef[_0x8135('0x48')]['id']}})[_0x8135('0x25')](handleEntityNotFound(_0x3033b7,null))[_0x8135('0x25')](removeEntity(_0x3033b7,null))['catch'](handleError(_0x3033b7,null));};exports['describe']=function(_0x57c28a,_0x37e150){return db['MailSubstatus'][_0x8135('0x4d')]()[_0x8135('0x25')](respondWithResult(_0x37e150,null))[_0x8135('0x46')](handleError(_0x37e150,null));}; \ No newline at end of file +var _0xe369=['filters','where','merge','VIRTUAL','filter','options','MailSubstatus','includeAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xe369,0xf1));var _0x9e36=function(_0x1cde18,_0x16d762){_0x1cde18=_0x1cde18-0x0;var _0x4dcc7c=_0xe369[_0x1cde18];return _0x4dcc7c;};'use strict';var emlformat=require(_0x9e36('0x0'));var rimraf=require(_0x9e36('0x1'));var zipdir=require(_0x9e36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9e36('0x3'));var BPromise=require(_0x9e36('0x4'));var Mustache=require(_0x9e36('0x5'));var util=require(_0x9e36('0x6'));var path=require(_0x9e36('0x7'));var sox=require(_0x9e36('0x8'));var csv=require(_0x9e36('0x9'));var ejs=require(_0x9e36('0xa'));var fs=require('fs');var fs_extra=require(_0x9e36('0xb'));var _=require(_0x9e36('0xc'));var squel=require(_0x9e36('0xd'));var crypto=require('crypto');var jsforce=require(_0x9e36('0xe'));var deskjs=require(_0x9e36('0xf'));var toCsv=require(_0x9e36('0x9'));var querystring=require(_0x9e36('0x10'));var Papa=require('papaparse');var Redis=require(_0x9e36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9e36('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e36('0x13'));var logger=require(_0x9e36('0x14'))(_0x9e36('0x15'));var utils=require(_0x9e36('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9e36('0x17'));var db=require(_0x9e36('0x18'))['db'];function respondWithStatusCode(_0x39ee52,_0x33b021){_0x33b021=_0x33b021||0xcc;return function(_0x2deba1){if(_0x2deba1){return _0x39ee52[_0x9e36('0x19')](_0x33b021);}return _0x39ee52[_0x9e36('0x1a')](_0x33b021)[_0x9e36('0x1b')]();};}function respondWithResult(_0x10c054,_0x5d725d){_0x5d725d=_0x5d725d||0xc8;return function(_0x51949b){if(_0x51949b){return _0x10c054[_0x9e36('0x1a')](_0x5d725d)[_0x9e36('0x1c')](_0x51949b);}};}function respondWithFilteredResult(_0xdb60df,_0x5e6bd5){return function(_0x1dd3c0){if(_0x1dd3c0){var _0x4e20b6=typeof _0x5e6bd5[_0x9e36('0x1d')]===_0x9e36('0x1e')&&typeof _0x5e6bd5[_0x9e36('0x1f')]==='undefined';var _0x65141c=_0x1dd3c0[_0x9e36('0x20')];var _0x3638e3=_0x4e20b6?0x0:_0x5e6bd5[_0x9e36('0x1d')];var _0x548b7d=_0x4e20b6?_0x1dd3c0[_0x9e36('0x20')]:_0x5e6bd5[_0x9e36('0x1d')]+_0x5e6bd5[_0x9e36('0x1f')];var _0x5ce183;if(_0x548b7d>=_0x65141c){_0x548b7d=_0x65141c;_0x5ce183=0xc8;}else{_0x5ce183=0xce;}_0xdb60df[_0x9e36('0x1a')](_0x5ce183);return _0xdb60df[_0x9e36('0x21')](_0x9e36('0x22'),_0x3638e3+'-'+_0x548b7d+'/'+_0x65141c)[_0x9e36('0x1c')](_0x1dd3c0);}return null;};}function patchUpdates(_0x101831){return function(_0x2dd9bc){try{jsonpatch[_0x9e36('0x23')](_0x2dd9bc,_0x101831,!![]);}catch(_0xc10247){return BPromise[_0x9e36('0x24')](_0xc10247);}return _0x2dd9bc[_0x9e36('0x25')]();};}function saveUpdates(_0x572b6f,_0x51e6be){return function(_0x1e04a8){if(_0x1e04a8){return _0x1e04a8[_0x9e36('0x26')](_0x572b6f)['then'](function(_0x1fe80a){return _0x1fe80a;});}return null;};}function removeEntity(_0x1ca09b,_0x5efdff){return function(_0x137401){if(_0x137401){return _0x137401[_0x9e36('0x27')]()[_0x9e36('0x28')](function(){_0x1ca09b[_0x9e36('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41fb70,_0x230e33){return function(_0x3de4ec){if(!_0x3de4ec){_0x41fb70['sendStatus'](0x194);}return _0x3de4ec;};}function handleError(_0x5607b5,_0x286f37){_0x286f37=_0x286f37||0x1f4;return function(_0xa7d25c){logger['error'](_0xa7d25c[_0x9e36('0x29')]);if(_0xa7d25c['name']){delete _0xa7d25c[_0x9e36('0x2a')];}_0x5607b5[_0x9e36('0x1a')](_0x286f37)['send'](_0xa7d25c);};}exports['index']=function(_0x23da1b,_0x142328){var _0x136e60={},_0x3e5178={},_0x564659={'count':0x0,'rows':[]};var _0xab9d86=_['map'](db['MailSubstatus'][_0x9e36('0x2b')],function(_0x659a5a){return{'name':_0x659a5a[_0x9e36('0x2c')],'type':_0x659a5a[_0x9e36('0x2d')][_0x9e36('0x2e')]};});_0x3e5178[_0x9e36('0x2f')]=_[_0x9e36('0x30')](_0xab9d86,_0x9e36('0x2a'));_0x3e5178[_0x9e36('0x31')]=_[_0x9e36('0x32')](_0x23da1b[_0x9e36('0x31')]);_0x3e5178['filters']=_[_0x9e36('0x33')](_0x3e5178[_0x9e36('0x2f')],_0x3e5178['query']);_0x136e60['attributes']=_['intersection'](_0x3e5178[_0x9e36('0x2f')],qs[_0x9e36('0x34')](_0x23da1b[_0x9e36('0x31')][_0x9e36('0x34')]));_0x136e60['attributes']=_0x136e60[_0x9e36('0x35')][_0x9e36('0x36')]?_0x136e60[_0x9e36('0x35')]:_0x3e5178[_0x9e36('0x2f')];if(!_0x23da1b['query'][_0x9e36('0x37')](_0x9e36('0x38'))){_0x136e60[_0x9e36('0x1f')]=qs[_0x9e36('0x1f')](_0x23da1b['query'][_0x9e36('0x1f')]);_0x136e60[_0x9e36('0x1d')]=qs[_0x9e36('0x1d')](_0x23da1b[_0x9e36('0x31')]['offset']);}_0x136e60[_0x9e36('0x39')]=qs['sort'](_0x23da1b['query'][_0x9e36('0x3a')]);_0x136e60['where']=qs['filters'](_['pick'](_0x23da1b[_0x9e36('0x31')],_0x3e5178[_0x9e36('0x3b')]),_0xab9d86);if(_0x23da1b[_0x9e36('0x31')]['filter']){_0x136e60[_0x9e36('0x3c')]=_[_0x9e36('0x3d')](_0x136e60[_0x9e36('0x3c')],{'$or':_[_0x9e36('0x30')](_0xab9d86,function(_0x26b787){if(_0x26b787[_0x9e36('0x2d')]!==_0x9e36('0x3e')){var _0x3b4044={};_0x3b4044[_0x26b787[_0x9e36('0x2a')]]={'$like':'%'+_0x23da1b['query'][_0x9e36('0x3f')]+'%'};return _0x3b4044;}})});}_0x136e60=_['merge']({},_0x136e60,_0x23da1b[_0x9e36('0x40')]);var _0x2ef214={'where':_0x136e60['where']};return db[_0x9e36('0x41')][_0x9e36('0x20')](_0x2ef214)[_0x9e36('0x28')](function(_0x110c40){_0x564659[_0x9e36('0x20')]=_0x110c40;if(_0x23da1b[_0x9e36('0x31')][_0x9e36('0x42')]){_0x136e60['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x136e60);})[_0x9e36('0x28')](function(_0x44ccaf){_0x564659[_0x9e36('0x43')]=_0x44ccaf;return _0x564659;})[_0x9e36('0x28')](respondWithFilteredResult(_0x142328,_0x136e60))[_0x9e36('0x44')](handleError(_0x142328,null));};exports[_0x9e36('0x45')]=function(_0x5cc562,_0x3bc257){var _0x343803={'raw':!![],'where':{'id':_0x5cc562['params']['id']}},_0x3234c0={};_0x3234c0['model']=_[_0x9e36('0x32')](db[_0x9e36('0x41')]['rawAttributes']);_0x3234c0[_0x9e36('0x31')]=_['keys'](_0x5cc562[_0x9e36('0x31')]);_0x3234c0[_0x9e36('0x3b')]=_[_0x9e36('0x33')](_0x3234c0[_0x9e36('0x2f')],_0x3234c0[_0x9e36('0x31')]);_0x343803[_0x9e36('0x35')]=_[_0x9e36('0x33')](_0x3234c0[_0x9e36('0x2f')],qs[_0x9e36('0x34')](_0x5cc562[_0x9e36('0x31')]['fields']));_0x343803[_0x9e36('0x35')]=_0x343803[_0x9e36('0x35')][_0x9e36('0x36')]?_0x343803['attributes']:_0x3234c0[_0x9e36('0x2f')];if(_0x5cc562['query'][_0x9e36('0x42')]){_0x343803['include']=[{'all':!![]}];}_0x343803=_[_0x9e36('0x3d')]({},_0x343803,_0x5cc562[_0x9e36('0x40')]);return db[_0x9e36('0x41')][_0x9e36('0x46')](_0x343803)[_0x9e36('0x28')](handleEntityNotFound(_0x3bc257,null))['then'](respondWithResult(_0x3bc257,null))['catch'](handleError(_0x3bc257,null));};exports[_0x9e36('0x47')]=function(_0x2832a6,_0x4af15a){return db[_0x9e36('0x41')][_0x9e36('0x47')](_0x2832a6[_0x9e36('0x48')],{})[_0x9e36('0x28')](respondWithResult(_0x4af15a,0xc9))[_0x9e36('0x44')](handleError(_0x4af15a,null));};exports['update']=function(_0x5ce9ec,_0x889a2e){if(_0x5ce9ec[_0x9e36('0x48')]['id']){delete _0x5ce9ec[_0x9e36('0x48')]['id'];}return db[_0x9e36('0x41')]['find']({'where':{'id':_0x5ce9ec['params']['id']}})[_0x9e36('0x28')](handleEntityNotFound(_0x889a2e,null))[_0x9e36('0x28')](saveUpdates(_0x5ce9ec[_0x9e36('0x48')],null))['then'](respondWithResult(_0x889a2e,null))[_0x9e36('0x44')](handleError(_0x889a2e,null));};exports['destroy']=function(_0x50499a,_0x278daa){return db[_0x9e36('0x41')][_0x9e36('0x46')]({'where':{'id':_0x50499a[_0x9e36('0x49')]['id']}})['then'](handleEntityNotFound(_0x278daa,null))[_0x9e36('0x28')](removeEntity(_0x278daa,null))['catch'](handleError(_0x278daa,null));};exports['describe']=function(_0x199e16,_0x41dbf8){return db[_0x9e36('0x41')][_0x9e36('0x4a')]()[_0x9e36('0x28')](respondWithResult(_0x41dbf8,null))[_0x9e36('0x44')](handleError(_0x41dbf8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index cf9d06a..ac7cb11 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 _0x4505=['emit','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x38fcc2,_0x5e8d76){var _0x10a6f1=function(_0x27f98f){while(--_0x27f98f){_0x38fcc2['push'](_0x38fcc2['shift']());}};_0x10a6f1(++_0x5e8d76);}(_0x4505,0x163));var _0x5450=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x4505[_0x21549c];return _0x426cbd;};'use strict';var EventEmitter=require(_0x5450('0x0'));var MailSubstatus=require(_0x5450('0x1'))['db'][_0x5450('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5450('0x3')](0x0);var events={'afterUpdate':_0x5450('0x4')};function emitEvent(_0x52d133){return function(_0x20ca01,_0x5a994d,_0x594c8c){MailSubstatusEvents[_0x5450('0x5')](_0x52d133+':'+_0x20ca01['id'],_0x20ca01);MailSubstatusEvents[_0x5450('0x5')](_0x52d133,_0x20ca01);_0x594c8c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x5450('0x6')](e,emitEvent(event));}}module[_0x5450('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x4c3e=['MailSubstatus','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x34434d,_0x5ad557){var _0x29b809=function(_0x275954){while(--_0x275954){_0x34434d['push'](_0x34434d['shift']());}};_0x29b809(++_0x5ad557);}(_0x4c3e,0x124));var _0xe4c3=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x4c3e[_0x13ea00];return _0x1f7347;};'use strict';var EventEmitter=require(_0xe4c3('0x0'));var MailSubstatus=require(_0xe4c3('0x1'))['db'][_0xe4c3('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x1dfaa4){return function(_0x5e5ea1,_0x1049ea,_0x526962){MailSubstatusEvents[_0xe4c3('0x3')](_0x1dfaa4+':'+_0x5e5ea1['id'],_0x5e5ea1);MailSubstatusEvents['emit'](_0x1dfaa4,_0x5e5ea1);_0x526962(null);};}for(var e in events){if(events[_0xe4c3('0x4')](e)){var event=events[e];MailSubstatus[_0xe4c3('0x5')](e,emitEvent(event));}}module[_0xe4c3('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index dbbd9fc..7d5851b 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 _0x5f23=['mailSubstatus','name','then','catch','./mailSubstatus.attributes','exports','define','mail_substatuses','Condition','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f23,0x7c));var _0x35f2=function(_0x4260c2,_0x3c4ef9){_0x4260c2=_0x4260c2-0x0;var _0x482f90=_0x5f23[_0x4260c2];return _0x482f90;};'use strict';var attributes=require(_0x35f2('0x0'));module[_0x35f2('0x1')]=function(_0x2cd0f3){var _0xb8aaf=_0x2cd0f3['models'];return _0x2cd0f3[_0x35f2('0x2')]('MailSubstatus',attributes,{'tableName':_0x35f2('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x19e704,_0x404767,_0x2cc58a){return _0xb8aaf[_0x35f2('0x4')][_0x35f2('0x5')]({'value':_0x19e704['name']},{'where':{'field':_0x35f2('0x6'),'value':_0x19e704['_previousDataValues'][_0x35f2('0x7')]}})[_0x35f2('0x8')](function(){_0x2cc58a();})[_0x35f2('0x9')](function(_0xb2b4dc){_0x2cc58a(_0xb2b4dc);});}}});}; \ No newline at end of file +var _0x617c=['then','catch','./mailSubstatus.attributes','exports','models','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues'];(function(_0x37edd2,_0x2a0fef){var _0x448bbb=function(_0x5d4e85){while(--_0x5d4e85){_0x37edd2['push'](_0x37edd2['shift']());}};_0x448bbb(++_0x2a0fef);}(_0x617c,0x1e2));var _0xc617=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x617c[_0x1a595a];return _0x33f008;};'use strict';var attributes=require(_0xc617('0x0'));module[_0xc617('0x1')]=function(_0x21d634){var _0xb59815=_0x21d634[_0xc617('0x2')];return _0x21d634['define']('MailSubstatus',attributes,{'tableName':_0xc617('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2ec1f6,_0x248b4e,_0x7a05df){return _0xb59815[_0xc617('0x4')]['update']({'value':_0x2ec1f6[_0xc617('0x5')]},{'where':{'field':_0xc617('0x6'),'value':_0x2ec1f6[_0xc617('0x7')][_0xc617('0x5')]}})[_0xc617('0x8')](function(){_0x7a05df();})[_0xc617('0x9')](function(_0x58a067){_0x7a05df(_0x58a067);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index ea26c6a..592ed21 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 _0xe0b1=['MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x34d131,_0x2503b2){var _0x25023f=function(_0x41bac7){while(--_0x41bac7){_0x34d131['push'](_0x34d131['shift']());}};_0x25023f(++_0x2503b2);}(_0xe0b1,0x10c));var _0x1e0b=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0xe0b1[_0x4d8789];return _0x404e41;};'use strict';var _=require(_0x1e0b('0x0'));var util=require(_0x1e0b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e0b('0x2'));var db=require(_0x1e0b('0x3'))['db'];var utils=require(_0x1e0b('0x4'));var logger=require('../../config/logger')(_0x1e0b('0x5'));var config=require(_0x1e0b('0x6'));var jayson=require(_0x1e0b('0x7'));var client=jayson['client'][_0x1e0b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a8b2c,_0x41dbcd,_0x18eb33){return new BPromise(function(_0x28f7fc,_0x301ed1){return client[_0x1e0b('0x9')](_0x4a8b2c,_0x18eb33)[_0x1e0b('0xa')](function(_0xf816a8){logger[_0x1e0b('0xb')](_0x1e0b('0xc'),_0x41dbcd,_0x1e0b('0xd'));logger['debug'](_0x1e0b('0xe'),_0x41dbcd,'request\x20sent',JSON[_0x1e0b('0xf')](_0xf816a8));if(_0xf816a8[_0x1e0b('0x10')]){if(_0xf816a8[_0x1e0b('0x10')]['code']===0x1f4){logger[_0x1e0b('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x41dbcd,_0xf816a8[_0x1e0b('0x10')]['message']);return _0x301ed1(_0xf816a8[_0x1e0b('0x10')][_0x1e0b('0x11')]);}logger[_0x1e0b('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x41dbcd,_0xf816a8[_0x1e0b('0x10')][_0x1e0b('0x11')]);return _0x28f7fc(_0xf816a8['error'][_0x1e0b('0x11')]);}else{logger[_0x1e0b('0xb')](_0x1e0b('0xc'),_0x41dbcd,_0x1e0b('0xd'));_0x28f7fc(_0xf816a8[_0x1e0b('0x12')][_0x1e0b('0x11')]);}})[_0x1e0b('0x13')](function(_0x10a480){logger[_0x1e0b('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x41dbcd,_0x10a480);_0x301ed1(_0x10a480);});});} \ No newline at end of file +var _0x6dbd=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0x6dbd,0x110));var _0xd6db=function(_0x56196c,_0x55bf95){_0x56196c=_0x56196c-0x0;var _0x33d519=_0x6dbd[_0x56196c];return _0x33d519;};'use strict';var _=require(_0xd6db('0x0'));var util=require(_0xd6db('0x1'));var moment=require(_0xd6db('0x2'));var BPromise=require(_0xd6db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6db('0x4'));var db=require(_0xd6db('0x5'))['db'];var utils=require(_0xd6db('0x6'));var logger=require(_0xd6db('0x7'))(_0xd6db('0x8'));var config=require(_0xd6db('0x9'));var jayson=require(_0xd6db('0xa'));var client=jayson[_0xd6db('0xb')][_0xd6db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b3aec,_0x3221af,_0x4eb265){return new BPromise(function(_0x25b804,_0x22a9d1){return client[_0xd6db('0xd')](_0x5b3aec,_0x4eb265)[_0xd6db('0xe')](function(_0x34579c){logger[_0xd6db('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x3221af,_0xd6db('0x10'));logger[_0xd6db('0x11')](_0xd6db('0x12'),_0x3221af,_0xd6db('0x10'),JSON[_0xd6db('0x13')](_0x34579c));if(_0x34579c[_0xd6db('0x14')]){if(_0x34579c[_0xd6db('0x14')]['code']===0x1f4){logger[_0xd6db('0x14')](_0xd6db('0x15'),_0x3221af,_0x34579c['error'][_0xd6db('0x16')]);return _0x22a9d1(_0x34579c[_0xd6db('0x14')][_0xd6db('0x16')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x3221af,_0x34579c[_0xd6db('0x14')][_0xd6db('0x16')]);return _0x25b804(_0x34579c['error']['message']);}else{logger[_0xd6db('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x3221af,_0xd6db('0x10'));_0x25b804(_0x34579c[_0xd6db('0x17')]['message']);}})[_0xd6db('0x18')](function(_0x557965){logger[_0xd6db('0x14')](_0xd6db('0x15'),_0x3221af,_0x557965);_0x22a9d1(_0x557965);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index be29d91..a186403 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 _0x712b=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','path'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x712b,0x116));var _0xb712=function(_0x79a6af,_0x38907f){_0x79a6af=_0x79a6af-0x0;var _0x5511e0=_0x712b[_0x79a6af];return _0x5511e0;};'use strict';var multer=require(_0xb712('0x0'));var util=require('util');var path=require(_0xb712('0x1'));var timeout=require(_0xb712('0x2'));var express=require(_0xb712('0x3'));var router=express[_0xb712('0x4')]();var fs_extra=require(_0xb712('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb712('0x6'));var config=require(_0xb712('0x7'));var controller=require('./mailTransferReport.controller');router[_0xb712('0x8')]('/',auth[_0xb712('0x9')](),controller[_0xb712('0xa')]);router[_0xb712('0x8')](_0xb712('0xb'),auth[_0xb712('0x9')](),controller[_0xb712('0xc')]);router['get'](_0xb712('0xd'),auth[_0xb712('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb712('0xe')]);router[_0xb712('0xf')](_0xb712('0xd'),auth[_0xb712('0x9')](),controller[_0xb712('0x10')]);router[_0xb712('0x11')]('/:id',auth[_0xb712('0x9')](),controller[_0xb712('0x12')]);module[_0xb712('0x13')]=router; \ No newline at end of file +var _0xa078=['create','put','update','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','/describe','get','/:id','show','post'];(function(_0x8779f0,_0x2e7493){var _0x20a6c0=function(_0x4c54a9){while(--_0x4c54a9){_0x8779f0['push'](_0x8779f0['shift']());}};_0x20a6c0(++_0x2e7493);}(_0xa078,0x144));var _0x8a07=function(_0x36b8cb,_0x57e2e1){_0x36b8cb=_0x36b8cb-0x0;var _0x11fdc5=_0xa078[_0x36b8cb];return _0x11fdc5;};'use strict';var multer=require(_0x8a07('0x0'));var util=require('util');var path=require(_0x8a07('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a07('0x2'));var router=express[_0x8a07('0x3')]();var fs_extra=require(_0x8a07('0x4'));var auth=require(_0x8a07('0x5'));var interaction=require(_0x8a07('0x6'));var config=require(_0x8a07('0x7'));var controller=require(_0x8a07('0x8'));router['get']('/',auth[_0x8a07('0x9')](),controller[_0x8a07('0xa')]);router['get'](_0x8a07('0xb'),auth[_0x8a07('0x9')](),controller['describe']);router[_0x8a07('0xc')](_0x8a07('0xd'),auth[_0x8a07('0x9')](),controller[_0x8a07('0xe')]);router[_0x8a07('0xf')]('/',auth[_0x8a07('0x9')](),controller[_0x8a07('0x10')]);router[_0x8a07('0x11')]('/:id',auth[_0x8a07('0x9')](),controller[_0x8a07('0x12')]);router['delete']('/:id',auth[_0x8a07('0x9')](),controller[_0x8a07('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index dc719ee..b146047 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(_0x4d9d1e,_0x3c2d20){var _0x1b9d54=function(_0x373c21){while(--_0x373c21){_0x4d9d1e['push'](_0x4d9d1e['shift']());}};_0x1b9d54(++_0x3c2d20);}(_0x34e8,0x12c));var _0x834e=function(_0x2cff0,_0x578279){_0x2cff0=_0x2cff0-0x0;var _0x541733=_0x34e8[_0x2cff0];return _0x541733;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0x34e8,0x12c));var _0x834e=function(_0x2de54f,_0x2a9933){_0x2de54f=_0x2de54f-0x0;var _0x2078f2=_0x34e8[_0x2de54f];return _0x2078f2;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index c729604..201b8fd 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 _0xaa8d=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','MailTransferReport','rawAttributes'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xaa8d,0x190));var _0xdaa8=function(_0x45ec02,_0x4dc118){_0x45ec02=_0x45ec02-0x0;var _0x5c5503=_0xaa8d[_0x45ec02];return _0x5c5503;};'use strict';var emlformat=require(_0xdaa8('0x0'));var rimraf=require(_0xdaa8('0x1'));var zipdir=require(_0xdaa8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdaa8('0x3'));var moment=require(_0xdaa8('0x4'));var BPromise=require(_0xdaa8('0x5'));var Mustache=require(_0xdaa8('0x6'));var util=require(_0xdaa8('0x7'));var path=require(_0xdaa8('0x8'));var sox=require(_0xdaa8('0x9'));var csv=require(_0xdaa8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaa8('0xb'));var squel=require(_0xdaa8('0xc'));var crypto=require(_0xdaa8('0xd'));var jsforce=require(_0xdaa8('0xe'));var deskjs=require(_0xdaa8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdaa8('0x10'));var Papa=require('papaparse');var Redis=require(_0xdaa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdaa8('0x12'));var as=require(_0xdaa8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdaa8('0x14'));var config=require(_0xdaa8('0x15'));var licenseUtil=require(_0xdaa8('0x16'));var db=require(_0xdaa8('0x17'))['db'];function respondWithStatusCode(_0x359cae,_0x4224e2){_0x4224e2=_0x4224e2||0xcc;return function(_0x1deb5c){if(_0x1deb5c){return _0x359cae['sendStatus'](_0x4224e2);}return _0x359cae['status'](_0x4224e2)[_0xdaa8('0x18')]();};}function respondWithResult(_0x407db0,_0x42384e){_0x42384e=_0x42384e||0xc8;return function(_0x22753e){if(_0x22753e){return _0x407db0[_0xdaa8('0x19')](_0x42384e)[_0xdaa8('0x1a')](_0x22753e);}};}function respondWithFilteredResult(_0x272c94,_0x3b3a72){return function(_0x3dd279){if(_0x3dd279){var _0x333ade=typeof _0x3b3a72['offset']===_0xdaa8('0x1b')&&typeof _0x3b3a72['limit']===_0xdaa8('0x1b');var _0x2ab224=_0x3dd279[_0xdaa8('0x1c')];var _0x3fcfa2=_0x333ade?0x0:_0x3b3a72[_0xdaa8('0x1d')];var _0x4b0d87=_0x333ade?_0x3dd279[_0xdaa8('0x1c')]:_0x3b3a72[_0xdaa8('0x1d')]+_0x3b3a72['limit'];var _0x42a02e;if(_0x4b0d87>=_0x2ab224){_0x4b0d87=_0x2ab224;_0x42a02e=0xc8;}else{_0x42a02e=0xce;}_0x272c94[_0xdaa8('0x19')](_0x42a02e);return _0x272c94['set'](_0xdaa8('0x1e'),_0x3fcfa2+'-'+_0x4b0d87+'/'+_0x2ab224)[_0xdaa8('0x1a')](_0x3dd279);}return null;};}function patchUpdates(_0xe7c324){return function(_0xfd3d32){try{jsonpatch[_0xdaa8('0x1f')](_0xfd3d32,_0xe7c324,!![]);}catch(_0x29a757){return BPromise[_0xdaa8('0x20')](_0x29a757);}return _0xfd3d32[_0xdaa8('0x21')]();};}function saveUpdates(_0x58716d,_0x4ea181){return function(_0x2554ac){if(_0x2554ac){return _0x2554ac[_0xdaa8('0x22')](_0x58716d)[_0xdaa8('0x23')](function(_0x455902){return _0x455902;});}return null;};}function removeEntity(_0x2bd8f0,_0x5c31b2){return function(_0xf2cb4e){if(_0xf2cb4e){return _0xf2cb4e[_0xdaa8('0x24')]()[_0xdaa8('0x23')](function(){_0x2bd8f0[_0xdaa8('0x19')](0xcc)[_0xdaa8('0x18')]();});}};}function handleEntityNotFound(_0x9171fb,_0x4303a0){return function(_0x377cbf){if(!_0x377cbf){_0x9171fb[_0xdaa8('0x25')](0x194);}return _0x377cbf;};}function handleError(_0x301813,_0x58c38e){_0x58c38e=_0x58c38e||0x1f4;return function(_0x55b4f8){logger['error'](_0x55b4f8[_0xdaa8('0x26')]);if(_0x55b4f8['name']){delete _0x55b4f8[_0xdaa8('0x27')];}_0x301813[_0xdaa8('0x19')](_0x58c38e)['send'](_0x55b4f8);};}exports[_0xdaa8('0x28')]=function(_0x3c756e,_0x44a999){var _0xcc17b0={},_0x3511ae={},_0x4eb586={'count':0x0,'rows':[]};var _0x2906e9=_[_0xdaa8('0x29')](db[_0xdaa8('0x2a')][_0xdaa8('0x2b')],function(_0x4d6c2d){return{'name':_0x4d6c2d['fieldName'],'type':_0x4d6c2d[_0xdaa8('0x2c')][_0xdaa8('0x2d')]};});_0x3511ae[_0xdaa8('0x2e')]=_[_0xdaa8('0x29')](_0x2906e9,_0xdaa8('0x27'));_0x3511ae[_0xdaa8('0x2f')]=_[_0xdaa8('0x30')](_0x3c756e[_0xdaa8('0x2f')]);_0x3511ae[_0xdaa8('0x31')]=_[_0xdaa8('0x32')](_0x3511ae[_0xdaa8('0x2e')],_0x3511ae[_0xdaa8('0x2f')]);_0xcc17b0[_0xdaa8('0x33')]=_[_0xdaa8('0x32')](_0x3511ae['model'],qs[_0xdaa8('0x34')](_0x3c756e['query']['fields']));_0xcc17b0[_0xdaa8('0x33')]=_0xcc17b0[_0xdaa8('0x33')]['length']?_0xcc17b0['attributes']:_0x3511ae[_0xdaa8('0x2e')];if(!_0x3c756e[_0xdaa8('0x2f')][_0xdaa8('0x35')]('nolimit')){_0xcc17b0['limit']=qs[_0xdaa8('0x36')](_0x3c756e[_0xdaa8('0x2f')][_0xdaa8('0x36')]);_0xcc17b0[_0xdaa8('0x1d')]=qs[_0xdaa8('0x1d')](_0x3c756e[_0xdaa8('0x2f')][_0xdaa8('0x1d')]);}_0xcc17b0['order']=qs[_0xdaa8('0x37')](_0x3c756e[_0xdaa8('0x2f')]['sort']);_0xcc17b0[_0xdaa8('0x38')]=qs[_0xdaa8('0x31')](_[_0xdaa8('0x39')](_0x3c756e['query'],_0x3511ae[_0xdaa8('0x31')]),_0x2906e9);if(_0x3c756e[_0xdaa8('0x2f')][_0xdaa8('0x3a')]){_0xcc17b0['where']=_['merge'](_0xcc17b0[_0xdaa8('0x38')],{'$or':_[_0xdaa8('0x29')](_0x2906e9,function(_0x2fd7c5){if(_0x2fd7c5[_0xdaa8('0x2c')]!==_0xdaa8('0x3b')){var _0x38c88a={};_0x38c88a[_0x2fd7c5[_0xdaa8('0x27')]]={'$like':'%'+_0x3c756e[_0xdaa8('0x2f')][_0xdaa8('0x3a')]+'%'};return _0x38c88a;}})});}_0xcc17b0=_[_0xdaa8('0x3c')]({},_0xcc17b0,_0x3c756e[_0xdaa8('0x3d')]);var _0x36b71e={'where':_0xcc17b0[_0xdaa8('0x38')]};return db[_0xdaa8('0x2a')][_0xdaa8('0x1c')](_0x36b71e)[_0xdaa8('0x23')](function(_0x102ba6){_0x4eb586[_0xdaa8('0x1c')]=_0x102ba6;if(_0x3c756e[_0xdaa8('0x2f')][_0xdaa8('0x3e')]){_0xcc17b0[_0xdaa8('0x3f')]=[{'all':!![]}];}return db[_0xdaa8('0x2a')][_0xdaa8('0x40')](_0xcc17b0);})[_0xdaa8('0x23')](function(_0x3199a9){_0x4eb586[_0xdaa8('0x41')]=_0x3199a9;return _0x4eb586;})['then'](respondWithFilteredResult(_0x44a999,_0xcc17b0))[_0xdaa8('0x42')](handleError(_0x44a999,null));};exports[_0xdaa8('0x43')]=function(_0x4fcaac,_0x297d31){var _0x5e35fe={'raw':!![],'where':{'id':_0x4fcaac[_0xdaa8('0x44')]['id']}},_0x54ca88={};_0x54ca88[_0xdaa8('0x2e')]=_[_0xdaa8('0x30')](db[_0xdaa8('0x2a')]['rawAttributes']);_0x54ca88[_0xdaa8('0x2f')]=_['keys'](_0x4fcaac[_0xdaa8('0x2f')]);_0x54ca88['filters']=_['intersection'](_0x54ca88['model'],_0x54ca88[_0xdaa8('0x2f')]);_0x5e35fe[_0xdaa8('0x33')]=_[_0xdaa8('0x32')](_0x54ca88[_0xdaa8('0x2e')],qs[_0xdaa8('0x34')](_0x4fcaac[_0xdaa8('0x2f')]['fields']));_0x5e35fe[_0xdaa8('0x33')]=_0x5e35fe[_0xdaa8('0x33')][_0xdaa8('0x45')]?_0x5e35fe['attributes']:_0x54ca88[_0xdaa8('0x2e')];if(_0x4fcaac[_0xdaa8('0x2f')][_0xdaa8('0x3e')]){_0x5e35fe[_0xdaa8('0x3f')]=[{'all':!![]}];}_0x5e35fe=_[_0xdaa8('0x3c')]({},_0x5e35fe,_0x4fcaac[_0xdaa8('0x3d')]);return db[_0xdaa8('0x2a')][_0xdaa8('0x46')](_0x5e35fe)[_0xdaa8('0x23')](handleEntityNotFound(_0x297d31,null))['then'](respondWithResult(_0x297d31,null))[_0xdaa8('0x42')](handleError(_0x297d31,null));};exports[_0xdaa8('0x47')]=function(_0x15c080,_0x57fc81){return db[_0xdaa8('0x2a')][_0xdaa8('0x47')](_0x15c080[_0xdaa8('0x48')],{})[_0xdaa8('0x23')](respondWithResult(_0x57fc81,0xc9))[_0xdaa8('0x42')](handleError(_0x57fc81,null));};exports['update']=function(_0x45ac3c,_0x365734){if(_0x45ac3c[_0xdaa8('0x48')]['id']){delete _0x45ac3c[_0xdaa8('0x48')]['id'];}return db[_0xdaa8('0x2a')][_0xdaa8('0x46')]({'where':{'id':_0x45ac3c[_0xdaa8('0x44')]['id']}})['then'](handleEntityNotFound(_0x365734,null))[_0xdaa8('0x23')](saveUpdates(_0x45ac3c[_0xdaa8('0x48')],null))[_0xdaa8('0x23')](respondWithResult(_0x365734,null))['catch'](handleError(_0x365734,null));};exports['destroy']=function(_0x3882c3,_0x1f5d91){return db[_0xdaa8('0x2a')][_0xdaa8('0x46')]({'where':{'id':_0x3882c3['params']['id']}})[_0xdaa8('0x23')](handleEntityNotFound(_0x1f5d91,null))[_0xdaa8('0x23')](removeEntity(_0x1f5d91,null))[_0xdaa8('0x42')](handleError(_0x1f5d91,null));};exports[_0xdaa8('0x49')]=function(_0x3b1c82,_0x15f32b){return db['MailTransferReport'][_0xdaa8('0x49')]()['then'](respondWithResult(_0x15f32b,null))[_0xdaa8('0x42')](handleError(_0x15f32b,null));}; \ No newline at end of file +var _0x90df=['fields','find','catch','create','body','update','describe','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params'];(function(_0x239b87,_0x9b5b5e){var _0x5aa839=function(_0x3f5b62){while(--_0x3f5b62){_0x239b87['push'](_0x239b87['shift']());}};_0x5aa839(++_0x9b5b5e);}(_0x90df,0xe8));var _0xf90d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90df[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf90d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf90d('0x1'));var moment=require(_0xf90d('0x2'));var BPromise=require(_0xf90d('0x3'));var Mustache=require(_0xf90d('0x4'));var util=require(_0xf90d('0x5'));var path=require('path');var sox=require(_0xf90d('0x6'));var csv=require(_0xf90d('0x7'));var ejs=require(_0xf90d('0x8'));var fs=require('fs');var fs_extra=require(_0xf90d('0x9'));var _=require(_0xf90d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf90d('0xb'));var toCsv=require(_0xf90d('0x7'));var querystring=require(_0xf90d('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf90d('0xd'));var qs=require(_0xf90d('0xe'));var as=require(_0xf90d('0xf'));var hardwareService=require(_0xf90d('0x10'));var logger=require(_0xf90d('0x11'))(_0xf90d('0x12'));var utils=require(_0xf90d('0x13'));var config=require(_0xf90d('0x14'));var licenseUtil=require(_0xf90d('0x15'));var db=require(_0xf90d('0x16'))['db'];function respondWithStatusCode(_0x12f015,_0x3f526f){_0x3f526f=_0x3f526f||0xcc;return function(_0xba74ae){if(_0xba74ae){return _0x12f015[_0xf90d('0x17')](_0x3f526f);}return _0x12f015[_0xf90d('0x18')](_0x3f526f)[_0xf90d('0x19')]();};}function respondWithResult(_0x29477f,_0x4206bc){_0x4206bc=_0x4206bc||0xc8;return function(_0x3d63dc){if(_0x3d63dc){return _0x29477f[_0xf90d('0x18')](_0x4206bc)[_0xf90d('0x1a')](_0x3d63dc);}};}function respondWithFilteredResult(_0x18511e,_0x24932a){return function(_0x3e8c17){if(_0x3e8c17){var _0x3901f2=typeof _0x24932a[_0xf90d('0x1b')]===_0xf90d('0x1c')&&typeof _0x24932a[_0xf90d('0x1d')]===_0xf90d('0x1c');var _0x1c5f15=_0x3e8c17[_0xf90d('0x1e')];var _0x4473b1=_0x3901f2?0x0:_0x24932a[_0xf90d('0x1b')];var _0x17a8fd=_0x3901f2?_0x3e8c17[_0xf90d('0x1e')]:_0x24932a[_0xf90d('0x1b')]+_0x24932a[_0xf90d('0x1d')];var _0x14ad41;if(_0x17a8fd>=_0x1c5f15){_0x17a8fd=_0x1c5f15;_0x14ad41=0xc8;}else{_0x14ad41=0xce;}_0x18511e['status'](_0x14ad41);return _0x18511e['set'](_0xf90d('0x1f'),_0x4473b1+'-'+_0x17a8fd+'/'+_0x1c5f15)[_0xf90d('0x1a')](_0x3e8c17);}return null;};}function patchUpdates(_0x2c6a5a){return function(_0x5d9be1){try{jsonpatch[_0xf90d('0x20')](_0x5d9be1,_0x2c6a5a,!![]);}catch(_0x1d42d9){return BPromise[_0xf90d('0x21')](_0x1d42d9);}return _0x5d9be1[_0xf90d('0x22')]();};}function saveUpdates(_0x150cc0,_0x40c6f5){return function(_0x598afc){if(_0x598afc){return _0x598afc['update'](_0x150cc0)[_0xf90d('0x23')](function(_0x376be3){return _0x376be3;});}return null;};}function removeEntity(_0x2226d1,_0x4eedbe){return function(_0x31cba2){if(_0x31cba2){return _0x31cba2[_0xf90d('0x24')]()[_0xf90d('0x23')](function(){_0x2226d1[_0xf90d('0x18')](0xcc)[_0xf90d('0x19')]();});}};}function handleEntityNotFound(_0x412d23,_0x10e57e){return function(_0x57bcee){if(!_0x57bcee){_0x412d23['sendStatus'](0x194);}return _0x57bcee;};}function handleError(_0x471aae,_0x59f39e){_0x59f39e=_0x59f39e||0x1f4;return function(_0x325878){logger[_0xf90d('0x25')](_0x325878[_0xf90d('0x26')]);if(_0x325878[_0xf90d('0x27')]){delete _0x325878[_0xf90d('0x27')];}_0x471aae[_0xf90d('0x18')](_0x59f39e)[_0xf90d('0x28')](_0x325878);};}exports[_0xf90d('0x29')]=function(_0x33821b,_0x5044aa){var _0x29d361={},_0x4868d2={},_0x3194e8={'count':0x0,'rows':[]};var _0x3e6e6d=_[_0xf90d('0x2a')](db[_0xf90d('0x2b')][_0xf90d('0x2c')],function(_0x544cda){return{'name':_0x544cda['fieldName'],'type':_0x544cda[_0xf90d('0x2d')]['key']};});_0x4868d2[_0xf90d('0x2e')]=_[_0xf90d('0x2a')](_0x3e6e6d,_0xf90d('0x27'));_0x4868d2['query']=_[_0xf90d('0x2f')](_0x33821b[_0xf90d('0x30')]);_0x4868d2[_0xf90d('0x31')]=_[_0xf90d('0x32')](_0x4868d2[_0xf90d('0x2e')],_0x4868d2[_0xf90d('0x30')]);_0x29d361['attributes']=_[_0xf90d('0x32')](_0x4868d2[_0xf90d('0x2e')],qs['fields'](_0x33821b['query']['fields']));_0x29d361[_0xf90d('0x33')]=_0x29d361['attributes'][_0xf90d('0x34')]?_0x29d361[_0xf90d('0x33')]:_0x4868d2['model'];if(!_0x33821b[_0xf90d('0x30')][_0xf90d('0x35')](_0xf90d('0x36'))){_0x29d361[_0xf90d('0x1d')]=qs[_0xf90d('0x1d')](_0x33821b[_0xf90d('0x30')][_0xf90d('0x1d')]);_0x29d361[_0xf90d('0x1b')]=qs[_0xf90d('0x1b')](_0x33821b[_0xf90d('0x30')][_0xf90d('0x1b')]);}_0x29d361[_0xf90d('0x37')]=qs[_0xf90d('0x38')](_0x33821b[_0xf90d('0x30')][_0xf90d('0x38')]);_0x29d361[_0xf90d('0x39')]=qs['filters'](_[_0xf90d('0x3a')](_0x33821b[_0xf90d('0x30')],_0x4868d2['filters']),_0x3e6e6d);if(_0x33821b[_0xf90d('0x30')]['filter']){_0x29d361[_0xf90d('0x39')]=_[_0xf90d('0x3b')](_0x29d361[_0xf90d('0x39')],{'$or':_['map'](_0x3e6e6d,function(_0x49799b){if(_0x49799b[_0xf90d('0x2d')]!==_0xf90d('0x3c')){var _0x5dcf87={};_0x5dcf87[_0x49799b[_0xf90d('0x27')]]={'$like':'%'+_0x33821b[_0xf90d('0x30')][_0xf90d('0x3d')]+'%'};return _0x5dcf87;}})});}_0x29d361=_['merge']({},_0x29d361,_0x33821b[_0xf90d('0x3e')]);var _0x533b04={'where':_0x29d361['where']};return db[_0xf90d('0x2b')][_0xf90d('0x1e')](_0x533b04)['then'](function(_0x24f79b){_0x3194e8['count']=_0x24f79b;if(_0x33821b['query'][_0xf90d('0x3f')]){_0x29d361[_0xf90d('0x40')]=[{'all':!![]}];}return db['MailTransferReport'][_0xf90d('0x41')](_0x29d361);})['then'](function(_0x27e2ed){_0x3194e8['rows']=_0x27e2ed;return _0x3194e8;})[_0xf90d('0x23')](respondWithFilteredResult(_0x5044aa,_0x29d361))['catch'](handleError(_0x5044aa,null));};exports[_0xf90d('0x42')]=function(_0x10794b,_0x13a35c){var _0x5e44ee={'raw':!![],'where':{'id':_0x10794b[_0xf90d('0x43')]['id']}},_0x2b626b={};_0x2b626b['model']=_[_0xf90d('0x2f')](db[_0xf90d('0x2b')]['rawAttributes']);_0x2b626b[_0xf90d('0x30')]=_[_0xf90d('0x2f')](_0x10794b[_0xf90d('0x30')]);_0x2b626b[_0xf90d('0x31')]=_[_0xf90d('0x32')](_0x2b626b[_0xf90d('0x2e')],_0x2b626b[_0xf90d('0x30')]);_0x5e44ee[_0xf90d('0x33')]=_['intersection'](_0x2b626b[_0xf90d('0x2e')],qs[_0xf90d('0x44')](_0x10794b['query'][_0xf90d('0x44')]));_0x5e44ee[_0xf90d('0x33')]=_0x5e44ee['attributes']['length']?_0x5e44ee['attributes']:_0x2b626b[_0xf90d('0x2e')];if(_0x10794b[_0xf90d('0x30')][_0xf90d('0x3f')]){_0x5e44ee['include']=[{'all':!![]}];}_0x5e44ee=_[_0xf90d('0x3b')]({},_0x5e44ee,_0x10794b[_0xf90d('0x3e')]);return db[_0xf90d('0x2b')][_0xf90d('0x45')](_0x5e44ee)[_0xf90d('0x23')](handleEntityNotFound(_0x13a35c,null))[_0xf90d('0x23')](respondWithResult(_0x13a35c,null))[_0xf90d('0x46')](handleError(_0x13a35c,null));};exports[_0xf90d('0x47')]=function(_0x4e2ac4,_0xf6dc88){return db[_0xf90d('0x2b')]['create'](_0x4e2ac4[_0xf90d('0x48')],{})['then'](respondWithResult(_0xf6dc88,0xc9))[_0xf90d('0x46')](handleError(_0xf6dc88,null));};exports[_0xf90d('0x49')]=function(_0x4e78f0,_0x50360f){if(_0x4e78f0[_0xf90d('0x48')]['id']){delete _0x4e78f0[_0xf90d('0x48')]['id'];}return db[_0xf90d('0x2b')][_0xf90d('0x45')]({'where':{'id':_0x4e78f0[_0xf90d('0x43')]['id']}})[_0xf90d('0x23')](handleEntityNotFound(_0x50360f,null))[_0xf90d('0x23')](saveUpdates(_0x4e78f0[_0xf90d('0x48')],null))[_0xf90d('0x23')](respondWithResult(_0x50360f,null))['catch'](handleError(_0x50360f,null));};exports[_0xf90d('0x24')]=function(_0x264959,_0x1c6fe6){return db['MailTransferReport'][_0xf90d('0x45')]({'where':{'id':_0x264959[_0xf90d('0x43')]['id']}})[_0xf90d('0x23')](handleEntityNotFound(_0x1c6fe6,null))[_0xf90d('0x23')](removeEntity(_0x1c6fe6,null))[_0xf90d('0x46')](handleError(_0x1c6fe6,null));};exports[_0xf90d('0x4a')]=function(_0x50dc8d,_0x3a4547){return db['MailTransferReport']['describe']()[_0xf90d('0x23')](respondWithResult(_0x3a4547,null))[_0xf90d('0x46')](handleError(_0x3a4547,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8e080c0..5b65fed 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 _0x1e92=['bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger'];(function(_0x100fb6,_0x447620){var _0x78101=function(_0x4caa04){while(--_0x4caa04){_0x100fb6['push'](_0x100fb6['shift']());}};_0x78101(++_0x447620);}(_0x1e92,0x1df));var _0x21e9=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x1e92[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0x21e9('0x0'));var util=require('util');var logger=require(_0x21e9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x21e9('0x2'));var rp=require(_0x21e9('0x3'));var fs=require('fs');var path=require(_0x21e9('0x4'));var rimraf=require(_0x21e9('0x5'));var config=require(_0x21e9('0x6'));var attributes=require(_0x21e9('0x7'));module[_0x21e9('0x8')]=function(_0x3212cb,_0x54b40a){return _0x3212cb[_0x21e9('0x9')](_0x21e9('0xa'),attributes,{'tableName':_0x21e9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x21e9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x135c=['report_mail_transfer','uniqueid','lodash','util','api','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport'];(function(_0x44bee5,_0x5d56ab){var _0x7a394f=function(_0x2d3ce8){while(--_0x2d3ce8){_0x44bee5['push'](_0x44bee5['shift']());}};_0x7a394f(++_0x5d56ab);}(_0x135c,0xda));var _0xc135=function(_0x1a5b8d,_0xdbba4a){_0x1a5b8d=_0x1a5b8d-0x0;var _0x3f0d28=_0x135c[_0x1a5b8d];return _0x3f0d28;};'use strict';var _=require(_0xc135('0x0'));var util=require(_0xc135('0x1'));var logger=require('../../config/logger')(_0xc135('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc135('0x3'));var fs=require('fs');var path=require(_0xc135('0x4'));var rimraf=require(_0xc135('0x5'));var config=require('../../config/environment');var attributes=require(_0xc135('0x6'));module[_0xc135('0x7')]=function(_0x14317c,_0x42cf72){return _0x14317c[_0xc135('0x8')](_0xc135('0x9'),attributes,{'tableName':_0xc135('0xa'),'paranoid':![],'indexes':[{'name':_0xc135('0xb'),'fields':[_0xc135('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e20e647..bdb0ca1 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 _0xa116=['http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0xa116,0x12b));var _0x6a11=function(_0x2fbb8a,_0x2689b6){_0x2fbb8a=_0x2fbb8a-0x0;var _0x319ff4=_0xa116[_0x2fbb8a];return _0x319ff4;};'use strict';var _=require(_0x6a11('0x0'));var util=require(_0x6a11('0x1'));var moment=require(_0x6a11('0x2'));var BPromise=require(_0x6a11('0x3'));var rs=require(_0x6a11('0x4'));var fs=require('fs');var Redis=require(_0x6a11('0x5'));var db=require(_0x6a11('0x6'))['db'];var utils=require(_0x6a11('0x7'));var logger=require(_0x6a11('0x8'))(_0x6a11('0x9'));var config=require(_0x6a11('0xa'));var jayson=require(_0x6a11('0xb'));var client=jayson[_0x6a11('0xc')][_0x6a11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5ba639,_0x4371e0,_0x2d9597){return new BPromise(function(_0x7abe16,_0x359030){return client[_0x6a11('0xe')](_0x5ba639,_0x2d9597)[_0x6a11('0xf')](function(_0x31c9f6){logger['info'](_0x6a11('0x10'),_0x4371e0,_0x6a11('0x11'));logger[_0x6a11('0x12')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4371e0,_0x6a11('0x11'),JSON[_0x6a11('0x13')](_0x31c9f6));if(_0x31c9f6[_0x6a11('0x14')]){if(_0x31c9f6[_0x6a11('0x14')][_0x6a11('0x15')]===0x1f4){logger[_0x6a11('0x14')](_0x6a11('0x10'),_0x4371e0,_0x31c9f6[_0x6a11('0x14')][_0x6a11('0x16')]);return _0x359030(_0x31c9f6[_0x6a11('0x14')][_0x6a11('0x16')]);}logger[_0x6a11('0x14')](_0x6a11('0x10'),_0x4371e0,_0x31c9f6['error'][_0x6a11('0x16')]);return _0x7abe16(_0x31c9f6[_0x6a11('0x14')]['message']);}else{logger[_0x6a11('0x17')]('MailTransferReport,\x20%s,\x20%s',_0x4371e0,_0x6a11('0x11'));_0x7abe16(_0x31c9f6[_0x6a11('0x18')][_0x6a11('0x16')]);}})[_0x6a11('0x19')](function(_0x4ef093){logger['error'](_0x6a11('0x10'),_0x4371e0,_0x4ef093);_0x359030(_0x4ef093);});});} \ No newline at end of file +var _0x8b64=['jayson/promise','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x10f28c,_0x2b0b35){var _0xb45c83=function(_0x2ebea5){while(--_0x2ebea5){_0x10f28c['push'](_0x10f28c['shift']());}};_0xb45c83(++_0x2b0b35);}(_0x8b64,0x76));var _0x48b6=function(_0x5eefa0,_0x4af576){_0x5eefa0=_0x5eefa0-0x0;var _0x436aa2=_0x8b64[_0x5eefa0];return _0x436aa2;};'use strict';var _=require(_0x48b6('0x0'));var util=require('util');var moment=require(_0x48b6('0x1'));var BPromise=require(_0x48b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48b6('0x3'));var db=require(_0x48b6('0x4'))['db'];var utils=require(_0x48b6('0x5'));var logger=require(_0x48b6('0x6'))(_0x48b6('0x7'));var config=require('../../config/environment');var jayson=require(_0x48b6('0x8'));var client=jayson['client'][_0x48b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4541cf,_0x27332b,_0x9dd004){return new BPromise(function(_0x13e445,_0xe64b35){return client['request'](_0x4541cf,_0x9dd004)[_0x48b6('0xa')](function(_0x2e8856){logger[_0x48b6('0xb')](_0x48b6('0xc'),_0x27332b,_0x48b6('0xd'));logger[_0x48b6('0xe')](_0x48b6('0xf'),_0x27332b,_0x48b6('0xd'),JSON[_0x48b6('0x10')](_0x2e8856));if(_0x2e8856[_0x48b6('0x11')]){if(_0x2e8856['error']['code']===0x1f4){logger[_0x48b6('0x11')](_0x48b6('0xc'),_0x27332b,_0x2e8856[_0x48b6('0x11')][_0x48b6('0x12')]);return _0xe64b35(_0x2e8856['error'][_0x48b6('0x12')]);}logger['error'](_0x48b6('0xc'),_0x27332b,_0x2e8856['error'][_0x48b6('0x12')]);return _0x13e445(_0x2e8856['error'][_0x48b6('0x12')]);}else{logger[_0x48b6('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x27332b,_0x48b6('0xd'));_0x13e445(_0x2e8856[_0x48b6('0x13')][_0x48b6('0x12')]);}})[_0x48b6('0x14')](function(_0x34a61d){logger[_0x48b6('0x11')](_0x48b6('0xc'),_0x27332b,_0x34a61d);_0xe64b35(_0x34a61d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index dc0c719..c31433a 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 _0xad75=['connect-timeout','express','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0xad75,0x1a9));var _0x5ad7=function(_0x4128ce,_0x17ce36){_0x4128ce=_0x4128ce-0x0;var _0x1d3c9c=_0xad75[_0x4128ce];return _0x1d3c9c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5ad7('0x0'));var express=require(_0x5ad7('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5ad7('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5ad7('0x3'));router[_0x5ad7('0x4')]('/',auth[_0x5ad7('0x5')](),controller[_0x5ad7('0x6')]);router[_0x5ad7('0x4')](_0x5ad7('0x7'),auth[_0x5ad7('0x5')](),controller[_0x5ad7('0x8')]);router['get'](_0x5ad7('0x9'),auth['isAuthenticated'](),controller[_0x5ad7('0xa')]);router['post']('/',auth[_0x5ad7('0x5')](),controller[_0x5ad7('0xb')]);router[_0x5ad7('0xc')]('/:id',auth[_0x5ad7('0x5')](),controller[_0x5ad7('0xd')]);router[_0x5ad7('0xe')]('/:id',auth[_0x5ad7('0x5')](),controller[_0x5ad7('0xf')]);module[_0x5ad7('0x10')]=router; \ No newline at end of file +var _0xa486=['../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','show','put','update','destroy','exports','multer','connect-timeout','Router','fs-extra'];(function(_0x3d6ef1,_0x384ad8){var _0x50c788=function(_0xa1c0e9){while(--_0xa1c0e9){_0x3d6ef1['push'](_0x3d6ef1['shift']());}};_0x50c788(++_0x384ad8);}(_0xa486,0xd9));var _0x6a48=function(_0x16a4a5,_0x479ddf){_0x16a4a5=_0x16a4a5-0x0;var _0x29219f=_0xa486[_0x16a4a5];return _0x29219f;};'use strict';var multer=require(_0x6a48('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a48('0x1'));var express=require('express');var router=express[_0x6a48('0x2')]();var fs_extra=require(_0x6a48('0x3'));var auth=require(_0x6a48('0x4'));var interaction=require(_0x6a48('0x5'));var config=require(_0x6a48('0x6'));var controller=require(_0x6a48('0x7'));router[_0x6a48('0x8')]('/',auth['isAuthenticated'](),controller[_0x6a48('0x9')]);router[_0x6a48('0x8')](_0x6a48('0xa'),auth[_0x6a48('0xb')](),controller['describe']);router[_0x6a48('0x8')]('/:id',auth[_0x6a48('0xb')](),controller[_0x6a48('0xc')]);router['post']('/',auth[_0x6a48('0xb')](),controller['create']);router[_0x6a48('0xd')]('/:id',auth[_0x6a48('0xb')](),controller[_0x6a48('0xe')]);router['delete']('/:id',auth[_0x6a48('0xb')](),controller[_0x6a48('0xf')]);module[_0x6a48('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ff7fc2b..206a704 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 _0x66b5=['DEFAULT\x20PAUSE','INTEGER','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING'];(function(_0x3fd441,_0x577687){var _0x391f68=function(_0x3f0f28){while(--_0x3f0f28){_0x3fd441['push'](_0x3fd441['shift']());}};_0x391f68(++_0x577687);}(_0x66b5,0xcf));var _0x566b=function(_0x1cb887,_0x3b9569){_0x1cb887=_0x1cb887-0x0;var _0x50a440=_0x66b5[_0x1cb887];return _0x50a440;};'use strict';var Sequelize=require(_0x566b('0x0'));var moment=require('moment');module[_0x566b('0x1')]={'channel':{'type':Sequelize[_0x566b('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x566b('0x2')]},'type':{'type':Sequelize[_0x566b('0x2')],'defaultValue':_0x566b('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x566b('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0xfa9ab9){var _0x12a2b3=moment(_0xfa9ab9);var _0x1b3384=moment(this[_0x566b('0x5')]('enterAt'));var _0x2c412c=_0x12a2b3[_0x566b('0x6')](_0x1b3384,_0x566b('0x7'));this[_0x566b('0x8')](_0x566b('0x9'),_0xfa9ab9);this[_0x566b('0x8')](_0x566b('0xa'),_0x2c412c>=0x0?_0x2c412c:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x566b('0x2')],'comment':_0x566b('0xb')},'data4':{'type':Sequelize[_0x566b('0x2')],'comment':_0x566b('0xc')},'data5':{'type':Sequelize[_0x566b('0x2')],'comment':_0x566b('0xd')},'role':{'type':Sequelize[_0x566b('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x566b('0x2')]}}; \ No newline at end of file +var _0x7ac4=['setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[queue]','moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','seconds'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7ac4,0x8d));var _0x47ac=function(_0xca82cc,_0x44c6b8){_0xca82cc=_0xca82cc-0x0;var _0xed5cde=_0x7ac4[_0xca82cc];return _0xed5cde;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x47ac('0x0'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x47ac('0x1')]},'interface':{'type':Sequelize[_0x47ac('0x1')]},'type':{'type':Sequelize[_0x47ac('0x1')],'defaultValue':_0x47ac('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x47ac('0x3')]},'enterAt':{'type':Sequelize[_0x47ac('0x4')]},'exitAt':{'type':Sequelize[_0x47ac('0x4')],'set':function(_0x1c1eac){var _0x182b86=moment(_0x1c1eac);var _0x382c2b=moment(this[_0x47ac('0x5')](_0x47ac('0x6')));var _0x501416=_0x182b86[_0x47ac('0x7')](_0x382c2b,_0x47ac('0x8'));this[_0x47ac('0x9')](_0x47ac('0xa'),_0x1c1eac);this['setDataValue'](_0x47ac('0xb'),_0x501416>=0x0?_0x501416:null);}},'data1':{'type':Sequelize[_0x47ac('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x47ac('0x1')],'comment':_0x47ac('0xc')},'data3':{'type':Sequelize[_0x47ac('0x1')],'comment':_0x47ac('0xd')},'data4':{'type':Sequelize[_0x47ac('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x47ac('0x1')],'comment':_0x47ac('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x47ac('0x3')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d7ede60..c5bce7f 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x560f24,_0x4f5306){var _0x42e919=function(_0x254bcd){while(--_0x254bcd){_0x560f24['push'](_0x560f24['shift']());}};_0x42e919(++_0x4f5306);}(_0x3e74,0x175));var _0x43e7=function(_0x1a5ce1,_0x17ceef){_0x1a5ce1=_0x1a5ce1-0x0;var _0x3ecba6=_0x3e74[_0x1a5ce1];return _0x3ecba6;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 795fdd3..c466316 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 _0xef6a=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername','interface'];(function(_0x58a5bf,_0x1f1483){var _0x4f7ac9=function(_0x5d9a17){while(--_0x5d9a17){_0x58a5bf['push'](_0x58a5bf['shift']());}};_0x4f7ac9(++_0x1f1483);}(_0xef6a,0x10e));var _0xaef6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xef6a[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xaef6('0x0'));var util=require(_0xaef6('0x1'));var logger=require(_0xaef6('0x2'))(_0xaef6('0x3'));var moment=require(_0xaef6('0x4'));var BPromise=require('bluebird');var rp=require(_0xaef6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaef6('0x6'));var config=require(_0xaef6('0x7'));var attributes=require(_0xaef6('0x8'));module[_0xaef6('0x9')]=function(_0x2fc56b,_0x2b6d62){return _0x2fc56b[_0xaef6('0xa')](_0xaef6('0xb'),attributes,{'tableName':_0xaef6('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xaef6('0xd'),_0xaef6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8706=['define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./memberReport.attributes','exports'];(function(_0x5598d2,_0x48715d){var _0x5242aa=function(_0x3b9588){while(--_0x3b9588){_0x5598d2['push'](_0x5598d2['shift']());}};_0x5242aa(++_0x48715d);}(_0x8706,0x104));var _0x6870=function(_0x2c15c6,_0x32ebf8){_0x2c15c6=_0x2c15c6-0x0;var _0x1f87bf=_0x8706[_0x2c15c6];return _0x1f87bf;};'use strict';var _=require(_0x6870('0x0'));var util=require(_0x6870('0x1'));var logger=require(_0x6870('0x2'))(_0x6870('0x3'));var moment=require(_0x6870('0x4'));var BPromise=require(_0x6870('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6870('0x6'));var config=require(_0x6870('0x7'));var attributes=require(_0x6870('0x8'));module[_0x6870('0x9')]=function(_0x137114,_0x395221){return _0x137114[_0x6870('0xa')]('MemberReport',attributes,{'tableName':_0x6870('0xb'),'paranoid':![],'indexes':[{'name':_0x6870('0xc'),'fields':[_0x6870('0xd'),_0x6870('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 75db01f..3368732 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 _0x0dee=['limit','include','map','model','GetMemberReport','create','CreateMemberReport','UpdateMemberReport','body','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','MemberReport','findAll','options','raw','where','attributes'];(function(_0x4e00df,_0x4d9e23){var _0x102179=function(_0x4c75ab){while(--_0x4c75ab){_0x4e00df['push'](_0x4e00df['shift']());}};_0x102179(++_0x4d9e23);}(_0x0dee,0xf7));var _0xe0de=function(_0x5161a4,_0x1a3b15){_0x5161a4=_0x5161a4-0x0;var _0x278b24=_0x0dee[_0x5161a4];return _0x278b24;};'use strict';var _=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var moment=require('moment');var BPromise=require(_0xe0de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0de('0x3'));var db=require(_0xe0de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0de('0x5'))(_0xe0de('0x6'));var config=require(_0xe0de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0de('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe1fd9,_0x5e5250,_0x349fd2){return new BPromise(function(_0x5b644c,_0x25818f){return client['request'](_0xfe1fd9,_0x349fd2)[_0xe0de('0x9')](function(_0x4a5ecd){logger[_0xe0de('0xa')](_0xe0de('0xb'),_0x5e5250,_0xe0de('0xc'));logger[_0xe0de('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5e5250,_0xe0de('0xc'),JSON[_0xe0de('0xe')](_0x4a5ecd));if(_0x4a5ecd[_0xe0de('0xf')]){if(_0x4a5ecd[_0xe0de('0xf')]['code']===0x1f4){logger['error'](_0xe0de('0xb'),_0x5e5250,_0x4a5ecd[_0xe0de('0xf')]['message']);return _0x25818f(_0x4a5ecd['error'][_0xe0de('0x10')]);}logger[_0xe0de('0xf')]('MemberReport,\x20%s,\x20%s',_0x5e5250,_0x4a5ecd['error']['message']);return _0x5b644c(_0x4a5ecd['error'][_0xe0de('0x10')]);}else{logger[_0xe0de('0xa')](_0xe0de('0xb'),_0x5e5250,_0xe0de('0xc'));_0x5b644c(_0x4a5ecd[_0xe0de('0x11')][_0xe0de('0x10')]);}})[_0xe0de('0x12')](function(_0x2d8c3d){logger[_0xe0de('0xf')](_0xe0de('0xb'),_0x5e5250,_0x2d8c3d);_0x25818f(_0x2d8c3d);});});}exports['GetMemberReport']=function(_0x45cecc){var _0x2f5a2b=this;return new Promise(function(_0xeb9581,_0x1f41d2){return db[_0xe0de('0x13')][_0xe0de('0x14')]({'raw':_0x45cecc[_0xe0de('0x15')]?_0x45cecc[_0xe0de('0x15')][_0xe0de('0x16')]===undefined?!![]:![]:!![],'where':_0x45cecc[_0xe0de('0x15')]?_0x45cecc['options'][_0xe0de('0x17')]||null:null,'attributes':_0x45cecc['options']?_0x45cecc[_0xe0de('0x15')][_0xe0de('0x18')]||null:null,'limit':_0x45cecc[_0xe0de('0x15')]?_0x45cecc['options'][_0xe0de('0x19')]||null:null,'include':_0x45cecc[_0xe0de('0x15')]?_0x45cecc[_0xe0de('0x15')][_0xe0de('0x1a')]?_[_0xe0de('0x1b')](_0x45cecc['options'][_0xe0de('0x1a')],function(_0x211e92){return{'model':db[_0x211e92['model']],'as':_0x211e92['as'],'attributes':_0x211e92[_0xe0de('0x18')],'include':_0x211e92[_0xe0de('0x1a')]?_[_0xe0de('0x1b')](_0x211e92['include'],function(_0x523891){return{'model':db[_0x523891['model']],'as':_0x523891['as'],'attributes':_0x523891[_0xe0de('0x18')],'include':_0x523891[_0xe0de('0x1a')]?_['map'](_0x523891[_0xe0de('0x1a')],function(_0x31bab4){return{'model':db[_0x31bab4[_0xe0de('0x1c')]],'as':_0x31bab4['as'],'attributes':_0x31bab4[_0xe0de('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x248fc4){logger[_0xe0de('0xa')]('GetMemberReport',_0x45cecc);logger[_0xe0de('0xd')](_0xe0de('0x1d'),_0x45cecc,JSON['stringify'](_0x248fc4));_0xeb9581(_0x248fc4);})['catch'](function(_0x48084f){logger['error'](_0xe0de('0x1d'),_0x48084f['message'],_0x45cecc);_0x1f41d2(_0x2f5a2b[_0xe0de('0xf')](0x1f4,_0x48084f[_0xe0de('0x10')]));});});};exports['CreateMemberReport']=function(_0x3f7d5b){var _0x497183=this;return new Promise(function(_0x4128d9,_0x378cd3){return db[_0xe0de('0x13')][_0xe0de('0x1e')](_0x3f7d5b['body'],{'raw':_0x3f7d5b['options']?_0x3f7d5b[_0xe0de('0x15')][_0xe0de('0x16')]===undefined?!![]:![]:!![]})[_0xe0de('0x9')](function(_0x4ed8c8){logger[_0xe0de('0xa')]('CreateMemberReport',_0x3f7d5b);logger[_0xe0de('0xd')](_0xe0de('0x1f'),_0x3f7d5b,JSON[_0xe0de('0xe')](_0x4ed8c8));_0x4128d9(_0x4ed8c8);})[_0xe0de('0x12')](function(_0x33ddb2){logger[_0xe0de('0xf')](_0xe0de('0x1f'),_0x33ddb2[_0xe0de('0x10')],_0x3f7d5b);_0x378cd3(_0x497183[_0xe0de('0xf')](0x1f4,_0x33ddb2[_0xe0de('0x10')]));});});};exports[_0xe0de('0x20')]=function(_0xb6265a){var _0x52dbd3=this;return new Promise(function(_0x22258a,_0x403a0c){return db[_0xe0de('0x13')]['update'](_0xb6265a[_0xe0de('0x21')],{'raw':_0xb6265a[_0xe0de('0x15')]?_0xb6265a['options'][_0xe0de('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb6265a['options']?_0xb6265a[_0xe0de('0x15')][_0xe0de('0x17')]||null:null,'attributes':_0xb6265a[_0xe0de('0x15')]?_0xb6265a[_0xe0de('0x15')]['attributes']||null:null,'limit':_0xb6265a[_0xe0de('0x15')]?_0xb6265a[_0xe0de('0x15')][_0xe0de('0x19')]||null:null})[_0xe0de('0x9')](function(_0x3c741d){logger[_0xe0de('0xa')](_0xe0de('0x20'),_0xb6265a);logger['debug'](_0xe0de('0x20'),_0xb6265a,JSON['stringify'](_0x3c741d));_0x22258a(_0x3c741d);})[_0xe0de('0x12')](function(_0xcd363d){logger[_0xe0de('0xf')]('UpdateMemberReport',_0xcd363d[_0xe0de('0x10')],_0xb6265a);_0x403a0c(_0x52dbd3[_0xe0de('0xf')](0x1f4,_0xcd363d['message']));});});}; \ No newline at end of file +var _0x9e8a=['GetMemberReport','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','include','map','model'];(function(_0x465055,_0x30af4f){var _0x5e2994=function(_0x25cfb0){while(--_0x25cfb0){_0x465055['push'](_0x465055['shift']());}};_0x5e2994(++_0x30af4f);}(_0x9e8a,0x112));var _0xa9e8=function(_0x9a5093,_0x2ba7ce){_0x9a5093=_0x9a5093-0x0;var _0x374933=_0x9e8a[_0x9a5093];return _0x374933;};'use strict';var _=require(_0xa9e8('0x0'));var util=require(_0xa9e8('0x1'));var moment=require(_0xa9e8('0x2'));var BPromise=require(_0xa9e8('0x3'));var rs=require(_0xa9e8('0x4'));var fs=require('fs');var Redis=require(_0xa9e8('0x5'));var db=require(_0xa9e8('0x6'))['db'];var utils=require(_0xa9e8('0x7'));var logger=require(_0xa9e8('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa9e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f9d95,_0x44e943,_0x3578d3){return new BPromise(function(_0x456245,_0x538ba7){return client[_0xa9e8('0xa')](_0x3f9d95,_0x3578d3)[_0xa9e8('0xb')](function(_0x1467f2){logger[_0xa9e8('0xc')]('MemberReport,\x20%s,\x20%s',_0x44e943,_0xa9e8('0xd'));logger[_0xa9e8('0xe')](_0xa9e8('0xf'),_0x44e943,_0xa9e8('0xd'),JSON['stringify'](_0x1467f2));if(_0x1467f2[_0xa9e8('0x10')]){if(_0x1467f2[_0xa9e8('0x10')][_0xa9e8('0x11')]===0x1f4){logger[_0xa9e8('0x10')](_0xa9e8('0x12'),_0x44e943,_0x1467f2[_0xa9e8('0x10')][_0xa9e8('0x13')]);return _0x538ba7(_0x1467f2[_0xa9e8('0x10')]['message']);}logger[_0xa9e8('0x10')]('MemberReport,\x20%s,\x20%s',_0x44e943,_0x1467f2['error']['message']);return _0x456245(_0x1467f2['error']['message']);}else{logger[_0xa9e8('0xc')](_0xa9e8('0x12'),_0x44e943,_0xa9e8('0xd'));_0x456245(_0x1467f2[_0xa9e8('0x14')][_0xa9e8('0x13')]);}})[_0xa9e8('0x15')](function(_0x541831){logger[_0xa9e8('0x10')]('MemberReport,\x20%s,\x20%s',_0x44e943,_0x541831);_0x538ba7(_0x541831);});});}exports['GetMemberReport']=function(_0x524e4e){var _0x3be872=this;return new Promise(function(_0x757a54,_0x434ac9){return db['MemberReport'][_0xa9e8('0x16')]({'raw':_0x524e4e[_0xa9e8('0x17')]?_0x524e4e[_0xa9e8('0x17')][_0xa9e8('0x18')]===undefined?!![]:![]:!![],'where':_0x524e4e[_0xa9e8('0x17')]?_0x524e4e[_0xa9e8('0x17')][_0xa9e8('0x19')]||null:null,'attributes':_0x524e4e[_0xa9e8('0x17')]?_0x524e4e[_0xa9e8('0x17')][_0xa9e8('0x1a')]||null:null,'limit':_0x524e4e[_0xa9e8('0x17')]?_0x524e4e['options']['limit']||null:null,'include':_0x524e4e[_0xa9e8('0x17')]?_0x524e4e[_0xa9e8('0x17')][_0xa9e8('0x1b')]?_[_0xa9e8('0x1c')](_0x524e4e[_0xa9e8('0x17')]['include'],function(_0x74fe20){return{'model':db[_0x74fe20['model']],'as':_0x74fe20['as'],'attributes':_0x74fe20[_0xa9e8('0x1a')],'include':_0x74fe20[_0xa9e8('0x1b')]?_[_0xa9e8('0x1c')](_0x74fe20[_0xa9e8('0x1b')],function(_0xc015c5){return{'model':db[_0xc015c5[_0xa9e8('0x1d')]],'as':_0xc015c5['as'],'attributes':_0xc015c5['attributes'],'include':_0xc015c5[_0xa9e8('0x1b')]?_['map'](_0xc015c5[_0xa9e8('0x1b')],function(_0x3a7b7a){return{'model':db[_0x3a7b7a['model']],'as':_0x3a7b7a['as'],'attributes':_0x3a7b7a[_0xa9e8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a206f){logger[_0xa9e8('0xc')](_0xa9e8('0x1e'),_0x524e4e);logger['debug'](_0xa9e8('0x1e'),_0x524e4e,JSON['stringify'](_0x3a206f));_0x757a54(_0x3a206f);})[_0xa9e8('0x15')](function(_0x3e6c63){logger[_0xa9e8('0x10')](_0xa9e8('0x1e'),_0x3e6c63['message'],_0x524e4e);_0x434ac9(_0x3be872[_0xa9e8('0x10')](0x1f4,_0x3e6c63[_0xa9e8('0x13')]));});});};exports[_0xa9e8('0x1f')]=function(_0x5c518d){var _0x1f8c9a=this;return new Promise(function(_0x53e363,_0xa3bf66){return db[_0xa9e8('0x20')][_0xa9e8('0x21')](_0x5c518d[_0xa9e8('0x22')],{'raw':_0x5c518d[_0xa9e8('0x17')]?_0x5c518d[_0xa9e8('0x17')][_0xa9e8('0x18')]===undefined?!![]:![]:!![]})[_0xa9e8('0xb')](function(_0x38d353){logger[_0xa9e8('0xc')](_0xa9e8('0x1f'),_0x5c518d);logger[_0xa9e8('0xe')](_0xa9e8('0x1f'),_0x5c518d,JSON['stringify'](_0x38d353));_0x53e363(_0x38d353);})[_0xa9e8('0x15')](function(_0x3a4c5f){logger[_0xa9e8('0x10')]('CreateMemberReport',_0x3a4c5f['message'],_0x5c518d);_0xa3bf66(_0x1f8c9a[_0xa9e8('0x10')](0x1f4,_0x3a4c5f[_0xa9e8('0x13')]));});});};exports[_0xa9e8('0x23')]=function(_0xc1b64d){var _0x184a8c=this;return new Promise(function(_0x2f906e,_0x390fe6){return db[_0xa9e8('0x20')][_0xa9e8('0x24')](_0xc1b64d[_0xa9e8('0x22')],{'raw':_0xc1b64d[_0xa9e8('0x17')]?_0xc1b64d[_0xa9e8('0x17')][_0xa9e8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc1b64d[_0xa9e8('0x17')]?_0xc1b64d[_0xa9e8('0x17')][_0xa9e8('0x19')]||null:null,'attributes':_0xc1b64d[_0xa9e8('0x17')]?_0xc1b64d[_0xa9e8('0x17')][_0xa9e8('0x1a')]||null:null,'limit':_0xc1b64d['options']?_0xc1b64d['options'][_0xa9e8('0x25')]||null:null})['then'](function(_0x42886f){logger[_0xa9e8('0xc')](_0xa9e8('0x23'),_0xc1b64d);logger[_0xa9e8('0xe')](_0xa9e8('0x23'),_0xc1b64d,JSON['stringify'](_0x42886f));_0x2f906e(_0x42886f);})[_0xa9e8('0x15')](function(_0x350f1b){logger[_0xa9e8('0x10')](_0xa9e8('0x23'),_0x350f1b[_0xa9e8('0x13')],_0xc1b64d);_0x390fe6(_0x184a8c[_0xa9e8('0x10')](0x1f4,_0x350f1b[_0xa9e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1637b2f..8c33485 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 _0x7d53=['get','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xe90e59,_0x15f85f){var _0x3c75c2=function(_0x519ecd){while(--_0x519ecd){_0xe90e59['push'](_0xe90e59['shift']());}};_0x3c75c2(++_0x15f85f);}(_0x7d53,0x1b9));var _0x37d5=function(_0x2fc5e4,_0x1f748a){_0x2fc5e4=_0x2fc5e4-0x0;var _0xd4a273=_0x7d53[_0x2fc5e4];return _0xd4a273;};'use strict';var multer=require(_0x37d5('0x0'));var util=require(_0x37d5('0x1'));var path=require(_0x37d5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x37d5('0x3')]();var fs_extra=require(_0x37d5('0x4'));var auth=require(_0x37d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x37d5('0x6'));var controller=require('./migration.controller');router[_0x37d5('0x7')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x8ab5=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util','path'];(function(_0x32859c,_0x1b85cc){var _0x3191d1=function(_0x38d86b){while(--_0x38d86b){_0x32859c['push'](_0x32859c['shift']());}};_0x3191d1(++_0x1b85cc);}(_0x8ab5,0x1e9));var _0x58ab=function(_0x5825fd,_0x2374cf){_0x5825fd=_0x5825fd-0x0;var _0x46960e=_0x8ab5[_0x5825fd];return _0x46960e;};'use strict';var multer=require(_0x58ab('0x0'));var util=require(_0x58ab('0x1'));var path=require(_0x58ab('0x2'));var timeout=require(_0x58ab('0x3'));var express=require(_0x58ab('0x4'));var router=express[_0x58ab('0x5')]();var fs_extra=require(_0x58ab('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x58ab('0x7'));var config=require(_0x58ab('0x8'));var controller=require(_0x58ab('0x9'));router[_0x58ab('0xa')]('/',controller[_0x58ab('0xb')]);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 5fcaf73..733b361 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 _0x7a43=['exports','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a43,0x1c7));var _0x37a4=function(_0x5dc42e,_0x21075d){_0x5dc42e=_0x5dc42e-0x0;var _0x3e3a22=_0x7a43[_0x5dc42e];return _0x3e3a22;};'use strict';var Sequelize=require(_0x37a4('0x0'));module[_0x37a4('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x9fd8=['version'];(function(_0x58b1ab,_0x4bf01b){var _0x471bc8=function(_0x2fbfd0){while(--_0x2fbfd0){_0x58b1ab['push'](_0x58b1ab['shift']());}};_0x471bc8(++_0x4bf01b);}(_0x9fd8,0x1b3));var _0x89fd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9fd8[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x89fd('0x0')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 1b6d369..5062bdd 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 _0x0307=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','Migration','rawAttributes','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x1c0b17,_0x405ed6){var _0x4c689a=function(_0x407d27){while(--_0x407d27){_0x1c0b17['push'](_0x1c0b17['shift']());}};_0x4c689a(++_0x405ed6);}(_0x0307,0xb5));var _0x7030=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x0307[_0x88cd7b];return _0x56fcc8;};'use strict';var emlformat=require(_0x7030('0x0'));var rimraf=require(_0x7030('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7030('0x2'));var rp=require('request-promise');var moment=require(_0x7030('0x3'));var BPromise=require(_0x7030('0x4'));var Mustache=require(_0x7030('0x5'));var util=require('util');var path=require(_0x7030('0x6'));var sox=require(_0x7030('0x7'));var csv=require(_0x7030('0x8'));var ejs=require(_0x7030('0x9'));var fs=require('fs');var fs_extra=require(_0x7030('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7030('0xb'));var jsforce=require(_0x7030('0xc'));var deskjs=require(_0x7030('0xd'));var toCsv=require(_0x7030('0x8'));var querystring=require(_0x7030('0xe'));var Papa=require('papaparse');var Redis=require(_0x7030('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7030('0x10'));var as=require(_0x7030('0x11'));var hardwareService=require(_0x7030('0x12'));var logger=require(_0x7030('0x13'))('api');var utils=require(_0x7030('0x14'));var config=require(_0x7030('0x15'));var licenseUtil=require(_0x7030('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x494327,_0x28ff6a){_0x28ff6a=_0x28ff6a||0xcc;return function(_0x200d32){if(_0x200d32){return _0x494327[_0x7030('0x17')](_0x28ff6a);}return _0x494327[_0x7030('0x18')](_0x28ff6a)[_0x7030('0x19')]();};}function respondWithResult(_0x20a26d,_0x4b19f8){_0x4b19f8=_0x4b19f8||0xc8;return function(_0x1a5e13){if(_0x1a5e13){return _0x20a26d[_0x7030('0x18')](_0x4b19f8)['json'](_0x1a5e13);}};}function respondWithFilteredResult(_0x325d7c,_0x775de9){return function(_0x5d5d1e){if(_0x5d5d1e){var _0x4cf48b=typeof _0x775de9[_0x7030('0x1a')]==='undefined'&&typeof _0x775de9[_0x7030('0x1b')]===_0x7030('0x1c');var _0x4e5699=_0x5d5d1e[_0x7030('0x1d')];var _0x90a7d1=_0x4cf48b?0x0:_0x775de9[_0x7030('0x1a')];var _0xd489c6=_0x4cf48b?_0x5d5d1e[_0x7030('0x1d')]:_0x775de9[_0x7030('0x1a')]+_0x775de9['limit'];var _0x30e5db;if(_0xd489c6>=_0x4e5699){_0xd489c6=_0x4e5699;_0x30e5db=0xc8;}else{_0x30e5db=0xce;}_0x325d7c[_0x7030('0x18')](_0x30e5db);return _0x325d7c[_0x7030('0x1e')](_0x7030('0x1f'),_0x90a7d1+'-'+_0xd489c6+'/'+_0x4e5699)['json'](_0x5d5d1e);}return null;};}function patchUpdates(_0x2a37e8){return function(_0x5b5c8c){try{jsonpatch[_0x7030('0x20')](_0x5b5c8c,_0x2a37e8,!![]);}catch(_0x215c29){return BPromise[_0x7030('0x21')](_0x215c29);}return _0x5b5c8c['save']();};}function saveUpdates(_0x448395,_0x40f80d){return function(_0x32c392){if(_0x32c392){return _0x32c392[_0x7030('0x22')](_0x448395)['then'](function(_0x5e1c3f){return _0x5e1c3f;});}return null;};}function removeEntity(_0x2eb923,_0x3a91a5){return function(_0x3837b8){if(_0x3837b8){return _0x3837b8[_0x7030('0x23')]()[_0x7030('0x24')](function(){_0x2eb923['status'](0xcc)[_0x7030('0x19')]();});}};}function handleEntityNotFound(_0x5a9e10,_0x4af865){return function(_0x433797){if(!_0x433797){_0x5a9e10[_0x7030('0x17')](0x194);}return _0x433797;};}function handleError(_0xd3b9dd,_0x19e83a){_0x19e83a=_0x19e83a||0x1f4;return function(_0x39beb2){logger[_0x7030('0x25')](_0x39beb2[_0x7030('0x26')]);if(_0x39beb2[_0x7030('0x27')]){delete _0x39beb2[_0x7030('0x27')];}_0xd3b9dd[_0x7030('0x18')](_0x19e83a)[_0x7030('0x28')](_0x39beb2);};}exports[_0x7030('0x29')]=function(_0x4e8f84,_0x1393f8){var _0x53f4e5={},_0x558bd5={},_0x143cb9={'count':0x0,'rows':[]};var _0x291366=_[_0x7030('0x2a')](db[_0x7030('0x2b')][_0x7030('0x2c')],function(_0x1b23d9){return{'name':_0x1b23d9['fieldName'],'type':_0x1b23d9['type']['key']};});_0x558bd5[_0x7030('0x2d')]=_[_0x7030('0x2a')](_0x291366,_0x7030('0x27'));_0x558bd5['query']=_[_0x7030('0x2e')](_0x4e8f84[_0x7030('0x2f')]);_0x558bd5[_0x7030('0x30')]=_['intersection'](_0x558bd5['model'],_0x558bd5[_0x7030('0x2f')]);_0x53f4e5[_0x7030('0x31')]=_[_0x7030('0x32')](_0x558bd5[_0x7030('0x2d')],qs['fields'](_0x4e8f84[_0x7030('0x2f')][_0x7030('0x33')]));_0x53f4e5[_0x7030('0x31')]=_0x53f4e5[_0x7030('0x31')]['length']?_0x53f4e5['attributes']:_0x558bd5[_0x7030('0x2d')];if(!_0x4e8f84['query'][_0x7030('0x34')](_0x7030('0x35'))){_0x53f4e5['limit']=qs['limit'](_0x4e8f84[_0x7030('0x2f')][_0x7030('0x1b')]);_0x53f4e5[_0x7030('0x1a')]=qs[_0x7030('0x1a')](_0x4e8f84[_0x7030('0x2f')]['offset']);}_0x53f4e5['order']=qs['sort'](_0x4e8f84['query'][_0x7030('0x36')]);_0x53f4e5[_0x7030('0x37')]=qs[_0x7030('0x30')](_[_0x7030('0x38')](_0x4e8f84[_0x7030('0x2f')],_0x558bd5[_0x7030('0x30')]),_0x291366);if(_0x4e8f84[_0x7030('0x2f')][_0x7030('0x39')]){_0x53f4e5[_0x7030('0x37')]=_[_0x7030('0x3a')](_0x53f4e5[_0x7030('0x37')],{'$or':_[_0x7030('0x2a')](_0x291366,function(_0x43ed54){if(_0x43ed54[_0x7030('0x3b')]!==_0x7030('0x3c')){var _0x5db6fb={};_0x5db6fb[_0x43ed54[_0x7030('0x27')]]={'$like':'%'+_0x4e8f84[_0x7030('0x2f')][_0x7030('0x39')]+'%'};return _0x5db6fb;}})});}_0x53f4e5=_[_0x7030('0x3a')]({},_0x53f4e5,_0x4e8f84[_0x7030('0x3d')]);var _0x23813c={'where':_0x53f4e5[_0x7030('0x37')]};return db[_0x7030('0x2b')]['count'](_0x23813c)[_0x7030('0x24')](function(_0x5c60c6){_0x143cb9[_0x7030('0x1d')]=_0x5c60c6;if(_0x4e8f84['query'][_0x7030('0x3e')]){_0x53f4e5[_0x7030('0x3f')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x53f4e5);})[_0x7030('0x24')](function(_0x2be2c8){_0x143cb9[_0x7030('0x40')]=_0x2be2c8;return _0x143cb9;})['then'](respondWithFilteredResult(_0x1393f8,_0x53f4e5))['catch'](handleError(_0x1393f8,null));}; \ No newline at end of file +var _0x90a4=['destroy','then','end','error','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update'];(function(_0x2b3a62,_0x218f43){var _0x291ca5=function(_0xbf1115){while(--_0xbf1115){_0x2b3a62['push'](_0x2b3a62['shift']());}};_0x291ca5(++_0x218f43);}(_0x90a4,0x1d1));var _0x490a=function(_0x2275bc,_0x21937c){_0x2275bc=_0x2275bc-0x0;var _0x1f0223=_0x90a4[_0x2275bc];return _0x1f0223;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x490a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x490a('0x1'));var rp=require(_0x490a('0x2'));var moment=require(_0x490a('0x3'));var BPromise=require(_0x490a('0x4'));var Mustache=require(_0x490a('0x5'));var util=require(_0x490a('0x6'));var path=require(_0x490a('0x7'));var sox=require('sox');var csv=require(_0x490a('0x8'));var ejs=require(_0x490a('0x9'));var fs=require('fs');var fs_extra=require(_0x490a('0xa'));var _=require(_0x490a('0xb'));var squel=require(_0x490a('0xc'));var crypto=require(_0x490a('0xd'));var jsforce=require(_0x490a('0xe'));var deskjs=require(_0x490a('0xf'));var toCsv=require(_0x490a('0x8'));var querystring=require(_0x490a('0x10'));var Papa=require(_0x490a('0x11'));var Redis=require(_0x490a('0x12'));var authService=require(_0x490a('0x13'));var qs=require(_0x490a('0x14'));var as=require(_0x490a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x490a('0x16'))(_0x490a('0x17'));var utils=require(_0x490a('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x490a('0x19'))['db'];function respondWithStatusCode(_0x35f8f1,_0x432090){_0x432090=_0x432090||0xcc;return function(_0x2bee1f){if(_0x2bee1f){return _0x35f8f1[_0x490a('0x1a')](_0x432090);}return _0x35f8f1['status'](_0x432090)['end']();};}function respondWithResult(_0x582499,_0x2724d4){_0x2724d4=_0x2724d4||0xc8;return function(_0x87d2fa){if(_0x87d2fa){return _0x582499[_0x490a('0x1b')](_0x2724d4)[_0x490a('0x1c')](_0x87d2fa);}};}function respondWithFilteredResult(_0x1d6458,_0x36e013){return function(_0x1ab91b){if(_0x1ab91b){var _0xe806bb=typeof _0x36e013[_0x490a('0x1d')]==='undefined'&&typeof _0x36e013[_0x490a('0x1e')]===_0x490a('0x1f');var _0x20c6f0=_0x1ab91b[_0x490a('0x20')];var _0x44e0bb=_0xe806bb?0x0:_0x36e013['offset'];var _0x17ee78=_0xe806bb?_0x1ab91b[_0x490a('0x20')]:_0x36e013[_0x490a('0x1d')]+_0x36e013['limit'];var _0x1ae00b;if(_0x17ee78>=_0x20c6f0){_0x17ee78=_0x20c6f0;_0x1ae00b=0xc8;}else{_0x1ae00b=0xce;}_0x1d6458[_0x490a('0x1b')](_0x1ae00b);return _0x1d6458[_0x490a('0x21')](_0x490a('0x22'),_0x44e0bb+'-'+_0x17ee78+'/'+_0x20c6f0)[_0x490a('0x1c')](_0x1ab91b);}return null;};}function patchUpdates(_0x4c1096){return function(_0x84abe3){try{jsonpatch[_0x490a('0x23')](_0x84abe3,_0x4c1096,!![]);}catch(_0x45965f){return BPromise[_0x490a('0x24')](_0x45965f);}return _0x84abe3[_0x490a('0x25')]();};}function saveUpdates(_0x4e283b,_0x47e1bb){return function(_0x1bbfc2){if(_0x1bbfc2){return _0x1bbfc2[_0x490a('0x26')](_0x4e283b)['then'](function(_0x253fe6){return _0x253fe6;});}return null;};}function removeEntity(_0x45173a,_0x559d22){return function(_0x1182bd){if(_0x1182bd){return _0x1182bd[_0x490a('0x27')]()[_0x490a('0x28')](function(){_0x45173a[_0x490a('0x1b')](0xcc)[_0x490a('0x29')]();});}};}function handleEntityNotFound(_0xdbe823,_0x5c2895){return function(_0x4e3f7b){if(!_0x4e3f7b){_0xdbe823[_0x490a('0x1a')](0x194);}return _0x4e3f7b;};}function handleError(_0x3a9901,_0x569fe2){_0x569fe2=_0x569fe2||0x1f4;return function(_0x39ab55){logger[_0x490a('0x2a')](_0x39ab55['stack']);if(_0x39ab55[_0x490a('0x2b')]){delete _0x39ab55[_0x490a('0x2b')];}_0x3a9901[_0x490a('0x1b')](_0x569fe2)[_0x490a('0x2c')](_0x39ab55);};}exports['index']=function(_0x6d4275,_0x2d10b3){var _0x3e66fb={},_0x1e2e15={},_0x282aaa={'count':0x0,'rows':[]};var _0x33c65d=_[_0x490a('0x2d')](db[_0x490a('0x2e')][_0x490a('0x2f')],function(_0x72766d){return{'name':_0x72766d[_0x490a('0x30')],'type':_0x72766d[_0x490a('0x31')][_0x490a('0x32')]};});_0x1e2e15[_0x490a('0x33')]=_[_0x490a('0x2d')](_0x33c65d,_0x490a('0x2b'));_0x1e2e15[_0x490a('0x34')]=_[_0x490a('0x35')](_0x6d4275[_0x490a('0x34')]);_0x1e2e15[_0x490a('0x36')]=_[_0x490a('0x37')](_0x1e2e15[_0x490a('0x33')],_0x1e2e15['query']);_0x3e66fb['attributes']=_[_0x490a('0x37')](_0x1e2e15[_0x490a('0x33')],qs['fields'](_0x6d4275[_0x490a('0x34')][_0x490a('0x38')]));_0x3e66fb[_0x490a('0x39')]=_0x3e66fb['attributes']['length']?_0x3e66fb['attributes']:_0x1e2e15[_0x490a('0x33')];if(!_0x6d4275[_0x490a('0x34')][_0x490a('0x3a')](_0x490a('0x3b'))){_0x3e66fb[_0x490a('0x1e')]=qs[_0x490a('0x1e')](_0x6d4275[_0x490a('0x34')]['limit']);_0x3e66fb[_0x490a('0x1d')]=qs[_0x490a('0x1d')](_0x6d4275[_0x490a('0x34')][_0x490a('0x1d')]);}_0x3e66fb[_0x490a('0x3c')]=qs[_0x490a('0x3d')](_0x6d4275[_0x490a('0x34')]['sort']);_0x3e66fb[_0x490a('0x3e')]=qs[_0x490a('0x36')](_[_0x490a('0x3f')](_0x6d4275[_0x490a('0x34')],_0x1e2e15[_0x490a('0x36')]),_0x33c65d);if(_0x6d4275[_0x490a('0x34')][_0x490a('0x40')]){_0x3e66fb[_0x490a('0x3e')]=_[_0x490a('0x41')](_0x3e66fb[_0x490a('0x3e')],{'$or':_['map'](_0x33c65d,function(_0x14fa37){if(_0x14fa37[_0x490a('0x31')]!==_0x490a('0x42')){var _0x99dbe1={};_0x99dbe1[_0x14fa37[_0x490a('0x2b')]]={'$like':'%'+_0x6d4275[_0x490a('0x34')][_0x490a('0x40')]+'%'};return _0x99dbe1;}})});}_0x3e66fb=_[_0x490a('0x41')]({},_0x3e66fb,_0x6d4275[_0x490a('0x43')]);var _0x313dc4={'where':_0x3e66fb[_0x490a('0x3e')]};return db['Migration'][_0x490a('0x20')](_0x313dc4)[_0x490a('0x28')](function(_0xcba007){_0x282aaa[_0x490a('0x20')]=_0xcba007;if(_0x6d4275[_0x490a('0x34')]['includeAll']){_0x3e66fb[_0x490a('0x44')]=[{'all':!![]}];}return db['Migration'][_0x490a('0x45')](_0x3e66fb);})['then'](function(_0xeef116){_0x282aaa[_0x490a('0x46')]=_0xeef116;return _0x282aaa;})[_0x490a('0x28')](respondWithFilteredResult(_0x2d10b3,_0x3e66fb))[_0x490a('0x47')](handleError(_0x2d10b3,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a2867d5..0cbd647 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 _0x5e6c=['rimraf','../../config/environment','./migration.attributes','define','Migration','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e6c,0x17b));var _0xc5e6=function(_0x17f5c5,_0x28196b){_0x17f5c5=_0x17f5c5-0x0;var _0x103af5=_0x5e6c[_0x17f5c5];return _0x103af5;};'use strict';var _=require('lodash');var util=require(_0xc5e6('0x0'));var logger=require(_0xc5e6('0x1'))(_0xc5e6('0x2'));var moment=require(_0xc5e6('0x3'));var BPromise=require(_0xc5e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5e6('0x5'));var rimraf=require(_0xc5e6('0x6'));var config=require(_0xc5e6('0x7'));var attributes=require(_0xc5e6('0x8'));module['exports']=function(_0x27dfa8,_0x4e31aa){return _0x27dfa8[_0xc5e6('0x9')](_0xc5e6('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcf3=['lodash','util','../../config/logger','api','moment','bluebird','path','define','migrations'];(function(_0x536953,_0x30b0d9){var _0x3448dc=function(_0x10b650){while(--_0x10b650){_0x536953['push'](_0x536953['shift']());}};_0x3448dc(++_0x30b0d9);}(_0xbcf3,0x144));var _0x3bcf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbcf3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3bcf('0x0'));var util=require(_0x3bcf('0x1'));var logger=require(_0x3bcf('0x2'))(_0x3bcf('0x3'));var moment=require(_0x3bcf('0x4'));var BPromise=require(_0x3bcf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bcf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./migration.attributes');module['exports']=function(_0x45d35b,_0x20690c){return _0x45d35b[_0x3bcf('0x7')]('Migration',attributes,{'tableName':_0x3bcf('0x8'),'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 924309c..0264667 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 _0x8aa7=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4fb78c,_0x2e7081){var _0x336826=function(_0x441d3b){while(--_0x441d3b){_0x4fb78c['push'](_0x4fb78c['shift']());}};_0x336826(++_0x2e7081);}(_0x8aa7,0xb6));var _0x78aa=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x8aa7[_0x6cf19c];return _0xce14f3;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var moment=require(_0x78aa('0x1'));var BPromise=require(_0x78aa('0x2'));var rs=require(_0x78aa('0x3'));var fs=require('fs');var Redis=require(_0x78aa('0x4'));var db=require(_0x78aa('0x5'))['db'];var utils=require(_0x78aa('0x6'));var logger=require('../../config/logger')(_0x78aa('0x7'));var config=require(_0x78aa('0x8'));var jayson=require(_0x78aa('0x9'));var client=jayson[_0x78aa('0xa')][_0x78aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369ee7,_0x462a9a,_0xa79008){return new BPromise(function(_0x2368ac,_0x460488){return client[_0x78aa('0xc')](_0x369ee7,_0xa79008)[_0x78aa('0xd')](function(_0x45d377){logger[_0x78aa('0xe')](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));logger[_0x78aa('0x11')](_0x78aa('0x12'),_0x462a9a,_0x78aa('0x10'),JSON['stringify'](_0x45d377));if(_0x45d377['error']){if(_0x45d377[_0x78aa('0x13')][_0x78aa('0x14')]===0x1f4){logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x460488(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x2368ac(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}else{logger['info'](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));_0x2368ac(_0x45d377[_0x78aa('0x16')][_0x78aa('0x15')]);}})[_0x78aa('0x17')](function(_0x2897f8){logger['error']('Migration,\x20%s,\x20%s',_0x462a9a,_0x2897f8);_0x460488(_0x2897f8);});});} \ No newline at end of file +var _0x5c00=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5c00,0x17e));var _0x05c0=function(_0x93c171,_0x2b3a4c){_0x93c171=_0x93c171-0x0;var _0x4970d9=_0x5c00[_0x93c171];return _0x4970d9;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('Migration,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('Migration,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2c8be78..c8ce1d0 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 _0x6365=['put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0x6365,0x148));var _0x5636=function(_0x5f28f6,_0xc92684){_0x5f28f6=_0x5f28f6-0x0;var _0x2841f2=_0x6365[_0x5f28f6];return _0x2841f2;};'use strict';var multer=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var path=require(_0x5636('0x2'));var timeout=require(_0x5636('0x3'));var express=require('express');var router=express[_0x5636('0x4')]();var fs_extra=require(_0x5636('0x5'));var auth=require(_0x5636('0x6'));var interaction=require(_0x5636('0x7'));var config=require(_0x5636('0x8'));var controller=require('./network.controller');router[_0x5636('0x9')]('/',auth[_0x5636('0xa')](),controller[_0x5636('0xb')]);router[_0x5636('0x9')]('/:id',auth[_0x5636('0xa')](),controller[_0x5636('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5636('0xd')]);router[_0x5636('0xe')](_0x5636('0xf'),auth[_0x5636('0xa')](),controller['update']);router['delete'](_0x5636('0xf'),auth['isAuthenticated'](),controller[_0x5636('0x10')]);module[_0x5636('0x11')]=router; \ No newline at end of file +var _0x66fa=['isAuthenticated','index','get','/:id','post','create','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x49972d,_0x73b509){var _0x4d1b26=function(_0x45e1c3){while(--_0x45e1c3){_0x49972d['push'](_0x49972d['shift']());}};_0x4d1b26(++_0x73b509);}(_0x66fa,0x117));var _0xa66f=function(_0xcaf9d6,_0x114553){_0xcaf9d6=_0xcaf9d6-0x0;var _0xd6366d=_0x66fa[_0xcaf9d6];return _0xd6366d;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./network.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller[_0xa66f('0xe')]);router['put'](_0xa66f('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 50d35aa..856c93c 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 _0x2357=['sequelize','exports','ENUM','localnet','stun','turn','STRING'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0x2357,0x149));var _0x7235=function(_0x58d8f4,_0x8046d9){_0x58d8f4=_0x58d8f4-0x0;var _0x1e1e09=_0x2357[_0x58d8f4];return _0x1e1e09;};'use strict';var Sequelize=require(_0x7235('0x0'));module[_0x7235('0x1')]={'type':{'type':Sequelize[_0x7235('0x2')](_0x7235('0x3'),'externip',_0x7235('0x4'),_0x7235('0x5'))},'value':{'type':Sequelize[_0x7235('0x6')]},'username':{'type':Sequelize[_0x7235('0x6')]},'password':{'type':Sequelize[_0x7235('0x6')]}}; \ No newline at end of file +var _0xc214=['localnet','stun','STRING','ENUM'];(function(_0x449a1b,_0x3f2a64){var _0x50494c=function(_0x55b753){while(--_0x55b753){_0x449a1b['push'](_0x449a1b['shift']());}};_0x50494c(++_0x3f2a64);}(_0xc214,0xb3));var _0x4c21=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc214[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x4c21('0x0')](_0x4c21('0x1'),'externip',_0x4c21('0x2'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4c21('0x3')]},'password':{'type':Sequelize[_0x4c21('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index c1ca2a2..aa7fe98 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 _0x964b=['find','create','body','findAll','type','readFileSync','join','root','render','writeFileSync','/etc/asterisk/stun_xcally.conf','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','STUN','server/files/templates/stun_multiple.ejs','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','destroy','util','path','ejs','../../components/parsers/qs','../../config/logger','../../config/environment','jayson/promise','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','status','offset','limit','undefined','count','set','Content-Range','json','update','sendStatus','stack','name','index','Network','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','params','keys'];(function(_0x1add6a,_0x5bf9bb){var _0x4f2de6=function(_0x3aa8bf){while(--_0x3aa8bf){_0x1add6a['push'](_0x1add6a['shift']());}};_0x4f2de6(++_0x5bf9bb);}(_0x964b,0x6e));var _0xb964=function(_0x2595a5,_0x3e8b79){_0x2595a5=_0x2595a5-0x0;var _0x270643=_0x964b[_0x2595a5];return _0x270643;};'use strict';var util=require(_0xb964('0x0'));var path=require(_0xb964('0x1'));var ejs=require(_0xb964('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0xb964('0x3'));var logger=require(_0xb964('0x4'))('api');var config=require(_0xb964('0x5'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb964('0x6'));var client=jayson['client'][_0xb964('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a2f07,_0x3a16c4,_0x87d8f9,_0x4dac3f){return new Promise(function(_0x1b452c,_0x13194d){var _0x9efeb3=_0x4dac3f||client;return _0x9efeb3[_0xb964('0x8')](_0x4a2f07,_0x87d8f9)[_0xb964('0x9')](function(_0xe680c0){logger['info'](_0xb964('0xa'),_0x3a16c4,_0xb964('0xb'));logger[_0xb964('0xc')](_0xb964('0xd'),_0x3a16c4,_0xb964('0xb'),JSON['stringify'](_0xe680c0));if(_0xe680c0[_0xb964('0xe')]){if(_0xe680c0[_0xb964('0xe')]['code']===0x1f4){logger['error'](_0xb964('0xa'),_0x3a16c4,_0xe680c0['error']['message']);return _0x13194d(_0xe680c0[_0xb964('0xe')][_0xb964('0xf')]);}logger['error'](_0xb964('0xa'),_0x3a16c4,_0xe680c0['error']['message']);return _0x1b452c(_0xe680c0[_0xb964('0xe')][_0xb964('0xf')]);}else{logger[_0xb964('0x10')](_0xb964('0xa'),_0x3a16c4,_0xb964('0xb'));_0x1b452c(_0xe680c0[_0xb964('0x11')][_0xb964('0xf')]);}})[_0xb964('0x12')](function(_0x1aeda1){logger[_0xb964('0xe')]('Network,\x20%s,\x20%s',_0x3a16c4,_0x1aeda1);_0x13194d(_0x1aeda1);});});}function respondWithResult(_0x233cc6,_0x58a230){_0x58a230=_0x58a230||0xc8;return function(_0x2cfc87){if(_0x2cfc87){return _0x233cc6[_0xb964('0x13')](_0x58a230)['json'](_0x2cfc87);}};}function respondWithFilteredResult(_0xbc940f,_0x2939ac){return function(_0x5d4e48){if(_0x5d4e48){var _0x285d62=typeof _0x2939ac[_0xb964('0x14')]==='undefined'&&typeof _0x2939ac[_0xb964('0x15')]===_0xb964('0x16');var _0x1bf105=_0x5d4e48[_0xb964('0x17')];var _0x3fe76f=_0x285d62?0x0:_0x2939ac[_0xb964('0x14')];var _0x1f2cc3=_0x285d62?_0x5d4e48[_0xb964('0x17')]:_0x2939ac[_0xb964('0x14')]+_0x2939ac[_0xb964('0x15')];var _0x11d29f;if(_0x1f2cc3>=_0x1bf105){_0x1f2cc3=_0x1bf105;_0x11d29f=0xc8;}else{_0x11d29f=0xce;}_0xbc940f[_0xb964('0x13')](_0x11d29f);return _0xbc940f[_0xb964('0x18')](_0xb964('0x19'),_0x3fe76f+'-'+_0x1f2cc3+'/'+_0x1bf105)[_0xb964('0x1a')](_0x5d4e48);}return null;};}function saveUpdates(_0x40cea1){return function(_0x58d659){if(_0x58d659){return _0x58d659[_0xb964('0x1b')](_0x40cea1)[_0xb964('0x9')](function(_0x3416cc){return _0x3416cc;});}return null;};}function removeEntity(_0x241fed){return function(_0x5a464b){if(_0x5a464b){return _0x5a464b['destroy']()[_0xb964('0x9')](function(){_0x241fed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x356dbb){return function(_0x1668cc){if(!_0x1668cc){_0x356dbb[_0xb964('0x1c')](0x194);}return _0x1668cc;};}function handleError(_0x534a6c,_0x4aca80){_0x4aca80=_0x4aca80||0x1f4;return function(_0x5873f2){logger['error'](_0x5873f2[_0xb964('0x1d')]);if(_0x5873f2[_0xb964('0x1e')]){delete _0x5873f2[_0xb964('0x1e')];}_0x534a6c[_0xb964('0x13')](_0x4aca80)['send'](_0x5873f2);};}exports[_0xb964('0x1f')]=function(_0x4ad5a7,_0x2f1e3e){var _0x3b50df={},_0x269fd7={},_0x15af53={'count':0x0,'rows':[]};var _0x2dafd2=_['map'](db[_0xb964('0x20')][_0xb964('0x21')],function(_0x42504d){return{'name':_0x42504d[_0xb964('0x22')],'type':_0x42504d['type'][_0xb964('0x23')]};});_0x269fd7['model']=_['map'](_0x2dafd2,_0xb964('0x1e'));_0x269fd7['query']=_['keys'](_0x4ad5a7[_0xb964('0x24')]);_0x269fd7['filters']=_[_0xb964('0x25')](_0x269fd7[_0xb964('0x26')],_0x269fd7[_0xb964('0x24')]);_0x3b50df[_0xb964('0x27')]=_['intersection'](_0x269fd7['model'],qs[_0xb964('0x28')](_0x4ad5a7['query'][_0xb964('0x28')]));_0x3b50df['attributes']=_0x3b50df[_0xb964('0x27')][_0xb964('0x29')]?_0x3b50df[_0xb964('0x27')]:_0x269fd7[_0xb964('0x26')];if(!_0x4ad5a7[_0xb964('0x24')][_0xb964('0x2a')](_0xb964('0x2b'))){_0x3b50df[_0xb964('0x15')]=qs[_0xb964('0x15')](_0x4ad5a7[_0xb964('0x24')][_0xb964('0x15')]);_0x3b50df['offset']=qs[_0xb964('0x14')](_0x4ad5a7[_0xb964('0x24')][_0xb964('0x14')]);}_0x3b50df[_0xb964('0x2c')]=qs[_0xb964('0x2d')](_0x4ad5a7[_0xb964('0x24')]['sort']);_0x3b50df['where']=qs[_0xb964('0x2e')](_[_0xb964('0x2f')](_0x4ad5a7[_0xb964('0x24')],_0x269fd7[_0xb964('0x2e')]),_0x2dafd2);if(_0x4ad5a7[_0xb964('0x24')][_0xb964('0x30')]){_0x3b50df[_0xb964('0x31')]=_[_0xb964('0x32')](_0x3b50df[_0xb964('0x31')],{'$or':_[_0xb964('0x33')](_0x2dafd2,function(_0x228031){if(_0x228031['type']!==_0xb964('0x34')){var _0x2ef1ba={};_0x2ef1ba[_0x228031[_0xb964('0x1e')]]={'$like':'%'+_0x4ad5a7[_0xb964('0x24')]['filter']+'%'};return _0x2ef1ba;}})});}_0x3b50df=_['merge']({},_0x3b50df,_0x4ad5a7[_0xb964('0x35')]);var _0x2426b6={'where':_0x3b50df[_0xb964('0x31')]};return db[_0xb964('0x20')]['count'](_0x2426b6)['then'](function(_0x19ad69){_0x15af53[_0xb964('0x17')]=_0x19ad69;if(_0x4ad5a7[_0xb964('0x24')][_0xb964('0x36')]){_0x3b50df[_0xb964('0x37')]=[{'all':!![]}];}return db[_0xb964('0x20')]['findAll'](_0x3b50df);})[_0xb964('0x9')](function(_0x39e75e){_0x15af53['rows']=_0x39e75e;return _0x15af53;})[_0xb964('0x9')](respondWithFilteredResult(_0x2f1e3e,_0x3b50df))[_0xb964('0x12')](handleError(_0x2f1e3e,null));};exports['show']=function(_0x5cc67c,_0x59d27d){var _0x320bc1={'raw':!![],'where':{'id':_0x5cc67c[_0xb964('0x38')]['id']}},_0x12a83b={};_0x12a83b[_0xb964('0x26')]=_['keys'](db[_0xb964('0x20')]['rawAttributes']);_0x12a83b[_0xb964('0x24')]=_[_0xb964('0x39')](_0x5cc67c[_0xb964('0x24')]);_0x12a83b[_0xb964('0x2e')]=_['intersection'](_0x12a83b[_0xb964('0x26')],_0x12a83b[_0xb964('0x24')]);_0x320bc1[_0xb964('0x27')]=_[_0xb964('0x25')](_0x12a83b[_0xb964('0x26')],qs['fields'](_0x5cc67c[_0xb964('0x24')][_0xb964('0x28')]));_0x320bc1['attributes']=_0x320bc1[_0xb964('0x27')][_0xb964('0x29')]?_0x320bc1[_0xb964('0x27')]:_0x12a83b[_0xb964('0x26')];if(_0x5cc67c[_0xb964('0x24')][_0xb964('0x36')]){_0x320bc1[_0xb964('0x37')]=[{'all':!![]}];}_0x320bc1=_[_0xb964('0x32')]({},_0x320bc1,_0x5cc67c[_0xb964('0x35')]);return db['Network'][_0xb964('0x3a')](_0x320bc1)[_0xb964('0x9')](handleEntityNotFound(_0x59d27d,null))['then'](respondWithResult(_0x59d27d,null))[_0xb964('0x12')](handleError(_0x59d27d,null));};exports[_0xb964('0x3b')]=function(_0x4e0742,_0x21cff1){var _0x4efb60;return db[_0xb964('0x20')][_0xb964('0x3b')](_0x4e0742[_0xb964('0x3c')],{'raw':!![]})[_0xb964('0x9')](function(_0x2f890b){_0x4efb60=_0x2f890b;return db[_0xb964('0x20')][_0xb964('0x3d')]({'where':{'type':_0x4e0742[_0xb964('0x3c')][_0xb964('0x3e')]},'raw':!![]});})['then'](function(_0x460314){if(_0x4efb60[_0xb964('0x3e')]['toUpperCase']()=='STUN'){var _0x4fd675=fs[_0xb964('0x3f')](path[_0xb964('0x40')](config[_0xb964('0x41')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x5ecdba=ejs[_0xb964('0x42')](_0x4fd675,{'networks':_0x460314||[]});fs[_0xb964('0x43')](_0xb964('0x44'),_0x5ecdba);return respondWithRpcPromise('Reload',_0xb964('0x3b'),{'module':'res_stun_monitor.so'});}else if(_0x4efb60[_0xb964('0x3e')][_0xb964('0x45')]()==_0xb964('0x46')){var _0x1b76e8=fs['readFileSync'](path[_0xb964('0x40')](config[_0xb964('0x41')],_0xb964('0x47')),_0xb964('0x48'));var _0x478aa1=ejs[_0xb964('0x42')](_0x1b76e8,{'networks':_0x460314||[]});fs[_0xb964('0x43')](_0xb964('0x49'),_0x478aa1);return respondWithRpcPromise(_0xb964('0x4a'),_0xb964('0x3b'),{'module':_0xb964('0x4b')});}else{var _0x405f9d=fs[_0xb964('0x3f')](path[_0xb964('0x40')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0xf3dd9a=ejs['render'](_0x405f9d,{'networks':_0x460314||[]});fs[_0xb964('0x43')](util['format'](_0xb964('0x4c'),_0x4e0742[_0xb964('0x3c')][_0xb964('0x3e')]['toLowerCase']()),_0xf3dd9a);return respondWithRpcPromise(_0xb964('0x4a'),_0xb964('0x3b'),{'module':'chan_sip.so'});}})[_0xb964('0x9')](function(){return _0x4efb60;})[_0xb964('0x9')](respondWithResult(_0x21cff1,0xc9))[_0xb964('0x12')](handleError(_0x21cff1,null));};exports['update']=function(_0x246f87,_0x3d328d){var _0x59fd15;return db[_0xb964('0x20')][_0xb964('0x3a')]({'where':{'id':_0x246f87[_0xb964('0x38')]['id']}})[_0xb964('0x9')](handleEntityNotFound(_0x3d328d,null))[_0xb964('0x9')](saveUpdates(_0x246f87[_0xb964('0x3c')],null))[_0xb964('0x9')](function(_0x51e857){if(_0x51e857){_0x59fd15=_0x51e857;return db['Network'][_0xb964('0x3d')]({'where':{'type':_0x59fd15[_0xb964('0x3e')]},'raw':!![]});}return null;})['then'](function(_0x405a67){if(_0x59fd15[_0xb964('0x3e')][_0xb964('0x45')]()==_0xb964('0x4d')){var _0x5e14b5=fs[_0xb964('0x3f')](path[_0xb964('0x40')](config[_0xb964('0x41')],_0xb964('0x4e')),_0xb964('0x48'));var _0x4404df=ejs['render'](_0x5e14b5,{'networks':_0x405a67||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4404df);return respondWithRpcPromise(_0xb964('0x4a'),_0xb964('0x1b'),{'module':_0xb964('0x4b')});}else if(_0x59fd15['type'][_0xb964('0x45')]()==_0xb964('0x46')){var _0x2703a4=fs['readFileSync'](path[_0xb964('0x40')](config[_0xb964('0x41')],_0xb964('0x47')),'utf8');var _0x3eb832=ejs[_0xb964('0x42')](_0x2703a4,{'networks':_0x405a67||[]});fs[_0xb964('0x43')](_0xb964('0x49'),_0x3eb832);return respondWithRpcPromise('Reload',_0xb964('0x1b'),{'module':_0xb964('0x4b')});}else{var _0x1db14f=fs[_0xb964('0x3f')](path[_0xb964('0x40')](config[_0xb964('0x41')],_0xb964('0x4f')),_0xb964('0x48'));var _0x2147b9=ejs['render'](_0x1db14f,{'networks':_0x405a67||[]});fs[_0xb964('0x43')](util[_0xb964('0x50')](_0xb964('0x4c'),_0x246f87[_0xb964('0x3c')]['type'][_0xb964('0x51')]()),_0x2147b9);return respondWithRpcPromise('Reload',_0xb964('0x1b'),{'module':_0xb964('0x52')});}})[_0xb964('0x9')](function(_0xa2678a){if(_0xa2678a){return _0x59fd15;}return null;})[_0xb964('0x9')](respondWithResult(_0x3d328d,null))[_0xb964('0x12')](handleError(_0x3d328d,null));};exports[_0xb964('0x53')]=function(_0x5e8acd,_0x293445){var _0x5bca91;return db['Network']['find']({'where':{'id':_0x5e8acd[_0xb964('0x38')]['id']}})[_0xb964('0x9')](function(_0x482ae1){_0x5bca91=_0x482ae1;return _0x482ae1;})[_0xb964('0x9')](handleEntityNotFound(_0x293445,null))['then'](removeEntity(_0x293445,null))[_0xb964('0x9')](function(){if(_0x5bca91){return db['Network'][_0xb964('0x3d')]({'where':{'type':_0x5bca91[_0xb964('0x3e')]},'raw':!![]});}})[_0xb964('0x9')](function(_0x58cdc1){if(_0x5bca91[_0xb964('0x3e')][_0xb964('0x45')]()=='STUN'){var _0x1f57bf=fs[_0xb964('0x3f')](path['join'](config[_0xb964('0x41')],_0xb964('0x4e')),_0xb964('0x48'));var _0x1fdaa3=ejs[_0xb964('0x42')](_0x1f57bf,{'networks':_0x58cdc1||[]});fs[_0xb964('0x43')](_0xb964('0x44'),_0x1fdaa3);return respondWithRpcPromise(_0xb964('0x4a'),_0xb964('0x53'),{'module':_0xb964('0x4b')});}else if(_0x5bca91[_0xb964('0x3e')][_0xb964('0x45')]()=='TURN'){var _0x4bf927=fs[_0xb964('0x3f')](path[_0xb964('0x40')](config[_0xb964('0x41')],_0xb964('0x47')),_0xb964('0x48'));var _0x20e558=ejs[_0xb964('0x42')](_0x4bf927,{'networks':_0x58cdc1||[]});fs[_0xb964('0x43')](_0xb964('0x49'),_0x20e558);return respondWithRpcPromise(_0xb964('0x4a'),_0xb964('0x53'),{'module':_0xb964('0x4b')});}else{var _0x85d9b8=fs[_0xb964('0x3f')](path[_0xb964('0x40')](config['root'],'server/files/templates/network.ejs'),_0xb964('0x48'));var _0xd56c59=ejs[_0xb964('0x42')](_0x85d9b8,{'networks':_0x58cdc1||[]});fs[_0xb964('0x43')](util[_0xb964('0x50')](_0xb964('0x4c'),_0x5bca91['type'][_0xb964('0x51')]()),_0xd56c59);return respondWithRpcPromise('Reload',_0xb964('0x53'),{'module':_0xb964('0x52')});}})[_0xb964('0x12')](handleError(_0x293445,null));}; \ No newline at end of file +var _0x541b=['sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','filters','catch','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','create','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','TURN','format','util','path','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','undefined','limit','count','offset','set','update','destroy','end','name','send','Network','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x1dc4cb,_0x36ea79){var _0x53052e=function(_0x2e3d96){while(--_0x2e3d96){_0x1dc4cb['push'](_0x1dc4cb['shift']());}};_0x53052e(++_0x36ea79);}(_0x541b,0x76));var _0xb541=function(_0x900a8d,_0x1f009a){_0x900a8d=_0x900a8d-0x0;var _0x5b80fc=_0x541b[_0x900a8d];return _0x5b80fc;};'use strict';var util=require(_0xb541('0x0'));var path=require(_0xb541('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0xb541('0x2'));var logger=require(_0xb541('0x3'))(_0xb541('0x4'));var config=require('../../config/environment');var db=require(_0xb541('0x5'))['db'];var jayson=require(_0xb541('0x6'));var client=jayson[_0xb541('0x7')][_0xb541('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x578045,_0x4c39aa,_0x5c86dc,_0x4d7b89){return new Promise(function(_0x2bfda7,_0x5c5be4){var _0x529a79=_0x4d7b89||client;return _0x529a79[_0xb541('0x9')](_0x578045,_0x5c86dc)[_0xb541('0xa')](function(_0x4b0c18){logger[_0xb541('0xb')](_0xb541('0xc'),_0x4c39aa,_0xb541('0xd'));logger[_0xb541('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x4c39aa,_0xb541('0xd'),JSON[_0xb541('0xf')](_0x4b0c18));if(_0x4b0c18['error']){if(_0x4b0c18[_0xb541('0x10')][_0xb541('0x11')]===0x1f4){logger[_0xb541('0x10')](_0xb541('0xc'),_0x4c39aa,_0x4b0c18[_0xb541('0x10')][_0xb541('0x12')]);return _0x5c5be4(_0x4b0c18[_0xb541('0x10')][_0xb541('0x12')]);}logger[_0xb541('0x10')](_0xb541('0xc'),_0x4c39aa,_0x4b0c18[_0xb541('0x10')][_0xb541('0x12')]);return _0x2bfda7(_0x4b0c18[_0xb541('0x10')][_0xb541('0x12')]);}else{logger[_0xb541('0xb')](_0xb541('0xc'),_0x4c39aa,'request\x20sent');_0x2bfda7(_0x4b0c18[_0xb541('0x13')][_0xb541('0x12')]);}})['catch'](function(_0x24eb24){logger[_0xb541('0x10')](_0xb541('0xc'),_0x4c39aa,_0x24eb24);_0x5c5be4(_0x24eb24);});});}function respondWithResult(_0x277902,_0x2813aa){_0x2813aa=_0x2813aa||0xc8;return function(_0x5858db){if(_0x5858db){return _0x277902[_0xb541('0x14')](_0x2813aa)[_0xb541('0x15')](_0x5858db);}};}function respondWithFilteredResult(_0x35a83f,_0x3be0f7){return function(_0x1e12bd){if(_0x1e12bd){var _0xc3042b=typeof _0x3be0f7['offset']===_0xb541('0x16')&&typeof _0x3be0f7[_0xb541('0x17')]===_0xb541('0x16');var _0x4f7e87=_0x1e12bd[_0xb541('0x18')];var _0x42e872=_0xc3042b?0x0:_0x3be0f7['offset'];var _0x17d23f=_0xc3042b?_0x1e12bd[_0xb541('0x18')]:_0x3be0f7[_0xb541('0x19')]+_0x3be0f7['limit'];var _0xdf72c3;if(_0x17d23f>=_0x4f7e87){_0x17d23f=_0x4f7e87;_0xdf72c3=0xc8;}else{_0xdf72c3=0xce;}_0x35a83f[_0xb541('0x14')](_0xdf72c3);return _0x35a83f[_0xb541('0x1a')]('Content-Range',_0x42e872+'-'+_0x17d23f+'/'+_0x4f7e87)[_0xb541('0x15')](_0x1e12bd);}return null;};}function saveUpdates(_0x249652){return function(_0x27af37){if(_0x27af37){return _0x27af37[_0xb541('0x1b')](_0x249652)[_0xb541('0xa')](function(_0x25ec40){return _0x25ec40;});}return null;};}function removeEntity(_0x1c3992){return function(_0x4ea1e2){if(_0x4ea1e2){return _0x4ea1e2[_0xb541('0x1c')]()[_0xb541('0xa')](function(){_0x1c3992[_0xb541('0x14')](0xcc)[_0xb541('0x1d')]();});}};}function handleEntityNotFound(_0x56a51a){return function(_0x1d726b){if(!_0x1d726b){_0x56a51a['sendStatus'](0x194);}return _0x1d726b;};}function handleError(_0xed0db6,_0x3ef2de){_0x3ef2de=_0x3ef2de||0x1f4;return function(_0x4161e9){logger['error'](_0x4161e9['stack']);if(_0x4161e9[_0xb541('0x1e')]){delete _0x4161e9['name'];}_0xed0db6['status'](_0x3ef2de)[_0xb541('0x1f')](_0x4161e9);};}exports['index']=function(_0x3e5f53,_0x2db3fe){var _0x2d952a={},_0x1fdf5d={},_0x1b6fa4={'count':0x0,'rows':[]};var _0x180e89=_['map'](db[_0xb541('0x20')][_0xb541('0x21')],function(_0x2e6ec6){return{'name':_0x2e6ec6[_0xb541('0x22')],'type':_0x2e6ec6[_0xb541('0x23')]['key']};});_0x1fdf5d[_0xb541('0x24')]=_[_0xb541('0x25')](_0x180e89,_0xb541('0x1e'));_0x1fdf5d[_0xb541('0x26')]=_[_0xb541('0x27')](_0x3e5f53[_0xb541('0x26')]);_0x1fdf5d['filters']=_[_0xb541('0x28')](_0x1fdf5d[_0xb541('0x24')],_0x1fdf5d[_0xb541('0x26')]);_0x2d952a['attributes']=_[_0xb541('0x28')](_0x1fdf5d[_0xb541('0x24')],qs[_0xb541('0x29')](_0x3e5f53[_0xb541('0x26')][_0xb541('0x29')]));_0x2d952a[_0xb541('0x2a')]=_0x2d952a['attributes'][_0xb541('0x2b')]?_0x2d952a['attributes']:_0x1fdf5d['model'];if(!_0x3e5f53[_0xb541('0x26')][_0xb541('0x2c')]('nolimit')){_0x2d952a[_0xb541('0x17')]=qs[_0xb541('0x17')](_0x3e5f53[_0xb541('0x26')][_0xb541('0x17')]);_0x2d952a[_0xb541('0x19')]=qs[_0xb541('0x19')](_0x3e5f53[_0xb541('0x26')][_0xb541('0x19')]);}_0x2d952a[_0xb541('0x2d')]=qs['sort'](_0x3e5f53[_0xb541('0x26')][_0xb541('0x2e')]);_0x2d952a[_0xb541('0x2f')]=qs['filters'](_['pick'](_0x3e5f53[_0xb541('0x26')],_0x1fdf5d['filters']),_0x180e89);if(_0x3e5f53['query'][_0xb541('0x30')]){_0x2d952a[_0xb541('0x2f')]=_[_0xb541('0x31')](_0x2d952a[_0xb541('0x2f')],{'$or':_[_0xb541('0x25')](_0x180e89,function(_0x26e5b9){if(_0x26e5b9[_0xb541('0x23')]!=='VIRTUAL'){var _0x418d55={};_0x418d55[_0x26e5b9[_0xb541('0x1e')]]={'$like':'%'+_0x3e5f53[_0xb541('0x26')][_0xb541('0x30')]+'%'};return _0x418d55;}})});}_0x2d952a=_[_0xb541('0x31')]({},_0x2d952a,_0x3e5f53[_0xb541('0x32')]);var _0x4158bc={'where':_0x2d952a[_0xb541('0x2f')]};return db[_0xb541('0x20')][_0xb541('0x18')](_0x4158bc)[_0xb541('0xa')](function(_0x3bf620){_0x1b6fa4[_0xb541('0x18')]=_0x3bf620;if(_0x3e5f53[_0xb541('0x26')][_0xb541('0x33')]){_0x2d952a[_0xb541('0x34')]=[{'all':!![]}];}return db[_0xb541('0x20')][_0xb541('0x35')](_0x2d952a);})[_0xb541('0xa')](function(_0x41cd60){_0x1b6fa4[_0xb541('0x36')]=_0x41cd60;return _0x1b6fa4;})[_0xb541('0xa')](respondWithFilteredResult(_0x2db3fe,_0x2d952a))['catch'](handleError(_0x2db3fe,null));};exports[_0xb541('0x37')]=function(_0x158bb7,_0x202032){var _0x49ac19={'raw':!![],'where':{'id':_0x158bb7[_0xb541('0x38')]['id']}},_0x1bb23f={};_0x1bb23f[_0xb541('0x24')]=_['keys'](db['Network'][_0xb541('0x21')]);_0x1bb23f['query']=_[_0xb541('0x27')](_0x158bb7['query']);_0x1bb23f[_0xb541('0x39')]=_[_0xb541('0x28')](_0x1bb23f[_0xb541('0x24')],_0x1bb23f[_0xb541('0x26')]);_0x49ac19[_0xb541('0x2a')]=_[_0xb541('0x28')](_0x1bb23f[_0xb541('0x24')],qs[_0xb541('0x29')](_0x158bb7[_0xb541('0x26')]['fields']));_0x49ac19[_0xb541('0x2a')]=_0x49ac19[_0xb541('0x2a')][_0xb541('0x2b')]?_0x49ac19[_0xb541('0x2a')]:_0x1bb23f[_0xb541('0x24')];if(_0x158bb7['query'][_0xb541('0x33')]){_0x49ac19['include']=[{'all':!![]}];}_0x49ac19=_[_0xb541('0x31')]({},_0x49ac19,_0x158bb7[_0xb541('0x32')]);return db[_0xb541('0x20')]['find'](_0x49ac19)[_0xb541('0xa')](handleEntityNotFound(_0x202032,null))[_0xb541('0xa')](respondWithResult(_0x202032,null))[_0xb541('0x3a')](handleError(_0x202032,null));};exports['create']=function(_0x14227d,_0x4b5a6b){var _0x57a602;return db[_0xb541('0x20')]['create'](_0x14227d[_0xb541('0x3b')],{'raw':!![]})['then'](function(_0x52fad5){_0x57a602=_0x52fad5;return db['Network']['findAll']({'where':{'type':_0x14227d[_0xb541('0x3b')][_0xb541('0x23')]},'raw':!![]});})[_0xb541('0xa')](function(_0x3d82a0){if(_0x57a602['type'][_0xb541('0x3c')]()==_0xb541('0x3d')){var _0x546626=fs[_0xb541('0x3e')](path[_0xb541('0x3f')](config[_0xb541('0x40')],_0xb541('0x41')),_0xb541('0x42'));var _0x5b62da=ejs[_0xb541('0x43')](_0x546626,{'networks':_0x3d82a0||[]});fs['writeFileSync'](_0xb541('0x44'),_0x5b62da);return respondWithRpcPromise('Reload','create',{'module':_0xb541('0x45')});}else if(_0x57a602['type'][_0xb541('0x3c')]()=='TURN'){var _0x42c7ff=fs['readFileSync'](path[_0xb541('0x3f')](config[_0xb541('0x40')],_0xb541('0x46')),_0xb541('0x42'));var _0x1b2c04=ejs[_0xb541('0x43')](_0x42c7ff,{'networks':_0x3d82a0||[]});fs[_0xb541('0x47')](_0xb541('0x48'),_0x1b2c04);return respondWithRpcPromise(_0xb541('0x49'),_0xb541('0x4a'),{'module':_0xb541('0x45')});}else{var _0x11b0e2=fs[_0xb541('0x3e')](path[_0xb541('0x3f')](config[_0xb541('0x40')],_0xb541('0x4b')),_0xb541('0x42'));var _0x2505d3=ejs[_0xb541('0x43')](_0x11b0e2,{'networks':_0x3d82a0||[]});fs['writeFileSync'](util['format'](_0xb541('0x4c'),_0x14227d['body'][_0xb541('0x23')][_0xb541('0x4d')]()),_0x2505d3);return respondWithRpcPromise(_0xb541('0x49'),'create',{'module':_0xb541('0x4e')});}})['then'](function(){return _0x57a602;})['then'](respondWithResult(_0x4b5a6b,0xc9))['catch'](handleError(_0x4b5a6b,null));};exports['update']=function(_0x55f04e,_0x1d2b80){var _0x264da3;return db[_0xb541('0x20')][_0xb541('0x4f')]({'where':{'id':_0x55f04e[_0xb541('0x38')]['id']}})[_0xb541('0xa')](handleEntityNotFound(_0x1d2b80,null))[_0xb541('0xa')](saveUpdates(_0x55f04e['body'],null))['then'](function(_0x59c7cc){if(_0x59c7cc){_0x264da3=_0x59c7cc;return db['Network']['findAll']({'where':{'type':_0x264da3['type']},'raw':!![]});}return null;})[_0xb541('0xa')](function(_0x4b1dc3){if(_0x264da3[_0xb541('0x23')][_0xb541('0x3c')]()==_0xb541('0x3d')){var _0x479ad8=fs[_0xb541('0x3e')](path[_0xb541('0x3f')](config[_0xb541('0x40')],_0xb541('0x41')),_0xb541('0x42'));var _0x3c5c8e=ejs[_0xb541('0x43')](_0x479ad8,{'networks':_0x4b1dc3||[]});fs[_0xb541('0x47')](_0xb541('0x44'),_0x3c5c8e);return respondWithRpcPromise('Reload','update',{'module':_0xb541('0x45')});}else if(_0x264da3[_0xb541('0x23')][_0xb541('0x3c')]()==_0xb541('0x50')){var _0x17d0f1=fs['readFileSync'](path[_0xb541('0x3f')](config[_0xb541('0x40')],_0xb541('0x46')),_0xb541('0x42'));var _0x31b87f=ejs[_0xb541('0x43')](_0x17d0f1,{'networks':_0x4b1dc3||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x31b87f);return respondWithRpcPromise('Reload',_0xb541('0x1b'),{'module':_0xb541('0x45')});}else{var _0x58670b=fs[_0xb541('0x3e')](path['join'](config[_0xb541('0x40')],_0xb541('0x4b')),_0xb541('0x42'));var _0x67df07=ejs[_0xb541('0x43')](_0x58670b,{'networks':_0x4b1dc3||[]});fs[_0xb541('0x47')](util[_0xb541('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x55f04e[_0xb541('0x3b')][_0xb541('0x23')][_0xb541('0x4d')]()),_0x67df07);return respondWithRpcPromise('Reload',_0xb541('0x1b'),{'module':'chan_sip.so'});}})[_0xb541('0xa')](function(_0x1e8e3c){if(_0x1e8e3c){return _0x264da3;}return null;})[_0xb541('0xa')](respondWithResult(_0x1d2b80,null))[_0xb541('0x3a')](handleError(_0x1d2b80,null));};exports[_0xb541('0x1c')]=function(_0x58562e,_0x3b1a19){var _0x1fbd6f;return db[_0xb541('0x20')][_0xb541('0x4f')]({'where':{'id':_0x58562e[_0xb541('0x38')]['id']}})['then'](function(_0x51a88e){_0x1fbd6f=_0x51a88e;return _0x51a88e;})[_0xb541('0xa')](handleEntityNotFound(_0x3b1a19,null))['then'](removeEntity(_0x3b1a19,null))[_0xb541('0xa')](function(){if(_0x1fbd6f){return db[_0xb541('0x20')]['findAll']({'where':{'type':_0x1fbd6f[_0xb541('0x23')]},'raw':!![]});}})[_0xb541('0xa')](function(_0xfb59b0){if(_0x1fbd6f['type'][_0xb541('0x3c')]()==_0xb541('0x3d')){var _0x5f45a4=fs[_0xb541('0x3e')](path[_0xb541('0x3f')](config[_0xb541('0x40')],_0xb541('0x41')),_0xb541('0x42'));var _0x38e8a7=ejs['render'](_0x5f45a4,{'networks':_0xfb59b0||[]});fs['writeFileSync'](_0xb541('0x44'),_0x38e8a7);return respondWithRpcPromise(_0xb541('0x49'),'destroy',{'module':_0xb541('0x45')});}else if(_0x1fbd6f[_0xb541('0x23')]['toUpperCase']()==_0xb541('0x50')){var _0xa66bbc=fs[_0xb541('0x3e')](path[_0xb541('0x3f')](config[_0xb541('0x40')],'server/files/templates/turn_multiple.ejs'),_0xb541('0x42'));var _0x2a9042=ejs['render'](_0xa66bbc,{'networks':_0xfb59b0||[]});fs[_0xb541('0x47')](_0xb541('0x48'),_0x2a9042);return respondWithRpcPromise(_0xb541('0x49'),_0xb541('0x1c'),{'module':_0xb541('0x45')});}else{var _0x430b8d=fs[_0xb541('0x3e')](path[_0xb541('0x3f')](config[_0xb541('0x40')],_0xb541('0x4b')),_0xb541('0x42'));var _0x6f362f=ejs['render'](_0x430b8d,{'networks':_0xfb59b0||[]});fs[_0xb541('0x47')](util[_0xb541('0x51')](_0xb541('0x4c'),_0x1fbd6f[_0xb541('0x23')]['toLowerCase']()),_0x6f362f);return respondWithRpcPromise(_0xb541('0x49'),'destroy',{'module':_0xb541('0x4e')});}})['catch'](handleError(_0x3b1a19,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 0aaecb8..d8339fb 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 _0x39cb=['network','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','define','Network'];(function(_0x555d95,_0x313355){var _0x362fe2=function(_0x48b837){while(--_0x48b837){_0x555d95['push'](_0x555d95['shift']());}};_0x362fe2(++_0x313355);}(_0x39cb,0x1bd));var _0xb39c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39cb[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var logger=require(_0xb39c('0x1'))('api');var moment=require(_0xb39c('0x2'));var BPromise=require(_0xb39c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb39c('0x4'));var rimraf=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var attributes=require(_0xb39c('0x7'));module[_0xb39c('0x8')]=function(_0x4ae4cf,_0x32cdcd){return _0x4ae4cf[_0xb39c('0x9')](_0xb39c('0xa'),attributes,{'tableName':_0xb39c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d2=['api','moment','bluebird','request-promise','path','rimraf','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger'];(function(_0x398140,_0x55b247){var _0x39f02f=function(_0x51b5c3){while(--_0x51b5c3){_0x398140['push'](_0x398140['shift']());}};_0x39f02f(++_0x55b247);}(_0x16d2,0x123));var _0x216d=function(_0x469492,_0x20cd06){_0x469492=_0x469492-0x0;var _0x2bf499=_0x16d2[_0x469492];return _0x2bf499;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var logger=require(_0x216d('0x2'))(_0x216d('0x3'));var moment=require(_0x216d('0x4'));var BPromise=require(_0x216d('0x5'));var rp=require(_0x216d('0x6'));var fs=require('fs');var path=require(_0x216d('0x7'));var rimraf=require(_0x216d('0x8'));var config=require('../../config/environment');var attributes=require(_0x216d('0x9'));module[_0x216d('0xa')]=function(_0xef687c,_0x205101){return _0xef687c[_0x216d('0xb')](_0x216d('0xc'),attributes,{'tableName':_0x216d('0xd'),'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 f44ff68..1a02cee 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0xc9d894,_0x31eb01){_0xc9d894=_0xc9d894-0x0;var _0x2d525b=_0x7a54[_0xc9d894];return _0x2d525b;};'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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7494a0,_0x585313){var _0x2430ff=function(_0x128cdb){while(--_0x128cdb){_0x7494a0['push'](_0x7494a0['shift']());}};_0x2430ff(++_0x585313);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 319d986..d2b8c10 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 _0x9ce6=['/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions'];(function(_0xf268c9,_0x5c01cf){var _0x54551b=function(_0x8d2407){while(--_0x8d2407){_0xf268c9['push'](_0xf268c9['shift']());}};_0x54551b(++_0x5c01cf);}(_0x9ce6,0x1e8));var _0x69ce=function(_0x3303c0,_0x1eaa43){_0x3303c0=_0x3303c0-0x0;var _0x454848=_0x9ce6[_0x3303c0];return _0x454848;};'use strict';var multer=require(_0x69ce('0x0'));var util=require(_0x69ce('0x1'));var path=require(_0x69ce('0x2'));var timeout=require(_0x69ce('0x3'));var express=require(_0x69ce('0x4'));var router=express[_0x69ce('0x5')]();var fs_extra=require(_0x69ce('0x6'));var auth=require(_0x69ce('0x7'));var interaction=require(_0x69ce('0x8'));var config=require(_0x69ce('0x9'));var controller=require(_0x69ce('0xa'));router[_0x69ce('0xb')]('/',auth['isAuthenticated'](),controller[_0x69ce('0xc')]);router[_0x69ce('0xb')](_0x69ce('0xd'),auth[_0x69ce('0xe')](),controller['describe']);router[_0x69ce('0xb')](_0x69ce('0xf'),auth['isAuthenticated'](),controller[_0x69ce('0x10')]);router[_0x69ce('0xb')](_0x69ce('0x11'),auth[_0x69ce('0xe')](),controller[_0x69ce('0x12')]);router[_0x69ce('0xb')](_0x69ce('0x13'),auth['isAuthenticated'](),controller[_0x69ce('0x14')]);router[_0x69ce('0xb')](_0x69ce('0x15'),auth[_0x69ce('0xe')](),controller[_0x69ce('0x16')]);router[_0x69ce('0xb')](_0x69ce('0x17'),auth['isAuthenticated'](),controller[_0x69ce('0x18')]);router[_0x69ce('0xb')](_0x69ce('0x19'),auth['isAuthenticated'](),controller[_0x69ce('0x1a')]);router[_0x69ce('0x1b')]('/',auth['isAuthenticated'](),controller['create']);router[_0x69ce('0x1b')]('/:id/dispositions',auth[_0x69ce('0xe')](),controller[_0x69ce('0x1c')]);router['post'](_0x69ce('0x13'),auth[_0x69ce('0xe')](),controller[_0x69ce('0x1d')]);router[_0x69ce('0x1b')](_0x69ce('0x1e'),controller[_0x69ce('0x1f')]);router[_0x69ce('0x1b')](_0x69ce('0x15'),auth[_0x69ce('0xe')](),controller[_0x69ce('0x20')]);router[_0x69ce('0x1b')](_0x69ce('0x19'),auth[_0x69ce('0xe')](),controller[_0x69ce('0x21')]);router['post']('/:id/send',auth[_0x69ce('0xe')](),controller[_0x69ce('0x22')]);router[_0x69ce('0x23')](_0x69ce('0xf'),auth[_0x69ce('0xe')](),controller[_0x69ce('0x24')]);router[_0x69ce('0x25')]('/:id',auth[_0x69ce('0xe')](),controller[_0x69ce('0x26')]);router[_0x69ce('0x25')](_0x69ce('0x11'),auth[_0x69ce('0xe')](),controller['removeDispositions']);router[_0x69ce('0x25')]('/:id/canned_answers',auth[_0x69ce('0xe')](),controller['removeAnswers']);router[_0x69ce('0x25')]('/:id/users',auth[_0x69ce('0xe')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x8c33=['post','create','addDisposition','addAnswer','/:id/notify','addAgents','send','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users'];(function(_0xbcdbae,_0x6510c2){var _0x3c879b=function(_0x56a279){while(--_0x56a279){_0xbcdbae['push'](_0xbcdbae['shift']());}};_0x3c879b(++_0x6510c2);}(_0x8c33,0xc6));var _0x38c3=function(_0x29f7d3,_0x1fc169){_0x29f7d3=_0x29f7d3-0x0;var _0x236b96=_0x8c33[_0x29f7d3];return _0x236b96;};'use strict';var multer=require(_0x38c3('0x0'));var util=require(_0x38c3('0x1'));var path=require(_0x38c3('0x2'));var timeout=require(_0x38c3('0x3'));var express=require('express');var router=express[_0x38c3('0x4')]();var fs_extra=require(_0x38c3('0x5'));var auth=require(_0x38c3('0x6'));var interaction=require(_0x38c3('0x7'));var config=require('../../config/environment');var controller=require(_0x38c3('0x8'));router[_0x38c3('0x9')]('/',auth[_0x38c3('0xa')](),controller[_0x38c3('0xb')]);router[_0x38c3('0x9')](_0x38c3('0xc'),auth['isAuthenticated'](),controller[_0x38c3('0xd')]);router['get'](_0x38c3('0xe'),auth[_0x38c3('0xa')](),controller['show']);router[_0x38c3('0x9')](_0x38c3('0xf'),auth[_0x38c3('0xa')](),controller[_0x38c3('0x10')]);router[_0x38c3('0x9')](_0x38c3('0x11'),auth[_0x38c3('0xa')](),controller[_0x38c3('0x12')]);router[_0x38c3('0x9')](_0x38c3('0x13'),auth[_0x38c3('0xa')](),controller[_0x38c3('0x14')]);router[_0x38c3('0x9')](_0x38c3('0x15'),auth[_0x38c3('0xa')](),controller[_0x38c3('0x16')]);router[_0x38c3('0x9')](_0x38c3('0x17'),auth[_0x38c3('0xa')](),controller['getAgents']);router[_0x38c3('0x18')]('/',auth[_0x38c3('0xa')](),controller[_0x38c3('0x19')]);router[_0x38c3('0x18')](_0x38c3('0xf'),auth[_0x38c3('0xa')](),controller[_0x38c3('0x1a')]);router[_0x38c3('0x18')]('/:id/canned_answers',auth[_0x38c3('0xa')](),controller[_0x38c3('0x1b')]);router[_0x38c3('0x18')](_0x38c3('0x1c'),controller['notify']);router[_0x38c3('0x18')](_0x38c3('0x13'),auth[_0x38c3('0xa')](),controller['addApplications']);router[_0x38c3('0x18')](_0x38c3('0x17'),auth['isAuthenticated'](),controller[_0x38c3('0x1d')]);router[_0x38c3('0x18')]('/:id/send',auth[_0x38c3('0xa')](),controller[_0x38c3('0x1e')]);router[_0x38c3('0x1f')](_0x38c3('0xe'),auth[_0x38c3('0xa')](),controller['update']);router[_0x38c3('0x20')](_0x38c3('0xe'),auth[_0x38c3('0xa')](),controller[_0x38c3('0x21')]);router['delete']('/:id/dispositions',auth[_0x38c3('0xa')](),controller[_0x38c3('0x22')]);router['delete'](_0x38c3('0x11'),auth[_0x38c3('0xa')](),controller['removeAnswers']);router[_0x38c3('0x20')](_0x38c3('0x17'),auth[_0x38c3('0xa')](),controller[_0x38c3('0x23')]);module[_0x38c3('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 848fd66..8b9268b 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 _0xdb14=['randomstring','exports','STRING','generate','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x261191,_0x4589a5){var _0x2345d1=function(_0x172619){while(--_0x172619){_0x261191['push'](_0x261191['shift']());}};_0x2345d1(++_0x4589a5);}(_0xdb14,0xbd));var _0x4db1=function(_0x549955,_0x176769){_0x549955=_0x549955-0x0;var _0x4f3213=_0xdb14[_0x549955];return _0x4f3213;};'use strict';var Sequelize=require(_0x4db1('0x0'));var rs=require(_0x4db1('0x1'));module[_0x4db1('0x2')]={'name':{'type':Sequelize[_0x4db1('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x4db1('0x3')]},'token':{'type':Sequelize[_0x4db1('0x3')],'defaultValue':function(){return rs[_0x4db1('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x4db1('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4db1('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4db1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x4db1('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4db1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4db1('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4db1('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4db1('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x28bcd7){if(!_0x28bcd7)this[_0x4db1('0x7')](_0x4db1('0x8'),null);this[_0x4db1('0x7')](_0x4db1('0x9'),_0x28bcd7);}}}; \ No newline at end of file +var _0x24de=['generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','STRING'];(function(_0x2c2134,_0x40ab33){var _0x270ee0=function(_0xd2668e){while(--_0xd2668e){_0x2c2134['push'](_0x2c2134['shift']());}};_0x270ee0(++_0x40ab33);}(_0x24de,0xed));var _0xe24d=function(_0x21337b,_0x1a24d5){_0x21337b=_0x21337b-0x0;var _0x26bec3=_0x24de[_0x21337b];return _0x26bec3;};'use strict';var Sequelize=require(_0xe24d('0x0'));var rs=require(_0xe24d('0x1'));module['exports']={'name':{'type':Sequelize[_0xe24d('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe24d('0x2')]},'token':{'type':Sequelize[_0xe24d('0x2')],'defaultValue':function(){return rs[_0xe24d('0x3')]();}},'replyUri':{'type':Sequelize[_0xe24d('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe24d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe24d('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe24d('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe24d('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe24d('0x2')]},'queueTransfer':{'type':Sequelize[_0xe24d('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe24d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe24d('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe24d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe24d('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe24d('0x7'),'set':function(_0x38ebee){if(!_0x38ebee)this['setDataValue'](_0xe24d('0x8'),null);this[_0xe24d('0x9')]('mandatoryDisposition',_0x38ebee);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6bd9c6d..0ae7828 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 _0x3378=['Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','get','OpenchannelAccounts','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','includeAll','create','body','user','role','find','userProfileId','autoAssociation','UserProfileResource','update','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','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','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','priority','from','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','internal','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','out'];(function(_0x2d6c83,_0x52c3e2){var _0x508c40=function(_0x580069){while(--_0x580069){_0x2d6c83['push'](_0x2d6c83['shift']());}};_0x508c40(++_0x52c3e2);}(_0x3378,0xc2));var _0x8337=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x3378[_0x1b3a5c];return _0x2ae8cb;};'use strict';var emlformat=require(_0x8337('0x0'));var rimraf=require(_0x8337('0x1'));var zipdir=require(_0x8337('0x2'));var jsonpatch=require(_0x8337('0x3'));var rp=require(_0x8337('0x4'));var moment=require(_0x8337('0x5'));var BPromise=require(_0x8337('0x6'));var Mustache=require(_0x8337('0x7'));var util=require(_0x8337('0x8'));var path=require(_0x8337('0x9'));var sox=require(_0x8337('0xa'));var csv=require(_0x8337('0xb'));var ejs=require(_0x8337('0xc'));var fs=require('fs');var fs_extra=require(_0x8337('0xd'));var _=require(_0x8337('0xe'));var squel=require(_0x8337('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8337('0xb'));var querystring=require('querystring');var Papa=require(_0x8337('0x10'));var Redis=require('ioredis');var authService=require(_0x8337('0x11'));var qs=require(_0x8337('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8337('0x13'));var logger=require(_0x8337('0x14'))(_0x8337('0x15'));var utils=require(_0x8337('0x16'));var config=require(_0x8337('0x17'));var licenseUtil=require(_0x8337('0x18'));var db=require(_0x8337('0x19'))['db'];config[_0x8337('0x1a')]=_[_0x8337('0x1b')](config[_0x8337('0x1a')],{'host':_0x8337('0x1c'),'port':0x18eb});var socket=require(_0x8337('0x1d'))(new Redis(config[_0x8337('0x1a')]));require(_0x8337('0x1e'))[_0x8337('0x1f')](socket);var jayson=require(_0x8337('0x20'));var client=jayson['client'][_0x8337('0x21')]({'port':0x232c});var client9002=jayson[_0x8337('0x22')][_0x8337('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x384d23,_0x32c858,_0x3e34ba,_0x53b6c5){return new BPromise(function(_0x42bdf0,_0x2ff9bb){var _0x4ceae0=_0x53b6c5||client;return _0x4ceae0['request'](_0x384d23,_0x3e34ba)[_0x8337('0x23')](function(_0x260104){logger[_0x8337('0x24')](_0x8337('0x25'),_0x32c858,_0x8337('0x26'));logger['debug'](_0x8337('0x27'),_0x32c858,_0x8337('0x26'),JSON[_0x8337('0x28')](_0x260104));if(_0x260104[_0x8337('0x29')]){if(_0x260104['error'][_0x8337('0x2a')]===0x1f4){logger[_0x8337('0x29')](_0x8337('0x25'),_0x32c858,_0x260104[_0x8337('0x29')][_0x8337('0x2b')]);return _0x2ff9bb(_0x260104[_0x8337('0x29')][_0x8337('0x2b')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x32c858,_0x260104['error'][_0x8337('0x2b')]);return _0x42bdf0(_0x260104['error'][_0x8337('0x2b')]);}else{logger[_0x8337('0x24')](_0x8337('0x25'),_0x32c858,'request\x20sent');_0x42bdf0(_0x260104[_0x8337('0x2c')][_0x8337('0x2b')]);}})[_0x8337('0x2d')](function(_0x27e2df){logger[_0x8337('0x29')](_0x8337('0x25'),_0x32c858,_0x27e2df);_0x2ff9bb(_0x27e2df);});});}function respondWithStatusCode(_0x4f3d2d,_0x33fb86){_0x33fb86=_0x33fb86||0xcc;return function(_0x34002f){if(_0x34002f){return _0x4f3d2d['sendStatus'](_0x33fb86);}return _0x4f3d2d[_0x8337('0x2e')](_0x33fb86)['end']();};}function respondWithResult(_0x1f4335,_0x4e4cad){_0x4e4cad=_0x4e4cad||0xc8;return function(_0x1145c5){if(_0x1145c5){return _0x1f4335[_0x8337('0x2e')](_0x4e4cad)[_0x8337('0x2f')](_0x1145c5);}};}function respondWithFilteredResult(_0x312a55,_0x46f034){return function(_0x26d62a){if(_0x26d62a){var _0x5041e1=typeof _0x46f034[_0x8337('0x30')]===_0x8337('0x31')&&typeof _0x46f034[_0x8337('0x32')]===_0x8337('0x31');var _0x3ea04e=_0x26d62a['count'];var _0x295c95=_0x5041e1?0x0:_0x46f034[_0x8337('0x30')];var _0x255caa=_0x5041e1?_0x26d62a[_0x8337('0x33')]:_0x46f034[_0x8337('0x30')]+_0x46f034[_0x8337('0x32')];var _0x280f15;if(_0x255caa>=_0x3ea04e){_0x255caa=_0x3ea04e;_0x280f15=0xc8;}else{_0x280f15=0xce;}_0x312a55[_0x8337('0x2e')](_0x280f15);return _0x312a55[_0x8337('0x34')](_0x8337('0x35'),_0x295c95+'-'+_0x255caa+'/'+_0x3ea04e)[_0x8337('0x2f')](_0x26d62a);}return null;};}function patchUpdates(_0x445f13){return function(_0x269e29){try{jsonpatch[_0x8337('0x36')](_0x269e29,_0x445f13,!![]);}catch(_0x1b5d79){return BPromise[_0x8337('0x37')](_0x1b5d79);}return _0x269e29['save']();};}function saveUpdates(_0x1ac124,_0x59a6a0){return function(_0x2bfc79){if(_0x2bfc79){return _0x2bfc79['update'](_0x1ac124)[_0x8337('0x23')](function(_0x26daed){return _0x26daed;});}return null;};}function removeEntity(_0x47d659,_0x398371){return function(_0x4509da){if(_0x4509da){return _0x4509da[_0x8337('0x38')]()[_0x8337('0x23')](function(){var _0xeec2b8=_0x4509da[_0x8337('0x39')]({'plain':!![]});var _0x1d820d=_0x8337('0x3a');return db['UserProfileResource'][_0x8337('0x38')]({'where':{'type':_0x1d820d,'resourceId':_0xeec2b8['id']}})['then'](function(){return _0x4509da;});})['then'](function(){_0x47d659[_0x8337('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dbdde,_0x2f7135){return function(_0x1fc840){if(!_0x1fc840){_0x1dbdde[_0x8337('0x3b')](0x194);}return _0x1fc840;};}function handleError(_0x5b6581,_0x4c5c0d){_0x4c5c0d=_0x4c5c0d||0x1f4;return function(_0x12ff25){logger[_0x8337('0x29')](_0x12ff25[_0x8337('0x3c')]);if(_0x12ff25[_0x8337('0x3d')]){delete _0x12ff25[_0x8337('0x3d')];}_0x5b6581['status'](_0x4c5c0d)[_0x8337('0x3e')](_0x12ff25);};}exports[_0x8337('0x3f')]=function(_0x5150ae,_0x1f4e5f){var _0x61fd09={'include':[{'model':db[_0x8337('0x40')],'as':_0x8337('0x41')}]},_0xa9eb34={},_0x321f0a={'count':0x0,'rows':[]};var _0x21dcf5=_['map'](db[_0x8337('0x42')][_0x8337('0x43')],function(_0x2c2c5e){return{'name':_0x2c2c5e[_0x8337('0x44')],'type':_0x2c2c5e[_0x8337('0x45')][_0x8337('0x46')]};});_0xa9eb34[_0x8337('0x47')]=_['map'](_0x21dcf5,_0x8337('0x3d'));_0xa9eb34[_0x8337('0x48')]=_['keys'](_0x5150ae[_0x8337('0x48')]);_0xa9eb34[_0x8337('0x49')]=_['intersection'](_0xa9eb34[_0x8337('0x47')],_0xa9eb34[_0x8337('0x48')]);_0x61fd09['attributes']=_[_0x8337('0x4a')](_0xa9eb34['model'],qs[_0x8337('0x4b')](_0x5150ae[_0x8337('0x48')][_0x8337('0x4b')]));_0x61fd09[_0x8337('0x4c')]=_0x61fd09[_0x8337('0x4c')][_0x8337('0x4d')]?_0x61fd09[_0x8337('0x4c')]:_0xa9eb34[_0x8337('0x47')];if(!_0x5150ae['query'][_0x8337('0x4e')](_0x8337('0x4f'))){_0x61fd09['limit']=qs[_0x8337('0x32')](_0x5150ae['query'][_0x8337('0x32')]);_0x61fd09[_0x8337('0x30')]=qs[_0x8337('0x30')](_0x5150ae[_0x8337('0x48')][_0x8337('0x30')]);}_0x61fd09[_0x8337('0x50')]=qs[_0x8337('0x51')](_0x5150ae['query'][_0x8337('0x51')]);_0x61fd09[_0x8337('0x52')]=qs[_0x8337('0x49')](_[_0x8337('0x53')](_0x5150ae[_0x8337('0x48')],_0xa9eb34[_0x8337('0x49')]),_0x21dcf5);if(_0x5150ae[_0x8337('0x48')]['filter']){_0x61fd09[_0x8337('0x52')]=_[_0x8337('0x54')](_0x61fd09[_0x8337('0x52')],{'$or':_[_0x8337('0x55')](_0x21dcf5,function(_0x10b89a){if(_0x10b89a['type']!==_0x8337('0x56')){var _0x10d371={};_0x10d371[_0x10b89a['name']]={'$like':'%'+_0x5150ae[_0x8337('0x48')][_0x8337('0x57')]+'%'};return _0x10d371;}})});}_0x61fd09=_[_0x8337('0x54')]({},_0x61fd09,_0x5150ae[_0x8337('0x58')]);var _0x22cb4c={'where':_0x61fd09[_0x8337('0x52')]};return db[_0x8337('0x42')][_0x8337('0x33')](_0x22cb4c)[_0x8337('0x23')](function(_0x1e19a5){_0x321f0a[_0x8337('0x33')]=_0x1e19a5;if(_0x5150ae[_0x8337('0x48')]['includeAll']){_0x61fd09[_0x8337('0x59')]=[{'all':!![]}];}return db[_0x8337('0x42')][_0x8337('0x5a')](_0x61fd09);})['then'](function(_0x414ef1){_0x321f0a[_0x8337('0x5b')]=_0x414ef1;return _0x321f0a;})[_0x8337('0x23')](respondWithFilteredResult(_0x1f4e5f,_0x61fd09))[_0x8337('0x2d')](handleError(_0x1f4e5f,null));};exports[_0x8337('0x5c')]=function(_0x35ea28,_0x332387){var _0x40b914={'raw':![],'where':{'id':_0x35ea28[_0x8337('0x5d')]['id']},'include':[{'model':db[_0x8337('0x40')],'as':'mandatoryDispositionPause'}]},_0xbf8d3b={};_0xbf8d3b[_0x8337('0x47')]=_['keys'](db[_0x8337('0x42')][_0x8337('0x43')]);_0xbf8d3b[_0x8337('0x48')]=_[_0x8337('0x5e')](_0x35ea28[_0x8337('0x48')]);_0xbf8d3b[_0x8337('0x49')]=_[_0x8337('0x4a')](_0xbf8d3b['model'],_0xbf8d3b[_0x8337('0x48')]);_0x40b914[_0x8337('0x4c')]=_[_0x8337('0x4a')](_0xbf8d3b[_0x8337('0x47')],qs[_0x8337('0x4b')](_0x35ea28[_0x8337('0x48')][_0x8337('0x4b')]));_0x40b914[_0x8337('0x4c')]=_0x40b914['attributes'][_0x8337('0x4d')]?_0x40b914[_0x8337('0x4c')]:_0xbf8d3b[_0x8337('0x47')];if(_0x35ea28[_0x8337('0x48')][_0x8337('0x5f')]){_0x40b914[_0x8337('0x59')]=[{'all':!![]}];}_0x40b914=_[_0x8337('0x54')]({},_0x40b914,_0x35ea28[_0x8337('0x58')]);return db[_0x8337('0x42')]['find'](_0x40b914)['then'](handleEntityNotFound(_0x332387,null))[_0x8337('0x23')](respondWithResult(_0x332387,null))[_0x8337('0x2d')](handleError(_0x332387,null));};exports[_0x8337('0x60')]=function(_0x1b1fc2,_0x5dc293){return db[_0x8337('0x42')][_0x8337('0x60')](_0x1b1fc2[_0x8337('0x61')],{})[_0x8337('0x23')](function(_0x2e4fd4){var _0x40e377=_0x1b1fc2[_0x8337('0x62')][_0x8337('0x39')]({'plain':!![]});if(!_0x40e377)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40e377[_0x8337('0x63')]==='user'){var _0x463933=_0x2e4fd4[_0x8337('0x39')]({'plain':!![]});var _0x3a5827='OpenchannelAccounts';return db['UserProfileSection'][_0x8337('0x64')]({'where':{'name':_0x3a5827,'userProfileId':_0x40e377[_0x8337('0x65')]},'raw':!![]})[_0x8337('0x23')](function(_0x384b6){if(_0x384b6&&_0x384b6[_0x8337('0x66')]===0x0){return db[_0x8337('0x67')]['create']({'name':_0x463933['name'],'resourceId':_0x463933['id'],'type':_0x384b6[_0x8337('0x3d')],'sectionId':_0x384b6['id']},{})[_0x8337('0x23')](function(){return _0x2e4fd4;});}else{return _0x2e4fd4;}})['catch'](function(_0x1d4d0a){logger[_0x8337('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d4d0a);throw _0x1d4d0a;});}return _0x2e4fd4;})[_0x8337('0x23')](respondWithResult(_0x5dc293,0xc9))[_0x8337('0x2d')](handleError(_0x5dc293,null));};exports[_0x8337('0x68')]=function(_0x55466f,_0x1d36cd){if(_0x55466f[_0x8337('0x61')]['id']){delete _0x55466f[_0x8337('0x61')]['id'];}return db[_0x8337('0x42')][_0x8337('0x64')]({'where':{'id':_0x55466f[_0x8337('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x8337('0x41')}]})[_0x8337('0x23')](handleEntityNotFound(_0x1d36cd,null))[_0x8337('0x23')](saveUpdates(_0x55466f[_0x8337('0x61')],null))[_0x8337('0x23')](respondWithResult(_0x1d36cd,null))[_0x8337('0x2d')](handleError(_0x1d36cd,null));};exports[_0x8337('0x38')]=function(_0x571a53,_0xf29ce9){return db['OpenchannelAccount'][_0x8337('0x64')]({'where':{'id':_0x571a53['params']['id']}})[_0x8337('0x23')](handleEntityNotFound(_0xf29ce9,null))[_0x8337('0x23')](removeEntity(_0xf29ce9,null))[_0x8337('0x2d')](handleError(_0xf29ce9,null));};exports['describe']=function(_0x504751,_0x283387){return db['OpenchannelAccount'][_0x8337('0x69')]()[_0x8337('0x23')](respondWithResult(_0x283387,null))['catch'](handleError(_0x283387,null));};exports[_0x8337('0x6a')]=function(_0x2439fc,_0x36fd20,_0x439630){if(_0x2439fc[_0x8337('0x61')]['id']){delete _0x2439fc[_0x8337('0x61')]['id'];}return db[_0x8337('0x42')][_0x8337('0x64')]({'where':{'id':_0x2439fc[_0x8337('0x5d')]['id']}})['then'](handleEntityNotFound(_0x36fd20,null))[_0x8337('0x23')](function(_0x38e82d){if(_0x38e82d){_0x2439fc[_0x8337('0x61')]['OpenchannelAccountId']=_0x38e82d['id'];return db[_0x8337('0x6b')][_0x8337('0x60')](_0x2439fc['body']);}})[_0x8337('0x23')](respondWithResult(_0x36fd20,null))['catch'](handleError(_0x36fd20,null));};exports[_0x8337('0x6c')]=function(_0x6038a1,_0x37105d,_0x1bb066){var _0x142bea={'raw':![],'where':{}};var _0x36f829={};var _0x17a8be={'count':0x0,'rows':[]};return db[_0x8337('0x42')][_0x8337('0x6d')]({'where':{'id':_0x6038a1['params']['id']}})[_0x8337('0x23')](handleEntityNotFound(_0x37105d,null))[_0x8337('0x23')](function(_0x23921b){if(_0x23921b){_0x36f829[_0x8337('0x47')]=_[_0x8337('0x5e')](db[_0x8337('0x6b')][_0x8337('0x43')]);_0x36f829[_0x8337('0x48')]=_[_0x8337('0x5e')](_0x6038a1['query']);_0x36f829[_0x8337('0x49')]=_[_0x8337('0x4a')](_0x36f829[_0x8337('0x47')],_0x36f829[_0x8337('0x48')]);_0x142bea[_0x8337('0x4c')]=_[_0x8337('0x4a')](_0x36f829[_0x8337('0x47')],qs[_0x8337('0x4b')](_0x6038a1[_0x8337('0x48')][_0x8337('0x4b')]));_0x142bea['attributes']=_0x142bea[_0x8337('0x4c')][_0x8337('0x4d')]?_0x142bea[_0x8337('0x4c')]:_0x36f829[_0x8337('0x47')];if(!_0x6038a1[_0x8337('0x48')][_0x8337('0x4e')](_0x8337('0x4f'))){_0x142bea[_0x8337('0x32')]=qs[_0x8337('0x32')](_0x6038a1[_0x8337('0x48')][_0x8337('0x32')]);_0x142bea[_0x8337('0x30')]=qs[_0x8337('0x30')](_0x6038a1[_0x8337('0x48')][_0x8337('0x30')]);}_0x142bea[_0x8337('0x50')]=qs[_0x8337('0x51')](_0x6038a1[_0x8337('0x48')][_0x8337('0x51')]);_0x142bea[_0x8337('0x52')]=qs[_0x8337('0x49')](_[_0x8337('0x53')](_0x6038a1[_0x8337('0x48')],_0x36f829[_0x8337('0x49')]));_0x142bea[_0x8337('0x52')][_0x8337('0x6e')]=_0x23921b['id'];if(_0x6038a1[_0x8337('0x48')]['filter']){_0x142bea[_0x8337('0x52')]=_[_0x8337('0x54')](_0x142bea[_0x8337('0x52')],{'$or':_[_0x8337('0x55')](_0x142bea['attributes'],function(_0x4f25b6){var _0x2d52ab={};_0x2d52ab[_0x4f25b6]={'$like':'%'+_0x6038a1['query'][_0x8337('0x57')]+'%'};return _0x2d52ab;})});}_0x142bea=_[_0x8337('0x54')]({},_0x142bea,_0x6038a1[_0x8337('0x58')]);return db[_0x8337('0x6b')][_0x8337('0x33')]({'where':_0x142bea[_0x8337('0x52')]})[_0x8337('0x23')](function(_0x330f22){_0x17a8be[_0x8337('0x33')]=_0x330f22;if(_0x6038a1[_0x8337('0x48')]['includeAll']){_0x142bea['include']=[{'all':!![]}];}return db[_0x8337('0x6b')][_0x8337('0x5a')](_0x142bea);})['then'](function(_0x88e74d){_0x17a8be['rows']=_0x88e74d;return _0x17a8be;});}})[_0x8337('0x23')](respondWithFilteredResult(_0x37105d,_0x142bea))[_0x8337('0x2d')](handleError(_0x37105d,null));};exports[_0x8337('0x6f')]=function(_0x7db8b7,_0x5642e4,_0x19fb4e){return db[_0x8337('0x42')][_0x8337('0x64')]({'where':{'id':_0x7db8b7['params']['id']}})[_0x8337('0x23')](handleEntityNotFound(_0x5642e4,null))['then'](function(_0x5ad3e8){if(_0x5ad3e8){return _0x5ad3e8[_0x8337('0x6f')](_0x7db8b7[_0x8337('0x48')][_0x8337('0x70')]);}})[_0x8337('0x23')](respondWithStatusCode(_0x5642e4,null))[_0x8337('0x2d')](handleError(_0x5642e4,null));};exports[_0x8337('0x71')]=function(_0x851beb,_0x44696e,_0x3b151e){if(_0x851beb[_0x8337('0x61')]['id']){delete _0x851beb['body']['id'];}return db[_0x8337('0x42')][_0x8337('0x64')]({'where':{'id':_0x851beb['params']['id']}})[_0x8337('0x23')](handleEntityNotFound(_0x44696e,null))[_0x8337('0x23')](function(_0x372552){if(_0x372552){_0x851beb['body'][_0x8337('0x6e')]=_0x372552['id'];return db[_0x8337('0x72')][_0x8337('0x60')](_0x851beb[_0x8337('0x61')]);}})[_0x8337('0x23')](respondWithResult(_0x44696e,null))['catch'](handleError(_0x44696e,null));};exports[_0x8337('0x73')]=function(_0x289e4f,_0x411706,_0x259ad2){var _0x1fc9c5={'raw':![],'where':{}};var _0x5e88b1={};var _0x126fe4={'count':0x0,'rows':[]};return db[_0x8337('0x42')]['findOne']({'where':{'id':_0x289e4f[_0x8337('0x5d')]['id']}})[_0x8337('0x23')](handleEntityNotFound(_0x411706,null))[_0x8337('0x23')](function(_0x582f3b){if(_0x582f3b){_0x5e88b1[_0x8337('0x47')]=_[_0x8337('0x5e')](db['CannedAnswer'][_0x8337('0x43')]);_0x5e88b1['query']=_[_0x8337('0x5e')](_0x289e4f[_0x8337('0x48')]);_0x5e88b1[_0x8337('0x49')]=_[_0x8337('0x4a')](_0x5e88b1['model'],_0x5e88b1[_0x8337('0x48')]);_0x1fc9c5[_0x8337('0x4c')]=_[_0x8337('0x4a')](_0x5e88b1[_0x8337('0x47')],qs['fields'](_0x289e4f[_0x8337('0x48')]['fields']));_0x1fc9c5[_0x8337('0x4c')]=_0x1fc9c5['attributes']['length']?_0x1fc9c5['attributes']:_0x5e88b1[_0x8337('0x47')];if(!_0x289e4f[_0x8337('0x48')][_0x8337('0x4e')](_0x8337('0x4f'))){_0x1fc9c5[_0x8337('0x32')]=qs[_0x8337('0x32')](_0x289e4f[_0x8337('0x48')][_0x8337('0x32')]);_0x1fc9c5[_0x8337('0x30')]=qs[_0x8337('0x30')](_0x289e4f['query']['offset']);}_0x1fc9c5[_0x8337('0x50')]=qs['sort'](_0x289e4f[_0x8337('0x48')]['sort']);_0x1fc9c5['where']=qs['filters'](_['pick'](_0x289e4f[_0x8337('0x48')],_0x5e88b1[_0x8337('0x49')]));_0x1fc9c5[_0x8337('0x52')][_0x8337('0x6e')]=_0x582f3b['id'];if(_0x289e4f[_0x8337('0x48')]['filter']){_0x1fc9c5[_0x8337('0x52')]=_[_0x8337('0x54')](_0x1fc9c5[_0x8337('0x52')],{'$or':_[_0x8337('0x55')](_0x1fc9c5[_0x8337('0x4c')],function(_0x455ea5){var _0x3f3137={};_0x3f3137[_0x455ea5]={'$like':'%'+_0x289e4f[_0x8337('0x48')][_0x8337('0x57')]+'%'};return _0x3f3137;})});}_0x1fc9c5=_[_0x8337('0x54')]({},_0x1fc9c5,_0x289e4f[_0x8337('0x58')]);return db['CannedAnswer'][_0x8337('0x33')]({'where':_0x1fc9c5['where']})['then'](function(_0x409feb){_0x126fe4[_0x8337('0x33')]=_0x409feb;if(_0x289e4f[_0x8337('0x48')]['includeAll']){_0x1fc9c5[_0x8337('0x59')]=[{'all':!![]}];}return db[_0x8337('0x72')][_0x8337('0x5a')](_0x1fc9c5);})[_0x8337('0x23')](function(_0x53522b){_0x126fe4[_0x8337('0x5b')]=_0x53522b;return _0x126fe4;});}})[_0x8337('0x23')](respondWithFilteredResult(_0x411706,_0x1fc9c5))[_0x8337('0x2d')](handleError(_0x411706,null));};exports['removeAnswers']=function(_0x4f51a0,_0x7e4f5c,_0x3a8042){return db[_0x8337('0x42')]['find']({'where':{'id':_0x4f51a0['params']['id']}})[_0x8337('0x23')](handleEntityNotFound(_0x7e4f5c,null))['then'](function(_0x668142){if(_0x668142){return _0x668142[_0x8337('0x74')](_0x4f51a0[_0x8337('0x48')][_0x8337('0x70')]);}})['then'](respondWithStatusCode(_0x7e4f5c,null))[_0x8337('0x2d')](handleError(_0x7e4f5c,null));};exports[_0x8337('0x75')]=function(_0x53f8bf,_0x2499bb,_0x430d64){var _0x92f2ae={'body':_0x53f8bf[_0x8337('0x61')],'channel':_0x8337('0x76')};var _0x5b901c=[];var _0x4129b5=[];var _0x2f6860={};var _0x52c343=![];return db[_0x8337('0x77')]['describe']()[_0x8337('0x23')](function(_0x45d7a9){if(!_0x45d7a9){throw new db['Sequelize']['ValidationError'](_0x8337('0x78'));}_0x5b901c=_[_0x8337('0x79')](_[_0x8337('0x5e')](_0x45d7a9),[_0x8337('0x7a'),_0x8337('0x7b')]);_0x4129b5=_[_0x8337('0x79')](_[_0x8337('0x5e')](_0x45d7a9),[_0x8337('0x7a'),_0x8337('0x7b'),_0x8337('0x7c'),_0x8337('0x7d')]);if(_0x53f8bf[_0x8337('0x61')]['id']){delete _0x53f8bf[_0x8337('0x61')]['id'];}if(_[_0x8337('0x7e')](_0x53f8bf['body']['from'])){throw new db[(_0x8337('0x7f'))][(_0x8337('0x80'))](_0x8337('0x81'));}if(_[_0x8337('0x7e')](_0x53f8bf[_0x8337('0x61')][_0x8337('0x61')])||_0x53f8bf[_0x8337('0x61')][_0x8337('0x61')]===''){throw new db[(_0x8337('0x7f'))][(_0x8337('0x80'))](_0x8337('0x82'));}if(_[_0x8337('0x7e')](_0x53f8bf['body'][_0x8337('0x83')])){throw new db['Sequelize'][(_0x8337('0x80'))](_0x8337('0x84')+_0x4129b5);}if(!_[_0x8337('0x85')](_0x4129b5,_0x53f8bf[_0x8337('0x61')][_0x8337('0x83')])){throw new db[(_0x8337('0x7f'))][(_0x8337('0x80'))](_0x8337('0x86')+_0x4129b5);}_0x2f6860[_0x53f8bf['body'][_0x8337('0x83')]]=_0x53f8bf[_0x8337('0x61')]['from'];})['then'](function(){return db[_0x8337('0x42')][_0x8337('0x64')]({'where':{'id':_0x53f8bf[_0x8337('0x5d')]['id']},'include':[{'model':db[_0x8337('0x87')],'as':'List','include':[{'model':db[_0x8337('0x77')],'as':_0x8337('0x88'),'where':_0x2f6860,'limit':0x1,'order':[[_0x8337('0x7b'),_0x8337('0x89')]]}]},{'model':db[_0x8337('0x8a')],'as':_0x8337('0x8b')}]});})['then'](handleEntityNotFound(_0x2499bb,null))[_0x8337('0x23')](function(_0x2bdecd){if(_0x2bdecd&&_0x2bdecd[_0x8337('0x8c')]){_0x92f2ae[_0x8337('0x8d')]=_0x2bdecd;_0x92f2ae[_0x8337('0x8e')]=_0x2bdecd['Applications'];_0x92f2ae[_0x8337('0x8f')]=_0x2bdecd[_0x8337('0x8c')];_0x92f2ae[_0x8337('0x8e')]=_['orderBy'](_0x92f2ae[_0x8337('0x8e')],[_0x8337('0x90')],['asc']);if(_0x92f2ae[_0x8337('0x8d')][_0x8337('0x8b')]){delete _0x92f2ae[_0x8337('0x8d')][_0x8337('0x8b')];}if(_0x92f2ae[_0x8337('0x8d')][_0x8337('0x8c')]&&_0x92f2ae[_0x8337('0x8d')]['List'][_0x8337('0x88')][_0x8337('0x4d')]){return _0x92f2ae[_0x8337('0x8d')]['List'][_0x8337('0x88')][0x0];}var _0x3be5d1=_['defaults'](_0x53f8bf[_0x8337('0x61')],{'firstName':_0x53f8bf[_0x8337('0x61')]['from'],'ListId':_0x2bdecd[_0x8337('0x7d')]});_0x3be5d1[_0x53f8bf[_0x8337('0x61')]['mapKey']]=_0x53f8bf[_0x8337('0x61')][_0x8337('0x91')];return db[_0x8337('0x77')][_0x8337('0x60')](_0x3be5d1,{'fields':_0x5b901c,'raw':!![]});}})[_0x8337('0x23')](handleEntityNotFound(_0x2499bb,null))[_0x8337('0x23')](function(_0x2a4c77){_0x92f2ae[_0x8337('0x92')]=_0x2a4c77;if(_0x2a4c77){var _0x189f1c={'ContactId':_0x2a4c77['id'],'OpenchannelAccountId':_0x53f8bf[_0x8337('0x5d')]['id'],'from':(_0x2a4c77['firstName']||'')+'\x20'+(_0x2a4c77[_0x8337('0x93')]||'')};var _0x3c9b27={'OpenchannelAccountId':_0x53f8bf[_0x8337('0x5d')]['id'],'closed':![]};if(_0x53f8bf[_0x8337('0x61')]['threadId']){_0x3c9b27[_0x8337('0x94')]=_0x53f8bf[_0x8337('0x61')][_0x8337('0x94')];return db[_0x8337('0x95')][_0x8337('0x64')]({'where':_0x3c9b27})[_0x8337('0x23')](function(_0x1b4be2){if(_0x1b4be2){return[_0x1b4be2,![]];}_0x189f1c[_0x8337('0x94')]=_0x53f8bf[_0x8337('0x61')][_0x8337('0x94')];_0x189f1c[_0x8337('0x96')]=_0x53f8bf[_0x8337('0x61')][_0x8337('0x96')];return db[_0x8337('0x95')][_0x8337('0x60')](_0x189f1c)[_0x8337('0x23')](function(_0x2bb9c7){return[_0x2bb9c7,!![]];});});}else{_0x3c9b27[_0x8337('0x94')]=null;}_0x3c9b27[_0x8337('0x97')]=_0x2a4c77['id'];return db[_0x8337('0x95')][_0x8337('0x64')]({'where':_0x3c9b27})[_0x8337('0x23')](function(_0x8809d8){if(_0x8809d8){return[_0x8809d8,![]];}return db['OpenchannelInteraction'][_0x8337('0x60')](_0x189f1c)[_0x8337('0x23')](function(_0x3d5a1c){return[_0x3d5a1c,!![]];});});}})[_0x8337('0x98')](function(_0x30b22a,_0x4f8224){if(_0x30b22a){_0x52c343=_0x4f8224;if(!_0x4f8224){var _0x166b6f={'from':(_0x92f2ae['contact']['firstName']||'')+'\x20'+(_0x92f2ae[_0x8337('0x92')][_0x8337('0x93')]||'')};if(_0x53f8bf[_0x8337('0x61')]['threadId']&&_0x53f8bf[_0x8337('0x61')][_0x8337('0x99')]&&_0x53f8bf[_0x8337('0x61')][_0x8337('0x94')]!=_0x53f8bf['body'][_0x8337('0x99')]){_0x166b6f[_0x8337('0x94')]=_0x53f8bf[_0x8337('0x61')][_0x8337('0x99')];}return _0x30b22a[_0x8337('0x68')](_0x166b6f);}else{return _0x30b22a;}}})[_0x8337('0x23')](function(_0x38c36a){_0x92f2ae['interaction']=_0x38c36a[_0x8337('0x39')]({'plain':!![]});_0x92f2ae[_0x8337('0x9a')][_0x8337('0x9b')]=_0x52c343;if(_0x92f2ae[_0x8337('0x9a')][_0x8337('0x9b')]){if(_0x92f2ae['account'][_0x8337('0x9c')]){_0x92f2ae[_0x8337('0x8e')][_0x8337('0x9d')]({'id':0x0,'priority':_0x92f2ae[_0x8337('0x8e')]['length']+0x1,'app':_0x8337('0x9e'),'appdata':'unmanaged','interval':_0x8337('0x9f')});}}return db[_0x8337('0xa0')][_0x8337('0x60')]({'body':_0x53f8bf[_0x8337('0x61')][_0x8337('0x61')],'OpenchannelAccountId':_0x53f8bf[_0x8337('0x5d')]['id'],'OpenchannelInteractionId':_0x38c36a['id'],'direction':'in','ContactId':_0x92f2ae[_0x8337('0x92')]['id'],'AttachmentId':_0x53f8bf[_0x8337('0x61')][_0x8337('0xa1')]});})[_0x8337('0x23')](function(_0x24743d){_0x92f2ae[_0x8337('0x2b')]=_0x24743d;if(_0x92f2ae[_0x8337('0x9a')][_0x8337('0xa2')]){return db[_0x8337('0xa3')][_0x8337('0x64')]({'attributes':['id','name'],'where':{'id':_0x92f2ae[_0x8337('0x9a')][_0x8337('0xa2')]}})[_0x8337('0x23')](function(_0x415002){if(_0x415002){_0x92f2ae[_0x8337('0x8e')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x415002[_0x8337('0x3d')]+','+(_0x92f2ae[_0x8337('0x8d')][_0x8337('0xa4')]||0xa),'interval':_0x8337('0x9f')});_0x92f2ae[_0x8337('0xa5')]=![];}return respondWithRpcPromise(_0x8337('0xa6'),_0x8337('0xa7'),_0x92f2ae);});}return respondWithRpcPromise(_0x8337('0xa6'),_0x8337('0xa7'),_0x92f2ae);})[_0x8337('0x23')](function(_0x55fd5b){respondWithRpcPromise(_0x8337('0xa8'),'EventManager',{'event':'notify','message':_0x55fd5b},client9002);return _0x55fd5b;})['then'](respondWithResult(_0x2499bb,null))[_0x8337('0x2d')](handleError(_0x2499bb,null));};exports['addApplications']=function(_0x57a57e,_0x398ce6){var _0x1da431=_0x57a57e['params']['id'];var _0x17d9cb=_0x57a57e[_0x8337('0x61')];var _0x3e5cae=0xc8;var _0x2ec967=null;return db[_0x8337('0xa9')][_0x8337('0xaa')]({'isolationLevel':db[_0x8337('0xa9')][_0x8337('0xab')]['ISOLATION_LEVELS'][_0x8337('0xac')]},function(_0x59be52){return db['OpenchannelAccount'][_0x8337('0x6d')]({'where':{'id':_0x1da431},'transaction':_0x59be52})[_0x8337('0x23')](function(_0x2fb2d5){if(_0x2fb2d5){return db[_0x8337('0x8a')][_0x8337('0x38')]({'where':{'OpenchannelAccountId':_0x1da431},'transaction':_0x59be52})['then'](function(){var _0x44a4a0=_[_0x8337('0x55')](_0x17d9cb,function(_0x4b4a52){_0x4b4a52['OpenchannelAccountId']=_0x1da431;return _0x4b4a52;});return db[_0x8337('0x8a')]['bulkCreate'](_0x44a4a0,{'transaction':_0x59be52});});}else{_0x3e5cae=0x194;_0x2ec967=[];}});})[_0x8337('0x23')](function(){if(_0x3e5cae!==0x194){return db[_0x8337('0x8a')][_0x8337('0xad')]({'where':{'OpenchannelAccountId':_0x1da431},'order':'priority'})['then'](function(_0x3c67b6){_0x2ec967=_0x3c67b6;});}})[_0x8337('0x2d')](function(_0x5031d6){_0x3e5cae=0x1f4;logger[_0x8337('0x29')](_0x5031d6['stack']);if(_0x5031d6[_0x8337('0x3d')]){delete _0x5031d6[_0x8337('0x3d')];}_0x2ec967=_0x5031d6;})[_0x8337('0xae')](function(){if(_0x2ec967===null){_0x398ce6[_0x8337('0x3b')](_0x3e5cae);}else{if(_0x3e5cae===0x1f4){_0x398ce6[_0x8337('0x2e')](_0x3e5cae)['send'](_0x2ec967);}else{_0x398ce6[_0x8337('0x2e')](_0x3e5cae)[_0x8337('0x2f')](_0x2ec967);}}});};exports['getApplications']=function(_0x3daf90,_0x1d54fb,_0x13046d){var _0x17a72d={};var _0x290c69={};var _0x137a38;var _0x2091a8;return db[_0x8337('0x42')][_0x8337('0x6d')]({'where':{'id':_0x3daf90[_0x8337('0x5d')]['id']}})[_0x8337('0x23')](handleEntityNotFound(_0x1d54fb,null))[_0x8337('0x23')](function(_0x494d15){if(_0x494d15){_0x137a38=_0x494d15;_0x290c69[_0x8337('0x47')]=_[_0x8337('0x5e')](db[_0x8337('0x8a')]['rawAttributes']);_0x290c69['query']=_['keys'](_0x3daf90['query']);_0x290c69[_0x8337('0x49')]=_[_0x8337('0x4a')](_0x290c69[_0x8337('0x47')],_0x290c69[_0x8337('0x48')]);_0x17a72d[_0x8337('0x4c')]=_['intersection'](_0x290c69[_0x8337('0x47')],qs[_0x8337('0x4b')](_0x3daf90[_0x8337('0x48')][_0x8337('0x4b')]));_0x17a72d[_0x8337('0x4c')]=_0x17a72d[_0x8337('0x4c')][_0x8337('0x4d')]?_0x17a72d[_0x8337('0x4c')]:_0x290c69[_0x8337('0x47')];_0x17a72d[_0x8337('0x50')]=qs[_0x8337('0x51')](_0x3daf90['query'][_0x8337('0x51')]);_0x17a72d[_0x8337('0x52')]=qs[_0x8337('0x49')](_['pick'](_0x3daf90[_0x8337('0x48')],_0x290c69['filters']));if(_0x3daf90[_0x8337('0x48')][_0x8337('0x57')]){_0x17a72d[_0x8337('0x52')]=_[_0x8337('0x54')](_0x17a72d['where'],{'$or':_[_0x8337('0x55')](_0x17a72d[_0x8337('0x4c')],function(_0x4444cb){var _0x28e803={};_0x28e803[_0x4444cb]={'$like':'%'+_0x3daf90['query']['filter']+'%'};return _0x28e803;})});}_0x17a72d=_[_0x8337('0x54')]({},_0x17a72d,_0x3daf90['options']);return _0x137a38[_0x8337('0xaf')](_0x17a72d);}})[_0x8337('0x23')](function(_0x296c15){if(_0x296c15){_0x2091a8=_0x296c15[_0x8337('0x4d')];if(!_0x3daf90['query'][_0x8337('0x4e')](_0x8337('0x4f'))){_0x17a72d[_0x8337('0x32')]=qs[_0x8337('0x32')](_0x3daf90[_0x8337('0x48')]['limit']);_0x17a72d['offset']=qs[_0x8337('0x30')](_0x3daf90[_0x8337('0x48')][_0x8337('0x30')]);}return _0x137a38[_0x8337('0xaf')](_0x17a72d);}})[_0x8337('0x23')](function(_0x10ce63){if(_0x10ce63){return _0x10ce63?{'count':_0x2091a8,'rows':_0x10ce63}:null;}})[_0x8337('0x23')](respondWithResult(_0x1d54fb,null))['catch'](handleError(_0x1d54fb,null));};exports[_0x8337('0xb0')]=function(_0x3808cc,_0x7044b0,_0x5138dd){var _0x2c6d01={'raw':![],'where':{}};var _0x2fbe99={};var _0x2f0667={'count':0x0,'rows':[]};return db[_0x8337('0x42')][_0x8337('0x6d')]({'where':{'id':_0x3808cc[_0x8337('0x5d')]['id']}})[_0x8337('0x23')](handleEntityNotFound(_0x7044b0,null))[_0x8337('0x23')](function(_0x5dd7ed){if(_0x5dd7ed){_0x2fbe99[_0x8337('0x47')]=_[_0x8337('0x5e')](db['OpenchannelInteraction'][_0x8337('0x43')]);_0x2fbe99[_0x8337('0x48')]=_[_0x8337('0x5e')](_0x3808cc[_0x8337('0x48')]);_0x2fbe99[_0x8337('0x49')]=_[_0x8337('0x4a')](_0x2fbe99[_0x8337('0x47')],_0x2fbe99[_0x8337('0x48')]);_0x2c6d01[_0x8337('0x4c')]=_[_0x8337('0x4a')](_0x2fbe99['model'],qs[_0x8337('0x4b')](_0x3808cc[_0x8337('0x48')][_0x8337('0x4b')]));_0x2c6d01['attributes']=_0x2c6d01[_0x8337('0x4c')][_0x8337('0x4d')]?_0x2c6d01[_0x8337('0x4c')]:_0x2fbe99[_0x8337('0x47')];if(!_0x3808cc[_0x8337('0x48')][_0x8337('0x4e')](_0x8337('0x4f'))){_0x2c6d01['limit']=qs[_0x8337('0x32')](_0x3808cc[_0x8337('0x48')][_0x8337('0x32')]);_0x2c6d01['offset']=qs[_0x8337('0x30')](_0x3808cc[_0x8337('0x48')][_0x8337('0x30')]);}_0x2c6d01[_0x8337('0x50')]=qs[_0x8337('0x51')](_0x3808cc[_0x8337('0x48')][_0x8337('0x51')]);_0x2c6d01['where']=qs[_0x8337('0x49')](_['pick'](_0x3808cc['query'],_0x2fbe99[_0x8337('0x49')]));_0x2c6d01[_0x8337('0x52')][_0x8337('0x6e')]=_0x5dd7ed['id'];if(_0x3808cc[_0x8337('0x48')][_0x8337('0x57')]){_0x2c6d01[_0x8337('0x52')]=_['merge'](_0x2c6d01['where'],{'$or':_[_0x8337('0x55')](_0x2c6d01['attributes'],function(_0x3b962b){var _0x273fa7={};_0x273fa7[_0x3b962b]={'$like':'%'+_0x3808cc[_0x8337('0x48')][_0x8337('0x57')]+'%'};return _0x273fa7;})});}_0x2c6d01=_[_0x8337('0x54')]({},_0x2c6d01,_0x3808cc['options']);return db[_0x8337('0x95')][_0x8337('0x33')]({'where':_0x2c6d01[_0x8337('0x52')]})['then'](function(_0x20639f){_0x2f0667[_0x8337('0x33')]=_0x20639f;if(_0x3808cc['query'][_0x8337('0x5f')]){_0x2c6d01[_0x8337('0x59')]=[{'model':db['CmContact'],'as':_0x8337('0xb1'),'required':![]},{'model':db[_0x8337('0xa3')],'as':'Owner','attributes':[_0x8337('0x3d'),_0x8337('0xb2'),_0x8337('0xb3')],'required':![]},{'model':db['Tag'],'as':_0x8337('0xb4'),'attributes':['id',_0x8337('0x3d'),_0x8337('0xb5')],'where':_0x3808cc['query']['tag']?{'id':_0x3808cc['query']['tag']}:undefined,'required':_0x3808cc[_0x8337('0x48')][_0x8337('0xb6')]?!![]:![]}];}return db[_0x8337('0x95')][_0x8337('0x5a')](_0x2c6d01);})[_0x8337('0x23')](function(_0x20429e){_0x2f0667[_0x8337('0x5b')]=_0x20429e;return _0x2f0667;});}})['then'](respondWithFilteredResult(_0x7044b0,_0x2c6d01))['catch'](handleError(_0x7044b0,null));};exports[_0x8337('0xb7')]=function(_0x369d2f,_0x1693d2,_0x3d88cd){return db['OpenchannelAccount'][_0x8337('0x64')]({'where':{'id':_0x369d2f[_0x8337('0x5d')]['id']}})[_0x8337('0x23')](handleEntityNotFound(_0x1693d2,null))[_0x8337('0x23')](function(_0xa402db){if(_0xa402db){return _0xa402db['addAgents'](_0x369d2f['body'][_0x8337('0x70')],_[_0x8337('0xb8')](_0x369d2f[_0x8337('0x61')],['ids','id'])||{})[_0x8337('0x98')](function(_0x4fc076){for(var _0x15feba=0x0;_0x15feba<_0x369d2f[_0x8337('0x61')]['ids'][_0x8337('0x4d')];_0x15feba+=0x1){socket[_0x8337('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x369d2f[_0x8337('0x61')]['ids'][_0x15feba]),'OpenchannelAccountId':Number(_0x369d2f[_0x8337('0x5d')]['id'])});}return _0x4fc076;});}})[_0x8337('0x23')](respondWithResult(_0x1693d2,null))[_0x8337('0x2d')](handleError(_0x1693d2,null));};exports[_0x8337('0xba')]=function(_0x24cf2a,_0x46771e,_0x5c4d36){return db[_0x8337('0x42')][_0x8337('0x64')]({'where':{'id':_0x24cf2a['params']['id']}})['then'](handleEntityNotFound(_0x46771e,null))[_0x8337('0x23')](function(_0x414842){if(_0x414842){return _0x414842[_0x8337('0xba')](_0x24cf2a[_0x8337('0x48')][_0x8337('0x70')])[_0x8337('0x23')](function(){if(_['isArray'](_0x24cf2a['query']['ids'])){for(var _0x342b7d=0x0;_0x342b7d<_0x24cf2a[_0x8337('0x48')]['ids'][_0x8337('0x4d')];_0x342b7d+=0x1){socket[_0x8337('0xb9')](_0x8337('0xbb'),{'UserId':Number(_0x24cf2a['query'][_0x8337('0x70')][_0x342b7d]),'OpenchannelAccountId':Number(_0x24cf2a[_0x8337('0x5d')]['id'])});}}else{socket[_0x8337('0xb9')](_0x8337('0xbb'),{'UserId':Number(_0x24cf2a[_0x8337('0x48')]['ids']),'OpenchannelAccountId':Number(_0x24cf2a['params']['id'])});}});}})[_0x8337('0x23')](respondWithStatusCode(_0x46771e,null))[_0x8337('0x2d')](handleError(_0x46771e,null));};exports[_0x8337('0xbc')]=function(_0x2fcef2,_0x3949ac,_0x25c523){var _0xd7800={};var _0x295a43={};var _0x2566a7;var _0x261c87;return db[_0x8337('0x42')][_0x8337('0x6d')]({'where':{'id':_0x2fcef2['params']['id']}})['then'](handleEntityNotFound(_0x3949ac,null))[_0x8337('0x23')](function(_0x297bf0){if(_0x297bf0){_0x2566a7=_0x297bf0;_0x295a43['model']=_[_0x8337('0x5e')](db[_0x8337('0xa3')][_0x8337('0x43')]);_0x295a43['query']=_['keys'](_0x2fcef2[_0x8337('0x48')]);_0x295a43['filters']=_[_0x8337('0x4a')](_0x295a43[_0x8337('0x47')],_0x295a43['query']);_0xd7800[_0x8337('0x4c')]=_[_0x8337('0x4a')](_0x295a43[_0x8337('0x47')],qs[_0x8337('0x4b')](_0x2fcef2[_0x8337('0x48')]['fields']));_0xd7800['attributes']=_0xd7800['attributes'][_0x8337('0x4d')]?_0xd7800[_0x8337('0x4c')]:_0x295a43[_0x8337('0x47')];_0xd7800['order']=qs[_0x8337('0x51')](_0x2fcef2[_0x8337('0x48')][_0x8337('0x51')]);_0xd7800[_0x8337('0x52')]=qs[_0x8337('0x49')](_[_0x8337('0x53')](_0x2fcef2[_0x8337('0x48')],_0x295a43[_0x8337('0x49')]));if(_0x2fcef2[_0x8337('0x48')][_0x8337('0x57')]){_0xd7800[_0x8337('0x52')]=_['merge'](_0xd7800[_0x8337('0x52')],{'$or':_[_0x8337('0x55')](_0xd7800[_0x8337('0x4c')],function(_0x444dd1){var _0x4edaa1={};_0x4edaa1[_0x444dd1]={'$like':'%'+_0x2fcef2[_0x8337('0x48')][_0x8337('0x57')]+'%'};return _0x4edaa1;})});}_0xd7800=_[_0x8337('0x54')]({},_0xd7800,_0x2fcef2[_0x8337('0x58')]);return _0x2566a7[_0x8337('0xbc')](_0xd7800);}})[_0x8337('0x23')](function(_0x5869e0){if(_0x5869e0){_0x261c87=_0x5869e0['length'];if(!_0x2fcef2[_0x8337('0x48')]['hasOwnProperty'](_0x8337('0x4f'))){_0xd7800[_0x8337('0x32')]=qs[_0x8337('0x32')](_0x2fcef2['query'][_0x8337('0x32')]);_0xd7800['offset']=qs[_0x8337('0x30')](_0x2fcef2[_0x8337('0x48')][_0x8337('0x30')]);}return _0x2566a7[_0x8337('0xbc')](_0xd7800);}})[_0x8337('0x23')](function(_0xd0600a){if(_0xd0600a){return _0xd0600a?{'count':_0x261c87,'rows':_0xd0600a}:null;}})[_0x8337('0x23')](respondWithResult(_0x3949ac,null))['catch'](handleError(_0x3949ac,null));};exports[_0x8337('0x3e')]=function(_0xd0dadd,_0x4be84d,_0x5bc836){var _0x1b8a87,_0xc757ce,_0x304d11;if(_[_0x8337('0x7e')](_0xd0dadd[_0x8337('0x61')][_0x8337('0x61')])||_0xd0dadd[_0x8337('0x61')][_0x8337('0x61')]===''){throw new db['Sequelize']['ValidationError'](_0x8337('0x82'));}if(_[_0x8337('0x7e')](_0xd0dadd[_0x8337('0x61')]['to'])){}_0x1b8a87=_0xd0dadd[_0x8337('0x61')]['to'];return db[_0x8337('0x42')][_0x8337('0x6d')]({'where':{'id':_0xd0dadd[_0x8337('0x5d')]['id']}})[_0x8337('0x23')](handleEntityNotFound(_0x4be84d,null))['then'](function(_0x570004){if(_0x570004){return db['OpenchannelAccount'][_0x8337('0x64')]({'where':{'id':_0x570004['id']},'include':[{'model':db[_0x8337('0x87')],'as':_0x8337('0x8c'),'include':[{'model':db[_0x8337('0x77')],'as':'Contacts','where':{[_0x570004['mapKey']]:_0x1b8a87},'limit':0x1,'order':[['updatedAt',_0x8337('0x89')]]}]}]})[_0x8337('0x23')](handleEntityNotFound(_0x4be84d,null))[_0x8337('0x23')](function(_0x5264f2){if(_0x5264f2&&_0x5264f2['List']){_0xc757ce=_0x5264f2['get']({'plain':!![]});if(_0xc757ce[_0x8337('0x8c')]&&_0xc757ce[_0x8337('0x8c')][_0x8337('0x88')]['length']){return _0xc757ce['List'][_0x8337('0x88')][0x0];}return db[_0x8337('0x77')]['create'](_[_0x8337('0x1b')](_0xd0dadd[_0x8337('0x61')],{'firstName':_0x1b8a87,[_0x5264f2[_0x8337('0x83')]]:_0x1b8a87,'phone':_0x1b8a87,'ListId':_0xc757ce['ListId']}));}})[_0x8337('0x23')](handleEntityNotFound(_0x4be84d,null))['then'](function(_0x19d03b){if(_0x19d03b){_0x304d11=_0x19d03b;return db[_0x8337('0x95')]['find']({'where':{'ContactId':_0x304d11['id'],'closed':![],'OpenchannelAccountId':_0xc757ce['id']}})[_0x8337('0x23')](function(_0xd2f82e){if(_0xd2f82e){return[_0xd2f82e,![]];}return db['OpenchannelInteraction'][_0x8337('0x60')]({'UserId':_0xd0dadd[_0x8337('0x62')]['id'],'ContactId':_0x304d11['id'],'OpenchannelAccountId':_0xc757ce['id'],'lastMsgDirection':_0x8337('0xbd'),'firstMsgDirection':_0x8337('0xbd'),'Messages':[_[_0x8337('0x54')](_0xd0dadd[_0x8337('0x61')],{'read':![],'body':_0xd0dadd[_0x8337('0x61')][_0x8337('0x61')],'OpenchannelAccountId':_0xc757ce['id'],'UserId':_0xd0dadd[_0x8337('0x62')]['id'],'ContactId':_0x304d11['id']})]},{'include':[{'model':db[_0x8337('0xa0')],'as':_0x8337('0xbe')}]})[_0x8337('0x23')](function(_0x3c5dba){return[_0x3c5dba,!![]];});});}})[_0x8337('0x98')](function(_0x1f297d,_0x25f7cc){if(_0x25f7cc){return _0x1f297d;}return db[_0x8337('0xa0')]['create'](_[_0x8337('0x54')](_0xd0dadd[_0x8337('0x61')],{'read':![],'body':_0xd0dadd[_0x8337('0x61')][_0x8337('0x61')],'OpenchannelAccountId':_0xc757ce['id'],'OpenchannelInteractionId':_0x1f297d['id'],'UserId':_0xd0dadd[_0x8337('0x62')]['id'],'ContactId':_0x304d11['id']}))[_0x8337('0x23')](function(_0x488b06){_0x1f297d['dataValues'][_0x8337('0xbe')]=[];_0x1f297d['dataValues'][_0x8337('0xbe')]['push'](_0x488b06[_0x8337('0xbf')]);return _0x1f297d;});});}})[_0x8337('0x23')](respondWithResult(_0x4be84d,null))[_0x8337('0x2d')](handleError(_0x4be84d,null));}; \ No newline at end of file +var _0x61e6=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','undefined','limit','count','offset','Content-Range','json','apply','reject','update','destroy','then','get','OpenchannelAccounts','UserProfileResource','status','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','Pause','length','create','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','from','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','asc','contact','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x56c6a9,_0x1239ee){var _0xa3ad43=function(_0x386c0a){while(--_0x386c0a){_0x56c6a9['push'](_0x56c6a9['shift']());}};_0xa3ad43(++_0x1239ee);}(_0x61e6,0x9a));var _0x661e=function(_0x4a8359,_0x3f9839){_0x4a8359=_0x4a8359-0x0;var _0x4d84c8=_0x61e6[_0x4a8359];return _0x4d84c8;};'use strict';var emlformat=require(_0x661e('0x0'));var rimraf=require(_0x661e('0x1'));var zipdir=require(_0x661e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x661e('0x3'));var moment=require(_0x661e('0x4'));var BPromise=require(_0x661e('0x5'));var Mustache=require(_0x661e('0x6'));var util=require(_0x661e('0x7'));var path=require(_0x661e('0x8'));var sox=require(_0x661e('0x9'));var csv=require(_0x661e('0xa'));var ejs=require(_0x661e('0xb'));var fs=require('fs');var fs_extra=require(_0x661e('0xc'));var _=require(_0x661e('0xd'));var squel=require(_0x661e('0xe'));var crypto=require(_0x661e('0xf'));var jsforce=require(_0x661e('0x10'));var deskjs=require(_0x661e('0x11'));var toCsv=require(_0x661e('0xa'));var querystring=require(_0x661e('0x12'));var Papa=require(_0x661e('0x13'));var Redis=require(_0x661e('0x14'));var authService=require(_0x661e('0x15'));var qs=require(_0x661e('0x16'));var as=require(_0x661e('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x661e('0x18'))('api');var utils=require(_0x661e('0x19'));var config=require(_0x661e('0x1a'));var licenseUtil=require(_0x661e('0x1b'));var db=require(_0x661e('0x1c'))['db'];config[_0x661e('0x1d')]=_[_0x661e('0x1e')](config[_0x661e('0x1d')],{'host':_0x661e('0x1f'),'port':0x18eb});var socket=require(_0x661e('0x20'))(new Redis(config[_0x661e('0x1d')]));require(_0x661e('0x21'))[_0x661e('0x22')](socket);var jayson=require(_0x661e('0x23'));var client=jayson['client'][_0x661e('0x24')]({'port':0x232c});var client9002=jayson[_0x661e('0x25')][_0x661e('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x2bc9be,_0x4cdb6e,_0x5421e2,_0x4a1d65){return new BPromise(function(_0x11b587,_0x495467){var _0x3c022a=_0x4a1d65||client;return _0x3c022a[_0x661e('0x26')](_0x2bc9be,_0x5421e2)['then'](function(_0x3e56cb){logger['info'](_0x661e('0x27'),_0x4cdb6e,_0x661e('0x28'));logger[_0x661e('0x29')](_0x661e('0x2a'),_0x4cdb6e,'request\x20sent',JSON[_0x661e('0x2b')](_0x3e56cb));if(_0x3e56cb[_0x661e('0x2c')]){if(_0x3e56cb['error'][_0x661e('0x2d')]===0x1f4){logger[_0x661e('0x2c')](_0x661e('0x27'),_0x4cdb6e,_0x3e56cb[_0x661e('0x2c')]['message']);return _0x495467(_0x3e56cb[_0x661e('0x2c')][_0x661e('0x2e')]);}logger[_0x661e('0x2c')](_0x661e('0x27'),_0x4cdb6e,_0x3e56cb[_0x661e('0x2c')]['message']);return _0x11b587(_0x3e56cb[_0x661e('0x2c')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4cdb6e,_0x661e('0x28'));_0x11b587(_0x3e56cb['result']['message']);}})[_0x661e('0x2f')](function(_0x2a4f48){logger['error'](_0x661e('0x27'),_0x4cdb6e,_0x2a4f48);_0x495467(_0x2a4f48);});});}function respondWithStatusCode(_0x338ff4,_0xaa058d){_0xaa058d=_0xaa058d||0xcc;return function(_0x317d67){if(_0x317d67){return _0x338ff4['sendStatus'](_0xaa058d);}return _0x338ff4['status'](_0xaa058d)[_0x661e('0x30')]();};}function respondWithResult(_0x196521,_0x1d1177){_0x1d1177=_0x1d1177||0xc8;return function(_0x391fd1){if(_0x391fd1){return _0x196521['status'](_0x1d1177)['json'](_0x391fd1);}};}function respondWithFilteredResult(_0x280607,_0x1f7d69){return function(_0x2cae77){if(_0x2cae77){var _0x753e09=typeof _0x1f7d69['offset']===_0x661e('0x31')&&typeof _0x1f7d69[_0x661e('0x32')]==='undefined';var _0x2d0399=_0x2cae77[_0x661e('0x33')];var _0x2847bd=_0x753e09?0x0:_0x1f7d69[_0x661e('0x34')];var _0x1d4d03=_0x753e09?_0x2cae77[_0x661e('0x33')]:_0x1f7d69[_0x661e('0x34')]+_0x1f7d69['limit'];var _0x3522b3;if(_0x1d4d03>=_0x2d0399){_0x1d4d03=_0x2d0399;_0x3522b3=0xc8;}else{_0x3522b3=0xce;}_0x280607['status'](_0x3522b3);return _0x280607['set'](_0x661e('0x35'),_0x2847bd+'-'+_0x1d4d03+'/'+_0x2d0399)[_0x661e('0x36')](_0x2cae77);}return null;};}function patchUpdates(_0x48d1ad){return function(_0x30daaf){try{jsonpatch[_0x661e('0x37')](_0x30daaf,_0x48d1ad,!![]);}catch(_0x48bf47){return BPromise[_0x661e('0x38')](_0x48bf47);}return _0x30daaf['save']();};}function saveUpdates(_0x3228fa,_0x3c779f){return function(_0x47f388){if(_0x47f388){return _0x47f388[_0x661e('0x39')](_0x3228fa)['then'](function(_0xccc97f){return _0xccc97f;});}return null;};}function removeEntity(_0x1c3968,_0x599ef5){return function(_0x3b589b){if(_0x3b589b){return _0x3b589b[_0x661e('0x3a')]()[_0x661e('0x3b')](function(){var _0x18fc7f=_0x3b589b[_0x661e('0x3c')]({'plain':!![]});var _0x226e55=_0x661e('0x3d');return db[_0x661e('0x3e')][_0x661e('0x3a')]({'where':{'type':_0x226e55,'resourceId':_0x18fc7f['id']}})[_0x661e('0x3b')](function(){return _0x3b589b;});})[_0x661e('0x3b')](function(){_0x1c3968[_0x661e('0x3f')](0xcc)[_0x661e('0x30')]();});}};}function handleEntityNotFound(_0x572f4d,_0x1e6f79){return function(_0xea075f){if(!_0xea075f){_0x572f4d[_0x661e('0x40')](0x194);}return _0xea075f;};}function handleError(_0x33afc6,_0x59fcb0){_0x59fcb0=_0x59fcb0||0x1f4;return function(_0x5481fc){logger[_0x661e('0x2c')](_0x5481fc[_0x661e('0x41')]);if(_0x5481fc[_0x661e('0x42')]){delete _0x5481fc[_0x661e('0x42')];}_0x33afc6['status'](_0x59fcb0)[_0x661e('0x43')](_0x5481fc);};}exports[_0x661e('0x44')]=function(_0x3d0a5d,_0x50c154){var _0xacd10d={'include':[{'model':db['Pause'],'as':_0x661e('0x45')}]},_0x563da8={},_0x4af358={'count':0x0,'rows':[]};var _0x39ec31=_[_0x661e('0x46')](db[_0x661e('0x47')][_0x661e('0x48')],function(_0x1ce741){return{'name':_0x1ce741['fieldName'],'type':_0x1ce741[_0x661e('0x49')][_0x661e('0x4a')]};});_0x563da8[_0x661e('0x4b')]=_[_0x661e('0x46')](_0x39ec31,_0x661e('0x42'));_0x563da8[_0x661e('0x4c')]=_[_0x661e('0x4d')](_0x3d0a5d[_0x661e('0x4c')]);_0x563da8['filters']=_[_0x661e('0x4e')](_0x563da8[_0x661e('0x4b')],_0x563da8[_0x661e('0x4c')]);_0xacd10d[_0x661e('0x4f')]=_[_0x661e('0x4e')](_0x563da8['model'],qs[_0x661e('0x50')](_0x3d0a5d[_0x661e('0x4c')]['fields']));_0xacd10d[_0x661e('0x4f')]=_0xacd10d[_0x661e('0x4f')]['length']?_0xacd10d[_0x661e('0x4f')]:_0x563da8[_0x661e('0x4b')];if(!_0x3d0a5d[_0x661e('0x4c')]['hasOwnProperty'](_0x661e('0x51'))){_0xacd10d[_0x661e('0x32')]=qs[_0x661e('0x32')](_0x3d0a5d[_0x661e('0x4c')][_0x661e('0x32')]);_0xacd10d[_0x661e('0x34')]=qs[_0x661e('0x34')](_0x3d0a5d[_0x661e('0x4c')][_0x661e('0x34')]);}_0xacd10d[_0x661e('0x52')]=qs[_0x661e('0x53')](_0x3d0a5d[_0x661e('0x4c')][_0x661e('0x53')]);_0xacd10d[_0x661e('0x54')]=qs['filters'](_[_0x661e('0x55')](_0x3d0a5d[_0x661e('0x4c')],_0x563da8[_0x661e('0x56')]),_0x39ec31);if(_0x3d0a5d[_0x661e('0x4c')]['filter']){_0xacd10d['where']=_[_0x661e('0x57')](_0xacd10d[_0x661e('0x54')],{'$or':_[_0x661e('0x46')](_0x39ec31,function(_0x4eb1c3){if(_0x4eb1c3['type']!==_0x661e('0x58')){var _0x34b254={};_0x34b254[_0x4eb1c3[_0x661e('0x42')]]={'$like':'%'+_0x3d0a5d[_0x661e('0x4c')][_0x661e('0x59')]+'%'};return _0x34b254;}})});}_0xacd10d=_[_0x661e('0x57')]({},_0xacd10d,_0x3d0a5d[_0x661e('0x5a')]);var _0x35d3b6={'where':_0xacd10d[_0x661e('0x54')]};return db['OpenchannelAccount'][_0x661e('0x33')](_0x35d3b6)['then'](function(_0x61fa74){_0x4af358[_0x661e('0x33')]=_0x61fa74;if(_0x3d0a5d[_0x661e('0x4c')][_0x661e('0x5b')]){_0xacd10d[_0x661e('0x5c')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0xacd10d);})[_0x661e('0x3b')](function(_0x174b96){_0x4af358[_0x661e('0x5d')]=_0x174b96;return _0x4af358;})[_0x661e('0x3b')](respondWithFilteredResult(_0x50c154,_0xacd10d))[_0x661e('0x2f')](handleError(_0x50c154,null));};exports[_0x661e('0x5e')]=function(_0x4f9a09,_0x32cf3e){var _0x185a02={'raw':![],'where':{'id':_0x4f9a09[_0x661e('0x5f')]['id']},'include':[{'model':db[_0x661e('0x60')],'as':_0x661e('0x45')}]},_0x468558={};_0x468558[_0x661e('0x4b')]=_[_0x661e('0x4d')](db[_0x661e('0x47')]['rawAttributes']);_0x468558[_0x661e('0x4c')]=_[_0x661e('0x4d')](_0x4f9a09[_0x661e('0x4c')]);_0x468558[_0x661e('0x56')]=_[_0x661e('0x4e')](_0x468558[_0x661e('0x4b')],_0x468558['query']);_0x185a02['attributes']=_[_0x661e('0x4e')](_0x468558[_0x661e('0x4b')],qs[_0x661e('0x50')](_0x4f9a09[_0x661e('0x4c')][_0x661e('0x50')]));_0x185a02['attributes']=_0x185a02[_0x661e('0x4f')][_0x661e('0x61')]?_0x185a02[_0x661e('0x4f')]:_0x468558[_0x661e('0x4b')];if(_0x4f9a09[_0x661e('0x4c')][_0x661e('0x5b')]){_0x185a02[_0x661e('0x5c')]=[{'all':!![]}];}_0x185a02=_[_0x661e('0x57')]({},_0x185a02,_0x4f9a09['options']);return db['OpenchannelAccount']['find'](_0x185a02)[_0x661e('0x3b')](handleEntityNotFound(_0x32cf3e,null))[_0x661e('0x3b')](respondWithResult(_0x32cf3e,null))[_0x661e('0x2f')](handleError(_0x32cf3e,null));};exports[_0x661e('0x62')]=function(_0x5ab064,_0x135c78){return db['OpenchannelAccount']['create'](_0x5ab064['body'],{})[_0x661e('0x3b')](function(_0x109679){var _0x16b0ba=_0x5ab064[_0x661e('0x63')][_0x661e('0x3c')]({'plain':!![]});if(!_0x16b0ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16b0ba[_0x661e('0x64')]==='user'){var _0x82b5b0=_0x109679['get']({'plain':!![]});var _0x3edf0c=_0x661e('0x3d');return db[_0x661e('0x65')][_0x661e('0x66')]({'where':{'name':_0x3edf0c,'userProfileId':_0x16b0ba['userProfileId']},'raw':!![]})[_0x661e('0x3b')](function(_0x463e77){if(_0x463e77&&_0x463e77[_0x661e('0x67')]===0x0){return db[_0x661e('0x3e')][_0x661e('0x62')]({'name':_0x82b5b0[_0x661e('0x42')],'resourceId':_0x82b5b0['id'],'type':_0x463e77[_0x661e('0x42')],'sectionId':_0x463e77['id']},{})['then'](function(){return _0x109679;});}else{return _0x109679;}})[_0x661e('0x2f')](function(_0x440907){logger[_0x661e('0x2c')](_0x661e('0x68'),_0x440907);throw _0x440907;});}return _0x109679;})[_0x661e('0x3b')](respondWithResult(_0x135c78,0xc9))['catch'](handleError(_0x135c78,null));};exports['update']=function(_0x470b07,_0x43d29b){if(_0x470b07[_0x661e('0x69')]['id']){delete _0x470b07['body']['id'];}return db[_0x661e('0x47')][_0x661e('0x66')]({'where':{'id':_0x470b07[_0x661e('0x5f')]['id']},'include':[{'model':db[_0x661e('0x60')],'as':_0x661e('0x45')}]})[_0x661e('0x3b')](handleEntityNotFound(_0x43d29b,null))[_0x661e('0x3b')](saveUpdates(_0x470b07[_0x661e('0x69')],null))[_0x661e('0x3b')](respondWithResult(_0x43d29b,null))[_0x661e('0x2f')](handleError(_0x43d29b,null));};exports[_0x661e('0x3a')]=function(_0x1bd051,_0x556169){return db[_0x661e('0x47')][_0x661e('0x66')]({'where':{'id':_0x1bd051[_0x661e('0x5f')]['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0x556169,null))['then'](removeEntity(_0x556169,null))[_0x661e('0x2f')](handleError(_0x556169,null));};exports[_0x661e('0x6a')]=function(_0x1440b4,_0x52b1a7){return db['OpenchannelAccount'][_0x661e('0x6a')]()[_0x661e('0x3b')](respondWithResult(_0x52b1a7,null))[_0x661e('0x2f')](handleError(_0x52b1a7,null));};exports[_0x661e('0x6b')]=function(_0xf37186,_0x5230eb,_0x41ff0a){if(_0xf37186['body']['id']){delete _0xf37186[_0x661e('0x69')]['id'];}return db[_0x661e('0x47')][_0x661e('0x66')]({'where':{'id':_0xf37186[_0x661e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5230eb,null))['then'](function(_0x373542){if(_0x373542){_0xf37186[_0x661e('0x69')][_0x661e('0x6c')]=_0x373542['id'];return db[_0x661e('0x6d')][_0x661e('0x62')](_0xf37186[_0x661e('0x69')]);}})[_0x661e('0x3b')](respondWithResult(_0x5230eb,null))[_0x661e('0x2f')](handleError(_0x5230eb,null));};exports[_0x661e('0x6e')]=function(_0x4799cd,_0x39adb6,_0x1bd2db){var _0x236473={'raw':![],'where':{}};var _0x73f524={};var _0x2894fd={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x661e('0x6f')]({'where':{'id':_0x4799cd['params']['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0x39adb6,null))[_0x661e('0x3b')](function(_0x483faa){if(_0x483faa){_0x73f524[_0x661e('0x4b')]=_[_0x661e('0x4d')](db[_0x661e('0x6d')]['rawAttributes']);_0x73f524[_0x661e('0x4c')]=_['keys'](_0x4799cd[_0x661e('0x4c')]);_0x73f524[_0x661e('0x56')]=_[_0x661e('0x4e')](_0x73f524[_0x661e('0x4b')],_0x73f524[_0x661e('0x4c')]);_0x236473['attributes']=_[_0x661e('0x4e')](_0x73f524[_0x661e('0x4b')],qs['fields'](_0x4799cd[_0x661e('0x4c')]['fields']));_0x236473['attributes']=_0x236473[_0x661e('0x4f')][_0x661e('0x61')]?_0x236473[_0x661e('0x4f')]:_0x73f524[_0x661e('0x4b')];if(!_0x4799cd[_0x661e('0x4c')][_0x661e('0x70')](_0x661e('0x51'))){_0x236473[_0x661e('0x32')]=qs[_0x661e('0x32')](_0x4799cd[_0x661e('0x4c')]['limit']);_0x236473[_0x661e('0x34')]=qs[_0x661e('0x34')](_0x4799cd[_0x661e('0x4c')][_0x661e('0x34')]);}_0x236473[_0x661e('0x52')]=qs[_0x661e('0x53')](_0x4799cd['query'][_0x661e('0x53')]);_0x236473[_0x661e('0x54')]=qs['filters'](_['pick'](_0x4799cd[_0x661e('0x4c')],_0x73f524[_0x661e('0x56')]));_0x236473[_0x661e('0x54')]['OpenchannelAccountId']=_0x483faa['id'];if(_0x4799cd[_0x661e('0x4c')]['filter']){_0x236473[_0x661e('0x54')]=_[_0x661e('0x57')](_0x236473[_0x661e('0x54')],{'$or':_['map'](_0x236473[_0x661e('0x4f')],function(_0x2d149f){var _0x639a61={};_0x639a61[_0x2d149f]={'$like':'%'+_0x4799cd[_0x661e('0x4c')]['filter']+'%'};return _0x639a61;})});}_0x236473=_['merge']({},_0x236473,_0x4799cd[_0x661e('0x5a')]);return db[_0x661e('0x6d')][_0x661e('0x33')]({'where':_0x236473[_0x661e('0x54')]})[_0x661e('0x3b')](function(_0x3d1436){_0x2894fd[_0x661e('0x33')]=_0x3d1436;if(_0x4799cd[_0x661e('0x4c')][_0x661e('0x5b')]){_0x236473['include']=[{'all':!![]}];}return db['Disposition'][_0x661e('0x71')](_0x236473);})[_0x661e('0x3b')](function(_0xafdf05){_0x2894fd[_0x661e('0x5d')]=_0xafdf05;return _0x2894fd;});}})[_0x661e('0x3b')](respondWithFilteredResult(_0x39adb6,_0x236473))[_0x661e('0x2f')](handleError(_0x39adb6,null));};exports[_0x661e('0x72')]=function(_0x491bf4,_0x8bc5,_0x3c8a08){return db[_0x661e('0x47')][_0x661e('0x66')]({'where':{'id':_0x491bf4[_0x661e('0x5f')]['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0x8bc5,null))[_0x661e('0x3b')](function(_0x42318f){if(_0x42318f){return _0x42318f['removeDispositions'](_0x491bf4['query'][_0x661e('0x73')]);}})[_0x661e('0x3b')](respondWithStatusCode(_0x8bc5,null))[_0x661e('0x2f')](handleError(_0x8bc5,null));};exports['addAnswer']=function(_0x255436,_0x371cb8,_0x56d89d){if(_0x255436[_0x661e('0x69')]['id']){delete _0x255436[_0x661e('0x69')]['id'];}return db['OpenchannelAccount'][_0x661e('0x66')]({'where':{'id':_0x255436['params']['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0x371cb8,null))[_0x661e('0x3b')](function(_0x4eac63){if(_0x4eac63){_0x255436[_0x661e('0x69')][_0x661e('0x6c')]=_0x4eac63['id'];return db['CannedAnswer'][_0x661e('0x62')](_0x255436[_0x661e('0x69')]);}})[_0x661e('0x3b')](respondWithResult(_0x371cb8,null))[_0x661e('0x2f')](handleError(_0x371cb8,null));};exports[_0x661e('0x74')]=function(_0x47d114,_0x400658,_0x290c63){var _0x39eb31={'raw':![],'where':{}};var _0x102da8={};var _0x309149={'count':0x0,'rows':[]};return db[_0x661e('0x47')][_0x661e('0x6f')]({'where':{'id':_0x47d114['params']['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0x400658,null))['then'](function(_0x3b3626){if(_0x3b3626){_0x102da8[_0x661e('0x4b')]=_[_0x661e('0x4d')](db[_0x661e('0x75')]['rawAttributes']);_0x102da8[_0x661e('0x4c')]=_[_0x661e('0x4d')](_0x47d114[_0x661e('0x4c')]);_0x102da8[_0x661e('0x56')]=_[_0x661e('0x4e')](_0x102da8[_0x661e('0x4b')],_0x102da8[_0x661e('0x4c')]);_0x39eb31['attributes']=_[_0x661e('0x4e')](_0x102da8[_0x661e('0x4b')],qs['fields'](_0x47d114[_0x661e('0x4c')][_0x661e('0x50')]));_0x39eb31[_0x661e('0x4f')]=_0x39eb31[_0x661e('0x4f')][_0x661e('0x61')]?_0x39eb31[_0x661e('0x4f')]:_0x102da8[_0x661e('0x4b')];if(!_0x47d114['query'][_0x661e('0x70')](_0x661e('0x51'))){_0x39eb31[_0x661e('0x32')]=qs[_0x661e('0x32')](_0x47d114[_0x661e('0x4c')]['limit']);_0x39eb31[_0x661e('0x34')]=qs['offset'](_0x47d114[_0x661e('0x4c')][_0x661e('0x34')]);}_0x39eb31[_0x661e('0x52')]=qs[_0x661e('0x53')](_0x47d114[_0x661e('0x4c')][_0x661e('0x53')]);_0x39eb31[_0x661e('0x54')]=qs[_0x661e('0x56')](_['pick'](_0x47d114[_0x661e('0x4c')],_0x102da8['filters']));_0x39eb31['where']['OpenchannelAccountId']=_0x3b3626['id'];if(_0x47d114[_0x661e('0x4c')]['filter']){_0x39eb31[_0x661e('0x54')]=_[_0x661e('0x57')](_0x39eb31['where'],{'$or':_[_0x661e('0x46')](_0x39eb31[_0x661e('0x4f')],function(_0x2d4af1){var _0x1b86de={};_0x1b86de[_0x2d4af1]={'$like':'%'+_0x47d114[_0x661e('0x4c')][_0x661e('0x59')]+'%'};return _0x1b86de;})});}_0x39eb31=_[_0x661e('0x57')]({},_0x39eb31,_0x47d114[_0x661e('0x5a')]);return db['CannedAnswer'][_0x661e('0x33')]({'where':_0x39eb31[_0x661e('0x54')]})[_0x661e('0x3b')](function(_0xf22db9){_0x309149['count']=_0xf22db9;if(_0x47d114[_0x661e('0x4c')][_0x661e('0x5b')]){_0x39eb31[_0x661e('0x5c')]=[{'all':!![]}];}return db[_0x661e('0x75')][_0x661e('0x71')](_0x39eb31);})[_0x661e('0x3b')](function(_0x746fa8){_0x309149[_0x661e('0x5d')]=_0x746fa8;return _0x309149;});}})[_0x661e('0x3b')](respondWithFilteredResult(_0x400658,_0x39eb31))[_0x661e('0x2f')](handleError(_0x400658,null));};exports[_0x661e('0x76')]=function(_0x121ee4,_0x1dbf9d,_0x3685dc){return db['OpenchannelAccount'][_0x661e('0x66')]({'where':{'id':_0x121ee4[_0x661e('0x5f')]['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0x1dbf9d,null))[_0x661e('0x3b')](function(_0x18c89a){if(_0x18c89a){return _0x18c89a['removeAnswers'](_0x121ee4['query'][_0x661e('0x73')]);}})[_0x661e('0x3b')](respondWithStatusCode(_0x1dbf9d,null))[_0x661e('0x2f')](handleError(_0x1dbf9d,null));};exports[_0x661e('0x77')]=function(_0x23b586,_0x2248ae,_0x5b6883){var _0x1bbd5c={'body':_0x23b586[_0x661e('0x69')],'channel':'openchannel'};var _0x259bcd=[];var _0x55ff66=[];var _0x26ad83={};var _0x147f4d=![];return db[_0x661e('0x78')][_0x661e('0x6a')]()[_0x661e('0x3b')](function(_0x5dc8f5){if(!_0x5dc8f5){throw new db[(_0x661e('0x79'))][(_0x661e('0x7a'))](_0x661e('0x7b'));}_0x259bcd=_[_0x661e('0x7c')](_['keys'](_0x5dc8f5),[_0x661e('0x7d'),'updatedAt']);_0x55ff66=_[_0x661e('0x7c')](_['keys'](_0x5dc8f5),[_0x661e('0x7d'),_0x661e('0x7e'),'CompanyId',_0x661e('0x7f')]);if(_0x23b586['body']['id']){delete _0x23b586[_0x661e('0x69')]['id'];}if(_[_0x661e('0x80')](_0x23b586[_0x661e('0x69')]['from'])){throw new db['Sequelize']['ValidationError'](_0x661e('0x81'));}if(_[_0x661e('0x80')](_0x23b586[_0x661e('0x69')][_0x661e('0x69')])||_0x23b586[_0x661e('0x69')][_0x661e('0x69')]===''){throw new db[(_0x661e('0x79'))][(_0x661e('0x7a'))](_0x661e('0x82'));}if(_[_0x661e('0x80')](_0x23b586[_0x661e('0x69')]['mapKey'])){throw new db[(_0x661e('0x79'))][(_0x661e('0x7a'))](_0x661e('0x83')+_0x55ff66);}if(!_[_0x661e('0x84')](_0x55ff66,_0x23b586[_0x661e('0x69')][_0x661e('0x85')])){throw new db[(_0x661e('0x79'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55ff66);}_0x26ad83[_0x23b586[_0x661e('0x69')][_0x661e('0x85')]]=_0x23b586[_0x661e('0x69')][_0x661e('0x86')];})[_0x661e('0x3b')](function(){return db[_0x661e('0x47')][_0x661e('0x66')]({'where':{'id':_0x23b586[_0x661e('0x5f')]['id']},'include':[{'model':db[_0x661e('0x87')],'as':_0x661e('0x88'),'include':[{'model':db[_0x661e('0x78')],'as':_0x661e('0x89'),'where':_0x26ad83,'limit':0x1,'order':[['updatedAt',_0x661e('0x8a')]]}]},{'model':db['OpenchannelApplication'],'as':_0x661e('0x8b')}]});})[_0x661e('0x3b')](handleEntityNotFound(_0x2248ae,null))[_0x661e('0x3b')](function(_0x145261){if(_0x145261&&_0x145261[_0x661e('0x88')]){_0x1bbd5c[_0x661e('0x8c')]=_0x145261;_0x1bbd5c[_0x661e('0x8d')]=_0x145261[_0x661e('0x8b')];_0x1bbd5c[_0x661e('0x8e')]=_0x145261[_0x661e('0x88')];_0x1bbd5c[_0x661e('0x8d')]=_[_0x661e('0x8f')](_0x1bbd5c['applications'],['priority'],[_0x661e('0x90')]);if(_0x1bbd5c[_0x661e('0x8c')][_0x661e('0x8b')]){delete _0x1bbd5c[_0x661e('0x8c')][_0x661e('0x8b')];}if(_0x1bbd5c[_0x661e('0x8c')][_0x661e('0x88')]&&_0x1bbd5c[_0x661e('0x8c')][_0x661e('0x88')][_0x661e('0x89')]['length']){return _0x1bbd5c[_0x661e('0x8c')][_0x661e('0x88')]['Contacts'][0x0];}var _0x5a7184=_[_0x661e('0x1e')](_0x23b586[_0x661e('0x69')],{'firstName':_0x23b586[_0x661e('0x69')][_0x661e('0x86')],'ListId':_0x145261[_0x661e('0x7f')]});_0x5a7184[_0x23b586[_0x661e('0x69')][_0x661e('0x85')]]=_0x23b586['body'][_0x661e('0x86')];return db[_0x661e('0x78')][_0x661e('0x62')](_0x5a7184,{'fields':_0x259bcd,'raw':!![]});}})[_0x661e('0x3b')](handleEntityNotFound(_0x2248ae,null))['then'](function(_0x21fcd6){_0x1bbd5c[_0x661e('0x91')]=_0x21fcd6;if(_0x21fcd6){var _0x4e4816={'ContactId':_0x21fcd6['id'],'OpenchannelAccountId':_0x23b586[_0x661e('0x5f')]['id'],'from':(_0x21fcd6['firstName']||'')+'\x20'+(_0x21fcd6['lastName']||'')};var _0x4902b8={'OpenchannelAccountId':_0x23b586[_0x661e('0x5f')]['id'],'closed':![]};if(_0x23b586[_0x661e('0x69')]['threadId']){_0x4902b8[_0x661e('0x92')]=_0x23b586['body'][_0x661e('0x92')];return db[_0x661e('0x93')][_0x661e('0x66')]({'where':_0x4902b8})[_0x661e('0x3b')](function(_0x823365){if(_0x823365){return[_0x823365,![]];}_0x4e4816[_0x661e('0x92')]=_0x23b586['body'][_0x661e('0x92')];_0x4e4816['externalUrl']=_0x23b586['body'][_0x661e('0x94')];return db[_0x661e('0x93')]['create'](_0x4e4816)['then'](function(_0x1f35ac){return[_0x1f35ac,!![]];});});}else{_0x4902b8['threadId']=null;}_0x4902b8['ContactId']=_0x21fcd6['id'];return db[_0x661e('0x93')][_0x661e('0x66')]({'where':_0x4902b8})[_0x661e('0x3b')](function(_0xe999e3){if(_0xe999e3){return[_0xe999e3,![]];}return db[_0x661e('0x93')][_0x661e('0x62')](_0x4e4816)[_0x661e('0x3b')](function(_0x4d99a1){return[_0x4d99a1,!![]];});});}})[_0x661e('0x95')](function(_0x3a07a0,_0x835fe1){if(_0x3a07a0){_0x147f4d=_0x835fe1;if(!_0x835fe1){var _0x58a840={'from':(_0x1bbd5c['contact']['firstName']||'')+'\x20'+(_0x1bbd5c[_0x661e('0x91')][_0x661e('0x96')]||'')};if(_0x23b586[_0x661e('0x69')][_0x661e('0x92')]&&_0x23b586[_0x661e('0x69')]['messageId']&&_0x23b586['body'][_0x661e('0x92')]!=_0x23b586[_0x661e('0x69')][_0x661e('0x97')]){_0x58a840[_0x661e('0x92')]=_0x23b586[_0x661e('0x69')][_0x661e('0x97')];}return _0x3a07a0['update'](_0x58a840);}else{return _0x3a07a0;}}})[_0x661e('0x3b')](function(_0x11fb3b){_0x1bbd5c[_0x661e('0x98')]=_0x11fb3b['get']({'plain':!![]});_0x1bbd5c['interaction'][_0x661e('0x99')]=_0x147f4d;if(_0x1bbd5c[_0x661e('0x98')][_0x661e('0x99')]){if(_0x1bbd5c[_0x661e('0x8c')][_0x661e('0x9a')]){_0x1bbd5c[_0x661e('0x8d')][_0x661e('0x9b')]({'id':0x0,'priority':_0x1bbd5c[_0x661e('0x8d')][_0x661e('0x61')]+0x1,'app':_0x661e('0x9c'),'appdata':_0x661e('0x9d'),'interval':_0x661e('0x9e')});}}return db[_0x661e('0x9f')][_0x661e('0x62')]({'body':_0x23b586['body']['body'],'OpenchannelAccountId':_0x23b586['params']['id'],'OpenchannelInteractionId':_0x11fb3b['id'],'direction':'in','ContactId':_0x1bbd5c[_0x661e('0x91')]['id'],'AttachmentId':_0x23b586[_0x661e('0x69')]['AttachmentId']});})[_0x661e('0x3b')](function(_0x5e31e2){_0x1bbd5c[_0x661e('0x2e')]=_0x5e31e2;if(_0x1bbd5c[_0x661e('0x98')]['UserId']){return db[_0x661e('0xa0')][_0x661e('0x66')]({'attributes':['id',_0x661e('0x42')],'where':{'id':_0x1bbd5c[_0x661e('0x98')]['UserId']}})['then'](function(_0x215403){if(_0x215403){_0x1bbd5c[_0x661e('0x8d')][_0x661e('0xa1')]({'id':0x0,'priority':0x0,'app':_0x661e('0xa2'),'appdata':_0x215403['name']+','+(_0x1bbd5c[_0x661e('0x8c')][_0x661e('0xa3')]||0xa),'interval':'*,*,*,*'});_0x1bbd5c[_0x661e('0xa4')]=![];}return respondWithRpcPromise(_0x661e('0xa5'),_0x661e('0xa6'),_0x1bbd5c);});}return respondWithRpcPromise('Start','startRouting',_0x1bbd5c);})[_0x661e('0x3b')](function(_0x2d6131){respondWithRpcPromise(_0x661e('0xa7'),_0x661e('0xa7'),{'event':_0x661e('0x77'),'message':_0x2d6131},client9002);return _0x2d6131;})[_0x661e('0x3b')](respondWithResult(_0x2248ae,null))['catch'](handleError(_0x2248ae,null));};exports[_0x661e('0xa8')]=function(_0x52e31a,_0x38986d){var _0x33488b=_0x52e31a['params']['id'];var _0x3632bf=_0x52e31a[_0x661e('0x69')];var _0x2801fa=0xc8;var _0x39b494=null;return db['sequelize'][_0x661e('0xa9')]({'isolationLevel':db[_0x661e('0xaa')][_0x661e('0xab')][_0x661e('0xac')]['READ_COMMITTED']},function(_0x39b992){return db['OpenchannelAccount'][_0x661e('0x6f')]({'where':{'id':_0x33488b},'transaction':_0x39b992})[_0x661e('0x3b')](function(_0x22be32){if(_0x22be32){return db[_0x661e('0xad')]['destroy']({'where':{'OpenchannelAccountId':_0x33488b},'transaction':_0x39b992})[_0x661e('0x3b')](function(){var _0x5f4b38=_[_0x661e('0x46')](_0x3632bf,function(_0x3212d1){_0x3212d1[_0x661e('0x6c')]=_0x33488b;return _0x3212d1;});return db['OpenchannelApplication'][_0x661e('0xae')](_0x5f4b38,{'transaction':_0x39b992});});}else{_0x2801fa=0x194;_0x39b494=[];}});})[_0x661e('0x3b')](function(){if(_0x2801fa!==0x194){return db['OpenchannelApplication'][_0x661e('0xaf')]({'where':{'OpenchannelAccountId':_0x33488b},'order':_0x661e('0xb0')})[_0x661e('0x3b')](function(_0x11d9e6){_0x39b494=_0x11d9e6;});}})[_0x661e('0x2f')](function(_0x6518c6){_0x2801fa=0x1f4;logger[_0x661e('0x2c')](_0x6518c6[_0x661e('0x41')]);if(_0x6518c6[_0x661e('0x42')]){delete _0x6518c6[_0x661e('0x42')];}_0x39b494=_0x6518c6;})[_0x661e('0xb1')](function(){if(_0x39b494===null){_0x38986d['sendStatus'](_0x2801fa);}else{if(_0x2801fa===0x1f4){_0x38986d['status'](_0x2801fa)[_0x661e('0x43')](_0x39b494);}else{_0x38986d[_0x661e('0x3f')](_0x2801fa)[_0x661e('0x36')](_0x39b494);}}});};exports[_0x661e('0xb2')]=function(_0xf66aa2,_0xaf31c1,_0x25c250){var _0x5d9e10={};var _0x42ad5a={};var _0xb969c3;var _0x166553;return db['OpenchannelAccount'][_0x661e('0x6f')]({'where':{'id':_0xf66aa2[_0x661e('0x5f')]['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0xaf31c1,null))[_0x661e('0x3b')](function(_0x1800d7){if(_0x1800d7){_0xb969c3=_0x1800d7;_0x42ad5a[_0x661e('0x4b')]=_['keys'](db[_0x661e('0xad')][_0x661e('0x48')]);_0x42ad5a['query']=_[_0x661e('0x4d')](_0xf66aa2[_0x661e('0x4c')]);_0x42ad5a['filters']=_[_0x661e('0x4e')](_0x42ad5a[_0x661e('0x4b')],_0x42ad5a[_0x661e('0x4c')]);_0x5d9e10['attributes']=_['intersection'](_0x42ad5a['model'],qs[_0x661e('0x50')](_0xf66aa2[_0x661e('0x4c')][_0x661e('0x50')]));_0x5d9e10[_0x661e('0x4f')]=_0x5d9e10[_0x661e('0x4f')][_0x661e('0x61')]?_0x5d9e10[_0x661e('0x4f')]:_0x42ad5a['model'];_0x5d9e10[_0x661e('0x52')]=qs[_0x661e('0x53')](_0xf66aa2['query'][_0x661e('0x53')]);_0x5d9e10[_0x661e('0x54')]=qs[_0x661e('0x56')](_[_0x661e('0x55')](_0xf66aa2[_0x661e('0x4c')],_0x42ad5a[_0x661e('0x56')]));if(_0xf66aa2['query']['filter']){_0x5d9e10[_0x661e('0x54')]=_[_0x661e('0x57')](_0x5d9e10['where'],{'$or':_[_0x661e('0x46')](_0x5d9e10[_0x661e('0x4f')],function(_0xe02ff){var _0x5226b6={};_0x5226b6[_0xe02ff]={'$like':'%'+_0xf66aa2['query'][_0x661e('0x59')]+'%'};return _0x5226b6;})});}_0x5d9e10=_[_0x661e('0x57')]({},_0x5d9e10,_0xf66aa2[_0x661e('0x5a')]);return _0xb969c3['getApplications'](_0x5d9e10);}})[_0x661e('0x3b')](function(_0x34292f){if(_0x34292f){_0x166553=_0x34292f[_0x661e('0x61')];if(!_0xf66aa2[_0x661e('0x4c')][_0x661e('0x70')](_0x661e('0x51'))){_0x5d9e10['limit']=qs[_0x661e('0x32')](_0xf66aa2[_0x661e('0x4c')][_0x661e('0x32')]);_0x5d9e10[_0x661e('0x34')]=qs[_0x661e('0x34')](_0xf66aa2[_0x661e('0x4c')]['offset']);}return _0xb969c3[_0x661e('0xb2')](_0x5d9e10);}})['then'](function(_0x23384d){if(_0x23384d){return _0x23384d?{'count':_0x166553,'rows':_0x23384d}:null;}})[_0x661e('0x3b')](respondWithResult(_0xaf31c1,null))[_0x661e('0x2f')](handleError(_0xaf31c1,null));};exports[_0x661e('0xb3')]=function(_0x32256f,_0x34a290,_0x4667b1){var _0x2d9f7c={'raw':![],'where':{}};var _0x26b916={};var _0x25543a={'count':0x0,'rows':[]};return db[_0x661e('0x47')]['findOne']({'where':{'id':_0x32256f[_0x661e('0x5f')]['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0x34a290,null))['then'](function(_0x30ff79){if(_0x30ff79){_0x26b916[_0x661e('0x4b')]=_[_0x661e('0x4d')](db[_0x661e('0x93')][_0x661e('0x48')]);_0x26b916[_0x661e('0x4c')]=_[_0x661e('0x4d')](_0x32256f[_0x661e('0x4c')]);_0x26b916['filters']=_['intersection'](_0x26b916[_0x661e('0x4b')],_0x26b916['query']);_0x2d9f7c[_0x661e('0x4f')]=_[_0x661e('0x4e')](_0x26b916[_0x661e('0x4b')],qs['fields'](_0x32256f[_0x661e('0x4c')][_0x661e('0x50')]));_0x2d9f7c[_0x661e('0x4f')]=_0x2d9f7c['attributes'][_0x661e('0x61')]?_0x2d9f7c[_0x661e('0x4f')]:_0x26b916[_0x661e('0x4b')];if(!_0x32256f[_0x661e('0x4c')][_0x661e('0x70')](_0x661e('0x51'))){_0x2d9f7c['limit']=qs[_0x661e('0x32')](_0x32256f[_0x661e('0x4c')][_0x661e('0x32')]);_0x2d9f7c[_0x661e('0x34')]=qs[_0x661e('0x34')](_0x32256f[_0x661e('0x4c')][_0x661e('0x34')]);}_0x2d9f7c['order']=qs[_0x661e('0x53')](_0x32256f[_0x661e('0x4c')][_0x661e('0x53')]);_0x2d9f7c[_0x661e('0x54')]=qs['filters'](_[_0x661e('0x55')](_0x32256f['query'],_0x26b916[_0x661e('0x56')]));_0x2d9f7c[_0x661e('0x54')][_0x661e('0x6c')]=_0x30ff79['id'];if(_0x32256f[_0x661e('0x4c')][_0x661e('0x59')]){_0x2d9f7c[_0x661e('0x54')]=_[_0x661e('0x57')](_0x2d9f7c[_0x661e('0x54')],{'$or':_[_0x661e('0x46')](_0x2d9f7c['attributes'],function(_0x29f2aa){var _0x4d0ed8={};_0x4d0ed8[_0x29f2aa]={'$like':'%'+_0x32256f[_0x661e('0x4c')][_0x661e('0x59')]+'%'};return _0x4d0ed8;})});}_0x2d9f7c=_[_0x661e('0x57')]({},_0x2d9f7c,_0x32256f['options']);return db[_0x661e('0x93')][_0x661e('0x33')]({'where':_0x2d9f7c['where']})[_0x661e('0x3b')](function(_0x518633){_0x25543a['count']=_0x518633;if(_0x32256f[_0x661e('0x4c')][_0x661e('0x5b')]){_0x2d9f7c[_0x661e('0x5c')]=[{'model':db[_0x661e('0x78')],'as':_0x661e('0xb4'),'required':![]},{'model':db[_0x661e('0xa0')],'as':_0x661e('0xb5'),'attributes':[_0x661e('0x42'),'fullname',_0x661e('0xb6')],'required':![]},{'model':db[_0x661e('0xb7')],'as':_0x661e('0xb8'),'attributes':['id',_0x661e('0x42'),_0x661e('0xb9')],'where':_0x32256f[_0x661e('0x4c')]['tag']?{'id':_0x32256f['query']['tag']}:undefined,'required':_0x32256f['query'][_0x661e('0xba')]?!![]:![]}];}return db[_0x661e('0x93')]['findAll'](_0x2d9f7c);})[_0x661e('0x3b')](function(_0x5b08f6){_0x25543a[_0x661e('0x5d')]=_0x5b08f6;return _0x25543a;});}})[_0x661e('0x3b')](respondWithFilteredResult(_0x34a290,_0x2d9f7c))[_0x661e('0x2f')](handleError(_0x34a290,null));};exports['addAgents']=function(_0x33d8dc,_0xf6889d,_0x49e76f){return db[_0x661e('0x47')]['find']({'where':{'id':_0x33d8dc[_0x661e('0x5f')]['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0xf6889d,null))[_0x661e('0x3b')](function(_0x122db9){if(_0x122db9){return _0x122db9['addAgents'](_0x33d8dc[_0x661e('0x69')][_0x661e('0x73')],_[_0x661e('0xbb')](_0x33d8dc[_0x661e('0x69')],['ids','id'])||{})[_0x661e('0x95')](function(_0x36a3f7){for(var _0x4f0fa4=0x0;_0x4f0fa4<_0x33d8dc['body'][_0x661e('0x73')][_0x661e('0x61')];_0x4f0fa4+=0x1){socket[_0x661e('0xbc')](_0x661e('0xbd'),{'UserId':Number(_0x33d8dc['body'][_0x661e('0x73')][_0x4f0fa4]),'OpenchannelAccountId':Number(_0x33d8dc['params']['id'])});}return _0x36a3f7;});}})[_0x661e('0x3b')](respondWithResult(_0xf6889d,null))[_0x661e('0x2f')](handleError(_0xf6889d,null));};exports['removeAgents']=function(_0x5767a1,_0x46b7de,_0xa89d89){return db[_0x661e('0x47')]['find']({'where':{'id':_0x5767a1[_0x661e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x46b7de,null))[_0x661e('0x3b')](function(_0x2a0e53){if(_0x2a0e53){return _0x2a0e53[_0x661e('0xbe')](_0x5767a1['query'][_0x661e('0x73')])['then'](function(){if(_['isArray'](_0x5767a1[_0x661e('0x4c')][_0x661e('0x73')])){for(var _0x26fa79=0x0;_0x26fa79<_0x5767a1[_0x661e('0x4c')][_0x661e('0x73')][_0x661e('0x61')];_0x26fa79+=0x1){socket[_0x661e('0xbc')](_0x661e('0xbf'),{'UserId':Number(_0x5767a1[_0x661e('0x4c')][_0x661e('0x73')][_0x26fa79]),'OpenchannelAccountId':Number(_0x5767a1['params']['id'])});}}else{socket[_0x661e('0xbc')](_0x661e('0xbf'),{'UserId':Number(_0x5767a1[_0x661e('0x4c')]['ids']),'OpenchannelAccountId':Number(_0x5767a1[_0x661e('0x5f')]['id'])});}});}})[_0x661e('0x3b')](respondWithStatusCode(_0x46b7de,null))['catch'](handleError(_0x46b7de,null));};exports[_0x661e('0xc0')]=function(_0x576564,_0x36ba96,_0x53c1d3){var _0x45581c={};var _0xa9f13c={};var _0x5335f0;var _0x50aaf3;return db[_0x661e('0x47')][_0x661e('0x6f')]({'where':{'id':_0x576564[_0x661e('0x5f')]['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0x36ba96,null))[_0x661e('0x3b')](function(_0x446a44){if(_0x446a44){_0x5335f0=_0x446a44;_0xa9f13c[_0x661e('0x4b')]=_[_0x661e('0x4d')](db[_0x661e('0xa0')][_0x661e('0x48')]);_0xa9f13c[_0x661e('0x4c')]=_['keys'](_0x576564[_0x661e('0x4c')]);_0xa9f13c[_0x661e('0x56')]=_[_0x661e('0x4e')](_0xa9f13c[_0x661e('0x4b')],_0xa9f13c[_0x661e('0x4c')]);_0x45581c[_0x661e('0x4f')]=_[_0x661e('0x4e')](_0xa9f13c[_0x661e('0x4b')],qs[_0x661e('0x50')](_0x576564[_0x661e('0x4c')]['fields']));_0x45581c['attributes']=_0x45581c['attributes'][_0x661e('0x61')]?_0x45581c[_0x661e('0x4f')]:_0xa9f13c[_0x661e('0x4b')];_0x45581c['order']=qs[_0x661e('0x53')](_0x576564[_0x661e('0x4c')][_0x661e('0x53')]);_0x45581c['where']=qs['filters'](_[_0x661e('0x55')](_0x576564['query'],_0xa9f13c[_0x661e('0x56')]));if(_0x576564['query'][_0x661e('0x59')]){_0x45581c['where']=_[_0x661e('0x57')](_0x45581c[_0x661e('0x54')],{'$or':_['map'](_0x45581c['attributes'],function(_0x12dc00){var _0x385004={};_0x385004[_0x12dc00]={'$like':'%'+_0x576564[_0x661e('0x4c')][_0x661e('0x59')]+'%'};return _0x385004;})});}_0x45581c=_[_0x661e('0x57')]({},_0x45581c,_0x576564[_0x661e('0x5a')]);return _0x5335f0[_0x661e('0xc0')](_0x45581c);}})['then'](function(_0x312244){if(_0x312244){_0x50aaf3=_0x312244[_0x661e('0x61')];if(!_0x576564[_0x661e('0x4c')]['hasOwnProperty'](_0x661e('0x51'))){_0x45581c[_0x661e('0x32')]=qs[_0x661e('0x32')](_0x576564[_0x661e('0x4c')][_0x661e('0x32')]);_0x45581c['offset']=qs[_0x661e('0x34')](_0x576564[_0x661e('0x4c')][_0x661e('0x34')]);}return _0x5335f0[_0x661e('0xc0')](_0x45581c);}})[_0x661e('0x3b')](function(_0x5808b3){if(_0x5808b3){return _0x5808b3?{'count':_0x50aaf3,'rows':_0x5808b3}:null;}})['then'](respondWithResult(_0x36ba96,null))[_0x661e('0x2f')](handleError(_0x36ba96,null));};exports[_0x661e('0x43')]=function(_0x52ae63,_0x54f67f,_0x1617b2){var _0x5442aa,_0x5bf771,_0x31fdfe;if(_['isNil'](_0x52ae63[_0x661e('0x69')]['body'])||_0x52ae63['body'][_0x661e('0x69')]===''){throw new db[(_0x661e('0x79'))][(_0x661e('0x7a'))](_0x661e('0x82'));}if(_[_0x661e('0x80')](_0x52ae63[_0x661e('0x69')]['to'])){}_0x5442aa=_0x52ae63[_0x661e('0x69')]['to'];return db[_0x661e('0x47')][_0x661e('0x6f')]({'where':{'id':_0x52ae63[_0x661e('0x5f')]['id']}})[_0x661e('0x3b')](handleEntityNotFound(_0x54f67f,null))[_0x661e('0x3b')](function(_0x3bc5a2){if(_0x3bc5a2){return db[_0x661e('0x47')][_0x661e('0x66')]({'where':{'id':_0x3bc5a2['id']},'include':[{'model':db[_0x661e('0x87')],'as':'List','include':[{'model':db[_0x661e('0x78')],'as':_0x661e('0x89'),'where':{[_0x3bc5a2[_0x661e('0x85')]]:_0x5442aa},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x661e('0x3b')](handleEntityNotFound(_0x54f67f,null))['then'](function(_0x361b2a){if(_0x361b2a&&_0x361b2a['List']){_0x5bf771=_0x361b2a[_0x661e('0x3c')]({'plain':!![]});if(_0x5bf771[_0x661e('0x88')]&&_0x5bf771[_0x661e('0x88')][_0x661e('0x89')][_0x661e('0x61')]){return _0x5bf771[_0x661e('0x88')][_0x661e('0x89')][0x0];}return db[_0x661e('0x78')][_0x661e('0x62')](_[_0x661e('0x1e')](_0x52ae63['body'],{'firstName':_0x5442aa,[_0x361b2a[_0x661e('0x85')]]:_0x5442aa,'phone':_0x5442aa,'ListId':_0x5bf771['ListId']}));}})[_0x661e('0x3b')](handleEntityNotFound(_0x54f67f,null))[_0x661e('0x3b')](function(_0x472a53){if(_0x472a53){_0x31fdfe=_0x472a53;return db[_0x661e('0x93')]['find']({'where':{'ContactId':_0x31fdfe['id'],'closed':![],'OpenchannelAccountId':_0x5bf771['id']}})[_0x661e('0x3b')](function(_0x446723){if(_0x446723){return[_0x446723,![]];}return db[_0x661e('0x93')][_0x661e('0x62')]({'UserId':_0x52ae63[_0x661e('0x63')]['id'],'ContactId':_0x31fdfe['id'],'OpenchannelAccountId':_0x5bf771['id'],'lastMsgDirection':_0x661e('0xc1'),'firstMsgDirection':_0x661e('0xc1'),'Messages':[_['merge'](_0x52ae63[_0x661e('0x69')],{'read':![],'body':_0x52ae63[_0x661e('0x69')][_0x661e('0x69')],'OpenchannelAccountId':_0x5bf771['id'],'UserId':_0x52ae63[_0x661e('0x63')]['id'],'ContactId':_0x31fdfe['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x661e('0xc2')}]})[_0x661e('0x3b')](function(_0x39b03d){return[_0x39b03d,!![]];});});}})[_0x661e('0x95')](function(_0x175375,_0x20e092){if(_0x20e092){return _0x175375;}return db[_0x661e('0x9f')][_0x661e('0x62')](_['merge'](_0x52ae63['body'],{'read':![],'body':_0x52ae63[_0x661e('0x69')][_0x661e('0x69')],'OpenchannelAccountId':_0x5bf771['id'],'OpenchannelInteractionId':_0x175375['id'],'UserId':_0x52ae63[_0x661e('0x63')]['id'],'ContactId':_0x31fdfe['id']}))[_0x661e('0x3b')](function(_0x104f20){_0x175375['dataValues'][_0x661e('0xc2')]=[];_0x175375['dataValues'][_0x661e('0xc2')][_0x661e('0x9b')](_0x104f20['dataValues']);return _0x175375;});});}})[_0x661e('0x3b')](respondWithResult(_0x54f67f,null))[_0x661e('0x2f')](handleError(_0x54f67f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 908f25f..7c3f86a 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 _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x1b5147,_0x328d3d){var _0x681b8c=function(_0x3041c6){while(--_0x3041c6){_0x1b5147['push'](_0x1b5147['shift']());}};_0x681b8c(++_0x328d3d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x7f407,_0x433539){_0x7f407=_0x7f407-0x0;var _0x2d82ca=_0xf4eb[_0x7f407];return _0x2d82ca;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];OpenchannelAccount[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xee5b=['remove','emit','hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x15659a,_0x2d0f91){var _0x228ac9=function(_0x3885b0){while(--_0x3885b0){_0x15659a['push'](_0x15659a['shift']());}};_0x228ac9(++_0x2d0f91);}(_0xee5b,0x1f4));var _0xbee5=function(_0x53b2a3,_0x4057a3){_0x53b2a3=_0x53b2a3-0x0;var _0x5de557=_0xee5b[_0x53b2a3];return _0x5de557;};'use strict';var EventEmitter=require(_0xbee5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xbee5('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbee5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbee5('0x3'),'afterDestroy':_0xbee5('0x4')};function emitEvent(_0x2eb857){return function(_0x210159,_0x4bd202,_0x5200b1){OpenchannelAccountEvents[_0xbee5('0x5')](_0x2eb857+':'+_0x210159['id'],_0x210159);OpenchannelAccountEvents[_0xbee5('0x5')](_0x2eb857,_0x210159);_0x5200b1(null);};}for(var e in events){if(events[_0xbee5('0x6')](e)){var event=events[e];OpenchannelAccount[_0xbee5('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4db67a8..d9fe5c9 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(_0x495e49,_0x10d4c8){var _0x5815c1=function(_0x112774){while(--_0x112774){_0x495e49['push'](_0x495e49['shift']());}};_0x5815c1(++_0x10d4c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0xc32c96,_0x2f698a){var _0xc28353=function(_0x2f798a){while(--_0x2f798a){_0xc32c96['push'](_0xc32c96['shift']());}};_0xc28353(++_0x2f698a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 dbaf116..215fdeb 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 _0x9d9b=['./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x6ec29c,_0x160f92){var _0xd0275b=function(_0x10800c){while(--_0x10800c){_0x6ec29c['push'](_0x6ec29c['shift']());}};_0xd0275b(++_0x160f92);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x5b2682,_0x24b4ce){_0x5b2682=_0x5b2682-0x0;var _0x30967f=_0x9d9b[_0x5b2682];return _0x30967f;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var moment=require(_0xb9d9('0x1'));var BPromise=require('bluebird');var rs=require(_0xb9d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9d9('0x3'))['db'];var utils=require(_0xb9d9('0x4'));var logger=require(_0xb9d9('0x5'))('rpc');var config=require(_0xb9d9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb9d9('0x7')][_0xb9d9('0x8')]({'port':0x232a});config['redis']=_[_0xb9d9('0x9')](config[_0xb9d9('0xa')],{'host':_0xb9d9('0xb'),'port':0x18eb});var socket=require(_0xb9d9('0xc'))(new Redis(config[_0xb9d9('0xa')]));require(_0xb9d9('0xd'))[_0xb9d9('0xe')](socket);function respondWithRpcPromise(_0x5a9c18,_0x5b591e,_0x5f14e7){return new BPromise(function(_0x4cde40,_0x45f507){return client[_0xb9d9('0xf')](_0x5a9c18,_0x5f14e7)[_0xb9d9('0x10')](function(_0x5e226e){logger[_0xb9d9('0x11')](_0xb9d9('0x12'),_0x5b591e,'request\x20sent');logger[_0xb9d9('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5b591e,_0xb9d9('0x14'),JSON[_0xb9d9('0x15')](_0x5e226e));if(_0x5e226e[_0xb9d9('0x16')]){if(_0x5e226e[_0xb9d9('0x16')][_0xb9d9('0x17')]===0x1f4){logger[_0xb9d9('0x16')](_0xb9d9('0x12'),_0x5b591e,_0x5e226e[_0xb9d9('0x16')]['message']);return _0x45f507(_0x5e226e['error'][_0xb9d9('0x18')]);}logger[_0xb9d9('0x16')](_0xb9d9('0x12'),_0x5b591e,_0x5e226e[_0xb9d9('0x16')]['message']);return _0x4cde40(_0x5e226e['error'][_0xb9d9('0x18')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5b591e,_0xb9d9('0x14'));_0x4cde40(_0x5e226e[_0xb9d9('0x19')][_0xb9d9('0x18')]);}})['catch'](function(_0x473b89){logger[_0xb9d9('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b591e,_0x473b89);_0x45f507(_0x473b89);});});} \ No newline at end of file +var _0x0972=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0972,0x64));var _0x2097=function(_0x42e651,_0x21333a){_0x42e651=_0x42e651-0x0;var _0x59ac17=_0x0972[_0x42e651];return _0x59ac17;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});config[_0x2097('0xa')]=_['defaults'](config[_0x2097('0xa')],{'host':_0x2097('0xb'),'port':0x18eb});var socket=require(_0x2097('0xc'))(new Redis(config[_0x2097('0xa')]));require(_0x2097('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e0024,_0x3b8b76,_0x131f06){return new BPromise(function(_0x430754,_0x7baeb3){return client[_0x2097('0xe')](_0x2e0024,_0x131f06)[_0x2097('0xf')](function(_0x1d1166){logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));logger[_0x2097('0x13')](_0x2097('0x14'),_0x3b8b76,_0x2097('0x12'),JSON[_0x2097('0x15')](_0x1d1166));if(_0x1d1166[_0x2097('0x16')]){if(_0x1d1166[_0x2097('0x16')][_0x2097('0x17')]===0x1f4){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x1d1166['error'][_0x2097('0x18')]);return _0x7baeb3(_0x1d1166[_0x2097('0x16')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3b8b76,_0x1d1166[_0x2097('0x16')]['message']);return _0x430754(_0x1d1166[_0x2097('0x16')][_0x2097('0x18')]);}else{logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));_0x430754(_0x1d1166['result'][_0x2097('0x18')]);}})[_0x2097('0x19')](function(_0x451584){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x451584);_0x7baeb3(_0x451584);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ab143cf..b744f1d 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 _0x885e=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit'];(function(_0x42e06a,_0x2f5fd1){var _0x3d3c90=function(_0xbd9403){while(--_0xbd9403){_0x42e06a['push'](_0x42e06a['shift']());}};_0x3d3c90(++_0x2f5fd1);}(_0x885e,0xe4));var _0xe885=function(_0x40b954,_0x59367b){_0x40b954=_0x40b954-0x0;var _0x4b6dd0=_0x885e[_0x40b954];return _0x4b6dd0;};'use strict';var OpenchannelAccountEvents=require(_0xe885('0x0'));var events=[_0xe885('0x1'),'remove',_0xe885('0x2')];function createListener(_0x1cd11a,_0x162982){return function(_0xfea0bc){_0x162982[_0xe885('0x3')](_0x1cd11a,_0xfea0bc);};}function removeListener(_0x4fcd9b,_0x499ab6){return function(){OpenchannelAccountEvents[_0xe885('0x4')](_0x4fcd9b,_0x499ab6);};}exports[_0xe885('0x5')]=function(_0x33286a){for(var _0x1a5fd6=0x0,_0x55d2b2=events[_0xe885('0x6')];_0x1a5fd6<_0x55d2b2;_0x1a5fd6++){var _0x597bdc=events[_0x1a5fd6];var _0x2e8fe0=createListener(_0xe885('0x7')+_0x597bdc,_0x33286a);OpenchannelAccountEvents['on'](_0x597bdc,_0x2e8fe0);}}; \ No newline at end of file +var _0xfdb5=['remove','register','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x1fa434,_0x409998){var _0x113d6c=function(_0x58353c){while(--_0x58353c){_0x1fa434['push'](_0x1fa434['shift']());}};_0x113d6c(++_0x409998);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfdb5[_0x2c91e9];return _0x13f0ff;};'use strict';var OpenchannelAccountEvents=require(_0x5fdb('0x0'));var events=[_0x5fdb('0x1'),_0x5fdb('0x2'),'update'];function createListener(_0x190bc2,_0x3067fa){return function(_0x7da3ba){_0x3067fa['emit'](_0x190bc2,_0x7da3ba);};}function removeListener(_0x55124b,_0x3ff059){return function(){OpenchannelAccountEvents['removeListener'](_0x55124b,_0x3ff059);};}exports[_0x5fdb('0x3')]=function(_0x4a2149){for(var _0x1b0148=0x0,_0xda053e=events['length'];_0x1b0148<_0xda053e;_0x1b0148++){var _0x542bbc=events[_0x1b0148];var _0x5a556e=createListener(_0x5fdb('0x4')+_0x542bbc,_0x4a2149);OpenchannelAccountEvents['on'](_0x542bbc,_0x5a556e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9563102..cb41762 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 _0x8856=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','multer','util','path'];(function(_0xf6dd18,_0x4dbf7b){var _0x3ad2eb=function(_0x3ca093){while(--_0x3ca093){_0xf6dd18['push'](_0xf6dd18['shift']());}};_0x3ad2eb(++_0x4dbf7b);}(_0x8856,0x89));var _0x6885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8856[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6885('0x0'));var util=require(_0x6885('0x1'));var path=require(_0x6885('0x2'));var timeout=require(_0x6885('0x3'));var express=require(_0x6885('0x4'));var router=express[_0x6885('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6885('0x6'));var interaction=require(_0x6885('0x7'));var config=require(_0x6885('0x8'));var controller=require(_0x6885('0x9'));router[_0x6885('0xa')]('/',auth[_0x6885('0xb')](),controller[_0x6885('0xc')]);router[_0x6885('0xa')]('/:id',auth[_0x6885('0xb')](),controller[_0x6885('0xd')]);router[_0x6885('0xe')]('/',auth['isAuthenticated'](),controller[_0x6885('0xf')]);router[_0x6885('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6885('0x11')](_0x6885('0x12'),auth['isAuthenticated'](),controller[_0x6885('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc33b=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x545ce3,_0x5eb428){var _0x5a0794=function(_0x444622){while(--_0x444622){_0x545ce3['push'](_0x545ce3['shift']());}};_0x5a0794(++_0x5eb428);}(_0xc33b,0x1aa));var _0xbc33=function(_0xfb2fdf,_0x3a5759){_0xfb2fdf=_0xfb2fdf-0x0;var _0x3cef7d=_0xc33b[_0xfb2fdf];return _0x3cef7d;};'use strict';var multer=require('multer');var util=require(_0xbc33('0x0'));var path=require(_0xbc33('0x1'));var timeout=require(_0xbc33('0x2'));var express=require(_0xbc33('0x3'));var router=express['Router']();var fs_extra=require(_0xbc33('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbc33('0x5'));var config=require(_0xbc33('0x6'));var controller=require(_0xbc33('0x7'));router[_0xbc33('0x8')]('/',auth[_0xbc33('0x9')](),controller['index']);router[_0xbc33('0x8')](_0xbc33('0xa'),auth[_0xbc33('0x9')](),controller[_0xbc33('0xb')]);router[_0xbc33('0xc')]('/',auth[_0xbc33('0x9')](),controller[_0xbc33('0xd')]);router[_0xbc33('0xe')](_0xbc33('0xa'),auth['isAuthenticated'](),controller[_0xbc33('0xf')]);router[_0xbc33('0x10')](_0xbc33('0xa'),auth[_0xbc33('0x9')](),controller['destroy']);module[_0xbc33('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 34afc68..e5627a2 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 _0x1cd1=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x170cb3,_0x5b4003){var _0x223a44=function(_0x135e11){while(--_0x135e11){_0x170cb3['push'](_0x170cb3['shift']());}};_0x223a44(++_0x5b4003);}(_0x1cd1,0xa9));var _0x11cd=function(_0x5edfb6,_0x2279c4){_0x5edfb6=_0x5edfb6-0x0;var _0x3f909f=_0x1cd1[_0x5edfb6];return _0x3f909f;};'use strict';var Sequelize=require(_0x11cd('0x0'));module['exports']={'priority':{'type':Sequelize[_0x11cd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x11cd('0x2')],'allowNull':![],'defaultValue':_0x11cd('0x3')},'appdata':{'type':Sequelize[_0x11cd('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x11cd('0x2')],'defaultValue':_0x11cd('0x5')}}; \ No newline at end of file +var _0x2e7f=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x1a6d8f,_0x190aaf){var _0x4bcf4d=function(_0x6c4c55){while(--_0x6c4c55){_0x1a6d8f['push'](_0x1a6d8f['shift']());}};_0x4bcf4d(++_0x190aaf);}(_0x2e7f,0x195));var _0xf2e7=function(_0x1ae723,_0x69cc98){_0x1ae723=_0x1ae723-0x0;var _0x1aefba=_0x2e7f[_0x1ae723];return _0x1aefba;};'use strict';var Sequelize=require(_0xf2e7('0x0'));module[_0xf2e7('0x1')]={'priority':{'type':Sequelize[_0xf2e7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf2e7('0x3')],'allowNull':![],'defaultValue':_0xf2e7('0x4')},'appdata':{'type':Sequelize[_0xf2e7('0x5')]()},'description':{'type':Sequelize[_0xf2e7('0x3')]},'interval':{'type':Sequelize[_0xf2e7('0x3')],'defaultValue':_0xf2e7('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 2d304b0..ef5c10e 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 _0x7b1f=['where','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','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','stack','name','send','index','map','OpenchannelApplication','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order'];(function(_0x396fd1,_0x11aa4f){var _0x167c00=function(_0x5c9db9){while(--_0x5c9db9){_0x396fd1['push'](_0x396fd1['shift']());}};_0x167c00(++_0x11aa4f);}(_0x7b1f,0x1b9));var _0xf7b1=function(_0x2b7312,_0x599b03){_0x2b7312=_0x2b7312-0x0;var _0x2a72c9=_0x7b1f[_0x2b7312];return _0x2a72c9;};'use strict';var emlformat=require(_0xf7b1('0x0'));var rimraf=require(_0xf7b1('0x1'));var zipdir=require(_0xf7b1('0x2'));var jsonpatch=require(_0xf7b1('0x3'));var rp=require(_0xf7b1('0x4'));var moment=require('moment');var BPromise=require(_0xf7b1('0x5'));var Mustache=require(_0xf7b1('0x6'));var util=require('util');var path=require(_0xf7b1('0x7'));var sox=require(_0xf7b1('0x8'));var csv=require('to-csv');var ejs=require(_0xf7b1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7b1('0xa'));var squel=require('squel');var crypto=require(_0xf7b1('0xb'));var jsforce=require(_0xf7b1('0xc'));var deskjs=require(_0xf7b1('0xd'));var toCsv=require(_0xf7b1('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf7b1('0xf'));var authService=require(_0xf7b1('0x10'));var qs=require(_0xf7b1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7b1('0x12'));var logger=require('../../config/logger')(_0xf7b1('0x13'));var utils=require(_0xf7b1('0x14'));var config=require(_0xf7b1('0x15'));var licenseUtil=require(_0xf7b1('0x16'));var db=require(_0xf7b1('0x17'))['db'];function respondWithStatusCode(_0x28709e,_0x466187){_0x466187=_0x466187||0xcc;return function(_0x1e9508){if(_0x1e9508){return _0x28709e[_0xf7b1('0x18')](_0x466187);}return _0x28709e[_0xf7b1('0x19')](_0x466187)[_0xf7b1('0x1a')]();};}function respondWithResult(_0x8a43ee,_0x29f2e4){_0x29f2e4=_0x29f2e4||0xc8;return function(_0xe7d425){if(_0xe7d425){return _0x8a43ee['status'](_0x29f2e4)[_0xf7b1('0x1b')](_0xe7d425);}};}function respondWithFilteredResult(_0x59f66b,_0xe8a7bf){return function(_0x203aac){if(_0x203aac){var _0x5ed388=typeof _0xe8a7bf['offset']===_0xf7b1('0x1c')&&typeof _0xe8a7bf[_0xf7b1('0x1d')]===_0xf7b1('0x1c');var _0x5d190b=_0x203aac[_0xf7b1('0x1e')];var _0x1d12bd=_0x5ed388?0x0:_0xe8a7bf[_0xf7b1('0x1f')];var _0xf61e28=_0x5ed388?_0x203aac[_0xf7b1('0x1e')]:_0xe8a7bf[_0xf7b1('0x1f')]+_0xe8a7bf[_0xf7b1('0x1d')];var _0x78bd43;if(_0xf61e28>=_0x5d190b){_0xf61e28=_0x5d190b;_0x78bd43=0xc8;}else{_0x78bd43=0xce;}_0x59f66b[_0xf7b1('0x19')](_0x78bd43);return _0x59f66b[_0xf7b1('0x20')](_0xf7b1('0x21'),_0x1d12bd+'-'+_0xf61e28+'/'+_0x5d190b)['json'](_0x203aac);}return null;};}function patchUpdates(_0x10bed4){return function(_0x182eb3){try{jsonpatch['apply'](_0x182eb3,_0x10bed4,!![]);}catch(_0x90abf9){return BPromise[_0xf7b1('0x22')](_0x90abf9);}return _0x182eb3[_0xf7b1('0x23')]();};}function saveUpdates(_0x7af80d,_0x1afbf7){return function(_0x4cbd45){if(_0x4cbd45){return _0x4cbd45[_0xf7b1('0x24')](_0x7af80d)[_0xf7b1('0x25')](function(_0x29767e){return _0x29767e;});}return null;};}function removeEntity(_0x4eb9f8,_0x39094c){return function(_0x4bcfe0){if(_0x4bcfe0){return _0x4bcfe0[_0xf7b1('0x26')]()['then'](function(){_0x4eb9f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdee9c5,_0x5ed7ce){return function(_0x1fbc39){if(!_0x1fbc39){_0xdee9c5[_0xf7b1('0x18')](0x194);}return _0x1fbc39;};}function handleError(_0x3d3ea7,_0x25d69b){_0x25d69b=_0x25d69b||0x1f4;return function(_0x4b3510){logger['error'](_0x4b3510[_0xf7b1('0x27')]);if(_0x4b3510[_0xf7b1('0x28')]){delete _0x4b3510[_0xf7b1('0x28')];}_0x3d3ea7[_0xf7b1('0x19')](_0x25d69b)[_0xf7b1('0x29')](_0x4b3510);};}exports[_0xf7b1('0x2a')]=function(_0x24336b,_0x2b7cf6){var _0x235969={},_0x1aff5f={},_0x2c07da={'count':0x0,'rows':[]};var _0x2e43f7=_[_0xf7b1('0x2b')](db[_0xf7b1('0x2c')]['rawAttributes'],function(_0x2c1e3e){return{'name':_0x2c1e3e[_0xf7b1('0x2d')],'type':_0x2c1e3e['type'][_0xf7b1('0x2e')]};});_0x1aff5f[_0xf7b1('0x2f')]=_['map'](_0x2e43f7,_0xf7b1('0x28'));_0x1aff5f[_0xf7b1('0x30')]=_[_0xf7b1('0x31')](_0x24336b[_0xf7b1('0x30')]);_0x1aff5f[_0xf7b1('0x32')]=_[_0xf7b1('0x33')](_0x1aff5f['model'],_0x1aff5f['query']);_0x235969['attributes']=_[_0xf7b1('0x33')](_0x1aff5f[_0xf7b1('0x2f')],qs[_0xf7b1('0x34')](_0x24336b[_0xf7b1('0x30')][_0xf7b1('0x34')]));_0x235969[_0xf7b1('0x35')]=_0x235969[_0xf7b1('0x35')]['length']?_0x235969[_0xf7b1('0x35')]:_0x1aff5f[_0xf7b1('0x2f')];if(!_0x24336b[_0xf7b1('0x30')][_0xf7b1('0x36')]('nolimit')){_0x235969[_0xf7b1('0x1d')]=qs[_0xf7b1('0x1d')](_0x24336b['query'][_0xf7b1('0x1d')]);_0x235969[_0xf7b1('0x1f')]=qs['offset'](_0x24336b[_0xf7b1('0x30')]['offset']);}_0x235969[_0xf7b1('0x37')]=qs['sort'](_0x24336b[_0xf7b1('0x30')]['sort']);_0x235969[_0xf7b1('0x38')]=qs[_0xf7b1('0x32')](_['pick'](_0x24336b[_0xf7b1('0x30')],_0x1aff5f[_0xf7b1('0x32')]),_0x2e43f7);if(_0x24336b[_0xf7b1('0x30')][_0xf7b1('0x39')]){_0x235969[_0xf7b1('0x38')]=_[_0xf7b1('0x3a')](_0x235969[_0xf7b1('0x38')],{'$or':_[_0xf7b1('0x2b')](_0x2e43f7,function(_0x34760e){if(_0x34760e[_0xf7b1('0x3b')]!=='VIRTUAL'){var _0x29dd45={};_0x29dd45[_0x34760e['name']]={'$like':'%'+_0x24336b[_0xf7b1('0x30')][_0xf7b1('0x39')]+'%'};return _0x29dd45;}})});}_0x235969=_[_0xf7b1('0x3a')]({},_0x235969,_0x24336b[_0xf7b1('0x3c')]);var _0x292686={'where':_0x235969[_0xf7b1('0x38')]};return db[_0xf7b1('0x2c')][_0xf7b1('0x1e')](_0x292686)['then'](function(_0x2342f7){_0x2c07da[_0xf7b1('0x1e')]=_0x2342f7;if(_0x24336b[_0xf7b1('0x30')][_0xf7b1('0x3d')]){_0x235969[_0xf7b1('0x3e')]=[{'all':!![]}];}return db[_0xf7b1('0x2c')][_0xf7b1('0x3f')](_0x235969);})[_0xf7b1('0x25')](function(_0x69625f){_0x2c07da[_0xf7b1('0x40')]=_0x69625f;return _0x2c07da;})[_0xf7b1('0x25')](respondWithFilteredResult(_0x2b7cf6,_0x235969))[_0xf7b1('0x41')](handleError(_0x2b7cf6,null));};exports['show']=function(_0x207bfa,_0x3034bd){var _0x36bf9e={'raw':!![],'where':{'id':_0x207bfa[_0xf7b1('0x42')]['id']}},_0x14d3c4={};_0x14d3c4['model']=_[_0xf7b1('0x31')](db['OpenchannelApplication']['rawAttributes']);_0x14d3c4[_0xf7b1('0x30')]=_[_0xf7b1('0x31')](_0x207bfa['query']);_0x14d3c4[_0xf7b1('0x32')]=_['intersection'](_0x14d3c4['model'],_0x14d3c4[_0xf7b1('0x30')]);_0x36bf9e[_0xf7b1('0x35')]=_[_0xf7b1('0x33')](_0x14d3c4[_0xf7b1('0x2f')],qs['fields'](_0x207bfa['query']['fields']));_0x36bf9e[_0xf7b1('0x35')]=_0x36bf9e['attributes'][_0xf7b1('0x43')]?_0x36bf9e['attributes']:_0x14d3c4[_0xf7b1('0x2f')];if(_0x207bfa[_0xf7b1('0x30')][_0xf7b1('0x3d')]){_0x36bf9e[_0xf7b1('0x3e')]=[{'all':!![]}];}_0x36bf9e=_[_0xf7b1('0x3a')]({},_0x36bf9e,_0x207bfa[_0xf7b1('0x3c')]);return db[_0xf7b1('0x2c')][_0xf7b1('0x44')](_0x36bf9e)[_0xf7b1('0x25')](handleEntityNotFound(_0x3034bd,null))[_0xf7b1('0x25')](respondWithResult(_0x3034bd,null))['catch'](handleError(_0x3034bd,null));};exports['create']=function(_0x3ce25c,_0x17594e){return db[_0xf7b1('0x2c')][_0xf7b1('0x45')](_0x3ce25c[_0xf7b1('0x46')],{})[_0xf7b1('0x25')](respondWithResult(_0x17594e,0xc9))[_0xf7b1('0x41')](handleError(_0x17594e,null));};exports[_0xf7b1('0x24')]=function(_0x85a7f3,_0x3c966f){if(_0x85a7f3[_0xf7b1('0x46')]['id']){delete _0x85a7f3['body']['id'];}return db[_0xf7b1('0x2c')]['find']({'where':{'id':_0x85a7f3[_0xf7b1('0x42')]['id']}})[_0xf7b1('0x25')](handleEntityNotFound(_0x3c966f,null))['then'](saveUpdates(_0x85a7f3[_0xf7b1('0x46')],null))[_0xf7b1('0x25')](respondWithResult(_0x3c966f,null))[_0xf7b1('0x41')](handleError(_0x3c966f,null));};exports['destroy']=function(_0x4891c8,_0x50069f){return db[_0xf7b1('0x2c')][_0xf7b1('0x44')]({'where':{'id':_0x4891c8['params']['id']}})['then'](handleEntityNotFound(_0x50069f,null))[_0xf7b1('0x25')](removeEntity(_0x50069f,null))[_0xf7b1('0x41')](handleError(_0x50069f,null));}; \ No newline at end of file +var _0xd824=['merge','VIRTUAL','options','OpenchannelApplication','includeAll','include','rows','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','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','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x26de5c,_0x15608f){var _0x139ed6=function(_0x5830da){while(--_0x5830da){_0x26de5c['push'](_0x26de5c['shift']());}};_0x139ed6(++_0x15608f);}(_0xd824,0x1e6));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4d82('0x0'));var rimraf=require(_0x4d82('0x1'));var zipdir=require(_0x4d82('0x2'));var jsonpatch=require(_0x4d82('0x3'));var rp=require(_0x4d82('0x4'));var moment=require(_0x4d82('0x5'));var BPromise=require(_0x4d82('0x6'));var Mustache=require(_0x4d82('0x7'));var util=require(_0x4d82('0x8'));var path=require('path');var sox=require(_0x4d82('0x9'));var csv=require('to-csv');var ejs=require(_0x4d82('0xa'));var fs=require('fs');var fs_extra=require(_0x4d82('0xb'));var _=require(_0x4d82('0xc'));var squel=require(_0x4d82('0xd'));var crypto=require(_0x4d82('0xe'));var jsforce=require(_0x4d82('0xf'));var deskjs=require(_0x4d82('0x10'));var toCsv=require(_0x4d82('0x11'));var querystring=require(_0x4d82('0x12'));var Papa=require(_0x4d82('0x13'));var Redis=require(_0x4d82('0x14'));var authService=require(_0x4d82('0x15'));var qs=require(_0x4d82('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d82('0x17'));var logger=require(_0x4d82('0x18'))(_0x4d82('0x19'));var utils=require(_0x4d82('0x1a'));var config=require(_0x4d82('0x1b'));var licenseUtil=require(_0x4d82('0x1c'));var db=require(_0x4d82('0x1d'))['db'];function respondWithStatusCode(_0x16459c,_0x17933d){_0x17933d=_0x17933d||0xcc;return function(_0x4ed482){if(_0x4ed482){return _0x16459c[_0x4d82('0x1e')](_0x17933d);}return _0x16459c[_0x4d82('0x1f')](_0x17933d)['end']();};}function respondWithResult(_0x59b801,_0x18e899){_0x18e899=_0x18e899||0xc8;return function(_0x45d5c9){if(_0x45d5c9){return _0x59b801[_0x4d82('0x1f')](_0x18e899)[_0x4d82('0x20')](_0x45d5c9);}};}function respondWithFilteredResult(_0x252673,_0x338766){return function(_0x4fd3f1){if(_0x4fd3f1){var _0xe6a853=typeof _0x338766[_0x4d82('0x21')]===_0x4d82('0x22')&&typeof _0x338766[_0x4d82('0x23')]===_0x4d82('0x22');var _0x3728cb=_0x4fd3f1[_0x4d82('0x24')];var _0xdb4de2=_0xe6a853?0x0:_0x338766[_0x4d82('0x21')];var _0x4d0a1f=_0xe6a853?_0x4fd3f1['count']:_0x338766[_0x4d82('0x21')]+_0x338766['limit'];var _0x312b37;if(_0x4d0a1f>=_0x3728cb){_0x4d0a1f=_0x3728cb;_0x312b37=0xc8;}else{_0x312b37=0xce;}_0x252673[_0x4d82('0x1f')](_0x312b37);return _0x252673['set'](_0x4d82('0x25'),_0xdb4de2+'-'+_0x4d0a1f+'/'+_0x3728cb)[_0x4d82('0x20')](_0x4fd3f1);}return null;};}function patchUpdates(_0xdf5dae){return function(_0x5960a6){try{jsonpatch[_0x4d82('0x26')](_0x5960a6,_0xdf5dae,!![]);}catch(_0x2bd26b){return BPromise['reject'](_0x2bd26b);}return _0x5960a6[_0x4d82('0x27')]();};}function saveUpdates(_0x3ff5fc,_0x96e045){return function(_0x3dbdb8){if(_0x3dbdb8){return _0x3dbdb8[_0x4d82('0x28')](_0x3ff5fc)[_0x4d82('0x29')](function(_0x5a0e0c){return _0x5a0e0c;});}return null;};}function removeEntity(_0x4b2131,_0x24e74d){return function(_0x4390bd){if(_0x4390bd){return _0x4390bd['destroy']()[_0x4d82('0x29')](function(){_0x4b2131['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc39aff,_0x46a2cf){return function(_0x5495e6){if(!_0x5495e6){_0xc39aff['sendStatus'](0x194);}return _0x5495e6;};}function handleError(_0x424d55,_0x3ab246){_0x3ab246=_0x3ab246||0x1f4;return function(_0x4faa05){logger[_0x4d82('0x2a')](_0x4faa05[_0x4d82('0x2b')]);if(_0x4faa05[_0x4d82('0x2c')]){delete _0x4faa05[_0x4d82('0x2c')];}_0x424d55['status'](_0x3ab246)[_0x4d82('0x2d')](_0x4faa05);};}exports[_0x4d82('0x2e')]=function(_0x2e8cfc,_0x17901f){var _0x418a66={},_0x3fdeee={},_0x432aa2={'count':0x0,'rows':[]};var _0x1ecb27=_[_0x4d82('0x2f')](db['OpenchannelApplication'][_0x4d82('0x30')],function(_0x268e9f){return{'name':_0x268e9f[_0x4d82('0x31')],'type':_0x268e9f[_0x4d82('0x32')][_0x4d82('0x33')]};});_0x3fdeee[_0x4d82('0x34')]=_['map'](_0x1ecb27,_0x4d82('0x2c'));_0x3fdeee[_0x4d82('0x35')]=_[_0x4d82('0x36')](_0x2e8cfc['query']);_0x3fdeee[_0x4d82('0x37')]=_['intersection'](_0x3fdeee[_0x4d82('0x34')],_0x3fdeee[_0x4d82('0x35')]);_0x418a66[_0x4d82('0x38')]=_[_0x4d82('0x39')](_0x3fdeee['model'],qs[_0x4d82('0x3a')](_0x2e8cfc[_0x4d82('0x35')]['fields']));_0x418a66[_0x4d82('0x38')]=_0x418a66['attributes'][_0x4d82('0x3b')]?_0x418a66[_0x4d82('0x38')]:_0x3fdeee[_0x4d82('0x34')];if(!_0x2e8cfc[_0x4d82('0x35')][_0x4d82('0x3c')](_0x4d82('0x3d'))){_0x418a66['limit']=qs[_0x4d82('0x23')](_0x2e8cfc['query'][_0x4d82('0x23')]);_0x418a66[_0x4d82('0x21')]=qs[_0x4d82('0x21')](_0x2e8cfc[_0x4d82('0x35')]['offset']);}_0x418a66[_0x4d82('0x3e')]=qs[_0x4d82('0x3f')](_0x2e8cfc[_0x4d82('0x35')][_0x4d82('0x3f')]);_0x418a66[_0x4d82('0x40')]=qs[_0x4d82('0x37')](_[_0x4d82('0x41')](_0x2e8cfc[_0x4d82('0x35')],_0x3fdeee['filters']),_0x1ecb27);if(_0x2e8cfc[_0x4d82('0x35')][_0x4d82('0x42')]){_0x418a66['where']=_[_0x4d82('0x43')](_0x418a66['where'],{'$or':_[_0x4d82('0x2f')](_0x1ecb27,function(_0x3c8b4b){if(_0x3c8b4b['type']!==_0x4d82('0x44')){var _0x18dc06={};_0x18dc06[_0x3c8b4b['name']]={'$like':'%'+_0x2e8cfc['query']['filter']+'%'};return _0x18dc06;}})});}_0x418a66=_[_0x4d82('0x43')]({},_0x418a66,_0x2e8cfc[_0x4d82('0x45')]);var _0x3aef27={'where':_0x418a66['where']};return db[_0x4d82('0x46')][_0x4d82('0x24')](_0x3aef27)[_0x4d82('0x29')](function(_0x10b173){_0x432aa2[_0x4d82('0x24')]=_0x10b173;if(_0x2e8cfc[_0x4d82('0x35')][_0x4d82('0x47')]){_0x418a66[_0x4d82('0x48')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x418a66);})[_0x4d82('0x29')](function(_0x13b43b){_0x432aa2[_0x4d82('0x49')]=_0x13b43b;return _0x432aa2;})[_0x4d82('0x29')](respondWithFilteredResult(_0x17901f,_0x418a66))[_0x4d82('0x4a')](handleError(_0x17901f,null));};exports['show']=function(_0x230b01,_0x5f034f){var _0x4e17f2={'raw':!![],'where':{'id':_0x230b01['params']['id']}},_0x122bb5={};_0x122bb5[_0x4d82('0x34')]=_['keys'](db[_0x4d82('0x46')][_0x4d82('0x30')]);_0x122bb5[_0x4d82('0x35')]=_[_0x4d82('0x36')](_0x230b01[_0x4d82('0x35')]);_0x122bb5['filters']=_[_0x4d82('0x39')](_0x122bb5['model'],_0x122bb5['query']);_0x4e17f2[_0x4d82('0x38')]=_['intersection'](_0x122bb5[_0x4d82('0x34')],qs[_0x4d82('0x3a')](_0x230b01[_0x4d82('0x35')][_0x4d82('0x3a')]));_0x4e17f2['attributes']=_0x4e17f2[_0x4d82('0x38')][_0x4d82('0x3b')]?_0x4e17f2[_0x4d82('0x38')]:_0x122bb5[_0x4d82('0x34')];if(_0x230b01[_0x4d82('0x35')][_0x4d82('0x47')]){_0x4e17f2[_0x4d82('0x48')]=[{'all':!![]}];}_0x4e17f2=_[_0x4d82('0x43')]({},_0x4e17f2,_0x230b01['options']);return db[_0x4d82('0x46')]['find'](_0x4e17f2)[_0x4d82('0x29')](handleEntityNotFound(_0x5f034f,null))[_0x4d82('0x29')](respondWithResult(_0x5f034f,null))['catch'](handleError(_0x5f034f,null));};exports[_0x4d82('0x4b')]=function(_0x1edea8,_0x4213aa){return db[_0x4d82('0x46')][_0x4d82('0x4b')](_0x1edea8[_0x4d82('0x4c')],{})[_0x4d82('0x29')](respondWithResult(_0x4213aa,0xc9))[_0x4d82('0x4a')](handleError(_0x4213aa,null));};exports[_0x4d82('0x28')]=function(_0x12d17c,_0x55797f){if(_0x12d17c[_0x4d82('0x4c')]['id']){delete _0x12d17c['body']['id'];}return db[_0x4d82('0x46')][_0x4d82('0x4d')]({'where':{'id':_0x12d17c[_0x4d82('0x4e')]['id']}})['then'](handleEntityNotFound(_0x55797f,null))[_0x4d82('0x29')](saveUpdates(_0x12d17c[_0x4d82('0x4c')],null))['then'](respondWithResult(_0x55797f,null))[_0x4d82('0x4a')](handleError(_0x55797f,null));};exports['destroy']=function(_0x1d5c95,_0x64b0){return db['OpenchannelApplication'][_0x4d82('0x4d')]({'where':{'id':_0x1d5c95[_0x4d82('0x4e')]['id']}})[_0x4d82('0x29')](handleEntityNotFound(_0x64b0,null))[_0x4d82('0x29')](removeEntity(_0x64b0,null))['catch'](handleError(_0x64b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index aeabc63..c5c157f 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 _0x26a7=['../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x493e12,_0x572598){var _0x46cfd5=function(_0x1f74f4){while(--_0x1f74f4){_0x493e12['push'](_0x493e12['shift']());}};_0x46cfd5(++_0x572598);}(_0x26a7,0x16e));var _0x726a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x26a7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x726a('0x0'));var util=require(_0x726a('0x1'));var logger=require(_0x726a('0x2'))(_0x726a('0x3'));var moment=require(_0x726a('0x4'));var BPromise=require(_0x726a('0x5'));var rp=require(_0x726a('0x6'));var fs=require('fs');var path=require(_0x726a('0x7'));var rimraf=require(_0x726a('0x8'));var config=require(_0x726a('0x9'));var attributes=require(_0x726a('0xa'));module['exports']=function(_0x49c0f9,_0x5583a4){return _0x49c0f9[_0x726a('0xb')](_0x726a('0xc'),attributes,{'tableName':_0x726a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x726a('0xe')});}; \ No newline at end of file +var _0x4b99=['OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./openchannelApplication.attributes','define'];(function(_0x434fe0,_0x5c01fa){var _0x3dab1b=function(_0x182f21){while(--_0x182f21){_0x434fe0['push'](_0x434fe0['shift']());}};_0x3dab1b(++_0x5c01fa);}(_0x4b99,0x13b));var _0x94b9=function(_0xac5447,_0x4eacdc){_0xac5447=_0xac5447-0x0;var _0x49a5a7=_0x4b99[_0xac5447];return _0x49a5a7;};'use strict';var _=require(_0x94b9('0x0'));var util=require(_0x94b9('0x1'));var logger=require(_0x94b9('0x2'))(_0x94b9('0x3'));var moment=require(_0x94b9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x94b9('0x5'));var config=require(_0x94b9('0x6'));var attributes=require(_0x94b9('0x7'));module['exports']=function(_0xb3ee33,_0x141969){return _0xb3ee33[_0x94b9('0x8')](_0x94b9('0x9'),attributes,{'tableName':_0x94b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x94b9('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 658db51..e2dab9c 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 _0x1e64=['request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateOpenchannelApplication','body','options','raw','where','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4186ae,_0x5548e5){var _0x31d4b0=function(_0xf394a9){while(--_0xf394a9){_0x4186ae['push'](_0x4186ae['shift']());}};_0x31d4b0(++_0x5548e5);}(_0x1e64,0x13f));var _0x41e6=function(_0x5aafc3,_0x53231a){_0x5aafc3=_0x5aafc3-0x0;var _0x306e29=_0x1e64[_0x5aafc3];return _0x306e29;};'use strict';var _=require(_0x41e6('0x0'));var util=require(_0x41e6('0x1'));var moment=require(_0x41e6('0x2'));var BPromise=require(_0x41e6('0x3'));var rs=require(_0x41e6('0x4'));var fs=require('fs');var Redis=require(_0x41e6('0x5'));var db=require(_0x41e6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x41e6('0x7'))('rpc');var config=require(_0x41e6('0x8'));var jayson=require(_0x41e6('0x9'));var client=jayson[_0x41e6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28450c,_0x208ab1,_0x327bd1){return new BPromise(function(_0x1ea341,_0x45126f){return client[_0x41e6('0xb')](_0x28450c,_0x327bd1)[_0x41e6('0xc')](function(_0x122981){logger['info'](_0x41e6('0xd'),_0x208ab1,'request\x20sent');logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x208ab1,_0x41e6('0xe'),JSON['stringify'](_0x122981));if(_0x122981[_0x41e6('0xf')]){if(_0x122981[_0x41e6('0xf')][_0x41e6('0x10')]===0x1f4){logger[_0x41e6('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x208ab1,_0x122981['error'][_0x41e6('0x11')]);return _0x45126f(_0x122981[_0x41e6('0xf')][_0x41e6('0x11')]);}logger[_0x41e6('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x208ab1,_0x122981[_0x41e6('0xf')][_0x41e6('0x11')]);return _0x1ea341(_0x122981[_0x41e6('0xf')]['message']);}else{logger[_0x41e6('0x12')](_0x41e6('0xd'),_0x208ab1,_0x41e6('0xe'));_0x1ea341(_0x122981[_0x41e6('0x13')][_0x41e6('0x11')]);}})[_0x41e6('0x14')](function(_0x4fe7f4){logger[_0x41e6('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x208ab1,_0x4fe7f4);_0x45126f(_0x4fe7f4);});});}exports[_0x41e6('0x15')]=function(_0x3fefb5){var _0x31f64e=this;return new Promise(function(_0x5c82a4,_0x572705){return db['OpenchannelApplication']['update'](_0x3fefb5[_0x41e6('0x16')],{'raw':_0x3fefb5[_0x41e6('0x17')]?_0x3fefb5[_0x41e6('0x17')][_0x41e6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fefb5[_0x41e6('0x17')]?_0x3fefb5[_0x41e6('0x17')][_0x41e6('0x19')]||null:null,'attributes':_0x3fefb5[_0x41e6('0x17')]?_0x3fefb5[_0x41e6('0x17')][_0x41e6('0x1a')]||null:null,'limit':_0x3fefb5['options']?_0x3fefb5[_0x41e6('0x17')][_0x41e6('0x1b')]||null:null})[_0x41e6('0xc')](function(_0x3650d8){logger['info'](_0x41e6('0x15'),_0x3fefb5);logger[_0x41e6('0x1c')](_0x41e6('0x15'),_0x3fefb5,JSON[_0x41e6('0x1d')](_0x3650d8));_0x5c82a4(_0x3650d8);})['catch'](function(_0x19449e){logger[_0x41e6('0xf')](_0x41e6('0x15'),_0x19449e[_0x41e6('0x11')],_0x3fefb5);_0x572705(_0x31f64e['error'](0x1f4,_0x19449e[_0x41e6('0x11')]));});});}; \ No newline at end of file +var _0xb002=['raw','attributes','limit','then','UpdateOpenchannelApplication','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelApplication','update','body','options'];(function(_0x511d0d,_0x16d951){var _0x42fc53=function(_0x342a95){while(--_0x342a95){_0x511d0d['push'](_0x511d0d['shift']());}};_0x42fc53(++_0x16d951);}(_0xb002,0x128));var _0x2b00=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb002[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x2b00('0x0'));var util=require('util');var moment=require(_0x2b00('0x1'));var BPromise=require(_0x2b00('0x2'));var rs=require(_0x2b00('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b00('0x4'))['db'];var utils=require(_0x2b00('0x5'));var logger=require(_0x2b00('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2b00('0x7'));var client=jayson[_0x2b00('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568570,_0x58f2f6,_0x508746){return new BPromise(function(_0xa6458b,_0x35ac39){return client['request'](_0x568570,_0x508746)['then'](function(_0x52f95a){logger[_0x2b00('0x9')](_0x2b00('0xa'),_0x58f2f6,_0x2b00('0xb'));logger[_0x2b00('0xc')](_0x2b00('0xd'),_0x58f2f6,_0x2b00('0xb'),JSON['stringify'](_0x52f95a));if(_0x52f95a[_0x2b00('0xe')]){if(_0x52f95a[_0x2b00('0xe')][_0x2b00('0xf')]===0x1f4){logger[_0x2b00('0xe')](_0x2b00('0xa'),_0x58f2f6,_0x52f95a[_0x2b00('0xe')]['message']);return _0x35ac39(_0x52f95a[_0x2b00('0xe')][_0x2b00('0x10')]);}logger[_0x2b00('0xe')](_0x2b00('0xa'),_0x58f2f6,_0x52f95a[_0x2b00('0xe')][_0x2b00('0x10')]);return _0xa6458b(_0x52f95a['error'][_0x2b00('0x10')]);}else{logger[_0x2b00('0x9')]('OpenchannelApplication,\x20%s,\x20%s',_0x58f2f6,'request\x20sent');_0xa6458b(_0x52f95a[_0x2b00('0x11')]['message']);}})[_0x2b00('0x12')](function(_0x2259b7){logger[_0x2b00('0xe')](_0x2b00('0xa'),_0x58f2f6,_0x2259b7);_0x35ac39(_0x2259b7);});});}exports['UpdateOpenchannelApplication']=function(_0x54c8a5){var _0x122c8d=this;return new Promise(function(_0x551801,_0x13926c){return db[_0x2b00('0x13')][_0x2b00('0x14')](_0x54c8a5[_0x2b00('0x15')],{'raw':_0x54c8a5[_0x2b00('0x16')]?_0x54c8a5[_0x2b00('0x16')][_0x2b00('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54c8a5[_0x2b00('0x16')]?_0x54c8a5[_0x2b00('0x16')]['where']||null:null,'attributes':_0x54c8a5[_0x2b00('0x16')]?_0x54c8a5[_0x2b00('0x16')][_0x2b00('0x18')]||null:null,'limit':_0x54c8a5[_0x2b00('0x16')]?_0x54c8a5[_0x2b00('0x16')][_0x2b00('0x19')]||null:null})[_0x2b00('0x1a')](function(_0x144cfc){logger['info'](_0x2b00('0x1b'),_0x54c8a5);logger['debug']('UpdateOpenchannelApplication',_0x54c8a5,JSON[_0x2b00('0x1c')](_0x144cfc));_0x551801(_0x144cfc);})[_0x2b00('0x12')](function(_0x186f76){logger['error']('UpdateOpenchannelApplication',_0x186f76['message'],_0x54c8a5);_0x13926c(_0x122c8d['error'](0x1f4,_0x186f76[_0x2b00('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4ae72cc..d065ee4 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 _0x726d=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','describe','/:id','show','/:id/messages','isAuthenticated','getMessages','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x726d,0xb4));var _0xd726=function(_0x2174d3,_0xd6d74d){_0x2174d3=_0x2174d3-0x0;var _0x1ae2d7=_0x726d[_0x2174d3];return _0x1ae2d7;};'use strict';var multer=require(_0xd726('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd726('0x1'));var express=require(_0xd726('0x2'));var router=express['Router']();var fs_extra=require(_0xd726('0x3'));var auth=require(_0xd726('0x4'));var interaction=require(_0xd726('0x5'));var config=require(_0xd726('0x6'));var controller=require(_0xd726('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd726('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd726('0x9')]);router[_0xd726('0x8')](_0xd726('0xa'),auth['isAuthenticated'](),controller[_0xd726('0xb')]);router[_0xd726('0x8')](_0xd726('0xc'),auth[_0xd726('0xd')](),controller[_0xd726('0xe')]);router[_0xd726('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xd726('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd726('0x10')]);router[_0xd726('0x11')](_0xd726('0xc'),auth[_0xd726('0xd')](),controller[_0xd726('0x12')]);router[_0xd726('0x11')](_0xd726('0x13'),auth[_0xd726('0xd')](),interaction[_0xd726('0x14')](_0xd726('0x15'),_0xd726('0x16')),controller[_0xd726('0x17')]);router[_0xd726('0x18')](_0xd726('0xa'),auth[_0xd726('0xd')](),interaction[_0xd726('0x14')]('openchannel',_0xd726('0x19')),controller[_0xd726('0x1a')]);router[_0xd726('0x1b')]('/:id',auth[_0xd726('0xd')](),interaction[_0xd726('0x14')](_0xd726('0x15'),_0xd726('0x1c')),controller['destroy']);router[_0xd726('0x1b')](_0xd726('0x13'),auth[_0xd726('0xd')](),controller['removeTags']);module[_0xd726('0x1d')]=router; \ No newline at end of file +var _0x62cc=['isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','openchannelinteraction:update','update','delete','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','describe'];(function(_0x4724bc,_0x293795){var _0x33e1ed=function(_0x9c44f9){while(--_0x9c44f9){_0x4724bc['push'](_0x4724bc['shift']());}};_0x33e1ed(++_0x293795);}(_0x62cc,0x1e4));var _0xc62c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62cc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc62c('0x0'));var timeout=require(_0xc62c('0x1'));var express=require(_0xc62c('0x2'));var router=express[_0xc62c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc62c('0x4'));var interaction=require(_0xc62c('0x5'));var config=require(_0xc62c('0x6'));var controller=require(_0xc62c('0x7'));router[_0xc62c('0x8')]('/',auth['isAuthenticated'](),controller[_0xc62c('0x9')]);router[_0xc62c('0x8')](_0xc62c('0xa'),auth['isAuthenticated'](),controller[_0xc62c('0xb')]);router[_0xc62c('0x8')]('/:id',auth[_0xc62c('0xc')](),controller[_0xc62c('0xd')]);router[_0xc62c('0x8')](_0xc62c('0xe'),auth[_0xc62c('0xc')](),controller[_0xc62c('0xf')]);router[_0xc62c('0x8')](_0xc62c('0x10'),auth['isAuthenticated'](),controller[_0xc62c('0x11')]);router[_0xc62c('0x12')]('/',auth['isAuthenticated'](),controller[_0xc62c('0x13')]);router[_0xc62c('0x12')](_0xc62c('0xe'),auth[_0xc62c('0xc')](),controller[_0xc62c('0x14')]);router['post'](_0xc62c('0x15'),auth[_0xc62c('0xc')](),interaction[_0xc62c('0x16')](_0xc62c('0x17'),_0xc62c('0x18')),controller[_0xc62c('0x19')]);router[_0xc62c('0x1a')](_0xc62c('0x1b'),auth['isAuthenticated'](),interaction['tracked'](_0xc62c('0x17'),_0xc62c('0x1c')),controller[_0xc62c('0x1d')]);router[_0xc62c('0x1e')](_0xc62c('0x1b'),auth[_0xc62c('0xc')](),interaction['tracked'](_0xc62c('0x17'),'openchannelinteraction:destroy'),controller['destroy']);router['delete'](_0xc62c('0x15'),auth[_0xc62c('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 74bf46f..06d2183 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 _0xd51f=['out','BOOLEAN','sequelize','exports','DATE','STRING','ENUM'];(function(_0x3aad61,_0x351442){var _0x37e8d5=function(_0x1cc7b0){while(--_0x1cc7b0){_0x3aad61['push'](_0x3aad61['shift']());}};_0x37e8d5(++_0x351442);}(_0xd51f,0xf0));var _0xfd51=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd51f[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xfd51('0x0'));module[_0xfd51('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfd51('0x2')]},'disposition':{'type':Sequelize[_0xfd51('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfd51('0x3')]},'note':{'type':Sequelize[_0xfd51('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xfd51('0x3')]},'externalUrl':{'type':Sequelize[_0xfd51('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xfd51('0x4')]('in',_0xfd51('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfd51('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xfd51('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xfd51('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x0dba=['BOOLEAN','DATE','STRING','out','sequelize','exports'];(function(_0x25f271,_0x4e67ed){var _0x104ab9=function(_0x3bf4f5){while(--_0x3bf4f5){_0x25f271['push'](_0x25f271['shift']());}};_0x104ab9(++_0x4e67ed);}(_0x0dba,0x136));var _0xa0db=function(_0x28df55,_0x39906a){_0x28df55=_0x28df55-0x0;var _0x505ca6=_0x0dba[_0x28df55];return _0x505ca6;};'use strict';var Sequelize=require(_0xa0db('0x0'));module[_0xa0db('0x1')]={'closed':{'type':Sequelize[_0xa0db('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa0db('0x3')]},'disposition':{'type':Sequelize[_0xa0db('0x4')]},'secondDisposition':{'type':Sequelize[_0xa0db('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa0db('0x4')]},'note':{'type':Sequelize[_0xa0db('0x4')]},'read1stAt':{'type':Sequelize[_0xa0db('0x3')]},'threadId':{'type':Sequelize[_0xa0db('0x4')]},'externalUrl':{'type':Sequelize[_0xa0db('0x4')]},'lastMsgAt':{'type':Sequelize[_0xa0db('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa0db('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa0db('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xa0db('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 946eef6..481a713 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 _0xda1b=['removeTags','unix','root','tmp','join','server','files','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','push','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Owner','mkdirSync','Openchannel','Account','N.A.','toString','closed','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','System','out','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','getOptions','findAll','query','catch','type','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','OpenchannelInteraction','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','openchannelInteractionTags:save'];(function(_0x26d311,_0x3f7749){var _0x3894da=function(_0x11290d){while(--_0x11290d){_0x26d311['push'](_0x26d311['shift']());}};_0x3894da(++_0x3f7749);}(_0xda1b,0x137));var _0xbda1=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xda1b[_0x2e4e19];return _0x9ba20b;};'use strict';var rimraf=require(_0xbda1('0x0'));var zipdir=require(_0xbda1('0x1'));var moment=require(_0xbda1('0x2'));var util=require(_0xbda1('0x3'));var path=require('path');var ejs=require(_0xbda1('0x4'));var fs=require('fs');var _=require(_0xbda1('0x5'));var Redis=require(_0xbda1('0x6'));var interaction=require(_0xbda1('0x7'));var qs=require(_0xbda1('0x8'));var pdf=require(_0xbda1('0x9'));var logger=require(_0xbda1('0xa'))(_0xbda1('0xb'));var config=require(_0xbda1('0xc'));var db=require(_0xbda1('0xd'))['db'];config[_0xbda1('0xe')]=_[_0xbda1('0xf')](config[_0xbda1('0xe')],{'host':_0xbda1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbda1('0xe')]));require(_0xbda1('0x11'))[_0xbda1('0x12')](socket);function respondWithStatusCode(_0x33a12c,_0x55eca0){_0x55eca0=_0x55eca0||0xcc;return function(_0x4ea312){if(_0x4ea312){return _0x33a12c[_0xbda1('0x13')](_0x55eca0);}return _0x33a12c[_0xbda1('0x14')](_0x55eca0)[_0xbda1('0x15')]();};}function respondWithResult(_0x11f193,_0x5695c3){_0x5695c3=_0x5695c3||0xc8;return function(_0x11cbdc){if(_0x11cbdc){return _0x11f193[_0xbda1('0x14')](_0x5695c3)[_0xbda1('0x16')](_0x11cbdc);}};}function respondWithFilteredResult(_0x27df6d,_0x4083d1){return function(_0x3554cd){if(_0x3554cd){var _0x5322b9=typeof _0x4083d1[_0xbda1('0x17')]==='undefined'&&typeof _0x4083d1[_0xbda1('0x18')]===_0xbda1('0x19');var _0x3e038e=_0x3554cd[_0xbda1('0x1a')];var _0x2be4e1=_0x5322b9?0x0:_0x4083d1[_0xbda1('0x17')];var _0x22cc92=_0x5322b9?_0x3554cd[_0xbda1('0x1a')]:_0x4083d1[_0xbda1('0x17')]+_0x4083d1[_0xbda1('0x18')];var _0x107c56;if(_0x22cc92>=_0x3e038e){_0x22cc92=_0x3e038e;_0x107c56=0xc8;}else{_0x107c56=0xce;}_0x27df6d[_0xbda1('0x14')](_0x107c56);return _0x27df6d['set'](_0xbda1('0x1b'),_0x2be4e1+'-'+_0x22cc92+'/'+_0x3e038e)['json'](_0x3554cd);}return null;};}function saveUpdates(_0x5cdb22){return function(_0xd2db55){if(_0xd2db55){return _0xd2db55[_0xbda1('0x1c')](_0x5cdb22)[_0xbda1('0x1d')](function(_0x31d0ba){return _0x31d0ba;});}return null;};}function removeEntity(_0x3e5fee){return function(_0x59fadb){if(_0x59fadb){return _0x59fadb[_0xbda1('0x1e')]()['then'](function(){_0x3e5fee[_0xbda1('0x14')](0xcc)[_0xbda1('0x15')]();});}};}function handleEntityNotFound(_0x4d5c24){return function(_0x2cf0e5){if(!_0x2cf0e5){_0x4d5c24['sendStatus'](0x194);}return _0x2cf0e5;};}function handleError(_0x4dd942,_0x2ef0cb){_0x2ef0cb=_0x2ef0cb||0x1f4;return function(_0x4e8325){logger[_0xbda1('0x1f')](_0x4e8325[_0xbda1('0x20')]);if(_0x4e8325[_0xbda1('0x21')]){delete _0x4e8325[_0xbda1('0x21')];}_0x4dd942[_0xbda1('0x14')](_0x2ef0cb)[_0xbda1('0x22')](_0x4e8325);};}exports['index']=function(_0xb95d19,_0x5a80b5){var _0x4310c7={};var _0x5dcf3c=_['map'](db['OpenchannelInteraction'][_0xbda1('0x23')],function(_0x1e427c){return{'name':_0x1e427c[_0xbda1('0x24')],'type':_0x1e427c['type'][_0xbda1('0x25')]};});_0x4310c7=qs[_0xbda1('0x26')](_0x5dcf3c,_0xb95d19);return interaction[_0xbda1('0x27')]('openchannel',_0xb95d19[_0xbda1('0x28')],_0xb95d19['user'],_0x4310c7,_0x5dcf3c)[_0xbda1('0x1d')](respondWithFilteredResult(_0x5a80b5,_0x4310c7))[_0xbda1('0x29')](handleError(_0x5a80b5,null));};exports['show']=function(_0x27af70,_0x10d037){var _0x31b9b6={};if(_0x27af70[_0xbda1('0x28')][_0xbda1('0x2a')]&&_0x27af70[_0xbda1('0x28')]['type']==='from'){_0x31b9b6[_0xbda1('0x2b')]=_0x27af70[_0xbda1('0x2c')]['id'];}else{_0x31b9b6['id']=_0x27af70[_0xbda1('0x2c')]['id'];}var _0x5930c2={'raw':![],'where':_0x31b9b6},_0x13ee2f={};_0x13ee2f[_0xbda1('0x2d')]=_[_0xbda1('0x2e')](db['OpenchannelInteraction']['rawAttributes']);_0x13ee2f['query']=_[_0xbda1('0x2e')](_0x27af70[_0xbda1('0x28')]);_0x13ee2f[_0xbda1('0x2f')]=_[_0xbda1('0x30')](_0x13ee2f[_0xbda1('0x2d')],_0x13ee2f[_0xbda1('0x28')]);_0x5930c2[_0xbda1('0x31')]=_[_0xbda1('0x30')](_0x13ee2f[_0xbda1('0x2d')],qs[_0xbda1('0x32')](_0x27af70[_0xbda1('0x28')][_0xbda1('0x32')]));_0x5930c2[_0xbda1('0x31')]=_0x5930c2[_0xbda1('0x31')][_0xbda1('0x33')]?_0x5930c2[_0xbda1('0x31')]:_0x13ee2f['model'];if(_0x27af70['query'][_0xbda1('0x34')]){_0x5930c2[_0xbda1('0x35')]=[{'all':!![]}];}_0x5930c2=_[_0xbda1('0x36')]({},_0x5930c2,_0x27af70['options']);return db[_0xbda1('0x37')][_0xbda1('0x38')](_0x5930c2)['then'](handleEntityNotFound(_0x10d037,null))['then'](respondWithResult(_0x10d037,null))[_0xbda1('0x29')](handleError(_0x10d037,null));};exports[_0xbda1('0x39')]=function(_0x288cfb,_0x44b4c2){return db[_0xbda1('0x37')][_0xbda1('0x39')](_0x288cfb['body'],{})['then'](respondWithResult(_0x44b4c2,0xc9))[_0xbda1('0x29')](handleError(_0x44b4c2,null));};exports[_0xbda1('0x1c')]=function(_0x10470e,_0x39add5){if(_0x10470e[_0xbda1('0x3a')]['id']){delete _0x10470e[_0xbda1('0x3a')]['id'];}return db[_0xbda1('0x37')][_0xbda1('0x38')]({'where':{'id':_0x10470e['params']['id']}})[_0xbda1('0x1d')](handleEntityNotFound(_0x39add5,null))['then'](saveUpdates(_0x10470e[_0xbda1('0x3a')],null))[_0xbda1('0x1d')](respondWithResult(_0x39add5,null))['catch'](handleError(_0x39add5,null));};exports[_0xbda1('0x1e')]=function(_0x450050,_0x2d8c13){return db['OpenchannelInteraction']['find']({'where':{'id':_0x450050[_0xbda1('0x2c')]['id']}})[_0xbda1('0x1d')](handleEntityNotFound(_0x2d8c13,null))[_0xbda1('0x1d')](removeEntity(_0x2d8c13,null))[_0xbda1('0x29')](handleError(_0x2d8c13,null));};exports[_0xbda1('0x3b')]=function(_0x1c1bdd,_0x13fae2){return db['OpenchannelInteraction'][_0xbda1('0x3b')]()[_0xbda1('0x1d')](respondWithResult(_0x13fae2,null))[_0xbda1('0x29')](handleError(_0x13fae2,null));};exports[_0xbda1('0x3c')]=function(_0xba1b8,_0x3105c6){return db[_0xbda1('0x3d')][_0xbda1('0x38')]({'where':{'id':_0xba1b8['params']['id']}})[_0xbda1('0x1d')](handleEntityNotFound(_0x3105c6,null))[_0xbda1('0x1d')](function(_0x41bf86){if(_0x41bf86){return _0x41bf86[_0xbda1('0x3c')](_0xba1b8['body'][_0xbda1('0x3e')],_[_0xbda1('0x3f')](_0xba1b8['body'],['ids','id'])||{});}})[_0xbda1('0x1d')](respondWithResult(_0x3105c6,null))['catch'](handleError(_0x3105c6,null));};exports[_0xbda1('0x40')]=function(_0x151a4d,_0xeac3f3){var _0x13c29f={'raw':![],'where':{}};var _0x54ca34={};var _0x3e6dba={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xbda1('0x41')]({'where':{'id':_0x151a4d[_0xbda1('0x2c')]['id']}})[_0xbda1('0x1d')](handleEntityNotFound(_0xeac3f3,null))[_0xbda1('0x1d')](function(_0x482115){if(_0x482115){_0x54ca34[_0xbda1('0x2d')]=_[_0xbda1('0x2e')](db[_0xbda1('0x3d')][_0xbda1('0x23')]);_0x54ca34['query']=_['keys'](_0x151a4d[_0xbda1('0x28')]);_0x54ca34[_0xbda1('0x2f')]=_['intersection'](_0x54ca34[_0xbda1('0x2d')],_0x54ca34['query']);_0x13c29f[_0xbda1('0x31')]=_[_0xbda1('0x30')](_0x54ca34[_0xbda1('0x2d')],qs[_0xbda1('0x32')](_0x151a4d[_0xbda1('0x28')][_0xbda1('0x32')]));_0x13c29f['attributes']=_0x13c29f[_0xbda1('0x31')][_0xbda1('0x33')]?_0x13c29f[_0xbda1('0x31')]:_0x54ca34[_0xbda1('0x2d')];if(!_0x151a4d[_0xbda1('0x28')][_0xbda1('0x42')](_0xbda1('0x43'))){_0x13c29f[_0xbda1('0x18')]=qs['limit'](_0x151a4d[_0xbda1('0x28')][_0xbda1('0x18')]);_0x13c29f[_0xbda1('0x17')]=qs[_0xbda1('0x17')](_0x151a4d[_0xbda1('0x28')][_0xbda1('0x17')]);}_0x13c29f[_0xbda1('0x44')]=qs[_0xbda1('0x45')](_0x151a4d[_0xbda1('0x28')][_0xbda1('0x45')]);_0x13c29f[_0xbda1('0x46')]=qs[_0xbda1('0x2f')](_['pick'](_0x151a4d[_0xbda1('0x28')],_0x54ca34[_0xbda1('0x2f')]));_0x13c29f[_0xbda1('0x46')][_0xbda1('0x47')]=_0x482115['id'];if(_0x151a4d[_0xbda1('0x28')][_0xbda1('0x48')]){_0x13c29f[_0xbda1('0x46')]=_['merge'](_0x13c29f[_0xbda1('0x46')],{'$or':_['map'](_0x13c29f[_0xbda1('0x31')],function(_0x582f74){var _0x1f468f={};_0x1f468f[_0x582f74]={'$like':'%'+_0x151a4d[_0xbda1('0x28')][_0xbda1('0x48')]+'%'};return _0x1f468f;})});}if(_0x151a4d['query'][_0xbda1('0x49')]){var _0x838ff8=_0x151a4d[_0xbda1('0x28')][_0xbda1('0x49')][_0xbda1('0x4a')](',');var _0x662e23={};_0x662e23[_0x838ff8[0x0]]={'$gte':moment(_0x838ff8[0x1])[_0xbda1('0x4b')](_0xbda1('0x4c'))};_0x13c29f[_0xbda1('0x46')]=_[_0xbda1('0x36')](_0x13c29f[_0xbda1('0x46')],_0x662e23);}_0x13c29f=_['merge']({},_0x13c29f,_0x151a4d[_0xbda1('0x4d')]);return db[_0xbda1('0x3d')][_0xbda1('0x1a')]({'where':_0x13c29f['where']})['then'](function(_0x4acb0d){_0x3e6dba[_0xbda1('0x1a')]=_0x4acb0d;if(_0x151a4d['query'][_0xbda1('0x34')]){_0x13c29f[_0xbda1('0x35')]=[{'all':!![]}];}return db[_0xbda1('0x3d')][_0xbda1('0x27')](_0x13c29f);})[_0xbda1('0x1d')](function(_0x48eef3){_0x3e6dba[_0xbda1('0x4e')]=_0x48eef3;return _0x3e6dba;});}})[_0xbda1('0x1d')](respondWithFilteredResult(_0xeac3f3,_0x13c29f))[_0xbda1('0x29')](handleError(_0xeac3f3,null));};exports[_0xbda1('0x4f')]=function(_0x26b69b,_0x991767){return db[_0xbda1('0x37')][_0xbda1('0x38')]({'where':{'id':_0x26b69b['params']['id']}})['then'](handleEntityNotFound(_0x991767,null))['then'](function(_0x477199){if(_0x477199){return _0x477199[_0xbda1('0x50')](_0x26b69b[_0xbda1('0x3a')][_0xbda1('0x3e')],_[_0xbda1('0x3f')](_0x26b69b['body'],[_0xbda1('0x3e'),'id'])||{})[_0xbda1('0x51')](function(){return db[_0xbda1('0x52')][_0xbda1('0x27')]({'attributes':['id',_0xbda1('0x21'),_0xbda1('0x53')],'where':{'id':_0x26b69b['body']['ids']}});})[_0xbda1('0x1d')](function(_0x1f6cbe){socket['emit'](_0xbda1('0x54'),{'id':Number(_0x26b69b[_0xbda1('0x2c')]['id']),'tags':_0x1f6cbe||[]});return{'id':Number(_0x26b69b[_0xbda1('0x2c')]['id']),'tags':_0x1f6cbe||[]};});}})[_0xbda1('0x1d')](respondWithResult(_0x991767,null))['catch'](handleError(_0x991767,null));};exports[_0xbda1('0x55')]=function(_0x31ff51,_0x211083){return db[_0xbda1('0x37')]['find']({'where':{'id':_0x31ff51['params']['id']}})[_0xbda1('0x1d')](handleEntityNotFound(_0x211083,null))[_0xbda1('0x1d')](function(_0x416aba){if(_0x416aba){return _0x416aba[_0xbda1('0x55')](_0x31ff51[_0xbda1('0x28')]['ids']);}})['then'](respondWithStatusCode(_0x211083,null))[_0xbda1('0x29')](handleError(_0x211083,null));};exports['download']=function(_0x1a0f71,_0x6ef9b2){var _0x4d8fb4=moment()[_0xbda1('0x56')]()['toString']();var _0x1b6f31=path['join'](config[_0xbda1('0x57')],'server','files',_0xbda1('0x58'));var _0x359458=path[_0xbda1('0x59')](config[_0xbda1('0x57')],_0xbda1('0x5a'),_0xbda1('0x5b'),_0xbda1('0x5c'));var _0x403287=path[_0xbda1('0x59')](_0x1b6f31,_0x4d8fb4);var _0xd93b61=util[_0xbda1('0x4b')](_0xbda1('0x5d'),_0x1a0f71[_0xbda1('0x2c')]['id'],_0x4d8fb4);var _0x487083=path[_0xbda1('0x59')](_0x1b6f31,_0xd93b61);var _0x539f71=[];_0x539f71['push']({'model':db[_0xbda1('0x5e')],'as':'User','attributes':['id',_0xbda1('0x5f')],'raw':!![]});_0x539f71['push']({'model':db['CmContact'],'as':_0xbda1('0x60'),'attributes':['id',_0xbda1('0x61'),_0xbda1('0x62')],'raw':!![]});if(_0x1a0f71[_0xbda1('0x28')][_0xbda1('0x5c')]){_0x539f71[_0xbda1('0x63')]({'model':db[_0xbda1('0x64')],'as':_0xbda1('0x64'),'raw':!![]});}var _0x571a19=[{'model':db['OpenchannelMessage'],'as':_0xbda1('0x65'),'attributes':['id',_0xbda1('0x3a'),_0xbda1('0x66'),_0xbda1('0x67'),'secret',_0xbda1('0x68')],'include':_0x539f71}];_0x571a19['push']({'model':db[_0xbda1('0x69')],'as':'Account','attributes':['id',_0xbda1('0x21')]});_0x571a19['push']({'model':db[_0xbda1('0x5e')],'as':_0xbda1('0x6a'),'attributes':['id','fullname']});return db[_0xbda1('0x37')][_0xbda1('0x38')]({'where':{'id':_0x1a0f71[_0xbda1('0x2c')]['id']},'include':_0x571a19})[_0xbda1('0x1d')](handleEntityNotFound(_0x6ef9b2,null))['then'](function(_0xe5c235){if(_0xe5c235){var _0x17f3c7=_0xe5c235['get']({'plain':!![]});fs[_0xbda1('0x6b')](_0x403287);var _0x274d91={'channel':_0xbda1('0x6c'),'account':_0x17f3c7[_0xbda1('0x6d')][_0xbda1('0x21')],'agent':_0x17f3c7[_0xbda1('0x6a')]?_0x17f3c7[_0xbda1('0x6a')][_0xbda1('0x5f')]:_0xbda1('0x6e'),'createdAt':moment(_0x17f3c7[_0xbda1('0x66')])['format'](_0xbda1('0x4c'))[_0xbda1('0x6f')](),'closedAt':_0x17f3c7[_0xbda1('0x70')]?moment(_0x17f3c7[_0xbda1('0x71')])[_0xbda1('0x4b')](_0xbda1('0x4c'))[_0xbda1('0x6f')]():'','disposition':_0x17f3c7[_0xbda1('0x72')],'visibility':_0x17f3c7[_0xbda1('0x73')]?'Public':_0xbda1('0x74'),'messages':_(_0x17f3c7[_0xbda1('0x65')])[_0xbda1('0x48')]({'secret':![]})['map'](function(_0x321456){if(_0x321456[_0xbda1('0x64')]){var _0x2a59c5=path[_0xbda1('0x59')](_0x359458,_0x321456['Attachment'][_0xbda1('0x75')]);if(fs[_0xbda1('0x76')](_0x2a59c5)){fs[_0xbda1('0x77')](_0x2a59c5)[_0xbda1('0x78')](fs['createWriteStream'](path['join'](_0x403287,_0x321456[_0xbda1('0x64')][_0xbda1('0x75')])));}}return{'date':moment(_0x321456['createdAt'])['format'](_0xbda1('0x4c'))[_0xbda1('0x6f')](),'sender':_0x321456['direction']==='out'?_0x321456[_0xbda1('0x5e')]?_0x321456[_0xbda1('0x5e')][_0xbda1('0x5f')]:_0xbda1('0x79'):_0x321456['Contact'][_0xbda1('0x61')]+(_0x321456[_0xbda1('0x60')][_0xbda1('0x62')]?'\x20'+_0x321456[_0xbda1('0x60')][_0xbda1('0x62')]:''),'body':_0x321456[_0xbda1('0x64')]?_0x321456[_0xbda1('0x64')]['basename']:_0x321456[_0xbda1('0x3a')],'direction':_0x321456[_0xbda1('0x67')]===_0xbda1('0x7a')?'A':'C','secret':_0x321456[_0xbda1('0x7b')],'read':_0x321456['read'],'attachment':_0x321456['Attachment']};})[_0xbda1('0x7c')]()};return ejs[_0xbda1('0x7d')](path['join'](config[_0xbda1('0x57')],_0xbda1('0x5a'),_0xbda1('0x7e'),_0xbda1('0x7f')),{'interaction':_0x274d91})['then'](function(_0x282d62){var _0x45778a=path['join'](_0x403287,_0xbda1('0x80')+_0x17f3c7['id']+'-'+_0x4d8fb4+_0xbda1('0x81'));var _0xc835b={'path':_0x45778a,'channel':_0xbda1('0x6c'),'interactionId':_0x17f3c7['id']};return pdf[_0xbda1('0x82')](_0x282d62,_0xc835b);})[_0xbda1('0x1d')](function(){return new Promise(function(_0x1b11ef,_0x401a16){zipdir(_0x403287,{'saveTo':_0x487083},function(_0x3a54f5,_0x28db0f){if(_0x3a54f5)return _0x401a16(_0x3a54f5);return _0x1b11ef(_0x28db0f);});})[_0xbda1('0x1d')](function(){return new Promise(function(_0x40b1d9,_0x23b6dc){rimraf(_0x403287,function(_0xc378a3){if(_0xc378a3)_0x23b6dc(_0xc378a3);return _0x40b1d9();});});})['then'](function(){return _0x6ef9b2['download'](_0x487083,_0xd93b61,function(_0x19bb6f){if(_0x19bb6f){logger[_0xbda1('0x1f')]('Unable\x20to\x20delete\x20zip\x20file',_0x19bb6f);}else{fs[_0xbda1('0x83')](_0x487083);}});});});}else{return _0x6ef9b2[_0xbda1('0x13')](0xc8);}})[_0xbda1('0x29')](handleError(_0x6ef9b2,null));}; \ No newline at end of file +var _0xf218=['nolimit','order','sort','where','pick','OpenchannelInteractionId','map','$gte','split','includeAll','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','toString','root','server','files','join','attachments','transcript-%d-%s.zip','push','User','fullname','firstName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','filter','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','Contact','read','value','renderFile','views','downloadInteraction.ejs','.pdf','error','Unable\x20to\x20delete\x20zip\x20file','sendStatus','rimraf','zip-dir','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','json','offset','undefined','count','limit','Content-Range','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','getOptions','findAll','query','catch','from','params','keys','OpenchannelInteraction','filters','intersection','model','attributes','fields','length','include','merge','options','create','body','find','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty'];(function(_0xdb6b52,_0xfa8dbf){var _0x25e315=function(_0xf32a7d){while(--_0xf32a7d){_0xdb6b52['push'](_0xdb6b52['shift']());}};_0x25e315(++_0xfa8dbf);}(_0xf218,0x1ca));var _0x8f21=function(_0xf5dbed,_0x28884b){_0xf5dbed=_0xf5dbed-0x0;var _0x1b102f=_0xf218[_0xf5dbed];return _0x1b102f;};'use strict';var rimraf=require(_0x8f21('0x0'));var zipdir=require(_0x8f21('0x1'));var moment=require(_0x8f21('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x8f21('0x3'));var fs=require('fs');var _=require(_0x8f21('0x4'));var Redis=require(_0x8f21('0x5'));var interaction=require(_0x8f21('0x6'));var qs=require(_0x8f21('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x8f21('0x8'))(_0x8f21('0x9'));var config=require(_0x8f21('0xa'));var db=require('../../mysqldb')['db'];config[_0x8f21('0xb')]=_[_0x8f21('0xc')](config[_0x8f21('0xb')],{'host':_0x8f21('0xd'),'port':0x18eb});var socket=require(_0x8f21('0xe'))(new Redis(config[_0x8f21('0xb')]));require(_0x8f21('0xf'))['register'](socket);function respondWithStatusCode(_0x5a69e6,_0x266f98){_0x266f98=_0x266f98||0xcc;return function(_0x80a1f5){if(_0x80a1f5){return _0x5a69e6['sendStatus'](_0x266f98);}return _0x5a69e6['status'](_0x266f98)['end']();};}function respondWithResult(_0x489611,_0x431ebe){_0x431ebe=_0x431ebe||0xc8;return function(_0x2b02f7){if(_0x2b02f7){return _0x489611[_0x8f21('0x10')](_0x431ebe)[_0x8f21('0x11')](_0x2b02f7);}};}function respondWithFilteredResult(_0x430e1f,_0x5431ff){return function(_0x267961){if(_0x267961){var _0x23695e=typeof _0x5431ff[_0x8f21('0x12')]===_0x8f21('0x13')&&typeof _0x5431ff['limit']===_0x8f21('0x13');var _0x4ac944=_0x267961[_0x8f21('0x14')];var _0x129a4b=_0x23695e?0x0:_0x5431ff[_0x8f21('0x12')];var _0x1b61c0=_0x23695e?_0x267961['count']:_0x5431ff[_0x8f21('0x12')]+_0x5431ff[_0x8f21('0x15')];var _0x2d42fc;if(_0x1b61c0>=_0x4ac944){_0x1b61c0=_0x4ac944;_0x2d42fc=0xc8;}else{_0x2d42fc=0xce;}_0x430e1f[_0x8f21('0x10')](_0x2d42fc);return _0x430e1f['set'](_0x8f21('0x16'),_0x129a4b+'-'+_0x1b61c0+'/'+_0x4ac944)[_0x8f21('0x11')](_0x267961);}return null;};}function saveUpdates(_0x45bc59){return function(_0x4dc971){if(_0x4dc971){return _0x4dc971[_0x8f21('0x17')](_0x45bc59)[_0x8f21('0x18')](function(_0x3c7e77){return _0x3c7e77;});}return null;};}function removeEntity(_0x4ce608){return function(_0x34c24e){if(_0x34c24e){return _0x34c24e[_0x8f21('0x19')]()[_0x8f21('0x18')](function(){_0x4ce608['status'](0xcc)[_0x8f21('0x1a')]();});}};}function handleEntityNotFound(_0x4343a8){return function(_0xacc366){if(!_0xacc366){_0x4343a8['sendStatus'](0x194);}return _0xacc366;};}function handleError(_0x252627,_0x26c4ff){_0x26c4ff=_0x26c4ff||0x1f4;return function(_0x241764){logger['error'](_0x241764[_0x8f21('0x1b')]);if(_0x241764['name']){delete _0x241764[_0x8f21('0x1c')];}_0x252627['status'](_0x26c4ff)[_0x8f21('0x1d')](_0x241764);};}exports[_0x8f21('0x1e')]=function(_0x31e7be,_0x2e9d23){var _0x40c366={};var _0x10a230=_['map'](db['OpenchannelInteraction'][_0x8f21('0x1f')],function(_0xfcf4f3){return{'name':_0xfcf4f3[_0x8f21('0x20')],'type':_0xfcf4f3[_0x8f21('0x21')]['key']};});_0x40c366=qs[_0x8f21('0x22')](_0x10a230,_0x31e7be);return interaction[_0x8f21('0x23')]('openchannel',_0x31e7be[_0x8f21('0x24')],_0x31e7be['user'],_0x40c366,_0x10a230)['then'](respondWithFilteredResult(_0x2e9d23,_0x40c366))[_0x8f21('0x25')](handleError(_0x2e9d23,null));};exports['show']=function(_0x62078d,_0x34cd87){var _0x9815e4={};if(_0x62078d[_0x8f21('0x24')]['type']&&_0x62078d[_0x8f21('0x24')][_0x8f21('0x21')]==='from'){_0x9815e4[_0x8f21('0x26')]=_0x62078d['params']['id'];}else{_0x9815e4['id']=_0x62078d[_0x8f21('0x27')]['id'];}var _0x419a4d={'raw':![],'where':_0x9815e4},_0x89e859={};_0x89e859['model']=_[_0x8f21('0x28')](db[_0x8f21('0x29')][_0x8f21('0x1f')]);_0x89e859['query']=_[_0x8f21('0x28')](_0x62078d[_0x8f21('0x24')]);_0x89e859[_0x8f21('0x2a')]=_[_0x8f21('0x2b')](_0x89e859[_0x8f21('0x2c')],_0x89e859[_0x8f21('0x24')]);_0x419a4d[_0x8f21('0x2d')]=_[_0x8f21('0x2b')](_0x89e859[_0x8f21('0x2c')],qs[_0x8f21('0x2e')](_0x62078d[_0x8f21('0x24')][_0x8f21('0x2e')]));_0x419a4d[_0x8f21('0x2d')]=_0x419a4d[_0x8f21('0x2d')][_0x8f21('0x2f')]?_0x419a4d[_0x8f21('0x2d')]:_0x89e859[_0x8f21('0x2c')];if(_0x62078d[_0x8f21('0x24')]['includeAll']){_0x419a4d[_0x8f21('0x30')]=[{'all':!![]}];}_0x419a4d=_[_0x8f21('0x31')]({},_0x419a4d,_0x62078d[_0x8f21('0x32')]);return db[_0x8f21('0x29')]['find'](_0x419a4d)['then'](handleEntityNotFound(_0x34cd87,null))['then'](respondWithResult(_0x34cd87,null))[_0x8f21('0x25')](handleError(_0x34cd87,null));};exports[_0x8f21('0x33')]=function(_0x48482e,_0x26fadc){return db['OpenchannelInteraction'][_0x8f21('0x33')](_0x48482e[_0x8f21('0x34')],{})[_0x8f21('0x18')](respondWithResult(_0x26fadc,0xc9))[_0x8f21('0x25')](handleError(_0x26fadc,null));};exports[_0x8f21('0x17')]=function(_0x3ee655,_0x58f59d){if(_0x3ee655[_0x8f21('0x34')]['id']){delete _0x3ee655[_0x8f21('0x34')]['id'];}return db['OpenchannelInteraction'][_0x8f21('0x35')]({'where':{'id':_0x3ee655[_0x8f21('0x27')]['id']}})[_0x8f21('0x18')](handleEntityNotFound(_0x58f59d,null))[_0x8f21('0x18')](saveUpdates(_0x3ee655['body'],null))[_0x8f21('0x18')](respondWithResult(_0x58f59d,null))[_0x8f21('0x25')](handleError(_0x58f59d,null));};exports[_0x8f21('0x19')]=function(_0x1ee3e6,_0x552ea7){return db['OpenchannelInteraction'][_0x8f21('0x35')]({'where':{'id':_0x1ee3e6['params']['id']}})['then'](handleEntityNotFound(_0x552ea7,null))[_0x8f21('0x18')](removeEntity(_0x552ea7,null))[_0x8f21('0x25')](handleError(_0x552ea7,null));};exports[_0x8f21('0x36')]=function(_0x1b26db,_0x3ea60d){return db['OpenchannelInteraction'][_0x8f21('0x36')]()[_0x8f21('0x18')](respondWithResult(_0x3ea60d,null))['catch'](handleError(_0x3ea60d,null));};exports['addMessage']=function(_0x56d2ba,_0x5ab960){return db[_0x8f21('0x37')][_0x8f21('0x35')]({'where':{'id':_0x56d2ba[_0x8f21('0x27')]['id']}})[_0x8f21('0x18')](handleEntityNotFound(_0x5ab960,null))[_0x8f21('0x18')](function(_0x1172fa){if(_0x1172fa){return _0x1172fa[_0x8f21('0x38')](_0x56d2ba[_0x8f21('0x34')][_0x8f21('0x39')],_[_0x8f21('0x3a')](_0x56d2ba[_0x8f21('0x34')],[_0x8f21('0x39'),'id'])||{});}})[_0x8f21('0x18')](respondWithResult(_0x5ab960,null))['catch'](handleError(_0x5ab960,null));};exports[_0x8f21('0x3b')]=function(_0x21eeee,_0x58a1b8){var _0x228b39={'raw':![],'where':{}};var _0x343f2e={};var _0x4bccfc={'count':0x0,'rows':[]};return db[_0x8f21('0x29')][_0x8f21('0x3c')]({'where':{'id':_0x21eeee['params']['id']}})['then'](handleEntityNotFound(_0x58a1b8,null))[_0x8f21('0x18')](function(_0x315028){if(_0x315028){_0x343f2e[_0x8f21('0x2c')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x343f2e['query']=_[_0x8f21('0x28')](_0x21eeee['query']);_0x343f2e[_0x8f21('0x2a')]=_['intersection'](_0x343f2e['model'],_0x343f2e[_0x8f21('0x24')]);_0x228b39['attributes']=_[_0x8f21('0x2b')](_0x343f2e[_0x8f21('0x2c')],qs[_0x8f21('0x2e')](_0x21eeee[_0x8f21('0x24')]['fields']));_0x228b39[_0x8f21('0x2d')]=_0x228b39[_0x8f21('0x2d')][_0x8f21('0x2f')]?_0x228b39[_0x8f21('0x2d')]:_0x343f2e[_0x8f21('0x2c')];if(!_0x21eeee[_0x8f21('0x24')][_0x8f21('0x3d')](_0x8f21('0x3e'))){_0x228b39['limit']=qs[_0x8f21('0x15')](_0x21eeee['query']['limit']);_0x228b39['offset']=qs[_0x8f21('0x12')](_0x21eeee['query']['offset']);}_0x228b39[_0x8f21('0x3f')]=qs[_0x8f21('0x40')](_0x21eeee[_0x8f21('0x24')]['sort']);_0x228b39[_0x8f21('0x41')]=qs[_0x8f21('0x2a')](_[_0x8f21('0x42')](_0x21eeee[_0x8f21('0x24')],_0x343f2e[_0x8f21('0x2a')]));_0x228b39[_0x8f21('0x41')][_0x8f21('0x43')]=_0x315028['id'];if(_0x21eeee[_0x8f21('0x24')]['filter']){_0x228b39[_0x8f21('0x41')]=_[_0x8f21('0x31')](_0x228b39['where'],{'$or':_[_0x8f21('0x44')](_0x228b39[_0x8f21('0x2d')],function(_0x350bc6){var _0x5249b4={};_0x5249b4[_0x350bc6]={'$like':'%'+_0x21eeee[_0x8f21('0x24')]['filter']+'%'};return _0x5249b4;})});}if(_0x21eeee[_0x8f21('0x24')][_0x8f21('0x45')]){var _0x2dfb5f=_0x21eeee[_0x8f21('0x24')][_0x8f21('0x45')][_0x8f21('0x46')](',');var _0x1917c3={};_0x1917c3[_0x2dfb5f[0x0]]={'$gte':moment(_0x2dfb5f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x228b39[_0x8f21('0x41')]=_[_0x8f21('0x31')](_0x228b39[_0x8f21('0x41')],_0x1917c3);}_0x228b39=_[_0x8f21('0x31')]({},_0x228b39,_0x21eeee[_0x8f21('0x32')]);return db['OpenchannelMessage'][_0x8f21('0x14')]({'where':_0x228b39[_0x8f21('0x41')]})[_0x8f21('0x18')](function(_0x46359e){_0x4bccfc[_0x8f21('0x14')]=_0x46359e;if(_0x21eeee[_0x8f21('0x24')][_0x8f21('0x47')]){_0x228b39[_0x8f21('0x30')]=[{'all':!![]}];}return db[_0x8f21('0x37')]['findAll'](_0x228b39);})[_0x8f21('0x18')](function(_0x2afb75){_0x4bccfc['rows']=_0x2afb75;return _0x4bccfc;});}})[_0x8f21('0x18')](respondWithFilteredResult(_0x58a1b8,_0x228b39))[_0x8f21('0x25')](handleError(_0x58a1b8,null));};exports[_0x8f21('0x48')]=function(_0x326508,_0x44f40a){return db[_0x8f21('0x29')][_0x8f21('0x35')]({'where':{'id':_0x326508[_0x8f21('0x27')]['id']}})[_0x8f21('0x18')](handleEntityNotFound(_0x44f40a,null))[_0x8f21('0x18')](function(_0xd8bca6){if(_0xd8bca6){return _0xd8bca6['setTags'](_0x326508[_0x8f21('0x34')][_0x8f21('0x39')],_[_0x8f21('0x3a')](_0x326508[_0x8f21('0x34')],[_0x8f21('0x39'),'id'])||{})[_0x8f21('0x49')](function(){return db[_0x8f21('0x4a')][_0x8f21('0x23')]({'attributes':['id',_0x8f21('0x1c'),_0x8f21('0x4b')],'where':{'id':_0x326508[_0x8f21('0x34')][_0x8f21('0x39')]}});})[_0x8f21('0x18')](function(_0x3c4286){socket[_0x8f21('0x4c')](_0x8f21('0x4d'),{'id':Number(_0x326508['params']['id']),'tags':_0x3c4286||[]});return{'id':Number(_0x326508[_0x8f21('0x27')]['id']),'tags':_0x3c4286||[]};});}})[_0x8f21('0x18')](respondWithResult(_0x44f40a,null))[_0x8f21('0x25')](handleError(_0x44f40a,null));};exports[_0x8f21('0x4e')]=function(_0x2cf976,_0x414d57){return db[_0x8f21('0x29')][_0x8f21('0x35')]({'where':{'id':_0x2cf976[_0x8f21('0x27')]['id']}})[_0x8f21('0x18')](handleEntityNotFound(_0x414d57,null))['then'](function(_0x345e58){if(_0x345e58){return _0x345e58[_0x8f21('0x4e')](_0x2cf976[_0x8f21('0x24')][_0x8f21('0x39')]);}})['then'](respondWithStatusCode(_0x414d57,null))[_0x8f21('0x25')](handleError(_0x414d57,null));};exports[_0x8f21('0x4f')]=function(_0x36d60c,_0x514dcf){var _0x3b6c44=moment()['unix']()[_0x8f21('0x50')]();var _0x5c4217=path['join'](config[_0x8f21('0x51')],_0x8f21('0x52'),_0x8f21('0x53'),'tmp');var _0x5e51bc=path[_0x8f21('0x54')](config['root'],_0x8f21('0x52'),_0x8f21('0x53'),_0x8f21('0x55'));var _0x20e310=path[_0x8f21('0x54')](_0x5c4217,_0x3b6c44);var _0x4fe117=util['format'](_0x8f21('0x56'),_0x36d60c[_0x8f21('0x27')]['id'],_0x3b6c44);var _0x48958c=path[_0x8f21('0x54')](_0x5c4217,_0x4fe117);var _0x3385bc=[];_0x3385bc[_0x8f21('0x57')]({'model':db['User'],'as':_0x8f21('0x58'),'attributes':['id',_0x8f21('0x59')],'raw':!![]});_0x3385bc[_0x8f21('0x57')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x8f21('0x5a'),'lastName'],'raw':!![]});if(_0x36d60c[_0x8f21('0x24')][_0x8f21('0x55')]){_0x3385bc[_0x8f21('0x57')]({'model':db['Attachment'],'as':_0x8f21('0x5b'),'raw':!![]});}var _0xa12079=[{'model':db[_0x8f21('0x37')],'as':_0x8f21('0x5c'),'attributes':['id',_0x8f21('0x34'),_0x8f21('0x5d'),_0x8f21('0x5e'),_0x8f21('0x5f'),'read'],'include':_0x3385bc}];_0xa12079[_0x8f21('0x57')]({'model':db[_0x8f21('0x60')],'as':_0x8f21('0x61'),'attributes':['id',_0x8f21('0x1c')]});_0xa12079[_0x8f21('0x57')]({'model':db[_0x8f21('0x58')],'as':_0x8f21('0x62'),'attributes':['id',_0x8f21('0x59')]});return db[_0x8f21('0x29')][_0x8f21('0x35')]({'where':{'id':_0x36d60c['params']['id']},'include':_0xa12079})[_0x8f21('0x18')](handleEntityNotFound(_0x514dcf,null))[_0x8f21('0x18')](function(_0x2ffe9b){if(_0x2ffe9b){var _0x36d3d3=_0x2ffe9b[_0x8f21('0x63')]({'plain':!![]});fs[_0x8f21('0x64')](_0x20e310);var _0x2cb363={'channel':_0x8f21('0x65'),'account':_0x36d3d3[_0x8f21('0x61')][_0x8f21('0x1c')],'agent':_0x36d3d3[_0x8f21('0x62')]?_0x36d3d3['Owner'][_0x8f21('0x59')]:_0x8f21('0x66'),'createdAt':moment(_0x36d3d3[_0x8f21('0x5d')])[_0x8f21('0x67')](_0x8f21('0x68'))[_0x8f21('0x50')](),'closedAt':_0x36d3d3[_0x8f21('0x69')]?moment(_0x36d3d3[_0x8f21('0x6a')])['format'](_0x8f21('0x68'))[_0x8f21('0x50')]():'','disposition':_0x36d3d3[_0x8f21('0x6b')],'visibility':_0x36d3d3[_0x8f21('0x6c')]?_0x8f21('0x6d'):_0x8f21('0x6e'),'messages':_(_0x36d3d3[_0x8f21('0x5c')])[_0x8f21('0x6f')]({'secret':![]})['map'](function(_0xa1660b){if(_0xa1660b['Attachment']){var _0x33e2f4=path[_0x8f21('0x54')](_0x5e51bc,_0xa1660b['Attachment'][_0x8f21('0x70')]);if(fs[_0x8f21('0x71')](_0x33e2f4)){fs[_0x8f21('0x72')](_0x33e2f4)[_0x8f21('0x73')](fs[_0x8f21('0x74')](path['join'](_0x20e310,_0xa1660b[_0x8f21('0x5b')][_0x8f21('0x70')])));}}return{'date':moment(_0xa1660b['createdAt'])[_0x8f21('0x67')](_0x8f21('0x68'))[_0x8f21('0x50')](),'sender':_0xa1660b['direction']===_0x8f21('0x75')?_0xa1660b[_0x8f21('0x58')]?_0xa1660b[_0x8f21('0x58')][_0x8f21('0x59')]:_0x8f21('0x76'):_0xa1660b['Contact'][_0x8f21('0x5a')]+(_0xa1660b['Contact'][_0x8f21('0x77')]?'\x20'+_0xa1660b[_0x8f21('0x78')]['lastName']:''),'body':_0xa1660b['Attachment']?_0xa1660b[_0x8f21('0x5b')]['basename']:_0xa1660b['body'],'direction':_0xa1660b[_0x8f21('0x5e')]==='out'?'A':'C','secret':_0xa1660b['secret'],'read':_0xa1660b[_0x8f21('0x79')],'attachment':_0xa1660b[_0x8f21('0x5b')]};})[_0x8f21('0x7a')]()};return ejs[_0x8f21('0x7b')](path[_0x8f21('0x54')](config[_0x8f21('0x51')],_0x8f21('0x52'),_0x8f21('0x7c'),_0x8f21('0x7d')),{'interaction':_0x2cb363})[_0x8f21('0x18')](function(_0x35acbe){var _0x1eae96=path[_0x8f21('0x54')](_0x20e310,'transcript-'+_0x36d3d3['id']+'-'+_0x3b6c44+_0x8f21('0x7e'));var _0x54a837={'path':_0x1eae96,'channel':_0x8f21('0x65'),'interactionId':_0x36d3d3['id']};return pdf['createPdfFromHTML'](_0x35acbe,_0x54a837);})[_0x8f21('0x18')](function(){return new Promise(function(_0xda2d23,_0x1d9d59){zipdir(_0x20e310,{'saveTo':_0x48958c},function(_0x14ebd3,_0x47b5a7){if(_0x14ebd3)return _0x1d9d59(_0x14ebd3);return _0xda2d23(_0x47b5a7);});})['then'](function(){return new Promise(function(_0x2755d7,_0x4799a3){rimraf(_0x20e310,function(_0x1a5ac1){if(_0x1a5ac1)_0x4799a3(_0x1a5ac1);return _0x2755d7();});});})[_0x8f21('0x18')](function(){return _0x514dcf[_0x8f21('0x4f')](_0x48958c,_0x4fe117,function(_0x55d5dd){if(_0x55d5dd){logger[_0x8f21('0x7f')](_0x8f21('0x80'),_0x55d5dd);}else{fs['unlinkSync'](_0x48958c);}});});});}else{return _0x514dcf[_0x8f21('0x81')](0xc8);}})[_0x8f21('0x25')](handleError(_0x514dcf,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e034202..1be7918 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 _0x4178=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x4178,0xa0));var _0x8417=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4178[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require(_0x8417('0x0'));var OpenchannelInteraction=require(_0x8417('0x1'))['db'][_0x8417('0x2')];var OpenchannelMessage=require(_0x8417('0x1'))['db'][_0x8417('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8417('0x4')](0x0);var events={'afterCreate':_0x8417('0x5'),'afterUpdate':_0x8417('0x6'),'afterDestroy':_0x8417('0x7')};function emitEvent(_0x546c4e){return function(_0x1bddca,_0x56cb21,_0x438269){_0x1bddca['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x52df1c){_0x1bddca[_0x8417('0x8')](_0x8417('0x9'),_0x52df1c['map'](function(_0x1d7c35){return{'id':_0x1d7c35['id']};}));return OpenchannelMessage[_0x8417('0xa')]({'where':{'OpenchannelInteractionId':_0x1bddca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8417('0xb')](function(_0x50217b){_0x1bddca[_0x8417('0x8')](_0x8417('0xc'),_0x50217b[_0x8417('0xd')]);OpenchannelInteractionEvents['emit'](_0x546c4e+':'+_0x1bddca['id'],_0x1bddca);OpenchannelInteractionEvents[_0x8417('0xe')](_0x546c4e,_0x1bddca);_0x438269(null);})[_0x8417('0xf')](_0x438269(null));};}for(var e in events){if(events[_0x8417('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x8417('0x11')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x56cd=['unreadMessages','length','emit','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll'];(function(_0x3c2e27,_0x1f0b8c){var _0x3fc1e3=function(_0x5bc3da){while(--_0x5bc3da){_0x3c2e27['push'](_0x3c2e27['shift']());}};_0x3fc1e3(++_0x1f0b8c);}(_0x56cd,0x1d0));var _0xd56c=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x56cd[_0x54d4a8];return _0x3b321b;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xd56c('0x0'))['db'][_0xd56c('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xd56c('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd56c('0x3')](0x0);var events={'afterCreate':_0xd56c('0x4'),'afterUpdate':_0xd56c('0x5'),'afterDestroy':_0xd56c('0x6')};function emitEvent(_0x33982f){return function(_0x184d43,_0x580cad,_0x352594){_0x184d43[_0xd56c('0x7')]({'attributes':['id'],'raw':!![]})[_0xd56c('0x8')](function(_0xb52dfb){_0x184d43[_0xd56c('0x9')](_0xd56c('0xa'),_0xb52dfb['map'](function(_0x482245){return{'id':_0x482245['id']};}));return OpenchannelMessage[_0xd56c('0xb')]({'where':{'OpenchannelInteractionId':_0x184d43['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd56c('0x8')](function(_0x1a9254){_0x184d43[_0xd56c('0x9')](_0xd56c('0xc'),_0x1a9254[_0xd56c('0xd')]);OpenchannelInteractionEvents[_0xd56c('0xe')](_0x33982f+':'+_0x184d43['id'],_0x184d43);OpenchannelInteractionEvents[_0xd56c('0xe')](_0x33982f,_0x184d43);_0x352594(null);})['catch'](_0x352594(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xd56c('0xf')](e,emitEvent(event));}}module[_0xd56c('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index bdfde23..2721a60 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 _0x368b=['define','OpenchannelInteraction','utf8mb4','changed','closedAt','format','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x2e839a,_0xad03e6){var _0x535ede=function(_0x1cffe5){while(--_0x1cffe5){_0x2e839a['push'](_0x2e839a['shift']());}};_0x535ede(++_0xad03e6);}(_0x368b,0x76));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb368('0x0'));var util=require(_0xb368('0x1'));var logger=require(_0xb368('0x2'))(_0xb368('0x3'));var moment=require('moment');var BPromise=require(_0xb368('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb368('0x5'));var rimraf=require(_0xb368('0x6'));var config=require(_0xb368('0x7'));var attributes=require(_0xb368('0x8'));module[_0xb368('0x9')]=function(_0xa250cb,_0x35233e){return _0xa250cb[_0xb368('0xa')](_0xb368('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb368('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x3be87f,_0x1ea0c0,_0x316b09){if(_0x3be87f[_0xb368('0xd')]('closed')){_0x3be87f[_0xb368('0xe')]=moment()[_0xb368('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x316b09(null,_0x3be87f);}}});}; \ No newline at end of file +var _0x8d5c=['define','OpenchannelInteraction','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x33f57c,_0x39a843){var _0xb864de=function(_0x435439){while(--_0x435439){_0x33f57c['push'](_0x33f57c['shift']());}};_0xb864de(++_0x39a843);}(_0x8d5c,0x71));var _0xc8d5=function(_0x447f6d,_0x36fc29){_0x447f6d=_0x447f6d-0x0;var _0x56a9b8=_0x8d5c[_0x447f6d];return _0x56a9b8;};'use strict';var _=require(_0xc8d5('0x0'));var util=require('util');var logger=require(_0xc8d5('0x1'))(_0xc8d5('0x2'));var moment=require('moment');var BPromise=require(_0xc8d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8d5('0x4'));var rimraf=require('rimraf');var config=require(_0xc8d5('0x5'));var attributes=require('./openchannelInteraction.attributes');module[_0xc8d5('0x6')]=function(_0x1ab1c3,_0x1fcd09){return _0x1ab1c3[_0xc8d5('0x7')](_0xc8d5('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc8d5('0x9'),'hooks':{'beforeUpdate':function(_0x47744e,_0x473654,_0x34aed8){if(_0x47744e[_0xc8d5('0xa')](_0xc8d5('0xb'))){_0x47744e[_0xc8d5('0xc')]=moment()[_0xc8d5('0xd')](_0xc8d5('0xe'));}_0x34aed8(null,_0x47744e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 084ef40..3eb4e2c 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 _0xdc97=['stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0xdc97,0x116));var _0x7dc9=function(_0x49c4b0,_0x2843c6){_0x49c4b0=_0x49c4b0-0x0;var _0xf3c77b=_0xdc97[_0x49c4b0];return _0xf3c77b;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require(_0x7dc9('0x3'));var rs=require(_0x7dc9('0x4'));var fs=require('fs');var Redis=require(_0x7dc9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dc9('0x6'));var logger=require(_0x7dc9('0x7'))('rpc');var config=require(_0x7dc9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7dc9('0x9')][_0x7dc9('0xa')]({'port':0x232a});config[_0x7dc9('0xb')]=_[_0x7dc9('0xc')](config[_0x7dc9('0xb')],{'host':_0x7dc9('0xd'),'port':0x18eb});var socket=require(_0x7dc9('0xe'))(new Redis(config[_0x7dc9('0xb')]));require(_0x7dc9('0xf'))[_0x7dc9('0x10')](socket);function respondWithRpcPromise(_0x38793e,_0xaabdad,_0x548885){return new BPromise(function(_0x3f3400,_0x292253){return client[_0x7dc9('0x11')](_0x38793e,_0x548885)[_0x7dc9('0x12')](function(_0xe12db9){logger[_0x7dc9('0x13')](_0x7dc9('0x14'),_0xaabdad,_0x7dc9('0x15'));logger[_0x7dc9('0x16')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xaabdad,'request\x20sent',JSON[_0x7dc9('0x17')](_0xe12db9));if(_0xe12db9[_0x7dc9('0x18')]){if(_0xe12db9['error']['code']===0x1f4){logger[_0x7dc9('0x18')](_0x7dc9('0x14'),_0xaabdad,_0xe12db9[_0x7dc9('0x18')]['message']);return _0x292253(_0xe12db9['error'][_0x7dc9('0x19')]);}logger[_0x7dc9('0x18')](_0x7dc9('0x14'),_0xaabdad,_0xe12db9['error'][_0x7dc9('0x19')]);return _0x3f3400(_0xe12db9[_0x7dc9('0x18')][_0x7dc9('0x19')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xaabdad,'request\x20sent');_0x3f3400(_0xe12db9[_0x7dc9('0x1a')]['message']);}})[_0x7dc9('0x1b')](function(_0x561652){logger[_0x7dc9('0x18')](_0x7dc9('0x14'),_0xaabdad,_0x561652);_0x292253(_0x561652);});});}exports[_0x7dc9('0x1c')]=function(_0x54f066){var _0x51901e=this;return new Promise(function(_0x2fd163,_0x58cf7b){return db[_0x7dc9('0x1d')][_0x7dc9('0x1e')](_0x54f066[_0x7dc9('0x1f')],{'raw':_0x54f066['options']?_0x54f066[_0x7dc9('0x20')][_0x7dc9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54f066[_0x7dc9('0x20')]?_0x54f066['options'][_0x7dc9('0x22')]||null:null,'attributes':_0x54f066[_0x7dc9('0x20')]?_0x54f066[_0x7dc9('0x20')][_0x7dc9('0x23')]||null:null,'limit':_0x54f066['options']?_0x54f066['options']['limit']||null:null})['then'](function(_0x3ce03a){logger['info'](_0x7dc9('0x1c'),_0x54f066);logger[_0x7dc9('0x16')](_0x7dc9('0x1c'),_0x54f066,JSON[_0x7dc9('0x17')](_0x3ce03a));_0x2fd163(_0x3ce03a);})['catch'](function(_0x3784a0){logger['error']('UpdateOpenchannelInteraction',_0x3784a0[_0x7dc9('0x19')],_0x54f066);_0x58cf7b(_0x51901e[_0x7dc9('0x18')](0x1f4,_0x3784a0[_0x7dc9('0x19')]));});});};exports[_0x7dc9('0x24')]=function(_0x50244e){return new Promise(function(_0x1fb13f,_0x2de360){return db[_0x7dc9('0x1d')][_0x7dc9('0x25')]({'where':_0x50244e[_0x7dc9('0x20')]?_0x50244e[_0x7dc9('0x20')][_0x7dc9('0x22')]||null:null})[_0x7dc9('0x12')](function(_0x3f3fdc){if(_0x3f3fdc){return _0x3f3fdc[_0x7dc9('0x26')](_0x50244e['body']['ids'],_[_0x7dc9('0x27')](_0x50244e[_0x7dc9('0x1f')],[_0x7dc9('0x28'),'id'])||{});}})[_0x7dc9('0x29')](function(_0x18b489){logger['info'](_0x7dc9('0x2a'),_0x50244e);logger[_0x7dc9('0x16')](_0x7dc9('0x2a'),_0x50244e,JSON[_0x7dc9('0x17')](_0x18b489));_0x1fb13f(_0x18b489);})[_0x7dc9('0x1b')](function(_0x613e13){logger[_0x7dc9('0x18')]('AddTags',_0x613e13[_0x7dc9('0x19')],_0x50244e);_0x2de360(_this[_0x7dc9('0x18')](0x1f4,_0x613e13[_0x7dc9('0x19')]));});});}; \ No newline at end of file +var _0x9d3d=['omit','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','./openchannelInteraction.socket','register','request','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelInteraction,\x20%s,\x20%s','result','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids'];(function(_0x490e30,_0x434a81){var _0x1a0511=function(_0x1bc26f){while(--_0x1bc26f){_0x490e30['push'](_0x490e30['shift']());}};_0x1a0511(++_0x434a81);}(_0x9d3d,0x129));var _0xd9d3=function(_0x39c47d,_0xb2f331){_0x39c47d=_0x39c47d-0x0;var _0x554812=_0x9d3d[_0x39c47d];return _0x554812;};'use strict';var _=require(_0xd9d3('0x0'));var util=require(_0xd9d3('0x1'));var moment=require(_0xd9d3('0x2'));var BPromise=require(_0xd9d3('0x3'));var rs=require(_0xd9d3('0x4'));var fs=require('fs');var Redis=require(_0xd9d3('0x5'));var db=require(_0xd9d3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd9d3('0x7'));var config=require(_0xd9d3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9d3('0x9')][_0xd9d3('0xa')]({'port':0x232a});config[_0xd9d3('0xb')]=_[_0xd9d3('0xc')](config[_0xd9d3('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9d3('0xb')]));require(_0xd9d3('0xd'))[_0xd9d3('0xe')](socket);function respondWithRpcPromise(_0xc962da,_0xc13737,_0x29ec96){return new BPromise(function(_0x11af65,_0x27e83){return client[_0xd9d3('0xf')](_0xc962da,_0x29ec96)[_0xd9d3('0x10')](function(_0x5f01aa){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xc13737,_0xd9d3('0x11'));logger[_0xd9d3('0x12')](_0xd9d3('0x13'),_0xc13737,_0xd9d3('0x11'),JSON[_0xd9d3('0x14')](_0x5f01aa));if(_0x5f01aa[_0xd9d3('0x15')]){if(_0x5f01aa[_0xd9d3('0x15')][_0xd9d3('0x16')]===0x1f4){logger[_0xd9d3('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xc13737,_0x5f01aa['error']['message']);return _0x27e83(_0x5f01aa['error'][_0xd9d3('0x17')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xc13737,_0x5f01aa[_0xd9d3('0x15')][_0xd9d3('0x17')]);return _0x11af65(_0x5f01aa[_0xd9d3('0x15')]['message']);}else{logger[_0xd9d3('0x18')](_0xd9d3('0x19'),_0xc13737,'request\x20sent');_0x11af65(_0x5f01aa[_0xd9d3('0x1a')]['message']);}})['catch'](function(_0x3f25d3){logger['error'](_0xd9d3('0x19'),_0xc13737,_0x3f25d3);_0x27e83(_0x3f25d3);});});}exports[_0xd9d3('0x1b')]=function(_0x566824){var _0xd719e5=this;return new Promise(function(_0x355903,_0x1ce60f){return db['OpenchannelInteraction'][_0xd9d3('0x1c')](_0x566824[_0xd9d3('0x1d')],{'raw':_0x566824[_0xd9d3('0x1e')]?_0x566824[_0xd9d3('0x1e')][_0xd9d3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x566824['options']?_0x566824['options'][_0xd9d3('0x20')]||null:null,'attributes':_0x566824['options']?_0x566824[_0xd9d3('0x1e')][_0xd9d3('0x21')]||null:null,'limit':_0x566824[_0xd9d3('0x1e')]?_0x566824[_0xd9d3('0x1e')]['limit']||null:null})[_0xd9d3('0x10')](function(_0x584a81){logger[_0xd9d3('0x18')]('UpdateOpenchannelInteraction',_0x566824);logger['debug'](_0xd9d3('0x1b'),_0x566824,JSON[_0xd9d3('0x14')](_0x584a81));_0x355903(_0x584a81);})['catch'](function(_0x494ef4){logger['error'](_0xd9d3('0x1b'),_0x494ef4[_0xd9d3('0x17')],_0x566824);_0x1ce60f(_0xd719e5[_0xd9d3('0x15')](0x1f4,_0x494ef4['message']));});});};exports[_0xd9d3('0x22')]=function(_0x5224e2){return new Promise(function(_0xeeb2eb,_0x458cac){return db[_0xd9d3('0x23')][_0xd9d3('0x24')]({'where':_0x5224e2[_0xd9d3('0x1e')]?_0x5224e2['options'][_0xd9d3('0x20')]||null:null})[_0xd9d3('0x10')](function(_0x3419c7){if(_0x3419c7){return _0x3419c7[_0xd9d3('0x25')](_0x5224e2[_0xd9d3('0x1d')][_0xd9d3('0x26')],_[_0xd9d3('0x27')](_0x5224e2[_0xd9d3('0x1d')],[_0xd9d3('0x26'),'id'])||{});}})['spread'](function(_0x151920){logger['info'](_0xd9d3('0x28'),_0x5224e2);logger['debug'](_0xd9d3('0x28'),_0x5224e2,JSON[_0xd9d3('0x14')](_0x151920));_0xeeb2eb(_0x151920);})[_0xd9d3('0x29')](function(_0x4a0c9a){logger[_0xd9d3('0x15')]('AddTags',_0x4a0c9a[_0xd9d3('0x17')],_0x5224e2);_0x458cac(_this[_0xd9d3('0x15')](0x1f4,_0x4a0c9a[_0xd9d3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 9dad81b..76dce4f 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 _0x121c=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','update','removeListener'];(function(_0xf4702a,_0x1366b7){var _0x554c3a=function(_0x4f1204){while(--_0x4f1204){_0xf4702a['push'](_0xf4702a['shift']());}};_0x554c3a(++_0x1366b7);}(_0x121c,0x192));var _0xc121=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x121c[_0x2b4411];return _0x8e41ef;};'use strict';var OpenchannelInteractionEvents=require(_0xc121('0x0'));var events=[_0xc121('0x1'),'remove',_0xc121('0x2')];function createListener(_0x541a72,_0x139408){return function(_0x5b2ca2){_0x139408['emit'](_0x541a72,_0x5b2ca2);};}function removeListener(_0x123a7,_0x41ddca){return function(){OpenchannelInteractionEvents[_0xc121('0x3')](_0x123a7,_0x41ddca);};}exports[_0xc121('0x4')]=function(_0x26a052){for(var _0x393c9b=0x0,_0x4d8326=events[_0xc121('0x5')];_0x393c9b<_0x4d8326;_0x393c9b++){var _0x194fae=events[_0x393c9b];var _0x8383d3=createListener(_0xc121('0x6')+_0x194fae,_0x26a052);OpenchannelInteractionEvents['on'](_0x194fae,_0x8383d3);}}; \ No newline at end of file +var _0x8f7a=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x58ee6b,_0x11d776){var _0x1d9210=function(_0x3c78ad){while(--_0x3c78ad){_0x58ee6b['push'](_0x58ee6b['shift']());}};_0x1d9210(++_0x11d776);}(_0x8f7a,0xbe));var _0xa8f7=function(_0x3fc7fa,_0x433a3f){_0x3fc7fa=_0x3fc7fa-0x0;var _0x5e518f=_0x8f7a[_0x3fc7fa];return _0x5e518f;};'use strict';var OpenchannelInteractionEvents=require(_0xa8f7('0x0'));var events=[_0xa8f7('0x1'),_0xa8f7('0x2'),_0xa8f7('0x3')];function createListener(_0x24da2b,_0x21a989){return function(_0x4f4978){_0x21a989[_0xa8f7('0x4')](_0x24da2b,_0x4f4978);};}function removeListener(_0x3ff639,_0x1b9000){return function(){OpenchannelInteractionEvents[_0xa8f7('0x5')](_0x3ff639,_0x1b9000);};}exports[_0xa8f7('0x6')]=function(_0x3c8d2a){for(var _0x3fddac=0x0,_0x442a09=events[_0xa8f7('0x7')];_0x3fddac<_0x442a09;_0x3fddac++){var _0x2b29d0=events[_0x3fddac];var _0x4c124a=createListener(_0xa8f7('0x8')+_0x2b29d0,_0x3c8d2a);OpenchannelInteractionEvents['on'](_0x2b29d0,_0x4c124a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9d812fa..abde887 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 _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0xbd3651,_0x3d9376){var _0x5305b3=function(_0x11dbff){while(--_0x11dbff){_0xbd3651['push'](_0xbd3651['shift']());}};_0x5305b3(++_0x3d9376);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index d965665..35705f1 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 _0x23a3=['out','DATE','STRING','TEXT','medium','BOOLEAN','ENUM'];(function(_0x384146,_0x45bebc){var _0x5c9510=function(_0x2435d0){while(--_0x2435d0){_0x384146['push'](_0x384146['shift']());}};_0x5c9510(++_0x45bebc);}(_0x23a3,0x131));var _0x323a=function(_0x31131c,_0x30e12b){_0x31131c=_0x31131c-0x0;var _0x199fcb=_0x23a3[_0x31131c];return _0x199fcb;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x323a('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x323a('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x323a('0x2')]('in',_0x323a('0x3')),'defaultValue':_0x323a('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x323a('0x4')]},'providerName':{'type':Sequelize[_0x323a('0x5')]},'providerResponse':{'type':Sequelize[_0x323a('0x6')]}}; \ No newline at end of file +var _0x117c=['ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x117c,0x71));var _0xc117=function(_0x206137,_0x2a56c7){_0x206137=_0x206137-0x0;var _0x96c5f7=_0x117c[_0x206137];return _0x96c5f7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xc117('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc117('0x1')]('in',_0xc117('0x2')),'defaultValue':_0xc117('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc117('0x3')]},'providerName':{'type':Sequelize[_0xc117('0x4')]},'providerResponse':{'type':Sequelize[_0xc117('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index ee11d41..9365d1c 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 _0x0e50=['reject','update','end','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','merge','VIRTUAL','filter','OpenchannelMessage','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','motionChannel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','internal','interface','SIP/%s','channel','event','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','limit','undefined','count','set','apply'];(function(_0x36e830,_0x165ec7){var _0x526512=function(_0x5babc9){while(--_0x5babc9){_0x36e830['push'](_0x36e830['shift']());}};_0x526512(++_0x165ec7);}(_0x0e50,0x1ce));var _0x00e5=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0e50[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00e5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00e5('0x1'));var rp=require(_0x00e5('0x2'));var moment=require(_0x00e5('0x3'));var BPromise=require(_0x00e5('0x4'));var Mustache=require(_0x00e5('0x5'));var util=require(_0x00e5('0x6'));var path=require(_0x00e5('0x7'));var sox=require('sox');var csv=require(_0x00e5('0x8'));var ejs=require(_0x00e5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x00e5('0xa'));var jsforce=require(_0x00e5('0xb'));var deskjs=require(_0x00e5('0xc'));var toCsv=require(_0x00e5('0x8'));var querystring=require(_0x00e5('0xd'));var Papa=require(_0x00e5('0xe'));var Redis=require(_0x00e5('0xf'));var authService=require(_0x00e5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x00e5('0x11'));var hardwareService=require(_0x00e5('0x12'));var logger=require(_0x00e5('0x13'))(_0x00e5('0x14'));var utils=require(_0x00e5('0x15'));var config=require(_0x00e5('0x16'));var licenseUtil=require(_0x00e5('0x17'));var db=require(_0x00e5('0x18'))['db'];config['redis']=_[_0x00e5('0x19')](config[_0x00e5('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x00e5('0x1b'))(new Redis(config[_0x00e5('0x1a')]));require(_0x00e5('0x1c'))['register'](socket);var jayson=require(_0x00e5('0x1d'));var client=jayson['client'][_0x00e5('0x1e')]({'port':0x232c});var client9002=jayson[_0x00e5('0x1f')][_0x00e5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2a7900,_0x2e4b2d,_0x15e42c,_0x2face7){return new BPromise(function(_0x3bea20,_0x345b28){var _0x57ac99=_0x2face7||client;return _0x57ac99['request'](_0x2a7900,_0x15e42c)[_0x00e5('0x20')](function(_0x259e89){logger[_0x00e5('0x21')](_0x00e5('0x22'),_0x2e4b2d,_0x00e5('0x23'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2e4b2d,_0x00e5('0x23'),JSON[_0x00e5('0x24')](_0x259e89));if(_0x259e89[_0x00e5('0x25')]){if(_0x259e89['error'][_0x00e5('0x26')]===0x1f4){logger[_0x00e5('0x25')](_0x00e5('0x22'),_0x2e4b2d,_0x259e89[_0x00e5('0x25')][_0x00e5('0x27')]);return _0x345b28(_0x259e89[_0x00e5('0x25')][_0x00e5('0x27')]);}logger['error'](_0x00e5('0x22'),_0x2e4b2d,_0x259e89['error'][_0x00e5('0x27')]);return _0x3bea20(_0x259e89[_0x00e5('0x25')]['message']);}else{logger[_0x00e5('0x21')](_0x00e5('0x22'),_0x2e4b2d,_0x00e5('0x23'));_0x3bea20(_0x259e89[_0x00e5('0x28')][_0x00e5('0x27')]);}})['catch'](function(_0x7dc150){logger['error'](_0x00e5('0x22'),_0x2e4b2d,_0x7dc150);_0x345b28(_0x7dc150);});});}function respondWithStatusCode(_0x454f31,_0x466131){_0x466131=_0x466131||0xcc;return function(_0x400849){if(_0x400849){return _0x454f31[_0x00e5('0x29')](_0x466131);}return _0x454f31[_0x00e5('0x2a')](_0x466131)['end']();};}function respondWithResult(_0x3abb23,_0x43b572){_0x43b572=_0x43b572||0xc8;return function(_0x30191f){if(_0x30191f){return _0x3abb23[_0x00e5('0x2a')](_0x43b572)[_0x00e5('0x2b')](_0x30191f);}};}function respondWithFilteredResult(_0x1f58f6,_0x23a54b){return function(_0x321bbf){if(_0x321bbf){var _0x2a48c7=typeof _0x23a54b[_0x00e5('0x2c')]==='undefined'&&typeof _0x23a54b[_0x00e5('0x2d')]===_0x00e5('0x2e');var _0x3cb504=_0x321bbf[_0x00e5('0x2f')];var _0x42ed9f=_0x2a48c7?0x0:_0x23a54b[_0x00e5('0x2c')];var _0x226dab=_0x2a48c7?_0x321bbf[_0x00e5('0x2f')]:_0x23a54b[_0x00e5('0x2c')]+_0x23a54b[_0x00e5('0x2d')];var _0x1f32a1;if(_0x226dab>=_0x3cb504){_0x226dab=_0x3cb504;_0x1f32a1=0xc8;}else{_0x1f32a1=0xce;}_0x1f58f6['status'](_0x1f32a1);return _0x1f58f6[_0x00e5('0x30')]('Content-Range',_0x42ed9f+'-'+_0x226dab+'/'+_0x3cb504)['json'](_0x321bbf);}return null;};}function patchUpdates(_0x531f94){return function(_0x3a87b1){try{jsonpatch[_0x00e5('0x31')](_0x3a87b1,_0x531f94,!![]);}catch(_0x5dbc0b){return BPromise[_0x00e5('0x32')](_0x5dbc0b);}return _0x3a87b1['save']();};}function saveUpdates(_0x53090f,_0x39e28b){return function(_0x40a57f){if(_0x40a57f){return _0x40a57f[_0x00e5('0x33')](_0x53090f)[_0x00e5('0x20')](function(_0x33a3dd){return _0x33a3dd;});}return null;};}function removeEntity(_0x329166,_0x2f7926){return function(_0xf829b9){if(_0xf829b9){return _0xf829b9['destroy']()[_0x00e5('0x20')](function(){_0x329166[_0x00e5('0x2a')](0xcc)[_0x00e5('0x34')]();});}};}function handleEntityNotFound(_0x20da9b,_0x64a990){return function(_0x496311){if(!_0x496311){_0x20da9b['sendStatus'](0x194);}return _0x496311;};}function handleError(_0x17b72d,_0x39a15c){_0x39a15c=_0x39a15c||0x1f4;return function(_0x12397e){logger[_0x00e5('0x25')](_0x12397e['stack']);if(_0x12397e[_0x00e5('0x35')]){delete _0x12397e[_0x00e5('0x35')];}_0x17b72d[_0x00e5('0x2a')](_0x39a15c)['send'](_0x12397e);};}exports[_0x00e5('0x36')]=function(_0x220ff0,_0x33fdd0){var _0x264bba={},_0x6dc505={},_0x4b13a0={'count':0x0,'rows':[]};var _0x41a1b0=_[_0x00e5('0x37')](db['OpenchannelMessage'][_0x00e5('0x38')],function(_0x135f3d){return{'name':_0x135f3d[_0x00e5('0x39')],'type':_0x135f3d[_0x00e5('0x3a')][_0x00e5('0x3b')]};});_0x6dc505[_0x00e5('0x3c')]=_[_0x00e5('0x37')](_0x41a1b0,'name');_0x6dc505[_0x00e5('0x3d')]=_['keys'](_0x220ff0[_0x00e5('0x3d')]);_0x6dc505[_0x00e5('0x3e')]=_[_0x00e5('0x3f')](_0x6dc505[_0x00e5('0x3c')],_0x6dc505[_0x00e5('0x3d')]);_0x264bba[_0x00e5('0x40')]=_['intersection'](_0x6dc505[_0x00e5('0x3c')],qs[_0x00e5('0x41')](_0x220ff0[_0x00e5('0x3d')][_0x00e5('0x41')]));_0x264bba[_0x00e5('0x40')]=_0x264bba[_0x00e5('0x40')]['length']?_0x264bba[_0x00e5('0x40')]:_0x6dc505[_0x00e5('0x3c')];if(!_0x220ff0[_0x00e5('0x3d')]['hasOwnProperty']('nolimit')){_0x264bba['limit']=qs[_0x00e5('0x2d')](_0x220ff0[_0x00e5('0x3d')][_0x00e5('0x2d')]);_0x264bba[_0x00e5('0x2c')]=qs['offset'](_0x220ff0[_0x00e5('0x3d')]['offset']);}_0x264bba[_0x00e5('0x42')]=qs[_0x00e5('0x43')](_0x220ff0['query'][_0x00e5('0x43')]);_0x264bba[_0x00e5('0x44')]=qs['filters'](_['pick'](_0x220ff0[_0x00e5('0x3d')],_0x6dc505['filters']),_0x41a1b0);if(_0x220ff0['query']['filter']){_0x264bba[_0x00e5('0x44')]=_[_0x00e5('0x45')](_0x264bba[_0x00e5('0x44')],{'$or':_[_0x00e5('0x37')](_0x41a1b0,function(_0x4b1855){if(_0x4b1855[_0x00e5('0x3a')]!==_0x00e5('0x46')){var _0xafab3a={};_0xafab3a[_0x4b1855['name']]={'$like':'%'+_0x220ff0[_0x00e5('0x3d')][_0x00e5('0x47')]+'%'};return _0xafab3a;}})});}_0x264bba=_['merge']({},_0x264bba,_0x220ff0['options']);var _0x262fc3={'where':_0x264bba[_0x00e5('0x44')]};return db[_0x00e5('0x48')][_0x00e5('0x2f')](_0x262fc3)[_0x00e5('0x20')](function(_0x287d30){_0x4b13a0[_0x00e5('0x2f')]=_0x287d30;if(_0x220ff0[_0x00e5('0x3d')][_0x00e5('0x49')]){_0x264bba[_0x00e5('0x4a')]=[{'all':!![]}];}return db[_0x00e5('0x48')][_0x00e5('0x4b')](_0x264bba);})['then'](function(_0x5691ee){_0x4b13a0[_0x00e5('0x4c')]=_0x5691ee;return _0x4b13a0;})[_0x00e5('0x20')](respondWithFilteredResult(_0x33fdd0,_0x264bba))[_0x00e5('0x4d')](handleError(_0x33fdd0,null));};exports[_0x00e5('0x4e')]=function(_0x57d5db,_0x325602){var _0x7f93a9={'raw':!![],'where':{'id':_0x57d5db[_0x00e5('0x4f')]['id']}},_0x124be4={};_0x124be4[_0x00e5('0x3c')]=_[_0x00e5('0x50')](db[_0x00e5('0x48')][_0x00e5('0x38')]);_0x124be4[_0x00e5('0x3d')]=_['keys'](_0x57d5db['query']);_0x124be4[_0x00e5('0x3e')]=_['intersection'](_0x124be4[_0x00e5('0x3c')],_0x124be4[_0x00e5('0x3d')]);_0x7f93a9['attributes']=_[_0x00e5('0x3f')](_0x124be4[_0x00e5('0x3c')],qs[_0x00e5('0x41')](_0x57d5db[_0x00e5('0x3d')][_0x00e5('0x41')]));_0x7f93a9[_0x00e5('0x40')]=_0x7f93a9[_0x00e5('0x40')][_0x00e5('0x51')]?_0x7f93a9[_0x00e5('0x40')]:_0x124be4[_0x00e5('0x3c')];if(_0x57d5db[_0x00e5('0x3d')][_0x00e5('0x49')]){_0x7f93a9['include']=[{'all':!![]}];}_0x7f93a9=_[_0x00e5('0x45')]({},_0x7f93a9,_0x57d5db[_0x00e5('0x52')]);return db[_0x00e5('0x48')][_0x00e5('0x53')](_0x7f93a9)[_0x00e5('0x20')](handleEntityNotFound(_0x325602,null))[_0x00e5('0x20')](respondWithResult(_0x325602,null))['catch'](handleError(_0x325602,null));};exports[_0x00e5('0x54')]=function(_0x46ed74,_0x5bc3f0){return db['OpenchannelMessage'][_0x00e5('0x54')](_0x46ed74[_0x00e5('0x55')],{})['then'](respondWithResult(_0x5bc3f0,0xc9))[_0x00e5('0x4d')](handleError(_0x5bc3f0,null));};exports['update']=function(_0x4983eb,_0x24386c){if(_0x4983eb[_0x00e5('0x55')]['id']){delete _0x4983eb[_0x00e5('0x55')]['id'];}return db[_0x00e5('0x48')][_0x00e5('0x53')]({'where':{'id':_0x4983eb['params']['id']}})[_0x00e5('0x20')](handleEntityNotFound(_0x24386c,null))[_0x00e5('0x20')](saveUpdates(_0x4983eb[_0x00e5('0x55')],null))['then'](respondWithResult(_0x24386c,null))['catch'](handleError(_0x24386c,null));};exports['destroy']=function(_0x1d7608,_0x3e66cd){return db[_0x00e5('0x48')][_0x00e5('0x53')]({'where':{'id':_0x1d7608[_0x00e5('0x4f')]['id']}})[_0x00e5('0x20')](handleEntityNotFound(_0x3e66cd,null))[_0x00e5('0x20')](removeEntity(_0x3e66cd,null))[_0x00e5('0x4d')](handleError(_0x3e66cd,null));};exports['describe']=function(_0x3285c5,_0x15f1e1){return db[_0x00e5('0x48')][_0x00e5('0x56')]()[_0x00e5('0x20')](respondWithResult(_0x15f1e1,null))['catch'](handleError(_0x15f1e1,null));};var interaction_log=require('../../config/logger')(_0x00e5('0x57'));exports[_0x00e5('0x58')]=function(_0x6ba039,_0x205a54,_0x155de0){var _0x225f0a={'agent':{},'channel':_0x00e5('0x59')};if(_0x6ba039[_0x00e5('0x55')]['id']){delete _0x6ba039['body']['id'];}_0x6ba039[_0x00e5('0x55')][_0x00e5('0x5a')]=!![];_0x6ba039[_0x00e5('0x55')]['readAt']=moment()[_0x00e5('0x5b')](_0x00e5('0x5c'));_0x6ba039[_0x00e5('0x55')][_0x00e5('0x5d')]=_0x6ba039[_0x00e5('0x55')][_0x00e5('0x5d')]||_0x6ba039[_0x00e5('0x5e')]['id'];_0x225f0a[_0x00e5('0x5f')]['id']=_0x6ba039[_0x00e5('0x55')][_0x00e5('0x5d')];return db[_0x00e5('0x48')]['find']({'where':{'id':_0x6ba039[_0x00e5('0x4f')]['id'],'UserId':null}})[_0x00e5('0x20')](handleEntityNotFound(_0x205a54,null))[_0x00e5('0x20')](saveUpdates(_0x6ba039[_0x00e5('0x55')],null))[_0x00e5('0x20')](function(_0x48d18e){if(_0x48d18e){_0x225f0a[_0x00e5('0x27')]=_0x48d18e['get']({'plain':!![]});return db[_0x00e5('0x60')]['find']({'where':{'id':_0x48d18e[_0x00e5('0x61')]}});}return null;})[_0x00e5('0x20')](handleEntityNotFound(_0x205a54,null))['then'](function(_0x1ffb25){if(_0x1ffb25){return _0x1ffb25[_0x00e5('0x33')]({'UserId':_0x6ba039[_0x00e5('0x55')][_0x00e5('0x5d')],'read1stAt':_[_0x00e5('0x62')](_0x1ffb25[_0x00e5('0x63')])?moment()[_0x00e5('0x5b')](_0x00e5('0x5c')):undefined});}return null;})['then'](function(_0x331ee1){if(_0x331ee1){_0x225f0a[_0x00e5('0x64')]=_0x331ee1[_0x00e5('0x65')]({'plain':!![]});interaction_log[_0x00e5('0x21')](_0x00e5('0x66'),_0x6ba039['user']['id'],_0x6ba039['user'][_0x00e5('0x35')],_0x6ba039[_0x00e5('0x5e')][_0x00e5('0x67')],_0x225f0a[_0x00e5('0x64')]['id'],_0x6ba039[_0x00e5('0x55')]?JSON[_0x00e5('0x24')](_0x6ba039[_0x00e5('0x55')]):_0x00e5('0x68'));return respondWithRpcPromise(_0x00e5('0x69'),_0x00e5('0x6a'),_0x225f0a);}return null;})[_0x00e5('0x20')](function(_0x3d4c89){var _0x51458f=_0x00e5('0x6b')+_0x3d4c89['message'][_0x00e5('0x6c')];return db[_0x00e5('0x6d')][_0x00e5('0x3d')](_0x51458f,{'type':db[_0x00e5('0x6e')][_0x00e5('0x6f')][_0x00e5('0x70')],'raw':!![]})[_0x00e5('0x20')](function(_0x1ef659){return _0x1ef659;});})['then'](function(_0x310a75){if(_0x310a75){_0x225f0a[_0x00e5('0x27')][_0x00e5('0x71')]=_0x310a75[0x0];if(!_0x6ba039[_0x00e5('0x55')][_0x00e5('0x5d')])return;return db[_0x00e5('0x72')][_0x00e5('0x53')]({'where':{'id':_0x6ba039[_0x00e5('0x55')][_0x00e5('0x5d')],'role':_0x00e5('0x5f')},'attributes':['id',_0x00e5('0x35'),_0x00e5('0x73'),_0x00e5('0x74'),'internal'],'raw':!![]});}return null;})[_0x00e5('0x20')](function(_0x5e7e37){if(!_0x5e7e37)return null;_0x225f0a[_0x00e5('0x27')][_0x00e5('0x5f')]=_0x5e7e37;return _0x225f0a;})[_0x00e5('0x20')](function(_0x356f1e){if(_0x356f1e){if(_0x6ba039[_0x00e5('0x55')]['manual']){_0x225f0a[_0x00e5('0x27')]['interface']=util[_0x00e5('0x5b')]('SIP/%s',_0x6ba039['user'][_0x00e5('0x35')]);_0x225f0a[_0x00e5('0x27')]['channel']=_0x225f0a['channel'];_0x225f0a[_0x00e5('0x27')][_0x00e5('0x75')]=_0x225f0a['channel'];_0x225f0a['message']['event']=_0x00e5('0x58');return respondWithRpcPromise(_0x00e5('0x76'),_0x00e5('0x76'),{'event':_0x00e5('0x77'),'message':_0x225f0a[_0x00e5('0x27')]},client9002)[_0x00e5('0x20')](function(){return _0x225f0a;});}return _0x225f0a;}return null;})[_0x00e5('0x20')](respondWithResult(_0x205a54,null))[_0x00e5('0x4d')](handleError(_0x205a54,null));};var interaction_log=require(_0x00e5('0x13'))('openchannel-interactions');exports[_0x00e5('0x32')]=function(_0x2cf650,_0x22b44b,_0x2aa08d){var _0x2590f5={'agent':{},'channel':'openchannel'};if(_0x2cf650[_0x00e5('0x55')]['id']){delete _0x2cf650[_0x00e5('0x55')]['id'];}_0x2cf650[_0x00e5('0x55')][_0x00e5('0x5d')]=_0x2cf650[_0x00e5('0x55')]['UserId']||_0x2cf650[_0x00e5('0x5e')]['id'];_0x2590f5['agent']['id']=_0x2cf650[_0x00e5('0x55')][_0x00e5('0x5d')];return db[_0x00e5('0x48')][_0x00e5('0x53')]({'where':{'id':_0x2cf650['params']['id'],'UserId':null}})[_0x00e5('0x20')](handleEntityNotFound(_0x22b44b,null))[_0x00e5('0x20')](function(_0x3206a6){if(_0x3206a6){_0x2590f5[_0x00e5('0x27')]=_0x3206a6[_0x00e5('0x65')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x3206a6['OpenchannelInteractionId']}});}return null;})[_0x00e5('0x20')](handleEntityNotFound(_0x22b44b,null))[_0x00e5('0x20')](function(_0xd31ede){if(_0xd31ede){_0x2590f5['interaction']=_0xd31ede[_0x00e5('0x65')]({'plain':!![]});interaction_log[_0x00e5('0x21')](_0x00e5('0x78'),_0x2cf650[_0x00e5('0x5e')]['id'],_0x2cf650['user'][_0x00e5('0x35')],_0x2cf650['user']['role'],_0x2590f5[_0x00e5('0x64')]['id'],_0x2cf650[_0x00e5('0x55')]?JSON['stringify'](_0x2cf650[_0x00e5('0x55')]):_0x00e5('0x68'));return respondWithRpcPromise(_0x00e5('0x79'),_0x00e5('0x7a'),_0x2590f5);}return null;})[_0x00e5('0x20')](function(_0xf7d23e){var _0x1957a2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xf7d23e[_0x00e5('0x27')]['ContactId'];return db[_0x00e5('0x6d')]['query'](_0x1957a2,{'type':db[_0x00e5('0x6e')][_0x00e5('0x6f')][_0x00e5('0x70')],'raw':!![]})[_0x00e5('0x20')](function(_0x205b72){return _0x205b72;});})[_0x00e5('0x20')](function(_0x1df410){if(_0x1df410){_0x2590f5[_0x00e5('0x27')][_0x00e5('0x71')]=_0x1df410[0x0];if(!_0x2cf650[_0x00e5('0x55')][_0x00e5('0x5d')])return;return db[_0x00e5('0x72')][_0x00e5('0x53')]({'where':{'id':_0x2cf650[_0x00e5('0x55')][_0x00e5('0x5d')],'role':_0x00e5('0x5f')},'attributes':['id',_0x00e5('0x35'),_0x00e5('0x73'),'email',_0x00e5('0x7b')],'raw':!![]});}return null;})[_0x00e5('0x20')](function(_0x4bcf26){if(!_0x4bcf26)return null;_0x2590f5[_0x00e5('0x27')][_0x00e5('0x5f')]=_0x4bcf26;return _0x2590f5;})[_0x00e5('0x20')](function(_0x468d70){if(_0x468d70){_0x468d70[_0x00e5('0x27')][_0x00e5('0x7c')]=util[_0x00e5('0x5b')](_0x00e5('0x7d'),_0x2cf650[_0x00e5('0x5e')]['name']);_0x468d70[_0x00e5('0x27')]['channel']=_0x2590f5['channel'];_0x468d70[_0x00e5('0x27')][_0x00e5('0x75')]=_0x2590f5[_0x00e5('0x7e')];_0x468d70[_0x00e5('0x27')][_0x00e5('0x7f')]='reject';respondWithRpcPromise('EventManager',_0x00e5('0x76'),{'event':'rejectmessage','message':_0x468d70[_0x00e5('0x27')]},client9002);return _0x2590f5;}return null;})['then'](respondWithResult(_0x22b44b,null))[_0x00e5('0x4d')](handleError(_0x22b44b,null));}; \ No newline at end of file +var _0xe29d=['QueryTypes','SELECT','User','email','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','fullname','internal','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','send','index','map','OpenchannelMessage','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','rawAttributes','includeAll','include','create','body','find','params','describe','openchannel-interactions','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xe29d,0x1a7));var _0xde29=function(_0x4ba17b,_0x55f724){_0x4ba17b=_0x4ba17b-0x0;var _0x1f0669=_0xe29d[_0x4ba17b];return _0x1f0669;};'use strict';var emlformat=require(_0xde29('0x0'));var rimraf=require(_0xde29('0x1'));var zipdir=require(_0xde29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde29('0x3'));var moment=require('moment');var BPromise=require(_0xde29('0x4'));var Mustache=require(_0xde29('0x5'));var util=require(_0xde29('0x6'));var path=require('path');var sox=require(_0xde29('0x7'));var csv=require('to-csv');var ejs=require(_0xde29('0x8'));var fs=require('fs');var fs_extra=require(_0xde29('0x9'));var _=require(_0xde29('0xa'));var squel=require(_0xde29('0xb'));var crypto=require(_0xde29('0xc'));var jsforce=require(_0xde29('0xd'));var deskjs=require(_0xde29('0xe'));var toCsv=require(_0xde29('0xf'));var querystring=require(_0xde29('0x10'));var Papa=require(_0xde29('0x11'));var Redis=require(_0xde29('0x12'));var authService=require(_0xde29('0x13'));var qs=require(_0xde29('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde29('0x15'));var logger=require(_0xde29('0x16'))(_0xde29('0x17'));var utils=require(_0xde29('0x18'));var config=require(_0xde29('0x19'));var licenseUtil=require(_0xde29('0x1a'));var db=require(_0xde29('0x1b'))['db'];config['redis']=_[_0xde29('0x1c')](config[_0xde29('0x1d')],{'host':_0xde29('0x1e'),'port':0x18eb});var socket=require(_0xde29('0x1f'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xde29('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xde29('0x21')][_0xde29('0x22')]({'port':0x232c});var client9002=jayson[_0xde29('0x21')][_0xde29('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x37d997,_0x4f5db5,_0x13e698,_0x9d222d){return new BPromise(function(_0x147960,_0x3ba42c){var _0x26e1c0=_0x9d222d||client;return _0x26e1c0[_0xde29('0x23')](_0x37d997,_0x13e698)[_0xde29('0x24')](function(_0x37d6b0){logger[_0xde29('0x25')](_0xde29('0x26'),_0x4f5db5,_0xde29('0x27'));logger[_0xde29('0x28')](_0xde29('0x29'),_0x4f5db5,_0xde29('0x27'),JSON[_0xde29('0x2a')](_0x37d6b0));if(_0x37d6b0[_0xde29('0x2b')]){if(_0x37d6b0['error']['code']===0x1f4){logger[_0xde29('0x2b')](_0xde29('0x26'),_0x4f5db5,_0x37d6b0[_0xde29('0x2b')][_0xde29('0x2c')]);return _0x3ba42c(_0x37d6b0[_0xde29('0x2b')][_0xde29('0x2c')]);}logger['error'](_0xde29('0x26'),_0x4f5db5,_0x37d6b0[_0xde29('0x2b')][_0xde29('0x2c')]);return _0x147960(_0x37d6b0['error'][_0xde29('0x2c')]);}else{logger[_0xde29('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f5db5,'request\x20sent');_0x147960(_0x37d6b0[_0xde29('0x2d')]['message']);}})[_0xde29('0x2e')](function(_0x2b146f){logger[_0xde29('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f5db5,_0x2b146f);_0x3ba42c(_0x2b146f);});});}function respondWithStatusCode(_0x272ad2,_0x5f411f){_0x5f411f=_0x5f411f||0xcc;return function(_0x30d993){if(_0x30d993){return _0x272ad2[_0xde29('0x2f')](_0x5f411f);}return _0x272ad2['status'](_0x5f411f)['end']();};}function respondWithResult(_0x1f286b,_0x2a0cec){_0x2a0cec=_0x2a0cec||0xc8;return function(_0x579f5f){if(_0x579f5f){return _0x1f286b[_0xde29('0x30')](_0x2a0cec)[_0xde29('0x31')](_0x579f5f);}};}function respondWithFilteredResult(_0xd1b4c8,_0x2a11ee){return function(_0x39a4ce){if(_0x39a4ce){var _0x213ea5=typeof _0x2a11ee[_0xde29('0x32')]===_0xde29('0x33')&&typeof _0x2a11ee[_0xde29('0x34')]===_0xde29('0x33');var _0x2b577a=_0x39a4ce[_0xde29('0x35')];var _0x163ef5=_0x213ea5?0x0:_0x2a11ee['offset'];var _0x28bfd4=_0x213ea5?_0x39a4ce[_0xde29('0x35')]:_0x2a11ee[_0xde29('0x32')]+_0x2a11ee['limit'];var _0x3260ff;if(_0x28bfd4>=_0x2b577a){_0x28bfd4=_0x2b577a;_0x3260ff=0xc8;}else{_0x3260ff=0xce;}_0xd1b4c8[_0xde29('0x30')](_0x3260ff);return _0xd1b4c8['set'](_0xde29('0x36'),_0x163ef5+'-'+_0x28bfd4+'/'+_0x2b577a)[_0xde29('0x31')](_0x39a4ce);}return null;};}function patchUpdates(_0xe7125f){return function(_0x5268aa){try{jsonpatch[_0xde29('0x37')](_0x5268aa,_0xe7125f,!![]);}catch(_0x30066a){return BPromise[_0xde29('0x38')](_0x30066a);}return _0x5268aa[_0xde29('0x39')]();};}function saveUpdates(_0x4f44fb,_0x15135e){return function(_0x54732c){if(_0x54732c){return _0x54732c[_0xde29('0x3a')](_0x4f44fb)['then'](function(_0x3989ca){return _0x3989ca;});}return null;};}function removeEntity(_0x21e6b4,_0x3cf494){return function(_0x484133){if(_0x484133){return _0x484133[_0xde29('0x3b')]()['then'](function(){_0x21e6b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cffd6,_0x23b05b){return function(_0x5424b8){if(!_0x5424b8){_0x1cffd6[_0xde29('0x2f')](0x194);}return _0x5424b8;};}function handleError(_0x14300d,_0x4e89ab){_0x4e89ab=_0x4e89ab||0x1f4;return function(_0x5af1c4){logger[_0xde29('0x2b')](_0x5af1c4[_0xde29('0x3c')]);if(_0x5af1c4['name']){delete _0x5af1c4['name'];}_0x14300d[_0xde29('0x30')](_0x4e89ab)[_0xde29('0x3d')](_0x5af1c4);};}exports[_0xde29('0x3e')]=function(_0xbe7c4e,_0x5d0613){var _0x4d5aa1={},_0x17c582={},_0x331cbe={'count':0x0,'rows':[]};var _0xb47777=_[_0xde29('0x3f')](db[_0xde29('0x40')]['rawAttributes'],function(_0x2f3eb1){return{'name':_0x2f3eb1[_0xde29('0x41')],'type':_0x2f3eb1[_0xde29('0x42')][_0xde29('0x43')]};});_0x17c582[_0xde29('0x44')]=_['map'](_0xb47777,_0xde29('0x45'));_0x17c582[_0xde29('0x46')]=_[_0xde29('0x47')](_0xbe7c4e[_0xde29('0x46')]);_0x17c582['filters']=_[_0xde29('0x48')](_0x17c582[_0xde29('0x44')],_0x17c582['query']);_0x4d5aa1[_0xde29('0x49')]=_[_0xde29('0x48')](_0x17c582[_0xde29('0x44')],qs[_0xde29('0x4a')](_0xbe7c4e[_0xde29('0x46')]['fields']));_0x4d5aa1[_0xde29('0x49')]=_0x4d5aa1['attributes'][_0xde29('0x4b')]?_0x4d5aa1[_0xde29('0x49')]:_0x17c582[_0xde29('0x44')];if(!_0xbe7c4e[_0xde29('0x46')][_0xde29('0x4c')]('nolimit')){_0x4d5aa1[_0xde29('0x34')]=qs['limit'](_0xbe7c4e[_0xde29('0x46')][_0xde29('0x34')]);_0x4d5aa1[_0xde29('0x32')]=qs['offset'](_0xbe7c4e[_0xde29('0x46')]['offset']);}_0x4d5aa1['order']=qs[_0xde29('0x4d')](_0xbe7c4e[_0xde29('0x46')]['sort']);_0x4d5aa1[_0xde29('0x4e')]=qs[_0xde29('0x4f')](_[_0xde29('0x50')](_0xbe7c4e[_0xde29('0x46')],_0x17c582['filters']),_0xb47777);if(_0xbe7c4e[_0xde29('0x46')][_0xde29('0x51')]){_0x4d5aa1[_0xde29('0x4e')]=_[_0xde29('0x52')](_0x4d5aa1[_0xde29('0x4e')],{'$or':_[_0xde29('0x3f')](_0xb47777,function(_0x4e94b8){if(_0x4e94b8['type']!==_0xde29('0x53')){var _0x4137bf={};_0x4137bf[_0x4e94b8[_0xde29('0x45')]]={'$like':'%'+_0xbe7c4e[_0xde29('0x46')][_0xde29('0x51')]+'%'};return _0x4137bf;}})});}_0x4d5aa1=_[_0xde29('0x52')]({},_0x4d5aa1,_0xbe7c4e[_0xde29('0x54')]);var _0x1cf14f={'where':_0x4d5aa1[_0xde29('0x4e')]};return db['OpenchannelMessage'][_0xde29('0x35')](_0x1cf14f)['then'](function(_0x1a552c){_0x331cbe['count']=_0x1a552c;if(_0xbe7c4e[_0xde29('0x46')]['includeAll']){_0x4d5aa1['include']=[{'all':!![]}];}return db[_0xde29('0x40')][_0xde29('0x55')](_0x4d5aa1);})[_0xde29('0x24')](function(_0x1cbe86){_0x331cbe[_0xde29('0x56')]=_0x1cbe86;return _0x331cbe;})[_0xde29('0x24')](respondWithFilteredResult(_0x5d0613,_0x4d5aa1))[_0xde29('0x2e')](handleError(_0x5d0613,null));};exports[_0xde29('0x57')]=function(_0x561b59,_0x5609c4){var _0xdd3079={'raw':!![],'where':{'id':_0x561b59['params']['id']}},_0x25f6e8={};_0x25f6e8[_0xde29('0x44')]=_[_0xde29('0x47')](db[_0xde29('0x40')][_0xde29('0x58')]);_0x25f6e8[_0xde29('0x46')]=_['keys'](_0x561b59[_0xde29('0x46')]);_0x25f6e8[_0xde29('0x4f')]=_[_0xde29('0x48')](_0x25f6e8[_0xde29('0x44')],_0x25f6e8[_0xde29('0x46')]);_0xdd3079[_0xde29('0x49')]=_[_0xde29('0x48')](_0x25f6e8[_0xde29('0x44')],qs['fields'](_0x561b59[_0xde29('0x46')][_0xde29('0x4a')]));_0xdd3079[_0xde29('0x49')]=_0xdd3079[_0xde29('0x49')][_0xde29('0x4b')]?_0xdd3079[_0xde29('0x49')]:_0x25f6e8[_0xde29('0x44')];if(_0x561b59[_0xde29('0x46')][_0xde29('0x59')]){_0xdd3079[_0xde29('0x5a')]=[{'all':!![]}];}_0xdd3079=_[_0xde29('0x52')]({},_0xdd3079,_0x561b59[_0xde29('0x54')]);return db[_0xde29('0x40')]['find'](_0xdd3079)[_0xde29('0x24')](handleEntityNotFound(_0x5609c4,null))[_0xde29('0x24')](respondWithResult(_0x5609c4,null))[_0xde29('0x2e')](handleError(_0x5609c4,null));};exports['create']=function(_0x5d4cb1,_0x2bb2ce){return db[_0xde29('0x40')][_0xde29('0x5b')](_0x5d4cb1['body'],{})[_0xde29('0x24')](respondWithResult(_0x2bb2ce,0xc9))[_0xde29('0x2e')](handleError(_0x2bb2ce,null));};exports['update']=function(_0x2fd412,_0x35be10){if(_0x2fd412[_0xde29('0x5c')]['id']){delete _0x2fd412[_0xde29('0x5c')]['id'];}return db['OpenchannelMessage'][_0xde29('0x5d')]({'where':{'id':_0x2fd412[_0xde29('0x5e')]['id']}})[_0xde29('0x24')](handleEntityNotFound(_0x35be10,null))[_0xde29('0x24')](saveUpdates(_0x2fd412[_0xde29('0x5c')],null))['then'](respondWithResult(_0x35be10,null))[_0xde29('0x2e')](handleError(_0x35be10,null));};exports[_0xde29('0x3b')]=function(_0x40d70b,_0x1b1c4e){return db[_0xde29('0x40')]['find']({'where':{'id':_0x40d70b['params']['id']}})[_0xde29('0x24')](handleEntityNotFound(_0x1b1c4e,null))[_0xde29('0x24')](removeEntity(_0x1b1c4e,null))[_0xde29('0x2e')](handleError(_0x1b1c4e,null));};exports[_0xde29('0x5f')]=function(_0x246a79,_0x138023){return db[_0xde29('0x40')]['describe']()[_0xde29('0x24')](respondWithResult(_0x138023,null))['catch'](handleError(_0x138023,null));};var interaction_log=require(_0xde29('0x16'))(_0xde29('0x60'));exports['accept']=function(_0xb58084,_0x24895b,_0x406f14){var _0x3f47d3={'agent':{},'channel':_0xde29('0x61')};if(_0xb58084[_0xde29('0x5c')]['id']){delete _0xb58084['body']['id'];}_0xb58084[_0xde29('0x5c')]['read']=!![];_0xb58084[_0xde29('0x5c')]['readAt']=moment()[_0xde29('0x62')](_0xde29('0x63'));_0xb58084['body'][_0xde29('0x64')]=_0xb58084['body'][_0xde29('0x64')]||_0xb58084[_0xde29('0x65')]['id'];_0x3f47d3[_0xde29('0x66')]['id']=_0xb58084[_0xde29('0x5c')][_0xde29('0x64')];return db[_0xde29('0x40')][_0xde29('0x5d')]({'where':{'id':_0xb58084[_0xde29('0x5e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24895b,null))[_0xde29('0x24')](saveUpdates(_0xb58084[_0xde29('0x5c')],null))[_0xde29('0x24')](function(_0x5388b9){if(_0x5388b9){_0x3f47d3[_0xde29('0x2c')]=_0x5388b9['get']({'plain':!![]});return db[_0xde29('0x67')][_0xde29('0x5d')]({'where':{'id':_0x5388b9[_0xde29('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x24895b,null))['then'](function(_0x41df0a){if(_0x41df0a){return _0x41df0a[_0xde29('0x3a')]({'UserId':_0xb58084[_0xde29('0x5c')][_0xde29('0x64')],'read1stAt':_[_0xde29('0x69')](_0x41df0a[_0xde29('0x6a')])?moment()[_0xde29('0x62')](_0xde29('0x63')):undefined});}return null;})['then'](function(_0x5eb256){if(_0x5eb256){_0x3f47d3[_0xde29('0x6b')]=_0x5eb256[_0xde29('0x6c')]({'plain':!![]});interaction_log[_0xde29('0x25')](_0xde29('0x6d'),_0xb58084[_0xde29('0x65')]['id'],_0xb58084['user']['name'],_0xb58084[_0xde29('0x65')][_0xde29('0x6e')],_0x3f47d3[_0xde29('0x6b')]['id'],_0xb58084[_0xde29('0x5c')]?JSON['stringify'](_0xb58084['body']):_0xde29('0x6f'));return respondWithRpcPromise(_0xde29('0x70'),_0xde29('0x71'),_0x3f47d3);}return null;})[_0xde29('0x24')](function(_0x33809e){var _0x3f32e4=_0xde29('0x72')+_0x33809e['message']['ContactId'];return db[_0xde29('0x73')][_0xde29('0x46')](_0x3f32e4,{'type':db[_0xde29('0x74')][_0xde29('0x75')][_0xde29('0x76')],'raw':!![]})[_0xde29('0x24')](function(_0x4de56b){return _0x4de56b;});})[_0xde29('0x24')](function(_0x2ff77e){if(_0x2ff77e){_0x3f47d3[_0xde29('0x2c')]['contact']=_0x2ff77e[0x0];if(!_0xb58084[_0xde29('0x5c')][_0xde29('0x64')])return;return db[_0xde29('0x77')][_0xde29('0x5d')]({'where':{'id':_0xb58084[_0xde29('0x5c')]['UserId'],'role':_0xde29('0x66')},'attributes':['id',_0xde29('0x45'),'fullname',_0xde29('0x78'),'internal'],'raw':!![]});}return null;})[_0xde29('0x24')](function(_0xf89d98){if(!_0xf89d98)return null;_0x3f47d3['message'][_0xde29('0x66')]=_0xf89d98;return _0x3f47d3;})[_0xde29('0x24')](function(_0x344e13){if(_0x344e13){if(_0xb58084[_0xde29('0x5c')]['manual']){_0x3f47d3[_0xde29('0x2c')][_0xde29('0x79')]=util[_0xde29('0x62')](_0xde29('0x7a'),_0xb58084[_0xde29('0x65')][_0xde29('0x45')]);_0x3f47d3['message'][_0xde29('0x7b')]=_0x3f47d3[_0xde29('0x7b')];_0x3f47d3['message'][_0xde29('0x7c')]=_0x3f47d3[_0xde29('0x7b')];_0x3f47d3['message'][_0xde29('0x7d')]=_0xde29('0x7e');return respondWithRpcPromise(_0xde29('0x7f'),'EventManager',{'event':_0xde29('0x80'),'message':_0x3f47d3[_0xde29('0x2c')]},client9002)[_0xde29('0x24')](function(){return _0x3f47d3;});}return _0x3f47d3;}return null;})[_0xde29('0x24')](respondWithResult(_0x24895b,null))['catch'](handleError(_0x24895b,null));};var interaction_log=require(_0xde29('0x16'))('openchannel-interactions');exports[_0xde29('0x38')]=function(_0x258e21,_0x21bee7,_0x10045f){var _0x362e3f={'agent':{},'channel':'openchannel'};if(_0x258e21[_0xde29('0x5c')]['id']){delete _0x258e21[_0xde29('0x5c')]['id'];}_0x258e21['body'][_0xde29('0x64')]=_0x258e21[_0xde29('0x5c')][_0xde29('0x64')]||_0x258e21[_0xde29('0x65')]['id'];_0x362e3f[_0xde29('0x66')]['id']=_0x258e21[_0xde29('0x5c')][_0xde29('0x64')];return db[_0xde29('0x40')][_0xde29('0x5d')]({'where':{'id':_0x258e21['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x21bee7,null))[_0xde29('0x24')](function(_0x5ee56b){if(_0x5ee56b){_0x362e3f[_0xde29('0x2c')]=_0x5ee56b[_0xde29('0x6c')]({'plain':!![]});return db[_0xde29('0x67')][_0xde29('0x5d')]({'where':{'id':_0x5ee56b[_0xde29('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x21bee7,null))['then'](function(_0x12888d){if(_0x12888d){_0x362e3f[_0xde29('0x6b')]=_0x12888d[_0xde29('0x6c')]({'plain':!![]});interaction_log[_0xde29('0x25')](_0xde29('0x81'),_0x258e21[_0xde29('0x65')]['id'],_0x258e21[_0xde29('0x65')][_0xde29('0x45')],_0x258e21[_0xde29('0x65')][_0xde29('0x6e')],_0x362e3f[_0xde29('0x6b')]['id'],_0x258e21['body']?JSON[_0xde29('0x2a')](_0x258e21['body']):_0xde29('0x6f'));return respondWithRpcPromise(_0xde29('0x82'),_0xde29('0x83'),_0x362e3f);}return null;})[_0xde29('0x24')](function(_0xa51c90){var _0x56b807=_0xde29('0x72')+_0xa51c90[_0xde29('0x2c')][_0xde29('0x84')];return db[_0xde29('0x73')][_0xde29('0x46')](_0x56b807,{'type':db[_0xde29('0x74')]['QueryTypes'][_0xde29('0x76')],'raw':!![]})[_0xde29('0x24')](function(_0x58f0fc){return _0x58f0fc;});})[_0xde29('0x24')](function(_0x196633){if(_0x196633){_0x362e3f[_0xde29('0x2c')]['contact']=_0x196633[0x0];if(!_0x258e21['body'][_0xde29('0x64')])return;return db[_0xde29('0x77')][_0xde29('0x5d')]({'where':{'id':_0x258e21[_0xde29('0x5c')]['UserId'],'role':_0xde29('0x66')},'attributes':['id',_0xde29('0x45'),_0xde29('0x85'),_0xde29('0x78'),_0xde29('0x86')],'raw':!![]});}return null;})[_0xde29('0x24')](function(_0x3cbb66){if(!_0x3cbb66)return null;_0x362e3f[_0xde29('0x2c')][_0xde29('0x66')]=_0x3cbb66;return _0x362e3f;})['then'](function(_0x5a0c25){if(_0x5a0c25){_0x5a0c25[_0xde29('0x2c')]['interface']=util[_0xde29('0x62')](_0xde29('0x7a'),_0x258e21[_0xde29('0x65')][_0xde29('0x45')]);_0x5a0c25[_0xde29('0x2c')]['channel']=_0x362e3f['channel'];_0x5a0c25['message'][_0xde29('0x7c')]=_0x362e3f[_0xde29('0x7b')];_0x5a0c25[_0xde29('0x2c')][_0xde29('0x7d')]=_0xde29('0x38');respondWithRpcPromise(_0xde29('0x7f'),_0xde29('0x7f'),{'event':'rejectmessage','message':_0x5a0c25['message']},client9002);return _0x362e3f;}return null;})[_0xde29('0x24')](respondWithResult(_0x21bee7,null))['catch'](handleError(_0x21bee7,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 46f8e6f..4f14b08 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 _0x0662=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x268f26,_0x1202fd){var _0x5cdbc0=function(_0x4c1524){while(--_0x4c1524){_0x268f26['push'](_0x268f26['shift']());}};_0x5cdbc0(++_0x1202fd);}(_0x0662,0x106));var _0x2066=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x0662[_0x1d9aa0];return _0x226868;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x2066('0x0'))['db'][_0x2066('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2066('0x2'),'afterUpdate':'update','afterDestroy':_0x2066('0x3')};function emitEvent(_0x591212){return function(_0x173017,_0x10c74c,_0x2ae953){OpenchannelMessageEvents[_0x2066('0x4')](_0x591212+':'+_0x173017['id'],_0x173017);OpenchannelMessageEvents[_0x2066('0x4')](_0x591212,_0x173017);_0x2ae953(null);};}for(var e in events){if(events[_0x2066('0x5')](e)){var event=events[e];OpenchannelMessage[_0x2066('0x6')](e,emitEvent(event));}}module[_0x2066('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xd697=['emit','hasOwnProperty','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x22607e,_0x44d612){var _0x4d8cf2=function(_0x1168df){while(--_0x1168df){_0x22607e['push'](_0x22607e['shift']());}};_0x4d8cf2(++_0x44d612);}(_0xd697,0x17c));var _0x7d69=function(_0xea891b,_0x6eb5b0){_0xea891b=_0xea891b-0x0;var _0x4c7a4c=_0xd697[_0xea891b];return _0x4c7a4c;};'use strict';var EventEmitter=require(_0x7d69('0x0'));var OpenchannelMessage=require(_0x7d69('0x1'))['db'][_0x7d69('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7d69('0x3')](0x0);var events={'afterCreate':_0x7d69('0x4'),'afterUpdate':_0x7d69('0x5'),'afterDestroy':_0x7d69('0x6')};function emitEvent(_0x516d7c){return function(_0x2d5da2,_0x84260e,_0xac0deb){OpenchannelMessageEvents[_0x7d69('0x7')](_0x516d7c+':'+_0x2d5da2['id'],_0x2d5da2);OpenchannelMessageEvents['emit'](_0x516d7c,_0x2d5da2);_0xac0deb(null);};}for(var e in events){if(events[_0x7d69('0x8')](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 d2d13e8..7007bb5 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 _0xc664=['toLowerCase','out','secret','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','CmContact','describe','find','OpenchannelAccountId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','method','POST','body','threadId','update','catch','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','FULLTEXT','models','get','direction'];(function(_0x3162f6,_0x695de6){var _0xca3757=function(_0x31a4aa){while(--_0x31a4aa){_0x3162f6['push'](_0x3162f6['shift']());}};_0xca3757(++_0x695de6);}(_0xc664,0x88));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var logger=require(_0x4c66('0x2'))(_0x4c66('0x3'));var moment=require(_0x4c66('0x4'));var BPromise=require('bluebird');var rp=require(_0x4c66('0x5'));var fs=require('fs');var path=require(_0x4c66('0x6'));var rimraf=require(_0x4c66('0x7'));var config=require(_0x4c66('0x8'));var attributes=require(_0x4c66('0x9'));module[_0x4c66('0xa')]=function(_0x33768b,_0x4ac75d){return _0x33768b[_0x4c66('0xb')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x4c66('0xc'),'fields':['body'],'type':_0x4c66('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x247370,_0x3046ac,_0x320eac){var _0x228874=_0x33768b[_0x4c66('0xe')];var _0x3b199a=_0x247370[_0x4c66('0xf')]({'plain':!![]});if(_0x3b199a[_0x4c66('0x10')][_0x4c66('0x11')]()==='in'||_0x3b199a[_0x4c66('0x10')][_0x4c66('0x11')]()===_0x4c66('0x12')&&!_0x3b199a[_0x4c66('0x13')]&&!_['isNil'](_0x3b199a[_0x4c66('0x14')])){_0x228874[_0x4c66('0x15')]['findOne']({'where':{'id':_0x3b199a[_0x4c66('0x16')]}})[_0x4c66('0x17')](function(_0x2f313b){if(_0x2f313b){_0x2f313b['update']({'lastMsgAt':_0x3b199a['createdAt'],'lastMsgDirection':_0x3b199a[_0x4c66('0x10')][_0x4c66('0x11')]()});}})['catch'](function(_0x552676){console['error'](_0x552676);});}if(_0x3b199a[_0x4c66('0x10')]===_0x4c66('0x12')&&!_0x3b199a['secret']){var _0x1b1b48;_0x228874[_0x4c66('0x18')][_0x4c66('0x19')]()['then'](function(_0xc06d86){return _0x228874['OpenchannelAccount'][_0x4c66('0x1a')]({'where':{'id':_0x3b199a[_0x4c66('0x1b')]},'include':[{'model':_0x228874[_0x4c66('0x15')],'as':'Interactions','where':{'id':_0x3b199a[_0x4c66('0x16')]},'limit':0x1,'include':[{'model':_0x228874[_0x4c66('0x18')],'as':_0x4c66('0x1c'),'attributes':_[_0x4c66('0x1d')](_0xc06d86)}]}]});})[_0x4c66('0x17')](function(_0x242129){_0x1b1b48=_0x242129[_0x4c66('0xf')]({'plain':!![]});if(_0x1b1b48&&_0x1b1b48[_0x4c66('0x1e')]){logger[_0x4c66('0x1f')](_0x4c66('0x20'),_0x4c66('0x21'),util[_0x4c66('0x22')](_0x4c66('0x23'),_0x3b199a['id'],_0x1b1b48['replyUri']));if(_0x1b1b48[_0x4c66('0x24')]&&_0x1b1b48[_0x4c66('0x24')][_0x4c66('0x25')]){_0x3b199a[_0x4c66('0x26')]=_[_0x4c66('0x27')](_0x1b1b48[_0x4c66('0x24')][0x0],_0x4c66('0x1c'));_0x3b199a[_0x4c66('0x1c')]=_0x1b1b48[_0x4c66('0x24')][0x0][_0x4c66('0x1c')];}var _0x3046ac={'method':'POST','uri':encodeURI(_0x1b1b48[_0x4c66('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3046ac[_0x4c66('0x28')]){case'GET':_0x3046ac['qs']=_0x3b199a;break;case _0x4c66('0x29'):_0x3046ac['body']=_0x3b199a;break;}return rp(_0x3046ac)[_0x4c66('0x17')](function(_0x1b50a8){logger[_0x4c66('0x1f')](_0x4c66('0x20'),_0x4c66('0x21'),util[_0x4c66('0x22')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x3b199a['id'],_0x1b1b48[_0x4c66('0x1e')]));if(_0x1b50a8[_0x4c66('0x2a')][_0x4c66('0x2b')]&&_0x1b50a8[_0x4c66('0x2a')][_0x4c66('0x2b')]!=_0x3b199a['Interaction']['threadId']){return _0x228874['OpenchannelInteraction'][_0x4c66('0x2c')]({'threadId':_0x1b50a8[_0x4c66('0x2a')]['threadId']},{'where':{'id':_0x3b199a[_0x4c66('0x26')]['id']}});}else{return;}})[_0x4c66('0x17')](function(){return _0x247370[_0x4c66('0x2c')]({'read':!![]});})[_0x4c66('0x2d')](function(_0x3b89d1){logger[_0x4c66('0x2e')](_0x4c66('0x20'),'afterCreate',util[_0x4c66('0x2f')](_0x3b89d1,{'showHidden':![],'depth':null}));_0x320eac();});}else{_0x320eac();}})[_0x4c66('0x30')](function(){_0x320eac();});}else{_0x320eac();}}},'charset':_0x4c66('0x31'),'collate':_0x4c66('0x32')});}; \ No newline at end of file +var _0x97cc=['OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','get','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define'];(function(_0x560f64,_0x4287ee){var _0x3cca21=function(_0x3b0f66){while(--_0x3b0f66){_0x560f64['push'](_0x560f64['shift']());}};_0x3cca21(++_0x4287ee);}(_0x97cc,0x12d));var _0xc97c=function(_0xe4665,_0x20336b){_0xe4665=_0xe4665-0x0;var _0x383958=_0x97cc[_0xe4665];return _0x383958;};'use strict';var _=require(_0xc97c('0x0'));var util=require(_0xc97c('0x1'));var logger=require(_0xc97c('0x2'))('api');var moment=require(_0xc97c('0x3'));var BPromise=require(_0xc97c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc97c('0x5'));var rimraf=require(_0xc97c('0x6'));var config=require(_0xc97c('0x7'));var attributes=require(_0xc97c('0x8'));module[_0xc97c('0x9')]=function(_0xee0653,_0x27d481){return _0xee0653[_0xc97c('0xa')](_0xc97c('0xb'),attributes,{'tableName':_0xc97c('0xc'),'paranoid':![],'indexes':[{'name':_0xc97c('0xd'),'fields':['body'],'type':_0xc97c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fc3cf,_0x4928cd,_0x17d1bc){var _0x3535cd=_0xee0653[_0xc97c('0xf')];var _0x1acae0=_0x2fc3cf['get']({'plain':!![]});if(_0x1acae0[_0xc97c('0x10')][_0xc97c('0x11')]()==='in'||_0x1acae0[_0xc97c('0x10')][_0xc97c('0x11')]()===_0xc97c('0x12')&&!_0x1acae0[_0xc97c('0x13')]&&!_[_0xc97c('0x14')](_0x1acae0[_0xc97c('0x15')])){_0x3535cd[_0xc97c('0x16')][_0xc97c('0x17')]({'where':{'id':_0x1acae0[_0xc97c('0x18')]}})[_0xc97c('0x19')](function(_0x5a7492){if(_0x5a7492){_0x5a7492[_0xc97c('0x1a')]({'lastMsgAt':_0x1acae0[_0xc97c('0x1b')],'lastMsgDirection':_0x1acae0[_0xc97c('0x10')][_0xc97c('0x11')]()});}})['catch'](function(_0x97ee52){console[_0xc97c('0x1c')](_0x97ee52);});}if(_0x1acae0[_0xc97c('0x10')]==='out'&&!_0x1acae0[_0xc97c('0x13')]){var _0x3cb62a;_0x3535cd[_0xc97c('0x1d')][_0xc97c('0x1e')]()[_0xc97c('0x19')](function(_0x125e1d){return _0x3535cd['OpenchannelAccount'][_0xc97c('0x1f')]({'where':{'id':_0x1acae0[_0xc97c('0x20')]},'include':[{'model':_0x3535cd[_0xc97c('0x16')],'as':_0xc97c('0x21'),'where':{'id':_0x1acae0['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3535cd[_0xc97c('0x1d')],'as':_0xc97c('0x22'),'attributes':_['keys'](_0x125e1d)}]}]});})[_0xc97c('0x19')](function(_0x1ba846){_0x3cb62a=_0x1ba846[_0xc97c('0x23')]({'plain':!![]});if(_0x3cb62a&&_0x3cb62a['replyUri']){logger['info'](_0xc97c('0x24'),'afterCreate',util[_0xc97c('0x25')](_0xc97c('0x26'),_0x1acae0['id'],_0x3cb62a[_0xc97c('0x27')]));if(_0x3cb62a[_0xc97c('0x21')]&&_0x3cb62a[_0xc97c('0x21')][_0xc97c('0x28')]){_0x1acae0[_0xc97c('0x29')]=_['omit'](_0x3cb62a[_0xc97c('0x21')][0x0],'Contact');_0x1acae0[_0xc97c('0x22')]=_0x3cb62a['Interactions'][0x0]['Contact'];}var _0x4928cd={'method':_0xc97c('0x2a'),'uri':encodeURI(_0x3cb62a[_0xc97c('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4928cd[_0xc97c('0x2b')]){case _0xc97c('0x2c'):_0x4928cd['qs']=_0x1acae0;break;case _0xc97c('0x2a'):_0x4928cd['body']=_0x1acae0;break;}return rp(_0x4928cd)[_0xc97c('0x19')](function(_0x2c925c){logger[_0xc97c('0x2d')](_0xc97c('0x24'),'afterCreate',util['format'](_0xc97c('0x2e'),_0x1acae0['id'],_0x3cb62a[_0xc97c('0x27')]));if(_0x2c925c['body']['threadId']&&_0x2c925c[_0xc97c('0x2f')][_0xc97c('0x30')]!=_0x1acae0['Interaction'][_0xc97c('0x30')]){return _0x3535cd[_0xc97c('0x16')]['update']({'threadId':_0x2c925c[_0xc97c('0x2f')][_0xc97c('0x30')]},{'where':{'id':_0x1acae0[_0xc97c('0x29')]['id']}});}else{return;}})[_0xc97c('0x19')](function(){return _0x2fc3cf[_0xc97c('0x1a')]({'read':!![]});})['catch'](function(_0x26dc3d){logger[_0xc97c('0x1c')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xc97c('0x31')](_0x26dc3d,{'showHidden':![],'depth':null}));_0x17d1bc();});}else{_0x17d1bc();}})[_0xc97c('0x32')](function(){_0x17d1bc();});}else{_0x17d1bc();}}},'charset':'utf8mb4','collate':_0xc97c('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 32b06e4..f8dcade 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x1aecc5,_0x2ba839){var _0x3011f4=function(_0x57a029){while(--_0x57a029){_0x1aecc5['push'](_0x1aecc5['shift']());}};_0x3011f4(++_0x2ba839);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e44a3,_0x54c659){_0x5e44a3=_0x5e44a3-0x0;var _0x5b95c5=_0x2ef3[_0x5e44a3];return _0x5b95c5;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x33ec0b,_0x13ab74){var _0x411c05=function(_0x3f29eb){while(--_0x3f29eb){_0x33ec0b['push'](_0x33ec0b['shift']());}};_0x411c05(++_0x13ab74);}(_0x1261,0x144));var _0x1126=function(_0x3d5df9,_0x5b3623){_0x3d5df9=_0x3d5df9-0x0;var _0x50ba39=_0x1261[_0x3d5df9];return _0x50ba39;};'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});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index a791f86..8b3b494 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 _0x064e=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x064e,0xd2));var _0xe064=function(_0x1ca945,_0x173383){_0x1ca945=_0x1ca945-0x0;var _0x9d4ff1=_0x064e[_0x1ca945];return _0x9d4ff1;};'use strict';var OpenchannelMessageEvents=require(_0xe064('0x0'));var events=[_0xe064('0x1'),_0xe064('0x2'),_0xe064('0x3')];function createListener(_0x4a19e7,_0x3b38c2){return function(_0x44b43c){_0x3b38c2[_0xe064('0x4')](_0x4a19e7,_0x44b43c);};}function removeListener(_0x53baee,_0xbc366b){return function(){OpenchannelMessageEvents[_0xe064('0x5')](_0x53baee,_0xbc366b);};}exports[_0xe064('0x6')]=function(_0x50b7d7){for(var _0x1382d5=0x0,_0x1bc692=events[_0xe064('0x7')];_0x1382d5<_0x1bc692;_0x1382d5++){var _0x5e6c86=events[_0x1382d5];var _0x1dd035=createListener(_0xe064('0x8')+_0x5e6c86,_0x50b7d7);OpenchannelMessageEvents['on'](_0x5e6c86,_0x1dd035);}}; \ No newline at end of file +var _0x24dc=['register','remove','update','emit','removeListener'];(function(_0x5a9953,_0x2f6b86){var _0x365718=function(_0x57618e){while(--_0x57618e){_0x5a9953['push'](_0x5a9953['shift']());}};_0x365718(++_0x2f6b86);}(_0x24dc,0x65));var _0xc24d=function(_0x1ab272,_0x164adc){_0x1ab272=_0x1ab272-0x0;var _0x1888f0=_0x24dc[_0x1ab272];return _0x1888f0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0xc24d('0x0'),_0xc24d('0x1')];function createListener(_0x31a8df,_0x292770){return function(_0x1fa05b){_0x292770[_0xc24d('0x2')](_0x31a8df,_0x1fa05b);};}function removeListener(_0x707559,_0x2737e1){return function(){OpenchannelMessageEvents[_0xc24d('0x3')](_0x707559,_0x2737e1);};}exports[_0xc24d('0x4')]=function(_0x1c833b){for(var _0x17ec2e=0x0,_0x1d5829=events['length'];_0x17ec2e<_0x1d5829;_0x17ec2e++){var _0x42b44d=events[_0x17ec2e];var _0x2e6391=createListener('openchannelMessage:'+_0x42b44d,_0x1c833b);OpenchannelMessageEvents['on'](_0x42b44d,_0x2e6391);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 37b0e51..be0d60a 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 _0x1488=['./openchannelQueue.controller','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e8d09,_0x290b78){var _0x145fcd=function(_0xcb521b){while(--_0xcb521b){_0x1e8d09['push'](_0x1e8d09['shift']());}};_0x145fcd(++_0x290b78);}(_0x1488,0x14d));var _0x8148=function(_0x2493f7,_0x49c670){_0x2493f7=_0x2493f7-0x0;var _0x594ab2=_0x1488[_0x2493f7];return _0x594ab2;};'use strict';var multer=require(_0x8148('0x0'));var util=require('util');var path=require(_0x8148('0x1'));var timeout=require('connect-timeout');var express=require(_0x8148('0x2'));var router=express[_0x8148('0x3')]();var fs_extra=require(_0x8148('0x4'));var auth=require(_0x8148('0x5'));var interaction=require(_0x8148('0x6'));var config=require(_0x8148('0x7'));var controller=require(_0x8148('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8148('0x9')]);router['get'](_0x8148('0xa'),auth[_0x8148('0xb')](),controller[_0x8148('0xc')]);router[_0x8148('0xd')](_0x8148('0xe'),auth[_0x8148('0xb')](),controller[_0x8148('0xf')]);router[_0x8148('0xd')](_0x8148('0x10'),auth[_0x8148('0xb')](),controller[_0x8148('0x11')]);router[_0x8148('0xd')](_0x8148('0x12'),auth[_0x8148('0xb')](),controller['getTeams']);router['get'](_0x8148('0x13'),auth['isAuthenticated'](),controller[_0x8148('0x14')]);router[_0x8148('0x15')]('/',auth[_0x8148('0xb')](),controller[_0x8148('0x16')]);router[_0x8148('0x15')]('/:id/teams',auth[_0x8148('0xb')](),controller[_0x8148('0x17')]);router['post'](_0x8148('0x13'),auth['isAuthenticated'](),controller[_0x8148('0x18')]);router[_0x8148('0x19')]('/:id',auth[_0x8148('0xb')](),controller[_0x8148('0x1a')]);router[_0x8148('0x1b')]('/:id',auth[_0x8148('0xb')](),controller['destroy']);router[_0x8148('0x1b')](_0x8148('0x12'),auth[_0x8148('0xb')](),controller[_0x8148('0x1c')]);router[_0x8148('0x1b')]('/:id/users',auth[_0x8148('0xb')](),controller[_0x8148('0x1d')]);module[_0x8148('0x1e')]=router; \ No newline at end of file +var _0xb82b=['getAgents','post','create','addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users'];(function(_0x6bd8fb,_0x183467){var _0x56fff3=function(_0xae60ee){while(--_0xae60ee){_0x6bd8fb['push'](_0x6bd8fb['shift']());}};_0x56fff3(++_0x183467);}(_0xb82b,0x1af));var _0xbb82=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb82b[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xbb82('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbb82('0x1'));var express=require(_0xbb82('0x2'));var router=express[_0xbb82('0x3')]();var fs_extra=require(_0xbb82('0x4'));var auth=require(_0xbb82('0x5'));var interaction=require(_0xbb82('0x6'));var config=require(_0xbb82('0x7'));var controller=require('./openchannelQueue.controller');router[_0xbb82('0x8')]('/',auth[_0xbb82('0x9')](),controller[_0xbb82('0xa')]);router[_0xbb82('0x8')](_0xbb82('0xb'),auth[_0xbb82('0x9')](),controller[_0xbb82('0xc')]);router[_0xbb82('0x8')](_0xbb82('0xd'),auth[_0xbb82('0x9')](),controller[_0xbb82('0xe')]);router[_0xbb82('0x8')](_0xbb82('0xf'),auth['isAuthenticated'](),controller[_0xbb82('0x10')]);router[_0xbb82('0x8')]('/:id/teams',auth[_0xbb82('0x9')](),controller[_0xbb82('0x11')]);router[_0xbb82('0x8')](_0xbb82('0x12'),auth['isAuthenticated'](),controller[_0xbb82('0x13')]);router[_0xbb82('0x14')]('/',auth[_0xbb82('0x9')](),controller[_0xbb82('0x15')]);router[_0xbb82('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbb82('0x16')]);router['post'](_0xbb82('0x12'),auth[_0xbb82('0x9')](),controller[_0xbb82('0x17')]);router[_0xbb82('0x18')](_0xbb82('0xd'),auth[_0xbb82('0x9')](),controller['update']);router[_0xbb82('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xbb82('0x1a')]);router['delete'](_0xbb82('0x1b'),auth[_0xbb82('0x9')](),controller[_0xbb82('0x1c')]);router[_0xbb82('0x19')](_0xbb82('0x12'),auth[_0xbb82('0x9')](),controller['removeAgents']);module[_0xbb82('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index d61d328..f8d265f 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 _0x7bb6=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0xc9bd13,_0x3ceab7){var _0x3e7481=function(_0x281b77){while(--_0x281b77){_0xc9bd13['push'](_0xc9bd13['shift']());}};_0x3e7481(++_0x3ceab7);}(_0x7bb6,0x10b));var _0x67bb=function(_0x3a7c78,_0x1b8b6b){_0x3a7c78=_0x3a7c78-0x0;var _0x5a7bb2=_0x7bb6[_0x3a7c78];return _0x5a7bb2;};'use strict';var Sequelize=require(_0x67bb('0x0'));module[_0x67bb('0x1')]={'name':{'type':Sequelize[_0x67bb('0x2')],'unique':_0x67bb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x67bb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x67bb('0x5')]('rrmemory',_0x67bb('0x6'),_0x67bb('0x7'))}}; \ No newline at end of file +var _0x3e73=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x1fff07,_0x461fe5){var _0xa10c69=function(_0x533586){while(--_0x533586){_0x1fff07['push'](_0x1fff07['shift']());}};_0xa10c69(++_0x461fe5);}(_0x3e73,0xc6));var _0x33e7=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x3e73[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x33e7('0x0'));module[_0x33e7('0x1')]={'name':{'type':Sequelize[_0x33e7('0x2')],'unique':_0x33e7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x33e7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x33e7('0x4')](_0x33e7('0x5'),_0x33e7('0x6'),_0x33e7('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 99f4177..77d76ae 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 _0xf998=['type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','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','params','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','order','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','userOpenchannelQueue:save','Team','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','includes','all','union','compact','value','removeTeams','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','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','defaults','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge'];(function(_0xdc2cb4,_0x4fe099){var _0x3ccca5=function(_0x53a66c){while(--_0x53a66c){_0xdc2cb4['push'](_0xdc2cb4['shift']());}};_0x3ccca5(++_0x4fe099);}(_0xf998,0xd7));var _0x8f99=function(_0x2e63e8,_0xed68f5){_0x2e63e8=_0x2e63e8-0x0;var _0x3fe904=_0xf998[_0x2e63e8];return _0x3fe904;};'use strict';var emlformat=require(_0x8f99('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f99('0x1'));var jsonpatch=require(_0x8f99('0x2'));var rp=require('request-promise');var moment=require(_0x8f99('0x3'));var BPromise=require(_0x8f99('0x4'));var Mustache=require('mustache');var util=require(_0x8f99('0x5'));var path=require(_0x8f99('0x6'));var sox=require(_0x8f99('0x7'));var csv=require(_0x8f99('0x8'));var ejs=require(_0x8f99('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f99('0xa'));var squel=require(_0x8f99('0xb'));var crypto=require(_0x8f99('0xc'));var jsforce=require(_0x8f99('0xd'));var deskjs=require(_0x8f99('0xe'));var toCsv=require(_0x8f99('0x8'));var querystring=require(_0x8f99('0xf'));var Papa=require('papaparse');var Redis=require(_0x8f99('0x10'));var authService=require(_0x8f99('0x11'));var qs=require(_0x8f99('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f99('0x13'));var logger=require('../../config/logger')(_0x8f99('0x14'));var utils=require(_0x8f99('0x15'));var config=require(_0x8f99('0x16'));var licenseUtil=require(_0x8f99('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8f99('0x18')](config[_0x8f99('0x19')],{'host':_0x8f99('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f99('0x19')]));require(_0x8f99('0x1b'))[_0x8f99('0x1c')](socket);function respondWithStatusCode(_0x2a512d,_0x37d228){_0x37d228=_0x37d228||0xcc;return function(_0x22119d){if(_0x22119d){return _0x2a512d[_0x8f99('0x1d')](_0x37d228);}return _0x2a512d[_0x8f99('0x1e')](_0x37d228)[_0x8f99('0x1f')]();};}function respondWithResult(_0xd21000,_0x5b4d04){_0x5b4d04=_0x5b4d04||0xc8;return function(_0x3b785e){if(_0x3b785e){return _0xd21000['status'](_0x5b4d04)['json'](_0x3b785e);}};}function respondWithFilteredResult(_0xaed1bf,_0x5caace){return function(_0x42f9be){if(_0x42f9be){var _0x2b7adb=typeof _0x5caace[_0x8f99('0x20')]===_0x8f99('0x21')&&typeof _0x5caace[_0x8f99('0x22')]===_0x8f99('0x21');var _0x50b7c0=_0x42f9be[_0x8f99('0x23')];var _0x2ef375=_0x2b7adb?0x0:_0x5caace[_0x8f99('0x20')];var _0x1490b1=_0x2b7adb?_0x42f9be[_0x8f99('0x23')]:_0x5caace[_0x8f99('0x20')]+_0x5caace['limit'];var _0x4a420c;if(_0x1490b1>=_0x50b7c0){_0x1490b1=_0x50b7c0;_0x4a420c=0xc8;}else{_0x4a420c=0xce;}_0xaed1bf[_0x8f99('0x1e')](_0x4a420c);return _0xaed1bf['set']('Content-Range',_0x2ef375+'-'+_0x1490b1+'/'+_0x50b7c0)[_0x8f99('0x24')](_0x42f9be);}return null;};}function patchUpdates(_0xab5225){return function(_0x2a56f3){try{jsonpatch[_0x8f99('0x25')](_0x2a56f3,_0xab5225,!![]);}catch(_0x9f1b8f){return BPromise[_0x8f99('0x26')](_0x9f1b8f);}return _0x2a56f3['save']();};}function saveUpdates(_0x864619,_0xeb7188){return function(_0x33c8f8){if(_0x33c8f8){return _0x33c8f8[_0x8f99('0x27')](_0x864619)[_0x8f99('0x28')](function(_0x27be9a){return _0x27be9a;});}return null;};}function removeEntity(_0x1728dc,_0xba8f6f){return function(_0x2944eb){if(_0x2944eb){return _0x2944eb['destroy']()[_0x8f99('0x28')](function(){var _0x2bc37b=_0x2944eb[_0x8f99('0x29')]({'plain':!![]});var _0x3dd714=_0x8f99('0x2a');return db[_0x8f99('0x2b')][_0x8f99('0x2c')]({'where':{'type':_0x3dd714,'resourceId':_0x2bc37b['id']}})[_0x8f99('0x28')](function(){return _0x2944eb;});})[_0x8f99('0x28')](function(){_0x1728dc[_0x8f99('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bda8b,_0x68e461){return function(_0x4a2b9a){if(!_0x4a2b9a){_0x4bda8b[_0x8f99('0x1d')](0x194);}return _0x4a2b9a;};}function handleError(_0x150695,_0x5e8986){_0x5e8986=_0x5e8986||0x1f4;return function(_0x2f4d4a){logger[_0x8f99('0x2d')](_0x2f4d4a['stack']);if(_0x2f4d4a[_0x8f99('0x2e')]){delete _0x2f4d4a[_0x8f99('0x2e')];}_0x150695[_0x8f99('0x1e')](_0x5e8986)[_0x8f99('0x2f')](_0x2f4d4a);};}exports[_0x8f99('0x30')]=function(_0x274815,_0x2ad143){var _0x2931c4={},_0x355678={},_0x2d9d01={'count':0x0,'rows':[]};var _0x2e434b=_[_0x8f99('0x31')](db[_0x8f99('0x32')][_0x8f99('0x33')],function(_0x53d7df){return{'name':_0x53d7df[_0x8f99('0x34')],'type':_0x53d7df['type'][_0x8f99('0x35')]};});_0x355678[_0x8f99('0x36')]=_[_0x8f99('0x31')](_0x2e434b,'name');_0x355678[_0x8f99('0x37')]=_['keys'](_0x274815[_0x8f99('0x37')]);_0x355678['filters']=_[_0x8f99('0x38')](_0x355678['model'],_0x355678['query']);_0x2931c4[_0x8f99('0x39')]=_['intersection'](_0x355678[_0x8f99('0x36')],qs['fields'](_0x274815['query'][_0x8f99('0x3a')]));_0x2931c4[_0x8f99('0x39')]=_0x2931c4[_0x8f99('0x39')][_0x8f99('0x3b')]?_0x2931c4[_0x8f99('0x39')]:_0x355678[_0x8f99('0x36')];if(!_0x274815[_0x8f99('0x37')]['hasOwnProperty'](_0x8f99('0x3c'))){_0x2931c4[_0x8f99('0x22')]=qs[_0x8f99('0x22')](_0x274815['query'][_0x8f99('0x22')]);_0x2931c4['offset']=qs[_0x8f99('0x20')](_0x274815[_0x8f99('0x37')][_0x8f99('0x20')]);}_0x2931c4['order']=qs[_0x8f99('0x3d')](_0x274815[_0x8f99('0x37')][_0x8f99('0x3d')]);_0x2931c4[_0x8f99('0x3e')]=qs[_0x8f99('0x3f')](_[_0x8f99('0x40')](_0x274815[_0x8f99('0x37')],_0x355678['filters']),_0x2e434b);if(_0x274815[_0x8f99('0x37')][_0x8f99('0x41')]){_0x2931c4[_0x8f99('0x3e')]=_[_0x8f99('0x42')](_0x2931c4[_0x8f99('0x3e')],{'$or':_[_0x8f99('0x31')](_0x2e434b,function(_0x198b0c){if(_0x198b0c[_0x8f99('0x43')]!==_0x8f99('0x44')){var _0x4b8681={};_0x4b8681[_0x198b0c['name']]={'$like':'%'+_0x274815['query']['filter']+'%'};return _0x4b8681;}})});}_0x2931c4=_[_0x8f99('0x42')]({},_0x2931c4,_0x274815[_0x8f99('0x45')]);var _0x52cde3={'where':_0x2931c4[_0x8f99('0x3e')]};return db[_0x8f99('0x32')][_0x8f99('0x23')](_0x52cde3)['then'](function(_0x31dec9){_0x2d9d01[_0x8f99('0x23')]=_0x31dec9;if(_0x274815['query'][_0x8f99('0x46')]){_0x2931c4['include']=[{'all':!![]}];}return db[_0x8f99('0x32')][_0x8f99('0x47')](_0x2931c4);})[_0x8f99('0x28')](function(_0x3e0b99){_0x2d9d01[_0x8f99('0x48')]=_0x3e0b99;return _0x2d9d01;})[_0x8f99('0x28')](respondWithFilteredResult(_0x2ad143,_0x2931c4))[_0x8f99('0x49')](handleError(_0x2ad143,null));};exports[_0x8f99('0x4a')]=function(_0x11fce0,_0x1fc907){var _0x2d8575={'raw':!![],'where':{'id':_0x11fce0['params']['id']}},_0x37c432={};_0x37c432[_0x8f99('0x36')]=_[_0x8f99('0x4b')](db[_0x8f99('0x32')][_0x8f99('0x33')]);_0x37c432[_0x8f99('0x37')]=_['keys'](_0x11fce0[_0x8f99('0x37')]);_0x37c432[_0x8f99('0x3f')]=_[_0x8f99('0x38')](_0x37c432[_0x8f99('0x36')],_0x37c432[_0x8f99('0x37')]);_0x2d8575[_0x8f99('0x39')]=_['intersection'](_0x37c432['model'],qs[_0x8f99('0x3a')](_0x11fce0['query'][_0x8f99('0x3a')]));_0x2d8575[_0x8f99('0x39')]=_0x2d8575[_0x8f99('0x39')]['length']?_0x2d8575[_0x8f99('0x39')]:_0x37c432['model'];if(_0x11fce0[_0x8f99('0x37')][_0x8f99('0x46')]){_0x2d8575[_0x8f99('0x4c')]=[{'all':!![]}];}_0x2d8575=_[_0x8f99('0x42')]({},_0x2d8575,_0x11fce0['options']);return db['OpenchannelQueue'][_0x8f99('0x4d')](_0x2d8575)[_0x8f99('0x28')](handleEntityNotFound(_0x1fc907,null))[_0x8f99('0x28')](respondWithResult(_0x1fc907,null))[_0x8f99('0x49')](handleError(_0x1fc907,null));};exports[_0x8f99('0x4e')]=function(_0x55ff26,_0x2668a8){return db[_0x8f99('0x32')][_0x8f99('0x4e')](_0x55ff26[_0x8f99('0x4f')],{})['then'](function(_0x41081d){var _0x4d2b22=_0x55ff26[_0x8f99('0x50')][_0x8f99('0x29')]({'plain':!![]});if(!_0x4d2b22)throw new Error(_0x8f99('0x51'));if(_0x4d2b22[_0x8f99('0x52')]===_0x8f99('0x50')){var _0x1c18e9=_0x41081d['get']({'plain':!![]});var _0x174864='OpenchannelQueues';return db[_0x8f99('0x53')]['find']({'where':{'name':_0x174864,'userProfileId':_0x4d2b22[_0x8f99('0x54')]},'raw':!![]})[_0x8f99('0x28')](function(_0x22cf28){if(_0x22cf28&&_0x22cf28[_0x8f99('0x55')]===0x0){return db[_0x8f99('0x2b')][_0x8f99('0x4e')]({'name':_0x1c18e9[_0x8f99('0x2e')],'resourceId':_0x1c18e9['id'],'type':_0x22cf28[_0x8f99('0x2e')],'sectionId':_0x22cf28['id']},{})[_0x8f99('0x28')](function(){return _0x41081d;});}else{return _0x41081d;}})[_0x8f99('0x49')](function(_0x38a63a){logger[_0x8f99('0x2d')](_0x8f99('0x56'),_0x38a63a);throw _0x38a63a;});}return _0x41081d;})[_0x8f99('0x28')](respondWithResult(_0x2668a8,0xc9))[_0x8f99('0x49')](handleError(_0x2668a8,null));};exports['update']=function(_0x27397f,_0x362be5){if(_0x27397f[_0x8f99('0x4f')]['id']){delete _0x27397f['body']['id'];}return db[_0x8f99('0x32')][_0x8f99('0x4d')]({'where':{'id':_0x27397f[_0x8f99('0x57')]['id']}})['then'](handleEntityNotFound(_0x362be5,null))['then'](saveUpdates(_0x27397f[_0x8f99('0x4f')],null))[_0x8f99('0x28')](respondWithResult(_0x362be5,null))[_0x8f99('0x49')](handleError(_0x362be5,null));};exports[_0x8f99('0x2c')]=function(_0x23af50,_0x3ff10b){return db[_0x8f99('0x32')][_0x8f99('0x4d')]({'where':{'id':_0x23af50[_0x8f99('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ff10b,null))['then'](removeEntity(_0x3ff10b,null))[_0x8f99('0x49')](handleError(_0x3ff10b,null));};exports[_0x8f99('0x58')]=function(_0x2d8970,_0x37d608){return db[_0x8f99('0x32')]['describe']()[_0x8f99('0x28')](respondWithResult(_0x37d608,null))['catch'](handleError(_0x37d608,null));};exports[_0x8f99('0x59')]=function(_0x46420d,_0x266675,_0x24a5bb){var _0x438ee7={'raw':!![],'where':{}},_0x2635a9={},_0x2d60cc;return db[_0x8f99('0x32')][_0x8f99('0x5a')]({'where':{'id':_0x46420d[_0x8f99('0x57')]['id']}})['then'](handleEntityNotFound(_0x266675,null))[_0x8f99('0x28')](function(_0x5dfd10){if(_0x5dfd10){_0x2d60cc=_0x5dfd10['get']({'plain':!![]});_0x2635a9[_0x8f99('0x36')]=_[_0x8f99('0x4b')](db[_0x8f99('0x5b')]['rawAttributes']);_0x2635a9[_0x8f99('0x37')]=_[_0x8f99('0x4b')](_0x46420d['query']);_0x2635a9[_0x8f99('0x3f')]=_[_0x8f99('0x38')](_0x2635a9[_0x8f99('0x36')],_0x2635a9[_0x8f99('0x37')]);_0x438ee7['attributes']=_[_0x8f99('0x38')](_0x2635a9[_0x8f99('0x36')],qs[_0x8f99('0x3a')](_0x46420d[_0x8f99('0x37')][_0x8f99('0x3a')]));_0x438ee7['attributes']=_0x438ee7[_0x8f99('0x39')][_0x8f99('0x3b')]?_0x438ee7['attributes']:_0x2635a9[_0x8f99('0x36')];if(!_0x46420d[_0x8f99('0x37')][_0x8f99('0x5c')](_0x8f99('0x3c'))){_0x438ee7[_0x8f99('0x22')]=qs[_0x8f99('0x22')](_0x46420d[_0x8f99('0x37')][_0x8f99('0x22')]);_0x438ee7[_0x8f99('0x20')]=qs['offset'](_0x46420d[_0x8f99('0x37')][_0x8f99('0x20')]);}_0x438ee7[_0x8f99('0x5d')]=qs[_0x8f99('0x3d')](_0x46420d[_0x8f99('0x37')][_0x8f99('0x3d')]);_0x438ee7[_0x8f99('0x3e')]=qs['filters'](_['pick'](_0x46420d['query'],_0x2635a9[_0x8f99('0x3f')]));_0x438ee7[_0x8f99('0x3e')]['OpenchannelQueueId']=_0x5dfd10['id'];if(_0x46420d[_0x8f99('0x37')][_0x8f99('0x41')]){_0x438ee7[_0x8f99('0x3e')]=_['merge'](_0x438ee7[_0x8f99('0x3e')],{'$or':_['map'](_0x438ee7['attributes'],function(_0x254f30){var _0x328b47={};_0x328b47[_0x254f30]={'$like':'%'+_0x46420d[_0x8f99('0x37')][_0x8f99('0x41')]+'%'};return _0x328b47;})});}_0x438ee7=_[_0x8f99('0x42')]({},_0x438ee7,_0x46420d[_0x8f99('0x45')]);return db[_0x8f99('0x5b')][_0x8f99('0x47')](_0x438ee7);}})[_0x8f99('0x28')](function(_0x13ca6a){if(_0x13ca6a){return db[_0x8f99('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x13ca6a,_0x8f99('0x5f')),'role':_0x8f99('0x60')},'attributes':['id',_0x8f99('0x2e'),_0x8f99('0x61'),_0x8f99('0x62'),_0x8f99('0x63')]});}})[_0x8f99('0x28')](function(_0x4c651b){if(_0x4c651b){return{'count':_0x4c651b['count'],'rows':_[_0x8f99('0x31')](_0x4c651b[_0x8f99('0x48')],function(_0x15dfad){return{'membername':_0x15dfad[_0x8f99('0x2e')],'UserId':_0x15dfad['id'],'queue_name':_0x2d60cc[_0x8f99('0x2e')],'OpenchannelQueueId':_0x2d60cc['id'],'interface':util[_0x8f99('0x64')](_0x8f99('0x65'),'SIP',_0x15dfad[_0x8f99('0x2e')]),'penalty':0x0,'paused':_0x15dfad[_0x8f99('0x61')],'createdAt':_0x15dfad[_0x8f99('0x63')],'updatedAt':_0x15dfad[_0x8f99('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8f99('0x28')](respondWithFilteredResult(_0x266675,_0x438ee7))['catch'](handleError(_0x266675,null));};exports[_0x8f99('0x66')]=function(_0x1c23bc,_0x4e1c6d,_0x5af8c6){var _0x1fe38a={};var _0x4dbc83={};var _0x5e9e2f;var _0x3e9e46;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x1c23bc[_0x8f99('0x57')]['id']}})[_0x8f99('0x28')](handleEntityNotFound(_0x4e1c6d,null))[_0x8f99('0x28')](function(_0x5ab6a3){if(_0x5ab6a3){_0x5e9e2f=_0x5ab6a3;_0x4dbc83[_0x8f99('0x36')]=_['keys'](db['Team'][_0x8f99('0x33')]);_0x4dbc83[_0x8f99('0x37')]=_[_0x8f99('0x4b')](_0x1c23bc['query']);_0x4dbc83[_0x8f99('0x3f')]=_[_0x8f99('0x38')](_0x4dbc83[_0x8f99('0x36')],_0x4dbc83['query']);_0x1fe38a[_0x8f99('0x39')]=_[_0x8f99('0x38')](_0x4dbc83[_0x8f99('0x36')],qs['fields'](_0x1c23bc[_0x8f99('0x37')][_0x8f99('0x3a')]));_0x1fe38a[_0x8f99('0x39')]=_0x1fe38a[_0x8f99('0x39')]['length']?_0x1fe38a[_0x8f99('0x39')]:_0x4dbc83['model'];_0x1fe38a['order']=qs[_0x8f99('0x3d')](_0x1c23bc['query'][_0x8f99('0x3d')]);_0x1fe38a[_0x8f99('0x3e')]=qs['filters'](_[_0x8f99('0x40')](_0x1c23bc[_0x8f99('0x37')],_0x4dbc83[_0x8f99('0x3f')]));if(_0x1c23bc[_0x8f99('0x37')][_0x8f99('0x41')]){_0x1fe38a[_0x8f99('0x3e')]=_['merge'](_0x1fe38a['where'],{'$or':_[_0x8f99('0x31')](_0x1fe38a[_0x8f99('0x39')],function(_0x1bb6d7){var _0x27694e={};_0x27694e[_0x1bb6d7]={'$like':'%'+_0x1c23bc['query'][_0x8f99('0x41')]+'%'};return _0x27694e;})});}_0x1fe38a=_[_0x8f99('0x42')]({},_0x1fe38a,_0x1c23bc['options']);return _0x5e9e2f[_0x8f99('0x66')](_0x1fe38a);}})[_0x8f99('0x28')](function(_0x148cff){if(_0x148cff){_0x3e9e46=_0x148cff[_0x8f99('0x3b')];if(!_0x1c23bc[_0x8f99('0x37')][_0x8f99('0x5c')](_0x8f99('0x3c'))){_0x1fe38a[_0x8f99('0x22')]=qs[_0x8f99('0x22')](_0x1c23bc[_0x8f99('0x37')]['limit']);_0x1fe38a[_0x8f99('0x20')]=qs['offset'](_0x1c23bc[_0x8f99('0x37')]['offset']);}return _0x5e9e2f[_0x8f99('0x66')](_0x1fe38a);}})[_0x8f99('0x28')](function(_0x531469){if(_0x531469){return _0x531469?{'count':_0x3e9e46,'rows':_0x531469}:null;}})[_0x8f99('0x28')](respondWithResult(_0x4e1c6d,null))[_0x8f99('0x49')](handleError(_0x4e1c6d,null));};exports[_0x8f99('0x67')]=function(_0xca7462,_0x248151,_0x39780d){var _0x112725=_0xca7462['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x112725},'attributes':['id'],'include':[{'model':db[_0x8f99('0x5e')],'as':_0x8f99('0x68'),'attributes':['id',_0x8f99('0x2e'),_0x8f99('0x69'),_0x8f99('0x6a'),_0x8f99('0x6b')],'raw':!![]}]})[_0x8f99('0x28')](function(_0x452cf6){if(_0x452cf6){var _0x3ec733=_[_0x8f99('0x6c')](_0x452cf6,function(_0x1a19a5){var _0x2bc922=_0x1a19a5['get']({'plain':!![]});return _0x2bc922['Agents'];});return db['OpenchannelQueue']['find']({'where':{'id':_0xca7462[_0x8f99('0x57')]['id']}})[_0x8f99('0x28')](function(_0x122798){return db['sequelize'][_0x8f99('0x6d')](function(_0x48be20){return _0x122798[_0x8f99('0x67')](_0x112725,{'transaction':_0x48be20})[_0x8f99('0x28')](function(){return BPromise[_0x8f99('0x6e')](_0x3ec733,function(_0x2e67e6){return db[_0x8f99('0x5b')]['findOrCreate']({'where':{'UserId':_0x2e67e6['id'],'OpenchannelQueueId':_0xca7462[_0x8f99('0x57')]['id']},'transaction':_0x48be20});});})[_0x8f99('0x28')](function(){_0x3ec733['forEach'](function(_0x2f6ef4){socket['emit'](_0x8f99('0x6f'),{'UserId':_0x2f6ef4['id'],'OpenchannelQueueId':_0x122798['id']});});});});});}})['then'](respondWithStatusCode(_0x248151,null))[_0x8f99('0x49')](handleError(_0x248151,null));};exports['removeTeams']=function(_0xd9add1,_0x280e99,_0x1e5aa9){return db[_0x8f99('0x70')][_0x8f99('0x47')]({'where':{'id':_0xd9add1['query'][_0x8f99('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8f99('0x28')](handleEntityNotFound(_0x280e99,null))[_0x8f99('0x28')](function(_0x4652b7){var _0x17f4c1=_[_0x8f99('0x31')](_0x4652b7,'id');var _0x1f4df0=[];var _0xc6ca11=[];var _0x5bed97=squel[_0x8f99('0x72')]();_0x5bed97[_0x8f99('0x73')](_0x8f99('0x74'))[_0x8f99('0x75')](_0x8f99('0x76'),'tq')[_0x8f99('0x77')](_0x8f99('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8f99('0x3e')](_0x8f99('0x79'),_0xd9add1['params']['id']);for(var _0x3e9e4c=0x0;_0x3e9e4c<_0x4652b7[_0x8f99('0x3b')];_0x3e9e4c+=0x1){let _0x920180=_0x4652b7[_0x3e9e4c];for(var _0x39793d=0x0;_0x39793d<_0x920180[_0x8f99('0x68')][_0x8f99('0x3b')];_0x39793d+=0x1){let _0x88e07a=_0x920180['Agents'][_0x39793d];var _0x374412=_0x5bed97[_0x8f99('0x7a')]();_0x374412['where']('ut.UserId\x20=\x20?',_0x88e07a['id']);_0xc6ca11['push'](db[_0x8f99('0x7b')][_0x8f99('0x37')](_0x374412[_0x8f99('0x7c')](),{'type':db['sequelize'][_0x8f99('0x7d')]['SELECT']})['then'](function(_0x52f720){if(_0x52f720['length']===0x1){return _0x88e07a['id'];}else{var _0xe0be52=_['every'](_[_0x8f99('0x31')](_0x52f720,'TeamId'),function(_0xd8e729){return _[_0x8f99('0x7e')](_0x17f4c1,_0xd8e729);});if(_0xe0be52){return _0x88e07a['id'];}}}));}}return BPromise[_0x8f99('0x7f')](_0xc6ca11)[_0x8f99('0x28')](function(_0xcd983c){_0x1f4df0=_(_0x1f4df0)[_0x8f99('0x80')](_0xcd983c)[_0x8f99('0x81')]()[_0x8f99('0x82')]();return db['OpenchannelQueue']['find']({'where':{'id':_0xd9add1[_0x8f99('0x57')]['id']}})['then'](function(_0x1d67b8){return db['sequelize'][_0x8f99('0x6d')](function(_0x232ec9){return _0x1d67b8[_0x8f99('0x83')](_0xd9add1[_0x8f99('0x37')][_0x8f99('0x71')],{'transaction':_0x232ec9})['then'](function(){if(!_['isEmpty'](_0x1f4df0)){return _0x1d67b8[_0x8f99('0x84')](_0x1f4df0,{'transaction':_0x232ec9});}})['then'](function(){_0x1f4df0[_0x8f99('0x85')](function(_0x5c1faa){socket[_0x8f99('0x86')](_0x8f99('0x87'),{'UserId':_0x5c1faa,'OpenchannelQueueId':_0x1d67b8['id']});});});});});});})[_0x8f99('0x28')](respondWithStatusCode(_0x280e99,null))[_0x8f99('0x49')](handleError(_0x280e99,null));};exports[_0x8f99('0x88')]=function(_0x54e2d0,_0x2fb866,_0x7181f5){return db['OpenchannelQueue'][_0x8f99('0x4d')]({'where':{'id':_0x54e2d0[_0x8f99('0x57')]['id']}})['then'](handleEntityNotFound(_0x2fb866,null))['then'](function(_0x29d401){if(_0x29d401){return _0x29d401[_0x8f99('0x88')](_0x54e2d0['body'][_0x8f99('0x71')],_[_0x8f99('0x89')](_0x54e2d0[_0x8f99('0x4f')],[_0x8f99('0x71'),'id'])||{})[_0x8f99('0x8a')](function(_0x3e2d54){for(var _0x987d28=0x0;_0x987d28<_0x54e2d0[_0x8f99('0x4f')]['ids']['length'];_0x987d28+=0x1){socket[_0x8f99('0x86')](_0x8f99('0x6f'),{'UserId':Number(_0x54e2d0['body'][_0x8f99('0x71')][_0x987d28]),'OpenchannelQueueId':Number(_0x54e2d0[_0x8f99('0x57')]['id'])});}return _0x3e2d54;});}})['then'](respondWithResult(_0x2fb866,null))[_0x8f99('0x49')](handleError(_0x2fb866,null));};exports[_0x8f99('0x84')]=function(_0x212830,_0x1f3e54,_0x4590e8){return db[_0x8f99('0x32')]['find']({'where':{'id':_0x212830[_0x8f99('0x57')]['id']}})[_0x8f99('0x28')](handleEntityNotFound(_0x1f3e54,null))['then'](function(_0x4e6442){if(_0x4e6442){return _0x4e6442[_0x8f99('0x84')](_0x212830[_0x8f99('0x37')]['ids'])[_0x8f99('0x28')](function(){if(_[_0x8f99('0x8b')](_0x212830['query'][_0x8f99('0x71')])){for(var _0x192dee=0x0;_0x192dee<_0x212830[_0x8f99('0x37')][_0x8f99('0x71')]['length'];_0x192dee+=0x1){socket[_0x8f99('0x86')]('userOpenchannelQueue:remove',{'UserId':Number(_0x212830[_0x8f99('0x37')][_0x8f99('0x71')][_0x192dee]),'OpenchannelQueueId':Number(_0x212830[_0x8f99('0x57')]['id'])});}}else{socket[_0x8f99('0x86')](_0x8f99('0x87'),{'UserId':Number(_0x212830[_0x8f99('0x37')][_0x8f99('0x71')]),'OpenchannelQueueId':Number(_0x212830[_0x8f99('0x57')]['id'])});}});}})[_0x8f99('0x28')](respondWithStatusCode(_0x1f3e54,null))['catch'](handleError(_0x1f3e54,null));};exports['getAgents']=function(_0x5f2b58,_0x423d77,_0x5e30a8){var _0x1f32c3={};var _0x17b0ed={};var _0x563675;var _0x300c2c;return db[_0x8f99('0x32')][_0x8f99('0x5a')]({'where':{'id':_0x5f2b58['params']['id']}})[_0x8f99('0x28')](handleEntityNotFound(_0x423d77,null))['then'](function(_0x102831){if(_0x102831){_0x563675=_0x102831;_0x17b0ed[_0x8f99('0x36')]=_[_0x8f99('0x4b')](db['User'][_0x8f99('0x33')]);_0x17b0ed['query']=_['keys'](_0x5f2b58[_0x8f99('0x37')]);_0x17b0ed[_0x8f99('0x3f')]=_[_0x8f99('0x38')](_0x17b0ed['model'],_0x17b0ed[_0x8f99('0x37')]);_0x1f32c3[_0x8f99('0x39')]=_[_0x8f99('0x38')](_0x17b0ed[_0x8f99('0x36')],qs[_0x8f99('0x3a')](_0x5f2b58['query'][_0x8f99('0x3a')]));_0x1f32c3[_0x8f99('0x39')]=_0x1f32c3[_0x8f99('0x39')][_0x8f99('0x3b')]?_0x1f32c3['attributes']:_0x17b0ed[_0x8f99('0x36')];_0x1f32c3['order']=qs[_0x8f99('0x3d')](_0x5f2b58[_0x8f99('0x37')][_0x8f99('0x3d')]);_0x1f32c3[_0x8f99('0x3e')]=qs[_0x8f99('0x3f')](_[_0x8f99('0x40')](_0x5f2b58[_0x8f99('0x37')],_0x17b0ed[_0x8f99('0x3f')]));if(_0x5f2b58[_0x8f99('0x37')][_0x8f99('0x41')]){_0x1f32c3[_0x8f99('0x3e')]=_[_0x8f99('0x42')](_0x1f32c3[_0x8f99('0x3e')],{'$or':_[_0x8f99('0x31')](_0x1f32c3[_0x8f99('0x39')],function(_0x35beec){var _0xea258a={};_0xea258a[_0x35beec]={'$like':'%'+_0x5f2b58[_0x8f99('0x37')]['filter']+'%'};return _0xea258a;})});}_0x1f32c3=_['merge']({},_0x1f32c3,_0x5f2b58[_0x8f99('0x45')]);return _0x563675[_0x8f99('0x8c')](_0x1f32c3);}})[_0x8f99('0x28')](function(_0x4547d8){if(_0x4547d8){_0x300c2c=_0x4547d8['length'];if(!_0x5f2b58[_0x8f99('0x37')][_0x8f99('0x5c')]('nolimit')){_0x1f32c3['limit']=qs[_0x8f99('0x22')](_0x5f2b58[_0x8f99('0x37')][_0x8f99('0x22')]);_0x1f32c3['offset']=qs[_0x8f99('0x20')](_0x5f2b58[_0x8f99('0x37')][_0x8f99('0x20')]);}return _0x563675[_0x8f99('0x8c')](_0x1f32c3);}})[_0x8f99('0x28')](function(_0x28e3c6){if(_0x28e3c6){return _0x28e3c6?{'count':_0x300c2c,'rows':_0x28e3c6}:null;}})[_0x8f99('0x28')](respondWithResult(_0x423d77,null))['catch'](handleError(_0x423d77,null));}; \ No newline at end of file +var _0xc78c=['error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','User','UserId','agent','openchannelPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','limit','count','offset','set','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xc78c,0x187));var _0xcc78=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xc78c[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc78('0x0'));var zipdir=require(_0xcc78('0x1'));var jsonpatch=require(_0xcc78('0x2'));var rp=require(_0xcc78('0x3'));var moment=require(_0xcc78('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcc78('0x5'));var util=require(_0xcc78('0x6'));var path=require(_0xcc78('0x7'));var sox=require(_0xcc78('0x8'));var csv=require(_0xcc78('0x9'));var ejs=require(_0xcc78('0xa'));var fs=require('fs');var fs_extra=require(_0xcc78('0xb'));var _=require(_0xcc78('0xc'));var squel=require('squel');var crypto=require(_0xcc78('0xd'));var jsforce=require(_0xcc78('0xe'));var deskjs=require(_0xcc78('0xf'));var toCsv=require(_0xcc78('0x9'));var querystring=require(_0xcc78('0x10'));var Papa=require(_0xcc78('0x11'));var Redis=require(_0xcc78('0x12'));var authService=require(_0xcc78('0x13'));var qs=require(_0xcc78('0x14'));var as=require(_0xcc78('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc78('0x16'))(_0xcc78('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcc78('0x18'));var db=require('../../mysqldb')['db'];config[_0xcc78('0x19')]=_[_0xcc78('0x1a')](config[_0xcc78('0x19')],{'host':_0xcc78('0x1b'),'port':0x18eb});var socket=require(_0xcc78('0x1c'))(new Redis(config[_0xcc78('0x19')]));require(_0xcc78('0x1d'))[_0xcc78('0x1e')](socket);function respondWithStatusCode(_0x4bca70,_0x392a26){_0x392a26=_0x392a26||0xcc;return function(_0x4e3336){if(_0x4e3336){return _0x4bca70[_0xcc78('0x1f')](_0x392a26);}return _0x4bca70[_0xcc78('0x20')](_0x392a26)['end']();};}function respondWithResult(_0x2161d5,_0x54079c){_0x54079c=_0x54079c||0xc8;return function(_0x323425){if(_0x323425){return _0x2161d5[_0xcc78('0x20')](_0x54079c)[_0xcc78('0x21')](_0x323425);}};}function respondWithFilteredResult(_0x15c1ab,_0x1daf69){return function(_0x44cb98){if(_0x44cb98){var _0x5c9c81=typeof _0x1daf69['offset']==='undefined'&&typeof _0x1daf69[_0xcc78('0x22')]==='undefined';var _0x5b0c63=_0x44cb98[_0xcc78('0x23')];var _0x2d8320=_0x5c9c81?0x0:_0x1daf69[_0xcc78('0x24')];var _0x251fe0=_0x5c9c81?_0x44cb98['count']:_0x1daf69[_0xcc78('0x24')]+_0x1daf69['limit'];var _0x4d9a7e;if(_0x251fe0>=_0x5b0c63){_0x251fe0=_0x5b0c63;_0x4d9a7e=0xc8;}else{_0x4d9a7e=0xce;}_0x15c1ab[_0xcc78('0x20')](_0x4d9a7e);return _0x15c1ab[_0xcc78('0x25')]('Content-Range',_0x2d8320+'-'+_0x251fe0+'/'+_0x5b0c63)['json'](_0x44cb98);}return null;};}function patchUpdates(_0x45a698){return function(_0x5a1ca0){try{jsonpatch[_0xcc78('0x26')](_0x5a1ca0,_0x45a698,!![]);}catch(_0x26f266){return BPromise['reject'](_0x26f266);}return _0x5a1ca0[_0xcc78('0x27')]();};}function saveUpdates(_0x243e43,_0x3e626e){return function(_0x2610f7){if(_0x2610f7){return _0x2610f7[_0xcc78('0x28')](_0x243e43)[_0xcc78('0x29')](function(_0xad4047){return _0xad4047;});}return null;};}function removeEntity(_0x4669b2,_0x386fc4){return function(_0xe60b22){if(_0xe60b22){return _0xe60b22[_0xcc78('0x2a')]()[_0xcc78('0x29')](function(){var _0x45a124=_0xe60b22[_0xcc78('0x2b')]({'plain':!![]});var _0x368efb=_0xcc78('0x2c');return db[_0xcc78('0x2d')]['destroy']({'where':{'type':_0x368efb,'resourceId':_0x45a124['id']}})[_0xcc78('0x29')](function(){return _0xe60b22;});})[_0xcc78('0x29')](function(){_0x4669b2['status'](0xcc)[_0xcc78('0x2e')]();});}};}function handleEntityNotFound(_0x12d991,_0x42e2a6){return function(_0x19d409){if(!_0x19d409){_0x12d991['sendStatus'](0x194);}return _0x19d409;};}function handleError(_0x4dec89,_0x20f1d3){_0x20f1d3=_0x20f1d3||0x1f4;return function(_0x1a4dd9){logger[_0xcc78('0x2f')](_0x1a4dd9[_0xcc78('0x30')]);if(_0x1a4dd9[_0xcc78('0x31')]){delete _0x1a4dd9[_0xcc78('0x31')];}_0x4dec89[_0xcc78('0x20')](_0x20f1d3)[_0xcc78('0x32')](_0x1a4dd9);};}exports[_0xcc78('0x33')]=function(_0x2838a4,_0x2ea79c){var _0x24834b={},_0x1c1a30={},_0x5dcf8b={'count':0x0,'rows':[]};var _0x479ada=_[_0xcc78('0x34')](db['OpenchannelQueue']['rawAttributes'],function(_0x334fa9){return{'name':_0x334fa9[_0xcc78('0x35')],'type':_0x334fa9[_0xcc78('0x36')][_0xcc78('0x37')]};});_0x1c1a30[_0xcc78('0x38')]=_[_0xcc78('0x34')](_0x479ada,_0xcc78('0x31'));_0x1c1a30[_0xcc78('0x39')]=_[_0xcc78('0x3a')](_0x2838a4['query']);_0x1c1a30['filters']=_[_0xcc78('0x3b')](_0x1c1a30[_0xcc78('0x38')],_0x1c1a30[_0xcc78('0x39')]);_0x24834b['attributes']=_[_0xcc78('0x3b')](_0x1c1a30['model'],qs[_0xcc78('0x3c')](_0x2838a4[_0xcc78('0x39')][_0xcc78('0x3c')]));_0x24834b[_0xcc78('0x3d')]=_0x24834b[_0xcc78('0x3d')][_0xcc78('0x3e')]?_0x24834b['attributes']:_0x1c1a30[_0xcc78('0x38')];if(!_0x2838a4['query']['hasOwnProperty'](_0xcc78('0x3f'))){_0x24834b['limit']=qs[_0xcc78('0x22')](_0x2838a4[_0xcc78('0x39')][_0xcc78('0x22')]);_0x24834b[_0xcc78('0x24')]=qs[_0xcc78('0x24')](_0x2838a4['query']['offset']);}_0x24834b[_0xcc78('0x40')]=qs[_0xcc78('0x41')](_0x2838a4[_0xcc78('0x39')][_0xcc78('0x41')]);_0x24834b[_0xcc78('0x42')]=qs[_0xcc78('0x43')](_[_0xcc78('0x44')](_0x2838a4[_0xcc78('0x39')],_0x1c1a30['filters']),_0x479ada);if(_0x2838a4[_0xcc78('0x39')][_0xcc78('0x45')]){_0x24834b[_0xcc78('0x42')]=_[_0xcc78('0x46')](_0x24834b[_0xcc78('0x42')],{'$or':_['map'](_0x479ada,function(_0x4ac50a){if(_0x4ac50a[_0xcc78('0x36')]!==_0xcc78('0x47')){var _0x36d220={};_0x36d220[_0x4ac50a['name']]={'$like':'%'+_0x2838a4[_0xcc78('0x39')][_0xcc78('0x45')]+'%'};return _0x36d220;}})});}_0x24834b=_[_0xcc78('0x46')]({},_0x24834b,_0x2838a4[_0xcc78('0x48')]);var _0x18242f={'where':_0x24834b['where']};return db[_0xcc78('0x49')][_0xcc78('0x23')](_0x18242f)[_0xcc78('0x29')](function(_0x25668d){_0x5dcf8b[_0xcc78('0x23')]=_0x25668d;if(_0x2838a4['query'][_0xcc78('0x4a')]){_0x24834b[_0xcc78('0x4b')]=[{'all':!![]}];}return db[_0xcc78('0x49')][_0xcc78('0x4c')](_0x24834b);})[_0xcc78('0x29')](function(_0x5855c0){_0x5dcf8b['rows']=_0x5855c0;return _0x5dcf8b;})[_0xcc78('0x29')](respondWithFilteredResult(_0x2ea79c,_0x24834b))[_0xcc78('0x4d')](handleError(_0x2ea79c,null));};exports[_0xcc78('0x4e')]=function(_0x305934,_0x67ad11){var _0xc1a05c={'raw':!![],'where':{'id':_0x305934[_0xcc78('0x4f')]['id']}},_0x5c9737={};_0x5c9737['model']=_[_0xcc78('0x3a')](db['OpenchannelQueue'][_0xcc78('0x50')]);_0x5c9737[_0xcc78('0x39')]=_[_0xcc78('0x3a')](_0x305934[_0xcc78('0x39')]);_0x5c9737[_0xcc78('0x43')]=_[_0xcc78('0x3b')](_0x5c9737[_0xcc78('0x38')],_0x5c9737[_0xcc78('0x39')]);_0xc1a05c[_0xcc78('0x3d')]=_[_0xcc78('0x3b')](_0x5c9737[_0xcc78('0x38')],qs['fields'](_0x305934[_0xcc78('0x39')][_0xcc78('0x3c')]));_0xc1a05c[_0xcc78('0x3d')]=_0xc1a05c['attributes'][_0xcc78('0x3e')]?_0xc1a05c[_0xcc78('0x3d')]:_0x5c9737[_0xcc78('0x38')];if(_0x305934['query'][_0xcc78('0x4a')]){_0xc1a05c[_0xcc78('0x4b')]=[{'all':!![]}];}_0xc1a05c=_[_0xcc78('0x46')]({},_0xc1a05c,_0x305934[_0xcc78('0x48')]);return db[_0xcc78('0x49')]['find'](_0xc1a05c)[_0xcc78('0x29')](handleEntityNotFound(_0x67ad11,null))[_0xcc78('0x29')](respondWithResult(_0x67ad11,null))[_0xcc78('0x4d')](handleError(_0x67ad11,null));};exports[_0xcc78('0x51')]=function(_0x9886e9,_0x4186a7){return db['OpenchannelQueue'][_0xcc78('0x51')](_0x9886e9[_0xcc78('0x52')],{})[_0xcc78('0x29')](function(_0x32fc1b){var _0x1dd0b7=_0x9886e9['user'][_0xcc78('0x2b')]({'plain':!![]});if(!_0x1dd0b7)throw new Error(_0xcc78('0x53'));if(_0x1dd0b7[_0xcc78('0x54')]===_0xcc78('0x55')){var _0x1c0f2b=_0x32fc1b['get']({'plain':!![]});var _0x350714=_0xcc78('0x2c');return db[_0xcc78('0x56')][_0xcc78('0x57')]({'where':{'name':_0x350714,'userProfileId':_0x1dd0b7[_0xcc78('0x58')]},'raw':!![]})[_0xcc78('0x29')](function(_0xd6f560){if(_0xd6f560&&_0xd6f560[_0xcc78('0x59')]===0x0){return db[_0xcc78('0x2d')][_0xcc78('0x51')]({'name':_0x1c0f2b['name'],'resourceId':_0x1c0f2b['id'],'type':_0xd6f560[_0xcc78('0x31')],'sectionId':_0xd6f560['id']},{})[_0xcc78('0x29')](function(){return _0x32fc1b;});}else{return _0x32fc1b;}})[_0xcc78('0x4d')](function(_0x3a154d){logger[_0xcc78('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a154d);throw _0x3a154d;});}return _0x32fc1b;})[_0xcc78('0x29')](respondWithResult(_0x4186a7,0xc9))['catch'](handleError(_0x4186a7,null));};exports['update']=function(_0x6e53e8,_0x430694){if(_0x6e53e8[_0xcc78('0x52')]['id']){delete _0x6e53e8[_0xcc78('0x52')]['id'];}return db[_0xcc78('0x49')][_0xcc78('0x57')]({'where':{'id':_0x6e53e8[_0xcc78('0x4f')]['id']}})['then'](handleEntityNotFound(_0x430694,null))[_0xcc78('0x29')](saveUpdates(_0x6e53e8[_0xcc78('0x52')],null))[_0xcc78('0x29')](respondWithResult(_0x430694,null))[_0xcc78('0x4d')](handleError(_0x430694,null));};exports[_0xcc78('0x2a')]=function(_0x375672,_0x5d16ef){return db['OpenchannelQueue'][_0xcc78('0x57')]({'where':{'id':_0x375672[_0xcc78('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d16ef,null))[_0xcc78('0x29')](removeEntity(_0x5d16ef,null))[_0xcc78('0x4d')](handleError(_0x5d16ef,null));};exports['describe']=function(_0x3e915f,_0x2bd5ac){return db['OpenchannelQueue'][_0xcc78('0x5a')]()[_0xcc78('0x29')](respondWithResult(_0x2bd5ac,null))[_0xcc78('0x4d')](handleError(_0x2bd5ac,null));};exports[_0xcc78('0x5b')]=function(_0x182a75,_0x27b645,_0x423ef0){var _0x2da6ef={'raw':!![],'where':{}},_0x20aed5={},_0x32da5b;return db['OpenchannelQueue'][_0xcc78('0x5c')]({'where':{'id':_0x182a75['params']['id']}})[_0xcc78('0x29')](handleEntityNotFound(_0x27b645,null))[_0xcc78('0x29')](function(_0x153be6){if(_0x153be6){_0x32da5b=_0x153be6['get']({'plain':!![]});_0x20aed5[_0xcc78('0x38')]=_[_0xcc78('0x3a')](db[_0xcc78('0x5d')][_0xcc78('0x50')]);_0x20aed5[_0xcc78('0x39')]=_[_0xcc78('0x3a')](_0x182a75[_0xcc78('0x39')]);_0x20aed5[_0xcc78('0x43')]=_[_0xcc78('0x3b')](_0x20aed5['model'],_0x20aed5[_0xcc78('0x39')]);_0x2da6ef['attributes']=_['intersection'](_0x20aed5[_0xcc78('0x38')],qs['fields'](_0x182a75[_0xcc78('0x39')][_0xcc78('0x3c')]));_0x2da6ef[_0xcc78('0x3d')]=_0x2da6ef[_0xcc78('0x3d')][_0xcc78('0x3e')]?_0x2da6ef['attributes']:_0x20aed5[_0xcc78('0x38')];if(!_0x182a75['query'][_0xcc78('0x5e')](_0xcc78('0x3f'))){_0x2da6ef[_0xcc78('0x22')]=qs[_0xcc78('0x22')](_0x182a75['query'][_0xcc78('0x22')]);_0x2da6ef[_0xcc78('0x24')]=qs[_0xcc78('0x24')](_0x182a75['query'][_0xcc78('0x24')]);}_0x2da6ef[_0xcc78('0x40')]=qs[_0xcc78('0x41')](_0x182a75['query'][_0xcc78('0x41')]);_0x2da6ef[_0xcc78('0x42')]=qs[_0xcc78('0x43')](_[_0xcc78('0x44')](_0x182a75['query'],_0x20aed5['filters']));_0x2da6ef['where']['OpenchannelQueueId']=_0x153be6['id'];if(_0x182a75[_0xcc78('0x39')]['filter']){_0x2da6ef[_0xcc78('0x42')]=_['merge'](_0x2da6ef['where'],{'$or':_[_0xcc78('0x34')](_0x2da6ef[_0xcc78('0x3d')],function(_0xc07461){var _0x2bf215={};_0x2bf215[_0xc07461]={'$like':'%'+_0x182a75[_0xcc78('0x39')][_0xcc78('0x45')]+'%'};return _0x2bf215;})});}_0x2da6ef=_[_0xcc78('0x46')]({},_0x2da6ef,_0x182a75[_0xcc78('0x48')]);return db[_0xcc78('0x5d')][_0xcc78('0x4c')](_0x2da6ef);}})[_0xcc78('0x29')](function(_0x525c53){if(_0x525c53){return db[_0xcc78('0x5f')]['findAndCountAll']({'where':{'id':_['map'](_0x525c53,_0xcc78('0x60')),'role':_0xcc78('0x61')},'attributes':['id','name',_0xcc78('0x62'),'updatedAt',_0xcc78('0x63')]});}})[_0xcc78('0x29')](function(_0x407fb5){if(_0x407fb5){return{'count':_0x407fb5[_0xcc78('0x23')],'rows':_[_0xcc78('0x34')](_0x407fb5[_0xcc78('0x64')],function(_0x57a779){return{'membername':_0x57a779[_0xcc78('0x31')],'UserId':_0x57a779['id'],'queue_name':_0x32da5b['name'],'OpenchannelQueueId':_0x32da5b['id'],'interface':util[_0xcc78('0x65')](_0xcc78('0x66'),_0xcc78('0x67'),_0x57a779[_0xcc78('0x31')]),'penalty':0x0,'paused':_0x57a779[_0xcc78('0x62')],'createdAt':_0x57a779[_0xcc78('0x63')],'updatedAt':_0x57a779[_0xcc78('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcc78('0x29')](respondWithFilteredResult(_0x27b645,_0x2da6ef))[_0xcc78('0x4d')](handleError(_0x27b645,null));};exports[_0xcc78('0x69')]=function(_0x381e30,_0x17a6c2,_0x12fecb){var _0x34cc6e={};var _0x34eea9={};var _0x376648;var _0x4b4137;return db['OpenchannelQueue'][_0xcc78('0x5c')]({'where':{'id':_0x381e30[_0xcc78('0x4f')]['id']}})[_0xcc78('0x29')](handleEntityNotFound(_0x17a6c2,null))[_0xcc78('0x29')](function(_0x435ed4){if(_0x435ed4){_0x376648=_0x435ed4;_0x34eea9['model']=_[_0xcc78('0x3a')](db[_0xcc78('0x6a')][_0xcc78('0x50')]);_0x34eea9['query']=_[_0xcc78('0x3a')](_0x381e30[_0xcc78('0x39')]);_0x34eea9[_0xcc78('0x43')]=_[_0xcc78('0x3b')](_0x34eea9['model'],_0x34eea9[_0xcc78('0x39')]);_0x34cc6e['attributes']=_['intersection'](_0x34eea9[_0xcc78('0x38')],qs['fields'](_0x381e30['query'][_0xcc78('0x3c')]));_0x34cc6e[_0xcc78('0x3d')]=_0x34cc6e[_0xcc78('0x3d')][_0xcc78('0x3e')]?_0x34cc6e[_0xcc78('0x3d')]:_0x34eea9[_0xcc78('0x38')];_0x34cc6e[_0xcc78('0x40')]=qs['sort'](_0x381e30[_0xcc78('0x39')][_0xcc78('0x41')]);_0x34cc6e[_0xcc78('0x42')]=qs[_0xcc78('0x43')](_['pick'](_0x381e30[_0xcc78('0x39')],_0x34eea9[_0xcc78('0x43')]));if(_0x381e30['query'][_0xcc78('0x45')]){_0x34cc6e[_0xcc78('0x42')]=_[_0xcc78('0x46')](_0x34cc6e[_0xcc78('0x42')],{'$or':_[_0xcc78('0x34')](_0x34cc6e['attributes'],function(_0xb9aeb1){var _0x93bdb0={};_0x93bdb0[_0xb9aeb1]={'$like':'%'+_0x381e30[_0xcc78('0x39')][_0xcc78('0x45')]+'%'};return _0x93bdb0;})});}_0x34cc6e=_[_0xcc78('0x46')]({},_0x34cc6e,_0x381e30[_0xcc78('0x48')]);return _0x376648['getTeams'](_0x34cc6e);}})['then'](function(_0x1164e2){if(_0x1164e2){_0x4b4137=_0x1164e2[_0xcc78('0x3e')];if(!_0x381e30[_0xcc78('0x39')][_0xcc78('0x5e')](_0xcc78('0x3f'))){_0x34cc6e[_0xcc78('0x22')]=qs[_0xcc78('0x22')](_0x381e30['query'][_0xcc78('0x22')]);_0x34cc6e[_0xcc78('0x24')]=qs[_0xcc78('0x24')](_0x381e30[_0xcc78('0x39')][_0xcc78('0x24')]);}return _0x376648[_0xcc78('0x69')](_0x34cc6e);}})[_0xcc78('0x29')](function(_0x22574f){if(_0x22574f){return _0x22574f?{'count':_0x4b4137,'rows':_0x22574f}:null;}})[_0xcc78('0x29')](respondWithResult(_0x17a6c2,null))[_0xcc78('0x4d')](handleError(_0x17a6c2,null));};exports['addTeams']=function(_0x2dfeca,_0x5a92a2,_0x3dc477){var _0x8381cd=_0x2dfeca[_0xcc78('0x52')][_0xcc78('0x6b')];return db[_0xcc78('0x6a')]['findAll']({'where':{'id':_0x8381cd},'attributes':['id'],'include':[{'model':db[_0xcc78('0x5f')],'as':_0xcc78('0x6c'),'attributes':['id','name',_0xcc78('0x6d'),_0xcc78('0x6e'),_0xcc78('0x6f')],'raw':!![]}]})[_0xcc78('0x29')](function(_0x160b9a){if(_0x160b9a){var _0x6155f9=_[_0xcc78('0x70')](_0x160b9a,function(_0x1343c3){var _0x59f14b=_0x1343c3[_0xcc78('0x2b')]({'plain':!![]});return _0x59f14b[_0xcc78('0x6c')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x2dfeca[_0xcc78('0x4f')]['id']}})[_0xcc78('0x29')](function(_0x4897da){return db['sequelize']['transaction'](function(_0x51fc5f){return _0x4897da['addTeams'](_0x8381cd,{'transaction':_0x51fc5f})[_0xcc78('0x29')](function(){return BPromise['each'](_0x6155f9,function(_0x33d5e7){return db[_0xcc78('0x5d')]['findOrCreate']({'where':{'UserId':_0x33d5e7['id'],'OpenchannelQueueId':_0x2dfeca['params']['id']},'transaction':_0x51fc5f});});})['then'](function(){_0x6155f9[_0xcc78('0x71')](function(_0x33aa44){socket[_0xcc78('0x72')](_0xcc78('0x73'),{'UserId':_0x33aa44['id'],'OpenchannelQueueId':_0x4897da['id']});});});});});}})[_0xcc78('0x29')](respondWithStatusCode(_0x5a92a2,null))[_0xcc78('0x4d')](handleError(_0x5a92a2,null));};exports['removeTeams']=function(_0x127cf8,_0x78036b,_0x3dd379){return db[_0xcc78('0x6a')][_0xcc78('0x4c')]({'where':{'id':_0x127cf8['query'][_0xcc78('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xcc78('0x5f')],'as':_0xcc78('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x78036b,null))[_0xcc78('0x29')](function(_0x3d68fe){var _0x4f5712=_[_0xcc78('0x34')](_0x3d68fe,'id');var _0x523610=[];var _0x4b6e44=[];var _0x263472=squel[_0xcc78('0x74')]();_0x263472[_0xcc78('0x75')](_0xcc78('0x76'))[_0xcc78('0x77')](_0xcc78('0x78'),'tq')['join'](_0xcc78('0x79'),'ut',_0xcc78('0x7a'))[_0xcc78('0x42')](_0xcc78('0x7b'),_0x127cf8[_0xcc78('0x4f')]['id']);for(var _0x4909f8=0x0;_0x4909f8<_0x3d68fe[_0xcc78('0x3e')];_0x4909f8+=0x1){let _0x5df8d3=_0x3d68fe[_0x4909f8];for(var _0x449026=0x0;_0x449026<_0x5df8d3[_0xcc78('0x6c')][_0xcc78('0x3e')];_0x449026+=0x1){let _0x208474=_0x5df8d3[_0xcc78('0x6c')][_0x449026];var _0x5a6831=_0x263472[_0xcc78('0x7c')]();_0x5a6831[_0xcc78('0x42')](_0xcc78('0x7d'),_0x208474['id']);_0x4b6e44['push'](db[_0xcc78('0x7e')][_0xcc78('0x39')](_0x5a6831[_0xcc78('0x7f')](),{'type':db['sequelize'][_0xcc78('0x80')][_0xcc78('0x81')]})[_0xcc78('0x29')](function(_0x23a241){if(_0x23a241['length']===0x1){return _0x208474['id'];}else{var _0x43bc8c=_[_0xcc78('0x82')](_[_0xcc78('0x34')](_0x23a241,_0xcc78('0x83')),function(_0x48447d){return _[_0xcc78('0x84')](_0x4f5712,_0x48447d);});if(_0x43bc8c){return _0x208474['id'];}}}));}}return BPromise[_0xcc78('0x85')](_0x4b6e44)[_0xcc78('0x29')](function(_0x324332){_0x523610=_(_0x523610)[_0xcc78('0x86')](_0x324332)[_0xcc78('0x87')]()[_0xcc78('0x88')]();return db['OpenchannelQueue'][_0xcc78('0x57')]({'where':{'id':_0x127cf8[_0xcc78('0x4f')]['id']}})['then'](function(_0x3ae7bc){return db[_0xcc78('0x7e')][_0xcc78('0x89')](function(_0x517b60){return _0x3ae7bc[_0xcc78('0x8a')](_0x127cf8[_0xcc78('0x39')]['ids'],{'transaction':_0x517b60})['then'](function(){if(!_[_0xcc78('0x8b')](_0x523610)){return _0x3ae7bc[_0xcc78('0x8c')](_0x523610,{'transaction':_0x517b60});}})[_0xcc78('0x29')](function(){_0x523610[_0xcc78('0x71')](function(_0x39e707){socket[_0xcc78('0x72')]('userOpenchannelQueue:remove',{'UserId':_0x39e707,'OpenchannelQueueId':_0x3ae7bc['id']});});});});});});})['then'](respondWithStatusCode(_0x78036b,null))[_0xcc78('0x4d')](handleError(_0x78036b,null));};exports['addAgents']=function(_0x37d958,_0x5780c,_0x486f94){return db[_0xcc78('0x49')][_0xcc78('0x57')]({'where':{'id':_0x37d958[_0xcc78('0x4f')]['id']}})[_0xcc78('0x29')](handleEntityNotFound(_0x5780c,null))[_0xcc78('0x29')](function(_0x4305d2){if(_0x4305d2){return _0x4305d2[_0xcc78('0x8d')](_0x37d958[_0xcc78('0x52')]['ids'],_[_0xcc78('0x8e')](_0x37d958['body'],[_0xcc78('0x6b'),'id'])||{})['spread'](function(_0x3c3555){for(var _0x3aa98c=0x0;_0x3aa98c<_0x37d958[_0xcc78('0x52')][_0xcc78('0x6b')][_0xcc78('0x3e')];_0x3aa98c+=0x1){socket[_0xcc78('0x72')](_0xcc78('0x73'),{'UserId':Number(_0x37d958['body'][_0xcc78('0x6b')][_0x3aa98c]),'OpenchannelQueueId':Number(_0x37d958['params']['id'])});}return _0x3c3555;});}})[_0xcc78('0x29')](respondWithResult(_0x5780c,null))[_0xcc78('0x4d')](handleError(_0x5780c,null));};exports['removeAgents']=function(_0x53d5f8,_0x5330d5,_0x126fc0){return db[_0xcc78('0x49')][_0xcc78('0x57')]({'where':{'id':_0x53d5f8[_0xcc78('0x4f')]['id']}})[_0xcc78('0x29')](handleEntityNotFound(_0x5330d5,null))[_0xcc78('0x29')](function(_0x2a54e7){if(_0x2a54e7){return _0x2a54e7[_0xcc78('0x8c')](_0x53d5f8[_0xcc78('0x39')][_0xcc78('0x6b')])[_0xcc78('0x29')](function(){if(_[_0xcc78('0x8f')](_0x53d5f8[_0xcc78('0x39')][_0xcc78('0x6b')])){for(var _0x355152=0x0;_0x355152<_0x53d5f8[_0xcc78('0x39')][_0xcc78('0x6b')][_0xcc78('0x3e')];_0x355152+=0x1){socket[_0xcc78('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x53d5f8['query']['ids'][_0x355152]),'OpenchannelQueueId':Number(_0x53d5f8[_0xcc78('0x4f')]['id'])});}}else{socket[_0xcc78('0x72')](_0xcc78('0x90'),{'UserId':Number(_0x53d5f8['query']['ids']),'OpenchannelQueueId':Number(_0x53d5f8[_0xcc78('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x5330d5,null))['catch'](handleError(_0x5330d5,null));};exports['getAgents']=function(_0xb5aba2,_0x4424dd,_0xf1eafe){var _0x9d2d8e={};var _0x2f92fa={};var _0x1c8391;var _0x4d4c53;return db[_0xcc78('0x49')]['findOne']({'where':{'id':_0xb5aba2[_0xcc78('0x4f')]['id']}})[_0xcc78('0x29')](handleEntityNotFound(_0x4424dd,null))[_0xcc78('0x29')](function(_0x571ec9){if(_0x571ec9){_0x1c8391=_0x571ec9;_0x2f92fa['model']=_['keys'](db['User'][_0xcc78('0x50')]);_0x2f92fa[_0xcc78('0x39')]=_[_0xcc78('0x3a')](_0xb5aba2[_0xcc78('0x39')]);_0x2f92fa[_0xcc78('0x43')]=_[_0xcc78('0x3b')](_0x2f92fa[_0xcc78('0x38')],_0x2f92fa[_0xcc78('0x39')]);_0x9d2d8e[_0xcc78('0x3d')]=_['intersection'](_0x2f92fa['model'],qs['fields'](_0xb5aba2['query'][_0xcc78('0x3c')]));_0x9d2d8e[_0xcc78('0x3d')]=_0x9d2d8e[_0xcc78('0x3d')][_0xcc78('0x3e')]?_0x9d2d8e[_0xcc78('0x3d')]:_0x2f92fa[_0xcc78('0x38')];_0x9d2d8e['order']=qs[_0xcc78('0x41')](_0xb5aba2[_0xcc78('0x39')]['sort']);_0x9d2d8e[_0xcc78('0x42')]=qs['filters'](_[_0xcc78('0x44')](_0xb5aba2[_0xcc78('0x39')],_0x2f92fa[_0xcc78('0x43')]));if(_0xb5aba2[_0xcc78('0x39')][_0xcc78('0x45')]){_0x9d2d8e[_0xcc78('0x42')]=_[_0xcc78('0x46')](_0x9d2d8e[_0xcc78('0x42')],{'$or':_[_0xcc78('0x34')](_0x9d2d8e['attributes'],function(_0x4de2fa){var _0x56b756={};_0x56b756[_0x4de2fa]={'$like':'%'+_0xb5aba2[_0xcc78('0x39')]['filter']+'%'};return _0x56b756;})});}_0x9d2d8e=_['merge']({},_0x9d2d8e,_0xb5aba2[_0xcc78('0x48')]);return _0x1c8391[_0xcc78('0x91')](_0x9d2d8e);}})[_0xcc78('0x29')](function(_0x4c8974){if(_0x4c8974){_0x4d4c53=_0x4c8974[_0xcc78('0x3e')];if(!_0xb5aba2[_0xcc78('0x39')][_0xcc78('0x5e')](_0xcc78('0x3f'))){_0x9d2d8e[_0xcc78('0x22')]=qs[_0xcc78('0x22')](_0xb5aba2[_0xcc78('0x39')][_0xcc78('0x22')]);_0x9d2d8e[_0xcc78('0x24')]=qs['offset'](_0xb5aba2['query'][_0xcc78('0x24')]);}return _0x1c8391[_0xcc78('0x91')](_0x9d2d8e);}})['then'](function(_0x4b0104){if(_0x4b0104){return _0x4b0104?{'count':_0x4d4c53,'rows':_0x4b0104}:null;}})['then'](respondWithResult(_0x4424dd,null))[_0xcc78('0x4d')](handleError(_0x4424dd,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 498cb29..e23c393 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 _0x5ffe=['remove','emit','hasOwnProperty','exports','events','OpenchannelQueue','update'];(function(_0x337c64,_0x481924){var _0x4b0b1a=function(_0x4a840f){while(--_0x4a840f){_0x337c64['push'](_0x337c64['shift']());}};_0x4b0b1a(++_0x481924);}(_0x5ffe,0x1cb));var _0xe5ff=function(_0x824626,_0x590cd4){_0x824626=_0x824626-0x0;var _0x7247cb=_0x5ffe[_0x824626];return _0x7247cb;};'use strict';var EventEmitter=require(_0xe5ff('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xe5ff('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe5ff('0x2'),'afterDestroy':_0xe5ff('0x3')};function emitEvent(_0x3b0a46){return function(_0x4d47f6,_0x427f44,_0x14c2f3){OpenchannelQueueEvents[_0xe5ff('0x4')](_0x3b0a46+':'+_0x4d47f6['id'],_0x4d47f6);OpenchannelQueueEvents[_0xe5ff('0x4')](_0x3b0a46,_0x4d47f6);_0x14c2f3(null);};}for(var e in events){if(events[_0xe5ff('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xe5ff('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7d73=['hasOwnProperty','events','../../mysqldb','OpenchannelQueue','remove','emit'];(function(_0x3aa09e,_0x1fefb8){var _0x1fba0b=function(_0x4f484e){while(--_0x4f484e){_0x3aa09e['push'](_0x3aa09e['shift']());}};_0x1fba0b(++_0x1fefb8);}(_0x7d73,0xfd));var _0x37d7=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x7d73[_0x20589d];return _0x422de9;};'use strict';var EventEmitter=require(_0x37d7('0x0'));var OpenchannelQueue=require(_0x37d7('0x1'))['db'][_0x37d7('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x37d7('0x3')};function emitEvent(_0x4776ee){return function(_0x44f144,_0x42abb8,_0x2bd76e){OpenchannelQueueEvents[_0x37d7('0x4')](_0x4776ee+':'+_0x44f144['id'],_0x44f144);OpenchannelQueueEvents['emit'](_0x4776ee,_0x44f144);_0x2bd76e(null);};}for(var e in events){if(events[_0x37d7('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 24d9793..bb4e2ff 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 _0xdc8a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelQueue','openchannel_queues','util','api'];(function(_0x26d398,_0x22f9b0){var _0x3e65f2=function(_0x20c15f){while(--_0x20c15f){_0x26d398['push'](_0x26d398['shift']());}};_0x3e65f2(++_0x22f9b0);}(_0xdc8a,0x132));var _0xadc8=function(_0xc03bed,_0x3fa4d5){_0xc03bed=_0xc03bed-0x0;var _0x4e063d=_0xdc8a[_0xc03bed];return _0x4e063d;};'use strict';var _=require('lodash');var util=require(_0xadc8('0x0'));var logger=require('../../config/logger')(_0xadc8('0x1'));var moment=require(_0xadc8('0x2'));var BPromise=require(_0xadc8('0x3'));var rp=require(_0xadc8('0x4'));var fs=require('fs');var path=require(_0xadc8('0x5'));var rimraf=require(_0xadc8('0x6'));var config=require(_0xadc8('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x35e5c1,_0x29acba){return _0x35e5c1[_0xadc8('0x8')](_0xadc8('0x9'),attributes,{'tableName':_0xadc8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22a1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','openchannel_queues','lodash','util','../../config/logger'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x22a1,0x183));var _0x122a=function(_0x325f4d,_0x35b6a8){_0x325f4d=_0x325f4d-0x0;var _0x58aaed=_0x22a1[_0x325f4d];return _0x58aaed;};'use strict';var _=require(_0x122a('0x0'));var util=require(_0x122a('0x1'));var logger=require(_0x122a('0x2'))(_0x122a('0x3'));var moment=require(_0x122a('0x4'));var BPromise=require(_0x122a('0x5'));var rp=require(_0x122a('0x6'));var fs=require('fs');var path=require(_0x122a('0x7'));var rimraf=require(_0x122a('0x8'));var config=require(_0x122a('0x9'));var attributes=require(_0x122a('0xa'));module[_0x122a('0xb')]=function(_0x517787,_0x544841){return _0x517787['define']('OpenchannelQueue',attributes,{'tableName':_0x122a('0xc'),'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 45a0cac..def2920 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 _0x933a=['./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','debug','stringify','ShowOpenchannelQueue','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x933a,0xb2));var _0xa933=function(_0x1fe355,_0xe414c){_0x1fe355=_0x1fe355-0x0;var _0x325d30=_0x933a[_0x1fe355];return _0x325d30;};'use strict';var _=require(_0xa933('0x0'));var util=require('util');var moment=require(_0xa933('0x1'));var BPromise=require(_0xa933('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa933('0x3'));var db=require(_0xa933('0x4'))['db'];var utils=require(_0xa933('0x5'));var logger=require(_0xa933('0x6'))(_0xa933('0x7'));var config=require(_0xa933('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa933('0x9')]['http']({'port':0x232a});config[_0xa933('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa933('0xb'))(new Redis(config[_0xa933('0xa')]));require(_0xa933('0xc'))[_0xa933('0xd')](socket);function respondWithRpcPromise(_0x4ffbe3,_0x255324,_0x2a43e3){return new BPromise(function(_0xa95de8,_0x4ce125){return client[_0xa933('0xe')](_0x4ffbe3,_0x2a43e3)[_0xa933('0xf')](function(_0x4f6b1c){logger['info'](_0xa933('0x10'),_0x255324,_0xa933('0x11'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x255324,_0xa933('0x11'),JSON['stringify'](_0x4f6b1c));if(_0x4f6b1c[_0xa933('0x12')]){if(_0x4f6b1c['error'][_0xa933('0x13')]===0x1f4){logger[_0xa933('0x12')](_0xa933('0x10'),_0x255324,_0x4f6b1c[_0xa933('0x12')][_0xa933('0x14')]);return _0x4ce125(_0x4f6b1c[_0xa933('0x12')][_0xa933('0x14')]);}logger[_0xa933('0x12')](_0xa933('0x10'),_0x255324,_0x4f6b1c['error'][_0xa933('0x14')]);return _0xa95de8(_0x4f6b1c['error'][_0xa933('0x14')]);}else{logger[_0xa933('0x15')](_0xa933('0x10'),_0x255324,_0xa933('0x11'));_0xa95de8(_0x4f6b1c['result'][_0xa933('0x14')]);}})[_0xa933('0x16')](function(_0x4423cb){logger[_0xa933('0x12')](_0xa933('0x10'),_0x255324,_0x4423cb);_0x4ce125(_0x4423cb);});});}exports[_0xa933('0x17')]=function(_0x21f87b){var _0x57dcd=this;return new Promise(function(_0x33a68f,_0x139092){return db[_0xa933('0x18')][_0xa933('0x19')]({'raw':_0x21f87b['options']?_0x21f87b[_0xa933('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x21f87b['options']?_0x21f87b['options'][_0xa933('0x1b')]||null:null,'attributes':_0x21f87b[_0xa933('0x1a')]?_0x21f87b[_0xa933('0x1a')][_0xa933('0x1c')]||null:null,'limit':_0x21f87b['options']?_0x21f87b['options'][_0xa933('0x1d')]||null:null,'include':_0x21f87b[_0xa933('0x1a')]?_0x21f87b['options'][_0xa933('0x1e')]?_[_0xa933('0x1f')](_0x21f87b[_0xa933('0x1a')][_0xa933('0x1e')],function(_0x5b5854){return{'model':db[_0x5b5854[_0xa933('0x20')]],'as':_0x5b5854['as'],'attributes':_0x5b5854[_0xa933('0x1c')],'include':_0x5b5854['include']?_['map'](_0x5b5854[_0xa933('0x1e')],function(_0x5d64aa){return{'model':db[_0x5d64aa['model']],'as':_0x5d64aa['as'],'attributes':_0x5d64aa[_0xa933('0x1c')],'include':_0x5d64aa[_0xa933('0x1e')]?_[_0xa933('0x1f')](_0x5d64aa[_0xa933('0x1e')],function(_0x1017cc){return{'model':db[_0x1017cc[_0xa933('0x20')]],'as':_0x1017cc['as'],'attributes':_0x1017cc[_0xa933('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa933('0xf')](function(_0x551291){logger[_0xa933('0x15')](_0xa933('0x17'),_0x21f87b);logger[_0xa933('0x21')](_0xa933('0x17'),_0x21f87b,JSON[_0xa933('0x22')](_0x551291));_0x33a68f(_0x551291);})['catch'](function(_0x34582c){logger[_0xa933('0x12')](_0xa933('0x17'),_0x34582c[_0xa933('0x14')],_0x21f87b);_0x139092(_0x57dcd[_0xa933('0x12')](0x1f4,_0x34582c['message']));});});};exports[_0xa933('0x23')]=function(_0x2d60f8){var _0x522c71=this;return new Promise(function(_0x2eae04,_0x56caea){return db[_0xa933('0x18')][_0xa933('0x24')]({'raw':_0x2d60f8[_0xa933('0x1a')]?_0x2d60f8[_0xa933('0x1a')][_0xa933('0x25')]===undefined?!![]:![]:!![],'where':_0x2d60f8[_0xa933('0x1a')]?_0x2d60f8[_0xa933('0x1a')]['where']||null:null,'attributes':_0x2d60f8['options']?_0x2d60f8[_0xa933('0x1a')]['attributes']||null:null,'include':_0x2d60f8['options']?_0x2d60f8['options'][_0xa933('0x1e')]?_['map'](_0x2d60f8[_0xa933('0x1a')]['include'],function(_0x357f02){return{'model':db[_0x357f02[_0xa933('0x20')]],'as':_0x357f02['as'],'attributes':_0x357f02[_0xa933('0x1c')],'include':_0x357f02['include']?_[_0xa933('0x1f')](_0x357f02[_0xa933('0x1e')],function(_0x5cf651){return{'model':db[_0x5cf651[_0xa933('0x20')]],'as':_0x5cf651['as'],'attributes':_0x5cf651[_0xa933('0x1c')],'include':_0x5cf651[_0xa933('0x1e')]?_[_0xa933('0x1f')](_0x5cf651[_0xa933('0x1e')],function(_0x10eeb5){return{'model':db[_0x10eeb5[_0xa933('0x20')]],'as':_0x10eeb5['as'],'attributes':_0x10eeb5[_0xa933('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e30df){logger[_0xa933('0x15')](_0xa933('0x23'),_0x2d60f8);logger[_0xa933('0x21')](_0xa933('0x23'),_0x2d60f8,JSON[_0xa933('0x22')](_0x1e30df));_0x2eae04(_0x1e30df);})[_0xa933('0x16')](function(_0x5328f5){logger[_0xa933('0x12')](_0xa933('0x23'),_0x5328f5[_0xa933('0x14')],_0x2d60f8);_0x56caea(_0x522c71[_0xa933('0x12')](0x1f4,_0x5328f5[_0xa933('0x14')]));});});}; \ No newline at end of file +var _0x784f=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','include','model','map','stringify','find','then','ShowOpenchannelQueue','catch','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x895358,_0x32f914){var _0x26e26e=function(_0xf2da4a){while(--_0xf2da4a){_0x895358['push'](_0x895358['shift']());}};_0x26e26e(++_0x32f914);}(_0x784f,0xeb));var _0xf784=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x784f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf784('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf784('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xf784('0x2'));var logger=require(_0xf784('0x3'))('rpc');var config=require(_0xf784('0x4'));var jayson=require(_0xf784('0x5'));var client=jayson[_0xf784('0x6')][_0xf784('0x7')]({'port':0x232a});config[_0xf784('0x8')]=_[_0xf784('0x9')](config[_0xf784('0x8')],{'host':_0xf784('0xa'),'port':0x18eb});var socket=require(_0xf784('0xb'))(new Redis(config[_0xf784('0x8')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x55daad,_0x526050,_0x204026){return new BPromise(function(_0x1c9ab5,_0x13978a){return client[_0xf784('0xc')](_0x55daad,_0x204026)['then'](function(_0x1485d1){logger[_0xf784('0xd')](_0xf784('0xe'),_0x526050,_0xf784('0xf'));logger[_0xf784('0x10')](_0xf784('0x11'),_0x526050,_0xf784('0xf'),JSON['stringify'](_0x1485d1));if(_0x1485d1[_0xf784('0x12')]){if(_0x1485d1[_0xf784('0x12')][_0xf784('0x13')]===0x1f4){logger[_0xf784('0x12')](_0xf784('0xe'),_0x526050,_0x1485d1[_0xf784('0x12')][_0xf784('0x14')]);return _0x13978a(_0x1485d1[_0xf784('0x12')]['message']);}logger[_0xf784('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x526050,_0x1485d1[_0xf784('0x12')][_0xf784('0x14')]);return _0x1c9ab5(_0x1485d1[_0xf784('0x12')][_0xf784('0x14')]);}else{logger[_0xf784('0xd')](_0xf784('0xe'),_0x526050,'request\x20sent');_0x1c9ab5(_0x1485d1[_0xf784('0x15')][_0xf784('0x14')]);}})['catch'](function(_0x227300){logger['error'](_0xf784('0xe'),_0x526050,_0x227300);_0x13978a(_0x227300);});});}exports[_0xf784('0x16')]=function(_0x5bee17){var _0x36f4b0=this;return new Promise(function(_0x513c89,_0x4840bc){return db[_0xf784('0x17')]['findAll']({'raw':_0x5bee17[_0xf784('0x18')]?_0x5bee17['options'][_0xf784('0x19')]===undefined?!![]:![]:!![],'where':_0x5bee17[_0xf784('0x18')]?_0x5bee17[_0xf784('0x18')][_0xf784('0x1a')]||null:null,'attributes':_0x5bee17[_0xf784('0x18')]?_0x5bee17[_0xf784('0x18')][_0xf784('0x1b')]||null:null,'limit':_0x5bee17['options']?_0x5bee17[_0xf784('0x18')]['limit']||null:null,'include':_0x5bee17[_0xf784('0x18')]?_0x5bee17['options'][_0xf784('0x1c')]?_['map'](_0x5bee17[_0xf784('0x18')][_0xf784('0x1c')],function(_0x29ef5f){return{'model':db[_0x29ef5f[_0xf784('0x1d')]],'as':_0x29ef5f['as'],'attributes':_0x29ef5f[_0xf784('0x1b')],'include':_0x29ef5f['include']?_[_0xf784('0x1e')](_0x29ef5f[_0xf784('0x1c')],function(_0x55e317){return{'model':db[_0x55e317[_0xf784('0x1d')]],'as':_0x55e317['as'],'attributes':_0x55e317[_0xf784('0x1b')],'include':_0x55e317[_0xf784('0x1c')]?_['map'](_0x55e317[_0xf784('0x1c')],function(_0x59f950){return{'model':db[_0x59f950['model']],'as':_0x59f950['as'],'attributes':_0x59f950['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4102dd){logger[_0xf784('0xd')](_0xf784('0x16'),_0x5bee17);logger[_0xf784('0x10')](_0xf784('0x16'),_0x5bee17,JSON[_0xf784('0x1f')](_0x4102dd));_0x513c89(_0x4102dd);})['catch'](function(_0x23c30e){logger[_0xf784('0x12')](_0xf784('0x16'),_0x23c30e[_0xf784('0x14')],_0x5bee17);_0x4840bc(_0x36f4b0[_0xf784('0x12')](0x1f4,_0x23c30e[_0xf784('0x14')]));});});};exports['ShowOpenchannelQueue']=function(_0x3f0815){var _0x1bb777=this;return new Promise(function(_0x47508f,_0x44e8d9){return db[_0xf784('0x17')][_0xf784('0x20')]({'raw':_0x3f0815[_0xf784('0x18')]?_0x3f0815[_0xf784('0x18')][_0xf784('0x19')]===undefined?!![]:![]:!![],'where':_0x3f0815[_0xf784('0x18')]?_0x3f0815[_0xf784('0x18')][_0xf784('0x1a')]||null:null,'attributes':_0x3f0815[_0xf784('0x18')]?_0x3f0815[_0xf784('0x18')]['attributes']||null:null,'include':_0x3f0815[_0xf784('0x18')]?_0x3f0815[_0xf784('0x18')][_0xf784('0x1c')]?_[_0xf784('0x1e')](_0x3f0815[_0xf784('0x18')][_0xf784('0x1c')],function(_0xbddb37){return{'model':db[_0xbddb37['model']],'as':_0xbddb37['as'],'attributes':_0xbddb37[_0xf784('0x1b')],'include':_0xbddb37[_0xf784('0x1c')]?_[_0xf784('0x1e')](_0xbddb37[_0xf784('0x1c')],function(_0x2bf150){return{'model':db[_0x2bf150['model']],'as':_0x2bf150['as'],'attributes':_0x2bf150[_0xf784('0x1b')],'include':_0x2bf150[_0xf784('0x1c')]?_['map'](_0x2bf150['include'],function(_0x4ba334){return{'model':db[_0x4ba334[_0xf784('0x1d')]],'as':_0x4ba334['as'],'attributes':_0x4ba334[_0xf784('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf784('0x21')](function(_0x2b557d){logger[_0xf784('0xd')]('ShowOpenchannelQueue',_0x3f0815);logger[_0xf784('0x10')](_0xf784('0x22'),_0x3f0815,JSON['stringify'](_0x2b557d));_0x47508f(_0x2b557d);})[_0xf784('0x23')](function(_0x51b2f6){logger[_0xf784('0x12')](_0xf784('0x22'),_0x51b2f6['message'],_0x3f0815);_0x44e8d9(_0x1bb777[_0xf784('0x12')](0x1f4,_0x51b2f6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d7f1aea..51f7300 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 _0x3ed4=['remove','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x283084,_0x37cb84){var _0x15ebc8=function(_0xc55605){while(--_0xc55605){_0x283084['push'](_0x283084['shift']());}};_0x15ebc8(++_0x37cb84);}(_0x3ed4,0xc5));var _0x43ed=function(_0x4d43ee,_0x55edfe){_0x4d43ee=_0x4d43ee-0x0;var _0x233903=_0x3ed4[_0x4d43ee];return _0x233903;};'use strict';var OpenchannelQueueEvents=require(_0x43ed('0x0'));var events=['save',_0x43ed('0x1'),'update'];function createListener(_0xc44379,_0x3a0d6c){return function(_0x365ab1){_0x3a0d6c[_0x43ed('0x2')](_0xc44379,_0x365ab1);};}function removeListener(_0x1bd649,_0x444e94){return function(){OpenchannelQueueEvents[_0x43ed('0x3')](_0x1bd649,_0x444e94);};}exports['register']=function(_0x3872f6){for(var _0x3b6a06=0x0,_0x5e5ccb=events[_0x43ed('0x4')];_0x3b6a06<_0x5e5ccb;_0x3b6a06++){var _0x43a7f3=events[_0x3b6a06];var _0x1f2171=createListener(_0x43ed('0x5')+_0x43a7f3,_0x3872f6);OpenchannelQueueEvents['on'](_0x43a7f3,_0x1f2171);}}; \ No newline at end of file +var _0x42f3=['register','openchannelQueue:','update','emit','removeListener'];(function(_0x2aa61b,_0x303995){var _0x134e19=function(_0x2be3da){while(--_0x2be3da){_0x2aa61b['push'](_0x2aa61b['shift']());}};_0x134e19(++_0x303995);}(_0x42f3,0x10b));var _0x342f=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x42f3[_0x333fc8];return _0x432439;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0x342f('0x0')];function createListener(_0xf034d,_0x20bc1d){return function(_0x33db48){_0x20bc1d[_0x342f('0x1')](_0xf034d,_0x33db48);};}function removeListener(_0x43c98f,_0x154508){return function(){OpenchannelQueueEvents[_0x342f('0x2')](_0x43c98f,_0x154508);};}exports[_0x342f('0x3')]=function(_0x1273a7){for(var _0xa175cc=0x0,_0x2653bd=events['length'];_0xa175cc<_0x2653bd;_0xa175cc++){var _0x4846af=events[_0xa175cc];var _0x13b67c=createListener(_0x342f('0x4')+_0x4846af,_0x1273a7);OpenchannelQueueEvents['on'](_0x4846af,_0x13b67c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 9c279ef..46bde91 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 _0xb98f=['connect-timeout','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','show','post','put','delete','/:id','destroy','multer','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb98f,0x8a));var _0xfb98=function(_0x458789,_0x575547){_0x458789=_0x458789-0x0;var _0x330fb3=_0xb98f[_0x458789];return _0x330fb3;};'use strict';var multer=require(_0xfb98('0x0'));var util=require('util');var path=require(_0xfb98('0x1'));var timeout=require(_0xfb98('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfb98('0x3'));router[_0xfb98('0x4')]('/',auth['isAuthenticated'](),controller[_0xfb98('0x5')]);router[_0xfb98('0x4')](_0xfb98('0x6'),auth[_0xfb98('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfb98('0x8')]);router[_0xfb98('0x9')]('/',auth[_0xfb98('0x7')](),controller['create']);router[_0xfb98('0xa')]('/:id',auth[_0xfb98('0x7')](),controller['update']);router[_0xfb98('0xb')](_0xfb98('0xc'),auth[_0xfb98('0x7')](),controller[_0xfb98('0xd')]);module['exports']=router; \ No newline at end of file +var _0x8910=['fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','Router'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8910,0x1f0));var _0x0891=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x8910[_0x34b821];return _0x5e00a0;};'use strict';var multer=require(_0x0891('0x0'));var util=require('util');var path=require(_0x0891('0x1'));var timeout=require(_0x0891('0x2'));var express=require('express');var router=express[_0x0891('0x3')]();var fs_extra=require(_0x0891('0x4'));var auth=require(_0x0891('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0891('0x6'));var controller=require(_0x0891('0x7'));router[_0x0891('0x8')]('/',auth[_0x0891('0x9')](),controller[_0x0891('0xa')]);router[_0x0891('0x8')](_0x0891('0xb'),auth[_0x0891('0x9')](),controller[_0x0891('0xc')]);router['get'](_0x0891('0xd'),auth[_0x0891('0x9')](),controller[_0x0891('0xe')]);router[_0x0891('0xf')]('/',auth[_0x0891('0x9')](),controller[_0x0891('0x10')]);router[_0x0891('0x11')](_0x0891('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0891('0x12')](_0x0891('0xd'),auth[_0x0891('0x9')](),controller[_0x0891('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 49105ef..9082d14 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 _0xa789=['DATE','moment','sequelize','exports','STRING'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0xa789,0x8d));var _0x9a78=function(_0x558fae,_0x41d064){_0x558fae=_0x558fae-0x0;var _0x44713d=_0xa789[_0x558fae];return _0x44713d;};'use strict';var moment=require(_0x9a78('0x0'));var Sequelize=require(_0x9a78('0x1'));module[_0x9a78('0x2')]={'uniqueid':{'type':Sequelize[_0x9a78('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9a78('0x3')]},'joinAt':{'type':Sequelize[_0x9a78('0x4')]},'leaveAt':{'type':Sequelize[_0x9a78('0x4')]},'acceptAt':{'type':Sequelize[_0x9a78('0x4')]},'exitAt':{'type':Sequelize[_0x9a78('0x4')]},'reason':{'type':Sequelize[_0x9a78('0x3')]}}; \ No newline at end of file +var _0xb7b6=['sequelize','STRING','DATE','moment'];(function(_0x523e16,_0x14735a){var _0xbf021a=function(_0x4a3646){while(--_0x4a3646){_0x523e16['push'](_0x523e16['shift']());}};_0xbf021a(++_0x14735a);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x74291f,_0x5ba54f){_0x74291f=_0x74291f-0x0;var _0x323254=_0xb7b6[_0x74291f];return _0x323254;};'use strict';var moment=require(_0x6b7b('0x0'));var Sequelize=require(_0x6b7b('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6b7b('0x2')]},'joinAt':{'type':Sequelize[_0x6b7b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6b7b('0x3')]},'exitAt':{'type':Sequelize[_0x6b7b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2a054b8..ec2b525 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 _0x70c8=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x70c8,0x1ab));var _0x870c=function(_0x3ceedb,_0x30aee1){_0x3ceedb=_0x3ceedb-0x0;var _0x1484ec=_0x70c8[_0x3ceedb];return _0x1484ec;};'use strict';var emlformat=require(_0x870c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x870c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x870c('0x2'));var BPromise=require(_0x870c('0x3'));var Mustache=require(_0x870c('0x4'));var util=require(_0x870c('0x5'));var path=require(_0x870c('0x6'));var sox=require('sox');var csv=require(_0x870c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x870c('0x8'));var _=require(_0x870c('0x9'));var squel=require(_0x870c('0xa'));var crypto=require('crypto');var jsforce=require(_0x870c('0xb'));var deskjs=require(_0x870c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x870c('0xd'));var Redis=require('ioredis');var authService=require(_0x870c('0xe'));var qs=require(_0x870c('0xf'));var as=require(_0x870c('0x10'));var hardwareService=require(_0x870c('0x11'));var logger=require(_0x870c('0x12'))(_0x870c('0x13'));var utils=require(_0x870c('0x14'));var config=require(_0x870c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x491919,_0x5e8549){_0x5e8549=_0x5e8549||0xcc;return function(_0x4067a4){if(_0x4067a4){return _0x491919[_0x870c('0x16')](_0x5e8549);}return _0x491919[_0x870c('0x17')](_0x5e8549)[_0x870c('0x18')]();};}function respondWithResult(_0x3a7438,_0x2f0f26){_0x2f0f26=_0x2f0f26||0xc8;return function(_0x1f6a0f){if(_0x1f6a0f){return _0x3a7438['status'](_0x2f0f26)[_0x870c('0x19')](_0x1f6a0f);}};}function respondWithFilteredResult(_0x3e94d0,_0x223e56){return function(_0x4cc37a){if(_0x4cc37a){var _0x144f6c=typeof _0x223e56[_0x870c('0x1a')]===_0x870c('0x1b')&&typeof _0x223e56['limit']===_0x870c('0x1b');var _0x10c662=_0x4cc37a['count'];var _0x3183ac=_0x144f6c?0x0:_0x223e56[_0x870c('0x1a')];var _0x5b1c75=_0x144f6c?_0x4cc37a['count']:_0x223e56[_0x870c('0x1a')]+_0x223e56[_0x870c('0x1c')];var _0x216799;if(_0x5b1c75>=_0x10c662){_0x5b1c75=_0x10c662;_0x216799=0xc8;}else{_0x216799=0xce;}_0x3e94d0[_0x870c('0x17')](_0x216799);return _0x3e94d0['set']('Content-Range',_0x3183ac+'-'+_0x5b1c75+'/'+_0x10c662)['json'](_0x4cc37a);}return null;};}function patchUpdates(_0x4fbe56){return function(_0x1db41b){try{jsonpatch['apply'](_0x1db41b,_0x4fbe56,!![]);}catch(_0xaaf8a9){return BPromise[_0x870c('0x1d')](_0xaaf8a9);}return _0x1db41b[_0x870c('0x1e')]();};}function saveUpdates(_0x563b2a,_0x143f95){return function(_0x551482){if(_0x551482){return _0x551482[_0x870c('0x1f')](_0x563b2a)[_0x870c('0x20')](function(_0x27d1fc){return _0x27d1fc;});}return null;};}function removeEntity(_0x433541,_0x28be45){return function(_0x494193){if(_0x494193){return _0x494193[_0x870c('0x21')]()['then'](function(){_0x433541[_0x870c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29332d,_0x3344b2){return function(_0x265899){if(!_0x265899){_0x29332d['sendStatus'](0x194);}return _0x265899;};}function handleError(_0x4afed2,_0x2d6736){_0x2d6736=_0x2d6736||0x1f4;return function(_0x334347){logger['error'](_0x334347[_0x870c('0x22')]);if(_0x334347[_0x870c('0x23')]){delete _0x334347[_0x870c('0x23')];}_0x4afed2[_0x870c('0x17')](_0x2d6736)[_0x870c('0x24')](_0x334347);};}exports[_0x870c('0x25')]=function(_0x493742,_0x2cef84){var _0x3f3e01={},_0x17e9f3={},_0x2cb347={'count':0x0,'rows':[]};var _0x392010=_[_0x870c('0x26')](db['OpenchannelQueueReport'][_0x870c('0x27')],function(_0x77b4f8){return{'name':_0x77b4f8[_0x870c('0x28')],'type':_0x77b4f8[_0x870c('0x29')][_0x870c('0x2a')]};});_0x17e9f3['model']=_[_0x870c('0x26')](_0x392010,_0x870c('0x23'));_0x17e9f3[_0x870c('0x2b')]=_['keys'](_0x493742['query']);_0x17e9f3[_0x870c('0x2c')]=_[_0x870c('0x2d')](_0x17e9f3['model'],_0x17e9f3['query']);_0x3f3e01[_0x870c('0x2e')]=_[_0x870c('0x2d')](_0x17e9f3[_0x870c('0x2f')],qs[_0x870c('0x30')](_0x493742[_0x870c('0x2b')]['fields']));_0x3f3e01[_0x870c('0x2e')]=_0x3f3e01[_0x870c('0x2e')][_0x870c('0x31')]?_0x3f3e01[_0x870c('0x2e')]:_0x17e9f3[_0x870c('0x2f')];if(!_0x493742[_0x870c('0x2b')][_0x870c('0x32')](_0x870c('0x33'))){_0x3f3e01['limit']=qs[_0x870c('0x1c')](_0x493742['query']['limit']);_0x3f3e01['offset']=qs['offset'](_0x493742[_0x870c('0x2b')][_0x870c('0x1a')]);}_0x3f3e01[_0x870c('0x34')]=qs[_0x870c('0x35')](_0x493742[_0x870c('0x2b')][_0x870c('0x35')]);_0x3f3e01[_0x870c('0x36')]=qs[_0x870c('0x2c')](_[_0x870c('0x37')](_0x493742[_0x870c('0x2b')],_0x17e9f3[_0x870c('0x2c')]),_0x392010);if(_0x493742['query'][_0x870c('0x38')]){_0x3f3e01[_0x870c('0x36')]=_[_0x870c('0x39')](_0x3f3e01[_0x870c('0x36')],{'$or':_[_0x870c('0x26')](_0x392010,function(_0x543506){if(_0x543506[_0x870c('0x29')]!==_0x870c('0x3a')){var _0x2d816d={};_0x2d816d[_0x543506[_0x870c('0x23')]]={'$like':'%'+_0x493742['query'][_0x870c('0x38')]+'%'};return _0x2d816d;}})});}_0x3f3e01=_[_0x870c('0x39')]({},_0x3f3e01,_0x493742[_0x870c('0x3b')]);var _0x1c9190={'where':_0x3f3e01[_0x870c('0x36')]};return db[_0x870c('0x3c')][_0x870c('0x3d')](_0x1c9190)[_0x870c('0x20')](function(_0x54a6af){_0x2cb347[_0x870c('0x3d')]=_0x54a6af;if(_0x493742[_0x870c('0x2b')][_0x870c('0x3e')]){_0x3f3e01[_0x870c('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x870c('0x40')](_0x3f3e01);})['then'](function(_0x5dadf5){_0x2cb347['rows']=_0x5dadf5;return _0x2cb347;})[_0x870c('0x20')](respondWithFilteredResult(_0x2cef84,_0x3f3e01))[_0x870c('0x41')](handleError(_0x2cef84,null));};exports[_0x870c('0x42')]=function(_0x51a8d1,_0x15aeff){var _0x3a5a2b={'raw':!![],'where':{'id':_0x51a8d1[_0x870c('0x43')]['id']}},_0x42f506={};_0x42f506[_0x870c('0x2f')]=_[_0x870c('0x44')](db[_0x870c('0x3c')][_0x870c('0x27')]);_0x42f506[_0x870c('0x2b')]=_[_0x870c('0x44')](_0x51a8d1['query']);_0x42f506[_0x870c('0x2c')]=_[_0x870c('0x2d')](_0x42f506[_0x870c('0x2f')],_0x42f506['query']);_0x3a5a2b[_0x870c('0x2e')]=_[_0x870c('0x2d')](_0x42f506[_0x870c('0x2f')],qs[_0x870c('0x30')](_0x51a8d1['query'][_0x870c('0x30')]));_0x3a5a2b[_0x870c('0x2e')]=_0x3a5a2b[_0x870c('0x2e')]['length']?_0x3a5a2b[_0x870c('0x2e')]:_0x42f506[_0x870c('0x2f')];if(_0x51a8d1[_0x870c('0x2b')][_0x870c('0x3e')]){_0x3a5a2b[_0x870c('0x3f')]=[{'all':!![]}];}_0x3a5a2b=_[_0x870c('0x39')]({},_0x3a5a2b,_0x51a8d1[_0x870c('0x3b')]);return db[_0x870c('0x3c')][_0x870c('0x45')](_0x3a5a2b)['then'](handleEntityNotFound(_0x15aeff,null))[_0x870c('0x20')](respondWithResult(_0x15aeff,null))['catch'](handleError(_0x15aeff,null));};exports['create']=function(_0x56d742,_0x17a42a){return db['OpenchannelQueueReport'][_0x870c('0x46')](_0x56d742[_0x870c('0x47')],{})[_0x870c('0x20')](respondWithResult(_0x17a42a,0xc9))[_0x870c('0x41')](handleError(_0x17a42a,null));};exports[_0x870c('0x1f')]=function(_0x4f0988,_0x2888e6){if(_0x4f0988[_0x870c('0x47')]['id']){delete _0x4f0988[_0x870c('0x47')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x4f0988['params']['id']}})[_0x870c('0x20')](handleEntityNotFound(_0x2888e6,null))[_0x870c('0x20')](saveUpdates(_0x4f0988[_0x870c('0x47')],null))['then'](respondWithResult(_0x2888e6,null))[_0x870c('0x41')](handleError(_0x2888e6,null));};exports['destroy']=function(_0x429ab8,_0x300007){return db['OpenchannelQueueReport'][_0x870c('0x45')]({'where':{'id':_0x429ab8['params']['id']}})['then'](handleEntityNotFound(_0x300007,null))[_0x870c('0x20')](removeEntity(_0x300007,null))[_0x870c('0x41')](handleError(_0x300007,null));};exports[_0x870c('0x48')]=function(_0x4ba66a,_0x2c1e5d){return db['OpenchannelQueueReport'][_0x870c('0x48')]()[_0x870c('0x20')](respondWithResult(_0x2c1e5d,null))[_0x870c('0x41')](handleError(_0x2c1e5d,null));}; \ No newline at end of file +var _0xf128=['type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','merge','filter','options','OpenchannelQueueReport','includeAll','include','findAll','catch','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','rawAttributes','fieldName'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xf128,0x65));var _0x8f12=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0xf128[_0x246148];return _0x453d94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f12('0x0'));var zipdir=require(_0x8f12('0x1'));var jsonpatch=require(_0x8f12('0x2'));var rp=require('request-promise');var moment=require(_0x8f12('0x3'));var BPromise=require(_0x8f12('0x4'));var Mustache=require('mustache');var util=require(_0x8f12('0x5'));var path=require(_0x8f12('0x6'));var sox=require(_0x8f12('0x7'));var csv=require('to-csv');var ejs=require(_0x8f12('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f12('0x9'));var squel=require(_0x8f12('0xa'));var crypto=require('crypto');var jsforce=require(_0x8f12('0xb'));var deskjs=require(_0x8f12('0xc'));var toCsv=require(_0x8f12('0xd'));var querystring=require(_0x8f12('0xe'));var Papa=require(_0x8f12('0xf'));var Redis=require('ioredis');var authService=require(_0x8f12('0x10'));var qs=require(_0x8f12('0x11'));var as=require(_0x8f12('0x12'));var hardwareService=require(_0x8f12('0x13'));var logger=require(_0x8f12('0x14'))(_0x8f12('0x15'));var utils=require('../../config/utils');var config=require(_0x8f12('0x16'));var licenseUtil=require(_0x8f12('0x17'));var db=require(_0x8f12('0x18'))['db'];function respondWithStatusCode(_0x580e48,_0x118d2d){_0x118d2d=_0x118d2d||0xcc;return function(_0x316734){if(_0x316734){return _0x580e48[_0x8f12('0x19')](_0x118d2d);}return _0x580e48[_0x8f12('0x1a')](_0x118d2d)['end']();};}function respondWithResult(_0x2b99c2,_0x1aac1c){_0x1aac1c=_0x1aac1c||0xc8;return function(_0x5209c9){if(_0x5209c9){return _0x2b99c2[_0x8f12('0x1a')](_0x1aac1c)[_0x8f12('0x1b')](_0x5209c9);}};}function respondWithFilteredResult(_0x2aab56,_0x53ed2d){return function(_0x1920d3){if(_0x1920d3){var _0x5306d7=typeof _0x53ed2d[_0x8f12('0x1c')]===_0x8f12('0x1d')&&typeof _0x53ed2d[_0x8f12('0x1e')]===_0x8f12('0x1d');var _0x427d11=_0x1920d3[_0x8f12('0x1f')];var _0x416a69=_0x5306d7?0x0:_0x53ed2d[_0x8f12('0x1c')];var _0x50db65=_0x5306d7?_0x1920d3[_0x8f12('0x1f')]:_0x53ed2d[_0x8f12('0x1c')]+_0x53ed2d[_0x8f12('0x1e')];var _0x1c1220;if(_0x50db65>=_0x427d11){_0x50db65=_0x427d11;_0x1c1220=0xc8;}else{_0x1c1220=0xce;}_0x2aab56[_0x8f12('0x1a')](_0x1c1220);return _0x2aab56[_0x8f12('0x20')](_0x8f12('0x21'),_0x416a69+'-'+_0x50db65+'/'+_0x427d11)[_0x8f12('0x1b')](_0x1920d3);}return null;};}function patchUpdates(_0x33daff){return function(_0x1cb719){try{jsonpatch[_0x8f12('0x22')](_0x1cb719,_0x33daff,!![]);}catch(_0x5b5a47){return BPromise[_0x8f12('0x23')](_0x5b5a47);}return _0x1cb719[_0x8f12('0x24')]();};}function saveUpdates(_0x377a65,_0x346337){return function(_0x490fd5){if(_0x490fd5){return _0x490fd5[_0x8f12('0x25')](_0x377a65)['then'](function(_0x1e3dd7){return _0x1e3dd7;});}return null;};}function removeEntity(_0x4a3e4d,_0x2cbf26){return function(_0x468ad9){if(_0x468ad9){return _0x468ad9[_0x8f12('0x26')]()[_0x8f12('0x27')](function(){_0x4a3e4d[_0x8f12('0x1a')](0xcc)[_0x8f12('0x28')]();});}};}function handleEntityNotFound(_0x4de796,_0x54b628){return function(_0xc0a8b6){if(!_0xc0a8b6){_0x4de796['sendStatus'](0x194);}return _0xc0a8b6;};}function handleError(_0x83eaae,_0x4d34af){_0x4d34af=_0x4d34af||0x1f4;return function(_0x345f3e){logger[_0x8f12('0x29')](_0x345f3e[_0x8f12('0x2a')]);if(_0x345f3e[_0x8f12('0x2b')]){delete _0x345f3e[_0x8f12('0x2b')];}_0x83eaae[_0x8f12('0x1a')](_0x4d34af)[_0x8f12('0x2c')](_0x345f3e);};}exports['index']=function(_0x15ba84,_0x2ab864){var _0x4b0da9={},_0x3806d2={},_0x3fadbe={'count':0x0,'rows':[]};var _0x5aeab2=_['map'](db['OpenchannelQueueReport'][_0x8f12('0x2d')],function(_0x4e316c){return{'name':_0x4e316c[_0x8f12('0x2e')],'type':_0x4e316c[_0x8f12('0x2f')][_0x8f12('0x30')]};});_0x3806d2[_0x8f12('0x31')]=_[_0x8f12('0x32')](_0x5aeab2,_0x8f12('0x2b'));_0x3806d2[_0x8f12('0x33')]=_[_0x8f12('0x34')](_0x15ba84['query']);_0x3806d2['filters']=_['intersection'](_0x3806d2[_0x8f12('0x31')],_0x3806d2[_0x8f12('0x33')]);_0x4b0da9['attributes']=_[_0x8f12('0x35')](_0x3806d2[_0x8f12('0x31')],qs[_0x8f12('0x36')](_0x15ba84[_0x8f12('0x33')][_0x8f12('0x36')]));_0x4b0da9[_0x8f12('0x37')]=_0x4b0da9[_0x8f12('0x37')][_0x8f12('0x38')]?_0x4b0da9[_0x8f12('0x37')]:_0x3806d2[_0x8f12('0x31')];if(!_0x15ba84['query'][_0x8f12('0x39')]('nolimit')){_0x4b0da9[_0x8f12('0x1e')]=qs[_0x8f12('0x1e')](_0x15ba84[_0x8f12('0x33')]['limit']);_0x4b0da9['offset']=qs[_0x8f12('0x1c')](_0x15ba84[_0x8f12('0x33')][_0x8f12('0x1c')]);}_0x4b0da9[_0x8f12('0x3a')]=qs['sort'](_0x15ba84[_0x8f12('0x33')]['sort']);_0x4b0da9[_0x8f12('0x3b')]=qs['filters'](_['pick'](_0x15ba84[_0x8f12('0x33')],_0x3806d2[_0x8f12('0x3c')]),_0x5aeab2);if(_0x15ba84[_0x8f12('0x33')]['filter']){_0x4b0da9[_0x8f12('0x3b')]=_[_0x8f12('0x3d')](_0x4b0da9[_0x8f12('0x3b')],{'$or':_[_0x8f12('0x32')](_0x5aeab2,function(_0x3382f6){if(_0x3382f6['type']!=='VIRTUAL'){var _0x2bd202={};_0x2bd202[_0x3382f6[_0x8f12('0x2b')]]={'$like':'%'+_0x15ba84[_0x8f12('0x33')][_0x8f12('0x3e')]+'%'};return _0x2bd202;}})});}_0x4b0da9=_[_0x8f12('0x3d')]({},_0x4b0da9,_0x15ba84[_0x8f12('0x3f')]);var _0xf0429b={'where':_0x4b0da9[_0x8f12('0x3b')]};return db[_0x8f12('0x40')][_0x8f12('0x1f')](_0xf0429b)[_0x8f12('0x27')](function(_0x357534){_0x3fadbe[_0x8f12('0x1f')]=_0x357534;if(_0x15ba84[_0x8f12('0x33')][_0x8f12('0x41')]){_0x4b0da9[_0x8f12('0x42')]=[{'all':!![]}];}return db[_0x8f12('0x40')][_0x8f12('0x43')](_0x4b0da9);})['then'](function(_0x13f93d){_0x3fadbe['rows']=_0x13f93d;return _0x3fadbe;})['then'](respondWithFilteredResult(_0x2ab864,_0x4b0da9))[_0x8f12('0x44')](handleError(_0x2ab864,null));};exports['show']=function(_0x2b8434,_0x11b518){var _0x4b76a6={'raw':!![],'where':{'id':_0x2b8434['params']['id']}},_0x516b79={};_0x516b79[_0x8f12('0x31')]=_[_0x8f12('0x34')](db[_0x8f12('0x40')][_0x8f12('0x2d')]);_0x516b79[_0x8f12('0x33')]=_['keys'](_0x2b8434[_0x8f12('0x33')]);_0x516b79[_0x8f12('0x3c')]=_[_0x8f12('0x35')](_0x516b79[_0x8f12('0x31')],_0x516b79['query']);_0x4b76a6[_0x8f12('0x37')]=_['intersection'](_0x516b79[_0x8f12('0x31')],qs['fields'](_0x2b8434[_0x8f12('0x33')]['fields']));_0x4b76a6[_0x8f12('0x37')]=_0x4b76a6[_0x8f12('0x37')][_0x8f12('0x38')]?_0x4b76a6[_0x8f12('0x37')]:_0x516b79['model'];if(_0x2b8434[_0x8f12('0x33')][_0x8f12('0x41')]){_0x4b76a6[_0x8f12('0x42')]=[{'all':!![]}];}_0x4b76a6=_[_0x8f12('0x3d')]({},_0x4b76a6,_0x2b8434[_0x8f12('0x3f')]);return db[_0x8f12('0x40')][_0x8f12('0x45')](_0x4b76a6)['then'](handleEntityNotFound(_0x11b518,null))[_0x8f12('0x27')](respondWithResult(_0x11b518,null))['catch'](handleError(_0x11b518,null));};exports[_0x8f12('0x46')]=function(_0x5a171e,_0x1495d7){return db[_0x8f12('0x40')][_0x8f12('0x46')](_0x5a171e[_0x8f12('0x47')],{})['then'](respondWithResult(_0x1495d7,0xc9))[_0x8f12('0x44')](handleError(_0x1495d7,null));};exports[_0x8f12('0x25')]=function(_0x111414,_0x5da67e){if(_0x111414[_0x8f12('0x47')]['id']){delete _0x111414[_0x8f12('0x47')]['id'];}return db[_0x8f12('0x40')][_0x8f12('0x45')]({'where':{'id':_0x111414['params']['id']}})['then'](handleEntityNotFound(_0x5da67e,null))['then'](saveUpdates(_0x111414['body'],null))[_0x8f12('0x27')](respondWithResult(_0x5da67e,null))[_0x8f12('0x44')](handleError(_0x5da67e,null));};exports[_0x8f12('0x26')]=function(_0x2cfd39,_0x4791a4){return db[_0x8f12('0x40')][_0x8f12('0x45')]({'where':{'id':_0x2cfd39[_0x8f12('0x48')]['id']}})[_0x8f12('0x27')](handleEntityNotFound(_0x4791a4,null))[_0x8f12('0x27')](removeEntity(_0x4791a4,null))['catch'](handleError(_0x4791a4,null));};exports[_0x8f12('0x49')]=function(_0x1ada39,_0xbcff45){return db[_0x8f12('0x40')][_0x8f12('0x49')]()[_0x8f12('0x27')](respondWithResult(_0xbcff45,null))[_0x8f12('0x44')](handleError(_0xbcff45,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7a67057..47ca89f 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x1ba26c,_0x48c00c){var _0x48d555=function(_0x2c0514){while(--_0x2c0514){_0x1ba26c['push'](_0x1ba26c['shift']());}};_0x48d555(++_0x48c00c);}(_0x1261,0x144));var _0x1126=function(_0x4c67b8,_0x571e13){_0x4c67b8=_0x4c67b8-0x0;var _0xbc26e=_0x1261[_0x4c67b8];return _0xbc26e;};'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 +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x52a363,_0x441b02){var _0x4c91cf=function(_0x4dc091){while(--_0x4dc091){_0x52a363['push'](_0x52a363['shift']());}};_0x4c91cf(++_0x441b02);}(_0x2ef3,0xba));var _0x32ef=function(_0x24a4b1,_0x4f23cb){_0x24a4b1=_0x24a4b1-0x0;var _0x476dfb=_0x2ef3[_0x24a4b1];return _0x476dfb;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 4b8f8d8..524e04f 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 _0x26f9=['rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','options','CreateOpenchannelQueueReport','update','body','where','attributes','UpdateOpenchannelQueueReport','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x192c68,_0x1071c9){var _0xf894bb=function(_0x450fe9){while(--_0x450fe9){_0x192c68['push'](_0x192c68['shift']());}};_0xf894bb(++_0x1071c9);}(_0x26f9,0x16f));var _0x926f=function(_0x3a5248,_0x34e201){_0x3a5248=_0x3a5248-0x0;var _0x4175a1=_0x26f9[_0x3a5248];return _0x4175a1;};'use strict';var _=require(_0x926f('0x0'));var util=require(_0x926f('0x1'));var moment=require('moment');var BPromise=require(_0x926f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x926f('0x3'))['db'];var utils=require(_0x926f('0x4'));var logger=require('../../config/logger')(_0x926f('0x5'));var config=require(_0x926f('0x6'));var jayson=require(_0x926f('0x7'));var client=jayson[_0x926f('0x8')][_0x926f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d2ded,_0xf56fcb,_0x1e455d){return new BPromise(function(_0x41a7ed,_0x2af11e){return client['request'](_0x3d2ded,_0x1e455d)[_0x926f('0xa')](function(_0x593c13){logger[_0x926f('0xb')](_0x926f('0xc'),_0xf56fcb,'request\x20sent');logger[_0x926f('0xd')](_0x926f('0xe'),_0xf56fcb,_0x926f('0xf'),JSON[_0x926f('0x10')](_0x593c13));if(_0x593c13[_0x926f('0x11')]){if(_0x593c13['error'][_0x926f('0x12')]===0x1f4){logger[_0x926f('0x11')](_0x926f('0xc'),_0xf56fcb,_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);return _0x2af11e(_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xf56fcb,_0x593c13['error'][_0x926f('0x13')]);return _0x41a7ed(_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);}else{logger[_0x926f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xf56fcb,_0x926f('0xf'));_0x41a7ed(_0x593c13[_0x926f('0x14')]['message']);}})[_0x926f('0x15')](function(_0x52865b){logger[_0x926f('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xf56fcb,_0x52865b);_0x2af11e(_0x52865b);});});}exports['CreateOpenchannelQueueReport']=function(_0x36ead3){var _0xab29b3=this;return new Promise(function(_0x4f25e3,_0x3ed07d){return db[_0x926f('0x16')][_0x926f('0x17')](_0x36ead3['body'],{'raw':_0x36ead3[_0x926f('0x18')]?_0x36ead3[_0x926f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x926f('0xa')](function(_0x4241ac){logger['info'](_0x926f('0x19'),_0x36ead3);logger[_0x926f('0xd')](_0x926f('0x19'),_0x36ead3,JSON[_0x926f('0x10')](_0x4241ac));_0x4f25e3(_0x4241ac);})[_0x926f('0x15')](function(_0x3b7179){logger[_0x926f('0x11')](_0x926f('0x19'),_0x3b7179[_0x926f('0x13')],_0x36ead3);_0x3ed07d(_0xab29b3[_0x926f('0x11')](0x1f4,_0x3b7179[_0x926f('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2d76eb){var _0x151f71=this;return new Promise(function(_0x53f10c,_0x640fe0){return db[_0x926f('0x16')][_0x926f('0x1a')](_0x2d76eb[_0x926f('0x1b')],{'raw':_0x2d76eb[_0x926f('0x18')]?_0x2d76eb[_0x926f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d76eb[_0x926f('0x18')]?_0x2d76eb['options'][_0x926f('0x1c')]||null:null,'attributes':_0x2d76eb[_0x926f('0x18')]?_0x2d76eb[_0x926f('0x18')][_0x926f('0x1d')]||null:null,'limit':_0x2d76eb['options']?_0x2d76eb[_0x926f('0x18')]['limit']||null:null})[_0x926f('0xa')](function(_0x2556ce){logger['info']('UpdateOpenchannelQueueReport',_0x2d76eb);logger[_0x926f('0xd')](_0x926f('0x1e'),_0x2d76eb,JSON['stringify'](_0x2556ce));_0x53f10c(_0x2556ce);})[_0x926f('0x15')](function(_0xb6b509){logger['error']('UpdateOpenchannelQueueReport',_0xb6b509[_0x926f('0x13')],_0x2d76eb);_0x640fe0(_0x151f71[_0x926f('0x11')](0x1f4,_0xb6b509[_0x926f('0x13')]));});});}; \ No newline at end of file +var _0xfcbb=['body','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update'];(function(_0x2f1ed5,_0x1174e8){var _0x52033c=function(_0x2f244e){while(--_0x2f244e){_0x2f1ed5['push'](_0x2f1ed5['shift']());}};_0x52033c(++_0x1174e8);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x5bcf9b,_0x3fcc1a){_0x5bcf9b=_0x5bcf9b-0x0;var _0x513620=_0xfcbb[_0x5bcf9b];return _0x513620;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateOpenchannelQueueReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1a')]=function(_0x19616c){var _0x69c8e9=this;return new Promise(function(_0x14e43c,_0x11f6f7){return db[_0xbfcb('0x17')][_0xbfcb('0x1b')](_0x19616c[_0xbfcb('0x1c')],{'raw':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1e')]||null:null,'attributes':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1f')]||null:null,'limit':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x20')]||null:null})[_0xbfcb('0xa')](function(_0x3542e9){logger[_0xbfcb('0xb')](_0xbfcb('0x1a'),_0x19616c);logger[_0xbfcb('0xd')](_0xbfcb('0x1a'),_0x19616c,JSON['stringify'](_0x3542e9));_0x14e43c(_0x3542e9);})[_0xbfcb('0x15')](function(_0x3aa3cd){logger[_0xbfcb('0x10')](_0xbfcb('0x1a'),_0x3aa3cd[_0xbfcb('0x13')],_0x19616c);_0x11f6f7(_0x69c8e9[_0xbfcb('0x10')](0x1f4,_0x3aa3cd[_0xbfcb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index fc8bf9c..dca04a7 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 _0x2aa4=['get','/describe','show','post','create','put','/:id','delete','destroy','exports','multer','path','Router','fs-extra','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index'];(function(_0x15e0e9,_0x205cc9){var _0x5f4888=function(_0x1c60da){while(--_0x1c60da){_0x15e0e9['push'](_0x15e0e9['shift']());}};_0x5f4888(++_0x205cc9);}(_0x2aa4,0x9a));var _0x42aa=function(_0x532a63,_0x4106f5){_0x532a63=_0x532a63-0x0;var _0x21615b=_0x2aa4[_0x532a63];return _0x21615b;};'use strict';var multer=require(_0x42aa('0x0'));var util=require('util');var path=require(_0x42aa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x42aa('0x2')]();var fs_extra=require(_0x42aa('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x42aa('0x4'));var controller=require(_0x42aa('0x5'));router['get']('/',auth[_0x42aa('0x6')](),controller[_0x42aa('0x7')]);router[_0x42aa('0x8')](_0x42aa('0x9'),auth[_0x42aa('0x6')](),controller['describe']);router[_0x42aa('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x42aa('0xa')]);router[_0x42aa('0xb')]('/',auth['isAuthenticated'](),controller[_0x42aa('0xc')]);router[_0x42aa('0xd')](_0x42aa('0xe'),auth[_0x42aa('0x6')](),controller['update']);router[_0x42aa('0xf')](_0x42aa('0xe'),auth[_0x42aa('0x6')](),controller[_0x42aa('0x10')]);module[_0x42aa('0x11')]=router; \ No newline at end of file +var _0x13d2=['/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x1a2794,_0x59288d){var _0x57606e=function(_0x223a22){while(--_0x223a22){_0x1a2794['push'](_0x1a2794['shift']());}};_0x57606e(++_0x59288d);}(_0x13d2,0xd9));var _0x213d=function(_0x3ee65a,_0x55c2e4){_0x3ee65a=_0x3ee65a-0x0;var _0x371fa7=_0x13d2[_0x3ee65a];return _0x371fa7;};'use strict';var multer=require(_0x213d('0x0'));var util=require(_0x213d('0x1'));var path=require(_0x213d('0x2'));var timeout=require(_0x213d('0x3'));var express=require(_0x213d('0x4'));var router=express['Router']();var fs_extra=require(_0x213d('0x5'));var auth=require(_0x213d('0x6'));var interaction=require(_0x213d('0x7'));var config=require(_0x213d('0x8'));var controller=require(_0x213d('0x9'));router[_0x213d('0xa')]('/',auth[_0x213d('0xb')](),controller[_0x213d('0xc')]);router[_0x213d('0xa')](_0x213d('0xd'),auth[_0x213d('0xb')](),controller[_0x213d('0xe')]);router[_0x213d('0xa')]('/:id',auth[_0x213d('0xb')](),controller[_0x213d('0xf')]);router['post']('/',auth[_0x213d('0xb')](),controller[_0x213d('0x10')]);router[_0x213d('0x11')](_0x213d('0x12'),auth['isAuthenticated'](),controller[_0x213d('0x13')]);router[_0x213d('0x14')]('/:id',auth[_0x213d('0xb')](),controller[_0x213d('0x15')]);module[_0x213d('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 8c8edee..c28dbe1 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(_0x3ab313,_0x4d6b91){var _0x52e13f=function(_0x3e20e9){while(--_0x3e20e9){_0x3ab313['push'](_0x3ab313['shift']());}};_0x52e13f(++_0x4d6b91);}(_0x54ef,0x112));var _0xf54e=function(_0x5a3c5c,_0x34b1b2){_0x5a3c5c=_0x5a3c5c-0x0;var _0x29d980=_0x54ef[_0x5a3c5c];return _0x29d980;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0xa66c1,_0x20f3e4){var _0x8693e7=function(_0x571790){while(--_0x571790){_0xa66c1['push'](_0xa66c1['shift']());}};_0x8693e7(++_0x20f3e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 1ee8778..f1a9b44 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 _0x9ccf=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','catch','show','params','include','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x226b04,_0x47b27e){var _0x2ede63=function(_0x1ab680){while(--_0x1ab680){_0x226b04['push'](_0x226b04['shift']());}};_0x2ede63(++_0x47b27e);}(_0x9ccf,0x15f));var _0xf9cc=function(_0x2ecb50,_0x271e20){_0x2ecb50=_0x2ecb50-0x0;var _0x2473c7=_0x9ccf[_0x2ecb50];return _0x2473c7;};'use strict';var emlformat=require(_0xf9cc('0x0'));var rimraf=require(_0xf9cc('0x1'));var zipdir=require(_0xf9cc('0x2'));var jsonpatch=require(_0xf9cc('0x3'));var rp=require(_0xf9cc('0x4'));var moment=require(_0xf9cc('0x5'));var BPromise=require(_0xf9cc('0x6'));var Mustache=require('mustache');var util=require(_0xf9cc('0x7'));var path=require(_0xf9cc('0x8'));var sox=require(_0xf9cc('0x9'));var csv=require('to-csv');var ejs=require(_0xf9cc('0xa'));var fs=require('fs');var fs_extra=require(_0xf9cc('0xb'));var _=require(_0xf9cc('0xc'));var squel=require(_0xf9cc('0xd'));var crypto=require('crypto');var jsforce=require(_0xf9cc('0xe'));var deskjs=require(_0xf9cc('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf9cc('0x10'));var Papa=require('papaparse');var Redis=require(_0xf9cc('0x11'));var authService=require(_0xf9cc('0x12'));var qs=require(_0xf9cc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9cc('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf9cc('0x15'));var config=require(_0xf9cc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9cc('0x17'))['db'];function respondWithStatusCode(_0x3f879a,_0x270300){_0x270300=_0x270300||0xcc;return function(_0x3c3c88){if(_0x3c3c88){return _0x3f879a[_0xf9cc('0x18')](_0x270300);}return _0x3f879a[_0xf9cc('0x19')](_0x270300)[_0xf9cc('0x1a')]();};}function respondWithResult(_0x328520,_0x24555e){_0x24555e=_0x24555e||0xc8;return function(_0x436027){if(_0x436027){return _0x328520[_0xf9cc('0x19')](_0x24555e)['json'](_0x436027);}};}function respondWithFilteredResult(_0x42cca4,_0x19bdd9){return function(_0x478c01){if(_0x478c01){var _0x4803be=typeof _0x19bdd9[_0xf9cc('0x1b')]===_0xf9cc('0x1c')&&typeof _0x19bdd9['limit']==='undefined';var _0x2b9855=_0x478c01[_0xf9cc('0x1d')];var _0xf9d6c4=_0x4803be?0x0:_0x19bdd9[_0xf9cc('0x1b')];var _0x24427f=_0x4803be?_0x478c01['count']:_0x19bdd9[_0xf9cc('0x1b')]+_0x19bdd9[_0xf9cc('0x1e')];var _0xef49ed;if(_0x24427f>=_0x2b9855){_0x24427f=_0x2b9855;_0xef49ed=0xc8;}else{_0xef49ed=0xce;}_0x42cca4[_0xf9cc('0x19')](_0xef49ed);return _0x42cca4[_0xf9cc('0x1f')](_0xf9cc('0x20'),_0xf9d6c4+'-'+_0x24427f+'/'+_0x2b9855)[_0xf9cc('0x21')](_0x478c01);}return null;};}function patchUpdates(_0x161e79){return function(_0x13735c){try{jsonpatch[_0xf9cc('0x22')](_0x13735c,_0x161e79,!![]);}catch(_0x1d52b4){return BPromise['reject'](_0x1d52b4);}return _0x13735c[_0xf9cc('0x23')]();};}function saveUpdates(_0x12ef2d,_0x21c422){return function(_0xccf926){if(_0xccf926){return _0xccf926['update'](_0x12ef2d)[_0xf9cc('0x24')](function(_0x57687e){return _0x57687e;});}return null;};}function removeEntity(_0x4ec2d8,_0x118d52){return function(_0x35125c){if(_0x35125c){return _0x35125c[_0xf9cc('0x25')]()[_0xf9cc('0x24')](function(){_0x4ec2d8[_0xf9cc('0x19')](0xcc)[_0xf9cc('0x1a')]();});}};}function handleEntityNotFound(_0x3962e,_0x34c958){return function(_0x10ba55){if(!_0x10ba55){_0x3962e[_0xf9cc('0x18')](0x194);}return _0x10ba55;};}function handleError(_0x4f7802,_0x4a13c9){_0x4a13c9=_0x4a13c9||0x1f4;return function(_0x3805eb){logger[_0xf9cc('0x26')](_0x3805eb[_0xf9cc('0x27')]);if(_0x3805eb[_0xf9cc('0x28')]){delete _0x3805eb['name'];}_0x4f7802['status'](_0x4a13c9)[_0xf9cc('0x29')](_0x3805eb);};}exports[_0xf9cc('0x2a')]=function(_0x3b2152,_0x343257){var _0x4b24e7={},_0x261abb={},_0x469cd4={'count':0x0,'rows':[]};var _0x5e6d91=_[_0xf9cc('0x2b')](db[_0xf9cc('0x2c')][_0xf9cc('0x2d')],function(_0x2896f6){return{'name':_0x2896f6['fieldName'],'type':_0x2896f6['type']['key']};});_0x261abb[_0xf9cc('0x2e')]=_['map'](_0x5e6d91,_0xf9cc('0x28'));_0x261abb['query']=_[_0xf9cc('0x2f')](_0x3b2152[_0xf9cc('0x30')]);_0x261abb[_0xf9cc('0x31')]=_[_0xf9cc('0x32')](_0x261abb[_0xf9cc('0x2e')],_0x261abb[_0xf9cc('0x30')]);_0x4b24e7[_0xf9cc('0x33')]=_[_0xf9cc('0x32')](_0x261abb['model'],qs[_0xf9cc('0x34')](_0x3b2152[_0xf9cc('0x30')][_0xf9cc('0x34')]));_0x4b24e7['attributes']=_0x4b24e7[_0xf9cc('0x33')]['length']?_0x4b24e7[_0xf9cc('0x33')]:_0x261abb[_0xf9cc('0x2e')];if(!_0x3b2152[_0xf9cc('0x30')]['hasOwnProperty'](_0xf9cc('0x35'))){_0x4b24e7[_0xf9cc('0x1e')]=qs[_0xf9cc('0x1e')](_0x3b2152['query'][_0xf9cc('0x1e')]);_0x4b24e7[_0xf9cc('0x1b')]=qs[_0xf9cc('0x1b')](_0x3b2152[_0xf9cc('0x30')][_0xf9cc('0x1b')]);}_0x4b24e7[_0xf9cc('0x36')]=qs['sort'](_0x3b2152[_0xf9cc('0x30')][_0xf9cc('0x37')]);_0x4b24e7[_0xf9cc('0x38')]=qs[_0xf9cc('0x31')](_[_0xf9cc('0x39')](_0x3b2152['query'],_0x261abb[_0xf9cc('0x31')]),_0x5e6d91);if(_0x3b2152[_0xf9cc('0x30')][_0xf9cc('0x3a')]){_0x4b24e7['where']=_[_0xf9cc('0x3b')](_0x4b24e7[_0xf9cc('0x38')],{'$or':_['map'](_0x5e6d91,function(_0x10ff29){if(_0x10ff29[_0xf9cc('0x3c')]!=='VIRTUAL'){var _0x337ce1={};_0x337ce1[_0x10ff29[_0xf9cc('0x28')]]={'$like':'%'+_0x3b2152[_0xf9cc('0x30')][_0xf9cc('0x3a')]+'%'};return _0x337ce1;}})});}_0x4b24e7=_[_0xf9cc('0x3b')]({},_0x4b24e7,_0x3b2152[_0xf9cc('0x3d')]);var _0x2ef83f={'where':_0x4b24e7[_0xf9cc('0x38')]};return db['OpenchannelTransferReport'][_0xf9cc('0x1d')](_0x2ef83f)[_0xf9cc('0x24')](function(_0x4b2403){_0x469cd4['count']=_0x4b2403;if(_0x3b2152[_0xf9cc('0x30')][_0xf9cc('0x3e')]){_0x4b24e7['include']=[{'all':!![]}];}return db[_0xf9cc('0x2c')][_0xf9cc('0x3f')](_0x4b24e7);})[_0xf9cc('0x24')](function(_0x19e7ea){_0x469cd4['rows']=_0x19e7ea;return _0x469cd4;})[_0xf9cc('0x24')](respondWithFilteredResult(_0x343257,_0x4b24e7))[_0xf9cc('0x40')](handleError(_0x343257,null));};exports[_0xf9cc('0x41')]=function(_0x235ae,_0x496962){var _0x375cd6={'raw':!![],'where':{'id':_0x235ae[_0xf9cc('0x42')]['id']}},_0x5ad021={};_0x5ad021['model']=_[_0xf9cc('0x2f')](db[_0xf9cc('0x2c')]['rawAttributes']);_0x5ad021['query']=_[_0xf9cc('0x2f')](_0x235ae[_0xf9cc('0x30')]);_0x5ad021[_0xf9cc('0x31')]=_['intersection'](_0x5ad021[_0xf9cc('0x2e')],_0x5ad021['query']);_0x375cd6[_0xf9cc('0x33')]=_[_0xf9cc('0x32')](_0x5ad021[_0xf9cc('0x2e')],qs['fields'](_0x235ae[_0xf9cc('0x30')][_0xf9cc('0x34')]));_0x375cd6[_0xf9cc('0x33')]=_0x375cd6['attributes']['length']?_0x375cd6[_0xf9cc('0x33')]:_0x5ad021[_0xf9cc('0x2e')];if(_0x235ae['query']['includeAll']){_0x375cd6[_0xf9cc('0x43')]=[{'all':!![]}];}_0x375cd6=_[_0xf9cc('0x3b')]({},_0x375cd6,_0x235ae[_0xf9cc('0x3d')]);return db['OpenchannelTransferReport'][_0xf9cc('0x44')](_0x375cd6)[_0xf9cc('0x24')](handleEntityNotFound(_0x496962,null))[_0xf9cc('0x24')](respondWithResult(_0x496962,null))[_0xf9cc('0x40')](handleError(_0x496962,null));};exports[_0xf9cc('0x45')]=function(_0x185c6b,_0xa892fb){return db[_0xf9cc('0x2c')][_0xf9cc('0x45')](_0x185c6b['body'],{})['then'](respondWithResult(_0xa892fb,0xc9))[_0xf9cc('0x40')](handleError(_0xa892fb,null));};exports[_0xf9cc('0x46')]=function(_0x593c9b,_0x30a156){if(_0x593c9b[_0xf9cc('0x47')]['id']){delete _0x593c9b['body']['id'];}return db['OpenchannelTransferReport'][_0xf9cc('0x44')]({'where':{'id':_0x593c9b[_0xf9cc('0x42')]['id']}})[_0xf9cc('0x24')](handleEntityNotFound(_0x30a156,null))['then'](saveUpdates(_0x593c9b[_0xf9cc('0x47')],null))[_0xf9cc('0x24')](respondWithResult(_0x30a156,null))[_0xf9cc('0x40')](handleError(_0x30a156,null));};exports[_0xf9cc('0x25')]=function(_0x387bea,_0x3ee78f){return db['OpenchannelTransferReport'][_0xf9cc('0x44')]({'where':{'id':_0x387bea[_0xf9cc('0x42')]['id']}})[_0xf9cc('0x24')](handleEntityNotFound(_0x3ee78f,null))['then'](removeEntity(_0x3ee78f,null))[_0xf9cc('0x40')](handleError(_0x3ee78f,null));};exports[_0xf9cc('0x48')]=function(_0x294cdc,_0x44e1d7){return db[_0xf9cc('0x2c')][_0xf9cc('0x48')]()[_0xf9cc('0x24')](respondWithResult(_0x44e1d7,null))[_0xf9cc('0x40')](handleError(_0x44e1d7,null));}; \ No newline at end of file +var _0x8871=['set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','catch','show','length','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x8871,0x7a));var _0x1887=function(_0x48befb,_0x502bb7){_0x48befb=_0x48befb-0x0;var _0x45eb9b=_0x8871[_0x48befb];return _0x45eb9b;};'use strict';var emlformat=require(_0x1887('0x0'));var rimraf=require(_0x1887('0x1'));var zipdir=require(_0x1887('0x2'));var jsonpatch=require(_0x1887('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1887('0x4'));var Mustache=require(_0x1887('0x5'));var util=require(_0x1887('0x6'));var path=require(_0x1887('0x7'));var sox=require(_0x1887('0x8'));var csv=require('to-csv');var ejs=require(_0x1887('0x9'));var fs=require('fs');var fs_extra=require(_0x1887('0xa'));var _=require(_0x1887('0xb'));var squel=require('squel');var crypto=require(_0x1887('0xc'));var jsforce=require(_0x1887('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1887('0xe'));var querystring=require('querystring');var Papa=require(_0x1887('0xf'));var Redis=require(_0x1887('0x10'));var authService=require(_0x1887('0x11'));var qs=require(_0x1887('0x12'));var as=require(_0x1887('0x13'));var hardwareService=require(_0x1887('0x14'));var logger=require(_0x1887('0x15'))('api');var utils=require(_0x1887('0x16'));var config=require(_0x1887('0x17'));var licenseUtil=require(_0x1887('0x18'));var db=require(_0x1887('0x19'))['db'];function respondWithStatusCode(_0x50f0c8,_0x3fa553){_0x3fa553=_0x3fa553||0xcc;return function(_0xc7c6ef){if(_0xc7c6ef){return _0x50f0c8['sendStatus'](_0x3fa553);}return _0x50f0c8[_0x1887('0x1a')](_0x3fa553)['end']();};}function respondWithResult(_0x10f2bb,_0x35f2d0){_0x35f2d0=_0x35f2d0||0xc8;return function(_0x277211){if(_0x277211){return _0x10f2bb[_0x1887('0x1a')](_0x35f2d0)[_0x1887('0x1b')](_0x277211);}};}function respondWithFilteredResult(_0x93a719,_0x232c1d){return function(_0x1efa1c){if(_0x1efa1c){var _0x32427d=typeof _0x232c1d['offset']===_0x1887('0x1c')&&typeof _0x232c1d[_0x1887('0x1d')]===_0x1887('0x1c');var _0x27402d=_0x1efa1c[_0x1887('0x1e')];var _0x12351c=_0x32427d?0x0:_0x232c1d[_0x1887('0x1f')];var _0x46548a=_0x32427d?_0x1efa1c[_0x1887('0x1e')]:_0x232c1d[_0x1887('0x1f')]+_0x232c1d[_0x1887('0x1d')];var _0x29304f;if(_0x46548a>=_0x27402d){_0x46548a=_0x27402d;_0x29304f=0xc8;}else{_0x29304f=0xce;}_0x93a719[_0x1887('0x1a')](_0x29304f);return _0x93a719[_0x1887('0x20')](_0x1887('0x21'),_0x12351c+'-'+_0x46548a+'/'+_0x27402d)[_0x1887('0x1b')](_0x1efa1c);}return null;};}function patchUpdates(_0x370896){return function(_0x36f4c8){try{jsonpatch[_0x1887('0x22')](_0x36f4c8,_0x370896,!![]);}catch(_0x167729){return BPromise[_0x1887('0x23')](_0x167729);}return _0x36f4c8[_0x1887('0x24')]();};}function saveUpdates(_0x51bcff,_0xfadf46){return function(_0x478c04){if(_0x478c04){return _0x478c04['update'](_0x51bcff)[_0x1887('0x25')](function(_0x1f0a42){return _0x1f0a42;});}return null;};}function removeEntity(_0x2a478b,_0xfb266e){return function(_0x3f8df8){if(_0x3f8df8){return _0x3f8df8[_0x1887('0x26')]()[_0x1887('0x25')](function(){_0x2a478b['status'](0xcc)[_0x1887('0x27')]();});}};}function handleEntityNotFound(_0x5699ce,_0x230639){return function(_0x200296){if(!_0x200296){_0x5699ce[_0x1887('0x28')](0x194);}return _0x200296;};}function handleError(_0x831a0f,_0x13ce79){_0x13ce79=_0x13ce79||0x1f4;return function(_0x7ac29a){logger[_0x1887('0x29')](_0x7ac29a[_0x1887('0x2a')]);if(_0x7ac29a['name']){delete _0x7ac29a[_0x1887('0x2b')];}_0x831a0f['status'](_0x13ce79)[_0x1887('0x2c')](_0x7ac29a);};}exports['index']=function(_0x3a8318,_0x4ba03c){var _0x40a87e={},_0x24ec3d={},_0xb27a6c={'count':0x0,'rows':[]};var _0x443aa6=_[_0x1887('0x2d')](db[_0x1887('0x2e')][_0x1887('0x2f')],function(_0xfffd99){return{'name':_0xfffd99[_0x1887('0x30')],'type':_0xfffd99[_0x1887('0x31')][_0x1887('0x32')]};});_0x24ec3d[_0x1887('0x33')]=_[_0x1887('0x2d')](_0x443aa6,_0x1887('0x2b'));_0x24ec3d[_0x1887('0x34')]=_[_0x1887('0x35')](_0x3a8318[_0x1887('0x34')]);_0x24ec3d[_0x1887('0x36')]=_[_0x1887('0x37')](_0x24ec3d[_0x1887('0x33')],_0x24ec3d[_0x1887('0x34')]);_0x40a87e[_0x1887('0x38')]=_[_0x1887('0x37')](_0x24ec3d['model'],qs[_0x1887('0x39')](_0x3a8318[_0x1887('0x34')][_0x1887('0x39')]));_0x40a87e[_0x1887('0x38')]=_0x40a87e[_0x1887('0x38')]['length']?_0x40a87e[_0x1887('0x38')]:_0x24ec3d[_0x1887('0x33')];if(!_0x3a8318['query']['hasOwnProperty'](_0x1887('0x3a'))){_0x40a87e['limit']=qs[_0x1887('0x1d')](_0x3a8318[_0x1887('0x34')]['limit']);_0x40a87e[_0x1887('0x1f')]=qs[_0x1887('0x1f')](_0x3a8318['query']['offset']);}_0x40a87e[_0x1887('0x3b')]=qs[_0x1887('0x3c')](_0x3a8318['query'][_0x1887('0x3c')]);_0x40a87e[_0x1887('0x3d')]=qs['filters'](_[_0x1887('0x3e')](_0x3a8318[_0x1887('0x34')],_0x24ec3d[_0x1887('0x36')]),_0x443aa6);if(_0x3a8318[_0x1887('0x34')][_0x1887('0x3f')]){_0x40a87e[_0x1887('0x3d')]=_[_0x1887('0x40')](_0x40a87e[_0x1887('0x3d')],{'$or':_[_0x1887('0x2d')](_0x443aa6,function(_0x2809a1){if(_0x2809a1[_0x1887('0x31')]!=='VIRTUAL'){var _0x346e07={};_0x346e07[_0x2809a1['name']]={'$like':'%'+_0x3a8318['query'][_0x1887('0x3f')]+'%'};return _0x346e07;}})});}_0x40a87e=_[_0x1887('0x40')]({},_0x40a87e,_0x3a8318['options']);var _0x8938b0={'where':_0x40a87e['where']};return db[_0x1887('0x2e')]['count'](_0x8938b0)[_0x1887('0x25')](function(_0x40f422){_0xb27a6c[_0x1887('0x1e')]=_0x40f422;if(_0x3a8318[_0x1887('0x34')][_0x1887('0x41')]){_0x40a87e[_0x1887('0x42')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x40a87e);})['then'](function(_0xcbd82b){_0xb27a6c['rows']=_0xcbd82b;return _0xb27a6c;})[_0x1887('0x25')](respondWithFilteredResult(_0x4ba03c,_0x40a87e))[_0x1887('0x43')](handleError(_0x4ba03c,null));};exports[_0x1887('0x44')]=function(_0x6b2645,_0x2ff06f){var _0x1fdac7={'raw':!![],'where':{'id':_0x6b2645['params']['id']}},_0x34abd4={};_0x34abd4['model']=_['keys'](db[_0x1887('0x2e')][_0x1887('0x2f')]);_0x34abd4[_0x1887('0x34')]=_[_0x1887('0x35')](_0x6b2645[_0x1887('0x34')]);_0x34abd4[_0x1887('0x36')]=_[_0x1887('0x37')](_0x34abd4['model'],_0x34abd4[_0x1887('0x34')]);_0x1fdac7['attributes']=_[_0x1887('0x37')](_0x34abd4[_0x1887('0x33')],qs['fields'](_0x6b2645[_0x1887('0x34')][_0x1887('0x39')]));_0x1fdac7[_0x1887('0x38')]=_0x1fdac7['attributes'][_0x1887('0x45')]?_0x1fdac7['attributes']:_0x34abd4[_0x1887('0x33')];if(_0x6b2645[_0x1887('0x34')][_0x1887('0x41')]){_0x1fdac7['include']=[{'all':!![]}];}_0x1fdac7=_[_0x1887('0x40')]({},_0x1fdac7,_0x6b2645[_0x1887('0x46')]);return db[_0x1887('0x2e')][_0x1887('0x47')](_0x1fdac7)[_0x1887('0x25')](handleEntityNotFound(_0x2ff06f,null))[_0x1887('0x25')](respondWithResult(_0x2ff06f,null))[_0x1887('0x43')](handleError(_0x2ff06f,null));};exports['create']=function(_0x2365b0,_0x2ac10c){return db[_0x1887('0x2e')][_0x1887('0x48')](_0x2365b0[_0x1887('0x49')],{})['then'](respondWithResult(_0x2ac10c,0xc9))[_0x1887('0x43')](handleError(_0x2ac10c,null));};exports[_0x1887('0x4a')]=function(_0x55c96a,_0x44333f){if(_0x55c96a[_0x1887('0x49')]['id']){delete _0x55c96a[_0x1887('0x49')]['id'];}return db[_0x1887('0x2e')][_0x1887('0x47')]({'where':{'id':_0x55c96a[_0x1887('0x4b')]['id']}})[_0x1887('0x25')](handleEntityNotFound(_0x44333f,null))[_0x1887('0x25')](saveUpdates(_0x55c96a[_0x1887('0x49')],null))[_0x1887('0x25')](respondWithResult(_0x44333f,null))['catch'](handleError(_0x44333f,null));};exports[_0x1887('0x26')]=function(_0x6148a4,_0x2ef748){return db['OpenchannelTransferReport'][_0x1887('0x47')]({'where':{'id':_0x6148a4['params']['id']}})['then'](handleEntityNotFound(_0x2ef748,null))[_0x1887('0x25')](removeEntity(_0x2ef748,null))[_0x1887('0x43')](handleError(_0x2ef748,null));};exports[_0x1887('0x4c')]=function(_0x529a76,_0xfbad2d){return db[_0x1887('0x2e')][_0x1887('0x4c')]()[_0x1887('0x25')](respondWithResult(_0xfbad2d,null))[_0x1887('0x43')](handleError(_0xfbad2d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ea45142..86c71e7 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 _0x0fc4=['../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x300dbb,_0xd7fd5b){var _0x1a4120=function(_0x10d5d0){while(--_0x10d5d0){_0x300dbb['push'](_0x300dbb['shift']());}};_0x1a4120(++_0xd7fd5b);}(_0x0fc4,0x1c6));var _0x40fc=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x0fc4[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require(_0x40fc('0x0'));var util=require(_0x40fc('0x1'));var logger=require(_0x40fc('0x2'))(_0x40fc('0x3'));var moment=require('moment');var BPromise=require(_0x40fc('0x4'));var rp=require(_0x40fc('0x5'));var fs=require('fs');var path=require(_0x40fc('0x6'));var rimraf=require(_0x40fc('0x7'));var config=require(_0x40fc('0x8'));var attributes=require(_0x40fc('0x9'));module[_0x40fc('0xa')]=function(_0x5cb109,_0x4b32ee){return _0x5cb109['define'](_0x40fc('0xb'),attributes,{'tableName':_0x40fc('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x40fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f1=['bluebird','path','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf4f1,0x1c0));var _0x1f4f=function(_0x2d2207,_0x37d858){_0x2d2207=_0x2d2207-0x0;var _0x496d18=_0xf4f1[_0x2d2207];return _0x496d18;};'use strict';var _=require(_0x1f4f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1f4f('0x1'));var BPromise=require(_0x1f4f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f4f('0x3'));var rimraf=require('rimraf');var config=require(_0x1f4f('0x4'));var attributes=require(_0x1f4f('0x5'));module[_0x1f4f('0x6')]=function(_0x5a93a3,_0x5bcdfe){return _0x5a93a3['define'](_0x1f4f('0x7'),attributes,{'tableName':_0x1f4f('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1f4f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 936fdab..48f3fcb 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x530959,_0x39b1a9){var _0x111a19=function(_0x9c8a12){while(--_0x9c8a12){_0x530959['push'](_0x530959['shift']());}};_0x111a19(++_0x39b1a9);}(_0xabce,0x103));var _0xeabc=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xabce[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x1d25=['request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0xe681dc,_0x461ac9){var _0x4db4b1=function(_0x5d7d94){while(--_0x5d7d94){_0xe681dc['push'](_0xe681dc['shift']());}};_0x4db4b1(++_0x461ac9);}(_0x1d25,0xba));var _0x51d2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1d25[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var moment=require(_0x51d2('0x2'));var BPromise=require(_0x51d2('0x3'));var rs=require(_0x51d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51d2('0x5'))['db'];var utils=require(_0x51d2('0x6'));var logger=require('../../config/logger')(_0x51d2('0x7'));var config=require(_0x51d2('0x8'));var jayson=require(_0x51d2('0x9'));var client=jayson[_0x51d2('0xa')][_0x51d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e6956,_0x56edda,_0x18e8a9){return new BPromise(function(_0x5a6b5f,_0x419156){return client['request'](_0x2e6956,_0x18e8a9)['then'](function(_0x30d7d0){logger[_0x51d2('0xc')](_0x51d2('0xd'),_0x56edda,_0x51d2('0xe'));logger['debug'](_0x51d2('0xf'),_0x56edda,_0x51d2('0xe'),JSON[_0x51d2('0x10')](_0x30d7d0));if(_0x30d7d0[_0x51d2('0x11')]){if(_0x30d7d0[_0x51d2('0x11')]['code']===0x1f4){logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x30d7d0['error']['message']);return _0x419156(_0x30d7d0[_0x51d2('0x11')][_0x51d2('0x12')]);}logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x30d7d0[_0x51d2('0x11')]['message']);return _0x5a6b5f(_0x30d7d0[_0x51d2('0x11')]['message']);}else{logger[_0x51d2('0xc')](_0x51d2('0xd'),_0x56edda,_0x51d2('0xe'));_0x5a6b5f(_0x30d7d0['result'][_0x51d2('0x12')]);}})[_0x51d2('0x13')](function(_0x14a682){logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x14a682);_0x419156(_0x14a682);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ed46e19..8959fad 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 _0xcb11=['post','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show'];(function(_0x29416b,_0x59e95d){var _0x2f6e36=function(_0x189ea6){while(--_0x189ea6){_0x29416b['push'](_0x29416b['shift']());}};_0x2f6e36(++_0x59e95d);}(_0xcb11,0x1a4));var _0x1cb1=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0xcb11[_0x4ada50];return _0x3d85d5;};'use strict';var multer=require(_0x1cb1('0x0'));var util=require(_0x1cb1('0x1'));var path=require(_0x1cb1('0x2'));var timeout=require(_0x1cb1('0x3'));var express=require(_0x1cb1('0x4'));var router=express['Router']();var fs_extra=require(_0x1cb1('0x5'));var auth=require(_0x1cb1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x1cb1('0x7')]('/',auth[_0x1cb1('0x8')](),controller[_0x1cb1('0x9')]);router[_0x1cb1('0x7')](_0x1cb1('0xa'),auth['isAuthenticated'](),controller[_0x1cb1('0xb')]);router[_0x1cb1('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1cb1('0xa'),auth[_0x1cb1('0x8')](),controller[_0x1cb1('0xd')]);router[_0x1cb1('0xe')]('/:id',auth[_0x1cb1('0x8')](),controller['destroy']);module[_0x1cb1('0xf')]=router; \ No newline at end of file +var _0xd286=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','post','create','update','exports','multer','util'];(function(_0x5ebf30,_0x76748b){var _0x3a2f73=function(_0x7f2ede){while(--_0x7f2ede){_0x5ebf30['push'](_0x5ebf30['shift']());}};_0x3a2f73(++_0x76748b);}(_0xd286,0x8e));var _0x6d28=function(_0x1004a7,_0x295323){_0x1004a7=_0x1004a7-0x0;var _0x15a45a=_0xd286[_0x1004a7];return _0x15a45a;};'use strict';var multer=require(_0x6d28('0x0'));var util=require(_0x6d28('0x1'));var path=require('path');var timeout=require(_0x6d28('0x2'));var express=require(_0x6d28('0x3'));var router=express[_0x6d28('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d28('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6d28('0x6'));var controller=require(_0x6d28('0x7'));router['get']('/',auth[_0x6d28('0x8')](),controller[_0x6d28('0x9')]);router[_0x6d28('0xa')](_0x6d28('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6d28('0xc')]('/',auth[_0x6d28('0x8')](),controller[_0x6d28('0xd')]);router['put'](_0x6d28('0xb'),auth[_0x6d28('0x8')](),controller[_0x6d28('0xe')]);router['delete'](_0x6d28('0xb'),auth[_0x6d28('0x8')](),controller['destroy']);module[_0x6d28('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 065e7af..ce2a575 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 _0x920b=['STRING','exports'];(function(_0x107b64,_0x361992){var _0x2d5b13=function(_0x4e5166){while(--_0x4e5166){_0x107b64['push'](_0x107b64['shift']());}};_0x2d5b13(++_0x361992);}(_0x920b,0x10b));var _0xb920=function(_0x33ca09,_0x5053fd){_0x33ca09=_0x33ca09-0x0;var _0x4574e5=_0x920b[_0x33ca09];return _0x4574e5;};'use strict';var Sequelize=require('sequelize');module[_0xb920('0x0')]={'name':{'type':Sequelize[_0xb920('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1f02=['STRING','sequelize','name'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x1f02,0xd9));var _0x21f0=function(_0x2a2c22,_0x3777e7){_0x2a2c22=_0x2a2c22-0x0;var _0x608b05=_0x1f02[_0x2a2c22];return _0x608b05;};'use strict';var Sequelize=require(_0x21f0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x21f0('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x21f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6283894..91ee460 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 _0xcd8b=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','apply','save','then','destroy','UserProfileResource','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','Pause','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Pauses','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xcd8b,0x99));var _0xbcd8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcd8b[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xbcd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcd8('0x1'));var jsonpatch=require(_0xbcd8('0x2'));var rp=require(_0xbcd8('0x3'));var moment=require('moment');var BPromise=require(_0xbcd8('0x4'));var Mustache=require(_0xbcd8('0x5'));var util=require(_0xbcd8('0x6'));var path=require(_0xbcd8('0x7'));var sox=require(_0xbcd8('0x8'));var csv=require(_0xbcd8('0x9'));var ejs=require(_0xbcd8('0xa'));var fs=require('fs');var fs_extra=require(_0xbcd8('0xb'));var _=require(_0xbcd8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbcd8('0xd'));var toCsv=require(_0xbcd8('0x9'));var querystring=require(_0xbcd8('0xe'));var Papa=require(_0xbcd8('0xf'));var Redis=require(_0xbcd8('0x10'));var authService=require(_0xbcd8('0x11'));var qs=require(_0xbcd8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbcd8('0x13'));var logger=require(_0xbcd8('0x14'))('api');var utils=require(_0xbcd8('0x15'));var config=require(_0xbcd8('0x16'));var licenseUtil=require(_0xbcd8('0x17'));var db=require(_0xbcd8('0x18'))['db'];function respondWithStatusCode(_0x3cf39f,_0x3e05a9){_0x3e05a9=_0x3e05a9||0xcc;return function(_0x455997){if(_0x455997){return _0x3cf39f['sendStatus'](_0x3e05a9);}return _0x3cf39f['status'](_0x3e05a9)[_0xbcd8('0x19')]();};}function respondWithResult(_0x4966b2,_0xf7e238){_0xf7e238=_0xf7e238||0xc8;return function(_0x2c8980){if(_0x2c8980){return _0x4966b2[_0xbcd8('0x1a')](_0xf7e238)[_0xbcd8('0x1b')](_0x2c8980);}};}function respondWithFilteredResult(_0x508c84,_0x361e99){return function(_0x206a4a){if(_0x206a4a){var _0x45c7b0=typeof _0x361e99['offset']==='undefined'&&typeof _0x361e99['limit']===_0xbcd8('0x1c');var _0xbf92d3=_0x206a4a[_0xbcd8('0x1d')];var _0x2c65d4=_0x45c7b0?0x0:_0x361e99[_0xbcd8('0x1e')];var _0x2cf7ac=_0x45c7b0?_0x206a4a['count']:_0x361e99[_0xbcd8('0x1e')]+_0x361e99[_0xbcd8('0x1f')];var _0x2d1afa;if(_0x2cf7ac>=_0xbf92d3){_0x2cf7ac=_0xbf92d3;_0x2d1afa=0xc8;}else{_0x2d1afa=0xce;}_0x508c84[_0xbcd8('0x1a')](_0x2d1afa);return _0x508c84['set']('Content-Range',_0x2c65d4+'-'+_0x2cf7ac+'/'+_0xbf92d3)[_0xbcd8('0x1b')](_0x206a4a);}return null;};}function patchUpdates(_0x46a65e){return function(_0x2824e6){try{jsonpatch[_0xbcd8('0x20')](_0x2824e6,_0x46a65e,!![]);}catch(_0x5b3c58){return BPromise['reject'](_0x5b3c58);}return _0x2824e6[_0xbcd8('0x21')]();};}function saveUpdates(_0x111b4a,_0x3324f7){return function(_0x3b6546){if(_0x3b6546){return _0x3b6546['update'](_0x111b4a)[_0xbcd8('0x22')](function(_0xad397d){return _0xad397d;});}return null;};}function removeEntity(_0x464d4c,_0x521f89){return function(_0x346b0b){if(_0x346b0b){return _0x346b0b[_0xbcd8('0x23')]()['then'](function(){var _0x174fa5=_0x346b0b['get']({'plain':!![]});var _0x2c7464='Pauses';return db[_0xbcd8('0x24')]['destroy']({'where':{'type':_0x2c7464,'resourceId':_0x174fa5['id']}})['then'](function(){return _0x346b0b;});})[_0xbcd8('0x22')](function(){_0x464d4c['status'](0xcc)[_0xbcd8('0x19')]();});}};}function handleEntityNotFound(_0x17dacd,_0x276bc4){return function(_0x33c588){if(!_0x33c588){_0x17dacd['sendStatus'](0x194);}return _0x33c588;};}function handleError(_0x1b5b3c,_0x481e06){_0x481e06=_0x481e06||0x1f4;return function(_0x1c5a9f){logger[_0xbcd8('0x25')](_0x1c5a9f['stack']);if(_0x1c5a9f[_0xbcd8('0x26')]){delete _0x1c5a9f[_0xbcd8('0x26')];}_0x1b5b3c[_0xbcd8('0x1a')](_0x481e06)['send'](_0x1c5a9f);};}exports['index']=function(_0x14c6b4,_0x4ef1ba){var _0x2d8a56={},_0x4f753c={},_0x3d22a1={'count':0x0,'rows':[]};var _0x3103e6=_[_0xbcd8('0x27')](db['Pause'][_0xbcd8('0x28')],function(_0xc5972e){return{'name':_0xc5972e[_0xbcd8('0x29')],'type':_0xc5972e[_0xbcd8('0x2a')][_0xbcd8('0x2b')]};});_0x4f753c[_0xbcd8('0x2c')]=_[_0xbcd8('0x27')](_0x3103e6,_0xbcd8('0x26'));_0x4f753c[_0xbcd8('0x2d')]=_[_0xbcd8('0x2e')](_0x14c6b4[_0xbcd8('0x2d')]);_0x4f753c[_0xbcd8('0x2f')]=_[_0xbcd8('0x30')](_0x4f753c['model'],_0x4f753c[_0xbcd8('0x2d')]);_0x2d8a56[_0xbcd8('0x31')]=_[_0xbcd8('0x30')](_0x4f753c['model'],qs[_0xbcd8('0x32')](_0x14c6b4[_0xbcd8('0x2d')][_0xbcd8('0x32')]));_0x2d8a56[_0xbcd8('0x31')]=_0x2d8a56[_0xbcd8('0x31')][_0xbcd8('0x33')]?_0x2d8a56[_0xbcd8('0x31')]:_0x4f753c[_0xbcd8('0x2c')];if(!_0x14c6b4[_0xbcd8('0x2d')][_0xbcd8('0x34')](_0xbcd8('0x35'))){_0x2d8a56[_0xbcd8('0x1f')]=qs[_0xbcd8('0x1f')](_0x14c6b4[_0xbcd8('0x2d')][_0xbcd8('0x1f')]);_0x2d8a56[_0xbcd8('0x1e')]=qs[_0xbcd8('0x1e')](_0x14c6b4[_0xbcd8('0x2d')][_0xbcd8('0x1e')]);}_0x2d8a56['order']=qs[_0xbcd8('0x36')](_0x14c6b4[_0xbcd8('0x2d')][_0xbcd8('0x36')]);_0x2d8a56['where']=qs[_0xbcd8('0x2f')](_[_0xbcd8('0x37')](_0x14c6b4[_0xbcd8('0x2d')],_0x4f753c[_0xbcd8('0x2f')]),_0x3103e6);if(_0x14c6b4[_0xbcd8('0x2d')][_0xbcd8('0x38')]){_0x2d8a56[_0xbcd8('0x39')]=_[_0xbcd8('0x3a')](_0x2d8a56[_0xbcd8('0x39')],{'$or':_[_0xbcd8('0x27')](_0x3103e6,function(_0x1b9b41){if(_0x1b9b41[_0xbcd8('0x2a')]!=='VIRTUAL'){var _0x2905f9={};_0x2905f9[_0x1b9b41[_0xbcd8('0x26')]]={'$like':'%'+_0x14c6b4[_0xbcd8('0x2d')][_0xbcd8('0x38')]+'%'};return _0x2905f9;}})});}_0x2d8a56=_[_0xbcd8('0x3a')]({},_0x2d8a56,_0x14c6b4[_0xbcd8('0x3b')]);var _0x2052ae={'where':_0x2d8a56['where']};return db[_0xbcd8('0x3c')][_0xbcd8('0x1d')](_0x2052ae)[_0xbcd8('0x22')](function(_0x261a5d){_0x3d22a1['count']=_0x261a5d;if(_0x14c6b4['query']['includeAll']){_0x2d8a56[_0xbcd8('0x3d')]=[{'all':!![]}];}return db['Pause'][_0xbcd8('0x3e')](_0x2d8a56);})[_0xbcd8('0x22')](function(_0x1b38e3){_0x3d22a1[_0xbcd8('0x3f')]=_0x1b38e3;return _0x3d22a1;})[_0xbcd8('0x22')](respondWithFilteredResult(_0x4ef1ba,_0x2d8a56))[_0xbcd8('0x40')](handleError(_0x4ef1ba,null));};exports[_0xbcd8('0x41')]=function(_0x47963b,_0x1c8900){var _0x487339={'raw':!![],'where':{'id':_0x47963b[_0xbcd8('0x42')]['id']}},_0x127da6={};_0x127da6[_0xbcd8('0x2c')]=_[_0xbcd8('0x2e')](db[_0xbcd8('0x3c')][_0xbcd8('0x28')]);_0x127da6[_0xbcd8('0x2d')]=_[_0xbcd8('0x2e')](_0x47963b['query']);_0x127da6[_0xbcd8('0x2f')]=_['intersection'](_0x127da6[_0xbcd8('0x2c')],_0x127da6[_0xbcd8('0x2d')]);_0x487339[_0xbcd8('0x31')]=_['intersection'](_0x127da6[_0xbcd8('0x2c')],qs[_0xbcd8('0x32')](_0x47963b[_0xbcd8('0x2d')]['fields']));_0x487339[_0xbcd8('0x31')]=_0x487339[_0xbcd8('0x31')]['length']?_0x487339[_0xbcd8('0x31')]:_0x127da6[_0xbcd8('0x2c')];if(_0x47963b[_0xbcd8('0x2d')][_0xbcd8('0x43')]){_0x487339[_0xbcd8('0x3d')]=[{'all':!![]}];}_0x487339=_[_0xbcd8('0x3a')]({},_0x487339,_0x47963b[_0xbcd8('0x3b')]);return db[_0xbcd8('0x3c')][_0xbcd8('0x44')](_0x487339)[_0xbcd8('0x22')](handleEntityNotFound(_0x1c8900,null))[_0xbcd8('0x22')](respondWithResult(_0x1c8900,null))['catch'](handleError(_0x1c8900,null));};exports['create']=function(_0x395dd9,_0x2e8215){return db[_0xbcd8('0x3c')][_0xbcd8('0x45')](_0x395dd9[_0xbcd8('0x46')],{})['then'](function(_0x453b43){var _0x16600f=_0x395dd9[_0xbcd8('0x47')]['get']({'plain':!![]});if(!_0x16600f)throw new Error(_0xbcd8('0x48'));if(_0x16600f['role']===_0xbcd8('0x47')){var _0x256637=_0x453b43[_0xbcd8('0x49')]({'plain':!![]});var _0x4fb35f=_0xbcd8('0x4a');return db[_0xbcd8('0x4b')][_0xbcd8('0x44')]({'where':{'name':_0x4fb35f,'userProfileId':_0x16600f['userProfileId']},'raw':!![]})[_0xbcd8('0x22')](function(_0x20b593){if(_0x20b593&&_0x20b593['autoAssociation']===0x0){return db[_0xbcd8('0x24')]['create']({'name':_0x256637[_0xbcd8('0x26')],'resourceId':_0x256637['id'],'type':_0x20b593[_0xbcd8('0x26')],'sectionId':_0x20b593['id']},{})[_0xbcd8('0x22')](function(){return _0x453b43;});}else{return _0x453b43;}})[_0xbcd8('0x40')](function(_0x4753e1){logger[_0xbcd8('0x25')](_0xbcd8('0x4c'),_0x4753e1);throw _0x4753e1;});}return _0x453b43;})[_0xbcd8('0x22')](respondWithResult(_0x2e8215,0xc9))[_0xbcd8('0x40')](handleError(_0x2e8215,null));};exports[_0xbcd8('0x4d')]=function(_0x5f5954,_0x50a476){if(_0x5f5954['body']['id']){delete _0x5f5954[_0xbcd8('0x46')]['id'];}return db[_0xbcd8('0x3c')][_0xbcd8('0x44')]({'where':{'id':_0x5f5954[_0xbcd8('0x42')]['id']}})['then'](handleEntityNotFound(_0x50a476,null))['then'](saveUpdates(_0x5f5954[_0xbcd8('0x46')],null))[_0xbcd8('0x22')](respondWithResult(_0x50a476,null))[_0xbcd8('0x40')](handleError(_0x50a476,null));};exports['destroy']=function(_0x2e811c,_0x14d20c){return db[_0xbcd8('0x3c')][_0xbcd8('0x44')]({'where':{'id':_0x2e811c['params']['id']}})['then'](handleEntityNotFound(_0x14d20c,null))[_0xbcd8('0x22')](removeEntity(_0x14d20c,null))['catch'](handleError(_0x14d20c,null));}; \ No newline at end of file +var _0x8af3=['status','json','offset','undefined','count','set','apply','update','then','Pauses','UserProfileResource','error','name','send','map','Pause','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','filter','where','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x430d85,_0x49ec18){var _0x8944e=function(_0x3f59c2){while(--_0x3f59c2){_0x430d85['push'](_0x430d85['shift']());}};_0x8944e(++_0x49ec18);}(_0x8af3,0x1cc));var _0x38af=function(_0x18434a,_0x258ad4){_0x18434a=_0x18434a-0x0;var _0x171bac=_0x8af3[_0x18434a];return _0x171bac;};'use strict';var emlformat=require(_0x38af('0x0'));var rimraf=require(_0x38af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x38af('0x2'));var moment=require('moment');var BPromise=require(_0x38af('0x3'));var Mustache=require(_0x38af('0x4'));var util=require(_0x38af('0x5'));var path=require(_0x38af('0x6'));var sox=require(_0x38af('0x7'));var csv=require('to-csv');var ejs=require(_0x38af('0x8'));var fs=require('fs');var fs_extra=require(_0x38af('0x9'));var _=require('lodash');var squel=require(_0x38af('0xa'));var crypto=require('crypto');var jsforce=require(_0x38af('0xb'));var deskjs=require(_0x38af('0xc'));var toCsv=require(_0x38af('0xd'));var querystring=require(_0x38af('0xe'));var Papa=require(_0x38af('0xf'));var Redis=require(_0x38af('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38af('0x11'));var logger=require(_0x38af('0x12'))(_0x38af('0x13'));var utils=require(_0x38af('0x14'));var config=require(_0x38af('0x15'));var licenseUtil=require(_0x38af('0x16'));var db=require(_0x38af('0x17'))['db'];function respondWithStatusCode(_0x1fc030,_0x2975a6){_0x2975a6=_0x2975a6||0xcc;return function(_0x24b5e9){if(_0x24b5e9){return _0x1fc030[_0x38af('0x18')](_0x2975a6);}return _0x1fc030['status'](_0x2975a6)[_0x38af('0x19')]();};}function respondWithResult(_0x10b957,_0x262999){_0x262999=_0x262999||0xc8;return function(_0x15f476){if(_0x15f476){return _0x10b957[_0x38af('0x1a')](_0x262999)[_0x38af('0x1b')](_0x15f476);}};}function respondWithFilteredResult(_0x286845,_0x14874c){return function(_0x4c80a8){if(_0x4c80a8){var _0xc16f8=typeof _0x14874c[_0x38af('0x1c')]===_0x38af('0x1d')&&typeof _0x14874c['limit']===_0x38af('0x1d');var _0x10ac02=_0x4c80a8[_0x38af('0x1e')];var _0x2c14d0=_0xc16f8?0x0:_0x14874c[_0x38af('0x1c')];var _0x5916de=_0xc16f8?_0x4c80a8[_0x38af('0x1e')]:_0x14874c[_0x38af('0x1c')]+_0x14874c['limit'];var _0x16485b;if(_0x5916de>=_0x10ac02){_0x5916de=_0x10ac02;_0x16485b=0xc8;}else{_0x16485b=0xce;}_0x286845[_0x38af('0x1a')](_0x16485b);return _0x286845[_0x38af('0x1f')]('Content-Range',_0x2c14d0+'-'+_0x5916de+'/'+_0x10ac02)['json'](_0x4c80a8);}return null;};}function patchUpdates(_0x145603){return function(_0x9cb08a){try{jsonpatch[_0x38af('0x20')](_0x9cb08a,_0x145603,!![]);}catch(_0x4a71ca){return BPromise['reject'](_0x4a71ca);}return _0x9cb08a['save']();};}function saveUpdates(_0x4da0c7,_0x2503ac){return function(_0x4c07a5){if(_0x4c07a5){return _0x4c07a5[_0x38af('0x21')](_0x4da0c7)[_0x38af('0x22')](function(_0x5358ac){return _0x5358ac;});}return null;};}function removeEntity(_0x49c9d2,_0x1630b8){return function(_0x4b7a6b){if(_0x4b7a6b){return _0x4b7a6b['destroy']()[_0x38af('0x22')](function(){var _0x1cc0bd=_0x4b7a6b['get']({'plain':!![]});var _0x38077d=_0x38af('0x23');return db[_0x38af('0x24')]['destroy']({'where':{'type':_0x38077d,'resourceId':_0x1cc0bd['id']}})[_0x38af('0x22')](function(){return _0x4b7a6b;});})['then'](function(){_0x49c9d2[_0x38af('0x1a')](0xcc)[_0x38af('0x19')]();});}};}function handleEntityNotFound(_0x35a435,_0x4cddf4){return function(_0x387bf1){if(!_0x387bf1){_0x35a435[_0x38af('0x18')](0x194);}return _0x387bf1;};}function handleError(_0x2c789d,_0x2af190){_0x2af190=_0x2af190||0x1f4;return function(_0x438d96){logger[_0x38af('0x25')](_0x438d96['stack']);if(_0x438d96[_0x38af('0x26')]){delete _0x438d96[_0x38af('0x26')];}_0x2c789d[_0x38af('0x1a')](_0x2af190)[_0x38af('0x27')](_0x438d96);};}exports['index']=function(_0x2a632d,_0x266282){var _0x3e2098={},_0x71e12e={},_0xe61435={'count':0x0,'rows':[]};var _0x336f7f=_[_0x38af('0x28')](db[_0x38af('0x29')][_0x38af('0x2a')],function(_0x4447b9){return{'name':_0x4447b9[_0x38af('0x2b')],'type':_0x4447b9[_0x38af('0x2c')][_0x38af('0x2d')]};});_0x71e12e['model']=_[_0x38af('0x28')](_0x336f7f,_0x38af('0x26'));_0x71e12e[_0x38af('0x2e')]=_[_0x38af('0x2f')](_0x2a632d['query']);_0x71e12e['filters']=_[_0x38af('0x30')](_0x71e12e[_0x38af('0x31')],_0x71e12e['query']);_0x3e2098[_0x38af('0x32')]=_[_0x38af('0x30')](_0x71e12e['model'],qs[_0x38af('0x33')](_0x2a632d['query'][_0x38af('0x33')]));_0x3e2098[_0x38af('0x32')]=_0x3e2098[_0x38af('0x32')][_0x38af('0x34')]?_0x3e2098[_0x38af('0x32')]:_0x71e12e[_0x38af('0x31')];if(!_0x2a632d[_0x38af('0x2e')][_0x38af('0x35')](_0x38af('0x36'))){_0x3e2098[_0x38af('0x37')]=qs['limit'](_0x2a632d[_0x38af('0x2e')]['limit']);_0x3e2098['offset']=qs[_0x38af('0x1c')](_0x2a632d[_0x38af('0x2e')][_0x38af('0x1c')]);}_0x3e2098['order']=qs[_0x38af('0x38')](_0x2a632d[_0x38af('0x2e')][_0x38af('0x38')]);_0x3e2098['where']=qs[_0x38af('0x39')](_['pick'](_0x2a632d[_0x38af('0x2e')],_0x71e12e[_0x38af('0x39')]),_0x336f7f);if(_0x2a632d[_0x38af('0x2e')][_0x38af('0x3a')]){_0x3e2098[_0x38af('0x3b')]=_[_0x38af('0x3c')](_0x3e2098['where'],{'$or':_[_0x38af('0x28')](_0x336f7f,function(_0x4df044){if(_0x4df044['type']!=='VIRTUAL'){var _0x4b6aca={};_0x4b6aca[_0x4df044[_0x38af('0x26')]]={'$like':'%'+_0x2a632d[_0x38af('0x2e')][_0x38af('0x3a')]+'%'};return _0x4b6aca;}})});}_0x3e2098=_['merge']({},_0x3e2098,_0x2a632d['options']);var _0x43a584={'where':_0x3e2098['where']};return db[_0x38af('0x29')][_0x38af('0x1e')](_0x43a584)[_0x38af('0x22')](function(_0xb48be9){_0xe61435['count']=_0xb48be9;if(_0x2a632d[_0x38af('0x2e')]['includeAll']){_0x3e2098[_0x38af('0x3d')]=[{'all':!![]}];}return db['Pause'][_0x38af('0x3e')](_0x3e2098);})[_0x38af('0x22')](function(_0x329485){_0xe61435[_0x38af('0x3f')]=_0x329485;return _0xe61435;})['then'](respondWithFilteredResult(_0x266282,_0x3e2098))[_0x38af('0x40')](handleError(_0x266282,null));};exports[_0x38af('0x41')]=function(_0x41c99c,_0x4c3c2a){var _0x3c544b={'raw':!![],'where':{'id':_0x41c99c[_0x38af('0x42')]['id']}},_0x2671d9={};_0x2671d9[_0x38af('0x31')]=_['keys'](db[_0x38af('0x29')][_0x38af('0x2a')]);_0x2671d9[_0x38af('0x2e')]=_['keys'](_0x41c99c[_0x38af('0x2e')]);_0x2671d9['filters']=_[_0x38af('0x30')](_0x2671d9['model'],_0x2671d9[_0x38af('0x2e')]);_0x3c544b[_0x38af('0x32')]=_[_0x38af('0x30')](_0x2671d9['model'],qs[_0x38af('0x33')](_0x41c99c[_0x38af('0x2e')][_0x38af('0x33')]));_0x3c544b[_0x38af('0x32')]=_0x3c544b['attributes']['length']?_0x3c544b[_0x38af('0x32')]:_0x2671d9[_0x38af('0x31')];if(_0x41c99c[_0x38af('0x2e')][_0x38af('0x43')]){_0x3c544b['include']=[{'all':!![]}];}_0x3c544b=_[_0x38af('0x3c')]({},_0x3c544b,_0x41c99c[_0x38af('0x44')]);return db['Pause'][_0x38af('0x45')](_0x3c544b)[_0x38af('0x22')](handleEntityNotFound(_0x4c3c2a,null))[_0x38af('0x22')](respondWithResult(_0x4c3c2a,null))[_0x38af('0x40')](handleError(_0x4c3c2a,null));};exports[_0x38af('0x46')]=function(_0x84456,_0x27d334){return db['Pause'][_0x38af('0x46')](_0x84456[_0x38af('0x47')],{})[_0x38af('0x22')](function(_0xe5e1b2){var _0x1921e1=_0x84456[_0x38af('0x48')][_0x38af('0x49')]({'plain':!![]});if(!_0x1921e1)throw new Error(_0x38af('0x4a'));if(_0x1921e1[_0x38af('0x4b')]==='user'){var _0x489f74=_0xe5e1b2[_0x38af('0x49')]({'plain':!![]});var _0x315600=_0x38af('0x23');return db[_0x38af('0x4c')][_0x38af('0x45')]({'where':{'name':_0x315600,'userProfileId':_0x1921e1[_0x38af('0x4d')]},'raw':!![]})['then'](function(_0x50aa11){if(_0x50aa11&&_0x50aa11[_0x38af('0x4e')]===0x0){return db[_0x38af('0x24')]['create']({'name':_0x489f74['name'],'resourceId':_0x489f74['id'],'type':_0x50aa11[_0x38af('0x26')],'sectionId':_0x50aa11['id']},{})[_0x38af('0x22')](function(){return _0xe5e1b2;});}else{return _0xe5e1b2;}})[_0x38af('0x40')](function(_0x43f685){logger[_0x38af('0x25')](_0x38af('0x4f'),_0x43f685);throw _0x43f685;});}return _0xe5e1b2;})[_0x38af('0x22')](respondWithResult(_0x27d334,0xc9))[_0x38af('0x40')](handleError(_0x27d334,null));};exports[_0x38af('0x21')]=function(_0x5433fb,_0x5c9f2c){if(_0x5433fb[_0x38af('0x47')]['id']){delete _0x5433fb[_0x38af('0x47')]['id'];}return db[_0x38af('0x29')][_0x38af('0x45')]({'where':{'id':_0x5433fb[_0x38af('0x42')]['id']}})[_0x38af('0x22')](handleEntityNotFound(_0x5c9f2c,null))[_0x38af('0x22')](saveUpdates(_0x5433fb[_0x38af('0x47')],null))['then'](respondWithResult(_0x5c9f2c,null))[_0x38af('0x40')](handleError(_0x5c9f2c,null));};exports[_0x38af('0x50')]=function(_0x51b446,_0x2172ca){return db[_0x38af('0x29')][_0x38af('0x45')]({'where':{'id':_0x51b446[_0x38af('0x42')]['id']}})[_0x38af('0x22')](handleEntityNotFound(_0x2172ca,null))[_0x38af('0x22')](removeEntity(_0x2172ca,null))[_0x38af('0x40')](handleError(_0x2172ca,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2f9b821..bda33fd 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x52d8b9,_0x30d959){var _0x5d1ac9=function(_0x430853){while(--_0x430853){_0x52d8b9['push'](_0x52d8b9['shift']());}};_0x5d1ac9(++_0x30d959);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x5fc3[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x437d7f,_0x1feb46){_0x437d7f=_0x437d7f-0x0;var _0x31058c=_0x7fbe[_0x437d7f];return _0x31058c;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 8293555..d88b375 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x1404a9,_0x5b8994){var _0x529967=function(_0x511e64){while(--_0x511e64){_0x1404a9['push'](_0x1404a9['shift']());}};_0x529967(++_0x5b8994);}(_0xb10b,0x12a));var _0xbb10=function(_0x143cfd,_0x1a336e){_0x143cfd=_0x143cfd-0x0;var _0x2cb5f5=_0xb10b[_0x143cfd];return _0x2cb5f5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3b9d12,_0x3abc5a){var _0xc0f048=function(_0x44973e){while(--_0x44973e){_0x3b9d12['push'](_0x3b9d12['shift']());}};_0xc0f048(++_0x3abc5a);}(_0xb10b,0x12a));var _0xbb10=function(_0x113cf9,_0x358825){_0x113cf9=_0x113cf9-0x0;var _0x5842ad=_0xb10b[_0x113cf9];return _0x5842ad;};'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 77c9fd5..740c7c6 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 _0xa41a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','webhookGet','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','post','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0xa41a,0x6b));var _0xaa41=function(_0x13b6d7,_0x1dcf18){_0x13b6d7=_0x13b6d7-0x0;var _0x2b2815=_0xa41a[_0x13b6d7];return _0x2b2815;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/webhook',controller[_0xaa41('0xc')]);router[_0xaa41('0xd')]('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xd')](_0xaa41('0xf'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x10')]);var upload=multer({'storage':multer[_0xaa41('0x11')]({'destination':function(_0x423a19,_0x1c291e,_0x5c9fc7){_0x5c9fc7(null,path[_0xaa41('0x12')](config[_0xaa41('0x13')],'server/files/plugins'));},'filename':function(_0x54827c,_0x1d0a54,_0x518b5b){_0x1d0a54[_0xaa41('0x14')]=_0x1d0a54[_0xaa41('0x14')][_0xaa41('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x518b5b(null,util[_0xaa41('0x16')](_0xaa41('0x17'),path['basename'](_0x1d0a54[_0xaa41('0x14')],path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])),Date[_0xaa41('0x19')](),path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])));}})});router[_0xaa41('0x1a')]('/',upload['single'](_0xaa41('0x1b')),controller[_0xaa41('0x1c')]);router[_0xaa41('0x1a')](_0xaa41('0x1d'),controller[_0xaa41('0x1e')]);router[_0xaa41('0x1f')](_0xaa41('0x20'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x21')]);router['delete']('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0x22')]);module[_0xaa41('0x23')]=router; \ No newline at end of file +var _0x668b=['fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','webhookPost','put','update','/:id','delete','exports','multer','util','connect-timeout','express'];(function(_0x40f61c,_0x2752fe){var _0x4f1059=function(_0x504269){while(--_0x504269){_0x40f61c['push'](_0x40f61c['shift']());}};_0x4f1059(++_0x2752fe);}(_0x668b,0x140));var _0xb668=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0x668b[_0x35181c];return _0xe14bf9;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),controller[_0xb668('0xc')]);router[_0xb668('0xa')]('/:id',auth[_0xb668('0x8')](),controller[_0xb668('0xd')]);router[_0xb668('0xa')](_0xb668('0xe'),auth[_0xb668('0x8')](),controller[_0xb668('0xf')]);var upload=multer({'storage':multer[_0xb668('0x10')]({'destination':function(_0x3616e9,_0x567ea9,_0x3b15a6){_0x3b15a6(null,path[_0xb668('0x11')](config[_0xb668('0x12')],_0xb668('0x13')));},'filename':function(_0x16ca75,_0x167057,_0x1d111a){_0x167057[_0xb668('0x14')]=_0x167057[_0xb668('0x14')][_0xb668('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d111a(null,util[_0xb668('0x16')](_0xb668('0x17'),path[_0xb668('0x18')](_0x167057[_0xb668('0x14')],path[_0xb668('0x19')](_0x167057[_0xb668('0x14')])),Date[_0xb668('0x1a')](),path[_0xb668('0x19')](_0x167057[_0xb668('0x14')])));}})});router[_0xb668('0x1b')]('/',upload[_0xb668('0x1c')](_0xb668('0x1d')),controller['upload']);router[_0xb668('0x1b')]('/webhook',controller[_0xb668('0x1e')]);router[_0xb668('0x1f')]('/:id',auth[_0xb668('0x8')](),controller[_0xb668('0x20')]);router['delete'](_0xb668('0x21'),auth['isAuthenticated'](),controller[_0xb668('0x22')]);module[_0xb668('0x23')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 3f323c0..e2cbcb4 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 _0xdadf=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script'];(function(_0xc2bf73,_0x117f9d){var _0x3a37fd=function(_0x2c5031){while(--_0x2c5031){_0xc2bf73['push'](_0xc2bf73['shift']());}};_0x3a37fd(++_0x117f9d);}(_0xdadf,0x13d));var _0xfdad=function(_0x211feb,_0x2ad482){_0x211feb=_0x211feb-0x0;var _0x3a54bb=_0xdadf[_0x211feb];return _0x3a54bb;};'use strict';var Sequelize=require('sequelize');module[_0xfdad('0x0')]={'name':{'type':Sequelize[_0xfdad('0x1')]},'type':{'type':Sequelize[_0xfdad('0x2')](_0xfdad('0x3'),_0xfdad('0x4'))},'description':{'type':Sequelize[_0xfdad('0x5')]},'version':{'type':Sequelize[_0xfdad('0x5')]},'path':{'type':Sequelize[_0xfdad('0x1')],'comment':_0xfdad('0x6')},'active':{'type':Sequelize[_0xfdad('0x7')],'defaultValue':0x0,'comment':_0xfdad('0x8')},'sidebar':{'type':Sequelize[_0xfdad('0x2')](_0xfdad('0x9'),_0xfdad('0xa'),'always',_0xfdad('0xb')),'defaultValue':_0xfdad('0xc'),'comment':_0xfdad('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xfdad('0x1')]},'agentUrl':{'type':Sequelize[_0xfdad('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xfdad('0x1')]}}; \ No newline at end of file +var _0xeb50=['sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x151926,_0x1c66fb){var _0x3a2182=function(_0x88cb4c){while(--_0x88cb4c){_0x151926['push'](_0x151926['shift']());}};_0x3a2182(++_0x1c66fb);}(_0xeb50,0x177));var _0x0eb5=function(_0x78e522,_0x37c539){_0x78e522=_0x78e522-0x0;var _0x4a170d=_0xeb50[_0x78e522];return _0x4a170d;};'use strict';var Sequelize=require(_0x0eb5('0x0'));module[_0x0eb5('0x1')]={'name':{'type':Sequelize[_0x0eb5('0x2')]},'type':{'type':Sequelize[_0x0eb5('0x3')](_0x0eb5('0x4'),_0x0eb5('0x5'))},'description':{'type':Sequelize[_0x0eb5('0x6')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x0eb5('0x2')],'comment':_0x0eb5('0x7')},'active':{'type':Sequelize[_0x0eb5('0x8')],'defaultValue':0x0,'comment':_0x0eb5('0x9')},'sidebar':{'type':Sequelize[_0x0eb5('0x3')](_0x0eb5('0xa'),_0x0eb5('0xb'),_0x0eb5('0xc'),_0x0eb5('0xd')),'defaultValue':'always','comment':_0x0eb5('0xe')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x0eb5('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x0eb5('0x2')]},'scriptPath':{'type':Sequelize[_0x0eb5('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 04614b3..f6bdf6e 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 _0xd0d0=['localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','get','Plugins','UserProfileResource','then','name','map','Plugin','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','catch','show','params','include','download','join','root','server/files/plugins','%s.zip','createWriteStream','zip','warning','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','plugins','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','update','body','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis'];(function(_0x208cdd,_0x44b7e6){var _0x155287=function(_0x4713f4){while(--_0x4713f4){_0x208cdd['push'](_0x208cdd['shift']());}};_0x155287(++_0x44b7e6);}(_0xd0d0,0x133));var _0x0d0d=function(_0xa57213,_0x2eadde){_0xa57213=_0xa57213-0x0;var _0x328828=_0xd0d0[_0xa57213];return _0x328828;};'use strict';var emlformat=require(_0x0d0d('0x0'));var rimraf=require(_0x0d0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d0d('0x2'));var rp=require(_0x0d0d('0x3'));var moment=require('moment');var BPromise=require(_0x0d0d('0x4'));var Mustache=require(_0x0d0d('0x5'));var util=require(_0x0d0d('0x6'));var path=require(_0x0d0d('0x7'));var sox=require(_0x0d0d('0x8'));var csv=require('to-csv');var ejs=require(_0x0d0d('0x9'));var fs=require('fs');var fs_extra=require(_0x0d0d('0xa'));var _=require(_0x0d0d('0xb'));var squel=require(_0x0d0d('0xc'));var crypto=require(_0x0d0d('0xd'));var jsforce=require(_0x0d0d('0xe'));var deskjs=require(_0x0d0d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0d0d('0x10'));var Papa=require('papaparse');var extract=require(_0x0d0d('0x11'));var rimraf=require(_0x0d0d('0x1'));var archiver=require('archiver');var Redis=require(_0x0d0d('0x12'));var authService=require(_0x0d0d('0x13'));var qs=require(_0x0d0d('0x14'));var as=require(_0x0d0d('0x15'));var hardwareService=require(_0x0d0d('0x16'));var logger=require(_0x0d0d('0x17'))(_0x0d0d('0x18'));var utils=require(_0x0d0d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0d0d('0x1a'));var db=require(_0x0d0d('0x1b'))['db'];config[_0x0d0d('0x1c')]=_['defaults'](config[_0x0d0d('0x1c')],{'host':_0x0d0d('0x1d'),'port':0x18eb});var socket=require(_0x0d0d('0x1e'))(new Redis(config[_0x0d0d('0x1c')]));require('./plugin.socket')[_0x0d0d('0x1f')](socket);function respondWithStatusCode(_0x472f89,_0x542c52){_0x542c52=_0x542c52||0xcc;return function(_0x27ff97){if(_0x27ff97){return _0x472f89[_0x0d0d('0x20')](_0x542c52);}return _0x472f89[_0x0d0d('0x21')](_0x542c52)[_0x0d0d('0x22')]();};}function respondWithResult(_0x3f139b,_0x3daa37){_0x3daa37=_0x3daa37||0xc8;return function(_0x50f816){if(_0x50f816){return _0x3f139b[_0x0d0d('0x21')](_0x3daa37)[_0x0d0d('0x23')](_0x50f816);}};}function respondWithFilteredResult(_0xc5eb45,_0x559e78){return function(_0x33b80b){if(_0x33b80b){var _0x577535=typeof _0x559e78[_0x0d0d('0x24')]===_0x0d0d('0x25')&&typeof _0x559e78[_0x0d0d('0x26')]===_0x0d0d('0x25');var _0x4b261a=_0x33b80b[_0x0d0d('0x27')];var _0x40e5df=_0x577535?0x0:_0x559e78[_0x0d0d('0x24')];var _0x1bc4a6=_0x577535?_0x33b80b[_0x0d0d('0x27')]:_0x559e78[_0x0d0d('0x24')]+_0x559e78['limit'];var _0x36363c;if(_0x1bc4a6>=_0x4b261a){_0x1bc4a6=_0x4b261a;_0x36363c=0xc8;}else{_0x36363c=0xce;}_0xc5eb45[_0x0d0d('0x21')](_0x36363c);return _0xc5eb45[_0x0d0d('0x28')](_0x0d0d('0x29'),_0x40e5df+'-'+_0x1bc4a6+'/'+_0x4b261a)['json'](_0x33b80b);}return null;};}function patchUpdates(_0x348bf8){return function(_0x3fdda3){try{jsonpatch[_0x0d0d('0x2a')](_0x3fdda3,_0x348bf8,!![]);}catch(_0x1a1821){return BPromise[_0x0d0d('0x2b')](_0x1a1821);}return _0x3fdda3['save']();};}function saveUpdates(_0x58d4d9,_0x571090){return function(_0x4152d8){if(_0x4152d8){return _0x4152d8['update'](_0x58d4d9)['then'](function(_0xe7a94){return _0xe7a94;});}return null;};}function removeEntity(_0x2179c8,_0x443213){return function(_0x57cd93){if(_0x57cd93){return _0x57cd93[_0x0d0d('0x2c')]()['then'](function(){var _0x5ad98c=_0x57cd93[_0x0d0d('0x2d')]({'plain':!![]});var _0x428c1b=_0x0d0d('0x2e');return db[_0x0d0d('0x2f')][_0x0d0d('0x2c')]({'where':{'type':_0x428c1b,'resourceId':_0x5ad98c['id']}})[_0x0d0d('0x30')](function(){return _0x57cd93;});})[_0x0d0d('0x30')](function(){_0x2179c8[_0x0d0d('0x21')](0xcc)[_0x0d0d('0x22')]();});}};}function handleEntityNotFound(_0x2d68a5,_0x4523d8){return function(_0x23537c){if(!_0x23537c){_0x2d68a5[_0x0d0d('0x20')](0x194);}return _0x23537c;};}function handleError(_0x11ace3,_0x3e8a2e){_0x3e8a2e=_0x3e8a2e||0x1f4;return function(_0x1ad9ba){logger['error'](_0x1ad9ba['stack']);if(_0x1ad9ba[_0x0d0d('0x31')]){delete _0x1ad9ba[_0x0d0d('0x31')];}_0x11ace3[_0x0d0d('0x21')](_0x3e8a2e)['send'](_0x1ad9ba);};}exports['index']=function(_0x4feb26,_0x19bf37){var _0x2fc3c8={},_0x2845ea={},_0x135419={'count':0x0,'rows':[]};var _0x1852f4=_[_0x0d0d('0x32')](db[_0x0d0d('0x33')][_0x0d0d('0x34')],function(_0x1a3233){return{'name':_0x1a3233[_0x0d0d('0x35')],'type':_0x1a3233['type'][_0x0d0d('0x36')]};});_0x2845ea['model']=_[_0x0d0d('0x32')](_0x1852f4,_0x0d0d('0x31'));_0x2845ea[_0x0d0d('0x37')]=_[_0x0d0d('0x38')](_0x4feb26[_0x0d0d('0x37')]);_0x2845ea[_0x0d0d('0x39')]=_[_0x0d0d('0x3a')](_0x2845ea[_0x0d0d('0x3b')],_0x2845ea[_0x0d0d('0x37')]);_0x2fc3c8[_0x0d0d('0x3c')]=_[_0x0d0d('0x3a')](_0x2845ea[_0x0d0d('0x3b')],qs[_0x0d0d('0x3d')](_0x4feb26[_0x0d0d('0x37')][_0x0d0d('0x3d')]));_0x2fc3c8[_0x0d0d('0x3c')]=_0x2fc3c8['attributes'][_0x0d0d('0x3e')]?_0x2fc3c8['attributes']:_0x2845ea[_0x0d0d('0x3b')];if(!_0x4feb26[_0x0d0d('0x37')][_0x0d0d('0x3f')]('nolimit')){_0x2fc3c8[_0x0d0d('0x26')]=qs[_0x0d0d('0x26')](_0x4feb26[_0x0d0d('0x37')][_0x0d0d('0x26')]);_0x2fc3c8[_0x0d0d('0x24')]=qs[_0x0d0d('0x24')](_0x4feb26[_0x0d0d('0x37')][_0x0d0d('0x24')]);}_0x2fc3c8[_0x0d0d('0x40')]=qs['sort'](_0x4feb26['query'][_0x0d0d('0x41')]);_0x2fc3c8[_0x0d0d('0x42')]=qs[_0x0d0d('0x39')](_[_0x0d0d('0x43')](_0x4feb26[_0x0d0d('0x37')],_0x2845ea[_0x0d0d('0x39')]),_0x1852f4);if(_0x4feb26[_0x0d0d('0x37')][_0x0d0d('0x44')]){_0x2fc3c8[_0x0d0d('0x42')]=_['merge'](_0x2fc3c8['where'],{'$or':_[_0x0d0d('0x32')](_0x1852f4,function(_0x5a5acc){if(_0x5a5acc[_0x0d0d('0x45')]!==_0x0d0d('0x46')){var _0x4fd0e5={};_0x4fd0e5[_0x5a5acc[_0x0d0d('0x31')]]={'$like':'%'+_0x4feb26[_0x0d0d('0x37')][_0x0d0d('0x44')]+'%'};return _0x4fd0e5;}})});}_0x2fc3c8=_[_0x0d0d('0x47')]({},_0x2fc3c8,_0x4feb26[_0x0d0d('0x48')]);var _0x395255={'where':_0x2fc3c8[_0x0d0d('0x42')]};return db[_0x0d0d('0x33')]['count'](_0x395255)[_0x0d0d('0x30')](function(_0x2d32a2){_0x135419['count']=_0x2d32a2;if(_0x4feb26[_0x0d0d('0x37')]['includeAll']){_0x2fc3c8['include']=[{'all':!![]}];}return db[_0x0d0d('0x33')]['findAll'](_0x2fc3c8);})[_0x0d0d('0x30')](function(_0x446c9a){_0x135419['rows']=_0x446c9a;return _0x135419;})[_0x0d0d('0x30')](respondWithFilteredResult(_0x19bf37,_0x2fc3c8))[_0x0d0d('0x49')](handleError(_0x19bf37,null));};exports[_0x0d0d('0x4a')]=function(_0x5bfbb9,_0x5c0cdd){var _0x530e05={'raw':!![],'where':{'id':_0x5bfbb9[_0x0d0d('0x4b')]['id']}},_0x19dcd0={};_0x19dcd0[_0x0d0d('0x3b')]=_['keys'](db['Plugin'][_0x0d0d('0x34')]);_0x19dcd0[_0x0d0d('0x37')]=_[_0x0d0d('0x38')](_0x5bfbb9[_0x0d0d('0x37')]);_0x19dcd0['filters']=_['intersection'](_0x19dcd0[_0x0d0d('0x3b')],_0x19dcd0['query']);_0x530e05[_0x0d0d('0x3c')]=_[_0x0d0d('0x3a')](_0x19dcd0[_0x0d0d('0x3b')],qs[_0x0d0d('0x3d')](_0x5bfbb9[_0x0d0d('0x37')]['fields']));_0x530e05['attributes']=_0x530e05[_0x0d0d('0x3c')][_0x0d0d('0x3e')]?_0x530e05[_0x0d0d('0x3c')]:_0x19dcd0[_0x0d0d('0x3b')];if(_0x5bfbb9[_0x0d0d('0x37')]['includeAll']){_0x530e05[_0x0d0d('0x4c')]=[{'all':!![]}];}_0x530e05=_[_0x0d0d('0x47')]({},_0x530e05,_0x5bfbb9[_0x0d0d('0x48')]);return db[_0x0d0d('0x33')]['find'](_0x530e05)[_0x0d0d('0x30')](handleEntityNotFound(_0x5c0cdd,null))[_0x0d0d('0x30')](respondWithResult(_0x5c0cdd,null))[_0x0d0d('0x49')](handleError(_0x5c0cdd,null));};exports[_0x0d0d('0x4d')]=function(_0x5488e4,_0x9a35e7,_0x52681a){return db['Plugin']['find']({'where':{'id':_0x5488e4['params']['id']},'attributes':[_0x0d0d('0x31'),'path'],'raw':!![]})[_0x0d0d('0x30')](handleEntityNotFound(_0x9a35e7,null))[_0x0d0d('0x30')](function(_0x14b338){if(_0x14b338){var _0xbbffba=path[_0x0d0d('0x4e')](config[_0x0d0d('0x4f')],_0x0d0d('0x50'),util['format'](_0x0d0d('0x51'),path['basename'](_0x14b338[_0x0d0d('0x7')])));var _0x1aa8f1=fs[_0x0d0d('0x52')](_0xbbffba);var _0x52c2c6=archiver(_0x0d0d('0x53'),{'zlib':{'level':0x9}});_0x52c2c6['on'](_0x0d0d('0x54'),function(_0x3686c5){if(_0x3686c5[_0x0d0d('0x55')]==='ENOENT'){logger[_0x0d0d('0x56')](_0x3686c5);}else{throw new db[(_0x0d0d('0x57'))][(_0x0d0d('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x52c2c6['on'](_0x0d0d('0x56'),function(_0x50f0d1){throw new db[(_0x0d0d('0x57'))]['Error'](_0x0d0d('0x59'));});_0x52c2c6[_0x0d0d('0x5a')](_0x1aa8f1);_0x52c2c6[_0x0d0d('0x5b')](_0x0d0d('0x5c'),{'cwd':path[_0x0d0d('0x4e')](config[_0x0d0d('0x4f')],_0x0d0d('0x50'),path[_0x0d0d('0x5d')](_0x14b338['path'])),'ignore':[path[_0x0d0d('0x4e')](path[_0x0d0d('0x5e')](_0x14b338[_0x0d0d('0x7')]),_0x0d0d('0x5f')),path[_0x0d0d('0x4e')](path[_0x0d0d('0x5e')](_0x14b338[_0x0d0d('0x7')]),_0x0d0d('0x60'))],'nodir':!![]})[_0x0d0d('0x61')]();_0x1aa8f1['on'](_0x0d0d('0x62'),function(){if(!fs[_0x0d0d('0x63')](_0xbbffba)){throw new db[(_0x0d0d('0x57'))][(_0x0d0d('0x58'))](_0x0d0d('0x64'));}return _0x9a35e7[_0x0d0d('0x4d')](_0xbbffba,util[_0x0d0d('0x65')](_0x0d0d('0x51'),path[_0x0d0d('0x5e')](_0x14b338['path'])),function(_0x291909){if(_0x291909){throw new db[(_0x0d0d('0x57'))][(_0x0d0d('0x58'))](_0x0d0d('0x66'));}fs['unlinkSync'](_0xbbffba);logger['info'](_0x0d0d('0x67'));logger[_0x0d0d('0x68')](_0x0d0d('0x69'));});});}return null;})[_0x0d0d('0x49')](handleError(_0x9a35e7,null));};exports[_0x0d0d('0x6a')]=function(_0x52a9d1,_0x33b5b5,_0x4112a7){var _0x34d7cc=path['basename'](_0x52a9d1[_0x0d0d('0x6b')][_0x0d0d('0x6c')],path[_0x0d0d('0x6d')](_0x52a9d1[_0x0d0d('0x6b')][_0x0d0d('0x6c')]));var _0x156bfa=path[_0x0d0d('0x4e')](config[_0x0d0d('0x4f')],_0x0d0d('0x50'),_0x52a9d1['file']['filename']);var _0x37c941=path[_0x0d0d('0x4e')](config[_0x0d0d('0x4f')],'server/files/plugins',_0x34d7cc);logger[_0x0d0d('0x68')](_0x0d0d('0x6e'),_0x156bfa);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x37c941);try{fs[_0x0d0d('0x6f')](_0x156bfa,parseInt(_0x0d0d('0x70'),0x8));extract(_0x156bfa,{'dir':_0x37c941},function(_0x164f42){if(_0x164f42){logger[_0x0d0d('0x56')](_0x164f42);handleError(_0x164f42,!![]);};var _0x17a4a3=fs['readdirSync'](_0x37c941);if(_0x17a4a3[_0x0d0d('0x3e')]>0x1){removeReferences(_0x156bfa,_0x37c941);logger['error'](_0x0d0d('0x71'));return _0x4112a7(new Error(_0x0d0d('0x71')));}var _0x42f890=fs[_0x0d0d('0x72')](path[_0x0d0d('0x4e')](_0x37c941,_0x17a4a3[0x0]));if(_0x42f890[_0x0d0d('0x73')]()){removeReferences(_0x156bfa,_0x37c941);logger['error']('Invalid\x20plugin\x20structure');return _0x4112a7(new Error(_0x0d0d('0x71')));}if(_0x42f890[_0x0d0d('0x74')]()){var _0x462df7=fs[_0x0d0d('0x75')](path[_0x0d0d('0x4e')](_0x37c941,_0x17a4a3[0x0]));if(_0x462df7[_0x0d0d('0x3e')]===0x0){removeReferences(_0x156bfa,_0x37c941);logger[_0x0d0d('0x56')](_0x0d0d('0x71'));return _0x4112a7(new Error(_0x0d0d('0x71')));}var _0x3aa601=_0x462df7['some'](function(_0x3b0dd3){return _0x3b0dd3===_0x0d0d('0x76');});if(!_0x3aa601){return _0x4112a7(new Error('Plugin\x20manifest\x20missing'));}var _0x4b6dcf=fs['readFileSync'](path['join'](_0x37c941,_0x17a4a3[0x0],_0x0d0d('0x76')));var _0x370259=JSON['parse'](_0x4b6dcf);if(_0x0d0d('0x25')==typeof _0x370259[_0x0d0d('0x31')]){return _0x4112a7(new Error(_0x0d0d('0x77')));}if(_0x0d0d('0x25')==typeof _0x370259[_0x0d0d('0x45')]){return _0x4112a7(new Error(_0x0d0d('0x78')));}if(_0x0d0d('0x25')==typeof _0x370259[_0x0d0d('0x79')]){return _0x4112a7(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x370259['parameters']){return _0x4112a7(new Error(_0x0d0d('0x7a')));}if(_0x370259[_0x0d0d('0x45')]===_0x0d0d('0x7b')){if('undefined'==typeof _0x370259[_0x0d0d('0x7c')][_0x0d0d('0x7d')]){return _0x4112a7(new Error(_0x0d0d('0x7e')));}if(_0x0d0d('0x25')==typeof _0x370259[_0x0d0d('0x7c')][_0x0d0d('0x7d')][_0x0d0d('0x7f')]&&_0x0d0d('0x25')==typeof _0x370259[_0x0d0d('0x7c')][_0x0d0d('0x7d')]['agent']){return _0x4112a7(new Error(_0x0d0d('0x80')));}}else if(_0x370259[_0x0d0d('0x45')]==='script'){if(_0x0d0d('0x25')==typeof _0x370259[_0x0d0d('0x7c')][_0x0d0d('0x81')]){return _0x4112a7(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x370259['parameters'][_0x0d0d('0x82')]){return _0x4112a7(new Error(_0x0d0d('0x83')));}}else{return _0x4112a7(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x17b1b1=_0x370259['name'];var _0x2a1590=_0x370259[_0x0d0d('0x84')];var _0x2d5173=_0x370259[_0x0d0d('0x45')];var _0x41df35=_0x370259[_0x0d0d('0x85')]?_0x370259[_0x0d0d('0x85')]:'always';var _0xfee654=_0x370259[_0x0d0d('0x86')]?_0x370259[_0x0d0d('0x86')]:_0x0d0d('0x87');var _0x305f95='';var _0xeea2e3='';var _0xff902f='';var _0x35dc91='';var _0x19812c=_0x370259['version'];if(_0x2d5173===_0x0d0d('0x7b')){if(_0x0d0d('0x25')!=typeof _0x370259['parameters'][_0x0d0d('0x7d')][_0x0d0d('0x7f')]){var _0x358e58=_0x370259['parameters'][_0x0d0d('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0d0d('0x88')](_0x358e58)){_0x305f95=path[_0x0d0d('0x4e')]('plugins',_0x34d7cc,_0x17a4a3[0x0],_0x358e58);}else{_0x305f95=_0x358e58;}}else{logger['info'](_0x0d0d('0x89'));}if('undefined'!=typeof _0x370259[_0x0d0d('0x7c')]['views']['agent']){var _0x21e1af=_0x370259[_0x0d0d('0x7c')][_0x0d0d('0x7d')][_0x0d0d('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x0d0d('0x88')](_0x21e1af)){_0xeea2e3=path[_0x0d0d('0x4e')]('plugins',_0x34d7cc,_0x17a4a3[0x0],_0x21e1af);}else{_0xeea2e3=_0x21e1af;}}else{logger['info'](_0x0d0d('0x8b'));}}else if(_0x2d5173==='script'){_0xff902f=_0x370259[_0x0d0d('0x7c')][_0x0d0d('0x81')];_0x35dc91=_0x370259['parameters'][_0x0d0d('0x82')];if(_0x0d0d('0x25')!=typeof _0x370259['parameters'][_0x0d0d('0x7d')]){if(_0x0d0d('0x25')!=typeof _0x370259[_0x0d0d('0x7c')][_0x0d0d('0x7d')]['admin']){var _0x358e58=_0x370259[_0x0d0d('0x7c')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x358e58)){_0x305f95=path[_0x0d0d('0x4e')](_0x0d0d('0x8c'),_0x34d7cc,_0x17a4a3[0x0],_0x358e58);}else{_0x305f95=_0x358e58;}}if(_0x0d0d('0x25')!=typeof _0x370259[_0x0d0d('0x7c')]['views'][_0x0d0d('0x8a')]){var _0x21e1af=_0x370259[_0x0d0d('0x7c')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x21e1af)){_0xeea2e3=path[_0x0d0d('0x4e')]('plugins',_0x34d7cc,_0x17a4a3[0x0],_0x21e1af);}else{_0xeea2e3=_0x21e1af;}}}}var _0x439446={'name':_0x17b1b1,'description':_0x2a1590,'path':path[_0x0d0d('0x4e')](_0x34d7cc,_0x17a4a3[0x0]),'type':_0x2d5173,'sidebar':_0x41df35,'icon':_0xfee654,'adminUrl':_0x305f95,'agentUrl':_0xeea2e3,'scriptName':_0xff902f,'scriptPath':_0x35dc91,'version':_0x19812c};removeReferences(_0x156bfa,null);return db[_0x0d0d('0x33')]['create'](_0x439446)['then'](function(_0x207b7a){var _0x279d82={'role':_0x52a9d1['body'][_0x0d0d('0x8d')],'userProfileId':_0x52a9d1['body']['userProfileId']};if(!_0x279d82)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x279d82[_0x0d0d('0x8d')]==='user'){var _0x43d8c3=_0x207b7a['get']({'plain':!![]});return db[_0x0d0d('0x8e')][_0x0d0d('0x8f')]({'where':{'name':_0x0d0d('0x2e'),'userProfileId':_0x279d82[_0x0d0d('0x90')]},'raw':!![]})[_0x0d0d('0x30')](function(_0x93e754){if(_0x93e754&&_0x93e754['autoAssociation']===0x0){return db['UserProfileResource'][_0x0d0d('0x91')]({'name':_0x43d8c3['name'],'resourceId':_0x43d8c3['id'],'type':_0x93e754[_0x0d0d('0x31')],'sectionId':_0x93e754['id']},{})[_0x0d0d('0x30')](function(){return _0x207b7a;});}else{return _0x207b7a;}})['catch'](function(_0x432b7e){logger['error'](_0x0d0d('0x92'),_0x432b7e);throw _0x432b7e;});}return _0x207b7a;})[_0x0d0d('0x30')](respondWithResult(_0x33b5b5,null))[_0x0d0d('0x49')](handleError(_0x33b5b5,null));}});}catch(_0x247786){_0x33b5b5[_0x0d0d('0x21')](0x1f4)[_0x0d0d('0x93')](_0x247786);}};function removeReferences(_0x3e60d7,_0x1cfcfc){try{if(_0x3e60d7){fs[_0x0d0d('0x94')](_0x3e60d7);logger['info'](_0x0d0d('0x95'));}if(_0x1cfcfc){rimraf(_0x1cfcfc,function(){});logger[_0x0d0d('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x524dfa){logger[_0x0d0d('0x56')](_0x524dfa);}}exports[_0x0d0d('0x96')]=function(_0xf51625,_0x13f779,_0x1db6fe){return db['Plugin'][_0x0d0d('0x8f')]({'where':{'id':_0xf51625['params']['id']}})['then'](handleEntityNotFound(_0x13f779,null))[_0x0d0d('0x30')](saveUpdates(_0xf51625[_0x0d0d('0x97')],null))['then'](respondWithResult(_0x13f779,null))[_0x0d0d('0x49')](handleError(_0x13f779,null));};exports[_0x0d0d('0x98')]=function(_0x223d11,_0x563287,_0x26a972){return db[_0x0d0d('0x33')]['find']({'where':{'id':_0x223d11['params']['id']}})[_0x0d0d('0x30')](function(_0x1ad91d){if(_0x1ad91d){return _0x1ad91d[_0x0d0d('0x2c')]();}})[_0x0d0d('0x30')](function(_0x37d395){rimraf(path[_0x0d0d('0x4e')](config[_0x0d0d('0x4f')],_0x0d0d('0x50'),path['dirname'](_0x37d395[_0x0d0d('0x7')])),function(){});return _0x37d395;})[_0x0d0d('0x30')](handleEntityNotFound(_0x563287,null))[_0x0d0d('0x30')](respondWithStatusCode(_0x563287,null))['catch'](handleError(_0x563287,null));};exports[_0x0d0d('0x99')]=function(_0x44520f,_0x458cae,_0x182f87){return BPromise[_0x0d0d('0x9a')]()[_0x0d0d('0x30')](function(){if(!_0x44520f[_0x0d0d('0x37')][_0x0d0d('0x7')]){throw new Error(_0x0d0d('0x9b'));}if(!_0x44520f[_0x0d0d('0x37')][_0x0d0d('0x9c')]){throw new Error(_0x0d0d('0x9d'));}var _0xc4a76f=_0x44520f[_0x0d0d('0x37')][_0x0d0d('0x9e')]?_0x44520f[_0x0d0d('0x37')][_0x0d0d('0x9e')]+':'+_0x44520f[_0x0d0d('0x37')][_0x0d0d('0x9c')]:_0x0d0d('0x9f')+_0x44520f[_0x0d0d('0x37')][_0x0d0d('0x9c')];var _0x101fe2=_0x44520f[_0x0d0d('0x37')]['json']?_0x44520f[_0x0d0d('0x37')][_0x0d0d('0x23')]:!![];var _0x54d6cb=_0x44520f[_0x0d0d('0x37')][_0x0d0d('0xa0')]?_0x44520f['query'][_0x0d0d('0xa0')]:null;var _0x2f5c87={'method':_0x44520f['method'],'uri':util[_0x0d0d('0x65')](_0x0d0d('0xa1'),_0xc4a76f,_0x44520f[_0x0d0d('0x37')]['path']),'json':_0x101fe2,'resolveWithFullResponse':!![],'encoding':_0x54d6cb,'qs':_0x44520f[_0x0d0d('0x37')]};if(_0x44520f[_0x0d0d('0xa2')]){_0x2f5c87[_0x0d0d('0xa2')]=_0x44520f['headers'];if(_0x2f5c87[_0x0d0d('0xa2')][_0x0d0d('0xa3')]){delete _0x2f5c87['headers'][_0x0d0d('0xa3')];}}if(_0x2f5c87['headers'][_0x0d0d('0xa4')]){delete _0x2f5c87[_0x0d0d('0xa2')]['content-type'];}return rp(_0x2f5c87);})[_0x0d0d('0x30')](function(_0x547265){if(_0x547265){_0x458cae[_0x0d0d('0x28')](_0x547265[_0x0d0d('0xa2')]);logger[_0x0d0d('0x68')](_0x547265[_0x0d0d('0x97')]);if(_[_0x0d0d('0xa5')](_0x44520f[_0x0d0d('0x37')][_0x0d0d('0x7')],_0x0d0d('0x4d'))&&_0x547265[_0x0d0d('0xa6')]==0x1f4){return _0x458cae[_0x0d0d('0x20')](_0x547265[_0x0d0d('0xa6')]);}else{return _0x458cae[_0x0d0d('0x21')](_0x547265['statusCode'])[_0x0d0d('0x93')](_0x547265[_0x0d0d('0x97')]);}}else{return _0x458cae[_0x0d0d('0x20')](0xc8);}})['catch'](handleError(_0x458cae,null));};exports[_0x0d0d('0xa7')]=function(_0x3dfd9a,_0x3db1a2,_0xbe9c8b){return BPromise['resolve']()[_0x0d0d('0x30')](function(){if(!_0x3dfd9a[_0x0d0d('0x37')]['path']){throw new Error(_0x0d0d('0x9b'));}if(!_0x3dfd9a[_0x0d0d('0x37')][_0x0d0d('0x9c')]){throw new Error(_0x0d0d('0x9d'));}var _0x9d68b4=_0x3dfd9a[_0x0d0d('0x37')][_0x0d0d('0x9e')]?_0x3dfd9a[_0x0d0d('0x37')][_0x0d0d('0x9e')]+':'+_0x3dfd9a[_0x0d0d('0x37')][_0x0d0d('0x9c')]:_0x0d0d('0x9f')+_0x3dfd9a[_0x0d0d('0x37')]['port'];var _0x563a4c=_0x3dfd9a[_0x0d0d('0x37')][_0x0d0d('0x23')]?_0x3dfd9a['query'][_0x0d0d('0x23')]:!![];var _0xf72a62=_0x3dfd9a[_0x0d0d('0x37')][_0x0d0d('0xa0')]?_0x3dfd9a[_0x0d0d('0x37')][_0x0d0d('0xa0')]:null;var _0x114d92={'method':_0x3dfd9a['method'],'uri':util[_0x0d0d('0x65')](_0x0d0d('0xa1'),_0x9d68b4,_0x3dfd9a[_0x0d0d('0x37')][_0x0d0d('0x7')]),'json':_0x563a4c,'resolveWithFullResponse':!![],'encoding':_0xf72a62,'body':_0x3dfd9a[_0x0d0d('0x97')]};if(_0x3dfd9a[_0x0d0d('0xa2')]){_0x114d92[_0x0d0d('0xa2')]=_0x3dfd9a['headers'];if(_0x114d92[_0x0d0d('0xa2')][_0x0d0d('0xa3')]){delete _0x114d92[_0x0d0d('0xa2')][_0x0d0d('0xa3')];}}if(_0x114d92['headers']['content-type']){delete _0x114d92[_0x0d0d('0xa2')][_0x0d0d('0xa4')];}return rp(_0x114d92);})[_0x0d0d('0x30')](function(_0x3c9ab0){if(_0x3c9ab0){_0x3db1a2[_0x0d0d('0x28')](_0x3c9ab0[_0x0d0d('0xa2')]);logger['info'](_0x3c9ab0[_0x0d0d('0x97')]);return _0x3db1a2[_0x0d0d('0x21')](_0x3c9ab0['statusCode'])[_0x0d0d('0x93')](_0x3c9ab0[_0x0d0d('0x97')]);}else{return _0x3db1a2[_0x0d0d('0x20')](0xc8);}})['catch'](handleError(_0x3db1a2,null));}; \ No newline at end of file +var _0x55a6=['Plugin','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','download','find','join','root','server/files/plugins','%s.zip','createWriteStream','zip','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','icon-apps','test','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','headers','content-type','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','method','%s%s','content-length','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./plugin.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Plugins','end','stack','name','send','map'];(function(_0x1e8366,_0x4d57e8){var _0xa22330=function(_0x45edc9){while(--_0x45edc9){_0x1e8366['push'](_0x1e8366['shift']());}};_0xa22330(++_0x4d57e8);}(_0x55a6,0x75));var _0x655a=function(_0x53e368,_0xfc9c6c){_0x53e368=_0x53e368-0x0;var _0x53af6a=_0x55a6[_0x53e368];return _0x53af6a;};'use strict';var emlformat=require(_0x655a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x655a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x655a('0x2'));var moment=require(_0x655a('0x3'));var BPromise=require(_0x655a('0x4'));var Mustache=require(_0x655a('0x5'));var util=require(_0x655a('0x6'));var path=require(_0x655a('0x7'));var sox=require(_0x655a('0x8'));var csv=require('to-csv');var ejs=require(_0x655a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x655a('0xa'));var squel=require(_0x655a('0xb'));var crypto=require(_0x655a('0xc'));var jsforce=require(_0x655a('0xd'));var deskjs=require(_0x655a('0xe'));var toCsv=require(_0x655a('0xf'));var querystring=require(_0x655a('0x10'));var Papa=require(_0x655a('0x11'));var extract=require(_0x655a('0x12'));var rimraf=require(_0x655a('0x13'));var archiver=require('archiver');var Redis=require(_0x655a('0x14'));var authService=require(_0x655a('0x15'));var qs=require(_0x655a('0x16'));var as=require(_0x655a('0x17'));var hardwareService=require(_0x655a('0x18'));var logger=require('../../config/logger')(_0x655a('0x19'));var utils=require(_0x655a('0x1a'));var config=require(_0x655a('0x1b'));var licenseUtil=require(_0x655a('0x1c'));var db=require('../../mysqldb')['db'];config[_0x655a('0x1d')]=_['defaults'](config[_0x655a('0x1d')],{'host':_0x655a('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x655a('0x1d')]));require(_0x655a('0x1f'))[_0x655a('0x20')](socket);function respondWithStatusCode(_0x4b9660,_0x5e06e3){_0x5e06e3=_0x5e06e3||0xcc;return function(_0x5a4b78){if(_0x5a4b78){return _0x4b9660[_0x655a('0x21')](_0x5e06e3);}return _0x4b9660[_0x655a('0x22')](_0x5e06e3)['end']();};}function respondWithResult(_0x436f39,_0x5e3a91){_0x5e3a91=_0x5e3a91||0xc8;return function(_0x5e30b7){if(_0x5e30b7){return _0x436f39[_0x655a('0x22')](_0x5e3a91)[_0x655a('0x23')](_0x5e30b7);}};}function respondWithFilteredResult(_0x4a8d6f,_0x4ff88c){return function(_0x37b8ef){if(_0x37b8ef){var _0xb1fd0f=typeof _0x4ff88c[_0x655a('0x24')]==='undefined'&&typeof _0x4ff88c[_0x655a('0x25')]===_0x655a('0x26');var _0x47346b=_0x37b8ef[_0x655a('0x27')];var _0x1ee5e2=_0xb1fd0f?0x0:_0x4ff88c[_0x655a('0x24')];var _0x2c649b=_0xb1fd0f?_0x37b8ef[_0x655a('0x27')]:_0x4ff88c[_0x655a('0x24')]+_0x4ff88c['limit'];var _0x392c40;if(_0x2c649b>=_0x47346b){_0x2c649b=_0x47346b;_0x392c40=0xc8;}else{_0x392c40=0xce;}_0x4a8d6f['status'](_0x392c40);return _0x4a8d6f[_0x655a('0x28')]('Content-Range',_0x1ee5e2+'-'+_0x2c649b+'/'+_0x47346b)[_0x655a('0x23')](_0x37b8ef);}return null;};}function patchUpdates(_0x4dcc93){return function(_0x8a1c2){try{jsonpatch[_0x655a('0x29')](_0x8a1c2,_0x4dcc93,!![]);}catch(_0x3b06f0){return BPromise[_0x655a('0x2a')](_0x3b06f0);}return _0x8a1c2[_0x655a('0x2b')]();};}function saveUpdates(_0x4b9b8d,_0x15c47a){return function(_0x3d29d5){if(_0x3d29d5){return _0x3d29d5[_0x655a('0x2c')](_0x4b9b8d)[_0x655a('0x2d')](function(_0x323cac){return _0x323cac;});}return null;};}function removeEntity(_0x2f2e70,_0x5bc912){return function(_0x11b557){if(_0x11b557){return _0x11b557[_0x655a('0x2e')]()[_0x655a('0x2d')](function(){var _0x37f50c=_0x11b557[_0x655a('0x2f')]({'plain':!![]});var _0x5cfc13=_0x655a('0x30');return db['UserProfileResource'][_0x655a('0x2e')]({'where':{'type':_0x5cfc13,'resourceId':_0x37f50c['id']}})[_0x655a('0x2d')](function(){return _0x11b557;});})[_0x655a('0x2d')](function(){_0x2f2e70[_0x655a('0x22')](0xcc)[_0x655a('0x31')]();});}};}function handleEntityNotFound(_0xf22428,_0x2da505){return function(_0x5d254a){if(!_0x5d254a){_0xf22428[_0x655a('0x21')](0x194);}return _0x5d254a;};}function handleError(_0x3d81eb,_0x531591){_0x531591=_0x531591||0x1f4;return function(_0x2fc0f6){logger['error'](_0x2fc0f6[_0x655a('0x32')]);if(_0x2fc0f6[_0x655a('0x33')]){delete _0x2fc0f6[_0x655a('0x33')];}_0x3d81eb['status'](_0x531591)[_0x655a('0x34')](_0x2fc0f6);};}exports['index']=function(_0x5e990e,_0x1e8c60){var _0x54ac90={},_0x37f62c={},_0x3268a0={'count':0x0,'rows':[]};var _0x2b4b0f=_[_0x655a('0x35')](db[_0x655a('0x36')][_0x655a('0x37')],function(_0x420ec6){return{'name':_0x420ec6[_0x655a('0x38')],'type':_0x420ec6[_0x655a('0x39')]['key']};});_0x37f62c['model']=_[_0x655a('0x35')](_0x2b4b0f,'name');_0x37f62c[_0x655a('0x3a')]=_[_0x655a('0x3b')](_0x5e990e[_0x655a('0x3a')]);_0x37f62c['filters']=_['intersection'](_0x37f62c[_0x655a('0x3c')],_0x37f62c['query']);_0x54ac90[_0x655a('0x3d')]=_[_0x655a('0x3e')](_0x37f62c['model'],qs[_0x655a('0x3f')](_0x5e990e[_0x655a('0x3a')][_0x655a('0x3f')]));_0x54ac90[_0x655a('0x3d')]=_0x54ac90['attributes'][_0x655a('0x40')]?_0x54ac90[_0x655a('0x3d')]:_0x37f62c['model'];if(!_0x5e990e[_0x655a('0x3a')][_0x655a('0x41')]('nolimit')){_0x54ac90[_0x655a('0x25')]=qs[_0x655a('0x25')](_0x5e990e['query'][_0x655a('0x25')]);_0x54ac90[_0x655a('0x24')]=qs[_0x655a('0x24')](_0x5e990e[_0x655a('0x3a')]['offset']);}_0x54ac90[_0x655a('0x42')]=qs[_0x655a('0x43')](_0x5e990e[_0x655a('0x3a')]['sort']);_0x54ac90[_0x655a('0x44')]=qs[_0x655a('0x45')](_[_0x655a('0x46')](_0x5e990e[_0x655a('0x3a')],_0x37f62c['filters']),_0x2b4b0f);if(_0x5e990e[_0x655a('0x3a')][_0x655a('0x47')]){_0x54ac90['where']=_[_0x655a('0x48')](_0x54ac90[_0x655a('0x44')],{'$or':_[_0x655a('0x35')](_0x2b4b0f,function(_0x4cace7){if(_0x4cace7['type']!=='VIRTUAL'){var _0x44f25b={};_0x44f25b[_0x4cace7[_0x655a('0x33')]]={'$like':'%'+_0x5e990e[_0x655a('0x3a')]['filter']+'%'};return _0x44f25b;}})});}_0x54ac90=_[_0x655a('0x48')]({},_0x54ac90,_0x5e990e[_0x655a('0x49')]);var _0xdb73b6={'where':_0x54ac90[_0x655a('0x44')]};return db['Plugin'][_0x655a('0x27')](_0xdb73b6)[_0x655a('0x2d')](function(_0x49038c){_0x3268a0[_0x655a('0x27')]=_0x49038c;if(_0x5e990e['query'][_0x655a('0x4a')]){_0x54ac90[_0x655a('0x4b')]=[{'all':!![]}];}return db[_0x655a('0x36')][_0x655a('0x4c')](_0x54ac90);})[_0x655a('0x2d')](function(_0x5a5eda){_0x3268a0[_0x655a('0x4d')]=_0x5a5eda;return _0x3268a0;})[_0x655a('0x2d')](respondWithFilteredResult(_0x1e8c60,_0x54ac90))[_0x655a('0x4e')](handleError(_0x1e8c60,null));};exports[_0x655a('0x4f')]=function(_0x4eaeb8,_0x3a853c){var _0x2f5484={'raw':!![],'where':{'id':_0x4eaeb8[_0x655a('0x50')]['id']}},_0x37f492={};_0x37f492[_0x655a('0x3c')]=_[_0x655a('0x3b')](db[_0x655a('0x36')][_0x655a('0x37')]);_0x37f492[_0x655a('0x3a')]=_['keys'](_0x4eaeb8[_0x655a('0x3a')]);_0x37f492[_0x655a('0x45')]=_['intersection'](_0x37f492[_0x655a('0x3c')],_0x37f492[_0x655a('0x3a')]);_0x2f5484[_0x655a('0x3d')]=_['intersection'](_0x37f492[_0x655a('0x3c')],qs[_0x655a('0x3f')](_0x4eaeb8[_0x655a('0x3a')][_0x655a('0x3f')]));_0x2f5484[_0x655a('0x3d')]=_0x2f5484['attributes'][_0x655a('0x40')]?_0x2f5484['attributes']:_0x37f492[_0x655a('0x3c')];if(_0x4eaeb8[_0x655a('0x3a')][_0x655a('0x4a')]){_0x2f5484['include']=[{'all':!![]}];}_0x2f5484=_[_0x655a('0x48')]({},_0x2f5484,_0x4eaeb8[_0x655a('0x49')]);return db[_0x655a('0x36')]['find'](_0x2f5484)[_0x655a('0x2d')](handleEntityNotFound(_0x3a853c,null))['then'](respondWithResult(_0x3a853c,null))[_0x655a('0x4e')](handleError(_0x3a853c,null));};exports[_0x655a('0x51')]=function(_0x2f636b,_0x3dec7d,_0x3601c0){return db[_0x655a('0x36')][_0x655a('0x52')]({'where':{'id':_0x2f636b['params']['id']},'attributes':[_0x655a('0x33'),_0x655a('0x7')],'raw':!![]})[_0x655a('0x2d')](handleEntityNotFound(_0x3dec7d,null))['then'](function(_0x3331e5){if(_0x3331e5){var _0x4bebb7=path[_0x655a('0x53')](config[_0x655a('0x54')],_0x655a('0x55'),util['format'](_0x655a('0x56'),path['basename'](_0x3331e5['path'])));var _0x3bfc30=fs[_0x655a('0x57')](_0x4bebb7);var _0x1e6477=archiver(_0x655a('0x58'),{'zlib':{'level':0x9}});_0x1e6477['on']('warning',function(_0x2610d6){if(_0x2610d6['code']===_0x655a('0x59')){logger[_0x655a('0x5a')](_0x2610d6);}else{throw new db[(_0x655a('0x5b'))]['Error'](_0x655a('0x5c'));}});_0x1e6477['on'](_0x655a('0x5a'),function(_0x3bd2db){throw new db['Sequelize'][(_0x655a('0x5d'))](_0x655a('0x5c'));});_0x1e6477[_0x655a('0x5e')](_0x3bfc30);_0x1e6477['glob']('**/*',{'cwd':path[_0x655a('0x53')](config[_0x655a('0x54')],_0x655a('0x55'),path[_0x655a('0x5f')](_0x3331e5['path'])),'ignore':[path[_0x655a('0x53')](path[_0x655a('0x60')](_0x3331e5['path']),_0x655a('0x61')),path[_0x655a('0x53')](path[_0x655a('0x60')](_0x3331e5[_0x655a('0x7')]),_0x655a('0x62'))],'nodir':!![]})[_0x655a('0x63')]();_0x3bfc30['on'](_0x655a('0x64'),function(){if(!fs[_0x655a('0x65')](_0x4bebb7)){throw new db[(_0x655a('0x5b'))][(_0x655a('0x5d'))](_0x655a('0x66'));}return _0x3dec7d['download'](_0x4bebb7,util[_0x655a('0x67')](_0x655a('0x56'),path[_0x655a('0x60')](_0x3331e5[_0x655a('0x7')])),function(_0xcee5e9){if(_0xcee5e9){throw new db[(_0x655a('0x5b'))]['Error'](_0x655a('0x68'));}fs[_0x655a('0x69')](_0x4bebb7);logger[_0x655a('0x6a')](_0x655a('0x6b'));logger[_0x655a('0x6a')]('Temporary\x20file\x20removed');});});}return null;})[_0x655a('0x4e')](handleError(_0x3dec7d,null));};exports[_0x655a('0x6c')]=function(_0x100b69,_0xb186f4,_0x4b8b95){var _0x20b034=path['basename'](_0x100b69[_0x655a('0x6d')][_0x655a('0x6e')],path[_0x655a('0x6f')](_0x100b69['file'][_0x655a('0x6e')]));var _0x4d20cf=path[_0x655a('0x53')](config[_0x655a('0x54')],_0x655a('0x55'),_0x100b69[_0x655a('0x6d')][_0x655a('0x6e')]);var _0x59a624=path[_0x655a('0x53')](config[_0x655a('0x54')],_0x655a('0x55'),_0x20b034);logger[_0x655a('0x6a')](_0x655a('0x70'),_0x4d20cf);logger[_0x655a('0x6a')]('Plugin\x20upload\x20destination:\x20%s',_0x59a624);try{fs['chmodSync'](_0x4d20cf,parseInt(_0x655a('0x71'),0x8));extract(_0x4d20cf,{'dir':_0x59a624},function(_0x4c1b27){if(_0x4c1b27){logger[_0x655a('0x5a')](_0x4c1b27);handleError(_0x4c1b27,!![]);};var _0x1b0de9=fs['readdirSync'](_0x59a624);if(_0x1b0de9['length']>0x1){removeReferences(_0x4d20cf,_0x59a624);logger['error']('Invalid\x20plugin\x20structure');return _0x4b8b95(new Error(_0x655a('0x72')));}var _0x14ad2a=fs[_0x655a('0x73')](path[_0x655a('0x53')](_0x59a624,_0x1b0de9[0x0]));if(_0x14ad2a[_0x655a('0x74')]()){removeReferences(_0x4d20cf,_0x59a624);logger['error']('Invalid\x20plugin\x20structure');return _0x4b8b95(new Error('Invalid\x20plugin\x20structure'));}if(_0x14ad2a[_0x655a('0x75')]()){var _0x3613da=fs[_0x655a('0x76')](path[_0x655a('0x53')](_0x59a624,_0x1b0de9[0x0]));if(_0x3613da['length']===0x0){removeReferences(_0x4d20cf,_0x59a624);logger['error']('Invalid\x20plugin\x20structure');return _0x4b8b95(new Error(_0x655a('0x72')));}var _0x373db7=_0x3613da[_0x655a('0x77')](function(_0x2e3232){return _0x2e3232===_0x655a('0x78');});if(!_0x373db7){return _0x4b8b95(new Error(_0x655a('0x79')));}var _0x2212bc=fs[_0x655a('0x7a')](path[_0x655a('0x53')](_0x59a624,_0x1b0de9[0x0],_0x655a('0x78')));var _0x4ff62e=JSON[_0x655a('0x7b')](_0x2212bc);if(_0x655a('0x26')==typeof _0x4ff62e[_0x655a('0x33')]){return _0x4b8b95(new Error(_0x655a('0x7c')));}if(_0x655a('0x26')==typeof _0x4ff62e[_0x655a('0x39')]){return _0x4b8b95(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x4ff62e[_0x655a('0x7d')]){return _0x4b8b95(new Error(_0x655a('0x7e')));}if(_0x655a('0x26')==typeof _0x4ff62e[_0x655a('0x7f')]){return _0x4b8b95(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4ff62e[_0x655a('0x39')]===_0x655a('0x80')){if(_0x655a('0x26')==typeof _0x4ff62e[_0x655a('0x7f')][_0x655a('0x81')]){return _0x4b8b95(new Error(_0x655a('0x82')));}if('undefined'==typeof _0x4ff62e[_0x655a('0x7f')][_0x655a('0x81')][_0x655a('0x83')]&&'undefined'==typeof _0x4ff62e[_0x655a('0x7f')][_0x655a('0x81')]['agent']){return _0x4b8b95(new Error(_0x655a('0x84')));}}else if(_0x4ff62e[_0x655a('0x39')]===_0x655a('0x85')){if('undefined'==typeof _0x4ff62e[_0x655a('0x7f')][_0x655a('0x86')]){return _0x4b8b95(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x655a('0x26')==typeof _0x4ff62e[_0x655a('0x7f')][_0x655a('0x87')]){return _0x4b8b95(new Error(_0x655a('0x88')));}}else{return _0x4b8b95(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x148bef=_0x4ff62e[_0x655a('0x33')];var _0xe9cb0c=_0x4ff62e[_0x655a('0x89')];var _0x641347=_0x4ff62e[_0x655a('0x39')];var _0x5e9826=_0x4ff62e[_0x655a('0x8a')]?_0x4ff62e[_0x655a('0x8a')]:'always';var _0x14145d=_0x4ff62e[_0x655a('0x8b')]?_0x4ff62e[_0x655a('0x8b')]:_0x655a('0x8c');var _0x9db6e8='';var _0x46bf87='';var _0x6ecf83='';var _0x176510='';var _0x2c6e8e=_0x4ff62e['version'];if(_0x641347==='html'){if('undefined'!=typeof _0x4ff62e[_0x655a('0x7f')][_0x655a('0x81')][_0x655a('0x83')]){var _0xc341b6=_0x4ff62e[_0x655a('0x7f')][_0x655a('0x81')][_0x655a('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x655a('0x8d')](_0xc341b6)){_0x9db6e8=path[_0x655a('0x53')]('plugins',_0x20b034,_0x1b0de9[0x0],_0xc341b6);}else{_0x9db6e8=_0xc341b6;}}else{logger[_0x655a('0x6a')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x4ff62e['parameters'][_0x655a('0x81')][_0x655a('0x8e')]){var _0x379b14=_0x4ff62e[_0x655a('0x7f')][_0x655a('0x81')][_0x655a('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x655a('0x8d')](_0x379b14)){_0x46bf87=path[_0x655a('0x53')](_0x655a('0x8f'),_0x20b034,_0x1b0de9[0x0],_0x379b14);}else{_0x46bf87=_0x379b14;}}else{logger['info'](_0x655a('0x90'));}}else if(_0x641347===_0x655a('0x85')){_0x6ecf83=_0x4ff62e[_0x655a('0x7f')][_0x655a('0x86')];_0x176510=_0x4ff62e['parameters'][_0x655a('0x87')];if(_0x655a('0x26')!=typeof _0x4ff62e[_0x655a('0x7f')][_0x655a('0x81')]){if(_0x655a('0x26')!=typeof _0x4ff62e['parameters']['views'][_0x655a('0x83')]){var _0xc341b6=_0x4ff62e[_0x655a('0x7f')][_0x655a('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x655a('0x8d')](_0xc341b6)){_0x9db6e8=path[_0x655a('0x53')](_0x655a('0x8f'),_0x20b034,_0x1b0de9[0x0],_0xc341b6);}else{_0x9db6e8=_0xc341b6;}}if(_0x655a('0x26')!=typeof _0x4ff62e[_0x655a('0x7f')][_0x655a('0x81')][_0x655a('0x8e')]){var _0x379b14=_0x4ff62e['parameters'][_0x655a('0x81')][_0x655a('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x655a('0x8d')](_0x379b14)){_0x46bf87=path[_0x655a('0x53')](_0x655a('0x8f'),_0x20b034,_0x1b0de9[0x0],_0x379b14);}else{_0x46bf87=_0x379b14;}}}}var _0x3d061e={'name':_0x148bef,'description':_0xe9cb0c,'path':path['join'](_0x20b034,_0x1b0de9[0x0]),'type':_0x641347,'sidebar':_0x5e9826,'icon':_0x14145d,'adminUrl':_0x9db6e8,'agentUrl':_0x46bf87,'scriptName':_0x6ecf83,'scriptPath':_0x176510,'version':_0x2c6e8e};removeReferences(_0x4d20cf,null);return db[_0x655a('0x36')][_0x655a('0x91')](_0x3d061e)['then'](function(_0x4f26ab){var _0x28c1d9={'role':_0x100b69[_0x655a('0x92')]['role'],'userProfileId':_0x100b69[_0x655a('0x92')][_0x655a('0x93')]};if(!_0x28c1d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28c1d9['role']===_0x655a('0x94')){var _0x3cf9f4=_0x4f26ab[_0x655a('0x2f')]({'plain':!![]});return db[_0x655a('0x95')][_0x655a('0x52')]({'where':{'name':_0x655a('0x30'),'userProfileId':_0x28c1d9['userProfileId']},'raw':!![]})[_0x655a('0x2d')](function(_0xe35153){if(_0xe35153&&_0xe35153[_0x655a('0x96')]===0x0){return db[_0x655a('0x97')][_0x655a('0x91')]({'name':_0x3cf9f4['name'],'resourceId':_0x3cf9f4['id'],'type':_0xe35153['name'],'sectionId':_0xe35153['id']},{})['then'](function(){return _0x4f26ab;});}else{return _0x4f26ab;}})[_0x655a('0x4e')](function(_0x11c267){logger[_0x655a('0x5a')](_0x655a('0x98'),_0x11c267);throw _0x11c267;});}return _0x4f26ab;})[_0x655a('0x2d')](respondWithResult(_0xb186f4,null))[_0x655a('0x4e')](handleError(_0xb186f4,null));}});}catch(_0xaa45b3){_0xb186f4['status'](0x1f4)['send'](_0xaa45b3);}};function removeReferences(_0x2c3155,_0x507428){try{if(_0x2c3155){fs['unlinkSync'](_0x2c3155);logger[_0x655a('0x6a')](_0x655a('0x99'));}if(_0x507428){rimraf(_0x507428,function(){});logger[_0x655a('0x6a')](_0x655a('0x9a'));}}catch(_0x571a46){logger[_0x655a('0x5a')](_0x571a46);}}exports['update']=function(_0x30fd83,_0x85f688,_0x4f67db){return db['Plugin']['find']({'where':{'id':_0x30fd83[_0x655a('0x50')]['id']}})[_0x655a('0x2d')](handleEntityNotFound(_0x85f688,null))[_0x655a('0x2d')](saveUpdates(_0x30fd83[_0x655a('0x92')],null))[_0x655a('0x2d')](respondWithResult(_0x85f688,null))[_0x655a('0x4e')](handleError(_0x85f688,null));};exports[_0x655a('0x9b')]=function(_0x142fbd,_0x1b3d5e,_0x30a6d5){return db[_0x655a('0x36')]['find']({'where':{'id':_0x142fbd[_0x655a('0x50')]['id']}})['then'](function(_0x33980c){if(_0x33980c){return _0x33980c[_0x655a('0x2e')]();}})[_0x655a('0x2d')](function(_0x3948ab){rimraf(path[_0x655a('0x53')](config[_0x655a('0x54')],_0x655a('0x55'),path[_0x655a('0x5f')](_0x3948ab[_0x655a('0x7')])),function(){});return _0x3948ab;})[_0x655a('0x2d')](handleEntityNotFound(_0x1b3d5e,null))[_0x655a('0x2d')](respondWithStatusCode(_0x1b3d5e,null))[_0x655a('0x4e')](handleError(_0x1b3d5e,null));};exports[_0x655a('0x9c')]=function(_0x509963,_0x110ae6,_0x3da8c6){return BPromise[_0x655a('0x9d')]()[_0x655a('0x2d')](function(){if(!_0x509963[_0x655a('0x3a')][_0x655a('0x7')]){throw new Error(_0x655a('0x9e'));}if(!_0x509963[_0x655a('0x3a')][_0x655a('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x472b53=_0x509963[_0x655a('0x3a')][_0x655a('0xa0')]?_0x509963[_0x655a('0x3a')][_0x655a('0xa0')]+':'+_0x509963[_0x655a('0x3a')][_0x655a('0x9f')]:_0x655a('0xa1')+_0x509963[_0x655a('0x3a')][_0x655a('0x9f')];var _0x196701=_0x509963[_0x655a('0x3a')]['json']?_0x509963[_0x655a('0x3a')][_0x655a('0x23')]:!![];var _0x1ba969=_0x509963[_0x655a('0x3a')][_0x655a('0xa2')]?_0x509963[_0x655a('0x3a')][_0x655a('0xa2')]:null;var _0x406eb7={'method':_0x509963['method'],'uri':util[_0x655a('0x67')]('%s%s',_0x472b53,_0x509963[_0x655a('0x3a')]['path']),'json':_0x196701,'resolveWithFullResponse':!![],'encoding':_0x1ba969,'qs':_0x509963[_0x655a('0x3a')]};if(_0x509963[_0x655a('0xa3')]){_0x406eb7[_0x655a('0xa3')]=_0x509963[_0x655a('0xa3')];if(_0x406eb7[_0x655a('0xa3')]['content-length']){delete _0x406eb7['headers']['content-length'];}}if(_0x406eb7[_0x655a('0xa3')]['content-type']){delete _0x406eb7['headers'][_0x655a('0xa4')];}return rp(_0x406eb7);})[_0x655a('0x2d')](function(_0x3d19a0){if(_0x3d19a0){_0x110ae6[_0x655a('0x28')](_0x3d19a0[_0x655a('0xa3')]);logger[_0x655a('0x6a')](_0x3d19a0[_0x655a('0x92')]);if(_['endsWith'](_0x509963[_0x655a('0x3a')][_0x655a('0x7')],_0x655a('0x51'))&&_0x3d19a0[_0x655a('0xa5')]==0x1f4){return _0x110ae6[_0x655a('0x21')](_0x3d19a0[_0x655a('0xa5')]);}else{return _0x110ae6[_0x655a('0x22')](_0x3d19a0['statusCode'])['send'](_0x3d19a0['body']);}}else{return _0x110ae6[_0x655a('0x21')](0xc8);}})['catch'](handleError(_0x110ae6,null));};exports[_0x655a('0xa6')]=function(_0x5abb2e,_0x5c8ced,_0xd2773c){return BPromise[_0x655a('0x9d')]()[_0x655a('0x2d')](function(){if(!_0x5abb2e[_0x655a('0x3a')][_0x655a('0x7')]){throw new Error(_0x655a('0x9e'));}if(!_0x5abb2e['query']['port']){throw new Error(_0x655a('0xa7'));}var _0x53dc0a=_0x5abb2e[_0x655a('0x3a')][_0x655a('0xa0')]?_0x5abb2e[_0x655a('0x3a')][_0x655a('0xa0')]+':'+_0x5abb2e[_0x655a('0x3a')]['port']:_0x655a('0xa1')+_0x5abb2e[_0x655a('0x3a')][_0x655a('0x9f')];var _0x4013c1=_0x5abb2e['query'][_0x655a('0x23')]?_0x5abb2e[_0x655a('0x3a')]['json']:!![];var _0x4ff3fa=_0x5abb2e['query'][_0x655a('0xa2')]?_0x5abb2e[_0x655a('0x3a')][_0x655a('0xa2')]:null;var _0x1231de={'method':_0x5abb2e[_0x655a('0xa8')],'uri':util[_0x655a('0x67')](_0x655a('0xa9'),_0x53dc0a,_0x5abb2e['query'][_0x655a('0x7')]),'json':_0x4013c1,'resolveWithFullResponse':!![],'encoding':_0x4ff3fa,'body':_0x5abb2e['body']};if(_0x5abb2e['headers']){_0x1231de[_0x655a('0xa3')]=_0x5abb2e[_0x655a('0xa3')];if(_0x1231de[_0x655a('0xa3')][_0x655a('0xaa')]){delete _0x1231de[_0x655a('0xa3')][_0x655a('0xaa')];}}if(_0x1231de[_0x655a('0xa3')][_0x655a('0xa4')]){delete _0x1231de['headers'][_0x655a('0xa4')];}return rp(_0x1231de);})[_0x655a('0x2d')](function(_0x4417f8){if(_0x4417f8){_0x5c8ced[_0x655a('0x28')](_0x4417f8['headers']);logger[_0x655a('0x6a')](_0x4417f8[_0x655a('0x92')]);return _0x5c8ced[_0x655a('0x22')](_0x4417f8[_0x655a('0xa5')])[_0x655a('0x34')](_0x4417f8[_0x655a('0x92')]);}else{return _0x5c8ced['sendStatus'](0xc8);}})['catch'](handleError(_0x5c8ced,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1f96453..f8d1704 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 _0x36c3=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x141055,_0x96d382){var _0x415757=function(_0x17e148){while(--_0x17e148){_0x141055['push'](_0x141055['shift']());}};_0x415757(++_0x96d382);}(_0x36c3,0x1a6));var _0x336c=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x36c3[_0x3a8db5];return _0x2c03cd;};'use strict';var EventEmitter=require(_0x336c('0x0'));var Plugin=require(_0x336c('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x336c('0x2')](0x0);var events={'afterCreate':_0x336c('0x3'),'afterUpdate':_0x336c('0x4'),'afterDestroy':_0x336c('0x5')};function emitEvent(_0x32aed2){return function(_0x2b1194,_0x39ed12,_0x4e4c07){PluginEvents[_0x336c('0x6')](_0x32aed2+':'+_0x2b1194['id'],_0x2b1194);PluginEvents[_0x336c('0x6')](_0x32aed2,_0x2b1194);_0x4e4c07(null);};}for(var e in events){if(events[_0x336c('0x7')](e)){var event=events[e];Plugin[_0x336c('0x8')](e,emitEvent(event));}}module[_0x336c('0x9')]=PluginEvents; \ No newline at end of file +var _0xd9a8=['emit','hook','exports','events','../../mysqldb','Plugin','save','update'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x3fdcee,_0x17dbfe){_0x3fdcee=_0x3fdcee-0x0;var _0x4a5788=_0xd9a8[_0x3fdcee];return _0x4a5788;};'use strict';var EventEmitter=require(_0x8d9a('0x0'));var Plugin=require(_0x8d9a('0x1'))['db'][_0x8d9a('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8d9a('0x3'),'afterUpdate':_0x8d9a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x489c45){return function(_0x47177e,_0x3a40f0,_0x34bbf9){PluginEvents[_0x8d9a('0x5')](_0x489c45+':'+_0x47177e['id'],_0x47177e);PluginEvents[_0x8d9a('0x5')](_0x489c45,_0x47177e);_0x34bbf9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x8d9a('0x6')](e,emitEvent(event));}}module[_0x8d9a('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 2563e5d..7a6b5c2 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 _0xd6ee=['path','../../config/environment','exports','Plugin','plugins','lodash','util','api','bluebird','request-promise'];(function(_0xde8111,_0x15702c){var _0x29af0b=function(_0x3d7873){while(--_0x3d7873){_0xde8111['push'](_0xde8111['shift']());}};_0x29af0b(++_0x15702c);}(_0xd6ee,0x109));var _0xed6e=function(_0x4a3554,_0x14f2fd){_0x4a3554=_0x4a3554-0x0;var _0x12e4cb=_0xd6ee[_0x4a3554];return _0x12e4cb;};'use strict';var _=require(_0xed6e('0x0'));var util=require(_0xed6e('0x1'));var logger=require('../../config/logger')(_0xed6e('0x2'));var moment=require('moment');var BPromise=require(_0xed6e('0x3'));var rp=require(_0xed6e('0x4'));var fs=require('fs');var path=require(_0xed6e('0x5'));var rimraf=require('rimraf');var config=require(_0xed6e('0x6'));var attributes=require('./plugin.attributes');module[_0xed6e('0x7')]=function(_0x124648,_0x266c6b){return _0x124648['define'](_0xed6e('0x8'),attributes,{'tableName':_0xed6e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x598e=['lodash','util','api','moment','path','rimraf','../../config/environment','exports','define','plugins'];(function(_0x48e5c5,_0x360097){var _0x38fbad=function(_0xa60dc0){while(--_0xa60dc0){_0x48e5c5['push'](_0x48e5c5['shift']());}};_0x38fbad(++_0x360097);}(_0x598e,0x154));var _0xe598=function(_0x1b3264,_0x101468){_0x1b3264=_0x1b3264-0x0;var _0x21e7e5=_0x598e[_0x1b3264];return _0x21e7e5;};'use strict';var _=require(_0xe598('0x0'));var util=require(_0xe598('0x1'));var logger=require('../../config/logger')(_0xe598('0x2'));var moment=require(_0xe598('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe598('0x4'));var rimraf=require(_0xe598('0x5'));var config=require(_0xe598('0x6'));var attributes=require('./plugin.attributes');module[_0xe598('0x7')]=function(_0x2f33c7,_0x27564b){return _0x2f33c7[_0xe598('0x8')]('Plugin',attributes,{'tableName':_0xe598('0x9'),'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 582d72b..ce9aaa3 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 _0xb4ee=['body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','CreatePlugin','Plugin'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xb4ee,0xa8));var _0xeb4e=function(_0x28ee82,_0x5c252f){_0x28ee82=_0x28ee82-0x0;var _0x13cd70=_0xb4ee[_0x28ee82];return _0x13cd70;};'use strict';var _=require(_0xeb4e('0x0'));var util=require('util');var moment=require(_0xeb4e('0x1'));var BPromise=require(_0xeb4e('0x2'));var rs=require(_0xeb4e('0x3'));var fs=require('fs');var Redis=require(_0xeb4e('0x4'));var db=require(_0xeb4e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb4e('0x6'))(_0xeb4e('0x7'));var config=require(_0xeb4e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb4e('0x9')][_0xeb4e('0xa')]({'port':0x232a});config[_0xeb4e('0xb')]=_[_0xeb4e('0xc')](config['redis'],{'host':_0xeb4e('0xd'),'port':0x18eb});var socket=require(_0xeb4e('0xe'))(new Redis(config[_0xeb4e('0xb')]));require(_0xeb4e('0xf'))['register'](socket);function respondWithRpcPromise(_0x513f9c,_0x1cf7b2,_0x119032){return new BPromise(function(_0x2654b2,_0x319275){return client[_0xeb4e('0x10')](_0x513f9c,_0x119032)[_0xeb4e('0x11')](function(_0x2f50d6){logger[_0xeb4e('0x12')]('Plugin,\x20%s,\x20%s',_0x1cf7b2,_0xeb4e('0x13'));logger[_0xeb4e('0x14')](_0xeb4e('0x15'),_0x1cf7b2,'request\x20sent',JSON[_0xeb4e('0x16')](_0x2f50d6));if(_0x2f50d6['error']){if(_0x2f50d6[_0xeb4e('0x17')][_0xeb4e('0x18')]===0x1f4){logger[_0xeb4e('0x17')](_0xeb4e('0x19'),_0x1cf7b2,_0x2f50d6[_0xeb4e('0x17')][_0xeb4e('0x1a')]);return _0x319275(_0x2f50d6['error'][_0xeb4e('0x1a')]);}logger[_0xeb4e('0x17')](_0xeb4e('0x19'),_0x1cf7b2,_0x2f50d6[_0xeb4e('0x17')][_0xeb4e('0x1a')]);return _0x2654b2(_0x2f50d6[_0xeb4e('0x17')][_0xeb4e('0x1a')]);}else{logger[_0xeb4e('0x12')](_0xeb4e('0x19'),_0x1cf7b2,'request\x20sent');_0x2654b2(_0x2f50d6['result'][_0xeb4e('0x1a')]);}})[_0xeb4e('0x1b')](function(_0x12356a){logger[_0xeb4e('0x17')](_0xeb4e('0x19'),_0x1cf7b2,_0x12356a);_0x319275(_0x12356a);});});}exports[_0xeb4e('0x1c')]=function(_0x370a68){var _0x5562ec=this;return new Promise(function(_0x77efe2,_0x1ab6ff){return db[_0xeb4e('0x1d')]['create'](_0x370a68[_0xeb4e('0x1e')],{'raw':_0x370a68[_0xeb4e('0x1f')]?_0x370a68[_0xeb4e('0x1f')][_0xeb4e('0x20')]===undefined?!![]:![]:!![]})[_0xeb4e('0x11')](function(_0x10abe3){logger[_0xeb4e('0x12')]('CreatePlugin',_0x370a68);logger[_0xeb4e('0x14')]('CreatePlugin',_0x370a68,JSON[_0xeb4e('0x16')](_0x10abe3));_0x77efe2(_0x10abe3);})[_0xeb4e('0x1b')](function(_0x213f86){logger[_0xeb4e('0x17')]('CreatePlugin',_0x213f86[_0xeb4e('0x1a')],_0x370a68);_0x1ab6ff(_0x5562ec[_0xeb4e('0x17')](0x1f4,_0x213f86['message']));});});}; \ No newline at end of file +var _0x8ce3=['Plugin','create','body','options','raw','info','CreatePlugin','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3b0b40,_0x2bfa5f){var _0x36f00d=function(_0x45ed92){while(--_0x45ed92){_0x3b0b40['push'](_0x3b0b40['shift']());}};_0x36f00d(++_0x2bfa5f);}(_0x8ce3,0x1b9));var _0x38ce=function(_0x39bf21,_0x5c2e3f){_0x39bf21=_0x39bf21-0x0;var _0x19c6e9=_0x8ce3[_0x39bf21];return _0x19c6e9;};'use strict';var _=require('lodash');var util=require(_0x38ce('0x0'));var moment=require(_0x38ce('0x1'));var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38ce('0x6'))(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x38ce('0x9')]=_[_0x38ce('0xa')](config[_0x38ce('0x9')],{'host':_0x38ce('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38ce('0x9')]));require(_0x38ce('0xc'))[_0x38ce('0xd')](socket);function respondWithRpcPromise(_0x1ab267,_0x34e46c,_0x55baeb){return new BPromise(function(_0x3af019,_0x3ebfa8){return client[_0x38ce('0xe')](_0x1ab267,_0x55baeb)[_0x38ce('0xf')](function(_0x3e7c12){logger['info'](_0x38ce('0x10'),_0x34e46c,'request\x20sent');logger[_0x38ce('0x11')](_0x38ce('0x12'),_0x34e46c,'request\x20sent',JSON['stringify'](_0x3e7c12));if(_0x3e7c12[_0x38ce('0x13')]){if(_0x3e7c12[_0x38ce('0x13')][_0x38ce('0x14')]===0x1f4){logger[_0x38ce('0x13')](_0x38ce('0x10'),_0x34e46c,_0x3e7c12[_0x38ce('0x13')]['message']);return _0x3ebfa8(_0x3e7c12[_0x38ce('0x13')][_0x38ce('0x15')]);}logger[_0x38ce('0x13')](_0x38ce('0x10'),_0x34e46c,_0x3e7c12[_0x38ce('0x13')][_0x38ce('0x15')]);return _0x3af019(_0x3e7c12[_0x38ce('0x13')][_0x38ce('0x15')]);}else{logger['info'](_0x38ce('0x10'),_0x34e46c,'request\x20sent');_0x3af019(_0x3e7c12[_0x38ce('0x16')]['message']);}})[_0x38ce('0x17')](function(_0xeeaea1){logger['error'](_0x38ce('0x10'),_0x34e46c,_0xeeaea1);_0x3ebfa8(_0xeeaea1);});});}exports['CreatePlugin']=function(_0x43ba83){var _0x53db82=this;return new Promise(function(_0xbe1781,_0x239870){return db[_0x38ce('0x18')][_0x38ce('0x19')](_0x43ba83[_0x38ce('0x1a')],{'raw':_0x43ba83[_0x38ce('0x1b')]?_0x43ba83['options'][_0x38ce('0x1c')]===undefined?!![]:![]:!![]})[_0x38ce('0xf')](function(_0x250502){logger[_0x38ce('0x1d')]('CreatePlugin',_0x43ba83);logger[_0x38ce('0x11')](_0x38ce('0x1e'),_0x43ba83,JSON['stringify'](_0x250502));_0xbe1781(_0x250502);})[_0x38ce('0x17')](function(_0xfedcbd){logger[_0x38ce('0x13')]('CreatePlugin',_0xfedcbd[_0x38ce('0x15')],_0x43ba83);_0x239870(_0x53db82['error'](0x1f4,_0xfedcbd[_0x38ce('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 83b98ae..3d9fa68 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 _0x8eab=['update','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x8eab,0x7d));var _0xb8ea=function(_0x1c670a,_0x52f088){_0x1c670a=_0x1c670a-0x0;var _0x4a16f5=_0x8eab[_0x1c670a];return _0x4a16f5;};'use strict';var PluginEvents=require(_0xb8ea('0x0'));var events=[_0xb8ea('0x1'),_0xb8ea('0x2'),_0xb8ea('0x3')];function createListener(_0x51eda9,_0x8ef5e5){return function(_0x534f0c){_0x8ef5e5['emit'](_0x51eda9,_0x534f0c);};}function removeListener(_0x5b2853,_0x5cb3eb){return function(){PluginEvents[_0xb8ea('0x4')](_0x5b2853,_0x5cb3eb);};}exports[_0xb8ea('0x5')]=function(_0x203a03){for(var _0x191540=0x0,_0x1af8ec=events[_0xb8ea('0x6')];_0x191540<_0x1af8ec;_0x191540++){var _0x245465=events[_0x191540];var _0x36a62b=createListener(_0xb8ea('0x7')+_0x245465,_0x203a03);PluginEvents['on'](_0x245465,_0x36a62b);}}; \ No newline at end of file +var _0xb5db=['update','emit','removeListener','register','length','plugin:','save'];(function(_0x513ebd,_0x3f8832){var _0x325c32=function(_0x46d0d1){while(--_0x46d0d1){_0x513ebd['push'](_0x513ebd['shift']());}};_0x325c32(++_0x3f8832);}(_0xb5db,0x1aa));var _0xbb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5db[_0x3dd15e];return _0x231fd0;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xbb5d('0x0'),'remove',_0xbb5d('0x1')];function createListener(_0x4def9e,_0x11627d){return function(_0x2c8768){_0x11627d[_0xbb5d('0x2')](_0x4def9e,_0x2c8768);};}function removeListener(_0x39ad83,_0x4059d9){return function(){PluginEvents[_0xbb5d('0x3')](_0x39ad83,_0x4059d9);};}exports[_0xbb5d('0x4')]=function(_0x21f088){for(var _0x8bd0b3=0x0,_0x3db569=events[_0xbb5d('0x5')];_0x8bd0b3<_0x3db569;_0x8bd0b3++){var _0x9e81cf=events[_0x8bd0b3];var _0x156be7=createListener(_0xbb5d('0x6')+_0x9e81cf,_0x21f088);PluginEvents['on'](_0x9e81cf,_0x156be7);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 9467ec9..9410cd5 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(_0x41f1e2,_0x221c3a){var _0x1e4ead=function(_0x3d0c18){while(--_0x3d0c18){_0x41f1e2['push'](_0x41f1e2['shift']());}};_0x1e4ead(++_0x221c3a);}(_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 +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x5011f7,_0x22967f){var _0x5c2293=function(_0x4d027f){while(--_0x4d027f){_0x5011f7['push'](_0x5011f7['shift']());}};_0x5c2293(++_0x22967f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 86901ef..79b31dc 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 _0x579c=['express','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','status','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','send','npm\x20install','info','index','then'];(function(_0xeeba0c,_0x51284b){var _0x850a1b=function(_0x425922){while(--_0x425922){_0xeeba0c['push'](_0xeeba0c['shift']());}};_0x850a1b(++_0x51284b);}(_0x579c,0xda));var _0xc579=function(_0x1413c7,_0x338846){_0x1413c7=_0x1413c7-0x0;var _0x855596=_0x579c[_0x1413c7];return _0x855596;};'use strict';var _=require(_0xc579('0x0'));var pm2=require(_0xc579('0x1'));var logger=require(_0xc579('0x2'))(_0xc579('0x3'));var path=require(_0xc579('0x4'));var exec=require('child_process')[_0xc579('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x21a0a2,_0x3b913c){return function(_0x1ce62b){if(!_0x1ce62b){_0x21a0a2[_0xc579('0x6')](0x194);;}return _0x1ce62b;};}function respondWithResult(_0x124ee5,_0x1bd276){_0x1bd276=_0x1bd276||0xc8;return function(_0x2e451b){if(_0x2e451b){return _0x124ee5['status'](_0x1bd276)[_0xc579('0x7')](_0x2e451b);}return null;};}function handleError(_0x293c4a,_0x2ce949){_0x2ce949=_0x2ce949||0x1f4;return function(_0x2361fc){logger[_0xc579('0x8')](_0x2361fc[_0xc579('0x9')]);if(_0x2361fc[_0xc579('0xa')]){delete _0x2361fc[_0xc579('0xa')];}_0x293c4a['status'](_0x2ce949)[_0xc579('0xb')](_0x2361fc);};}function execChildProcess(){return new BPromise(function(_0x2048bc,_0x17e37f){exec(_0xc579('0xc'),function(_0x9e3fd3,_0x4577a2,_0x2a8e70){logger[_0xc579('0xd')](_0x4577a2);logger[_0xc579('0xd')](_0x2a8e70);if(_0x9e3fd3){logger[_0xc579('0x8')](_0x9e3fd3);return _0x17e37f(_0x9e3fd3);}return _0x2048bc(_0x4577a2);});});}exports[_0xc579('0xe')]=function(_0x4ac675,_0x177314){return pm2['list']()[_0xc579('0xf')](function(_0x59243e){if(_0x59243e){var _0x424e15=_['reject'](_0x59243e,function(_0x44cd32){return _0x44cd32['name']===_0xc579('0x10')||_0x44cd32[_0xc579('0xa')]==='motion2';});return{'rows':_0x424e15,'count':_0x424e15['length']};}return null;})[_0xc579('0xf')](respondWithResult(_0x177314,null))[_0xc579('0x11')](handleError(_0x177314,null));};exports[_0xc579('0x12')]=function(_0x414ee7,_0x7d5865){return pm2[_0xc579('0x13')](_0x414ee7[_0xc579('0x14')]['id'])[_0xc579('0xf')](respondWithResult(_0x7d5865,null))[_0xc579('0xf')](handleEntityNotFound(_0x7d5865,null))[_0xc579('0x11')](handleError(_0x7d5865,null));};exports['create']=function(_0x463f5e,_0x2b7d74){if(_0x463f5e['body'][_0xc579('0xa')]&&_0x463f5e[_0xc579('0x15')][_0xc579('0x16')]){var _0x6501bc=path[_0xc579('0x17')](__dirname,_0xc579('0x18'),_0x463f5e[_0xc579('0x15')][_0xc579('0x16')]);var _0x55781e=process[_0xc579('0x19')]();process[_0xc579('0x1a')](path[_0xc579('0x1b')](_0x6501bc));return execChildProcess()[_0xc579('0xf')](function(_0x1da86e){process['chdir'](_0x55781e);return pm2[_0xc579('0x1c')]({'name':_0x463f5e[_0xc579('0x15')][_0xc579('0xa')],'script':_0x6501bc});})['then'](function(_0x45e1ac){pm2['dump']();return _0x45e1ac[0x0];})[_0xc579('0xf')](respondWithResult(_0x2b7d74,0xc9))[_0xc579('0x11')](handleError(_0x2b7d74,null));}else{return _0x2b7d74[_0xc579('0x1d')](0x1f4)['send']({'message':_0xc579('0x1e')});}};exports['update']=function(_0x532b33,_0x56439a){if(_0x532b33[_0xc579('0x15')]['id']){delete _0x532b33[_0xc579('0x15')]['id'];}var _0xfdbb73={'online':_0xc579('0x1f'),'stopped':_0xc579('0x20')};if(_0xfdbb73[_0xc579('0x21')](_0x532b33[_0xc579('0x15')]['status'])){return pm2[_0xfdbb73[_0x532b33['body'][_0xc579('0x1d')]]](_0x532b33['params']['id'])[_0xc579('0xf')](respondWithResult(_0x56439a,0xc8))[_0xc579('0x11')](handleError(_0x56439a,null));}else{return _0x56439a[_0xc579('0x1d')](0x1f4)[_0xc579('0xb')]({'message':_0xc579('0x22')});}};exports[_0xc579('0x23')]=function(_0x45e6a3,_0x133d08){if(_0x45e6a3['body']['id']){delete _0x45e6a3[_0xc579('0x15')]['id'];}if(_0x45e6a3[_0xc579('0x14')]['id']){return pm2[_0xc579('0x24')](_0x45e6a3[_0xc579('0x14')]['id'])['then'](function(_0x57299e){pm2[_0xc579('0x25')]();return _0x57299e[0x0];})['then'](respondWithResult(_0x133d08,null))[_0xc579('0x11')](handleError(_0x133d08,null));}else{return _0x133d08[_0xc579('0x1d')](0x1f4)[_0xc579('0xb')]({'message':_0xc579('0x26')});}}; \ No newline at end of file +var _0x39cb=['create','body','join','../../files/plugins','cwd','chdir','start','send','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','../../config/pm2','../../config/logger','path','child_process','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','then','reject','express','motion2','length','catch','show','describe','params'];(function(_0x14a89c,_0x1c33df){var _0x137353=function(_0x156cd8){while(--_0x156cd8){_0x14a89c['push'](_0x14a89c['shift']());}};_0x137353(++_0x1c33df);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var pm2=require(_0xb39c('0x0'));var logger=require(_0xb39c('0x1'))('api');var path=require(_0xb39c('0x2'));var exec=require(_0xb39c('0x3'))['exec'];var BPromise=require(_0xb39c('0x4'));function handleEntityNotFound(_0x285eca,_0x398d07){return function(_0x2bca14){if(!_0x2bca14){_0x285eca[_0xb39c('0x5')](0x194);;}return _0x2bca14;};}function respondWithResult(_0x4ae4cf,_0x32cdcd){_0x32cdcd=_0x32cdcd||0xc8;return function(_0x2fc868){if(_0x2fc868){return _0x4ae4cf[_0xb39c('0x6')](_0x32cdcd)[_0xb39c('0x7')](_0x2fc868);}return null;};}function handleError(_0x47d6d7,_0x5ae14a){_0x5ae14a=_0x5ae14a||0x1f4;return function(_0x41557b){logger[_0xb39c('0x8')](_0x41557b[_0xb39c('0x9')]);if(_0x41557b[_0xb39c('0xa')]){delete _0x41557b['name'];}_0x47d6d7['status'](_0x5ae14a)['send'](_0x41557b);};}function execChildProcess(){return new BPromise(function(_0x1de94f,_0x497ffc){exec(_0xb39c('0xb'),function(_0x1088ee,_0x433ee8,_0x340622){logger[_0xb39c('0xc')](_0x433ee8);logger[_0xb39c('0xc')](_0x340622);if(_0x1088ee){logger['error'](_0x1088ee);return _0x497ffc(_0x1088ee);}return _0x1de94f(_0x433ee8);});});}exports[_0xb39c('0xd')]=function(_0x468995,_0x2620cd){return pm2['list']()[_0xb39c('0xe')](function(_0x40a6d3){if(_0x40a6d3){var _0x42a203=_[_0xb39c('0xf')](_0x40a6d3,function(_0x469fa9){return _0x469fa9[_0xb39c('0xa')]===_0xb39c('0x10')||_0x469fa9['name']===_0xb39c('0x11');});return{'rows':_0x42a203,'count':_0x42a203[_0xb39c('0x12')]};}return null;})[_0xb39c('0xe')](respondWithResult(_0x2620cd,null))[_0xb39c('0x13')](handleError(_0x2620cd,null));};exports[_0xb39c('0x14')]=function(_0x3b7fad,_0x1a2f48){return pm2[_0xb39c('0x15')](_0x3b7fad[_0xb39c('0x16')]['id'])[_0xb39c('0xe')](respondWithResult(_0x1a2f48,null))['then'](handleEntityNotFound(_0x1a2f48,null))[_0xb39c('0x13')](handleError(_0x1a2f48,null));};exports[_0xb39c('0x17')]=function(_0x28bbe1,_0x447352){if(_0x28bbe1['body'][_0xb39c('0xa')]&&_0x28bbe1[_0xb39c('0x18')]['script']){var _0x2d8e93=path[_0xb39c('0x19')](__dirname,_0xb39c('0x1a'),_0x28bbe1['body']['script']);var _0x2789fd=process[_0xb39c('0x1b')]();process[_0xb39c('0x1c')](path['dirname'](_0x2d8e93));return execChildProcess()[_0xb39c('0xe')](function(_0x438207){process[_0xb39c('0x1c')](_0x2789fd);return pm2[_0xb39c('0x1d')]({'name':_0x28bbe1[_0xb39c('0x18')]['name'],'script':_0x2d8e93});})[_0xb39c('0xe')](function(_0xbeab7e){pm2['dump']();return _0xbeab7e[0x0];})[_0xb39c('0xe')](respondWithResult(_0x447352,0xc9))[_0xb39c('0x13')](handleError(_0x447352,null));}else{return _0x447352[_0xb39c('0x6')](0x1f4)[_0xb39c('0x1e')]({'message':_0xb39c('0x1f')});}};exports['update']=function(_0x23a2f1,_0x299c27){if(_0x23a2f1[_0xb39c('0x18')]['id']){delete _0x23a2f1['body']['id'];}var _0x41fff2={'online':_0xb39c('0x20'),'stopped':'stop'};if(_0x41fff2[_0xb39c('0x21')](_0x23a2f1[_0xb39c('0x18')][_0xb39c('0x6')])){return pm2[_0x41fff2[_0x23a2f1['body'][_0xb39c('0x6')]]](_0x23a2f1[_0xb39c('0x16')]['id'])['then'](respondWithResult(_0x299c27,0xc8))[_0xb39c('0x13')](handleError(_0x299c27,null));}else{return _0x299c27['status'](0x1f4)[_0xb39c('0x1e')]({'message':_0xb39c('0x22')});}};exports[_0xb39c('0x23')]=function(_0x7339b4,_0x17eb7b){if(_0x7339b4['body']['id']){delete _0x7339b4[_0xb39c('0x18')]['id'];}if(_0x7339b4['params']['id']){return pm2[_0xb39c('0x24')](_0x7339b4['params']['id'])[_0xb39c('0xe')](function(_0xe2111a){pm2[_0xb39c('0x25')]();return _0xe2111a[0x0];})[_0xb39c('0xe')](respondWithResult(_0x17eb7b,null))['catch'](handleError(_0x17eb7b,null));}else{return _0x17eb7b['status'](0x1f4)[_0xb39c('0x1e')]({'message':_0xb39c('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 5c8ad91..a7cca49 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 _0x8beb=['/agents','isAuthenticated','getQueues','exports','express','Router','../../components/auth/service','get'];(function(_0x2b5635,_0x2cf2e4){var _0x54b4d0=function(_0x463b8c){while(--_0x463b8c){_0x2b5635['push'](_0x2b5635['shift']());}};_0x54b4d0(++_0x2cf2e4);}(_0x8beb,0x84));var _0xb8be=function(_0xb1e1e1,_0x5baf84){_0xb1e1e1=_0xb1e1e1-0x0;var _0x57349b=_0x8beb[_0xb1e1e1];return _0x57349b;};'use strict';var express=require(_0xb8be('0x0'));var router=express[_0xb8be('0x1')]();var auth=require(_0xb8be('0x2'));var controller=require('./realtime.controller');router[_0xb8be('0x3')](_0xb8be('0x4'),auth[_0xb8be('0x5')](),controller['getAgents']);router[_0xb8be('0x3')]('/queues',auth['isAuthenticated'](),controller[_0xb8be('0x6')]);module[_0xb8be('0x7')]=router; \ No newline at end of file +var _0xe8a2=['isAuthenticated','getAgents','/queues','exports','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xe8a2,0x124));var _0x2e8a=function(_0x29223c,_0x6f1345){_0x29223c=_0x29223c-0x0;var _0x9e65cc=_0xe8a2[_0x29223c];return _0x9e65cc;};'use strict';var express=require(_0x2e8a('0x0'));var router=express[_0x2e8a('0x1')]();var auth=require(_0x2e8a('0x2'));var controller=require(_0x2e8a('0x3'));router[_0x2e8a('0x4')]('/agents',auth[_0x2e8a('0x5')](),controller[_0x2e8a('0x6')]);router[_0x2e8a('0x4')](_0x2e8a('0x7'),auth[_0x2e8a('0x5')](),controller['getQueues']);module[_0x2e8a('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index c429733..0f347f8 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 _0xa6ba=['getQueues','startCase','Queue','key','name','voice','dialActive','dialMethod','getOptions','Queues','filter','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','agent','online','sequelize','FIELD(id,','push','Pause','forEach','merge','where','role','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','find','getAgentStatus','Status','sortAgentsByStatus','fields','split','pick','catch'];(function(_0x2202d2,_0x529a53){var _0x55094b=function(_0x46d701){while(--_0x46d701){_0x2202d2['push'](_0x2202d2['shift']());}};_0x55094b(++_0x529a53);}(_0xa6ba,0x1ba));var _0xaa6b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa6ba[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xaa6b('0x0'));var util=require(_0xaa6b('0x1'));var rta=require(_0xaa6b('0x2'));var rtq=require(_0xaa6b('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0xaa6b('0x4'));var db=require(_0xaa6b('0x5'))['db'];var APIBadRequestError=require('../../errors/api')[_0xaa6b('0x6')];var APIHandleError=require(_0xaa6b('0x7'))[_0xaa6b('0x8')];function respondWithFilteredResult(_0x55b241,_0x111e3e){return function(_0x26f610){if(_0x26f610){var _0x40129e=typeof _0x111e3e[_0xaa6b('0x9')]===_0xaa6b('0xa')&&typeof _0x111e3e[_0xaa6b('0xb')]==='undefined';var _0x28dd62=_0x26f610[_0xaa6b('0xc')];var _0x5edba2=_0x40129e?0x0:_0x111e3e[_0xaa6b('0x9')];var _0xe0b8bd=_0x40129e?_0x26f610[_0xaa6b('0xc')]:_0x111e3e[_0xaa6b('0x9')]+_0x111e3e['limit'];var _0x4bde89;if(_0xe0b8bd>=_0x28dd62){_0xe0b8bd=_0x28dd62;_0x4bde89=0xc8;}else{_0x4bde89=0xce;}_0x55b241[_0xaa6b('0xd')](_0x4bde89);return _0x55b241[_0xaa6b('0xe')](_0xaa6b('0xf'),_0x5edba2+'-'+_0xe0b8bd+'/'+_0x28dd62)[_0xaa6b('0x10')](_0x26f610);}return null;};}exports[_0xaa6b('0x11')]=function(_0x1b0871,_0x29a496){var _0x5094f0={'count':0x0,'rows':[]};var _0x4cd2b6={};var _0x26d982;var _0x82e6ba=utils[_0xaa6b('0x12')]();var _0x5c087a;var _0x48d089;var _0x408183=_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x14')];var _0xdbf08d=_0x1b0871['query'][_0xaa6b('0x15')];var _0x5021f3=_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x16')];var _0xf926f=_0xdbf08d===_0xaa6b('0x17')||_0xdbf08d===_0xaa6b('0x18')?!![]:![];var _0x29ee2d=[];var _0x291562;var _0x21be91;Promise[_0xaa6b('0x19')]()[_0xaa6b('0x1a')](function(){if(_0x1b0871['query'][_0xaa6b('0x1b')]){if(!utils[_0xaa6b('0x1c')](_0x1b0871['query'][_0xaa6b('0x1b')])){throw new APIBadRequestError(util[_0xaa6b('0x1d')](_0xaa6b('0x1e'),_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x1b')]));}_0x26d982=_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x1b')][_0xaa6b('0x1f')]();}if(!_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x20')]||!_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x20')][_0xaa6b('0x21')](_0xaa6b('0x22'))){_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x20')]=rta[_0xaa6b('0x23')](_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x20')]);return;}var _0x438fe6=rta['getUpdatedSortOptions'](_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x20')]);_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x20')]=_0x438fe6['fields'][_0xaa6b('0x24')](',');_0x291562=_0x438fe6[_0xaa6b('0x25')];})[_0xaa6b('0x1a')](function(){if(!_0x408183){return[];}return rta[_0xaa6b('0x26')](_0x408183,_0x26d982);})[_0xaa6b('0x1a')](function(_0x2955cb){_0x29ee2d=_0x2955cb;return rta[_0xaa6b('0x27')]();})[_0xaa6b('0x1a')](function(_0x129784){_0x48d089=_0x129784[_0xaa6b('0x28')];if((!_0xdbf08d||_0xf926f)&&!_0x291562){return _0x29ee2d;}if(_0x291562&&!_0xdbf08d){return rta[_0xaa6b('0x29')](_0x48d089,_0x29ee2d,_0x291562);}else{return rta[_0xaa6b('0x2a')](_0x48d089,_0x29ee2d,_0xdbf08d);}})[_0xaa6b('0x1a')](function(_0x3d80b8){_0x29ee2d=_0x3d80b8;var _0x5ad213=![];if(_0x29ee2d[_0xaa6b('0x2b')]===0x0){if(_0x408183||_0xdbf08d){_0x5ad213=!![];}if(_0xf926f){_0x5ad213=![];}}if(_0x5ad213){return _0x5094f0;}var _0x2e4ea8=_[_0xaa6b('0x2c')](db[_0xaa6b('0x2d')]['rawAttributes'],function(_0xd4eded){return{'name':_0xd4eded[_0xaa6b('0x2e')],'type':_0xd4eded[_0xaa6b('0x2f')]['key']};});_0x1b0871[_0xaa6b('0x13')]['role']=_0xaa6b('0x30');_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x31')]=!![];_0x4cd2b6=qs['getOptions'](_0x2e4ea8,_0x1b0871);_0x4cd2b6['raw']=!![];var _0x10ddf9=[];if(_0x29ee2d[_0xaa6b('0x2b')]>0x0){_0x10ddf9['push']({'id':{'$in':_0x29ee2d}});if(_0x291562&&!_0xdbf08d){_0x21be91=[db[_0xaa6b('0x32')]['literal'](_0xaa6b('0x33')+_0x29ee2d+')')];_0x4cd2b6[_0xaa6b('0x25')]=_0x21be91;}}if(_0xf926f){_0x82e6ba['forEach'](function(_0x5e4aa2){var _0x43554e=!![];if(_0xdbf08d===_0xaa6b('0x18')&&_0x26d982!==_0x5e4aa2){_0x43554e=![];}_0x10ddf9[_0xaa6b('0x34')]({[_0x5e4aa2+_0xaa6b('0x35')]:_0x43554e});});if(_0x5021f3){_0x10ddf9['push']({'pauseType':_0x5021f3});}}else if(_0xdbf08d){_0x82e6ba[_0xaa6b('0x36')](function(_0x30a106){_0x10ddf9[_0xaa6b('0x34')]({[_0x30a106+_0xaa6b('0x35')]:![]});});}_0x4cd2b6['where']=_[_0xaa6b('0x37')](_0x4cd2b6[_0xaa6b('0x38')],{'$and':_0x10ddf9});if(_0x1b0871['user'][_0xaa6b('0x39')]===_0xaa6b('0x3a')){var _0x2e850c={'params':{'id':_0x1b0871[_0xaa6b('0x3a')][_0xaa6b('0x3b')]},'query':{'section':_0xaa6b('0x3c'),'role':_0xaa6b('0x30'),'online':!![],'raw':!![],'ids':_0x29ee2d,'customSorting':_0x21be91}};if(_0xf926f){_0x2e850c[_0xaa6b('0x13')][_0xaa6b('0x3d')]=_0x10ddf9;}_0x2e850c[_0xaa6b('0x13')]=Object[_0xaa6b('0x3e')](_0x2e850c[_0xaa6b('0x13')],_0x1b0871[_0xaa6b('0x13')]);delete _0x2e850c['query']['id'];return db[_0xaa6b('0x3f')][_0xaa6b('0x40')](_0x2e850c);}return db[_0xaa6b('0x2d')][_0xaa6b('0x41')](_0x4cd2b6);})['then'](function(_0x17ed47){_0x5094f0['count']=_0x17ed47['count'];_0x5c087a=_0x17ed47[_0xaa6b('0x28')];return _0x5c087a[_0xaa6b('0x2c')](function(_0x19719d){var _0x37bea0=_[_0xaa6b('0x42')](_0x48d089,['id',_0x19719d['id']]);if(_0x37bea0){var _0x245bd4=rta['filterAgentAttributes'](_0x37bea0);_[_0xaa6b('0x37')](_0x19719d,_0x245bd4);}_0x19719d[_0xaa6b('0x22')]=rta[_0xaa6b('0x43')](_0x19719d);if(_0x19719d['globalStatus'][_0xaa6b('0x21')]('pause')){_0x82e6ba[_0xaa6b('0x36')](function(_0x35d37c){if(_0x19719d[_0x35d37c+_0xaa6b('0x35')]){_0x19719d[_0x35d37c+_0xaa6b('0x44')]=_0xaa6b('0x17');}});}return _0x19719d;});})['then'](function(_0x5952eb){if(!_0x291562||_0x21be91){return _0x5952eb;}return rta[_0xaa6b('0x45')](_0x5952eb,_0x291562);})[_0xaa6b('0x1a')](function(_0x5ebedc){var _0x2a8302=null;if(_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x46')]){var _0x55a84f=_0x1b0871[_0xaa6b('0x13')][_0xaa6b('0x46')][_0xaa6b('0x47')](',');_0x2a8302=_0x5ebedc['map'](function(_0x2dce65){return _[_0xaa6b('0x48')](_0x2dce65,_0x55a84f);});}_0x5094f0['rows']=_0x2a8302||_0x5ebedc;return _0x5094f0;})['then'](respondWithFilteredResult(_0x29a496,_0x4cd2b6))[_0xaa6b('0x49')](APIHandleError(_0x29a496));};exports[_0xaa6b('0x4a')]=function(_0x2594ca,_0x12fee3){var _0x41d958={'count':0x0,'rows':[]};var _0x308dd9={};var _0x12913c;var _0x444d29;var _0x2e6fb6;Promise['resolve']()[_0xaa6b('0x1a')](function(){if(_0x2594ca[_0xaa6b('0x13')][_0xaa6b('0x1b')]){if(!utils[_0xaa6b('0x1c')](_0x2594ca[_0xaa6b('0x13')][_0xaa6b('0x1b')])){throw new APIBadRequestError(util[_0xaa6b('0x1d')](_0xaa6b('0x1e'),_0x2594ca[_0xaa6b('0x13')][_0xaa6b('0x1b')]));}_0x12913c=_0x2594ca[_0xaa6b('0x13')][_0xaa6b('0x1b')][_0xaa6b('0x1f')]();}var _0x45fe8c=_[_0xaa6b('0x4b')](_0x12913c)+_0xaa6b('0x4c');var _0x36bc3f=_[_0xaa6b('0x2c')](db[_0x45fe8c]['rawAttributes'],function(_0x1afcb4){return{'name':_0x1afcb4[_0xaa6b('0x2e')],'type':_0x1afcb4[_0xaa6b('0x2f')][_0xaa6b('0x4d')]};});if(!_0x2594ca['query']['fields']){var _0x3ff32c=['id',_0xaa6b('0x4e')];if(_0x12913c===_0xaa6b('0x4f')){_0x3ff32c[_0xaa6b('0x34')]('type');if(_0x2594ca['query']['type']==='outbound'){_0x3ff32c['push']([_0xaa6b('0x50'),_0xaa6b('0x51')]);}}_0x2594ca['query'][_0xaa6b('0x46')]=_0x3ff32c[_0xaa6b('0x24')](',');}_0x308dd9=qs[_0xaa6b('0x52')](_0x36bc3f,_0x2594ca);if(_0x2594ca['user']['role']===_0xaa6b('0x3a')){var _0x4b7f7a={'params':{'id':_0x2594ca[_0xaa6b('0x3a')][_0xaa6b('0x3b')]},'query':{'section':_0x12913c===_0xaa6b('0x4f')&&_0x2594ca['query'][_0xaa6b('0x2f')]==='outbound'?'QueueCampaigns':_[_0xaa6b('0x4b')](_0x12913c)+_0xaa6b('0x53'),'type':_0x2594ca['query'][_0xaa6b('0x2f')],'nolimit':!![],'sort':_0xaa6b('0x4e'),'filter':_0x2594ca[_0xaa6b('0x13')][_0xaa6b('0x54')]}};return db['UserProfile'][_0xaa6b('0x40')](_0x4b7f7a);}return db[_0x45fe8c][_0xaa6b('0x41')](_0x308dd9);})[_0xaa6b('0x1a')](function(_0x3872bd){_0x41d958['count']=_0x3872bd['count'];_0x444d29=_0x3872bd[_0xaa6b('0x28')];return rtq['getRealtimeQueues'](_0x2594ca,_0x12913c);})[_0xaa6b('0x1a')](function(_0x3c3880){_0x2e6fb6=_0x3c3880[_0xaa6b('0x28')];return rtq[_0xaa6b('0x55')](_0x444d29,_0x2e6fb6,_0x12913c,_0x2594ca[_0xaa6b('0x13')]['type']);})[_0xaa6b('0x1a')](function(_0x12ed1f){_0x41d958[_0xaa6b('0x28')]=_0x12ed1f;return _0x41d958;})[_0xaa6b('0x1a')](respondWithFilteredResult(_0x12fee3,_0x308dd9))['catch'](APIHandleError(_0x12fee3));}; \ No newline at end of file +var _0x05b8=['extraQueryConditions','assign','getResources','findAndCountAll','find','filterAgentAttributes','merge','globalStatus','getAgentStatus','Pause','split','pick','getQueues','Queue','type','key','name','voice','outbound','dialActive','dialMethod','userProfileId','QueueCampaigns','Queues','filter','UserProfile','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','status','set','Content-Range','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pause','*pause','resolve','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','validateSortParameter','fields','join','order','getRealtimeAgents','rows','getAgentIdsByStatus','length','map','User','fieldName','role','online','getOptions','raw','sequelize','literal','FIELD(id,','push','forEach','user','Agents','agent'];(function(_0x13dc4b,_0x4635e8){var _0x25626d=function(_0x21b6e1){while(--_0x21b6e1){_0x13dc4b['push'](_0x13dc4b['shift']());}};_0x25626d(++_0x4635e8);}(_0x05b8,0x1ac));var _0x805b=function(_0x14c2bc,_0x341b72){_0x14c2bc=_0x14c2bc-0x0;var _0x3d01bd=_0x05b8[_0x14c2bc];return _0x3d01bd;};'use strict';var _=require(_0x805b('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require(_0x805b('0x1'));var qs=require(_0x805b('0x2'));var utils=require(_0x805b('0x3'));var db=require(_0x805b('0x4'))['db'];var APIBadRequestError=require(_0x805b('0x5'))[_0x805b('0x6')];var APIHandleError=require('../../errors/api')[_0x805b('0x7')];function respondWithFilteredResult(_0x1ee4d5,_0x4da68e){return function(_0x31424f){if(_0x31424f){var _0xe67ce7=typeof _0x4da68e[_0x805b('0x8')]===_0x805b('0x9')&&typeof _0x4da68e['limit']===_0x805b('0x9');var _0x53254d=_0x31424f[_0x805b('0xa')];var _0xeda385=_0xe67ce7?0x0:_0x4da68e['offset'];var _0x36ccc4=_0xe67ce7?_0x31424f[_0x805b('0xa')]:_0x4da68e[_0x805b('0x8')]+_0x4da68e[_0x805b('0xb')];var _0x2b82f7;if(_0x36ccc4>=_0x53254d){_0x36ccc4=_0x53254d;_0x2b82f7=0xc8;}else{_0x2b82f7=0xce;}_0x1ee4d5[_0x805b('0xc')](_0x2b82f7);return _0x1ee4d5[_0x805b('0xd')](_0x805b('0xe'),_0xeda385+'-'+_0x36ccc4+'/'+_0x53254d)['json'](_0x31424f);}return null;};}exports[_0x805b('0xf')]=function(_0x4b6e14,_0x4dc7c7){var _0x48e923={'count':0x0,'rows':[]};var _0x145891={};var _0x100527;var _0x469533=utils[_0x805b('0x10')]();var _0x55ebdc;var _0x234768;var _0x270ea5=_0x4b6e14[_0x805b('0x11')][_0x805b('0x12')];var _0xc2a381=_0x4b6e14[_0x805b('0x11')][_0x805b('0x13')];var _0x4de102=_0x4b6e14['query']['pauseTypeFilter'];var _0x2e114d=_0xc2a381===_0x805b('0x14')||_0xc2a381===_0x805b('0x15')?!![]:![];var _0x254d88=[];var _0x3606c4;var _0x163b0a;Promise[_0x805b('0x16')]()[_0x805b('0x17')](function(){if(_0x4b6e14[_0x805b('0x11')][_0x805b('0x18')]){if(!utils[_0x805b('0x19')](_0x4b6e14[_0x805b('0x11')][_0x805b('0x18')])){throw new APIBadRequestError(util['format'](_0x805b('0x1a'),_0x4b6e14[_0x805b('0x11')]['channel']));}_0x100527=_0x4b6e14['query'][_0x805b('0x18')]['toLowerCase']();}if(!_0x4b6e14[_0x805b('0x11')][_0x805b('0x1b')]||!_0x4b6e14[_0x805b('0x11')]['sort'][_0x805b('0x1c')]('globalStatus')){_0x4b6e14[_0x805b('0x11')][_0x805b('0x1b')]=rta[_0x805b('0x1d')](_0x4b6e14[_0x805b('0x11')][_0x805b('0x1b')]);return;}var _0x2c56ea=rta['getUpdatedSortOptions'](_0x4b6e14[_0x805b('0x11')][_0x805b('0x1b')]);_0x4b6e14[_0x805b('0x11')][_0x805b('0x1b')]=_0x2c56ea[_0x805b('0x1e')][_0x805b('0x1f')](',');_0x3606c4=_0x2c56ea[_0x805b('0x20')];})[_0x805b('0x17')](function(){if(!_0x270ea5){return[];}return rta['getAgentIdsByQueues'](_0x270ea5,_0x100527);})[_0x805b('0x17')](function(_0x47d31f){_0x254d88=_0x47d31f;return rta[_0x805b('0x21')]();})[_0x805b('0x17')](function(_0x59eedc){_0x234768=_0x59eedc[_0x805b('0x22')];if((!_0xc2a381||_0x2e114d)&&!_0x3606c4){return _0x254d88;}if(_0x3606c4&&!_0xc2a381){return rta['getSortedAgentsIdsByStatus'](_0x234768,_0x254d88,_0x3606c4);}else{return rta[_0x805b('0x23')](_0x234768,_0x254d88,_0xc2a381);}})[_0x805b('0x17')](function(_0x38aa7c){_0x254d88=_0x38aa7c;var _0x3d2be9=![];if(_0x254d88[_0x805b('0x24')]===0x0){if(_0x270ea5||_0xc2a381){_0x3d2be9=!![];}if(_0x2e114d){_0x3d2be9=![];}}if(_0x3d2be9){return _0x48e923;}var _0x27256e=_[_0x805b('0x25')](db[_0x805b('0x26')]['rawAttributes'],function(_0x2e41ed){return{'name':_0x2e41ed[_0x805b('0x27')],'type':_0x2e41ed['type']['key']};});_0x4b6e14[_0x805b('0x11')][_0x805b('0x28')]='agent';_0x4b6e14[_0x805b('0x11')][_0x805b('0x29')]=!![];_0x145891=qs[_0x805b('0x2a')](_0x27256e,_0x4b6e14);_0x145891[_0x805b('0x2b')]=!![];var _0x1bff58=[];if(_0x254d88[_0x805b('0x24')]>0x0){_0x1bff58['push']({'id':{'$in':_0x254d88}});if(_0x3606c4&&!_0xc2a381){_0x163b0a=[db[_0x805b('0x2c')][_0x805b('0x2d')](_0x805b('0x2e')+_0x254d88+')')];_0x145891[_0x805b('0x20')]=_0x163b0a;}}if(_0x2e114d){_0x469533['forEach'](function(_0x202917){var _0x1c853d=!![];if(_0xc2a381===_0x805b('0x15')&&_0x100527!==_0x202917){_0x1c853d=![];}_0x1bff58[_0x805b('0x2f')]({[_0x202917+'Pause']:_0x1c853d});});if(_0x4de102){_0x1bff58[_0x805b('0x2f')]({'pauseType':_0x4de102});}}else if(_0xc2a381){_0x469533[_0x805b('0x30')](function(_0x4024ba){_0x1bff58[_0x805b('0x2f')]({[_0x4024ba+'Pause']:![]});});}_0x145891['where']=_['merge'](_0x145891['where'],{'$and':_0x1bff58});if(_0x4b6e14[_0x805b('0x31')][_0x805b('0x28')]==='user'){var _0x49c5d0={'params':{'id':_0x4b6e14['user']['userProfileId']},'query':{'section':_0x805b('0x32'),'role':_0x805b('0x33'),'online':!![],'raw':!![],'ids':_0x254d88,'customSorting':_0x163b0a}};if(_0x2e114d){_0x49c5d0['query'][_0x805b('0x34')]=_0x1bff58;}_0x49c5d0[_0x805b('0x11')]=Object[_0x805b('0x35')](_0x49c5d0['query'],_0x4b6e14[_0x805b('0x11')]);delete _0x49c5d0[_0x805b('0x11')]['id'];return db['UserProfile'][_0x805b('0x36')](_0x49c5d0);}return db['User'][_0x805b('0x37')](_0x145891);})[_0x805b('0x17')](function(_0x3d354c){_0x48e923[_0x805b('0xa')]=_0x3d354c[_0x805b('0xa')];_0x55ebdc=_0x3d354c[_0x805b('0x22')];return _0x55ebdc[_0x805b('0x25')](function(_0x44f683){var _0xe9a808=_[_0x805b('0x38')](_0x234768,['id',_0x44f683['id']]);if(_0xe9a808){var _0x3da2d6=rta[_0x805b('0x39')](_0xe9a808);_[_0x805b('0x3a')](_0x44f683,_0x3da2d6);}_0x44f683[_0x805b('0x3b')]=rta[_0x805b('0x3c')](_0x44f683);if(_0x44f683[_0x805b('0x3b')][_0x805b('0x1c')](_0x805b('0x14'))){_0x469533['forEach'](function(_0xf392f9){if(_0x44f683[_0xf392f9+_0x805b('0x3d')]){_0x44f683[_0xf392f9+'Status']=_0x805b('0x14');}});}return _0x44f683;});})['then'](function(_0x22f300){if(!_0x3606c4||_0x163b0a){return _0x22f300;}return rta['sortAgentsByStatus'](_0x22f300,_0x3606c4);})['then'](function(_0x106863){var _0x4c8971=null;if(_0x4b6e14[_0x805b('0x11')]['fields']){var _0x3ee827=_0x4b6e14[_0x805b('0x11')][_0x805b('0x1e')][_0x805b('0x3e')](',');_0x4c8971=_0x106863[_0x805b('0x25')](function(_0x5052eb){return _[_0x805b('0x3f')](_0x5052eb,_0x3ee827);});}_0x48e923['rows']=_0x4c8971||_0x106863;return _0x48e923;})['then'](respondWithFilteredResult(_0x4dc7c7,_0x145891))['catch'](APIHandleError(_0x4dc7c7));};exports[_0x805b('0x40')]=function(_0x2d313f,_0x5f0d24){var _0x200c6d={'count':0x0,'rows':[]};var _0xf7f675={};var _0x3729cd;var _0x21b8ac;var _0x5c2e19;Promise[_0x805b('0x16')]()[_0x805b('0x17')](function(){if(_0x2d313f[_0x805b('0x11')][_0x805b('0x18')]){if(!utils['isValidChannel'](_0x2d313f[_0x805b('0x11')][_0x805b('0x18')])){throw new APIBadRequestError(util['format'](_0x805b('0x1a'),_0x2d313f['query'][_0x805b('0x18')]));}_0x3729cd=_0x2d313f['query']['channel']['toLowerCase']();}var _0x31eeea=_['startCase'](_0x3729cd)+_0x805b('0x41');var _0xabdd89=_[_0x805b('0x25')](db[_0x31eeea]['rawAttributes'],function(_0x4b9d17){return{'name':_0x4b9d17[_0x805b('0x27')],'type':_0x4b9d17[_0x805b('0x42')][_0x805b('0x43')]};});if(!_0x2d313f[_0x805b('0x11')][_0x805b('0x1e')]){var _0x2cd4f7=['id',_0x805b('0x44')];if(_0x3729cd===_0x805b('0x45')){_0x2cd4f7[_0x805b('0x2f')](_0x805b('0x42'));if(_0x2d313f['query'][_0x805b('0x42')]===_0x805b('0x46')){_0x2cd4f7[_0x805b('0x2f')]([_0x805b('0x47'),_0x805b('0x48')]);}}_0x2d313f[_0x805b('0x11')][_0x805b('0x1e')]=_0x2cd4f7[_0x805b('0x1f')](',');}_0xf7f675=qs[_0x805b('0x2a')](_0xabdd89,_0x2d313f);if(_0x2d313f[_0x805b('0x31')][_0x805b('0x28')]===_0x805b('0x31')){var _0x4dbf5c={'params':{'id':_0x2d313f[_0x805b('0x31')][_0x805b('0x49')]},'query':{'section':_0x3729cd===_0x805b('0x45')&&_0x2d313f[_0x805b('0x11')][_0x805b('0x42')]===_0x805b('0x46')?_0x805b('0x4a'):_['startCase'](_0x3729cd)+_0x805b('0x4b'),'type':_0x2d313f['query']['type'],'nolimit':!![],'sort':_0x805b('0x44'),'filter':_0x2d313f['query'][_0x805b('0x4c')]}};return db[_0x805b('0x4d')][_0x805b('0x36')](_0x4dbf5c);}return db[_0x31eeea][_0x805b('0x37')](_0xf7f675);})[_0x805b('0x17')](function(_0x4eb2d0){_0x200c6d[_0x805b('0xa')]=_0x4eb2d0[_0x805b('0xa')];_0x21b8ac=_0x4eb2d0[_0x805b('0x22')];return rtq[_0x805b('0x4e')](_0x2d313f,_0x3729cd);})[_0x805b('0x17')](function(_0x2cc6ad){_0x5c2e19=_0x2cc6ad['rows'];return rtq[_0x805b('0x4f')](_0x21b8ac,_0x5c2e19,_0x3729cd,_0x2d313f['query'][_0x805b('0x42')]);})[_0x805b('0x17')](function(_0x3847f1){_0x200c6d[_0x805b('0x22')]=_0x3847f1;return _0x200c6d;})[_0x805b('0x17')](respondWithFilteredResult(_0x5f0d24,_0xf7f675))['catch'](APIHandleError(_0x5f0d24));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index e79d41d..b376892 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x133de8,_0xdde3d9){var _0x1861eb=function(_0x395f6b){while(--_0x395f6b){_0x133de8['push'](_0x133de8['shift']());}};_0x1861eb(++_0xdde3d9);}(_0xedd9,0xfc));var _0x9edd=function(_0x225a46,_0x224368){_0x225a46=_0x225a46-0x0;var _0x3a1797=_0xedd9[_0x225a46];return _0x3a1797;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x227f13,_0x14a6e8){var _0xc1e07=function(_0x41057c){while(--_0x41057c){_0x227f13['push'](_0x227f13['shift']());}};_0xc1e07(++_0x14a6e8);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 6e5976f..6ddd41d 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 _0x1939=['DATE','sequelize','INTEGER','STRING'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x1939,0x1d1));var _0x9193=function(_0x26a515,_0x286339){_0x26a515=_0x26a515-0x0;var _0x314682=_0x1939[_0x26a515];return _0x314682;};'use strict';var Sequelize=require(_0x9193('0x0'));module['exports']={'state':{'type':Sequelize[_0x9193('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x9193('0x2')]},'scheduledat':{'type':Sequelize[_0x9193('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9193('0x3')]},'responsetime':{'type':Sequelize[_0x9193('0x3')]},'ringtime':{'type':Sequelize[_0x9193('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9193('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9193('0x2')]}}; \ No newline at end of file +var _0x3641=['DATE','STRING','INTEGER','exports'];(function(_0x32c1fb,_0x312e7f){var _0x5e442d=function(_0x477655){while(--_0x477655){_0x32c1fb['push'](_0x32c1fb['shift']());}};_0x5e442d(++_0x312e7f);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1364('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1364('0x1')]},'uniqueid':{'type':Sequelize[_0x1364('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1364('0x1')]},'ringtime':{'type':Sequelize[_0x1364('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1364('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1364('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 7ff56a9..fc4caea 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 _0x675e=['define','ReportAgentPreview','report_agent_preview','lodash','util','moment','request-promise','path','rimraf','./reportAgentPreview.attributes'];(function(_0x4f828c,_0x2f6cac){var _0x1fea4d=function(_0x3049f2){while(--_0x3049f2){_0x4f828c['push'](_0x4f828c['shift']());}};_0x1fea4d(++_0x2f6cac);}(_0x675e,0x1a7));var _0xe675=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x675e[_0x3f6565];return _0x4abd23;};'use strict';var _=require(_0xe675('0x0'));var util=require(_0xe675('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe675('0x2'));var BPromise=require('bluebird');var rp=require(_0xe675('0x3'));var fs=require('fs');var path=require(_0xe675('0x4'));var rimraf=require(_0xe675('0x5'));var config=require('../../config/environment');var attributes=require(_0xe675('0x6'));module['exports']=function(_0x1ee97b,_0x3e36fd){return _0x1ee97b[_0xe675('0x7')](_0xe675('0x8'),attributes,{'tableName':_0xe675('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd290=['api','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','define','report_agent_preview','lodash','util','../../config/logger'];(function(_0x2fae24,_0x8b4e9){var _0x25a62f=function(_0x27e31f){while(--_0x27e31f){_0x2fae24['push'](_0x2fae24['shift']());}};_0x25a62f(++_0x8b4e9);}(_0xd290,0x15d));var _0x0d29=function(_0x5be628,_0x565ebd){_0x5be628=_0x5be628-0x0;var _0x18249e=_0xd290[_0x5be628];return _0x18249e;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var logger=require(_0x0d29('0x2'))(_0x0d29('0x3'));var moment=require('moment');var BPromise=require(_0x0d29('0x4'));var rp=require(_0x0d29('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var attributes=require(_0x0d29('0x8'));module['exports']=function(_0x441192,_0x5b763f){return _0x441192[_0x0d29('0x9')]('ReportAgentPreview',attributes,{'tableName':_0x0d29('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 608fa64..f8af42c 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 _0x30ff=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2044ec,_0x86721e){var _0x4472e3=function(_0x10972e){while(--_0x10972e){_0x2044ec['push'](_0x2044ec['shift']());}};_0x4472e3(++_0x86721e);}(_0x30ff,0x6a));var _0xf30f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x30ff[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xf30f('0x0'));var moment=require(_0xf30f('0x1'));var BPromise=require(_0xf30f('0x2'));var rs=require(_0xf30f('0x3'));var fs=require('fs');var Redis=require(_0xf30f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf30f('0x5'));var logger=require(_0xf30f('0x6'))('rpc');var config=require(_0xf30f('0x7'));var jayson=require(_0xf30f('0x8'));var client=jayson[_0xf30f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c95ba,_0x25c70a,_0x1a1fc0){return new BPromise(function(_0x398805,_0x5b4901){return client[_0xf30f('0xa')](_0x2c95ba,_0x1a1fc0)[_0xf30f('0xb')](function(_0x35cff8){logger[_0xf30f('0xc')](_0xf30f('0xd'),_0x25c70a,_0xf30f('0xe'));logger[_0xf30f('0xf')](_0xf30f('0x10'),_0x25c70a,_0xf30f('0xe'),JSON[_0xf30f('0x11')](_0x35cff8));if(_0x35cff8[_0xf30f('0x12')]){if(_0x35cff8[_0xf30f('0x12')]['code']===0x1f4){logger[_0xf30f('0x12')](_0xf30f('0xd'),_0x25c70a,_0x35cff8[_0xf30f('0x12')]['message']);return _0x5b4901(_0x35cff8[_0xf30f('0x12')][_0xf30f('0x13')]);}logger[_0xf30f('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x25c70a,_0x35cff8[_0xf30f('0x12')][_0xf30f('0x13')]);return _0x398805(_0x35cff8[_0xf30f('0x12')][_0xf30f('0x13')]);}else{logger[_0xf30f('0xc')](_0xf30f('0xd'),_0x25c70a,_0xf30f('0xe'));_0x398805(_0x35cff8[_0xf30f('0x14')][_0xf30f('0x13')]);}})['catch'](function(_0x3d1d77){logger[_0xf30f('0x12')](_0xf30f('0xd'),_0x25c70a,_0x3d1d77);_0x5b4901(_0x3d1d77);});});}exports[_0xf30f('0x15')]=function(_0xce8b1b){var _0x16c4ad=this;return new Promise(function(_0x532d98,_0x175e27){return db[_0xf30f('0x16')][_0xf30f('0x17')](_0xce8b1b[_0xf30f('0x18')],{'raw':_0xce8b1b['options']?_0xce8b1b[_0xf30f('0x19')][_0xf30f('0x1a')]===undefined?!![]:![]:!![]})[_0xf30f('0xb')](function(_0x47d75e){logger['info'](_0xf30f('0x15'),_0xce8b1b);logger[_0xf30f('0xf')](_0xf30f('0x15'),_0xce8b1b,JSON['stringify'](_0x47d75e));_0x532d98(_0x47d75e);})[_0xf30f('0x1b')](function(_0xca91e2){logger[_0xf30f('0x12')](_0xf30f('0x15'),_0xca91e2[_0xf30f('0x13')],_0xce8b1b);_0x175e27(_0x16c4ad['error'](0x1f4,_0xca91e2[_0xf30f('0x13')]));});});}; \ No newline at end of file +var _0xd0ac=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','then','lodash','moment','bluebird','randomstring'];(function(_0x4a6f7b,_0x442d79){var _0x3f3fdf=function(_0x406eea){while(--_0x406eea){_0x4a6f7b['push'](_0x4a6f7b['shift']());}};_0x3f3fdf(++_0x442d79);}(_0xd0ac,0x101));var _0xcd0a=function(_0x4feaa0,_0x2c2d83){_0x4feaa0=_0x4feaa0-0x0;var _0x561149=_0xd0ac[_0x4feaa0];return _0x561149;};'use strict';var _=require(_0xcd0a('0x0'));var util=require('util');var moment=require(_0xcd0a('0x1'));var BPromise=require(_0xcd0a('0x2'));var rs=require(_0xcd0a('0x3'));var fs=require('fs');var Redis=require(_0xcd0a('0x4'));var db=require(_0xcd0a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd0a('0x6'))(_0xcd0a('0x7'));var config=require(_0xcd0a('0x8'));var jayson=require(_0xcd0a('0x9'));var client=jayson[_0xcd0a('0xa')][_0xcd0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27de8f,_0x4f648c,_0x1764bb){return new BPromise(function(_0x4ef069,_0x369721){return client['request'](_0x27de8f,_0x1764bb)['then'](function(_0x378c2b){logger[_0xcd0a('0xc')](_0xcd0a('0xd'),_0x4f648c,_0xcd0a('0xe'));logger[_0xcd0a('0xf')](_0xcd0a('0x10'),_0x4f648c,'request\x20sent',JSON[_0xcd0a('0x11')](_0x378c2b));if(_0x378c2b['error']){if(_0x378c2b[_0xcd0a('0x12')][_0xcd0a('0x13')]===0x1f4){logger['error'](_0xcd0a('0xd'),_0x4f648c,_0x378c2b[_0xcd0a('0x12')]['message']);return _0x369721(_0x378c2b[_0xcd0a('0x12')][_0xcd0a('0x14')]);}logger[_0xcd0a('0x12')](_0xcd0a('0xd'),_0x4f648c,_0x378c2b[_0xcd0a('0x12')][_0xcd0a('0x14')]);return _0x4ef069(_0x378c2b[_0xcd0a('0x12')][_0xcd0a('0x14')]);}else{logger[_0xcd0a('0xc')](_0xcd0a('0xd'),_0x4f648c,_0xcd0a('0xe'));_0x4ef069(_0x378c2b[_0xcd0a('0x15')][_0xcd0a('0x14')]);}})[_0xcd0a('0x16')](function(_0x1a4d0f){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x4f648c,_0x1a4d0f);_0x369721(_0x1a4d0f);});});}exports[_0xcd0a('0x17')]=function(_0xe9883){var _0x337ba4=this;return new Promise(function(_0x5273be,_0x359964){return db[_0xcd0a('0x18')]['create'](_0xe9883[_0xcd0a('0x19')],{'raw':_0xe9883[_0xcd0a('0x1a')]?_0xe9883['options'][_0xcd0a('0x1b')]===undefined?!![]:![]:!![]})[_0xcd0a('0x1c')](function(_0x87169f){logger[_0xcd0a('0xc')](_0xcd0a('0x17'),_0xe9883);logger['debug'](_0xcd0a('0x17'),_0xe9883,JSON['stringify'](_0x87169f));_0x5273be(_0x87169f);})[_0xcd0a('0x16')](function(_0x5522c1){logger['error']('CreateReportAgentPreview',_0x5522c1[_0xcd0a('0x14')],_0xe9883);_0x359964(_0x337ba4[_0xcd0a('0x12')](0x1f4,_0x5522c1[_0xcd0a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0fff548..f2fbb22 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 _0x7c70=['/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','chat','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','telephones','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions'];(function(_0x4ede38,_0x4dc1e4){var _0x28119e=function(_0x3c6bb1){while(--_0x3c6bb1){_0x4ede38['push'](_0x4ede38['shift']());}};_0x28119e(++_0x4dc1e4);}(_0x7c70,0xfc));var _0x07c7=function(_0x2a4fa4,_0x20ff6c){_0x2a4fa4=_0x2a4fa4-0x0;var _0x20104a=_0x7c70[_0x2a4fa4];return _0x20104a;};'use strict';var multer=require(_0x07c7('0x0'));var util=require('util');var path=require(_0x07c7('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x07c7('0x2'));var controller=require(_0x07c7('0x3'));router[_0x07c7('0x4')](_0x07c7('0x5'),auth[_0x07c7('0x6')](),controller['voiceChannels']);router['get'](_0x07c7('0x7'),auth[_0x07c7('0x6')](),controller['voiceChannelMixMonitor']);router[_0x07c7('0x4')](_0x07c7('0x8'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x9')]);router['get'](_0x07c7('0xa'),auth[_0x07c7('0x6')](),controller[_0x07c7('0xb')]);router['get'](_0x07c7('0xc'),auth[_0x07c7('0x6')](),controller[_0x07c7('0xd')]);router[_0x07c7('0x4')](_0x07c7('0xe'),auth['isAuthenticated'](),controller[_0x07c7('0xf')]);router[_0x07c7('0x4')](_0x07c7('0x10'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x11')]);router[_0x07c7('0x4')](_0x07c7('0x12'),auth[_0x07c7('0x6')](),controller['openchannelQueues']);router[_0x07c7('0x4')]('/sms/queues',auth[_0x07c7('0x6')](),controller[_0x07c7('0x13')]);router['get'](_0x07c7('0x14'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x15')]);router['get']('/fax/queues',auth[_0x07c7('0x6')](),controller[_0x07c7('0x16')]);router['get'](_0x07c7('0x17'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x18')]);router[_0x07c7('0x4')](_0x07c7('0x19'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x1a')]);router[_0x07c7('0x4')](_0x07c7('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x07c7('0x4')](_0x07c7('0x1c'),auth[_0x07c7('0x6')](),controller['voiceQueuesChannelHangup']);router['get'](_0x07c7('0x1d'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x1e')]);router[_0x07c7('0x4')]('/voice/queues/:id',auth[_0x07c7('0x6')](),controller[_0x07c7('0x1f')]);router[_0x07c7('0x20')](_0x07c7('0x21'),auth[_0x07c7('0x6')](),controller['updateVoiceQueue']);router[_0x07c7('0x4')](_0x07c7('0x22'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x23')]);router[_0x07c7('0x4')](_0x07c7('0x24'),auth[_0x07c7('0x6')](),controller['outboundChannels']);router[_0x07c7('0x4')](_0x07c7('0x25'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x26')]);router[_0x07c7('0x20')](_0x07c7('0x27'),auth[_0x07c7('0x6')](),controller['agentCapacity']);router['get'](_0x07c7('0x28'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x29')]);router[_0x07c7('0x4')]('/trunks',auth[_0x07c7('0x6')](),controller[_0x07c7('0x2a')]);router[_0x07c7('0x4')]('/campaigns',auth[_0x07c7('0x6')](),controller[_0x07c7('0x2b')]);router['get'](_0x07c7('0x2c'),auth[_0x07c7('0x6')](),controller['faxAccounts']);router[_0x07c7('0x4')](_0x07c7('0x2d'),auth[_0x07c7('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x07c7('0x4')](_0x07c7('0x2e'),auth[_0x07c7('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x07c7('0x4')](_0x07c7('0x2f'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x30')]);router[_0x07c7('0x4')](_0x07c7('0x31'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x07c7('0x4')](_0x07c7('0x32'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x33')]);router[_0x07c7('0x4')](_0x07c7('0x34'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x35')]);router['get'](_0x07c7('0x36'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x37')]);router[_0x07c7('0x38')](_0x07c7('0x39'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x3a')]('mail'));router[_0x07c7('0x4')](_0x07c7('0x3b'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x3c')]);router[_0x07c7('0x38')]('/chat/queues/:id/notify',auth[_0x07c7('0x6')](),controller[_0x07c7('0x3a')](_0x07c7('0x3d')));router[_0x07c7('0x4')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x07c7('0x38')]('/fax/queues/:id/notify',auth[_0x07c7('0x6')](),controller[_0x07c7('0x3a')]('fax'));router['get'](_0x07c7('0x3e'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x3f')]);router[_0x07c7('0x38')](_0x07c7('0x40'),auth['isAuthenticated'](),controller[_0x07c7('0x3a')](_0x07c7('0x41')));router[_0x07c7('0x4')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x07c7('0x42')]);router[_0x07c7('0x38')](_0x07c7('0x43'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x3a')](_0x07c7('0x44')));router[_0x07c7('0x38')]('/whatsapp/queues/:id/notify',auth[_0x07c7('0x6')](),controller[_0x07c7('0x3a')](_0x07c7('0x45')));router[_0x07c7('0x4')](_0x07c7('0x46'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x47')]);router['get']('/whatsapp/queues/:id',auth[_0x07c7('0x6')](),controller[_0x07c7('0x48')]);router['post'](_0x07c7('0x49'),auth[_0x07c7('0x6')](),controller[_0x07c7('0x4a')]);module[_0x07c7('0x4b')]=router; \ No newline at end of file +var _0xb6c2=['openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','util','express','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','mailAccounts','/openchannel/queues'];(function(_0x417c6d,_0x2f1520){var _0x20ce91=function(_0x430ec1){while(--_0x430ec1){_0x417c6d['push'](_0x417c6d['shift']());}};_0x20ce91(++_0x2f1520);}(_0xb6c2,0x141));var _0x2b6c=function(_0x449110,_0xfabf30){_0x449110=_0x449110-0x0;var _0x2e57e2=_0xb6c2[_0x449110];return _0x2e57e2;};'use strict';var multer=require(_0x2b6c('0x0'));var util=require(_0x2b6c('0x1'));var path=require('path');var express=require(_0x2b6c('0x2'));var router=express[_0x2b6c('0x3')]();var auth=require(_0x2b6c('0x4'));var controller=require(_0x2b6c('0x5'));router[_0x2b6c('0x6')](_0x2b6c('0x7'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x9')]);router[_0x2b6c('0x6')](_0x2b6c('0xa'),auth['isAuthenticated'](),controller[_0x2b6c('0xb')]);router[_0x2b6c('0x6')](_0x2b6c('0xc'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0xd')]);router[_0x2b6c('0x6')](_0x2b6c('0xe'),auth['isAuthenticated'](),controller[_0x2b6c('0xf')]);router[_0x2b6c('0x6')](_0x2b6c('0x10'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x11')]);router['get'](_0x2b6c('0x12'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x13')]);router[_0x2b6c('0x6')](_0x2b6c('0x14'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x15')]);router[_0x2b6c('0x6')](_0x2b6c('0x16'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x17')]);router[_0x2b6c('0x6')](_0x2b6c('0x18'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x19')]);router[_0x2b6c('0x6')](_0x2b6c('0x1a'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get'](_0x2b6c('0x1b'),auth['isAuthenticated'](),controller[_0x2b6c('0x1c')]);router[_0x2b6c('0x6')](_0x2b6c('0x1d'),auth[_0x2b6c('0x8')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x2b6c('0x1e')]);router['get'](_0x2b6c('0x1f'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x20')]);router[_0x2b6c('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x21')]);router[_0x2b6c('0x6')](_0x2b6c('0x22'),auth[_0x2b6c('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0x2b6c('0x6')](_0x2b6c('0x23'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x24')]);router[_0x2b6c('0x25')](_0x2b6c('0x23'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x26')]);router[_0x2b6c('0x6')]('/outbound',auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x27')]);router[_0x2b6c('0x6')](_0x2b6c('0x28'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x29')]);router[_0x2b6c('0x6')](_0x2b6c('0x2a'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x2b')]);router[_0x2b6c('0x25')]('/agents/:id/capacity',auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x2c')]);router[_0x2b6c('0x6')](_0x2b6c('0x2d'),auth['isAuthenticated'](),controller[_0x2b6c('0x2e')]);router[_0x2b6c('0x6')](_0x2b6c('0x2f'),auth['isAuthenticated'](),controller[_0x2b6c('0x30')]);router[_0x2b6c('0x6')](_0x2b6c('0x31'),auth[_0x2b6c('0x8')](),controller['campaigns']);router[_0x2b6c('0x6')](_0x2b6c('0x32'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x33')]);router[_0x2b6c('0x6')](_0x2b6c('0x34'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router['get'](_0x2b6c('0x35'),auth['isAuthenticated'](),controller[_0x2b6c('0x36')]);router['get'](_0x2b6c('0x37'),auth['isAuthenticated'](),controller[_0x2b6c('0x38')]);router[_0x2b6c('0x6')](_0x2b6c('0x39'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x3a')]);router['get']('/sms/queues/waitinginteractions',auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x3b')]);router['get'](_0x2b6c('0x3c'),auth['isAuthenticated'](),controller[_0x2b6c('0x3d')]);router['get'](_0x2b6c('0x3e'),auth['isAuthenticated'](),controller[_0x2b6c('0x3f')]);router[_0x2b6c('0x40')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x2b6c('0x41')](_0x2b6c('0x42')));router['get']('/mail/queues/:id',auth[_0x2b6c('0x8')](),controller['showMailQueues']);router[_0x2b6c('0x40')](_0x2b6c('0x43'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x41')](_0x2b6c('0x44')));router[_0x2b6c('0x6')](_0x2b6c('0x45'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x46')]);router[_0x2b6c('0x40')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x2b6c('0x47')));router[_0x2b6c('0x6')](_0x2b6c('0x48'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x49')]);router[_0x2b6c('0x40')](_0x2b6c('0x4a'),auth['isAuthenticated'](),controller[_0x2b6c('0x41')](_0x2b6c('0x4b')));router['get'](_0x2b6c('0x4c'),auth['isAuthenticated'](),controller[_0x2b6c('0x4d')]);router['post'](_0x2b6c('0x4e'),auth['isAuthenticated'](),controller[_0x2b6c('0x41')](_0x2b6c('0x4f')));router[_0x2b6c('0x40')](_0x2b6c('0x50'),auth[_0x2b6c('0x8')](),controller['queueNotify']('whatsapp'));router['get'](_0x2b6c('0x51'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x52')]);router[_0x2b6c('0x6')](_0x2b6c('0x53'),auth[_0x2b6c('0x8')](),controller['showWhatsappQueues']);router[_0x2b6c('0x40')](_0x2b6c('0x54'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x55')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 2a58705..4fe4340 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 _0xee14=['telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','channel','Website','User','agent','Agent\x20not\x20found','\x20Message\x20not\x20found','*,*,*,*','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','INTERACTION','SIP/%s','AgentCapacity'];(function(_0x299e7a,_0x1122d1){var _0x4dd909=function(_0x5a27af){while(--_0x5a27af){_0x299e7a['push'](_0x299e7a['shift']());}};_0x4dd909(++_0x1122d1);}(_0xee14,0x13a));var _0x4ee1=function(_0x5e85b5,_0x201b4b){_0x5e85b5=_0x5e85b5-0x0;var _0x252f45=_0xee14[_0x5e85b5];return _0x252f45;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x4ee1('0x0'));var util=require(_0x4ee1('0x1'));var db=require(_0x4ee1('0x2'))['db'];var logger=require(_0x4ee1('0x3'))(_0x4ee1('0x4'));var jayson=require(_0x4ee1('0x5'));var amiClient=jayson[_0x4ee1('0x6')][_0x4ee1('0x7')]({'port':0x232a});var mailClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){var _0x1fd8c8=_0x187656?_0x187656:amiClient;return _0x1fd8c8['request'](_0x327c18,_0x3a45a3)[_0x4ee1('0x8')](function(_0x38be25){if(_0x38be25['error']){if(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xa')]===0x1f4){return _0xdfe9c1(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xb')]);}return _0x293d5f(_0x38be25['error'][_0x4ee1('0xb')]);}else{_0x293d5f(_0x38be25[_0x4ee1('0xc')]);}})[_0x4ee1('0xd')](function(_0x2d5d3c){_0xdfe9c1(_0x2d5d3c);});});}function respondWithResult(_0x2f864e,_0x174427){_0x174427=_0x174427||0xc8;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0xe')](_0x174427)[_0x4ee1('0xf')](_0x5616d6);}return _0x2f864e[_0x4ee1('0x10')](0x194);};}function handleError(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0x1f4;return function(_0x1c342a){logger[_0x4ee1('0x9')](_0x1c342a[_0x4ee1('0x11')]);if(_0x1c342a[_0x4ee1('0x12')]){delete _0x1c342a['name'];}_0x24a915[_0x4ee1('0xe')](_0x46d2c2)[_0x4ee1('0x13')](_0x1c342a);};}function findById(_0x34651b){return function(_0x1b1e0e){if(!_[_0x4ee1('0x14')](_0x34651b)&&!_[_0x4ee1('0x14')](_0x1b1e0e)&&!_[_0x4ee1('0x14')](_0x1b1e0e[_0x4ee1('0x15')])){return _[_0x4ee1('0x16')](_0x1b1e0e[_0x4ee1('0x15')],function(_0x274de5){return _0x274de5['id']==_0x34651b;});}return null;};}exports['voiceChannels']=function(_0x236215,_0x3db827){return respondWithRpcPromise(_0x4ee1('0x17'),_0x236215[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3db827,null))[_0x4ee1('0xd')](handleError(_0x3db827,null));};exports['voiceChannelMixMonitor']=function(_0x8a631f,_0x333e96){return respondWithRpcPromise(_0x4ee1('0x19'),_[_0x4ee1('0x1a')](_0x8a631f[_0x4ee1('0x18')],_0x8a631f[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x333e96,null))[_0x4ee1('0xd')](handleError(_0x333e96,null));};exports[_0x4ee1('0x1c')]=function(_0x3e5038,_0x4faaf6){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x4ee1('0x1a')](_0x3e5038[_0x4ee1('0x18')],_0x3e5038[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x4faaf6,null))[_0x4ee1('0xd')](handleError(_0x4faaf6,null));};exports[_0x4ee1('0x1d')]=function(_0x57d45d,_0x5cc0b5){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x57d45d[_0x4ee1('0x18')])['then'](respondWithResult(_0x5cc0b5,null))[_0x4ee1('0xd')](handleError(_0x5cc0b5,null));};exports[_0x4ee1('0x1f')]=function(_0x36654c,_0x215949){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x36654c[_0x4ee1('0x18')])[_0x4ee1('0x8')](findById(_0x36654c['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x215949,null))['catch'](handleError(_0x215949,null));};exports[_0x4ee1('0x20')]=function(_0x4ec408,_0x3dc870){return respondWithRpcPromise(_0x4ee1('0x21'),_[_0x4ee1('0x1a')](_0x4ec408[_0x4ee1('0x22')],_0x4ec408[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x3dc870,null))[_0x4ee1('0xd')](handleError(_0x3dc870,null));};exports['voiceQueuesPreview']=function(_0x121301,_0x3d5e6c){return respondWithRpcPromise(_0x4ee1('0x23'),_[_0x4ee1('0x1a')](_0x121301[_0x4ee1('0x18')],_0x121301['params']))[_0x4ee1('0x8')](respondWithResult(_0x3d5e6c,null))[_0x4ee1('0xd')](handleError(_0x3d5e6c,null));};exports[_0x4ee1('0x24')]=function(_0x2e37a3,_0x79f87c){return respondWithRpcPromise(_0x4ee1('0x25'),_0x2e37a3['query'])['then'](respondWithResult(_0x79f87c,null))[_0x4ee1('0xd')](handleError(_0x79f87c,null));};exports[_0x4ee1('0x26')]=function(_0x41ab60,_0x5a2f6f){return respondWithRpcPromise(_0x4ee1('0x27'),_[_0x4ee1('0x1a')](_0x41ab60[_0x4ee1('0x18')],_0x41ab60[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x5a2f6f,null))[_0x4ee1('0xd')](handleError(_0x5a2f6f,null));};exports[_0x4ee1('0x28')]=function(_0x199e11,_0x36898c){return respondWithRpcPromise(_0x4ee1('0x29'),_[_0x4ee1('0x1a')](_0x199e11[_0x4ee1('0x18')],_0x199e11[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x36898c,null))[_0x4ee1('0xd')](handleError(_0x36898c,null));};exports[_0x4ee1('0x2a')]=function(_0x882468,_0x50539f){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x4ee1('0x1a')](_0x882468[_0x4ee1('0x18')],_0x882468[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x50539f,null))['catch'](handleError(_0x50539f,null));};exports[_0x4ee1('0x2b')]=function(_0x2ed16f,_0x11721a){return respondWithRpcPromise(_0x4ee1('0x2c'),_0x2ed16f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x11721a,null))[_0x4ee1('0xd')](handleError(_0x11721a,null));};exports[_0x4ee1('0x2d')]=function(_0x59b5cc,_0x3b346e){return respondWithRpcPromise(_0x4ee1('0x2e'),_0x59b5cc[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3b346e,null))[_0x4ee1('0xd')](handleError(_0x3b346e,null));};exports[_0x4ee1('0x2f')]=function(_0x543b2e,_0x3e2ca7){var _0x37176a;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')])[_0x4ee1('0x8')](function(_0x352dc5){_0x37176a=_0x352dc5;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')],routingClient);})[_0x4ee1('0x8')](function(_0x29493d){return _[_0x4ee1('0x1a')]({},_0x29493d,_0x37176a);})[_0x4ee1('0x8')](respondWithResult(_0x3e2ca7,null))[_0x4ee1('0xd')](handleError(_0x3e2ca7,null));};exports['agentCapacity']=function(_0x3b3bed,_0x40a3e3){if(_0x3b3bed['body']&&_0x3b3bed[_0x4ee1('0x22')]['interaction']&&_0x3b3bed[_0x4ee1('0x31')]&&_0x3b3bed['user'][_0x4ee1('0x12')]){for(var _0xc7580c in _0x3b3bed['body'][_0x4ee1('0x32')]){if(_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0x4ee1('0x33')](_0xc7580c)){db['MemberReport'][_0x4ee1('0x34')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3b3bed['body'][_0x4ee1('0x32')][_0xc7580c]&&_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')]?{'$notIn':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c]}:{'$ne':null}}})['then'](function(_0xaa71d5){var _0x266add=moment()[_0x4ee1('0x36')](_0x4ee1('0x37'));for(var _0x5c5862=0x0,_0x3d6bf4=_0xaa71d5[_0x4ee1('0x35')];_0x5c5862<_0x3d6bf4;_0x5c5862+=0x1){_0xaa71d5[_0x5c5862]['updateAttributes']({'exitAt':_0x266add});}});for(var _0x21ebb8=0x0;_0x21ebb8<_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')];_0x21ebb8+=0x1){db[_0x4ee1('0x38')][_0x4ee1('0x39')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':_0x4ee1('0x3a'),'uniqueid':_0x3b3bed['body']['interaction'][_0xc7580c][_0x21ebb8],'exitAt':null},'defaults':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'interface':_[_0x4ee1('0x14')](_0x3b3bed[_0x4ee1('0x31')]['interface'])?util[_0x4ee1('0x36')](_0x4ee1('0x3b'),_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')]):_0x3b3bed[_0x4ee1('0x31')]['interface'],'type':_0x4ee1('0x3a'),'enterAt':moment()[_0x4ee1('0x36')](_0x4ee1('0x37')),'role':'agent','internal':_0x3b3bed[_0x4ee1('0x31')]['internal'],'uniqueid':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c][_0x21ebb8]}});}}}}return respondWithRpcPromise(_0x4ee1('0x3c'),{'id':_0x3b3bed['params']['id'],'capacity':_0x3b3bed[_0x4ee1('0x22')]['capacity']},routingClient)[_0x4ee1('0x8')](respondWithResult(_0x40a3e3,null))[_0x4ee1('0xd')](handleError(_0x40a3e3,null));};exports[_0x4ee1('0x3d')]=function(_0x5f4f78,_0x3368ed){return respondWithRpcPromise(_0x4ee1('0x3e'),_0x5f4f78[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3368ed,null))[_0x4ee1('0xd')](handleError(_0x3368ed,null));};exports[_0x4ee1('0x3f')]=function(_0x3f1c32,_0x517729){return respondWithRpcPromise('Trunks',_0x3f1c32[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x517729,null))[_0x4ee1('0xd')](handleError(_0x517729,null));};exports[_0x4ee1('0x40')]=function(_0x44e65f,_0x31e82d){return respondWithRpcPromise(_0x4ee1('0x41'),_0x44e65f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x31e82d,null))[_0x4ee1('0xd')](handleError(_0x31e82d,null));};exports[_0x4ee1('0x42')]=function(_0x2453ac,_0x3c2e42){return respondWithRpcPromise('ChatQueues',_0x2453ac[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x3c2e42,null))[_0x4ee1('0xd')](handleError(_0x3c2e42,null));};exports[_0x4ee1('0x43')]=function(_0x59bbca,_0x1e0aac){return respondWithRpcPromise(_0x4ee1('0x44'),_0x59bbca['query'],routingClient)['then'](findById(_0x59bbca[_0x4ee1('0x1b')]['id']))['then'](respondWithResult(_0x1e0aac,null))[_0x4ee1('0xd')](handleError(_0x1e0aac,null));};exports[_0x4ee1('0x45')]=function(_0x59ba70,_0x43489c){return respondWithRpcPromise(_0x4ee1('0x46'),_0x59ba70[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x43489c,null))[_0x4ee1('0xd')](handleError(_0x43489c,null));};exports[_0x4ee1('0x47')]=function(_0x11f619,_0x5f5694){return respondWithRpcPromise('MailQueues',_0x11f619[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x11f619['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x5f5694,null))[_0x4ee1('0xd')](handleError(_0x5f5694,null));};exports[_0x4ee1('0x48')]=function(_0x51e341,_0x1ad933){return respondWithRpcPromise('MailAccounts',_0x51e341[_0x4ee1('0x18')],mailClient)['then'](respondWithResult(_0x1ad933,null))['catch'](handleError(_0x1ad933,null));};exports[_0x4ee1('0x49')]=function(_0x16fcd0,_0x290451){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x16fcd0[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x290451,null))[_0x4ee1('0xd')](handleError(_0x290451,null));};exports[_0x4ee1('0x4b')]=function(_0x10f4e,_0x58eb1d){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x10f4e[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x10f4e[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x58eb1d,null))[_0x4ee1('0xd')](handleError(_0x58eb1d,null));};exports[_0x4ee1('0x4c')]=function(_0x20ca0b,_0x19fa31){return respondWithRpcPromise(_0x4ee1('0x4d'),_0x20ca0b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x19fa31,null))['catch'](handleError(_0x19fa31,null));};exports[_0x4ee1('0x4e')]=function(_0x5bf5e9,_0x25cfc3){return respondWithRpcPromise('SmsQueues',_0x5bf5e9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x5bf5e9[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x25cfc3,null))[_0x4ee1('0xd')](handleError(_0x25cfc3,null));};exports[_0x4ee1('0x4f')]=function(_0x342aa1,_0x447060){return respondWithRpcPromise(_0x4ee1('0x50'),_0x342aa1[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x447060,null))[_0x4ee1('0xd')](handleError(_0x447060,null));};exports['showWhatsappQueues']=function(_0x759888,_0x24308c){return respondWithRpcPromise(_0x4ee1('0x50'),_0x759888['query'],routingClient)['then'](findById(_0x759888[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x24308c,null))['catch'](handleError(_0x24308c,null));};exports[_0x4ee1('0x51')]=function(_0x431dfa,_0x3f8f94){return respondWithRpcPromise(_0x4ee1('0x52'),_0x431dfa[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x3f8f94,null))[_0x4ee1('0xd')](handleError(_0x3f8f94,null));};exports[_0x4ee1('0x53')]=function(_0x28e11c,_0x3824bf){return respondWithRpcPromise('FaxQueues',_0x28e11c[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x28e11c['params']['id']))['then'](respondWithResult(_0x3824bf,null))[_0x4ee1('0xd')](handleError(_0x3824bf,null));};exports[_0x4ee1('0x54')]=function(_0x19e095,_0x38e06){return respondWithRpcPromise(_0x4ee1('0x55'),_0x19e095[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x38e06,null))['catch'](handleError(_0x38e06,null));};exports[_0x4ee1('0x56')]=function(_0x39583b,_0x44af66){return respondWithRpcPromise(_0x4ee1('0x57'),_0x39583b[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x44af66,null))[_0x4ee1('0xd')](handleError(_0x44af66,null));};exports['mailQueuesWaitingInteractions']=function(_0x1d360f,_0x29371c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x1d360f['query'],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x29371c,null))[_0x4ee1('0xd')](handleError(_0x29371c,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2beb82,_0x5aacf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2beb82[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x5aacf1,null))[_0x4ee1('0xd')](handleError(_0x5aacf1,null));};exports[_0x4ee1('0x58')]=function(_0x37fa42,_0x38698a){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x37fa42[_0x4ee1('0x18')],routingClient)['then'](function(_0x57f66c){if(_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')]!==undefined){var _0x411c99=_(_0x57f66c[_0x4ee1('0x15')])[_0x4ee1('0x5a')]([_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')],_0x37fa42[_0x4ee1('0x1b')]['id']])['map'](_0x4ee1('0x5b'))[_0x4ee1('0x5c')]()['value']();return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0xcd0dd9){return _0x411c99[_0x4ee1('0x5d')](_0xcd0dd9[_0x4ee1('0x5b')])>-0x1;});}else{return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0x4dee3a){return _0x4dee3a[_0x4ee1('0x5b')]===parseInt(_0x37fa42['params']['id']);});}})[_0x4ee1('0x8')](respondWithResult(_0x38698a,null))[_0x4ee1('0xd')](handleError(_0x38698a,null));};exports[_0x4ee1('0x5e')]=function(_0x35a719,_0x48c51c){return respondWithRpcPromise(_0x4ee1('0x5f'),_0x35a719[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x48c51c,null))['catch'](handleError(_0x48c51c,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2ef7c9,_0x4b4ad5){return respondWithRpcPromise(_0x4ee1('0x60'),_0x2ef7c9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x4b4ad5,null))['catch'](handleError(_0x4b4ad5,null));};exports['faxQueuesWaitingInteractions']=function(_0x27fd3b,_0x1e2360){return respondWithRpcPromise(_0x4ee1('0x61'),_0x27fd3b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x1e2360,null))[_0x4ee1('0xd')](handleError(_0x1e2360,null));};exports[_0x4ee1('0x62')]=function(_0x5727ef){return function(_0x4a3201,_0x50645b){var _0x3fba19,_0x3a75a7;var _0x33f5af=_[_0x4ee1('0x63')](_0x5727ef);var _0x4db801=_0x5727ef===_0x4ee1('0x64')?'Website':_0x4ee1('0x65');return db[_0x33f5af+_0x4ee1('0x66')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x4a3201[_0x4ee1('0x1b')]['id']}})[_0x4ee1('0x8')](function(_0x190f59){if(_['isNil'](_0x190f59)){throw new Error(_0x33f5af+_0x4ee1('0x68'));}_0x3fba19=_0x190f59;return db[_0x33f5af+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x4a3201[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0x33f5af+_0x4ee1('0x6b')],'as':_0x4ee1('0x6b')},{'model':db[_0x33f5af+_0x4db801],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x207758){if(_[_0x4ee1('0x14')](_0x207758)){throw new Error(_0x33f5af+'\x20Message\x20not\x20found');}_0x3a75a7=_0x207758;return _0x207758[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x646878={'uniqueid':_0x5727ef+'.'+_0x3a75a7['id']+'.'+_0x3a75a7[_0x4ee1('0x6b')]['id'],'FromUserId':_0x4a3201[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d')};_0x646878[_0x33f5af+_0x4ee1('0x6e')]=_0x3a75a7['id'];_0x646878[_0x33f5af+_0x4ee1('0x6f')]=_0x3a75a7[_0x4ee1('0x6b')]['id'];_0x646878[_0x4ee1('0x70')+_0x33f5af+_0x4db801+'Id']=_0x3a75a7[_0x4ee1('0x65')]['id'];_0x646878['To'+_0x33f5af+_0x4ee1('0x71')]=_0x3fba19['id'];return db[_0x33f5af+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x646878);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x5727ef,'interaction':_0x3a75a7['Interaction'],'message':_0x3a75a7,'account':_0x3a75a7[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x6d'),'appdata':_0x3fba19['name']+','+(_0x3a75a7[_0x4ee1('0x65')][_0x4ee1('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x50645b,null))[_0x4ee1('0xd')](handleError(_0x50645b,null));};};exports['agentNotify']=function(_0x13a755,_0x1a00a4){var _0x47b854,_0x1700c6;if(_[_0x4ee1('0x14')](_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x2bc05a=_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')];var _0xc07f75=_[_0x4ee1('0x63')](_0x2bc05a);var _0x4315e9=_0x2bc05a===_0x4ee1('0x64')?_0x4ee1('0x77'):'Account';return db[_0x4ee1('0x78')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x13a755['params']['id'],'role':_0x4ee1('0x79')}})['then'](function(_0x5cf7fb){if(_[_0x4ee1('0x14')](_0x5cf7fb)){throw new Error(_0x4ee1('0x7a'));}_0x47b854=_0x5cf7fb;return db[_0xc07f75+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0xc07f75+'Interaction'],'as':_0x4ee1('0x6b')},{'model':db[_0xc07f75+_0x4315e9],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x17ae2d){if(_[_0x4ee1('0x14')](_0x17ae2d)){throw new Error(_0xc07f75+_0x4ee1('0x7b'));}_0x1700c6=_0x17ae2d;return _0x17ae2d[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x5076c6={'uniqueid':_0x2bc05a+'.'+_0x1700c6['id']+'.'+_0x1700c6[_0x4ee1('0x6b')]['id'],'FromUserId':_0x13a755[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d'),'ToUserId':_0x47b854['id']};_0x5076c6[_0xc07f75+_0x4ee1('0x6e')]=_0x1700c6['id'];_0x5076c6[_0xc07f75+_0x4ee1('0x6f')]=_0x1700c6['Interaction']['id'];_0x5076c6[_0x4ee1('0x70')+_0xc07f75+_0x4315e9+'Id']=_0x1700c6['Account']['id'];return db[_0xc07f75+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x5076c6);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x2bc05a,'interaction':_0x1700c6['Interaction'],'message':_0x1700c6,'account':_0x1700c6[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x79'),'appdata':_0x47b854['name']+','+(_0x1700c6[_0x4ee1('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x4ee1('0x7c')}]},routingClient);})[_0x4ee1('0x8')](respondWithResult(_0x1a00a4,null))['catch'](handleError(_0x1a00a4,null));}; \ No newline at end of file +var _0xe14b=['MessageId','InteractionId','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','Website','User','agent','Agent\x20not\x20found','Message','update','From','bluebird','moment','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','internal','AgentCapacity','capacity','telephones','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found'];(function(_0x97b032,_0x53327c){var _0x5414a8=function(_0x450983){while(--_0x450983){_0x97b032['push'](_0x97b032['shift']());}};_0x5414a8(++_0x53327c);}(_0xe14b,0x93));var _0xbe14=function(_0x4b679a,_0x396d09){_0x4b679a=_0x4b679a-0x0;var _0x32b50a=_0xe14b[_0x4b679a];return _0x32b50a;};'use strict';var BPromise=require(_0xbe14('0x0'));var moment=require(_0xbe14('0x1'));var _=require('lodash');var util=require('util');var db=require(_0xbe14('0x2'))['db'];var logger=require(_0xbe14('0x3'))('api');var jayson=require(_0xbe14('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232b});var routingClient=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){var _0x496063=_0x196fca?_0x196fca:amiClient;return _0x496063[_0xbe14('0x7')](_0x1d9ade,_0x39387e)[_0xbe14('0x8')](function(_0xd68cd7){if(_0xd68cd7[_0xbe14('0x9')]){if(_0xd68cd7['error']['code']===0x1f4){return _0x50f909(_0xd68cd7[_0xbe14('0x9')][_0xbe14('0xa')]);}return _0x566ae7(_0xd68cd7['error'][_0xbe14('0xa')]);}else{_0x566ae7(_0xd68cd7[_0xbe14('0xb')]);}})[_0xbe14('0xc')](function(_0x3d38c2){_0x50f909(_0x3d38c2);});});}function respondWithResult(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xc8;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0xd')](_0x3b898d)[_0xbe14('0xe')](_0x23a730);}return _0x27792f[_0xbe14('0xf')](0x194);};}function handleError(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0x1f4;return function(_0x813399){logger['error'](_0x813399['stack']);if(_0x813399[_0xbe14('0x10')]){delete _0x813399[_0xbe14('0x10')];}_0x1e4826[_0xbe14('0xd')](_0x33fd54)[_0xbe14('0x11')](_0x813399);};}function findById(_0x4e8f34){return function(_0x21c789){if(!_[_0xbe14('0x12')](_0x4e8f34)&&!_[_0xbe14('0x12')](_0x21c789)&&!_[_0xbe14('0x12')](_0x21c789[_0xbe14('0x13')])){return _[_0xbe14('0x14')](_0x21c789[_0xbe14('0x13')],function(_0x5ea1f8){return _0x5ea1f8['id']==_0x4e8f34;});}return null;};}exports[_0xbe14('0x15')]=function(_0x456ca8,_0x329588){return respondWithRpcPromise(_0xbe14('0x16'),_0x456ca8[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x329588,null))['catch'](handleError(_0x329588,null));};exports[_0xbe14('0x18')]=function(_0x4a1bbd,_0x417c8d){return respondWithRpcPromise(_0xbe14('0x19'),_[_0xbe14('0x1a')](_0x4a1bbd['query'],_0x4a1bbd[_0xbe14('0x1b')]))['then'](respondWithResult(_0x417c8d,null))[_0xbe14('0xc')](handleError(_0x417c8d,null));};exports['voiceChannelStopMixMonitor']=function(_0x32e8eb,_0x4a25fa){return respondWithRpcPromise(_0xbe14('0x1c'),_[_0xbe14('0x1a')](_0x32e8eb['query'],_0x32e8eb[_0xbe14('0x1b')]))['then'](respondWithResult(_0x4a25fa,null))[_0xbe14('0xc')](handleError(_0x4a25fa,null));};exports['voiceQueues']=function(_0x36a21e,_0x5fa043){return respondWithRpcPromise(_0xbe14('0x1d'),_0x36a21e[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x5fa043,null))[_0xbe14('0xc')](handleError(_0x5fa043,null));};exports['showVoiceQueues']=function(_0x1822e0,_0x1ba46a){return respondWithRpcPromise(_0xbe14('0x1d'),_0x1822e0[_0xbe14('0x17')])['then'](findById(_0x1822e0[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x1ba46a,null))['catch'](handleError(_0x1ba46a,null));};exports[_0xbe14('0x1e')]=function(_0x3b3e84,_0x1c7cc7){return respondWithRpcPromise(_0xbe14('0x1f'),_[_0xbe14('0x1a')](_0x3b3e84[_0xbe14('0x20')],_0x3b3e84[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x1c7cc7,null))[_0xbe14('0xc')](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x21')]=function(_0x40538f,_0x3bf43c){return respondWithRpcPromise(_0xbe14('0x22'),_[_0xbe14('0x1a')](_0x40538f[_0xbe14('0x17')],_0x40538f[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x3bf43c,null))[_0xbe14('0xc')](handleError(_0x3bf43c,null));};exports[_0xbe14('0x23')]=function(_0x14e7c4,_0x581e86){return respondWithRpcPromise(_0xbe14('0x24'),_0x14e7c4['query'])['then'](respondWithResult(_0x581e86,null))[_0xbe14('0xc')](handleError(_0x581e86,null));};exports['voiceQueuesChannel']=function(_0x243524,_0x345b0){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x243524['query'],_0x243524[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x345b0,null))['catch'](handleError(_0x345b0,null));};exports[_0xbe14('0x25')]=function(_0x1faf3e,_0x452635){return respondWithRpcPromise(_0xbe14('0x26'),_[_0xbe14('0x1a')](_0x1faf3e['query'],_0x1faf3e['params']))[_0xbe14('0x8')](respondWithResult(_0x452635,null))['catch'](handleError(_0x452635,null));};exports['voiceQueuesChannelRedirect']=function(_0x5c5e9f,_0x163ef7){return respondWithRpcPromise(_0xbe14('0x27'),_[_0xbe14('0x1a')](_0x5c5e9f[_0xbe14('0x17')],_0x5c5e9f[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x163ef7,null))[_0xbe14('0xc')](handleError(_0x163ef7,null));};exports[_0xbe14('0x28')]=function(_0x2d9c12,_0x2dfd5a){return respondWithRpcPromise(_0xbe14('0x29'),_0x2d9c12[_0xbe14('0x17')])['then'](respondWithResult(_0x2dfd5a,null))['catch'](handleError(_0x2dfd5a,null));};exports[_0xbe14('0x2a')]=function(_0x2951e1,_0x13bfcf){return respondWithRpcPromise('OutboundChannels',_0x2951e1[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x13bfcf,null))[_0xbe14('0xc')](handleError(_0x13bfcf,null));};exports[_0xbe14('0x2b')]=function(_0x3bd454,_0x25ee1f){var _0x19fa30;return respondWithRpcPromise(_0xbe14('0x2c'),_0x3bd454[_0xbe14('0x17')])['then'](function(_0xe51424){_0x19fa30=_0xe51424;return respondWithRpcPromise(_0xbe14('0x2c'),_0x3bd454[_0xbe14('0x17')],routingClient);})[_0xbe14('0x8')](function(_0x3287b9){return _[_0xbe14('0x1a')]({},_0x3287b9,_0x19fa30);})['then'](respondWithResult(_0x25ee1f,null))[_0xbe14('0xc')](handleError(_0x25ee1f,null));};exports[_0xbe14('0x2d')]=function(_0x1220c9,_0x36263c){if(_0x1220c9['body']&&_0x1220c9['body'][_0xbe14('0x2e')]&&_0x1220c9[_0xbe14('0x2f')]&&_0x1220c9[_0xbe14('0x2f')]['name']){for(var _0x5d5318 in _0x1220c9[_0xbe14('0x20')]['interaction']){if(_0x1220c9['body'][_0xbe14('0x2e')][_0xbe14('0x30')](_0x5d5318)){db[_0xbe14('0x31')]['findAll']({'where':{'channel':_0x5d5318,'membername':_0x1220c9['user']['name'],'type':_0xbe14('0x32'),'exitAt':null,'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318]&&_0x1220c9['body'][_0xbe14('0x2e')][_0x5d5318][_0xbe14('0x33')]?{'$notIn':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318]}:{'$ne':null}}})['then'](function(_0x4a1a4b){var _0x3e2fd3=moment()[_0xbe14('0x34')](_0xbe14('0x35'));for(var _0xb2b285=0x0,_0x2550dc=_0x4a1a4b['length'];_0xb2b285<_0x2550dc;_0xb2b285+=0x1){_0x4a1a4b[_0xb2b285]['updateAttributes']({'exitAt':_0x3e2fd3});}});for(var _0x46af81=0x0;_0x46af81<_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0xbe14('0x33')];_0x46af81+=0x1){db['MemberReport'][_0xbe14('0x36')]({'where':{'channel':_0x5d5318,'membername':_0x1220c9[_0xbe14('0x2f')]['name'],'type':_0xbe14('0x32'),'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0x46af81],'exitAt':null},'defaults':{'channel':_0x5d5318,'membername':_0x1220c9[_0xbe14('0x2f')]['name'],'interface':_['isNil'](_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x37')])?util['format']('SIP/%s',_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x10')]):_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x37')],'type':_0xbe14('0x32'),'enterAt':moment()[_0xbe14('0x34')](_0xbe14('0x35')),'role':'agent','internal':_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x38')],'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0x46af81]}});}}}}return respondWithRpcPromise(_0xbe14('0x39'),{'id':_0x1220c9['params']['id'],'capacity':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x3a')]},routingClient)[_0xbe14('0x8')](respondWithResult(_0x36263c,null))[_0xbe14('0xc')](handleError(_0x36263c,null));};exports[_0xbe14('0x3b')]=function(_0x2dbeb1,_0x505829){return respondWithRpcPromise('Telephones',_0x2dbeb1[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x505829,null))[_0xbe14('0xc')](handleError(_0x505829,null));};exports['trunks']=function(_0x497b00,_0x44fe0d){return respondWithRpcPromise(_0xbe14('0x3c'),_0x497b00['query'])[_0xbe14('0x8')](respondWithResult(_0x44fe0d,null))[_0xbe14('0xc')](handleError(_0x44fe0d,null));};exports['campaigns']=function(_0x28f995,_0x4a40d2){return respondWithRpcPromise(_0xbe14('0x3d'),_0x28f995[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x4a40d2,null))['catch'](handleError(_0x4a40d2,null));};exports[_0xbe14('0x3e')]=function(_0x404212,_0x5dc78a){return respondWithRpcPromise(_0xbe14('0x3f'),_0x404212[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x5dc78a,null))[_0xbe14('0xc')](handleError(_0x5dc78a,null));};exports[_0xbe14('0x40')]=function(_0x4f06a3,_0x42a346){return respondWithRpcPromise(_0xbe14('0x3f'),_0x4f06a3[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x4f06a3[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x42a346,null))[_0xbe14('0xc')](handleError(_0x42a346,null));};exports['mailQueues']=function(_0x72c875,_0x1b47a4){return respondWithRpcPromise(_0xbe14('0x41'),_0x72c875[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1b47a4,null))[_0xbe14('0xc')](handleError(_0x1b47a4,null));};exports[_0xbe14('0x42')]=function(_0x32df3c,_0x285b6e){return respondWithRpcPromise(_0xbe14('0x41'),_0x32df3c[_0xbe14('0x17')],routingClient)['then'](findById(_0x32df3c['params']['id']))['then'](respondWithResult(_0x285b6e,null))[_0xbe14('0xc')](handleError(_0x285b6e,null));};exports[_0xbe14('0x43')]=function(_0x2f4e52,_0xf79b21){return respondWithRpcPromise(_0xbe14('0x44'),_0x2f4e52[_0xbe14('0x17')],mailClient)[_0xbe14('0x8')](respondWithResult(_0xf79b21,null))[_0xbe14('0xc')](handleError(_0xf79b21,null));};exports[_0xbe14('0x45')]=function(_0x451b0b,_0x603816){return respondWithRpcPromise(_0xbe14('0x46'),_0x451b0b[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x603816,null))[_0xbe14('0xc')](handleError(_0x603816,null));};exports[_0xbe14('0x47')]=function(_0x179077,_0x2225d9){return respondWithRpcPromise(_0xbe14('0x46'),_0x179077[_0xbe14('0x17')],routingClient)['then'](findById(_0x179077[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x2225d9,null))[_0xbe14('0xc')](handleError(_0x2225d9,null));};exports[_0xbe14('0x48')]=function(_0x3ee6b7,_0x222944){return respondWithRpcPromise(_0xbe14('0x49'),_0x3ee6b7[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x222944,null))[_0xbe14('0xc')](handleError(_0x222944,null));};exports['showSmsQueues']=function(_0x18be56,_0x442ec4){return respondWithRpcPromise(_0xbe14('0x49'),_0x18be56[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x18be56['params']['id']))[_0xbe14('0x8')](respondWithResult(_0x442ec4,null))[_0xbe14('0xc')](handleError(_0x442ec4,null));};exports[_0xbe14('0x4a')]=function(_0xd4e1c7,_0x46ac9c){return respondWithRpcPromise('WhatsappQueues',_0xd4e1c7[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x46ac9c,null))[_0xbe14('0xc')](handleError(_0x46ac9c,null));};exports[_0xbe14('0x4b')]=function(_0xaebce8,_0x289c4d){return respondWithRpcPromise(_0xbe14('0x4c'),_0xaebce8[_0xbe14('0x17')],routingClient)['then'](findById(_0xaebce8[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x289c4d,null))[_0xbe14('0xc')](handleError(_0x289c4d,null));};exports[_0xbe14('0x4d')]=function(_0x5982b7,_0xa4b2a3){return respondWithRpcPromise(_0xbe14('0x4e'),_0x5982b7['query'],routingClient)['then'](respondWithResult(_0xa4b2a3,null))[_0xbe14('0xc')](handleError(_0xa4b2a3,null));};exports[_0xbe14('0x4f')]=function(_0x2d2643,_0x2510a0){return respondWithRpcPromise(_0xbe14('0x4e'),_0x2d2643[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x2d2643[_0xbe14('0x1b')]['id']))['then'](respondWithResult(_0x2510a0,null))['catch'](handleError(_0x2510a0,null));};exports[_0xbe14('0x50')]=function(_0x1c18b6,_0x29aa52){return respondWithRpcPromise('FaxAccounts',_0x1c18b6[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x29aa52,null))[_0xbe14('0xc')](handleError(_0x29aa52,null));};exports[_0xbe14('0x51')]=function(_0x468e9f,_0x1ef09b){return respondWithRpcPromise(_0xbe14('0x52'),_0x468e9f['query'],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1ef09b,null))[_0xbe14('0xc')](handleError(_0x1ef09b,null));};exports[_0xbe14('0x53')]=function(_0x3afc5a,_0x469555){return respondWithRpcPromise(_0xbe14('0x54'),_0x3afc5a[_0xbe14('0x17')],routingClient)['then'](respondWithResult(_0x469555,null))[_0xbe14('0xc')](handleError(_0x469555,null));};exports[_0xbe14('0x55')]=function(_0x3cd17e,_0x1c0932){return respondWithRpcPromise(_0xbe14('0x56'),_0x3cd17e[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1c0932,null))[_0xbe14('0xc')](handleError(_0x1c0932,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x1e5ce1,_0x401968){return respondWithRpcPromise(_0xbe14('0x56'),_0x1e5ce1[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](function(_0x17576b){if(_0x1e5ce1['query'][_0xbe14('0x57')]!==undefined){var _0x175213=_(_0x17576b[_0xbe14('0x13')])[_0xbe14('0x58')]([_0x1e5ce1['query'][_0xbe14('0x57')],_0x1e5ce1[_0xbe14('0x1b')]['id']])[_0xbe14('0x59')](_0xbe14('0x5a'))[_0xbe14('0x5b')]()[_0xbe14('0x5c')]();return _0x17576b[_0xbe14('0x13')]['filter'](function(_0x70ed08){return _0x175213['indexOf'](_0x70ed08[_0xbe14('0x5a')])>-0x1;});}else{return _0x17576b['rows'][_0xbe14('0x58')](function(_0x21837c){return _0x21837c[_0xbe14('0x5a')]===parseInt(_0x1e5ce1['params']['id']);});}})[_0xbe14('0x8')](respondWithResult(_0x401968,null))[_0xbe14('0xc')](handleError(_0x401968,null));};exports[_0xbe14('0x5d')]=function(_0x546f22,_0x41a896){return respondWithRpcPromise(_0xbe14('0x5e'),_0x546f22[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x41a896,null))['catch'](handleError(_0x41a896,null));};exports[_0xbe14('0x5f')]=function(_0x39bc54,_0x34f90b){return respondWithRpcPromise(_0xbe14('0x60'),_0x39bc54[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x34f90b,null))[_0xbe14('0xc')](handleError(_0x34f90b,null));};exports['faxQueuesWaitingInteractions']=function(_0x2ff94c,_0x123f4f){return respondWithRpcPromise(_0xbe14('0x61'),_0x2ff94c['query'],routingClient)[_0xbe14('0x8')](respondWithResult(_0x123f4f,null))[_0xbe14('0xc')](handleError(_0x123f4f,null));};exports[_0xbe14('0x62')]=function(_0x5bc52b){return function(_0xa53262,_0x1205d1){var _0x47d7bb,_0x2be969;var _0x49990b=_[_0xbe14('0x63')](_0x5bc52b);var _0x337073=_0x5bc52b==='chat'?'Website':_0xbe14('0x64');return db[_0x49990b+_0xbe14('0x65')][_0xbe14('0x66')]({'raw':!![],'where':{'id':_0xa53262['params']['id']}})[_0xbe14('0x8')](function(_0x30c03b){if(_[_0xbe14('0x12')](_0x30c03b)){throw new Error(_0x49990b+_0xbe14('0x67'));}_0x47d7bb=_0x30c03b;return db[_0x49990b+'Message']['findOne']({'where':{'id':_0xa53262[_0xbe14('0x20')][_0xbe14('0x68')]},'include':[{'model':db[_0x49990b+_0xbe14('0x69')],'as':_0xbe14('0x69')},{'model':db[_0x49990b+_0x337073],'as':_0xbe14('0x64')}]});})[_0xbe14('0x8')](function(_0x139aab){if(_['isNil'](_0x139aab)){throw new Error(_0x49990b+_0xbe14('0x6a'));}_0x2be969=_0x139aab;return _0x139aab['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xbe14('0x8')](function(){var _0x3a01bb={'uniqueid':_0x5bc52b+'.'+_0x2be969['id']+'.'+_0x2be969[_0xbe14('0x69')]['id'],'FromUserId':_0xa53262[_0xbe14('0x2f')]['id'],'type':'queue'};_0x3a01bb[_0x49990b+_0xbe14('0x6b')]=_0x2be969['id'];_0x3a01bb[_0x49990b+_0xbe14('0x6c')]=_0x2be969[_0xbe14('0x69')]['id'];_0x3a01bb['From'+_0x49990b+_0x337073+'Id']=_0x2be969[_0xbe14('0x64')]['id'];_0x3a01bb['To'+_0x49990b+_0xbe14('0x6d')]=_0x47d7bb['id'];return db[_0x49990b+_0xbe14('0x6e')][_0xbe14('0x6f')](_0x3a01bb);})[_0xbe14('0x8')](function(){return respondWithRpcPromise(_0xbe14('0x70'),{'channel':_0x5bc52b,'interaction':_0x2be969[_0xbe14('0x69')],'message':_0x2be969,'account':_0x2be969[_0xbe14('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbe14('0x71'),'appdata':_0x47d7bb[_0xbe14('0x10')]+','+(_0x2be969[_0xbe14('0x64')][_0xbe14('0x72')]||0x12c),'interval':_0xbe14('0x73')}]},routingClient);})[_0xbe14('0x8')](respondWithResult(_0x1205d1,null))[_0xbe14('0xc')](handleError(_0x1205d1,null));};};exports[_0xbe14('0x74')]=function(_0x1de70d,_0x30be9e){var _0x1679bd,_0x2ca6e6;if(_['isNil'](_0x1de70d[_0xbe14('0x20')]['channel'])){throw new Error(_0xbe14('0x75'));}var _0x1b8733=_0x1de70d[_0xbe14('0x20')][_0xbe14('0x76')];var _0x1d7b08=_['capitalize'](_0x1b8733);var _0x5868d7=_0x1b8733===_0xbe14('0x77')?_0xbe14('0x78'):_0xbe14('0x64');return db[_0xbe14('0x79')]['findOne']({'raw':!![],'where':{'id':_0x1de70d[_0xbe14('0x1b')]['id'],'role':_0xbe14('0x7a')}})['then'](function(_0x186225){if(_[_0xbe14('0x12')](_0x186225)){throw new Error(_0xbe14('0x7b'));}_0x1679bd=_0x186225;return db[_0x1d7b08+_0xbe14('0x7c')]['findOne']({'where':{'id':_0x1de70d[_0xbe14('0x20')]['messageId']},'include':[{'model':db[_0x1d7b08+'Interaction'],'as':_0xbe14('0x69')},{'model':db[_0x1d7b08+_0x5868d7],'as':_0xbe14('0x64')}]});})[_0xbe14('0x8')](function(_0x3d890b){if(_[_0xbe14('0x12')](_0x3d890b)){throw new Error(_0x1d7b08+'\x20Message\x20not\x20found');}_0x2ca6e6=_0x3d890b;return _0x3d890b[_0xbe14('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbe14('0x8')](function(){var _0x5dc793={'uniqueid':_0x1b8733+'.'+_0x2ca6e6['id']+'.'+_0x2ca6e6['Interaction']['id'],'FromUserId':_0x1de70d[_0xbe14('0x2f')]['id'],'type':_0xbe14('0x71'),'ToUserId':_0x1679bd['id']};_0x5dc793[_0x1d7b08+'MessageId']=_0x2ca6e6['id'];_0x5dc793[_0x1d7b08+_0xbe14('0x6c')]=_0x2ca6e6['Interaction']['id'];_0x5dc793[_0xbe14('0x7e')+_0x1d7b08+_0x5868d7+'Id']=_0x2ca6e6['Account']['id'];return db[_0x1d7b08+_0xbe14('0x6e')]['create'](_0x5dc793);})[_0xbe14('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1b8733,'interaction':_0x2ca6e6[_0xbe14('0x69')],'message':_0x2ca6e6,'account':_0x2ca6e6[_0xbe14('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1679bd['name']+','+(_0x2ca6e6[_0xbe14('0x64')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xbe14('0x8')](respondWithResult(_0x30be9e,null))[_0xbe14('0xc')](handleError(_0x30be9e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 6c9e9ef..722a5a3 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 _0xe74a=['create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post'];(function(_0x2cf734,_0x3c4bf3){var _0x43775b=function(_0x292d42){while(--_0x292d42){_0x2cf734['push'](_0x2cf734['shift']());}};_0x43775b(++_0x3c4bf3);}(_0xe74a,0xb6));var _0xae74=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xe74a[_0x34bc6c];return _0x168820;};'use strict';var multer=require(_0xae74('0x0'));var util=require('util');var path=require(_0xae74('0x1'));var timeout=require(_0xae74('0x2'));var express=require(_0xae74('0x3'));var router=express[_0xae74('0x4')]();var fs_extra=require(_0xae74('0x5'));var auth=require(_0xae74('0x6'));var interaction=require(_0xae74('0x7'));var config=require('../../config/environment');var controller=require(_0xae74('0x8'));router[_0xae74('0x9')]('/',auth[_0xae74('0xa')](),controller[_0xae74('0xb')]);router[_0xae74('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xae74('0xc')]);router['get'](_0xae74('0xd'),auth[_0xae74('0xa')](),controller[_0xae74('0xe')]);router[_0xae74('0xf')]('/',auth[_0xae74('0xa')](),controller[_0xae74('0x10')]);router[_0xae74('0x11')](_0xae74('0x12'),auth[_0xae74('0xa')](),controller[_0xae74('0x13')]);router['delete'](_0xae74('0x12'),auth['isAuthenticated'](),controller[_0xae74('0x14')]);module[_0xae74('0x15')]=router; \ No newline at end of file +var _0xdcc3=['update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','get','/:id','isAuthenticated','run','post','put'];(function(_0x5ee91a,_0x3bcac9){var _0x2c7680=function(_0x4da774){while(--_0x4da774){_0x5ee91a['push'](_0x5ee91a['shift']());}};_0x2c7680(++_0x3bcac9);}(_0xdcc3,0xe4));var _0x3dcc=function(_0x52052d,_0x28f88c){_0x52052d=_0x52052d-0x0;var _0x1af104=_0xdcc3[_0x52052d];return _0x1af104;};'use strict';var multer=require(_0x3dcc('0x0'));var util=require(_0x3dcc('0x1'));var path=require('path');var timeout=require(_0x3dcc('0x2'));var express=require(_0x3dcc('0x3'));var router=express[_0x3dcc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3dcc('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x3dcc('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3dcc('0x6')](_0x3dcc('0x7'),auth[_0x3dcc('0x8')](),controller['show']);router[_0x3dcc('0x6')]('/:id/run',auth[_0x3dcc('0x8')](),controller[_0x3dcc('0x9')]);router[_0x3dcc('0xa')]('/',auth[_0x3dcc('0x8')](),controller['create']);router[_0x3dcc('0xb')](_0x3dcc('0x7'),auth[_0x3dcc('0x8')](),controller[_0x3dcc('0xc')]);router['delete'](_0x3dcc('0x7'),auth[_0x3dcc('0x8')](),controller[_0x3dcc('0xd')]);module[_0x3dcc('0xe')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e485a22..ade2eeb 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 _0xe1a0=['months','weeks','hours','minutes','days','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters'];(function(_0x44e6e7,_0x170df1){var _0x32cd37=function(_0x3812c4){while(--_0x3812c4){_0x44e6e7['push'](_0x44e6e7['shift']());}};_0x32cd37(++_0x170df1);}(_0xe1a0,0x195));var _0x0e1a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe1a0[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x0e1a('0x0'));module[_0x0e1a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0e1a('0x2')]},'active':{'type':Sequelize[_0x0e1a('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0e1a('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x0e1a('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0e1a('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0e1a('0x6')](_0x0e1a('0x7'),_0x0e1a('0x8'),_0x0e1a('0x9'),_0x0e1a('0xa'),'days',_0x0e1a('0xb'),_0x0e1a('0xc')),'allowNull':![],'defaultValue':_0x0e1a('0xd')},'output':{'type':Sequelize[_0x0e1a('0x6')](_0x0e1a('0xe'),_0x0e1a('0xf'),'xlsx'),'allowNull':![],'defaultValue':_0x0e1a('0xe')},'type':{'type':Sequelize[_0x0e1a('0x6')](_0x0e1a('0x10'),'default'),'allowNull':![],'defaultValue':_0x0e1a('0x10')},'sendMail':{'type':Sequelize[_0x0e1a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x0e1a('0x2')]},'cc':{'type':Sequelize[_0x0e1a('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x0e1a('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xceac=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','months','weeks','days','pdf','xlsx','custom','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xceac,0x1d2));var _0xccea=function(_0x5ab6b0,_0x1687a5){_0x5ab6b0=_0x5ab6b0-0x0;var _0x2bcdae=_0xceac[_0x5ab6b0];return _0x2bcdae;};'use strict';var Sequelize=require('sequelize');module[_0xccea('0x0')]={'name':{'type':Sequelize[_0xccea('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xccea('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xccea('0x1')],'allowNull':![],'defaultValue':_0xccea('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xccea('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xccea('0x5')]('years','quarters',_0xccea('0x6'),_0xccea('0x7'),_0xccea('0x8'),'hours','minutes'),'allowNull':![],'defaultValue':_0xccea('0x8')},'output':{'type':Sequelize[_0xccea('0x5')]('csv',_0xccea('0x9'),_0xccea('0xa')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xccea('0x5')](_0xccea('0xb'),'default'),'allowNull':![],'defaultValue':_0xccea('0xb')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xccea('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xccea('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 6d8bb96..a43edd8 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 _0x4fad=['Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','stack','name','send','map','Schedule','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params','run','../../config/schedule','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4fad,0x8b));var _0xd4fa=function(_0x5aad95,_0x152c76){_0x5aad95=_0x5aad95-0x0;var _0x3bb6ae=_0x4fad[_0x5aad95];return _0x3bb6ae;};'use strict';var emlformat=require(_0xd4fa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd4fa('0x1'));var rp=require(_0xd4fa('0x2'));var moment=require(_0xd4fa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd4fa('0x4'));var util=require(_0xd4fa('0x5'));var path=require(_0xd4fa('0x6'));var sox=require(_0xd4fa('0x7'));var csv=require(_0xd4fa('0x8'));var ejs=require(_0xd4fa('0x9'));var fs=require('fs');var fs_extra=require(_0xd4fa('0xa'));var _=require(_0xd4fa('0xb'));var squel=require(_0xd4fa('0xc'));var crypto=require(_0xd4fa('0xd'));var jsforce=require(_0xd4fa('0xe'));var deskjs=require(_0xd4fa('0xf'));var toCsv=require(_0xd4fa('0x8'));var querystring=require(_0xd4fa('0x10'));var Papa=require(_0xd4fa('0x11'));var Redis=require(_0xd4fa('0x12'));var authService=require(_0xd4fa('0x13'));var qs=require(_0xd4fa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4fa('0x15'));var logger=require('../../config/logger')(_0xd4fa('0x16'));var utils=require(_0xd4fa('0x17'));var config=require(_0xd4fa('0x18'));var licenseUtil=require(_0xd4fa('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55fec9,_0x27ac02){_0x27ac02=_0x27ac02||0xcc;return function(_0x43cf1d){if(_0x43cf1d){return _0x55fec9[_0xd4fa('0x1a')](_0x27ac02);}return _0x55fec9['status'](_0x27ac02)[_0xd4fa('0x1b')]();};}function respondWithResult(_0x110f52,_0x226c25){_0x226c25=_0x226c25||0xc8;return function(_0x57d3c6){if(_0x57d3c6){return _0x110f52[_0xd4fa('0x1c')](_0x226c25)[_0xd4fa('0x1d')](_0x57d3c6);}};}function respondWithFilteredResult(_0x86bb66,_0xb7d5c0){return function(_0x3af91a){if(_0x3af91a){var _0x4ca659=typeof _0xb7d5c0[_0xd4fa('0x1e')]===_0xd4fa('0x1f')&&typeof _0xb7d5c0[_0xd4fa('0x20')]===_0xd4fa('0x1f');var _0x2caaa4=_0x3af91a[_0xd4fa('0x21')];var _0x491434=_0x4ca659?0x0:_0xb7d5c0[_0xd4fa('0x1e')];var _0x42bb22=_0x4ca659?_0x3af91a[_0xd4fa('0x21')]:_0xb7d5c0['offset']+_0xb7d5c0['limit'];var _0x100baf;if(_0x42bb22>=_0x2caaa4){_0x42bb22=_0x2caaa4;_0x100baf=0xc8;}else{_0x100baf=0xce;}_0x86bb66[_0xd4fa('0x1c')](_0x100baf);return _0x86bb66[_0xd4fa('0x22')](_0xd4fa('0x23'),_0x491434+'-'+_0x42bb22+'/'+_0x2caaa4)['json'](_0x3af91a);}return null;};}function patchUpdates(_0x2fac78){return function(_0xcb7926){try{jsonpatch[_0xd4fa('0x24')](_0xcb7926,_0x2fac78,!![]);}catch(_0x17eb5b){return BPromise[_0xd4fa('0x25')](_0x17eb5b);}return _0xcb7926[_0xd4fa('0x26')]();};}function saveUpdates(_0x49ca73,_0x6b7443){return function(_0x400e37){if(_0x400e37){return _0x400e37[_0xd4fa('0x27')](_0x49ca73)[_0xd4fa('0x28')](function(_0x332622){return _0x332622;});}return null;};}function removeEntity(_0x67fcfd,_0x553b61){return function(_0x183be4){if(_0x183be4){return _0x183be4['destroy']()[_0xd4fa('0x28')](function(){var _0x4ac4c2=_0x183be4[_0xd4fa('0x29')]({'plain':!![]});var _0xe31bf=_0xd4fa('0x2a');return db[_0xd4fa('0x2b')][_0xd4fa('0x2c')]({'where':{'type':_0xe31bf,'resourceId':_0x4ac4c2['id']}})[_0xd4fa('0x28')](function(){return _0x183be4;});})[_0xd4fa('0x28')](function(){_0x67fcfd[_0xd4fa('0x1c')](0xcc)[_0xd4fa('0x1b')]();});}};}function handleEntityNotFound(_0x13d4ec,_0x19ff19){return function(_0x424d8a){if(!_0x424d8a){_0x13d4ec[_0xd4fa('0x1a')](0x194);}return _0x424d8a;};}function handleError(_0x102418,_0x506c5f){_0x506c5f=_0x506c5f||0x1f4;return function(_0x560893){logger[_0xd4fa('0x2d')](_0x560893[_0xd4fa('0x2e')]);if(_0x560893['name']){delete _0x560893[_0xd4fa('0x2f')];}_0x102418[_0xd4fa('0x1c')](_0x506c5f)[_0xd4fa('0x30')](_0x560893);};}exports['index']=function(_0x47011d,_0x409307){var _0x11c05e={},_0x50d513={},_0x28a843={'count':0x0,'rows':[]};var _0x3796eb=_[_0xd4fa('0x31')](db[_0xd4fa('0x32')]['rawAttributes'],function(_0x4aeaac){return{'name':_0x4aeaac[_0xd4fa('0x33')],'type':_0x4aeaac[_0xd4fa('0x34')][_0xd4fa('0x35')]};});_0x50d513[_0xd4fa('0x36')]=_['map'](_0x3796eb,_0xd4fa('0x2f'));_0x50d513[_0xd4fa('0x37')]=_[_0xd4fa('0x38')](_0x47011d[_0xd4fa('0x37')]);_0x50d513['filters']=_[_0xd4fa('0x39')](_0x50d513['model'],_0x50d513[_0xd4fa('0x37')]);_0x11c05e[_0xd4fa('0x3a')]=_[_0xd4fa('0x39')](_0x50d513[_0xd4fa('0x36')],qs['fields'](_0x47011d[_0xd4fa('0x37')][_0xd4fa('0x3b')]));_0x11c05e[_0xd4fa('0x3a')]=_0x11c05e[_0xd4fa('0x3a')][_0xd4fa('0x3c')]?_0x11c05e[_0xd4fa('0x3a')]:_0x50d513[_0xd4fa('0x36')];if(!_0x47011d[_0xd4fa('0x37')][_0xd4fa('0x3d')](_0xd4fa('0x3e'))){_0x11c05e['limit']=qs[_0xd4fa('0x20')](_0x47011d[_0xd4fa('0x37')][_0xd4fa('0x20')]);_0x11c05e[_0xd4fa('0x1e')]=qs['offset'](_0x47011d['query'][_0xd4fa('0x1e')]);}_0x11c05e['order']=qs['sort'](_0x47011d[_0xd4fa('0x37')][_0xd4fa('0x3f')]);_0x11c05e[_0xd4fa('0x40')]=qs[_0xd4fa('0x41')](_[_0xd4fa('0x42')](_0x47011d[_0xd4fa('0x37')],_0x50d513[_0xd4fa('0x41')]),_0x3796eb);if(_0x47011d[_0xd4fa('0x37')][_0xd4fa('0x43')]){_0x11c05e[_0xd4fa('0x40')]=_[_0xd4fa('0x44')](_0x11c05e[_0xd4fa('0x40')],{'$or':_[_0xd4fa('0x31')](_0x3796eb,function(_0xf613b4){if(_0xf613b4[_0xd4fa('0x34')]!==_0xd4fa('0x45')){var _0x26edb6={};_0x26edb6[_0xf613b4[_0xd4fa('0x2f')]]={'$like':'%'+_0x47011d['query']['filter']+'%'};return _0x26edb6;}})});}_0x11c05e=_[_0xd4fa('0x44')]({},_0x11c05e,_0x47011d[_0xd4fa('0x46')]);var _0x3e979e={'where':_0x11c05e['where']};return db[_0xd4fa('0x32')][_0xd4fa('0x21')](_0x3e979e)[_0xd4fa('0x28')](function(_0x5ca158){_0x28a843[_0xd4fa('0x21')]=_0x5ca158;if(_0x47011d[_0xd4fa('0x37')]['includeAll']){_0x11c05e[_0xd4fa('0x47')]=[{'all':!![]}];}return db[_0xd4fa('0x32')][_0xd4fa('0x48')](_0x11c05e);})['then'](function(_0x414fe1){_0x28a843[_0xd4fa('0x49')]=_0x414fe1;return _0x28a843;})[_0xd4fa('0x28')](respondWithFilteredResult(_0x409307,_0x11c05e))[_0xd4fa('0x4a')](handleError(_0x409307,null));};exports[_0xd4fa('0x4b')]=function(_0x32314f,_0x3add1a){var _0x22148b={'raw':![],'where':{'id':_0x32314f['params']['id']}},_0x3826f4={};_0x3826f4[_0xd4fa('0x36')]=_[_0xd4fa('0x38')](db[_0xd4fa('0x32')]['rawAttributes']);_0x3826f4[_0xd4fa('0x37')]=_['keys'](_0x32314f[_0xd4fa('0x37')]);_0x3826f4[_0xd4fa('0x41')]=_[_0xd4fa('0x39')](_0x3826f4[_0xd4fa('0x36')],_0x3826f4['query']);_0x22148b[_0xd4fa('0x3a')]=_[_0xd4fa('0x39')](_0x3826f4['model'],qs[_0xd4fa('0x3b')](_0x32314f[_0xd4fa('0x37')][_0xd4fa('0x3b')]));_0x22148b[_0xd4fa('0x3a')]=_0x22148b[_0xd4fa('0x3a')][_0xd4fa('0x3c')]?_0x22148b[_0xd4fa('0x3a')]:_0x3826f4['model'];if(_0x32314f[_0xd4fa('0x37')][_0xd4fa('0x4c')]){_0x22148b['include']=[{'all':!![]}];}_0x22148b=_[_0xd4fa('0x44')]({},_0x22148b,_0x32314f['options']);return db[_0xd4fa('0x32')][_0xd4fa('0x4d')](_0x22148b)[_0xd4fa('0x28')](handleEntityNotFound(_0x3add1a,null))[_0xd4fa('0x28')](respondWithResult(_0x3add1a,null))[_0xd4fa('0x4a')](handleError(_0x3add1a,null));};exports[_0xd4fa('0x4e')]=function(_0x2056a2,_0x4b229a){return db[_0xd4fa('0x32')][_0xd4fa('0x4e')](_0x2056a2[_0xd4fa('0x4f')],{})[_0xd4fa('0x28')](function(_0x2cfaa7){var _0x22c4ac=_0x2056a2[_0xd4fa('0x50')][_0xd4fa('0x29')]({'plain':!![]});if(!_0x22c4ac)throw new Error(_0xd4fa('0x51'));if(_0x22c4ac[_0xd4fa('0x52')]==='user'){var _0x11a1a2=_0x2cfaa7[_0xd4fa('0x29')]({'plain':!![]});var _0x33b700=_0xd4fa('0x2a');return db[_0xd4fa('0x53')][_0xd4fa('0x4d')]({'where':{'name':_0x33b700,'userProfileId':_0x22c4ac['userProfileId']},'raw':!![]})['then'](function(_0x1659e1){if(_0x1659e1&&_0x1659e1['autoAssociation']===0x0){return db[_0xd4fa('0x2b')][_0xd4fa('0x4e')]({'name':_0x11a1a2[_0xd4fa('0x2f')],'resourceId':_0x11a1a2['id'],'type':_0x1659e1[_0xd4fa('0x2f')],'sectionId':_0x1659e1['id']},{})[_0xd4fa('0x28')](function(){return _0x2cfaa7;});}else{return _0x2cfaa7;}})[_0xd4fa('0x4a')](function(_0x47ddfc){logger[_0xd4fa('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47ddfc);throw _0x47ddfc;});}return _0x2cfaa7;})[_0xd4fa('0x28')](respondWithResult(_0x4b229a,0xc9))[_0xd4fa('0x4a')](handleError(_0x4b229a,null));};exports[_0xd4fa('0x27')]=function(_0x2a979b,_0x3578ab){if(_0x2a979b[_0xd4fa('0x4f')]['id']){delete _0x2a979b[_0xd4fa('0x4f')]['id'];}return db[_0xd4fa('0x32')][_0xd4fa('0x4d')]({'where':{'id':_0x2a979b[_0xd4fa('0x54')]['id']}})['then'](handleEntityNotFound(_0x3578ab,null))[_0xd4fa('0x28')](saveUpdates(_0x2a979b[_0xd4fa('0x4f')],null))['then'](respondWithResult(_0x3578ab,null))[_0xd4fa('0x4a')](handleError(_0x3578ab,null));};exports[_0xd4fa('0x2c')]=function(_0x497cd7,_0x472b00){return db['Schedule'][_0xd4fa('0x4d')]({'where':{'id':_0x497cd7['params']['id']}})[_0xd4fa('0x28')](handleEntityNotFound(_0x472b00,null))[_0xd4fa('0x28')](removeEntity(_0x472b00,null))['catch'](handleError(_0x472b00,null));};exports[_0xd4fa('0x55')]=function(_0x1481b1,_0x56aa19,_0x3f80e7){var _0x5ec56e=require(_0xd4fa('0x56'));return db[_0xd4fa('0x32')][_0xd4fa('0x4d')]({'where':{'id':_0x1481b1[_0xd4fa('0x54')]['id']},'raw':!![]})[_0xd4fa('0x28')](handleEntityNotFound(_0x56aa19,null))[_0xd4fa('0x28')](function(){_0x5ec56e['run'](_0x1481b1[_0xd4fa('0x54')]['id']);})['then'](respondWithStatusCode(_0x56aa19,null))[_0xd4fa('0x4a')](handleError(_0x56aa19,null));}; \ No newline at end of file +var _0x337e=['type','VIRTUAL','findAll','rows','catch','show','params','keys','length','includeAll','include','create','body','user','role','Scheduler','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','Schedule','rawAttributes','fieldName','key','map','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0x516c49,_0x197819){var _0x26fb33=function(_0x2a82a3){while(--_0x2a82a3){_0x516c49['push'](_0x516c49['shift']());}};_0x26fb33(++_0x197819);}(_0x337e,0x17c));var _0xe337=function(_0x42dd21,_0x327250){_0x42dd21=_0x42dd21-0x0;var _0x4fd174=_0x337e[_0x42dd21];return _0x4fd174;};'use strict';var emlformat=require(_0xe337('0x0'));var rimraf=require(_0xe337('0x1'));var zipdir=require(_0xe337('0x2'));var jsonpatch=require(_0xe337('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe337('0x4'));var Mustache=require(_0xe337('0x5'));var util=require(_0xe337('0x6'));var path=require(_0xe337('0x7'));var sox=require(_0xe337('0x8'));var csv=require(_0xe337('0x9'));var ejs=require(_0xe337('0xa'));var fs=require('fs');var fs_extra=require(_0xe337('0xb'));var _=require(_0xe337('0xc'));var squel=require(_0xe337('0xd'));var crypto=require(_0xe337('0xe'));var jsforce=require(_0xe337('0xf'));var deskjs=require(_0xe337('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe337('0x11'));var Papa=require(_0xe337('0x12'));var Redis=require(_0xe337('0x13'));var authService=require(_0xe337('0x14'));var qs=require(_0xe337('0x15'));var as=require(_0xe337('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe337('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe337('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe337('0x19'))['db'];function respondWithStatusCode(_0x3331a4,_0x4e1e43){_0x4e1e43=_0x4e1e43||0xcc;return function(_0x2e368a){if(_0x2e368a){return _0x3331a4[_0xe337('0x1a')](_0x4e1e43);}return _0x3331a4[_0xe337('0x1b')](_0x4e1e43)[_0xe337('0x1c')]();};}function respondWithResult(_0x2a46d3,_0x4c1a40){_0x4c1a40=_0x4c1a40||0xc8;return function(_0x1b5898){if(_0x1b5898){return _0x2a46d3[_0xe337('0x1b')](_0x4c1a40)['json'](_0x1b5898);}};}function respondWithFilteredResult(_0x3ef2ee,_0x148b36){return function(_0x2c87b1){if(_0x2c87b1){var _0x40bcbf=typeof _0x148b36[_0xe337('0x1d')]===_0xe337('0x1e')&&typeof _0x148b36[_0xe337('0x1f')]===_0xe337('0x1e');var _0x252b9a=_0x2c87b1[_0xe337('0x20')];var _0x4fc4a8=_0x40bcbf?0x0:_0x148b36[_0xe337('0x1d')];var _0x1a34f7=_0x40bcbf?_0x2c87b1[_0xe337('0x20')]:_0x148b36[_0xe337('0x1d')]+_0x148b36['limit'];var _0xf7fc6f;if(_0x1a34f7>=_0x252b9a){_0x1a34f7=_0x252b9a;_0xf7fc6f=0xc8;}else{_0xf7fc6f=0xce;}_0x3ef2ee['status'](_0xf7fc6f);return _0x3ef2ee[_0xe337('0x21')](_0xe337('0x22'),_0x4fc4a8+'-'+_0x1a34f7+'/'+_0x252b9a)[_0xe337('0x23')](_0x2c87b1);}return null;};}function patchUpdates(_0x4c348c){return function(_0x2ce33b){try{jsonpatch[_0xe337('0x24')](_0x2ce33b,_0x4c348c,!![]);}catch(_0x3fa6e6){return BPromise[_0xe337('0x25')](_0x3fa6e6);}return _0x2ce33b[_0xe337('0x26')]();};}function saveUpdates(_0x295f34,_0x3070d5){return function(_0x131e48){if(_0x131e48){return _0x131e48['update'](_0x295f34)[_0xe337('0x27')](function(_0x5e3f43){return _0x5e3f43;});}return null;};}function removeEntity(_0x15f023,_0x3fa939){return function(_0x42d7d2){if(_0x42d7d2){return _0x42d7d2[_0xe337('0x28')]()[_0xe337('0x27')](function(){var _0x3ce4d1=_0x42d7d2[_0xe337('0x29')]({'plain':!![]});var _0x366842='Scheduler';return db[_0xe337('0x2a')][_0xe337('0x28')]({'where':{'type':_0x366842,'resourceId':_0x3ce4d1['id']}})[_0xe337('0x27')](function(){return _0x42d7d2;});})['then'](function(){_0x15f023[_0xe337('0x1b')](0xcc)[_0xe337('0x1c')]();});}};}function handleEntityNotFound(_0x2d00c0,_0x493392){return function(_0x563071){if(!_0x563071){_0x2d00c0[_0xe337('0x1a')](0x194);}return _0x563071;};}function handleError(_0x593c8b,_0x559b0a){_0x559b0a=_0x559b0a||0x1f4;return function(_0x273387){logger[_0xe337('0x2b')](_0x273387[_0xe337('0x2c')]);if(_0x273387[_0xe337('0x2d')]){delete _0x273387[_0xe337('0x2d')];}_0x593c8b['status'](_0x559b0a)['send'](_0x273387);};}exports[_0xe337('0x2e')]=function(_0x3b54ac,_0x1ae4e5){var _0xf9a7c9={},_0x2e7f10={},_0x132340={'count':0x0,'rows':[]};var _0x542277=_['map'](db[_0xe337('0x2f')][_0xe337('0x30')],function(_0xe0b319){return{'name':_0xe0b319[_0xe337('0x31')],'type':_0xe0b319['type'][_0xe337('0x32')]};});_0x2e7f10['model']=_[_0xe337('0x33')](_0x542277,'name');_0x2e7f10[_0xe337('0x34')]=_['keys'](_0x3b54ac['query']);_0x2e7f10[_0xe337('0x35')]=_['intersection'](_0x2e7f10[_0xe337('0x36')],_0x2e7f10[_0xe337('0x34')]);_0xf9a7c9[_0xe337('0x37')]=_[_0xe337('0x38')](_0x2e7f10[_0xe337('0x36')],qs['fields'](_0x3b54ac[_0xe337('0x34')][_0xe337('0x39')]));_0xf9a7c9[_0xe337('0x37')]=_0xf9a7c9[_0xe337('0x37')]['length']?_0xf9a7c9['attributes']:_0x2e7f10[_0xe337('0x36')];if(!_0x3b54ac[_0xe337('0x34')]['hasOwnProperty'](_0xe337('0x3a'))){_0xf9a7c9['limit']=qs['limit'](_0x3b54ac[_0xe337('0x34')][_0xe337('0x1f')]);_0xf9a7c9[_0xe337('0x1d')]=qs[_0xe337('0x1d')](_0x3b54ac['query'][_0xe337('0x1d')]);}_0xf9a7c9[_0xe337('0x3b')]=qs[_0xe337('0x3c')](_0x3b54ac[_0xe337('0x34')]['sort']);_0xf9a7c9[_0xe337('0x3d')]=qs['filters'](_[_0xe337('0x3e')](_0x3b54ac['query'],_0x2e7f10[_0xe337('0x35')]),_0x542277);if(_0x3b54ac[_0xe337('0x34')][_0xe337('0x3f')]){_0xf9a7c9['where']=_[_0xe337('0x40')](_0xf9a7c9['where'],{'$or':_[_0xe337('0x33')](_0x542277,function(_0xba4f96){if(_0xba4f96[_0xe337('0x41')]!==_0xe337('0x42')){var _0x455593={};_0x455593[_0xba4f96['name']]={'$like':'%'+_0x3b54ac[_0xe337('0x34')][_0xe337('0x3f')]+'%'};return _0x455593;}})});}_0xf9a7c9=_[_0xe337('0x40')]({},_0xf9a7c9,_0x3b54ac['options']);var _0x51646a={'where':_0xf9a7c9[_0xe337('0x3d')]};return db['Schedule']['count'](_0x51646a)[_0xe337('0x27')](function(_0x2d67d6){_0x132340['count']=_0x2d67d6;if(_0x3b54ac['query']['includeAll']){_0xf9a7c9['include']=[{'all':!![]}];}return db['Schedule'][_0xe337('0x43')](_0xf9a7c9);})[_0xe337('0x27')](function(_0xb8cd9){_0x132340[_0xe337('0x44')]=_0xb8cd9;return _0x132340;})[_0xe337('0x27')](respondWithFilteredResult(_0x1ae4e5,_0xf9a7c9))[_0xe337('0x45')](handleError(_0x1ae4e5,null));};exports[_0xe337('0x46')]=function(_0x27a3b4,_0x5738a7){var _0x4b576c={'raw':![],'where':{'id':_0x27a3b4[_0xe337('0x47')]['id']}},_0x213202={};_0x213202[_0xe337('0x36')]=_['keys'](db['Schedule'][_0xe337('0x30')]);_0x213202[_0xe337('0x34')]=_[_0xe337('0x48')](_0x27a3b4['query']);_0x213202[_0xe337('0x35')]=_[_0xe337('0x38')](_0x213202['model'],_0x213202[_0xe337('0x34')]);_0x4b576c[_0xe337('0x37')]=_['intersection'](_0x213202[_0xe337('0x36')],qs[_0xe337('0x39')](_0x27a3b4['query'][_0xe337('0x39')]));_0x4b576c[_0xe337('0x37')]=_0x4b576c[_0xe337('0x37')][_0xe337('0x49')]?_0x4b576c[_0xe337('0x37')]:_0x213202[_0xe337('0x36')];if(_0x27a3b4['query'][_0xe337('0x4a')]){_0x4b576c[_0xe337('0x4b')]=[{'all':!![]}];}_0x4b576c=_[_0xe337('0x40')]({},_0x4b576c,_0x27a3b4['options']);return db[_0xe337('0x2f')]['find'](_0x4b576c)[_0xe337('0x27')](handleEntityNotFound(_0x5738a7,null))[_0xe337('0x27')](respondWithResult(_0x5738a7,null))[_0xe337('0x45')](handleError(_0x5738a7,null));};exports[_0xe337('0x4c')]=function(_0x2b1736,_0x32f9f6){return db['Schedule']['create'](_0x2b1736[_0xe337('0x4d')],{})[_0xe337('0x27')](function(_0x563593){var _0x276759=_0x2b1736[_0xe337('0x4e')][_0xe337('0x29')]({'plain':!![]});if(!_0x276759)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x276759[_0xe337('0x4f')]===_0xe337('0x4e')){var _0x30812f=_0x563593['get']({'plain':!![]});var _0x1ae2cc=_0xe337('0x50');return db[_0xe337('0x51')][_0xe337('0x52')]({'where':{'name':_0x1ae2cc,'userProfileId':_0x276759[_0xe337('0x53')]},'raw':!![]})[_0xe337('0x27')](function(_0x442dc7){if(_0x442dc7&&_0x442dc7[_0xe337('0x54')]===0x0){return db['UserProfileResource'][_0xe337('0x4c')]({'name':_0x30812f[_0xe337('0x2d')],'resourceId':_0x30812f['id'],'type':_0x442dc7[_0xe337('0x2d')],'sectionId':_0x442dc7['id']},{})[_0xe337('0x27')](function(){return _0x563593;});}else{return _0x563593;}})[_0xe337('0x45')](function(_0x2dfddf){logger[_0xe337('0x2b')](_0xe337('0x55'),_0x2dfddf);throw _0x2dfddf;});}return _0x563593;})['then'](respondWithResult(_0x32f9f6,0xc9))[_0xe337('0x45')](handleError(_0x32f9f6,null));};exports[_0xe337('0x56')]=function(_0x3fcca5,_0x2584c1){if(_0x3fcca5[_0xe337('0x4d')]['id']){delete _0x3fcca5[_0xe337('0x4d')]['id'];}return db[_0xe337('0x2f')][_0xe337('0x52')]({'where':{'id':_0x3fcca5[_0xe337('0x47')]['id']}})[_0xe337('0x27')](handleEntityNotFound(_0x2584c1,null))[_0xe337('0x27')](saveUpdates(_0x3fcca5[_0xe337('0x4d')],null))[_0xe337('0x27')](respondWithResult(_0x2584c1,null))[_0xe337('0x45')](handleError(_0x2584c1,null));};exports['destroy']=function(_0x5686fa,_0x170348){return db[_0xe337('0x2f')][_0xe337('0x52')]({'where':{'id':_0x5686fa[_0xe337('0x47')]['id']}})[_0xe337('0x27')](handleEntityNotFound(_0x170348,null))['then'](removeEntity(_0x170348,null))[_0xe337('0x45')](handleError(_0x170348,null));};exports[_0xe337('0x57')]=function(_0x3c6b6a,_0x35f10a,_0x5a0fa3){var _0x39d01c=require(_0xe337('0x58'));return db[_0xe337('0x2f')][_0xe337('0x52')]({'where':{'id':_0x3c6b6a['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x35f10a,null))[_0xe337('0x27')](function(){_0x39d01c[_0xe337('0x57')](_0x3c6b6a['params']['id']);})[_0xe337('0x27')](respondWithStatusCode(_0x35f10a,null))[_0xe337('0x45')](handleError(_0x35f10a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index af35151..812e8a1 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 _0x7239=['path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x7239,0xa3));var _0x9723=function(_0x4108c0,_0x5a1e36){_0x4108c0=_0x4108c0-0x0;var _0x56540a=_0x7239[_0x4108c0];return _0x56540a;};'use strict';var _=require(_0x9723('0x0'));var util=require(_0x9723('0x1'));var logger=require(_0x9723('0x2'))(_0x9723('0x3'));var moment=require(_0x9723('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9723('0x5'));var rimraf=require(_0x9723('0x6'));var config=require(_0x9723('0x7'));var attributes=require(_0x9723('0x8'));module['exports']=function(_0x232698,_0x59b2bc){return _0x232698[_0x9723('0x9')](_0x9723('0xa'),attributes,{'tableName':_0x9723('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x688a=['util','../../config/logger','api','request-promise','path','./schedule.attributes','define','Schedule','tools_schedules'];(function(_0x12ef39,_0x18d320){var _0x47a734=function(_0x112dcf){while(--_0x112dcf){_0x12ef39['push'](_0x12ef39['shift']());}};_0x47a734(++_0x18d320);}(_0x688a,0xea));var _0xa688=function(_0x41d67f,_0x31519d){_0x41d67f=_0x41d67f-0x0;var _0x214538=_0x688a[_0x41d67f];return _0x214538;};'use strict';var _=require('lodash');var util=require(_0xa688('0x0'));var logger=require(_0xa688('0x1'))(_0xa688('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa688('0x3'));var fs=require('fs');var path=require(_0xa688('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa688('0x5'));module['exports']=function(_0x209d51,_0x1c8380){return _0x209d51[_0xa688('0x6')](_0xa688('0x7'),attributes,{'tableName':_0xa688('0x8'),'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 6589c3e..d9b1c6b 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 _0xdda5=['request\x20sent','debug','error','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s'];(function(_0x11a0b0,_0x13077c){var _0x1382e6=function(_0x562ed0){while(--_0x562ed0){_0x11a0b0['push'](_0x11a0b0['shift']());}};_0x1382e6(++_0x13077c);}(_0xdda5,0x1c0));var _0x5dda=function(_0x322452,_0x443700){_0x322452=_0x322452-0x0;var _0x26ed24=_0xdda5[_0x322452];return _0x26ed24;};'use strict';var _=require('lodash');var util=require(_0x5dda('0x0'));var moment=require(_0x5dda('0x1'));var BPromise=require(_0x5dda('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dda('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5dda('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5dda('0x5'));var client=jayson[_0x5dda('0x6')][_0x5dda('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4669d9,_0x33f80a,_0x24cdf2){return new BPromise(function(_0x262ecc,_0x2fcac0){return client[_0x5dda('0x8')](_0x4669d9,_0x24cdf2)['then'](function(_0x460337){logger[_0x5dda('0x9')](_0x5dda('0xa'),_0x33f80a,_0x5dda('0xb'));logger[_0x5dda('0xc')]('Schedule,\x20%s,\x20%s,\x20%s',_0x33f80a,'request\x20sent',JSON['stringify'](_0x460337));if(_0x460337[_0x5dda('0xd')]){if(_0x460337['error']['code']===0x1f4){logger[_0x5dda('0xd')](_0x5dda('0xa'),_0x33f80a,_0x460337[_0x5dda('0xd')][_0x5dda('0xe')]);return _0x2fcac0(_0x460337[_0x5dda('0xd')][_0x5dda('0xe')]);}logger[_0x5dda('0xd')]('Schedule,\x20%s,\x20%s',_0x33f80a,_0x460337[_0x5dda('0xd')][_0x5dda('0xe')]);return _0x262ecc(_0x460337['error'][_0x5dda('0xe')]);}else{logger[_0x5dda('0x9')](_0x5dda('0xa'),_0x33f80a,'request\x20sent');_0x262ecc(_0x460337[_0x5dda('0xf')][_0x5dda('0xe')]);}})[_0x5dda('0x10')](function(_0x1bc38b){logger[_0x5dda('0xd')]('Schedule,\x20%s,\x20%s',_0x33f80a,_0x1bc38b);_0x2fcac0(_0x1bc38b);});});} \ No newline at end of file +var _0x269b=['bluebird','../../config/environment','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x52d2b8,_0x4d7924){var _0x32e08a=function(_0x3e3711){while(--_0x3e3711){_0x52d2b8['push'](_0x52d2b8['shift']());}};_0x32e08a(++_0x4d7924);}(_0x269b,0x1e3));var _0xb269=function(_0xa84f31,_0x261b6f){_0xa84f31=_0xa84f31-0x0;var _0x4cc842=_0x269b[_0xa84f31];return _0x4cc842;};'use strict';var _=require(_0xb269('0x0'));var util=require(_0xb269('0x1'));var moment=require(_0xb269('0x2'));var BPromise=require(_0xb269('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb269('0x4'));var jayson=require(_0xb269('0x5'));var client=jayson['client'][_0xb269('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x71572d,_0x52eaf2,_0x273d82){return new BPromise(function(_0x490e29,_0x3df146){return client['request'](_0x71572d,_0x273d82)[_0xb269('0x7')](function(_0x598882){logger[_0xb269('0x8')](_0xb269('0x9'),_0x52eaf2,_0xb269('0xa'));logger[_0xb269('0xb')](_0xb269('0xc'),_0x52eaf2,'request\x20sent',JSON[_0xb269('0xd')](_0x598882));if(_0x598882[_0xb269('0xe')]){if(_0x598882['error'][_0xb269('0xf')]===0x1f4){logger[_0xb269('0xe')](_0xb269('0x9'),_0x52eaf2,_0x598882[_0xb269('0xe')]['message']);return _0x3df146(_0x598882[_0xb269('0xe')]['message']);}logger[_0xb269('0xe')](_0xb269('0x9'),_0x52eaf2,_0x598882[_0xb269('0xe')][_0xb269('0x10')]);return _0x490e29(_0x598882[_0xb269('0xe')][_0xb269('0x10')]);}else{logger[_0xb269('0x8')]('Schedule,\x20%s,\x20%s',_0x52eaf2,_0xb269('0xa'));_0x490e29(_0x598882[_0xb269('0x11')][_0xb269('0x10')]);}})['catch'](function(_0x34923e){logger[_0xb269('0xe')](_0xb269('0x9'),_0x52eaf2,_0x34923e);_0x3df146(_0x34923e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b9c98ac..510ed4f 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 _0xb48c=['/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get'];(function(_0x3b00b4,_0x413db0){var _0x1f83a4=function(_0x5f1a3b){while(--_0x5f1a3b){_0x3b00b4['push'](_0x3b00b4['shift']());}};_0x1f83a4(++_0x413db0);}(_0xb48c,0x8a));var _0xcb48=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb48c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xcb48('0x0'));var util=require(_0xcb48('0x1'));var path=require(_0xcb48('0x2'));var timeout=require(_0xcb48('0x3'));var express=require(_0xcb48('0x4'));var router=express[_0xcb48('0x5')]();var fs_extra=require(_0xcb48('0x6'));var auth=require(_0xcb48('0x7'));var interaction=require(_0xcb48('0x8'));var config=require(_0xcb48('0x9'));var controller=require(_0xcb48('0xa'));router[_0xcb48('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcb48('0xb')](_0xcb48('0xc'),auth['isAuthenticated'](),controller[_0xcb48('0xd')]);router[_0xcb48('0xb')](_0xcb48('0xe'),auth[_0xcb48('0xf')](),controller[_0xcb48('0x10')]);router['get'](_0xcb48('0x11'),auth['isAuthenticated'](),controller[_0xcb48('0x12')]);router[_0xcb48('0x13')]('/',auth[_0xcb48('0xf')](),controller[_0xcb48('0x14')]);router[_0xcb48('0x15')](_0xcb48('0xe'),auth[_0xcb48('0xf')](),controller[_0xcb48('0x16')]);router[_0xcb48('0x17')](_0xcb48('0xe'),auth[_0xcb48('0xf')](),controller[_0xcb48('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9735=['/:id','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','download','post','put'];(function(_0x3374fd,_0x59a9bc){var _0xb10792=function(_0x51eb9d){while(--_0x51eb9d){_0x3374fd['push'](_0x3374fd['shift']());}};_0xb10792(++_0x59a9bc);}(_0x9735,0x1cd));var _0x5973=function(_0x1bcab2,_0x516bfc){_0x1bcab2=_0x1bcab2-0x0;var _0x37ae48=_0x9735[_0x1bcab2];return _0x37ae48;};'use strict';var multer=require('multer');var util=require(_0x5973('0x0'));var path=require(_0x5973('0x1'));var timeout=require(_0x5973('0x2'));var express=require('express');var router=express[_0x5973('0x3')]();var fs_extra=require(_0x5973('0x4'));var auth=require(_0x5973('0x5'));var interaction=require(_0x5973('0x6'));var config=require(_0x5973('0x7'));var controller=require(_0x5973('0x8'));router[_0x5973('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5973('0x9')](_0x5973('0xa'),auth[_0x5973('0xb')](),controller['describe']);router[_0x5973('0x9')]('/:id',auth[_0x5973('0xb')](),controller['show']);router[_0x5973('0x9')]('/:id/download',auth[_0x5973('0xb')](),controller[_0x5973('0xc')]);router[_0x5973('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5973('0xe')](_0x5973('0xf'),auth[_0x5973('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5973('0x10')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6c80ee6..893b153 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 _0xe1e8=['sequelize','path','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x20d503,_0x255a38){_0x20d503=_0x20d503-0x0;var _0xe51bef=_0xe1e8[_0x20d503];return _0xe51bef;};'use strict';var Sequelize=require(_0x8e1e('0x0'));var moment=require('moment');var path=require(_0x8e1e('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x8e1e('0x2')],'get':function(){return this[_0x8e1e('0x3')](_0x8e1e('0x4'))?path[_0x8e1e('0x5')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x8e1e('0x6')]},'channel':{'type':Sequelize[_0x8e1e('0x6')]},'value':{'type':Sequelize[_0x8e1e('0x6')],'set':function(_0x1861ce){var _0x4eb2b7=_0x1861ce[_0x8e1e('0x7')](/\\/g,'/');this[_0x8e1e('0x8')](_0x8e1e('0x4'),_0x4eb2b7);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4007f3){this[_0x8e1e('0x8')]('startedAt',moment()[_0x8e1e('0x9')](_0x4007f3,'ms'));this['setDataValue'](_0x8e1e('0xa'),moment());this[_0x8e1e('0x8')](_0x8e1e('0xb'),_0x4007f3);}},'startedAt':{'type':Sequelize[_0x8e1e('0xc')],'get':function(){return moment(this[_0x8e1e('0x3')]('startedAt'))[_0x8e1e('0xd')](_0x8e1e('0xe'))[_0x8e1e('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8e1e('0x3')](_0x8e1e('0xa')))[_0x8e1e('0xd')](_0x8e1e('0xe'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8e1e('0x10')))[_0x8e1e('0xd')](_0x8e1e('0xe'))[_0x8e1e('0xf')]();}},'updatedAt':{'type':Sequelize[_0x8e1e('0xc')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x8e1e('0xd')](_0x8e1e('0xe'))[_0x8e1e('0xf')]();}}}; \ No newline at end of file +var _0x18f3=['subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','moment','path','../../config/environment','getDataValue','extname','value','STRING','setDataValue','INTEGER','startedAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x18f3,0x19f));var _0x318f=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x18f3[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x318f('0x0'));var path=require(_0x318f('0x1'));var config=require(_0x318f('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x318f('0x3')]('value')?path[_0x318f('0x4')](this[_0x318f('0x3')](_0x318f('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x318f('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x318f('0x6')],'set':function(_0x3579e8){var _0x49188c=_0x3579e8['replace'](/\\/g,'/');this[_0x318f('0x7')]('value',_0x49188c);}},'rating':{'type':Sequelize[_0x318f('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x318f('0x8')],'set':function(_0x1479df){this[_0x318f('0x7')](_0x318f('0x9'),moment()[_0x318f('0xa')](_0x1479df,'ms'));this[_0x318f('0x7')](_0x318f('0xb'),moment());this[_0x318f('0x7')](_0x318f('0xc'),_0x1479df);}},'startedAt':{'type':Sequelize[_0x318f('0xd')],'get':function(){return moment(this[_0x318f('0x3')](_0x318f('0x9')))[_0x318f('0xe')](_0x318f('0xf'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x318f('0x3')](_0x318f('0xb')))[_0x318f('0xe')](_0x318f('0xf'))[_0x318f('0x10')]();}},'createdAt':{'type':Sequelize[_0x318f('0xd')],'get':function(){return moment(this[_0x318f('0x3')]('createdAt'))[_0x318f('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x318f('0xd')],'get':function(){return moment(this[_0x318f('0x3')]('updatedAt'))['format'](_0x318f('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 52dc475..08a3e87 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 _0xac31=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','then','includeAll','findAll','rows','catch','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher'];(function(_0x537501,_0x1509e4){var _0x54bfc2=function(_0x29bd68){while(--_0x29bd68){_0x537501['push'](_0x537501['shift']());}};_0x54bfc2(++_0x1509e4);}(_0xac31,0xca));var _0x1ac3=function(_0x3e3527,_0x4f9a6c){_0x3e3527=_0x3e3527-0x0;var _0x2ed1ae=_0xac31[_0x3e3527];return _0x2ed1ae;};'use strict';var emlformat=require(_0x1ac3('0x0'));var rimraf=require(_0x1ac3('0x1'));var zipdir=require(_0x1ac3('0x2'));var jsonpatch=require(_0x1ac3('0x3'));var rp=require(_0x1ac3('0x4'));var moment=require(_0x1ac3('0x5'));var BPromise=require(_0x1ac3('0x6'));var Mustache=require('mustache');var util=require(_0x1ac3('0x7'));var path=require(_0x1ac3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ac3('0x9'));var fs=require('fs');var fs_extra=require(_0x1ac3('0xa'));var _=require(_0x1ac3('0xb'));var squel=require(_0x1ac3('0xc'));var crypto=require(_0x1ac3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1ac3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ac3('0xf'));var Papa=require(_0x1ac3('0x10'));var Redis=require(_0x1ac3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ac3('0x12'));var as=require(_0x1ac3('0x13'));var hardwareService=require(_0x1ac3('0x14'));var logger=require(_0x1ac3('0x15'))(_0x1ac3('0x16'));var utils=require(_0x1ac3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac3('0x18'));var db=require(_0x1ac3('0x19'))['db'];function respondWithStatusCode(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xcc;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0x1a')](_0x2338b9);}return _0x2eeabf[_0x1ac3('0x1b')](_0x2338b9)[_0x1ac3('0x1c')]();};}function respondWithResult(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0xc8;return function(_0x24bb5e){if(_0x24bb5e){return _0x2def9f[_0x1ac3('0x1b')](_0x53cc35)['json'](_0x24bb5e);}};}function respondWithFilteredResult(_0x29a7b3,_0x1f9641){return function(_0x38b52a){if(_0x38b52a){var _0x51f1e4=typeof _0x1f9641[_0x1ac3('0x1d')]===_0x1ac3('0x1e')&&typeof _0x1f9641[_0x1ac3('0x1f')]==='undefined';var _0x195683=_0x38b52a['count'];var _0x291616=_0x51f1e4?0x0:_0x1f9641[_0x1ac3('0x1d')];var _0x20091d=_0x51f1e4?_0x38b52a[_0x1ac3('0x20')]:_0x1f9641[_0x1ac3('0x1d')]+_0x1f9641['limit'];var _0x136e73;if(_0x20091d>=_0x195683){_0x20091d=_0x195683;_0x136e73=0xc8;}else{_0x136e73=0xce;}_0x29a7b3[_0x1ac3('0x1b')](_0x136e73);return _0x29a7b3[_0x1ac3('0x21')](_0x1ac3('0x22'),_0x291616+'-'+_0x20091d+'/'+_0x195683)['json'](_0x38b52a);}return null;};}function patchUpdates(_0x48d18a){return function(_0x2879d8){try{jsonpatch[_0x1ac3('0x23')](_0x2879d8,_0x48d18a,!![]);}catch(_0x14070b){return BPromise[_0x1ac3('0x24')](_0x14070b);}return _0x2879d8[_0x1ac3('0x25')]();};}function saveUpdates(_0x319988,_0x23b767){return function(_0x10912a){if(_0x10912a){return _0x10912a[_0x1ac3('0x26')](_0x319988)['then'](function(_0x1e277f){return _0x1e277f;});}return null;};}function removeEntity(_0x231b7f,_0x4b19f2){return function(_0x2b5182){if(_0x2b5182){return _0x2b5182[_0x1ac3('0x27')]()['then'](function(){_0x231b7f[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();});}};}function handleEntityNotFound(_0x145486,_0x2dfdb7){return function(_0x10db3d){if(!_0x10db3d){_0x145486['sendStatus'](0x194);}return _0x10db3d;};}function handleError(_0x5a2ab2,_0x503a64){_0x503a64=_0x503a64||0x1f4;return function(_0x528807){logger['error'](_0x528807[_0x1ac3('0x28')]);if(_0x528807['name']){delete _0x528807[_0x1ac3('0x29')];}_0x5a2ab2[_0x1ac3('0x1b')](_0x503a64)[_0x1ac3('0x2a')](_0x528807);};}exports[_0x1ac3('0x2b')]=function(_0x4b3d3c,_0x61441d){var _0x541da0={},_0x2ddd73={},_0x4000b0={'count':0x0,'rows':[]};var _0x440aed=_[_0x1ac3('0x2c')](db[_0x1ac3('0x2d')][_0x1ac3('0x2e')],function(_0x9c17c2){return{'name':_0x9c17c2['fieldName'],'type':_0x9c17c2[_0x1ac3('0x2f')][_0x1ac3('0x30')]};});_0x2ddd73[_0x1ac3('0x31')]=_[_0x1ac3('0x32')](_['map'](_0x440aed,_0x1ac3('0x29')),[_0x1ac3('0x33')]);_0x2ddd73[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4b3d3c[_0x1ac3('0x34')]);_0x2ddd73['filters']=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],_0x2ddd73[_0x1ac3('0x34')]);_0x541da0[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],qs['fields'](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x541da0[_0x1ac3('0x37')]=_0x541da0[_0x1ac3('0x37')]['length']?_0x541da0[_0x1ac3('0x37')]:_0x2ddd73[_0x1ac3('0x31')];if(!_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x39')](_0x1ac3('0x3a'))){_0x541da0[_0x1ac3('0x1f')]=qs[_0x1ac3('0x1f')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x1f')]);_0x541da0['offset']=qs[_0x1ac3('0x1d')](_0x4b3d3c[_0x1ac3('0x34')]['offset']);}_0x541da0[_0x1ac3('0x3b')]=qs[_0x1ac3('0x3c')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x3c')]);_0x541da0[_0x1ac3('0x3d')]=qs[_0x1ac3('0x3e')](_[_0x1ac3('0x3f')](_0x4b3d3c[_0x1ac3('0x34')],_0x2ddd73['filters']),_0x440aed);if(_0x4b3d3c[_0x1ac3('0x34')]['filter']){_0x541da0[_0x1ac3('0x3d')]=_[_0x1ac3('0x40')](_0x541da0[_0x1ac3('0x3d')],{'$or':_[_0x1ac3('0x2c')](_0x440aed,function(_0x3141ae){if(_0x3141ae[_0x1ac3('0x2f')]!=='VIRTUAL'){var _0x3b5c1c={};_0x3b5c1c[_0x3141ae[_0x1ac3('0x29')]]={'$like':'%'+_0x4b3d3c[_0x1ac3('0x34')]['filter']+'%'};return _0x3b5c1c;}})});}_0x541da0=_[_0x1ac3('0x40')]({},_0x541da0,_0x4b3d3c[_0x1ac3('0x41')]);var _0x5cec6b={'where':_0x541da0[_0x1ac3('0x3d')]};return db[_0x1ac3('0x2d')][_0x1ac3('0x20')](_0x5cec6b)[_0x1ac3('0x42')](function(_0x466a45){_0x4000b0[_0x1ac3('0x20')]=_0x466a45;if(_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x541da0['include']=[{'all':!![]}];}return db[_0x1ac3('0x2d')][_0x1ac3('0x44')](_0x541da0);})[_0x1ac3('0x42')](function(_0x254a77){_0x4000b0[_0x1ac3('0x45')]=_0x254a77;return _0x4000b0;})[_0x1ac3('0x42')](respondWithFilteredResult(_0x61441d,_0x541da0))[_0x1ac3('0x46')](handleError(_0x61441d,null));};exports['show']=function(_0x4edc4d,_0x2c2099){var _0x3f60ca={'raw':![],'where':{'id':_0x4edc4d[_0x1ac3('0x47')]['id']}},_0x4972d1={};_0x4972d1[_0x1ac3('0x31')]=_['keys'](db[_0x1ac3('0x2d')]['rawAttributes']);_0x4972d1[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4edc4d[_0x1ac3('0x34')]);_0x4972d1[_0x1ac3('0x3e')]=_['intersection'](_0x4972d1[_0x1ac3('0x31')],_0x4972d1[_0x1ac3('0x34')]);_0x3f60ca[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x4972d1[_0x1ac3('0x31')],qs['fields'](_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x3f60ca[_0x1ac3('0x37')]=_0x3f60ca[_0x1ac3('0x37')]['length']?_0x3f60ca[_0x1ac3('0x37')]:_0x4972d1[_0x1ac3('0x31')];if(_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x3f60ca['include']=[{'all':!![]}];}_0x3f60ca=_[_0x1ac3('0x40')]({},_0x3f60ca,_0x4edc4d[_0x1ac3('0x41')]);return db[_0x1ac3('0x2d')][_0x1ac3('0x48')](_0x3f60ca)['then'](handleEntityNotFound(_0x2c2099,null))[_0x1ac3('0x42')](respondWithResult(_0x2c2099,null))['catch'](handleError(_0x2c2099,null));};exports[_0x1ac3('0x49')]=function(_0x10bcaf,_0x2e3347){return db[_0x1ac3('0x2d')][_0x1ac3('0x49')](_0x10bcaf[_0x1ac3('0x4a')],{})[_0x1ac3('0x42')](respondWithResult(_0x2e3347,0xc9))['catch'](handleError(_0x2e3347,null));};exports['update']=function(_0xe8f33c,_0x249c2d){if(_0xe8f33c[_0x1ac3('0x4a')]['id']){delete _0xe8f33c['body']['id'];}delete _0xe8f33c['body']['duration'];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4b')];delete _0xe8f33c['body'][_0x1ac3('0x4c')];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4d')];return db[_0x1ac3('0x2d')]['find']({'where':{'id':_0xe8f33c['params']['id']}})[_0x1ac3('0x42')](handleEntityNotFound(_0x249c2d,null))[_0x1ac3('0x42')](saveUpdates(_0xe8f33c['body'],null))[_0x1ac3('0x42')](respondWithResult(_0x249c2d,null))['catch'](handleError(_0x249c2d,null));};exports['describe']=function(_0x2d628d,_0x220dd0){return db['ScreenRecording'][_0x1ac3('0x4e')]()['then'](respondWithResult(_0x220dd0,null))[_0x1ac3('0x46')](handleError(_0x220dd0,null));};exports[_0x1ac3('0x4f')]=function(_0x3586b9,_0x3a0320,_0x34ad43){var _0x40e9c7=require(_0x1ac3('0x50'));var _0x331374=![];var _0xeb7e49={};if(_0x3586b9[_0x1ac3('0x34')][_0x1ac3('0x2f')]&&_0x3586b9['query']['type']===_0x1ac3('0x51')){_0xeb7e49[_0x1ac3('0x51')]=_0x3586b9[_0x1ac3('0x47')]['id'];}else{_0xeb7e49['id']=_0x3586b9[_0x1ac3('0x47')]['id'];}return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':_0xeb7e49,'attributes':['id',_0x1ac3('0x4d')],'raw':!![]})[_0x1ac3('0x42')](handleEntityNotFound(_0x3a0320,null))[_0x1ac3('0x42')](function(_0x3149f6){if(_0x3149f6){var _0x541bba=path[_0x1ac3('0x52')](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x3149f6[_0x1ac3('0x4d')]);var _0x20c195=util['format'](_0x1ac3('0x55'),_0x541bba);if(fs[_0x1ac3('0x56')](_0x20c195)){_0x331374=!![];return _0x40e9c7['decryptFile'](_0x20c195,_0x541bba,config['secrets']['recording'])[_0x1ac3('0x42')](function(){return _0x3149f6;});}return _0x3149f6;}})[_0x1ac3('0x42')](function(_0x2a1f66){if(_0x2a1f66){var _0x5ad546=path[_0x1ac3('0x52')](config['root'],'server/files/screen_recordings',_0x2a1f66['value']);if(!fs['existsSync'](_0x5ad546)){throw new db[(_0x1ac3('0x57'))][(_0x1ac3('0x58'))](_0x1ac3('0x59'));}if(_0x2a1f66[_0x1ac3('0x5a')]){return _0x3a0320[_0x1ac3('0x4f')](_0x5ad546,_0x2a1f66['filename']+path[_0x1ac3('0x5b')](_0x5ad546),function(){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}else{return _0x3a0320['download'](_0x5ad546,function(_0x2bcb4b){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}}})[_0x1ac3('0x46')](function(_0x2e79b2){if(_0x2e79b2[_0x1ac3('0x5d')]==='ScreenRecording\x20not\x20found'){_0x3a0320[_0x1ac3('0x1b')](0x194)[_0x1ac3('0x2a')](_0x1ac3('0x5e'));}else{return handleError(_0x3a0320,null);}});};exports[_0x1ac3('0x27')]=function(_0x4cfa04,_0x19407a){return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':{'id':_0x4cfa04[_0x1ac3('0x47')]['id']}})[_0x1ac3('0x42')](function(_0x1ac283){if(_['isNil'](_0x1ac283)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1ac283;})['then'](function(_0x582fe2){var _0x3b930b=path['join'](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x582fe2[_0x1ac3('0x4d')]);logger[_0x1ac3('0x5f')](_0x1ac3('0x60'),_0x3b930b);if(!_[_0x1ac3('0x61')](_0x582fe2['value'])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')](_0x1ac3('0x62')+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}_0x3b930b=_0x3b930b+_0x1ac3('0x64');if(!_[_0x1ac3('0x61')](_0x582fe2[_0x1ac3('0x4d')])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')]('File:\x20\x22'+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}return _0x582fe2;})['then'](function(_0x402507){if(!_0x402507)throw new InternalError();return _0x402507[_0x1ac3('0x27')]();})[_0x1ac3('0x42')](function(){_0x19407a[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();})[_0x1ac3('0x46')](handleError(_0x19407a,null));}; \ No newline at end of file +var _0x1cb9=['ValidationError','filename','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','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','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','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','keys','length','include','options','find','create','body','duration','createdAt','value','params','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize'];(function(_0x2029f7,_0x53b3f1){var _0x5c6c6f=function(_0x22836a){while(--_0x22836a){_0x2029f7['push'](_0x2029f7['shift']());}};_0x5c6c6f(++_0x53b3f1);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3a7063,_0x3f2373){_0x3a7063=_0x3a7063-0x0;var _0x5b114b=_0x1cb9[_0x3a7063];return _0x5b114b;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x33')](_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29')),[_0x91cb('0x34')]);_0x504275[_0x91cb('0x35')]=_['keys'](_0x3b3ee6[_0x91cb('0x35')]);_0x504275[_0x91cb('0x36')]=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x35')]);_0x468908['attributes']=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x38')]));_0x468908['attributes']=_0x468908[_0x91cb('0x39')]['length']?_0x468908['attributes']:_0x504275['model'];if(!_0x3b3ee6[_0x91cb('0x35')]['hasOwnProperty'](_0x91cb('0x3a'))){_0x468908['limit']=qs['limit'](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x1d')]);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x35')]['offset']);}_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3c')]);_0x468908['where']=qs['filters'](_[_0x91cb('0x3d')](_0x3b3ee6[_0x91cb('0x35')],_0x504275['filters']),_0x52670a);if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]){_0x468908['where']=_[_0x91cb('0x3f')](_0x468908[_0x91cb('0x40')],{'$or':_['map'](_0x52670a,function(_0x43d4fe){if(_0x43d4fe['type']!==_0x91cb('0x41')){var _0xabe6a3={};_0xabe6a3[_0x43d4fe[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]+'%'};return _0xabe6a3;}})});}_0x468908=_[_0x91cb('0x3f')]({},_0x468908,_0x3b3ee6['options']);var _0xa90111={'where':_0x468908[_0x91cb('0x40')]};return db['ScreenRecording'][_0x91cb('0x1e')](_0xa90111)['then'](function(_0x2c6102){_0x2f04a3[_0x91cb('0x1e')]=_0x2c6102;if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x42')]){_0x468908['include']=[{'all':!![]}];}return db[_0x91cb('0x2d')][_0x91cb('0x43')](_0x468908);})[_0x91cb('0x25')](function(_0x37e777){_0x2f04a3[_0x91cb('0x44')]=_0x37e777;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x45')](handleError(_0x2fb473,null));};exports[_0x91cb('0x46')]=function(_0x325dca,_0x3cc4c1){var _0x49bc42={'raw':![],'where':{'id':_0x325dca['params']['id']}},_0x16993f={};_0x16993f[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x16993f[_0x91cb('0x35')]=_[_0x91cb('0x47')](_0x325dca[_0x91cb('0x35')]);_0x16993f[_0x91cb('0x36')]=_['intersection'](_0x16993f[_0x91cb('0x32')],_0x16993f[_0x91cb('0x35')]);_0x49bc42['attributes']=_[_0x91cb('0x37')](_0x16993f[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x325dca[_0x91cb('0x35')][_0x91cb('0x38')]));_0x49bc42[_0x91cb('0x39')]=_0x49bc42[_0x91cb('0x39')][_0x91cb('0x48')]?_0x49bc42[_0x91cb('0x39')]:_0x16993f['model'];if(_0x325dca[_0x91cb('0x35')][_0x91cb('0x42')]){_0x49bc42[_0x91cb('0x49')]=[{'all':!![]}];}_0x49bc42=_[_0x91cb('0x3f')]({},_0x49bc42,_0x325dca[_0x91cb('0x4a')]);return db[_0x91cb('0x2d')][_0x91cb('0x4b')](_0x49bc42)[_0x91cb('0x25')](handleEntityNotFound(_0x3cc4c1,null))['then'](respondWithResult(_0x3cc4c1,null))[_0x91cb('0x45')](handleError(_0x3cc4c1,null));};exports[_0x91cb('0x4c')]=function(_0x2b8b7f,_0x3b8cfd){return db['ScreenRecording'][_0x91cb('0x4c')](_0x2b8b7f[_0x91cb('0x4d')],{})['then'](respondWithResult(_0x3b8cfd,0xc9))[_0x91cb('0x45')](handleError(_0x3b8cfd,null));};exports['update']=function(_0x2c419b,_0x4c0acd){if(_0x2c419b['body']['id']){delete _0x2c419b['body']['id'];}delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4e')];delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4f')];delete _0x2c419b[_0x91cb('0x4d')]['closedAt'];delete _0x2c419b['body'][_0x91cb('0x50')];return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x2c419b[_0x91cb('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c0acd,null))['then'](saveUpdates(_0x2c419b['body'],null))[_0x91cb('0x25')](respondWithResult(_0x4c0acd,null))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x52')]=function(_0x4aa670,_0x21463a){return db[_0x91cb('0x2d')][_0x91cb('0x52')]()[_0x91cb('0x25')](respondWithResult(_0x21463a,null))[_0x91cb('0x45')](handleError(_0x21463a,null));};exports[_0x91cb('0x53')]=function(_0x3ec250,_0x30fd4e,_0xff7c3f){var _0x20fc0a=require(_0x91cb('0x54'));var _0x5752ed=![];var _0x1e445a={};if(_0x3ec250[_0x91cb('0x35')]['type']&&_0x3ec250[_0x91cb('0x35')][_0x91cb('0x30')]==='uniqueid'){_0x1e445a[_0x91cb('0x55')]=_0x3ec250[_0x91cb('0x51')]['id'];}else{_0x1e445a['id']=_0x3ec250[_0x91cb('0x51')]['id'];}return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':_0x1e445a,'attributes':['id',_0x91cb('0x50')],'raw':!![]})[_0x91cb('0x25')](handleEntityNotFound(_0x30fd4e,null))[_0x91cb('0x25')](function(_0x3320bd){if(_0x3320bd){var _0x93ef52=path[_0x91cb('0x56')](config['root'],_0x91cb('0x57'),_0x3320bd['value']);var _0x37221e=util['format'](_0x91cb('0x58'),_0x93ef52);if(fs[_0x91cb('0x59')](_0x37221e)){_0x5752ed=!![];return _0x20fc0a[_0x91cb('0x5a')](_0x37221e,_0x93ef52,config['secrets'][_0x91cb('0x5b')])[_0x91cb('0x25')](function(){return _0x3320bd;});}return _0x3320bd;}})['then'](function(_0xef4754){if(_0xef4754){var _0x102025=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],'server/files/screen_recordings',_0xef4754[_0x91cb('0x50')]);if(!fs[_0x91cb('0x59')](_0x102025)){throw new db[(_0x91cb('0x5d'))][(_0x91cb('0x5e'))]('ScreenRecording\x20not\x20found');}if(_0xef4754[_0x91cb('0x5f')]){return _0x30fd4e[_0x91cb('0x53')](_0x102025,_0xef4754['filename']+path['extname'](_0x102025),function(){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}else{return _0x30fd4e['download'](_0x102025,function(_0x1180ac){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}}})['catch'](function(_0x4f19c8){if(_0x4f19c8[_0x91cb('0x61')]==='ScreenRecording\x20not\x20found'){_0x30fd4e[_0x91cb('0x1a')](0x194)[_0x91cb('0x2a')](_0x91cb('0x62'));}else{return handleError(_0x30fd4e,null);}});};exports['destroy']=function(_0x22fea8,_0x524400){return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x22fea8[_0x91cb('0x51')]['id']}})[_0x91cb('0x25')](function(_0x483172){if(_[_0x91cb('0x63')](_0x483172)){throw new ReferenceError(_0x91cb('0x64'));}return _0x483172;})[_0x91cb('0x25')](function(_0x443c72){var _0xaf70c5=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],_0x91cb('0x57'),_0x443c72[_0x91cb('0x50')]);logger[_0x91cb('0x65')](_0x91cb('0x66'),_0xaf70c5);if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger[_0x91cb('0x65')](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}_0xaf70c5=_0xaf70c5+_0x91cb('0x6a');if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger['info'](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}return _0x443c72;})[_0x91cb('0x25')](function(_0x48fcfe){if(!_0x48fcfe)throw new InternalError();return _0x48fcfe[_0x91cb('0x26')]();})[_0x91cb('0x25')](function(){_0x524400[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();})[_0x91cb('0x45')](handleError(_0x524400,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 7706cb4..584eebb 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 _0x3062=['path','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3062,0x11b));var _0x2306=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0x3062[_0x1c3370];return _0xa9b358;};'use strict';var _=require(_0x2306('0x0'));var util=require(_0x2306('0x1'));var logger=require(_0x2306('0x2'))('api');var moment=require(_0x2306('0x3'));var BPromise=require(_0x2306('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2306('0x5'));var rimraf=require('rimraf');var config=require(_0x2306('0x6'));var attributes=require(_0x2306('0x7'));module[_0x2306('0x8')]=function(_0x2a8603,_0xa1d393){return _0x2a8603[_0x2306('0x9')]('ScreenRecording',attributes,{'tableName':_0x2306('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x2306('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6ff=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe6ff,0xb4));var _0xfe6f=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe6ff[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xfe6f('0x0'));var util=require(_0xfe6f('0x1'));var logger=require(_0xfe6f('0x2'))(_0xfe6f('0x3'));var moment=require(_0xfe6f('0x4'));var BPromise=require(_0xfe6f('0x5'));var rp=require(_0xfe6f('0x6'));var fs=require('fs');var path=require(_0xfe6f('0x7'));var rimraf=require('rimraf');var config=require(_0xfe6f('0x8'));var attributes=require(_0xfe6f('0x9'));module[_0xfe6f('0xa')]=function(_0x5e4c8b,_0x6a551){return _0x5e4c8b['define']('ScreenRecording',attributes,{'tableName':_0xfe6f('0xb'),'paranoid':![],'indexes':[{'name':_0xfe6f('0xc'),'fields':[_0xfe6f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 8691c2e..1610502 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 _0x4984=['ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x2feb0c,_0x5635b4){var _0x13014e=function(_0x4b863f){while(--_0x4b863f){_0x2feb0c['push'](_0x2feb0c['shift']());}};_0x13014e(++_0x5635b4);}(_0x4984,0x1ae));var _0x4498=function(_0xc68e96,_0x15beea){_0xc68e96=_0xc68e96-0x0;var _0x47f8c5=_0x4984[_0xc68e96];return _0x47f8c5;};'use strict';var _=require(_0x4498('0x0'));var util=require(_0x4498('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4498('0x2'));var fs=require('fs');var Redis=require(_0x4498('0x3'));var db=require(_0x4498('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4498('0x5'))('rpc');var config=require(_0x4498('0x6'));var jayson=require(_0x4498('0x7'));var client=jayson[_0x4498('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2854fe,_0x5a5d6c,_0x13844d){return new BPromise(function(_0x1cbee3,_0x25cef8){return client[_0x4498('0x9')](_0x2854fe,_0x13844d)[_0x4498('0xa')](function(_0x22d358){logger['info'](_0x4498('0xb'),_0x5a5d6c,'request\x20sent');logger[_0x4498('0xc')](_0x4498('0xd'),_0x5a5d6c,_0x4498('0xe'),JSON[_0x4498('0xf')](_0x22d358));if(_0x22d358[_0x4498('0x10')]){if(_0x22d358['error'][_0x4498('0x11')]===0x1f4){logger[_0x4498('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x5a5d6c,_0x22d358[_0x4498('0x10')]['message']);return _0x25cef8(_0x22d358[_0x4498('0x10')][_0x4498('0x12')]);}logger[_0x4498('0x10')](_0x4498('0xb'),_0x5a5d6c,_0x22d358[_0x4498('0x10')][_0x4498('0x12')]);return _0x1cbee3(_0x22d358[_0x4498('0x10')][_0x4498('0x12')]);}else{logger['info'](_0x4498('0xb'),_0x5a5d6c,'request\x20sent');_0x1cbee3(_0x22d358[_0x4498('0x13')]['message']);}})[_0x4498('0x14')](function(_0x551423){logger['error'](_0x4498('0xb'),_0x5a5d6c,_0x551423);_0x25cef8(_0x551423);});});} \ No newline at end of file +var _0x8db1=['../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x508f23,_0x322a05){var _0x2bec4a=function(_0x507156){while(--_0x507156){_0x508f23['push'](_0x508f23['shift']());}};_0x2bec4a(++_0x322a05);}(_0x8db1,0x118));var _0x18db=function(_0x88ffd4,_0x25f7e6){_0x88ffd4=_0x88ffd4-0x0;var _0x528f9c=_0x8db1[_0x88ffd4];return _0x528f9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x18db('0x0'));var rs=require(_0x18db('0x1'));var fs=require('fs');var Redis=require(_0x18db('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x18db('0x3'));var logger=require('../../config/logger')(_0x18db('0x4'));var config=require(_0x18db('0x5'));var jayson=require(_0x18db('0x6'));var client=jayson['client'][_0x18db('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x52a6ee,_0x52295a,_0x9a7b90){return new BPromise(function(_0x2102cd,_0x1e597d){return client[_0x18db('0x8')](_0x52a6ee,_0x9a7b90)[_0x18db('0x9')](function(_0x36363f){logger[_0x18db('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x52295a,'request\x20sent');logger['debug'](_0x18db('0xb'),_0x52295a,_0x18db('0xc'),JSON['stringify'](_0x36363f));if(_0x36363f[_0x18db('0xd')]){if(_0x36363f[_0x18db('0xd')][_0x18db('0xe')]===0x1f4){logger[_0x18db('0xd')](_0x18db('0xf'),_0x52295a,_0x36363f[_0x18db('0xd')][_0x18db('0x10')]);return _0x1e597d(_0x36363f[_0x18db('0xd')][_0x18db('0x10')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x52295a,_0x36363f[_0x18db('0xd')][_0x18db('0x10')]);return _0x2102cd(_0x36363f[_0x18db('0xd')][_0x18db('0x10')]);}else{logger[_0x18db('0xa')](_0x18db('0xf'),_0x52295a,'request\x20sent');_0x2102cd(_0x36363f[_0x18db('0x11')]['message']);}})[_0x18db('0x12')](function(_0x9c3b50){logger[_0x18db('0xd')](_0x18db('0xf'),_0x52295a,_0x9c3b50);_0x1e597d(_0x9c3b50);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 027f6bb..5cfc662 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 _0x642d=['get','index','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','/:id/logo','single','file','addLogo','%s%s','extname','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x642d,0x19e));var _0xd642=function(_0x35c571,_0x528a19){_0x35c571=_0x35c571-0x0;var _0x52c5a2=_0x642d[_0x35c571];return _0x52c5a2;};'use strict';var multer=require(_0xd642('0x0'));var util=require(_0xd642('0x1'));var path=require(_0xd642('0x2'));var timeout=require(_0xd642('0x3'));var express=require(_0xd642('0x4'));var router=express[_0xd642('0x5')]();var fs_extra=require(_0xd642('0x6'));var auth=require(_0xd642('0x7'));var interaction=require(_0xd642('0x8'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xd642('0x9')]('/',auth['isAuthenticated'](),controller[_0xd642('0xa')]);router['get'](_0xd642('0xb'),controller[_0xd642('0xc')]);router['get'](_0xd642('0xd'),controller[_0xd642('0xe')]);router[_0xd642('0x9')]('/:id/logo',controller[_0xd642('0xf')]);router[_0xd642('0x9')](_0xd642('0x10'),controller[_0xd642('0x11')]);router[_0xd642('0x9')](_0xd642('0x12'),controller[_0xd642('0x13')]);router[_0xd642('0x9')](_0xd642('0x14'),controller[_0xd642('0x15')]);router[_0xd642('0x9')](_0xd642('0x16'),controller[_0xd642('0x17')]);var upload=multer({'storage':multer[_0xd642('0x18')]({'destination':function(_0xdfa21,_0x2cf631,_0x5cfed8){_0x5cfed8(null,path[_0xd642('0x19')](config[_0xd642('0x1a')],_0xd642('0x1b')));},'filename':function(_0x44e256,_0x66ad34,_0x7976){_0x7976(null,util[_0xd642('0x1c')]('%s%s',_0xd642('0x1d'),path['extname'](_0x66ad34[_0xd642('0x1e')])));}})});router[_0xd642('0x1f')](_0xd642('0x20'),upload[_0xd642('0x21')](_0xd642('0x22')),controller[_0xd642('0x23')]);var upload=multer({'storage':multer[_0xd642('0x18')]({'destination':function(_0x522269,_0x427f62,_0x4afdcf){_0x4afdcf(null,path[_0xd642('0x19')](config[_0xd642('0x1a')],'server/files/images/logos/'));},'filename':function(_0x5690f9,_0x4fd64d,_0x150c0d){_0x150c0d(null,util['format'](_0xd642('0x24'),'logologin',path[_0xd642('0x25')](_0x4fd64d[_0xd642('0x1e')])));}})});router[_0xd642('0x1f')](_0xd642('0x10'),upload[_0xd642('0x21')](_0xd642('0x22')),controller[_0xd642('0x26')]);var upload=multer({'storage':multer[_0xd642('0x18')]({'destination':function(_0x33ade4,_0xf2dc22,_0x4722c7){_0x4722c7(null,path[_0xd642('0x19')](config[_0xd642('0x1a')],'server/files/images/logos/'));},'filename':function(_0x5904a4,_0x372115,_0x1b8f74){_0x1b8f74(null,util[_0xd642('0x1c')](_0xd642('0x24'),_0xd642('0x27'),path['extname'](_0x372115[_0xd642('0x1e')])));}})});router[_0xd642('0x1f')](_0xd642('0x14'),upload[_0xd642('0x21')](_0xd642('0x22')),controller[_0xd642('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x51eae2,_0x2f986b,_0x4691f2){_0x4691f2(null,path[_0xd642('0x19')](config['root'],_0xd642('0x1b')));},'filename':function(_0x3d22ef,_0x5e076c,_0x5204fd){_0x5204fd(null,util[_0xd642('0x1c')]('%s%s',_0xd642('0x29'),path[_0xd642('0x25')](_0x5e076c[_0xd642('0x1e')])));}})});router['post']('/:id/favicon',upload['single']('file'),controller[_0xd642('0x2a')]);router[_0xd642('0x2b')](_0xd642('0xd'),auth[_0xd642('0x2c')](),controller[_0xd642('0x2d')]);module[_0xd642('0x2e')]=router; \ No newline at end of file +var _0xb212=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','file','addLogo','%s%s','extname','addLogoLogin','preferred','/:id/preferred','addPreferred','/:id/favicon','put','update','exports','multer','util','path','connect-timeout'];(function(_0x17f424,_0x176a5a){var _0x111e6f=function(_0x468c71){while(--_0x468c71){_0x17f424['push'](_0x17f424['shift']());}};_0x111e6f(++_0x176a5a);}(_0xb212,0x122));var _0x2b21=function(_0x4f59bb,_0x26c50b){_0x4f59bb=_0x4f59bb-0x0;var _0x2da275=_0xb212[_0x4f59bb];return _0x2da275;};'use strict';var multer=require(_0x2b21('0x0'));var util=require(_0x2b21('0x1'));var path=require(_0x2b21('0x2'));var timeout=require(_0x2b21('0x3'));var express=require(_0x2b21('0x4'));var router=express[_0x2b21('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2b21('0x6'));var interaction=require(_0x2b21('0x7'));var config=require(_0x2b21('0x8'));var controller=require('./setting.controller');router['get']('/',auth[_0x2b21('0x9')](),controller[_0x2b21('0xa')]);router[_0x2b21('0xb')](_0x2b21('0xc'),controller['getDate']);router[_0x2b21('0xb')](_0x2b21('0xd'),controller[_0x2b21('0xe')]);router[_0x2b21('0xb')](_0x2b21('0xf'),controller[_0x2b21('0x10')]);router[_0x2b21('0xb')](_0x2b21('0x11'),controller[_0x2b21('0x12')]);router[_0x2b21('0xb')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x2b21('0x13')]);router[_0x2b21('0xb')]('/:id/favicon',controller[_0x2b21('0x14')]);var upload=multer({'storage':multer[_0x2b21('0x15')]({'destination':function(_0x2ba9ed,_0xaeb5d5,_0x19cf75){_0x19cf75(null,path[_0x2b21('0x16')](config[_0x2b21('0x17')],_0x2b21('0x18')));},'filename':function(_0x52e309,_0x559194,_0x244da1){_0x244da1(null,util[_0x2b21('0x19')]('%s%s',_0x2b21('0x1a'),path['extname'](_0x559194[_0x2b21('0x1b')])));}})});router[_0x2b21('0x1c')]('/:id/logo',upload[_0x2b21('0x1d')](_0x2b21('0x1e')),controller[_0x2b21('0x1f')]);var upload=multer({'storage':multer[_0x2b21('0x15')]({'destination':function(_0x4a78d4,_0x4bc899,_0x446b4d){_0x446b4d(null,path[_0x2b21('0x16')](config['root'],_0x2b21('0x18')));},'filename':function(_0x19e4ec,_0x23b255,_0x552240){_0x552240(null,util['format'](_0x2b21('0x20'),'logologin',path[_0x2b21('0x21')](_0x23b255[_0x2b21('0x1b')])));}})});router['post']('/:id/logo_login',upload[_0x2b21('0x1d')](_0x2b21('0x1e')),controller[_0x2b21('0x22')]);var upload=multer({'storage':multer[_0x2b21('0x15')]({'destination':function(_0x50fde5,_0x556c98,_0xc3a744){_0xc3a744(null,path[_0x2b21('0x16')](config[_0x2b21('0x17')],_0x2b21('0x18')));},'filename':function(_0x48533a,_0x179afd,_0x421336){_0x421336(null,util[_0x2b21('0x19')]('%s%s',_0x2b21('0x23'),path['extname'](_0x179afd[_0x2b21('0x1b')])));}})});router['post'](_0x2b21('0x24'),upload[_0x2b21('0x1d')](_0x2b21('0x1e')),controller[_0x2b21('0x25')]);var upload=multer({'storage':multer[_0x2b21('0x15')]({'destination':function(_0x4dde8d,_0x2b0d73,_0x28511a){_0x28511a(null,path[_0x2b21('0x16')](config[_0x2b21('0x17')],_0x2b21('0x18')));},'filename':function(_0x5d3e66,_0x5c1989,_0x36ff1e){_0x36ff1e(null,util[_0x2b21('0x19')]('%s%s','favicon',path[_0x2b21('0x21')](_0x5c1989[_0x2b21('0x1b')])));}})});router[_0x2b21('0x1c')](_0x2b21('0x26'),upload['single']('file'),controller['addFavicon']);router[_0x2b21('0x27')](_0x2b21('0xd'),auth[_0x2b21('0x9')](),controller[_0x2b21('0x28')]);module[_0x2b21('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 0ef6a59..30caf7a 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3022b6,_0x5d0530){var _0x4b592=function(_0x261211){while(--_0x261211){_0x3022b6['push'](_0x3022b6['shift']());}};_0x4b592(++_0x5d0530);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x472e0a,_0x3c0707){var _0x3942f=function(_0xf5a62f){while(--_0xf5a62f){_0x472e0a['push'](_0x472e0a['shift']());}};_0x3942f(++_0x3c0707);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 7c65fde..f22b1c6 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 _0xcb06=['fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','Setting','includeAll','include','findAll','rows','params','find','addLogo','file','filename','body','logo','addLogoLogin','getLogo','loginLogo','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','download','getLogoLogin','getLicense','preferred','defaultPreferred','default_loginLogo.svg','\x20not\x20found','addPreferred','getPreferred','server/files/images/logos','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','sendStatus','stack','name','send','index','rawAttributes'];(function(_0x5ccffa,_0x372061){var _0x23c9f2=function(_0x237fb7){while(--_0x237fb7){_0x5ccffa['push'](_0x5ccffa['shift']());}};_0x23c9f2(++_0x372061);}(_0xcb06,0x127));var _0x6cb0=function(_0x1f55f3,_0xac0628){_0x1f55f3=_0x1f55f3-0x0;var _0x456d70=_0xcb06[_0x1f55f3];return _0x456d70;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6cb0('0x0'));var rp=require('request-promise');var moment=require(_0x6cb0('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6cb0('0x2'));var util=require('util');var path=require(_0x6cb0('0x3'));var sox=require('sox');var csv=require(_0x6cb0('0x4'));var ejs=require(_0x6cb0('0x5'));var fs=require('fs');var fs_extra=require(_0x6cb0('0x6'));var _=require(_0x6cb0('0x7'));var squel=require(_0x6cb0('0x8'));var crypto=require(_0x6cb0('0x9'));var jsforce=require(_0x6cb0('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6cb0('0x4'));var querystring=require(_0x6cb0('0xb'));var Papa=require(_0x6cb0('0xc'));var Redis=require(_0x6cb0('0xd'));var authService=require(_0x6cb0('0xe'));var qs=require(_0x6cb0('0xf'));var as=require(_0x6cb0('0x10'));var hardwareService=require(_0x6cb0('0x11'));var logger=require(_0x6cb0('0x12'))(_0x6cb0('0x13'));var utils=require(_0x6cb0('0x14'));var config=require(_0x6cb0('0x15'));var licenseUtil=require(_0x6cb0('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6cb0('0x17'));var client=jayson[_0x6cb0('0x18')][_0x6cb0('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3c2c2a,_0x53a11d,_0x37409f,_0x3b2b85){return new BPromise(function(_0x362fd4,_0x308793){var _0x307d33=_0x3b2b85||client;return _0x307d33[_0x6cb0('0x1a')](_0x3c2c2a,_0x37409f)['then'](function(_0x7609a){logger[_0x6cb0('0x1b')](_0x6cb0('0x1c'),_0x53a11d,'request\x20sent');logger[_0x6cb0('0x1d')](_0x6cb0('0x1e'),_0x53a11d,_0x6cb0('0x1f'),JSON[_0x6cb0('0x20')](_0x7609a));if(_0x7609a[_0x6cb0('0x21')]){if(_0x7609a[_0x6cb0('0x21')]['code']===0x1f4){logger[_0x6cb0('0x21')](_0x6cb0('0x1c'),_0x53a11d,_0x7609a[_0x6cb0('0x21')][_0x6cb0('0x22')]);return _0x308793(_0x7609a[_0x6cb0('0x21')][_0x6cb0('0x22')]);}logger['error']('Setting,\x20%s,\x20%s',_0x53a11d,_0x7609a[_0x6cb0('0x21')][_0x6cb0('0x22')]);return _0x362fd4(_0x7609a['error']['message']);}else{logger[_0x6cb0('0x1b')](_0x6cb0('0x1c'),_0x53a11d,_0x6cb0('0x1f'));_0x362fd4(_0x7609a['result'][_0x6cb0('0x22')]);}})[_0x6cb0('0x23')](function(_0x3d673e){logger['error'](_0x6cb0('0x1c'),_0x53a11d,_0x3d673e);_0x308793(_0x3d673e);});});}function respondWithStatusCode(_0x3182c0,_0x412eea){_0x412eea=_0x412eea||0xcc;return function(_0x3402b3){if(_0x3402b3){return _0x3182c0['sendStatus'](_0x412eea);}return _0x3182c0[_0x6cb0('0x24')](_0x412eea)[_0x6cb0('0x25')]();};}function respondWithResult(_0x4302e0,_0x4dfe76){_0x4dfe76=_0x4dfe76||0xc8;return function(_0x2c5d78){if(_0x2c5d78){return _0x4302e0[_0x6cb0('0x24')](_0x4dfe76)[_0x6cb0('0x26')](_0x2c5d78);}};}function respondWithFilteredResult(_0x328afd,_0x10e780){return function(_0x23f25b){if(_0x23f25b){var _0x4953d5=typeof _0x10e780[_0x6cb0('0x27')]===_0x6cb0('0x28')&&typeof _0x10e780[_0x6cb0('0x29')]===_0x6cb0('0x28');var _0x5be66e=_0x23f25b[_0x6cb0('0x2a')];var _0x17e55a=_0x4953d5?0x0:_0x10e780['offset'];var _0x838416=_0x4953d5?_0x23f25b['count']:_0x10e780[_0x6cb0('0x27')]+_0x10e780[_0x6cb0('0x29')];var _0x3e1e17;if(_0x838416>=_0x5be66e){_0x838416=_0x5be66e;_0x3e1e17=0xc8;}else{_0x3e1e17=0xce;}_0x328afd[_0x6cb0('0x24')](_0x3e1e17);return _0x328afd[_0x6cb0('0x2b')](_0x6cb0('0x2c'),_0x17e55a+'-'+_0x838416+'/'+_0x5be66e)[_0x6cb0('0x26')](_0x23f25b);}return null;};}function patchUpdates(_0x57a44d){return function(_0x13e9fc){try{jsonpatch['apply'](_0x13e9fc,_0x57a44d,!![]);}catch(_0x4c797e){return BPromise[_0x6cb0('0x2d')](_0x4c797e);}return _0x13e9fc['save']();};}function saveUpdates(_0x37f724,_0x62c91b){return function(_0x3f4b65){if(_0x3f4b65){return _0x3f4b65['update'](_0x37f724)[_0x6cb0('0x2e')](function(_0x56d720){return _0x56d720;});}return null;};}function removeEntity(_0x23d05d,_0x22370d){return function(_0x4a46be){if(_0x4a46be){return _0x4a46be['destroy']()[_0x6cb0('0x2e')](function(){_0x23d05d[_0x6cb0('0x24')](0xcc)[_0x6cb0('0x25')]();});}};}function handleEntityNotFound(_0x5c9867,_0x546d51){return function(_0x24a2a7){if(!_0x24a2a7){_0x5c9867[_0x6cb0('0x2f')](0x194);}return _0x24a2a7;};}function handleError(_0x260260,_0xf78022){_0xf78022=_0xf78022||0x1f4;return function(_0x588ca0){logger[_0x6cb0('0x21')](_0x588ca0[_0x6cb0('0x30')]);if(_0x588ca0['name']){delete _0x588ca0[_0x6cb0('0x31')];}_0x260260[_0x6cb0('0x24')](_0xf78022)[_0x6cb0('0x32')](_0x588ca0);};}exports[_0x6cb0('0x33')]=function(_0x26f2e8,_0xd8bf6c){var _0x3bc191={},_0xb68de7={},_0x3076fc={'count':0x0,'rows':[]};var _0x1e7d28=_['map'](db['Setting'][_0x6cb0('0x34')],function(_0x447d3b){return{'name':_0x447d3b[_0x6cb0('0x35')],'type':_0x447d3b[_0x6cb0('0x36')][_0x6cb0('0x37')]};});_0xb68de7['model']=_[_0x6cb0('0x38')](_0x1e7d28,_0x6cb0('0x31'));_0xb68de7[_0x6cb0('0x39')]=_[_0x6cb0('0x3a')](_0x26f2e8[_0x6cb0('0x39')]);_0xb68de7[_0x6cb0('0x3b')]=_[_0x6cb0('0x3c')](_0xb68de7[_0x6cb0('0x3d')],_0xb68de7['query']);_0x3bc191[_0x6cb0('0x3e')]=_[_0x6cb0('0x3c')](_0xb68de7[_0x6cb0('0x3d')],qs[_0x6cb0('0x3f')](_0x26f2e8[_0x6cb0('0x39')][_0x6cb0('0x3f')]));_0x3bc191[_0x6cb0('0x3e')]=_0x3bc191[_0x6cb0('0x3e')][_0x6cb0('0x40')]?_0x3bc191['attributes']:_0xb68de7[_0x6cb0('0x3d')];if(!_0x26f2e8[_0x6cb0('0x39')][_0x6cb0('0x41')]('nolimit')){_0x3bc191[_0x6cb0('0x29')]=qs['limit'](_0x26f2e8['query'][_0x6cb0('0x29')]);_0x3bc191[_0x6cb0('0x27')]=qs[_0x6cb0('0x27')](_0x26f2e8[_0x6cb0('0x39')][_0x6cb0('0x27')]);}_0x3bc191[_0x6cb0('0x42')]=qs['sort'](_0x26f2e8[_0x6cb0('0x39')]['sort']);_0x3bc191[_0x6cb0('0x43')]=qs['filters'](_[_0x6cb0('0x44')](_0x26f2e8['query'],_0xb68de7[_0x6cb0('0x3b')]),_0x1e7d28);if(_0x26f2e8[_0x6cb0('0x39')][_0x6cb0('0x45')]){_0x3bc191[_0x6cb0('0x43')]=_[_0x6cb0('0x46')](_0x3bc191[_0x6cb0('0x43')],{'$or':_['map'](_0x1e7d28,function(_0x2c5f28){if(_0x2c5f28[_0x6cb0('0x36')]!=='VIRTUAL'){var _0x4a7886={};_0x4a7886[_0x2c5f28[_0x6cb0('0x31')]]={'$like':'%'+_0x26f2e8[_0x6cb0('0x39')][_0x6cb0('0x45')]+'%'};return _0x4a7886;}})});}_0x3bc191=_['merge']({},_0x3bc191,_0x26f2e8[_0x6cb0('0x47')]);var _0x384cd6={'where':_0x3bc191[_0x6cb0('0x43')]};return db[_0x6cb0('0x48')][_0x6cb0('0x2a')](_0x384cd6)[_0x6cb0('0x2e')](function(_0x304bf3){_0x3076fc['count']=_0x304bf3;if(_0x26f2e8[_0x6cb0('0x39')][_0x6cb0('0x49')]){_0x3bc191[_0x6cb0('0x4a')]=[{'all':!![]}];}return db[_0x6cb0('0x48')][_0x6cb0('0x4b')](_0x3bc191);})[_0x6cb0('0x2e')](function(_0x495011){_0x3076fc[_0x6cb0('0x4c')]=_0x495011;return _0x3076fc;})[_0x6cb0('0x2e')](respondWithFilteredResult(_0xd8bf6c,_0x3bc191))[_0x6cb0('0x23')](handleError(_0xd8bf6c,null));};exports['show']=function(_0x5478e2,_0x10bf91){var _0xb3ff27={'raw':![],'where':{'id':_0x5478e2[_0x6cb0('0x4d')]['id']}},_0x5331c7={};_0x5331c7[_0x6cb0('0x3d')]=_[_0x6cb0('0x3a')](db[_0x6cb0('0x48')][_0x6cb0('0x34')]);_0x5331c7['query']=_[_0x6cb0('0x3a')](_0x5478e2[_0x6cb0('0x39')]);_0x5331c7[_0x6cb0('0x3b')]=_[_0x6cb0('0x3c')](_0x5331c7[_0x6cb0('0x3d')],_0x5331c7[_0x6cb0('0x39')]);_0xb3ff27[_0x6cb0('0x3e')]=_[_0x6cb0('0x3c')](_0x5331c7['model'],qs[_0x6cb0('0x3f')](_0x5478e2[_0x6cb0('0x39')][_0x6cb0('0x3f')]));_0xb3ff27[_0x6cb0('0x3e')]=_0xb3ff27[_0x6cb0('0x3e')][_0x6cb0('0x40')]?_0xb3ff27[_0x6cb0('0x3e')]:_0x5331c7[_0x6cb0('0x3d')];if(_0x5478e2[_0x6cb0('0x39')]['includeAll']){_0xb3ff27['include']=[{'all':!![]}];}_0xb3ff27=_[_0x6cb0('0x46')]({},_0xb3ff27,_0x5478e2[_0x6cb0('0x47')]);return db['Setting']['find'](_0xb3ff27)['then'](handleEntityNotFound(_0x10bf91,null))[_0x6cb0('0x2e')](respondWithResult(_0x10bf91,null))['catch'](handleError(_0x10bf91,null));};exports['update']=function(_0x480683,_0x8c8d0c){if(_0x480683['body']['id']){delete _0x480683['body']['id'];}return db[_0x6cb0('0x48')][_0x6cb0('0x4e')]({'where':{'id':_0x480683[_0x6cb0('0x4d')]['id']}})[_0x6cb0('0x2e')](handleEntityNotFound(_0x8c8d0c,null))[_0x6cb0('0x2e')](saveUpdates(_0x480683['body'],null))[_0x6cb0('0x2e')](respondWithResult(_0x8c8d0c,null))[_0x6cb0('0x23')](handleError(_0x8c8d0c,null));};exports[_0x6cb0('0x4f')]=function(_0x31e754,_0x454238,_0x286ad9){if(_0x31e754[_0x6cb0('0x50')]&&_0x31e754[_0x6cb0('0x50')][_0x6cb0('0x51')]){_0x31e754[_0x6cb0('0x52')][_0x6cb0('0x53')]=_0x31e754[_0x6cb0('0x50')][_0x6cb0('0x51')];}return db['Setting'][_0x6cb0('0x4e')]({'where':{'id':_0x31e754[_0x6cb0('0x4d')]['id']}})[_0x6cb0('0x2e')](handleEntityNotFound(_0x454238,null))[_0x6cb0('0x2e')](saveUpdates(_0x31e754['body'],null))[_0x6cb0('0x2e')](respondWithResult(_0x454238,null))[_0x6cb0('0x23')](handleError(_0x454238,null));};exports[_0x6cb0('0x54')]=function(_0x11283c,_0x3d5081,_0x255110){if(_0x11283c[_0x6cb0('0x50')]&&_0x11283c[_0x6cb0('0x50')][_0x6cb0('0x51')]){_0x11283c[_0x6cb0('0x52')]['loginLogo']=_0x11283c[_0x6cb0('0x50')][_0x6cb0('0x51')];}return db['Setting']['find']({'where':{'id':_0x11283c['params']['id']}})[_0x6cb0('0x2e')](handleEntityNotFound(_0x3d5081,null))[_0x6cb0('0x2e')](saveUpdates(_0x11283c[_0x6cb0('0x52')],null))[_0x6cb0('0x2e')](respondWithResult(_0x3d5081,null))[_0x6cb0('0x23')](handleError(_0x3d5081,null));};var utilLicense=require(_0x6cb0('0x16'));exports[_0x6cb0('0x55')]=function(_0x5ec5aa,_0x455278,_0x3f0588){var _0x529395='server/files/images/logos';var _0x5736cd={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x563c63){if(_0x563c63){_0x5736cd=_0x563c63;}return db[_0x6cb0('0x48')][_0x6cb0('0x4e')]({'where':{'id':_0x5ec5aa['params']['id']},'attributes':[_0x6cb0('0x53'),_0x6cb0('0x56'),'preferred',_0x6cb0('0x57'),_0x6cb0('0x58'),_0x6cb0('0x59'),'defaultPreferred',_0x6cb0('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x455278,null))[_0x6cb0('0x2e')](function(_0x1c70dd){if(_0x1c70dd){var _0x16e640=_0x1c70dd[_0x6cb0('0x53')]&&fs['existsSync'](path[_0x6cb0('0x5b')](config[_0x6cb0('0x5c')],_0x529395,_[_0x6cb0('0x5d')](_0x1c70dd['logo'])))?path['join'](config[_0x6cb0('0x5c')],_0x529395,_[_0x6cb0('0x5d')](_0x1c70dd[_0x6cb0('0x53')])):path['join'](config['root'],_0x529395,_[_0x6cb0('0x5d')](_0x6cb0('0x5e')));var _0x20d78f=_0x6cb0('0x5f')+_[_0x6cb0('0x60')](_0x6cb0('0x53'));if(_0x1c70dd[_0x20d78f]||!_0x5736cd[_0x6cb0('0x61')]){_0x16e640=path[_0x6cb0('0x5b')](config[_0x6cb0('0x5c')],_0x529395,_['toLower']('default_logo.svg'));}if(!fs[_0x6cb0('0x62')](_0x16e640)){throw new db[(_0x6cb0('0x63'))][(_0x6cb0('0x64'))](_[_0x6cb0('0x60')](_0x6cb0('0x53'))+'\x20not\x20found');}return _0x455278[_0x6cb0('0x65')](_0x16e640);}})[_0x6cb0('0x23')](handleError(_0x455278,null));};var utilLicense=require(_0x6cb0('0x16'));exports[_0x6cb0('0x66')]=function(_0x250d3b,_0x386127,_0x3efe68){var _0x426003='server/files/images/logos';var _0x59390a={'custom':![]};return utilLicense[_0x6cb0('0x67')]()[_0x6cb0('0x2e')](function(_0x31b07a){if(_0x31b07a){_0x59390a=_0x31b07a;}return db['Setting']['find']({'where':{'id':_0x250d3b['params']['id']},'attributes':['logo','loginLogo',_0x6cb0('0x68'),_0x6cb0('0x57'),_0x6cb0('0x58'),'defaultLoginLogo',_0x6cb0('0x69'),_0x6cb0('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x386127,null))[_0x6cb0('0x2e')](function(_0x709772){if(_0x709772){var _0x35ecf9=_0x709772[_0x6cb0('0x56')]&&fs[_0x6cb0('0x62')](path[_0x6cb0('0x5b')](config['root'],_0x426003,_['toLower'](_0x709772['loginLogo'])))?path['join'](config[_0x6cb0('0x5c')],_0x426003,_['toLower'](_0x709772[_0x6cb0('0x56')])):path['join'](config[_0x6cb0('0x5c')],_0x426003,_[_0x6cb0('0x5d')](_0x6cb0('0x6a')));var _0x2462db=_0x6cb0('0x5f')+_[_0x6cb0('0x60')](_0x6cb0('0x56'));if(_0x709772[_0x2462db]||!_0x59390a[_0x6cb0('0x61')]){_0x35ecf9=path[_0x6cb0('0x5b')](config[_0x6cb0('0x5c')],_0x426003,_[_0x6cb0('0x5d')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x35ecf9)){throw new db['Sequelize']['ValidationError'](_[_0x6cb0('0x60')]('loginLogo')+_0x6cb0('0x6b'));}return _0x386127[_0x6cb0('0x65')](_0x35ecf9);}})[_0x6cb0('0x23')](handleError(_0x386127,null));};exports['gdpr']=function(_0x18d748,_0x5e880a){return db[_0x6cb0('0x48')]['find']({'where':{'id':_0x18d748[_0x6cb0('0x4d')]['id']},'attributes':['securePassword']})[_0x6cb0('0x2e')](respondWithResult(_0x5e880a,null))[_0x6cb0('0x23')](handleError(_0x5e880a,null));};exports[_0x6cb0('0x6c')]=function(_0x28fb20,_0x2a07cd,_0x59e34f){if(_0x28fb20['file']&&_0x28fb20[_0x6cb0('0x50')][_0x6cb0('0x51')]){_0x28fb20[_0x6cb0('0x52')][_0x6cb0('0x68')]=_0x28fb20[_0x6cb0('0x50')][_0x6cb0('0x51')];}return db[_0x6cb0('0x48')][_0x6cb0('0x4e')]({'where':{'id':_0x28fb20['params']['id']}})[_0x6cb0('0x2e')](handleEntityNotFound(_0x2a07cd,null))['then'](saveUpdates(_0x28fb20['body'],null))['then'](respondWithResult(_0x2a07cd,null))[_0x6cb0('0x23')](handleError(_0x2a07cd,null));};var utilLicense=require(_0x6cb0('0x16'));exports[_0x6cb0('0x6d')]=function(_0x3acba1,_0x5b8026,_0x130e82){var _0x49f408=_0x6cb0('0x6e');var _0x522f8b={'custom':![]};return utilLicense[_0x6cb0('0x67')]()[_0x6cb0('0x2e')](function(_0x36cbf6){if(_0x36cbf6){_0x522f8b=_0x36cbf6;}return db['Setting'][_0x6cb0('0x4e')]({'where':{'id':_0x3acba1[_0x6cb0('0x4d')]['id']},'attributes':['logo',_0x6cb0('0x56'),'preferred',_0x6cb0('0x57'),'defaultLogo','defaultLoginLogo',_0x6cb0('0x69'),_0x6cb0('0x5a')],'raw':!![]});})[_0x6cb0('0x2e')](handleEntityNotFound(_0x5b8026,null))[_0x6cb0('0x2e')](function(_0x151597){if(_0x151597){var _0xb5d208=_0x151597[_0x6cb0('0x68')]&&fs[_0x6cb0('0x62')](path[_0x6cb0('0x5b')](config[_0x6cb0('0x5c')],_0x49f408,_[_0x6cb0('0x5d')](_0x151597[_0x6cb0('0x68')])))?path[_0x6cb0('0x5b')](config[_0x6cb0('0x5c')],_0x49f408,_[_0x6cb0('0x5d')](_0x151597[_0x6cb0('0x68')])):path[_0x6cb0('0x5b')](config[_0x6cb0('0x5c')],_0x49f408,_[_0x6cb0('0x5d')]('default_preferred.png'));var _0x4f1006=_0x6cb0('0x5f')+_[_0x6cb0('0x60')](_0x6cb0('0x68'));if(_0x151597[_0x4f1006]||!_0x522f8b[_0x6cb0('0x61')]||!_0x522f8b[_0x6cb0('0x68')]){_0xb5d208=path[_0x6cb0('0x5b')](config['root'],_0x49f408,_['toLower']('default_preferred.png'));}if(!fs[_0x6cb0('0x62')](_0xb5d208)){throw new db[(_0x6cb0('0x63'))][(_0x6cb0('0x64'))](_[_0x6cb0('0x60')]('preferred')+'\x20not\x20found');}return _0x5b8026[_0x6cb0('0x65')](_0xb5d208);}})[_0x6cb0('0x23')](handleError(_0x5b8026,null));};exports['addFavicon']=function(_0x14effc,_0x229308,_0x107dd4){if(_0x14effc[_0x6cb0('0x50')]&&_0x14effc[_0x6cb0('0x50')][_0x6cb0('0x51')]){_0x14effc[_0x6cb0('0x52')][_0x6cb0('0x57')]=_0x14effc[_0x6cb0('0x50')][_0x6cb0('0x51')];}return db[_0x6cb0('0x48')][_0x6cb0('0x4e')]({'where':{'id':_0x14effc[_0x6cb0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x229308,null))[_0x6cb0('0x2e')](saveUpdates(_0x14effc[_0x6cb0('0x52')],null))['then'](respondWithResult(_0x229308,null))[_0x6cb0('0x23')](handleError(_0x229308,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x1c5251,_0x1d95cd,_0x8f379){var _0x1919f3=_0x6cb0('0x6e');var _0x5f08a2={'custom':![]};return utilLicense[_0x6cb0('0x67')]()[_0x6cb0('0x2e')](function(_0x5188a2){if(_0x5188a2){_0x5f08a2=_0x5188a2;}return db[_0x6cb0('0x48')][_0x6cb0('0x4e')]({'where':{'id':_0x1c5251[_0x6cb0('0x4d')]['id']},'attributes':[_0x6cb0('0x53'),_0x6cb0('0x56'),'preferred','favicon',_0x6cb0('0x58'),'defaultLoginLogo',_0x6cb0('0x69'),_0x6cb0('0x5a')],'raw':!![]});})[_0x6cb0('0x2e')](handleEntityNotFound(_0x1d95cd,null))[_0x6cb0('0x2e')](function(_0x2215d4){if(_0x2215d4){var _0x21f67f=_0x2215d4['favicon']&&fs['existsSync'](path['join'](config['root'],_0x1919f3,_[_0x6cb0('0x5d')](_0x2215d4[_0x6cb0('0x57')])))?path['join'](config['root'],_0x1919f3,_['toLower'](_0x2215d4[_0x6cb0('0x57')])):path[_0x6cb0('0x5b')](config[_0x6cb0('0x5c')],_0x1919f3,_[_0x6cb0('0x5d')](_0x6cb0('0x6f')));var _0x1678d2=_0x6cb0('0x5f')+_[_0x6cb0('0x60')](_0x6cb0('0x57'));if(_0x2215d4[_0x1678d2]||!_0x5f08a2['custom']){_0x21f67f=path[_0x6cb0('0x5b')](config[_0x6cb0('0x5c')],_0x1919f3,_['toLower'](_0x6cb0('0x6f')));}if(!fs[_0x6cb0('0x62')](_0x21f67f)){throw new db[(_0x6cb0('0x63'))][(_0x6cb0('0x64'))](_[_0x6cb0('0x60')](_0x6cb0('0x57'))+'\x20not\x20found');}return _0x1d95cd[_0x6cb0('0x65')](_0x21f67f);}})['catch'](handleError(_0x1d95cd,null));};exports[_0x6cb0('0x70')]=function(_0x2c1e8c,_0x11384b){var _0x1952d4={'offset':moment()[_0x6cb0('0x71')]()};_0x1952d4['now']=moment()[_0x6cb0('0x71')](_0x1952d4[_0x6cb0('0x27')])[_0x6cb0('0x72')](_0x6cb0('0x73'));return _0x11384b[_0x6cb0('0x24')](0xc8)[_0x6cb0('0x32')](_0x1952d4);}; \ No newline at end of file +var _0x3dc8=['catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Setting','includeAll','include','findAll','rows','length','find','body','params','filename','logo','addLogoLogin','file','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','getLogoLogin','getLicense','defaultPreferred','defaultFavicon','ValidationError','addPreferred','getPreferred','default_preferred.png','download','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result'];(function(_0xe88157,_0x965589){var _0xa9cf33=function(_0x222d32){while(--_0x222d32){_0xe88157['push'](_0xe88157['shift']());}};_0xa9cf33(++_0x965589);}(_0x3dc8,0x148));var _0x83dc=function(_0x4918e2,_0x2ab8c1){_0x4918e2=_0x4918e2-0x0;var _0x1dcc31=_0x3dc8[_0x4918e2];return _0x1dcc31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83dc('0x0'));var zipdir=require(_0x83dc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x83dc('0x2'));var moment=require(_0x83dc('0x3'));var BPromise=require(_0x83dc('0x4'));var Mustache=require('mustache');var util=require(_0x83dc('0x5'));var path=require(_0x83dc('0x6'));var sox=require(_0x83dc('0x7'));var csv=require('to-csv');var ejs=require(_0x83dc('0x8'));var fs=require('fs');var fs_extra=require(_0x83dc('0x9'));var _=require(_0x83dc('0xa'));var squel=require(_0x83dc('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x83dc('0xc'));var toCsv=require(_0x83dc('0xd'));var querystring=require('querystring');var Papa=require(_0x83dc('0xe'));var Redis=require(_0x83dc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x83dc('0x10'));var as=require(_0x83dc('0x11'));var hardwareService=require(_0x83dc('0x12'));var logger=require(_0x83dc('0x13'))('api');var utils=require(_0x83dc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x83dc('0x15'));var db=require(_0x83dc('0x16'))['db'];var jayson=require(_0x83dc('0x17'));var client=jayson['client'][_0x83dc('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1ef092,_0x1ee100,_0x276aa2,_0x5abf66){return new BPromise(function(_0x36d620,_0x3f1b64){var _0x53f912=_0x5abf66||client;return _0x53f912['request'](_0x1ef092,_0x276aa2)['then'](function(_0x559347){logger['info']('Setting,\x20%s,\x20%s',_0x1ee100,_0x83dc('0x19'));logger[_0x83dc('0x1a')](_0x83dc('0x1b'),_0x1ee100,_0x83dc('0x19'),JSON[_0x83dc('0x1c')](_0x559347));if(_0x559347[_0x83dc('0x1d')]){if(_0x559347['error'][_0x83dc('0x1e')]===0x1f4){logger[_0x83dc('0x1d')](_0x83dc('0x1f'),_0x1ee100,_0x559347['error'][_0x83dc('0x20')]);return _0x3f1b64(_0x559347['error'][_0x83dc('0x20')]);}logger[_0x83dc('0x1d')](_0x83dc('0x1f'),_0x1ee100,_0x559347[_0x83dc('0x1d')][_0x83dc('0x20')]);return _0x36d620(_0x559347[_0x83dc('0x1d')][_0x83dc('0x20')]);}else{logger[_0x83dc('0x21')]('Setting,\x20%s,\x20%s',_0x1ee100,_0x83dc('0x19'));_0x36d620(_0x559347[_0x83dc('0x22')][_0x83dc('0x20')]);}})[_0x83dc('0x23')](function(_0x206200){logger['error'](_0x83dc('0x1f'),_0x1ee100,_0x206200);_0x3f1b64(_0x206200);});});}function respondWithStatusCode(_0x4745df,_0x2ab7af){_0x2ab7af=_0x2ab7af||0xcc;return function(_0x4a0eb7){if(_0x4a0eb7){return _0x4745df[_0x83dc('0x24')](_0x2ab7af);}return _0x4745df[_0x83dc('0x25')](_0x2ab7af)[_0x83dc('0x26')]();};}function respondWithResult(_0xb413e4,_0x302334){_0x302334=_0x302334||0xc8;return function(_0x5b68a9){if(_0x5b68a9){return _0xb413e4[_0x83dc('0x25')](_0x302334)[_0x83dc('0x27')](_0x5b68a9);}};}function respondWithFilteredResult(_0x27cd5e,_0x45a0d6){return function(_0x576672){if(_0x576672){var _0x313f16=typeof _0x45a0d6[_0x83dc('0x28')]===_0x83dc('0x29')&&typeof _0x45a0d6[_0x83dc('0x2a')]===_0x83dc('0x29');var _0x408d14=_0x576672[_0x83dc('0x2b')];var _0x6646f4=_0x313f16?0x0:_0x45a0d6[_0x83dc('0x28')];var _0x13d54d=_0x313f16?_0x576672[_0x83dc('0x2b')]:_0x45a0d6[_0x83dc('0x28')]+_0x45a0d6[_0x83dc('0x2a')];var _0x2a73ee;if(_0x13d54d>=_0x408d14){_0x13d54d=_0x408d14;_0x2a73ee=0xc8;}else{_0x2a73ee=0xce;}_0x27cd5e['status'](_0x2a73ee);return _0x27cd5e['set'](_0x83dc('0x2c'),_0x6646f4+'-'+_0x13d54d+'/'+_0x408d14)[_0x83dc('0x27')](_0x576672);}return null;};}function patchUpdates(_0x1284fa){return function(_0xeb7a26){try{jsonpatch[_0x83dc('0x2d')](_0xeb7a26,_0x1284fa,!![]);}catch(_0x3f131e){return BPromise[_0x83dc('0x2e')](_0x3f131e);}return _0xeb7a26[_0x83dc('0x2f')]();};}function saveUpdates(_0x1150db,_0x49f290){return function(_0x2a2cfa){if(_0x2a2cfa){return _0x2a2cfa[_0x83dc('0x30')](_0x1150db)[_0x83dc('0x31')](function(_0x5701a2){return _0x5701a2;});}return null;};}function removeEntity(_0x2f8110,_0x38f8da){return function(_0x106115){if(_0x106115){return _0x106115[_0x83dc('0x32')]()[_0x83dc('0x31')](function(){_0x2f8110['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58bea6,_0x1021ad){return function(_0x4b20bf){if(!_0x4b20bf){_0x58bea6[_0x83dc('0x24')](0x194);}return _0x4b20bf;};}function handleError(_0x40d96c,_0x1a12cb){_0x1a12cb=_0x1a12cb||0x1f4;return function(_0x423978){logger[_0x83dc('0x1d')](_0x423978[_0x83dc('0x33')]);if(_0x423978[_0x83dc('0x34')]){delete _0x423978[_0x83dc('0x34')];}_0x40d96c[_0x83dc('0x25')](_0x1a12cb)[_0x83dc('0x35')](_0x423978);};}exports[_0x83dc('0x36')]=function(_0xc3f2c1,_0x1ae4b7){var _0x5d07c2={},_0x192fc5={},_0x172ee6={'count':0x0,'rows':[]};var _0xad55f8=_[_0x83dc('0x37')](db['Setting'][_0x83dc('0x38')],function(_0x4cf2ec){return{'name':_0x4cf2ec[_0x83dc('0x39')],'type':_0x4cf2ec[_0x83dc('0x3a')][_0x83dc('0x3b')]};});_0x192fc5['model']=_['map'](_0xad55f8,'name');_0x192fc5[_0x83dc('0x3c')]=_[_0x83dc('0x3d')](_0xc3f2c1['query']);_0x192fc5[_0x83dc('0x3e')]=_[_0x83dc('0x3f')](_0x192fc5['model'],_0x192fc5['query']);_0x5d07c2[_0x83dc('0x40')]=_['intersection'](_0x192fc5[_0x83dc('0x41')],qs[_0x83dc('0x42')](_0xc3f2c1[_0x83dc('0x3c')][_0x83dc('0x42')]));_0x5d07c2['attributes']=_0x5d07c2[_0x83dc('0x40')]['length']?_0x5d07c2['attributes']:_0x192fc5['model'];if(!_0xc3f2c1[_0x83dc('0x3c')][_0x83dc('0x43')](_0x83dc('0x44'))){_0x5d07c2[_0x83dc('0x2a')]=qs[_0x83dc('0x2a')](_0xc3f2c1[_0x83dc('0x3c')][_0x83dc('0x2a')]);_0x5d07c2[_0x83dc('0x28')]=qs[_0x83dc('0x28')](_0xc3f2c1[_0x83dc('0x3c')]['offset']);}_0x5d07c2[_0x83dc('0x45')]=qs[_0x83dc('0x46')](_0xc3f2c1['query']['sort']);_0x5d07c2['where']=qs[_0x83dc('0x3e')](_[_0x83dc('0x47')](_0xc3f2c1['query'],_0x192fc5[_0x83dc('0x3e')]),_0xad55f8);if(_0xc3f2c1[_0x83dc('0x3c')][_0x83dc('0x48')]){_0x5d07c2[_0x83dc('0x49')]=_[_0x83dc('0x4a')](_0x5d07c2[_0x83dc('0x49')],{'$or':_[_0x83dc('0x37')](_0xad55f8,function(_0x605ef3){if(_0x605ef3['type']!=='VIRTUAL'){var _0x2f49a0={};_0x2f49a0[_0x605ef3[_0x83dc('0x34')]]={'$like':'%'+_0xc3f2c1['query'][_0x83dc('0x48')]+'%'};return _0x2f49a0;}})});}_0x5d07c2=_['merge']({},_0x5d07c2,_0xc3f2c1[_0x83dc('0x4b')]);var _0x1b1f3f={'where':_0x5d07c2[_0x83dc('0x49')]};return db[_0x83dc('0x4c')][_0x83dc('0x2b')](_0x1b1f3f)[_0x83dc('0x31')](function(_0x28db39){_0x172ee6[_0x83dc('0x2b')]=_0x28db39;if(_0xc3f2c1[_0x83dc('0x3c')][_0x83dc('0x4d')]){_0x5d07c2[_0x83dc('0x4e')]=[{'all':!![]}];}return db[_0x83dc('0x4c')][_0x83dc('0x4f')](_0x5d07c2);})['then'](function(_0x302c2b){_0x172ee6[_0x83dc('0x50')]=_0x302c2b;return _0x172ee6;})[_0x83dc('0x31')](respondWithFilteredResult(_0x1ae4b7,_0x5d07c2))['catch'](handleError(_0x1ae4b7,null));};exports['show']=function(_0x43199c,_0x52435b){var _0x3ccb51={'raw':![],'where':{'id':_0x43199c['params']['id']}},_0x3e9d41={};_0x3e9d41[_0x83dc('0x41')]=_[_0x83dc('0x3d')](db[_0x83dc('0x4c')]['rawAttributes']);_0x3e9d41[_0x83dc('0x3c')]=_['keys'](_0x43199c['query']);_0x3e9d41[_0x83dc('0x3e')]=_[_0x83dc('0x3f')](_0x3e9d41[_0x83dc('0x41')],_0x3e9d41[_0x83dc('0x3c')]);_0x3ccb51[_0x83dc('0x40')]=_[_0x83dc('0x3f')](_0x3e9d41[_0x83dc('0x41')],qs[_0x83dc('0x42')](_0x43199c[_0x83dc('0x3c')][_0x83dc('0x42')]));_0x3ccb51[_0x83dc('0x40')]=_0x3ccb51[_0x83dc('0x40')][_0x83dc('0x51')]?_0x3ccb51['attributes']:_0x3e9d41['model'];if(_0x43199c['query'][_0x83dc('0x4d')]){_0x3ccb51[_0x83dc('0x4e')]=[{'all':!![]}];}_0x3ccb51=_[_0x83dc('0x4a')]({},_0x3ccb51,_0x43199c[_0x83dc('0x4b')]);return db[_0x83dc('0x4c')][_0x83dc('0x52')](_0x3ccb51)['then'](handleEntityNotFound(_0x52435b,null))[_0x83dc('0x31')](respondWithResult(_0x52435b,null))['catch'](handleError(_0x52435b,null));};exports[_0x83dc('0x30')]=function(_0x5be8a8,_0x50b86a){if(_0x5be8a8['body']['id']){delete _0x5be8a8[_0x83dc('0x53')]['id'];}return db[_0x83dc('0x4c')][_0x83dc('0x52')]({'where':{'id':_0x5be8a8[_0x83dc('0x54')]['id']}})[_0x83dc('0x31')](handleEntityNotFound(_0x50b86a,null))[_0x83dc('0x31')](saveUpdates(_0x5be8a8[_0x83dc('0x53')],null))[_0x83dc('0x31')](respondWithResult(_0x50b86a,null))[_0x83dc('0x23')](handleError(_0x50b86a,null));};exports['addLogo']=function(_0x1a2af6,_0x109c87,_0x47dd0f){if(_0x1a2af6['file']&&_0x1a2af6['file'][_0x83dc('0x55')]){_0x1a2af6[_0x83dc('0x53')][_0x83dc('0x56')]=_0x1a2af6['file'][_0x83dc('0x55')];}return db[_0x83dc('0x4c')][_0x83dc('0x52')]({'where':{'id':_0x1a2af6[_0x83dc('0x54')]['id']}})[_0x83dc('0x31')](handleEntityNotFound(_0x109c87,null))[_0x83dc('0x31')](saveUpdates(_0x1a2af6['body'],null))['then'](respondWithResult(_0x109c87,null))[_0x83dc('0x23')](handleError(_0x109c87,null));};exports[_0x83dc('0x57')]=function(_0x3e07a8,_0x4ab806,_0x6ed10c){if(_0x3e07a8[_0x83dc('0x58')]&&_0x3e07a8[_0x83dc('0x58')][_0x83dc('0x55')]){_0x3e07a8['body'][_0x83dc('0x59')]=_0x3e07a8['file']['filename'];}return db[_0x83dc('0x4c')]['find']({'where':{'id':_0x3e07a8[_0x83dc('0x54')]['id']}})[_0x83dc('0x31')](handleEntityNotFound(_0x4ab806,null))['then'](saveUpdates(_0x3e07a8['body'],null))[_0x83dc('0x31')](respondWithResult(_0x4ab806,null))['catch'](handleError(_0x4ab806,null));};var utilLicense=require(_0x83dc('0x15'));exports[_0x83dc('0x5a')]=function(_0x5cba47,_0x35b6b2,_0x539c57){var _0x41b8de=_0x83dc('0x5b');var _0x14adb7={'custom':![]};return utilLicense['getLicense']()[_0x83dc('0x31')](function(_0x1fd9e1){if(_0x1fd9e1){_0x14adb7=_0x1fd9e1;}return db[_0x83dc('0x4c')][_0x83dc('0x52')]({'where':{'id':_0x5cba47[_0x83dc('0x54')]['id']},'attributes':[_0x83dc('0x56'),'loginLogo',_0x83dc('0x5c'),_0x83dc('0x5d'),_0x83dc('0x5e'),_0x83dc('0x5f'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x83dc('0x31')](handleEntityNotFound(_0x35b6b2,null))['then'](function(_0x2247e0){if(_0x2247e0){var _0x1cc2de=_0x2247e0[_0x83dc('0x56')]&&fs[_0x83dc('0x60')](path['join'](config[_0x83dc('0x61')],_0x41b8de,_[_0x83dc('0x62')](_0x2247e0['logo'])))?path['join'](config[_0x83dc('0x61')],_0x41b8de,_[_0x83dc('0x62')](_0x2247e0['logo'])):path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x41b8de,_[_0x83dc('0x62')](_0x83dc('0x64')));var _0x13982e=_0x83dc('0x65')+_[_0x83dc('0x66')](_0x83dc('0x56'));if(_0x2247e0[_0x13982e]||!_0x14adb7[_0x83dc('0x67')]){_0x1cc2de=path[_0x83dc('0x63')](config['root'],_0x41b8de,_[_0x83dc('0x62')](_0x83dc('0x64')));}if(!fs['existsSync'](_0x1cc2de)){throw new db[(_0x83dc('0x68'))]['ValidationError'](_[_0x83dc('0x66')]('logo')+_0x83dc('0x69'));}return _0x35b6b2['download'](_0x1cc2de);}})['catch'](handleError(_0x35b6b2,null));};var utilLicense=require(_0x83dc('0x15'));exports[_0x83dc('0x6a')]=function(_0x1203d8,_0x15ccde,_0xddbec8){var _0x42e845=_0x83dc('0x5b');var _0x2f8ae6={'custom':![]};return utilLicense[_0x83dc('0x6b')]()[_0x83dc('0x31')](function(_0x59ddeb){if(_0x59ddeb){_0x2f8ae6=_0x59ddeb;}return db[_0x83dc('0x4c')][_0x83dc('0x52')]({'where':{'id':_0x1203d8[_0x83dc('0x54')]['id']},'attributes':[_0x83dc('0x56'),'loginLogo',_0x83dc('0x5c'),_0x83dc('0x5d'),_0x83dc('0x5e'),'defaultLoginLogo',_0x83dc('0x6c'),_0x83dc('0x6d')],'raw':!![]});})[_0x83dc('0x31')](handleEntityNotFound(_0x15ccde,null))[_0x83dc('0x31')](function(_0xb92258){if(_0xb92258){var _0x4c939b=_0xb92258['loginLogo']&&fs['existsSync'](path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x42e845,_[_0x83dc('0x62')](_0xb92258[_0x83dc('0x59')])))?path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x42e845,_['toLower'](_0xb92258['loginLogo'])):path['join'](config[_0x83dc('0x61')],_0x42e845,_['toLower']('default_loginLogo.svg'));var _0x190cce=_0x83dc('0x65')+_[_0x83dc('0x66')]('loginLogo');if(_0xb92258[_0x190cce]||!_0x2f8ae6[_0x83dc('0x67')]){_0x4c939b=path[_0x83dc('0x63')](config['root'],_0x42e845,_[_0x83dc('0x62')]('default_loginLogo.svg'));}if(!fs[_0x83dc('0x60')](_0x4c939b)){throw new db[(_0x83dc('0x68'))][(_0x83dc('0x6e'))](_[_0x83dc('0x66')](_0x83dc('0x59'))+_0x83dc('0x69'));}return _0x15ccde['download'](_0x4c939b);}})[_0x83dc('0x23')](handleError(_0x15ccde,null));};exports['gdpr']=function(_0x3f8826,_0x19907d){return db[_0x83dc('0x4c')][_0x83dc('0x52')]({'where':{'id':_0x3f8826[_0x83dc('0x54')]['id']},'attributes':['securePassword']})[_0x83dc('0x31')](respondWithResult(_0x19907d,null))['catch'](handleError(_0x19907d,null));};exports[_0x83dc('0x6f')]=function(_0x197fcc,_0x348167,_0x4137d4){if(_0x197fcc[_0x83dc('0x58')]&&_0x197fcc[_0x83dc('0x58')][_0x83dc('0x55')]){_0x197fcc['body']['preferred']=_0x197fcc[_0x83dc('0x58')]['filename'];}return db[_0x83dc('0x4c')][_0x83dc('0x52')]({'where':{'id':_0x197fcc[_0x83dc('0x54')]['id']}})[_0x83dc('0x31')](handleEntityNotFound(_0x348167,null))['then'](saveUpdates(_0x197fcc['body'],null))[_0x83dc('0x31')](respondWithResult(_0x348167,null))['catch'](handleError(_0x348167,null));};var utilLicense=require(_0x83dc('0x15'));exports[_0x83dc('0x70')]=function(_0x5681a3,_0x46e869,_0x32704f){var _0x202e4f=_0x83dc('0x5b');var _0x465b84={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x203035){if(_0x203035){_0x465b84=_0x203035;}return db[_0x83dc('0x4c')][_0x83dc('0x52')]({'where':{'id':_0x5681a3[_0x83dc('0x54')]['id']},'attributes':[_0x83dc('0x56'),'loginLogo','preferred',_0x83dc('0x5d'),_0x83dc('0x5e'),'defaultLoginLogo',_0x83dc('0x6c'),'defaultFavicon'],'raw':!![]});})[_0x83dc('0x31')](handleEntityNotFound(_0x46e869,null))[_0x83dc('0x31')](function(_0x2c83f4){if(_0x2c83f4){var _0x44cc8a=_0x2c83f4[_0x83dc('0x5c')]&&fs[_0x83dc('0x60')](path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x202e4f,_['toLower'](_0x2c83f4[_0x83dc('0x5c')])))?path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x202e4f,_[_0x83dc('0x62')](_0x2c83f4[_0x83dc('0x5c')])):path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x202e4f,_[_0x83dc('0x62')]('default_preferred.png'));var _0x5e9192='default'+_[_0x83dc('0x66')](_0x83dc('0x5c'));if(_0x2c83f4[_0x5e9192]||!_0x465b84['custom']||!_0x465b84[_0x83dc('0x5c')]){_0x44cc8a=path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x202e4f,_['toLower'](_0x83dc('0x71')));}if(!fs[_0x83dc('0x60')](_0x44cc8a)){throw new db[(_0x83dc('0x68'))][(_0x83dc('0x6e'))](_[_0x83dc('0x66')](_0x83dc('0x5c'))+_0x83dc('0x69'));}return _0x46e869[_0x83dc('0x72')](_0x44cc8a);}})[_0x83dc('0x23')](handleError(_0x46e869,null));};exports['addFavicon']=function(_0x32ca62,_0x3eed86,_0x3c00c6){if(_0x32ca62[_0x83dc('0x58')]&&_0x32ca62[_0x83dc('0x58')][_0x83dc('0x55')]){_0x32ca62[_0x83dc('0x53')][_0x83dc('0x5d')]=_0x32ca62[_0x83dc('0x58')][_0x83dc('0x55')];}return db['Setting'][_0x83dc('0x52')]({'where':{'id':_0x32ca62['params']['id']}})[_0x83dc('0x31')](handleEntityNotFound(_0x3eed86,null))[_0x83dc('0x31')](saveUpdates(_0x32ca62[_0x83dc('0x53')],null))[_0x83dc('0x31')](respondWithResult(_0x3eed86,null))['catch'](handleError(_0x3eed86,null));};var utilLicense=require('../../config/license/util');exports[_0x83dc('0x73')]=function(_0x5577d7,_0x1e56a6,_0x5b6bc4){var _0x2d3ac0=_0x83dc('0x5b');var _0x4e666e={'custom':![]};return utilLicense[_0x83dc('0x6b')]()[_0x83dc('0x31')](function(_0x426660){if(_0x426660){_0x4e666e=_0x426660;}return db[_0x83dc('0x4c')]['find']({'where':{'id':_0x5577d7[_0x83dc('0x54')]['id']},'attributes':[_0x83dc('0x56'),_0x83dc('0x59'),'preferred',_0x83dc('0x5d'),_0x83dc('0x5e'),_0x83dc('0x5f'),_0x83dc('0x6c'),_0x83dc('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x1e56a6,null))[_0x83dc('0x31')](function(_0x254f1a){if(_0x254f1a){var _0x379f54=_0x254f1a[_0x83dc('0x5d')]&&fs[_0x83dc('0x60')](path[_0x83dc('0x63')](config['root'],_0x2d3ac0,_[_0x83dc('0x62')](_0x254f1a[_0x83dc('0x5d')])))?path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x2d3ac0,_[_0x83dc('0x62')](_0x254f1a[_0x83dc('0x5d')])):path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x2d3ac0,_['toLower'](_0x83dc('0x74')));var _0x521b40=_0x83dc('0x65')+_[_0x83dc('0x66')](_0x83dc('0x5d'));if(_0x254f1a[_0x521b40]||!_0x4e666e['custom']){_0x379f54=path[_0x83dc('0x63')](config[_0x83dc('0x61')],_0x2d3ac0,_[_0x83dc('0x62')](_0x83dc('0x74')));}if(!fs[_0x83dc('0x60')](_0x379f54)){throw new db[(_0x83dc('0x68'))][(_0x83dc('0x6e'))](_[_0x83dc('0x66')](_0x83dc('0x5d'))+'\x20not\x20found');}return _0x1e56a6[_0x83dc('0x72')](_0x379f54);}})[_0x83dc('0x23')](handleError(_0x1e56a6,null));};exports[_0x83dc('0x75')]=function(_0x401f55,_0x35f324){var _0x505d2f={'offset':moment()['utcOffset']()};_0x505d2f[_0x83dc('0x76')]=moment()[_0x83dc('0x77')](_0x505d2f[_0x83dc('0x28')])[_0x83dc('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x35f324[_0x83dc('0x25')](0xc8)['send'](_0x505d2f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 91d534f..71b19ca 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x2d05b6,_0x585b6a){var _0x2204b7=function(_0x35990f){while(--_0x35990f){_0x2d05b6['push'](_0x2d05b6['shift']());}};_0x2204b7(++_0x585b6a);}(_0xe14b,0x93));var _0xbe14=function(_0x48d257,_0x285c58){_0x48d257=_0x48d257-0x0;var _0x1ba4b5=_0xe14b[_0x48d257];return _0x1ba4b5;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f1f3466..898ad80 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 _0xaae9=['Setting,\x20%s,\x20%s','message','result','ShowSetting','Setting','options','raw','attributes','include','map','model','debug','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x578644,_0x38e061){var _0x2340ef=function(_0x8bab5){while(--_0x8bab5){_0x578644['push'](_0x578644['shift']());}};_0x2340ef(++_0x38e061);}(_0xaae9,0x6a));var _0x9aae=function(_0x1ee206,_0x4eca26){_0x1ee206=_0x1ee206-0x0;var _0x36c57b=_0xaae9[_0x1ee206];return _0x36c57b;};'use strict';var _=require(_0x9aae('0x0'));var util=require(_0x9aae('0x1'));var moment=require('moment');var BPromise=require(_0x9aae('0x2'));var rs=require(_0x9aae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9aae('0x4'))['db'];var utils=require(_0x9aae('0x5'));var logger=require(_0x9aae('0x6'))('rpc');var config=require(_0x9aae('0x7'));var jayson=require(_0x9aae('0x8'));var client=jayson[_0x9aae('0x9')][_0x9aae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1018b6,_0x105d4b,_0x1ecdcd){return new BPromise(function(_0x4bc225,_0x4747f3){return client[_0x9aae('0xb')](_0x1018b6,_0x1ecdcd)[_0x9aae('0xc')](function(_0x54ef73){logger[_0x9aae('0xd')]('Setting,\x20%s,\x20%s',_0x105d4b,_0x9aae('0xe'));logger['debug'](_0x9aae('0xf'),_0x105d4b,_0x9aae('0xe'),JSON[_0x9aae('0x10')](_0x54ef73));if(_0x54ef73[_0x9aae('0x11')]){if(_0x54ef73[_0x9aae('0x11')]['code']===0x1f4){logger[_0x9aae('0x11')](_0x9aae('0x12'),_0x105d4b,_0x54ef73['error'][_0x9aae('0x13')]);return _0x4747f3(_0x54ef73[_0x9aae('0x11')][_0x9aae('0x13')]);}logger['error'](_0x9aae('0x12'),_0x105d4b,_0x54ef73[_0x9aae('0x11')]['message']);return _0x4bc225(_0x54ef73['error'][_0x9aae('0x13')]);}else{logger[_0x9aae('0xd')](_0x9aae('0x12'),_0x105d4b,_0x9aae('0xe'));_0x4bc225(_0x54ef73[_0x9aae('0x14')]['message']);}})['catch'](function(_0x4272df){logger[_0x9aae('0x11')]('Setting,\x20%s,\x20%s',_0x105d4b,_0x4272df);_0x4747f3(_0x4272df);});});}exports[_0x9aae('0x15')]=function(_0x3ec155){var _0x4e55ad=this;return new Promise(function(_0x2da310,_0xbe2a99){return db[_0x9aae('0x16')]['find']({'raw':_0x3ec155[_0x9aae('0x17')]?_0x3ec155[_0x9aae('0x17')][_0x9aae('0x18')]===undefined?!![]:![]:!![],'where':_0x3ec155[_0x9aae('0x17')]?_0x3ec155[_0x9aae('0x17')]['where']||null:null,'attributes':_0x3ec155['options']?_0x3ec155[_0x9aae('0x17')][_0x9aae('0x19')]||null:null,'include':_0x3ec155[_0x9aae('0x17')]?_0x3ec155[_0x9aae('0x17')][_0x9aae('0x1a')]?_[_0x9aae('0x1b')](_0x3ec155[_0x9aae('0x17')][_0x9aae('0x1a')],function(_0x41932e){return{'model':db[_0x41932e[_0x9aae('0x1c')]],'as':_0x41932e['as'],'attributes':_0x41932e['attributes'],'include':_0x41932e[_0x9aae('0x1a')]?_['map'](_0x41932e[_0x9aae('0x1a')],function(_0x167aeb){return{'model':db[_0x167aeb[_0x9aae('0x1c')]],'as':_0x167aeb['as'],'attributes':_0x167aeb[_0x9aae('0x19')],'include':_0x167aeb['include']?_[_0x9aae('0x1b')](_0x167aeb['include'],function(_0x206c80){return{'model':db[_0x206c80[_0x9aae('0x1c')]],'as':_0x206c80['as'],'attributes':_0x206c80[_0x9aae('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9aae('0xc')](function(_0x483382){logger[_0x9aae('0xd')](_0x9aae('0x15'),_0x3ec155);logger[_0x9aae('0x1d')](_0x9aae('0x15'),_0x3ec155,JSON[_0x9aae('0x10')](_0x483382));_0x2da310(_0x483382);})[_0x9aae('0x1e')](function(_0x38a7c3){logger[_0x9aae('0x11')]('ShowSetting',_0x38a7c3[_0x9aae('0x13')],_0x3ec155);_0xbe2a99(_0x4e55ad[_0x9aae('0x11')](0x1f4,_0x38a7c3[_0x9aae('0x13')]));});});}; \ No newline at end of file +var _0x919a=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Setting','options','raw','where','map','include','model','attributes','ShowSetting','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a7a1f,_0x375467){var _0x51b98b=function(_0x5bced6){while(--_0x5bced6){_0x1a7a1f['push'](_0x1a7a1f['shift']());}};_0x51b98b(++_0x375467);}(_0x919a,0x8d));var _0xa919=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x919a[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xa919('0x0'));var util=require(_0xa919('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa919('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa919('0x3'));var logger=require(_0xa919('0x4'))(_0xa919('0x5'));var config=require(_0xa919('0x6'));var jayson=require(_0xa919('0x7'));var client=jayson[_0xa919('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30e0c6,_0x5a85f9,_0x52f968){return new BPromise(function(_0x91037,_0x3471b9){return client[_0xa919('0x9')](_0x30e0c6,_0x52f968)[_0xa919('0xa')](function(_0x4a5200){logger[_0xa919('0xb')](_0xa919('0xc'),_0x5a85f9,_0xa919('0xd'));logger[_0xa919('0xe')](_0xa919('0xf'),_0x5a85f9,'request\x20sent',JSON['stringify'](_0x4a5200));if(_0x4a5200[_0xa919('0x10')]){if(_0x4a5200[_0xa919('0x10')][_0xa919('0x11')]===0x1f4){logger['error'](_0xa919('0xc'),_0x5a85f9,_0x4a5200['error'][_0xa919('0x12')]);return _0x3471b9(_0x4a5200[_0xa919('0x10')]['message']);}logger[_0xa919('0x10')](_0xa919('0xc'),_0x5a85f9,_0x4a5200['error'][_0xa919('0x12')]);return _0x91037(_0x4a5200['error'][_0xa919('0x12')]);}else{logger[_0xa919('0xb')](_0xa919('0xc'),_0x5a85f9,_0xa919('0xd'));_0x91037(_0x4a5200[_0xa919('0x13')][_0xa919('0x12')]);}})[_0xa919('0x14')](function(_0x5bd78e){logger[_0xa919('0x10')](_0xa919('0xc'),_0x5a85f9,_0x5bd78e);_0x3471b9(_0x5bd78e);});});}exports['ShowSetting']=function(_0x32eb3c){var _0x327f67=this;return new Promise(function(_0x4ed4b0,_0x2efb75){return db[_0xa919('0x15')]['find']({'raw':_0x32eb3c[_0xa919('0x16')]?_0x32eb3c[_0xa919('0x16')][_0xa919('0x17')]===undefined?!![]:![]:!![],'where':_0x32eb3c[_0xa919('0x16')]?_0x32eb3c['options'][_0xa919('0x18')]||null:null,'attributes':_0x32eb3c[_0xa919('0x16')]?_0x32eb3c[_0xa919('0x16')]['attributes']||null:null,'include':_0x32eb3c['options']?_0x32eb3c[_0xa919('0x16')]['include']?_[_0xa919('0x19')](_0x32eb3c['options'][_0xa919('0x1a')],function(_0x734d27){return{'model':db[_0x734d27['model']],'as':_0x734d27['as'],'attributes':_0x734d27['attributes'],'include':_0x734d27[_0xa919('0x1a')]?_[_0xa919('0x19')](_0x734d27[_0xa919('0x1a')],function(_0x5f5442){return{'model':db[_0x5f5442[_0xa919('0x1b')]],'as':_0x5f5442['as'],'attributes':_0x5f5442[_0xa919('0x1c')],'include':_0x5f5442[_0xa919('0x1a')]?_['map'](_0x5f5442[_0xa919('0x1a')],function(_0x3b2540){return{'model':db[_0x3b2540[_0xa919('0x1b')]],'as':_0x3b2540['as'],'attributes':_0x3b2540['attributes']};}):[]};}):[]};}):[]:[]})[_0xa919('0xa')](function(_0x348ca8){logger['info'](_0xa919('0x1d'),_0x32eb3c);logger[_0xa919('0xe')](_0xa919('0x1d'),_0x32eb3c,JSON['stringify'](_0x348ca8));_0x4ed4b0(_0x348ca8);})[_0xa919('0x14')](function(_0x3ed250){logger[_0xa919('0x10')](_0xa919('0x1d'),_0x3ed250[_0xa919('0x12')],_0x32eb3c);_0x2efb75(_0x327f67[_0xa919('0x10')](0x1f4,_0x3ed250['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8df2c25..8e358d6 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 _0x1cb9=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','/:id/status','status','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1a75d0,_0x468c73){_0x1a75d0=_0x1a75d0-0x0;var _0x5f0cd1=_0x1cb9[_0x1a75d0];return _0x5f0cd1;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/status',controller['statusGet']);router[_0x91cb('0x8')](_0x91cb('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x91cb('0x17')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x18')]);router['post'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x19')]);router['post'](_0x91cb('0x1a'),controller[_0x91cb('0x1b')]);router['post'](_0x91cb('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x91cb('0x17')](_0x91cb('0x1d'),auth['isAuthenticated'](),controller['send']);router['post'](_0x91cb('0x1e'),controller[_0x91cb('0x1f')]);router[_0x91cb('0x17')](_0x91cb('0x16'),auth['isAuthenticated'](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0x22')]);router[_0x91cb('0x23')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x24')]);router[_0x91cb('0x23')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x25')]);router['delete']('/:id/canned_answers',auth[_0x91cb('0x9')](),controller['removeAnswers']);router[_0x91cb('0x23')](_0x91cb('0x16'),auth[_0x91cb('0x9')](),controller['removeAgents']);module[_0x91cb('0x26')]=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0xd8dc8,_0xb661fd){var _0x2dfe9a=function(_0x38d1d5){while(--_0x38d1d5){_0xd8dc8['push'](_0xd8dc8['shift']());}};_0x2dfe9a(++_0xb661fd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c7a3c6d..df2fa8e 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 _0xcca0=['STRING','generate','ENUM','twilio','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name'];(function(_0x10421f,_0x46f58d){var _0x356fa4=function(_0x4fdaf2){while(--_0x4fdaf2){_0x10421f['push'](_0x10421f['shift']());}};_0x356fa4(++_0x46f58d);}(_0xcca0,0x1b1));var _0x0cca=function(_0x46a085,_0x33fa72){_0x46a085=_0x46a085-0x0;var _0x57d64f=_0xcca0[_0x46a085];return _0x57d64f;};'use strict';var Sequelize=require(_0x0cca('0x0'));var rs=require(_0x0cca('0x1'));module[_0x0cca('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x0cca('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0cca('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x0cca('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0cca('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0cca('0x6')](_0x0cca('0x7'),'skebby',_0x0cca('0x8'),_0x0cca('0x9'),_0x0cca('0xa'),'clickatell',_0x0cca('0xb'),_0x0cca('0xc'),_0x0cca('0xd'),_0x0cca('0xe'))},'accountSid':{'type':Sequelize[_0x0cca('0x4')]},'authId':{'type':Sequelize[_0x0cca('0x4')]},'authToken':{'type':Sequelize[_0x0cca('0x4')]},'smsMethod':{'type':Sequelize[_0x0cca('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0cca('0x4')]},'password':{'type':Sequelize[_0x0cca('0x4')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x0cca('0x4')]},'accountId':{'type':Sequelize[_0x0cca('0x4')]},'senderString':{'type':Sequelize[_0x0cca('0x4')]},'deliveryReport':{'type':Sequelize[_0x0cca('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x0cca('0x4')]},'notificationTemplate':{'type':Sequelize[_0x0cca('0x10')],'defaultValue':function(){return _0x0cca('0x11');}},'notificationSound':{'type':Sequelize[_0x0cca('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0cca('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0cca('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0cca('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0cca('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0cca('0x12')],'comment':_0x0cca('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x0cca('0xf')],'defaultValue':![],'comment':_0x0cca('0x14'),'set':function(_0x4c21ea){if(!_0x4c21ea)this[_0x0cca('0x15')]('mandatoryDispositionPauseId',null);this[_0x0cca('0x15')](_0x0cca('0x16'),_0x4c21ea);}}}; \ No newline at end of file +var _0x957f=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4ce063,_0x5cccdf){var _0x47a15f=function(_0x55eef8){while(--_0x55eef8){_0x4ce063['push'](_0x4ce063['shift']());}};_0x47a15f(++_0x5cccdf);}(_0x957f,0xea));var _0xf957=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0x957f[_0x54d52];return _0x968345;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf957('0x0'));module[_0xf957('0x1')]={'name':{'type':Sequelize[_0xf957('0x2')],'unique':_0xf957('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xf957('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xf957('0x2')],'defaultValue':function(){return rs[_0xf957('0x4')]();}},'phone':{'type':Sequelize[_0xf957('0x2')]},'type':{'type':Sequelize['ENUM'](_0xf957('0x5'),_0xf957('0x6'),_0xf957('0x7'),_0xf957('0x8'),_0xf957('0x9'),_0xf957('0xa'),_0xf957('0xb'),'csc',_0xf957('0xc'),_0xf957('0xd'))},'accountSid':{'type':Sequelize[_0xf957('0x2')]},'authId':{'type':Sequelize[_0xf957('0x2')]},'authToken':{'type':Sequelize[_0xf957('0x2')]},'smsMethod':{'type':Sequelize[_0xf957('0xe')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xf957('0x2')]},'applicationId':{'type':Sequelize[_0xf957('0x2')]},'accountId':{'type':Sequelize[_0xf957('0x2')]},'senderString':{'type':Sequelize[_0xf957('0x2')]},'deliveryReport':{'type':Sequelize[_0xf957('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xf957('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf957('0x10');}},'notificationSound':{'type':Sequelize[_0xf957('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf957('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf957('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf957('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf957('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf957('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf957('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf957('0x11')],'comment':_0xf957('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xf957('0xf')],'defaultValue':![],'comment':_0xf957('0x13'),'set':function(_0x3eb2d1){if(!_0x3eb2d1)this[_0xf957('0x14')](_0xf957('0x15'),null);this[_0xf957('0x14')](_0xf957('0x16'),_0x3eb2d1);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index bf9e885..f7ee2a2 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 _0x4028=['result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','addDisposition','SmsAccountId','Disposition','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','From','messageId','MessageSid','skebby','from','sender','clicksend','message_id','plivo','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','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','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','send','getApplications','getInteractions','Contact','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','dataValues','Messages','skebby_dispatch_id','connectel','statusInt','requestid','status_code','groupName','DELIVERED','redif','inspect','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x41817b,_0x1b6ae4){var _0x70dd8=function(_0x7bbc4){while(--_0x7bbc4){_0x41817b['push'](_0x41817b['shift']());}};_0x70dd8(++_0x1b6ae4);}(_0x4028,0x1a4));var _0x8402=function(_0x59559d,_0x46bd3a){_0x59559d=_0x59559d-0x0;var _0x1202e9=_0x4028[_0x59559d];return _0x1202e9;};'use strict';var emlformat=require(_0x8402('0x0'));var rimraf=require(_0x8402('0x1'));var zipdir=require(_0x8402('0x2'));var jsonpatch=require(_0x8402('0x3'));var rp=require(_0x8402('0x4'));var moment=require('moment');var BPromise=require(_0x8402('0x5'));var Mustache=require('mustache');var util=require(_0x8402('0x6'));var path=require('path');var sox=require(_0x8402('0x7'));var csv=require(_0x8402('0x8'));var ejs=require(_0x8402('0x9'));var fs=require('fs');var fs_extra=require(_0x8402('0xa'));var _=require(_0x8402('0xb'));var squel=require(_0x8402('0xc'));var crypto=require('crypto');var jsforce=require(_0x8402('0xd'));var deskjs=require(_0x8402('0xe'));var toCsv=require(_0x8402('0x8'));var querystring=require(_0x8402('0xf'));var Papa=require(_0x8402('0x10'));var Redis=require(_0x8402('0x11'));var authService=require(_0x8402('0x12'));var qs=require(_0x8402('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8402('0x14'))(_0x8402('0x15'));var utils=require('../../config/utils');var config=require(_0x8402('0x16'));var licenseUtil=require(_0x8402('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8402('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8402('0x19'))(new Redis(config[_0x8402('0x1a')]));require(_0x8402('0x1b'))[_0x8402('0x1c')](socket);var jayson=require(_0x8402('0x1d'));var client=jayson[_0x8402('0x1e')][_0x8402('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x38c130,_0x3b7615,_0x54d550,_0x59a95b){return new BPromise(function(_0x4c635b,_0x34f96e){var _0x27e744=_0x59a95b||client;return _0x27e744[_0x8402('0x20')](_0x38c130,_0x54d550)[_0x8402('0x21')](function(_0x257f77){logger[_0x8402('0x22')](_0x8402('0x23'),_0x3b7615,_0x8402('0x24'));logger['debug'](_0x8402('0x25'),_0x3b7615,_0x8402('0x24'),JSON[_0x8402('0x26')](_0x257f77));if(_0x257f77[_0x8402('0x27')]){if(_0x257f77[_0x8402('0x27')][_0x8402('0x28')]===0x1f4){logger['error'](_0x8402('0x23'),_0x3b7615,_0x257f77[_0x8402('0x27')][_0x8402('0x29')]);return _0x34f96e(_0x257f77[_0x8402('0x27')]['message']);}logger[_0x8402('0x27')](_0x8402('0x23'),_0x3b7615,_0x257f77[_0x8402('0x27')]['message']);return _0x4c635b(_0x257f77[_0x8402('0x27')]['message']);}else{logger[_0x8402('0x22')](_0x8402('0x23'),_0x3b7615,_0x8402('0x24'));_0x4c635b(_0x257f77[_0x8402('0x2a')][_0x8402('0x29')]);}})[_0x8402('0x2b')](function(_0x18b8aa){logger[_0x8402('0x27')](_0x8402('0x23'),_0x3b7615,_0x18b8aa);_0x34f96e(_0x18b8aa);});});}function respondWithStatusCode(_0x4c76e2,_0x1930a3){_0x1930a3=_0x1930a3||0xcc;return function(_0x8d2df6){if(_0x8d2df6){return _0x4c76e2['sendStatus'](_0x1930a3);}return _0x4c76e2[_0x8402('0x2c')](_0x1930a3)[_0x8402('0x2d')]();};}function respondWithResult(_0x23147d,_0x21bdca){_0x21bdca=_0x21bdca||0xc8;return function(_0x4bb757){if(_0x4bb757){return _0x23147d[_0x8402('0x2c')](_0x21bdca)[_0x8402('0x2e')](_0x4bb757);}};}function respondWithFilteredResult(_0x16a821,_0x5f345b){return function(_0x4ee451){if(_0x4ee451){var _0xa5dd6b=typeof _0x5f345b['offset']===_0x8402('0x2f')&&typeof _0x5f345b[_0x8402('0x30')]===_0x8402('0x2f');var _0xf8fcc6=_0x4ee451[_0x8402('0x31')];var _0x41c5c4=_0xa5dd6b?0x0:_0x5f345b['offset'];var _0x17ba6f=_0xa5dd6b?_0x4ee451[_0x8402('0x31')]:_0x5f345b[_0x8402('0x32')]+_0x5f345b[_0x8402('0x30')];var _0xad3014;if(_0x17ba6f>=_0xf8fcc6){_0x17ba6f=_0xf8fcc6;_0xad3014=0xc8;}else{_0xad3014=0xce;}_0x16a821[_0x8402('0x2c')](_0xad3014);return _0x16a821[_0x8402('0x33')](_0x8402('0x34'),_0x41c5c4+'-'+_0x17ba6f+'/'+_0xf8fcc6)['json'](_0x4ee451);}return null;};}function patchUpdates(_0x588189){return function(_0x495009){try{jsonpatch[_0x8402('0x35')](_0x495009,_0x588189,!![]);}catch(_0x2969e5){return BPromise[_0x8402('0x36')](_0x2969e5);}return _0x495009[_0x8402('0x37')]();};}function saveUpdates(_0x34f0e3,_0x311adb){return function(_0x277d96){if(_0x277d96){return _0x277d96[_0x8402('0x38')](_0x34f0e3)['then'](function(_0x3467de){return _0x3467de;});}return null;};}function removeEntity(_0x5e134a,_0x45b5ba){return function(_0x1bcfb9){if(_0x1bcfb9){return _0x1bcfb9[_0x8402('0x39')]()[_0x8402('0x21')](function(){var _0x379e7f=_0x1bcfb9['get']({'plain':!![]});var _0x49d8fd=_0x8402('0x3a');return db[_0x8402('0x3b')][_0x8402('0x39')]({'where':{'type':_0x49d8fd,'resourceId':_0x379e7f['id']}})['then'](function(){return _0x1bcfb9;});})[_0x8402('0x21')](function(){_0x5e134a[_0x8402('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b633e,_0x5c5592){return function(_0x590aab){if(!_0x590aab){_0x1b633e[_0x8402('0x3c')](0x194);}return _0x590aab;};}function handleError(_0x374fb0,_0x3684b9){_0x3684b9=_0x3684b9||0x1f4;return function(_0x1739d7){logger['error'](_0x1739d7[_0x8402('0x3d')]);if(_0x1739d7['name']){delete _0x1739d7[_0x8402('0x3e')];}_0x374fb0[_0x8402('0x2c')](_0x3684b9)['send'](_0x1739d7);};}exports[_0x8402('0x3f')]=function(_0x5e5dbe,_0x4edcb0){var _0x1891a8={'include':[{'model':db[_0x8402('0x40')],'as':_0x8402('0x41')}]},_0x134dba={},_0x359615={'count':0x0,'rows':[]};var _0x4fe270=_['map'](db[_0x8402('0x42')][_0x8402('0x43')],function(_0x51d64a){return{'name':_0x51d64a['fieldName'],'type':_0x51d64a[_0x8402('0x44')][_0x8402('0x45')]};});_0x134dba[_0x8402('0x46')]=_[_0x8402('0x47')](_0x4fe270,_0x8402('0x3e'));_0x134dba['query']=_[_0x8402('0x48')](_0x5e5dbe[_0x8402('0x49')]);_0x134dba[_0x8402('0x4a')]=_[_0x8402('0x4b')](_0x134dba['model'],_0x134dba[_0x8402('0x49')]);_0x1891a8[_0x8402('0x4c')]=_[_0x8402('0x4b')](_0x134dba['model'],qs[_0x8402('0x4d')](_0x5e5dbe[_0x8402('0x49')]['fields']));_0x1891a8[_0x8402('0x4c')]=_0x1891a8[_0x8402('0x4c')][_0x8402('0x4e')]?_0x1891a8[_0x8402('0x4c')]:_0x134dba['model'];if(!_0x5e5dbe[_0x8402('0x49')][_0x8402('0x4f')]('nolimit')){_0x1891a8[_0x8402('0x30')]=qs['limit'](_0x5e5dbe[_0x8402('0x49')][_0x8402('0x30')]);_0x1891a8[_0x8402('0x32')]=qs['offset'](_0x5e5dbe['query'][_0x8402('0x32')]);}_0x1891a8[_0x8402('0x50')]=qs[_0x8402('0x51')](_0x5e5dbe[_0x8402('0x49')][_0x8402('0x51')]);_0x1891a8[_0x8402('0x52')]=qs[_0x8402('0x4a')](_[_0x8402('0x53')](_0x5e5dbe['query'],_0x134dba[_0x8402('0x4a')]),_0x4fe270);if(_0x5e5dbe[_0x8402('0x49')][_0x8402('0x54')]){_0x1891a8[_0x8402('0x52')]=_[_0x8402('0x55')](_0x1891a8[_0x8402('0x52')],{'$or':_[_0x8402('0x47')](_0x4fe270,function(_0x35450e){if(_0x35450e[_0x8402('0x44')]!==_0x8402('0x56')){var _0x124d34={};_0x124d34[_0x35450e['name']]={'$like':'%'+_0x5e5dbe[_0x8402('0x49')][_0x8402('0x54')]+'%'};return _0x124d34;}})});}_0x1891a8=_[_0x8402('0x55')]({},_0x1891a8,_0x5e5dbe[_0x8402('0x57')]);var _0x42d7b5={'where':_0x1891a8['where']};return db['SmsAccount'][_0x8402('0x31')](_0x42d7b5)[_0x8402('0x21')](function(_0x4e1105){_0x359615[_0x8402('0x31')]=_0x4e1105;if(_0x5e5dbe['query']['includeAll']){_0x1891a8[_0x8402('0x58')]=[{'all':!![]}];}return db[_0x8402('0x42')]['findAll'](_0x1891a8);})['then'](function(_0x2f51d1){_0x359615[_0x8402('0x59')]=_0x2f51d1;return _0x359615;})[_0x8402('0x21')](respondWithFilteredResult(_0x4edcb0,_0x1891a8))['catch'](handleError(_0x4edcb0,null));};exports[_0x8402('0x5a')]=function(_0x4e5d53,_0x59ab7d){var _0x36fd80={'raw':![],'where':{'id':_0x4e5d53[_0x8402('0x5b')]['id']},'include':[{'model':db[_0x8402('0x40')],'as':_0x8402('0x41')}]},_0x445a06={};_0x445a06[_0x8402('0x46')]=_[_0x8402('0x48')](db[_0x8402('0x42')][_0x8402('0x43')]);_0x445a06[_0x8402('0x49')]=_[_0x8402('0x48')](_0x4e5d53[_0x8402('0x49')]);_0x445a06[_0x8402('0x4a')]=_[_0x8402('0x4b')](_0x445a06['model'],_0x445a06[_0x8402('0x49')]);_0x36fd80['attributes']=_['intersection'](_0x445a06['model'],qs[_0x8402('0x4d')](_0x4e5d53['query']['fields']));_0x36fd80[_0x8402('0x4c')]=_0x36fd80[_0x8402('0x4c')][_0x8402('0x4e')]?_0x36fd80[_0x8402('0x4c')]:_0x445a06[_0x8402('0x46')];if(_0x4e5d53[_0x8402('0x49')][_0x8402('0x5c')]){_0x36fd80[_0x8402('0x58')]=[{'all':!![]}];}_0x36fd80=_[_0x8402('0x55')]({},_0x36fd80,_0x4e5d53['options']);return db[_0x8402('0x42')]['find'](_0x36fd80)['then'](handleEntityNotFound(_0x59ab7d,null))['then'](respondWithResult(_0x59ab7d,null))['catch'](handleError(_0x59ab7d,null));};exports[_0x8402('0x5d')]=function(_0x50c88c,_0xadec01){return db['SmsAccount'][_0x8402('0x5d')](_0x50c88c[_0x8402('0x5e')],{})['then'](function(_0x1c8841){var _0x55b3ad=_0x50c88c[_0x8402('0x5f')]['get']({'plain':!![]});if(!_0x55b3ad)throw new Error(_0x8402('0x60'));if(_0x55b3ad['role']==='user'){var _0x916a23=_0x1c8841[_0x8402('0x61')]({'plain':!![]});var _0x1ecfc6='SmsAccounts';return db[_0x8402('0x62')][_0x8402('0x63')]({'where':{'name':_0x1ecfc6,'userProfileId':_0x55b3ad[_0x8402('0x64')]},'raw':!![]})[_0x8402('0x21')](function(_0x5af2e5){if(_0x5af2e5&&_0x5af2e5[_0x8402('0x65')]===0x0){return db['UserProfileResource'][_0x8402('0x5d')]({'name':_0x916a23[_0x8402('0x3e')],'resourceId':_0x916a23['id'],'type':_0x5af2e5[_0x8402('0x3e')],'sectionId':_0x5af2e5['id']},{})['then'](function(){return _0x1c8841;});}else{return _0x1c8841;}})[_0x8402('0x2b')](function(_0x323661){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x323661);throw _0x323661;});}return _0x1c8841;})[_0x8402('0x21')](respondWithResult(_0xadec01,0xc9))['catch'](handleError(_0xadec01,null));};exports[_0x8402('0x38')]=function(_0x3bb932,_0x259ba5){if(_0x3bb932[_0x8402('0x5e')]['id']){delete _0x3bb932[_0x8402('0x5e')]['id'];}return db['SmsAccount'][_0x8402('0x63')]({'where':{'id':_0x3bb932['params']['id']},'include':[{'model':db[_0x8402('0x40')],'as':_0x8402('0x41')}]})[_0x8402('0x21')](handleEntityNotFound(_0x259ba5,null))[_0x8402('0x21')](saveUpdates(_0x3bb932['body'],null))['then'](respondWithResult(_0x259ba5,null))[_0x8402('0x2b')](handleError(_0x259ba5,null));};exports['destroy']=function(_0x2f6134,_0x142974){return db[_0x8402('0x42')]['find']({'where':{'id':_0x2f6134[_0x8402('0x5b')]['id']}})[_0x8402('0x21')](handleEntityNotFound(_0x142974,null))[_0x8402('0x21')](removeEntity(_0x142974,null))[_0x8402('0x2b')](handleError(_0x142974,null));};exports['describe']=function(_0x5e633b,_0x868fda){return db[_0x8402('0x42')]['describe']()[_0x8402('0x21')](respondWithResult(_0x868fda,null))[_0x8402('0x2b')](handleError(_0x868fda,null));};exports[_0x8402('0x66')]=function(_0xa06c63,_0x497614,_0xe6e2af){if(_0xa06c63[_0x8402('0x5e')]['id']){delete _0xa06c63['body']['id'];}return db[_0x8402('0x42')][_0x8402('0x63')]({'where':{'id':_0xa06c63[_0x8402('0x5b')]['id']}})['then'](handleEntityNotFound(_0x497614,null))[_0x8402('0x21')](function(_0x19d439){if(_0x19d439){_0xa06c63[_0x8402('0x5e')][_0x8402('0x67')]=_0x19d439['id'];return db[_0x8402('0x68')][_0x8402('0x5d')](_0xa06c63[_0x8402('0x5e')]);}})[_0x8402('0x21')](respondWithResult(_0x497614,null))[_0x8402('0x2b')](handleError(_0x497614,null));};exports['getDispositions']=function(_0x40f824,_0x4d01fd,_0x47c562){var _0x11382b={'raw':![],'where':{}};var _0x5941e1={};var _0x46d90f={'count':0x0,'rows':[]};return db[_0x8402('0x42')][_0x8402('0x69')]({'where':{'id':_0x40f824[_0x8402('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4d01fd,null))['then'](function(_0xd17d91){if(_0xd17d91){_0x5941e1[_0x8402('0x46')]=_[_0x8402('0x48')](db[_0x8402('0x68')][_0x8402('0x43')]);_0x5941e1[_0x8402('0x49')]=_[_0x8402('0x48')](_0x40f824[_0x8402('0x49')]);_0x5941e1['filters']=_[_0x8402('0x4b')](_0x5941e1['model'],_0x5941e1['query']);_0x11382b['attributes']=_[_0x8402('0x4b')](_0x5941e1['model'],qs['fields'](_0x40f824['query'][_0x8402('0x4d')]));_0x11382b[_0x8402('0x4c')]=_0x11382b[_0x8402('0x4c')]['length']?_0x11382b[_0x8402('0x4c')]:_0x5941e1['model'];if(!_0x40f824[_0x8402('0x49')][_0x8402('0x4f')](_0x8402('0x6a'))){_0x11382b[_0x8402('0x30')]=qs['limit'](_0x40f824['query']['limit']);_0x11382b['offset']=qs[_0x8402('0x32')](_0x40f824[_0x8402('0x49')][_0x8402('0x32')]);}_0x11382b[_0x8402('0x50')]=qs[_0x8402('0x51')](_0x40f824[_0x8402('0x49')][_0x8402('0x51')]);_0x11382b[_0x8402('0x52')]=qs[_0x8402('0x4a')](_['pick'](_0x40f824[_0x8402('0x49')],_0x5941e1[_0x8402('0x4a')]));_0x11382b[_0x8402('0x52')]['SmsAccountId']=_0xd17d91['id'];if(_0x40f824[_0x8402('0x49')][_0x8402('0x54')]){_0x11382b[_0x8402('0x52')]=_['merge'](_0x11382b[_0x8402('0x52')],{'$or':_[_0x8402('0x47')](_0x11382b[_0x8402('0x4c')],function(_0x579d71){var _0x5e49f8={};_0x5e49f8[_0x579d71]={'$like':'%'+_0x40f824['query'][_0x8402('0x54')]+'%'};return _0x5e49f8;})});}_0x11382b=_[_0x8402('0x55')]({},_0x11382b,_0x40f824['options']);return db[_0x8402('0x68')][_0x8402('0x31')]({'where':_0x11382b[_0x8402('0x52')]})[_0x8402('0x21')](function(_0x8f23ba){_0x46d90f[_0x8402('0x31')]=_0x8f23ba;if(_0x40f824[_0x8402('0x49')][_0x8402('0x5c')]){_0x11382b[_0x8402('0x58')]=[{'all':!![]}];}return db[_0x8402('0x68')][_0x8402('0x6b')](_0x11382b);})[_0x8402('0x21')](function(_0x1d0425){_0x46d90f[_0x8402('0x59')]=_0x1d0425;return _0x46d90f;});}})[_0x8402('0x21')](respondWithFilteredResult(_0x4d01fd,_0x11382b))['catch'](handleError(_0x4d01fd,null));};exports[_0x8402('0x6c')]=function(_0x38a7a6,_0x4fa88b,_0x22a58d){return db['SmsAccount'][_0x8402('0x63')]({'where':{'id':_0x38a7a6[_0x8402('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4fa88b,null))[_0x8402('0x21')](function(_0x2ff188){if(_0x2ff188){return _0x2ff188[_0x8402('0x6c')](_0x38a7a6[_0x8402('0x49')][_0x8402('0x6d')]);}})[_0x8402('0x21')](respondWithStatusCode(_0x4fa88b,null))[_0x8402('0x2b')](handleError(_0x4fa88b,null));};exports[_0x8402('0x6e')]=function(_0x276d23,_0x9785f3,_0x1e8bfe){if(_0x276d23[_0x8402('0x5e')]['id']){delete _0x276d23[_0x8402('0x5e')]['id'];}return db[_0x8402('0x42')][_0x8402('0x63')]({'where':{'id':_0x276d23[_0x8402('0x5b')]['id']}})[_0x8402('0x21')](handleEntityNotFound(_0x9785f3,null))[_0x8402('0x21')](function(_0x46b072){if(_0x46b072){_0x276d23['body'][_0x8402('0x67')]=_0x46b072['id'];return db[_0x8402('0x6f')][_0x8402('0x5d')](_0x276d23[_0x8402('0x5e')]);}})['then'](respondWithResult(_0x9785f3,null))[_0x8402('0x2b')](handleError(_0x9785f3,null));};exports[_0x8402('0x70')]=function(_0x3e91cb,_0x1576ee,_0x1935bd){var _0x1c3666={'raw':![],'where':{}};var _0x3fb6fd={};var _0x26e6b5={'count':0x0,'rows':[]};return db['SmsAccount'][_0x8402('0x69')]({'where':{'id':_0x3e91cb[_0x8402('0x5b')]['id']}})[_0x8402('0x21')](handleEntityNotFound(_0x1576ee,null))[_0x8402('0x21')](function(_0x58919f){if(_0x58919f){_0x3fb6fd[_0x8402('0x46')]=_[_0x8402('0x48')](db[_0x8402('0x6f')][_0x8402('0x43')]);_0x3fb6fd['query']=_['keys'](_0x3e91cb[_0x8402('0x49')]);_0x3fb6fd[_0x8402('0x4a')]=_[_0x8402('0x4b')](_0x3fb6fd[_0x8402('0x46')],_0x3fb6fd[_0x8402('0x49')]);_0x1c3666[_0x8402('0x4c')]=_[_0x8402('0x4b')](_0x3fb6fd['model'],qs[_0x8402('0x4d')](_0x3e91cb[_0x8402('0x49')]['fields']));_0x1c3666['attributes']=_0x1c3666[_0x8402('0x4c')][_0x8402('0x4e')]?_0x1c3666['attributes']:_0x3fb6fd[_0x8402('0x46')];if(!_0x3e91cb[_0x8402('0x49')]['hasOwnProperty']('nolimit')){_0x1c3666['limit']=qs[_0x8402('0x30')](_0x3e91cb['query'][_0x8402('0x30')]);_0x1c3666[_0x8402('0x32')]=qs[_0x8402('0x32')](_0x3e91cb['query']['offset']);}_0x1c3666[_0x8402('0x50')]=qs[_0x8402('0x51')](_0x3e91cb[_0x8402('0x49')][_0x8402('0x51')]);_0x1c3666['where']=qs['filters'](_[_0x8402('0x53')](_0x3e91cb[_0x8402('0x49')],_0x3fb6fd[_0x8402('0x4a')]));_0x1c3666['where'][_0x8402('0x67')]=_0x58919f['id'];if(_0x3e91cb['query'][_0x8402('0x54')]){_0x1c3666[_0x8402('0x52')]=_['merge'](_0x1c3666[_0x8402('0x52')],{'$or':_[_0x8402('0x47')](_0x1c3666['attributes'],function(_0x29c697){var _0x3d9048={};_0x3d9048[_0x29c697]={'$like':'%'+_0x3e91cb[_0x8402('0x49')]['filter']+'%'};return _0x3d9048;})});}_0x1c3666=_[_0x8402('0x55')]({},_0x1c3666,_0x3e91cb[_0x8402('0x57')]);return db[_0x8402('0x6f')]['count']({'where':_0x1c3666[_0x8402('0x52')]})['then'](function(_0x17707b){_0x26e6b5[_0x8402('0x31')]=_0x17707b;if(_0x3e91cb[_0x8402('0x49')][_0x8402('0x5c')]){_0x1c3666[_0x8402('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8402('0x6b')](_0x1c3666);})[_0x8402('0x21')](function(_0x6cfc51){_0x26e6b5[_0x8402('0x59')]=_0x6cfc51;return _0x26e6b5;});}})['then'](respondWithFilteredResult(_0x1576ee,_0x1c3666))[_0x8402('0x2b')](handleError(_0x1576ee,null));};exports[_0x8402('0x71')]=function(_0x59d7ed,_0x5b8aee,_0x13ff3c){return db[_0x8402('0x42')]['find']({'where':{'id':_0x59d7ed[_0x8402('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5b8aee,null))[_0x8402('0x21')](function(_0x2642c9){if(_0x2642c9){return _0x2642c9[_0x8402('0x71')](_0x59d7ed['query'][_0x8402('0x6d')]);}})[_0x8402('0x21')](respondWithStatusCode(_0x5b8aee,null))[_0x8402('0x2b')](handleError(_0x5b8aee,null));};exports[_0x8402('0x72')]=function(_0x5d2a2c,_0x5a3a93,_0x4a36b5){var _0x42c20f={'channel':_0x8402('0x73')};var _0x2f7a03=[];var _0xfb129a=[];var _0xc09388={};return db[_0x8402('0x42')]['find']({'where':{'id':_0x5d2a2c['params']['id']},'include':[{'model':db[_0x8402('0x74')],'as':'Applications'}]})[_0x8402('0x21')](handleEntityNotFound(_0x5a3a93,null))['then'](function(_0x362b58){_0x42c20f[_0x8402('0x75')]=_0x362b58;_0x42c20f[_0x8402('0x76')]=_[_0x8402('0x77')](_0x362b58[_0x8402('0x78')],[_0x8402('0x79')],['asc']);if(_0x42c20f[_0x8402('0x75')][_0x8402('0x78')]){delete _0x42c20f['account'][_0x8402('0x78')];}return db[_0x8402('0x7a')]['describe']();})[_0x8402('0x21')](function(_0x310285){if(!_0x310285){throw new db[(_0x8402('0x7b'))][(_0x8402('0x7c'))](_0x8402('0x7d'));}_0x2f7a03=_[_0x8402('0x7e')](_['keys'](_0x310285),[_0x8402('0x7f'),_0x8402('0x80')]);_0xfb129a=_[_0x8402('0x7e')](_[_0x8402('0x48')](_0x310285),[_0x8402('0x7f'),'updatedAt',_0x8402('0x81'),_0x8402('0x82')]);_0x42c20f[_0x8402('0x5e')]={'mapKey':'mobile'};if(_0x42c20f[_0x8402('0x75')][_0x8402('0x44')]){switch(_0x42c20f[_0x8402('0x75')]['type']){case _0x8402('0x83'):_0x42c20f[_0x8402('0x5e')]['from']=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x84')];_0x42c20f[_0x8402('0x5e')][_0x8402('0x5e')]=_0x5d2a2c[_0x8402('0x5e')]['Body'];_0x42c20f[_0x8402('0x5e')][_0x8402('0x85')]=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x86')];break;case _0x8402('0x87'):_0x42c20f['body'][_0x8402('0x88')]='+'+_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x89')];_0x42c20f['body'][_0x8402('0x5e')]=_0x5d2a2c[_0x8402('0x5e')]['text'];break;case'connectel':_0x42c20f[_0x8402('0x5e')]['from']=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x88')];_0x42c20f['body'][_0x8402('0x5e')]=_0x5d2a2c[_0x8402('0x5e')]['message'];break;case _0x8402('0x8a'):_0x42c20f[_0x8402('0x5e')]['from']=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x88')];_0x42c20f[_0x8402('0x5e')]['body']=_0x5d2a2c[_0x8402('0x5e')]['body'];_0x42c20f[_0x8402('0x5e')][_0x8402('0x85')]=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x8b')];break;case _0x8402('0x8c'):_0x42c20f[_0x8402('0x5e')][_0x8402('0x88')]=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x84')];_0x42c20f[_0x8402('0x5e')]['body']=_0x5d2a2c[_0x8402('0x5e')]['Text'];_0x42c20f[_0x8402('0x5e')][_0x8402('0x85')]=_0x5d2a2c['body'][_0x8402('0x8d')];break;case _0x8402('0x8e'):_0x42c20f[_0x8402('0x5e')][_0x8402('0x88')]='+'+_0x5d2a2c[_0x8402('0x5e')]['results'][0x0][_0x8402('0x88')];_0x42c20f['body'][_0x8402('0x5e')]=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x8f')][0x0][_0x8402('0x90')];_0x42c20f['body'][_0x8402('0x85')]=_0x5d2a2c['body'][_0x8402('0x8f')][0x0][_0x8402('0x85')];break;case _0x8402('0x91'):_0x42c20f[_0x8402('0x5e')][_0x8402('0x88')]=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x92')];_0x42c20f[_0x8402('0x5e')][_0x8402('0x5e')]=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x93')][_0x8402('0x29')];break;case _0x8402('0x94'):_0x42c20f['body']['from']=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x95')];_0x42c20f[_0x8402('0x5e')][_0x8402('0x5e')]=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x90')];_0x42c20f[_0x8402('0x5e')][_0x8402('0x85')]=_0x5d2a2c[_0x8402('0x5e')][_0x8402('0x96')];break;case _0x8402('0x97'):_0x42c20f[_0x8402('0x5e')][_0x8402('0x85')]=_0x5d2a2c[_0x8402('0x5e')][0x0][_0x8402('0x29')]['id'];_0x42c20f['body'][_0x8402('0x88')]=_0x5d2a2c['body'][0x0][_0x8402('0x29')][_0x8402('0x88')];_0x42c20f[_0x8402('0x5e')][_0x8402('0x5e')]=_0x5d2a2c[_0x8402('0x5e')][0x0][_0x8402('0x29')][_0x8402('0x90')];break;case _0x8402('0x98'):_0x42c20f[_0x8402('0x5e')]['from']=_0x5d2a2c['body'][_0x8402('0x88')];_0x42c20f[_0x8402('0x5e')][_0x8402('0x5e')]=_0x5d2a2c['body'][_0x8402('0x29')];_0x42c20f[_0x8402('0x5e')][_0x8402('0x85')]=_0x5d2a2c[_0x8402('0x5e')]['refid'];break;}}if(_0x42c20f[_0x8402('0x5e')]['id']){delete _0x42c20f[_0x8402('0x5e')]['id'];}if(_[_0x8402('0x99')](_0x42c20f['body'][_0x8402('0x88')])){throw new db[(_0x8402('0x7b'))][(_0x8402('0x7c'))](_0x8402('0x9a'));}if(_[_0x8402('0x99')](_0x42c20f[_0x8402('0x5e')][_0x8402('0x5e')])||_0x42c20f[_0x8402('0x5e')][_0x8402('0x5e')]===''){throw new db[(_0x8402('0x7b'))][(_0x8402('0x7c'))](_0x8402('0x9b'));}if(_[_0x8402('0x99')](_0x42c20f[_0x8402('0x5e')][_0x8402('0x9c')])){throw new db[(_0x8402('0x7b'))][(_0x8402('0x7c'))](_0x8402('0x9d')+_0xfb129a);}if(!_[_0x8402('0x9e')](_0xfb129a,_0x42c20f[_0x8402('0x5e')][_0x8402('0x9c')])){throw new db['Sequelize'][(_0x8402('0x7c'))](_0x8402('0x9f')+_0xfb129a);}_0xc09388[_0x42c20f[_0x8402('0x5e')]['mapKey']]=_0x42c20f[_0x8402('0x5e')][_0x8402('0x88')];return db[_0x8402('0xa0')][_0x8402('0x63')]({'where':{'id':_0x42c20f['account'][_0x8402('0x82')]},'include':[{'model':db['CmContact'],'as':_0x8402('0xa1'),'where':_0xc09388,'limit':0x1,'order':[[_0x8402('0x80'),_0x8402('0xa2')]]}]});})['then'](handleEntityNotFound(_0x5a3a93,null))[_0x8402('0x21')](function(_0x4a31c5){if(_0x4a31c5){_0x42c20f[_0x8402('0xa3')]=_[_0x8402('0xa4')](_0x4a31c5,['Contacts']);if(_0x4a31c5[_0x8402('0xa1')][_0x8402('0x4e')]){return _0x4a31c5[_0x8402('0xa1')][0x0];}var _0x38ed91=_['defaults'](_0x42c20f[_0x8402('0x5e')],{'firstName':_0x42c20f['body'][_0x8402('0x88')],'ListId':_0x4a31c5['id']});_0x38ed91[_0x42c20f[_0x8402('0x5e')][_0x8402('0x9c')]]=_0x42c20f[_0x8402('0x5e')][_0x8402('0x88')];return db[_0x8402('0x7a')][_0x8402('0x5d')](_0x38ed91,{'fields':_0x2f7a03,'raw':!![]});}})[_0x8402('0x21')](handleEntityNotFound(_0x5a3a93,null))[_0x8402('0x21')](function(_0x4bf054){if(_0x4bf054){_0x42c20f['contact']=_0x4bf054;var _0xd0ba6e={'ContactId':_0x4bf054['id'],'phone':_0x42c20f[_0x8402('0x5e')][_0x8402('0x88')],'SmsAccountId':_0x5d2a2c['params']['id']};var _0x21fe24={'ContactId':_0x4bf054['id'],'SmsAccountId':_0x5d2a2c[_0x8402('0x5b')]['id'],'closed':![]};return db[_0x8402('0xa5')][_0x8402('0x63')]({'where':_0x21fe24})[_0x8402('0x21')](function(_0x1b3bff){if(_0x1b3bff){return[_0x1b3bff,![]];}return db['SmsInteraction']['create'](_0xd0ba6e)[_0x8402('0x21')](function(_0x5c58be){return[_0x5c58be,!![]];});});}})[_0x8402('0xa6')](function(_0x1e9e78,_0x187e34){_0x42c20f[_0x8402('0xa7')]=_0x1e9e78['get']({'plain':!![]});_0x42c20f[_0x8402('0xa7')][_0x8402('0xa8')]=![];if(_0x187e34){if(_0x42c20f[_0x8402('0x75')][_0x8402('0xa9')]){_0x42c20f[_0x8402('0x76')][_0x8402('0xaa')]({'id':0x0,'priority':_0x42c20f['applications']['length']+0x1,'app':_0x8402('0xab'),'appdata':_0x8402('0xac'),'interval':_0x8402('0xad')});}_0x42c20f[_0x8402('0xa7')][_0x8402('0xa8')]=!![];}return db[_0x8402('0xae')][_0x8402('0x5d')]({'phone':_0x42c20f[_0x8402('0x5e')][_0x8402('0x88')],'messageId':_0x42c20f[_0x8402('0x5e')]['messageId'],'body':_0x42c20f[_0x8402('0x5e')][_0x8402('0x5e')],'SmsAccountId':_0x5d2a2c['params']['id'],'SmsInteractionId':_0x1e9e78['id'],'direction':'in','ContactId':_0x1e9e78[_0x8402('0xaf')],'AttachmentId':_0x42c20f[_0x8402('0x5e')][_0x8402('0xb0')]});})['then'](function(_0x34ee9d){_0x42c20f[_0x8402('0x29')]=_0x34ee9d;if(_0x42c20f['interaction'][_0x8402('0xb1')]){return db[_0x8402('0xb2')]['find']({'attributes':['id',_0x8402('0x3e')],'where':{'id':_0x42c20f[_0x8402('0xa7')]['UserId']}})[_0x8402('0x21')](function(_0x1c2979){if(_0x1c2979){_0x42c20f[_0x8402('0x76')][_0x8402('0xb3')]({'id':0x0,'priority':0x0,'app':_0x8402('0xb4'),'appdata':_0x1c2979[_0x8402('0x3e')]+','+(_0x42c20f['account'][_0x8402('0xb5')]||0xa),'interval':_0x8402('0xad')});}return respondWithRpcPromise('Start',_0x8402('0xb6'),_0x42c20f);});}return respondWithRpcPromise('Start',_0x8402('0xb6'),_0x42c20f);})['then'](function(_0x194b2a){if(_0x194b2a){var _0x24de62=0xc8;var _0x462361=_0x8402('0xb7');logger[_0x8402('0x22')](_0x8402('0x25'),_0x462361,_0x24de62,'entity\x20found');logger[_0x8402('0xb8')](_0x8402('0xb9'),_0x462361,_0x24de62,'entity\x20found',JSON['stringify'](_0x194b2a));if(_0x42c20f[_0x8402('0x75')][_0x8402('0x44')]===_0x8402('0x83')){return _0x5a3a93['status'](_0x24de62)[_0x8402('0x33')](_0x8402('0xba'),'text/xml')['send'](_0x8402('0xbb'));}else{return _0x5a3a93[_0x8402('0x2c')](_0x24de62)[_0x8402('0x2e')](_0x194b2a);}}})['catch'](handleError(_0x5a3a93,null));};exports[_0x8402('0xbc')]=function(_0x24dac0,_0x7b6482){var _0x16401c=_0x24dac0[_0x8402('0x5b')]['id'];var _0xc503d8=_0x24dac0[_0x8402('0x5e')];var _0x3f04c8=0xc8;var _0x2fcdaf=null;return db[_0x8402('0xbd')][_0x8402('0xbe')]({'isolationLevel':db[_0x8402('0xbd')][_0x8402('0xbf')]['ISOLATION_LEVELS'][_0x8402('0xc0')]},function(_0x171a2c){return db[_0x8402('0x42')]['findOne']({'where':{'id':_0x16401c},'transaction':_0x171a2c})[_0x8402('0x21')](function(_0x106b29){if(_0x106b29){return db[_0x8402('0x74')][_0x8402('0x39')]({'where':{'SmsAccountId':_0x16401c},'transaction':_0x171a2c})['then'](function(){var _0x2e43cb=_['map'](_0xc503d8,function(_0x37622b){_0x37622b[_0x8402('0x67')]=_0x16401c;return _0x37622b;});return db[_0x8402('0x74')][_0x8402('0xc1')](_0x2e43cb,{'transaction':_0x171a2c});});}else{_0x3f04c8=0x194;_0x2fcdaf=[];}});})[_0x8402('0x21')](function(){if(_0x3f04c8!==0x194){return db[_0x8402('0x74')][_0x8402('0xc2')]({'where':{'SmsAccountId':_0x16401c},'order':'priority'})[_0x8402('0x21')](function(_0x122d74){_0x2fcdaf=_0x122d74;});}})[_0x8402('0x2b')](function(_0x64c45){_0x3f04c8=0x1f4;logger[_0x8402('0x27')](_0x64c45['stack']);if(_0x64c45[_0x8402('0x3e')]){delete _0x64c45[_0x8402('0x3e')];}_0x2fcdaf=_0x64c45;})['finally'](function(){if(_0x2fcdaf===null){_0x7b6482[_0x8402('0x3c')](_0x3f04c8);}else{if(_0x3f04c8===0x1f4){_0x7b6482[_0x8402('0x2c')](_0x3f04c8)[_0x8402('0xc3')](_0x2fcdaf);}else{_0x7b6482[_0x8402('0x2c')](_0x3f04c8)[_0x8402('0x2e')](_0x2fcdaf);}}});};exports[_0x8402('0xc4')]=function(_0x250398,_0x7374b1,_0x553d23){var _0x106c46={};var _0x704984={};var _0x3a7c50;var _0x53e40b;return db['SmsAccount'][_0x8402('0x69')]({'where':{'id':_0x250398[_0x8402('0x5b')]['id']}})['then'](handleEntityNotFound(_0x7374b1,null))[_0x8402('0x21')](function(_0x7cd633){if(_0x7cd633){_0x3a7c50=_0x7cd633;_0x704984[_0x8402('0x46')]=_[_0x8402('0x48')](db[_0x8402('0x74')][_0x8402('0x43')]);_0x704984[_0x8402('0x49')]=_[_0x8402('0x48')](_0x250398[_0x8402('0x49')]);_0x704984['filters']=_[_0x8402('0x4b')](_0x704984[_0x8402('0x46')],_0x704984[_0x8402('0x49')]);_0x106c46['attributes']=_[_0x8402('0x4b')](_0x704984[_0x8402('0x46')],qs[_0x8402('0x4d')](_0x250398['query'][_0x8402('0x4d')]));_0x106c46[_0x8402('0x4c')]=_0x106c46['attributes'][_0x8402('0x4e')]?_0x106c46[_0x8402('0x4c')]:_0x704984[_0x8402('0x46')];_0x106c46['order']=qs[_0x8402('0x51')](_0x250398[_0x8402('0x49')][_0x8402('0x51')]);_0x106c46['where']=qs[_0x8402('0x4a')](_['pick'](_0x250398['query'],_0x704984['filters']));if(_0x250398[_0x8402('0x49')][_0x8402('0x54')]){_0x106c46[_0x8402('0x52')]=_[_0x8402('0x55')](_0x106c46['where'],{'$or':_[_0x8402('0x47')](_0x106c46['attributes'],function(_0x5e16fd){var _0x223e15={};_0x223e15[_0x5e16fd]={'$like':'%'+_0x250398[_0x8402('0x49')][_0x8402('0x54')]+'%'};return _0x223e15;})});}_0x106c46=_[_0x8402('0x55')]({},_0x106c46,_0x250398[_0x8402('0x57')]);return _0x3a7c50[_0x8402('0xc4')](_0x106c46);}})[_0x8402('0x21')](function(_0x5b328f){if(_0x5b328f){_0x53e40b=_0x5b328f[_0x8402('0x4e')];if(!_0x250398[_0x8402('0x49')][_0x8402('0x4f')](_0x8402('0x6a'))){_0x106c46[_0x8402('0x30')]=qs[_0x8402('0x30')](_0x250398[_0x8402('0x49')][_0x8402('0x30')]);_0x106c46[_0x8402('0x32')]=qs['offset'](_0x250398[_0x8402('0x49')][_0x8402('0x32')]);}return _0x3a7c50[_0x8402('0xc4')](_0x106c46);}})[_0x8402('0x21')](function(_0x5f3eed){if(_0x5f3eed){return _0x5f3eed?{'count':_0x53e40b,'rows':_0x5f3eed}:null;}})[_0x8402('0x21')](respondWithResult(_0x7374b1,null))[_0x8402('0x2b')](handleError(_0x7374b1,null));};exports[_0x8402('0xc5')]=function(_0x18fa16,_0x59368b,_0x364f17){var _0xf605a7={'raw':![],'where':{}};var _0xc7f0be={};var _0x1492ae={'count':0x0,'rows':[]};return db[_0x8402('0x42')][_0x8402('0x69')]({'where':{'id':_0x18fa16[_0x8402('0x5b')]['id']}})[_0x8402('0x21')](handleEntityNotFound(_0x59368b,null))[_0x8402('0x21')](function(_0x390c3f){if(_0x390c3f){_0xc7f0be[_0x8402('0x46')]=_[_0x8402('0x48')](db[_0x8402('0xa5')][_0x8402('0x43')]);_0xc7f0be[_0x8402('0x49')]=_[_0x8402('0x48')](_0x18fa16[_0x8402('0x49')]);_0xc7f0be[_0x8402('0x4a')]=_[_0x8402('0x4b')](_0xc7f0be[_0x8402('0x46')],_0xc7f0be['query']);_0xf605a7['attributes']=_[_0x8402('0x4b')](_0xc7f0be[_0x8402('0x46')],qs[_0x8402('0x4d')](_0x18fa16[_0x8402('0x49')][_0x8402('0x4d')]));_0xf605a7['attributes']=_0xf605a7[_0x8402('0x4c')]['length']?_0xf605a7['attributes']:_0xc7f0be[_0x8402('0x46')];if(!_0x18fa16['query']['hasOwnProperty'](_0x8402('0x6a'))){_0xf605a7['limit']=qs[_0x8402('0x30')](_0x18fa16[_0x8402('0x49')][_0x8402('0x30')]);_0xf605a7[_0x8402('0x32')]=qs[_0x8402('0x32')](_0x18fa16['query'][_0x8402('0x32')]);}_0xf605a7[_0x8402('0x50')]=qs[_0x8402('0x51')](_0x18fa16[_0x8402('0x49')][_0x8402('0x51')]);_0xf605a7[_0x8402('0x52')]=qs[_0x8402('0x4a')](_['pick'](_0x18fa16['query'],_0xc7f0be[_0x8402('0x4a')]));_0xf605a7[_0x8402('0x52')][_0x8402('0x67')]=_0x390c3f['id'];if(_0x18fa16[_0x8402('0x49')][_0x8402('0x54')]){_0xf605a7[_0x8402('0x52')]=_[_0x8402('0x55')](_0xf605a7[_0x8402('0x52')],{'$or':_['map'](_0xf605a7['attributes'],function(_0x244eac){var _0x3b82f4={};_0x3b82f4[_0x244eac]={'$like':'%'+_0x18fa16[_0x8402('0x49')][_0x8402('0x54')]+'%'};return _0x3b82f4;})});}_0xf605a7=_[_0x8402('0x55')]({},_0xf605a7,_0x18fa16[_0x8402('0x57')]);return db[_0x8402('0xa5')][_0x8402('0x31')]({'where':_0xf605a7[_0x8402('0x52')]})[_0x8402('0x21')](function(_0x57823c){_0x1492ae['count']=_0x57823c;if(_0x18fa16[_0x8402('0x49')]['includeAll']){_0xf605a7[_0x8402('0x58')]=[{'model':db[_0x8402('0x7a')],'as':_0x8402('0xc6'),'required':![]},{'model':db[_0x8402('0xb2')],'as':'Owner','attributes':[_0x8402('0x3e'),_0x8402('0xc7'),_0x8402('0xc8')],'required':![]},{'model':db['Tag'],'as':_0x8402('0xc9'),'attributes':['id','name',_0x8402('0xca')],'where':_0x18fa16[_0x8402('0x49')]['tag']?{'id':_0x18fa16[_0x8402('0x49')][_0x8402('0xcb')]}:undefined,'required':_0x18fa16[_0x8402('0x49')][_0x8402('0xcb')]?!![]:![]}];}return db[_0x8402('0xa5')]['findAll'](_0xf605a7);})['then'](function(_0x54f693){_0x1492ae[_0x8402('0x59')]=_0x54f693;return _0x1492ae;});}})['then'](respondWithFilteredResult(_0x59368b,_0xf605a7))[_0x8402('0x2b')](handleError(_0x59368b,null));};exports[_0x8402('0xc3')]=function(_0xadf1b4,_0x565a5c,_0xcfe418){var _0x3fffc3,_0x4b9bfb,_0x12e113;if(_['isNil'](_0xadf1b4['body'][_0x8402('0x5e')])||_0xadf1b4[_0x8402('0x5e')][_0x8402('0x5e')]===''){throw new db[(_0x8402('0x7b'))][(_0x8402('0x7c'))](_0x8402('0x9b'));}if(_['isNil'](_0xadf1b4[_0x8402('0x5e')]['to'])){throw new db[(_0x8402('0x7b'))][(_0x8402('0x7c'))](_0x8402('0xcc'));}_0x3fffc3=_0xadf1b4['body']['to'];return db['SmsAccount'][_0x8402('0x63')]({'where':{'id':_0xadf1b4['params']['id']},'include':[{'model':db[_0x8402('0xa0')],'as':_0x8402('0xcd'),'include':[{'model':db[_0x8402('0x7a')],'as':'Contacts','where':{'mobile':_0x3fffc3},'limit':0x1,'order':[[_0x8402('0x80'),_0x8402('0xa2')]]}]}]})[_0x8402('0x21')](handleEntityNotFound(_0x565a5c,null))[_0x8402('0x21')](function(_0x57e7d2){if(_0x57e7d2&&_0x57e7d2[_0x8402('0xcd')]){_0x4b9bfb=_0x57e7d2[_0x8402('0x61')]({'plain':!![]});if(_0x4b9bfb[_0x8402('0xcd')]&&_0x4b9bfb[_0x8402('0xcd')][_0x8402('0xa1')][_0x8402('0x4e')]){return _0x4b9bfb[_0x8402('0xcd')]['Contacts'][0x0];}return db[_0x8402('0x7a')][_0x8402('0x5d')](_[_0x8402('0x18')](_0xadf1b4['body'],{'firstName':_0x3fffc3,'mobile':_0x3fffc3,'phone':_0x3fffc3,'ListId':_0x4b9bfb[_0x8402('0x82')]}));}})['then'](handleEntityNotFound(_0x565a5c,null))[_0x8402('0x21')](function(_0x3afad3){if(_0x3afad3){_0x12e113=_0x3afad3;return db[_0x8402('0xa5')]['find']({'where':{'ContactId':_0x12e113['id'],'closed':![],'SmsAccountId':_0x4b9bfb['id']}})['then'](function(_0x3c4dfa){if(_0x3c4dfa){return[_0x3c4dfa,![]];}return db[_0x8402('0xa5')][_0x8402('0x5d')]({'UserId':_0xadf1b4[_0x8402('0x5f')]['id'],'ContactId':_0x12e113['id'],'SmsAccountId':_0x4b9bfb['id'],'phone':_0x3fffc3,'firstMsgDirection':'out','Messages':[_[_0x8402('0x55')](_0xadf1b4['body'],{'read':![],'body':_0xadf1b4['body'][_0x8402('0x5e')],'phone':_0x3fffc3,'SmsAccountId':_0x4b9bfb['id'],'UserId':_0xadf1b4[_0x8402('0x5f')]['id'],'ContactId':_0x12e113['id']})]},{'include':[{'model':db[_0x8402('0xae')],'as':'Messages'}]})['then'](function(_0x42e94d){return[_0x42e94d,!![]];});});}})[_0x8402('0xa6')](function(_0x30b9d3,_0x45b163){if(_0x45b163){return _0x30b9d3;}return db['SmsMessage'][_0x8402('0x5d')](_[_0x8402('0x55')](_0xadf1b4['body'],{'read':![],'body':_0xadf1b4[_0x8402('0x5e')]['body'],'phone':_0x3fffc3,'SmsAccountId':_0x4b9bfb['id'],'SmsInteractionId':_0x30b9d3['id'],'UserId':_0xadf1b4[_0x8402('0x5f')]['id'],'ContactId':_0x12e113['id']}))['then'](function(_0x8b4241){_0x30b9d3[_0x8402('0xce')][_0x8402('0xcf')]=[];_0x30b9d3[_0x8402('0xce')]['Messages']['push'](_0x8b4241[_0x8402('0xce')]);return _0x30b9d3;});})[_0x8402('0x21')](respondWithResult(_0x565a5c,null))[_0x8402('0x2b')](handleError(_0x565a5c,null));};exports[_0x8402('0x2c')]=function(_0x52bd6f,_0x131bdb,_0x1607a0){if(_0x52bd6f[_0x8402('0x5e')]['id']){delete _0x52bd6f[_0x8402('0x5e')]['id'];}var _0xde203e,_0x120bd4,_0x3c3245;return db[_0x8402('0x42')][_0x8402('0x63')]({'where':{'id':_0x52bd6f[_0x8402('0x5b')]['id']}})[_0x8402('0x21')](handleEntityNotFound(_0x131bdb,null))[_0x8402('0x21')](function(_0x21a447){if(_0x21a447){_0x3c3245=_0x21a447;logger['debug'](_0x8402('0x25'),_0x8402('0x2c'),'received\x20delivery\x20report\x20from',_0x21a447['type'],util['inspect'](_0x52bd6f[_0x8402('0x5e')],{'showHidden':![],'depth':null}));switch(_0x21a447[_0x8402('0x44')]){case'skebby':if(_0x52bd6f[_0x8402('0x5e')][_0x8402('0xd0')]&&_0x52bd6f[_0x8402('0x5e')][_0x8402('0x2c')]){_0x120bd4=_0x52bd6f[_0x8402('0x5e')][_0x8402('0x2c')];return db[_0x8402('0xae')][_0x8402('0x63')]({'where':{'messageId':_0x52bd6f[_0x8402('0x5e')]['skebby_dispatch_id']}});}break;case _0x8402('0xd1'):if(_0x52bd6f[_0x8402('0x5e')]['requestid']&&_0x52bd6f[_0x8402('0x5e')][_0x8402('0xd2')]){_0x120bd4=_0x52bd6f[_0x8402('0x5e')]['statusInt'];return db[_0x8402('0xae')][_0x8402('0x63')]({'where':{'messageId':_0x52bd6f[_0x8402('0x5e')][_0x8402('0xd3')]}});}break;case _0x8402('0x8a'):if(_0x52bd6f['body']['message_id']&&_0x52bd6f[_0x8402('0x5e')][_0x8402('0xd4')]){_0x120bd4=_0x52bd6f['body'][_0x8402('0xd4')];return db[_0x8402('0xae')][_0x8402('0x63')]({'where':{'messageId':_0x52bd6f['body'][_0x8402('0x8b')]}});}break;case _0x8402('0x8e'):var _0xa301a3=_0x52bd6f[_0x8402('0x5e')][_0x8402('0x8f')][0x0];if(_0xa301a3[_0x8402('0x85')]&&_0xa301a3[_0x8402('0x2c')][_0x8402('0xd5')]===_0x8402('0xd6')){_0x120bd4=_0xa301a3[_0x8402('0x2c')]['groupName'];return db[_0x8402('0xae')][_0x8402('0x63')]({'where':{'messageId':_0xa301a3[_0x8402('0x85')]}});}break;case _0x8402('0x94'):if(_0x52bd6f[_0x8402('0x5e')][_0x8402('0x85')]&&_0x52bd6f[_0x8402('0x5e')][_0x8402('0x2c')]){_0x120bd4=_0x52bd6f[_0x8402('0x5e')][_0x8402('0x2c')];return db['SmsMessage'][_0x8402('0x63')]({'where':{'messageId':_0x52bd6f['body']['messageId']}});}break;case _0x8402('0x97'):if(_0x52bd6f[_0x8402('0x5e')][0x0][_0x8402('0x29')]['id']){_0x120bd4=_0x52bd6f[_0x8402('0x5e')][0x0][_0x8402('0x44')];return db[_0x8402('0xae')]['find']({'where':{'messageId':_0x52bd6f[_0x8402('0x5e')][0x0][_0x8402('0x29')]['id']}});}break;case _0x8402('0x98'):if(_0x52bd6f['body']['redif']&&_0x52bd6f[_0x8402('0x5e')][_0x8402('0x2c')]){_0x120bd4=_0x52bd6f['body'][_0x8402('0x2c')];return db[_0x8402('0xae')][_0x8402('0x63')]({'where':{'messageId':_0x52bd6f[_0x8402('0x5e')][_0x8402('0xd7')]}});}break;}}})[_0x8402('0x21')](handleEntityNotFound(_0x131bdb,null))[_0x8402('0x21')](function(_0x27e9ef){if(_0x27e9ef){_0xde203e=_0x27e9ef;switch(_0x3c3245[_0x8402('0x44')]){case _0x8402('0x87'):if(_0x120bd4===_0x8402('0xd6')){return _0xde203e[_0x8402('0x38')]({'read':!![]});}else{logger[_0x8402('0x27')](_0x8402('0x25'),_0x8402('0x2c'),_0x8402('0x87'),util[_0x8402('0xd8')](_0x52bd6f[_0x8402('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x8402('0xd1'):if(_0x120bd4==='1'){return _0xde203e[_0x8402('0x38')]({'read':!![]});}else{logger[_0x8402('0x27')](_0x8402('0x25'),_0x8402('0x2c'),_0x8402('0x87'),util[_0x8402('0xd8')](_0x52bd6f[_0x8402('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x8402('0x8a'):if(!_0x52bd6f[_0x8402('0x5e')][_0x8402('0xd9')]&&_0x120bd4>=0xc8&&_0x120bd4<=0xce){return _0xde203e[_0x8402('0x38')]({'read':!![]});}else{logger[_0x8402('0x27')](_0x8402('0x25'),'status',_0x8402('0x8a'),util[_0x8402('0xd8')](_0x52bd6f['body'],{'showHidden':![],'depth':null}));}break;case _0x8402('0x8e'):var _0x70a4c4=_0x52bd6f['body']['results'][0x0];if(_0x70a4c4[_0x8402('0x2c')][_0x8402('0xd5')]==='DELIVERED'){return _0xde203e[_0x8402('0x38')]({'read':!![]});}else{logger[_0x8402('0x27')](_0x8402('0x25'),'status','infobip',util[_0x8402('0xd8')](_0x52bd6f[_0x8402('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x8402('0x94'):if(_0x120bd4=='DELIVERED_TO_GATEWAY'||_0x120bd4==_0x8402('0xda')){return _0xde203e['update']({'read':!![]});}else{logger[_0x8402('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8402('0x2c'),_0x8402('0x94'),util[_0x8402('0xd8')](_0x52bd6f[_0x8402('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x8402('0x97'):if(_0x120bd4==_0x8402('0xdb')){return _0xde203e[_0x8402('0x38')]({'read':!![]});}else{logger[_0x8402('0x27')](_0x8402('0x25'),'status',_0x8402('0x97'),util[_0x8402('0xd8')](_0x52bd6f['body'],{'showHidden':![],'depth':null}));}break;case _0x8402('0x98'):if(_0x120bd4===_0x8402('0xdc')||_0x120bd4===_0x8402('0xdd')){return _0xde203e[_0x8402('0x38')]({'read':!![]});}else{logger['error'](_0x8402('0x25'),_0x8402('0x2c'),_0x8402('0x98'),util[_0x8402('0xd8')](_0x52bd6f['body'],{'showHidden':![],'depth':null}));}break;}return _0xde203e;}})[_0x8402('0x21')](respondWithResult(_0x131bdb,null))[_0x8402('0x2b')](handleError(_0x131bdb,null));};exports[_0x8402('0xde')]=function(_0x501f47,_0x189593,_0x762072){var _0x528fea,_0x7153c,_0x38c3e4;return db[_0x8402('0x42')][_0x8402('0x63')]({'where':{'id':_0x501f47[_0x8402('0x5b')]['id']}})[_0x8402('0x21')](handleEntityNotFound(_0x189593,null))['then'](function(_0x33abf9){if(_0x33abf9){_0x38c3e4=_0x33abf9;logger[_0x8402('0xb8')](_0x8402('0x25'),_0x8402('0x2c'),'received\x20delivery\x20report\x20from',_0x33abf9[_0x8402('0x44')],util[_0x8402('0xd8')](_0x501f47[_0x8402('0x49')],{'showHidden':![],'depth':null}));switch(_0x33abf9[_0x8402('0x44')]){case _0x8402('0x91'):if(_0x501f47[_0x8402('0x49')]['message-id']&&_0x501f47['query'][_0x8402('0xdf')]){_0x7153c=_0x501f47[_0x8402('0x49')][_0x8402('0xdf')];return db[_0x8402('0xae')][_0x8402('0x63')]({'where':{'messageId':_0x501f47[_0x8402('0x49')][_0x8402('0xe0')]}});}break;}}})['then'](handleEntityNotFound(_0x189593,null))[_0x8402('0x21')](function(_0x106874){if(_0x106874){_0x528fea=_0x106874;switch(_0x38c3e4[_0x8402('0x44')]){case _0x8402('0x91'):if(_0x7153c==='2'||_0x7153c==='6'){return _0x528fea['update']({'read':!![]});}else{logger[_0x8402('0x27')](_0x8402('0x25'),_0x8402('0x2c'),_0x8402('0x91'),util[_0x8402('0xd8')](_0x501f47[_0x8402('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x528fea;}})[_0x8402('0x21')](respondWithResult(_0x189593,null))[_0x8402('0x2b')](handleError(_0x189593,null));};exports[_0x8402('0xe1')]=function(_0x5ec097,_0x3cb7c6,_0x4fef74){return db['SmsAccount']['find']({'where':{'id':_0x5ec097[_0x8402('0x5b')]['id']}})[_0x8402('0x21')](handleEntityNotFound(_0x3cb7c6,null))[_0x8402('0x21')](function(_0x16f2ad){if(_0x16f2ad){return _0x16f2ad['addAgents'](_0x5ec097[_0x8402('0x5e')]['ids'],_[_0x8402('0xa4')](_0x5ec097[_0x8402('0x5e')],[_0x8402('0x6d'),'id'])||{})['spread'](function(_0x3110bd){for(var _0x2241a6=0x0;_0x2241a6<_0x5ec097[_0x8402('0x5e')]['ids'][_0x8402('0x4e')];_0x2241a6+=0x1){socket[_0x8402('0xe2')](_0x8402('0xe3'),{'UserId':Number(_0x5ec097[_0x8402('0x5e')][_0x8402('0x6d')][_0x2241a6]),'SmsAccountId':Number(_0x5ec097[_0x8402('0x5b')]['id'])});}return _0x3110bd;});}})[_0x8402('0x21')](respondWithResult(_0x3cb7c6,null))[_0x8402('0x2b')](handleError(_0x3cb7c6,null));};exports['removeAgents']=function(_0x59596a,_0x5f45b0,_0x34f0d5){return db[_0x8402('0x42')][_0x8402('0x63')]({'where':{'id':_0x59596a[_0x8402('0x5b')]['id']}})[_0x8402('0x21')](handleEntityNotFound(_0x5f45b0,null))[_0x8402('0x21')](function(_0x1c3cc4){if(_0x1c3cc4){return _0x1c3cc4[_0x8402('0xe4')](_0x59596a[_0x8402('0x49')][_0x8402('0x6d')])[_0x8402('0x21')](function(){if(_['isArray'](_0x59596a[_0x8402('0x49')][_0x8402('0x6d')])){for(var _0x5e08df=0x0;_0x5e08df<_0x59596a[_0x8402('0x49')]['ids'][_0x8402('0x4e')];_0x5e08df+=0x1){socket[_0x8402('0xe2')](_0x8402('0xe5'),{'UserId':Number(_0x59596a['query'][_0x8402('0x6d')][_0x5e08df]),'SmsAccountId':Number(_0x59596a[_0x8402('0x5b')]['id'])});}}else{socket[_0x8402('0xe2')](_0x8402('0xe5'),{'UserId':Number(_0x59596a[_0x8402('0x49')][_0x8402('0x6d')]),'SmsAccountId':Number(_0x59596a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5f45b0,null))[_0x8402('0x2b')](handleError(_0x5f45b0,null));};exports[_0x8402('0xe6')]=function(_0x159d91,_0x14d7e6,_0x4ffc9c){var _0x3c5189={};var _0x1b5e08={};var _0x1174a9;var _0x4bd43b;return db[_0x8402('0x42')][_0x8402('0x69')]({'where':{'id':_0x159d91[_0x8402('0x5b')]['id']}})[_0x8402('0x21')](handleEntityNotFound(_0x14d7e6,null))[_0x8402('0x21')](function(_0x5300bc){if(_0x5300bc){_0x1174a9=_0x5300bc;_0x1b5e08[_0x8402('0x46')]=_['keys'](db[_0x8402('0xb2')][_0x8402('0x43')]);_0x1b5e08[_0x8402('0x49')]=_[_0x8402('0x48')](_0x159d91[_0x8402('0x49')]);_0x1b5e08[_0x8402('0x4a')]=_[_0x8402('0x4b')](_0x1b5e08[_0x8402('0x46')],_0x1b5e08['query']);_0x3c5189['attributes']=_[_0x8402('0x4b')](_0x1b5e08[_0x8402('0x46')],qs[_0x8402('0x4d')](_0x159d91['query']['fields']));_0x3c5189[_0x8402('0x4c')]=_0x3c5189[_0x8402('0x4c')][_0x8402('0x4e')]?_0x3c5189[_0x8402('0x4c')]:_0x1b5e08[_0x8402('0x46')];_0x3c5189[_0x8402('0x50')]=qs['sort'](_0x159d91[_0x8402('0x49')]['sort']);_0x3c5189[_0x8402('0x52')]=qs[_0x8402('0x4a')](_['pick'](_0x159d91[_0x8402('0x49')],_0x1b5e08[_0x8402('0x4a')]));if(_0x159d91['query'][_0x8402('0x54')]){_0x3c5189['where']=_[_0x8402('0x55')](_0x3c5189[_0x8402('0x52')],{'$or':_[_0x8402('0x47')](_0x3c5189['attributes'],function(_0x2fc1e8){var _0x20234b={};_0x20234b[_0x2fc1e8]={'$like':'%'+_0x159d91['query'][_0x8402('0x54')]+'%'};return _0x20234b;})});}_0x3c5189=_[_0x8402('0x55')]({},_0x3c5189,_0x159d91[_0x8402('0x57')]);return _0x1174a9[_0x8402('0xe6')](_0x3c5189);}})[_0x8402('0x21')](function(_0x2f7ca6){if(_0x2f7ca6){_0x4bd43b=_0x2f7ca6['length'];if(!_0x159d91[_0x8402('0x49')][_0x8402('0x4f')]('nolimit')){_0x3c5189[_0x8402('0x30')]=qs[_0x8402('0x30')](_0x159d91[_0x8402('0x49')][_0x8402('0x30')]);_0x3c5189['offset']=qs[_0x8402('0x32')](_0x159d91[_0x8402('0x49')][_0x8402('0x32')]);}return _0x1174a9['getAgents'](_0x3c5189);}})['then'](function(_0xac3a82){if(_0xac3a82){return _0xac3a82?{'count':_0x4bd43b,'rows':_0xac3a82}:null;}})[_0x8402('0x21')](respondWithResult(_0x14d7e6,null))[_0x8402('0x2b')](handleError(_0x14d7e6,null));}; \ No newline at end of file +var _0x49cf=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','SmsAccount','findAll','rows','show','params','Pause','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','findOne','hasOwnProperty','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','SmsApplication','account','orderBy','Applications','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','clicksend','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','text','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','applications','push','unmanaged','*,*,*,*','SmsMessage','ContactId','User','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Tag','Tags','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','message-delivered','DELIVRD','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4a7a82,_0x1e3650){var _0x4c986b=function(_0x17a7cf){while(--_0x17a7cf){_0x4a7a82['push'](_0x4a7a82['shift']());}};_0x4c986b(++_0x1e3650);}(_0x49cf,0xb4));var _0xf49c=function(_0x3bbdf5,_0x22eb38){_0x3bbdf5=_0x3bbdf5-0x0;var _0x48cb02=_0x49cf[_0x3bbdf5];return _0x48cb02;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf49c('0x0'));var zipdir=require(_0xf49c('0x1'));var jsonpatch=require(_0xf49c('0x2'));var rp=require(_0xf49c('0x3'));var moment=require(_0xf49c('0x4'));var BPromise=require(_0xf49c('0x5'));var Mustache=require(_0xf49c('0x6'));var util=require(_0xf49c('0x7'));var path=require(_0xf49c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf49c('0x9'));var _=require('lodash');var squel=require(_0xf49c('0xa'));var crypto=require(_0xf49c('0xb'));var jsforce=require(_0xf49c('0xc'));var deskjs=require(_0xf49c('0xd'));var toCsv=require(_0xf49c('0xe'));var querystring=require(_0xf49c('0xf'));var Papa=require(_0xf49c('0x10'));var Redis=require(_0xf49c('0x11'));var authService=require(_0xf49c('0x12'));var qs=require(_0xf49c('0x13'));var as=require(_0xf49c('0x14'));var hardwareService=require(_0xf49c('0x15'));var logger=require('../../config/logger')(_0xf49c('0x16'));var utils=require(_0xf49c('0x17'));var config=require(_0xf49c('0x18'));var licenseUtil=require(_0xf49c('0x19'));var db=require(_0xf49c('0x1a'))['db'];config[_0xf49c('0x1b')]=_[_0xf49c('0x1c')](config[_0xf49c('0x1b')],{'host':_0xf49c('0x1d'),'port':0x18eb});var socket=require(_0xf49c('0x1e'))(new Redis(config[_0xf49c('0x1b')]));require('./smsAccount.socket')[_0xf49c('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf49c('0x20')][_0xf49c('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x54d6f4,_0x1e19a2,_0x4215fa,_0x30543c){return new BPromise(function(_0x34fc86,_0x526d08){var _0x55cd5b=_0x30543c||client;return _0x55cd5b['request'](_0x54d6f4,_0x4215fa)['then'](function(_0xac835a){logger[_0xf49c('0x22')](_0xf49c('0x23'),_0x1e19a2,_0xf49c('0x24'));logger[_0xf49c('0x25')](_0xf49c('0x26'),_0x1e19a2,_0xf49c('0x24'),JSON[_0xf49c('0x27')](_0xac835a));if(_0xac835a[_0xf49c('0x28')]){if(_0xac835a[_0xf49c('0x28')][_0xf49c('0x29')]===0x1f4){logger[_0xf49c('0x28')]('SmsAccount,\x20%s,\x20%s',_0x1e19a2,_0xac835a[_0xf49c('0x28')][_0xf49c('0x2a')]);return _0x526d08(_0xac835a[_0xf49c('0x28')][_0xf49c('0x2a')]);}logger[_0xf49c('0x28')](_0xf49c('0x23'),_0x1e19a2,_0xac835a[_0xf49c('0x28')][_0xf49c('0x2a')]);return _0x34fc86(_0xac835a[_0xf49c('0x28')][_0xf49c('0x2a')]);}else{logger[_0xf49c('0x22')]('SmsAccount,\x20%s,\x20%s',_0x1e19a2,_0xf49c('0x24'));_0x34fc86(_0xac835a['result']['message']);}})[_0xf49c('0x2b')](function(_0x19563e){logger['error']('SmsAccount,\x20%s,\x20%s',_0x1e19a2,_0x19563e);_0x526d08(_0x19563e);});});}function respondWithStatusCode(_0xc7d206,_0x4fb3ce){_0x4fb3ce=_0x4fb3ce||0xcc;return function(_0x42a72c){if(_0x42a72c){return _0xc7d206[_0xf49c('0x2c')](_0x4fb3ce);}return _0xc7d206[_0xf49c('0x2d')](_0x4fb3ce)[_0xf49c('0x2e')]();};}function respondWithResult(_0x52e1e9,_0x4316c7){_0x4316c7=_0x4316c7||0xc8;return function(_0x5b04d5){if(_0x5b04d5){return _0x52e1e9[_0xf49c('0x2d')](_0x4316c7)[_0xf49c('0x2f')](_0x5b04d5);}};}function respondWithFilteredResult(_0x4bb829,_0x5354e9){return function(_0x3b82f1){if(_0x3b82f1){var _0xe8f84a=typeof _0x5354e9[_0xf49c('0x30')]===_0xf49c('0x31')&&typeof _0x5354e9[_0xf49c('0x32')]===_0xf49c('0x31');var _0x34856e=_0x3b82f1[_0xf49c('0x33')];var _0x318441=_0xe8f84a?0x0:_0x5354e9['offset'];var _0x364377=_0xe8f84a?_0x3b82f1['count']:_0x5354e9[_0xf49c('0x30')]+_0x5354e9['limit'];var _0x20b8ee;if(_0x364377>=_0x34856e){_0x364377=_0x34856e;_0x20b8ee=0xc8;}else{_0x20b8ee=0xce;}_0x4bb829['status'](_0x20b8ee);return _0x4bb829[_0xf49c('0x34')](_0xf49c('0x35'),_0x318441+'-'+_0x364377+'/'+_0x34856e)['json'](_0x3b82f1);}return null;};}function patchUpdates(_0x607960){return function(_0x4a0c09){try{jsonpatch[_0xf49c('0x36')](_0x4a0c09,_0x607960,!![]);}catch(_0x3f0ea6){return BPromise['reject'](_0x3f0ea6);}return _0x4a0c09['save']();};}function saveUpdates(_0x665e3,_0x560009){return function(_0x2e40ab){if(_0x2e40ab){return _0x2e40ab[_0xf49c('0x37')](_0x665e3)[_0xf49c('0x38')](function(_0x540460){return _0x540460;});}return null;};}function removeEntity(_0x347642,_0x164b32){return function(_0xb5843){if(_0xb5843){return _0xb5843[_0xf49c('0x39')]()[_0xf49c('0x38')](function(){var _0x2b14e3=_0xb5843[_0xf49c('0x3a')]({'plain':!![]});var _0x19367c=_0xf49c('0x3b');return db[_0xf49c('0x3c')][_0xf49c('0x39')]({'where':{'type':_0x19367c,'resourceId':_0x2b14e3['id']}})[_0xf49c('0x38')](function(){return _0xb5843;});})[_0xf49c('0x38')](function(){_0x347642[_0xf49c('0x2d')](0xcc)[_0xf49c('0x2e')]();});}};}function handleEntityNotFound(_0x49932b,_0x576a6f){return function(_0xb498f0){if(!_0xb498f0){_0x49932b[_0xf49c('0x2c')](0x194);}return _0xb498f0;};}function handleError(_0x267a2b,_0x174330){_0x174330=_0x174330||0x1f4;return function(_0x2373cb){logger[_0xf49c('0x28')](_0x2373cb[_0xf49c('0x3d')]);if(_0x2373cb[_0xf49c('0x3e')]){delete _0x2373cb['name'];}_0x267a2b[_0xf49c('0x2d')](_0x174330)[_0xf49c('0x3f')](_0x2373cb);};}exports[_0xf49c('0x40')]=function(_0x41fea1,_0x3db1d4){var _0x11d2f1={'include':[{'model':db['Pause'],'as':_0xf49c('0x41')}]},_0x4054ca={},_0x4b1305={'count':0x0,'rows':[]};var _0x1c8119=_[_0xf49c('0x42')](db['SmsAccount'][_0xf49c('0x43')],function(_0x2b5fa3){return{'name':_0x2b5fa3['fieldName'],'type':_0x2b5fa3[_0xf49c('0x44')]['key']};});_0x4054ca[_0xf49c('0x45')]=_[_0xf49c('0x42')](_0x1c8119,_0xf49c('0x3e'));_0x4054ca['query']=_['keys'](_0x41fea1[_0xf49c('0x46')]);_0x4054ca[_0xf49c('0x47')]=_[_0xf49c('0x48')](_0x4054ca['model'],_0x4054ca[_0xf49c('0x46')]);_0x11d2f1[_0xf49c('0x49')]=_[_0xf49c('0x48')](_0x4054ca[_0xf49c('0x45')],qs[_0xf49c('0x4a')](_0x41fea1[_0xf49c('0x46')][_0xf49c('0x4a')]));_0x11d2f1[_0xf49c('0x49')]=_0x11d2f1[_0xf49c('0x49')][_0xf49c('0x4b')]?_0x11d2f1['attributes']:_0x4054ca['model'];if(!_0x41fea1[_0xf49c('0x46')]['hasOwnProperty'](_0xf49c('0x4c'))){_0x11d2f1[_0xf49c('0x32')]=qs['limit'](_0x41fea1[_0xf49c('0x46')]['limit']);_0x11d2f1['offset']=qs[_0xf49c('0x30')](_0x41fea1[_0xf49c('0x46')]['offset']);}_0x11d2f1[_0xf49c('0x4d')]=qs[_0xf49c('0x4e')](_0x41fea1[_0xf49c('0x46')][_0xf49c('0x4e')]);_0x11d2f1[_0xf49c('0x4f')]=qs['filters'](_[_0xf49c('0x50')](_0x41fea1['query'],_0x4054ca[_0xf49c('0x47')]),_0x1c8119);if(_0x41fea1['query'][_0xf49c('0x51')]){_0x11d2f1[_0xf49c('0x4f')]=_[_0xf49c('0x52')](_0x11d2f1[_0xf49c('0x4f')],{'$or':_[_0xf49c('0x42')](_0x1c8119,function(_0x4d302e){if(_0x4d302e[_0xf49c('0x44')]!=='VIRTUAL'){var _0x46d330={};_0x46d330[_0x4d302e[_0xf49c('0x3e')]]={'$like':'%'+_0x41fea1[_0xf49c('0x46')][_0xf49c('0x51')]+'%'};return _0x46d330;}})});}_0x11d2f1=_['merge']({},_0x11d2f1,_0x41fea1[_0xf49c('0x53')]);var _0x518a11={'where':_0x11d2f1[_0xf49c('0x4f')]};return db['SmsAccount']['count'](_0x518a11)[_0xf49c('0x38')](function(_0x1e42a1){_0x4b1305[_0xf49c('0x33')]=_0x1e42a1;if(_0x41fea1[_0xf49c('0x46')][_0xf49c('0x54')]){_0x11d2f1[_0xf49c('0x55')]=[{'all':!![]}];}return db[_0xf49c('0x56')][_0xf49c('0x57')](_0x11d2f1);})[_0xf49c('0x38')](function(_0x168ea2){_0x4b1305[_0xf49c('0x58')]=_0x168ea2;return _0x4b1305;})[_0xf49c('0x38')](respondWithFilteredResult(_0x3db1d4,_0x11d2f1))['catch'](handleError(_0x3db1d4,null));};exports[_0xf49c('0x59')]=function(_0x108b27,_0x32fcac){var _0x3e6ee2={'raw':![],'where':{'id':_0x108b27[_0xf49c('0x5a')]['id']},'include':[{'model':db[_0xf49c('0x5b')],'as':'mandatoryDispositionPause'}]},_0x5b01ed={};_0x5b01ed[_0xf49c('0x45')]=_[_0xf49c('0x5c')](db[_0xf49c('0x56')][_0xf49c('0x43')]);_0x5b01ed['query']=_[_0xf49c('0x5c')](_0x108b27[_0xf49c('0x46')]);_0x5b01ed[_0xf49c('0x47')]=_[_0xf49c('0x48')](_0x5b01ed[_0xf49c('0x45')],_0x5b01ed['query']);_0x3e6ee2[_0xf49c('0x49')]=_['intersection'](_0x5b01ed[_0xf49c('0x45')],qs['fields'](_0x108b27[_0xf49c('0x46')][_0xf49c('0x4a')]));_0x3e6ee2['attributes']=_0x3e6ee2[_0xf49c('0x49')][_0xf49c('0x4b')]?_0x3e6ee2[_0xf49c('0x49')]:_0x5b01ed['model'];if(_0x108b27[_0xf49c('0x46')]['includeAll']){_0x3e6ee2[_0xf49c('0x55')]=[{'all':!![]}];}_0x3e6ee2=_[_0xf49c('0x52')]({},_0x3e6ee2,_0x108b27[_0xf49c('0x53')]);return db[_0xf49c('0x56')][_0xf49c('0x5d')](_0x3e6ee2)[_0xf49c('0x38')](handleEntityNotFound(_0x32fcac,null))[_0xf49c('0x38')](respondWithResult(_0x32fcac,null))['catch'](handleError(_0x32fcac,null));};exports['create']=function(_0xd886c5,_0x11677f){return db[_0xf49c('0x56')]['create'](_0xd886c5[_0xf49c('0x5e')],{})[_0xf49c('0x38')](function(_0x3fe102){var _0x108994=_0xd886c5[_0xf49c('0x5f')]['get']({'plain':!![]});if(!_0x108994)throw new Error(_0xf49c('0x60'));if(_0x108994[_0xf49c('0x61')]===_0xf49c('0x5f')){var _0x2c0c2f=_0x3fe102[_0xf49c('0x3a')]({'plain':!![]});var _0x59efbc='SmsAccounts';return db[_0xf49c('0x62')]['find']({'where':{'name':_0x59efbc,'userProfileId':_0x108994[_0xf49c('0x63')]},'raw':!![]})[_0xf49c('0x38')](function(_0x5688ae){if(_0x5688ae&&_0x5688ae['autoAssociation']===0x0){return db[_0xf49c('0x3c')][_0xf49c('0x64')]({'name':_0x2c0c2f[_0xf49c('0x3e')],'resourceId':_0x2c0c2f['id'],'type':_0x5688ae[_0xf49c('0x3e')],'sectionId':_0x5688ae['id']},{})[_0xf49c('0x38')](function(){return _0x3fe102;});}else{return _0x3fe102;}})[_0xf49c('0x2b')](function(_0x43c725){logger[_0xf49c('0x28')](_0xf49c('0x65'),_0x43c725);throw _0x43c725;});}return _0x3fe102;})['then'](respondWithResult(_0x11677f,0xc9))[_0xf49c('0x2b')](handleError(_0x11677f,null));};exports[_0xf49c('0x37')]=function(_0x1ef783,_0x3beafd){if(_0x1ef783['body']['id']){delete _0x1ef783[_0xf49c('0x5e')]['id'];}return db[_0xf49c('0x56')]['find']({'where':{'id':_0x1ef783[_0xf49c('0x5a')]['id']},'include':[{'model':db[_0xf49c('0x5b')],'as':'mandatoryDispositionPause'}]})[_0xf49c('0x38')](handleEntityNotFound(_0x3beafd,null))[_0xf49c('0x38')](saveUpdates(_0x1ef783['body'],null))['then'](respondWithResult(_0x3beafd,null))[_0xf49c('0x2b')](handleError(_0x3beafd,null));};exports['destroy']=function(_0x5cbedb,_0x26628f){return db[_0xf49c('0x56')][_0xf49c('0x5d')]({'where':{'id':_0x5cbedb[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x26628f,null))[_0xf49c('0x38')](removeEntity(_0x26628f,null))[_0xf49c('0x2b')](handleError(_0x26628f,null));};exports['describe']=function(_0x2bcb54,_0x507571){return db['SmsAccount'][_0xf49c('0x66')]()[_0xf49c('0x38')](respondWithResult(_0x507571,null))[_0xf49c('0x2b')](handleError(_0x507571,null));};exports[_0xf49c('0x67')]=function(_0x4b435b,_0x5ef34f,_0x1aed34){if(_0x4b435b[_0xf49c('0x5e')]['id']){delete _0x4b435b['body']['id'];}return db[_0xf49c('0x56')][_0xf49c('0x5d')]({'where':{'id':_0x4b435b[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x5ef34f,null))[_0xf49c('0x38')](function(_0x55c72c){if(_0x55c72c){_0x4b435b[_0xf49c('0x5e')][_0xf49c('0x68')]=_0x55c72c['id'];return db['Disposition'][_0xf49c('0x64')](_0x4b435b[_0xf49c('0x5e')]);}})['then'](respondWithResult(_0x5ef34f,null))[_0xf49c('0x2b')](handleError(_0x5ef34f,null));};exports[_0xf49c('0x69')]=function(_0x2bd16e,_0x33f957,_0x16a460){var _0x22bd52={'raw':![],'where':{}};var _0x405838={};var _0x1ea289={'count':0x0,'rows':[]};return db[_0xf49c('0x56')][_0xf49c('0x6a')]({'where':{'id':_0x2bd16e[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x33f957,null))[_0xf49c('0x38')](function(_0x558f58){if(_0x558f58){_0x405838['model']=_[_0xf49c('0x5c')](db['Disposition'][_0xf49c('0x43')]);_0x405838[_0xf49c('0x46')]=_[_0xf49c('0x5c')](_0x2bd16e[_0xf49c('0x46')]);_0x405838[_0xf49c('0x47')]=_[_0xf49c('0x48')](_0x405838[_0xf49c('0x45')],_0x405838[_0xf49c('0x46')]);_0x22bd52['attributes']=_[_0xf49c('0x48')](_0x405838[_0xf49c('0x45')],qs[_0xf49c('0x4a')](_0x2bd16e[_0xf49c('0x46')][_0xf49c('0x4a')]));_0x22bd52[_0xf49c('0x49')]=_0x22bd52[_0xf49c('0x49')]['length']?_0x22bd52[_0xf49c('0x49')]:_0x405838['model'];if(!_0x2bd16e['query'][_0xf49c('0x6b')](_0xf49c('0x4c'))){_0x22bd52[_0xf49c('0x32')]=qs[_0xf49c('0x32')](_0x2bd16e['query'][_0xf49c('0x32')]);_0x22bd52[_0xf49c('0x30')]=qs[_0xf49c('0x30')](_0x2bd16e[_0xf49c('0x46')][_0xf49c('0x30')]);}_0x22bd52[_0xf49c('0x4d')]=qs['sort'](_0x2bd16e[_0xf49c('0x46')][_0xf49c('0x4e')]);_0x22bd52[_0xf49c('0x4f')]=qs[_0xf49c('0x47')](_[_0xf49c('0x50')](_0x2bd16e[_0xf49c('0x46')],_0x405838[_0xf49c('0x47')]));_0x22bd52[_0xf49c('0x4f')][_0xf49c('0x68')]=_0x558f58['id'];if(_0x2bd16e['query']['filter']){_0x22bd52['where']=_[_0xf49c('0x52')](_0x22bd52[_0xf49c('0x4f')],{'$or':_['map'](_0x22bd52[_0xf49c('0x49')],function(_0x5a5c21){var _0x4d943b={};_0x4d943b[_0x5a5c21]={'$like':'%'+_0x2bd16e[_0xf49c('0x46')]['filter']+'%'};return _0x4d943b;})});}_0x22bd52=_[_0xf49c('0x52')]({},_0x22bd52,_0x2bd16e['options']);return db[_0xf49c('0x6c')][_0xf49c('0x33')]({'where':_0x22bd52[_0xf49c('0x4f')]})['then'](function(_0x2a8cc0){_0x1ea289['count']=_0x2a8cc0;if(_0x2bd16e[_0xf49c('0x46')]['includeAll']){_0x22bd52[_0xf49c('0x55')]=[{'all':!![]}];}return db[_0xf49c('0x6c')][_0xf49c('0x57')](_0x22bd52);})[_0xf49c('0x38')](function(_0x50d42c){_0x1ea289['rows']=_0x50d42c;return _0x1ea289;});}})[_0xf49c('0x38')](respondWithFilteredResult(_0x33f957,_0x22bd52))[_0xf49c('0x2b')](handleError(_0x33f957,null));};exports[_0xf49c('0x6d')]=function(_0xad0638,_0x9a6e1f,_0x1d1e8d){return db[_0xf49c('0x56')]['find']({'where':{'id':_0xad0638[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x9a6e1f,null))['then'](function(_0x579930){if(_0x579930){return _0x579930[_0xf49c('0x6d')](_0xad0638[_0xf49c('0x46')]['ids']);}})[_0xf49c('0x38')](respondWithStatusCode(_0x9a6e1f,null))[_0xf49c('0x2b')](handleError(_0x9a6e1f,null));};exports[_0xf49c('0x6e')]=function(_0x2fe882,_0x4af28b,_0x1e3a89){if(_0x2fe882[_0xf49c('0x5e')]['id']){delete _0x2fe882['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x2fe882[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x4af28b,null))['then'](function(_0x1bdecb){if(_0x1bdecb){_0x2fe882[_0xf49c('0x5e')][_0xf49c('0x68')]=_0x1bdecb['id'];return db[_0xf49c('0x6f')][_0xf49c('0x64')](_0x2fe882['body']);}})[_0xf49c('0x38')](respondWithResult(_0x4af28b,null))['catch'](handleError(_0x4af28b,null));};exports[_0xf49c('0x70')]=function(_0x2a76b6,_0x173ea3,_0x429f60){var _0x41f089={'raw':![],'where':{}};var _0x60b014={};var _0x2ef3a0={'count':0x0,'rows':[]};return db['SmsAccount'][_0xf49c('0x6a')]({'where':{'id':_0x2a76b6[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x173ea3,null))[_0xf49c('0x38')](function(_0x19c724){if(_0x19c724){_0x60b014[_0xf49c('0x45')]=_[_0xf49c('0x5c')](db[_0xf49c('0x6f')][_0xf49c('0x43')]);_0x60b014['query']=_[_0xf49c('0x5c')](_0x2a76b6['query']);_0x60b014[_0xf49c('0x47')]=_[_0xf49c('0x48')](_0x60b014[_0xf49c('0x45')],_0x60b014[_0xf49c('0x46')]);_0x41f089[_0xf49c('0x49')]=_[_0xf49c('0x48')](_0x60b014[_0xf49c('0x45')],qs[_0xf49c('0x4a')](_0x2a76b6[_0xf49c('0x46')][_0xf49c('0x4a')]));_0x41f089[_0xf49c('0x49')]=_0x41f089[_0xf49c('0x49')][_0xf49c('0x4b')]?_0x41f089['attributes']:_0x60b014[_0xf49c('0x45')];if(!_0x2a76b6[_0xf49c('0x46')][_0xf49c('0x6b')](_0xf49c('0x4c'))){_0x41f089[_0xf49c('0x32')]=qs[_0xf49c('0x32')](_0x2a76b6['query'][_0xf49c('0x32')]);_0x41f089[_0xf49c('0x30')]=qs[_0xf49c('0x30')](_0x2a76b6['query'][_0xf49c('0x30')]);}_0x41f089[_0xf49c('0x4d')]=qs[_0xf49c('0x4e')](_0x2a76b6[_0xf49c('0x46')][_0xf49c('0x4e')]);_0x41f089['where']=qs[_0xf49c('0x47')](_[_0xf49c('0x50')](_0x2a76b6[_0xf49c('0x46')],_0x60b014[_0xf49c('0x47')]));_0x41f089[_0xf49c('0x4f')][_0xf49c('0x68')]=_0x19c724['id'];if(_0x2a76b6[_0xf49c('0x46')]['filter']){_0x41f089[_0xf49c('0x4f')]=_[_0xf49c('0x52')](_0x41f089[_0xf49c('0x4f')],{'$or':_['map'](_0x41f089[_0xf49c('0x49')],function(_0x2c8b58){var _0x53dab2={};_0x53dab2[_0x2c8b58]={'$like':'%'+_0x2a76b6[_0xf49c('0x46')]['filter']+'%'};return _0x53dab2;})});}_0x41f089=_['merge']({},_0x41f089,_0x2a76b6[_0xf49c('0x53')]);return db[_0xf49c('0x6f')][_0xf49c('0x33')]({'where':_0x41f089[_0xf49c('0x4f')]})['then'](function(_0x3e9b9c){_0x2ef3a0[_0xf49c('0x33')]=_0x3e9b9c;if(_0x2a76b6['query'][_0xf49c('0x54')]){_0x41f089['include']=[{'all':!![]}];}return db[_0xf49c('0x6f')][_0xf49c('0x57')](_0x41f089);})[_0xf49c('0x38')](function(_0x13bd1a){_0x2ef3a0[_0xf49c('0x58')]=_0x13bd1a;return _0x2ef3a0;});}})[_0xf49c('0x38')](respondWithFilteredResult(_0x173ea3,_0x41f089))[_0xf49c('0x2b')](handleError(_0x173ea3,null));};exports[_0xf49c('0x71')]=function(_0x16b0d6,_0x55a50e,_0x1b6fac){return db[_0xf49c('0x56')][_0xf49c('0x5d')]({'where':{'id':_0x16b0d6[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x55a50e,null))[_0xf49c('0x38')](function(_0x5cfc4e){if(_0x5cfc4e){return _0x5cfc4e[_0xf49c('0x71')](_0x16b0d6[_0xf49c('0x46')][_0xf49c('0x72')]);}})['then'](respondWithStatusCode(_0x55a50e,null))['catch'](handleError(_0x55a50e,null));};exports[_0xf49c('0x73')]=function(_0x1b7511,_0x507b9d,_0x48bd04){var _0x18fcf7={'channel':'sms'};var _0x37b240=[];var _0x479ca6=[];var _0x52f99b={};return db['SmsAccount'][_0xf49c('0x5d')]({'where':{'id':_0x1b7511[_0xf49c('0x5a')]['id']},'include':[{'model':db[_0xf49c('0x74')],'as':'Applications'}]})[_0xf49c('0x38')](handleEntityNotFound(_0x507b9d,null))['then'](function(_0x51abc9){_0x18fcf7[_0xf49c('0x75')]=_0x51abc9;_0x18fcf7['applications']=_[_0xf49c('0x76')](_0x51abc9[_0xf49c('0x77')],[_0xf49c('0x78')],[_0xf49c('0x79')]);if(_0x18fcf7[_0xf49c('0x75')][_0xf49c('0x77')]){delete _0x18fcf7['account'][_0xf49c('0x77')];}return db[_0xf49c('0x7a')][_0xf49c('0x66')]();})[_0xf49c('0x38')](function(_0x246932){if(!_0x246932){throw new db[(_0xf49c('0x7b'))]['ValidationError'](_0xf49c('0x7c'));}_0x37b240=_[_0xf49c('0x7d')](_[_0xf49c('0x5c')](_0x246932),[_0xf49c('0x7e'),_0xf49c('0x7f')]);_0x479ca6=_[_0xf49c('0x7d')](_[_0xf49c('0x5c')](_0x246932),['createdAt',_0xf49c('0x7f'),_0xf49c('0x80'),_0xf49c('0x81')]);_0x18fcf7['body']={'mapKey':_0xf49c('0x82')};if(_0x18fcf7[_0xf49c('0x75')][_0xf49c('0x44')]){switch(_0x18fcf7[_0xf49c('0x75')][_0xf49c('0x44')]){case'twilio':_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x83')]=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x84')];_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x5e')]=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x85')];_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x86')]=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x87')];break;case _0xf49c('0x88'):_0x18fcf7['body'][_0xf49c('0x83')]='+'+_0x1b7511['body'][_0xf49c('0x89')];_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x5e')]=_0x1b7511[_0xf49c('0x5e')]['text'];break;case'connectel':_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x83')]=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x83')];_0x18fcf7[_0xf49c('0x5e')]['body']=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x2a')];break;case _0xf49c('0x8a'):_0x18fcf7[_0xf49c('0x5e')]['from']=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x83')];_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x5e')]=_0x1b7511[_0xf49c('0x5e')]['body'];_0x18fcf7['body'][_0xf49c('0x86')]=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x8b')];break;case'plivo':_0x18fcf7['body']['from']=_0x1b7511['body'][_0xf49c('0x84')];_0x18fcf7['body']['body']=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x8c')];_0x18fcf7[_0xf49c('0x5e')]['messageId']=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x8d')];break;case _0xf49c('0x8e'):_0x18fcf7[_0xf49c('0x5e')]['from']='+'+_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x8f')][0x0]['from'];_0x18fcf7['body'][_0xf49c('0x5e')]=_0x1b7511[_0xf49c('0x5e')]['results'][0x0]['text'];_0x18fcf7[_0xf49c('0x5e')]['messageId']=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x8f')][0x0]['messageId'];break;case _0xf49c('0x90'):_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x83')]=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x91')];_0x18fcf7['body'][_0xf49c('0x5e')]=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x92')][_0xf49c('0x2a')];break;case _0xf49c('0x93'):_0x18fcf7['body'][_0xf49c('0x83')]=_0x1b7511['body'][_0xf49c('0x94')];_0x18fcf7['body'][_0xf49c('0x5e')]=_0x1b7511['body']['text'];_0x18fcf7[_0xf49c('0x5e')]['messageId']=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x95')];break;case _0xf49c('0x96'):_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x86')]=_0x1b7511[_0xf49c('0x5e')][0x0][_0xf49c('0x2a')]['id'];_0x18fcf7[_0xf49c('0x5e')]['from']=_0x1b7511[_0xf49c('0x5e')][0x0][_0xf49c('0x2a')][_0xf49c('0x83')];_0x18fcf7['body'][_0xf49c('0x5e')]=_0x1b7511[_0xf49c('0x5e')][0x0]['message'][_0xf49c('0x97')];break;case _0xf49c('0x98'):_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x83')]=_0x1b7511[_0xf49c('0x5e')]['from'];_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x5e')]=_0x1b7511['body'][_0xf49c('0x2a')];_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x86')]=_0x1b7511[_0xf49c('0x5e')][_0xf49c('0x99')];break;}}if(_0x18fcf7[_0xf49c('0x5e')]['id']){delete _0x18fcf7['body']['id'];}if(_[_0xf49c('0x9a')](_0x18fcf7['body']['from'])){throw new db[(_0xf49c('0x7b'))][(_0xf49c('0x9b'))](_0xf49c('0x9c'));}if(_[_0xf49c('0x9a')](_0x18fcf7['body']['body'])||_0x18fcf7['body'][_0xf49c('0x5e')]===''){throw new db[(_0xf49c('0x7b'))][(_0xf49c('0x9b'))](_0xf49c('0x9d'));}if(_[_0xf49c('0x9a')](_0x18fcf7['body'][_0xf49c('0x9e')])){throw new db[(_0xf49c('0x7b'))][(_0xf49c('0x9b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x479ca6);}if(!_[_0xf49c('0x9f')](_0x479ca6,_0x18fcf7[_0xf49c('0x5e')]['mapKey'])){throw new db[(_0xf49c('0x7b'))][(_0xf49c('0x9b'))](_0xf49c('0xa0')+_0x479ca6);}_0x52f99b[_0x18fcf7['body'][_0xf49c('0x9e')]]=_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x83')];return db[_0xf49c('0xa1')]['find']({'where':{'id':_0x18fcf7['account'][_0xf49c('0x81')]},'include':[{'model':db[_0xf49c('0x7a')],'as':_0xf49c('0xa2'),'where':_0x52f99b,'limit':0x1,'order':[[_0xf49c('0x7f'),_0xf49c('0xa3')]]}]});})[_0xf49c('0x38')](handleEntityNotFound(_0x507b9d,null))[_0xf49c('0x38')](function(_0x22a7e6){if(_0x22a7e6){_0x18fcf7[_0xf49c('0xa4')]=_['omit'](_0x22a7e6,['Contacts']);if(_0x22a7e6[_0xf49c('0xa2')][_0xf49c('0x4b')]){return _0x22a7e6[_0xf49c('0xa2')][0x0];}var _0x2dd1a5=_[_0xf49c('0x1c')](_0x18fcf7['body'],{'firstName':_0x18fcf7['body']['from'],'ListId':_0x22a7e6['id']});_0x2dd1a5[_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x9e')]]=_0x18fcf7['body'][_0xf49c('0x83')];return db[_0xf49c('0x7a')][_0xf49c('0x64')](_0x2dd1a5,{'fields':_0x37b240,'raw':!![]});}})['then'](handleEntityNotFound(_0x507b9d,null))['then'](function(_0x545188){if(_0x545188){_0x18fcf7[_0xf49c('0xa5')]=_0x545188;var _0x54c81c={'ContactId':_0x545188['id'],'phone':_0x18fcf7['body'][_0xf49c('0x83')],'SmsAccountId':_0x1b7511[_0xf49c('0x5a')]['id']};var _0x4a50d4={'ContactId':_0x545188['id'],'SmsAccountId':_0x1b7511[_0xf49c('0x5a')]['id'],'closed':![]};return db[_0xf49c('0xa6')][_0xf49c('0x5d')]({'where':_0x4a50d4})['then'](function(_0x5f2db7){if(_0x5f2db7){return[_0x5f2db7,![]];}return db['SmsInteraction'][_0xf49c('0x64')](_0x54c81c)[_0xf49c('0x38')](function(_0x1b068a){return[_0x1b068a,!![]];});});}})[_0xf49c('0xa7')](function(_0x4dbf91,_0x2858f0){_0x18fcf7[_0xf49c('0xa8')]=_0x4dbf91['get']({'plain':!![]});_0x18fcf7['interaction'][_0xf49c('0xa9')]=![];if(_0x2858f0){if(_0x18fcf7['account']['autoclose']){_0x18fcf7[_0xf49c('0xaa')][_0xf49c('0xab')]({'id':0x0,'priority':_0x18fcf7[_0xf49c('0xaa')][_0xf49c('0x4b')]+0x1,'app':'close','appdata':_0xf49c('0xac'),'interval':_0xf49c('0xad')});}_0x18fcf7[_0xf49c('0xa8')][_0xf49c('0xa9')]=!![];}return db[_0xf49c('0xae')][_0xf49c('0x64')]({'phone':_0x18fcf7[_0xf49c('0x5e')]['from'],'messageId':_0x18fcf7[_0xf49c('0x5e')]['messageId'],'body':_0x18fcf7[_0xf49c('0x5e')][_0xf49c('0x5e')],'SmsAccountId':_0x1b7511[_0xf49c('0x5a')]['id'],'SmsInteractionId':_0x4dbf91['id'],'direction':'in','ContactId':_0x4dbf91[_0xf49c('0xaf')],'AttachmentId':_0x18fcf7['body']['AttachmentId']});})['then'](function(_0x52edea){_0x18fcf7[_0xf49c('0x2a')]=_0x52edea;if(_0x18fcf7['interaction']['UserId']){return db[_0xf49c('0xb0')][_0xf49c('0x5d')]({'attributes':['id',_0xf49c('0x3e')],'where':{'id':_0x18fcf7[_0xf49c('0xa8')]['UserId']}})[_0xf49c('0x38')](function(_0x3e8250){if(_0x3e8250){_0x18fcf7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf49c('0xb1'),'appdata':_0x3e8250[_0xf49c('0x3e')]+','+(_0x18fcf7[_0xf49c('0x75')][_0xf49c('0xb2')]||0xa),'interval':_0xf49c('0xad')});}return respondWithRpcPromise(_0xf49c('0xb3'),'startRouting',_0x18fcf7);});}return respondWithRpcPromise(_0xf49c('0xb3'),'startRouting',_0x18fcf7);})[_0xf49c('0x38')](function(_0x1cbd88){if(_0x1cbd88){var _0xd02efa=0xc8;var _0x4edd13=_0xf49c('0xb4');logger[_0xf49c('0x22')](_0xf49c('0x26'),_0x4edd13,_0xd02efa,_0xf49c('0xb5'));logger[_0xf49c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4edd13,_0xd02efa,_0xf49c('0xb5'),JSON[_0xf49c('0x27')](_0x1cbd88));if(_0x18fcf7[_0xf49c('0x75')][_0xf49c('0x44')]==='twilio'){return _0x507b9d['status'](_0xd02efa)[_0xf49c('0x34')]('Content-Type',_0xf49c('0xb6'))['send'](_0xf49c('0xb7'));}else{return _0x507b9d[_0xf49c('0x2d')](_0xd02efa)['json'](_0x1cbd88);}}})[_0xf49c('0x2b')](handleError(_0x507b9d,null));};exports[_0xf49c('0xb8')]=function(_0x466b6c,_0x2e9c6d){var _0x5bb8b2=_0x466b6c[_0xf49c('0x5a')]['id'];var _0x1690dd=_0x466b6c['body'];var _0xe6d627=0xc8;var _0x3940ea=null;return db[_0xf49c('0xb9')][_0xf49c('0xba')]({'isolationLevel':db[_0xf49c('0xb9')][_0xf49c('0xbb')][_0xf49c('0xbc')]['READ_COMMITTED']},function(_0xb70368){return db['SmsAccount'][_0xf49c('0x6a')]({'where':{'id':_0x5bb8b2},'transaction':_0xb70368})[_0xf49c('0x38')](function(_0x2f4b35){if(_0x2f4b35){return db[_0xf49c('0x74')][_0xf49c('0x39')]({'where':{'SmsAccountId':_0x5bb8b2},'transaction':_0xb70368})['then'](function(){var _0x1dfdbe=_[_0xf49c('0x42')](_0x1690dd,function(_0x23b5bc){_0x23b5bc[_0xf49c('0x68')]=_0x5bb8b2;return _0x23b5bc;});return db[_0xf49c('0x74')][_0xf49c('0xbd')](_0x1dfdbe,{'transaction':_0xb70368});});}else{_0xe6d627=0x194;_0x3940ea=[];}});})[_0xf49c('0x38')](function(){if(_0xe6d627!==0x194){return db['SmsApplication'][_0xf49c('0xbe')]({'where':{'SmsAccountId':_0x5bb8b2},'order':'priority'})[_0xf49c('0x38')](function(_0x4fd4b5){_0x3940ea=_0x4fd4b5;});}})[_0xf49c('0x2b')](function(_0x482177){_0xe6d627=0x1f4;logger[_0xf49c('0x28')](_0x482177['stack']);if(_0x482177[_0xf49c('0x3e')]){delete _0x482177[_0xf49c('0x3e')];}_0x3940ea=_0x482177;})[_0xf49c('0xbf')](function(){if(_0x3940ea===null){_0x2e9c6d[_0xf49c('0x2c')](_0xe6d627);}else{if(_0xe6d627===0x1f4){_0x2e9c6d['status'](_0xe6d627)[_0xf49c('0x3f')](_0x3940ea);}else{_0x2e9c6d[_0xf49c('0x2d')](_0xe6d627)['json'](_0x3940ea);}}});};exports['getApplications']=function(_0x21fefe,_0x2b9c74,_0x131e2c){var _0x76e893={};var _0x3428ae={};var _0x23767d;var _0x31cdcb;return db[_0xf49c('0x56')][_0xf49c('0x6a')]({'where':{'id':_0x21fefe[_0xf49c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2b9c74,null))[_0xf49c('0x38')](function(_0x46f822){if(_0x46f822){_0x23767d=_0x46f822;_0x3428ae[_0xf49c('0x45')]=_['keys'](db[_0xf49c('0x74')][_0xf49c('0x43')]);_0x3428ae[_0xf49c('0x46')]=_[_0xf49c('0x5c')](_0x21fefe['query']);_0x3428ae[_0xf49c('0x47')]=_[_0xf49c('0x48')](_0x3428ae['model'],_0x3428ae[_0xf49c('0x46')]);_0x76e893[_0xf49c('0x49')]=_[_0xf49c('0x48')](_0x3428ae[_0xf49c('0x45')],qs[_0xf49c('0x4a')](_0x21fefe[_0xf49c('0x46')][_0xf49c('0x4a')]));_0x76e893[_0xf49c('0x49')]=_0x76e893[_0xf49c('0x49')][_0xf49c('0x4b')]?_0x76e893[_0xf49c('0x49')]:_0x3428ae[_0xf49c('0x45')];_0x76e893[_0xf49c('0x4d')]=qs[_0xf49c('0x4e')](_0x21fefe[_0xf49c('0x46')]['sort']);_0x76e893['where']=qs[_0xf49c('0x47')](_[_0xf49c('0x50')](_0x21fefe['query'],_0x3428ae[_0xf49c('0x47')]));if(_0x21fefe[_0xf49c('0x46')][_0xf49c('0x51')]){_0x76e893[_0xf49c('0x4f')]=_[_0xf49c('0x52')](_0x76e893[_0xf49c('0x4f')],{'$or':_['map'](_0x76e893[_0xf49c('0x49')],function(_0x18c38b){var _0x48467d={};_0x48467d[_0x18c38b]={'$like':'%'+_0x21fefe['query'][_0xf49c('0x51')]+'%'};return _0x48467d;})});}_0x76e893=_[_0xf49c('0x52')]({},_0x76e893,_0x21fefe[_0xf49c('0x53')]);return _0x23767d[_0xf49c('0xc0')](_0x76e893);}})[_0xf49c('0x38')](function(_0x15ec7c){if(_0x15ec7c){_0x31cdcb=_0x15ec7c['length'];if(!_0x21fefe[_0xf49c('0x46')][_0xf49c('0x6b')](_0xf49c('0x4c'))){_0x76e893[_0xf49c('0x32')]=qs[_0xf49c('0x32')](_0x21fefe[_0xf49c('0x46')][_0xf49c('0x32')]);_0x76e893[_0xf49c('0x30')]=qs[_0xf49c('0x30')](_0x21fefe[_0xf49c('0x46')][_0xf49c('0x30')]);}return _0x23767d['getApplications'](_0x76e893);}})[_0xf49c('0x38')](function(_0x20ed2a){if(_0x20ed2a){return _0x20ed2a?{'count':_0x31cdcb,'rows':_0x20ed2a}:null;}})[_0xf49c('0x38')](respondWithResult(_0x2b9c74,null))[_0xf49c('0x2b')](handleError(_0x2b9c74,null));};exports[_0xf49c('0xc1')]=function(_0x278358,_0x483753,_0x3c839){var _0x44495c={'raw':![],'where':{}};var _0x288ad9={};var _0x15ce86={'count':0x0,'rows':[]};return db[_0xf49c('0x56')][_0xf49c('0x6a')]({'where':{'id':_0x278358[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x483753,null))['then'](function(_0x40de18){if(_0x40de18){_0x288ad9['model']=_[_0xf49c('0x5c')](db[_0xf49c('0xa6')][_0xf49c('0x43')]);_0x288ad9[_0xf49c('0x46')]=_[_0xf49c('0x5c')](_0x278358[_0xf49c('0x46')]);_0x288ad9['filters']=_[_0xf49c('0x48')](_0x288ad9[_0xf49c('0x45')],_0x288ad9[_0xf49c('0x46')]);_0x44495c[_0xf49c('0x49')]=_[_0xf49c('0x48')](_0x288ad9[_0xf49c('0x45')],qs['fields'](_0x278358['query'][_0xf49c('0x4a')]));_0x44495c['attributes']=_0x44495c['attributes'][_0xf49c('0x4b')]?_0x44495c['attributes']:_0x288ad9[_0xf49c('0x45')];if(!_0x278358[_0xf49c('0x46')][_0xf49c('0x6b')]('nolimit')){_0x44495c[_0xf49c('0x32')]=qs['limit'](_0x278358[_0xf49c('0x46')][_0xf49c('0x32')]);_0x44495c['offset']=qs[_0xf49c('0x30')](_0x278358[_0xf49c('0x46')][_0xf49c('0x30')]);}_0x44495c[_0xf49c('0x4d')]=qs[_0xf49c('0x4e')](_0x278358['query']['sort']);_0x44495c['where']=qs[_0xf49c('0x47')](_[_0xf49c('0x50')](_0x278358['query'],_0x288ad9[_0xf49c('0x47')]));_0x44495c[_0xf49c('0x4f')][_0xf49c('0x68')]=_0x40de18['id'];if(_0x278358[_0xf49c('0x46')][_0xf49c('0x51')]){_0x44495c[_0xf49c('0x4f')]=_[_0xf49c('0x52')](_0x44495c[_0xf49c('0x4f')],{'$or':_['map'](_0x44495c[_0xf49c('0x49')],function(_0x35f38f){var _0x3f7356={};_0x3f7356[_0x35f38f]={'$like':'%'+_0x278358['query'][_0xf49c('0x51')]+'%'};return _0x3f7356;})});}_0x44495c=_[_0xf49c('0x52')]({},_0x44495c,_0x278358['options']);return db[_0xf49c('0xa6')][_0xf49c('0x33')]({'where':_0x44495c[_0xf49c('0x4f')]})[_0xf49c('0x38')](function(_0x2c7ab9){_0x15ce86['count']=_0x2c7ab9;if(_0x278358['query'][_0xf49c('0x54')]){_0x44495c[_0xf49c('0x55')]=[{'model':db[_0xf49c('0x7a')],'as':_0xf49c('0xc2'),'required':![]},{'model':db[_0xf49c('0xb0')],'as':'Owner','attributes':[_0xf49c('0x3e'),'fullname','internal'],'required':![]},{'model':db[_0xf49c('0xc3')],'as':_0xf49c('0xc4'),'attributes':['id',_0xf49c('0x3e'),'color'],'where':_0x278358[_0xf49c('0x46')]['tag']?{'id':_0x278358[_0xf49c('0x46')]['tag']}:undefined,'required':_0x278358['query'][_0xf49c('0xc5')]?!![]:![]}];}return db[_0xf49c('0xa6')]['findAll'](_0x44495c);})[_0xf49c('0x38')](function(_0x479c9f){_0x15ce86[_0xf49c('0x58')]=_0x479c9f;return _0x15ce86;});}})[_0xf49c('0x38')](respondWithFilteredResult(_0x483753,_0x44495c))[_0xf49c('0x2b')](handleError(_0x483753,null));};exports[_0xf49c('0x3f')]=function(_0x1085cd,_0x6a5a5d,_0x359dec){var _0x15ae79,_0x183188,_0x25e843;if(_[_0xf49c('0x9a')](_0x1085cd['body'][_0xf49c('0x5e')])||_0x1085cd[_0xf49c('0x5e')]['body']===''){throw new db['Sequelize'][(_0xf49c('0x9b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf49c('0x9a')](_0x1085cd['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xf49c('0xc6'));}_0x15ae79=_0x1085cd[_0xf49c('0x5e')]['to'];return db[_0xf49c('0x56')]['find']({'where':{'id':_0x1085cd[_0xf49c('0x5a')]['id']},'include':[{'model':db[_0xf49c('0xa1')],'as':_0xf49c('0xc7'),'include':[{'model':db[_0xf49c('0x7a')],'as':'Contacts','where':{'mobile':_0x15ae79},'limit':0x1,'order':[[_0xf49c('0x7f'),_0xf49c('0xa3')]]}]}]})[_0xf49c('0x38')](handleEntityNotFound(_0x6a5a5d,null))[_0xf49c('0x38')](function(_0x48e879){if(_0x48e879&&_0x48e879['List']){_0x183188=_0x48e879[_0xf49c('0x3a')]({'plain':!![]});if(_0x183188[_0xf49c('0xc7')]&&_0x183188['List'][_0xf49c('0xa2')][_0xf49c('0x4b')]){return _0x183188[_0xf49c('0xc7')][_0xf49c('0xa2')][0x0];}return db[_0xf49c('0x7a')][_0xf49c('0x64')](_[_0xf49c('0x1c')](_0x1085cd[_0xf49c('0x5e')],{'firstName':_0x15ae79,'mobile':_0x15ae79,'phone':_0x15ae79,'ListId':_0x183188[_0xf49c('0x81')]}));}})[_0xf49c('0x38')](handleEntityNotFound(_0x6a5a5d,null))[_0xf49c('0x38')](function(_0x53f166){if(_0x53f166){_0x25e843=_0x53f166;return db[_0xf49c('0xa6')]['find']({'where':{'ContactId':_0x25e843['id'],'closed':![],'SmsAccountId':_0x183188['id']}})['then'](function(_0x34f124){if(_0x34f124){return[_0x34f124,![]];}return db[_0xf49c('0xa6')][_0xf49c('0x64')]({'UserId':_0x1085cd[_0xf49c('0x5f')]['id'],'ContactId':_0x25e843['id'],'SmsAccountId':_0x183188['id'],'phone':_0x15ae79,'firstMsgDirection':_0xf49c('0xc8'),'Messages':[_[_0xf49c('0x52')](_0x1085cd[_0xf49c('0x5e')],{'read':![],'body':_0x1085cd[_0xf49c('0x5e')][_0xf49c('0x5e')],'phone':_0x15ae79,'SmsAccountId':_0x183188['id'],'UserId':_0x1085cd['user']['id'],'ContactId':_0x25e843['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xf49c('0x38')](function(_0x467777){return[_0x467777,!![]];});});}})[_0xf49c('0xa7')](function(_0x15effd,_0x1d202a){if(_0x1d202a){return _0x15effd;}return db[_0xf49c('0xae')][_0xf49c('0x64')](_['merge'](_0x1085cd[_0xf49c('0x5e')],{'read':![],'body':_0x1085cd[_0xf49c('0x5e')]['body'],'phone':_0x15ae79,'SmsAccountId':_0x183188['id'],'SmsInteractionId':_0x15effd['id'],'UserId':_0x1085cd[_0xf49c('0x5f')]['id'],'ContactId':_0x25e843['id']}))[_0xf49c('0x38')](function(_0x81dc09){_0x15effd[_0xf49c('0xc9')][_0xf49c('0xca')]=[];_0x15effd[_0xf49c('0xc9')][_0xf49c('0xca')][_0xf49c('0xab')](_0x81dc09[_0xf49c('0xc9')]);return _0x15effd;});})[_0xf49c('0x38')](respondWithResult(_0x6a5a5d,null))['catch'](handleError(_0x6a5a5d,null));};exports[_0xf49c('0x2d')]=function(_0x3034d2,_0x4f6f44,_0x2f8fe0){if(_0x3034d2[_0xf49c('0x5e')]['id']){delete _0x3034d2[_0xf49c('0x5e')]['id'];}var _0x2490e0,_0x317a40,_0x5e43de;return db['SmsAccount']['find']({'where':{'id':_0x3034d2['params']['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x4f6f44,null))[_0xf49c('0x38')](function(_0x5d0733){if(_0x5d0733){_0x5e43de=_0x5d0733;logger[_0xf49c('0x25')](_0xf49c('0x26'),_0xf49c('0x2d'),'received\x20delivery\x20report\x20from',_0x5d0733[_0xf49c('0x44')],util[_0xf49c('0xcb')](_0x3034d2[_0xf49c('0x5e')],{'showHidden':![],'depth':null}));switch(_0x5d0733[_0xf49c('0x44')]){case _0xf49c('0x88'):if(_0x3034d2[_0xf49c('0x5e')][_0xf49c('0xcc')]&&_0x3034d2[_0xf49c('0x5e')][_0xf49c('0x2d')]){_0x317a40=_0x3034d2[_0xf49c('0x5e')][_0xf49c('0x2d')];return db[_0xf49c('0xae')]['find']({'where':{'messageId':_0x3034d2[_0xf49c('0x5e')][_0xf49c('0xcc')]}});}break;case _0xf49c('0xcd'):if(_0x3034d2[_0xf49c('0x5e')][_0xf49c('0xce')]&&_0x3034d2['body'][_0xf49c('0xcf')]){_0x317a40=_0x3034d2[_0xf49c('0x5e')][_0xf49c('0xcf')];return db['SmsMessage'][_0xf49c('0x5d')]({'where':{'messageId':_0x3034d2[_0xf49c('0x5e')][_0xf49c('0xce')]}});}break;case _0xf49c('0x8a'):if(_0x3034d2[_0xf49c('0x5e')][_0xf49c('0x8b')]&&_0x3034d2[_0xf49c('0x5e')][_0xf49c('0xd0')]){_0x317a40=_0x3034d2['body'][_0xf49c('0xd0')];return db[_0xf49c('0xae')][_0xf49c('0x5d')]({'where':{'messageId':_0x3034d2['body']['message_id']}});}break;case _0xf49c('0x8e'):var _0x3cc7de=_0x3034d2['body'][_0xf49c('0x8f')][0x0];if(_0x3cc7de['messageId']&&_0x3cc7de[_0xf49c('0x2d')][_0xf49c('0xd1')]===_0xf49c('0xd2')){_0x317a40=_0x3cc7de[_0xf49c('0x2d')][_0xf49c('0xd1')];return db['SmsMessage'][_0xf49c('0x5d')]({'where':{'messageId':_0x3cc7de[_0xf49c('0x86')]}});}break;case _0xf49c('0x93'):if(_0x3034d2['body'][_0xf49c('0x86')]&&_0x3034d2[_0xf49c('0x5e')][_0xf49c('0x2d')]){_0x317a40=_0x3034d2[_0xf49c('0x5e')][_0xf49c('0x2d')];return db[_0xf49c('0xae')][_0xf49c('0x5d')]({'where':{'messageId':_0x3034d2[_0xf49c('0x5e')][_0xf49c('0x86')]}});}break;case'bandwidth':if(_0x3034d2[_0xf49c('0x5e')][0x0][_0xf49c('0x2a')]['id']){_0x317a40=_0x3034d2[_0xf49c('0x5e')][0x0][_0xf49c('0x44')];return db['SmsMessage'][_0xf49c('0x5d')]({'where':{'messageId':_0x3034d2['body'][0x0][_0xf49c('0x2a')]['id']}});}break;case _0xf49c('0x98'):if(_0x3034d2[_0xf49c('0x5e')][_0xf49c('0xd3')]&&_0x3034d2[_0xf49c('0x5e')][_0xf49c('0x2d')]){_0x317a40=_0x3034d2['body'][_0xf49c('0x2d')];return db['SmsMessage'][_0xf49c('0x5d')]({'where':{'messageId':_0x3034d2[_0xf49c('0x5e')][_0xf49c('0xd3')]}});}break;}}})[_0xf49c('0x38')](handleEntityNotFound(_0x4f6f44,null))[_0xf49c('0x38')](function(_0xf529cc){if(_0xf529cc){_0x2490e0=_0xf529cc;switch(_0x5e43de[_0xf49c('0x44')]){case _0xf49c('0x88'):if(_0x317a40===_0xf49c('0xd2')){return _0x2490e0['update']({'read':!![]});}else{logger[_0xf49c('0x28')](_0xf49c('0x26'),_0xf49c('0x2d'),_0xf49c('0x88'),util[_0xf49c('0xcb')](_0x3034d2[_0xf49c('0x5e')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x317a40==='1'){return _0x2490e0[_0xf49c('0x37')]({'read':!![]});}else{logger['error'](_0xf49c('0x26'),_0xf49c('0x2d'),_0xf49c('0x88'),util[_0xf49c('0xcb')](_0x3034d2[_0xf49c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf49c('0x8a'):if(!_0x3034d2[_0xf49c('0x5e')][_0xf49c('0xd4')]&&_0x317a40>=0xc8&&_0x317a40<=0xce){return _0x2490e0[_0xf49c('0x37')]({'read':!![]});}else{logger[_0xf49c('0x28')](_0xf49c('0x26'),_0xf49c('0x2d'),_0xf49c('0x8a'),util['inspect'](_0x3034d2[_0xf49c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf49c('0x8e'):var _0x1cb587=_0x3034d2[_0xf49c('0x5e')][_0xf49c('0x8f')][0x0];if(_0x1cb587['status'][_0xf49c('0xd1')]==='DELIVERED'){return _0x2490e0[_0xf49c('0x37')]({'read':!![]});}else{logger[_0xf49c('0x28')](_0xf49c('0x26'),_0xf49c('0x2d'),_0xf49c('0x8e'),util['inspect'](_0x3034d2[_0xf49c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf49c('0x93'):if(_0x317a40=='DELIVERED_TO_GATEWAY'||_0x317a40=='RECEIVED_BY_RECIPIENT'){return _0x2490e0[_0xf49c('0x37')]({'read':!![]});}else{logger[_0xf49c('0x28')](_0xf49c('0x26'),_0xf49c('0x2d'),_0xf49c('0x93'),util[_0xf49c('0xcb')](_0x3034d2[_0xf49c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf49c('0x96'):if(_0x317a40==_0xf49c('0xd5')){return _0x2490e0['update']({'read':!![]});}else{logger[_0xf49c('0x28')](_0xf49c('0x26'),'status',_0xf49c('0x96'),util['inspect'](_0x3034d2[_0xf49c('0x5e')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x317a40===_0xf49c('0xd6')||_0x317a40==='ACCEPTD'){return _0x2490e0['update']({'read':!![]});}else{logger[_0xf49c('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','intelepeer',util[_0xf49c('0xcb')](_0x3034d2[_0xf49c('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x2490e0;}})[_0xf49c('0x38')](respondWithResult(_0x4f6f44,null))[_0xf49c('0x2b')](handleError(_0x4f6f44,null));};exports['statusGet']=function(_0x34efcb,_0x41516c,_0x596c23){var _0x4fbed4,_0x337ad5,_0x2c6845;return db[_0xf49c('0x56')][_0xf49c('0x5d')]({'where':{'id':_0x34efcb[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x41516c,null))[_0xf49c('0x38')](function(_0x2bcc4b){if(_0x2bcc4b){_0x2c6845=_0x2bcc4b;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf49c('0x2d'),_0xf49c('0xd7'),_0x2bcc4b[_0xf49c('0x44')],util[_0xf49c('0xcb')](_0x34efcb[_0xf49c('0x46')],{'showHidden':![],'depth':null}));switch(_0x2bcc4b[_0xf49c('0x44')]){case'csc':if(_0x34efcb[_0xf49c('0x46')][_0xf49c('0xd8')]&&_0x34efcb[_0xf49c('0x46')]['state']){_0x337ad5=_0x34efcb[_0xf49c('0x46')][_0xf49c('0xd9')];return db[_0xf49c('0xae')][_0xf49c('0x5d')]({'where':{'messageId':_0x34efcb['query'][_0xf49c('0xd8')]}});}break;}}})['then'](handleEntityNotFound(_0x41516c,null))[_0xf49c('0x38')](function(_0xb64629){if(_0xb64629){_0x4fbed4=_0xb64629;switch(_0x2c6845[_0xf49c('0x44')]){case _0xf49c('0x90'):if(_0x337ad5==='2'||_0x337ad5==='6'){return _0x4fbed4[_0xf49c('0x37')]({'read':!![]});}else{logger[_0xf49c('0x28')](_0xf49c('0x26'),'status',_0xf49c('0x90'),util['inspect'](_0x34efcb[_0xf49c('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x4fbed4;}})[_0xf49c('0x38')](respondWithResult(_0x41516c,null))['catch'](handleError(_0x41516c,null));};exports[_0xf49c('0xda')]=function(_0x4150e2,_0x292823,_0x3f5485){return db[_0xf49c('0x56')][_0xf49c('0x5d')]({'where':{'id':_0x4150e2['params']['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x292823,null))[_0xf49c('0x38')](function(_0x528a80){if(_0x528a80){return _0x528a80[_0xf49c('0xda')](_0x4150e2['body']['ids'],_['omit'](_0x4150e2[_0xf49c('0x5e')],[_0xf49c('0x72'),'id'])||{})[_0xf49c('0xa7')](function(_0x224703){for(var _0x4d552f=0x0;_0x4d552f<_0x4150e2['body'][_0xf49c('0x72')][_0xf49c('0x4b')];_0x4d552f+=0x1){socket[_0xf49c('0xdb')]('userSmsAccount:save',{'UserId':Number(_0x4150e2[_0xf49c('0x5e')][_0xf49c('0x72')][_0x4d552f]),'SmsAccountId':Number(_0x4150e2['params']['id'])});}return _0x224703;});}})[_0xf49c('0x38')](respondWithResult(_0x292823,null))[_0xf49c('0x2b')](handleError(_0x292823,null));};exports[_0xf49c('0xdc')]=function(_0x1a6d8c,_0x59f155,_0x1d4aa2){return db[_0xf49c('0x56')][_0xf49c('0x5d')]({'where':{'id':_0x1a6d8c[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x59f155,null))[_0xf49c('0x38')](function(_0x137738){if(_0x137738){return _0x137738[_0xf49c('0xdc')](_0x1a6d8c[_0xf49c('0x46')][_0xf49c('0x72')])[_0xf49c('0x38')](function(){if(_[_0xf49c('0xdd')](_0x1a6d8c[_0xf49c('0x46')][_0xf49c('0x72')])){for(var _0xe9e5bd=0x0;_0xe9e5bd<_0x1a6d8c['query'][_0xf49c('0x72')][_0xf49c('0x4b')];_0xe9e5bd+=0x1){socket[_0xf49c('0xdb')](_0xf49c('0xde'),{'UserId':Number(_0x1a6d8c['query'][_0xf49c('0x72')][_0xe9e5bd]),'SmsAccountId':Number(_0x1a6d8c[_0xf49c('0x5a')]['id'])});}}else{socket[_0xf49c('0xdb')](_0xf49c('0xde'),{'UserId':Number(_0x1a6d8c['query']['ids']),'SmsAccountId':Number(_0x1a6d8c[_0xf49c('0x5a')]['id'])});}});}})[_0xf49c('0x38')](respondWithStatusCode(_0x59f155,null))[_0xf49c('0x2b')](handleError(_0x59f155,null));};exports['getAgents']=function(_0x2bbcea,_0x429d65,_0x4b8eaf){var _0x24489a={};var _0x43555f={};var _0x4e1882;var _0x1009fa;return db[_0xf49c('0x56')][_0xf49c('0x6a')]({'where':{'id':_0x2bbcea[_0xf49c('0x5a')]['id']}})[_0xf49c('0x38')](handleEntityNotFound(_0x429d65,null))[_0xf49c('0x38')](function(_0x3516bd){if(_0x3516bd){_0x4e1882=_0x3516bd;_0x43555f[_0xf49c('0x45')]=_[_0xf49c('0x5c')](db['User'][_0xf49c('0x43')]);_0x43555f[_0xf49c('0x46')]=_['keys'](_0x2bbcea[_0xf49c('0x46')]);_0x43555f[_0xf49c('0x47')]=_[_0xf49c('0x48')](_0x43555f[_0xf49c('0x45')],_0x43555f[_0xf49c('0x46')]);_0x24489a[_0xf49c('0x49')]=_[_0xf49c('0x48')](_0x43555f[_0xf49c('0x45')],qs[_0xf49c('0x4a')](_0x2bbcea[_0xf49c('0x46')][_0xf49c('0x4a')]));_0x24489a['attributes']=_0x24489a['attributes'][_0xf49c('0x4b')]?_0x24489a[_0xf49c('0x49')]:_0x43555f[_0xf49c('0x45')];_0x24489a[_0xf49c('0x4d')]=qs[_0xf49c('0x4e')](_0x2bbcea[_0xf49c('0x46')]['sort']);_0x24489a[_0xf49c('0x4f')]=qs[_0xf49c('0x47')](_[_0xf49c('0x50')](_0x2bbcea[_0xf49c('0x46')],_0x43555f[_0xf49c('0x47')]));if(_0x2bbcea[_0xf49c('0x46')][_0xf49c('0x51')]){_0x24489a[_0xf49c('0x4f')]=_[_0xf49c('0x52')](_0x24489a['where'],{'$or':_['map'](_0x24489a[_0xf49c('0x49')],function(_0x22efe4){var _0x491076={};_0x491076[_0x22efe4]={'$like':'%'+_0x2bbcea[_0xf49c('0x46')][_0xf49c('0x51')]+'%'};return _0x491076;})});}_0x24489a=_[_0xf49c('0x52')]({},_0x24489a,_0x2bbcea[_0xf49c('0x53')]);return _0x4e1882['getAgents'](_0x24489a);}})['then'](function(_0x4d8ad3){if(_0x4d8ad3){_0x1009fa=_0x4d8ad3['length'];if(!_0x2bbcea[_0xf49c('0x46')]['hasOwnProperty']('nolimit')){_0x24489a[_0xf49c('0x32')]=qs[_0xf49c('0x32')](_0x2bbcea[_0xf49c('0x46')][_0xf49c('0x32')]);_0x24489a[_0xf49c('0x30')]=qs[_0xf49c('0x30')](_0x2bbcea[_0xf49c('0x46')][_0xf49c('0x30')]);}return _0x4e1882[_0xf49c('0xdf')](_0x24489a);}})['then'](function(_0x4a51c9){if(_0x4a51c9){return _0x4a51c9?{'count':_0x1009fa,'rows':_0x4a51c9}:null;}})[_0xf49c('0x38')](respondWithResult(_0x429d65,null))['catch'](handleError(_0x429d65,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5e6aa5b..fff5275 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 _0xa079=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0xa079,0x10c));var _0x9a07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa079[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x9a07('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9a07('0x1')](0x0);var events={'afterCreate':_0x9a07('0x2'),'afterUpdate':_0x9a07('0x3'),'afterDestroy':_0x9a07('0x4')};function emitEvent(_0x1cce9){return function(_0x3a55fc,_0x217638,_0x1d774a){SmsAccountEvents[_0x9a07('0x5')](_0x1cce9+':'+_0x3a55fc['id'],_0x3a55fc);SmsAccountEvents['emit'](_0x1cce9,_0x3a55fc);_0x1d774a(null);};}for(var e in events){if(events[_0x9a07('0x6')](e)){var event=events[e];SmsAccount[_0x9a07('0x7')](e,emitEvent(event));}}module[_0x9a07('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xcf57=['emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners','update','remove'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0xcf57,0x11b));var _0x7cf5=function(_0x16d07e,_0x3a66a5){_0x16d07e=_0x16d07e-0x0;var _0x4c1b8=_0xcf57[_0x16d07e];return _0x4c1b8;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x7cf5('0x0'))['db'][_0x7cf5('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7cf5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7cf5('0x3'),'afterDestroy':_0x7cf5('0x4')};function emitEvent(_0x3b8edb){return function(_0xa40706,_0x209934,_0x325ca7){SmsAccountEvents[_0x7cf5('0x5')](_0x3b8edb+':'+_0xa40706['id'],_0xa40706);SmsAccountEvents[_0x7cf5('0x5')](_0x3b8edb,_0xa40706);_0x325ca7(null);};}for(var e in events){if(events[_0x7cf5('0x6')](e)){var event=events[e];SmsAccount[_0x7cf5('0x7')](e,emitEvent(event));}}module[_0x7cf5('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e64abe0..f208bfb 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 _0x4cf7=['request-promise','path','../../config/environment','./smsAccount.attributes','define','sms_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4af3b7,_0x30c116){var _0x24727c=function(_0x3ae9a0){while(--_0x3ae9a0){_0x4af3b7['push'](_0x4af3b7['shift']());}};_0x24727c(++_0x30c116);}(_0x4cf7,0x12f));var _0x74cf=function(_0x3b74a7,_0x145537){_0x3b74a7=_0x3b74a7-0x0;var _0xaa1fd4=_0x4cf7[_0x3b74a7];return _0xaa1fd4;};'use strict';var _=require(_0x74cf('0x0'));var util=require(_0x74cf('0x1'));var logger=require(_0x74cf('0x2'))('api');var moment=require(_0x74cf('0x3'));var BPromise=require(_0x74cf('0x4'));var rp=require(_0x74cf('0x5'));var fs=require('fs');var path=require(_0x74cf('0x6'));var rimraf=require('rimraf');var config=require(_0x74cf('0x7'));var attributes=require(_0x74cf('0x8'));module['exports']=function(_0x23194d,_0x53a576){return _0x23194d[_0x74cf('0x9')]('SmsAccount',attributes,{'tableName':_0x74cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd677=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash'];(function(_0x57c907,_0x119611){var _0x244022=function(_0x28b7ab){while(--_0x28b7ab){_0x57c907['push'](_0x57c907['shift']());}};_0x244022(++_0x119611);}(_0xd677,0x14f));var _0x7d67=function(_0x6a27db,_0x2731a7){_0x6a27db=_0x6a27db-0x0;var _0xd814f5=_0xd677[_0x6a27db];return _0xd814f5;};'use strict';var _=require(_0x7d67('0x0'));var util=require(_0x7d67('0x1'));var logger=require(_0x7d67('0x2'))(_0x7d67('0x3'));var moment=require(_0x7d67('0x4'));var BPromise=require(_0x7d67('0x5'));var rp=require(_0x7d67('0x6'));var fs=require('fs');var path=require(_0x7d67('0x7'));var rimraf=require(_0x7d67('0x8'));var config=require(_0x7d67('0x9'));var attributes=require(_0x7d67('0xa'));module[_0x7d67('0xb')]=function(_0x3f27a4,_0x2572f0){return _0x3f27a4['define'](_0x7d67('0xc'),attributes,{'tableName':_0x7d67('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 20f11d0..e1ca250 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 _0xf797=['attributes','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','redis','localhost','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount,\x20%s,\x20%s','result','ShowSmsAccount','SmsAccount','find','options','raw','where','include','model','map'];(function(_0x1746a6,_0x441a6f){var _0xa7115d=function(_0x228e97){while(--_0x228e97){_0x1746a6['push'](_0x1746a6['shift']());}};_0xa7115d(++_0x441a6f);}(_0xf797,0x82));var _0x7f79=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xf797[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x7f79('0x0'));var util=require(_0x7f79('0x1'));var moment=require(_0x7f79('0x2'));var BPromise=require(_0x7f79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f79('0x4'));var db=require(_0x7f79('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7f79('0x6'));var jayson=require(_0x7f79('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7f79('0x8')],{'host':_0x7f79('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4e63e8,_0x2e7e96,_0x4733b2){return new BPromise(function(_0x43f535,_0x5d56a4){return client[_0x7f79('0xa')](_0x4e63e8,_0x4733b2)[_0x7f79('0xb')](function(_0x41a85f){logger[_0x7f79('0xc')]('SmsAccount,\x20%s,\x20%s',_0x2e7e96,_0x7f79('0xd'));logger[_0x7f79('0xe')](_0x7f79('0xf'),_0x2e7e96,'request\x20sent',JSON[_0x7f79('0x10')](_0x41a85f));if(_0x41a85f['error']){if(_0x41a85f[_0x7f79('0x11')]['code']===0x1f4){logger[_0x7f79('0x11')]('SmsAccount,\x20%s,\x20%s',_0x2e7e96,_0x41a85f[_0x7f79('0x11')]['message']);return _0x5d56a4(_0x41a85f[_0x7f79('0x11')][_0x7f79('0x12')]);}logger['error'](_0x7f79('0x13'),_0x2e7e96,_0x41a85f[_0x7f79('0x11')]['message']);return _0x43f535(_0x41a85f[_0x7f79('0x11')][_0x7f79('0x12')]);}else{logger[_0x7f79('0xc')]('SmsAccount,\x20%s,\x20%s',_0x2e7e96,'request\x20sent');_0x43f535(_0x41a85f[_0x7f79('0x14')][_0x7f79('0x12')]);}})['catch'](function(_0x565bee){logger[_0x7f79('0x11')](_0x7f79('0x13'),_0x2e7e96,_0x565bee);_0x5d56a4(_0x565bee);});});}exports[_0x7f79('0x15')]=function(_0x4ccaf0){var _0x3f9a87=this;return new Promise(function(_0x2217ee,_0x1bd592){return db[_0x7f79('0x16')][_0x7f79('0x17')]({'raw':_0x4ccaf0[_0x7f79('0x18')]?_0x4ccaf0[_0x7f79('0x18')][_0x7f79('0x19')]===undefined?!![]:![]:!![],'where':_0x4ccaf0['options']?_0x4ccaf0[_0x7f79('0x18')][_0x7f79('0x1a')]||null:null,'attributes':_0x4ccaf0[_0x7f79('0x18')]?_0x4ccaf0[_0x7f79('0x18')]['attributes']||null:null,'include':_0x4ccaf0[_0x7f79('0x18')]?_0x4ccaf0['options']['include']?_['map'](_0x4ccaf0[_0x7f79('0x18')][_0x7f79('0x1b')],function(_0x143c3f){return{'model':db[_0x143c3f[_0x7f79('0x1c')]],'as':_0x143c3f['as'],'attributes':_0x143c3f['attributes'],'include':_0x143c3f[_0x7f79('0x1b')]?_[_0x7f79('0x1d')](_0x143c3f[_0x7f79('0x1b')],function(_0x28f63f){return{'model':db[_0x28f63f[_0x7f79('0x1c')]],'as':_0x28f63f['as'],'attributes':_0x28f63f[_0x7f79('0x1e')],'include':_0x28f63f[_0x7f79('0x1b')]?_[_0x7f79('0x1d')](_0x28f63f['include'],function(_0x1b7849){return{'model':db[_0x1b7849[_0x7f79('0x1c')]],'as':_0x1b7849['as'],'attributes':_0x1b7849['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f79('0xb')](function(_0x127d0a){logger[_0x7f79('0xc')](_0x7f79('0x15'),_0x4ccaf0);logger[_0x7f79('0xe')]('ShowSmsAccount',_0x4ccaf0,JSON[_0x7f79('0x10')](_0x127d0a));_0x2217ee(_0x127d0a);})[_0x7f79('0x1f')](function(_0x149a0c){logger[_0x7f79('0x11')](_0x7f79('0x15'),_0x149a0c[_0x7f79('0x12')],_0x4ccaf0);_0x1bd592(_0x3f9a87[_0x7f79('0x11')](0x1f4,_0x149a0c[_0x7f79('0x12')]));});});}; \ No newline at end of file +var _0xeb0d=['http','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','find','options','raw','where','include','map','model','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb0d,0x184));var _0xdeb0=function(_0x568ae7,_0x2b5fa3){_0x568ae7=_0x568ae7-0x0;var _0x257050=_0xeb0d[_0x568ae7];return _0x257050;};'use strict';var _=require(_0xdeb0('0x0'));var util=require(_0xdeb0('0x1'));var moment=require('moment');var BPromise=require(_0xdeb0('0x2'));var rs=require(_0xdeb0('0x3'));var fs=require('fs');var Redis=require(_0xdeb0('0x4'));var db=require(_0xdeb0('0x5'))['db'];var utils=require(_0xdeb0('0x6'));var logger=require(_0xdeb0('0x7'))(_0xdeb0('0x8'));var config=require(_0xdeb0('0x9'));var jayson=require(_0xdeb0('0xa'));var client=jayson[_0xdeb0('0xb')][_0xdeb0('0xc')]({'port':0x232a});config[_0xdeb0('0xd')]=_[_0xdeb0('0xe')](config['redis'],{'host':_0xdeb0('0xf'),'port':0x18eb});var socket=require(_0xdeb0('0x10'))(new Redis(config[_0xdeb0('0xd')]));require('./smsAccount.socket')[_0xdeb0('0x11')](socket);function respondWithRpcPromise(_0x234745,_0x4ff962,_0x2479f9){return new BPromise(function(_0x3ac68f,_0x19ff25){return client[_0xdeb0('0x12')](_0x234745,_0x2479f9)['then'](function(_0x5640a5){logger[_0xdeb0('0x13')](_0xdeb0('0x14'),_0x4ff962,_0xdeb0('0x15'));logger[_0xdeb0('0x16')](_0xdeb0('0x17'),_0x4ff962,_0xdeb0('0x15'),JSON[_0xdeb0('0x18')](_0x5640a5));if(_0x5640a5[_0xdeb0('0x19')]){if(_0x5640a5['error'][_0xdeb0('0x1a')]===0x1f4){logger[_0xdeb0('0x19')](_0xdeb0('0x14'),_0x4ff962,_0x5640a5['error']['message']);return _0x19ff25(_0x5640a5[_0xdeb0('0x19')]['message']);}logger[_0xdeb0('0x19')](_0xdeb0('0x14'),_0x4ff962,_0x5640a5[_0xdeb0('0x19')]['message']);return _0x3ac68f(_0x5640a5[_0xdeb0('0x19')][_0xdeb0('0x1b')]);}else{logger[_0xdeb0('0x13')](_0xdeb0('0x14'),_0x4ff962,_0xdeb0('0x15'));_0x3ac68f(_0x5640a5[_0xdeb0('0x1c')]['message']);}})[_0xdeb0('0x1d')](function(_0x3ff9c3){logger[_0xdeb0('0x19')](_0xdeb0('0x14'),_0x4ff962,_0x3ff9c3);_0x19ff25(_0x3ff9c3);});});}exports['ShowSmsAccount']=function(_0x2efc8f){var _0x298082=this;return new Promise(function(_0x35f483,_0x216b00){return db[_0xdeb0('0x1e')][_0xdeb0('0x1f')]({'raw':_0x2efc8f[_0xdeb0('0x20')]?_0x2efc8f[_0xdeb0('0x20')][_0xdeb0('0x21')]===undefined?!![]:![]:!![],'where':_0x2efc8f[_0xdeb0('0x20')]?_0x2efc8f[_0xdeb0('0x20')][_0xdeb0('0x22')]||null:null,'attributes':_0x2efc8f[_0xdeb0('0x20')]?_0x2efc8f[_0xdeb0('0x20')]['attributes']||null:null,'include':_0x2efc8f[_0xdeb0('0x20')]?_0x2efc8f['options'][_0xdeb0('0x23')]?_['map'](_0x2efc8f[_0xdeb0('0x20')]['include'],function(_0x3f4a7f){return{'model':db[_0x3f4a7f['model']],'as':_0x3f4a7f['as'],'attributes':_0x3f4a7f['attributes'],'include':_0x3f4a7f[_0xdeb0('0x23')]?_[_0xdeb0('0x24')](_0x3f4a7f[_0xdeb0('0x23')],function(_0x15bdc6){return{'model':db[_0x15bdc6[_0xdeb0('0x25')]],'as':_0x15bdc6['as'],'attributes':_0x15bdc6[_0xdeb0('0x26')],'include':_0x15bdc6[_0xdeb0('0x23')]?_[_0xdeb0('0x24')](_0x15bdc6[_0xdeb0('0x23')],function(_0x34372f){return{'model':db[_0x34372f[_0xdeb0('0x25')]],'as':_0x34372f['as'],'attributes':_0x34372f[_0xdeb0('0x26')]};}):[]};}):[]};}):[]:[]})[_0xdeb0('0x27')](function(_0x597c83){logger[_0xdeb0('0x13')]('ShowSmsAccount',_0x2efc8f);logger[_0xdeb0('0x16')]('ShowSmsAccount',_0x2efc8f,JSON[_0xdeb0('0x18')](_0x597c83));_0x35f483(_0x597c83);})[_0xdeb0('0x1d')](function(_0x1fdc51){logger[_0xdeb0('0x19')]('ShowSmsAccount',_0x1fdc51[_0xdeb0('0x1b')],_0x2efc8f);_0x216b00(_0x298082['error'](0x1f4,_0x1fdc51[_0xdeb0('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0218ef7..f865ef8 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(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 285267b..09c1050 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(_0x2e9550,_0x2197bd){var _0xa4fee3=function(_0x13a4fa){while(--_0x13a4fa){_0x2e9550['push'](_0x2e9550['shift']());}};_0xa4fee3(++_0x2197bd);}(_0x008c,0x188));var _0xc008=function(_0x5ec896,_0x4c06cc){_0x5ec896=_0x5ec896-0x0;var _0x5b553b=_0x008c[_0x5ec896];return _0x5b553b;};'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 _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x1d95dd,_0x7bb499){var _0x53348a=function(_0x13f2be){while(--_0x13f2be){_0x1d95dd['push'](_0x1d95dd['shift']());}};_0x53348a(++_0x7bb499);}(_0xe14b,0x93));var _0xbe14=function(_0x5bae4c,_0x226d8e){_0x5bae4c=_0x5bae4c-0x0;var _0x1d1377=_0xe14b[_0x5bae4c];return _0x1d1377;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ea5814f..113ec57 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 _0xe783=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x343042,_0x12f667){var _0x4a42d8=function(_0x23b601){while(--_0x23b601){_0x343042['push'](_0x343042['shift']());}};_0x4a42d8(++_0x12f667);}(_0xe783,0x1de));var _0x3e78=function(_0x4fd6e4,_0x37c100){_0x4fd6e4=_0x4fd6e4-0x0;var _0x589559=_0xe783[_0x4fd6e4];return _0x589559;};'use strict';var Sequelize=require(_0x3e78('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3e78('0x1')],'allowNull':![],'defaultValue':_0x3e78('0x2')},'appdata':{'type':Sequelize[_0x3e78('0x3')]()},'description':{'type':Sequelize[_0x3e78('0x1')]},'interval':{'type':Sequelize[_0x3e78('0x1')],'defaultValue':_0x3e78('0x4')}}; \ No newline at end of file +var _0xf7c1=['noop','TEXT','exports','INTEGER','STRING'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xf7c1,0xd9));var _0x1f7c=function(_0x24d09b,_0x5ebc84){_0x24d09b=_0x24d09b-0x0;var _0x2765d0=_0xf7c1[_0x24d09b];return _0x2765d0;};'use strict';var Sequelize=require('sequelize');module[_0x1f7c('0x0')]={'priority':{'type':Sequelize[_0x1f7c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1f7c('0x2')],'allowNull':![],'defaultValue':_0x1f7c('0x3')},'appdata':{'type':Sequelize[_0x1f7c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1f7c('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 7421de0..a5a51c8 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 _0x1b3d=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','update','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','find','body','destroy','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x1b3d,0x161));var _0xd1b3=function(_0x4391b6,_0x438a42){_0x4391b6=_0x4391b6-0x0;var _0xe70c96=_0x1b3d[_0x4391b6];return _0xe70c96;};'use strict';var emlformat=require(_0xd1b3('0x0'));var rimraf=require(_0xd1b3('0x1'));var zipdir=require(_0xd1b3('0x2'));var jsonpatch=require(_0xd1b3('0x3'));var rp=require('request-promise');var moment=require(_0xd1b3('0x4'));var BPromise=require(_0xd1b3('0x5'));var Mustache=require(_0xd1b3('0x6'));var util=require('util');var path=require(_0xd1b3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd1b3('0x8'));var fs=require('fs');var fs_extra=require(_0xd1b3('0x9'));var _=require(_0xd1b3('0xa'));var squel=require(_0xd1b3('0xb'));var crypto=require(_0xd1b3('0xc'));var jsforce=require(_0xd1b3('0xd'));var deskjs=require(_0xd1b3('0xe'));var toCsv=require(_0xd1b3('0xf'));var querystring=require(_0xd1b3('0x10'));var Papa=require(_0xd1b3('0x11'));var Redis=require(_0xd1b3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd1b3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1b3('0x14'));var logger=require(_0xd1b3('0x15'))('api');var utils=require(_0xd1b3('0x16'));var config=require(_0xd1b3('0x17'));var licenseUtil=require(_0xd1b3('0x18'));var db=require(_0xd1b3('0x19'))['db'];function respondWithStatusCode(_0x1226ef,_0x2e5b83){_0x2e5b83=_0x2e5b83||0xcc;return function(_0x2e6b97){if(_0x2e6b97){return _0x1226ef[_0xd1b3('0x1a')](_0x2e5b83);}return _0x1226ef[_0xd1b3('0x1b')](_0x2e5b83)[_0xd1b3('0x1c')]();};}function respondWithResult(_0x2a7588,_0x1c22df){_0x1c22df=_0x1c22df||0xc8;return function(_0x53593f){if(_0x53593f){return _0x2a7588[_0xd1b3('0x1b')](_0x1c22df)[_0xd1b3('0x1d')](_0x53593f);}};}function respondWithFilteredResult(_0x5d86ef,_0x130b0b){return function(_0x28bda3){if(_0x28bda3){var _0x214262=typeof _0x130b0b[_0xd1b3('0x1e')]==='undefined'&&typeof _0x130b0b[_0xd1b3('0x1f')]==='undefined';var _0x4c9fd9=_0x28bda3[_0xd1b3('0x20')];var _0x4c90e1=_0x214262?0x0:_0x130b0b['offset'];var _0x4a800d=_0x214262?_0x28bda3[_0xd1b3('0x20')]:_0x130b0b['offset']+_0x130b0b['limit'];var _0x16a3e6;if(_0x4a800d>=_0x4c9fd9){_0x4a800d=_0x4c9fd9;_0x16a3e6=0xc8;}else{_0x16a3e6=0xce;}_0x5d86ef[_0xd1b3('0x1b')](_0x16a3e6);return _0x5d86ef['set'](_0xd1b3('0x21'),_0x4c90e1+'-'+_0x4a800d+'/'+_0x4c9fd9)[_0xd1b3('0x1d')](_0x28bda3);}return null;};}function patchUpdates(_0x721484){return function(_0x533e29){try{jsonpatch[_0xd1b3('0x22')](_0x533e29,_0x721484,!![]);}catch(_0x43fa1b){return BPromise['reject'](_0x43fa1b);}return _0x533e29[_0xd1b3('0x23')]();};}function saveUpdates(_0x433371,_0x474655){return function(_0x2438a5){if(_0x2438a5){return _0x2438a5[_0xd1b3('0x24')](_0x433371)[_0xd1b3('0x25')](function(_0x3dcb36){return _0x3dcb36;});}return null;};}function removeEntity(_0x325619,_0x20d126){return function(_0x51990b){if(_0x51990b){return _0x51990b['destroy']()['then'](function(){_0x325619[_0xd1b3('0x1b')](0xcc)[_0xd1b3('0x1c')]();});}};}function handleEntityNotFound(_0x132396,_0x19f78c){return function(_0x317d8c){if(!_0x317d8c){_0x132396['sendStatus'](0x194);}return _0x317d8c;};}function handleError(_0x14a773,_0x24f7bc){_0x24f7bc=_0x24f7bc||0x1f4;return function(_0x98b055){logger[_0xd1b3('0x26')](_0x98b055[_0xd1b3('0x27')]);if(_0x98b055[_0xd1b3('0x28')]){delete _0x98b055['name'];}_0x14a773[_0xd1b3('0x1b')](_0x24f7bc)[_0xd1b3('0x29')](_0x98b055);};}exports[_0xd1b3('0x2a')]=function(_0x215819,_0x39f752){var _0x72ba70={},_0x14c588={},_0x494569={'count':0x0,'rows':[]};var _0x500092=_[_0xd1b3('0x2b')](db[_0xd1b3('0x2c')][_0xd1b3('0x2d')],function(_0x52621d){return{'name':_0x52621d[_0xd1b3('0x2e')],'type':_0x52621d[_0xd1b3('0x2f')][_0xd1b3('0x30')]};});_0x14c588['model']=_[_0xd1b3('0x2b')](_0x500092,_0xd1b3('0x28'));_0x14c588[_0xd1b3('0x31')]=_[_0xd1b3('0x32')](_0x215819[_0xd1b3('0x31')]);_0x14c588['filters']=_[_0xd1b3('0x33')](_0x14c588[_0xd1b3('0x34')],_0x14c588[_0xd1b3('0x31')]);_0x72ba70[_0xd1b3('0x35')]=_[_0xd1b3('0x33')](_0x14c588[_0xd1b3('0x34')],qs['fields'](_0x215819[_0xd1b3('0x31')][_0xd1b3('0x36')]));_0x72ba70[_0xd1b3('0x35')]=_0x72ba70['attributes'][_0xd1b3('0x37')]?_0x72ba70['attributes']:_0x14c588['model'];if(!_0x215819[_0xd1b3('0x31')][_0xd1b3('0x38')]('nolimit')){_0x72ba70[_0xd1b3('0x1f')]=qs['limit'](_0x215819[_0xd1b3('0x31')][_0xd1b3('0x1f')]);_0x72ba70[_0xd1b3('0x1e')]=qs[_0xd1b3('0x1e')](_0x215819['query'][_0xd1b3('0x1e')]);}_0x72ba70['order']=qs[_0xd1b3('0x39')](_0x215819[_0xd1b3('0x31')][_0xd1b3('0x39')]);_0x72ba70[_0xd1b3('0x3a')]=qs[_0xd1b3('0x3b')](_['pick'](_0x215819['query'],_0x14c588['filters']),_0x500092);if(_0x215819[_0xd1b3('0x31')][_0xd1b3('0x3c')]){_0x72ba70['where']=_[_0xd1b3('0x3d')](_0x72ba70[_0xd1b3('0x3a')],{'$or':_[_0xd1b3('0x2b')](_0x500092,function(_0x15b721){if(_0x15b721[_0xd1b3('0x2f')]!=='VIRTUAL'){var _0x5d0af4={};_0x5d0af4[_0x15b721[_0xd1b3('0x28')]]={'$like':'%'+_0x215819[_0xd1b3('0x31')]['filter']+'%'};return _0x5d0af4;}})});}_0x72ba70=_[_0xd1b3('0x3d')]({},_0x72ba70,_0x215819[_0xd1b3('0x3e')]);var _0x592713={'where':_0x72ba70[_0xd1b3('0x3a')]};return db[_0xd1b3('0x2c')][_0xd1b3('0x20')](_0x592713)[_0xd1b3('0x25')](function(_0xbed5c5){_0x494569[_0xd1b3('0x20')]=_0xbed5c5;if(_0x215819['query'][_0xd1b3('0x3f')]){_0x72ba70[_0xd1b3('0x40')]=[{'all':!![]}];}return db['SmsApplication'][_0xd1b3('0x41')](_0x72ba70);})[_0xd1b3('0x25')](function(_0x18eb89){_0x494569[_0xd1b3('0x42')]=_0x18eb89;return _0x494569;})[_0xd1b3('0x25')](respondWithFilteredResult(_0x39f752,_0x72ba70))['catch'](handleError(_0x39f752,null));};exports[_0xd1b3('0x43')]=function(_0x29eb47,_0x46c244){var _0x10c132={'raw':!![],'where':{'id':_0x29eb47[_0xd1b3('0x44')]['id']}},_0x115246={};_0x115246['model']=_[_0xd1b3('0x32')](db[_0xd1b3('0x2c')][_0xd1b3('0x2d')]);_0x115246[_0xd1b3('0x31')]=_['keys'](_0x29eb47[_0xd1b3('0x31')]);_0x115246[_0xd1b3('0x3b')]=_[_0xd1b3('0x33')](_0x115246[_0xd1b3('0x34')],_0x115246[_0xd1b3('0x31')]);_0x10c132['attributes']=_['intersection'](_0x115246[_0xd1b3('0x34')],qs['fields'](_0x29eb47[_0xd1b3('0x31')][_0xd1b3('0x36')]));_0x10c132['attributes']=_0x10c132[_0xd1b3('0x35')][_0xd1b3('0x37')]?_0x10c132[_0xd1b3('0x35')]:_0x115246['model'];if(_0x29eb47[_0xd1b3('0x31')]['includeAll']){_0x10c132[_0xd1b3('0x40')]=[{'all':!![]}];}_0x10c132=_[_0xd1b3('0x3d')]({},_0x10c132,_0x29eb47[_0xd1b3('0x3e')]);return db[_0xd1b3('0x2c')][_0xd1b3('0x45')](_0x10c132)[_0xd1b3('0x25')](handleEntityNotFound(_0x46c244,null))[_0xd1b3('0x25')](respondWithResult(_0x46c244,null))['catch'](handleError(_0x46c244,null));};exports['create']=function(_0x2ca204,_0xf48b2b){return db[_0xd1b3('0x2c')]['create'](_0x2ca204[_0xd1b3('0x46')],{})[_0xd1b3('0x25')](respondWithResult(_0xf48b2b,0xc9))['catch'](handleError(_0xf48b2b,null));};exports[_0xd1b3('0x24')]=function(_0x448489,_0x2bea01){if(_0x448489[_0xd1b3('0x46')]['id']){delete _0x448489[_0xd1b3('0x46')]['id'];}return db[_0xd1b3('0x2c')][_0xd1b3('0x45')]({'where':{'id':_0x448489[_0xd1b3('0x44')]['id']}})[_0xd1b3('0x25')](handleEntityNotFound(_0x2bea01,null))[_0xd1b3('0x25')](saveUpdates(_0x448489[_0xd1b3('0x46')],null))[_0xd1b3('0x25')](respondWithResult(_0x2bea01,null))['catch'](handleError(_0x2bea01,null));};exports[_0xd1b3('0x47')]=function(_0x10555b,_0x3e279f){return db[_0xd1b3('0x2c')][_0xd1b3('0x45')]({'where':{'id':_0x10555b[_0xd1b3('0x44')]['id']}})[_0xd1b3('0x25')](handleEntityNotFound(_0x3e279f,null))[_0xd1b3('0x25')](removeEntity(_0x3e279f,null))[_0xd1b3('0x48')](handleError(_0x3e279f,null));}; \ No newline at end of file +var _0x0b04=['status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','options','find','create','body','params','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xff319d,_0x1dfdc0){var _0x4839c7=function(_0x1a8b67){while(--_0x1a8b67){_0xff319d['push'](_0xff319d['shift']());}};_0x4839c7(++_0x1dfdc0);}(_0x0b04,0x109));var _0x40b0=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x0b04[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40b0('0x0'));var zipdir=require(_0x40b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40b0('0x2'));var moment=require('moment');var BPromise=require(_0x40b0('0x3'));var Mustache=require(_0x40b0('0x4'));var util=require(_0x40b0('0x5'));var path=require(_0x40b0('0x6'));var sox=require(_0x40b0('0x7'));var csv=require(_0x40b0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40b0('0x9'));var _=require(_0x40b0('0xa'));var squel=require(_0x40b0('0xb'));var crypto=require(_0x40b0('0xc'));var jsforce=require(_0x40b0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x40b0('0x8'));var querystring=require('querystring');var Papa=require(_0x40b0('0xe'));var Redis=require('ioredis');var authService=require(_0x40b0('0xf'));var qs=require(_0x40b0('0x10'));var as=require(_0x40b0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40b0('0x12'))(_0x40b0('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x40b0('0x14'));var db=require(_0x40b0('0x15'))['db'];function respondWithStatusCode(_0x4853a6,_0x4feac0){_0x4feac0=_0x4feac0||0xcc;return function(_0x12149c){if(_0x12149c){return _0x4853a6[_0x40b0('0x16')](_0x4feac0);}return _0x4853a6['status'](_0x4feac0)['end']();};}function respondWithResult(_0x545fa2,_0x70f02a){_0x70f02a=_0x70f02a||0xc8;return function(_0x23e6ef){if(_0x23e6ef){return _0x545fa2[_0x40b0('0x17')](_0x70f02a)['json'](_0x23e6ef);}};}function respondWithFilteredResult(_0x41c315,_0x2f04ea){return function(_0x22cef4){if(_0x22cef4){var _0x5754e1=typeof _0x2f04ea[_0x40b0('0x18')]==='undefined'&&typeof _0x2f04ea[_0x40b0('0x19')]===_0x40b0('0x1a');var _0x28959a=_0x22cef4[_0x40b0('0x1b')];var _0xb78f39=_0x5754e1?0x0:_0x2f04ea[_0x40b0('0x18')];var _0x40b4d8=_0x5754e1?_0x22cef4['count']:_0x2f04ea[_0x40b0('0x18')]+_0x2f04ea[_0x40b0('0x19')];var _0x1316e1;if(_0x40b4d8>=_0x28959a){_0x40b4d8=_0x28959a;_0x1316e1=0xc8;}else{_0x1316e1=0xce;}_0x41c315[_0x40b0('0x17')](_0x1316e1);return _0x41c315[_0x40b0('0x1c')](_0x40b0('0x1d'),_0xb78f39+'-'+_0x40b4d8+'/'+_0x28959a)[_0x40b0('0x1e')](_0x22cef4);}return null;};}function patchUpdates(_0x55d7cf){return function(_0x432de4){try{jsonpatch['apply'](_0x432de4,_0x55d7cf,!![]);}catch(_0x3fe4d8){return BPromise[_0x40b0('0x1f')](_0x3fe4d8);}return _0x432de4[_0x40b0('0x20')]();};}function saveUpdates(_0x26a0ad,_0x4c73c8){return function(_0x5c2211){if(_0x5c2211){return _0x5c2211[_0x40b0('0x21')](_0x26a0ad)[_0x40b0('0x22')](function(_0x4dc4cf){return _0x4dc4cf;});}return null;};}function removeEntity(_0x2f473f,_0x2f1bd7){return function(_0x4d119e){if(_0x4d119e){return _0x4d119e[_0x40b0('0x23')]()['then'](function(){_0x2f473f[_0x40b0('0x17')](0xcc)[_0x40b0('0x24')]();});}};}function handleEntityNotFound(_0x2ef131,_0x4c23be){return function(_0x5ded14){if(!_0x5ded14){_0x2ef131[_0x40b0('0x16')](0x194);}return _0x5ded14;};}function handleError(_0x26494e,_0x264f3e){_0x264f3e=_0x264f3e||0x1f4;return function(_0x114bbd){logger[_0x40b0('0x25')](_0x114bbd[_0x40b0('0x26')]);if(_0x114bbd[_0x40b0('0x27')]){delete _0x114bbd['name'];}_0x26494e[_0x40b0('0x17')](_0x264f3e)[_0x40b0('0x28')](_0x114bbd);};}exports[_0x40b0('0x29')]=function(_0x760d73,_0x249cb0){var _0x202fd3={},_0x403ee7={},_0x55874f={'count':0x0,'rows':[]};var _0x34ff11=_[_0x40b0('0x2a')](db[_0x40b0('0x2b')][_0x40b0('0x2c')],function(_0x2cc7cd){return{'name':_0x2cc7cd[_0x40b0('0x2d')],'type':_0x2cc7cd[_0x40b0('0x2e')][_0x40b0('0x2f')]};});_0x403ee7[_0x40b0('0x30')]=_[_0x40b0('0x2a')](_0x34ff11,_0x40b0('0x27'));_0x403ee7['query']=_[_0x40b0('0x31')](_0x760d73['query']);_0x403ee7[_0x40b0('0x32')]=_[_0x40b0('0x33')](_0x403ee7[_0x40b0('0x30')],_0x403ee7['query']);_0x202fd3[_0x40b0('0x34')]=_['intersection'](_0x403ee7['model'],qs[_0x40b0('0x35')](_0x760d73[_0x40b0('0x36')][_0x40b0('0x35')]));_0x202fd3['attributes']=_0x202fd3[_0x40b0('0x34')][_0x40b0('0x37')]?_0x202fd3[_0x40b0('0x34')]:_0x403ee7[_0x40b0('0x30')];if(!_0x760d73[_0x40b0('0x36')]['hasOwnProperty'](_0x40b0('0x38'))){_0x202fd3[_0x40b0('0x19')]=qs['limit'](_0x760d73[_0x40b0('0x36')]['limit']);_0x202fd3['offset']=qs[_0x40b0('0x18')](_0x760d73[_0x40b0('0x36')][_0x40b0('0x18')]);}_0x202fd3['order']=qs[_0x40b0('0x39')](_0x760d73[_0x40b0('0x36')][_0x40b0('0x39')]);_0x202fd3[_0x40b0('0x3a')]=qs[_0x40b0('0x32')](_[_0x40b0('0x3b')](_0x760d73[_0x40b0('0x36')],_0x403ee7[_0x40b0('0x32')]),_0x34ff11);if(_0x760d73[_0x40b0('0x36')][_0x40b0('0x3c')]){_0x202fd3[_0x40b0('0x3a')]=_[_0x40b0('0x3d')](_0x202fd3[_0x40b0('0x3a')],{'$or':_['map'](_0x34ff11,function(_0xa29c13){if(_0xa29c13[_0x40b0('0x2e')]!==_0x40b0('0x3e')){var _0x479516={};_0x479516[_0xa29c13[_0x40b0('0x27')]]={'$like':'%'+_0x760d73['query'][_0x40b0('0x3c')]+'%'};return _0x479516;}})});}_0x202fd3=_[_0x40b0('0x3d')]({},_0x202fd3,_0x760d73['options']);var _0x45379c={'where':_0x202fd3[_0x40b0('0x3a')]};return db['SmsApplication']['count'](_0x45379c)[_0x40b0('0x22')](function(_0xa17220){_0x55874f[_0x40b0('0x1b')]=_0xa17220;if(_0x760d73['query'][_0x40b0('0x3f')]){_0x202fd3['include']=[{'all':!![]}];}return db[_0x40b0('0x2b')][_0x40b0('0x40')](_0x202fd3);})[_0x40b0('0x22')](function(_0x2645ab){_0x55874f[_0x40b0('0x41')]=_0x2645ab;return _0x55874f;})[_0x40b0('0x22')](respondWithFilteredResult(_0x249cb0,_0x202fd3))[_0x40b0('0x42')](handleError(_0x249cb0,null));};exports['show']=function(_0x17a0d8,_0x13378f){var _0x19c17f={'raw':!![],'where':{'id':_0x17a0d8['params']['id']}},_0x26574c={};_0x26574c[_0x40b0('0x30')]=_[_0x40b0('0x31')](db[_0x40b0('0x2b')][_0x40b0('0x2c')]);_0x26574c[_0x40b0('0x36')]=_['keys'](_0x17a0d8[_0x40b0('0x36')]);_0x26574c[_0x40b0('0x32')]=_['intersection'](_0x26574c[_0x40b0('0x30')],_0x26574c[_0x40b0('0x36')]);_0x19c17f['attributes']=_[_0x40b0('0x33')](_0x26574c[_0x40b0('0x30')],qs['fields'](_0x17a0d8[_0x40b0('0x36')]['fields']));_0x19c17f[_0x40b0('0x34')]=_0x19c17f[_0x40b0('0x34')][_0x40b0('0x37')]?_0x19c17f['attributes']:_0x26574c[_0x40b0('0x30')];if(_0x17a0d8[_0x40b0('0x36')][_0x40b0('0x3f')]){_0x19c17f['include']=[{'all':!![]}];}_0x19c17f=_['merge']({},_0x19c17f,_0x17a0d8[_0x40b0('0x43')]);return db['SmsApplication'][_0x40b0('0x44')](_0x19c17f)[_0x40b0('0x22')](handleEntityNotFound(_0x13378f,null))[_0x40b0('0x22')](respondWithResult(_0x13378f,null))[_0x40b0('0x42')](handleError(_0x13378f,null));};exports['create']=function(_0x2af423,_0x1cbeba){return db['SmsApplication'][_0x40b0('0x45')](_0x2af423[_0x40b0('0x46')],{})['then'](respondWithResult(_0x1cbeba,0xc9))[_0x40b0('0x42')](handleError(_0x1cbeba,null));};exports[_0x40b0('0x21')]=function(_0x42af68,_0x3a8741){if(_0x42af68[_0x40b0('0x46')]['id']){delete _0x42af68['body']['id'];}return db[_0x40b0('0x2b')][_0x40b0('0x44')]({'where':{'id':_0x42af68[_0x40b0('0x47')]['id']}})[_0x40b0('0x22')](handleEntityNotFound(_0x3a8741,null))[_0x40b0('0x22')](saveUpdates(_0x42af68[_0x40b0('0x46')],null))['then'](respondWithResult(_0x3a8741,null))[_0x40b0('0x42')](handleError(_0x3a8741,null));};exports[_0x40b0('0x23')]=function(_0x22ffbb,_0x5e49d7){return db[_0x40b0('0x2b')]['find']({'where':{'id':_0x22ffbb[_0x40b0('0x47')]['id']}})[_0x40b0('0x22')](handleEntityNotFound(_0x5e49d7,null))[_0x40b0('0x22')](removeEntity(_0x5e49d7,null))[_0x40b0('0x42')](handleError(_0x5e49d7,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 6738f80..09c51a1 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 _0xf12b=['path','rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0xa5aec7,_0x1dc1f7){var _0x3dc3bd=function(_0x192ca5){while(--_0x192ca5){_0xa5aec7['push'](_0xa5aec7['shift']());}};_0x3dc3bd(++_0x1dc1f7);}(_0xf12b,0x133));var _0xbf12=function(_0x8b0f6a,_0x39fa7d){_0x8b0f6a=_0x8b0f6a-0x0;var _0x2842bc=_0xf12b[_0x8b0f6a];return _0x2842bc;};'use strict';var _=require(_0xbf12('0x0'));var util=require(_0xbf12('0x1'));var logger=require('../../config/logger')(_0xbf12('0x2'));var moment=require(_0xbf12('0x3'));var BPromise=require(_0xbf12('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf12('0x5'));var rimraf=require(_0xbf12('0x6'));var config=require(_0xbf12('0x7'));var attributes=require(_0xbf12('0x8'));module['exports']=function(_0x2853ad,_0x45d4ee){return _0x2853ad['define'](_0xbf12('0x9'),attributes,{'tableName':_0xbf12('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf12('0xb'),'collate':_0xbf12('0xc')});}; \ No newline at end of file +var _0xb20b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','../../config/logger','api'];(function(_0x1ce0ff,_0x1d224c){var _0x448b56=function(_0x508338){while(--_0x508338){_0x1ce0ff['push'](_0x1ce0ff['shift']());}};_0x448b56(++_0x1d224c);}(_0xb20b,0x93));var _0xbb20=function(_0x5e6614,_0x59d498){_0x5e6614=_0x5e6614-0x0;var _0x462955=_0xb20b[_0x5e6614];return _0x462955;};'use strict';var _=require(_0xbb20('0x0'));var util=require('util');var logger=require(_0xbb20('0x1'))(_0xbb20('0x2'));var moment=require(_0xbb20('0x3'));var BPromise=require(_0xbb20('0x4'));var rp=require(_0xbb20('0x5'));var fs=require('fs');var path=require(_0xbb20('0x6'));var rimraf=require(_0xbb20('0x7'));var config=require(_0xbb20('0x8'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x46b3df,_0x2d8f49){return _0x46b3df[_0xbb20('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 45360e2..1cbfad0 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 _0x6ca3=['bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x6ca3,0xba));var _0x36ca=function(_0x2f4ee6,_0x24a540){_0x2f4ee6=_0x2f4ee6-0x0;var _0x28f20e=_0x6ca3[_0x2f4ee6];return _0x28f20e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36ca('0x0'));var BPromise=require(_0x36ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36ca('0x2'));var db=require(_0x36ca('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x36ca('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x36ca('0x5'));var client=jayson[_0x36ca('0x6')][_0x36ca('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4453c2,_0x5996df,_0x5e70ee){return new BPromise(function(_0x1a160c,_0x3c43be){return client['request'](_0x4453c2,_0x5e70ee)['then'](function(_0x14e486){logger[_0x36ca('0x8')](_0x36ca('0x9'),_0x5996df,_0x36ca('0xa'));logger['debug'](_0x36ca('0xb'),_0x5996df,'request\x20sent',JSON[_0x36ca('0xc')](_0x14e486));if(_0x14e486[_0x36ca('0xd')]){if(_0x14e486[_0x36ca('0xd')][_0x36ca('0xe')]===0x1f4){logger[_0x36ca('0xd')]('SmsApplication,\x20%s,\x20%s',_0x5996df,_0x14e486[_0x36ca('0xd')][_0x36ca('0xf')]);return _0x3c43be(_0x14e486[_0x36ca('0xd')]['message']);}logger[_0x36ca('0xd')](_0x36ca('0x9'),_0x5996df,_0x14e486[_0x36ca('0xd')][_0x36ca('0xf')]);return _0x1a160c(_0x14e486[_0x36ca('0xd')][_0x36ca('0xf')]);}else{logger[_0x36ca('0x8')](_0x36ca('0x9'),_0x5996df,_0x36ca('0xa'));_0x1a160c(_0x14e486['result'][_0x36ca('0xf')]);}})[_0x36ca('0x10')](function(_0x212cb2){logger[_0x36ca('0xd')](_0x36ca('0x9'),_0x5996df,_0x212cb2);_0x3c43be(_0x212cb2);});});} \ No newline at end of file +var _0xa2cb=['code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa2cb,0x7d));var _0xba2c=function(_0x78087a,_0x135b22){_0x78087a=_0x78087a-0x0;var _0x1a5435=_0xa2cb[_0x78087a];return _0x1a5435;};'use strict';var _=require(_0xba2c('0x0'));var util=require(_0xba2c('0x1'));var moment=require('moment');var BPromise=require(_0xba2c('0x2'));var rs=require(_0xba2c('0x3'));var fs=require('fs');var Redis=require(_0xba2c('0x4'));var db=require(_0xba2c('0x5'))['db'];var utils=require(_0xba2c('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xba2c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54e503,_0x19c898,_0x525698){return new BPromise(function(_0x747ceb,_0x447f53){return client['request'](_0x54e503,_0x525698)[_0xba2c('0x8')](function(_0x1045fe){logger['info'](_0xba2c('0x9'),_0x19c898,_0xba2c('0xa'));logger[_0xba2c('0xb')](_0xba2c('0xc'),_0x19c898,'request\x20sent',JSON[_0xba2c('0xd')](_0x1045fe));if(_0x1045fe[_0xba2c('0xe')]){if(_0x1045fe[_0xba2c('0xe')][_0xba2c('0xf')]===0x1f4){logger[_0xba2c('0xe')](_0xba2c('0x9'),_0x19c898,_0x1045fe[_0xba2c('0xe')][_0xba2c('0x10')]);return _0x447f53(_0x1045fe[_0xba2c('0xe')][_0xba2c('0x10')]);}logger['error'](_0xba2c('0x9'),_0x19c898,_0x1045fe[_0xba2c('0xe')][_0xba2c('0x10')]);return _0x747ceb(_0x1045fe[_0xba2c('0xe')][_0xba2c('0x10')]);}else{logger[_0xba2c('0x11')](_0xba2c('0x9'),_0x19c898,_0xba2c('0xa'));_0x747ceb(_0x1045fe[_0xba2c('0x12')]['message']);}})[_0xba2c('0x13')](function(_0x125b5e){logger[_0xba2c('0xe')](_0xba2c('0x9'),_0x19c898,_0x125b5e);_0x447f53(_0x125b5e);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index edeaae4..e178f4b 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 _0xda3f=['/:id/tags','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','sms','smsinteraction:addtags','tracked','smsinteraction:update','update','delete','destroy'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xda3f,0xec));var _0xfda3=function(_0x2a0f91,_0x25937f){_0x2a0f91=_0x2a0f91-0x0;var _0x27b53b=_0xda3f[_0x2a0f91];return _0x27b53b;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./smsInteraction.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/download',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0xe')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['post'](_0xfda3('0xb'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfda3('0x11'),_0xfda3('0x12')),controller['addTags']);router['put']('/:id',auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),_0xfda3('0x14')),controller[_0xfda3('0x15')]);router[_0xfda3('0x16')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),'smsinteraction:destroy'),controller[_0xfda3('0x17')]);router[_0xfda3('0x16')](_0xfda3('0x18'),auth[_0xfda3('0x6')](),controller['removeTags']);module[_0xfda3('0x19')]=router; \ No newline at end of file +var _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3bcc2b,_0x2168be){var _0x2180f6=function(_0x192c9b){while(--_0x192c9b){_0x3bcc2b['push'](_0x3bcc2b['shift']());}};_0x2180f6(++_0x2168be);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index ee5107f..82b6444 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 _0x05bc=['moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3d1807,_0x4fabc2){var _0x2b15c0=function(_0x15311e){while(--_0x15311e){_0x3d1807['push'](_0x3d1807['shift']());}};_0x2b15c0(++_0x4fabc2);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc05b('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc05b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc05b('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc05b('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc05b('0x3')]},'note':{'type':Sequelize[_0xc05b('0x3')]},'phone':{'type':Sequelize[_0xc05b('0x3')]},'read1stAt':{'type':Sequelize[_0xc05b('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xc05b('0x4')]('in',_0xc05b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc05b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc05b('0x4')]('in',_0xc05b('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc05b('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xa1f6=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x340dc7,_0x330051){var _0x378e2e=function(_0x153f5f){while(--_0x153f5f){_0x340dc7['push'](_0x340dc7['shift']());}};_0x378e2e(++_0x330051);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xa1f6[_0x367361];return _0x195d2d;};'use strict';var Sequelize=require(_0x6a1f('0x0'));var moment=require(_0x6a1f('0x1'));module[_0x6a1f('0x2')]={'closed':{'type':Sequelize[_0x6a1f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6a1f('0x4')]},'disposition':{'type':Sequelize[_0x6a1f('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6a1f('0x6')]('in',_0x6a1f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6a1f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x6a1f('0x6')]('in',_0x6a1f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6a1f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 0e2ee0a..1242b96 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 _0x2675=['mkdirSync','Account','N.A.','closedAt','disposition','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','sms','query','user','catch','show','params','keys','filters','model','attributes','intersection','fields','includeAll','merge','options','create','body','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Owner','get'];(function(_0x251cec,_0x105364){var _0x51636b=function(_0x5326ed){while(--_0x5326ed){_0x251cec['push'](_0x251cec['shift']());}};_0x51636b(++_0x105364);}(_0x2675,0x91));var _0x5267=function(_0x16d2ae,_0x51822d){_0x16d2ae=_0x16d2ae-0x0;var _0x36be4b=_0x2675[_0x16d2ae];return _0x36be4b;};'use strict';var rimraf=require(_0x5267('0x0'));var zipdir=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require(_0x5267('0x5'));var ejs=require(_0x5267('0x6'));var fs=require('fs');var _=require(_0x5267('0x7'));var Redis=require(_0x5267('0x8'));var interaction=require(_0x5267('0x9'));var qs=require('../../components/parsers/qs');var pdf=require(_0x5267('0xa'));var logger=require('../../config/logger')(_0x5267('0xb'));var config=require(_0x5267('0xc'));var db=require(_0x5267('0xd'))['db'];config[_0x5267('0xe')]=_[_0x5267('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5267('0x10'))(new Redis(config[_0x5267('0xe')]));require(_0x5267('0x11'))[_0x5267('0x12')](socket);function respondWithStatusCode(_0x16b4f1,_0x22271c){_0x22271c=_0x22271c||0xcc;return function(_0x2fa95f){if(_0x2fa95f){return _0x16b4f1[_0x5267('0x13')](_0x22271c);}return _0x16b4f1[_0x5267('0x14')](_0x22271c)[_0x5267('0x15')]();};}function respondWithResult(_0x1ba9df,_0x1ebf62){_0x1ebf62=_0x1ebf62||0xc8;return function(_0x3cd481){if(_0x3cd481){return _0x1ba9df[_0x5267('0x14')](_0x1ebf62)['json'](_0x3cd481);}};}function respondWithFilteredResult(_0x37d294,_0x27b52c){return function(_0x576ee4){if(_0x576ee4){var _0x33063a=typeof _0x27b52c[_0x5267('0x16')]===_0x5267('0x17')&&typeof _0x27b52c[_0x5267('0x18')]===_0x5267('0x17');var _0x18cc26=_0x576ee4[_0x5267('0x19')];var _0x48eb67=_0x33063a?0x0:_0x27b52c[_0x5267('0x16')];var _0x3020a6=_0x33063a?_0x576ee4['count']:_0x27b52c['offset']+_0x27b52c[_0x5267('0x18')];var _0x4622ef;if(_0x3020a6>=_0x18cc26){_0x3020a6=_0x18cc26;_0x4622ef=0xc8;}else{_0x4622ef=0xce;}_0x37d294[_0x5267('0x14')](_0x4622ef);return _0x37d294[_0x5267('0x1a')](_0x5267('0x1b'),_0x48eb67+'-'+_0x3020a6+'/'+_0x18cc26)[_0x5267('0x1c')](_0x576ee4);}return null;};}function saveUpdates(_0x30f9b6){return function(_0x493eee){if(_0x493eee){return _0x493eee[_0x5267('0x1d')](_0x30f9b6)[_0x5267('0x1e')](function(_0xea826e){return _0xea826e;});}return null;};}function removeEntity(_0x4706ac){return function(_0xb1d956){if(_0xb1d956){return _0xb1d956[_0x5267('0x1f')]()[_0x5267('0x1e')](function(){_0x4706ac['status'](0xcc)[_0x5267('0x15')]();});}};}function handleEntityNotFound(_0x8021d7){return function(_0x4096cd){if(!_0x4096cd){_0x8021d7[_0x5267('0x13')](0x194);}return _0x4096cd;};}function handleError(_0x95029c,_0x1a05f3){_0x1a05f3=_0x1a05f3||0x1f4;return function(_0x363a4c){logger[_0x5267('0x20')](_0x363a4c[_0x5267('0x21')]);if(_0x363a4c[_0x5267('0x22')]){delete _0x363a4c[_0x5267('0x22')];}_0x95029c['status'](_0x1a05f3)[_0x5267('0x23')](_0x363a4c);};}exports['index']=function(_0xc7e826,_0x23a449){var _0x2f3118={};var _0x4ff7fb=_[_0x5267('0x24')](db[_0x5267('0x25')][_0x5267('0x26')],function(_0x4c28d8){return{'name':_0x4c28d8[_0x5267('0x27')],'type':_0x4c28d8[_0x5267('0x28')][_0x5267('0x29')]};});_0x2f3118=qs[_0x5267('0x2a')](_0x4ff7fb,_0xc7e826);return interaction['findAll'](_0x5267('0x2b'),_0xc7e826[_0x5267('0x2c')],_0xc7e826[_0x5267('0x2d')],_0x2f3118,_0x4ff7fb)['then'](respondWithFilteredResult(_0x23a449,_0x2f3118))[_0x5267('0x2e')](handleError(_0x23a449,null));};exports[_0x5267('0x2f')]=function(_0x491162,_0x76e9c5){var _0x36ad53={'raw':![],'where':{'id':_0x491162[_0x5267('0x30')]['id']}},_0x455ef7={};_0x455ef7['model']=_[_0x5267('0x31')](db['SmsInteraction'][_0x5267('0x26')]);_0x455ef7[_0x5267('0x2c')]=_[_0x5267('0x31')](_0x491162[_0x5267('0x2c')]);_0x455ef7[_0x5267('0x32')]=_['intersection'](_0x455ef7[_0x5267('0x33')],_0x455ef7[_0x5267('0x2c')]);_0x36ad53[_0x5267('0x34')]=_[_0x5267('0x35')](_0x455ef7['model'],qs[_0x5267('0x36')](_0x491162[_0x5267('0x2c')][_0x5267('0x36')]));_0x36ad53[_0x5267('0x34')]=_0x36ad53['attributes']['length']?_0x36ad53[_0x5267('0x34')]:_0x455ef7[_0x5267('0x33')];if(_0x491162['query'][_0x5267('0x37')]){_0x36ad53['include']=[{'all':!![]}];}_0x36ad53=_[_0x5267('0x38')]({},_0x36ad53,_0x491162[_0x5267('0x39')]);return db[_0x5267('0x25')]['find'](_0x36ad53)[_0x5267('0x1e')](handleEntityNotFound(_0x76e9c5,null))[_0x5267('0x1e')](respondWithResult(_0x76e9c5,null))['catch'](handleError(_0x76e9c5,null));};exports[_0x5267('0x3a')]=function(_0x141598,_0x3b787e){return db['SmsInteraction'][_0x5267('0x3a')](_0x141598[_0x5267('0x3b')],{})['then'](respondWithResult(_0x3b787e,0xc9))[_0x5267('0x2e')](handleError(_0x3b787e,null));};exports[_0x5267('0x1d')]=function(_0x2a2d3c,_0xaa81e7){if(_0x2a2d3c[_0x5267('0x3b')]['id']){delete _0x2a2d3c[_0x5267('0x3b')]['id'];}return db[_0x5267('0x25')][_0x5267('0x3c')]({'where':{'id':_0x2a2d3c[_0x5267('0x30')]['id']}})[_0x5267('0x1e')](handleEntityNotFound(_0xaa81e7,null))[_0x5267('0x1e')](saveUpdates(_0x2a2d3c[_0x5267('0x3b')],null))['then'](respondWithResult(_0xaa81e7,null))['catch'](handleError(_0xaa81e7,null));};exports[_0x5267('0x1f')]=function(_0x2fcf99,_0x44ef0d){return db[_0x5267('0x25')][_0x5267('0x3c')]({'where':{'id':_0x2fcf99[_0x5267('0x30')]['id']}})['then'](handleEntityNotFound(_0x44ef0d,null))[_0x5267('0x1e')](removeEntity(_0x44ef0d,null))[_0x5267('0x2e')](handleError(_0x44ef0d,null));};exports[_0x5267('0x3d')]=function(_0x465517,_0x30dd3f){return db[_0x5267('0x25')][_0x5267('0x3d')]()[_0x5267('0x1e')](respondWithResult(_0x30dd3f,null))[_0x5267('0x2e')](handleError(_0x30dd3f,null));};exports[_0x5267('0x3e')]=function(_0x1dbd8c,_0x47be92){return db[_0x5267('0x3f')][_0x5267('0x3c')]({'where':{'id':_0x1dbd8c[_0x5267('0x30')]['id']}})[_0x5267('0x1e')](handleEntityNotFound(_0x47be92,null))['then'](function(_0x79338f){if(_0x79338f){return _0x79338f['addMessage'](_0x1dbd8c[_0x5267('0x3b')][_0x5267('0x40')],_[_0x5267('0x41')](_0x1dbd8c[_0x5267('0x3b')],[_0x5267('0x40'),'id'])||{});}})['then'](respondWithResult(_0x47be92,null))['catch'](handleError(_0x47be92,null));};exports[_0x5267('0x42')]=function(_0x2db7bb,_0x5a88c9){var _0x3d76e9={'raw':![],'where':{}};var _0x457b09={};var _0x5dccbb={'count':0x0,'rows':[]};return db[_0x5267('0x25')][_0x5267('0x43')]({'where':{'id':_0x2db7bb[_0x5267('0x30')]['id']}})[_0x5267('0x1e')](handleEntityNotFound(_0x5a88c9,null))['then'](function(_0x1f9a78){if(_0x1f9a78){_0x457b09[_0x5267('0x33')]=_[_0x5267('0x31')](db['SmsMessage'][_0x5267('0x26')]);_0x457b09[_0x5267('0x2c')]=_['keys'](_0x2db7bb[_0x5267('0x2c')]);_0x457b09[_0x5267('0x32')]=_[_0x5267('0x35')](_0x457b09[_0x5267('0x33')],_0x457b09[_0x5267('0x2c')]);_0x3d76e9[_0x5267('0x34')]=_[_0x5267('0x35')](_0x457b09[_0x5267('0x33')],qs['fields'](_0x2db7bb[_0x5267('0x2c')][_0x5267('0x36')]));_0x3d76e9[_0x5267('0x34')]=_0x3d76e9[_0x5267('0x34')]['length']?_0x3d76e9[_0x5267('0x34')]:_0x457b09[_0x5267('0x33')];if(!_0x2db7bb[_0x5267('0x2c')][_0x5267('0x44')]('nolimit')){_0x3d76e9[_0x5267('0x18')]=qs[_0x5267('0x18')](_0x2db7bb[_0x5267('0x2c')][_0x5267('0x18')]);_0x3d76e9['offset']=qs[_0x5267('0x16')](_0x2db7bb[_0x5267('0x2c')][_0x5267('0x16')]);}_0x3d76e9[_0x5267('0x45')]=qs[_0x5267('0x46')](_0x2db7bb[_0x5267('0x2c')]['sort']);_0x3d76e9[_0x5267('0x47')]=qs[_0x5267('0x32')](_[_0x5267('0x48')](_0x2db7bb['query'],_0x457b09['filters']));_0x3d76e9['where'][_0x5267('0x49')]=_0x1f9a78['id'];if(_0x2db7bb[_0x5267('0x2c')][_0x5267('0x4a')]){_0x3d76e9[_0x5267('0x47')]=_[_0x5267('0x38')](_0x3d76e9[_0x5267('0x47')],{'$or':_[_0x5267('0x24')](_0x3d76e9['attributes'],function(_0x251c29){var _0x48589d={};_0x48589d[_0x251c29]={'$like':'%'+_0x2db7bb[_0x5267('0x2c')][_0x5267('0x4a')]+'%'};return _0x48589d;})});}if(_0x2db7bb['query'][_0x5267('0x4b')]){var _0x534f4a=_0x2db7bb[_0x5267('0x2c')][_0x5267('0x4b')][_0x5267('0x4c')](',');var _0x1f5024={};_0x1f5024[_0x534f4a[0x0]]={'$gte':moment(_0x534f4a[0x1])[_0x5267('0x4d')](_0x5267('0x4e'))};_0x3d76e9['where']=_[_0x5267('0x38')](_0x3d76e9[_0x5267('0x47')],_0x1f5024);}_0x3d76e9=_[_0x5267('0x38')]({},_0x3d76e9,_0x2db7bb[_0x5267('0x39')]);return db[_0x5267('0x3f')][_0x5267('0x19')]({'where':_0x3d76e9['where']})[_0x5267('0x1e')](function(_0x880647){_0x5dccbb[_0x5267('0x19')]=_0x880647;if(_0x2db7bb['query'][_0x5267('0x37')]){_0x3d76e9['include']=[{'all':!![]}];}return db[_0x5267('0x3f')][_0x5267('0x4f')](_0x3d76e9);})[_0x5267('0x1e')](function(_0x28d455){_0x5dccbb['rows']=_0x28d455;return _0x5dccbb;});}})[_0x5267('0x1e')](respondWithFilteredResult(_0x5a88c9,_0x3d76e9))[_0x5267('0x2e')](handleError(_0x5a88c9,null));};exports[_0x5267('0x50')]=function(_0x178cba,_0x48e7d6){return db[_0x5267('0x25')]['find']({'where':{'id':_0x178cba[_0x5267('0x30')]['id']}})[_0x5267('0x1e')](handleEntityNotFound(_0x48e7d6,null))[_0x5267('0x1e')](function(_0x25e40f){if(_0x25e40f){return _0x25e40f[_0x5267('0x51')](_0x178cba[_0x5267('0x3b')][_0x5267('0x40')],_[_0x5267('0x41')](_0x178cba[_0x5267('0x3b')],[_0x5267('0x40'),'id'])||{})[_0x5267('0x52')](function(){return db['Tag'][_0x5267('0x4f')]({'attributes':['id','name',_0x5267('0x53')],'where':{'id':_0x178cba['body']['ids']}});})[_0x5267('0x1e')](function(_0x543ab2){socket[_0x5267('0x54')](_0x5267('0x55'),{'id':Number(_0x178cba[_0x5267('0x30')]['id']),'tags':_0x543ab2||[]});return{'id':Number(_0x178cba[_0x5267('0x30')]['id']),'tags':_0x543ab2||[]};});}})[_0x5267('0x1e')](respondWithResult(_0x48e7d6,null))[_0x5267('0x2e')](handleError(_0x48e7d6,null));};exports[_0x5267('0x56')]=function(_0x6b1599,_0x75d575){return db[_0x5267('0x25')]['find']({'where':{'id':_0x6b1599[_0x5267('0x30')]['id']}})[_0x5267('0x1e')](handleEntityNotFound(_0x75d575,null))[_0x5267('0x1e')](function(_0x5c3d97){if(_0x5c3d97){return _0x5c3d97[_0x5267('0x56')](_0x6b1599[_0x5267('0x2c')]['ids']);}})[_0x5267('0x1e')](respondWithStatusCode(_0x75d575,null))[_0x5267('0x2e')](handleError(_0x75d575,null));};exports['download']=function(_0x140f62,_0x9564bc){var _0x423ec3=moment()[_0x5267('0x57')]()[_0x5267('0x58')]();var _0x399d9f=path[_0x5267('0x59')](config[_0x5267('0x5a')],_0x5267('0x5b'),_0x5267('0x5c'),'tmp');var _0x317200=path['join'](_0x399d9f,_0x423ec3);var _0x8f85e7=util[_0x5267('0x4d')](_0x5267('0x5d'),_0x140f62[_0x5267('0x30')]['id'],_0x423ec3);var _0x5c7dfc=path['join'](_0x399d9f,_0x8f85e7);var _0x7ded27=[];_0x7ded27[_0x5267('0x5e')]({'model':db[_0x5267('0x5f')],'as':'User','attributes':['id',_0x5267('0x60')],'raw':!![]});_0x7ded27['push']({'model':db[_0x5267('0x61')],'as':_0x5267('0x62'),'attributes':['id',_0x5267('0x63'),_0x5267('0x64')],'raw':!![]});var _0x106906=[{'model':db[_0x5267('0x3f')],'as':_0x5267('0x65'),'attributes':['id',_0x5267('0x3b'),_0x5267('0x66'),_0x5267('0x67'),_0x5267('0x68'),_0x5267('0x69')],'include':_0x7ded27}];_0x106906[_0x5267('0x5e')]({'model':db[_0x5267('0x6a')],'as':'Account','attributes':['id',_0x5267('0x22')]});_0x106906['push']({'model':db['User'],'as':_0x5267('0x6b'),'attributes':['id','fullname']});return db[_0x5267('0x25')][_0x5267('0x3c')]({'where':{'id':_0x140f62[_0x5267('0x30')]['id']},'include':_0x106906})[_0x5267('0x1e')](handleEntityNotFound(_0x9564bc,null))[_0x5267('0x1e')](function(_0x3f39b4){if(_0x3f39b4){var _0x1b36a1=_0x3f39b4[_0x5267('0x6c')]({'plain':!![]});fs[_0x5267('0x6d')](_0x317200);var _0x43a09e={'channel':'Sms','account':_0x1b36a1[_0x5267('0x6e')][_0x5267('0x22')],'agent':_0x1b36a1[_0x5267('0x6b')]?_0x1b36a1['Owner'][_0x5267('0x60')]:_0x5267('0x6f'),'createdAt':moment(_0x1b36a1[_0x5267('0x66')])[_0x5267('0x4d')](_0x5267('0x4e'))[_0x5267('0x58')](),'closedAt':_0x1b36a1['closed']?moment(_0x1b36a1[_0x5267('0x70')])[_0x5267('0x4d')](_0x5267('0x4e'))[_0x5267('0x58')]():'','disposition':_0x1b36a1[_0x5267('0x71')],'messages':_(_0x1b36a1[_0x5267('0x65')])['filter']({'secret':![]})[_0x5267('0x24')](function(_0x25b93d){return{'date':moment(_0x25b93d[_0x5267('0x66')])[_0x5267('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5267('0x58')](),'sender':_0x25b93d[_0x5267('0x67')]===_0x5267('0x72')?_0x25b93d[_0x5267('0x5f')]?_0x25b93d[_0x5267('0x5f')][_0x5267('0x60')]:_0x5267('0x73'):_0x25b93d[_0x5267('0x62')]['firstName']+(_0x25b93d[_0x5267('0x62')][_0x5267('0x64')]?'\x20'+_0x25b93d[_0x5267('0x62')][_0x5267('0x64')]:''),'body':_0x25b93d[_0x5267('0x3b')],'direction':_0x25b93d['direction']===_0x5267('0x72')?'A':'C','secret':_0x25b93d[_0x5267('0x68')],'read':_0x25b93d[_0x5267('0x69')]};})[_0x5267('0x74')]()};return ejs[_0x5267('0x75')](path[_0x5267('0x59')](config[_0x5267('0x5a')],'server',_0x5267('0x76'),_0x5267('0x77')),{'interaction':_0x43a09e})[_0x5267('0x1e')](function(_0x4b42b0){var _0x214ba7=path['join'](_0x317200,_0x5267('0x78')+_0x1b36a1['id']+'-'+_0x423ec3+_0x5267('0x79'));var _0x384c95={'path':_0x214ba7,'channel':_0x5267('0x7a'),'interactionId':_0x1b36a1['id']};return pdf['createPdfFromHTML'](_0x4b42b0,_0x384c95);})['then'](function(){return new BPromise(function(_0x21115a,_0x3215f0){zipdir(_0x317200,{'saveTo':_0x5c7dfc},function(_0x380807,_0x7c91d9){if(_0x380807)return _0x3215f0(_0x380807);return _0x21115a(_0x7c91d9);});})['then'](function(){return new BPromise(function(_0x3825ae,_0x5e308d){rimraf(_0x317200,function(_0x282133){if(_0x282133)_0x5e308d(_0x282133);return _0x3825ae();});});})[_0x5267('0x1e')](function(){return _0x9564bc[_0x5267('0x7b')](_0x5c7dfc,_0x8f85e7,function(_0x33f6d6){if(_0x33f6d6){console[_0x5267('0x7c')](_0x5267('0x7d'),_0x33f6d6);}else{fs[_0x5267('0x7e')](_0x5c7dfc);}});});});}else{return _0x9564bc[_0x5267('0x13')](0xc8);}})['catch'](handleError(_0x9564bc,null));}; \ No newline at end of file +var _0x1722=['order','sort','pick','SmsInteractionId','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','files','transcript-%d-%s.zip','User','fullname','push','CmContact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Owner','mkdirSync','Sms','Account','N.A.','closed','closedAt','format','disposition','out','System','Contact','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./smsInteraction.socket','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','sendStatus','name','index','map','SmsInteraction','rawAttributes','type','key','getOptions','findAll','sms','user','catch','params','keys','query','filters','intersection','attributes','model','fields','length','include','merge','options','create','body','find','describe','addMessage','ids','omit','findOne','SmsMessage','hasOwnProperty'];(function(_0x14e213,_0x15f651){var _0x3365cd=function(_0x5b49a5){while(--_0x5b49a5){_0x14e213['push'](_0x14e213['shift']());}};_0x3365cd(++_0x15f651);}(_0x1722,0xad));var _0x2172=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1722[_0x19950b];return _0x3c6b41;};'use strict';var rimraf=require(_0x2172('0x0'));var zipdir=require(_0x2172('0x1'));var moment=require(_0x2172('0x2'));var BPromise=require(_0x2172('0x3'));var util=require(_0x2172('0x4'));var path=require(_0x2172('0x5'));var ejs=require(_0x2172('0x6'));var fs=require('fs');var _=require(_0x2172('0x7'));var Redis=require('ioredis');var interaction=require(_0x2172('0x8'));var qs=require(_0x2172('0x9'));var pdf=require(_0x2172('0xa'));var logger=require(_0x2172('0xb'))(_0x2172('0xc'));var config=require(_0x2172('0xd'));var db=require('../../mysqldb')['db'];config[_0x2172('0xe')]=_[_0x2172('0xf')](config[_0x2172('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x2172('0x10'))(new Redis(config[_0x2172('0xe')]));require(_0x2172('0x11'))['register'](socket);function respondWithStatusCode(_0x49366e,_0x2a7ade){_0x2a7ade=_0x2a7ade||0xcc;return function(_0x3e2782){if(_0x3e2782){return _0x49366e['sendStatus'](_0x2a7ade);}return _0x49366e['status'](_0x2a7ade)[_0x2172('0x12')]();};}function respondWithResult(_0x2c07c0,_0x344e03){_0x344e03=_0x344e03||0xc8;return function(_0x40089e){if(_0x40089e){return _0x2c07c0[_0x2172('0x13')](_0x344e03)['json'](_0x40089e);}};}function respondWithFilteredResult(_0x2fa871,_0x2d21a2){return function(_0x57bbca){if(_0x57bbca){var _0x12366a=typeof _0x2d21a2[_0x2172('0x14')]===_0x2172('0x15')&&typeof _0x2d21a2[_0x2172('0x16')]===_0x2172('0x15');var _0x51c53e=_0x57bbca[_0x2172('0x17')];var _0x2980cb=_0x12366a?0x0:_0x2d21a2[_0x2172('0x14')];var _0x4a162b=_0x12366a?_0x57bbca[_0x2172('0x17')]:_0x2d21a2['offset']+_0x2d21a2[_0x2172('0x16')];var _0x5cf63c;if(_0x4a162b>=_0x51c53e){_0x4a162b=_0x51c53e;_0x5cf63c=0xc8;}else{_0x5cf63c=0xce;}_0x2fa871[_0x2172('0x13')](_0x5cf63c);return _0x2fa871[_0x2172('0x18')](_0x2172('0x19'),_0x2980cb+'-'+_0x4a162b+'/'+_0x51c53e)[_0x2172('0x1a')](_0x57bbca);}return null;};}function saveUpdates(_0x20a4f8){return function(_0x46a132){if(_0x46a132){return _0x46a132[_0x2172('0x1b')](_0x20a4f8)[_0x2172('0x1c')](function(_0x11ccb7){return _0x11ccb7;});}return null;};}function removeEntity(_0x25e507){return function(_0x4797fa){if(_0x4797fa){return _0x4797fa[_0x2172('0x1d')]()['then'](function(){_0x25e507[_0x2172('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fc8a){return function(_0x14604d){if(!_0x14604d){_0x33fc8a[_0x2172('0x1e')](0x194);}return _0x14604d;};}function handleError(_0xf46b25,_0x4d02f6){_0x4d02f6=_0x4d02f6||0x1f4;return function(_0x1af4f0){logger['error'](_0x1af4f0['stack']);if(_0x1af4f0[_0x2172('0x1f')]){delete _0x1af4f0[_0x2172('0x1f')];}_0xf46b25[_0x2172('0x13')](_0x4d02f6)['send'](_0x1af4f0);};}exports[_0x2172('0x20')]=function(_0x289a78,_0x406873){var _0x2e3c8c={};var _0x563968=_[_0x2172('0x21')](db[_0x2172('0x22')][_0x2172('0x23')],function(_0x406fa7){return{'name':_0x406fa7['fieldName'],'type':_0x406fa7[_0x2172('0x24')][_0x2172('0x25')]};});_0x2e3c8c=qs[_0x2172('0x26')](_0x563968,_0x289a78);return interaction[_0x2172('0x27')](_0x2172('0x28'),_0x289a78['query'],_0x289a78[_0x2172('0x29')],_0x2e3c8c,_0x563968)[_0x2172('0x1c')](respondWithFilteredResult(_0x406873,_0x2e3c8c))[_0x2172('0x2a')](handleError(_0x406873,null));};exports['show']=function(_0x1dbdca,_0x3c6072){var _0x1cefb9={'raw':![],'where':{'id':_0x1dbdca[_0x2172('0x2b')]['id']}},_0xfb89d7={};_0xfb89d7['model']=_[_0x2172('0x2c')](db[_0x2172('0x22')][_0x2172('0x23')]);_0xfb89d7[_0x2172('0x2d')]=_[_0x2172('0x2c')](_0x1dbdca[_0x2172('0x2d')]);_0xfb89d7[_0x2172('0x2e')]=_[_0x2172('0x2f')](_0xfb89d7['model'],_0xfb89d7[_0x2172('0x2d')]);_0x1cefb9[_0x2172('0x30')]=_[_0x2172('0x2f')](_0xfb89d7[_0x2172('0x31')],qs[_0x2172('0x32')](_0x1dbdca[_0x2172('0x2d')][_0x2172('0x32')]));_0x1cefb9[_0x2172('0x30')]=_0x1cefb9['attributes'][_0x2172('0x33')]?_0x1cefb9[_0x2172('0x30')]:_0xfb89d7[_0x2172('0x31')];if(_0x1dbdca[_0x2172('0x2d')]['includeAll']){_0x1cefb9[_0x2172('0x34')]=[{'all':!![]}];}_0x1cefb9=_[_0x2172('0x35')]({},_0x1cefb9,_0x1dbdca[_0x2172('0x36')]);return db[_0x2172('0x22')]['find'](_0x1cefb9)[_0x2172('0x1c')](handleEntityNotFound(_0x3c6072,null))[_0x2172('0x1c')](respondWithResult(_0x3c6072,null))['catch'](handleError(_0x3c6072,null));};exports[_0x2172('0x37')]=function(_0x1e4c0c,_0x367024){return db[_0x2172('0x22')]['create'](_0x1e4c0c[_0x2172('0x38')],{})[_0x2172('0x1c')](respondWithResult(_0x367024,0xc9))[_0x2172('0x2a')](handleError(_0x367024,null));};exports[_0x2172('0x1b')]=function(_0xa6151a,_0x5d8554){if(_0xa6151a[_0x2172('0x38')]['id']){delete _0xa6151a[_0x2172('0x38')]['id'];}return db[_0x2172('0x22')]['find']({'where':{'id':_0xa6151a[_0x2172('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d8554,null))[_0x2172('0x1c')](saveUpdates(_0xa6151a[_0x2172('0x38')],null))[_0x2172('0x1c')](respondWithResult(_0x5d8554,null))['catch'](handleError(_0x5d8554,null));};exports[_0x2172('0x1d')]=function(_0x1ac2de,_0x15e016){return db[_0x2172('0x22')][_0x2172('0x39')]({'where':{'id':_0x1ac2de[_0x2172('0x2b')]['id']}})[_0x2172('0x1c')](handleEntityNotFound(_0x15e016,null))[_0x2172('0x1c')](removeEntity(_0x15e016,null))[_0x2172('0x2a')](handleError(_0x15e016,null));};exports[_0x2172('0x3a')]=function(_0x6b70bf,_0xdffc4e){return db[_0x2172('0x22')][_0x2172('0x3a')]()[_0x2172('0x1c')](respondWithResult(_0xdffc4e,null))[_0x2172('0x2a')](handleError(_0xdffc4e,null));};exports[_0x2172('0x3b')]=function(_0x170137,_0xf237cc){return db['SmsMessage'][_0x2172('0x39')]({'where':{'id':_0x170137[_0x2172('0x2b')]['id']}})[_0x2172('0x1c')](handleEntityNotFound(_0xf237cc,null))[_0x2172('0x1c')](function(_0x209f9c){if(_0x209f9c){return _0x209f9c[_0x2172('0x3b')](_0x170137[_0x2172('0x38')][_0x2172('0x3c')],_[_0x2172('0x3d')](_0x170137[_0x2172('0x38')],[_0x2172('0x3c'),'id'])||{});}})['then'](respondWithResult(_0xf237cc,null))[_0x2172('0x2a')](handleError(_0xf237cc,null));};exports['getMessages']=function(_0x2a7414,_0xe0b414){var _0x273e7f={'raw':![],'where':{}};var _0x42dfd7={};var _0x53a323={'count':0x0,'rows':[]};return db[_0x2172('0x22')][_0x2172('0x3e')]({'where':{'id':_0x2a7414[_0x2172('0x2b')]['id']}})[_0x2172('0x1c')](handleEntityNotFound(_0xe0b414,null))[_0x2172('0x1c')](function(_0xafc004){if(_0xafc004){_0x42dfd7[_0x2172('0x31')]=_['keys'](db[_0x2172('0x3f')][_0x2172('0x23')]);_0x42dfd7['query']=_[_0x2172('0x2c')](_0x2a7414['query']);_0x42dfd7['filters']=_[_0x2172('0x2f')](_0x42dfd7[_0x2172('0x31')],_0x42dfd7[_0x2172('0x2d')]);_0x273e7f['attributes']=_['intersection'](_0x42dfd7[_0x2172('0x31')],qs[_0x2172('0x32')](_0x2a7414[_0x2172('0x2d')][_0x2172('0x32')]));_0x273e7f[_0x2172('0x30')]=_0x273e7f[_0x2172('0x30')][_0x2172('0x33')]?_0x273e7f[_0x2172('0x30')]:_0x42dfd7['model'];if(!_0x2a7414[_0x2172('0x2d')][_0x2172('0x40')]('nolimit')){_0x273e7f[_0x2172('0x16')]=qs['limit'](_0x2a7414[_0x2172('0x2d')][_0x2172('0x16')]);_0x273e7f[_0x2172('0x14')]=qs[_0x2172('0x14')](_0x2a7414[_0x2172('0x2d')][_0x2172('0x14')]);}_0x273e7f[_0x2172('0x41')]=qs[_0x2172('0x42')](_0x2a7414['query'][_0x2172('0x42')]);_0x273e7f['where']=qs[_0x2172('0x2e')](_[_0x2172('0x43')](_0x2a7414[_0x2172('0x2d')],_0x42dfd7[_0x2172('0x2e')]));_0x273e7f['where'][_0x2172('0x44')]=_0xafc004['id'];if(_0x2a7414[_0x2172('0x2d')]['filter']){_0x273e7f[_0x2172('0x45')]=_['merge'](_0x273e7f[_0x2172('0x45')],{'$or':_[_0x2172('0x21')](_0x273e7f['attributes'],function(_0x5147ce){var _0x1bb008={};_0x1bb008[_0x5147ce]={'$like':'%'+_0x2a7414[_0x2172('0x2d')][_0x2172('0x46')]+'%'};return _0x1bb008;})});}if(_0x2a7414['query'][_0x2172('0x47')]){var _0x23d10f=_0x2a7414['query'][_0x2172('0x47')][_0x2172('0x48')](',');var _0x3a936c={};_0x3a936c[_0x23d10f[0x0]]={'$gte':moment(_0x23d10f[0x1])['format'](_0x2172('0x49'))};_0x273e7f[_0x2172('0x45')]=_[_0x2172('0x35')](_0x273e7f[_0x2172('0x45')],_0x3a936c);}_0x273e7f=_['merge']({},_0x273e7f,_0x2a7414[_0x2172('0x36')]);return db['SmsMessage']['count']({'where':_0x273e7f['where']})[_0x2172('0x1c')](function(_0x5b60ce){_0x53a323['count']=_0x5b60ce;if(_0x2a7414['query']['includeAll']){_0x273e7f['include']=[{'all':!![]}];}return db[_0x2172('0x3f')]['findAll'](_0x273e7f);})[_0x2172('0x1c')](function(_0x23e146){_0x53a323[_0x2172('0x4a')]=_0x23e146;return _0x53a323;});}})['then'](respondWithFilteredResult(_0xe0b414,_0x273e7f))['catch'](handleError(_0xe0b414,null));};exports[_0x2172('0x4b')]=function(_0x535cd8,_0x4fc2c7){return db['SmsInteraction'][_0x2172('0x39')]({'where':{'id':_0x535cd8[_0x2172('0x2b')]['id']}})[_0x2172('0x1c')](handleEntityNotFound(_0x4fc2c7,null))[_0x2172('0x1c')](function(_0x21578b){if(_0x21578b){return _0x21578b['setTags'](_0x535cd8[_0x2172('0x38')][_0x2172('0x3c')],_[_0x2172('0x3d')](_0x535cd8['body'],['ids','id'])||{})[_0x2172('0x4c')](function(){return db['Tag'][_0x2172('0x27')]({'attributes':['id',_0x2172('0x1f'),'color'],'where':{'id':_0x535cd8[_0x2172('0x38')][_0x2172('0x3c')]}});})[_0x2172('0x1c')](function(_0x490a36){socket[_0x2172('0x4d')](_0x2172('0x4e'),{'id':Number(_0x535cd8[_0x2172('0x2b')]['id']),'tags':_0x490a36||[]});return{'id':Number(_0x535cd8[_0x2172('0x2b')]['id']),'tags':_0x490a36||[]};});}})[_0x2172('0x1c')](respondWithResult(_0x4fc2c7,null))[_0x2172('0x2a')](handleError(_0x4fc2c7,null));};exports['removeTags']=function(_0x22440b,_0x2d95e3){return db[_0x2172('0x22')][_0x2172('0x39')]({'where':{'id':_0x22440b[_0x2172('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2d95e3,null))[_0x2172('0x1c')](function(_0x15ea87){if(_0x15ea87){return _0x15ea87[_0x2172('0x4f')](_0x22440b[_0x2172('0x2d')][_0x2172('0x3c')]);}})[_0x2172('0x1c')](respondWithStatusCode(_0x2d95e3,null))['catch'](handleError(_0x2d95e3,null));};exports[_0x2172('0x50')]=function(_0x2cba60,_0x566598){var _0x1b098f=moment()[_0x2172('0x51')]()[_0x2172('0x52')]();var _0x383947=path[_0x2172('0x53')](config['root'],'server',_0x2172('0x54'),'tmp');var _0x49d568=path[_0x2172('0x53')](_0x383947,_0x1b098f);var _0xa2f4b9=util['format'](_0x2172('0x55'),_0x2cba60[_0x2172('0x2b')]['id'],_0x1b098f);var _0x3d49d2=path['join'](_0x383947,_0xa2f4b9);var _0x2c6d03=[];_0x2c6d03['push']({'model':db['User'],'as':_0x2172('0x56'),'attributes':['id',_0x2172('0x57')],'raw':!![]});_0x2c6d03[_0x2172('0x58')]({'model':db[_0x2172('0x59')],'as':'Contact','attributes':['id',_0x2172('0x5a'),_0x2172('0x5b')],'raw':!![]});var _0x3f1b52=[{'model':db['SmsMessage'],'as':_0x2172('0x5c'),'attributes':['id',_0x2172('0x38'),_0x2172('0x5d'),_0x2172('0x5e'),_0x2172('0x5f'),_0x2172('0x60')],'include':_0x2c6d03}];_0x3f1b52[_0x2172('0x58')]({'model':db[_0x2172('0x61')],'as':'Account','attributes':['id',_0x2172('0x1f')]});_0x3f1b52[_0x2172('0x58')]({'model':db['User'],'as':_0x2172('0x62'),'attributes':['id',_0x2172('0x57')]});return db[_0x2172('0x22')][_0x2172('0x39')]({'where':{'id':_0x2cba60[_0x2172('0x2b')]['id']},'include':_0x3f1b52})[_0x2172('0x1c')](handleEntityNotFound(_0x566598,null))[_0x2172('0x1c')](function(_0x18705d){if(_0x18705d){var _0x5e5533=_0x18705d['get']({'plain':!![]});fs[_0x2172('0x63')](_0x49d568);var _0x3a9139={'channel':_0x2172('0x64'),'account':_0x5e5533[_0x2172('0x65')][_0x2172('0x1f')],'agent':_0x5e5533['Owner']?_0x5e5533[_0x2172('0x62')][_0x2172('0x57')]:_0x2172('0x66'),'createdAt':moment(_0x5e5533[_0x2172('0x5d')])['format'](_0x2172('0x49'))[_0x2172('0x52')](),'closedAt':_0x5e5533[_0x2172('0x67')]?moment(_0x5e5533[_0x2172('0x68')])[_0x2172('0x69')](_0x2172('0x49'))[_0x2172('0x52')]():'','disposition':_0x5e5533[_0x2172('0x6a')],'messages':_(_0x5e5533[_0x2172('0x5c')])[_0x2172('0x46')]({'secret':![]})[_0x2172('0x21')](function(_0x16b476){return{'date':moment(_0x16b476['createdAt'])['format'](_0x2172('0x49'))['toString'](),'sender':_0x16b476['direction']===_0x2172('0x6b')?_0x16b476[_0x2172('0x56')]?_0x16b476['User'][_0x2172('0x57')]:_0x2172('0x6c'):_0x16b476[_0x2172('0x6d')][_0x2172('0x5a')]+(_0x16b476[_0x2172('0x6d')][_0x2172('0x5b')]?'\x20'+_0x16b476[_0x2172('0x6d')][_0x2172('0x5b')]:''),'body':_0x16b476[_0x2172('0x38')],'direction':_0x16b476[_0x2172('0x5e')]==='out'?'A':'C','secret':_0x16b476[_0x2172('0x5f')],'read':_0x16b476[_0x2172('0x60')]};})['value']()};return ejs[_0x2172('0x6e')](path[_0x2172('0x53')](config[_0x2172('0x6f')],'server',_0x2172('0x70'),_0x2172('0x71')),{'interaction':_0x3a9139})[_0x2172('0x1c')](function(_0x41159e){var _0x34062b=path['join'](_0x49d568,_0x2172('0x72')+_0x5e5533['id']+'-'+_0x1b098f+_0x2172('0x73'));var _0x19b8a0={'path':_0x34062b,'channel':_0x2172('0x64'),'interactionId':_0x5e5533['id']};return pdf['createPdfFromHTML'](_0x41159e,_0x19b8a0);})[_0x2172('0x1c')](function(){return new BPromise(function(_0x9c40a3,_0x1a6c8b){zipdir(_0x49d568,{'saveTo':_0x3d49d2},function(_0x3c2174,_0xf4b3ba){if(_0x3c2174)return _0x1a6c8b(_0x3c2174);return _0x9c40a3(_0xf4b3ba);});})[_0x2172('0x1c')](function(){return new BPromise(function(_0x1c6dc9,_0x4c8eda){rimraf(_0x49d568,function(_0x4e23a5){if(_0x4e23a5)_0x4c8eda(_0x4e23a5);return _0x1c6dc9();});});})[_0x2172('0x1c')](function(){return _0x566598[_0x2172('0x50')](_0x3d49d2,_0xa2f4b9,function(_0x45ea0f){if(_0x45ea0f){console[_0x2172('0x74')](_0x2172('0x75'),_0x45ea0f);}else{fs[_0x2172('0x76')](_0x3d49d2);}});});});}else{return _0x566598[_0x2172('0x1e')](0xc8);}})[_0x2172('0x2a')](handleError(_0x566598,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index d17cada..9339c22 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 _0xb78e=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook'];(function(_0xe25e9d,_0x5f124d){var _0x3e1a2f=function(_0x2fa2f0){while(--_0x2fa2f0){_0xe25e9d['push'](_0xe25e9d['shift']());}};_0x3e1a2f(++_0x5f124d);}(_0xb78e,0x1c9));var _0xeb78=function(_0x45f528,_0x239200){_0x45f528=_0x45f528-0x0;var _0x1393b3=_0xb78e[_0x45f528];return _0x1393b3;};'use strict';var EventEmitter=require(_0xeb78('0x0'));var SmsInteraction=require(_0xeb78('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xeb78('0x1'))['db'][_0xeb78('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xeb78('0x3')](0x0);var events={'afterCreate':_0xeb78('0x4'),'afterUpdate':_0xeb78('0x5'),'afterDestroy':_0xeb78('0x6')};function emitEvent(_0x13ef9d){return function(_0x1bdf83,_0x57ec6b,_0x3c35e7){_0x1bdf83[_0xeb78('0x7')]({'attributes':['id'],'raw':!![]})[_0xeb78('0x8')](function(_0x30c884){_0x1bdf83[_0xeb78('0x9')](_0xeb78('0xa'),_0x30c884[_0xeb78('0xb')](function(_0x573406){return{'id':_0x573406['id']};}));return SmsMessage[_0xeb78('0xc')]({'where':{'SmsInteractionId':_0x1bdf83['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb78('0x8')](function(_0xa1ca82){_0x1bdf83[_0xeb78('0x9')](_0xeb78('0xd'),_0xa1ca82[_0xeb78('0xe')]);SmsInteractionEvents[_0xeb78('0xf')](_0x13ef9d+':'+_0x1bdf83['id'],_0x1bdf83);SmsInteractionEvents[_0xeb78('0xf')](_0x13ef9d,_0x1bdf83);_0x3c35e7(null);})[_0xeb78('0x10')](_0x3c35e7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xeb78('0x11')](e,emitEvent(event));}}module[_0xeb78('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x4137=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0x231c93,_0x181ba9){var _0xa0ff24=function(_0x2bf640){while(--_0x2bf640){_0x231c93['push'](_0x231c93['shift']());}};_0xa0ff24(++_0x181ba9);}(_0x4137,0xf8));var _0x7413=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4137[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x7413('0x0'));var SmsInteraction=require(_0x7413('0x1'))['db'][_0x7413('0x2')];var SmsMessage=require(_0x7413('0x1'))['db'][_0x7413('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7413('0x4')](0x0);var events={'afterCreate':_0x7413('0x5'),'afterUpdate':_0x7413('0x6'),'afterDestroy':_0x7413('0x7')};function emitEvent(_0x3dc48a){return function(_0x451a96,_0x3bb181,_0x4fbade){_0x451a96[_0x7413('0x8')]({'attributes':['id'],'raw':!![]})[_0x7413('0x9')](function(_0x5b39ac){_0x451a96[_0x7413('0xa')]('Users',_0x5b39ac[_0x7413('0xb')](function(_0x120dc2){return{'id':_0x120dc2['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x451a96['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7413('0x9')](function(_0x2f4b54){_0x451a96['setDataValue'](_0x7413('0xc'),_0x2f4b54[_0x7413('0xd')]);SmsInteractionEvents[_0x7413('0xe')](_0x3dc48a+':'+_0x451a96['id'],_0x451a96);SmsInteractionEvents[_0x7413('0xe')](_0x3dc48a,_0x451a96);_0x4fbade(null);})[_0x7413('0xf')](_0x4fbade(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x7413('0x10')](e,emitEvent(event));}}module[_0x7413('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 17b0917..86220e3 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 _0xcf31=['moment','bluebird','rimraf','./smsInteraction.attributes','define','sms_interactions','changed','closed','format','util','../../config/logger','api'];(function(_0x18398f,_0x3dbe75){var _0x4714f1=function(_0x94963d){while(--_0x94963d){_0x18398f['push'](_0x18398f['shift']());}};_0x4714f1(++_0x3dbe75);}(_0xcf31,0x1ad));var _0x1cf3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf31[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x1cf3('0x0'));var logger=require(_0x1cf3('0x1'))(_0x1cf3('0x2'));var moment=require(_0x1cf3('0x3'));var BPromise=require(_0x1cf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1cf3('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cf3('0x6'));module['exports']=function(_0x53e70c,_0x3197c4){return _0x53e70c[_0x1cf3('0x7')]('SmsInteraction',attributes,{'tableName':_0x1cf3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc6cd74,_0x4be4b3,_0x1baf35){if(_0xc6cd74[_0x1cf3('0x9')](_0x1cf3('0xa'))){_0xc6cd74['closedAt']=moment()[_0x1cf3('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1baf35(null,_0xc6cd74);}}});}; \ No newline at end of file +var _0x4ec4=['path','rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x4ec4,0x1ae));var _0x44ec=function(_0x535617,_0x23f05c){_0x535617=_0x535617-0x0;var _0x5c7dfe=_0x4ec4[_0x535617];return _0x5c7dfe;};'use strict';var _=require(_0x44ec('0x0'));var util=require(_0x44ec('0x1'));var logger=require('../../config/logger')(_0x44ec('0x2'));var moment=require(_0x44ec('0x3'));var BPromise=require(_0x44ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44ec('0x5'));var rimraf=require(_0x44ec('0x6'));var config=require('../../config/environment');var attributes=require(_0x44ec('0x7'));module[_0x44ec('0x8')]=function(_0x4821ed,_0x34931b){return _0x4821ed['define'](_0x44ec('0x9'),attributes,{'tableName':_0x44ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8e39f4,_0x5bb323,_0x43d46f){if(_0x8e39f4[_0x44ec('0xb')](_0x44ec('0xc'))){_0x8e39f4[_0x44ec('0xd')]=moment()['format'](_0x44ec('0xe'));}_0x43d46f(null,_0x8e39f4);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ae3ed0d..a48dc18 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 _0x27b7=['AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','options','where','attributes','limit','then','find','addTags','body','ids','omit'];(function(_0x5672ee,_0x77ff50){var _0x37d1cb=function(_0x17db3f){while(--_0x17db3f){_0x5672ee['push'](_0x5672ee['shift']());}};_0x37d1cb(++_0x77ff50);}(_0x27b7,0xdf));var _0x727b=function(_0x2173d2,_0x4013cc){_0x2173d2=_0x2173d2-0x0;var _0x177637=_0x27b7[_0x2173d2];return _0x177637;};'use strict';var _=require(_0x727b('0x0'));var util=require(_0x727b('0x1'));var moment=require('moment');var BPromise=require(_0x727b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x727b('0x3'));var db=require(_0x727b('0x4'))['db'];var utils=require(_0x727b('0x5'));var logger=require(_0x727b('0x6'))('rpc');var config=require(_0x727b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x727b('0x8')]['http']({'port':0x232a});config[_0x727b('0x9')]=_['defaults'](config['redis'],{'host':_0x727b('0xa'),'port':0x18eb});var socket=require(_0x727b('0xb'))(new Redis(config[_0x727b('0x9')]));require(_0x727b('0xc'))[_0x727b('0xd')](socket);function respondWithRpcPromise(_0x329394,_0x473e79,_0x4b3c09){return new BPromise(function(_0x3d0f4c,_0x15865d){return client[_0x727b('0xe')](_0x329394,_0x4b3c09)['then'](function(_0x135bb0){logger[_0x727b('0xf')](_0x727b('0x10'),_0x473e79,'request\x20sent');logger[_0x727b('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x473e79,_0x727b('0x12'),JSON[_0x727b('0x13')](_0x135bb0));if(_0x135bb0[_0x727b('0x14')]){if(_0x135bb0[_0x727b('0x14')][_0x727b('0x15')]===0x1f4){logger[_0x727b('0x14')](_0x727b('0x10'),_0x473e79,_0x135bb0[_0x727b('0x14')][_0x727b('0x16')]);return _0x15865d(_0x135bb0[_0x727b('0x14')]['message']);}logger[_0x727b('0x14')](_0x727b('0x10'),_0x473e79,_0x135bb0[_0x727b('0x14')][_0x727b('0x16')]);return _0x3d0f4c(_0x135bb0[_0x727b('0x14')]['message']);}else{logger[_0x727b('0xf')](_0x727b('0x10'),_0x473e79,_0x727b('0x12'));_0x3d0f4c(_0x135bb0[_0x727b('0x17')][_0x727b('0x16')]);}})['catch'](function(_0x1fdc55){logger[_0x727b('0x14')](_0x727b('0x10'),_0x473e79,_0x1fdc55);_0x15865d(_0x1fdc55);});});}exports[_0x727b('0x18')]=function(_0x50ea9b){var _0x5cc345=this;return new Promise(function(_0x4a8adb,_0x13516c){return db[_0x727b('0x19')]['update'](_0x50ea9b['body'],{'raw':_0x50ea9b[_0x727b('0x1a')]?_0x50ea9b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50ea9b['options']?_0x50ea9b['options'][_0x727b('0x1b')]||null:null,'attributes':_0x50ea9b[_0x727b('0x1a')]?_0x50ea9b['options'][_0x727b('0x1c')]||null:null,'limit':_0x50ea9b[_0x727b('0x1a')]?_0x50ea9b['options'][_0x727b('0x1d')]||null:null})[_0x727b('0x1e')](function(_0x5294b5){logger[_0x727b('0xf')]('UpdateSmsInteraction',_0x50ea9b);logger[_0x727b('0x11')]('UpdateSmsInteraction',_0x50ea9b,JSON['stringify'](_0x5294b5));_0x4a8adb(_0x5294b5);})['catch'](function(_0x2085f9){logger['error'](_0x727b('0x18'),_0x2085f9[_0x727b('0x16')],_0x50ea9b);_0x13516c(_0x5cc345[_0x727b('0x14')](0x1f4,_0x2085f9[_0x727b('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x109fda){return new Promise(function(_0x13129f,_0x41d44f){return db[_0x727b('0x19')][_0x727b('0x1f')]({'where':_0x109fda[_0x727b('0x1a')]?_0x109fda[_0x727b('0x1a')][_0x727b('0x1b')]||null:null})['then'](function(_0x5a2989){if(_0x5a2989){return _0x5a2989[_0x727b('0x20')](_0x109fda[_0x727b('0x21')][_0x727b('0x22')],_[_0x727b('0x23')](_0x109fda['body'],[_0x727b('0x22'),'id'])||{});}})['spread'](function(_0x1bf3b4){logger[_0x727b('0xf')](_0x727b('0x24'),_0x109fda);logger['debug']('AddTags',_0x109fda,JSON['stringify'](_0x1bf3b4));_0x13129f(_0x1bf3b4);})['catch'](function(_0x2debcf){logger[_0x727b('0x14')](_0x727b('0x24'),_0x2debcf[_0x727b('0x16')],_0x109fda);_0x41d44f(_this[_0x727b('0x14')](0x1f4,_0x2debcf[_0x727b('0x16')]));});});}; \ No newline at end of file +var _0xad47=['SmsInteraction','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','catch','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x262428,_0x165bb0){var _0xbe888d=function(_0x1fa4c3){while(--_0x1fa4c3){_0x262428['push'](_0x262428['shift']());}};_0xbe888d(++_0x165bb0);}(_0xad47,0x158));var _0x7ad4=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xad47[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x7ad4('0x0'));var util=require(_0x7ad4('0x1'));var moment=require(_0x7ad4('0x2'));var BPromise=require(_0x7ad4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7ad4('0x4'));var logger=require(_0x7ad4('0x5'))(_0x7ad4('0x6'));var config=require(_0x7ad4('0x7'));var jayson=require(_0x7ad4('0x8'));var client=jayson[_0x7ad4('0x9')][_0x7ad4('0xa')]({'port':0x232a});config[_0x7ad4('0xb')]=_[_0x7ad4('0xc')](config['redis'],{'host':_0x7ad4('0xd'),'port':0x18eb});var socket=require(_0x7ad4('0xe'))(new Redis(config[_0x7ad4('0xb')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x353796,_0x17ac5d,_0x10b2b3){return new BPromise(function(_0x4020e7,_0x15e142){return client[_0x7ad4('0xf')](_0x353796,_0x10b2b3)[_0x7ad4('0x10')](function(_0x133fa9){logger[_0x7ad4('0x11')](_0x7ad4('0x12'),_0x17ac5d,_0x7ad4('0x13'));logger[_0x7ad4('0x14')](_0x7ad4('0x15'),_0x17ac5d,_0x7ad4('0x13'),JSON['stringify'](_0x133fa9));if(_0x133fa9[_0x7ad4('0x16')]){if(_0x133fa9[_0x7ad4('0x16')]['code']===0x1f4){logger[_0x7ad4('0x16')](_0x7ad4('0x12'),_0x17ac5d,_0x133fa9[_0x7ad4('0x16')][_0x7ad4('0x17')]);return _0x15e142(_0x133fa9[_0x7ad4('0x16')][_0x7ad4('0x17')]);}logger[_0x7ad4('0x16')](_0x7ad4('0x12'),_0x17ac5d,_0x133fa9[_0x7ad4('0x16')]['message']);return _0x4020e7(_0x133fa9[_0x7ad4('0x16')]['message']);}else{logger[_0x7ad4('0x11')](_0x7ad4('0x12'),_0x17ac5d,'request\x20sent');_0x4020e7(_0x133fa9[_0x7ad4('0x18')][_0x7ad4('0x17')]);}})['catch'](function(_0x1b4069){logger[_0x7ad4('0x16')](_0x7ad4('0x12'),_0x17ac5d,_0x1b4069);_0x15e142(_0x1b4069);});});}exports['UpdateSmsInteraction']=function(_0x1d686d){var _0x5c4936=this;return new Promise(function(_0x5ceb20,_0x2bc3a0){return db[_0x7ad4('0x19')][_0x7ad4('0x1a')](_0x1d686d[_0x7ad4('0x1b')],{'raw':_0x1d686d[_0x7ad4('0x1c')]?_0x1d686d['options'][_0x7ad4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d686d[_0x7ad4('0x1c')]?_0x1d686d['options'][_0x7ad4('0x1e')]||null:null,'attributes':_0x1d686d['options']?_0x1d686d[_0x7ad4('0x1c')][_0x7ad4('0x1f')]||null:null,'limit':_0x1d686d[_0x7ad4('0x1c')]?_0x1d686d['options'][_0x7ad4('0x20')]||null:null})[_0x7ad4('0x10')](function(_0x2193be){logger['info']('UpdateSmsInteraction',_0x1d686d);logger[_0x7ad4('0x14')](_0x7ad4('0x21'),_0x1d686d,JSON['stringify'](_0x2193be));_0x5ceb20(_0x2193be);})[_0x7ad4('0x22')](function(_0x49fe32){logger[_0x7ad4('0x16')]('UpdateSmsInteraction',_0x49fe32[_0x7ad4('0x17')],_0x1d686d);_0x2bc3a0(_0x5c4936[_0x7ad4('0x16')](0x1f4,_0x49fe32[_0x7ad4('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x174f80){return new Promise(function(_0x44f5b5,_0x2f7b54){return db['SmsInteraction']['find']({'where':_0x174f80[_0x7ad4('0x1c')]?_0x174f80[_0x7ad4('0x1c')]['where']||null:null})[_0x7ad4('0x10')](function(_0x1db347){if(_0x1db347){return _0x1db347[_0x7ad4('0x23')](_0x174f80[_0x7ad4('0x1b')][_0x7ad4('0x24')],_[_0x7ad4('0x25')](_0x174f80['body'],['ids','id'])||{});}})[_0x7ad4('0x26')](function(_0xed9f26){logger[_0x7ad4('0x11')](_0x7ad4('0x27'),_0x174f80);logger[_0x7ad4('0x14')](_0x7ad4('0x27'),_0x174f80,JSON[_0x7ad4('0x28')](_0xed9f26));_0x44f5b5(_0xed9f26);})[_0x7ad4('0x22')](function(_0x693ef){logger[_0x7ad4('0x16')](_0x7ad4('0x27'),_0x693ef[_0x7ad4('0x17')],_0x174f80);_0x2f7b54(_this[_0x7ad4('0x16')](0x1f4,_0x693ef[_0x7ad4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b5f13ee..9459f93 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 _0x3a36=['update','emit','removeListener','register','smsInteraction:','save','remove'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0x3a36,0x186));var _0x63a3=function(_0x4309b5,_0x2717c8){_0x4309b5=_0x4309b5-0x0;var _0xaddc65=_0x3a36[_0x4309b5];return _0xaddc65;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x63a3('0x0'),_0x63a3('0x1'),_0x63a3('0x2')];function createListener(_0x5730d0,_0x3c92a9){return function(_0x1a5c38){_0x3c92a9[_0x63a3('0x3')](_0x5730d0,_0x1a5c38);};}function removeListener(_0x3ed8de,_0x633fa9){return function(){SmsInteractionEvents[_0x63a3('0x4')](_0x3ed8de,_0x633fa9);};}exports[_0x63a3('0x5')]=function(_0x3070aa){for(var _0x20d303=0x0,_0x164a08=events['length'];_0x20d303<_0x164a08;_0x20d303++){var _0x26b5a4=events[_0x20d303];var _0x76566f=createListener(_0x63a3('0x6')+_0x26b5a4,_0x3070aa);SmsInteractionEvents['on'](_0x26b5a4,_0x76566f);}}; \ No newline at end of file +var _0x2614=['./smsInteraction.events','save','update','emit','length','smsInteraction:'];(function(_0x34938a,_0x5acdd4){var _0x4e0dac=function(_0x54e845){while(--_0x54e845){_0x34938a['push'](_0x34938a['shift']());}};_0x4e0dac(++_0x5acdd4);}(_0x2614,0x6c));var _0x4261=function(_0x44add5,_0x4f262c){_0x44add5=_0x44add5-0x0;var _0x3dce88=_0x2614[_0x44add5];return _0x3dce88;};'use strict';var SmsInteractionEvents=require(_0x4261('0x0'));var events=[_0x4261('0x1'),'remove',_0x4261('0x2')];function createListener(_0x23aac9,_0x209543){return function(_0x45d9d6){_0x209543[_0x4261('0x3')](_0x23aac9,_0x45d9d6);};}function removeListener(_0x57e9d7,_0x34029e){return function(){SmsInteractionEvents['removeListener'](_0x57e9d7,_0x34029e);};}exports['register']=function(_0x4b2c87){for(var _0x42da23=0x0,_0x542b76=events[_0x4261('0x4')];_0x42da23<_0x542b76;_0x42da23++){var _0x38d5c6=events[_0x42da23];var _0x2eb70b=createListener(_0x4261('0x5')+_0x38d5c6,_0x4b2c87);SmsInteractionEvents['on'](_0x38d5c6,_0x2eb70b);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index e16f7eb..5f58674 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 _0xc97e=['get','isAuthenticated','index','/:id','show','tracked','smsmessage:create','post','/:id/status','status','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller'];(function(_0x497af6,_0x474cee){var _0x24bce4=function(_0xea888e){while(--_0xea888e){_0x497af6['push'](_0x497af6['shift']());}};_0x24bce4(++_0x474cee);}(_0xc97e,0x148));var _0xec97=function(_0x1a0a63,_0x4b736e){_0x1a0a63=_0x1a0a63-0x0;var _0x4a68dc=_0xc97e[_0x1a0a63];return _0x4a68dc;};'use strict';var multer=require(_0xec97('0x0'));var util=require('util');var path=require(_0xec97('0x1'));var timeout=require(_0xec97('0x2'));var express=require(_0xec97('0x3'));var router=express['Router']();var fs_extra=require(_0xec97('0x4'));var auth=require(_0xec97('0x5'));var interaction=require(_0xec97('0x6'));var config=require('../../config/environment');var controller=require(_0xec97('0x7'));router[_0xec97('0x8')]('/',auth[_0xec97('0x9')](),controller[_0xec97('0xa')]);router[_0xec97('0x8')]('/describe',auth[_0xec97('0x9')](),controller['describe']);router[_0xec97('0x8')](_0xec97('0xb'),auth[_0xec97('0x9')](),controller[_0xec97('0xc')]);router['post']('/',auth[_0xec97('0x9')](),interaction[_0xec97('0xd')]('sms',_0xec97('0xe')),controller['create']);router[_0xec97('0xf')](_0xec97('0x10'),controller[_0xec97('0x11')]);router[_0xec97('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xec97('0x12')](_0xec97('0x13'),auth[_0xec97('0x9')](),controller['accept']);router[_0xec97('0x12')](_0xec97('0x14'),auth[_0xec97('0x9')](),controller[_0xec97('0x15')]);router['delete']('/:id',auth[_0xec97('0x9')](),controller[_0xec97('0x16')]);module[_0xec97('0x17')]=router; \ No newline at end of file +var _0xac1a=['get','isAuthenticated','index','/describe','describe','show','post','sms','smsmessage:create','create','status','put','update','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x15cd6f,_0x5b5da4){var _0x5946ad=function(_0x350eb2){while(--_0x350eb2){_0x15cd6f['push'](_0x15cd6f['shift']());}};_0x5946ad(++_0x5b5da4);}(_0xac1a,0x156));var _0xaac1=function(_0x17844e,_0x522c64){_0x17844e=_0x17844e-0x0;var _0x1c7267=_0xac1a[_0x17844e];return _0x1c7267;};'use strict';var multer=require(_0xaac1('0x0'));var util=require(_0xaac1('0x1'));var path=require(_0xaac1('0x2'));var timeout=require(_0xaac1('0x3'));var express=require(_0xaac1('0x4'));var router=express[_0xaac1('0x5')]();var fs_extra=require(_0xaac1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaac1('0x7'));var config=require(_0xaac1('0x8'));var controller=require('./smsMessage.controller');router[_0xaac1('0x9')]('/',auth[_0xaac1('0xa')](),controller[_0xaac1('0xb')]);router[_0xaac1('0x9')](_0xaac1('0xc'),auth['isAuthenticated'](),controller[_0xaac1('0xd')]);router[_0xaac1('0x9')]('/:id',auth[_0xaac1('0xa')](),controller[_0xaac1('0xe')]);router[_0xaac1('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xaac1('0x10'),_0xaac1('0x11')),controller[_0xaac1('0x12')]);router[_0xaac1('0xf')]('/:id/status',controller[_0xaac1('0x13')]);router[_0xaac1('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xaac1('0x15')]);router['put']('/:id/accept',auth[_0xaac1('0xa')](),controller[_0xaac1('0x16')]);router['put'](_0xaac1('0x17'),auth['isAuthenticated'](),controller[_0xaac1('0x18')]);router[_0xaac1('0x19')]('/:id',auth[_0xaac1('0xa')](),controller[_0xaac1('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 1bd6ef4..b5378d8 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 _0xb079=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x5e36f8,_0x13a981){var _0x3de0fe=function(_0x491b61){while(--_0x491b61){_0x5e36f8['push'](_0x5e36f8['shift']());}};_0x3de0fe(++_0x13a981);}(_0xb079,0x1c9));var _0x9b07=function(_0xaeca75,_0x487ce5){_0xaeca75=_0xaeca75-0x0;var _0x50e0b0=_0xb079[_0xaeca75];return _0x50e0b0;};'use strict';var Sequelize=require('sequelize');module[_0x9b07('0x0')]={'body':{'type':Sequelize[_0x9b07('0x1')](_0x9b07('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9b07('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9b07('0x4')]('in',_0x9b07('0x5')),'defaultValue':_0x9b07('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9b07('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9b07('0x6')]},'readAt':{'type':Sequelize[_0x9b07('0x7')]},'secret':{'type':Sequelize[_0x9b07('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9b07('0x1')]}}; \ No newline at end of file +var _0xacd4=['sequelize','exports','TEXT','medium','out','STRING','DATE'];(function(_0xb1bc,_0x1d3718){var _0x47ced2=function(_0x34264f){while(--_0x34264f){_0xb1bc['push'](_0xb1bc['shift']());}};_0x47ced2(++_0x1d3718);}(_0xacd4,0x196));var _0x4acd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xacd4[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x4acd('0x0'));module[_0x4acd('0x1')]={'body':{'type':Sequelize[_0x4acd('0x2')](_0x4acd('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4acd('0x4')),'defaultValue':_0x4acd('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4acd('0x5')](0xbe)},'phone':{'type':Sequelize[_0x4acd('0x5')]},'readAt':{'type':Sequelize[_0x4acd('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4acd('0x5')]},'providerResponse':{'type':Sequelize[_0x4acd('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e14da83..ee3002b 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 _0xfb93=['../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','destroy','then','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','show','create','body','find','params','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','reject','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','sent','delivered','Status','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x5c86a9,_0x245d13){var _0x18c48f=function(_0x140e5e){while(--_0x140e5e){_0x5c86a9['push'](_0x5c86a9['shift']());}};_0x18c48f(++_0x245d13);}(_0xfb93,0x111));var _0x3fb9=function(_0x52e978,_0x49de10){_0x52e978=_0x52e978-0x0;var _0x4f6afc=_0xfb93[_0x52e978];return _0x4f6afc;};'use strict';var emlformat=require(_0x3fb9('0x0'));var rimraf=require(_0x3fb9('0x1'));var zipdir=require(_0x3fb9('0x2'));var jsonpatch=require(_0x3fb9('0x3'));var rp=require('request-promise');var moment=require(_0x3fb9('0x4'));var BPromise=require(_0x3fb9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3fb9('0x6'));var csv=require(_0x3fb9('0x7'));var ejs=require(_0x3fb9('0x8'));var fs=require('fs');var fs_extra=require(_0x3fb9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3fb9('0xa'));var jsforce=require(_0x3fb9('0xb'));var deskjs=require(_0x3fb9('0xc'));var toCsv=require(_0x3fb9('0x7'));var querystring=require(_0x3fb9('0xd'));var Papa=require(_0x3fb9('0xe'));var Redis=require(_0x3fb9('0xf'));var authService=require(_0x3fb9('0x10'));var qs=require(_0x3fb9('0x11'));var as=require(_0x3fb9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fb9('0x13'))(_0x3fb9('0x14'));var utils=require('../../config/utils');var config=require(_0x3fb9('0x15'));var licenseUtil=require(_0x3fb9('0x16'));var db=require(_0x3fb9('0x17'))['db'];config[_0x3fb9('0x18')]=_['defaults'](config[_0x3fb9('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3fb9('0x19'))(new Redis(config['redis']));require(_0x3fb9('0x1a'))[_0x3fb9('0x1b')](socket);var jayson=require(_0x3fb9('0x1c'));var client=jayson[_0x3fb9('0x1d')][_0x3fb9('0x1e')]({'port':0x232c});var client9002=jayson[_0x3fb9('0x1d')][_0x3fb9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4f0add,_0x42afd2,_0x1f7be7,_0x48dd1d){return new BPromise(function(_0x1720fc,_0xd0528f){var _0x1726e9=_0x48dd1d||client;return _0x1726e9[_0x3fb9('0x1f')](_0x4f0add,_0x1f7be7)['then'](function(_0x3c7e15){logger[_0x3fb9('0x20')](_0x3fb9('0x21'),_0x42afd2,'request\x20sent');logger['debug'](_0x3fb9('0x22'),_0x42afd2,_0x3fb9('0x23'),JSON['stringify'](_0x3c7e15));if(_0x3c7e15[_0x3fb9('0x24')]){if(_0x3c7e15[_0x3fb9('0x24')][_0x3fb9('0x25')]===0x1f4){logger[_0x3fb9('0x24')](_0x3fb9('0x21'),_0x42afd2,_0x3c7e15[_0x3fb9('0x24')][_0x3fb9('0x26')]);return _0xd0528f(_0x3c7e15[_0x3fb9('0x24')][_0x3fb9('0x26')]);}logger[_0x3fb9('0x24')](_0x3fb9('0x21'),_0x42afd2,_0x3c7e15[_0x3fb9('0x24')][_0x3fb9('0x26')]);return _0x1720fc(_0x3c7e15[_0x3fb9('0x24')][_0x3fb9('0x26')]);}else{logger[_0x3fb9('0x20')](_0x3fb9('0x21'),_0x42afd2,_0x3fb9('0x23'));_0x1720fc(_0x3c7e15[_0x3fb9('0x27')]['message']);}})[_0x3fb9('0x28')](function(_0x17d284){logger[_0x3fb9('0x24')]('SmsMessage,\x20%s,\x20%s',_0x42afd2,_0x17d284);_0xd0528f(_0x17d284);});});}function respondWithStatusCode(_0x3158fd,_0x11c47b){_0x11c47b=_0x11c47b||0xcc;return function(_0x27fe8c){if(_0x27fe8c){return _0x3158fd[_0x3fb9('0x29')](_0x11c47b);}return _0x3158fd[_0x3fb9('0x2a')](_0x11c47b)[_0x3fb9('0x2b')]();};}function respondWithResult(_0x303094,_0x3a9fe9){_0x3a9fe9=_0x3a9fe9||0xc8;return function(_0x978155){if(_0x978155){return _0x303094[_0x3fb9('0x2a')](_0x3a9fe9)[_0x3fb9('0x2c')](_0x978155);}};}function respondWithFilteredResult(_0x1c2ea5,_0x4d8118){return function(_0x1ed4f5){if(_0x1ed4f5){var _0x3835f2=typeof _0x4d8118[_0x3fb9('0x2d')]==='undefined'&&typeof _0x4d8118[_0x3fb9('0x2e')]===_0x3fb9('0x2f');var _0x92ba51=_0x1ed4f5[_0x3fb9('0x30')];var _0x17fe99=_0x3835f2?0x0:_0x4d8118[_0x3fb9('0x2d')];var _0x3f6aaa=_0x3835f2?_0x1ed4f5[_0x3fb9('0x30')]:_0x4d8118[_0x3fb9('0x2d')]+_0x4d8118['limit'];var _0x816a6a;if(_0x3f6aaa>=_0x92ba51){_0x3f6aaa=_0x92ba51;_0x816a6a=0xc8;}else{_0x816a6a=0xce;}_0x1c2ea5['status'](_0x816a6a);return _0x1c2ea5['set'](_0x3fb9('0x31'),_0x17fe99+'-'+_0x3f6aaa+'/'+_0x92ba51)[_0x3fb9('0x2c')](_0x1ed4f5);}return null;};}function patchUpdates(_0x292f6f){return function(_0x459d0c){try{jsonpatch['apply'](_0x459d0c,_0x292f6f,!![]);}catch(_0x20be7a){return BPromise['reject'](_0x20be7a);}return _0x459d0c['save']();};}function saveUpdates(_0x11746b,_0xdf277){return function(_0x38fd30){if(_0x38fd30){return _0x38fd30[_0x3fb9('0x32')](_0x11746b)['then'](function(_0x51fb15){return _0x51fb15;});}return null;};}function removeEntity(_0x339f84,_0xb05499){return function(_0x1367c1){if(_0x1367c1){return _0x1367c1[_0x3fb9('0x33')]()[_0x3fb9('0x34')](function(){_0x339f84[_0x3fb9('0x2a')](0xcc)[_0x3fb9('0x2b')]();});}};}function handleEntityNotFound(_0x18b91c,_0x68f72b){return function(_0x5d2b21){if(!_0x5d2b21){_0x18b91c[_0x3fb9('0x29')](0x194);}return _0x5d2b21;};}function handleError(_0x30cbfa,_0x1c1bd7){_0x1c1bd7=_0x1c1bd7||0x1f4;return function(_0x13e6bc){logger[_0x3fb9('0x24')](_0x13e6bc['stack']);if(_0x13e6bc[_0x3fb9('0x35')]){delete _0x13e6bc[_0x3fb9('0x35')];}_0x30cbfa[_0x3fb9('0x2a')](_0x1c1bd7)[_0x3fb9('0x36')](_0x13e6bc);};}exports['index']=function(_0x29b312,_0x6db531){var _0x35da61={},_0x382b4b={},_0x14781c={'count':0x0,'rows':[]};var _0x4ccdff=_[_0x3fb9('0x37')](db['SmsMessage'][_0x3fb9('0x38')],function(_0x31e068){return{'name':_0x31e068[_0x3fb9('0x39')],'type':_0x31e068[_0x3fb9('0x3a')][_0x3fb9('0x3b')]};});_0x382b4b[_0x3fb9('0x3c')]=_[_0x3fb9('0x37')](_0x4ccdff,_0x3fb9('0x35'));_0x382b4b[_0x3fb9('0x3d')]=_[_0x3fb9('0x3e')](_0x29b312[_0x3fb9('0x3d')]);_0x382b4b[_0x3fb9('0x3f')]=_[_0x3fb9('0x40')](_0x382b4b[_0x3fb9('0x3c')],_0x382b4b[_0x3fb9('0x3d')]);_0x35da61[_0x3fb9('0x41')]=_[_0x3fb9('0x40')](_0x382b4b[_0x3fb9('0x3c')],qs[_0x3fb9('0x42')](_0x29b312['query'][_0x3fb9('0x42')]));_0x35da61[_0x3fb9('0x41')]=_0x35da61[_0x3fb9('0x41')][_0x3fb9('0x43')]?_0x35da61[_0x3fb9('0x41')]:_0x382b4b[_0x3fb9('0x3c')];if(!_0x29b312['query'][_0x3fb9('0x44')](_0x3fb9('0x45'))){_0x35da61[_0x3fb9('0x2e')]=qs[_0x3fb9('0x2e')](_0x29b312['query'][_0x3fb9('0x2e')]);_0x35da61[_0x3fb9('0x2d')]=qs['offset'](_0x29b312[_0x3fb9('0x3d')][_0x3fb9('0x2d')]);}_0x35da61[_0x3fb9('0x46')]=qs[_0x3fb9('0x47')](_0x29b312[_0x3fb9('0x3d')][_0x3fb9('0x47')]);_0x35da61[_0x3fb9('0x48')]=qs['filters'](_['pick'](_0x29b312[_0x3fb9('0x3d')],_0x382b4b[_0x3fb9('0x3f')]),_0x4ccdff);if(_0x29b312[_0x3fb9('0x3d')][_0x3fb9('0x49')]){_0x35da61[_0x3fb9('0x48')]=_[_0x3fb9('0x4a')](_0x35da61[_0x3fb9('0x48')],{'$or':_[_0x3fb9('0x37')](_0x4ccdff,function(_0x522a23){if(_0x522a23[_0x3fb9('0x3a')]!==_0x3fb9('0x4b')){var _0x46415e={};_0x46415e[_0x522a23[_0x3fb9('0x35')]]={'$like':'%'+_0x29b312[_0x3fb9('0x3d')][_0x3fb9('0x49')]+'%'};return _0x46415e;}})});}_0x35da61=_[_0x3fb9('0x4a')]({},_0x35da61,_0x29b312[_0x3fb9('0x4c')]);var _0x470a1b={'where':_0x35da61[_0x3fb9('0x48')]};return db[_0x3fb9('0x4d')][_0x3fb9('0x30')](_0x470a1b)[_0x3fb9('0x34')](function(_0x28d10f){_0x14781c[_0x3fb9('0x30')]=_0x28d10f;if(_0x29b312[_0x3fb9('0x3d')][_0x3fb9('0x4e')]){_0x35da61[_0x3fb9('0x4f')]=[{'all':!![]}];}return db[_0x3fb9('0x4d')][_0x3fb9('0x50')](_0x35da61);})[_0x3fb9('0x34')](function(_0x3ba8d7){_0x14781c[_0x3fb9('0x51')]=_0x3ba8d7;return _0x14781c;})['then'](respondWithFilteredResult(_0x6db531,_0x35da61))['catch'](handleError(_0x6db531,null));};exports[_0x3fb9('0x52')]=function(_0x2bfe52,_0x3cec1f){var _0x7fffcc={'raw':!![],'where':{'id':_0x2bfe52['params']['id']}},_0x326674={};_0x326674['model']=_[_0x3fb9('0x3e')](db[_0x3fb9('0x4d')][_0x3fb9('0x38')]);_0x326674[_0x3fb9('0x3d')]=_[_0x3fb9('0x3e')](_0x2bfe52[_0x3fb9('0x3d')]);_0x326674[_0x3fb9('0x3f')]=_[_0x3fb9('0x40')](_0x326674[_0x3fb9('0x3c')],_0x326674[_0x3fb9('0x3d')]);_0x7fffcc['attributes']=_['intersection'](_0x326674[_0x3fb9('0x3c')],qs[_0x3fb9('0x42')](_0x2bfe52[_0x3fb9('0x3d')][_0x3fb9('0x42')]));_0x7fffcc['attributes']=_0x7fffcc['attributes'][_0x3fb9('0x43')]?_0x7fffcc[_0x3fb9('0x41')]:_0x326674['model'];if(_0x2bfe52[_0x3fb9('0x3d')][_0x3fb9('0x4e')]){_0x7fffcc[_0x3fb9('0x4f')]=[{'all':!![]}];}_0x7fffcc=_['merge']({},_0x7fffcc,_0x2bfe52['options']);return db[_0x3fb9('0x4d')]['find'](_0x7fffcc)[_0x3fb9('0x34')](handleEntityNotFound(_0x3cec1f,null))[_0x3fb9('0x34')](respondWithResult(_0x3cec1f,null))[_0x3fb9('0x28')](handleError(_0x3cec1f,null));};exports[_0x3fb9('0x53')]=function(_0x4cd2a1,_0x4828bb){return db[_0x3fb9('0x4d')][_0x3fb9('0x53')](_0x4cd2a1[_0x3fb9('0x54')],{})[_0x3fb9('0x34')](respondWithResult(_0x4828bb,0xc9))[_0x3fb9('0x28')](handleError(_0x4828bb,null));};exports[_0x3fb9('0x32')]=function(_0x52b873,_0x489557){if(_0x52b873[_0x3fb9('0x54')]['id']){delete _0x52b873['body']['id'];}return db[_0x3fb9('0x4d')][_0x3fb9('0x55')]({'where':{'id':_0x52b873[_0x3fb9('0x56')]['id']}})[_0x3fb9('0x34')](handleEntityNotFound(_0x489557,null))[_0x3fb9('0x34')](saveUpdates(_0x52b873[_0x3fb9('0x54')],null))[_0x3fb9('0x34')](respondWithResult(_0x489557,null))[_0x3fb9('0x28')](handleError(_0x489557,null));};exports[_0x3fb9('0x33')]=function(_0x4c5c16,_0x4aae19){return db[_0x3fb9('0x4d')]['find']({'where':{'id':_0x4c5c16[_0x3fb9('0x56')]['id']}})['then'](handleEntityNotFound(_0x4aae19,null))[_0x3fb9('0x34')](removeEntity(_0x4aae19,null))[_0x3fb9('0x28')](handleError(_0x4aae19,null));};exports[_0x3fb9('0x57')]=function(_0x1f62cd,_0x52e53e){return db[_0x3fb9('0x4d')][_0x3fb9('0x57')]()[_0x3fb9('0x34')](respondWithResult(_0x52e53e,null))[_0x3fb9('0x28')](handleError(_0x52e53e,null));};var interaction_log=require('../../config/logger')(_0x3fb9('0x58'));exports[_0x3fb9('0x59')]=function(_0x1d57c4,_0x4d1ac6,_0x5137f8){var _0x61bca8={'agent':{},'channel':_0x3fb9('0x5a')};if(_0x1d57c4[_0x3fb9('0x54')]['id']){delete _0x1d57c4[_0x3fb9('0x54')]['id'];}_0x1d57c4[_0x3fb9('0x54')][_0x3fb9('0x5b')]=!![];_0x1d57c4[_0x3fb9('0x54')][_0x3fb9('0x5c')]=moment()[_0x3fb9('0x5d')](_0x3fb9('0x5e'));_0x1d57c4['body'][_0x3fb9('0x5f')]=_0x1d57c4[_0x3fb9('0x54')][_0x3fb9('0x5f')]||_0x1d57c4[_0x3fb9('0x60')]['id'];_0x61bca8[_0x3fb9('0x61')]['id']=_0x1d57c4[_0x3fb9('0x54')][_0x3fb9('0x5f')];return db[_0x3fb9('0x4d')][_0x3fb9('0x55')]({'where':{'id':_0x1d57c4[_0x3fb9('0x56')]['id'],'UserId':null}})[_0x3fb9('0x34')](handleEntityNotFound(_0x4d1ac6,null))[_0x3fb9('0x34')](saveUpdates(_0x1d57c4['body'],null))['then'](function(_0x2d559e){if(_0x2d559e){_0x61bca8[_0x3fb9('0x26')]=_0x2d559e[_0x3fb9('0x62')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x2d559e['SmsInteractionId']}});}return null;})[_0x3fb9('0x34')](handleEntityNotFound(_0x4d1ac6,null))[_0x3fb9('0x34')](function(_0x4331eb){if(_0x4331eb){return _0x4331eb['update']({'UserId':_0x1d57c4[_0x3fb9('0x54')][_0x3fb9('0x5f')],'read1stAt':_['isNil'](_0x4331eb[_0x3fb9('0x63')])?moment()[_0x3fb9('0x5d')](_0x3fb9('0x5e')):undefined});}return null;})['then'](function(_0x4ccd1f){if(_0x4ccd1f){_0x61bca8['interaction']=_0x4ccd1f[_0x3fb9('0x62')]({'plain':!![]});interaction_log[_0x3fb9('0x20')](_0x3fb9('0x64'),_0x1d57c4[_0x3fb9('0x60')]['id'],_0x1d57c4[_0x3fb9('0x60')][_0x3fb9('0x35')],_0x1d57c4[_0x3fb9('0x60')]['role'],_0x61bca8[_0x3fb9('0x65')]['id'],_0x1d57c4['body']?JSON[_0x3fb9('0x66')](_0x1d57c4[_0x3fb9('0x54')]):_0x3fb9('0x67'));return respondWithRpcPromise(_0x3fb9('0x68'),_0x3fb9('0x69'),_0x61bca8);}return null;})[_0x3fb9('0x34')](function(_0x4dbd1e){var _0x1027c6=_0x3fb9('0x6a')+_0x4dbd1e[_0x3fb9('0x26')][_0x3fb9('0x6b')];return db['sequelize'][_0x3fb9('0x3d')](_0x1027c6,{'type':db[_0x3fb9('0x6c')][_0x3fb9('0x6d')][_0x3fb9('0x6e')],'raw':!![]})[_0x3fb9('0x34')](function(_0x24bac7){return _0x24bac7;});})[_0x3fb9('0x34')](function(_0x342ec8){if(_0x342ec8){_0x61bca8[_0x3fb9('0x26')][_0x3fb9('0x6f')]=_0x342ec8[0x0];if(!_0x1d57c4[_0x3fb9('0x54')]['UserId'])return;return db[_0x3fb9('0x70')][_0x3fb9('0x55')]({'where':{'id':_0x1d57c4[_0x3fb9('0x54')]['UserId'],'role':_0x3fb9('0x61')},'attributes':['id',_0x3fb9('0x35'),_0x3fb9('0x71'),_0x3fb9('0x72'),_0x3fb9('0x73')],'raw':!![]});}return null;})[_0x3fb9('0x34')](function(_0xe2c1ae){if(!_0xe2c1ae)return null;_0x61bca8[_0x3fb9('0x26')][_0x3fb9('0x61')]=_0xe2c1ae;return _0x61bca8;})[_0x3fb9('0x34')](function(_0x38d107){if(_0x38d107){if(_0x1d57c4[_0x3fb9('0x54')][_0x3fb9('0x74')]){_0x61bca8['message'][_0x3fb9('0x75')]=util[_0x3fb9('0x5d')](_0x3fb9('0x76'),_0x1d57c4['user'][_0x3fb9('0x35')]);_0x61bca8[_0x3fb9('0x26')]['channel']=_0x61bca8[_0x3fb9('0x77')];_0x61bca8[_0x3fb9('0x26')][_0x3fb9('0x78')]=_0x61bca8[_0x3fb9('0x77')];_0x61bca8['message'][_0x3fb9('0x79')]=_0x3fb9('0x59');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x61bca8[_0x3fb9('0x26')]},client9002)['then'](function(){return _0x61bca8;});}return _0x61bca8;}return null;})[_0x3fb9('0x34')](respondWithResult(_0x4d1ac6,null))[_0x3fb9('0x28')](handleError(_0x4d1ac6,null));};var interaction_log=require('../../config/logger')(_0x3fb9('0x58'));exports[_0x3fb9('0x7a')]=function(_0x4fb62f,_0x527dec,_0x169743){var _0x3e1303={'agent':{},'channel':'sms'};if(_0x4fb62f[_0x3fb9('0x54')]['id']){delete _0x4fb62f[_0x3fb9('0x54')]['id'];}_0x4fb62f['body'][_0x3fb9('0x5f')]=_0x4fb62f[_0x3fb9('0x54')][_0x3fb9('0x5f')]||_0x4fb62f['user']['id'];_0x3e1303['agent']['id']=_0x4fb62f['body'][_0x3fb9('0x5f')];return db['SmsMessage'][_0x3fb9('0x55')]({'where':{'id':_0x4fb62f['params']['id'],'UserId':null}})[_0x3fb9('0x34')](handleEntityNotFound(_0x527dec,null))[_0x3fb9('0x34')](function(_0x29f659){if(_0x29f659){_0x3e1303[_0x3fb9('0x26')]=_0x29f659[_0x3fb9('0x62')]({'plain':!![]});return db[_0x3fb9('0x7b')][_0x3fb9('0x55')]({'where':{'id':_0x29f659['SmsInteractionId']}});}return null;})[_0x3fb9('0x34')](handleEntityNotFound(_0x527dec,null))[_0x3fb9('0x34')](function(_0x9ac6a9){if(_0x9ac6a9){_0x3e1303[_0x3fb9('0x65')]=_0x9ac6a9[_0x3fb9('0x62')]({'plain':!![]});interaction_log['info'](_0x3fb9('0x7c'),_0x4fb62f[_0x3fb9('0x60')]['id'],_0x4fb62f['user']['name'],_0x4fb62f[_0x3fb9('0x60')][_0x3fb9('0x7d')],_0x3e1303[_0x3fb9('0x65')]['id'],_0x4fb62f[_0x3fb9('0x54')]?JSON['stringify'](_0x4fb62f[_0x3fb9('0x54')]):'null');return respondWithRpcPromise(_0x3fb9('0x7e'),_0x3fb9('0x7f'),_0x3e1303);}return null;})[_0x3fb9('0x34')](function(_0x4d0050){var _0x309c0d=_0x3fb9('0x6a')+_0x4d0050[_0x3fb9('0x26')][_0x3fb9('0x6b')];return db[_0x3fb9('0x80')]['query'](_0x309c0d,{'type':db[_0x3fb9('0x6c')][_0x3fb9('0x6d')][_0x3fb9('0x6e')],'raw':!![]})['then'](function(_0x2c48f6){return _0x2c48f6;});})[_0x3fb9('0x34')](function(_0x241bea){if(_0x241bea){_0x3e1303[_0x3fb9('0x26')][_0x3fb9('0x6f')]=_0x241bea[0x0];if(!_0x4fb62f[_0x3fb9('0x54')]['UserId'])return;return db['User']['find']({'where':{'id':_0x4fb62f[_0x3fb9('0x54')][_0x3fb9('0x5f')],'role':_0x3fb9('0x61')},'attributes':['id',_0x3fb9('0x35'),'fullname',_0x3fb9('0x72'),_0x3fb9('0x73')],'raw':!![]});}return null;})[_0x3fb9('0x34')](function(_0x16fe7f){if(!_0x16fe7f)return null;_0x3e1303[_0x3fb9('0x26')][_0x3fb9('0x61')]=_0x16fe7f;return _0x3e1303;})[_0x3fb9('0x34')](function(_0x52921d){if(_0x52921d){_0x52921d['message']['interface']=util[_0x3fb9('0x5d')](_0x3fb9('0x76'),_0x4fb62f[_0x3fb9('0x60')]['name']);_0x52921d['message'][_0x3fb9('0x77')]=_0x3e1303[_0x3fb9('0x77')];_0x52921d[_0x3fb9('0x26')]['motionChannel']=_0x3e1303[_0x3fb9('0x77')];_0x52921d[_0x3fb9('0x26')]['event']=_0x3fb9('0x7a');respondWithRpcPromise('EventManager',_0x3fb9('0x81'),{'event':_0x3fb9('0x82'),'message':_0x52921d['message']},client9002);return _0x3e1303;}return null;})[_0x3fb9('0x34')](respondWithResult(_0x527dec,null))[_0x3fb9('0x28')](handleError(_0x527dec,null));};exports[_0x3fb9('0x2a')]=function(_0x569dc7,_0x3d0d6a,_0xb7b4f5){if(_0x569dc7[_0x3fb9('0x54')]['id']){delete _0x569dc7['body']['id'];}var _0x4f1ee0;return db[_0x3fb9('0x4d')]['find']({'where':{'id':_0x569dc7[_0x3fb9('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d0d6a,null))[_0x3fb9('0x34')](function(_0x1de9ce){if(_0x1de9ce){_0x4f1ee0=_0x1de9ce;return db[_0x3fb9('0x83')][_0x3fb9('0x55')]({'where':{'id':_0x1de9ce[_0x3fb9('0x84')]}});}})[_0x3fb9('0x34')](handleEntityNotFound(_0x3d0d6a,null))[_0x3fb9('0x34')](function(_0x246e1c){if(_0x246e1c){logger[_0x3fb9('0x85')](_0x3fb9('0x22'),_0x3fb9('0x2a'),_0x3fb9('0x86'),_0x246e1c['type'],util['inspect'](_0x569dc7[_0x3fb9('0x54')],{'showHidden':![],'depth':null}));switch(_0x246e1c['type']){case _0x3fb9('0x87'):if(_0x569dc7[_0x3fb9('0x54')][_0x3fb9('0x88')]&&_0x569dc7[_0x3fb9('0x54')][_0x3fb9('0x88')]===_0x4f1ee0[_0x3fb9('0x89')]){return _0x4f1ee0['update']({'read':!![]});}else{logger[_0x3fb9('0x24')](_0x3fb9('0x8a'),'status','twilio',util[_0x3fb9('0x8b')](_0x569dc7[_0x3fb9('0x54')],{'showHidden':![],'depth':null}));}break;case _0x3fb9('0x8c'):if(_0x569dc7[_0x3fb9('0x54')]['MessageUUID']&&_0x569dc7[_0x3fb9('0x54')]['MessageUUID']===_0x4f1ee0[_0x3fb9('0x89')]&&_['indexOf']([_0x3fb9('0x8d'),_0x3fb9('0x8e')],_0x569dc7['body'][_0x3fb9('0x8f')])>=0x0){return _0x4f1ee0[_0x3fb9('0x32')]({'read':!![]});}else{logger[_0x3fb9('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3fb9('0x2a'),_0x3fb9('0x90'),util[_0x3fb9('0x8b')](_0x569dc7[_0x3fb9('0x54')],{'showHidden':![],'depth':null}));}break;case _0x3fb9('0x91'):var _0x3ef5d2=_0x569dc7['body'][_0x3fb9('0x92')][0x0];if(_0x3ef5d2[_0x3fb9('0x2a')][_0x3fb9('0x93')]==='DELIVERED'){return _0x4f1ee0[_0x3fb9('0x32')]({'read':!![]});}else{logger[_0x3fb9('0x24')](_0x3fb9('0x8a'),_0x3fb9('0x2a'),'infobip',util['inspect'](_0x569dc7[_0x3fb9('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x4f1ee0;}})[_0x3fb9('0x34')](respondWithResult(_0x3d0d6a,null))[_0x3fb9('0x28')](handleError(_0x3d0d6a,null));}; \ No newline at end of file +var _0x81b7=['intersection','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','SmsMessage','includeAll','include','rows','catch','params','length','find','create','body','describe','../../config/logger','sms-interactions','accept','read','readAt','format','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','user','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','contact','email','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','plivio','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','sendStatus','name','index','map','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81b7,0x1f2));var _0x781b=function(_0x2801e0,_0x4556cb){_0x2801e0=_0x2801e0-0x0;var _0x3cd783=_0x81b7[_0x2801e0];return _0x3cd783;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x781b('0x0'));var zipdir=require(_0x781b('0x1'));var jsonpatch=require(_0x781b('0x2'));var rp=require(_0x781b('0x3'));var moment=require('moment');var BPromise=require(_0x781b('0x4'));var Mustache=require('mustache');var util=require(_0x781b('0x5'));var path=require(_0x781b('0x6'));var sox=require(_0x781b('0x7'));var csv=require(_0x781b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x781b('0x9'));var _=require(_0x781b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x781b('0xb'));var deskjs=require(_0x781b('0xc'));var toCsv=require(_0x781b('0x8'));var querystring=require(_0x781b('0xd'));var Papa=require('papaparse');var Redis=require(_0x781b('0xe'));var authService=require(_0x781b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x781b('0x10'));var logger=require('../../config/logger')(_0x781b('0x11'));var utils=require('../../config/utils');var config=require(_0x781b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x781b('0x13'))['db'];config['redis']=_[_0x781b('0x14')](config[_0x781b('0x15')],{'host':_0x781b('0x16'),'port':0x18eb});var socket=require(_0x781b('0x17'))(new Redis(config[_0x781b('0x15')]));require('./smsMessage.socket')[_0x781b('0x18')](socket);var jayson=require(_0x781b('0x19'));var client=jayson[_0x781b('0x1a')][_0x781b('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x781b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x533377,_0x176e91,_0x40a6ea,_0x1d0282){return new BPromise(function(_0x4ac48a,_0x22cff6){var _0x554ff5=_0x1d0282||client;return _0x554ff5['request'](_0x533377,_0x40a6ea)[_0x781b('0x1c')](function(_0x177e18){logger[_0x781b('0x1d')](_0x781b('0x1e'),_0x176e91,_0x781b('0x1f'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x176e91,'request\x20sent',JSON[_0x781b('0x20')](_0x177e18));if(_0x177e18[_0x781b('0x21')]){if(_0x177e18[_0x781b('0x21')][_0x781b('0x22')]===0x1f4){logger[_0x781b('0x21')](_0x781b('0x1e'),_0x176e91,_0x177e18['error'][_0x781b('0x23')]);return _0x22cff6(_0x177e18[_0x781b('0x21')][_0x781b('0x23')]);}logger['error'](_0x781b('0x1e'),_0x176e91,_0x177e18[_0x781b('0x21')][_0x781b('0x23')]);return _0x4ac48a(_0x177e18[_0x781b('0x21')]['message']);}else{logger[_0x781b('0x1d')](_0x781b('0x1e'),_0x176e91,_0x781b('0x1f'));_0x4ac48a(_0x177e18[_0x781b('0x24')][_0x781b('0x23')]);}})['catch'](function(_0x226d68){logger[_0x781b('0x21')](_0x781b('0x1e'),_0x176e91,_0x226d68);_0x22cff6(_0x226d68);});});}function respondWithStatusCode(_0x22cdc0,_0x38ba8f){_0x38ba8f=_0x38ba8f||0xcc;return function(_0x398bfa){if(_0x398bfa){return _0x22cdc0['sendStatus'](_0x38ba8f);}return _0x22cdc0['status'](_0x38ba8f)[_0x781b('0x25')]();};}function respondWithResult(_0x2f27a9,_0x560449){_0x560449=_0x560449||0xc8;return function(_0x124339){if(_0x124339){return _0x2f27a9[_0x781b('0x26')](_0x560449)[_0x781b('0x27')](_0x124339);}};}function respondWithFilteredResult(_0x33561e,_0xbde04f){return function(_0x3d3d4c){if(_0x3d3d4c){var _0x1957c4=typeof _0xbde04f[_0x781b('0x28')]===_0x781b('0x29')&&typeof _0xbde04f[_0x781b('0x2a')]===_0x781b('0x29');var _0x5c81fa=_0x3d3d4c[_0x781b('0x2b')];var _0x286a73=_0x1957c4?0x0:_0xbde04f['offset'];var _0x536be8=_0x1957c4?_0x3d3d4c[_0x781b('0x2b')]:_0xbde04f[_0x781b('0x28')]+_0xbde04f[_0x781b('0x2a')];var _0x32f325;if(_0x536be8>=_0x5c81fa){_0x536be8=_0x5c81fa;_0x32f325=0xc8;}else{_0x32f325=0xce;}_0x33561e[_0x781b('0x26')](_0x32f325);return _0x33561e[_0x781b('0x2c')](_0x781b('0x2d'),_0x286a73+'-'+_0x536be8+'/'+_0x5c81fa)[_0x781b('0x27')](_0x3d3d4c);}return null;};}function patchUpdates(_0x5a7c47){return function(_0x10ff42){try{jsonpatch['apply'](_0x10ff42,_0x5a7c47,!![]);}catch(_0x2e043b){return BPromise['reject'](_0x2e043b);}return _0x10ff42[_0x781b('0x2e')]();};}function saveUpdates(_0x468b8c,_0x4be2af){return function(_0x134761){if(_0x134761){return _0x134761[_0x781b('0x2f')](_0x468b8c)[_0x781b('0x1c')](function(_0x2cae64){return _0x2cae64;});}return null;};}function removeEntity(_0x1ff492,_0xb48785){return function(_0x5b3ba0){if(_0x5b3ba0){return _0x5b3ba0[_0x781b('0x30')]()[_0x781b('0x1c')](function(){_0x1ff492[_0x781b('0x26')](0xcc)[_0x781b('0x25')]();});}};}function handleEntityNotFound(_0x39b178,_0xea2d47){return function(_0x379d69){if(!_0x379d69){_0x39b178[_0x781b('0x31')](0x194);}return _0x379d69;};}function handleError(_0x3794c7,_0x249368){_0x249368=_0x249368||0x1f4;return function(_0x3a25a4){logger[_0x781b('0x21')](_0x3a25a4['stack']);if(_0x3a25a4[_0x781b('0x32')]){delete _0x3a25a4[_0x781b('0x32')];}_0x3794c7[_0x781b('0x26')](_0x249368)['send'](_0x3a25a4);};}exports[_0x781b('0x33')]=function(_0x521dc2,_0x58455d){var _0x137589={},_0x32bcbc={},_0x19f55f={'count':0x0,'rows':[]};var _0x4e8069=_[_0x781b('0x34')](db['SmsMessage'][_0x781b('0x35')],function(_0x130b21){return{'name':_0x130b21[_0x781b('0x36')],'type':_0x130b21[_0x781b('0x37')][_0x781b('0x38')]};});_0x32bcbc['model']=_['map'](_0x4e8069,_0x781b('0x32'));_0x32bcbc['query']=_[_0x781b('0x39')](_0x521dc2['query']);_0x32bcbc[_0x781b('0x3a')]=_['intersection'](_0x32bcbc[_0x781b('0x3b')],_0x32bcbc[_0x781b('0x3c')]);_0x137589[_0x781b('0x3d')]=_[_0x781b('0x3e')](_0x32bcbc[_0x781b('0x3b')],qs[_0x781b('0x3f')](_0x521dc2['query'][_0x781b('0x3f')]));_0x137589[_0x781b('0x3d')]=_0x137589[_0x781b('0x3d')]['length']?_0x137589[_0x781b('0x3d')]:_0x32bcbc[_0x781b('0x3b')];if(!_0x521dc2['query']['hasOwnProperty'](_0x781b('0x40'))){_0x137589['limit']=qs[_0x781b('0x2a')](_0x521dc2['query'][_0x781b('0x2a')]);_0x137589[_0x781b('0x28')]=qs[_0x781b('0x28')](_0x521dc2[_0x781b('0x3c')][_0x781b('0x28')]);}_0x137589[_0x781b('0x41')]=qs[_0x781b('0x42')](_0x521dc2['query'][_0x781b('0x42')]);_0x137589['where']=qs[_0x781b('0x3a')](_['pick'](_0x521dc2[_0x781b('0x3c')],_0x32bcbc['filters']),_0x4e8069);if(_0x521dc2[_0x781b('0x3c')][_0x781b('0x43')]){_0x137589[_0x781b('0x44')]=_[_0x781b('0x45')](_0x137589[_0x781b('0x44')],{'$or':_[_0x781b('0x34')](_0x4e8069,function(_0x1105ef){if(_0x1105ef[_0x781b('0x37')]!==_0x781b('0x46')){var _0x2ebbc9={};_0x2ebbc9[_0x1105ef[_0x781b('0x32')]]={'$like':'%'+_0x521dc2['query'][_0x781b('0x43')]+'%'};return _0x2ebbc9;}})});}_0x137589=_[_0x781b('0x45')]({},_0x137589,_0x521dc2[_0x781b('0x47')]);var _0x640362={'where':_0x137589[_0x781b('0x44')]};return db[_0x781b('0x48')]['count'](_0x640362)['then'](function(_0x5ddb43){_0x19f55f['count']=_0x5ddb43;if(_0x521dc2[_0x781b('0x3c')][_0x781b('0x49')]){_0x137589[_0x781b('0x4a')]=[{'all':!![]}];}return db[_0x781b('0x48')]['findAll'](_0x137589);})[_0x781b('0x1c')](function(_0x369939){_0x19f55f[_0x781b('0x4b')]=_0x369939;return _0x19f55f;})['then'](respondWithFilteredResult(_0x58455d,_0x137589))[_0x781b('0x4c')](handleError(_0x58455d,null));};exports['show']=function(_0x15f104,_0x459038){var _0x1eb1b3={'raw':!![],'where':{'id':_0x15f104[_0x781b('0x4d')]['id']}},_0x428dca={};_0x428dca[_0x781b('0x3b')]=_[_0x781b('0x39')](db[_0x781b('0x48')][_0x781b('0x35')]);_0x428dca[_0x781b('0x3c')]=_[_0x781b('0x39')](_0x15f104['query']);_0x428dca['filters']=_['intersection'](_0x428dca[_0x781b('0x3b')],_0x428dca['query']);_0x1eb1b3[_0x781b('0x3d')]=_[_0x781b('0x3e')](_0x428dca[_0x781b('0x3b')],qs['fields'](_0x15f104['query'][_0x781b('0x3f')]));_0x1eb1b3[_0x781b('0x3d')]=_0x1eb1b3[_0x781b('0x3d')][_0x781b('0x4e')]?_0x1eb1b3[_0x781b('0x3d')]:_0x428dca['model'];if(_0x15f104[_0x781b('0x3c')][_0x781b('0x49')]){_0x1eb1b3[_0x781b('0x4a')]=[{'all':!![]}];}_0x1eb1b3=_['merge']({},_0x1eb1b3,_0x15f104[_0x781b('0x47')]);return db[_0x781b('0x48')][_0x781b('0x4f')](_0x1eb1b3)[_0x781b('0x1c')](handleEntityNotFound(_0x459038,null))['then'](respondWithResult(_0x459038,null))['catch'](handleError(_0x459038,null));};exports[_0x781b('0x50')]=function(_0x417a40,_0x4d1824){return db[_0x781b('0x48')][_0x781b('0x50')](_0x417a40[_0x781b('0x51')],{})[_0x781b('0x1c')](respondWithResult(_0x4d1824,0xc9))[_0x781b('0x4c')](handleError(_0x4d1824,null));};exports[_0x781b('0x2f')]=function(_0x4b701e,_0x215bc4){if(_0x4b701e[_0x781b('0x51')]['id']){delete _0x4b701e[_0x781b('0x51')]['id'];}return db['SmsMessage'][_0x781b('0x4f')]({'where':{'id':_0x4b701e[_0x781b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x215bc4,null))[_0x781b('0x1c')](saveUpdates(_0x4b701e['body'],null))[_0x781b('0x1c')](respondWithResult(_0x215bc4,null))[_0x781b('0x4c')](handleError(_0x215bc4,null));};exports['destroy']=function(_0x4ab5b9,_0x42198b){return db[_0x781b('0x48')][_0x781b('0x4f')]({'where':{'id':_0x4ab5b9[_0x781b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x42198b,null))['then'](removeEntity(_0x42198b,null))['catch'](handleError(_0x42198b,null));};exports['describe']=function(_0xb822e6,_0x3e092f){return db['SmsMessage'][_0x781b('0x52')]()[_0x781b('0x1c')](respondWithResult(_0x3e092f,null))['catch'](handleError(_0x3e092f,null));};var interaction_log=require(_0x781b('0x53'))(_0x781b('0x54'));exports[_0x781b('0x55')]=function(_0x2c4ae7,_0x5d2ade,_0x18d6f7){var _0x48f4c2={'agent':{},'channel':'sms'};if(_0x2c4ae7[_0x781b('0x51')]['id']){delete _0x2c4ae7[_0x781b('0x51')]['id'];}_0x2c4ae7['body'][_0x781b('0x56')]=!![];_0x2c4ae7['body'][_0x781b('0x57')]=moment()[_0x781b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c4ae7[_0x781b('0x51')][_0x781b('0x59')]=_0x2c4ae7[_0x781b('0x51')][_0x781b('0x59')]||_0x2c4ae7['user']['id'];_0x48f4c2[_0x781b('0x5a')]['id']=_0x2c4ae7['body'][_0x781b('0x59')];return db[_0x781b('0x48')][_0x781b('0x4f')]({'where':{'id':_0x2c4ae7[_0x781b('0x4d')]['id'],'UserId':null}})[_0x781b('0x1c')](handleEntityNotFound(_0x5d2ade,null))['then'](saveUpdates(_0x2c4ae7[_0x781b('0x51')],null))[_0x781b('0x1c')](function(_0x3aa2a9){if(_0x3aa2a9){_0x48f4c2[_0x781b('0x23')]=_0x3aa2a9[_0x781b('0x5b')]({'plain':!![]});return db[_0x781b('0x5c')]['find']({'where':{'id':_0x3aa2a9[_0x781b('0x5d')]}});}return null;})[_0x781b('0x1c')](handleEntityNotFound(_0x5d2ade,null))[_0x781b('0x1c')](function(_0x165de0){if(_0x165de0){return _0x165de0[_0x781b('0x2f')]({'UserId':_0x2c4ae7[_0x781b('0x51')][_0x781b('0x59')],'read1stAt':_[_0x781b('0x5e')](_0x165de0[_0x781b('0x5f')])?moment()[_0x781b('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x781b('0x1c')](function(_0x34cd35){if(_0x34cd35){_0x48f4c2[_0x781b('0x60')]=_0x34cd35[_0x781b('0x5b')]({'plain':!![]});interaction_log[_0x781b('0x1d')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c4ae7[_0x781b('0x61')]['id'],_0x2c4ae7[_0x781b('0x61')]['name'],_0x2c4ae7['user'][_0x781b('0x62')],_0x48f4c2[_0x781b('0x60')]['id'],_0x2c4ae7[_0x781b('0x51')]?JSON['stringify'](_0x2c4ae7[_0x781b('0x51')]):'null');return respondWithRpcPromise('AcceptMessage',_0x781b('0x63'),_0x48f4c2);}return null;})[_0x781b('0x1c')](function(_0x47b85d){var _0x24444d=_0x781b('0x64')+_0x47b85d[_0x781b('0x23')]['ContactId'];return db[_0x781b('0x65')][_0x781b('0x3c')](_0x24444d,{'type':db['Sequelize'][_0x781b('0x66')][_0x781b('0x67')],'raw':!![]})[_0x781b('0x1c')](function(_0x39a7a7){return _0x39a7a7;});})[_0x781b('0x1c')](function(_0x7a7914){if(_0x7a7914){_0x48f4c2[_0x781b('0x23')]['contact']=_0x7a7914[0x0];if(!_0x2c4ae7['body'][_0x781b('0x59')])return;return db[_0x781b('0x68')]['find']({'where':{'id':_0x2c4ae7[_0x781b('0x51')][_0x781b('0x59')],'role':_0x781b('0x5a')},'attributes':['id','name',_0x781b('0x69'),'email',_0x781b('0x6a')],'raw':!![]});}return null;})[_0x781b('0x1c')](function(_0x55c80a){if(!_0x55c80a)return null;_0x48f4c2[_0x781b('0x23')][_0x781b('0x5a')]=_0x55c80a;return _0x48f4c2;})[_0x781b('0x1c')](function(_0x838e3d){if(_0x838e3d){if(_0x2c4ae7[_0x781b('0x51')]['manual']){_0x48f4c2['message'][_0x781b('0x6b')]=util[_0x781b('0x58')](_0x781b('0x6c'),_0x2c4ae7[_0x781b('0x61')][_0x781b('0x32')]);_0x48f4c2[_0x781b('0x23')][_0x781b('0x6d')]=_0x48f4c2[_0x781b('0x6d')];_0x48f4c2[_0x781b('0x23')][_0x781b('0x6e')]=_0x48f4c2[_0x781b('0x6d')];_0x48f4c2[_0x781b('0x23')][_0x781b('0x6f')]=_0x781b('0x55');return respondWithRpcPromise('EventManager',_0x781b('0x70'),{'event':'acceptmessage','message':_0x48f4c2[_0x781b('0x23')]},client9002)['then'](function(){return _0x48f4c2;});}return _0x48f4c2;}return null;})[_0x781b('0x1c')](respondWithResult(_0x5d2ade,null))[_0x781b('0x4c')](handleError(_0x5d2ade,null));};var interaction_log=require(_0x781b('0x53'))(_0x781b('0x54'));exports[_0x781b('0x71')]=function(_0x258aa5,_0x2acc44,_0x4910e4){var _0xbac058={'agent':{},'channel':_0x781b('0x72')};if(_0x258aa5[_0x781b('0x51')]['id']){delete _0x258aa5[_0x781b('0x51')]['id'];}_0x258aa5['body'][_0x781b('0x59')]=_0x258aa5[_0x781b('0x51')]['UserId']||_0x258aa5[_0x781b('0x61')]['id'];_0xbac058[_0x781b('0x5a')]['id']=_0x258aa5[_0x781b('0x51')][_0x781b('0x59')];return db[_0x781b('0x48')][_0x781b('0x4f')]({'where':{'id':_0x258aa5[_0x781b('0x4d')]['id'],'UserId':null}})[_0x781b('0x1c')](handleEntityNotFound(_0x2acc44,null))[_0x781b('0x1c')](function(_0x7734eb){if(_0x7734eb){_0xbac058[_0x781b('0x23')]=_0x7734eb[_0x781b('0x5b')]({'plain':!![]});return db[_0x781b('0x5c')][_0x781b('0x4f')]({'where':{'id':_0x7734eb[_0x781b('0x5d')]}});}return null;})[_0x781b('0x1c')](handleEntityNotFound(_0x2acc44,null))['then'](function(_0x599b5a){if(_0x599b5a){_0xbac058[_0x781b('0x60')]=_0x599b5a[_0x781b('0x5b')]({'plain':!![]});interaction_log[_0x781b('0x1d')](_0x781b('0x73'),_0x258aa5['user']['id'],_0x258aa5[_0x781b('0x61')][_0x781b('0x32')],_0x258aa5[_0x781b('0x61')][_0x781b('0x62')],_0xbac058[_0x781b('0x60')]['id'],_0x258aa5[_0x781b('0x51')]?JSON[_0x781b('0x20')](_0x258aa5[_0x781b('0x51')]):_0x781b('0x74'));return respondWithRpcPromise(_0x781b('0x75'),_0x781b('0x76'),_0xbac058);}return null;})[_0x781b('0x1c')](function(_0x12fc3c){var _0x53d555='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x12fc3c[_0x781b('0x23')]['ContactId'];return db[_0x781b('0x65')]['query'](_0x53d555,{'type':db[_0x781b('0x77')]['QueryTypes'][_0x781b('0x67')],'raw':!![]})[_0x781b('0x1c')](function(_0x3f5b2d){return _0x3f5b2d;});})[_0x781b('0x1c')](function(_0x3760c8){if(_0x3760c8){_0xbac058['message'][_0x781b('0x78')]=_0x3760c8[0x0];if(!_0x258aa5[_0x781b('0x51')][_0x781b('0x59')])return;return db['User']['find']({'where':{'id':_0x258aa5[_0x781b('0x51')][_0x781b('0x59')],'role':_0x781b('0x5a')},'attributes':['id','name',_0x781b('0x69'),_0x781b('0x79'),_0x781b('0x6a')],'raw':!![]});}return null;})['then'](function(_0x287247){if(!_0x287247)return null;_0xbac058[_0x781b('0x23')][_0x781b('0x5a')]=_0x287247;return _0xbac058;})[_0x781b('0x1c')](function(_0x998fc3){if(_0x998fc3){_0x998fc3[_0x781b('0x23')][_0x781b('0x6b')]=util[_0x781b('0x58')]('SIP/%s',_0x258aa5[_0x781b('0x61')]['name']);_0x998fc3[_0x781b('0x23')][_0x781b('0x6d')]=_0xbac058['channel'];_0x998fc3[_0x781b('0x23')][_0x781b('0x6e')]=_0xbac058[_0x781b('0x6d')];_0x998fc3[_0x781b('0x23')][_0x781b('0x6f')]='reject';respondWithRpcPromise(_0x781b('0x70'),'EventManager',{'event':_0x781b('0x7a'),'message':_0x998fc3[_0x781b('0x23')]},client9002);return _0xbac058;}return null;})[_0x781b('0x1c')](respondWithResult(_0x2acc44,null))[_0x781b('0x4c')](handleError(_0x2acc44,null));};exports['status']=function(_0x560ab9,_0x588b10,_0x527b99){if(_0x560ab9[_0x781b('0x51')]['id']){delete _0x560ab9[_0x781b('0x51')]['id'];}var _0xa2549c;return db[_0x781b('0x48')][_0x781b('0x4f')]({'where':{'id':_0x560ab9[_0x781b('0x4d')]['id']}})[_0x781b('0x1c')](handleEntityNotFound(_0x588b10,null))[_0x781b('0x1c')](function(_0x1c1922){if(_0x1c1922){_0xa2549c=_0x1c1922;return db[_0x781b('0x7b')][_0x781b('0x4f')]({'where':{'id':_0x1c1922[_0x781b('0x7c')]}});}})[_0x781b('0x1c')](handleEntityNotFound(_0x588b10,null))['then'](function(_0x1845d0){if(_0x1845d0){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x781b('0x7d'),_0x1845d0[_0x781b('0x37')],util[_0x781b('0x7e')](_0x560ab9['body'],{'showHidden':![],'depth':null}));switch(_0x1845d0[_0x781b('0x37')]){case _0x781b('0x7f'):if(_0x560ab9[_0x781b('0x51')]['MessageSid']&&_0x560ab9['body'][_0x781b('0x80')]===_0xa2549c[_0x781b('0x81')]){return _0xa2549c[_0x781b('0x2f')]({'read':!![]});}else{logger[_0x781b('0x21')](_0x781b('0x82'),_0x781b('0x26'),_0x781b('0x7f'),util[_0x781b('0x7e')](_0x560ab9[_0x781b('0x51')],{'showHidden':![],'depth':null}));}break;case _0x781b('0x83'):if(_0x560ab9[_0x781b('0x51')][_0x781b('0x84')]&&_0x560ab9[_0x781b('0x51')][_0x781b('0x84')]===_0xa2549c[_0x781b('0x81')]&&_[_0x781b('0x85')](['sent',_0x781b('0x86')],_0x560ab9[_0x781b('0x51')]['Status'])>=0x0){return _0xa2549c[_0x781b('0x2f')]({'read':!![]});}else{logger['error'](_0x781b('0x82'),_0x781b('0x26'),_0x781b('0x87'),util[_0x781b('0x7e')](_0x560ab9[_0x781b('0x51')],{'showHidden':![],'depth':null}));}break;case _0x781b('0x88'):var _0x4cb2d4=_0x560ab9[_0x781b('0x51')][_0x781b('0x89')][0x0];if(_0x4cb2d4[_0x781b('0x26')][_0x781b('0x8a')]===_0x781b('0x8b')){return _0xa2549c[_0x781b('0x2f')]({'read':!![]});}else{logger[_0x781b('0x21')](_0x781b('0x82'),_0x781b('0x26'),_0x781b('0x88'),util['inspect'](_0x560ab9[_0x781b('0x51')],{'showHidden':![],'depth':null}));}break;}return _0xa2549c;}})[_0x781b('0x1c')](respondWithResult(_0x588b10,null))['catch'](handleError(_0x588b10,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c545661..c9d5d6b 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 _0x21c6=['hook','exports','events','../../mysqldb','SmsMessage','save','update','remove','emit'];(function(_0x75618f,_0x20d707){var _0x48c1c4=function(_0x10b048){while(--_0x10b048){_0x75618f['push'](_0x75618f['shift']());}};_0x48c1c4(++_0x20d707);}(_0x21c6,0xad));var _0x621c=function(_0x47b57d,_0x4645a0){_0x47b57d=_0x47b57d-0x0;var _0x92ca2c=_0x21c6[_0x47b57d];return _0x92ca2c;};'use strict';var EventEmitter=require(_0x621c('0x0'));var SmsMessage=require(_0x621c('0x1'))['db'][_0x621c('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x621c('0x3'),'afterUpdate':_0x621c('0x4'),'afterDestroy':_0x621c('0x5')};function emitEvent(_0x57d79c){return function(_0x352b9b,_0x5dcbf6,_0x1eeb23){SmsMessageEvents[_0x621c('0x6')](_0x57d79c+':'+_0x352b9b['id'],_0x352b9b);SmsMessageEvents[_0x621c('0x6')](_0x57d79c,_0x352b9b);_0x1eeb23(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x621c('0x7')](e,emitEvent(event));}}module[_0x621c('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x514a=['events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x514a,0xcd));var _0xa514=function(_0x420d6a,_0x5f3df8){_0x420d6a=_0x420d6a-0x0;var _0x1f5f2c=_0x514a[_0x420d6a];return _0x1f5f2c;};'use strict';var EventEmitter=require(_0xa514('0x0'));var SmsMessage=require(_0xa514('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa514('0x2')](0x0);var events={'afterCreate':_0xa514('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x67aa6c){return function(_0x4c5868,_0x416709,_0x24bce6){SmsMessageEvents[_0xa514('0x4')](_0x67aa6c+':'+_0x4c5868['id'],_0x4c5868);SmsMessageEvents[_0xa514('0x4')](_0x67aa6c,_0x4c5868);_0x24bce6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c227c09..479318a 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 _0x97e7=['models','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','authToken','accountSid','messages','create','phone','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','/status?token=','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','timestamp','keys','length','apiKey','createHash','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','finally','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT'];(function(_0x5a559c,_0xb34e0b){var _0x1a4bd9=function(_0x3178e7){while(--_0x3178e7){_0x5a559c['push'](_0x5a559c['shift']());}};_0x1a4bd9(++_0xb34e0b);}(_0x97e7,0x6f));var _0x797e=function(_0x1d5874,_0x118e9a){_0x1d5874=_0x1d5874-0x0;var _0x10608f=_0x97e7[_0x1d5874];return _0x10608f;};'use strict';var _=require(_0x797e('0x0'));var util=require(_0x797e('0x1'));var logger=require(_0x797e('0x2'))(_0x797e('0x3'));var moment=require('moment');var BPromise=require(_0x797e('0x4'));var rp=require(_0x797e('0x5'));var fs=require('fs');var path=require(_0x797e('0x6'));var rimraf=require('rimraf');var config=require(_0x797e('0x7'));var attributes=require(_0x797e('0x8'));module['exports']=function(_0x27360a,_0xd2c48){return _0x27360a[_0x797e('0x9')](_0x797e('0xa'),attributes,{'tableName':_0x797e('0xb'),'paranoid':![],'indexes':[{'name':_0x797e('0xc'),'fields':[_0x797e('0xc')]},{'name':_0x797e('0xd'),'fields':[_0x797e('0xe')],'type':_0x797e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21b014,_0x47efa7,_0x43c91c){var _0xeee94=_0x27360a[_0x797e('0x10')];var _0x352166=_0x21b014['get']({'plain':!![]});if(_0x352166['direction'][_0x797e('0x11')]()==='in'||_0x352166[_0x797e('0x12')]['toLowerCase']()===_0x797e('0x13')&&!_0x352166[_0x797e('0x14')]&&!_[_0x797e('0x15')](_0x352166[_0x797e('0x16')])&&!_['isNil'](_0x352166[_0x797e('0x17')])){_0xeee94[_0x797e('0x18')]['findOne']({'where':{'id':_0x352166[_0x797e('0x17')]}})[_0x797e('0x19')](function(_0x3d15d9){if(_0x3d15d9){_0x3d15d9[_0x797e('0x1a')]({'lastMsgAt':_0x352166[_0x797e('0x1b')],'lastMsgDirection':_0x352166[_0x797e('0x12')][_0x797e('0x11')]()});}})[_0x797e('0x1c')](function(_0x519287){console[_0x797e('0x1d')](_0x519287);});}if(_0x352166[_0x797e('0x12')]===_0x797e('0x13')&&!_0x352166[_0x797e('0x14')]){var _0x367a5a;_0xeee94[_0x797e('0x1e')][_0x797e('0x1f')]({'where':{'id':_0x352166[_0x797e('0x20')]},'raw':!![]})['then'](function(_0x3b8a74){_0x367a5a=_0x3b8a74;if(_0x367a5a&&_0x367a5a[_0x797e('0x21')]){switch(_0x367a5a[_0x797e('0x21')]){case'twilio':var _0x4d1989=require('twilio');if(_0x367a5a['accountSid']&&_0x367a5a[_0x797e('0x22')]&&_0x367a5a['phone']){var _0x36576e=new _0x4d1989(_0x367a5a[_0x797e('0x23')],_0x367a5a[_0x797e('0x22')]);_0x36576e[_0x797e('0x24')][_0x797e('0x25')]({'body':_0x352166[_0x797e('0xe')],'to':_0x352166['phone'],'from':_0x367a5a[_0x797e('0x26')],'statusCallback':_0x367a5a[_0x797e('0x27')]+_0x797e('0x28')+_0x352166['id']+'/status?token='+_0x367a5a[_0x797e('0x29')]})[_0x797e('0x19')](function(_0x2f201c){if(_0x2f201c[_0x797e('0x2a')]){return _0x21b014[_0x797e('0x1a')]({'messageId':_0x2f201c[_0x797e('0x2a')]});}})[_0x797e('0x1c')](function(_0x51eb73){logger[_0x797e('0x1d')](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x2d'),util[_0x797e('0x2e')](_0x51eb73,{'showHidden':![],'depth':null}));});}else{logger[_0x797e('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x797e('0x2d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x1c2217=_0x797e('0x2f');if(_0x367a5a[_0x797e('0x30')]&&_0x367a5a[_0x797e('0x31')]){var _0x408bc5={'recipient':[_0x352166[_0x797e('0x26')]],'message':_0x352166['body'],'message_type':_0x367a5a[_0x797e('0x32')]};if(_0x367a5a[_0x797e('0x32')]&&_0x367a5a[_0x797e('0x32')]!=='SI'){_0x408bc5[_0x797e('0x33')]=_0x367a5a[_0x797e('0x26')];}var _0x48612b={'url':_0x1c2217+_0x797e('0x34')+_0x367a5a[_0x797e('0x30')]+_0x797e('0x35')+_0x367a5a[_0x797e('0x31')],'method':_0x797e('0x36')};rp(_0x48612b)[_0x797e('0x19')](function(_0x105650){var _0x3c3c6b=_0x105650[_0x797e('0x37')](';');var _0x85feb5={'user_key':_0x3c3c6b[0x0],'session_key':_0x3c3c6b[0x1]};_0x48612b={'url':_0x1c2217+_0x797e('0x38'),'method':_0x797e('0x39'),'headers':{'user_key':_0x85feb5['user_key'],'Session_key':_0x85feb5[_0x797e('0x3a')]},'json':!![],'body':_0x408bc5};return rp(_0x48612b);})[_0x797e('0x19')](function(_0x5e77e1){if(_0x5e77e1[_0x797e('0x3b')]>=0x1){var _0x1edbc4={'messageId':_0x5e77e1[_0x797e('0x3c')]};if(_0x367a5a[_0x797e('0x32')]!=='GP'||!_0x367a5a[_0x797e('0x3d')]){_0x1edbc4['read']=!![];}return _0x21b014[_0x797e('0x1a')](_0x1edbc4);}else{return logger[_0x797e('0x1d')](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x3e'),util[_0x797e('0x2e')](_0x5e77e1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x25b80e){return logger[_0x797e('0x1d')](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x3e'),util['inspect'](_0x25b80e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x3e'),_0x797e('0x3f'));}break;case _0x797e('0x40'):if(_0x367a5a[_0x797e('0x22')]){var _0x404a34={'recipient':_0x352166[_0x797e('0x26')],'message':_0x352166['body'],'sender':_0x367a5a[_0x797e('0x41')]||_0x367a5a[_0x797e('0x26')],'authorization':_0x367a5a['authToken']};var _0x47efa7={'method':_0x797e('0x39'),'uri':_0x797e('0x42'),'body':_0x404a34,'json':!![]};rp(_0x47efa7)[_0x797e('0x19')](function(_0x37705a){var _0xaf3bb1={'messageId':_0x37705a[_0x797e('0x43')]};if(!_0x367a5a[_0x797e('0x3d')]){_0xaf3bb1[_0x797e('0x44')]=!![];}return _0x21b014[_0x797e('0x1a')](_0xaf3bb1);})[_0x797e('0x1c')](function(_0x7c5894){logger['error'](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x40'),util[_0x797e('0x2e')](_0x7c5894,{'showHidden':![],'depth':null}));});}else{logger[_0x797e('0x1d')](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x40'),_0x797e('0x45'));}break;case _0x797e('0x46'):if(_0x367a5a[_0x797e('0x30')]&&_0x367a5a[_0x797e('0x31')]){var _0x404a34={'messages':[{'source':_0x797e('0x47'),'to':_0x352166[_0x797e('0x26')],'body':_0x352166[_0x797e('0xe')],'from':_0x367a5a[_0x797e('0x41')]||_0x367a5a['phone']}]};var _0x1d95c1=util[_0x797e('0x48')](_0x797e('0x49'),_0x367a5a[_0x797e('0x30')],_0x367a5a[_0x797e('0x31')]);var _0x47efa7={'method':'POST','uri':_0x797e('0x4a'),'body':_0x404a34,'headers':{'Authorization':util['format'](_0x797e('0x4b'),new Buffer(_0x1d95c1)[_0x797e('0x4c')](_0x797e('0x4d')))},'json':!![]};rp(_0x47efa7)[_0x797e('0x19')](function(_0x81e211){if(_0x81e211['http_code']>=0xc8&&_0x81e211[_0x797e('0x4e')]<=0xce){if(_0x81e211[_0x797e('0x4f')]&&_0x81e211[_0x797e('0x4f')][_0x797e('0x50')]>0x0){var _0x3e57f7=_[_0x797e('0x51')](_0x81e211[_0x797e('0x4f')][_0x797e('0x24')]);var _0x50a59c={'messageId':_0x3e57f7[_0x797e('0x52')]};if(!_0x367a5a['deliveryReport']){_0x50a59c[_0x797e('0x44')]=!![];}return _0x21b014[_0x797e('0x1a')](_0x50a59c);}else{logger[_0x797e('0x1d')](_0x797e('0x2b'),'afterCreate','clickSend',util[_0x797e('0x2e')](_0x81e211,{'showHidden':![],'depth':null}));}}else{logger[_0x797e('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x797e('0x2c'),_0x797e('0x53'),util[_0x797e('0x2e')](_0x81e211,{'showHidden':![],'depth':null}));}})[_0x797e('0x1c')](function(_0x426333){logger[_0x797e('0x1d')](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x53'),util[_0x797e('0x2e')](_0x426333,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x797e('0x2c'),_0x797e('0x53'),_0x797e('0x3f'));}break;case'plivo':if(_0x367a5a[_0x797e('0x54')]&&_0x367a5a[_0x797e('0x22')]){var _0x404a34={'dst':_0x352166[_0x797e('0x26')],'text':_0x352166['body'],'src':_0x367a5a[_0x797e('0x41')]||_0x367a5a[_0x797e('0x26')],'url':_0x367a5a[_0x797e('0x27')]+_0x797e('0x28')+_0x352166['id']+_0x797e('0x55')+_0x367a5a[_0x797e('0x29')]};var _0x1d95c1=util[_0x797e('0x48')]('%s:%s',_0x367a5a['authId'],_0x367a5a[_0x797e('0x22')]);var _0x47efa7={'method':_0x797e('0x39'),'uri':util[_0x797e('0x48')]('https://api.plivo.com/v1/Account/%s/Message/',_0x367a5a[_0x797e('0x54')]),'body':_0x404a34,'headers':{'Authorization':util[_0x797e('0x48')](_0x797e('0x4b'),new Buffer(_0x1d95c1)[_0x797e('0x4c')](_0x797e('0x4d')))},'json':!![]};rp(_0x47efa7)[_0x797e('0x19')](function(_0x1cf55a){var _0x54ea9d={'messageId':_0x1cf55a[_0x797e('0x56')][0x0]};return _0x21b014[_0x797e('0x1a')](_0x54ea9d);})[_0x797e('0x1c')](function(_0x5cffe7){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x797e('0x57'),util[_0x797e('0x2e')](_0x5cffe7,{'showHidden':![],'depth':null}));});}else{logger[_0x797e('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x797e('0x2c'),'plivo',_0x797e('0x58'));}break;case _0x797e('0x59'):if(_0x367a5a[_0x797e('0x30')]&&_0x367a5a[_0x797e('0x31')]){if(_0x367a5a[_0x797e('0x5a')]){var _0x12bb1d={'method':_0x797e('0x39'),'uri':_0x367a5a[_0x797e('0x5a')]+'/auth/1/session','body':{'username':_0x367a5a['username'],'password':_0x367a5a[_0x797e('0x31')]},'json':!![]};return rp(_0x12bb1d)[_0x797e('0x19')](function(_0x466185){var _0x1b3817={'method':_0x797e('0x39'),'uri':_0x367a5a[_0x797e('0x5a')]+_0x797e('0x5b'),'body':{'messages':[{'from':_0x367a5a['phone'],'destinations':[{'to':_0x352166[_0x797e('0x26')]}],'text':_0x352166['body'],'notifyUrl':_0x367a5a[_0x797e('0x27')]+_0x797e('0x28')+_0x352166['id']+'/status?token='+_0x367a5a['token'],'notifyContentType':'application/json','callbackData':_0x367a5a[_0x797e('0x26')]+';'+_0x352166[_0x797e('0xe')]}]},'headers':{'Authorization':_0x797e('0x5c')+_0x466185[_0x797e('0x29')]},'json':!![]};return rp(_0x1b3817)['then'](function(_0x4a282c){if(_0x4a282c['messages']){var _0x300cfc={'messageId':_0x4a282c[_0x797e('0x24')][0x0]['messageId']};if(!_0x367a5a[_0x797e('0x3d')]){_0x300cfc[_0x797e('0x44')]=!![];}return _0x21b014['update'](_0x300cfc);}else{return logger['error'](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x59'),util['inspect'](_0x4a282c,{'showHidden':![],'depth':null}));}});})[_0x797e('0x1c')](function(_0x79435f){return logger[_0x797e('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x797e('0x59'),util[_0x797e('0x2e')](_0x79435f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x59'),_0x797e('0x5d'));}}else{logger[_0x797e('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x797e('0x2c'),_0x797e('0x59'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x797e('0x5e'):var _0x3e49ce=require(_0x797e('0x5f'));if(_0x367a5a['apiKey']){var _0xdb3062={};_0xdb3062[_0x797e('0x60')]=_0x367a5a[_0x797e('0x30')];_0xdb3062['phone']=_0x352166[_0x797e('0x26')];_0xdb3062[_0x797e('0x33')]=_0x367a5a[_0x797e('0x26')];_0xdb3062['text']=_0x352166[_0x797e('0xe')];_0xdb3062[_0x797e('0x61')]=+new Date();var _0x253229='';var _0x326667='';var _0x283fe5=Object[_0x797e('0x62')](_0xdb3062);_0x283fe5['sort']();for(var _0x3a0c7a=0x0;_0x3a0c7a<_0x283fe5[_0x797e('0x63')];_0x3a0c7a++){if(_0x253229!=''){_0x253229+='&';}_0x253229+=_0x283fe5[_0x3a0c7a]+'='+encodeURIComponent(_0xdb3062[_0x283fe5[_0x3a0c7a]]);_0x326667+=_0xdb3062[_0x283fe5[_0x3a0c7a]];}_0x326667+=_0x367a5a[_0x797e('0x64')];_0x326667=_0x3e49ce[_0x797e('0x65')](_0x797e('0x66'))[_0x797e('0x1a')](_0x326667)[_0x797e('0x67')](_0x797e('0x68'));if(_0x253229!==''){_0x253229+='&';}_0x253229+=_0x797e('0x69')+_0x326667;var _0x48612b={'method':_0x797e('0x36'),'uri':_0x367a5a[_0x797e('0x5a')]+'/external/get/send.php?'+_0x253229,'json':!![]};return rp(_0x48612b)[_0x797e('0x19')](function(_0x798fdb){var _0x35ef4d=Object[_0x797e('0x62')](_0x798fdb);if(_0x798fdb[_0x35ef4d[0x0]][_0x797e('0x1d')]&&parseInt(_0x798fdb[_0x35ef4d[0x0]][_0x797e('0x1d')])===0x0){var _0x205634={'messageId':_0x798fdb[_0x35ef4d[0x0]][_0x797e('0x6a')]};if(!_0x367a5a[_0x797e('0x3d')]){_0x205634[_0x797e('0x44')]=!![];}return _0x21b014[_0x797e('0x1a')](_0x205634);}else{return logger['error'](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x5e'),util[_0x797e('0x2e')](_0x798fdb[_0x797e('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1f0d89){return logger[_0x797e('0x1d')](_0x797e('0x2b'),'afterCreate',_0x797e('0x5e'),util[_0x797e('0x2e')](_0x1f0d89,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x797e('0x2b'),_0x797e('0x2c'),'csc',_0x797e('0x6b'));}break;case'clickatell':if(_0x367a5a[_0x797e('0x64')]){var _0x4d8089={'method':_0x797e('0x39'),'uri':_0x797e('0x6c'),'headers':{'Authorization':_0x367a5a[_0x797e('0x64')]},'body':{'content':_0x352166['body'],'to':[_0x352166[_0x797e('0x26')]],'from':_0x367a5a[_0x797e('0x26')],'binary':![],'clientMessageId':_0x797e('0x6d'),'charset':'UTF-8'},'json':!![]};rp(_0x4d8089)[_0x797e('0x19')](function(_0x551e67){if(!_0x551e67[_0x797e('0x1d')]){var _0x2ad572={'messageId':_0x551e67[_0x797e('0x24')][0x0][_0x797e('0x6e')]};if(!_0x367a5a['deliveryReport']){_0x2ad572[_0x797e('0x44')]=!![];}return _0x21b014[_0x797e('0x1a')](_0x2ad572);}else{return logger['error'](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x6f'),util[_0x797e('0x2e')](_0x551e67[_0x797e('0x1d')],{'showHidden':![],'depth':null}));}})[_0x797e('0x1c')](function(_0x15ea5a){return logger[_0x797e('0x1d')](_0x797e('0x2b'),'afterCreate',_0x797e('0x6f'),util[_0x797e('0x2e')](_0x15ea5a,{'showHidden':![],'depth':null}));});}else{logger[_0x797e('0x1d')](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x6f'),_0x797e('0x6b'));}break;case _0x797e('0x70'):if(_0x367a5a['username']&&_0x367a5a['password']){var _0x1d95c1=util[_0x797e('0x48')](_0x797e('0x49'),_0x367a5a[_0x797e('0x30')],_0x367a5a['password']);var _0x47efa7={'method':_0x797e('0x39'),'uri':_0x797e('0x71')+_0x367a5a[_0x797e('0x72')]+_0x797e('0x73'),'body':{'to':[_0x352166[_0x797e('0x26')]],'text':_0x352166['body'],'from':_0x367a5a['phone'],'applicationId':_0x367a5a[_0x797e('0x74')]},'headers':{'Authorization':util[_0x797e('0x48')](_0x797e('0x4b'),new Buffer(_0x1d95c1)['toString'](_0x797e('0x4d')))},'json':!![]};rp(_0x47efa7)['then'](function(_0x1881f0){if(_0x1881f0['id']){var _0xc0e9c8={'messageId':_0x1881f0['id']};return _0x21b014[_0x797e('0x1a')](_0xc0e9c8);}else{logger['error'](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x70'),util[_0x797e('0x2e')](_0x1881f0,{'showHidden':![],'depth':null}));}})[_0x797e('0x1c')](function(_0x32bea7){logger['error'](_0x797e('0x2b'),'afterCreate',_0x797e('0x70'),util[_0x797e('0x2e')](_0x32bea7,{'showHidden':![],'depth':null}));});}else{logger[_0x797e('0x1d')](_0x797e('0x2b'),_0x797e('0x2c'),_0x797e('0x70'),_0x797e('0x3f'));}break;case _0x797e('0x75'):if(_0x367a5a['apiKey']){var _0x5b5f76={};var _0x48612b={'method':'POST','uri':_0x797e('0x76'),'headers':{'Authorization':_0x797e('0x77')+_0x367a5a[_0x797e('0x64')],'Content-Type':_0x797e('0x78')},'body':{'from':_0x367a5a['phone'],'to':_0x352166[_0x797e('0x26')],'text':_0x352166[_0x797e('0xe')]},'json':!![]};return rp(_0x48612b)[_0x797e('0x19')](function(_0x5a4cbb){if(_0x5a4cbb[_0x797e('0x79')]==0xca){_0x5b5f76[_0x797e('0x7a')]=_0x5a4cbb;var _0x48b5bd={'method':_0x797e('0x39'),'uri':_0x797e('0x7b'),'headers':{'Authorization':'Bearer\x20'+_0x367a5a[_0x797e('0x64')],'Content-Type':'application/json'},'body':{'refid':_0x5b5f76[_0x797e('0x7a')]['refid']},'json':!![]};return rp(_0x48b5bd)[_0x797e('0x19')](function(_0x5a15e2){_0x5b5f76[_0x797e('0x7c')]=_0x5a15e2;var _0x4b5b0b={'messageId':_0x5b5f76[_0x797e('0x7a')][_0x797e('0x7d')],'read':!![]};return _0x21b014['update'](_0x4b5b0b);});}else{return logger[_0x797e('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x797e('0x2c'),_0x797e('0x75'),util[_0x797e('0x2e')](_0x5a4cbb,{'showHidden':![],'depth':null}));}})[_0x797e('0x1c')](function(_0x5918cf){return logger[_0x797e('0x1d')](_0x797e('0x2b'),'afterCreate',_0x797e('0x75'),util[_0x797e('0x2e')](_0x5918cf,{'showHidden':![],'depth':null}));});}else{return logger[_0x797e('0x1d')](_0x797e('0x2b'),'afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0x797e('0x7e')](function(){_0x43c91c();});}else{_0x43c91c();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa706=['message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','senderString','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','infobip','baseUrl','/auth/1/session','/status?token=','IBSSO\x20','messages','crypto','login','text','timestamp','keys','sort','length','apiKey','createHash','md5','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','application/json','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','update','createdAt','error','SmsAccount','find','SmsAccountId','then','type','twilio','authToken','phone','accountSid','create','remote','/api/sms/messages/','token','sid','catch','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','login?username=','username','&password=','GET','POST','user_key','session_key','total_sent','deliveryReport','read','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head'];(function(_0x576a1a,_0x2e1999){var _0x5336e8=function(_0x58f0c6){while(--_0x58f0c6){_0x576a1a['push'](_0x576a1a['shift']());}};_0x5336e8(++_0x2e1999);}(_0xa706,0xb0));var _0x6a70=function(_0x5b601a,_0x2a7669){_0x5b601a=_0x5b601a-0x0;var _0x18a26=_0xa706[_0x5b601a];return _0x18a26;};'use strict';var _=require(_0x6a70('0x0'));var util=require(_0x6a70('0x1'));var logger=require('../../config/logger')(_0x6a70('0x2'));var moment=require('moment');var BPromise=require(_0x6a70('0x3'));var rp=require(_0x6a70('0x4'));var fs=require('fs');var path=require(_0x6a70('0x5'));var rimraf=require(_0x6a70('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a70('0x7'));module[_0x6a70('0x8')]=function(_0x390051,_0x55d5f8){return _0x390051[_0x6a70('0x9')](_0x6a70('0xa'),attributes,{'tableName':_0x6a70('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6a70('0xc')]},{'name':_0x6a70('0xd'),'fields':[_0x6a70('0xe')],'type':_0x6a70('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a415e,_0xe76951,_0x2d8199){var _0xbb47d1=_0x390051[_0x6a70('0x10')];var _0x468abc=_0x5a415e['get']({'plain':!![]});if(_0x468abc[_0x6a70('0x11')][_0x6a70('0x12')]()==='in'||_0x468abc[_0x6a70('0x11')][_0x6a70('0x12')]()===_0x6a70('0x13')&&!_0x468abc[_0x6a70('0x14')]&&!_['isNil'](_0x468abc[_0x6a70('0x15')])&&!_[_0x6a70('0x16')](_0x468abc[_0x6a70('0x17')])){_0xbb47d1[_0x6a70('0x18')][_0x6a70('0x19')]({'where':{'id':_0x468abc[_0x6a70('0x17')]}})['then'](function(_0x28ed1f){if(_0x28ed1f){_0x28ed1f[_0x6a70('0x1a')]({'lastMsgAt':_0x468abc[_0x6a70('0x1b')],'lastMsgDirection':_0x468abc[_0x6a70('0x11')][_0x6a70('0x12')]()});}})['catch'](function(_0x5e42f6){console[_0x6a70('0x1c')](_0x5e42f6);});}if(_0x468abc[_0x6a70('0x11')]===_0x6a70('0x13')&&!_0x468abc['secret']){var _0x3f9c1b;_0xbb47d1[_0x6a70('0x1d')][_0x6a70('0x1e')]({'where':{'id':_0x468abc[_0x6a70('0x1f')]},'raw':!![]})[_0x6a70('0x20')](function(_0x3b3621){_0x3f9c1b=_0x3b3621;if(_0x3f9c1b&&_0x3f9c1b[_0x6a70('0x21')]){switch(_0x3f9c1b[_0x6a70('0x21')]){case _0x6a70('0x22'):var _0x8823ed=require('twilio');if(_0x3f9c1b['accountSid']&&_0x3f9c1b[_0x6a70('0x23')]&&_0x3f9c1b[_0x6a70('0x24')]){var _0x574b84=new _0x8823ed(_0x3f9c1b[_0x6a70('0x25')],_0x3f9c1b[_0x6a70('0x23')]);_0x574b84['messages'][_0x6a70('0x26')]({'body':_0x468abc[_0x6a70('0xe')],'to':_0x468abc['phone'],'from':_0x3f9c1b[_0x6a70('0x24')],'statusCallback':_0x3f9c1b[_0x6a70('0x27')]+_0x6a70('0x28')+_0x468abc['id']+'/status?token='+_0x3f9c1b[_0x6a70('0x29')]})[_0x6a70('0x20')](function(_0xa0b512){if(_0xa0b512[_0x6a70('0x2a')]){return _0x5a415e[_0x6a70('0x1a')]({'messageId':_0xa0b512[_0x6a70('0x2a')]});}})[_0x6a70('0x2b')](function(_0x116319){logger[_0x6a70('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a70('0x22'),util[_0x6a70('0x2c')](_0x116319,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a70('0x2d'),_0x6a70('0x2e'),'twilio',_0x6a70('0x2f'));}break;case _0x6a70('0x30'):var _0xac302a=_0x6a70('0x31');if(_0x3f9c1b['username']&&_0x3f9c1b[_0x6a70('0x32')]){var _0x47bbd1={'recipient':[_0x468abc[_0x6a70('0x24')]],'message':_0x468abc['body'],'message_type':_0x3f9c1b[_0x6a70('0x33')]};if(_0x3f9c1b['smsMethod']&&_0x3f9c1b[_0x6a70('0x33')]!=='SI'){_0x47bbd1['sender']=_0x3f9c1b['phone'];}var _0xaca786={'url':_0xac302a+_0x6a70('0x34')+_0x3f9c1b[_0x6a70('0x35')]+_0x6a70('0x36')+_0x3f9c1b[_0x6a70('0x32')],'method':_0x6a70('0x37')};rp(_0xaca786)[_0x6a70('0x20')](function(_0x271599){var _0x2ad394=_0x271599['split'](';');var _0xf9f08d={'user_key':_0x2ad394[0x0],'session_key':_0x2ad394[0x1]};_0xaca786={'url':_0xac302a+'sms','method':_0x6a70('0x38'),'headers':{'user_key':_0xf9f08d[_0x6a70('0x39')],'Session_key':_0xf9f08d[_0x6a70('0x3a')]},'json':!![],'body':_0x47bbd1};return rp(_0xaca786);})[_0x6a70('0x20')](function(_0x2f444d){if(_0x2f444d[_0x6a70('0x3b')]>=0x1){var _0x487307={'messageId':_0x2f444d['internal_order_id']};if(_0x3f9c1b[_0x6a70('0x33')]!=='GP'||!_0x3f9c1b[_0x6a70('0x3c')]){_0x487307[_0x6a70('0x3d')]=!![];}return _0x5a415e[_0x6a70('0x1a')](_0x487307);}else{return logger[_0x6a70('0x1c')](_0x6a70('0x2d'),'afterCreate',_0x6a70('0x30'),util[_0x6a70('0x2c')](_0x2f444d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5c03e6){return logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),'skebby',util[_0x6a70('0x2c')](_0x5c03e6,{'showHidden':![],'depth':null}));});}else{logger[_0x6a70('0x1c')](_0x6a70('0x2d'),'afterCreate',_0x6a70('0x30'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6a70('0x3e'):if(_0x3f9c1b['authToken']){var _0x3ac7cf={'recipient':_0x468abc[_0x6a70('0x24')],'message':_0x468abc[_0x6a70('0xe')],'sender':_0x3f9c1b['senderString']||_0x3f9c1b[_0x6a70('0x24')],'authorization':_0x3f9c1b['authToken']};var _0xe76951={'method':_0x6a70('0x38'),'uri':_0x6a70('0x3f'),'body':_0x3ac7cf,'json':!![]};rp(_0xe76951)[_0x6a70('0x20')](function(_0x447661){var _0x9c47a={'messageId':_0x447661[_0x6a70('0x40')]};if(!_0x3f9c1b['deliveryReport']){_0x9c47a[_0x6a70('0x3d')]=!![];}return _0x5a415e[_0x6a70('0x1a')](_0x9c47a);})[_0x6a70('0x2b')](function(_0x186078){logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x3e'),util[_0x6a70('0x2c')](_0x186078,{'showHidden':![],'depth':null}));});}else{logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x3e'),_0x6a70('0x41'));}break;case _0x6a70('0x42'):if(_0x3f9c1b['username']&&_0x3f9c1b[_0x6a70('0x32')]){var _0x3ac7cf={'messages':[{'source':'xCALLY\x20Motion','to':_0x468abc[_0x6a70('0x24')],'body':_0x468abc[_0x6a70('0xe')],'from':_0x3f9c1b['senderString']||_0x3f9c1b['phone']}]};var _0x1a6a64=util[_0x6a70('0x43')](_0x6a70('0x44'),_0x3f9c1b[_0x6a70('0x35')],_0x3f9c1b[_0x6a70('0x32')]);var _0xe76951={'method':'POST','uri':_0x6a70('0x45'),'body':_0x3ac7cf,'headers':{'Authorization':util[_0x6a70('0x43')](_0x6a70('0x46'),new Buffer(_0x1a6a64)['toString'](_0x6a70('0x47')))},'json':!![]};rp(_0xe76951)[_0x6a70('0x20')](function(_0x13cb6f){if(_0x13cb6f[_0x6a70('0x48')]>=0xc8&&_0x13cb6f[_0x6a70('0x48')]<=0xce){if(_0x13cb6f[_0x6a70('0x49')]&&_0x13cb6f[_0x6a70('0x49')][_0x6a70('0x4a')]>0x0){var _0x19177c=_[_0x6a70('0x4b')](_0x13cb6f['data']['messages']);var _0x30538c={'messageId':_0x19177c[_0x6a70('0x4c')]};if(!_0x3f9c1b[_0x6a70('0x3c')]){_0x30538c[_0x6a70('0x3d')]=!![];}return _0x5a415e[_0x6a70('0x1a')](_0x30538c);}else{logger['error'](_0x6a70('0x2d'),'afterCreate','clickSend',util[_0x6a70('0x2c')](_0x13cb6f,{'showHidden':![],'depth':null}));}}else{logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x4d'),util[_0x6a70('0x2c')](_0x13cb6f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x27a18a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a70('0x4d'),util['inspect'](_0x27a18a,{'showHidden':![],'depth':null}));});}else{logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),'clickSend',_0x6a70('0x4e'));}break;case _0x6a70('0x4f'):if(_0x3f9c1b['authId']&&_0x3f9c1b[_0x6a70('0x23')]){var _0x3ac7cf={'dst':_0x468abc[_0x6a70('0x24')],'text':_0x468abc[_0x6a70('0xe')],'src':_0x3f9c1b[_0x6a70('0x50')]||_0x3f9c1b[_0x6a70('0x24')],'url':_0x3f9c1b[_0x6a70('0x27')]+_0x6a70('0x28')+_0x468abc['id']+'/status?token='+_0x3f9c1b['token']};var _0x1a6a64=util['format']('%s:%s',_0x3f9c1b[_0x6a70('0x51')],_0x3f9c1b[_0x6a70('0x23')]);var _0xe76951={'method':_0x6a70('0x38'),'uri':util[_0x6a70('0x43')](_0x6a70('0x52'),_0x3f9c1b[_0x6a70('0x51')]),'body':_0x3ac7cf,'headers':{'Authorization':util[_0x6a70('0x43')](_0x6a70('0x46'),new Buffer(_0x1a6a64)[_0x6a70('0x53')](_0x6a70('0x47')))},'json':!![]};rp(_0xe76951)[_0x6a70('0x20')](function(_0x7dd544){var _0x54c852={'messageId':_0x7dd544[_0x6a70('0x54')][0x0]};return _0x5a415e[_0x6a70('0x1a')](_0x54c852);})['catch'](function(_0x3a1d6f){logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x4f'),util[_0x6a70('0x2c')](_0x3a1d6f,{'showHidden':![],'depth':null}));});}else{logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x4f'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x6a70('0x55'):if(_0x3f9c1b[_0x6a70('0x35')]&&_0x3f9c1b[_0x6a70('0x32')]){if(_0x3f9c1b[_0x6a70('0x56')]){var _0x54b388={'method':_0x6a70('0x38'),'uri':_0x3f9c1b[_0x6a70('0x56')]+_0x6a70('0x57'),'body':{'username':_0x3f9c1b[_0x6a70('0x35')],'password':_0x3f9c1b[_0x6a70('0x32')]},'json':!![]};return rp(_0x54b388)[_0x6a70('0x20')](function(_0x5a8c1e){var _0x24f1ed={'method':_0x6a70('0x38'),'uri':_0x3f9c1b[_0x6a70('0x56')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3f9c1b[_0x6a70('0x24')],'destinations':[{'to':_0x468abc['phone']}],'text':_0x468abc[_0x6a70('0xe')],'notifyUrl':_0x3f9c1b[_0x6a70('0x27')]+_0x6a70('0x28')+_0x468abc['id']+_0x6a70('0x58')+_0x3f9c1b['token'],'notifyContentType':'application/json','callbackData':_0x3f9c1b[_0x6a70('0x24')]+';'+_0x468abc['body']}]},'headers':{'Authorization':_0x6a70('0x59')+_0x5a8c1e[_0x6a70('0x29')]},'json':!![]};return rp(_0x24f1ed)[_0x6a70('0x20')](function(_0x16b230){if(_0x16b230[_0x6a70('0x5a')]){var _0x2f7f1b={'messageId':_0x16b230[_0x6a70('0x5a')][0x0][_0x6a70('0xc')]};if(!_0x3f9c1b[_0x6a70('0x3c')]){_0x2f7f1b['read']=!![];}return _0x5a415e[_0x6a70('0x1a')](_0x2f7f1b);}else{return logger['error'](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x55'),util[_0x6a70('0x2c')](_0x16b230,{'showHidden':![],'depth':null}));}});})[_0x6a70('0x2b')](function(_0x5757f6){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a70('0x55'),util[_0x6a70('0x2c')](_0x5757f6,{'showHidden':![],'depth':null}));});}else{logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x6a70('0x1c')](_0x6a70('0x2d'),'afterCreate','infobip',_0x6a70('0x4e'));}break;case'csc':var _0x3a7253=require(_0x6a70('0x5b'));if(_0x3f9c1b['apiKey']){var _0x236c93={};_0x236c93[_0x6a70('0x5c')]=_0x3f9c1b[_0x6a70('0x35')];_0x236c93['phone']=_0x468abc['phone'];_0x236c93['sender']=_0x3f9c1b['phone'];_0x236c93[_0x6a70('0x5d')]=_0x468abc[_0x6a70('0xe')];_0x236c93[_0x6a70('0x5e')]=+new Date();var _0x135c71='';var _0x245502='';var _0x23ae55=Object[_0x6a70('0x5f')](_0x236c93);_0x23ae55[_0x6a70('0x60')]();for(var _0x50db8a=0x0;_0x50db8a<_0x23ae55[_0x6a70('0x61')];_0x50db8a++){if(_0x135c71!=''){_0x135c71+='&';}_0x135c71+=_0x23ae55[_0x50db8a]+'='+encodeURIComponent(_0x236c93[_0x23ae55[_0x50db8a]]);_0x245502+=_0x236c93[_0x23ae55[_0x50db8a]];}_0x245502+=_0x3f9c1b[_0x6a70('0x62')];_0x245502=_0x3a7253[_0x6a70('0x63')](_0x6a70('0x64'))[_0x6a70('0x1a')](_0x245502)['digest'](_0x6a70('0x65'));if(_0x135c71!==''){_0x135c71+='&';}_0x135c71+=_0x6a70('0x66')+_0x245502;var _0xaca786={'method':_0x6a70('0x37'),'uri':_0x3f9c1b['baseUrl']+_0x6a70('0x67')+_0x135c71,'json':!![]};return rp(_0xaca786)[_0x6a70('0x20')](function(_0x8638a2){var _0x180809=Object[_0x6a70('0x5f')](_0x8638a2);if(_0x8638a2[_0x180809[0x0]]['error']&&parseInt(_0x8638a2[_0x180809[0x0]]['error'])===0x0){var _0xced76a={'messageId':_0x8638a2[_0x180809[0x0]]['id_sms']};if(!_0x3f9c1b[_0x6a70('0x3c')]){_0xced76a['read']=!![];}return _0x5a415e['update'](_0xced76a);}else{return logger[_0x6a70('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a70('0x2e'),'csc',util[_0x6a70('0x2c')](_0x8638a2[_0x6a70('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1933d2){return logger[_0x6a70('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a70('0x2e'),'csc',util['inspect'](_0x1933d2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a70('0x2d'),_0x6a70('0x2e'),'csc',_0x6a70('0x68'));}break;case _0x6a70('0x69'):if(_0x3f9c1b[_0x6a70('0x62')]){var _0x3289fa={'method':_0x6a70('0x38'),'uri':_0x6a70('0x6a'),'headers':{'Authorization':_0x3f9c1b['apiKey']},'body':{'content':_0x468abc[_0x6a70('0xe')],'to':[_0x468abc[_0x6a70('0x24')]],'from':_0x3f9c1b[_0x6a70('0x24')],'binary':![],'clientMessageId':_0x6a70('0x6b'),'charset':'UTF-8'},'json':!![]};rp(_0x3289fa)[_0x6a70('0x20')](function(_0x16e380){if(!_0x16e380[_0x6a70('0x1c')]){var _0x52bd07={'messageId':_0x16e380[_0x6a70('0x5a')][0x0][_0x6a70('0x6c')]};if(!_0x3f9c1b[_0x6a70('0x3c')]){_0x52bd07[_0x6a70('0x3d')]=!![];}return _0x5a415e[_0x6a70('0x1a')](_0x52bd07);}else{return logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x69'),util['inspect'](_0x16e380[_0x6a70('0x1c')],{'showHidden':![],'depth':null}));}})[_0x6a70('0x2b')](function(_0x4ec84a){return logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x69'),util[_0x6a70('0x2c')](_0x4ec84a,{'showHidden':![],'depth':null}));});}else{logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x69'),_0x6a70('0x68'));}break;case'bandwidth':if(_0x3f9c1b[_0x6a70('0x35')]&&_0x3f9c1b[_0x6a70('0x32')]){var _0x1a6a64=util[_0x6a70('0x43')](_0x6a70('0x44'),_0x3f9c1b['username'],_0x3f9c1b[_0x6a70('0x32')]);var _0xe76951={'method':_0x6a70('0x38'),'uri':_0x6a70('0x6d')+_0x3f9c1b[_0x6a70('0x6e')]+_0x6a70('0x6f'),'body':{'to':[_0x468abc[_0x6a70('0x24')]],'text':_0x468abc[_0x6a70('0xe')],'from':_0x3f9c1b['phone'],'applicationId':_0x3f9c1b[_0x6a70('0x70')]},'headers':{'Authorization':util['format'](_0x6a70('0x46'),new Buffer(_0x1a6a64)[_0x6a70('0x53')]('base64'))},'json':!![]};rp(_0xe76951)[_0x6a70('0x20')](function(_0x527de8){if(_0x527de8['id']){var _0x5643ee={'messageId':_0x527de8['id']};return _0x5a415e[_0x6a70('0x1a')](_0x5643ee);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a70('0x2e'),_0x6a70('0x71'),util['inspect'](_0x527de8,{'showHidden':![],'depth':null}));}})[_0x6a70('0x2b')](function(_0x1cef49){logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x71'),util[_0x6a70('0x2c')](_0x1cef49,{'showHidden':![],'depth':null}));});}else{logger[_0x6a70('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a70('0x2e'),'bandwidth',_0x6a70('0x4e'));}break;case'intelepeer':if(_0x3f9c1b[_0x6a70('0x62')]){var _0xf60bc9={};var _0xaca786={'method':_0x6a70('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x3f9c1b[_0x6a70('0x62')],'Content-Type':'application/json'},'body':{'from':_0x3f9c1b[_0x6a70('0x24')],'to':_0x468abc[_0x6a70('0x24')],'text':_0x468abc[_0x6a70('0xe')]},'json':!![]};return rp(_0xaca786)['then'](function(_0x2523b8){if(_0x2523b8[_0x6a70('0x72')]==0xca){_0xf60bc9[_0x6a70('0x73')]=_0x2523b8;var _0x3a4f0f={'method':_0x6a70('0x38'),'uri':_0x6a70('0x74'),'headers':{'Authorization':_0x6a70('0x75')+_0x3f9c1b[_0x6a70('0x62')],'Content-Type':_0x6a70('0x76')},'body':{'refid':_0xf60bc9[_0x6a70('0x73')][_0x6a70('0x77')]},'json':!![]};return rp(_0x3a4f0f)['then'](function(_0x75fd16){_0xf60bc9[_0x6a70('0x78')]=_0x75fd16;var _0x128687={'messageId':_0xf60bc9[_0x6a70('0x73')][_0x6a70('0x77')],'read':!![]};return _0x5a415e[_0x6a70('0x1a')](_0x128687);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a70('0x79'),util[_0x6a70('0x2c')](_0x2523b8,{'showHidden':![],'depth':null}));}})[_0x6a70('0x2b')](function(_0x5a83af){return logger[_0x6a70('0x1c')](_0x6a70('0x2d'),'afterCreate',_0x6a70('0x79'),util[_0x6a70('0x2c')](_0x5a83af,{'showHidden':![],'depth':null}));});}else{return logger[_0x6a70('0x1c')](_0x6a70('0x2d'),_0x6a70('0x2e'),_0x6a70('0x79'),_0x6a70('0x7a'));}break;}}})[_0x6a70('0x7b')](function(){_0x2d8199();});}else{_0x2d8199();}}},'charset':_0x6a70('0x7c'),'collate':_0x6a70('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 9186db4..4621370 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 _0xa363=['./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xa363,0x9b));var _0x3a36=function(_0x6490c4,_0x2b2190){_0x6490c4=_0x6490c4-0x0;var _0x1cccdc=_0xa363[_0x6490c4];return _0x1cccdc;};'use strict';var _=require(_0x3a36('0x0'));var util=require(_0x3a36('0x1'));var moment=require(_0x3a36('0x2'));var BPromise=require(_0x3a36('0x3'));var rs=require(_0x3a36('0x4'));var fs=require('fs');var Redis=require(_0x3a36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a36('0x6'));var logger=require(_0x3a36('0x7'))('rpc');var config=require(_0x3a36('0x8'));var jayson=require(_0x3a36('0x9'));var client=jayson[_0x3a36('0xa')][_0x3a36('0xb')]({'port':0x232a});config[_0x3a36('0xc')]=_[_0x3a36('0xd')](config[_0x3a36('0xc')],{'host':_0x3a36('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a36('0xc')]));require(_0x3a36('0xf'))[_0x3a36('0x10')](socket);function respondWithRpcPromise(_0x1bfbe2,_0xc83a34,_0x530bfa){return new BPromise(function(_0x207819,_0x47dc48){return client[_0x3a36('0x11')](_0x1bfbe2,_0x530bfa)[_0x3a36('0x12')](function(_0x409a19){logger['info'](_0x3a36('0x13'),_0xc83a34,_0x3a36('0x14'));logger['debug'](_0x3a36('0x15'),_0xc83a34,'request\x20sent',JSON[_0x3a36('0x16')](_0x409a19));if(_0x409a19['error']){if(_0x409a19[_0x3a36('0x17')]['code']===0x1f4){logger[_0x3a36('0x17')](_0x3a36('0x13'),_0xc83a34,_0x409a19[_0x3a36('0x17')][_0x3a36('0x18')]);return _0x47dc48(_0x409a19[_0x3a36('0x17')][_0x3a36('0x18')]);}logger[_0x3a36('0x17')]('SmsMessage,\x20%s,\x20%s',_0xc83a34,_0x409a19[_0x3a36('0x17')][_0x3a36('0x18')]);return _0x207819(_0x409a19[_0x3a36('0x17')][_0x3a36('0x18')]);}else{logger['info'](_0x3a36('0x13'),_0xc83a34,_0x3a36('0x14'));_0x207819(_0x409a19[_0x3a36('0x19')]['message']);}})[_0x3a36('0x1a')](function(_0x4c7147){logger[_0x3a36('0x17')](_0x3a36('0x13'),_0xc83a34,_0x4c7147);_0x47dc48(_0x4c7147);});});}exports['CreateSmsMessage']=function(_0x35bcf7){var _0xb64771=this;return new Promise(function(_0x1cc933,_0x5e9f73){return db[_0x3a36('0x1b')][_0x3a36('0x1c')](_0x35bcf7[_0x3a36('0x1d')],{'raw':_0x35bcf7[_0x3a36('0x1e')]?_0x35bcf7[_0x3a36('0x1e')][_0x3a36('0x1f')]===undefined?!![]:![]:!![]})[_0x3a36('0x12')](function(_0x565a8e){logger['info'](_0x3a36('0x20'),_0x35bcf7);logger[_0x3a36('0x21')](_0x3a36('0x20'),_0x35bcf7,JSON['stringify'](_0x565a8e));_0x1cc933(_0x565a8e);})['catch'](function(_0x21a137){logger[_0x3a36('0x17')](_0x3a36('0x20'),_0x21a137[_0x3a36('0x18')],_0x35bcf7);_0x5e9f73(_0xb64771[_0x3a36('0x17')](0x1f4,_0x21a137[_0x3a36('0x18')]));});});}; \ No newline at end of file +var _0x8437=['jayson/promise','client','http','redis','socket.io-emitter','./smsMessage.socket','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','SmsMessage','create','options','raw','lodash','util','moment','randomstring','ioredis','../../config/logger'];(function(_0x2a5168,_0x4830f3){var _0x2646e4=function(_0x1c79a8){while(--_0x1c79a8){_0x2a5168['push'](_0x2a5168['shift']());}};_0x2646e4(++_0x4830f3);}(_0x8437,0x180));var _0x7843=function(_0x35059d,_0x519800){_0x35059d=_0x35059d-0x0;var _0x153846=_0x8437[_0x35059d];return _0x153846;};'use strict';var _=require(_0x7843('0x0'));var util=require(_0x7843('0x1'));var moment=require(_0x7843('0x2'));var BPromise=require('bluebird');var rs=require(_0x7843('0x3'));var fs=require('fs');var Redis=require(_0x7843('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7843('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7843('0x6'));var client=jayson[_0x7843('0x7')][_0x7843('0x8')]({'port':0x232a});config[_0x7843('0x9')]=_['defaults'](config[_0x7843('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7843('0xa'))(new Redis(config[_0x7843('0x9')]));require(_0x7843('0xb'))['register'](socket);function respondWithRpcPromise(_0x202990,_0x2e6aca,_0x4c61ff){return new BPromise(function(_0x458982,_0xf8ea93){return client[_0x7843('0xc')](_0x202990,_0x4c61ff)[_0x7843('0xd')](function(_0x40d434){logger[_0x7843('0xe')](_0x7843('0xf'),_0x2e6aca,_0x7843('0x10'));logger[_0x7843('0x11')](_0x7843('0x12'),_0x2e6aca,_0x7843('0x10'),JSON[_0x7843('0x13')](_0x40d434));if(_0x40d434[_0x7843('0x14')]){if(_0x40d434['error'][_0x7843('0x15')]===0x1f4){logger[_0x7843('0x14')](_0x7843('0xf'),_0x2e6aca,_0x40d434[_0x7843('0x14')][_0x7843('0x16')]);return _0xf8ea93(_0x40d434[_0x7843('0x14')][_0x7843('0x16')]);}logger[_0x7843('0x14')](_0x7843('0xf'),_0x2e6aca,_0x40d434[_0x7843('0x14')][_0x7843('0x16')]);return _0x458982(_0x40d434['error'][_0x7843('0x16')]);}else{logger[_0x7843('0xe')](_0x7843('0xf'),_0x2e6aca,_0x7843('0x10'));_0x458982(_0x40d434[_0x7843('0x17')][_0x7843('0x16')]);}})[_0x7843('0x18')](function(_0x1dcf67){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2e6aca,_0x1dcf67);_0xf8ea93(_0x1dcf67);});});}exports[_0x7843('0x19')]=function(_0x21ca41){var _0x2f0cf3=this;return new Promise(function(_0x2c23cf,_0xcda9df){return db[_0x7843('0x1a')][_0x7843('0x1b')](_0x21ca41['body'],{'raw':_0x21ca41[_0x7843('0x1c')]?_0x21ca41['options'][_0x7843('0x1d')]===undefined?!![]:![]:!![]})[_0x7843('0xd')](function(_0x55936c){logger[_0x7843('0xe')](_0x7843('0x19'),_0x21ca41);logger[_0x7843('0x11')]('CreateSmsMessage',_0x21ca41,JSON[_0x7843('0x13')](_0x55936c));_0x2c23cf(_0x55936c);})[_0x7843('0x18')](function(_0xb49fcb){logger[_0x7843('0x14')](_0x7843('0x19'),_0xb49fcb['message'],_0x21ca41);_0xcda9df(_0x2f0cf3[_0x7843('0x14')](0x1f4,_0xb49fcb[_0x7843('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 6e96643..a8b27ec 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 _0xe244=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x5ba3c1,_0x48983e){var _0x42d088=function(_0x1cd160){while(--_0x1cd160){_0x5ba3c1['push'](_0x5ba3c1['shift']());}};_0x42d088(++_0x48983e);}(_0xe244,0x1ec));var _0x4e24=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xe244[_0x5c351c];return _0x26f3b3;};'use strict';var SmsMessageEvents=require(_0x4e24('0x0'));var events=[_0x4e24('0x1'),_0x4e24('0x2'),'update'];function createListener(_0x4e1c19,_0x2de46d){return function(_0x1b83c3){_0x2de46d[_0x4e24('0x3')](_0x4e1c19,_0x1b83c3);};}function removeListener(_0x2a2875,_0x1f09b6){return function(){SmsMessageEvents[_0x4e24('0x4')](_0x2a2875,_0x1f09b6);};}exports[_0x4e24('0x5')]=function(_0x552ef2){for(var _0x17843f=0x0,_0x19240b=events[_0x4e24('0x6')];_0x17843f<_0x19240b;_0x17843f++){var _0x5bd8e1=events[_0x17843f];var _0x4a893c=createListener(_0x4e24('0x7')+_0x5bd8e1,_0x552ef2);SmsMessageEvents['on'](_0x5bd8e1,_0x4a893c);}}; \ No newline at end of file +var _0xba1a=['update','emit','removeListener','smsMessage:','./smsMessage.events','save','remove'];(function(_0x144ec8,_0x1917ae){var _0x42f1d3=function(_0xb616ce){while(--_0xb616ce){_0x144ec8['push'](_0x144ec8['shift']());}};_0x42f1d3(++_0x1917ae);}(_0xba1a,0x1cb));var _0xaba1=function(_0x2c4f8c,_0x3a8962){_0x2c4f8c=_0x2c4f8c-0x0;var _0x56f686=_0xba1a[_0x2c4f8c];return _0x56f686;};'use strict';var SmsMessageEvents=require(_0xaba1('0x0'));var events=[_0xaba1('0x1'),_0xaba1('0x2'),_0xaba1('0x3')];function createListener(_0x235c8f,_0x366446){return function(_0x11fb7c){_0x366446[_0xaba1('0x4')](_0x235c8f,_0x11fb7c);};}function removeListener(_0x3c3ff3,_0x4f279a){return function(){SmsMessageEvents[_0xaba1('0x5')](_0x3c3ff3,_0x4f279a);};}exports['register']=function(_0x2560db){for(var _0x28d181=0x0,_0x1d780e=events['length'];_0x28d181<_0x1d780e;_0x28d181++){var _0x88793c=events[_0x28d181];var _0x44c5d3=createListener(_0xaba1('0x6')+_0x88793c,_0x2560db);SmsMessageEvents['on'](_0x88793c,_0x44c5d3);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5b7c431..e3f346c 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 _0x20c7=['post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id/members','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x489083,_0x2abcf1){var _0x3cd31b=function(_0x49705d){while(--_0x49705d){_0x489083['push'](_0x489083['shift']());}};_0x3cd31b(++_0x2abcf1);}(_0x20c7,0x183));var _0x720c=function(_0x5e7f18,_0x5c4411){_0x5e7f18=_0x5e7f18-0x0;var _0x41b0f6=_0x20c7[_0x5e7f18];return _0x41b0f6;};'use strict';var multer=require(_0x720c('0x0'));var util=require(_0x720c('0x1'));var path=require(_0x720c('0x2'));var timeout=require('connect-timeout');var express=require(_0x720c('0x3'));var router=express[_0x720c('0x4')]();var fs_extra=require(_0x720c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x720c('0x6'));var config=require(_0x720c('0x7'));var controller=require(_0x720c('0x8'));router[_0x720c('0x9')]('/',auth['isAuthenticated'](),controller[_0x720c('0xa')]);router[_0x720c('0x9')](_0x720c('0xb'),auth[_0x720c('0xc')](),controller[_0x720c('0xd')]);router[_0x720c('0x9')]('/:id',auth[_0x720c('0xc')](),controller['show']);router['get'](_0x720c('0xe'),auth['isAuthenticated'](),controller[_0x720c('0xf')]);router[_0x720c('0x9')](_0x720c('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x720c('0x9')](_0x720c('0x11'),auth[_0x720c('0xc')](),controller[_0x720c('0x12')]);router[_0x720c('0x13')]('/',auth[_0x720c('0xc')](),controller[_0x720c('0x14')]);router[_0x720c('0x13')]('/:id/teams',auth[_0x720c('0xc')](),controller[_0x720c('0x15')]);router['post'](_0x720c('0x11'),auth[_0x720c('0xc')](),controller[_0x720c('0x16')]);router[_0x720c('0x17')](_0x720c('0x18'),auth['isAuthenticated'](),controller[_0x720c('0x19')]);router[_0x720c('0x1a')](_0x720c('0x18'),auth[_0x720c('0xc')](),controller[_0x720c('0x1b')]);router[_0x720c('0x1a')](_0x720c('0x10'),auth['isAuthenticated'](),controller[_0x720c('0x1c')]);router[_0x720c('0x1a')](_0x720c('0x11'),auth[_0x720c('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x7138=['show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x519d3f,_0x37f5cb){var _0x21d563=function(_0x338e8b){while(--_0x338e8b){_0x519d3f['push'](_0x519d3f['shift']());}};_0x21d563(++_0x37f5cb);}(_0x7138,0x1df));var _0x8713=function(_0x1efb37,_0x36569f){_0x1efb37=_0x1efb37-0x0;var _0x154cb0=_0x7138[_0x1efb37];return _0x154cb0;};'use strict';var multer=require(_0x8713('0x0'));var util=require(_0x8713('0x1'));var path=require('path');var timeout=require(_0x8713('0x2'));var express=require(_0x8713('0x3'));var router=express[_0x8713('0x4')]();var fs_extra=require(_0x8713('0x5'));var auth=require(_0x8713('0x6'));var interaction=require(_0x8713('0x7'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router['get']('/',auth[_0x8713('0x8')](),controller[_0x8713('0x9')]);router[_0x8713('0xa')](_0x8713('0xb'),auth[_0x8713('0x8')](),controller[_0x8713('0xc')]);router['get'](_0x8713('0xd'),auth[_0x8713('0x8')](),controller[_0x8713('0xe')]);router[_0x8713('0xa')](_0x8713('0xf'),auth[_0x8713('0x8')](),controller[_0x8713('0x10')]);router[_0x8713('0xa')](_0x8713('0x11'),auth[_0x8713('0x8')](),controller['getTeams']);router[_0x8713('0xa')](_0x8713('0x12'),auth[_0x8713('0x8')](),controller[_0x8713('0x13')]);router[_0x8713('0x14')]('/',auth['isAuthenticated'](),controller[_0x8713('0x15')]);router[_0x8713('0x14')](_0x8713('0x11'),auth[_0x8713('0x8')](),controller['addTeams']);router[_0x8713('0x14')](_0x8713('0x12'),auth[_0x8713('0x8')](),controller[_0x8713('0x16')]);router[_0x8713('0x17')](_0x8713('0xd'),auth[_0x8713('0x8')](),controller['update']);router[_0x8713('0x18')](_0x8713('0xd'),auth[_0x8713('0x8')](),controller[_0x8713('0x19')]);router[_0x8713('0x18')](_0x8713('0x11'),auth[_0x8713('0x8')](),controller[_0x8713('0x1a')]);router[_0x8713('0x18')](_0x8713('0x12'),auth[_0x8713('0x8')](),controller[_0x8713('0x1b')]);module[_0x8713('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 aebec6e..7c0894b 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 _0xdfcc=['ENUM','rrmemory','roundrobin','exports','STRING','name'];(function(_0x18c8b7,_0x2178e7){var _0x53b194=function(_0x4f1ab3){while(--_0x4f1ab3){_0x18c8b7['push'](_0x18c8b7['shift']());}};_0x53b194(++_0x2178e7);}(_0xdfcc,0x7b));var _0xcdfc=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xdfcc[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require('sequelize');module[_0xcdfc('0x0')]={'name':{'type':Sequelize[_0xcdfc('0x1')],'unique':_0xcdfc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcdfc('0x3')](_0xcdfc('0x4'),'beepall',_0xcdfc('0x5'))}}; \ No newline at end of file +var _0xeeb8=['INTEGER','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x390c42,_0x10e1ae){var _0x43894c=function(_0x510bd0){while(--_0x510bd0){_0x390c42['push'](_0x390c42['shift']());}};_0x43894c(++_0x10e1ae);}(_0xeeb8,0xd5));var _0x8eeb=function(_0x5b3b7e,_0x3ed8d4){_0x5b3b7e=_0x5b3b7e-0x0;var _0xdb379b=_0xeeb8[_0x5b3b7e];return _0xdb379b;};'use strict';var Sequelize=require(_0x8eeb('0x0'));module[_0x8eeb('0x1')]={'name':{'type':Sequelize[_0x8eeb('0x2')],'unique':_0x8eeb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8eeb('0x2')]},'timeout':{'type':Sequelize[_0x8eeb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8eeb('0x5'),_0x8eeb('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5951544..2f6fbb5 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 _0x840f=['UserProfileResource','describe','findOne','UserSmsQueue','length','pick','SmsQueueId','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','select','field','team_has_sms_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','transaction','removeTeams','isEmpty','removeAgents','addAgents','omit','userSmsQueue:save','userSmsQueue:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','get','SmsQueues','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId'];(function(_0x4526cf,_0x31e7d5){var _0x210a01=function(_0x168515){while(--_0x168515){_0x4526cf['push'](_0x4526cf['shift']());}};_0x210a01(++_0x31e7d5);}(_0x840f,0xb5));var _0xf840=function(_0x500aa7,_0x350ad6){_0x500aa7=_0x500aa7-0x0;var _0x5aca36=_0x840f[_0x500aa7];return _0x5aca36;};'use strict';var emlformat=require(_0xf840('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf840('0x1'));var rp=require('request-promise');var moment=require(_0xf840('0x2'));var BPromise=require(_0xf840('0x3'));var Mustache=require(_0xf840('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf840('0x5'));var csv=require(_0xf840('0x6'));var ejs=require(_0xf840('0x7'));var fs=require('fs');var fs_extra=require(_0xf840('0x8'));var _=require(_0xf840('0x9'));var squel=require('squel');var crypto=require(_0xf840('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf840('0xb'));var toCsv=require(_0xf840('0x6'));var querystring=require(_0xf840('0xc'));var Papa=require(_0xf840('0xd'));var Redis=require(_0xf840('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf840('0xf'));var utils=require(_0xf840('0x10'));var config=require(_0xf840('0x11'));var licenseUtil=require(_0xf840('0x12'));var db=require(_0xf840('0x13'))['db'];config['redis']=_[_0xf840('0x14')](config[_0xf840('0x15')],{'host':_0xf840('0x16'),'port':0x18eb});var socket=require(_0xf840('0x17'))(new Redis(config[_0xf840('0x15')]));require('./smsQueue.socket')[_0xf840('0x18')](socket);function respondWithStatusCode(_0xe9aaf2,_0x31e211){_0x31e211=_0x31e211||0xcc;return function(_0x3166ce){if(_0x3166ce){return _0xe9aaf2[_0xf840('0x19')](_0x31e211);}return _0xe9aaf2[_0xf840('0x1a')](_0x31e211)[_0xf840('0x1b')]();};}function respondWithResult(_0x57a0a0,_0x1a71c3){_0x1a71c3=_0x1a71c3||0xc8;return function(_0xf434f5){if(_0xf434f5){return _0x57a0a0['status'](_0x1a71c3)['json'](_0xf434f5);}};}function respondWithFilteredResult(_0x20cdb7,_0x55744d){return function(_0x3922f7){if(_0x3922f7){var _0x32b2df=typeof _0x55744d[_0xf840('0x1c')]===_0xf840('0x1d')&&typeof _0x55744d[_0xf840('0x1e')]===_0xf840('0x1d');var _0x25001a=_0x3922f7[_0xf840('0x1f')];var _0x1a2fc7=_0x32b2df?0x0:_0x55744d['offset'];var _0x27a8b1=_0x32b2df?_0x3922f7['count']:_0x55744d[_0xf840('0x1c')]+_0x55744d[_0xf840('0x1e')];var _0x144e5c;if(_0x27a8b1>=_0x25001a){_0x27a8b1=_0x25001a;_0x144e5c=0xc8;}else{_0x144e5c=0xce;}_0x20cdb7[_0xf840('0x1a')](_0x144e5c);return _0x20cdb7['set'](_0xf840('0x20'),_0x1a2fc7+'-'+_0x27a8b1+'/'+_0x25001a)[_0xf840('0x21')](_0x3922f7);}return null;};}function patchUpdates(_0x310e59){return function(_0xd19a80){try{jsonpatch['apply'](_0xd19a80,_0x310e59,!![]);}catch(_0x4932f4){return BPromise['reject'](_0x4932f4);}return _0xd19a80[_0xf840('0x22')]();};}function saveUpdates(_0x5be433,_0x1c9d31){return function(_0x4d4a8b){if(_0x4d4a8b){return _0x4d4a8b[_0xf840('0x23')](_0x5be433)[_0xf840('0x24')](function(_0x67d2b1){return _0x67d2b1;});}return null;};}function removeEntity(_0x4659a4,_0x252fc7){return function(_0x5ac473){if(_0x5ac473){return _0x5ac473[_0xf840('0x25')]()[_0xf840('0x24')](function(){var _0x3c870f=_0x5ac473[_0xf840('0x26')]({'plain':!![]});var _0x58dfcf=_0xf840('0x27');return db['UserProfileResource'][_0xf840('0x25')]({'where':{'type':_0x58dfcf,'resourceId':_0x3c870f['id']}})[_0xf840('0x24')](function(){return _0x5ac473;});})[_0xf840('0x24')](function(){_0x4659a4[_0xf840('0x1a')](0xcc)[_0xf840('0x1b')]();});}};}function handleEntityNotFound(_0x1eb5df,_0x20484e){return function(_0x4b6a6c){if(!_0x4b6a6c){_0x1eb5df[_0xf840('0x19')](0x194);}return _0x4b6a6c;};}function handleError(_0x15c1ea,_0x1a68a6){_0x1a68a6=_0x1a68a6||0x1f4;return function(_0x398b56){logger[_0xf840('0x28')](_0x398b56[_0xf840('0x29')]);if(_0x398b56[_0xf840('0x2a')]){delete _0x398b56[_0xf840('0x2a')];}_0x15c1ea[_0xf840('0x1a')](_0x1a68a6)['send'](_0x398b56);};}exports[_0xf840('0x2b')]=function(_0x20d13d,_0x47f7e7){var _0x2a000a={},_0x3b73ba={},_0x2456c8={'count':0x0,'rows':[]};var _0x1af738=_[_0xf840('0x2c')](db[_0xf840('0x2d')][_0xf840('0x2e')],function(_0x2ed26a){return{'name':_0x2ed26a[_0xf840('0x2f')],'type':_0x2ed26a[_0xf840('0x30')][_0xf840('0x31')]};});_0x3b73ba['model']=_[_0xf840('0x2c')](_0x1af738,_0xf840('0x2a'));_0x3b73ba[_0xf840('0x32')]=_[_0xf840('0x33')](_0x20d13d[_0xf840('0x32')]);_0x3b73ba['filters']=_['intersection'](_0x3b73ba['model'],_0x3b73ba['query']);_0x2a000a[_0xf840('0x34')]=_[_0xf840('0x35')](_0x3b73ba[_0xf840('0x36')],qs[_0xf840('0x37')](_0x20d13d[_0xf840('0x32')]['fields']));_0x2a000a[_0xf840('0x34')]=_0x2a000a[_0xf840('0x34')]['length']?_0x2a000a[_0xf840('0x34')]:_0x3b73ba[_0xf840('0x36')];if(!_0x20d13d[_0xf840('0x32')][_0xf840('0x38')](_0xf840('0x39'))){_0x2a000a['limit']=qs[_0xf840('0x1e')](_0x20d13d['query'][_0xf840('0x1e')]);_0x2a000a[_0xf840('0x1c')]=qs['offset'](_0x20d13d['query'][_0xf840('0x1c')]);}_0x2a000a[_0xf840('0x3a')]=qs[_0xf840('0x3b')](_0x20d13d[_0xf840('0x32')]['sort']);_0x2a000a[_0xf840('0x3c')]=qs[_0xf840('0x3d')](_['pick'](_0x20d13d[_0xf840('0x32')],_0x3b73ba[_0xf840('0x3d')]),_0x1af738);if(_0x20d13d[_0xf840('0x32')][_0xf840('0x3e')]){_0x2a000a['where']=_[_0xf840('0x3f')](_0x2a000a['where'],{'$or':_['map'](_0x1af738,function(_0x3e08b8){if(_0x3e08b8[_0xf840('0x30')]!=='VIRTUAL'){var _0xad9c31={};_0xad9c31[_0x3e08b8[_0xf840('0x2a')]]={'$like':'%'+_0x20d13d[_0xf840('0x32')]['filter']+'%'};return _0xad9c31;}})});}_0x2a000a=_['merge']({},_0x2a000a,_0x20d13d[_0xf840('0x40')]);var _0x4d4311={'where':_0x2a000a[_0xf840('0x3c')]};return db[_0xf840('0x2d')][_0xf840('0x1f')](_0x4d4311)[_0xf840('0x24')](function(_0x15fdc5){_0x2456c8['count']=_0x15fdc5;if(_0x20d13d['query']['includeAll']){_0x2a000a[_0xf840('0x41')]=[{'all':!![]}];}return db[_0xf840('0x2d')][_0xf840('0x42')](_0x2a000a);})['then'](function(_0x257918){_0x2456c8[_0xf840('0x43')]=_0x257918;return _0x2456c8;})[_0xf840('0x24')](respondWithFilteredResult(_0x47f7e7,_0x2a000a))[_0xf840('0x44')](handleError(_0x47f7e7,null));};exports[_0xf840('0x45')]=function(_0x16e765,_0x3aba0f){var _0x48620c={'raw':!![],'where':{'id':_0x16e765[_0xf840('0x46')]['id']}},_0x284ebf={};_0x284ebf[_0xf840('0x36')]=_[_0xf840('0x33')](db[_0xf840('0x2d')][_0xf840('0x2e')]);_0x284ebf[_0xf840('0x32')]=_[_0xf840('0x33')](_0x16e765[_0xf840('0x32')]);_0x284ebf[_0xf840('0x3d')]=_[_0xf840('0x35')](_0x284ebf[_0xf840('0x36')],_0x284ebf[_0xf840('0x32')]);_0x48620c[_0xf840('0x34')]=_[_0xf840('0x35')](_0x284ebf[_0xf840('0x36')],qs[_0xf840('0x37')](_0x16e765[_0xf840('0x32')]['fields']));_0x48620c[_0xf840('0x34')]=_0x48620c['attributes']['length']?_0x48620c[_0xf840('0x34')]:_0x284ebf[_0xf840('0x36')];if(_0x16e765[_0xf840('0x32')][_0xf840('0x47')]){_0x48620c['include']=[{'all':!![]}];}_0x48620c=_[_0xf840('0x3f')]({},_0x48620c,_0x16e765[_0xf840('0x40')]);return db['SmsQueue'][_0xf840('0x48')](_0x48620c)[_0xf840('0x24')](handleEntityNotFound(_0x3aba0f,null))['then'](respondWithResult(_0x3aba0f,null))[_0xf840('0x44')](handleError(_0x3aba0f,null));};exports[_0xf840('0x49')]=function(_0x104753,_0x46d274){return db['SmsQueue'][_0xf840('0x49')](_0x104753[_0xf840('0x4a')],{})[_0xf840('0x24')](function(_0x3b8ada){var _0x2a6757=_0x104753['user'][_0xf840('0x26')]({'plain':!![]});if(!_0x2a6757)throw new Error(_0xf840('0x4b'));if(_0x2a6757['role']===_0xf840('0x4c')){var _0x269d83=_0x3b8ada[_0xf840('0x26')]({'plain':!![]});var _0x1e72be=_0xf840('0x27');return db[_0xf840('0x4d')][_0xf840('0x48')]({'where':{'name':_0x1e72be,'userProfileId':_0x2a6757[_0xf840('0x4e')]},'raw':!![]})['then'](function(_0x156097){if(_0x156097&&_0x156097['autoAssociation']===0x0){return db[_0xf840('0x4f')]['create']({'name':_0x269d83[_0xf840('0x2a')],'resourceId':_0x269d83['id'],'type':_0x156097[_0xf840('0x2a')],'sectionId':_0x156097['id']},{})[_0xf840('0x24')](function(){return _0x3b8ada;});}else{return _0x3b8ada;}})[_0xf840('0x44')](function(_0x336769){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x336769);throw _0x336769;});}return _0x3b8ada;})[_0xf840('0x24')](respondWithResult(_0x46d274,0xc9))[_0xf840('0x44')](handleError(_0x46d274,null));};exports['update']=function(_0x5d9fe9,_0x1f7102){if(_0x5d9fe9[_0xf840('0x4a')]['id']){delete _0x5d9fe9[_0xf840('0x4a')]['id'];}return db[_0xf840('0x2d')][_0xf840('0x48')]({'where':{'id':_0x5d9fe9[_0xf840('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f7102,null))[_0xf840('0x24')](saveUpdates(_0x5d9fe9['body'],null))[_0xf840('0x24')](respondWithResult(_0x1f7102,null))['catch'](handleError(_0x1f7102,null));};exports[_0xf840('0x25')]=function(_0x586cb1,_0x5a2379){return db[_0xf840('0x2d')]['find']({'where':{'id':_0x586cb1[_0xf840('0x46')]['id']}})[_0xf840('0x24')](handleEntityNotFound(_0x5a2379,null))[_0xf840('0x24')](removeEntity(_0x5a2379,null))[_0xf840('0x44')](handleError(_0x5a2379,null));};exports['describe']=function(_0x4cf2ab,_0x3a6e4a){return db[_0xf840('0x2d')][_0xf840('0x50')]()['then'](respondWithResult(_0x3a6e4a,null))['catch'](handleError(_0x3a6e4a,null));};exports['getMembers']=function(_0x322e1d,_0x2fc0dc,_0x1132d8){var _0x44096b={'raw':!![],'where':{}},_0x441f99={},_0x51b1aa;return db[_0xf840('0x2d')][_0xf840('0x51')]({'where':{'id':_0x322e1d[_0xf840('0x46')]['id']}})[_0xf840('0x24')](handleEntityNotFound(_0x2fc0dc,null))[_0xf840('0x24')](function(_0x9a9548){if(_0x9a9548){_0x51b1aa=_0x9a9548['get']({'plain':!![]});_0x441f99[_0xf840('0x36')]=_[_0xf840('0x33')](db[_0xf840('0x52')][_0xf840('0x2e')]);_0x441f99[_0xf840('0x32')]=_[_0xf840('0x33')](_0x322e1d['query']);_0x441f99[_0xf840('0x3d')]=_['intersection'](_0x441f99['model'],_0x441f99[_0xf840('0x32')]);_0x44096b['attributes']=_['intersection'](_0x441f99['model'],qs['fields'](_0x322e1d[_0xf840('0x32')][_0xf840('0x37')]));_0x44096b[_0xf840('0x34')]=_0x44096b['attributes'][_0xf840('0x53')]?_0x44096b[_0xf840('0x34')]:_0x441f99[_0xf840('0x36')];if(!_0x322e1d[_0xf840('0x32')]['hasOwnProperty'](_0xf840('0x39'))){_0x44096b['limit']=qs['limit'](_0x322e1d[_0xf840('0x32')][_0xf840('0x1e')]);_0x44096b[_0xf840('0x1c')]=qs[_0xf840('0x1c')](_0x322e1d['query'][_0xf840('0x1c')]);}_0x44096b[_0xf840('0x3a')]=qs[_0xf840('0x3b')](_0x322e1d[_0xf840('0x32')][_0xf840('0x3b')]);_0x44096b[_0xf840('0x3c')]=qs[_0xf840('0x3d')](_[_0xf840('0x54')](_0x322e1d['query'],_0x441f99[_0xf840('0x3d')]));_0x44096b[_0xf840('0x3c')][_0xf840('0x55')]=_0x9a9548['id'];if(_0x322e1d['query'][_0xf840('0x3e')]){_0x44096b[_0xf840('0x3c')]=_[_0xf840('0x3f')](_0x44096b[_0xf840('0x3c')],{'$or':_[_0xf840('0x2c')](_0x44096b[_0xf840('0x34')],function(_0x4c134e){var _0x287dad={};_0x287dad[_0x4c134e]={'$like':'%'+_0x322e1d[_0xf840('0x32')][_0xf840('0x3e')]+'%'};return _0x287dad;})});}_0x44096b=_['merge']({},_0x44096b,_0x322e1d[_0xf840('0x40')]);return db[_0xf840('0x52')][_0xf840('0x42')](_0x44096b);}})[_0xf840('0x24')](function(_0x44448c){if(_0x44448c){return db[_0xf840('0x56')][_0xf840('0x57')]({'where':{'id':_[_0xf840('0x2c')](_0x44448c,'UserId'),'role':_0xf840('0x58')},'attributes':['id','name',_0xf840('0x59'),_0xf840('0x5a'),_0xf840('0x5b')]});}})['then'](function(_0x324642){if(_0x324642){return{'count':_0x324642['count'],'rows':_[_0xf840('0x2c')](_0x324642['rows'],function(_0x1194df){return{'membername':_0x1194df[_0xf840('0x2a')],'UserId':_0x1194df['id'],'queue_name':_0x51b1aa[_0xf840('0x2a')],'SmsQueueId':_0x51b1aa['id'],'interface':util[_0xf840('0x5c')](_0xf840('0x5d'),_0xf840('0x5e'),_0x1194df['name']),'penalty':0x0,'paused':_0x1194df[_0xf840('0x59')],'createdAt':_0x1194df['createdAt'],'updatedAt':_0x1194df[_0xf840('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2fc0dc,_0x44096b))['catch'](handleError(_0x2fc0dc,null));};exports[_0xf840('0x5f')]=function(_0x467ba6,_0x4537e7,_0x361990){var _0x3a0e23={};var _0x108fc3={};var _0x2de22c;var _0x547cbc;return db[_0xf840('0x2d')][_0xf840('0x51')]({'where':{'id':_0x467ba6[_0xf840('0x46')]['id']}})[_0xf840('0x24')](handleEntityNotFound(_0x4537e7,null))[_0xf840('0x24')](function(_0x2490f7){if(_0x2490f7){_0x2de22c=_0x2490f7;_0x108fc3[_0xf840('0x36')]=_['keys'](db[_0xf840('0x60')][_0xf840('0x2e')]);_0x108fc3[_0xf840('0x32')]=_[_0xf840('0x33')](_0x467ba6[_0xf840('0x32')]);_0x108fc3[_0xf840('0x3d')]=_[_0xf840('0x35')](_0x108fc3['model'],_0x108fc3[_0xf840('0x32')]);_0x3a0e23['attributes']=_[_0xf840('0x35')](_0x108fc3['model'],qs['fields'](_0x467ba6[_0xf840('0x32')][_0xf840('0x37')]));_0x3a0e23[_0xf840('0x34')]=_0x3a0e23[_0xf840('0x34')][_0xf840('0x53')]?_0x3a0e23[_0xf840('0x34')]:_0x108fc3['model'];_0x3a0e23['order']=qs[_0xf840('0x3b')](_0x467ba6[_0xf840('0x32')]['sort']);_0x3a0e23['where']=qs[_0xf840('0x3d')](_[_0xf840('0x54')](_0x467ba6[_0xf840('0x32')],_0x108fc3[_0xf840('0x3d')]));if(_0x467ba6[_0xf840('0x32')][_0xf840('0x3e')]){_0x3a0e23[_0xf840('0x3c')]=_[_0xf840('0x3f')](_0x3a0e23[_0xf840('0x3c')],{'$or':_[_0xf840('0x2c')](_0x3a0e23[_0xf840('0x34')],function(_0x1c7bb3){var _0x1a72fe={};_0x1a72fe[_0x1c7bb3]={'$like':'%'+_0x467ba6['query'][_0xf840('0x3e')]+'%'};return _0x1a72fe;})});}_0x3a0e23=_[_0xf840('0x3f')]({},_0x3a0e23,_0x467ba6[_0xf840('0x40')]);return _0x2de22c['getTeams'](_0x3a0e23);}})[_0xf840('0x24')](function(_0x1a76aa){if(_0x1a76aa){_0x547cbc=_0x1a76aa[_0xf840('0x53')];if(!_0x467ba6[_0xf840('0x32')][_0xf840('0x38')](_0xf840('0x39'))){_0x3a0e23[_0xf840('0x1e')]=qs['limit'](_0x467ba6[_0xf840('0x32')][_0xf840('0x1e')]);_0x3a0e23[_0xf840('0x1c')]=qs[_0xf840('0x1c')](_0x467ba6[_0xf840('0x32')]['offset']);}return _0x2de22c[_0xf840('0x5f')](_0x3a0e23);}})[_0xf840('0x24')](function(_0x12b755){if(_0x12b755){return _0x12b755?{'count':_0x547cbc,'rows':_0x12b755}:null;}})[_0xf840('0x24')](respondWithResult(_0x4537e7,null))['catch'](handleError(_0x4537e7,null));};exports[_0xf840('0x61')]=function(_0x398857,_0x50d8af,_0x33ccd4){var _0x256ad3=_0x398857['body'][_0xf840('0x62')];return db[_0xf840('0x60')][_0xf840('0x42')]({'where':{'id':_0x256ad3},'attributes':['id'],'include':[{'model':db[_0xf840('0x56')],'as':_0xf840('0x63'),'attributes':['id',_0xf840('0x2a'),'online',_0xf840('0x64'),_0xf840('0x65')],'raw':!![]}]})[_0xf840('0x24')](function(_0x3d95f7){if(_0x3d95f7){var _0x5a7c29=_[_0xf840('0x66')](_0x3d95f7,function(_0x2e1019){var _0xfc2c9d=_0x2e1019[_0xf840('0x26')]({'plain':!![]});return _0xfc2c9d[_0xf840('0x63')];});return db[_0xf840('0x2d')][_0xf840('0x48')]({'where':{'id':_0x398857[_0xf840('0x46')]['id']}})['then'](function(_0x28ed7d){return db[_0xf840('0x67')]['transaction'](function(_0x506b06){return _0x28ed7d[_0xf840('0x61')](_0x256ad3,{'transaction':_0x506b06})[_0xf840('0x24')](function(){return BPromise['each'](_0x5a7c29,function(_0x1238b9){return db[_0xf840('0x52')][_0xf840('0x68')]({'where':{'UserId':_0x1238b9['id'],'SmsQueueId':_0x398857['params']['id']},'transaction':_0x506b06});});})[_0xf840('0x24')](function(){_0x5a7c29[_0xf840('0x69')](function(_0x1b4d8f){socket[_0xf840('0x6a')]('userSmsQueue:save',{'UserId':_0x1b4d8f['id'],'SmsQueueId':_0x28ed7d['id']});});});});});}})[_0xf840('0x24')](respondWithStatusCode(_0x50d8af,null))[_0xf840('0x44')](handleError(_0x50d8af,null));};exports['removeTeams']=function(_0x5a5ab1,_0x3de176,_0x346613){return db['Team'][_0xf840('0x42')]({'where':{'id':_0x5a5ab1[_0xf840('0x32')][_0xf840('0x62')]},'attributes':['id'],'include':[{'model':db[_0xf840('0x56')],'as':_0xf840('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3de176,null))[_0xf840('0x24')](function(_0x3573c0){var _0x448980=_[_0xf840('0x2c')](_0x3573c0,'id');var _0x5c7f4e=[];var _0x5e5819=[];var _0x4b619f=squel[_0xf840('0x6b')]();_0x4b619f[_0xf840('0x6c')]('tq.TeamId')['from'](_0xf840('0x6d'),'tq')[_0xf840('0x6e')](_0xf840('0x6f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf840('0x3c')]('SmsQueueId\x20=\x20?',_0x5a5ab1['params']['id']);for(var _0x6cc2f8=0x0;_0x6cc2f8<_0x3573c0[_0xf840('0x53')];_0x6cc2f8+=0x1){let _0x4b878b=_0x3573c0[_0x6cc2f8];for(var _0x44ffb7=0x0;_0x44ffb7<_0x4b878b[_0xf840('0x63')][_0xf840('0x53')];_0x44ffb7+=0x1){let _0x2e462c=_0x4b878b[_0xf840('0x63')][_0x44ffb7];var _0x4bc435=_0x4b619f[_0xf840('0x70')]();_0x4bc435[_0xf840('0x3c')](_0xf840('0x71'),_0x2e462c['id']);_0x5e5819[_0xf840('0x72')](db[_0xf840('0x67')][_0xf840('0x32')](_0x4bc435[_0xf840('0x73')](),{'type':db[_0xf840('0x67')]['QueryTypes'][_0xf840('0x74')]})['then'](function(_0x43f0dc){if(_0x43f0dc[_0xf840('0x53')]===0x1){return _0x2e462c['id'];}else{var _0x21e989=_['every'](_[_0xf840('0x2c')](_0x43f0dc,_0xf840('0x75')),function(_0x90ab45){return _[_0xf840('0x76')](_0x448980,_0x90ab45);});if(_0x21e989){return _0x2e462c['id'];}}}));}}return BPromise[_0xf840('0x77')](_0x5e5819)[_0xf840('0x24')](function(_0x2f39ef){_0x5c7f4e=_(_0x5c7f4e)[_0xf840('0x78')](_0x2f39ef)['compact']()['value']();return db[_0xf840('0x2d')][_0xf840('0x48')]({'where':{'id':_0x5a5ab1['params']['id']}})['then'](function(_0x25179f){return db[_0xf840('0x67')][_0xf840('0x79')](function(_0x2fc4ab){return _0x25179f[_0xf840('0x7a')](_0x5a5ab1['query'][_0xf840('0x62')],{'transaction':_0x2fc4ab})[_0xf840('0x24')](function(){if(!_[_0xf840('0x7b')](_0x5c7f4e)){return _0x25179f[_0xf840('0x7c')](_0x5c7f4e,{'transaction':_0x2fc4ab});}})[_0xf840('0x24')](function(){_0x5c7f4e[_0xf840('0x69')](function(_0xde09a4){socket[_0xf840('0x6a')]('userSmsQueue:remove',{'UserId':_0xde09a4,'SmsQueueId':_0x25179f['id']});});});});});});})[_0xf840('0x24')](respondWithStatusCode(_0x3de176,null))[_0xf840('0x44')](handleError(_0x3de176,null));};exports['addAgents']=function(_0x1aac0d,_0x5d6d1b,_0x50a50f){return db[_0xf840('0x2d')][_0xf840('0x48')]({'where':{'id':_0x1aac0d[_0xf840('0x46')]['id']}})[_0xf840('0x24')](handleEntityNotFound(_0x5d6d1b,null))['then'](function(_0x1c6e94){if(_0x1c6e94){return _0x1c6e94[_0xf840('0x7d')](_0x1aac0d[_0xf840('0x4a')][_0xf840('0x62')],_[_0xf840('0x7e')](_0x1aac0d['body'],[_0xf840('0x62'),'id'])||{})['spread'](function(_0x16996d){for(var _0x56c840=0x0;_0x56c840<_0x1aac0d[_0xf840('0x4a')][_0xf840('0x62')][_0xf840('0x53')];_0x56c840+=0x1){socket[_0xf840('0x6a')](_0xf840('0x7f'),{'UserId':Number(_0x1aac0d[_0xf840('0x4a')]['ids'][_0x56c840]),'SmsQueueId':Number(_0x1aac0d[_0xf840('0x46')]['id'])});}return _0x16996d;});}})[_0xf840('0x24')](respondWithResult(_0x5d6d1b,null))[_0xf840('0x44')](handleError(_0x5d6d1b,null));};exports[_0xf840('0x7c')]=function(_0x231b15,_0x1ba316,_0x5c1a91){return db[_0xf840('0x2d')]['find']({'where':{'id':_0x231b15['params']['id']}})[_0xf840('0x24')](handleEntityNotFound(_0x1ba316,null))['then'](function(_0x3495ec){if(_0x3495ec){return _0x3495ec[_0xf840('0x7c')](_0x231b15['query'][_0xf840('0x62')])[_0xf840('0x24')](function(){if(_['isArray'](_0x231b15[_0xf840('0x32')][_0xf840('0x62')])){for(var _0x3a5e31=0x0;_0x3a5e31<_0x231b15[_0xf840('0x32')][_0xf840('0x62')][_0xf840('0x53')];_0x3a5e31+=0x1){socket['emit'](_0xf840('0x80'),{'UserId':Number(_0x231b15[_0xf840('0x32')][_0xf840('0x62')][_0x3a5e31]),'SmsQueueId':Number(_0x231b15[_0xf840('0x46')]['id'])});}}else{socket[_0xf840('0x6a')](_0xf840('0x80'),{'UserId':Number(_0x231b15[_0xf840('0x32')]['ids']),'SmsQueueId':Number(_0x231b15[_0xf840('0x46')]['id'])});}});}})[_0xf840('0x24')](respondWithStatusCode(_0x1ba316,null))[_0xf840('0x44')](handleError(_0x1ba316,null));};exports['getAgents']=function(_0xb3ef5e,_0x1240c8,_0x4ffae6){var _0x4568c8={};var _0xbe12b9={};var _0x5eb5f5;var _0x45d8c0;return db[_0xf840('0x2d')][_0xf840('0x51')]({'where':{'id':_0xb3ef5e['params']['id']}})[_0xf840('0x24')](handleEntityNotFound(_0x1240c8,null))[_0xf840('0x24')](function(_0x1074f6){if(_0x1074f6){_0x5eb5f5=_0x1074f6;_0xbe12b9[_0xf840('0x36')]=_[_0xf840('0x33')](db['User'][_0xf840('0x2e')]);_0xbe12b9[_0xf840('0x32')]=_[_0xf840('0x33')](_0xb3ef5e[_0xf840('0x32')]);_0xbe12b9[_0xf840('0x3d')]=_['intersection'](_0xbe12b9[_0xf840('0x36')],_0xbe12b9[_0xf840('0x32')]);_0x4568c8[_0xf840('0x34')]=_[_0xf840('0x35')](_0xbe12b9['model'],qs[_0xf840('0x37')](_0xb3ef5e[_0xf840('0x32')][_0xf840('0x37')]));_0x4568c8[_0xf840('0x34')]=_0x4568c8[_0xf840('0x34')][_0xf840('0x53')]?_0x4568c8[_0xf840('0x34')]:_0xbe12b9[_0xf840('0x36')];_0x4568c8['order']=qs[_0xf840('0x3b')](_0xb3ef5e[_0xf840('0x32')][_0xf840('0x3b')]);_0x4568c8[_0xf840('0x3c')]=qs[_0xf840('0x3d')](_[_0xf840('0x54')](_0xb3ef5e[_0xf840('0x32')],_0xbe12b9['filters']));if(_0xb3ef5e['query']['filter']){_0x4568c8[_0xf840('0x3c')]=_['merge'](_0x4568c8[_0xf840('0x3c')],{'$or':_[_0xf840('0x2c')](_0x4568c8[_0xf840('0x34')],function(_0x4c8f1b){var _0x26dc4d={};_0x26dc4d[_0x4c8f1b]={'$like':'%'+_0xb3ef5e[_0xf840('0x32')][_0xf840('0x3e')]+'%'};return _0x26dc4d;})});}_0x4568c8=_['merge']({},_0x4568c8,_0xb3ef5e['options']);return _0x5eb5f5[_0xf840('0x81')](_0x4568c8);}})[_0xf840('0x24')](function(_0x3f45d9){if(_0x3f45d9){_0x45d8c0=_0x3f45d9['length'];if(!_0xb3ef5e[_0xf840('0x32')][_0xf840('0x38')](_0xf840('0x39'))){_0x4568c8['limit']=qs[_0xf840('0x1e')](_0xb3ef5e[_0xf840('0x32')][_0xf840('0x1e')]);_0x4568c8[_0xf840('0x1c')]=qs[_0xf840('0x1c')](_0xb3ef5e[_0xf840('0x32')][_0xf840('0x1c')]);}return _0x5eb5f5['getAgents'](_0x4568c8);}})[_0xf840('0x24')](function(_0x436bde){if(_0x436bde){return _0x436bde?{'count':_0x45d8c0,'rows':_0x436bde}:null;}})[_0xf840('0x24')](respondWithResult(_0x1240c8,null))[_0xf840('0x44')](handleError(_0x1240c8,null));}; \ No newline at end of file +var _0x9ba5=['update','destroy','then','get','UserProfileResource','stack','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','UserProfileSection','find','error','body','params','findOne','UserSmsQueue','hasOwnProperty','findAndCountAll','UserId','smsPause','createdAt','format','SIP','updatedAt','getTeams','nolimit','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','User','select','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','end','status','json','count','offset','set','Content-Range','reject'];(function(_0x8c9741,_0x1362c8){var _0x580e3e=function(_0x31ee83){while(--_0x31ee83){_0x8c9741['push'](_0x8c9741['shift']());}};_0x580e3e(++_0x1362c8);}(_0x9ba5,0x1f3));var _0x59ba=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x9ba5[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0x59ba('0x0'));var rimraf=require(_0x59ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59ba('0x2'));var rp=require(_0x59ba('0x3'));var moment=require('moment');var BPromise=require(_0x59ba('0x4'));var Mustache=require(_0x59ba('0x5'));var util=require(_0x59ba('0x6'));var path=require(_0x59ba('0x7'));var sox=require(_0x59ba('0x8'));var csv=require(_0x59ba('0x9'));var ejs=require(_0x59ba('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x59ba('0xb'));var crypto=require(_0x59ba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x59ba('0xd'));var toCsv=require(_0x59ba('0x9'));var querystring=require(_0x59ba('0xe'));var Papa=require('papaparse');var Redis=require(_0x59ba('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x59ba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59ba('0x11'))(_0x59ba('0x12'));var utils=require(_0x59ba('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x59ba('0x14'));var db=require(_0x59ba('0x15'))['db'];config[_0x59ba('0x16')]=_[_0x59ba('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x59ba('0x16')]));require('./smsQueue.socket')[_0x59ba('0x18')](socket);function respondWithStatusCode(_0x520b2b,_0x30db76){_0x30db76=_0x30db76||0xcc;return function(_0x1074f6){if(_0x1074f6){return _0x520b2b['sendStatus'](_0x30db76);}return _0x520b2b['status'](_0x30db76)[_0x59ba('0x19')]();};}function respondWithResult(_0x3a6311,_0x28ebbd){_0x28ebbd=_0x28ebbd||0xc8;return function(_0x54f47f){if(_0x54f47f){return _0x3a6311[_0x59ba('0x1a')](_0x28ebbd)[_0x59ba('0x1b')](_0x54f47f);}};}function respondWithFilteredResult(_0x16ff93,_0x42530c){return function(_0x23afb3){if(_0x23afb3){var _0x55e41b=typeof _0x42530c['offset']==='undefined'&&typeof _0x42530c['limit']==='undefined';var _0x17c7b3=_0x23afb3[_0x59ba('0x1c')];var _0x31fd82=_0x55e41b?0x0:_0x42530c[_0x59ba('0x1d')];var _0x5b281b=_0x55e41b?_0x23afb3[_0x59ba('0x1c')]:_0x42530c[_0x59ba('0x1d')]+_0x42530c['limit'];var _0x4fdcef;if(_0x5b281b>=_0x17c7b3){_0x5b281b=_0x17c7b3;_0x4fdcef=0xc8;}else{_0x4fdcef=0xce;}_0x16ff93['status'](_0x4fdcef);return _0x16ff93[_0x59ba('0x1e')](_0x59ba('0x1f'),_0x31fd82+'-'+_0x5b281b+'/'+_0x17c7b3)[_0x59ba('0x1b')](_0x23afb3);}return null;};}function patchUpdates(_0x48f8dd){return function(_0x290942){try{jsonpatch['apply'](_0x290942,_0x48f8dd,!![]);}catch(_0x104276){return BPromise[_0x59ba('0x20')](_0x104276);}return _0x290942['save']();};}function saveUpdates(_0x1a6f70,_0x2119d0){return function(_0x58d617){if(_0x58d617){return _0x58d617[_0x59ba('0x21')](_0x1a6f70)['then'](function(_0x72dda1){return _0x72dda1;});}return null;};}function removeEntity(_0xee5a26,_0xb9e357){return function(_0x20789c){if(_0x20789c){return _0x20789c[_0x59ba('0x22')]()[_0x59ba('0x23')](function(){var _0x1a3bb0=_0x20789c[_0x59ba('0x24')]({'plain':!![]});var _0x30e13c='SmsQueues';return db[_0x59ba('0x25')]['destroy']({'where':{'type':_0x30e13c,'resourceId':_0x1a3bb0['id']}})[_0x59ba('0x23')](function(){return _0x20789c;});})['then'](function(){_0xee5a26[_0x59ba('0x1a')](0xcc)[_0x59ba('0x19')]();});}};}function handleEntityNotFound(_0xc5aa1b,_0x3f2f89){return function(_0x3ea1ee){if(!_0x3ea1ee){_0xc5aa1b['sendStatus'](0x194);}return _0x3ea1ee;};}function handleError(_0x4db2e8,_0x52e5b7){_0x52e5b7=_0x52e5b7||0x1f4;return function(_0x35c2ab){logger['error'](_0x35c2ab[_0x59ba('0x26')]);if(_0x35c2ab['name']){delete _0x35c2ab[_0x59ba('0x27')];}_0x4db2e8[_0x59ba('0x1a')](_0x52e5b7)[_0x59ba('0x28')](_0x35c2ab);};}exports['index']=function(_0x4263d0,_0x4e5db2){var _0x2284b3={},_0x2c107c={},_0x129a61={'count':0x0,'rows':[]};var _0x14fc98=_[_0x59ba('0x29')](db[_0x59ba('0x2a')][_0x59ba('0x2b')],function(_0x26fd88){return{'name':_0x26fd88[_0x59ba('0x2c')],'type':_0x26fd88[_0x59ba('0x2d')][_0x59ba('0x2e')]};});_0x2c107c[_0x59ba('0x2f')]=_['map'](_0x14fc98,_0x59ba('0x27'));_0x2c107c[_0x59ba('0x30')]=_[_0x59ba('0x31')](_0x4263d0[_0x59ba('0x30')]);_0x2c107c['filters']=_[_0x59ba('0x32')](_0x2c107c['model'],_0x2c107c[_0x59ba('0x30')]);_0x2284b3[_0x59ba('0x33')]=_[_0x59ba('0x32')](_0x2c107c[_0x59ba('0x2f')],qs[_0x59ba('0x34')](_0x4263d0[_0x59ba('0x30')][_0x59ba('0x34')]));_0x2284b3[_0x59ba('0x33')]=_0x2284b3[_0x59ba('0x33')][_0x59ba('0x35')]?_0x2284b3['attributes']:_0x2c107c[_0x59ba('0x2f')];if(!_0x4263d0[_0x59ba('0x30')]['hasOwnProperty']('nolimit')){_0x2284b3[_0x59ba('0x36')]=qs['limit'](_0x4263d0['query'][_0x59ba('0x36')]);_0x2284b3[_0x59ba('0x1d')]=qs['offset'](_0x4263d0[_0x59ba('0x30')][_0x59ba('0x1d')]);}_0x2284b3[_0x59ba('0x37')]=qs[_0x59ba('0x38')](_0x4263d0['query'][_0x59ba('0x38')]);_0x2284b3[_0x59ba('0x39')]=qs[_0x59ba('0x3a')](_[_0x59ba('0x3b')](_0x4263d0[_0x59ba('0x30')],_0x2c107c['filters']),_0x14fc98);if(_0x4263d0[_0x59ba('0x30')][_0x59ba('0x3c')]){_0x2284b3[_0x59ba('0x39')]=_[_0x59ba('0x3d')](_0x2284b3[_0x59ba('0x39')],{'$or':_[_0x59ba('0x29')](_0x14fc98,function(_0x194c8d){if(_0x194c8d[_0x59ba('0x2d')]!==_0x59ba('0x3e')){var _0x4aba7d={};_0x4aba7d[_0x194c8d[_0x59ba('0x27')]]={'$like':'%'+_0x4263d0[_0x59ba('0x30')][_0x59ba('0x3c')]+'%'};return _0x4aba7d;}})});}_0x2284b3=_[_0x59ba('0x3d')]({},_0x2284b3,_0x4263d0[_0x59ba('0x3f')]);var _0x1048e6={'where':_0x2284b3[_0x59ba('0x39')]};return db[_0x59ba('0x2a')][_0x59ba('0x1c')](_0x1048e6)[_0x59ba('0x23')](function(_0x19d5e9){_0x129a61[_0x59ba('0x1c')]=_0x19d5e9;if(_0x4263d0['query']['includeAll']){_0x2284b3[_0x59ba('0x40')]=[{'all':!![]}];}return db[_0x59ba('0x2a')][_0x59ba('0x41')](_0x2284b3);})[_0x59ba('0x23')](function(_0x174cf9){_0x129a61[_0x59ba('0x42')]=_0x174cf9;return _0x129a61;})[_0x59ba('0x23')](respondWithFilteredResult(_0x4e5db2,_0x2284b3))[_0x59ba('0x43')](handleError(_0x4e5db2,null));};exports[_0x59ba('0x44')]=function(_0x2f050a,_0x1a2de0){var _0x24c228={'raw':!![],'where':{'id':_0x2f050a['params']['id']}},_0x5475b7={};_0x5475b7[_0x59ba('0x2f')]=_[_0x59ba('0x31')](db[_0x59ba('0x2a')][_0x59ba('0x2b')]);_0x5475b7['query']=_['keys'](_0x2f050a['query']);_0x5475b7['filters']=_[_0x59ba('0x32')](_0x5475b7[_0x59ba('0x2f')],_0x5475b7['query']);_0x24c228[_0x59ba('0x33')]=_['intersection'](_0x5475b7[_0x59ba('0x2f')],qs[_0x59ba('0x34')](_0x2f050a['query']['fields']));_0x24c228[_0x59ba('0x33')]=_0x24c228[_0x59ba('0x33')][_0x59ba('0x35')]?_0x24c228['attributes']:_0x5475b7[_0x59ba('0x2f')];if(_0x2f050a[_0x59ba('0x30')]['includeAll']){_0x24c228[_0x59ba('0x40')]=[{'all':!![]}];}_0x24c228=_['merge']({},_0x24c228,_0x2f050a[_0x59ba('0x3f')]);return db['SmsQueue']['find'](_0x24c228)[_0x59ba('0x23')](handleEntityNotFound(_0x1a2de0,null))[_0x59ba('0x23')](respondWithResult(_0x1a2de0,null))['catch'](handleError(_0x1a2de0,null));};exports[_0x59ba('0x45')]=function(_0xf80153,_0xc19559){return db['SmsQueue'][_0x59ba('0x45')](_0xf80153['body'],{})['then'](function(_0xc30a50){var _0xf9af58=_0xf80153['user'][_0x59ba('0x24')]({'plain':!![]});if(!_0xf9af58)throw new Error(_0x59ba('0x46'));if(_0xf9af58[_0x59ba('0x47')]===_0x59ba('0x48')){var _0x4e3bb=_0xc30a50[_0x59ba('0x24')]({'plain':!![]});var _0x2bc871=_0x59ba('0x49');return db[_0x59ba('0x4a')][_0x59ba('0x4b')]({'where':{'name':_0x2bc871,'userProfileId':_0xf9af58['userProfileId']},'raw':!![]})[_0x59ba('0x23')](function(_0x58a97f){if(_0x58a97f&&_0x58a97f['autoAssociation']===0x0){return db[_0x59ba('0x25')]['create']({'name':_0x4e3bb[_0x59ba('0x27')],'resourceId':_0x4e3bb['id'],'type':_0x58a97f[_0x59ba('0x27')],'sectionId':_0x58a97f['id']},{})[_0x59ba('0x23')](function(){return _0xc30a50;});}else{return _0xc30a50;}})[_0x59ba('0x43')](function(_0x1173ac){logger[_0x59ba('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1173ac);throw _0x1173ac;});}return _0xc30a50;})[_0x59ba('0x23')](respondWithResult(_0xc19559,0xc9))[_0x59ba('0x43')](handleError(_0xc19559,null));};exports[_0x59ba('0x21')]=function(_0x42f766,_0x369476){if(_0x42f766[_0x59ba('0x4d')]['id']){delete _0x42f766['body']['id'];}return db['SmsQueue'][_0x59ba('0x4b')]({'where':{'id':_0x42f766[_0x59ba('0x4e')]['id']}})['then'](handleEntityNotFound(_0x369476,null))[_0x59ba('0x23')](saveUpdates(_0x42f766[_0x59ba('0x4d')],null))[_0x59ba('0x23')](respondWithResult(_0x369476,null))['catch'](handleError(_0x369476,null));};exports['destroy']=function(_0x3a07fe,_0x5eab91){return db['SmsQueue'][_0x59ba('0x4b')]({'where':{'id':_0x3a07fe[_0x59ba('0x4e')]['id']}})[_0x59ba('0x23')](handleEntityNotFound(_0x5eab91,null))['then'](removeEntity(_0x5eab91,null))[_0x59ba('0x43')](handleError(_0x5eab91,null));};exports['describe']=function(_0x3fa5b0,_0x256ee8){return db[_0x59ba('0x2a')]['describe']()[_0x59ba('0x23')](respondWithResult(_0x256ee8,null))[_0x59ba('0x43')](handleError(_0x256ee8,null));};exports['getMembers']=function(_0x2f0028,_0x3ca343,_0x1e89ae){var _0x36a962={'raw':!![],'where':{}},_0x252d3e={},_0x3ff72d;return db[_0x59ba('0x2a')][_0x59ba('0x4f')]({'where':{'id':_0x2f0028['params']['id']}})[_0x59ba('0x23')](handleEntityNotFound(_0x3ca343,null))[_0x59ba('0x23')](function(_0x5da044){if(_0x5da044){_0x3ff72d=_0x5da044[_0x59ba('0x24')]({'plain':!![]});_0x252d3e[_0x59ba('0x2f')]=_['keys'](db[_0x59ba('0x50')][_0x59ba('0x2b')]);_0x252d3e[_0x59ba('0x30')]=_[_0x59ba('0x31')](_0x2f0028[_0x59ba('0x30')]);_0x252d3e[_0x59ba('0x3a')]=_[_0x59ba('0x32')](_0x252d3e['model'],_0x252d3e['query']);_0x36a962[_0x59ba('0x33')]=_[_0x59ba('0x32')](_0x252d3e[_0x59ba('0x2f')],qs[_0x59ba('0x34')](_0x2f0028[_0x59ba('0x30')][_0x59ba('0x34')]));_0x36a962[_0x59ba('0x33')]=_0x36a962['attributes']['length']?_0x36a962['attributes']:_0x252d3e['model'];if(!_0x2f0028[_0x59ba('0x30')][_0x59ba('0x51')]('nolimit')){_0x36a962[_0x59ba('0x36')]=qs[_0x59ba('0x36')](_0x2f0028[_0x59ba('0x30')]['limit']);_0x36a962[_0x59ba('0x1d')]=qs[_0x59ba('0x1d')](_0x2f0028[_0x59ba('0x30')][_0x59ba('0x1d')]);}_0x36a962['order']=qs[_0x59ba('0x38')](_0x2f0028[_0x59ba('0x30')][_0x59ba('0x38')]);_0x36a962[_0x59ba('0x39')]=qs[_0x59ba('0x3a')](_[_0x59ba('0x3b')](_0x2f0028[_0x59ba('0x30')],_0x252d3e[_0x59ba('0x3a')]));_0x36a962[_0x59ba('0x39')]['SmsQueueId']=_0x5da044['id'];if(_0x2f0028[_0x59ba('0x30')]['filter']){_0x36a962[_0x59ba('0x39')]=_[_0x59ba('0x3d')](_0x36a962[_0x59ba('0x39')],{'$or':_['map'](_0x36a962[_0x59ba('0x33')],function(_0x485092){var _0x137c8a={};_0x137c8a[_0x485092]={'$like':'%'+_0x2f0028['query'][_0x59ba('0x3c')]+'%'};return _0x137c8a;})});}_0x36a962=_[_0x59ba('0x3d')]({},_0x36a962,_0x2f0028[_0x59ba('0x3f')]);return db[_0x59ba('0x50')]['findAll'](_0x36a962);}})['then'](function(_0x4672f5){if(_0x4672f5){return db['User'][_0x59ba('0x52')]({'where':{'id':_['map'](_0x4672f5,_0x59ba('0x53')),'role':'agent'},'attributes':['id',_0x59ba('0x27'),_0x59ba('0x54'),'updatedAt',_0x59ba('0x55')]});}})[_0x59ba('0x23')](function(_0x489574){if(_0x489574){return{'count':_0x489574[_0x59ba('0x1c')],'rows':_['map'](_0x489574[_0x59ba('0x42')],function(_0x50d17e){return{'membername':_0x50d17e[_0x59ba('0x27')],'UserId':_0x50d17e['id'],'queue_name':_0x3ff72d['name'],'SmsQueueId':_0x3ff72d['id'],'interface':util[_0x59ba('0x56')]('%s/%s',_0x59ba('0x57'),_0x50d17e['name']),'penalty':0x0,'paused':_0x50d17e[_0x59ba('0x54')],'createdAt':_0x50d17e[_0x59ba('0x55')],'updatedAt':_0x50d17e[_0x59ba('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3ca343,_0x36a962))[_0x59ba('0x43')](handleError(_0x3ca343,null));};exports[_0x59ba('0x59')]=function(_0x10cde0,_0x3bcd0e,_0x25b733){var _0x36c5cb={};var _0x11877e={};var _0x41b2ef;var _0x4e40cb;return db[_0x59ba('0x2a')]['findOne']({'where':{'id':_0x10cde0[_0x59ba('0x4e')]['id']}})[_0x59ba('0x23')](handleEntityNotFound(_0x3bcd0e,null))[_0x59ba('0x23')](function(_0xa36e85){if(_0xa36e85){_0x41b2ef=_0xa36e85;_0x11877e[_0x59ba('0x2f')]=_['keys'](db['Team'][_0x59ba('0x2b')]);_0x11877e[_0x59ba('0x30')]=_[_0x59ba('0x31')](_0x10cde0['query']);_0x11877e[_0x59ba('0x3a')]=_['intersection'](_0x11877e[_0x59ba('0x2f')],_0x11877e[_0x59ba('0x30')]);_0x36c5cb['attributes']=_['intersection'](_0x11877e[_0x59ba('0x2f')],qs[_0x59ba('0x34')](_0x10cde0[_0x59ba('0x30')][_0x59ba('0x34')]));_0x36c5cb['attributes']=_0x36c5cb['attributes'][_0x59ba('0x35')]?_0x36c5cb[_0x59ba('0x33')]:_0x11877e[_0x59ba('0x2f')];_0x36c5cb[_0x59ba('0x37')]=qs[_0x59ba('0x38')](_0x10cde0['query'][_0x59ba('0x38')]);_0x36c5cb[_0x59ba('0x39')]=qs['filters'](_[_0x59ba('0x3b')](_0x10cde0[_0x59ba('0x30')],_0x11877e[_0x59ba('0x3a')]));if(_0x10cde0[_0x59ba('0x30')]['filter']){_0x36c5cb[_0x59ba('0x39')]=_['merge'](_0x36c5cb[_0x59ba('0x39')],{'$or':_[_0x59ba('0x29')](_0x36c5cb[_0x59ba('0x33')],function(_0x3f86f2){var _0x2f8ab4={};_0x2f8ab4[_0x3f86f2]={'$like':'%'+_0x10cde0['query'][_0x59ba('0x3c')]+'%'};return _0x2f8ab4;})});}_0x36c5cb=_[_0x59ba('0x3d')]({},_0x36c5cb,_0x10cde0[_0x59ba('0x3f')]);return _0x41b2ef['getTeams'](_0x36c5cb);}})[_0x59ba('0x23')](function(_0x294418){if(_0x294418){_0x4e40cb=_0x294418[_0x59ba('0x35')];if(!_0x10cde0[_0x59ba('0x30')][_0x59ba('0x51')](_0x59ba('0x5a'))){_0x36c5cb[_0x59ba('0x36')]=qs[_0x59ba('0x36')](_0x10cde0[_0x59ba('0x30')][_0x59ba('0x36')]);_0x36c5cb[_0x59ba('0x1d')]=qs[_0x59ba('0x1d')](_0x10cde0['query']['offset']);}return _0x41b2ef['getTeams'](_0x36c5cb);}})[_0x59ba('0x23')](function(_0x339b6c){if(_0x339b6c){return _0x339b6c?{'count':_0x4e40cb,'rows':_0x339b6c}:null;}})[_0x59ba('0x23')](respondWithResult(_0x3bcd0e,null))[_0x59ba('0x43')](handleError(_0x3bcd0e,null));};exports[_0x59ba('0x5b')]=function(_0x49cd5c,_0xa0da73,_0x4f5a20){var _0x202e3c=_0x49cd5c[_0x59ba('0x4d')][_0x59ba('0x5c')];return db[_0x59ba('0x5d')][_0x59ba('0x41')]({'where':{'id':_0x202e3c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x59ba('0x5e'),'attributes':['id',_0x59ba('0x27'),'online',_0x59ba('0x5f'),_0x59ba('0x60')],'raw':!![]}]})[_0x59ba('0x23')](function(_0x9afd7){if(_0x9afd7){var _0x45a945=_[_0x59ba('0x61')](_0x9afd7,function(_0x3ea7dd){var _0x1b83a1=_0x3ea7dd[_0x59ba('0x24')]({'plain':!![]});return _0x1b83a1[_0x59ba('0x5e')];});return db[_0x59ba('0x2a')][_0x59ba('0x4b')]({'where':{'id':_0x49cd5c[_0x59ba('0x4e')]['id']}})['then'](function(_0x5262b9){return db[_0x59ba('0x62')]['transaction'](function(_0x4e2751){return _0x5262b9[_0x59ba('0x5b')](_0x202e3c,{'transaction':_0x4e2751})[_0x59ba('0x23')](function(){return BPromise[_0x59ba('0x63')](_0x45a945,function(_0x1c0b8b){return db[_0x59ba('0x50')][_0x59ba('0x64')]({'where':{'UserId':_0x1c0b8b['id'],'SmsQueueId':_0x49cd5c['params']['id']},'transaction':_0x4e2751});});})[_0x59ba('0x23')](function(){_0x45a945[_0x59ba('0x65')](function(_0x79c14b){socket[_0x59ba('0x66')](_0x59ba('0x67'),{'UserId':_0x79c14b['id'],'SmsQueueId':_0x5262b9['id']});});});});});}})[_0x59ba('0x23')](respondWithStatusCode(_0xa0da73,null))['catch'](handleError(_0xa0da73,null));};exports[_0x59ba('0x68')]=function(_0x136313,_0x5b8f0e,_0xcf0235){return db[_0x59ba('0x5d')][_0x59ba('0x41')]({'where':{'id':_0x136313[_0x59ba('0x30')][_0x59ba('0x5c')]},'attributes':['id'],'include':[{'model':db[_0x59ba('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5b8f0e,null))[_0x59ba('0x23')](function(_0x3e8c46){var _0x4b2fcb=_['map'](_0x3e8c46,'id');var _0x327f6b=[];var _0x1fb4ae=[];var _0x8b2c7=squel[_0x59ba('0x6a')]();_0x8b2c7[_0x59ba('0x6b')](_0x59ba('0x6c'))[_0x59ba('0x6d')](_0x59ba('0x6e'),'tq')[_0x59ba('0x6f')]('user_has_teams','ut',_0x59ba('0x70'))[_0x59ba('0x39')](_0x59ba('0x71'),_0x136313[_0x59ba('0x4e')]['id']);for(var _0x2166ac=0x0;_0x2166ac<_0x3e8c46['length'];_0x2166ac+=0x1){let _0xcf0a1=_0x3e8c46[_0x2166ac];for(var _0x3730c7=0x0;_0x3730c7<_0xcf0a1[_0x59ba('0x5e')][_0x59ba('0x35')];_0x3730c7+=0x1){let _0x549230=_0xcf0a1[_0x59ba('0x5e')][_0x3730c7];var _0x19494b=_0x8b2c7[_0x59ba('0x72')]();_0x19494b[_0x59ba('0x39')](_0x59ba('0x73'),_0x549230['id']);_0x1fb4ae[_0x59ba('0x74')](db[_0x59ba('0x62')]['query'](_0x19494b[_0x59ba('0x75')](),{'type':db[_0x59ba('0x62')][_0x59ba('0x76')][_0x59ba('0x77')]})[_0x59ba('0x23')](function(_0x49dcc5){if(_0x49dcc5[_0x59ba('0x35')]===0x1){return _0x549230['id'];}else{var _0x15cd84=_[_0x59ba('0x78')](_[_0x59ba('0x29')](_0x49dcc5,_0x59ba('0x79')),function(_0x57c4a8){return _[_0x59ba('0x7a')](_0x4b2fcb,_0x57c4a8);});if(_0x15cd84){return _0x549230['id'];}}}));}}return BPromise['all'](_0x1fb4ae)[_0x59ba('0x23')](function(_0x8dd95c){_0x327f6b=_(_0x327f6b)['union'](_0x8dd95c)[_0x59ba('0x7b')]()[_0x59ba('0x7c')]();return db[_0x59ba('0x2a')]['find']({'where':{'id':_0x136313['params']['id']}})['then'](function(_0x1f99de){return db[_0x59ba('0x62')][_0x59ba('0x7d')](function(_0x38b9b4){return _0x1f99de[_0x59ba('0x68')](_0x136313['query']['ids'],{'transaction':_0x38b9b4})['then'](function(){if(!_[_0x59ba('0x7e')](_0x327f6b)){return _0x1f99de[_0x59ba('0x7f')](_0x327f6b,{'transaction':_0x38b9b4});}})['then'](function(){_0x327f6b[_0x59ba('0x65')](function(_0x2e10a9){socket[_0x59ba('0x66')](_0x59ba('0x80'),{'UserId':_0x2e10a9,'SmsQueueId':_0x1f99de['id']});});});});});});})[_0x59ba('0x23')](respondWithStatusCode(_0x5b8f0e,null))[_0x59ba('0x43')](handleError(_0x5b8f0e,null));};exports['addAgents']=function(_0x507735,_0x5b9b97,_0x56190d){return db['SmsQueue']['find']({'where':{'id':_0x507735[_0x59ba('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b9b97,null))['then'](function(_0x1dcc72){if(_0x1dcc72){return _0x1dcc72[_0x59ba('0x81')](_0x507735[_0x59ba('0x4d')][_0x59ba('0x5c')],_[_0x59ba('0x82')](_0x507735[_0x59ba('0x4d')],[_0x59ba('0x5c'),'id'])||{})[_0x59ba('0x83')](function(_0xb8fcad){for(var _0x21dd36=0x0;_0x21dd36<_0x507735[_0x59ba('0x4d')][_0x59ba('0x5c')][_0x59ba('0x35')];_0x21dd36+=0x1){socket[_0x59ba('0x66')]('userSmsQueue:save',{'UserId':Number(_0x507735[_0x59ba('0x4d')]['ids'][_0x21dd36]),'SmsQueueId':Number(_0x507735[_0x59ba('0x4e')]['id'])});}return _0xb8fcad;});}})['then'](respondWithResult(_0x5b9b97,null))['catch'](handleError(_0x5b9b97,null));};exports[_0x59ba('0x7f')]=function(_0x5ef84c,_0x3be80b,_0x46b916){return db[_0x59ba('0x2a')][_0x59ba('0x4b')]({'where':{'id':_0x5ef84c[_0x59ba('0x4e')]['id']}})[_0x59ba('0x23')](handleEntityNotFound(_0x3be80b,null))[_0x59ba('0x23')](function(_0x4df934){if(_0x4df934){return _0x4df934[_0x59ba('0x7f')](_0x5ef84c[_0x59ba('0x30')]['ids'])[_0x59ba('0x23')](function(){if(_['isArray'](_0x5ef84c['query'][_0x59ba('0x5c')])){for(var _0x520b2a=0x0;_0x520b2a<_0x5ef84c[_0x59ba('0x30')][_0x59ba('0x5c')]['length'];_0x520b2a+=0x1){socket[_0x59ba('0x66')](_0x59ba('0x80'),{'UserId':Number(_0x5ef84c[_0x59ba('0x30')][_0x59ba('0x5c')][_0x520b2a]),'SmsQueueId':Number(_0x5ef84c[_0x59ba('0x4e')]['id'])});}}else{socket[_0x59ba('0x66')](_0x59ba('0x80'),{'UserId':Number(_0x5ef84c[_0x59ba('0x30')][_0x59ba('0x5c')]),'SmsQueueId':Number(_0x5ef84c[_0x59ba('0x4e')]['id'])});}});}})[_0x59ba('0x23')](respondWithStatusCode(_0x3be80b,null))[_0x59ba('0x43')](handleError(_0x3be80b,null));};exports[_0x59ba('0x84')]=function(_0xebef76,_0x96276b,_0x23a520){var _0xd44710={};var _0x5e7afe={};var _0x3dec7f;var _0x10962d;return db[_0x59ba('0x2a')][_0x59ba('0x4f')]({'where':{'id':_0xebef76['params']['id']}})[_0x59ba('0x23')](handleEntityNotFound(_0x96276b,null))[_0x59ba('0x23')](function(_0x501818){if(_0x501818){_0x3dec7f=_0x501818;_0x5e7afe[_0x59ba('0x2f')]=_[_0x59ba('0x31')](db['User']['rawAttributes']);_0x5e7afe[_0x59ba('0x30')]=_['keys'](_0xebef76['query']);_0x5e7afe['filters']=_[_0x59ba('0x32')](_0x5e7afe[_0x59ba('0x2f')],_0x5e7afe[_0x59ba('0x30')]);_0xd44710['attributes']=_['intersection'](_0x5e7afe[_0x59ba('0x2f')],qs[_0x59ba('0x34')](_0xebef76['query'][_0x59ba('0x34')]));_0xd44710['attributes']=_0xd44710[_0x59ba('0x33')][_0x59ba('0x35')]?_0xd44710[_0x59ba('0x33')]:_0x5e7afe[_0x59ba('0x2f')];_0xd44710['order']=qs['sort'](_0xebef76[_0x59ba('0x30')][_0x59ba('0x38')]);_0xd44710[_0x59ba('0x39')]=qs['filters'](_[_0x59ba('0x3b')](_0xebef76['query'],_0x5e7afe['filters']));if(_0xebef76['query'][_0x59ba('0x3c')]){_0xd44710['where']=_['merge'](_0xd44710['where'],{'$or':_['map'](_0xd44710[_0x59ba('0x33')],function(_0xd46a33){var _0x1a31ce={};_0x1a31ce[_0xd46a33]={'$like':'%'+_0xebef76[_0x59ba('0x30')][_0x59ba('0x3c')]+'%'};return _0x1a31ce;})});}_0xd44710=_['merge']({},_0xd44710,_0xebef76[_0x59ba('0x3f')]);return _0x3dec7f[_0x59ba('0x84')](_0xd44710);}})['then'](function(_0x2020da){if(_0x2020da){_0x10962d=_0x2020da[_0x59ba('0x35')];if(!_0xebef76['query'][_0x59ba('0x51')](_0x59ba('0x5a'))){_0xd44710[_0x59ba('0x36')]=qs[_0x59ba('0x36')](_0xebef76[_0x59ba('0x30')][_0x59ba('0x36')]);_0xd44710[_0x59ba('0x1d')]=qs[_0x59ba('0x1d')](_0xebef76[_0x59ba('0x30')][_0x59ba('0x1d')]);}return _0x3dec7f[_0x59ba('0x84')](_0xd44710);}})[_0x59ba('0x23')](function(_0x2a8ae5){if(_0x2a8ae5){return _0x2a8ae5?{'count':_0x10962d,'rows':_0x2a8ae5}:null;}})[_0x59ba('0x23')](respondWithResult(_0x96276b,null))[_0x59ba('0x43')](handleError(_0x96276b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 1119b80..d70663a 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 _0x3656=['hook','events','../../mysqldb','SmsQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x439ba5,_0x689abc){var _0x59ee86=function(_0x45c695){while(--_0x45c695){_0x439ba5['push'](_0x439ba5['shift']());}};_0x59ee86(++_0x689abc);}(_0x3656,0x133));var _0x6365=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x3656[_0x2be8c2];return _0x97f531;};'use strict';var EventEmitter=require(_0x6365('0x0'));var SmsQueue=require(_0x6365('0x1'))['db'][_0x6365('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6365('0x3')](0x0);var events={'afterCreate':_0x6365('0x4'),'afterUpdate':'update','afterDestroy':_0x6365('0x5')};function emitEvent(_0x2691f8){return function(_0x51f822,_0x29b0d7,_0x57323c){SmsQueueEvents[_0x6365('0x6')](_0x2691f8+':'+_0x51f822['id'],_0x51f822);SmsQueueEvents[_0x6365('0x6')](_0x2691f8,_0x51f822);_0x57323c(null);};}for(var e in events){if(events[_0x6365('0x7')](e)){var event=events[e];SmsQueue[_0x6365('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xc535=['SmsQueue','setMaxListeners','save','update','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4007fa,_0x3974ea){var _0x25f5c7=function(_0x23a411){while(--_0x23a411){_0x4007fa['push'](_0x4007fa['shift']());}};_0x25f5c7(++_0x3974ea);}(_0xc535,0x87));var _0x5c53=function(_0x58d473,_0x3439c6){_0x58d473=_0x58d473-0x0;var _0x300ef6=_0xc535[_0x58d473];return _0x300ef6;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x5c53('0x0'))['db'][_0x5c53('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5c53('0x2')](0x0);var events={'afterCreate':_0x5c53('0x3'),'afterUpdate':_0x5c53('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1670b5){return function(_0x24a29b,_0x58cf60,_0x56dbbe){SmsQueueEvents['emit'](_0x1670b5+':'+_0x24a29b['id'],_0x24a29b);SmsQueueEvents['emit'](_0x1670b5,_0x24a29b);_0x56dbbe(null);};}for(var e in events){if(events[_0x5c53('0x5')](e)){var event=events[e];SmsQueue[_0x5c53('0x6')](e,emitEvent(event));}}module[_0x5c53('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 1c26dfe..0db4990 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 _0x3344=['request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x3344,0x190));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4334('0x0'));var util=require(_0x4334('0x1'));var logger=require(_0x4334('0x2'))(_0x4334('0x3'));var moment=require(_0x4334('0x4'));var BPromise=require(_0x4334('0x5'));var rp=require(_0x4334('0x6'));var fs=require('fs');var path=require(_0x4334('0x7'));var rimraf=require(_0x4334('0x8'));var config=require(_0x4334('0x9'));var attributes=require(_0x4334('0xa'));module[_0x4334('0xb')]=function(_0x1f31b3,_0x32873c){return _0x1f31b3['define'](_0x4334('0xc'),attributes,{'tableName':_0x4334('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3775=['define','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3783a9,_0x375eb5){var _0x4266da=function(_0x3c8ef1){while(--_0x3c8ef1){_0x3783a9['push'](_0x3783a9['shift']());}};_0x4266da(++_0x375eb5);}(_0x3775,0xa7));var _0x5377=function(_0x165219,_0x58afc){_0x165219=_0x165219-0x0;var _0x301202=_0x3775[_0x165219];return _0x301202;};'use strict';var _=require(_0x5377('0x0'));var util=require('util');var logger=require(_0x5377('0x1'))(_0x5377('0x2'));var moment=require(_0x5377('0x3'));var BPromise=require(_0x5377('0x4'));var rp=require(_0x5377('0x5'));var fs=require('fs');var path=require(_0x5377('0x6'));var rimraf=require(_0x5377('0x7'));var config=require(_0x5377('0x8'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x254ae7,_0x3d222d){return _0x254ae7[_0x5377('0x9')]('SmsQueue',attributes,{'tableName':_0x5377('0xa'),'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 d72af3c..20e2ad4 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 _0x1430=['catch','GetSmsQueue','SmsQueue','options','where','attributes','limit','include','model','map','then','stringify','ShowSmsQueue','find','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x482a85,_0x2cb8ca){var _0x5ececb=function(_0x4c203a){while(--_0x4c203a){_0x482a85['push'](_0x482a85['shift']());}};_0x5ececb(++_0x2cb8ca);}(_0x1430,0x120));var _0x0143=function(_0x217751,_0x5a0349){_0x217751=_0x217751-0x0;var _0x66446b=_0x1430[_0x217751];return _0x66446b;};'use strict';var _=require(_0x0143('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0143('0x1'));var rs=require(_0x0143('0x2'));var fs=require('fs');var Redis=require(_0x0143('0x3'));var db=require(_0x0143('0x4'))['db'];var utils=require(_0x0143('0x5'));var logger=require(_0x0143('0x6'))('rpc');var config=require(_0x0143('0x7'));var jayson=require(_0x0143('0x8'));var client=jayson[_0x0143('0x9')][_0x0143('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0143('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0143('0xc'))(new Redis(config[_0x0143('0xb')]));require(_0x0143('0xd'))[_0x0143('0xe')](socket);function respondWithRpcPromise(_0x12b6fd,_0x326948,_0x5791e3){return new BPromise(function(_0x14c928,_0x2d8a52){return client[_0x0143('0xf')](_0x12b6fd,_0x5791e3)['then'](function(_0x5b54e3){logger['info'](_0x0143('0x10'),_0x326948,_0x0143('0x11'));logger[_0x0143('0x12')](_0x0143('0x13'),_0x326948,_0x0143('0x11'),JSON['stringify'](_0x5b54e3));if(_0x5b54e3[_0x0143('0x14')]){if(_0x5b54e3[_0x0143('0x14')][_0x0143('0x15')]===0x1f4){logger[_0x0143('0x14')](_0x0143('0x10'),_0x326948,_0x5b54e3['error'][_0x0143('0x16')]);return _0x2d8a52(_0x5b54e3['error'][_0x0143('0x16')]);}logger[_0x0143('0x14')]('SmsQueue,\x20%s,\x20%s',_0x326948,_0x5b54e3['error'][_0x0143('0x16')]);return _0x14c928(_0x5b54e3['error'][_0x0143('0x16')]);}else{logger[_0x0143('0x17')](_0x0143('0x10'),_0x326948,'request\x20sent');_0x14c928(_0x5b54e3['result']['message']);}})[_0x0143('0x18')](function(_0x185454){logger['error'](_0x0143('0x10'),_0x326948,_0x185454);_0x2d8a52(_0x185454);});});}exports[_0x0143('0x19')]=function(_0x55c14d){var _0x4e4772=this;return new Promise(function(_0x56adc0,_0x902dd3){return db[_0x0143('0x1a')]['findAll']({'raw':_0x55c14d[_0x0143('0x1b')]?_0x55c14d[_0x0143('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x55c14d[_0x0143('0x1b')]?_0x55c14d[_0x0143('0x1b')][_0x0143('0x1c')]||null:null,'attributes':_0x55c14d[_0x0143('0x1b')]?_0x55c14d['options'][_0x0143('0x1d')]||null:null,'limit':_0x55c14d[_0x0143('0x1b')]?_0x55c14d[_0x0143('0x1b')][_0x0143('0x1e')]||null:null,'include':_0x55c14d[_0x0143('0x1b')]?_0x55c14d[_0x0143('0x1b')][_0x0143('0x1f')]?_['map'](_0x55c14d[_0x0143('0x1b')][_0x0143('0x1f')],function(_0x48b1ce){return{'model':db[_0x48b1ce[_0x0143('0x20')]],'as':_0x48b1ce['as'],'attributes':_0x48b1ce[_0x0143('0x1d')],'include':_0x48b1ce[_0x0143('0x1f')]?_[_0x0143('0x21')](_0x48b1ce['include'],function(_0x3d8542){return{'model':db[_0x3d8542[_0x0143('0x20')]],'as':_0x3d8542['as'],'attributes':_0x3d8542[_0x0143('0x1d')],'include':_0x3d8542['include']?_['map'](_0x3d8542[_0x0143('0x1f')],function(_0x44cd66){return{'model':db[_0x44cd66[_0x0143('0x20')]],'as':_0x44cd66['as'],'attributes':_0x44cd66['attributes']};}):[]};}):[]};}):[]:[]})[_0x0143('0x22')](function(_0x247318){logger[_0x0143('0x17')]('GetSmsQueue',_0x55c14d);logger['debug'](_0x0143('0x19'),_0x55c14d,JSON[_0x0143('0x23')](_0x247318));_0x56adc0(_0x247318);})[_0x0143('0x18')](function(_0x3d83d5){logger[_0x0143('0x14')](_0x0143('0x19'),_0x3d83d5[_0x0143('0x16')],_0x55c14d);_0x902dd3(_0x4e4772[_0x0143('0x14')](0x1f4,_0x3d83d5['message']));});});};exports[_0x0143('0x24')]=function(_0x1171e4){var _0x36f779=this;return new Promise(function(_0x23fe0d,_0x1045dd){return db[_0x0143('0x1a')][_0x0143('0x25')]({'raw':_0x1171e4[_0x0143('0x1b')]?_0x1171e4['options'][_0x0143('0x26')]===undefined?!![]:![]:!![],'where':_0x1171e4['options']?_0x1171e4[_0x0143('0x1b')][_0x0143('0x1c')]||null:null,'attributes':_0x1171e4[_0x0143('0x1b')]?_0x1171e4['options'][_0x0143('0x1d')]||null:null,'include':_0x1171e4[_0x0143('0x1b')]?_0x1171e4['options'][_0x0143('0x1f')]?_[_0x0143('0x21')](_0x1171e4['options'][_0x0143('0x1f')],function(_0x10a5ee){return{'model':db[_0x10a5ee['model']],'as':_0x10a5ee['as'],'attributes':_0x10a5ee[_0x0143('0x1d')],'include':_0x10a5ee[_0x0143('0x1f')]?_[_0x0143('0x21')](_0x10a5ee[_0x0143('0x1f')],function(_0x158efc){return{'model':db[_0x158efc[_0x0143('0x20')]],'as':_0x158efc['as'],'attributes':_0x158efc[_0x0143('0x1d')],'include':_0x158efc['include']?_[_0x0143('0x21')](_0x158efc[_0x0143('0x1f')],function(_0x56b570){return{'model':db[_0x56b570[_0x0143('0x20')]],'as':_0x56b570['as'],'attributes':_0x56b570[_0x0143('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e6b83){logger['info']('ShowSmsQueue',_0x1171e4);logger[_0x0143('0x12')](_0x0143('0x24'),_0x1171e4,JSON[_0x0143('0x23')](_0x4e6b83));_0x23fe0d(_0x4e6b83);})['catch'](function(_0x39277e){logger[_0x0143('0x14')]('ShowSmsQueue',_0x39277e[_0x0143('0x16')],_0x1171e4);_0x1045dd(_0x36f779[_0x0143('0x14')](0x1f4,_0x39277e['message']));});});}; \ No newline at end of file +var _0xd82f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','findAll','raw','options','where','limit','map','attributes','include','model','ShowSmsQueue','SmsQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4836a1,_0x58ca74){var _0x553f8d=function(_0x1483be){while(--_0x1483be){_0x4836a1['push'](_0x4836a1['shift']());}};_0x553f8d(++_0x58ca74);}(_0xd82f,0x7b));var _0xfd82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd82f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xfd82('0x0'));var util=require(_0xfd82('0x1'));var moment=require(_0xfd82('0x2'));var BPromise=require(_0xfd82('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd82('0x4'));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(_0xfd82('0xa'));var client=jayson[_0xfd82('0xb')][_0xfd82('0xc')]({'port':0x232a});config[_0xfd82('0xd')]=_[_0xfd82('0xe')](config[_0xfd82('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd82('0xf'))(new Redis(config[_0xfd82('0xd')]));require('./smsQueue.socket')[_0xfd82('0x10')](socket);function respondWithRpcPromise(_0x572ae6,_0x26df46,_0x18bdae){return new BPromise(function(_0x31bcb1,_0x25e112){return client[_0xfd82('0x11')](_0x572ae6,_0x18bdae)[_0xfd82('0x12')](function(_0x536557){logger[_0xfd82('0x13')]('SmsQueue,\x20%s,\x20%s',_0x26df46,'request\x20sent');logger[_0xfd82('0x14')](_0xfd82('0x15'),_0x26df46,_0xfd82('0x16'),JSON[_0xfd82('0x17')](_0x536557));if(_0x536557[_0xfd82('0x18')]){if(_0x536557['error'][_0xfd82('0x19')]===0x1f4){logger['error'](_0xfd82('0x1a'),_0x26df46,_0x536557['error'][_0xfd82('0x1b')]);return _0x25e112(_0x536557['error'][_0xfd82('0x1b')]);}logger[_0xfd82('0x18')](_0xfd82('0x1a'),_0x26df46,_0x536557[_0xfd82('0x18')][_0xfd82('0x1b')]);return _0x31bcb1(_0x536557[_0xfd82('0x18')][_0xfd82('0x1b')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x26df46,_0xfd82('0x16'));_0x31bcb1(_0x536557[_0xfd82('0x1c')][_0xfd82('0x1b')]);}})[_0xfd82('0x1d')](function(_0x3692c2){logger[_0xfd82('0x18')]('SmsQueue,\x20%s,\x20%s',_0x26df46,_0x3692c2);_0x25e112(_0x3692c2);});});}exports[_0xfd82('0x1e')]=function(_0x3e02ca){var _0x1f9839=this;return new Promise(function(_0x24ff21,_0x4994c9){return db['SmsQueue'][_0xfd82('0x1f')]({'raw':_0x3e02ca['options']?_0x3e02ca['options'][_0xfd82('0x20')]===undefined?!![]:![]:!![],'where':_0x3e02ca[_0xfd82('0x21')]?_0x3e02ca['options'][_0xfd82('0x22')]||null:null,'attributes':_0x3e02ca[_0xfd82('0x21')]?_0x3e02ca['options']['attributes']||null:null,'limit':_0x3e02ca['options']?_0x3e02ca[_0xfd82('0x21')][_0xfd82('0x23')]||null:null,'include':_0x3e02ca[_0xfd82('0x21')]?_0x3e02ca[_0xfd82('0x21')]['include']?_[_0xfd82('0x24')](_0x3e02ca[_0xfd82('0x21')]['include'],function(_0x3d73ba){return{'model':db[_0x3d73ba['model']],'as':_0x3d73ba['as'],'attributes':_0x3d73ba[_0xfd82('0x25')],'include':_0x3d73ba[_0xfd82('0x26')]?_[_0xfd82('0x24')](_0x3d73ba[_0xfd82('0x26')],function(_0x825c26){return{'model':db[_0x825c26[_0xfd82('0x27')]],'as':_0x825c26['as'],'attributes':_0x825c26[_0xfd82('0x25')],'include':_0x825c26[_0xfd82('0x26')]?_[_0xfd82('0x24')](_0x825c26['include'],function(_0xd377b5){return{'model':db[_0xd377b5[_0xfd82('0x27')]],'as':_0xd377b5['as'],'attributes':_0xd377b5[_0xfd82('0x25')]};}):[]};}):[]};}):[]:[]})[_0xfd82('0x12')](function(_0xd4cd44){logger[_0xfd82('0x13')]('GetSmsQueue',_0x3e02ca);logger[_0xfd82('0x14')](_0xfd82('0x1e'),_0x3e02ca,JSON[_0xfd82('0x17')](_0xd4cd44));_0x24ff21(_0xd4cd44);})['catch'](function(_0x559601){logger['error'](_0xfd82('0x1e'),_0x559601[_0xfd82('0x1b')],_0x3e02ca);_0x4994c9(_0x1f9839['error'](0x1f4,_0x559601[_0xfd82('0x1b')]));});});};exports[_0xfd82('0x28')]=function(_0x483b63){var _0x5d4c21=this;return new Promise(function(_0x4fade9,_0x598521){return db[_0xfd82('0x29')][_0xfd82('0x2a')]({'raw':_0x483b63[_0xfd82('0x21')]?_0x483b63[_0xfd82('0x21')][_0xfd82('0x20')]===undefined?!![]:![]:!![],'where':_0x483b63[_0xfd82('0x21')]?_0x483b63[_0xfd82('0x21')][_0xfd82('0x22')]||null:null,'attributes':_0x483b63['options']?_0x483b63['options'][_0xfd82('0x25')]||null:null,'include':_0x483b63[_0xfd82('0x21')]?_0x483b63['options'][_0xfd82('0x26')]?_['map'](_0x483b63['options'][_0xfd82('0x26')],function(_0x5d21b2){return{'model':db[_0x5d21b2['model']],'as':_0x5d21b2['as'],'attributes':_0x5d21b2[_0xfd82('0x25')],'include':_0x5d21b2[_0xfd82('0x26')]?_[_0xfd82('0x24')](_0x5d21b2[_0xfd82('0x26')],function(_0x289dad){return{'model':db[_0x289dad['model']],'as':_0x289dad['as'],'attributes':_0x289dad[_0xfd82('0x25')],'include':_0x289dad['include']?_['map'](_0x289dad['include'],function(_0x516966){return{'model':db[_0x516966[_0xfd82('0x27')]],'as':_0x516966['as'],'attributes':_0x516966[_0xfd82('0x25')]};}):[]};}):[]};}):[]:[]})[_0xfd82('0x12')](function(_0x4520aa){logger[_0xfd82('0x13')](_0xfd82('0x28'),_0x483b63);logger[_0xfd82('0x14')](_0xfd82('0x28'),_0x483b63,JSON[_0xfd82('0x17')](_0x4520aa));_0x4fade9(_0x4520aa);})['catch'](function(_0x28d351){logger[_0xfd82('0x18')]('ShowSmsQueue',_0x28d351[_0xfd82('0x1b')],_0x483b63);_0x598521(_0x5d4c21[_0xfd82('0x18')](0x1f4,_0x28d351[_0xfd82('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 73f849b..6f06db7 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 _0xebfa=['remove','removeListener','register','length','./smsQueue.events'];(function(_0x30ddd6,_0x1e3c7b){var _0x3ba7c7=function(_0x312e55){while(--_0x312e55){_0x30ddd6['push'](_0x30ddd6['shift']());}};_0x3ba7c7(++_0x1e3c7b);}(_0xebfa,0x121));var _0xaebf=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xebfa[_0x266618];return _0x54dbf5;};'use strict';var SmsQueueEvents=require(_0xaebf('0x0'));var events=['save',_0xaebf('0x1'),'update'];function createListener(_0x5b0f61,_0x3fa08b){return function(_0x1787fd){_0x3fa08b['emit'](_0x5b0f61,_0x1787fd);};}function removeListener(_0x4a68d3,_0xac4c4b){return function(){SmsQueueEvents[_0xaebf('0x2')](_0x4a68d3,_0xac4c4b);};}exports[_0xaebf('0x3')]=function(_0xdf89d3){for(var _0x278002=0x0,_0x2aefd4=events[_0xaebf('0x4')];_0x278002<_0x2aefd4;_0x278002++){var _0xb03f4b=events[_0x278002];var _0x571f6f=createListener('smsQueue:'+_0xb03f4b,_0xdf89d3);SmsQueueEvents['on'](_0xb03f4b,_0x571f6f);}}; \ No newline at end of file +var _0x9bac=['remove','update','emit','removeListener','length','smsQueue:','./smsQueue.events','save'];(function(_0x4251d7,_0x2a6154){var _0x102c65=function(_0x2bb273){while(--_0x2bb273){_0x4251d7['push'](_0x4251d7['shift']());}};_0x102c65(++_0x2a6154);}(_0x9bac,0xbe));var _0xc9ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9bac[_0x14add3];return _0x4a174f;};'use strict';var SmsQueueEvents=require(_0xc9ba('0x0'));var events=[_0xc9ba('0x1'),_0xc9ba('0x2'),_0xc9ba('0x3')];function createListener(_0x6ebdad,_0x35a299){return function(_0x4f91f1){_0x35a299[_0xc9ba('0x4')](_0x6ebdad,_0x4f91f1);};}function removeListener(_0x4becae,_0x15ab36){return function(){SmsQueueEvents[_0xc9ba('0x5')](_0x4becae,_0x15ab36);};}exports['register']=function(_0x4434d0){for(var _0x55da98=0x0,_0x56d875=events[_0xc9ba('0x6')];_0x55da98<_0x56d875;_0x55da98++){var _0x49c34e=events[_0x55da98];var _0x3cbda9=createListener(_0xc9ba('0x7')+_0x49c34e,_0x4434d0);SmsQueueEvents['on'](_0x49c34e,_0x3cbda9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index a84f941..32ed7b2 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 _0xa969=['isAuthenticated','index','get','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa969,0x114));var _0x9a96=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xa969[_0x35b18a];return _0x4db1bd;};'use strict';var multer=require(_0x9a96('0x0'));var util=require(_0x9a96('0x1'));var path=require(_0x9a96('0x2'));var timeout=require(_0x9a96('0x3'));var express=require(_0x9a96('0x4'));var router=express[_0x9a96('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9a96('0x6'));var interaction=require(_0x9a96('0x7'));var config=require(_0x9a96('0x8'));var controller=require(_0x9a96('0x9'));router['get']('/',auth[_0x9a96('0xa')](),controller[_0x9a96('0xb')]);router[_0x9a96('0xc')](_0x9a96('0xd'),auth[_0x9a96('0xa')](),controller[_0x9a96('0xe')]);router[_0x9a96('0xc')](_0x9a96('0xf'),auth[_0x9a96('0xa')](),controller['show']);router[_0x9a96('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9a96('0x11')](_0x9a96('0xf'),auth[_0x9a96('0xa')](),controller[_0x9a96('0x12')]);router[_0x9a96('0x13')](_0x9a96('0xf'),auth['isAuthenticated'](),controller[_0x9a96('0x14')]);module[_0x9a96('0x15')]=router; \ No newline at end of file +var _0xd1c3=['express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x513ee4,_0x4c131b){var _0x28fe71=function(_0x52e64a){while(--_0x52e64a){_0x513ee4['push'](_0x513ee4['shift']());}};_0x28fe71(++_0x4c131b);}(_0xd1c3,0x11d));var _0x3d1c=function(_0x392d29,_0x4fc620){_0x392d29=_0x392d29-0x0;var _0x57876a=_0xd1c3[_0x392d29];return _0x57876a;};'use strict';var multer=require(_0x3d1c('0x0'));var util=require(_0x3d1c('0x1'));var path=require(_0x3d1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d1c('0x3'));var router=express[_0x3d1c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3d1c('0x5'));var config=require(_0x3d1c('0x6'));var controller=require(_0x3d1c('0x7'));router[_0x3d1c('0x8')]('/',auth[_0x3d1c('0x9')](),controller['index']);router[_0x3d1c('0x8')](_0x3d1c('0xa'),auth[_0x3d1c('0x9')](),controller['describe']);router[_0x3d1c('0x8')](_0x3d1c('0xb'),auth[_0x3d1c('0x9')](),controller[_0x3d1c('0xc')]);router[_0x3d1c('0xd')]('/',auth[_0x3d1c('0x9')](),controller[_0x3d1c('0xe')]);router['put'](_0x3d1c('0xb'),auth[_0x3d1c('0x9')](),controller[_0x3d1c('0xf')]);router[_0x3d1c('0x10')](_0x3d1c('0xb'),auth[_0x3d1c('0x9')](),controller[_0x3d1c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c1039a9..e24d3ea 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 _0x28d1=['DATE','moment','sequelize','exports','STRING'];(function(_0xee4200,_0x816075){var _0x226399=function(_0x5d51fa){while(--_0x5d51fa){_0xee4200['push'](_0xee4200['shift']());}};_0x226399(++_0x816075);}(_0x28d1,0x1d2));var _0x128d=function(_0x3dfaa3,_0xbdb7eb){_0x3dfaa3=_0x3dfaa3-0x0;var _0x4f4078=_0x28d1[_0x3dfaa3];return _0x4f4078;};'use strict';var moment=require(_0x128d('0x0'));var Sequelize=require(_0x128d('0x1'));module[_0x128d('0x2')]={'uniqueid':{'type':Sequelize[_0x128d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x128d('0x3')]},'joinAt':{'type':Sequelize[_0x128d('0x4')]},'leaveAt':{'type':Sequelize[_0x128d('0x4')]},'acceptAt':{'type':Sequelize[_0x128d('0x4')]},'exitAt':{'type':Sequelize[_0x128d('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3123=['sequelize','STRING','DATE','moment'];(function(_0x17ad45,_0x4b040d){var _0x202c43=function(_0x10c851){while(--_0x10c851){_0x17ad45['push'](_0x17ad45['shift']());}};_0x202c43(++_0x4b040d);}(_0x3123,0x1f3));var _0x3312=function(_0x4e5262,_0x321203){_0x4e5262=_0x4e5262-0x0;var _0x2a8411=_0x3123[_0x4e5262];return _0x2a8411;};'use strict';var moment=require(_0x3312('0x0'));var Sequelize=require(_0x3312('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3312('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3312('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3312('0x3')]},'acceptAt':{'type':Sequelize[_0x3312('0x3')]},'exitAt':{'type':Sequelize[_0x3312('0x3')]},'reason':{'type':Sequelize[_0x3312('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 71a91a5..cb37882 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 _0xef7f=['body','describe','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','options','include','SmsQueueReport','findAll','rows','catch','show','params','length','includeAll','find','create'];(function(_0x4d187c,_0x5b5995){var _0x1d266e=function(_0x5785f0){while(--_0x5785f0){_0x4d187c['push'](_0x4d187c['shift']());}};_0x1d266e(++_0x5b5995);}(_0xef7f,0x179));var _0xfef7=function(_0x96f03d,_0x3c73c2){_0x96f03d=_0x96f03d-0x0;var _0x48e81e=_0xef7f[_0x96f03d];return _0x48e81e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfef7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfef7('0x1'));var rp=require(_0xfef7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfef7('0x3'));var util=require(_0xfef7('0x4'));var path=require('path');var sox=require(_0xfef7('0x5'));var csv=require(_0xfef7('0x6'));var ejs=require(_0xfef7('0x7'));var fs=require('fs');var fs_extra=require(_0xfef7('0x8'));var _=require(_0xfef7('0x9'));var squel=require('squel');var crypto=require(_0xfef7('0xa'));var jsforce=require(_0xfef7('0xb'));var deskjs=require(_0xfef7('0xc'));var toCsv=require(_0xfef7('0x6'));var querystring=require(_0xfef7('0xd'));var Papa=require(_0xfef7('0xe'));var Redis=require(_0xfef7('0xf'));var authService=require(_0xfef7('0x10'));var qs=require(_0xfef7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfef7('0x12'));var logger=require(_0xfef7('0x13'))('api');var utils=require(_0xfef7('0x14'));var config=require(_0xfef7('0x15'));var licenseUtil=require(_0xfef7('0x16'));var db=require(_0xfef7('0x17'))['db'];function respondWithStatusCode(_0x1fd26c,_0x4eb4e8){_0x4eb4e8=_0x4eb4e8||0xcc;return function(_0x2d6c2e){if(_0x2d6c2e){return _0x1fd26c[_0xfef7('0x18')](_0x4eb4e8);}return _0x1fd26c[_0xfef7('0x19')](_0x4eb4e8)[_0xfef7('0x1a')]();};}function respondWithResult(_0x406609,_0x3ab13e){_0x3ab13e=_0x3ab13e||0xc8;return function(_0x35d87c){if(_0x35d87c){return _0x406609[_0xfef7('0x19')](_0x3ab13e)['json'](_0x35d87c);}};}function respondWithFilteredResult(_0x8bda7b,_0x10d5ef){return function(_0x3788b4){if(_0x3788b4){var _0x4f237c=typeof _0x10d5ef[_0xfef7('0x1b')]===_0xfef7('0x1c')&&typeof _0x10d5ef[_0xfef7('0x1d')]===_0xfef7('0x1c');var _0x496713=_0x3788b4[_0xfef7('0x1e')];var _0x4ee2e5=_0x4f237c?0x0:_0x10d5ef[_0xfef7('0x1b')];var _0x44f090=_0x4f237c?_0x3788b4['count']:_0x10d5ef['offset']+_0x10d5ef['limit'];var _0x418050;if(_0x44f090>=_0x496713){_0x44f090=_0x496713;_0x418050=0xc8;}else{_0x418050=0xce;}_0x8bda7b[_0xfef7('0x19')](_0x418050);return _0x8bda7b[_0xfef7('0x1f')](_0xfef7('0x20'),_0x4ee2e5+'-'+_0x44f090+'/'+_0x496713)['json'](_0x3788b4);}return null;};}function patchUpdates(_0x178a90){return function(_0x140d92){try{jsonpatch[_0xfef7('0x21')](_0x140d92,_0x178a90,!![]);}catch(_0x595cc7){return BPromise['reject'](_0x595cc7);}return _0x140d92[_0xfef7('0x22')]();};}function saveUpdates(_0x5aa4ca,_0x544c60){return function(_0x4fbe08){if(_0x4fbe08){return _0x4fbe08[_0xfef7('0x23')](_0x5aa4ca)[_0xfef7('0x24')](function(_0x28cc8b){return _0x28cc8b;});}return null;};}function removeEntity(_0x4251d8,_0x4426c7){return function(_0x14371e){if(_0x14371e){return _0x14371e[_0xfef7('0x25')]()[_0xfef7('0x24')](function(){_0x4251d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x394979,_0x16087a){return function(_0x40ac29){if(!_0x40ac29){_0x394979[_0xfef7('0x18')](0x194);}return _0x40ac29;};}function handleError(_0x525223,_0x342a8d){_0x342a8d=_0x342a8d||0x1f4;return function(_0x5122ee){logger[_0xfef7('0x26')](_0x5122ee[_0xfef7('0x27')]);if(_0x5122ee['name']){delete _0x5122ee[_0xfef7('0x28')];}_0x525223['status'](_0x342a8d)[_0xfef7('0x29')](_0x5122ee);};}exports[_0xfef7('0x2a')]=function(_0x44f1f4,_0x5baeea){var _0x2ce9a9={},_0x1835b3={},_0x41d05e={'count':0x0,'rows':[]};var _0x356354=_['map'](db['SmsQueueReport'][_0xfef7('0x2b')],function(_0x213c41){return{'name':_0x213c41[_0xfef7('0x2c')],'type':_0x213c41[_0xfef7('0x2d')][_0xfef7('0x2e')]};});_0x1835b3['model']=_['map'](_0x356354,'name');_0x1835b3[_0xfef7('0x2f')]=_[_0xfef7('0x30')](_0x44f1f4[_0xfef7('0x2f')]);_0x1835b3['filters']=_[_0xfef7('0x31')](_0x1835b3[_0xfef7('0x32')],_0x1835b3[_0xfef7('0x2f')]);_0x2ce9a9[_0xfef7('0x33')]=_['intersection'](_0x1835b3[_0xfef7('0x32')],qs[_0xfef7('0x34')](_0x44f1f4[_0xfef7('0x2f')]['fields']));_0x2ce9a9[_0xfef7('0x33')]=_0x2ce9a9['attributes']['length']?_0x2ce9a9[_0xfef7('0x33')]:_0x1835b3[_0xfef7('0x32')];if(!_0x44f1f4[_0xfef7('0x2f')][_0xfef7('0x35')]('nolimit')){_0x2ce9a9[_0xfef7('0x1d')]=qs[_0xfef7('0x1d')](_0x44f1f4['query'][_0xfef7('0x1d')]);_0x2ce9a9['offset']=qs['offset'](_0x44f1f4[_0xfef7('0x2f')]['offset']);}_0x2ce9a9[_0xfef7('0x36')]=qs[_0xfef7('0x37')](_0x44f1f4[_0xfef7('0x2f')][_0xfef7('0x37')]);_0x2ce9a9[_0xfef7('0x38')]=qs[_0xfef7('0x39')](_[_0xfef7('0x3a')](_0x44f1f4['query'],_0x1835b3[_0xfef7('0x39')]),_0x356354);if(_0x44f1f4[_0xfef7('0x2f')]['filter']){_0x2ce9a9[_0xfef7('0x38')]=_['merge'](_0x2ce9a9[_0xfef7('0x38')],{'$or':_['map'](_0x356354,function(_0x2fb787){if(_0x2fb787[_0xfef7('0x2d')]!==_0xfef7('0x3b')){var _0x3fc2de={};_0x3fc2de[_0x2fb787[_0xfef7('0x28')]]={'$like':'%'+_0x44f1f4[_0xfef7('0x2f')][_0xfef7('0x3c')]+'%'};return _0x3fc2de;}})});}_0x2ce9a9=_['merge']({},_0x2ce9a9,_0x44f1f4[_0xfef7('0x3d')]);var _0x33c62b={'where':_0x2ce9a9[_0xfef7('0x38')]};return db['SmsQueueReport'][_0xfef7('0x1e')](_0x33c62b)[_0xfef7('0x24')](function(_0x1d4d73){_0x41d05e['count']=_0x1d4d73;if(_0x44f1f4[_0xfef7('0x2f')]['includeAll']){_0x2ce9a9[_0xfef7('0x3e')]=[{'all':!![]}];}return db[_0xfef7('0x3f')][_0xfef7('0x40')](_0x2ce9a9);})[_0xfef7('0x24')](function(_0x33ebc4){_0x41d05e[_0xfef7('0x41')]=_0x33ebc4;return _0x41d05e;})[_0xfef7('0x24')](respondWithFilteredResult(_0x5baeea,_0x2ce9a9))[_0xfef7('0x42')](handleError(_0x5baeea,null));};exports[_0xfef7('0x43')]=function(_0xa140e6,_0x3a330f){var _0x5c14c1={'raw':!![],'where':{'id':_0xa140e6[_0xfef7('0x44')]['id']}},_0x4048f7={};_0x4048f7[_0xfef7('0x32')]=_[_0xfef7('0x30')](db[_0xfef7('0x3f')][_0xfef7('0x2b')]);_0x4048f7[_0xfef7('0x2f')]=_[_0xfef7('0x30')](_0xa140e6[_0xfef7('0x2f')]);_0x4048f7[_0xfef7('0x39')]=_[_0xfef7('0x31')](_0x4048f7[_0xfef7('0x32')],_0x4048f7[_0xfef7('0x2f')]);_0x5c14c1[_0xfef7('0x33')]=_[_0xfef7('0x31')](_0x4048f7['model'],qs[_0xfef7('0x34')](_0xa140e6[_0xfef7('0x2f')][_0xfef7('0x34')]));_0x5c14c1[_0xfef7('0x33')]=_0x5c14c1[_0xfef7('0x33')][_0xfef7('0x45')]?_0x5c14c1[_0xfef7('0x33')]:_0x4048f7[_0xfef7('0x32')];if(_0xa140e6[_0xfef7('0x2f')][_0xfef7('0x46')]){_0x5c14c1[_0xfef7('0x3e')]=[{'all':!![]}];}_0x5c14c1=_['merge']({},_0x5c14c1,_0xa140e6[_0xfef7('0x3d')]);return db[_0xfef7('0x3f')][_0xfef7('0x47')](_0x5c14c1)[_0xfef7('0x24')](handleEntityNotFound(_0x3a330f,null))[_0xfef7('0x24')](respondWithResult(_0x3a330f,null))[_0xfef7('0x42')](handleError(_0x3a330f,null));};exports[_0xfef7('0x48')]=function(_0x231930,_0x58df70){return db[_0xfef7('0x3f')][_0xfef7('0x48')](_0x231930[_0xfef7('0x49')],{})[_0xfef7('0x24')](respondWithResult(_0x58df70,0xc9))[_0xfef7('0x42')](handleError(_0x58df70,null));};exports[_0xfef7('0x23')]=function(_0x28a980,_0x54423a){if(_0x28a980[_0xfef7('0x49')]['id']){delete _0x28a980[_0xfef7('0x49')]['id'];}return db[_0xfef7('0x3f')][_0xfef7('0x47')]({'where':{'id':_0x28a980[_0xfef7('0x44')]['id']}})[_0xfef7('0x24')](handleEntityNotFound(_0x54423a,null))[_0xfef7('0x24')](saveUpdates(_0x28a980[_0xfef7('0x49')],null))[_0xfef7('0x24')](respondWithResult(_0x54423a,null))[_0xfef7('0x42')](handleError(_0x54423a,null));};exports[_0xfef7('0x25')]=function(_0x438e72,_0x4f8e2c){return db['SmsQueueReport'][_0xfef7('0x47')]({'where':{'id':_0x438e72[_0xfef7('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f8e2c,null))[_0xfef7('0x24')](removeEntity(_0x4f8e2c,null))[_0xfef7('0x42')](handleError(_0x4f8e2c,null));};exports[_0xfef7('0x4a')]=function(_0x45a6ee,_0x21b660){return db[_0xfef7('0x3f')][_0xfef7('0x4a')]()[_0xfef7('0x24')](respondWithResult(_0x21b660,null))[_0xfef7('0x42')](handleError(_0x21b660,null));}; \ No newline at end of file +var _0xab1e=['../../mysqldb','end','status','offset','undefined','limit','count','set','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1ab2ae,_0x1218e7){var _0x1ef352=function(_0x66def9){while(--_0x66def9){_0x1ab2ae['push'](_0x1ab2ae['shift']());}};_0x1ef352(++_0x1218e7);}(_0xab1e,0x164));var _0xeab1=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xab1e[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0xeab1('0x0'));var rimraf=require(_0xeab1('0x1'));var zipdir=require(_0xeab1('0x2'));var jsonpatch=require(_0xeab1('0x3'));var rp=require(_0xeab1('0x4'));var moment=require('moment');var BPromise=require(_0xeab1('0x5'));var Mustache=require(_0xeab1('0x6'));var util=require(_0xeab1('0x7'));var path=require(_0xeab1('0x8'));var sox=require(_0xeab1('0x9'));var csv=require(_0xeab1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeab1('0xb'));var _=require(_0xeab1('0xc'));var squel=require(_0xeab1('0xd'));var crypto=require(_0xeab1('0xe'));var jsforce=require(_0xeab1('0xf'));var deskjs=require(_0xeab1('0x10'));var toCsv=require(_0xeab1('0xa'));var querystring=require(_0xeab1('0x11'));var Papa=require(_0xeab1('0x12'));var Redis=require(_0xeab1('0x13'));var authService=require(_0xeab1('0x14'));var qs=require(_0xeab1('0x15'));var as=require(_0xeab1('0x16'));var hardwareService=require(_0xeab1('0x17'));var logger=require(_0xeab1('0x18'))(_0xeab1('0x19'));var utils=require(_0xeab1('0x1a'));var config=require(_0xeab1('0x1b'));var licenseUtil=require(_0xeab1('0x1c'));var db=require(_0xeab1('0x1d'))['db'];function respondWithStatusCode(_0x501df1,_0x1787dc){_0x1787dc=_0x1787dc||0xcc;return function(_0x3a2dcb){if(_0x3a2dcb){return _0x501df1['sendStatus'](_0x1787dc);}return _0x501df1['status'](_0x1787dc)[_0xeab1('0x1e')]();};}function respondWithResult(_0x59333b,_0x5673bb){_0x5673bb=_0x5673bb||0xc8;return function(_0x58ad62){if(_0x58ad62){return _0x59333b[_0xeab1('0x1f')](_0x5673bb)['json'](_0x58ad62);}};}function respondWithFilteredResult(_0x168f0f,_0x1af69b){return function(_0x1c2668){if(_0x1c2668){var _0x541caf=typeof _0x1af69b[_0xeab1('0x20')]===_0xeab1('0x21')&&typeof _0x1af69b[_0xeab1('0x22')]===_0xeab1('0x21');var _0x2b8728=_0x1c2668[_0xeab1('0x23')];var _0x2b528b=_0x541caf?0x0:_0x1af69b['offset'];var _0x47e20a=_0x541caf?_0x1c2668[_0xeab1('0x23')]:_0x1af69b[_0xeab1('0x20')]+_0x1af69b[_0xeab1('0x22')];var _0x3bcf6d;if(_0x47e20a>=_0x2b8728){_0x47e20a=_0x2b8728;_0x3bcf6d=0xc8;}else{_0x3bcf6d=0xce;}_0x168f0f[_0xeab1('0x1f')](_0x3bcf6d);return _0x168f0f[_0xeab1('0x24')]('Content-Range',_0x2b528b+'-'+_0x47e20a+'/'+_0x2b8728)['json'](_0x1c2668);}return null;};}function patchUpdates(_0x483bdb){return function(_0x20cab7){try{jsonpatch['apply'](_0x20cab7,_0x483bdb,!![]);}catch(_0x1b24d0){return BPromise['reject'](_0x1b24d0);}return _0x20cab7['save']();};}function saveUpdates(_0x12e0c2,_0x518506){return function(_0x419ac6){if(_0x419ac6){return _0x419ac6['update'](_0x12e0c2)[_0xeab1('0x25')](function(_0x40f764){return _0x40f764;});}return null;};}function removeEntity(_0x5a6134,_0x3ca5fa){return function(_0x55643c){if(_0x55643c){return _0x55643c['destroy']()[_0xeab1('0x25')](function(){_0x5a6134[_0xeab1('0x1f')](0xcc)[_0xeab1('0x1e')]();});}};}function handleEntityNotFound(_0x11b5d7,_0x53034f){return function(_0x920a82){if(!_0x920a82){_0x11b5d7['sendStatus'](0x194);}return _0x920a82;};}function handleError(_0x1582e3,_0x3cd078){_0x3cd078=_0x3cd078||0x1f4;return function(_0x3a9544){logger[_0xeab1('0x26')](_0x3a9544[_0xeab1('0x27')]);if(_0x3a9544[_0xeab1('0x28')]){delete _0x3a9544['name'];}_0x1582e3[_0xeab1('0x1f')](_0x3cd078)[_0xeab1('0x29')](_0x3a9544);};}exports[_0xeab1('0x2a')]=function(_0xb83fcf,_0xf2c3b3){var _0x3e59c1={},_0x51f4a2={},_0xd940a0={'count':0x0,'rows':[]};var _0x457ffd=_[_0xeab1('0x2b')](db[_0xeab1('0x2c')][_0xeab1('0x2d')],function(_0x6d1e3e){return{'name':_0x6d1e3e['fieldName'],'type':_0x6d1e3e[_0xeab1('0x2e')][_0xeab1('0x2f')]};});_0x51f4a2[_0xeab1('0x30')]=_[_0xeab1('0x2b')](_0x457ffd,_0xeab1('0x28'));_0x51f4a2['query']=_[_0xeab1('0x31')](_0xb83fcf['query']);_0x51f4a2[_0xeab1('0x32')]=_[_0xeab1('0x33')](_0x51f4a2[_0xeab1('0x30')],_0x51f4a2['query']);_0x3e59c1[_0xeab1('0x34')]=_[_0xeab1('0x33')](_0x51f4a2[_0xeab1('0x30')],qs[_0xeab1('0x35')](_0xb83fcf[_0xeab1('0x36')][_0xeab1('0x35')]));_0x3e59c1['attributes']=_0x3e59c1[_0xeab1('0x34')][_0xeab1('0x37')]?_0x3e59c1[_0xeab1('0x34')]:_0x51f4a2[_0xeab1('0x30')];if(!_0xb83fcf['query'][_0xeab1('0x38')](_0xeab1('0x39'))){_0x3e59c1[_0xeab1('0x22')]=qs[_0xeab1('0x22')](_0xb83fcf['query'][_0xeab1('0x22')]);_0x3e59c1[_0xeab1('0x20')]=qs[_0xeab1('0x20')](_0xb83fcf[_0xeab1('0x36')][_0xeab1('0x20')]);}_0x3e59c1['order']=qs['sort'](_0xb83fcf['query']['sort']);_0x3e59c1[_0xeab1('0x3a')]=qs[_0xeab1('0x32')](_[_0xeab1('0x3b')](_0xb83fcf[_0xeab1('0x36')],_0x51f4a2[_0xeab1('0x32')]),_0x457ffd);if(_0xb83fcf[_0xeab1('0x36')][_0xeab1('0x3c')]){_0x3e59c1['where']=_['merge'](_0x3e59c1[_0xeab1('0x3a')],{'$or':_['map'](_0x457ffd,function(_0x2f43bb){if(_0x2f43bb[_0xeab1('0x2e')]!==_0xeab1('0x3d')){var _0x324099={};_0x324099[_0x2f43bb['name']]={'$like':'%'+_0xb83fcf[_0xeab1('0x36')][_0xeab1('0x3c')]+'%'};return _0x324099;}})});}_0x3e59c1=_[_0xeab1('0x3e')]({},_0x3e59c1,_0xb83fcf[_0xeab1('0x3f')]);var _0x2c4138={'where':_0x3e59c1['where']};return db[_0xeab1('0x2c')][_0xeab1('0x23')](_0x2c4138)['then'](function(_0x18603b){_0xd940a0[_0xeab1('0x23')]=_0x18603b;if(_0xb83fcf[_0xeab1('0x36')][_0xeab1('0x40')]){_0x3e59c1[_0xeab1('0x41')]=[{'all':!![]}];}return db[_0xeab1('0x2c')][_0xeab1('0x42')](_0x3e59c1);})[_0xeab1('0x25')](function(_0x35ce6c){_0xd940a0[_0xeab1('0x43')]=_0x35ce6c;return _0xd940a0;})['then'](respondWithFilteredResult(_0xf2c3b3,_0x3e59c1))[_0xeab1('0x44')](handleError(_0xf2c3b3,null));};exports[_0xeab1('0x45')]=function(_0x50ee88,_0x423851){var _0x2f1a84={'raw':!![],'where':{'id':_0x50ee88['params']['id']}},_0x32ba77={};_0x32ba77['model']=_[_0xeab1('0x31')](db[_0xeab1('0x2c')][_0xeab1('0x2d')]);_0x32ba77[_0xeab1('0x36')]=_[_0xeab1('0x31')](_0x50ee88[_0xeab1('0x36')]);_0x32ba77[_0xeab1('0x32')]=_[_0xeab1('0x33')](_0x32ba77[_0xeab1('0x30')],_0x32ba77[_0xeab1('0x36')]);_0x2f1a84[_0xeab1('0x34')]=_[_0xeab1('0x33')](_0x32ba77[_0xeab1('0x30')],qs[_0xeab1('0x35')](_0x50ee88[_0xeab1('0x36')][_0xeab1('0x35')]));_0x2f1a84[_0xeab1('0x34')]=_0x2f1a84[_0xeab1('0x34')]['length']?_0x2f1a84[_0xeab1('0x34')]:_0x32ba77[_0xeab1('0x30')];if(_0x50ee88[_0xeab1('0x36')][_0xeab1('0x40')]){_0x2f1a84[_0xeab1('0x41')]=[{'all':!![]}];}_0x2f1a84=_[_0xeab1('0x3e')]({},_0x2f1a84,_0x50ee88[_0xeab1('0x3f')]);return db[_0xeab1('0x2c')][_0xeab1('0x46')](_0x2f1a84)[_0xeab1('0x25')](handleEntityNotFound(_0x423851,null))[_0xeab1('0x25')](respondWithResult(_0x423851,null))['catch'](handleError(_0x423851,null));};exports[_0xeab1('0x47')]=function(_0xf681bb,_0x445c29){return db[_0xeab1('0x2c')][_0xeab1('0x47')](_0xf681bb[_0xeab1('0x48')],{})[_0xeab1('0x25')](respondWithResult(_0x445c29,0xc9))['catch'](handleError(_0x445c29,null));};exports[_0xeab1('0x49')]=function(_0x24c4d8,_0x15e9b0){if(_0x24c4d8['body']['id']){delete _0x24c4d8['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x24c4d8[_0xeab1('0x4a')]['id']}})[_0xeab1('0x25')](handleEntityNotFound(_0x15e9b0,null))['then'](saveUpdates(_0x24c4d8[_0xeab1('0x48')],null))[_0xeab1('0x25')](respondWithResult(_0x15e9b0,null))['catch'](handleError(_0x15e9b0,null));};exports[_0xeab1('0x4b')]=function(_0x55958b,_0x2571bc){return db[_0xeab1('0x2c')]['find']({'where':{'id':_0x55958b[_0xeab1('0x4a')]['id']}})[_0xeab1('0x25')](handleEntityNotFound(_0x2571bc,null))['then'](removeEntity(_0x2571bc,null))['catch'](handleError(_0x2571bc,null));};exports[_0xeab1('0x4c')]=function(_0x487b93,_0x666888){return db[_0xeab1('0x2c')]['describe']()[_0xeab1('0x25')](respondWithResult(_0x666888,null))['catch'](handleError(_0x666888,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 7e2654e..3c0fbad 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x3ac063,_0x52424f){var _0xa682d=function(_0x47af4a){while(--_0x47af4a){_0x3ac063['push'](_0x3ac063['shift']());}};_0xa682d(++_0x52424f);}(_0xe706,0xa3));var _0x6e70=function(_0x4b6804,_0x301b24){_0x4b6804=_0x4b6804-0x0;var _0x11b4f1=_0xe706[_0x4b6804];return _0x11b4f1;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 23618d5..3a91907 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 _0x93be=['http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSmsQueueReport','SmsQueueReport','body','options','debug','UpdateSmsQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x93be,0x1c7));var _0xe93b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x93be[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe93b('0x0'));var util=require(_0xe93b('0x1'));var moment=require(_0xe93b('0x2'));var BPromise=require(_0xe93b('0x3'));var rs=require(_0xe93b('0x4'));var fs=require('fs');var Redis=require(_0xe93b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe93b('0x6'))('rpc');var config=require(_0xe93b('0x7'));var jayson=require(_0xe93b('0x8'));var client=jayson['client'][_0xe93b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43cfa2,_0x34600a,_0x259739){return new BPromise(function(_0x50509c,_0x124fb3){return client[_0xe93b('0xa')](_0x43cfa2,_0x259739)[_0xe93b('0xb')](function(_0x332b82){logger[_0xe93b('0xc')](_0xe93b('0xd'),_0x34600a,_0xe93b('0xe'));logger['debug'](_0xe93b('0xf'),_0x34600a,_0xe93b('0xe'),JSON[_0xe93b('0x10')](_0x332b82));if(_0x332b82[_0xe93b('0x11')]){if(_0x332b82['error']['code']===0x1f4){logger[_0xe93b('0x11')](_0xe93b('0xd'),_0x34600a,_0x332b82['error']['message']);return _0x124fb3(_0x332b82['error'][_0xe93b('0x12')]);}logger[_0xe93b('0x11')](_0xe93b('0xd'),_0x34600a,_0x332b82[_0xe93b('0x11')][_0xe93b('0x12')]);return _0x50509c(_0x332b82[_0xe93b('0x11')][_0xe93b('0x12')]);}else{logger[_0xe93b('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x34600a,'request\x20sent');_0x50509c(_0x332b82[_0xe93b('0x13')][_0xe93b('0x12')]);}})['catch'](function(_0x4d0f9c){logger[_0xe93b('0x11')](_0xe93b('0xd'),_0x34600a,_0x4d0f9c);_0x124fb3(_0x4d0f9c);});});}exports[_0xe93b('0x14')]=function(_0x3ac557){var _0x255e5b=this;return new Promise(function(_0x373b12,_0x1e5a2f){return db[_0xe93b('0x15')]['create'](_0x3ac557[_0xe93b('0x16')],{'raw':_0x3ac557[_0xe93b('0x17')]?_0x3ac557['options']['raw']===undefined?!![]:![]:!![]})[_0xe93b('0xb')](function(_0x412368){logger['info'](_0xe93b('0x14'),_0x3ac557);logger[_0xe93b('0x18')](_0xe93b('0x14'),_0x3ac557,JSON[_0xe93b('0x10')](_0x412368));_0x373b12(_0x412368);})['catch'](function(_0x3fc01d){logger[_0xe93b('0x11')](_0xe93b('0x14'),_0x3fc01d[_0xe93b('0x12')],_0x3ac557);_0x1e5a2f(_0x255e5b['error'](0x1f4,_0x3fc01d['message']));});});};exports[_0xe93b('0x19')]=function(_0x4fd539){var _0x3aba9f=this;return new Promise(function(_0x2beb12,_0x60fd91){return db[_0xe93b('0x15')]['update'](_0x4fd539[_0xe93b('0x16')],{'raw':_0x4fd539[_0xe93b('0x17')]?_0x4fd539[_0xe93b('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fd539['options']?_0x4fd539[_0xe93b('0x17')][_0xe93b('0x1a')]||null:null,'attributes':_0x4fd539[_0xe93b('0x17')]?_0x4fd539['options'][_0xe93b('0x1b')]||null:null,'limit':_0x4fd539[_0xe93b('0x17')]?_0x4fd539['options'][_0xe93b('0x1c')]||null:null})[_0xe93b('0xb')](function(_0x267266){logger[_0xe93b('0xc')]('UpdateSmsQueueReport',_0x4fd539);logger[_0xe93b('0x18')]('UpdateSmsQueueReport',_0x4fd539,JSON[_0xe93b('0x10')](_0x267266));_0x2beb12(_0x267266);})['catch'](function(_0x456a23){logger[_0xe93b('0x11')](_0xe93b('0x19'),_0x456a23['message'],_0x4fd539);_0x60fd91(_0x3aba9f['error'](0x1f4,_0x456a23[_0xe93b('0x12')]));});});}; \ No newline at end of file +var _0x63c6=['stringify','error','message','info','result','catch','create','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','body','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x4f3d81,_0x6a323){var _0xaac319=function(_0x2bcf4c){while(--_0x2bcf4c){_0x4f3d81['push'](_0x4f3d81['shift']());}};_0xaac319(++_0x6a323);}(_0x63c6,0x1ee));var _0x663c=function(_0x4a7fd3,_0x5ed2d8){_0x4a7fd3=_0x4a7fd3-0x0;var _0x3218a2=_0x63c6[_0x4a7fd3];return _0x3218a2;};'use strict';var _=require(_0x663c('0x0'));var util=require(_0x663c('0x1'));var moment=require(_0x663c('0x2'));var BPromise=require(_0x663c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x663c('0x4'));var db=require(_0x663c('0x5'))['db'];var utils=require(_0x663c('0x6'));var logger=require(_0x663c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x663c('0x8'));var client=jayson['client'][_0x663c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7afb,_0x2ec4ba,_0x3bafea){return new BPromise(function(_0x583638,_0x4b0d45){return client[_0x663c('0xa')](_0x1f7afb,_0x3bafea)[_0x663c('0xb')](function(_0x2f480c){logger['info'](_0x663c('0xc'),_0x2ec4ba,_0x663c('0xd'));logger[_0x663c('0xe')](_0x663c('0xf'),_0x2ec4ba,_0x663c('0xd'),JSON[_0x663c('0x10')](_0x2f480c));if(_0x2f480c[_0x663c('0x11')]){if(_0x2f480c[_0x663c('0x11')]['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x2ec4ba,_0x2f480c[_0x663c('0x11')][_0x663c('0x12')]);return _0x4b0d45(_0x2f480c['error'][_0x663c('0x12')]);}logger[_0x663c('0x11')](_0x663c('0xc'),_0x2ec4ba,_0x2f480c[_0x663c('0x11')][_0x663c('0x12')]);return _0x583638(_0x2f480c[_0x663c('0x11')][_0x663c('0x12')]);}else{logger[_0x663c('0x13')](_0x663c('0xc'),_0x2ec4ba,'request\x20sent');_0x583638(_0x2f480c[_0x663c('0x14')]['message']);}})[_0x663c('0x15')](function(_0x3e1a8a){logger[_0x663c('0x11')](_0x663c('0xc'),_0x2ec4ba,_0x3e1a8a);_0x4b0d45(_0x3e1a8a);});});}exports['CreateSmsQueueReport']=function(_0x40332a){var _0x2aa815=this;return new Promise(function(_0x28ba8f,_0x30722e){return db['SmsQueueReport'][_0x663c('0x16')](_0x40332a['body'],{'raw':_0x40332a['options']?_0x40332a[_0x663c('0x17')][_0x663c('0x18')]===undefined?!![]:![]:!![]})[_0x663c('0xb')](function(_0x3b431c){logger['info']('CreateSmsQueueReport',_0x40332a);logger[_0x663c('0xe')](_0x663c('0x19'),_0x40332a,JSON[_0x663c('0x10')](_0x3b431c));_0x28ba8f(_0x3b431c);})[_0x663c('0x15')](function(_0x267677){logger[_0x663c('0x11')]('CreateSmsQueueReport',_0x267677[_0x663c('0x12')],_0x40332a);_0x30722e(_0x2aa815[_0x663c('0x11')](0x1f4,_0x267677[_0x663c('0x12')]));});});};exports[_0x663c('0x1a')]=function(_0x26103e){var _0x16eab5=this;return new Promise(function(_0x3d83d9,_0x501476){return db[_0x663c('0x1b')]['update'](_0x26103e[_0x663c('0x1c')],{'raw':_0x26103e['options']?_0x26103e['options'][_0x663c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26103e['options']?_0x26103e[_0x663c('0x17')][_0x663c('0x1d')]||null:null,'attributes':_0x26103e[_0x663c('0x17')]?_0x26103e['options']['attributes']||null:null,'limit':_0x26103e[_0x663c('0x17')]?_0x26103e['options']['limit']||null:null})[_0x663c('0xb')](function(_0x4def09){logger[_0x663c('0x13')]('UpdateSmsQueueReport',_0x26103e);logger[_0x663c('0xe')](_0x663c('0x1a'),_0x26103e,JSON[_0x663c('0x10')](_0x4def09));_0x3d83d9(_0x4def09);})[_0x663c('0x15')](function(_0x2f0b35){logger['error'](_0x663c('0x1a'),_0x2f0b35['message'],_0x26103e);_0x501476(_0x16eab5[_0x663c('0x11')](0x1f4,_0x2f0b35[_0x663c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 4bf5d11..2187222 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 _0x2fed=['path','connect-timeout','express','fs-extra','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2b0cbb,_0x1e08f3){var _0x47e9ad=function(_0x306f3f){while(--_0x306f3f){_0x2b0cbb['push'](_0x2b0cbb['shift']());}};_0x47e9ad(++_0x1e08f3);}(_0x2fed,0x7c));var _0xd2fe=function(_0x24dd3f,_0x4632bb){_0x24dd3f=_0x24dd3f-0x0;var _0x56c79c=_0x2fed[_0x24dd3f];return _0x56c79c;};'use strict';var multer=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var path=require(_0xd2fe('0x2'));var timeout=require(_0xd2fe('0x3'));var express=require(_0xd2fe('0x4'));var router=express['Router']();var fs_extra=require(_0xd2fe('0x5'));var auth=require(_0xd2fe('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2fe('0x7'));router[_0xd2fe('0x8')]('/',auth[_0xd2fe('0x9')](),controller['index']);router[_0xd2fe('0x8')](_0xd2fe('0xa'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0xb')]);router['get'](_0xd2fe('0xc'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0xd')]);router[_0xd2fe('0xe')]('/',auth[_0xd2fe('0x9')](),controller[_0xd2fe('0xf')]);router[_0xd2fe('0x10')](_0xd2fe('0xc'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0x11')]);router[_0xd2fe('0x12')](_0xd2fe('0xc'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0x13')]);module[_0xd2fe('0x14')]=router; \ No newline at end of file +var _0xd2bb=['../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5440c1,_0x398422){var _0x176fa0=function(_0x343aa4){while(--_0x343aa4){_0x5440c1['push'](_0x5440c1['shift']());}};_0x176fa0(++_0x398422);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x174900,_0x22b8a8){_0x174900=_0x174900-0x0;var _0x7b872e=_0xd2bb[_0x174900];return _0x7b872e;};'use strict';var multer=require('multer');var util=require(_0xbd2b('0x0'));var path=require('path');var timeout=require(_0xbd2b('0x1'));var express=require(_0xbd2b('0x2'));var router=express[_0xbd2b('0x3')]();var fs_extra=require(_0xbd2b('0x4'));var auth=require(_0xbd2b('0x5'));var interaction=require(_0xbd2b('0x6'));var config=require('../../config/environment');var controller=require(_0xbd2b('0x7'));router[_0xbd2b('0x8')]('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xa')]);router[_0xbd2b('0x8')](_0xbd2b('0xb'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xc')]);router[_0xbd2b('0x8')](_0xbd2b('0xd'),auth['isAuthenticated'](),controller[_0xbd2b('0xe')]);router['post']('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xf')]);router['put'](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x10')]);router[_0xbd2b('0x11')](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x12')]);module[_0xbd2b('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1c08b06..5ac833d 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x6bfe16,_0x4c6b4a){var _0x195da8=function(_0x1e5607){while(--_0x1e5607){_0x6bfe16['push'](_0x6bfe16['shift']());}};_0x195da8(++_0x4c6b4a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0xf3cd[_0x28b0a1];return _0x21470c;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x008c,0x188));var _0xc008=function(_0x1920ad,_0x4e7462){_0x1920ad=_0x1920ad-0x0;var _0x1024af=_0x008c[_0x1920ad];return _0x1024af;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 1933e87..ede34df 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 _0xf7f6=['keys','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','pick','merge','filter','options','includeAll','include','SmsTransferReport','findAll','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query'];(function(_0x35f46d,_0x1887ef){var _0x3409b5=function(_0x5f52b7){while(--_0x5f52b7){_0x35f46d['push'](_0x35f46d['shift']());}};_0x3409b5(++_0x1887ef);}(_0xf7f6,0x147));var _0x6f7f=function(_0x56b274,_0x3614f5){_0x56b274=_0x56b274-0x0;var _0x3edc9f=_0xf7f6[_0x56b274];return _0x3edc9f;};'use strict';var emlformat=require(_0x6f7f('0x0'));var rimraf=require(_0x6f7f('0x1'));var zipdir=require(_0x6f7f('0x2'));var jsonpatch=require(_0x6f7f('0x3'));var rp=require(_0x6f7f('0x4'));var moment=require(_0x6f7f('0x5'));var BPromise=require(_0x6f7f('0x6'));var Mustache=require(_0x6f7f('0x7'));var util=require('util');var path=require(_0x6f7f('0x8'));var sox=require(_0x6f7f('0x9'));var csv=require(_0x6f7f('0xa'));var ejs=require(_0x6f7f('0xb'));var fs=require('fs');var fs_extra=require(_0x6f7f('0xc'));var _=require(_0x6f7f('0xd'));var squel=require(_0x6f7f('0xe'));var crypto=require(_0x6f7f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6f7f('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6f7f('0x11'));var Redis=require(_0x6f7f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6f7f('0x13'));var as=require(_0x6f7f('0x14'));var hardwareService=require(_0x6f7f('0x15'));var logger=require(_0x6f7f('0x16'))(_0x6f7f('0x17'));var utils=require(_0x6f7f('0x18'));var config=require(_0x6f7f('0x19'));var licenseUtil=require(_0x6f7f('0x1a'));var db=require(_0x6f7f('0x1b'))['db'];function respondWithStatusCode(_0xfb4c91,_0x1fa981){_0x1fa981=_0x1fa981||0xcc;return function(_0x13bc50){if(_0x13bc50){return _0xfb4c91[_0x6f7f('0x1c')](_0x1fa981);}return _0xfb4c91[_0x6f7f('0x1d')](_0x1fa981)[_0x6f7f('0x1e')]();};}function respondWithResult(_0x28bdc8,_0x1f34ea){_0x1f34ea=_0x1f34ea||0xc8;return function(_0x7c9f79){if(_0x7c9f79){return _0x28bdc8[_0x6f7f('0x1d')](_0x1f34ea)[_0x6f7f('0x1f')](_0x7c9f79);}};}function respondWithFilteredResult(_0x572781,_0x553455){return function(_0x59dadc){if(_0x59dadc){var _0x2c8de1=typeof _0x553455[_0x6f7f('0x20')]==='undefined'&&typeof _0x553455['limit']===_0x6f7f('0x21');var _0x54e8cb=_0x59dadc[_0x6f7f('0x22')];var _0x13326d=_0x2c8de1?0x0:_0x553455[_0x6f7f('0x20')];var _0x371c4c=_0x2c8de1?_0x59dadc['count']:_0x553455[_0x6f7f('0x20')]+_0x553455[_0x6f7f('0x23')];var _0x80028a;if(_0x371c4c>=_0x54e8cb){_0x371c4c=_0x54e8cb;_0x80028a=0xc8;}else{_0x80028a=0xce;}_0x572781[_0x6f7f('0x1d')](_0x80028a);return _0x572781[_0x6f7f('0x24')](_0x6f7f('0x25'),_0x13326d+'-'+_0x371c4c+'/'+_0x54e8cb)[_0x6f7f('0x1f')](_0x59dadc);}return null;};}function patchUpdates(_0x2b5016){return function(_0x266611){try{jsonpatch['apply'](_0x266611,_0x2b5016,!![]);}catch(_0x164d96){return BPromise[_0x6f7f('0x26')](_0x164d96);}return _0x266611[_0x6f7f('0x27')]();};}function saveUpdates(_0x32a0ce,_0x290d5f){return function(_0x551b50){if(_0x551b50){return _0x551b50[_0x6f7f('0x28')](_0x32a0ce)[_0x6f7f('0x29')](function(_0x21fc21){return _0x21fc21;});}return null;};}function removeEntity(_0x79646d,_0x41cb4a){return function(_0xb87a3c){if(_0xb87a3c){return _0xb87a3c[_0x6f7f('0x2a')]()[_0x6f7f('0x29')](function(){_0x79646d[_0x6f7f('0x1d')](0xcc)[_0x6f7f('0x1e')]();});}};}function handleEntityNotFound(_0x21ae48,_0x4e0d0c){return function(_0x24337a){if(!_0x24337a){_0x21ae48[_0x6f7f('0x1c')](0x194);}return _0x24337a;};}function handleError(_0x23981f,_0x186205){_0x186205=_0x186205||0x1f4;return function(_0x42fd97){logger[_0x6f7f('0x2b')](_0x42fd97[_0x6f7f('0x2c')]);if(_0x42fd97[_0x6f7f('0x2d')]){delete _0x42fd97[_0x6f7f('0x2d')];}_0x23981f[_0x6f7f('0x1d')](_0x186205)[_0x6f7f('0x2e')](_0x42fd97);};}exports[_0x6f7f('0x2f')]=function(_0x45672e,_0x4f8e32){var _0x13d352={},_0x1e5c22={},_0x78037b={'count':0x0,'rows':[]};var _0x405322=_[_0x6f7f('0x30')](db['SmsTransferReport']['rawAttributes'],function(_0x4a4e24){return{'name':_0x4a4e24[_0x6f7f('0x31')],'type':_0x4a4e24[_0x6f7f('0x32')]['key']};});_0x1e5c22[_0x6f7f('0x33')]=_[_0x6f7f('0x30')](_0x405322,_0x6f7f('0x2d'));_0x1e5c22[_0x6f7f('0x34')]=_[_0x6f7f('0x35')](_0x45672e['query']);_0x1e5c22['filters']=_[_0x6f7f('0x36')](_0x1e5c22[_0x6f7f('0x33')],_0x1e5c22[_0x6f7f('0x34')]);_0x13d352['attributes']=_[_0x6f7f('0x36')](_0x1e5c22[_0x6f7f('0x33')],qs[_0x6f7f('0x37')](_0x45672e[_0x6f7f('0x34')]['fields']));_0x13d352['attributes']=_0x13d352[_0x6f7f('0x38')][_0x6f7f('0x39')]?_0x13d352[_0x6f7f('0x38')]:_0x1e5c22[_0x6f7f('0x33')];if(!_0x45672e[_0x6f7f('0x34')][_0x6f7f('0x3a')]('nolimit')){_0x13d352['limit']=qs[_0x6f7f('0x23')](_0x45672e[_0x6f7f('0x34')][_0x6f7f('0x23')]);_0x13d352[_0x6f7f('0x20')]=qs['offset'](_0x45672e['query']['offset']);}_0x13d352[_0x6f7f('0x3b')]=qs['sort'](_0x45672e[_0x6f7f('0x34')]['sort']);_0x13d352[_0x6f7f('0x3c')]=qs[_0x6f7f('0x3d')](_[_0x6f7f('0x3e')](_0x45672e['query'],_0x1e5c22[_0x6f7f('0x3d')]),_0x405322);if(_0x45672e[_0x6f7f('0x34')]['filter']){_0x13d352[_0x6f7f('0x3c')]=_[_0x6f7f('0x3f')](_0x13d352[_0x6f7f('0x3c')],{'$or':_[_0x6f7f('0x30')](_0x405322,function(_0x1a9577){if(_0x1a9577['type']!=='VIRTUAL'){var _0x13c5f9={};_0x13c5f9[_0x1a9577[_0x6f7f('0x2d')]]={'$like':'%'+_0x45672e['query'][_0x6f7f('0x40')]+'%'};return _0x13c5f9;}})});}_0x13d352=_['merge']({},_0x13d352,_0x45672e[_0x6f7f('0x41')]);var _0x326b71={'where':_0x13d352[_0x6f7f('0x3c')]};return db['SmsTransferReport'][_0x6f7f('0x22')](_0x326b71)[_0x6f7f('0x29')](function(_0x3b4ef4){_0x78037b[_0x6f7f('0x22')]=_0x3b4ef4;if(_0x45672e[_0x6f7f('0x34')][_0x6f7f('0x42')]){_0x13d352[_0x6f7f('0x43')]=[{'all':!![]}];}return db[_0x6f7f('0x44')][_0x6f7f('0x45')](_0x13d352);})[_0x6f7f('0x29')](function(_0x5799b7){_0x78037b['rows']=_0x5799b7;return _0x78037b;})[_0x6f7f('0x29')](respondWithFilteredResult(_0x4f8e32,_0x13d352))['catch'](handleError(_0x4f8e32,null));};exports['show']=function(_0x50021a,_0x5cbe40){var _0xefbb27={'raw':!![],'where':{'id':_0x50021a[_0x6f7f('0x46')]['id']}},_0x4e93de={};_0x4e93de[_0x6f7f('0x33')]=_[_0x6f7f('0x35')](db[_0x6f7f('0x44')]['rawAttributes']);_0x4e93de[_0x6f7f('0x34')]=_[_0x6f7f('0x35')](_0x50021a['query']);_0x4e93de[_0x6f7f('0x3d')]=_[_0x6f7f('0x36')](_0x4e93de[_0x6f7f('0x33')],_0x4e93de[_0x6f7f('0x34')]);_0xefbb27['attributes']=_[_0x6f7f('0x36')](_0x4e93de[_0x6f7f('0x33')],qs[_0x6f7f('0x37')](_0x50021a['query'][_0x6f7f('0x37')]));_0xefbb27[_0x6f7f('0x38')]=_0xefbb27[_0x6f7f('0x38')][_0x6f7f('0x39')]?_0xefbb27[_0x6f7f('0x38')]:_0x4e93de[_0x6f7f('0x33')];if(_0x50021a[_0x6f7f('0x34')]['includeAll']){_0xefbb27[_0x6f7f('0x43')]=[{'all':!![]}];}_0xefbb27=_[_0x6f7f('0x3f')]({},_0xefbb27,_0x50021a[_0x6f7f('0x41')]);return db[_0x6f7f('0x44')][_0x6f7f('0x47')](_0xefbb27)[_0x6f7f('0x29')](handleEntityNotFound(_0x5cbe40,null))[_0x6f7f('0x29')](respondWithResult(_0x5cbe40,null))[_0x6f7f('0x48')](handleError(_0x5cbe40,null));};exports[_0x6f7f('0x49')]=function(_0x38c049,_0x1b32c5){return db[_0x6f7f('0x44')][_0x6f7f('0x49')](_0x38c049[_0x6f7f('0x4a')],{})[_0x6f7f('0x29')](respondWithResult(_0x1b32c5,0xc9))[_0x6f7f('0x48')](handleError(_0x1b32c5,null));};exports[_0x6f7f('0x28')]=function(_0x54e0f2,_0x2e38af){if(_0x54e0f2['body']['id']){delete _0x54e0f2[_0x6f7f('0x4a')]['id'];}return db[_0x6f7f('0x44')][_0x6f7f('0x47')]({'where':{'id':_0x54e0f2[_0x6f7f('0x46')]['id']}})[_0x6f7f('0x29')](handleEntityNotFound(_0x2e38af,null))[_0x6f7f('0x29')](saveUpdates(_0x54e0f2[_0x6f7f('0x4a')],null))['then'](respondWithResult(_0x2e38af,null))[_0x6f7f('0x48')](handleError(_0x2e38af,null));};exports['destroy']=function(_0x42bc01,_0x5e1f30){return db['SmsTransferReport'][_0x6f7f('0x47')]({'where':{'id':_0x42bc01[_0x6f7f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e1f30,null))[_0x6f7f('0x29')](removeEntity(_0x5e1f30,null))[_0x6f7f('0x48')](handleError(_0x5e1f30,null));};exports[_0x6f7f('0x4b')]=function(_0x38eb2f,_0x59fb23){return db[_0x6f7f('0x44')][_0x6f7f('0x4b')]()[_0x6f7f('0x29')](respondWithResult(_0x59fb23,null))['catch'](handleError(_0x59fb23,null));}; \ No newline at end of file +var _0x8baf=['json','apply','reject','save','update','then','end','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','SmsTransferReport','findAll','rows','catch','show','params','options','body','find','describe','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x4be4d0,_0x52a06f){var _0x41b1b0=function(_0x4226cb){while(--_0x4226cb){_0x4be4d0['push'](_0x4be4d0['shift']());}};_0x41b1b0(++_0x52a06f);}(_0x8baf,0xfb));var _0xf8ba=function(_0x29e659,_0xd51c09){_0x29e659=_0x29e659-0x0;var _0x4f4f22=_0x8baf[_0x29e659];return _0x4f4f22;};'use strict';var emlformat=require(_0xf8ba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf8ba('0x1'));var rp=require(_0xf8ba('0x2'));var moment=require('moment');var BPromise=require(_0xf8ba('0x3'));var Mustache=require('mustache');var util=require(_0xf8ba('0x4'));var path=require(_0xf8ba('0x5'));var sox=require(_0xf8ba('0x6'));var csv=require(_0xf8ba('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8ba('0x8'));var _=require('lodash');var squel=require(_0xf8ba('0x9'));var crypto=require(_0xf8ba('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf8ba('0x7'));var querystring=require(_0xf8ba('0xb'));var Papa=require(_0xf8ba('0xc'));var Redis=require(_0xf8ba('0xd'));var authService=require(_0xf8ba('0xe'));var qs=require(_0xf8ba('0xf'));var as=require(_0xf8ba('0x10'));var hardwareService=require(_0xf8ba('0x11'));var logger=require(_0xf8ba('0x12'))(_0xf8ba('0x13'));var utils=require(_0xf8ba('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13d06b,_0x41d0ca){_0x41d0ca=_0x41d0ca||0xcc;return function(_0x1324c3){if(_0x1324c3){return _0x13d06b[_0xf8ba('0x15')](_0x41d0ca);}return _0x13d06b[_0xf8ba('0x16')](_0x41d0ca)['end']();};}function respondWithResult(_0x4c5bcc,_0x18e867){_0x18e867=_0x18e867||0xc8;return function(_0x48e04f){if(_0x48e04f){return _0x4c5bcc['status'](_0x18e867)['json'](_0x48e04f);}};}function respondWithFilteredResult(_0x50abb7,_0x330d05){return function(_0x578016){if(_0x578016){var _0x5c3eb8=typeof _0x330d05[_0xf8ba('0x17')]===_0xf8ba('0x18')&&typeof _0x330d05[_0xf8ba('0x19')]===_0xf8ba('0x18');var _0x484a57=_0x578016[_0xf8ba('0x1a')];var _0x33c2db=_0x5c3eb8?0x0:_0x330d05[_0xf8ba('0x17')];var _0x2203e6=_0x5c3eb8?_0x578016['count']:_0x330d05['offset']+_0x330d05['limit'];var _0x5ed288;if(_0x2203e6>=_0x484a57){_0x2203e6=_0x484a57;_0x5ed288=0xc8;}else{_0x5ed288=0xce;}_0x50abb7[_0xf8ba('0x16')](_0x5ed288);return _0x50abb7[_0xf8ba('0x1b')](_0xf8ba('0x1c'),_0x33c2db+'-'+_0x2203e6+'/'+_0x484a57)[_0xf8ba('0x1d')](_0x578016);}return null;};}function patchUpdates(_0x2448c9){return function(_0xd3a75f){try{jsonpatch[_0xf8ba('0x1e')](_0xd3a75f,_0x2448c9,!![]);}catch(_0x1ffd2c){return BPromise[_0xf8ba('0x1f')](_0x1ffd2c);}return _0xd3a75f[_0xf8ba('0x20')]();};}function saveUpdates(_0x320002,_0x2677eb){return function(_0x5307d6){if(_0x5307d6){return _0x5307d6[_0xf8ba('0x21')](_0x320002)[_0xf8ba('0x22')](function(_0x26287c){return _0x26287c;});}return null;};}function removeEntity(_0x476b2a,_0x5cbffa){return function(_0x5f00ee){if(_0x5f00ee){return _0x5f00ee['destroy']()[_0xf8ba('0x22')](function(){_0x476b2a[_0xf8ba('0x16')](0xcc)[_0xf8ba('0x23')]();});}};}function handleEntityNotFound(_0xd4ee39,_0x15567b){return function(_0x330d4c){if(!_0x330d4c){_0xd4ee39[_0xf8ba('0x15')](0x194);}return _0x330d4c;};}function handleError(_0x2e25c4,_0x888975){_0x888975=_0x888975||0x1f4;return function(_0x358586){logger['error'](_0x358586['stack']);if(_0x358586[_0xf8ba('0x24')]){delete _0x358586[_0xf8ba('0x24')];}_0x2e25c4[_0xf8ba('0x16')](_0x888975)[_0xf8ba('0x25')](_0x358586);};}exports['index']=function(_0x4213aa,_0x2a21e4){var _0x196c1e={},_0x5585dd={},_0x11e51a={'count':0x0,'rows':[]};var _0xa16a2c=_['map'](db['SmsTransferReport'][_0xf8ba('0x26')],function(_0x4cfbcc){return{'name':_0x4cfbcc[_0xf8ba('0x27')],'type':_0x4cfbcc[_0xf8ba('0x28')]['key']};});_0x5585dd[_0xf8ba('0x29')]=_[_0xf8ba('0x2a')](_0xa16a2c,'name');_0x5585dd[_0xf8ba('0x2b')]=_[_0xf8ba('0x2c')](_0x4213aa[_0xf8ba('0x2b')]);_0x5585dd[_0xf8ba('0x2d')]=_[_0xf8ba('0x2e')](_0x5585dd[_0xf8ba('0x29')],_0x5585dd['query']);_0x196c1e[_0xf8ba('0x2f')]=_[_0xf8ba('0x2e')](_0x5585dd[_0xf8ba('0x29')],qs[_0xf8ba('0x30')](_0x4213aa[_0xf8ba('0x2b')][_0xf8ba('0x30')]));_0x196c1e['attributes']=_0x196c1e[_0xf8ba('0x2f')][_0xf8ba('0x31')]?_0x196c1e['attributes']:_0x5585dd[_0xf8ba('0x29')];if(!_0x4213aa[_0xf8ba('0x2b')][_0xf8ba('0x32')](_0xf8ba('0x33'))){_0x196c1e[_0xf8ba('0x19')]=qs[_0xf8ba('0x19')](_0x4213aa[_0xf8ba('0x2b')]['limit']);_0x196c1e[_0xf8ba('0x17')]=qs[_0xf8ba('0x17')](_0x4213aa['query'][_0xf8ba('0x17')]);}_0x196c1e[_0xf8ba('0x34')]=qs[_0xf8ba('0x35')](_0x4213aa['query']['sort']);_0x196c1e[_0xf8ba('0x36')]=qs[_0xf8ba('0x2d')](_['pick'](_0x4213aa[_0xf8ba('0x2b')],_0x5585dd[_0xf8ba('0x2d')]),_0xa16a2c);if(_0x4213aa[_0xf8ba('0x2b')][_0xf8ba('0x37')]){_0x196c1e[_0xf8ba('0x36')]=_['merge'](_0x196c1e[_0xf8ba('0x36')],{'$or':_['map'](_0xa16a2c,function(_0x3ce799){if(_0x3ce799['type']!==_0xf8ba('0x38')){var _0x47a732={};_0x47a732[_0x3ce799[_0xf8ba('0x24')]]={'$like':'%'+_0x4213aa[_0xf8ba('0x2b')]['filter']+'%'};return _0x47a732;}})});}_0x196c1e=_[_0xf8ba('0x39')]({},_0x196c1e,_0x4213aa['options']);var _0x433c06={'where':_0x196c1e[_0xf8ba('0x36')]};return db['SmsTransferReport'][_0xf8ba('0x1a')](_0x433c06)['then'](function(_0x466f1b){_0x11e51a['count']=_0x466f1b;if(_0x4213aa[_0xf8ba('0x2b')][_0xf8ba('0x3a')]){_0x196c1e[_0xf8ba('0x3b')]=[{'all':!![]}];}return db[_0xf8ba('0x3c')][_0xf8ba('0x3d')](_0x196c1e);})[_0xf8ba('0x22')](function(_0x1a66d3){_0x11e51a[_0xf8ba('0x3e')]=_0x1a66d3;return _0x11e51a;})['then'](respondWithFilteredResult(_0x2a21e4,_0x196c1e))[_0xf8ba('0x3f')](handleError(_0x2a21e4,null));};exports[_0xf8ba('0x40')]=function(_0x5a11a7,_0x373bde){var _0x54c177={'raw':!![],'where':{'id':_0x5a11a7[_0xf8ba('0x41')]['id']}},_0x3e1822={};_0x3e1822[_0xf8ba('0x29')]=_[_0xf8ba('0x2c')](db[_0xf8ba('0x3c')][_0xf8ba('0x26')]);_0x3e1822[_0xf8ba('0x2b')]=_[_0xf8ba('0x2c')](_0x5a11a7[_0xf8ba('0x2b')]);_0x3e1822[_0xf8ba('0x2d')]=_['intersection'](_0x3e1822[_0xf8ba('0x29')],_0x3e1822[_0xf8ba('0x2b')]);_0x54c177[_0xf8ba('0x2f')]=_['intersection'](_0x3e1822[_0xf8ba('0x29')],qs[_0xf8ba('0x30')](_0x5a11a7['query'][_0xf8ba('0x30')]));_0x54c177[_0xf8ba('0x2f')]=_0x54c177[_0xf8ba('0x2f')]['length']?_0x54c177[_0xf8ba('0x2f')]:_0x3e1822['model'];if(_0x5a11a7[_0xf8ba('0x2b')][_0xf8ba('0x3a')]){_0x54c177['include']=[{'all':!![]}];}_0x54c177=_[_0xf8ba('0x39')]({},_0x54c177,_0x5a11a7[_0xf8ba('0x42')]);return db[_0xf8ba('0x3c')]['find'](_0x54c177)['then'](handleEntityNotFound(_0x373bde,null))['then'](respondWithResult(_0x373bde,null))[_0xf8ba('0x3f')](handleError(_0x373bde,null));};exports['create']=function(_0x1ec857,_0x272979){return db['SmsTransferReport']['create'](_0x1ec857[_0xf8ba('0x43')],{})[_0xf8ba('0x22')](respondWithResult(_0x272979,0xc9))[_0xf8ba('0x3f')](handleError(_0x272979,null));};exports[_0xf8ba('0x21')]=function(_0x548c33,_0x511e21){if(_0x548c33[_0xf8ba('0x43')]['id']){delete _0x548c33[_0xf8ba('0x43')]['id'];}return db[_0xf8ba('0x3c')][_0xf8ba('0x44')]({'where':{'id':_0x548c33[_0xf8ba('0x41')]['id']}})[_0xf8ba('0x22')](handleEntityNotFound(_0x511e21,null))[_0xf8ba('0x22')](saveUpdates(_0x548c33[_0xf8ba('0x43')],null))['then'](respondWithResult(_0x511e21,null))[_0xf8ba('0x3f')](handleError(_0x511e21,null));};exports['destroy']=function(_0x52c3bb,_0x2d83b1){return db[_0xf8ba('0x3c')][_0xf8ba('0x44')]({'where':{'id':_0x52c3bb[_0xf8ba('0x41')]['id']}})[_0xf8ba('0x22')](handleEntityNotFound(_0x2d83b1,null))[_0xf8ba('0x22')](removeEntity(_0x2d83b1,null))[_0xf8ba('0x3f')](handleError(_0x2d83b1,null));};exports['describe']=function(_0x3cd6b5,_0x273b83){return db['SmsTransferReport'][_0xf8ba('0x45')]()[_0xf8ba('0x22')](respondWithResult(_0x273b83,null))[_0xf8ba('0x3f')](handleError(_0x273b83,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 9da82cb..4aba339 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 _0xa459=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xa459,0x1d8));var _0x9a45=function(_0x31a65,_0x7eb34b){_0x31a65=_0x31a65-0x0;var _0x1f4c96=_0xa459[_0x31a65];return _0x1f4c96;};'use strict';var _=require(_0x9a45('0x0'));var util=require(_0x9a45('0x1'));var logger=require(_0x9a45('0x2'))(_0x9a45('0x3'));var moment=require(_0x9a45('0x4'));var BPromise=require(_0x9a45('0x5'));var rp=require(_0x9a45('0x6'));var fs=require('fs');var path=require(_0x9a45('0x7'));var rimraf=require(_0x9a45('0x8'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x257f0a,_0x5bab55){return _0x257f0a[_0x9a45('0x9')](_0x9a45('0xa'),attributes,{'tableName':_0x9a45('0xb'),'paranoid':![],'indexes':[{'name':_0x9a45('0xc'),'fields':[_0x9a45('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3442=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','uniqueid','lodash','util'];(function(_0xdc2309,_0x5df189){var _0x16c194=function(_0x5b37e6){while(--_0x5b37e6){_0xdc2309['push'](_0xdc2309['shift']());}};_0x16c194(++_0x5df189);}(_0x3442,0x194));var _0x2344=function(_0x2935ce,_0x56890c){_0x2935ce=_0x2935ce-0x0;var _0x1a291f=_0x3442[_0x2935ce];return _0x1a291f;};'use strict';var _=require(_0x2344('0x0'));var util=require(_0x2344('0x1'));var logger=require(_0x2344('0x2'))(_0x2344('0x3'));var moment=require(_0x2344('0x4'));var BPromise=require(_0x2344('0x5'));var rp=require(_0x2344('0x6'));var fs=require('fs');var path=require(_0x2344('0x7'));var rimraf=require(_0x2344('0x8'));var config=require(_0x2344('0x9'));var attributes=require(_0x2344('0xa'));module[_0x2344('0xb')]=function(_0x4e985b,_0x414264){return _0x4e985b[_0x2344('0xc')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x2344('0xd'),'fields':[_0x2344('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index c05c9f0..c5a2e80 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 _0x06f4=['error','message','info','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4718d9,_0x15a308){var _0x31fc60=function(_0x8b85ad){while(--_0x8b85ad){_0x4718d9['push'](_0x4718d9['shift']());}};_0x31fc60(++_0x15a308);}(_0x06f4,0x136));var _0x406f=function(_0x335bad,_0x53bc49){_0x335bad=_0x335bad-0x0;var _0x522dcb=_0x06f4[_0x335bad];return _0x522dcb;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var moment=require('moment');var BPromise=require(_0x406f('0x2'));var rs=require(_0x406f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x406f('0x4'));var logger=require('../../config/logger')(_0x406f('0x5'));var config=require(_0x406f('0x6'));var jayson=require(_0x406f('0x7'));var client=jayson[_0x406f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d2886,_0x5bec4f,_0x1afec4){return new BPromise(function(_0x1c39ce,_0xc2f682){return client['request'](_0x1d2886,_0x1afec4)[_0x406f('0x9')](function(_0x52bad2){logger['info'](_0x406f('0xa'),_0x5bec4f,'request\x20sent');logger[_0x406f('0xb')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5bec4f,_0x406f('0xc'),JSON['stringify'](_0x52bad2));if(_0x52bad2[_0x406f('0xd')]){if(_0x52bad2[_0x406f('0xd')]['code']===0x1f4){logger[_0x406f('0xd')](_0x406f('0xa'),_0x5bec4f,_0x52bad2[_0x406f('0xd')][_0x406f('0xe')]);return _0xc2f682(_0x52bad2[_0x406f('0xd')][_0x406f('0xe')]);}logger[_0x406f('0xd')](_0x406f('0xa'),_0x5bec4f,_0x52bad2[_0x406f('0xd')][_0x406f('0xe')]);return _0x1c39ce(_0x52bad2[_0x406f('0xd')]['message']);}else{logger[_0x406f('0xf')](_0x406f('0xa'),_0x5bec4f,_0x406f('0xc'));_0x1c39ce(_0x52bad2['result'][_0x406f('0xe')]);}})[_0x406f('0x10')](function(_0x4dfbc1){logger['error'](_0x406f('0xa'),_0x5bec4f,_0x4dfbc1);_0xc2f682(_0x4dfbc1);});});} \ No newline at end of file +var _0xc0a4=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0xc0a4,0x147));var _0x4c0a=function(_0x3edcf0,_0x2dfeff){_0x3edcf0=_0x3edcf0-0x0;var _0xcd8301=_0xc0a4[_0x3edcf0];return _0xcd8301;};'use strict';var _=require('lodash');var util=require(_0x4c0a('0x0'));var moment=require(_0x4c0a('0x1'));var BPromise=require(_0x4c0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c0a('0x3'));var db=require(_0x4c0a('0x4'))['db'];var utils=require(_0x4c0a('0x5'));var logger=require(_0x4c0a('0x6'))(_0x4c0a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4c0a('0x8'));var client=jayson[_0x4c0a('0x9')][_0x4c0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x457ef9,_0x7ca892,_0x1a64e7){return new BPromise(function(_0x4093d5,_0x33aedb){return client[_0x4c0a('0xb')](_0x457ef9,_0x1a64e7)['then'](function(_0x3bfa91){logger[_0x4c0a('0xc')](_0x4c0a('0xd'),_0x7ca892,_0x4c0a('0xe'));logger[_0x4c0a('0xf')](_0x4c0a('0x10'),_0x7ca892,_0x4c0a('0xe'),JSON[_0x4c0a('0x11')](_0x3bfa91));if(_0x3bfa91[_0x4c0a('0x12')]){if(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x13')]===0x1f4){logger[_0x4c0a('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x7ca892,_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);return _0x33aedb(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);}logger['error'](_0x4c0a('0xd'),_0x7ca892,_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);return _0x4093d5(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);}else{logger[_0x4c0a('0xc')](_0x4c0a('0xd'),_0x7ca892,_0x4c0a('0xe'));_0x4093d5(_0x3bfa91[_0x4c0a('0x15')][_0x4c0a('0x14')]);}})[_0x4c0a('0x16')](function(_0x4637a8){logger[_0x4c0a('0x12')](_0x4c0a('0xd'),_0x7ca892,_0x4637a8);_0x33aedb(_0x4637a8);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 471bbf5..f7c9e35 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 _0x9c8a=['/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','file','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get'];(function(_0x4700a6,_0x1892a1){var _0x4975a5=function(_0x297412){while(--_0x297412){_0x4700a6['push'](_0x4700a6['shift']());}};_0x4975a5(++_0x1892a1);}(_0x9c8a,0x1a6));var _0xa9c8=function(_0x1e3bc7,_0x229dcf){_0x1e3bc7=_0x1e3bc7-0x0;var _0x43051a=_0x9c8a[_0x1e3bc7];return _0x43051a;};'use strict';var multer=require(_0xa9c8('0x0'));var util=require(_0xa9c8('0x1'));var path=require(_0xa9c8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9c8('0x3')]();var fs_extra=require(_0xa9c8('0x4'));var auth=require(_0xa9c8('0x5'));var interaction=require(_0xa9c8('0x6'));var config=require(_0xa9c8('0x7'));var controller=require(_0xa9c8('0x8'));router['get']('/',auth[_0xa9c8('0x9')](),controller[_0xa9c8('0xa')]);router[_0xa9c8('0xb')](_0xa9c8('0xc'),auth['isAuthenticated'](),controller[_0xa9c8('0xd')]);router[_0xa9c8('0xb')](_0xa9c8('0xe'),auth[_0xa9c8('0x9')](),controller[_0xa9c8('0xf')]);var upload=multer({'storage':multer[_0xa9c8('0x10')]({'destination':function(_0x416c3,_0x451ad9,_0x269345){_0x269345(null,path[_0xa9c8('0x11')](config[_0xa9c8('0x12')],_0xa9c8('0x13')));},'filename':function(_0x370c9d,_0x2dde25,_0x1642ca){_0x2dde25[_0xa9c8('0x14')]=_0x2dde25[_0xa9c8('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1642ca(null,util[_0xa9c8('0x15')](_0xa9c8('0x16'),path[_0xa9c8('0x17')](_0x2dde25[_0xa9c8('0x14')],path[_0xa9c8('0x18')](_0x2dde25['originalname'])),Date[_0xa9c8('0x19')](),path['extname'](_0x2dde25[_0xa9c8('0x14')])));}})});router['post']('/',upload['single'](_0xa9c8('0x1a')),controller['create']);router[_0xa9c8('0x1b')](_0xa9c8('0xc'),auth[_0xa9c8('0x9')](),controller[_0xa9c8('0x1c')]);router[_0xa9c8('0x1d')](_0xa9c8('0xc'),auth[_0xa9c8('0x9')](),controller[_0xa9c8('0x1d')]);module[_0xa9c8('0x1e')]=router; \ No newline at end of file +var _0x05be=['isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','extname','post','single','file','create','put','update','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x05be,0xfd));var _0xe05b=function(_0x287ece,_0x5139c2){_0x287ece=_0x287ece-0x0;var _0x12087f=_0x05be[_0x287ece];return _0x12087f;};'use strict';var multer=require(_0xe05b('0x0'));var util=require(_0xe05b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe05b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe05b('0x3'));var interaction=require(_0xe05b('0x4'));var config=require(_0xe05b('0x5'));var controller=require(_0xe05b('0x6'));router[_0xe05b('0x7')]('/',auth[_0xe05b('0x8')](),controller[_0xe05b('0x9')]);router[_0xe05b('0x7')](_0xe05b('0xa'),auth['isAuthenticated'](),controller[_0xe05b('0xb')]);router[_0xe05b('0x7')](_0xe05b('0xc'),auth[_0xe05b('0x8')](),controller[_0xe05b('0xd')]);var upload=multer({'storage':multer[_0xe05b('0xe')]({'destination':function(_0x2f7cec,_0x419795,_0xeb3d93){_0xeb3d93(null,path[_0xe05b('0xf')](config[_0xe05b('0x10')],_0xe05b('0x11')));},'filename':function(_0x2eb184,_0x4c01bb,_0x4d80e3){_0x4c01bb[_0xe05b('0x12')]=_0x4c01bb['originalname'][_0xe05b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d80e3(null,util['format']('%s-%s%s',path['basename'](_0x4c01bb[_0xe05b('0x12')],path['extname'](_0x4c01bb[_0xe05b('0x12')])),Date['now'](),path[_0xe05b('0x14')](_0x4c01bb[_0xe05b('0x12')])));}})});router[_0xe05b('0x15')]('/',upload[_0xe05b('0x16')](_0xe05b('0x17')),controller[_0xe05b('0x18')]);router[_0xe05b('0x19')](_0xe05b('0xa'),auth['isAuthenticated'](),controller[_0xe05b('0x1a')]);router[_0xe05b('0x1b')](_0xe05b('0xa'),auth[_0xe05b('0x8')](),controller[_0xe05b('0x1b')]);module[_0xe05b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 577b019..2b90615 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 _0xd0c1=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x1a10d4,_0x3161d9){var _0x5d0cec=function(_0x171073){while(--_0x171073){_0x1a10d4['push'](_0x1a10d4['shift']());}};_0x5d0cec(++_0x3161d9);}(_0xd0c1,0x144));var _0x1d0c=function(_0x404a41,_0x3204e2){_0x404a41=_0x404a41-0x0;var _0x4479ad=_0xd0c1[_0x404a41];return _0x4479ad;};'use strict';var Sequelize=require(_0x1d0c('0x0'));module[_0x1d0c('0x1')]={'name':{'type':Sequelize[_0x1d0c('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x1d0c('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x1d0c('0x2')]},'original_format':{'type':Sequelize[_0x1d0c('0x2')]},'original_duration':{'type':Sequelize[_0x1d0c('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x1d0c('0x4')]},'original_sampleRate':{'type':Sequelize[_0x1d0c('0x5')]},'converted_format':{'type':Sequelize[_0x1d0c('0x2')]},'converted_duration':{'type':Sequelize[_0x1d0c('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x1d0c('0x4')]},'converted_channelCount':{'type':Sequelize[_0x1d0c('0x5')]},'converted_bitRate':{'type':Sequelize[_0x1d0c('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x1d0c('0x5')]}}; \ No newline at end of file +var _0x08d3=['STRING','INTEGER','BIGINT','FLOAT','sequelize'];(function(_0x32960c,_0x491736){var _0x10d449=function(_0x161849){while(--_0x161849){_0x32960c['push'](_0x32960c['shift']());}};_0x10d449(++_0x491736);}(_0x08d3,0xd6));var _0x308d=function(_0x1981aa,_0x196b04){_0x1981aa=_0x1981aa-0x0;var _0x7e028b=_0x08d3[_0x1981aa];return _0x7e028b;};'use strict';var Sequelize=require(_0x308d('0x0'));module['exports']={'name':{'type':Sequelize[_0x308d('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x308d('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x308d('0x1')]},'original_format':{'type':Sequelize[_0x308d('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x308d('0x2')]},'original_bitRate':{'type':Sequelize[_0x308d('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x308d('0x1')]},'converted_duration':{'type':Sequelize[_0x308d('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x308d('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x308d('0x2')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ac30895..000c7e5 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 _0x90d2=['UserProfileResource','stack','name','send','map','Sound','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','fields','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','format','%s.%s','catch','create','basename','file','originalname','extname','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','Sounds'];(function(_0x37cd00,_0x501df6){var _0x4cb283=function(_0x51aa67){while(--_0x51aa67){_0x37cd00['push'](_0x37cd00['shift']());}};_0x4cb283(++_0x501df6);}(_0x90d2,0x1cb));var _0x290d=function(_0x124b6f,_0x22f98c){_0x124b6f=_0x124b6f-0x0;var _0x2e40fd=_0x90d2[_0x124b6f];return _0x2e40fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x290d('0x0'));var zipdir=require(_0x290d('0x1'));var jsonpatch=require(_0x290d('0x2'));var rp=require(_0x290d('0x3'));var moment=require(_0x290d('0x4'));var BPromise=require(_0x290d('0x5'));var Mustache=require(_0x290d('0x6'));var util=require(_0x290d('0x7'));var path=require(_0x290d('0x8'));var sox=require(_0x290d('0x9'));var csv=require(_0x290d('0xa'));var ejs=require(_0x290d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x290d('0xc'));var squel=require(_0x290d('0xd'));var crypto=require(_0x290d('0xe'));var jsforce=require(_0x290d('0xf'));var deskjs=require(_0x290d('0x10'));var toCsv=require(_0x290d('0xa'));var querystring=require('querystring');var Papa=require(_0x290d('0x11'));var Redis=require(_0x290d('0x12'));var authService=require(_0x290d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x290d('0x14'));var hardwareService=require(_0x290d('0x15'));var logger=require(_0x290d('0x16'))('api');var utils=require(_0x290d('0x17'));var config=require(_0x290d('0x18'));var licenseUtil=require(_0x290d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e0366,_0x2a0780){_0x2a0780=_0x2a0780||0xcc;return function(_0x377f7e){if(_0x377f7e){return _0x4e0366[_0x290d('0x1a')](_0x2a0780);}return _0x4e0366[_0x290d('0x1b')](_0x2a0780)[_0x290d('0x1c')]();};}function respondWithResult(_0x340b93,_0x416585){_0x416585=_0x416585||0xc8;return function(_0xfec9ee){if(_0xfec9ee){return _0x340b93['status'](_0x416585)[_0x290d('0x1d')](_0xfec9ee);}};}function respondWithFilteredResult(_0x38923a,_0x213ded){return function(_0x3d5d08){if(_0x3d5d08){var _0x4bc4c4=typeof _0x213ded[_0x290d('0x1e')]===_0x290d('0x1f')&&typeof _0x213ded[_0x290d('0x20')]==='undefined';var _0x46fb9d=_0x3d5d08[_0x290d('0x21')];var _0x14bbf9=_0x4bc4c4?0x0:_0x213ded[_0x290d('0x1e')];var _0x4d1cb1=_0x4bc4c4?_0x3d5d08['count']:_0x213ded[_0x290d('0x1e')]+_0x213ded[_0x290d('0x20')];var _0x39e83e;if(_0x4d1cb1>=_0x46fb9d){_0x4d1cb1=_0x46fb9d;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x38923a[_0x290d('0x1b')](_0x39e83e);return _0x38923a[_0x290d('0x22')](_0x290d('0x23'),_0x14bbf9+'-'+_0x4d1cb1+'/'+_0x46fb9d)[_0x290d('0x1d')](_0x3d5d08);}return null;};}function patchUpdates(_0x15d757){return function(_0x32eb8d){try{jsonpatch[_0x290d('0x24')](_0x32eb8d,_0x15d757,!![]);}catch(_0x41915c){return BPromise['reject'](_0x41915c);}return _0x32eb8d['save']();};}function saveUpdates(_0x16b7c6,_0x2e1f42){return function(_0x37bcc4){if(_0x37bcc4){return _0x37bcc4['update'](_0x16b7c6)[_0x290d('0x25')](function(_0x4efa82){return _0x4efa82;});}return null;};}function removeEntity(_0x4f5fa1,_0x13f26f){return function(_0x777e5d){if(_0x777e5d){return _0x777e5d[_0x290d('0x26')]()[_0x290d('0x25')](function(){var _0x947009=_0x777e5d[_0x290d('0x27')]({'plain':!![]});var _0x3131b9=_0x290d('0x28');return db[_0x290d('0x29')][_0x290d('0x26')]({'where':{'type':_0x3131b9,'resourceId':_0x947009['id']}})[_0x290d('0x25')](function(){return _0x777e5d;});})[_0x290d('0x25')](function(){_0x4f5fa1[_0x290d('0x1b')](0xcc)[_0x290d('0x1c')]();});}};}function handleEntityNotFound(_0x45574f,_0x1c423d){return function(_0x3efd7b){if(!_0x3efd7b){_0x45574f['sendStatus'](0x194);}return _0x3efd7b;};}function handleError(_0x4fd19d,_0x244306){_0x244306=_0x244306||0x1f4;return function(_0x31238c){logger['error'](_0x31238c[_0x290d('0x2a')]);if(_0x31238c[_0x290d('0x2b')]){delete _0x31238c[_0x290d('0x2b')];}_0x4fd19d[_0x290d('0x1b')](_0x244306)[_0x290d('0x2c')](_0x31238c);};}exports['index']=function(_0x46e9aa,_0x18f451){var _0x476b08={},_0x51fd21={},_0x111a0a={'count':0x0,'rows':[]};var _0x3e3438=_[_0x290d('0x2d')](db[_0x290d('0x2e')][_0x290d('0x2f')],function(_0x2f04bc){return{'name':_0x2f04bc[_0x290d('0x30')],'type':_0x2f04bc[_0x290d('0x31')][_0x290d('0x32')]};});_0x51fd21['model']=_[_0x290d('0x2d')](_0x3e3438,'name');_0x51fd21[_0x290d('0x33')]=_[_0x290d('0x34')](_0x46e9aa[_0x290d('0x33')]);_0x51fd21[_0x290d('0x35')]=_[_0x290d('0x36')](_0x51fd21[_0x290d('0x37')],_0x51fd21[_0x290d('0x33')]);_0x476b08[_0x290d('0x38')]=_[_0x290d('0x36')](_0x51fd21['model'],qs['fields'](_0x46e9aa[_0x290d('0x33')]['fields']));_0x476b08['attributes']=_0x476b08[_0x290d('0x38')][_0x290d('0x39')]?_0x476b08['attributes']:_0x51fd21['model'];if(!_0x46e9aa[_0x290d('0x33')][_0x290d('0x3a')](_0x290d('0x3b'))){_0x476b08[_0x290d('0x20')]=qs['limit'](_0x46e9aa[_0x290d('0x33')][_0x290d('0x20')]);_0x476b08['offset']=qs[_0x290d('0x1e')](_0x46e9aa['query'][_0x290d('0x1e')]);}_0x476b08[_0x290d('0x3c')]=qs[_0x290d('0x3d')](_0x46e9aa['query'][_0x290d('0x3d')]);_0x476b08[_0x290d('0x3e')]=qs[_0x290d('0x35')](_[_0x290d('0x3f')](_0x46e9aa['query'],_0x51fd21['filters']),_0x3e3438);if(_0x46e9aa['query'][_0x290d('0x40')]){_0x476b08[_0x290d('0x3e')]=_[_0x290d('0x41')](_0x476b08[_0x290d('0x3e')],{'$or':_[_0x290d('0x2d')](_0x3e3438,function(_0x1c11b9){if(_0x1c11b9[_0x290d('0x31')]!==_0x290d('0x42')){var _0x1be9f8={};_0x1be9f8[_0x1c11b9[_0x290d('0x2b')]]={'$like':'%'+_0x46e9aa[_0x290d('0x33')][_0x290d('0x40')]+'%'};return _0x1be9f8;}})});}_0x476b08=_[_0x290d('0x41')]({},_0x476b08,_0x46e9aa[_0x290d('0x43')]);var _0x4a4f30={'where':_0x476b08['where']};return db[_0x290d('0x2e')][_0x290d('0x21')](_0x4a4f30)[_0x290d('0x25')](function(_0x9597f7){_0x111a0a[_0x290d('0x21')]=_0x9597f7;if(_0x46e9aa['query'][_0x290d('0x44')]){_0x476b08[_0x290d('0x45')]=[{'all':!![]}];}return db['Sound'][_0x290d('0x46')](_0x476b08);})[_0x290d('0x25')](function(_0x5b3c01){_0x111a0a['rows']=_0x5b3c01;return _0x111a0a;})['then'](respondWithFilteredResult(_0x18f451,_0x476b08))['catch'](handleError(_0x18f451,null));};exports['show']=function(_0x574208,_0x27ad05){var _0x1a92bc={'raw':!![],'where':{'id':_0x574208[_0x290d('0x47')]['id']}},_0x34bcae={};_0x34bcae['model']=_[_0x290d('0x34')](db['Sound'][_0x290d('0x2f')]);_0x34bcae[_0x290d('0x33')]=_[_0x290d('0x34')](_0x574208[_0x290d('0x33')]);_0x34bcae[_0x290d('0x35')]=_[_0x290d('0x36')](_0x34bcae[_0x290d('0x37')],_0x34bcae[_0x290d('0x33')]);_0x1a92bc[_0x290d('0x38')]=_[_0x290d('0x36')](_0x34bcae[_0x290d('0x37')],qs[_0x290d('0x48')](_0x574208[_0x290d('0x33')][_0x290d('0x48')]));_0x1a92bc[_0x290d('0x38')]=_0x1a92bc[_0x290d('0x38')]['length']?_0x1a92bc[_0x290d('0x38')]:_0x34bcae[_0x290d('0x37')];if(_0x574208['query'][_0x290d('0x44')]){_0x1a92bc[_0x290d('0x45')]=[{'all':!![]}];}_0x1a92bc=_['merge']({},_0x1a92bc,_0x574208[_0x290d('0x43')]);return db[_0x290d('0x2e')][_0x290d('0x49')](_0x1a92bc)[_0x290d('0x25')](handleEntityNotFound(_0x27ad05,null))['then'](respondWithResult(_0x27ad05,null))['catch'](handleError(_0x27ad05,null));};exports[_0x290d('0x4a')]=function(_0x172fff,_0x27d740,_0x3e4351){return db[_0x290d('0x2e')][_0x290d('0x49')]({'where':{'id':_0x172fff[_0x290d('0x47')]['id']},'attributes':[_0x290d('0x2b'),_0x290d('0x4b'),'converted_format'],'raw':!![]})[_0x290d('0x25')](handleEntityNotFound(_0x27d740,null))[_0x290d('0x25')](function(_0x29447d){if(_0x29447d){if(!fs[_0x290d('0x4c')](path[_0x290d('0x4d')](config[_0x290d('0x4e')],_0x290d('0x4f'),_0x29447d['save_name']+'.'+_0x29447d[_0x290d('0x50')]))){throw new db[(_0x290d('0x51'))][(_0x290d('0x52'))]('Sound\x20not\x20found');}return _0x27d740[_0x290d('0x4a')](path[_0x290d('0x4d')](config[_0x290d('0x4e')],_0x290d('0x4f'),util[_0x290d('0x53')](_0x290d('0x54'),_0x29447d[_0x290d('0x4b')],_0x29447d[_0x290d('0x50')])),util[_0x290d('0x53')](_0x290d('0x54'),_0x29447d[_0x290d('0x2b')],_0x29447d[_0x290d('0x50')]));}return null;})[_0x290d('0x55')](handleError(_0x27d740,null));};exports[_0x290d('0x56')]=function(_0x3d25b9,_0x248c43,_0x50dda7){var _0x3e6583={'name':path[_0x290d('0x57')](_0x3d25b9[_0x290d('0x58')][_0x290d('0x59')],path[_0x290d('0x5a')](_0x3d25b9[_0x290d('0x58')][_0x290d('0x59')])),'save_name':path['basename'](_0x3d25b9[_0x290d('0x58')]['filename'],path[_0x290d('0x5a')](_0x3d25b9[_0x290d('0x58')]['filename'])),'original_format':path['extname'](_0x3d25b9[_0x290d('0x58')][_0x290d('0x59')])['substring'](0x1),'converted_format':_0x290d('0x5b')};var _0x2071d5=path[_0x290d('0x4d')](config['root'],_0x290d('0x5c'),_0x3d25b9[_0x290d('0x58')][_0x290d('0x5d')]);var _0x11b5cc=path[_0x290d('0x4d')](config[_0x290d('0x4e')],_0x290d('0x4f'),util[_0x290d('0x53')]('%s.%s',path[_0x290d('0x57')](_0x3d25b9[_0x290d('0x58')][_0x290d('0x5d')],path['extname'](_0x3d25b9[_0x290d('0x58')]['filename'])),_0x3e6583[_0x290d('0x50')]));logger[_0x290d('0x5e')](_0x290d('0x5f'),_0x2071d5);logger[_0x290d('0x5e')]('Sound\x20upload\x20destination:\x20%s',_0x11b5cc);try{fs[_0x290d('0x60')](_0x2071d5,parseInt(_0x290d('0x61'),0x8));var _0x50f838=sox['transcode'](_0x2071d5,_0x11b5cc,{'sampleRate':0x1f40,'format':_0x290d('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x50f838['on'](_0x290d('0x62'),function(_0x322c70){fs[_0x290d('0x63')](_0x2071d5);_0x248c43[_0x290d('0x1b')](0x1f4)[_0x290d('0x2c')](_0x322c70);});_0x50f838['on'](_0x290d('0x64'),function(_0x4788e0){_0x3e6583[_0x290d('0x65')]=isNaN(_0x4788e0[_0x290d('0x66')])?null:_0x4788e0[_0x290d('0x66')]*0x3e8;_0x3e6583[_0x290d('0x67')]=isNaN(_0x4788e0[_0x290d('0x68')])?null:_0x4788e0['sampleCount'];_0x3e6583[_0x290d('0x69')]=isNaN(_0x4788e0['channelCount'])?null:_0x4788e0['channelCount'];_0x3e6583[_0x290d('0x6a')]=isNaN(_0x4788e0[_0x290d('0x6b')])?null:_0x4788e0[_0x290d('0x6b')];_0x3e6583[_0x290d('0x6c')]=isNaN(_0x4788e0[_0x290d('0x6d')])?null:_0x4788e0[_0x290d('0x6d')];});_0x50f838['on'](_0x290d('0x6e'),function(_0x51d1f){_0x3e6583[_0x290d('0x6f')]=isNaN(_0x51d1f['duration'])?null:_0x51d1f[_0x290d('0x66')]*0x3e8;_0x3e6583[_0x290d('0x70')]=isNaN(_0x51d1f[_0x290d('0x68')])?null:_0x51d1f[_0x290d('0x68')];_0x3e6583['converted_channelCount']=isNaN(_0x51d1f[_0x290d('0x71')])?null:_0x51d1f[_0x290d('0x71')];_0x3e6583[_0x290d('0x72')]=isNaN(_0x51d1f[_0x290d('0x6b')])?null:_0x51d1f['bitRate'];_0x3e6583[_0x290d('0x73')]=isNaN(_0x51d1f[_0x290d('0x6d')])?null:_0x51d1f[_0x290d('0x6d')];});_0x50f838['on'](_0x290d('0x1c'),function(){fs[_0x290d('0x60')](_0x11b5cc,parseInt(_0x290d('0x61'),0x8));return db[_0x290d('0x2e')][_0x290d('0x56')](_0x3e6583)[_0x290d('0x25')](function(_0x451f93){var _0x5a5d04={'role':_0x3d25b9[_0x290d('0x74')][_0x290d('0x75')],'userProfileId':_0x3d25b9[_0x290d('0x74')][_0x290d('0x76')]};if(!_0x5a5d04)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a5d04[_0x290d('0x75')]==='user'){var _0x3e53af=_0x451f93[_0x290d('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x290d('0x49')]({'where':{'name':_0x290d('0x28'),'userProfileId':_0x5a5d04[_0x290d('0x76')]},'raw':!![]})['then'](function(_0x80c3df){if(_0x80c3df&&_0x80c3df[_0x290d('0x77')]===0x0){return db['UserProfileResource']['create']({'name':_0x3e53af[_0x290d('0x2b')],'resourceId':_0x3e53af['id'],'type':_0x80c3df['name'],'sectionId':_0x80c3df['id']},{})[_0x290d('0x25')](function(){return _0x451f93;});}else{return _0x451f93;}})[_0x290d('0x55')](function(_0x185bc5){logger['error'](_0x290d('0x78'),_0x185bc5);throw _0x185bc5;});}return _0x451f93;})[_0x290d('0x25')](respondWithResult(_0x248c43,null))[_0x290d('0x55')](handleError(_0x248c43,null));});_0x50f838[_0x290d('0x79')]();}catch(_0x1560e2){_0x248c43[_0x290d('0x1b')](0x1f4)[_0x290d('0x2c')](_0x1560e2);}};exports['update']=function(_0x5ddc5f,_0x4ba8ff,_0x54f4b9){return db[_0x290d('0x2e')][_0x290d('0x49')]({'where':{'id':_0x5ddc5f[_0x290d('0x47')]['id']}})[_0x290d('0x25')](handleEntityNotFound(_0x4ba8ff,null))[_0x290d('0x25')](saveUpdates(_[_0x290d('0x3f')](_0x5ddc5f[_0x290d('0x74')],['name',_0x290d('0x7a')]),null))[_0x290d('0x25')](respondWithResult(_0x4ba8ff,null))[_0x290d('0x55')](handleError(_0x4ba8ff,null));};exports[_0x290d('0x7b')]=function(_0x10b744,_0x28887e,_0x1e0a9c){return db['Sound'][_0x290d('0x49')]({'where':{'id':_0x10b744['params']['id']}})['then'](function(_0x984aa3){if(_0x984aa3){return _0x984aa3[_0x290d('0x26')]();}})[_0x290d('0x25')](function(_0x8bd268){var _0x387a21=path['join'](config[_0x290d('0x4e')],_0x290d('0x5c'),util[_0x290d('0x53')](_0x290d('0x54'),_0x8bd268[_0x290d('0x4b')],_0x8bd268[_0x290d('0x7c')]));var _0x4d02c2=path[_0x290d('0x4d')](config[_0x290d('0x4e')],'server/files/sounds/converted',util[_0x290d('0x53')]('%s.%s',_0x8bd268[_0x290d('0x4b')],_0x8bd268[_0x290d('0x50')]));fs[_0x290d('0x63')](_0x387a21);fs[_0x290d('0x63')](_0x4d02c2);return _0x8bd268;})[_0x290d('0x25')](function(_0x29bb88){if(_0x29bb88){return _0x28887e['status'](0xcc)[_0x290d('0x1c')]();}})['then'](handleEntityNotFound(_0x28887e,null))['catch'](handleError(_0x28887e,null));}; \ No newline at end of file +var _0x3d9d=['start','delete','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Sound','rows','catch','params','rawAttributes','download','converted_format','existsSync','join','root','server/files/sounds/converted','Sound\x20not\x20found','%s.%s','save_name','format','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','Sounds','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x42276c,_0x141d47){var _0x1b5009=function(_0x23713f){while(--_0x23713f){_0x42276c['push'](_0x42276c['shift']());}};_0x1b5009(++_0x141d47);}(_0x3d9d,0x161));var _0xd3d9=function(_0x525529,_0x37a273){_0x525529=_0x525529-0x0;var _0x19f9e4=_0x3d9d[_0x525529];return _0x19f9e4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd3d9('0x0'));var jsonpatch=require(_0xd3d9('0x1'));var rp=require(_0xd3d9('0x2'));var moment=require('moment');var BPromise=require(_0xd3d9('0x3'));var Mustache=require(_0xd3d9('0x4'));var util=require('util');var path=require(_0xd3d9('0x5'));var sox=require(_0xd3d9('0x6'));var csv=require(_0xd3d9('0x7'));var ejs=require(_0xd3d9('0x8'));var fs=require('fs');var fs_extra=require(_0xd3d9('0x9'));var _=require(_0xd3d9('0xa'));var squel=require(_0xd3d9('0xb'));var crypto=require(_0xd3d9('0xc'));var jsforce=require(_0xd3d9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd3d9('0x7'));var querystring=require(_0xd3d9('0xe'));var Papa=require('papaparse');var Redis=require(_0xd3d9('0xf'));var authService=require(_0xd3d9('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3d9('0x11'));var logger=require('../../config/logger')(_0xd3d9('0x12'));var utils=require(_0xd3d9('0x13'));var config=require(_0xd3d9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd3d9('0x15'))['db'];function respondWithStatusCode(_0x2b90ce,_0x4bd3be){_0x4bd3be=_0x4bd3be||0xcc;return function(_0x277f6a){if(_0x277f6a){return _0x2b90ce['sendStatus'](_0x4bd3be);}return _0x2b90ce[_0xd3d9('0x16')](_0x4bd3be)['end']();};}function respondWithResult(_0x3276f9,_0x1a03f7){_0x1a03f7=_0x1a03f7||0xc8;return function(_0x4ad252){if(_0x4ad252){return _0x3276f9['status'](_0x1a03f7)[_0xd3d9('0x17')](_0x4ad252);}};}function respondWithFilteredResult(_0x4bb10a,_0x26cf5f){return function(_0x415f1e){if(_0x415f1e){var _0x5355d3=typeof _0x26cf5f[_0xd3d9('0x18')]===_0xd3d9('0x19')&&typeof _0x26cf5f[_0xd3d9('0x1a')]===_0xd3d9('0x19');var _0x1a824d=_0x415f1e[_0xd3d9('0x1b')];var _0x4786e8=_0x5355d3?0x0:_0x26cf5f['offset'];var _0x2e881e=_0x5355d3?_0x415f1e['count']:_0x26cf5f[_0xd3d9('0x18')]+_0x26cf5f[_0xd3d9('0x1a')];var _0xb25773;if(_0x2e881e>=_0x1a824d){_0x2e881e=_0x1a824d;_0xb25773=0xc8;}else{_0xb25773=0xce;}_0x4bb10a[_0xd3d9('0x16')](_0xb25773);return _0x4bb10a[_0xd3d9('0x1c')](_0xd3d9('0x1d'),_0x4786e8+'-'+_0x2e881e+'/'+_0x1a824d)[_0xd3d9('0x17')](_0x415f1e);}return null;};}function patchUpdates(_0x5bb096){return function(_0x11dd8b){try{jsonpatch['apply'](_0x11dd8b,_0x5bb096,!![]);}catch(_0x579552){return BPromise[_0xd3d9('0x1e')](_0x579552);}return _0x11dd8b[_0xd3d9('0x1f')]();};}function saveUpdates(_0x1dad7d,_0x1d9523){return function(_0x11a2a5){if(_0x11a2a5){return _0x11a2a5[_0xd3d9('0x20')](_0x1dad7d)[_0xd3d9('0x21')](function(_0x1970e6){return _0x1970e6;});}return null;};}function removeEntity(_0x4dd0f1,_0x248519){return function(_0x34b84d){if(_0x34b84d){return _0x34b84d[_0xd3d9('0x22')]()[_0xd3d9('0x21')](function(){var _0x4d68a4=_0x34b84d['get']({'plain':!![]});var _0xe52ae='Sounds';return db['UserProfileResource'][_0xd3d9('0x22')]({'where':{'type':_0xe52ae,'resourceId':_0x4d68a4['id']}})[_0xd3d9('0x21')](function(){return _0x34b84d;});})[_0xd3d9('0x21')](function(){_0x4dd0f1['status'](0xcc)[_0xd3d9('0x23')]();});}};}function handleEntityNotFound(_0x261611,_0x16e5b0){return function(_0x3732c7){if(!_0x3732c7){_0x261611[_0xd3d9('0x24')](0x194);}return _0x3732c7;};}function handleError(_0x542ea0,_0x5ee058){_0x5ee058=_0x5ee058||0x1f4;return function(_0x1ef8e6){logger[_0xd3d9('0x25')](_0x1ef8e6[_0xd3d9('0x26')]);if(_0x1ef8e6[_0xd3d9('0x27')]){delete _0x1ef8e6[_0xd3d9('0x27')];}_0x542ea0['status'](_0x5ee058)[_0xd3d9('0x28')](_0x1ef8e6);};}exports[_0xd3d9('0x29')]=function(_0x3aa861,_0x2c44dc){var _0x52cbdb={},_0x45ee04={},_0x5ed97b={'count':0x0,'rows':[]};var _0x5e7491=_[_0xd3d9('0x2a')](db['Sound']['rawAttributes'],function(_0x199dc4){return{'name':_0x199dc4[_0xd3d9('0x2b')],'type':_0x199dc4[_0xd3d9('0x2c')]['key']};});_0x45ee04[_0xd3d9('0x2d')]=_[_0xd3d9('0x2a')](_0x5e7491,_0xd3d9('0x27'));_0x45ee04[_0xd3d9('0x2e')]=_[_0xd3d9('0x2f')](_0x3aa861[_0xd3d9('0x2e')]);_0x45ee04[_0xd3d9('0x30')]=_[_0xd3d9('0x31')](_0x45ee04[_0xd3d9('0x2d')],_0x45ee04[_0xd3d9('0x2e')]);_0x52cbdb['attributes']=_['intersection'](_0x45ee04[_0xd3d9('0x2d')],qs[_0xd3d9('0x32')](_0x3aa861[_0xd3d9('0x2e')][_0xd3d9('0x32')]));_0x52cbdb['attributes']=_0x52cbdb[_0xd3d9('0x33')]['length']?_0x52cbdb['attributes']:_0x45ee04[_0xd3d9('0x2d')];if(!_0x3aa861[_0xd3d9('0x2e')]['hasOwnProperty'](_0xd3d9('0x34'))){_0x52cbdb[_0xd3d9('0x1a')]=qs['limit'](_0x3aa861[_0xd3d9('0x2e')][_0xd3d9('0x1a')]);_0x52cbdb[_0xd3d9('0x18')]=qs[_0xd3d9('0x18')](_0x3aa861[_0xd3d9('0x2e')][_0xd3d9('0x18')]);}_0x52cbdb[_0xd3d9('0x35')]=qs[_0xd3d9('0x36')](_0x3aa861['query'][_0xd3d9('0x36')]);_0x52cbdb[_0xd3d9('0x37')]=qs[_0xd3d9('0x30')](_[_0xd3d9('0x38')](_0x3aa861['query'],_0x45ee04[_0xd3d9('0x30')]),_0x5e7491);if(_0x3aa861[_0xd3d9('0x2e')][_0xd3d9('0x39')]){_0x52cbdb['where']=_[_0xd3d9('0x3a')](_0x52cbdb[_0xd3d9('0x37')],{'$or':_[_0xd3d9('0x2a')](_0x5e7491,function(_0x3e92d7){if(_0x3e92d7[_0xd3d9('0x2c')]!==_0xd3d9('0x3b')){var _0x1937a5={};_0x1937a5[_0x3e92d7[_0xd3d9('0x27')]]={'$like':'%'+_0x3aa861[_0xd3d9('0x2e')]['filter']+'%'};return _0x1937a5;}})});}_0x52cbdb=_[_0xd3d9('0x3a')]({},_0x52cbdb,_0x3aa861[_0xd3d9('0x3c')]);var _0x3fedfc={'where':_0x52cbdb['where']};return db['Sound'][_0xd3d9('0x1b')](_0x3fedfc)[_0xd3d9('0x21')](function(_0x22b0cf){_0x5ed97b[_0xd3d9('0x1b')]=_0x22b0cf;if(_0x3aa861[_0xd3d9('0x2e')][_0xd3d9('0x3d')]){_0x52cbdb[_0xd3d9('0x3e')]=[{'all':!![]}];}return db[_0xd3d9('0x3f')]['findAll'](_0x52cbdb);})[_0xd3d9('0x21')](function(_0xad1236){_0x5ed97b[_0xd3d9('0x40')]=_0xad1236;return _0x5ed97b;})[_0xd3d9('0x21')](respondWithFilteredResult(_0x2c44dc,_0x52cbdb))[_0xd3d9('0x41')](handleError(_0x2c44dc,null));};exports['show']=function(_0x1454a7,_0x3980a9){var _0x39f21={'raw':!![],'where':{'id':_0x1454a7[_0xd3d9('0x42')]['id']}},_0x3bd9c8={};_0x3bd9c8[_0xd3d9('0x2d')]=_[_0xd3d9('0x2f')](db[_0xd3d9('0x3f')][_0xd3d9('0x43')]);_0x3bd9c8[_0xd3d9('0x2e')]=_[_0xd3d9('0x2f')](_0x1454a7[_0xd3d9('0x2e')]);_0x3bd9c8['filters']=_[_0xd3d9('0x31')](_0x3bd9c8[_0xd3d9('0x2d')],_0x3bd9c8['query']);_0x39f21[_0xd3d9('0x33')]=_[_0xd3d9('0x31')](_0x3bd9c8[_0xd3d9('0x2d')],qs[_0xd3d9('0x32')](_0x1454a7[_0xd3d9('0x2e')][_0xd3d9('0x32')]));_0x39f21[_0xd3d9('0x33')]=_0x39f21[_0xd3d9('0x33')]['length']?_0x39f21['attributes']:_0x3bd9c8[_0xd3d9('0x2d')];if(_0x1454a7[_0xd3d9('0x2e')][_0xd3d9('0x3d')]){_0x39f21['include']=[{'all':!![]}];}_0x39f21=_['merge']({},_0x39f21,_0x1454a7[_0xd3d9('0x3c')]);return db['Sound']['find'](_0x39f21)[_0xd3d9('0x21')](handleEntityNotFound(_0x3980a9,null))[_0xd3d9('0x21')](respondWithResult(_0x3980a9,null))[_0xd3d9('0x41')](handleError(_0x3980a9,null));};exports[_0xd3d9('0x44')]=function(_0x563201,_0x3ae5ac,_0x10939e){return db[_0xd3d9('0x3f')]['find']({'where':{'id':_0x563201['params']['id']},'attributes':[_0xd3d9('0x27'),'save_name',_0xd3d9('0x45')],'raw':!![]})['then'](handleEntityNotFound(_0x3ae5ac,null))['then'](function(_0x10b8ab){if(_0x10b8ab){if(!fs[_0xd3d9('0x46')](path[_0xd3d9('0x47')](config[_0xd3d9('0x48')],_0xd3d9('0x49'),_0x10b8ab['save_name']+'.'+_0x10b8ab[_0xd3d9('0x45')]))){throw new db['Sequelize']['ValidationError'](_0xd3d9('0x4a'));}return _0x3ae5ac[_0xd3d9('0x44')](path[_0xd3d9('0x47')](config[_0xd3d9('0x48')],'server/files/sounds/converted',util['format'](_0xd3d9('0x4b'),_0x10b8ab[_0xd3d9('0x4c')],_0x10b8ab[_0xd3d9('0x45')])),util[_0xd3d9('0x4d')](_0xd3d9('0x4b'),_0x10b8ab['name'],_0x10b8ab[_0xd3d9('0x45')]));}return null;})['catch'](handleError(_0x3ae5ac,null));};exports['create']=function(_0x34da7c,_0x33056b,_0x5cb087){var _0x1b8b81={'name':path['basename'](_0x34da7c['file'][_0xd3d9('0x4e')],path[_0xd3d9('0x4f')](_0x34da7c['file']['originalname'])),'save_name':path['basename'](_0x34da7c[_0xd3d9('0x50')][_0xd3d9('0x51')],path['extname'](_0x34da7c[_0xd3d9('0x50')][_0xd3d9('0x51')])),'original_format':path[_0xd3d9('0x4f')](_0x34da7c[_0xd3d9('0x50')][_0xd3d9('0x4e')])[_0xd3d9('0x52')](0x1),'converted_format':_0xd3d9('0x53')};var _0x1c2181=path[_0xd3d9('0x47')](config['root'],_0xd3d9('0x54'),_0x34da7c['file'][_0xd3d9('0x51')]);var _0xea1cbf=path[_0xd3d9('0x47')](config[_0xd3d9('0x48')],_0xd3d9('0x49'),util[_0xd3d9('0x4d')](_0xd3d9('0x4b'),path['basename'](_0x34da7c[_0xd3d9('0x50')][_0xd3d9('0x51')],path[_0xd3d9('0x4f')](_0x34da7c[_0xd3d9('0x50')][_0xd3d9('0x51')])),_0x1b8b81['converted_format']));logger[_0xd3d9('0x55')](_0xd3d9('0x56'),_0x1c2181);logger[_0xd3d9('0x55')](_0xd3d9('0x57'),_0xea1cbf);try{fs['chmodSync'](_0x1c2181,parseInt(_0xd3d9('0x58'),0x8));var _0xf7c361=sox[_0xd3d9('0x59')](_0x1c2181,_0xea1cbf,{'sampleRate':0x1f40,'format':_0xd3d9('0x53'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf7c361['on'](_0xd3d9('0x25'),function(_0x49ef10){fs[_0xd3d9('0x5a')](_0x1c2181);_0x33056b['status'](0x1f4)[_0xd3d9('0x28')](_0x49ef10);});_0xf7c361['on']('src',function(_0x403ff7){_0x1b8b81[_0xd3d9('0x5b')]=isNaN(_0x403ff7['duration'])?null:_0x403ff7[_0xd3d9('0x5c')]*0x3e8;_0x1b8b81['original_sampleCount']=isNaN(_0x403ff7['sampleCount'])?null:_0x403ff7[_0xd3d9('0x5d')];_0x1b8b81['original_channelCount']=isNaN(_0x403ff7[_0xd3d9('0x5e')])?null:_0x403ff7['channelCount'];_0x1b8b81[_0xd3d9('0x5f')]=isNaN(_0x403ff7[_0xd3d9('0x60')])?null:_0x403ff7[_0xd3d9('0x60')];_0x1b8b81['original_sampleRate']=isNaN(_0x403ff7['sampleRate'])?null:_0x403ff7[_0xd3d9('0x61')];});_0xf7c361['on'](_0xd3d9('0x62'),function(_0x4e4345){_0x1b8b81[_0xd3d9('0x63')]=isNaN(_0x4e4345[_0xd3d9('0x5c')])?null:_0x4e4345[_0xd3d9('0x5c')]*0x3e8;_0x1b8b81[_0xd3d9('0x64')]=isNaN(_0x4e4345[_0xd3d9('0x5d')])?null:_0x4e4345[_0xd3d9('0x5d')];_0x1b8b81[_0xd3d9('0x65')]=isNaN(_0x4e4345[_0xd3d9('0x5e')])?null:_0x4e4345[_0xd3d9('0x5e')];_0x1b8b81[_0xd3d9('0x66')]=isNaN(_0x4e4345['bitRate'])?null:_0x4e4345[_0xd3d9('0x60')];_0x1b8b81[_0xd3d9('0x67')]=isNaN(_0x4e4345[_0xd3d9('0x61')])?null:_0x4e4345[_0xd3d9('0x61')];});_0xf7c361['on'](_0xd3d9('0x23'),function(){fs[_0xd3d9('0x68')](_0xea1cbf,parseInt(_0xd3d9('0x58'),0x8));return db['Sound']['create'](_0x1b8b81)[_0xd3d9('0x21')](function(_0x53a0ac){var _0x2e3f28={'role':_0x34da7c[_0xd3d9('0x69')][_0xd3d9('0x6a')],'userProfileId':_0x34da7c[_0xd3d9('0x69')][_0xd3d9('0x6b')]};if(!_0x2e3f28)throw new Error(_0xd3d9('0x6c'));if(_0x2e3f28[_0xd3d9('0x6a')]===_0xd3d9('0x6d')){var _0x3e8731=_0x53a0ac['get']({'plain':!![]});return db['UserProfileSection'][_0xd3d9('0x6e')]({'where':{'name':_0xd3d9('0x6f'),'userProfileId':_0x2e3f28['userProfileId']},'raw':!![]})[_0xd3d9('0x21')](function(_0x359d3e){if(_0x359d3e&&_0x359d3e['autoAssociation']===0x0){return db[_0xd3d9('0x70')][_0xd3d9('0x71')]({'name':_0x3e8731[_0xd3d9('0x27')],'resourceId':_0x3e8731['id'],'type':_0x359d3e[_0xd3d9('0x27')],'sectionId':_0x359d3e['id']},{})[_0xd3d9('0x21')](function(){return _0x53a0ac;});}else{return _0x53a0ac;}})[_0xd3d9('0x41')](function(_0xc6e4c1){logger[_0xd3d9('0x25')](_0xd3d9('0x72'),_0xc6e4c1);throw _0xc6e4c1;});}return _0x53a0ac;})[_0xd3d9('0x21')](respondWithResult(_0x33056b,null))[_0xd3d9('0x41')](handleError(_0x33056b,null));});_0xf7c361[_0xd3d9('0x73')]();}catch(_0x44421d){_0x33056b[_0xd3d9('0x16')](0x1f4)['send'](_0x44421d);}};exports[_0xd3d9('0x20')]=function(_0xc90b95,_0x1b45f7,_0x243281){return db['Sound'][_0xd3d9('0x6e')]({'where':{'id':_0xc90b95[_0xd3d9('0x42')]['id']}})[_0xd3d9('0x21')](handleEntityNotFound(_0x1b45f7,null))[_0xd3d9('0x21')](saveUpdates(_[_0xd3d9('0x38')](_0xc90b95[_0xd3d9('0x69')],[_0xd3d9('0x27'),'description']),null))[_0xd3d9('0x21')](respondWithResult(_0x1b45f7,null))['catch'](handleError(_0x1b45f7,null));};exports[_0xd3d9('0x74')]=function(_0x57c97f,_0x540228,_0x3befcd){return db[_0xd3d9('0x3f')][_0xd3d9('0x6e')]({'where':{'id':_0x57c97f['params']['id']}})['then'](function(_0x12e75f){if(_0x12e75f){return _0x12e75f[_0xd3d9('0x22')]();}})['then'](function(_0x4d7751){var _0x284a0d=path[_0xd3d9('0x47')](config['root'],_0xd3d9('0x54'),util[_0xd3d9('0x4d')](_0xd3d9('0x4b'),_0x4d7751[_0xd3d9('0x4c')],_0x4d7751['original_format']));var _0x559bbd=path[_0xd3d9('0x47')](config[_0xd3d9('0x48')],_0xd3d9('0x49'),util[_0xd3d9('0x4d')](_0xd3d9('0x4b'),_0x4d7751[_0xd3d9('0x4c')],_0x4d7751['converted_format']));fs['unlinkSync'](_0x284a0d);fs[_0xd3d9('0x5a')](_0x559bbd);return _0x4d7751;})['then'](function(_0x17945d){if(_0x17945d){return _0x540228[_0xd3d9('0x16')](0xcc)[_0xd3d9('0x23')]();}})['then'](handleEntityNotFound(_0x540228,null))[_0xd3d9('0x41')](handleError(_0x540228,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 9593c04..ef24282 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 _0xec9c=['../../config/logger','bluebird','request-promise','path','rimraf','./sound.attributes','exports','Sound','tools_sounds','lodash','util'];(function(_0x14b767,_0x577e84){var _0x22267a=function(_0xa87ebc){while(--_0xa87ebc){_0x14b767['push'](_0x14b767['shift']());}};_0x22267a(++_0x577e84);}(_0xec9c,0x15e));var _0xcec9=function(_0x53d97d,_0x5267e7){_0x53d97d=_0x53d97d-0x0;var _0x381d0e=_0xec9c[_0x53d97d];return _0x381d0e;};'use strict';var _=require(_0xcec9('0x0'));var util=require(_0xcec9('0x1'));var logger=require(_0xcec9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcec9('0x3'));var rp=require(_0xcec9('0x4'));var fs=require('fs');var path=require(_0xcec9('0x5'));var rimraf=require(_0xcec9('0x6'));var config=require('../../config/environment');var attributes=require(_0xcec9('0x7'));module[_0xcec9('0x8')]=function(_0x4c4f33,_0x556eba){return _0x4c4f33['define'](_0xcec9('0x9'),attributes,{'tableName':_0xcec9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5112=['Sound','api','moment','bluebird','request-promise','path','./sound.attributes','exports','define'];(function(_0x187790,_0x2a083b){var _0x472705=function(_0x22d9b4){while(--_0x22d9b4){_0x187790['push'](_0x187790['shift']());}};_0x472705(++_0x2a083b);}(_0x5112,0xeb));var _0x2511=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0x5112[_0x188703];return _0x1a0c81;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2511('0x0'));var moment=require(_0x2511('0x1'));var BPromise=require(_0x2511('0x2'));var rp=require(_0x2511('0x3'));var fs=require('fs');var path=require(_0x2511('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2511('0x5'));module[_0x2511('0x6')]=function(_0x1b8298,_0x4527c6){return _0x1b8298[_0x2511('0x7')](_0x2511('0x8'),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 421b302..b103038 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 _0xda16=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','catch','Sound','options','attributes','model','include','map','then','ShowSound','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xda16,0x17a));var _0x6da1=function(_0x1283ad,_0x33c0e0){_0x1283ad=_0x1283ad-0x0;var _0x12afe0=_0xda16[_0x1283ad];return _0x12afe0;};'use strict';var _=require(_0x6da1('0x0'));var util=require('util');var moment=require(_0x6da1('0x1'));var BPromise=require(_0x6da1('0x2'));var rs=require(_0x6da1('0x3'));var fs=require('fs');var Redis=require(_0x6da1('0x4'));var db=require(_0x6da1('0x5'))['db'];var utils=require(_0x6da1('0x6'));var logger=require(_0x6da1('0x7'))(_0x6da1('0x8'));var config=require(_0x6da1('0x9'));var jayson=require(_0x6da1('0xa'));var client=jayson[_0x6da1('0xb')][_0x6da1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x339c0e,_0x1eb623,_0x58a7ef){return new BPromise(function(_0x34c8dd,_0x4d92d8){return client[_0x6da1('0xd')](_0x339c0e,_0x58a7ef)['then'](function(_0x1ac781){logger[_0x6da1('0xe')](_0x6da1('0xf'),_0x1eb623,_0x6da1('0x10'));logger[_0x6da1('0x11')](_0x6da1('0x12'),_0x1eb623,_0x6da1('0x10'),JSON['stringify'](_0x1ac781));if(_0x1ac781['error']){if(_0x1ac781[_0x6da1('0x13')][_0x6da1('0x14')]===0x1f4){logger[_0x6da1('0x13')](_0x6da1('0xf'),_0x1eb623,_0x1ac781[_0x6da1('0x13')][_0x6da1('0x15')]);return _0x4d92d8(_0x1ac781[_0x6da1('0x13')]['message']);}logger[_0x6da1('0x13')](_0x6da1('0xf'),_0x1eb623,_0x1ac781[_0x6da1('0x13')][_0x6da1('0x15')]);return _0x34c8dd(_0x1ac781[_0x6da1('0x13')]['message']);}else{logger[_0x6da1('0xe')](_0x6da1('0xf'),_0x1eb623,_0x6da1('0x10'));_0x34c8dd(_0x1ac781['result'][_0x6da1('0x15')]);}})[_0x6da1('0x16')](function(_0xb44a19){logger[_0x6da1('0x13')](_0x6da1('0xf'),_0x1eb623,_0xb44a19);_0x4d92d8(_0xb44a19);});});}exports['ShowSound']=function(_0x633d39){var _0x1907c1=this;return new Promise(function(_0x5bd591,_0x251595){return db[_0x6da1('0x17')]['find']({'raw':_0x633d39[_0x6da1('0x18')]?_0x633d39[_0x6da1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x633d39[_0x6da1('0x18')]?_0x633d39[_0x6da1('0x18')]['where']||null:null,'attributes':_0x633d39[_0x6da1('0x18')]?_0x633d39[_0x6da1('0x18')][_0x6da1('0x19')]||null:null,'include':_0x633d39['options']?_0x633d39[_0x6da1('0x18')]['include']?_['map'](_0x633d39[_0x6da1('0x18')]['include'],function(_0x1aee47){return{'model':db[_0x1aee47[_0x6da1('0x1a')]],'as':_0x1aee47['as'],'attributes':_0x1aee47['attributes'],'include':_0x1aee47[_0x6da1('0x1b')]?_[_0x6da1('0x1c')](_0x1aee47[_0x6da1('0x1b')],function(_0x4d211c){return{'model':db[_0x4d211c['model']],'as':_0x4d211c['as'],'attributes':_0x4d211c[_0x6da1('0x19')],'include':_0x4d211c[_0x6da1('0x1b')]?_[_0x6da1('0x1c')](_0x4d211c[_0x6da1('0x1b')],function(_0x1eec8c){return{'model':db[_0x1eec8c['model']],'as':_0x1eec8c['as'],'attributes':_0x1eec8c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6da1('0x1d')](function(_0x508062){logger[_0x6da1('0xe')]('ShowSound',_0x633d39);logger[_0x6da1('0x11')](_0x6da1('0x1e'),_0x633d39,JSON[_0x6da1('0x1f')](_0x508062));_0x5bd591(_0x508062);})['catch'](function(_0x39b497){logger[_0x6da1('0x13')](_0x6da1('0x1e'),_0x39b497[_0x6da1('0x15')],_0x633d39);_0x251595(_0x1907c1[_0x6da1('0x13')](0x1f4,_0x39b497['message']));});});}; \ No newline at end of file +var _0x9ac1=['util','moment','ioredis','request','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Sound','options','attributes','map','include','model','info','ShowSound','debug'];(function(_0x3246d0,_0x543c60){var _0x41727a=function(_0x221fe9){while(--_0x221fe9){_0x3246d0['push'](_0x3246d0['shift']());}};_0x41727a(++_0x543c60);}(_0x9ac1,0x1a2));var _0x19ac=function(_0x47b165,_0x117089){_0x47b165=_0x47b165-0x0;var _0x3b2414=_0x9ac1[_0x47b165];return _0x3b2414;};'use strict';var _=require('lodash');var util=require(_0x19ac('0x0'));var moment=require(_0x19ac('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19ac('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51d0ba,_0x516675,_0x563293){return new BPromise(function(_0xa12627,_0x23638f){return client[_0x19ac('0x3')](_0x51d0ba,_0x563293)[_0x19ac('0x4')](function(_0x106413){logger['info'](_0x19ac('0x5'),_0x516675,_0x19ac('0x6'));logger['debug'](_0x19ac('0x7'),_0x516675,_0x19ac('0x6'),JSON[_0x19ac('0x8')](_0x106413));if(_0x106413[_0x19ac('0x9')]){if(_0x106413['error']['code']===0x1f4){logger[_0x19ac('0x9')](_0x19ac('0x5'),_0x516675,_0x106413[_0x19ac('0x9')]['message']);return _0x23638f(_0x106413[_0x19ac('0x9')][_0x19ac('0xa')]);}logger[_0x19ac('0x9')](_0x19ac('0x5'),_0x516675,_0x106413[_0x19ac('0x9')][_0x19ac('0xa')]);return _0xa12627(_0x106413[_0x19ac('0x9')][_0x19ac('0xa')]);}else{logger['info'](_0x19ac('0x5'),_0x516675,'request\x20sent');_0xa12627(_0x106413[_0x19ac('0xb')]['message']);}})[_0x19ac('0xc')](function(_0x1ae822){logger[_0x19ac('0x9')](_0x19ac('0x5'),_0x516675,_0x1ae822);_0x23638f(_0x1ae822);});});}exports['ShowSound']=function(_0x2139f9){var _0x44d715=this;return new Promise(function(_0x189404,_0x1cc822){return db[_0x19ac('0xd')]['find']({'raw':_0x2139f9[_0x19ac('0xe')]?_0x2139f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x2139f9[_0x19ac('0xe')]?_0x2139f9[_0x19ac('0xe')]['where']||null:null,'attributes':_0x2139f9[_0x19ac('0xe')]?_0x2139f9['options'][_0x19ac('0xf')]||null:null,'include':_0x2139f9[_0x19ac('0xe')]?_0x2139f9['options']['include']?_[_0x19ac('0x10')](_0x2139f9['options'][_0x19ac('0x11')],function(_0x778768){return{'model':db[_0x778768['model']],'as':_0x778768['as'],'attributes':_0x778768[_0x19ac('0xf')],'include':_0x778768[_0x19ac('0x11')]?_[_0x19ac('0x10')](_0x778768[_0x19ac('0x11')],function(_0x1ce3f6){return{'model':db[_0x1ce3f6[_0x19ac('0x12')]],'as':_0x1ce3f6['as'],'attributes':_0x1ce3f6[_0x19ac('0xf')],'include':_0x1ce3f6[_0x19ac('0x11')]?_[_0x19ac('0x10')](_0x1ce3f6[_0x19ac('0x11')],function(_0x5a22be){return{'model':db[_0x5a22be[_0x19ac('0x12')]],'as':_0x5a22be['as'],'attributes':_0x5a22be[_0x19ac('0xf')]};}):[]};}):[]};}):[]:[]})[_0x19ac('0x4')](function(_0x43b651){logger[_0x19ac('0x13')](_0x19ac('0x14'),_0x2139f9);logger[_0x19ac('0x15')]('ShowSound',_0x2139f9,JSON['stringify'](_0x43b651));_0x189404(_0x43b651);})[_0x19ac('0xc')](function(_0xe3f764){logger[_0x19ac('0x9')](_0x19ac('0x14'),_0xe3f764[_0x19ac('0xa')],_0x2139f9);_0x1cc822(_0x44d715[_0x19ac('0x9')](0x1f4,_0xe3f764[_0x19ac('0xa')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 060cd50..5fdbc3a 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x3b9d79,_0x42f721){var _0x16d93e=function(_0x15d370){while(--_0x15d370){_0x3b9d79['push'](_0x3b9d79['shift']());}};_0x16d93e(++_0x42f721);}(_0xda2d,0x102));var _0xdda2=function(_0x13b7c7,_0x3ad9d4){_0x13b7c7=_0x13b7c7-0x0;var _0x4f41c3=_0xda2d[_0x13b7c7];return _0x4f41c3;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x54c60d,_0x17ccfa){var _0x407205=function(_0x2fb1da){while(--_0x2fb1da){_0x54c60d['push'](_0x54c60d['shift']());}};_0x407205(++_0x17ccfa);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb7e7[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 4e3432a..bb1416b 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 _0x2d15=['TEXT','exports','STRING','medium','ENUM','out'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d15,0x85));var _0x52d1=function(_0x52ec73,_0x219fec){_0x52ec73=_0x52ec73-0x0;var _0x2f5a30=_0x2d15[_0x52ec73];return _0x2f5a30;};'use strict';var Sequelize=require('sequelize');module[_0x52d1('0x0')]={'uniqueid':{'type':Sequelize[_0x52d1('0x1')]},'body':{'type':Sequelize['TEXT'](_0x52d1('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x52d1('0x3')]('in',_0x52d1('0x4')),'defaultValue':_0x52d1('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x52d1('0x5')]}}; \ No newline at end of file +var _0xc374=['out','sequelize','exports','STRING'];(function(_0x1d9fea,_0x5b5d7a){var _0x262d74=function(_0x45ff54){while(--_0x45ff54){_0x1d9fea['push'](_0x1d9fea['shift']());}};_0x262d74(++_0x5b5d7a);}(_0xc374,0xa9));var _0x4c37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc374[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4c37('0x0'));module[_0x4c37('0x1')]={'uniqueid':{'type':Sequelize[_0x4c37('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4c37('0x3')),'defaultValue':_0x4c37('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4c37('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 63ea04c..a49d2ab 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 _0xd8a2=['path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd8a2,0x128));var _0x2d8a=function(_0x147bc8,_0x1c6991){_0x147bc8=_0x147bc8-0x0;var _0x22e6a8=_0xd8a2[_0x147bc8];return _0x22e6a8;};'use strict';var emlformat=require(_0x2d8a('0x0'));var rimraf=require(_0x2d8a('0x1'));var zipdir=require(_0x2d8a('0x2'));var jsonpatch=require(_0x2d8a('0x3'));var rp=require(_0x2d8a('0x4'));var moment=require(_0x2d8a('0x5'));var BPromise=require(_0x2d8a('0x6'));var Mustache=require('mustache');var util=require(_0x2d8a('0x7'));var path=require(_0x2d8a('0x8'));var sox=require('sox');var csv=require(_0x2d8a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d8a('0xa'));var _=require('lodash');var squel=require(_0x2d8a('0xb'));var crypto=require(_0x2d8a('0xc'));var jsforce=require(_0x2d8a('0xd'));var deskjs=require(_0x2d8a('0xe'));var toCsv=require(_0x2d8a('0x9'));var querystring=require(_0x2d8a('0xf'));var Papa=require(_0x2d8a('0x10'));var Redis=require(_0x2d8a('0x11'));var authService=require(_0x2d8a('0x12'));var qs=require(_0x2d8a('0x13'));var as=require(_0x2d8a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d8a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2d8a('0x16'));var licenseUtil=require(_0x2d8a('0x17'));var db=require(_0x2d8a('0x18'))['db'];function respondWithStatusCode(_0x406eb2,_0x2c698b){_0x2c698b=_0x2c698b||0xcc;return function(_0x12f819){if(_0x12f819){return _0x406eb2[_0x2d8a('0x19')](_0x2c698b);}return _0x406eb2[_0x2d8a('0x1a')](_0x2c698b)[_0x2d8a('0x1b')]();};}function respondWithResult(_0xdac34c,_0x63f53){_0x63f53=_0x63f53||0xc8;return function(_0x2c6e94){if(_0x2c6e94){return _0xdac34c['status'](_0x63f53)[_0x2d8a('0x1c')](_0x2c6e94);}};}function respondWithFilteredResult(_0x1763d6,_0x5bc042){return function(_0x5c7f74){if(_0x5c7f74){var _0x45218a=typeof _0x5bc042[_0x2d8a('0x1d')]===_0x2d8a('0x1e')&&typeof _0x5bc042[_0x2d8a('0x1f')]==='undefined';var _0x2aa33d=_0x5c7f74['count'];var _0x3147b9=_0x45218a?0x0:_0x5bc042['offset'];var _0x2b0291=_0x45218a?_0x5c7f74[_0x2d8a('0x20')]:_0x5bc042[_0x2d8a('0x1d')]+_0x5bc042[_0x2d8a('0x1f')];var _0xab6753;if(_0x2b0291>=_0x2aa33d){_0x2b0291=_0x2aa33d;_0xab6753=0xc8;}else{_0xab6753=0xce;}_0x1763d6['status'](_0xab6753);return _0x1763d6[_0x2d8a('0x21')](_0x2d8a('0x22'),_0x3147b9+'-'+_0x2b0291+'/'+_0x2aa33d)[_0x2d8a('0x1c')](_0x5c7f74);}return null;};}function patchUpdates(_0x2d5830){return function(_0x10e836){try{jsonpatch[_0x2d8a('0x23')](_0x10e836,_0x2d5830,!![]);}catch(_0x45f97b){return BPromise[_0x2d8a('0x24')](_0x45f97b);}return _0x10e836[_0x2d8a('0x25')]();};}function saveUpdates(_0x333298,_0x3b8e0e){return function(_0x15567f){if(_0x15567f){return _0x15567f[_0x2d8a('0x26')](_0x333298)[_0x2d8a('0x27')](function(_0x463774){return _0x463774;});}return null;};}function removeEntity(_0x5c622b,_0x137c4d){return function(_0x31a036){if(_0x31a036){return _0x31a036[_0x2d8a('0x28')]()['then'](function(){_0x5c622b[_0x2d8a('0x1a')](0xcc)[_0x2d8a('0x1b')]();});}};}function handleEntityNotFound(_0x3574e0,_0x2c47c1){return function(_0x3400bf){if(!_0x3400bf){_0x3574e0['sendStatus'](0x194);}return _0x3400bf;};}function handleError(_0x9c97bf,_0x28a22b){_0x28a22b=_0x28a22b||0x1f4;return function(_0x1ac19d){logger['error'](_0x1ac19d[_0x2d8a('0x29')]);if(_0x1ac19d[_0x2d8a('0x2a')]){delete _0x1ac19d[_0x2d8a('0x2a')];}_0x9c97bf[_0x2d8a('0x1a')](_0x28a22b)[_0x2d8a('0x2b')](_0x1ac19d);};}exports[_0x2d8a('0x2c')]=function(_0x1a4750,_0x504841){var _0x1d787d={},_0x3a5b2b={},_0x182148={'count':0x0,'rows':[]};var _0x16bd5a=_['map'](db[_0x2d8a('0x2d')][_0x2d8a('0x2e')],function(_0x5beac0){return{'name':_0x5beac0[_0x2d8a('0x2f')],'type':_0x5beac0[_0x2d8a('0x30')][_0x2d8a('0x31')]};});_0x3a5b2b[_0x2d8a('0x32')]=_['map'](_0x16bd5a,'name');_0x3a5b2b[_0x2d8a('0x33')]=_[_0x2d8a('0x34')](_0x1a4750['query']);_0x3a5b2b[_0x2d8a('0x35')]=_[_0x2d8a('0x36')](_0x3a5b2b[_0x2d8a('0x32')],_0x3a5b2b['query']);_0x1d787d[_0x2d8a('0x37')]=_['intersection'](_0x3a5b2b[_0x2d8a('0x32')],qs[_0x2d8a('0x38')](_0x1a4750[_0x2d8a('0x33')][_0x2d8a('0x38')]));_0x1d787d[_0x2d8a('0x37')]=_0x1d787d[_0x2d8a('0x37')][_0x2d8a('0x39')]?_0x1d787d[_0x2d8a('0x37')]:_0x3a5b2b['model'];if(!_0x1a4750[_0x2d8a('0x33')]['hasOwnProperty'](_0x2d8a('0x3a'))){_0x1d787d[_0x2d8a('0x1f')]=qs[_0x2d8a('0x1f')](_0x1a4750[_0x2d8a('0x33')][_0x2d8a('0x1f')]);_0x1d787d[_0x2d8a('0x1d')]=qs['offset'](_0x1a4750[_0x2d8a('0x33')]['offset']);}_0x1d787d[_0x2d8a('0x3b')]=qs[_0x2d8a('0x3c')](_0x1a4750[_0x2d8a('0x33')][_0x2d8a('0x3c')]);_0x1d787d[_0x2d8a('0x3d')]=qs[_0x2d8a('0x35')](_[_0x2d8a('0x3e')](_0x1a4750[_0x2d8a('0x33')],_0x3a5b2b['filters']),_0x16bd5a);if(_0x1a4750[_0x2d8a('0x33')][_0x2d8a('0x3f')]){_0x1d787d[_0x2d8a('0x3d')]=_[_0x2d8a('0x40')](_0x1d787d[_0x2d8a('0x3d')],{'$or':_[_0x2d8a('0x41')](_0x16bd5a,function(_0x3abf6d){if(_0x3abf6d['type']!=='VIRTUAL'){var _0x1e299f={};_0x1e299f[_0x3abf6d[_0x2d8a('0x2a')]]={'$like':'%'+_0x1a4750[_0x2d8a('0x33')][_0x2d8a('0x3f')]+'%'};return _0x1e299f;}})});}_0x1d787d=_[_0x2d8a('0x40')]({},_0x1d787d,_0x1a4750[_0x2d8a('0x42')]);var _0x29b44e={'where':_0x1d787d[_0x2d8a('0x3d')]};return db['SquareMessage']['count'](_0x29b44e)[_0x2d8a('0x27')](function(_0x92ee8a){_0x182148['count']=_0x92ee8a;if(_0x1a4750[_0x2d8a('0x33')][_0x2d8a('0x43')]){_0x1d787d[_0x2d8a('0x44')]=[{'all':!![]}];}return db[_0x2d8a('0x2d')][_0x2d8a('0x45')](_0x1d787d);})[_0x2d8a('0x27')](function(_0xcbb2ef){_0x182148[_0x2d8a('0x46')]=_0xcbb2ef;return _0x182148;})[_0x2d8a('0x27')](respondWithFilteredResult(_0x504841,_0x1d787d))[_0x2d8a('0x47')](handleError(_0x504841,null));};exports['show']=function(_0x1605ad,_0x5bded4){var _0x44d9e6={'raw':!![],'where':{'id':_0x1605ad[_0x2d8a('0x48')]['id']}},_0x3107b3={};_0x3107b3[_0x2d8a('0x32')]=_['keys'](db[_0x2d8a('0x2d')][_0x2d8a('0x2e')]);_0x3107b3[_0x2d8a('0x33')]=_[_0x2d8a('0x34')](_0x1605ad['query']);_0x3107b3['filters']=_[_0x2d8a('0x36')](_0x3107b3[_0x2d8a('0x32')],_0x3107b3[_0x2d8a('0x33')]);_0x44d9e6[_0x2d8a('0x37')]=_['intersection'](_0x3107b3['model'],qs['fields'](_0x1605ad[_0x2d8a('0x33')][_0x2d8a('0x38')]));_0x44d9e6[_0x2d8a('0x37')]=_0x44d9e6[_0x2d8a('0x37')]['length']?_0x44d9e6[_0x2d8a('0x37')]:_0x3107b3[_0x2d8a('0x32')];if(_0x1605ad[_0x2d8a('0x33')][_0x2d8a('0x43')]){_0x44d9e6[_0x2d8a('0x44')]=[{'all':!![]}];}_0x44d9e6=_[_0x2d8a('0x40')]({},_0x44d9e6,_0x1605ad['options']);return db[_0x2d8a('0x2d')][_0x2d8a('0x49')](_0x44d9e6)['then'](handleEntityNotFound(_0x5bded4,null))['then'](respondWithResult(_0x5bded4,null))[_0x2d8a('0x47')](handleError(_0x5bded4,null));};exports[_0x2d8a('0x4a')]=function(_0x51fe6e,_0x53ad24){return db[_0x2d8a('0x2d')]['create'](_0x51fe6e[_0x2d8a('0x4b')],{})[_0x2d8a('0x27')](respondWithResult(_0x53ad24,0xc9))[_0x2d8a('0x47')](handleError(_0x53ad24,null));};exports[_0x2d8a('0x26')]=function(_0x4a3732,_0x426205){if(_0x4a3732[_0x2d8a('0x4b')]['id']){delete _0x4a3732[_0x2d8a('0x4b')]['id'];}return db['SquareMessage'][_0x2d8a('0x49')]({'where':{'id':_0x4a3732[_0x2d8a('0x48')]['id']}})[_0x2d8a('0x27')](handleEntityNotFound(_0x426205,null))[_0x2d8a('0x27')](saveUpdates(_0x4a3732[_0x2d8a('0x4b')],null))[_0x2d8a('0x27')](respondWithResult(_0x426205,null))['catch'](handleError(_0x426205,null));};exports[_0x2d8a('0x28')]=function(_0x3b5324,_0x3f1cb9){return db[_0x2d8a('0x2d')][_0x2d8a('0x49')]({'where':{'id':_0x3b5324['params']['id']}})[_0x2d8a('0x27')](handleEntityNotFound(_0x3f1cb9,null))[_0x2d8a('0x27')](removeEntity(_0x3f1cb9,null))[_0x2d8a('0x47')](handleError(_0x3f1cb9,null));}; \ No newline at end of file +var _0x61e6=['map','SquareMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','keys','create','update','body','find','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index'];(function(_0x39bba7,_0x1f065b){var _0x54aa6e=function(_0x2ee05e){while(--_0x2ee05e){_0x39bba7['push'](_0x39bba7['shift']());}};_0x54aa6e(++_0x1f065b);}(_0x61e6,0x10c));var _0x661e=function(_0xbf5571,_0x4ca005){_0xbf5571=_0xbf5571-0x0;var _0x411439=_0x61e6[_0xbf5571];return _0x411439;};'use strict';var emlformat=require(_0x661e('0x0'));var rimraf=require(_0x661e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x661e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x661e('0x3'));var Mustache=require('mustache');var util=require(_0x661e('0x4'));var path=require(_0x661e('0x5'));var sox=require(_0x661e('0x6'));var csv=require(_0x661e('0x7'));var ejs=require(_0x661e('0x8'));var fs=require('fs');var fs_extra=require(_0x661e('0x9'));var _=require(_0x661e('0xa'));var squel=require(_0x661e('0xb'));var crypto=require(_0x661e('0xc'));var jsforce=require(_0x661e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x661e('0x7'));var querystring=require(_0x661e('0xe'));var Papa=require(_0x661e('0xf'));var Redis=require(_0x661e('0x10'));var authService=require(_0x661e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x661e('0x12'));var logger=require(_0x661e('0x13'))(_0x661e('0x14'));var utils=require(_0x661e('0x15'));var config=require(_0x661e('0x16'));var licenseUtil=require(_0x661e('0x17'));var db=require(_0x661e('0x18'))['db'];function respondWithStatusCode(_0x11e240,_0xb591fd){_0xb591fd=_0xb591fd||0xcc;return function(_0x40f9b0){if(_0x40f9b0){return _0x11e240[_0x661e('0x19')](_0xb591fd);}return _0x11e240['status'](_0xb591fd)[_0x661e('0x1a')]();};}function respondWithResult(_0x4a786b,_0x4fd520){_0x4fd520=_0x4fd520||0xc8;return function(_0x415644){if(_0x415644){return _0x4a786b['status'](_0x4fd520)[_0x661e('0x1b')](_0x415644);}};}function respondWithFilteredResult(_0x4364f1,_0x329dc9){return function(_0x4fd65c){if(_0x4fd65c){var _0x4bef93=typeof _0x329dc9[_0x661e('0x1c')]===_0x661e('0x1d')&&typeof _0x329dc9[_0x661e('0x1e')]===_0x661e('0x1d');var _0x5bae17=_0x4fd65c[_0x661e('0x1f')];var _0x240b01=_0x4bef93?0x0:_0x329dc9[_0x661e('0x1c')];var _0x43920e=_0x4bef93?_0x4fd65c[_0x661e('0x1f')]:_0x329dc9['offset']+_0x329dc9[_0x661e('0x1e')];var _0x151cdc;if(_0x43920e>=_0x5bae17){_0x43920e=_0x5bae17;_0x151cdc=0xc8;}else{_0x151cdc=0xce;}_0x4364f1[_0x661e('0x20')](_0x151cdc);return _0x4364f1[_0x661e('0x21')](_0x661e('0x22'),_0x240b01+'-'+_0x43920e+'/'+_0x5bae17)[_0x661e('0x1b')](_0x4fd65c);}return null;};}function patchUpdates(_0x291df8){return function(_0x294fba){try{jsonpatch[_0x661e('0x23')](_0x294fba,_0x291df8,!![]);}catch(_0xd95279){return BPromise[_0x661e('0x24')](_0xd95279);}return _0x294fba['save']();};}function saveUpdates(_0x2322ab,_0x3ee54b){return function(_0x593380){if(_0x593380){return _0x593380['update'](_0x2322ab)[_0x661e('0x25')](function(_0x20e86c){return _0x20e86c;});}return null;};}function removeEntity(_0x3f67e6,_0x552376){return function(_0x3827ad){if(_0x3827ad){return _0x3827ad[_0x661e('0x26')]()[_0x661e('0x25')](function(){_0x3f67e6[_0x661e('0x20')](0xcc)[_0x661e('0x1a')]();});}};}function handleEntityNotFound(_0x2df6e4,_0x1ae201){return function(_0x471840){if(!_0x471840){_0x2df6e4['sendStatus'](0x194);}return _0x471840;};}function handleError(_0x500cc1,_0x46af6c){_0x46af6c=_0x46af6c||0x1f4;return function(_0x435fb4){logger[_0x661e('0x27')](_0x435fb4[_0x661e('0x28')]);if(_0x435fb4[_0x661e('0x29')]){delete _0x435fb4[_0x661e('0x29')];}_0x500cc1['status'](_0x46af6c)[_0x661e('0x2a')](_0x435fb4);};}exports[_0x661e('0x2b')]=function(_0x2ae2d1,_0x5b07d5){var _0x181277={},_0x11581d={},_0x3b362f={'count':0x0,'rows':[]};var _0xdc9b2e=_[_0x661e('0x2c')](db[_0x661e('0x2d')][_0x661e('0x2e')],function(_0x1912d7){return{'name':_0x1912d7[_0x661e('0x2f')],'type':_0x1912d7[_0x661e('0x30')][_0x661e('0x31')]};});_0x11581d['model']=_['map'](_0xdc9b2e,_0x661e('0x29'));_0x11581d[_0x661e('0x32')]=_['keys'](_0x2ae2d1[_0x661e('0x32')]);_0x11581d[_0x661e('0x33')]=_[_0x661e('0x34')](_0x11581d[_0x661e('0x35')],_0x11581d[_0x661e('0x32')]);_0x181277[_0x661e('0x36')]=_['intersection'](_0x11581d['model'],qs[_0x661e('0x37')](_0x2ae2d1['query'][_0x661e('0x37')]));_0x181277[_0x661e('0x36')]=_0x181277['attributes'][_0x661e('0x38')]?_0x181277['attributes']:_0x11581d[_0x661e('0x35')];if(!_0x2ae2d1[_0x661e('0x32')][_0x661e('0x39')](_0x661e('0x3a'))){_0x181277['limit']=qs[_0x661e('0x1e')](_0x2ae2d1[_0x661e('0x32')][_0x661e('0x1e')]);_0x181277[_0x661e('0x1c')]=qs[_0x661e('0x1c')](_0x2ae2d1[_0x661e('0x32')][_0x661e('0x1c')]);}_0x181277[_0x661e('0x3b')]=qs[_0x661e('0x3c')](_0x2ae2d1[_0x661e('0x32')][_0x661e('0x3c')]);_0x181277['where']=qs[_0x661e('0x33')](_[_0x661e('0x3d')](_0x2ae2d1[_0x661e('0x32')],_0x11581d[_0x661e('0x33')]),_0xdc9b2e);if(_0x2ae2d1[_0x661e('0x32')]['filter']){_0x181277['where']=_['merge'](_0x181277[_0x661e('0x3e')],{'$or':_[_0x661e('0x2c')](_0xdc9b2e,function(_0x1c8261){if(_0x1c8261[_0x661e('0x30')]!==_0x661e('0x3f')){var _0x2ff99d={};_0x2ff99d[_0x1c8261[_0x661e('0x29')]]={'$like':'%'+_0x2ae2d1[_0x661e('0x32')][_0x661e('0x40')]+'%'};return _0x2ff99d;}})});}_0x181277=_[_0x661e('0x41')]({},_0x181277,_0x2ae2d1[_0x661e('0x42')]);var _0x53c069={'where':_0x181277[_0x661e('0x3e')]};return db[_0x661e('0x2d')]['count'](_0x53c069)[_0x661e('0x25')](function(_0x24dbe7){_0x3b362f[_0x661e('0x1f')]=_0x24dbe7;if(_0x2ae2d1[_0x661e('0x32')][_0x661e('0x43')]){_0x181277[_0x661e('0x44')]=[{'all':!![]}];}return db[_0x661e('0x2d')]['findAll'](_0x181277);})[_0x661e('0x25')](function(_0x588e71){_0x3b362f[_0x661e('0x45')]=_0x588e71;return _0x3b362f;})[_0x661e('0x25')](respondWithFilteredResult(_0x5b07d5,_0x181277))[_0x661e('0x46')](handleError(_0x5b07d5,null));};exports[_0x661e('0x47')]=function(_0x4eadc7,_0x43d43b){var _0x493a70={'raw':!![],'where':{'id':_0x4eadc7[_0x661e('0x48')]['id']}},_0x53022e={};_0x53022e['model']=_[_0x661e('0x49')](db[_0x661e('0x2d')]['rawAttributes']);_0x53022e['query']=_[_0x661e('0x49')](_0x4eadc7[_0x661e('0x32')]);_0x53022e[_0x661e('0x33')]=_[_0x661e('0x34')](_0x53022e[_0x661e('0x35')],_0x53022e[_0x661e('0x32')]);_0x493a70['attributes']=_[_0x661e('0x34')](_0x53022e['model'],qs['fields'](_0x4eadc7[_0x661e('0x32')][_0x661e('0x37')]));_0x493a70[_0x661e('0x36')]=_0x493a70[_0x661e('0x36')][_0x661e('0x38')]?_0x493a70['attributes']:_0x53022e[_0x661e('0x35')];if(_0x4eadc7[_0x661e('0x32')][_0x661e('0x43')]){_0x493a70[_0x661e('0x44')]=[{'all':!![]}];}_0x493a70=_[_0x661e('0x41')]({},_0x493a70,_0x4eadc7[_0x661e('0x42')]);return db[_0x661e('0x2d')]['find'](_0x493a70)[_0x661e('0x25')](handleEntityNotFound(_0x43d43b,null))[_0x661e('0x25')](respondWithResult(_0x43d43b,null))[_0x661e('0x46')](handleError(_0x43d43b,null));};exports[_0x661e('0x4a')]=function(_0x1db9c5,_0x45dc99){return db[_0x661e('0x2d')][_0x661e('0x4a')](_0x1db9c5['body'],{})[_0x661e('0x25')](respondWithResult(_0x45dc99,0xc9))[_0x661e('0x46')](handleError(_0x45dc99,null));};exports[_0x661e('0x4b')]=function(_0x1ae531,_0x2df8b6){if(_0x1ae531['body']['id']){delete _0x1ae531[_0x661e('0x4c')]['id'];}return db['SquareMessage'][_0x661e('0x4d')]({'where':{'id':_0x1ae531[_0x661e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2df8b6,null))[_0x661e('0x25')](saveUpdates(_0x1ae531[_0x661e('0x4c')],null))[_0x661e('0x25')](respondWithResult(_0x2df8b6,null))[_0x661e('0x46')](handleError(_0x2df8b6,null));};exports[_0x661e('0x26')]=function(_0x496a66,_0x3c2a82){return db[_0x661e('0x2d')][_0x661e('0x4d')]({'where':{'id':_0x496a66[_0x661e('0x48')]['id']}})[_0x661e('0x25')](handleEntityNotFound(_0x3c2a82,null))[_0x661e('0x25')](removeEntity(_0x3c2a82,null))[_0x661e('0x46')](handleError(_0x3c2a82,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3c4cfd3..5f791eb 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 _0x2dd6=['api','bluebird','request-promise','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2dd6,0x81));var _0x62dd=function(_0x4f04a6,_0x2d4a50){_0x4f04a6=_0x4f04a6-0x0;var _0x5aea1e=_0x2dd6[_0x4f04a6];return _0x5aea1e;};'use strict';var _=require(_0x62dd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x62dd('0x1'));var moment=require('moment');var BPromise=require(_0x62dd('0x2'));var rp=require(_0x62dd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x62dd('0x4'));var attributes=require(_0x62dd('0x5'));module[_0x62dd('0x6')]=function(_0x5e9325,_0x50b4c4){return _0x5e9325[_0x62dd('0x7')](_0x62dd('0x8'),attributes,{'tableName':_0x62dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d90=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','square_messages'];(function(_0x5d9e50,_0xe844cd){var _0x4c148c=function(_0x546ecb){while(--_0x546ecb){_0x5d9e50['push'](_0x5d9e50['shift']());}};_0x4c148c(++_0xe844cd);}(_0x3d90,0xbe));var _0x03d9=function(_0x48e5fc,_0x2c9968){_0x48e5fc=_0x48e5fc-0x0;var _0x1cc707=_0x3d90[_0x48e5fc];return _0x1cc707;};'use strict';var _=require(_0x03d9('0x0'));var util=require('util');var logger=require(_0x03d9('0x1'))('api');var moment=require(_0x03d9('0x2'));var BPromise=require(_0x03d9('0x3'));var rp=require(_0x03d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03d9('0x5'));var config=require(_0x03d9('0x6'));var attributes=require(_0x03d9('0x7'));module[_0x03d9('0x8')]=function(_0x5e11a1,_0x1711d7){return _0x5e11a1['define']('SquareMessage',attributes,{'tableName':_0x03d9('0x9'),'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 67a946e..af3b03a 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 _0xfc26=['SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','raw','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4f882c,_0x260c16){var _0x255a0d=function(_0x2e8bf0){while(--_0x2e8bf0){_0x4f882c['push'](_0x4f882c['shift']());}};_0x255a0d(++_0x260c16);}(_0xfc26,0x12f));var _0x6fc2=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xfc26[_0x280f4a];return _0x1bb157;};'use strict';var _=require('lodash');var util=require(_0x6fc2('0x0'));var moment=require(_0x6fc2('0x1'));var BPromise=require(_0x6fc2('0x2'));var rs=require(_0x6fc2('0x3'));var fs=require('fs');var Redis=require(_0x6fc2('0x4'));var db=require(_0x6fc2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fc2('0x6'))(_0x6fc2('0x7'));var config=require(_0x6fc2('0x8'));var jayson=require(_0x6fc2('0x9'));var client=jayson[_0x6fc2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1143d7,_0x15adaf,_0x538c39){return new BPromise(function(_0x113691,_0x20208f){return client[_0x6fc2('0xb')](_0x1143d7,_0x538c39)['then'](function(_0x1a36c8){logger[_0x6fc2('0xc')](_0x6fc2('0xd'),_0x15adaf,_0x6fc2('0xe'));logger[_0x6fc2('0xf')](_0x6fc2('0x10'),_0x15adaf,_0x6fc2('0xe'),JSON['stringify'](_0x1a36c8));if(_0x1a36c8['error']){if(_0x1a36c8[_0x6fc2('0x11')][_0x6fc2('0x12')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x15adaf,_0x1a36c8[_0x6fc2('0x11')][_0x6fc2('0x13')]);return _0x20208f(_0x1a36c8[_0x6fc2('0x11')][_0x6fc2('0x13')]);}logger[_0x6fc2('0x11')](_0x6fc2('0xd'),_0x15adaf,_0x1a36c8[_0x6fc2('0x11')][_0x6fc2('0x13')]);return _0x113691(_0x1a36c8[_0x6fc2('0x11')]['message']);}else{logger[_0x6fc2('0xc')](_0x6fc2('0xd'),_0x15adaf,_0x6fc2('0xe'));_0x113691(_0x1a36c8[_0x6fc2('0x14')][_0x6fc2('0x13')]);}})[_0x6fc2('0x15')](function(_0x384cc5){logger[_0x6fc2('0x11')](_0x6fc2('0xd'),_0x15adaf,_0x384cc5);_0x20208f(_0x384cc5);});});}exports[_0x6fc2('0x16')]=function(_0x9c6be4){var _0x3404cc=this;return new Promise(function(_0x2f07c2,_0x528204){return db[_0x6fc2('0x17')][_0x6fc2('0x18')](_0x9c6be4[_0x6fc2('0x19')],{'raw':_0x9c6be4['options']?_0x9c6be4['options'][_0x6fc2('0x1a')]===undefined?!![]:![]:!![]})[_0x6fc2('0x1b')](function(_0x5ebdac){logger[_0x6fc2('0xc')](_0x6fc2('0x16'),_0x9c6be4);logger[_0x6fc2('0xf')]('CreateSquareMessage',_0x9c6be4,JSON[_0x6fc2('0x1c')](_0x5ebdac));_0x2f07c2(_0x5ebdac);})[_0x6fc2('0x15')](function(_0x1df672){logger[_0x6fc2('0x11')]('CreateSquareMessage',_0x1df672['message'],_0x9c6be4);_0x528204(_0x3404cc[_0x6fc2('0x11')](0x1f4,_0x1df672[_0x6fc2('0x13')]));});});}; \ No newline at end of file +var _0xc82b=['options','raw','CreateSquareMessage','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','SquareMessage','body'];(function(_0x361492,_0x3eb70a){var _0x4b4295=function(_0x3b2619){while(--_0x3b2619){_0x361492['push'](_0x361492['shift']());}};_0x4b4295(++_0x3eb70a);}(_0xc82b,0x17e));var _0xbc82=function(_0x1ae044,_0x232026){_0x1ae044=_0x1ae044-0x0;var _0x579b49=_0xc82b[_0x1ae044];return _0x579b49;};'use strict';var _=require(_0xbc82('0x0'));var util=require(_0xbc82('0x1'));var moment=require(_0xbc82('0x2'));var BPromise=require(_0xbc82('0x3'));var rs=require(_0xbc82('0x4'));var fs=require('fs');var Redis=require(_0xbc82('0x5'));var db=require(_0xbc82('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc82('0x7'))('rpc');var config=require(_0xbc82('0x8'));var jayson=require(_0xbc82('0x9'));var client=jayson[_0xbc82('0xa')][_0xbc82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x243e16,_0x1ed0d2,_0x4bf0af){return new BPromise(function(_0xdb8dc7,_0x37f844){return client['request'](_0x243e16,_0x4bf0af)[_0xbc82('0xc')](function(_0x31f577){logger['info'](_0xbc82('0xd'),_0x1ed0d2,_0xbc82('0xe'));logger['debug'](_0xbc82('0xf'),_0x1ed0d2,'request\x20sent',JSON[_0xbc82('0x10')](_0x31f577));if(_0x31f577[_0xbc82('0x11')]){if(_0x31f577[_0xbc82('0x11')][_0xbc82('0x12')]===0x1f4){logger[_0xbc82('0x11')](_0xbc82('0xd'),_0x1ed0d2,_0x31f577['error'][_0xbc82('0x13')]);return _0x37f844(_0x31f577[_0xbc82('0x11')][_0xbc82('0x13')]);}logger[_0xbc82('0x11')]('SquareMessage,\x20%s,\x20%s',_0x1ed0d2,_0x31f577[_0xbc82('0x11')][_0xbc82('0x13')]);return _0xdb8dc7(_0x31f577[_0xbc82('0x11')][_0xbc82('0x13')]);}else{logger[_0xbc82('0x14')]('SquareMessage,\x20%s,\x20%s',_0x1ed0d2,_0xbc82('0xe'));_0xdb8dc7(_0x31f577[_0xbc82('0x15')]['message']);}})['catch'](function(_0x1e9651){logger[_0xbc82('0x11')](_0xbc82('0xd'),_0x1ed0d2,_0x1e9651);_0x37f844(_0x1e9651);});});}exports['CreateSquareMessage']=function(_0x58a46b){var _0x8bf892=this;return new Promise(function(_0x4df0e0,_0x43a056){return db[_0xbc82('0x16')]['create'](_0x58a46b[_0xbc82('0x17')],{'raw':_0x58a46b[_0xbc82('0x18')]?_0x58a46b[_0xbc82('0x18')][_0xbc82('0x19')]===undefined?!![]:![]:!![]})[_0xbc82('0xc')](function(_0x4f2461){logger[_0xbc82('0x14')](_0xbc82('0x1a'),_0x58a46b);logger[_0xbc82('0x1b')](_0xbc82('0x1a'),_0x58a46b,JSON['stringify'](_0x4f2461));_0x4df0e0(_0x4f2461);})[_0xbc82('0x1c')](function(_0x4277db){logger[_0xbc82('0x11')](_0xbc82('0x1a'),_0x4277db[_0xbc82('0x13')],_0x58a46b);_0x43a056(_0x8bf892[_0xbc82('0x11')](0x1f4,_0x4277db['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 03ca354..d3612dc 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 _0x3eb1=['/:id/test','test','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1b4aac,_0x107091){var _0x2a627c=function(_0x273a8f){while(--_0x273a8f){_0x1b4aac['push'](_0x1b4aac['shift']());}};_0x2a627c(++_0x107091);}(_0x3eb1,0x127));var _0x13eb=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x3eb1[_0x12b8ec];return _0x21af77;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x13eb('0x0'));var express=require(_0x13eb('0x1'));var router=express[_0x13eb('0x2')]();var fs_extra=require(_0x13eb('0x3'));var auth=require(_0x13eb('0x4'));var interaction=require(_0x13eb('0x5'));var config=require(_0x13eb('0x6'));var controller=require(_0x13eb('0x7'));router[_0x13eb('0x8')]('/',auth[_0x13eb('0x9')](),controller[_0x13eb('0xa')]);router['get'](_0x13eb('0xb'),auth[_0x13eb('0x9')](),controller[_0x13eb('0xc')]);router[_0x13eb('0x8')](_0x13eb('0xd'),auth[_0x13eb('0x9')](),timeout('15s'),controller[_0x13eb('0xe')]);router[_0x13eb('0xf')]('/',auth[_0x13eb('0x9')](),controller[_0x13eb('0x10')]);router[_0x13eb('0x11')](_0x13eb('0xb'),auth[_0x13eb('0x9')](),controller[_0x13eb('0x12')]);router[_0x13eb('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x13eb('0x14')]);module[_0x13eb('0x15')]=router; \ No newline at end of file +var _0x1daa=['create','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','post'];(function(_0x135b26,_0x55cf7e){var _0x2170f7=function(_0x12b4a3){while(--_0x12b4a3){_0x135b26['push'](_0x135b26['shift']());}};_0x2170f7(++_0x55cf7e);}(_0x1daa,0x1d2));var _0xa1da=function(_0x584308,_0x1379b3){_0x584308=_0x584308-0x0;var _0x45865b=_0x1daa[_0x584308];return _0x45865b;};'use strict';var multer=require(_0xa1da('0x0'));var util=require('util');var path=require(_0xa1da('0x1'));var timeout=require(_0xa1da('0x2'));var express=require(_0xa1da('0x3'));var router=express[_0xa1da('0x4')]();var fs_extra=require(_0xa1da('0x5'));var auth=require(_0xa1da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa1da('0x7'));var controller=require(_0xa1da('0x8'));router[_0xa1da('0x9')]('/',auth[_0xa1da('0xa')](),controller['index']);router[_0xa1da('0x9')](_0xa1da('0xb'),auth[_0xa1da('0xa')](),controller[_0xa1da('0xc')]);router[_0xa1da('0x9')](_0xa1da('0xd'),auth[_0xa1da('0xa')](),timeout(_0xa1da('0xe')),controller[_0xa1da('0xf')]);router[_0xa1da('0x10')]('/',auth[_0xa1da('0xa')](),controller[_0xa1da('0x11')]);router['put'](_0xa1da('0xb'),auth[_0xa1da('0xa')](),controller[_0xa1da('0x12')]);router[_0xa1da('0x13')](_0xa1da('0xb'),auth[_0xa1da('0xa')](),controller['destroy']);module[_0xa1da('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 93c40c1..c31bf2e 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 _0x4802=['STRING','name','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4802,0x18a));var _0x2480=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x4802[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x2480('0x0'));module[_0x2480('0x1')]={'name':{'type':Sequelize[_0x2480('0x2')],'unique':_0x2480('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2480('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8492=['STRING','name','exports'];(function(_0xa7163a,_0x25b4df){var _0x2b68b7=function(_0xa5995c){while(--_0xa5995c){_0xa7163a['push'](_0xa7163a['shift']());}};_0x2b68b7(++_0x25b4df);}(_0x8492,0x10d));var _0x2849=function(_0x772a04,_0x16271c){_0x772a04=_0x772a04-0x0;var _0x109a94=_0x8492[_0x772a04];return _0x109a94;};'use strict';var Sequelize=require('sequelize');module[_0x2849('0x0')]={'name':{'type':Sequelize[_0x2849('0x1')],'unique':_0x2849('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2849('0x1')]},'description':{'type':Sequelize[_0x2849('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index d72f8d5..6753d50 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 _0xb5c1=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','options','SquareOdbc','include','catch','show','params','includeAll','find','create','user','role','UserProfileSection','autoAssociation','body','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x37a65b,_0x20f100){var _0x2c38c0=function(_0x3b2f1c){while(--_0x3b2f1c){_0x37a65b['push'](_0x37a65b['shift']());}};_0x2c38c0(++_0x20f100);}(_0xb5c1,0x1ea));var _0x1b5c=function(_0x3edb6d,_0x324624){_0x3edb6d=_0x3edb6d-0x0;var _0x59a15e=_0xb5c1[_0x3edb6d];return _0x59a15e;};'use strict';var emlformat=require(_0x1b5c('0x0'));var rimraf=require(_0x1b5c('0x1'));var zipdir=require(_0x1b5c('0x2'));var jsonpatch=require(_0x1b5c('0x3'));var rp=require(_0x1b5c('0x4'));var moment=require(_0x1b5c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1b5c('0x6'));var util=require(_0x1b5c('0x7'));var path=require(_0x1b5c('0x8'));var sox=require(_0x1b5c('0x9'));var csv=require(_0x1b5c('0xa'));var ejs=require(_0x1b5c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b5c('0xc'));var squel=require(_0x1b5c('0xd'));var crypto=require('crypto');var jsforce=require(_0x1b5c('0xe'));var deskjs=require(_0x1b5c('0xf'));var toCsv=require(_0x1b5c('0xa'));var querystring=require('querystring');var Papa=require(_0x1b5c('0x10'));var Redis=require('ioredis');var authService=require(_0x1b5c('0x11'));var qs=require(_0x1b5c('0x12'));var as=require(_0x1b5c('0x13'));var hardwareService=require(_0x1b5c('0x14'));var logger=require(_0x1b5c('0x15'))('api');var utils=require(_0x1b5c('0x16'));var config=require(_0x1b5c('0x17'));var licenseUtil=require(_0x1b5c('0x18'));var db=require(_0x1b5c('0x19'))['db'];function respondWithStatusCode(_0x16df1e,_0x22b879){_0x22b879=_0x22b879||0xcc;return function(_0x47927f){if(_0x47927f){return _0x16df1e[_0x1b5c('0x1a')](_0x22b879);}return _0x16df1e['status'](_0x22b879)[_0x1b5c('0x1b')]();};}function respondWithResult(_0x275879,_0x309842){_0x309842=_0x309842||0xc8;return function(_0x1c33ea){if(_0x1c33ea){return _0x275879[_0x1b5c('0x1c')](_0x309842)[_0x1b5c('0x1d')](_0x1c33ea);}};}function respondWithFilteredResult(_0x1e980d,_0x54e3bf){return function(_0x1e0c61){if(_0x1e0c61){var _0x2725a0=typeof _0x54e3bf[_0x1b5c('0x1e')]===_0x1b5c('0x1f')&&typeof _0x54e3bf[_0x1b5c('0x20')]===_0x1b5c('0x1f');var _0x120782=_0x1e0c61[_0x1b5c('0x21')];var _0xa642af=_0x2725a0?0x0:_0x54e3bf[_0x1b5c('0x1e')];var _0x204612=_0x2725a0?_0x1e0c61['count']:_0x54e3bf[_0x1b5c('0x1e')]+_0x54e3bf[_0x1b5c('0x20')];var _0xd3a1a;if(_0x204612>=_0x120782){_0x204612=_0x120782;_0xd3a1a=0xc8;}else{_0xd3a1a=0xce;}_0x1e980d[_0x1b5c('0x1c')](_0xd3a1a);return _0x1e980d[_0x1b5c('0x22')](_0x1b5c('0x23'),_0xa642af+'-'+_0x204612+'/'+_0x120782)[_0x1b5c('0x1d')](_0x1e0c61);}return null;};}function patchUpdates(_0x19717d){return function(_0x4c9d9f){try{jsonpatch['apply'](_0x4c9d9f,_0x19717d,!![]);}catch(_0x560d28){return BPromise[_0x1b5c('0x24')](_0x560d28);}return _0x4c9d9f['save']();};}function saveUpdates(_0xc17dba,_0x3967a0){return function(_0x13a340){if(_0x13a340){return _0x13a340[_0x1b5c('0x25')](_0xc17dba)[_0x1b5c('0x26')](function(_0xffc452){return _0xffc452;});}return null;};}function removeEntity(_0x3ba1c3,_0x1be063){return function(_0x2669dd){if(_0x2669dd){return _0x2669dd[_0x1b5c('0x27')]()[_0x1b5c('0x26')](function(){var _0xea7d86=_0x2669dd[_0x1b5c('0x28')]({'plain':!![]});var _0x354fe8=_0x1b5c('0x29');return db[_0x1b5c('0x2a')][_0x1b5c('0x27')]({'where':{'type':_0x354fe8,'resourceId':_0xea7d86['id']}})[_0x1b5c('0x26')](function(){return _0x2669dd;});})['then'](function(){_0x3ba1c3['status'](0xcc)[_0x1b5c('0x1b')]();});}};}function handleEntityNotFound(_0xa7814,_0x200192){return function(_0x2251ef){if(!_0x2251ef){_0xa7814[_0x1b5c('0x1a')](0x194);}return _0x2251ef;};}function handleError(_0x13447a,_0x226492){_0x226492=_0x226492||0x1f4;return function(_0x13b08c){logger[_0x1b5c('0x2b')](_0x13b08c[_0x1b5c('0x2c')]);if(_0x13b08c[_0x1b5c('0x2d')]){delete _0x13b08c[_0x1b5c('0x2d')];}_0x13447a[_0x1b5c('0x1c')](_0x226492)[_0x1b5c('0x2e')](_0x13b08c);};}exports['index']=function(_0x174761,_0x253802){var _0x4f2196={},_0x213cbc={},_0x3dd1cc={'count':0x0,'rows':[]};var _0x44315d=_['map'](db['SquareOdbc'][_0x1b5c('0x2f')],function(_0x56e00c){return{'name':_0x56e00c[_0x1b5c('0x30')],'type':_0x56e00c[_0x1b5c('0x31')]['key']};});_0x213cbc['model']=_[_0x1b5c('0x32')](_0x44315d,'name');_0x213cbc[_0x1b5c('0x33')]=_[_0x1b5c('0x34')](_0x174761['query']);_0x213cbc[_0x1b5c('0x35')]=_[_0x1b5c('0x36')](_0x213cbc[_0x1b5c('0x37')],_0x213cbc[_0x1b5c('0x33')]);_0x4f2196['attributes']=_[_0x1b5c('0x36')](_0x213cbc[_0x1b5c('0x37')],qs[_0x1b5c('0x38')](_0x174761[_0x1b5c('0x33')][_0x1b5c('0x38')]));_0x4f2196['attributes']=_0x4f2196[_0x1b5c('0x39')][_0x1b5c('0x3a')]?_0x4f2196['attributes']:_0x213cbc[_0x1b5c('0x37')];if(!_0x174761[_0x1b5c('0x33')]['hasOwnProperty']('nolimit')){_0x4f2196['limit']=qs[_0x1b5c('0x20')](_0x174761[_0x1b5c('0x33')][_0x1b5c('0x20')]);_0x4f2196['offset']=qs[_0x1b5c('0x1e')](_0x174761[_0x1b5c('0x33')][_0x1b5c('0x1e')]);}_0x4f2196[_0x1b5c('0x3b')]=qs[_0x1b5c('0x3c')](_0x174761[_0x1b5c('0x33')]['sort']);_0x4f2196[_0x1b5c('0x3d')]=qs['filters'](_[_0x1b5c('0x3e')](_0x174761[_0x1b5c('0x33')],_0x213cbc['filters']),_0x44315d);if(_0x174761[_0x1b5c('0x33')]['filter']){_0x4f2196[_0x1b5c('0x3d')]=_['merge'](_0x4f2196[_0x1b5c('0x3d')],{'$or':_[_0x1b5c('0x32')](_0x44315d,function(_0x3be255){if(_0x3be255[_0x1b5c('0x31')]!=='VIRTUAL'){var _0x562baf={};_0x562baf[_0x3be255[_0x1b5c('0x2d')]]={'$like':'%'+_0x174761[_0x1b5c('0x33')][_0x1b5c('0x3f')]+'%'};return _0x562baf;}})});}_0x4f2196=_[_0x1b5c('0x40')]({},_0x4f2196,_0x174761[_0x1b5c('0x41')]);var _0xb46350={'where':_0x4f2196[_0x1b5c('0x3d')]};return db[_0x1b5c('0x42')][_0x1b5c('0x21')](_0xb46350)[_0x1b5c('0x26')](function(_0x185ae1){_0x3dd1cc['count']=_0x185ae1;if(_0x174761['query']['includeAll']){_0x4f2196[_0x1b5c('0x43')]=[{'all':!![]}];}return db[_0x1b5c('0x42')]['findAll'](_0x4f2196);})[_0x1b5c('0x26')](function(_0xbc679f){_0x3dd1cc['rows']=_0xbc679f;return _0x3dd1cc;})[_0x1b5c('0x26')](respondWithFilteredResult(_0x253802,_0x4f2196))[_0x1b5c('0x44')](handleError(_0x253802,null));};exports[_0x1b5c('0x45')]=function(_0x45dbb7,_0x15c568){var _0x542525={'raw':!![],'where':{'id':_0x45dbb7[_0x1b5c('0x46')]['id']}},_0x27ac19={};_0x27ac19[_0x1b5c('0x37')]=_['keys'](db[_0x1b5c('0x42')][_0x1b5c('0x2f')]);_0x27ac19[_0x1b5c('0x33')]=_[_0x1b5c('0x34')](_0x45dbb7['query']);_0x27ac19[_0x1b5c('0x35')]=_[_0x1b5c('0x36')](_0x27ac19['model'],_0x27ac19[_0x1b5c('0x33')]);_0x542525['attributes']=_['intersection'](_0x27ac19[_0x1b5c('0x37')],qs[_0x1b5c('0x38')](_0x45dbb7['query'][_0x1b5c('0x38')]));_0x542525[_0x1b5c('0x39')]=_0x542525[_0x1b5c('0x39')]['length']?_0x542525[_0x1b5c('0x39')]:_0x27ac19[_0x1b5c('0x37')];if(_0x45dbb7[_0x1b5c('0x33')][_0x1b5c('0x47')]){_0x542525[_0x1b5c('0x43')]=[{'all':!![]}];}_0x542525=_[_0x1b5c('0x40')]({},_0x542525,_0x45dbb7[_0x1b5c('0x41')]);return db[_0x1b5c('0x42')][_0x1b5c('0x48')](_0x542525)[_0x1b5c('0x26')](handleEntityNotFound(_0x15c568,null))[_0x1b5c('0x26')](respondWithResult(_0x15c568,null))[_0x1b5c('0x44')](handleError(_0x15c568,null));};exports[_0x1b5c('0x49')]=function(_0xda3021,_0x3f70ed){return db[_0x1b5c('0x42')][_0x1b5c('0x49')](_0xda3021['body'],{})[_0x1b5c('0x26')](function(_0x2e9599){var _0x6e52ed=_0xda3021[_0x1b5c('0x4a')][_0x1b5c('0x28')]({'plain':!![]});if(!_0x6e52ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6e52ed[_0x1b5c('0x4b')]===_0x1b5c('0x4a')){var _0x453e86=_0x2e9599[_0x1b5c('0x28')]({'plain':!![]});var _0x203ae5=_0x1b5c('0x29');return db[_0x1b5c('0x4c')]['find']({'where':{'name':_0x203ae5,'userProfileId':_0x6e52ed['userProfileId']},'raw':!![]})[_0x1b5c('0x26')](function(_0x49e959){if(_0x49e959&&_0x49e959[_0x1b5c('0x4d')]===0x0){return db[_0x1b5c('0x2a')][_0x1b5c('0x49')]({'name':_0x453e86[_0x1b5c('0x2d')],'resourceId':_0x453e86['id'],'type':_0x49e959['name'],'sectionId':_0x49e959['id']},{})[_0x1b5c('0x26')](function(){return _0x2e9599;});}else{return _0x2e9599;}})['catch'](function(_0x497cd5){logger[_0x1b5c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x497cd5);throw _0x497cd5;});}return _0x2e9599;})[_0x1b5c('0x26')](respondWithResult(_0x3f70ed,0xc9))[_0x1b5c('0x44')](handleError(_0x3f70ed,null));};exports[_0x1b5c('0x25')]=function(_0x55d03a,_0x1572ea){if(_0x55d03a[_0x1b5c('0x4e')]['id']){delete _0x55d03a[_0x1b5c('0x4e')]['id'];}return db[_0x1b5c('0x42')][_0x1b5c('0x48')]({'where':{'id':_0x55d03a[_0x1b5c('0x46')]['id']}})[_0x1b5c('0x26')](handleEntityNotFound(_0x1572ea,null))[_0x1b5c('0x26')](saveUpdates(_0x55d03a[_0x1b5c('0x4e')],null))[_0x1b5c('0x26')](respondWithResult(_0x1572ea,null))[_0x1b5c('0x44')](handleError(_0x1572ea,null));};exports['destroy']=function(_0x444bf1,_0x1ed9db){return db['SquareOdbc'][_0x1b5c('0x48')]({'where':{'id':_0x444bf1['params']['id']}})['then'](handleEntityNotFound(_0x1ed9db,null))['then'](removeEntity(_0x1ed9db,null))[_0x1b5c('0x44')](handleError(_0x1ed9db,null));};exports[_0x1b5c('0x4f')]=function(_0x43802b,_0x134fe7,_0x32e481){var _0x328315;return db[_0x1b5c('0x42')][_0x1b5c('0x48')]({'where':{'id':_0x43802b['params']['id']},'attributes':['id',_0x1b5c('0x50')]})['then'](handleEntityNotFound(_0x134fe7,null))['then'](function(_0x442fa0){if(_0x442fa0){var _0x9e306a=require(_0x1b5c('0x51'))();_0x9e306a[_0x1b5c('0x52')](_0x442fa0[_0x1b5c('0x50')]);_0x9e306a[_0x1b5c('0x53')]();return _0x442fa0;}})[_0x1b5c('0x26')](respondWithResult(_0x134fe7,null))[_0x1b5c('0x44')](handleError(_0x134fe7,null));}; \ No newline at end of file +var _0xab3a=['userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','end','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','model','intersection','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x54e1a2,_0x1e444a){var _0xbbfc9d=function(_0x1c9e17){while(--_0x1c9e17){_0x54e1a2['push'](_0x54e1a2['shift']());}};_0xbbfc9d(++_0x1e444a);}(_0xab3a,0x1c2));var _0xaab3=function(_0x4e7f3f,_0x5c57da){_0x4e7f3f=_0x4e7f3f-0x0;var _0x441fd2=_0xab3a[_0x4e7f3f];return _0x441fd2;};'use strict';var emlformat=require(_0xaab3('0x0'));var rimraf=require(_0xaab3('0x1'));var zipdir=require(_0xaab3('0x2'));var jsonpatch=require(_0xaab3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaab3('0x4'));var Mustache=require('mustache');var util=require(_0xaab3('0x5'));var path=require(_0xaab3('0x6'));var sox=require(_0xaab3('0x7'));var csv=require(_0xaab3('0x8'));var ejs=require(_0xaab3('0x9'));var fs=require('fs');var fs_extra=require(_0xaab3('0xa'));var _=require(_0xaab3('0xb'));var squel=require('squel');var crypto=require(_0xaab3('0xc'));var jsforce=require(_0xaab3('0xd'));var deskjs=require(_0xaab3('0xe'));var toCsv=require(_0xaab3('0x8'));var querystring=require(_0xaab3('0xf'));var Papa=require(_0xaab3('0x10'));var Redis=require('ioredis');var authService=require(_0xaab3('0x11'));var qs=require(_0xaab3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaab3('0x13'))(_0xaab3('0x14'));var utils=require('../../config/utils');var config=require(_0xaab3('0x15'));var licenseUtil=require(_0xaab3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ba204,_0x4901f1){_0x4901f1=_0x4901f1||0xcc;return function(_0x49cac2){if(_0x49cac2){return _0x4ba204[_0xaab3('0x17')](_0x4901f1);}return _0x4ba204[_0xaab3('0x18')](_0x4901f1)['end']();};}function respondWithResult(_0x5eb724,_0x2ba76f){_0x2ba76f=_0x2ba76f||0xc8;return function(_0x44ca40){if(_0x44ca40){return _0x5eb724[_0xaab3('0x18')](_0x2ba76f)[_0xaab3('0x19')](_0x44ca40);}};}function respondWithFilteredResult(_0x1da029,_0x2cba5b){return function(_0x2b0f5e){if(_0x2b0f5e){var _0x19df88=typeof _0x2cba5b['offset']===_0xaab3('0x1a')&&typeof _0x2cba5b[_0xaab3('0x1b')]===_0xaab3('0x1a');var _0x3476c4=_0x2b0f5e[_0xaab3('0x1c')];var _0x4b4127=_0x19df88?0x0:_0x2cba5b[_0xaab3('0x1d')];var _0x2b59d5=_0x19df88?_0x2b0f5e['count']:_0x2cba5b['offset']+_0x2cba5b[_0xaab3('0x1b')];var _0x3f11e4;if(_0x2b59d5>=_0x3476c4){_0x2b59d5=_0x3476c4;_0x3f11e4=0xc8;}else{_0x3f11e4=0xce;}_0x1da029[_0xaab3('0x18')](_0x3f11e4);return _0x1da029[_0xaab3('0x1e')](_0xaab3('0x1f'),_0x4b4127+'-'+_0x2b59d5+'/'+_0x3476c4)['json'](_0x2b0f5e);}return null;};}function patchUpdates(_0x129656){return function(_0x373d48){try{jsonpatch[_0xaab3('0x20')](_0x373d48,_0x129656,!![]);}catch(_0x2a0438){return BPromise[_0xaab3('0x21')](_0x2a0438);}return _0x373d48[_0xaab3('0x22')]();};}function saveUpdates(_0xe35a8f,_0x17129c){return function(_0x430ecf){if(_0x430ecf){return _0x430ecf[_0xaab3('0x23')](_0xe35a8f)[_0xaab3('0x24')](function(_0x4310c1){return _0x4310c1;});}return null;};}function removeEntity(_0xb61f95,_0x7df19f){return function(_0x511570){if(_0x511570){return _0x511570['destroy']()[_0xaab3('0x24')](function(){var _0x5811e3=_0x511570[_0xaab3('0x25')]({'plain':!![]});var _0x1d5231=_0xaab3('0x26');return db[_0xaab3('0x27')][_0xaab3('0x28')]({'where':{'type':_0x1d5231,'resourceId':_0x5811e3['id']}})[_0xaab3('0x24')](function(){return _0x511570;});})[_0xaab3('0x24')](function(){_0xb61f95[_0xaab3('0x18')](0xcc)[_0xaab3('0x29')]();});}};}function handleEntityNotFound(_0x366013,_0x1df3e2){return function(_0x3c4ca2){if(!_0x3c4ca2){_0x366013['sendStatus'](0x194);}return _0x3c4ca2;};}function handleError(_0x4ae83b,_0x15aed1){_0x15aed1=_0x15aed1||0x1f4;return function(_0x1e9d3e){logger['error'](_0x1e9d3e[_0xaab3('0x2a')]);if(_0x1e9d3e[_0xaab3('0x2b')]){delete _0x1e9d3e[_0xaab3('0x2b')];}_0x4ae83b[_0xaab3('0x18')](_0x15aed1)[_0xaab3('0x2c')](_0x1e9d3e);};}exports[_0xaab3('0x2d')]=function(_0x44c053,_0x3c78d4){var _0x54c2ca={},_0x365701={},_0x2331b3={'count':0x0,'rows':[]};var _0x52dd16=_['map'](db[_0xaab3('0x2e')][_0xaab3('0x2f')],function(_0x5a1e2b){return{'name':_0x5a1e2b[_0xaab3('0x30')],'type':_0x5a1e2b[_0xaab3('0x31')]['key']};});_0x365701['model']=_[_0xaab3('0x32')](_0x52dd16,_0xaab3('0x2b'));_0x365701[_0xaab3('0x33')]=_[_0xaab3('0x34')](_0x44c053[_0xaab3('0x33')]);_0x365701[_0xaab3('0x35')]=_['intersection'](_0x365701['model'],_0x365701['query']);_0x54c2ca[_0xaab3('0x36')]=_['intersection'](_0x365701['model'],qs[_0xaab3('0x37')](_0x44c053[_0xaab3('0x33')][_0xaab3('0x37')]));_0x54c2ca[_0xaab3('0x36')]=_0x54c2ca[_0xaab3('0x36')][_0xaab3('0x38')]?_0x54c2ca['attributes']:_0x365701['model'];if(!_0x44c053[_0xaab3('0x33')][_0xaab3('0x39')](_0xaab3('0x3a'))){_0x54c2ca[_0xaab3('0x1b')]=qs[_0xaab3('0x1b')](_0x44c053[_0xaab3('0x33')][_0xaab3('0x1b')]);_0x54c2ca[_0xaab3('0x1d')]=qs['offset'](_0x44c053[_0xaab3('0x33')][_0xaab3('0x1d')]);}_0x54c2ca[_0xaab3('0x3b')]=qs[_0xaab3('0x3c')](_0x44c053[_0xaab3('0x33')]['sort']);_0x54c2ca['where']=qs[_0xaab3('0x35')](_[_0xaab3('0x3d')](_0x44c053[_0xaab3('0x33')],_0x365701['filters']),_0x52dd16);if(_0x44c053[_0xaab3('0x33')]['filter']){_0x54c2ca[_0xaab3('0x3e')]=_[_0xaab3('0x3f')](_0x54c2ca[_0xaab3('0x3e')],{'$or':_[_0xaab3('0x32')](_0x52dd16,function(_0x3e1451){if(_0x3e1451[_0xaab3('0x31')]!==_0xaab3('0x40')){var _0x3c01bc={};_0x3c01bc[_0x3e1451['name']]={'$like':'%'+_0x44c053[_0xaab3('0x33')][_0xaab3('0x41')]+'%'};return _0x3c01bc;}})});}_0x54c2ca=_[_0xaab3('0x3f')]({},_0x54c2ca,_0x44c053[_0xaab3('0x42')]);var _0x5c05d1={'where':_0x54c2ca['where']};return db['SquareOdbc'][_0xaab3('0x1c')](_0x5c05d1)['then'](function(_0x3cdd41){_0x2331b3['count']=_0x3cdd41;if(_0x44c053[_0xaab3('0x33')][_0xaab3('0x43')]){_0x54c2ca[_0xaab3('0x44')]=[{'all':!![]}];}return db[_0xaab3('0x2e')][_0xaab3('0x45')](_0x54c2ca);})['then'](function(_0xa24bd4){_0x2331b3['rows']=_0xa24bd4;return _0x2331b3;})[_0xaab3('0x24')](respondWithFilteredResult(_0x3c78d4,_0x54c2ca))[_0xaab3('0x46')](handleError(_0x3c78d4,null));};exports['show']=function(_0x258609,_0x171c04){var _0x1942d5={'raw':!![],'where':{'id':_0x258609['params']['id']}},_0x43f7bc={};_0x43f7bc[_0xaab3('0x47')]=_[_0xaab3('0x34')](db['SquareOdbc'][_0xaab3('0x2f')]);_0x43f7bc[_0xaab3('0x33')]=_[_0xaab3('0x34')](_0x258609[_0xaab3('0x33')]);_0x43f7bc[_0xaab3('0x35')]=_[_0xaab3('0x48')](_0x43f7bc[_0xaab3('0x47')],_0x43f7bc[_0xaab3('0x33')]);_0x1942d5[_0xaab3('0x36')]=_['intersection'](_0x43f7bc['model'],qs['fields'](_0x258609['query']['fields']));_0x1942d5[_0xaab3('0x36')]=_0x1942d5[_0xaab3('0x36')][_0xaab3('0x38')]?_0x1942d5['attributes']:_0x43f7bc[_0xaab3('0x47')];if(_0x258609[_0xaab3('0x33')][_0xaab3('0x43')]){_0x1942d5[_0xaab3('0x44')]=[{'all':!![]}];}_0x1942d5=_[_0xaab3('0x3f')]({},_0x1942d5,_0x258609[_0xaab3('0x42')]);return db[_0xaab3('0x2e')][_0xaab3('0x49')](_0x1942d5)[_0xaab3('0x24')](handleEntityNotFound(_0x171c04,null))[_0xaab3('0x24')](respondWithResult(_0x171c04,null))['catch'](handleError(_0x171c04,null));};exports['create']=function(_0x28623a,_0x4ff2a3){return db[_0xaab3('0x2e')]['create'](_0x28623a[_0xaab3('0x4a')],{})['then'](function(_0x21bb08){var _0x3b1894=_0x28623a[_0xaab3('0x4b')][_0xaab3('0x25')]({'plain':!![]});if(!_0x3b1894)throw new Error(_0xaab3('0x4c'));if(_0x3b1894[_0xaab3('0x4d')]===_0xaab3('0x4b')){var _0xa33705=_0x21bb08[_0xaab3('0x25')]({'plain':!![]});var _0x567aa0=_0xaab3('0x26');return db['UserProfileSection'][_0xaab3('0x49')]({'where':{'name':_0x567aa0,'userProfileId':_0x3b1894[_0xaab3('0x4e')]},'raw':!![]})['then'](function(_0x220490){if(_0x220490&&_0x220490[_0xaab3('0x4f')]===0x0){return db[_0xaab3('0x27')][_0xaab3('0x50')]({'name':_0xa33705[_0xaab3('0x2b')],'resourceId':_0xa33705['id'],'type':_0x220490['name'],'sectionId':_0x220490['id']},{})[_0xaab3('0x24')](function(){return _0x21bb08;});}else{return _0x21bb08;}})[_0xaab3('0x46')](function(_0x2fb083){logger[_0xaab3('0x51')](_0xaab3('0x52'),_0x2fb083);throw _0x2fb083;});}return _0x21bb08;})[_0xaab3('0x24')](respondWithResult(_0x4ff2a3,0xc9))['catch'](handleError(_0x4ff2a3,null));};exports[_0xaab3('0x23')]=function(_0x501a1b,_0x5031e1){if(_0x501a1b[_0xaab3('0x4a')]['id']){delete _0x501a1b['body']['id'];}return db[_0xaab3('0x2e')]['find']({'where':{'id':_0x501a1b['params']['id']}})[_0xaab3('0x24')](handleEntityNotFound(_0x5031e1,null))['then'](saveUpdates(_0x501a1b[_0xaab3('0x4a')],null))['then'](respondWithResult(_0x5031e1,null))['catch'](handleError(_0x5031e1,null));};exports[_0xaab3('0x28')]=function(_0xf8aca2,_0x36e54f){return db[_0xaab3('0x2e')][_0xaab3('0x49')]({'where':{'id':_0xf8aca2[_0xaab3('0x53')]['id']}})[_0xaab3('0x24')](handleEntityNotFound(_0x36e54f,null))['then'](removeEntity(_0x36e54f,null))['catch'](handleError(_0x36e54f,null));};exports[_0xaab3('0x54')]=function(_0x4f6c45,_0x43eb8b,_0x333912){var _0x70b52b;return db['SquareOdbc'][_0xaab3('0x49')]({'where':{'id':_0x4f6c45[_0xaab3('0x53')]['id']},'attributes':['id',_0xaab3('0x55')]})[_0xaab3('0x24')](handleEntityNotFound(_0x43eb8b,null))['then'](function(_0x9dd0af){if(_0x9dd0af){var _0x1cc19c=require(_0xaab3('0x56'))();_0x1cc19c[_0xaab3('0x57')](_0x9dd0af['dsn']);_0x1cc19c['closeSync']();return _0x9dd0af;}})[_0xaab3('0x24')](respondWithResult(_0x43eb8b,null))[_0xaab3('0x46')](handleError(_0x43eb8b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 71492b4..4eae7ec 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 _0xe64c=['path','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3493d5,_0x3ababa){var _0x173f5a=function(_0x1edb96){while(--_0x1edb96){_0x3493d5['push'](_0x3493d5['shift']());}};_0x173f5a(++_0x3ababa);}(_0xe64c,0xc9));var _0xce64=function(_0x40a110,_0x4bad90){_0x40a110=_0x40a110-0x0;var _0x1418c9=_0xe64c[_0x40a110];return _0x1418c9;};'use strict';var _=require(_0xce64('0x0'));var util=require(_0xce64('0x1'));var logger=require(_0xce64('0x2'))(_0xce64('0x3'));var moment=require(_0xce64('0x4'));var BPromise=require(_0xce64('0x5'));var rp=require(_0xce64('0x6'));var fs=require('fs');var path=require(_0xce64('0x7'));var rimraf=require(_0xce64('0x8'));var config=require(_0xce64('0x9'));var attributes=require(_0xce64('0xa'));module['exports']=function(_0x1e9953,_0x1c0884){return _0x1e9953['define'](_0xce64('0xb'),attributes,{'tableName':_0xce64('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd428=['./squareOdbc.attributes','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ce74a,_0x3228a2){var _0x1e934a=function(_0x434fa3){while(--_0x434fa3){_0x2ce74a['push'](_0x2ce74a['shift']());}};_0x1e934a(++_0x3228a2);}(_0xd428,0x18f));var _0x8d42=function(_0x3de5a1,_0x4fab1a){_0x3de5a1=_0x3de5a1-0x0;var _0x3619bd=_0xd428[_0x3de5a1];return _0x3619bd;};'use strict';var _=require(_0x8d42('0x0'));var util=require(_0x8d42('0x1'));var logger=require(_0x8d42('0x2'))(_0x8d42('0x3'));var moment=require(_0x8d42('0x4'));var BPromise=require(_0x8d42('0x5'));var rp=require(_0x8d42('0x6'));var fs=require('fs');var path=require(_0x8d42('0x7'));var rimraf=require(_0x8d42('0x8'));var config=require('../../config/environment');var attributes=require(_0x8d42('0x9'));module['exports']=function(_0x2d8da8,_0x3406f6){return _0x2d8da8['define'](_0x8d42('0xa'),attributes,{'tableName':_0x8d42('0xb'),'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 a3da7d9..7715632 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 _0x93e9=['message','result','catch','ShowSquareOdbc','find','options','raw','where','include','map','model','attributes','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','SquareOdbc,\x20%s,\x20%s'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x93e9,0x1a0));var _0x993e=function(_0x4890df,_0x4f9aa0){_0x4890df=_0x4890df-0x0;var _0x23f6be=_0x93e9[_0x4890df];return _0x23f6be;};'use strict';var _=require('lodash');var util=require(_0x993e('0x0'));var moment=require(_0x993e('0x1'));var BPromise=require('bluebird');var rs=require(_0x993e('0x2'));var fs=require('fs');var Redis=require(_0x993e('0x3'));var db=require(_0x993e('0x4'))['db'];var utils=require(_0x993e('0x5'));var logger=require('../../config/logger')(_0x993e('0x6'));var config=require(_0x993e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x993e('0x8')][_0x993e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1337b4,_0x36c4ad,_0x33ace1){return new BPromise(function(_0x30d4c2,_0x586d16){return client[_0x993e('0xa')](_0x1337b4,_0x33ace1)[_0x993e('0xb')](function(_0x39aa7b){logger[_0x993e('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x36c4ad,_0x993e('0xd'));logger[_0x993e('0xe')](_0x993e('0xf'),_0x36c4ad,_0x993e('0xd'),JSON['stringify'](_0x39aa7b));if(_0x39aa7b[_0x993e('0x10')]){if(_0x39aa7b[_0x993e('0x10')]['code']===0x1f4){logger[_0x993e('0x10')](_0x993e('0x11'),_0x36c4ad,_0x39aa7b[_0x993e('0x10')][_0x993e('0x12')]);return _0x586d16(_0x39aa7b[_0x993e('0x10')]['message']);}logger['error'](_0x993e('0x11'),_0x36c4ad,_0x39aa7b['error'][_0x993e('0x12')]);return _0x30d4c2(_0x39aa7b[_0x993e('0x10')]['message']);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x36c4ad,'request\x20sent');_0x30d4c2(_0x39aa7b[_0x993e('0x13')][_0x993e('0x12')]);}})[_0x993e('0x14')](function(_0x3a8187){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x36c4ad,_0x3a8187);_0x586d16(_0x3a8187);});});}exports[_0x993e('0x15')]=function(_0x4f1ecb){var _0x3fda31=this;return new Promise(function(_0x2bdd47,_0x109328){return db['SquareOdbc'][_0x993e('0x16')]({'raw':_0x4f1ecb[_0x993e('0x17')]?_0x4f1ecb['options'][_0x993e('0x18')]===undefined?!![]:![]:!![],'where':_0x4f1ecb[_0x993e('0x17')]?_0x4f1ecb['options'][_0x993e('0x19')]||null:null,'attributes':_0x4f1ecb[_0x993e('0x17')]?_0x4f1ecb['options']['attributes']||null:null,'include':_0x4f1ecb[_0x993e('0x17')]?_0x4f1ecb[_0x993e('0x17')][_0x993e('0x1a')]?_[_0x993e('0x1b')](_0x4f1ecb[_0x993e('0x17')][_0x993e('0x1a')],function(_0x304450){return{'model':db[_0x304450[_0x993e('0x1c')]],'as':_0x304450['as'],'attributes':_0x304450['attributes'],'include':_0x304450[_0x993e('0x1a')]?_[_0x993e('0x1b')](_0x304450[_0x993e('0x1a')],function(_0x8fd211){return{'model':db[_0x8fd211[_0x993e('0x1c')]],'as':_0x8fd211['as'],'attributes':_0x8fd211['attributes'],'include':_0x8fd211[_0x993e('0x1a')]?_['map'](_0x8fd211[_0x993e('0x1a')],function(_0x4366ca){return{'model':db[_0x4366ca[_0x993e('0x1c')]],'as':_0x4366ca['as'],'attributes':_0x4366ca[_0x993e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b9682){logger[_0x993e('0xc')](_0x993e('0x15'),_0x4f1ecb);logger['debug'](_0x993e('0x15'),_0x4f1ecb,JSON[_0x993e('0x1e')](_0x5b9682));_0x2bdd47(_0x5b9682);})[_0x993e('0x14')](function(_0x28ad28){logger['error'](_0x993e('0x15'),_0x28ad28['message'],_0x4f1ecb);_0x109328(_0x3fda31[_0x993e('0x10')](0x1f4,_0x28ad28[_0x993e('0x12')]));});});}; \ No newline at end of file +var _0xaebc=['client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1e8bea,_0x47bde9){var _0x29f756=function(_0x37bb53){while(--_0x37bb53){_0x1e8bea['push'](_0x1e8bea['shift']());}};_0x29f756(++_0x47bde9);}(_0xaebc,0x183));var _0xcaeb=function(_0x27842c,_0x324fcb){_0x27842c=_0x27842c-0x0;var _0x493de8=_0xaebc[_0x27842c];return _0x493de8;};'use strict';var _=require(_0xcaeb('0x0'));var util=require(_0xcaeb('0x1'));var moment=require('moment');var BPromise=require(_0xcaeb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcaeb('0x3'));var db=require(_0xcaeb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaeb('0x5'))(_0xcaeb('0x6'));var config=require(_0xcaeb('0x7'));var jayson=require(_0xcaeb('0x8'));var client=jayson[_0xcaeb('0x9')][_0xcaeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2693b1,_0x332928,_0x194841){return new BPromise(function(_0x57805d,_0x20dfa7){return client[_0xcaeb('0xb')](_0x2693b1,_0x194841)[_0xcaeb('0xc')](function(_0x32b076){logger[_0xcaeb('0xd')](_0xcaeb('0xe'),_0x332928,'request\x20sent');logger[_0xcaeb('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x332928,_0xcaeb('0x10'),JSON[_0xcaeb('0x11')](_0x32b076));if(_0x32b076[_0xcaeb('0x12')]){if(_0x32b076[_0xcaeb('0x12')][_0xcaeb('0x13')]===0x1f4){logger[_0xcaeb('0x12')](_0xcaeb('0xe'),_0x332928,_0x32b076[_0xcaeb('0x12')][_0xcaeb('0x14')]);return _0x20dfa7(_0x32b076[_0xcaeb('0x12')][_0xcaeb('0x14')]);}logger['error'](_0xcaeb('0xe'),_0x332928,_0x32b076[_0xcaeb('0x12')][_0xcaeb('0x14')]);return _0x57805d(_0x32b076[_0xcaeb('0x12')][_0xcaeb('0x14')]);}else{logger[_0xcaeb('0xd')](_0xcaeb('0xe'),_0x332928,_0xcaeb('0x10'));_0x57805d(_0x32b076[_0xcaeb('0x15')][_0xcaeb('0x14')]);}})[_0xcaeb('0x16')](function(_0x3183f2){logger[_0xcaeb('0x12')](_0xcaeb('0xe'),_0x332928,_0x3183f2);_0x20dfa7(_0x3183f2);});});}exports[_0xcaeb('0x17')]=function(_0x499286){var _0x40ae19=this;return new Promise(function(_0x144447,_0x4d2bb5){return db[_0xcaeb('0x18')][_0xcaeb('0x19')]({'raw':_0x499286[_0xcaeb('0x1a')]?_0x499286['options'][_0xcaeb('0x1b')]===undefined?!![]:![]:!![],'where':_0x499286[_0xcaeb('0x1a')]?_0x499286[_0xcaeb('0x1a')][_0xcaeb('0x1c')]||null:null,'attributes':_0x499286[_0xcaeb('0x1a')]?_0x499286['options'][_0xcaeb('0x1d')]||null:null,'include':_0x499286[_0xcaeb('0x1a')]?_0x499286['options']['include']?_[_0xcaeb('0x1e')](_0x499286[_0xcaeb('0x1a')][_0xcaeb('0x1f')],function(_0xf6a16e){return{'model':db[_0xf6a16e['model']],'as':_0xf6a16e['as'],'attributes':_0xf6a16e[_0xcaeb('0x1d')],'include':_0xf6a16e[_0xcaeb('0x1f')]?_[_0xcaeb('0x1e')](_0xf6a16e[_0xcaeb('0x1f')],function(_0x1d7eb1){return{'model':db[_0x1d7eb1[_0xcaeb('0x20')]],'as':_0x1d7eb1['as'],'attributes':_0x1d7eb1['attributes'],'include':_0x1d7eb1[_0xcaeb('0x1f')]?_[_0xcaeb('0x1e')](_0x1d7eb1['include'],function(_0x298975){return{'model':db[_0x298975[_0xcaeb('0x20')]],'as':_0x298975['as'],'attributes':_0x298975['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28d12e){logger[_0xcaeb('0xd')](_0xcaeb('0x17'),_0x499286);logger[_0xcaeb('0xf')](_0xcaeb('0x17'),_0x499286,JSON[_0xcaeb('0x11')](_0x28d12e));_0x144447(_0x28d12e);})[_0xcaeb('0x16')](function(_0x529a93){logger['error']('ShowSquareOdbc',_0x529a93[_0xcaeb('0x14')],_0x499286);_0x4d2bb5(_0x40ae19[_0xcaeb('0x12')](0x1f4,_0x529a93['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d23187f..d9aabca 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 _0xc7ba=['create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','post'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc7ba,0x155));var _0xac7b=function(_0x556e2e,_0x5381d8){_0x556e2e=_0x556e2e-0x0;var _0x1564ec=_0xc7ba[_0x556e2e];return _0x1564ec;};'use strict';var multer=require(_0xac7b('0x0'));var util=require(_0xac7b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xac7b('0x2'));var router=express[_0xac7b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xac7b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xac7b('0x5'));var controller=require(_0xac7b('0x6'));router[_0xac7b('0x7')]('/',auth[_0xac7b('0x8')](),controller[_0xac7b('0x9')]);router['get']('/:id',auth[_0xac7b('0x8')](),controller['show']);router[_0xac7b('0xa')]('/',auth[_0xac7b('0x8')](),controller[_0xac7b('0xb')]);router['put']('/:id',auth[_0xac7b('0x8')](),controller[_0xac7b('0xc')]);router[_0xac7b('0xd')]('/:id',auth[_0xac7b('0x8')](),controller[_0xac7b('0xe')]);module[_0xac7b('0xf')]=router; \ No newline at end of file +var _0x62e1=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete'];(function(_0x555e9b,_0x3dc683){var _0x2367a1=function(_0x64211f){while(--_0x64211f){_0x555e9b['push'](_0x555e9b['shift']());}};_0x2367a1(++_0x3dc683);}(_0x62e1,0x16a));var _0x162e=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x62e1[_0xc77819];return _0x1c9434;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x162e('0x0'));var timeout=require(_0x162e('0x1'));var express=require(_0x162e('0x2'));var router=express[_0x162e('0x3')]();var fs_extra=require(_0x162e('0x4'));var auth=require(_0x162e('0x5'));var interaction=require(_0x162e('0x6'));var config=require(_0x162e('0x7'));var controller=require(_0x162e('0x8'));router['get']('/',auth[_0x162e('0x9')](),controller[_0x162e('0xa')]);router[_0x162e('0xb')]('/:id',auth[_0x162e('0x9')](),controller[_0x162e('0xc')]);router[_0x162e('0xd')]('/',auth[_0x162e('0x9')](),controller['create']);router[_0x162e('0xe')](_0x162e('0xf'),auth['isAuthenticated'](),controller[_0x162e('0x10')]);router[_0x162e('0x11')](_0x162e('0xf'),auth[_0x162e('0x9')](),controller[_0x162e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a494f3e..b0eb7bf 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 _0xc177=['production','DATE','sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xc177,0x1b2));var _0x7c17=function(_0x1e648e,_0x28f54e){_0x1e648e=_0x1e648e-0x0;var _0xfe9991=_0xc177[_0x1e648e];return _0xfe9991;};'use strict';var Sequelize=require(_0x7c17('0x0'));module[_0x7c17('0x1')]={'name':{'type':Sequelize[_0x7c17('0x2')],'unique':_0x7c17('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7c17('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x7c17('0x4')](_0x7c17('0x5')),'get':function(){if(this[_0x7c17('0x6')](_0x7c17('0x7'))){return this['getDataValue'](_0x7c17('0x7'))[_0x7c17('0x8')](_0x7c17('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x7c17('0x5')),'get':function(){if(this[_0x7c17('0x6')](_0x7c17('0xa'))){return this[_0x7c17('0x6')](_0x7c17('0xa'))[_0x7c17('0x8')](_0x7c17('0x9'));}}},'savedAt':{'type':Sequelize[_0x7c17('0xb')]},'publishedAt':{'type':Sequelize[_0x7c17('0xb')]}}; \ No newline at end of file +var _0xfbf2=['getDataValue','preproduction','toString','utf8','DATE','sequelize','exports','STRING','name','TEXT','long'];(function(_0x4dcc55,_0x138e60){var _0xfb34be=function(_0x5e0514){while(--_0x5e0514){_0x4dcc55['push'](_0x4dcc55['shift']());}};_0xfb34be(++_0x138e60);}(_0xfbf2,0xc0));var _0x2fbf=function(_0xe540c0,_0x2d98e5){_0xe540c0=_0xe540c0-0x0;var _0x130549=_0xfbf2[_0xe540c0];return _0x130549;};'use strict';var Sequelize=require(_0x2fbf('0x0'));module[_0x2fbf('0x1')]={'name':{'type':Sequelize[_0x2fbf('0x2')],'unique':_0x2fbf('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2fbf('0x2')]},'notes':{'type':Sequelize[_0x2fbf('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x2fbf('0x5')),'get':function(){if(this[_0x2fbf('0x6')](_0x2fbf('0x7'))){return this[_0x2fbf('0x6')](_0x2fbf('0x7'))[_0x2fbf('0x8')](_0x2fbf('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x2fbf('0x5')),'get':function(){if(this[_0x2fbf('0x6')]('production')){return this[_0x2fbf('0x6')]('production')[_0x2fbf('0x8')](_0x2fbf('0x9'));}}},'savedAt':{'type':Sequelize[_0x2fbf('0xa')]},'publishedAt':{'type':Sequelize[_0x2fbf('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index de63256..6bc1adb 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 _0x3b3c=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','map','VIRTUAL','merge','includeAll','include','rows','catch','params','intersection','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','production','lodash','ioredis','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','register','status','json','offset','undefined','limit','count','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','end','error','name','index','SquareProject','rawAttributes','fieldName','type','keys','query','filters','model'];(function(_0x504575,_0x1ad9e0){var _0x4484cc=function(_0xc4c2ea){while(--_0xc4c2ea){_0x504575['push'](_0x504575['shift']());}};_0x4484cc(++_0x1ad9e0);}(_0x3b3c,0x17b));var _0xc3b3=function(_0x4a232c,_0x4db76b){_0x4a232c=_0x4a232c-0x0;var _0xb5807f=_0x3b3c[_0x4a232c];return _0xb5807f;};'use strict';var _=require(_0xc3b3('0x0'));var Redis=require(_0xc3b3('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xc3b3('0x2'))('api');var config=require(_0xc3b3('0x3'));var db=require('../../mysqldb')['db'];config[_0xc3b3('0x4')]=_[_0xc3b3('0x5')](config[_0xc3b3('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xc3b3('0x6'))(new Redis(config['redis']));require('./squareProject.socket')[_0xc3b3('0x7')](socket);function respondWithResult(_0x111344,_0x57807a){_0x57807a=_0x57807a||0xc8;return function(_0x53013a){if(_0x53013a){return _0x111344[_0xc3b3('0x8')](_0x57807a)[_0xc3b3('0x9')](_0x53013a);}};}function respondWithFilteredResult(_0x409994,_0x451502){return function(_0x33692d){if(_0x33692d){var _0x4bd984=typeof _0x451502[_0xc3b3('0xa')]===_0xc3b3('0xb')&&typeof _0x451502[_0xc3b3('0xc')]===_0xc3b3('0xb');var _0x1af4e0=_0x33692d[_0xc3b3('0xd')];var _0x2034da=_0x4bd984?0x0:_0x451502[_0xc3b3('0xa')];var _0x281ab1=_0x4bd984?_0x33692d[_0xc3b3('0xd')]:_0x451502[_0xc3b3('0xa')]+_0x451502[_0xc3b3('0xc')];var _0xf77049;if(_0x281ab1>=_0x1af4e0){_0x281ab1=_0x1af4e0;_0xf77049=0xc8;}else{_0xf77049=0xce;}_0x409994[_0xc3b3('0x8')](_0xf77049);return _0x409994['set']('Content-Range',_0x2034da+'-'+_0x281ab1+'/'+_0x1af4e0)[_0xc3b3('0x9')](_0x33692d);}return null;};}function saveUpdates(_0x2f9bad){return function(_0x378c06){if(_0x378c06){return _0x378c06[_0xc3b3('0xe')](_0x2f9bad)[_0xc3b3('0xf')](function(_0x22b386){return _0x22b386;});}return null;};}function removeEntity(_0x3f26ca){return function(_0x314c40){if(_0x314c40){return _0x314c40[_0xc3b3('0x10')]()[_0xc3b3('0xf')](function(){var _0x34ffc5=_0x314c40[_0xc3b3('0x11')]({'plain':!![]});var _0x347cc6=_0xc3b3('0x12');return db[_0xc3b3('0x13')][_0xc3b3('0x10')]({'where':{'type':_0x347cc6,'resourceId':_0x34ffc5['id']}})[_0xc3b3('0xf')](function(){return _0x314c40;});})[_0xc3b3('0xf')](function(){var _0x13f5df=new Redis(config[_0xc3b3('0x4')]);_0x13f5df[_0xc3b3('0x14')](_0xc3b3('0x15'),JSON['stringify']({'id':_0x314c40['id'],'deleted':!![]}));})[_0xc3b3('0xf')](function(){_0x3f26ca[_0xc3b3('0x8')](0xcc)[_0xc3b3('0x16')]();});}};}function handleEntityNotFound(_0x553b2d){return function(_0x2f3876){if(!_0x2f3876){_0x553b2d['sendStatus'](0x194);}return _0x2f3876;};}function handleError(_0x43bfa4,_0x491e13){_0x491e13=_0x491e13||0x1f4;return function(_0x59df2f){logger[_0xc3b3('0x17')](_0x59df2f['stack']);if(_0x59df2f[_0xc3b3('0x18')]){delete _0x59df2f[_0xc3b3('0x18')];}_0x43bfa4[_0xc3b3('0x8')](_0x491e13)['send'](_0x59df2f);};}exports[_0xc3b3('0x19')]=function(_0x5f2867,_0x3743e3){var _0x2e0808={},_0x4b39f5={},_0x4b1b7={'count':0x0,'rows':[]};var _0x33c3ab=_['map'](db[_0xc3b3('0x1a')][_0xc3b3('0x1b')],function(_0xdd45d7){return{'name':_0xdd45d7[_0xc3b3('0x1c')],'type':_0xdd45d7[_0xc3b3('0x1d')]['key']};});_0x4b39f5['model']=_['map'](_0x33c3ab,'name');_0x4b39f5['query']=_[_0xc3b3('0x1e')](_0x5f2867[_0xc3b3('0x1f')]);_0x4b39f5[_0xc3b3('0x20')]=_['intersection'](_0x4b39f5[_0xc3b3('0x21')],_0x4b39f5['query']);_0x2e0808[_0xc3b3('0x22')]=_['intersection'](_0x4b39f5['model'],qs[_0xc3b3('0x23')](_0x5f2867['query'][_0xc3b3('0x23')]));_0x2e0808[_0xc3b3('0x22')]=_0x2e0808[_0xc3b3('0x22')][_0xc3b3('0x24')]?_0x2e0808[_0xc3b3('0x22')]:_0x4b39f5['model'];if(!_0x5f2867[_0xc3b3('0x1f')][_0xc3b3('0x25')]('nolimit')){_0x2e0808[_0xc3b3('0xc')]=qs[_0xc3b3('0xc')](_0x5f2867[_0xc3b3('0x1f')][_0xc3b3('0xc')]);_0x2e0808['offset']=qs[_0xc3b3('0xa')](_0x5f2867['query'][_0xc3b3('0xa')]);}_0x2e0808[_0xc3b3('0x26')]=qs[_0xc3b3('0x27')](_0x5f2867['query'][_0xc3b3('0x27')]);_0x2e0808[_0xc3b3('0x28')]=qs['filters'](_[_0xc3b3('0x29')](_0x5f2867[_0xc3b3('0x1f')],_0x4b39f5[_0xc3b3('0x20')]),_0x33c3ab);if(_0x5f2867['query']['filter']){_0x2e0808[_0xc3b3('0x28')]=_['merge'](_0x2e0808['where'],{'$or':_[_0xc3b3('0x2a')](_0x33c3ab,function(_0xa76789){if(_0xa76789['type']!==_0xc3b3('0x2b')){var _0x5cf43c={};_0x5cf43c[_0xa76789['name']]={'$like':'%'+_0x5f2867[_0xc3b3('0x1f')]['filter']+'%'};return _0x5cf43c;}})});}_0x2e0808=_[_0xc3b3('0x2c')]({},_0x2e0808,_0x5f2867['options']);var _0x2356d2={'where':_0x2e0808['where']};return db['SquareProject'][_0xc3b3('0xd')](_0x2356d2)[_0xc3b3('0xf')](function(_0x34ac50){_0x4b1b7['count']=_0x34ac50;if(_0x5f2867[_0xc3b3('0x1f')][_0xc3b3('0x2d')]){_0x2e0808[_0xc3b3('0x2e')]=[{'all':!![]}];}return db[_0xc3b3('0x1a')]['findAll'](_0x2e0808);})[_0xc3b3('0xf')](function(_0x58cfd7){_0x4b1b7[_0xc3b3('0x2f')]=_0x58cfd7;return _0x4b1b7;})[_0xc3b3('0xf')](respondWithFilteredResult(_0x3743e3,_0x2e0808))[_0xc3b3('0x30')](handleError(_0x3743e3,null));};exports['show']=function(_0x1b1026,_0x3154b8){var _0x381d50={'raw':![],'where':{'id':_0x1b1026[_0xc3b3('0x31')]['id']}},_0x3578cf={};_0x3578cf[_0xc3b3('0x21')]=_[_0xc3b3('0x1e')](db[_0xc3b3('0x1a')][_0xc3b3('0x1b')]);_0x3578cf['query']=_[_0xc3b3('0x1e')](_0x1b1026[_0xc3b3('0x1f')]);_0x3578cf['filters']=_[_0xc3b3('0x32')](_0x3578cf[_0xc3b3('0x21')],_0x3578cf[_0xc3b3('0x1f')]);_0x381d50['attributes']=_['intersection'](_0x3578cf[_0xc3b3('0x21')],qs[_0xc3b3('0x23')](_0x1b1026[_0xc3b3('0x1f')][_0xc3b3('0x23')]));_0x381d50[_0xc3b3('0x22')]=_0x381d50[_0xc3b3('0x22')][_0xc3b3('0x24')]?_0x381d50['attributes']:_0x3578cf[_0xc3b3('0x21')];if(_0x1b1026['query']['includeAll']){_0x381d50[_0xc3b3('0x2e')]=[{'all':!![]}];}_0x381d50=_[_0xc3b3('0x2c')]({},_0x381d50,_0x1b1026['options']);return db[_0xc3b3('0x1a')][_0xc3b3('0x33')](_0x381d50)['then'](handleEntityNotFound(_0x3154b8,null))[_0xc3b3('0xf')](respondWithResult(_0x3154b8,null))['catch'](handleError(_0x3154b8,null));};exports[_0xc3b3('0x34')]=function(_0x131163,_0xf6a9ea){return db['SquareProject'][_0xc3b3('0x34')](_0x131163[_0xc3b3('0x35')],{})[_0xc3b3('0xf')](function(_0x5f56ba){var _0x1b2087=_0x131163[_0xc3b3('0x36')][_0xc3b3('0x11')]({'plain':!![]});if(!_0x1b2087)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b2087['role']==='user'){var _0xa05d9c=_0x5f56ba[_0xc3b3('0x11')]({'plain':!![]});var _0x5102d6='SquareProjects';return db[_0xc3b3('0x37')]['find']({'where':{'name':_0x5102d6,'userProfileId':_0x1b2087[_0xc3b3('0x38')]},'raw':!![]})['then'](function(_0x41437a){if(_0x41437a&&_0x41437a[_0xc3b3('0x39')]===0x0){return db[_0xc3b3('0x13')][_0xc3b3('0x34')]({'name':_0xa05d9c[_0xc3b3('0x18')],'resourceId':_0xa05d9c['id'],'type':_0x41437a[_0xc3b3('0x18')],'sectionId':_0x41437a['id']},{})[_0xc3b3('0xf')](function(){return _0x5f56ba;});}else{return _0x5f56ba;}})[_0xc3b3('0x30')](function(_0x107f42){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x107f42);throw _0x107f42;});}return _0x5f56ba;})[_0xc3b3('0xf')](respondWithResult(_0xf6a9ea,0xc9))[_0xc3b3('0x30')](handleError(_0xf6a9ea,null));};exports[_0xc3b3('0xe')]=function(_0x280b78,_0x86b84f){if(_0x280b78[_0xc3b3('0x35')]['id']){delete _0x280b78[_0xc3b3('0x35')]['id'];}return db['SquareProject'][_0xc3b3('0x33')]({'where':{'id':_0x280b78[_0xc3b3('0x31')]['id']}})[_0xc3b3('0xf')](handleEntityNotFound(_0x86b84f,null))[_0xc3b3('0xf')](saveUpdates(_0x280b78[_0xc3b3('0x35')],null))[_0xc3b3('0xf')](function(_0x53cab7){if(!_0x53cab7)return;var _0x58d671=_0x53cab7[_0xc3b3('0x11')]({'plain':!![]});return _0x58d671;})[_0xc3b3('0xf')](function(_0x4f980a){var _0x1692b0=new Redis(config[_0xc3b3('0x4')]);_0x1692b0[_0xc3b3('0x14')](_0xc3b3('0x15'),JSON['stringify'](_['pick'](_0x4f980a,['id',_0xc3b3('0x18'),_0xc3b3('0x3a')])));return _0x4f980a;})['then'](respondWithResult(_0x86b84f,null))[_0xc3b3('0x30')](handleError(_0x86b84f,null));};exports[_0xc3b3('0x10')]=function(_0x233a01,_0x37e823){return db[_0xc3b3('0x1a')][_0xc3b3('0x33')]({'where':{'id':_0x233a01['params']['id']}})[_0xc3b3('0xf')](handleEntityNotFound(_0x37e823,null))[_0xc3b3('0xf')](removeEntity(_0x37e823,null))[_0xc3b3('0x30')](handleError(_0x37e823,null));}; \ No newline at end of file +var _0x94f4=['include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','status','json','undefined','limit','offset','Content-Range','update','then','destroy','get','SquareProjects','publish','stringify','end','error','name','send','index','map','SquareProject','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll'];(function(_0x2b082f,_0x65ad67){var _0x133d03=function(_0x32c1ce){while(--_0x32c1ce){_0x2b082f['push'](_0x2b082f['shift']());}};_0x133d03(++_0x65ad67);}(_0x94f4,0xdb));var _0x494f=function(_0x2a54f6,_0x46cc39){_0x2a54f6=_0x2a54f6-0x0;var _0x493b89=_0x94f4[_0x2a54f6];return _0x493b89;};'use strict';var _=require(_0x494f('0x0'));var Redis=require('ioredis');var qs=require(_0x494f('0x1'));var logger=require(_0x494f('0x2'))(_0x494f('0x3'));var config=require(_0x494f('0x4'));var db=require(_0x494f('0x5'))['db'];config['redis']=_[_0x494f('0x6')](config[_0x494f('0x7')],{'host':_0x494f('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x494f('0x7')]));require('./squareProject.socket')[_0x494f('0x9')](socket);function respondWithResult(_0x52fef0,_0x517200){_0x517200=_0x517200||0xc8;return function(_0x5c7a73){if(_0x5c7a73){return _0x52fef0[_0x494f('0xa')](_0x517200)[_0x494f('0xb')](_0x5c7a73);}};}function respondWithFilteredResult(_0x50e11d,_0x570eb6){return function(_0x27ab6a){if(_0x27ab6a){var _0x4163c8=typeof _0x570eb6['offset']===_0x494f('0xc')&&typeof _0x570eb6[_0x494f('0xd')]==='undefined';var _0x5344ed=_0x27ab6a['count'];var _0x4a6f54=_0x4163c8?0x0:_0x570eb6[_0x494f('0xe')];var _0x46772a=_0x4163c8?_0x27ab6a['count']:_0x570eb6[_0x494f('0xe')]+_0x570eb6['limit'];var _0x3a9b9b;if(_0x46772a>=_0x5344ed){_0x46772a=_0x5344ed;_0x3a9b9b=0xc8;}else{_0x3a9b9b=0xce;}_0x50e11d[_0x494f('0xa')](_0x3a9b9b);return _0x50e11d['set'](_0x494f('0xf'),_0x4a6f54+'-'+_0x46772a+'/'+_0x5344ed)['json'](_0x27ab6a);}return null;};}function saveUpdates(_0x2a4e9b){return function(_0x22c3aa){if(_0x22c3aa){return _0x22c3aa[_0x494f('0x10')](_0x2a4e9b)[_0x494f('0x11')](function(_0x247416){return _0x247416;});}return null;};}function removeEntity(_0x16862e){return function(_0x331cf4){if(_0x331cf4){return _0x331cf4[_0x494f('0x12')]()[_0x494f('0x11')](function(){var _0x19eb50=_0x331cf4[_0x494f('0x13')]({'plain':!![]});var _0x2849db=_0x494f('0x14');return db['UserProfileResource']['destroy']({'where':{'type':_0x2849db,'resourceId':_0x19eb50['id']}})[_0x494f('0x11')](function(){return _0x331cf4;});})[_0x494f('0x11')](function(){var _0x36f7e9=new Redis(config['redis']);_0x36f7e9[_0x494f('0x15')]('agi',JSON[_0x494f('0x16')]({'id':_0x331cf4['id'],'deleted':!![]}));})['then'](function(){_0x16862e['status'](0xcc)[_0x494f('0x17')]();});}};}function handleEntityNotFound(_0x4b5c96){return function(_0x32abf7){if(!_0x32abf7){_0x4b5c96['sendStatus'](0x194);}return _0x32abf7;};}function handleError(_0x2a24b8,_0x268ec9){_0x268ec9=_0x268ec9||0x1f4;return function(_0x433138){logger[_0x494f('0x18')](_0x433138['stack']);if(_0x433138[_0x494f('0x19')]){delete _0x433138['name'];}_0x2a24b8[_0x494f('0xa')](_0x268ec9)[_0x494f('0x1a')](_0x433138);};}exports[_0x494f('0x1b')]=function(_0x29dcfe,_0x545520){var _0x5b837f={},_0x2b4273={},_0x295a7a={'count':0x0,'rows':[]};var _0x53690d=_[_0x494f('0x1c')](db[_0x494f('0x1d')]['rawAttributes'],function(_0x362c56){return{'name':_0x362c56[_0x494f('0x1e')],'type':_0x362c56[_0x494f('0x1f')][_0x494f('0x20')]};});_0x2b4273[_0x494f('0x21')]=_[_0x494f('0x1c')](_0x53690d,'name');_0x2b4273[_0x494f('0x22')]=_['keys'](_0x29dcfe['query']);_0x2b4273[_0x494f('0x23')]=_[_0x494f('0x24')](_0x2b4273[_0x494f('0x21')],_0x2b4273['query']);_0x5b837f[_0x494f('0x25')]=_[_0x494f('0x24')](_0x2b4273[_0x494f('0x21')],qs['fields'](_0x29dcfe['query']['fields']));_0x5b837f[_0x494f('0x25')]=_0x5b837f[_0x494f('0x25')][_0x494f('0x26')]?_0x5b837f[_0x494f('0x25')]:_0x2b4273[_0x494f('0x21')];if(!_0x29dcfe['query']['hasOwnProperty'](_0x494f('0x27'))){_0x5b837f[_0x494f('0xd')]=qs[_0x494f('0xd')](_0x29dcfe[_0x494f('0x22')][_0x494f('0xd')]);_0x5b837f[_0x494f('0xe')]=qs['offset'](_0x29dcfe[_0x494f('0x22')][_0x494f('0xe')]);}_0x5b837f[_0x494f('0x28')]=qs['sort'](_0x29dcfe[_0x494f('0x22')][_0x494f('0x29')]);_0x5b837f[_0x494f('0x2a')]=qs[_0x494f('0x23')](_[_0x494f('0x2b')](_0x29dcfe['query'],_0x2b4273[_0x494f('0x23')]),_0x53690d);if(_0x29dcfe[_0x494f('0x22')][_0x494f('0x2c')]){_0x5b837f['where']=_['merge'](_0x5b837f[_0x494f('0x2a')],{'$or':_[_0x494f('0x1c')](_0x53690d,function(_0x416106){if(_0x416106[_0x494f('0x1f')]!==_0x494f('0x2d')){var _0x632c45={};_0x632c45[_0x416106[_0x494f('0x19')]]={'$like':'%'+_0x29dcfe[_0x494f('0x22')][_0x494f('0x2c')]+'%'};return _0x632c45;}})});}_0x5b837f=_[_0x494f('0x2e')]({},_0x5b837f,_0x29dcfe['options']);var _0x392918={'where':_0x5b837f[_0x494f('0x2a')]};return db[_0x494f('0x1d')][_0x494f('0x2f')](_0x392918)[_0x494f('0x11')](function(_0x41f704){_0x295a7a[_0x494f('0x2f')]=_0x41f704;if(_0x29dcfe['query'][_0x494f('0x30')]){_0x5b837f[_0x494f('0x31')]=[{'all':!![]}];}return db[_0x494f('0x1d')][_0x494f('0x32')](_0x5b837f);})['then'](function(_0x44c7ab){_0x295a7a[_0x494f('0x33')]=_0x44c7ab;return _0x295a7a;})[_0x494f('0x11')](respondWithFilteredResult(_0x545520,_0x5b837f))[_0x494f('0x34')](handleError(_0x545520,null));};exports[_0x494f('0x35')]=function(_0x45e674,_0x532679){var _0x48f13b={'raw':![],'where':{'id':_0x45e674[_0x494f('0x36')]['id']}},_0x10bbd6={};_0x10bbd6['model']=_['keys'](db[_0x494f('0x1d')]['rawAttributes']);_0x10bbd6['query']=_[_0x494f('0x37')](_0x45e674[_0x494f('0x22')]);_0x10bbd6[_0x494f('0x23')]=_['intersection'](_0x10bbd6[_0x494f('0x21')],_0x10bbd6[_0x494f('0x22')]);_0x48f13b[_0x494f('0x25')]=_['intersection'](_0x10bbd6[_0x494f('0x21')],qs[_0x494f('0x38')](_0x45e674[_0x494f('0x22')][_0x494f('0x38')]));_0x48f13b['attributes']=_0x48f13b[_0x494f('0x25')][_0x494f('0x26')]?_0x48f13b[_0x494f('0x25')]:_0x10bbd6['model'];if(_0x45e674[_0x494f('0x22')][_0x494f('0x30')]){_0x48f13b[_0x494f('0x31')]=[{'all':!![]}];}_0x48f13b=_[_0x494f('0x2e')]({},_0x48f13b,_0x45e674['options']);return db[_0x494f('0x1d')][_0x494f('0x39')](_0x48f13b)[_0x494f('0x11')](handleEntityNotFound(_0x532679,null))[_0x494f('0x11')](respondWithResult(_0x532679,null))[_0x494f('0x34')](handleError(_0x532679,null));};exports[_0x494f('0x3a')]=function(_0x356d0c,_0x2db3f9){return db[_0x494f('0x1d')][_0x494f('0x3a')](_0x356d0c[_0x494f('0x3b')],{})[_0x494f('0x11')](function(_0x23824b){var _0x35bdef=_0x356d0c[_0x494f('0x3c')][_0x494f('0x13')]({'plain':!![]});if(!_0x35bdef)throw new Error(_0x494f('0x3d'));if(_0x35bdef['role']===_0x494f('0x3c')){var _0x25f68d=_0x23824b[_0x494f('0x13')]({'plain':!![]});var _0x45a88e=_0x494f('0x14');return db['UserProfileSection'][_0x494f('0x39')]({'where':{'name':_0x45a88e,'userProfileId':_0x35bdef[_0x494f('0x3e')]},'raw':!![]})[_0x494f('0x11')](function(_0x464417){if(_0x464417&&_0x464417[_0x494f('0x3f')]===0x0){return db['UserProfileResource']['create']({'name':_0x25f68d[_0x494f('0x19')],'resourceId':_0x25f68d['id'],'type':_0x464417[_0x494f('0x19')],'sectionId':_0x464417['id']},{})[_0x494f('0x11')](function(){return _0x23824b;});}else{return _0x23824b;}})[_0x494f('0x34')](function(_0x4f0fc9){logger[_0x494f('0x18')](_0x494f('0x40'),_0x4f0fc9);throw _0x4f0fc9;});}return _0x23824b;})[_0x494f('0x11')](respondWithResult(_0x2db3f9,0xc9))['catch'](handleError(_0x2db3f9,null));};exports['update']=function(_0xc5f07,_0x201e5b){if(_0xc5f07[_0x494f('0x3b')]['id']){delete _0xc5f07['body']['id'];}return db['SquareProject'][_0x494f('0x39')]({'where':{'id':_0xc5f07[_0x494f('0x36')]['id']}})['then'](handleEntityNotFound(_0x201e5b,null))[_0x494f('0x11')](saveUpdates(_0xc5f07[_0x494f('0x3b')],null))[_0x494f('0x11')](function(_0x446152){if(!_0x446152)return;var _0x494fff=_0x446152[_0x494f('0x13')]({'plain':!![]});return _0x494fff;})[_0x494f('0x11')](function(_0x292e1d){var _0x2744ae=new Redis(config[_0x494f('0x7')]);_0x2744ae[_0x494f('0x15')](_0x494f('0x41'),JSON[_0x494f('0x16')](_[_0x494f('0x2b')](_0x292e1d,['id',_0x494f('0x19'),_0x494f('0x42')])));return _0x292e1d;})[_0x494f('0x11')](respondWithResult(_0x201e5b,null))[_0x494f('0x34')](handleError(_0x201e5b,null));};exports[_0x494f('0x12')]=function(_0x10fc56,_0x561483){return db[_0x494f('0x1d')][_0x494f('0x39')]({'where':{'id':_0x10fc56['params']['id']}})[_0x494f('0x11')](handleEntityNotFound(_0x561483,null))[_0x494f('0x11')](removeEntity(_0x561483,null))['catch'](handleError(_0x561483,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3a2ebe0..8ec2e35 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 _0xd248=['save','update','remove','emit','exports','events','SquareProject','setMaxListeners'];(function(_0x38e1c3,_0x421148){var _0x451552=function(_0x42f872){while(--_0x42f872){_0x38e1c3['push'](_0x38e1c3['shift']());}};_0x451552(++_0x421148);}(_0xd248,0x7d));var _0x8d24=function(_0xf2931a,_0x2d490b){_0xf2931a=_0xf2931a-0x0;var _0x45c15d=_0xd248[_0xf2931a];return _0x45c15d;};'use strict';var EventEmitter=require(_0x8d24('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x8d24('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8d24('0x2')](0x0);var events={'afterCreate':_0x8d24('0x3'),'afterUpdate':_0x8d24('0x4'),'afterDestroy':_0x8d24('0x5')};function emitEvent(_0x14456b){return function(_0x110e27,_0x16ab53,_0x3a5783){SquareProjectEvents[_0x8d24('0x6')](_0x14456b+':'+_0x110e27['id'],_0x110e27);SquareProjectEvents['emit'](_0x14456b,_0x110e27);_0x3a5783(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x8d24('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x5249=['events','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1d6386,_0x10904b){var _0x47c516=function(_0xe544a8){while(--_0xe544a8){_0x1d6386['push'](_0x1d6386['shift']());}};_0x47c516(++_0x10904b);}(_0x5249,0x75));var _0x9524=function(_0x541565,_0xbacd48){_0x541565=_0x541565-0x0;var _0x1464ef=_0x5249[_0x541565];return _0x1464ef;};'use strict';var EventEmitter=require(_0x9524('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x9524('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9524('0x2')](0x0);var events={'afterCreate':_0x9524('0x3'),'afterUpdate':_0x9524('0x4'),'afterDestroy':_0x9524('0x5')};function emitEvent(_0xe74443){return function(_0x58dde4,_0x227da1,_0x48341a){SquareProjectEvents[_0x9524('0x6')](_0xe74443+':'+_0x58dde4['id'],_0x58dde4);SquareProjectEvents[_0x9524('0x6')](_0xe74443,_0x58dde4);_0x48341a(null);};}for(var e in events){if(events[_0x9524('0x7')](e)){var event=events[e];SquareProject[_0x9524('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 45b4b81..6662569 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 _0xf59f=['api','moment','path','rimraf','../../config/environment','exports','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','util'];(function(_0x535c4a,_0xba5232){var _0x900f1b=function(_0x5b4ca8){while(--_0x5b4ca8){_0x535c4a['push'](_0x535c4a['shift']());}};_0x900f1b(++_0xba5232);}(_0xf59f,0x77));var _0xff59=function(_0x160959,_0x40a945){_0x160959=_0x160959-0x0;var _0x2e0b6c=_0xf59f[_0x160959];return _0x2e0b6c;};'use strict';var _=require('lodash');var util=require(_0xff59('0x0'));var logger=require('../../config/logger')(_0xff59('0x1'));var moment=require(_0xff59('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff59('0x3'));var rimraf=require(_0xff59('0x4'));var config=require(_0xff59('0x5'));var attributes=require('./squareProject.attributes');module[_0xff59('0x6')]=function(_0x275c9f,_0x501907){return _0x275c9f[_0xff59('0x7')](_0xff59('0x8'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57961c,_0x18cac0,_0x3e0f4d){if(_0x57961c[_0xff59('0x9')](_0xff59('0xa'))){_0x57961c[_0xff59('0xb')]=moment()[_0xff59('0xc')](_0xff59('0xd'));}if(_0x57961c[_0xff59('0x9')]('production')){_0x57961c[_0xff59('0xe')]=moment()[_0xff59('0xc')](_0xff59('0xd'));}_0x3e0f4d(null,_0x57961c);}}});}; \ No newline at end of file +var _0x827d=['bluebird','request-promise','path','../../config/environment','exports','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util'];(function(_0x93be30,_0x1be6c3){var _0x4d6c2c=function(_0x938e14){while(--_0x938e14){_0x93be30['push'](_0x93be30['shift']());}};_0x4d6c2c(++_0x1be6c3);}(_0x827d,0xdf));var _0xd827=function(_0x987b7e,_0x14abb1){_0x987b7e=_0x987b7e-0x0;var _0x211d3d=_0x827d[_0x987b7e];return _0x211d3d;};'use strict';var _=require(_0xd827('0x0'));var util=require(_0xd827('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd827('0x2'));var rp=require(_0xd827('0x3'));var fs=require('fs');var path=require(_0xd827('0x4'));var rimraf=require('rimraf');var config=require(_0xd827('0x5'));var attributes=require('./squareProject.attributes');module[_0xd827('0x6')]=function(_0x357c0b,_0x105998){return _0x357c0b[_0xd827('0x7')](_0xd827('0x8'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35cc70,_0x4fc7c7,_0x44c870){if(_0x35cc70[_0xd827('0x9')](_0xd827('0xa'))){_0x35cc70[_0xd827('0xb')]=moment()[_0xd827('0xc')](_0xd827('0xd'));}if(_0x35cc70[_0xd827('0x9')](_0xd827('0xe'))){_0x35cc70['publishedAt']=moment()[_0xd827('0xc')](_0xd827('0xd'));}_0x44c870(null,_0x35cc70);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 432a90f..39e01e0 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 _0xb6fb=['ioredis','../../config/logger','rpc','defaults','localhost','GetSquareProjects','findAll','options','raw','where','attributes','include','map','model','info','stringify','error','message','ShowSquareProject','then','debug','catch','lodash'];(function(_0x1b2477,_0x368cc0){var _0x38b837=function(_0x353499){while(--_0x353499){_0x1b2477['push'](_0x1b2477['shift']());}};_0x38b837(++_0x368cc0);}(_0xb6fb,0x141));var _0xbb6f=function(_0x46797c,_0x2f5cba){_0x46797c=_0x46797c-0x0;var _0x334197=_0xb6fb[_0x46797c];return _0x334197;};'use strict';var _=require(_0xbb6f('0x0'));var Redis=require(_0xbb6f('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xbb6f('0x2'))(_0xbb6f('0x3'));var config=require('../../config/environment');config['redis']=_[_0xbb6f('0x4')](config['redis'],{'host':_0xbb6f('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);exports[_0xbb6f('0x6')]=function(_0x532a90){var _0x183243=this;return new Promise(function(_0x5bc006,_0x125739){return db['SquareProject'][_0xbb6f('0x7')]({'raw':_0x532a90[_0xbb6f('0x8')]?_0x532a90[_0xbb6f('0x8')][_0xbb6f('0x9')]===undefined?!![]:![]:!![],'where':_0x532a90[_0xbb6f('0x8')]?_0x532a90[_0xbb6f('0x8')][_0xbb6f('0xa')]||null:null,'attributes':_0x532a90[_0xbb6f('0x8')]?_0x532a90[_0xbb6f('0x8')][_0xbb6f('0xb')]||null:null,'limit':_0x532a90[_0xbb6f('0x8')]?_0x532a90[_0xbb6f('0x8')]['limit']||null:null,'include':_0x532a90['options']?_0x532a90['options'][_0xbb6f('0xc')]?_[_0xbb6f('0xd')](_0x532a90['options']['include'],function(_0x6a4e8){return{'model':db[_0x6a4e8[_0xbb6f('0xe')]],'as':_0x6a4e8['as'],'attributes':_0x6a4e8[_0xbb6f('0xb')],'include':_0x6a4e8[_0xbb6f('0xc')]?_[_0xbb6f('0xd')](_0x6a4e8[_0xbb6f('0xc')],function(_0x3e517d){return{'model':db[_0x3e517d[_0xbb6f('0xe')]],'as':_0x3e517d['as'],'attributes':_0x3e517d[_0xbb6f('0xb')],'include':_0x3e517d['include']?_[_0xbb6f('0xd')](_0x3e517d[_0xbb6f('0xc')],function(_0x2a2da6){return{'model':db[_0x2a2da6[_0xbb6f('0xe')]],'as':_0x2a2da6['as'],'attributes':_0x2a2da6[_0xbb6f('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44dbf8){logger[_0xbb6f('0xf')]('GetSquareProjects',_0x532a90);logger['debug']('GetSquareProjects',_0x532a90,JSON[_0xbb6f('0x10')](_0x44dbf8));_0x5bc006(_0x44dbf8);})['catch'](function(_0x18e03c){logger[_0xbb6f('0x11')](_0xbb6f('0x6'),_0x18e03c[_0xbb6f('0x12')],_0x532a90);_0x125739(_0x183243[_0xbb6f('0x11')](0x1f4,_0x18e03c['message']));});});};exports[_0xbb6f('0x13')]=function(_0xabc1d4){var _0x3a9a40=this;return new Promise(function(_0x4dbfc5,_0x2251e9){return db['SquareProject']['find']({'raw':_0xabc1d4[_0xbb6f('0x8')]?_0xabc1d4[_0xbb6f('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0xabc1d4[_0xbb6f('0x8')]?_0xabc1d4['options'][_0xbb6f('0xa')]||null:null,'attributes':_0xabc1d4[_0xbb6f('0x8')]?_0xabc1d4[_0xbb6f('0x8')][_0xbb6f('0xb')]||null:null,'include':_0xabc1d4[_0xbb6f('0x8')]?_0xabc1d4[_0xbb6f('0x8')][_0xbb6f('0xc')]?_[_0xbb6f('0xd')](_0xabc1d4[_0xbb6f('0x8')][_0xbb6f('0xc')],function(_0x3e332e){return{'model':db[_0x3e332e[_0xbb6f('0xe')]],'as':_0x3e332e['as'],'attributes':_0x3e332e['attributes'],'include':_0x3e332e['include']?_[_0xbb6f('0xd')](_0x3e332e[_0xbb6f('0xc')],function(_0x53adaf){return{'model':db[_0x53adaf[_0xbb6f('0xe')]],'as':_0x53adaf['as'],'attributes':_0x53adaf[_0xbb6f('0xb')],'include':_0x53adaf[_0xbb6f('0xc')]?_[_0xbb6f('0xd')](_0x53adaf['include'],function(_0x503f29){return{'model':db[_0x503f29['model']],'as':_0x503f29['as'],'attributes':_0x503f29['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb6f('0x14')](function(_0x387d54){logger[_0xbb6f('0xf')](_0xbb6f('0x13'),_0xabc1d4);logger[_0xbb6f('0x15')](_0xbb6f('0x13'),_0xabc1d4,JSON[_0xbb6f('0x10')](_0x387d54));_0x4dbfc5(_0x387d54);})[_0xbb6f('0x16')](function(_0x62b73c){logger['error']('ShowSquareProject',_0x62b73c[_0xbb6f('0x12')],_0xabc1d4);_0x2251e9(_0x3a9a40['error'](0x1f4,_0x62b73c[_0xbb6f('0x12')]));});});}; \ No newline at end of file +var _0x57d4=['include','model','info','stringify','catch','error','message','ShowSquareProject','find','where','map','then','debug','lodash','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes'];(function(_0x26cdbe,_0x383eb9){var _0x278b12=function(_0x26164f){while(--_0x26164f){_0x26cdbe['push'](_0x26cdbe['shift']());}};_0x278b12(++_0x383eb9);}(_0x57d4,0x9e));var _0x457d=function(_0xd7944c,_0x13e945){_0xd7944c=_0xd7944c-0x0;var _0x569633=_0x57d4[_0xd7944c];return _0x569633;};'use strict';var _=require(_0x457d('0x0'));var Redis=require(_0x457d('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x457d('0x2'))('rpc');var config=require(_0x457d('0x3'));config[_0x457d('0x4')]=_[_0x457d('0x5')](config['redis'],{'host':_0x457d('0x6'),'port':0x18eb});var socket=require(_0x457d('0x7'))(new Redis(config[_0x457d('0x4')]));require(_0x457d('0x8'))[_0x457d('0x9')](socket);exports[_0x457d('0xa')]=function(_0x2be8bc){var _0x44b1ec=this;return new Promise(function(_0x4f187a,_0x147db6){return db[_0x457d('0xb')][_0x457d('0xc')]({'raw':_0x2be8bc[_0x457d('0xd')]?_0x2be8bc[_0x457d('0xd')][_0x457d('0xe')]===undefined?!![]:![]:!![],'where':_0x2be8bc['options']?_0x2be8bc[_0x457d('0xd')]['where']||null:null,'attributes':_0x2be8bc[_0x457d('0xd')]?_0x2be8bc[_0x457d('0xd')][_0x457d('0xf')]||null:null,'limit':_0x2be8bc['options']?_0x2be8bc[_0x457d('0xd')]['limit']||null:null,'include':_0x2be8bc[_0x457d('0xd')]?_0x2be8bc['options'][_0x457d('0x10')]?_['map'](_0x2be8bc[_0x457d('0xd')][_0x457d('0x10')],function(_0x3370cd){return{'model':db[_0x3370cd[_0x457d('0x11')]],'as':_0x3370cd['as'],'attributes':_0x3370cd[_0x457d('0xf')],'include':_0x3370cd[_0x457d('0x10')]?_['map'](_0x3370cd[_0x457d('0x10')],function(_0x35c2cc){return{'model':db[_0x35c2cc[_0x457d('0x11')]],'as':_0x35c2cc['as'],'attributes':_0x35c2cc['attributes'],'include':_0x35c2cc[_0x457d('0x10')]?_['map'](_0x35c2cc[_0x457d('0x10')],function(_0x3fad67){return{'model':db[_0x3fad67[_0x457d('0x11')]],'as':_0x3fad67['as'],'attributes':_0x3fad67[_0x457d('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x360437){logger[_0x457d('0x12')](_0x457d('0xa'),_0x2be8bc);logger['debug'](_0x457d('0xa'),_0x2be8bc,JSON[_0x457d('0x13')](_0x360437));_0x4f187a(_0x360437);})[_0x457d('0x14')](function(_0x9e9cfb){logger[_0x457d('0x15')](_0x457d('0xa'),_0x9e9cfb[_0x457d('0x16')],_0x2be8bc);_0x147db6(_0x44b1ec[_0x457d('0x15')](0x1f4,_0x9e9cfb[_0x457d('0x16')]));});});};exports[_0x457d('0x17')]=function(_0x13162b){var _0x569228=this;return new Promise(function(_0x360a65,_0x207acc){return db[_0x457d('0xb')][_0x457d('0x18')]({'raw':_0x13162b['options']?_0x13162b[_0x457d('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x13162b[_0x457d('0xd')]?_0x13162b[_0x457d('0xd')][_0x457d('0x19')]||null:null,'attributes':_0x13162b['options']?_0x13162b[_0x457d('0xd')][_0x457d('0xf')]||null:null,'include':_0x13162b[_0x457d('0xd')]?_0x13162b['options'][_0x457d('0x10')]?_[_0x457d('0x1a')](_0x13162b[_0x457d('0xd')]['include'],function(_0x36fd64){return{'model':db[_0x36fd64[_0x457d('0x11')]],'as':_0x36fd64['as'],'attributes':_0x36fd64[_0x457d('0xf')],'include':_0x36fd64[_0x457d('0x10')]?_[_0x457d('0x1a')](_0x36fd64[_0x457d('0x10')],function(_0x19933f){return{'model':db[_0x19933f[_0x457d('0x11')]],'as':_0x19933f['as'],'attributes':_0x19933f[_0x457d('0xf')],'include':_0x19933f[_0x457d('0x10')]?_[_0x457d('0x1a')](_0x19933f['include'],function(_0x169c1d){return{'model':db[_0x169c1d[_0x457d('0x11')]],'as':_0x169c1d['as'],'attributes':_0x169c1d['attributes']};}):[]};}):[]};}):[]:[]})[_0x457d('0x1b')](function(_0x4f03df){logger[_0x457d('0x12')]('ShowSquareProject',_0x13162b);logger[_0x457d('0x1c')](_0x457d('0x17'),_0x13162b,JSON[_0x457d('0x13')](_0x4f03df));_0x360a65(_0x4f03df);})[_0x457d('0x14')](function(_0xda51ef){logger['error'](_0x457d('0x17'),_0xda51ef[_0x457d('0x16')],_0x13162b);_0x207acc(_0x569228[_0x457d('0x15')](0x1f4,_0xda51ef[_0x457d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9f838bb..5b3e106 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 _0xfd36=['emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x597025,_0x305ea4){var _0x1ae12f=function(_0x22ea02){while(--_0x22ea02){_0x597025['push'](_0x597025['shift']());}};_0x1ae12f(++_0x305ea4);}(_0xfd36,0xa7));var _0x6fd3=function(_0x1df0bb,_0x251c51){_0x1df0bb=_0x1df0bb-0x0;var _0x41a310=_0xfd36[_0x1df0bb];return _0x41a310;};'use strict';var SquareProjectEvents=require(_0x6fd3('0x0'));var events=[_0x6fd3('0x1'),_0x6fd3('0x2'),_0x6fd3('0x3')];function createListener(_0x428488,_0x1109db){return function(_0x731917){_0x1109db[_0x6fd3('0x4')](_0x428488,_0x731917);};}function removeListener(_0x21ee3e,_0x5abcca){return function(){SquareProjectEvents[_0x6fd3('0x5')](_0x21ee3e,_0x5abcca);};}exports[_0x6fd3('0x6')]=function(_0x26b0a4){for(var _0x49bad0=0x0,_0x30f12f=events[_0x6fd3('0x7')];_0x49bad0<_0x30f12f;_0x49bad0++){var _0x560b8e=events[_0x49bad0];var _0x4fc0e6=createListener(_0x6fd3('0x8')+_0x560b8e,_0x26b0a4);SquareProjectEvents['on'](_0x560b8e,_0x4fc0e6);}}; \ No newline at end of file +var _0x9b0b=['remove','update','emit','removeListener','register','length','squareProject:','save'];(function(_0x20d500,_0x124cf3){var _0x12bdc8=function(_0x535b29){while(--_0x535b29){_0x20d500['push'](_0x20d500['shift']());}};_0x12bdc8(++_0x124cf3);}(_0x9b0b,0x1c7));var _0xb9b0=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0x9b0b[_0x38841c];return _0x500610;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xb9b0('0x0'),_0xb9b0('0x1'),_0xb9b0('0x2')];function createListener(_0x1751bf,_0x401946){return function(_0x4c9b8c){_0x401946[_0xb9b0('0x3')](_0x1751bf,_0x4c9b8c);};}function removeListener(_0x3f6e9e,_0x51db99){return function(){SquareProjectEvents[_0xb9b0('0x4')](_0x3f6e9e,_0x51db99);};}exports[_0xb9b0('0x5')]=function(_0x1d2ca7){for(var _0x585843=0x0,_0x1f1ec5=events[_0xb9b0('0x6')];_0x585843<_0x1f1ec5;_0x585843++){var _0x8414ff=events[_0x585843];var _0x9f5b70=createListener(_0xb9b0('0x7')+_0x8414ff,_0x1d2ca7);SquareProjectEvents['on'](_0x8414ff,_0x9f5b70);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ae2fe23..f854ce0 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x2dcf67,_0x22dc95){var _0x516ee2=function(_0x562035){while(--_0x562035){_0x2dcf67['push'](_0x2dcf67['shift']());}};_0x516ee2(++_0x22dc95);}(_0x5fc3,0xa8));var _0x35fc=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x5fc3[_0x31a576];return _0x30b1d3;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x4b36bb,_0x4a2aae){var _0x49f6cf=function(_0x471c36){while(--_0x471c36){_0x4b36bb['push'](_0x4b36bb['shift']());}};_0x49f6cf(++_0x4a2aae);}(_0x5fc3,0xa8));var _0x35fc=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x5fc3[_0x485b5a];return _0xd2b34d;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3b3fea8..2ec515a 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 _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x1e4957,_0xdf5686){var _0x319245=function(_0x3ac09d){while(--_0x3ac09d){_0x1e4957['push'](_0x1e4957['shift']());}};_0x319245(++_0xdf5686);}(_0x5fd1,0x155));var _0x15fd=function(_0x323e14,_0x52a272){_0x323e14=_0x323e14-0x0;var _0x5ee537=_0x5fd1[_0x323e14];return _0x5ee537;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file +var _0xb138=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x944812,_0x490212){var _0x4ce4e4=function(_0x349b3d){while(--_0x349b3d){_0x944812['push'](_0x944812['shift']());}};_0x4ce4e4(++_0x490212);}(_0xb138,0x1dd));var _0x8b13=function(_0x1136c4,_0x51025a){_0x1136c4=_0x1136c4-0x0;var _0x5a1743=_0xb138[_0x1136c4];return _0x5a1743;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'callerid':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'extension':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'dnid':{'type':Sequelize[_0x8b13('0x2')]},'projectName':{'type':Sequelize[_0x8b13('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8b13('0x2')]},'savePath':{'type':Sequelize[_0x8b13('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3fdf4d='';var _0x33d1a7=this[_0x8b13('0x3')]('savePath');if(_0x33d1a7){_0x3fdf4d=_0x33d1a7[_0x8b13('0x4')](_0x33d1a7[_0x8b13('0x5')]('.'));}return _0x3fdf4d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4ebd2ea..07f3763 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 _0x7c0f=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','SquareRecording','count','includeAll','rows','catch','params','include','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22'];(function(_0x270243,_0x2a7a79){var _0x1dd094=function(_0x2df7a2){while(--_0x2df7a2){_0x270243['push'](_0x270243['shift']());}};_0x1dd094(++_0x2a7a79);}(_0x7c0f,0x1db));var _0xf7c0=function(_0x35e641,_0x4b5f7e){_0x35e641=_0x35e641-0x0;var _0x24c608=_0x7c0f[_0x35e641];return _0x24c608;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7c0('0x0'));var zipdir=require(_0xf7c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7c0('0x2'));var moment=require(_0xf7c0('0x3'));var BPromise=require(_0xf7c0('0x4'));var Mustache=require(_0xf7c0('0x5'));var util=require(_0xf7c0('0x6'));var path=require(_0xf7c0('0x7'));var sox=require(_0xf7c0('0x8'));var csv=require(_0xf7c0('0x9'));var ejs=require(_0xf7c0('0xa'));var fs=require('fs');var fs_extra=require(_0xf7c0('0xb'));var _=require(_0xf7c0('0xc'));var squel=require(_0xf7c0('0xd'));var crypto=require(_0xf7c0('0xe'));var jsforce=require(_0xf7c0('0xf'));var deskjs=require(_0xf7c0('0x10'));var toCsv=require(_0xf7c0('0x9'));var querystring=require(_0xf7c0('0x11'));var Papa=require('papaparse');var Redis=require(_0xf7c0('0x12'));var authService=require(_0xf7c0('0x13'));var qs=require(_0xf7c0('0x14'));var as=require(_0xf7c0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7c0('0x16'))('api');var utils=require(_0xf7c0('0x17'));var config=require(_0xf7c0('0x18'));var licenseUtil=require(_0xf7c0('0x19'));var db=require(_0xf7c0('0x1a'))['db'];function respondWithStatusCode(_0x3cdb08,_0x1ae79c){_0x1ae79c=_0x1ae79c||0xcc;return function(_0x5af45c){if(_0x5af45c){return _0x3cdb08['sendStatus'](_0x1ae79c);}return _0x3cdb08[_0xf7c0('0x1b')](_0x1ae79c)[_0xf7c0('0x1c')]();};}function respondWithResult(_0x5e9539,_0x1231f3){_0x1231f3=_0x1231f3||0xc8;return function(_0x568624){if(_0x568624){return _0x5e9539['status'](_0x1231f3)[_0xf7c0('0x1d')](_0x568624);}};}function respondWithFilteredResult(_0x10ea52,_0x51733a){return function(_0x2490ef){if(_0x2490ef){var _0x56d4aa=typeof _0x51733a[_0xf7c0('0x1e')]===_0xf7c0('0x1f')&&typeof _0x51733a[_0xf7c0('0x20')]==='undefined';var _0x385d29=_0x2490ef['count'];var _0x59a553=_0x56d4aa?0x0:_0x51733a[_0xf7c0('0x1e')];var _0x305e1b=_0x56d4aa?_0x2490ef['count']:_0x51733a[_0xf7c0('0x1e')]+_0x51733a['limit'];var _0x5b28cc;if(_0x305e1b>=_0x385d29){_0x305e1b=_0x385d29;_0x5b28cc=0xc8;}else{_0x5b28cc=0xce;}_0x10ea52[_0xf7c0('0x1b')](_0x5b28cc);return _0x10ea52[_0xf7c0('0x21')](_0xf7c0('0x22'),_0x59a553+'-'+_0x305e1b+'/'+_0x385d29)['json'](_0x2490ef);}return null;};}function patchUpdates(_0x221013){return function(_0x821954){try{jsonpatch[_0xf7c0('0x23')](_0x821954,_0x221013,!![]);}catch(_0x2f41ca){return BPromise[_0xf7c0('0x24')](_0x2f41ca);}return _0x821954['save']();};}function saveUpdates(_0x47121c,_0x3dd061){return function(_0x45fbe8){if(_0x45fbe8){return _0x45fbe8[_0xf7c0('0x25')](_0x47121c)['then'](function(_0x177c90){return _0x177c90;});}return null;};}function removeEntity(_0xec6c74,_0x1c6582){return function(_0x5782d6){if(_0x5782d6){return _0x5782d6[_0xf7c0('0x26')]()[_0xf7c0('0x27')](function(){_0xec6c74[_0xf7c0('0x1b')](0xcc)[_0xf7c0('0x1c')]();});}};}function handleEntityNotFound(_0x253fb2,_0x2cc0c4){return function(_0x1ed768){if(!_0x1ed768){_0x253fb2['sendStatus'](0x194);}return _0x1ed768;};}function handleError(_0x1dcefe,_0x5cdaaa){_0x5cdaaa=_0x5cdaaa||0x1f4;return function(_0x4cf900){logger[_0xf7c0('0x28')](_0x4cf900['stack']);if(_0x4cf900['name']){delete _0x4cf900[_0xf7c0('0x29')];}_0x1dcefe[_0xf7c0('0x1b')](_0x5cdaaa)[_0xf7c0('0x2a')](_0x4cf900);};}exports['index']=function(_0x593b29,_0x429759){var _0x3bfcd8={},_0x4a3326={},_0x1321ab={'count':0x0,'rows':[]};var _0x56727a=_[_0xf7c0('0x2b')](db['SquareRecording'][_0xf7c0('0x2c')],function(_0x28dfdb){return{'name':_0x28dfdb['fieldName'],'type':_0x28dfdb[_0xf7c0('0x2d')][_0xf7c0('0x2e')]};});_0x4a3326[_0xf7c0('0x2f')]=_[_0xf7c0('0x2b')](_0x56727a,'name');_0x4a3326[_0xf7c0('0x30')]=_[_0xf7c0('0x31')](_0x593b29[_0xf7c0('0x30')]);_0x4a3326['filters']=_[_0xf7c0('0x32')](_0x4a3326['model'],_0x4a3326[_0xf7c0('0x30')]);_0x3bfcd8[_0xf7c0('0x33')]=_['intersection'](_0x4a3326[_0xf7c0('0x2f')],qs['fields'](_0x593b29[_0xf7c0('0x30')][_0xf7c0('0x34')]));_0x3bfcd8['attributes']=_0x3bfcd8[_0xf7c0('0x33')]['length']?_0x3bfcd8['attributes']:_0x4a3326[_0xf7c0('0x2f')];if(!_0x593b29[_0xf7c0('0x30')][_0xf7c0('0x35')](_0xf7c0('0x36'))){_0x3bfcd8[_0xf7c0('0x20')]=qs[_0xf7c0('0x20')](_0x593b29[_0xf7c0('0x30')][_0xf7c0('0x20')]);_0x3bfcd8[_0xf7c0('0x1e')]=qs[_0xf7c0('0x1e')](_0x593b29[_0xf7c0('0x30')][_0xf7c0('0x1e')]);}_0x3bfcd8['order']=qs[_0xf7c0('0x37')](_0x593b29[_0xf7c0('0x30')]['sort']);_0x3bfcd8[_0xf7c0('0x38')]=qs['filters'](_[_0xf7c0('0x39')](_0x593b29[_0xf7c0('0x30')],_0x4a3326[_0xf7c0('0x3a')]),_0x56727a);if(_0x593b29[_0xf7c0('0x30')][_0xf7c0('0x3b')]){_0x3bfcd8[_0xf7c0('0x38')]=_[_0xf7c0('0x3c')](_0x3bfcd8[_0xf7c0('0x38')],{'$or':_[_0xf7c0('0x2b')](_0x56727a,function(_0x13fa5e){if(_0x13fa5e[_0xf7c0('0x2d')]!=='VIRTUAL'){var _0x47f7ef={};_0x47f7ef[_0x13fa5e[_0xf7c0('0x29')]]={'$like':'%'+_0x593b29['query']['filter']+'%'};return _0x47f7ef;}})});}_0x3bfcd8=_[_0xf7c0('0x3c')]({},_0x3bfcd8,_0x593b29[_0xf7c0('0x3d')]);var _0x1ac16b={'where':_0x3bfcd8['where']};return db[_0xf7c0('0x3e')][_0xf7c0('0x3f')](_0x1ac16b)[_0xf7c0('0x27')](function(_0x389280){_0x1321ab[_0xf7c0('0x3f')]=_0x389280;if(_0x593b29[_0xf7c0('0x30')][_0xf7c0('0x40')]){_0x3bfcd8['include']=[{'all':!![]}];}return db[_0xf7c0('0x3e')]['findAll'](_0x3bfcd8);})[_0xf7c0('0x27')](function(_0x30b776){_0x1321ab[_0xf7c0('0x41')]=_0x30b776;return _0x1321ab;})[_0xf7c0('0x27')](respondWithFilteredResult(_0x429759,_0x3bfcd8))[_0xf7c0('0x42')](handleError(_0x429759,null));};exports['show']=function(_0x5effa2,_0x11b2a4){var _0x1168ff={'raw':!![],'where':{'id':_0x5effa2[_0xf7c0('0x43')]['id']}},_0x896db6={};_0x896db6['model']=_[_0xf7c0('0x31')](db[_0xf7c0('0x3e')]['rawAttributes']);_0x896db6[_0xf7c0('0x30')]=_[_0xf7c0('0x31')](_0x5effa2[_0xf7c0('0x30')]);_0x896db6[_0xf7c0('0x3a')]=_[_0xf7c0('0x32')](_0x896db6[_0xf7c0('0x2f')],_0x896db6[_0xf7c0('0x30')]);_0x1168ff[_0xf7c0('0x33')]=_[_0xf7c0('0x32')](_0x896db6[_0xf7c0('0x2f')],qs[_0xf7c0('0x34')](_0x5effa2[_0xf7c0('0x30')][_0xf7c0('0x34')]));_0x1168ff[_0xf7c0('0x33')]=_0x1168ff[_0xf7c0('0x33')]['length']?_0x1168ff[_0xf7c0('0x33')]:_0x896db6[_0xf7c0('0x2f')];if(_0x5effa2[_0xf7c0('0x30')][_0xf7c0('0x40')]){_0x1168ff[_0xf7c0('0x44')]=[{'all':!![]}];}_0x1168ff=_['merge']({},_0x1168ff,_0x5effa2['options']);return db[_0xf7c0('0x3e')]['find'](_0x1168ff)[_0xf7c0('0x27')](handleEntityNotFound(_0x11b2a4,null))[_0xf7c0('0x27')](respondWithResult(_0x11b2a4,null))['catch'](handleError(_0x11b2a4,null));};exports[_0xf7c0('0x45')]=function(_0xa833bc,_0x3f35d7){return db[_0xf7c0('0x3e')]['create'](_0xa833bc['body'],{})['then'](respondWithResult(_0x3f35d7,0xc9))['catch'](handleError(_0x3f35d7,null));};exports[_0xf7c0('0x25')]=function(_0x221db3,_0x398fa5){if(_0x221db3['body']['id']){delete _0x221db3[_0xf7c0('0x46')]['id'];}return db[_0xf7c0('0x3e')][_0xf7c0('0x47')]({'where':{'id':_0x221db3[_0xf7c0('0x43')]['id']}})[_0xf7c0('0x27')](handleEntityNotFound(_0x398fa5,null))[_0xf7c0('0x27')](saveUpdates(_0x221db3[_0xf7c0('0x46')],null))[_0xf7c0('0x27')](respondWithResult(_0x398fa5,null))[_0xf7c0('0x42')](handleError(_0x398fa5,null));};exports[_0xf7c0('0x48')]=function(_0x1a6811,_0x3dd128,_0x2251f8){var _0x41ca0c=require(_0xf7c0('0x49'));var _0x218b40=![];var _0x1c9100={};if(_0x1a6811[_0xf7c0('0x30')][_0xf7c0('0x2d')]&&_0x1a6811[_0xf7c0('0x30')]['type']==='uniqueid'){_0x1c9100[_0xf7c0('0x4a')]=_0x1a6811[_0xf7c0('0x43')]['id'];}else{_0x1c9100['id']=_0x1a6811[_0xf7c0('0x43')]['id'];}return db[_0xf7c0('0x3e')][_0xf7c0('0x47')]({'where':_0x1c9100,'attributes':['id',_0xf7c0('0x4b'),_0xf7c0('0x4c')],'raw':!![]})[_0xf7c0('0x27')](handleEntityNotFound(_0x3dd128,null))[_0xf7c0('0x27')](function(_0x3a4f81){if(_0x3a4f81){var _0x5ae4fd=_0x3a4f81['savePath'];var _0x369fbb=util[_0xf7c0('0x4d')]('%s.cypher',_0x5ae4fd);if(fs[_0xf7c0('0x4e')](_0x369fbb)){_0x218b40=!![];return _0x41ca0c[_0xf7c0('0x4f')](_0x369fbb,_0x5ae4fd,config['secrets'][_0xf7c0('0x50')])['then'](function(){return _0x3a4f81;});}return _0x3a4f81;}})[_0xf7c0('0x27')](function(_0x397fed){if(_0x397fed){var _0x400087=_0x397fed[_0xf7c0('0x4b')];if(!fs[_0xf7c0('0x4e')](_0x400087)){throw new db[(_0xf7c0('0x51'))][(_0xf7c0('0x52'))](_0xf7c0('0x53'));}if(_0x397fed[_0xf7c0('0x4c')]){return _0x3dd128[_0xf7c0('0x48')](_0x400087,_0x397fed[_0xf7c0('0x4c')]+path[_0xf7c0('0x54')](_0x400087),function(){if(_0x218b40){fs['unlink'](_0x400087);}});}else{return _0x3dd128[_0xf7c0('0x48')](_0x400087,function(_0x3db92a){if(_0x218b40){fs['unlink'](_0x400087);}});}}})[_0xf7c0('0x42')](function(_0xea3efe){if(_0xea3efe[_0xf7c0('0x55')]==='SquareRecording\x20not\x20found'){_0x3dd128[_0xf7c0('0x1b')](0x194)[_0xf7c0('0x2a')](_0xf7c0('0x56'));}else{return handleError(_0x3dd128,null);}});};exports[_0xf7c0('0x26')]=function(_0x342f5d,_0x417dd2){return db[_0xf7c0('0x3e')][_0xf7c0('0x47')]({'where':{'id':_0x342f5d['params']['id']}})[_0xf7c0('0x27')](function(_0x36eefa){if(_[_0xf7c0('0x57')](_0x36eefa)){throw new ReferenceError(_0xf7c0('0x58'));}return _0x36eefa;})[_0xf7c0('0x27')](function(_0x3ae93a){var _0x4a772b=_0x3ae93a['savePath'];logger[_0xf7c0('0x59')](_0xf7c0('0x5a'),_0x4a772b);if(!_[_0xf7c0('0x57')](_0x3ae93a[_0xf7c0('0x4b')])&&fs[_0xf7c0('0x4e')](_0x4a772b)){logger[_0xf7c0('0x59')]('File:\x20\x22'+_0x4a772b+_0xf7c0('0x5b'));fs[_0xf7c0('0x5c')](_0x4a772b);}_0x4a772b=_0x4a772b+_0xf7c0('0x5d');if(!_[_0xf7c0('0x57')](_0x3ae93a['savePath'])&&fs[_0xf7c0('0x4e')](_0x4a772b)){logger['info'](_0xf7c0('0x5e')+_0x4a772b+_0xf7c0('0x5b'));fs[_0xf7c0('0x5c')](_0x4a772b);}return _0x3ae93a;})[_0xf7c0('0x27')](function(_0x3a44ab){if(!_0x3a44ab)throw new InternalError();return _0x3a44ab[_0xf7c0('0x26')]();})[_0xf7c0('0x27')](function(){_0x417dd2['status'](0xcc)[_0xf7c0('0x1c')]();})[_0xf7c0('0x42')](handleError(_0x417dd2,null));}; \ No newline at end of file +var _0xaaff=['map','SquareRecording','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','../../components/encryptor','filename','format','%s.cypher','secrets','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','savePath','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','stack','name','send'];(function(_0x13f52c,_0x4cd8f2){var _0x3ca8c9=function(_0x384726){while(--_0x384726){_0x13f52c['push'](_0x13f52c['shift']());}};_0x3ca8c9(++_0x4cd8f2);}(_0xaaff,0x152));var _0xfaaf=function(_0x1bfda4,_0x4a1d18){_0x1bfda4=_0x1bfda4-0x0;var _0x2a3741=_0xaaff[_0x1bfda4];return _0x2a3741;};'use strict';var emlformat=require(_0xfaaf('0x0'));var rimraf=require(_0xfaaf('0x1'));var zipdir=require(_0xfaaf('0x2'));var jsonpatch=require(_0xfaaf('0x3'));var rp=require(_0xfaaf('0x4'));var moment=require(_0xfaaf('0x5'));var BPromise=require(_0xfaaf('0x6'));var Mustache=require(_0xfaaf('0x7'));var util=require('util');var path=require(_0xfaaf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfaaf('0x9'));var fs=require('fs');var fs_extra=require(_0xfaaf('0xa'));var _=require(_0xfaaf('0xb'));var squel=require('squel');var crypto=require(_0xfaaf('0xc'));var jsforce=require(_0xfaaf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfaaf('0xe'));var querystring=require('querystring');var Papa=require(_0xfaaf('0xf'));var Redis=require(_0xfaaf('0x10'));var authService=require(_0xfaaf('0x11'));var qs=require(_0xfaaf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfaaf('0x13'));var logger=require('../../config/logger')(_0xfaaf('0x14'));var utils=require(_0xfaaf('0x15'));var config=require(_0xfaaf('0x16'));var licenseUtil=require(_0xfaaf('0x17'));var db=require(_0xfaaf('0x18'))['db'];function respondWithStatusCode(_0x10db9a,_0x219009){_0x219009=_0x219009||0xcc;return function(_0x4fce06){if(_0x4fce06){return _0x10db9a[_0xfaaf('0x19')](_0x219009);}return _0x10db9a[_0xfaaf('0x1a')](_0x219009)[_0xfaaf('0x1b')]();};}function respondWithResult(_0x12ca7e,_0x34b151){_0x34b151=_0x34b151||0xc8;return function(_0x5f2b3a){if(_0x5f2b3a){return _0x12ca7e['status'](_0x34b151)['json'](_0x5f2b3a);}};}function respondWithFilteredResult(_0x5b07b5,_0x35b952){return function(_0x20f02e){if(_0x20f02e){var _0x35ef68=typeof _0x35b952[_0xfaaf('0x1c')]==='undefined'&&typeof _0x35b952['limit']===_0xfaaf('0x1d');var _0x207c8b=_0x20f02e[_0xfaaf('0x1e')];var _0x6c3a7d=_0x35ef68?0x0:_0x35b952[_0xfaaf('0x1c')];var _0x5e1985=_0x35ef68?_0x20f02e[_0xfaaf('0x1e')]:_0x35b952[_0xfaaf('0x1c')]+_0x35b952[_0xfaaf('0x1f')];var _0x47fcbc;if(_0x5e1985>=_0x207c8b){_0x5e1985=_0x207c8b;_0x47fcbc=0xc8;}else{_0x47fcbc=0xce;}_0x5b07b5[_0xfaaf('0x1a')](_0x47fcbc);return _0x5b07b5[_0xfaaf('0x20')](_0xfaaf('0x21'),_0x6c3a7d+'-'+_0x5e1985+'/'+_0x207c8b)[_0xfaaf('0x22')](_0x20f02e);}return null;};}function patchUpdates(_0xfbb9ac){return function(_0x454551){try{jsonpatch[_0xfaaf('0x23')](_0x454551,_0xfbb9ac,!![]);}catch(_0x53cf94){return BPromise['reject'](_0x53cf94);}return _0x454551[_0xfaaf('0x24')]();};}function saveUpdates(_0x1f09ad,_0x447642){return function(_0x49f70d){if(_0x49f70d){return _0x49f70d[_0xfaaf('0x25')](_0x1f09ad)[_0xfaaf('0x26')](function(_0x2dfc8d){return _0x2dfc8d;});}return null;};}function removeEntity(_0x41f996,_0x1806f9){return function(_0x43b620){if(_0x43b620){return _0x43b620['destroy']()['then'](function(){_0x41f996[_0xfaaf('0x1a')](0xcc)[_0xfaaf('0x1b')]();});}};}function handleEntityNotFound(_0x2a88d6,_0x2ae9c8){return function(_0x37bf45){if(!_0x37bf45){_0x2a88d6[_0xfaaf('0x19')](0x194);}return _0x37bf45;};}function handleError(_0x4edbdf,_0xd73fb){_0xd73fb=_0xd73fb||0x1f4;return function(_0x5a5ff4){logger['error'](_0x5a5ff4[_0xfaaf('0x27')]);if(_0x5a5ff4[_0xfaaf('0x28')]){delete _0x5a5ff4['name'];}_0x4edbdf[_0xfaaf('0x1a')](_0xd73fb)[_0xfaaf('0x29')](_0x5a5ff4);};}exports['index']=function(_0x3bc4de,_0x56dae7){var _0x1871b1={},_0x1e7397={},_0x5a4a74={'count':0x0,'rows':[]};var _0x3f1479=_[_0xfaaf('0x2a')](db[_0xfaaf('0x2b')][_0xfaaf('0x2c')],function(_0x48962e){return{'name':_0x48962e['fieldName'],'type':_0x48962e[_0xfaaf('0x2d')]['key']};});_0x1e7397[_0xfaaf('0x2e')]=_[_0xfaaf('0x2a')](_0x3f1479,_0xfaaf('0x28'));_0x1e7397[_0xfaaf('0x2f')]=_[_0xfaaf('0x30')](_0x3bc4de[_0xfaaf('0x2f')]);_0x1e7397['filters']=_[_0xfaaf('0x31')](_0x1e7397['model'],_0x1e7397['query']);_0x1871b1[_0xfaaf('0x32')]=_[_0xfaaf('0x31')](_0x1e7397[_0xfaaf('0x2e')],qs[_0xfaaf('0x33')](_0x3bc4de[_0xfaaf('0x2f')][_0xfaaf('0x33')]));_0x1871b1[_0xfaaf('0x32')]=_0x1871b1[_0xfaaf('0x32')][_0xfaaf('0x34')]?_0x1871b1[_0xfaaf('0x32')]:_0x1e7397[_0xfaaf('0x2e')];if(!_0x3bc4de[_0xfaaf('0x2f')]['hasOwnProperty']('nolimit')){_0x1871b1[_0xfaaf('0x1f')]=qs[_0xfaaf('0x1f')](_0x3bc4de['query'][_0xfaaf('0x1f')]);_0x1871b1[_0xfaaf('0x1c')]=qs[_0xfaaf('0x1c')](_0x3bc4de['query'][_0xfaaf('0x1c')]);}_0x1871b1[_0xfaaf('0x35')]=qs[_0xfaaf('0x36')](_0x3bc4de[_0xfaaf('0x2f')][_0xfaaf('0x36')]);_0x1871b1[_0xfaaf('0x37')]=qs[_0xfaaf('0x38')](_[_0xfaaf('0x39')](_0x3bc4de[_0xfaaf('0x2f')],_0x1e7397['filters']),_0x3f1479);if(_0x3bc4de[_0xfaaf('0x2f')][_0xfaaf('0x3a')]){_0x1871b1[_0xfaaf('0x37')]=_[_0xfaaf('0x3b')](_0x1871b1[_0xfaaf('0x37')],{'$or':_[_0xfaaf('0x2a')](_0x3f1479,function(_0x33eeac){if(_0x33eeac[_0xfaaf('0x2d')]!==_0xfaaf('0x3c')){var _0x17324f={};_0x17324f[_0x33eeac[_0xfaaf('0x28')]]={'$like':'%'+_0x3bc4de['query']['filter']+'%'};return _0x17324f;}})});}_0x1871b1=_[_0xfaaf('0x3b')]({},_0x1871b1,_0x3bc4de['options']);var _0x3f6aa8={'where':_0x1871b1[_0xfaaf('0x37')]};return db[_0xfaaf('0x2b')][_0xfaaf('0x1e')](_0x3f6aa8)[_0xfaaf('0x26')](function(_0x38b75f){_0x5a4a74[_0xfaaf('0x1e')]=_0x38b75f;if(_0x3bc4de[_0xfaaf('0x2f')]['includeAll']){_0x1871b1[_0xfaaf('0x3d')]=[{'all':!![]}];}return db[_0xfaaf('0x2b')][_0xfaaf('0x3e')](_0x1871b1);})[_0xfaaf('0x26')](function(_0x58aa42){_0x5a4a74[_0xfaaf('0x3f')]=_0x58aa42;return _0x5a4a74;})[_0xfaaf('0x26')](respondWithFilteredResult(_0x56dae7,_0x1871b1))[_0xfaaf('0x40')](handleError(_0x56dae7,null));};exports[_0xfaaf('0x41')]=function(_0x41c476,_0x283a4c){var _0x1fdf9e={'raw':!![],'where':{'id':_0x41c476[_0xfaaf('0x42')]['id']}},_0x1e49a8={};_0x1e49a8[_0xfaaf('0x2e')]=_[_0xfaaf('0x30')](db['SquareRecording'][_0xfaaf('0x2c')]);_0x1e49a8[_0xfaaf('0x2f')]=_[_0xfaaf('0x30')](_0x41c476[_0xfaaf('0x2f')]);_0x1e49a8[_0xfaaf('0x38')]=_[_0xfaaf('0x31')](_0x1e49a8[_0xfaaf('0x2e')],_0x1e49a8[_0xfaaf('0x2f')]);_0x1fdf9e[_0xfaaf('0x32')]=_[_0xfaaf('0x31')](_0x1e49a8['model'],qs['fields'](_0x41c476['query']['fields']));_0x1fdf9e['attributes']=_0x1fdf9e[_0xfaaf('0x32')][_0xfaaf('0x34')]?_0x1fdf9e[_0xfaaf('0x32')]:_0x1e49a8[_0xfaaf('0x2e')];if(_0x41c476[_0xfaaf('0x2f')][_0xfaaf('0x43')]){_0x1fdf9e[_0xfaaf('0x3d')]=[{'all':!![]}];}_0x1fdf9e=_[_0xfaaf('0x3b')]({},_0x1fdf9e,_0x41c476[_0xfaaf('0x44')]);return db['SquareRecording'][_0xfaaf('0x45')](_0x1fdf9e)['then'](handleEntityNotFound(_0x283a4c,null))['then'](respondWithResult(_0x283a4c,null))[_0xfaaf('0x40')](handleError(_0x283a4c,null));};exports[_0xfaaf('0x46')]=function(_0x454dd5,_0x4a7596){return db['SquareRecording'][_0xfaaf('0x46')](_0x454dd5[_0xfaaf('0x47')],{})[_0xfaaf('0x26')](respondWithResult(_0x4a7596,0xc9))[_0xfaaf('0x40')](handleError(_0x4a7596,null));};exports[_0xfaaf('0x25')]=function(_0x5a32e0,_0x478bd9){if(_0x5a32e0[_0xfaaf('0x47')]['id']){delete _0x5a32e0[_0xfaaf('0x47')]['id'];}return db[_0xfaaf('0x2b')][_0xfaaf('0x45')]({'where':{'id':_0x5a32e0[_0xfaaf('0x42')]['id']}})['then'](handleEntityNotFound(_0x478bd9,null))[_0xfaaf('0x26')](saveUpdates(_0x5a32e0[_0xfaaf('0x47')],null))['then'](respondWithResult(_0x478bd9,null))['catch'](handleError(_0x478bd9,null));};exports['download']=function(_0x124fca,_0x29db01,_0x26880c){var _0x337172=require(_0xfaaf('0x48'));var _0x41194f=![];var _0x355849={};if(_0x124fca[_0xfaaf('0x2f')][_0xfaaf('0x2d')]&&_0x124fca['query']['type']==='uniqueid'){_0x355849['uniqueid']=_0x124fca[_0xfaaf('0x42')]['id'];}else{_0x355849['id']=_0x124fca['params']['id'];}return db['SquareRecording'][_0xfaaf('0x45')]({'where':_0x355849,'attributes':['id','savePath',_0xfaaf('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x29db01,null))[_0xfaaf('0x26')](function(_0x4a6868){if(_0x4a6868){var _0x2b4d4b=_0x4a6868['savePath'];var _0x5c6ef5=util[_0xfaaf('0x4a')](_0xfaaf('0x4b'),_0x2b4d4b);if(fs['existsSync'](_0x5c6ef5)){_0x41194f=!![];return _0x337172['decryptFile'](_0x5c6ef5,_0x2b4d4b,config[_0xfaaf('0x4c')]['recording'])[_0xfaaf('0x26')](function(){return _0x4a6868;});}return _0x4a6868;}})['then'](function(_0x4dcaa0){if(_0x4dcaa0){var _0x260fe1=_0x4dcaa0['savePath'];if(!fs[_0xfaaf('0x4d')](_0x260fe1)){throw new db[(_0xfaaf('0x4e'))][(_0xfaaf('0x4f'))](_0xfaaf('0x50'));}if(_0x4dcaa0[_0xfaaf('0x49')]){return _0x29db01[_0xfaaf('0x51')](_0x260fe1,_0x4dcaa0[_0xfaaf('0x49')]+path[_0xfaaf('0x52')](_0x260fe1),function(){if(_0x41194f){fs['unlink'](_0x260fe1);}});}else{return _0x29db01['download'](_0x260fe1,function(_0x213bb6){if(_0x41194f){fs[_0xfaaf('0x53')](_0x260fe1);}});}}})[_0xfaaf('0x40')](function(_0x5151db){if(_0x5151db[_0xfaaf('0x54')]==='SquareRecording\x20not\x20found'){_0x29db01[_0xfaaf('0x1a')](0x194)[_0xfaaf('0x29')](_0xfaaf('0x55'));}else{return handleError(_0x29db01,null);}});};exports[_0xfaaf('0x56')]=function(_0x27d77d,_0x39c557){return db[_0xfaaf('0x2b')]['find']({'where':{'id':_0x27d77d[_0xfaaf('0x42')]['id']}})[_0xfaaf('0x26')](function(_0x3d1a78){if(_[_0xfaaf('0x57')](_0x3d1a78)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3d1a78;})[_0xfaaf('0x26')](function(_0x155b9c){var _0x9421c7=_0x155b9c['savePath'];logger[_0xfaaf('0x58')](_0xfaaf('0x59'),_0x9421c7);if(!_[_0xfaaf('0x57')](_0x155b9c[_0xfaaf('0x5a')])&&fs[_0xfaaf('0x4d')](_0x9421c7)){logger[_0xfaaf('0x58')](_0xfaaf('0x5b')+_0x9421c7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfaaf('0x5c')](_0x9421c7);}_0x9421c7=_0x9421c7+_0xfaaf('0x5d');if(!_['isNil'](_0x155b9c[_0xfaaf('0x5a')])&&fs['existsSync'](_0x9421c7)){logger[_0xfaaf('0x58')](_0xfaaf('0x5b')+_0x9421c7+_0xfaaf('0x5e'));fs[_0xfaaf('0x5c')](_0x9421c7);}return _0x155b9c;})[_0xfaaf('0x26')](function(_0x297106){if(!_0x297106)throw new InternalError();return _0x297106[_0xfaaf('0x56')]();})[_0xfaaf('0x26')](function(){_0x39c557[_0xfaaf('0x1a')](0xcc)[_0xfaaf('0x1b')]();})[_0xfaaf('0x40')](handleError(_0x39c557,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 500d22f..cc139d4 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 _0x2faf=['bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','util','../../config/logger','moment'];(function(_0x55dd01,_0xac4207){var _0xf38a3e=function(_0x47e32e){while(--_0x47e32e){_0x55dd01['push'](_0x55dd01['shift']());}};_0xf38a3e(++_0xac4207);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var logger=require(_0xf2fa('0x2'))('api');var moment=require(_0xf2fa('0x3'));var BPromise=require(_0xf2fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2fa('0x5'));var rimraf=require(_0xf2fa('0x6'));var config=require(_0xf2fa('0x7'));var attributes=require(_0xf2fa('0x8'));module[_0xf2fa('0x9')]=function(_0x33c832,_0x44d406){return _0x33c832['define'](_0xf2fa('0xa'),attributes,{'tableName':_0xf2fa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa809=['exports','SquareRecording','square_recordings','util','moment','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x594ba6,_0x100f79){var _0x4d7d50=function(_0x3f6fbe){while(--_0x3f6fbe){_0x594ba6['push'](_0x594ba6['shift']());}};_0x4d7d50(++_0x100f79);}(_0xa809,0x1f3));var _0x9a80=function(_0x1fae4e,_0x9aab08){_0x1fae4e=_0x1fae4e-0x0;var _0x4a576e=_0xa809[_0x1fae4e];return _0x4a576e;};'use strict';var _=require('lodash');var util=require(_0x9a80('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9a80('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9a80('0x2'));var config=require(_0x9a80('0x3'));var attributes=require(_0x9a80('0x4'));module[_0x9a80('0x5')]=function(_0x4c748d,_0x295910){return _0x4c748d['define'](_0x9a80('0x6'),attributes,{'tableName':_0x9a80('0x7'),'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 3c499f0..d4b4f85 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 _0x6a45=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','CreateSquareRecording','SquareRecording','create','body','stringify','catch'];(function(_0x2010f7,_0x3b1a0e){var _0x19c064=function(_0x3f21ce){while(--_0x3f21ce){_0x2010f7['push'](_0x2010f7['shift']());}};_0x19c064(++_0x3b1a0e);}(_0x6a45,0x11e));var _0x56a4=function(_0xf58b80,_0x1bfe1f){_0xf58b80=_0xf58b80-0x0;var _0x51651c=_0x6a45[_0xf58b80];return _0x51651c;};'use strict';var _=require(_0x56a4('0x0'));var util=require(_0x56a4('0x1'));var moment=require(_0x56a4('0x2'));var BPromise=require(_0x56a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56a4('0x4'));var db=require(_0x56a4('0x5'))['db'];var utils=require(_0x56a4('0x6'));var logger=require(_0x56a4('0x7'))('rpc');var config=require(_0x56a4('0x8'));var jayson=require(_0x56a4('0x9'));var client=jayson['client'][_0x56a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fa3b9,_0x16e9d3,_0x5a523a){return new BPromise(function(_0x11e3dc,_0x14d531){return client[_0x56a4('0xb')](_0x4fa3b9,_0x5a523a)[_0x56a4('0xc')](function(_0xe09a27){logger[_0x56a4('0xd')](_0x56a4('0xe'),_0x16e9d3,'request\x20sent');logger[_0x56a4('0xf')](_0x56a4('0x10'),_0x16e9d3,'request\x20sent',JSON['stringify'](_0xe09a27));if(_0xe09a27[_0x56a4('0x11')]){if(_0xe09a27['error']['code']===0x1f4){logger[_0x56a4('0x11')](_0x56a4('0xe'),_0x16e9d3,_0xe09a27[_0x56a4('0x11')][_0x56a4('0x12')]);return _0x14d531(_0xe09a27[_0x56a4('0x11')]['message']);}logger[_0x56a4('0x11')](_0x56a4('0xe'),_0x16e9d3,_0xe09a27[_0x56a4('0x11')]['message']);return _0x11e3dc(_0xe09a27[_0x56a4('0x11')][_0x56a4('0x12')]);}else{logger[_0x56a4('0xd')](_0x56a4('0xe'),_0x16e9d3,_0x56a4('0x13'));_0x11e3dc(_0xe09a27['result'][_0x56a4('0x12')]);}})['catch'](function(_0x343cfa){logger[_0x56a4('0x11')]('SquareRecording,\x20%s,\x20%s',_0x16e9d3,_0x343cfa);_0x14d531(_0x343cfa);});});}exports[_0x56a4('0x14')]=function(_0x5ac07c){var _0x2038b2=this;return new Promise(function(_0x13d569,_0x557d57){return db[_0x56a4('0x15')][_0x56a4('0x16')](_0x5ac07c[_0x56a4('0x17')],{'raw':_0x5ac07c['options']?_0x5ac07c['options']['raw']===undefined?!![]:![]:!![]})[_0x56a4('0xc')](function(_0x525f60){logger[_0x56a4('0xd')](_0x56a4('0x14'),_0x5ac07c);logger['debug']('CreateSquareRecording',_0x5ac07c,JSON[_0x56a4('0x18')](_0x525f60));_0x13d569(_0x525f60);})[_0x56a4('0x19')](function(_0x42652c){logger[_0x56a4('0x11')]('CreateSquareRecording',_0x42652c[_0x56a4('0x12')],_0x5ac07c);_0x557d57(_0x2038b2[_0x56a4('0x11')](0x1f4,_0x42652c[_0x56a4('0x12')]));});});}; \ No newline at end of file +var _0xc6a6=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xc6a6,0x127));var _0x6c6a=function(_0x3ad753,_0x1c6677){_0x3ad753=_0x3ad753-0x0;var _0x440d2f=_0xc6a6[_0x3ad753];return _0x440d2f;};'use strict';var _=require(_0x6c6a('0x0'));var util=require(_0x6c6a('0x1'));var moment=require(_0x6c6a('0x2'));var BPromise=require(_0x6c6a('0x3'));var rs=require(_0x6c6a('0x4'));var fs=require('fs');var Redis=require(_0x6c6a('0x5'));var db=require(_0x6c6a('0x6'))['db'];var utils=require(_0x6c6a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c6a('0x8'));var jayson=require(_0x6c6a('0x9'));var client=jayson[_0x6c6a('0xa')][_0x6c6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x380b53,_0x1f0b22,_0x4cc4bf){return new BPromise(function(_0x3029a7,_0x56bb4f){return client[_0x6c6a('0xc')](_0x380b53,_0x4cc4bf)[_0x6c6a('0xd')](function(_0xd76836){logger[_0x6c6a('0xe')](_0x6c6a('0xf'),_0x1f0b22,_0x6c6a('0x10'));logger[_0x6c6a('0x11')](_0x6c6a('0x12'),_0x1f0b22,_0x6c6a('0x10'),JSON[_0x6c6a('0x13')](_0xd76836));if(_0xd76836[_0x6c6a('0x14')]){if(_0xd76836[_0x6c6a('0x14')][_0x6c6a('0x15')]===0x1f4){logger[_0x6c6a('0x14')](_0x6c6a('0xf'),_0x1f0b22,_0xd76836['error']['message']);return _0x56bb4f(_0xd76836[_0x6c6a('0x14')][_0x6c6a('0x16')]);}logger[_0x6c6a('0x14')](_0x6c6a('0xf'),_0x1f0b22,_0xd76836[_0x6c6a('0x14')]['message']);return _0x3029a7(_0xd76836[_0x6c6a('0x14')][_0x6c6a('0x16')]);}else{logger['info'](_0x6c6a('0xf'),_0x1f0b22,_0x6c6a('0x10'));_0x3029a7(_0xd76836[_0x6c6a('0x17')]['message']);}})[_0x6c6a('0x18')](function(_0x42e6e3){logger[_0x6c6a('0x14')]('SquareRecording,\x20%s,\x20%s',_0x1f0b22,_0x42e6e3);_0x56bb4f(_0x42e6e3);});});}exports[_0x6c6a('0x19')]=function(_0xf0ca2b){var _0x56375d=this;return new Promise(function(_0x4b1440,_0x2d4ebf){return db['SquareRecording'][_0x6c6a('0x1a')](_0xf0ca2b[_0x6c6a('0x1b')],{'raw':_0xf0ca2b[_0x6c6a('0x1c')]?_0xf0ca2b[_0x6c6a('0x1c')][_0x6c6a('0x1d')]===undefined?!![]:![]:!![]})[_0x6c6a('0xd')](function(_0x53ea3c){logger[_0x6c6a('0xe')](_0x6c6a('0x19'),_0xf0ca2b);logger['debug'](_0x6c6a('0x19'),_0xf0ca2b,JSON[_0x6c6a('0x13')](_0x53ea3c));_0x4b1440(_0x53ea3c);})[_0x6c6a('0x18')](function(_0x1c85ba){logger['error'](_0x6c6a('0x19'),_0x1c85ba[_0x6c6a('0x16')],_0xf0ca2b);_0x2d4ebf(_0x56375d[_0x6c6a('0x14')](0x1f4,_0x1c85ba[_0x6c6a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0118a7d..50eded8 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 _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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _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(_0x354fce,_0x2a6d72){var _0x17b8f6=function(_0xe8247f){while(--_0xe8247f){_0x354fce['push'](_0x354fce['shift']());}};_0x17b8f6(++_0x2a6d72);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 1dc500b..135a656 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 _0xffc0=['exports','STRING','DATE','BOOLEAN'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x5789c2,_0x1fb5c0){_0x5789c2=_0x5789c2-0x0;var _0x43e604=_0xffc0[_0x5789c2];return _0x43e604;};'use strict';var Sequelize=require('sequelize');module[_0x0ffc('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x0ffc('0x1')]},'request':{'type':Sequelize[_0x0ffc('0x1')]},'channel':{'type':Sequelize[_0x0ffc('0x1')]},'language':{'type':Sequelize[_0x0ffc('0x1')]},'type':{'type':Sequelize[_0x0ffc('0x1')]},'uniqueid':{'type':Sequelize[_0x0ffc('0x1')]},'version':{'type':Sequelize[_0x0ffc('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0ffc('0x1')]},'callingpres':{'type':Sequelize[_0x0ffc('0x1')]},'callingani2':{'type':Sequelize[_0x0ffc('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x0ffc('0x1')]},'rdnis':{'type':Sequelize[_0x0ffc('0x1')]},'context':{'type':Sequelize[_0x0ffc('0x1')]},'extension':{'type':Sequelize[_0x0ffc('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x0ffc('0x1')]},'accountcode':{'type':Sequelize[_0x0ffc('0x1')]},'threadid':{'type':Sequelize[_0x0ffc('0x1')]},'project_name':{'type':Sequelize[_0x0ffc('0x1')]},'joinAt':{'type':Sequelize[_0x0ffc('0x2')]},'leaveAt':{'type':Sequelize[_0x0ffc('0x2')]},'bot':{'type':Sequelize[_0x0ffc('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4b67=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x4b67,0x1f0));var _0x74b6=function(_0x10917b,_0x1a9c8c){_0x10917b=_0x10917b-0x0;var _0x30886d=_0x4b67[_0x10917b];return _0x30886d;};'use strict';var Sequelize=require(_0x74b6('0x0'));module[_0x74b6('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x74b6('0x2')]},'request':{'type':Sequelize[_0x74b6('0x2')]},'channel':{'type':Sequelize[_0x74b6('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x74b6('0x2')]},'uniqueid':{'type':Sequelize[_0x74b6('0x2')]},'version':{'type':Sequelize[_0x74b6('0x2')]},'callerid':{'type':Sequelize[_0x74b6('0x2')]},'calleridname':{'type':Sequelize[_0x74b6('0x2')]},'callingpres':{'type':Sequelize[_0x74b6('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x74b6('0x2')]},'callingtns':{'type':Sequelize[_0x74b6('0x2')]},'dnid':{'type':Sequelize[_0x74b6('0x2')]},'rdnis':{'type':Sequelize[_0x74b6('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x74b6('0x2')]},'priority':{'type':Sequelize[_0x74b6('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x74b6('0x2')]},'threadid':{'type':Sequelize[_0x74b6('0x2')]},'project_name':{'type':Sequelize[_0x74b6('0x2')]},'joinAt':{'type':Sequelize[_0x74b6('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x74b6('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 35ccafe..37b978d 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 _0xa47f=['fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../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','reject','save','update','then','destroy','error','name','send','map','SquareReport','fieldName','type','key','keys','filters','model','query','attributes','intersection'];(function(_0x1662e8,_0x23f431){var _0x3ca0a1=function(_0x20f625){while(--_0x20f625){_0x1662e8['push'](_0x1662e8['shift']());}};_0x3ca0a1(++_0x23f431);}(_0xa47f,0xfa));var _0xfa47=function(_0xfdc515,_0x4585bc){_0xfdc515=_0xfdc515-0x0;var _0x1e9e02=_0xa47f[_0xfdc515];return _0x1e9e02;};'use strict';var emlformat=require(_0xfa47('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa47('0x1'));var jsonpatch=require(_0xfa47('0x2'));var rp=require(_0xfa47('0x3'));var moment=require('moment');var BPromise=require(_0xfa47('0x4'));var Mustache=require(_0xfa47('0x5'));var util=require(_0xfa47('0x6'));var path=require(_0xfa47('0x7'));var sox=require(_0xfa47('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa47('0x9'));var _=require(_0xfa47('0xa'));var squel=require(_0xfa47('0xb'));var crypto=require(_0xfa47('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfa47('0xd'));var toCsv=require(_0xfa47('0xe'));var querystring=require(_0xfa47('0xf'));var Papa=require(_0xfa47('0x10'));var Redis=require('ioredis');var authService=require(_0xfa47('0x11'));var qs=require(_0xfa47('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa47('0x13'));var utils=require(_0xfa47('0x14'));var config=require(_0xfa47('0x15'));var licenseUtil=require(_0xfa47('0x16'));var db=require(_0xfa47('0x17'))['db'];function respondWithStatusCode(_0x151dfa,_0x2f6868){_0x2f6868=_0x2f6868||0xcc;return function(_0x395ab3){if(_0x395ab3){return _0x151dfa[_0xfa47('0x18')](_0x2f6868);}return _0x151dfa[_0xfa47('0x19')](_0x2f6868)[_0xfa47('0x1a')]();};}function respondWithResult(_0x1887dd,_0x1f9812){_0x1f9812=_0x1f9812||0xc8;return function(_0x1165c8){if(_0x1165c8){return _0x1887dd[_0xfa47('0x19')](_0x1f9812)[_0xfa47('0x1b')](_0x1165c8);}};}function respondWithFilteredResult(_0x53e69c,_0x412fad){return function(_0x5318d0){if(_0x5318d0){var _0x43d30f=typeof _0x412fad[_0xfa47('0x1c')]===_0xfa47('0x1d')&&typeof _0x412fad[_0xfa47('0x1e')]==='undefined';var _0x59d3c3=_0x5318d0[_0xfa47('0x1f')];var _0x5e929f=_0x43d30f?0x0:_0x412fad[_0xfa47('0x1c')];var _0x1cf95f=_0x43d30f?_0x5318d0[_0xfa47('0x1f')]:_0x412fad[_0xfa47('0x1c')]+_0x412fad['limit'];var _0x5ab5ff;if(_0x1cf95f>=_0x59d3c3){_0x1cf95f=_0x59d3c3;_0x5ab5ff=0xc8;}else{_0x5ab5ff=0xce;}_0x53e69c[_0xfa47('0x19')](_0x5ab5ff);return _0x53e69c[_0xfa47('0x20')](_0xfa47('0x21'),_0x5e929f+'-'+_0x1cf95f+'/'+_0x59d3c3)[_0xfa47('0x1b')](_0x5318d0);}return null;};}function patchUpdates(_0x4e30ca){return function(_0x1dcde9){try{jsonpatch[_0xfa47('0x22')](_0x1dcde9,_0x4e30ca,!![]);}catch(_0x511896){return BPromise[_0xfa47('0x23')](_0x511896);}return _0x1dcde9[_0xfa47('0x24')]();};}function saveUpdates(_0x409295,_0x5b3965){return function(_0x26c638){if(_0x26c638){return _0x26c638[_0xfa47('0x25')](_0x409295)[_0xfa47('0x26')](function(_0x2f88c8){return _0x2f88c8;});}return null;};}function removeEntity(_0x6c669f,_0x484db4){return function(_0x2653d5){if(_0x2653d5){return _0x2653d5[_0xfa47('0x27')]()[_0xfa47('0x26')](function(){_0x6c669f[_0xfa47('0x19')](0xcc)[_0xfa47('0x1a')]();});}};}function handleEntityNotFound(_0x349665,_0x25d8ec){return function(_0x1a404f){if(!_0x1a404f){_0x349665['sendStatus'](0x194);}return _0x1a404f;};}function handleError(_0x41869b,_0x2d0447){_0x2d0447=_0x2d0447||0x1f4;return function(_0x4a820a){logger[_0xfa47('0x28')](_0x4a820a['stack']);if(_0x4a820a[_0xfa47('0x29')]){delete _0x4a820a['name'];}_0x41869b[_0xfa47('0x19')](_0x2d0447)[_0xfa47('0x2a')](_0x4a820a);};}exports['index']=function(_0x15456c,_0x528117){var _0xcea59b={},_0xbbb49f={},_0x5f1da6={'count':0x0,'rows':[]};var _0x14c7a2=_[_0xfa47('0x2b')](db[_0xfa47('0x2c')]['rawAttributes'],function(_0x37999d){return{'name':_0x37999d[_0xfa47('0x2d')],'type':_0x37999d[_0xfa47('0x2e')][_0xfa47('0x2f')]};});_0xbbb49f['model']=_[_0xfa47('0x2b')](_0x14c7a2,_0xfa47('0x29'));_0xbbb49f['query']=_[_0xfa47('0x30')](_0x15456c['query']);_0xbbb49f[_0xfa47('0x31')]=_['intersection'](_0xbbb49f[_0xfa47('0x32')],_0xbbb49f[_0xfa47('0x33')]);_0xcea59b[_0xfa47('0x34')]=_[_0xfa47('0x35')](_0xbbb49f[_0xfa47('0x32')],qs[_0xfa47('0x36')](_0x15456c['query']['fields']));_0xcea59b[_0xfa47('0x34')]=_0xcea59b['attributes'][_0xfa47('0x37')]?_0xcea59b[_0xfa47('0x34')]:_0xbbb49f[_0xfa47('0x32')];if(!_0x15456c[_0xfa47('0x33')][_0xfa47('0x38')]('nolimit')){_0xcea59b[_0xfa47('0x1e')]=qs[_0xfa47('0x1e')](_0x15456c[_0xfa47('0x33')][_0xfa47('0x1e')]);_0xcea59b[_0xfa47('0x1c')]=qs[_0xfa47('0x1c')](_0x15456c[_0xfa47('0x33')][_0xfa47('0x1c')]);}_0xcea59b['order']=qs[_0xfa47('0x39')](_0x15456c[_0xfa47('0x33')][_0xfa47('0x39')]);_0xcea59b[_0xfa47('0x3a')]=qs[_0xfa47('0x31')](_[_0xfa47('0x3b')](_0x15456c[_0xfa47('0x33')],_0xbbb49f[_0xfa47('0x31')]),_0x14c7a2);if(_0x15456c[_0xfa47('0x33')][_0xfa47('0x3c')]){_0xcea59b[_0xfa47('0x3a')]=_[_0xfa47('0x3d')](_0xcea59b[_0xfa47('0x3a')],{'$or':_[_0xfa47('0x2b')](_0x14c7a2,function(_0x1f8b1b){if(_0x1f8b1b[_0xfa47('0x2e')]!==_0xfa47('0x3e')){var _0x11fab2={};_0x11fab2[_0x1f8b1b['name']]={'$like':'%'+_0x15456c[_0xfa47('0x33')]['filter']+'%'};return _0x11fab2;}})});}_0xcea59b=_['merge']({},_0xcea59b,_0x15456c[_0xfa47('0x3f')]);var _0x518db0={'where':_0xcea59b[_0xfa47('0x3a')]};return db[_0xfa47('0x2c')][_0xfa47('0x1f')](_0x518db0)['then'](function(_0x543ab1){_0x5f1da6['count']=_0x543ab1;if(_0x15456c[_0xfa47('0x33')][_0xfa47('0x40')]){_0xcea59b[_0xfa47('0x41')]=[{'all':!![]}];}return db[_0xfa47('0x2c')][_0xfa47('0x42')](_0xcea59b);})[_0xfa47('0x26')](function(_0x54c85f){_0x5f1da6[_0xfa47('0x43')]=_0x54c85f;return _0x5f1da6;})[_0xfa47('0x26')](respondWithFilteredResult(_0x528117,_0xcea59b))[_0xfa47('0x44')](handleError(_0x528117,null));};exports[_0xfa47('0x45')]=function(_0x17f6c0,_0x1f49ae){var _0x570590={'raw':!![],'where':{'id':_0x17f6c0['params']['id']}},_0xe61574={};_0xe61574[_0xfa47('0x32')]=_[_0xfa47('0x30')](db['SquareReport'][_0xfa47('0x46')]);_0xe61574['query']=_['keys'](_0x17f6c0[_0xfa47('0x33')]);_0xe61574[_0xfa47('0x31')]=_[_0xfa47('0x35')](_0xe61574['model'],_0xe61574[_0xfa47('0x33')]);_0x570590['attributes']=_[_0xfa47('0x35')](_0xe61574[_0xfa47('0x32')],qs[_0xfa47('0x36')](_0x17f6c0[_0xfa47('0x33')][_0xfa47('0x36')]));_0x570590['attributes']=_0x570590[_0xfa47('0x34')][_0xfa47('0x37')]?_0x570590[_0xfa47('0x34')]:_0xe61574['model'];if(_0x17f6c0[_0xfa47('0x33')]['includeAll']){_0x570590['include']=[{'all':!![]}];}_0x570590=_[_0xfa47('0x3d')]({},_0x570590,_0x17f6c0[_0xfa47('0x3f')]);return db[_0xfa47('0x2c')][_0xfa47('0x47')](_0x570590)[_0xfa47('0x26')](handleEntityNotFound(_0x1f49ae,null))[_0xfa47('0x26')](respondWithResult(_0x1f49ae,null))[_0xfa47('0x44')](handleError(_0x1f49ae,null));};exports[_0xfa47('0x48')]=function(_0x567729,_0x433d8a){return db[_0xfa47('0x2c')][_0xfa47('0x48')](_0x567729[_0xfa47('0x49')],{})[_0xfa47('0x26')](respondWithResult(_0x433d8a,0xc9))[_0xfa47('0x44')](handleError(_0x433d8a,null));};exports['update']=function(_0x1e40b2,_0x6804c1){if(_0x1e40b2[_0xfa47('0x49')]['id']){delete _0x1e40b2[_0xfa47('0x49')]['id'];}return db[_0xfa47('0x2c')][_0xfa47('0x47')]({'where':{'id':_0x1e40b2['params']['id']}})[_0xfa47('0x26')](handleEntityNotFound(_0x6804c1,null))[_0xfa47('0x26')](saveUpdates(_0x1e40b2[_0xfa47('0x49')],null))[_0xfa47('0x26')](respondWithResult(_0x6804c1,null))[_0xfa47('0x44')](handleError(_0x6804c1,null));};exports[_0xfa47('0x27')]=function(_0x1340da,_0x2d7938){return db[_0xfa47('0x2c')][_0xfa47('0x47')]({'where':{'id':_0x1340da[_0xfa47('0x4a')]['id']}})[_0xfa47('0x26')](handleEntityNotFound(_0x2d7938,null))[_0xfa47('0x26')](removeEntity(_0x2d7938,null))[_0xfa47('0x44')](handleError(_0x2d7938,null));};exports[_0xfa47('0x4b')]=function(_0x1895cf,_0x4f09d9){return db[_0xfa47('0x2c')][_0xfa47('0x4b')]()[_0xfa47('0x26')](respondWithResult(_0x4f09d9,null))[_0xfa47('0x44')](handleError(_0x4f09d9,null));}; \ No newline at end of file +var _0x843d=['options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','SquareReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x2e2cbc,_0x47ef65){var _0x3f185f=function(_0x5f2a37){while(--_0x5f2a37){_0x2e2cbc['push'](_0x2e2cbc['shift']());}};_0x3f185f(++_0x47ef65);}(_0x843d,0xe3));var _0xd843=function(_0xf687ff,_0x4dc760){_0xf687ff=_0xf687ff-0x0;var _0x3d1965=_0x843d[_0xf687ff];return _0x3d1965;};'use strict';var emlformat=require(_0xd843('0x0'));var rimraf=require(_0xd843('0x1'));var zipdir=require(_0xd843('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd843('0x3'));var moment=require(_0xd843('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd843('0x5'));var sox=require(_0xd843('0x6'));var csv=require(_0xd843('0x7'));var ejs=require(_0xd843('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd843('0x9'));var squel=require(_0xd843('0xa'));var crypto=require(_0xd843('0xb'));var jsforce=require(_0xd843('0xc'));var deskjs=require(_0xd843('0xd'));var toCsv=require(_0xd843('0x7'));var querystring=require(_0xd843('0xe'));var Papa=require(_0xd843('0xf'));var Redis=require('ioredis');var authService=require(_0xd843('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd843('0x11'));var hardwareService=require(_0xd843('0x12'));var logger=require(_0xd843('0x13'))('api');var utils=require(_0xd843('0x14'));var config=require(_0xd843('0x15'));var licenseUtil=require(_0xd843('0x16'));var db=require(_0xd843('0x17'))['db'];function respondWithStatusCode(_0x522f30,_0x2d5da9){_0x2d5da9=_0x2d5da9||0xcc;return function(_0x477805){if(_0x477805){return _0x522f30[_0xd843('0x18')](_0x2d5da9);}return _0x522f30[_0xd843('0x19')](_0x2d5da9)['end']();};}function respondWithResult(_0x74d2bc,_0xb82657){_0xb82657=_0xb82657||0xc8;return function(_0x27f8d2){if(_0x27f8d2){return _0x74d2bc[_0xd843('0x19')](_0xb82657)[_0xd843('0x1a')](_0x27f8d2);}};}function respondWithFilteredResult(_0x2e8421,_0x4dbfb5){return function(_0x476c40){if(_0x476c40){var _0x363b2f=typeof _0x4dbfb5['offset']==='undefined'&&typeof _0x4dbfb5[_0xd843('0x1b')]===_0xd843('0x1c');var _0x4ae861=_0x476c40[_0xd843('0x1d')];var _0x496bb8=_0x363b2f?0x0:_0x4dbfb5[_0xd843('0x1e')];var _0x21fa62=_0x363b2f?_0x476c40[_0xd843('0x1d')]:_0x4dbfb5[_0xd843('0x1e')]+_0x4dbfb5[_0xd843('0x1b')];var _0x200abb;if(_0x21fa62>=_0x4ae861){_0x21fa62=_0x4ae861;_0x200abb=0xc8;}else{_0x200abb=0xce;}_0x2e8421['status'](_0x200abb);return _0x2e8421['set'](_0xd843('0x1f'),_0x496bb8+'-'+_0x21fa62+'/'+_0x4ae861)[_0xd843('0x1a')](_0x476c40);}return null;};}function patchUpdates(_0x1ae066){return function(_0x505f2a){try{jsonpatch[_0xd843('0x20')](_0x505f2a,_0x1ae066,!![]);}catch(_0x565f67){return BPromise[_0xd843('0x21')](_0x565f67);}return _0x505f2a['save']();};}function saveUpdates(_0x5319e5,_0x2bade7){return function(_0x395065){if(_0x395065){return _0x395065[_0xd843('0x22')](_0x5319e5)[_0xd843('0x23')](function(_0x16a7a6){return _0x16a7a6;});}return null;};}function removeEntity(_0x284498,_0x29b5f4){return function(_0x2c061e){if(_0x2c061e){return _0x2c061e[_0xd843('0x24')]()[_0xd843('0x23')](function(){_0x284498[_0xd843('0x19')](0xcc)[_0xd843('0x25')]();});}};}function handleEntityNotFound(_0x1897f0,_0x4d38ac){return function(_0x429c1e){if(!_0x429c1e){_0x1897f0[_0xd843('0x18')](0x194);}return _0x429c1e;};}function handleError(_0x16b4dc,_0xf50e5e){_0xf50e5e=_0xf50e5e||0x1f4;return function(_0x4c270c){logger['error'](_0x4c270c[_0xd843('0x26')]);if(_0x4c270c[_0xd843('0x27')]){delete _0x4c270c[_0xd843('0x27')];}_0x16b4dc[_0xd843('0x19')](_0xf50e5e)[_0xd843('0x28')](_0x4c270c);};}exports[_0xd843('0x29')]=function(_0x3b52a0,_0x57cf29){var _0x3d8b5f={},_0x28a632={},_0x3cafe8={'count':0x0,'rows':[]};var _0x4f95f5=_[_0xd843('0x2a')](db[_0xd843('0x2b')]['rawAttributes'],function(_0x3796f4){return{'name':_0x3796f4['fieldName'],'type':_0x3796f4[_0xd843('0x2c')][_0xd843('0x2d')]};});_0x28a632[_0xd843('0x2e')]=_['map'](_0x4f95f5,'name');_0x28a632[_0xd843('0x2f')]=_[_0xd843('0x30')](_0x3b52a0[_0xd843('0x2f')]);_0x28a632[_0xd843('0x31')]=_[_0xd843('0x32')](_0x28a632['model'],_0x28a632[_0xd843('0x2f')]);_0x3d8b5f[_0xd843('0x33')]=_[_0xd843('0x32')](_0x28a632[_0xd843('0x2e')],qs[_0xd843('0x34')](_0x3b52a0[_0xd843('0x2f')][_0xd843('0x34')]));_0x3d8b5f[_0xd843('0x33')]=_0x3d8b5f[_0xd843('0x33')][_0xd843('0x35')]?_0x3d8b5f[_0xd843('0x33')]:_0x28a632[_0xd843('0x2e')];if(!_0x3b52a0['query']['hasOwnProperty'](_0xd843('0x36'))){_0x3d8b5f[_0xd843('0x1b')]=qs[_0xd843('0x1b')](_0x3b52a0['query'][_0xd843('0x1b')]);_0x3d8b5f[_0xd843('0x1e')]=qs[_0xd843('0x1e')](_0x3b52a0[_0xd843('0x2f')][_0xd843('0x1e')]);}_0x3d8b5f['order']=qs[_0xd843('0x37')](_0x3b52a0[_0xd843('0x2f')][_0xd843('0x37')]);_0x3d8b5f['where']=qs[_0xd843('0x31')](_[_0xd843('0x38')](_0x3b52a0[_0xd843('0x2f')],_0x28a632[_0xd843('0x31')]),_0x4f95f5);if(_0x3b52a0[_0xd843('0x2f')][_0xd843('0x39')]){_0x3d8b5f[_0xd843('0x3a')]=_[_0xd843('0x3b')](_0x3d8b5f[_0xd843('0x3a')],{'$or':_[_0xd843('0x2a')](_0x4f95f5,function(_0x32f7df){if(_0x32f7df['type']!==_0xd843('0x3c')){var _0x3fd722={};_0x3fd722[_0x32f7df[_0xd843('0x27')]]={'$like':'%'+_0x3b52a0[_0xd843('0x2f')][_0xd843('0x39')]+'%'};return _0x3fd722;}})});}_0x3d8b5f=_[_0xd843('0x3b')]({},_0x3d8b5f,_0x3b52a0[_0xd843('0x3d')]);var _0x19d20a={'where':_0x3d8b5f['where']};return db[_0xd843('0x2b')][_0xd843('0x1d')](_0x19d20a)[_0xd843('0x23')](function(_0xf3da0c){_0x3cafe8[_0xd843('0x1d')]=_0xf3da0c;if(_0x3b52a0['query'][_0xd843('0x3e')]){_0x3d8b5f[_0xd843('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0xd843('0x40')](_0x3d8b5f);})[_0xd843('0x23')](function(_0xa4f62f){_0x3cafe8[_0xd843('0x41')]=_0xa4f62f;return _0x3cafe8;})[_0xd843('0x23')](respondWithFilteredResult(_0x57cf29,_0x3d8b5f))[_0xd843('0x42')](handleError(_0x57cf29,null));};exports[_0xd843('0x43')]=function(_0x20062b,_0x33b05d){var _0x579ad5={'raw':!![],'where':{'id':_0x20062b[_0xd843('0x44')]['id']}},_0x1afa65={};_0x1afa65[_0xd843('0x2e')]=_[_0xd843('0x30')](db[_0xd843('0x2b')]['rawAttributes']);_0x1afa65[_0xd843('0x2f')]=_['keys'](_0x20062b['query']);_0x1afa65[_0xd843('0x31')]=_['intersection'](_0x1afa65[_0xd843('0x2e')],_0x1afa65['query']);_0x579ad5['attributes']=_[_0xd843('0x32')](_0x1afa65[_0xd843('0x2e')],qs['fields'](_0x20062b['query'][_0xd843('0x34')]));_0x579ad5[_0xd843('0x33')]=_0x579ad5[_0xd843('0x33')][_0xd843('0x35')]?_0x579ad5['attributes']:_0x1afa65[_0xd843('0x2e')];if(_0x20062b['query'][_0xd843('0x3e')]){_0x579ad5[_0xd843('0x3f')]=[{'all':!![]}];}_0x579ad5=_[_0xd843('0x3b')]({},_0x579ad5,_0x20062b[_0xd843('0x3d')]);return db[_0xd843('0x2b')]['find'](_0x579ad5)['then'](handleEntityNotFound(_0x33b05d,null))['then'](respondWithResult(_0x33b05d,null))['catch'](handleError(_0x33b05d,null));};exports['create']=function(_0x38b259,_0x19fde0){return db[_0xd843('0x2b')][_0xd843('0x45')](_0x38b259[_0xd843('0x46')],{})[_0xd843('0x23')](respondWithResult(_0x19fde0,0xc9))[_0xd843('0x42')](handleError(_0x19fde0,null));};exports[_0xd843('0x22')]=function(_0x31c473,_0x20fe6b){if(_0x31c473['body']['id']){delete _0x31c473['body']['id'];}return db[_0xd843('0x2b')][_0xd843('0x47')]({'where':{'id':_0x31c473['params']['id']}})['then'](handleEntityNotFound(_0x20fe6b,null))[_0xd843('0x23')](saveUpdates(_0x31c473[_0xd843('0x46')],null))[_0xd843('0x23')](respondWithResult(_0x20fe6b,null))[_0xd843('0x42')](handleError(_0x20fe6b,null));};exports[_0xd843('0x24')]=function(_0x43c8a2,_0x35dc95){return db[_0xd843('0x2b')][_0xd843('0x47')]({'where':{'id':_0x43c8a2[_0xd843('0x44')]['id']}})[_0xd843('0x23')](handleEntityNotFound(_0x35dc95,null))[_0xd843('0x23')](removeEntity(_0x35dc95,null))[_0xd843('0x42')](handleError(_0x35dc95,null));};exports['describe']=function(_0x4b571e,_0x50a7d0){return db[_0xd843('0x2b')]['describe']()[_0xd843('0x23')](respondWithResult(_0x50a7d0,null))[_0xd843('0x42')](handleError(_0x50a7d0,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index dcaeb74..138640f 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 _0xf06c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','project_name','leaveAt'];(function(_0x57f6ad,_0x4795b6){var _0x425c09=function(_0xac3ba6){while(--_0xac3ba6){_0x57f6ad['push'](_0x57f6ad['shift']());}};_0x425c09(++_0x4795b6);}(_0xf06c,0xff));var _0xcf06=function(_0x130a42,_0x50c832){_0x130a42=_0x130a42-0x0;var _0x49801e=_0xf06c[_0x130a42];return _0x49801e;};'use strict';var _=require(_0xcf06('0x0'));var util=require(_0xcf06('0x1'));var logger=require(_0xcf06('0x2'))(_0xcf06('0x3'));var moment=require(_0xcf06('0x4'));var BPromise=require(_0xcf06('0x5'));var rp=require(_0xcf06('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf06('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf06('0x8'));module[_0xcf06('0x9')]=function(_0xfb7443,_0x30ed7a){return _0xfb7443[_0xcf06('0xa')](_0xcf06('0xb'),attributes,{'tableName':_0xcf06('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0xcf06('0xd')]},{'name':'leaveAt','fields':[_0xcf06('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x04e3=['bluebird','path','rimraf','../../config/environment','report_square','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','api','moment'];(function(_0x41f59b,_0x5f5893){var _0x2aae21=function(_0x4895c7){while(--_0x4895c7){_0x41f59b['push'](_0x41f59b['shift']());}};_0x2aae21(++_0x5f5893);}(_0x04e3,0x129));var _0x304e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x04e3[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x304e('0x0'))(_0x304e('0x1'));var moment=require(_0x304e('0x2'));var BPromise=require(_0x304e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x304e('0x4'));var rimraf=require(_0x304e('0x5'));var config=require(_0x304e('0x6'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x144782,_0xc644da){return _0x144782['define']('SquareReport',attributes,{'tableName':_0x304e('0x7'),'paranoid':![],'indexes':[{'name':_0x304e('0x8'),'fields':[_0x304e('0x9'),_0x304e('0xa')]},{'name':_0x304e('0xb'),'fields':[_0x304e('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 4d0af40..669104b 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 _0x7a0d=['SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','update','where','attributes','limit','UpdateSquareReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a0d,0xed));var _0xd7a0=function(_0x4f3e5a,_0x1ee150){_0x4f3e5a=_0x4f3e5a-0x0;var _0x452880=_0x7a0d[_0x4f3e5a];return _0x452880;};'use strict';var _=require(_0xd7a0('0x0'));var util=require('util');var moment=require(_0xd7a0('0x1'));var BPromise=require(_0xd7a0('0x2'));var rs=require(_0xd7a0('0x3'));var fs=require('fs');var Redis=require(_0xd7a0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd7a0('0x5'));var logger=require(_0xd7a0('0x6'))(_0xd7a0('0x7'));var config=require(_0xd7a0('0x8'));var jayson=require(_0xd7a0('0x9'));var client=jayson[_0xd7a0('0xa')][_0xd7a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a7c1f,_0x197786,_0x4fbad4){return new BPromise(function(_0xfed59a,_0x5effcb){return client[_0xd7a0('0xc')](_0x5a7c1f,_0x4fbad4)[_0xd7a0('0xd')](function(_0x177cd3){logger[_0xd7a0('0xe')](_0xd7a0('0xf'),_0x197786,_0xd7a0('0x10'));logger[_0xd7a0('0x11')](_0xd7a0('0x12'),_0x197786,'request\x20sent',JSON[_0xd7a0('0x13')](_0x177cd3));if(_0x177cd3[_0xd7a0('0x14')]){if(_0x177cd3[_0xd7a0('0x14')][_0xd7a0('0x15')]===0x1f4){logger[_0xd7a0('0x14')]('SquareReport,\x20%s,\x20%s',_0x197786,_0x177cd3[_0xd7a0('0x14')][_0xd7a0('0x16')]);return _0x5effcb(_0x177cd3['error'][_0xd7a0('0x16')]);}logger[_0xd7a0('0x14')]('SquareReport,\x20%s,\x20%s',_0x197786,_0x177cd3['error'][_0xd7a0('0x16')]);return _0xfed59a(_0x177cd3[_0xd7a0('0x14')][_0xd7a0('0x16')]);}else{logger[_0xd7a0('0xe')]('SquareReport,\x20%s,\x20%s',_0x197786,_0xd7a0('0x10'));_0xfed59a(_0x177cd3[_0xd7a0('0x17')][_0xd7a0('0x16')]);}})[_0xd7a0('0x18')](function(_0x43b78c){logger[_0xd7a0('0x14')]('SquareReport,\x20%s,\x20%s',_0x197786,_0x43b78c);_0x5effcb(_0x43b78c);});});}exports[_0xd7a0('0x19')]=function(_0x13f38a){var _0x2c5e4d=this;return new Promise(function(_0xf51e87,_0x33c2e4){return db[_0xd7a0('0x1a')][_0xd7a0('0x1b')](_0x13f38a[_0xd7a0('0x1c')],{'raw':_0x13f38a[_0xd7a0('0x1d')]?_0x13f38a[_0xd7a0('0x1d')][_0xd7a0('0x1e')]===undefined?!![]:![]:!![]})[_0xd7a0('0xd')](function(_0x3263cc){logger[_0xd7a0('0xe')](_0xd7a0('0x19'),_0x13f38a);logger[_0xd7a0('0x11')](_0xd7a0('0x19'),_0x13f38a,JSON[_0xd7a0('0x13')](_0x3263cc));_0xf51e87(_0x3263cc);})['catch'](function(_0x27257b){logger[_0xd7a0('0x14')](_0xd7a0('0x19'),_0x27257b[_0xd7a0('0x16')],_0x13f38a);_0x33c2e4(_0x2c5e4d[_0xd7a0('0x14')](0x1f4,_0x27257b[_0xd7a0('0x16')]));});});};exports['UpdateSquareReport']=function(_0x24b94e){var _0x2ab6be=this;return new Promise(function(_0x1aec6a,_0x4a73e2){return db['SquareReport'][_0xd7a0('0x1f')](_0x24b94e[_0xd7a0('0x1c')],{'raw':_0x24b94e[_0xd7a0('0x1d')]?_0x24b94e[_0xd7a0('0x1d')][_0xd7a0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24b94e[_0xd7a0('0x1d')]?_0x24b94e['options'][_0xd7a0('0x20')]||null:null,'attributes':_0x24b94e['options']?_0x24b94e[_0xd7a0('0x1d')][_0xd7a0('0x21')]||null:null,'limit':_0x24b94e['options']?_0x24b94e[_0xd7a0('0x1d')][_0xd7a0('0x22')]||null:null})[_0xd7a0('0xd')](function(_0x1c95de){logger['info'](_0xd7a0('0x23'),_0x24b94e);logger['debug'](_0xd7a0('0x23'),_0x24b94e,JSON[_0xd7a0('0x13')](_0x1c95de));_0x1aec6a(_0x1c95de);})[_0xd7a0('0x18')](function(_0x1c528d){logger[_0xd7a0('0x14')]('UpdateSquareReport',_0x1c528d[_0xd7a0('0x16')],_0x24b94e);_0x4a73e2(_0x2ab6be[_0xd7a0('0x14')](0x1f4,_0x1c528d[_0xd7a0('0x16')]));});});}; \ No newline at end of file +var _0xa3ad=['randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','SquareReport,\x20%s,\x20%s','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','update','where','attributes','limit','stringify','lodash','util','moment'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xa3ad,0x1bd));var _0xda3a=function(_0x45ecfc,_0x515703){_0x45ecfc=_0x45ecfc-0x0;var _0x531a12=_0xa3ad[_0x45ecfc];return _0x531a12;};'use strict';var _=require(_0xda3a('0x0'));var util=require(_0xda3a('0x1'));var moment=require(_0xda3a('0x2'));var BPromise=require('bluebird');var rs=require(_0xda3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xda3a('0x4'));var config=require(_0xda3a('0x5'));var jayson=require(_0xda3a('0x6'));var client=jayson[_0xda3a('0x7')][_0xda3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20ff3e,_0x320064,_0x59821c){return new BPromise(function(_0x39d5f1,_0x9dadc7){return client[_0xda3a('0x9')](_0x20ff3e,_0x59821c)[_0xda3a('0xa')](function(_0x4fd64d){logger[_0xda3a('0xb')]('SquareReport,\x20%s,\x20%s',_0x320064,'request\x20sent');logger[_0xda3a('0xc')](_0xda3a('0xd'),_0x320064,_0xda3a('0xe'),JSON['stringify'](_0x4fd64d));if(_0x4fd64d[_0xda3a('0xf')]){if(_0x4fd64d[_0xda3a('0xf')]['code']===0x1f4){logger[_0xda3a('0xf')]('SquareReport,\x20%s,\x20%s',_0x320064,_0x4fd64d[_0xda3a('0xf')]['message']);return _0x9dadc7(_0x4fd64d['error'][_0xda3a('0x10')]);}logger[_0xda3a('0xf')](_0xda3a('0x11'),_0x320064,_0x4fd64d['error']['message']);return _0x39d5f1(_0x4fd64d[_0xda3a('0xf')][_0xda3a('0x10')]);}else{logger[_0xda3a('0xb')]('SquareReport,\x20%s,\x20%s',_0x320064,_0xda3a('0xe'));_0x39d5f1(_0x4fd64d[_0xda3a('0x12')][_0xda3a('0x10')]);}})[_0xda3a('0x13')](function(_0x43f65b){logger[_0xda3a('0xf')](_0xda3a('0x11'),_0x320064,_0x43f65b);_0x9dadc7(_0x43f65b);});});}exports['CreateSquareReport']=function(_0x133495){var _0x551c87=this;return new Promise(function(_0x280ce5,_0x2b1bf4){return db[_0xda3a('0x14')][_0xda3a('0x15')](_0x133495[_0xda3a('0x16')],{'raw':_0x133495['options']?_0x133495[_0xda3a('0x17')][_0xda3a('0x18')]===undefined?!![]:![]:!![]})[_0xda3a('0xa')](function(_0x27b30f){logger[_0xda3a('0xb')]('CreateSquareReport',_0x133495);logger['debug'](_0xda3a('0x19'),_0x133495,JSON['stringify'](_0x27b30f));_0x280ce5(_0x27b30f);})[_0xda3a('0x13')](function(_0x29d804){logger['error']('CreateSquareReport',_0x29d804[_0xda3a('0x10')],_0x133495);_0x2b1bf4(_0x551c87['error'](0x1f4,_0x29d804[_0xda3a('0x10')]));});});};exports[_0xda3a('0x1a')]=function(_0x34f51e){var _0x648f65=this;return new Promise(function(_0x1e3427,_0x4f5512){return db[_0xda3a('0x14')][_0xda3a('0x1b')](_0x34f51e[_0xda3a('0x16')],{'raw':_0x34f51e['options']?_0x34f51e[_0xda3a('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34f51e[_0xda3a('0x17')]?_0x34f51e['options'][_0xda3a('0x1c')]||null:null,'attributes':_0x34f51e[_0xda3a('0x17')]?_0x34f51e['options'][_0xda3a('0x1d')]||null:null,'limit':_0x34f51e['options']?_0x34f51e[_0xda3a('0x17')][_0xda3a('0x1e')]||null:null})[_0xda3a('0xa')](function(_0x39784e){logger[_0xda3a('0xb')](_0xda3a('0x1a'),_0x34f51e);logger['debug'](_0xda3a('0x1a'),_0x34f51e,JSON[_0xda3a('0x1f')](_0x39784e));_0x1e3427(_0x39784e);})['catch'](function(_0x276b44){logger[_0xda3a('0xf')](_0xda3a('0x1a'),_0x276b44[_0xda3a('0x10')],_0x34f51e);_0x4f5512(_0x648f65[_0xda3a('0xf')](0x1f4,_0x276b44[_0xda3a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 952fb40..aecc970 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 _0xd7e8=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd7e8,0x154));var _0x8d7e=function(_0x196be3,_0x1df3ef){_0x196be3=_0x196be3-0x0;var _0x400a51=_0xd7e8[_0x196be3];return _0x400a51;};'use strict';var multer=require(_0x8d7e('0x0'));var util=require(_0x8d7e('0x1'));var path=require(_0x8d7e('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d7e('0x3'));var router=express[_0x8d7e('0x4')]();var fs_extra=require(_0x8d7e('0x5'));var auth=require(_0x8d7e('0x6'));var interaction=require(_0x8d7e('0x7'));var config=require('../../config/environment');var controller=require(_0x8d7e('0x8'));router[_0x8d7e('0x9')]('/',auth[_0x8d7e('0xa')](),controller[_0x8d7e('0xb')]);router[_0x8d7e('0x9')](_0x8d7e('0xc'),auth[_0x8d7e('0xa')](),controller[_0x8d7e('0xd')]);router[_0x8d7e('0x9')](_0x8d7e('0xe'),auth[_0x8d7e('0xa')](),controller[_0x8d7e('0xf')]);router[_0x8d7e('0x10')]('/',auth[_0x8d7e('0xa')](),controller[_0x8d7e('0x11')]);router['put'](_0x8d7e('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x8d7e('0x12')](_0x8d7e('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x8d7e('0x13')]=router; \ No newline at end of file +var _0x86f7=['path','express','fs-extra','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','post','put','destroy','multer','util'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0x86f7,0x157));var _0x786f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x86f7[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x786f('0x0'));var util=require(_0x786f('0x1'));var path=require(_0x786f('0x2'));var timeout=require('connect-timeout');var express=require(_0x786f('0x3'));var router=express['Router']();var fs_extra=require(_0x786f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x786f('0x5'));var controller=require(_0x786f('0x6'));router[_0x786f('0x7')]('/',auth[_0x786f('0x8')](),controller[_0x786f('0x9')]);router[_0x786f('0x7')](_0x786f('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x786f('0x7')](_0x786f('0xb'),auth[_0x786f('0x8')](),controller['show']);router[_0x786f('0xc')]('/',auth[_0x786f('0x8')](),controller['create']);router[_0x786f('0xd')]('/:id',auth[_0x786f('0x8')](),controller['update']);router['delete'](_0x786f('0xb'),auth[_0x786f('0x8')](),controller[_0x786f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index fb29a3a..30c0dc8 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 _0x2ae8=['TEXT','sequelize','exports','STRING'];(function(_0xf5a8e4,_0x4b7e54){var _0x58ac23=function(_0x391b4c){while(--_0x391b4c){_0xf5a8e4['push'](_0xf5a8e4['shift']());}};_0x58ac23(++_0x4b7e54);}(_0x2ae8,0x101));var _0x82ae=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x2ae8[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x82ae('0x0'));module[_0x82ae('0x1')]={'uniqueid':{'type':Sequelize[_0x82ae('0x2')]},'node':{'type':Sequelize[_0x82ae('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x82ae('0x3')]},'project_name':{'type':Sequelize[_0x82ae('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc29=['STRING','sequelize'];(function(_0x545e1c,_0x3088d1){var _0x47abef=function(_0x4981b1){while(--_0x4981b1){_0x545e1c['push'](_0x545e1c['shift']());}};_0x47abef(++_0x3088d1);}(_0xdc29,0xd3));var _0x9dc2=function(_0x2015eb,_0x2652d4){_0x2015eb=_0x2015eb-0x0;var _0x47e50f=_0xdc29[_0x2015eb];return _0x47e50f;};'use strict';var Sequelize=require(_0x9dc2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9dc2('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9dc2('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 49800b5..2912d51 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 _0x614f=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','end','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce'];(function(_0x5009a2,_0x528e60){var _0x26f74d=function(_0x2b1bf0){while(--_0x2b1bf0){_0x5009a2['push'](_0x5009a2['shift']());}};_0x26f74d(++_0x528e60);}(_0x614f,0x1c5));var _0xf614=function(_0xe769be,_0x5898cb){_0xe769be=_0xe769be-0x0;var _0x487ffc=_0x614f[_0xe769be];return _0x487ffc;};'use strict';var emlformat=require(_0xf614('0x0'));var rimraf=require(_0xf614('0x1'));var zipdir=require(_0xf614('0x2'));var jsonpatch=require(_0xf614('0x3'));var rp=require(_0xf614('0x4'));var moment=require(_0xf614('0x5'));var BPromise=require(_0xf614('0x6'));var Mustache=require(_0xf614('0x7'));var util=require(_0xf614('0x8'));var path=require(_0xf614('0x9'));var sox=require(_0xf614('0xa'));var csv=require('to-csv');var ejs=require(_0xf614('0xb'));var fs=require('fs');var fs_extra=require(_0xf614('0xc'));var _=require(_0xf614('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf614('0xe'));var deskjs=require(_0xf614('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf614('0x10'));var Papa=require(_0xf614('0x11'));var Redis=require(_0xf614('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf614('0x13'));var hardwareService=require(_0xf614('0x14'));var logger=require('../../config/logger')(_0xf614('0x15'));var utils=require(_0xf614('0x16'));var config=require(_0xf614('0x17'));var licenseUtil=require(_0xf614('0x18'));var db=require(_0xf614('0x19'))['db'];function respondWithStatusCode(_0x512286,_0x3969dc){_0x3969dc=_0x3969dc||0xcc;return function(_0x50e054){if(_0x50e054){return _0x512286[_0xf614('0x1a')](_0x3969dc);}return _0x512286['status'](_0x3969dc)['end']();};}function respondWithResult(_0xeccf5f,_0x41bd29){_0x41bd29=_0x41bd29||0xc8;return function(_0x16a789){if(_0x16a789){return _0xeccf5f[_0xf614('0x1b')](_0x41bd29)['json'](_0x16a789);}};}function respondWithFilteredResult(_0x2a3283,_0x5d9550){return function(_0x53149f){if(_0x53149f){var _0x25a863=typeof _0x5d9550[_0xf614('0x1c')]===_0xf614('0x1d')&&typeof _0x5d9550[_0xf614('0x1e')]==='undefined';var _0x16a5be=_0x53149f[_0xf614('0x1f')];var _0x285e9a=_0x25a863?0x0:_0x5d9550[_0xf614('0x1c')];var _0x46f116=_0x25a863?_0x53149f['count']:_0x5d9550[_0xf614('0x1c')]+_0x5d9550['limit'];var _0x50267b;if(_0x46f116>=_0x16a5be){_0x46f116=_0x16a5be;_0x50267b=0xc8;}else{_0x50267b=0xce;}_0x2a3283[_0xf614('0x1b')](_0x50267b);return _0x2a3283[_0xf614('0x20')](_0xf614('0x21'),_0x285e9a+'-'+_0x46f116+'/'+_0x16a5be)['json'](_0x53149f);}return null;};}function patchUpdates(_0x13323e){return function(_0x15df74){try{jsonpatch[_0xf614('0x22')](_0x15df74,_0x13323e,!![]);}catch(_0x5ab06c){return BPromise['reject'](_0x5ab06c);}return _0x15df74['save']();};}function saveUpdates(_0x3a8037,_0x16403d){return function(_0x38810e){if(_0x38810e){return _0x38810e[_0xf614('0x23')](_0x3a8037)['then'](function(_0x4e7e14){return _0x4e7e14;});}return null;};}function removeEntity(_0x2b3f23,_0x298d5b){return function(_0x3cbf98){if(_0x3cbf98){return _0x3cbf98[_0xf614('0x24')]()[_0xf614('0x25')](function(){_0x2b3f23[_0xf614('0x1b')](0xcc)[_0xf614('0x26')]();});}};}function handleEntityNotFound(_0x470b01,_0x4ad250){return function(_0x4147c9){if(!_0x4147c9){_0x470b01[_0xf614('0x1a')](0x194);}return _0x4147c9;};}function handleError(_0x15f0bb,_0x9b48fb){_0x9b48fb=_0x9b48fb||0x1f4;return function(_0x16b609){logger[_0xf614('0x27')](_0x16b609[_0xf614('0x28')]);if(_0x16b609[_0xf614('0x29')]){delete _0x16b609[_0xf614('0x29')];}_0x15f0bb[_0xf614('0x1b')](_0x9b48fb)[_0xf614('0x2a')](_0x16b609);};}exports[_0xf614('0x2b')]=function(_0x246edd,_0x4bbbbd){var _0x14825c={},_0x436663={},_0x3d3c2b={'count':0x0,'rows':[]};var _0x918e57=_[_0xf614('0x2c')](db[_0xf614('0x2d')][_0xf614('0x2e')],function(_0x16e825){return{'name':_0x16e825[_0xf614('0x2f')],'type':_0x16e825['type'][_0xf614('0x30')]};});_0x436663[_0xf614('0x31')]=_[_0xf614('0x2c')](_0x918e57,_0xf614('0x29'));_0x436663[_0xf614('0x32')]=_[_0xf614('0x33')](_0x246edd[_0xf614('0x32')]);_0x436663[_0xf614('0x34')]=_['intersection'](_0x436663[_0xf614('0x31')],_0x436663[_0xf614('0x32')]);_0x14825c[_0xf614('0x35')]=_[_0xf614('0x36')](_0x436663[_0xf614('0x31')],qs[_0xf614('0x37')](_0x246edd[_0xf614('0x32')]['fields']));_0x14825c[_0xf614('0x35')]=_0x14825c[_0xf614('0x35')][_0xf614('0x38')]?_0x14825c[_0xf614('0x35')]:_0x436663[_0xf614('0x31')];if(!_0x246edd['query'][_0xf614('0x39')](_0xf614('0x3a'))){_0x14825c[_0xf614('0x1e')]=qs[_0xf614('0x1e')](_0x246edd[_0xf614('0x32')][_0xf614('0x1e')]);_0x14825c['offset']=qs[_0xf614('0x1c')](_0x246edd[_0xf614('0x32')][_0xf614('0x1c')]);}_0x14825c[_0xf614('0x3b')]=qs[_0xf614('0x3c')](_0x246edd[_0xf614('0x32')]['sort']);_0x14825c[_0xf614('0x3d')]=qs[_0xf614('0x34')](_['pick'](_0x246edd['query'],_0x436663[_0xf614('0x34')]),_0x918e57);if(_0x246edd[_0xf614('0x32')][_0xf614('0x3e')]){_0x14825c['where']=_[_0xf614('0x3f')](_0x14825c[_0xf614('0x3d')],{'$or':_[_0xf614('0x2c')](_0x918e57,function(_0x3a54b5){if(_0x3a54b5[_0xf614('0x40')]!==_0xf614('0x41')){var _0x201c16={};_0x201c16[_0x3a54b5[_0xf614('0x29')]]={'$like':'%'+_0x246edd['query'][_0xf614('0x3e')]+'%'};return _0x201c16;}})});}_0x14825c=_[_0xf614('0x3f')]({},_0x14825c,_0x246edd[_0xf614('0x42')]);var _0x372e36={'where':_0x14825c[_0xf614('0x3d')]};return db[_0xf614('0x2d')][_0xf614('0x1f')](_0x372e36)[_0xf614('0x25')](function(_0x389b5c){_0x3d3c2b[_0xf614('0x1f')]=_0x389b5c;if(_0x246edd[_0xf614('0x32')]['includeAll']){_0x14825c[_0xf614('0x43')]=[{'all':!![]}];}return db[_0xf614('0x2d')][_0xf614('0x44')](_0x14825c);})[_0xf614('0x25')](function(_0x1f4bc2){_0x3d3c2b[_0xf614('0x45')]=_0x1f4bc2;return _0x3d3c2b;})['then'](respondWithFilteredResult(_0x4bbbbd,_0x14825c))[_0xf614('0x46')](handleError(_0x4bbbbd,null));};exports[_0xf614('0x47')]=function(_0x5bb85f,_0x3da3fe){var _0x3947c2={'raw':!![],'where':{'id':_0x5bb85f['params']['id']}},_0x36cea3={};_0x36cea3['model']=_[_0xf614('0x33')](db['SquareDetailsReport'][_0xf614('0x2e')]);_0x36cea3[_0xf614('0x32')]=_[_0xf614('0x33')](_0x5bb85f['query']);_0x36cea3[_0xf614('0x34')]=_[_0xf614('0x36')](_0x36cea3[_0xf614('0x31')],_0x36cea3[_0xf614('0x32')]);_0x3947c2[_0xf614('0x35')]=_['intersection'](_0x36cea3[_0xf614('0x31')],qs[_0xf614('0x37')](_0x5bb85f[_0xf614('0x32')][_0xf614('0x37')]));_0x3947c2[_0xf614('0x35')]=_0x3947c2[_0xf614('0x35')][_0xf614('0x38')]?_0x3947c2[_0xf614('0x35')]:_0x36cea3['model'];if(_0x5bb85f[_0xf614('0x32')][_0xf614('0x48')]){_0x3947c2['include']=[{'all':!![]}];}_0x3947c2=_[_0xf614('0x3f')]({},_0x3947c2,_0x5bb85f[_0xf614('0x42')]);return db[_0xf614('0x2d')][_0xf614('0x49')](_0x3947c2)[_0xf614('0x25')](handleEntityNotFound(_0x3da3fe,null))[_0xf614('0x25')](respondWithResult(_0x3da3fe,null))[_0xf614('0x46')](handleError(_0x3da3fe,null));};exports[_0xf614('0x4a')]=function(_0x548b86,_0x74ce18){return db[_0xf614('0x2d')]['create'](_0x548b86['body'],{})['then'](respondWithResult(_0x74ce18,0xc9))[_0xf614('0x46')](handleError(_0x74ce18,null));};exports['update']=function(_0x2447ce,_0x2e8bf3){if(_0x2447ce[_0xf614('0x4b')]['id']){delete _0x2447ce[_0xf614('0x4b')]['id'];}return db[_0xf614('0x2d')][_0xf614('0x49')]({'where':{'id':_0x2447ce[_0xf614('0x4c')]['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x2e8bf3,null))[_0xf614('0x25')](saveUpdates(_0x2447ce[_0xf614('0x4b')],null))[_0xf614('0x25')](respondWithResult(_0x2e8bf3,null))[_0xf614('0x46')](handleError(_0x2e8bf3,null));};exports[_0xf614('0x24')]=function(_0x51bcfb,_0x230474){return db[_0xf614('0x2d')]['find']({'where':{'id':_0x51bcfb[_0xf614('0x4c')]['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x230474,null))[_0xf614('0x25')](removeEntity(_0x230474,null))[_0xf614('0x46')](handleError(_0x230474,null));};exports[_0xf614('0x4d')]=function(_0xd90f2e,_0x26f807){return db[_0xf614('0x2d')][_0xf614('0x4d')]()[_0xf614('0x25')](respondWithResult(_0x26f807,null))[_0xf614('0x46')](handleError(_0x26f807,null));}; \ No newline at end of file +var _0xabd2=['create','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','find'];(function(_0x347e71,_0x592fe6){var _0x49705d=function(_0x416857){while(--_0x416857){_0x347e71['push'](_0x347e71['shift']());}};_0x49705d(++_0x592fe6);}(_0xabd2,0xd8));var _0x2abd=function(_0x118549,_0x5400d1){_0x118549=_0x118549-0x0;var _0x255409=_0xabd2[_0x118549];return _0x255409;};'use strict';var emlformat=require(_0x2abd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2abd('0x1'));var rp=require(_0x2abd('0x2'));var moment=require(_0x2abd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2abd('0x4'));var util=require(_0x2abd('0x5'));var path=require(_0x2abd('0x6'));var sox=require(_0x2abd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2abd('0x8'));var _=require(_0x2abd('0x9'));var squel=require(_0x2abd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2abd('0xb'));var toCsv=require(_0x2abd('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2abd('0xd'));var authService=require(_0x2abd('0xe'));var qs=require(_0x2abd('0xf'));var as=require(_0x2abd('0x10'));var hardwareService=require(_0x2abd('0x11'));var logger=require(_0x2abd('0x12'))('api');var utils=require(_0x2abd('0x13'));var config=require(_0x2abd('0x14'));var licenseUtil=require(_0x2abd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1706d1,_0x3cfc8e){_0x3cfc8e=_0x3cfc8e||0xcc;return function(_0x2bd8f3){if(_0x2bd8f3){return _0x1706d1['sendStatus'](_0x3cfc8e);}return _0x1706d1['status'](_0x3cfc8e)['end']();};}function respondWithResult(_0x1eb867,_0x1514b8){_0x1514b8=_0x1514b8||0xc8;return function(_0x7274e5){if(_0x7274e5){return _0x1eb867[_0x2abd('0x16')](_0x1514b8)['json'](_0x7274e5);}};}function respondWithFilteredResult(_0x204940,_0xae5342){return function(_0x516c37){if(_0x516c37){var _0x171b32=typeof _0xae5342[_0x2abd('0x17')]==='undefined'&&typeof _0xae5342[_0x2abd('0x18')]===_0x2abd('0x19');var _0x3911de=_0x516c37['count'];var _0x45be3c=_0x171b32?0x0:_0xae5342[_0x2abd('0x17')];var _0x30ceca=_0x171b32?_0x516c37[_0x2abd('0x1a')]:_0xae5342[_0x2abd('0x17')]+_0xae5342[_0x2abd('0x18')];var _0x250c65;if(_0x30ceca>=_0x3911de){_0x30ceca=_0x3911de;_0x250c65=0xc8;}else{_0x250c65=0xce;}_0x204940[_0x2abd('0x16')](_0x250c65);return _0x204940[_0x2abd('0x1b')](_0x2abd('0x1c'),_0x45be3c+'-'+_0x30ceca+'/'+_0x3911de)[_0x2abd('0x1d')](_0x516c37);}return null;};}function patchUpdates(_0x4eae9f){return function(_0xc06d0){try{jsonpatch['apply'](_0xc06d0,_0x4eae9f,!![]);}catch(_0x111b21){return BPromise[_0x2abd('0x1e')](_0x111b21);}return _0xc06d0[_0x2abd('0x1f')]();};}function saveUpdates(_0xb5d813,_0x49442a){return function(_0x115186){if(_0x115186){return _0x115186[_0x2abd('0x20')](_0xb5d813)[_0x2abd('0x21')](function(_0x474bb5){return _0x474bb5;});}return null;};}function removeEntity(_0x3f7b08,_0x29bc5e){return function(_0x28f13d){if(_0x28f13d){return _0x28f13d[_0x2abd('0x22')]()['then'](function(){_0x3f7b08[_0x2abd('0x16')](0xcc)[_0x2abd('0x23')]();});}};}function handleEntityNotFound(_0x23a3f8,_0x15830f){return function(_0x5e7be9){if(!_0x5e7be9){_0x23a3f8[_0x2abd('0x24')](0x194);}return _0x5e7be9;};}function handleError(_0x209e4d,_0x2e7ae9){_0x2e7ae9=_0x2e7ae9||0x1f4;return function(_0x571546){logger[_0x2abd('0x25')](_0x571546[_0x2abd('0x26')]);if(_0x571546[_0x2abd('0x27')]){delete _0x571546[_0x2abd('0x27')];}_0x209e4d[_0x2abd('0x16')](_0x2e7ae9)[_0x2abd('0x28')](_0x571546);};}exports[_0x2abd('0x29')]=function(_0xcc404c,_0x1c2787){var _0x3a156b={},_0x4cd631={},_0x368318={'count':0x0,'rows':[]};var _0x13ef01=_[_0x2abd('0x2a')](db[_0x2abd('0x2b')]['rawAttributes'],function(_0x482379){return{'name':_0x482379[_0x2abd('0x2c')],'type':_0x482379[_0x2abd('0x2d')]['key']};});_0x4cd631[_0x2abd('0x2e')]=_['map'](_0x13ef01,_0x2abd('0x27'));_0x4cd631['query']=_[_0x2abd('0x2f')](_0xcc404c['query']);_0x4cd631[_0x2abd('0x30')]=_[_0x2abd('0x31')](_0x4cd631['model'],_0x4cd631[_0x2abd('0x32')]);_0x3a156b[_0x2abd('0x33')]=_[_0x2abd('0x31')](_0x4cd631['model'],qs[_0x2abd('0x34')](_0xcc404c[_0x2abd('0x32')]['fields']));_0x3a156b[_0x2abd('0x33')]=_0x3a156b[_0x2abd('0x33')][_0x2abd('0x35')]?_0x3a156b[_0x2abd('0x33')]:_0x4cd631[_0x2abd('0x2e')];if(!_0xcc404c[_0x2abd('0x32')][_0x2abd('0x36')](_0x2abd('0x37'))){_0x3a156b[_0x2abd('0x18')]=qs[_0x2abd('0x18')](_0xcc404c['query']['limit']);_0x3a156b[_0x2abd('0x17')]=qs[_0x2abd('0x17')](_0xcc404c[_0x2abd('0x32')]['offset']);}_0x3a156b[_0x2abd('0x38')]=qs['sort'](_0xcc404c['query']['sort']);_0x3a156b['where']=qs['filters'](_['pick'](_0xcc404c[_0x2abd('0x32')],_0x4cd631['filters']),_0x13ef01);if(_0xcc404c['query'][_0x2abd('0x39')]){_0x3a156b[_0x2abd('0x3a')]=_['merge'](_0x3a156b['where'],{'$or':_[_0x2abd('0x2a')](_0x13ef01,function(_0x3a6e55){if(_0x3a6e55[_0x2abd('0x2d')]!==_0x2abd('0x3b')){var _0x291003={};_0x291003[_0x3a6e55[_0x2abd('0x27')]]={'$like':'%'+_0xcc404c[_0x2abd('0x32')][_0x2abd('0x39')]+'%'};return _0x291003;}})});}_0x3a156b=_[_0x2abd('0x3c')]({},_0x3a156b,_0xcc404c['options']);var _0x26ede3={'where':_0x3a156b['where']};return db[_0x2abd('0x2b')][_0x2abd('0x1a')](_0x26ede3)[_0x2abd('0x21')](function(_0xf7a9ef){_0x368318[_0x2abd('0x1a')]=_0xf7a9ef;if(_0xcc404c[_0x2abd('0x32')][_0x2abd('0x3d')]){_0x3a156b[_0x2abd('0x3e')]=[{'all':!![]}];}return db[_0x2abd('0x2b')][_0x2abd('0x3f')](_0x3a156b);})[_0x2abd('0x21')](function(_0xa70853){_0x368318['rows']=_0xa70853;return _0x368318;})['then'](respondWithFilteredResult(_0x1c2787,_0x3a156b))[_0x2abd('0x40')](handleError(_0x1c2787,null));};exports[_0x2abd('0x41')]=function(_0x4440bb,_0xab716e){var _0x316b5c={'raw':!![],'where':{'id':_0x4440bb[_0x2abd('0x42')]['id']}},_0x490fa3={};_0x490fa3[_0x2abd('0x2e')]=_['keys'](db[_0x2abd('0x2b')]['rawAttributes']);_0x490fa3[_0x2abd('0x32')]=_[_0x2abd('0x2f')](_0x4440bb[_0x2abd('0x32')]);_0x490fa3[_0x2abd('0x30')]=_[_0x2abd('0x31')](_0x490fa3[_0x2abd('0x2e')],_0x490fa3[_0x2abd('0x32')]);_0x316b5c[_0x2abd('0x33')]=_['intersection'](_0x490fa3['model'],qs[_0x2abd('0x34')](_0x4440bb[_0x2abd('0x32')][_0x2abd('0x34')]));_0x316b5c['attributes']=_0x316b5c['attributes'][_0x2abd('0x35')]?_0x316b5c[_0x2abd('0x33')]:_0x490fa3['model'];if(_0x4440bb['query'][_0x2abd('0x3d')]){_0x316b5c['include']=[{'all':!![]}];}_0x316b5c=_[_0x2abd('0x3c')]({},_0x316b5c,_0x4440bb['options']);return db[_0x2abd('0x2b')][_0x2abd('0x43')](_0x316b5c)[_0x2abd('0x21')](handleEntityNotFound(_0xab716e,null))['then'](respondWithResult(_0xab716e,null))[_0x2abd('0x40')](handleError(_0xab716e,null));};exports[_0x2abd('0x44')]=function(_0x133207,_0x35bcf9){return db[_0x2abd('0x2b')][_0x2abd('0x44')](_0x133207[_0x2abd('0x45')],{})[_0x2abd('0x21')](respondWithResult(_0x35bcf9,0xc9))[_0x2abd('0x40')](handleError(_0x35bcf9,null));};exports['update']=function(_0xd071c7,_0x145273){if(_0xd071c7[_0x2abd('0x45')]['id']){delete _0xd071c7['body']['id'];}return db[_0x2abd('0x2b')][_0x2abd('0x43')]({'where':{'id':_0xd071c7[_0x2abd('0x42')]['id']}})[_0x2abd('0x21')](handleEntityNotFound(_0x145273,null))[_0x2abd('0x21')](saveUpdates(_0xd071c7[_0x2abd('0x45')],null))[_0x2abd('0x21')](respondWithResult(_0x145273,null))[_0x2abd('0x40')](handleError(_0x145273,null));};exports[_0x2abd('0x22')]=function(_0x7e47e4,_0x3e05d3){return db[_0x2abd('0x2b')][_0x2abd('0x43')]({'where':{'id':_0x7e47e4[_0x2abd('0x42')]['id']}})[_0x2abd('0x21')](handleEntityNotFound(_0x3e05d3,null))[_0x2abd('0x21')](removeEntity(_0x3e05d3,null))[_0x2abd('0x40')](handleError(_0x3e05d3,null));};exports[_0x2abd('0x46')]=function(_0x3239a6,_0x2317d0){return db['SquareDetailsReport']['describe']()[_0x2abd('0x21')](respondWithResult(_0x2317d0,null))[_0x2abd('0x40')](handleError(_0x2317d0,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c36be37..956569c 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 _0x93f3=['SquareDetailsReport','report_square_details','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x93f3,0x112));var _0x393f=function(_0x3b036c,_0x1e7390){_0x3b036c=_0x3b036c-0x0;var _0x28369a=_0x93f3[_0x3b036c];return _0x28369a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x393f('0x0'));var rp=require(_0x393f('0x1'));var fs=require('fs');var path=require(_0x393f('0x2'));var rimraf=require(_0x393f('0x3'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x393f('0x4')]=function(_0x3ce4d3,_0x4a94b6){return _0x3ce4d3[_0x393f('0x5')](_0x393f('0x6'),attributes,{'tableName':_0x393f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd11e=['request-promise','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3af159,_0x2018cc){var _0x47e916=function(_0x56adc1){while(--_0x56adc1){_0x3af159['push'](_0x3af159['shift']());}};_0x47e916(++_0x2018cc);}(_0xd11e,0x102));var _0xed11=function(_0x4fd23f,_0x301599){_0x4fd23f=_0x4fd23f-0x0;var _0xddd201=_0xd11e[_0x4fd23f];return _0xddd201;};'use strict';var _=require(_0xed11('0x0'));var util=require(_0xed11('0x1'));var logger=require(_0xed11('0x2'))(_0xed11('0x3'));var moment=require(_0xed11('0x4'));var BPromise=require(_0xed11('0x5'));var rp=require(_0xed11('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xed11('0x7'));var attributes=require(_0xed11('0x8'));module[_0xed11('0x9')]=function(_0x479603,_0x9d35a1){return _0x479603[_0xed11('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xed11('0xb'),'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 6bd95bc..7000164 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 _0x5eb8=['CreateSquareDetailsReport','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','catch','SquareDetailsReport','create','body','options','raw','then'];(function(_0x16eeb7,_0x57dc34){var _0x1d6c43=function(_0x32f507){while(--_0x32f507){_0x16eeb7['push'](_0x16eeb7['shift']());}};_0x1d6c43(++_0x57dc34);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0x5eb8[_0x4f4c2a];return _0xd15be6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['CreateSquareDetailsReport']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')](_0x50d2a8[_0x85eb('0x17')],{'raw':_0x50d2a8['options']?_0x50d2a8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![]})[_0x85eb('0x1a')](function(_0x4e8041){logger['info']('CreateSquareDetailsReport',_0x50d2a8);logger['debug'](_0x85eb('0x1b'),_0x50d2a8,JSON[_0x85eb('0x1c')](_0x4e8041));_0x39ca96(_0x4e8041);})[_0x85eb('0x14')](function(_0x255ca7){logger[_0x85eb('0x12')](_0x85eb('0x1b'),_0x255ca7['message'],_0x50d2a8);_0x10cf2f(_0xe198ca['error'](0x1f4,_0x255ca7['message']));});});}; \ No newline at end of file +var _0x3423=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','catch'];(function(_0x472665,_0x461f26){var _0xa9c46b=function(_0x5bdd0d){while(--_0x5bdd0d){_0x472665['push'](_0x472665['shift']());}};_0xa9c46b(++_0x461f26);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c40c,_0x420d4b,_0x76422d){return new BPromise(function(_0xce08ab,_0x305d13){return client[_0x3342('0xc')](_0x29c40c,_0x76422d)[_0x3342('0xd')](function(_0x4ae4f3){logger['info'](_0x3342('0xe'),_0x420d4b,'request\x20sent');logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x420d4b,'request\x20sent',JSON[_0x3342('0xf')](_0x4ae4f3));if(_0x4ae4f3[_0x3342('0x10')]){if(_0x4ae4f3['error'][_0x3342('0x11')]===0x1f4){logger['error'](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')]['message']);return _0x305d13(_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);}logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);return _0xce08ab(_0x4ae4f3[_0x3342('0x10')]['message']);}else{logger[_0x3342('0x13')](_0x3342('0xe'),_0x420d4b,'request\x20sent');_0xce08ab(_0x4ae4f3[_0x3342('0x14')][_0x3342('0x12')]);}})['catch'](function(_0x554f9c){logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x554f9c);_0x305d13(_0x554f9c);});});}exports[_0x3342('0x15')]=function(_0x2075cb){var _0x12947a=this;return new Promise(function(_0x156c24,_0x45a3ca){return db[_0x3342('0x16')][_0x3342('0x17')](_0x2075cb['body'],{'raw':_0x2075cb[_0x3342('0x18')]?_0x2075cb[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3cb86f){logger[_0x3342('0x13')]('CreateSquareDetailsReport',_0x2075cb);logger[_0x3342('0x1a')](_0x3342('0x15'),_0x2075cb,JSON['stringify'](_0x3cb86f));_0x156c24(_0x3cb86f);})[_0x3342('0x1b')](function(_0x5a0658){logger[_0x3342('0x10')](_0x3342('0x15'),_0x5a0658[_0x3342('0x12')],_0x2075cb);_0x45a3ca(_0x12947a[_0x3342('0x10')](0x1f4,_0x5a0658[_0x3342('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3862378..09d1cf8 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 _0xd314=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess','exports','express'];(function(_0x53fed7,_0x3873be){var _0x29714f=function(_0xd248b0){while(--_0xd248b0){_0x53fed7['push'](_0x53fed7['shift']());}};_0x29714f(++_0x3873be);}(_0xd314,0x13a));var _0x4d31=function(_0xc36879,_0x33e511){_0xc36879=_0xc36879-0x0;var _0x4daeaa=_0xd314[_0xc36879];return _0x4daeaa;};'use strict';var express=require(_0x4d31('0x0'));var router=express[_0x4d31('0x1')]();var auth=require(_0x4d31('0x2'));var controller=require(_0x4d31('0x3'));router[_0x4d31('0x4')]('/',auth[_0x4d31('0x5')](),controller[_0x4d31('0x6')]);router[_0x4d31('0x4')]('/process/:pid/kill',auth[_0x4d31('0x5')](),controller[_0x4d31('0x7')]);module[_0x4d31('0x8')]=router; \ No newline at end of file +var _0x754e=['Router','../../components/auth/service','./system.controller','isAuthenticated','/process/:pid/kill','exports','express'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x754e,0x92));var _0xe754=function(_0x5ed894,_0x4276b6){_0x5ed894=_0x5ed894-0x0;var _0x5b0496=_0x754e[_0x5ed894];return _0x5b0496;};'use strict';var express=require(_0xe754('0x0'));var router=express[_0xe754('0x1')]();var auth=require(_0xe754('0x2'));var controller=require(_0xe754('0x3'));router['get']('/',auth[_0xe754('0x4')](),controller['index']);router['get'](_0xe754('0x5'),auth[_0xe754('0x4')](),controller['killProcess']);module[_0xe754('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 6974e6a..8be6ab3 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 _0x80ef=['kill','SIGINT','killProcess','systeminformation','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','then','catch','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x80ef,0xd3));var _0xf80e=function(_0x1eb3a9,_0x1bc3d2){_0x1eb3a9=_0x1eb3a9-0x0;var _0x588a71=_0x80ef[_0x1eb3a9];return _0x588a71;};'use strict';var info=require(_0xf80e('0x0'));var exec=require('child_process')[_0xf80e('0x1')];var logger=require(_0xf80e('0x2'))(_0xf80e('0x3'));var util=require('util');var BPromise=require(_0xf80e('0x4'));var _=require(_0xf80e('0x5'));function handleError(_0x30ac81,_0x2b730b,_0x3fef2a){_0x2b730b=_0x2b730b||0x1f4;return function(_0x345fb9){logger[_0xf80e('0x6')](_0xf80e('0x7'),_0x3fef2a,_0x2b730b,util['inspect'](_0x345fb9,{'showHidden':![],'depth':null}));delete _0x345fb9['name'];_0x30ac81[_0xf80e('0x8')](_0x2b730b)[_0xf80e('0x9')](_0x345fb9);};}exports[_0xf80e('0xa')]=function(_0x354b3f,_0x19ecb2){return info[_0xf80e('0xb')]()[_0xf80e('0xc')](function(_0x2f7ffc){return _0x19ecb2['status'](0xc8)['json'](_0x2f7ffc);})[_0xf80e('0xd')](function(_0x4a3b9b){return _0x19ecb2[_0xf80e('0x8')](0x1f4)[_0xf80e('0xe')](_0x4a3b9b);});};exports['killProcess']=function(_0x4539c4,_0x2be415){var _0x3cc649=[_0xf80e('0xf')];return new BPromise(function(_0x1169c8,_0x185227){return exec(util[_0xf80e('0x10')](_0xf80e('0x11'),_0x4539c4[_0xf80e('0x12')][_0xf80e('0x13')]),function(_0x1fdb40,_0x1dc80b,_0xc89b7c){if(_0x1fdb40){return _0x185227(_0x1fdb40);}return _0x1169c8(_0x1dc80b);});})['then'](function(_0x811c3f){var _0x3db540=![];var _0x144700=_0x811c3f[_0xf80e('0x14')](/\n/);for(var _0x1510c4=0x0,_0x17157c=_0x3cc649[_0xf80e('0x15')];_0x1510c4<_0x17157c,_0x3db540===![];_0x1510c4+=0x1){if(_0x811c3f[_0xf80e('0x16')](_0x3cc649[_0x1510c4])>=0x0){_0x3db540=!![];}}if(!_0x3db540){throw new Error(util[_0xf80e('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4539c4[_0xf80e('0x12')][_0xf80e('0x13')]));}process[_0xf80e('0x17')](_0x4539c4[_0xf80e('0x12')][_0xf80e('0x13')],_0xf80e('0x18'));return _0x2be415[_0xf80e('0x8')](0xc8)['json']({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4539c4[_0xf80e('0x12')][_0xf80e('0x13')])});})[_0xf80e('0xd')](handleError(_0x2be415,null,_0xf80e('0x19')));}; \ No newline at end of file +var _0x5314=['name','send','index','getAllData','then','json','catch','status','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','kill','SIGINT','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x1f0639,_0x306cfb){var _0x1080c2=function(_0x3d6490){while(--_0x3d6490){_0x1f0639['push'](_0x1f0639['shift']());}};_0x1080c2(++_0x306cfb);}(_0x5314,0xbf));var _0x4531=function(_0x590693,_0x2c047e){_0x590693=_0x590693-0x0;var _0x1757ce=_0x5314[_0x590693];return _0x1757ce;};'use strict';var info=require(_0x4531('0x0'));var exec=require(_0x4531('0x1'))[_0x4531('0x2')];var logger=require('../../config/logger')(_0x4531('0x3'));var util=require(_0x4531('0x4'));var BPromise=require(_0x4531('0x5'));var _=require(_0x4531('0x6'));function handleError(_0x1583c9,_0x1027cb,_0x453194){_0x1027cb=_0x1027cb||0x1f4;return function(_0x4072b5){logger[_0x4531('0x7')](_0x4531('0x8'),_0x453194,_0x1027cb,util['inspect'](_0x4072b5,{'showHidden':![],'depth':null}));delete _0x4072b5[_0x4531('0x9')];_0x1583c9['status'](_0x1027cb)[_0x4531('0xa')](_0x4072b5);};}exports[_0x4531('0xb')]=function(_0x1e628c,_0x2274ef){return info[_0x4531('0xc')]()[_0x4531('0xd')](function(_0x572ec2){return _0x2274ef['status'](0xc8)[_0x4531('0xe')](_0x572ec2);})[_0x4531('0xf')](function(_0x4770fa){return _0x2274ef[_0x4531('0x10')](0x1f4)[_0x4531('0xe')](_0x4770fa);});};exports['killProcess']=function(_0x5ec91e,_0x6aa090){var _0xe2cc73=['components/import/cm'];return new BPromise(function(_0x573796,_0x4ac260){return exec(util[_0x4531('0x11')](_0x4531('0x12'),_0x5ec91e[_0x4531('0x13')][_0x4531('0x14')]),function(_0x1b9456,_0x2f93e4,_0x30c428){if(_0x1b9456){return _0x4ac260(_0x1b9456);}return _0x573796(_0x2f93e4);});})[_0x4531('0xd')](function(_0x4bce55){var _0x1d5671=![];var _0x46696d=_0x4bce55['split'](/\n/);for(var _0x4e20cc=0x0,_0x4b45fe=_0xe2cc73[_0x4531('0x15')];_0x4e20cc<_0x4b45fe,_0x1d5671===![];_0x4e20cc+=0x1){if(_0x4bce55[_0x4531('0x16')](_0xe2cc73[_0x4e20cc])>=0x0){_0x1d5671=!![];}}if(!_0x1d5671){throw new Error(util[_0x4531('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5ec91e[_0x4531('0x13')]['pid']));}process[_0x4531('0x17')](_0x5ec91e[_0x4531('0x13')][_0x4531('0x14')],_0x4531('0x18'));return _0x6aa090[_0x4531('0x10')](0xc8)['json']({'message':util[_0x4531('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x5ec91e[_0x4531('0x13')]['pid'])});})[_0x4531('0xf')](handleError(_0x6aa090,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 322b101..b74ef3a 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 _0xdbcd=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create','delete','destroy'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0xdbcd,0x67));var _0xddbc=function(_0x4a884c,_0x150644){_0x4a884c=_0x4a884c-0x0;var _0x17ba1c=_0xdbcd[_0x4a884c];return _0x17ba1c;};'use strict';var multer=require('multer');var util=require(_0xddbc('0x0'));var path=require(_0xddbc('0x1'));var timeout=require(_0xddbc('0x2'));var express=require('express');var router=express[_0xddbc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xddbc('0x4'));var interaction=require(_0xddbc('0x5'));var config=require(_0xddbc('0x6'));var controller=require(_0xddbc('0x7'));router[_0xddbc('0x8')]('/',auth[_0xddbc('0x9')](),controller['index']);router[_0xddbc('0x8')](_0xddbc('0xa'),auth['isAuthenticated'](),controller[_0xddbc('0xb')]);router[_0xddbc('0xc')]('/',auth[_0xddbc('0x9')](),controller[_0xddbc('0xd')]);router['put']('/:id',auth[_0xddbc('0x9')](),controller['update']);router[_0xddbc('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xddbc('0xf')]);module[_0xddbc('0x10')]=router; \ No newline at end of file +var _0xa745=['update','delete','/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0xa745,0x1b9));var _0x5a74=function(_0x29adec,_0x44ea26){_0x29adec=_0x29adec-0x0;var _0x2f87ed=_0xa745[_0x29adec];return _0x2f87ed;};'use strict';var multer=require(_0x5a74('0x0'));var util=require(_0x5a74('0x1'));var path=require(_0x5a74('0x2'));var timeout=require(_0x5a74('0x3'));var express=require('express');var router=express[_0x5a74('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5a74('0x5'));var interaction=require(_0x5a74('0x6'));var config=require('../../config/environment');var controller=require(_0x5a74('0x7'));router[_0x5a74('0x8')]('/',auth[_0x5a74('0x9')](),controller[_0x5a74('0xa')]);router['get']('/:id',auth[_0x5a74('0x9')](),controller[_0x5a74('0xb')]);router[_0x5a74('0xc')]('/',auth['isAuthenticated'](),controller[_0x5a74('0xd')]);router[_0x5a74('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5a74('0xf')]);router[_0x5a74('0x10')](_0x5a74('0x11'),auth[_0x5a74('0x9')](),controller['destroy']);module[_0x5a74('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 734ae6f..fa5f471 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 _0xb9a7=['exports','#0091EA'];(function(_0x36aa9b,_0x3cc441){var _0x2d4825=function(_0x2b3d10){while(--_0x2b3d10){_0x36aa9b['push'](_0x36aa9b['shift']());}};_0x2d4825(++_0x3cc441);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xb9a7[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x7b9a('0x1')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc23d=['name','#0091EA','sequelize','exports','STRING'];(function(_0x46e724,_0x5b5a67){var _0x54f52c=function(_0x1f0703){while(--_0x1f0703){_0x46e724['push'](_0x46e724['shift']());}};_0x54f52c(++_0x5b5a67);}(_0xc23d,0x7f));var _0xdc23=function(_0x3557d0,_0x39f204){_0x3557d0=_0x3557d0-0x0;var _0x38d56c=_0xc23d[_0x3557d0];return _0x38d56c;};'use strict';var Sequelize=require(_0xdc23('0x0'));module[_0xdc23('0x1')]={'name':{'type':Sequelize[_0xdc23('0x2')],'unique':_0xdc23('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xdc23('0x2')],'defaultValue':_0xdc23('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 8d0c0cc..481cac3 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Tags','UserProfileResource','destroy','error','stack','name','send','index','map','Tag','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0xc88ec5,_0x1a52fe){var _0x229d5e=function(_0x58d101){while(--_0x58d101){_0xc88ec5['push'](_0xc88ec5['shift']());}};_0x229d5e(++_0x1a52fe);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2ab31c,_0x586896){_0x2ab31c=_0x2ab31c-0x0;var _0x2d86e6=_0xe5b3[_0x2ab31c];return _0x2d86e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['Tag'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['Tag'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['Tag'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0x5ff3=['params','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','Tag','include','findAll','catch','show','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3ccf89,_0xd885ac){_0x3ccf89=_0x3ccf89-0x0;var _0x37c651=_0x5ff3[_0x3ccf89];return _0x37c651;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35ff('0x1'));var rp=require('request-promise');var moment=require(_0x35ff('0x2'));var BPromise=require(_0x35ff('0x3'));var Mustache=require(_0x35ff('0x4'));var util=require(_0x35ff('0x5'));var path=require('path');var sox=require(_0x35ff('0x6'));var csv=require(_0x35ff('0x7'));var ejs=require(_0x35ff('0x8'));var fs=require('fs');var fs_extra=require(_0x35ff('0x9'));var _=require(_0x35ff('0xa'));var squel=require('squel');var crypto=require(_0x35ff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x35ff('0xc'));var toCsv=require(_0x35ff('0x7'));var querystring=require(_0x35ff('0xd'));var Papa=require('papaparse');var Redis=require(_0x35ff('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x35ff('0xf'));var as=require(_0x35ff('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x35ff('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x35ff('0x12'))['db'];function respondWithStatusCode(_0x3c5f4b,_0x5bda40){_0x5bda40=_0x5bda40||0xcc;return function(_0x842930){if(_0x842930){return _0x3c5f4b['sendStatus'](_0x5bda40);}return _0x3c5f4b[_0x35ff('0x13')](_0x5bda40)[_0x35ff('0x14')]();};}function respondWithResult(_0x3db454,_0x4d1d41){_0x4d1d41=_0x4d1d41||0xc8;return function(_0xff8ac){if(_0xff8ac){return _0x3db454[_0x35ff('0x13')](_0x4d1d41)[_0x35ff('0x15')](_0xff8ac);}};}function respondWithFilteredResult(_0x3e24dd,_0x438199){return function(_0x3dff65){if(_0x3dff65){var _0x2d4a88=typeof _0x438199[_0x35ff('0x16')]===_0x35ff('0x17')&&typeof _0x438199[_0x35ff('0x18')]===_0x35ff('0x17');var _0x3430e2=_0x3dff65[_0x35ff('0x19')];var _0x16c803=_0x2d4a88?0x0:_0x438199[_0x35ff('0x16')];var _0x5f470e=_0x2d4a88?_0x3dff65[_0x35ff('0x19')]:_0x438199[_0x35ff('0x16')]+_0x438199[_0x35ff('0x18')];var _0x1c0d8c;if(_0x5f470e>=_0x3430e2){_0x5f470e=_0x3430e2;_0x1c0d8c=0xc8;}else{_0x1c0d8c=0xce;}_0x3e24dd['status'](_0x1c0d8c);return _0x3e24dd['set'](_0x35ff('0x1a'),_0x16c803+'-'+_0x5f470e+'/'+_0x3430e2)[_0x35ff('0x15')](_0x3dff65);}return null;};}function patchUpdates(_0x4c8dd4){return function(_0x238f65){try{jsonpatch[_0x35ff('0x1b')](_0x238f65,_0x4c8dd4,!![]);}catch(_0x3a87bc){return BPromise[_0x35ff('0x1c')](_0x3a87bc);}return _0x238f65['save']();};}function saveUpdates(_0x3d60b4,_0x55274b){return function(_0x7cc20a){if(_0x7cc20a){return _0x7cc20a[_0x35ff('0x1d')](_0x3d60b4)[_0x35ff('0x1e')](function(_0x16a5a0){return _0x16a5a0;});}return null;};}function removeEntity(_0x396cc2,_0x2b3782){return function(_0x347cec){if(_0x347cec){return _0x347cec['destroy']()[_0x35ff('0x1e')](function(){var _0x2ffcb=_0x347cec['get']({'plain':!![]});var _0x426e4e='Tags';return db['UserProfileResource'][_0x35ff('0x1f')]({'where':{'type':_0x426e4e,'resourceId':_0x2ffcb['id']}})[_0x35ff('0x1e')](function(){return _0x347cec;});})[_0x35ff('0x1e')](function(){_0x396cc2[_0x35ff('0x13')](0xcc)[_0x35ff('0x14')]();});}};}function handleEntityNotFound(_0x546ec0,_0x2bdba4){return function(_0x412873){if(!_0x412873){_0x546ec0[_0x35ff('0x20')](0x194);}return _0x412873;};}function handleError(_0x5e191b,_0x3357a){_0x3357a=_0x3357a||0x1f4;return function(_0x1f51c5){logger[_0x35ff('0x21')](_0x1f51c5[_0x35ff('0x22')]);if(_0x1f51c5[_0x35ff('0x23')]){delete _0x1f51c5[_0x35ff('0x23')];}_0x5e191b[_0x35ff('0x13')](_0x3357a)[_0x35ff('0x24')](_0x1f51c5);};}exports[_0x35ff('0x25')]=function(_0x47d8fa,_0x3f9440){var _0x57339d={},_0x1cb370={},_0x257501={'count':0x0,'rows':[]};var _0x2bc118=_[_0x35ff('0x26')](db['Tag'][_0x35ff('0x27')],function(_0x5de349){return{'name':_0x5de349[_0x35ff('0x28')],'type':_0x5de349[_0x35ff('0x29')]['key']};});_0x1cb370['model']=_[_0x35ff('0x26')](_0x2bc118,_0x35ff('0x23'));_0x1cb370['query']=_[_0x35ff('0x2a')](_0x47d8fa[_0x35ff('0x2b')]);_0x1cb370['filters']=_[_0x35ff('0x2c')](_0x1cb370[_0x35ff('0x2d')],_0x1cb370[_0x35ff('0x2b')]);_0x57339d[_0x35ff('0x2e')]=_[_0x35ff('0x2c')](_0x1cb370[_0x35ff('0x2d')],qs[_0x35ff('0x2f')](_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x2f')]));_0x57339d[_0x35ff('0x2e')]=_0x57339d[_0x35ff('0x2e')][_0x35ff('0x30')]?_0x57339d[_0x35ff('0x2e')]:_0x1cb370['model'];if(!_0x47d8fa[_0x35ff('0x2b')]['hasOwnProperty'](_0x35ff('0x31'))){_0x57339d[_0x35ff('0x18')]=qs[_0x35ff('0x18')](_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x18')]);_0x57339d['offset']=qs[_0x35ff('0x16')](_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x16')]);}_0x57339d[_0x35ff('0x32')]=qs[_0x35ff('0x33')](_0x47d8fa['query'][_0x35ff('0x33')]);_0x57339d[_0x35ff('0x34')]=qs[_0x35ff('0x35')](_['pick'](_0x47d8fa['query'],_0x1cb370[_0x35ff('0x35')]),_0x2bc118);if(_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x36')]){_0x57339d[_0x35ff('0x34')]=_[_0x35ff('0x37')](_0x57339d[_0x35ff('0x34')],{'$or':_[_0x35ff('0x26')](_0x2bc118,function(_0x368f7c){if(_0x368f7c['type']!=='VIRTUAL'){var _0x550c09={};_0x550c09[_0x368f7c[_0x35ff('0x23')]]={'$like':'%'+_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x36')]+'%'};return _0x550c09;}})});}_0x57339d=_[_0x35ff('0x37')]({},_0x57339d,_0x47d8fa[_0x35ff('0x38')]);var _0x59c398={'where':_0x57339d[_0x35ff('0x34')]};return db[_0x35ff('0x39')][_0x35ff('0x19')](_0x59c398)[_0x35ff('0x1e')](function(_0x117ee6){_0x257501[_0x35ff('0x19')]=_0x117ee6;if(_0x47d8fa['query']['includeAll']){_0x57339d[_0x35ff('0x3a')]=[{'all':!![]}];}return db[_0x35ff('0x39')][_0x35ff('0x3b')](_0x57339d);})[_0x35ff('0x1e')](function(_0x4b1e3e){_0x257501['rows']=_0x4b1e3e;return _0x257501;})[_0x35ff('0x1e')](respondWithFilteredResult(_0x3f9440,_0x57339d))[_0x35ff('0x3c')](handleError(_0x3f9440,null));};exports[_0x35ff('0x3d')]=function(_0x1cd2c8,_0xb1f6ca){var _0x2ff794={'raw':!![],'where':{'id':_0x1cd2c8['params']['id']}},_0x346758={};_0x346758['model']=_[_0x35ff('0x2a')](db[_0x35ff('0x39')][_0x35ff('0x27')]);_0x346758['query']=_[_0x35ff('0x2a')](_0x1cd2c8[_0x35ff('0x2b')]);_0x346758['filters']=_['intersection'](_0x346758[_0x35ff('0x2d')],_0x346758['query']);_0x2ff794[_0x35ff('0x2e')]=_[_0x35ff('0x2c')](_0x346758['model'],qs[_0x35ff('0x2f')](_0x1cd2c8['query']['fields']));_0x2ff794[_0x35ff('0x2e')]=_0x2ff794[_0x35ff('0x2e')][_0x35ff('0x30')]?_0x2ff794[_0x35ff('0x2e')]:_0x346758[_0x35ff('0x2d')];if(_0x1cd2c8[_0x35ff('0x2b')][_0x35ff('0x3e')]){_0x2ff794[_0x35ff('0x3a')]=[{'all':!![]}];}_0x2ff794=_[_0x35ff('0x37')]({},_0x2ff794,_0x1cd2c8[_0x35ff('0x38')]);return db[_0x35ff('0x39')][_0x35ff('0x3f')](_0x2ff794)['then'](handleEntityNotFound(_0xb1f6ca,null))[_0x35ff('0x1e')](respondWithResult(_0xb1f6ca,null))[_0x35ff('0x3c')](handleError(_0xb1f6ca,null));};exports[_0x35ff('0x40')]=function(_0x2d26e2,_0x506def){return db['Tag'][_0x35ff('0x40')](_0x2d26e2['body'],{})[_0x35ff('0x1e')](function(_0x2caefe){var _0x14aa90=_0x2d26e2[_0x35ff('0x41')][_0x35ff('0x42')]({'plain':!![]});if(!_0x14aa90)throw new Error(_0x35ff('0x43'));if(_0x14aa90[_0x35ff('0x44')]===_0x35ff('0x41')){var _0x3be5fc=_0x2caefe['get']({'plain':!![]});var _0x48e22b=_0x35ff('0x45');return db['UserProfileSection'][_0x35ff('0x3f')]({'where':{'name':_0x48e22b,'userProfileId':_0x14aa90[_0x35ff('0x46')]},'raw':!![]})[_0x35ff('0x1e')](function(_0x255bdc){if(_0x255bdc&&_0x255bdc[_0x35ff('0x47')]===0x0){return db[_0x35ff('0x48')][_0x35ff('0x40')]({'name':_0x3be5fc[_0x35ff('0x23')],'resourceId':_0x3be5fc['id'],'type':_0x255bdc[_0x35ff('0x23')],'sectionId':_0x255bdc['id']},{})['then'](function(){return _0x2caefe;});}else{return _0x2caefe;}})[_0x35ff('0x3c')](function(_0x39b65f){logger[_0x35ff('0x21')](_0x35ff('0x49'),_0x39b65f);throw _0x39b65f;});}return _0x2caefe;})['then'](respondWithResult(_0x506def,0xc9))['catch'](handleError(_0x506def,null));};exports['update']=function(_0x211bb2,_0x5b410d){if(_0x211bb2[_0x35ff('0x4a')]['id']){delete _0x211bb2['body']['id'];}return db[_0x35ff('0x39')]['find']({'where':{'id':_0x211bb2[_0x35ff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b410d,null))[_0x35ff('0x1e')](saveUpdates(_0x211bb2[_0x35ff('0x4a')],null))[_0x35ff('0x1e')](respondWithResult(_0x5b410d,null))[_0x35ff('0x3c')](handleError(_0x5b410d,null));};exports['destroy']=function(_0x497b38,_0x2be86b){return db['Tag'][_0x35ff('0x3f')]({'where':{'id':_0x497b38[_0x35ff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2be86b,null))[_0x35ff('0x1e')](removeEntity(_0x2be86b,null))['catch'](handleError(_0x2be86b,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index bfc0b31..c22c8a5 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 _0x75fd=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash'];(function(_0x10bf2a,_0x242442){var _0x1a6127=function(_0x48a7c9){while(--_0x48a7c9){_0x10bf2a['push'](_0x10bf2a['shift']());}};_0x1a6127(++_0x242442);}(_0x75fd,0x197));var _0xd75f=function(_0x4befbc,_0x4b4ff9){_0x4befbc=_0x4befbc-0x0;var _0x58bdad=_0x75fd[_0x4befbc];return _0x58bdad;};'use strict';var _=require(_0xd75f('0x0'));var util=require('util');var logger=require(_0xd75f('0x1'))(_0xd75f('0x2'));var moment=require('moment');var BPromise=require(_0xd75f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd75f('0x4'));var rimraf=require(_0xd75f('0x5'));var config=require(_0xd75f('0x6'));var attributes=require(_0xd75f('0x7'));module[_0xd75f('0x8')]=function(_0x16776b,_0x5b96b0){return _0x16776b[_0xd75f('0x9')](_0xd75f('0xa'),attributes,{'tableName':_0xd75f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6910=['./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x578c02,_0x215428){var _0x5dfa9e=function(_0x4737b1){while(--_0x4737b1){_0x578c02['push'](_0x578c02['shift']());}};_0x5dfa9e(++_0x215428);}(_0x6910,0x157));var _0x0691=function(_0x5172a3,_0x1a1e39){_0x5172a3=_0x5172a3-0x0;var _0x50c69b=_0x6910[_0x5172a3];return _0x50c69b;};'use strict';var _=require(_0x0691('0x0'));var util=require(_0x0691('0x1'));var logger=require(_0x0691('0x2'))(_0x0691('0x3'));var moment=require(_0x0691('0x4'));var BPromise=require(_0x0691('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0691('0x6'));var rimraf=require('rimraf');var config=require(_0x0691('0x7'));var attributes=require(_0x0691('0x8'));module[_0x0691('0x9')]=function(_0x2143dd,_0x19db1b){return _0x2143dd[_0x0691('0xa')](_0x0691('0xb'),attributes,{'tableName':_0x0691('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 9486617..c19295d 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 _0xb205=['../../config/environment','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xb205,0xf0));var _0x5b20=function(_0x2b1ebf,_0x3bd1ad){_0x2b1ebf=_0x2b1ebf-0x0;var _0x5e3742=_0xb205[_0x2b1ebf];return _0x5e3742;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var moment=require(_0x5b20('0x2'));var BPromise=require(_0x5b20('0x3'));var rs=require(_0x5b20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b20('0x5'));var logger=require('../../config/logger')(_0x5b20('0x6'));var config=require(_0x5b20('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b20('0x8')][_0x5b20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x364e48,_0x5c1ff9,_0x32b467){return new BPromise(function(_0x13fb27,_0x528c54){return client['request'](_0x364e48,_0x32b467)[_0x5b20('0xa')](function(_0xb77426){logger[_0x5b20('0xb')](_0x5b20('0xc'),_0x5c1ff9,_0x5b20('0xd'));logger[_0x5b20('0xe')](_0x5b20('0xf'),_0x5c1ff9,'request\x20sent',JSON[_0x5b20('0x10')](_0xb77426));if(_0xb77426[_0x5b20('0x11')]){if(_0xb77426[_0x5b20('0x11')]['code']===0x1f4){logger['error'](_0x5b20('0xc'),_0x5c1ff9,_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);return _0x528c54(_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);}logger['error'](_0x5b20('0xc'),_0x5c1ff9,_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);return _0x13fb27(_0xb77426[_0x5b20('0x11')]['message']);}else{logger['info'](_0x5b20('0xc'),_0x5c1ff9,'request\x20sent');_0x13fb27(_0xb77426['result'][_0x5b20('0x12')]);}})['catch'](function(_0x43b7b0){logger[_0x5b20('0x11')](_0x5b20('0xc'),_0x5c1ff9,_0x43b7b0);_0x528c54(_0x43b7b0);});});} \ No newline at end of file +var _0xac95=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','Tag,\x20%s,\x20%s','message','result','catch'];(function(_0x2bacc6,_0x58fa6d){var _0x2ab31a=function(_0x119cf5){while(--_0x119cf5){_0x2bacc6['push'](_0x2bacc6['shift']());}};_0x2ab31a(++_0x58fa6d);}(_0xac95,0xa8));var _0x5ac9=function(_0x210a80,_0x1a4a06){_0x210a80=_0x210a80-0x0;var _0x17f7e0=_0xac95[_0x210a80];return _0x17f7e0;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var moment=require(_0x5ac9('0x2'));var BPromise=require(_0x5ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ac9('0x4'))['db'];var utils=require(_0x5ac9('0x5'));var logger=require('../../config/logger')(_0x5ac9('0x6'));var config=require(_0x5ac9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ac9('0x8')][_0x5ac9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8675ec,_0x4bddcf,_0x4dffb8){return new BPromise(function(_0x32afbc,_0x2ab11c){return client[_0x5ac9('0xa')](_0x8675ec,_0x4dffb8)[_0x5ac9('0xb')](function(_0x397bb8){logger[_0x5ac9('0xc')]('Tag,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'));logger[_0x5ac9('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'),JSON['stringify'](_0x397bb8));if(_0x397bb8[_0x5ac9('0xf')]){if(_0x397bb8['error'][_0x5ac9('0x10')]===0x1f4){logger[_0x5ac9('0xf')](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x2ab11c(_0x397bb8['error'][_0x5ac9('0x12')]);}logger['error'](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x32afbc(_0x397bb8[_0x5ac9('0xf')][_0x5ac9('0x12')]);}else{logger[_0x5ac9('0xc')](_0x5ac9('0x11'),_0x4bddcf,_0x5ac9('0xd'));_0x32afbc(_0x397bb8[_0x5ac9('0x13')][_0x5ac9('0x12')]);}})[_0x5ac9('0x14')](function(_0x460fd7){logger['error']('Tag,\x20%s,\x20%s',_0x4bddcf,_0x460fd7);_0x2ab11c(_0x460fd7);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index fedde7f..ef6ec6a 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 125a133..d17589f 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 _0x757a=['exports','STRING'];(function(_0xcd001d,_0x4529e0){var _0x4a79a1=function(_0x1702da){while(--_0x1702da){_0xcd001d['push'](_0xcd001d['shift']());}};_0x4a79a1(++_0x4529e0);}(_0x757a,0xde));var _0xa757=function(_0x2d4c63,_0x434522){_0x2d4c63=_0x2d4c63-0x0;var _0x46dad3=_0x757a[_0x2d4c63];return _0x46dad3;};'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 +var _0xbaf0=['name','exports','STRING'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 bbf3a11..5d18891 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 _0x4069=['redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','name','send','index','map','Team','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','transaction','sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','end','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','toLowerCase','sort','capitalize','Queues','addQueues','ValidationError','add','ids','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','QueueId','defaults','TeamVoiceQueue','findOrCreate','Queue:save','User','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','spread','removeAgents','isArray','Whatsapp','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1b9124,_0x563548){var _0x128a98=function(_0xf219b){while(--_0xf219b){_0x1b9124['push'](_0x1b9124['shift']());}};_0x128a98(++_0x563548);}(_0x4069,0x1ba));var _0x9406=function(_0x1159e2,_0x20baf7){_0x1159e2=_0x1159e2-0x0;var _0x58d938=_0x4069[_0x1159e2];return _0x58d938;};'use strict';var emlformat=require(_0x9406('0x0'));var rimraf=require(_0x9406('0x1'));var zipdir=require(_0x9406('0x2'));var jsonpatch=require(_0x9406('0x3'));var rp=require(_0x9406('0x4'));var moment=require('moment');var BPromise=require(_0x9406('0x5'));var Mustache=require(_0x9406('0x6'));var util=require(_0x9406('0x7'));var path=require(_0x9406('0x8'));var sox=require(_0x9406('0x9'));var csv=require('to-csv');var ejs=require(_0x9406('0xa'));var fs=require('fs');var fs_extra=require(_0x9406('0xb'));var _=require(_0x9406('0xc'));var squel=require(_0x9406('0xd'));var crypto=require(_0x9406('0xe'));var jsforce=require(_0x9406('0xf'));var deskjs=require(_0x9406('0x10'));var toCsv=require(_0x9406('0x11'));var querystring=require(_0x9406('0x12'));var Papa=require(_0x9406('0x13'));var Redis=require(_0x9406('0x14'));var authService=require(_0x9406('0x15'));var qs=require(_0x9406('0x16'));var as=require(_0x9406('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9406('0x18'))(_0x9406('0x19'));var utils=require(_0x9406('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x9406('0x1b'));var db=require(_0x9406('0x1c'))['db'];config[_0x9406('0x1d')]=_['defaults'](config[_0x9406('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x9406('0x1e'))(new Redis(config[_0x9406('0x1d')]));require('./team.socket')[_0x9406('0x1f')](socket);function respondWithStatusCode(_0x171202,_0x1a56e1){_0x1a56e1=_0x1a56e1||0xcc;return function(_0x391027){if(_0x391027){return _0x171202[_0x9406('0x20')](_0x1a56e1);}return _0x171202[_0x9406('0x21')](_0x1a56e1)['end']();};}function respondWithResult(_0x385445,_0x4d03cd){_0x4d03cd=_0x4d03cd||0xc8;return function(_0x4c5961){if(_0x4c5961){return _0x385445[_0x9406('0x21')](_0x4d03cd)[_0x9406('0x22')](_0x4c5961);}};}function respondWithFilteredResult(_0x13bc38,_0x326c03){return function(_0x28f480){if(_0x28f480){var _0x527813=typeof _0x326c03[_0x9406('0x23')]===_0x9406('0x24')&&typeof _0x326c03['limit']===_0x9406('0x24');var _0x427be6=_0x28f480[_0x9406('0x25')];var _0x53d84b=_0x527813?0x0:_0x326c03[_0x9406('0x23')];var _0x5d0db8=_0x527813?_0x28f480[_0x9406('0x25')]:_0x326c03[_0x9406('0x23')]+_0x326c03[_0x9406('0x26')];var _0x30ae0c;if(_0x5d0db8>=_0x427be6){_0x5d0db8=_0x427be6;_0x30ae0c=0xc8;}else{_0x30ae0c=0xce;}_0x13bc38['status'](_0x30ae0c);return _0x13bc38[_0x9406('0x27')]('Content-Range',_0x53d84b+'-'+_0x5d0db8+'/'+_0x427be6)['json'](_0x28f480);}return null;};}function patchUpdates(_0xc5b561){return function(_0x420dbc){try{jsonpatch[_0x9406('0x28')](_0x420dbc,_0xc5b561,!![]);}catch(_0x2def62){return BPromise[_0x9406('0x29')](_0x2def62);}return _0x420dbc[_0x9406('0x2a')]();};}function saveUpdates(_0x139a11,_0x3bb8c0){return function(_0x583f27){if(_0x583f27){return _0x583f27[_0x9406('0x2b')](_0x139a11)['then'](function(_0x2bfbe6){return _0x2bfbe6;});}return null;};}function handleEntityNotFound(_0x216fc5,_0xb5654e){return function(_0x22b3f0){if(!_0x22b3f0){_0x216fc5['sendStatus'](0x194);}return _0x22b3f0;};}function handleError(_0x43129d,_0x3df8a0){_0x3df8a0=_0x3df8a0||0x1f4;return function(_0x373829){logger['error'](_0x373829['stack']);if(_0x373829[_0x9406('0x2c')]){delete _0x373829['name'];}_0x43129d[_0x9406('0x21')](_0x3df8a0)[_0x9406('0x2d')](_0x373829);};}exports[_0x9406('0x2e')]=function(_0x592e83,_0x31717c){var _0x458674={},_0x3d1013={},_0x365dfc={'count':0x0,'rows':[]};var _0x120f8f=_[_0x9406('0x2f')](db[_0x9406('0x30')][_0x9406('0x31')],function(_0x4c913d){return{'name':_0x4c913d['fieldName'],'type':_0x4c913d[_0x9406('0x32')][_0x9406('0x33')]};});_0x3d1013[_0x9406('0x34')]=_['map'](_0x120f8f,_0x9406('0x2c'));_0x3d1013[_0x9406('0x35')]=_[_0x9406('0x36')](_0x592e83[_0x9406('0x35')]);_0x3d1013[_0x9406('0x37')]=_[_0x9406('0x38')](_0x3d1013[_0x9406('0x34')],_0x3d1013['query']);_0x458674[_0x9406('0x39')]=_[_0x9406('0x38')](_0x3d1013[_0x9406('0x34')],qs[_0x9406('0x3a')](_0x592e83[_0x9406('0x35')][_0x9406('0x3a')]));_0x458674[_0x9406('0x39')]=_0x458674[_0x9406('0x39')][_0x9406('0x3b')]?_0x458674['attributes']:_0x3d1013[_0x9406('0x34')];if(!_0x592e83['query'][_0x9406('0x3c')](_0x9406('0x3d'))){_0x458674['limit']=qs['limit'](_0x592e83[_0x9406('0x35')]['limit']);_0x458674[_0x9406('0x23')]=qs[_0x9406('0x23')](_0x592e83[_0x9406('0x35')]['offset']);}_0x458674[_0x9406('0x3e')]=qs['sort'](_0x592e83[_0x9406('0x35')]['sort']);_0x458674[_0x9406('0x3f')]=qs['filters'](_[_0x9406('0x40')](_0x592e83[_0x9406('0x35')],_0x3d1013[_0x9406('0x37')]),_0x120f8f);if(_0x592e83[_0x9406('0x35')][_0x9406('0x41')]){_0x458674[_0x9406('0x3f')]=_[_0x9406('0x42')](_0x458674[_0x9406('0x3f')],{'$or':_[_0x9406('0x2f')](_0x120f8f,function(_0x30d720){if(_0x30d720[_0x9406('0x32')]!==_0x9406('0x43')){var _0x2a73ac={};_0x2a73ac[_0x30d720['name']]={'$like':'%'+_0x592e83[_0x9406('0x35')][_0x9406('0x41')]+'%'};return _0x2a73ac;}})});}_0x458674=_[_0x9406('0x42')]({},_0x458674,_0x592e83['options']);var _0x116de2={'where':_0x458674[_0x9406('0x3f')]};return db[_0x9406('0x30')][_0x9406('0x25')](_0x116de2)[_0x9406('0x44')](function(_0x53f5ea){_0x365dfc[_0x9406('0x25')]=_0x53f5ea;if(_0x592e83[_0x9406('0x35')][_0x9406('0x45')]){_0x458674[_0x9406('0x46')]=[{'all':!![]}];}return db[_0x9406('0x30')][_0x9406('0x47')](_0x458674);})[_0x9406('0x44')](function(_0x5ad8a8){_0x365dfc[_0x9406('0x48')]=_0x5ad8a8;return _0x365dfc;})[_0x9406('0x44')](respondWithFilteredResult(_0x31717c,_0x458674))[_0x9406('0x49')](handleError(_0x31717c,null));};exports[_0x9406('0x4a')]=function(_0x2e6667,_0x405605){var _0x35739c={'raw':![],'where':{'id':_0x2e6667['params']['id']}},_0x144692={};_0x144692[_0x9406('0x34')]=_[_0x9406('0x36')](db['Team'][_0x9406('0x31')]);_0x144692[_0x9406('0x35')]=_[_0x9406('0x36')](_0x2e6667['query']);_0x144692[_0x9406('0x37')]=_['intersection'](_0x144692['model'],_0x144692[_0x9406('0x35')]);_0x35739c['attributes']=_['intersection'](_0x144692[_0x9406('0x34')],qs[_0x9406('0x3a')](_0x2e6667['query'][_0x9406('0x3a')]));_0x35739c[_0x9406('0x39')]=_0x35739c[_0x9406('0x39')][_0x9406('0x3b')]?_0x35739c[_0x9406('0x39')]:_0x144692[_0x9406('0x34')];if(_0x2e6667['query'][_0x9406('0x45')]){_0x35739c[_0x9406('0x46')]=[{'all':!![]}];}_0x35739c=_[_0x9406('0x42')]({},_0x35739c,_0x2e6667[_0x9406('0x4b')]);return db[_0x9406('0x30')][_0x9406('0x4c')](_0x35739c)['then'](handleEntityNotFound(_0x405605,null))[_0x9406('0x44')](respondWithResult(_0x405605,null))[_0x9406('0x49')](handleError(_0x405605,null));};exports['create']=function(_0x3db0af,_0x32cff8){return db[_0x9406('0x30')][_0x9406('0x4d')](_0x3db0af[_0x9406('0x4e')],{})[_0x9406('0x44')](function(_0x5ad579){var _0x23c663=_0x3db0af[_0x9406('0x4f')][_0x9406('0x50')]({'plain':!![]});if(!_0x23c663)throw new Error(_0x9406('0x51'));if(_0x23c663[_0x9406('0x52')]===_0x9406('0x4f')){var _0x314adc=_0x5ad579[_0x9406('0x50')]({'plain':!![]});var _0x1cdfd9='Teams';return db['UserProfileSection'][_0x9406('0x4c')]({'where':{'name':_0x1cdfd9,'userProfileId':_0x23c663[_0x9406('0x53')]},'raw':!![]})['then'](function(_0x2718e9){if(_0x2718e9&&_0x2718e9[_0x9406('0x54')]===0x0){return db['UserProfileResource'][_0x9406('0x4d')]({'name':_0x314adc['name'],'resourceId':_0x314adc['id'],'type':_0x2718e9['name'],'sectionId':_0x2718e9['id']},{})[_0x9406('0x44')](function(){return _0x5ad579;});}else{return _0x5ad579;}})[_0x9406('0x49')](function(_0x1247a7){logger[_0x9406('0x55')](_0x9406('0x56'),_0x1247a7);throw _0x1247a7;});}return _0x5ad579;})[_0x9406('0x44')](respondWithResult(_0x32cff8,0xc9))[_0x9406('0x49')](handleError(_0x32cff8,null));};exports[_0x9406('0x2b')]=function(_0x228750,_0x390c17){if(_0x228750[_0x9406('0x4e')]['id']){delete _0x228750[_0x9406('0x4e')]['id'];}return db[_0x9406('0x30')][_0x9406('0x4c')]({'where':{'id':_0x228750[_0x9406('0x57')]['id']}})[_0x9406('0x44')](handleEntityNotFound(_0x390c17,null))[_0x9406('0x44')](saveUpdates(_0x228750['body'],null))['then'](respondWithResult(_0x390c17,null))[_0x9406('0x49')](handleError(_0x390c17,null));};exports[_0x9406('0x58')]=function(_0x137ed9,_0x52992f){var _0xb69d1e=_0x137ed9[_0x9406('0x57')]['id'];var _0x23a04f=[];return db['sequelize'][_0x9406('0x59')](function(_0x4e7185){var _0x1704d5='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0xb69d1e;return db[_0x9406('0x5a')][_0x9406('0x35')](_0x1704d5,{'type':db['Sequelize'][_0x9406('0x5b')][_0x9406('0x5c')],'raw':!![],'transaction':_0x4e7185})[_0x9406('0x44')](function(_0x53ccae){_0x23a04f=_[_0x9406('0x2f')](_0x53ccae,function(_0x1cad48){return Number(_0x1cad48['UserId']);});})[_0x9406('0x44')](function(){var _0x31b68d=_0x9406('0x5d')+_0xb69d1e;return db[_0x9406('0x5a')][_0x9406('0x35')](_0x31b68d,{'type':db[_0x9406('0x5e')][_0x9406('0x5b')]['SELECT'],'raw':!![],'transaction':_0x4e7185});})[_0x9406('0x44')](function(_0x112a47){var _0x332b06=_[_0x9406('0x2f')](_0x112a47,function(_0x569ea0){return Number(_0x569ea0[_0x9406('0x5f')]);});return db['UserVoiceQueue'][_0x9406('0x58')]({'where':{'UserId':{'$in':_0x23a04f},'VoiceQueueId':{'$in':_0x332b06}},'transaction':_0x4e7185});})[_0x9406('0x44')](function(){var _0xfeec83=_0x9406('0x60')+_0xb69d1e;return db['sequelize'][_0x9406('0x35')](_0xfeec83,{'type':db[_0x9406('0x5e')][_0x9406('0x5b')][_0x9406('0x5c')],'raw':!![],'transaction':_0x4e7185});})[_0x9406('0x44')](function(_0x36b7cf){var _0x24ffc5=_[_0x9406('0x2f')](_0x36b7cf,function(_0x4ba6c7){return Number(_0x4ba6c7[_0x9406('0x61')]);});return db['UserMailQueue'][_0x9406('0x58')]({'where':{'UserId':{'$in':_0x23a04f},'MailQueueId':{'$in':_0x24ffc5}},'transaction':_0x4e7185});})[_0x9406('0x44')](function(){var _0x3c8a76='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xb69d1e;return db[_0x9406('0x5a')][_0x9406('0x35')](_0x3c8a76,{'type':db[_0x9406('0x5e')][_0x9406('0x5b')][_0x9406('0x5c')],'raw':!![],'transaction':_0x4e7185});})[_0x9406('0x44')](function(_0x2cd34b){var _0x14ebf4=_['map'](_0x2cd34b,function(_0x31f5dd){return Number(_0x31f5dd[_0x9406('0x62')]);});return db[_0x9406('0x63')][_0x9406('0x58')]({'where':{'UserId':{'$in':_0x23a04f},'SmsQueueId':{'$in':_0x14ebf4}},'transaction':_0x4e7185});})[_0x9406('0x44')](function(){var _0x29b484=_0x9406('0x64')+_0xb69d1e;return db[_0x9406('0x5a')][_0x9406('0x35')](_0x29b484,{'type':db[_0x9406('0x5e')][_0x9406('0x5b')]['SELECT'],'raw':!![],'transaction':_0x4e7185});})[_0x9406('0x44')](function(_0x1e31ae){var _0x4a8201=_[_0x9406('0x2f')](_0x1e31ae,function(_0x2c2c60){return Number(_0x2c2c60[_0x9406('0x65')]);});return db[_0x9406('0x66')][_0x9406('0x58')]({'where':{'UserId':{'$in':_0x23a04f},'ChatQueueId':{'$in':_0x4a8201}},'transaction':_0x4e7185});})[_0x9406('0x44')](function(){var _0xbd0fac='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0xb69d1e;return db[_0x9406('0x5a')][_0x9406('0x35')](_0xbd0fac,{'type':db[_0x9406('0x5e')]['QueryTypes'][_0x9406('0x5c')],'raw':!![],'transaction':_0x4e7185});})[_0x9406('0x44')](function(_0x34b160){var _0x4ba50d=_[_0x9406('0x2f')](_0x34b160,function(_0x239018){return Number(_0x239018[_0x9406('0x67')]);});return db[_0x9406('0x68')][_0x9406('0x58')]({'where':{'UserId':{'$in':_0x23a04f},'FaxQueueId':{'$in':_0x4ba50d}},'transaction':_0x4e7185});})['then'](function(){var _0x5430cd=_0x9406('0x69')+_0xb69d1e;return db[_0x9406('0x5a')][_0x9406('0x35')](_0x5430cd,{'type':db[_0x9406('0x5e')]['QueryTypes'][_0x9406('0x5c')],'raw':!![],'transaction':_0x4e7185});})[_0x9406('0x44')](function(_0x2e4fd6){var _0x4ac481=_[_0x9406('0x2f')](_0x2e4fd6,function(_0x42c00c){return Number(_0x42c00c[_0x9406('0x6a')]);});return db[_0x9406('0x6b')][_0x9406('0x58')]({'where':{'UserId':{'$in':_0x23a04f},'OpenchannelQueueId':{'$in':_0x4ac481}},'transaction':_0x4e7185});})[_0x9406('0x44')](function(){var _0x387724='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xb69d1e;return db[_0x9406('0x5a')][_0x9406('0x35')](_0x387724,{'type':db['Sequelize'][_0x9406('0x5b')][_0x9406('0x5c')],'raw':!![],'transaction':_0x4e7185});})[_0x9406('0x44')](function(_0x2732cc){var _0x46b9fc=_[_0x9406('0x2f')](_0x2732cc,function(_0x5105e5){return Number(_0x5105e5['WhatsappQueueId']);});return db[_0x9406('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x23a04f},'WhatsappQueueId':{'$in':_0x46b9fc}},'transaction':_0x4e7185});})[_0x9406('0x44')](function(){return db[_0x9406('0x6d')][_0x9406('0x4c')]({'where':{'TeamId':_0xb69d1e}});})[_0x9406('0x44')](function(_0x5a0aae){if(_0x5a0aae===null){return;}return db[_0x9406('0x6e')][_0x9406('0x58')]({'where':{'UserId':{'$in':_0x23a04f},'VoicePrefixId':_0x5a0aae[_0x9406('0x6f')]},'transaction':_0x4e7185});})['then'](function(){return db[_0x9406('0x30')][_0x9406('0x58')]({'where':{'id':_0xb69d1e},'cascade':!![],'transaction':_0x4e7185});})['then'](function(_0x1aa225){if(_0x1aa225===0x0){_0x52992f[_0x9406('0x20')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':_0x9406('0x70'),'resourceId':_0xb69d1e},'cascade':!![],'transaction':_0x4e7185})[_0x9406('0x44')](function(){_0x52992f[_0x9406('0x21')](0xcc)[_0x9406('0x71')]();});}})[_0x9406('0x49')](function(_0x5ec856){_0x52992f[_0x9406('0x21')](0x1f4)[_0x9406('0x2d')](_0x5ec856);});});};exports[_0x9406('0x72')]=function(_0x702c72,_0x353cc0,_0x58b521){return db[_0x9406('0x30')][_0x9406('0x73')]({'where':{'id':_0x702c72[_0x9406('0x57')]['id']}})[_0x9406('0x44')](handleEntityNotFound(_0x353cc0,null))[_0x9406('0x44')](function(_0xf69c96){if(!_0x702c72[_0x9406('0x35')][_0x9406('0x74')]||!utils[_0x9406('0x75')](_0x702c72['query'][_0x9406('0x74')])){throw new db[(_0x9406('0x5e'))]['ValidationError'](_0x9406('0x76'));}var _0x682e4f={};var _0x37a3d6={};_0x37a3d6[_0x9406('0x34')]=_[_0x9406('0x36')](db[_['capitalize'](_0x702c72[_0x9406('0x35')][_0x9406('0x74')][_0x9406('0x77')]())+'Queue'][_0x9406('0x31')]);_0x37a3d6['query']=_[_0x9406('0x36')](_0x702c72[_0x9406('0x35')]);_0x37a3d6[_0x9406('0x37')]=_[_0x9406('0x38')](_0x37a3d6['model'],_0x37a3d6[_0x9406('0x35')]);_0x682e4f[_0x9406('0x39')]=_[_0x9406('0x38')](_0x37a3d6[_0x9406('0x34')],qs[_0x9406('0x3a')](_0x702c72['query'][_0x9406('0x3a')]));_0x682e4f[_0x9406('0x39')]=_0x682e4f[_0x9406('0x39')][_0x9406('0x3b')]?_0x682e4f[_0x9406('0x39')]:_0x37a3d6[_0x9406('0x34')];_0x682e4f['limit']=qs[_0x9406('0x26')](_0x702c72[_0x9406('0x35')]['limit']);_0x682e4f['offset']=qs[_0x9406('0x23')](_0x702c72[_0x9406('0x35')][_0x9406('0x23')]);_0x682e4f[_0x9406('0x3e')]=qs['sort'](_0x702c72[_0x9406('0x35')][_0x9406('0x78')]);_0x682e4f[_0x9406('0x3f')]=qs[_0x9406('0x37')](_['pick'](_0x702c72[_0x9406('0x35')],_0x37a3d6['filters']));_0x682e4f=_['merge']({},_0x682e4f,_0x702c72['options']);return _0xf69c96[_0x9406('0x50')+_[_0x9406('0x79')](_0x702c72[_0x9406('0x35')][_0x9406('0x74')][_0x9406('0x77')]())+_0x9406('0x7a')](_0x682e4f);})['then'](respondWithResult(_0x353cc0,null))[_0x9406('0x49')](handleError(_0x353cc0,null));};exports[_0x9406('0x7b')]=function(_0x41b5b2,_0x564dfb,_0x5107b9){return db['Team']['findOne']({'where':{'id':_0x41b5b2[_0x9406('0x57')]['id']}})[_0x9406('0x44')](function(_0x1c506d){if(_0x1c506d){if(!_0x41b5b2[_0x9406('0x4e')]['channel']||!utils['isValidChannel'](_0x41b5b2['body'][_0x9406('0x74')])){throw new db[(_0x9406('0x5e'))][(_0x9406('0x7c'))](_0x9406('0x76'));}return _0x1c506d[_0x9406('0x7d')+_[_0x9406('0x79')](_0x41b5b2[_0x9406('0x4e')][_0x9406('0x74')][_0x9406('0x77')]())+'Queues'](_0x41b5b2[_0x9406('0x4e')][_0x9406('0x7e')]);}return null;})[_0x9406('0x44')](handleEntityNotFound(_0x564dfb,null))[_0x9406('0x44')](respondWithStatusCode(_0x564dfb,null))[_0x9406('0x49')](handleError(_0x564dfb,null));};exports['removeQueues']=function(_0xc296df,_0x43cea8,_0x2057a6){return db[_0x9406('0x30')]['findOne']({'where':{'id':_0xc296df[_0x9406('0x57')]['id']}})[_0x9406('0x44')](function(_0x1518ab){if(_0x1518ab){if(!_0xc296df[_0x9406('0x35')][_0x9406('0x74')]||!utils['isValidChannel'](_0xc296df['query']['channel'])){throw new db['Sequelize'][(_0x9406('0x7c'))](_0x9406('0x76'));}return _0x1518ab[_0x9406('0x7f')+_[_0x9406('0x79')](_0xc296df['query'][_0x9406('0x74')][_0x9406('0x77')]())+_0x9406('0x7a')](_0xc296df[_0x9406('0x35')]['ids']);}return null;})[_0x9406('0x44')](handleEntityNotFound(_0x43cea8,null))[_0x9406('0x44')](respondWithStatusCode(_0x43cea8,null))[_0x9406('0x49')](handleError(_0x43cea8,null));};exports[_0x9406('0x80')]=function(_0x508e6b,_0x46eefb){var _0x20bb9f=_['isArray'](_0x508e6b['body'][_0x9406('0x7e')])?_0x508e6b[_0x9406('0x4e')][_0x9406('0x7e')]:[_0x508e6b['body'][_0x9406('0x7e')]];var _0x59f6b0=_0x508e6b[_0x9406('0x57')]['id'];return db[_0x9406('0x30')][_0x9406('0x4c')]({'where':{'id':_0x59f6b0}})[_0x9406('0x44')](handleEntityNotFound(_0x46eefb,null))[_0x9406('0x44')](function(_0x43cab8){if(_0x43cab8){var _0x7e371f=[_0x9406('0x81'),_0x9406('0x82'),_0x9406('0x83'),_0x9406('0x84'),_0x9406('0x85'),_0x9406('0x86'),'Whatsapp'];return db[_0x9406('0x5a')][_0x9406('0x59')](function(_0x5b26ac){var _0xb132b7=_['map'](_0x7e371f,function(_0x4bf478){var _0x5b309a={'attributes':['id',_0x9406('0x2c')]};if(_0x4bf478==='Voice'){_0x5b309a[_0x9406('0x87')]={'attributes':[_0x9406('0x88')]};}return _0x43cab8[_0x9406('0x50')+_0x4bf478+_0x9406('0x7a')](_0x5b309a)[_0x9406('0x44')](function(_0x48ddc4){var _0x13bd53=_['map'](_0x48ddc4,function(_0x1c9bd3){var _0x20e88f=_[_0x9406('0x2f')](_0x20bb9f,function(_0x3b626b){var _0x5029be={'where':{'UserId':_0x3b626b,[_0x4bf478+_0x9406('0x89')]:_0x1c9bd3['id']},'transaction':_0x5b26ac};if(_0x4bf478===_0x9406('0x81')){_0x5029be[_0x9406('0x8a')]={'penalty':_0x1c9bd3[_0x9406('0x8b')][_0x9406('0x88')]};}return db['User'+_0x4bf478+'Queue'][_0x9406('0x8c')](_0x5029be)[_0x9406('0x44')](function(){socket['emit'](_0x9406('0x4f')+_0x4bf478+_0x9406('0x8d'),{'UserId':_0x3b626b,[_0x4bf478+_0x9406('0x89')]:_0x1c9bd3['id']});if(_0x4bf478!==_0x9406('0x81')){return;}return db[_0x9406('0x8e')][_0x9406('0x47')]({'where':{'id':_0x20bb9f,'online':0x1},'attributes':['id',_0x9406('0x2c'),'online','voicePause',_0x9406('0x8f')],'raw':!![]})[_0x9406('0x44')](function(_0x454d58){var _0x38398b=_[_0x9406('0x2f')](_0x454d58,function(_0x205a74){return db[_0x9406('0x90')][_0x9406('0x91')]({'membername':_0x205a74[_0x9406('0x2c')],'UserId':_0x205a74['id'],'queue_name':_0x1c9bd3[_0x9406('0x2c')],'VoiceQueueId':_0x1c9bd3['id'],'interface':_[_0x9406('0x92')](_0x205a74[_0x9406('0x8f')])?util[_0x9406('0x93')](_0x9406('0x94'),_0x205a74[_0x9406('0x2c')]):_0x205a74['interface'],'paused':_0x205a74[_0x9406('0x95')]||![],'penalty':_0x1c9bd3[_0x9406('0x8b')][_0x9406('0x88')]},{'transaction':_0x5b26ac});});return Promise[_0x9406('0x96')](_0x38398b);});});});return Promise[_0x9406('0x96')](_0x20e88f);});return Promise[_0x9406('0x96')](_0x13bd53);})['then'](function(){return db[_0x9406('0x6d')][_0x9406('0x73')]({'where':{'teamId':_0x59f6b0}})[_0x9406('0x44')](function(_0x2029da){if(_0x2029da){var _0x2492c3=_[_0x9406('0x2f')](_0x20bb9f,function(_0x327ba2){db[_0x9406('0x6e')]['upsert']({'UserId':_0x327ba2,'VoicePrefixId':_0x2029da[_0x9406('0x6f')]});});return Promise['all'](_0x2492c3);}});});});return Promise[_0x9406('0x96')](_0xb132b7)[_0x9406('0x44')](function(){return _0x43cab8[_0x9406('0x80')](_0x20bb9f,{'transaction':_0x5b26ac})[_0x9406('0x97')](function(_0x5621f1){return _0x5621f1;});});});}})[_0x9406('0x44')](respondWithResult(_0x46eefb,null))[_0x9406('0x49')](handleError(_0x46eefb,null));};exports[_0x9406('0x98')]=function(_0x102db8,_0x2751df){var _0x3c1f7e=_[_0x9406('0x99')](_0x102db8[_0x9406('0x35')][_0x9406('0x7e')])?_0x102db8['query'][_0x9406('0x7e')]:[_0x102db8['query']['ids']];var _0x27b70b=_0x102db8[_0x9406('0x57')]['id'];return db[_0x9406('0x30')]['find']({'where':{'id':_0x27b70b}})[_0x9406('0x44')](handleEntityNotFound(_0x2751df,null))[_0x9406('0x44')](function(_0x5c7c46){if(_0x5c7c46){var _0x2f608d=[_0x9406('0x81'),_0x9406('0x82'),_0x9406('0x83'),_0x9406('0x84'),'Fax',_0x9406('0x86'),_0x9406('0x9a')];return db[_0x9406('0x5a')][_0x9406('0x59')](function(_0x40a67e){var _0xa007e8=_[_0x9406('0x2f')](_0x2f608d,function(_0x2005cf){var _0x4c223c={'attributes':['id',_0x9406('0x2c')]};return _0x5c7c46[_0x9406('0x50')+_0x2005cf+_0x9406('0x7a')](_0x4c223c)[_0x9406('0x44')](function(_0x3ca46e){var _0x14f083=_[_0x9406('0x2f')](_0x3ca46e,function(_0x4d16d4){return _0x4d16d4['removeAgents'](_0x3c1f7e,{'transaction':_0x40a67e})[_0x9406('0x44')](function(){var _0x377dda=_['map'](_0x3c1f7e,function(_0x5639fd){socket[_0x9406('0x9b')]('user'+_0x2005cf+'Queue:remove',{'UserId':Number(_0x5639fd),[_0x2005cf+'QueueId']:_0x4d16d4['id']});if(_0x2005cf!==_0x9406('0x81')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4d16d4['id'],'UserId':_0x5639fd},'transaction':_0x40a67e});});return Promise['all'](_0x377dda);});});return Promise[_0x9406('0x96')](_0x14f083);});});return Promise[_0x9406('0x96')](_0xa007e8)[_0x9406('0x44')](function(){return _0x5c7c46[_0x9406('0x98')](_0x3c1f7e,{'transaction':_0x40a67e});})[_0x9406('0x44')](function(){return db[_0x9406('0x6d')][_0x9406('0x73')]({'where':{'teamId':_0x27b70b}})[_0x9406('0x44')](function(_0x53004e){if(_0x53004e){var _0x479d0e=_[_0x9406('0x2f')](_0x3c1f7e,function(_0x54854b){db[_0x9406('0x6e')][_0x9406('0x58')]({'where':{'UserId':_0x54854b,'VoicePrefixId':_0x53004e[_0x9406('0x6f')]}});});return Promise[_0x9406('0x96')](_0x479d0e);}});});});}})['then'](respondWithStatusCode(_0x2751df,null))[_0x9406('0x49')](handleError(_0x2751df,null));};exports[_0x9406('0x9c')]=function(_0x231360,_0x5b2aa3,_0x3d77b8){var _0xabf5ba={};var _0x14cdc2={};var _0x5a2038;var _0x2a3fca;return db[_0x9406('0x30')][_0x9406('0x73')]({'where':{'id':_0x231360[_0x9406('0x57')]['id']}})[_0x9406('0x44')](handleEntityNotFound(_0x5b2aa3,null))[_0x9406('0x44')](function(_0x30575f){if(_0x30575f){_0x5a2038=_0x30575f;_0x14cdc2['model']=_[_0x9406('0x36')](db[_0x9406('0x8e')][_0x9406('0x31')]);_0x14cdc2[_0x9406('0x35')]=_[_0x9406('0x36')](_0x231360[_0x9406('0x35')]);_0x14cdc2[_0x9406('0x37')]=_[_0x9406('0x38')](_0x14cdc2['model'],_0x14cdc2[_0x9406('0x35')]);_0xabf5ba[_0x9406('0x39')]=_[_0x9406('0x38')](_0x14cdc2[_0x9406('0x34')],qs[_0x9406('0x3a')](_0x231360[_0x9406('0x35')]['fields']));_0xabf5ba[_0x9406('0x39')]=_0xabf5ba['attributes'][_0x9406('0x3b')]?_0xabf5ba[_0x9406('0x39')]:_0x14cdc2['model'];_0xabf5ba[_0x9406('0x3e')]=qs[_0x9406('0x78')](_0x231360[_0x9406('0x35')][_0x9406('0x78')]);_0xabf5ba[_0x9406('0x3f')]=qs[_0x9406('0x37')](_[_0x9406('0x40')](_0x231360['query'],_0x14cdc2['filters']));if(_0x231360[_0x9406('0x35')][_0x9406('0x41')]){_0xabf5ba[_0x9406('0x3f')]=_[_0x9406('0x42')](_0xabf5ba['where'],{'$or':_[_0x9406('0x2f')](_0xabf5ba[_0x9406('0x39')],function(_0x57a771){var _0x35819b={};_0x35819b[_0x57a771]={'$like':'%'+_0x231360['query'][_0x9406('0x41')]+'%'};return _0x35819b;})});}_0xabf5ba=_[_0x9406('0x42')]({},_0xabf5ba,_0x231360['options']);return _0x5a2038[_0x9406('0x9c')](_0xabf5ba);}})[_0x9406('0x44')](function(_0x3904c){if(_0x3904c){_0x2a3fca=_0x3904c[_0x9406('0x3b')];if(!_0x231360[_0x9406('0x35')][_0x9406('0x3c')](_0x9406('0x3d'))){_0xabf5ba['limit']=qs['limit'](_0x231360['query'][_0x9406('0x26')]);_0xabf5ba['offset']=qs[_0x9406('0x23')](_0x231360[_0x9406('0x35')]['offset']);}return _0x5a2038['getAgents'](_0xabf5ba);}})[_0x9406('0x44')](function(_0x3bb433){if(_0x3bb433){return _0x3bb433?{'count':_0x2a3fca,'rows':_0x3bb433}:null;}})[_0x9406('0x44')](respondWithResult(_0x5b2aa3,null))[_0x9406('0x49')](handleError(_0x5b2aa3,null));}; \ No newline at end of file +var _0xe457=['../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','count','set','Content-Range','apply','reject','save','update','error','name','send','index','map','Team','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','then','findAll','catch','rawAttributes','keys','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserMailQueue','SmsQueueId','UserSmsQueue','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','TeamVoicePrefix','VoicePrefixId','Teams','findOne','channel','ValidationError','capitalize','Queue','isValidChannel','add','toLowerCase','Queues','ids','Unknown\x20channel','remove','addAgents','isArray','Voice','Chat','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','emit','online','voicePause','interface','UserVoiceQueueRt','isNil','all','UserVoicePrefix','upsert','spread','removeAgents','Mail','Sms','Queue:remove','getAgents','filter','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x55af3d,_0x2e9b9f){var _0x22de17=function(_0x4eb3c5){while(--_0x4eb3c5){_0x55af3d['push'](_0x55af3d['shift']());}};_0x22de17(++_0x2e9b9f);}(_0xe457,0x112));var _0x7e45=function(_0x4587cc,_0x688988){_0x4587cc=_0x4587cc-0x0;var _0x1cf76b=_0xe457[_0x4587cc];return _0x1cf76b;};'use strict';var emlformat=require(_0x7e45('0x0'));var rimraf=require(_0x7e45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7e45('0x2'));var BPromise=require(_0x7e45('0x3'));var Mustache=require(_0x7e45('0x4'));var util=require(_0x7e45('0x5'));var path=require(_0x7e45('0x6'));var sox=require(_0x7e45('0x7'));var csv=require(_0x7e45('0x8'));var ejs=require(_0x7e45('0x9'));var fs=require('fs');var fs_extra=require(_0x7e45('0xa'));var _=require(_0x7e45('0xb'));var squel=require(_0x7e45('0xc'));var crypto=require(_0x7e45('0xd'));var jsforce=require(_0x7e45('0xe'));var deskjs=require(_0x7e45('0xf'));var toCsv=require(_0x7e45('0x8'));var querystring=require(_0x7e45('0x10'));var Papa=require(_0x7e45('0x11'));var Redis=require(_0x7e45('0x12'));var authService=require(_0x7e45('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7e45('0x14'));var hardwareService=require(_0x7e45('0x15'));var logger=require(_0x7e45('0x16'))(_0x7e45('0x17'));var utils=require('../../config/utils');var config=require(_0x7e45('0x18'));var licenseUtil=require(_0x7e45('0x19'));var db=require(_0x7e45('0x1a'))['db'];config[_0x7e45('0x1b')]=_['defaults'](config[_0x7e45('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e45('0x1c'))(new Redis(config[_0x7e45('0x1b')]));require(_0x7e45('0x1d'))[_0x7e45('0x1e')](socket);function respondWithStatusCode(_0x35a54b,_0x13ccca){_0x13ccca=_0x13ccca||0xcc;return function(_0x8425a9){if(_0x8425a9){return _0x35a54b[_0x7e45('0x1f')](_0x13ccca);}return _0x35a54b['status'](_0x13ccca)[_0x7e45('0x20')]();};}function respondWithResult(_0x5d750d,_0x207aee){_0x207aee=_0x207aee||0xc8;return function(_0x48ac73){if(_0x48ac73){return _0x5d750d[_0x7e45('0x21')](_0x207aee)[_0x7e45('0x22')](_0x48ac73);}};}function respondWithFilteredResult(_0x11f372,_0x247d12){return function(_0x3ac451){if(_0x3ac451){var _0x5505a0=typeof _0x247d12[_0x7e45('0x23')]==='undefined'&&typeof _0x247d12['limit']==='undefined';var _0x4b7161=_0x3ac451[_0x7e45('0x24')];var _0xc38fb7=_0x5505a0?0x0:_0x247d12[_0x7e45('0x23')];var _0x221221=_0x5505a0?_0x3ac451[_0x7e45('0x24')]:_0x247d12[_0x7e45('0x23')]+_0x247d12['limit'];var _0x3a845c;if(_0x221221>=_0x4b7161){_0x221221=_0x4b7161;_0x3a845c=0xc8;}else{_0x3a845c=0xce;}_0x11f372[_0x7e45('0x21')](_0x3a845c);return _0x11f372[_0x7e45('0x25')](_0x7e45('0x26'),_0xc38fb7+'-'+_0x221221+'/'+_0x4b7161)[_0x7e45('0x22')](_0x3ac451);}return null;};}function patchUpdates(_0x250710){return function(_0xbf4135){try{jsonpatch[_0x7e45('0x27')](_0xbf4135,_0x250710,!![]);}catch(_0x149cb6){return BPromise[_0x7e45('0x28')](_0x149cb6);}return _0xbf4135[_0x7e45('0x29')]();};}function saveUpdates(_0x2f121e,_0x5d74f8){return function(_0x3bfe68){if(_0x3bfe68){return _0x3bfe68[_0x7e45('0x2a')](_0x2f121e)['then'](function(_0x264eb0){return _0x264eb0;});}return null;};}function handleEntityNotFound(_0x296e6f,_0x24755e){return function(_0x3b0d75){if(!_0x3b0d75){_0x296e6f[_0x7e45('0x1f')](0x194);}return _0x3b0d75;};}function handleError(_0x61453d,_0x2cbb8f){_0x2cbb8f=_0x2cbb8f||0x1f4;return function(_0x3d5361){logger[_0x7e45('0x2b')](_0x3d5361['stack']);if(_0x3d5361[_0x7e45('0x2c')]){delete _0x3d5361['name'];}_0x61453d[_0x7e45('0x21')](_0x2cbb8f)[_0x7e45('0x2d')](_0x3d5361);};}exports[_0x7e45('0x2e')]=function(_0x5566de,_0x4933c7){var _0x5dc83b={},_0x55dc12={},_0x257c9a={'count':0x0,'rows':[]};var _0x52773b=_[_0x7e45('0x2f')](db[_0x7e45('0x30')]['rawAttributes'],function(_0x3cfd61){return{'name':_0x3cfd61['fieldName'],'type':_0x3cfd61['type'][_0x7e45('0x31')]};});_0x55dc12[_0x7e45('0x32')]=_[_0x7e45('0x2f')](_0x52773b,'name');_0x55dc12[_0x7e45('0x33')]=_['keys'](_0x5566de['query']);_0x55dc12[_0x7e45('0x34')]=_[_0x7e45('0x35')](_0x55dc12[_0x7e45('0x32')],_0x55dc12['query']);_0x5dc83b[_0x7e45('0x36')]=_[_0x7e45('0x35')](_0x55dc12[_0x7e45('0x32')],qs[_0x7e45('0x37')](_0x5566de['query'][_0x7e45('0x37')]));_0x5dc83b['attributes']=_0x5dc83b[_0x7e45('0x36')][_0x7e45('0x38')]?_0x5dc83b[_0x7e45('0x36')]:_0x55dc12[_0x7e45('0x32')];if(!_0x5566de[_0x7e45('0x33')][_0x7e45('0x39')](_0x7e45('0x3a'))){_0x5dc83b[_0x7e45('0x3b')]=qs[_0x7e45('0x3b')](_0x5566de['query']['limit']);_0x5dc83b[_0x7e45('0x23')]=qs[_0x7e45('0x23')](_0x5566de['query']['offset']);}_0x5dc83b[_0x7e45('0x3c')]=qs[_0x7e45('0x3d')](_0x5566de[_0x7e45('0x33')]['sort']);_0x5dc83b[_0x7e45('0x3e')]=qs[_0x7e45('0x34')](_[_0x7e45('0x3f')](_0x5566de[_0x7e45('0x33')],_0x55dc12['filters']),_0x52773b);if(_0x5566de['query']['filter']){_0x5dc83b[_0x7e45('0x3e')]=_[_0x7e45('0x40')](_0x5dc83b['where'],{'$or':_[_0x7e45('0x2f')](_0x52773b,function(_0x5cef97){if(_0x5cef97[_0x7e45('0x41')]!=='VIRTUAL'){var _0x1bf99d={};_0x1bf99d[_0x5cef97[_0x7e45('0x2c')]]={'$like':'%'+_0x5566de[_0x7e45('0x33')]['filter']+'%'};return _0x1bf99d;}})});}_0x5dc83b=_[_0x7e45('0x40')]({},_0x5dc83b,_0x5566de['options']);var _0x40351e={'where':_0x5dc83b[_0x7e45('0x3e')]};return db['Team']['count'](_0x40351e)[_0x7e45('0x42')](function(_0x5b5423){_0x257c9a[_0x7e45('0x24')]=_0x5b5423;if(_0x5566de[_0x7e45('0x33')]['includeAll']){_0x5dc83b['include']=[{'all':!![]}];}return db['Team'][_0x7e45('0x43')](_0x5dc83b);})[_0x7e45('0x42')](function(_0x5709dd){_0x257c9a['rows']=_0x5709dd;return _0x257c9a;})['then'](respondWithFilteredResult(_0x4933c7,_0x5dc83b))[_0x7e45('0x44')](handleError(_0x4933c7,null));};exports['show']=function(_0x551a50,_0x992aee){var _0x15e584={'raw':![],'where':{'id':_0x551a50['params']['id']}},_0x428500={};_0x428500[_0x7e45('0x32')]=_['keys'](db[_0x7e45('0x30')][_0x7e45('0x45')]);_0x428500[_0x7e45('0x33')]=_[_0x7e45('0x46')](_0x551a50[_0x7e45('0x33')]);_0x428500[_0x7e45('0x34')]=_[_0x7e45('0x35')](_0x428500[_0x7e45('0x32')],_0x428500[_0x7e45('0x33')]);_0x15e584[_0x7e45('0x36')]=_['intersection'](_0x428500[_0x7e45('0x32')],qs['fields'](_0x551a50['query'][_0x7e45('0x37')]));_0x15e584['attributes']=_0x15e584['attributes'][_0x7e45('0x38')]?_0x15e584[_0x7e45('0x36')]:_0x428500[_0x7e45('0x32')];if(_0x551a50[_0x7e45('0x33')]['includeAll']){_0x15e584[_0x7e45('0x47')]=[{'all':!![]}];}_0x15e584=_['merge']({},_0x15e584,_0x551a50[_0x7e45('0x48')]);return db[_0x7e45('0x30')]['find'](_0x15e584)[_0x7e45('0x42')](handleEntityNotFound(_0x992aee,null))[_0x7e45('0x42')](respondWithResult(_0x992aee,null))[_0x7e45('0x44')](handleError(_0x992aee,null));};exports[_0x7e45('0x49')]=function(_0x474587,_0x25f613){return db[_0x7e45('0x30')][_0x7e45('0x49')](_0x474587[_0x7e45('0x4a')],{})[_0x7e45('0x42')](function(_0x277e57){var _0x512954=_0x474587[_0x7e45('0x4b')][_0x7e45('0x4c')]({'plain':!![]});if(!_0x512954)throw new Error(_0x7e45('0x4d'));if(_0x512954['role']==='user'){var _0x3cec54=_0x277e57[_0x7e45('0x4c')]({'plain':!![]});var _0x3cac7c='Teams';return db[_0x7e45('0x4e')][_0x7e45('0x4f')]({'where':{'name':_0x3cac7c,'userProfileId':_0x512954[_0x7e45('0x50')]},'raw':!![]})['then'](function(_0x5a5f4d){if(_0x5a5f4d&&_0x5a5f4d[_0x7e45('0x51')]===0x0){return db[_0x7e45('0x52')][_0x7e45('0x49')]({'name':_0x3cec54['name'],'resourceId':_0x3cec54['id'],'type':_0x5a5f4d['name'],'sectionId':_0x5a5f4d['id']},{})[_0x7e45('0x42')](function(){return _0x277e57;});}else{return _0x277e57;}})[_0x7e45('0x44')](function(_0x25786a){logger[_0x7e45('0x2b')](_0x7e45('0x53'),_0x25786a);throw _0x25786a;});}return _0x277e57;})['then'](respondWithResult(_0x25f613,0xc9))[_0x7e45('0x44')](handleError(_0x25f613,null));};exports[_0x7e45('0x2a')]=function(_0x27d30d,_0x454751){if(_0x27d30d[_0x7e45('0x4a')]['id']){delete _0x27d30d['body']['id'];}return db['Team'][_0x7e45('0x4f')]({'where':{'id':_0x27d30d[_0x7e45('0x54')]['id']}})[_0x7e45('0x42')](handleEntityNotFound(_0x454751,null))['then'](saveUpdates(_0x27d30d[_0x7e45('0x4a')],null))['then'](respondWithResult(_0x454751,null))[_0x7e45('0x44')](handleError(_0x454751,null));};exports['destroy']=function(_0x7d9818,_0x37e2bc){var _0x35b17c=_0x7d9818[_0x7e45('0x54')]['id'];var _0x53834a=[];return db['sequelize'][_0x7e45('0x55')](function(_0x2b35ba){var _0x56a480=_0x7e45('0x56')+_0x35b17c;return db[_0x7e45('0x57')][_0x7e45('0x33')](_0x56a480,{'type':db['Sequelize'][_0x7e45('0x58')][_0x7e45('0x59')],'raw':!![],'transaction':_0x2b35ba})['then'](function(_0x51d832){_0x53834a=_['map'](_0x51d832,function(_0x196eaf){return Number(_0x196eaf['UserId']);});})[_0x7e45('0x42')](function(){var _0x111046=_0x7e45('0x5a')+_0x35b17c;return db[_0x7e45('0x57')][_0x7e45('0x33')](_0x111046,{'type':db['Sequelize'][_0x7e45('0x58')][_0x7e45('0x59')],'raw':!![],'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(_0x5b0fea){var _0x2cf9d6=_[_0x7e45('0x2f')](_0x5b0fea,function(_0x4b0de1){return Number(_0x4b0de1[_0x7e45('0x5b')]);});return db['UserVoiceQueue'][_0x7e45('0x5c')]({'where':{'UserId':{'$in':_0x53834a},'VoiceQueueId':{'$in':_0x2cf9d6}},'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(){var _0x16e964=_0x7e45('0x5d')+_0x35b17c;return db['sequelize']['query'](_0x16e964,{'type':db[_0x7e45('0x5e')][_0x7e45('0x58')]['SELECT'],'raw':!![],'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(_0x5e89b7){var _0x5f53af=_[_0x7e45('0x2f')](_0x5e89b7,function(_0x1f7899){return Number(_0x1f7899['MailQueueId']);});return db[_0x7e45('0x5f')][_0x7e45('0x5c')]({'where':{'UserId':{'$in':_0x53834a},'MailQueueId':{'$in':_0x5f53af}},'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(){var _0x15180f='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x35b17c;return db[_0x7e45('0x57')][_0x7e45('0x33')](_0x15180f,{'type':db['Sequelize'][_0x7e45('0x58')]['SELECT'],'raw':!![],'transaction':_0x2b35ba});})['then'](function(_0x183ddb){var _0x5b8b10=_[_0x7e45('0x2f')](_0x183ddb,function(_0x327a72){return Number(_0x327a72[_0x7e45('0x60')]);});return db[_0x7e45('0x61')][_0x7e45('0x5c')]({'where':{'UserId':{'$in':_0x53834a},'SmsQueueId':{'$in':_0x5b8b10}},'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(){var _0x5c92c0='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x35b17c;return db[_0x7e45('0x57')]['query'](_0x5c92c0,{'type':db[_0x7e45('0x5e')][_0x7e45('0x58')]['SELECT'],'raw':!![],'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(_0x3d3d0f){var _0x4ead24=_[_0x7e45('0x2f')](_0x3d3d0f,function(_0x497cbc){return Number(_0x497cbc[_0x7e45('0x62')]);});return db[_0x7e45('0x63')][_0x7e45('0x5c')]({'where':{'UserId':{'$in':_0x53834a},'ChatQueueId':{'$in':_0x4ead24}},'transaction':_0x2b35ba});})['then'](function(){var _0x492b9e=_0x7e45('0x64')+_0x35b17c;return db['sequelize'][_0x7e45('0x33')](_0x492b9e,{'type':db[_0x7e45('0x5e')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(_0x444efa){var _0x2d1bcb=_[_0x7e45('0x2f')](_0x444efa,function(_0x5e52fa){return Number(_0x5e52fa[_0x7e45('0x65')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x53834a},'FaxQueueId':{'$in':_0x2d1bcb}},'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(){var _0x20f7e5='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x35b17c;return db[_0x7e45('0x57')][_0x7e45('0x33')](_0x20f7e5,{'type':db[_0x7e45('0x5e')][_0x7e45('0x58')]['SELECT'],'raw':!![],'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(_0x4e099f){var _0x2e5d61=_[_0x7e45('0x2f')](_0x4e099f,function(_0x33f922){return Number(_0x33f922[_0x7e45('0x66')]);});return db[_0x7e45('0x67')]['destroy']({'where':{'UserId':{'$in':_0x53834a},'OpenchannelQueueId':{'$in':_0x2e5d61}},'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(){var _0xb6d3d4=_0x7e45('0x68')+_0x35b17c;return db['sequelize']['query'](_0xb6d3d4,{'type':db[_0x7e45('0x5e')][_0x7e45('0x58')][_0x7e45('0x59')],'raw':!![],'transaction':_0x2b35ba});})['then'](function(_0x258c3d){var _0x37c4b6=_[_0x7e45('0x2f')](_0x258c3d,function(_0x4ddb06){return Number(_0x4ddb06['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x7e45('0x5c')]({'where':{'UserId':{'$in':_0x53834a},'WhatsappQueueId':{'$in':_0x37c4b6}},'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(){return db[_0x7e45('0x69')]['find']({'where':{'TeamId':_0x35b17c}});})[_0x7e45('0x42')](function(_0x56e5cf){if(_0x56e5cf===null){return;}return db['UserVoicePrefix'][_0x7e45('0x5c')]({'where':{'UserId':{'$in':_0x53834a},'VoicePrefixId':_0x56e5cf[_0x7e45('0x6a')]},'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(){return db['Team'][_0x7e45('0x5c')]({'where':{'id':_0x35b17c},'cascade':!![],'transaction':_0x2b35ba});})[_0x7e45('0x42')](function(_0x1defdf){if(_0x1defdf===0x0){_0x37e2bc['sendStatus'](0x194);}else{return db[_0x7e45('0x52')][_0x7e45('0x5c')]({'where':{'type':_0x7e45('0x6b'),'resourceId':_0x35b17c},'cascade':!![],'transaction':_0x2b35ba})[_0x7e45('0x42')](function(){_0x37e2bc[_0x7e45('0x21')](0xcc)[_0x7e45('0x20')]();});}})[_0x7e45('0x44')](function(_0x12670e){_0x37e2bc[_0x7e45('0x21')](0x1f4)[_0x7e45('0x2d')](_0x12670e);});});};exports['getQueues']=function(_0x138499,_0x1adac0,_0x2522aa){return db[_0x7e45('0x30')][_0x7e45('0x6c')]({'where':{'id':_0x138499[_0x7e45('0x54')]['id']}})['then'](handleEntityNotFound(_0x1adac0,null))[_0x7e45('0x42')](function(_0x5ba715){if(!_0x138499['query']['channel']||!utils['isValidChannel'](_0x138499[_0x7e45('0x33')][_0x7e45('0x6d')])){throw new db[(_0x7e45('0x5e'))][(_0x7e45('0x6e'))]('Unknown\x20channel');}var _0x57c10f={};var _0x5280fd={};_0x5280fd[_0x7e45('0x32')]=_['keys'](db[_[_0x7e45('0x6f')](_0x138499[_0x7e45('0x33')][_0x7e45('0x6d')]['toLowerCase']())+_0x7e45('0x70')][_0x7e45('0x45')]);_0x5280fd[_0x7e45('0x33')]=_[_0x7e45('0x46')](_0x138499[_0x7e45('0x33')]);_0x5280fd['filters']=_[_0x7e45('0x35')](_0x5280fd[_0x7e45('0x32')],_0x5280fd['query']);_0x57c10f[_0x7e45('0x36')]=_[_0x7e45('0x35')](_0x5280fd[_0x7e45('0x32')],qs[_0x7e45('0x37')](_0x138499[_0x7e45('0x33')]['fields']));_0x57c10f[_0x7e45('0x36')]=_0x57c10f['attributes'][_0x7e45('0x38')]?_0x57c10f[_0x7e45('0x36')]:_0x5280fd[_0x7e45('0x32')];_0x57c10f[_0x7e45('0x3b')]=qs[_0x7e45('0x3b')](_0x138499['query'][_0x7e45('0x3b')]);_0x57c10f[_0x7e45('0x23')]=qs[_0x7e45('0x23')](_0x138499[_0x7e45('0x33')][_0x7e45('0x23')]);_0x57c10f[_0x7e45('0x3c')]=qs[_0x7e45('0x3d')](_0x138499[_0x7e45('0x33')][_0x7e45('0x3d')]);_0x57c10f['where']=qs[_0x7e45('0x34')](_[_0x7e45('0x3f')](_0x138499[_0x7e45('0x33')],_0x5280fd['filters']));_0x57c10f=_['merge']({},_0x57c10f,_0x138499[_0x7e45('0x48')]);return _0x5ba715['get'+_['capitalize'](_0x138499['query'][_0x7e45('0x6d')]['toLowerCase']())+'Queues'](_0x57c10f);})['then'](respondWithResult(_0x1adac0,null))[_0x7e45('0x44')](handleError(_0x1adac0,null));};exports['addQueues']=function(_0x35ae70,_0x50a326,_0x5f1c94){return db[_0x7e45('0x30')][_0x7e45('0x6c')]({'where':{'id':_0x35ae70[_0x7e45('0x54')]['id']}})[_0x7e45('0x42')](function(_0x71c291){if(_0x71c291){if(!_0x35ae70[_0x7e45('0x4a')][_0x7e45('0x6d')]||!utils[_0x7e45('0x71')](_0x35ae70['body'][_0x7e45('0x6d')])){throw new db[(_0x7e45('0x5e'))]['ValidationError']('Unknown\x20channel');}return _0x71c291[_0x7e45('0x72')+_[_0x7e45('0x6f')](_0x35ae70[_0x7e45('0x4a')][_0x7e45('0x6d')][_0x7e45('0x73')]())+_0x7e45('0x74')](_0x35ae70[_0x7e45('0x4a')][_0x7e45('0x75')]);}return null;})[_0x7e45('0x42')](handleEntityNotFound(_0x50a326,null))[_0x7e45('0x42')](respondWithStatusCode(_0x50a326,null))['catch'](handleError(_0x50a326,null));};exports['removeQueues']=function(_0x22b771,_0x4044a4,_0x11b3df){return db[_0x7e45('0x30')]['findOne']({'where':{'id':_0x22b771[_0x7e45('0x54')]['id']}})['then'](function(_0x10e141){if(_0x10e141){if(!_0x22b771[_0x7e45('0x33')]['channel']||!utils[_0x7e45('0x71')](_0x22b771[_0x7e45('0x33')][_0x7e45('0x6d')])){throw new db[(_0x7e45('0x5e'))][(_0x7e45('0x6e'))](_0x7e45('0x76'));}return _0x10e141[_0x7e45('0x77')+_[_0x7e45('0x6f')](_0x22b771['query'][_0x7e45('0x6d')][_0x7e45('0x73')]())+_0x7e45('0x74')](_0x22b771[_0x7e45('0x33')][_0x7e45('0x75')]);}return null;})[_0x7e45('0x42')](handleEntityNotFound(_0x4044a4,null))[_0x7e45('0x42')](respondWithStatusCode(_0x4044a4,null))['catch'](handleError(_0x4044a4,null));};exports[_0x7e45('0x78')]=function(_0x93c3fd,_0x2dbfeb){var _0x59d504=_[_0x7e45('0x79')](_0x93c3fd['body'][_0x7e45('0x75')])?_0x93c3fd['body'][_0x7e45('0x75')]:[_0x93c3fd[_0x7e45('0x4a')][_0x7e45('0x75')]];var _0xbc5af=_0x93c3fd['params']['id'];return db[_0x7e45('0x30')][_0x7e45('0x4f')]({'where':{'id':_0xbc5af}})[_0x7e45('0x42')](handleEntityNotFound(_0x2dbfeb,null))['then'](function(_0x3c1bd7){if(_0x3c1bd7){var _0x4a05ae=[_0x7e45('0x7a'),_0x7e45('0x7b'),'Mail','Sms',_0x7e45('0x7c'),_0x7e45('0x7d'),_0x7e45('0x7e')];return db[_0x7e45('0x57')][_0x7e45('0x55')](function(_0x109914){var _0x1e764d=_[_0x7e45('0x2f')](_0x4a05ae,function(_0x126779){var _0x483563={'attributes':['id',_0x7e45('0x2c')]};if(_0x126779==='Voice'){_0x483563[_0x7e45('0x7f')]={'attributes':[_0x7e45('0x80')]};}return _0x3c1bd7[_0x7e45('0x4c')+_0x126779+_0x7e45('0x74')](_0x483563)['then'](function(_0x51eb5d){var _0x2c8754=_[_0x7e45('0x2f')](_0x51eb5d,function(_0x4d9317){var _0x277c93=_['map'](_0x59d504,function(_0x3fe5a1){var _0x312d39={'where':{'UserId':_0x3fe5a1,[_0x126779+_0x7e45('0x81')]:_0x4d9317['id']},'transaction':_0x109914};if(_0x126779===_0x7e45('0x7a')){_0x312d39[_0x7e45('0x82')]={'penalty':_0x4d9317[_0x7e45('0x83')][_0x7e45('0x80')]};}return db[_0x7e45('0x84')+_0x126779+_0x7e45('0x70')]['findOrCreate'](_0x312d39)['then'](function(){socket[_0x7e45('0x85')](_0x7e45('0x4b')+_0x126779+'Queue:save',{'UserId':_0x3fe5a1,[_0x126779+_0x7e45('0x81')]:_0x4d9317['id']});if(_0x126779!==_0x7e45('0x7a')){return;}return db['User'][_0x7e45('0x43')]({'where':{'id':_0x59d504,'online':0x1},'attributes':['id','name',_0x7e45('0x86'),_0x7e45('0x87'),_0x7e45('0x88')],'raw':!![]})['then'](function(_0x35e689){var _0x339b75=_[_0x7e45('0x2f')](_0x35e689,function(_0x43d610){return db[_0x7e45('0x89')]['upsert']({'membername':_0x43d610[_0x7e45('0x2c')],'UserId':_0x43d610['id'],'queue_name':_0x4d9317[_0x7e45('0x2c')],'VoiceQueueId':_0x4d9317['id'],'interface':_[_0x7e45('0x8a')](_0x43d610[_0x7e45('0x88')])?util['format']('SIP/%s',_0x43d610[_0x7e45('0x2c')]):_0x43d610[_0x7e45('0x88')],'paused':_0x43d610[_0x7e45('0x87')]||![],'penalty':_0x4d9317[_0x7e45('0x83')][_0x7e45('0x80')]},{'transaction':_0x109914});});return Promise[_0x7e45('0x8b')](_0x339b75);});});});return Promise['all'](_0x277c93);});return Promise['all'](_0x2c8754);})[_0x7e45('0x42')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0xbc5af}})[_0x7e45('0x42')](function(_0x37e820){if(_0x37e820){var _0xad303e=_[_0x7e45('0x2f')](_0x59d504,function(_0x1e93a5){db[_0x7e45('0x8c')][_0x7e45('0x8d')]({'UserId':_0x1e93a5,'VoicePrefixId':_0x37e820[_0x7e45('0x6a')]});});return Promise['all'](_0xad303e);}});});});return Promise['all'](_0x1e764d)[_0x7e45('0x42')](function(){return _0x3c1bd7[_0x7e45('0x78')](_0x59d504,{'transaction':_0x109914})[_0x7e45('0x8e')](function(_0x677f06){return _0x677f06;});});});}})['then'](respondWithResult(_0x2dbfeb,null))[_0x7e45('0x44')](handleError(_0x2dbfeb,null));};exports[_0x7e45('0x8f')]=function(_0x49e31a,_0x244b6d){var _0x38c537=_[_0x7e45('0x79')](_0x49e31a[_0x7e45('0x33')][_0x7e45('0x75')])?_0x49e31a[_0x7e45('0x33')]['ids']:[_0x49e31a[_0x7e45('0x33')][_0x7e45('0x75')]];var _0x1a847a=_0x49e31a[_0x7e45('0x54')]['id'];return db[_0x7e45('0x30')][_0x7e45('0x4f')]({'where':{'id':_0x1a847a}})[_0x7e45('0x42')](handleEntityNotFound(_0x244b6d,null))['then'](function(_0x309845){if(_0x309845){var _0x33ee4b=['Voice','Chat',_0x7e45('0x90'),_0x7e45('0x91'),_0x7e45('0x7c'),_0x7e45('0x7d'),_0x7e45('0x7e')];return db[_0x7e45('0x57')][_0x7e45('0x55')](function(_0x3c1ec3){var _0x55e59c=_[_0x7e45('0x2f')](_0x33ee4b,function(_0x57e0e7){var _0x2baa86={'attributes':['id','name']};return _0x309845['get'+_0x57e0e7+_0x7e45('0x74')](_0x2baa86)['then'](function(_0x33ba69){var _0x254c38=_['map'](_0x33ba69,function(_0x232dd0){return _0x232dd0[_0x7e45('0x8f')](_0x38c537,{'transaction':_0x3c1ec3})[_0x7e45('0x42')](function(){var _0x399882=_['map'](_0x38c537,function(_0x3e26bb){socket[_0x7e45('0x85')](_0x7e45('0x4b')+_0x57e0e7+_0x7e45('0x92'),{'UserId':Number(_0x3e26bb),[_0x57e0e7+'QueueId']:_0x232dd0['id']});if(_0x57e0e7!==_0x7e45('0x7a')){return;}return db['UserVoiceQueueRt'][_0x7e45('0x5c')]({'where':{'VoiceQueueId':_0x232dd0['id'],'UserId':_0x3e26bb},'transaction':_0x3c1ec3});});return Promise[_0x7e45('0x8b')](_0x399882);});});return Promise['all'](_0x254c38);});});return Promise[_0x7e45('0x8b')](_0x55e59c)['then'](function(){return _0x309845[_0x7e45('0x8f')](_0x38c537,{'transaction':_0x3c1ec3});})['then'](function(){return db[_0x7e45('0x69')][_0x7e45('0x6c')]({'where':{'teamId':_0x1a847a}})['then'](function(_0x106950){if(_0x106950){var _0x44ed81=_[_0x7e45('0x2f')](_0x38c537,function(_0x27c3e3){db[_0x7e45('0x8c')]['destroy']({'where':{'UserId':_0x27c3e3,'VoicePrefixId':_0x106950[_0x7e45('0x6a')]}});});return Promise[_0x7e45('0x8b')](_0x44ed81);}});});});}})['then'](respondWithStatusCode(_0x244b6d,null))['catch'](handleError(_0x244b6d,null));};exports[_0x7e45('0x93')]=function(_0x456d04,_0x3fa346,_0x2acaec){var _0x51011b={};var _0x374b10={};var _0x44090a;var _0x543aac;return db['Team'][_0x7e45('0x6c')]({'where':{'id':_0x456d04[_0x7e45('0x54')]['id']}})['then'](handleEntityNotFound(_0x3fa346,null))[_0x7e45('0x42')](function(_0x156905){if(_0x156905){_0x44090a=_0x156905;_0x374b10[_0x7e45('0x32')]=_[_0x7e45('0x46')](db[_0x7e45('0x84')]['rawAttributes']);_0x374b10['query']=_[_0x7e45('0x46')](_0x456d04['query']);_0x374b10[_0x7e45('0x34')]=_['intersection'](_0x374b10[_0x7e45('0x32')],_0x374b10['query']);_0x51011b[_0x7e45('0x36')]=_[_0x7e45('0x35')](_0x374b10['model'],qs[_0x7e45('0x37')](_0x456d04[_0x7e45('0x33')]['fields']));_0x51011b[_0x7e45('0x36')]=_0x51011b[_0x7e45('0x36')]['length']?_0x51011b[_0x7e45('0x36')]:_0x374b10[_0x7e45('0x32')];_0x51011b['order']=qs[_0x7e45('0x3d')](_0x456d04[_0x7e45('0x33')][_0x7e45('0x3d')]);_0x51011b[_0x7e45('0x3e')]=qs[_0x7e45('0x34')](_[_0x7e45('0x3f')](_0x456d04[_0x7e45('0x33')],_0x374b10[_0x7e45('0x34')]));if(_0x456d04[_0x7e45('0x33')]['filter']){_0x51011b['where']=_[_0x7e45('0x40')](_0x51011b[_0x7e45('0x3e')],{'$or':_[_0x7e45('0x2f')](_0x51011b[_0x7e45('0x36')],function(_0x3bc278){var _0x5412ee={};_0x5412ee[_0x3bc278]={'$like':'%'+_0x456d04[_0x7e45('0x33')][_0x7e45('0x94')]+'%'};return _0x5412ee;})});}_0x51011b=_[_0x7e45('0x40')]({},_0x51011b,_0x456d04['options']);return _0x44090a[_0x7e45('0x93')](_0x51011b);}})['then'](function(_0x34fd4b){if(_0x34fd4b){_0x543aac=_0x34fd4b[_0x7e45('0x38')];if(!_0x456d04[_0x7e45('0x33')][_0x7e45('0x39')]('nolimit')){_0x51011b['limit']=qs[_0x7e45('0x3b')](_0x456d04['query'][_0x7e45('0x3b')]);_0x51011b['offset']=qs[_0x7e45('0x23')](_0x456d04[_0x7e45('0x33')][_0x7e45('0x23')]);}return _0x44090a[_0x7e45('0x93')](_0x51011b);}})[_0x7e45('0x42')](function(_0x19b77e){if(_0x19b77e){return _0x19b77e?{'count':_0x543aac,'rows':_0x19b77e}:null;}})['then'](respondWithResult(_0x3fa346,null))[_0x7e45('0x44')](handleError(_0x3fa346,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c269e71..c70897e 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 _0xfdf4=['setMaxListeners','update','remove','hasOwnProperty','exports','events','Team'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfdf4,0x83));var _0x4fdf=function(_0x2b2200,_0x2bcc71){_0x2b2200=_0x2b2200-0x0;var _0x3bdc34=_0xfdf4[_0x2b2200];return _0x3bdc34;};'use strict';var EventEmitter=require(_0x4fdf('0x0'));var Team=require('../../mysqldb')['db'][_0x4fdf('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x4fdf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4fdf('0x3'),'afterDestroy':_0x4fdf('0x4')};function emitEvent(_0x420f5f){return function(_0x3ae869,_0x409cd4,_0x436fc5){TeamEvents['emit'](_0x420f5f+':'+_0x3ae869['id'],_0x3ae869);TeamEvents['emit'](_0x420f5f,_0x3ae869);_0x436fc5(null);};}for(var e in events){if(events[_0x4fdf('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x4fdf('0x6')]=TeamEvents; \ No newline at end of file +var _0xe519=['save','update','remove','emit','hasOwnProperty','hook','exports','events','Team','setMaxListeners'];(function(_0xbfe211,_0x52a8d3){var _0x48ffb2=function(_0x27ad18){while(--_0x27ad18){_0xbfe211['push'](_0xbfe211['shift']());}};_0x48ffb2(++_0x52a8d3);}(_0xe519,0x7f));var _0x9e51=function(_0x13111b,_0x42d1cc){_0x13111b=_0x13111b-0x0;var _0x50d49d=_0xe519[_0x13111b];return _0x50d49d;};'use strict';var EventEmitter=require(_0x9e51('0x0'));var Team=require('../../mysqldb')['db'][_0x9e51('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x9e51('0x2')](0x0);var events={'afterCreate':_0x9e51('0x3'),'afterUpdate':_0x9e51('0x4'),'afterDestroy':_0x9e51('0x5')};function emitEvent(_0x2b3b09){return function(_0x20f6c7,_0x3caab9,_0xf6b55a){TeamEvents[_0x9e51('0x6')](_0x2b3b09+':'+_0x20f6c7['id'],_0x20f6c7);TeamEvents[_0x9e51('0x6')](_0x2b3b09,_0x20f6c7);_0xf6b55a(null);};}for(var e in events){if(events[_0x9e51('0x7')](e)){var event=events[e];Team[_0x9e51('0x8')](e,emitEvent(event));}}module[_0x9e51('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 5c11dc0..3b36486 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 _0xd341=['Openchannel','Sms','Voice','Whatsapp','all','lodash','./team.attributes','get','Queues','then','map','channel','catch','Team','teams','Chat','Fax','Mail'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xd341,0xa7));var _0x1d34=function(_0x74c77a,_0x89628e){_0x74c77a=_0x74c77a-0x0;var _0x51d12c=_0xd341[_0x74c77a];return _0x51d12c;};'use strict';var _=require(_0x1d34('0x0'));var attributes=require(_0x1d34('0x1'));function getQueuesByChannel(_0x2b71f0,_0x185055){var _0x48f4df=_0x1d34('0x2')+_0x185055+_0x1d34('0x3');return _0x2b71f0[_0x48f4df]()[_0x1d34('0x4')](function(_0x411316){return _[_0x1d34('0x5')](_0x411316,function(_0xc90c1a){_0xc90c1a['setDataValue'](_0x1d34('0x6'),_0x185055);return _0xc90c1a;});})[_0x1d34('0x7')](function(_0x393faf){throw _0x393faf;});}module['exports']=function(_0x54e273){return _0x54e273['define'](_0x1d34('0x8'),attributes,{'tableName':_0x1d34('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x10ae2e=this;var _0x359c11=[_0x1d34('0xa'),_0x1d34('0xb'),_0x1d34('0xc'),_0x1d34('0xd'),_0x1d34('0xe'),_0x1d34('0xf'),_0x1d34('0x10')];return Promise['resolve']()[_0x1d34('0x4')](function(){var _0x37e9f7=_[_0x1d34('0x5')](_0x359c11,function(_0x2a4b89){return getQueuesByChannel(_0x10ae2e,_0x2a4b89);});return Promise[_0x1d34('0x11')](_0x37e9f7);})[_0x1d34('0x7')](function(_0x2d5f53){throw _0x2d5f53;});}}});}; \ No newline at end of file +var _0x58c2=['Sms','Whatsapp','resolve','then','map','all','lodash','./team.attributes','get','Queues','setDataValue','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel'];(function(_0x363618,_0x5ebf3a){var _0x496dee=function(_0x3b312a){while(--_0x3b312a){_0x363618['push'](_0x363618['shift']());}};_0x496dee(++_0x5ebf3a);}(_0x58c2,0x146));var _0x258c=function(_0x49c54c,_0x54a647){_0x49c54c=_0x49c54c-0x0;var _0x446225=_0x58c2[_0x49c54c];return _0x446225;};'use strict';var _=require(_0x258c('0x0'));var attributes=require(_0x258c('0x1'));function getQueuesByChannel(_0x397a5b,_0x299f27){var _0x3d2d89=_0x258c('0x2')+_0x299f27+_0x258c('0x3');return _0x397a5b[_0x3d2d89]()['then'](function(_0x15997e){return _['map'](_0x15997e,function(_0xf26f5f){_0xf26f5f[_0x258c('0x4')]('channel',_0x299f27);return _0xf26f5f;});})[_0x258c('0x5')](function(_0x103c2a){throw _0x103c2a;});}module[_0x258c('0x6')]=function(_0x1e0e7f){return _0x1e0e7f[_0x258c('0x7')](_0x258c('0x8'),attributes,{'tableName':_0x258c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xe6d66c=this;var _0x36ea5e=[_0x258c('0xa'),_0x258c('0xb'),_0x258c('0xc'),_0x258c('0xd'),_0x258c('0xe'),'Voice',_0x258c('0xf')];return Promise[_0x258c('0x10')]()[_0x258c('0x11')](function(){var _0x534f95=_[_0x258c('0x12')](_0x36ea5e,function(_0x23f6d0){return getQueuesByChannel(_0xe6d66c,_0x23f6d0);});return Promise[_0x258c('0x13')](_0x534f95);})['catch'](function(_0x1f7d9c){throw _0x1f7d9c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 95472da..5b7d12f 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 _0x2873=['request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./team.socket','register'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x2873,0x1f2));var _0x3287=function(_0x591fbb,_0x1f4133){_0x591fbb=_0x591fbb-0x0;var _0x11e944=_0x2873[_0x591fbb];return _0x11e944;};'use strict';var _=require(_0x3287('0x0'));var util=require(_0x3287('0x1'));var moment=require(_0x3287('0x2'));var BPromise=require(_0x3287('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3287('0x4'));var db=require(_0x3287('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3287('0x6'))(_0x3287('0x7'));var config=require('../../config/environment');var jayson=require(_0x3287('0x8'));var client=jayson[_0x3287('0x9')]['http']({'port':0x232a});config[_0x3287('0xa')]=_['defaults'](config[_0x3287('0xa')],{'host':_0x3287('0xb'),'port':0x18eb});var socket=require(_0x3287('0xc'))(new Redis(config[_0x3287('0xa')]));require(_0x3287('0xd'))[_0x3287('0xe')](socket);function respondWithRpcPromise(_0x3333d5,_0x5d0ec9,_0x29ecc6){return new BPromise(function(_0x1c342a,_0x22f28c){return client[_0x3287('0xf')](_0x3333d5,_0x29ecc6)[_0x3287('0x10')](function(_0x36081b){logger[_0x3287('0x11')]('Team,\x20%s,\x20%s',_0x5d0ec9,'request\x20sent');logger[_0x3287('0x12')](_0x3287('0x13'),_0x5d0ec9,_0x3287('0x14'),JSON[_0x3287('0x15')](_0x36081b));if(_0x36081b[_0x3287('0x16')]){if(_0x36081b['error'][_0x3287('0x17')]===0x1f4){logger[_0x3287('0x16')](_0x3287('0x18'),_0x5d0ec9,_0x36081b[_0x3287('0x16')]['message']);return _0x22f28c(_0x36081b[_0x3287('0x16')]['message']);}logger[_0x3287('0x16')](_0x3287('0x18'),_0x5d0ec9,_0x36081b[_0x3287('0x16')]['message']);return _0x1c342a(_0x36081b[_0x3287('0x16')][_0x3287('0x19')]);}else{logger[_0x3287('0x11')](_0x3287('0x18'),_0x5d0ec9,_0x3287('0x14'));_0x1c342a(_0x36081b['result']['message']);}})[_0x3287('0x1a')](function(_0x48b024){logger[_0x3287('0x16')]('Team,\x20%s,\x20%s',_0x5d0ec9,_0x48b024);_0x22f28c(_0x48b024);});});} \ No newline at end of file +var _0x3dc3=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','request\x20sent','result','catch'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x3dc3,0xd8));var _0x33dc=function(_0x475cf5,_0x2d767d){_0x475cf5=_0x475cf5-0x0;var _0xadc877=_0x3dc3[_0x475cf5];return _0xadc877;};'use strict';var _=require(_0x33dc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x33dc('0x1'));var rs=require(_0x33dc('0x2'));var fs=require('fs');var Redis=require(_0x33dc('0x3'));var db=require(_0x33dc('0x4'))['db'];var utils=require(_0x33dc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x33dc('0x6'));var client=jayson['client'][_0x33dc('0x7')]({'port':0x232a});config[_0x33dc('0x8')]=_[_0x33dc('0x9')](config[_0x33dc('0x8')],{'host':_0x33dc('0xa'),'port':0x18eb});var socket=require(_0x33dc('0xb'))(new Redis(config[_0x33dc('0x8')]));require(_0x33dc('0xc'))[_0x33dc('0xd')](socket);function respondWithRpcPromise(_0x24fa9c,_0x169ed1,_0x54c9c6){return new BPromise(function(_0x15730c,_0x278b8c){return client[_0x33dc('0xe')](_0x24fa9c,_0x54c9c6)[_0x33dc('0xf')](function(_0x3161e4){logger[_0x33dc('0x10')]('Team,\x20%s,\x20%s',_0x169ed1,'request\x20sent');logger[_0x33dc('0x11')](_0x33dc('0x12'),_0x169ed1,'request\x20sent',JSON[_0x33dc('0x13')](_0x3161e4));if(_0x3161e4[_0x33dc('0x14')]){if(_0x3161e4[_0x33dc('0x14')][_0x33dc('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x169ed1,_0x3161e4[_0x33dc('0x14')]['message']);return _0x278b8c(_0x3161e4['error']['message']);}logger[_0x33dc('0x14')](_0x33dc('0x16'),_0x169ed1,_0x3161e4[_0x33dc('0x14')][_0x33dc('0x17')]);return _0x15730c(_0x3161e4[_0x33dc('0x14')]['message']);}else{logger['info'](_0x33dc('0x16'),_0x169ed1,_0x33dc('0x18'));_0x15730c(_0x3161e4[_0x33dc('0x19')][_0x33dc('0x17')]);}})[_0x33dc('0x1a')](function(_0x21ba95){logger['error'](_0x33dc('0x16'),_0x169ed1,_0x21ba95);_0x278b8c(_0x21ba95);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 151978a..bc1bf1b 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 _0xfcc8=['remove','update','removeListener','length','team:','./team.events','save'];(function(_0x41a797,_0x4378ae){var _0x297b7c=function(_0x4419b5){while(--_0x4419b5){_0x41a797['push'](_0x41a797['shift']());}};_0x297b7c(++_0x4378ae);}(_0xfcc8,0xb4));var _0x8fcc=function(_0xe5252b,_0x3377e8){_0xe5252b=_0xe5252b-0x0;var _0x17b964=_0xfcc8[_0xe5252b];return _0x17b964;};'use strict';var TeamEvents=require(_0x8fcc('0x0'));var events=[_0x8fcc('0x1'),_0x8fcc('0x2'),_0x8fcc('0x3')];function createListener(_0x5e3eb2,_0x39681c){return function(_0x5bed54){_0x39681c['emit'](_0x5e3eb2,_0x5bed54);};}function removeListener(_0x464bda,_0x5915c5){return function(){TeamEvents[_0x8fcc('0x4')](_0x464bda,_0x5915c5);};}exports['register']=function(_0x423ef8){for(var _0x22dec9=0x0,_0xd44c17=events[_0x8fcc('0x5')];_0x22dec9<_0xd44c17;_0x22dec9++){var _0x310cad=events[_0x22dec9];var _0x1c8b19=createListener(_0x8fcc('0x6')+_0x310cad,_0x423ef8);TeamEvents['on'](_0x310cad,_0x1c8b19);}}; \ No newline at end of file +var _0x0a6b=['./team.events','remove','update','emit','removeListener','register','length','team:'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x0a6b,0x120));var _0xb0a6=function(_0x39a3f4,_0x4036c3){_0x39a3f4=_0x39a3f4-0x0;var _0x2a14e9=_0x0a6b[_0x39a3f4];return _0x2a14e9;};'use strict';var TeamEvents=require(_0xb0a6('0x0'));var events=['save',_0xb0a6('0x1'),_0xb0a6('0x2')];function createListener(_0x91427c,_0x42f95f){return function(_0x1886ea){_0x42f95f[_0xb0a6('0x3')](_0x91427c,_0x1886ea);};}function removeListener(_0x39d403,_0xa2c294){return function(){TeamEvents[_0xb0a6('0x4')](_0x39d403,_0xa2c294);};}exports[_0xb0a6('0x5')]=function(_0x4b47bc){for(var _0x30b3b7=0x0,_0x504a45=events[_0xb0a6('0x6')];_0x30b3b7<_0x504a45;_0x30b3b7++){var _0x490cfc=events[_0x30b3b7];var _0x597b68=createListener(_0xb0a6('0x7')+_0x490cfc,_0x4b47bc);TeamEvents['on'](_0x490cfc,_0x597b68);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 35599c5..fea81ce 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 _0x2e78=['sequelize','exports','INTEGER'];(function(_0x4ea44b,_0x546b89){var _0x418cc9=function(_0x1eb1e5){while(--_0x1eb1e5){_0x4ea44b['push'](_0x4ea44b['shift']());}};_0x418cc9(++_0x546b89);}(_0x2e78,0xab));var _0x82e7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2e78[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x82e7('0x0'));module[_0x82e7('0x1')]={'TeamId':{'type':Sequelize[_0x82e7('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x59e0=['exports','INTEGER'];(function(_0x46d737,_0xe7225b){var _0x13292c=function(_0x1ada3f){while(--_0x1ada3f){_0x46d737['push'](_0x46d737['shift']());}};_0x13292c(++_0xe7225b);}(_0x59e0,0x1f4));var _0x059e=function(_0x31bc65,_0x14a39e){_0x31bc65=_0x31bc65-0x0;var _0x462aa6=_0x59e0[_0x31bc65];return _0x462aa6;};'use strict';var Sequelize=require('sequelize');module[_0x059e('0x0')]={'TeamId':{'type':Sequelize[_0x059e('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x059e('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 42386bb..909a1e1 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 _0xa71a=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x4c9100,_0x37622e){var _0x276fc6=function(_0x102b72){while(--_0x102b72){_0x4c9100['push'](_0x4c9100['shift']());}};_0x276fc6(++_0x37622e);}(_0xa71a,0xf1));var _0xaa71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa71a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaa71('0x0'));var util=require(_0xaa71('0x1'));var logger=require(_0xaa71('0x2'))(_0xaa71('0x3'));var moment=require('moment');var BPromise=require(_0xaa71('0x4'));var rp=require(_0xaa71('0x5'));var fs=require('fs');var path=require(_0xaa71('0x6'));var rimraf=require('rimraf');var config=require(_0xaa71('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0xaa71('0x8')]=function(_0x2f476b,_0x1f07bd){return _0x2f476b['define'](_0xaa71('0x9'),attributes,{'tableName':_0xaa71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd48a=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','team_has_voice_prefixes'];(function(_0x575741,_0x56b666){var _0x4ec5d8=function(_0x59d705){while(--_0x59d705){_0x575741['push'](_0x575741['shift']());}};_0x4ec5d8(++_0x56b666);}(_0xd48a,0x96));var _0xad48=function(_0x2802bc,_0x2cecd0){_0x2802bc=_0x2802bc-0x0;var _0x4eaf48=_0xd48a[_0x2802bc];return _0x4eaf48;};'use strict';var _=require(_0xad48('0x0'));var util=require('util');var logger=require(_0xad48('0x1'))(_0xad48('0x2'));var moment=require(_0xad48('0x3'));var BPromise=require(_0xad48('0x4'));var rp=require(_0xad48('0x5'));var fs=require('fs');var path=require(_0xad48('0x6'));var rimraf=require('rimraf');var config=require(_0xad48('0x7'));var attributes=require(_0xad48('0x8'));module['exports']=function(_0x143780,_0x584cf0){return _0x143780['define']('TeamVoicePrefix',attributes,{'tableName':_0xad48('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index f504840..00860a4 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1feefe,_0x2018ad){var _0x56471a=function(_0x8745df){while(--_0x8745df){_0x1feefe['push'](_0x1feefe['shift']());}};_0x56471a(++_0x2018ad);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3473d9,_0x5aafbb){var _0x2224eb=function(_0x5acc0f){while(--_0x5acc0f){_0x3473d9['push'](_0x3473d9['shift']());}};_0x2224eb(++_0x5aafbb);}(_0x70e0,0x17b));var _0x070e=function(_0x333f27,_0x257969){_0x333f27=_0x333f27-0x0;var _0x54d568=_0x70e0[_0x333f27];return _0x54d568;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9006424..d312697 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd97a=['exports','INTEGER'];(function(_0x5d2637,_0x4de66a){var _0x197d8d=function(_0x352f24){while(--_0x352f24){_0x5d2637['push'](_0x5d2637['shift']());}};_0x197d8d(++_0x4de66a);}(_0xd97a,0x176));var _0xad97=function(_0x5c17e0,_0x11d7fe){_0x5c17e0=_0x5c17e0-0x0;var _0x491ac1=_0xd97a[_0x5c17e0];return _0x491ac1;};'use strict';var Sequelize=require('sequelize');module[_0xad97('0x0')]={'penalty':{'type':Sequelize[_0xad97('0x1')],'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 6da4be0..24ce979 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 _0xfaec=['./teamVoiceQueue.attributes','define','team_has_voice_queues','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x4eb269,_0x3cd1b6){var _0x1597b8=function(_0x527f9d){while(--_0x527f9d){_0x4eb269['push'](_0x4eb269['shift']());}};_0x1597b8(++_0x3cd1b6);}(_0xfaec,0x12f));var _0xcfae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfaec[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcfae('0x0'));var util=require(_0xcfae('0x1'));var logger=require(_0xcfae('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcfae('0x3'));var fs=require('fs');var path=require(_0xcfae('0x4'));var rimraf=require(_0xcfae('0x5'));var config=require(_0xcfae('0x6'));var attributes=require(_0xcfae('0x7'));module['exports']=function(_0x5dcf1e,_0x31e193){return _0x5dcf1e[_0xcfae('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0xcfae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f49=['util','api','moment','bluebird','path','rimraf','exports','TeamVoiceQueue','lodash'];(function(_0x3ac011,_0x586d8d){var _0x39a47a=function(_0x2ded00){while(--_0x2ded00){_0x3ac011['push'](_0x3ac011['shift']());}};_0x39a47a(++_0x586d8d);}(_0x3f49,0x11f));var _0x93f4=function(_0x5937a1,_0x325780){_0x5937a1=_0x5937a1-0x0;var _0x2509d0=_0x3f49[_0x5937a1];return _0x2509d0;};'use strict';var _=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var logger=require('../../config/logger')(_0x93f4('0x2'));var moment=require(_0x93f4('0x3'));var BPromise=require(_0x93f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93f4('0x5'));var rimraf=require(_0x93f4('0x6'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0x93f4('0x7')]=function(_0x38eb6c,_0x2dfdf7){return _0x38eb6c['define'](_0x93f4('0x8'),attributes,{'tableName':'team_has_voice_queues','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 9dd69e2..ee18270 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 _0xbe7c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xbe7c,0x108));var _0xcbe7=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbe7c[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xcbe7('0x0'));var util=require(_0xcbe7('0x1'));var moment=require(_0xcbe7('0x2'));var BPromise=require(_0xcbe7('0x3'));var rs=require(_0xcbe7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbe7('0x5'))['db'];var utils=require(_0xcbe7('0x6'));var logger=require('../../config/logger')(_0xcbe7('0x7'));var config=require(_0xcbe7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcbe7('0x9')][_0xcbe7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x466b19,_0x4b7021,_0x673d55){return new BPromise(function(_0x1e1bff,_0x246aad){return client['request'](_0x466b19,_0x673d55)[_0xcbe7('0xb')](function(_0x47820a){logger[_0xcbe7('0xc')](_0xcbe7('0xd'),_0x4b7021,_0xcbe7('0xe'));logger[_0xcbe7('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4b7021,_0xcbe7('0xe'),JSON['stringify'](_0x47820a));if(_0x47820a['error']){if(_0x47820a[_0xcbe7('0x10')][_0xcbe7('0x11')]===0x1f4){logger[_0xcbe7('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4b7021,_0x47820a[_0xcbe7('0x10')]['message']);return _0x246aad(_0x47820a[_0xcbe7('0x10')][_0xcbe7('0x12')]);}logger[_0xcbe7('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4b7021,_0x47820a[_0xcbe7('0x10')][_0xcbe7('0x12')]);return _0x1e1bff(_0x47820a['error'][_0xcbe7('0x12')]);}else{logger[_0xcbe7('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4b7021,_0xcbe7('0xe'));_0x1e1bff(_0x47820a['result'][_0xcbe7('0x12')]);}})['catch'](function(_0x391d35){logger['error'](_0xcbe7('0xd'),_0x4b7021,_0x391d35);_0x246aad(_0x391d35);});});} \ No newline at end of file +var _0x28bc=['info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4b3618,_0x3f02d8){var _0x410aa5=function(_0x5e9847){while(--_0x5e9847){_0x4b3618['push'](_0x4b3618['shift']());}};_0x410aa5(++_0x3f02d8);}(_0x28bc,0x79));var _0xc28b=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x28bc[_0x3a7a9c];return _0x59156e;};'use strict';var _=require(_0xc28b('0x0'));var util=require(_0xc28b('0x1'));var moment=require(_0xc28b('0x2'));var BPromise=require(_0xc28b('0x3'));var rs=require(_0xc28b('0x4'));var fs=require('fs');var Redis=require(_0xc28b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc28b('0x6'));var logger=require(_0xc28b('0x7'))(_0xc28b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc28b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a581d,_0x123671,_0x387746){return new BPromise(function(_0x22a92a,_0x18fc74){return client[_0xc28b('0xa')](_0x1a581d,_0x387746)[_0xc28b('0xb')](function(_0x107339){logger['info'](_0xc28b('0xc'),_0x123671,_0xc28b('0xd'));logger[_0xc28b('0xe')](_0xc28b('0xf'),_0x123671,_0xc28b('0xd'),JSON[_0xc28b('0x10')](_0x107339));if(_0x107339[_0xc28b('0x11')]){if(_0x107339[_0xc28b('0x11')]['code']===0x1f4){logger[_0xc28b('0x11')](_0xc28b('0xc'),_0x123671,_0x107339[_0xc28b('0x11')]['message']);return _0x18fc74(_0x107339[_0xc28b('0x11')]['message']);}logger['error'](_0xc28b('0xc'),_0x123671,_0x107339['error'][_0xc28b('0x12')]);return _0x22a92a(_0x107339['error'][_0xc28b('0x12')]);}else{logger[_0xc28b('0x13')](_0xc28b('0xc'),_0x123671,_0xc28b('0xd'));_0x22a92a(_0x107339['result'][_0xc28b('0x12')]);}})['catch'](function(_0x23a2c4){logger['error'](_0xc28b('0xc'),_0x123671,_0x23a2c4);_0x18fc74(_0x23a2c4);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index bd1fbbb..29d0685 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 _0x0a1c=['show','post','create','put','delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id'];(function(_0x1ec92b,_0x2adfc3){var _0x3e9ac2=function(_0x55d289){while(--_0x55d289){_0x1ec92b['push'](_0x1ec92b['shift']());}};_0x3e9ac2(++_0x2adfc3);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x0a1c[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0a1('0x0'));var timeout=require(_0xc0a1('0x1'));var express=require(_0xc0a1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc0a1('0x3'));var interaction=require(_0xc0a1('0x4'));var config=require(_0xc0a1('0x5'));var controller=require(_0xc0a1('0x6'));router[_0xc0a1('0x7')]('/',auth[_0xc0a1('0x8')](),controller[_0xc0a1('0x9')]);router[_0xc0a1('0x7')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller[_0xc0a1('0xb')]);router[_0xc0a1('0xc')]('/',auth[_0xc0a1('0x8')](),controller[_0xc0a1('0xd')]);router[_0xc0a1('0xe')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller['update']);router[_0xc0a1('0xf')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller['destroy']);module[_0xc0a1('0x10')]=router; \ No newline at end of file +var _0xe3b3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe3b3,0x1b3));var _0x3e3b=function(_0x3d0efc,_0x3b0a48){_0x3d0efc=_0x3d0efc-0x0;var _0x10cee7=_0xe3b3[_0x3d0efc];return _0x10cee7;};'use strict';var multer=require(_0x3e3b('0x0'));var util=require(_0x3e3b('0x1'));var path=require(_0x3e3b('0x2'));var timeout=require(_0x3e3b('0x3'));var express=require(_0x3e3b('0x4'));var router=express[_0x3e3b('0x5')]();var fs_extra=require(_0x3e3b('0x6'));var auth=require(_0x3e3b('0x7'));var interaction=require(_0x3e3b('0x8'));var config=require(_0x3e3b('0x9'));var controller=require('./template.controller');router[_0x3e3b('0xa')]('/',auth[_0x3e3b('0xb')](),controller[_0x3e3b('0xc')]);router['get'](_0x3e3b('0xd'),auth[_0x3e3b('0xb')](),controller[_0x3e3b('0xe')]);router[_0x3e3b('0xf')]('/',auth[_0x3e3b('0xb')](),controller[_0x3e3b('0x10')]);router[_0x3e3b('0x11')](_0x3e3b('0xd'),auth[_0x3e3b('0xb')](),controller['update']);router[_0x3e3b('0x12')]('/:id',auth[_0x3e3b('0xb')](),controller[_0x3e3b('0x13')]);module[_0x3e3b('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 23aa864..c27b579 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 _0x8d98=['sequelize','STRING','TEXT'];(function(_0x23f0e1,_0x11d94b){var _0x257f0d=function(_0xab63c7){while(--_0xab63c7){_0x23f0e1['push'](_0x23f0e1['shift']());}};_0x257f0d(++_0x11d94b);}(_0x8d98,0xd5));var _0x88d9=function(_0x3f5389,_0x55588e){_0x3f5389=_0x3f5389-0x0;var _0x1734a4=_0x8d98[_0x3f5389];return _0x1734a4;};'use strict';var Sequelize=require(_0x88d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x88d9('0x1')]},'description':{'type':Sequelize[_0x88d9('0x1')]},'html':{'type':Sequelize[_0x88d9('0x2')]}}; \ No newline at end of file +var _0x73f9=['exports','STRING','TEXT','sequelize'];(function(_0x2da6fe,_0x4be0be){var _0x1eb835=function(_0x1a1997){while(--_0x1a1997){_0x2da6fe['push'](_0x2da6fe['shift']());}};_0x1eb835(++_0x4be0be);}(_0x73f9,0xa3));var _0x973f=function(_0x333a7b,_0x4f423c){_0x333a7b=_0x333a7b-0x0;var _0x54f72a=_0x73f9[_0x333a7b];return _0x54f72a;};'use strict';var Sequelize=require(_0x973f('0x0'));module[_0x973f('0x1')]={'name':{'type':Sequelize[_0x973f('0x2')]},'description':{'type':Sequelize[_0x973f('0x2')]},'html':{'type':Sequelize[_0x973f('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 670320c..73fb20c 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 _0xbee9=['filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','rows','catch','show','params','includeAll','include','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','fast-json-patch','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Templates','UserProfileResource','error','name','send','index','map','Template','fieldName','type','key','model','query','keys'];(function(_0x150762,_0xd8e082){var _0x232767=function(_0x570e88){while(--_0x570e88){_0x150762['push'](_0x150762['shift']());}};_0x232767(++_0xd8e082);}(_0xbee9,0x145));var _0x9bee=function(_0x3f5fc8,_0x4f4379){_0x3f5fc8=_0x3f5fc8-0x0;var _0x529645=_0xbee9[_0x3f5fc8];return _0x529645;};'use strict';var emlformat=require(_0x9bee('0x0'));var rimraf=require(_0x9bee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bee('0x2'));var rp=require('request-promise');var moment=require(_0x9bee('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9bee('0x4'));var path=require('path');var sox=require(_0x9bee('0x5'));var csv=require(_0x9bee('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bee('0x7'));var _=require(_0x9bee('0x8'));var squel=require(_0x9bee('0x9'));var crypto=require(_0x9bee('0xa'));var jsforce=require(_0x9bee('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9bee('0xc'));var Redis=require('ioredis');var authService=require(_0x9bee('0xd'));var qs=require(_0x9bee('0xe'));var as=require(_0x9bee('0xf'));var hardwareService=require(_0x9bee('0x10'));var logger=require('../../config/logger')(_0x9bee('0x11'));var utils=require(_0x9bee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9bee('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71668f,_0x2b8e50){_0x2b8e50=_0x2b8e50||0xcc;return function(_0x497716){if(_0x497716){return _0x71668f[_0x9bee('0x14')](_0x2b8e50);}return _0x71668f['status'](_0x2b8e50)[_0x9bee('0x15')]();};}function respondWithResult(_0x6adcdf,_0x37c366){_0x37c366=_0x37c366||0xc8;return function(_0x5fddbc){if(_0x5fddbc){return _0x6adcdf[_0x9bee('0x16')](_0x37c366)[_0x9bee('0x17')](_0x5fddbc);}};}function respondWithFilteredResult(_0x364505,_0x43011a){return function(_0x5a3a4d){if(_0x5a3a4d){var _0x5bec85=typeof _0x43011a[_0x9bee('0x18')]===_0x9bee('0x19')&&typeof _0x43011a['limit']===_0x9bee('0x19');var _0x4eb669=_0x5a3a4d[_0x9bee('0x1a')];var _0x1d870d=_0x5bec85?0x0:_0x43011a[_0x9bee('0x18')];var _0x13d0eb=_0x5bec85?_0x5a3a4d[_0x9bee('0x1a')]:_0x43011a[_0x9bee('0x18')]+_0x43011a[_0x9bee('0x1b')];var _0x3f5fad;if(_0x13d0eb>=_0x4eb669){_0x13d0eb=_0x4eb669;_0x3f5fad=0xc8;}else{_0x3f5fad=0xce;}_0x364505['status'](_0x3f5fad);return _0x364505[_0x9bee('0x1c')](_0x9bee('0x1d'),_0x1d870d+'-'+_0x13d0eb+'/'+_0x4eb669)[_0x9bee('0x17')](_0x5a3a4d);}return null;};}function patchUpdates(_0x2df288){return function(_0x12f135){try{jsonpatch[_0x9bee('0x1e')](_0x12f135,_0x2df288,!![]);}catch(_0x38c470){return BPromise[_0x9bee('0x1f')](_0x38c470);}return _0x12f135[_0x9bee('0x20')]();};}function saveUpdates(_0x20195a,_0x5be9c4){return function(_0x1dfc61){if(_0x1dfc61){return _0x1dfc61['update'](_0x20195a)[_0x9bee('0x21')](function(_0x568630){return _0x568630;});}return null;};}function removeEntity(_0x27ef5c,_0x2e6d0b){return function(_0x81f101){if(_0x81f101){return _0x81f101[_0x9bee('0x22')]()[_0x9bee('0x21')](function(){var _0x40abaa=_0x81f101[_0x9bee('0x23')]({'plain':!![]});var _0x334a24=_0x9bee('0x24');return db[_0x9bee('0x25')]['destroy']({'where':{'type':_0x334a24,'resourceId':_0x40abaa['id']}})['then'](function(){return _0x81f101;});})['then'](function(){_0x27ef5c[_0x9bee('0x16')](0xcc)[_0x9bee('0x15')]();});}};}function handleEntityNotFound(_0x587062,_0x1ee81a){return function(_0xf08176){if(!_0xf08176){_0x587062[_0x9bee('0x14')](0x194);}return _0xf08176;};}function handleError(_0x4dc28e,_0x1eff8c){_0x1eff8c=_0x1eff8c||0x1f4;return function(_0x48867e){logger[_0x9bee('0x26')](_0x48867e['stack']);if(_0x48867e[_0x9bee('0x27')]){delete _0x48867e[_0x9bee('0x27')];}_0x4dc28e['status'](_0x1eff8c)[_0x9bee('0x28')](_0x48867e);};}exports[_0x9bee('0x29')]=function(_0x513f8b,_0x13386d){var _0x4336d6={},_0x5d2ef3={},_0xceb708={'count':0x0,'rows':[]};var _0x31cb21=_[_0x9bee('0x2a')](db[_0x9bee('0x2b')]['rawAttributes'],function(_0x3b7833){return{'name':_0x3b7833[_0x9bee('0x2c')],'type':_0x3b7833[_0x9bee('0x2d')][_0x9bee('0x2e')]};});_0x5d2ef3[_0x9bee('0x2f')]=_[_0x9bee('0x2a')](_0x31cb21,_0x9bee('0x27'));_0x5d2ef3[_0x9bee('0x30')]=_[_0x9bee('0x31')](_0x513f8b[_0x9bee('0x30')]);_0x5d2ef3[_0x9bee('0x32')]=_[_0x9bee('0x33')](_0x5d2ef3[_0x9bee('0x2f')],_0x5d2ef3[_0x9bee('0x30')]);_0x4336d6[_0x9bee('0x34')]=_['intersection'](_0x5d2ef3[_0x9bee('0x2f')],qs[_0x9bee('0x35')](_0x513f8b[_0x9bee('0x30')]['fields']));_0x4336d6[_0x9bee('0x34')]=_0x4336d6[_0x9bee('0x34')][_0x9bee('0x36')]?_0x4336d6[_0x9bee('0x34')]:_0x5d2ef3[_0x9bee('0x2f')];if(!_0x513f8b[_0x9bee('0x30')]['hasOwnProperty']('nolimit')){_0x4336d6[_0x9bee('0x1b')]=qs[_0x9bee('0x1b')](_0x513f8b[_0x9bee('0x30')][_0x9bee('0x1b')]);_0x4336d6[_0x9bee('0x18')]=qs[_0x9bee('0x18')](_0x513f8b[_0x9bee('0x30')][_0x9bee('0x18')]);}_0x4336d6[_0x9bee('0x37')]=qs[_0x9bee('0x38')](_0x513f8b['query'][_0x9bee('0x38')]);_0x4336d6[_0x9bee('0x39')]=qs['filters'](_[_0x9bee('0x3a')](_0x513f8b['query'],_0x5d2ef3[_0x9bee('0x32')]),_0x31cb21);if(_0x513f8b[_0x9bee('0x30')][_0x9bee('0x3b')]){_0x4336d6[_0x9bee('0x39')]=_[_0x9bee('0x3c')](_0x4336d6[_0x9bee('0x39')],{'$or':_[_0x9bee('0x2a')](_0x31cb21,function(_0x2a21ed){if(_0x2a21ed[_0x9bee('0x2d')]!=='VIRTUAL'){var _0x46cc9a={};_0x46cc9a[_0x2a21ed[_0x9bee('0x27')]]={'$like':'%'+_0x513f8b[_0x9bee('0x30')][_0x9bee('0x3b')]+'%'};return _0x46cc9a;}})});}_0x4336d6=_['merge']({},_0x4336d6,_0x513f8b['options']);var _0x218d21={'where':_0x4336d6[_0x9bee('0x39')]};return db[_0x9bee('0x2b')][_0x9bee('0x1a')](_0x218d21)[_0x9bee('0x21')](function(_0x524f4d){_0xceb708['count']=_0x524f4d;if(_0x513f8b[_0x9bee('0x30')]['includeAll']){_0x4336d6['include']=[{'all':!![]}];}return db[_0x9bee('0x2b')]['findAll'](_0x4336d6);})[_0x9bee('0x21')](function(_0x2d8ea0){_0xceb708[_0x9bee('0x3d')]=_0x2d8ea0;return _0xceb708;})[_0x9bee('0x21')](respondWithFilteredResult(_0x13386d,_0x4336d6))[_0x9bee('0x3e')](handleError(_0x13386d,null));};exports[_0x9bee('0x3f')]=function(_0x5765bf,_0x555756){var _0x3c86e8={'raw':!![],'where':{'id':_0x5765bf[_0x9bee('0x40')]['id']}},_0x510ca7={};_0x510ca7[_0x9bee('0x2f')]=_[_0x9bee('0x31')](db[_0x9bee('0x2b')]['rawAttributes']);_0x510ca7[_0x9bee('0x30')]=_[_0x9bee('0x31')](_0x5765bf[_0x9bee('0x30')]);_0x510ca7['filters']=_[_0x9bee('0x33')](_0x510ca7[_0x9bee('0x2f')],_0x510ca7[_0x9bee('0x30')]);_0x3c86e8[_0x9bee('0x34')]=_[_0x9bee('0x33')](_0x510ca7[_0x9bee('0x2f')],qs['fields'](_0x5765bf['query'][_0x9bee('0x35')]));_0x3c86e8[_0x9bee('0x34')]=_0x3c86e8[_0x9bee('0x34')][_0x9bee('0x36')]?_0x3c86e8[_0x9bee('0x34')]:_0x510ca7[_0x9bee('0x2f')];if(_0x5765bf[_0x9bee('0x30')][_0x9bee('0x41')]){_0x3c86e8[_0x9bee('0x42')]=[{'all':!![]}];}_0x3c86e8=_['merge']({},_0x3c86e8,_0x5765bf['options']);return db[_0x9bee('0x2b')][_0x9bee('0x43')](_0x3c86e8)[_0x9bee('0x21')](handleEntityNotFound(_0x555756,null))[_0x9bee('0x21')](respondWithResult(_0x555756,null))[_0x9bee('0x3e')](handleError(_0x555756,null));};exports[_0x9bee('0x44')]=function(_0x1769f6,_0x1b106f){return db[_0x9bee('0x2b')][_0x9bee('0x44')](_0x1769f6[_0x9bee('0x45')],{})[_0x9bee('0x21')](function(_0x2b9227){var _0x2c0eec=_0x1769f6[_0x9bee('0x46')][_0x9bee('0x23')]({'plain':!![]});if(!_0x2c0eec)throw new Error(_0x9bee('0x47'));if(_0x2c0eec['role']===_0x9bee('0x46')){var _0x366a88=_0x2b9227[_0x9bee('0x23')]({'plain':!![]});var _0x263463=_0x9bee('0x24');return db['UserProfileSection'][_0x9bee('0x43')]({'where':{'name':_0x263463,'userProfileId':_0x2c0eec[_0x9bee('0x48')]},'raw':!![]})['then'](function(_0x43e284){if(_0x43e284&&_0x43e284[_0x9bee('0x49')]===0x0){return db[_0x9bee('0x25')][_0x9bee('0x44')]({'name':_0x366a88[_0x9bee('0x27')],'resourceId':_0x366a88['id'],'type':_0x43e284['name'],'sectionId':_0x43e284['id']},{})[_0x9bee('0x21')](function(){return _0x2b9227;});}else{return _0x2b9227;}})[_0x9bee('0x3e')](function(_0x3135ce){logger[_0x9bee('0x26')](_0x9bee('0x4a'),_0x3135ce);throw _0x3135ce;});}return _0x2b9227;})['then'](respondWithResult(_0x1b106f,0xc9))['catch'](handleError(_0x1b106f,null));};exports['update']=function(_0x405f8a,_0x529aa7){if(_0x405f8a['body']['id']){delete _0x405f8a['body']['id'];}return db[_0x9bee('0x2b')][_0x9bee('0x43')]({'where':{'id':_0x405f8a[_0x9bee('0x40')]['id']}})[_0x9bee('0x21')](handleEntityNotFound(_0x529aa7,null))[_0x9bee('0x21')](saveUpdates(_0x405f8a['body'],null))['then'](respondWithResult(_0x529aa7,null))['catch'](handleError(_0x529aa7,null));};exports[_0x9bee('0x22')]=function(_0x17fdf5,_0x35c61e){return db['Template'][_0x9bee('0x43')]({'where':{'id':_0x17fdf5[_0x9bee('0x40')]['id']}})[_0x9bee('0x21')](handleEntityNotFound(_0x35c61e,null))[_0x9bee('0x21')](removeEntity(_0x35c61e,null))['catch'](handleError(_0x35c61e,null));}; \ No newline at end of file +var _0x1bce=['type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','intersection','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','Template','rawAttributes','fieldName','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge'];(function(_0x5a0c29,_0x47af88){var _0x1e378c=function(_0x9f5f95){while(--_0x9f5f95){_0x5a0c29['push'](_0x5a0c29['shift']());}};_0x1e378c(++_0x47af88);}(_0x1bce,0x6a));var _0xe1bc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1bce[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xe1bc('0x0'));var rimraf=require(_0xe1bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe1bc('0x2'));var moment=require(_0xe1bc('0x3'));var BPromise=require(_0xe1bc('0x4'));var Mustache=require(_0xe1bc('0x5'));var util=require(_0xe1bc('0x6'));var path=require('path');var sox=require(_0xe1bc('0x7'));var csv=require(_0xe1bc('0x8'));var ejs=require(_0xe1bc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe1bc('0xa'));var squel=require('squel');var crypto=require(_0xe1bc('0xb'));var jsforce=require(_0xe1bc('0xc'));var deskjs=require(_0xe1bc('0xd'));var toCsv=require(_0xe1bc('0x8'));var querystring=require('querystring');var Papa=require(_0xe1bc('0xe'));var Redis=require(_0xe1bc('0xf'));var authService=require(_0xe1bc('0x10'));var qs=require(_0xe1bc('0x11'));var as=require(_0xe1bc('0x12'));var hardwareService=require(_0xe1bc('0x13'));var logger=require(_0xe1bc('0x14'))(_0xe1bc('0x15'));var utils=require(_0xe1bc('0x16'));var config=require(_0xe1bc('0x17'));var licenseUtil=require(_0xe1bc('0x18'));var db=require(_0xe1bc('0x19'))['db'];function respondWithStatusCode(_0x28382c,_0x2f1295){_0x2f1295=_0x2f1295||0xcc;return function(_0x24ec96){if(_0x24ec96){return _0x28382c[_0xe1bc('0x1a')](_0x2f1295);}return _0x28382c[_0xe1bc('0x1b')](_0x2f1295)[_0xe1bc('0x1c')]();};}function respondWithResult(_0x62a3a,_0x37fc9f){_0x37fc9f=_0x37fc9f||0xc8;return function(_0x15e9fb){if(_0x15e9fb){return _0x62a3a[_0xe1bc('0x1b')](_0x37fc9f)[_0xe1bc('0x1d')](_0x15e9fb);}};}function respondWithFilteredResult(_0x4a8977,_0xb3fe61){return function(_0x303253){if(_0x303253){var _0x152604=typeof _0xb3fe61[_0xe1bc('0x1e')]===_0xe1bc('0x1f')&&typeof _0xb3fe61[_0xe1bc('0x20')]===_0xe1bc('0x1f');var _0x2e55a1=_0x303253['count'];var _0x4c3819=_0x152604?0x0:_0xb3fe61[_0xe1bc('0x1e')];var _0x2fab1d=_0x152604?_0x303253['count']:_0xb3fe61['offset']+_0xb3fe61['limit'];var _0x1dbf34;if(_0x2fab1d>=_0x2e55a1){_0x2fab1d=_0x2e55a1;_0x1dbf34=0xc8;}else{_0x1dbf34=0xce;}_0x4a8977[_0xe1bc('0x1b')](_0x1dbf34);return _0x4a8977[_0xe1bc('0x21')](_0xe1bc('0x22'),_0x4c3819+'-'+_0x2fab1d+'/'+_0x2e55a1)[_0xe1bc('0x1d')](_0x303253);}return null;};}function patchUpdates(_0x3b75d8){return function(_0x43ec67){try{jsonpatch['apply'](_0x43ec67,_0x3b75d8,!![]);}catch(_0x5e529c){return BPromise[_0xe1bc('0x23')](_0x5e529c);}return _0x43ec67[_0xe1bc('0x24')]();};}function saveUpdates(_0x385d42,_0x5c5339){return function(_0x5539b6){if(_0x5539b6){return _0x5539b6[_0xe1bc('0x25')](_0x385d42)[_0xe1bc('0x26')](function(_0x3fddd4){return _0x3fddd4;});}return null;};}function removeEntity(_0x5a2d3a,_0x30067b){return function(_0x17b270){if(_0x17b270){return _0x17b270[_0xe1bc('0x27')]()[_0xe1bc('0x26')](function(){var _0x240c43=_0x17b270[_0xe1bc('0x28')]({'plain':!![]});var _0xe26448=_0xe1bc('0x29');return db[_0xe1bc('0x2a')][_0xe1bc('0x27')]({'where':{'type':_0xe26448,'resourceId':_0x240c43['id']}})[_0xe1bc('0x26')](function(){return _0x17b270;});})[_0xe1bc('0x26')](function(){_0x5a2d3a[_0xe1bc('0x1b')](0xcc)[_0xe1bc('0x1c')]();});}};}function handleEntityNotFound(_0xba291c,_0x3d8fa5){return function(_0x50c68e){if(!_0x50c68e){_0xba291c[_0xe1bc('0x1a')](0x194);}return _0x50c68e;};}function handleError(_0x6697f,_0x15d93e){_0x15d93e=_0x15d93e||0x1f4;return function(_0x4455a4){logger[_0xe1bc('0x2b')](_0x4455a4[_0xe1bc('0x2c')]);if(_0x4455a4['name']){delete _0x4455a4[_0xe1bc('0x2d')];}_0x6697f[_0xe1bc('0x1b')](_0x15d93e)['send'](_0x4455a4);};}exports[_0xe1bc('0x2e')]=function(_0x107d8e,_0x51622f){var _0x4bc4d6={},_0x29e2fc={},_0x157feb={'count':0x0,'rows':[]};var _0x594d46=_[_0xe1bc('0x2f')](db[_0xe1bc('0x30')][_0xe1bc('0x31')],function(_0x24d71d){return{'name':_0x24d71d[_0xe1bc('0x32')],'type':_0x24d71d['type'][_0xe1bc('0x33')]};});_0x29e2fc['model']=_[_0xe1bc('0x2f')](_0x594d46,_0xe1bc('0x2d'));_0x29e2fc[_0xe1bc('0x34')]=_[_0xe1bc('0x35')](_0x107d8e['query']);_0x29e2fc['filters']=_['intersection'](_0x29e2fc[_0xe1bc('0x36')],_0x29e2fc['query']);_0x4bc4d6[_0xe1bc('0x37')]=_['intersection'](_0x29e2fc[_0xe1bc('0x36')],qs[_0xe1bc('0x38')](_0x107d8e[_0xe1bc('0x34')][_0xe1bc('0x38')]));_0x4bc4d6[_0xe1bc('0x37')]=_0x4bc4d6['attributes'][_0xe1bc('0x39')]?_0x4bc4d6[_0xe1bc('0x37')]:_0x29e2fc['model'];if(!_0x107d8e[_0xe1bc('0x34')][_0xe1bc('0x3a')](_0xe1bc('0x3b'))){_0x4bc4d6['limit']=qs[_0xe1bc('0x20')](_0x107d8e['query'][_0xe1bc('0x20')]);_0x4bc4d6[_0xe1bc('0x1e')]=qs['offset'](_0x107d8e[_0xe1bc('0x34')][_0xe1bc('0x1e')]);}_0x4bc4d6[_0xe1bc('0x3c')]=qs[_0xe1bc('0x3d')](_0x107d8e[_0xe1bc('0x34')][_0xe1bc('0x3d')]);_0x4bc4d6[_0xe1bc('0x3e')]=qs[_0xe1bc('0x3f')](_['pick'](_0x107d8e['query'],_0x29e2fc['filters']),_0x594d46);if(_0x107d8e[_0xe1bc('0x34')][_0xe1bc('0x40')]){_0x4bc4d6[_0xe1bc('0x3e')]=_[_0xe1bc('0x41')](_0x4bc4d6['where'],{'$or':_['map'](_0x594d46,function(_0xe8cee7){if(_0xe8cee7[_0xe1bc('0x42')]!==_0xe1bc('0x43')){var _0x3b3e93={};_0x3b3e93[_0xe8cee7[_0xe1bc('0x2d')]]={'$like':'%'+_0x107d8e[_0xe1bc('0x34')][_0xe1bc('0x40')]+'%'};return _0x3b3e93;}})});}_0x4bc4d6=_[_0xe1bc('0x41')]({},_0x4bc4d6,_0x107d8e[_0xe1bc('0x44')]);var _0x4cac07={'where':_0x4bc4d6[_0xe1bc('0x3e')]};return db['Template'][_0xe1bc('0x45')](_0x4cac07)[_0xe1bc('0x26')](function(_0x59bb0d){_0x157feb['count']=_0x59bb0d;if(_0x107d8e[_0xe1bc('0x34')][_0xe1bc('0x46')]){_0x4bc4d6[_0xe1bc('0x47')]=[{'all':!![]}];}return db[_0xe1bc('0x30')][_0xe1bc('0x48')](_0x4bc4d6);})['then'](function(_0x2269c5){_0x157feb[_0xe1bc('0x49')]=_0x2269c5;return _0x157feb;})['then'](respondWithFilteredResult(_0x51622f,_0x4bc4d6))[_0xe1bc('0x4a')](handleError(_0x51622f,null));};exports['show']=function(_0x3f715f,_0x28afcb){var _0x1d0e34={'raw':!![],'where':{'id':_0x3f715f[_0xe1bc('0x4b')]['id']}},_0x36330a={};_0x36330a[_0xe1bc('0x36')]=_[_0xe1bc('0x35')](db[_0xe1bc('0x30')][_0xe1bc('0x31')]);_0x36330a[_0xe1bc('0x34')]=_['keys'](_0x3f715f[_0xe1bc('0x34')]);_0x36330a[_0xe1bc('0x3f')]=_[_0xe1bc('0x4c')](_0x36330a[_0xe1bc('0x36')],_0x36330a[_0xe1bc('0x34')]);_0x1d0e34[_0xe1bc('0x37')]=_[_0xe1bc('0x4c')](_0x36330a[_0xe1bc('0x36')],qs[_0xe1bc('0x38')](_0x3f715f[_0xe1bc('0x34')][_0xe1bc('0x38')]));_0x1d0e34[_0xe1bc('0x37')]=_0x1d0e34[_0xe1bc('0x37')][_0xe1bc('0x39')]?_0x1d0e34['attributes']:_0x36330a[_0xe1bc('0x36')];if(_0x3f715f[_0xe1bc('0x34')][_0xe1bc('0x46')]){_0x1d0e34[_0xe1bc('0x47')]=[{'all':!![]}];}_0x1d0e34=_['merge']({},_0x1d0e34,_0x3f715f[_0xe1bc('0x44')]);return db[_0xe1bc('0x30')][_0xe1bc('0x4d')](_0x1d0e34)[_0xe1bc('0x26')](handleEntityNotFound(_0x28afcb,null))[_0xe1bc('0x26')](respondWithResult(_0x28afcb,null))[_0xe1bc('0x4a')](handleError(_0x28afcb,null));};exports[_0xe1bc('0x4e')]=function(_0x368b3d,_0x53f420){return db[_0xe1bc('0x30')][_0xe1bc('0x4e')](_0x368b3d['body'],{})[_0xe1bc('0x26')](function(_0x41ed61){var _0x4cbd2c=_0x368b3d['user']['get']({'plain':!![]});if(!_0x4cbd2c)throw new Error(_0xe1bc('0x4f'));if(_0x4cbd2c[_0xe1bc('0x50')]===_0xe1bc('0x51')){var _0x3fe2c8=_0x41ed61[_0xe1bc('0x28')]({'plain':!![]});var _0xcfb160='Templates';return db['UserProfileSection'][_0xe1bc('0x4d')]({'where':{'name':_0xcfb160,'userProfileId':_0x4cbd2c[_0xe1bc('0x52')]},'raw':!![]})['then'](function(_0x462e5a){if(_0x462e5a&&_0x462e5a[_0xe1bc('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x3fe2c8['name'],'resourceId':_0x3fe2c8['id'],'type':_0x462e5a[_0xe1bc('0x2d')],'sectionId':_0x462e5a['id']},{})[_0xe1bc('0x26')](function(){return _0x41ed61;});}else{return _0x41ed61;}})[_0xe1bc('0x4a')](function(_0xdb9249){logger['error'](_0xe1bc('0x54'),_0xdb9249);throw _0xdb9249;});}return _0x41ed61;})[_0xe1bc('0x26')](respondWithResult(_0x53f420,0xc9))[_0xe1bc('0x4a')](handleError(_0x53f420,null));};exports[_0xe1bc('0x25')]=function(_0x5e2a60,_0x3d4315){if(_0x5e2a60[_0xe1bc('0x55')]['id']){delete _0x5e2a60[_0xe1bc('0x55')]['id'];}return db[_0xe1bc('0x30')]['find']({'where':{'id':_0x5e2a60[_0xe1bc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d4315,null))[_0xe1bc('0x26')](saveUpdates(_0x5e2a60[_0xe1bc('0x55')],null))[_0xe1bc('0x26')](respondWithResult(_0x3d4315,null))[_0xe1bc('0x4a')](handleError(_0x3d4315,null));};exports['destroy']=function(_0x56113c,_0x545401){return db[_0xe1bc('0x30')][_0xe1bc('0x4d')]({'where':{'id':_0x56113c[_0xe1bc('0x4b')]['id']}})[_0xe1bc('0x26')](handleEntityNotFound(_0x545401,null))[_0xe1bc('0x26')](removeEntity(_0x545401,null))[_0xe1bc('0x4a')](handleError(_0x545401,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 737f7b3..b139082 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 _0x5ab7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ab7,0xb2));var _0x75ab=function(_0x9230a2,_0x255d18){_0x9230a2=_0x9230a2-0x0;var _0x5c00dd=_0x5ab7[_0x9230a2];return _0x5c00dd;};'use strict';var _=require(_0x75ab('0x0'));var util=require(_0x75ab('0x1'));var logger=require(_0x75ab('0x2'))(_0x75ab('0x3'));var moment=require(_0x75ab('0x4'));var BPromise=require(_0x75ab('0x5'));var rp=require(_0x75ab('0x6'));var fs=require('fs');var path=require(_0x75ab('0x7'));var rimraf=require(_0x75ab('0x8'));var config=require(_0x75ab('0x9'));var attributes=require(_0x75ab('0xa'));module[_0x75ab('0xb')]=function(_0x1c5184,_0x1fead0){return _0x1c5184[_0x75ab('0xc')](_0x75ab('0xd'),attributes,{'tableName':_0x75ab('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc27f=['moment','bluebird','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util'];(function(_0x14d53b,_0x2146b6){var _0x5e9034=function(_0x18bb49){while(--_0x18bb49){_0x14d53b['push'](_0x14d53b['shift']());}};_0x5e9034(++_0x2146b6);}(_0xc27f,0xee));var _0xfc27=function(_0x35c5de,_0x12eb96){_0x35c5de=_0x35c5de-0x0;var _0x41ddff=_0xc27f[_0x35c5de];return _0x41ddff;};'use strict';var _=require(_0xfc27('0x0'));var util=require(_0xfc27('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfc27('0x2'));var BPromise=require(_0xfc27('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc27('0x4'));var config=require(_0xfc27('0x5'));var attributes=require(_0xfc27('0x6'));module[_0xfc27('0x7')]=function(_0x5dd3c0,_0x1625f2){return _0x5dd3c0[_0xfc27('0x8')]('Template',attributes,{'tableName':_0xfc27('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index aa6df0d..5b092ad 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 _0x60e1=['rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Template','findAll','options','raw','limit','map','attributes','model','include','GetTemplate','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2fd249,_0xd0fdd6){var _0xfa0151=function(_0x144542){while(--_0x144542){_0x2fd249['push'](_0x2fd249['shift']());}};_0xfa0151(++_0xd0fdd6);}(_0x60e1,0x14c));var _0x160e=function(_0x264bea,_0x2a6529){_0x264bea=_0x264bea-0x0;var _0x4981a8=_0x60e1[_0x264bea];return _0x4981a8;};'use strict';var _=require(_0x160e('0x0'));var util=require('util');var moment=require(_0x160e('0x1'));var BPromise=require(_0x160e('0x2'));var rs=require(_0x160e('0x3'));var fs=require('fs');var Redis=require(_0x160e('0x4'));var db=require(_0x160e('0x5'))['db'];var utils=require(_0x160e('0x6'));var logger=require(_0x160e('0x7'))(_0x160e('0x8'));var config=require(_0x160e('0x9'));var jayson=require(_0x160e('0xa'));var client=jayson['client'][_0x160e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4da502,_0x3b58ca,_0x195a22){return new BPromise(function(_0xbc9baa,_0x5cc74f){return client[_0x160e('0xc')](_0x4da502,_0x195a22)[_0x160e('0xd')](function(_0x2b90da){logger[_0x160e('0xe')](_0x160e('0xf'),_0x3b58ca,_0x160e('0x10'));logger['debug'](_0x160e('0x11'),_0x3b58ca,_0x160e('0x10'),JSON[_0x160e('0x12')](_0x2b90da));if(_0x2b90da[_0x160e('0x13')]){if(_0x2b90da[_0x160e('0x13')][_0x160e('0x14')]===0x1f4){logger[_0x160e('0x13')]('Template,\x20%s,\x20%s',_0x3b58ca,_0x2b90da[_0x160e('0x13')][_0x160e('0x15')]);return _0x5cc74f(_0x2b90da[_0x160e('0x13')][_0x160e('0x15')]);}logger['error'](_0x160e('0xf'),_0x3b58ca,_0x2b90da[_0x160e('0x13')][_0x160e('0x15')]);return _0xbc9baa(_0x2b90da[_0x160e('0x13')]['message']);}else{logger['info']('Template,\x20%s,\x20%s',_0x3b58ca,'request\x20sent');_0xbc9baa(_0x2b90da[_0x160e('0x16')][_0x160e('0x15')]);}})[_0x160e('0x17')](function(_0x2a5ec5){logger[_0x160e('0x13')](_0x160e('0xf'),_0x3b58ca,_0x2a5ec5);_0x5cc74f(_0x2a5ec5);});});}exports['GetTemplate']=function(_0x37d722){var _0x1edeff=this;return new Promise(function(_0x5c7bde,_0x38561b){return db[_0x160e('0x18')][_0x160e('0x19')]({'raw':_0x37d722[_0x160e('0x1a')]?_0x37d722[_0x160e('0x1a')][_0x160e('0x1b')]===undefined?!![]:![]:!![],'where':_0x37d722['options']?_0x37d722[_0x160e('0x1a')]['where']||null:null,'attributes':_0x37d722[_0x160e('0x1a')]?_0x37d722[_0x160e('0x1a')]['attributes']||null:null,'limit':_0x37d722[_0x160e('0x1a')]?_0x37d722['options'][_0x160e('0x1c')]||null:null,'include':_0x37d722['options']?_0x37d722[_0x160e('0x1a')]['include']?_[_0x160e('0x1d')](_0x37d722[_0x160e('0x1a')]['include'],function(_0x280763){return{'model':db[_0x280763['model']],'as':_0x280763['as'],'attributes':_0x280763[_0x160e('0x1e')],'include':_0x280763['include']?_[_0x160e('0x1d')](_0x280763['include'],function(_0x5e8d17){return{'model':db[_0x5e8d17[_0x160e('0x1f')]],'as':_0x5e8d17['as'],'attributes':_0x5e8d17[_0x160e('0x1e')],'include':_0x5e8d17[_0x160e('0x20')]?_[_0x160e('0x1d')](_0x5e8d17[_0x160e('0x20')],function(_0x34979d){return{'model':db[_0x34979d[_0x160e('0x1f')]],'as':_0x34979d['as'],'attributes':_0x34979d[_0x160e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x160e('0xd')](function(_0x1ce68f){logger[_0x160e('0xe')](_0x160e('0x21'),_0x37d722);logger['debug'](_0x160e('0x21'),_0x37d722,JSON['stringify'](_0x1ce68f));_0x5c7bde(_0x1ce68f);})[_0x160e('0x17')](function(_0x4468ec){logger[_0x160e('0x13')](_0x160e('0x21'),_0x4468ec[_0x160e('0x15')],_0x37d722);_0x38561b(_0x1edeff[_0x160e('0x13')](0x1f4,_0x4468ec[_0x160e('0x15')]));});});}; \ No newline at end of file +var _0xc694=['map','model','attributes','stringify','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTemplate','findAll','options','raw','include'];(function(_0x1aa0e7,_0x498fbd){var _0x55f771=function(_0x595895){while(--_0x595895){_0x1aa0e7['push'](_0x1aa0e7['shift']());}};_0x55f771(++_0x498fbd);}(_0xc694,0x15a));var _0x4c69=function(_0x413426,_0x4f7814){_0x413426=_0x413426-0x0;var _0x5576e2=_0xc694[_0x413426];return _0x5576e2;};'use strict';var _=require(_0x4c69('0x0'));var util=require(_0x4c69('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c69('0x2'));var fs=require('fs');var Redis=require(_0x4c69('0x3'));var db=require(_0x4c69('0x4'))['db'];var utils=require(_0x4c69('0x5'));var logger=require('../../config/logger')(_0x4c69('0x6'));var config=require(_0x4c69('0x7'));var jayson=require(_0x4c69('0x8'));var client=jayson[_0x4c69('0x9')][_0x4c69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42e75b,_0xe37508,_0x24873a){return new BPromise(function(_0x30c871,_0x1b894d){return client['request'](_0x42e75b,_0x24873a)[_0x4c69('0xb')](function(_0x377bd9){logger[_0x4c69('0xc')](_0x4c69('0xd'),_0xe37508,_0x4c69('0xe'));logger[_0x4c69('0xf')](_0x4c69('0x10'),_0xe37508,'request\x20sent',JSON['stringify'](_0x377bd9));if(_0x377bd9[_0x4c69('0x11')]){if(_0x377bd9[_0x4c69('0x11')][_0x4c69('0x12')]===0x1f4){logger[_0x4c69('0x11')](_0x4c69('0xd'),_0xe37508,_0x377bd9[_0x4c69('0x11')][_0x4c69('0x13')]);return _0x1b894d(_0x377bd9[_0x4c69('0x11')][_0x4c69('0x13')]);}logger[_0x4c69('0x11')](_0x4c69('0xd'),_0xe37508,_0x377bd9['error']['message']);return _0x30c871(_0x377bd9[_0x4c69('0x11')][_0x4c69('0x13')]);}else{logger[_0x4c69('0xc')](_0x4c69('0xd'),_0xe37508,_0x4c69('0xe'));_0x30c871(_0x377bd9[_0x4c69('0x14')][_0x4c69('0x13')]);}})['catch'](function(_0x2ae903){logger[_0x4c69('0x11')](_0x4c69('0xd'),_0xe37508,_0x2ae903);_0x1b894d(_0x2ae903);});});}exports[_0x4c69('0x15')]=function(_0x452a8e){var _0x4690f5=this;return new Promise(function(_0x13852a,_0x459a8c){return db['Template'][_0x4c69('0x16')]({'raw':_0x452a8e['options']?_0x452a8e[_0x4c69('0x17')][_0x4c69('0x18')]===undefined?!![]:![]:!![],'where':_0x452a8e['options']?_0x452a8e[_0x4c69('0x17')]['where']||null:null,'attributes':_0x452a8e[_0x4c69('0x17')]?_0x452a8e[_0x4c69('0x17')]['attributes']||null:null,'limit':_0x452a8e['options']?_0x452a8e[_0x4c69('0x17')]['limit']||null:null,'include':_0x452a8e[_0x4c69('0x17')]?_0x452a8e[_0x4c69('0x17')][_0x4c69('0x19')]?_[_0x4c69('0x1a')](_0x452a8e[_0x4c69('0x17')][_0x4c69('0x19')],function(_0x394871){return{'model':db[_0x394871[_0x4c69('0x1b')]],'as':_0x394871['as'],'attributes':_0x394871['attributes'],'include':_0x394871[_0x4c69('0x19')]?_['map'](_0x394871[_0x4c69('0x19')],function(_0x1592a8){return{'model':db[_0x1592a8[_0x4c69('0x1b')]],'as':_0x1592a8['as'],'attributes':_0x1592a8[_0x4c69('0x1c')],'include':_0x1592a8['include']?_[_0x4c69('0x1a')](_0x1592a8[_0x4c69('0x19')],function(_0x1be0a3){return{'model':db[_0x1be0a3['model']],'as':_0x1be0a3['as'],'attributes':_0x1be0a3[_0x4c69('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4c69('0xb')](function(_0x23d2be){logger['info'](_0x4c69('0x15'),_0x452a8e);logger[_0x4c69('0xf')](_0x4c69('0x15'),_0x452a8e,JSON[_0x4c69('0x1d')](_0x23d2be));_0x13852a(_0x23d2be);})[_0x4c69('0x1e')](function(_0x33a4c0){logger[_0x4c69('0x11')](_0x4c69('0x15'),_0x33a4c0[_0x4c69('0x13')],_0x452a8e);_0x459a8c(_0x4690f5[_0x4c69('0x11')](0x1f4,_0x33a4c0[_0x4c69('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index bba1007..62bd648 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 _0xd0f5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','get','getAllConditions','getAnyConditions','/:id/actions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x34992e,_0x4ef4e6){var _0x340418=function(_0x590adc){while(--_0x590adc){_0x34992e['push'](_0x34992e['shift']());}};_0x340418(++_0x4ef4e6);}(_0xd0f5,0xda));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5d0f('0x0'));var util=require(_0x5d0f('0x1'));var path=require('path');var timeout=require(_0x5d0f('0x2'));var express=require(_0x5d0f('0x3'));var router=express[_0x5d0f('0x4')]();var fs_extra=require(_0x5d0f('0x5'));var auth=require(_0x5d0f('0x6'));var interaction=require(_0x5d0f('0x7'));var config=require(_0x5d0f('0x8'));var controller=require(_0x5d0f('0x9'));router['get']('/',auth[_0x5d0f('0xa')](),controller[_0x5d0f('0xb')]);router['get'](_0x5d0f('0xc'),auth[_0x5d0f('0xa')](),controller[_0x5d0f('0xd')]);router[_0x5d0f('0xe')]('/:id/all_conditions',auth[_0x5d0f('0xa')](),controller[_0x5d0f('0xf')]);router[_0x5d0f('0xe')]('/:id/any_conditions',auth[_0x5d0f('0xa')](),controller[_0x5d0f('0x10')]);router['get'](_0x5d0f('0x11'),auth[_0x5d0f('0xa')](),controller['getActions']);router[_0x5d0f('0x12')]('/',auth[_0x5d0f('0xa')](),controller[_0x5d0f('0x13')]);router[_0x5d0f('0x12')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x5d0f('0x14')]);router['post'](_0x5d0f('0x15'),auth[_0x5d0f('0xa')](),controller[_0x5d0f('0x16')]);router[_0x5d0f('0x12')](_0x5d0f('0x11'),auth[_0x5d0f('0xa')](),controller[_0x5d0f('0x17')]);router[_0x5d0f('0x18')](_0x5d0f('0xc'),auth[_0x5d0f('0xa')](),controller[_0x5d0f('0x19')]);router['delete']('/:id',auth[_0x5d0f('0xa')](),controller[_0x5d0f('0x1a')]);module[_0x5d0f('0x1b')]=router; \ No newline at end of file +var _0x5226=['/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','/:id/any_conditions','addAnyCondition','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show'];(function(_0x254276,_0x209ac7){var _0x4152d1=function(_0x1858fc){while(--_0x1858fc){_0x254276['push'](_0x254276['shift']());}};_0x4152d1(++_0x209ac7);}(_0x5226,0x16c));var _0x6522=function(_0x3e83d0,_0x4fdcd3){_0x3e83d0=_0x3e83d0-0x0;var _0x70c69d=_0x5226[_0x3e83d0];return _0x70c69d;};'use strict';var multer=require(_0x6522('0x0'));var util=require(_0x6522('0x1'));var path=require(_0x6522('0x2'));var timeout=require(_0x6522('0x3'));var express=require(_0x6522('0x4'));var router=express['Router']();var fs_extra=require(_0x6522('0x5'));var auth=require(_0x6522('0x6'));var interaction=require(_0x6522('0x7'));var config=require('../../config/environment');var controller=require(_0x6522('0x8'));router[_0x6522('0x9')]('/',auth[_0x6522('0xa')](),controller[_0x6522('0xb')]);router[_0x6522('0x9')](_0x6522('0xc'),auth[_0x6522('0xa')](),controller[_0x6522('0xd')]);router['get'](_0x6522('0xe'),auth['isAuthenticated'](),controller[_0x6522('0xf')]);router['get']('/:id/any_conditions',auth[_0x6522('0xa')](),controller[_0x6522('0x10')]);router[_0x6522('0x9')](_0x6522('0x11'),auth[_0x6522('0xa')](),controller[_0x6522('0x12')]);router['post']('/',auth[_0x6522('0xa')](),controller['create']);router[_0x6522('0x13')](_0x6522('0xe'),auth[_0x6522('0xa')](),controller['addAllCondition']);router[_0x6522('0x13')](_0x6522('0x14'),auth['isAuthenticated'](),controller[_0x6522('0x15')]);router[_0x6522('0x13')]('/:id/actions',auth['isAuthenticated'](),controller['addAction']);router[_0x6522('0x16')](_0x6522('0xc'),auth[_0x6522('0xa')](),controller[_0x6522('0x17')]);router[_0x6522('0x18')]('/:id',auth[_0x6522('0xa')](),controller[_0x6522('0x19')]);module[_0x6522('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ea80c42..b502122 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 _0xdbcf=['sequelize','exports','STRING','BOOLEAN'];(function(_0x289713,_0x116e64){var _0x37f991=function(_0x118696){while(--_0x118696){_0x289713['push'](_0x289713['shift']());}};_0x37f991(++_0x116e64);}(_0xdbcf,0x158));var _0xfdbc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdbcf[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xfdbc('0x0'));module[_0xfdbc('0x1')]={'name':{'type':Sequelize[_0xfdbc('0x2')]},'channel':{'type':Sequelize[_0xfdbc('0x2')]},'description':{'type':Sequelize[_0xfdbc('0x2')]},'status':{'type':Sequelize[_0xfdbc('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x771a=['exports','STRING','sequelize'];(function(_0x477026,_0x1a60e1){var _0x47d9d8=function(_0xa83c4b){while(--_0xa83c4b){_0x477026['push'](_0x477026['shift']());}};_0x47d9d8(++_0x1a60e1);}(_0x771a,0x1e2));var _0xa771=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x771a[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0xa771('0x0'));module[_0xa771('0x1')]={'name':{'type':Sequelize[_0xa771('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa771('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index c61683e..4efb551 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 _0x35f5=['json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','sendStatus','error','stack','name','index','map','Trigger','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','include','rows','catch','show','keys','length','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','rawAttributes','hasOwnProperty','getAnyConditions','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','end','status'];(function(_0x3da72b,_0x4fd809){var _0xc64ac4=function(_0x387e50){while(--_0x387e50){_0x3da72b['push'](_0x3da72b['shift']());}};_0xc64ac4(++_0x4fd809);}(_0x35f5,0x103));var _0x535f=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x35f5[_0x484cac];return _0x1d6e77;};'use strict';var emlformat=require(_0x535f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x535f('0x1'));var jsonpatch=require(_0x535f('0x2'));var rp=require(_0x535f('0x3'));var moment=require(_0x535f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x535f('0x5'));var util=require(_0x535f('0x6'));var path=require(_0x535f('0x7'));var sox=require(_0x535f('0x8'));var csv=require(_0x535f('0x9'));var ejs=require(_0x535f('0xa'));var fs=require('fs');var fs_extra=require(_0x535f('0xb'));var _=require('lodash');var squel=require(_0x535f('0xc'));var crypto=require(_0x535f('0xd'));var jsforce=require(_0x535f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x535f('0x9'));var querystring=require(_0x535f('0xf'));var Papa=require(_0x535f('0x10'));var Redis=require('ioredis');var authService=require(_0x535f('0x11'));var qs=require(_0x535f('0x12'));var as=require(_0x535f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x535f('0x14'))(_0x535f('0x15'));var utils=require(_0x535f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x535f('0x17'))['db'];function respondWithStatusCode(_0x58e8e9,_0x11c367){_0x11c367=_0x11c367||0xcc;return function(_0x1d4352){if(_0x1d4352){return _0x58e8e9['sendStatus'](_0x11c367);}return _0x58e8e9['status'](_0x11c367)[_0x535f('0x18')]();};}function respondWithResult(_0x14458e,_0x5ada12){_0x5ada12=_0x5ada12||0xc8;return function(_0x35ec0b){if(_0x35ec0b){return _0x14458e[_0x535f('0x19')](_0x5ada12)[_0x535f('0x1a')](_0x35ec0b);}};}function respondWithFilteredResult(_0x38dc97,_0x585341){return function(_0x3b657d){if(_0x3b657d){var _0x807d8b=typeof _0x585341[_0x535f('0x1b')]==='undefined'&&typeof _0x585341[_0x535f('0x1c')]===_0x535f('0x1d');var _0x3d0464=_0x3b657d[_0x535f('0x1e')];var _0x368651=_0x807d8b?0x0:_0x585341[_0x535f('0x1b')];var _0x31ebb9=_0x807d8b?_0x3b657d['count']:_0x585341[_0x535f('0x1b')]+_0x585341[_0x535f('0x1c')];var _0x4c9e3e;if(_0x31ebb9>=_0x3d0464){_0x31ebb9=_0x3d0464;_0x4c9e3e=0xc8;}else{_0x4c9e3e=0xce;}_0x38dc97[_0x535f('0x19')](_0x4c9e3e);return _0x38dc97[_0x535f('0x1f')]('Content-Range',_0x368651+'-'+_0x31ebb9+'/'+_0x3d0464)[_0x535f('0x1a')](_0x3b657d);}return null;};}function patchUpdates(_0x4c6671){return function(_0x194fac){try{jsonpatch[_0x535f('0x20')](_0x194fac,_0x4c6671,!![]);}catch(_0x33de81){return BPromise[_0x535f('0x21')](_0x33de81);}return _0x194fac[_0x535f('0x22')]();};}function saveUpdates(_0x388eac,_0x1cec6b){return function(_0x18baa0){if(_0x18baa0){return _0x18baa0[_0x535f('0x23')](_0x388eac)[_0x535f('0x24')](function(_0x56caa9){return _0x56caa9;});}return null;};}function removeEntity(_0x42ef96,_0x5cac07){return function(_0x334209){if(_0x334209){return _0x334209[_0x535f('0x25')]()[_0x535f('0x24')](function(){var _0x59ac5c=_0x334209['get']({'plain':!![]});var _0x187af1=_0x535f('0x26');return db[_0x535f('0x27')]['destroy']({'where':{'type':_0x187af1,'resourceId':_0x59ac5c['id']}})[_0x535f('0x24')](function(){return _0x334209;});})[_0x535f('0x24')](function(){_0x42ef96[_0x535f('0x19')](0xcc)[_0x535f('0x18')]();});}};}function handleEntityNotFound(_0x17dbdd,_0xfb1d3d){return function(_0x531fed){if(!_0x531fed){_0x17dbdd[_0x535f('0x28')](0x194);}return _0x531fed;};}function handleError(_0x3632dd,_0x31c8b7){_0x31c8b7=_0x31c8b7||0x1f4;return function(_0x1bb188){logger[_0x535f('0x29')](_0x1bb188[_0x535f('0x2a')]);if(_0x1bb188[_0x535f('0x2b')]){delete _0x1bb188[_0x535f('0x2b')];}_0x3632dd['status'](_0x31c8b7)['send'](_0x1bb188);};}exports[_0x535f('0x2c')]=function(_0x24c768,_0x14bc54){var _0x3466c8={},_0x4a10fb={},_0x4b7cee={'count':0x0,'rows':[]};var _0x30e7db=_[_0x535f('0x2d')](db[_0x535f('0x2e')]['rawAttributes'],function(_0xf68a0c){return{'name':_0xf68a0c[_0x535f('0x2f')],'type':_0xf68a0c[_0x535f('0x30')][_0x535f('0x31')]};});_0x4a10fb[_0x535f('0x32')]=_['map'](_0x30e7db,_0x535f('0x2b'));_0x4a10fb[_0x535f('0x33')]=_['keys'](_0x24c768[_0x535f('0x33')]);_0x4a10fb['filters']=_[_0x535f('0x34')](_0x4a10fb[_0x535f('0x32')],_0x4a10fb[_0x535f('0x33')]);_0x3466c8[_0x535f('0x35')]=_[_0x535f('0x34')](_0x4a10fb['model'],qs[_0x535f('0x36')](_0x24c768['query'][_0x535f('0x36')]));_0x3466c8[_0x535f('0x35')]=_0x3466c8[_0x535f('0x35')]['length']?_0x3466c8['attributes']:_0x4a10fb[_0x535f('0x32')];if(!_0x24c768[_0x535f('0x33')]['hasOwnProperty'](_0x535f('0x37'))){_0x3466c8[_0x535f('0x1c')]=qs[_0x535f('0x1c')](_0x24c768[_0x535f('0x33')][_0x535f('0x1c')]);_0x3466c8[_0x535f('0x1b')]=qs[_0x535f('0x1b')](_0x24c768['query'][_0x535f('0x1b')]);}_0x3466c8[_0x535f('0x38')]=qs[_0x535f('0x39')](_0x24c768[_0x535f('0x33')][_0x535f('0x39')]);_0x3466c8[_0x535f('0x3a')]=qs[_0x535f('0x3b')](_[_0x535f('0x3c')](_0x24c768[_0x535f('0x33')],_0x4a10fb[_0x535f('0x3b')]),_0x30e7db);if(_0x24c768[_0x535f('0x33')][_0x535f('0x3d')]){_0x3466c8[_0x535f('0x3a')]=_[_0x535f('0x3e')](_0x3466c8[_0x535f('0x3a')],{'$or':_['map'](_0x30e7db,function(_0xc9d403){if(_0xc9d403[_0x535f('0x30')]!=='VIRTUAL'){var _0x585cc6={};_0x585cc6[_0xc9d403[_0x535f('0x2b')]]={'$like':'%'+_0x24c768[_0x535f('0x33')][_0x535f('0x3d')]+'%'};return _0x585cc6;}})});}_0x3466c8=_['merge']({},_0x3466c8,_0x24c768['options']);var _0x250573={'where':_0x3466c8[_0x535f('0x3a')]};return db[_0x535f('0x2e')][_0x535f('0x1e')](_0x250573)['then'](function(_0x21a302){_0x4b7cee[_0x535f('0x1e')]=_0x21a302;if(_0x24c768[_0x535f('0x33')]['includeAll']){_0x3466c8[_0x535f('0x3f')]=[{'all':!![]}];}return db[_0x535f('0x2e')]['findAll'](_0x3466c8);})['then'](function(_0x15d170){_0x4b7cee[_0x535f('0x40')]=_0x15d170;return _0x4b7cee;})[_0x535f('0x24')](respondWithFilteredResult(_0x14bc54,_0x3466c8))[_0x535f('0x41')](handleError(_0x14bc54,null));};exports[_0x535f('0x42')]=function(_0x1783ec,_0x24e4c3){var _0x3cdcb1={'raw':![],'where':{'id':_0x1783ec['params']['id']}},_0x34ebfc={};_0x34ebfc[_0x535f('0x32')]=_['keys'](db[_0x535f('0x2e')]['rawAttributes']);_0x34ebfc[_0x535f('0x33')]=_[_0x535f('0x43')](_0x1783ec[_0x535f('0x33')]);_0x34ebfc[_0x535f('0x3b')]=_[_0x535f('0x34')](_0x34ebfc[_0x535f('0x32')],_0x34ebfc[_0x535f('0x33')]);_0x3cdcb1[_0x535f('0x35')]=_[_0x535f('0x34')](_0x34ebfc[_0x535f('0x32')],qs[_0x535f('0x36')](_0x1783ec['query'][_0x535f('0x36')]));_0x3cdcb1[_0x535f('0x35')]=_0x3cdcb1[_0x535f('0x35')][_0x535f('0x44')]?_0x3cdcb1[_0x535f('0x35')]:_0x34ebfc['model'];if(_0x1783ec[_0x535f('0x33')][_0x535f('0x45')]){_0x3cdcb1[_0x535f('0x3f')]=[{'all':!![]}];}_0x3cdcb1=_[_0x535f('0x3e')]({},_0x3cdcb1,_0x1783ec[_0x535f('0x46')]);return db[_0x535f('0x2e')][_0x535f('0x47')](_0x3cdcb1)[_0x535f('0x24')](handleEntityNotFound(_0x24e4c3,null))[_0x535f('0x24')](respondWithResult(_0x24e4c3,null))['catch'](handleError(_0x24e4c3,null));};exports[_0x535f('0x48')]=function(_0x19fc51,_0x79e121){return db[_0x535f('0x2e')][_0x535f('0x48')](_0x19fc51[_0x535f('0x49')],{})[_0x535f('0x24')](function(_0x28075a){var _0x2e7244=_0x19fc51[_0x535f('0x4a')][_0x535f('0x4b')]({'plain':!![]});if(!_0x2e7244)throw new Error(_0x535f('0x4c'));if(_0x2e7244[_0x535f('0x4d')]===_0x535f('0x4a')){var _0x7bac53=_0x28075a[_0x535f('0x4b')]({'plain':!![]});var _0x196706=_0x535f('0x26');return db[_0x535f('0x4e')]['find']({'where':{'name':_0x196706,'userProfileId':_0x2e7244[_0x535f('0x4f')]},'raw':!![]})[_0x535f('0x24')](function(_0x1fc1fe){if(_0x1fc1fe&&_0x1fc1fe[_0x535f('0x50')]===0x0){return db[_0x535f('0x27')][_0x535f('0x48')]({'name':_0x7bac53['name'],'resourceId':_0x7bac53['id'],'type':_0x1fc1fe[_0x535f('0x2b')],'sectionId':_0x1fc1fe['id']},{})['then'](function(){return _0x28075a;});}else{return _0x28075a;}})[_0x535f('0x41')](function(_0xd2c4dc){logger[_0x535f('0x29')](_0x535f('0x51'),_0xd2c4dc);throw _0xd2c4dc;});}return _0x28075a;})['then'](respondWithResult(_0x79e121,0xc9))[_0x535f('0x41')](handleError(_0x79e121,null));};exports[_0x535f('0x23')]=function(_0x2dae0d,_0x336247){if(_0x2dae0d['body']['id']){delete _0x2dae0d['body']['id'];}return db[_0x535f('0x2e')][_0x535f('0x47')]({'where':{'id':_0x2dae0d[_0x535f('0x52')]['id']}})[_0x535f('0x24')](handleEntityNotFound(_0x336247,null))[_0x535f('0x24')](saveUpdates(_0x2dae0d[_0x535f('0x49')],null))[_0x535f('0x24')](respondWithResult(_0x336247,null))[_0x535f('0x41')](handleError(_0x336247,null));};exports[_0x535f('0x25')]=function(_0x9583f6,_0x4f7f11){return db[_0x535f('0x2e')][_0x535f('0x47')]({'where':{'id':_0x9583f6[_0x535f('0x52')]['id']}})['then'](handleEntityNotFound(_0x4f7f11,null))[_0x535f('0x24')](removeEntity(_0x4f7f11,null))[_0x535f('0x41')](handleError(_0x4f7f11,null));};exports[_0x535f('0x53')]=function(_0x2675dc,_0x44eb79,_0x1b2a8e){if(_0x2675dc[_0x535f('0x49')]['id']){delete _0x2675dc[_0x535f('0x49')]['id'];}return db['Trigger'][_0x535f('0x47')]({'where':{'id':_0x2675dc['params']['id']}})[_0x535f('0x24')](handleEntityNotFound(_0x44eb79,null))['then'](function(_0x29031c){if(_0x29031c){_0x2675dc['body'][_0x535f('0x54')]=_0x29031c['id'];return db['Condition'][_0x535f('0x48')](_0x2675dc[_0x535f('0x49')]);}})[_0x535f('0x24')](respondWithResult(_0x44eb79,null))[_0x535f('0x41')](handleError(_0x44eb79,null));};exports[_0x535f('0x55')]=function(_0x340809,_0x30e617,_0x41b722){if(_0x340809[_0x535f('0x49')]['id']){delete _0x340809[_0x535f('0x49')]['id'];}return db[_0x535f('0x2e')][_0x535f('0x47')]({'where':{'id':_0x340809[_0x535f('0x52')]['id']}})[_0x535f('0x24')](handleEntityNotFound(_0x30e617,null))[_0x535f('0x24')](function(_0x348ca5){if(_0x348ca5){_0x340809['body'][_0x535f('0x56')]=_0x348ca5['id'];return db[_0x535f('0x57')][_0x535f('0x48')](_0x340809[_0x535f('0x49')]);}})[_0x535f('0x24')](respondWithResult(_0x30e617,null))[_0x535f('0x41')](handleError(_0x30e617,null));};exports[_0x535f('0x58')]=function(_0x573c09,_0x47205d,_0x431d66){var _0x214090={};var _0xaf2cf7={};var _0x1217dd;var _0x8389e;return db[_0x535f('0x2e')][_0x535f('0x59')]({'where':{'id':_0x573c09['params']['id']}})[_0x535f('0x24')](handleEntityNotFound(_0x47205d,null))[_0x535f('0x24')](function(_0x4757d5){if(_0x4757d5){_0x1217dd=_0x4757d5;_0xaf2cf7[_0x535f('0x32')]=_[_0x535f('0x43')](db[_0x535f('0x57')][_0x535f('0x5a')]);_0xaf2cf7[_0x535f('0x33')]=_[_0x535f('0x43')](_0x573c09[_0x535f('0x33')]);_0xaf2cf7[_0x535f('0x3b')]=_[_0x535f('0x34')](_0xaf2cf7['model'],_0xaf2cf7[_0x535f('0x33')]);_0x214090[_0x535f('0x35')]=_[_0x535f('0x34')](_0xaf2cf7['model'],qs[_0x535f('0x36')](_0x573c09[_0x535f('0x33')]['fields']));_0x214090[_0x535f('0x35')]=_0x214090[_0x535f('0x35')][_0x535f('0x44')]?_0x214090[_0x535f('0x35')]:_0xaf2cf7[_0x535f('0x32')];_0x214090[_0x535f('0x38')]=qs[_0x535f('0x39')](_0x573c09['query']['sort']);_0x214090[_0x535f('0x3a')]=qs['filters'](_[_0x535f('0x3c')](_0x573c09[_0x535f('0x33')],_0xaf2cf7[_0x535f('0x3b')]));if(_0x573c09[_0x535f('0x33')][_0x535f('0x3d')]){_0x214090[_0x535f('0x3a')]=_[_0x535f('0x3e')](_0x214090[_0x535f('0x3a')],{'$or':_[_0x535f('0x2d')](_0x214090['attributes'],function(_0x1ab5a9){var _0x13e0a3={};_0x13e0a3[_0x1ab5a9]={'$like':'%'+_0x573c09[_0x535f('0x33')][_0x535f('0x3d')]+'%'};return _0x13e0a3;})});}_0x214090=_[_0x535f('0x3e')]({},_0x214090,_0x573c09[_0x535f('0x46')]);return _0x1217dd[_0x535f('0x58')](_0x214090);}})[_0x535f('0x24')](function(_0x29e808){if(_0x29e808){_0x8389e=_0x29e808[_0x535f('0x44')];if(!_0x573c09[_0x535f('0x33')][_0x535f('0x5b')](_0x535f('0x37'))){_0x214090[_0x535f('0x1c')]=qs[_0x535f('0x1c')](_0x573c09['query']['limit']);_0x214090['offset']=qs['offset'](_0x573c09['query'][_0x535f('0x1b')]);}return _0x1217dd[_0x535f('0x58')](_0x214090);}})['then'](function(_0x13aae4){if(_0x13aae4){return _0x13aae4?{'count':_0x8389e,'rows':_0x13aae4}:null;}})[_0x535f('0x24')](respondWithResult(_0x47205d,null))[_0x535f('0x41')](handleError(_0x47205d,null));};exports[_0x535f('0x5c')]=function(_0x2ceae5,_0x1c4467,_0x1225f5){var _0x20ce4e={};var _0x509264={};var _0x33128f;var _0x1a8e4f;return db[_0x535f('0x2e')][_0x535f('0x59')]({'where':{'id':_0x2ceae5[_0x535f('0x52')]['id']}})[_0x535f('0x24')](handleEntityNotFound(_0x1c4467,null))[_0x535f('0x24')](function(_0x3c1971){if(_0x3c1971){_0x33128f=_0x3c1971;_0x509264[_0x535f('0x32')]=_[_0x535f('0x43')](db[_0x535f('0x57')][_0x535f('0x5a')]);_0x509264[_0x535f('0x33')]=_['keys'](_0x2ceae5[_0x535f('0x33')]);_0x509264[_0x535f('0x3b')]=_[_0x535f('0x34')](_0x509264[_0x535f('0x32')],_0x509264[_0x535f('0x33')]);_0x20ce4e[_0x535f('0x35')]=_['intersection'](_0x509264[_0x535f('0x32')],qs[_0x535f('0x36')](_0x2ceae5['query'][_0x535f('0x36')]));_0x20ce4e['attributes']=_0x20ce4e[_0x535f('0x35')][_0x535f('0x44')]?_0x20ce4e[_0x535f('0x35')]:_0x509264[_0x535f('0x32')];_0x20ce4e['order']=qs[_0x535f('0x39')](_0x2ceae5[_0x535f('0x33')][_0x535f('0x39')]);_0x20ce4e[_0x535f('0x3a')]=qs['filters'](_['pick'](_0x2ceae5[_0x535f('0x33')],_0x509264[_0x535f('0x3b')]));if(_0x2ceae5[_0x535f('0x33')]['filter']){_0x20ce4e[_0x535f('0x3a')]=_[_0x535f('0x3e')](_0x20ce4e[_0x535f('0x3a')],{'$or':_[_0x535f('0x2d')](_0x20ce4e[_0x535f('0x35')],function(_0x25bd50){var _0x3801df={};_0x3801df[_0x25bd50]={'$like':'%'+_0x2ceae5[_0x535f('0x33')][_0x535f('0x3d')]+'%'};return _0x3801df;})});}_0x20ce4e=_[_0x535f('0x3e')]({},_0x20ce4e,_0x2ceae5[_0x535f('0x46')]);return _0x33128f['getAnyConditions'](_0x20ce4e);}})[_0x535f('0x24')](function(_0x3b52c1){if(_0x3b52c1){_0x1a8e4f=_0x3b52c1[_0x535f('0x44')];if(!_0x2ceae5[_0x535f('0x33')][_0x535f('0x5b')](_0x535f('0x37'))){_0x20ce4e['limit']=qs[_0x535f('0x1c')](_0x2ceae5['query'][_0x535f('0x1c')]);_0x20ce4e[_0x535f('0x1b')]=qs[_0x535f('0x1b')](_0x2ceae5[_0x535f('0x33')]['offset']);}return _0x33128f['getAnyConditions'](_0x20ce4e);}})[_0x535f('0x24')](function(_0x159412){if(_0x159412){return _0x159412?{'count':_0x1a8e4f,'rows':_0x159412}:null;}})[_0x535f('0x24')](respondWithResult(_0x1c4467,null))['catch'](handleError(_0x1c4467,null));};exports['addAction']=function(_0x43f955,_0x11ff1a,_0x538af4){if(_0x43f955[_0x535f('0x49')]['id']){delete _0x43f955[_0x535f('0x49')]['id'];}return db[_0x535f('0x2e')][_0x535f('0x47')]({'where':{'id':_0x43f955[_0x535f('0x52')]['id']}})['then'](handleEntityNotFound(_0x11ff1a,null))['then'](function(_0x5d4fa0){if(_0x5d4fa0){_0x43f955[_0x535f('0x49')]['TriggerId']=_0x5d4fa0['id'];return db['Action'][_0x535f('0x48')](_0x43f955[_0x535f('0x49')]);}})[_0x535f('0x24')](respondWithResult(_0x11ff1a,null))[_0x535f('0x41')](handleError(_0x11ff1a,null));};exports['getActions']=function(_0x1ed67e,_0xdfd625,_0x5e646e){var _0x5c7236={};var _0x21cc31={};var _0x255808;var _0x3c52d4;return db[_0x535f('0x2e')]['findOne']({'where':{'id':_0x1ed67e[_0x535f('0x52')]['id']}})['then'](handleEntityNotFound(_0xdfd625,null))[_0x535f('0x24')](function(_0x47ffca){if(_0x47ffca){_0x255808=_0x47ffca;_0x21cc31['model']=_['keys'](db[_0x535f('0x5d')][_0x535f('0x5a')]);_0x21cc31[_0x535f('0x33')]=_[_0x535f('0x43')](_0x1ed67e[_0x535f('0x33')]);_0x21cc31['filters']=_[_0x535f('0x34')](_0x21cc31['model'],_0x21cc31['query']);_0x5c7236[_0x535f('0x35')]=_['intersection'](_0x21cc31[_0x535f('0x32')],qs[_0x535f('0x36')](_0x1ed67e[_0x535f('0x33')][_0x535f('0x36')]));_0x5c7236[_0x535f('0x35')]=_0x5c7236['attributes'][_0x535f('0x44')]?_0x5c7236['attributes']:_0x21cc31[_0x535f('0x32')];_0x5c7236[_0x535f('0x38')]=qs['sort'](_0x1ed67e[_0x535f('0x33')]['sort']);_0x5c7236[_0x535f('0x3a')]=qs[_0x535f('0x3b')](_[_0x535f('0x3c')](_0x1ed67e[_0x535f('0x33')],_0x21cc31[_0x535f('0x3b')]));if(_0x1ed67e[_0x535f('0x33')][_0x535f('0x3d')]){_0x5c7236[_0x535f('0x3a')]=_['merge'](_0x5c7236[_0x535f('0x3a')],{'$or':_['map'](_0x5c7236[_0x535f('0x35')],function(_0x2c1446){var _0x519eb6={};_0x519eb6[_0x2c1446]={'$like':'%'+_0x1ed67e[_0x535f('0x33')]['filter']+'%'};return _0x519eb6;})});}_0x5c7236=_[_0x535f('0x3e')]({},_0x5c7236,_0x1ed67e[_0x535f('0x46')]);return _0x255808[_0x535f('0x5e')](_0x5c7236);}})['then'](function(_0x5f143f){if(_0x5f143f){_0x3c52d4=_0x5f143f[_0x535f('0x44')];if(!_0x1ed67e[_0x535f('0x33')][_0x535f('0x5b')](_0x535f('0x37'))){_0x5c7236[_0x535f('0x1c')]=qs[_0x535f('0x1c')](_0x1ed67e['query'][_0x535f('0x1c')]);_0x5c7236[_0x535f('0x1b')]=qs['offset'](_0x1ed67e['query'][_0x535f('0x1b')]);}return _0x255808['getActions'](_0x5c7236);}})[_0x535f('0x24')](function(_0x50f74a){if(_0x50f74a){return _0x50f74a?{'count':_0x3c52d4,'rows':_0x50f74a}:null;}})['then'](respondWithResult(_0xdfd625,null))[_0x535f('0x41')](handleError(_0xdfd625,null));}; \ No newline at end of file +var _0x039f=['offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Triggers','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','pick','where','merge','filter','options','includeAll','include','Trigger','findAll','rows','catch','show','keys','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','params','TriggerAllId','Condition','addAnyCondition','findOne','sort','getAllConditions','getAnyConditions','Action','getActions','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0x039f,0x1b0));var _0xf039=function(_0x2891d1,_0x2ddd3e){_0x2891d1=_0x2891d1-0x0;var _0x486948=_0x039f[_0x2891d1];return _0x486948;};'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(_0xf039('0x0'));var moment=require(_0xf039('0x1'));var BPromise=require(_0xf039('0x2'));var Mustache=require(_0xf039('0x3'));var util=require(_0xf039('0x4'));var path=require(_0xf039('0x5'));var sox=require(_0xf039('0x6'));var csv=require(_0xf039('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf039('0x8'));var _=require(_0xf039('0x9'));var squel=require('squel');var crypto=require(_0xf039('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf039('0xb'));var Papa=require(_0xf039('0xc'));var Redis=require(_0xf039('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf039('0xe'));var as=require(_0xf039('0xf'));var hardwareService=require(_0xf039('0x10'));var logger=require(_0xf039('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf039('0x12'));var licenseUtil=require(_0xf039('0x13'));var db=require(_0xf039('0x14'))['db'];function respondWithStatusCode(_0x5c413b,_0x1224bf){_0x1224bf=_0x1224bf||0xcc;return function(_0x3091d1){if(_0x3091d1){return _0x5c413b['sendStatus'](_0x1224bf);}return _0x5c413b['status'](_0x1224bf)['end']();};}function respondWithResult(_0x23a2ed,_0x5f40fb){_0x5f40fb=_0x5f40fb||0xc8;return function(_0x440c6f){if(_0x440c6f){return _0x23a2ed[_0xf039('0x15')](_0x5f40fb)[_0xf039('0x16')](_0x440c6f);}};}function respondWithFilteredResult(_0x4417c4,_0x439b13){return function(_0x1065a9){if(_0x1065a9){var _0x431a37=typeof _0x439b13[_0xf039('0x17')]===_0xf039('0x18')&&typeof _0x439b13[_0xf039('0x19')]===_0xf039('0x18');var _0x23bca8=_0x1065a9[_0xf039('0x1a')];var _0x42625f=_0x431a37?0x0:_0x439b13[_0xf039('0x17')];var _0xc419ec=_0x431a37?_0x1065a9['count']:_0x439b13[_0xf039('0x17')]+_0x439b13[_0xf039('0x19')];var _0x17ae31;if(_0xc419ec>=_0x23bca8){_0xc419ec=_0x23bca8;_0x17ae31=0xc8;}else{_0x17ae31=0xce;}_0x4417c4[_0xf039('0x15')](_0x17ae31);return _0x4417c4[_0xf039('0x1b')](_0xf039('0x1c'),_0x42625f+'-'+_0xc419ec+'/'+_0x23bca8)[_0xf039('0x16')](_0x1065a9);}return null;};}function patchUpdates(_0x4e21f4){return function(_0x1aa5fc){try{jsonpatch['apply'](_0x1aa5fc,_0x4e21f4,!![]);}catch(_0x58ead4){return BPromise[_0xf039('0x1d')](_0x58ead4);}return _0x1aa5fc[_0xf039('0x1e')]();};}function saveUpdates(_0x117d46,_0xddf2e2){return function(_0x44a5e7){if(_0x44a5e7){return _0x44a5e7['update'](_0x117d46)[_0xf039('0x1f')](function(_0x51f0e1){return _0x51f0e1;});}return null;};}function removeEntity(_0x828a1f,_0x2f189a){return function(_0x5c8efd){if(_0x5c8efd){return _0x5c8efd[_0xf039('0x20')]()[_0xf039('0x1f')](function(){var _0x2f411d=_0x5c8efd[_0xf039('0x21')]({'plain':!![]});var _0x2d5e37=_0xf039('0x22');return db[_0xf039('0x23')][_0xf039('0x20')]({'where':{'type':_0x2d5e37,'resourceId':_0x2f411d['id']}})[_0xf039('0x1f')](function(){return _0x5c8efd;});})['then'](function(){_0x828a1f[_0xf039('0x15')](0xcc)[_0xf039('0x24')]();});}};}function handleEntityNotFound(_0xadf94b,_0x47a76a){return function(_0x1063bc){if(!_0x1063bc){_0xadf94b[_0xf039('0x25')](0x194);}return _0x1063bc;};}function handleError(_0x83a3d6,_0x448026){_0x448026=_0x448026||0x1f4;return function(_0x1e25f3){logger[_0xf039('0x26')](_0x1e25f3[_0xf039('0x27')]);if(_0x1e25f3[_0xf039('0x28')]){delete _0x1e25f3[_0xf039('0x28')];}_0x83a3d6[_0xf039('0x15')](_0x448026)[_0xf039('0x29')](_0x1e25f3);};}exports[_0xf039('0x2a')]=function(_0xd90516,_0x40951a){var _0x4959e8={},_0x34a059={},_0x316616={'count':0x0,'rows':[]};var _0x10266d=_[_0xf039('0x2b')](db['Trigger'][_0xf039('0x2c')],function(_0x6a6938){return{'name':_0x6a6938[_0xf039('0x2d')],'type':_0x6a6938[_0xf039('0x2e')][_0xf039('0x2f')]};});_0x34a059[_0xf039('0x30')]=_[_0xf039('0x2b')](_0x10266d,_0xf039('0x28'));_0x34a059['query']=_['keys'](_0xd90516['query']);_0x34a059[_0xf039('0x31')]=_[_0xf039('0x32')](_0x34a059['model'],_0x34a059['query']);_0x4959e8[_0xf039('0x33')]=_[_0xf039('0x32')](_0x34a059['model'],qs[_0xf039('0x34')](_0xd90516[_0xf039('0x35')][_0xf039('0x34')]));_0x4959e8[_0xf039('0x33')]=_0x4959e8[_0xf039('0x33')][_0xf039('0x36')]?_0x4959e8['attributes']:_0x34a059[_0xf039('0x30')];if(!_0xd90516[_0xf039('0x35')][_0xf039('0x37')](_0xf039('0x38'))){_0x4959e8[_0xf039('0x19')]=qs['limit'](_0xd90516[_0xf039('0x35')][_0xf039('0x19')]);_0x4959e8[_0xf039('0x17')]=qs['offset'](_0xd90516[_0xf039('0x35')]['offset']);}_0x4959e8[_0xf039('0x39')]=qs['sort'](_0xd90516['query']['sort']);_0x4959e8['where']=qs[_0xf039('0x31')](_[_0xf039('0x3a')](_0xd90516['query'],_0x34a059[_0xf039('0x31')]),_0x10266d);if(_0xd90516['query']['filter']){_0x4959e8[_0xf039('0x3b')]=_[_0xf039('0x3c')](_0x4959e8[_0xf039('0x3b')],{'$or':_[_0xf039('0x2b')](_0x10266d,function(_0x3c69b0){if(_0x3c69b0[_0xf039('0x2e')]!=='VIRTUAL'){var _0x33dee0={};_0x33dee0[_0x3c69b0[_0xf039('0x28')]]={'$like':'%'+_0xd90516['query'][_0xf039('0x3d')]+'%'};return _0x33dee0;}})});}_0x4959e8=_[_0xf039('0x3c')]({},_0x4959e8,_0xd90516[_0xf039('0x3e')]);var _0xe7bcbf={'where':_0x4959e8[_0xf039('0x3b')]};return db['Trigger'][_0xf039('0x1a')](_0xe7bcbf)['then'](function(_0x31d472){_0x316616['count']=_0x31d472;if(_0xd90516[_0xf039('0x35')][_0xf039('0x3f')]){_0x4959e8[_0xf039('0x40')]=[{'all':!![]}];}return db[_0xf039('0x41')][_0xf039('0x42')](_0x4959e8);})[_0xf039('0x1f')](function(_0x2bf9fd){_0x316616[_0xf039('0x43')]=_0x2bf9fd;return _0x316616;})[_0xf039('0x1f')](respondWithFilteredResult(_0x40951a,_0x4959e8))[_0xf039('0x44')](handleError(_0x40951a,null));};exports[_0xf039('0x45')]=function(_0x408030,_0x13b2bc){var _0x5280a6={'raw':![],'where':{'id':_0x408030['params']['id']}},_0x2c2ea3={};_0x2c2ea3[_0xf039('0x30')]=_[_0xf039('0x46')](db[_0xf039('0x41')][_0xf039('0x2c')]);_0x2c2ea3['query']=_[_0xf039('0x46')](_0x408030[_0xf039('0x35')]);_0x2c2ea3[_0xf039('0x31')]=_[_0xf039('0x32')](_0x2c2ea3[_0xf039('0x30')],_0x2c2ea3[_0xf039('0x35')]);_0x5280a6['attributes']=_[_0xf039('0x32')](_0x2c2ea3[_0xf039('0x30')],qs[_0xf039('0x34')](_0x408030[_0xf039('0x35')][_0xf039('0x34')]));_0x5280a6[_0xf039('0x33')]=_0x5280a6[_0xf039('0x33')][_0xf039('0x36')]?_0x5280a6[_0xf039('0x33')]:_0x2c2ea3[_0xf039('0x30')];if(_0x408030[_0xf039('0x35')][_0xf039('0x3f')]){_0x5280a6[_0xf039('0x40')]=[{'all':!![]}];}_0x5280a6=_[_0xf039('0x3c')]({},_0x5280a6,_0x408030[_0xf039('0x3e')]);return db[_0xf039('0x41')][_0xf039('0x47')](_0x5280a6)[_0xf039('0x1f')](handleEntityNotFound(_0x13b2bc,null))[_0xf039('0x1f')](respondWithResult(_0x13b2bc,null))[_0xf039('0x44')](handleError(_0x13b2bc,null));};exports[_0xf039('0x48')]=function(_0x4aaf49,_0x21313c){return db[_0xf039('0x41')][_0xf039('0x48')](_0x4aaf49[_0xf039('0x49')],{})[_0xf039('0x1f')](function(_0x358a4b){var _0x10a49c=_0x4aaf49[_0xf039('0x4a')][_0xf039('0x21')]({'plain':!![]});if(!_0x10a49c)throw new Error(_0xf039('0x4b'));if(_0x10a49c[_0xf039('0x4c')]===_0xf039('0x4a')){var _0x5c41c8=_0x358a4b[_0xf039('0x21')]({'plain':!![]});var _0x340021='Triggers';return db['UserProfileSection'][_0xf039('0x47')]({'where':{'name':_0x340021,'userProfileId':_0x10a49c[_0xf039('0x4d')]},'raw':!![]})[_0xf039('0x1f')](function(_0x2a5f59){if(_0x2a5f59&&_0x2a5f59[_0xf039('0x4e')]===0x0){return db[_0xf039('0x23')]['create']({'name':_0x5c41c8[_0xf039('0x28')],'resourceId':_0x5c41c8['id'],'type':_0x2a5f59[_0xf039('0x28')],'sectionId':_0x2a5f59['id']},{})['then'](function(){return _0x358a4b;});}else{return _0x358a4b;}})[_0xf039('0x44')](function(_0x45e2e7){logger[_0xf039('0x26')](_0xf039('0x4f'),_0x45e2e7);throw _0x45e2e7;});}return _0x358a4b;})['then'](respondWithResult(_0x21313c,0xc9))[_0xf039('0x44')](handleError(_0x21313c,null));};exports[_0xf039('0x50')]=function(_0x4f974c,_0x363d92){if(_0x4f974c[_0xf039('0x49')]['id']){delete _0x4f974c[_0xf039('0x49')]['id'];}return db[_0xf039('0x41')][_0xf039('0x47')]({'where':{'id':_0x4f974c[_0xf039('0x51')]['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x363d92,null))['then'](saveUpdates(_0x4f974c[_0xf039('0x49')],null))[_0xf039('0x1f')](respondWithResult(_0x363d92,null))['catch'](handleError(_0x363d92,null));};exports['destroy']=function(_0x4a4919,_0x3e2f0e){return db[_0xf039('0x41')][_0xf039('0x47')]({'where':{'id':_0x4a4919[_0xf039('0x51')]['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x3e2f0e,null))[_0xf039('0x1f')](removeEntity(_0x3e2f0e,null))[_0xf039('0x44')](handleError(_0x3e2f0e,null));};exports['addAllCondition']=function(_0x3ac802,_0x142161,_0x1ce6b0){if(_0x3ac802['body']['id']){delete _0x3ac802[_0xf039('0x49')]['id'];}return db[_0xf039('0x41')]['find']({'where':{'id':_0x3ac802[_0xf039('0x51')]['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x142161,null))[_0xf039('0x1f')](function(_0x51cc19){if(_0x51cc19){_0x3ac802[_0xf039('0x49')][_0xf039('0x52')]=_0x51cc19['id'];return db[_0xf039('0x53')][_0xf039('0x48')](_0x3ac802['body']);}})[_0xf039('0x1f')](respondWithResult(_0x142161,null))['catch'](handleError(_0x142161,null));};exports[_0xf039('0x54')]=function(_0x3fc40c,_0x4ffaf3,_0x23a0ec){if(_0x3fc40c[_0xf039('0x49')]['id']){delete _0x3fc40c[_0xf039('0x49')]['id'];}return db[_0xf039('0x41')]['find']({'where':{'id':_0x3fc40c['params']['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x4ffaf3,null))[_0xf039('0x1f')](function(_0x3bc87c){if(_0x3bc87c){_0x3fc40c['body']['TriggerAnyId']=_0x3bc87c['id'];return db[_0xf039('0x53')][_0xf039('0x48')](_0x3fc40c[_0xf039('0x49')]);}})[_0xf039('0x1f')](respondWithResult(_0x4ffaf3,null))[_0xf039('0x44')](handleError(_0x4ffaf3,null));};exports['getAllConditions']=function(_0x203a4c,_0x29e832,_0x55f48){var _0x185655={};var _0x5af806={};var _0x2dccc5;var _0x33814f;return db[_0xf039('0x41')][_0xf039('0x55')]({'where':{'id':_0x203a4c['params']['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x29e832,null))[_0xf039('0x1f')](function(_0x2ddc67){if(_0x2ddc67){_0x2dccc5=_0x2ddc67;_0x5af806[_0xf039('0x30')]=_[_0xf039('0x46')](db['Condition']['rawAttributes']);_0x5af806[_0xf039('0x35')]=_['keys'](_0x203a4c['query']);_0x5af806['filters']=_['intersection'](_0x5af806[_0xf039('0x30')],_0x5af806[_0xf039('0x35')]);_0x185655[_0xf039('0x33')]=_[_0xf039('0x32')](_0x5af806[_0xf039('0x30')],qs[_0xf039('0x34')](_0x203a4c[_0xf039('0x35')][_0xf039('0x34')]));_0x185655[_0xf039('0x33')]=_0x185655[_0xf039('0x33')][_0xf039('0x36')]?_0x185655[_0xf039('0x33')]:_0x5af806[_0xf039('0x30')];_0x185655[_0xf039('0x39')]=qs[_0xf039('0x56')](_0x203a4c['query'][_0xf039('0x56')]);_0x185655['where']=qs[_0xf039('0x31')](_[_0xf039('0x3a')](_0x203a4c[_0xf039('0x35')],_0x5af806[_0xf039('0x31')]));if(_0x203a4c[_0xf039('0x35')][_0xf039('0x3d')]){_0x185655[_0xf039('0x3b')]=_[_0xf039('0x3c')](_0x185655[_0xf039('0x3b')],{'$or':_[_0xf039('0x2b')](_0x185655['attributes'],function(_0x10dfdb){var _0x179228={};_0x179228[_0x10dfdb]={'$like':'%'+_0x203a4c[_0xf039('0x35')][_0xf039('0x3d')]+'%'};return _0x179228;})});}_0x185655=_[_0xf039('0x3c')]({},_0x185655,_0x203a4c[_0xf039('0x3e')]);return _0x2dccc5[_0xf039('0x57')](_0x185655);}})['then'](function(_0x1d7790){if(_0x1d7790){_0x33814f=_0x1d7790['length'];if(!_0x203a4c[_0xf039('0x35')][_0xf039('0x37')](_0xf039('0x38'))){_0x185655[_0xf039('0x19')]=qs['limit'](_0x203a4c['query'][_0xf039('0x19')]);_0x185655[_0xf039('0x17')]=qs['offset'](_0x203a4c[_0xf039('0x35')][_0xf039('0x17')]);}return _0x2dccc5[_0xf039('0x57')](_0x185655);}})[_0xf039('0x1f')](function(_0x989b48){if(_0x989b48){return _0x989b48?{'count':_0x33814f,'rows':_0x989b48}:null;}})[_0xf039('0x1f')](respondWithResult(_0x29e832,null))[_0xf039('0x44')](handleError(_0x29e832,null));};exports[_0xf039('0x58')]=function(_0x45c182,_0x1c9658,_0x5e5f46){var _0x4882bb={};var _0x3f2b1c={};var _0x560da0;var _0x1447d8;return db[_0xf039('0x41')][_0xf039('0x55')]({'where':{'id':_0x45c182[_0xf039('0x51')]['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x1c9658,null))[_0xf039('0x1f')](function(_0x3e6978){if(_0x3e6978){_0x560da0=_0x3e6978;_0x3f2b1c[_0xf039('0x30')]=_[_0xf039('0x46')](db[_0xf039('0x53')][_0xf039('0x2c')]);_0x3f2b1c[_0xf039('0x35')]=_['keys'](_0x45c182[_0xf039('0x35')]);_0x3f2b1c['filters']=_[_0xf039('0x32')](_0x3f2b1c[_0xf039('0x30')],_0x3f2b1c['query']);_0x4882bb[_0xf039('0x33')]=_['intersection'](_0x3f2b1c[_0xf039('0x30')],qs[_0xf039('0x34')](_0x45c182[_0xf039('0x35')][_0xf039('0x34')]));_0x4882bb[_0xf039('0x33')]=_0x4882bb[_0xf039('0x33')][_0xf039('0x36')]?_0x4882bb[_0xf039('0x33')]:_0x3f2b1c[_0xf039('0x30')];_0x4882bb['order']=qs[_0xf039('0x56')](_0x45c182[_0xf039('0x35')][_0xf039('0x56')]);_0x4882bb[_0xf039('0x3b')]=qs[_0xf039('0x31')](_[_0xf039('0x3a')](_0x45c182[_0xf039('0x35')],_0x3f2b1c[_0xf039('0x31')]));if(_0x45c182[_0xf039('0x35')]['filter']){_0x4882bb[_0xf039('0x3b')]=_[_0xf039('0x3c')](_0x4882bb[_0xf039('0x3b')],{'$or':_[_0xf039('0x2b')](_0x4882bb['attributes'],function(_0x3213ae){var _0x22c789={};_0x22c789[_0x3213ae]={'$like':'%'+_0x45c182[_0xf039('0x35')][_0xf039('0x3d')]+'%'};return _0x22c789;})});}_0x4882bb=_['merge']({},_0x4882bb,_0x45c182['options']);return _0x560da0[_0xf039('0x58')](_0x4882bb);}})['then'](function(_0x17abda){if(_0x17abda){_0x1447d8=_0x17abda[_0xf039('0x36')];if(!_0x45c182['query'][_0xf039('0x37')]('nolimit')){_0x4882bb[_0xf039('0x19')]=qs[_0xf039('0x19')](_0x45c182[_0xf039('0x35')][_0xf039('0x19')]);_0x4882bb[_0xf039('0x17')]=qs[_0xf039('0x17')](_0x45c182['query'][_0xf039('0x17')]);}return _0x560da0[_0xf039('0x58')](_0x4882bb);}})['then'](function(_0x218989){if(_0x218989){return _0x218989?{'count':_0x1447d8,'rows':_0x218989}:null;}})[_0xf039('0x1f')](respondWithResult(_0x1c9658,null))['catch'](handleError(_0x1c9658,null));};exports['addAction']=function(_0x11b10b,_0x2b9b3f,_0x10b1e8){if(_0x11b10b[_0xf039('0x49')]['id']){delete _0x11b10b['body']['id'];}return db[_0xf039('0x41')][_0xf039('0x47')]({'where':{'id':_0x11b10b['params']['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x2b9b3f,null))[_0xf039('0x1f')](function(_0x5e9cee){if(_0x5e9cee){_0x11b10b[_0xf039('0x49')]['TriggerId']=_0x5e9cee['id'];return db[_0xf039('0x59')]['create'](_0x11b10b[_0xf039('0x49')]);}})[_0xf039('0x1f')](respondWithResult(_0x2b9b3f,null))['catch'](handleError(_0x2b9b3f,null));};exports[_0xf039('0x5a')]=function(_0x6fabfa,_0x54af85,_0x1a3719){var _0x134792={};var _0x2c3d32={};var _0x84a4f8;var _0x5357a2;return db[_0xf039('0x41')][_0xf039('0x55')]({'where':{'id':_0x6fabfa[_0xf039('0x51')]['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x54af85,null))[_0xf039('0x1f')](function(_0x2dcec5){if(_0x2dcec5){_0x84a4f8=_0x2dcec5;_0x2c3d32[_0xf039('0x30')]=_[_0xf039('0x46')](db[_0xf039('0x59')][_0xf039('0x2c')]);_0x2c3d32[_0xf039('0x35')]=_[_0xf039('0x46')](_0x6fabfa[_0xf039('0x35')]);_0x2c3d32['filters']=_[_0xf039('0x32')](_0x2c3d32['model'],_0x2c3d32[_0xf039('0x35')]);_0x134792[_0xf039('0x33')]=_[_0xf039('0x32')](_0x2c3d32[_0xf039('0x30')],qs[_0xf039('0x34')](_0x6fabfa['query'][_0xf039('0x34')]));_0x134792[_0xf039('0x33')]=_0x134792['attributes'][_0xf039('0x36')]?_0x134792[_0xf039('0x33')]:_0x2c3d32[_0xf039('0x30')];_0x134792[_0xf039('0x39')]=qs[_0xf039('0x56')](_0x6fabfa[_0xf039('0x35')][_0xf039('0x56')]);_0x134792['where']=qs[_0xf039('0x31')](_[_0xf039('0x3a')](_0x6fabfa['query'],_0x2c3d32[_0xf039('0x31')]));if(_0x6fabfa['query'][_0xf039('0x3d')]){_0x134792['where']=_[_0xf039('0x3c')](_0x134792[_0xf039('0x3b')],{'$or':_[_0xf039('0x2b')](_0x134792['attributes'],function(_0x52a8eb){var _0x551f87={};_0x551f87[_0x52a8eb]={'$like':'%'+_0x6fabfa[_0xf039('0x35')]['filter']+'%'};return _0x551f87;})});}_0x134792=_[_0xf039('0x3c')]({},_0x134792,_0x6fabfa['options']);return _0x84a4f8[_0xf039('0x5a')](_0x134792);}})[_0xf039('0x1f')](function(_0x5b37c9){if(_0x5b37c9){_0x5357a2=_0x5b37c9[_0xf039('0x36')];if(!_0x6fabfa['query'][_0xf039('0x37')](_0xf039('0x38'))){_0x134792[_0xf039('0x19')]=qs['limit'](_0x6fabfa[_0xf039('0x35')]['limit']);_0x134792[_0xf039('0x17')]=qs[_0xf039('0x17')](_0x6fabfa[_0xf039('0x35')][_0xf039('0x17')]);}return _0x84a4f8[_0xf039('0x5a')](_0x134792);}})['then'](function(_0x11ec1e){if(_0x11ec1e){return _0x11ec1e?{'count':_0x5357a2,'rows':_0x11ec1e}:null;}})[_0xf039('0x1f')](respondWithResult(_0x54af85,null))['catch'](handleError(_0x54af85,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 102dd6c..ea8e9d4 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 _0x3edc=['tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x4da279,_0x287048){_0x4da279=_0x4da279-0x0;var _0xca923f=_0x3edc[_0x4da279];return _0xca923f;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require(_0xc3ed('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ed('0x6'));var config=require(_0xc3ed('0x7'));var attributes=require(_0xc3ed('0x8'));module[_0xc3ed('0x9')]=function(_0x3f8468,_0x50b95c){return _0x3f8468[_0xc3ed('0xa')](_0xc3ed('0xb'),attributes,{'tableName':_0xc3ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe13a=['./trigger.attributes','exports','define','tools_triggers','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4e745f,_0x220bde){var _0xeefa76=function(_0x4b7ac3){while(--_0x4b7ac3){_0x4e745f['push'](_0x4e745f['shift']());}};_0xeefa76(++_0x220bde);}(_0xe13a,0x178));var _0xae13=function(_0x41a9a2,_0x3e3d3d){_0x41a9a2=_0x41a9a2-0x0;var _0x5e2b49=_0xe13a[_0x41a9a2];return _0x5e2b49;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var moment=require(_0xae13('0x3'));var BPromise=require('bluebird');var rp=require(_0xae13('0x4'));var fs=require('fs');var path=require(_0xae13('0x5'));var rimraf=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var attributes=require(_0xae13('0x8'));module[_0xae13('0x9')]=function(_0x412a07,_0x3379ed){return _0x412a07[_0xae13('0xa')]('Trigger',attributes,{'tableName':_0xae13('0xb'),'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 ecc34ba..c18ba01 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 _0x1327=['Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','Trigger','findAll','options','limit','include','map','model','attributes','ShowTrigger','find','raw','where','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x1327,0xba));var _0x7132=function(_0x48bc67,_0x3b2b80){_0x48bc67=_0x48bc67-0x0;var _0x5f0651=_0x1327[_0x48bc67];return _0x5f0651;};'use strict';var _=require('lodash');var util=require(_0x7132('0x0'));var moment=require('moment');var BPromise=require(_0x7132('0x1'));var rs=require(_0x7132('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7132('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7132('0x4'))(_0x7132('0x5'));var config=require('../../config/environment');var jayson=require(_0x7132('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27460e,_0x481db3,_0x1577a){return new BPromise(function(_0x573554,_0x57a73b){return client[_0x7132('0x7')](_0x27460e,_0x1577a)[_0x7132('0x8')](function(_0x5e8d1e){logger['info'](_0x7132('0x9'),_0x481db3,_0x7132('0xa'));logger[_0x7132('0xb')](_0x7132('0xc'),_0x481db3,_0x7132('0xa'),JSON[_0x7132('0xd')](_0x5e8d1e));if(_0x5e8d1e['error']){if(_0x5e8d1e[_0x7132('0xe')][_0x7132('0xf')]===0x1f4){logger[_0x7132('0xe')](_0x7132('0x9'),_0x481db3,_0x5e8d1e[_0x7132('0xe')][_0x7132('0x10')]);return _0x57a73b(_0x5e8d1e['error'][_0x7132('0x10')]);}logger['error'](_0x7132('0x9'),_0x481db3,_0x5e8d1e[_0x7132('0xe')][_0x7132('0x10')]);return _0x573554(_0x5e8d1e['error'][_0x7132('0x10')]);}else{logger[_0x7132('0x11')](_0x7132('0x9'),_0x481db3,_0x7132('0xa'));_0x573554(_0x5e8d1e[_0x7132('0x12')][_0x7132('0x10')]);}})[_0x7132('0x13')](function(_0x335edb){logger[_0x7132('0xe')](_0x7132('0x9'),_0x481db3,_0x335edb);_0x57a73b(_0x335edb);});});}exports[_0x7132('0x14')]=function(_0xb1fe2c){var _0x53afab=this;return new Promise(function(_0x4d0dc2,_0x593c49){return db[_0x7132('0x15')][_0x7132('0x16')]({'raw':_0xb1fe2c[_0x7132('0x17')]?_0xb1fe2c['options']['raw']===undefined?!![]:![]:!![],'where':_0xb1fe2c[_0x7132('0x17')]?_0xb1fe2c['options']['where']||null:null,'attributes':_0xb1fe2c[_0x7132('0x17')]?_0xb1fe2c['options']['attributes']||null:null,'limit':_0xb1fe2c[_0x7132('0x17')]?_0xb1fe2c[_0x7132('0x17')][_0x7132('0x18')]||null:null,'include':_0xb1fe2c[_0x7132('0x17')]?_0xb1fe2c[_0x7132('0x17')][_0x7132('0x19')]?_[_0x7132('0x1a')](_0xb1fe2c[_0x7132('0x17')]['include'],function(_0x41a4cf){return{'model':db[_0x41a4cf[_0x7132('0x1b')]],'as':_0x41a4cf['as'],'attributes':_0x41a4cf[_0x7132('0x1c')],'include':_0x41a4cf[_0x7132('0x19')]?_[_0x7132('0x1a')](_0x41a4cf[_0x7132('0x19')],function(_0x4b4ea5){return{'model':db[_0x4b4ea5[_0x7132('0x1b')]],'as':_0x4b4ea5['as'],'attributes':_0x4b4ea5[_0x7132('0x1c')],'include':_0x4b4ea5[_0x7132('0x19')]?_['map'](_0x4b4ea5[_0x7132('0x19')],function(_0x257e56){return{'model':db[_0x257e56['model']],'as':_0x257e56['as'],'attributes':_0x257e56[_0x7132('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7132('0x8')](function(_0x236c7e){logger[_0x7132('0x11')](_0x7132('0x14'),_0xb1fe2c);logger['debug'](_0x7132('0x14'),_0xb1fe2c,JSON['stringify'](_0x236c7e));_0x4d0dc2(_0x236c7e);})[_0x7132('0x13')](function(_0x5970f4){logger[_0x7132('0xe')](_0x7132('0x14'),_0x5970f4[_0x7132('0x10')],_0xb1fe2c);_0x593c49(_0x53afab[_0x7132('0xe')](0x1f4,_0x5970f4[_0x7132('0x10')]));});});};exports[_0x7132('0x1d')]=function(_0x4e054e){var _0x12e549=this;return new Promise(function(_0x22b099,_0x2e2c90){return db[_0x7132('0x15')][_0x7132('0x1e')]({'raw':_0x4e054e[_0x7132('0x17')]?_0x4e054e[_0x7132('0x17')][_0x7132('0x1f')]===undefined?!![]:![]:!![],'where':_0x4e054e[_0x7132('0x17')]?_0x4e054e[_0x7132('0x17')][_0x7132('0x20')]||null:null,'attributes':_0x4e054e[_0x7132('0x17')]?_0x4e054e['options'][_0x7132('0x1c')]||null:null,'include':_0x4e054e['options']?_0x4e054e[_0x7132('0x17')][_0x7132('0x19')]?_[_0x7132('0x1a')](_0x4e054e[_0x7132('0x17')][_0x7132('0x19')],function(_0x2ea038){return{'model':db[_0x2ea038[_0x7132('0x1b')]],'as':_0x2ea038['as'],'attributes':_0x2ea038['attributes'],'include':_0x2ea038[_0x7132('0x19')]?_[_0x7132('0x1a')](_0x2ea038[_0x7132('0x19')],function(_0x2fab99){return{'model':db[_0x2fab99[_0x7132('0x1b')]],'as':_0x2fab99['as'],'attributes':_0x2fab99[_0x7132('0x1c')],'include':_0x2fab99[_0x7132('0x19')]?_[_0x7132('0x1a')](_0x2fab99['include'],function(_0x385e4c){return{'model':db[_0x385e4c['model']],'as':_0x385e4c['as'],'attributes':_0x385e4c[_0x7132('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5591a3){logger['info']('ShowTrigger',_0x4e054e);logger[_0x7132('0xb')]('ShowTrigger',_0x4e054e,JSON[_0x7132('0xd')](_0x5591a3));_0x22b099(_0x5591a3);})['catch'](function(_0x118fa4){logger[_0x7132('0xe')](_0x7132('0x1d'),_0x118fa4[_0x7132('0x10')],_0x4e054e);_0x2e2c90(_0x12e549[_0x7132('0xe')](0x1f4,_0x118fa4[_0x7132('0x10')]));});});}; \ No newline at end of file +var _0xb156=['Trigger','raw','options','attributes','limit','include','map','model','GetTrigger','ShowTrigger','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x35564a,_0x174b30){var _0x49d230=function(_0x4fbf7b){while(--_0x4fbf7b){_0x35564a['push'](_0x35564a['shift']());}};_0x49d230(++_0x174b30);}(_0xb156,0x108));var _0x6b15=function(_0xe67e22,_0x547e07){_0xe67e22=_0xe67e22-0x0;var _0x39ff12=_0xb156[_0xe67e22];return _0x39ff12;};'use strict';var _=require(_0x6b15('0x0'));var util=require(_0x6b15('0x1'));var moment=require(_0x6b15('0x2'));var BPromise=require(_0x6b15('0x3'));var rs=require(_0x6b15('0x4'));var fs=require('fs');var Redis=require(_0x6b15('0x5'));var db=require(_0x6b15('0x6'))['db'];var utils=require(_0x6b15('0x7'));var logger=require(_0x6b15('0x8'))(_0x6b15('0x9'));var config=require('../../config/environment');var jayson=require(_0x6b15('0xa'));var client=jayson['client'][_0x6b15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0117,_0x28f73c,_0x2246b2){return new BPromise(function(_0x2a2dbb,_0x5bbfbf){return client[_0x6b15('0xc')](_0x3c0117,_0x2246b2)[_0x6b15('0xd')](function(_0x388ca2){logger[_0x6b15('0xe')](_0x6b15('0xf'),_0x28f73c,_0x6b15('0x10'));logger[_0x6b15('0x11')](_0x6b15('0x12'),_0x28f73c,_0x6b15('0x10'),JSON[_0x6b15('0x13')](_0x388ca2));if(_0x388ca2[_0x6b15('0x14')]){if(_0x388ca2[_0x6b15('0x14')]['code']===0x1f4){logger[_0x6b15('0x14')]('Trigger,\x20%s,\x20%s',_0x28f73c,_0x388ca2[_0x6b15('0x14')][_0x6b15('0x15')]);return _0x5bbfbf(_0x388ca2[_0x6b15('0x14')][_0x6b15('0x15')]);}logger[_0x6b15('0x14')](_0x6b15('0xf'),_0x28f73c,_0x388ca2[_0x6b15('0x14')][_0x6b15('0x15')]);return _0x2a2dbb(_0x388ca2[_0x6b15('0x14')][_0x6b15('0x15')]);}else{logger['info'](_0x6b15('0xf'),_0x28f73c,_0x6b15('0x10'));_0x2a2dbb(_0x388ca2[_0x6b15('0x16')][_0x6b15('0x15')]);}})[_0x6b15('0x17')](function(_0x3aeaa1){logger[_0x6b15('0x14')](_0x6b15('0xf'),_0x28f73c,_0x3aeaa1);_0x5bbfbf(_0x3aeaa1);});});}exports['GetTrigger']=function(_0x4ca41f){var _0x5f3427=this;return new Promise(function(_0x4fb25d,_0x499d90){return db[_0x6b15('0x18')]['findAll']({'raw':_0x4ca41f['options']?_0x4ca41f['options'][_0x6b15('0x19')]===undefined?!![]:![]:!![],'where':_0x4ca41f[_0x6b15('0x1a')]?_0x4ca41f[_0x6b15('0x1a')]['where']||null:null,'attributes':_0x4ca41f['options']?_0x4ca41f[_0x6b15('0x1a')][_0x6b15('0x1b')]||null:null,'limit':_0x4ca41f[_0x6b15('0x1a')]?_0x4ca41f[_0x6b15('0x1a')][_0x6b15('0x1c')]||null:null,'include':_0x4ca41f[_0x6b15('0x1a')]?_0x4ca41f[_0x6b15('0x1a')][_0x6b15('0x1d')]?_[_0x6b15('0x1e')](_0x4ca41f[_0x6b15('0x1a')]['include'],function(_0x4ca6da){return{'model':db[_0x4ca6da[_0x6b15('0x1f')]],'as':_0x4ca6da['as'],'attributes':_0x4ca6da[_0x6b15('0x1b')],'include':_0x4ca6da['include']?_[_0x6b15('0x1e')](_0x4ca6da[_0x6b15('0x1d')],function(_0x15a14c){return{'model':db[_0x15a14c[_0x6b15('0x1f')]],'as':_0x15a14c['as'],'attributes':_0x15a14c[_0x6b15('0x1b')],'include':_0x15a14c['include']?_['map'](_0x15a14c[_0x6b15('0x1d')],function(_0x3e3957){return{'model':db[_0x3e3957['model']],'as':_0x3e3957['as'],'attributes':_0x3e3957[_0x6b15('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6b15('0xd')](function(_0x231324){logger[_0x6b15('0xe')](_0x6b15('0x20'),_0x4ca41f);logger[_0x6b15('0x11')](_0x6b15('0x20'),_0x4ca41f,JSON[_0x6b15('0x13')](_0x231324));_0x4fb25d(_0x231324);})[_0x6b15('0x17')](function(_0x2def61){logger['error'](_0x6b15('0x20'),_0x2def61[_0x6b15('0x15')],_0x4ca41f);_0x499d90(_0x5f3427[_0x6b15('0x14')](0x1f4,_0x2def61[_0x6b15('0x15')]));});});};exports[_0x6b15('0x21')]=function(_0x11f48b){var _0x2b227f=this;return new Promise(function(_0x4d71c6,_0x35c807){return db['Trigger'][_0x6b15('0x22')]({'raw':_0x11f48b[_0x6b15('0x1a')]?_0x11f48b[_0x6b15('0x1a')][_0x6b15('0x19')]===undefined?!![]:![]:!![],'where':_0x11f48b['options']?_0x11f48b[_0x6b15('0x1a')][_0x6b15('0x23')]||null:null,'attributes':_0x11f48b[_0x6b15('0x1a')]?_0x11f48b[_0x6b15('0x1a')][_0x6b15('0x1b')]||null:null,'include':_0x11f48b[_0x6b15('0x1a')]?_0x11f48b[_0x6b15('0x1a')][_0x6b15('0x1d')]?_[_0x6b15('0x1e')](_0x11f48b[_0x6b15('0x1a')][_0x6b15('0x1d')],function(_0x27e315){return{'model':db[_0x27e315[_0x6b15('0x1f')]],'as':_0x27e315['as'],'attributes':_0x27e315[_0x6b15('0x1b')],'include':_0x27e315['include']?_[_0x6b15('0x1e')](_0x27e315[_0x6b15('0x1d')],function(_0x537833){return{'model':db[_0x537833[_0x6b15('0x1f')]],'as':_0x537833['as'],'attributes':_0x537833['attributes'],'include':_0x537833['include']?_[_0x6b15('0x1e')](_0x537833[_0x6b15('0x1d')],function(_0x1dfe91){return{'model':db[_0x1dfe91[_0x6b15('0x1f')]],'as':_0x1dfe91['as'],'attributes':_0x1dfe91[_0x6b15('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6b15('0xd')](function(_0x29e874){logger[_0x6b15('0xe')]('ShowTrigger',_0x11f48b);logger[_0x6b15('0x11')](_0x6b15('0x21'),_0x11f48b,JSON[_0x6b15('0x13')](_0x29e874));_0x4d71c6(_0x29e874);})['catch'](function(_0x124036){logger[_0x6b15('0x14')](_0x6b15('0x21'),_0x124036[_0x6b15('0x15')],_0x11f48b);_0x35c807(_0x2b227f[_0x6b15('0x14')](0x1f4,_0x124036['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 76863dd..9ca4cd4 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 _0x217c=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x484c21,_0x1a3d1a){var _0x2fb5dc=function(_0x43f3aa){while(--_0x43f3aa){_0x484c21['push'](_0x484c21['shift']());}};_0x2fb5dc(++_0x1a3d1a);}(_0x217c,0x108));var _0xc217=function(_0x39aa53,_0x55f102){_0x39aa53=_0x39aa53-0x0;var _0x6e0987=_0x217c[_0x39aa53];return _0x6e0987;};'use strict';var multer=require(_0xc217('0x0'));var util=require(_0xc217('0x1'));var path=require(_0xc217('0x2'));var timeout=require(_0xc217('0x3'));var express=require(_0xc217('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc217('0x5'));var interaction=require(_0xc217('0x6'));var config=require('../../config/environment');var controller=require(_0xc217('0x7'));router[_0xc217('0x8')]('/',auth[_0xc217('0x9')](),controller[_0xc217('0xa')]);router[_0xc217('0x8')](_0xc217('0xb'),auth[_0xc217('0x9')](),controller[_0xc217('0xc')]);router['post']('/:id/clone',auth[_0xc217('0x9')](),controller['clone']);router[_0xc217('0xd')]('/',auth['isAuthenticated'](),controller[_0xc217('0xe')]);router[_0xc217('0xf')](_0xc217('0xb'),auth[_0xc217('0x9')](),controller['update']);router[_0xc217('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc217('0x11')]);module[_0xc217('0x12')]=router; \ No newline at end of file +var _0xc7e8=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./trunk.controller','isAuthenticated','get','/:id','show','post','clone','put','delete'];(function(_0x229d7c,_0x2e8fd1){var _0x35c63b=function(_0x2f6d3e){while(--_0x2f6d3e){_0x229d7c['push'](_0x229d7c['shift']());}};_0x35c63b(++_0x2e8fd1);}(_0xc7e8,0x16a));var _0x8c7e=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xc7e8[_0x5e6ea3];return _0x4048b5;};'use strict';var multer=require(_0x8c7e('0x0'));var util=require(_0x8c7e('0x1'));var path=require(_0x8c7e('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c7e('0x3'));var router=express[_0x8c7e('0x4')]();var fs_extra=require(_0x8c7e('0x5'));var auth=require(_0x8c7e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c7e('0x7'));router['get']('/',auth[_0x8c7e('0x8')](),controller['index']);router[_0x8c7e('0x9')](_0x8c7e('0xa'),auth[_0x8c7e('0x8')](),controller[_0x8c7e('0xb')]);router[_0x8c7e('0xc')]('/:id/clone',auth[_0x8c7e('0x8')](),controller[_0x8c7e('0xd')]);router[_0x8c7e('0xc')]('/',auth[_0x8c7e('0x8')](),controller['create']);router[_0x8c7e('0xe')]('/:id',auth[_0x8c7e('0x8')](),controller['update']);router[_0x8c7e('0xf')]('/:id',auth[_0x8c7e('0x8')](),controller[_0x8c7e('0x10')]);module[_0x8c7e('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 82f0b84..cfc195c 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 _0xf25f=['join','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','nonat','update,nonat','BOOLEAN','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','force_rport,comedia','nat'];(function(_0x24ea89,_0x426346){var _0x441f37=function(_0x49b6d9){while(--_0x49b6d9){_0x24ea89['push'](_0x24ea89['shift']());}};_0x441f37(++_0x426346);}(_0xf25f,0xac));var _0xff25=function(_0x4f58e9,_0x4a22a9){_0x4f58e9=_0x4f58e9-0x0;var _0x140a90=_0xf25f[_0x4f58e9];return _0x140a90;};'use strict';var Sequelize=require('sequelize');module[_0xff25('0x0')]={'name':{'type':Sequelize[_0xff25('0x1')],'allowNull':![],'unique':_0xff25('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xff25('0x3')]('friend',_0xff25('0x4'),_0xff25('0x5')),'allowNull':![],'defaultValue':_0xff25('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xff25('0x7')},'callingpres':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x8'),_0xff25('0x9'),_0xff25('0xa'),'ALLOWED',_0xff25('0xb'),_0xff25('0xc'),_0xff25('0xd'),_0xff25('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xff25('0x1')]},'remotesecret':{'type':Sequelize[_0xff25('0x1')]},'transport':{'type':Sequelize[_0xff25('0x1')],'defaultValue':_0xff25('0xf'),'set':function(_0x1e9360){this[_0xff25('0x10')]('transport',_0x1e9360?_0x1e9360['join'](','):null);},'get':function(){return this[_0xff25('0x11')]('transport')?this[_0xff25('0x11')](_0xff25('0x12'))['split'](','):null;},'comment':_0xff25('0x13')},'dtmfmode':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x14'),_0xff25('0x15'),'shortinfo',_0xff25('0x16'),_0xff25('0x17')),'defaultValue':_0xff25('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0xff25('0x18'),'no','nonat',_0xff25('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xff25('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xff25('0x1a'),'set':function(_0x415d9d){this[_0xff25('0x10')](_0xff25('0x1b'),_0x415d9d?_0x415d9d[_0xff25('0x1c')](','):null);},'get':function(){return this[_0xff25('0x11')](_0xff25('0x1b'))?this[_0xff25('0x11')](_0xff25('0x1b'))[_0xff25('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xff25('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xff25('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xff25('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xff25('0x1')],'defaultValue':_0xff25('0x1e')},'allow':{'type':Sequelize[_0xff25('0x1')],'allowNull':![],'defaultValue':_0xff25('0x1f'),'set':function(_0x384790){this[_0xff25('0x10')](_0xff25('0x20'),_0x384790?_0x384790[_0xff25('0x1c')](';'):_0xff25('0x1f'));},'get':function(){return this['getDataValue'](_0xff25('0x20'))?this['getDataValue'](_0xff25('0x20'))[_0xff25('0x1d')](';'):null;},'comment':_0xff25('0x21')},'autoframing':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no')},'insecure':{'type':Sequelize[_0xff25('0x1')],'defaultValue':'port,invite','set':function(_0x4ada1f){this[_0xff25('0x10')](_0xff25('0x22'),_0x4ada1f?_0x4ada1f[_0xff25('0x1c')](','):null);},'get':function(){return this[_0xff25('0x11')](_0xff25('0x22'))?this[_0xff25('0x11')]('insecure')[_0xff25('0x1d')](','):null;},'comment':_0xff25('0x23')},'trustrpid':{'type':Sequelize[_0xff25('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xff25('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no')},'accountcode':{'type':Sequelize[_0xff25('0x24')](0xb)},'setvar':{'type':Sequelize[_0xff25('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xff25('0x25')},'amaflags':{'type':Sequelize[_0xff25('0x1')]},'callcounter':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xff25('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xff25('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xff25('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xff25('0x1')]},'template':{'type':Sequelize[_0xff25('0x1')]},'videosupport':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no',_0xff25('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no')},'mailbox':{'type':Sequelize[_0xff25('0x1')]},'session_timers':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x27'),_0xff25('0x28'),_0xff25('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xff25('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xff25('0x3')]('uac',_0xff25('0x2a')),'defaultValue':_0xff25('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xff25('0x1')]},'regexten':{'type':Sequelize[_0xff25('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xff25('0x1')]},'port':{'type':Sequelize[_0xff25('0x24')](0x5)},'qualify':{'type':Sequelize[_0xff25('0x3')]('yes','no'),'defaultValue':_0xff25('0x18')},'keepalive':{'type':Sequelize[_0xff25('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xff25('0x1')]},'rtptimeout':{'type':Sequelize[_0xff25('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xff25('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xff25('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xff25('0x3')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xff25('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xff25('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xff25('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xff25('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xff25('0x1')]},'maxforwards':{'type':Sequelize[_0xff25('0x24')](0xb)},'encryption':{'type':Sequelize[_0xff25('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no')},'force_avp':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xff25('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xff25('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no',_0xff25('0x2b'),_0xff25('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xff25('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xff25('0x1')]},'dtlscipher':{'type':Sequelize[_0xff25('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xff25('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xff25('0x2d'),_0xff25('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xff25('0x1')]},'usereqphone':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xff25('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xff25('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0xff25('0x1')]},'mohinterpret':{'type':Sequelize[_0xff25('0x1')]},'mohsuggest':{'type':Sequelize[_0xff25('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xff25('0x1')]},'host':{'type':Sequelize[_0xff25('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xff25('0x3')](_0xff25('0x18'),'no',_0xff25('0x2f'),_0xff25('0x19'),_0xff25('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xff25('0x1')]},'otherFields':{'type':Sequelize[_0xff25('0x1')]},'active':{'type':Sequelize[_0xff25('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xa6a9=['join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','certificate','active','passive','actpass','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport'];(function(_0x51fe9e,_0x25d373){var _0x520a56=function(_0x5acdb5){while(--_0x5acdb5){_0x51fe9e['push'](_0x51fe9e['shift']());}};_0x520a56(++_0x25d373);}(_0xa6a9,0xef));var _0x9a6a=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xa6a9[_0x5eb22e];return _0x27fed5;};'use strict';var Sequelize=require(_0x9a6a('0x0'));module[_0x9a6a('0x1')]={'name':{'type':Sequelize[_0x9a6a('0x2')],'allowNull':![],'unique':_0x9a6a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9a6a('0x4')]('friend',_0x9a6a('0x5'),_0x9a6a('0x6')),'allowNull':![],'defaultValue':_0x9a6a('0x7')},'context':{'type':Sequelize[_0x9a6a('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x8'),_0x9a6a('0x9'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x9a6a('0xa'),'PROHIB_PASSED_SCREEN',_0x9a6a('0xb'),_0x9a6a('0xc'))},'deny':{'type':Sequelize[_0x9a6a('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x9a6a('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x9a6a('0x2')]},'transport':{'type':Sequelize[_0x9a6a('0x2')],'defaultValue':_0x9a6a('0xd'),'set':function(_0x1a7bff){this[_0x9a6a('0xe')](_0x9a6a('0xf'),_0x1a7bff?_0x1a7bff[_0x9a6a('0x10')](','):null);},'get':function(){return this[_0x9a6a('0x11')](_0x9a6a('0xf'))?this['getDataValue'](_0x9a6a('0xf'))[_0x9a6a('0x12')](','):null;},'comment':_0x9a6a('0x13')},'dtmfmode':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x14'),_0x9a6a('0x15'),_0x9a6a('0x16'),_0x9a6a('0x17'),_0x9a6a('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no',_0x9a6a('0x1a'),_0x9a6a('0x1b'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x9a6a('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9a6a('0x2')]},'directmediadeny':{'type':Sequelize[_0x9a6a('0x2')]},'nat':{'type':Sequelize[_0x9a6a('0x2')],'defaultValue':_0x9a6a('0x1c'),'set':function(_0x3272f8){this[_0x9a6a('0xe')]('nat',_0x3272f8?_0x3272f8['join'](','):null);},'get':function(){return this[_0x9a6a('0x11')](_0x9a6a('0x1d'))?this['getDataValue'](_0x9a6a('0x1d'))[_0x9a6a('0x12')](','):null;},'comment':_0x9a6a('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9a6a('0x2')]},'pickupgroup':{'type':Sequelize[_0x9a6a('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x9a6a('0x2')]},'language':{'type':Sequelize[_0x9a6a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9a6a('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9a6a('0x2')],'defaultValue':_0x9a6a('0x1f')},'allow':{'type':Sequelize[_0x9a6a('0x2')],'allowNull':![],'defaultValue':_0x9a6a('0x20'),'set':function(_0x45abb6){this[_0x9a6a('0xe')](_0x9a6a('0x21'),_0x45abb6?_0x45abb6[_0x9a6a('0x10')](';'):_0x9a6a('0x20'));},'get':function(){return this['getDataValue'](_0x9a6a('0x21'))?this['getDataValue']('allow')[_0x9a6a('0x12')](';'):null;},'comment':_0x9a6a('0x22')},'autoframing':{'type':Sequelize[_0x9a6a('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x9a6a('0x2')],'defaultValue':_0x9a6a('0x23'),'set':function(_0x3fe786){this[_0x9a6a('0xe')](_0x9a6a('0x24'),_0x3fe786?_0x3fe786['join'](','):null);},'get':function(){return this[_0x9a6a('0x11')](_0x9a6a('0x24'))?this[_0x9a6a('0x11')](_0x9a6a('0x24'))['split'](','):null;},'comment':_0x9a6a('0x25')},'trustrpid':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no','never')},'promiscredir':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x9a6a('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'setvar':{'type':Sequelize[_0x9a6a('0x2')]},'callerid':{'type':Sequelize[_0x9a6a('0x2')],'defaultValue':_0x9a6a('0x27')},'amaflags':{'type':Sequelize[_0x9a6a('0x2')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x9a6a('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x9a6a('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x9a6a('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x9a6a('0x19'),'no',_0x9a6a('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9a6a('0x19'),'no')},'mailbox':{'type':Sequelize[_0x9a6a('0x2')]},'session_timers':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x29'),_0x9a6a('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x2b'),_0x9a6a('0x2c')),'defaultValue':_0x9a6a('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x9a6a('0x2')]},'fromdomain':{'type':Sequelize[_0x9a6a('0x2')]},'fromuser':{'type':Sequelize[_0x9a6a('0x2')]},'port':{'type':Sequelize[_0x9a6a('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x9a6a('0x19')},'keepalive':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x9a6a('0x2')]},'defaultuser':{'type':Sequelize[_0x9a6a('0x2')]},'rtptimeout':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x9a6a('0x4')]('yes','no',_0x9a6a('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x9a6a('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x9a6a('0x2')]},'contactdeny':{'type':Sequelize[_0x9a6a('0x2')]},'contactacl':{'type':Sequelize[_0x9a6a('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x9a6a('0x2')]},'use_q850_reason':{'type':Sequelize[_0x9a6a('0x2')]},'maxforwards':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x9a6a('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no')},'force_avp':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no')},'icesupport':{'type':Sequelize[_0x9a6a('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x9a6a('0x4')]('yes','no','fingerprint',_0x9a6a('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x9a6a('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x9a6a('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x9a6a('0x2')]},'dtlssetup':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x2f'),_0x9a6a('0x30'),_0x9a6a('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9a6a('0x2')]},'usereqphone':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x9a6a('0x2')]},'call_limit':{'type':Sequelize[_0x9a6a('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9a6a('0x4')](_0x9a6a('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x9a6a('0x19'),'no')},'vmexten':{'type':Sequelize[_0x9a6a('0x2')]},'mohinterpret':{'type':Sequelize[_0x9a6a('0x2')]},'mohsuggest':{'type':Sequelize[_0x9a6a('0x2')]},'parkinglot':{'type':Sequelize[_0x9a6a('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9a6a('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x9a6a('0x19'),'no',_0x9a6a('0x1a'),_0x9a6a('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9a6a('0x2')]},'otherFields':{'type':Sequelize[_0x9a6a('0x2')]},'active':{'type':Sequelize[_0x9a6a('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 8a2608d..6b395a6 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 _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x52ece0,_0xa385f){var _0x1fa339=function(_0x3d1b96){while(--_0x3d1b96){_0x52ece0['push'](_0x52ece0['shift']());}};_0x1fa339(++_0xa385f);}(_0xe14d,0x1ee));var _0xde14=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xe14d[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file +var _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x102470,_0x199a01){var _0x558eaa=function(_0x12c74a){while(--_0x12c74a){_0x102470['push'](_0x102470['shift']());}};_0x558eaa(++_0x199a01);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3d0c4c,_0x6dfa6d){_0x3d0c4c=_0x3d0c4c-0x0;var _0x16a03a=_0x9bde[_0x3d0c4c];return _0x16a03a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 792206a..db436f6 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 _0x0dbb=['lodash','util','api','moment','request-promise','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x30652d,_0x3518b6){var _0x1db397=function(_0x28f481){while(--_0x28f481){_0x30652d['push'](_0x30652d['shift']());}};_0x1db397(++_0x3518b6);}(_0x0dbb,0x6e));var _0xb0db=function(_0x33bf72,_0x2a0651){_0x33bf72=_0x33bf72-0x0;var _0x49fe01=_0x0dbb[_0x33bf72];return _0x49fe01;};'use strict';var _=require(_0xb0db('0x0'));var util=require(_0xb0db('0x1'));var logger=require('../../config/logger')(_0xb0db('0x2'));var moment=require(_0xb0db('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0db('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0db('0x5'));var attributes=require(_0xb0db('0x6'));module[_0xb0db('0x7')]=function(_0x35239e,_0x58b369){return _0x35239e[_0xb0db('0x8')](_0xb0db('0x9'),attributes,{'tableName':_0xb0db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75cd=['./trunk.attributes','exports','Trunk','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2d120c,_0x5b8a68){var _0x463343=function(_0x464b58){while(--_0x464b58){_0x2d120c['push'](_0x2d120c['shift']());}};_0x463343(++_0x5b8a68);}(_0x75cd,0x193));var _0xd75c=function(_0x29bddc,_0x2f8af9){_0x29bddc=_0x29bddc-0x0;var _0x5c400b=_0x75cd[_0x29bddc];return _0x5c400b;};'use strict';var _=require('lodash');var util=require(_0xd75c('0x0'));var logger=require(_0xd75c('0x1'))(_0xd75c('0x2'));var moment=require(_0xd75c('0x3'));var BPromise=require(_0xd75c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd75c('0x5'));var rimraf=require(_0xd75c('0x6'));var config=require('../../config/environment');var attributes=require(_0xd75c('0x7'));module[_0xd75c('0x8')]=function(_0x4848ec,_0x1f6ec3){return _0x4848ec['define'](_0xd75c('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index f22a640..1a34e25 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 _0x4ab6=['include','map','model','attributes','GetTrunk','debug','stringify','ShowTrunk','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','options','raw','where','limit'];(function(_0x432732,_0x435e7b){var _0x45350a=function(_0x1b026a){while(--_0x1b026a){_0x432732['push'](_0x432732['shift']());}};_0x45350a(++_0x435e7b);}(_0x4ab6,0x1e5));var _0x64ab=function(_0x1dd2ca,_0x2652a4){_0x1dd2ca=_0x1dd2ca-0x0;var _0x223b68=_0x4ab6[_0x1dd2ca];return _0x223b68;};'use strict';var _=require('lodash');var util=require(_0x64ab('0x0'));var moment=require(_0x64ab('0x1'));var BPromise=require(_0x64ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64ab('0x3'));var db=require(_0x64ab('0x4'))['db'];var utils=require(_0x64ab('0x5'));var logger=require(_0x64ab('0x6'))('rpc');var config=require(_0x64ab('0x7'));var jayson=require(_0x64ab('0x8'));var client=jayson[_0x64ab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x246546,_0x2e3bfd,_0xc103cd){return new BPromise(function(_0x28d76f,_0x2d4271){return client[_0x64ab('0xa')](_0x246546,_0xc103cd)[_0x64ab('0xb')](function(_0x208eed){logger[_0x64ab('0xc')](_0x64ab('0xd'),_0x2e3bfd,_0x64ab('0xe'));logger['debug'](_0x64ab('0xf'),_0x2e3bfd,_0x64ab('0xe'),JSON['stringify'](_0x208eed));if(_0x208eed['error']){if(_0x208eed['error'][_0x64ab('0x10')]===0x1f4){logger[_0x64ab('0x11')](_0x64ab('0xd'),_0x2e3bfd,_0x208eed[_0x64ab('0x11')][_0x64ab('0x12')]);return _0x2d4271(_0x208eed[_0x64ab('0x11')][_0x64ab('0x12')]);}logger[_0x64ab('0x11')](_0x64ab('0xd'),_0x2e3bfd,_0x208eed[_0x64ab('0x11')][_0x64ab('0x12')]);return _0x28d76f(_0x208eed[_0x64ab('0x11')][_0x64ab('0x12')]);}else{logger[_0x64ab('0xc')](_0x64ab('0xd'),_0x2e3bfd,_0x64ab('0xe'));_0x28d76f(_0x208eed[_0x64ab('0x13')][_0x64ab('0x12')]);}})[_0x64ab('0x14')](function(_0x29df25){logger['error'](_0x64ab('0xd'),_0x2e3bfd,_0x29df25);_0x2d4271(_0x29df25);});});}exports['GetTrunk']=function(_0x4adbbc){var _0x39c689=this;return new Promise(function(_0x4b5d1e,_0x206f0b){return db['Trunk']['findAll']({'raw':_0x4adbbc['options']?_0x4adbbc[_0x64ab('0x15')][_0x64ab('0x16')]===undefined?!![]:![]:!![],'where':_0x4adbbc[_0x64ab('0x15')]?_0x4adbbc['options'][_0x64ab('0x17')]||null:null,'attributes':_0x4adbbc['options']?_0x4adbbc[_0x64ab('0x15')]['attributes']||null:null,'limit':_0x4adbbc[_0x64ab('0x15')]?_0x4adbbc[_0x64ab('0x15')][_0x64ab('0x18')]||null:null,'include':_0x4adbbc['options']?_0x4adbbc[_0x64ab('0x15')][_0x64ab('0x19')]?_[_0x64ab('0x1a')](_0x4adbbc[_0x64ab('0x15')]['include'],function(_0x4d415c){return{'model':db[_0x4d415c[_0x64ab('0x1b')]],'as':_0x4d415c['as'],'attributes':_0x4d415c[_0x64ab('0x1c')],'include':_0x4d415c[_0x64ab('0x19')]?_[_0x64ab('0x1a')](_0x4d415c['include'],function(_0x5adf51){return{'model':db[_0x5adf51['model']],'as':_0x5adf51['as'],'attributes':_0x5adf51[_0x64ab('0x1c')],'include':_0x5adf51[_0x64ab('0x19')]?_[_0x64ab('0x1a')](_0x5adf51[_0x64ab('0x19')],function(_0x44119e){return{'model':db[_0x44119e[_0x64ab('0x1b')]],'as':_0x44119e['as'],'attributes':_0x44119e[_0x64ab('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x64ab('0xb')](function(_0x4b8737){logger[_0x64ab('0xc')](_0x64ab('0x1d'),_0x4adbbc);logger[_0x64ab('0x1e')]('GetTrunk',_0x4adbbc,JSON[_0x64ab('0x1f')](_0x4b8737));_0x4b5d1e(_0x4b8737);})[_0x64ab('0x14')](function(_0x961f8e){logger[_0x64ab('0x11')](_0x64ab('0x1d'),_0x961f8e[_0x64ab('0x12')],_0x4adbbc);_0x206f0b(_0x39c689[_0x64ab('0x11')](0x1f4,_0x961f8e[_0x64ab('0x12')]));});});};exports[_0x64ab('0x20')]=function(_0x40ad74){var _0x2b2bef=this;return new Promise(function(_0x32a2bb,_0x522e8b){return db['Trunk'][_0x64ab('0x21')]({'raw':_0x40ad74['options']?_0x40ad74['options'][_0x64ab('0x16')]===undefined?!![]:![]:!![],'where':_0x40ad74[_0x64ab('0x15')]?_0x40ad74['options']['where']||null:null,'attributes':_0x40ad74['options']?_0x40ad74['options'][_0x64ab('0x1c')]||null:null,'include':_0x40ad74['options']?_0x40ad74['options']['include']?_[_0x64ab('0x1a')](_0x40ad74[_0x64ab('0x15')][_0x64ab('0x19')],function(_0x2b7ff3){return{'model':db[_0x2b7ff3[_0x64ab('0x1b')]],'as':_0x2b7ff3['as'],'attributes':_0x2b7ff3[_0x64ab('0x1c')],'include':_0x2b7ff3[_0x64ab('0x19')]?_[_0x64ab('0x1a')](_0x2b7ff3[_0x64ab('0x19')],function(_0x1981ab){return{'model':db[_0x1981ab[_0x64ab('0x1b')]],'as':_0x1981ab['as'],'attributes':_0x1981ab['attributes'],'include':_0x1981ab['include']?_['map'](_0x1981ab[_0x64ab('0x19')],function(_0x465a97){return{'model':db[_0x465a97[_0x64ab('0x1b')]],'as':_0x465a97['as'],'attributes':_0x465a97['attributes']};}):[]};}):[]};}):[]:[]})[_0x64ab('0xb')](function(_0x320a2a){logger[_0x64ab('0xc')](_0x64ab('0x20'),_0x40ad74);logger[_0x64ab('0x1e')](_0x64ab('0x20'),_0x40ad74,JSON['stringify'](_0x320a2a));_0x32a2bb(_0x320a2a);})[_0x64ab('0x14')](function(_0x302cec){logger[_0x64ab('0x11')](_0x64ab('0x20'),_0x302cec[_0x64ab('0x12')],_0x40ad74);_0x522e8b(_0x2b2bef[_0x64ab('0x11')](0x1f4,_0x302cec['message']));});});}; \ No newline at end of file +var _0x871e=['stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','limit','include','map','model','attributes','ShowTrunk','find','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0x1e4535,_0x37cf32){var _0x4d8658=function(_0x15509a){while(--_0x15509a){_0x1e4535['push'](_0x1e4535['shift']());}};_0x4d8658(++_0x37cf32);}(_0x871e,0x1aa));var _0xe871=function(_0x14762b,_0x56e597){_0x14762b=_0x14762b-0x0;var _0xbf8ad9=_0x871e[_0x14762b];return _0xbf8ad9;};'use strict';var _=require(_0xe871('0x0'));var util=require(_0xe871('0x1'));var moment=require(_0xe871('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe871('0x3'))['db'];var utils=require(_0xe871('0x4'));var logger=require(_0xe871('0x5'))('rpc');var config=require(_0xe871('0x6'));var jayson=require(_0xe871('0x7'));var client=jayson[_0xe871('0x8')][_0xe871('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ba240,_0x176048,_0x21b5d2){return new BPromise(function(_0x28a391,_0xec0f50){return client['request'](_0x3ba240,_0x21b5d2)[_0xe871('0xa')](function(_0x14597e){logger[_0xe871('0xb')](_0xe871('0xc'),_0x176048,_0xe871('0xd'));logger[_0xe871('0xe')](_0xe871('0xf'),_0x176048,_0xe871('0xd'),JSON[_0xe871('0x10')](_0x14597e));if(_0x14597e[_0xe871('0x11')]){if(_0x14597e[_0xe871('0x11')][_0xe871('0x12')]===0x1f4){logger[_0xe871('0x11')]('Trunk,\x20%s,\x20%s',_0x176048,_0x14597e[_0xe871('0x11')][_0xe871('0x13')]);return _0xec0f50(_0x14597e[_0xe871('0x11')][_0xe871('0x13')]);}logger[_0xe871('0x11')](_0xe871('0xc'),_0x176048,_0x14597e[_0xe871('0x11')][_0xe871('0x13')]);return _0x28a391(_0x14597e['error'][_0xe871('0x13')]);}else{logger[_0xe871('0xb')](_0xe871('0xc'),_0x176048,'request\x20sent');_0x28a391(_0x14597e[_0xe871('0x14')]['message']);}})[_0xe871('0x15')](function(_0x3dd66e){logger['error'](_0xe871('0xc'),_0x176048,_0x3dd66e);_0xec0f50(_0x3dd66e);});});}exports[_0xe871('0x16')]=function(_0x529a1d){var _0x30b23e=this;return new Promise(function(_0x3b1073,_0x5cd960){return db[_0xe871('0x17')][_0xe871('0x18')]({'raw':_0x529a1d[_0xe871('0x19')]?_0x529a1d['options'][_0xe871('0x1a')]===undefined?!![]:![]:!![],'where':_0x529a1d[_0xe871('0x19')]?_0x529a1d[_0xe871('0x19')]['where']||null:null,'attributes':_0x529a1d[_0xe871('0x19')]?_0x529a1d[_0xe871('0x19')]['attributes']||null:null,'limit':_0x529a1d[_0xe871('0x19')]?_0x529a1d[_0xe871('0x19')][_0xe871('0x1b')]||null:null,'include':_0x529a1d['options']?_0x529a1d['options'][_0xe871('0x1c')]?_[_0xe871('0x1d')](_0x529a1d['options'][_0xe871('0x1c')],function(_0x41bc12){return{'model':db[_0x41bc12[_0xe871('0x1e')]],'as':_0x41bc12['as'],'attributes':_0x41bc12[_0xe871('0x1f')],'include':_0x41bc12[_0xe871('0x1c')]?_['map'](_0x41bc12['include'],function(_0x4c1644){return{'model':db[_0x4c1644[_0xe871('0x1e')]],'as':_0x4c1644['as'],'attributes':_0x4c1644[_0xe871('0x1f')],'include':_0x4c1644[_0xe871('0x1c')]?_['map'](_0x4c1644[_0xe871('0x1c')],function(_0x1ab8f9){return{'model':db[_0x1ab8f9[_0xe871('0x1e')]],'as':_0x1ab8f9['as'],'attributes':_0x1ab8f9[_0xe871('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe871('0xa')](function(_0x1a409d){logger[_0xe871('0xb')](_0xe871('0x16'),_0x529a1d);logger[_0xe871('0xe')]('GetTrunk',_0x529a1d,JSON['stringify'](_0x1a409d));_0x3b1073(_0x1a409d);})[_0xe871('0x15')](function(_0x1f8895){logger[_0xe871('0x11')](_0xe871('0x16'),_0x1f8895[_0xe871('0x13')],_0x529a1d);_0x5cd960(_0x30b23e[_0xe871('0x11')](0x1f4,_0x1f8895['message']));});});};exports[_0xe871('0x20')]=function(_0x563d6c){var _0x4b5ec1=this;return new Promise(function(_0x51da78,_0x2c4327){return db['Trunk'][_0xe871('0x21')]({'raw':_0x563d6c['options']?_0x563d6c['options'][_0xe871('0x1a')]===undefined?!![]:![]:!![],'where':_0x563d6c['options']?_0x563d6c[_0xe871('0x19')]['where']||null:null,'attributes':_0x563d6c[_0xe871('0x19')]?_0x563d6c['options']['attributes']||null:null,'include':_0x563d6c[_0xe871('0x19')]?_0x563d6c['options'][_0xe871('0x1c')]?_[_0xe871('0x1d')](_0x563d6c['options']['include'],function(_0x533279){return{'model':db[_0x533279[_0xe871('0x1e')]],'as':_0x533279['as'],'attributes':_0x533279['attributes'],'include':_0x533279[_0xe871('0x1c')]?_[_0xe871('0x1d')](_0x533279[_0xe871('0x1c')],function(_0x2066a1){return{'model':db[_0x2066a1[_0xe871('0x1e')]],'as':_0x2066a1['as'],'attributes':_0x2066a1[_0xe871('0x1f')],'include':_0x2066a1[_0xe871('0x1c')]?_['map'](_0x2066a1[_0xe871('0x1c')],function(_0x9ff00c){return{'model':db[_0x9ff00c[_0xe871('0x1e')]],'as':_0x9ff00c['as'],'attributes':_0x9ff00c[_0xe871('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe871('0xa')](function(_0x2b8a94){logger[_0xe871('0xb')](_0xe871('0x20'),_0x563d6c);logger[_0xe871('0xe')](_0xe871('0x20'),_0x563d6c,JSON[_0xe871('0x10')](_0x2b8a94));_0x51da78(_0x2b8a94);})[_0xe871('0x15')](function(_0x5c0e95){logger[_0xe871('0x11')](_0xe871('0x20'),_0x5c0e95[_0xe871('0x13')],_0x563d6c);_0x2c4327(_0x4b5ec1['error'](0x1f4,_0x5c0e95['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 89bf211..9c4d44a 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 _0xbb1c=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbb1c,0x173));var _0xcbb1=function(_0x9ea8c2,_0xc86974){_0x9ea8c2=_0x9ea8c2-0x0;var _0x56cf27=_0xbb1c[_0x9ea8c2];return _0x56cf27;};'use strict';var express=require(_0xcbb1('0x0'));var router=express[_0xcbb1('0x1')]();var auth=require(_0xcbb1('0x2'));var controller=require(_0xcbb1('0x3'));router[_0xcbb1('0x4')](_0xcbb1('0x5'),auth[_0xcbb1('0x6')](),controller[_0xcbb1('0x7')]);module[_0xcbb1('0x8')]=router; \ No newline at end of file +var _0x5085=['put','isAuthenticated','update','express','Router','../../components/auth/service'];(function(_0x2cfe87,_0x1d63de){var _0x55153c=function(_0x43c34a){while(--_0x43c34a){_0x2cfe87['push'](_0x2cfe87['shift']());}};_0x55153c(++_0x1d63de);}(_0x5085,0xbd));var _0x5508=function(_0x3c4398,_0x1682a6){_0x3c4398=_0x3c4398-0x0;var _0x2f3ed7=_0x5085[_0x3c4398];return _0x2f3ed7;};'use strict';var express=require(_0x5508('0x0'));var router=express[_0x5508('0x1')]();var auth=require(_0x5508('0x2'));var controller=require('./user-setting.controller');router[_0x5508('0x3')]('/:id',auth[_0x5508('0x4')](),controller[_0x5508('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 84a5a29..fe88c93 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 _0xbf8b=['INTEGER','UserId','error','warning','info','debug','exports','BOOLEAN','TEXT','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf8b,0x1b0));var _0xbbf8=function(_0x3b5b3d,_0x724a61){_0x3b5b3d=_0x3b5b3d-0x0;var _0x124686=_0xbf8b[_0x3b5b3d];return _0x124686;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xbbf8('0x0'),_0xbbf8('0x1'),_0xbbf8('0x2'),_0xbbf8('0x3')];module[_0xbbf8('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xbbf8('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xbbf8('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xbbf8('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xbbf8('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xbbf8('0x8')],'unique':_0xbbf8('0x9')}}; \ No newline at end of file +var _0x448a=['BOOLEAN','DATE','INTEGER','UserId','sequelize','warning','info','ENUM'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x448a,0x1a4));var _0xa448=function(_0x33734a,_0x370171){_0x33734a=_0x33734a-0x0;var _0x52858b=_0x448a[_0x33734a];return _0x52858b;};'use strict';var Sequelize=require(_0xa448('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xa448('0x1'),_0xa448('0x2'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xa448('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa448('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xa448('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xa448('0x6')],'unique':_0xa448('0x7')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 6fb9dc4..63e55f5 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 _0x0bde=['ioredis','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','status','json','update','then','stack','name','user','role','admin','Unauthorized','params','body'];(function(_0xd8fba6,_0x363e6){var _0x3fcfd9=function(_0x984298){while(--_0x984298){_0xd8fba6['push'](_0xd8fba6['shift']());}};_0x3fcfd9(++_0x363e6);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var Redis=require(_0xe0bd('0x0'));var logger=require('../../config/logger')(_0xe0bd('0x1'));var config=require(_0xe0bd('0x2'));var db=require(_0xe0bd('0x3'))['db'];var socket=require(_0xe0bd('0x4'))(new Redis(config[_0xe0bd('0x5')]));require('./user-setting.socket')[_0xe0bd('0x6')](socket);config[_0xe0bd('0x5')]=_[_0xe0bd('0x7')](config[_0xe0bd('0x5')],{'host':_0xe0bd('0x8'),'port':0x18eb});function respondWithResult(_0x26393f,_0x217145){_0x217145=_0x217145||0xc8;return function(_0x491dc7){if(_0x491dc7){return _0x26393f[_0xe0bd('0x9')](_0x217145)[_0xe0bd('0xa')](_0x491dc7);}};}function saveUpdates(_0xb17265){return function(_0x2d32c6){if(_0x2d32c6){return _0x2d32c6[_0xe0bd('0xb')](_0xb17265)[_0xe0bd('0xc')](function(_0x475265){return _0x475265;});}return null;};}function handleEntityNotFound(_0x58d892){return function(_0x561b74){if(!_0x561b74){_0x58d892['sendStatus'](0x194);}return _0x561b74;};}function handleError(_0x47f96d,_0x44ffa9){_0x44ffa9=_0x44ffa9||0x1f4;return function(_0x5e2a24){logger['error'](_0x5e2a24[_0xe0bd('0xd')]);if(_0x5e2a24[_0xe0bd('0xe')]){delete _0x5e2a24['name'];}_0x47f96d[_0xe0bd('0x9')](_0x44ffa9)['send'](_0x5e2a24);};}exports[_0xe0bd('0xb')]=function(_0x436535,_0x3b2fb1){if(_0x436535[_0xe0bd('0xf')][_0xe0bd('0x10')]!==_0xe0bd('0x11'))throw new Error(_0xe0bd('0x12'));if(isNaN(Number(_0x436535[_0xe0bd('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting']['find']({'where':{'id':_0x436535[_0xe0bd('0x13')]['id']}})[_0xe0bd('0xc')](handleEntityNotFound(_0x3b2fb1,null))[_0xe0bd('0xc')](saveUpdates(_0x436535[_0xe0bd('0x14')],null))[_0xe0bd('0xc')](respondWithResult(_0x3b2fb1,null))['catch'](handleError(_0x3b2fb1,null));}; \ No newline at end of file +var _0x6ae0=['sendStatus','error','stack','name','user','role','admin','Invalid\x20user\x20setting\x20id','find','params','catch','lodash','ioredis','../../config/logger','api','socket.io-emitter','./user-setting.socket','redis','defaults','localhost','json','update','then'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x6ae0,0x192));var _0x06ae=function(_0x129b3c,_0x2706d8){_0x129b3c=_0x129b3c-0x0;var _0x101d89=_0x6ae0[_0x129b3c];return _0x101d89;};'use strict';var _=require(_0x06ae('0x0'));var Redis=require(_0x06ae('0x1'));var logger=require(_0x06ae('0x2'))(_0x06ae('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x06ae('0x4'))(new Redis(config['redis']));require(_0x06ae('0x5'))['register'](socket);config[_0x06ae('0x6')]=_[_0x06ae('0x7')](config['redis'],{'host':_0x06ae('0x8'),'port':0x18eb});function respondWithResult(_0x51bac4,_0x26167c){_0x26167c=_0x26167c||0xc8;return function(_0x2bc2ad){if(_0x2bc2ad){return _0x51bac4['status'](_0x26167c)[_0x06ae('0x9')](_0x2bc2ad);}};}function saveUpdates(_0x240758){return function(_0x4ce533){if(_0x4ce533){return _0x4ce533[_0x06ae('0xa')](_0x240758)[_0x06ae('0xb')](function(_0x1a667c){return _0x1a667c;});}return null;};}function handleEntityNotFound(_0x407a5a){return function(_0x58aac0){if(!_0x58aac0){_0x407a5a[_0x06ae('0xc')](0x194);}return _0x58aac0;};}function handleError(_0xb59ea6,_0xe29a31){_0xe29a31=_0xe29a31||0x1f4;return function(_0x2b0fff){logger[_0x06ae('0xd')](_0x2b0fff[_0x06ae('0xe')]);if(_0x2b0fff[_0x06ae('0xf')]){delete _0x2b0fff['name'];}_0xb59ea6['status'](_0xe29a31)['send'](_0x2b0fff);};}exports[_0x06ae('0xa')]=function(_0x480c9a,_0x2c0c6c){if(_0x480c9a[_0x06ae('0x10')][_0x06ae('0x11')]!==_0x06ae('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x480c9a['params']['id'])))throw new Error(_0x06ae('0x13'));return db['UserSetting'][_0x06ae('0x14')]({'where':{'id':_0x480c9a[_0x06ae('0x15')]['id']}})[_0x06ae('0xb')](handleEntityNotFound(_0x2c0c6c,null))['then'](saveUpdates(_0x480c9a['body'],null))['then'](respondWithResult(_0x2c0c6c,null))[_0x06ae('0x16')](handleError(_0x2c0c6c,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 0628cf1..c721a1c 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 _0xdbdf=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','update'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xdbdf,0x87));var _0xfdbd=function(_0x5e69f5,_0x52fbf3){_0x5e69f5=_0x5e69f5-0x0;var _0x237a73=_0xdbdf[_0x5e69f5];return _0x237a73;};'use strict';var EventEmitter=require(_0xfdbd('0x0'));var UserSetting=require(_0xfdbd('0x1'))['db'][_0xfdbd('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xfdbd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdbd('0x4'),'afterDestroy':_0xfdbd('0x5')};function emitEvent(_0x420a45){return function(_0x13a27a,_0x594fcc,_0x568364){UserSettingEvents[_0xfdbd('0x6')](_0x420a45+':'+_0x13a27a['id'],_0x13a27a);UserSettingEvents[_0xfdbd('0x6')](_0x420a45,_0x13a27a);_0x568364(null);};}for(var e in events){if(events[_0xfdbd('0x7')](e)){var event=events[e];UserSetting[_0xfdbd('0x8')](e,emitEvent(event));}}module[_0xfdbd('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x6280=['hook','exports','events','setMaxListeners','emit'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x6280,0x7a));var _0x0628=function(_0x17cb5a,_0x562d78){_0x17cb5a=_0x17cb5a-0x0;var _0x5d7af2=_0x6280[_0x17cb5a];return _0x5d7af2;};'use strict';var EventEmitter=require(_0x0628('0x0'));var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0628('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5ddd27){return function(_0x51a6f8,_0x1c2e0a,_0x3a74ba){UserSettingEvents[_0x0628('0x2')](_0x5ddd27+':'+_0x51a6f8['id'],_0x51a6f8);UserSettingEvents['emit'](_0x5ddd27,_0x51a6f8);_0x3a74ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x0628('0x3')](e,emitEvent(event));}}module[_0x0628('0x4')]=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 9ae2dcc..f0d0f99 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 _0xd3f5=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x579220,_0x185a18){var _0x533780=function(_0xc60d33){while(--_0xc60d33){_0x579220['push'](_0x579220['shift']());}};_0x533780(++_0x185a18);}(_0xd3f5,0x147));var _0x5d3f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xd3f5[_0x618414];return _0x21c19a;};'use strict';var attributes=require(_0x5d3f('0x0'));module[_0x5d3f('0x1')]=function(_0x590291){return _0x590291[_0x5d3f('0x2')](_0x5d3f('0x3'),attributes,{'tableName':_0x5d3f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x432ba1){if(!_0x432ba1[_0x5d3f('0x5')])_0x432ba1[_0x5d3f('0x6')]=null;else if(_0x432ba1[_0x5d3f('0x6')]===null)_0x432ba1[_0x5d3f('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x7633=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x2d50d0,_0x364d3c){var _0x110d38=function(_0x54aaf2){while(--_0x54aaf2){_0x2d50d0['push'](_0x2d50d0['shift']());}};_0x110d38(++_0x364d3c);}(_0x7633,0x1c4));var _0x3763=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7633[_0x1ac595];return _0x455fff;};'use strict';var attributes=require(_0x3763('0x0'));module[_0x3763('0x1')]=function(_0x1a6321){return _0x1a6321[_0x3763('0x2')](_0x3763('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa069d0){if(!_0xa069d0[_0x3763('0x4')])_0xa069d0['clientSideLoggingEnabledSince']=null;else if(_0xa069d0[_0x3763('0x5')]===null)_0xa069d0[_0x3763('0x5')]=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 01c0e07..01118c6 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 _0x0a6d=['user-setting:update:user-','UserId','length','user-setting:','./user-setting.events','remove','update','emit'];(function(_0x29e871,_0x330b98){var _0x3380e3=function(_0x26eeae){while(--_0x26eeae){_0x29e871['push'](_0x29e871['shift']());}};_0x3380e3(++_0x330b98);}(_0x0a6d,0x1dc));var _0xd0a6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0a6d[_0x4b369d];return _0x571a98;};'use strict';var UserSettingEvents=require(_0xd0a6('0x0'));var events=['save',_0xd0a6('0x1'),_0xd0a6('0x2')];function createListener(_0x167a5d,_0x155da8){return function(_0x1df777){_0x155da8['emit'](_0x167a5d,_0x1df777);if(_0x167a5d==='user-setting:update'){_0x155da8[_0xd0a6('0x3')](_0xd0a6('0x4')+_0x1df777[_0xd0a6('0x5')],_0x1df777);}};}exports['register']=function(_0x4b5722){for(var _0x593b39=0x0,_0x56bcd7=events[_0xd0a6('0x6')];_0x593b39<_0x56bcd7;_0x593b39++){var _0x5cb915=events[_0x593b39];var _0x25e4ad=createListener(_0xd0a6('0x7')+_0x5cb915,_0x4b5722);UserSettingEvents['on'](_0x5cb915,_0x25e4ad);}}; \ No newline at end of file +var _0x7094=['user-setting:update:user-','UserId','register','length','user-setting:','save','remove','emit','user-setting:update'];(function(_0x27448a,_0x51b7bb){var _0x15971e=function(_0x400131){while(--_0x400131){_0x27448a['push'](_0x27448a['shift']());}};_0x15971e(++_0x51b7bb);}(_0x7094,0x1f4));var _0x4709=function(_0xb41999,_0x5836c0){_0xb41999=_0xb41999-0x0;var _0x376f48=_0x7094[_0xb41999];return _0x376f48;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x4709('0x0'),_0x4709('0x1'),'update'];function createListener(_0x37dcc2,_0x59eca9){return function(_0x3ebb9e){_0x59eca9[_0x4709('0x2')](_0x37dcc2,_0x3ebb9e);if(_0x37dcc2===_0x4709('0x3')){_0x59eca9['emit'](_0x4709('0x4')+_0x3ebb9e[_0x4709('0x5')],_0x3ebb9e);}};}exports[_0x4709('0x6')]=function(_0x5d5586){for(var _0x502362=0x0,_0x531b8e=events[_0x4709('0x7')];_0x502362<_0x531b8e;_0x502362++){var _0x28ff0f=events[_0x502362];var _0x5f0ac9=createListener(_0x4709('0x8')+_0x28ff0f,_0x5d5586);UserSettingEvents['on'](_0x28ff0f,_0x5f0ac9);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 22935f4..4e427d1 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 _0x1948=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','/presence','getPresence','show','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/mail_accounts','/:id/sms_accounts','getSmsAccounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','addContacts','post','create','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','file','addAvatar','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','/:id/fax_accounts','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','/:id','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1948,0x145));var _0x8194=function(_0x3d695c,_0x2ea4f8){_0x3d695c=_0x3d695c-0x0;var _0x5b8a39=_0x1948[_0x3d695c];return _0x5b8a39;};'use strict';var multer=require(_0x8194('0x0'));var util=require(_0x8194('0x1'));var path=require(_0x8194('0x2'));var timeout=require(_0x8194('0x3'));var express=require(_0x8194('0x4'));var router=express['Router']();var fs_extra=require(_0x8194('0x5'));var auth=require(_0x8194('0x6'));var interaction=require(_0x8194('0x7'));var config=require(_0x8194('0x8'));var controller=require(_0x8194('0x9'));router[_0x8194('0xa')]('/',auth[_0x8194('0xb')](),controller[_0x8194('0xc')]);router['get'](_0x8194('0xd'),auth[_0x8194('0xb')](),controller['describe']);router[_0x8194('0xa')](_0x8194('0xe'),auth['isAuthenticated'](),controller['whoami']);router[_0x8194('0xa')](_0x8194('0xf'),auth[_0x8194('0xb')](),controller[_0x8194('0x10')]);router[_0x8194('0xa')]('/:id',auth[_0x8194('0xb')](),controller[_0x8194('0x11')]);router[_0x8194('0xa')]('/:id/avatar',controller[_0x8194('0x12')]);router[_0x8194('0xa')](_0x8194('0x13'),auth[_0x8194('0xb')](),controller[_0x8194('0x14')]);router[_0x8194('0xa')]('/:id/contacts',auth[_0x8194('0xb')](),controller[_0x8194('0x15')]);router[_0x8194('0xa')](_0x8194('0x16'),auth[_0x8194('0xb')](),controller[_0x8194('0x17')]);router[_0x8194('0xa')](_0x8194('0x18'),auth[_0x8194('0xb')](),controller['getVoiceQueuesRt']);router[_0x8194('0xa')](_0x8194('0x19'),auth['isAuthenticated'](),controller[_0x8194('0x1a')]);router['get']('/:id/recordings',auth['isAuthenticated'](),controller[_0x8194('0x1b')]);router[_0x8194('0xa')](_0x8194('0x1c'),auth[_0x8194('0xb')](),controller[_0x8194('0x1d')]);router[_0x8194('0xa')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x8194('0x1e')]);router['get'](_0x8194('0x1f'),auth[_0x8194('0xb')](),controller[_0x8194('0x20')]);router['get'](_0x8194('0x21'),auth[_0x8194('0xb')](),controller[_0x8194('0x22')]);router[_0x8194('0xa')](_0x8194('0x23'),auth[_0x8194('0xb')](),controller[_0x8194('0x24')]);router[_0x8194('0xa')](_0x8194('0x25'),auth[_0x8194('0xb')](),controller[_0x8194('0x26')]);router[_0x8194('0xa')]('/:id/whatsapp/interactions',auth[_0x8194('0xb')](),controller[_0x8194('0x27')]);router[_0x8194('0xa')](_0x8194('0x28'),auth['isAuthenticated'](),controller[_0x8194('0x29')]);router[_0x8194('0xa')](_0x8194('0x2a'),auth[_0x8194('0xb')](),controller[_0x8194('0x2b')]);router['get']('/:id/agents',auth[_0x8194('0xb')](),controller[_0x8194('0x2c')]);router[_0x8194('0xa')](_0x8194('0x2d'),auth[_0x8194('0xb')](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth[_0x8194('0xb')](),controller['getFaxAccounts']);router['get'](_0x8194('0x2e'),auth[_0x8194('0xb')](),controller['getMailAccounts']);router[_0x8194('0xa')]('/:id/openchannel_accounts',auth[_0x8194('0xb')](),controller['getOpenchannelAccounts']);router[_0x8194('0xa')](_0x8194('0x2f'),auth[_0x8194('0xb')](),controller[_0x8194('0x30')]);router[_0x8194('0xa')]('/:id/chat_websites',auth[_0x8194('0xb')](),controller['getChatWebsites']);router[_0x8194('0xa')]('/:id/whatsapp_accounts',auth[_0x8194('0xb')](),controller[_0x8194('0x31')]);router[_0x8194('0xa')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x8194('0x32')]);router[_0x8194('0xa')](_0x8194('0x33'),auth[_0x8194('0xb')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0x8194('0xb')](),controller[_0x8194('0x34')]);router[_0x8194('0x35')]('/',auth[_0x8194('0xb')](),controller[_0x8194('0x36')]);router[_0x8194('0x35')]('/create_many',auth[_0x8194('0xb')](),controller[_0x8194('0x37')]);router[_0x8194('0x35')](_0x8194('0x16'),auth[_0x8194('0xb')](),controller[_0x8194('0x38')]);var upload=multer({'storage':multer[_0x8194('0x39')]({'destination':function(_0x44c8e6,_0x3627ec,_0x3965ff){_0x3965ff(null,path[_0x8194('0x3a')](config[_0x8194('0x3b')],'server/files/images/'));},'filename':function(_0x1be49d,_0x48a8ee,_0x542768){_0x542768(null,util[_0x8194('0x3c')](_0x8194('0x3d'),Date['now'](),_0x48a8ee['originalname']));}})});router['post']('/:id/avatar',upload['single'](_0x8194('0x3e')),controller[_0x8194('0x3f')]);router[_0x8194('0x35')]('/:id/login',auth['isAuthenticated'](),controller['login']);router[_0x8194('0x35')](_0x8194('0x40'),auth[_0x8194('0xb')](),controller[_0x8194('0x41')]);router['post'](_0x8194('0x42'),auth[_0x8194('0xb')](),controller[_0x8194('0x43')]);router[_0x8194('0x35')](_0x8194('0x44'),auth['isAuthenticated'](),controller[_0x8194('0x45')]);router[_0x8194('0x35')](_0x8194('0x28'),auth[_0x8194('0xb')](),controller[_0x8194('0x46')]);router[_0x8194('0x35')](_0x8194('0x47'),auth['isAuthenticated'](),controller[_0x8194('0x48')]);router[_0x8194('0x35')](_0x8194('0x49'),auth[_0x8194('0xb')](),controller['addMailInteractions']);router['post'](_0x8194('0x4a'),auth['isAuthenticated'](),controller[_0x8194('0x4b')]);router['post'](_0x8194('0x4c'),auth['isAuthenticated'](),controller[_0x8194('0x4d')]);router[_0x8194('0x35')](_0x8194('0x4e'),auth[_0x8194('0xb')](),controller['addOpenchannelInteractions']);router[_0x8194('0x35')](_0x8194('0x4f'),auth[_0x8194('0xb')](),controller['addWhatsappInteractions']);router[_0x8194('0x35')](_0x8194('0x50'),auth[_0x8194('0xb')](),controller[_0x8194('0x51')]);router[_0x8194('0x35')]('/:id/mail_accounts',auth[_0x8194('0xb')](),controller['addMailAccounts']);router[_0x8194('0x35')](_0x8194('0x52'),auth[_0x8194('0xb')](),controller[_0x8194('0x53')]);router[_0x8194('0x35')](_0x8194('0x2f'),auth[_0x8194('0xb')](),controller[_0x8194('0x54')]);router[_0x8194('0x35')](_0x8194('0x55'),auth[_0x8194('0xb')](),controller[_0x8194('0x56')]);router[_0x8194('0x35')](_0x8194('0x57'),auth[_0x8194('0xb')](),controller[_0x8194('0x58')]);router[_0x8194('0x35')](_0x8194('0x33'),auth['isAuthenticated'](),controller[_0x8194('0x59')]);router[_0x8194('0x5a')]('/:id',auth['isAuthenticated'](),controller[_0x8194('0x5b')]);router[_0x8194('0x5a')](_0x8194('0x5c'),auth[_0x8194('0xb')](),controller[_0x8194('0x5d')]);router[_0x8194('0x5e')](_0x8194('0x16'),auth[_0x8194('0xb')](),controller[_0x8194('0x5f')]);router[_0x8194('0x5e')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x8194('0x60'),auth[_0x8194('0xb')](),controller[_0x8194('0x61')]);router[_0x8194('0x5e')](_0x8194('0x47'),auth[_0x8194('0xb')](),controller[_0x8194('0x62')]);router[_0x8194('0x5e')](_0x8194('0x49'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x8194('0x5e')](_0x8194('0x4a'),auth[_0x8194('0xb')](),controller[_0x8194('0x63')]);router[_0x8194('0x5e')](_0x8194('0x4c'),auth['isAuthenticated'](),controller[_0x8194('0x64')]);router[_0x8194('0x5e')](_0x8194('0x4e'),auth[_0x8194('0xb')](),controller[_0x8194('0x65')]);router[_0x8194('0x5e')](_0x8194('0x4f'),auth[_0x8194('0xb')](),controller['removeWhatsappInteractions']);router[_0x8194('0x5e')](_0x8194('0x50'),auth[_0x8194('0xb')](),controller[_0x8194('0x66')]);router[_0x8194('0x5e')](_0x8194('0x2e'),auth[_0x8194('0xb')](),controller[_0x8194('0x67')]);router[_0x8194('0x5e')](_0x8194('0x52'),auth[_0x8194('0xb')](),controller['removeOpenchannelAccounts']);router[_0x8194('0x5e')](_0x8194('0x2f'),auth[_0x8194('0xb')](),controller[_0x8194('0x68')]);router['delete']('/:id/chat_websites',auth[_0x8194('0xb')](),controller[_0x8194('0x69')]);router[_0x8194('0x5e')](_0x8194('0x57'),auth[_0x8194('0xb')](),controller['removeWhatsappAccounts']);router[_0x8194('0x5e')](_0x8194('0x33'),auth[_0x8194('0xb')](),controller[_0x8194('0x6a')]);module[_0x8194('0x6b')]=router; \ No newline at end of file +var _0x2547=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','root','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar','login','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','put','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x2547,0x1cd));var _0x7254=function(_0x43ab0b,_0x450af3){_0x43ab0b=_0x43ab0b-0x0;var _0x2d76e6=_0x2547[_0x43ab0b];return _0x2d76e6;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['whoami']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x9')](_0x7254('0x11'),auth[_0x7254('0xa')](),controller['show']);router[_0x7254('0x9')]('/:id/avatar',controller[_0x7254('0x12')]);router['get'](_0x7254('0x13'),auth[_0x7254('0xa')](),controller[_0x7254('0x14')]);router[_0x7254('0x9')](_0x7254('0x15'),auth[_0x7254('0xa')](),controller[_0x7254('0x16')]);router[_0x7254('0x9')](_0x7254('0x17'),auth[_0x7254('0xa')](),controller[_0x7254('0x18')]);router[_0x7254('0x9')](_0x7254('0x19'),auth['isAuthenticated'](),controller[_0x7254('0x1a')]);router[_0x7254('0x9')](_0x7254('0x1b'),auth[_0x7254('0xa')](),controller[_0x7254('0x1c')]);router[_0x7254('0x9')](_0x7254('0x1d'),auth['isAuthenticated'](),controller[_0x7254('0x1e')]);router[_0x7254('0x9')](_0x7254('0x1f'),auth[_0x7254('0xa')](),controller[_0x7254('0x20')]);router[_0x7254('0x9')](_0x7254('0x21'),auth[_0x7254('0xa')](),controller[_0x7254('0x22')]);router[_0x7254('0x9')](_0x7254('0x23'),auth[_0x7254('0xa')](),controller[_0x7254('0x24')]);router[_0x7254('0x9')](_0x7254('0x25'),auth[_0x7254('0xa')](),controller[_0x7254('0x26')]);router[_0x7254('0x9')](_0x7254('0x27'),auth[_0x7254('0xa')](),controller[_0x7254('0x28')]);router['get']('/:id/fax/interactions',auth[_0x7254('0xa')](),controller[_0x7254('0x29')]);router[_0x7254('0x9')](_0x7254('0x2a'),auth[_0x7254('0xa')](),controller[_0x7254('0x2b')]);router[_0x7254('0x9')]('/:id/teams',auth[_0x7254('0xa')](),controller[_0x7254('0x2c')]);router[_0x7254('0x9')]('/:id/lists',auth[_0x7254('0xa')](),controller['getLists']);router[_0x7254('0x9')](_0x7254('0x2d'),auth['isAuthenticated'](),controller[_0x7254('0x2e')]);router[_0x7254('0x9')]('/:id/prefixes',auth[_0x7254('0xa')](),controller[_0x7254('0x2f')]);router[_0x7254('0x9')](_0x7254('0x30'),auth[_0x7254('0xa')](),controller[_0x7254('0x31')]);router['get'](_0x7254('0x32'),auth[_0x7254('0xa')](),controller['getMailAccounts']);router[_0x7254('0x9')](_0x7254('0x33'),auth[_0x7254('0xa')](),controller['getOpenchannelAccounts']);router[_0x7254('0x9')](_0x7254('0x34'),auth[_0x7254('0xa')](),controller[_0x7254('0x35')]);router[_0x7254('0x9')](_0x7254('0x36'),auth[_0x7254('0xa')](),controller['getChatWebsites']);router[_0x7254('0x9')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x7254('0x37')]);router[_0x7254('0x9')](_0x7254('0x38'),auth[_0x7254('0xa')](),controller[_0x7254('0x39')]);router[_0x7254('0x9')](_0x7254('0x3a'),auth[_0x7254('0xa')](),controller[_0x7254('0x3b')]);router[_0x7254('0x3c')](_0x7254('0x15'),auth[_0x7254('0xa')](),controller[_0x7254('0x3d')]);router[_0x7254('0x3c')]('/',auth['isAuthenticated'](),controller[_0x7254('0x3e')]);router[_0x7254('0x3c')](_0x7254('0x3f'),auth[_0x7254('0xa')](),controller[_0x7254('0x40')]);router['post'](_0x7254('0x17'),auth['isAuthenticated'](),controller[_0x7254('0x41')]);var upload=multer({'storage':multer[_0x7254('0x42')]({'destination':function(_0x3bb517,_0x238aa6,_0x5726fc){_0x5726fc(null,path['join'](config[_0x7254('0x43')],'server/files/images/'));},'filename':function(_0x1c03c5,_0x12bd3b,_0x49ea48){_0x49ea48(null,util[_0x7254('0x44')](_0x7254('0x45'),Date[_0x7254('0x46')](),_0x12bd3b[_0x7254('0x47')]));}})});router[_0x7254('0x3c')](_0x7254('0x48'),upload['single'](_0x7254('0x49')),controller[_0x7254('0x4a')]);router[_0x7254('0x3c')]('/:id/login',auth[_0x7254('0xa')](),controller[_0x7254('0x4b')]);router[_0x7254('0x3c')]('/:id/logout',auth[_0x7254('0xa')](),controller[_0x7254('0x4c')]);router[_0x7254('0x3c')](_0x7254('0x4d'),auth[_0x7254('0xa')](),controller['pause']);router['post'](_0x7254('0x4e'),auth[_0x7254('0xa')](),controller[_0x7254('0x4f')]);router[_0x7254('0x3c')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7254('0x50')]);router['post'](_0x7254('0x51'),auth[_0x7254('0xa')](),controller[_0x7254('0x52')]);router[_0x7254('0x3c')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x7254('0x53')]);router[_0x7254('0x3c')](_0x7254('0x54'),auth[_0x7254('0xa')](),controller[_0x7254('0x55')]);router['post']('/:id/sms_interactions',auth[_0x7254('0xa')](),controller[_0x7254('0x56')]);router[_0x7254('0x3c')]('/:id/openchannel_interactions',auth[_0x7254('0xa')](),controller[_0x7254('0x57')]);router['post'](_0x7254('0x58'),auth[_0x7254('0xa')](),controller[_0x7254('0x59')]);router[_0x7254('0x3c')]('/:id/fax_accounts',auth[_0x7254('0xa')](),controller[_0x7254('0x5a')]);router['post'](_0x7254('0x32'),auth[_0x7254('0xa')](),controller[_0x7254('0x5b')]);router['post'](_0x7254('0x33'),auth[_0x7254('0xa')](),controller['addOpenchannelAccounts']);router['post'](_0x7254('0x34'),auth['isAuthenticated'](),controller[_0x7254('0x5c')]);router[_0x7254('0x3c')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x7254('0x5d')]);router[_0x7254('0x3c')](_0x7254('0x5e'),auth[_0x7254('0xa')](),controller[_0x7254('0x5f')]);router[_0x7254('0x3c')]('/:id/api_key',auth[_0x7254('0xa')](),controller['createApiKey']);router[_0x7254('0x60')](_0x7254('0x11'),auth[_0x7254('0xa')](),controller['update']);router[_0x7254('0x60')](_0x7254('0x61'),auth[_0x7254('0xa')](),controller['changePassword']);router[_0x7254('0x62')](_0x7254('0x17'),auth[_0x7254('0xa')](),controller[_0x7254('0x63')]);router[_0x7254('0x62')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7254('0x64')]);router[_0x7254('0x62')](_0x7254('0x11'),auth[_0x7254('0xa')](),controller[_0x7254('0x65')]);router['delete']('/:id/chat_interactions',auth[_0x7254('0xa')](),controller[_0x7254('0x66')]);router[_0x7254('0x62')](_0x7254('0x67'),auth['isAuthenticated'](),controller[_0x7254('0x68')]);router[_0x7254('0x62')]('/:id/fax_interactions',auth[_0x7254('0xa')](),controller['removeFaxInteractions']);router[_0x7254('0x62')]('/:id/sms_interactions',auth[_0x7254('0xa')](),controller['removeSmsInteractions']);router['delete'](_0x7254('0x69'),auth[_0x7254('0xa')](),controller[_0x7254('0x6a')]);router[_0x7254('0x62')]('/:id/whatsapp_interactions',auth[_0x7254('0xa')](),controller['removeWhatsappInteractions']);router[_0x7254('0x62')](_0x7254('0x30'),auth[_0x7254('0xa')](),controller[_0x7254('0x6b')]);router[_0x7254('0x62')](_0x7254('0x32'),auth['isAuthenticated'](),controller[_0x7254('0x6c')]);router[_0x7254('0x62')](_0x7254('0x33'),auth[_0x7254('0xa')](),controller[_0x7254('0x6d')]);router[_0x7254('0x62')]('/:id/sms_accounts',auth[_0x7254('0xa')](),controller[_0x7254('0x6e')]);router[_0x7254('0x62')](_0x7254('0x36'),auth[_0x7254('0xa')](),controller[_0x7254('0x6f')]);router[_0x7254('0x62')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x7254('0x70')]);router['delete']('/:id/api_key',auth[_0x7254('0xa')](),controller[_0x7254('0x71')]);module[_0x7254('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6ad21a7..2d48c75 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x56888a,_0x37e91b){var _0x449a5c=function(_0x54d247){while(--_0x54d247){_0x56888a['push'](_0x56888a['shift']());}};_0x449a5c(++_0x37e91b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xcb91[_0x5d8631];return _0x34c15e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['admin','user','agent','telephone','local','accountcode','BOOLEAN','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept','uac','uas','certificate','active','passive','actpass','update,nonat','showWebBar','get','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','avpf','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','blocked','blockedAt','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM'];(function(_0x2acef2,_0x3697dd){var _0x1f9fc2=function(_0x18e429){while(--_0x18e429){_0x2acef2['push'](_0x2acef2['shift']());}};_0x1f9fc2(++_0x3697dd);}(_0xe706,0xa3));var _0x6e70=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xe706[_0x506d83];return _0x335e8b;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var _=require('lodash');module[_0x6e70('0x3')]={'name':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7dfbc3){this[_0x6e70('0x6')](_0x6e70('0x5'),_0x7dfbc3);this[_0x6e70('0x6')](_0x6e70('0x7'),_0x7dfbc3);},'comment':_0x6e70('0x8')},'fullname':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'set':function(_0x36357b){this[_0x6e70('0x6')](_0x6e70('0x9'),_0x36357b);this[_0x6e70('0x6')](_0x6e70('0xa'),util[_0x6e70('0xb')](_0x6e70('0xc'),_0x36357b,this[_0x6e70('0xd')](_0x6e70('0xe'))));}},'alias':{'type':Sequelize[_0x6e70('0x4')]},'email':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0xf'),'validate':{'isEmail':!![]},'set':function(_0x37b3e0){if(_0x37b3e0){this[_0x6e70('0x6')]('email',_0x37b3e0['toLowerCase']());}}},'role':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x11'),_0x6e70('0x12'),_0x6e70('0x13'),_0x6e70('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':_0x6e70('0x15')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x48bc72){this[_0x6e70('0x6')]('internal',_0x48bc72);this['setDataValue'](_0x6e70('0x16'),_0x48bc72);this[_0x6e70('0x6')]('callerid',util[_0x6e70('0xb')]('\x22%s\x22\x20<%s>',this[_0x6e70('0xd')](_0x6e70('0x9')),_0x48bc72));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6e70('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6e70('0x4')]},'userpic':{'type':Sequelize[_0x6e70('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6e70('0x18')]},'voicePause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x6e70('0x18')]},'chatCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x1a')},'ipaddr':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x6e70('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1b'),'user',_0x6e70('0x1c')),'allowNull':!![],'defaultValue':_0x6e70('0x1b')},'context':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x1d')},'callingpres':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1e'),_0x6e70('0x1f'),_0x6e70('0x20'),_0x6e70('0x21'),_0x6e70('0x22'),'PROHIB_PASSED_SCREEN',_0x6e70('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x24'),'set':function(_0x42b094){this['setDataValue'](_0x6e70('0x25'),_0x42b094?_0x42b094[_0x6e70('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x6e70('0x25'))?this[_0x6e70('0xd')](_0x6e70('0x25'))[_0x6e70('0x27')](','):null;},'comment':_0x6e70('0x28')},'dtmfmode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x29'),_0x6e70('0x2a'),_0x6e70('0x2b'),_0x6e70('0x2c'),'auto'),'allowNull':!![],'defaultValue':_0x6e70('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no',_0x6e70('0x2e'),_0x6e70('0x2f'),_0x6e70('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x31'),'set':function(_0x2a5444){this[_0x6e70('0x6')](_0x6e70('0x32'),_0x2a5444?_0x2a5444['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x6e70('0xd')](_0x6e70('0x32'))[_0x6e70('0x27')](','):null;},'comment':_0x6e70('0x33')},'callgroup':{'type':Sequelize[_0x6e70('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6e70('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x6e70('0x4')]},'language':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6e70('0x4')]},'disallow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x34')},'allow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x35'),'set':function(_0x16fc7d){this['setDataValue'](_0x6e70('0x36'),_0x16fc7d?_0x16fc7d[_0x6e70('0x26')](';'):_0x6e70('0x35'));},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x36'))?this[_0x6e70('0xd')](_0x6e70('0x36'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'set':function(_0x83847b){this[_0x6e70('0x6')](_0x6e70('0x37'),_0x83847b?_0x83847b['join'](','):null);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x37'))?this[_0x6e70('0xd')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x38')},'amaflags':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x6e70('0x2d')},'busylevel':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6e70('0x10')]('yes','no',_0x6e70('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3a'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3b'),_0x6e70('0x3c')),'allowNull':!![],'defaultValue':_0x6e70('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','fingerprint',_0x6e70('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3e'),_0x6e70('0x3f'),_0x6e70('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','nonat',_0x6e70('0x2f'),_0x6e70('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6e70('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x6e70('0x18')]},'passwordResetAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x2f9be4){this[_0x6e70('0x6')](_0x6e70('0x42'),_0x2f9be4);var _0x41a861=this[_0x6e70('0x43')]({'plain':!![]});switch(_0x2f9be4){case 0x0:case 0x1:var _0x739946=_0x41a861[_0x6e70('0x25')]?_['isArray'](_0x41a861['transport'])?_0x41a861[_0x6e70('0x25')][_0x6e70('0x26')]():_0x41a861[_0x6e70('0x25')]:_0x6e70('0x24');if(_0x739946==='wss'){_0x739946='udp';}this[_0x6e70('0x6')](_0x6e70('0x25'),_0x739946);this['setDataValue']('encryption','no');this[_0x6e70('0x6')]('avpf',null);this[_0x6e70('0x6')](_0x6e70('0x44'),null);this[_0x6e70('0x6')](_0x6e70('0x45'),null);this[_0x6e70('0x6')](_0x6e70('0x46'),null);this[_0x6e70('0x6')](_0x6e70('0x47'),null);this['setDataValue'](_0x6e70('0x48'),null);this[_0x6e70('0x6')](_0x6e70('0x49'),null);this[_0x6e70('0x6')](_0x6e70('0x4a'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x6e70('0x25'),_0x6e70('0x4b'));this[_0x6e70('0x6')]('encryption','yes');this[_0x6e70('0x6')](_0x6e70('0x4c'),_0x6e70('0x2d'));this[_0x6e70('0x6')](_0x6e70('0x44'),_0x6e70('0x2d'));this['setDataValue'](_0x6e70('0x45'),_0x6e70('0x2d'));this[_0x6e70('0x6')](_0x6e70('0x46'),'yes');this[_0x6e70('0x6')]('dtlsverify','no');this['setDataValue'](_0x6e70('0x48'),_0x6e70('0x40'));this[_0x6e70('0x6')](_0x6e70('0x49'),_0x41a861[_0x6e70('0x49')]||_0x6e70('0x4d'));this['setDataValue'](_0x6e70('0x4a'),_0x41a861[_0x6e70('0x4a')]||_0x6e70('0x4e'));this[_0x6e70('0x6')](_0x6e70('0x4f'),_0x6e70('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x6e70('0x50')],'set':function(_0xd9b4a9){this[_0x6e70('0x6')](_0x6e70('0x51'),_0xd9b4a9?_0xd9b4a9['join'](','):[]);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x51'))?_[_0x6e70('0x52')](this['getDataValue']('permissions')[_0x6e70('0x27')](','),function(_0x18ecf0){return parseInt(_0x18ecf0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6e70('0x53')],'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x54'))?this[_0x6e70('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x576069){if(typeof _0x576069===_0x6e70('0x55')){var _0x21e4c2=_0x576069==='1'?!![]:_0x576069==='0'?![]:_0x576069===_0x6e70('0x56')?!![]:_0x576069==='false'?![]:![];this['setDataValue']('screenrecording',_0x21e4c2);}else{this[_0x6e70('0x6')]('screenrecording',_0x576069);}}},'blocked':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![],'set':function(_0x34237d){this[_0x6e70('0x6')](_0x6e70('0x57'),_0x34237d);if(_0x34237d===!![]){this[_0x6e70('0x6')](_0x6e70('0x58'),moment());this[_0x6e70('0x6')]('loginAttempts',0x0);}else{this[_0x6e70('0x6')](_0x6e70('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6e70('0x19')](0x5)[_0x6e70('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 36e3686..279aedb 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 _0xec66=['Tag','Tags','color','tag','findAll','getQueues','Queue','rawAttributes','order','sort','where','pick','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','upsert','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','bulkCreate','LOGININPAUSE','isMiddleware','resolve','logout','MemberReport','pause','QueuePause','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','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','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$ne','$not','$between','$notBetween','$like','$notLike','$iLike','$overlap','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','flatten','lower','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','busy','charAt','toUpperCase','slice','select','field','ui.','InteractionId','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','register','redis','localhost','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','role','emit','userNotification:recalc:','get','admin','user','Telephones','telephone','filter','map','value','includes','find','destroy','stack','name','index','fieldName','type','key','salt','getOptions','User','includeAll','include','query','true','UserSetting','userSetting','attributes','push','rows','openTabs','length','dataValues','sms','fax','mail','openchannel','all','show','model','differenceBy','password','keys','filters','intersection','fields','merge','options','body','params','describe','addContacts','omit','internal','findById','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','from','mailbox','VoiceMail','fullname','agent','101','103','104','105','106','107','108','109','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','Agents','isEmpty','autoAssociation','compact','UserProfileResource','changePassword','oldPassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','securePassword','enforcePasswordHistory','validatePasswordPattern','validatePasswordHistory','previousPasswords','passwordHistoryLimit','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','ids','penalty','toLowerCase','QueueId','Queue:save','voice','VoiceQueue','format','UserVoiceQueueRt','removeQueues','remove','Queues','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','download','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','CmList','List'];(function(_0x3d7206,_0x2b53dc){var _0x1a0525=function(_0x2343f8){while(--_0x2343f8){_0x3d7206['push'](_0x3d7206['shift']());}};_0x1a0525(++_0x2b53dc);}(_0xec66,0xcb));var _0x6ec6=function(_0x5222d9,_0x12496d){_0x5222d9=_0x5222d9-0x0;var _0x16b0d5=_0xec66[_0x5222d9];return _0x16b0d5;};'use strict';var moment=require(_0x6ec6('0x0'));var util=require(_0x6ec6('0x1'));var path=require(_0x6ec6('0x2'));var fs=require('fs');var _=require(_0x6ec6('0x3'));var squel=require('squel');var jayson=require(_0x6ec6('0x4'));var Redis=require(_0x6ec6('0x5'));var authService=require(_0x6ec6('0x6'));var contacts=require(_0x6ec6('0x7'));var qs=require(_0x6ec6('0x8'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6ec6('0x9'));var licenseUtil=require(_0x6ec6('0xa'));var APIBadRequestError=require(_0x6ec6('0xb'))[_0x6ec6('0xc')];var APINotFoundError=require('../../errors/api')[_0x6ec6('0xd')];var APIHandleError=require(_0x6ec6('0xb'))[_0x6ec6('0xe')];var db=require(_0x6ec6('0xf'))['db'];var socket=require(_0x6ec6('0x10'))(new Redis(config['redis']));require('./user.socket')[_0x6ec6('0x11')](socket);config[_0x6ec6('0x12')]=_['defaults'](config[_0x6ec6('0x12')],{'host':_0x6ec6('0x13'),'port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x4c7308,_0x33b961,_0x354f5f,_0x24b3bc){return new Promise(function(_0x138f96,_0x4e5f95){var _0x4ae76a=_0x24b3bc||amiClient;return _0x4ae76a[_0x6ec6('0x14')](_0x4c7308,_0x354f5f)[_0x6ec6('0x15')](function(_0x3edb6c){logger[_0x6ec6('0x16')](_0x6ec6('0x17'),_0x33b961,_0x6ec6('0x18'));logger[_0x6ec6('0x19')](_0x6ec6('0x1a'),_0x33b961,_0x6ec6('0x18'),JSON[_0x6ec6('0x1b')](_0x3edb6c));if(_0x3edb6c['error']){if(_0x3edb6c[_0x6ec6('0x1c')][_0x6ec6('0x1d')]===0x1f4){logger['error'](_0x6ec6('0x17'),_0x33b961,_0x3edb6c['error'][_0x6ec6('0x1e')]);return _0x4e5f95(_0x3edb6c['error'][_0x6ec6('0x1e')]);}logger[_0x6ec6('0x1c')](_0x6ec6('0x17'),_0x33b961,_0x3edb6c[_0x6ec6('0x1c')][_0x6ec6('0x1e')]);return _0x138f96(_0x3edb6c[_0x6ec6('0x1c')]['message']);}else{logger[_0x6ec6('0x16')]('User,\x20%s,\x20%s',_0x33b961,_0x6ec6('0x18'));_0x138f96(_0x3edb6c[_0x6ec6('0x1f')]['message']);}})[_0x6ec6('0x20')](function(_0xed6c01){logger[_0x6ec6('0x1c')](_0x6ec6('0x17'),_0x33b961,_0xed6c01);_0x4e5f95(_0xed6c01);});});}function respondWithStatusCode(_0x442e1c,_0x17f14f){_0x17f14f=_0x17f14f||0xcc;return function(_0x555eca){if(_0x555eca){return _0x442e1c[_0x6ec6('0x21')](_0x17f14f);}return _0x442e1c[_0x6ec6('0x22')](_0x17f14f)[_0x6ec6('0x23')]();};}function respondWithResult(_0x51cdaf,_0x50071a){_0x50071a=_0x50071a||0xc8;return function(_0x233af7){if(_0x233af7){return _0x51cdaf[_0x6ec6('0x22')](_0x50071a)[_0x6ec6('0x24')](_0x233af7);}};}function respondWithFilteredResult(_0x19251f,_0x265a97){return function(_0xc75250){if(_0xc75250){var _0x2a1048=typeof _0x265a97[_0x6ec6('0x25')]===_0x6ec6('0x26')&&typeof _0x265a97[_0x6ec6('0x27')]==='undefined';var _0x4442af=_0xc75250['count'];var _0x4a0be2=_0x2a1048?0x0:_0x265a97[_0x6ec6('0x25')];var _0x466b6d=_0x2a1048?_0xc75250[_0x6ec6('0x28')]:_0x265a97[_0x6ec6('0x25')]+_0x265a97[_0x6ec6('0x27')];var _0x44385b;if(_0x466b6d>=_0x4442af){_0x466b6d=_0x4442af;_0x44385b=0xc8;}else{_0x44385b=0xce;}_0x19251f[_0x6ec6('0x22')](_0x44385b);return _0x19251f[_0x6ec6('0x29')](_0x6ec6('0x2a'),_0x4a0be2+'-'+_0x466b6d+'/'+_0x4442af)[_0x6ec6('0x24')](_0xc75250);}return null;};}function saveUpdates(_0x46f5ea){return function(_0x45bf80){if(_0x45bf80){return _0x45bf80[_0x6ec6('0x2b')](_0x46f5ea)[_0x6ec6('0x15')](function(_0x5f4576){if(_0x5f4576[_0x6ec6('0x2c')]==='agent'){socket[_0x6ec6('0x2d')](_0x6ec6('0x2e')+_0x5f4576['id'],_0x5f4576);}return _0x5f4576;});}return null;};}function removeEntity(_0x4e0d52){return function(_0x14e5e9){if(_0x14e5e9){return _0x14e5e9['destroy']()[_0x6ec6('0x15')](function(){var _0x4ebc01=_0x14e5e9[_0x6ec6('0x2f')]({'plain':!![]});if(_0x4ebc01[_0x6ec6('0x2c')]===_0x6ec6('0x30'))return;var _0xf31b41=[{'name':'Users','value':_0x6ec6('0x31'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x6ec6('0x32'),'value':_0x6ec6('0x33'),'ignore':![]}];var _0x1eb9c0=_(_0xf31b41)[_0x6ec6('0x34')]('ignore')[_0x6ec6('0x35')](_0x6ec6('0x36'))['value']();if(_[_0x6ec6('0x37')](_0x1eb9c0,_0x4ebc01[_0x6ec6('0x2c')])){return;}var _0x48c146=_[_0x6ec6('0x38')](_0xf31b41,['value',_0x4ebc01[_0x6ec6('0x2c')]])['name'];return db['UserProfileResource'][_0x6ec6('0x39')]({'where':{'type':_0x48c146,'resourceId':_0x4ebc01['id']}})['then'](function(){return _0x14e5e9;});})[_0x6ec6('0x15')](function(){_0x4e0d52['status'](0xcc)[_0x6ec6('0x23')]();});}};}function handleEntityNotFound(_0x19443c){return function(_0x4f3e5d){if(!_0x4f3e5d){_0x19443c['sendStatus'](0x194);}return _0x4f3e5d;};}function handleError(_0x23ffe9,_0x26e165){_0x26e165=_0x26e165||0x1f4;return function(_0x25d6d0){logger[_0x6ec6('0x1c')](_0x25d6d0[_0x6ec6('0x3a')]);if(_0x25d6d0[_0x6ec6('0x3b')]){delete _0x25d6d0[_0x6ec6('0x3b')];}_0x23ffe9[_0x6ec6('0x22')](_0x26e165)['send'](_0x25d6d0);};}exports[_0x6ec6('0x3c')]=function(_0x4b4f0c,_0x22b4c){var _0x3b0eff={},_0x29fd1c={'count':0x0,'rows':[]};var _0x53327d=_(db['User']['rawAttributes'])[_0x6ec6('0x35')](function(_0x2b387f){return{'name':_0x2b387f[_0x6ec6('0x3d')],'type':_0x2b387f[_0x6ec6('0x3e')][_0x6ec6('0x3f')]};})['filter'](function(_0x5ee672){return!_[_0x6ec6('0x37')](['password',_0x6ec6('0x40')],_0x5ee672['name']);})['value']();_0x3b0eff=qs[_0x6ec6('0x41')](_0x53327d,_0x4b4f0c);var _0x446b58={'where':_0x3b0eff['where']};return db[_0x6ec6('0x42')][_0x6ec6('0x28')](_0x446b58)[_0x6ec6('0x15')](function(_0x1479a7){_0x29fd1c[_0x6ec6('0x28')]=_0x1479a7;if(_0x4b4f0c['query'][_0x6ec6('0x43')]){_0x3b0eff[_0x6ec6('0x44')]=[{'all':!![]}];}if(_0x4b4f0c[_0x6ec6('0x45')]['userSetting']===_0x6ec6('0x46')){_0x3b0eff[_0x6ec6('0x44')]=[{'model':db[_0x6ec6('0x47')],'as':_0x6ec6('0x48')}];}if(!_[_0x6ec6('0x37')](_0x3b0eff[_0x6ec6('0x49')],'id')){_0x3b0eff[_0x6ec6('0x49')][_0x6ec6('0x4a')]('id');}return db[_0x6ec6('0x42')]['findAll'](_0x3b0eff);})[_0x6ec6('0x15')](function(_0x35f8a4){_0x29fd1c[_0x6ec6('0x4b')]=_0x35f8a4;if(_0x4b4f0c[_0x6ec6('0x45')][_0x6ec6('0x4c')]===_0x6ec6('0x46')){var _0x4d58bf=[];for(var _0x6fb6a0=0x0;_0x6fb6a0<_0x29fd1c[_0x6ec6('0x4b')][_0x6ec6('0x4d')];_0x6fb6a0++){_0x4d58bf[_0x6ec6('0x4a')](get_open_tabs('chat',_0x29fd1c[_0x6ec6('0x4b')][_0x6fb6a0][_0x6ec6('0x4e')]));_0x4d58bf['push'](get_open_tabs(_0x6ec6('0x4f'),_0x29fd1c['rows'][_0x6fb6a0][_0x6ec6('0x4e')]));_0x4d58bf[_0x6ec6('0x4a')](get_open_tabs(_0x6ec6('0x50'),_0x29fd1c['rows'][_0x6fb6a0][_0x6ec6('0x4e')]));_0x4d58bf[_0x6ec6('0x4a')](get_open_tabs(_0x6ec6('0x51'),_0x29fd1c[_0x6ec6('0x4b')][_0x6fb6a0][_0x6ec6('0x4e')]));_0x4d58bf[_0x6ec6('0x4a')](get_open_tabs(_0x6ec6('0x52'),_0x29fd1c[_0x6ec6('0x4b')][_0x6fb6a0][_0x6ec6('0x4e')]));_0x4d58bf['push'](get_open_tabs('whatsapp',_0x29fd1c[_0x6ec6('0x4b')][_0x6fb6a0][_0x6ec6('0x4e')]));}return Promise[_0x6ec6('0x53')](_0x4d58bf)['then'](function(){return _0x29fd1c;});}else{return _0x29fd1c;}})[_0x6ec6('0x15')](respondWithFilteredResult(_0x22b4c,_0x3b0eff))[_0x6ec6('0x20')](handleError(_0x22b4c,null));};exports[_0x6ec6('0x54')]=function(_0x163a07,_0x12e66){var _0x218183={'raw':![],'where':{'id':_0x163a07['params']['id']}},_0x891691={};_0x891691[_0x6ec6('0x55')]=_[_0x6ec6('0x56')](_['keys'](db[_0x6ec6('0x42')]['rawAttributes']),[_0x6ec6('0x57'),_0x6ec6('0x40')]);_0x891691['query']=_[_0x6ec6('0x58')](_0x163a07['query']);_0x891691[_0x6ec6('0x59')]=_['intersection'](_0x891691[_0x6ec6('0x55')],_0x891691['query']);_0x218183[_0x6ec6('0x49')]=_[_0x6ec6('0x5a')](_0x891691[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x163a07[_0x6ec6('0x45')]['fields']));_0x218183['attributes']=_0x218183['attributes'][_0x6ec6('0x4d')]?_0x218183[_0x6ec6('0x49')]:_0x891691[_0x6ec6('0x55')];if(_0x163a07['query'][_0x6ec6('0x43')]){_0x218183['include']=[{'all':!![]}];}if(_0x163a07[_0x6ec6('0x45')][_0x6ec6('0x48')]==='true'){_0x218183[_0x6ec6('0x44')]=[{'model':db[_0x6ec6('0x47')],'as':'userSetting'}];}_0x218183=_[_0x6ec6('0x5c')]({},_0x218183,_0x163a07[_0x6ec6('0x5d')]);if(!_['includes'](_0x218183[_0x6ec6('0x49')],'id')){_0x218183[_0x6ec6('0x49')][_0x6ec6('0x4a')]('id');}return db['User'][_0x6ec6('0x38')](_0x218183)[_0x6ec6('0x15')](handleEntityNotFound(_0x12e66,null))[_0x6ec6('0x15')](function(_0x3cb49f){var _0x5b9540=[];values=_0x3cb49f;if(_0x163a07[_0x6ec6('0x45')][_0x6ec6('0x4c')]==='true'){_0x5b9540[_0x6ec6('0x4a')](get_open_tabs('chat',_0x3cb49f[_0x6ec6('0x4e')]));_0x5b9540[_0x6ec6('0x4a')](get_open_tabs('sms',_0x3cb49f[_0x6ec6('0x4e')]));_0x5b9540[_0x6ec6('0x4a')](get_open_tabs(_0x6ec6('0x52'),_0x3cb49f[_0x6ec6('0x4e')]));_0x5b9540[_0x6ec6('0x4a')](get_open_tabs('whatsapp',_0x3cb49f['dataValues']));_0x5b9540['push'](get_open_tabs(_0x6ec6('0x50'),_0x3cb49f[_0x6ec6('0x4e')]));_0x5b9540[_0x6ec6('0x4a')](get_open_tabs(_0x6ec6('0x51'),_0x3cb49f[_0x6ec6('0x4e')]));return Promise[_0x6ec6('0x53')](_0x5b9540);}else{return values;}})['then'](function(){return values;})[_0x6ec6('0x15')](respondWithResult(_0x12e66,null))[_0x6ec6('0x20')](handleError(_0x12e66,null));};exports[_0x6ec6('0x2b')]=function(_0x366e2e,_0x4917e7){if(_0x366e2e['body']['id']){delete _0x366e2e[_0x6ec6('0x5e')]['id'];}delete _0x366e2e[_0x6ec6('0x5e')][_0x6ec6('0x2c')];return db['User'][_0x6ec6('0x38')]({'where':{'id':_0x366e2e[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x4917e7,null))[_0x6ec6('0x15')](saveUpdates(_0x366e2e[_0x6ec6('0x5e')],null))[_0x6ec6('0x15')](respondWithResult(_0x4917e7,null))['catch'](handleError(_0x4917e7,null));};exports[_0x6ec6('0x60')]=function(_0x5c2d6a,_0x3217aa){return db[_0x6ec6('0x42')][_0x6ec6('0x60')]()['then'](respondWithResult(_0x3217aa,null))['catch'](handleError(_0x3217aa,null));};exports[_0x6ec6('0x61')]=function(_0x4ca8a0,_0x6e7014){return db['User'][_0x6ec6('0x38')]({'where':{'id':_0x4ca8a0['params']['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x6e7014,null))[_0x6ec6('0x15')](function(_0x5c0174){if(_0x5c0174){return _0x5c0174[_0x6ec6('0x61')](_0x4ca8a0[_0x6ec6('0x5e')]['ids'],_[_0x6ec6('0x62')](_0x4ca8a0[_0x6ec6('0x5e')],['ids','id'])||{});}})['then'](respondWithResult(_0x6e7014,null))[_0x6ec6('0x20')](handleError(_0x6e7014,null));};function validateUser(_0x74ec14){return new Promise(function(_0x3a6df7,_0x1bdac6){if(_0x74ec14[_0x6ec6('0x63')])return _0x3a6df7(_0x74ec14);return db['Setting'][_0x6ec6('0x64')](0x1)[_0x6ec6('0x15')](function(_0x53eaa1){if(_0x53eaa1['securePassword'])authService['validatePasswordPattern'](_0x74ec14[_0x6ec6('0x57')]);db[_0x6ec6('0x42')][_0x6ec6('0x65')](_0x6ec6('0x63'))['then'](function(_0x2f1d82){if(_[_0x6ec6('0x66')](_0x2f1d82)){_0x74ec14['internal']=_0x53eaa1[_0x6ec6('0x67')]||0x1;return;}if(_[_0x6ec6('0x66')](_0x53eaa1[_0x6ec6('0x67')])||_0x53eaa1['min_internal']===_0x2f1d82){_0x74ec14[_0x6ec6('0x63')]=_0x2f1d82+0x1;return;}if(_0x53eaa1['min_internal']>_0x2f1d82){_0x74ec14[_0x6ec6('0x63')]=_0x53eaa1[_0x6ec6('0x67')];return;}return db['sequelize']['query'](_0x6ec6('0x68'),{'type':db[_0x6ec6('0x69')][_0x6ec6('0x6a')][_0x6ec6('0x6b')]})[_0x6ec6('0x15')](function(_0x1f3849){if(_0x1f3849&&_0x1f3849[_0x6ec6('0x4d')]){for(var _0x5ab263=0x0,_0x2cae53=_0x1f3849[_0x6ec6('0x4d')];_0x5ab263<_0x2cae53&&_['isNil'](_0x74ec14[_0x6ec6('0x63')]);_0x5ab263++){if(_0x53eaa1[_0x6ec6('0x67')]<=_0x1f3849[_0x5ab263][_0x6ec6('0x6c')]){_0x74ec14['internal']=_0x1f3849[_0x5ab263][_0x6ec6('0x6c')];}else if(_0x53eaa1[_0x6ec6('0x67')]>_0x1f3849[_0x5ab263][_0x6ec6('0x6c')]&&_0x53eaa1['min_internal']<=_0x1f3849[_0x5ab263]['to']){_0x74ec14['internal']=_0x53eaa1[_0x6ec6('0x67')];}}}if(_[_0x6ec6('0x66')](_0x74ec14[_0x6ec6('0x63')])){_0x74ec14[_0x6ec6('0x63')]=_0x2f1d82+0x1;}return _0x3a6df7(_0x74ec14);});});})[_0x6ec6('0x20')](function(_0x4e75e5){_0x1bdac6(_0x4e75e5);});});}function updateUser(_0x4ebed7){return new Promise(function(_0x4baacf,_0x2b215f){try{if(_0x4ebed7['voicemail']){_0x4ebed7[_0x6ec6('0x6d')]=_0x4ebed7[_0x6ec6('0x63')];_0x4ebed7[_0x6ec6('0x6e')]={'mailbox':_0x4ebed7[_0x6ec6('0x63')],'password':_0x4ebed7[_0x6ec6('0x57')],'fullname':_0x4ebed7[_0x6ec6('0x6f')],'email':_0x4ebed7['email']};}if(_0x4ebed7['role']===_0x6ec6('0x70')){if(!_0x4ebed7['permissions'])_0x4ebed7['permissions']=[_0x6ec6('0x71'),'102',_0x6ec6('0x72'),'113','110',_0x6ec6('0x73'),_0x6ec6('0x74'),_0x6ec6('0x75'),_0x6ec6('0x76'),_0x6ec6('0x77'),_0x6ec6('0x78'),_0x6ec6('0x79'),_0x6ec6('0x7a'),_0x6ec6('0x7b'),_0x6ec6('0x7c')];}_0x4baacf(_0x4ebed7);}catch(_0x32084b){_0x2b215f(_0x32084b);}});}exports[_0x6ec6('0x7d')]=function(_0x3b36a4,_0x581872){if(_0x3b36a4['user']['role']==='agent')throw new Error('Unauthorized');if(_0x3b36a4[_0x6ec6('0x5e')][_0x6ec6('0x2c')]===_0x6ec6('0x31')&&_0x3b36a4[_0x6ec6('0x31')]['role']!==_0x6ec6('0x30')){throw new Error(_0x6ec6('0x7e'));}if(_0x3b36a4[_0x6ec6('0x5e')][_0x6ec6('0x2c')]===_0x6ec6('0x30')&&_0x3b36a4[_0x6ec6('0x31')]['role']!==_0x6ec6('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x6ec6('0x7f')]([_0x3b36a4['body']])[_0x6ec6('0x15')](function(){return validateUser(_0x3b36a4[_0x6ec6('0x5e')]);})['then'](function(_0x37fa84){return updateUser(_0x37fa84)[_0x6ec6('0x15')](function(_0x38e67c){if(_0x38e67c[_0x6ec6('0x2c')]===_0x6ec6('0x30')){_0x38e67c[_0x6ec6('0x80')]=_0x3b36a4[_0x6ec6('0x31')][_0x6ec6('0x80')];delete _0x38e67c[_0x6ec6('0x81')];}return _0x38e67c;});})[_0x6ec6('0x15')](function(_0x4c4b4c){return db[_0x6ec6('0x42')]['create'](_0x4c4b4c,{'include':[{'model':db[_0x6ec6('0x6e')],'as':_0x6ec6('0x6e')}]});})[_0x6ec6('0x15')](function(_0x1d3eb9){if(_0x3b36a4[_0x6ec6('0x5e')][_0x6ec6('0x2c')]==='user')return _0x1d3eb9;if(_0x3b36a4[_0x6ec6('0x31')][_0x6ec6('0x2c')]!=='user')return _0x1d3eb9;return db[_0x6ec6('0x82')][_0x6ec6('0x38')]({'where':{'name':_0x1d3eb9[_0x6ec6('0x2c')]===_0x6ec6('0x70')?'Agents':_0x6ec6('0x32'),'userProfileId':_0x3b36a4['user'][_0x6ec6('0x81')]},'raw':!![]})[_0x6ec6('0x15')](function(_0x85f912){if(!_0x85f912||_0x85f912['autoAssociation']!=0x0)return _0x1d3eb9;return db['UserProfileResource'][_0x6ec6('0x7d')]({'name':_0x1d3eb9['name'],'resourceId':_0x1d3eb9['id'],'type':_0x85f912[_0x6ec6('0x3b')],'sectionId':_0x85f912['id']},{})[_0x6ec6('0x15')](function(){return _0x1d3eb9;});})[_0x6ec6('0x20')](function(_0x41f8b4){logger[_0x6ec6('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41f8b4);throw _0x41f8b4;});})[_0x6ec6('0x15')](respondWithResult(_0x581872,0xc9))[_0x6ec6('0x20')](handleError(_0x581872,null));};exports['bulkCreate']=function(_0x2642c5,_0x4cba83){var _0x39294c=_0x2642c5['body'];var _0x32da8f=[];if(_0x2642c5[_0x6ec6('0x31')][_0x6ec6('0x2c')]===_0x6ec6('0x70'))throw new Error('Unauthorized');if(_[_0x6ec6('0x83')](_0x39294c,[_0x6ec6('0x2c'),'user'])&&_0x2642c5[_0x6ec6('0x31')][_0x6ec6('0x2c')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x6ec6('0x83')](_0x39294c,[_0x6ec6('0x2c'),'admin'])&&_0x2642c5['user'][_0x6ec6('0x2c')]!==_0x6ec6('0x30')){throw new Error(_0x6ec6('0x84'));}return licenseUtil[_0x6ec6('0x7f')](_0x39294c)[_0x6ec6('0x15')](function(){return validateUser(_0x39294c[0x0]);})[_0x6ec6('0x15')](function(){for(var _0x398e41=0x1;_0x398e41<_0x39294c[_0x6ec6('0x4d')];_0x398e41++){var _0x116845=_0x39294c[_0x398e41-0x1][_0x6ec6('0x63')];if(!_0x39294c[_0x398e41][_0x6ec6('0x63')])_0x39294c[_0x398e41]['internal']=_0x116845+0x1;_0x32da8f[_0x6ec6('0x4a')](validateUser(_0x39294c[_0x398e41]));}return Promise[_0x6ec6('0x53')](_0x32da8f);})[_0x6ec6('0x15')](function(){_0x32da8f=[];for(var _0x290f58=0x0;_0x290f58<_0x39294c[_0x6ec6('0x4d')];_0x290f58++){_0x32da8f[_0x6ec6('0x4a')](updateUser(_0x39294c[_0x290f58]));}return Promise['all'](_0x32da8f);})[_0x6ec6('0x15')](function(){_0x32da8f=_0x39294c[_0x6ec6('0x35')](function(_0x12b362){return db[_0x6ec6('0x42')][_0x6ec6('0x7d')](_0x12b362,{'include':[{'model':db['VoiceMail'],'as':_0x6ec6('0x6e')}]})[_0x6ec6('0x15')](function(_0x2f45fc){_0x12b362['id']=_0x2f45fc['id'];return _0x12b362;});});return Promise['all'](_0x32da8f);})[_0x6ec6('0x15')](function(_0x1e370b){if(_0x2642c5['body']['role']==='user')return _0x1e370b;if(_0x2642c5['user'][_0x6ec6('0x2c')]!==_0x6ec6('0x31'))return _0x1e370b;var _0x167059=_[_0x6ec6('0x83')](_0x1e370b,function(_0x335157){return _0x335157[_0x6ec6('0x2c')]===_0x6ec6('0x70')||_0x335157['role']===_0x6ec6('0x33');});if(!_0x167059)return _0x1e370b;return db[_0x6ec6('0x82')]['findAll']({'where':{'name':{'$or':[_0x6ec6('0x85'),'Telephones']},'userProfileId':_0x2642c5[_0x6ec6('0x31')]['userProfileId']},'raw':!![]})['then'](function(_0x5e59dd){if(_[_0x6ec6('0x86')](_0x5e59dd)||!_[_0x6ec6('0x83')](_0x5e59dd,[_0x6ec6('0x87'),0x0]))return _0x1e370b;_0x32da8f=[];var _0x5363ab=_(_0x5e59dd)[_0x6ec6('0x35')](function(_0x2c4faf){if(_0x2c4faf[_0x6ec6('0x87')]===0x1)return;return _0x2c4faf[_0x6ec6('0x3b')]===_0x6ec6('0x85')?_0x6ec6('0x70'):_0x6ec6('0x33');})[_0x6ec6('0x88')]()['value']();for(var _0x31068d=0x0;_0x31068d<_0x1e370b[_0x6ec6('0x4d')];_0x31068d++){if(!_[_0x6ec6('0x37')](_0x5363ab,_0x1e370b[_0x31068d][_0x6ec6('0x2c')]))return;var _0x50e2f5=_0x1e370b[_0x31068d][_0x6ec6('0x2c')]==='agent'?_0x6ec6('0x85'):_0x6ec6('0x32');_0x32da8f[_0x6ec6('0x4a')](db[_0x6ec6('0x89')][_0x6ec6('0x7d')]({'name':_0x1e370b[_0x31068d][_0x6ec6('0x3b')],'resourceId':_0x1e370b[_0x31068d]['id'],'type':_0x50e2f5,'sectionId':_[_0x6ec6('0x38')](_0x5e59dd,[_0x6ec6('0x3b'),_0x50e2f5])['id']},{}));}return Promise[_0x6ec6('0x53')](_0x32da8f);});})[_0x6ec6('0x15')](respondWithResult(_0x4cba83,0xc9))[_0x6ec6('0x20')](handleError(_0x4cba83,null));};exports[_0x6ec6('0x8a')]=function(_0x4ef3b5,_0x49a1d3){if(_0x4ef3b5[_0x6ec6('0x5e')]['id']){delete _0x4ef3b5[_0x6ec6('0x5e')]['id'];}return db['User'][_0x6ec6('0x38')]({'where':{'id':_0x4ef3b5[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](function(_0x32848e){if(!_0x32848e)return null;if(_0x32848e['id']===_0x4ef3b5['user']['id']){if(!_0x4ef3b5[_0x6ec6('0x5e')][_0x6ec6('0x8b')]||!_0x4ef3b5[_0x6ec6('0x5e')][_0x6ec6('0x8c')]){throw new db[(_0x6ec6('0x8d'))][(_0x6ec6('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x32848e[_0x6ec6('0x8f')](_0x4ef3b5[_0x6ec6('0x5e')][_0x6ec6('0x8b')])){throw new db[(_0x6ec6('0x8d'))][(_0x6ec6('0x8e'))](_0x6ec6('0x90'));}if(_0x4ef3b5['body'][_0x6ec6('0x8b')]===_0x4ef3b5['body'][_0x6ec6('0x8c')]){throw new db[(_0x6ec6('0x8d'))][(_0x6ec6('0x8e'))](_0x6ec6('0x91'));}}else if(_0x4ef3b5[_0x6ec6('0x31')][_0x6ec6('0x2c')]==='admin'){if(!_0x4ef3b5[_0x6ec6('0x5e')][_0x6ec6('0x8c')]){throw new db[(_0x6ec6('0x8d'))][(_0x6ec6('0x8e'))](_0x6ec6('0x92'));}}else if(_0x4ef3b5['user']['role']===_0x6ec6('0x31')){if(!_0x4ef3b5[_0x6ec6('0x5e')]['newPassword']){throw new db[(_0x6ec6('0x8d'))][(_0x6ec6('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x32848e[_0x6ec6('0x2c')]!==_0x6ec6('0x70')){throw new db['Sequelize'][(_0x6ec6('0x8e'))](_0x6ec6('0x93'));}}else{throw new db['Sequelize'][(_0x6ec6('0x8e'))]('Unauthorized');}return _0x32848e;})[_0x6ec6('0x15')](handleEntityNotFound(_0x49a1d3,null))[_0x6ec6('0x15')](function(_0x369efb){return db['Setting'][_0x6ec6('0x94')]({'attributes':['id',_0x6ec6('0x95'),_0x6ec6('0x96'),'passwordHistoryLimit']})[_0x6ec6('0x15')](function(_0x4d248f){if(_0x4d248f[_0x6ec6('0x95')])authService[_0x6ec6('0x97')](_0x4ef3b5[_0x6ec6('0x5e')][_0x6ec6('0x8c')]);if(!_0x4d248f[_0x6ec6('0x96')]||!_0x369efb['previousPasswords'])return _0x369efb;authService[_0x6ec6('0x98')](_0x4ef3b5['body'][_0x6ec6('0x8c')],_0x369efb[_0x6ec6('0x99')],_0x4d248f[_0x6ec6('0x9a')]);return _0x369efb;})[_0x6ec6('0x15')](saveUpdates({'password':_0x4ef3b5['body'][_0x6ec6('0x8c')],'passwordResetAt':_0x4ef3b5[_0x6ec6('0x31')]['id']==_0x4ef3b5[_0x6ec6('0x5f')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4ef3b5['body'][_0x6ec6('0x8c')],_0x369efb[_0x6ec6('0x99')])},null));})[_0x6ec6('0x15')](respondWithResult(_0x49a1d3,null))[_0x6ec6('0x20')](handleError(_0x49a1d3,null));};exports['addQueues']=function(_0x57752f,_0x586b2c){var _0x45fc58=_0x57752f[_0x6ec6('0x5e')][_0x6ec6('0x9b')];return db['User'][_0x6ec6('0x38')]({'where':{'id':_0x57752f['params']['id']},'attributes':['id',_0x6ec6('0x3b'),_0x6ec6('0x2c'),_0x6ec6('0x9c'),_0x6ec6('0x9d'),_0x6ec6('0x9e'),_0x6ec6('0x9f')]})['then'](handleEntityNotFound(_0x586b2c,null))[_0x6ec6('0x15')](function(_0x5d8948){if(_0x5d8948){if(!utils[_0x6ec6('0xa0')](_0x45fc58)){throw new db[(_0x6ec6('0x8d'))][(_0x6ec6('0x8e'))](_0x6ec6('0xa1'));}return _0x5d8948[_0x6ec6('0xa2')+_[_0x6ec6('0xa3')](_0x45fc58['toLowerCase']())+'Queues'](_0x57752f[_0x6ec6('0x5e')][_0x6ec6('0xa4')],{'penalty':_0x57752f[_0x6ec6('0x5e')][_0x6ec6('0xa5')]||0x0})['spread'](function(_0x594d64){for(var _0x2421a2=0x0;_0x2421a2<_0x57752f[_0x6ec6('0x5e')][_0x6ec6('0xa4')][_0x6ec6('0x4d')];_0x2421a2+=0x1){var _0x4c97fc={'UserId':Number(_0x57752f[_0x6ec6('0x5f')]['id'])};_0x4c97fc[_['capitalize'](_0x45fc58[_0x6ec6('0xa6')]())+_0x6ec6('0xa7')]=Number(_0x57752f['body'][_0x6ec6('0xa4')][_0x2421a2]);socket[_0x6ec6('0x2d')]('user'+_['capitalize'](_0x45fc58[_0x6ec6('0xa6')]())+_0x6ec6('0xa8'),_0x4c97fc);}return _0x594d64;})[_0x6ec6('0x15')](function(){if(_0x45fc58===_0x6ec6('0xa9')){return db[_0x6ec6('0xaa')]['findAll']({'where':{'id':_0x57752f[_0x6ec6('0x5e')][_0x6ec6('0xa4')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x6ec6('0x15')](function(_0x571bd6){var _0xc088b9=_0x5d8948['get']({'plain':!![]});var _0x149339=[];if(_0x45fc58===_0x6ec6('0xa9')&&_0xc088b9[_0x6ec6('0x2c')]===_0x6ec6('0x70')&&_0xc088b9[_0x6ec6('0x9c')]){for(let _0xfe0cd2=0x0;_0xfe0cd2<_0x571bd6[_0x6ec6('0x4d')];_0xfe0cd2+=0x1){_0x149339[_0x6ec6('0x4a')]({'membername':_0xc088b9[_0x6ec6('0x3b')],'UserId':_0xc088b9['id'],'queue_name':_0x571bd6[_0xfe0cd2][_0x6ec6('0x3b')],'VoiceQueueId':_0x571bd6[_0xfe0cd2]['id'],'interface':_[_0x6ec6('0x66')](_0xc088b9['interface'])?util[_0x6ec6('0xab')]('SIP/%s',_0xc088b9[_0x6ec6('0x3b')]):_0xc088b9[_0x6ec6('0x9f')],'paused':_0xc088b9[_0x6ec6('0x9e')]||![],'penalty':_0x57752f[_0x6ec6('0x5e')]['penalty']||0x0});}return Promise['all'](_0x149339[_0x6ec6('0x35')](function(_0x371cd8){return db[_0x6ec6('0xac')]['upsert'](_0x371cd8);}));}return _0x5d8948;});}})[_0x6ec6('0x15')](respondWithStatusCode(_0x586b2c,null))['catch'](handleError(_0x586b2c,null));};exports[_0x6ec6('0xad')]=function(_0x337721,_0x1fa306){var _0x3c6ddc,_0x2801dc;return db[_0x6ec6('0x42')]['find']({'where':{'id':_0x337721['params']['id']},'attributes':['id',_0x6ec6('0x3b'),_0x6ec6('0x2c')]})[_0x6ec6('0x15')](handleEntityNotFound(_0x1fa306,null))[_0x6ec6('0x15')](function(_0x4cc7c8){if(_0x4cc7c8){_0x3c6ddc=_0x4cc7c8;if(!_0x337721[_0x6ec6('0x45')][_0x6ec6('0x9b')]||!utils[_0x6ec6('0xa0')](_0x337721[_0x6ec6('0x45')]['channel'])){throw new db[(_0x6ec6('0x8d'))][(_0x6ec6('0x8e'))]('Unknown\x20channel');}return _0x4cc7c8[_0x6ec6('0xae')+_[_0x6ec6('0xa3')](_0x337721[_0x6ec6('0x45')][_0x6ec6('0x9b')]['toLowerCase']())+_0x6ec6('0xaf')](_0x337721['query'][_0x6ec6('0xa4')]);}})[_0x6ec6('0x15')](function(_0x13e451){if(_[_0x6ec6('0xb0')](_0x337721[_0x6ec6('0x45')][_0x6ec6('0xa4')])){for(var _0x3392c7=0x0;_0x3392c7<_0x337721[_0x6ec6('0x45')][_0x6ec6('0xa4')][_0x6ec6('0x4d')];_0x3392c7+=0x1){_0x2801dc={'UserId':Number(_0x337721[_0x6ec6('0x5f')]['id'])};_0x2801dc[_[_0x6ec6('0xa3')](_0x337721['query'][_0x6ec6('0x9b')]['toLowerCase']())+_0x6ec6('0xa7')]=Number(_0x337721[_0x6ec6('0x45')]['ids'][_0x3392c7]);socket[_0x6ec6('0x2d')](_0x6ec6('0x31')+_['capitalize'](_0x337721[_0x6ec6('0x45')][_0x6ec6('0x9b')]['toLowerCase']())+_0x6ec6('0xb1'),_0x2801dc);}}else{_0x2801dc={'UserId':Number(_0x337721[_0x6ec6('0x5f')]['id'])};_0x2801dc[_['capitalize'](_0x337721['query'][_0x6ec6('0x9b')][_0x6ec6('0xa6')]())+_0x6ec6('0xa7')]=Number(_0x337721['query']['ids']);socket[_0x6ec6('0x2d')]('user'+_[_0x6ec6('0xa3')](_0x337721['query']['channel'][_0x6ec6('0xa6')]())+'Queue:remove',_0x2801dc);}return _0x13e451;})['then'](function(){if(_0x337721[_0x6ec6('0x45')][_0x6ec6('0x9b')]===_0x6ec6('0xa9')){return db[_0x6ec6('0xac')][_0x6ec6('0x39')]({'where':{'UserId':_0x337721['params']['id'],'VoiceQueueId':_0x337721[_0x6ec6('0x45')][_0x6ec6('0xa4')]},'individualHooks':!![]})[_0x6ec6('0x15')](function(){return _0x3c6ddc;});}return _0x3c6ddc;})[_0x6ec6('0x15')](respondWithStatusCode(_0x1fa306,null))[_0x6ec6('0x20')](handleError(_0x1fa306,null));};exports[_0x6ec6('0xb2')]=function(_0x5a7d03,_0x21424a){_0x5a7d03[_0x6ec6('0x5e')][_0x6ec6('0xb3')]=_0x5a7d03[_0x6ec6('0xb4')][_0x6ec6('0xb5')];return db[_0x6ec6('0x42')][_0x6ec6('0x38')]({'where':{'id':_0x5a7d03[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x21424a,null))[_0x6ec6('0x15')](saveUpdates(_0x5a7d03[_0x6ec6('0x5e')],null))[_0x6ec6('0x15')](respondWithResult(_0x21424a,null))[_0x6ec6('0x20')](handleError(_0x21424a,null));};exports[_0x6ec6('0xb6')]=function(_0x113872,_0x25ce1f){var _0x5ab730=path[_0x6ec6('0xb7')](config[_0x6ec6('0xb8')],_0x6ec6('0xb9'));return db[_0x6ec6('0x42')][_0x6ec6('0x38')]({'where':{'id':_0x113872[_0x6ec6('0x5f')]['id']},'attributes':['id',_0x6ec6('0xb3')],'raw':!![]})['then'](handleEntityNotFound(_0x25ce1f,null))[_0x6ec6('0x15')](function(_0x3a0a34){if(_0x3a0a34){if(_[_0x6ec6('0x66')](_0x3a0a34[_0x6ec6('0xb3')])){return _0x25ce1f['download'](_0x5ab730);}else{if(!fs[_0x6ec6('0xba')](path['join'](config[_0x6ec6('0xb8')],_0x6ec6('0xbb'),_0x3a0a34[_0x6ec6('0xb3')]))){return _0x25ce1f[_0x6ec6('0xbc')](_0x5ab730);}return _0x25ce1f['download'](path[_0x6ec6('0xb7')](config[_0x6ec6('0xb8')],'server/files/images/',_0x3a0a34[_0x6ec6('0xb3')]));}}})[_0x6ec6('0x20')](handleError(_0x25ce1f,null));};exports['getOpenTabs']=function(_0xdfcce1,_0x438015){return db[_0x6ec6('0x42')][_0x6ec6('0x38')]({'where':{'id':_0xdfcce1['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x438015,null))[_0x6ec6('0x15')](function(_0x5d2573){var _0x730486=[];values=_0x5d2573[_0x6ec6('0x4e')];_0x730486['push'](get_open_tabs('chat',_0x5d2573['dataValues']));_0x730486[_0x6ec6('0x4a')](get_open_tabs(_0x6ec6('0x4f'),_0x5d2573[_0x6ec6('0x4e')]));_0x730486[_0x6ec6('0x4a')](get_open_tabs(_0x6ec6('0x52'),_0x5d2573[_0x6ec6('0x4e')]));_0x730486[_0x6ec6('0x4a')](get_open_tabs('whatsapp',_0x5d2573['dataValues']));_0x730486[_0x6ec6('0x4a')](get_open_tabs(_0x6ec6('0x50'),_0x5d2573['dataValues']));_0x730486[_0x6ec6('0x4a')](get_open_tabs(_0x6ec6('0x51'),_0x5d2573['dataValues']));return Promise['all'](_0x730486);})[_0x6ec6('0x15')](function(_0x45c3e8){if(_0x45c3e8){var _0x1789d6=_[_0x6ec6('0x35')](values[_0x6ec6('0xbd')],function(_0x2017d6){return{'channel':_0x6ec6('0xbe'),'id':_0x2017d6['id'],'createdAt':_0x2017d6[_0x6ec6('0xbf')]};});var _0x3397b9=_['map'](values[_0x6ec6('0xc0')],function(_0x49457e){return{'channel':_0x6ec6('0xc1'),'id':_0x49457e['id'],'createdAt':_0x49457e['createdAt']};});var _0x534a82=_[_0x6ec6('0x35')](values[_0x6ec6('0xc2')],function(_0x56badf){return{'channel':_0x6ec6('0xc3'),'id':_0x56badf['id'],'createdAt':_0x56badf['createdAt']};});var _0x332bf3=_[_0x6ec6('0x35')](values['MailOpenTabs'],function(_0x41c1e2){return{'channel':_0x6ec6('0xc4'),'id':_0x41c1e2['id'],'createdAt':_0x41c1e2[_0x6ec6('0xbf')]};});var _0xa66f4b=_[_0x6ec6('0x35')](values[_0x6ec6('0xc5')],function(_0x523071){return{'channel':'SMS','id':_0x523071['id'],'createdAt':_0x523071[_0x6ec6('0xbf')]};});var _0x58771a=_['map'](values['WhatsappOpenTabs'],function(_0xc517d8){return{'channel':'WHATSAPP','id':_0xc517d8['id'],'createdAt':_0xc517d8[_0x6ec6('0xbf')]};});var _0x2fdbc5=_[_0x6ec6('0xc6')](_0x1789d6,_0x3397b9,_0x534a82,_0x332bf3,_0xa66f4b,_0x58771a);var _0xd5e835={'count':_0x2fdbc5['length'],'rows':_0x2fdbc5};return _0xd5e835;}else return null;})[_0x6ec6('0x15')](respondWithResult(_0x438015,null))['catch'](handleError(_0x438015,null));};exports[_0x6ec6('0xc7')]=function(_0x1be352,_0x3cbe13){var _0x5ad36b={};return db[_0x6ec6('0x42')][_0x6ec6('0x94')]({'where':{'id':_0x1be352[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](function(_0x1aac27){if(!_0x1aac27){throw new APINotFoundError(util[_0x6ec6('0xab')](_0x6ec6('0xc8'),_0x1be352[_0x6ec6('0x5f')]['id']));}return contacts['describe']();})[_0x6ec6('0x15')](function(_0x101ccc){_0x1be352[_0x6ec6('0x45')]['User']=_0x1be352[_0x6ec6('0x5f')]['id'];_0x5ad36b=qs[_0x6ec6('0x41')](_0x101ccc,_0x1be352);if(_0x1be352['query']['hasOwnProperty']('includeAll')){_0x5ad36b[_0x6ec6('0x44')]=[{'model':db[_0x6ec6('0xc9')],'as':_0x6ec6('0xca'),'required':![]},{'model':db[_0x6ec6('0xcb')],'as':_0x6ec6('0xcc'),'attributes':['id',_0x6ec6('0x3b'),_0x6ec6('0xcd')],'where':_0x1be352[_0x6ec6('0x45')][_0x6ec6('0xce')]?{'id':_0x1be352[_0x6ec6('0x45')]['tag']}:undefined,'required':_0x1be352[_0x6ec6('0x45')][_0x6ec6('0xce')]?!![]:![]}];}return contacts[_0x6ec6('0xcf')](_0x1be352[_0x6ec6('0x45')],_0x1be352[_0x6ec6('0x31')],_0x5ad36b,_0x101ccc);})[_0x6ec6('0x15')](respondWithFilteredResult(_0x3cbe13,_0x5ad36b))[_0x6ec6('0x20')](APIHandleError(_0x3cbe13));};exports[_0x6ec6('0xd0')]=function(_0x3db4b2,_0x3bf843){var _0x2775bd;var _0x12b97c={};var _0x1fe23a;return db['User'][_0x6ec6('0x94')]({'where':{'id':_0x3db4b2[_0x6ec6('0x5f')]['id']},'attributes':['id',_0x6ec6('0x3b'),_0x6ec6('0x2c')]})[_0x6ec6('0x15')](handleEntityNotFound(_0x3bf843,null))['then'](function(_0x648ca4){if(!utils[_0x6ec6('0xa0')](_0x3db4b2['query'][_0x6ec6('0x9b')])){throw new db[(_0x6ec6('0x8d'))][(_0x6ec6('0x8e'))](_0x6ec6('0xa1'));}_0x2775bd=_0x648ca4;var _0x46c94e={};_0x46c94e['model']=_[_0x6ec6('0x58')](db[_[_0x6ec6('0xa3')](_0x3db4b2[_0x6ec6('0x45')][_0x6ec6('0x9b')])+_0x6ec6('0xd1')][_0x6ec6('0xd2')]);_0x46c94e['query']=_[_0x6ec6('0x58')](_0x3db4b2[_0x6ec6('0x45')]);_0x46c94e['filters']=_[_0x6ec6('0x5a')](_0x46c94e[_0x6ec6('0x55')],_0x46c94e[_0x6ec6('0x45')]);_0x12b97c[_0x6ec6('0x49')]=_[_0x6ec6('0x5a')](_0x46c94e[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x3db4b2[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x12b97c[_0x6ec6('0x49')]=_0x12b97c[_0x6ec6('0x49')][_0x6ec6('0x4d')]?_0x12b97c[_0x6ec6('0x49')]:_0x46c94e[_0x6ec6('0x55')];_0x12b97c[_0x6ec6('0xd3')]=qs[_0x6ec6('0xd4')](_0x3db4b2[_0x6ec6('0x45')][_0x6ec6('0xd4')]);_0x12b97c[_0x6ec6('0xd5')]=qs[_0x6ec6('0x59')](_[_0x6ec6('0xd6')](_0x3db4b2[_0x6ec6('0x45')],_0x46c94e[_0x6ec6('0x59')]));if(_0x3db4b2[_0x6ec6('0x45')]['filter']){_0x12b97c[_0x6ec6('0xd5')]=_['merge'](_0x12b97c['where'],{'$or':_[_0x6ec6('0x35')](_0x12b97c[_0x6ec6('0x49')],function(_0x285811){var _0xda32d={};_0xda32d[_0x285811]={'$like':'%'+_0x3db4b2[_0x6ec6('0x45')]['filter']+'%'};return _0xda32d;})});}_0x12b97c=_[_0x6ec6('0x5c')]({},_0x12b97c,_0x3db4b2[_0x6ec6('0x5d')]);switch(_0x2775bd[_0x6ec6('0x2c')]){case _0x6ec6('0x30'):return db[_[_0x6ec6('0xa3')](_0x3db4b2[_0x6ec6('0x45')]['channel'])+_0x6ec6('0xd1')][_0x6ec6('0xcf')](_0x12b97c);case _0x6ec6('0x31'):case'agent':return _0x2775bd['get'+_[_0x6ec6('0xa3')](_0x3db4b2[_0x6ec6('0x45')][_0x6ec6('0x9b')])+_0x6ec6('0xaf')](_0x12b97c);default:throw new db[(_0x6ec6('0x8d'))]['ValidationError'](_0x6ec6('0xd7'));}})[_0x6ec6('0x15')](function(_0x189e59){_0x1fe23a=_0x189e59[_0x6ec6('0x4d')];if(!_0x3db4b2['query'][_0x6ec6('0xd8')](_0x6ec6('0xd9'))){_0x12b97c[_0x6ec6('0x27')]=qs['limit'](_0x3db4b2[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x12b97c[_0x6ec6('0x25')]=qs[_0x6ec6('0x25')](_0x3db4b2['query'][_0x6ec6('0x25')]);}switch(_0x2775bd['role']){case _0x6ec6('0x30'):return db[_[_0x6ec6('0xa3')](_0x3db4b2[_0x6ec6('0x45')][_0x6ec6('0x9b')])+_0x6ec6('0xd1')][_0x6ec6('0xcf')](_0x12b97c);case _0x6ec6('0x31'):case'agent':return _0x2775bd['get'+_[_0x6ec6('0xa3')](_0x3db4b2[_0x6ec6('0x45')][_0x6ec6('0x9b')])+'Queues'](_0x12b97c);}})[_0x6ec6('0x15')](function(_0x282d98){return{'count':_0x1fe23a,'rows':_0x282d98};})[_0x6ec6('0x15')](respondWithResult(_0x3bf843,null))[_0x6ec6('0x20')](handleError(_0x3bf843,null));};exports[_0x6ec6('0xda')]=function(_0x253304,_0x5eb2a0){var _0x2459e0={};var _0x50d50a={};var _0x370334;var _0x149b83;return db[_0x6ec6('0x42')]['findOne']({'where':{'id':_0x253304[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x5eb2a0,null))[_0x6ec6('0x15')](function(_0x4ccffb){if(_0x4ccffb){_0x370334=_0x4ccffb;_0x50d50a[_0x6ec6('0x55')]=_['keys'](db['UserVoiceQueueRt'][_0x6ec6('0xd2')]);_0x50d50a[_0x6ec6('0x45')]=_[_0x6ec6('0x58')](_0x253304[_0x6ec6('0x45')]);_0x50d50a['filters']=_[_0x6ec6('0x5a')](_0x50d50a[_0x6ec6('0x55')],_0x50d50a['query']);_0x2459e0[_0x6ec6('0x49')]=_['intersection'](_0x50d50a[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x253304[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x2459e0[_0x6ec6('0x49')]=_0x2459e0[_0x6ec6('0x49')][_0x6ec6('0x4d')]?_0x2459e0[_0x6ec6('0x49')]:_0x50d50a[_0x6ec6('0x55')];_0x2459e0[_0x6ec6('0xd3')]=qs[_0x6ec6('0xd4')](_0x253304[_0x6ec6('0x45')][_0x6ec6('0xd4')]);_0x2459e0[_0x6ec6('0xd5')]=qs['filters'](_[_0x6ec6('0xd6')](_0x253304[_0x6ec6('0x45')],_0x50d50a[_0x6ec6('0x59')]));if(_0x253304[_0x6ec6('0x45')][_0x6ec6('0x34')]){_0x2459e0['where']=_[_0x6ec6('0x5c')](_0x2459e0[_0x6ec6('0xd5')],{'$or':_[_0x6ec6('0x35')](_0x2459e0['attributes'],function(_0x55d877){var _0xbf35a9={};_0xbf35a9[_0x55d877]={'$like':'%'+_0x253304['query'][_0x6ec6('0x34')]+'%'};return _0xbf35a9;})});}_0x2459e0=_['merge']({},_0x2459e0,_0x253304[_0x6ec6('0x5d')]);return _0x370334[_0x6ec6('0xda')](_0x2459e0);}})[_0x6ec6('0x15')](function(_0x4eb326){if(_0x4eb326){_0x149b83=_0x4eb326[_0x6ec6('0x4d')];if(!_0x253304[_0x6ec6('0x45')][_0x6ec6('0xd8')]('nolimit')){_0x2459e0[_0x6ec6('0x27')]=qs[_0x6ec6('0x27')](_0x253304[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x2459e0['offset']=qs[_0x6ec6('0x25')](_0x253304[_0x6ec6('0x45')][_0x6ec6('0x25')]);}return _0x370334[_0x6ec6('0xda')](_0x2459e0);}})[_0x6ec6('0x15')](function(_0xc1c81c){if(_0xc1c81c){return _0xc1c81c?{'count':_0x149b83,'rows':_0xc1c81c}:null;}})['then'](respondWithResult(_0x5eb2a0,null))[_0x6ec6('0x20')](handleError(_0x5eb2a0,null));};exports[_0x6ec6('0xdb')]=function(_0x1f5212,_0x5ee55a){var _0x5f44d8={};var _0x23e4bf={};var _0x188464;var _0x3f186f;return db[_0x6ec6('0x42')]['findOne']({'where':{'id':_0x1f5212[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x5ee55a,null))[_0x6ec6('0x15')](function(_0x2211aa){if(_0x2211aa){_0x188464=_0x2211aa;_0x23e4bf[_0x6ec6('0x55')]=_[_0x6ec6('0x58')](db[_0x6ec6('0xdc')][_0x6ec6('0xd2')]);_0x23e4bf[_0x6ec6('0x45')]=_['keys'](_0x1f5212[_0x6ec6('0x45')]);_0x23e4bf[_0x6ec6('0x59')]=_[_0x6ec6('0x5a')](_0x23e4bf['model'],_0x23e4bf[_0x6ec6('0x45')]);_0x5f44d8[_0x6ec6('0x49')]=_['intersection'](_0x23e4bf[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x1f5212[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x5f44d8[_0x6ec6('0x49')]=_0x5f44d8[_0x6ec6('0x49')][_0x6ec6('0x4d')]?_0x5f44d8[_0x6ec6('0x49')]:_0x23e4bf['model'];_0x5f44d8[_0x6ec6('0xd3')]=qs[_0x6ec6('0xd4')](_0x1f5212[_0x6ec6('0x45')][_0x6ec6('0xd4')]);_0x5f44d8['where']=qs[_0x6ec6('0x59')](_[_0x6ec6('0xd6')](_0x1f5212['query'],_0x23e4bf[_0x6ec6('0x59')]));if(_0x1f5212[_0x6ec6('0x45')]['filter']){_0x5f44d8[_0x6ec6('0xd5')]=_[_0x6ec6('0x5c')](_0x5f44d8[_0x6ec6('0xd5')],{'$or':_['map'](_0x5f44d8['attributes'],function(_0x37ddeb){var _0x9084c={};_0x9084c[_0x37ddeb]={'$like':'%'+_0x1f5212['query']['filter']+'%'};return _0x9084c;})});}_0x5f44d8=_[_0x6ec6('0x5c')]({},_0x5f44d8,_0x1f5212['options']);return _0x188464[_0x6ec6('0xdb')](_0x5f44d8);}})[_0x6ec6('0x15')](function(_0xfd0968){if(_0xfd0968){_0x3f186f=_0xfd0968['length'];if(!_0x1f5212[_0x6ec6('0x45')]['hasOwnProperty'](_0x6ec6('0xd9'))){_0x5f44d8['limit']=qs[_0x6ec6('0x27')](_0x1f5212[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x5f44d8[_0x6ec6('0x25')]=qs[_0x6ec6('0x25')](_0x1f5212['query'][_0x6ec6('0x25')]);}return _0x188464[_0x6ec6('0xdb')](_0x5f44d8);}})['then'](function(_0x4aead9){if(_0x4aead9){return _0x4aead9?{'count':_0x3f186f,'rows':_0x4aead9}:null;}})[_0x6ec6('0x15')](respondWithResult(_0x5ee55a,null))['catch'](handleError(_0x5ee55a,null));};exports[_0x6ec6('0xdd')]=function(_0x1c6d2c,_0x42f1ab){var _0x455b3c={'raw':!![],'where':{}};var _0x4cb75d={};var _0x26491={'count':0x0,'rows':[]};return db[_0x6ec6('0x42')][_0x6ec6('0x94')]({'where':{'id':_0x1c6d2c[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x42f1ab,null))[_0x6ec6('0x15')](function(_0x5458ac){if(_0x5458ac){_0x4cb75d['model']=_[_0x6ec6('0x58')](db['VoiceRecording'][_0x6ec6('0xd2')]);_0x4cb75d[_0x6ec6('0x45')]=_[_0x6ec6('0x58')](_0x1c6d2c['query']);_0x4cb75d[_0x6ec6('0x59')]=_['intersection'](_0x4cb75d[_0x6ec6('0x55')],_0x4cb75d['query']);_0x455b3c[_0x6ec6('0x49')]=_[_0x6ec6('0x5a')](_0x4cb75d['model'],qs['fields'](_0x1c6d2c[_0x6ec6('0x45')]['fields']));_0x455b3c[_0x6ec6('0x49')]=_0x455b3c[_0x6ec6('0x49')][_0x6ec6('0x4d')]?_0x455b3c['attributes']:_0x4cb75d[_0x6ec6('0x55')];if(!_0x1c6d2c[_0x6ec6('0x45')]['hasOwnProperty'](_0x6ec6('0xd9'))){_0x455b3c['limit']=qs[_0x6ec6('0x27')](_0x1c6d2c[_0x6ec6('0x45')]['limit']);_0x455b3c[_0x6ec6('0x25')]=qs[_0x6ec6('0x25')](_0x1c6d2c['query'][_0x6ec6('0x25')]);}_0x455b3c['order']=qs[_0x6ec6('0xd4')](_0x1c6d2c['query']['sort']);_0x455b3c[_0x6ec6('0xd5')]=qs[_0x6ec6('0x59')](_['pick'](_0x1c6d2c[_0x6ec6('0x45')],_0x4cb75d['filters']));_0x455b3c[_0x6ec6('0xd5')][_0x6ec6('0xde')]=_0x5458ac['id'];if(_0x1c6d2c['query'][_0x6ec6('0x34')]){_0x455b3c[_0x6ec6('0xd5')]=_[_0x6ec6('0x5c')](_0x455b3c[_0x6ec6('0xd5')],{'$or':_[_0x6ec6('0x35')](_0x455b3c[_0x6ec6('0x49')],function(_0x38c7f3){var _0x13e15f={};_0x13e15f[_0x38c7f3]={'$like':'%'+_0x1c6d2c['query'][_0x6ec6('0x34')]+'%'};return _0x13e15f;})});}_0x455b3c=_[_0x6ec6('0x5c')]({},_0x455b3c,_0x1c6d2c[_0x6ec6('0x5d')]);return db[_0x6ec6('0xdf')]['count']({'where':_0x455b3c[_0x6ec6('0xd5')]})[_0x6ec6('0x15')](function(_0x4aa9b6){_0x26491[_0x6ec6('0x28')]=_0x4aa9b6;if(_0x1c6d2c['query'][_0x6ec6('0x43')]){_0x455b3c['include']=[{'all':!![]}];}return db[_0x6ec6('0xdf')][_0x6ec6('0xcf')](_0x455b3c);})[_0x6ec6('0x15')](function(_0x510598){_0x26491[_0x6ec6('0x4b')]=_0x510598;return _0x26491;});}})[_0x6ec6('0x15')](respondWithFilteredResult(_0x42f1ab,_0x455b3c))[_0x6ec6('0x20')](handleError(_0x42f1ab,null));};exports[_0x6ec6('0xe0')]=function(_0x3b87b3,_0x20db5f){var _0x4b6a4c={'raw':!![],'where':{}};var _0x50cf3d={};var _0x5b4f55={'count':0x0,'rows':[]};return db[_0x6ec6('0x42')]['findOne']({'where':{'id':_0x3b87b3[_0x6ec6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x20db5f,null))['then'](function(_0x465745){if(_0x465745){_0x50cf3d[_0x6ec6('0x55')]=_['keys'](db[_0x6ec6('0xe1')][_0x6ec6('0xd2')]);_0x50cf3d[_0x6ec6('0x45')]=_[_0x6ec6('0x58')](_0x3b87b3[_0x6ec6('0x45')]);_0x50cf3d[_0x6ec6('0x59')]=_[_0x6ec6('0x5a')](_0x50cf3d[_0x6ec6('0x55')],_0x50cf3d[_0x6ec6('0x45')]);_0x4b6a4c[_0x6ec6('0x49')]=_['intersection'](_0x50cf3d['model'],qs['fields'](_0x3b87b3[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x4b6a4c['attributes']=_0x4b6a4c[_0x6ec6('0x49')][_0x6ec6('0x4d')]?_0x4b6a4c[_0x6ec6('0x49')]:_0x50cf3d[_0x6ec6('0x55')];if(!_0x3b87b3[_0x6ec6('0x45')]['hasOwnProperty'](_0x6ec6('0xd9'))){_0x4b6a4c['limit']=qs[_0x6ec6('0x27')](_0x3b87b3[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x4b6a4c[_0x6ec6('0x25')]=qs['offset'](_0x3b87b3[_0x6ec6('0x45')][_0x6ec6('0x25')]);}_0x4b6a4c['order']=qs['sort'](_0x3b87b3['query'][_0x6ec6('0xd4')]);_0x4b6a4c[_0x6ec6('0xd5')]=qs[_0x6ec6('0x59')](_[_0x6ec6('0xd6')](_0x3b87b3[_0x6ec6('0x45')],_0x50cf3d[_0x6ec6('0x59')]));_0x4b6a4c[_0x6ec6('0xd5')][_0x6ec6('0xde')]=_0x465745['id'];if(_0x3b87b3['query'][_0x6ec6('0x34')]){_0x4b6a4c[_0x6ec6('0xd5')]=_[_0x6ec6('0x5c')](_0x4b6a4c[_0x6ec6('0xd5')],{'$or':_[_0x6ec6('0x35')](_0x4b6a4c[_0x6ec6('0x49')],function(_0x4d6a56){var _0x459819={};_0x459819[_0x4d6a56]={'$like':'%'+_0x3b87b3['query'][_0x6ec6('0x34')]+'%'};return _0x459819;})});}_0x4b6a4c=_[_0x6ec6('0x5c')]({},_0x4b6a4c,_0x3b87b3[_0x6ec6('0x5d')]);return db[_0x6ec6('0xe1')][_0x6ec6('0x28')]({'where':_0x4b6a4c[_0x6ec6('0xd5')]})[_0x6ec6('0x15')](function(_0x5819de){_0x5b4f55[_0x6ec6('0x28')]=_0x5819de;if(_0x3b87b3[_0x6ec6('0x45')][_0x6ec6('0x43')]){_0x4b6a4c[_0x6ec6('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0x6ec6('0xcf')](_0x4b6a4c);})[_0x6ec6('0x15')](function(_0x12687d){_0x5b4f55[_0x6ec6('0x4b')]=_0x12687d;return _0x5b4f55;});}})[_0x6ec6('0x15')](respondWithFilteredResult(_0x20db5f,_0x4b6a4c))[_0x6ec6('0x20')](handleError(_0x20db5f,null));};exports['getChatInteractions']=function(_0x2b0adb,_0x5e9cfd){var _0x46e343={};var _0x443e23={};var _0x41d4f0;var _0x5a714d;return db[_0x6ec6('0x42')][_0x6ec6('0x94')]({'where':{'id':_0x2b0adb['params']['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x5e9cfd,null))[_0x6ec6('0x15')](function(_0x208ce1){if(_0x208ce1){_0x41d4f0=_0x208ce1;_0x443e23[_0x6ec6('0x55')]=_['keys'](db[_0x6ec6('0xe2')][_0x6ec6('0xd2')]);_0x443e23[_0x6ec6('0x45')]=_['keys'](_0x2b0adb[_0x6ec6('0x45')]);_0x443e23['filters']=_[_0x6ec6('0x5a')](_0x443e23[_0x6ec6('0x55')],_0x443e23[_0x6ec6('0x45')]);_0x46e343['attributes']=_[_0x6ec6('0x5a')](_0x443e23[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x2b0adb[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x46e343[_0x6ec6('0x49')]=_0x46e343[_0x6ec6('0x49')]['length']?_0x46e343[_0x6ec6('0x49')]:_0x443e23[_0x6ec6('0x55')];_0x46e343['order']=qs['sort'](_0x2b0adb[_0x6ec6('0x45')][_0x6ec6('0xd4')]);_0x46e343[_0x6ec6('0xd5')]=qs[_0x6ec6('0x59')](_[_0x6ec6('0xd6')](_0x2b0adb[_0x6ec6('0x45')],_0x443e23[_0x6ec6('0x59')]));if(_0x2b0adb['query'][_0x6ec6('0x34')]){_0x46e343['where']=_[_0x6ec6('0x5c')](_0x46e343[_0x6ec6('0xd5')],{'$or':_[_0x6ec6('0x35')](_0x46e343[_0x6ec6('0x49')],function(_0x6fab98){var _0x11e566={};_0x11e566[_0x6fab98]={'$like':'%'+_0x2b0adb[_0x6ec6('0x45')][_0x6ec6('0x34')]+'%'};return _0x11e566;})});}_0x46e343=_['merge']({},_0x46e343,_0x2b0adb[_0x6ec6('0x5d')]);return _0x41d4f0['getChatInteractions'](_0x46e343);}})['then'](function(_0x3587ac){if(_0x3587ac){_0x5a714d=_0x3587ac[_0x6ec6('0x4d')];if(!_0x2b0adb[_0x6ec6('0x45')][_0x6ec6('0xd8')](_0x6ec6('0xd9'))){_0x46e343[_0x6ec6('0x27')]=qs[_0x6ec6('0x27')](_0x2b0adb[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x46e343[_0x6ec6('0x25')]=qs['offset'](_0x2b0adb[_0x6ec6('0x45')]['offset']);}return _0x41d4f0[_0x6ec6('0xe3')](_0x46e343);}})[_0x6ec6('0x15')](function(_0x562343){if(_0x562343){return _0x562343?{'count':_0x5a714d,'rows':_0x562343}:null;}})['then'](respondWithResult(_0x5e9cfd,null))[_0x6ec6('0x20')](handleError(_0x5e9cfd,null));};exports[_0x6ec6('0xe4')]=function(_0x3cf6e8,_0x230599){var _0x43d8b5={};var _0x2fcae2={};var _0x38215e;var _0x26aab2;return db['User'][_0x6ec6('0x94')]({'where':{'id':_0x3cf6e8['params']['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x230599,null))[_0x6ec6('0x15')](function(_0x44dbbe){if(_0x44dbbe){_0x38215e=_0x44dbbe;_0x2fcae2['model']=_[_0x6ec6('0x58')](db[_0x6ec6('0xe5')][_0x6ec6('0xd2')]);_0x2fcae2[_0x6ec6('0x45')]=_[_0x6ec6('0x58')](_0x3cf6e8[_0x6ec6('0x45')]);_0x2fcae2['filters']=_['intersection'](_0x2fcae2[_0x6ec6('0x55')],_0x2fcae2[_0x6ec6('0x45')]);_0x43d8b5[_0x6ec6('0x49')]=_[_0x6ec6('0x5a')](_0x2fcae2[_0x6ec6('0x55')],qs['fields'](_0x3cf6e8[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x43d8b5['attributes']=_0x43d8b5[_0x6ec6('0x49')][_0x6ec6('0x4d')]?_0x43d8b5[_0x6ec6('0x49')]:_0x2fcae2[_0x6ec6('0x55')];_0x43d8b5['order']=qs[_0x6ec6('0xd4')](_0x3cf6e8[_0x6ec6('0x45')]['sort']);_0x43d8b5[_0x6ec6('0xd5')]=qs[_0x6ec6('0x59')](_[_0x6ec6('0xd6')](_0x3cf6e8[_0x6ec6('0x45')],_0x2fcae2[_0x6ec6('0x59')]));if(_0x3cf6e8[_0x6ec6('0x45')][_0x6ec6('0x34')]){_0x43d8b5[_0x6ec6('0xd5')]=_[_0x6ec6('0x5c')](_0x43d8b5[_0x6ec6('0xd5')],{'$or':_[_0x6ec6('0x35')](_0x43d8b5[_0x6ec6('0x49')],function(_0x541a4d){var _0x5b05c4={};_0x5b05c4[_0x541a4d]={'$like':'%'+_0x3cf6e8[_0x6ec6('0x45')][_0x6ec6('0x34')]+'%'};return _0x5b05c4;})});}_0x43d8b5=_[_0x6ec6('0x5c')]({},_0x43d8b5,_0x3cf6e8[_0x6ec6('0x5d')]);return _0x38215e[_0x6ec6('0xe4')](_0x43d8b5);}})[_0x6ec6('0x15')](function(_0xfd4a4e){if(_0xfd4a4e){_0x26aab2=_0xfd4a4e[_0x6ec6('0x4d')];if(!_0x3cf6e8[_0x6ec6('0x45')][_0x6ec6('0xd8')](_0x6ec6('0xd9'))){_0x43d8b5['limit']=qs[_0x6ec6('0x27')](_0x3cf6e8['query'][_0x6ec6('0x27')]);_0x43d8b5[_0x6ec6('0x25')]=qs[_0x6ec6('0x25')](_0x3cf6e8['query'][_0x6ec6('0x25')]);}return _0x38215e['getOpenchannelInteractions'](_0x43d8b5);}})['then'](function(_0x16f91e){if(_0x16f91e){return _0x16f91e?{'count':_0x26aab2,'rows':_0x16f91e}:null;}})[_0x6ec6('0x15')](respondWithResult(_0x230599,null))[_0x6ec6('0x20')](handleError(_0x230599,null));};exports['getMailInteractions']=function(_0xbc56cc,_0x180a98){var _0x4e84b1={'raw':!![],'where':{}};var _0x598b5d={};var _0x575ef1={'count':0x0,'rows':[]};return db[_0x6ec6('0x42')][_0x6ec6('0x94')]({'where':{'id':_0xbc56cc['params']['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x180a98,null))[_0x6ec6('0x15')](function(_0x440a0f){if(_0x440a0f){_0x598b5d[_0x6ec6('0x55')]=_[_0x6ec6('0x58')](db[_0x6ec6('0xe6')][_0x6ec6('0xd2')]);_0x598b5d[_0x6ec6('0x45')]=_[_0x6ec6('0x58')](_0xbc56cc[_0x6ec6('0x45')]);_0x598b5d[_0x6ec6('0x59')]=_[_0x6ec6('0x5a')](_0x598b5d[_0x6ec6('0x55')],_0x598b5d[_0x6ec6('0x45')]);_0x4e84b1[_0x6ec6('0x49')]=_['intersection'](_0x598b5d[_0x6ec6('0x55')],qs['fields'](_0xbc56cc['query'][_0x6ec6('0x5b')]));_0x4e84b1[_0x6ec6('0x49')]=_0x4e84b1[_0x6ec6('0x49')][_0x6ec6('0x4d')]?_0x4e84b1[_0x6ec6('0x49')]:_0x598b5d[_0x6ec6('0x55')];if(!_0xbc56cc[_0x6ec6('0x45')]['hasOwnProperty'](_0x6ec6('0xd9'))){_0x4e84b1[_0x6ec6('0x27')]=qs[_0x6ec6('0x27')](_0xbc56cc[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x4e84b1['offset']=qs[_0x6ec6('0x25')](_0xbc56cc[_0x6ec6('0x45')][_0x6ec6('0x25')]);}_0x4e84b1[_0x6ec6('0xd3')]=qs['sort'](_0xbc56cc[_0x6ec6('0x45')][_0x6ec6('0xd4')]);_0x4e84b1[_0x6ec6('0xd5')]=qs[_0x6ec6('0x59')](_[_0x6ec6('0xd6')](_0xbc56cc['query'],_0x598b5d['filters']));_0x4e84b1[_0x6ec6('0xd5')][_0x6ec6('0xde')]=_0x440a0f['id'];if(_0xbc56cc['query'][_0x6ec6('0x34')]){_0x4e84b1['where']=_[_0x6ec6('0x5c')](_0x4e84b1[_0x6ec6('0xd5')],{'$or':_[_0x6ec6('0x35')](_0x4e84b1['attributes'],function(_0x3214f8){var _0x1b0c6a={};_0x1b0c6a[_0x3214f8]={'$like':'%'+_0xbc56cc['query']['filter']+'%'};return _0x1b0c6a;})});}_0x4e84b1=_['merge']({},_0x4e84b1,_0xbc56cc[_0x6ec6('0x5d')]);return db[_0x6ec6('0xe6')][_0x6ec6('0x28')]({'where':_0x4e84b1[_0x6ec6('0xd5')]})[_0x6ec6('0x15')](function(_0x429ced){_0x575ef1[_0x6ec6('0x28')]=_0x429ced;if(_0xbc56cc['query']['includeAll']){_0x4e84b1[_0x6ec6('0x44')]=[{'all':!![]}];}return db[_0x6ec6('0xe6')][_0x6ec6('0xcf')](_0x4e84b1);})[_0x6ec6('0x15')](function(_0x3c3a2a){_0x575ef1[_0x6ec6('0x4b')]=_0x3c3a2a;return _0x575ef1;});}})[_0x6ec6('0x15')](respondWithFilteredResult(_0x180a98,_0x4e84b1))[_0x6ec6('0x20')](handleError(_0x180a98,null));};exports[_0x6ec6('0xe7')]=function(_0x5505c9,_0x1947ed){var _0x17bc70={};var _0x4ad89e={};var _0x2f35ce;var _0x132a9b;return db[_0x6ec6('0x42')][_0x6ec6('0x94')]({'where':{'id':_0x5505c9['params']['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x1947ed,null))[_0x6ec6('0x15')](function(_0x35fa61){if(_0x35fa61){_0x2f35ce=_0x35fa61;_0x4ad89e[_0x6ec6('0x55')]=_[_0x6ec6('0x58')](db[_0x6ec6('0xe8')]['rawAttributes']);_0x4ad89e['query']=_[_0x6ec6('0x58')](_0x5505c9[_0x6ec6('0x45')]);_0x4ad89e['filters']=_['intersection'](_0x4ad89e['model'],_0x4ad89e[_0x6ec6('0x45')]);_0x17bc70[_0x6ec6('0x49')]=_['intersection'](_0x4ad89e[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x5505c9[_0x6ec6('0x45')]['fields']));_0x17bc70[_0x6ec6('0x49')]=_0x17bc70[_0x6ec6('0x49')]['length']?_0x17bc70[_0x6ec6('0x49')]:_0x4ad89e[_0x6ec6('0x55')];_0x17bc70[_0x6ec6('0xd3')]=qs[_0x6ec6('0xd4')](_0x5505c9[_0x6ec6('0x45')][_0x6ec6('0xd4')]);_0x17bc70['where']=qs[_0x6ec6('0x59')](_['pick'](_0x5505c9[_0x6ec6('0x45')],_0x4ad89e[_0x6ec6('0x59')]));if(_0x5505c9['query']['filter']){_0x17bc70[_0x6ec6('0xd5')]=_[_0x6ec6('0x5c')](_0x17bc70[_0x6ec6('0xd5')],{'$or':_[_0x6ec6('0x35')](_0x17bc70[_0x6ec6('0x49')],function(_0x4bb69e){var _0x50836b={};_0x50836b[_0x4bb69e]={'$like':'%'+_0x5505c9[_0x6ec6('0x45')][_0x6ec6('0x34')]+'%'};return _0x50836b;})});}_0x17bc70=_[_0x6ec6('0x5c')]({},_0x17bc70,_0x5505c9[_0x6ec6('0x5d')]);return _0x2f35ce[_0x6ec6('0xe7')](_0x17bc70);}})[_0x6ec6('0x15')](function(_0x82de23){if(_0x82de23){_0x132a9b=_0x82de23[_0x6ec6('0x4d')];if(!_0x5505c9[_0x6ec6('0x45')][_0x6ec6('0xd8')]('nolimit')){_0x17bc70[_0x6ec6('0x27')]=qs['limit'](_0x5505c9[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x17bc70['offset']=qs[_0x6ec6('0x25')](_0x5505c9['query'][_0x6ec6('0x25')]);}return _0x2f35ce[_0x6ec6('0xe7')](_0x17bc70);}})[_0x6ec6('0x15')](function(_0x38cb14){if(_0x38cb14){return _0x38cb14?{'count':_0x132a9b,'rows':_0x38cb14}:null;}})[_0x6ec6('0x15')](respondWithResult(_0x1947ed,null))['catch'](handleError(_0x1947ed,null));};exports[_0x6ec6('0xe9')]=function(_0x4e11a0,_0x128b6e){var _0x5ce512={};var _0x493d82={};var _0x589867;var _0x1e46e1;return db[_0x6ec6('0x42')]['findOne']({'where':{'id':_0x4e11a0[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x128b6e,null))[_0x6ec6('0x15')](function(_0x522220){if(_0x522220){_0x589867=_0x522220;_0x493d82[_0x6ec6('0x55')]=_[_0x6ec6('0x58')](db[_0x6ec6('0xea')]['rawAttributes']);_0x493d82['query']=_[_0x6ec6('0x58')](_0x4e11a0[_0x6ec6('0x45')]);_0x493d82['filters']=_[_0x6ec6('0x5a')](_0x493d82['model'],_0x493d82[_0x6ec6('0x45')]);_0x5ce512['attributes']=_[_0x6ec6('0x5a')](_0x493d82[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x4e11a0[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x5ce512[_0x6ec6('0x49')]=_0x5ce512['attributes']['length']?_0x5ce512[_0x6ec6('0x49')]:_0x493d82[_0x6ec6('0x55')];_0x5ce512[_0x6ec6('0xd3')]=qs[_0x6ec6('0xd4')](_0x4e11a0[_0x6ec6('0x45')]['sort']);_0x5ce512['where']=qs['filters'](_[_0x6ec6('0xd6')](_0x4e11a0[_0x6ec6('0x45')],_0x493d82[_0x6ec6('0x59')]));if(_0x4e11a0[_0x6ec6('0x45')][_0x6ec6('0x34')]){_0x5ce512[_0x6ec6('0xd5')]=_[_0x6ec6('0x5c')](_0x5ce512['where'],{'$or':_[_0x6ec6('0x35')](_0x5ce512['attributes'],function(_0x1d7628){var _0x5b5ffb={};_0x5b5ffb[_0x1d7628]={'$like':'%'+_0x4e11a0['query'][_0x6ec6('0x34')]+'%'};return _0x5b5ffb;})});}_0x5ce512=_[_0x6ec6('0x5c')]({},_0x5ce512,_0x4e11a0[_0x6ec6('0x5d')]);return _0x589867['getFaxInteractions'](_0x5ce512);}})[_0x6ec6('0x15')](function(_0x5d191c){if(_0x5d191c){_0x1e46e1=_0x5d191c[_0x6ec6('0x4d')];if(!_0x4e11a0[_0x6ec6('0x45')][_0x6ec6('0xd8')](_0x6ec6('0xd9'))){_0x5ce512[_0x6ec6('0x27')]=qs[_0x6ec6('0x27')](_0x4e11a0[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x5ce512[_0x6ec6('0x25')]=qs[_0x6ec6('0x25')](_0x4e11a0[_0x6ec6('0x45')]['offset']);}return _0x589867[_0x6ec6('0xe9')](_0x5ce512);}})[_0x6ec6('0x15')](function(_0x255d9b){if(_0x255d9b){return _0x255d9b?{'count':_0x1e46e1,'rows':_0x255d9b}:null;}})[_0x6ec6('0x15')](respondWithResult(_0x128b6e,null))[_0x6ec6('0x20')](handleError(_0x128b6e,null));};exports[_0x6ec6('0xeb')]=function(_0x490d98,_0x372ead){var _0x232cb2={};var _0x5b5150={};var _0x4d3563;var _0xd04ce;return db[_0x6ec6('0x42')][_0x6ec6('0x94')]({'where':{'id':_0x490d98[_0x6ec6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x372ead,null))['then'](function(_0xa96d83){if(_0xa96d83){_0x4d3563=_0xa96d83;_0x5b5150[_0x6ec6('0x55')]=_['keys'](db[_0x6ec6('0xec')][_0x6ec6('0xd2')]);_0x5b5150[_0x6ec6('0x45')]=_['keys'](_0x490d98['query']);_0x5b5150[_0x6ec6('0x59')]=_[_0x6ec6('0x5a')](_0x5b5150['model'],_0x5b5150[_0x6ec6('0x45')]);_0x232cb2[_0x6ec6('0x49')]=_[_0x6ec6('0x5a')](_0x5b5150[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x490d98[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x232cb2['attributes']=_0x232cb2[_0x6ec6('0x49')][_0x6ec6('0x4d')]?_0x232cb2[_0x6ec6('0x49')]:_0x5b5150['model'];_0x232cb2[_0x6ec6('0xd3')]=qs[_0x6ec6('0xd4')](_0x490d98[_0x6ec6('0x45')][_0x6ec6('0xd4')]);_0x232cb2[_0x6ec6('0xd5')]=qs[_0x6ec6('0x59')](_[_0x6ec6('0xd6')](_0x490d98[_0x6ec6('0x45')],_0x5b5150['filters']));if(_0x490d98[_0x6ec6('0x45')][_0x6ec6('0x34')]){_0x232cb2[_0x6ec6('0xd5')]=_[_0x6ec6('0x5c')](_0x232cb2['where'],{'$or':_[_0x6ec6('0x35')](_0x232cb2[_0x6ec6('0x49')],function(_0x1c31ab){var _0x20bacf={};_0x20bacf[_0x1c31ab]={'$like':'%'+_0x490d98['query'][_0x6ec6('0x34')]+'%'};return _0x20bacf;})});}_0x232cb2=_[_0x6ec6('0x5c')]({},_0x232cb2,_0x490d98[_0x6ec6('0x5d')]);return _0x4d3563[_0x6ec6('0xeb')](_0x232cb2);}})['then'](function(_0x24fe33){if(_0x24fe33){_0xd04ce=_0x24fe33[_0x6ec6('0x4d')];if(!_0x490d98[_0x6ec6('0x45')][_0x6ec6('0xd8')]('nolimit')){_0x232cb2[_0x6ec6('0x27')]=qs[_0x6ec6('0x27')](_0x490d98[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x232cb2[_0x6ec6('0x25')]=qs['offset'](_0x490d98['query']['offset']);}return _0x4d3563[_0x6ec6('0xeb')](_0x232cb2);}})['then'](function(_0x53f75f){if(_0x53f75f){return _0x53f75f?{'count':_0xd04ce,'rows':_0x53f75f}:null;}})[_0x6ec6('0x15')](respondWithResult(_0x372ead,null))[_0x6ec6('0x20')](handleError(_0x372ead,null));};exports[_0x6ec6('0xed')]=function(_0x17aca4,_0x2c5167,_0x26e925){var _0x6009c3;var _0x2cde7d;var _0xceae5d;var _0x3e8ac6=!_['isNil'](_0x17aca4[_0x6ec6('0x5f')]['id'])?_0x17aca4[_0x6ec6('0x5f')]['id']:!_[_0x6ec6('0x66')](_0x17aca4['user']['id'])?_0x17aca4[_0x6ec6('0x31')]['id']:null;return db[_0x6ec6('0x42')][_0x6ec6('0x38')]({'where':{'id':_0x3e8ac6,'role':{'$or':[_0x6ec6('0x30'),_0x6ec6('0x31'),'agent']}},'attributes':['id','name',_0x6ec6('0xee'),_0x6ec6('0xef'),_0x6ec6('0x2c'),_0x6ec6('0x63'),_0x6ec6('0x9d')]})[_0x6ec6('0x15')](function(_0x58e263){if(_0x58e263){if(_0x58e263[_0x6ec6('0x2c')]===_0x6ec6('0x70')){_0x6009c3=_0x58e263;if(_0x17aca4['body']['interface']){_0xceae5d=util['format'](_0x6ec6('0xf0'),_0x6009c3[_0x17aca4[_0x6ec6('0x5e')][_0x6ec6('0x9f')]]);}else if(_0x17aca4[_0x6ec6('0x5e')][_0x6ec6('0xf1')]){_0xceae5d=util['format'](_0x6ec6('0xf2'),_0x17aca4[_0x6ec6('0x5e')][_0x6ec6('0xf1')]);}else{_0xceae5d=util[_0x6ec6('0xab')](_0x6ec6('0xf2'),_0x6009c3[_0x6ec6('0x3b')]);}socket['to'](util[_0x6ec6('0xab')](_0x6ec6('0xf3'),_0x6009c3['name']))[_0x6ec6('0x2d')](_0x6ec6('0xf4'),{'user':{'id':_0x6009c3['id'],'name':_0x6009c3[_0x6ec6('0x3b')]},'ip':_0x17aca4[_0x6ec6('0xf5')][_0x6ec6('0xf6')]||_0x17aca4['connection'][_0x6ec6('0xf7')]||_0x17aca4[_0x6ec6('0xf8')]['remoteAddress']||_0x17aca4[_0x6ec6('0xf9')][_0x6ec6('0xf8')]['remoteAddress']});return db[_0x6ec6('0xac')]['destroy']({'where':{'membername':_0x6009c3[_0x6ec6('0x3b')]},'individualHooks':!![]});}}else{throw new db[(_0x6ec6('0x8d'))][(_0x6ec6('0x8e'))](_0x6ec6('0xfa'));}})[_0x6ec6('0x15')](function(){if(_0x6009c3){return _0x6009c3[_0x6ec6('0xfb')]({'raw':!![]});}})[_0x6ec6('0x15')](function(_0xfbd040){if(_0x6009c3){if(_0xfbd040){_0x2cde7d=_0xfbd040;if(_0x2cde7d['length']){var _0x1c7d85=_0x2cde7d['map'](function(_0x5a449c){var _0xdc8bbb={'membername':_0x6009c3[_0x6ec6('0x3b')],'UserId':_0x6009c3['id'],'queue_name':_0x5a449c[_0x6ec6('0x3b')],'VoiceQueueId':_0x5a449c['id'],'interface':_0xceae5d,'paused':_0x6009c3[_0x6ec6('0x9d')]||![],'penalty':_0x5a449c['UserVoiceQueue.penalty']||0x0};return db[_0x6ec6('0xac')][_0x6ec6('0xfc')](_0xdc8bbb);});return Promise[_0x6ec6('0x53')](_0x1c7d85);}}}})[_0x6ec6('0x15')](function(){if(_0x6009c3){return db['MemberReport'][_0x6ec6('0xcf')]({'where':{'membername':_0x6009c3[_0x6ec6('0x3b')],'exitAt':null}});}})['then'](function(_0x56eddc){if(_0x6009c3){var _0xd867b5=[];_0x56eddc[_0x6ec6('0xfd')](function(_0x7318f3){_0xd867b5[_0x6ec6('0x4a')](_0x7318f3[_0x6ec6('0x2b')]({'exitAt':moment()['format'](_0x6ec6('0xfe'))}));});return Promise[_0x6ec6('0x53')](_0xd867b5);}})['then'](function(){if(_0x6009c3){var _0x162c9f=[];var _0x1a1207=[];var _0x20ad02=utils[_0x6ec6('0xff')]();var _0x1953a2={'membername':_0x6009c3[_0x6ec6('0x3b')],'interface':_0xceae5d,'enterAt':moment()[_0x6ec6('0xab')](_0x6ec6('0xfe')),'role':_0x6009c3[_0x6ec6('0x2c')],'internal':_0x6009c3[_0x6ec6('0x63')]};_0x20ad02['forEach'](function(_0x4df5bd){_0x162c9f[_0x6ec6('0x4a')](_[_0x6ec6('0x5c')]({'channel':_0x4df5bd,'type':_0x6ec6('0x100'),'data1':_0x17aca4[_0x6ec6('0x5e')][_0x6ec6('0x101')],'data2':_0xceae5d},_0x1953a2));if(_0x6009c3[_0x6ec6('0x9d')]){_0x1a1207[_0x6ec6('0x4a')](_['merge']({'channel':_0x4df5bd,'type':_0x6ec6('0x102'),'data1':'LOGININPAUSE'},_0x1953a2));}});return db['MemberReport'][_0x6ec6('0x103')](_0x162c9f[_0x6ec6('0xc6')](_0x1a1207),{'individualHooks':!![]});}})['then'](function(){if(_0x6009c3){return _0x6009c3[_0x6ec6('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x6ec6('0xab')](_0x6ec6('0xfe')),'voicePause':_0x6009c3[_0x6ec6('0x9d')]||![],'mailPause':_0x6009c3[_0x6ec6('0x9d')]||![],'chatPause':_0x6009c3['loginInPause']||![],'faxPause':_0x6009c3[_0x6ec6('0x9d')]||![],'smsPause':_0x6009c3[_0x6ec6('0x9d')]||![],'openchannelPause':_0x6009c3[_0x6ec6('0x9d')]||![],'whatsappPause':_0x6009c3[_0x6ec6('0x9d')]||![],'pauseType':_0x6009c3['loginInPause']?_0x6ec6('0x104'):null,'interface':_0xceae5d,'lastPauseAt':moment()[_0x6ec6('0xab')](_0x6ec6('0xfe'))});}})[_0x6ec6('0x15')](function(_0x166588){if(_0x17aca4[_0x6ec6('0x105')]){return _0x26e925();}else{return Promise[_0x6ec6('0x106')](_0x166588)[_0x6ec6('0x15')](respondWithResult(_0x2c5167,null));}})[_0x6ec6('0x20')](handleError(_0x2c5167,null));};exports[_0x6ec6('0x107')]=function(_0x4cbe2f,_0x4faa3c){var _0x1636f3;return db[_0x6ec6('0x42')][_0x6ec6('0x38')]({'where':{'id':_0x4cbe2f[_0x6ec6('0x5f')]['id'],'role':_0x6ec6('0x70')},'attributes':['id','name',_0x6ec6('0x2c')]})[_0x6ec6('0x15')](handleEntityNotFound(_0x4faa3c,null))[_0x6ec6('0x15')](function(_0x519304){if(_0x519304){_0x1636f3=_0x519304;return db[_0x6ec6('0xac')]['destroy']({'where':{'membername':_0x1636f3['name']},'individualHooks':!![]});}})[_0x6ec6('0x15')](function(){return db[_0x6ec6('0x108')][_0x6ec6('0xcf')]({'where':{'membername':_0x1636f3['name'],'exitAt':null}});})[_0x6ec6('0x15')](function(_0x4afa6b){var _0x212fd3=[];_0x4afa6b[_0x6ec6('0xfd')](function(_0x44c7c5){_0x212fd3[_0x6ec6('0x4a')](_0x44c7c5[_0x6ec6('0x2b')]({'exitAt':moment()[_0x6ec6('0xab')](_0x6ec6('0xfe'))}));});return Promise[_0x6ec6('0x53')](_0x212fd3);})[_0x6ec6('0x15')](function(){return _0x1636f3[_0x6ec6('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6ec6('0x15')](respondWithResult(_0x4faa3c,null))[_0x6ec6('0x20')](handleError(_0x4faa3c,null));};exports[_0x6ec6('0x109')]=function(_0x10d8d1,_0x1df12a){var _0x1520da;return db[_0x6ec6('0xac')]['update']({'paused':0x1},{'where':{'UserId':_0x10d8d1[_0x6ec6('0x5f')]['id']},'individualHooks':!![]})[_0x6ec6('0x15')](function(){return db['User'][_0x6ec6('0x38')]({'where':{'id':_0x10d8d1[_0x6ec6('0x5f')]['id'],'role':_0x6ec6('0x70')},'attributes':['id',_0x6ec6('0x3b'),_0x6ec6('0x2c'),_0x6ec6('0x63'),_0x6ec6('0x9f'),_0x6ec6('0x9c')]});})[_0x6ec6('0x15')](handleEntityNotFound(_0x1df12a,null))[_0x6ec6('0x15')](function(_0x35ea24){if(_0x35ea24){_0x1520da=_0x35ea24;return respondWithRpcPromise(_0x6ec6('0x10a'),_0x6ec6('0x109'),{'id':_0x1520da['id'],'name':_0x1520da[_0x6ec6('0x3b')],'pause':!![]});}})[_0x6ec6('0x15')](function(){if(_0x1520da){return db[_0x6ec6('0x108')][_0x6ec6('0xcf')]({'where':{'membername':_0x1520da[_0x6ec6('0x3b')],'type':'PAUSE','exitAt':null}});}})[_0x6ec6('0x15')](function(_0x195067){if(_0x195067[_0x6ec6('0x4d')]){var _0x138d7a=moment()[_0x6ec6('0xab')](_0x6ec6('0xfe'));for(var _0x15aced=0x0,_0x150ef7=_0x195067[_0x6ec6('0x4d')];_0x15aced<_0x150ef7;_0x15aced++){_0x195067[_0x15aced]['updateAttributes']({'exitAt':_0x138d7a});}}})[_0x6ec6('0x15')](function(){var _0x3c3dcf=[];var _0x2c234f=utils['getChannels']();_0x2c234f[_0x6ec6('0xfd')](function(_0x597f5f){_0x3c3dcf[_0x6ec6('0x4a')]({'channel':_0x597f5f,'membername':_0x1520da[_0x6ec6('0x3b')],'interface':_[_0x6ec6('0x66')](_0x1520da['interface'])?util['format']('SIP/%s',_0x1520da[_0x6ec6('0x3b')]):_0x1520da['interface'],'type':_0x6ec6('0x102'),'enterAt':moment()[_0x6ec6('0xab')](_0x6ec6('0xfe')),'data1':_0x10d8d1[_0x6ec6('0x5e')][_0x6ec6('0x3e')]||_0x6ec6('0x10b'),'role':_0x1520da[_0x6ec6('0x2c')],'internal':_0x1520da[_0x6ec6('0x63')]});});return db['MemberReport']['bulkCreate'](_0x3c3dcf,{'individualHooks':!![]});})[_0x6ec6('0x15')](function(){return _0x1520da[_0x6ec6('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x10d8d1[_0x6ec6('0x5e')][_0x6ec6('0x3e')]||_0x6ec6('0x10b'),'lastPauseAt':moment()[_0x6ec6('0xab')](_0x6ec6('0xfe'))});})[_0x6ec6('0x15')](respondWithResult(_0x1df12a,null))['catch'](handleError(_0x1df12a,null));};exports[_0x6ec6('0x10c')]=function(_0x388a99,_0x57fa21){if(_0x388a99[_0x6ec6('0x5e')][_0x6ec6('0x9b')]&&!utils[_0x6ec6('0xa0')](_0x388a99['body']['channel'])){throw new APIBadRequestError(util[_0x6ec6('0xab')](_0x6ec6('0x10d'),_0x388a99['body'][_0x6ec6('0x9b')]));}return db[_0x6ec6('0x42')]['find']({'where':{'id':_0x388a99['params']['id']},'attributes':['id',_0x6ec6('0x3b'),_0x6ec6('0x2c'),_0x6ec6('0x63'),_0x6ec6('0x9f'),'online',_0x6ec6('0x9e'),'mailPause',_0x6ec6('0x10e'),_0x6ec6('0x10f'),_0x6ec6('0x110'),_0x6ec6('0x111'),_0x6ec6('0x112'),_0x6ec6('0x113'),'lastPauseAt']})[_0x6ec6('0x15')](function(_0x435ace){if(!_0x435ace){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x388a99[_0x6ec6('0x5f')]['id']));}return _0x435ace[_0x6ec6('0x10c')](_0x388a99[_0x6ec6('0x5e')][_0x6ec6('0x9b')]);})[_0x6ec6('0x15')](respondWithResult(_0x57fa21,null))[_0x6ec6('0x20')](APIHandleError(_0x57fa21));};exports['getTeams']=function(_0x1af111,_0x329bc3){var _0x13eb15={};var _0x15c6c3={};var _0x4f4735;var _0x18d047;return db['User']['findOne']({'where':{'id':_0x1af111[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x329bc3,null))[_0x6ec6('0x15')](function(_0x41f00b){if(_0x41f00b){_0x4f4735=_0x41f00b;_0x15c6c3[_0x6ec6('0x55')]=_[_0x6ec6('0x58')](db[_0x6ec6('0x114')][_0x6ec6('0xd2')]);_0x15c6c3['query']=_[_0x6ec6('0x58')](_0x1af111['query']);_0x15c6c3['filters']=_[_0x6ec6('0x5a')](_0x15c6c3[_0x6ec6('0x55')],_0x15c6c3['query']);_0x13eb15['attributes']=_['intersection'](_0x15c6c3[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x1af111[_0x6ec6('0x45')]['fields']));_0x13eb15[_0x6ec6('0x49')]=_0x13eb15['attributes'][_0x6ec6('0x4d')]?_0x13eb15['attributes']:_0x15c6c3[_0x6ec6('0x55')];_0x13eb15[_0x6ec6('0xd3')]=qs['sort'](_0x1af111[_0x6ec6('0x45')][_0x6ec6('0xd4')]);_0x13eb15[_0x6ec6('0xd5')]=qs[_0x6ec6('0x59')](_[_0x6ec6('0xd6')](_0x1af111[_0x6ec6('0x45')],_0x15c6c3[_0x6ec6('0x59')]));if(_0x1af111['query'][_0x6ec6('0x34')]){_0x13eb15[_0x6ec6('0xd5')]=_[_0x6ec6('0x5c')](_0x13eb15[_0x6ec6('0xd5')],{'$or':_[_0x6ec6('0x35')](_0x13eb15[_0x6ec6('0x49')],function(_0x3e4fb5){var _0x5f07a9={};_0x5f07a9[_0x3e4fb5]={'$like':'%'+_0x1af111[_0x6ec6('0x45')][_0x6ec6('0x34')]+'%'};return _0x5f07a9;})});}_0x13eb15=_['merge']({},_0x13eb15,_0x1af111['options']);return _0x4f4735['getTeams'](_0x13eb15);}})[_0x6ec6('0x15')](function(_0x53e92e){if(_0x53e92e){_0x18d047=_0x53e92e['length'];if(!_0x1af111['query'][_0x6ec6('0xd8')]('nolimit')){_0x13eb15[_0x6ec6('0x27')]=qs['limit'](_0x1af111[_0x6ec6('0x45')][_0x6ec6('0x27')]);_0x13eb15[_0x6ec6('0x25')]=qs['offset'](_0x1af111[_0x6ec6('0x45')][_0x6ec6('0x25')]);}return _0x4f4735['getTeams'](_0x13eb15);}})[_0x6ec6('0x15')](function(_0x4c2cd4){if(_0x4c2cd4){return _0x4c2cd4?{'count':_0x18d047,'rows':_0x4c2cd4}:null;}})[_0x6ec6('0x15')](respondWithResult(_0x329bc3,null))[_0x6ec6('0x20')](handleError(_0x329bc3,null));};exports[_0x6ec6('0x115')]=function(_0x503e7a,_0x3a0ec7){var _0x218e65=_0x503e7a[_0x6ec6('0x5f')]['id'];var _0x495fd9=_0x503e7a[_0x6ec6('0x5e')]?_0x503e7a['body'][_0x6ec6('0xa4')]:null;var _0x263959=[];return Promise[_0x6ec6('0x106')]()['then'](function(){if(!_0x495fd9)throw new APIBadRequestError(_0x6ec6('0x116'));})[_0x6ec6('0x15')](function(){return db[_0x6ec6('0x42')][_0x6ec6('0x94')]({'where':{'id':_0x218e65}});})[_0x6ec6('0x15')](function(_0x5e09c5){if(!_0x5e09c5)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x503e7a[_0x6ec6('0x5f')]['id']));return db['sequelize'][_0x6ec6('0x117')](function(_0x49d174){return _0x5e09c5['addTeams'](_0x495fd9,{'transaction':_0x49d174})['then'](function(){return db[_0x6ec6('0x114')][_0x6ec6('0xcf')]({'where':{'id':{'$in':_0x495fd9}}});})[_0x6ec6('0x15')](function(_0x358b88){var _0x26f4b8=_[_0x6ec6('0x35')](_0x358b88,function(_0x6aca81){return _0x6aca81[_0x6ec6('0x118')]();});return Promise['all'](_0x26f4b8);})[_0x6ec6('0x15')](function(_0x2c193a){_0x263959=_[_0x6ec6('0x119')](_0x2c193a);var _0xa20711=_[_0x6ec6('0x35')](_0x263959,function(_0x5ccc48){return _0x5ccc48[_0x6ec6('0x11a')](_0x5e09c5['id'],{'transaction':_0x49d174});});return Promise[_0x6ec6('0x53')](_0xa20711);})[_0x6ec6('0x15')](function(){if(!_0x5e09c5['online'])return;var _0x1b1900=_['filter'](_0x263959,function(_0x87ca53){return _0x87ca53['getDataValue'](_0x6ec6('0x9b'))===_0x6ec6('0x11b');});var _0x34c98a=_[_0x6ec6('0x35')](_0x1b1900,function(_0x50c518){return db['UserVoiceQueueRt'][_0x6ec6('0xfc')]({'membername':_0x5e09c5[_0x6ec6('0x3b')],'UserId':_0x5e09c5['id'],'queue_name':_0x50c518['name'],'VoiceQueueId':_0x50c518['id'],'interface':_[_0x6ec6('0x66')](_0x5e09c5[_0x6ec6('0x9f')])?util[_0x6ec6('0xab')](_0x6ec6('0xf2'),_0x5e09c5[_0x6ec6('0x3b')]):_0x5e09c5[_0x6ec6('0x9f')],'paused':_0x5e09c5[_0x6ec6('0x9e')]||![],'penalty':_0x5e09c5['penalty']},{'transaction':_0x49d174});});return Promise[_0x6ec6('0x53')](_0x34c98a);})['then'](function(){return db[_0x6ec6('0x11c')][_0x6ec6('0xcf')]({'where':{'teamId':{'$in':_0x495fd9}}});})[_0x6ec6('0x15')](function(_0xc70333){var _0x3592ff=_[_0x6ec6('0x35')](_0xc70333,function(_0x9821ae){return db[_0x6ec6('0x11d')][_0x6ec6('0x7d')]({'UserId':_0x5e09c5['id'],'VoicePrefixId':_0x9821ae[_0x6ec6('0x11e')]},{'transaction':_0x49d174});});return Promise['all'](_0x3592ff);});});})[_0x6ec6('0x15')](function(){for(var _0x1bc843=0x0;_0x1bc843<_0x263959[_0x6ec6('0x4d')];_0x1bc843++){var _0x11af2e=_0x263959[_0x1bc843][_0x6ec6('0x11f')]('channel');var _0x197063=_0x11af2e+_0x6ec6('0xa7');socket['emit']('user'+_0x11af2e+_0x6ec6('0xa8'),{'UserId':_0x218e65,['queueField']:_0x263959[_0x1bc843]['id']});}})['then'](respondWithStatusCode(_0x3a0ec7,null))[_0x6ec6('0x20')](APIHandleError(_0x3a0ec7));};exports[_0x6ec6('0x120')]=function(_0x31081d,_0x48af7c){var _0x17e675=_0x31081d['params']['id'];var _0x182006=null;if(_0x31081d['query']['ids']){_0x182006=_[_0x6ec6('0xb0')](_0x31081d['query'][_0x6ec6('0xa4')])?_0x31081d[_0x6ec6('0x45')][_0x6ec6('0xa4')]:[_0x31081d['query']['ids']];}var _0x2c392f=[];return Promise['resolve']()[_0x6ec6('0x15')](function(){if(!_0x182006)throw new APIBadRequestError(_0x6ec6('0x121'));})[_0x6ec6('0x15')](function(){return db['User'][_0x6ec6('0x94')]({'where':{'id':_0x17e675}});})[_0x6ec6('0x15')](function(_0x567dab){if(!_0x567dab)throw new APINotFoundError(util[_0x6ec6('0xab')](_0x6ec6('0xc8'),_0x31081d[_0x6ec6('0x5f')]['id']));return db[_0x6ec6('0x69')]['transaction'](function(_0x5913c0){return _0x567dab[_0x6ec6('0x120')](_0x182006,{'transaction':_0x5913c0})['then'](function(){return db[_0x6ec6('0x114')][_0x6ec6('0xcf')]({'where':{'id':{'$in':_0x182006}}});})['then'](function(_0x2b979c){var _0x2ea516=_['map'](_0x2b979c,function(_0x1bb610){return _0x1bb610[_0x6ec6('0x118')]();});return Promise['all'](_0x2ea516);})['then'](function(_0x4aea1a){_0x2c392f=_[_0x6ec6('0x119')](_0x4aea1a);var _0x44358b=_[_0x6ec6('0x35')](_0x2c392f,function(_0x38ae79){return _0x38ae79['removeAgent'](_0x567dab['id'],{'transaction':_0x5913c0});});return Promise[_0x6ec6('0x53')](_0x44358b);})[_0x6ec6('0x15')](function(){if(!_0x567dab[_0x6ec6('0x9c')])return;var _0x1ec538=_[_0x6ec6('0x34')](_0x2c392f,function(_0x1eabcc){return _0x1eabcc[_0x6ec6('0x11f')]('channel')===_0x6ec6('0x11b');});var _0x4688dc=_[_0x6ec6('0x35')](_0x1ec538,function(_0x398f44){return db[_0x6ec6('0xac')][_0x6ec6('0x39')]({'where':{'VoiceQueueId':_0x398f44['id'],'UserId':_0x567dab['id']},'transaction':_0x5913c0});});return Promise[_0x6ec6('0x53')](_0x4688dc);})[_0x6ec6('0x15')](function(){return db[_0x6ec6('0x11c')][_0x6ec6('0xcf')]({'where':{'teamId':{'$in':_0x182006}}});})['then'](function(_0x4434e2){var _0x4416fc=_[_0x6ec6('0x35')](_0x4434e2,function(_0x32ba85){return db[_0x6ec6('0x11d')][_0x6ec6('0x39')]({'where':{'UserId':_0x567dab['id'],'VoicePrefixId':_0x32ba85[_0x6ec6('0x11e')]}},{'transaction':_0x5913c0});});return Promise[_0x6ec6('0x53')](_0x4416fc);});});})[_0x6ec6('0x15')](function(){for(var _0x367bb9=0x0;_0x367bb9<_0x2c392f[_0x6ec6('0x4d')];_0x367bb9++){var _0x50c583=_0x2c392f[_0x367bb9][_0x6ec6('0x11f')](_0x6ec6('0x9b'));var _0x41454a=_0x50c583+_0x6ec6('0xa7');socket[_0x6ec6('0x2d')](_0x6ec6('0x31')+_0x50c583+'Queue:remove',{'UserId':_0x17e675,['queueField']:_0x2c392f[_0x367bb9]['id']});}})[_0x6ec6('0x15')](respondWithStatusCode(_0x48af7c,null))[_0x6ec6('0x20')](APIHandleError(_0x48af7c));};exports['getLists']=function(_0x5d2594,_0x570edb){var _0x7f9bb3={};var _0x1e19a5={};var _0x5a2ad2;var _0x3076fd;return db[_0x6ec6('0x42')]['findOne']({'where':{'id':_0x5d2594[_0x6ec6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x570edb,null))[_0x6ec6('0x15')](function(_0xf725f4){if(_0xf725f4){_0x5a2ad2=_0xf725f4;_0x1e19a5[_0x6ec6('0x55')]=_[_0x6ec6('0x58')](db[_0x6ec6('0xc9')][_0x6ec6('0xd2')]);_0x1e19a5[_0x6ec6('0x45')]=_[_0x6ec6('0x58')](_0x5d2594[_0x6ec6('0x45')]);_0x1e19a5[_0x6ec6('0x59')]=_[_0x6ec6('0x5a')](_0x1e19a5[_0x6ec6('0x55')],_0x1e19a5[_0x6ec6('0x45')]);_0x7f9bb3[_0x6ec6('0x49')]=_[_0x6ec6('0x5a')](_0x1e19a5['model'],qs[_0x6ec6('0x5b')](_0x5d2594[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x7f9bb3[_0x6ec6('0x49')]=_0x7f9bb3['attributes'][_0x6ec6('0x4d')]?_0x7f9bb3['attributes']:_0x1e19a5[_0x6ec6('0x55')];_0x7f9bb3['order']=qs[_0x6ec6('0xd4')](_0x5d2594[_0x6ec6('0x45')][_0x6ec6('0xd4')]);_0x7f9bb3[_0x6ec6('0xd5')]=qs[_0x6ec6('0x59')](_[_0x6ec6('0xd6')](_0x5d2594[_0x6ec6('0x45')],_0x1e19a5['filters']));if(_0x5d2594['query'][_0x6ec6('0x34')]){_0x7f9bb3[_0x6ec6('0xd5')]=_['merge'](_0x7f9bb3['where'],{'$or':_[_0x6ec6('0x35')](_0x7f9bb3[_0x6ec6('0x49')],function(_0x2a1123){var _0x97c0dd={};_0x97c0dd[_0x2a1123]={'$like':'%'+_0x5d2594[_0x6ec6('0x45')][_0x6ec6('0x34')]+'%'};return _0x97c0dd;})});}_0x7f9bb3=_[_0x6ec6('0x5c')]({},_0x7f9bb3,_0x5d2594[_0x6ec6('0x5d')]);return _0x5a2ad2[_0x6ec6('0x122')](_0x7f9bb3);}})['then'](function(_0x4980b2){if(_0x4980b2){_0x3076fd=_0x4980b2[_0x6ec6('0x4d')];if(!_0x5d2594[_0x6ec6('0x45')]['hasOwnProperty'](_0x6ec6('0xd9'))){_0x7f9bb3['limit']=qs[_0x6ec6('0x27')](_0x5d2594['query'][_0x6ec6('0x27')]);_0x7f9bb3[_0x6ec6('0x25')]=qs[_0x6ec6('0x25')](_0x5d2594['query'][_0x6ec6('0x25')]);}return _0x5a2ad2['getLists'](_0x7f9bb3);}})['then'](function(_0x7c9f37){if(_0x7c9f37){return _0x7c9f37?{'count':_0x3076fd,'rows':_0x7c9f37}:null;}})[_0x6ec6('0x15')](respondWithResult(_0x570edb,null))[_0x6ec6('0x20')](handleError(_0x570edb,null));};exports[_0x6ec6('0x123')]=function(_0x4e26a2,_0x261c98){var _0x53383c={};var _0x39971a={};var _0x32f1c3;return db[_0x6ec6('0x42')][_0x6ec6('0x94')]({'where':{'id':_0x4e26a2[_0x6ec6('0x5f')]['id']}})[_0x6ec6('0x15')](handleEntityNotFound(_0x261c98,null))[_0x6ec6('0x15')](function(_0x2acf93){if(_0x2acf93){_0x32f1c3=_0x2acf93;_0x39971a['model']=_[_0x6ec6('0x58')](db['User']['rawAttributes']);_0x39971a[_0x6ec6('0x45')]=_['keys'](_0x4e26a2[_0x6ec6('0x45')]);_0x39971a[_0x6ec6('0x59')]=_[_0x6ec6('0x5a')](_0x39971a[_0x6ec6('0x55')],_0x39971a[_0x6ec6('0x45')]);_0x53383c[_0x6ec6('0x49')]=_['intersection'](_0x39971a[_0x6ec6('0x55')],qs[_0x6ec6('0x5b')](_0x4e26a2[_0x6ec6('0x45')][_0x6ec6('0x5b')]));_0x53383c[_0x6ec6('0x49')]=_0x53383c[_0x6ec6('0x49')][_0x6ec6('0x4d')]?_0x53383c[_0x6ec6('0x49')]:_0x39971a['model'];_0x53383c[_0x6ec6('0xd3')]=qs['sort'](_0x4e26a2[_0x6ec6('0x45')]['sort']);_0x53383c[_0x6ec6('0xd5')]=qs['filters'](_['pick'](_0x4e26a2['query'],_0x39971a[_0x6ec6('0x59')]));if(_0x4e26a2['query'][_0x6ec6('0x34')]){_0x53383c['where']=_['merge'](_0x53383c[_0x6ec6('0xd5')],{'$or':_[_0x6ec6('0x35')](_0x53383c['attributes'],function(_0x3b0caa){var _0x5cb9aa={};_0x5cb9aa[_0x3b0caa]={'$like':'%'+_0x4e26a2['query'][_0x6ec6('0x34')]+'%'};return _0x5cb9aa;})});}_0x53383c[_0x6ec6('0x55')]=db['User'];_0x53383c['as']=_0x6ec6('0x85');_0x53383c=_[_0x6ec6('0x5c')]({},_0x53383c,_0x4e26a2[_0x6ec6('0x5d')]);return _0x32f1c3[_0x6ec6('0xfb')]({'include':[_0x53383c]});}})['then'](function(_0x503ab2){if(_0x503ab2){var _0x5e75dd={},_0x3d3a13=[];for(var _0x5222f6=0x0;_0x5222f6<_0x503ab2[_0x6ec6('0x4d')];_0x5222f6+=0x1){for(var _0x4b1818=0x0,_0x2fac43;_0x4b1818<_0x503ab2[_0x5222f6]['Agents'][_0x6ec6('0x4d')];_0x4b1818+=0x1){_0x2fac43=_0x503ab2[_0x5222f6][_0x6ec6('0x85')][_0x4b1818][_0x6ec6('0x2f')]({'plain':!![]});_0x5e75dd[_0x2fac43['id']]=_0x2fac43;}}_0x5e75dd=_[_0x6ec6('0x124')](_0x5e75dd);for(var _0x5abdf9=qs[_0x6ec6('0x25')](_0x4e26a2[_0x6ec6('0x45')]['offset']);_0x5abdf9<_0x5e75dd[_0x6ec6('0x4d')]&&_0x3d3a13[_0x6ec6('0x4d')]=_0x40dec9){_0x2697b4=_0x40dec9;_0x5d9846=0xc8;}else{_0x5d9846=0xce;}_0x187194[_0xd439('0x22')](_0x5d9846);return _0x187194[_0xd439('0x28')](_0xd439('0x29'),_0x1476be+'-'+_0x2697b4+'/'+_0x40dec9)[_0xd439('0x23')](_0x590c96);}return null;};}function saveUpdates(_0x2a7a19){return function(_0x54a79a){if(_0x54a79a){return _0x54a79a[_0xd439('0x2a')](_0x2a7a19)[_0xd439('0x2b')](function(_0x32e1af){if(_0x32e1af[_0xd439('0x2c')]==='agent'){socket['emit'](_0xd439('0x2d')+_0x32e1af['id'],_0x32e1af);}return _0x32e1af;});}return null;};}function removeEntity(_0x5e6484){return function(_0x5da4c1){if(_0x5da4c1){return _0x5da4c1[_0xd439('0x2e')]()[_0xd439('0x2b')](function(){var _0x80c00b=_0x5da4c1[_0xd439('0x2f')]({'plain':!![]});if(_0x80c00b[_0xd439('0x2c')]==='admin')return;var _0x17fc7d=[{'name':'Users','value':_0xd439('0x30'),'ignore':!![]},{'name':'Agents','value':_0xd439('0x31'),'ignore':![]},{'name':_0xd439('0x32'),'value':_0xd439('0x33'),'ignore':![]}];var _0x3e1045=_(_0x17fc7d)['filter'](_0xd439('0x34'))[_0xd439('0x35')]('value')['value']();if(_[_0xd439('0x36')](_0x3e1045,_0x80c00b[_0xd439('0x2c')])){return;}var _0x22ba12=_['find'](_0x17fc7d,[_0xd439('0x37'),_0x80c00b[_0xd439('0x2c')]])['name'];return db[_0xd439('0x38')][_0xd439('0x2e')]({'where':{'type':_0x22ba12,'resourceId':_0x80c00b['id']}})[_0xd439('0x2b')](function(){return _0x5da4c1;});})[_0xd439('0x2b')](function(){_0x5e6484['status'](0xcc)[_0xd439('0x21')]();});}};}function handleEntityNotFound(_0x25e4e7){return function(_0x5e3ccb){if(!_0x5e3ccb){_0x25e4e7[_0xd439('0x20')](0x194);}return _0x5e3ccb;};}function handleError(_0x477bd7,_0x4e154f){_0x4e154f=_0x4e154f||0x1f4;return function(_0x492863){logger['error'](_0x492863[_0xd439('0x39')]);if(_0x492863['name']){delete _0x492863[_0xd439('0x3a')];}_0x477bd7[_0xd439('0x22')](_0x4e154f)[_0xd439('0x3b')](_0x492863);};}exports[_0xd439('0x3c')]=function(_0x4f9359,_0xfd8320){var _0x112061={},_0x10a6f0={'count':0x0,'rows':[]};var _0x54d8a8=_(db[_0xd439('0x3d')][_0xd439('0x3e')])['map'](function(_0xe17319){return{'name':_0xe17319[_0xd439('0x3f')],'type':_0xe17319[_0xd439('0x40')][_0xd439('0x41')]};})[_0xd439('0x42')](function(_0x3b728d){return!_[_0xd439('0x36')]([_0xd439('0x43'),_0xd439('0x44')],_0x3b728d[_0xd439('0x3a')]);})['value']();_0x112061=qs['getOptions'](_0x54d8a8,_0x4f9359);var _0x258ba5={'where':_0x112061[_0xd439('0x45')]};return db[_0xd439('0x3d')][_0xd439('0x26')](_0x258ba5)[_0xd439('0x2b')](function(_0x534e0a){_0x10a6f0[_0xd439('0x26')]=_0x534e0a;if(_0x4f9359['query']['includeAll']){_0x112061[_0xd439('0x46')]=[{'all':!![]}];}if(_0x4f9359[_0xd439('0x47')][_0xd439('0x48')]===_0xd439('0x49')){_0x112061[_0xd439('0x46')]=[{'model':db[_0xd439('0x4a')],'as':_0xd439('0x48')}];}if(!_[_0xd439('0x36')](_0x112061['attributes'],'id')){_0x112061[_0xd439('0x4b')][_0xd439('0x4c')]('id');}return db[_0xd439('0x3d')][_0xd439('0x4d')](_0x112061);})[_0xd439('0x2b')](function(_0x21ed1a){_0x10a6f0['rows']=_0x21ed1a;if(_0x4f9359[_0xd439('0x47')]['openTabs']==='true'){var _0x4544ad=[];for(var _0x583047=0x0;_0x583047<_0x10a6f0['rows'][_0xd439('0x4e')];_0x583047++){_0x4544ad[_0xd439('0x4c')](get_open_tabs(_0xd439('0x4f'),_0x10a6f0['rows'][_0x583047][_0xd439('0x50')]));_0x4544ad[_0xd439('0x4c')](get_open_tabs(_0xd439('0x51'),_0x10a6f0[_0xd439('0x52')][_0x583047][_0xd439('0x50')]));_0x4544ad[_0xd439('0x4c')](get_open_tabs(_0xd439('0x53'),_0x10a6f0[_0xd439('0x52')][_0x583047]['dataValues']));_0x4544ad[_0xd439('0x4c')](get_open_tabs('mail',_0x10a6f0[_0xd439('0x52')][_0x583047]['dataValues']));_0x4544ad[_0xd439('0x4c')](get_open_tabs('openchannel',_0x10a6f0[_0xd439('0x52')][_0x583047][_0xd439('0x50')]));_0x4544ad[_0xd439('0x4c')](get_open_tabs('whatsapp',_0x10a6f0[_0xd439('0x52')][_0x583047][_0xd439('0x50')]));}return Promise[_0xd439('0x54')](_0x4544ad)[_0xd439('0x2b')](function(){return _0x10a6f0;});}else{return _0x10a6f0;}})[_0xd439('0x2b')](respondWithFilteredResult(_0xfd8320,_0x112061))[_0xd439('0x55')](handleError(_0xfd8320,null));};exports[_0xd439('0x56')]=function(_0x46a3c0,_0x343137){var _0x37c0ac={'raw':![],'where':{'id':_0x46a3c0[_0xd439('0x57')]['id']}},_0x38107a={};_0x38107a[_0xd439('0x58')]=_[_0xd439('0x59')](_['keys'](db[_0xd439('0x3d')][_0xd439('0x3e')]),['password',_0xd439('0x44')]);_0x38107a[_0xd439('0x47')]=_[_0xd439('0x5a')](_0x46a3c0['query']);_0x38107a[_0xd439('0x5b')]=_[_0xd439('0x5c')](_0x38107a[_0xd439('0x58')],_0x38107a[_0xd439('0x47')]);_0x37c0ac[_0xd439('0x4b')]=_[_0xd439('0x5c')](_0x38107a[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x46a3c0[_0xd439('0x47')]['fields']));_0x37c0ac[_0xd439('0x4b')]=_0x37c0ac[_0xd439('0x4b')][_0xd439('0x4e')]?_0x37c0ac[_0xd439('0x4b')]:_0x38107a[_0xd439('0x58')];if(_0x46a3c0['query'][_0xd439('0x5e')]){_0x37c0ac['include']=[{'all':!![]}];}if(_0x46a3c0['query'][_0xd439('0x48')]===_0xd439('0x49')){_0x37c0ac['include']=[{'model':db[_0xd439('0x4a')],'as':_0xd439('0x48')}];}_0x37c0ac=_['merge']({},_0x37c0ac,_0x46a3c0[_0xd439('0x5f')]);if(!_[_0xd439('0x36')](_0x37c0ac[_0xd439('0x4b')],'id')){_0x37c0ac[_0xd439('0x4b')][_0xd439('0x4c')]('id');}return db['User'][_0xd439('0x60')](_0x37c0ac)['then'](handleEntityNotFound(_0x343137,null))[_0xd439('0x2b')](function(_0x323c96){var _0x59f2ff=[];values=_0x323c96;if(_0x46a3c0[_0xd439('0x47')][_0xd439('0x61')]===_0xd439('0x49')){_0x59f2ff['push'](get_open_tabs(_0xd439('0x4f'),_0x323c96['dataValues']));_0x59f2ff[_0xd439('0x4c')](get_open_tabs(_0xd439('0x51'),_0x323c96[_0xd439('0x50')]));_0x59f2ff['push'](get_open_tabs(_0xd439('0x62'),_0x323c96[_0xd439('0x50')]));_0x59f2ff[_0xd439('0x4c')](get_open_tabs(_0xd439('0x63'),_0x323c96['dataValues']));_0x59f2ff[_0xd439('0x4c')](get_open_tabs(_0xd439('0x53'),_0x323c96[_0xd439('0x50')]));_0x59f2ff[_0xd439('0x4c')](get_open_tabs(_0xd439('0x64'),_0x323c96[_0xd439('0x50')]));return Promise[_0xd439('0x54')](_0x59f2ff);}else{return values;}})[_0xd439('0x2b')](function(){return values;})[_0xd439('0x2b')](respondWithResult(_0x343137,null))[_0xd439('0x55')](handleError(_0x343137,null));};exports['update']=function(_0x15ba10,_0x5445f0){if(_0x15ba10[_0xd439('0x65')]['id']){delete _0x15ba10[_0xd439('0x65')]['id'];}delete _0x15ba10['body']['role'];return db[_0xd439('0x3d')][_0xd439('0x60')]({'where':{'id':_0x15ba10['params']['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x5445f0,null))['then'](saveUpdates(_0x15ba10[_0xd439('0x65')],null))['then'](respondWithResult(_0x5445f0,null))[_0xd439('0x55')](handleError(_0x5445f0,null));};exports[_0xd439('0x66')]=function(_0x890d94,_0x1a04c0){return db[_0xd439('0x3d')][_0xd439('0x66')]()[_0xd439('0x2b')](respondWithResult(_0x1a04c0,null))[_0xd439('0x55')](handleError(_0x1a04c0,null));};exports[_0xd439('0x67')]=function(_0x1ebffb,_0x1b18fc){return db[_0xd439('0x3d')]['find']({'where':{'id':_0x1ebffb['params']['id']}})['then'](handleEntityNotFound(_0x1b18fc,null))['then'](function(_0xf04046){if(_0xf04046){return _0xf04046[_0xd439('0x67')](_0x1ebffb[_0xd439('0x65')][_0xd439('0x68')],_[_0xd439('0x69')](_0x1ebffb[_0xd439('0x65')],[_0xd439('0x68'),'id'])||{});}})[_0xd439('0x2b')](respondWithResult(_0x1b18fc,null))[_0xd439('0x55')](handleError(_0x1b18fc,null));};function validateUser(_0x4ffd5d){return new Promise(function(_0x4776fe,_0x3997cd){if(_0x4ffd5d[_0xd439('0x6a')])return _0x4776fe(_0x4ffd5d);return db['Setting'][_0xd439('0x6b')](0x1)['then'](function(_0x20f7e7){if(_0x20f7e7[_0xd439('0x6c')])authService[_0xd439('0x6d')](_0x4ffd5d[_0xd439('0x43')]);db[_0xd439('0x3d')][_0xd439('0x6e')](_0xd439('0x6a'))['then'](function(_0x4d0080){if(_[_0xd439('0x6f')](_0x4d0080)){_0x4ffd5d[_0xd439('0x6a')]=_0x20f7e7[_0xd439('0x70')]||0x1;return;}if(_[_0xd439('0x6f')](_0x20f7e7[_0xd439('0x70')])||_0x20f7e7[_0xd439('0x70')]===_0x4d0080){_0x4ffd5d[_0xd439('0x6a')]=_0x4d0080+0x1;return;}if(_0x20f7e7['min_internal']>_0x4d0080){_0x4ffd5d[_0xd439('0x6a')]=_0x20f7e7[_0xd439('0x70')];return;}return db[_0xd439('0x71')][_0xd439('0x47')](_0xd439('0x72'),{'type':db[_0xd439('0x71')][_0xd439('0x73')]['SELECT']})[_0xd439('0x2b')](function(_0x28c0f0){if(_0x28c0f0&&_0x28c0f0[_0xd439('0x4e')]){for(var _0x2e9098=0x0,_0x1708eb=_0x28c0f0[_0xd439('0x4e')];_0x2e9098<_0x1708eb&&_[_0xd439('0x6f')](_0x4ffd5d[_0xd439('0x6a')]);_0x2e9098++){if(_0x20f7e7[_0xd439('0x70')]<=_0x28c0f0[_0x2e9098][_0xd439('0x74')]){_0x4ffd5d['internal']=_0x28c0f0[_0x2e9098]['from'];}else if(_0x20f7e7['min_internal']>_0x28c0f0[_0x2e9098][_0xd439('0x74')]&&_0x20f7e7['min_internal']<=_0x28c0f0[_0x2e9098]['to']){_0x4ffd5d['internal']=_0x20f7e7[_0xd439('0x70')];}}}if(_[_0xd439('0x6f')](_0x4ffd5d[_0xd439('0x6a')])){_0x4ffd5d['internal']=_0x4d0080+0x1;}return _0x4776fe(_0x4ffd5d);});});})[_0xd439('0x55')](function(_0x40b310){_0x3997cd(_0x40b310);});});}function updateUser(_0x178ac3){return new Promise(function(_0x106143,_0x449928){try{if(_0x178ac3[_0xd439('0x75')]){_0x178ac3[_0xd439('0x76')]=_0x178ac3['internal'];_0x178ac3[_0xd439('0x77')]={'mailbox':_0x178ac3[_0xd439('0x6a')],'password':_0x178ac3[_0xd439('0x43')],'fullname':_0x178ac3[_0xd439('0x78')],'email':_0x178ac3[_0xd439('0x79')]};}if(_0x178ac3[_0xd439('0x2c')]===_0xd439('0x31')){if(!_0x178ac3[_0xd439('0x7a')])_0x178ac3[_0xd439('0x7a')]=[_0xd439('0x7b'),_0xd439('0x7c'),_0xd439('0x7d'),'113',_0xd439('0x7e'),_0xd439('0x7f'),'105',_0xd439('0x80'),_0xd439('0x81'),_0xd439('0x82'),'109',_0xd439('0x83'),_0xd439('0x84'),_0xd439('0x85'),'115'];}_0x106143(_0x178ac3);}catch(_0x42c298){_0x449928(_0x42c298);}});}exports[_0xd439('0x86')]=function(_0x129475,_0xa70329){if(_0x129475[_0xd439('0x30')][_0xd439('0x2c')]===_0xd439('0x31'))throw new Error(_0xd439('0x87'));if(_0x129475[_0xd439('0x65')]['role']===_0xd439('0x30')&&_0x129475[_0xd439('0x30')][_0xd439('0x2c')]!==_0xd439('0x88')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x129475[_0xd439('0x65')][_0xd439('0x2c')]===_0xd439('0x88')&&_0x129475[_0xd439('0x30')][_0xd439('0x2c')]!=='admin'){throw new Error(_0xd439('0x89'));}return licenseUtil[_0xd439('0x8a')]([_0x129475[_0xd439('0x65')]])['then'](function(){return validateUser(_0x129475[_0xd439('0x65')]);})[_0xd439('0x2b')](function(_0x5d57b2){return updateUser(_0x5d57b2)['then'](function(_0x409623){if(_0x409623[_0xd439('0x2c')]===_0xd439('0x88')){_0x409623[_0xd439('0x8b')]=_0x129475[_0xd439('0x30')][_0xd439('0x8b')];delete _0x409623[_0xd439('0x8c')];}return _0x409623;});})[_0xd439('0x2b')](function(_0x2e2cdd){return db[_0xd439('0x3d')][_0xd439('0x86')](_0x2e2cdd,{'include':[{'model':db[_0xd439('0x77')],'as':_0xd439('0x77')}]});})[_0xd439('0x2b')](function(_0x5979a7){if(_0x129475[_0xd439('0x65')]['role']===_0xd439('0x30'))return _0x5979a7;if(_0x129475[_0xd439('0x30')][_0xd439('0x2c')]!==_0xd439('0x30'))return _0x5979a7;return db['UserProfileSection'][_0xd439('0x60')]({'where':{'name':_0x5979a7[_0xd439('0x2c')]===_0xd439('0x31')?_0xd439('0x8d'):_0xd439('0x32'),'userProfileId':_0x129475['user'][_0xd439('0x8c')]},'raw':!![]})[_0xd439('0x2b')](function(_0x44449e){if(!_0x44449e||_0x44449e[_0xd439('0x8e')]!=0x0)return _0x5979a7;return db['UserProfileResource'][_0xd439('0x86')]({'name':_0x5979a7[_0xd439('0x3a')],'resourceId':_0x5979a7['id'],'type':_0x44449e[_0xd439('0x3a')],'sectionId':_0x44449e['id']},{})[_0xd439('0x2b')](function(){return _0x5979a7;});})[_0xd439('0x55')](function(_0x50b911){logger['error'](_0xd439('0x8f'),_0x50b911);throw _0x50b911;});})[_0xd439('0x2b')](respondWithResult(_0xa70329,0xc9))[_0xd439('0x55')](handleError(_0xa70329,null));};exports['bulkCreate']=function(_0x1613d7,_0x5a784a){var _0x1e3aa4=_0x1613d7[_0xd439('0x65')];var _0x3855a0=[];if(_0x1613d7[_0xd439('0x30')]['role']===_0xd439('0x31'))throw new Error(_0xd439('0x87'));if(_[_0xd439('0x90')](_0x1e3aa4,[_0xd439('0x2c'),_0xd439('0x30')])&&_0x1613d7[_0xd439('0x30')][_0xd439('0x2c')]!=='admin'){throw new Error(_0xd439('0x91'));}if(_['some'](_0x1e3aa4,['role','admin'])&&_0x1613d7['user'][_0xd439('0x2c')]!=='admin'){throw new Error(_0xd439('0x92'));}return licenseUtil[_0xd439('0x8a')](_0x1e3aa4)[_0xd439('0x2b')](function(){return validateUser(_0x1e3aa4[0x0]);})[_0xd439('0x2b')](function(){for(var _0x1b004d=0x1;_0x1b004d<_0x1e3aa4[_0xd439('0x4e')];_0x1b004d++){var _0xc38e95=_0x1e3aa4[_0x1b004d-0x1][_0xd439('0x6a')];if(!_0x1e3aa4[_0x1b004d][_0xd439('0x6a')])_0x1e3aa4[_0x1b004d]['internal']=_0xc38e95+0x1;_0x3855a0['push'](validateUser(_0x1e3aa4[_0x1b004d]));}return Promise['all'](_0x3855a0);})['then'](function(){_0x3855a0=[];for(var _0x57aa7e=0x0;_0x57aa7e<_0x1e3aa4[_0xd439('0x4e')];_0x57aa7e++){_0x3855a0[_0xd439('0x4c')](updateUser(_0x1e3aa4[_0x57aa7e]));}return Promise[_0xd439('0x54')](_0x3855a0);})[_0xd439('0x2b')](function(){_0x3855a0=_0x1e3aa4[_0xd439('0x35')](function(_0x29d268){return db['User'][_0xd439('0x86')](_0x29d268,{'include':[{'model':db[_0xd439('0x77')],'as':_0xd439('0x77')}]})[_0xd439('0x2b')](function(_0x47d1a1){_0x29d268['id']=_0x47d1a1['id'];return _0x29d268;});});return Promise[_0xd439('0x54')](_0x3855a0);})[_0xd439('0x2b')](function(_0x38b115){if(_0x1613d7['body'][_0xd439('0x2c')]==='user')return _0x38b115;if(_0x1613d7[_0xd439('0x30')][_0xd439('0x2c')]!==_0xd439('0x30'))return _0x38b115;var _0x69e006=_[_0xd439('0x90')](_0x38b115,function(_0x3f8e32){return _0x3f8e32[_0xd439('0x2c')]==='agent'||_0x3f8e32[_0xd439('0x2c')]===_0xd439('0x33');});if(!_0x69e006)return _0x38b115;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0xd439('0x8d'),_0xd439('0x32')]},'userProfileId':_0x1613d7[_0xd439('0x30')][_0xd439('0x8c')]},'raw':!![]})['then'](function(_0x5a95e0){if(_['isEmpty'](_0x5a95e0)||!_['some'](_0x5a95e0,[_0xd439('0x8e'),0x0]))return _0x38b115;_0x3855a0=[];var _0x1cb77a=_(_0x5a95e0)[_0xd439('0x35')](function(_0x79ed86){if(_0x79ed86[_0xd439('0x8e')]===0x1)return;return _0x79ed86[_0xd439('0x3a')]===_0xd439('0x8d')?'agent':_0xd439('0x33');})['compact']()[_0xd439('0x37')]();for(var _0x2ba96a=0x0;_0x2ba96a<_0x38b115['length'];_0x2ba96a++){if(!_[_0xd439('0x36')](_0x1cb77a,_0x38b115[_0x2ba96a][_0xd439('0x2c')]))return;var _0x39af89=_0x38b115[_0x2ba96a][_0xd439('0x2c')]===_0xd439('0x31')?_0xd439('0x8d'):'Telephones';_0x3855a0[_0xd439('0x4c')](db[_0xd439('0x38')][_0xd439('0x86')]({'name':_0x38b115[_0x2ba96a][_0xd439('0x3a')],'resourceId':_0x38b115[_0x2ba96a]['id'],'type':_0x39af89,'sectionId':_[_0xd439('0x60')](_0x5a95e0,[_0xd439('0x3a'),_0x39af89])['id']},{}));}return Promise[_0xd439('0x54')](_0x3855a0);});})['then'](respondWithResult(_0x5a784a,0xc9))[_0xd439('0x55')](handleError(_0x5a784a,null));};exports[_0xd439('0x93')]=function(_0x571f6f,_0x1f9b9c){if(_0x571f6f[_0xd439('0x65')]['id']){delete _0x571f6f[_0xd439('0x65')]['id'];}return db[_0xd439('0x3d')]['find']({'where':{'id':_0x571f6f['params']['id']}})[_0xd439('0x2b')](function(_0x402016){if(!_0x402016)return null;if(_0x402016['id']===_0x571f6f[_0xd439('0x30')]['id']){if(!_0x571f6f['body'][_0xd439('0x94')]||!_0x571f6f[_0xd439('0x65')][_0xd439('0x95')]){throw new db[(_0xd439('0x96'))][(_0xd439('0x97'))](_0xd439('0x98'));}if(!_0x402016[_0xd439('0x99')](_0x571f6f[_0xd439('0x65')]['oldPassword'])){throw new db[(_0xd439('0x96'))][(_0xd439('0x97'))](_0xd439('0x9a'));}if(_0x571f6f[_0xd439('0x65')][_0xd439('0x94')]===_0x571f6f[_0xd439('0x65')][_0xd439('0x95')]){throw new db[(_0xd439('0x96'))][(_0xd439('0x97'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x571f6f['user'][_0xd439('0x2c')]===_0xd439('0x88')){if(!_0x571f6f[_0xd439('0x65')]['newPassword']){throw new db['Sequelize'][(_0xd439('0x97'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x571f6f[_0xd439('0x30')][_0xd439('0x2c')]===_0xd439('0x30')){if(!_0x571f6f[_0xd439('0x65')][_0xd439('0x95')]){throw new db[(_0xd439('0x96'))]['ValidationError'](_0xd439('0x9b'));}if(_0x402016[_0xd439('0x2c')]!==_0xd439('0x31')){throw new db['Sequelize']['ValidationError'](_0xd439('0x87'));}}else{throw new db['Sequelize'][(_0xd439('0x97'))]('Unauthorized');}return _0x402016;})[_0xd439('0x2b')](handleEntityNotFound(_0x1f9b9c,null))[_0xd439('0x2b')](function(_0x1b7b65){return db[_0xd439('0x9c')][_0xd439('0x9d')]({'attributes':['id','securePassword',_0xd439('0x9e'),_0xd439('0x9f')]})['then'](function(_0x13f5f2){if(_0x13f5f2[_0xd439('0x6c')])authService['validatePasswordPattern'](_0x571f6f['body'][_0xd439('0x95')]);if(!_0x13f5f2[_0xd439('0x9e')]||!_0x1b7b65['previousPasswords'])return _0x1b7b65;authService[_0xd439('0xa0')](_0x571f6f[_0xd439('0x65')][_0xd439('0x95')],_0x1b7b65[_0xd439('0xa1')],_0x13f5f2[_0xd439('0x9f')]);return _0x1b7b65;})[_0xd439('0x2b')](saveUpdates({'password':_0x571f6f[_0xd439('0x65')][_0xd439('0x95')],'passwordResetAt':_0x571f6f['user']['id']==_0x571f6f['params']['id']?moment():null,'previousPasswords':authService[_0xd439('0xa2')](_0x571f6f['body'][_0xd439('0x95')],_0x1b7b65[_0xd439('0xa1')])},null));})[_0xd439('0x2b')](respondWithResult(_0x1f9b9c,null))[_0xd439('0x55')](handleError(_0x1f9b9c,null));};exports[_0xd439('0xa3')]=function(_0x518927,_0x46dbeb){var _0x1ac739=_0x518927['body'][_0xd439('0xa4')];return db[_0xd439('0x3d')][_0xd439('0x60')]({'where':{'id':_0x518927[_0xd439('0x57')]['id']},'attributes':['id',_0xd439('0x3a'),_0xd439('0x2c'),_0xd439('0xa5'),_0xd439('0xa6'),_0xd439('0xa7'),_0xd439('0xa8')]})[_0xd439('0x2b')](handleEntityNotFound(_0x46dbeb,null))['then'](function(_0xf5f4ca){if(_0xf5f4ca){if(!utils['isValidChannel'](_0x1ac739)){throw new db[(_0xd439('0x96'))][(_0xd439('0x97'))](_0xd439('0xa9'));}return _0xf5f4ca['add'+_['capitalize'](_0x1ac739[_0xd439('0xaa')]())+_0xd439('0xab')](_0x518927[_0xd439('0x65')]['ids'],{'penalty':_0x518927['body']['penalty']||0x0})[_0xd439('0xac')](function(_0x1a0540){for(var _0x22744f=0x0;_0x22744f<_0x518927['body'][_0xd439('0x68')][_0xd439('0x4e')];_0x22744f+=0x1){var _0x5e8df5={'UserId':Number(_0x518927[_0xd439('0x57')]['id'])};_0x5e8df5[_[_0xd439('0xad')](_0x1ac739['toLowerCase']())+_0xd439('0xae')]=Number(_0x518927[_0xd439('0x65')]['ids'][_0x22744f]);socket['emit']('user'+_[_0xd439('0xad')](_0x1ac739[_0xd439('0xaa')]())+'Queue:save',_0x5e8df5);}return _0x1a0540;})[_0xd439('0x2b')](function(){if(_0x1ac739==='voice'){return db[_0xd439('0xaf')][_0xd439('0x4d')]({'where':{'id':_0x518927[_0xd439('0x65')]['ids']||[]},'raw':!![],'attributes':['id',_0xd439('0x3a')]});}})[_0xd439('0x2b')](function(_0x26ee82){var _0x139988=_0xf5f4ca[_0xd439('0x2f')]({'plain':!![]});var _0x59795b=[];if(_0x1ac739==='voice'&&_0x139988[_0xd439('0x2c')]===_0xd439('0x31')&&_0x139988[_0xd439('0xa5')]){for(let _0x56a70b=0x0;_0x56a70b<_0x26ee82[_0xd439('0x4e')];_0x56a70b+=0x1){_0x59795b['push']({'membername':_0x139988[_0xd439('0x3a')],'UserId':_0x139988['id'],'queue_name':_0x26ee82[_0x56a70b]['name'],'VoiceQueueId':_0x26ee82[_0x56a70b]['id'],'interface':_[_0xd439('0x6f')](_0x139988['interface'])?util[_0xd439('0xb0')](_0xd439('0xb1'),_0x139988[_0xd439('0x3a')]):_0x139988['interface'],'paused':_0x139988[_0xd439('0xa7')]||![],'penalty':_0x518927[_0xd439('0x65')][_0xd439('0xb2')]||0x0});}return Promise[_0xd439('0x54')](_0x59795b['map'](function(_0x5ed7e3){return db['UserVoiceQueueRt'][_0xd439('0xb3')](_0x5ed7e3);}));}return _0xf5f4ca;});}})[_0xd439('0x2b')](respondWithStatusCode(_0x46dbeb,null))[_0xd439('0x55')](handleError(_0x46dbeb,null));};exports[_0xd439('0xb4')]=function(_0x543653,_0x267c52){var _0x55ff44,_0x3db4f2;return db[_0xd439('0x3d')][_0xd439('0x60')]({'where':{'id':_0x543653[_0xd439('0x57')]['id']},'attributes':['id','name',_0xd439('0x2c')]})['then'](handleEntityNotFound(_0x267c52,null))[_0xd439('0x2b')](function(_0x3636a4){if(_0x3636a4){_0x55ff44=_0x3636a4;if(!_0x543653[_0xd439('0x47')][_0xd439('0xa4')]||!utils['isValidChannel'](_0x543653[_0xd439('0x47')][_0xd439('0xa4')])){throw new db[(_0xd439('0x96'))][(_0xd439('0x97'))](_0xd439('0xa9'));}return _0x3636a4['remove'+_[_0xd439('0xad')](_0x543653[_0xd439('0x47')][_0xd439('0xa4')][_0xd439('0xaa')]())+_0xd439('0xab')](_0x543653[_0xd439('0x47')][_0xd439('0x68')]);}})[_0xd439('0x2b')](function(_0x441072){if(_[_0xd439('0xb5')](_0x543653[_0xd439('0x47')][_0xd439('0x68')])){for(var _0x558ddc=0x0;_0x558ddc<_0x543653[_0xd439('0x47')][_0xd439('0x68')][_0xd439('0x4e')];_0x558ddc+=0x1){_0x3db4f2={'UserId':Number(_0x543653['params']['id'])};_0x3db4f2[_[_0xd439('0xad')](_0x543653[_0xd439('0x47')][_0xd439('0xa4')][_0xd439('0xaa')]())+_0xd439('0xae')]=Number(_0x543653[_0xd439('0x47')][_0xd439('0x68')][_0x558ddc]);socket[_0xd439('0xb6')]('user'+_[_0xd439('0xad')](_0x543653[_0xd439('0x47')][_0xd439('0xa4')][_0xd439('0xaa')]())+_0xd439('0xb7'),_0x3db4f2);}}else{_0x3db4f2={'UserId':Number(_0x543653[_0xd439('0x57')]['id'])};_0x3db4f2[_[_0xd439('0xad')](_0x543653[_0xd439('0x47')][_0xd439('0xa4')][_0xd439('0xaa')]())+_0xd439('0xae')]=Number(_0x543653[_0xd439('0x47')][_0xd439('0x68')]);socket['emit'](_0xd439('0x30')+_['capitalize'](_0x543653[_0xd439('0x47')][_0xd439('0xa4')]['toLowerCase']())+_0xd439('0xb7'),_0x3db4f2);}return _0x441072;})['then'](function(){if(_0x543653['query'][_0xd439('0xa4')]===_0xd439('0xb8')){return db[_0xd439('0xb9')][_0xd439('0x2e')]({'where':{'UserId':_0x543653[_0xd439('0x57')]['id'],'VoiceQueueId':_0x543653[_0xd439('0x47')][_0xd439('0x68')]},'individualHooks':!![]})[_0xd439('0x2b')](function(){return _0x55ff44;});}return _0x55ff44;})[_0xd439('0x2b')](respondWithStatusCode(_0x267c52,null))[_0xd439('0x55')](handleError(_0x267c52,null));};exports[_0xd439('0xba')]=function(_0x5a3bdc,_0x2610da){_0x5a3bdc[_0xd439('0x65')][_0xd439('0xbb')]=_0x5a3bdc[_0xd439('0xbc')][_0xd439('0xbd')];return db[_0xd439('0x3d')]['find']({'where':{'id':_0x5a3bdc[_0xd439('0x57')]['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x2610da,null))['then'](saveUpdates(_0x5a3bdc[_0xd439('0x65')],null))['then'](respondWithResult(_0x2610da,null))[_0xd439('0x55')](handleError(_0x2610da,null));};exports[_0xd439('0xbe')]=function(_0x353046,_0x463783){var _0x4635a2=path[_0xd439('0xbf')](config[_0xd439('0xc0')],_0xd439('0xc1'));return db[_0xd439('0x3d')][_0xd439('0x60')]({'where':{'id':_0x353046['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xd439('0x2b')](handleEntityNotFound(_0x463783,null))['then'](function(_0x26bbc0){if(_0x26bbc0){if(_[_0xd439('0x6f')](_0x26bbc0['userpic'])){return _0x463783[_0xd439('0xc2')](_0x4635a2);}else{if(!fs['existsSync'](path['join'](config['root'],'server/files/images/',_0x26bbc0[_0xd439('0xbb')]))){return _0x463783[_0xd439('0xc2')](_0x4635a2);}return _0x463783[_0xd439('0xc2')](path['join'](config['root'],_0xd439('0xc3'),_0x26bbc0[_0xd439('0xbb')]));}}})[_0xd439('0x55')](handleError(_0x463783,null));};exports[_0xd439('0xc4')]=function(_0x23bcab,_0x5a7fbf){return db[_0xd439('0x3d')][_0xd439('0x60')]({'where':{'id':_0x23bcab[_0xd439('0x57')]['id']},'attributes':['id']})[_0xd439('0x2b')](handleEntityNotFound(_0x5a7fbf,null))['then'](function(_0xbac859){var _0x21348b=[];values=_0xbac859[_0xd439('0x50')];_0x21348b[_0xd439('0x4c')](get_open_tabs(_0xd439('0x4f'),_0xbac859['dataValues']));_0x21348b[_0xd439('0x4c')](get_open_tabs('sms',_0xbac859[_0xd439('0x50')]));_0x21348b['push'](get_open_tabs(_0xd439('0x62'),_0xbac859['dataValues']));_0x21348b[_0xd439('0x4c')](get_open_tabs(_0xd439('0x63'),_0xbac859[_0xd439('0x50')]));_0x21348b[_0xd439('0x4c')](get_open_tabs(_0xd439('0x53'),_0xbac859['dataValues']));_0x21348b['push'](get_open_tabs(_0xd439('0x64'),_0xbac859[_0xd439('0x50')]));return Promise[_0xd439('0x54')](_0x21348b);})[_0xd439('0x2b')](function(_0x2e84e7){if(_0x2e84e7){var _0x27b487=_[_0xd439('0x35')](values['ChatOpenTabs'],function(_0x428c50){return{'channel':_0xd439('0xc5'),'id':_0x428c50['id'],'createdAt':_0x428c50[_0xd439('0xc6')]};});var _0x2010b2=_[_0xd439('0x35')](values['FaxOpenTabs'],function(_0x5064a6){return{'channel':_0xd439('0xc7'),'id':_0x5064a6['id'],'createdAt':_0x5064a6[_0xd439('0xc6')]};});var _0x5bee0a=_[_0xd439('0x35')](values[_0xd439('0xc8')],function(_0x4ac754){return{'channel':'OPENCHANNEL','id':_0x4ac754['id'],'createdAt':_0x4ac754[_0xd439('0xc6')]};});var _0x266d6f=_[_0xd439('0x35')](values[_0xd439('0xc9')],function(_0x1cc1d4){return{'channel':'MAIL','id':_0x1cc1d4['id'],'createdAt':_0x1cc1d4['createdAt']};});var _0x4372bd=_[_0xd439('0x35')](values[_0xd439('0xca')],function(_0x17c649){return{'channel':_0xd439('0xcb'),'id':_0x17c649['id'],'createdAt':_0x17c649[_0xd439('0xc6')]};});var _0x100fed=_[_0xd439('0x35')](values[_0xd439('0xcc')],function(_0x2654e2){return{'channel':_0xd439('0xcd'),'id':_0x2654e2['id'],'createdAt':_0x2654e2[_0xd439('0xc6')]};});var _0xddbae4=_[_0xd439('0xce')](_0x27b487,_0x2010b2,_0x5bee0a,_0x266d6f,_0x4372bd,_0x100fed);var _0x4e8cb7={'count':_0xddbae4[_0xd439('0x4e')],'rows':_0xddbae4};return _0x4e8cb7;}else return null;})[_0xd439('0x2b')](respondWithResult(_0x5a7fbf,null))[_0xd439('0x55')](handleError(_0x5a7fbf,null));};exports[_0xd439('0xcf')]=function(_0x30ee55,_0x40e87b){var _0x32b4be={};return db[_0xd439('0x3d')][_0xd439('0x9d')]({'where':{'id':_0x30ee55[_0xd439('0x57')]['id']}})[_0xd439('0x2b')](function(_0x3a675c){if(!_0x3a675c){throw new APINotFoundError(util[_0xd439('0xb0')](_0xd439('0xd0'),_0x30ee55[_0xd439('0x57')]['id']));}return contacts[_0xd439('0x66')]();})[_0xd439('0x2b')](function(_0x2da812){_0x30ee55[_0xd439('0x47')]['User']=_0x30ee55['params']['id'];_0x32b4be=qs[_0xd439('0xd1')](_0x2da812,_0x30ee55);if(_0x30ee55[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0x5e'))){_0x32b4be['include']=[{'model':db[_0xd439('0xd3')],'as':_0xd439('0xd4'),'required':![]},{'model':db[_0xd439('0xd5')],'as':'Tags','attributes':['id','name',_0xd439('0xd6')],'where':_0x30ee55[_0xd439('0x47')]['tag']?{'id':_0x30ee55[_0xd439('0x47')][_0xd439('0xd7')]}:undefined,'required':_0x30ee55['query'][_0xd439('0xd7')]?!![]:![]}];}return contacts[_0xd439('0x4d')](_0x30ee55['query'],_0x30ee55[_0xd439('0x30')],_0x32b4be,_0x2da812);})[_0xd439('0x2b')](respondWithFilteredResult(_0x40e87b,_0x32b4be))[_0xd439('0x55')](APIHandleError(_0x40e87b));};exports[_0xd439('0xd8')]=function(_0x982a11,_0x100816){var _0x20d25d;var _0x36980d={};var _0x4a0087;return db['User'][_0xd439('0x9d')]({'where':{'id':_0x982a11['params']['id']},'attributes':['id',_0xd439('0x3a'),'role']})[_0xd439('0x2b')](handleEntityNotFound(_0x100816,null))[_0xd439('0x2b')](function(_0x9d84c6){if(!utils[_0xd439('0xd9')](_0x982a11['query'][_0xd439('0xa4')])){throw new db[(_0xd439('0x96'))][(_0xd439('0x97'))](_0xd439('0xa9'));}_0x20d25d=_0x9d84c6;var _0x439933={};_0x439933[_0xd439('0x58')]=_['keys'](db[_['capitalize'](_0x982a11[_0xd439('0x47')][_0xd439('0xa4')])+_0xd439('0xda')][_0xd439('0x3e')]);_0x439933[_0xd439('0x47')]=_[_0xd439('0x5a')](_0x982a11['query']);_0x439933[_0xd439('0x5b')]=_['intersection'](_0x439933[_0xd439('0x58')],_0x439933[_0xd439('0x47')]);_0x36980d[_0xd439('0x4b')]=_[_0xd439('0x5c')](_0x439933[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x982a11['query']['fields']));_0x36980d[_0xd439('0x4b')]=_0x36980d['attributes'][_0xd439('0x4e')]?_0x36980d[_0xd439('0x4b')]:_0x439933[_0xd439('0x58')];_0x36980d[_0xd439('0xdb')]=qs['sort'](_0x982a11[_0xd439('0x47')][_0xd439('0xdc')]);_0x36980d['where']=qs[_0xd439('0x5b')](_[_0xd439('0xdd')](_0x982a11[_0xd439('0x47')],_0x439933[_0xd439('0x5b')]));if(_0x982a11[_0xd439('0x47')][_0xd439('0x42')]){_0x36980d[_0xd439('0x45')]=_['merge'](_0x36980d[_0xd439('0x45')],{'$or':_[_0xd439('0x35')](_0x36980d['attributes'],function(_0x52145f){var _0x4be15d={};_0x4be15d[_0x52145f]={'$like':'%'+_0x982a11[_0xd439('0x47')][_0xd439('0x42')]+'%'};return _0x4be15d;})});}_0x36980d=_[_0xd439('0xde')]({},_0x36980d,_0x982a11[_0xd439('0x5f')]);switch(_0x20d25d['role']){case _0xd439('0x88'):return db[_['capitalize'](_0x982a11[_0xd439('0x47')][_0xd439('0xa4')])+'Queue'][_0xd439('0x4d')](_0x36980d);case'user':case'agent':return _0x20d25d[_0xd439('0x2f')+_[_0xd439('0xad')](_0x982a11['query'][_0xd439('0xa4')])+'Queues'](_0x36980d);default:throw new db['Sequelize']['ValidationError'](_0xd439('0xdf'));}})[_0xd439('0x2b')](function(_0x483ba9){_0x4a0087=_0x483ba9[_0xd439('0x4e')];if(!_0x982a11[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0xe0'))){_0x36980d[_0xd439('0x25')]=qs[_0xd439('0x25')](_0x982a11['query']['limit']);_0x36980d[_0xd439('0x27')]=qs[_0xd439('0x27')](_0x982a11[_0xd439('0x47')][_0xd439('0x27')]);}switch(_0x20d25d[_0xd439('0x2c')]){case _0xd439('0x88'):return db[_[_0xd439('0xad')](_0x982a11[_0xd439('0x47')][_0xd439('0xa4')])+_0xd439('0xda')][_0xd439('0x4d')](_0x36980d);case _0xd439('0x30'):case _0xd439('0x31'):return _0x20d25d[_0xd439('0x2f')+_[_0xd439('0xad')](_0x982a11[_0xd439('0x47')]['channel'])+_0xd439('0xab')](_0x36980d);}})[_0xd439('0x2b')](function(_0x49fbed){return{'count':_0x4a0087,'rows':_0x49fbed};})[_0xd439('0x2b')](respondWithResult(_0x100816,null))[_0xd439('0x55')](handleError(_0x100816,null));};exports[_0xd439('0xe1')]=function(_0x2fd36e,_0x5aa9d3){var _0x55d3af={};var _0x3bed6a={};var _0x496340;var _0x44a8d6;return db['User']['findOne']({'where':{'id':_0x2fd36e['params']['id']}})['then'](handleEntityNotFound(_0x5aa9d3,null))['then'](function(_0x1b15da){if(_0x1b15da){_0x496340=_0x1b15da;_0x3bed6a['model']=_[_0xd439('0x5a')](db[_0xd439('0xb9')][_0xd439('0x3e')]);_0x3bed6a[_0xd439('0x47')]=_['keys'](_0x2fd36e[_0xd439('0x47')]);_0x3bed6a['filters']=_[_0xd439('0x5c')](_0x3bed6a[_0xd439('0x58')],_0x3bed6a['query']);_0x55d3af[_0xd439('0x4b')]=_['intersection'](_0x3bed6a['model'],qs['fields'](_0x2fd36e[_0xd439('0x47')][_0xd439('0x5d')]));_0x55d3af[_0xd439('0x4b')]=_0x55d3af['attributes'][_0xd439('0x4e')]?_0x55d3af[_0xd439('0x4b')]:_0x3bed6a[_0xd439('0x58')];_0x55d3af[_0xd439('0xdb')]=qs[_0xd439('0xdc')](_0x2fd36e[_0xd439('0x47')][_0xd439('0xdc')]);_0x55d3af[_0xd439('0x45')]=qs[_0xd439('0x5b')](_[_0xd439('0xdd')](_0x2fd36e[_0xd439('0x47')],_0x3bed6a[_0xd439('0x5b')]));if(_0x2fd36e[_0xd439('0x47')]['filter']){_0x55d3af[_0xd439('0x45')]=_[_0xd439('0xde')](_0x55d3af['where'],{'$or':_[_0xd439('0x35')](_0x55d3af['attributes'],function(_0x3e426c){var _0xafc977={};_0xafc977[_0x3e426c]={'$like':'%'+_0x2fd36e[_0xd439('0x47')][_0xd439('0x42')]+'%'};return _0xafc977;})});}_0x55d3af=_[_0xd439('0xde')]({},_0x55d3af,_0x2fd36e[_0xd439('0x5f')]);return _0x496340[_0xd439('0xe1')](_0x55d3af);}})[_0xd439('0x2b')](function(_0x36fe00){if(_0x36fe00){_0x44a8d6=_0x36fe00[_0xd439('0x4e')];if(!_0x2fd36e[_0xd439('0x47')]['hasOwnProperty'](_0xd439('0xe0'))){_0x55d3af[_0xd439('0x25')]=qs['limit'](_0x2fd36e[_0xd439('0x47')]['limit']);_0x55d3af[_0xd439('0x27')]=qs[_0xd439('0x27')](_0x2fd36e[_0xd439('0x47')][_0xd439('0x27')]);}return _0x496340[_0xd439('0xe1')](_0x55d3af);}})['then'](function(_0x502012){if(_0x502012){return _0x502012?{'count':_0x44a8d6,'rows':_0x502012}:null;}})[_0xd439('0x2b')](respondWithResult(_0x5aa9d3,null))[_0xd439('0x55')](handleError(_0x5aa9d3,null));};exports[_0xd439('0xe2')]=function(_0x24d68c,_0x24f7a0){var _0x50c2ec={};var _0x1c76c2={};var _0x1b9d08;var _0x2b98b4;return db[_0xd439('0x3d')][_0xd439('0x9d')]({'where':{'id':_0x24d68c['params']['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x24f7a0,null))[_0xd439('0x2b')](function(_0x1f8554){if(_0x1f8554){_0x1b9d08=_0x1f8554;_0x1c76c2[_0xd439('0x58')]=_['keys'](db[_0xd439('0xe3')][_0xd439('0x3e')]);_0x1c76c2[_0xd439('0x47')]=_[_0xd439('0x5a')](_0x24d68c[_0xd439('0x47')]);_0x1c76c2[_0xd439('0x5b')]=_[_0xd439('0x5c')](_0x1c76c2[_0xd439('0x58')],_0x1c76c2[_0xd439('0x47')]);_0x50c2ec[_0xd439('0x4b')]=_[_0xd439('0x5c')](_0x1c76c2[_0xd439('0x58')],qs['fields'](_0x24d68c['query'][_0xd439('0x5d')]));_0x50c2ec[_0xd439('0x4b')]=_0x50c2ec[_0xd439('0x4b')][_0xd439('0x4e')]?_0x50c2ec[_0xd439('0x4b')]:_0x1c76c2[_0xd439('0x58')];_0x50c2ec[_0xd439('0xdb')]=qs[_0xd439('0xdc')](_0x24d68c[_0xd439('0x47')][_0xd439('0xdc')]);_0x50c2ec[_0xd439('0x45')]=qs[_0xd439('0x5b')](_[_0xd439('0xdd')](_0x24d68c[_0xd439('0x47')],_0x1c76c2[_0xd439('0x5b')]));if(_0x24d68c[_0xd439('0x47')][_0xd439('0x42')]){_0x50c2ec[_0xd439('0x45')]=_[_0xd439('0xde')](_0x50c2ec[_0xd439('0x45')],{'$or':_[_0xd439('0x35')](_0x50c2ec[_0xd439('0x4b')],function(_0x2041e5){var _0x416689={};_0x416689[_0x2041e5]={'$like':'%'+_0x24d68c[_0xd439('0x47')]['filter']+'%'};return _0x416689;})});}_0x50c2ec=_[_0xd439('0xde')]({},_0x50c2ec,_0x24d68c['options']);return _0x1b9d08[_0xd439('0xe2')](_0x50c2ec);}})[_0xd439('0x2b')](function(_0x5c1bce){if(_0x5c1bce){_0x2b98b4=_0x5c1bce[_0xd439('0x4e')];if(!_0x24d68c[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0xe0'))){_0x50c2ec[_0xd439('0x25')]=qs[_0xd439('0x25')](_0x24d68c[_0xd439('0x47')][_0xd439('0x25')]);_0x50c2ec[_0xd439('0x27')]=qs['offset'](_0x24d68c[_0xd439('0x47')][_0xd439('0x27')]);}return _0x1b9d08[_0xd439('0xe2')](_0x50c2ec);}})[_0xd439('0x2b')](function(_0x2873a1){if(_0x2873a1){return _0x2873a1?{'count':_0x2b98b4,'rows':_0x2873a1}:null;}})[_0xd439('0x2b')](respondWithResult(_0x24f7a0,null))[_0xd439('0x55')](handleError(_0x24f7a0,null));};exports['getRecordings']=function(_0x173c32,_0x2bc982){var _0x240a19={'raw':!![],'where':{}};var _0x139faa={};var _0x225654={'count':0x0,'rows':[]};return db['User'][_0xd439('0x9d')]({'where':{'id':_0x173c32['params']['id']}})['then'](handleEntityNotFound(_0x2bc982,null))[_0xd439('0x2b')](function(_0x51a36d){if(_0x51a36d){_0x139faa[_0xd439('0x58')]=_[_0xd439('0x5a')](db['VoiceRecording'][_0xd439('0x3e')]);_0x139faa['query']=_[_0xd439('0x5a')](_0x173c32['query']);_0x139faa[_0xd439('0x5b')]=_[_0xd439('0x5c')](_0x139faa['model'],_0x139faa[_0xd439('0x47')]);_0x240a19['attributes']=_[_0xd439('0x5c')](_0x139faa[_0xd439('0x58')],qs['fields'](_0x173c32['query'][_0xd439('0x5d')]));_0x240a19[_0xd439('0x4b')]=_0x240a19[_0xd439('0x4b')]['length']?_0x240a19[_0xd439('0x4b')]:_0x139faa[_0xd439('0x58')];if(!_0x173c32[_0xd439('0x47')][_0xd439('0xd2')]('nolimit')){_0x240a19[_0xd439('0x25')]=qs[_0xd439('0x25')](_0x173c32[_0xd439('0x47')][_0xd439('0x25')]);_0x240a19[_0xd439('0x27')]=qs[_0xd439('0x27')](_0x173c32[_0xd439('0x47')][_0xd439('0x27')]);}_0x240a19[_0xd439('0xdb')]=qs[_0xd439('0xdc')](_0x173c32[_0xd439('0x47')]['sort']);_0x240a19[_0xd439('0x45')]=qs['filters'](_[_0xd439('0xdd')](_0x173c32[_0xd439('0x47')],_0x139faa['filters']));_0x240a19[_0xd439('0x45')][_0xd439('0xe4')]=_0x51a36d['id'];if(_0x173c32['query']['filter']){_0x240a19[_0xd439('0x45')]=_['merge'](_0x240a19[_0xd439('0x45')],{'$or':_[_0xd439('0x35')](_0x240a19['attributes'],function(_0x110f65){var _0xaf696c={};_0xaf696c[_0x110f65]={'$like':'%'+_0x173c32[_0xd439('0x47')][_0xd439('0x42')]+'%'};return _0xaf696c;})});}_0x240a19=_[_0xd439('0xde')]({},_0x240a19,_0x173c32['options']);return db['VoiceRecording'][_0xd439('0x26')]({'where':_0x240a19[_0xd439('0x45')]})['then'](function(_0x54cfc7){_0x225654['count']=_0x54cfc7;if(_0x173c32['query']['includeAll']){_0x240a19['include']=[{'all':!![]}];}return db[_0xd439('0xe5')][_0xd439('0x4d')](_0x240a19);})[_0xd439('0x2b')](function(_0x5ed151){_0x225654[_0xd439('0x52')]=_0x5ed151;return _0x225654;});}})['then'](respondWithFilteredResult(_0x2bc982,_0x240a19))[_0xd439('0x55')](handleError(_0x2bc982,null));};exports[_0xd439('0xe6')]=function(_0x2f6936,_0x2a511c){var _0x49e8d4={'raw':!![],'where':{}};var _0x961af9={};var _0x4f254c={'count':0x0,'rows':[]};return db[_0xd439('0x3d')][_0xd439('0x9d')]({'where':{'id':_0x2f6936[_0xd439('0x57')]['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x2a511c,null))[_0xd439('0x2b')](function(_0x535014){if(_0x535014){_0x961af9[_0xd439('0x58')]=_['keys'](db[_0xd439('0xe7')][_0xd439('0x3e')]);_0x961af9['query']=_[_0xd439('0x5a')](_0x2f6936[_0xd439('0x47')]);_0x961af9[_0xd439('0x5b')]=_[_0xd439('0x5c')](_0x961af9[_0xd439('0x58')],_0x961af9[_0xd439('0x47')]);_0x49e8d4[_0xd439('0x4b')]=_[_0xd439('0x5c')](_0x961af9['model'],qs[_0xd439('0x5d')](_0x2f6936[_0xd439('0x47')][_0xd439('0x5d')]));_0x49e8d4[_0xd439('0x4b')]=_0x49e8d4[_0xd439('0x4b')][_0xd439('0x4e')]?_0x49e8d4[_0xd439('0x4b')]:_0x961af9[_0xd439('0x58')];if(!_0x2f6936[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0xe0'))){_0x49e8d4['limit']=qs[_0xd439('0x25')](_0x2f6936[_0xd439('0x47')][_0xd439('0x25')]);_0x49e8d4[_0xd439('0x27')]=qs[_0xd439('0x27')](_0x2f6936[_0xd439('0x47')]['offset']);}_0x49e8d4['order']=qs[_0xd439('0xdc')](_0x2f6936[_0xd439('0x47')]['sort']);_0x49e8d4[_0xd439('0x45')]=qs[_0xd439('0x5b')](_[_0xd439('0xdd')](_0x2f6936[_0xd439('0x47')],_0x961af9[_0xd439('0x5b')]));_0x49e8d4['where'][_0xd439('0xe4')]=_0x535014['id'];if(_0x2f6936[_0xd439('0x47')][_0xd439('0x42')]){_0x49e8d4[_0xd439('0x45')]=_['merge'](_0x49e8d4[_0xd439('0x45')],{'$or':_[_0xd439('0x35')](_0x49e8d4[_0xd439('0x4b')],function(_0x9d618d){var _0x2da197={};_0x2da197[_0x9d618d]={'$like':'%'+_0x2f6936['query'][_0xd439('0x42')]+'%'};return _0x2da197;})});}_0x49e8d4=_[_0xd439('0xde')]({},_0x49e8d4,_0x2f6936[_0xd439('0x5f')]);return db[_0xd439('0xe7')][_0xd439('0x26')]({'where':_0x49e8d4[_0xd439('0x45')]})['then'](function(_0x487033){_0x4f254c[_0xd439('0x26')]=_0x487033;if(_0x2f6936[_0xd439('0x47')]['includeAll']){_0x49e8d4['include']=[{'all':!![]}];}return db[_0xd439('0xe7')][_0xd439('0x4d')](_0x49e8d4);})['then'](function(_0x141b32){_0x4f254c[_0xd439('0x52')]=_0x141b32;return _0x4f254c;});}})[_0xd439('0x2b')](respondWithFilteredResult(_0x2a511c,_0x49e8d4))['catch'](handleError(_0x2a511c,null));};exports[_0xd439('0xe8')]=function(_0x928c86,_0x566403){var _0x301516={};var _0x3b6c08={};var _0x258081;var _0x45ccd1;return db['User'][_0xd439('0x9d')]({'where':{'id':_0x928c86[_0xd439('0x57')]['id']}})['then'](handleEntityNotFound(_0x566403,null))[_0xd439('0x2b')](function(_0x51ca05){if(_0x51ca05){_0x258081=_0x51ca05;_0x3b6c08['model']=_['keys'](db[_0xd439('0xe9')][_0xd439('0x3e')]);_0x3b6c08[_0xd439('0x47')]=_[_0xd439('0x5a')](_0x928c86[_0xd439('0x47')]);_0x3b6c08['filters']=_[_0xd439('0x5c')](_0x3b6c08[_0xd439('0x58')],_0x3b6c08['query']);_0x301516['attributes']=_[_0xd439('0x5c')](_0x3b6c08[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x928c86[_0xd439('0x47')]['fields']));_0x301516['attributes']=_0x301516['attributes']['length']?_0x301516[_0xd439('0x4b')]:_0x3b6c08[_0xd439('0x58')];_0x301516[_0xd439('0xdb')]=qs[_0xd439('0xdc')](_0x928c86[_0xd439('0x47')][_0xd439('0xdc')]);_0x301516[_0xd439('0x45')]=qs[_0xd439('0x5b')](_['pick'](_0x928c86[_0xd439('0x47')],_0x3b6c08['filters']));if(_0x928c86['query'][_0xd439('0x42')]){_0x301516[_0xd439('0x45')]=_['merge'](_0x301516[_0xd439('0x45')],{'$or':_[_0xd439('0x35')](_0x301516['attributes'],function(_0x3a8449){var _0x489789={};_0x489789[_0x3a8449]={'$like':'%'+_0x928c86[_0xd439('0x47')][_0xd439('0x42')]+'%'};return _0x489789;})});}_0x301516=_[_0xd439('0xde')]({},_0x301516,_0x928c86[_0xd439('0x5f')]);return _0x258081['getChatInteractions'](_0x301516);}})['then'](function(_0x1f161e){if(_0x1f161e){_0x45ccd1=_0x1f161e['length'];if(!_0x928c86[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0xe0'))){_0x301516[_0xd439('0x25')]=qs[_0xd439('0x25')](_0x928c86['query'][_0xd439('0x25')]);_0x301516[_0xd439('0x27')]=qs[_0xd439('0x27')](_0x928c86['query']['offset']);}return _0x258081[_0xd439('0xe8')](_0x301516);}})[_0xd439('0x2b')](function(_0x49178d){if(_0x49178d){return _0x49178d?{'count':_0x45ccd1,'rows':_0x49178d}:null;}})[_0xd439('0x2b')](respondWithResult(_0x566403,null))[_0xd439('0x55')](handleError(_0x566403,null));};exports[_0xd439('0xea')]=function(_0x421bcb,_0x3c175a){var _0xfd9cfb={};var _0x5f2750={};var _0x326e17;var _0x3645d5;return db[_0xd439('0x3d')][_0xd439('0x9d')]({'where':{'id':_0x421bcb['params']['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x3c175a,null))['then'](function(_0x50e958){if(_0x50e958){_0x326e17=_0x50e958;_0x5f2750[_0xd439('0x58')]=_[_0xd439('0x5a')](db['OpenchannelInteraction'][_0xd439('0x3e')]);_0x5f2750[_0xd439('0x47')]=_[_0xd439('0x5a')](_0x421bcb['query']);_0x5f2750['filters']=_[_0xd439('0x5c')](_0x5f2750[_0xd439('0x58')],_0x5f2750['query']);_0xfd9cfb[_0xd439('0x4b')]=_[_0xd439('0x5c')](_0x5f2750[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x421bcb['query']['fields']));_0xfd9cfb['attributes']=_0xfd9cfb[_0xd439('0x4b')][_0xd439('0x4e')]?_0xfd9cfb['attributes']:_0x5f2750['model'];_0xfd9cfb[_0xd439('0xdb')]=qs[_0xd439('0xdc')](_0x421bcb[_0xd439('0x47')][_0xd439('0xdc')]);_0xfd9cfb[_0xd439('0x45')]=qs['filters'](_[_0xd439('0xdd')](_0x421bcb['query'],_0x5f2750[_0xd439('0x5b')]));if(_0x421bcb['query'][_0xd439('0x42')]){_0xfd9cfb[_0xd439('0x45')]=_[_0xd439('0xde')](_0xfd9cfb[_0xd439('0x45')],{'$or':_['map'](_0xfd9cfb['attributes'],function(_0x2fdc35){var _0x781a1d={};_0x781a1d[_0x2fdc35]={'$like':'%'+_0x421bcb[_0xd439('0x47')][_0xd439('0x42')]+'%'};return _0x781a1d;})});}_0xfd9cfb=_['merge']({},_0xfd9cfb,_0x421bcb[_0xd439('0x5f')]);return _0x326e17[_0xd439('0xea')](_0xfd9cfb);}})['then'](function(_0x3acd03){if(_0x3acd03){_0x3645d5=_0x3acd03[_0xd439('0x4e')];if(!_0x421bcb[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0xe0'))){_0xfd9cfb['limit']=qs[_0xd439('0x25')](_0x421bcb[_0xd439('0x47')][_0xd439('0x25')]);_0xfd9cfb[_0xd439('0x27')]=qs[_0xd439('0x27')](_0x421bcb[_0xd439('0x47')][_0xd439('0x27')]);}return _0x326e17[_0xd439('0xea')](_0xfd9cfb);}})[_0xd439('0x2b')](function(_0xe3eb55){if(_0xe3eb55){return _0xe3eb55?{'count':_0x3645d5,'rows':_0xe3eb55}:null;}})[_0xd439('0x2b')](respondWithResult(_0x3c175a,null))['catch'](handleError(_0x3c175a,null));};exports[_0xd439('0xeb')]=function(_0x494473,_0x1f75e5){var _0x385014={'raw':!![],'where':{}};var _0xc74b9a={};var _0x58116={'count':0x0,'rows':[]};return db[_0xd439('0x3d')][_0xd439('0x9d')]({'where':{'id':_0x494473['params']['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x1f75e5,null))['then'](function(_0xd050a4){if(_0xd050a4){_0xc74b9a[_0xd439('0x58')]=_[_0xd439('0x5a')](db[_0xd439('0xec')][_0xd439('0x3e')]);_0xc74b9a[_0xd439('0x47')]=_[_0xd439('0x5a')](_0x494473[_0xd439('0x47')]);_0xc74b9a[_0xd439('0x5b')]=_['intersection'](_0xc74b9a[_0xd439('0x58')],_0xc74b9a['query']);_0x385014[_0xd439('0x4b')]=_[_0xd439('0x5c')](_0xc74b9a[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x494473[_0xd439('0x47')][_0xd439('0x5d')]));_0x385014[_0xd439('0x4b')]=_0x385014['attributes'][_0xd439('0x4e')]?_0x385014['attributes']:_0xc74b9a[_0xd439('0x58')];if(!_0x494473[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0xe0'))){_0x385014[_0xd439('0x25')]=qs[_0xd439('0x25')](_0x494473[_0xd439('0x47')][_0xd439('0x25')]);_0x385014['offset']=qs[_0xd439('0x27')](_0x494473[_0xd439('0x47')][_0xd439('0x27')]);}_0x385014[_0xd439('0xdb')]=qs[_0xd439('0xdc')](_0x494473['query'][_0xd439('0xdc')]);_0x385014['where']=qs[_0xd439('0x5b')](_['pick'](_0x494473[_0xd439('0x47')],_0xc74b9a[_0xd439('0x5b')]));_0x385014[_0xd439('0x45')][_0xd439('0xe4')]=_0xd050a4['id'];if(_0x494473[_0xd439('0x47')][_0xd439('0x42')]){_0x385014['where']=_[_0xd439('0xde')](_0x385014['where'],{'$or':_[_0xd439('0x35')](_0x385014['attributes'],function(_0x60e022){var _0x130f6b={};_0x130f6b[_0x60e022]={'$like':'%'+_0x494473[_0xd439('0x47')]['filter']+'%'};return _0x130f6b;})});}_0x385014=_[_0xd439('0xde')]({},_0x385014,_0x494473[_0xd439('0x5f')]);return db[_0xd439('0xec')][_0xd439('0x26')]({'where':_0x385014[_0xd439('0x45')]})[_0xd439('0x2b')](function(_0x15848b){_0x58116['count']=_0x15848b;if(_0x494473[_0xd439('0x47')][_0xd439('0x5e')]){_0x385014[_0xd439('0x46')]=[{'all':!![]}];}return db[_0xd439('0xec')][_0xd439('0x4d')](_0x385014);})[_0xd439('0x2b')](function(_0x1a9410){_0x58116[_0xd439('0x52')]=_0x1a9410;return _0x58116;});}})[_0xd439('0x2b')](respondWithFilteredResult(_0x1f75e5,_0x385014))[_0xd439('0x55')](handleError(_0x1f75e5,null));};exports['getSmsInteractions']=function(_0x33170b,_0x19436b){var _0x33d046={};var _0x953933={};var _0xfc6462;var _0x3cd3ee;return db[_0xd439('0x3d')]['findOne']({'where':{'id':_0x33170b[_0xd439('0x57')]['id']}})['then'](handleEntityNotFound(_0x19436b,null))['then'](function(_0x32cf23){if(_0x32cf23){_0xfc6462=_0x32cf23;_0x953933[_0xd439('0x58')]=_[_0xd439('0x5a')](db['SmsInteraction'][_0xd439('0x3e')]);_0x953933['query']=_[_0xd439('0x5a')](_0x33170b[_0xd439('0x47')]);_0x953933[_0xd439('0x5b')]=_[_0xd439('0x5c')](_0x953933[_0xd439('0x58')],_0x953933[_0xd439('0x47')]);_0x33d046[_0xd439('0x4b')]=_[_0xd439('0x5c')](_0x953933[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x33170b[_0xd439('0x47')][_0xd439('0x5d')]));_0x33d046['attributes']=_0x33d046[_0xd439('0x4b')][_0xd439('0x4e')]?_0x33d046[_0xd439('0x4b')]:_0x953933[_0xd439('0x58')];_0x33d046[_0xd439('0xdb')]=qs[_0xd439('0xdc')](_0x33170b[_0xd439('0x47')][_0xd439('0xdc')]);_0x33d046[_0xd439('0x45')]=qs[_0xd439('0x5b')](_['pick'](_0x33170b[_0xd439('0x47')],_0x953933['filters']));if(_0x33170b[_0xd439('0x47')][_0xd439('0x42')]){_0x33d046['where']=_['merge'](_0x33d046['where'],{'$or':_[_0xd439('0x35')](_0x33d046[_0xd439('0x4b')],function(_0x580316){var _0x532192={};_0x532192[_0x580316]={'$like':'%'+_0x33170b[_0xd439('0x47')][_0xd439('0x42')]+'%'};return _0x532192;})});}_0x33d046=_[_0xd439('0xde')]({},_0x33d046,_0x33170b[_0xd439('0x5f')]);return _0xfc6462['getSmsInteractions'](_0x33d046);}})['then'](function(_0xad02d6){if(_0xad02d6){_0x3cd3ee=_0xad02d6[_0xd439('0x4e')];if(!_0x33170b[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0xe0'))){_0x33d046['limit']=qs['limit'](_0x33170b['query'][_0xd439('0x25')]);_0x33d046[_0xd439('0x27')]=qs[_0xd439('0x27')](_0x33170b[_0xd439('0x47')][_0xd439('0x27')]);}return _0xfc6462[_0xd439('0xed')](_0x33d046);}})['then'](function(_0x3416bf){if(_0x3416bf){return _0x3416bf?{'count':_0x3cd3ee,'rows':_0x3416bf}:null;}})['then'](respondWithResult(_0x19436b,null))[_0xd439('0x55')](handleError(_0x19436b,null));};exports[_0xd439('0xee')]=function(_0x17e30d,_0x3bab7f){var _0x1378c8={};var _0x14f5be={};var _0x419398;var _0x2c8ac1;return db[_0xd439('0x3d')][_0xd439('0x9d')]({'where':{'id':_0x17e30d[_0xd439('0x57')]['id']}})['then'](handleEntityNotFound(_0x3bab7f,null))[_0xd439('0x2b')](function(_0x46ef37){if(_0x46ef37){_0x419398=_0x46ef37;_0x14f5be[_0xd439('0x58')]=_[_0xd439('0x5a')](db[_0xd439('0xef')][_0xd439('0x3e')]);_0x14f5be['query']=_['keys'](_0x17e30d[_0xd439('0x47')]);_0x14f5be[_0xd439('0x5b')]=_[_0xd439('0x5c')](_0x14f5be[_0xd439('0x58')],_0x14f5be['query']);_0x1378c8['attributes']=_[_0xd439('0x5c')](_0x14f5be[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x17e30d['query'][_0xd439('0x5d')]));_0x1378c8[_0xd439('0x4b')]=_0x1378c8[_0xd439('0x4b')][_0xd439('0x4e')]?_0x1378c8[_0xd439('0x4b')]:_0x14f5be['model'];_0x1378c8[_0xd439('0xdb')]=qs[_0xd439('0xdc')](_0x17e30d[_0xd439('0x47')]['sort']);_0x1378c8[_0xd439('0x45')]=qs[_0xd439('0x5b')](_[_0xd439('0xdd')](_0x17e30d[_0xd439('0x47')],_0x14f5be[_0xd439('0x5b')]));if(_0x17e30d[_0xd439('0x47')]['filter']){_0x1378c8[_0xd439('0x45')]=_[_0xd439('0xde')](_0x1378c8['where'],{'$or':_['map'](_0x1378c8['attributes'],function(_0x5d0618){var _0x3cd343={};_0x3cd343[_0x5d0618]={'$like':'%'+_0x17e30d[_0xd439('0x47')]['filter']+'%'};return _0x3cd343;})});}_0x1378c8=_[_0xd439('0xde')]({},_0x1378c8,_0x17e30d['options']);return _0x419398['getFaxInteractions'](_0x1378c8);}})[_0xd439('0x2b')](function(_0x4bb378){if(_0x4bb378){_0x2c8ac1=_0x4bb378[_0xd439('0x4e')];if(!_0x17e30d[_0xd439('0x47')]['hasOwnProperty'](_0xd439('0xe0'))){_0x1378c8[_0xd439('0x25')]=qs[_0xd439('0x25')](_0x17e30d['query'][_0xd439('0x25')]);_0x1378c8[_0xd439('0x27')]=qs[_0xd439('0x27')](_0x17e30d[_0xd439('0x47')]['offset']);}return _0x419398[_0xd439('0xee')](_0x1378c8);}})[_0xd439('0x2b')](function(_0x2e756a){if(_0x2e756a){return _0x2e756a?{'count':_0x2c8ac1,'rows':_0x2e756a}:null;}})[_0xd439('0x2b')](respondWithResult(_0x3bab7f,null))[_0xd439('0x55')](handleError(_0x3bab7f,null));};exports[_0xd439('0xf0')]=function(_0x3a5265,_0x123b80){var _0x40a9e4={};var _0x2bc6d2={};var _0x1a0ee9;var _0xc16979;return db['User'][_0xd439('0x9d')]({'where':{'id':_0x3a5265[_0xd439('0x57')]['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x123b80,null))[_0xd439('0x2b')](function(_0x23bead){if(_0x23bead){_0x1a0ee9=_0x23bead;_0x2bc6d2[_0xd439('0x58')]=_[_0xd439('0x5a')](db[_0xd439('0xf1')]['rawAttributes']);_0x2bc6d2[_0xd439('0x47')]=_['keys'](_0x3a5265['query']);_0x2bc6d2[_0xd439('0x5b')]=_['intersection'](_0x2bc6d2[_0xd439('0x58')],_0x2bc6d2['query']);_0x40a9e4['attributes']=_['intersection'](_0x2bc6d2[_0xd439('0x58')],qs['fields'](_0x3a5265[_0xd439('0x47')]['fields']));_0x40a9e4[_0xd439('0x4b')]=_0x40a9e4[_0xd439('0x4b')][_0xd439('0x4e')]?_0x40a9e4['attributes']:_0x2bc6d2['model'];_0x40a9e4['order']=qs[_0xd439('0xdc')](_0x3a5265[_0xd439('0x47')][_0xd439('0xdc')]);_0x40a9e4[_0xd439('0x45')]=qs['filters'](_['pick'](_0x3a5265['query'],_0x2bc6d2[_0xd439('0x5b')]));if(_0x3a5265['query'][_0xd439('0x42')]){_0x40a9e4[_0xd439('0x45')]=_[_0xd439('0xde')](_0x40a9e4[_0xd439('0x45')],{'$or':_[_0xd439('0x35')](_0x40a9e4['attributes'],function(_0x58e560){var _0x198b2a={};_0x198b2a[_0x58e560]={'$like':'%'+_0x3a5265[_0xd439('0x47')][_0xd439('0x42')]+'%'};return _0x198b2a;})});}_0x40a9e4=_[_0xd439('0xde')]({},_0x40a9e4,_0x3a5265['options']);return _0x1a0ee9[_0xd439('0xf0')](_0x40a9e4);}})[_0xd439('0x2b')](function(_0x53e031){if(_0x53e031){_0xc16979=_0x53e031[_0xd439('0x4e')];if(!_0x3a5265[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0xe0'))){_0x40a9e4[_0xd439('0x25')]=qs[_0xd439('0x25')](_0x3a5265[_0xd439('0x47')][_0xd439('0x25')]);_0x40a9e4[_0xd439('0x27')]=qs[_0xd439('0x27')](_0x3a5265[_0xd439('0x47')][_0xd439('0x27')]);}return _0x1a0ee9['getWhatsappInteractions'](_0x40a9e4);}})[_0xd439('0x2b')](function(_0x494f99){if(_0x494f99){return _0x494f99?{'count':_0xc16979,'rows':_0x494f99}:null;}})[_0xd439('0x2b')](respondWithResult(_0x123b80,null))[_0xd439('0x55')](handleError(_0x123b80,null));};exports[_0xd439('0xf2')]=function(_0x2584c6,_0x57992c,_0x4e3e66){var _0x1f31d6;var _0x47b539;var _0x1edfd1;var _0x47b79e=!_[_0xd439('0x6f')](_0x2584c6[_0xd439('0x57')]['id'])?_0x2584c6[_0xd439('0x57')]['id']:!_[_0xd439('0x6f')](_0x2584c6['user']['id'])?_0x2584c6[_0xd439('0x30')]['id']:null;return db['User'][_0xd439('0x60')]({'where':{'id':_0x47b79e,'role':{'$or':[_0xd439('0x88'),_0xd439('0x30'),_0xd439('0x31')]}},'attributes':['id',_0xd439('0x3a'),'phone',_0xd439('0xf3'),'role','internal',_0xd439('0xa6')]})['then'](function(_0x4ee70f){if(_0x4ee70f){if(_0x4ee70f[_0xd439('0x2c')]===_0xd439('0x31')){_0x1f31d6=_0x4ee70f;if(_0x2584c6[_0xd439('0x65')]['interface']){_0x1edfd1=util['format'](_0xd439('0xf4'),_0x1f31d6[_0x2584c6['body']['interface']]);}else if(_0x2584c6['body'][_0xd439('0xf5')]){_0x1edfd1=util[_0xd439('0xb0')](_0xd439('0xb1'),_0x2584c6['body']['intrf']);}else{_0x1edfd1=util[_0xd439('0xb0')](_0xd439('0xb1'),_0x1f31d6[_0xd439('0x3a')]);}socket['to'](util[_0xd439('0xb0')]('user:%s',_0x1f31d6['name']))[_0xd439('0xb6')]('user:forcelogout',{'user':{'id':_0x1f31d6['id'],'name':_0x1f31d6[_0xd439('0x3a')]},'ip':_0x2584c6[_0xd439('0xf6')]['x-forwarded-for']||_0x2584c6[_0xd439('0xf7')][_0xd439('0xf8')]||_0x2584c6[_0xd439('0xf9')][_0xd439('0xf8')]||_0x2584c6['connection'][_0xd439('0xf9')][_0xd439('0xf8')]});return db[_0xd439('0xb9')][_0xd439('0x2e')]({'where':{'membername':_0x1f31d6[_0xd439('0x3a')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xd439('0x97'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xd439('0x2b')](function(){if(_0x1f31d6){return _0x1f31d6[_0xd439('0xfa')]({'raw':!![]});}})['then'](function(_0x56cb40){if(_0x1f31d6){if(_0x56cb40){_0x47b539=_0x56cb40;if(_0x47b539[_0xd439('0x4e')]){var _0x574e8a=_0x47b539[_0xd439('0x35')](function(_0x3f7a5a){var _0x592119={'membername':_0x1f31d6[_0xd439('0x3a')],'UserId':_0x1f31d6['id'],'queue_name':_0x3f7a5a[_0xd439('0x3a')],'VoiceQueueId':_0x3f7a5a['id'],'interface':_0x1edfd1,'paused':_0x1f31d6[_0xd439('0xa6')]||![],'penalty':_0x3f7a5a['UserVoiceQueue.penalty']||0x0};return db[_0xd439('0xb9')]['upsert'](_0x592119);});return Promise['all'](_0x574e8a);}}}})[_0xd439('0x2b')](function(){if(_0x1f31d6){return db[_0xd439('0xfb')][_0xd439('0x4d')]({'where':{'membername':_0x1f31d6['name'],'exitAt':null}});}})[_0xd439('0x2b')](function(_0x3872b8){if(_0x1f31d6){var _0x33e665=[];_0x3872b8['forEach'](function(_0x45ef51){_0x33e665[_0xd439('0x4c')](_0x45ef51[_0xd439('0x2a')]({'exitAt':moment()[_0xd439('0xb0')](_0xd439('0xfc'))}));});return Promise['all'](_0x33e665);}})[_0xd439('0x2b')](function(){if(_0x1f31d6){var _0xbe1c6e=[];var _0x3eaeeb=[];var _0x1f82e9=utils[_0xd439('0xfd')]();var _0x5be656={'membername':_0x1f31d6['name'],'interface':_0x1edfd1,'enterAt':moment()[_0xd439('0xb0')](_0xd439('0xfc')),'role':_0x1f31d6[_0xd439('0x2c')],'internal':_0x1f31d6[_0xd439('0x6a')]};_0x1f82e9[_0xd439('0xfe')](function(_0x4fcfec){_0xbe1c6e[_0xd439('0x4c')](_[_0xd439('0xde')]({'channel':_0x4fcfec,'type':_0xd439('0xff'),'data1':_0x2584c6[_0xd439('0x65')][_0xd439('0x100')],'data2':_0x1edfd1},_0x5be656));if(_0x1f31d6[_0xd439('0xa6')]){_0x3eaeeb[_0xd439('0x4c')](_['merge']({'channel':_0x4fcfec,'type':_0xd439('0x101'),'data1':'LOGININPAUSE'},_0x5be656));}});return db[_0xd439('0xfb')][_0xd439('0x102')](_0xbe1c6e[_0xd439('0xce')](_0x3eaeeb),{'individualHooks':!![]});}})[_0xd439('0x2b')](function(){if(_0x1f31d6){return _0x1f31d6[_0xd439('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xd439('0xb0')](_0xd439('0xfc')),'voicePause':_0x1f31d6[_0xd439('0xa6')]||![],'mailPause':_0x1f31d6[_0xd439('0xa6')]||![],'chatPause':_0x1f31d6['loginInPause']||![],'faxPause':_0x1f31d6[_0xd439('0xa6')]||![],'smsPause':_0x1f31d6[_0xd439('0xa6')]||![],'openchannelPause':_0x1f31d6[_0xd439('0xa6')]||![],'whatsappPause':_0x1f31d6[_0xd439('0xa6')]||![],'pauseType':_0x1f31d6['loginInPause']?'LOGININPAUSE':null,'interface':_0x1edfd1,'lastPauseAt':moment()[_0xd439('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xd439('0x2b')](function(_0x54b7dd){if(_0x2584c6[_0xd439('0x103')]){return _0x4e3e66();}else{return Promise['resolve'](_0x54b7dd)['then'](respondWithResult(_0x57992c,null));}})[_0xd439('0x55')](handleError(_0x57992c,null));};exports[_0xd439('0x104')]=function(_0x14c996,_0x25c29e){var _0x14b9b4;return db[_0xd439('0x3d')][_0xd439('0x60')]({'where':{'id':_0x14c996[_0xd439('0x57')]['id'],'role':_0xd439('0x31')},'attributes':['id',_0xd439('0x3a'),_0xd439('0x2c')]})['then'](handleEntityNotFound(_0x25c29e,null))[_0xd439('0x2b')](function(_0x3b45a2){if(_0x3b45a2){_0x14b9b4=_0x3b45a2;return db[_0xd439('0xb9')][_0xd439('0x2e')]({'where':{'membername':_0x14b9b4[_0xd439('0x3a')]},'individualHooks':!![]});}})[_0xd439('0x2b')](function(){return db[_0xd439('0xfb')]['findAll']({'where':{'membername':_0x14b9b4['name'],'exitAt':null}});})[_0xd439('0x2b')](function(_0x3e7ac8){var _0x24e9d3=[];_0x3e7ac8[_0xd439('0xfe')](function(_0x105f93){_0x24e9d3[_0xd439('0x4c')](_0x105f93[_0xd439('0x2a')]({'exitAt':moment()[_0xd439('0xb0')](_0xd439('0xfc'))}));});return Promise['all'](_0x24e9d3);})[_0xd439('0x2b')](function(){return _0x14b9b4['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd439('0x2b')](respondWithResult(_0x25c29e,null))[_0xd439('0x55')](handleError(_0x25c29e,null));};exports['pause']=function(_0x34c5bb,_0x2803e2){var _0x31845c;return db[_0xd439('0xb9')][_0xd439('0x2a')]({'paused':0x1},{'where':{'UserId':_0x34c5bb[_0xd439('0x57')]['id']},'individualHooks':!![]})['then'](function(){return db['User']['find']({'where':{'id':_0x34c5bb[_0xd439('0x57')]['id'],'role':_0xd439('0x31')},'attributes':['id',_0xd439('0x3a'),_0xd439('0x2c'),_0xd439('0x6a'),_0xd439('0xa8'),'online']});})[_0xd439('0x2b')](handleEntityNotFound(_0x2803e2,null))[_0xd439('0x2b')](function(_0x5c9d29){if(_0x5c9d29){_0x31845c=_0x5c9d29;return respondWithRpcPromise(_0xd439('0x105'),_0xd439('0x106'),{'id':_0x31845c['id'],'name':_0x31845c['name'],'pause':!![]});}})[_0xd439('0x2b')](function(){if(_0x31845c){return db[_0xd439('0xfb')][_0xd439('0x4d')]({'where':{'membername':_0x31845c['name'],'type':_0xd439('0x101'),'exitAt':null}});}})[_0xd439('0x2b')](function(_0x47d294){if(_0x47d294[_0xd439('0x4e')]){var _0x44c4c1=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x61d020=0x0,_0x28a0ba=_0x47d294[_0xd439('0x4e')];_0x61d020<_0x28a0ba;_0x61d020++){_0x47d294[_0x61d020][_0xd439('0x107')]({'exitAt':_0x44c4c1});}}})['then'](function(){var _0x31fe0d=[];var _0x26b295=utils[_0xd439('0xfd')]();_0x26b295[_0xd439('0xfe')](function(_0x49aa99){_0x31fe0d[_0xd439('0x4c')]({'channel':_0x49aa99,'membername':_0x31845c[_0xd439('0x3a')],'interface':_[_0xd439('0x6f')](_0x31845c['interface'])?util[_0xd439('0xb0')](_0xd439('0xb1'),_0x31845c[_0xd439('0x3a')]):_0x31845c[_0xd439('0xa8')],'type':_0xd439('0x101'),'enterAt':moment()[_0xd439('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x34c5bb[_0xd439('0x65')]['type']||_0xd439('0x108'),'role':_0x31845c[_0xd439('0x2c')],'internal':_0x31845c['internal']});});return db['MemberReport'][_0xd439('0x102')](_0x31fe0d,{'individualHooks':!![]});})[_0xd439('0x2b')](function(){return _0x31845c[_0xd439('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x34c5bb[_0xd439('0x65')][_0xd439('0x40')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd439('0xb0')](_0xd439('0xfc'))});})['then'](respondWithResult(_0x2803e2,null))[_0xd439('0x55')](handleError(_0x2803e2,null));};exports[_0xd439('0x109')]=function(_0x3f071f,_0x5654f9){if(_0x3f071f[_0xd439('0x65')][_0xd439('0xa4')]&&!utils['isValidChannel'](_0x3f071f['body']['channel'])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3f071f[_0xd439('0x65')]['channel']));}return db[_0xd439('0x3d')]['find']({'where':{'id':_0x3f071f[_0xd439('0x57')]['id']},'attributes':['id',_0xd439('0x3a'),_0xd439('0x2c'),'internal',_0xd439('0xa8'),'online','voicePause',_0xd439('0x10a'),'chatPause','faxPause',_0xd439('0x10b'),_0xd439('0x10c'),_0xd439('0x10d'),'pauseType','lastPauseAt']})['then'](function(_0x5917fe){if(!_0x5917fe){throw new APINotFoundError(util[_0xd439('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3f071f[_0xd439('0x57')]['id']));}return _0x5917fe['unpause'](_0x3f071f[_0xd439('0x65')][_0xd439('0xa4')]);})[_0xd439('0x2b')](respondWithResult(_0x5654f9,null))[_0xd439('0x55')](APIHandleError(_0x5654f9));};exports[_0xd439('0x10e')]=function(_0x3f8d01,_0x3c9dfc){var _0x5cfd05={};var _0x127d24={};var _0xe0d420;var _0xb0c3e;return db['User']['findOne']({'where':{'id':_0x3f8d01[_0xd439('0x57')]['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x3c9dfc,null))['then'](function(_0x349909){if(_0x349909){_0xe0d420=_0x349909;_0x127d24[_0xd439('0x58')]=_[_0xd439('0x5a')](db[_0xd439('0x10f')]['rawAttributes']);_0x127d24[_0xd439('0x47')]=_['keys'](_0x3f8d01[_0xd439('0x47')]);_0x127d24[_0xd439('0x5b')]=_[_0xd439('0x5c')](_0x127d24[_0xd439('0x58')],_0x127d24[_0xd439('0x47')]);_0x5cfd05['attributes']=_[_0xd439('0x5c')](_0x127d24[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x3f8d01[_0xd439('0x47')][_0xd439('0x5d')]));_0x5cfd05[_0xd439('0x4b')]=_0x5cfd05[_0xd439('0x4b')][_0xd439('0x4e')]?_0x5cfd05[_0xd439('0x4b')]:_0x127d24['model'];_0x5cfd05['order']=qs['sort'](_0x3f8d01['query'][_0xd439('0xdc')]);_0x5cfd05[_0xd439('0x45')]=qs[_0xd439('0x5b')](_[_0xd439('0xdd')](_0x3f8d01['query'],_0x127d24['filters']));if(_0x3f8d01[_0xd439('0x47')][_0xd439('0x42')]){_0x5cfd05[_0xd439('0x45')]=_['merge'](_0x5cfd05[_0xd439('0x45')],{'$or':_[_0xd439('0x35')](_0x5cfd05[_0xd439('0x4b')],function(_0xcd3fa5){var _0xd2566b={};_0xd2566b[_0xcd3fa5]={'$like':'%'+_0x3f8d01['query'][_0xd439('0x42')]+'%'};return _0xd2566b;})});}_0x5cfd05=_[_0xd439('0xde')]({},_0x5cfd05,_0x3f8d01[_0xd439('0x5f')]);return _0xe0d420[_0xd439('0x10e')](_0x5cfd05);}})[_0xd439('0x2b')](function(_0x5e5d1d){if(_0x5e5d1d){_0xb0c3e=_0x5e5d1d[_0xd439('0x4e')];if(!_0x3f8d01[_0xd439('0x47')][_0xd439('0xd2')](_0xd439('0xe0'))){_0x5cfd05[_0xd439('0x25')]=qs[_0xd439('0x25')](_0x3f8d01['query'][_0xd439('0x25')]);_0x5cfd05[_0xd439('0x27')]=qs['offset'](_0x3f8d01[_0xd439('0x47')][_0xd439('0x27')]);}return _0xe0d420[_0xd439('0x10e')](_0x5cfd05);}})['then'](function(_0x23ffd4){if(_0x23ffd4){return _0x23ffd4?{'count':_0xb0c3e,'rows':_0x23ffd4}:null;}})[_0xd439('0x2b')](respondWithResult(_0x3c9dfc,null))[_0xd439('0x55')](handleError(_0x3c9dfc,null));};exports['addTeams']=function(_0x136a19,_0x489cc9){var _0x44a97a=_0x136a19[_0xd439('0x57')]['id'];var _0x3b22dd=_0x136a19[_0xd439('0x65')]?_0x136a19['body'][_0xd439('0x68')]:null;var _0x1698f9=[];return Promise[_0xd439('0x110')]()[_0xd439('0x2b')](function(){if(!_0x3b22dd)throw new APIBadRequestError(_0xd439('0x111'));})[_0xd439('0x2b')](function(){return db[_0xd439('0x3d')][_0xd439('0x9d')]({'where':{'id':_0x44a97a}});})[_0xd439('0x2b')](function(_0x13a9e0){if(!_0x13a9e0)throw new APINotFoundError(util[_0xd439('0xb0')](_0xd439('0xd0'),_0x136a19[_0xd439('0x57')]['id']));return db[_0xd439('0x71')]['transaction'](function(_0x4ebaf7){return _0x13a9e0[_0xd439('0x112')](_0x3b22dd,{'transaction':_0x4ebaf7})['then'](function(){return db['Team'][_0xd439('0x4d')]({'where':{'id':{'$in':_0x3b22dd}}});})[_0xd439('0x2b')](function(_0x104931){var _0x29221b=_[_0xd439('0x35')](_0x104931,function(_0x48d6d3){return _0x48d6d3['getAssociatedQueues']();});return Promise[_0xd439('0x54')](_0x29221b);})[_0xd439('0x2b')](function(_0x3dcae2){_0x1698f9=_[_0xd439('0x113')](_0x3dcae2);var _0x25fbf9=_[_0xd439('0x35')](_0x1698f9,function(_0x1cf183){return _0x1cf183[_0xd439('0x114')](_0x13a9e0['id'],{'transaction':_0x4ebaf7});});return Promise[_0xd439('0x54')](_0x25fbf9);})[_0xd439('0x2b')](function(){if(!_0x13a9e0['online'])return;var _0x1ef199=_[_0xd439('0x42')](_0x1698f9,function(_0x57c867){return _0x57c867[_0xd439('0x115')](_0xd439('0xa4'))===_0xd439('0x116');});var _0x44633c=_[_0xd439('0x35')](_0x1ef199,function(_0x2d65e8){return db[_0xd439('0xb9')]['upsert']({'membername':_0x13a9e0[_0xd439('0x3a')],'UserId':_0x13a9e0['id'],'queue_name':_0x2d65e8['name'],'VoiceQueueId':_0x2d65e8['id'],'interface':_[_0xd439('0x6f')](_0x13a9e0[_0xd439('0xa8')])?util[_0xd439('0xb0')](_0xd439('0xb1'),_0x13a9e0[_0xd439('0x3a')]):_0x13a9e0[_0xd439('0xa8')],'paused':_0x13a9e0[_0xd439('0xa7')]||![],'penalty':_0x13a9e0[_0xd439('0xb2')]},{'transaction':_0x4ebaf7});});return Promise['all'](_0x44633c);})[_0xd439('0x2b')](function(){return db[_0xd439('0x117')][_0xd439('0x4d')]({'where':{'teamId':{'$in':_0x3b22dd}}});})[_0xd439('0x2b')](function(_0x36a95f){var _0x247578=_[_0xd439('0x35')](_0x36a95f,function(_0x5767fe){return db[_0xd439('0x118')][_0xd439('0x86')]({'UserId':_0x13a9e0['id'],'VoicePrefixId':_0x5767fe[_0xd439('0x119')]},{'transaction':_0x4ebaf7});});return Promise[_0xd439('0x54')](_0x247578);});});})['then'](function(){for(var _0x6e45da=0x0;_0x6e45da<_0x1698f9['length'];_0x6e45da++){var _0x46cc2a=_0x1698f9[_0x6e45da][_0xd439('0x115')]('channel');var _0x1a4c24=_0x46cc2a+'QueueId';socket[_0xd439('0xb6')](_0xd439('0x30')+_0x46cc2a+_0xd439('0x11a'),{'UserId':_0x44a97a,['queueField']:_0x1698f9[_0x6e45da]['id']});}})[_0xd439('0x2b')](respondWithStatusCode(_0x489cc9,null))[_0xd439('0x55')](APIHandleError(_0x489cc9));};exports[_0xd439('0x11b')]=function(_0x2d1470,_0x943ebf){var _0x56ec06=_0x2d1470[_0xd439('0x57')]['id'];var _0x20ed95=null;if(_0x2d1470['query'][_0xd439('0x68')]){_0x20ed95=_[_0xd439('0xb5')](_0x2d1470[_0xd439('0x47')][_0xd439('0x68')])?_0x2d1470[_0xd439('0x47')][_0xd439('0x68')]:[_0x2d1470[_0xd439('0x47')]['ids']];}var _0x1d8449=[];return Promise[_0xd439('0x110')]()[_0xd439('0x2b')](function(){if(!_0x20ed95)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd439('0x2b')](function(){return db['User']['findOne']({'where':{'id':_0x56ec06}});})[_0xd439('0x2b')](function(_0x29dc05){if(!_0x29dc05)throw new APINotFoundError(util[_0xd439('0xb0')](_0xd439('0xd0'),_0x2d1470[_0xd439('0x57')]['id']));return db['sequelize'][_0xd439('0x11c')](function(_0x4274a2){return _0x29dc05['removeTeams'](_0x20ed95,{'transaction':_0x4274a2})['then'](function(){return db[_0xd439('0x10f')][_0xd439('0x4d')]({'where':{'id':{'$in':_0x20ed95}}});})[_0xd439('0x2b')](function(_0x48e1af){var _0x451674=_[_0xd439('0x35')](_0x48e1af,function(_0x2e36d5){return _0x2e36d5[_0xd439('0x11d')]();});return Promise[_0xd439('0x54')](_0x451674);})[_0xd439('0x2b')](function(_0x3fa496){_0x1d8449=_[_0xd439('0x113')](_0x3fa496);var _0x12bf8d=_[_0xd439('0x35')](_0x1d8449,function(_0x52db2e){return _0x52db2e[_0xd439('0x11e')](_0x29dc05['id'],{'transaction':_0x4274a2});});return Promise[_0xd439('0x54')](_0x12bf8d);})['then'](function(){if(!_0x29dc05[_0xd439('0xa5')])return;var _0x283358=_[_0xd439('0x42')](_0x1d8449,function(_0x168cb0){return _0x168cb0['getDataValue'](_0xd439('0xa4'))==='Voice';});var _0x16e576=_[_0xd439('0x35')](_0x283358,function(_0x3a3755){return db[_0xd439('0xb9')][_0xd439('0x2e')]({'where':{'VoiceQueueId':_0x3a3755['id'],'UserId':_0x29dc05['id']},'transaction':_0x4274a2});});return Promise[_0xd439('0x54')](_0x16e576);})[_0xd439('0x2b')](function(){return db[_0xd439('0x117')][_0xd439('0x4d')]({'where':{'teamId':{'$in':_0x20ed95}}});})[_0xd439('0x2b')](function(_0x2eca65){var _0x479bd9=_['map'](_0x2eca65,function(_0x43eacb){return db['UserVoicePrefix'][_0xd439('0x2e')]({'where':{'UserId':_0x29dc05['id'],'VoicePrefixId':_0x43eacb[_0xd439('0x119')]}},{'transaction':_0x4274a2});});return Promise[_0xd439('0x54')](_0x479bd9);});});})[_0xd439('0x2b')](function(){for(var _0x286172=0x0;_0x286172<_0x1d8449['length'];_0x286172++){var _0xe79f0=_0x1d8449[_0x286172][_0xd439('0x115')](_0xd439('0xa4'));var _0x2857f0=_0xe79f0+_0xd439('0xae');socket[_0xd439('0xb6')](_0xd439('0x30')+_0xe79f0+_0xd439('0xb7'),{'UserId':_0x56ec06,['queueField']:_0x1d8449[_0x286172]['id']});}})[_0xd439('0x2b')](respondWithStatusCode(_0x943ebf,null))[_0xd439('0x55')](APIHandleError(_0x943ebf));};exports['getLists']=function(_0x2134e8,_0x4fe551){var _0x29f922={};var _0xba3357={};var _0xdebd88;var _0x5725ae;return db[_0xd439('0x3d')][_0xd439('0x9d')]({'where':{'id':_0x2134e8[_0xd439('0x57')]['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x4fe551,null))[_0xd439('0x2b')](function(_0x508a4f){if(_0x508a4f){_0xdebd88=_0x508a4f;_0xba3357[_0xd439('0x58')]=_['keys'](db['CmList'][_0xd439('0x3e')]);_0xba3357['query']=_['keys'](_0x2134e8['query']);_0xba3357[_0xd439('0x5b')]=_[_0xd439('0x5c')](_0xba3357[_0xd439('0x58')],_0xba3357['query']);_0x29f922[_0xd439('0x4b')]=_[_0xd439('0x5c')](_0xba3357[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x2134e8[_0xd439('0x47')][_0xd439('0x5d')]));_0x29f922['attributes']=_0x29f922['attributes']['length']?_0x29f922[_0xd439('0x4b')]:_0xba3357[_0xd439('0x58')];_0x29f922[_0xd439('0xdb')]=qs['sort'](_0x2134e8[_0xd439('0x47')][_0xd439('0xdc')]);_0x29f922[_0xd439('0x45')]=qs[_0xd439('0x5b')](_['pick'](_0x2134e8[_0xd439('0x47')],_0xba3357[_0xd439('0x5b')]));if(_0x2134e8[_0xd439('0x47')][_0xd439('0x42')]){_0x29f922[_0xd439('0x45')]=_[_0xd439('0xde')](_0x29f922[_0xd439('0x45')],{'$or':_['map'](_0x29f922[_0xd439('0x4b')],function(_0xabe73f){var _0x92d11f={};_0x92d11f[_0xabe73f]={'$like':'%'+_0x2134e8['query'][_0xd439('0x42')]+'%'};return _0x92d11f;})});}_0x29f922=_[_0xd439('0xde')]({},_0x29f922,_0x2134e8[_0xd439('0x5f')]);return _0xdebd88[_0xd439('0x11f')](_0x29f922);}})[_0xd439('0x2b')](function(_0x28d200){if(_0x28d200){_0x5725ae=_0x28d200[_0xd439('0x4e')];if(!_0x2134e8[_0xd439('0x47')][_0xd439('0xd2')]('nolimit')){_0x29f922[_0xd439('0x25')]=qs[_0xd439('0x25')](_0x2134e8[_0xd439('0x47')][_0xd439('0x25')]);_0x29f922[_0xd439('0x27')]=qs['offset'](_0x2134e8[_0xd439('0x47')][_0xd439('0x27')]);}return _0xdebd88[_0xd439('0x11f')](_0x29f922);}})[_0xd439('0x2b')](function(_0x211307){if(_0x211307){return _0x211307?{'count':_0x5725ae,'rows':_0x211307}:null;}})[_0xd439('0x2b')](respondWithResult(_0x4fe551,null))['catch'](handleError(_0x4fe551,null));};exports[_0xd439('0x120')]=function(_0x195f76,_0x2dc5e8){var _0x176ec2={};var _0x15937f={};var _0x24d882;return db['User']['findOne']({'where':{'id':_0x195f76[_0xd439('0x57')]['id']}})[_0xd439('0x2b')](handleEntityNotFound(_0x2dc5e8,null))[_0xd439('0x2b')](function(_0x1fc6df){if(_0x1fc6df){_0x24d882=_0x1fc6df;_0x15937f[_0xd439('0x58')]=_[_0xd439('0x5a')](db['User']['rawAttributes']);_0x15937f[_0xd439('0x47')]=_['keys'](_0x195f76[_0xd439('0x47')]);_0x15937f[_0xd439('0x5b')]=_[_0xd439('0x5c')](_0x15937f[_0xd439('0x58')],_0x15937f[_0xd439('0x47')]);_0x176ec2['attributes']=_['intersection'](_0x15937f[_0xd439('0x58')],qs[_0xd439('0x5d')](_0x195f76[_0xd439('0x47')][_0xd439('0x5d')]));_0x176ec2[_0xd439('0x4b')]=_0x176ec2[_0xd439('0x4b')][_0xd439('0x4e')]?_0x176ec2[_0xd439('0x4b')]:_0x15937f[_0xd439('0x58')];_0x176ec2[_0xd439('0xdb')]=qs[_0xd439('0xdc')](_0x195f76[_0xd439('0x47')][_0xd439('0xdc')]);_0x176ec2['where']=qs[_0xd439('0x5b')](_[_0xd439('0xdd')](_0x195f76[_0xd439('0x47')],_0x15937f[_0xd439('0x5b')]));if(_0x195f76[_0xd439('0x47')][_0xd439('0x42')]){_0x176ec2[_0xd439('0x45')]=_[_0xd439('0xde')](_0x176ec2[_0xd439('0x45')],{'$or':_[_0xd439('0x35')](_0x176ec2['attributes'],function(_0x1a94d7){var _0x225964={};_0x225964[_0x1a94d7]={'$like':'%'+_0x195f76[_0xd439('0x47')][_0xd439('0x42')]+'%'};return _0x225964;})});}_0x176ec2[_0xd439('0x58')]=db[_0xd439('0x3d')];_0x176ec2['as']=_0xd439('0x8d');_0x176ec2=_[_0xd439('0xde')]({},_0x176ec2,_0x195f76['options']);return _0x24d882[_0xd439('0xfa')]({'include':[_0x176ec2]});}})[_0xd439('0x2b')](function(_0x264f14){if(_0x264f14){var _0x30de36={},_0x61c21a=[];for(var _0x4791bb=0x0;_0x4791bb<_0x264f14[_0xd439('0x4e')];_0x4791bb+=0x1){for(var _0x59f33b=0x0,_0x38b92d;_0x59f33b<_0x264f14[_0x4791bb][_0xd439('0x8d')][_0xd439('0x4e')];_0x59f33b+=0x1){_0x38b92d=_0x264f14[_0x4791bb][_0xd439('0x8d')][_0x59f33b][_0xd439('0x2f')]({'plain':!![]});_0x30de36[_0x38b92d['id']]=_0x38b92d;}}_0x30de36=_[_0xd439('0x121')](_0x30de36);for(var _0x4e1cb0=qs[_0xd439('0x27')](_0x195f76[_0xd439('0x47')][_0xd439('0x27')]);_0x4e1cb0<_0x30de36[_0xd439('0x4e')]&&_0x61c21a[_0xd439('0x4e')]=_0x34dbe2['agents']){throw new Error(_0x8c4c('0x4c'));}})['then'](function(){if(_0x3f068b){return db['UserVoiceQueueRt'][_0x8c4c('0x42')]({'where':{'membername':_0x3f068b['name']},'individualHooks':!![]});}})[_0x8c4c('0x14')](function(){if(_0x3f068b){return _0x3f068b['getVoiceQueues']({'raw':!![]});}})[_0x8c4c('0x14')](function(_0x56f204){if(_0x3f068b){if(_0x56f204){var _0x451d7a=[];_0x1f6368=_0x56f204;if(_0x1f6368[_0x8c4c('0x26')]){for(var _0x2f05fd=0x0;_0x2f05fd<_0x1f6368[_0x8c4c('0x26')];_0x2f05fd++){_0x451d7a[_0x8c4c('0x43')](db[_0x8c4c('0x23')][_0x8c4c('0x4d')]({'membername':_0x3f068b[_0x8c4c('0x1e')],'UserId':_0x3f068b['id'],'queue_name':_0x1f6368[_0x2f05fd][_0x8c4c('0x1e')],'VoiceQueueId':_0x1f6368[_0x2f05fd]['id'],'interface':_0x312cb4,'paused':_0x3f068b[_0x8c4c('0x47')]||![],'penalty':_0x1f6368[_0x2f05fd][_0x8c4c('0x4e')]||0x0}));}return BPromise['all'](_0x451d7a);}}}})[_0x8c4c('0x14')](function(){if(_0x3f068b){return db[_0x8c4c('0x30')][_0x8c4c('0xb')]({'where':{'membername':_0x3f068b['name'],'exitAt':null}});}})[_0x8c4c('0x14')](function(_0x40b5a1){if(_0x3f068b){if(_0x40b5a1&&_0x40b5a1[_0x8c4c('0x26')]){var _0x1b0b2f=[];_0x40b5a1[_0x8c4c('0x29')](function(_0x23c992){_0x1b0b2f[_0x8c4c('0x43')](_0x23c992[_0x8c4c('0x32')]({'exitAt':moment()[_0x8c4c('0x2b')](_0x8c4c('0x25'))}));});return BPromise[_0x8c4c('0x44')](_0x1b0b2f);}}})[_0x8c4c('0x14')](function(){if(_0x3f068b){var _0x4e615c=[];var _0x5989d6=[];var _0x5a45e0=utils[_0x8c4c('0x28')]();var _0x491633={'membername':_0x3f068b[_0x8c4c('0x1e')],'interface':_0x312cb4,'enterAt':moment()[_0x8c4c('0x2b')](_0x8c4c('0x25')),'role':_0x3f068b['role'],'internal':_0x3f068b['internal']};_0x5a45e0[_0x8c4c('0x29')](function(_0x2e826f){_0x4e615c['push'](_[_0x8c4c('0x4f')]({'channel':_0x2e826f,'type':_0x8c4c('0x50'),'data1':_0x8c4c('0x51'),'data2':_0x312cb4},_0x491633));if(_0x3f068b['loginInPause']){_0x5989d6[_0x8c4c('0x43')](_[_0x8c4c('0x4f')]({'channel':_0x2e826f,'type':_0x8c4c('0x24'),'data1':_0x8c4c('0x52')},_0x491633));}});return db[_0x8c4c('0x30')][_0x8c4c('0x31')](_0x4e615c[_0x8c4c('0x53')](_0x5989d6),{'individualHooks':!![]});}})[_0x8c4c('0x14')](function(){if(_0x3f068b){return _0x3f068b[_0x8c4c('0x32')]({'online':!![],'lastLoginAt':moment()[_0x8c4c('0x2b')](_0x8c4c('0x25')),'voicePause':_0x3f068b['loginInPause']||![],'mailPause':_0x3f068b[_0x8c4c('0x47')]||![],'chatPause':_0x3f068b[_0x8c4c('0x47')]||![],'faxPause':_0x3f068b[_0x8c4c('0x47')]||![],'smsPause':_0x3f068b[_0x8c4c('0x47')]||![],'openchannelPause':_0x3f068b[_0x8c4c('0x47')]||![],'pauseType':_0x3f068b[_0x8c4c('0x47')]?_0x8c4c('0x52'):null,'lastPauseAt':moment()[_0x8c4c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x312cb4});}})[_0x8c4c('0x14')](function(_0x243129){_0x3e5ff6(_0x243129);})['catch'](function(_0x4550fd){_0xfe47e5(_0x238358[_0x8c4c('0x19')](0x1f4,_0x4550fd[_0x8c4c('0x1c')]));});});}; \ No newline at end of file +var _0x6144=['smsPause','whatsappPause','pauseType','system','LogoutUser','destroy','forEach','push','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','all','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','where','attributes','include','map','model','info','debug','stringify','catch','error','message','ShowUser','find','raw','then','PauseUser','name','role','internal','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','isNil','SIP/%s','interface','body','uniqueid','MemberReport','update','type','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','voicePause','chatPause','faxPause','openchannelPause'];(function(_0x47d46d,_0x13d647){var _0x40951b=function(_0x1a7e37){while(--_0x1a7e37){_0x47d46d['push'](_0x47d46d['shift']());}};_0x40951b(++_0x13d647);}(_0x6144,0x6e));var _0x4614=function(_0x518866,_0x43a92f){_0x518866=_0x518866-0x0;var _0x399c29=_0x6144[_0x518866];return _0x399c29;};'use strict';var _=require(_0x4614('0x0'));var util=require(_0x4614('0x1'));var moment=require('moment');var BPromise=require(_0x4614('0x2'));var Redis=require('ioredis');var db=require(_0x4614('0x3'))['db'];var utils=require(_0x4614('0x4'));var logger=require(_0x4614('0x5'))(_0x4614('0x6'));var config=require(_0x4614('0x7'));config[_0x4614('0x8')]=_[_0x4614('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4614('0xa'))(new Redis(config['redis']));require(_0x4614('0xb'))[_0x4614('0xc')](socket);exports[_0x4614('0xd')]=function(_0x3ad0da){var _0x3808e9=this;return new Promise(function(_0x334a82,_0x2edff7){return db[_0x4614('0xe')][_0x4614('0xf')]({'raw':_0x3ad0da[_0x4614('0x10')]?_0x3ad0da['options']['raw']===undefined?!![]:![]:!![],'where':_0x3ad0da[_0x4614('0x10')]?_0x3ad0da[_0x4614('0x10')][_0x4614('0x11')]||null:null,'attributes':_0x3ad0da['options']?_0x3ad0da[_0x4614('0x10')][_0x4614('0x12')]||null:null,'limit':_0x3ad0da['options']?_0x3ad0da['options']['limit']||null:null,'include':_0x3ad0da[_0x4614('0x10')]?_0x3ad0da[_0x4614('0x10')][_0x4614('0x13')]?_[_0x4614('0x14')](_0x3ad0da[_0x4614('0x10')][_0x4614('0x13')],function(_0x5e39a0){return{'model':db[_0x5e39a0[_0x4614('0x15')]],'as':_0x5e39a0['as'],'attributes':_0x5e39a0['attributes'],'include':_0x5e39a0['include']?_[_0x4614('0x14')](_0x5e39a0[_0x4614('0x13')],function(_0x6cf4a0){return{'model':db[_0x6cf4a0[_0x4614('0x15')]],'as':_0x6cf4a0['as'],'attributes':_0x6cf4a0[_0x4614('0x12')],'include':_0x6cf4a0[_0x4614('0x13')]?_['map'](_0x6cf4a0[_0x4614('0x13')],function(_0x525c4a){return{'model':db[_0x525c4a[_0x4614('0x15')]],'as':_0x525c4a['as'],'attributes':_0x525c4a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x376cc4){logger[_0x4614('0x16')](_0x4614('0xd'),_0x3ad0da);logger[_0x4614('0x17')](_0x4614('0xd'),_0x3ad0da,JSON[_0x4614('0x18')](_0x376cc4));_0x334a82(_0x376cc4);})[_0x4614('0x19')](function(_0x50ea5a){logger[_0x4614('0x1a')](_0x4614('0xd'),_0x50ea5a[_0x4614('0x1b')],_0x3ad0da);_0x2edff7(_0x3808e9[_0x4614('0x1a')](0x1f4,_0x50ea5a[_0x4614('0x1b')]));});});};exports[_0x4614('0x1c')]=function(_0x5e84d4){var _0x157c0c=this;return new Promise(function(_0xeda995,_0x289de3){return db[_0x4614('0xe')][_0x4614('0x1d')]({'raw':_0x5e84d4['options']?_0x5e84d4[_0x4614('0x10')][_0x4614('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e84d4[_0x4614('0x10')]?_0x5e84d4[_0x4614('0x10')][_0x4614('0x11')]||null:null,'attributes':_0x5e84d4[_0x4614('0x10')]?_0x5e84d4[_0x4614('0x10')]['attributes']||null:null,'include':_0x5e84d4['options']?_0x5e84d4[_0x4614('0x10')][_0x4614('0x13')]?_['map'](_0x5e84d4[_0x4614('0x10')][_0x4614('0x13')],function(_0x9b38f4){return{'model':db[_0x9b38f4[_0x4614('0x15')]],'as':_0x9b38f4['as'],'attributes':_0x9b38f4[_0x4614('0x12')],'include':_0x9b38f4[_0x4614('0x13')]?_['map'](_0x9b38f4[_0x4614('0x13')],function(_0x26d559){return{'model':db[_0x26d559[_0x4614('0x15')]],'as':_0x26d559['as'],'attributes':_0x26d559[_0x4614('0x12')],'include':_0x26d559['include']?_[_0x4614('0x14')](_0x26d559[_0x4614('0x13')],function(_0x177d51){return{'model':db[_0x177d51[_0x4614('0x15')]],'as':_0x177d51['as'],'attributes':_0x177d51[_0x4614('0x12')]};}):[]};}):[]};}):[]:[]})[_0x4614('0x1f')](function(_0x5dcac0){logger[_0x4614('0x16')](_0x4614('0x1c'),_0x5e84d4);logger[_0x4614('0x17')](_0x4614('0x1c'),_0x5e84d4,JSON[_0x4614('0x18')](_0x5dcac0));_0xeda995(_0x5dcac0);})[_0x4614('0x19')](function(_0x5b2cc3){logger['error']('ShowUser',_0x5b2cc3[_0x4614('0x1b')],_0x5e84d4);_0x289de3(_0x157c0c[_0x4614('0x1a')](0x1f4,_0x5b2cc3[_0x4614('0x1b')]));});});};exports[_0x4614('0x20')]=function(_0x141815){var _0x5ccec6;return db['User']['find']({'where':_0x141815[_0x4614('0x10')][_0x4614('0x11')]||{},'attributes':['id',_0x4614('0x21'),_0x4614('0x22'),_0x4614('0x23'),'interface']})['then'](function(_0x5bd75f){if(!_0x5bd75f){throw new Error(util[_0x4614('0x24')](_0x4614('0x25'),_0x141815[_0x4614('0x26')]['id']));}_0x5ccec6=_0x5bd75f;return db[_0x4614('0x27')]['update']({'paused':0x1},{'where':{'UserId':_0x5ccec6['id']},'individualHooks':!![]});})[_0x4614('0x1f')](function(){return db['MemberReport'][_0x4614('0xf')]({'where':{'membername':_0x5ccec6[_0x4614('0x21')],'type':_0x4614('0x28'),'exitAt':null}});})[_0x4614('0x1f')](function(_0x86f13b){if(_0x86f13b&&_0x86f13b[_0x4614('0x29')]){var _0x546e0c=moment()[_0x4614('0x24')](_0x4614('0x2a'));for(var _0x5e199a=0x0,_0x2008d7=_0x86f13b['length'];_0x5e199a<_0x2008d7;_0x5e199a++){_0x86f13b[_0x5e199a][_0x4614('0x2b')]({'exitAt':_0x546e0c});}}})[_0x4614('0x1f')](function(){var _0x3e03bc=[];var _0x7fe60d=utils['getChannels']();_0x7fe60d['forEach'](function(_0x2e4fe2){_0x3e03bc['push']({'channel':_0x2e4fe2,'membername':_0x5ccec6[_0x4614('0x21')],'interface':_[_0x4614('0x2c')](_0x5ccec6['interface'])?util[_0x4614('0x24')](_0x4614('0x2d'),_0x5ccec6[_0x4614('0x21')]):_0x5ccec6[_0x4614('0x2e')],'type':_0x4614('0x28'),'enterAt':moment()[_0x4614('0x24')](_0x4614('0x2a')),'data1':_0x141815[_0x4614('0x2f')]['type']||'DEFAULT\x20PAUSE','role':_0x5ccec6[_0x4614('0x22')],'internal':_0x5ccec6[_0x4614('0x23')],'uniqueid':_0x141815['body'][_0x4614('0x30')]||null});});return db[_0x4614('0x31')]['bulkCreate'](_0x3e03bc,{'individualHooks':!![]});})[_0x4614('0x1f')](function(){return _0x5ccec6[_0x4614('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x141815[_0x4614('0x2f')][_0x4614('0x33')]||_0x4614('0x34'),'lastPauseAt':moment()[_0x4614('0x24')](_0x4614('0x2a'))});})[_0x4614('0x19')](function(_0x69e554){throw _0x69e554;});};exports[_0x4614('0x35')]=function(_0x12f315){return Promise[_0x4614('0x36')]()[_0x4614('0x1f')](function(){if(_0x12f315['body']['channel']&&!utils['isValidChannel'](_0x12f315[_0x4614('0x2f')][_0x4614('0x37')])){throw new Error(util[_0x4614('0x24')](_0x4614('0x38'),_0x12f315[_0x4614('0x2f')][_0x4614('0x37')]));}return db[_0x4614('0xe')][_0x4614('0x39')]({'where':_0x12f315[_0x4614('0x10')][_0x4614('0x11')]||{},'attributes':['id',_0x4614('0x21'),_0x4614('0x22'),'internal','interface','online',_0x4614('0x3a'),'mailPause',_0x4614('0x3b'),_0x4614('0x3c'),_0x4614('0x3d'),_0x4614('0x3e'),_0x4614('0x3f'),_0x4614('0x40'),'lastPauseAt']});})[_0x4614('0x1f')](function(_0x262010){if(!_0x262010){throw new Error(util[_0x4614('0x24')](_0x4614('0x25'),_0x12f315[_0x4614('0x26')]['id']));}return _0x262010['unpause'](_0x12f315[_0x4614('0x2f')][_0x4614('0x37')],_0x4614('0x41'));})['catch'](function(_0x40e11e){throw _0x40e11e;});};exports[_0x4614('0x42')]=function(_0x45d37d){var _0x4d6576=this;return new Promise(function(_0x3ae73f,_0x464878){var _0x1dee67;return db[_0x4614('0xe')][_0x4614('0x39')]({'where':_0x45d37d[_0x4614('0x10')][_0x4614('0x11')]||{},'attributes':['id',_0x4614('0x21')]})[_0x4614('0x1f')](function(_0x7a40f0){if(_0x7a40f0){_0x1dee67=_0x7a40f0;return db[_0x4614('0x27')][_0x4614('0x43')]({'where':{'membername':_0x1dee67['name']},'individualHooks':!![]});}})[_0x4614('0x1f')](function(){if(_0x1dee67){return db[_0x4614('0x31')][_0x4614('0xf')]({'where':{'membername':_0x1dee67[_0x4614('0x21')],'exitAt':null}});}})['then'](function(_0x237f61){if(_0x1dee67){if(_0x237f61&&_0x237f61[_0x4614('0x29')]){var _0x2965c4=[];_0x237f61[_0x4614('0x44')](function(_0x1125b1){_0x2965c4[_0x4614('0x45')](_0x1125b1[_0x4614('0x32')]({'exitAt':moment()[_0x4614('0x24')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2965c4);}}})[_0x4614('0x1f')](function(){if(_0x1dee67){return _0x1dee67['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x4614('0x1f')](function(_0x1ddea4){_0x3ae73f(_0x1ddea4);})[_0x4614('0x19')](function(_0xc2fc99){_0x464878(_0x4d6576['error'](0x1f4,_0xc2fc99['message']));});});};exports['LoginUser']=function(_0x32a3d2){var _0x586d43=this;return new Promise(function(_0x4ee563,_0x1fba11){var _0x2b0e2e;var _0x38c21f;var _0x4c9156;var _0xac98dc;return db['User']['findOne']({'where':_0x32a3d2[_0x4614('0x10')][_0x4614('0x11')]||{},'attributes':['id',_0x4614('0x21'),_0x4614('0x22'),_0x4614('0x46'),_0x4614('0x47'),_0x4614('0x23'),_0x4614('0x48'),'interface']})[_0x4614('0x1f')](function(_0x561c5e){if(_0x561c5e){_0x2b0e2e=_0x561c5e;_0xac98dc=_0x32a3d2[_0x4614('0x2f')]['interface']?_0x32a3d2[_0x4614('0x2f')][_0x4614('0x2e')]:util[_0x4614('0x24')](_0x4614('0x2d'),_0x2b0e2e[_0x4614('0x21')]);return db[_0x4614('0xe')][_0x4614('0x49')]({'where':{'role':_0x4614('0x4a'),'online':!![],'id':{'$ne':_0x2b0e2e['id']}}});}})['then'](function(_0x26856a){if(_0x26856a){_0x4c9156=_0x26856a;return require(_0x4614('0x4b'))[_0x4614('0x4c')]();}})[_0x4614('0x1f')](function(_0xf180b0){if(_0xf180b0&&_0xf180b0[_0x4614('0x4d')]&&_0x4c9156>=_0xf180b0['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x4614('0x1f')](function(){if(_0x2b0e2e){return db[_0x4614('0x27')][_0x4614('0x43')]({'where':{'membername':_0x2b0e2e[_0x4614('0x21')]},'individualHooks':!![]});}})[_0x4614('0x1f')](function(){if(_0x2b0e2e){return _0x2b0e2e[_0x4614('0x4e')]({'raw':!![]});}})['then'](function(_0x276016){if(_0x2b0e2e){if(_0x276016){var _0x516f53=[];_0x38c21f=_0x276016;if(_0x38c21f[_0x4614('0x29')]){for(var _0x17f4d3=0x0;_0x17f4d3<_0x38c21f[_0x4614('0x29')];_0x17f4d3++){_0x516f53[_0x4614('0x45')](db['UserVoiceQueueRt'][_0x4614('0x4f')]({'membername':_0x2b0e2e[_0x4614('0x21')],'UserId':_0x2b0e2e['id'],'queue_name':_0x38c21f[_0x17f4d3][_0x4614('0x21')],'VoiceQueueId':_0x38c21f[_0x17f4d3]['id'],'interface':_0xac98dc,'paused':_0x2b0e2e['loginInPause']||![],'penalty':_0x38c21f[_0x17f4d3]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x4614('0x50')](_0x516f53);}}}})[_0x4614('0x1f')](function(){if(_0x2b0e2e){return db[_0x4614('0x31')]['findAll']({'where':{'membername':_0x2b0e2e[_0x4614('0x21')],'exitAt':null}});}})[_0x4614('0x1f')](function(_0xaac023){if(_0x2b0e2e){if(_0xaac023&&_0xaac023['length']){var _0x2b5806=[];_0xaac023['forEach'](function(_0x3db5bb){_0x2b5806[_0x4614('0x45')](_0x3db5bb[_0x4614('0x32')]({'exitAt':moment()[_0x4614('0x24')](_0x4614('0x2a'))}));});return BPromise['all'](_0x2b5806);}}})[_0x4614('0x1f')](function(){if(_0x2b0e2e){var _0x56ae31=[];var _0x385ebd=[];var _0x4172ea=utils['getChannels']();var _0x11ebff={'membername':_0x2b0e2e[_0x4614('0x21')],'interface':_0xac98dc,'enterAt':moment()['format'](_0x4614('0x2a')),'role':_0x2b0e2e[_0x4614('0x22')],'internal':_0x2b0e2e[_0x4614('0x23')]};_0x4172ea['forEach'](function(_0x107d50){_0x56ae31[_0x4614('0x45')](_[_0x4614('0x51')]({'channel':_0x107d50,'type':_0x4614('0x52'),'data1':_0x4614('0x53'),'data2':_0xac98dc},_0x11ebff));if(_0x2b0e2e[_0x4614('0x48')]){_0x385ebd[_0x4614('0x45')](_[_0x4614('0x51')]({'channel':_0x107d50,'type':_0x4614('0x28'),'data1':_0x4614('0x54')},_0x11ebff));}});return db[_0x4614('0x31')]['bulkCreate'](_0x56ae31[_0x4614('0x55')](_0x385ebd),{'individualHooks':!![]});}})[_0x4614('0x1f')](function(){if(_0x2b0e2e){return _0x2b0e2e[_0x4614('0x32')]({'online':!![],'lastLoginAt':moment()[_0x4614('0x24')](_0x4614('0x2a')),'voicePause':_0x2b0e2e[_0x4614('0x48')]||![],'mailPause':_0x2b0e2e[_0x4614('0x48')]||![],'chatPause':_0x2b0e2e[_0x4614('0x48')]||![],'faxPause':_0x2b0e2e[_0x4614('0x48')]||![],'smsPause':_0x2b0e2e[_0x4614('0x48')]||![],'openchannelPause':_0x2b0e2e[_0x4614('0x48')]||![],'pauseType':_0x2b0e2e[_0x4614('0x48')]?_0x4614('0x54'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xac98dc});}})[_0x4614('0x1f')](function(_0x295b17){_0x4ee563(_0x295b17);})[_0x4614('0x19')](function(_0xcb5d25){_0x1fba11(_0x586d43['error'](0x1f4,_0xcb5d25['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 734226b..2e3574f 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 _0x4ef9=['emit','removeListener','register','length','user:','remove','update'];(function(_0x1a800c,_0x37b923){var _0x2e41f4=function(_0x91398a){while(--_0x91398a){_0x1a800c['push'](_0x1a800c['shift']());}};_0x2e41f4(++_0x37b923);}(_0x4ef9,0xc2));var _0x94ef=function(_0x42276c,_0x141d47){_0x42276c=_0x42276c-0x0;var _0x1b5009=_0x4ef9[_0x42276c];return _0x1b5009;};'use strict';var UserEvents=require('./user.events');var events=['save',_0x94ef('0x0'),_0x94ef('0x1')];function createListener(_0x37b314,_0x2b2ba4){return function(_0x102b0e){_0x2b2ba4[_0x94ef('0x2')](_0x37b314,_0x102b0e);};}function removeListener(_0x1805c0,_0x47e4dd){return function(){UserEvents[_0x94ef('0x3')](_0x1805c0,_0x47e4dd);};}exports[_0x94ef('0x4')]=function(_0x2d1233){for(var _0x4c7571=0x0,_0x48b1d7=events[_0x94ef('0x5')];_0x4c7571<_0x48b1d7;_0x4c7571++){var _0x164083=events[_0x4c7571];var _0x5454a9=createListener(_0x94ef('0x6')+_0x164083,_0x2d1233);UserEvents['on'](_0x164083,_0x5454a9);}}; \ No newline at end of file +var _0x2e04=['emit','removeListener','register','./user.events','save','update'];(function(_0x3c20fa,_0x5ab37a){var _0x3a51f4=function(_0x13c3a8){while(--_0x13c3a8){_0x3c20fa['push'](_0x3c20fa['shift']());}};_0x3a51f4(++_0x5ab37a);}(_0x2e04,0x1d7));var _0x42e0=function(_0x49b47c,_0xe8992e){_0x49b47c=_0x49b47c-0x0;var _0x3472d6=_0x2e04[_0x49b47c];return _0x3472d6;};'use strict';var UserEvents=require(_0x42e0('0x0'));var events=[_0x42e0('0x1'),'remove',_0x42e0('0x2')];function createListener(_0x224314,_0x3d3875){return function(_0x4eeb1e){_0x3d3875[_0x42e0('0x3')](_0x224314,_0x4eeb1e);};}function removeListener(_0x3a1b70,_0x420a98){return function(){UserEvents[_0x42e0('0x4')](_0x3a1b70,_0x420a98);};}exports[_0x42e0('0x5')]=function(_0x4235f9){for(var _0x17d8f3=0x0,_0x29cea6=events['length'];_0x17d8f3<_0x29cea6;_0x17d8f3++){var _0x3e68e4=events[_0x17d8f3];var _0x43a631=createListener('user:'+_0x3e68e4,_0x4235f9);UserEvents['on'](_0x3e68e4,_0x43a631);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 1e924b6..0e5844e 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x42e988,_0xd8abe0){var _0x5ce1fb=function(_0x2531bc){while(--_0x2531bc){_0x42e988['push'](_0x42e988['shift']());}};_0x5ce1fb(++_0xd8abe0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x3447d7,_0x20863c){var _0x42d816=function(_0x3b3cc7){while(--_0x3b3cc7){_0x3447d7['push'](_0x3447d7['shift']());}};_0x42d816(++_0x20863c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b6dbef1..ca411fc 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 _0x8f4e=['INTEGER','sequelize'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0x8f4e,0x149));var _0xe8f4=function(_0x182e58,_0x4fe60d){_0x182e58=_0x182e58-0x0;var _0x49763f=_0x8f4e[_0x182e58];return _0x49763f;};'use strict';var Sequelize=require(_0xe8f4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe8f4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb866=['exports','INTEGER'];(function(_0x381c68,_0x50cc23){var _0x71d40a=function(_0x4c289e){while(--_0x4c289e){_0x381c68['push'](_0x381c68['shift']());}};_0x71d40a(++_0x50cc23);}(_0xb866,0x68));var _0x6b86=function(_0x373978,_0x554e2c){_0x373978=_0x373978-0x0;var _0x585a1e=_0xb866[_0x373978];return _0x585a1e;};'use strict';var Sequelize=require('sequelize');module[_0x6b86('0x0')]={'penalty':{'type':Sequelize[_0x6b86('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 d54afeb..15e2fff 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 _0x412a=['bluebird','rimraf','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','api','moment'];(function(_0x1eba45,_0x407d7c){var _0x2b809c=function(_0x2d386f){while(--_0x2d386f){_0x1eba45['push'](_0x1eba45['shift']());}};_0x2b809c(++_0x407d7c);}(_0x412a,0x146));var _0xa412=function(_0x411242,_0x195c15){_0x411242=_0x411242-0x0;var _0x130ca3=_0x412a[_0x411242];return _0x130ca3;};'use strict';var _=require(_0xa412('0x0'));var util=require(_0xa412('0x1'));var logger=require('../../config/logger')(_0xa412('0x2'));var moment=require(_0xa412('0x3'));var BPromise=require(_0xa412('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa412('0x5'));var config=require('../../config/environment');var attributes=require(_0xa412('0x6'));module[_0xa412('0x7')]=function(_0xaa883c,_0x52bc05){return _0xaa883c[_0xa412('0x8')]('UserChatQueue',attributes,{'tableName':_0xa412('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c1f=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x8c1f,0x17c));var _0xf8c1=function(_0x2693d3,_0x1c2868){_0x2693d3=_0x2693d3-0x0;var _0x35a272=_0x8c1f[_0x2693d3];return _0x35a272;};'use strict';var _=require(_0xf8c1('0x0'));var util=require(_0xf8c1('0x1'));var logger=require(_0xf8c1('0x2'))(_0xf8c1('0x3'));var moment=require(_0xf8c1('0x4'));var BPromise=require(_0xf8c1('0x5'));var rp=require(_0xf8c1('0x6'));var fs=require('fs');var path=require(_0xf8c1('0x7'));var rimraf=require(_0xf8c1('0x8'));var config=require(_0xf8c1('0x9'));var attributes=require(_0xf8c1('0xa'));module[_0xf8c1('0xb')]=function(_0x4fb011,_0x3e8937){return _0x4fb011[_0xf8c1('0xc')](_0xf8c1('0xd'),attributes,{'tableName':_0xf8c1('0xe'),'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 bc1f206..f15d488 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 _0x4446=['error','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x37f8dc,_0x1c7eee){var _0x3f07e3=function(_0x2efc22){while(--_0x2efc22){_0x37f8dc['push'](_0x37f8dc['shift']());}};_0x3f07e3(++_0x1c7eee);}(_0x4446,0x1b3));var _0x6444=function(_0x18aeb6,_0x18575c){_0x18aeb6=_0x18aeb6-0x0;var _0x41579c=_0x4446[_0x18aeb6];return _0x41579c;};'use strict';var _=require(_0x6444('0x0'));var util=require(_0x6444('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6444('0x2'));var db=require(_0x6444('0x3'))['db'];var utils=require(_0x6444('0x4'));var logger=require('../../config/logger')(_0x6444('0x5'));var config=require(_0x6444('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6444('0x7')][_0x6444('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d323b,_0x1bb72b,_0xcc5e4a){return new BPromise(function(_0x2c78b4,_0x3a25cc){return client[_0x6444('0x9')](_0x2d323b,_0xcc5e4a)['then'](function(_0x11882e){logger[_0x6444('0xa')](_0x6444('0xb'),_0x1bb72b,_0x6444('0xc'));logger['debug'](_0x6444('0xd'),_0x1bb72b,_0x6444('0xc'),JSON[_0x6444('0xe')](_0x11882e));if(_0x11882e['error']){if(_0x11882e['error']['code']===0x1f4){logger[_0x6444('0xf')](_0x6444('0xb'),_0x1bb72b,_0x11882e[_0x6444('0xf')][_0x6444('0x10')]);return _0x3a25cc(_0x11882e[_0x6444('0xf')][_0x6444('0x10')]);}logger['error'](_0x6444('0xb'),_0x1bb72b,_0x11882e[_0x6444('0xf')][_0x6444('0x10')]);return _0x2c78b4(_0x11882e['error'][_0x6444('0x10')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x1bb72b,_0x6444('0xc'));_0x2c78b4(_0x11882e[_0x6444('0x11')][_0x6444('0x10')]);}})['catch'](function(_0x909aed){logger[_0x6444('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x1bb72b,_0x909aed);_0x3a25cc(_0x909aed);});});} \ No newline at end of file +var _0xc0e8=['../../config/environment','jayson/promise','client','http','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x11eb54,_0x1b38b7){var _0x919d4a=function(_0x423a2e){while(--_0x423a2e){_0x11eb54['push'](_0x11eb54['shift']());}};_0x919d4a(++_0x1b38b7);}(_0xc0e8,0x150));var _0x8c0e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0e8[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x8c0e('0x0'));var util=require(_0x8c0e('0x1'));var moment=require(_0x8c0e('0x2'));var BPromise=require(_0x8c0e('0x3'));var rs=require(_0x8c0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c0e('0x5'))['db'];var utils=require(_0x8c0e('0x6'));var logger=require(_0x8c0e('0x7'))(_0x8c0e('0x8'));var config=require(_0x8c0e('0x9'));var jayson=require(_0x8c0e('0xa'));var client=jayson[_0x8c0e('0xb')][_0x8c0e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39ca50,_0x5cd689,_0x4123b7){return new BPromise(function(_0x51f173,_0x27de31){return client['request'](_0x39ca50,_0x4123b7)[_0x8c0e('0xd')](function(_0x4e9816){logger['info'](_0x8c0e('0xe'),_0x5cd689,_0x8c0e('0xf'));logger[_0x8c0e('0x10')](_0x8c0e('0x11'),_0x5cd689,_0x8c0e('0xf'),JSON['stringify'](_0x4e9816));if(_0x4e9816['error']){if(_0x4e9816['error']['code']===0x1f4){logger[_0x8c0e('0x12')](_0x8c0e('0xe'),_0x5cd689,_0x4e9816[_0x8c0e('0x12')][_0x8c0e('0x13')]);return _0x27de31(_0x4e9816[_0x8c0e('0x12')]['message']);}logger[_0x8c0e('0x12')](_0x8c0e('0xe'),_0x5cd689,_0x4e9816[_0x8c0e('0x12')][_0x8c0e('0x13')]);return _0x51f173(_0x4e9816[_0x8c0e('0x12')][_0x8c0e('0x13')]);}else{logger[_0x8c0e('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x5cd689,_0x8c0e('0xf'));_0x51f173(_0x4e9816[_0x8c0e('0x15')]['message']);}})[_0x8c0e('0x16')](function(_0x15e3ab){logger[_0x8c0e('0x12')](_0x8c0e('0xe'),_0x5cd689,_0x15e3ab);_0x27de31(_0x15e3ab);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 24a3e29..5cfbe17 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5dfcdf,_0x285e69){var _0xd97fa1=function(_0x45c6fa){while(--_0x45c6fa){_0x5dfcdf['push'](_0x5dfcdf['shift']());}};_0xd97fa1(++_0x285e69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x54da5b,_0x12fd71){var _0x285d3b=function(_0x4dea38){while(--_0x4dea38){_0x54da5b['push'](_0x54da5b['shift']());}};_0x285d3b(++_0x12fd71);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index dd8a848..cf9bff0 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 _0x222a=['exports','INTEGER','sequelize'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x222a,0xad));var _0xa222=function(_0x2e21dc,_0x544c93){_0x2e21dc=_0x2e21dc-0x0;var _0x4487b6=_0x222a[_0x2e21dc];return _0x4487b6;};'use strict';var Sequelize=require(_0xa222('0x0'));module[_0xa222('0x1')]={'penalty':{'type':Sequelize[_0xa222('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa222('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe5f3=['exports','STRING'];(function(_0x4b3f65,_0x54c3e0){var _0x4cab12=function(_0x55c75a){while(--_0x55c75a){_0x4b3f65['push'](_0x4b3f65['shift']());}};_0x4cab12(++_0x54c3e0);}(_0xe5f3,0x122));var _0x3e5f=function(_0x4ceca3,_0x56e3c4){_0x4ceca3=_0x4ceca3-0x0;var _0x5dd7c7=_0xe5f3[_0x4ceca3];return _0x5dd7c7;};'use strict';var Sequelize=require('sequelize');module[_0x3e5f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3e5f('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 7c7b61a..3bd96f0 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 _0xbf53=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues'];(function(_0x837c3b,_0x19c527){var _0x277180=function(_0x5aee7b){while(--_0x5aee7b){_0x837c3b['push'](_0x837c3b['shift']());}};_0x277180(++_0x19c527);}(_0xbf53,0x111));var _0x3bf5=function(_0x214393,_0x243463){_0x214393=_0x214393-0x0;var _0x38be1a=_0xbf53[_0x214393];return _0x38be1a;};'use strict';var _=require('lodash');var util=require(_0x3bf5('0x0'));var logger=require(_0x3bf5('0x1'))(_0x3bf5('0x2'));var moment=require(_0x3bf5('0x3'));var BPromise=require(_0x3bf5('0x4'));var rp=require(_0x3bf5('0x5'));var fs=require('fs');var path=require(_0x3bf5('0x6'));var rimraf=require('rimraf');var config=require(_0x3bf5('0x7'));var attributes=require(_0x3bf5('0x8'));module[_0x3bf5('0x9')]=function(_0x1c5381,_0xb01d25){return _0x1c5381[_0x3bf5('0xa')](_0x3bf5('0xb'),attributes,{'tableName':_0x3bf5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc795=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','../../config/logger','moment','bluebird'];(function(_0x4504c8,_0x3440ed){var _0x5065fd=function(_0x5ef45a){while(--_0x5ef45a){_0x4504c8['push'](_0x4504c8['shift']());}};_0x5065fd(++_0x3440ed);}(_0xc795,0x111));var _0x5c79=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc795[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c79('0x0'))('api');var moment=require(_0x5c79('0x1'));var BPromise=require(_0x5c79('0x2'));var rp=require(_0x5c79('0x3'));var fs=require('fs');var path=require(_0x5c79('0x4'));var rimraf=require(_0x5c79('0x5'));var config=require(_0x5c79('0x6'));var attributes=require(_0x5c79('0x7'));module[_0x5c79('0x8')]=function(_0x133655,_0x3c1d43){return _0x133655[_0x5c79('0x9')](_0x5c79('0xa'),attributes,{'tableName':_0x5c79('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 159afc8..5405853 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 _0x647e=['info','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserFaxQueue,\x20%s,\x20%s','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x32c108,_0x35f155){var _0x4b2cf2=function(_0x11b8b9){while(--_0x11b8b9){_0x32c108['push'](_0x32c108['shift']());}};_0x4b2cf2(++_0x35f155);}(_0x647e,0x18e));var _0xe647=function(_0x4455b7,_0x4ec866){_0x4455b7=_0x4455b7-0x0;var _0xd68c91=_0x647e[_0x4455b7];return _0xd68c91;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe647('0x0'));var BPromise=require(_0xe647('0x1'));var rs=require(_0xe647('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe647('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe647('0x4'));var config=require(_0xe647('0x5'));var jayson=require(_0xe647('0x6'));var client=jayson[_0xe647('0x7')][_0xe647('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3789a0,_0x54931d,_0x3fe9ae){return new BPromise(function(_0x4d6f21,_0x239e71){return client[_0xe647('0x9')](_0x3789a0,_0x3fe9ae)['then'](function(_0x2680f0){logger[_0xe647('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x54931d,'request\x20sent');logger['debug'](_0xe647('0xb'),_0x54931d,_0xe647('0xc'),JSON[_0xe647('0xd')](_0x2680f0));if(_0x2680f0[_0xe647('0xe')]){if(_0x2680f0['error']['code']===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x54931d,_0x2680f0[_0xe647('0xe')][_0xe647('0xf')]);return _0x239e71(_0x2680f0[_0xe647('0xe')][_0xe647('0xf')]);}logger['error'](_0xe647('0x10'),_0x54931d,_0x2680f0['error'][_0xe647('0xf')]);return _0x4d6f21(_0x2680f0[_0xe647('0xe')][_0xe647('0xf')]);}else{logger[_0xe647('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x54931d,_0xe647('0xc'));_0x4d6f21(_0x2680f0['result']['message']);}})['catch'](function(_0x666b1f){logger[_0xe647('0xe')](_0xe647('0x10'),_0x54931d,_0x666b1f);_0x239e71(_0x666b1f);});});} \ No newline at end of file +var _0xfd58=['error','code','message','UserFaxQueue,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xfd58,0x73));var _0x8fd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8fd5('0x0'));var BPromise=require(_0x8fd5('0x1'));var rs=require(_0x8fd5('0x2'));var fs=require('fs');var Redis=require(_0x8fd5('0x3'));var db=require(_0x8fd5('0x4'))['db'];var utils=require(_0x8fd5('0x5'));var logger=require(_0x8fd5('0x6'))(_0x8fd5('0x7'));var config=require(_0x8fd5('0x8'));var jayson=require(_0x8fd5('0x9'));var client=jayson[_0x8fd5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1500d8,_0x509a34,_0x12f70b){return new BPromise(function(_0x5327c0,_0x124f90){return client[_0x8fd5('0xb')](_0x1500d8,_0x12f70b)[_0x8fd5('0xc')](function(_0xbb3080){logger[_0x8fd5('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x509a34,_0x8fd5('0xe'));logger['debug'](_0x8fd5('0xf'),_0x509a34,_0x8fd5('0xe'),JSON[_0x8fd5('0x10')](_0xbb3080));if(_0xbb3080[_0x8fd5('0x11')]){if(_0xbb3080['error'][_0x8fd5('0x12')]===0x1f4){logger[_0x8fd5('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x509a34,_0xbb3080[_0x8fd5('0x11')][_0x8fd5('0x13')]);return _0x124f90(_0xbb3080[_0x8fd5('0x11')][_0x8fd5('0x13')]);}logger[_0x8fd5('0x11')](_0x8fd5('0x14'),_0x509a34,_0xbb3080[_0x8fd5('0x11')][_0x8fd5('0x13')]);return _0x5327c0(_0xbb3080[_0x8fd5('0x11')]['message']);}else{logger[_0x8fd5('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x509a34,'request\x20sent');_0x5327c0(_0xbb3080['result'][_0x8fd5('0x13')]);}})[_0x8fd5('0x15')](function(_0x57561a){logger[_0x8fd5('0x11')](_0x8fd5('0x14'),_0x509a34,_0x57561a);_0x124f90(_0x57561a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 23756c2..95bfb06 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xcd4e86,_0x10338c){var _0x3b10ed=function(_0x136a41){while(--_0x136a41){_0xcd4e86['push'](_0xcd4e86['shift']());}};_0x3b10ed(++_0x10338c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4a6a4c,_0x5149d1){var _0xdb0e5b=function(_0x319640){while(--_0x319640){_0x4a6a4c['push'](_0x4a6a4c['shift']());}};_0xdb0e5b(++_0x5149d1);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index eaab14b..b57f4ea 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe51=['INTEGER','sequelize','exports'];(function(_0x4e3069,_0x53b483){var _0x3bec81=function(_0x3bc69b){while(--_0x3bc69b){_0x4e3069['push'](_0x4e3069['shift']());}};_0x3bec81(++_0x53b483);}(_0xfe51,0x1ab));var _0x1fe5=function(_0x38d2ba,_0x388571){_0x38d2ba=_0x38d2ba-0x0;var _0x287cb6=_0xfe51[_0x38d2ba];return _0x287cb6;};'use strict';var Sequelize=require(_0x1fe5('0x0'));module[_0x1fe5('0x1')]={'penalty':{'type':Sequelize[_0x1fe5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x43d1=['sequelize','exports','INTEGER'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x43d1,0x1ec));var _0x143d=function(_0x305e1c,_0x5522d8){_0x305e1c=_0x305e1c-0x0;var _0x5d13bc=_0x43d1[_0x305e1c];return _0x5d13bc;};'use strict';var Sequelize=require(_0x143d('0x0'));module[_0x143d('0x1')]={'penalty':{'type':Sequelize[_0x143d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index bf3dcac..561de08 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 _0xbdbe=['./userMailQueue.attributes','exports','define','user_has_mail_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3437ea,_0x23afa0){var _0x25b21d=function(_0x32c6a5){while(--_0x32c6a5){_0x3437ea['push'](_0x3437ea['shift']());}};_0x25b21d(++_0x23afa0);}(_0xbdbe,0x14e));var _0xebdb=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xbdbe[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0xebdb('0x0'));var logger=require(_0xebdb('0x1'))(_0xebdb('0x2'));var moment=require('moment');var BPromise=require(_0xebdb('0x3'));var rp=require(_0xebdb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebdb('0x5'));var config=require(_0xebdb('0x6'));var attributes=require(_0xebdb('0x7'));module[_0xebdb('0x8')]=function(_0x46b3e2,_0xd4f872){return _0x46b3e2[_0xebdb('0x9')]('UserMailQueue',attributes,{'tableName':_0xebdb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af6=['path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','bluebird','request-promise'];(function(_0x2d745c,_0x1a22e9){var _0x589dad=function(_0xd61a3f){while(--_0xd61a3f){_0x2d745c['push'](_0x2d745c['shift']());}};_0x589dad(++_0x1a22e9);}(_0x4af6,0x165));var _0x64af=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4af6[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x64af('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x64af('0x1'));var rp=require(_0x64af('0x2'));var fs=require('fs');var path=require(_0x64af('0x3'));var rimraf=require('rimraf');var config=require(_0x64af('0x4'));var attributes=require(_0x64af('0x5'));module[_0x64af('0x6')]=function(_0x374080,_0x41483b){return _0x374080[_0x64af('0x7')](_0x64af('0x8'),attributes,{'tableName':_0x64af('0x9'),'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 92941a0..e992785 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 _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(_0x497c8e,_0x3987fc){var _0x496b4d=function(_0x500e88){while(--_0x500e88){_0x497c8e['push'](_0x497c8e['shift']());}};_0x496b4d(++_0x3987fc);}(_0x55ca,0x126));var _0xa55c=function(_0xefef6f,_0x5f9f66){_0xefef6f=_0xefef6f-0x0;var _0x454173=_0x55ca[_0xefef6f];return _0x454173;};'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 +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3f93c7,_0x27d64c){_0x3f93c7=_0x3f93c7-0x0;var _0x298174=_0x1cb9[_0x3f93c7];return _0x298174;};'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')]('UserMailQueue,\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/userNotification/index.js b/server/api/userNotification/index.js index 9cbd9b4..43672ea 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 _0xa27a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x7fab38,_0x501063){var _0xb5c718=function(_0x471181){while(--_0x471181){_0x7fab38['push'](_0x7fab38['shift']());}};_0xb5c718(++_0x501063);}(_0xa27a,0x135));var _0xaa27=function(_0x1fbeaf,_0x256fbd){_0x1fbeaf=_0x1fbeaf-0x0;var _0x13daa3=_0xa27a[_0x1fbeaf];return _0x13daa3;};'use strict';var multer=require(_0xaa27('0x0'));var util=require(_0xaa27('0x1'));var path=require(_0xaa27('0x2'));var timeout=require(_0xaa27('0x3'));var express=require(_0xaa27('0x4'));var router=express[_0xaa27('0x5')]();var fs_extra=require(_0xaa27('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaa27('0x7'));var config=require(_0xaa27('0x8'));var controller=require(_0xaa27('0x9'));router[_0xaa27('0xa')]('/',auth[_0xaa27('0xb')](),controller[_0xaa27('0xc')]);module[_0xaa27('0xd')]=router; \ No newline at end of file +var _0x9959=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','sendUserNotification','exports'];(function(_0x85084a,_0x499f6a){var _0x441c9b=function(_0x21c017){while(--_0x21c017){_0x85084a['push'](_0x85084a['shift']());}};_0x441c9b(++_0x499f6a);}(_0x9959,0xf3));var _0x9995=function(_0x1519c7,_0x50aabf){_0x1519c7=_0x1519c7-0x0;var _0x51c3df=_0x9959[_0x1519c7];return _0x51c3df;};'use strict';var multer=require('multer');var util=require(_0x9995('0x0'));var path=require('path');var timeout=require(_0x9995('0x1'));var express=require(_0x9995('0x2'));var router=express[_0x9995('0x3')]();var fs_extra=require(_0x9995('0x4'));var auth=require(_0x9995('0x5'));var interaction=require(_0x9995('0x6'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router['post']('/',auth['isAuthenticated'](),controller[_0x9995('0x7')]);module[_0x9995('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index cfb355c..f6ff8df 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 _0xcfe6=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x573a88,_0x471dd2){var _0x313a5e=function(_0x5139e1){while(--_0x5139e1){_0x573a88['push'](_0x573a88['shift']());}};_0x313a5e(++_0x471dd2);}(_0xcfe6,0x18f));var _0x6cfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfe6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6cfe('0x0'));module[_0x6cfe('0x1')]={'body':{'type':Sequelize[_0x6cfe('0x2')]},'senderName':{'type':Sequelize[_0x6cfe('0x3')]},'recipientsId':{'type':Sequelize[_0x6cfe('0x2')]},'recipientsDescription':{'type':Sequelize[_0x6cfe('0x3')]},'beep':{'type':Sequelize[_0x6cfe('0x4')]}}; \ No newline at end of file +var _0x4c8a=['TEXT','STRING','sequelize','exports'];(function(_0x5749a3,_0x13ceca){var _0x35b36b=function(_0x2f262d){while(--_0x2f262d){_0x5749a3['push'](_0x5749a3['shift']());}};_0x35b36b(++_0x13ceca);}(_0x4c8a,0x18a));var _0xa4c8=function(_0x4211cf,_0xecfcd9){_0x4211cf=_0x4211cf-0x0;var _0x33e246=_0x4c8a[_0x4211cf];return _0x33e246;};'use strict';var Sequelize=require(_0xa4c8('0x0'));module[_0xa4c8('0x1')]={'body':{'type':Sequelize[_0xa4c8('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xa4c8('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa4c8('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index eb37ba6..d9312d9 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 _0x5c8a=['text','body','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','then','forEach','recipient','emit','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','User','ids','queue','replace','Queue','push','all','flatten','findOne','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','destroy','sendStatus','error','stack','name','send','sendUserNotification','hasOwnProperty'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5c8a,0x108));var _0xa5c8=function(_0xaf509c,_0x5ba717){_0xaf509c=_0xaf509c-0x0;var _0xb8c7c4=_0x5c8a[_0xaf509c];return _0xb8c7c4;};'use strict';var emlformat=require(_0xa5c8('0x0'));var rimraf=require(_0xa5c8('0x1'));var zipdir=require(_0xa5c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5c8('0x3'));var moment=require(_0xa5c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5c8('0x5'));var util=require(_0xa5c8('0x6'));var path=require(_0xa5c8('0x7'));var sox=require(_0xa5c8('0x8'));var csv=require(_0xa5c8('0x9'));var ejs=require(_0xa5c8('0xa'));var fs=require('fs');var fs_extra=require(_0xa5c8('0xb'));var _=require(_0xa5c8('0xc'));var squel=require(_0xa5c8('0xd'));var crypto=require('crypto');var jsforce=require(_0xa5c8('0xe'));var deskjs=require(_0xa5c8('0xf'));var toCsv=require(_0xa5c8('0x9'));var querystring=require(_0xa5c8('0x10'));var Papa=require(_0xa5c8('0x11'));var Redis=require(_0xa5c8('0x12'));var authService=require(_0xa5c8('0x13'));var qs=require(_0xa5c8('0x14'));var as=require(_0xa5c8('0x15'));var hardwareService=require(_0xa5c8('0x16'));var logger=require(_0xa5c8('0x17'))(_0xa5c8('0x18'));var utils=require(_0xa5c8('0x19'));var config=require(_0xa5c8('0x1a'));var licenseUtil=require(_0xa5c8('0x1b'));var db=require(_0xa5c8('0x1c'))['db'];config[_0xa5c8('0x1d')]=_[_0xa5c8('0x1e')](config[_0xa5c8('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xa5c8('0x1f'))(new Redis(config[_0xa5c8('0x1d')]));require(_0xa5c8('0x20'))['register'](socket);function respondWithStatusCode(_0xb10c58,_0x57a94b){_0x57a94b=_0x57a94b||0xcc;return function(_0x558257){if(_0x558257){return _0xb10c58['sendStatus'](_0x57a94b);}return _0xb10c58[_0xa5c8('0x21')](_0x57a94b)[_0xa5c8('0x22')]();};}function respondWithResult(_0x4a3431,_0x11ae68){_0x11ae68=_0x11ae68||0xc8;return function(_0x2f92a6){if(_0x2f92a6){return _0x4a3431[_0xa5c8('0x21')](_0x11ae68)[_0xa5c8('0x23')](_0x2f92a6);}};}function respondWithFilteredResult(_0x348948,_0x446887){return function(_0x23774e){if(_0x23774e){var _0x12d129=typeof _0x446887[_0xa5c8('0x24')]===_0xa5c8('0x25')&&typeof _0x446887[_0xa5c8('0x26')]===_0xa5c8('0x25');var _0x12aa88=_0x23774e['count'];var _0x3fabd7=_0x12d129?0x0:_0x446887['offset'];var _0x3a8353=_0x12d129?_0x23774e['count']:_0x446887['offset']+_0x446887[_0xa5c8('0x26')];var _0x19c167;if(_0x3a8353>=_0x12aa88){_0x3a8353=_0x12aa88;_0x19c167=0xc8;}else{_0x19c167=0xce;}_0x348948[_0xa5c8('0x21')](_0x19c167);return _0x348948[_0xa5c8('0x27')](_0xa5c8('0x28'),_0x3fabd7+'-'+_0x3a8353+'/'+_0x12aa88)[_0xa5c8('0x23')](_0x23774e);}return null;};}function patchUpdates(_0x1f1df7){return function(_0x6fa1ec){try{jsonpatch[_0xa5c8('0x29')](_0x6fa1ec,_0x1f1df7,!![]);}catch(_0x3d4d82){return BPromise[_0xa5c8('0x2a')](_0x3d4d82);}return _0x6fa1ec['save']();};}function saveUpdates(_0x1aa5ab,_0x12f3e3){return function(_0x4ffbc5){if(_0x4ffbc5){return _0x4ffbc5['update'](_0x1aa5ab)['then'](function(_0x1a6d9a){return _0x1a6d9a;});}return null;};}function removeEntity(_0x3d0053,_0x197620){return function(_0x502bd6){if(_0x502bd6){return _0x502bd6[_0xa5c8('0x2b')]()['then'](function(){_0x3d0053[_0xa5c8('0x21')](0xcc)[_0xa5c8('0x22')]();});}};}function handleEntityNotFound(_0x7df66e,_0x2800a6){return function(_0xf2ab0e){if(!_0xf2ab0e){_0x7df66e[_0xa5c8('0x2c')](0x194);}return _0xf2ab0e;};}function handleError(_0x35fb07,_0x499e41){_0x499e41=_0x499e41||0x1f4;return function(_0x3834d9){logger[_0xa5c8('0x2d')](_0x3834d9[_0xa5c8('0x2e')]);if(_0x3834d9[_0xa5c8('0x2f')]){delete _0x3834d9[_0xa5c8('0x2f')];}_0x35fb07[_0xa5c8('0x21')](_0x499e41)[_0xa5c8('0x30')](_0x3834d9);};}exports[_0xa5c8('0x31')]=function(_0x15256d,_0x1cbbda,_0x414c27){if(!_0x15256d['body'][_0xa5c8('0x32')](_0xa5c8('0x33'))&&!_0x15256d[_0xa5c8('0x34')][_0xa5c8('0x32')]('TemplateId')){throw new db[(_0xa5c8('0x35'))][(_0xa5c8('0x36'))](_0xa5c8('0x37'));}else{if(_0x15256d['body'][_0xa5c8('0x32')](_0xa5c8('0x38'))&&!_0x15256d[_0xa5c8('0x34')]['hasOwnProperty']('view')){throw new db['Sequelize']['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x15256d[_0xa5c8('0x34')][_0xa5c8('0x32')](_0xa5c8('0x39'))){throw new db[(_0xa5c8('0x35'))][(_0xa5c8('0x36'))](_0xa5c8('0x3a'));}else{try{var _0x416527=JSON[_0xa5c8('0x3b')](_0x15256d[_0xa5c8('0x34')][_0xa5c8('0x39')]);}catch(_0x3447de){logger[_0xa5c8('0x2d')](_0x3447de);throw new db['Sequelize'][(_0xa5c8('0x36'))](_0xa5c8('0x3c'));}var _0x30dfe6=[_0xa5c8('0x3d'),'faxqueue',_0xa5c8('0x3e'),_0xa5c8('0x3f'),_0xa5c8('0x40'),_0xa5c8('0x41'),_0xa5c8('0x42'),_0xa5c8('0x43'),_0xa5c8('0x44')];if(_[_0xa5c8('0x45')](_0x416527,function(_0x2375e5){return!_[_0xa5c8('0x46')](_0x30dfe6,_0x2375e5[_0xa5c8('0x47')]['toLowerCase']());})){throw new db[(_0xa5c8('0x35'))][(_0xa5c8('0x36'))](_0xa5c8('0x48'));}}}var _0x3a41d2={};_0x3a41d2[_0xa5c8('0x49')]=_0x15256d['body'][_0xa5c8('0x32')](_0xa5c8('0x49'))?_0x15256d['body'][_0xa5c8('0x49')]:_0x15256d[_0xa5c8('0x44')][_0xa5c8('0x4a')];_0x3a41d2['recipientsDescription']=_[_0xa5c8('0x4b')](_0x15256d[_0xa5c8('0x34')][_0xa5c8('0x4c')])?null:_0x15256d[_0xa5c8('0x34')][_0xa5c8('0x4c')];_0x3a41d2['beep']=_0x15256d['body'][_0xa5c8('0x4d')]||![];_0x3a41d2[_0xa5c8('0x4e')]=_0x15256d['user']['id'];return getContent(_0x15256d[_0xa5c8('0x34')])['then'](function(_0x436185){_0x3a41d2[_0xa5c8('0x34')]=_0x436185;return getRecipients(_0x416527);})['then'](function(_0x29fbbf){_0x3a41d2[_0xa5c8('0x4f')]=_[_0xa5c8('0x50')](_0x29fbbf)[_0xa5c8('0x51')](',');return db['sequelize'][_0xa5c8('0x52')](function(_0x5ccb51){return db[_0xa5c8('0x53')][_0xa5c8('0x54')](_0x3a41d2,{'raw':!![],'transaction':_0x5ccb51})[_0xa5c8('0x55')](function(_0x588853){var _0x4c96e1={'sender':_0x3a41d2['senderName'],'description':_0x3a41d2[_0xa5c8('0x4c')],'content':_0x3a41d2[_0xa5c8('0x34')],'beep':_0x3a41d2['beep']};_0x29fbbf[_0xa5c8('0x56')](function(_0x4e9243){_0x4c96e1[_0xa5c8('0x57')]=_0x4e9243;socket[_0xa5c8('0x58')]('userNotification:send',_0x4c96e1);});return _0x588853;});});})[_0xa5c8('0x55')](respondWithResult(_0x1cbbda,0xc9))[_0xa5c8('0x59')](handleError(_0x1cbbda,null));};function getContent(_0x43179f){return new BPromise(function(_0x47912b,_0xbb7093){if(_0x43179f[_0xa5c8('0x33')]){_0x47912b(_0x43179f[_0xa5c8('0x33')]);return;}return db[_0xa5c8('0x5a')]['findOne']({'attributes':[_0xa5c8('0x5b')],'where':{'id':_0x43179f[_0xa5c8('0x38')]},'raw':!![]})[_0xa5c8('0x55')](function(_0x9e3db6){if(!_0x9e3db6)throw new db[(_0xa5c8('0x35'))][(_0xa5c8('0x36'))](_0xa5c8('0x5c'));var _0x126717=Mustache[_0xa5c8('0x5d')](_0x9e3db6['html'],_0x43179f[_0xa5c8('0x5e')]);_0x47912b(_0x126717);})[_0xa5c8('0x59')](function(_0x4eddbd){_0xbb7093(_0x4eddbd);});});}function getRecipients(_0x4d3fb2){return new BPromise(function(_0x234f7c,_0x109db0){var _0x2df0ad=[];var _0x516188=[];_0x4d3fb2[_0xa5c8('0x56')](function(_0x3c7e27){var _0x14c84d=_['startCase'](_0x3c7e27[_0xa5c8('0x47')]['toLowerCase']());if(_0x14c84d===_0xa5c8('0x5f')){_0x2df0ad=_['union'](_0x2df0ad,_0x3c7e27[_0xa5c8('0x60')]);}else{if(_[_0xa5c8('0x46')](_0x14c84d,_0xa5c8('0x61')))_0x14c84d=_0x14c84d[_0xa5c8('0x62')](_0xa5c8('0x61'),_0xa5c8('0x63'));_0x3c7e27['ids'][_0xa5c8('0x56')](function(_0x220e5b){_0x516188[_0xa5c8('0x64')](getAgents(_0x14c84d,_0x220e5b));});}});return BPromise[_0xa5c8('0x65')](_0x516188)['then'](function(_0x21358a){_0x2df0ad=_['union'](_0x2df0ad,_[_0xa5c8('0x66')](_0x21358a));_0x234f7c(_0x2df0ad);})[_0xa5c8('0x59')](function(_0x22c0dd){_0x109db0(_0x22c0dd);});});}function getAgents(_0x1064de,_0x344f82){return new BPromise(function(_0x17a85f,_0x144c53){return db[_0x1064de][_0xa5c8('0x67')]({'where':{'id':_0x344f82}})[_0xa5c8('0x55')](function(_0x2ec8fe){return _0x2ec8fe[_0xa5c8('0x68')]({'attributes':['id'],'raw':!![]})[_0xa5c8('0x55')](function(_0x1bb0ed){var _0xb7c5ec=_['map'](_0x1bb0ed,'id');_0x17a85f(_0xb7c5ec);});})['catch'](function(_0x570a02){_0x144c53(_0x570a02);});});} \ No newline at end of file +var _0xa80e=['userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','queue','replace','Queue','ids','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','sendUserNotification','body','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa80e,0x146));var _0xea80=function(_0x37fffb,_0x581ac0){_0x37fffb=_0x37fffb-0x0;var _0x34a7d8=_0xa80e[_0x37fffb];return _0x34a7d8;};'use strict';var emlformat=require(_0xea80('0x0'));var rimraf=require(_0xea80('0x1'));var zipdir=require(_0xea80('0x2'));var jsonpatch=require(_0xea80('0x3'));var rp=require(_0xea80('0x4'));var moment=require(_0xea80('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xea80('0x6'));var util=require(_0xea80('0x7'));var path=require(_0xea80('0x8'));var sox=require(_0xea80('0x9'));var csv=require(_0xea80('0xa'));var ejs=require(_0xea80('0xb'));var fs=require('fs');var fs_extra=require(_0xea80('0xc'));var _=require('lodash');var squel=require(_0xea80('0xd'));var crypto=require(_0xea80('0xe'));var jsforce=require(_0xea80('0xf'));var deskjs=require(_0xea80('0x10'));var toCsv=require(_0xea80('0xa'));var querystring=require('querystring');var Papa=require(_0xea80('0x11'));var Redis=require(_0xea80('0x12'));var authService=require(_0xea80('0x13'));var qs=require(_0xea80('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea80('0x15'))('api');var utils=require(_0xea80('0x16'));var config=require(_0xea80('0x17'));var licenseUtil=require(_0xea80('0x18'));var db=require(_0xea80('0x19'))['db'];config['redis']=_['defaults'](config[_0xea80('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xea80('0x1b'))(new Redis(config['redis']));require(_0xea80('0x1c'))[_0xea80('0x1d')](socket);function respondWithStatusCode(_0x4150cb,_0x2352c0){_0x2352c0=_0x2352c0||0xcc;return function(_0x54b61a){if(_0x54b61a){return _0x4150cb['sendStatus'](_0x2352c0);}return _0x4150cb[_0xea80('0x1e')](_0x2352c0)[_0xea80('0x1f')]();};}function respondWithResult(_0xbd0003,_0x38fc92){_0x38fc92=_0x38fc92||0xc8;return function(_0x2c3468){if(_0x2c3468){return _0xbd0003[_0xea80('0x1e')](_0x38fc92)[_0xea80('0x20')](_0x2c3468);}};}function respondWithFilteredResult(_0x255967,_0xc5edcb){return function(_0x4fee08){if(_0x4fee08){var _0x23d623=typeof _0xc5edcb[_0xea80('0x21')]===_0xea80('0x22')&&typeof _0xc5edcb[_0xea80('0x23')]===_0xea80('0x22');var _0x1265b1=_0x4fee08[_0xea80('0x24')];var _0x145505=_0x23d623?0x0:_0xc5edcb[_0xea80('0x21')];var _0x206e74=_0x23d623?_0x4fee08['count']:_0xc5edcb['offset']+_0xc5edcb[_0xea80('0x23')];var _0x98c7ff;if(_0x206e74>=_0x1265b1){_0x206e74=_0x1265b1;_0x98c7ff=0xc8;}else{_0x98c7ff=0xce;}_0x255967['status'](_0x98c7ff);return _0x255967[_0xea80('0x25')]('Content-Range',_0x145505+'-'+_0x206e74+'/'+_0x1265b1)['json'](_0x4fee08);}return null;};}function patchUpdates(_0x589705){return function(_0x5e7033){try{jsonpatch[_0xea80('0x26')](_0x5e7033,_0x589705,!![]);}catch(_0x245641){return BPromise[_0xea80('0x27')](_0x245641);}return _0x5e7033[_0xea80('0x28')]();};}function saveUpdates(_0x2bf730,_0x2f7def){return function(_0x81c3c6){if(_0x81c3c6){return _0x81c3c6['update'](_0x2bf730)[_0xea80('0x29')](function(_0xff449c){return _0xff449c;});}return null;};}function removeEntity(_0x4013a5,_0x22cbac){return function(_0xccdd7c){if(_0xccdd7c){return _0xccdd7c[_0xea80('0x2a')]()[_0xea80('0x29')](function(){_0x4013a5['status'](0xcc)[_0xea80('0x1f')]();});}};}function handleEntityNotFound(_0x43c772,_0x93318e){return function(_0x2573b7){if(!_0x2573b7){_0x43c772['sendStatus'](0x194);}return _0x2573b7;};}function handleError(_0x5b6e7f,_0x18f3a7){_0x18f3a7=_0x18f3a7||0x1f4;return function(_0x5ac4b6){logger[_0xea80('0x2b')](_0x5ac4b6[_0xea80('0x2c')]);if(_0x5ac4b6[_0xea80('0x2d')]){delete _0x5ac4b6[_0xea80('0x2d')];}_0x5b6e7f[_0xea80('0x1e')](_0x18f3a7)[_0xea80('0x2e')](_0x5ac4b6);};}exports[_0xea80('0x2f')]=function(_0x2440dc,_0x51ecb5,_0xb45d10){if(!_0x2440dc[_0xea80('0x30')]['hasOwnProperty'](_0xea80('0x31'))&&!_0x2440dc[_0xea80('0x30')]['hasOwnProperty'](_0xea80('0x32'))){throw new db[(_0xea80('0x33'))][(_0xea80('0x34'))](_0xea80('0x35'));}else{if(_0x2440dc[_0xea80('0x30')][_0xea80('0x36')](_0xea80('0x32'))&&!_0x2440dc['body'][_0xea80('0x36')](_0xea80('0x37'))){throw new db[(_0xea80('0x33'))][(_0xea80('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2440dc[_0xea80('0x30')][_0xea80('0x36')](_0xea80('0x38'))){throw new db[(_0xea80('0x33'))][(_0xea80('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x191f86=JSON[_0xea80('0x39')](_0x2440dc['body'][_0xea80('0x38')]);}catch(_0x135b72){logger[_0xea80('0x2b')](_0x135b72);throw new db[(_0xea80('0x33'))]['ValidationError'](_0xea80('0x3a'));}var _0x2657ef=[_0xea80('0x3b'),_0xea80('0x3c'),_0xea80('0x3d'),'openchannelqueue',_0xea80('0x3e'),_0xea80('0x3f'),_0xea80('0x40'),_0xea80('0x41'),_0xea80('0x42')];if(_[_0xea80('0x43')](_0x191f86,function(_0x4b6cfd){return!_[_0xea80('0x44')](_0x2657ef,_0x4b6cfd[_0xea80('0x45')][_0xea80('0x46')]());})){throw new db[(_0xea80('0x33'))][(_0xea80('0x34'))](_0xea80('0x47'));}}}var _0x4722d2={};_0x4722d2[_0xea80('0x48')]=_0x2440dc['body'][_0xea80('0x36')]('senderName')?_0x2440dc[_0xea80('0x30')]['senderName']:_0x2440dc[_0xea80('0x42')][_0xea80('0x49')];_0x4722d2[_0xea80('0x4a')]=_[_0xea80('0x4b')](_0x2440dc[_0xea80('0x30')][_0xea80('0x4a')])?null:_0x2440dc[_0xea80('0x30')][_0xea80('0x4a')];_0x4722d2[_0xea80('0x4c')]=_0x2440dc[_0xea80('0x30')][_0xea80('0x4c')]||![];_0x4722d2['SenderId']=_0x2440dc[_0xea80('0x42')]['id'];return getContent(_0x2440dc[_0xea80('0x30')])[_0xea80('0x29')](function(_0x28909c){_0x4722d2['body']=_0x28909c;return getRecipients(_0x191f86);})[_0xea80('0x29')](function(_0x54493d){_0x4722d2[_0xea80('0x4d')]=_[_0xea80('0x4e')](_0x54493d)[_0xea80('0x4f')](',');return db[_0xea80('0x50')][_0xea80('0x51')](function(_0x1bc9e7){return db[_0xea80('0x52')][_0xea80('0x53')](_0x4722d2,{'raw':!![],'transaction':_0x1bc9e7})[_0xea80('0x29')](function(_0x556a15){var _0x34b7ae={'sender':_0x4722d2['senderName'],'description':_0x4722d2[_0xea80('0x4a')],'content':_0x4722d2['body'],'beep':_0x4722d2['beep']};_0x54493d[_0xea80('0x54')](function(_0x1fd7a2){_0x34b7ae[_0xea80('0x55')]=_0x1fd7a2;socket['emit'](_0xea80('0x56'),_0x34b7ae);});return _0x556a15;});});})[_0xea80('0x29')](respondWithResult(_0x51ecb5,0xc9))[_0xea80('0x57')](handleError(_0x51ecb5,null));};function getContent(_0x151949){return new BPromise(function(_0x5bf953,_0x5da38b){if(_0x151949['text']){_0x5bf953(_0x151949[_0xea80('0x31')]);return;}return db[_0xea80('0x58')][_0xea80('0x59')]({'attributes':['html'],'where':{'id':_0x151949[_0xea80('0x32')]},'raw':!![]})['then'](function(_0x104b21){if(!_0x104b21)throw new db[(_0xea80('0x33'))][(_0xea80('0x34'))](_0xea80('0x5a'));var _0x500b53=Mustache[_0xea80('0x5b')](_0x104b21[_0xea80('0x5c')],_0x151949['view']);_0x5bf953(_0x500b53);})[_0xea80('0x57')](function(_0x1472b4){_0x5da38b(_0x1472b4);});});}function getRecipients(_0x384b9a){return new BPromise(function(_0x5e2031,_0x54e7bb){var _0x2867eb=[];var _0x32a0dd=[];_0x384b9a[_0xea80('0x54')](function(_0x4efe91){var _0xb0e93d=_[_0xea80('0x5d')](_0x4efe91[_0xea80('0x45')][_0xea80('0x46')]());if(_0xb0e93d===_0xea80('0x5e')){_0x2867eb=_[_0xea80('0x5f')](_0x2867eb,_0x4efe91['ids']);}else{if(_[_0xea80('0x44')](_0xb0e93d,_0xea80('0x60')))_0xb0e93d=_0xb0e93d[_0xea80('0x61')](_0xea80('0x60'),_0xea80('0x62'));_0x4efe91[_0xea80('0x63')][_0xea80('0x54')](function(_0x1fed37){_0x32a0dd['push'](getAgents(_0xb0e93d,_0x1fed37));});}});return BPromise[_0xea80('0x64')](_0x32a0dd)[_0xea80('0x29')](function(_0x45b2e4){_0x2867eb=_[_0xea80('0x5f')](_0x2867eb,_['flatten'](_0x45b2e4));_0x5e2031(_0x2867eb);})[_0xea80('0x57')](function(_0x11e55f){_0x54e7bb(_0x11e55f);});});}function getAgents(_0x20a8e5,_0x4b21a1){return new BPromise(function(_0x1e76a1,_0x278331){return db[_0x20a8e5]['findOne']({'where':{'id':_0x4b21a1}})[_0xea80('0x29')](function(_0x4a37fa){return _0x4a37fa[_0xea80('0x65')]({'attributes':['id'],'raw':!![]})[_0xea80('0x29')](function(_0x1450dc){var _0x3ca9dd=_[_0xea80('0x66')](_0x1450dc,'id');_0x1e76a1(_0x3ca9dd);});})[_0xea80('0x57')](function(_0x326aea){_0x278331(_0x326aea);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 44f9051..8274f22 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 _0x6c05=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x6c05,0xc4));var _0x56c0=function(_0xbceaff,_0x49d1e5){_0xbceaff=_0xbceaff-0x0;var _0x78716f=_0x6c05[_0xbceaff];return _0x78716f;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x56c0('0x0'))['db'][_0x56c0('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x56c0('0x2')](0x0);var events={'afterCreate':_0x56c0('0x3'),'afterUpdate':'update','afterDestroy':_0x56c0('0x4')};function emitEvent(_0x254301){return function(_0x2dacf4,_0x222db3,_0x5d0481){UserNotificationEvents[_0x56c0('0x5')](_0x254301+':'+_0x2dacf4['id'],_0x2dacf4);UserNotificationEvents[_0x56c0('0x5')](_0x254301,_0x2dacf4);_0x5d0481(null);};}for(var e in events){if(events[_0x56c0('0x6')](e)){var event=events[e];UserNotification[_0x56c0('0x7')](e,emitEvent(event));}}module[_0x56c0('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xa4f3=['hasOwnProperty','hook','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x12d289,_0x3d870a){var _0x381fee=function(_0xee446a){while(--_0xee446a){_0x12d289['push'](_0x12d289['shift']());}};_0x381fee(++_0x3d870a);}(_0xa4f3,0x1b2));var _0x3a4f=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa4f3[_0x56482c];return _0x5aae7a;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x3a4f('0x0'))['db'][_0x3a4f('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3a4f('0x2')](0x0);var events={'afterCreate':_0x3a4f('0x3'),'afterUpdate':_0x3a4f('0x4'),'afterDestroy':_0x3a4f('0x5')};function emitEvent(_0x17f0b7){return function(_0x50ec38,_0x57da73,_0x49450c){UserNotificationEvents['emit'](_0x17f0b7+':'+_0x50ec38['id'],_0x50ec38);UserNotificationEvents[_0x3a4f('0x6')](_0x17f0b7,_0x50ec38);_0x49450c(null);};}for(var e in events){if(events[_0x3a4f('0x7')](e)){var event=events[e];UserNotification[_0x3a4f('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index b03918a..a4f9200 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 _0x1806=['util','moment','bluebird','request-promise','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x18a1aa,_0x3c4466){var _0x4b273e=function(_0x4d1d62){while(--_0x4d1d62){_0x18a1aa['push'](_0x18a1aa['shift']());}};_0x4b273e(++_0x3c4466);}(_0x1806,0x8f));var _0x6180=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x1806[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require(_0x6180('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6180('0x1'));var BPromise=require(_0x6180('0x2'));var rp=require(_0x6180('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6180('0x4'));module[_0x6180('0x5')]=function(_0x4b3f8a,_0x547f18){return _0x4b3f8a[_0x6180('0x6')](_0x6180('0x7'),attributes,{'tableName':_0x6180('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6180('0x9'),'collate':_0x6180('0xa')});}; \ No newline at end of file +var _0xfd1d=['utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','UserNotification','utf8mb4'];(function(_0x2ba8d5,_0x46c75c){var _0x14e5b1=function(_0x33cc7a){while(--_0x33cc7a){_0x2ba8d5['push'](_0x2ba8d5['shift']());}};_0x14e5b1(++_0x46c75c);}(_0xfd1d,0xdd));var _0xdfd1=function(_0x225f68,_0x105107){_0x225f68=_0x225f68-0x0;var _0x38d17f=_0xfd1d[_0x225f68];return _0x38d17f;};'use strict';var _=require('lodash');var util=require(_0xdfd1('0x0'));var logger=require('../../config/logger')(_0xdfd1('0x1'));var moment=require('moment');var BPromise=require(_0xdfd1('0x2'));var rp=require(_0xdfd1('0x3'));var fs=require('fs');var path=require(_0xdfd1('0x4'));var rimraf=require(_0xdfd1('0x5'));var config=require('../../config/environment');var attributes=require(_0xdfd1('0x6'));module[_0xdfd1('0x7')]=function(_0x24c3e5,_0x5ba582){return _0x24c3e5['define'](_0xdfd1('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdfd1('0x9'),'collate':_0xdfd1('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 9ebe3e2..0fc7935 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 _0xf892=['then','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request'];(function(_0xafd652,_0x2780ee){var _0x217596=function(_0x78dcd8){while(--_0x78dcd8){_0xafd652['push'](_0xafd652['shift']());}};_0x217596(++_0x2780ee);}(_0xf892,0x1bd));var _0x2f89=function(_0x299d43,_0x4ebe75){_0x299d43=_0x299d43-0x0;var _0x2173b6=_0xf892[_0x299d43];return _0x2173b6;};'use strict';var _=require(_0x2f89('0x0'));var util=require(_0x2f89('0x1'));var moment=require(_0x2f89('0x2'));var BPromise=require(_0x2f89('0x3'));var rs=require(_0x2f89('0x4'));var fs=require('fs');var Redis=require(_0x2f89('0x5'));var db=require(_0x2f89('0x6'))['db'];var utils=require(_0x2f89('0x7'));var logger=require('../../config/logger')(_0x2f89('0x8'));var config=require(_0x2f89('0x9'));var jayson=require(_0x2f89('0xa'));var client=jayson['client'][_0x2f89('0xb')]({'port':0x232a});config[_0x2f89('0xc')]=_[_0x2f89('0xd')](config[_0x2f89('0xc')],{'host':_0x2f89('0xe'),'port':0x18eb});var socket=require(_0x2f89('0xf'))(new Redis(config[_0x2f89('0xc')]));require(_0x2f89('0x10'))[_0x2f89('0x11')](socket);function respondWithRpcPromise(_0x358fbd,_0x45ab97,_0x310d51){return new BPromise(function(_0x432554,_0x4c7c1e){return client[_0x2f89('0x12')](_0x358fbd,_0x310d51)[_0x2f89('0x13')](function(_0x869f39){logger['info']('UserNotification,\x20%s,\x20%s',_0x45ab97,_0x2f89('0x14'));logger['debug'](_0x2f89('0x15'),_0x45ab97,_0x2f89('0x14'),JSON['stringify'](_0x869f39));if(_0x869f39['error']){if(_0x869f39[_0x2f89('0x16')][_0x2f89('0x17')]===0x1f4){logger[_0x2f89('0x16')](_0x2f89('0x18'),_0x45ab97,_0x869f39[_0x2f89('0x16')][_0x2f89('0x19')]);return _0x4c7c1e(_0x869f39['error'][_0x2f89('0x19')]);}logger['error'](_0x2f89('0x18'),_0x45ab97,_0x869f39[_0x2f89('0x16')]['message']);return _0x432554(_0x869f39[_0x2f89('0x16')][_0x2f89('0x19')]);}else{logger[_0x2f89('0x1a')](_0x2f89('0x18'),_0x45ab97,_0x2f89('0x14'));_0x432554(_0x869f39[_0x2f89('0x1b')][_0x2f89('0x19')]);}})[_0x2f89('0x1c')](function(_0x351719){logger[_0x2f89('0x16')](_0x2f89('0x18'),_0x45ab97,_0x351719);_0x4c7c1e(_0x351719);});});} \ No newline at end of file +var _0x383c=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch'];(function(_0x19bd6c,_0xebbbf1){var _0x179091=function(_0x33ec6d){while(--_0x33ec6d){_0x19bd6c['push'](_0x19bd6c['shift']());}};_0x179091(++_0xebbbf1);}(_0x383c,0x1e0));var _0xc383=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x383c[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require(_0xc383('0x0'));var moment=require(_0xc383('0x1'));var BPromise=require(_0xc383('0x2'));var rs=require(_0xc383('0x3'));var fs=require('fs');var Redis=require(_0xc383('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc383('0x5'))(_0xc383('0x6'));var config=require('../../config/environment');var jayson=require(_0xc383('0x7'));var client=jayson[_0xc383('0x8')][_0xc383('0x9')]({'port':0x232a});config[_0xc383('0xa')]=_['defaults'](config['redis'],{'host':_0xc383('0xb'),'port':0x18eb});var socket=require(_0xc383('0xc'))(new Redis(config[_0xc383('0xa')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x3f1e5a,_0x4f2fea,_0x56dbc1){return new BPromise(function(_0x3f7fd2,_0xcaaa88){return client[_0xc383('0xd')](_0x3f1e5a,_0x56dbc1)[_0xc383('0xe')](function(_0x58d6eb){logger['info'](_0xc383('0xf'),_0x4f2fea,_0xc383('0x10'));logger[_0xc383('0x11')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x4f2fea,_0xc383('0x10'),JSON['stringify'](_0x58d6eb));if(_0x58d6eb[_0xc383('0x12')]){if(_0x58d6eb['error'][_0xc383('0x13')]===0x1f4){logger[_0xc383('0x12')](_0xc383('0xf'),_0x4f2fea,_0x58d6eb[_0xc383('0x12')]['message']);return _0xcaaa88(_0x58d6eb[_0xc383('0x12')][_0xc383('0x14')]);}logger[_0xc383('0x12')](_0xc383('0xf'),_0x4f2fea,_0x58d6eb['error'][_0xc383('0x14')]);return _0x3f7fd2(_0x58d6eb[_0xc383('0x12')]['message']);}else{logger[_0xc383('0x15')](_0xc383('0xf'),_0x4f2fea,_0xc383('0x10'));_0x3f7fd2(_0x58d6eb[_0xc383('0x16')][_0xc383('0x14')]);}})[_0xc383('0x17')](function(_0x442b56){logger[_0xc383('0x12')](_0xc383('0xf'),_0x4f2fea,_0x442b56);_0xcaaa88(_0x442b56);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 2b022d5..810f3f6 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 _0xcb00=['remove','update','emit','removeListener','length','userNotification:','./userNotification.events','save'];(function(_0x55176d,_0x198e17){var _0x41ac66=function(_0x4d5fc2){while(--_0x4d5fc2){_0x55176d['push'](_0x55176d['shift']());}};_0x41ac66(++_0x198e17);}(_0xcb00,0x19e));var _0x0cb0=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0xcb00[_0x59616b];return _0x5c4523;};'use strict';var UserNotificationEvents=require(_0x0cb0('0x0'));var events=[_0x0cb0('0x1'),_0x0cb0('0x2'),_0x0cb0('0x3')];function createListener(_0x5fbf35,_0x423b9e){return function(_0x179628){_0x423b9e[_0x0cb0('0x4')](_0x5fbf35,_0x179628);};}function removeListener(_0x22d45c,_0x1ff3c4){return function(){UserNotificationEvents[_0x0cb0('0x5')](_0x22d45c,_0x1ff3c4);};}exports['register']=function(_0x2097da){for(var _0x37f589=0x0,_0x2ec0cc=events[_0x0cb0('0x6')];_0x37f589<_0x2ec0cc;_0x37f589++){var _0x4e0eb7=events[_0x37f589];var _0x30a05c=createListener(_0x0cb0('0x7')+_0x4e0eb7,_0x2097da);UserNotificationEvents['on'](_0x4e0eb7,_0x30a05c);}}; \ No newline at end of file +var _0xe7fa=['update','emit','removeListener','register','userNotification:','./userNotification.events'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xe7fa,0x1b5));var _0xae7f=function(_0x4f1b43,_0x2a085c){_0x4f1b43=_0x4f1b43-0x0;var _0x571cf9=_0xe7fa[_0x4f1b43];return _0x571cf9;};'use strict';var UserNotificationEvents=require(_0xae7f('0x0'));var events=['save','remove',_0xae7f('0x1')];function createListener(_0x42fe71,_0x33782f){return function(_0x59b031){_0x33782f[_0xae7f('0x2')](_0x42fe71,_0x59b031);};}function removeListener(_0x5d17d2,_0x5d7726){return function(){UserNotificationEvents[_0xae7f('0x3')](_0x5d17d2,_0x5d7726);};}exports[_0xae7f('0x4')]=function(_0x29bc30){for(var _0x3bd1c7=0x0,_0x4175d2=events['length'];_0x3bd1c7<_0x4175d2;_0x3bd1c7++){var _0x1b97c3=events[_0x3bd1c7];var _0xeb1b2e=createListener(_0xae7f('0x5')+_0x1b97c3,_0x29bc30);UserNotificationEvents['on'](_0x1b97c3,_0xeb1b2e);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 26924b0..a14517f 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(_0x1d9ad6,_0x4316c0){var _0x353c2a=function(_0x2b19d6){while(--_0x2b19d6){_0x1d9ad6['push'](_0x1d9ad6['shift']());}};_0x353c2a(++_0x4316c0);}(_0x70e0,0x17b));var _0x070e=function(_0x463951,_0x349b44){_0x463951=_0x463951-0x0;var _0xc11a43=_0x70e0[_0x463951];return _0xc11a43;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xb7ad03,_0x43fef7){var _0x3ab965=function(_0x4cca67){while(--_0x4cca67){_0xb7ad03['push'](_0xb7ad03['shift']());}};_0x3ab965(++_0x43fef7);}(_0xedd9,0xfc));var _0x9edd=function(_0x22a57a,_0x9a9e9f){_0x22a57a=_0x22a57a-0x0;var _0x1150fc=_0xedd9[_0x22a57a];return _0x1150fc;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 3d27ee5..81416f4 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 _0xd40a=['exports'];(function(_0x5291a9,_0x49f153){var _0x31103c=function(_0x178140){while(--_0x178140){_0x5291a9['push'](_0x5291a9['shift']());}};_0x31103c(++_0x49f153);}(_0xd40a,0x17d));var _0xad40=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd40a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xad40('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9cfc=['sequelize','exports','INTEGER'];(function(_0x35b501,_0x47c3a0){var _0x48eff2=function(_0x591135){while(--_0x591135){_0x35b501['push'](_0x35b501['shift']());}};_0x48eff2(++_0x47c3a0);}(_0x9cfc,0x1b0));var _0xc9cf=function(_0x3f4e52,_0x2024ec){_0x3f4e52=_0x3f4e52-0x0;var _0x44d874=_0x9cfc[_0x3f4e52];return _0x44d874;};'use strict';var Sequelize=require(_0xc9cf('0x0'));module[_0xc9cf('0x1')]={'penalty':{'type':Sequelize[_0xc9cf('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 3b90d44..b4d9d81 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 _0xe2e3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x21d129,_0x5ccf2a){var _0x3c5086=function(_0x55f507){while(--_0x55f507){_0x21d129['push'](_0x21d129['shift']());}};_0x3c5086(++_0x5ccf2a);}(_0xe2e3,0x145));var _0x3e2e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xe2e3[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x3e2e('0x0'));var util=require(_0x3e2e('0x1'));var logger=require(_0x3e2e('0x2'))(_0x3e2e('0x3'));var moment=require(_0x3e2e('0x4'));var BPromise=require(_0x3e2e('0x5'));var rp=require(_0x3e2e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e2e('0x7'));var config=require(_0x3e2e('0x8'));var attributes=require(_0x3e2e('0x9'));module[_0x3e2e('0xa')]=function(_0xe92085,_0x2fb962){return _0xe92085['define'](_0x3e2e('0xb'),attributes,{'tableName':_0x3e2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b40=['user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','UserOpenchannelQueue'];(function(_0xc5f18f,_0x28dc7f){var _0x4169ca=function(_0x3641fa){while(--_0x3641fa){_0xc5f18f['push'](_0xc5f18f['shift']());}};_0x4169ca(++_0x28dc7f);}(_0x7b40,0x109));var _0x07b4=function(_0x491a9c,_0x17c628){_0x491a9c=_0x491a9c-0x0;var _0xae522=_0x7b40[_0x491a9c];return _0xae522;};'use strict';var _=require(_0x07b4('0x0'));var util=require(_0x07b4('0x1'));var logger=require(_0x07b4('0x2'))(_0x07b4('0x3'));var moment=require(_0x07b4('0x4'));var BPromise=require(_0x07b4('0x5'));var rp=require(_0x07b4('0x6'));var fs=require('fs');var path=require(_0x07b4('0x7'));var rimraf=require(_0x07b4('0x8'));var config=require(_0x07b4('0x9'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x1f2a46,_0x2ef9cd){return _0x1f2a46['define'](_0x07b4('0xa'),attributes,{'tableName':_0x07b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 0d30f1f..de008c1 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 _0xfbd3=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfbd3,0x1b0));var _0x3fbd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfbd3[_0x432682];return _0x463d05;};'use strict';var _=require(_0x3fbd('0x0'));var util=require(_0x3fbd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3fbd('0x2'));var fs=require('fs');var Redis=require(_0x3fbd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fbd('0x4'));var logger=require(_0x3fbd('0x5'))(_0x3fbd('0x6'));var config=require(_0x3fbd('0x7'));var jayson=require(_0x3fbd('0x8'));var client=jayson['client'][_0x3fbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f46d2,_0x34b2cd,_0x4b8c75){return new BPromise(function(_0x315528,_0x2c5bad){return client[_0x3fbd('0xa')](_0x3f46d2,_0x4b8c75)[_0x3fbd('0xb')](function(_0x5896ba){logger[_0x3fbd('0xc')](_0x3fbd('0xd'),_0x34b2cd,'request\x20sent');logger[_0x3fbd('0xe')](_0x3fbd('0xf'),_0x34b2cd,'request\x20sent',JSON[_0x3fbd('0x10')](_0x5896ba));if(_0x5896ba[_0x3fbd('0x11')]){if(_0x5896ba[_0x3fbd('0x11')][_0x3fbd('0x12')]===0x1f4){logger[_0x3fbd('0x11')](_0x3fbd('0xd'),_0x34b2cd,_0x5896ba[_0x3fbd('0x11')][_0x3fbd('0x13')]);return _0x2c5bad(_0x5896ba[_0x3fbd('0x11')][_0x3fbd('0x13')]);}logger[_0x3fbd('0x11')](_0x3fbd('0xd'),_0x34b2cd,_0x5896ba[_0x3fbd('0x11')][_0x3fbd('0x13')]);return _0x315528(_0x5896ba[_0x3fbd('0x11')][_0x3fbd('0x13')]);}else{logger[_0x3fbd('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34b2cd,'request\x20sent');_0x315528(_0x5896ba[_0x3fbd('0x14')]['message']);}})['catch'](function(_0x128b17){logger[_0x3fbd('0x11')](_0x3fbd('0xd'),_0x34b2cd,_0x128b17);_0x2c5bad(_0x128b17);});});} \ No newline at end of file +var _0x57b6=['info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x249ca3,_0x4de015){var _0x37ad4=function(_0x1dbded){while(--_0x1dbded){_0x249ca3['push'](_0x249ca3['shift']());}};_0x37ad4(++_0x4de015);}(_0x57b6,0x7d));var _0x657b=function(_0x5aeaa5,_0xa37654){_0x5aeaa5=_0x5aeaa5-0x0;var _0xae1de3=_0x57b6[_0x5aeaa5];return _0xae1de3;};'use strict';var _=require(_0x657b('0x0'));var util=require(_0x657b('0x1'));var moment=require(_0x657b('0x2'));var BPromise=require(_0x657b('0x3'));var rs=require(_0x657b('0x4'));var fs=require('fs');var Redis=require(_0x657b('0x5'));var db=require(_0x657b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x657b('0x7'))(_0x657b('0x8'));var config=require(_0x657b('0x9'));var jayson=require(_0x657b('0xa'));var client=jayson[_0x657b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9975df,_0x240470,_0x351783){return new BPromise(function(_0x451a27,_0x464d32){return client['request'](_0x9975df,_0x351783)[_0x657b('0xc')](function(_0x36ef3d){logger[_0x657b('0xd')](_0x657b('0xe'),_0x240470,'request\x20sent');logger[_0x657b('0xf')](_0x657b('0x10'),_0x240470,_0x657b('0x11'),JSON['stringify'](_0x36ef3d));if(_0x36ef3d[_0x657b('0x12')]){if(_0x36ef3d[_0x657b('0x12')][_0x657b('0x13')]===0x1f4){logger[_0x657b('0x12')](_0x657b('0xe'),_0x240470,_0x36ef3d[_0x657b('0x12')][_0x657b('0x14')]);return _0x464d32(_0x36ef3d[_0x657b('0x12')][_0x657b('0x14')]);}logger['error'](_0x657b('0xe'),_0x240470,_0x36ef3d[_0x657b('0x12')][_0x657b('0x14')]);return _0x451a27(_0x36ef3d[_0x657b('0x12')][_0x657b('0x14')]);}else{logger['info'](_0x657b('0xe'),_0x240470,_0x657b('0x11'));_0x451a27(_0x36ef3d[_0x657b('0x15')]['message']);}})[_0x657b('0x16')](function(_0x2945dd){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x240470,_0x2945dd);_0x464d32(_0x2945dd);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 39115c2..bc31dc7 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 _0xb2be=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','getSections','/:id/resources','getResources','clone','post','addSections','addResources','delete','destroy','removeSections','removeResources','exports','multer','util'];(function(_0x59be39,_0x38558d){var _0x136795=function(_0x5e499f){while(--_0x5e499f){_0x59be39['push'](_0x59be39['shift']());}};_0x136795(++_0x38558d);}(_0xb2be,0x1da));var _0xeb2b=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0xb2be[_0x5fa520];return _0x1bf6c4;};'use strict';var multer=require(_0xeb2b('0x0'));var util=require(_0xeb2b('0x1'));var path=require(_0xeb2b('0x2'));var timeout=require('connect-timeout');var express=require(_0xeb2b('0x3'));var router=express[_0xeb2b('0x4')]();var fs_extra=require(_0xeb2b('0x5'));var auth=require(_0xeb2b('0x6'));var interaction=require(_0xeb2b('0x7'));var config=require(_0xeb2b('0x8'));var controller=require(_0xeb2b('0x9'));router[_0xeb2b('0xa')]('/',auth[_0xeb2b('0xb')](),controller['index']);router[_0xeb2b('0xa')](_0xeb2b('0xc'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0xd')]);router['get'](_0xeb2b('0xe'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0xf')]);router[_0xeb2b('0xa')]('/:id/sections',auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x10')]);router[_0xeb2b('0xa')](_0xeb2b('0x11'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/clone',auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x13')]);router[_0xeb2b('0x14')]('/:id/sections',auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x15')]);router[_0xeb2b('0x14')](_0xeb2b('0x11'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x16')]);router['put'](_0xeb2b('0xe'),auth[_0xeb2b('0xb')](),controller['update']);router[_0xeb2b('0x17')](_0xeb2b('0xe'),auth['isAuthenticated'](),controller[_0xeb2b('0x18')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0xeb2b('0x19')]);router[_0xeb2b('0x17')](_0xeb2b('0x11'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x1a')]);module[_0xeb2b('0x1b')]=router; \ No newline at end of file +var _0x8f43=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','/describe','describe','show','get','/:id/sections','getResources','post','create','/:id/clone','clone','addSections','put','/:id','delete','removeSections','removeResources','exports','multer'];(function(_0x44528d,_0x50a1a4){var _0x5760fc=function(_0x350aa1){while(--_0x350aa1){_0x44528d['push'](_0x44528d['shift']());}};_0x5760fc(++_0x50a1a4);}(_0x8f43,0x1ed));var _0x38f4=function(_0x288a71,_0x88e68b){_0x288a71=_0x288a71-0x0;var _0x102e74=_0x8f43[_0x288a71];return _0x102e74;};'use strict';var multer=require(_0x38f4('0x0'));var util=require(_0x38f4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x38f4('0x2'));var router=express['Router']();var fs_extra=require(_0x38f4('0x3'));var auth=require(_0x38f4('0x4'));var interaction=require(_0x38f4('0x5'));var config=require('../../config/environment');var controller=require(_0x38f4('0x6'));router['get']('/',auth[_0x38f4('0x7')](),controller[_0x38f4('0x8')]);router['get'](_0x38f4('0x9'),auth[_0x38f4('0x7')](),controller[_0x38f4('0xa')]);router['get']('/:id',auth[_0x38f4('0x7')](),controller[_0x38f4('0xb')]);router[_0x38f4('0xc')](_0x38f4('0xd'),auth[_0x38f4('0x7')](),controller['getSections']);router[_0x38f4('0xc')]('/:id/resources',auth[_0x38f4('0x7')](),controller[_0x38f4('0xe')]);router[_0x38f4('0xf')]('/',auth[_0x38f4('0x7')](),controller[_0x38f4('0x10')]);router[_0x38f4('0xf')](_0x38f4('0x11'),auth[_0x38f4('0x7')](),controller[_0x38f4('0x12')]);router[_0x38f4('0xf')]('/:id/sections',auth[_0x38f4('0x7')](),controller[_0x38f4('0x13')]);router[_0x38f4('0xf')]('/:id/resources',auth[_0x38f4('0x7')](),controller['addResources']);router[_0x38f4('0x14')](_0x38f4('0x15'),auth[_0x38f4('0x7')](),controller['update']);router[_0x38f4('0x16')](_0x38f4('0x15'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x38f4('0xd'),auth[_0x38f4('0x7')](),controller[_0x38f4('0x17')]);router[_0x38f4('0x16')]('/:id/resources',auth[_0x38f4('0x7')](),controller[_0x38f4('0x18')]);module[_0x38f4('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index fe8bbf3..b882642 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 _0x8b12=['sequelize','STRING','name','join','getDataValue','crudPermissions','split','BOOLEAN'];(function(_0x4e584c,_0x292d9f){var _0xe71a6f=function(_0x2bea05){while(--_0x2bea05){_0x4e584c['push'](_0x4e584c['shift']());}};_0xe71a6f(++_0x292d9f);}(_0x8b12,0xb0));var _0x28b1=function(_0x17d229,_0x265a8f){_0x17d229=_0x17d229-0x0;var _0x2318da=_0x8b12[_0x17d229];return _0x2318da;};'use strict';var Sequelize=require(_0x28b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x28b1('0x1')],'allowNull':![],'unique':_0x28b1('0x2')},'crudPermissions':{'type':Sequelize[_0x28b1('0x1')],'set':function(_0x28c6d5){this['setDataValue']('crudPermissions',_0x28c6d5?_0x28c6d5[_0x28b1('0x3')](''):[]);},'get':function(){return this[_0x28b1('0x4')](_0x28b1('0x5'))?this[_0x28b1('0x4')]('crudPermissions')[_0x28b1('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x28b1('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x28b1('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x28b1('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x28b1('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x656d=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','crudPermissions'];(function(_0x38854a,_0x1eb890){var _0x57fac2=function(_0x1018c6){while(--_0x1018c6){_0x38854a['push'](_0x38854a['shift']());}};_0x57fac2(++_0x1eb890);}(_0x656d,0x153));var _0xd656=function(_0x43dbcf,_0x34af8b){_0x43dbcf=_0x43dbcf-0x0;var _0x21b7f7=_0x656d[_0x43dbcf];return _0x21b7f7;};'use strict';var Sequelize=require(_0xd656('0x0'));module[_0xd656('0x1')]={'name':{'type':Sequelize[_0xd656('0x2')],'allowNull':![],'unique':_0xd656('0x3')},'crudPermissions':{'type':Sequelize[_0xd656('0x2')],'set':function(_0xea9228){this['setDataValue'](_0xd656('0x4'),_0xea9228?_0xea9228['join'](''):[]);},'get':function(){return this['getDataValue'](_0xd656('0x4'))?this[_0xd656('0x5')](_0xd656('0x4'))[_0xd656('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd656('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd656('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd656('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd656('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xd656('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd656('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 02878d3..ab04e5f 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 _0x8fe2=['query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','filter','merge','includeAll','findAll','rows','show','params','keys','length','options','find','catch','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','each','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','Dashboard','forEach','resourceId','Plugin','addResources','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','name'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x8fe2,0x194));var _0x28fe=function(_0x31cc0e,_0x24ba4c){_0x31cc0e=_0x31cc0e-0x0;var _0x144862=_0x8fe2[_0x31cc0e];return _0x144862;};'use strict';var emlformat=require(_0x28fe('0x0'));var rimraf=require(_0x28fe('0x1'));var zipdir=require(_0x28fe('0x2'));var jsonpatch=require(_0x28fe('0x3'));var rp=require(_0x28fe('0x4'));var moment=require(_0x28fe('0x5'));var BPromise=require(_0x28fe('0x6'));var Mustache=require(_0x28fe('0x7'));var util=require(_0x28fe('0x8'));var path=require('path');var sox=require(_0x28fe('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28fe('0xa'));var _=require(_0x28fe('0xb'));var squel=require(_0x28fe('0xc'));var crypto=require(_0x28fe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x28fe('0xe'));var toCsv=require(_0x28fe('0xf'));var querystring=require(_0x28fe('0x10'));var Papa=require('papaparse');var Redis=require(_0x28fe('0x11'));var authService=require(_0x28fe('0x12'));var qs=require(_0x28fe('0x13'));var as=require(_0x28fe('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x28fe('0x15'))(_0x28fe('0x16'));var utils=require(_0x28fe('0x17'));var config=require(_0x28fe('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x28fe('0x19'))['db'];config[_0x28fe('0x1a')]=_['defaults'](config[_0x28fe('0x1a')],{'host':_0x28fe('0x1b'),'port':0x18eb});var socket=require(_0x28fe('0x1c'))(new Redis(config[_0x28fe('0x1a')]));require('./userProfile.socket')[_0x28fe('0x1d')](socket);function respondWithStatusCode(_0x547531,_0x20557f){_0x20557f=_0x20557f||0xcc;return function(_0x20d2fc){if(_0x20d2fc){return _0x547531[_0x28fe('0x1e')](_0x20557f);}return _0x547531[_0x28fe('0x1f')](_0x20557f)['end']();};}function respondWithResult(_0x3f71a1,_0x48ce8e){_0x48ce8e=_0x48ce8e||0xc8;return function(_0x2517d6){if(_0x2517d6){return _0x3f71a1[_0x28fe('0x1f')](_0x48ce8e)[_0x28fe('0x20')](_0x2517d6);}};}function respondWithFilteredResult(_0x503463,_0x422eee){return function(_0x48ed45){if(_0x48ed45){var _0x3bce82=typeof _0x422eee['offset']==='undefined'&&typeof _0x422eee[_0x28fe('0x21')]===_0x28fe('0x22');var _0x3be6b1=_0x48ed45[_0x28fe('0x23')];var _0x14db4f=_0x3bce82?0x0:_0x422eee[_0x28fe('0x24')];var _0x5d6787=_0x3bce82?_0x48ed45[_0x28fe('0x23')]:_0x422eee[_0x28fe('0x24')]+_0x422eee['limit'];var _0x3bd6b0;if(_0x5d6787>=_0x3be6b1){_0x5d6787=_0x3be6b1;_0x3bd6b0=0xc8;}else{_0x3bd6b0=0xce;}_0x503463[_0x28fe('0x1f')](_0x3bd6b0);return _0x503463[_0x28fe('0x25')](_0x28fe('0x26'),_0x14db4f+'-'+_0x5d6787+'/'+_0x3be6b1)['json'](_0x48ed45);}return null;};}function patchUpdates(_0xe5efc9){return function(_0x362f67){try{jsonpatch[_0x28fe('0x27')](_0x362f67,_0xe5efc9,!![]);}catch(_0x16f571){return BPromise[_0x28fe('0x28')](_0x16f571);}return _0x362f67['save']();};}function saveUpdates(_0x176da8,_0x597613){return function(_0x296e6b){if(_0x296e6b){return _0x296e6b[_0x28fe('0x29')](_0x176da8)[_0x28fe('0x2a')](function(_0x3e05a2){return _0x3e05a2;});}return null;};}function removeEntity(_0x248dd5,_0x45385b){return function(_0x3fd67c){if(_0x3fd67c){return _0x3fd67c[_0x28fe('0x2b')]()[_0x28fe('0x2a')](function(){_0x248dd5[_0x28fe('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25228f,_0x34feed){return function(_0x335cdb){if(!_0x335cdb){_0x25228f[_0x28fe('0x1e')](0x194);}return _0x335cdb;};}function handleError(_0x378cf1,_0x1275cc){_0x1275cc=_0x1275cc||0x1f4;return function(_0x3547b4){logger[_0x28fe('0x2c')](_0x3547b4[_0x28fe('0x2d')]);if(_0x3547b4['name']){delete _0x3547b4['name'];}_0x378cf1['status'](_0x1275cc)[_0x28fe('0x2e')](_0x3547b4);};}exports[_0x28fe('0x2f')]=function(_0xc842fa,_0xeb91b){var _0x2cfaa7={},_0x238707={},_0x379cf5={'count':0x0,'rows':[]};var _0xa70277=_['map'](db[_0x28fe('0x30')][_0x28fe('0x31')],function(_0x2ee0da){return{'name':_0x2ee0da[_0x28fe('0x32')],'type':_0x2ee0da[_0x28fe('0x33')][_0x28fe('0x34')]};});_0x238707[_0x28fe('0x35')]=_[_0x28fe('0x36')](_0xa70277,_0x28fe('0x37'));_0x238707[_0x28fe('0x38')]=_['keys'](_0xc842fa[_0x28fe('0x38')]);_0x238707['filters']=_[_0x28fe('0x39')](_0x238707[_0x28fe('0x35')],_0x238707[_0x28fe('0x38')]);_0x2cfaa7[_0x28fe('0x3a')]=_[_0x28fe('0x39')](_0x238707[_0x28fe('0x35')],qs[_0x28fe('0x3b')](_0xc842fa['query'][_0x28fe('0x3b')]));_0x2cfaa7['attributes']=_0x2cfaa7[_0x28fe('0x3a')]['length']?_0x2cfaa7['attributes']:_0x238707[_0x28fe('0x35')];if(!_0xc842fa['query'][_0x28fe('0x3c')]('nolimit')){_0x2cfaa7[_0x28fe('0x21')]=qs['limit'](_0xc842fa[_0x28fe('0x38')]['limit']);_0x2cfaa7['offset']=qs[_0x28fe('0x24')](_0xc842fa[_0x28fe('0x38')][_0x28fe('0x24')]);}_0x2cfaa7[_0x28fe('0x3d')]=qs['sort'](_0xc842fa[_0x28fe('0x38')][_0x28fe('0x3e')]);_0x2cfaa7['where']=qs[_0x28fe('0x3f')](_[_0x28fe('0x40')](_0xc842fa[_0x28fe('0x38')],_0x238707[_0x28fe('0x3f')]),_0xa70277);if(_0xc842fa[_0x28fe('0x38')]['filter']){_0x2cfaa7[_0x28fe('0x41')]=_['merge'](_0x2cfaa7[_0x28fe('0x41')],{'$or':_['map'](_0xa70277,function(_0x10105d){if(_0x10105d['type']!=='VIRTUAL'){var _0x399aba={};_0x399aba[_0x10105d[_0x28fe('0x37')]]={'$like':'%'+_0xc842fa[_0x28fe('0x38')][_0x28fe('0x42')]+'%'};return _0x399aba;}})});}_0x2cfaa7=_[_0x28fe('0x43')]({},_0x2cfaa7,_0xc842fa['options']);var _0x1ed987={'where':_0x2cfaa7[_0x28fe('0x41')]};return db[_0x28fe('0x30')][_0x28fe('0x23')](_0x1ed987)[_0x28fe('0x2a')](function(_0x57e08e){_0x379cf5[_0x28fe('0x23')]=_0x57e08e;if(_0xc842fa['query'][_0x28fe('0x44')]){_0x2cfaa7['include']=[{'all':!![]}];}return db['UserProfile'][_0x28fe('0x45')](_0x2cfaa7);})[_0x28fe('0x2a')](function(_0x2ec36f){_0x379cf5[_0x28fe('0x46')]=_0x2ec36f;return _0x379cf5;})[_0x28fe('0x2a')](respondWithFilteredResult(_0xeb91b,_0x2cfaa7))['catch'](handleError(_0xeb91b,null));};exports[_0x28fe('0x47')]=function(_0x1c33cf,_0x9b4695){var _0x4e953b={'raw':![],'where':{'id':_0x1c33cf[_0x28fe('0x48')]['id']}},_0x284d58={};_0x284d58[_0x28fe('0x35')]=_[_0x28fe('0x49')](db['UserProfile'][_0x28fe('0x31')]);_0x284d58['query']=_[_0x28fe('0x49')](_0x1c33cf[_0x28fe('0x38')]);_0x284d58['filters']=_[_0x28fe('0x39')](_0x284d58[_0x28fe('0x35')],_0x284d58['query']);_0x4e953b[_0x28fe('0x3a')]=_['intersection'](_0x284d58[_0x28fe('0x35')],qs[_0x28fe('0x3b')](_0x1c33cf['query'][_0x28fe('0x3b')]));_0x4e953b[_0x28fe('0x3a')]=_0x4e953b[_0x28fe('0x3a')][_0x28fe('0x4a')]?_0x4e953b[_0x28fe('0x3a')]:_0x284d58['model'];if(_0x1c33cf[_0x28fe('0x38')][_0x28fe('0x44')]){_0x4e953b['include']=[{'all':!![]}];}_0x4e953b=_[_0x28fe('0x43')]({},_0x4e953b,_0x1c33cf[_0x28fe('0x4b')]);return db[_0x28fe('0x30')][_0x28fe('0x4c')](_0x4e953b)['then'](handleEntityNotFound(_0x9b4695,null))['then'](respondWithResult(_0x9b4695,null))[_0x28fe('0x4d')](handleError(_0x9b4695,null));};exports[_0x28fe('0x4e')]=function(_0x232770,_0x292387){return db['UserProfile'][_0x28fe('0x4e')](_0x232770[_0x28fe('0x4f')],{})[_0x28fe('0x2a')](respondWithResult(_0x292387,0xc9))[_0x28fe('0x4d')](handleError(_0x292387,null));};exports['clone']=function(_0x128abb,_0x2f5ad3){var _0x4d4f18={'where':{'id':_0x128abb[_0x28fe('0x48')]['id']}},_0x4718d0={};_0x4718d0[_0x28fe('0x35')]=_['keys'](db['UserProfile']['rawAttributes']);_0x4d4f18[_0x28fe('0x3a')]=_[_0x28fe('0x39')](_0x4718d0[_0x28fe('0x35')],qs[_0x28fe('0x3b')](_0x128abb['query'][_0x28fe('0x3b')]));_0x4d4f18[_0x28fe('0x3a')]=_0x4d4f18['attributes'][_0x28fe('0x4a')]?_0x4d4f18[_0x28fe('0x3a')]:_0x4718d0[_0x28fe('0x35')];if(_0x128abb[_0x28fe('0x38')][_0x28fe('0x44')]){_0x4d4f18['include']=[{'all':!![]}];}_0x4d4f18=_[_0x28fe('0x43')]({},_0x4d4f18,_0x128abb['options']);return db[_0x28fe('0x30')][_0x28fe('0x4c')](_0x4d4f18)[_0x28fe('0x2a')](handleEntityNotFound(_0x2f5ad3,null))[_0x28fe('0x2a')](function(_0x3d5875){if(_0x3d5875){var _0x15e2eb=_0x3d5875[_0x28fe('0x50')]({'plain':!![]});_0x15e2eb=qs[_0x28fe('0x51')](_0x15e2eb,['id',_0x28fe('0x52'),_0x28fe('0x53'),_0x28fe('0x54')]);_0x128abb['body']=_[_0x28fe('0x51')](_0x128abb[_0x28fe('0x4f')],['id','createdAt',_0x28fe('0x53')]);return db[_0x28fe('0x55')][_0x28fe('0x56')](function(_0x38d241){return db['UserProfile']['create'](_[_0x28fe('0x43')](_0x15e2eb,_0x128abb[_0x28fe('0x4f')]),{'include':_0x128abb[_0x28fe('0x38')][_0x28fe('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x38d241})[_0x28fe('0x2a')](function(_0x426b0a){var _0x510578=_0x426b0a[_0x28fe('0x50')]({'plain':!![]});return db[_0x28fe('0x57')]['findAll']({'where':{'userProfileId':_0x128abb[_0x28fe('0x48')]['id']},'raw':!![]})['then'](function(_0x51d7b1){if(_0x51d7b1){return BPromise['each'](_0x51d7b1,function(_0x834915){return new BPromise(function(_0x1a7469,_0x312b6a){if(_0x834915[_0x28fe('0x58')]===null||_0x834915['autoAssociation']===0x1)_0x1a7469(null);return db['UserProfileResource'][_0x28fe('0x45')]({'where':{'sectionId':_0x834915['id']},'raw':!![]})['then'](function(_0x28068f){var _0x5154fc=_[_0x28fe('0x36')](_0x28068f,function(_0x637741){return qs[_0x28fe('0x51')](_0x637741,['id',_0x28fe('0x52'),_0x28fe('0x53'),_0x28fe('0x59')]);});_0x1a7469(_0x5154fc);})[_0x28fe('0x4d')](function(_0x4e135b){_0x312b6a(_0x4e135b);});})['then'](function(_0x933118){var _0x4c90e5=qs['omit'](_0x834915,['id',_0x28fe('0x52'),_0x28fe('0x53')]);_0x4c90e5[_0x28fe('0x5a')]=_0x510578['id'];if(_0x933118)_0x4c90e5[_0x28fe('0x5b')]=_0x933118;return _0x4c90e5;})[_0x28fe('0x2a')](function(_0x57ea7c){return db[_0x28fe('0x57')]['create'](_0x57ea7c,{'include':[{'model':db[_0x28fe('0x5c')],'as':_0x28fe('0x5b')}],'raw':!![],'transaction':_0x38d241});});})[_0x28fe('0x2a')](function(){return _0x510578;});}});});});}})[_0x28fe('0x2a')](respondWithResult(_0x2f5ad3,0xc9))[_0x28fe('0x4d')](handleError(_0x2f5ad3,null));};exports['update']=function(_0x393906,_0x333ee1){if(_0x393906[_0x28fe('0x4f')]['id']){delete _0x393906['body']['id'];}return db[_0x28fe('0x30')]['find']({'where':{'id':_0x393906[_0x28fe('0x48')]['id']}})[_0x28fe('0x2a')](handleEntityNotFound(_0x333ee1,null))['then'](saveUpdates(_0x393906[_0x28fe('0x4f')],null))['then'](respondWithResult(_0x333ee1,null))[_0x28fe('0x4d')](handleError(_0x333ee1,null));};exports['destroy']=function(_0x55d2e8,_0x64e1ba){return db[_0x28fe('0x30')][_0x28fe('0x4c')]({'where':{'id':_0x55d2e8['params']['id']}})[_0x28fe('0x2a')](handleEntityNotFound(_0x64e1ba,null))['then'](removeEntity(_0x64e1ba,null))[_0x28fe('0x4d')](handleError(_0x64e1ba,null));};exports[_0x28fe('0x5d')]=function(_0x51d29b,_0x316471){return db[_0x28fe('0x30')][_0x28fe('0x5d')]()['then'](respondWithResult(_0x316471,null))[_0x28fe('0x4d')](handleError(_0x316471,null));};exports[_0x28fe('0x5e')]=function(_0x4f3afe,_0x41e0b2){var _0x110aed=_0x4f3afe[_0x28fe('0x4f')];return db[_0x28fe('0x30')][_0x28fe('0x4c')]({'where':{'id':_0x4f3afe[_0x28fe('0x48')]['id']}})[_0x28fe('0x2a')](handleEntityNotFound(_0x41e0b2,null))['then'](function(_0x59dbaa){if(_0x59dbaa){return db[_0x28fe('0x55')][_0x28fe('0x56')](function(_0x23712c){return db['UserProfileSection'][_0x28fe('0x2b')]({'where':{'userProfileId':_0x4f3afe[_0x28fe('0x48')]['id'],'sectionId':_['map'](_0x110aed,function(_0x3bedce){return _0x3bedce[_0x28fe('0x59')];})},'transaction':_0x23712c})[_0x28fe('0x2a')](function(){var _0x43d4c1=_[_0x28fe('0x36')](_0x110aed,function(_0xcab2b2){_0xcab2b2[_0x28fe('0x5a')]=_0x4f3afe[_0x28fe('0x48')]['id'];return _0xcab2b2;});var _0x2539ea=[];return BPromise[_0x28fe('0x5f')](_0x43d4c1,function(_0xdd8d39){return db[_0x28fe('0x57')][_0x28fe('0x4e')](_0xdd8d39,{'include':[{'model':db[_0x28fe('0x5c')],'as':_0x28fe('0x5b')}],'raw':!![],'transaction':_0x23712c})[_0x28fe('0x2a')](function(_0x2da5c3){_0x2539ea[_0x28fe('0x60')](_0x2da5c3[_0x28fe('0x50')]({'plain':!![]}));});})[_0x28fe('0x2a')](function(){return _0x2539ea;});});});}})['then'](function(_0x568467){return _0x568467;})['then'](respondWithResult(_0x41e0b2,null))[_0x28fe('0x4d')](handleError(_0x41e0b2,null));};exports[_0x28fe('0x61')]=function(_0x164b52,_0x576282){var _0x5e357c;return db[_0x28fe('0x30')][_0x28fe('0x4c')]({'where':{'id':_0x164b52['params']['id']},'attributes':['id',_0x28fe('0x37')]})[_0x28fe('0x2a')](handleEntityNotFound(_0x576282,null))[_0x28fe('0x2a')](function(_0x4139e7){if(_0x4139e7){_0x5e357c=_0x4139e7;return db['UserProfileSection'][_0x28fe('0x2b')]({'where':{'userProfileId':_0x164b52['params']['id'],'sectionId':_0x164b52[_0x28fe('0x38')][_0x28fe('0x62')]}});}})['then'](function(){return _0x5e357c;})[_0x28fe('0x2a')](respondWithStatusCode(_0x576282,null))[_0x28fe('0x4d')](handleError(_0x576282,null));};exports[_0x28fe('0x63')]=function(_0x54fb31,_0x5089d4){var _0x177a8d=[];var _0x55cd3a=[];return db['UserProfileSection'][_0x28fe('0x45')]({'where':{'userProfileId':_0x54fb31[_0x28fe('0x48')]['id']},'raw':!![]})['then'](function(_0x4626e7){_0x177a8d=_['filter'](_0x4626e7,function(_0x681ff1){return _0x681ff1[_0x28fe('0x64')]===0x1||_[_0x28fe('0x65')]([0x3eb,0x709],_0x681ff1[_0x28fe('0x59')]);});if(!_[_0x28fe('0x66')](_0x177a8d)){return _['map'](_0x177a8d,function(_0x13650b){return _0x13650b[_0x28fe('0x59')];});}else{return;}})[_0x28fe('0x2a')](function(_0x36faff){if(_0x36faff)_0x55cd3a=_0x36faff;if(_[_0x28fe('0x65')](_0x55cd3a,0x64)){var _0x5c064a=_[_0x28fe('0x4c')](_0x177a8d,{'sectionId':0x64});return hasDefaultDashboard(_0x5c064a)[_0x28fe('0x2a')](function(_0x1620c3){return _['map'](_0x177a8d,function(_0x66bc8f){if(_0x66bc8f[_0x28fe('0x59')]===0x64){_0x66bc8f[_0x28fe('0x67')]=_0x1620c3;}return _0x66bc8f;});});}else{return;}})[_0x28fe('0x2a')](function(_0xf3bbb8){if(_0xf3bbb8)_0x177a8d=_0xf3bbb8;if(_[_0x28fe('0x65')](_0x55cd3a,0x3eb)){var _0x27c5e6=_['find'](_0x177a8d,{'sectionId':0x3eb});return getCustomDashboards(_0x27c5e6)[_0x28fe('0x2a')](function(_0x212b39){return _[_0x28fe('0x36')](_0x177a8d,function(_0x1568ed){if(_0x27c5e6['enabled']){if(_0x1568ed[_0x28fe('0x59')]===0x3eb){_0x1568ed[_0x28fe('0x67')]=_0x212b39;}}else{if(_0x1568ed[_0x28fe('0x59')]===0x64){if(!_0x1568ed['subsections']){_0x1568ed['subsections']=[];}_0x1568ed['subsections']=_0x1568ed[_0x28fe('0x67')][_0x28fe('0x68')](_0x212b39);}}return _0x1568ed;});});}else{return;}})[_0x28fe('0x2a')](function(_0x102467){if(_0x102467)_0x177a8d=_0x102467;if(_[_0x28fe('0x65')](_0x55cd3a,0x709)){var _0x39f5cd=_[_0x28fe('0x4c')](_0x177a8d,{'sectionId':0x709});return getPlugins(_0x39f5cd)[_0x28fe('0x2a')](function(_0x420584){if(_0x39f5cd['enabled']){return _['map'](_0x177a8d,function(_0x4c33a6){if(_0x4c33a6[_0x28fe('0x59')]===0x709){_0x4c33a6['subsections']=_0x420584;}return _0x4c33a6;});}else{var _0x3eddf3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x420584};var _0x2edaaa=_[_0x28fe('0x36')](_0x177a8d);_0x2edaaa['push'](_0x3eddf3);return _0x2edaaa;}});}else{return;}})[_0x28fe('0x2a')](function(_0x3491e5){if(_0x3491e5)_0x177a8d=_0x3491e5;return _[_0x28fe('0x42')](_0x177a8d,[_0x28fe('0x64'),0x1]);})['then'](respondWithResult(_0x5089d4,null))[_0x28fe('0x4d')](handleError(_0x5089d4,null));};function hasDefaultDashboard(_0x228f6c){var _0x49419d=[0x65];return new BPromise(function(_0x28e7ce,_0x5ad2be){try{if(_0x228f6c['autoAssociation']){_0x28e7ce(_0x49419d);}else{return db[_0x28fe('0x5c')]['findOne']({'where':{'sectionId':_0x228f6c['id']},'raw':!![]})[_0x28fe('0x2a')](function(_0x359169){_0x359169?_0x28e7ce(_0x49419d):_0x28e7ce();});}}catch(_0xbb9415){_0x5ad2be(_0xbb9415);}});}function getCustomDashboards(_0x3dde05){var _0x442deb=[];return new BPromise(function(_0x138789,_0x2f3fa3){try{if(_0x3dde05['autoAssociation']){return db[_0x28fe('0x69')][_0x28fe('0x45')]({'raw':!![]})[_0x28fe('0x2a')](function(_0x23dcc7){_0x23dcc7[_0x28fe('0x6a')](function(_0x5ec569){_0x442deb[_0x28fe('0x60')](_0x5ec569['id']+0x1869f);});_0x138789(_0x442deb);});}else{return db[_0x28fe('0x5c')][_0x28fe('0x45')]({'where':{'sectionId':_0x3dde05['id']},'raw':!![]})[_0x28fe('0x2a')](function(_0x56aa5c){_0x56aa5c[_0x28fe('0x6a')](function(_0x395314){_0x442deb[_0x28fe('0x60')](_0x395314[_0x28fe('0x6b')]+0x1869f);});_0x138789(_0x442deb);});}}catch(_0x41f7c0){_0x2f3fa3(_0x41f7c0);}});}function getPlugins(_0x183a5b){var _0x141b81=[];return new BPromise(function(_0x22f220,_0x565d24){try{if(_0x183a5b[_0x28fe('0x58')]){return db[_0x28fe('0x6c')][_0x28fe('0x45')]({'raw':!![]})[_0x28fe('0x2a')](function(_0x459675){_0x459675['forEach'](function(_0x4d4bf9){_0x141b81['push'](_0x4d4bf9['id']+0x15b38);});_0x22f220(_0x141b81);});}else{return db[_0x28fe('0x5c')][_0x28fe('0x45')]({'where':{'sectionId':_0x183a5b['id']},'raw':!![]})[_0x28fe('0x2a')](function(_0x5dd1c7){_0x5dd1c7['forEach'](function(_0x2d83b9){_0x141b81[_0x28fe('0x60')](_0x2d83b9[_0x28fe('0x6b')]+0x15b38);});_0x22f220(_0x141b81);});}}catch(_0xd62951){_0x565d24(_0xd62951);}});}exports[_0x28fe('0x6d')]=function(_0x455ad8,_0x553597){return db['UserProfile'][_0x28fe('0x4c')]({'where':{'id':_0x455ad8[_0x28fe('0x48')]['id']}})[_0x28fe('0x2a')](handleEntityNotFound(_0x553597,null))['then'](function(_0x287b48){if(_0x287b48){return db[_0x28fe('0x55')][_0x28fe('0x56')](function(_0x5e2477){return db[_0x28fe('0x57')][_0x28fe('0x45')]({'where':{'userProfileId':_0x455ad8['params']['id']},'attributes':['id'],'raw':!![]})[_0x28fe('0x2a')](function(_0x433814){if(_0x433814){return db['UserProfileSection'][_0x28fe('0x2b')]({'where':{'userProfileId':_0x455ad8[_0x28fe('0x48')]['id'],'id':_['map'](_0x433814,function(_0x388f02){return _0x388f02['id'];})},'transaction':_0x5e2477});}})[_0x28fe('0x2a')](function(_0x2baf11){var _0x4ee49b=_[_0x28fe('0x36')](_0x455ad8[_0x28fe('0x4f')],function(_0x1775da){_0x1775da['userProfileId']=_0x455ad8['params']['id'];return _0x1775da;});return db[_0x28fe('0x57')]['bulkCreate'](_0x4ee49b,{'raw':!![],'transaction':_0x5e2477});})['then'](function(_0x48bca3){var _0x1cee7d=_['filter'](_[_0x28fe('0x36')](_0x48bca3,function(_0x124887){return _0x124887[_0x28fe('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1cee7d){return db[_0x28fe('0x57')][_0x28fe('0x45')]({'where':{'userProfileId':_0x455ad8[_0x28fe('0x48')]['id'],'sectionId':_['map'](_0x1cee7d,function(_0x54a039){return _0x54a039['sectionId'];})},'attributes':['id',_0x28fe('0x59')],'raw':!![]})['then'](function(_0x9438d1){var _0x501a1b=_[_0x28fe('0x36')](_0x455ad8[_0x28fe('0x4f')],function(_0x317c03){_0x317c03[_0x28fe('0x5a')]=_0x455ad8[_0x28fe('0x48')]['id'];return _0x317c03;});return db['UserProfileResource']['bulkCreate'](_0x501a1b,{'raw':!![],'transaction':_0x5e2477});});}})[_0x28fe('0x4d')](handleError(_0x553597,null));});}})['then'](function(_0x193978){var _0x53ec3b=_[_0x28fe('0x36')](_0x193978,function(_0x4c7ec3){return _0x4c7ec3[_0x28fe('0x50')]({'plain':!![]});});})[_0x28fe('0x2a')](respondWithResult(_0x553597,null))[_0x28fe('0x4d')](handleError(_0x553597,null));};exports[_0x28fe('0x6e')]=function(_0x2bcf31,_0x23df64,_0x41af61){return db[_0x28fe('0x30')][_0x28fe('0x4c')]({'where':{'id':_0x2bcf31[_0x28fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x23df64,null))[_0x28fe('0x2a')](function(_0x8042dc){if(_0x8042dc){return _0x8042dc[_0x28fe('0x6e')](_0x2bcf31['query'][_0x28fe('0x62')]);}})[_0x28fe('0x2a')](respondWithStatusCode(_0x23df64,null))[_0x28fe('0x4d')](handleError(_0x23df64,null));};exports[_0x28fe('0x6f')]=function(_0x74f9b4,_0x369a10){var _0x3fa13b={};if(!_0x74f9b4['query'][_0x28fe('0x70')])throw new Error(_0x28fe('0x71'));if(!_0x74f9b4[_0x28fe('0x38')][_0x28fe('0x3c')](_0x28fe('0x72'))){_0x3fa13b['limit']=qs[_0x28fe('0x21')](_0x74f9b4[_0x28fe('0x38')][_0x28fe('0x21')]);_0x3fa13b[_0x28fe('0x24')]=qs['offset'](_0x74f9b4[_0x28fe('0x38')][_0x28fe('0x24')]);}return db['UserProfile'][_0x28fe('0x4c')]({'where':{'id':_0x74f9b4[_0x28fe('0x48')]['id']}})[_0x28fe('0x2a')](function(_0x261c4e){if(!_0x261c4e)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x74f9b4[_0x28fe('0x48')]['id']);return db['UserProfile']['getResources'](_0x74f9b4);})[_0x28fe('0x2a')](respondWithFilteredResult(_0x369a10,_0x3fa13b))['catch'](handleError(_0x369a10,null));}; \ No newline at end of file +var _0x1b14=['socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','UserProfile','include','findAll','catch','show','params','fields','includeAll','create','body','clone','keys','find','omit','crudPermissions','updatedAt','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','createdAt','sectionId','userProfileId','Resources','describe','sequelize','each','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','forEach','resourceId','Plugin','bulkCreate','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0x10187b,_0xe4275b){var _0xe50337=function(_0x12bc9f){while(--_0x12bc9f){_0x10187b['push'](_0x10187b['shift']());}};_0xe50337(++_0xe4275b);}(_0x1b14,0x19e));var _0x41b1=function(_0x541455,_0xb15217){_0x541455=_0x541455-0x0;var _0x41223b=_0x1b14[_0x541455];return _0x41223b;};'use strict';var emlformat=require(_0x41b1('0x0'));var rimraf=require(_0x41b1('0x1'));var zipdir=require(_0x41b1('0x2'));var jsonpatch=require(_0x41b1('0x3'));var rp=require(_0x41b1('0x4'));var moment=require('moment');var BPromise=require(_0x41b1('0x5'));var Mustache=require(_0x41b1('0x6'));var util=require(_0x41b1('0x7'));var path=require(_0x41b1('0x8'));var sox=require(_0x41b1('0x9'));var csv=require(_0x41b1('0xa'));var ejs=require(_0x41b1('0xb'));var fs=require('fs');var fs_extra=require(_0x41b1('0xc'));var _=require('lodash');var squel=require(_0x41b1('0xd'));var crypto=require(_0x41b1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x41b1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x41b1('0xf'));var authService=require(_0x41b1('0x10'));var qs=require(_0x41b1('0x11'));var as=require(_0x41b1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x41b1('0x13'));var utils=require(_0x41b1('0x14'));var config=require(_0x41b1('0x15'));var licenseUtil=require(_0x41b1('0x16'));var db=require('../../mysqldb')['db'];config[_0x41b1('0x17')]=_[_0x41b1('0x18')](config['redis'],{'host':_0x41b1('0x19'),'port':0x18eb});var socket=require(_0x41b1('0x1a'))(new Redis(config[_0x41b1('0x17')]));require(_0x41b1('0x1b'))[_0x41b1('0x1c')](socket);function respondWithStatusCode(_0x3756a8,_0x3c7c0d){_0x3c7c0d=_0x3c7c0d||0xcc;return function(_0x55de59){if(_0x55de59){return _0x3756a8[_0x41b1('0x1d')](_0x3c7c0d);}return _0x3756a8[_0x41b1('0x1e')](_0x3c7c0d)[_0x41b1('0x1f')]();};}function respondWithResult(_0x3183f5,_0x45d8b8){_0x45d8b8=_0x45d8b8||0xc8;return function(_0x225c3a){if(_0x225c3a){return _0x3183f5['status'](_0x45d8b8)['json'](_0x225c3a);}};}function respondWithFilteredResult(_0x2478cf,_0x1e5aaf){return function(_0x51845d){if(_0x51845d){var _0x1effe0=typeof _0x1e5aaf[_0x41b1('0x20')]===_0x41b1('0x21')&&typeof _0x1e5aaf[_0x41b1('0x22')]===_0x41b1('0x21');var _0x1d3cdf=_0x51845d[_0x41b1('0x23')];var _0x5d83f5=_0x1effe0?0x0:_0x1e5aaf['offset'];var _0x5b3c70=_0x1effe0?_0x51845d['count']:_0x1e5aaf['offset']+_0x1e5aaf[_0x41b1('0x22')];var _0x3cf5d3;if(_0x5b3c70>=_0x1d3cdf){_0x5b3c70=_0x1d3cdf;_0x3cf5d3=0xc8;}else{_0x3cf5d3=0xce;}_0x2478cf[_0x41b1('0x1e')](_0x3cf5d3);return _0x2478cf[_0x41b1('0x24')](_0x41b1('0x25'),_0x5d83f5+'-'+_0x5b3c70+'/'+_0x1d3cdf)['json'](_0x51845d);}return null;};}function patchUpdates(_0x587581){return function(_0x5b3654){try{jsonpatch['apply'](_0x5b3654,_0x587581,!![]);}catch(_0x4be5fa){return BPromise['reject'](_0x4be5fa);}return _0x5b3654[_0x41b1('0x26')]();};}function saveUpdates(_0x34d1e9,_0x4fdc4b){return function(_0x115f30){if(_0x115f30){return _0x115f30[_0x41b1('0x27')](_0x34d1e9)['then'](function(_0x32eb25){return _0x32eb25;});}return null;};}function removeEntity(_0x2ab81d,_0x5d3296){return function(_0x590eb3){if(_0x590eb3){return _0x590eb3[_0x41b1('0x28')]()[_0x41b1('0x29')](function(){_0x2ab81d[_0x41b1('0x1e')](0xcc)[_0x41b1('0x1f')]();});}};}function handleEntityNotFound(_0x3a37c8,_0x163ea8){return function(_0x297a6e){if(!_0x297a6e){_0x3a37c8[_0x41b1('0x1d')](0x194);}return _0x297a6e;};}function handleError(_0xb8997e,_0x10d5d9){_0x10d5d9=_0x10d5d9||0x1f4;return function(_0x10e1ac){logger[_0x41b1('0x2a')](_0x10e1ac[_0x41b1('0x2b')]);if(_0x10e1ac[_0x41b1('0x2c')]){delete _0x10e1ac[_0x41b1('0x2c')];}_0xb8997e[_0x41b1('0x1e')](_0x10d5d9)[_0x41b1('0x2d')](_0x10e1ac);};}exports[_0x41b1('0x2e')]=function(_0x5b9741,_0x48e3f7){var _0x4fab2d={},_0x3e0cc9={},_0xa4b813={'count':0x0,'rows':[]};var _0x5d748b=_[_0x41b1('0x2f')](db['UserProfile'][_0x41b1('0x30')],function(_0x52b4f4){return{'name':_0x52b4f4[_0x41b1('0x31')],'type':_0x52b4f4[_0x41b1('0x32')][_0x41b1('0x33')]};});_0x3e0cc9[_0x41b1('0x34')]=_[_0x41b1('0x2f')](_0x5d748b,_0x41b1('0x2c'));_0x3e0cc9[_0x41b1('0x35')]=_['keys'](_0x5b9741[_0x41b1('0x35')]);_0x3e0cc9['filters']=_[_0x41b1('0x36')](_0x3e0cc9[_0x41b1('0x34')],_0x3e0cc9[_0x41b1('0x35')]);_0x4fab2d[_0x41b1('0x37')]=_[_0x41b1('0x36')](_0x3e0cc9[_0x41b1('0x34')],qs['fields'](_0x5b9741[_0x41b1('0x35')]['fields']));_0x4fab2d[_0x41b1('0x37')]=_0x4fab2d[_0x41b1('0x37')][_0x41b1('0x38')]?_0x4fab2d[_0x41b1('0x37')]:_0x3e0cc9['model'];if(!_0x5b9741[_0x41b1('0x35')][_0x41b1('0x39')](_0x41b1('0x3a'))){_0x4fab2d[_0x41b1('0x22')]=qs[_0x41b1('0x22')](_0x5b9741[_0x41b1('0x35')][_0x41b1('0x22')]);_0x4fab2d['offset']=qs['offset'](_0x5b9741['query']['offset']);}_0x4fab2d[_0x41b1('0x3b')]=qs['sort'](_0x5b9741[_0x41b1('0x35')]['sort']);_0x4fab2d[_0x41b1('0x3c')]=qs[_0x41b1('0x3d')](_['pick'](_0x5b9741[_0x41b1('0x35')],_0x3e0cc9['filters']),_0x5d748b);if(_0x5b9741['query'][_0x41b1('0x3e')]){_0x4fab2d['where']=_[_0x41b1('0x3f')](_0x4fab2d['where'],{'$or':_[_0x41b1('0x2f')](_0x5d748b,function(_0x17d121){if(_0x17d121[_0x41b1('0x32')]!==_0x41b1('0x40')){var _0xa9c86a={};_0xa9c86a[_0x17d121[_0x41b1('0x2c')]]={'$like':'%'+_0x5b9741[_0x41b1('0x35')][_0x41b1('0x3e')]+'%'};return _0xa9c86a;}})});}_0x4fab2d=_[_0x41b1('0x3f')]({},_0x4fab2d,_0x5b9741[_0x41b1('0x41')]);var _0x3cce46={'where':_0x4fab2d[_0x41b1('0x3c')]};return db[_0x41b1('0x42')]['count'](_0x3cce46)[_0x41b1('0x29')](function(_0x548fc9){_0xa4b813[_0x41b1('0x23')]=_0x548fc9;if(_0x5b9741[_0x41b1('0x35')]['includeAll']){_0x4fab2d[_0x41b1('0x43')]=[{'all':!![]}];}return db['UserProfile'][_0x41b1('0x44')](_0x4fab2d);})[_0x41b1('0x29')](function(_0x3b65f0){_0xa4b813['rows']=_0x3b65f0;return _0xa4b813;})[_0x41b1('0x29')](respondWithFilteredResult(_0x48e3f7,_0x4fab2d))[_0x41b1('0x45')](handleError(_0x48e3f7,null));};exports[_0x41b1('0x46')]=function(_0x5c2803,_0x543ae8){var _0xcfefe2={'raw':![],'where':{'id':_0x5c2803[_0x41b1('0x47')]['id']}},_0x44f7e3={};_0x44f7e3[_0x41b1('0x34')]=_['keys'](db['UserProfile'][_0x41b1('0x30')]);_0x44f7e3[_0x41b1('0x35')]=_['keys'](_0x5c2803[_0x41b1('0x35')]);_0x44f7e3[_0x41b1('0x3d')]=_[_0x41b1('0x36')](_0x44f7e3[_0x41b1('0x34')],_0x44f7e3['query']);_0xcfefe2['attributes']=_['intersection'](_0x44f7e3[_0x41b1('0x34')],qs[_0x41b1('0x48')](_0x5c2803[_0x41b1('0x35')][_0x41b1('0x48')]));_0xcfefe2[_0x41b1('0x37')]=_0xcfefe2['attributes']['length']?_0xcfefe2[_0x41b1('0x37')]:_0x44f7e3[_0x41b1('0x34')];if(_0x5c2803[_0x41b1('0x35')][_0x41b1('0x49')]){_0xcfefe2[_0x41b1('0x43')]=[{'all':!![]}];}_0xcfefe2=_[_0x41b1('0x3f')]({},_0xcfefe2,_0x5c2803[_0x41b1('0x41')]);return db[_0x41b1('0x42')]['find'](_0xcfefe2)[_0x41b1('0x29')](handleEntityNotFound(_0x543ae8,null))[_0x41b1('0x29')](respondWithResult(_0x543ae8,null))[_0x41b1('0x45')](handleError(_0x543ae8,null));};exports[_0x41b1('0x4a')]=function(_0x3b1620,_0x14cfc4){return db[_0x41b1('0x42')][_0x41b1('0x4a')](_0x3b1620[_0x41b1('0x4b')],{})['then'](respondWithResult(_0x14cfc4,0xc9))[_0x41b1('0x45')](handleError(_0x14cfc4,null));};exports[_0x41b1('0x4c')]=function(_0x3373e3,_0x4448e3){var _0x597d65={'where':{'id':_0x3373e3[_0x41b1('0x47')]['id']}},_0x4e98d3={};_0x4e98d3[_0x41b1('0x34')]=_[_0x41b1('0x4d')](db[_0x41b1('0x42')][_0x41b1('0x30')]);_0x597d65[_0x41b1('0x37')]=_[_0x41b1('0x36')](_0x4e98d3[_0x41b1('0x34')],qs[_0x41b1('0x48')](_0x3373e3[_0x41b1('0x35')][_0x41b1('0x48')]));_0x597d65['attributes']=_0x597d65[_0x41b1('0x37')][_0x41b1('0x38')]?_0x597d65[_0x41b1('0x37')]:_0x4e98d3[_0x41b1('0x34')];if(_0x3373e3[_0x41b1('0x35')]['includeAll']){_0x597d65[_0x41b1('0x43')]=[{'all':!![]}];}_0x597d65=_['merge']({},_0x597d65,_0x3373e3['options']);return db[_0x41b1('0x42')][_0x41b1('0x4e')](_0x597d65)['then'](handleEntityNotFound(_0x4448e3,null))[_0x41b1('0x29')](function(_0x5a272e){if(_0x5a272e){var _0x3a75ec=_0x5a272e['get']({'plain':!![]});_0x3a75ec=qs[_0x41b1('0x4f')](_0x3a75ec,['id','createdAt','updatedAt',_0x41b1('0x50')]);_0x3373e3[_0x41b1('0x4b')]=_[_0x41b1('0x4f')](_0x3373e3[_0x41b1('0x4b')],['id','createdAt',_0x41b1('0x51')]);return db['sequelize'][_0x41b1('0x52')](function(_0x2bd5e8){return db[_0x41b1('0x42')][_0x41b1('0x4a')](_[_0x41b1('0x3f')](_0x3a75ec,_0x3373e3[_0x41b1('0x4b')]),{'include':_0x3373e3['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2bd5e8})[_0x41b1('0x29')](function(_0x6374db){var _0xb7395a=_0x6374db[_0x41b1('0x53')]({'plain':!![]});return db[_0x41b1('0x54')][_0x41b1('0x44')]({'where':{'userProfileId':_0x3373e3['params']['id']},'raw':!![]})[_0x41b1('0x29')](function(_0x47ffe0){if(_0x47ffe0){return BPromise['each'](_0x47ffe0,function(_0x1492da){return new BPromise(function(_0x59189e,_0x42cf0b){if(_0x1492da[_0x41b1('0x55')]===null||_0x1492da['autoAssociation']===0x1)_0x59189e(null);return db[_0x41b1('0x56')][_0x41b1('0x44')]({'where':{'sectionId':_0x1492da['id']},'raw':!![]})[_0x41b1('0x29')](function(_0x30e628){var _0x3d9182=_[_0x41b1('0x2f')](_0x30e628,function(_0x11b968){return qs[_0x41b1('0x4f')](_0x11b968,['id',_0x41b1('0x57'),_0x41b1('0x51'),_0x41b1('0x58')]);});_0x59189e(_0x3d9182);})[_0x41b1('0x45')](function(_0x2c2aec){_0x42cf0b(_0x2c2aec);});})[_0x41b1('0x29')](function(_0x44ea57){var _0x57bf40=qs[_0x41b1('0x4f')](_0x1492da,['id',_0x41b1('0x57'),_0x41b1('0x51')]);_0x57bf40[_0x41b1('0x59')]=_0xb7395a['id'];if(_0x44ea57)_0x57bf40[_0x41b1('0x5a')]=_0x44ea57;return _0x57bf40;})[_0x41b1('0x29')](function(_0x24f08d){return db[_0x41b1('0x54')][_0x41b1('0x4a')](_0x24f08d,{'include':[{'model':db[_0x41b1('0x56')],'as':_0x41b1('0x5a')}],'raw':!![],'transaction':_0x2bd5e8});});})[_0x41b1('0x29')](function(){return _0xb7395a;});}});});});}})[_0x41b1('0x29')](respondWithResult(_0x4448e3,0xc9))['catch'](handleError(_0x4448e3,null));};exports[_0x41b1('0x27')]=function(_0x593e17,_0x3534e9){if(_0x593e17[_0x41b1('0x4b')]['id']){delete _0x593e17[_0x41b1('0x4b')]['id'];}return db[_0x41b1('0x42')][_0x41b1('0x4e')]({'where':{'id':_0x593e17['params']['id']}})['then'](handleEntityNotFound(_0x3534e9,null))[_0x41b1('0x29')](saveUpdates(_0x593e17[_0x41b1('0x4b')],null))[_0x41b1('0x29')](respondWithResult(_0x3534e9,null))['catch'](handleError(_0x3534e9,null));};exports[_0x41b1('0x28')]=function(_0x9c1673,_0x3bae33){return db[_0x41b1('0x42')][_0x41b1('0x4e')]({'where':{'id':_0x9c1673[_0x41b1('0x47')]['id']}})[_0x41b1('0x29')](handleEntityNotFound(_0x3bae33,null))[_0x41b1('0x29')](removeEntity(_0x3bae33,null))[_0x41b1('0x45')](handleError(_0x3bae33,null));};exports[_0x41b1('0x5b')]=function(_0x526d3f,_0x99da32){return db[_0x41b1('0x42')][_0x41b1('0x5b')]()[_0x41b1('0x29')](respondWithResult(_0x99da32,null))[_0x41b1('0x45')](handleError(_0x99da32,null));};exports['addSections']=function(_0x4a86ab,_0x564ff5){var _0x407d80=_0x4a86ab[_0x41b1('0x4b')];return db[_0x41b1('0x42')][_0x41b1('0x4e')]({'where':{'id':_0x4a86ab[_0x41b1('0x47')]['id']}})[_0x41b1('0x29')](handleEntityNotFound(_0x564ff5,null))['then'](function(_0x62a1cd){if(_0x62a1cd){return db[_0x41b1('0x5c')][_0x41b1('0x52')](function(_0x105448){return db['UserProfileSection'][_0x41b1('0x28')]({'where':{'userProfileId':_0x4a86ab[_0x41b1('0x47')]['id'],'sectionId':_[_0x41b1('0x2f')](_0x407d80,function(_0x3dfb70){return _0x3dfb70['sectionId'];})},'transaction':_0x105448})[_0x41b1('0x29')](function(){var _0x22b712=_[_0x41b1('0x2f')](_0x407d80,function(_0x3efb6e){_0x3efb6e['userProfileId']=_0x4a86ab['params']['id'];return _0x3efb6e;});var _0x1591cd=[];return BPromise[_0x41b1('0x5d')](_0x22b712,function(_0x5e87d7){return db[_0x41b1('0x54')]['create'](_0x5e87d7,{'include':[{'model':db['UserProfileResource'],'as':_0x41b1('0x5a')}],'raw':!![],'transaction':_0x105448})[_0x41b1('0x29')](function(_0xb3fba8){_0x1591cd[_0x41b1('0x5e')](_0xb3fba8[_0x41b1('0x53')]({'plain':!![]}));});})[_0x41b1('0x29')](function(){return _0x1591cd;});});});}})['then'](function(_0x28d2fa){return _0x28d2fa;})['then'](respondWithResult(_0x564ff5,null))[_0x41b1('0x45')](handleError(_0x564ff5,null));};exports[_0x41b1('0x5f')]=function(_0x43a28e,_0x31efb7){var _0x284835;return db[_0x41b1('0x42')][_0x41b1('0x4e')]({'where':{'id':_0x43a28e[_0x41b1('0x47')]['id']},'attributes':['id',_0x41b1('0x2c')]})[_0x41b1('0x29')](handleEntityNotFound(_0x31efb7,null))['then'](function(_0x178048){if(_0x178048){_0x284835=_0x178048;return db[_0x41b1('0x54')][_0x41b1('0x28')]({'where':{'userProfileId':_0x43a28e[_0x41b1('0x47')]['id'],'sectionId':_0x43a28e[_0x41b1('0x35')][_0x41b1('0x60')]}});}})['then'](function(){return _0x284835;})[_0x41b1('0x29')](respondWithStatusCode(_0x31efb7,null))['catch'](handleError(_0x31efb7,null));};exports[_0x41b1('0x61')]=function(_0x469b67,_0x1aca6a){var _0x23d8d4=[];var _0x45e216=[];return db[_0x41b1('0x54')][_0x41b1('0x44')]({'where':{'userProfileId':_0x469b67[_0x41b1('0x47')]['id']},'raw':!![]})['then'](function(_0x5de6be){_0x23d8d4=_[_0x41b1('0x3e')](_0x5de6be,function(_0x169c94){return _0x169c94[_0x41b1('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x169c94[_0x41b1('0x58')]);});if(!_[_0x41b1('0x63')](_0x23d8d4)){return _['map'](_0x23d8d4,function(_0x4b063a){return _0x4b063a[_0x41b1('0x58')];});}else{return;}})[_0x41b1('0x29')](function(_0x376743){if(_0x376743)_0x45e216=_0x376743;if(_[_0x41b1('0x64')](_0x45e216,0x64)){var _0x2b01ea=_[_0x41b1('0x4e')](_0x23d8d4,{'sectionId':0x64});return hasDefaultDashboard(_0x2b01ea)['then'](function(_0x3a81f0){return _[_0x41b1('0x2f')](_0x23d8d4,function(_0x4dee27){if(_0x4dee27[_0x41b1('0x58')]===0x64){_0x4dee27[_0x41b1('0x65')]=_0x3a81f0;}return _0x4dee27;});});}else{return;}})[_0x41b1('0x29')](function(_0x2bd6ed){if(_0x2bd6ed)_0x23d8d4=_0x2bd6ed;if(_[_0x41b1('0x64')](_0x45e216,0x3eb)){var _0x482e5f=_[_0x41b1('0x4e')](_0x23d8d4,{'sectionId':0x3eb});return getCustomDashboards(_0x482e5f)[_0x41b1('0x29')](function(_0xbab0ad){return _[_0x41b1('0x2f')](_0x23d8d4,function(_0x1b4190){if(_0x482e5f['enabled']){if(_0x1b4190[_0x41b1('0x58')]===0x3eb){_0x1b4190[_0x41b1('0x65')]=_0xbab0ad;}}else{if(_0x1b4190[_0x41b1('0x58')]===0x64){if(!_0x1b4190[_0x41b1('0x65')]){_0x1b4190[_0x41b1('0x65')]=[];}_0x1b4190[_0x41b1('0x65')]=_0x1b4190[_0x41b1('0x65')]['concat'](_0xbab0ad);}}return _0x1b4190;});});}else{return;}})[_0x41b1('0x29')](function(_0x110b46){if(_0x110b46)_0x23d8d4=_0x110b46;if(_[_0x41b1('0x64')](_0x45e216,0x709)){var _0x1f12be=_[_0x41b1('0x4e')](_0x23d8d4,{'sectionId':0x709});return getPlugins(_0x1f12be)[_0x41b1('0x29')](function(_0x336c93){if(_0x1f12be['enabled']){return _[_0x41b1('0x2f')](_0x23d8d4,function(_0x23d69d){if(_0x23d69d[_0x41b1('0x58')]===0x709){_0x23d69d[_0x41b1('0x65')]=_0x336c93;}return _0x23d69d;});}else{var _0x369be3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x336c93};var _0x903dbb=_['map'](_0x23d8d4);_0x903dbb[_0x41b1('0x5e')](_0x369be3);return _0x903dbb;}});}else{return;}})[_0x41b1('0x29')](function(_0x320be3){if(_0x320be3)_0x23d8d4=_0x320be3;return _[_0x41b1('0x3e')](_0x23d8d4,[_0x41b1('0x62'),0x1]);})['then'](respondWithResult(_0x1aca6a,null))['catch'](handleError(_0x1aca6a,null));};function hasDefaultDashboard(_0x1a34f6){var _0x34db16=[0x65];return new BPromise(function(_0xcf8d8d,_0x446276){try{if(_0x1a34f6[_0x41b1('0x55')]){_0xcf8d8d(_0x34db16);}else{return db[_0x41b1('0x56')][_0x41b1('0x66')]({'where':{'sectionId':_0x1a34f6['id']},'raw':!![]})[_0x41b1('0x29')](function(_0x412c6c){_0x412c6c?_0xcf8d8d(_0x34db16):_0xcf8d8d();});}}catch(_0x441a79){_0x446276(_0x441a79);}});}function getCustomDashboards(_0x3e6c96){var _0x30927d=[];return new BPromise(function(_0x3779eb,_0x2248d2){try{if(_0x3e6c96['autoAssociation']){return db['Dashboard']['findAll']({'raw':!![]})[_0x41b1('0x29')](function(_0x28eff2){_0x28eff2[_0x41b1('0x67')](function(_0x27375b){_0x30927d[_0x41b1('0x5e')](_0x27375b['id']+0x1869f);});_0x3779eb(_0x30927d);});}else{return db['UserProfileResource'][_0x41b1('0x44')]({'where':{'sectionId':_0x3e6c96['id']},'raw':!![]})[_0x41b1('0x29')](function(_0x12df9f){_0x12df9f[_0x41b1('0x67')](function(_0x28c9a0){_0x30927d[_0x41b1('0x5e')](_0x28c9a0[_0x41b1('0x68')]+0x1869f);});_0x3779eb(_0x30927d);});}}catch(_0x1a78fe){_0x2248d2(_0x1a78fe);}});}function getPlugins(_0x25e752){var _0x507aa4=[];return new BPromise(function(_0x49d2df,_0x4b356f){try{if(_0x25e752[_0x41b1('0x55')]){return db[_0x41b1('0x69')]['findAll']({'raw':!![]})[_0x41b1('0x29')](function(_0x5905e5){_0x5905e5[_0x41b1('0x67')](function(_0x423b5d){_0x507aa4['push'](_0x423b5d['id']+0x15b38);});_0x49d2df(_0x507aa4);});}else{return db[_0x41b1('0x56')][_0x41b1('0x44')]({'where':{'sectionId':_0x25e752['id']},'raw':!![]})[_0x41b1('0x29')](function(_0x360cf1){_0x360cf1[_0x41b1('0x67')](function(_0x559519){_0x507aa4[_0x41b1('0x5e')](_0x559519[_0x41b1('0x68')]+0x15b38);});_0x49d2df(_0x507aa4);});}}catch(_0x404d55){_0x4b356f(_0x404d55);}});}exports['addResources']=function(_0x4ba76c,_0x136415){return db[_0x41b1('0x42')][_0x41b1('0x4e')]({'where':{'id':_0x4ba76c[_0x41b1('0x47')]['id']}})[_0x41b1('0x29')](handleEntityNotFound(_0x136415,null))[_0x41b1('0x29')](function(_0x4a1a39){if(_0x4a1a39){return db[_0x41b1('0x5c')][_0x41b1('0x52')](function(_0x136de7){return db['UserProfileSection'][_0x41b1('0x44')]({'where':{'userProfileId':_0x4ba76c[_0x41b1('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x41b1('0x29')](function(_0x49999a){if(_0x49999a){return db[_0x41b1('0x54')][_0x41b1('0x28')]({'where':{'userProfileId':_0x4ba76c[_0x41b1('0x47')]['id'],'id':_[_0x41b1('0x2f')](_0x49999a,function(_0x49253e){return _0x49253e['id'];})},'transaction':_0x136de7});}})[_0x41b1('0x29')](function(_0x530684){var _0x366bc8=_[_0x41b1('0x2f')](_0x4ba76c[_0x41b1('0x4b')],function(_0x1d7620){_0x1d7620[_0x41b1('0x59')]=_0x4ba76c[_0x41b1('0x47')]['id'];return _0x1d7620;});return db[_0x41b1('0x54')][_0x41b1('0x6a')](_0x366bc8,{'raw':!![],'transaction':_0x136de7});})['then'](function(_0xcf80cc){var _0x10fc9e=_[_0x41b1('0x3e')](_[_0x41b1('0x2f')](_0xcf80cc,function(_0x1d0d94){return _0x1d0d94[_0x41b1('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x10fc9e){return db[_0x41b1('0x54')][_0x41b1('0x44')]({'where':{'userProfileId':_0x4ba76c[_0x41b1('0x47')]['id'],'sectionId':_[_0x41b1('0x2f')](_0x10fc9e,function(_0x3f426d){return _0x3f426d[_0x41b1('0x58')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x41b1('0x29')](function(_0x44cbda){var _0x34e0fe=_[_0x41b1('0x2f')](_0x4ba76c['body'],function(_0x15931e){_0x15931e[_0x41b1('0x59')]=_0x4ba76c[_0x41b1('0x47')]['id'];return _0x15931e;});return db[_0x41b1('0x56')][_0x41b1('0x6a')](_0x34e0fe,{'raw':!![],'transaction':_0x136de7});});}})[_0x41b1('0x45')](handleError(_0x136415,null));});}})[_0x41b1('0x29')](function(_0x13c4c9){var _0x7bd669=_['map'](_0x13c4c9,function(_0x109c0c){return _0x109c0c[_0x41b1('0x53')]({'plain':!![]});});})[_0x41b1('0x29')](respondWithResult(_0x136415,null))['catch'](handleError(_0x136415,null));};exports['removeResources']=function(_0x37ef68,_0x388a77,_0x5e6b98){return db['UserProfile'][_0x41b1('0x4e')]({'where':{'id':_0x37ef68[_0x41b1('0x47')]['id']}})[_0x41b1('0x29')](handleEntityNotFound(_0x388a77,null))['then'](function(_0x2595ab){if(_0x2595ab){return _0x2595ab['removeResources'](_0x37ef68[_0x41b1('0x35')]['ids']);}})[_0x41b1('0x29')](respondWithStatusCode(_0x388a77,null))['catch'](handleError(_0x388a77,null));};exports[_0x41b1('0x6b')]=function(_0x168382,_0x3fe1fe){var _0x56fd35={};if(!_0x168382[_0x41b1('0x35')]['section'])throw new Error(_0x41b1('0x6c'));if(!_0x168382[_0x41b1('0x35')]['hasOwnProperty'](_0x41b1('0x3a'))){_0x56fd35['limit']=qs[_0x41b1('0x22')](_0x168382[_0x41b1('0x35')]['limit']);_0x56fd35[_0x41b1('0x20')]=qs['offset'](_0x168382[_0x41b1('0x35')]['offset']);}return db[_0x41b1('0x42')][_0x41b1('0x4e')]({'where':{'id':_0x168382[_0x41b1('0x47')]['id']}})[_0x41b1('0x29')](function(_0x5db644){if(!_0x5db644)throw new Error(_0x41b1('0x6d')+_0x168382[_0x41b1('0x47')]['id']);return db['UserProfile'][_0x41b1('0x6b')](_0x168382);})[_0x41b1('0x29')](respondWithFilteredResult(_0x3fe1fe,_0x56fd35))[_0x41b1('0x45')](handleError(_0x3fe1fe,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7d693d6..fd1cce2 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 _0x8b8e=['save','emit','hasOwnProperty','hook','exports','events','UserProfile'];(function(_0x1035eb,_0x4023d7){var _0x35a2db=function(_0x3af4cf){while(--_0x3af4cf){_0x1035eb['push'](_0x1035eb['shift']());}};_0x35a2db(++_0x4023d7);}(_0x8b8e,0x108));var _0xe8b8=function(_0x54f270,_0x5116ba){_0x54f270=_0x54f270-0x0;var _0x2fee7d=_0x8b8e[_0x54f270];return _0x2fee7d;};'use strict';var EventEmitter=require(_0xe8b8('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xe8b8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe8b8('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xb409fe){return function(_0x472a91,_0x13a865,_0x221ccc){UserProfileEvents[_0xe8b8('0x3')](_0xb409fe+':'+_0x472a91['id'],_0x472a91);UserProfileEvents[_0xe8b8('0x3')](_0xb409fe,_0x472a91);_0x221ccc(null);};}for(var e in events){if(events[_0xe8b8('0x4')](e)){var event=events[e];UserProfile[_0xe8b8('0x5')](e,emitEvent(event));}}module[_0xe8b8('0x6')]=UserProfileEvents; \ No newline at end of file +var _0xbc36=['exports','events','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x32d1e5,_0x37fe50){var _0x555cda=function(_0xbc4236){while(--_0xbc4236){_0x32d1e5['push'](_0x32d1e5['shift']());}};_0x555cda(++_0x37fe50);}(_0xbc36,0x169));var _0x6bc3=function(_0x1b321b,_0x461707){_0x1b321b=_0x1b321b-0x0;var _0x2e719c=_0xbc36[_0x1b321b];return _0x2e719c;};'use strict';var EventEmitter=require(_0x6bc3('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x6bc3('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6bc3('0x2')](0x0);var events={'afterCreate':_0x6bc3('0x3'),'afterUpdate':_0x6bc3('0x4'),'afterDestroy':_0x6bc3('0x5')};function emitEvent(_0x441f74){return function(_0x3f2335,_0x1d73ad,_0x3e8659){UserProfileEvents['emit'](_0x441f74+':'+_0x3f2335['id'],_0x3f2335);UserProfileEvents[_0x6bc3('0x6')](_0x441f74,_0x3f2335);_0x3e8659(null);};}for(var e in events){if(events[_0x6bc3('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x6bc3('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e4a0e67..cd054c4 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 _0xd4b9=['VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','value','findAll','then','associatedResources','map','catch','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','CmContact','parentSections','ListId','CmList','companies','CmCustomField','chatqueues','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','name','telephone','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','QueueCampaigns','agents','telephones','Users','role','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','Pause','scheduler','sounds','tags','Tag','templates','Template','Trigger','trunks','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','rawAttributes','model','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','key'];(function(_0x3a4a9b,_0x29315d){var _0x58454b=function(_0x5b0be4){while(--_0x5b0be4){_0x3a4a9b['push'](_0x3a4a9b['shift']());}};_0x58454b(++_0x29315d);}(_0xd4b9,0x19d));var _0x9d4b=function(_0x2e01e9,_0x44558e){_0x2e01e9=_0x2e01e9-0x0;var _0x547b4a=_0xd4b9[_0x2e01e9];return _0x547b4a;};'use strict';var _=require(_0x9d4b('0x0'));var attributes=require(_0x9d4b('0x1'));var qs=require(_0x9d4b('0x2'));var squel=require('squel');module[_0x9d4b('0x3')]=function(_0x548ac8){var _0x4c20d9=_0x548ac8['models'];function _0x1a618b(_0x54aba8,_0x4a915f){return new Promise(function(_0x4caf9e,_0x1bfaff){if(!_0x4a915f)return _0x4caf9e(null);var _0x4c9a6a=_0x4a915f[_0x9d4b('0x4')]?{[_0x4a915f['filter'][_0x9d4b('0x5')]]:_0x4a915f[_0x9d4b('0x4')][_0x9d4b('0x6')]}:undefined;return _0x4c20d9[_0x54aba8][_0x9d4b('0x7')]({'where':_0x4c9a6a,'raw':!![]})[_0x9d4b('0x8')](function(_0x35fec2){_0x4a915f[_0x9d4b('0x9')]=_[_0x9d4b('0xa')](_0x35fec2,'id');_0x4caf9e(_0x4a915f);})[_0x9d4b('0xb')](function(_0x3cb44d){_0x1bfaff(_0x3cb44d);});});}function _0x4d2df0(_0x165292,_0x5eea11){return new Promise(function(_0x2763d6,_0x29a4e1){var _0x4d148e=_0x165292[_0x9d4b('0x4')]?{[_0x165292['filter'][_0x9d4b('0x5')]]:_0x165292[_0x9d4b('0x4')][_0x9d4b('0x6')]}:undefined;return _0x4c20d9[_0x165292['model']][_0x9d4b('0x7')]({'where':_0x4d148e,'raw':!![]})['then'](function(_0x38082f){_0x5eea11[_0x9d4b('0x9')]=_[_0x9d4b('0xa')](_0x38082f,function(_0x4bebe0){return _0x4bebe0['name'];});_0x2763d6(_0x5eea11);})[_0x9d4b('0xb')](function(_0x3395be){_0x29a4e1(_0x3395be);});});}function _0x110d52(_0x4416d7,_0x153710,_0x5cb428){if(!_0x153710)return Promise['resolve'](null);return new Promise(function(_0x35db65,_0x3e8240){return _0x4c20d9[_0x9d4b('0xc')][_0x9d4b('0x7')]({'where':{'sectionId':_0x153710['id']},'raw':!![]})[_0x9d4b('0x8')](function(_0xb455){if(_0x4416d7[_0x9d4b('0x5')]&&_0x4416d7[_0x9d4b('0x5')]!=='id'){_0x153710[_0x9d4b('0x9')]=_[_0x9d4b('0xa')](_0xb455,function(_0x1a5ab3){return _0x1a5ab3[_0x4416d7[_0x9d4b('0x5')]];});}else{if(_0x5cb428===_0x9d4b('0xd')){_0x153710['associatedResources']=_[_0x9d4b('0xa')](_0xb455,function(_0x42e748){return{'id':_0x42e748[_0x9d4b('0xe')],'type':_0x42e748[_0x9d4b('0xf')]};});}else{_0x153710[_0x9d4b('0x9')]=_[_0x9d4b('0xa')](_0xb455,function(_0x38b11b){return _0x38b11b[_0x9d4b('0xe')];});}}_0x35db65(_0x153710);})['catch'](function(_0x5dfc69){_0x3e8240(_0x5dfc69);});});}function _0x48d2ae(_0x342e98,_0x2fba5a){var _0x5218b6={'parentSections':[]};switch(_0x342e98[_0x9d4b('0x10')]()){case _0x9d4b('0x11'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x13');break;case _0x9d4b('0x14'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x15');break;case'squarerecordings':_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x16');_0x5218b6['parentSections']=[{'name':_0x9d4b('0x17'),'field':'name','foreignKey':_0x9d4b('0x18')}];break;case _0x9d4b('0x19'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x1a');break;case'contacts':_0x5218b6['childModel']=_0x9d4b('0x1b');_0x5218b6[_0x9d4b('0x1c')]=[{'name':'Lists','field':'id','foreignKey':_0x9d4b('0x1d')}];break;case'lists':_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x1e');break;case _0x9d4b('0x1f'):_0x5218b6[_0x9d4b('0x12')]='CmCompany';break;case'globalcustomfields':_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x20');break;case _0x9d4b('0x21'):_0x5218b6['childModel']='ChatQueue';break;case _0x9d4b('0x22'):_0x5218b6['childModel']='ChatWebsite';break;case _0x9d4b('0x23'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x24');break;case _0x9d4b('0x25'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x26');break;case _0x9d4b('0x27'):case _0x9d4b('0x28'):case _0x9d4b('0x29'):_0x5218b6[_0x9d4b('0x12')]='VoiceExtension';break;case _0x9d4b('0x2a'):_0x5218b6['childModel']='VoiceContext';break;case'voicemails':_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x2b');break;case _0x9d4b('0x2c'):_0x5218b6[_0x9d4b('0x12')]='VoiceRecording';_0x5218b6[_0x9d4b('0x1c')]=[{'name':_0x9d4b('0x2d'),'field':'name','foreignKey':_0x9d4b('0x2e'),'model':_0x9d4b('0x2f'),'filter':{'field':'role','value':[_0x9d4b('0x30')]}},{'name':_0x9d4b('0x31'),'field':_0x9d4b('0x32'),'foreignKey':'membername','model':_0x9d4b('0x2f'),'filter':{'field':'role','value':[_0x9d4b('0x33')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x9d4b('0x34'),'model':_0x9d4b('0x35'),'filter':{'field':_0x9d4b('0xf'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x9d4b('0x32'),'foreignKey':_0x9d4b('0x34'),'model':'VoiceQueue','filter':{'field':_0x9d4b('0xf'),'value':[_0x9d4b('0x36')]}}];break;case _0x9d4b('0x37'):_0x5218b6['childModel']=_0x9d4b('0x38');break;case _0x9d4b('0x39'):_0x5218b6[_0x9d4b('0x12')]='VoiceChanSpy';break;case _0x9d4b('0x3a'):_0x5218b6[_0x9d4b('0x12')]='VoicePrefix';break;case _0x9d4b('0x3b'):_0x5218b6['childModel']=_0x9d4b('0x3c');break;case'mailqueues':_0x5218b6[_0x9d4b('0x12')]='MailQueue';break;case _0x9d4b('0x3d'):_0x5218b6['childModel']='MailAccount';break;case _0x9d4b('0x3e'):_0x5218b6[_0x9d4b('0x12')]='MailSubstatus';break;case _0x9d4b('0x3f'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x40');break;case _0x9d4b('0x41'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x42');break;case _0x9d4b('0x43'):_0x5218b6['childModel']='SmsQueue';break;case _0x9d4b('0x44'):_0x5218b6['childModel']='SmsAccount';break;case _0x9d4b('0x45'):_0x5218b6['childModel']='WhatsappQueue';break;case _0x9d4b('0x46'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x47');break;case _0x9d4b('0x48'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x49');break;case _0x9d4b('0x4a'):case'queuecampaigns':_0x5218b6['childModel']='VoiceQueue';if(_0x2fba5a){_0x5218b6[_0x9d4b('0x1c')]=[{'name':'VoiceQueues'},{'name':_0x9d4b('0x4b')}];}break;case'users':case _0x9d4b('0x4c'):case _0x9d4b('0x4d'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x2f');if(_0x2fba5a){_0x5218b6[_0x9d4b('0x1c')]=[{'name':_0x9d4b('0x4e'),'filter':{'field':_0x9d4b('0x4f'),'value':[_0x9d4b('0x50'),_0x9d4b('0x51')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x9d4b('0x52'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x53');break;case _0x9d4b('0x54'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x55');break;case _0x9d4b('0x56'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x57');break;case _0x9d4b('0x58'):_0x5218b6[_0x9d4b('0x12')]='SugarcrmAccount';break;case'deskaccounts':_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x59');break;case _0x9d4b('0x5a'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x5b');break;case _0x9d4b('0x5c'):_0x5218b6['childModel']=_0x9d4b('0x2f');break;case'cannedanswers':_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x5d');break;case _0x9d4b('0x5e'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x5f');break;case _0x9d4b('0x60'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x61');break;case'intervals':_0x5218b6['childModel']=_0x9d4b('0x62');break;case'pauses':_0x5218b6['childModel']=_0x9d4b('0x63');break;case _0x9d4b('0x64'):_0x5218b6['childModel']='Schedule';break;case _0x9d4b('0x65'):_0x5218b6[_0x9d4b('0x12')]='Sound';break;case _0x9d4b('0x66'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x67');break;case _0x9d4b('0x68'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x69');break;case'triggers':_0x5218b6['childModel']=_0x9d4b('0x6a');break;case _0x9d4b('0x6b'):_0x5218b6[_0x9d4b('0x12')]='Trunk';break;case _0x9d4b('0x6c'):_0x5218b6['childModel']=_0x9d4b('0x6d');break;case _0x9d4b('0x6e'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x6f');break;case'extractedreports':_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0xd');_0x5218b6['parentSections']=[{'name':_0x9d4b('0x70'),'field':'id','foreignKey':_0x9d4b('0x71')}];break;case _0x9d4b('0x72'):_0x5218b6[_0x9d4b('0x12')]=_0x9d4b('0x73');break;}return _0x5218b6;}function _0x194dc8(_0x302611,_0x52fb87){var _0x291aa2=_0x302611[_0x9d4b('0x74')](0x0)[_0x9d4b('0x75')]()+_0x302611[_0x9d4b('0x76')](0x1);var _0xf1382c={'type':_0x4c20d9[_0x9d4b('0x77')][_0x9d4b('0x78')][_0x9d4b('0x79')],'raw':!![]};return new Promise(function(_0x4f8481,_0x1e2224){var _0x1241e0=squel[_0x9d4b('0x7a')]()[_0x9d4b('0x5')]('ui.'+_0x291aa2+_0x9d4b('0x7b'),'id')[_0x9d4b('0x5')]('ui.createdAt')[_0x9d4b('0x7c')](_0x9d4b('0x7d')+_0x302611+_0x9d4b('0x7e'),'ui')[_0x9d4b('0x7f')](_0x9d4b('0x80'),_0x52fb87['id']);return _0x4c20d9[_0x9d4b('0x81')][_0x9d4b('0x82')](_0x1241e0[_0x9d4b('0x83')](),_0xf1382c)[_0x9d4b('0x8')](function(_0x401be6){_0x52fb87[_0x291aa2+'OpenTabs']=_0x401be6;_0x4f8481(_0x401be6);})[_0x9d4b('0xb')](function(_0xb8fd7c){_0x1e2224(_0xb8fd7c);});});}return _0x548ac8['define'](_0x9d4b('0x84'),attributes,{'tableName':_0x9d4b('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1f108e){var _0x49a160={'raw':_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0x86')],'where':{}};var _0x4cbeda={};var _0x247ae7={'count':0x0,'rows':[]};var _0x19e01a=_0x1f108e['query'][_0x9d4b('0x87')];var _0x532c34=_0x1f108e['query'][_0x9d4b('0x88')]||![];var _0x9720d4=_0x48d2ae(_0x19e01a,_0x532c34);if(!_0x9720d4[_0x9d4b('0x12')])throw new Error(_0x9d4b('0x89')+_0x19e01a+'\x27');var _0x452f69=[{'name':_0x19e01a}];if(!_[_0x9d4b('0x8a')](_0x9720d4[_0x9d4b('0x1c')]))_0x452f69=_0x9720d4[_0x9d4b('0x1c')];var _0x2411ab=[];for(var _0x44542f=0x0;_0x44542f<_0x452f69[_0x9d4b('0x8b')];_0x44542f++){_0x2411ab[_0x9d4b('0x8c')](_0x4c20d9[_0x9d4b('0x8d')][_0x9d4b('0x8e')]({'where':{'userProfileId':_0x1f108e[_0x9d4b('0x8f')]['id'],'name':_0x452f69[_0x44542f][_0x9d4b('0x32')]},'raw':!![]}));}return Promise['all'](_0x2411ab)['then'](function(_0x42981e){var _0x4569f6=_[_0x9d4b('0x4')](_0x42981e,function(_0x30c4b2){return _0x30c4b2?_0x30c4b2:undefined;});var _0x4c294f=_[_0x9d4b('0x4')](_0x452f69,[_0x9d4b('0x90'),!![]]);var _0x4b594d=_[_0x9d4b('0x8a')](_0x4569f6)&&_[_0x9d4b('0x8a')](_0x4c294f)?null:_[_0x9d4b('0x91')](_0x4c294f,_0x4569f6);if(!_0x4b594d)return null;var _0x4de1a8=[];for(var _0x43256a=0x0;_0x43256a<_0x4b594d[_0x9d4b('0x8b')];_0x43256a++){var _0x58173d=_[_0x9d4b('0x8e')](_0x452f69,function(_0x4810de){return _0x4b594d[_0x43256a]?_0x4810de[_0x9d4b('0x32')]===_0x4b594d[_0x43256a][_0x9d4b('0x32')]:null;});if(_0x58173d){if(_0x4b594d[_0x43256a]['ignore']){_0x4de1a8[_0x9d4b('0x8c')](_0x1a618b(_0x9720d4[_0x9d4b('0x12')],_0x4b594d[_0x43256a]));}else{if(!_0x4b594d[_0x43256a][_0x9d4b('0x92')]){_0x4de1a8['push'](_0x110d52(_0x58173d,_0x4b594d[_0x43256a],_0x9720d4[_0x9d4b('0x12')]));}else{if(_0x58173d['model']){_0x4de1a8['push'](_0x4d2df0(_0x58173d,_0x4b594d[_0x43256a]));}}}}}return Promise['all'](_0x4de1a8);})['then'](function(_0x5a02e0){var _0x3210a8=_0x5a02e0;var _0x289a74=null;if(_0x3210a8){_0x289a74=_0x3210a8[_0x9d4b('0x8b')]===0x1?_0x3210a8[0x0]:null;}if(!_0x289a74&&!_0x3210a8)return _0x247ae7;var _0x28f009=_0x4c20d9[_0x9720d4[_0x9d4b('0x12')]][_0x9d4b('0x93')];_0x4cbeda[_0x9d4b('0x94')]=_[_0x9d4b('0x95')](_0x28f009);_0x4cbeda[_0x9d4b('0x82')]=_[_0x9d4b('0x95')](_0x1f108e[_0x9d4b('0x82')]);_0x4cbeda['filters']=_['intersection'](_0x4cbeda['model'],_0x4cbeda['query']);_0x49a160[_0x9d4b('0x96')]=_[_0x9d4b('0x97')](_0x4cbeda[_0x9d4b('0x94')],qs[_0x9d4b('0x98')](_0x1f108e[_0x9d4b('0x82')]['fields']));_0x49a160[_0x9d4b('0x96')]=_0x49a160[_0x9d4b('0x96')][_0x9d4b('0x8b')]?_0x49a160['attributes']:_0x4cbeda[_0x9d4b('0x94')];if(!_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0x99')](_0x9d4b('0x9a'))){_0x49a160['limit']=qs[_0x9d4b('0x9b')](_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0x9b')]);_0x49a160[_0x9d4b('0x9c')]=qs['offset'](_0x1f108e[_0x9d4b('0x82')]['offset']);}_0x49a160[_0x9d4b('0x9d')]=qs[_0x9d4b('0x9e')](_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0x9e')]);_0x49a160[_0x9d4b('0x7f')]=qs[_0x9d4b('0x9f')](_[_0x9d4b('0xa0')](_0x1f108e['query'],_0x4cbeda['filters']));if(_0x1f108e['query'][_0x9d4b('0x4')]){_0x49a160['where']=_[_0x9d4b('0xa1')](_0x49a160[_0x9d4b('0x7f')],{'$or':_['map'](_0x28f009,function(_0xad3c7d){if(_0xad3c7d[_0x9d4b('0xf')][_0x9d4b('0xa2')]!==_0x9d4b('0xa3')){var _0x33380f={};_0x33380f[_0xad3c7d[_0x9d4b('0x5')]]={'$like':'%'+_0x1f108e['query'][_0x9d4b('0x4')]+'%'};return _0x33380f;}})});}var _0x101a6e=[];var _0x455a26=null;var _0x5c917c={};if(_0x289a74){_0x455a26=_[_0x9d4b('0x8e')](_0x452f69,['name',_0x289a74[_0x9d4b('0x32')]]);if(_0x455a26[_0x9d4b('0x5')]){_0x5c917c={};if(_0x9720d4[_0x9d4b('0x12')]==='AnalyticExtractedReport'){_0x5c917c[_0x455a26[_0x9d4b('0xa4')]]=_['map'](_0x289a74['associatedResources'],'id');}else{_0x5c917c[_0x455a26['foreignKey']]=_0x289a74['associatedResources'];}_0x101a6e[_0x9d4b('0x8c')](_0x5c917c);}else{_0x49a160[_0x9d4b('0x7f')]['id']=_0x289a74[_0x9d4b('0x9')];}}else{for(var _0x11083f=0x0;_0x11083f<_0x3210a8['length'];_0x11083f++){_0x455a26=_[_0x9d4b('0x8e')](_0x452f69,['name',_0x3210a8[_0x11083f][_0x9d4b('0x32')]]);if(_0x455a26['field']){_0x5c917c={};_0x5c917c[_0x455a26[_0x9d4b('0xa4')]]=_0x3210a8[_0x11083f]['associatedResources'];_0x101a6e[_0x9d4b('0x8c')](_0x5c917c);}else{if(!_0x49a160['where']['id'])_0x49a160[_0x9d4b('0x7f')]['id']=[];_0x3210a8[_0x11083f][_0x9d4b('0x9')][_0x9d4b('0xa5')](function(_0x305f14){_0x49a160[_0x9d4b('0x7f')]['id'][_0x9d4b('0x8c')](_0x305f14);});}}}if(!_[_0x9d4b('0x8a')](_0x101a6e)){_0x49a160[_0x9d4b('0x7f')]=_[_0x9d4b('0xa1')](_0x49a160[_0x9d4b('0x7f')],{'$and':{'$or':_0x101a6e}});}_0x49a160=_[_0x9d4b('0xa1')]({},_0x49a160,_0x1f108e[_0x9d4b('0xa6')]);if(_0x289a74&&!_0x289a74[_0x9d4b('0x92')]&&_0x9720d4[_0x9d4b('0x12')]===_0x9d4b('0xd')){if(_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0xa7')]){_0x49a160[_0x9d4b('0xa8')]=[{'all':!![]}];}return _0x4c20d9[_0x9720d4['childModel']][_0x9d4b('0x7')](_0x49a160)['then'](function(_0x351f08){var _0x123c99=[];_0x351f08[_0x9d4b('0xa5')](function(_0x20ec41){var _0x25ad11;switch(_0x20ec41[_0x9d4b('0xa9')]){case _0x9d4b('0xaa'):_0x25ad11=_[_0x9d4b('0x8e')](_0x289a74[_0x9d4b('0x9')],function(_0x1ec8e5){return _0x1ec8e5['id']===_0x20ec41['reportId']&&_0x1ec8e5[_0x9d4b('0xf')]===_0x9d4b('0xab');});break;case _0x9d4b('0xac'):_0x25ad11=_[_0x9d4b('0x8e')](_0x289a74[_0x9d4b('0x9')],function(_0x16f3ce){return _0x16f3ce['id']===_0x20ec41[_0x9d4b('0x71')]&&_0x16f3ce[_0x9d4b('0xf')]===_0x9d4b('0xad');});break;}if(_0x25ad11)_0x123c99[_0x9d4b('0x8c')](_0x20ec41);});_0x247ae7[_0x9d4b('0xae')]=_0x123c99[_0x9d4b('0x8b')];_0x247ae7[_0x9d4b('0xaf')]=_0x123c99;return _0x247ae7;});}else{if(!_[_0x9d4b('0x8a')](_0x1f108e['query']['ids'])){_0x49a160[_0x9d4b('0x7f')]['id']=_0x49a160['where']['id']?_[_0x9d4b('0x97')](_0x49a160['where']['id'],_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0xb0')]):_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0xb0')];if(_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0xb1')]){_0x49a160[_0x9d4b('0x9d')]=_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0xb1')];}}if(_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0xb2')]){_0x49a160[_0x9d4b('0x7f')]=_[_0x9d4b('0xa1')](_0x49a160[_0x9d4b('0x7f')],{'$and':_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0xb2')]});}return _0x4c20d9[_0x9720d4[_0x9d4b('0x12')]][_0x9d4b('0xae')]({'where':_0x49a160[_0x9d4b('0x7f')]})['then'](function(_0x35c9ef){_0x247ae7[_0x9d4b('0xae')]=_0x35c9ef;if(_0x1f108e[_0x9d4b('0x82')]['includeAll']){if(_0x9720d4[_0x9d4b('0x12')]===_0x9d4b('0x1b')){_0x49a160[_0x9d4b('0xa8')]=[{'model':_0x4c20d9[_0x9d4b('0x67')],'as':_0x9d4b('0xb3'),'attributes':['id','name',_0x9d4b('0xb4')],'required':_0x1f108e['query']['tag']?!![]:![]},{'model':_0x4c20d9['Tag'],'as':_0x9d4b('0xb5'),'attributes':['id',_0x9d4b('0x32'),_0x9d4b('0xb4')],'through':_0x1f108e['query'][_0x9d4b('0xb6')]?{'attributes':[],'where':{'TagId':_0x1f108e['query'][_0x9d4b('0xb6')]||undefined}}:{},'required':_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0xb6')]?!![]:![]}];}else{_0x49a160[_0x9d4b('0xa8')]=[{'all':!![]}];}}return _0x4c20d9[_0x9720d4['childModel']]['findAll'](_0x49a160);})['then'](function(_0x34207f){_0x247ae7[_0x9d4b('0xaf')]=_0x34207f;if(_0x19e01a===_0x9d4b('0x2d')&&_0x1f108e[_0x9d4b('0x82')][_0x9d4b('0xb7')]===_0x9d4b('0xb8')){var _0x233404=[];for(var _0x290063=0x0;_0x290063<_0x247ae7[_0x9d4b('0xaf')][_0x9d4b('0x8b')];_0x290063++){_0x233404[_0x9d4b('0x8c')](_0x194dc8(_0x9d4b('0xb9'),_0x247ae7[_0x9d4b('0xaf')][_0x290063][_0x9d4b('0xba')]));_0x233404[_0x9d4b('0x8c')](_0x194dc8(_0x9d4b('0xbb'),_0x247ae7[_0x9d4b('0xaf')][_0x290063][_0x9d4b('0xba')]));_0x233404[_0x9d4b('0x8c')](_0x194dc8(_0x9d4b('0xbc'),_0x247ae7[_0x9d4b('0xaf')][_0x290063][_0x9d4b('0xba')]));_0x233404[_0x9d4b('0x8c')](_0x194dc8(_0x9d4b('0xbd'),_0x247ae7[_0x9d4b('0xaf')][_0x290063][_0x9d4b('0xba')]));_0x233404['push'](_0x194dc8(_0x9d4b('0xbe'),_0x247ae7[_0x9d4b('0xaf')][_0x290063][_0x9d4b('0xba')]));_0x233404['push'](_0x194dc8(_0x9d4b('0xbf'),_0x247ae7[_0x9d4b('0xaf')][_0x290063]['dataValues']));}return Promise['all'](_0x233404)[_0x9d4b('0x8')](function(){return _0x247ae7;});}return _0x247ae7;});}});}}});}; \ No newline at end of file +var _0x0a06=['FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','user','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','Trunk','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','all','ignore','union','find','rawAttributes','keys','attributes','intersection','fields','hasOwnProperty','limit','offset','sort','filters','pick','merge','VIRTUAL','foreignKey','options','autoAssociation','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','color','tag','openTabs','true','dataValues','sms','mail','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','field','filter','value','findAll','then','associatedResources','map','catch','model','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','parentSections','SquareProjects','name','projects','JscriptyProject','contacts','CmContact','ListId','CmList','CmCompany','globalcustomfields','ChatQueue','faxqueues'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x0a06,0x150));var _0x60a0=function(_0x1b16ba,_0xe1a8dc){_0x1b16ba=_0x1b16ba-0x0;var _0x30d703=_0x0a06[_0x1b16ba];return _0x30d703;};'use strict';var _=require('lodash');var attributes=require(_0x60a0('0x0'));var qs=require(_0x60a0('0x1'));var squel=require(_0x60a0('0x2'));module[_0x60a0('0x3')]=function(_0x5b26c0){var _0x4278c0=_0x5b26c0['models'];function _0x49713b(_0x401f5a,_0x4d1ec6){return new Promise(function(_0x176117,_0x4e6951){if(!_0x4d1ec6)return _0x176117(null);var _0x23345b=_0x4d1ec6['filter']?{[_0x4d1ec6['filter'][_0x60a0('0x4')]]:_0x4d1ec6[_0x60a0('0x5')][_0x60a0('0x6')]}:undefined;return _0x4278c0[_0x401f5a][_0x60a0('0x7')]({'where':_0x23345b,'raw':!![]})[_0x60a0('0x8')](function(_0x421483){_0x4d1ec6[_0x60a0('0x9')]=_[_0x60a0('0xa')](_0x421483,'id');_0x176117(_0x4d1ec6);})[_0x60a0('0xb')](function(_0x41fa02){_0x4e6951(_0x41fa02);});});}function _0x3dd910(_0x403d69,_0x2df200){return new Promise(function(_0x2e5c2a,_0x5bf3ee){var _0xf666d0=_0x403d69[_0x60a0('0x5')]?{[_0x403d69[_0x60a0('0x5')]['field']]:_0x403d69['filter']['value']}:undefined;return _0x4278c0[_0x403d69[_0x60a0('0xc')]][_0x60a0('0x7')]({'where':_0xf666d0,'raw':!![]})[_0x60a0('0x8')](function(_0x7b4959){_0x2df200[_0x60a0('0x9')]=_['map'](_0x7b4959,function(_0x594397){return _0x594397['name'];});_0x2e5c2a(_0x2df200);})[_0x60a0('0xb')](function(_0x47d90a){_0x5bf3ee(_0x47d90a);});});}function _0x54c1ba(_0x19dc19,_0x442de0,_0x44d291){if(!_0x442de0)return Promise[_0x60a0('0xd')](null);return new Promise(function(_0x2c3891,_0x3dad0a){return _0x4278c0[_0x60a0('0xe')]['findAll']({'where':{'sectionId':_0x442de0['id']},'raw':!![]})[_0x60a0('0x8')](function(_0x5715b5){if(_0x19dc19[_0x60a0('0x4')]&&_0x19dc19[_0x60a0('0x4')]!=='id'){_0x442de0[_0x60a0('0x9')]=_[_0x60a0('0xa')](_0x5715b5,function(_0x516a17){return _0x516a17[_0x19dc19[_0x60a0('0x4')]];});}else{if(_0x44d291===_0x60a0('0xf')){_0x442de0[_0x60a0('0x9')]=_['map'](_0x5715b5,function(_0x27d282){return{'id':_0x27d282['resourceId'],'type':_0x27d282[_0x60a0('0x10')]};});}else{_0x442de0[_0x60a0('0x9')]=_[_0x60a0('0xa')](_0x5715b5,function(_0x46006f){return _0x46006f[_0x60a0('0x11')];});}}_0x2c3891(_0x442de0);})[_0x60a0('0xb')](function(_0x1c8461){_0x3dad0a(_0x1c8461);});});}function _0x1db61a(_0x3789a4,_0x60e47c){var _0x505eab={'parentSections':[]};switch(_0x3789a4['toLowerCase']()){case _0x60a0('0x12'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x14');break;case'odbc':_0x505eab[_0x60a0('0x13')]=_0x60a0('0x15');break;case _0x60a0('0x16'):_0x505eab[_0x60a0('0x13')]='SquareRecording';_0x505eab[_0x60a0('0x17')]=[{'name':_0x60a0('0x18'),'field':_0x60a0('0x19'),'foreignKey':'projectName'}];break;case _0x60a0('0x1a'):_0x505eab['childModel']=_0x60a0('0x1b');break;case _0x60a0('0x1c'):_0x505eab['childModel']=_0x60a0('0x1d');_0x505eab[_0x60a0('0x17')]=[{'name':'Lists','field':'id','foreignKey':_0x60a0('0x1e')}];break;case'lists':_0x505eab[_0x60a0('0x13')]=_0x60a0('0x1f');break;case'companies':_0x505eab['childModel']=_0x60a0('0x20');break;case _0x60a0('0x21'):_0x505eab[_0x60a0('0x13')]='CmCustomField';break;case'chatqueues':_0x505eab['childModel']=_0x60a0('0x22');break;case'chatwebsites':_0x505eab[_0x60a0('0x13')]='ChatWebsite';break;case _0x60a0('0x23'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x24');break;case _0x60a0('0x25'):_0x505eab[_0x60a0('0x13')]='FaxAccount';break;case'inboundroutes':case _0x60a0('0x26'):case _0x60a0('0x27'):_0x505eab[_0x60a0('0x13')]='VoiceExtension';break;case'contexts':_0x505eab[_0x60a0('0x13')]=_0x60a0('0x28');break;case _0x60a0('0x29'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x2a');break;case _0x60a0('0x2b'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x2c');_0x505eab[_0x60a0('0x17')]=[{'name':_0x60a0('0x2d'),'field':_0x60a0('0x19'),'foreignKey':_0x60a0('0x2e'),'model':'User','filter':{'field':_0x60a0('0x2f'),'value':[_0x60a0('0x30')]}},{'name':_0x60a0('0x31'),'field':'name','foreignKey':_0x60a0('0x2e'),'model':_0x60a0('0x32'),'filter':{'field':'role','value':[_0x60a0('0x33')]}},{'name':_0x60a0('0x34'),'field':_0x60a0('0x19'),'foreignKey':_0x60a0('0x35'),'model':_0x60a0('0x36'),'filter':{'field':_0x60a0('0x10'),'value':[_0x60a0('0x37')]}},{'name':'QueueCampaigns','field':_0x60a0('0x19'),'foreignKey':'queue','model':_0x60a0('0x36'),'filter':{'field':_0x60a0('0x10'),'value':[_0x60a0('0x38')]}}];break;case _0x60a0('0x39'):_0x505eab['childModel']=_0x60a0('0x3a');break;case _0x60a0('0x3b'):_0x505eab[_0x60a0('0x13')]='VoiceChanSpy';break;case _0x60a0('0x3c'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x3d');break;case _0x60a0('0x3e'):_0x505eab[_0x60a0('0x13')]='Campaign';break;case'mailqueues':_0x505eab[_0x60a0('0x13')]='MailQueue';break;case _0x60a0('0x3f'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x40');break;case _0x60a0('0x41'):_0x505eab['childModel']=_0x60a0('0x42');break;case'openchannelqueues':_0x505eab['childModel']=_0x60a0('0x43');break;case _0x60a0('0x44'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x45');break;case _0x60a0('0x46'):_0x505eab[_0x60a0('0x13')]='SmsQueue';break;case'smsaccounts':_0x505eab['childModel']=_0x60a0('0x47');break;case _0x60a0('0x48'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x49');break;case _0x60a0('0x4a'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x4b');break;case _0x60a0('0x4c'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x4d');break;case _0x60a0('0x4e'):case _0x60a0('0x4f'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x36');if(_0x60e47c){_0x505eab['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case _0x60a0('0x50'):case _0x60a0('0x51'):_0x505eab[_0x60a0('0x13')]='User';if(_0x60e47c){_0x505eab['parentSections']=[{'name':_0x60a0('0x52'),'filter':{'field':_0x60a0('0x2f'),'value':['admin',_0x60a0('0x53')]},'ignore':!![]},{'name':_0x60a0('0x2d')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x505eab['childModel']='ZendeskAccount';break;case _0x60a0('0x54'):_0x505eab['childModel']=_0x60a0('0x55');break;case _0x60a0('0x56'):_0x505eab['childModel']='FreshdeskAccount';break;case'sugarcrmaccounts':_0x505eab['childModel']=_0x60a0('0x57');break;case'deskaccounts':_0x505eab[_0x60a0('0x13')]=_0x60a0('0x58');break;case _0x60a0('0x59'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x5a');break;case _0x60a0('0x5b'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x32');break;case _0x60a0('0x5c'):_0x505eab['childModel']=_0x60a0('0x5d');break;case _0x60a0('0x5e'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x5f');break;case _0x60a0('0x60'):_0x505eab[_0x60a0('0x13')]='Dashboard';break;case'intervals':_0x505eab['childModel']=_0x60a0('0x61');break;case _0x60a0('0x62'):_0x505eab[_0x60a0('0x13')]='Pause';break;case _0x60a0('0x63'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x64');break;case _0x60a0('0x65'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x66');break;case _0x60a0('0x67'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x68');break;case _0x60a0('0x69'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x6a');break;case _0x60a0('0x6b'):_0x505eab[_0x60a0('0x13')]=_0x60a0('0x6c');break;case'trunks':_0x505eab[_0x60a0('0x13')]=_0x60a0('0x6d');break;case'variables':_0x505eab[_0x60a0('0x13')]=_0x60a0('0x6e');break;case _0x60a0('0x6f'):_0x505eab['childModel']=_0x60a0('0x70');break;case _0x60a0('0x71'):_0x505eab[_0x60a0('0x13')]='AnalyticExtractedReport';_0x505eab[_0x60a0('0x17')]=[{'name':_0x60a0('0x72'),'field':'id','foreignKey':_0x60a0('0x73')}];break;case'metrics':_0x505eab[_0x60a0('0x13')]=_0x60a0('0x74');break;}return _0x505eab;}function _0x435351(_0x4bd0b9,_0x2e4d03){var _0xca9758=_0x4bd0b9[_0x60a0('0x75')](0x0)[_0x60a0('0x76')]()+_0x4bd0b9[_0x60a0('0x77')](0x1);var _0x533a3e={'type':_0x4278c0[_0x60a0('0x78')]['QueryTypes'][_0x60a0('0x79')],'raw':!![]};return new Promise(function(_0x5ca577,_0x19f85c){var _0x444b4c=squel[_0x60a0('0x7a')]()[_0x60a0('0x4')](_0x60a0('0x7b')+_0xca9758+_0x60a0('0x7c'),'id')[_0x60a0('0x4')](_0x60a0('0x7d'))[_0x60a0('0x7e')](_0x60a0('0x7f')+_0x4bd0b9+_0x60a0('0x80'),'ui')[_0x60a0('0x81')](_0x60a0('0x82'),_0x2e4d03['id']);return _0x4278c0[_0x60a0('0x83')][_0x60a0('0x84')](_0x444b4c[_0x60a0('0x85')](),_0x533a3e)[_0x60a0('0x8')](function(_0x1a49aa){_0x2e4d03[_0xca9758+_0x60a0('0x86')]=_0x1a49aa;_0x5ca577(_0x1a49aa);})[_0x60a0('0xb')](function(_0x5a2b93){_0x19f85c(_0x5a2b93);});});}return _0x5b26c0[_0x60a0('0x87')](_0x60a0('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2c4740){var _0x371910={'raw':_0x2c4740[_0x60a0('0x84')][_0x60a0('0x89')],'where':{}};var _0x1c1964={};var _0x2cdeeb={'count':0x0,'rows':[]};var _0x53fb3a=_0x2c4740['query'][_0x60a0('0x8a')];var _0x1411dc=_0x2c4740['query'][_0x60a0('0x8b')]||![];var _0x288bd1=_0x1db61a(_0x53fb3a,_0x1411dc);if(!_0x288bd1[_0x60a0('0x13')])throw new Error(_0x60a0('0x8c')+_0x53fb3a+'\x27');var _0x10d132=[{'name':_0x53fb3a}];if(!_[_0x60a0('0x8d')](_0x288bd1[_0x60a0('0x17')]))_0x10d132=_0x288bd1[_0x60a0('0x17')];var _0x10fc7f=[];for(var _0x316238=0x0;_0x316238<_0x10d132[_0x60a0('0x8e')];_0x316238++){_0x10fc7f[_0x60a0('0x8f')](_0x4278c0['UserProfileSection']['find']({'where':{'userProfileId':_0x2c4740['params']['id'],'name':_0x10d132[_0x316238][_0x60a0('0x19')]},'raw':!![]}));}return Promise[_0x60a0('0x90')](_0x10fc7f)['then'](function(_0x4df7c5){var _0x201ff2=_[_0x60a0('0x5')](_0x4df7c5,function(_0x106f3d){return _0x106f3d?_0x106f3d:undefined;});var _0xc650ad=_[_0x60a0('0x5')](_0x10d132,[_0x60a0('0x91'),!![]]);var _0xcc63a8=_[_0x60a0('0x8d')](_0x201ff2)&&_[_0x60a0('0x8d')](_0xc650ad)?null:_[_0x60a0('0x92')](_0xc650ad,_0x201ff2);if(!_0xcc63a8)return null;var _0x25e0a4=[];for(var _0x4e8681=0x0;_0x4e8681<_0xcc63a8[_0x60a0('0x8e')];_0x4e8681++){var _0x15ab18=_[_0x60a0('0x93')](_0x10d132,function(_0x172da6){return _0xcc63a8[_0x4e8681]?_0x172da6['name']===_0xcc63a8[_0x4e8681]['name']:null;});if(_0x15ab18){if(_0xcc63a8[_0x4e8681]['ignore']){_0x25e0a4[_0x60a0('0x8f')](_0x49713b(_0x288bd1['childModel'],_0xcc63a8[_0x4e8681]));}else{if(!_0xcc63a8[_0x4e8681]['autoAssociation']){_0x25e0a4[_0x60a0('0x8f')](_0x54c1ba(_0x15ab18,_0xcc63a8[_0x4e8681],_0x288bd1[_0x60a0('0x13')]));}else{if(_0x15ab18[_0x60a0('0xc')]){_0x25e0a4['push'](_0x3dd910(_0x15ab18,_0xcc63a8[_0x4e8681]));}}}}}return Promise[_0x60a0('0x90')](_0x25e0a4);})[_0x60a0('0x8')](function(_0x295f0a){var _0x10ef33=_0x295f0a;var _0x351f47=null;if(_0x10ef33){_0x351f47=_0x10ef33[_0x60a0('0x8e')]===0x1?_0x10ef33[0x0]:null;}if(!_0x351f47&&!_0x10ef33)return _0x2cdeeb;var _0x1710a4=_0x4278c0[_0x288bd1[_0x60a0('0x13')]][_0x60a0('0x94')];_0x1c1964[_0x60a0('0xc')]=_[_0x60a0('0x95')](_0x1710a4);_0x1c1964[_0x60a0('0x84')]=_[_0x60a0('0x95')](_0x2c4740[_0x60a0('0x84')]);_0x1c1964['filters']=_['intersection'](_0x1c1964[_0x60a0('0xc')],_0x1c1964[_0x60a0('0x84')]);_0x371910[_0x60a0('0x96')]=_[_0x60a0('0x97')](_0x1c1964['model'],qs[_0x60a0('0x98')](_0x2c4740['query'][_0x60a0('0x98')]));_0x371910[_0x60a0('0x96')]=_0x371910[_0x60a0('0x96')][_0x60a0('0x8e')]?_0x371910['attributes']:_0x1c1964['model'];if(!_0x2c4740['query'][_0x60a0('0x99')]('nolimit')){_0x371910[_0x60a0('0x9a')]=qs[_0x60a0('0x9a')](_0x2c4740[_0x60a0('0x84')]['limit']);_0x371910[_0x60a0('0x9b')]=qs[_0x60a0('0x9b')](_0x2c4740[_0x60a0('0x84')]['offset']);}_0x371910['order']=qs['sort'](_0x2c4740[_0x60a0('0x84')][_0x60a0('0x9c')]);_0x371910['where']=qs[_0x60a0('0x9d')](_[_0x60a0('0x9e')](_0x2c4740[_0x60a0('0x84')],_0x1c1964[_0x60a0('0x9d')]));if(_0x2c4740[_0x60a0('0x84')][_0x60a0('0x5')]){_0x371910[_0x60a0('0x81')]=_[_0x60a0('0x9f')](_0x371910[_0x60a0('0x81')],{'$or':_[_0x60a0('0xa')](_0x1710a4,function(_0x503c24){if(_0x503c24[_0x60a0('0x10')]['key']!==_0x60a0('0xa0')){var _0x49a044={};_0x49a044[_0x503c24[_0x60a0('0x4')]]={'$like':'%'+_0x2c4740[_0x60a0('0x84')]['filter']+'%'};return _0x49a044;}})});}var _0x25eab7=[];var _0x251187=null;var _0xb72cfc={};if(_0x351f47){_0x251187=_[_0x60a0('0x93')](_0x10d132,['name',_0x351f47[_0x60a0('0x19')]]);if(_0x251187[_0x60a0('0x4')]){_0xb72cfc={};if(_0x288bd1[_0x60a0('0x13')]==='AnalyticExtractedReport'){_0xb72cfc[_0x251187[_0x60a0('0xa1')]]=_[_0x60a0('0xa')](_0x351f47['associatedResources'],'id');}else{_0xb72cfc[_0x251187['foreignKey']]=_0x351f47[_0x60a0('0x9')];}_0x25eab7[_0x60a0('0x8f')](_0xb72cfc);}else{_0x371910['where']['id']=_0x351f47[_0x60a0('0x9')];}}else{for(var _0x52d9fd=0x0;_0x52d9fd<_0x10ef33[_0x60a0('0x8e')];_0x52d9fd++){_0x251187=_[_0x60a0('0x93')](_0x10d132,[_0x60a0('0x19'),_0x10ef33[_0x52d9fd]['name']]);if(_0x251187['field']){_0xb72cfc={};_0xb72cfc[_0x251187[_0x60a0('0xa1')]]=_0x10ef33[_0x52d9fd][_0x60a0('0x9')];_0x25eab7[_0x60a0('0x8f')](_0xb72cfc);}else{if(!_0x371910[_0x60a0('0x81')]['id'])_0x371910[_0x60a0('0x81')]['id']=[];_0x10ef33[_0x52d9fd][_0x60a0('0x9')]['forEach'](function(_0x5c6a12){_0x371910[_0x60a0('0x81')]['id'][_0x60a0('0x8f')](_0x5c6a12);});}}}if(!_[_0x60a0('0x8d')](_0x25eab7)){_0x371910[_0x60a0('0x81')]=_[_0x60a0('0x9f')](_0x371910['where'],{'$and':{'$or':_0x25eab7}});}_0x371910=_[_0x60a0('0x9f')]({},_0x371910,_0x2c4740[_0x60a0('0xa2')]);if(_0x351f47&&!_0x351f47[_0x60a0('0xa3')]&&_0x288bd1['childModel']==='AnalyticExtractedReport'){if(_0x2c4740[_0x60a0('0x84')][_0x60a0('0xa4')]){_0x371910[_0x60a0('0xa5')]=[{'all':!![]}];}return _0x4278c0[_0x288bd1['childModel']][_0x60a0('0x7')](_0x371910)[_0x60a0('0x8')](function(_0x578811){var _0x12873c=[];_0x578811[_0x60a0('0xa6')](function(_0x4eaac0){var _0x140bf9;switch(_0x4eaac0[_0x60a0('0xa7')]){case _0x60a0('0xa8'):_0x140bf9=_[_0x60a0('0x93')](_0x351f47[_0x60a0('0x9')],function(_0x56eb5d){return _0x56eb5d['id']===_0x4eaac0[_0x60a0('0x73')]&&_0x56eb5d[_0x60a0('0x10')]===_0x60a0('0xa9');});break;case _0x60a0('0xaa'):_0x140bf9=_['find'](_0x351f47[_0x60a0('0x9')],function(_0x5afb15){return _0x5afb15['id']===_0x4eaac0['reportId']&&_0x5afb15['type']===_0x60a0('0xab');});break;}if(_0x140bf9)_0x12873c[_0x60a0('0x8f')](_0x4eaac0);});_0x2cdeeb[_0x60a0('0xac')]=_0x12873c[_0x60a0('0x8e')];_0x2cdeeb[_0x60a0('0xad')]=_0x12873c;return _0x2cdeeb;});}else{if(!_[_0x60a0('0x8d')](_0x2c4740['query'][_0x60a0('0xae')])){_0x371910['where']['id']=_0x371910[_0x60a0('0x81')]['id']?_[_0x60a0('0x97')](_0x371910[_0x60a0('0x81')]['id'],_0x2c4740[_0x60a0('0x84')][_0x60a0('0xae')]):_0x2c4740[_0x60a0('0x84')][_0x60a0('0xae')];if(_0x2c4740[_0x60a0('0x84')][_0x60a0('0xaf')]){_0x371910[_0x60a0('0xb0')]=_0x2c4740[_0x60a0('0x84')][_0x60a0('0xaf')];}}if(_0x2c4740[_0x60a0('0x84')][_0x60a0('0xb1')]){_0x371910['where']=_[_0x60a0('0x9f')](_0x371910['where'],{'$and':_0x2c4740['query']['extraQueryConditions']});}return _0x4278c0[_0x288bd1[_0x60a0('0x13')]][_0x60a0('0xac')]({'where':_0x371910[_0x60a0('0x81')]})[_0x60a0('0x8')](function(_0x145f29){_0x2cdeeb[_0x60a0('0xac')]=_0x145f29;if(_0x2c4740[_0x60a0('0x84')][_0x60a0('0xa4')]){if(_0x288bd1[_0x60a0('0x13')]===_0x60a0('0x1d')){_0x371910[_0x60a0('0xa5')]=[{'model':_0x4278c0[_0x60a0('0x68')],'as':'Tags','attributes':['id','name',_0x60a0('0xb2')],'required':_0x2c4740['query'][_0x60a0('0xb3')]?!![]:![]},{'model':_0x4278c0[_0x60a0('0x68')],'as':'ThroughTags','attributes':['id',_0x60a0('0x19'),_0x60a0('0xb2')],'through':_0x2c4740[_0x60a0('0x84')][_0x60a0('0xb3')]?{'attributes':[],'where':{'TagId':_0x2c4740[_0x60a0('0x84')][_0x60a0('0xb3')]||undefined}}:{},'required':_0x2c4740['query']['tag']?!![]:![]}];}else{_0x371910[_0x60a0('0xa5')]=[{'all':!![]}];}}return _0x4278c0[_0x288bd1[_0x60a0('0x13')]]['findAll'](_0x371910);})[_0x60a0('0x8')](function(_0x5af796){_0x2cdeeb[_0x60a0('0xad')]=_0x5af796;if(_0x53fb3a===_0x60a0('0x2d')&&_0x2c4740[_0x60a0('0x84')][_0x60a0('0xb4')]===_0x60a0('0xb5')){var _0x31a585=[];for(var _0x42efcd=0x0;_0x42efcd<_0x2cdeeb[_0x60a0('0xad')][_0x60a0('0x8e')];_0x42efcd++){_0x31a585[_0x60a0('0x8f')](_0x435351('chat',_0x2cdeeb[_0x60a0('0xad')][_0x42efcd][_0x60a0('0xb6')]));_0x31a585[_0x60a0('0x8f')](_0x435351(_0x60a0('0xb7'),_0x2cdeeb[_0x60a0('0xad')][_0x42efcd]['dataValues']));_0x31a585[_0x60a0('0x8f')](_0x435351('fax',_0x2cdeeb[_0x60a0('0xad')][_0x42efcd][_0x60a0('0xb6')]));_0x31a585[_0x60a0('0x8f')](_0x435351(_0x60a0('0xb8'),_0x2cdeeb[_0x60a0('0xad')][_0x42efcd]['dataValues']));_0x31a585[_0x60a0('0x8f')](_0x435351('openchannel',_0x2cdeeb[_0x60a0('0xad')][_0x42efcd][_0x60a0('0xb6')]));_0x31a585[_0x60a0('0x8f')](_0x435351(_0x60a0('0xb9'),_0x2cdeeb[_0x60a0('0xad')][_0x42efcd][_0x60a0('0xb6')]));}return Promise[_0x60a0('0x90')](_0x31a585)[_0x60a0('0x8')](function(){return _0x2cdeeb;});}return _0x2cdeeb;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 1152dc4..6b0db0c 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 _0x33af=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5233c1,_0x155089){var _0x54faef=function(_0x3b4912){while(--_0x3b4912){_0x5233c1['push'](_0x5233c1['shift']());}};_0x54faef(++_0x155089);}(_0x33af,0xec));var _0xf33a=function(_0x567f0e,_0x2be7a0){_0x567f0e=_0x567f0e-0x0;var _0x15aca8=_0x33af[_0x567f0e];return _0x15aca8;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});config[_0xf33a('0xa')]=_[_0xf33a('0xb')](config[_0xf33a('0xa')],{'host':_0xf33a('0xc'),'port':0x18eb});var socket=require(_0xf33a('0xd'))(new Redis(config['redis']));require(_0xf33a('0xe'))[_0xf33a('0xf')](socket);function respondWithRpcPromise(_0x115e08,_0x457b3b,_0x44ee7f){return new BPromise(function(_0x27f30a,_0x5074a2){return client['request'](_0x115e08,_0x44ee7f)[_0xf33a('0x10')](function(_0xb47cde){logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,_0xf33a('0x13'));logger['debug'](_0xf33a('0x14'),_0x457b3b,_0xf33a('0x13'),JSON['stringify'](_0xb47cde));if(_0xb47cde['error']){if(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x16')]===0x1f4){logger[_0xf33a('0x15')](_0xf33a('0x12'),_0x457b3b,_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);return _0x5074a2(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);}logger['error'](_0xf33a('0x12'),_0x457b3b,_0xb47cde['error'][_0xf33a('0x17')]);return _0x27f30a(_0xb47cde[_0xf33a('0x15')]['message']);}else{logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,'request\x20sent');_0x27f30a(_0xb47cde[_0xf33a('0x18')][_0xf33a('0x17')]);}})[_0xf33a('0x19')](function(_0x2a9f0e){logger['error'](_0xf33a('0x12'),_0x457b3b,_0x2a9f0e);_0x5074a2(_0x2a9f0e);});});} \ No newline at end of file +var _0xeae8=['result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','UserProfile,\x20%s,\x20%s','message'];(function(_0x1d0e5e,_0x596f00){var _0x3ba445=function(_0x2c153f){while(--_0x2c153f){_0x1d0e5e['push'](_0x1d0e5e['shift']());}};_0x3ba445(++_0x596f00);}(_0xeae8,0x66));var _0x8eae=function(_0x1997f1,_0x2dd70c){_0x1997f1=_0x1997f1-0x0;var _0x62465d=_0xeae8[_0x1997f1];return _0x62465d;};'use strict';var _=require(_0x8eae('0x0'));var util=require(_0x8eae('0x1'));var moment=require(_0x8eae('0x2'));var BPromise=require('bluebird');var rs=require(_0x8eae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8eae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8eae('0x5'))(_0x8eae('0x6'));var config=require(_0x8eae('0x7'));var jayson=require(_0x8eae('0x8'));var client=jayson[_0x8eae('0x9')][_0x8eae('0xa')]({'port':0x232a});config[_0x8eae('0xb')]=_[_0x8eae('0xc')](config[_0x8eae('0xb')],{'host':_0x8eae('0xd'),'port':0x18eb});var socket=require(_0x8eae('0xe'))(new Redis(config['redis']));require('./userProfile.socket')[_0x8eae('0xf')](socket);function respondWithRpcPromise(_0xc9ec42,_0x2c8e25,_0x329b64){return new BPromise(function(_0x15ba7d,_0x4aba96){return client['request'](_0xc9ec42,_0x329b64)['then'](function(_0x9bf1c1){logger[_0x8eae('0x10')]('UserProfile,\x20%s,\x20%s',_0x2c8e25,_0x8eae('0x11'));logger['debug'](_0x8eae('0x12'),_0x2c8e25,_0x8eae('0x11'),JSON[_0x8eae('0x13')](_0x9bf1c1));if(_0x9bf1c1[_0x8eae('0x14')]){if(_0x9bf1c1[_0x8eae('0x14')]['code']===0x1f4){logger[_0x8eae('0x14')](_0x8eae('0x15'),_0x2c8e25,_0x9bf1c1[_0x8eae('0x14')][_0x8eae('0x16')]);return _0x4aba96(_0x9bf1c1[_0x8eae('0x14')][_0x8eae('0x16')]);}logger[_0x8eae('0x14')](_0x8eae('0x15'),_0x2c8e25,_0x9bf1c1[_0x8eae('0x14')]['message']);return _0x15ba7d(_0x9bf1c1['error']['message']);}else{logger[_0x8eae('0x10')]('UserProfile,\x20%s,\x20%s',_0x2c8e25,_0x8eae('0x11'));_0x15ba7d(_0x9bf1c1[_0x8eae('0x17')][_0x8eae('0x16')]);}})[_0x8eae('0x18')](function(_0x20213d){logger[_0x8eae('0x14')](_0x8eae('0x15'),_0x2c8e25,_0x20213d);_0x4aba96(_0x20213d);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6da66af..6979bb4 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 _0xb68e=['remove','update','removeListener','register','length','./userProfile.events','save'];(function(_0x4e662c,_0x56d8e2){var _0x33a35d=function(_0x2e3721){while(--_0x2e3721){_0x4e662c['push'](_0x4e662c['shift']());}};_0x33a35d(++_0x56d8e2);}(_0xb68e,0x15c));var _0xeb68=function(_0x3c8149,_0x19b47a){_0x3c8149=_0x3c8149-0x0;var _0x186c9f=_0xb68e[_0x3c8149];return _0x186c9f;};'use strict';var UserProfileEvents=require(_0xeb68('0x0'));var events=[_0xeb68('0x1'),_0xeb68('0x2'),_0xeb68('0x3')];function createListener(_0x3f8d40,_0x1307fa){return function(_0x56eca3){_0x1307fa['emit'](_0x3f8d40,_0x56eca3);};}function removeListener(_0x4abf94,_0x4bebe0){return function(){UserProfileEvents[_0xeb68('0x4')](_0x4abf94,_0x4bebe0);};}exports[_0xeb68('0x5')]=function(_0xfcf4d7){for(var _0x483eef=0x0,_0x403825=events[_0xeb68('0x6')];_0x483eef<_0x403825;_0x483eef++){var _0x221987=events[_0x483eef];var _0x2a601f=createListener('userProfile:'+_0x221987,_0xfcf4d7);UserProfileEvents['on'](_0x221987,_0x2a601f);}}; \ No newline at end of file +var _0xad53=['userProfile:','remove','update','emit','removeListener','length'];(function(_0x15a58a,_0xf442b1){var _0x5b43c1=function(_0x1fe51f){while(--_0x1fe51f){_0x15a58a['push'](_0x15a58a['shift']());}};_0x5b43c1(++_0xf442b1);}(_0xad53,0x199));var _0x3ad5=function(_0x44fa91,_0x116306){_0x44fa91=_0x44fa91-0x0;var _0x252933=_0xad53[_0x44fa91];return _0x252933;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x3ad5('0x0'),_0x3ad5('0x1')];function createListener(_0x3b77ff,_0x15ca99){return function(_0xb0928a){_0x15ca99[_0x3ad5('0x2')](_0x3b77ff,_0xb0928a);};}function removeListener(_0x16ea95,_0x138f9a){return function(){UserProfileEvents[_0x3ad5('0x3')](_0x16ea95,_0x138f9a);};}exports['register']=function(_0x4a9d20){for(var _0x1d61ac=0x0,_0x281824=events[_0x3ad5('0x4')];_0x1d61ac<_0x281824;_0x1d61ac++){var _0x15bdf5=events[_0x1d61ac];var _0x1f0fbc=createListener(_0x3ad5('0x5')+_0x15bdf5,_0x4a9d20);UserProfileEvents['on'](_0x15bdf5,_0x1f0fbc);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index ac9fa3e..3c09816 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 _0x96cb=['fs-extra','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x160ea0,_0x112f92){var _0x504a0a=function(_0x519b9c){while(--_0x519b9c){_0x160ea0['push'](_0x160ea0['shift']());}};_0x504a0a(++_0x112f92);}(_0x96cb,0x184));var _0xb96c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96cb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb96c('0x0'));var timeout=require(_0xb96c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb96c('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb96c('0x3'));var controller=require(_0xb96c('0x4'));router[_0xb96c('0x5')]('/',auth[_0xb96c('0x6')](),controller[_0xb96c('0x7')]);router[_0xb96c('0x5')]('/describe',auth[_0xb96c('0x6')](),controller['describe']);router[_0xb96c('0x5')](_0xb96c('0x8'),auth[_0xb96c('0x6')](),controller[_0xb96c('0x9')]);router['post']('/',auth[_0xb96c('0x6')](),controller['create']);router[_0xb96c('0xa')](_0xb96c('0x8'),auth[_0xb96c('0x6')](),controller[_0xb96c('0xb')]);router[_0xb96c('0xc')]('/:id',auth[_0xb96c('0x6')](),controller[_0xb96c('0xd')]);module[_0xb96c('0xe')]=router; \ No newline at end of file +var _0xc8cd=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get'];(function(_0x5d9b6d,_0x2fb429){var _0x574c7d=function(_0xde1284){while(--_0xde1284){_0x5d9b6d['push'](_0x5d9b6d['shift']());}};_0x574c7d(++_0x2fb429);}(_0xc8cd,0x17d));var _0xdc8c=function(_0x5300c4,_0x1d97db){_0x5300c4=_0x5300c4-0x0;var _0x3f8d0e=_0xc8cd[_0x5300c4];return _0x3f8d0e;};'use strict';var multer=require(_0xdc8c('0x0'));var util=require(_0xdc8c('0x1'));var path=require('path');var timeout=require(_0xdc8c('0x2'));var express=require(_0xdc8c('0x3'));var router=express['Router']();var fs_extra=require(_0xdc8c('0x4'));var auth=require(_0xdc8c('0x5'));var interaction=require(_0xdc8c('0x6'));var config=require(_0xdc8c('0x7'));var controller=require(_0xdc8c('0x8'));router[_0xdc8c('0x9')]('/',auth[_0xdc8c('0xa')](),controller[_0xdc8c('0xb')]);router[_0xdc8c('0x9')](_0xdc8c('0xc'),auth[_0xdc8c('0xa')](),controller[_0xdc8c('0xd')]);router[_0xdc8c('0x9')](_0xdc8c('0xe'),auth['isAuthenticated'](),controller[_0xdc8c('0xf')]);router[_0xdc8c('0x10')]('/',auth[_0xdc8c('0xa')](),controller[_0xdc8c('0x11')]);router[_0xdc8c('0x12')]('/:id',auth[_0xdc8c('0xa')](),controller[_0xdc8c('0x13')]);router[_0xdc8c('0x14')](_0xdc8c('0xe'),auth[_0xdc8c('0xa')](),controller[_0xdc8c('0x15')]);module[_0xdc8c('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 90310d8..10a642d 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 _0x111c=['STRING','INTEGER','sequelize','exports'];(function(_0x426fea,_0x599858){var _0x20ef42=function(_0x1ef482){while(--_0x1ef482){_0x426fea['push'](_0x426fea['shift']());}};_0x20ef42(++_0x599858);}(_0x111c,0xf6));var _0xc111=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x111c[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xc111('0x0'));module[_0xc111('0x1')]={'name':{'type':Sequelize[_0xc111('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc111('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc111('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1e53=['STRING','INTEGER','sequelize','exports'];(function(_0x49507f,_0x35835f){var _0x3eafaf=function(_0x2e3dc5){while(--_0x2e3dc5){_0x49507f['push'](_0x49507f['shift']());}};_0x3eafaf(++_0x35835f);}(_0x1e53,0x1be));var _0x31e5=function(_0x21ada4,_0xc89442){_0x21ada4=_0x21ada4-0x0;var _0x2c157d=_0x1e53[_0x21ada4];return _0x2c157d;};'use strict';var Sequelize=require(_0x31e5('0x0'));module[_0x31e5('0x1')]={'name':{'type':Sequelize[_0x31e5('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x31e5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x31e5('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index f03bf2e..360eac0 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 _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0xffb079,_0x2d5dc0){var _0x4ed0ee=function(_0x1d445f){while(--_0x1d445f){_0xffb079['push'](_0xffb079['shift']());}};_0x4ed0ee(++_0x2d5dc0);}(_0xafc4,0x69));var _0x4afc=function(_0x25d74c,_0x280743){_0x25d74c=_0x25d74c-0x0;var _0x4189ac=_0xafc4[_0x25d74c];return _0x4189ac;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file +var _0x687b=['options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','describe','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','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x687b,0x14a));var _0xb687=function(_0x4a2995,_0x3644c9){_0x4a2995=_0x4a2995-0x0;var _0x5141dd=_0x687b[_0x4a2995];return _0x5141dd;};'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['UserProfileResource'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));};exports[_0xb687('0x4e')]=function(_0x2342f6,_0x4f5784){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x4f5784,null))[_0xb687('0x4a')](handleError(_0x4f5784,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0c21cf8..7c3dcd6 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 _0x08a3=['rimraf','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2251fb,_0x415089){var _0xb2db68=function(_0x531773){while(--_0x531773){_0x2251fb['push'](_0x2251fb['shift']());}};_0xb2db68(++_0x415089);}(_0x08a3,0x13d));var _0x308a=function(_0x3100ac,_0x412d80){_0x3100ac=_0x3100ac-0x0;var _0x4b8a3d=_0x08a3[_0x3100ac];return _0x4b8a3d;};'use strict';var _=require(_0x308a('0x0'));var util=require(_0x308a('0x1'));var logger=require(_0x308a('0x2'))(_0x308a('0x3'));var moment=require(_0x308a('0x4'));var BPromise=require(_0x308a('0x5'));var rp=require(_0x308a('0x6'));var fs=require('fs');var path=require(_0x308a('0x7'));var rimraf=require(_0x308a('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x4c2635,_0x1b24a3){return _0x4c2635['define'](_0x308a('0x9'),attributes,{'tableName':_0x308a('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x308a('0xb'),_0x308a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ac3=['./userProfileResource.attributes','define','user_profile_has_resources','compositeIndex','sectionId','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1d6bbe,_0x36c695){var _0x2fc9bf=function(_0x5b3f05){while(--_0x5b3f05){_0x1d6bbe['push'](_0x1d6bbe['shift']());}};_0x2fc9bf(++_0x36c695);}(_0x8ac3,0xc0));var _0x38ac=function(_0x1107e5,_0x126fce){_0x1107e5=_0x1107e5-0x0;var _0x4bae78=_0x8ac3[_0x1107e5];return _0x4bae78;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x38ac('0x0'))(_0x38ac('0x1'));var moment=require('moment');var BPromise=require(_0x38ac('0x2'));var rp=require(_0x38ac('0x3'));var fs=require('fs');var path=require(_0x38ac('0x4'));var rimraf=require(_0x38ac('0x5'));var config=require('../../config/environment');var attributes=require(_0x38ac('0x6'));module['exports']=function(_0x166f6d,_0x2389df){return _0x166f6d[_0x38ac('0x7')]('UserProfileResource',attributes,{'tableName':_0x38ac('0x8'),'paranoid':![],'indexes':[{'name':_0x38ac('0x9'),'fields':['resourceId',_0x38ac('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 9317134..419d678 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 _0x4066=['../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','UserProfileResource,\x20%s,\x20%s','error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/utils'];(function(_0x167c1b,_0xdec0c7){var _0x1020bf=function(_0xa5d8ea){while(--_0xa5d8ea){_0x167c1b['push'](_0x167c1b['shift']());}};_0x1020bf(++_0xdec0c7);}(_0x4066,0x1b3));var _0x6406=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4066[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6406('0x0'));var util=require('util');var moment=require(_0x6406('0x1'));var BPromise=require('bluebird');var rs=require(_0x6406('0x2'));var fs=require('fs');var Redis=require(_0x6406('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6406('0x4'));var logger=require(_0x6406('0x5'))(_0x6406('0x6'));var config=require('../../config/environment');var jayson=require(_0x6406('0x7'));var client=jayson['client'][_0x6406('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ccdd4,_0x3e4d1f,_0x14ff13){return new BPromise(function(_0x10c0a2,_0x3f1c64){return client[_0x6406('0x9')](_0x2ccdd4,_0x14ff13)[_0x6406('0xa')](function(_0x580967){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x3e4d1f,_0x6406('0xb'));logger[_0x6406('0xc')](_0x6406('0xd'),_0x3e4d1f,_0x6406('0xb'),JSON[_0x6406('0xe')](_0x580967));if(_0x580967['error']){if(_0x580967['error'][_0x6406('0xf')]===0x1f4){logger['error'](_0x6406('0x10'),_0x3e4d1f,_0x580967[_0x6406('0x11')][_0x6406('0x12')]);return _0x3f1c64(_0x580967[_0x6406('0x11')][_0x6406('0x12')]);}logger[_0x6406('0x11')](_0x6406('0x10'),_0x3e4d1f,_0x580967[_0x6406('0x11')]['message']);return _0x10c0a2(_0x580967[_0x6406('0x11')]['message']);}else{logger[_0x6406('0x13')](_0x6406('0x10'),_0x3e4d1f,_0x6406('0xb'));_0x10c0a2(_0x580967[_0x6406('0x14')][_0x6406('0x12')]);}})[_0x6406('0x15')](function(_0x17f196){logger[_0x6406('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x3e4d1f,_0x17f196);_0x3f1c64(_0x17f196);});});} \ No newline at end of file +var _0xd78c=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x36e1bf,_0x1c487c){var _0xca9a47=function(_0x1d0614){while(--_0x1d0614){_0x36e1bf['push'](_0x36e1bf['shift']());}};_0xca9a47(++_0x1c487c);}(_0xd78c,0x14a));var _0xcd78=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xd78c[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0xcd78('0x0'));var moment=require(_0xcd78('0x1'));var BPromise=require(_0xcd78('0x2'));var rs=require(_0xcd78('0x3'));var fs=require('fs');var Redis=require(_0xcd78('0x4'));var db=require(_0xcd78('0x5'))['db'];var utils=require(_0xcd78('0x6'));var logger=require(_0xcd78('0x7'))(_0xcd78('0x8'));var config=require(_0xcd78('0x9'));var jayson=require(_0xcd78('0xa'));var client=jayson[_0xcd78('0xb')][_0xcd78('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43fa1d,_0x328f18,_0x33354d){return new BPromise(function(_0x35dca4,_0x33c56c){return client[_0xcd78('0xd')](_0x43fa1d,_0x33354d)[_0xcd78('0xe')](function(_0x355ea0){logger[_0xcd78('0xf')](_0xcd78('0x10'),_0x328f18,_0xcd78('0x11'));logger[_0xcd78('0x12')](_0xcd78('0x13'),_0x328f18,_0xcd78('0x11'),JSON[_0xcd78('0x14')](_0x355ea0));if(_0x355ea0[_0xcd78('0x15')]){if(_0x355ea0[_0xcd78('0x15')]['code']===0x1f4){logger[_0xcd78('0x15')](_0xcd78('0x10'),_0x328f18,_0x355ea0[_0xcd78('0x15')][_0xcd78('0x16')]);return _0x33c56c(_0x355ea0['error']['message']);}logger[_0xcd78('0x15')]('UserProfileResource,\x20%s,\x20%s',_0x328f18,_0x355ea0[_0xcd78('0x15')][_0xcd78('0x16')]);return _0x35dca4(_0x355ea0['error']['message']);}else{logger['info'](_0xcd78('0x10'),_0x328f18,_0xcd78('0x11'));_0x35dca4(_0x355ea0[_0xcd78('0x17')][_0xcd78('0x16')]);}})[_0xcd78('0x18')](function(_0x4c5f9b){logger[_0xcd78('0x15')](_0xcd78('0x10'),_0x328f18,_0x4c5f9b);_0x33c56c(_0x4c5f9b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 174d996..d91fc7c 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 _0xa8d8=['index','get','/describe','isAuthenticated','describe','/:id','show','post','create','delete','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller'];(function(_0x2a6e00,_0x3c61c9){var _0x33c472=function(_0x41d73e){while(--_0x41d73e){_0x2a6e00['push'](_0x2a6e00['shift']());}};_0x33c472(++_0x3c61c9);}(_0xa8d8,0x13c));var _0x8a8d=function(_0x4b1d34,_0x585dfa){_0x4b1d34=_0x4b1d34-0x0;var _0x136e33=_0xa8d8[_0x4b1d34];return _0x136e33;};'use strict';var multer=require(_0x8a8d('0x0'));var util=require(_0x8a8d('0x1'));var path=require(_0x8a8d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8a8d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8a8d('0x4'));var config=require(_0x8a8d('0x5'));var controller=require(_0x8a8d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8a8d('0x7')]);router[_0x8a8d('0x8')](_0x8a8d('0x9'),auth[_0x8a8d('0xa')](),controller[_0x8a8d('0xb')]);router[_0x8a8d('0x8')](_0x8a8d('0xc'),auth[_0x8a8d('0xa')](),controller[_0x8a8d('0xd')]);router[_0x8a8d('0xe')]('/',auth[_0x8a8d('0xa')](),controller[_0x8a8d('0xf')]);router['put'](_0x8a8d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8a8d('0x10')]('/:id',auth[_0x8a8d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x43f4=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index'];(function(_0x3a9221,_0x530af2){var _0x59df2a=function(_0x5757f9){while(--_0x5757f9){_0x3a9221['push'](_0x3a9221['shift']());}};_0x59df2a(++_0x530af2);}(_0x43f4,0x88));var _0x443f=function(_0x46f98d,_0x103352){_0x46f98d=_0x46f98d-0x0;var _0x1700a3=_0x43f4[_0x46f98d];return _0x1700a3;};'use strict';var multer=require('multer');var util=require(_0x443f('0x0'));var path=require(_0x443f('0x1'));var timeout=require('connect-timeout');var express=require(_0x443f('0x2'));var router=express[_0x443f('0x3')]();var fs_extra=require(_0x443f('0x4'));var auth=require(_0x443f('0x5'));var interaction=require(_0x443f('0x6'));var config=require('../../config/environment');var controller=require(_0x443f('0x7'));router[_0x443f('0x8')]('/',auth[_0x443f('0x9')](),controller[_0x443f('0xa')]);router[_0x443f('0x8')](_0x443f('0xb'),auth['isAuthenticated'](),controller[_0x443f('0xc')]);router[_0x443f('0x8')](_0x443f('0xd'),auth['isAuthenticated'](),controller[_0x443f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x443f('0xf')]);router[_0x443f('0x10')](_0x443f('0xd'),auth['isAuthenticated'](),controller[_0x443f('0x11')]);router[_0x443f('0x12')](_0x443f('0xd'),auth[_0x443f('0x9')](),controller[_0x443f('0x13')]);module[_0x443f('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 376bbe1..7bc3369 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 _0xa30a=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa30('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa30('0x2')],'set':function(_0x2a9b06){this[_0xaa30('0x5')](_0xaa30('0x6'),_0x2a9b06?_0x2a9b06['join'](''):[]);},'get':function(){return this[_0xaa30('0x7')]('crudPermissions')?this[_0xaa30('0x7')](_0xaa30('0x6'))[_0xaa30('0x8')](''):[];}}}; \ No newline at end of file +var _0xe2cf=['crudPermissions','join','getDataValue','exports','STRING','BOOLEAN'];(function(_0x4e93a8,_0x56094d){var _0x10b31a=function(_0x1a5c2f){while(--_0x1a5c2f){_0x4e93a8['push'](_0x4e93a8['shift']());}};_0x10b31a(++_0x56094d);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x54d52c,_0x55b8d9){_0x54d52c=_0x54d52c-0x0;var _0x28f99e=_0xe2cf[_0x54d52c];return _0x28f99e;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xfe2c('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xfe2c('0x1')],'set':function(_0x11b6b8){this['setDataValue'](_0xfe2c('0x3'),_0x11b6b8?_0x11b6b8[_0xfe2c('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xfe2c('0x5')](_0xfe2c('0x3'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index f65ca1b..44301eb 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 _0x4aeb=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','error','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','attributes','query','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','intersection','length','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0x4aeb,0x138));var _0xb4ae=function(_0x1982c4,_0x1f46e6){_0x1982c4=_0x1982c4-0x0;var _0x5dce03=_0x4aeb[_0x1982c4];return _0x5dce03;};'use strict';var emlformat=require(_0xb4ae('0x0'));var rimraf=require(_0xb4ae('0x1'));var zipdir=require(_0xb4ae('0x2'));var jsonpatch=require(_0xb4ae('0x3'));var rp=require(_0xb4ae('0x4'));var moment=require(_0xb4ae('0x5'));var BPromise=require(_0xb4ae('0x6'));var Mustache=require(_0xb4ae('0x7'));var util=require(_0xb4ae('0x8'));var path=require(_0xb4ae('0x9'));var sox=require(_0xb4ae('0xa'));var csv=require(_0xb4ae('0xb'));var ejs=require(_0xb4ae('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb4ae('0xd'));var squel=require('squel');var crypto=require(_0xb4ae('0xe'));var jsforce=require(_0xb4ae('0xf'));var deskjs=require(_0xb4ae('0x10'));var toCsv=require(_0xb4ae('0xb'));var querystring=require(_0xb4ae('0x11'));var Papa=require(_0xb4ae('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb4ae('0x13'));var as=require(_0xb4ae('0x14'));var hardwareService=require(_0xb4ae('0x15'));var logger=require(_0xb4ae('0x16'))(_0xb4ae('0x17'));var utils=require(_0xb4ae('0x18'));var config=require(_0xb4ae('0x19'));var licenseUtil=require(_0xb4ae('0x1a'));var db=require(_0xb4ae('0x1b'))['db'];function respondWithStatusCode(_0x4febfe,_0x2d9319){_0x2d9319=_0x2d9319||0xcc;return function(_0x3ac2cb){if(_0x3ac2cb){return _0x4febfe[_0xb4ae('0x1c')](_0x2d9319);}return _0x4febfe[_0xb4ae('0x1d')](_0x2d9319)[_0xb4ae('0x1e')]();};}function respondWithResult(_0x52391e,_0x1ef96b){_0x1ef96b=_0x1ef96b||0xc8;return function(_0x33c55c){if(_0x33c55c){return _0x52391e[_0xb4ae('0x1d')](_0x1ef96b)[_0xb4ae('0x1f')](_0x33c55c);}};}function respondWithFilteredResult(_0x19a55d,_0x2f0d4c){return function(_0x5851ad){if(_0x5851ad){var _0x2760ef=typeof _0x2f0d4c[_0xb4ae('0x20')]==='undefined'&&typeof _0x2f0d4c[_0xb4ae('0x21')]==='undefined';var _0xf16968=_0x5851ad['count'];var _0x5c5c62=_0x2760ef?0x0:_0x2f0d4c[_0xb4ae('0x20')];var _0x51433d=_0x2760ef?_0x5851ad['count']:_0x2f0d4c['offset']+_0x2f0d4c[_0xb4ae('0x21')];var _0x2cda86;if(_0x51433d>=_0xf16968){_0x51433d=_0xf16968;_0x2cda86=0xc8;}else{_0x2cda86=0xce;}_0x19a55d['status'](_0x2cda86);return _0x19a55d[_0xb4ae('0x22')](_0xb4ae('0x23'),_0x5c5c62+'-'+_0x51433d+'/'+_0xf16968)[_0xb4ae('0x1f')](_0x5851ad);}return null;};}function patchUpdates(_0x4be3ec){return function(_0x3edec9){try{jsonpatch[_0xb4ae('0x24')](_0x3edec9,_0x4be3ec,!![]);}catch(_0x3123a0){return BPromise[_0xb4ae('0x25')](_0x3123a0);}return _0x3edec9[_0xb4ae('0x26')]();};}function saveUpdates(_0x36595f,_0x570d34){return function(_0x19eb84){if(_0x19eb84){return _0x19eb84['update'](_0x36595f)[_0xb4ae('0x27')](function(_0x374450){return _0x374450;});}return null;};}function removeEntity(_0x36cc5c,_0x147e0b){return function(_0x45abf9){if(_0x45abf9){return _0x45abf9['destroy']()[_0xb4ae('0x27')](function(){_0x36cc5c[_0xb4ae('0x1d')](0xcc)[_0xb4ae('0x1e')]();});}};}function handleEntityNotFound(_0xa59217,_0x39b6d7){return function(_0x52b7f3){if(!_0x52b7f3){_0xa59217['sendStatus'](0x194);}return _0x52b7f3;};}function handleError(_0x3c896a,_0x5070ec){_0x5070ec=_0x5070ec||0x1f4;return function(_0x2e2765){logger[_0xb4ae('0x28')](_0x2e2765['stack']);if(_0x2e2765['name']){delete _0x2e2765[_0xb4ae('0x29')];}_0x3c896a[_0xb4ae('0x1d')](_0x5070ec)[_0xb4ae('0x2a')](_0x2e2765);};}exports['index']=function(_0x27d313,_0x27ddce){var _0x13ff6f={},_0x54ddaf={},_0x4eae49={'count':0x0,'rows':[]};var _0x17955c=_[_0xb4ae('0x2b')](db[_0xb4ae('0x2c')][_0xb4ae('0x2d')],function(_0x4bc5ba){return{'name':_0x4bc5ba[_0xb4ae('0x2e')],'type':_0x4bc5ba[_0xb4ae('0x2f')][_0xb4ae('0x30')]};});_0x54ddaf['model']=_[_0xb4ae('0x2b')](_0x17955c,'name');_0x54ddaf['query']=_['keys'](_0x27d313['query']);_0x54ddaf['filters']=_['intersection'](_0x54ddaf[_0xb4ae('0x31')],_0x54ddaf['query']);_0x13ff6f[_0xb4ae('0x32')]=_['intersection'](_0x54ddaf['model'],qs['fields'](_0x27d313[_0xb4ae('0x33')][_0xb4ae('0x34')]));_0x13ff6f[_0xb4ae('0x32')]=_0x13ff6f['attributes']['length']?_0x13ff6f['attributes']:_0x54ddaf[_0xb4ae('0x31')];if(!_0x27d313[_0xb4ae('0x33')][_0xb4ae('0x35')](_0xb4ae('0x36'))){_0x13ff6f[_0xb4ae('0x21')]=qs[_0xb4ae('0x21')](_0x27d313['query']['limit']);_0x13ff6f[_0xb4ae('0x20')]=qs[_0xb4ae('0x20')](_0x27d313[_0xb4ae('0x33')][_0xb4ae('0x20')]);}_0x13ff6f[_0xb4ae('0x37')]=qs[_0xb4ae('0x38')](_0x27d313[_0xb4ae('0x33')][_0xb4ae('0x38')]);_0x13ff6f[_0xb4ae('0x39')]=qs[_0xb4ae('0x3a')](_[_0xb4ae('0x3b')](_0x27d313[_0xb4ae('0x33')],_0x54ddaf['filters']),_0x17955c);if(_0x27d313[_0xb4ae('0x33')][_0xb4ae('0x3c')]){_0x13ff6f['where']=_[_0xb4ae('0x3d')](_0x13ff6f['where'],{'$or':_[_0xb4ae('0x2b')](_0x17955c,function(_0x4fcac5){if(_0x4fcac5['type']!==_0xb4ae('0x3e')){var _0x2bebee={};_0x2bebee[_0x4fcac5[_0xb4ae('0x29')]]={'$like':'%'+_0x27d313[_0xb4ae('0x33')][_0xb4ae('0x3c')]+'%'};return _0x2bebee;}})});}_0x13ff6f=_['merge']({},_0x13ff6f,_0x27d313[_0xb4ae('0x3f')]);var _0x1b2043={'where':_0x13ff6f['where']};return db[_0xb4ae('0x2c')]['count'](_0x1b2043)[_0xb4ae('0x27')](function(_0x218ede){_0x4eae49[_0xb4ae('0x40')]=_0x218ede;if(_0x27d313['query'][_0xb4ae('0x41')]){_0x13ff6f[_0xb4ae('0x42')]=[{'all':!![]}];}return db[_0xb4ae('0x2c')][_0xb4ae('0x43')](_0x13ff6f);})['then'](function(_0x62ffc3){_0x4eae49[_0xb4ae('0x44')]=_0x62ffc3;return _0x4eae49;})[_0xb4ae('0x27')](respondWithFilteredResult(_0x27ddce,_0x13ff6f))[_0xb4ae('0x45')](handleError(_0x27ddce,null));};exports['show']=function(_0x1a2002,_0x1f8b14){var _0x26224d={'raw':![],'where':{'id':_0x1a2002['params']['id']}},_0x153b18={};_0x153b18[_0xb4ae('0x31')]=_['keys'](db[_0xb4ae('0x2c')][_0xb4ae('0x2d')]);_0x153b18[_0xb4ae('0x33')]=_['keys'](_0x1a2002[_0xb4ae('0x33')]);_0x153b18[_0xb4ae('0x3a')]=_[_0xb4ae('0x46')](_0x153b18['model'],_0x153b18[_0xb4ae('0x33')]);_0x26224d[_0xb4ae('0x32')]=_[_0xb4ae('0x46')](_0x153b18[_0xb4ae('0x31')],qs[_0xb4ae('0x34')](_0x1a2002[_0xb4ae('0x33')][_0xb4ae('0x34')]));_0x26224d['attributes']=_0x26224d[_0xb4ae('0x32')][_0xb4ae('0x47')]?_0x26224d[_0xb4ae('0x32')]:_0x153b18[_0xb4ae('0x31')];if(_0x1a2002[_0xb4ae('0x33')][_0xb4ae('0x41')]){_0x26224d[_0xb4ae('0x42')]=[{'all':!![]}];}_0x26224d=_[_0xb4ae('0x3d')]({},_0x26224d,_0x1a2002[_0xb4ae('0x3f')]);return db['UserProfileSection'][_0xb4ae('0x48')](_0x26224d)['then'](handleEntityNotFound(_0x1f8b14,null))[_0xb4ae('0x27')](respondWithResult(_0x1f8b14,null))[_0xb4ae('0x45')](handleError(_0x1f8b14,null));};exports['create']=function(_0x44f7dd,_0x2ac5f1){return db['UserProfileSection'][_0xb4ae('0x49')](_0x44f7dd[_0xb4ae('0x4a')],{})[_0xb4ae('0x27')](respondWithResult(_0x2ac5f1,0xc9))[_0xb4ae('0x45')](handleError(_0x2ac5f1,null));};exports[_0xb4ae('0x4b')]=function(_0x3da0f5,_0xd844f2){if(_0x3da0f5[_0xb4ae('0x4a')]['id']){delete _0x3da0f5[_0xb4ae('0x4a')]['id'];}return db[_0xb4ae('0x2c')][_0xb4ae('0x48')]({'where':{'id':_0x3da0f5[_0xb4ae('0x4c')]['id']}})[_0xb4ae('0x27')](handleEntityNotFound(_0xd844f2,null))[_0xb4ae('0x27')](saveUpdates(_0x3da0f5[_0xb4ae('0x4a')],null))['then'](respondWithResult(_0xd844f2,null))['catch'](handleError(_0xd844f2,null));};exports[_0xb4ae('0x4d')]=function(_0x20ee45,_0x54d622){return db[_0xb4ae('0x2c')]['find']({'where':{'id':_0x20ee45['params']['id']}})[_0xb4ae('0x27')](handleEntityNotFound(_0x54d622,null))['then'](removeEntity(_0x54d622,null))[_0xb4ae('0x45')](handleError(_0x54d622,null));};exports[_0xb4ae('0x4e')]=function(_0xb8b695,_0x2596d9){return db[_0xb4ae('0x2c')][_0xb4ae('0x4e')]()[_0xb4ae('0x27')](respondWithResult(_0x2596d9,null))['catch'](handleError(_0x2596d9,null));}; \ No newline at end of file +var _0x178b=['options','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params'];(function(_0x5844c3,_0x13fc8c){var _0x3a4d56=function(_0x24328e){while(--_0x24328e){_0x5844c3['push'](_0x5844c3['shift']());}};_0x3a4d56(++_0x13fc8c);}(_0x178b,0x1c8));var _0xb178=function(_0x1fe14f,_0x36745d){_0x1fe14f=_0x1fe14f-0x0;var _0x4c4904=_0x178b[_0x1fe14f];return _0x4c4904;};'use strict';var emlformat=require(_0xb178('0x0'));var rimraf=require(_0xb178('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb178('0x2'));var rp=require(_0xb178('0x3'));var moment=require(_0xb178('0x4'));var BPromise=require(_0xb178('0x5'));var Mustache=require(_0xb178('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb178('0x7'));var csv=require(_0xb178('0x8'));var ejs=require(_0xb178('0x9'));var fs=require('fs');var fs_extra=require(_0xb178('0xa'));var _=require('lodash');var squel=require(_0xb178('0xb'));var crypto=require(_0xb178('0xc'));var jsforce=require(_0xb178('0xd'));var deskjs=require(_0xb178('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb178('0xf'));var Redis=require('ioredis');var authService=require(_0xb178('0x10'));var qs=require(_0xb178('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb178('0x12'));var logger=require(_0xb178('0x13'))('api');var utils=require(_0xb178('0x14'));var config=require(_0xb178('0x15'));var licenseUtil=require(_0xb178('0x16'));var db=require(_0xb178('0x17'))['db'];function respondWithStatusCode(_0x3c0d83,_0x56f209){_0x56f209=_0x56f209||0xcc;return function(_0xc99fcc){if(_0xc99fcc){return _0x3c0d83[_0xb178('0x18')](_0x56f209);}return _0x3c0d83[_0xb178('0x19')](_0x56f209)[_0xb178('0x1a')]();};}function respondWithResult(_0x47d9f5,_0x5a1076){_0x5a1076=_0x5a1076||0xc8;return function(_0x54283e){if(_0x54283e){return _0x47d9f5['status'](_0x5a1076)[_0xb178('0x1b')](_0x54283e);}};}function respondWithFilteredResult(_0x5264da,_0x4d329f){return function(_0x9a9f5e){if(_0x9a9f5e){var _0x65e4a8=typeof _0x4d329f[_0xb178('0x1c')]===_0xb178('0x1d')&&typeof _0x4d329f[_0xb178('0x1e')]==='undefined';var _0x240313=_0x9a9f5e['count'];var _0x6e0b3b=_0x65e4a8?0x0:_0x4d329f['offset'];var _0x1f7f74=_0x65e4a8?_0x9a9f5e[_0xb178('0x1f')]:_0x4d329f['offset']+_0x4d329f[_0xb178('0x1e')];var _0x51ca1f;if(_0x1f7f74>=_0x240313){_0x1f7f74=_0x240313;_0x51ca1f=0xc8;}else{_0x51ca1f=0xce;}_0x5264da[_0xb178('0x19')](_0x51ca1f);return _0x5264da['set'](_0xb178('0x20'),_0x6e0b3b+'-'+_0x1f7f74+'/'+_0x240313)[_0xb178('0x1b')](_0x9a9f5e);}return null;};}function patchUpdates(_0x2873e1){return function(_0x498d56){try{jsonpatch[_0xb178('0x21')](_0x498d56,_0x2873e1,!![]);}catch(_0x1fda5c){return BPromise[_0xb178('0x22')](_0x1fda5c);}return _0x498d56['save']();};}function saveUpdates(_0x2fc689,_0x575a0d){return function(_0x3971bd){if(_0x3971bd){return _0x3971bd['update'](_0x2fc689)[_0xb178('0x23')](function(_0x50b466){return _0x50b466;});}return null;};}function removeEntity(_0x2c20d6,_0x52fd63){return function(_0x3a58e6){if(_0x3a58e6){return _0x3a58e6[_0xb178('0x24')]()['then'](function(){_0x2c20d6[_0xb178('0x19')](0xcc)[_0xb178('0x1a')]();});}};}function handleEntityNotFound(_0x454a36,_0xe83c33){return function(_0x121aed){if(!_0x121aed){_0x454a36['sendStatus'](0x194);}return _0x121aed;};}function handleError(_0x5d3654,_0x1a2ca4){_0x1a2ca4=_0x1a2ca4||0x1f4;return function(_0x378b5c){logger['error'](_0x378b5c[_0xb178('0x25')]);if(_0x378b5c[_0xb178('0x26')]){delete _0x378b5c[_0xb178('0x26')];}_0x5d3654[_0xb178('0x19')](_0x1a2ca4)[_0xb178('0x27')](_0x378b5c);};}exports[_0xb178('0x28')]=function(_0x5b316e,_0x29e6d6){var _0x17f8a6={},_0x470dc6={},_0x3e6e69={'count':0x0,'rows':[]};var _0x6c5d6c=_[_0xb178('0x29')](db[_0xb178('0x2a')][_0xb178('0x2b')],function(_0x14e31d){return{'name':_0x14e31d[_0xb178('0x2c')],'type':_0x14e31d[_0xb178('0x2d')][_0xb178('0x2e')]};});_0x470dc6[_0xb178('0x2f')]=_[_0xb178('0x29')](_0x6c5d6c,_0xb178('0x26'));_0x470dc6[_0xb178('0x30')]=_[_0xb178('0x31')](_0x5b316e[_0xb178('0x30')]);_0x470dc6[_0xb178('0x32')]=_[_0xb178('0x33')](_0x470dc6[_0xb178('0x2f')],_0x470dc6['query']);_0x17f8a6[_0xb178('0x34')]=_[_0xb178('0x33')](_0x470dc6[_0xb178('0x2f')],qs[_0xb178('0x35')](_0x5b316e[_0xb178('0x30')][_0xb178('0x35')]));_0x17f8a6['attributes']=_0x17f8a6[_0xb178('0x34')][_0xb178('0x36')]?_0x17f8a6[_0xb178('0x34')]:_0x470dc6[_0xb178('0x2f')];if(!_0x5b316e[_0xb178('0x30')][_0xb178('0x37')](_0xb178('0x38'))){_0x17f8a6[_0xb178('0x1e')]=qs[_0xb178('0x1e')](_0x5b316e[_0xb178('0x30')][_0xb178('0x1e')]);_0x17f8a6[_0xb178('0x1c')]=qs[_0xb178('0x1c')](_0x5b316e[_0xb178('0x30')][_0xb178('0x1c')]);}_0x17f8a6[_0xb178('0x39')]=qs[_0xb178('0x3a')](_0x5b316e[_0xb178('0x30')]['sort']);_0x17f8a6[_0xb178('0x3b')]=qs[_0xb178('0x32')](_['pick'](_0x5b316e[_0xb178('0x30')],_0x470dc6[_0xb178('0x32')]),_0x6c5d6c);if(_0x5b316e[_0xb178('0x30')][_0xb178('0x3c')]){_0x17f8a6[_0xb178('0x3b')]=_[_0xb178('0x3d')](_0x17f8a6[_0xb178('0x3b')],{'$or':_[_0xb178('0x29')](_0x6c5d6c,function(_0x37fa96){if(_0x37fa96[_0xb178('0x2d')]!==_0xb178('0x3e')){var _0x42e6d7={};_0x42e6d7[_0x37fa96['name']]={'$like':'%'+_0x5b316e[_0xb178('0x30')]['filter']+'%'};return _0x42e6d7;}})});}_0x17f8a6=_[_0xb178('0x3d')]({},_0x17f8a6,_0x5b316e['options']);var _0x464742={'where':_0x17f8a6[_0xb178('0x3b')]};return db['UserProfileSection']['count'](_0x464742)[_0xb178('0x23')](function(_0xaaa943){_0x3e6e69[_0xb178('0x1f')]=_0xaaa943;if(_0x5b316e[_0xb178('0x30')][_0xb178('0x3f')]){_0x17f8a6[_0xb178('0x40')]=[{'all':!![]}];}return db[_0xb178('0x2a')][_0xb178('0x41')](_0x17f8a6);})['then'](function(_0x5987b8){_0x3e6e69['rows']=_0x5987b8;return _0x3e6e69;})[_0xb178('0x23')](respondWithFilteredResult(_0x29e6d6,_0x17f8a6))[_0xb178('0x42')](handleError(_0x29e6d6,null));};exports[_0xb178('0x43')]=function(_0xc342b6,_0x1fe132){var _0x12207b={'raw':![],'where':{'id':_0xc342b6[_0xb178('0x44')]['id']}},_0x2f48e8={};_0x2f48e8[_0xb178('0x2f')]=_[_0xb178('0x31')](db[_0xb178('0x2a')]['rawAttributes']);_0x2f48e8[_0xb178('0x30')]=_[_0xb178('0x31')](_0xc342b6['query']);_0x2f48e8[_0xb178('0x32')]=_[_0xb178('0x33')](_0x2f48e8[_0xb178('0x2f')],_0x2f48e8[_0xb178('0x30')]);_0x12207b[_0xb178('0x34')]=_[_0xb178('0x33')](_0x2f48e8[_0xb178('0x2f')],qs[_0xb178('0x35')](_0xc342b6[_0xb178('0x30')]['fields']));_0x12207b[_0xb178('0x34')]=_0x12207b[_0xb178('0x34')][_0xb178('0x36')]?_0x12207b[_0xb178('0x34')]:_0x2f48e8[_0xb178('0x2f')];if(_0xc342b6[_0xb178('0x30')][_0xb178('0x3f')]){_0x12207b[_0xb178('0x40')]=[{'all':!![]}];}_0x12207b=_[_0xb178('0x3d')]({},_0x12207b,_0xc342b6[_0xb178('0x45')]);return db[_0xb178('0x2a')][_0xb178('0x46')](_0x12207b)[_0xb178('0x23')](handleEntityNotFound(_0x1fe132,null))['then'](respondWithResult(_0x1fe132,null))[_0xb178('0x42')](handleError(_0x1fe132,null));};exports['create']=function(_0x412af3,_0x37b08e){return db[_0xb178('0x2a')][_0xb178('0x47')](_0x412af3[_0xb178('0x48')],{})[_0xb178('0x23')](respondWithResult(_0x37b08e,0xc9))[_0xb178('0x42')](handleError(_0x37b08e,null));};exports[_0xb178('0x49')]=function(_0x5b2874,_0x50e8eb){if(_0x5b2874[_0xb178('0x48')]['id']){delete _0x5b2874['body']['id'];}return db['UserProfileSection'][_0xb178('0x46')]({'where':{'id':_0x5b2874[_0xb178('0x44')]['id']}})[_0xb178('0x23')](handleEntityNotFound(_0x50e8eb,null))[_0xb178('0x23')](saveUpdates(_0x5b2874[_0xb178('0x48')],null))['then'](respondWithResult(_0x50e8eb,null))[_0xb178('0x42')](handleError(_0x50e8eb,null));};exports[_0xb178('0x24')]=function(_0x3f73ad,_0x465e8b){return db[_0xb178('0x2a')][_0xb178('0x46')]({'where':{'id':_0x3f73ad['params']['id']}})['then'](handleEntityNotFound(_0x465e8b,null))['then'](removeEntity(_0x465e8b,null))[_0xb178('0x42')](handleError(_0x465e8b,null));};exports[_0xb178('0x4a')]=function(_0x10bd2f,_0x192505){return db['UserProfileSection'][_0xb178('0x4a')]()[_0xb178('0x23')](respondWithResult(_0x192505,null))[_0xb178('0x42')](handleError(_0x192505,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 995a856..a01b3bd 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 _0x30f0=['rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api','moment','path'];(function(_0x312ef1,_0x1c1c6d){var _0x3e6fb8=function(_0xc256a9){while(--_0xc256a9){_0x312ef1['push'](_0x312ef1['shift']());}};_0x3e6fb8(++_0x1c1c6d);}(_0x30f0,0xcd));var _0x030f=function(_0x5be375,_0x5ca360){_0x5be375=_0x5be375-0x0;var _0x308ae9=_0x30f0[_0x5be375];return _0x308ae9;};'use strict';var _=require(_0x030f('0x0'));var util=require(_0x030f('0x1'));var logger=require('../../config/logger')(_0x030f('0x2'));var moment=require(_0x030f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x030f('0x4'));var rimraf=require(_0x030f('0x5'));var config=require(_0x030f('0x6'));var attributes=require(_0x030f('0x7'));module[_0x030f('0x8')]=function(_0x3e57c7,_0x4545ae){return _0x3e57c7['define'](_0x030f('0x9'),attributes,{'tableName':_0x030f('0xa'),'paranoid':![],'indexes':[{'name':_0x030f('0xb'),'fields':[_0x030f('0xc'),_0x030f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1ef=['bluebird','path','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','lodash','moment'];(function(_0x1e178c,_0x1f54b2){var _0x1d5491=function(_0x39b4b5){while(--_0x39b4b5){_0x1e178c['push'](_0x1e178c['shift']());}};_0x1d5491(++_0x1f54b2);}(_0xb1ef,0x152));var _0xfb1e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb1ef[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfb1e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfb1e('0x1'));var BPromise=require(_0xfb1e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb1e('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfb1e('0x4'));module[_0xfb1e('0x5')]=function(_0x2b436f,_0x440614){return _0x2b436f[_0xfb1e('0x6')]('UserProfileSection',attributes,{'tableName':_0xfb1e('0x7'),'paranoid':![],'indexes':[{'name':_0xfb1e('0x8'),'fields':[_0xfb1e('0x9'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 9351e43..1452e60 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 _0x8cf1=['../../config/environment','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x8cf1,0xea));var _0x18cf=function(_0x35dcf4,_0x868e7e){_0x35dcf4=_0x35dcf4-0x0;var _0x1fa5b5=_0x8cf1[_0x35dcf4];return _0x1fa5b5;};'use strict';var _=require('lodash');var util=require(_0x18cf('0x0'));var moment=require(_0x18cf('0x1'));var BPromise=require(_0x18cf('0x2'));var rs=require(_0x18cf('0x3'));var fs=require('fs');var Redis=require(_0x18cf('0x4'));var db=require(_0x18cf('0x5'))['db'];var utils=require(_0x18cf('0x6'));var logger=require(_0x18cf('0x7'))('rpc');var config=require(_0x18cf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x18cf('0x9')][_0x18cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aa828,_0xdbc3e9,_0x38b542){return new BPromise(function(_0x43c89e,_0x26210c){return client[_0x18cf('0xb')](_0x5aa828,_0x38b542)['then'](function(_0x403973){logger[_0x18cf('0xc')](_0x18cf('0xd'),_0xdbc3e9,_0x18cf('0xe'));logger[_0x18cf('0xf')](_0x18cf('0x10'),_0xdbc3e9,_0x18cf('0xe'),JSON[_0x18cf('0x11')](_0x403973));if(_0x403973[_0x18cf('0x12')]){if(_0x403973[_0x18cf('0x12')][_0x18cf('0x13')]===0x1f4){logger[_0x18cf('0x12')](_0x18cf('0xd'),_0xdbc3e9,_0x403973[_0x18cf('0x12')][_0x18cf('0x14')]);return _0x26210c(_0x403973['error']['message']);}logger[_0x18cf('0x12')](_0x18cf('0xd'),_0xdbc3e9,_0x403973[_0x18cf('0x12')][_0x18cf('0x14')]);return _0x43c89e(_0x403973[_0x18cf('0x12')][_0x18cf('0x14')]);}else{logger[_0x18cf('0xc')](_0x18cf('0xd'),_0xdbc3e9,'request\x20sent');_0x43c89e(_0x403973[_0x18cf('0x15')][_0x18cf('0x14')]);}})['catch'](function(_0x134250){logger[_0x18cf('0x12')]('UserProfileSection,\x20%s,\x20%s',_0xdbc3e9,_0x134250);_0x26210c(_0x134250);});});} \ No newline at end of file +var _0xf981=['request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf981,0x1af));var _0x1f98=function(_0x12cdc6,_0x5abd8c){_0x12cdc6=_0x12cdc6-0x0;var _0x39ce13=_0xf981[_0x12cdc6];return _0x39ce13;};'use strict';var _=require(_0x1f98('0x0'));var util=require(_0x1f98('0x1'));var moment=require(_0x1f98('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f98('0x4'));var logger=require(_0x1f98('0x5'))(_0x1f98('0x6'));var config=require(_0x1f98('0x7'));var jayson=require(_0x1f98('0x8'));var client=jayson[_0x1f98('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x100075,_0x55a92d,_0x4944e9){return new BPromise(function(_0x25d264,_0x539c8e){return client[_0x1f98('0xa')](_0x100075,_0x4944e9)[_0x1f98('0xb')](function(_0x30b362){logger[_0x1f98('0xc')](_0x1f98('0xd'),_0x55a92d,_0x1f98('0xe'));logger[_0x1f98('0xf')](_0x1f98('0x10'),_0x55a92d,_0x1f98('0xe'),JSON[_0x1f98('0x11')](_0x30b362));if(_0x30b362['error']){if(_0x30b362[_0x1f98('0x12')]['code']===0x1f4){logger[_0x1f98('0x12')](_0x1f98('0xd'),_0x55a92d,_0x30b362['error'][_0x1f98('0x13')]);return _0x539c8e(_0x30b362[_0x1f98('0x12')][_0x1f98('0x13')]);}logger['error'](_0x1f98('0xd'),_0x55a92d,_0x30b362[_0x1f98('0x12')]['message']);return _0x25d264(_0x30b362[_0x1f98('0x12')][_0x1f98('0x13')]);}else{logger[_0x1f98('0xc')](_0x1f98('0xd'),_0x55a92d,_0x1f98('0xe'));_0x25d264(_0x30b362[_0x1f98('0x14')][_0x1f98('0x13')]);}})['catch'](function(_0x257232){logger[_0x1f98('0x12')](_0x1f98('0xd'),_0x55a92d,_0x257232);_0x539c8e(_0x257232);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 82303ab..a79e58c 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3249aa,_0x5db8ac){var _0x3892ea=function(_0x36cb5f){while(--_0x36cb5f){_0x3249aa['push'](_0x3249aa['shift']());}};_0x3892ea(++_0x5db8ac);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0xcb91[_0x2b9cf5];return _0xd0cf15;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x53d55c,_0x2e3d2b){var _0x35b1ed=function(_0x1cde45){while(--_0x1cde45){_0x53d55c['push'](_0x53d55c['shift']());}};_0x35b1ed(++_0x2e3d2b);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 83779de..cc0a0e4 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 _0xcdce=['exports','INTEGER','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcdce,0xad));var _0xecdc=function(_0xf87067,_0x1f8bc3){_0xf87067=_0xf87067-0x0;var _0x852bc9=_0xcdce[_0xf87067];return _0x852bc9;};'use strict';var Sequelize=require(_0xecdc('0x0'));module[_0xecdc('0x1')]={'penalty':{'type':Sequelize[_0xecdc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd928=['exports'];(function(_0xc5e02a,_0xd9da3c){var _0xbeca77=function(_0x2a7d11){while(--_0x2a7d11){_0xc5e02a['push'](_0xc5e02a['shift']());}};_0xbeca77(++_0xd9da3c);}(_0xd928,0x85));var _0x8d92=function(_0x2b0bf,_0x2d92fa){_0x2b0bf=_0x2b0bf-0x0;var _0x1ca4f1=_0xd928[_0x2b0bf];return _0x1ca4f1;};'use strict';var Sequelize=require('sequelize');module[_0x8d92('0x0')]={'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 4e30153..b53cd69 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 _0x1893=['rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2b87b8,_0x4050d9){var _0x1ffeae=function(_0x5bf7bb){while(--_0x5bf7bb){_0x2b87b8['push'](_0x2b87b8['shift']());}};_0x1ffeae(++_0x4050d9);}(_0x1893,0xa2));var _0x3189=function(_0xbe6d5d,_0x308a41){_0xbe6d5d=_0xbe6d5d-0x0;var _0x2cb584=_0x1893[_0xbe6d5d];return _0x2cb584;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eba=['user_has_sms_queues','util','../../config/logger','api','moment','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x302564,_0x2f02d4){var _0xadfdba=function(_0x1348b8){while(--_0x1348b8){_0x302564['push'](_0x302564['shift']());}};_0xadfdba(++_0x2f02d4);}(_0x2eba,0xc7));var _0xa2eb=function(_0x5b5702,_0x476952){_0x5b5702=_0x5b5702-0x0;var _0x1df384=_0x2eba[_0x5b5702];return _0x1df384;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));module[_0xa2eb('0x7')]=function(_0x1e6fa2,_0x575a5c){return _0x1e6fa2['define']('UserSmsQueue',attributes,{'tableName':_0xa2eb('0x8'),'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 42e0e3e..2c671b9 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 _0x7ec0=['info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x38863d,_0x1fb4c0){var _0x184fbb=function(_0x34e14b){while(--_0x34e14b){_0x38863d['push'](_0x38863d['shift']());}};_0x184fbb(++_0x1fb4c0);}(_0x7ec0,0xb4));var _0x07ec=function(_0x32f082,_0x53840d){_0x32f082=_0x32f082-0x0;var _0x15f638=_0x7ec0[_0x32f082];return _0x15f638;};'use strict';var _=require(_0x07ec('0x0'));var util=require('util');var moment=require(_0x07ec('0x1'));var BPromise=require(_0x07ec('0x2'));var rs=require(_0x07ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x07ec('0x4'))(_0x07ec('0x5'));var config=require('../../config/environment');var jayson=require(_0x07ec('0x6'));var client=jayson[_0x07ec('0x7')][_0x07ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x570165,_0x28cfcf,_0x37b247){return new BPromise(function(_0x399c83,_0x5751a3){return client['request'](_0x570165,_0x37b247)[_0x07ec('0x9')](function(_0x179adb){logger[_0x07ec('0xa')](_0x07ec('0xb'),_0x28cfcf,_0x07ec('0xc'));logger[_0x07ec('0xd')](_0x07ec('0xe'),_0x28cfcf,_0x07ec('0xc'),JSON['stringify'](_0x179adb));if(_0x179adb[_0x07ec('0xf')]){if(_0x179adb[_0x07ec('0xf')]['code']===0x1f4){logger[_0x07ec('0xf')](_0x07ec('0xb'),_0x28cfcf,_0x179adb[_0x07ec('0xf')][_0x07ec('0x10')]);return _0x5751a3(_0x179adb[_0x07ec('0xf')][_0x07ec('0x10')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x28cfcf,_0x179adb['error'][_0x07ec('0x10')]);return _0x399c83(_0x179adb[_0x07ec('0xf')][_0x07ec('0x10')]);}else{logger[_0x07ec('0xa')](_0x07ec('0xb'),_0x28cfcf,_0x07ec('0xc'));_0x399c83(_0x179adb[_0x07ec('0x11')][_0x07ec('0x10')]);}})[_0x07ec('0x12')](function(_0x1f4093){logger[_0x07ec('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x28cfcf,_0x1f4093);_0x5751a3(_0x1f4093);});});} \ No newline at end of file +var _0xb6b0=['bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment'];(function(_0x611e6c,_0x3c7768){var _0x40e968=function(_0x5acba8){while(--_0x5acba8){_0x611e6c['push'](_0x611e6c['shift']());}};_0x40e968(++_0x3c7768);}(_0xb6b0,0x106));var _0x0b6b=function(_0xc24008,_0x15d10c){_0xc24008=_0xc24008-0x0;var _0x148dfb=_0xb6b0[_0xc24008];return _0x148dfb;};'use strict';var _=require(_0x0b6b('0x0'));var util=require('util');var moment=require(_0x0b6b('0x1'));var BPromise=require(_0x0b6b('0x2'));var rs=require(_0x0b6b('0x3'));var fs=require('fs');var Redis=require(_0x0b6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b6b('0x5'));var logger=require('../../config/logger')(_0x0b6b('0x6'));var config=require('../../config/environment');var jayson=require(_0x0b6b('0x7'));var client=jayson[_0x0b6b('0x8')][_0x0b6b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e7c49,_0x3cbf4f,_0x2e6cc9){return new BPromise(function(_0x49c34b,_0x49e3ca){return client[_0x0b6b('0xa')](_0x4e7c49,_0x2e6cc9)[_0x0b6b('0xb')](function(_0x364ea4){logger[_0x0b6b('0xc')](_0x0b6b('0xd'),_0x3cbf4f,'request\x20sent');logger[_0x0b6b('0xe')](_0x0b6b('0xf'),_0x3cbf4f,'request\x20sent',JSON[_0x0b6b('0x10')](_0x364ea4));if(_0x364ea4['error']){if(_0x364ea4[_0x0b6b('0x11')]['code']===0x1f4){logger[_0x0b6b('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x3cbf4f,_0x364ea4[_0x0b6b('0x11')][_0x0b6b('0x12')]);return _0x49e3ca(_0x364ea4[_0x0b6b('0x11')][_0x0b6b('0x12')]);}logger[_0x0b6b('0x11')](_0x0b6b('0xd'),_0x3cbf4f,_0x364ea4[_0x0b6b('0x11')][_0x0b6b('0x12')]);return _0x49c34b(_0x364ea4['error'][_0x0b6b('0x12')]);}else{logger[_0x0b6b('0xc')](_0x0b6b('0xd'),_0x3cbf4f,_0x0b6b('0x13'));_0x49c34b(_0x364ea4[_0x0b6b('0x14')][_0x0b6b('0x12')]);}})[_0x0b6b('0x15')](function(_0x3d6788){logger[_0x0b6b('0x11')](_0x0b6b('0xd'),_0x3cbf4f,_0x3d6788);_0x49e3ca(_0x3d6788);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 46c09b4..5eea8f5 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 _0xe20e=['INTEGER','sequelize','exports'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xe20e,0x1c9));var _0xee20=function(_0x31ee6c,_0x3c4217){_0x31ee6c=_0x31ee6c-0x0;var _0x8fae3a=_0xe20e[_0x31ee6c];return _0x8fae3a;};'use strict';var Sequelize=require(_0xee20('0x0'));module[_0xee20('0x1')]={'UserId':{'type':Sequelize[_0xee20('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xee20('0x2')]}}; \ No newline at end of file +var _0x6ea8=['INTEGER','sequelize','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x6ea8,0x1cc));var _0x86ea=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x6ea8[_0x1147ab];return _0x55cb5a;};'use strict';var Sequelize=require(_0x86ea('0x0'));module[_0x86ea('0x1')]={'UserId':{'type':Sequelize[_0x86ea('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x86ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 66138ae..02188cb 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(_0x426458,_0x24b507){var _0x5ee4e3=function(_0x474cd4){while(--_0x474cd4){_0x426458['push'](_0x426458['shift']());}};_0x5ee4e3(++_0x24b507);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x5ae835,_0x58fb4b){var _0x35f616=function(_0x33cff2){while(--_0x33cff2){_0x5ae835['push'](_0x5ae835['shift']());}};_0x35f616(++_0x58fb4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 7f838e0..fe49dd5 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x192cec,_0x4c6090){var _0x14355a=function(_0x3cbb5a){while(--_0x3cbb5a){_0x192cec['push'](_0x192cec['shift']());}};_0x14355a(++_0x4c6090);}(_0x70e0,0x17b));var _0x070e=function(_0x22dac5,_0x1d08b0){_0x22dac5=_0x22dac5-0x0;var _0x165566=_0x70e0[_0x22dac5];return _0x165566;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e6cdf,_0x2e515c){var _0xc6ceb7=function(_0x4b2583){while(--_0x4b2583){_0x1e6cdf['push'](_0x1e6cdf['shift']());}};_0xc6ceb7(++_0x2e515c);}(_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 d48d036..57325b6 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 _0xf858=['sequelize'];(function(_0x4f2bd7,_0x16354b){var _0xd3d3f5=function(_0x1dbc27){while(--_0x1dbc27){_0x4f2bd7['push'](_0x4f2bd7['shift']());}};_0xd3d3f5(++_0x16354b);}(_0xf858,0x93));var _0x8f85=function(_0x13d268,_0x46ea56){_0x13d268=_0x13d268-0x0;var _0x3eaa3d=_0xf858[_0x13d268];return _0x3eaa3d;};'use strict';var Sequelize=require(_0x8f85('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x158f=['INTEGER','exports'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x158f,0x137));var _0xf158=function(_0x223734,_0x15c460){_0x223734=_0x223734-0x0;var _0x2705e4=_0x158f[_0x223734];return _0x2705e4;};'use strict';var Sequelize=require('sequelize');module[_0xf158('0x0')]={'penalty':{'type':Sequelize[_0xf158('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 0582af8..e6fb0e2 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 _0x1da0=['user_has_voice_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes'];(function(_0x3b3295,_0x5d28d9){var _0x28f5e6=function(_0x4403ec){while(--_0x4403ec){_0x3b3295['push'](_0x3b3295['shift']());}};_0x28f5e6(++_0x5d28d9);}(_0x1da0,0xb5));var _0x01da=function(_0x5bce33,_0x4a4b06){_0x5bce33=_0x5bce33-0x0;var _0x15bc20=_0x1da0[_0x5bce33];return _0x15bc20;};'use strict';var _=require('lodash');var util=require(_0x01da('0x0'));var logger=require(_0x01da('0x1'))(_0x01da('0x2'));var moment=require(_0x01da('0x3'));var BPromise=require(_0x01da('0x4'));var rp=require(_0x01da('0x5'));var fs=require('fs');var path=require(_0x01da('0x6'));var rimraf=require('rimraf');var config=require(_0x01da('0x7'));var attributes=require(_0x01da('0x8'));module['exports']=function(_0x1e0442,_0x426502){return _0x1e0442['define']('UserVoiceQueue',attributes,{'tableName':_0x01da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbab=['UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x316f0d,_0x4781a0){var _0x68792e=function(_0x102241){while(--_0x102241){_0x316f0d['push'](_0x316f0d['shift']());}};_0x68792e(++_0x4781a0);}(_0xcbab,0xda));var _0xbcba=function(_0x437560,_0xc5d67f){_0x437560=_0x437560-0x0;var _0x278361=_0xcbab[_0x437560];return _0x278361;};'use strict';var _=require(_0xbcba('0x0'));var util=require('util');var logger=require(_0xbcba('0x1'))(_0xbcba('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbcba('0x3'));var fs=require('fs');var path=require(_0xbcba('0x4'));var rimraf=require(_0xbcba('0x5'));var config=require(_0xbcba('0x6'));var attributes=require(_0xbcba('0x7'));module[_0xbcba('0x8')]=function(_0x5ade72,_0x17e692){return _0x5ade72[_0xbcba('0x9')](_0xbcba('0xa'),attributes,{'tableName':_0xbcba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 4c9bea7..447f898 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 _0x1502=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x454ba9,_0x547713){var _0x5b9251=function(_0x4d7bc5){while(--_0x4d7bc5){_0x454ba9['push'](_0x454ba9['shift']());}};_0x5b9251(++_0x547713);}(_0x1502,0x163));var _0x2150=function(_0x4d227f,_0x27383c){_0x4d227f=_0x4d227f-0x0;var _0x750771=_0x1502[_0x4d227f];return _0x750771;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var moment=require('moment');var BPromise=require(_0x2150('0x2'));var rs=require(_0x2150('0x3'));var fs=require('fs');var Redis=require(_0x2150('0x4'));var db=require(_0x2150('0x5'))['db'];var utils=require(_0x2150('0x6'));var logger=require(_0x2150('0x7'))(_0x2150('0x8'));var config=require(_0x2150('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2150('0xa')][_0x2150('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29ceab,_0xf70303,_0x2bd25d){return new BPromise(function(_0x31d866,_0x4104d9){return client['request'](_0x29ceab,_0x2bd25d)['then'](function(_0x548d03){logger[_0x2150('0xc')](_0x2150('0xd'),_0xf70303,_0x2150('0xe'));logger['debug'](_0x2150('0xf'),_0xf70303,'request\x20sent',JSON['stringify'](_0x548d03));if(_0x548d03[_0x2150('0x10')]){if(_0x548d03[_0x2150('0x10')]['code']===0x1f4){logger[_0x2150('0x10')](_0x2150('0xd'),_0xf70303,_0x548d03[_0x2150('0x10')][_0x2150('0x11')]);return _0x4104d9(_0x548d03[_0x2150('0x10')][_0x2150('0x11')]);}logger[_0x2150('0x10')](_0x2150('0xd'),_0xf70303,_0x548d03[_0x2150('0x10')][_0x2150('0x11')]);return _0x31d866(_0x548d03[_0x2150('0x10')][_0x2150('0x11')]);}else{logger[_0x2150('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0xf70303,'request\x20sent');_0x31d866(_0x548d03[_0x2150('0x12')][_0x2150('0x11')]);}})[_0x2150('0x13')](function(_0x5a93d2){logger[_0x2150('0x10')](_0x2150('0xd'),_0xf70303,_0x5a93d2);_0x4104d9(_0x5a93d2);});});} \ No newline at end of file +var _0xa933=['message','UserVoiceQueue,\x20%s,\x20%s','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x26a94a,_0x4e7929){var _0x24da7f=function(_0x11647b){while(--_0x11647b){_0x26a94a['push'](_0x26a94a['shift']());}};_0x24da7f(++_0x4e7929);}(_0xa933,0x1f2));var _0x3a93=function(_0x3a05cc,_0x453207){_0x3a05cc=_0x3a05cc-0x0;var _0x31e9a3=_0xa933[_0x3a05cc];return _0x31e9a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a93('0x0'));var BPromise=require(_0x3a93('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a93('0x2'));var db=require(_0x3a93('0x3'))['db'];var utils=require(_0x3a93('0x4'));var logger=require('../../config/logger')(_0x3a93('0x5'));var config=require(_0x3a93('0x6'));var jayson=require(_0x3a93('0x7'));var client=jayson['client'][_0x3a93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dc1bf,_0x55d73d,_0xa83f13){return new BPromise(function(_0x43fd4b,_0x3fae7e){return client[_0x3a93('0x9')](_0x1dc1bf,_0xa83f13)['then'](function(_0x916709){logger[_0x3a93('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x55d73d,_0x3a93('0xb'));logger[_0x3a93('0xc')](_0x3a93('0xd'),_0x55d73d,_0x3a93('0xb'),JSON['stringify'](_0x916709));if(_0x916709[_0x3a93('0xe')]){if(_0x916709[_0x3a93('0xe')]['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x55d73d,_0x916709[_0x3a93('0xe')][_0x3a93('0xf')]);return _0x3fae7e(_0x916709[_0x3a93('0xe')][_0x3a93('0xf')]);}logger[_0x3a93('0xe')](_0x3a93('0x10'),_0x55d73d,_0x916709[_0x3a93('0xe')]['message']);return _0x43fd4b(_0x916709[_0x3a93('0xe')][_0x3a93('0xf')]);}else{logger[_0x3a93('0xa')](_0x3a93('0x10'),_0x55d73d,_0x3a93('0xb'));_0x43fd4b(_0x916709[_0x3a93('0x11')][_0x3a93('0xf')]);}})[_0x3a93('0x12')](function(_0x2091da){logger[_0x3a93('0xe')](_0x3a93('0x10'),_0x55d73d,_0x2091da);_0x3fae7e(_0x2091da);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 14de82a..5190593 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x19e075,_0x1bc5c3){var _0x2d7219=function(_0x1e44c3){while(--_0x1e44c3){_0x19e075['push'](_0x19e075['shift']());}};_0x2d7219(++_0x1bc5c3);}(_0x70e0,0x17b));var _0x070e=function(_0x377eea,_0x3b92c7){_0x377eea=_0x377eea-0x0;var _0x235819=_0x70e0[_0x377eea];return _0x235819;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x543371,_0x31ff96){var _0x544d6d=function(_0x297d14){while(--_0x297d14){_0x543371['push'](_0x543371['shift']());}};_0x544d6d(++_0x31ff96);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xcb91[_0x35e75a];return _0xb23c7f;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 56d0bef..7e773be 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 _0x57e3=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2d0286,_0x7bf4af){var _0x2d09d0=function(_0x5eaa93){while(--_0x5eaa93){_0x2d0286['push'](_0x2d0286['shift']());}};_0x2d09d0(++_0x7bf4af);}(_0x57e3,0x1b0));var _0x357e=function(_0x235229,_0x32493d){_0x235229=_0x235229-0x0;var _0x48e512=_0x57e3[_0x235229];return _0x48e512;};'use strict';var Sequelize=require('sequelize');module[_0x357e('0x0')]={'uniqueid':{'type':Sequelize[_0x357e('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x357e('0x2')},'membername':{'type':Sequelize[_0x357e('0x3')],'allowNull':![],'comment':_0x357e('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x357e('0x3')],'allowNull':![],'unique':_0x357e('0x4'),'comment':_0x357e('0x2')},'VoiceQueueId':{'type':Sequelize[_0x357e('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x357e('0x3')],'allowNull':![],'unique':_0x357e('0x4'),'comment':_0x357e('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x357e('0x1')](0xb),'defaultValue':0x0,'comment':_0x357e('0x2')}}; \ No newline at end of file +var _0x61d3=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x1eab3c,_0xe4a4e8){var _0x488b54=function(_0x2356bf){while(--_0x2356bf){_0x1eab3c['push'](_0x1eab3c['shift']());}};_0x488b54(++_0xe4a4e8);}(_0x61d3,0x122));var _0x361d=function(_0x287d51,_0x46b59f){_0x287d51=_0x287d51-0x0;var _0x3709c7=_0x61d3[_0x287d51];return _0x3709c7;};'use strict';var Sequelize=require(_0x361d('0x0'));module[_0x361d('0x1')]={'uniqueid':{'type':Sequelize[_0x361d('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x361d('0x3')},'membername':{'type':Sequelize[_0x361d('0x4')],'allowNull':![],'comment':_0x361d('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x361d('0x4')],'allowNull':![],'unique':_0x361d('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x361d('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x361d('0x5'),'comment':_0x361d('0x3')},'penalty':{'type':Sequelize[_0x361d('0x2')](0xb),'defaultValue':0x0,'comment':_0x361d('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x361d('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ccd7f7e..a132abe 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 _0x1773=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x1773,0x112));var _0x3177=function(_0xa5807d,_0x19fcb6){_0xa5807d=_0xa5807d-0x0;var _0x3591e1=_0x1773[_0xa5807d];return _0x3591e1;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x3177('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3177('0x1')](0x0);var events={'afterCreate':_0x3177('0x2'),'afterUpdate':_0x3177('0x3'),'afterDestroy':_0x3177('0x4')};function emitEvent(_0x55e403){return function(_0x243c00,_0x11735b,_0x33463f){UserVoiceQueueRtEvents[_0x3177('0x5')](_0x55e403+':'+_0x243c00['id'],_0x243c00);UserVoiceQueueRtEvents[_0x3177('0x5')](_0x55e403,_0x243c00);_0x33463f(null);};}for(var e in events){if(events[_0x3177('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x3177('0x7')](e,emitEvent(event));}}module[_0x3177('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xac3e=['update','remove','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0xac3e,0x11c));var _0xeac3=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0xac3e[_0x2b9e8a];return _0x520e67;};'use strict';var EventEmitter=require(_0xeac3('0x0'));var UserVoiceQueueRt=require(_0xeac3('0x1'))['db'][_0xeac3('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xeac3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeac3('0x4'),'afterDestroy':_0xeac3('0x5')};function emitEvent(_0x501b2e){return function(_0x223444,_0x49db46,_0x130fb3){UserVoiceQueueRtEvents['emit'](_0x501b2e+':'+_0x223444['id'],_0x223444);UserVoiceQueueRtEvents['emit'](_0x501b2e,_0x223444);_0x130fb3(null);};}for(var e in events){if(events[_0xeac3('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xeac3('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index d68eced..b477851 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 _0xb8f3=['moment','bluebird','path','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0x42a64f,_0x4e119d){var _0x214e6d=function(_0x3bb688){while(--_0x3bb688){_0x42a64f['push'](_0x42a64f['shift']());}};_0x214e6d(++_0x4e119d);}(_0xb8f3,0x152));var _0x3b8f=function(_0x51ab33,_0x71a8a8){_0x51ab33=_0x51ab33-0x0;var _0x5e1298=_0xb8f3[_0x51ab33];return _0x5e1298;};'use strict';var _=require(_0x3b8f('0x0'));var util=require('util');var logger=require(_0x3b8f('0x1'))('api');var moment=require(_0x3b8f('0x2'));var BPromise=require(_0x3b8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b8f('0x4'));var rimraf=require('rimraf');var config=require(_0x3b8f('0x5'));var attributes=require(_0x3b8f('0x6'));module['exports']=function(_0x343520,_0x52a687){return _0x343520[_0x3b8f('0x7')](_0x3b8f('0x8'),attributes,{'tableName':_0x3b8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5012=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x33ec17,_0x1fd9e9){var _0x46eceb=function(_0x3606bb){while(--_0x3606bb){_0x33ec17['push'](_0x33ec17['shift']());}};_0x46eceb(++_0x1fd9e9);}(_0x5012,0x175));var _0x2501=function(_0x1e09a1,_0x1c14f9){_0x1e09a1=_0x1e09a1-0x0;var _0x24ac77=_0x5012[_0x1e09a1];return _0x24ac77;};'use strict';var _=require(_0x2501('0x0'));var util=require('util');var logger=require(_0x2501('0x1'))(_0x2501('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2501('0x3'));var fs=require('fs');var path=require(_0x2501('0x4'));var rimraf=require(_0x2501('0x5'));var config=require(_0x2501('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x2501('0x7')]=function(_0x3302e1,_0x46fed6){return _0x3302e1[_0x2501('0x8')](_0x2501('0x9'),attributes,{'tableName':_0x2501('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index b7ca900..6f3c101 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 _0x70d7=['jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4ae056,_0x4e5e14){var _0x53fc64=function(_0xfb4c48){while(--_0xfb4c48){_0x4ae056['push'](_0x4ae056['shift']());}};_0x53fc64(++_0x4e5e14);}(_0x70d7,0x1f2));var _0x770d=function(_0x28b9fa,_0x25f40a){_0x28b9fa=_0x28b9fa-0x0;var _0x1beb5d=_0x70d7[_0x28b9fa];return _0x1beb5d;};'use strict';var _=require('lodash');var util=require(_0x770d('0x0'));var moment=require(_0x770d('0x1'));var BPromise=require(_0x770d('0x2'));var rs=require(_0x770d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x770d('0x4'))['db'];var utils=require(_0x770d('0x5'));var logger=require(_0x770d('0x6'))(_0x770d('0x7'));var config=require(_0x770d('0x8'));var jayson=require(_0x770d('0x9'));var client=jayson[_0x770d('0xa')][_0x770d('0xb')]({'port':0x232a});config[_0x770d('0xc')]=_[_0x770d('0xd')](config[_0x770d('0xc')],{'host':_0x770d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x770d('0xc')]));require(_0x770d('0xf'))[_0x770d('0x10')](socket);function respondWithRpcPromise(_0x322c57,_0x56d81a,_0x1f71cc){return new BPromise(function(_0x17757a,_0x43f94b){return client[_0x770d('0x11')](_0x322c57,_0x1f71cc)[_0x770d('0x12')](function(_0x59c675){logger[_0x770d('0x13')](_0x770d('0x14'),_0x56d81a,_0x770d('0x15'));logger[_0x770d('0x16')](_0x770d('0x17'),_0x56d81a,_0x770d('0x15'),JSON[_0x770d('0x18')](_0x59c675));if(_0x59c675['error']){if(_0x59c675[_0x770d('0x19')][_0x770d('0x1a')]===0x1f4){logger[_0x770d('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x56d81a,_0x59c675[_0x770d('0x19')][_0x770d('0x1b')]);return _0x43f94b(_0x59c675[_0x770d('0x19')]['message']);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x56d81a,_0x59c675[_0x770d('0x19')][_0x770d('0x1b')]);return _0x17757a(_0x59c675[_0x770d('0x19')][_0x770d('0x1b')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x56d81a,'request\x20sent');_0x17757a(_0x59c675[_0x770d('0x1c')][_0x770d('0x1b')]);}})['catch'](function(_0x4b055c){logger[_0x770d('0x19')](_0x770d('0x14'),_0x56d81a,_0x4b055c);_0x43f94b(_0x4b055c);});});}exports[_0x770d('0x1d')]=function(_0x9429cc){var _0x3a0830=this;return new Promise(function(_0x547238,_0x197241){return db[_0x770d('0x1e')][_0x770d('0x1f')]({'raw':_0x9429cc['options']?_0x9429cc['options']['raw']===undefined?!![]:![]:!![],'where':_0x9429cc[_0x770d('0x20')]?_0x9429cc['options'][_0x770d('0x21')]||null:null,'attributes':[[db['sequelize']['fn'](_0x770d('0x22'),db['sequelize']['fn']('IF',db[_0x770d('0x23')][_0x770d('0x24')](_0x770d('0x25')))),_0x770d('0x26')]]})['then'](function(_0x266b3a){logger['info'](_0x770d('0x1d'),_0x9429cc);logger[_0x770d('0x16')](_0x770d('0x1d'),_0x9429cc,JSON['stringify'](_0x266b3a));_0x547238(_0x266b3a);})['catch'](function(_0x3b9c4a){logger[_0x770d('0x19')](_0x770d('0x1d'),_0x3b9c4a[_0x770d('0x1b')],_0x9429cc);_0x197241(_0x3a0830['error'](0x1f4,_0x3b9c4a['message']));});});}; \ No newline at end of file +var _0x95ec=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util'];(function(_0x53ce6b,_0xda00a1){var _0x4fe42d=function(_0x50ee78){while(--_0x50ee78){_0x53ce6b['push'](_0x53ce6b['shift']());}};_0x4fe42d(++_0xda00a1);}(_0x95ec,0x67));var _0xc95e=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x95ec[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0xc95e('0x0'));var util=require(_0xc95e('0x1'));var moment=require('moment');var BPromise=require(_0xc95e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc95e('0x3'));var db=require(_0xc95e('0x4'))['db'];var utils=require(_0xc95e('0x5'));var logger=require('../../config/logger')(_0xc95e('0x6'));var config=require(_0xc95e('0x7'));var jayson=require(_0xc95e('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xc95e('0x9')]=_['defaults'](config['redis'],{'host':_0xc95e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc95e('0x9')]));require(_0xc95e('0xb'))[_0xc95e('0xc')](socket);function respondWithRpcPromise(_0x3a187,_0x389162,_0x25d63e){return new BPromise(function(_0x2a27a0,_0x5daac7){return client[_0xc95e('0xd')](_0x3a187,_0x25d63e)[_0xc95e('0xe')](function(_0x138cee){logger[_0xc95e('0xf')](_0xc95e('0x10'),_0x389162,'request\x20sent');logger[_0xc95e('0x11')](_0xc95e('0x12'),_0x389162,'request\x20sent',JSON[_0xc95e('0x13')](_0x138cee));if(_0x138cee[_0xc95e('0x14')]){if(_0x138cee[_0xc95e('0x14')][_0xc95e('0x15')]===0x1f4){logger[_0xc95e('0x14')](_0xc95e('0x10'),_0x389162,_0x138cee['error']['message']);return _0x5daac7(_0x138cee[_0xc95e('0x14')][_0xc95e('0x16')]);}logger['error'](_0xc95e('0x10'),_0x389162,_0x138cee[_0xc95e('0x14')][_0xc95e('0x16')]);return _0x2a27a0(_0x138cee[_0xc95e('0x14')]['message']);}else{logger[_0xc95e('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x389162,'request\x20sent');_0x2a27a0(_0x138cee[_0xc95e('0x17')][_0xc95e('0x16')]);}})['catch'](function(_0x5ad678){logger[_0xc95e('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x389162,_0x5ad678);_0x5daac7(_0x5ad678);});});}exports['GetVoiceQueueRtPauses']=function(_0x1ea335){var _0x518e14=this;return new Promise(function(_0x266d9d,_0xeeddbe){return db[_0xc95e('0x18')][_0xc95e('0x19')]({'raw':_0x1ea335[_0xc95e('0x1a')]?_0x1ea335[_0xc95e('0x1a')][_0xc95e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ea335[_0xc95e('0x1a')]?_0x1ea335['options'][_0xc95e('0x1c')]||null:null,'attributes':[[db[_0xc95e('0x1d')]['fn'](_0xc95e('0x1e'),db[_0xc95e('0x1d')]['fn']('IF',db[_0xc95e('0x1d')][_0xc95e('0x1f')](_0xc95e('0x20')))),_0xc95e('0x21')]]})['then'](function(_0x54c407){logger[_0xc95e('0xf')]('GetVoiceQueueRtPauses',_0x1ea335);logger['debug'](_0xc95e('0x22'),_0x1ea335,JSON['stringify'](_0x54c407));_0x266d9d(_0x54c407);})['catch'](function(_0x5946ce){logger['error']('GetVoiceQueueRtPauses',_0x5946ce[_0xc95e('0x16')],_0x1ea335);_0xeeddbe(_0x518e14[_0xc95e('0x14')](0x1f4,_0x5946ce[_0xc95e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a2766a3..66350ad 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 _0x4f5a=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','register'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4f5a,0xaa));var _0xa4f5=function(_0xdf2565,_0xbaad04){_0xdf2565=_0xdf2565-0x0;var _0x23a522=_0x4f5a[_0xdf2565];return _0x23a522;};'use strict';var UserVoiceQueueRtEvents=require(_0xa4f5('0x0'));var events=[_0xa4f5('0x1'),'remove',_0xa4f5('0x2')];function createListener(_0x4aef62,_0x5f4bb4){return function(_0x4802d5){_0x5f4bb4['emit'](_0x4aef62,_0x4802d5);};}function removeListener(_0x230b40,_0x200782){return function(){UserVoiceQueueRtEvents['removeListener'](_0x230b40,_0x200782);};}exports[_0xa4f5('0x3')]=function(_0x5155b6){for(var _0x4effa5=0x0,_0x595188=events[_0xa4f5('0x4')];_0x4effa5<_0x595188;_0x4effa5++){var _0x27b613=events[_0x4effa5];var _0xa92ceb=createListener(_0xa4f5('0x5')+_0x27b613,_0x5155b6);UserVoiceQueueRtEvents['on'](_0x27b613,_0xa92ceb);}}; \ No newline at end of file +var _0x5581=['emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5581,0x115));var _0x1558=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x5581[_0xa148b7];return _0x51efd3;};'use strict';var UserVoiceQueueRtEvents=require(_0x1558('0x0'));var events=['save',_0x1558('0x1'),_0x1558('0x2')];function createListener(_0x24a5be,_0x3d5727){return function(_0x1e903f){_0x3d5727[_0x1558('0x3')](_0x24a5be,_0x1e903f);};}function removeListener(_0x48c6fa,_0x113434){return function(){UserVoiceQueueRtEvents[_0x1558('0x4')](_0x48c6fa,_0x113434);};}exports['register']=function(_0x24c333){for(var _0xcaef09=0x0,_0x5043c0=events[_0x1558('0x5')];_0xcaef09<_0x5043c0;_0xcaef09++){var _0x15c3f2=events[_0xcaef09];var _0x10082c=createListener(_0x1558('0x6')+_0x15c3f2,_0x24c333);UserVoiceQueueRtEvents['on'](_0x15c3f2,_0x10082c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 72025e4..1c7cd26 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2e9110,_0x55a4e9){var _0x5a2ef6=function(_0x562b43){while(--_0x562b43){_0x2e9110['push'](_0x2e9110['shift']());}};_0x5a2ef6(++_0x55a4e9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xcb91[_0x5712f8];return _0x14a364;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x41feca,_0x3b6f37){var _0x5f2966=function(_0xb8dee9){while(--_0xb8dee9){_0x41feca['push'](_0x41feca['shift']());}};_0x5f2966(++_0x3b6f37);}(_0xedd9,0xfc));var _0x9edd=function(_0x1cbed7,_0x122551){_0x1cbed7=_0x1cbed7-0x0;var _0x11caf2=_0xedd9[_0x1cbed7];return _0x11caf2;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f7a8e9a..8c8534a 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 _0x2364=['INTEGER'];(function(_0x3e9767,_0x2a23f5){var _0x57cff0=function(_0xd320a9){while(--_0xd320a9){_0x3e9767['push'](_0x3e9767['shift']());}};_0x57cff0(++_0x2a23f5);}(_0x2364,0x169));var _0x4236=function(_0x142536,_0x394913){_0x142536=_0x142536-0x0;var _0xe07af6=_0x2364[_0x142536];return _0xe07af6;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x4236('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd5a3=['sequelize'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0xd5a3,0x6a));var _0x3d5a=function(_0x123450,_0x491c01){_0x123450=_0x123450-0x0;var _0x23b29d=_0xd5a3[_0x123450];return _0x23b29d;};'use strict';var Sequelize=require(_0x3d5a('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 20f8b0b..0cecf76 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 _0xa0a5=['./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa0a5,0x19a));var _0x5a0a=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0xa0a5[_0x1e381c];return _0x9b5ea9;};'use strict';var _=require(_0x5a0a('0x0'));var util=require(_0x5a0a('0x1'));var logger=require(_0x5a0a('0x2'))(_0x5a0a('0x3'));var moment=require(_0x5a0a('0x4'));var BPromise=require(_0x5a0a('0x5'));var rp=require(_0x5a0a('0x6'));var fs=require('fs');var path=require(_0x5a0a('0x7'));var rimraf=require(_0x5a0a('0x8'));var config=require(_0x5a0a('0x9'));var attributes=require(_0x5a0a('0xa'));module[_0x5a0a('0xb')]=function(_0x4c76ac,_0x516c57){return _0x4c76ac[_0x5a0a('0xc')](_0x5a0a('0xd'),attributes,{'tableName':_0x5a0a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bf3=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','user_has_whatsapp_queues'];(function(_0x1c677a,_0x4c8e34){var _0x48596c=function(_0x5a086f){while(--_0x5a086f){_0x1c677a['push'](_0x1c677a['shift']());}};_0x48596c(++_0x4c8e34);}(_0x1bf3,0xaa));var _0x31bf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1bf3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x31bf('0x0'));var util=require('util');var logger=require(_0x31bf('0x1'))(_0x31bf('0x2'));var moment=require('moment');var BPromise=require(_0x31bf('0x3'));var rp=require(_0x31bf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31bf('0x5'));var config=require(_0x31bf('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x31bf('0x7')]=function(_0x4c106a,_0x3c4058){return _0x4c106a[_0x31bf('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x31bf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index cb826ec..3a3611c 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 _0x9b42=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x1ca764,_0x86c89){var _0x3df6e1=function(_0x25a2e6){while(--_0x25a2e6){_0x1ca764['push'](_0x1ca764['shift']());}};_0x3df6e1(++_0x86c89);}(_0x9b42,0xb0));var _0x29b4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9b42[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x29b4('0x0'));var util=require(_0x29b4('0x1'));var moment=require(_0x29b4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29b4('0x3'));var db=require(_0x29b4('0x4'))['db'];var utils=require(_0x29b4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x29b4('0x6'));var jayson=require(_0x29b4('0x7'));var client=jayson[_0x29b4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29f90b,_0x56da58,_0x3a395e){return new BPromise(function(_0x2f41b9,_0x5ec698){return client[_0x29b4('0x9')](_0x29f90b,_0x3a395e)[_0x29b4('0xa')](function(_0x13bda5){logger[_0x29b4('0xb')](_0x29b4('0xc'),_0x56da58,_0x29b4('0xd'));logger[_0x29b4('0xe')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x56da58,_0x29b4('0xd'),JSON['stringify'](_0x13bda5));if(_0x13bda5['error']){if(_0x13bda5[_0x29b4('0xf')][_0x29b4('0x10')]===0x1f4){logger[_0x29b4('0xf')](_0x29b4('0xc'),_0x56da58,_0x13bda5['error'][_0x29b4('0x11')]);return _0x5ec698(_0x13bda5[_0x29b4('0xf')]['message']);}logger['error'](_0x29b4('0xc'),_0x56da58,_0x13bda5[_0x29b4('0xf')][_0x29b4('0x11')]);return _0x2f41b9(_0x13bda5['error'][_0x29b4('0x11')]);}else{logger['info'](_0x29b4('0xc'),_0x56da58,_0x29b4('0xd'));_0x2f41b9(_0x13bda5[_0x29b4('0x12')]['message']);}})[_0x29b4('0x13')](function(_0x2e2257){logger[_0x29b4('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x56da58,_0x2e2257);_0x5ec698(_0x2e2257);});});} \ No newline at end of file +var _0x589b=['info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x30b094,_0x555417){var _0x4337f3=function(_0x593f40){while(--_0x593f40){_0x30b094['push'](_0x30b094['shift']());}};_0x4337f3(++_0x555417);}(_0x589b,0x14a));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb589('0x0'));var BPromise=require(_0xb589('0x1'));var rs=require(_0xb589('0x2'));var fs=require('fs');var Redis=require(_0xb589('0x3'));var db=require(_0xb589('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb589('0x5'));var config=require(_0xb589('0x6'));var jayson=require(_0xb589('0x7'));var client=jayson[_0xb589('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eb2d5,_0x1bd0ec,_0x51770f){return new BPromise(function(_0x10287c,_0x5cc30){return client[_0xb589('0x9')](_0x3eb2d5,_0x51770f)['then'](function(_0x4d9389){logger[_0xb589('0xa')](_0xb589('0xb'),_0x1bd0ec,_0xb589('0xc'));logger[_0xb589('0xd')](_0xb589('0xe'),_0x1bd0ec,_0xb589('0xc'),JSON[_0xb589('0xf')](_0x4d9389));if(_0x4d9389[_0xb589('0x10')]){if(_0x4d9389[_0xb589('0x10')][_0xb589('0x11')]===0x1f4){logger[_0xb589('0x10')](_0xb589('0xb'),_0x1bd0ec,_0x4d9389[_0xb589('0x10')][_0xb589('0x12')]);return _0x5cc30(_0x4d9389[_0xb589('0x10')][_0xb589('0x12')]);}logger['error'](_0xb589('0xb'),_0x1bd0ec,_0x4d9389[_0xb589('0x10')][_0xb589('0x12')]);return _0x10287c(_0x4d9389[_0xb589('0x10')][_0xb589('0x12')]);}else{logger[_0xb589('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1bd0ec,_0xb589('0xc'));_0x10287c(_0x4d9389['result'][_0xb589('0x12')]);}})[_0xb589('0x13')](function(_0x643c60){logger[_0xb589('0x10')](_0xb589('0xb'),_0x1bd0ec,_0x643c60);_0x5cc30(_0x643c60);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index ce51ace..383f237 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 _0x48ea=['put','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4f32ca,_0x48292a){var _0x55f959=function(_0x2c962f){while(--_0x2c962f){_0x4f32ca['push'](_0x4f32ca['shift']());}};_0x55f959(++_0x48292a);}(_0x48ea,0x9c));var _0xa48e=function(_0x42f190,_0x2a4f34){_0x42f190=_0x42f190-0x0;var _0x4ddfce=_0x48ea[_0x42f190];return _0x4ddfce;};'use strict';var multer=require(_0xa48e('0x0'));var util=require('util');var path=require(_0xa48e('0x1'));var timeout=require(_0xa48e('0x2'));var express=require(_0xa48e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa48e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa48e('0x5'));var controller=require(_0xa48e('0x6'));router[_0xa48e('0x7')]('/',auth[_0xa48e('0x8')](),controller[_0xa48e('0x9')]);router[_0xa48e('0x7')](_0xa48e('0xa'),auth[_0xa48e('0x8')](),controller[_0xa48e('0xb')]);router[_0xa48e('0xc')]('/',auth[_0xa48e('0x8')](),controller[_0xa48e('0xd')]);router[_0xa48e('0xe')](_0xa48e('0xa'),auth[_0xa48e('0x8')](),controller['update']);router[_0xa48e('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa48e('0x10')]=router; \ No newline at end of file +var _0x7846=['./variable.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x53f940,_0x1e4088){var _0x365769=function(_0x42439c){while(--_0x42439c){_0x53f940['push'](_0x53f940['shift']());}};_0x365769(++_0x1e4088);}(_0x7846,0xf4));var _0x6784=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0x7846[_0xa3c06b];return _0x33aa1d;};'use strict';var multer=require('multer');var util=require(_0x6784('0x0'));var path=require(_0x6784('0x1'));var timeout=require(_0x6784('0x2'));var express=require(_0x6784('0x3'));var router=express[_0x6784('0x4')]();var fs_extra=require(_0x6784('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6784('0x6'));var config=require(_0x6784('0x7'));var controller=require(_0x6784('0x8'));router[_0x6784('0x9')]('/',auth[_0x6784('0xa')](),controller[_0x6784('0xb')]);router[_0x6784('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6784('0xc')]);router[_0x6784('0xd')]('/',auth[_0x6784('0xa')](),controller[_0x6784('0xe')]);router[_0x6784('0xf')](_0x6784('0x10'),auth[_0x6784('0xa')](),controller[_0x6784('0x11')]);router[_0x6784('0x12')](_0x6784('0x10'),auth[_0x6784('0xa')](),controller[_0x6784('0x13')]);module[_0x6784('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index fe06d3b..46b8ec7 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 _0xb379=['sequelize','STRING','name'];(function(_0x3311f8,_0x47c8ab){var _0x42e6c1=function(_0x3915ac){while(--_0x3915ac){_0x3311f8['push'](_0x3311f8['shift']());}};_0x42e6c1(++_0x47c8ab);}(_0xb379,0x16b));var _0x9b37=function(_0x20cdce,_0x5cb26b){_0x20cdce=_0x20cdce-0x0;var _0x468bef=_0xb379[_0x20cdce];return _0x468bef;};'use strict';var Sequelize=require(_0x9b37('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b37('0x1')],'unique':_0x9b37('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9b37('0x1')]}}; \ No newline at end of file +var _0x4202=['exports','name','sequelize'];(function(_0x5308e9,_0xd01b46){var _0x1e509c=function(_0x1a362f){while(--_0x1a362f){_0x5308e9['push'](_0x5308e9['shift']());}};_0x1e509c(++_0xd01b46);}(_0x4202,0x8c));var _0x2420=function(_0x837006,_0x326159){_0x837006=_0x837006-0x0;var _0x4cf513=_0x4202[_0x837006];return _0x4cf513;};'use strict';var Sequelize=require(_0x2420('0x0'));module[_0x2420('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2420('0x2'),'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 f7d9b1c..59f6d24 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 _0x34c5=['Variable','includeAll','include','findAll','catch','params','fields','create','body','user','role','Variables','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0x34c5,0x1bb));var _0x534c=function(_0x455b5f,_0x4e978d){_0x455b5f=_0x455b5f-0x0;var _0x21bee7=_0x34c5[_0x455b5f];return _0x21bee7;};'use strict';var emlformat=require(_0x534c('0x0'));var rimraf=require(_0x534c('0x1'));var zipdir=require(_0x534c('0x2'));var jsonpatch=require(_0x534c('0x3'));var rp=require(_0x534c('0x4'));var moment=require(_0x534c('0x5'));var BPromise=require(_0x534c('0x6'));var Mustache=require(_0x534c('0x7'));var util=require('util');var path=require(_0x534c('0x8'));var sox=require(_0x534c('0x9'));var csv=require(_0x534c('0xa'));var ejs=require(_0x534c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x534c('0xc'));var squel=require('squel');var crypto=require(_0x534c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x534c('0xa'));var querystring=require(_0x534c('0xe'));var Papa=require('papaparse');var Redis=require(_0x534c('0xf'));var authService=require(_0x534c('0x10'));var qs=require(_0x534c('0x11'));var as=require(_0x534c('0x12'));var hardwareService=require(_0x534c('0x13'));var logger=require(_0x534c('0x14'))(_0x534c('0x15'));var utils=require(_0x534c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x534c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ade60,_0x2cfebb){_0x2cfebb=_0x2cfebb||0xcc;return function(_0x115054){if(_0x115054){return _0x4ade60['sendStatus'](_0x2cfebb);}return _0x4ade60['status'](_0x2cfebb)['end']();};}function respondWithResult(_0x2314b3,_0x116944){_0x116944=_0x116944||0xc8;return function(_0x4a35ff){if(_0x4a35ff){return _0x2314b3[_0x534c('0x18')](_0x116944)[_0x534c('0x19')](_0x4a35ff);}};}function respondWithFilteredResult(_0x442375,_0x9ce6db){return function(_0x6399a1){if(_0x6399a1){var _0x4aebbc=typeof _0x9ce6db[_0x534c('0x1a')]===_0x534c('0x1b')&&typeof _0x9ce6db['limit']===_0x534c('0x1b');var _0x4e55ea=_0x6399a1[_0x534c('0x1c')];var _0x16287c=_0x4aebbc?0x0:_0x9ce6db['offset'];var _0x377445=_0x4aebbc?_0x6399a1[_0x534c('0x1c')]:_0x9ce6db[_0x534c('0x1a')]+_0x9ce6db['limit'];var _0xfb89b8;if(_0x377445>=_0x4e55ea){_0x377445=_0x4e55ea;_0xfb89b8=0xc8;}else{_0xfb89b8=0xce;}_0x442375[_0x534c('0x18')](_0xfb89b8);return _0x442375[_0x534c('0x1d')](_0x534c('0x1e'),_0x16287c+'-'+_0x377445+'/'+_0x4e55ea)[_0x534c('0x19')](_0x6399a1);}return null;};}function patchUpdates(_0x52775b){return function(_0xe17b47){try{jsonpatch[_0x534c('0x1f')](_0xe17b47,_0x52775b,!![]);}catch(_0x13e9ce){return BPromise[_0x534c('0x20')](_0x13e9ce);}return _0xe17b47[_0x534c('0x21')]();};}function saveUpdates(_0x33e749,_0x436ac2){return function(_0x51d0ae){if(_0x51d0ae){return _0x51d0ae[_0x534c('0x22')](_0x33e749)['then'](function(_0x41cafe){return _0x41cafe;});}return null;};}function removeEntity(_0x17d4f3,_0x659fb3){return function(_0x1be740){if(_0x1be740){return _0x1be740[_0x534c('0x23')]()[_0x534c('0x24')](function(){var _0x256035=_0x1be740[_0x534c('0x25')]({'plain':!![]});var _0x16c064='Variables';return db['UserProfileResource'][_0x534c('0x23')]({'where':{'type':_0x16c064,'resourceId':_0x256035['id']}})[_0x534c('0x24')](function(){return _0x1be740;});})[_0x534c('0x24')](function(){_0x17d4f3[_0x534c('0x18')](0xcc)[_0x534c('0x26')]();});}};}function handleEntityNotFound(_0x2d6563,_0x302e11){return function(_0x589139){if(!_0x589139){_0x2d6563[_0x534c('0x27')](0x194);}return _0x589139;};}function handleError(_0x32b201,_0xea0bc1){_0xea0bc1=_0xea0bc1||0x1f4;return function(_0x370065){logger[_0x534c('0x28')](_0x370065[_0x534c('0x29')]);if(_0x370065['name']){delete _0x370065[_0x534c('0x2a')];}_0x32b201[_0x534c('0x18')](_0xea0bc1)[_0x534c('0x2b')](_0x370065);};}exports[_0x534c('0x2c')]=function(_0xc90b0e,_0x4c6834){var _0x3544e1={},_0x5c319c={},_0x4df275={'count':0x0,'rows':[]};var _0x5eb6b9=_[_0x534c('0x2d')](db['Variable'][_0x534c('0x2e')],function(_0x2534f0){return{'name':_0x2534f0[_0x534c('0x2f')],'type':_0x2534f0[_0x534c('0x30')]['key']};});_0x5c319c[_0x534c('0x31')]=_[_0x534c('0x2d')](_0x5eb6b9,_0x534c('0x2a'));_0x5c319c[_0x534c('0x32')]=_[_0x534c('0x33')](_0xc90b0e[_0x534c('0x32')]);_0x5c319c[_0x534c('0x34')]=_['intersection'](_0x5c319c[_0x534c('0x31')],_0x5c319c[_0x534c('0x32')]);_0x3544e1[_0x534c('0x35')]=_[_0x534c('0x36')](_0x5c319c[_0x534c('0x31')],qs['fields'](_0xc90b0e[_0x534c('0x32')]['fields']));_0x3544e1[_0x534c('0x35')]=_0x3544e1[_0x534c('0x35')][_0x534c('0x37')]?_0x3544e1[_0x534c('0x35')]:_0x5c319c['model'];if(!_0xc90b0e[_0x534c('0x32')][_0x534c('0x38')](_0x534c('0x39'))){_0x3544e1['limit']=qs[_0x534c('0x3a')](_0xc90b0e['query'][_0x534c('0x3a')]);_0x3544e1[_0x534c('0x1a')]=qs['offset'](_0xc90b0e[_0x534c('0x32')][_0x534c('0x1a')]);}_0x3544e1[_0x534c('0x3b')]=qs[_0x534c('0x3c')](_0xc90b0e[_0x534c('0x32')][_0x534c('0x3c')]);_0x3544e1[_0x534c('0x3d')]=qs['filters'](_[_0x534c('0x3e')](_0xc90b0e[_0x534c('0x32')],_0x5c319c[_0x534c('0x34')]),_0x5eb6b9);if(_0xc90b0e['query']['filter']){_0x3544e1[_0x534c('0x3d')]=_['merge'](_0x3544e1['where'],{'$or':_[_0x534c('0x2d')](_0x5eb6b9,function(_0x16357a){if(_0x16357a['type']!==_0x534c('0x3f')){var _0x30e29e={};_0x30e29e[_0x16357a[_0x534c('0x2a')]]={'$like':'%'+_0xc90b0e['query'][_0x534c('0x40')]+'%'};return _0x30e29e;}})});}_0x3544e1=_[_0x534c('0x41')]({},_0x3544e1,_0xc90b0e[_0x534c('0x42')]);var _0x582809={'where':_0x3544e1['where']};return db[_0x534c('0x43')][_0x534c('0x1c')](_0x582809)[_0x534c('0x24')](function(_0x1c5550){_0x4df275[_0x534c('0x1c')]=_0x1c5550;if(_0xc90b0e[_0x534c('0x32')][_0x534c('0x44')]){_0x3544e1[_0x534c('0x45')]=[{'all':!![]}];}return db[_0x534c('0x43')][_0x534c('0x46')](_0x3544e1);})[_0x534c('0x24')](function(_0x10f097){_0x4df275['rows']=_0x10f097;return _0x4df275;})['then'](respondWithFilteredResult(_0x4c6834,_0x3544e1))[_0x534c('0x47')](handleError(_0x4c6834,null));};exports['show']=function(_0x55fe3c,_0x2b7da6){var _0x11aa49={'raw':!![],'where':{'id':_0x55fe3c[_0x534c('0x48')]['id']}},_0x38bee8={};_0x38bee8[_0x534c('0x31')]=_['keys'](db[_0x534c('0x43')][_0x534c('0x2e')]);_0x38bee8[_0x534c('0x32')]=_[_0x534c('0x33')](_0x55fe3c['query']);_0x38bee8[_0x534c('0x34')]=_[_0x534c('0x36')](_0x38bee8[_0x534c('0x31')],_0x38bee8[_0x534c('0x32')]);_0x11aa49['attributes']=_[_0x534c('0x36')](_0x38bee8['model'],qs[_0x534c('0x49')](_0x55fe3c[_0x534c('0x32')][_0x534c('0x49')]));_0x11aa49[_0x534c('0x35')]=_0x11aa49[_0x534c('0x35')][_0x534c('0x37')]?_0x11aa49[_0x534c('0x35')]:_0x38bee8['model'];if(_0x55fe3c[_0x534c('0x32')][_0x534c('0x44')]){_0x11aa49[_0x534c('0x45')]=[{'all':!![]}];}_0x11aa49=_[_0x534c('0x41')]({},_0x11aa49,_0x55fe3c[_0x534c('0x42')]);return db[_0x534c('0x43')]['find'](_0x11aa49)[_0x534c('0x24')](handleEntityNotFound(_0x2b7da6,null))[_0x534c('0x24')](respondWithResult(_0x2b7da6,null))[_0x534c('0x47')](handleError(_0x2b7da6,null));};exports[_0x534c('0x4a')]=function(_0x1cb903,_0x77c098){return db[_0x534c('0x43')][_0x534c('0x4a')](_0x1cb903[_0x534c('0x4b')],{})[_0x534c('0x24')](function(_0x2a86e9){var _0x3855b6=_0x1cb903[_0x534c('0x4c')]['get']({'plain':!![]});if(!_0x3855b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3855b6[_0x534c('0x4d')]===_0x534c('0x4c')){var _0x41f6e5=_0x2a86e9[_0x534c('0x25')]({'plain':!![]});var _0x3fa2d3=_0x534c('0x4e');return db[_0x534c('0x4f')][_0x534c('0x50')]({'where':{'name':_0x3fa2d3,'userProfileId':_0x3855b6[_0x534c('0x51')]},'raw':!![]})[_0x534c('0x24')](function(_0x137e14){if(_0x137e14&&_0x137e14[_0x534c('0x52')]===0x0){return db[_0x534c('0x53')][_0x534c('0x4a')]({'name':_0x41f6e5[_0x534c('0x2a')],'resourceId':_0x41f6e5['id'],'type':_0x137e14[_0x534c('0x2a')],'sectionId':_0x137e14['id']},{})[_0x534c('0x24')](function(){return _0x2a86e9;});}else{return _0x2a86e9;}})[_0x534c('0x47')](function(_0x1f9721){logger['error'](_0x534c('0x54'),_0x1f9721);throw _0x1f9721;});}return _0x2a86e9;})[_0x534c('0x24')](respondWithResult(_0x77c098,0xc9))[_0x534c('0x47')](handleError(_0x77c098,null));};exports['update']=function(_0x2871e8,_0x4b1c91){if(_0x2871e8[_0x534c('0x4b')]['id']){delete _0x2871e8[_0x534c('0x4b')]['id'];}return db[_0x534c('0x43')][_0x534c('0x50')]({'where':{'id':_0x2871e8[_0x534c('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b1c91,null))['then'](saveUpdates(_0x2871e8[_0x534c('0x4b')],null))['then'](respondWithResult(_0x4b1c91,null))[_0x534c('0x47')](handleError(_0x4b1c91,null));};exports[_0x534c('0x23')]=function(_0xcf31f4,_0x2087e9){return db[_0x534c('0x43')][_0x534c('0x50')]({'where':{'id':_0xcf31f4[_0x534c('0x48')]['id']}})[_0x534c('0x24')](handleEntityNotFound(_0x2087e9,null))[_0x534c('0x24')](removeEntity(_0x2087e9,null))[_0x534c('0x47')](handleError(_0x2087e9,null));}; \ No newline at end of file +var _0x9802=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','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','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x9802,0x1c4));var _0x2980=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x9802[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x2980('0x0'));var rimraf=require(_0x2980('0x1'));var zipdir=require(_0x2980('0x2'));var jsonpatch=require(_0x2980('0x3'));var rp=require(_0x2980('0x4'));var moment=require(_0x2980('0x5'));var BPromise=require(_0x2980('0x6'));var Mustache=require('mustache');var util=require(_0x2980('0x7'));var path=require(_0x2980('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2980('0x9'));var fs=require('fs');var fs_extra=require(_0x2980('0xa'));var _=require(_0x2980('0xb'));var squel=require('squel');var crypto=require(_0x2980('0xc'));var jsforce=require(_0x2980('0xd'));var deskjs=require(_0x2980('0xe'));var toCsv=require(_0x2980('0xf'));var querystring=require('querystring');var Papa=require(_0x2980('0x10'));var Redis=require(_0x2980('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2980('0x12'));var as=require(_0x2980('0x13'));var hardwareService=require(_0x2980('0x14'));var logger=require(_0x2980('0x15'))(_0x2980('0x16'));var utils=require(_0x2980('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2980('0x18'));var db=require(_0x2980('0x19'))['db'];function respondWithStatusCode(_0xe46c3c,_0xae7b70){_0xae7b70=_0xae7b70||0xcc;return function(_0x41b0eb){if(_0x41b0eb){return _0xe46c3c[_0x2980('0x1a')](_0xae7b70);}return _0xe46c3c[_0x2980('0x1b')](_0xae7b70)[_0x2980('0x1c')]();};}function respondWithResult(_0x47633d,_0x2fa4a8){_0x2fa4a8=_0x2fa4a8||0xc8;return function(_0x25fac7){if(_0x25fac7){return _0x47633d['status'](_0x2fa4a8)[_0x2980('0x1d')](_0x25fac7);}};}function respondWithFilteredResult(_0x465b21,_0x6cbf53){return function(_0x18c030){if(_0x18c030){var _0x1b4246=typeof _0x6cbf53['offset']===_0x2980('0x1e')&&typeof _0x6cbf53[_0x2980('0x1f')]===_0x2980('0x1e');var _0x4811ca=_0x18c030[_0x2980('0x20')];var _0x54eb05=_0x1b4246?0x0:_0x6cbf53['offset'];var _0xb7247a=_0x1b4246?_0x18c030['count']:_0x6cbf53[_0x2980('0x21')]+_0x6cbf53['limit'];var _0x484574;if(_0xb7247a>=_0x4811ca){_0xb7247a=_0x4811ca;_0x484574=0xc8;}else{_0x484574=0xce;}_0x465b21['status'](_0x484574);return _0x465b21[_0x2980('0x22')]('Content-Range',_0x54eb05+'-'+_0xb7247a+'/'+_0x4811ca)[_0x2980('0x1d')](_0x18c030);}return null;};}function patchUpdates(_0x2fde8b){return function(_0x51e955){try{jsonpatch['apply'](_0x51e955,_0x2fde8b,!![]);}catch(_0x3efb1a){return BPromise[_0x2980('0x23')](_0x3efb1a);}return _0x51e955['save']();};}function saveUpdates(_0x1d377d,_0x575442){return function(_0x4f4b37){if(_0x4f4b37){return _0x4f4b37[_0x2980('0x24')](_0x1d377d)[_0x2980('0x25')](function(_0x18d0f6){return _0x18d0f6;});}return null;};}function removeEntity(_0x42b215,_0x5ca1fb){return function(_0x434bd8){if(_0x434bd8){return _0x434bd8[_0x2980('0x26')]()[_0x2980('0x25')](function(){var _0x548ed4=_0x434bd8[_0x2980('0x27')]({'plain':!![]});var _0x19b593=_0x2980('0x28');return db[_0x2980('0x29')][_0x2980('0x26')]({'where':{'type':_0x19b593,'resourceId':_0x548ed4['id']}})[_0x2980('0x25')](function(){return _0x434bd8;});})[_0x2980('0x25')](function(){_0x42b215[_0x2980('0x1b')](0xcc)[_0x2980('0x1c')]();});}};}function handleEntityNotFound(_0x27d3b6,_0x28dde9){return function(_0x2b33e8){if(!_0x2b33e8){_0x27d3b6['sendStatus'](0x194);}return _0x2b33e8;};}function handleError(_0x33659f,_0x125236){_0x125236=_0x125236||0x1f4;return function(_0x5a3467){logger[_0x2980('0x2a')](_0x5a3467[_0x2980('0x2b')]);if(_0x5a3467['name']){delete _0x5a3467[_0x2980('0x2c')];}_0x33659f[_0x2980('0x1b')](_0x125236)[_0x2980('0x2d')](_0x5a3467);};}exports[_0x2980('0x2e')]=function(_0x5777c3,_0x1905d9){var _0x229f53={},_0x488d31={},_0x7ab4cd={'count':0x0,'rows':[]};var _0x376611=_[_0x2980('0x2f')](db[_0x2980('0x30')][_0x2980('0x31')],function(_0x24a8a9){return{'name':_0x24a8a9[_0x2980('0x32')],'type':_0x24a8a9[_0x2980('0x33')][_0x2980('0x34')]};});_0x488d31[_0x2980('0x35')]=_['map'](_0x376611,_0x2980('0x2c'));_0x488d31[_0x2980('0x36')]=_[_0x2980('0x37')](_0x5777c3[_0x2980('0x36')]);_0x488d31[_0x2980('0x38')]=_[_0x2980('0x39')](_0x488d31[_0x2980('0x35')],_0x488d31['query']);_0x229f53[_0x2980('0x3a')]=_[_0x2980('0x39')](_0x488d31[_0x2980('0x35')],qs['fields'](_0x5777c3[_0x2980('0x36')][_0x2980('0x3b')]));_0x229f53[_0x2980('0x3a')]=_0x229f53[_0x2980('0x3a')]['length']?_0x229f53[_0x2980('0x3a')]:_0x488d31['model'];if(!_0x5777c3['query'][_0x2980('0x3c')]('nolimit')){_0x229f53['limit']=qs[_0x2980('0x1f')](_0x5777c3[_0x2980('0x36')][_0x2980('0x1f')]);_0x229f53[_0x2980('0x21')]=qs['offset'](_0x5777c3[_0x2980('0x36')][_0x2980('0x21')]);}_0x229f53[_0x2980('0x3d')]=qs[_0x2980('0x3e')](_0x5777c3['query'][_0x2980('0x3e')]);_0x229f53['where']=qs['filters'](_[_0x2980('0x3f')](_0x5777c3['query'],_0x488d31[_0x2980('0x38')]),_0x376611);if(_0x5777c3['query'][_0x2980('0x40')]){_0x229f53[_0x2980('0x41')]=_['merge'](_0x229f53[_0x2980('0x41')],{'$or':_[_0x2980('0x2f')](_0x376611,function(_0x5c3afa){if(_0x5c3afa['type']!==_0x2980('0x42')){var _0x2cdefc={};_0x2cdefc[_0x5c3afa['name']]={'$like':'%'+_0x5777c3[_0x2980('0x36')][_0x2980('0x40')]+'%'};return _0x2cdefc;}})});}_0x229f53=_[_0x2980('0x43')]({},_0x229f53,_0x5777c3[_0x2980('0x44')]);var _0x1d13c0={'where':_0x229f53[_0x2980('0x41')]};return db[_0x2980('0x30')]['count'](_0x1d13c0)[_0x2980('0x25')](function(_0x5ea229){_0x7ab4cd[_0x2980('0x20')]=_0x5ea229;if(_0x5777c3[_0x2980('0x36')][_0x2980('0x45')]){_0x229f53['include']=[{'all':!![]}];}return db[_0x2980('0x30')][_0x2980('0x46')](_0x229f53);})[_0x2980('0x25')](function(_0x4d8fe5){_0x7ab4cd[_0x2980('0x47')]=_0x4d8fe5;return _0x7ab4cd;})[_0x2980('0x25')](respondWithFilteredResult(_0x1905d9,_0x229f53))[_0x2980('0x48')](handleError(_0x1905d9,null));};exports['show']=function(_0x376fce,_0x401612){var _0x4f5bcc={'raw':!![],'where':{'id':_0x376fce[_0x2980('0x49')]['id']}},_0x2092e1={};_0x2092e1[_0x2980('0x35')]=_[_0x2980('0x37')](db[_0x2980('0x30')][_0x2980('0x31')]);_0x2092e1[_0x2980('0x36')]=_[_0x2980('0x37')](_0x376fce[_0x2980('0x36')]);_0x2092e1[_0x2980('0x38')]=_[_0x2980('0x39')](_0x2092e1[_0x2980('0x35')],_0x2092e1[_0x2980('0x36')]);_0x4f5bcc[_0x2980('0x3a')]=_[_0x2980('0x39')](_0x2092e1[_0x2980('0x35')],qs[_0x2980('0x3b')](_0x376fce[_0x2980('0x36')][_0x2980('0x3b')]));_0x4f5bcc[_0x2980('0x3a')]=_0x4f5bcc['attributes']['length']?_0x4f5bcc[_0x2980('0x3a')]:_0x2092e1[_0x2980('0x35')];if(_0x376fce['query'][_0x2980('0x45')]){_0x4f5bcc[_0x2980('0x4a')]=[{'all':!![]}];}_0x4f5bcc=_[_0x2980('0x43')]({},_0x4f5bcc,_0x376fce['options']);return db['Variable'][_0x2980('0x4b')](_0x4f5bcc)[_0x2980('0x25')](handleEntityNotFound(_0x401612,null))['then'](respondWithResult(_0x401612,null))[_0x2980('0x48')](handleError(_0x401612,null));};exports[_0x2980('0x4c')]=function(_0x183171,_0xf00464){return db['Variable'][_0x2980('0x4c')](_0x183171[_0x2980('0x4d')],{})[_0x2980('0x25')](function(_0x27bda1){var _0x441429=_0x183171[_0x2980('0x4e')]['get']({'plain':!![]});if(!_0x441429)throw new Error(_0x2980('0x4f'));if(_0x441429[_0x2980('0x50')]==='user'){var _0x14848=_0x27bda1['get']({'plain':!![]});var _0x464d37=_0x2980('0x28');return db[_0x2980('0x51')][_0x2980('0x4b')]({'where':{'name':_0x464d37,'userProfileId':_0x441429['userProfileId']},'raw':!![]})['then'](function(_0x926252){if(_0x926252&&_0x926252[_0x2980('0x52')]===0x0){return db[_0x2980('0x29')][_0x2980('0x4c')]({'name':_0x14848['name'],'resourceId':_0x14848['id'],'type':_0x926252['name'],'sectionId':_0x926252['id']},{})['then'](function(){return _0x27bda1;});}else{return _0x27bda1;}})[_0x2980('0x48')](function(_0x576d16){logger[_0x2980('0x2a')](_0x2980('0x53'),_0x576d16);throw _0x576d16;});}return _0x27bda1;})['then'](respondWithResult(_0xf00464,0xc9))['catch'](handleError(_0xf00464,null));};exports['update']=function(_0x315ae1,_0x2dafa0){if(_0x315ae1[_0x2980('0x4d')]['id']){delete _0x315ae1[_0x2980('0x4d')]['id'];}return db['Variable'][_0x2980('0x4b')]({'where':{'id':_0x315ae1['params']['id']}})[_0x2980('0x25')](handleEntityNotFound(_0x2dafa0,null))['then'](saveUpdates(_0x315ae1['body'],null))[_0x2980('0x25')](respondWithResult(_0x2dafa0,null))['catch'](handleError(_0x2dafa0,null));};exports[_0x2980('0x26')]=function(_0x3004a5,_0x4fdfb0){return db[_0x2980('0x30')]['find']({'where':{'id':_0x3004a5[_0x2980('0x49')]['id']}})['then'](handleEntityNotFound(_0x4fdfb0,null))[_0x2980('0x25')](removeEntity(_0x4fdfb0,null))[_0x2980('0x48')](handleError(_0x4fdfb0,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3a19efb..d557214 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 _0xd502=['../../config/environment','./variable.attributes','exports','define','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x3bf42b,_0x4b766c){var _0x261133=function(_0x490e48){while(--_0x490e48){_0x3bf42b['push'](_0x3bf42b['shift']());}};_0x261133(++_0x4b766c);}(_0xd502,0x1b2));var _0x2d50=function(_0x5820df,_0x24240a){_0x5820df=_0x5820df-0x0;var _0x7a47f1=_0xd502[_0x5820df];return _0x7a47f1;};'use strict';var _=require(_0x2d50('0x0'));var util=require(_0x2d50('0x1'));var logger=require(_0x2d50('0x2'))(_0x2d50('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d50('0x4'));var rimraf=require(_0x2d50('0x5'));var config=require(_0x2d50('0x6'));var attributes=require(_0x2d50('0x7'));module[_0x2d50('0x8')]=function(_0x158e93,_0x41c8b2){return _0x158e93[_0x2d50('0x9')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb841=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xb841,0x168));var _0x1b84=function(_0x60435f,_0x3286b6){_0x60435f=_0x60435f-0x0;var _0x5f4653=_0xb841[_0x60435f];return _0x5f4653;};'use strict';var _=require(_0x1b84('0x0'));var util=require(_0x1b84('0x1'));var logger=require(_0x1b84('0x2'))(_0x1b84('0x3'));var moment=require(_0x1b84('0x4'));var BPromise=require(_0x1b84('0x5'));var rp=require(_0x1b84('0x6'));var fs=require('fs');var path=require(_0x1b84('0x7'));var rimraf=require(_0x1b84('0x8'));var config=require(_0x1b84('0x9'));var attributes=require('./variable.attributes');module[_0x1b84('0xa')]=function(_0x1f1c71,_0x4ac748){return _0x1f1c71[_0x1b84('0xb')](_0x1b84('0xc'),attributes,{'tableName':_0x1b84('0xd'),'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 876b40b..cdfbd88 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 _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa41a,0x6b));var _0xaa41=function(_0x2138d5,_0x203cf9){_0x2138d5=_0x2138d5-0x0;var _0x26f39c=_0xa41a[_0x2138d5];return _0x26f39c;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file +var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x281e76,_0x8bde50){var _0x5ecce5=function(_0x2382bc){while(--_0x2382bc){_0x281e76['push'](_0x281e76['shift']());}};_0x5ecce5(++_0x8bde50);}(_0x3e74,0x175));var _0x43e7=function(_0x92f039,_0x19eac7){_0x92f039=_0x92f039-0x0;var _0x12475a=_0x3e74[_0x92f039];return _0x12475a;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index fb427e7..3acb9e7 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 _0xf8fd=['exports','express','Router','./version.controller','get','isAuthenticated','fetch','canUpdate','reset','/pull','pull','/restart','/migrations','migrations'];(function(_0x18419a,_0x3d5790){var _0x1f1ab2=function(_0x3002b4){while(--_0x3002b4){_0x18419a['push'](_0x18419a['shift']());}};_0x1f1ab2(++_0x3d5790);}(_0xf8fd,0x197));var _0xdf8f=function(_0x5e1858,_0xaeb272){_0x5e1858=_0x5e1858-0x0;var _0x4dd027=_0xf8fd[_0x5e1858];return _0x4dd027;};'use strict';var express=require(_0xdf8f('0x0'));var router=express[_0xdf8f('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xdf8f('0x2'));router[_0xdf8f('0x3')]('/',controller['index']);router[_0xdf8f('0x3')]('/fetch',auth[_0xdf8f('0x4')](),auth['canUpdate'](),controller[_0xdf8f('0x5')]);router[_0xdf8f('0x3')]('/reset',auth[_0xdf8f('0x4')](),auth[_0xdf8f('0x6')](),controller[_0xdf8f('0x7')]);router['get'](_0xdf8f('0x8'),auth[_0xdf8f('0x4')](),auth['canUpdate'](),controller[_0xdf8f('0x9')]);router[_0xdf8f('0x3')](_0xdf8f('0xa'),auth['isAuthenticated'](),controller['restart']);router[_0xdf8f('0x3')](_0xdf8f('0xb'),controller[_0xdf8f('0xc')]);module[_0xdf8f('0xd')]=router; \ No newline at end of file +var _0x8411=['pull','/restart','/migrations','exports','express','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x8411,0x18c));var _0x1841=function(_0x360c72,_0xfc7433){_0x360c72=_0x360c72-0x0;var _0x1bf3af=_0x8411[_0x360c72];return _0x1bf3af;};'use strict';var express=require(_0x1841('0x0'));var router=express['Router']();var auth=require(_0x1841('0x1'));var controller=require('./version.controller');router[_0x1841('0x2')]('/',controller[_0x1841('0x3')]);router[_0x1841('0x2')](_0x1841('0x4'),auth[_0x1841('0x5')](),auth[_0x1841('0x6')](),controller[_0x1841('0x7')]);router[_0x1841('0x2')](_0x1841('0x8'),auth[_0x1841('0x5')](),auth['canUpdate'](),controller['reset']);router['get'](_0x1841('0x9'),auth[_0x1841('0x5')](),auth[_0x1841('0x6')](),controller[_0x1841('0xa')]);router[_0x1841('0x2')](_0x1841('0xb'),auth[_0x1841('0x5')](),controller['restart']);router['get'](_0x1841('0xc'),controller['migrations']);module[_0x1841('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index f1a8986..f63ad5c 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 _0x391c=['constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','update','simple-git','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','origin','info','git\x20fetch','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','.js','push','sort','sequelize','Migration'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0x391c,0x196));var _0xc391=function(_0x107ab0,_0x37df6c){_0x107ab0=_0x107ab0-0x0;var _0x439ed6=_0x391c[_0x107ab0];return _0x439ed6;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0xc391('0x0'));var pkginfo=require(_0xc391('0x1'))(module,_0xc391('0x2'));var compareVersions=require(_0xc391('0x3'));var exec=require(_0xc391('0x4'))[_0xc391('0x5')];var db=require(_0xc391('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0xc391('0x7'));var logger=require('../../config/logger')(_0xc391('0x8'));var git=require(_0xc391('0x9'))(config[_0xc391('0xa')]);exports[_0xc391('0xb')]=function(_0x3d051e,_0x3eb15d){var _0x163c31={'current':module[_0xc391('0xc')][_0xc391('0x2')],'phonebar':0x2};if(_0x3d051e[_0xc391('0xd')]&&_0x3d051e[_0xc391('0xd')][_0xc391('0xe')]){return git['fetch']()[_0xc391('0xf')](function(_0xd0484e,_0x4c89fa){_0x163c31[_0xc391('0xe')]=(_0xd0484e?module[_0xc391('0xc')]['version']:_0x4c89fa[_0xc391('0xe')])||_0xc391('0x10');return _0x3eb15d[_0xc391('0x11')](0xc8)['json'](_0x163c31);});}else{return _0x3eb15d[_0xc391('0x11')](0xc8)[_0xc391('0x12')](_0x163c31);}};exports[_0xc391('0x13')]=function(_0x1a9d6d,_0x394782){return git[_0xc391('0x13')]([_0xc391('0x14'),'master'],function(_0x20f7c6){if(_0x20f7c6){logger['error'](_0x20f7c6);return _0x394782['status'](0x1f4)['json'](_0x20f7c6);}logger[_0xc391('0x15')](_0xc391('0x16'));return _0x394782[_0xc391('0x11')](0xc8)[_0xc391('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xc391('0x17')]=function(_0x3dccca,_0x51a3f2){return git[_0xc391('0x17')]([_0xc391('0x18'),'FETCH_HEAD'],function(_0x2807b1){if(_0x2807b1){logger[_0xc391('0x19')](_0x2807b1);return _0x51a3f2[_0xc391('0x11')](0x1f4)[_0xc391('0x12')](_0x2807b1);}logger['info'](_0xc391('0x1a'));return _0x51a3f2['status'](0xc8)[_0xc391('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0xc391('0x1b')]=function(_0x41c814,_0x524ac6){exec(_0xc391('0x1c'),function(_0x1ac7ca,_0x2f1649,_0x29ed97){logger['info'](_0x2f1649);logger['info'](_0x29ed97);if(_0x1ac7ca){logger['error'](_0x1ac7ca);return _0x524ac6[_0xc391('0x11')](0x1f4)[_0xc391('0x12')](_0x1ac7ca);}return _0x524ac6[_0xc391('0x11')](0xc8)['json']({'output':_0x2f1649});});};exports['restart']=function(_0x21b1a4,_0x13b5a8){return pm2[_0xc391('0x1d')]('motion2')[_0xc391('0x1e')](function(_0x1985b2){logger[_0xc391('0x15')](_0xc391('0x1f'),_0x1985b2);return _0x13b5a8[_0xc391('0x11')](0xc8)[_0xc391('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xc391('0x20')](function(_0xce6729){logger['error'](_0xce6729);return _0x13b5a8[_0xc391('0x11')](0x1f4)['json'](_0xce6729);});};exports[_0xc391('0x21')]=function(_0x380f13,_0x4b83c2){var _0x348b65=fs[_0xc391('0x22')](path[_0xc391('0x23')](config[_0xc391('0xa')],_0xc391('0x24'),_0xc391('0x21')));var _0xfa2e3e=[];for(var _0x30f5a8=0x0;_0x30f5a8<_0x348b65[_0xc391('0x25')];_0x30f5a8++){var _0x36e1f2=_0x348b65[_0x30f5a8][_0xc391('0x26')](_0xc391('0x27'),'');if(compareVersions(module[_0xc391('0xc')][_0xc391('0x2')],_0x36e1f2)===-0x1){_0xfa2e3e[_0xc391('0x28')](_0x36e1f2);}}if(_0xfa2e3e[_0xc391('0x25')]){var _0x4cc93b=_0xfa2e3e[_0xc391('0x29')](compareVersions);var _0x2f559b=new Umzug({'storage':_0xc391('0x2a'),'storageOptions':{'model':db[_0xc391('0x2b')],'modelName':_0xc391('0x2b'),'columnName':_0xc391('0x2')},'migrations':{'params':[db[_0xc391('0x2a')]['getQueryInterface'](),db['sequelize'][_0xc391('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xc391('0x23')](config[_0xc391('0xa')],_0xc391('0x24'),_0xc391('0x21')),'pattern':/\.js$/}});_0x2f559b['up']({'migrations':_[_0xc391('0x2d')](_0x4cc93b,function(_0x13c950){return _0x13c950+'.js';})})['then'](function(){return _0x4b83c2[_0xc391('0x11')](0xc8)[_0xc391('0x12')]({'output':_0xc391('0x2e')+module[_0xc391('0xc')][_0xc391('0x2')]+_0xc391('0x2f')+_[_0xc391('0x30')](_0x4cc93b),'migrations':_['join'](_0x4cc93b)});})[_0xc391('0x20')](function(_0x4f5a42){if(_0x4f5a42 instanceof db[_0xc391('0x2a')]['UniqueConstraintError']){return _0x4b83c2[_0xc391('0x11')](0xc8)[_0xc391('0x12')]({'output':_0xc391('0x31')});}else{return _0x4b83c2[_0xc391('0x11')](0x1f4)[_0xc391('0x12')](_0x4f5a42);}});}else{return _0x4b83c2['status'](0xc8)['json']({'output':_0xc391('0x31')});}}; \ No newline at end of file +var _0x4e08=['lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','tags','latest','2.0.0','status','json','fetch','origin','error','info','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','.js','push','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e08,0x13c));var _0x84e0=function(_0x2b0927,_0x2a4d9d){_0x2b0927=_0x2b0927-0x0;var _0x5a39c7=_0x4e08[_0x2b0927];return _0x5a39c7;};'use strict';var Umzug=require(_0x84e0('0x0'));var path=require(_0x84e0('0x1'));var fs=require('fs');var _=require(_0x84e0('0x2'));var pkginfo=require('pkginfo')(module,_0x84e0('0x3'));var compareVersions=require(_0x84e0('0x4'));var exec=require(_0x84e0('0x5'))[_0x84e0('0x6')];var db=require(_0x84e0('0x7'))['db'];var config=require(_0x84e0('0x8'));var pm2=require(_0x84e0('0x9'));var logger=require(_0x84e0('0xa'))('update');var git=require(_0x84e0('0xb'))(config[_0x84e0('0xc')]);exports[_0x84e0('0xd')]=function(_0x40c716,_0x2656bc){var _0x4eb287={'current':module[_0x84e0('0xe')]['version'],'phonebar':0x2};if(_0x40c716[_0x84e0('0xf')]&&_0x40c716[_0x84e0('0xf')]['latest']){return git['fetch']()[_0x84e0('0x10')](function(_0x11b9f9,_0x5f4467){_0x4eb287[_0x84e0('0x11')]=(_0x11b9f9?module[_0x84e0('0xe')][_0x84e0('0x3')]:_0x5f4467[_0x84e0('0x11')])||_0x84e0('0x12');return _0x2656bc[_0x84e0('0x13')](0xc8)['json'](_0x4eb287);});}else{return _0x2656bc[_0x84e0('0x13')](0xc8)[_0x84e0('0x14')](_0x4eb287);}};exports[_0x84e0('0x15')]=function(_0x2a253d,_0xec9bc4){return git[_0x84e0('0x15')]([_0x84e0('0x16'),'master'],function(_0x2b7809){if(_0x2b7809){logger[_0x84e0('0x17')](_0x2b7809);return _0xec9bc4[_0x84e0('0x13')](0x1f4)[_0x84e0('0x14')](_0x2b7809);}logger[_0x84e0('0x18')]('git\x20fetch');return _0xec9bc4[_0x84e0('0x13')](0xc8)[_0x84e0('0x14')]({'output':_0x84e0('0x19')});});};exports[_0x84e0('0x1a')]=function(_0x35fdc2,_0x58a66d){return git['reset'](['--hard',_0x84e0('0x1b')],function(_0x2dbb6a){if(_0x2dbb6a){logger[_0x84e0('0x17')](_0x2dbb6a);return _0x58a66d['status'](0x1f4)[_0x84e0('0x14')](_0x2dbb6a);}logger[_0x84e0('0x18')](_0x84e0('0x1c'));return _0x58a66d['status'](0xc8)[_0x84e0('0x14')]({'output':_0x84e0('0x1d')});});};exports[_0x84e0('0x1e')]=function(_0x1b1966,_0x5ec9eb){exec(_0x84e0('0x1f'),function(_0xcebe91,_0x59ce4d,_0x2cc3f4){logger[_0x84e0('0x18')](_0x59ce4d);logger[_0x84e0('0x18')](_0x2cc3f4);if(_0xcebe91){logger[_0x84e0('0x17')](_0xcebe91);return _0x5ec9eb[_0x84e0('0x13')](0x1f4)['json'](_0xcebe91);}return _0x5ec9eb[_0x84e0('0x13')](0xc8)['json']({'output':_0x59ce4d});});};exports[_0x84e0('0x20')]=function(_0x117760,_0x31befb){return pm2[_0x84e0('0x20')](_0x84e0('0x21'))['then'](function(_0x31ca54){logger['info'](_0x84e0('0x22'),_0x31ca54);return _0x31befb[_0x84e0('0x13')](0xc8)[_0x84e0('0x14')]({'output':_0x84e0('0x23')});})[_0x84e0('0x24')](function(_0x16ce6d){logger[_0x84e0('0x17')](_0x16ce6d);return _0x31befb['status'](0x1f4)[_0x84e0('0x14')](_0x16ce6d);});};exports[_0x84e0('0x25')]=function(_0x9ffdd2,_0x5e35a2){var _0x2770cd=fs[_0x84e0('0x26')](path[_0x84e0('0x27')](config['root'],'server','migrations'));var _0x3e09c2=[];for(var _0xd06901=0x0;_0xd06901<_0x2770cd[_0x84e0('0x28')];_0xd06901++){var _0xd5ccd2=_0x2770cd[_0xd06901]['replace'](_0x84e0('0x29'),'');if(compareVersions(module[_0x84e0('0xe')][_0x84e0('0x3')],_0xd5ccd2)===-0x1){_0x3e09c2[_0x84e0('0x2a')](_0xd5ccd2);}}if(_0x3e09c2[_0x84e0('0x28')]){var _0xb84c8e=_0x3e09c2[_0x84e0('0x2b')](compareVersions);var _0x2b3e27=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x84e0('0x2c')],'modelName':_0x84e0('0x2c'),'columnName':_0x84e0('0x3')},'migrations':{'params':[db[_0x84e0('0x2d')][_0x84e0('0x2e')](),db[_0x84e0('0x2d')]['constructor'],function(){throw new Error(_0x84e0('0x2f'));}],'path':path[_0x84e0('0x27')](config['root'],_0x84e0('0x30'),'migrations'),'pattern':/\.js$/}});_0x2b3e27['up']({'migrations':_[_0x84e0('0x31')](_0xb84c8e,function(_0x5f36ad){return _0x5f36ad+_0x84e0('0x29');})})['then'](function(){return _0x5e35a2[_0x84e0('0x13')](0xc8)[_0x84e0('0x14')]({'output':_0x84e0('0x32')+module[_0x84e0('0xe')]['version']+_0x84e0('0x33')+_['last'](_0xb84c8e),'migrations':_[_0x84e0('0x27')](_0xb84c8e)});})[_0x84e0('0x24')](function(_0x304527){if(_0x304527 instanceof db[_0x84e0('0x2d')]['UniqueConstraintError']){return _0x5e35a2['status'](0xc8)[_0x84e0('0x14')]({'output':_0x84e0('0x34')});}else{return _0x5e35a2['status'](0x1f4)[_0x84e0('0x14')](_0x304527);}});}else{return _0x5e35a2['status'](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 20eb16a..2edd805 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 _0x394e=['index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x394e,0x1c3));var _0xe394=function(_0x2de84b,_0x32bd82){_0x2de84b=_0x2de84b-0x0;var _0x3d5943=_0x394e[_0x2de84b];return _0x3d5943;};'use strict';var multer=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var path=require(_0xe394('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe394('0x3')]();var fs_extra=require(_0xe394('0x4'));var auth=require(_0xe394('0x5'));var interaction=require(_0xe394('0x6'));var config=require(_0xe394('0x7'));var controller=require(_0xe394('0x8'));router[_0xe394('0x9')]('/',auth[_0xe394('0xa')](),controller[_0xe394('0xb')]);router[_0xe394('0x9')](_0xe394('0xc'),auth[_0xe394('0xa')](),controller[_0xe394('0xd')]);router[_0xe394('0x9')](_0xe394('0xe'),auth[_0xe394('0xa')](),controller[_0xe394('0xf')]);router[_0xe394('0x10')]('/',auth[_0xe394('0xa')](),controller['create']);router[_0xe394('0x11')](_0xe394('0xe'),auth[_0xe394('0xa')](),controller[_0xe394('0x12')]);router[_0xe394('0x13')](_0xe394('0xe'),auth[_0xe394('0xa')](),controller['destroy']);module[_0xe394('0x14')]=router; \ No newline at end of file +var _0x0344=['express','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x5bca87,_0x4ba510){var _0x172665=function(_0x151a09){while(--_0x151a09){_0x5bca87['push'](_0x5bca87['shift']());}};_0x172665(++_0x4ba510);}(_0x0344,0x1b5));var _0x4034=function(_0x138a0e,_0x5c4a7a){_0x138a0e=_0x138a0e-0x0;var _0xba2741=_0x0344[_0x138a0e];return _0xba2741;};'use strict';var multer=require(_0x4034('0x0'));var util=require('util');var path=require(_0x4034('0x1'));var timeout=require(_0x4034('0x2'));var express=require(_0x4034('0x3'));var router=express['Router']();var fs_extra=require(_0x4034('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4034('0x5'));var config=require(_0x4034('0x6'));var controller=require(_0x4034('0x7'));router[_0x4034('0x8')]('/',auth[_0x4034('0x9')](),controller['index']);router[_0x4034('0x8')](_0x4034('0xa'),auth[_0x4034('0x9')](),controller[_0x4034('0xb')]);router[_0x4034('0x8')](_0x4034('0xc'),auth['isAuthenticated'](),controller[_0x4034('0xd')]);router[_0x4034('0xe')]('/',auth['isAuthenticated'](),controller[_0x4034('0xf')]);router[_0x4034('0x10')](_0x4034('0xc'),auth['isAuthenticated'](),controller[_0x4034('0x11')]);router['delete'](_0x4034('0xc'),auth[_0x4034('0x9')](),controller[_0x4034('0x12')]);module[_0x4034('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7f24f90..759853e 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 _0xdeb3=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE'];(function(_0x2c2244,_0x197be1){var _0x1e3b27=function(_0x2b8e83){while(--_0x2b8e83){_0x2c2244['push'](_0x2c2244['shift']());}};_0x1e3b27(++_0x197be1);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0x3deb('0x0')]={'type':{'type':Sequelize[_0x3deb('0x1')]},'uniqueid':{'type':Sequelize[_0x3deb('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3deb('0x1')]},'interface':{'type':Sequelize[_0x3deb('0x1')]},'membername':{'type':Sequelize[_0x3deb('0x1')]},'agentcalledAt':{'type':Sequelize[_0x3deb('0x2')]},'agentconnectAt':{'type':Sequelize[_0x3deb('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x3deb('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x3deb('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3deb('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x3deb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3deb('0x3')]},'agentacw':{'type':Sequelize[_0x3deb('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3deb('0x3')]},'reason':{'type':Sequelize[_0x3deb('0x1')]},'lastevent':{'type':Sequelize[_0x3deb('0x1')]},'channel':{'type':Sequelize[_0x3deb('0x1')]},'channelstate':{'type':Sequelize[_0x3deb('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3deb('0x1')]},'language':{'type':Sequelize[_0x3deb('0x1')]},'accountcode':{'type':Sequelize[_0x3deb('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3deb('0x1')]},'priority':{'type':Sequelize[_0x3deb('0x1')]},'destchannel':{'type':Sequelize[_0x3deb('0x1')]},'destchannelstate':{'type':Sequelize[_0x3deb('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3deb('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3deb('0x1')]},'destlanguage':{'type':Sequelize[_0x3deb('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x3deb('0x1')]},'destexten':{'type':Sequelize[_0x3deb('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x3deb('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3deb('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x3deb('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x3deb('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x3deb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfef3=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x1c7e32,_0x3cb8de){var _0x4b5d6d=function(_0x2e76b4){while(--_0x2e76b4){_0x1c7e32['push'](_0x1c7e32['shift']());}};_0x4b5d6d(++_0x3cb8de);}(_0xfef3,0x118));var _0x3fef=function(_0x514c5e,_0x8c0875){_0x514c5e=_0x514c5e-0x0;var _0x34c3e6=_0xfef3[_0x514c5e];return _0x34c3e6;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'type':{'type':Sequelize[_0x3fef('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3fef('0x1')]},'calleridname':{'type':Sequelize[_0x3fef('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3fef('0x1')]},'membername':{'type':Sequelize[_0x3fef('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x3fef('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x3fef('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x3fef('0x2')]},'holdtime':{'type':Sequelize[_0x3fef('0x3')]},'agentcomplete':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3fef('0x3')]},'agentacw':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3fef('0x3')]},'reason':{'type':Sequelize[_0x3fef('0x1')]},'lastevent':{'type':Sequelize[_0x3fef('0x1')]},'channel':{'type':Sequelize[_0x3fef('0x1')]},'channelstate':{'type':Sequelize[_0x3fef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x3fef('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3fef('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3fef('0x1')]},'accountcode':{'type':Sequelize[_0x3fef('0x1')]},'context':{'type':Sequelize[_0x3fef('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3fef('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x3fef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3fef('0x1')]},'destcalleridnum':{'type':Sequelize[_0x3fef('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3fef('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x3fef('0x1')]},'destaccountcode':{'type':Sequelize[_0x3fef('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3fef('0x1')]},'destpriority':{'type':Sequelize[_0x3fef('0x1')]},'destuniqueid':{'type':Sequelize[_0x3fef('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3fef('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x3fef('0x1')]},'transfer':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x3fef('0x5')},'transferexten':{'type':Sequelize[_0x3fef('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3fef('0x1')]},'agententerreason':{'type':Sequelize[_0x3fef('0x3')],'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 78c23d2..58b517b 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(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 e7a2475..e1f2a15 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 _0xdcc4=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xdcc4,0xea));var _0x4dcc=function(_0x15a957,_0x124084){_0x15a957=_0x15a957-0x0;var _0x15264e=_0xdcc4[_0x15a957];return _0x15264e;};'use strict';var _=require(_0x4dcc('0x0'));var util=require(_0x4dcc('0x1'));var logger=require(_0x4dcc('0x2'))(_0x4dcc('0x3'));var moment=require(_0x4dcc('0x4'));var BPromise=require('bluebird');var rp=require(_0x4dcc('0x5'));var fs=require('fs');var path=require(_0x4dcc('0x6'));var rimraf=require(_0x4dcc('0x7'));var config=require(_0x4dcc('0x8'));var attributes=require(_0x4dcc('0x9'));module[_0x4dcc('0xa')]=function(_0x5ce6e6,_0x1f8ef7){return _0x5ce6e6['define'](_0x4dcc('0xb'),attributes,{'tableName':_0x4dcc('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4dcc('0xd'),_0x4dcc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39d9=['path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5f4ee9,_0x11aeef){var _0x4ce122=function(_0x3ca424){while(--_0x3ca424){_0x5f4ee9['push'](_0x5f4ee9['shift']());}};_0x4ce122(++_0x11aeef);}(_0x39d9,0x17f));var _0x939d=function(_0x2eaa3d,_0x4d0dce){_0x2eaa3d=_0x2eaa3d-0x0;var _0x25314d=_0x39d9[_0x2eaa3d];return _0x25314d;};'use strict';var _=require(_0x939d('0x0'));var util=require(_0x939d('0x1'));var logger=require(_0x939d('0x2'))(_0x939d('0x3'));var moment=require(_0x939d('0x4'));var BPromise=require(_0x939d('0x5'));var rp=require(_0x939d('0x6'));var fs=require('fs');var path=require(_0x939d('0x7'));var rimraf=require('rimraf');var config=require(_0x939d('0x8'));var attributes=require(_0x939d('0x9'));module[_0x939d('0xa')]=function(_0x48b22f,_0x41c89f){return _0x48b22f['define'](_0x939d('0xb'),attributes,{'tableName':_0x939d('0xc'),'paranoid':![],'indexes':[{'fields':[_0x939d('0xd'),_0x939d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 3223550..c9d8a02 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 _0xe8d1=['../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','debug','update','where','attributes','limit','UpdateVoiceAgentReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3c7f1f,_0x234583){var _0x33ee9c=function(_0x5a6c2a){while(--_0x5a6c2a){_0x3c7f1f['push'](_0x3c7f1f['shift']());}};_0x33ee9c(++_0x234583);}(_0xe8d1,0x1d8));var _0x1e8d=function(_0x5206fc,_0x2eec61){_0x5206fc=_0x5206fc-0x0;var _0x12acf6=_0xe8d1[_0x5206fc];return _0x12acf6;};'use strict';var _=require(_0x1e8d('0x0'));var util=require(_0x1e8d('0x1'));var moment=require(_0x1e8d('0x2'));var BPromise=require(_0x1e8d('0x3'));var rs=require(_0x1e8d('0x4'));var fs=require('fs');var Redis=require(_0x1e8d('0x5'));var db=require(_0x1e8d('0x6'))['db'];var utils=require(_0x1e8d('0x7'));var logger=require(_0x1e8d('0x8'))('rpc');var config=require(_0x1e8d('0x9'));var jayson=require(_0x1e8d('0xa'));var client=jayson[_0x1e8d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229074,_0x9187f4,_0x1e98ac){return new BPromise(function(_0x503fa7,_0x424945){return client['request'](_0x229074,_0x1e98ac)[_0x1e8d('0xc')](function(_0x2bcd45){logger[_0x1e8d('0xd')](_0x1e8d('0xe'),_0x9187f4,_0x1e8d('0xf'));logger['debug'](_0x1e8d('0x10'),_0x9187f4,_0x1e8d('0xf'),JSON[_0x1e8d('0x11')](_0x2bcd45));if(_0x2bcd45['error']){if(_0x2bcd45['error']['code']===0x1f4){logger[_0x1e8d('0x12')](_0x1e8d('0xe'),_0x9187f4,_0x2bcd45[_0x1e8d('0x12')][_0x1e8d('0x13')]);return _0x424945(_0x2bcd45[_0x1e8d('0x12')][_0x1e8d('0x13')]);}logger[_0x1e8d('0x12')](_0x1e8d('0xe'),_0x9187f4,_0x2bcd45['error']['message']);return _0x503fa7(_0x2bcd45['error'][_0x1e8d('0x13')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x9187f4,_0x1e8d('0xf'));_0x503fa7(_0x2bcd45['result']['message']);}})['catch'](function(_0x2dc3c0){logger[_0x1e8d('0x12')](_0x1e8d('0xe'),_0x9187f4,_0x2dc3c0);_0x424945(_0x2dc3c0);});});}exports[_0x1e8d('0x14')]=function(_0x532859){var _0x3cd904=this;return new Promise(function(_0x2800d9,_0x5a851f){return db[_0x1e8d('0x15')]['create'](_0x532859[_0x1e8d('0x16')],{'raw':_0x532859[_0x1e8d('0x17')]?_0x532859[_0x1e8d('0x17')][_0x1e8d('0x18')]===undefined?!![]:![]:!![]})[_0x1e8d('0xc')](function(_0x1d5702){logger[_0x1e8d('0xd')](_0x1e8d('0x14'),_0x532859);logger[_0x1e8d('0x19')]('CreateVoiceAgentReport',_0x532859,JSON[_0x1e8d('0x11')](_0x1d5702));_0x2800d9(_0x1d5702);})['catch'](function(_0x129e39){logger[_0x1e8d('0x12')]('CreateVoiceAgentReport',_0x129e39[_0x1e8d('0x13')],_0x532859);_0x5a851f(_0x3cd904[_0x1e8d('0x12')](0x1f4,_0x129e39[_0x1e8d('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x146775){var _0x23ba67=this;return new Promise(function(_0x589eba,_0x2a0211){return db['VoiceAgentReport'][_0x1e8d('0x1a')](_0x146775[_0x1e8d('0x16')],{'raw':_0x146775[_0x1e8d('0x17')]?_0x146775[_0x1e8d('0x17')][_0x1e8d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x146775[_0x1e8d('0x17')]?_0x146775['options'][_0x1e8d('0x1b')]||null:null,'attributes':_0x146775['options']?_0x146775[_0x1e8d('0x17')][_0x1e8d('0x1c')]||null:null,'limit':_0x146775['options']?_0x146775['options'][_0x1e8d('0x1d')]||null:null})[_0x1e8d('0xc')](function(_0x5dae99){logger[_0x1e8d('0xd')](_0x1e8d('0x1e'),_0x146775);logger['debug']('UpdateVoiceAgentReport',_0x146775,JSON[_0x1e8d('0x11')](_0x5dae99));_0x589eba(_0x5dae99);})[_0x1e8d('0x1f')](function(_0x6032ab){logger[_0x1e8d('0x12')](_0x1e8d('0x1e'),_0x6032ab['message'],_0x146775);_0x2a0211(_0x23ba67[_0x1e8d('0x12')](0x1f4,_0x6032ab[_0x1e8d('0x13')]));});});}; \ No newline at end of file +var _0x9c3a=['rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','body','options','raw','VoiceAgentReport','update','where','limit','then','UpdateVoiceAgentReport','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x293a6b,_0x3b9ede){var _0x2d371c=function(_0x2b115a){while(--_0x2b115a){_0x293a6b['push'](_0x293a6b['shift']());}};_0x2d371c(++_0x3b9ede);}(_0x9c3a,0x7e));var _0xa9c3=function(_0x101206,_0x50b46c){_0x101206=_0x101206-0x0;var _0xf506e=_0x9c3a[_0x101206];return _0xf506e;};'use strict';var _=require(_0xa9c3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa9c3('0x1'));var rs=require(_0xa9c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9c3('0x3'))['db'];var utils=require(_0xa9c3('0x4'));var logger=require(_0xa9c3('0x5'))(_0xa9c3('0x6'));var config=require(_0xa9c3('0x7'));var jayson=require(_0xa9c3('0x8'));var client=jayson[_0xa9c3('0x9')][_0xa9c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x344c4d,_0x2fba1d,_0x5aca0b){return new BPromise(function(_0x4f6beb,_0x54ba72){return client[_0xa9c3('0xb')](_0x344c4d,_0x5aca0b)['then'](function(_0x1b846d){logger[_0xa9c3('0xc')](_0xa9c3('0xd'),_0x2fba1d,_0xa9c3('0xe'));logger[_0xa9c3('0xf')](_0xa9c3('0x10'),_0x2fba1d,_0xa9c3('0xe'),JSON[_0xa9c3('0x11')](_0x1b846d));if(_0x1b846d[_0xa9c3('0x12')]){if(_0x1b846d[_0xa9c3('0x12')][_0xa9c3('0x13')]===0x1f4){logger[_0xa9c3('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x2fba1d,_0x1b846d['error'][_0xa9c3('0x14')]);return _0x54ba72(_0x1b846d[_0xa9c3('0x12')][_0xa9c3('0x14')]);}logger[_0xa9c3('0x12')](_0xa9c3('0xd'),_0x2fba1d,_0x1b846d[_0xa9c3('0x12')][_0xa9c3('0x14')]);return _0x4f6beb(_0x1b846d['error'][_0xa9c3('0x14')]);}else{logger['info'](_0xa9c3('0xd'),_0x2fba1d,_0xa9c3('0xe'));_0x4f6beb(_0x1b846d[_0xa9c3('0x15')][_0xa9c3('0x14')]);}})[_0xa9c3('0x16')](function(_0x54b6ec){logger[_0xa9c3('0x12')](_0xa9c3('0xd'),_0x2fba1d,_0x54b6ec);_0x54ba72(_0x54b6ec);});});}exports[_0xa9c3('0x17')]=function(_0x9e44cc){var _0x759a6d=this;return new Promise(function(_0x409edf,_0x5e11d4){return db['VoiceAgentReport']['create'](_0x9e44cc[_0xa9c3('0x18')],{'raw':_0x9e44cc['options']?_0x9e44cc[_0xa9c3('0x19')][_0xa9c3('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1359f1){logger['info'](_0xa9c3('0x17'),_0x9e44cc);logger['debug']('CreateVoiceAgentReport',_0x9e44cc,JSON[_0xa9c3('0x11')](_0x1359f1));_0x409edf(_0x1359f1);})[_0xa9c3('0x16')](function(_0x3bdc7d){logger[_0xa9c3('0x12')]('CreateVoiceAgentReport',_0x3bdc7d[_0xa9c3('0x14')],_0x9e44cc);_0x5e11d4(_0x759a6d['error'](0x1f4,_0x3bdc7d[_0xa9c3('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x493c14){var _0x3fb064=this;return new Promise(function(_0x4bb6a4,_0x2e6f52){return db[_0xa9c3('0x1b')][_0xa9c3('0x1c')](_0x493c14[_0xa9c3('0x18')],{'raw':_0x493c14[_0xa9c3('0x19')]?_0x493c14['options'][_0xa9c3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493c14[_0xa9c3('0x19')]?_0x493c14[_0xa9c3('0x19')][_0xa9c3('0x1d')]||null:null,'attributes':_0x493c14['options']?_0x493c14[_0xa9c3('0x19')]['attributes']||null:null,'limit':_0x493c14[_0xa9c3('0x19')]?_0x493c14[_0xa9c3('0x19')][_0xa9c3('0x1e')]||null:null})[_0xa9c3('0x1f')](function(_0x5f2b1b){logger[_0xa9c3('0xc')]('UpdateVoiceAgentReport',_0x493c14);logger[_0xa9c3('0xf')](_0xa9c3('0x20'),_0x493c14,JSON[_0xa9c3('0x11')](_0x5f2b1b));_0x4bb6a4(_0x5f2b1b);})[_0xa9c3('0x16')](function(_0x499eb1){logger[_0xa9c3('0x12')]('UpdateVoiceAgentReport',_0x499eb1[_0xa9c3('0x14')],_0x493c14);_0x2e6f52(_0x3fb064[_0xa9c3('0x12')](0x1f4,_0x499eb1[_0xa9c3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 56bf5ea..c1d4578 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 _0x277c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x277c,0x153));var _0xc277=function(_0x554722,_0x355b91){_0x554722=_0x554722-0x0;var _0xfab058=_0x277c[_0x554722];return _0xfab058;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/describe',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['get'](_0xc277('0xc'),auth[_0xc277('0x9')](),controller[_0xc277('0xd')]);router[_0xc277('0xe')]('/',auth[_0xc277('0x9')](),controller[_0xc277('0xf')]);router['put']('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);router[_0xc277('0x11')](_0xc277('0xc'),auth['isAuthenticated'](),controller[_0xc277('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3eea=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1238be,_0x230070){var _0x3a272f=function(_0x2cbf14){while(--_0x2cbf14){_0x1238be['push'](_0x1238be['shift']());}};_0x3a272f(++_0x230070);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3f2dff,_0x4a965d){_0x3f2dff=_0x3f2dff-0x0;var _0x3cb285=_0x3eea[_0x3f2dff];return _0x3cb285;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')]('/',auth[_0xa3ee('0xb')](),controller['index']);router['get'](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['get'](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router['post']('/',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x10')]);router[_0xa3ee('0x11')]('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x12')]);router['delete']('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x13')]);module[_0xa3ee('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0a613c2..efeb426 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 _0x9036=['inbound','internal','outbound','inbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0x9036,0x151));var _0x6903=function(_0x28cb75,_0x3f187c){_0x28cb75=_0x28cb75-0x0;var _0x4c0f9e=_0x9036[_0x28cb75];return _0x4c0f9e;};'use strict';var Sequelize=require(_0x6903('0x0'));module[_0x6903('0x1')]={'uniqueid':{'type':Sequelize[_0x6903('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6903('0x3'),_0x6903('0x4'),_0x6903('0x5'),_0x6903('0x6'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x6903('0x2')]},'accountcode':{'type':Sequelize[_0x6903('0x2')]},'source':{'type':Sequelize[_0x6903('0x2')]},'destination':{'type':Sequelize[_0x6903('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6903('0x2')]},'channel':{'type':Sequelize[_0x6903('0x2')]},'destinationchannel':{'type':Sequelize[_0x6903('0x2')]},'lastapplication':{'type':Sequelize[_0x6903('0x2')]},'lastdata':{'type':Sequelize[_0x6903('0x7')]},'starttime':{'type':Sequelize[_0x6903('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6903('0x8')]},'endtime':{'type':Sequelize[_0x6903('0x8')]},'duration':{'type':Sequelize[_0x6903('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x6903('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6903('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x6903('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x6903('0x2')]},'note':{'type':Sequelize[_0x6903('0x2')]},'prefix':{'type':Sequelize[_0x6903('0x2')]},'routeid':{'type':Sequelize[_0x6903('0x9')]},'sipcallid':{'type':Sequelize[_0x6903('0x2')]}}; \ No newline at end of file +var _0x9173=['inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x9173,0x7e));var _0x3917=function(_0x14a78a,_0x25258d){_0x14a78a=_0x14a78a-0x0;var _0x34dbcd=_0x9173[_0x14a78a];return _0x34dbcd;};'use strict';var Sequelize=require(_0x3917('0x0'));module[_0x3917('0x1')]={'uniqueid':{'type':Sequelize[_0x3917('0x2')]},'type':{'type':Sequelize[_0x3917('0x3')](_0x3917('0x4'),'internal',_0x3917('0x5'),_0x3917('0x6'),'outbound-fax',_0x3917('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3917('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x3917('0x2')]},'destinationcontext':{'type':Sequelize[_0x3917('0x2')]},'callerid':{'type':Sequelize[_0x3917('0x2')]},'channel':{'type':Sequelize[_0x3917('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x3917('0x2')]},'lastdata':{'type':Sequelize[_0x3917('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x3917('0x9')]},'answertime':{'type':Sequelize[_0x3917('0x9')]},'endtime':{'type':Sequelize[_0x3917('0x9')]},'duration':{'type':Sequelize[_0x3917('0xa')]},'billableseconds':{'type':Sequelize[_0x3917('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3917('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x3917('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3917('0x2')]},'prefix':{'type':Sequelize[_0x3917('0x2')]},'routeid':{'type':Sequelize[_0x3917('0xa')]},'sipcallid':{'type':Sequelize[_0x3917('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 0842514..3091920 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 _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x4c5220,_0x5ddd98){var _0x36211c=function(_0x8cd22e){while(--_0x8cd22e){_0x4c5220['push'](_0x4c5220['shift']());}};_0x36211c(++_0x5ddd98);}(_0xdb28,0x106));var _0x8db2=function(_0x443edc,_0x335ccc){_0x443edc=_0x443edc-0x0;var _0x365356=_0xdb28[_0x443edc];return _0x365356;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x326cd8,_0x127725){var _0x4f3758=function(_0x1b1fa3){while(--_0x1b1fa3){_0x326cd8['push'](_0x326cd8['shift']());}};_0x4f3758(++_0x127725);}(_0xdb28,0x106));var _0x8db2=function(_0x514260,_0x487e23){_0x514260=_0x514260-0x0;var _0x47b729=_0xdb28[_0x514260];return _0x47b729;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 06672da..8d644c0 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 _0xcb04=['./voiceCallReport.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xf41fb7,_0x2bb7d7){var _0x4a3d94=function(_0x1c0bb7){while(--_0x1c0bb7){_0xf41fb7['push'](_0xf41fb7['shift']());}};_0x4a3d94(++_0x2bb7d7);}(_0xcb04,0x7c));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4cb0('0x0'));var util=require(_0x4cb0('0x1'));var logger=require('../../config/logger')(_0x4cb0('0x2'));var moment=require(_0x4cb0('0x3'));var BPromise=require(_0x4cb0('0x4'));var rp=require(_0x4cb0('0x5'));var fs=require('fs');var path=require(_0x4cb0('0x6'));var rimraf=require('rimraf');var config=require(_0x4cb0('0x7'));var attributes=require(_0x4cb0('0x8'));module[_0x4cb0('0x9')]=function(_0x265733,_0x24dc32){return _0x265733[_0x4cb0('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6a0=['define','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xc6a0,0x1bf));var _0x0c6a=function(_0x4a49f7,_0x5a287b){_0x4a49f7=_0x4a49f7-0x0;var _0x1116ca=_0xc6a0[_0x4a49f7];return _0x1116ca;};'use strict';var _=require(_0x0c6a('0x0'));var util=require(_0x0c6a('0x1'));var logger=require(_0x0c6a('0x2'))('api');var moment=require(_0x0c6a('0x3'));var BPromise=require(_0x0c6a('0x4'));var rp=require(_0x0c6a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c6a('0x6'));var config=require(_0x0c6a('0x7'));var attributes=require(_0x0c6a('0x8'));module['exports']=function(_0x20879e,_0x13c6d2){return _0x20879e[_0x0c6a('0x9')]('VoiceCallReport',attributes,{'tableName':_0x0c6a('0xa'),'paranoid':![],'indexes':[{'fields':[_0x0c6a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 274a8b5..e67045f 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 _0x19d4=['update','UpdateVoiceCallReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','map','include','model','attributes','CreateVoiceCallReport','create','body','catch'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x19d4,0x121));var _0x419d=function(_0x32b96c,_0xe55520){_0x32b96c=_0x32b96c-0x0;var _0x36b76f=_0x19d4[_0x32b96c];return _0x36b76f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x419d('0x0'));var BPromise=require(_0x419d('0x1'));var rs=require(_0x419d('0x2'));var fs=require('fs');var Redis=require(_0x419d('0x3'));var db=require(_0x419d('0x4'))['db'];var utils=require(_0x419d('0x5'));var logger=require(_0x419d('0x6'))(_0x419d('0x7'));var config=require(_0x419d('0x8'));var jayson=require(_0x419d('0x9'));var client=jayson[_0x419d('0xa')][_0x419d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x206f52,_0x55afe4,_0x1d70a0){return new BPromise(function(_0x3772aa,_0x3548c2){return client[_0x419d('0xc')](_0x206f52,_0x1d70a0)[_0x419d('0xd')](function(_0x85993d){logger[_0x419d('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x55afe4,_0x419d('0xf'));logger[_0x419d('0x10')](_0x419d('0x11'),_0x55afe4,'request\x20sent',JSON[_0x419d('0x12')](_0x85993d));if(_0x85993d['error']){if(_0x85993d[_0x419d('0x13')][_0x419d('0x14')]===0x1f4){logger[_0x419d('0x13')](_0x419d('0x15'),_0x55afe4,_0x85993d[_0x419d('0x13')][_0x419d('0x16')]);return _0x3548c2(_0x85993d[_0x419d('0x13')][_0x419d('0x16')]);}logger[_0x419d('0x13')](_0x419d('0x15'),_0x55afe4,_0x85993d[_0x419d('0x13')][_0x419d('0x16')]);return _0x3772aa(_0x85993d[_0x419d('0x13')]['message']);}else{logger[_0x419d('0xe')](_0x419d('0x15'),_0x55afe4,'request\x20sent');_0x3772aa(_0x85993d[_0x419d('0x17')]['message']);}})['catch'](function(_0x3f743f){logger[_0x419d('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x55afe4,_0x3f743f);_0x3548c2(_0x3f743f);});});}exports[_0x419d('0x18')]=function(_0x587c88){var _0x59c39=this;return new Promise(function(_0x17d91e,_0x1b302c){return db[_0x419d('0x19')][_0x419d('0x1a')]({'raw':_0x587c88[_0x419d('0x1b')]?_0x587c88[_0x419d('0x1b')][_0x419d('0x1c')]===undefined?!![]:![]:!![],'where':_0x587c88[_0x419d('0x1b')]?_0x587c88[_0x419d('0x1b')][_0x419d('0x1d')]||null:null,'attributes':_0x587c88[_0x419d('0x1b')]?_0x587c88[_0x419d('0x1b')]['attributes']||null:null,'limit':_0x587c88[_0x419d('0x1b')]?_0x587c88[_0x419d('0x1b')][_0x419d('0x1e')]||null:null,'include':_0x587c88[_0x419d('0x1b')]?_0x587c88['options']['include']?_[_0x419d('0x1f')](_0x587c88[_0x419d('0x1b')][_0x419d('0x20')],function(_0x1a9c91){return{'model':db[_0x1a9c91[_0x419d('0x21')]],'as':_0x1a9c91['as'],'attributes':_0x1a9c91['attributes'],'include':_0x1a9c91[_0x419d('0x20')]?_[_0x419d('0x1f')](_0x1a9c91['include'],function(_0xfc508d){return{'model':db[_0xfc508d['model']],'as':_0xfc508d['as'],'attributes':_0xfc508d[_0x419d('0x22')],'include':_0xfc508d['include']?_[_0x419d('0x1f')](_0xfc508d[_0x419d('0x20')],function(_0x3f9990){return{'model':db[_0x3f9990[_0x419d('0x21')]],'as':_0x3f9990['as'],'attributes':_0x3f9990[_0x419d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x419d('0xd')](function(_0x240ab6){logger['info']('GetVoiceCallReport',_0x587c88);logger[_0x419d('0x10')](_0x419d('0x18'),_0x587c88,JSON['stringify'](_0x240ab6));_0x17d91e(_0x240ab6);})['catch'](function(_0x39eb85){logger[_0x419d('0x13')]('GetVoiceCallReport',_0x39eb85['message'],_0x587c88);_0x1b302c(_0x59c39[_0x419d('0x13')](0x1f4,_0x39eb85['message']));});});};exports[_0x419d('0x23')]=function(_0x43a757){var _0x310455=this;return new Promise(function(_0x4ff42b,_0xd91f1b){return db['VoiceCallReport'][_0x419d('0x24')](_0x43a757[_0x419d('0x25')],{'raw':_0x43a757[_0x419d('0x1b')]?_0x43a757[_0x419d('0x1b')][_0x419d('0x1c')]===undefined?!![]:![]:!![]})[_0x419d('0xd')](function(_0x51345b){logger['info'](_0x419d('0x23'),_0x43a757);logger[_0x419d('0x10')](_0x419d('0x23'),_0x43a757,JSON['stringify'](_0x51345b));_0x4ff42b(_0x51345b);})[_0x419d('0x26')](function(_0x21950b){logger['error'](_0x419d('0x23'),_0x21950b[_0x419d('0x16')],_0x43a757);_0xd91f1b(_0x310455[_0x419d('0x13')](0x1f4,_0x21950b[_0x419d('0x16')]));});});};exports['UpdateVoiceCallReport']=function(_0x44c92c){var _0x1dd03=this;return new Promise(function(_0x2e8306,_0xfa0242){return db[_0x419d('0x19')][_0x419d('0x27')](_0x44c92c[_0x419d('0x25')],{'raw':_0x44c92c['options']?_0x44c92c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44c92c[_0x419d('0x1b')]?_0x44c92c[_0x419d('0x1b')][_0x419d('0x1d')]||null:null,'attributes':_0x44c92c[_0x419d('0x1b')]?_0x44c92c[_0x419d('0x1b')][_0x419d('0x22')]||null:null,'limit':_0x44c92c[_0x419d('0x1b')]?_0x44c92c[_0x419d('0x1b')]['limit']||null:null})[_0x419d('0xd')](function(_0x513685){logger['info'](_0x419d('0x28'),_0x44c92c);logger['debug'](_0x419d('0x28'),_0x44c92c,JSON[_0x419d('0x12')](_0x513685));_0x2e8306(_0x513685);})[_0x419d('0x26')](function(_0x223991){logger[_0x419d('0x13')](_0x419d('0x28'),_0x223991['message'],_0x44c92c);_0xfa0242(_0x1dd03[_0x419d('0x13')](0x1f4,_0x223991[_0x419d('0x16')]));});});}; \ No newline at end of file +var _0x4271=['request\x20sent','debug','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','options','where','attributes','limit','map','include','model','info','CreateVoiceCallReport','create','body','raw','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x25dc63,_0x3df6cf){var _0xa010fb=function(_0x229024){while(--_0x229024){_0x25dc63['push'](_0x25dc63['shift']());}};_0xa010fb(++_0x3df6cf);}(_0x4271,0x1ba));var _0x1427=function(_0x522be3,_0x3aec4f){_0x522be3=_0x522be3-0x0;var _0x3c6865=_0x4271[_0x522be3];return _0x3c6865;};'use strict';var _=require(_0x1427('0x0'));var util=require(_0x1427('0x1'));var moment=require(_0x1427('0x2'));var BPromise=require(_0x1427('0x3'));var rs=require(_0x1427('0x4'));var fs=require('fs');var Redis=require(_0x1427('0x5'));var db=require(_0x1427('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1427('0x7'))(_0x1427('0x8'));var config=require('../../config/environment');var jayson=require(_0x1427('0x9'));var client=jayson[_0x1427('0xa')][_0x1427('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x595cc9,_0x20f7a9,_0x219992){return new BPromise(function(_0x592763,_0x58b47c){return client[_0x1427('0xc')](_0x595cc9,_0x219992)[_0x1427('0xd')](function(_0x484c53){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x20f7a9,_0x1427('0xe'));logger[_0x1427('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x20f7a9,_0x1427('0xe'),JSON[_0x1427('0x10')](_0x484c53));if(_0x484c53[_0x1427('0x11')]){if(_0x484c53[_0x1427('0x11')][_0x1427('0x12')]===0x1f4){logger[_0x1427('0x11')](_0x1427('0x13'),_0x20f7a9,_0x484c53['error']['message']);return _0x58b47c(_0x484c53[_0x1427('0x11')]['message']);}logger[_0x1427('0x11')](_0x1427('0x13'),_0x20f7a9,_0x484c53[_0x1427('0x11')][_0x1427('0x14')]);return _0x592763(_0x484c53[_0x1427('0x11')][_0x1427('0x14')]);}else{logger['info'](_0x1427('0x13'),_0x20f7a9,_0x1427('0xe'));_0x592763(_0x484c53['result'][_0x1427('0x14')]);}})[_0x1427('0x15')](function(_0x519f11){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x20f7a9,_0x519f11);_0x58b47c(_0x519f11);});});}exports[_0x1427('0x16')]=function(_0xba15f4){var _0x37299a=this;return new Promise(function(_0x333338,_0x45ad2d){return db[_0x1427('0x17')]['findAll']({'raw':_0xba15f4[_0x1427('0x18')]?_0xba15f4[_0x1427('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xba15f4[_0x1427('0x18')]?_0xba15f4[_0x1427('0x18')][_0x1427('0x19')]||null:null,'attributes':_0xba15f4[_0x1427('0x18')]?_0xba15f4['options'][_0x1427('0x1a')]||null:null,'limit':_0xba15f4[_0x1427('0x18')]?_0xba15f4['options'][_0x1427('0x1b')]||null:null,'include':_0xba15f4[_0x1427('0x18')]?_0xba15f4[_0x1427('0x18')]['include']?_[_0x1427('0x1c')](_0xba15f4['options'][_0x1427('0x1d')],function(_0x1a8ee3){return{'model':db[_0x1a8ee3[_0x1427('0x1e')]],'as':_0x1a8ee3['as'],'attributes':_0x1a8ee3[_0x1427('0x1a')],'include':_0x1a8ee3[_0x1427('0x1d')]?_[_0x1427('0x1c')](_0x1a8ee3[_0x1427('0x1d')],function(_0x810b70){return{'model':db[_0x810b70[_0x1427('0x1e')]],'as':_0x810b70['as'],'attributes':_0x810b70[_0x1427('0x1a')],'include':_0x810b70['include']?_['map'](_0x810b70[_0x1427('0x1d')],function(_0x360b76){return{'model':db[_0x360b76[_0x1427('0x1e')]],'as':_0x360b76['as'],'attributes':_0x360b76['attributes']};}):[]};}):[]};}):[]:[]})[_0x1427('0xd')](function(_0x1eead6){logger[_0x1427('0x1f')](_0x1427('0x16'),_0xba15f4);logger['debug'](_0x1427('0x16'),_0xba15f4,JSON[_0x1427('0x10')](_0x1eead6));_0x333338(_0x1eead6);})[_0x1427('0x15')](function(_0x4eacd1){logger[_0x1427('0x11')](_0x1427('0x16'),_0x4eacd1[_0x1427('0x14')],_0xba15f4);_0x45ad2d(_0x37299a[_0x1427('0x11')](0x1f4,_0x4eacd1['message']));});});};exports[_0x1427('0x20')]=function(_0x1aeb37){var _0x2c1dd9=this;return new Promise(function(_0x3547c6,_0xd6355e){return db[_0x1427('0x17')][_0x1427('0x21')](_0x1aeb37[_0x1427('0x22')],{'raw':_0x1aeb37['options']?_0x1aeb37['options'][_0x1427('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x114a24){logger[_0x1427('0x1f')](_0x1427('0x20'),_0x1aeb37);logger['debug']('CreateVoiceCallReport',_0x1aeb37,JSON[_0x1427('0x10')](_0x114a24));_0x3547c6(_0x114a24);})[_0x1427('0x15')](function(_0x4dd6a2){logger[_0x1427('0x11')](_0x1427('0x20'),_0x4dd6a2[_0x1427('0x14')],_0x1aeb37);_0xd6355e(_0x2c1dd9[_0x1427('0x11')](0x1f4,_0x4dd6a2[_0x1427('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x399bf3){var _0x1fd4d9=this;return new Promise(function(_0x854ddb,_0x55190a){return db[_0x1427('0x17')][_0x1427('0x24')](_0x399bf3[_0x1427('0x22')],{'raw':_0x399bf3[_0x1427('0x18')]?_0x399bf3['options'][_0x1427('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x399bf3[_0x1427('0x18')]?_0x399bf3['options'][_0x1427('0x19')]||null:null,'attributes':_0x399bf3[_0x1427('0x18')]?_0x399bf3[_0x1427('0x18')][_0x1427('0x1a')]||null:null,'limit':_0x399bf3[_0x1427('0x18')]?_0x399bf3['options']['limit']||null:null})[_0x1427('0xd')](function(_0x1b966f){logger[_0x1427('0x1f')](_0x1427('0x25'),_0x399bf3);logger[_0x1427('0xf')](_0x1427('0x25'),_0x399bf3,JSON[_0x1427('0x10')](_0x1b966f));_0x854ddb(_0x1b966f);})[_0x1427('0x15')](function(_0x196445){logger[_0x1427('0x11')]('UpdateVoiceCallReport',_0x196445[_0x1427('0x14')],_0x399bf3);_0x55190a(_0x1fd4d9[_0x1427('0x11')](0x1f4,_0x196445['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index a122bcc..5afdf72 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 _0x5b0e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5b0e,0x12e));var _0xe5b0=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x5b0e[_0x18cac4];return _0x2227c6;};'use strict';var multer=require(_0xe5b0('0x0'));var util=require('util');var path=require(_0xe5b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe5b0('0x2'));var router=express['Router']();var fs_extra=require(_0xe5b0('0x3'));var auth=require(_0xe5b0('0x4'));var interaction=require(_0xe5b0('0x5'));var config=require(_0xe5b0('0x6'));var controller=require('./voiceChanSpy.controller');router[_0xe5b0('0x7')]('/',auth[_0xe5b0('0x8')](),controller[_0xe5b0('0x9')]);router[_0xe5b0('0x7')](_0xe5b0('0xa'),auth[_0xe5b0('0x8')](),controller['show']);router[_0xe5b0('0xb')]('/',auth[_0xe5b0('0x8')](),controller[_0xe5b0('0xc')]);router[_0xe5b0('0xd')]('/:id',auth[_0xe5b0('0x8')](),controller[_0xe5b0('0xe')]);router[_0xe5b0('0xf')]('/:id',auth[_0xe5b0('0x8')](),controller[_0xe5b0('0x10')]);module[_0xe5b0('0x11')]=router; \ No newline at end of file +var _0xe3f7=['/:id','post','create','update','delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3f7,0x1d4));var _0x7e3f=function(_0x4785d9,_0x17d297){_0x4785d9=_0x4785d9-0x0;var _0x8b2cee=_0xe3f7[_0x4785d9];return _0x8b2cee;};'use strict';var multer=require(_0x7e3f('0x0'));var util=require('util');var path=require(_0x7e3f('0x1'));var timeout=require('connect-timeout');var express=require(_0x7e3f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7e3f('0x3'));var interaction=require(_0x7e3f('0x4'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x7e3f('0x5')]('/',auth[_0x7e3f('0x6')](),controller[_0x7e3f('0x7')]);router[_0x7e3f('0x5')](_0x7e3f('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x7e3f('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e3f('0xa')]);router['put'](_0x7e3f('0x8'),auth['isAuthenticated'](),controller[_0x7e3f('0xb')]);router[_0x7e3f('0xc')](_0x7e3f('0x8'),auth[_0x7e3f('0x6')](),controller['destroy']);module[_0x7e3f('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 869e585..54b8079 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 _0x0097=['name','setDataValue','options','join','BOOLEAN','exports','STRING'];(function(_0x5f3cb2,_0x141f34){var _0x4da262=function(_0x3b558f){while(--_0x3b558f){_0x5f3cb2['push'](_0x5f3cb2['shift']());}};_0x4da262(++_0x141f34);}(_0x0097,0xe5));var _0x7009=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0097[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7009('0x0')]={'name':{'type':Sequelize[_0x7009('0x1')]},'prefix':{'type':Sequelize[_0x7009('0x1')],'unique':_0x7009('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2f9d62){this[_0x7009('0x3')](_0x7009('0x4'),_0x2f9d62?_0x2f9d62[_0x7009('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x7009('0x4'))?this['getDataValue'](_0x7009('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x7009('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x7009('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7009('0x1')]},'description':{'type':Sequelize[_0x7009('0x1')]}}; \ No newline at end of file +var _0xf772=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x54bee2,_0x5f2ab8){var _0x4a47ad=function(_0x30e90a){while(--_0x30e90a){_0x54bee2['push'](_0x54bee2['shift']());}};_0x4a47ad(++_0x5f2ab8);}(_0xf772,0x1c1));var _0x2f77=function(_0x12c863,_0xcc4553){_0x12c863=_0x12c863-0x0;var _0x394af5=_0xf772[_0x12c863];return _0x394af5;};'use strict';var Sequelize=require(_0x2f77('0x0'));module[_0x2f77('0x1')]={'name':{'type':Sequelize[_0x2f77('0x2')]},'prefix':{'type':Sequelize[_0x2f77('0x2')],'unique':_0x2f77('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2f77('0x2')],'set':function(_0x5112c3){this[_0x2f77('0x4')](_0x2f77('0x5'),_0x5112c3?_0x5112c3[_0x2f77('0x6')](''):[]);},'get':function(){return this[_0x2f77('0x7')](_0x2f77('0x5'))?this[_0x2f77('0x7')]('options')[_0x2f77('0x8')](''):[];}},'auth':{'type':Sequelize[_0x2f77('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x2f77('0x2')]},'record':{'type':Sequelize[_0x2f77('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2f77('0x2')]},'description':{'type':Sequelize[_0x2f77('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 76195ce..20ccd5a 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 _0x7341=['status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x2e4edb,_0x43fb89){var _0x42f6a9=function(_0x2701c8){while(--_0x2701c8){_0x2e4edb['push'](_0x2e4edb['shift']());}};_0x42f6a9(++_0x43fb89);}(_0x7341,0xe4));var _0x1734=function(_0x24946b,_0x82a605){_0x24946b=_0x24946b-0x0;var _0x56a39f=_0x7341[_0x24946b];return _0x56a39f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1734('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1734('0x1'));var moment=require(_0x1734('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1734('0x3'));var util=require(_0x1734('0x4'));var path=require(_0x1734('0x5'));var sox=require(_0x1734('0x6'));var csv=require(_0x1734('0x7'));var ejs=require(_0x1734('0x8'));var fs=require('fs');var fs_extra=require(_0x1734('0x9'));var _=require('lodash');var squel=require(_0x1734('0xa'));var crypto=require(_0x1734('0xb'));var jsforce=require(_0x1734('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1734('0xd'));var authService=require(_0x1734('0xe'));var qs=require(_0x1734('0xf'));var as=require(_0x1734('0x10'));var hardwareService=require(_0x1734('0x11'));var logger=require(_0x1734('0x12'))(_0x1734('0x13'));var utils=require(_0x1734('0x14'));var config=require(_0x1734('0x15'));var licenseUtil=require(_0x1734('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4391a1,_0x449ab1){_0x449ab1=_0x449ab1||0xcc;return function(_0x44de07){if(_0x44de07){return _0x4391a1[_0x1734('0x17')](_0x449ab1);}return _0x4391a1[_0x1734('0x18')](_0x449ab1)[_0x1734('0x19')]();};}function respondWithResult(_0x9e7cf5,_0xd2f288){_0xd2f288=_0xd2f288||0xc8;return function(_0xb90c22){if(_0xb90c22){return _0x9e7cf5[_0x1734('0x18')](_0xd2f288)[_0x1734('0x1a')](_0xb90c22);}};}function respondWithFilteredResult(_0x27679e,_0x2162c9){return function(_0x2dd53c){if(_0x2dd53c){var _0x3989a6=typeof _0x2162c9[_0x1734('0x1b')]===_0x1734('0x1c')&&typeof _0x2162c9[_0x1734('0x1d')]===_0x1734('0x1c');var _0x56756c=_0x2dd53c['count'];var _0x1fa9c0=_0x3989a6?0x0:_0x2162c9[_0x1734('0x1b')];var _0x4a86d1=_0x3989a6?_0x2dd53c[_0x1734('0x1e')]:_0x2162c9['offset']+_0x2162c9['limit'];var _0x5b2789;if(_0x4a86d1>=_0x56756c){_0x4a86d1=_0x56756c;_0x5b2789=0xc8;}else{_0x5b2789=0xce;}_0x27679e[_0x1734('0x18')](_0x5b2789);return _0x27679e['set'](_0x1734('0x1f'),_0x1fa9c0+'-'+_0x4a86d1+'/'+_0x56756c)[_0x1734('0x1a')](_0x2dd53c);}return null;};}function patchUpdates(_0x4fc4ed){return function(_0x54b1bd){try{jsonpatch['apply'](_0x54b1bd,_0x4fc4ed,!![]);}catch(_0x1e7401){return BPromise['reject'](_0x1e7401);}return _0x54b1bd[_0x1734('0x20')]();};}function saveUpdates(_0x5ad801,_0x215ae4){return function(_0x42485f){if(_0x42485f){return _0x42485f[_0x1734('0x21')](_0x5ad801)[_0x1734('0x22')](function(_0x29bb2c){return _0x29bb2c;});}return null;};}function removeEntity(_0x45593e,_0x4285ee){return function(_0x44e420){if(_0x44e420){return _0x44e420[_0x1734('0x23')]()['then'](function(){var _0x34ac29=_0x44e420['get']({'plain':!![]});var _0x5e0023=_0x1734('0x24');return db[_0x1734('0x25')][_0x1734('0x23')]({'where':{'type':_0x5e0023,'resourceId':_0x34ac29['id']}})[_0x1734('0x22')](function(){return _0x44e420;});})[_0x1734('0x22')](function(){_0x45593e[_0x1734('0x18')](0xcc)[_0x1734('0x19')]();});}};}function handleEntityNotFound(_0x27d6e5,_0x4a670a){return function(_0x381960){if(!_0x381960){_0x27d6e5['sendStatus'](0x194);}return _0x381960;};}function handleError(_0x17e068,_0x16a35f){_0x16a35f=_0x16a35f||0x1f4;return function(_0xfca2ad){logger['error'](_0xfca2ad[_0x1734('0x26')]);if(_0xfca2ad[_0x1734('0x27')]){delete _0xfca2ad[_0x1734('0x27')];}_0x17e068['status'](_0x16a35f)[_0x1734('0x28')](_0xfca2ad);};}exports[_0x1734('0x29')]=function(_0x5594c0,_0x1bd659){var _0x419e75={},_0x1b2d85={},_0xf3d22e={'count':0x0,'rows':[]};var _0x4f4d92=_[_0x1734('0x2a')](db[_0x1734('0x2b')]['rawAttributes'],function(_0x4dd04a){return{'name':_0x4dd04a[_0x1734('0x2c')],'type':_0x4dd04a[_0x1734('0x2d')][_0x1734('0x2e')]};});_0x1b2d85[_0x1734('0x2f')]=_[_0x1734('0x2a')](_0x4f4d92,_0x1734('0x27'));_0x1b2d85[_0x1734('0x30')]=_[_0x1734('0x31')](_0x5594c0[_0x1734('0x30')]);_0x1b2d85[_0x1734('0x32')]=_[_0x1734('0x33')](_0x1b2d85[_0x1734('0x2f')],_0x1b2d85[_0x1734('0x30')]);_0x419e75[_0x1734('0x34')]=_[_0x1734('0x33')](_0x1b2d85[_0x1734('0x2f')],qs[_0x1734('0x35')](_0x5594c0['query'][_0x1734('0x35')]));_0x419e75['attributes']=_0x419e75[_0x1734('0x34')][_0x1734('0x36')]?_0x419e75[_0x1734('0x34')]:_0x1b2d85[_0x1734('0x2f')];if(!_0x5594c0[_0x1734('0x30')][_0x1734('0x37')](_0x1734('0x38'))){_0x419e75[_0x1734('0x1d')]=qs['limit'](_0x5594c0[_0x1734('0x30')][_0x1734('0x1d')]);_0x419e75[_0x1734('0x1b')]=qs[_0x1734('0x1b')](_0x5594c0[_0x1734('0x30')][_0x1734('0x1b')]);}_0x419e75[_0x1734('0x39')]=qs['sort'](_0x5594c0[_0x1734('0x30')][_0x1734('0x3a')]);_0x419e75[_0x1734('0x3b')]=qs[_0x1734('0x32')](_[_0x1734('0x3c')](_0x5594c0[_0x1734('0x30')],_0x1b2d85[_0x1734('0x32')]),_0x4f4d92);if(_0x5594c0[_0x1734('0x30')]['filter']){_0x419e75[_0x1734('0x3b')]=_['merge'](_0x419e75[_0x1734('0x3b')],{'$or':_[_0x1734('0x2a')](_0x4f4d92,function(_0x4ee569){if(_0x4ee569[_0x1734('0x2d')]!==_0x1734('0x3d')){var _0x169db8={};_0x169db8[_0x4ee569[_0x1734('0x27')]]={'$like':'%'+_0x5594c0[_0x1734('0x30')][_0x1734('0x3e')]+'%'};return _0x169db8;}})});}_0x419e75=_[_0x1734('0x3f')]({},_0x419e75,_0x5594c0[_0x1734('0x40')]);var _0x55d67c={'where':_0x419e75[_0x1734('0x3b')]};return db[_0x1734('0x2b')][_0x1734('0x1e')](_0x55d67c)[_0x1734('0x22')](function(_0x5f34e1){_0xf3d22e[_0x1734('0x1e')]=_0x5f34e1;if(_0x5594c0['query']['includeAll']){_0x419e75[_0x1734('0x41')]=[{'all':!![]}];}return db[_0x1734('0x2b')][_0x1734('0x42')](_0x419e75);})[_0x1734('0x22')](function(_0x4fc418){_0xf3d22e[_0x1734('0x43')]=_0x4fc418;return _0xf3d22e;})[_0x1734('0x22')](respondWithFilteredResult(_0x1bd659,_0x419e75))['catch'](handleError(_0x1bd659,null));};exports[_0x1734('0x44')]=function(_0x1b104a,_0x55954e){var _0x17f282={'raw':![],'where':{'id':_0x1b104a[_0x1734('0x45')]['id']}},_0x4bfc67={};_0x4bfc67[_0x1734('0x2f')]=_[_0x1734('0x31')](db[_0x1734('0x2b')][_0x1734('0x46')]);_0x4bfc67[_0x1734('0x30')]=_[_0x1734('0x31')](_0x1b104a['query']);_0x4bfc67[_0x1734('0x32')]=_[_0x1734('0x33')](_0x4bfc67['model'],_0x4bfc67[_0x1734('0x30')]);_0x17f282[_0x1734('0x34')]=_[_0x1734('0x33')](_0x4bfc67[_0x1734('0x2f')],qs['fields'](_0x1b104a[_0x1734('0x30')][_0x1734('0x35')]));_0x17f282[_0x1734('0x34')]=_0x17f282['attributes'][_0x1734('0x36')]?_0x17f282[_0x1734('0x34')]:_0x4bfc67[_0x1734('0x2f')];if(_0x1b104a[_0x1734('0x30')][_0x1734('0x47')]){_0x17f282[_0x1734('0x41')]=[{'all':!![]}];}_0x17f282=_[_0x1734('0x3f')]({},_0x17f282,_0x1b104a[_0x1734('0x40')]);return db[_0x1734('0x2b')][_0x1734('0x48')](_0x17f282)[_0x1734('0x22')](handleEntityNotFound(_0x55954e,null))[_0x1734('0x22')](respondWithResult(_0x55954e,null))[_0x1734('0x49')](handleError(_0x55954e,null));};exports[_0x1734('0x4a')]=function(_0x470110,_0x121c8c){return db[_0x1734('0x2b')][_0x1734('0x4a')](_0x470110['body'],{})[_0x1734('0x22')](function(_0x50e12d){var _0xfc42f3=_0x470110[_0x1734('0x4b')][_0x1734('0x4c')]({'plain':!![]});if(!_0xfc42f3)throw new Error(_0x1734('0x4d'));if(_0xfc42f3['role']==='user'){var _0x294097=_0x50e12d[_0x1734('0x4c')]({'plain':!![]});var _0x518ef4=_0x1734('0x24');return db[_0x1734('0x4e')][_0x1734('0x48')]({'where':{'name':_0x518ef4,'userProfileId':_0xfc42f3[_0x1734('0x4f')]},'raw':!![]})[_0x1734('0x22')](function(_0x1394bd){if(_0x1394bd&&_0x1394bd[_0x1734('0x50')]===0x0){return db['UserProfileResource'][_0x1734('0x4a')]({'name':_0x294097[_0x1734('0x27')],'resourceId':_0x294097['id'],'type':_0x1394bd[_0x1734('0x27')],'sectionId':_0x1394bd['id']},{})['then'](function(){return _0x50e12d;});}else{return _0x50e12d;}})[_0x1734('0x49')](function(_0x6b6fef){logger[_0x1734('0x51')](_0x1734('0x52'),_0x6b6fef);throw _0x6b6fef;});}return _0x50e12d;})['then'](respondWithResult(_0x121c8c,0xc9))[_0x1734('0x49')](handleError(_0x121c8c,null));};exports[_0x1734('0x21')]=function(_0x19ceed,_0xac0441){if(_0x19ceed[_0x1734('0x53')]['id']){delete _0x19ceed['body']['id'];}return db[_0x1734('0x2b')]['find']({'where':{'id':_0x19ceed['params']['id']}})[_0x1734('0x22')](handleEntityNotFound(_0xac0441,null))[_0x1734('0x22')](saveUpdates(_0x19ceed['body'],null))['then'](respondWithResult(_0xac0441,null))[_0x1734('0x49')](handleError(_0xac0441,null));};exports[_0x1734('0x23')]=function(_0x553fc0,_0x515e39){return db['VoiceChanSpy'][_0x1734('0x48')]({'where':{'id':_0x553fc0[_0x1734('0x45')]['id']}})[_0x1734('0x22')](handleEntityNotFound(_0x515e39,null))[_0x1734('0x22')](removeEntity(_0x515e39,null))['catch'](handleError(_0x515e39,null));}; \ No newline at end of file +var _0x9567=['save','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x524824,_0x598a16){var _0x10dcda=function(_0x25d402){while(--_0x25d402){_0x524824['push'](_0x524824['shift']());}};_0x10dcda(++_0x598a16);}(_0x9567,0xdc));var _0x7956=function(_0x3f6066,_0x2e146c){_0x3f6066=_0x3f6066-0x0;var _0x4eb452=_0x9567[_0x3f6066];return _0x4eb452;};'use strict';var emlformat=require(_0x7956('0x0'));var rimraf=require(_0x7956('0x1'));var zipdir=require(_0x7956('0x2'));var jsonpatch=require(_0x7956('0x3'));var rp=require(_0x7956('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7956('0x5'));var util=require(_0x7956('0x6'));var path=require('path');var sox=require(_0x7956('0x7'));var csv=require('to-csv');var ejs=require(_0x7956('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7956('0x9'));var squel=require(_0x7956('0xa'));var crypto=require('crypto');var jsforce=require(_0x7956('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7956('0xc'));var querystring=require(_0x7956('0xd'));var Papa=require('papaparse');var Redis=require(_0x7956('0xe'));var authService=require(_0x7956('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7956('0x10'));var hardwareService=require(_0x7956('0x11'));var logger=require(_0x7956('0x12'))('api');var utils=require(_0x7956('0x13'));var config=require(_0x7956('0x14'));var licenseUtil=require(_0x7956('0x15'));var db=require(_0x7956('0x16'))['db'];function respondWithStatusCode(_0x5b3531,_0x1d2e5d){_0x1d2e5d=_0x1d2e5d||0xcc;return function(_0x9d985e){if(_0x9d985e){return _0x5b3531[_0x7956('0x17')](_0x1d2e5d);}return _0x5b3531['status'](_0x1d2e5d)[_0x7956('0x18')]();};}function respondWithResult(_0x43c7f6,_0x248b79){_0x248b79=_0x248b79||0xc8;return function(_0x3a408a){if(_0x3a408a){return _0x43c7f6[_0x7956('0x19')](_0x248b79)[_0x7956('0x1a')](_0x3a408a);}};}function respondWithFilteredResult(_0x197360,_0x436573){return function(_0x24ea8d){if(_0x24ea8d){var _0x6a6d78=typeof _0x436573[_0x7956('0x1b')]===_0x7956('0x1c')&&typeof _0x436573[_0x7956('0x1d')]===_0x7956('0x1c');var _0x1e8040=_0x24ea8d[_0x7956('0x1e')];var _0x5e6b90=_0x6a6d78?0x0:_0x436573['offset'];var _0x10b29c=_0x6a6d78?_0x24ea8d[_0x7956('0x1e')]:_0x436573['offset']+_0x436573[_0x7956('0x1d')];var _0x584922;if(_0x10b29c>=_0x1e8040){_0x10b29c=_0x1e8040;_0x584922=0xc8;}else{_0x584922=0xce;}_0x197360[_0x7956('0x19')](_0x584922);return _0x197360[_0x7956('0x1f')]('Content-Range',_0x5e6b90+'-'+_0x10b29c+'/'+_0x1e8040)[_0x7956('0x1a')](_0x24ea8d);}return null;};}function patchUpdates(_0x2e31cd){return function(_0xc500bd){try{jsonpatch['apply'](_0xc500bd,_0x2e31cd,!![]);}catch(_0x8a58ea){return BPromise['reject'](_0x8a58ea);}return _0xc500bd[_0x7956('0x20')]();};}function saveUpdates(_0x5100d8,_0x427500){return function(_0x8a7165){if(_0x8a7165){return _0x8a7165[_0x7956('0x21')](_0x5100d8)[_0x7956('0x22')](function(_0x4d4d95){return _0x4d4d95;});}return null;};}function removeEntity(_0x19c033,_0x3f13b7){return function(_0x432a2d){if(_0x432a2d){return _0x432a2d['destroy']()['then'](function(){var _0x45f866=_0x432a2d[_0x7956('0x23')]({'plain':!![]});var _0x40d2d6=_0x7956('0x24');return db[_0x7956('0x25')]['destroy']({'where':{'type':_0x40d2d6,'resourceId':_0x45f866['id']}})[_0x7956('0x22')](function(){return _0x432a2d;});})[_0x7956('0x22')](function(){_0x19c033[_0x7956('0x19')](0xcc)[_0x7956('0x18')]();});}};}function handleEntityNotFound(_0x16d978,_0x30392c){return function(_0x4821d7){if(!_0x4821d7){_0x16d978[_0x7956('0x17')](0x194);}return _0x4821d7;};}function handleError(_0x33401e,_0x377261){_0x377261=_0x377261||0x1f4;return function(_0x3de345){logger[_0x7956('0x26')](_0x3de345[_0x7956('0x27')]);if(_0x3de345[_0x7956('0x28')]){delete _0x3de345[_0x7956('0x28')];}_0x33401e[_0x7956('0x19')](_0x377261)[_0x7956('0x29')](_0x3de345);};}exports[_0x7956('0x2a')]=function(_0xe64c4f,_0x21fb1b){var _0x2a00c1={},_0x3de2b5={},_0x378e31={'count':0x0,'rows':[]};var _0x305e30=_[_0x7956('0x2b')](db[_0x7956('0x2c')][_0x7956('0x2d')],function(_0x5bb0f1){return{'name':_0x5bb0f1[_0x7956('0x2e')],'type':_0x5bb0f1[_0x7956('0x2f')][_0x7956('0x30')]};});_0x3de2b5[_0x7956('0x31')]=_[_0x7956('0x2b')](_0x305e30,_0x7956('0x28'));_0x3de2b5['query']=_[_0x7956('0x32')](_0xe64c4f[_0x7956('0x33')]);_0x3de2b5['filters']=_[_0x7956('0x34')](_0x3de2b5[_0x7956('0x31')],_0x3de2b5[_0x7956('0x33')]);_0x2a00c1[_0x7956('0x35')]=_[_0x7956('0x34')](_0x3de2b5[_0x7956('0x31')],qs[_0x7956('0x36')](_0xe64c4f[_0x7956('0x33')][_0x7956('0x36')]));_0x2a00c1[_0x7956('0x35')]=_0x2a00c1[_0x7956('0x35')][_0x7956('0x37')]?_0x2a00c1[_0x7956('0x35')]:_0x3de2b5[_0x7956('0x31')];if(!_0xe64c4f[_0x7956('0x33')][_0x7956('0x38')]('nolimit')){_0x2a00c1[_0x7956('0x1d')]=qs[_0x7956('0x1d')](_0xe64c4f['query'][_0x7956('0x1d')]);_0x2a00c1['offset']=qs[_0x7956('0x1b')](_0xe64c4f['query']['offset']);}_0x2a00c1[_0x7956('0x39')]=qs['sort'](_0xe64c4f[_0x7956('0x33')][_0x7956('0x3a')]);_0x2a00c1[_0x7956('0x3b')]=qs[_0x7956('0x3c')](_[_0x7956('0x3d')](_0xe64c4f[_0x7956('0x33')],_0x3de2b5[_0x7956('0x3c')]),_0x305e30);if(_0xe64c4f[_0x7956('0x33')][_0x7956('0x3e')]){_0x2a00c1['where']=_[_0x7956('0x3f')](_0x2a00c1['where'],{'$or':_[_0x7956('0x2b')](_0x305e30,function(_0x14b2b2){if(_0x14b2b2[_0x7956('0x2f')]!==_0x7956('0x40')){var _0x4fd0fc={};_0x4fd0fc[_0x14b2b2[_0x7956('0x28')]]={'$like':'%'+_0xe64c4f[_0x7956('0x33')]['filter']+'%'};return _0x4fd0fc;}})});}_0x2a00c1=_['merge']({},_0x2a00c1,_0xe64c4f[_0x7956('0x41')]);var _0x4e9279={'where':_0x2a00c1[_0x7956('0x3b')]};return db[_0x7956('0x2c')][_0x7956('0x1e')](_0x4e9279)['then'](function(_0x387237){_0x378e31[_0x7956('0x1e')]=_0x387237;if(_0xe64c4f['query'][_0x7956('0x42')]){_0x2a00c1['include']=[{'all':!![]}];}return db[_0x7956('0x2c')][_0x7956('0x43')](_0x2a00c1);})[_0x7956('0x22')](function(_0x31cea9){_0x378e31[_0x7956('0x44')]=_0x31cea9;return _0x378e31;})['then'](respondWithFilteredResult(_0x21fb1b,_0x2a00c1))['catch'](handleError(_0x21fb1b,null));};exports[_0x7956('0x45')]=function(_0x475c42,_0x20d5fa){var _0x21fd73={'raw':![],'where':{'id':_0x475c42[_0x7956('0x46')]['id']}},_0x23472d={};_0x23472d['model']=_[_0x7956('0x32')](db[_0x7956('0x2c')][_0x7956('0x2d')]);_0x23472d[_0x7956('0x33')]=_[_0x7956('0x32')](_0x475c42[_0x7956('0x33')]);_0x23472d[_0x7956('0x3c')]=_[_0x7956('0x34')](_0x23472d[_0x7956('0x31')],_0x23472d[_0x7956('0x33')]);_0x21fd73[_0x7956('0x35')]=_[_0x7956('0x34')](_0x23472d[_0x7956('0x31')],qs[_0x7956('0x36')](_0x475c42[_0x7956('0x33')]['fields']));_0x21fd73[_0x7956('0x35')]=_0x21fd73['attributes']['length']?_0x21fd73[_0x7956('0x35')]:_0x23472d[_0x7956('0x31')];if(_0x475c42[_0x7956('0x33')][_0x7956('0x42')]){_0x21fd73[_0x7956('0x47')]=[{'all':!![]}];}_0x21fd73=_[_0x7956('0x3f')]({},_0x21fd73,_0x475c42[_0x7956('0x41')]);return db[_0x7956('0x2c')][_0x7956('0x48')](_0x21fd73)[_0x7956('0x22')](handleEntityNotFound(_0x20d5fa,null))[_0x7956('0x22')](respondWithResult(_0x20d5fa,null))[_0x7956('0x49')](handleError(_0x20d5fa,null));};exports[_0x7956('0x4a')]=function(_0x2ba635,_0x3158aa){return db[_0x7956('0x2c')][_0x7956('0x4a')](_0x2ba635[_0x7956('0x4b')],{})[_0x7956('0x22')](function(_0x2c8b8f){var _0x3b0c2e=_0x2ba635[_0x7956('0x4c')]['get']({'plain':!![]});if(!_0x3b0c2e)throw new Error(_0x7956('0x4d'));if(_0x3b0c2e[_0x7956('0x4e')]===_0x7956('0x4c')){var _0x493092=_0x2c8b8f[_0x7956('0x23')]({'plain':!![]});var _0x583766=_0x7956('0x24');return db[_0x7956('0x4f')]['find']({'where':{'name':_0x583766,'userProfileId':_0x3b0c2e[_0x7956('0x50')]},'raw':!![]})[_0x7956('0x22')](function(_0x5cc4d3){if(_0x5cc4d3&&_0x5cc4d3[_0x7956('0x51')]===0x0){return db[_0x7956('0x25')]['create']({'name':_0x493092[_0x7956('0x28')],'resourceId':_0x493092['id'],'type':_0x5cc4d3[_0x7956('0x28')],'sectionId':_0x5cc4d3['id']},{})[_0x7956('0x22')](function(){return _0x2c8b8f;});}else{return _0x2c8b8f;}})[_0x7956('0x49')](function(_0x3c592a){logger[_0x7956('0x26')](_0x7956('0x52'),_0x3c592a);throw _0x3c592a;});}return _0x2c8b8f;})['then'](respondWithResult(_0x3158aa,0xc9))[_0x7956('0x49')](handleError(_0x3158aa,null));};exports[_0x7956('0x21')]=function(_0x1b69d1,_0x43e920){if(_0x1b69d1['body']['id']){delete _0x1b69d1[_0x7956('0x4b')]['id'];}return db[_0x7956('0x2c')][_0x7956('0x48')]({'where':{'id':_0x1b69d1[_0x7956('0x46')]['id']}})[_0x7956('0x22')](handleEntityNotFound(_0x43e920,null))[_0x7956('0x22')](saveUpdates(_0x1b69d1[_0x7956('0x4b')],null))[_0x7956('0x22')](respondWithResult(_0x43e920,null))[_0x7956('0x49')](handleError(_0x43e920,null));};exports[_0x7956('0x53')]=function(_0x29a005,_0x1d2af8){return db[_0x7956('0x2c')][_0x7956('0x48')]({'where':{'id':_0x29a005['params']['id']}})[_0x7956('0x22')](handleEntityNotFound(_0x1d2af8,null))[_0x7956('0x22')](removeEntity(_0x1d2af8,null))[_0x7956('0x49')](handleError(_0x1d2af8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 2037202..35300d8 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 _0xe291=['then','VoiceExtension','bulkCreate','catch','destroy','util','bluebird','./voiceChanSpy.attributes','from-sip','format','prefix','system','merge','Set','CDR(type)=%s','chanspy','push','MixMonitor','${UNIQUEID}.%s,a','auth','password','name','options','record','length','concat','internal','User','findAll','agent','exports','define','VoiceChanSpy','voice_chanspy'];(function(_0x27a5a0,_0x21ebaf){var _0x3b6b17=function(_0x57e25d){while(--_0x57e25d){_0x27a5a0['push'](_0x27a5a0['shift']());}};_0x3b6b17(++_0x21ebaf);}(_0xe291,0x19d));var _0x1e29=function(_0x374d9d,_0x3c3b7a){_0x374d9d=_0x374d9d-0x0;var _0x21d878=_0xe291[_0x374d9d];return _0x21d878;};'use strict';var _=require('lodash');var util=require(_0x1e29('0x0'));var BPromise=require(_0x1e29('0x1'));var attributes=require(_0x1e29('0x2'));var getUserApplications=function(_0x5c01b8,_0x109323,_0x2e974c){var _0x54a913=0x1;var _0x26e574=[];var _0x599987={'context':_0x109323['context']||_0x1e29('0x3'),'exten':util[_0x1e29('0x4')]('%s%s',_0x5c01b8[_0x1e29('0x5')],_0x2e974c),'type':_0x1e29('0x6'),'isApp':![],'ChanSpyId':_0x5c01b8['id'],'UserId':_0x109323['id']};_0x26e574['push'](_[_0x1e29('0x7')]({'app':_0x1e29('0x8'),'appdata':util[_0x1e29('0x4')](_0x1e29('0x9'),_0x1e29('0xa')),'priority':_0x54a913++},_0x599987));if(_0x5c01b8['record']){_0x26e574[_0x1e29('0xb')](_[_0x1e29('0x7')]({'app':_0x1e29('0xc'),'appdata':util[_0x1e29('0x4')](_0x1e29('0xd'),_0x5c01b8['recordingFormat']),'priority':_0x54a913++},_0x599987));}if(_0x5c01b8[_0x1e29('0xe')]){_0x26e574[_0x1e29('0xb')](_[_0x1e29('0x7')]({'app':'Authenticate','appdata':_0x5c01b8[_0x1e29('0xf')],'priority':_0x54a913++},_0x599987));}_0x26e574[_0x1e29('0xb')](_[_0x1e29('0x7')]({'app':'ChanSpy','appdata':util['format']('SIP/%s,%s',_0x109323[_0x1e29('0x10')],_0x5c01b8['options']?_0x5c01b8[_0x1e29('0x11')]['join'](''):''),'priority':_0x54a913++},_0x599987));if(_0x5c01b8[_0x1e29('0x12')]){_0x26e574[_0x1e29('0xb')](_['merge']({'app':'StopMixMonitor','priority':_0x54a913++},_0x599987));}return _0x26e574;};var getChanSpyApplications=function(_0x534b98,_0x326090){var _0x4785e7=[];for(var _0x7e781a=0x0,_0x36c31b=0x1;_0x7e781a<_0x326090[_0x1e29('0x13')];_0x7e781a++,_0x36c31b=0x1){_0x4785e7=_0x4785e7[_0x1e29('0x14')](getUserApplications(_0x534b98,_0x326090[_0x7e781a],_0x326090[_0x7e781a][_0x1e29('0x15')]));if(_0x326090[_0x7e781a]['internal']!=_0x326090[_0x7e781a][_0x1e29('0x10')]){_0x4785e7=_0x4785e7['concat'](getUserApplications(_0x534b98,_0x326090[_0x7e781a],_0x326090[_0x7e781a][_0x1e29('0x10')]));}}return _0x4785e7;};var getChanSpyPromise=function(_0x494579,_0x494961){return new BPromise(function(_0x155b58,_0x3f714c){return _0x494579[_0x1e29('0x16')][_0x1e29('0x17')]({'attributes':['id',_0x1e29('0x10'),_0x1e29('0x15')],'where':{'role':_0x1e29('0x18'),'chanspy':!![]},'raw':!![]})['then'](function(_0x507357){if(_0x507357){return _0x155b58(getChanSpyApplications(_0x494961,_0x507357));}return _0x155b58([]);})['catch'](function(_0x47b58e){_0x3f714c(_0x47b58e);});});};module[_0x1e29('0x19')]=function(_0x390da1,_0x733e85){var _0x475a53=_0x390da1['models'];return _0x390da1[_0x1e29('0x1a')](_0x1e29('0x1b'),attributes,{'tableName':_0x1e29('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x529e9e,_0x7b5a39,_0x32d661){return getChanSpyPromise(_0x475a53,_0x529e9e)[_0x1e29('0x1d')](function(_0x4e64c9){if(_0x4e64c9&&_0x4e64c9['length']){return _0x475a53[_0x1e29('0x1e')][_0x1e29('0x1f')](_0x4e64c9);}})[_0x1e29('0x1d')](function(){_0x32d661();})[_0x1e29('0x20')](function(_0x18335f){_0x32d661(_0x18335f);});},'afterUpdate':function(_0x764bde,_0x153556,_0x24bf14){return _0x475a53[_0x1e29('0x1e')]['destroy']({'where':{'ChanSpyId':_0x764bde['id']}})['then'](function(){return getChanSpyPromise(_0x475a53,_0x764bde);})[_0x1e29('0x1d')](function(_0x106875){if(_0x106875&&_0x106875[_0x1e29('0x13')]){return _0x475a53['VoiceExtension'][_0x1e29('0x1f')](_0x106875);}})['then'](function(){_0x24bf14();})[_0x1e29('0x20')](function(_0xfcb863){_0x24bf14(_0xfcb863);});},'afterDestroy':function(_0x321c84,_0x380682,_0x4aefdf){return _0x475a53[_0x1e29('0x1e')][_0x1e29('0x21')]({'where':{'ChanSpyId':_0x321c84['id']}})[_0x1e29('0x1d')](function(){_0x4aefdf();})['catch'](function(_0x5f7881){_0x4aefdf(_0x5f7881);});}}});}; \ No newline at end of file +var _0xb152=['record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','context','from-sip','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy'];(function(_0x8b9e62,_0x173b44){var _0x31a9a0=function(_0x5cacf7){while(--_0x5cacf7){_0x8b9e62['push'](_0x8b9e62['shift']());}};_0x31a9a0(++_0x173b44);}(_0xb152,0x166));var _0x2b15=function(_0x3d9898,_0x3ea6f5){_0x3d9898=_0x3d9898-0x0;var _0x3b49e3=_0xb152[_0x3d9898];return _0x3b49e3;};'use strict';var _=require(_0x2b15('0x0'));var util=require('util');var BPromise=require(_0x2b15('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x203860,_0x131d9f,_0x5054db){var _0x553023=0x1;var _0x18d514=[];var _0x1b5e51={'context':_0x131d9f[_0x2b15('0x2')]||_0x2b15('0x3'),'exten':util[_0x2b15('0x4')](_0x2b15('0x5'),_0x203860[_0x2b15('0x6')],_0x5054db),'type':'system','isApp':![],'ChanSpyId':_0x203860['id'],'UserId':_0x131d9f['id']};_0x18d514[_0x2b15('0x7')](_[_0x2b15('0x8')]({'app':_0x2b15('0x9'),'appdata':util[_0x2b15('0x4')](_0x2b15('0xa'),_0x2b15('0xb')),'priority':_0x553023++},_0x1b5e51));if(_0x203860[_0x2b15('0xc')]){_0x18d514['push'](_[_0x2b15('0x8')]({'app':'MixMonitor','appdata':util[_0x2b15('0x4')](_0x2b15('0xd'),_0x203860[_0x2b15('0xe')]),'priority':_0x553023++},_0x1b5e51));}if(_0x203860[_0x2b15('0xf')]){_0x18d514[_0x2b15('0x7')](_[_0x2b15('0x8')]({'app':_0x2b15('0x10'),'appdata':_0x203860['password'],'priority':_0x553023++},_0x1b5e51));}_0x18d514['push'](_[_0x2b15('0x8')]({'app':_0x2b15('0x11'),'appdata':util['format'](_0x2b15('0x12'),_0x131d9f['name'],_0x203860[_0x2b15('0x13')]?_0x203860[_0x2b15('0x13')][_0x2b15('0x14')](''):''),'priority':_0x553023++},_0x1b5e51));if(_0x203860['record']){_0x18d514[_0x2b15('0x7')](_[_0x2b15('0x8')]({'app':_0x2b15('0x15'),'priority':_0x553023++},_0x1b5e51));}return _0x18d514;};var getChanSpyApplications=function(_0x2c460d,_0x1d1a5a){var _0x4148c9=[];for(var _0x5ac894=0x0,_0x21bb5e=0x1;_0x5ac894<_0x1d1a5a[_0x2b15('0x16')];_0x5ac894++,_0x21bb5e=0x1){_0x4148c9=_0x4148c9[_0x2b15('0x17')](getUserApplications(_0x2c460d,_0x1d1a5a[_0x5ac894],_0x1d1a5a[_0x5ac894]['internal']));if(_0x1d1a5a[_0x5ac894][_0x2b15('0x18')]!=_0x1d1a5a[_0x5ac894][_0x2b15('0x19')]){_0x4148c9=_0x4148c9[_0x2b15('0x17')](getUserApplications(_0x2c460d,_0x1d1a5a[_0x5ac894],_0x1d1a5a[_0x5ac894][_0x2b15('0x19')]));}}return _0x4148c9;};var getChanSpyPromise=function(_0x120a1d,_0x58824c){return new BPromise(function(_0xaef3da,_0x1a100f){return _0x120a1d['User'][_0x2b15('0x1a')]({'attributes':['id',_0x2b15('0x19'),_0x2b15('0x18')],'where':{'role':_0x2b15('0x1b'),'chanspy':!![]},'raw':!![]})[_0x2b15('0x1c')](function(_0x3906b6){if(_0x3906b6){return _0xaef3da(getChanSpyApplications(_0x58824c,_0x3906b6));}return _0xaef3da([]);})[_0x2b15('0x1d')](function(_0x34ac78){_0x1a100f(_0x34ac78);});});};module['exports']=function(_0x573dab,_0x5b37d0){var _0xe163bb=_0x573dab[_0x2b15('0x1e')];return _0x573dab[_0x2b15('0x1f')](_0x2b15('0x20'),attributes,{'tableName':_0x2b15('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ec8a4,_0x2513b0,_0x37973b){return getChanSpyPromise(_0xe163bb,_0x4ec8a4)[_0x2b15('0x1c')](function(_0x2d6c98){if(_0x2d6c98&&_0x2d6c98[_0x2b15('0x16')]){return _0xe163bb[_0x2b15('0x22')][_0x2b15('0x23')](_0x2d6c98);}})[_0x2b15('0x1c')](function(){_0x37973b();})[_0x2b15('0x1d')](function(_0x3ec42f){_0x37973b(_0x3ec42f);});},'afterUpdate':function(_0x53802,_0xeefe37,_0x5b6b39){return _0xe163bb[_0x2b15('0x22')][_0x2b15('0x24')]({'where':{'ChanSpyId':_0x53802['id']}})[_0x2b15('0x1c')](function(){return getChanSpyPromise(_0xe163bb,_0x53802);})['then'](function(_0x52af86){if(_0x52af86&&_0x52af86[_0x2b15('0x16')]){return _0xe163bb[_0x2b15('0x22')][_0x2b15('0x23')](_0x52af86);}})[_0x2b15('0x1c')](function(){_0x5b6b39();})[_0x2b15('0x1d')](function(_0x26339){_0x5b6b39(_0x26339);});},'afterDestroy':function(_0x495937,_0x580cde,_0x510eca){return _0xe163bb[_0x2b15('0x22')]['destroy']({'where':{'ChanSpyId':_0x495937['id']}})[_0x2b15('0x1c')](function(){_0x510eca();})[_0x2b15('0x1d')](function(_0x378daa){_0x510eca(_0x378daa);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1450013..1791c56 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 _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x457fac,_0x3e5839){var _0x4019c2=function(_0x426ef3){while(--_0x426ef3){_0x457fac['push'](_0x457fac['shift']());}};_0x4019c2(++_0x3e5839);}(_0x668b,0x140));var _0xb668=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0x668b[_0x466247];return _0x4b352e;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file +var _0x8b29=['then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x451679,_0x232f6b){var _0x13eed1=function(_0xc3c685){while(--_0xc3c685){_0x451679['push'](_0x451679['shift']());}};_0x13eed1(++_0x232f6b);}(_0x8b29,0xbe));var _0x98b2=function(_0x2b3753,_0x165ada){_0x2b3753=_0x2b3753-0x0;var _0x444e94=_0x8b29[_0x2b3753];return _0x444e94;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var moment=require(_0x98b2('0x1'));var BPromise=require(_0x98b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98b2('0x3'))['db'];var utils=require(_0x98b2('0x4'));var logger=require('../../config/logger')(_0x98b2('0x5'));var config=require('../../config/environment');var jayson=require(_0x98b2('0x6'));var client=jayson[_0x98b2('0x7')][_0x98b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e7ef5,_0x221cee,_0x2cd0cb){return new BPromise(function(_0x417ca6,_0x388827){return client[_0x98b2('0x9')](_0x3e7ef5,_0x2cd0cb)[_0x98b2('0xa')](function(_0x501b51){logger['info'](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));logger[_0x98b2('0xd')](_0x98b2('0xe'),_0x221cee,_0x98b2('0xc'),JSON[_0x98b2('0xf')](_0x501b51));if(_0x501b51['error']){if(_0x501b51[_0x98b2('0x10')][_0x98b2('0x11')]===0x1f4){logger['error'](_0x98b2('0xb'),_0x221cee,_0x501b51[_0x98b2('0x10')][_0x98b2('0x12')]);return _0x388827(_0x501b51['error']['message']);}logger[_0x98b2('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x221cee,_0x501b51[_0x98b2('0x10')]['message']);return _0x417ca6(_0x501b51['error']['message']);}else{logger[_0x98b2('0x13')](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));_0x417ca6(_0x501b51['result']['message']);}})['catch'](function(_0x389d22){logger[_0x98b2('0x10')](_0x98b2('0xb'),_0x221cee,_0x389d22);_0x388827(_0x389d22);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d2578b5..2e0b391 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 _0xe0d4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','update','delete','multer','util','path','express','Router','fs-extra'];(function(_0x1d2fb7,_0x46f357){var _0x4fadd9=function(_0x54b557){while(--_0x54b557){_0x1d2fb7['push'](_0x1d2fb7['shift']());}};_0x4fadd9(++_0x46f357);}(_0xe0d4,0x1e0));var _0x4e0d=function(_0x164e59,_0x269425){_0x164e59=_0x164e59-0x0;var _0x405ed2=_0xe0d4[_0x164e59];return _0x405ed2;};'use strict';var multer=require(_0x4e0d('0x0'));var util=require(_0x4e0d('0x1'));var path=require(_0x4e0d('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e0d('0x3'));var router=express[_0x4e0d('0x4')]();var fs_extra=require(_0x4e0d('0x5'));var auth=require(_0x4e0d('0x6'));var interaction=require(_0x4e0d('0x7'));var config=require(_0x4e0d('0x8'));var controller=require(_0x4e0d('0x9'));router[_0x4e0d('0xa')]('/',auth[_0x4e0d('0xb')](),controller['index']);router[_0x4e0d('0xa')](_0x4e0d('0xc'),auth[_0x4e0d('0xb')](),controller[_0x4e0d('0xd')]);router[_0x4e0d('0xe')]('/',auth[_0x4e0d('0xb')](),controller[_0x4e0d('0xf')]);router['put']('/:id',auth[_0x4e0d('0xb')](),controller[_0x4e0d('0x10')]);router[_0x4e0d('0x11')](_0x4e0d('0xc'),auth[_0x4e0d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd13f=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get'];(function(_0x1ad394,_0x1beea7){var _0x7548c=function(_0xb780cf){while(--_0xb780cf){_0x1ad394['push'](_0x1ad394['shift']());}};_0x7548c(++_0x1beea7);}(_0xd13f,0xc8));var _0xfd13=function(_0x3b7cfa,_0xc6be5c){_0x3b7cfa=_0x3b7cfa-0x0;var _0x28c1b4=_0xd13f[_0x3b7cfa];return _0x28c1b4;};'use strict';var multer=require(_0xfd13('0x0'));var util=require(_0xfd13('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfd13('0x2'));var router=express[_0xfd13('0x3')]();var fs_extra=require(_0xfd13('0x4'));var auth=require(_0xfd13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd13('0x6'));var controller=require(_0xfd13('0x7'));router[_0xfd13('0x8')]('/',auth[_0xfd13('0x9')](),controller[_0xfd13('0xa')]);router['get'](_0xfd13('0xb'),auth[_0xfd13('0x9')](),controller[_0xfd13('0xc')]);router[_0xfd13('0xd')]('/',auth[_0xfd13('0x9')](),controller[_0xfd13('0xe')]);router[_0xfd13('0xf')]('/:id',auth[_0xfd13('0x9')](),controller[_0xfd13('0x10')]);router['delete'](_0xfd13('0xb'),auth[_0xfd13('0x9')](),controller[_0xfd13('0x11')]);module[_0xfd13('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2e2fdde..bc3f61c 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 _0x7ef3=['sequelize','STRING','name','BOOLEAN'];(function(_0x678dda,_0x4bd7a9){var _0x430464=function(_0x1da5b1){while(--_0x1da5b1){_0x678dda['push'](_0x678dda['shift']());}};_0x430464(++_0x4bd7a9);}(_0x7ef3,0x178));var _0x37ef=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x7ef3[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x37ef('0x0'));module['exports']={'name':{'type':Sequelize[_0x37ef('0x1')],'unique':_0x37ef('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x37ef('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6eae=['STRING','name','BOOLEAN','exports'];(function(_0x443a13,_0x5df6f0){var _0x24c1c7=function(_0x362788){while(--_0x362788){_0x443a13['push'](_0x443a13['shift']());}};_0x24c1c7(++_0x5df6f0);}(_0x6eae,0xc3));var _0xe6ea=function(_0x2aa42f,_0x235204){_0x2aa42f=_0x2aa42f-0x0;var _0xa3f6d3=_0x6eae[_0x2aa42f];return _0xa3f6d3;};'use strict';var Sequelize=require('sequelize');module[_0xe6ea('0x0')]={'name':{'type':Sequelize[_0xe6ea('0x1')],'unique':_0xe6ea('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe6ea('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 9284609..cbbcb66 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 _0x395f=['fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','writeFileSync','Reload','chan_sip.so','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x16ca4a,_0x1ed3e7){var _0x48f844=function(_0x161e91){while(--_0x161e91){_0x16ca4a['push'](_0x16ca4a['shift']());}};_0x48f844(++_0x1ed3e7);}(_0x395f,0xc8));var _0xf395=function(_0x2d4317,_0x33b780){_0x2d4317=_0x2d4317-0x0;var _0x537d80=_0x395f[_0x2d4317];return _0x537d80;};'use strict';var emlformat=require(_0xf395('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf395('0x1'));var jsonpatch=require(_0xf395('0x2'));var rp=require(_0xf395('0x3'));var moment=require(_0xf395('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf395('0x5'));var util=require(_0xf395('0x6'));var path=require(_0xf395('0x7'));var sox=require(_0xf395('0x8'));var csv=require('to-csv');var ejs=require(_0xf395('0x9'));var fs=require('fs');var fs_extra=require(_0xf395('0xa'));var _=require(_0xf395('0xb'));var squel=require('squel');var crypto=require(_0xf395('0xc'));var jsforce=require(_0xf395('0xd'));var deskjs=require(_0xf395('0xe'));var toCsv=require(_0xf395('0xf'));var querystring=require(_0xf395('0x10'));var Papa=require('papaparse');var Redis=require(_0xf395('0x11'));var authService=require(_0xf395('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf395('0x13'));var logger=require(_0xf395('0x14'))(_0xf395('0x15'));var utils=require(_0xf395('0x16'));var config=require(_0xf395('0x17'));var licenseUtil=require(_0xf395('0x18'));var db=require(_0xf395('0x19'))['db'];var jayson=require(_0xf395('0x1a'));var client=jayson['client'][_0xf395('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf44db1,_0xff909,_0x4b1fa1,_0x38968a){return new BPromise(function(_0x5b13ae,_0x199090){var _0x570a34=_0x38968a||client;return _0x570a34[_0xf395('0x1c')](_0xf44db1,_0x4b1fa1)[_0xf395('0x1d')](function(_0x5d1daf){logger[_0xf395('0x1e')](_0xf395('0x1f'),_0xff909,_0xf395('0x20'));logger[_0xf395('0x21')](_0xf395('0x22'),_0xff909,'request\x20sent',JSON['stringify'](_0x5d1daf));if(_0x5d1daf[_0xf395('0x23')]){if(_0x5d1daf[_0xf395('0x23')][_0xf395('0x24')]===0x1f4){logger[_0xf395('0x23')](_0xf395('0x1f'),_0xff909,_0x5d1daf[_0xf395('0x23')][_0xf395('0x25')]);return _0x199090(_0x5d1daf[_0xf395('0x23')]['message']);}logger['error'](_0xf395('0x1f'),_0xff909,_0x5d1daf[_0xf395('0x23')]['message']);return _0x5b13ae(_0x5d1daf[_0xf395('0x23')][_0xf395('0x25')]);}else{logger[_0xf395('0x1e')](_0xf395('0x1f'),_0xff909,_0xf395('0x20'));_0x5b13ae(_0x5d1daf[_0xf395('0x26')][_0xf395('0x25')]);}})[_0xf395('0x27')](function(_0x2bcf18){logger[_0xf395('0x23')](_0xf395('0x1f'),_0xff909,_0x2bcf18);_0x199090(_0x2bcf18);});});}function respondWithStatusCode(_0x5deaa6,_0x526e89){_0x526e89=_0x526e89||0xcc;return function(_0x42e534){if(_0x42e534){return _0x5deaa6['sendStatus'](_0x526e89);}return _0x5deaa6[_0xf395('0x28')](_0x526e89)[_0xf395('0x29')]();};}function respondWithResult(_0x2cd95d,_0x233d54){_0x233d54=_0x233d54||0xc8;return function(_0x2432aa){if(_0x2432aa){return _0x2cd95d['status'](_0x233d54)[_0xf395('0x2a')](_0x2432aa);}};}function respondWithFilteredResult(_0x86b24f,_0x5a33fd){return function(_0x5ef08f){if(_0x5ef08f){var _0x542d63=typeof _0x5a33fd['offset']==='undefined'&&typeof _0x5a33fd[_0xf395('0x2b')]===_0xf395('0x2c');var _0x2368a3=_0x5ef08f['count'];var _0x253e49=_0x542d63?0x0:_0x5a33fd[_0xf395('0x2d')];var _0xfee329=_0x542d63?_0x5ef08f[_0xf395('0x2e')]:_0x5a33fd['offset']+_0x5a33fd[_0xf395('0x2b')];var _0x884d43;if(_0xfee329>=_0x2368a3){_0xfee329=_0x2368a3;_0x884d43=0xc8;}else{_0x884d43=0xce;}_0x86b24f[_0xf395('0x28')](_0x884d43);return _0x86b24f[_0xf395('0x2f')](_0xf395('0x30'),_0x253e49+'-'+_0xfee329+'/'+_0x2368a3)[_0xf395('0x2a')](_0x5ef08f);}return null;};}function patchUpdates(_0x409c60){return function(_0x2c683f){try{jsonpatch[_0xf395('0x31')](_0x2c683f,_0x409c60,!![]);}catch(_0x3c286c){return BPromise[_0xf395('0x32')](_0x3c286c);}return _0x2c683f['save']();};}function saveUpdates(_0x94f7cf,_0x1915ba){return function(_0x15f219){if(_0x15f219){return _0x15f219['update'](_0x94f7cf)['then'](function(_0x54f51c){return _0x54f51c;});}return null;};}function removeEntity(_0x5dc43a,_0x1f230d){return function(_0x505d11){if(_0x505d11){return _0x505d11[_0xf395('0x33')]()[_0xf395('0x1d')](function(){var _0x58f7f2=_0x505d11[_0xf395('0x34')]({'plain':!![]});var _0x359686=_0xf395('0x35');return db[_0xf395('0x36')][_0xf395('0x33')]({'where':{'type':_0x359686,'resourceId':_0x58f7f2['id']}})[_0xf395('0x1d')](function(){return _0x505d11;});})[_0xf395('0x1d')](function(){_0x5dc43a[_0xf395('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a4186,_0x4e1fb5){return function(_0x2457d6){if(!_0x2457d6){_0x2a4186[_0xf395('0x37')](0x194);}return _0x2457d6;};}function handleError(_0x387241,_0x57c239){_0x57c239=_0x57c239||0x1f4;return function(_0x18e4ad){logger['error'](_0x18e4ad[_0xf395('0x38')]);if(_0x18e4ad[_0xf395('0x39')]){delete _0x18e4ad[_0xf395('0x39')];}_0x387241[_0xf395('0x28')](_0x57c239)[_0xf395('0x3a')](_0x18e4ad);};}exports[_0xf395('0x3b')]=function(_0x257a64,_0x2cec29){var _0x16c2e9={},_0x311d45={},_0x4430ba={'count':0x0,'rows':[]};var _0x151669=_[_0xf395('0x3c')](db[_0xf395('0x3d')][_0xf395('0x3e')],function(_0x5eb2cd){return{'name':_0x5eb2cd[_0xf395('0x3f')],'type':_0x5eb2cd[_0xf395('0x40')][_0xf395('0x41')]};});_0x311d45['model']=_[_0xf395('0x3c')](_0x151669,_0xf395('0x39'));_0x311d45['query']=_[_0xf395('0x42')](_0x257a64[_0xf395('0x43')]);_0x311d45[_0xf395('0x44')]=_[_0xf395('0x45')](_0x311d45[_0xf395('0x46')],_0x311d45[_0xf395('0x43')]);_0x16c2e9['attributes']=_[_0xf395('0x45')](_0x311d45[_0xf395('0x46')],qs[_0xf395('0x47')](_0x257a64[_0xf395('0x43')][_0xf395('0x47')]));_0x16c2e9[_0xf395('0x48')]=_0x16c2e9[_0xf395('0x48')][_0xf395('0x49')]?_0x16c2e9['attributes']:_0x311d45[_0xf395('0x46')];if(!_0x257a64[_0xf395('0x43')][_0xf395('0x4a')]('nolimit')){_0x16c2e9[_0xf395('0x2b')]=qs[_0xf395('0x2b')](_0x257a64[_0xf395('0x43')]['limit']);_0x16c2e9[_0xf395('0x2d')]=qs[_0xf395('0x2d')](_0x257a64[_0xf395('0x43')][_0xf395('0x2d')]);}_0x16c2e9['order']=qs[_0xf395('0x4b')](_0x257a64[_0xf395('0x43')][_0xf395('0x4b')]);_0x16c2e9[_0xf395('0x4c')]=qs['filters'](_[_0xf395('0x4d')](_0x257a64['query'],_0x311d45[_0xf395('0x44')]),_0x151669);if(_0x257a64[_0xf395('0x43')][_0xf395('0x4e')]){_0x16c2e9[_0xf395('0x4c')]=_[_0xf395('0x4f')](_0x16c2e9[_0xf395('0x4c')],{'$or':_[_0xf395('0x3c')](_0x151669,function(_0x702ccc){if(_0x702ccc[_0xf395('0x40')]!==_0xf395('0x50')){var _0x4f5a7d={};_0x4f5a7d[_0x702ccc['name']]={'$like':'%'+_0x257a64[_0xf395('0x43')]['filter']+'%'};return _0x4f5a7d;}})});}_0x16c2e9=_['merge']({},_0x16c2e9,_0x257a64['options']);var _0x583c2f={'where':_0x16c2e9[_0xf395('0x4c')]};return db[_0xf395('0x3d')]['count'](_0x583c2f)[_0xf395('0x1d')](function(_0xeea83a){_0x4430ba['count']=_0xeea83a;if(_0x257a64[_0xf395('0x43')][_0xf395('0x51')]){_0x16c2e9[_0xf395('0x52')]=[{'all':!![]}];}return db['VoiceContext'][_0xf395('0x53')](_0x16c2e9);})['then'](function(_0x444b6a){_0x4430ba['rows']=_0x444b6a;return _0x4430ba;})[_0xf395('0x1d')](respondWithFilteredResult(_0x2cec29,_0x16c2e9))['catch'](handleError(_0x2cec29,null));};exports[_0xf395('0x54')]=function(_0x2716be,_0x8fed91){var _0x40194e={'raw':![],'where':{'id':_0x2716be[_0xf395('0x55')]['id']}},_0x5435d6={};_0x5435d6[_0xf395('0x46')]=_['keys'](db['VoiceContext'][_0xf395('0x3e')]);_0x5435d6['query']=_[_0xf395('0x42')](_0x2716be['query']);_0x5435d6['filters']=_[_0xf395('0x45')](_0x5435d6[_0xf395('0x46')],_0x5435d6[_0xf395('0x43')]);_0x40194e[_0xf395('0x48')]=_[_0xf395('0x45')](_0x5435d6[_0xf395('0x46')],qs[_0xf395('0x47')](_0x2716be[_0xf395('0x43')][_0xf395('0x47')]));_0x40194e[_0xf395('0x48')]=_0x40194e['attributes']['length']?_0x40194e['attributes']:_0x5435d6[_0xf395('0x46')];if(_0x2716be[_0xf395('0x43')][_0xf395('0x51')]){_0x40194e[_0xf395('0x52')]=[{'all':!![]}];}_0x40194e=_[_0xf395('0x4f')]({},_0x40194e,_0x2716be['options']);return db[_0xf395('0x3d')][_0xf395('0x56')](_0x40194e)[_0xf395('0x1d')](handleEntityNotFound(_0x8fed91,null))['then'](respondWithResult(_0x8fed91,null))[_0xf395('0x27')](handleError(_0x8fed91,null));};exports[_0xf395('0x57')]=function(_0xa51317,_0x390ab5,_0x56351c){var _0x525822;return db['VoiceContext'][_0xf395('0x57')](_0xa51317[_0xf395('0x58')],{'raw':!![]})['then'](function(_0x342335){_0x525822=_0x342335;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x2a9b2d){var _0x35e734=fs[_0xf395('0x59')](path[_0xf395('0x5a')](config[_0xf395('0x5b')],_0xf395('0x5c')),_0xf395('0x5d'));var _0x588e20=ejs['render'](_0x35e734,{'contexts':_0x2a9b2d||[]});fs['writeFileSync'](_0xf395('0x5e'),_0x588e20);})[_0xf395('0x1d')](function(){return respondWithRpcPromise('Reload',_0xf395('0x57'),{'module':'chan_sip.so'});})[_0xf395('0x1d')](function(){var _0x341789=_0xa51317[_0xf395('0x5f')]['get']({'plain':!![]});if(!_0x341789)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x341789[_0xf395('0x60')]==='user'){var _0xc328ec=_0x525822[_0xf395('0x34')]({'plain':!![]});return db[_0xf395('0x61')][_0xf395('0x56')]({'where':{'name':_0xf395('0x35'),'userProfileId':_0x341789[_0xf395('0x62')]},'raw':!![]})['then'](function(_0x4d0062){if(_0x4d0062&&_0x4d0062[_0xf395('0x63')]===0x0){return db[_0xf395('0x36')]['create']({'name':_0xc328ec[_0xf395('0x39')],'resourceId':_0xc328ec['id'],'type':_0x4d0062[_0xf395('0x39')],'sectionId':_0x4d0062['id']},{})[_0xf395('0x1d')](function(){return _0x525822;});}else{return _0x525822;}})['catch'](function(_0x1c4ebd){logger['error'](_0xf395('0x64'),_0x1c4ebd);throw _0x1c4ebd;});}return _0x525822;})['then'](respondWithResult(_0x390ab5,0xc9))[_0xf395('0x27')](handleError(_0x390ab5,null));};exports[_0xf395('0x65')]=function(_0x42ec1b,_0x1ecc7a,_0x709f5b){var _0x306398;return db[_0xf395('0x3d')]['find']({'where':{'id':_0x42ec1b[_0xf395('0x55')]['id']}})[_0xf395('0x1d')](handleEntityNotFound(_0x1ecc7a,null))[_0xf395('0x1d')](saveUpdates(_0x42ec1b[_0xf395('0x58')],null))[_0xf395('0x1d')](function(_0x50b92a){if(_0x50b92a){_0x306398=_0x50b92a;return db[_0xf395('0x3d')][_0xf395('0x53')]({'raw':!![]});}})[_0xf395('0x1d')](function(_0x3aeaec){var _0x507777=fs['readFileSync'](path[_0xf395('0x5a')](config[_0xf395('0x5b')],_0xf395('0x5c')),'utf8');var _0x207027=ejs['render'](_0x507777,{'contexts':_0x3aeaec||[]});fs[_0xf395('0x66')](_0xf395('0x5e'),_0x207027);})[_0xf395('0x1d')](function(){return respondWithRpcPromise(_0xf395('0x67'),_0xf395('0x65'),{'module':_0xf395('0x68')});})['then'](function(){return _0x306398;})[_0xf395('0x1d')](respondWithResult(_0x1ecc7a,null))['catch'](handleError(_0x1ecc7a,null));};exports[_0xf395('0x33')]=function(_0x17851a,_0x2ee246,_0x125e81){var _0x408030;return db[_0xf395('0x3d')]['find']({'where':{'id':_0x17851a[_0xf395('0x55')]['id']}})[_0xf395('0x1d')](handleEntityNotFound(_0x2ee246,null))['then'](removeEntity(_0x2ee246,null))[_0xf395('0x1d')](function(){return db[_0xf395('0x3d')][_0xf395('0x53')]({'raw':!![]});})['then'](function(_0x325942){var _0x20c9de=fs[_0xf395('0x59')](path[_0xf395('0x5a')](config['root'],_0xf395('0x5c')),_0xf395('0x5d'));var _0x1d6ded=ejs['render'](_0x20c9de,{'contexts':_0x325942});fs[_0xf395('0x66')](_0xf395('0x5e'),_0x1d6ded);return respondWithRpcPromise(_0xf395('0x67'),_0xf395('0x33'),{'module':_0xf395('0x68')});})[_0xf395('0x27')](handleError(_0x2ee246,null));}; \ No newline at end of file +var _0x09ef=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','send','index','map','VoiceContext','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','rows','show','params','rawAttributes','includeAll','include','options','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','chan_sip.so','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x45320c,_0x1fbf45){var _0xd4bdd4=function(_0x35a076){while(--_0x35a076){_0x45320c['push'](_0x45320c['shift']());}};_0xd4bdd4(++_0x1fbf45);}(_0x09ef,0x145));var _0xf09e=function(_0x19e409,_0xbd4727){_0x19e409=_0x19e409-0x0;var _0x535450=_0x09ef[_0x19e409];return _0x535450;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf09e('0x0'));var zipdir=require(_0xf09e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf09e('0x2'));var moment=require(_0xf09e('0x3'));var BPromise=require(_0xf09e('0x4'));var Mustache=require(_0xf09e('0x5'));var util=require(_0xf09e('0x6'));var path=require(_0xf09e('0x7'));var sox=require('sox');var csv=require(_0xf09e('0x8'));var ejs=require(_0xf09e('0x9'));var fs=require('fs');var fs_extra=require(_0xf09e('0xa'));var _=require(_0xf09e('0xb'));var squel=require(_0xf09e('0xc'));var crypto=require(_0xf09e('0xd'));var jsforce=require(_0xf09e('0xe'));var deskjs=require(_0xf09e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf09e('0x10'));var Papa=require(_0xf09e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf09e('0x12'));var as=require(_0xf09e('0x13'));var hardwareService=require(_0xf09e('0x14'));var logger=require(_0xf09e('0x15'))(_0xf09e('0x16'));var utils=require(_0xf09e('0x17'));var config=require(_0xf09e('0x18'));var licenseUtil=require(_0xf09e('0x19'));var db=require(_0xf09e('0x1a'))['db'];var jayson=require(_0xf09e('0x1b'));var client=jayson[_0xf09e('0x1c')][_0xf09e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54f444,_0x28d0eb,_0x2d88cc,_0x595517){return new BPromise(function(_0x12d2a4,_0x1253fc){var _0x28ceb9=_0x595517||client;return _0x28ceb9['request'](_0x54f444,_0x2d88cc)[_0xf09e('0x1e')](function(_0x477f7e){logger[_0xf09e('0x1f')](_0xf09e('0x20'),_0x28d0eb,'request\x20sent');logger[_0xf09e('0x21')](_0xf09e('0x22'),_0x28d0eb,_0xf09e('0x23'),JSON[_0xf09e('0x24')](_0x477f7e));if(_0x477f7e[_0xf09e('0x25')]){if(_0x477f7e['error'][_0xf09e('0x26')]===0x1f4){logger['error'](_0xf09e('0x20'),_0x28d0eb,_0x477f7e['error']['message']);return _0x1253fc(_0x477f7e[_0xf09e('0x25')][_0xf09e('0x27')]);}logger[_0xf09e('0x25')](_0xf09e('0x20'),_0x28d0eb,_0x477f7e[_0xf09e('0x25')][_0xf09e('0x27')]);return _0x12d2a4(_0x477f7e[_0xf09e('0x25')][_0xf09e('0x27')]);}else{logger[_0xf09e('0x1f')](_0xf09e('0x20'),_0x28d0eb,_0xf09e('0x23'));_0x12d2a4(_0x477f7e[_0xf09e('0x28')]['message']);}})[_0xf09e('0x29')](function(_0x4cf95a){logger[_0xf09e('0x25')](_0xf09e('0x20'),_0x28d0eb,_0x4cf95a);_0x1253fc(_0x4cf95a);});});}function respondWithStatusCode(_0x269ca9,_0x945612){_0x945612=_0x945612||0xcc;return function(_0x35a831){if(_0x35a831){return _0x269ca9[_0xf09e('0x2a')](_0x945612);}return _0x269ca9[_0xf09e('0x2b')](_0x945612)[_0xf09e('0x2c')]();};}function respondWithResult(_0x180624,_0x161f6f){_0x161f6f=_0x161f6f||0xc8;return function(_0x23c50e){if(_0x23c50e){return _0x180624[_0xf09e('0x2b')](_0x161f6f)[_0xf09e('0x2d')](_0x23c50e);}};}function respondWithFilteredResult(_0x19dd28,_0x227eef){return function(_0xd7da81){if(_0xd7da81){var _0x5f5438=typeof _0x227eef[_0xf09e('0x2e')]===_0xf09e('0x2f')&&typeof _0x227eef[_0xf09e('0x30')]===_0xf09e('0x2f');var _0x5d4254=_0xd7da81[_0xf09e('0x31')];var _0x141979=_0x5f5438?0x0:_0x227eef[_0xf09e('0x2e')];var _0xdd48d3=_0x5f5438?_0xd7da81['count']:_0x227eef[_0xf09e('0x2e')]+_0x227eef['limit'];var _0x4c1884;if(_0xdd48d3>=_0x5d4254){_0xdd48d3=_0x5d4254;_0x4c1884=0xc8;}else{_0x4c1884=0xce;}_0x19dd28[_0xf09e('0x2b')](_0x4c1884);return _0x19dd28[_0xf09e('0x32')](_0xf09e('0x33'),_0x141979+'-'+_0xdd48d3+'/'+_0x5d4254)[_0xf09e('0x2d')](_0xd7da81);}return null;};}function patchUpdates(_0x480309){return function(_0x319cd2){try{jsonpatch[_0xf09e('0x34')](_0x319cd2,_0x480309,!![]);}catch(_0x32487d){return BPromise[_0xf09e('0x35')](_0x32487d);}return _0x319cd2[_0xf09e('0x36')]();};}function saveUpdates(_0x11f071,_0x1be947){return function(_0x317805){if(_0x317805){return _0x317805[_0xf09e('0x37')](_0x11f071)[_0xf09e('0x1e')](function(_0x4fe08f){return _0x4fe08f;});}return null;};}function removeEntity(_0x43ecae,_0x1eb846){return function(_0x512c85){if(_0x512c85){return _0x512c85[_0xf09e('0x38')]()['then'](function(){var _0x4a38fe=_0x512c85[_0xf09e('0x39')]({'plain':!![]});var _0x3969de=_0xf09e('0x3a');return db[_0xf09e('0x3b')][_0xf09e('0x38')]({'where':{'type':_0x3969de,'resourceId':_0x4a38fe['id']}})[_0xf09e('0x1e')](function(){return _0x512c85;});})[_0xf09e('0x1e')](function(){_0x43ecae[_0xf09e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x468a2d,_0xd8c1ae){return function(_0x638ea8){if(!_0x638ea8){_0x468a2d[_0xf09e('0x2a')](0x194);}return _0x638ea8;};}function handleError(_0x368e72,_0x33926b){_0x33926b=_0x33926b||0x1f4;return function(_0x17ab8a){logger['error'](_0x17ab8a[_0xf09e('0x3c')]);if(_0x17ab8a['name']){delete _0x17ab8a['name'];}_0x368e72[_0xf09e('0x2b')](_0x33926b)[_0xf09e('0x3d')](_0x17ab8a);};}exports[_0xf09e('0x3e')]=function(_0x351463,_0x37c93b){var _0x4b8aef={},_0x479489={},_0x4f2eb4={'count':0x0,'rows':[]};var _0x18da69=_[_0xf09e('0x3f')](db[_0xf09e('0x40')]['rawAttributes'],function(_0x24cb15){return{'name':_0x24cb15[_0xf09e('0x41')],'type':_0x24cb15[_0xf09e('0x42')][_0xf09e('0x43')]};});_0x479489[_0xf09e('0x44')]=_[_0xf09e('0x3f')](_0x18da69,_0xf09e('0x45'));_0x479489[_0xf09e('0x46')]=_[_0xf09e('0x47')](_0x351463[_0xf09e('0x46')]);_0x479489[_0xf09e('0x48')]=_[_0xf09e('0x49')](_0x479489[_0xf09e('0x44')],_0x479489[_0xf09e('0x46')]);_0x4b8aef[_0xf09e('0x4a')]=_['intersection'](_0x479489[_0xf09e('0x44')],qs[_0xf09e('0x4b')](_0x351463[_0xf09e('0x46')][_0xf09e('0x4b')]));_0x4b8aef[_0xf09e('0x4a')]=_0x4b8aef['attributes'][_0xf09e('0x4c')]?_0x4b8aef[_0xf09e('0x4a')]:_0x479489[_0xf09e('0x44')];if(!_0x351463[_0xf09e('0x46')][_0xf09e('0x4d')]('nolimit')){_0x4b8aef[_0xf09e('0x30')]=qs[_0xf09e('0x30')](_0x351463[_0xf09e('0x46')][_0xf09e('0x30')]);_0x4b8aef[_0xf09e('0x2e')]=qs[_0xf09e('0x2e')](_0x351463[_0xf09e('0x46')][_0xf09e('0x2e')]);}_0x4b8aef[_0xf09e('0x4e')]=qs[_0xf09e('0x4f')](_0x351463[_0xf09e('0x46')][_0xf09e('0x4f')]);_0x4b8aef['where']=qs[_0xf09e('0x48')](_[_0xf09e('0x50')](_0x351463[_0xf09e('0x46')],_0x479489[_0xf09e('0x48')]),_0x18da69);if(_0x351463[_0xf09e('0x46')][_0xf09e('0x51')]){_0x4b8aef[_0xf09e('0x52')]=_[_0xf09e('0x53')](_0x4b8aef[_0xf09e('0x52')],{'$or':_[_0xf09e('0x3f')](_0x18da69,function(_0x1a941a){if(_0x1a941a[_0xf09e('0x42')]!=='VIRTUAL'){var _0x1f21ed={};_0x1f21ed[_0x1a941a[_0xf09e('0x45')]]={'$like':'%'+_0x351463[_0xf09e('0x46')][_0xf09e('0x51')]+'%'};return _0x1f21ed;}})});}_0x4b8aef=_[_0xf09e('0x53')]({},_0x4b8aef,_0x351463['options']);var _0x199634={'where':_0x4b8aef[_0xf09e('0x52')]};return db[_0xf09e('0x40')]['count'](_0x199634)[_0xf09e('0x1e')](function(_0x5524c7){_0x4f2eb4[_0xf09e('0x31')]=_0x5524c7;if(_0x351463[_0xf09e('0x46')]['includeAll']){_0x4b8aef['include']=[{'all':!![]}];}return db[_0xf09e('0x40')]['findAll'](_0x4b8aef);})[_0xf09e('0x1e')](function(_0x160663){_0x4f2eb4[_0xf09e('0x54')]=_0x160663;return _0x4f2eb4;})[_0xf09e('0x1e')](respondWithFilteredResult(_0x37c93b,_0x4b8aef))[_0xf09e('0x29')](handleError(_0x37c93b,null));};exports[_0xf09e('0x55')]=function(_0x15ee73,_0x5153e0){var _0x3fc77a={'raw':![],'where':{'id':_0x15ee73[_0xf09e('0x56')]['id']}},_0x453a21={};_0x453a21[_0xf09e('0x44')]=_[_0xf09e('0x47')](db['VoiceContext'][_0xf09e('0x57')]);_0x453a21[_0xf09e('0x46')]=_['keys'](_0x15ee73[_0xf09e('0x46')]);_0x453a21[_0xf09e('0x48')]=_[_0xf09e('0x49')](_0x453a21[_0xf09e('0x44')],_0x453a21[_0xf09e('0x46')]);_0x3fc77a[_0xf09e('0x4a')]=_['intersection'](_0x453a21[_0xf09e('0x44')],qs[_0xf09e('0x4b')](_0x15ee73['query'][_0xf09e('0x4b')]));_0x3fc77a['attributes']=_0x3fc77a[_0xf09e('0x4a')]['length']?_0x3fc77a[_0xf09e('0x4a')]:_0x453a21[_0xf09e('0x44')];if(_0x15ee73[_0xf09e('0x46')][_0xf09e('0x58')]){_0x3fc77a[_0xf09e('0x59')]=[{'all':!![]}];}_0x3fc77a=_[_0xf09e('0x53')]({},_0x3fc77a,_0x15ee73[_0xf09e('0x5a')]);return db[_0xf09e('0x40')]['find'](_0x3fc77a)[_0xf09e('0x1e')](handleEntityNotFound(_0x5153e0,null))[_0xf09e('0x1e')](respondWithResult(_0x5153e0,null))[_0xf09e('0x29')](handleError(_0x5153e0,null));};exports[_0xf09e('0x5b')]=function(_0x4ad157,_0xbbd91e,_0xc7b184){var _0x5177a9;return db[_0xf09e('0x40')][_0xf09e('0x5b')](_0x4ad157[_0xf09e('0x5c')],{'raw':!![]})[_0xf09e('0x1e')](function(_0x3fdaea){_0x5177a9=_0x3fdaea;return db[_0xf09e('0x40')][_0xf09e('0x5d')]({'raw':!![]});})[_0xf09e('0x1e')](function(_0x521916){var _0x591cda=fs[_0xf09e('0x5e')](path[_0xf09e('0x5f')](config[_0xf09e('0x60')],_0xf09e('0x61')),_0xf09e('0x62'));var _0x39a2d9=ejs[_0xf09e('0x63')](_0x591cda,{'contexts':_0x521916||[]});fs[_0xf09e('0x64')](_0xf09e('0x65'),_0x39a2d9);})[_0xf09e('0x1e')](function(){return respondWithRpcPromise(_0xf09e('0x66'),_0xf09e('0x5b'),{'module':'chan_sip.so'});})[_0xf09e('0x1e')](function(){var _0x3011d0=_0x4ad157['user']['get']({'plain':!![]});if(!_0x3011d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3011d0[_0xf09e('0x67')]===_0xf09e('0x68')){var _0x1ac7e0=_0x5177a9[_0xf09e('0x39')]({'plain':!![]});return db[_0xf09e('0x69')]['find']({'where':{'name':_0xf09e('0x3a'),'userProfileId':_0x3011d0['userProfileId']},'raw':!![]})[_0xf09e('0x1e')](function(_0x2da8c8){if(_0x2da8c8&&_0x2da8c8[_0xf09e('0x6a')]===0x0){return db['UserProfileResource']['create']({'name':_0x1ac7e0[_0xf09e('0x45')],'resourceId':_0x1ac7e0['id'],'type':_0x2da8c8[_0xf09e('0x45')],'sectionId':_0x2da8c8['id']},{})[_0xf09e('0x1e')](function(){return _0x5177a9;});}else{return _0x5177a9;}})[_0xf09e('0x29')](function(_0x137b05){logger[_0xf09e('0x25')](_0xf09e('0x6b'),_0x137b05);throw _0x137b05;});}return _0x5177a9;})[_0xf09e('0x1e')](respondWithResult(_0xbbd91e,0xc9))['catch'](handleError(_0xbbd91e,null));};exports[_0xf09e('0x37')]=function(_0x9f924a,_0x1a3e03,_0x35cff6){var _0x506594;return db['VoiceContext'][_0xf09e('0x6c')]({'where':{'id':_0x9f924a[_0xf09e('0x56')]['id']}})[_0xf09e('0x1e')](handleEntityNotFound(_0x1a3e03,null))[_0xf09e('0x1e')](saveUpdates(_0x9f924a['body'],null))[_0xf09e('0x1e')](function(_0x52de45){if(_0x52de45){_0x506594=_0x52de45;return db[_0xf09e('0x40')][_0xf09e('0x5d')]({'raw':!![]});}})[_0xf09e('0x1e')](function(_0x43798c){var _0x2dd5da=fs[_0xf09e('0x5e')](path[_0xf09e('0x5f')](config[_0xf09e('0x60')],'server/files/templates/context.ejs'),_0xf09e('0x62'));var _0x6a5b49=ejs['render'](_0x2dd5da,{'contexts':_0x43798c||[]});fs[_0xf09e('0x64')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x6a5b49);})[_0xf09e('0x1e')](function(){return respondWithRpcPromise(_0xf09e('0x66'),_0xf09e('0x37'),{'module':_0xf09e('0x6d')});})[_0xf09e('0x1e')](function(){return _0x506594;})['then'](respondWithResult(_0x1a3e03,null))[_0xf09e('0x29')](handleError(_0x1a3e03,null));};exports[_0xf09e('0x38')]=function(_0x568928,_0x3c9078,_0x1152f2){var _0x29f9b6;return db['VoiceContext']['find']({'where':{'id':_0x568928[_0xf09e('0x56')]['id']}})[_0xf09e('0x1e')](handleEntityNotFound(_0x3c9078,null))[_0xf09e('0x1e')](removeEntity(_0x3c9078,null))['then'](function(){return db[_0xf09e('0x40')][_0xf09e('0x5d')]({'raw':!![]});})['then'](function(_0x11a4d9){var _0x37095b=fs[_0xf09e('0x5e')](path['join'](config[_0xf09e('0x60')],_0xf09e('0x61')),_0xf09e('0x62'));var _0x5eb8dc=ejs[_0xf09e('0x63')](_0x37095b,{'contexts':_0x11a4d9});fs[_0xf09e('0x64')](_0xf09e('0x65'),_0x5eb8dc);return respondWithRpcPromise(_0xf09e('0x66'),_0xf09e('0x38'),{'module':'chan_sip.so'});})[_0xf09e('0x29')](handleError(_0x3c9078,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 072e35e..0dfa10f 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 _0x117e=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','define','VoiceContext','voice_contexts','lodash'];(function(_0x78ac8e,_0x34f635){var _0x242d93=function(_0x1660b0){while(--_0x1660b0){_0x78ac8e['push'](_0x78ac8e['shift']());}};_0x242d93(++_0x34f635);}(_0x117e,0xc5));var _0xe117=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x117e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe117('0x0'));var util=require(_0xe117('0x1'));var logger=require(_0xe117('0x2'))(_0xe117('0x3'));var moment=require('moment');var BPromise=require(_0xe117('0x4'));var rp=require(_0xe117('0x5'));var fs=require('fs');var path=require(_0xe117('0x6'));var rimraf=require(_0xe117('0x7'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module['exports']=function(_0x2eb08d,_0x80a325){return _0x2eb08d[_0xe117('0x8')](_0xe117('0x9'),attributes,{'tableName':_0xe117('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x330c=['./voiceContext.attributes','exports','define','VoiceContext','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x4cb086,_0x4cc048){var _0x10d1af=function(_0x296e16){while(--_0x296e16){_0x4cb086['push'](_0x4cb086['shift']());}};_0x10d1af(++_0x4cc048);}(_0x330c,0x14e));var _0xc330=function(_0x3251f2,_0x1eca2f){_0x3251f2=_0x3251f2-0x0;var _0x4a2b38=_0x330c[_0x3251f2];return _0x4a2b38;};'use strict';var _=require('lodash');var util=require(_0xc330('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc330('0x1'));var BPromise=require(_0xc330('0x2'));var rp=require(_0xc330('0x3'));var fs=require('fs');var path=require(_0xc330('0x4'));var rimraf=require(_0xc330('0x5'));var config=require('../../config/environment');var attributes=require(_0xc330('0x6'));module[_0xc330('0x7')]=function(_0x2faeec,_0x329d61){return _0x2faeec[_0xc330('0x8')](_0xc330('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index ada5853..45eb029 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 _0x20df=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x361ab9,_0x54e6b9){var _0x51d018=function(_0x598c8a){while(--_0x598c8a){_0x361ab9['push'](_0x361ab9['shift']());}};_0x51d018(++_0x54e6b9);}(_0x20df,0x7c));var _0xf20d=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x20df[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require(_0xf20d('0x0'));var util=require(_0xf20d('0x1'));var moment=require(_0xf20d('0x2'));var BPromise=require(_0xf20d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20d('0x4'));var db=require(_0xf20d('0x5'))['db'];var utils=require(_0xf20d('0x6'));var logger=require(_0xf20d('0x7'))(_0xf20d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf20d('0x9'));var client=jayson['client'][_0xf20d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d0da,_0x53a7b5,_0x184c8d){return new BPromise(function(_0x5f0353,_0x4f36d1){return client['request'](_0x41d0da,_0x184c8d)[_0xf20d('0xb')](function(_0x22b427){logger[_0xf20d('0xc')](_0xf20d('0xd'),_0x53a7b5,'request\x20sent');logger[_0xf20d('0xe')](_0xf20d('0xf'),_0x53a7b5,_0xf20d('0x10'),JSON[_0xf20d('0x11')](_0x22b427));if(_0x22b427[_0xf20d('0x12')]){if(_0x22b427[_0xf20d('0x12')][_0xf20d('0x13')]===0x1f4){logger[_0xf20d('0x12')]('VoiceContext,\x20%s,\x20%s',_0x53a7b5,_0x22b427[_0xf20d('0x12')]['message']);return _0x4f36d1(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}logger['error'](_0xf20d('0xd'),_0x53a7b5,_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);return _0x5f0353(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x53a7b5,_0xf20d('0x10'));_0x5f0353(_0x22b427[_0xf20d('0x15')][_0xf20d('0x14')]);}})[_0xf20d('0x16')](function(_0x53c164){logger[_0xf20d('0x12')]('VoiceContext,\x20%s,\x20%s',_0x53a7b5,_0x53c164);_0x4f36d1(_0x53c164);});});} \ No newline at end of file +var _0xa5df=['randomstring','../../config/utils','../../config/environment','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0xa5df,0xe8));var _0xfa5d=function(_0x5ec62d,_0x49c2a1){_0x5ec62d=_0x5ec62d-0x0;var _0x1b1750=_0xa5df[_0x5ec62d];return _0x1b1750;};'use strict';var _=require(_0xfa5d('0x0'));var util=require(_0xfa5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa5d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfa5d('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xfa5d('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6245,_0x5bc116,_0x39029b){return new BPromise(function(_0x148c3a,_0x4d2449){return client[_0xfa5d('0x5')](_0x4e6245,_0x39029b)['then'](function(_0x51b1af){logger[_0xfa5d('0x6')](_0xfa5d('0x7'),_0x5bc116,_0xfa5d('0x8'));logger['debug'](_0xfa5d('0x9'),_0x5bc116,_0xfa5d('0x8'),JSON['stringify'](_0x51b1af));if(_0x51b1af[_0xfa5d('0xa')]){if(_0x51b1af[_0xfa5d('0xa')]['code']===0x1f4){logger['error'](_0xfa5d('0x7'),_0x5bc116,_0x51b1af['error']['message']);return _0x4d2449(_0x51b1af[_0xfa5d('0xa')][_0xfa5d('0xb')]);}logger[_0xfa5d('0xa')]('VoiceContext,\x20%s,\x20%s',_0x5bc116,_0x51b1af['error'][_0xfa5d('0xb')]);return _0x148c3a(_0x51b1af['error'][_0xfa5d('0xb')]);}else{logger[_0xfa5d('0x6')](_0xfa5d('0x7'),_0x5bc116,_0xfa5d('0x8'));_0x148c3a(_0x51b1af['result'][_0xfa5d('0xb')]);}})[_0xfa5d('0xc')](function(_0xdd78ed){logger[_0xfa5d('0xa')]('VoiceContext,\x20%s,\x20%s',_0x5bc116,_0xdd78ed);_0x4d2449(_0xdd78ed);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 56e1b9f..42dbd8e 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 _0xe617=['../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','util','connect-timeout','Router'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xe617,0x13f));var _0x7e61=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe617[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x7e61('0x0'));var util=require(_0x7e61('0x1'));var path=require('path');var timeout=require(_0x7e61('0x2'));var express=require('express');var router=express[_0x7e61('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7e61('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7e61('0x5'));var controller=require(_0x7e61('0x6'));router[_0x7e61('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e61('0x7')](_0x7e61('0x8'),auth[_0x7e61('0x9')](),controller[_0x7e61('0xa')]);router[_0x7e61('0x7')](_0x7e61('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7e61('0xc')]('/',auth[_0x7e61('0x9')](),controller[_0x7e61('0xd')]);router['put'](_0x7e61('0xb'),auth[_0x7e61('0x9')](),controller[_0x7e61('0xe')]);router[_0x7e61('0xf')](_0x7e61('0xb'),auth[_0x7e61('0x9')](),controller['destroy']);module[_0x7e61('0x10')]=router; \ No newline at end of file +var _0x5fbd=['/:id','show','post','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','describe'];(function(_0x3018fb,_0x507e28){var _0x557c8c=function(_0x1ede9f){while(--_0x1ede9f){_0x3018fb['push'](_0x3018fb['shift']());}};_0x557c8c(++_0x507e28);}(_0x5fbd,0x1bd));var _0xd5fb=function(_0x2af352,_0x20b539){_0x2af352=_0x2af352-0x0;var _0x38ab74=_0x5fbd[_0x2af352];return _0x38ab74;};'use strict';var multer=require(_0xd5fb('0x0'));var util=require('util');var path=require(_0xd5fb('0x1'));var timeout=require('connect-timeout');var express=require(_0xd5fb('0x2'));var router=express['Router']();var fs_extra=require(_0xd5fb('0x3'));var auth=require(_0xd5fb('0x4'));var interaction=require(_0xd5fb('0x5'));var config=require(_0xd5fb('0x6'));var controller=require(_0xd5fb('0x7'));router[_0xd5fb('0x8')]('/',auth[_0xd5fb('0x9')](),controller['index']);router[_0xd5fb('0x8')]('/describe',auth[_0xd5fb('0x9')](),controller[_0xd5fb('0xa')]);router[_0xd5fb('0x8')](_0xd5fb('0xb'),auth[_0xd5fb('0x9')](),controller[_0xd5fb('0xc')]);router[_0xd5fb('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd5fb('0xe')](_0xd5fb('0xb'),auth[_0xd5fb('0x9')](),controller[_0xd5fb('0xf')]);router[_0xd5fb('0x10')](_0xd5fb('0xb'),auth[_0xd5fb('0x9')](),controller[_0xd5fb('0x11')]);module[_0xd5fb('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8115203..4993611 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 _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x9fa8c3,_0x2e59b2){var _0x79b768=function(_0x39a132){while(--_0x39a132){_0x9fa8c3['push'](_0x9fa8c3['shift']());}};_0x79b768(++_0x2e59b2);}(_0xbec5,0xe5));var _0x5bec=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xbec5[_0x48ec91];return _0x22766c;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file +var _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x552352,_0x51e3b0){var _0x1e0d71=function(_0xa0c4f5){while(--_0xa0c4f5){_0x552352['push'](_0x552352['shift']());}};_0x1e0d71(++_0x51e3b0);}(_0x8ef6,0xf2));var _0x68ef=function(_0x104346,_0x1f0eb0){_0x104346=_0x104346-0x0;var _0x566af7=_0x8ef6[_0x104346];return _0x566af7;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index dd7e300..664dfa2 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 _0x425e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','fieldName','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','filter','merge','where','type','VoiceDialReport','includeAll','include','findAll','show','params','rawAttributes','intersection','length','options','find','create','body','catch','describe','eml-format','rimraf','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x425e,0x11e));var _0xe425=function(_0x29bc2e,_0xf94885){_0x29bc2e=_0x29bc2e-0x0;var _0x19b2c6=_0x425e[_0x29bc2e];return _0x19b2c6;};'use strict';var emlformat=require(_0xe425('0x0'));var rimraf=require(_0xe425('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe425('0x2'));var Mustache=require('mustache');var util=require(_0xe425('0x3'));var path=require(_0xe425('0x4'));var sox=require(_0xe425('0x5'));var csv=require(_0xe425('0x6'));var ejs=require(_0xe425('0x7'));var fs=require('fs');var fs_extra=require(_0xe425('0x8'));var _=require(_0xe425('0x9'));var squel=require(_0xe425('0xa'));var crypto=require(_0xe425('0xb'));var jsforce=require(_0xe425('0xc'));var deskjs=require(_0xe425('0xd'));var toCsv=require(_0xe425('0x6'));var querystring=require(_0xe425('0xe'));var Papa=require(_0xe425('0xf'));var Redis=require(_0xe425('0x10'));var authService=require(_0xe425('0x11'));var qs=require(_0xe425('0x12'));var as=require(_0xe425('0x13'));var hardwareService=require(_0xe425('0x14'));var logger=require(_0xe425('0x15'))(_0xe425('0x16'));var utils=require(_0xe425('0x17'));var config=require(_0xe425('0x18'));var licenseUtil=require(_0xe425('0x19'));var db=require(_0xe425('0x1a'))['db'];function respondWithStatusCode(_0x166c1f,_0x4c481b){_0x4c481b=_0x4c481b||0xcc;return function(_0x14f919){if(_0x14f919){return _0x166c1f[_0xe425('0x1b')](_0x4c481b);}return _0x166c1f[_0xe425('0x1c')](_0x4c481b)[_0xe425('0x1d')]();};}function respondWithResult(_0x211482,_0x10ee8d){_0x10ee8d=_0x10ee8d||0xc8;return function(_0x386e87){if(_0x386e87){return _0x211482[_0xe425('0x1c')](_0x10ee8d)[_0xe425('0x1e')](_0x386e87);}};}function respondWithFilteredResult(_0x4a700e,_0x38a50f){return function(_0x3eef30){if(_0x3eef30){var _0x56e8d7=typeof _0x38a50f['offset']===_0xe425('0x1f')&&typeof _0x38a50f[_0xe425('0x20')]===_0xe425('0x1f');var _0x11ee48=_0x3eef30[_0xe425('0x21')];var _0x5bcc66=_0x56e8d7?0x0:_0x38a50f[_0xe425('0x22')];var _0x269d10=_0x56e8d7?_0x3eef30[_0xe425('0x21')]:_0x38a50f[_0xe425('0x22')]+_0x38a50f['limit'];var _0x48c94f;if(_0x269d10>=_0x11ee48){_0x269d10=_0x11ee48;_0x48c94f=0xc8;}else{_0x48c94f=0xce;}_0x4a700e[_0xe425('0x1c')](_0x48c94f);return _0x4a700e[_0xe425('0x23')](_0xe425('0x24'),_0x5bcc66+'-'+_0x269d10+'/'+_0x11ee48)['json'](_0x3eef30);}return null;};}function patchUpdates(_0xead687){return function(_0x4d4127){try{jsonpatch[_0xe425('0x25')](_0x4d4127,_0xead687,!![]);}catch(_0xd036cc){return BPromise[_0xe425('0x26')](_0xd036cc);}return _0x4d4127['save']();};}function saveUpdates(_0x502dd9,_0xd29dfe){return function(_0x3e2872){if(_0x3e2872){return _0x3e2872[_0xe425('0x27')](_0x502dd9)[_0xe425('0x28')](function(_0x4fa726){return _0x4fa726;});}return null;};}function removeEntity(_0x83e28,_0x4c9d52){return function(_0x535ba1){if(_0x535ba1){return _0x535ba1[_0xe425('0x29')]()[_0xe425('0x28')](function(){_0x83e28[_0xe425('0x1c')](0xcc)[_0xe425('0x1d')]();});}};}function handleEntityNotFound(_0x197985,_0x1d163e){return function(_0x148220){if(!_0x148220){_0x197985[_0xe425('0x1b')](0x194);}return _0x148220;};}function handleError(_0x559224,_0x2b690d){_0x2b690d=_0x2b690d||0x1f4;return function(_0x290a74){logger[_0xe425('0x2a')](_0x290a74['stack']);if(_0x290a74['name']){delete _0x290a74[_0xe425('0x2b')];}_0x559224['status'](_0x2b690d)['send'](_0x290a74);};}exports[_0xe425('0x2c')]=function(_0x51f5c8,_0x3443d4){var _0x26418b={},_0x14838b={},_0x2d312b={'count':0x0,'rows':[]};var _0x4a8622=_[_0xe425('0x2d')](db['VoiceDialReport']['rawAttributes'],function(_0x4ded2d){return{'name':_0x4ded2d[_0xe425('0x2e')],'type':_0x4ded2d['type'][_0xe425('0x2f')]};});_0x14838b[_0xe425('0x30')]=_['map'](_0x4a8622,_0xe425('0x2b'));_0x14838b[_0xe425('0x31')]=_[_0xe425('0x32')](_0x51f5c8[_0xe425('0x31')]);_0x14838b[_0xe425('0x33')]=_['intersection'](_0x14838b['model'],_0x14838b['query']);_0x26418b[_0xe425('0x34')]=_['intersection'](_0x14838b[_0xe425('0x30')],qs[_0xe425('0x35')](_0x51f5c8['query'][_0xe425('0x35')]));_0x26418b['attributes']=_0x26418b[_0xe425('0x34')]['length']?_0x26418b[_0xe425('0x34')]:_0x14838b[_0xe425('0x30')];if(!_0x51f5c8['query']['hasOwnProperty'](_0xe425('0x36'))){_0x26418b[_0xe425('0x20')]=qs[_0xe425('0x20')](_0x51f5c8[_0xe425('0x31')][_0xe425('0x20')]);_0x26418b['offset']=qs['offset'](_0x51f5c8[_0xe425('0x31')][_0xe425('0x22')]);}_0x26418b[_0xe425('0x37')]=qs[_0xe425('0x38')](_0x51f5c8[_0xe425('0x31')][_0xe425('0x38')]);_0x26418b['where']=qs['filters'](_['pick'](_0x51f5c8[_0xe425('0x31')],_0x14838b[_0xe425('0x33')]),_0x4a8622);if(_0x51f5c8[_0xe425('0x31')][_0xe425('0x39')]){_0x26418b['where']=_[_0xe425('0x3a')](_0x26418b[_0xe425('0x3b')],{'$or':_[_0xe425('0x2d')](_0x4a8622,function(_0x10ec08){if(_0x10ec08[_0xe425('0x3c')]!=='VIRTUAL'){var _0x14e58b={};_0x14e58b[_0x10ec08[_0xe425('0x2b')]]={'$like':'%'+_0x51f5c8[_0xe425('0x31')][_0xe425('0x39')]+'%'};return _0x14e58b;}})});}_0x26418b=_[_0xe425('0x3a')]({},_0x26418b,_0x51f5c8['options']);var _0x9751ad={'where':_0x26418b['where']};return db[_0xe425('0x3d')][_0xe425('0x21')](_0x9751ad)['then'](function(_0x4221ea){_0x2d312b['count']=_0x4221ea;if(_0x51f5c8['query'][_0xe425('0x3e')]){_0x26418b[_0xe425('0x3f')]=[{'all':!![]}];}return db[_0xe425('0x3d')][_0xe425('0x40')](_0x26418b);})[_0xe425('0x28')](function(_0x9968ae){_0x2d312b['rows']=_0x9968ae;return _0x2d312b;})['then'](respondWithFilteredResult(_0x3443d4,_0x26418b))['catch'](handleError(_0x3443d4,null));};exports[_0xe425('0x41')]=function(_0x33aa38,_0x41100c){var _0x59effe={'raw':!![],'where':{'id':_0x33aa38[_0xe425('0x42')]['id']}},_0x502a25={};_0x502a25[_0xe425('0x30')]=_['keys'](db[_0xe425('0x3d')][_0xe425('0x43')]);_0x502a25['query']=_['keys'](_0x33aa38[_0xe425('0x31')]);_0x502a25['filters']=_[_0xe425('0x44')](_0x502a25[_0xe425('0x30')],_0x502a25[_0xe425('0x31')]);_0x59effe['attributes']=_[_0xe425('0x44')](_0x502a25[_0xe425('0x30')],qs[_0xe425('0x35')](_0x33aa38[_0xe425('0x31')][_0xe425('0x35')]));_0x59effe[_0xe425('0x34')]=_0x59effe[_0xe425('0x34')][_0xe425('0x45')]?_0x59effe[_0xe425('0x34')]:_0x502a25[_0xe425('0x30')];if(_0x33aa38['query'][_0xe425('0x3e')]){_0x59effe[_0xe425('0x3f')]=[{'all':!![]}];}_0x59effe=_['merge']({},_0x59effe,_0x33aa38[_0xe425('0x46')]);return db[_0xe425('0x3d')][_0xe425('0x47')](_0x59effe)['then'](handleEntityNotFound(_0x41100c,null))['then'](respondWithResult(_0x41100c,null))['catch'](handleError(_0x41100c,null));};exports['create']=function(_0x31f214,_0x5da6f5){return db['VoiceDialReport'][_0xe425('0x48')](_0x31f214[_0xe425('0x49')],{})[_0xe425('0x28')](respondWithResult(_0x5da6f5,0xc9))['catch'](handleError(_0x5da6f5,null));};exports['update']=function(_0x17bbdf,_0x34e304){if(_0x17bbdf['body']['id']){delete _0x17bbdf[_0xe425('0x49')]['id'];}return db['VoiceDialReport'][_0xe425('0x47')]({'where':{'id':_0x17bbdf[_0xe425('0x42')]['id']}})['then'](handleEntityNotFound(_0x34e304,null))[_0xe425('0x28')](saveUpdates(_0x17bbdf[_0xe425('0x49')],null))[_0xe425('0x28')](respondWithResult(_0x34e304,null))[_0xe425('0x4a')](handleError(_0x34e304,null));};exports['destroy']=function(_0x46aa32,_0x4d41e0){return db[_0xe425('0x3d')][_0xe425('0x47')]({'where':{'id':_0x46aa32[_0xe425('0x42')]['id']}})[_0xe425('0x28')](handleEntityNotFound(_0x4d41e0,null))[_0xe425('0x28')](removeEntity(_0x4d41e0,null))[_0xe425('0x4a')](handleError(_0x4d41e0,null));};exports[_0xe425('0x4b')]=function(_0x1d80e4,_0x1c8df9){return db[_0xe425('0x3d')][_0xe425('0x4b')]()[_0xe425('0x28')](respondWithResult(_0x1c8df9,null))[_0xe425('0x4a')](handleError(_0x1c8df9,null));}; \ No newline at end of file +var _0xac2a=['then','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','catch','create','body','find','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update'];(function(_0x1f77a4,_0x375e75){var _0x37d164=function(_0x546837){while(--_0x546837){_0x1f77a4['push'](_0x1f77a4['shift']());}};_0x37d164(++_0x375e75);}(_0xac2a,0x118));var _0xaac2=function(_0x58c13e,_0x341742){_0x58c13e=_0x58c13e-0x0;var _0x57d5ee=_0xac2a[_0x58c13e];return _0x57d5ee;};'use strict';var emlformat=require(_0xaac2('0x0'));var rimraf=require(_0xaac2('0x1'));var zipdir=require(_0xaac2('0x2'));var jsonpatch=require(_0xaac2('0x3'));var rp=require(_0xaac2('0x4'));var moment=require(_0xaac2('0x5'));var BPromise=require(_0xaac2('0x6'));var Mustache=require(_0xaac2('0x7'));var util=require('util');var path=require(_0xaac2('0x8'));var sox=require(_0xaac2('0x9'));var csv=require(_0xaac2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaac2('0xb'));var _=require(_0xaac2('0xc'));var squel=require('squel');var crypto=require(_0xaac2('0xd'));var jsforce=require(_0xaac2('0xe'));var deskjs=require(_0xaac2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaac2('0x10'));var Papa=require(_0xaac2('0x11'));var Redis=require(_0xaac2('0x12'));var authService=require(_0xaac2('0x13'));var qs=require(_0xaac2('0x14'));var as=require(_0xaac2('0x15'));var hardwareService=require(_0xaac2('0x16'));var logger=require(_0xaac2('0x17'))(_0xaac2('0x18'));var utils=require(_0xaac2('0x19'));var config=require(_0xaac2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xaac2('0x1b'))['db'];function respondWithStatusCode(_0x1ff82b,_0x301d88){_0x301d88=_0x301d88||0xcc;return function(_0x178e9e){if(_0x178e9e){return _0x1ff82b[_0xaac2('0x1c')](_0x301d88);}return _0x1ff82b[_0xaac2('0x1d')](_0x301d88)['end']();};}function respondWithResult(_0x4188d2,_0x47480a){_0x47480a=_0x47480a||0xc8;return function(_0x546421){if(_0x546421){return _0x4188d2[_0xaac2('0x1d')](_0x47480a)['json'](_0x546421);}};}function respondWithFilteredResult(_0x3eac4a,_0x517d71){return function(_0x1c3fa0){if(_0x1c3fa0){var _0x6ca9a=typeof _0x517d71[_0xaac2('0x1e')]===_0xaac2('0x1f')&&typeof _0x517d71['limit']===_0xaac2('0x1f');var _0x1d76f6=_0x1c3fa0[_0xaac2('0x20')];var _0x5c606f=_0x6ca9a?0x0:_0x517d71[_0xaac2('0x1e')];var _0x29d77b=_0x6ca9a?_0x1c3fa0[_0xaac2('0x20')]:_0x517d71[_0xaac2('0x1e')]+_0x517d71[_0xaac2('0x21')];var _0x1baa6c;if(_0x29d77b>=_0x1d76f6){_0x29d77b=_0x1d76f6;_0x1baa6c=0xc8;}else{_0x1baa6c=0xce;}_0x3eac4a[_0xaac2('0x1d')](_0x1baa6c);return _0x3eac4a[_0xaac2('0x22')](_0xaac2('0x23'),_0x5c606f+'-'+_0x29d77b+'/'+_0x1d76f6)[_0xaac2('0x24')](_0x1c3fa0);}return null;};}function patchUpdates(_0x2b935e){return function(_0x37486d){try{jsonpatch[_0xaac2('0x25')](_0x37486d,_0x2b935e,!![]);}catch(_0x1d8f7e){return BPromise[_0xaac2('0x26')](_0x1d8f7e);}return _0x37486d['save']();};}function saveUpdates(_0x317a07,_0x146a97){return function(_0x232e28){if(_0x232e28){return _0x232e28[_0xaac2('0x27')](_0x317a07)[_0xaac2('0x28')](function(_0x335aac){return _0x335aac;});}return null;};}function removeEntity(_0xd2ede,_0x3e1025){return function(_0x199dec){if(_0x199dec){return _0x199dec['destroy']()[_0xaac2('0x28')](function(){_0xd2ede[_0xaac2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x293e01,_0x4c4061){return function(_0x22cf4c){if(!_0x22cf4c){_0x293e01['sendStatus'](0x194);}return _0x22cf4c;};}function handleError(_0x18754b,_0x8c312a){_0x8c312a=_0x8c312a||0x1f4;return function(_0x2bc57d){logger[_0xaac2('0x29')](_0x2bc57d[_0xaac2('0x2a')]);if(_0x2bc57d['name']){delete _0x2bc57d[_0xaac2('0x2b')];}_0x18754b[_0xaac2('0x1d')](_0x8c312a)['send'](_0x2bc57d);};}exports[_0xaac2('0x2c')]=function(_0x1c5501,_0x2905e1){var _0x353735={},_0x444d65={},_0x294108={'count':0x0,'rows':[]};var _0x29113f=_[_0xaac2('0x2d')](db[_0xaac2('0x2e')][_0xaac2('0x2f')],function(_0xe591f){return{'name':_0xe591f[_0xaac2('0x30')],'type':_0xe591f[_0xaac2('0x31')][_0xaac2('0x32')]};});_0x444d65[_0xaac2('0x33')]=_[_0xaac2('0x2d')](_0x29113f,_0xaac2('0x2b'));_0x444d65[_0xaac2('0x34')]=_[_0xaac2('0x35')](_0x1c5501[_0xaac2('0x34')]);_0x444d65[_0xaac2('0x36')]=_[_0xaac2('0x37')](_0x444d65[_0xaac2('0x33')],_0x444d65[_0xaac2('0x34')]);_0x353735['attributes']=_[_0xaac2('0x37')](_0x444d65[_0xaac2('0x33')],qs[_0xaac2('0x38')](_0x1c5501[_0xaac2('0x34')]['fields']));_0x353735['attributes']=_0x353735[_0xaac2('0x39')][_0xaac2('0x3a')]?_0x353735[_0xaac2('0x39')]:_0x444d65[_0xaac2('0x33')];if(!_0x1c5501[_0xaac2('0x34')][_0xaac2('0x3b')](_0xaac2('0x3c'))){_0x353735['limit']=qs[_0xaac2('0x21')](_0x1c5501['query'][_0xaac2('0x21')]);_0x353735[_0xaac2('0x1e')]=qs[_0xaac2('0x1e')](_0x1c5501['query']['offset']);}_0x353735[_0xaac2('0x3d')]=qs[_0xaac2('0x3e')](_0x1c5501[_0xaac2('0x34')]['sort']);_0x353735[_0xaac2('0x3f')]=qs[_0xaac2('0x36')](_[_0xaac2('0x40')](_0x1c5501[_0xaac2('0x34')],_0x444d65['filters']),_0x29113f);if(_0x1c5501[_0xaac2('0x34')][_0xaac2('0x41')]){_0x353735[_0xaac2('0x3f')]=_[_0xaac2('0x42')](_0x353735[_0xaac2('0x3f')],{'$or':_[_0xaac2('0x2d')](_0x29113f,function(_0x11bb2c){if(_0x11bb2c[_0xaac2('0x31')]!==_0xaac2('0x43')){var _0x5994d8={};_0x5994d8[_0x11bb2c['name']]={'$like':'%'+_0x1c5501[_0xaac2('0x34')][_0xaac2('0x41')]+'%'};return _0x5994d8;}})});}_0x353735=_[_0xaac2('0x42')]({},_0x353735,_0x1c5501[_0xaac2('0x44')]);var _0xea3640={'where':_0x353735[_0xaac2('0x3f')]};return db[_0xaac2('0x2e')]['count'](_0xea3640)['then'](function(_0x3b051f){_0x294108[_0xaac2('0x20')]=_0x3b051f;if(_0x1c5501['query'][_0xaac2('0x45')]){_0x353735[_0xaac2('0x46')]=[{'all':!![]}];}return db[_0xaac2('0x2e')][_0xaac2('0x47')](_0x353735);})[_0xaac2('0x28')](function(_0x3294ad){_0x294108['rows']=_0x3294ad;return _0x294108;})[_0xaac2('0x28')](respondWithFilteredResult(_0x2905e1,_0x353735))['catch'](handleError(_0x2905e1,null));};exports[_0xaac2('0x48')]=function(_0x409a54,_0x5b8e2f){var _0x48c608={'raw':!![],'where':{'id':_0x409a54['params']['id']}},_0x4216ab={};_0x4216ab[_0xaac2('0x33')]=_[_0xaac2('0x35')](db[_0xaac2('0x2e')][_0xaac2('0x2f')]);_0x4216ab['query']=_['keys'](_0x409a54['query']);_0x4216ab['filters']=_[_0xaac2('0x37')](_0x4216ab[_0xaac2('0x33')],_0x4216ab[_0xaac2('0x34')]);_0x48c608['attributes']=_[_0xaac2('0x37')](_0x4216ab['model'],qs[_0xaac2('0x38')](_0x409a54[_0xaac2('0x34')][_0xaac2('0x38')]));_0x48c608[_0xaac2('0x39')]=_0x48c608['attributes'][_0xaac2('0x3a')]?_0x48c608[_0xaac2('0x39')]:_0x4216ab[_0xaac2('0x33')];if(_0x409a54['query'][_0xaac2('0x45')]){_0x48c608[_0xaac2('0x46')]=[{'all':!![]}];}_0x48c608=_[_0xaac2('0x42')]({},_0x48c608,_0x409a54[_0xaac2('0x44')]);return db[_0xaac2('0x2e')]['find'](_0x48c608)['then'](handleEntityNotFound(_0x5b8e2f,null))[_0xaac2('0x28')](respondWithResult(_0x5b8e2f,null))[_0xaac2('0x49')](handleError(_0x5b8e2f,null));};exports[_0xaac2('0x4a')]=function(_0x26f1d5,_0x5ce36a){return db[_0xaac2('0x2e')][_0xaac2('0x4a')](_0x26f1d5['body'],{})[_0xaac2('0x28')](respondWithResult(_0x5ce36a,0xc9))[_0xaac2('0x49')](handleError(_0x5ce36a,null));};exports['update']=function(_0x5b335c,_0x4e3b10){if(_0x5b335c[_0xaac2('0x4b')]['id']){delete _0x5b335c[_0xaac2('0x4b')]['id'];}return db['VoiceDialReport'][_0xaac2('0x4c')]({'where':{'id':_0x5b335c['params']['id']}})['then'](handleEntityNotFound(_0x4e3b10,null))['then'](saveUpdates(_0x5b335c[_0xaac2('0x4b')],null))['then'](respondWithResult(_0x4e3b10,null))[_0xaac2('0x49')](handleError(_0x4e3b10,null));};exports[_0xaac2('0x4d')]=function(_0x9c574f,_0x45d2cb){return db[_0xaac2('0x2e')]['find']({'where':{'id':_0x9c574f[_0xaac2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x45d2cb,null))[_0xaac2('0x28')](removeEntity(_0x45d2cb,null))[_0xaac2('0x49')](handleError(_0x45d2cb,null));};exports[_0xaac2('0x4f')]=function(_0x46b8e7,_0x42f690){return db[_0xaac2('0x2e')][_0xaac2('0x4f')]()[_0xaac2('0x28')](respondWithResult(_0x42f690,null))[_0xaac2('0x49')](handleError(_0x42f690,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 3a53b56..ee81fcd 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 _0x8b5b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','../../config/logger'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8b5b,0x137));var _0xb8b5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8b5b[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb8b5('0x0'))(_0xb8b5('0x1'));var moment=require(_0xb8b5('0x2'));var BPromise=require(_0xb8b5('0x3'));var rp=require(_0xb8b5('0x4'));var fs=require('fs');var path=require(_0xb8b5('0x5'));var rimraf=require(_0xb8b5('0x6'));var config=require(_0xb8b5('0x7'));var attributes=require(_0xb8b5('0x8'));module[_0xb8b5('0x9')]=function(_0x2a02e9,_0xb474f8){return _0x2a02e9['define'](_0xb8b5('0xa'),attributes,{'tableName':_0xb8b5('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x794b=['report_dial','uniqueid','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x794b,0xa7));var _0xb794=function(_0x49af20,_0x2d75f6){_0x49af20=_0x49af20-0x0;var _0x55845b=_0x794b[_0x49af20];return _0x55845b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb794('0x0'))(_0xb794('0x1'));var moment=require('moment');var BPromise=require(_0xb794('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb794('0x3'));var rimraf=require(_0xb794('0x4'));var config=require(_0xb794('0x5'));var attributes=require(_0xb794('0x6'));module[_0xb794('0x7')]=function(_0x491b88,_0x50e4a8){return _0x491b88[_0xb794('0x8')]('VoiceDialReport',attributes,{'tableName':_0xb794('0x9'),'paranoid':![],'indexes':[{'fields':[_0xb794('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 83b53a7..5173b22 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 _0xeebd=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport','VoiceDialReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x3beae2,_0x43241e){var _0x3cf8cd=function(_0x26af4f){while(--_0x26af4f){_0x3beae2['push'](_0x3beae2['shift']());}};_0x3cf8cd(++_0x43241e);}(_0xeebd,0x12d));var _0xdeeb=function(_0x499e90,_0x2d9c45){_0x499e90=_0x499e90-0x0;var _0xaf1c7e=_0xeebd[_0x499e90];return _0xaf1c7e;};'use strict';var _=require(_0xdeeb('0x0'));var util=require(_0xdeeb('0x1'));var moment=require(_0xdeeb('0x2'));var BPromise=require(_0xdeeb('0x3'));var rs=require(_0xdeeb('0x4'));var fs=require('fs');var Redis=require(_0xdeeb('0x5'));var db=require(_0xdeeb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdeeb('0x7'))(_0xdeeb('0x8'));var config=require(_0xdeeb('0x9'));var jayson=require(_0xdeeb('0xa'));var client=jayson[_0xdeeb('0xb')][_0xdeeb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21cf52,_0x409561,_0x256d9b){return new BPromise(function(_0x18930c,_0xaa6e1d){return client['request'](_0x21cf52,_0x256d9b)[_0xdeeb('0xd')](function(_0x12d414){logger[_0xdeeb('0xe')](_0xdeeb('0xf'),_0x409561,_0xdeeb('0x10'));logger[_0xdeeb('0x11')](_0xdeeb('0x12'),_0x409561,_0xdeeb('0x10'),JSON['stringify'](_0x12d414));if(_0x12d414[_0xdeeb('0x13')]){if(_0x12d414['error'][_0xdeeb('0x14')]===0x1f4){logger[_0xdeeb('0x13')](_0xdeeb('0xf'),_0x409561,_0x12d414['error'][_0xdeeb('0x15')]);return _0xaa6e1d(_0x12d414[_0xdeeb('0x13')]['message']);}logger[_0xdeeb('0x13')](_0xdeeb('0xf'),_0x409561,_0x12d414[_0xdeeb('0x13')][_0xdeeb('0x15')]);return _0x18930c(_0x12d414[_0xdeeb('0x13')]['message']);}else{logger['info'](_0xdeeb('0xf'),_0x409561,_0xdeeb('0x10'));_0x18930c(_0x12d414[_0xdeeb('0x16')][_0xdeeb('0x15')]);}})[_0xdeeb('0x17')](function(_0x923440){logger[_0xdeeb('0x13')](_0xdeeb('0xf'),_0x409561,_0x923440);_0xaa6e1d(_0x923440);});});}exports[_0xdeeb('0x18')]=function(_0x1d0461){var _0x2b19d5=this;return new Promise(function(_0x35e174,_0x5000b6){return db['VoiceDialReport'][_0xdeeb('0x19')](_0x1d0461[_0xdeeb('0x1a')],{'raw':_0x1d0461[_0xdeeb('0x1b')]?_0x1d0461[_0xdeeb('0x1b')][_0xdeeb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x183d23){logger[_0xdeeb('0xe')](_0xdeeb('0x18'),_0x1d0461);logger[_0xdeeb('0x11')](_0xdeeb('0x18'),_0x1d0461,JSON[_0xdeeb('0x1d')](_0x183d23));_0x35e174(_0x183d23);})[_0xdeeb('0x17')](function(_0x2c3c18){logger[_0xdeeb('0x13')]('CreateVoiceDialReport',_0x2c3c18[_0xdeeb('0x15')],_0x1d0461);_0x5000b6(_0x2b19d5[_0xdeeb('0x13')](0x1f4,_0x2c3c18['message']));});});};exports[_0xdeeb('0x1e')]=function(_0x5d5a6c){var _0x4d090=this;return new Promise(function(_0x7cf900,_0x1309ad){return db[_0xdeeb('0x1f')][_0xdeeb('0x20')](_0x5d5a6c[_0xdeeb('0x1a')],{'raw':_0x5d5a6c['options']?_0x5d5a6c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d5a6c[_0xdeeb('0x1b')]?_0x5d5a6c[_0xdeeb('0x1b')][_0xdeeb('0x21')]||null:null,'attributes':_0x5d5a6c['options']?_0x5d5a6c[_0xdeeb('0x1b')]['attributes']||null:null,'limit':_0x5d5a6c[_0xdeeb('0x1b')]?_0x5d5a6c['options'][_0xdeeb('0x22')]||null:null})[_0xdeeb('0xd')](function(_0x33c34b){logger['info'](_0xdeeb('0x1e'),_0x5d5a6c);logger[_0xdeeb('0x11')](_0xdeeb('0x1e'),_0x5d5a6c,JSON['stringify'](_0x33c34b));_0x7cf900(_0x33c34b);})['catch'](function(_0x4e8bb8){logger[_0xdeeb('0x13')](_0xdeeb('0x1e'),_0x4e8bb8[_0xdeeb('0x15')],_0x5d5a6c);_0x1309ad(_0x4d090[_0xdeeb('0x13')](0x1f4,_0x4e8bb8[_0xdeeb('0x15')]));});});}; \ No newline at end of file +var _0x23e1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport','update','attributes','limit','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x23e1,0x1c8));var _0x123e=function(_0x54e99c,_0x236324){_0x54e99c=_0x54e99c-0x0;var _0x5c9588=_0x23e1[_0x54e99c];return _0x5c9588;};'use strict';var _=require('lodash');var util=require(_0x123e('0x0'));var moment=require(_0x123e('0x1'));var BPromise=require(_0x123e('0x2'));var rs=require(_0x123e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x123e('0x4'));var logger=require(_0x123e('0x5'))(_0x123e('0x6'));var config=require(_0x123e('0x7'));var jayson=require(_0x123e('0x8'));var client=jayson[_0x123e('0x9')][_0x123e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x220d14,_0x21edc7,_0x2afc74){return new BPromise(function(_0x3aa656,_0x3188ba){return client[_0x123e('0xb')](_0x220d14,_0x2afc74)[_0x123e('0xc')](function(_0x4f0a2c){logger[_0x123e('0xd')](_0x123e('0xe'),_0x21edc7,'request\x20sent');logger[_0x123e('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x21edc7,'request\x20sent',JSON['stringify'](_0x4f0a2c));if(_0x4f0a2c[_0x123e('0x10')]){if(_0x4f0a2c[_0x123e('0x10')][_0x123e('0x11')]===0x1f4){logger[_0x123e('0x10')](_0x123e('0xe'),_0x21edc7,_0x4f0a2c[_0x123e('0x10')]['message']);return _0x3188ba(_0x4f0a2c[_0x123e('0x10')][_0x123e('0x12')]);}logger[_0x123e('0x10')](_0x123e('0xe'),_0x21edc7,_0x4f0a2c['error'][_0x123e('0x12')]);return _0x3aa656(_0x4f0a2c[_0x123e('0x10')][_0x123e('0x12')]);}else{logger['info'](_0x123e('0xe'),_0x21edc7,_0x123e('0x13'));_0x3aa656(_0x4f0a2c[_0x123e('0x14')][_0x123e('0x12')]);}})[_0x123e('0x15')](function(_0x3fffe0){logger[_0x123e('0x10')](_0x123e('0xe'),_0x21edc7,_0x3fffe0);_0x3188ba(_0x3fffe0);});});}exports[_0x123e('0x16')]=function(_0x311d5b){var _0x7f23e=this;return new Promise(function(_0x498356,_0x5b076f){return db[_0x123e('0x17')][_0x123e('0x18')](_0x311d5b[_0x123e('0x19')],{'raw':_0x311d5b[_0x123e('0x1a')]?_0x311d5b[_0x123e('0x1a')][_0x123e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1617a5){logger[_0x123e('0xd')](_0x123e('0x16'),_0x311d5b);logger[_0x123e('0xf')](_0x123e('0x16'),_0x311d5b,JSON[_0x123e('0x1c')](_0x1617a5));_0x498356(_0x1617a5);})[_0x123e('0x15')](function(_0xe0cbee){logger['error']('CreateVoiceDialReport',_0xe0cbee[_0x123e('0x12')],_0x311d5b);_0x5b076f(_0x7f23e[_0x123e('0x10')](0x1f4,_0xe0cbee[_0x123e('0x12')]));});});};exports[_0x123e('0x1d')]=function(_0x49f481){var _0x1fbc7f=this;return new Promise(function(_0x59fe9d,_0x48f984){return db[_0x123e('0x17')][_0x123e('0x1e')](_0x49f481[_0x123e('0x19')],{'raw':_0x49f481[_0x123e('0x1a')]?_0x49f481[_0x123e('0x1a')][_0x123e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49f481['options']?_0x49f481[_0x123e('0x1a')]['where']||null:null,'attributes':_0x49f481['options']?_0x49f481[_0x123e('0x1a')][_0x123e('0x1f')]||null:null,'limit':_0x49f481[_0x123e('0x1a')]?_0x49f481[_0x123e('0x1a')][_0x123e('0x20')]||null:null})['then'](function(_0x46f1fc){logger[_0x123e('0xd')](_0x123e('0x1d'),_0x49f481);logger['debug'](_0x123e('0x1d'),_0x49f481,JSON['stringify'](_0x46f1fc));_0x59fe9d(_0x46f1fc);})[_0x123e('0x15')](function(_0x27d9eb){logger[_0x123e('0x10')](_0x123e('0x1d'),_0x27d9eb[_0x123e('0x12')],_0x49f481);_0x48f984(_0x1fbc7f[_0x123e('0x10')](0x1f4,_0x27d9eb[_0x123e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5c19c04..ace75b7 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 _0xd9c1=['../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','/:id/applications','addApplications','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x26fb2b,_0x52deea){var _0x4afd06=function(_0x3f5c1d){while(--_0x3f5c1d){_0x26fb2b['push'](_0x26fb2b['shift']());}};_0x4afd06(++_0x52deea);}(_0xd9c1,0x1a4));var _0x1d9c=function(_0x43695c,_0x33355c){_0x43695c=_0x43695c-0x0;var _0xbab647=_0xd9c1[_0x43695c];return _0xbab647;};'use strict';var multer=require(_0x1d9c('0x0'));var util=require(_0x1d9c('0x1'));var path=require('path');var timeout=require(_0x1d9c('0x2'));var express=require(_0x1d9c('0x3'));var router=express[_0x1d9c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1d9c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1d9c('0x6'));var controller=require('./voiceExtension.controller');router[_0x1d9c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1d9c('0x8'),auth[_0x1d9c('0x9')](),controller[_0x1d9c('0xa')]);router[_0x1d9c('0xb')]('/',auth[_0x1d9c('0x9')](),controller['create']);router[_0x1d9c('0xb')](_0x1d9c('0xc'),auth['isAuthenticated'](),controller[_0x1d9c('0xd')]);router['put']('/:id',auth[_0x1d9c('0x9')](),controller[_0x1d9c('0xe')]);router['delete'](_0x1d9c('0x8'),auth[_0x1d9c('0x9')](),controller[_0x1d9c('0xf')]);module[_0x1d9c('0x10')]=router; \ No newline at end of file +var _0x439f=['get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3f4b99,_0xb7dcde){var _0x17fea4=function(_0x51e5db){while(--_0x51e5db){_0x3f4b99['push'](_0x3f4b99['shift']());}};_0x17fea4(++_0xb7dcde);}(_0x439f,0x1c4));var _0xf439=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0x439f[_0x206338];return _0x2b87f2;};'use strict';var multer=require(_0xf439('0x0'));var util=require(_0xf439('0x1'));var path=require(_0xf439('0x2'));var timeout=require(_0xf439('0x3'));var express=require(_0xf439('0x4'));var router=express['Router']();var fs_extra=require(_0xf439('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf439('0x6'));var config=require(_0xf439('0x7'));var controller=require('./voiceExtension.controller');router[_0xf439('0x8')]('/',auth[_0xf439('0x9')](),controller[_0xf439('0xa')]);router[_0xf439('0x8')](_0xf439('0xb'),auth['isAuthenticated'](),controller[_0xf439('0xc')]);router['post']('/',auth[_0xf439('0x9')](),controller['create']);router[_0xf439('0xd')](_0xf439('0xe'),auth[_0xf439('0x9')](),controller[_0xf439('0xf')]);router[_0xf439('0x10')]('/:id',auth[_0xf439('0x9')](),controller[_0xf439('0x11')]);router['delete']('/:id',auth[_0xf439('0x9')](),controller[_0xf439('0x12')]);module[_0xf439('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index c70742a..774dbf2 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 _0x7a38=['outbound','internal','inbound-fax','system','any','*,*,*,*','wav','getDataValue','exten','exports','STRING','compositeIndex','ENUM','inbound'];(function(_0x53ee43,_0x2a63ec){var _0x58b2ca=function(_0x35e8a0){while(--_0x35e8a0){_0x53ee43['push'](_0x53ee43['shift']());}};_0x58b2ca(++_0x2a63ec);}(_0x7a38,0x14b));var _0x87a3=function(_0x2fe37c,_0x106dcf){_0x2fe37c=_0x2fe37c-0x0;var _0xac935e=_0x7a38[_0x2fe37c];return _0xac935e;};'use strict';var Sequelize=require('sequelize');module[_0x87a3('0x0')]={'context':{'type':Sequelize[_0x87a3('0x1')],'allowNull':![],'unique':_0x87a3('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x87a3('0x1')],'allowNull':![],'unique':_0x87a3('0x2')},'priority':{'type':Sequelize[_0x87a3('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x87a3('0x2')},'tag':{'type':Sequelize[_0x87a3('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x87a3('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x87a3('0x3')](_0x87a3('0x4'),_0x87a3('0x5'),_0x87a3('0x6'),_0x87a3('0x7'),'outbound-fax',_0x87a3('0x8'),_0x87a3('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x87a3('0x1')]},'interval':{'type':Sequelize[_0x87a3('0x1')],'allowNull':![],'defaultValue':_0x87a3('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x87a3('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x87a3('0x1')],'defaultValue':_0x87a3('0xb')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3d453a){return this[_0x87a3('0xc')](_0x87a3('0xd'));}},'alias':{'type':Sequelize[_0x87a3('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xc0bf=['INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','*,*,*,*'];(function(_0x180bf5,_0x28a50e){var _0x2e3e85=function(_0x2345cc){while(--_0x2345cc){_0x180bf5['push'](_0x180bf5['shift']());}};_0x2e3e85(++_0x28a50e);}(_0xc0bf,0x1eb));var _0xfc0b=function(_0x34485b,_0x25a1a5){_0x34485b=_0x34485b-0x0;var _0x12764e=_0xc0bf[_0x34485b];return _0x12764e;};'use strict';var Sequelize=require(_0xfc0b('0x0'));module[_0xfc0b('0x1')]={'context':{'type':Sequelize[_0xfc0b('0x2')],'allowNull':![],'unique':_0xfc0b('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xfc0b('0x2')],'allowNull':![],'unique':_0xfc0b('0x3')},'priority':{'type':Sequelize[_0xfc0b('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xfc0b('0x3')},'tag':{'type':Sequelize[_0xfc0b('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xfc0b('0x2')],'allowNull':![],'defaultValue':_0xfc0b('0x4')},'appdata':{'type':Sequelize[_0xfc0b('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xfc0b('0x5')](_0xfc0b('0x6'),_0xfc0b('0x7'),_0xfc0b('0x8'),_0xfc0b('0x9'),_0xfc0b('0xa'),_0xfc0b('0xb'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xfc0b('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfc0b('0xc')},'IntervalId':{'type':Sequelize[_0xfc0b('0xd')]},'isApp':{'type':Sequelize[_0xfc0b('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xfc0b('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xfc0b('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xfc0b('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xfc0b('0xf')},'answer':{'type':Sequelize[_0xfc0b('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xfc0b('0x10')],'get':function(_0x54e990){return this[_0xfc0b('0x11')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 7151f25..9f6d437 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 _0x2ec4=['includes','type','find','name','then','error','rawAttributes','fieldName','key','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','VoiceExtension','includeAll','findAll','rows','catch','show','include','destroy','params','create','body','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','InternalRoutes','internal','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','findAndCountAll','stack','finally','send','json','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','InboundRoutes','inbound','outbound','filter','ignore','map','value'];(function(_0x204b83,_0x1bc369){var _0x24df77=function(_0x58b355){while(--_0x58b355){_0x204b83['push'](_0x204b83['shift']());}};_0x24df77(++_0x1bc369);}(_0x2ec4,0xa3));var _0x42ec=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x2ec4[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x42ec('0x0'));var Redis=require(_0x42ec('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x42ec('0x2'));var config=require(_0x42ec('0x3'));var db=require(_0x42ec('0x4'))['db'];config[_0x42ec('0x5')]=_[_0x42ec('0x6')](config['redis'],{'host':_0x42ec('0x7'),'port':0x18eb});var socket=require(_0x42ec('0x8'))(new Redis(config[_0x42ec('0x5')]));require('./voiceExtension.socket')[_0x42ec('0x9')](socket);function respondWithStatusCode(_0x5dcbce,_0x57bdf2){_0x57bdf2=_0x57bdf2||0xcc;return function(_0x5b0e0c){if(_0x5b0e0c){return _0x5dcbce[_0x42ec('0xa')](_0x57bdf2);}return _0x5dcbce[_0x42ec('0xb')](_0x57bdf2)[_0x42ec('0xc')]();};}function respondWithResult(_0xd10718,_0x23e763){_0x23e763=_0x23e763||0xc8;return function(_0x2c6827){if(_0x2c6827){return _0xd10718[_0x42ec('0xb')](_0x23e763)['json'](_0x2c6827);}};}function respondWithFilteredResult(_0xf4f04e,_0x452193){return function(_0x38ad53){if(_0x38ad53){var _0x5daef0=typeof _0x452193[_0x42ec('0xd')]===_0x42ec('0xe')&&typeof _0x452193[_0x42ec('0xf')]===_0x42ec('0xe');var _0x599b45=_0x38ad53[_0x42ec('0x10')];var _0x4d9147=_0x5daef0?0x0:_0x452193[_0x42ec('0xd')];var _0x48e17d=_0x5daef0?_0x38ad53[_0x42ec('0x10')]:_0x452193[_0x42ec('0xd')]+_0x452193[_0x42ec('0xf')];var _0x49d84b;if(_0x48e17d>=_0x599b45){_0x48e17d=_0x599b45;_0x49d84b=0xc8;}else{_0x49d84b=0xce;}_0xf4f04e[_0x42ec('0xb')](_0x49d84b);return _0xf4f04e['set'](_0x42ec('0x11'),_0x4d9147+'-'+_0x48e17d+'/'+_0x599b45)['json'](_0x38ad53);}return null;};}function removeEntity(_0xd1ad83){return function(_0x42bb0d){if(_0x42bb0d){return _0x42bb0d['destroy']()['then'](function(){var _0x57612c=_0x42bb0d['get']({'plain':!![]});var _0x33c89a=[{'name':_0x42ec('0x12'),'value':_0x42ec('0x13'),'ignore':![]},{'name':'OutboundRoutes','value':_0x42ec('0x14'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x3e1d0d=_(_0x33c89a)[_0x42ec('0x15')](_0x42ec('0x16'))[_0x42ec('0x17')](_0x42ec('0x18'))['value']();if(_[_0x42ec('0x19')](_0x3e1d0d,_0x57612c[_0x42ec('0x1a')])){return;}var _0x5de099=_[_0x42ec('0x1b')](_0x33c89a,[_0x42ec('0x18'),_0x57612c[_0x42ec('0x1a')]])[_0x42ec('0x1c')];return db['UserProfileResource']['destroy']({'where':{'type':_0x5de099,'resourceId':_0x57612c['id']}})[_0x42ec('0x1d')](function(){return _0x42bb0d;});})[_0x42ec('0x1d')](function(){_0xd1ad83['status'](0xcc)[_0x42ec('0xc')]();});}};}function handleEntityNotFound(_0x28e899){return function(_0x27b7dc){if(!_0x27b7dc){_0x28e899[_0x42ec('0xa')](0x194);}return _0x27b7dc;};}function handleError(_0x42bac6,_0x336e5f){_0x336e5f=_0x336e5f||0x1f4;return function(_0x54de5d){logger[_0x42ec('0x1e')](_0x54de5d['stack']);if(_0x54de5d[_0x42ec('0x1c')]){delete _0x54de5d[_0x42ec('0x1c')];}_0x42bac6[_0x42ec('0xb')](_0x336e5f)['send'](_0x54de5d);};}exports['index']=function(_0x30e6b5,_0x993ec8){var _0x25b40e={},_0x589d3d={},_0x2c8759={'count':0x0,'rows':[]};var _0x540caf=_[_0x42ec('0x17')](db['VoiceExtension'][_0x42ec('0x1f')],function(_0x374c46){return{'name':_0x374c46[_0x42ec('0x20')],'type':_0x374c46[_0x42ec('0x1a')][_0x42ec('0x21')]};});_0x589d3d['model']=_['map'](_0x540caf,_0x42ec('0x1c'));_0x589d3d['query']=_[_0x42ec('0x22')](_0x30e6b5['query']);_0x589d3d[_0x42ec('0x23')]=_[_0x42ec('0x24')](_0x589d3d[_0x42ec('0x25')],_0x589d3d['query']);_0x25b40e[_0x42ec('0x26')]=_[_0x42ec('0x24')](_0x589d3d[_0x42ec('0x25')],qs[_0x42ec('0x27')](_0x30e6b5['query'][_0x42ec('0x27')]));_0x25b40e['attributes']=_0x25b40e[_0x42ec('0x26')][_0x42ec('0x28')]?_0x25b40e[_0x42ec('0x26')]:_0x589d3d['model'];if(!_0x30e6b5[_0x42ec('0x29')][_0x42ec('0x2a')](_0x42ec('0x2b'))){_0x25b40e[_0x42ec('0xf')]=qs[_0x42ec('0xf')](_0x30e6b5[_0x42ec('0x29')][_0x42ec('0xf')]);_0x25b40e[_0x42ec('0xd')]=qs[_0x42ec('0xd')](_0x30e6b5[_0x42ec('0x29')][_0x42ec('0xd')]);}_0x25b40e[_0x42ec('0x2c')]=qs[_0x42ec('0x2d')](_0x30e6b5[_0x42ec('0x29')]['sort']);_0x25b40e[_0x42ec('0x2e')]=qs['filters'](_['pick'](_0x30e6b5[_0x42ec('0x29')],_0x589d3d[_0x42ec('0x23')]),_0x540caf);if(_0x30e6b5[_0x42ec('0x29')][_0x42ec('0x15')]){_0x25b40e[_0x42ec('0x2e')]=_[_0x42ec('0x2f')](_0x25b40e[_0x42ec('0x2e')],{'$or':_[_0x42ec('0x17')](_0x540caf,function(_0x42544c){if(_0x42544c[_0x42ec('0x1a')]!==_0x42ec('0x30')){var _0x52b9f7={};_0x52b9f7[_0x42544c[_0x42ec('0x1c')]]={'$like':'%'+_0x30e6b5[_0x42ec('0x29')][_0x42ec('0x15')]+'%'};return _0x52b9f7;}})});}_0x25b40e=_[_0x42ec('0x2f')]({},_0x25b40e,_0x30e6b5[_0x42ec('0x31')]);var _0x3a029d={'where':_0x25b40e[_0x42ec('0x2e')]};return db[_0x42ec('0x32')][_0x42ec('0x10')](_0x3a029d)[_0x42ec('0x1d')](function(_0x17d55e){_0x2c8759[_0x42ec('0x10')]=_0x17d55e;if(_0x30e6b5[_0x42ec('0x29')][_0x42ec('0x33')]){_0x25b40e['include']=[{'all':!![]}];}return db[_0x42ec('0x32')][_0x42ec('0x34')](_0x25b40e);})['then'](function(_0x11bf7c){_0x2c8759[_0x42ec('0x35')]=_0x11bf7c;return _0x2c8759;})[_0x42ec('0x1d')](respondWithFilteredResult(_0x993ec8,_0x25b40e))[_0x42ec('0x36')](handleError(_0x993ec8,null));};exports[_0x42ec('0x37')]=function(_0x53f686,_0x35f17f){var _0x1f9d7={'raw':![],'where':{'id':_0x53f686['params']['id']}},_0x1eeaf7={};_0x1eeaf7[_0x42ec('0x25')]=_[_0x42ec('0x22')](db[_0x42ec('0x32')][_0x42ec('0x1f')]);_0x1eeaf7[_0x42ec('0x29')]=_[_0x42ec('0x22')](_0x53f686[_0x42ec('0x29')]);_0x1eeaf7['filters']=_['intersection'](_0x1eeaf7[_0x42ec('0x25')],_0x1eeaf7[_0x42ec('0x29')]);_0x1f9d7[_0x42ec('0x26')]=_[_0x42ec('0x24')](_0x1eeaf7[_0x42ec('0x25')],qs[_0x42ec('0x27')](_0x53f686[_0x42ec('0x29')]['fields']));_0x1f9d7[_0x42ec('0x26')]=_0x1f9d7[_0x42ec('0x26')][_0x42ec('0x28')]?_0x1f9d7[_0x42ec('0x26')]:_0x1eeaf7['model'];if(_0x53f686[_0x42ec('0x29')][_0x42ec('0x33')]){_0x1f9d7[_0x42ec('0x38')]=[{'all':!![]}];}_0x1f9d7=_[_0x42ec('0x2f')]({},_0x1f9d7,_0x53f686[_0x42ec('0x31')]);return db[_0x42ec('0x32')][_0x42ec('0x1b')](_0x1f9d7)[_0x42ec('0x1d')](handleEntityNotFound(_0x35f17f,null))[_0x42ec('0x1d')](respondWithResult(_0x35f17f,null))[_0x42ec('0x36')](handleError(_0x35f17f,null));};exports[_0x42ec('0x39')]=function(_0x3aba3d,_0x475a78){return db[_0x42ec('0x32')][_0x42ec('0x1b')]({'where':{'id':_0x3aba3d[_0x42ec('0x3a')]['id']}})[_0x42ec('0x1d')](handleEntityNotFound(_0x475a78,null))[_0x42ec('0x1d')](removeEntity(_0x475a78,null))[_0x42ec('0x36')](handleError(_0x475a78,null));};exports[_0x42ec('0x3b')]=function(_0x5747c5,_0x4540b3){if(_0x5747c5[_0x42ec('0x3c')][_0x42ec('0x1a')]===_0x42ec('0x14')&&!_[_0x42ec('0x3d')](_0x5747c5['body'][_0x42ec('0x3e')],'_')){_0x5747c5['body'][_0x42ec('0x3e')]='_'[_0x42ec('0x3f')](_0x5747c5[_0x42ec('0x3c')][_0x42ec('0x3e')]);}return db[_0x42ec('0x32')][_0x42ec('0x3b')](_0x5747c5[_0x42ec('0x3c')],{'raw':![]})['then'](function(_0xfb8b83){var _0x5e8f95=_0x5747c5[_0x42ec('0x40')][_0x42ec('0x41')]({'plain':!![]});if(!_0x5e8f95)throw new Error(_0x42ec('0x42'));if(_0x5e8f95[_0x42ec('0x43')]===_0x42ec('0x40')){var _0x4283f2=_0xfb8b83[_0x42ec('0x41')]({'plain':!![]});var _0x3eb40b=[{'name':_0x42ec('0x12'),'value':_0x42ec('0x13')},{'name':_0x42ec('0x44'),'value':'outbound'},{'name':_0x42ec('0x45'),'value':_0x42ec('0x46')}];var _0x1cf6bf=_[_0x42ec('0x1b')](_0x3eb40b,[_0x42ec('0x18'),_0x4283f2['type']])[_0x42ec('0x1c')];return db[_0x42ec('0x47')][_0x42ec('0x1b')]({'where':{'name':_0x1cf6bf,'userProfileId':_0x5e8f95[_0x42ec('0x48')]},'raw':!![]})[_0x42ec('0x1d')](function(_0x4662ac){if(_0x4662ac&&_0x4662ac['autoAssociation']===0x0){return db[_0x42ec('0x49')][_0x42ec('0x3b')]({'name':_0x4283f2['name'],'resourceId':_0x4283f2['id'],'type':_0x4662ac[_0x42ec('0x1c')],'sectionId':_0x4662ac['id']},{})[_0x42ec('0x1d')](function(){return _0xfb8b83;});}else{return _0xfb8b83;}})[_0x42ec('0x36')](function(_0x6f3585){logger[_0x42ec('0x1e')](_0x42ec('0x4a'),_0x6f3585);throw _0x6f3585;});}return _0xfb8b83;})[_0x42ec('0x1d')](respondWithResult(_0x4540b3,0xc9))[_0x42ec('0x36')](handleError(_0x4540b3,null));};exports[_0x42ec('0x4b')]=function(_0x22c5cd,_0x1e6cc7){if(_0x22c5cd[_0x42ec('0x3c')]['id']){delete _0x22c5cd[_0x42ec('0x3c')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x22c5cd[_0x42ec('0x3a')]['id']}})[_0x42ec('0x1d')](handleEntityNotFound(_0x1e6cc7,null))[_0x42ec('0x1d')](function(_0x207e33){if(_0x207e33){return db['VoiceExtension'][_0x42ec('0x4b')](_['pick'](_0x22c5cd[_0x42ec('0x3c')],[_0x42ec('0x3e'),_0x42ec('0x4c'),_0x42ec('0x4d'),_0x42ec('0x4e'),_0x42ec('0x4f'),_0x42ec('0x50'),'alias']),{'where':{'context':_0x207e33[_0x42ec('0x4c')],'exten':_0x207e33[_0x42ec('0x3e')]},'individualHooks':!![]})['then'](function(_0x4bf152){return _0x4bf152;});}return null;})[_0x42ec('0x1d')](respondWithStatusCode(_0x1e6cc7,null))[_0x42ec('0x36')](handleError(_0x1e6cc7,null));};exports[_0x42ec('0x51')]=function(_0x4d2e56,_0x114900){var _0x232fc2=_0x4d2e56['params']['id'];var _0x558809=_0x4d2e56[_0x42ec('0x3c')];var _0x2b8f55=0xc8;var _0x795e97=null;return db[_0x42ec('0x52')][_0x42ec('0x53')]({'isolationLevel':db[_0x42ec('0x52')]['Transaction'][_0x42ec('0x54')][_0x42ec('0x55')]},function(_0x107e18){return db['VoiceExtension'][_0x42ec('0x56')]({'where':{'id':_0x232fc2},'transaction':_0x107e18})[_0x42ec('0x1d')](function(_0x2cf851){if(_0x2cf851){return db['VoiceExtension'][_0x42ec('0x39')]({'where':{'VoiceExtensionId':_0x232fc2},'transaction':_0x107e18})['then'](function(){var _0x4402d6=_[_0x42ec('0x17')](_0x558809,function(_0x2a2df3){_0x2a2df3[_0x42ec('0x57')]=_0x232fc2;_0x2a2df3['isApp']=!![];return _0x2a2df3;});return _0x2cf851[_0x42ec('0x58')](_0x4402d6);})[_0x42ec('0x1d')](function(_0x21eb23){return db['VoiceExtension']['bulkCreate'](_0x21eb23,{'transaction':_0x107e18});});}else{_0x2b8f55=0x194;_0x795e97=[];}});})[_0x42ec('0x1d')](function(){if(_0x2b8f55!==0x194){return db[_0x42ec('0x32')][_0x42ec('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x232fc2},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x41364e){_0x795e97=_0x41364e;});}})[_0x42ec('0x36')](function(_0x303a64){_0x2b8f55=0x1f4;logger[_0x42ec('0x1e')](_0x303a64[_0x42ec('0x5a')]);if(_0x303a64[_0x42ec('0x1c')]){delete _0x303a64['name'];}_0x795e97=_0x303a64;})[_0x42ec('0x5b')](function(){if(_0x795e97===null){_0x114900['sendStatus'](_0x2b8f55);}else{if(_0x2b8f55===0x1f4){_0x114900[_0x42ec('0xb')](_0x2b8f55)[_0x42ec('0x5c')](_0x795e97);}else{_0x114900['status'](_0x2b8f55)[_0x42ec('0x5d')](_0x795e97);}}});}; \ No newline at end of file +var _0xcb2c=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','json','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','offset','undefined','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','count','includeAll','include','rows','catch','show','rawAttributes','params','create','body','startsWith','concat','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','userProfileId'];(function(_0x5651be,_0x11828c){var _0x571b5d=function(_0x23301c){while(--_0x23301c){_0x5651be['push'](_0x5651be['shift']());}};_0x571b5d(++_0x11828c);}(_0xcb2c,0x143));var _0xccb2=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xcb2c[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xccb2('0x0'));var Redis=require(_0xccb2('0x1'));var qs=require(_0xccb2('0x2'));var logger=require(_0xccb2('0x3'))(_0xccb2('0x4'));var config=require(_0xccb2('0x5'));var db=require(_0xccb2('0x6'))['db'];config[_0xccb2('0x7')]=_[_0xccb2('0x8')](config[_0xccb2('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xccb2('0x9'))(new Redis(config[_0xccb2('0x7')]));require(_0xccb2('0xa'))['register'](socket);function respondWithStatusCode(_0x433b9c,_0x56b189){_0x56b189=_0x56b189||0xcc;return function(_0x5b4966){if(_0x5b4966){return _0x433b9c[_0xccb2('0xb')](_0x56b189);}return _0x433b9c[_0xccb2('0xc')](_0x56b189)[_0xccb2('0xd')]();};}function respondWithResult(_0x4c08fe,_0x170aea){_0x170aea=_0x170aea||0xc8;return function(_0x2f1d04){if(_0x2f1d04){return _0x4c08fe[_0xccb2('0xc')](_0x170aea)['json'](_0x2f1d04);}};}function respondWithFilteredResult(_0x1df249,_0x22c909){return function(_0x21d552){if(_0x21d552){var _0x16e841=typeof _0x22c909[_0xccb2('0xe')]===_0xccb2('0xf')&&typeof _0x22c909['limit']===_0xccb2('0xf');var _0x5aae5d=_0x21d552['count'];var _0x1760f0=_0x16e841?0x0:_0x22c909[_0xccb2('0xe')];var _0x3fe34d=_0x16e841?_0x21d552['count']:_0x22c909['offset']+_0x22c909['limit'];var _0x2269e6;if(_0x3fe34d>=_0x5aae5d){_0x3fe34d=_0x5aae5d;_0x2269e6=0xc8;}else{_0x2269e6=0xce;}_0x1df249['status'](_0x2269e6);return _0x1df249[_0xccb2('0x10')](_0xccb2('0x11'),_0x1760f0+'-'+_0x3fe34d+'/'+_0x5aae5d)['json'](_0x21d552);}return null;};}function removeEntity(_0x22ed34){return function(_0x5e38bb){if(_0x5e38bb){return _0x5e38bb[_0xccb2('0x12')]()[_0xccb2('0x13')](function(){var _0x50f752=_0x5e38bb[_0xccb2('0x14')]({'plain':!![]});var _0x1f6a57=[{'name':_0xccb2('0x15'),'value':_0xccb2('0x16'),'ignore':![]},{'name':_0xccb2('0x17'),'value':_0xccb2('0x18'),'ignore':![]},{'name':'InternalRoutes','value':_0xccb2('0x19'),'ignore':![]}];var _0x1c5052=_(_0x1f6a57)[_0xccb2('0x1a')](_0xccb2('0x1b'))[_0xccb2('0x1c')]('value')[_0xccb2('0x1d')]();if(_[_0xccb2('0x1e')](_0x1c5052,_0x50f752[_0xccb2('0x1f')])){return;}var _0x1f3d85=_[_0xccb2('0x20')](_0x1f6a57,['value',_0x50f752['type']])[_0xccb2('0x21')];return db[_0xccb2('0x22')][_0xccb2('0x12')]({'where':{'type':_0x1f3d85,'resourceId':_0x50f752['id']}})[_0xccb2('0x13')](function(){return _0x5e38bb;});})[_0xccb2('0x13')](function(){_0x22ed34['status'](0xcc)[_0xccb2('0xd')]();});}};}function handleEntityNotFound(_0x4adff6){return function(_0x3950d6){if(!_0x3950d6){_0x4adff6['sendStatus'](0x194);}return _0x3950d6;};}function handleError(_0x4b75ed,_0x48a7fe){_0x48a7fe=_0x48a7fe||0x1f4;return function(_0x292d89){logger[_0xccb2('0x23')](_0x292d89['stack']);if(_0x292d89[_0xccb2('0x21')]){delete _0x292d89[_0xccb2('0x21')];}_0x4b75ed[_0xccb2('0xc')](_0x48a7fe)[_0xccb2('0x24')](_0x292d89);};}exports[_0xccb2('0x25')]=function(_0x5490f3,_0x4fc2c0){var _0x4df753={},_0x5ac11c={},_0x389231={'count':0x0,'rows':[]};var _0xf00331=_[_0xccb2('0x1c')](db[_0xccb2('0x26')]['rawAttributes'],function(_0x10bee0){return{'name':_0x10bee0[_0xccb2('0x27')],'type':_0x10bee0[_0xccb2('0x1f')][_0xccb2('0x28')]};});_0x5ac11c[_0xccb2('0x29')]=_[_0xccb2('0x1c')](_0xf00331,_0xccb2('0x21'));_0x5ac11c[_0xccb2('0x2a')]=_[_0xccb2('0x2b')](_0x5490f3[_0xccb2('0x2a')]);_0x5ac11c[_0xccb2('0x2c')]=_[_0xccb2('0x2d')](_0x5ac11c[_0xccb2('0x29')],_0x5ac11c[_0xccb2('0x2a')]);_0x4df753[_0xccb2('0x2e')]=_[_0xccb2('0x2d')](_0x5ac11c['model'],qs['fields'](_0x5490f3[_0xccb2('0x2a')][_0xccb2('0x2f')]));_0x4df753[_0xccb2('0x2e')]=_0x4df753['attributes'][_0xccb2('0x30')]?_0x4df753[_0xccb2('0x2e')]:_0x5ac11c[_0xccb2('0x29')];if(!_0x5490f3['query'][_0xccb2('0x31')](_0xccb2('0x32'))){_0x4df753['limit']=qs[_0xccb2('0x33')](_0x5490f3[_0xccb2('0x2a')][_0xccb2('0x33')]);_0x4df753[_0xccb2('0xe')]=qs[_0xccb2('0xe')](_0x5490f3[_0xccb2('0x2a')][_0xccb2('0xe')]);}_0x4df753[_0xccb2('0x34')]=qs[_0xccb2('0x35')](_0x5490f3[_0xccb2('0x2a')][_0xccb2('0x35')]);_0x4df753['where']=qs['filters'](_[_0xccb2('0x36')](_0x5490f3[_0xccb2('0x2a')],_0x5ac11c[_0xccb2('0x2c')]),_0xf00331);if(_0x5490f3[_0xccb2('0x2a')][_0xccb2('0x1a')]){_0x4df753[_0xccb2('0x37')]=_[_0xccb2('0x38')](_0x4df753[_0xccb2('0x37')],{'$or':_[_0xccb2('0x1c')](_0xf00331,function(_0x3de20c){if(_0x3de20c[_0xccb2('0x1f')]!==_0xccb2('0x39')){var _0x3ca40f={};_0x3ca40f[_0x3de20c[_0xccb2('0x21')]]={'$like':'%'+_0x5490f3[_0xccb2('0x2a')][_0xccb2('0x1a')]+'%'};return _0x3ca40f;}})});}_0x4df753=_[_0xccb2('0x38')]({},_0x4df753,_0x5490f3['options']);var _0x182efe={'where':_0x4df753['where']};return db[_0xccb2('0x26')][_0xccb2('0x3a')](_0x182efe)['then'](function(_0x571754){_0x389231[_0xccb2('0x3a')]=_0x571754;if(_0x5490f3[_0xccb2('0x2a')][_0xccb2('0x3b')]){_0x4df753[_0xccb2('0x3c')]=[{'all':!![]}];}return db[_0xccb2('0x26')]['findAll'](_0x4df753);})[_0xccb2('0x13')](function(_0x5a6363){_0x389231[_0xccb2('0x3d')]=_0x5a6363;return _0x389231;})[_0xccb2('0x13')](respondWithFilteredResult(_0x4fc2c0,_0x4df753))[_0xccb2('0x3e')](handleError(_0x4fc2c0,null));};exports[_0xccb2('0x3f')]=function(_0x24a58f,_0x25fde0){var _0x1eb363={'raw':![],'where':{'id':_0x24a58f['params']['id']}},_0x209059={};_0x209059[_0xccb2('0x29')]=_[_0xccb2('0x2b')](db[_0xccb2('0x26')][_0xccb2('0x40')]);_0x209059[_0xccb2('0x2a')]=_['keys'](_0x24a58f[_0xccb2('0x2a')]);_0x209059[_0xccb2('0x2c')]=_[_0xccb2('0x2d')](_0x209059[_0xccb2('0x29')],_0x209059[_0xccb2('0x2a')]);_0x1eb363['attributes']=_[_0xccb2('0x2d')](_0x209059['model'],qs[_0xccb2('0x2f')](_0x24a58f[_0xccb2('0x2a')]['fields']));_0x1eb363[_0xccb2('0x2e')]=_0x1eb363[_0xccb2('0x2e')][_0xccb2('0x30')]?_0x1eb363[_0xccb2('0x2e')]:_0x209059[_0xccb2('0x29')];if(_0x24a58f['query'][_0xccb2('0x3b')]){_0x1eb363[_0xccb2('0x3c')]=[{'all':!![]}];}_0x1eb363=_['merge']({},_0x1eb363,_0x24a58f['options']);return db[_0xccb2('0x26')][_0xccb2('0x20')](_0x1eb363)[_0xccb2('0x13')](handleEntityNotFound(_0x25fde0,null))[_0xccb2('0x13')](respondWithResult(_0x25fde0,null))[_0xccb2('0x3e')](handleError(_0x25fde0,null));};exports['destroy']=function(_0x25ae78,_0x1bf95b){return db[_0xccb2('0x26')][_0xccb2('0x20')]({'where':{'id':_0x25ae78[_0xccb2('0x41')]['id']}})[_0xccb2('0x13')](handleEntityNotFound(_0x1bf95b,null))['then'](removeEntity(_0x1bf95b,null))[_0xccb2('0x3e')](handleError(_0x1bf95b,null));};exports[_0xccb2('0x42')]=function(_0xaa860f,_0xaa0ded){if(_0xaa860f[_0xccb2('0x43')][_0xccb2('0x1f')]===_0xccb2('0x18')&&!_[_0xccb2('0x44')](_0xaa860f[_0xccb2('0x43')]['exten'],'_')){_0xaa860f['body']['exten']='_'[_0xccb2('0x45')](_0xaa860f[_0xccb2('0x43')][_0xccb2('0x46')]);}return db[_0xccb2('0x26')][_0xccb2('0x42')](_0xaa860f[_0xccb2('0x43')],{'raw':![]})[_0xccb2('0x13')](function(_0x2c1dae){var _0x3600b0=_0xaa860f[_0xccb2('0x47')][_0xccb2('0x14')]({'plain':!![]});if(!_0x3600b0)throw new Error(_0xccb2('0x48'));if(_0x3600b0[_0xccb2('0x49')]===_0xccb2('0x47')){var _0x59f007=_0x2c1dae['get']({'plain':!![]});var _0x4e2c36=[{'name':_0xccb2('0x15'),'value':'inbound'},{'name':_0xccb2('0x17'),'value':'outbound'},{'name':_0xccb2('0x4a'),'value':_0xccb2('0x19')}];var _0x57bc4d=_[_0xccb2('0x20')](_0x4e2c36,['value',_0x59f007['type']])['name'];return db[_0xccb2('0x4b')][_0xccb2('0x20')]({'where':{'name':_0x57bc4d,'userProfileId':_0x3600b0[_0xccb2('0x4c')]},'raw':!![]})[_0xccb2('0x13')](function(_0x6c3159){if(_0x6c3159&&_0x6c3159[_0xccb2('0x4d')]===0x0){return db[_0xccb2('0x22')][_0xccb2('0x42')]({'name':_0x59f007[_0xccb2('0x21')],'resourceId':_0x59f007['id'],'type':_0x6c3159[_0xccb2('0x21')],'sectionId':_0x6c3159['id']},{})[_0xccb2('0x13')](function(){return _0x2c1dae;});}else{return _0x2c1dae;}})[_0xccb2('0x3e')](function(_0x3d4932){logger[_0xccb2('0x23')](_0xccb2('0x4e'),_0x3d4932);throw _0x3d4932;});}return _0x2c1dae;})[_0xccb2('0x13')](respondWithResult(_0xaa0ded,0xc9))['catch'](handleError(_0xaa0ded,null));};exports[_0xccb2('0x4f')]=function(_0x2a0644,_0x11a1af){if(_0x2a0644['body']['id']){delete _0x2a0644[_0xccb2('0x43')]['id'];}return db[_0xccb2('0x26')][_0xccb2('0x20')]({'where':{'id':_0x2a0644[_0xccb2('0x41')]['id']}})[_0xccb2('0x13')](handleEntityNotFound(_0x11a1af,null))[_0xccb2('0x13')](function(_0x4e19e4){if(_0x4e19e4){return db[_0xccb2('0x26')]['update'](_['pick'](_0x2a0644[_0xccb2('0x43')],[_0xccb2('0x46'),_0xccb2('0x50'),_0xccb2('0x51'),_0xccb2('0x52'),_0xccb2('0x53'),_0xccb2('0x54'),_0xccb2('0x55')]),{'where':{'context':_0x4e19e4[_0xccb2('0x50')],'exten':_0x4e19e4['exten']},'individualHooks':!![]})[_0xccb2('0x13')](function(_0xf19f0){return _0xf19f0;});}return null;})['then'](respondWithStatusCode(_0x11a1af,null))[_0xccb2('0x3e')](handleError(_0x11a1af,null));};exports[_0xccb2('0x56')]=function(_0x4fc536,_0x37b3bc){var _0x4cf43f=_0x4fc536[_0xccb2('0x41')]['id'];var _0x5965fb=_0x4fc536[_0xccb2('0x43')];var _0x3f206d=0xc8;var _0x20cfd6=null;return db['sequelize'][_0xccb2('0x57')]({'isolationLevel':db[_0xccb2('0x58')][_0xccb2('0x59')][_0xccb2('0x5a')][_0xccb2('0x5b')]},function(_0x53e657){return db[_0xccb2('0x26')][_0xccb2('0x5c')]({'where':{'id':_0x4cf43f},'transaction':_0x53e657})[_0xccb2('0x13')](function(_0x58ee57){if(_0x58ee57){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x4cf43f},'transaction':_0x53e657})['then'](function(){var _0xfda898=_[_0xccb2('0x1c')](_0x5965fb,function(_0x1fc351){_0x1fc351['VoiceExtensionId']=_0x4cf43f;_0x1fc351[_0xccb2('0x5d')]=!![];return _0x1fc351;});return _0x58ee57[_0xccb2('0x5e')](_0xfda898);})[_0xccb2('0x13')](function(_0x486b4d){return db['VoiceExtension'][_0xccb2('0x5f')](_0x486b4d,{'transaction':_0x53e657});});}else{_0x3f206d=0x194;_0x20cfd6=[];}});})[_0xccb2('0x13')](function(){if(_0x3f206d!==0x194){return db[_0xccb2('0x26')][_0xccb2('0x60')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4cf43f},'order':_0xccb2('0x61')})[_0xccb2('0x13')](function(_0xfd7de){_0x20cfd6=_0xfd7de;});}})['catch'](function(_0x5efbcd){_0x3f206d=0x1f4;logger['error'](_0x5efbcd['stack']);if(_0x5efbcd[_0xccb2('0x21')]){delete _0x5efbcd[_0xccb2('0x21')];}_0x20cfd6=_0x5efbcd;})[_0xccb2('0x62')](function(){if(_0x20cfd6===null){_0x37b3bc[_0xccb2('0xb')](_0x3f206d);}else{if(_0x3f206d===0x1f4){_0x37b3bc[_0xccb2('0xc')](_0x3f206d)['send'](_0x20cfd6);}else{_0x37b3bc[_0xccb2('0xc')](_0x3f206d)[_0xccb2('0x63')](_0x20cfd6);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 678fba7..e27d6ce 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 _0x590c=['hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit'];(function(_0x54bdb6,_0x14407d){var _0x14bf58=function(_0xd72317){while(--_0xd72317){_0x54bdb6['push'](_0x54bdb6['shift']());}};_0x14bf58(++_0x14407d);}(_0x590c,0xb6));var _0xc590=function(_0x14a041,_0x502e4a){_0x14a041=_0x14a041-0x0;var _0x29ff01=_0x590c[_0x14a041];return _0x29ff01;};'use strict';var EventEmitter=require(_0xc590('0x0'));var VoiceExtension=require(_0xc590('0x1'))['db'][_0xc590('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc590('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc590('0x4'),'afterDestroy':_0xc590('0x5')};function emitEvent(_0x55eabd){return function(_0x108dc3,_0x36e2aa,_0x3778f0){VoiceExtensionEvents[_0xc590('0x6')](_0x55eabd+':'+_0x108dc3['id'],_0x108dc3);VoiceExtensionEvents[_0xc590('0x6')](_0x55eabd,_0x108dc3);_0x3778f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xc590('0x7')](e,emitEvent(event));}}module[_0xc590('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb05f=['save','remove','emit','hasOwnProperty','hook','events','VoiceExtension','setMaxListeners'];(function(_0x536ddb,_0x3a6085){var _0x2bc26e=function(_0x3b5c53){while(--_0x3b5c53){_0x536ddb['push'](_0x536ddb['shift']());}};_0x2bc26e(++_0x3a6085);}(_0xb05f,0x18d));var _0xfb05=function(_0x40ebaf,_0x216fe5){_0x40ebaf=_0x40ebaf-0x0;var _0x5b3038=_0xb05f[_0x40ebaf];return _0x5b3038;};'use strict';var EventEmitter=require(_0xfb05('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xfb05('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xfb05('0x2')](0x0);var events={'afterCreate':_0xfb05('0x3'),'afterUpdate':'update','afterDestroy':_0xfb05('0x4')};function emitEvent(_0x30a15d){return function(_0x5147e7,_0x4ad1c6,_0x4f429e){VoiceExtensionEvents[_0xfb05('0x5')](_0x30a15d+':'+_0x5147e7['id'],_0x5147e7);VoiceExtensionEvents[_0xfb05('0x5')](_0x30a15d,_0x5147e7);_0x4f429e(null);};}for(var e in events){if(events[_0xfb05('0x6')](e)){var event=events[e];VoiceExtension[_0xfb05('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 892604f..8e84b89 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 _0x556b=['CDR(routeAlias)=','inbound','CDR(routeid)=','push','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','split','name','trunk','phone','prefix','param','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','length','*,*,*,*','intervals','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','playback','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','catch','define','VoiceExtension','voice_extensions','get','last','then','Hangup','lodash','./voiceExtension.attributes','exports','type','context','exten','alias','Set','NoOp'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x556b,0x1d7));var _0xb556=function(_0x555fc4,_0x20e669){_0x555fc4=_0x555fc4-0x0;var _0x1c74c0=_0x556b[_0x555fc4];return _0x1c74c0;};'use strict';var _=require(_0xb556('0x0'));var attributes=require(_0xb556('0x1'));module[_0xb556('0x2')]=function(_0x3a96e6){var _0x3589ec=_0x3a96e6['models'];function _0xdc5b69(_0x23c794){var _0x4202e0=0x2;var _0x30214e=[{'type':_0x23c794[_0xb556('0x3')],'app':'Set','appdata':'CDR(type)='+_0x23c794['type'],'context':_0x23c794[_0xb556('0x4')],'exten':_0x23c794[_0xb556('0x5')],'priority':_0x4202e0++,'VoiceExtensionId':_0x23c794['id']},{'type':_0x23c794[_0xb556('0x3')],'app':_0x23c794[_0xb556('0x6')]?_0xb556('0x7'):_0xb556('0x8'),'appdata':_0x23c794[_0xb556('0x6')]?_0xb556('0x9')+_0x23c794['alias']:'No\x20alias\x20set','context':_0x23c794[_0xb556('0x4')],'exten':_0x23c794['exten'],'priority':_0x4202e0++,'VoiceExtensionId':_0x23c794['id']}];if(_0x23c794[_0xb556('0x3')]===_0xb556('0xa')){_0x30214e['push']({'type':'inbound','app':_0xb556('0x7'),'appdata':_0xb556('0xb')+_0x23c794['id'],'context':_0x23c794[_0xb556('0x4')],'exten':_0x23c794[_0xb556('0x5')],'priority':_0x4202e0++,'VoiceExtensionId':_0x23c794['id']});}_0x30214e[_0xb556('0xc')]({'type':_0x23c794[_0xb556('0x3')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x23c794[_0xb556('0x4')],'exten':_0x23c794['exten'],'priority':_0x4202e0++,'VoiceExtensionId':_0x23c794['id']},{'type':_0x23c794[_0xb556('0x3')],'app':_0xb556('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x23c794['context'],'exten':_0x23c794[_0xb556('0x5')],'priority':_0x4202e0++,'VoiceExtensionId':_0x23c794['id']},{'type':_0x23c794[_0xb556('0x3')],'app':_0xb556('0x7'),'appdata':_0xb556('0xd'),'context':_0x23c794[_0xb556('0x4')],'exten':_0x23c794[_0xb556('0x5')],'priority':_0x4202e0++,'VoiceExtensionId':_0x23c794['id']});return _0x30214e;}function _0x13677c(_0x81e473){var _0xcfaa19=0x2;var _0x485187=[{'type':_0xb556('0xe'),'app':_0xb556('0x7'),'appdata':_0xb556('0xf'),'context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473['exten'],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':_0xb556('0xe'),'app':_0x81e473[_0xb556('0x6')]?_0xb556('0x7'):_0xb556('0x8'),'appdata':_0x81e473['alias']?_0xb556('0x9')+_0x81e473[_0xb556('0x6')]:_0xb556('0x10'),'context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473['exten'],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':_0xb556('0xe'),'app':_0xb556('0x7'),'appdata':_0xb556('0x11')+(_0x81e473[_0xb556('0x12')]?_0xb556('0x13')+_0x81e473[_0xb556('0x12')]+'}':_0xb556('0x14')),'context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':_0xb556('0xe'),'app':_0xb556('0x7'),'appdata':_0xb556('0xb')+_0x81e473['id'],'context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':_0xb556('0xe'),'app':_0xb556('0x15'),'appdata':_0xb556('0x16')+(_0xcfaa19+0x2)+_0xb556('0x17')+(_0xcfaa19+0x1)+')','context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':_0xb556('0xe'),'app':_0xb556('0x7'),'appdata':_0x81e473['cutdigits']?_0xb556('0x18')+_0x81e473['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x81e473['context'],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':_0xb556('0xe'),'app':_0xb556('0x7'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':'outbound','app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':'outbound','app':'Set','appdata':_0xb556('0xd'),'context':_0x81e473['context'],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':'outbound','app':_0xb556('0x7'),'appdata':'outboundrouteid='+_0x81e473['id'],'context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']}];if(_0x81e473['hasOwnProperty']('recordingFormat')&&_0x81e473[_0xb556('0x19')]!==_0xb556('0x1a')){_0x485187[_0xb556('0xc')]({'type':'outbound','app':_0xb556('0x7'),'appdata':_0xb556('0x1b'),'context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']},{'type':'outbound','app':_0xb556('0x7'),'appdata':_0xb556('0x1c')+_0x81e473['recordingFormat']||'wav','context':_0x81e473[_0xb556('0x4')],'exten':_0x81e473[_0xb556('0x5')],'priority':_0xcfaa19++,'VoiceExtensionId':_0x81e473['id']});}return _0x485187;}function _0x3a4547(_0x5bdf7b,_0x272ffe){var _0x2af3fa=[{'name':'trunk','param':0x0},{'name':_0xb556('0x1d'),'param':0x1},{'name':_0xb556('0x1e'),'param':0x2},{'name':_0xb556('0x1f'),'param':0x3}];var _0x5e2a69={};var _0x5ace4c=_0x272ffe[_0xb556('0x20')](',');var _0x2db02e=[];for(var _0x28f349=0x0;_0x28f349<_0x2af3fa['length'];_0x28f349++){switch(_0x2af3fa[_0x28f349][_0xb556('0x21')]){case _0xb556('0x22'):_0x5e2a69['trunk']=_0x5ace4c[_0x2af3fa[_0x28f349]['param']][_0xb556('0x20')]('/')[0x1];_0x5e2a69[_0xb556('0x23')]=_0x5ace4c[_0x2af3fa[_0x28f349]['param']]['split']('/')[0x2];_0x5e2a69[_0xb556('0x24')]=_0x5e2a69[_0xb556('0x23')]?_0x5e2a69[_0xb556('0x23')][_0xb556('0x20')]('$')[0x0]:undefined;_0x5e2a69['phone']=_0x5bdf7b[_0xb556('0x12')]?(_0x5e2a69['prefix']||'')+'${EXTEN:'+_0x5bdf7b[_0xb556('0x12')]+'}':(_0x5e2a69[_0xb556('0x24')]||'')+_0xb556('0x14');_0x2db02e[_0x2af3fa[_0x28f349][_0xb556('0x25')]]=[_0xb556('0x26'),_0x5e2a69[_0xb556('0x22')],_0x5e2a69['phone']][_0xb556('0x27')]('/');break;case _0xb556('0x1e'):_0x5e2a69[_0xb556('0x1e')]=_0x5ace4c[_0x2af3fa[_0x28f349][_0xb556('0x25')]];if(_0x5bdf7b[_0xb556('0x19')]!=='none'){if(_0x5e2a69[_0xb556('0x1e')][_0xb556('0x28')]('U(xcally-mixmonitor-context)')<0x0){_0x5e2a69[_0xb556('0x1e')]+=_0xb556('0x29');}}else{_0x5e2a69[_0xb556('0x1e')]=_0x5e2a69[_0xb556('0x1e')][_0xb556('0x2a')](_0xb556('0x29'),'');}_0x2db02e[_0x2af3fa[_0x28f349][_0xb556('0x25')]]=_0x5e2a69['options'];break;default:_0x2db02e[_0x2af3fa[_0x28f349]['param']]=_0x5ace4c[_0x2af3fa[_0x28f349][_0xb556('0x25')]];}}return _0x2db02e[_0xb556('0x27')](',');}function _0x56e797(_0x513ba4,_0x145452,_0xca9189){return new Promise(function(_0x357e75,_0x5934c4){var _0x3dc492=[];if(_['isEmpty'](_0x145452))return _0x357e75(_0x3dc492);_0x3589ec[_0xb556('0x2b')][_0xb556('0x2c')]({'attributes':['id',_0xb556('0x2d'),_0xb556('0x2e')],'raw':!![]})['then'](function(_0x711602){for(var _0x141b73=0x0,_0x4c042f=0x0;_0x141b73<_0x145452[_0xb556('0x2f')];_0x141b73++,_0x4c042f=0x0){var _0xb7f578=_0x145452[_0x141b73];var _0x9737c0=[];var _0x2d23cc=[];delete _0xb7f578['id'];if(_0xb7f578['interval']!==_0xb556('0x30')){_0xb7f578[_0xb556('0x31')]=[_0xb7f578[_0xb556('0x2d')]];}else{_0xb7f578[_0xb556('0x31')]=_0xb7f578['IntervalId']?_['map'](_[_0xb556('0x32')](_0x711602,{'IntervalId':_0xb7f578[_0xb556('0x2e')]}),'interval'):[];}_0xb7f578[_0xb556('0x4')]=_0x513ba4[_0xb556('0x4')];_0xb7f578['exten']=_0x513ba4[_0xb556('0x5')];if(_0xb7f578[_0xb556('0x3')])_0xb7f578[_0xb556('0x3')]=_0xb7f578[_0xb556('0x3')][_0xb556('0x33')]();if(_0x513ba4[_0xb556('0x3')]===_0xb556('0xe')){if(_0xb7f578[_0xb556('0x34')](_0xb556('0x35'))&&_0xb7f578[_0xb556('0x35')]&&_0xb7f578[_0xb556('0x35')]!=='--'){_0x9737c0[_0xb556('0xc')]({'type':_0xb7f578[_0xb556('0x3')][_0xb556('0x33')](),'app':_0xb556('0x7'),'appdata':_0xb556('0x36')+_0xb7f578['tag'],'context':_0x513ba4[_0xb556('0x4')],'exten':_0x513ba4[_0xb556('0x5')],'priority':_0xb7f578['intervals']['length']+_0xca9189+_0x4c042f++,'VoiceExtensionId':_0x513ba4['id']});}_0x9737c0[_0xb556('0xc')]({'type':_0xb7f578[_0xb556('0x3')][_0xb556('0x33')](),'app':_0xb556('0x15'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0xb7f578['callerID']?_0xb556('0x37')+_0xb7f578[_0xb556('0x38')]+')':_0xb556('0x39')),'context':_0x513ba4[_0xb556('0x4')],'exten':_0x513ba4[_0xb556('0x5')],'priority':_0xb7f578[_0xb556('0x31')][_0xb556('0x2f')]+_0xca9189+_0x4c042f++,'VoiceExtensionId':_0x513ba4['id']});}else{if(_0xb7f578[_0xb556('0x34')](_0xb556('0x3a'))){if(['queue',_0xb556('0x3b')]['includes'](_0xb7f578['app'][_0xb556('0x33')]())&&_0xb7f578[_0xb556('0x3c')]!==_0xb556('0x3d')){if(_0xb7f578[_0xb556('0x3a')]){_0x9737c0['push']({'type':_0xb7f578[_0xb556('0x3')][_0xb556('0x33')](),'app':_0xb556('0x15'),'appdata':_0xb556('0x3e'),'context':_0x513ba4[_0xb556('0x4')],'exten':_0x513ba4[_0xb556('0x5')],'priority':_0xb7f578['intervals'][_0xb556('0x2f')]+_0xca9189+_0x4c042f++,'VoiceExtensionId':_0x513ba4['id']});_0x9737c0[_0xb556('0xc')]({'type':_0xb7f578[_0xb556('0x3')]['toLowerCase'](),'app':'Set','appdata':_0xb556('0x3f'),'context':_0x513ba4[_0xb556('0x4')],'exten':_0x513ba4['exten'],'priority':_0xb7f578[_0xb556('0x31')][_0xb556('0x2f')]+_0xca9189+_0x4c042f++,'VoiceExtensionId':_0x513ba4['id']});}else{_0x9737c0[_0xb556('0xc')]({'type':_0xb7f578[_0xb556('0x3')]['toLowerCase'](),'app':_0xb556('0x15'),'appdata':_0xb556('0x40'),'context':_0x513ba4['context'],'exten':_0x513ba4[_0xb556('0x5')],'priority':_0xb7f578[_0xb556('0x31')]['length']+_0xca9189+_0x4c042f++,'VoiceExtensionId':_0x513ba4['id']});_0x9737c0[_0xb556('0xc')]({'type':_0xb7f578[_0xb556('0x3')][_0xb556('0x33')](),'app':_0xb556('0x7'),'appdata':_0xb556('0x41'),'context':_0x513ba4[_0xb556('0x4')],'exten':_0x513ba4['exten'],'priority':_0xb7f578[_0xb556('0x31')]['length']+_0xca9189+_0x4c042f++,'VoiceExtensionId':_0x513ba4['id']});}}}}for(var _0x21c84e=0x0;_0x21c84e<_0xb7f578['intervals'][_0xb556('0x2f')];_0x21c84e++){var _0x14380a=_0xca9189+_0xb7f578[_0xb556('0x31')]['length'];var _0x3e9218=_0x21c84e===_0xb7f578[_0xb556('0x31')][_0xb556('0x2f')]-0x1?_0xca9189+_0x9737c0[_0xb556('0x2f')]+_0x2d23cc['length']+0x2:_0xca9189+_0x21c84e+0x1;_0x9737c0[_0xb556('0x42')](_0x21c84e,0x0,{'type':_0x513ba4[_0xb556('0x3')],'app':_0xb556('0x43'),'appdata':_0xb7f578[_0xb556('0x31')][_0x21c84e]+'?'+_0x513ba4[_0xb556('0x4')]+_0xb556('0x44')+_0x14380a+':'+_0x513ba4['context']+_0xb556('0x44')+_0x3e9218,'exten':_0x513ba4['exten'],'context':_0x513ba4[_0xb556('0x4')],'priority':_0xca9189+_0x21c84e,'VoiceExtensionId':_0x513ba4['id']});}if(_0xb7f578['appType']===_0xb556('0x45'))_0xb7f578[_0xb556('0x46')]=_0x3a4547(_0x513ba4,_0xb7f578[_0xb556('0x46')]);_0xb7f578[_0xb556('0x47')]=_0x9737c0[_0xb556('0x2f')]?_['last'](_0x9737c0)[_0xb556('0x47')]+0x1:_0xca9189;_0x3dc492=_['concat'](_0x3dc492,_0x9737c0,[_0xb7f578],_0x2d23cc);_0xca9189=_['last'](_0x3dc492)[_0xb556('0x47')]+0x1;}return _0x357e75(_0x3dc492);})[_0xb556('0x48')](function(_0x5924c6){_0x5934c4(_0x5924c6);});});}return _0x3a96e6[_0xb556('0x49')](_0xb556('0x4a'),attributes,{'tableName':_0xb556('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4ac0e3){var _0x9d9c16=this[_0xb556('0x4c')]({'plain':!![]});var _0xde8760=_0x9d9c16[_0xb556('0x3')]==='outbound'?_0x13677c(_0x9d9c16):_0xdc5b69(_0x9d9c16);return _0x56e797(_0x9d9c16,_0x4ac0e3,_[_0xb556('0x4d')](_0xde8760)[_0xb556('0x47')]+0x1)[_0xb556('0x4e')](function(_0x260db6){var _0x46deb2=_['concat'](_0xde8760,_0x260db6);_0x46deb2[_0xb556('0xc')]({'type':_0x9d9c16[_0xb556('0x3')],'app':_0xb556('0x4f'),'exten':_0x9d9c16[_0xb556('0x5')],'context':_0x9d9c16['context'],'priority':_[_0xb556('0x4d')](_0x46deb2)[_0xb556('0x47')]+0x1,'VoiceExtensionId':_0x9d9c16['id']});return _0x46deb2;});}}});}; \ No newline at end of file +var _0x8463=['CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','name','param','phone','prefix','SIP','none','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','length','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','define','VoiceExtension','voice_extensions','get','concat','lodash','./voiceExtension.attributes','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound'];(function(_0x1faffe,_0x52c8be){var _0x2667e7=function(_0x35fd60){while(--_0x35fd60){_0x1faffe['push'](_0x1faffe['shift']());}};_0x2667e7(++_0x52c8be);}(_0x8463,0x140));var _0x3846=function(_0x2f338f,_0x573598){_0x2f338f=_0x2f338f-0x0;var _0x1c36c9=_0x8463[_0x2f338f];return _0x1c36c9;};'use strict';var _=require(_0x3846('0x0'));var attributes=require(_0x3846('0x1'));module['exports']=function(_0x241ea2){var _0x44af57=_0x241ea2[_0x3846('0x2')];function _0x398db5(_0x4c7ba3){var _0x22dbe7=0x2;var _0x28939c=[{'type':_0x4c7ba3['type'],'app':_0x3846('0x3'),'appdata':_0x3846('0x4')+_0x4c7ba3[_0x3846('0x5')],'context':_0x4c7ba3[_0x3846('0x6')],'exten':_0x4c7ba3[_0x3846('0x7')],'priority':_0x22dbe7++,'VoiceExtensionId':_0x4c7ba3['id']},{'type':_0x4c7ba3['type'],'app':_0x4c7ba3[_0x3846('0x8')]?_0x3846('0x3'):_0x3846('0x9'),'appdata':_0x4c7ba3[_0x3846('0x8')]?_0x3846('0xa')+_0x4c7ba3[_0x3846('0x8')]:_0x3846('0xb'),'context':_0x4c7ba3[_0x3846('0x6')],'exten':_0x4c7ba3[_0x3846('0x7')],'priority':_0x22dbe7++,'VoiceExtensionId':_0x4c7ba3['id']}];if(_0x4c7ba3[_0x3846('0x5')]==='inbound'){_0x28939c['push']({'type':_0x3846('0xc'),'app':_0x3846('0x3'),'appdata':_0x3846('0xd')+_0x4c7ba3['id'],'context':_0x4c7ba3[_0x3846('0x6')],'exten':_0x4c7ba3[_0x3846('0x7')],'priority':_0x22dbe7++,'VoiceExtensionId':_0x4c7ba3['id']});}_0x28939c[_0x3846('0xe')]({'type':_0x4c7ba3[_0x3846('0x5')],'app':_0x3846('0x3'),'appdata':_0x3846('0xf'),'context':_0x4c7ba3[_0x3846('0x6')],'exten':_0x4c7ba3[_0x3846('0x7')],'priority':_0x22dbe7++,'VoiceExtensionId':_0x4c7ba3['id']},{'type':_0x4c7ba3[_0x3846('0x5')],'app':'Set','appdata':_0x3846('0x10'),'context':_0x4c7ba3[_0x3846('0x6')],'exten':_0x4c7ba3['exten'],'priority':_0x22dbe7++,'VoiceExtensionId':_0x4c7ba3['id']},{'type':_0x4c7ba3[_0x3846('0x5')],'app':'Set','appdata':_0x3846('0x11'),'context':_0x4c7ba3['context'],'exten':_0x4c7ba3[_0x3846('0x7')],'priority':_0x22dbe7++,'VoiceExtensionId':_0x4c7ba3['id']});return _0x28939c;}function _0x55710f(_0x561e89){var _0x4390cc=0x2;var _0x48806a=[{'type':_0x3846('0x12'),'app':_0x3846('0x3'),'appdata':_0x3846('0x13'),'context':_0x561e89[_0x3846('0x6')],'exten':_0x561e89[_0x3846('0x7')],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':'outbound','app':_0x561e89['alias']?_0x3846('0x3'):'NoOp','appdata':_0x561e89[_0x3846('0x8')]?_0x3846('0xa')+_0x561e89[_0x3846('0x8')]:'No\x20alias\x20set','context':_0x561e89[_0x3846('0x6')],'exten':_0x561e89['exten'],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':_0x3846('0x12'),'app':_0x3846('0x3'),'appdata':_0x3846('0x14')+(_0x561e89['cutdigits']?'${EXTEN:'+_0x561e89[_0x3846('0x15')]+'}':_0x3846('0x16')),'context':_0x561e89['context'],'exten':_0x561e89[_0x3846('0x7')],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':_0x3846('0x12'),'app':'Set','appdata':_0x3846('0xd')+_0x561e89['id'],'context':_0x561e89[_0x3846('0x6')],'exten':_0x561e89[_0x3846('0x7')],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':_0x3846('0x12'),'app':_0x3846('0x17'),'appdata':_0x3846('0x18')+(_0x4390cc+0x2)+_0x3846('0x19')+(_0x4390cc+0x1)+')','context':_0x561e89[_0x3846('0x6')],'exten':_0x561e89[_0x3846('0x7')],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':_0x3846('0x12'),'app':_0x3846('0x3'),'appdata':_0x561e89[_0x3846('0x15')]?_0x3846('0x1a')+_0x561e89[_0x3846('0x15')]+'}':_0x3846('0x1b'),'context':_0x561e89[_0x3846('0x6')],'exten':_0x561e89[_0x3846('0x7')],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':_0x3846('0x12'),'app':_0x3846('0x3'),'appdata':_0x3846('0xf'),'context':_0x561e89[_0x3846('0x6')],'exten':_0x561e89[_0x3846('0x7')],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':'outbound','app':'Set','appdata':_0x3846('0x10'),'context':_0x561e89['context'],'exten':_0x561e89['exten'],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':_0x3846('0x12'),'app':'Set','appdata':_0x3846('0x11'),'context':_0x561e89[_0x3846('0x6')],'exten':_0x561e89['exten'],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':_0x3846('0x12'),'app':'Set','appdata':'outboundrouteid='+_0x561e89['id'],'context':_0x561e89['context'],'exten':_0x561e89[_0x3846('0x7')],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']}];if(_0x561e89[_0x3846('0x1c')](_0x3846('0x1d'))&&_0x561e89[_0x3846('0x1d')]!=='none'){_0x48806a[_0x3846('0xe')]({'type':'outbound','app':_0x3846('0x3'),'appdata':_0x3846('0x1e'),'context':_0x561e89[_0x3846('0x6')],'exten':_0x561e89['exten'],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']},{'type':_0x3846('0x12'),'app':_0x3846('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x561e89[_0x3846('0x1d')]||_0x3846('0x1f'),'context':_0x561e89[_0x3846('0x6')],'exten':_0x561e89[_0x3846('0x7')],'priority':_0x4390cc++,'VoiceExtensionId':_0x561e89['id']});}return _0x48806a;}function _0xd85507(_0x12f83f,_0x3ebc7b){var _0x41b4fc=[{'name':_0x3846('0x20'),'param':0x0},{'name':_0x3846('0x21'),'param':0x1},{'name':_0x3846('0x22'),'param':0x2},{'name':_0x3846('0x23'),'param':0x3}];var _0x39c3ed={};var _0x19f0ab=_0x3ebc7b[_0x3846('0x24')](',');var _0x1ca6bd=[];for(var _0xbaba07=0x0;_0xbaba07<_0x41b4fc['length'];_0xbaba07++){switch(_0x41b4fc[_0xbaba07][_0x3846('0x25')]){case'trunk':_0x39c3ed[_0x3846('0x20')]=_0x19f0ab[_0x41b4fc[_0xbaba07][_0x3846('0x26')]][_0x3846('0x24')]('/')[0x1];_0x39c3ed[_0x3846('0x27')]=_0x19f0ab[_0x41b4fc[_0xbaba07]['param']][_0x3846('0x24')]('/')[0x2];_0x39c3ed[_0x3846('0x28')]=_0x39c3ed[_0x3846('0x27')]?_0x39c3ed[_0x3846('0x27')][_0x3846('0x24')]('$')[0x0]:undefined;_0x39c3ed[_0x3846('0x27')]=_0x12f83f[_0x3846('0x15')]?(_0x39c3ed[_0x3846('0x28')]||'')+'${EXTEN:'+_0x12f83f[_0x3846('0x15')]+'}':(_0x39c3ed[_0x3846('0x28')]||'')+_0x3846('0x16');_0x1ca6bd[_0x41b4fc[_0xbaba07][_0x3846('0x26')]]=[_0x3846('0x29'),_0x39c3ed['trunk'],_0x39c3ed[_0x3846('0x27')]]['join']('/');break;case _0x3846('0x22'):_0x39c3ed['options']=_0x19f0ab[_0x41b4fc[_0xbaba07]['param']];if(_0x12f83f['recordingFormat']!==_0x3846('0x2a')){if(_0x39c3ed[_0x3846('0x22')][_0x3846('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x39c3ed['options']+=_0x3846('0x2c');}}else{_0x39c3ed[_0x3846('0x22')]=_0x39c3ed['options'][_0x3846('0x2d')]('U(xcally-mixmonitor-context)','');}_0x1ca6bd[_0x41b4fc[_0xbaba07]['param']]=_0x39c3ed[_0x3846('0x22')];break;default:_0x1ca6bd[_0x41b4fc[_0xbaba07][_0x3846('0x26')]]=_0x19f0ab[_0x41b4fc[_0xbaba07][_0x3846('0x26')]];}}return _0x1ca6bd[_0x3846('0x2e')](',');}function _0x7a3895(_0x510b66,_0x1f484e,_0x57f372){return new Promise(function(_0x41fb76,_0x239d75){var _0x240af6=[];if(_[_0x3846('0x2f')](_0x1f484e))return _0x41fb76(_0x240af6);_0x44af57[_0x3846('0x30')][_0x3846('0x31')]({'attributes':['id',_0x3846('0x32'),'IntervalId'],'raw':!![]})['then'](function(_0x4ea984){for(var _0x53a7ef=0x0,_0x429bdf=0x0;_0x53a7ef<_0x1f484e[_0x3846('0x33')];_0x53a7ef++,_0x429bdf=0x0){var _0x352fa1=_0x1f484e[_0x53a7ef];var _0xecd914=[];var _0x174af6=[];delete _0x352fa1['id'];if(_0x352fa1[_0x3846('0x32')]!==_0x3846('0x34')){_0x352fa1[_0x3846('0x35')]=[_0x352fa1[_0x3846('0x32')]];}else{_0x352fa1[_0x3846('0x35')]=_0x352fa1[_0x3846('0x36')]?_[_0x3846('0x37')](_[_0x3846('0x38')](_0x4ea984,{'IntervalId':_0x352fa1[_0x3846('0x36')]}),_0x3846('0x32')):[];}_0x352fa1[_0x3846('0x6')]=_0x510b66[_0x3846('0x6')];_0x352fa1[_0x3846('0x7')]=_0x510b66[_0x3846('0x7')];if(_0x352fa1[_0x3846('0x5')])_0x352fa1[_0x3846('0x5')]=_0x352fa1['type'][_0x3846('0x39')]();if(_0x510b66[_0x3846('0x5')]==='outbound'){if(_0x352fa1[_0x3846('0x1c')](_0x3846('0x3a'))&&_0x352fa1['tag']&&_0x352fa1[_0x3846('0x3a')]!=='--'){_0xecd914[_0x3846('0xe')]({'type':_0x352fa1[_0x3846('0x5')][_0x3846('0x39')](),'app':_0x3846('0x3'),'appdata':_0x3846('0x3b')+_0x352fa1[_0x3846('0x3a')],'context':_0x510b66[_0x3846('0x6')],'exten':_0x510b66[_0x3846('0x7')],'priority':_0x352fa1[_0x3846('0x35')][_0x3846('0x33')]+_0x57f372+_0x429bdf++,'VoiceExtensionId':_0x510b66['id']});}_0xecd914['push']({'type':_0x352fa1[_0x3846('0x5')][_0x3846('0x39')](),'app':'ExecIf','appdata':_0x3846('0x3c')+(_0x352fa1[_0x3846('0x3d')]?_0x3846('0x3e')+_0x352fa1[_0x3846('0x3d')]+')':_0x3846('0x3f')),'context':_0x510b66['context'],'exten':_0x510b66[_0x3846('0x7')],'priority':_0x352fa1[_0x3846('0x35')][_0x3846('0x33')]+_0x57f372+_0x429bdf++,'VoiceExtensionId':_0x510b66['id']});}else{if(_0x352fa1['hasOwnProperty'](_0x3846('0x40'))){if([_0x3846('0x41'),'playback'][_0x3846('0x42')](_0x352fa1[_0x3846('0x43')]['toLowerCase']())&&_0x352fa1[_0x3846('0x44')]!==_0x3846('0x45')){if(_0x352fa1['answer']){_0xecd914[_0x3846('0xe')]({'type':_0x352fa1[_0x3846('0x5')]['toLowerCase'](),'app':_0x3846('0x17'),'appdata':_0x3846('0x46'),'context':_0x510b66[_0x3846('0x6')],'exten':_0x510b66['exten'],'priority':_0x352fa1[_0x3846('0x35')][_0x3846('0x33')]+_0x57f372+_0x429bdf++,'VoiceExtensionId':_0x510b66['id']});_0xecd914[_0x3846('0xe')]({'type':_0x352fa1['type'][_0x3846('0x39')](),'app':'Set','appdata':_0x3846('0x47'),'context':_0x510b66['context'],'exten':_0x510b66[_0x3846('0x7')],'priority':_0x352fa1['intervals'][_0x3846('0x33')]+_0x57f372+_0x429bdf++,'VoiceExtensionId':_0x510b66['id']});}else{_0xecd914[_0x3846('0xe')]({'type':_0x352fa1['type'][_0x3846('0x39')](),'app':'ExecIf','appdata':_0x3846('0x48'),'context':_0x510b66[_0x3846('0x6')],'exten':_0x510b66[_0x3846('0x7')],'priority':_0x352fa1[_0x3846('0x35')][_0x3846('0x33')]+_0x57f372+_0x429bdf++,'VoiceExtensionId':_0x510b66['id']});_0xecd914[_0x3846('0xe')]({'type':_0x352fa1[_0x3846('0x5')][_0x3846('0x39')](),'app':_0x3846('0x3'),'appdata':_0x3846('0x49'),'context':_0x510b66[_0x3846('0x6')],'exten':_0x510b66['exten'],'priority':_0x352fa1[_0x3846('0x35')][_0x3846('0x33')]+_0x57f372+_0x429bdf++,'VoiceExtensionId':_0x510b66['id']});}}}}for(var _0x328132=0x0;_0x328132<_0x352fa1['intervals'][_0x3846('0x33')];_0x328132++){var _0x18230c=_0x57f372+_0x352fa1[_0x3846('0x35')]['length'];var _0x434460=_0x328132===_0x352fa1[_0x3846('0x35')][_0x3846('0x33')]-0x1?_0x57f372+_0xecd914['length']+_0x174af6['length']+0x2:_0x57f372+_0x328132+0x1;_0xecd914[_0x3846('0x4a')](_0x328132,0x0,{'type':_0x510b66[_0x3846('0x5')],'app':'GotoIfTime','appdata':_0x352fa1[_0x3846('0x35')][_0x328132]+'?'+_0x510b66[_0x3846('0x6')]+_0x3846('0x4b')+_0x18230c+':'+_0x510b66[_0x3846('0x6')]+',${EXTEN},'+_0x434460,'exten':_0x510b66[_0x3846('0x7')],'context':_0x510b66['context'],'priority':_0x57f372+_0x328132,'VoiceExtensionId':_0x510b66['id']});}if(_0x352fa1[_0x3846('0x44')]===_0x3846('0x4c'))_0x352fa1['appdata']=_0xd85507(_0x510b66,_0x352fa1[_0x3846('0x4d')]);_0x352fa1[_0x3846('0x4e')]=_0xecd914[_0x3846('0x33')]?_[_0x3846('0x4f')](_0xecd914)['priority']+0x1:_0x57f372;_0x240af6=_['concat'](_0x240af6,_0xecd914,[_0x352fa1],_0x174af6);_0x57f372=_[_0x3846('0x4f')](_0x240af6)[_0x3846('0x4e')]+0x1;}return _0x41fb76(_0x240af6);})['catch'](function(_0x2ab75c){_0x239d75(_0x2ab75c);});});}return _0x241ea2[_0x3846('0x50')](_0x3846('0x51'),attributes,{'tableName':_0x3846('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xf668e1){var _0x248484=this[_0x3846('0x53')]({'plain':!![]});var _0x4118cf=_0x248484[_0x3846('0x5')]===_0x3846('0x12')?_0x55710f(_0x248484):_0x398db5(_0x248484);return _0x7a3895(_0x248484,_0xf668e1,_[_0x3846('0x4f')](_0x4118cf)[_0x3846('0x4e')]+0x1)['then'](function(_0x309e31){var _0x1455d5=_[_0x3846('0x54')](_0x4118cf,_0x309e31);_0x1455d5[_0x3846('0xe')]({'type':_0x248484[_0x3846('0x5')],'app':'Hangup','exten':_0x248484[_0x3846('0x7')],'context':_0x248484[_0x3846('0x6')],'priority':_['last'](_0x1455d5)[_0x3846('0x4e')]+0x1,'VoiceExtensionId':_0x248484['id']});return _0x1455d5;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 695403d..8cf9eda 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 _0xe2bc=['../../config/environment','jayson/promise','client','http','redis','localhost','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xe2bc[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0xce2b('0x0'));var util=require('util');var moment=require(_0xce2b('0x1'));var BPromise=require('bluebird');var rs=require(_0xce2b('0x2'));var fs=require('fs');var Redis=require(_0xce2b('0x3'));var db=require(_0xce2b('0x4'))['db'];var utils=require(_0xce2b('0x5'));var logger=require(_0xce2b('0x6'))('rpc');var config=require(_0xce2b('0x7'));var jayson=require(_0xce2b('0x8'));var client=jayson[_0xce2b('0x9')][_0xce2b('0xa')]({'port':0x232a});config[_0xce2b('0xb')]=_['defaults'](config[_0xce2b('0xb')],{'host':_0xce2b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce2b('0xb')]));require(_0xce2b('0xd'))[_0xce2b('0xe')](socket);function respondWithRpcPromise(_0x3786aa,_0x1e5036,_0xc6cdb){return new BPromise(function(_0x3eae6d,_0xa7941){return client[_0xce2b('0xf')](_0x3786aa,_0xc6cdb)[_0xce2b('0x10')](function(_0x47a597){logger[_0xce2b('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x1e5036,_0xce2b('0x12'));logger[_0xce2b('0x13')](_0xce2b('0x14'),_0x1e5036,_0xce2b('0x12'),JSON[_0xce2b('0x15')](_0x47a597));if(_0x47a597[_0xce2b('0x16')]){if(_0x47a597[_0xce2b('0x16')][_0xce2b('0x17')]===0x1f4){logger['error'](_0xce2b('0x18'),_0x1e5036,_0x47a597[_0xce2b('0x16')]['message']);return _0xa7941(_0x47a597['error']['message']);}logger[_0xce2b('0x16')](_0xce2b('0x18'),_0x1e5036,_0x47a597[_0xce2b('0x16')]['message']);return _0x3eae6d(_0x47a597['error'][_0xce2b('0x19')]);}else{logger[_0xce2b('0x11')](_0xce2b('0x18'),_0x1e5036,_0xce2b('0x12'));_0x3eae6d(_0x47a597[_0xce2b('0x1a')][_0xce2b('0x19')]);}})[_0xce2b('0x1b')](function(_0x31316d){logger[_0xce2b('0x16')](_0xce2b('0x18'),_0x1e5036,_0x31316d);_0xa7941(_0x31316d);});});}exports['GetVoiceExtension']=function(_0x192002){var _0x1d888c=this;return new Promise(function(_0x167e55,_0x44c2af){return db[_0xce2b('0x1c')][_0xce2b('0x1d')]({'raw':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x1f')]===undefined?!![]:![]:!![],'where':_0x192002[_0xce2b('0x1e')]?_0x192002['options'][_0xce2b('0x20')]||null:null,'attributes':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x21')]||null:null,'limit':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x22')]||null:null,'include':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x192002['options']['include'],function(_0x527b03){return{'model':db[_0x527b03[_0xce2b('0x25')]],'as':_0x527b03['as'],'attributes':_0x527b03['attributes'],'include':_0x527b03[_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x527b03['include'],function(_0x60eca0){return{'model':db[_0x60eca0[_0xce2b('0x25')]],'as':_0x60eca0['as'],'attributes':_0x60eca0['attributes'],'include':_0x60eca0[_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x60eca0[_0xce2b('0x23')],function(_0x50a62f){return{'model':db[_0x50a62f['model']],'as':_0x50a62f['as'],'attributes':_0x50a62f[_0xce2b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xce2b('0x10')](function(_0x211b88){logger['info']('GetVoiceExtension',_0x192002);logger[_0xce2b('0x13')](_0xce2b('0x26'),_0x192002,JSON[_0xce2b('0x15')](_0x211b88));_0x167e55(_0x211b88);})['catch'](function(_0x3a8c00){logger[_0xce2b('0x16')](_0xce2b('0x26'),_0x3a8c00[_0xce2b('0x19')],_0x192002);_0x44c2af(_0x1d888c[_0xce2b('0x16')](0x1f4,_0x3a8c00[_0xce2b('0x19')]));});});}; \ No newline at end of file +var _0x3e24=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e24,0x167));var _0x43e2=function(_0x164e8f,_0xdba27a){_0x164e8f=_0x164e8f-0x0;var _0x2b2840=_0x3e24[_0x164e8f];return _0x2b2840;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});config[_0x43e2('0xc')]=_[_0x43e2('0xd')](config['redis'],{'host':_0x43e2('0xe'),'port':0x18eb});var socket=require(_0x43e2('0xf'))(new Redis(config['redis']));require(_0x43e2('0x10'))[_0x43e2('0x11')](socket);function respondWithRpcPromise(_0x5375d8,_0x2ed387,_0x1ef968){return new BPromise(function(_0x52146c,_0x45848e){return client['request'](_0x5375d8,_0x1ef968)['then'](function(_0x5847f0){logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));logger[_0x43e2('0x15')](_0x43e2('0x16'),_0x2ed387,_0x43e2('0x14'),JSON[_0x43e2('0x17')](_0x5847f0));if(_0x5847f0[_0x43e2('0x18')]){if(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x19')]===0x1f4){logger[_0x43e2('0x18')](_0x43e2('0x13'),_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x45848e(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}logger[_0x43e2('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x52146c(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}else{logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));_0x52146c(_0x5847f0[_0x43e2('0x1b')][_0x43e2('0x1a')]);}})[_0x43e2('0x1c')](function(_0x399cab){logger['error'](_0x43e2('0x13'),_0x2ed387,_0x399cab);_0x45848e(_0x399cab);});});}exports[_0x43e2('0x1d')]=function(_0x4de509){var _0x115c0a=this;return new Promise(function(_0x5a5df5,_0x3bc2ce){return db[_0x43e2('0x1e')][_0x43e2('0x1f')]({'raw':_0x4de509[_0x43e2('0x20')]?_0x4de509[_0x43e2('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4de509[_0x43e2('0x20')]?_0x4de509[_0x43e2('0x20')][_0x43e2('0x21')]||null:null,'attributes':_0x4de509['options']?_0x4de509[_0x43e2('0x20')][_0x43e2('0x22')]||null:null,'limit':_0x4de509[_0x43e2('0x20')]?_0x4de509[_0x43e2('0x20')]['limit']||null:null,'include':_0x4de509[_0x43e2('0x20')]?_0x4de509[_0x43e2('0x20')][_0x43e2('0x23')]?_[_0x43e2('0x24')](_0x4de509[_0x43e2('0x20')][_0x43e2('0x23')],function(_0x3ca16b){return{'model':db[_0x3ca16b[_0x43e2('0x25')]],'as':_0x3ca16b['as'],'attributes':_0x3ca16b[_0x43e2('0x22')],'include':_0x3ca16b[_0x43e2('0x23')]?_[_0x43e2('0x24')](_0x3ca16b[_0x43e2('0x23')],function(_0x52ed49){return{'model':db[_0x52ed49[_0x43e2('0x25')]],'as':_0x52ed49['as'],'attributes':_0x52ed49[_0x43e2('0x22')],'include':_0x52ed49['include']?_[_0x43e2('0x24')](_0x52ed49[_0x43e2('0x23')],function(_0x2dffa2){return{'model':db[_0x2dffa2[_0x43e2('0x25')]],'as':_0x2dffa2['as'],'attributes':_0x2dffa2[_0x43e2('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42f495){logger[_0x43e2('0x12')](_0x43e2('0x1d'),_0x4de509);logger[_0x43e2('0x15')](_0x43e2('0x1d'),_0x4de509,JSON[_0x43e2('0x17')](_0x42f495));_0x5a5df5(_0x42f495);})['catch'](function(_0x51226b){logger[_0x43e2('0x18')](_0x43e2('0x1d'),_0x51226b[_0x43e2('0x1a')],_0x4de509);_0x3bc2ce(_0x115c0a[_0x43e2('0x18')](0x1f4,_0x51226b[_0x43e2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c97b589..028badb 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(_0x267ecc,_0x184cbd){var _0x240e1e=function(_0x4efdd1){while(--_0x4efdd1){_0x267ecc['push'](_0x267ecc['shift']());}};_0x240e1e(++_0x184cbd);}(_0x0295,0x1f0));var _0x5029=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0x0295[_0x5e6bec];return _0x5dc5cf;};'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 _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x15755a,_0x3d960c){var _0xdc3438=function(_0x53ee76){while(--_0x53ee76){_0x15755a['push'](_0x15755a['shift']());}};_0xdc3438(++_0x3d960c);}(_0x5fab,0x177));var _0xb5fa=function(_0x19616a,_0x545c46){_0x19616a=_0x19616a-0x0;var _0x57bfb4=_0x5fab[_0x19616a];return _0x57bfb4;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index df5e153..5c819a3 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 _0x4bd3=['post','create','put','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','getMessages'];(function(_0x57cc24,_0x489aaf){var _0x4ccc33=function(_0x538f68){while(--_0x538f68){_0x57cc24['push'](_0x57cc24['shift']());}};_0x4ccc33(++_0x489aaf);}(_0x4bd3,0x174));var _0x34bd=function(_0x20c612,_0x4599e8){_0x20c612=_0x20c612-0x0;var _0x24dcaa=_0x4bd3[_0x20c612];return _0x24dcaa;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34bd('0x3'));var interaction=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var controller=require('./voiceMail.controller');router[_0x34bd('0x6')]('/',auth[_0x34bd('0x7')](),controller['index']);router[_0x34bd('0x6')](_0x34bd('0x8'),auth['isAuthenticated'](),controller[_0x34bd('0x9')]);router[_0x34bd('0x6')](_0x34bd('0xa'),auth[_0x34bd('0x7')](),controller[_0x34bd('0xb')]);router[_0x34bd('0xc')]('/',auth['isAuthenticated'](),controller[_0x34bd('0xd')]);router[_0x34bd('0xe')](_0x34bd('0x8'),auth[_0x34bd('0x7')](),controller['update']);router['delete'](_0x34bd('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x34bd('0xf')]=router; \ No newline at end of file +var _0x4c60=['exports','multer','util','path','connect-timeout','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','put','update','destroy'];(function(_0x10116a,_0x3e680c){var _0x1f83d4=function(_0x79caf5){while(--_0x79caf5){_0x10116a['push'](_0x10116a['shift']());}};_0x1f83d4(++_0x3e680c);}(_0x4c60,0xc1));var _0x04c6=function(_0x449ffa,_0x285fff){_0x449ffa=_0x449ffa-0x0;var _0x547d3c=_0x4c60[_0x449ffa];return _0x547d3c;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['show']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x04c6('0xc')]('/:id',auth[_0x04c6('0x7')](),controller[_0x04c6('0xd')]);router['delete'](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xe')]);module[_0x04c6('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 ac0d500..7b9cb2d 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 _0xef6c=['VIRTUAL','fullname','\x20-\x20','exports','STRING','from-voicemail','setDataValue','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x33bc93,_0xcf2d7c){var _0x2bfa36=function(_0x77b0d){while(--_0x77b0d){_0x33bc93['push'](_0x33bc93['shift']());}};_0x2bfa36(++_0xcf2d7c);}(_0xef6c,0x81));var _0xcef6=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xef6c[_0x469a3c];return _0x968f4;};'use strict';var Sequelize=require('sequelize');module[_0xcef6('0x0')]={'customer_id':{'type':Sequelize[_0xcef6('0x1')]},'context':{'type':Sequelize[_0xcef6('0x1')],'defaultValue':_0xcef6('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xcef6('0x1')]},'fullname':{'type':Sequelize[_0xcef6('0x1')]},'email':{'type':Sequelize[_0xcef6('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1763de){this[_0xcef6('0x3')]('email',typeof _0x1763de===_0xcef6('0x4')&&_0x1763de[_0xcef6('0x5')]()?_0x1763de[_0xcef6('0x5')]():null);}},'pager':{'type':Sequelize[_0xcef6('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0xcef6('0x6')](_0xcef6('0x7'),'no'),'defaultValue':_0xcef6('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xcef6('0x6')](_0xcef6('0x7'),'no'),'defaultValue':_0xcef6('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0xcef6('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xcef6('0x6')](_0xcef6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xcef6('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xcef6('0x6')](_0xcef6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xcef6('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xcef6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xcef6('0x6')](_0xcef6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xcef6('0x6')](_0xcef6('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xcef6('0x6')](_0xcef6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xcef6('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xcef6('0x6')](_0xcef6('0x7'),'no'),'defaultValue':_0xcef6('0x7'),'allowNull':![]},'stamp':{'type':_0xcef6('0x9')},'emailsubject':{'type':Sequelize[_0xcef6('0x1')]},'emailbody':{'type':Sequelize[_0xcef6('0x1')]},'maxsecs':{'type':Sequelize[_0xcef6('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xcef6('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xcef6('0xb')],'get':function(){return this['getDataValue'](_0xcef6('0xc'))+_0xcef6('0xd')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0xf7b2=['sequelize','exports','STRING','contest_mailbox','setDataValue','email','trim','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x5d5c06,_0x5e97f6){var _0x2ccc0d=function(_0x5e1db9){while(--_0x5e1db9){_0x5d5c06['push'](_0x5d5c06['shift']());}};_0x2ccc0d(++_0x5e97f6);}(_0xf7b2,0x190));var _0x2f7b=function(_0x27d5ab,_0x33050f){_0x27d5ab=_0x27d5ab-0x0;var _0xb260cb=_0xf7b2[_0x27d5ab];return _0xb260cb;};'use strict';var Sequelize=require(_0x2f7b('0x0'));module[_0x2f7b('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2f7b('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x2f7b('0x2')],'defaultValue':'','allowNull':![],'unique':_0x2f7b('0x3')},'password':{'type':Sequelize[_0x2f7b('0x2')]},'fullname':{'type':Sequelize[_0x2f7b('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x597fc1){this[_0x2f7b('0x4')](_0x2f7b('0x5'),typeof _0x597fc1==='string'&&_0x597fc1[_0x2f7b('0x6')]()?_0x597fc1['trim']():null);}},'pager':{'type':Sequelize[_0x2f7b('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x2f7b('0x7')](_0x2f7b('0x8'),'no'),'defaultValue':_0x2f7b('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x2f7b('0x7')](_0x2f7b('0x8'),'no'),'defaultValue':_0x2f7b('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2f7b('0x2')]},'callback':{'type':Sequelize[_0x2f7b('0x2')]},'review':{'type':Sequelize[_0x2f7b('0x7')](_0x2f7b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2f7b('0x7')](_0x2f7b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x2f7b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x2f7b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2f7b('0x7')](_0x2f7b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2f7b('0x7')](_0x2f7b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2f7b('0x7')](_0x2f7b('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x2f7b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x2f7b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2f7b('0x7')]('yes','no'),'defaultValue':_0x2f7b('0x8'),'allowNull':![]},'stamp':{'type':_0x2f7b('0x9')},'emailsubject':{'type':Sequelize[_0x2f7b('0x2')]},'emailbody':{'type':Sequelize[_0x2f7b('0x2')]},'maxsecs':{'type':Sequelize[_0x2f7b('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2f7b('0xb')],'get':function(){return this[_0x2f7b('0xc')](_0x2f7b('0xd'))+_0x2f7b('0xe')+this['getDataValue'](_0x2f7b('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e6252d3..2688710 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','eml-format','moment','util','path','sox','to-csv','ejs'];(function(_0x128241,_0x277491){var _0x27cbc5=function(_0x3074d5){while(--_0x3074d5){_0x128241['push'](_0x128241['shift']());}};_0x27cbc5(++_0x277491);}(_0xf4eb,0xec));var _0xbf4e=function(_0x29c90d,_0x50cc96){_0x29c90d=_0x29c90d-0x0;var _0x2495c6=_0xf4eb[_0x29c90d];return _0x2495c6;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['VoiceMail'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));};exports[_0xbf4e('0x4c')]=function(_0x3e60e7,_0x16592f,_0xfd54c){return db['VoiceMail']['findOne']({'where':{'id':_0x3e60e7['params']['id']}})['then'](handleEntityNotFound(_0x16592f,null))[_0xbf4e('0x1f')](function(_0x453411){var _0x5cfc26;var _0x200096={},_0x23c335={};_0x23c335[_0xbf4e('0x2c')]=_[_0xbf4e('0x2d')](db[_0xbf4e('0x4d')][_0xbf4e('0x41')]);_0x23c335[_0xbf4e('0x32')]=_['keys'](_0x3e60e7[_0xbf4e('0x32')]);_0x23c335[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x23c335['model'],_0x23c335['query']);_0x200096[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x23c335[_0xbf4e('0x2c')],qs['fields'](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x200096[_0xbf4e('0x30')]=_0x200096[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x200096[_0xbf4e('0x30')]:_0x23c335[_0xbf4e('0x2c')];if(!_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x4e')](_0xbf4e('0x4f'))){_0x200096[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x3e60e7['query'][_0xbf4e('0x18')]);_0x200096['offset']=qs[_0xbf4e('0x16')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x200096[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x35')]);_0x200096[_0xbf4e('0x37')]=qs['filters'](_[_0xbf4e('0x36')](_0x3e60e7[_0xbf4e('0x32')],_0x23c335[_0xbf4e('0x2e')]));if(_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x3b')]){_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0x200096[_0xbf4e('0x30')],function(_0x12f19f){var _0x2c606b={};_0x2c606b[_0x12f19f]={'$like':'%'+_0x3e60e7['query'][_0xbf4e('0x3b')]+'%'};return _0x2c606b;})});}_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'mailboxuser':_0x453411[_0xbf4e('0x50')]});_0x200096=_[_0xbf4e('0x38')]({},_0x200096,_0x3e60e7['options']);return db[_0xbf4e('0x4d')]['findAndCountAll'](_0x200096)['then'](respondWithFilteredResult(_0x16592f,_0x200096));})[_0xbf4e('0x3f')](handleError(_0x16592f,null));}; \ No newline at end of file +var _0xf45e=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','UserProfileResource','error','stack','name','send','map','VoiceMail','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir'];(function(_0x27e121,_0xb086c7){var _0x5008f2=function(_0x6ade4a){while(--_0x6ade4a){_0x27e121['push'](_0x27e121['shift']());}};_0x5008f2(++_0xb086c7);}(_0xf45e,0x115));var _0xef45=function(_0x1194c4,_0x598963){_0x1194c4=_0x1194c4-0x0;var _0x32ea56=_0xf45e[_0x1194c4];return _0x32ea56;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){var _0x315777=_0x7817d0['get']({'plain':!![]});var _0x208b35='Voicemails';return db[_0xef45('0x2a')][_0xef45('0x28')]({'where':{'type':_0x208b35,'resourceId':_0x315777['id']}})['then'](function(){return _0x7817d0;});})[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1096af,_0x4f8c9b){return function(_0x550e18){if(!_0x550e18){_0x1096af['sendStatus'](0x194);}return _0x550e18;};}function handleError(_0x53690e,_0x1f636f){_0x1f636f=_0x1f636f||0x1f4;return function(_0x2f72ef){logger[_0xef45('0x2b')](_0x2f72ef[_0xef45('0x2c')]);if(_0x2f72ef['name']){delete _0x2f72ef[_0xef45('0x2d')];}_0x53690e['status'](_0x1f636f)[_0xef45('0x2e')](_0x2f72ef);};}exports['index']=function(_0x3e6922,_0x5bfd2d){var _0x575734={},_0x14ce5a={},_0x3e45de={'count':0x0,'rows':[]};var _0x390a7a=_[_0xef45('0x2f')](db[_0xef45('0x30')]['rawAttributes'],function(_0x5551ce){return{'name':_0x5551ce['fieldName'],'type':_0x5551ce[_0xef45('0x31')][_0xef45('0x32')]};});_0x14ce5a[_0xef45('0x33')]=_[_0xef45('0x2f')](_0x390a7a,_0xef45('0x2d'));_0x14ce5a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x3e6922['query']);_0x14ce5a['filters']=_[_0xef45('0x36')](_0x14ce5a['model'],_0x14ce5a[_0xef45('0x34')]);_0x575734['attributes']=_[_0xef45('0x36')](_0x14ce5a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x3e6922[_0xef45('0x34')][_0xef45('0x37')]));_0x575734['attributes']=_0x575734[_0xef45('0x38')][_0xef45('0x39')]?_0x575734[_0xef45('0x38')]:_0x14ce5a['model'];if(!_0x3e6922['query'][_0xef45('0x3a')](_0xef45('0x3b'))){_0x575734['limit']=qs[_0xef45('0x20')](_0x3e6922['query']['limit']);_0x575734[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x3e6922[_0xef45('0x34')]['offset']);}_0x575734[_0xef45('0x3c')]=qs[_0xef45('0x3d')](_0x3e6922[_0xef45('0x34')][_0xef45('0x3d')]);_0x575734['where']=qs['filters'](_[_0xef45('0x3e')](_0x3e6922[_0xef45('0x34')],_0x14ce5a[_0xef45('0x3f')]),_0x390a7a);if(_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]){_0x575734[_0xef45('0x41')]=_[_0xef45('0x42')](_0x575734[_0xef45('0x41')],{'$or':_['map'](_0x390a7a,function(_0x4f5877){if(_0x4f5877[_0xef45('0x31')]!==_0xef45('0x43')){var _0x154e72={};_0x154e72[_0x4f5877[_0xef45('0x2d')]]={'$like':'%'+_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]+'%'};return _0x154e72;}})});}_0x575734=_[_0xef45('0x42')]({},_0x575734,_0x3e6922[_0xef45('0x44')]);var _0x3a5082={'where':_0x575734[_0xef45('0x41')]};return db[_0xef45('0x30')][_0xef45('0x21')](_0x3a5082)[_0xef45('0x29')](function(_0xd7d217){_0x3e45de[_0xef45('0x21')]=_0xd7d217;if(_0x3e6922[_0xef45('0x34')]['includeAll']){_0x575734[_0xef45('0x45')]=[{'all':!![]}];}return db[_0xef45('0x30')][_0xef45('0x46')](_0x575734);})[_0xef45('0x29')](function(_0x54ccb8){_0x3e45de[_0xef45('0x47')]=_0x54ccb8;return _0x3e45de;})['then'](respondWithFilteredResult(_0x5bfd2d,_0x575734))[_0xef45('0x48')](handleError(_0x5bfd2d,null));};exports['show']=function(_0x5faf67,_0x2d086f){var _0x2236d9={'raw':!![],'where':{'id':_0x5faf67[_0xef45('0x49')]['id']}},_0x36e81a={};_0x36e81a[_0xef45('0x33')]=_[_0xef45('0x35')](db['VoiceMail'][_0xef45('0x4a')]);_0x36e81a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5faf67[_0xef45('0x34')]);_0x36e81a[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],_0x36e81a[_0xef45('0x34')]);_0x2236d9[_0xef45('0x38')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x5faf67[_0xef45('0x34')][_0xef45('0x37')]));_0x2236d9[_0xef45('0x38')]=_0x2236d9['attributes'][_0xef45('0x39')]?_0x2236d9[_0xef45('0x38')]:_0x36e81a[_0xef45('0x33')];if(_0x5faf67['query']['includeAll']){_0x2236d9['include']=[{'all':!![]}];}_0x2236d9=_[_0xef45('0x42')]({},_0x2236d9,_0x5faf67[_0xef45('0x44')]);return db[_0xef45('0x30')][_0xef45('0x4b')](_0x2236d9)[_0xef45('0x29')](handleEntityNotFound(_0x2d086f,null))[_0xef45('0x29')](respondWithResult(_0x2d086f,null))['catch'](handleError(_0x2d086f,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){return db['VoiceMail']['create'](_0x463796[_0xef45('0x4d')],{})[_0xef45('0x29')](function(_0x4feeb1){var _0x1a56ae=_0x463796[_0xef45('0x4e')][_0xef45('0x4f')]({'plain':!![]});if(!_0x1a56ae)throw new Error(_0xef45('0x50'));if(_0x1a56ae[_0xef45('0x51')]===_0xef45('0x4e')){var _0x23581f=_0x4feeb1[_0xef45('0x4f')]({'plain':!![]});var _0x1961b4=_0xef45('0x52');return db[_0xef45('0x53')][_0xef45('0x4b')]({'where':{'name':_0x1961b4,'userProfileId':_0x1a56ae[_0xef45('0x54')]},'raw':!![]})[_0xef45('0x29')](function(_0x48a391){if(_0x48a391&&_0x48a391[_0xef45('0x55')]===0x0){return db[_0xef45('0x2a')][_0xef45('0x4c')]({'name':_0x23581f['name'],'resourceId':_0x23581f['id'],'type':_0x48a391[_0xef45('0x2d')],'sectionId':_0x48a391['id']},{})[_0xef45('0x29')](function(){return _0x4feeb1;});}else{return _0x4feeb1;}})[_0xef45('0x48')](function(_0x1531ea){logger['error'](_0xef45('0x56'),_0x1531ea);throw _0x1531ea;});}return _0x4feeb1;})[_0xef45('0x29')](respondWithResult(_0x2b2419,0xc9))[_0xef45('0x48')](handleError(_0x2b2419,null));};exports[_0xef45('0x57')]=function(_0x67d57b,_0x41f575){if(_0x67d57b[_0xef45('0x4d')]['id']){delete _0x67d57b[_0xef45('0x4d')]['id'];}return db[_0xef45('0x30')][_0xef45('0x4b')]({'where':{'id':_0x67d57b[_0xef45('0x49')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x41f575,null))['then'](saveUpdates(_0x67d57b[_0xef45('0x4d')],null))[_0xef45('0x29')](respondWithResult(_0x41f575,null))[_0xef45('0x48')](handleError(_0x41f575,null));};exports[_0xef45('0x28')]=function(_0x2fe9cf,_0x32232f){return db['VoiceMail']['find']({'where':{'id':_0x2fe9cf[_0xef45('0x49')]['id']}})['then'](handleEntityNotFound(_0x32232f,null))[_0xef45('0x29')](removeEntity(_0x32232f,null))[_0xef45('0x48')](handleError(_0x32232f,null));};exports[_0xef45('0x58')]=function(_0x5676fb,_0x16b04e,_0x398dc0){return db['VoiceMail'][_0xef45('0x59')]({'where':{'id':_0x5676fb['params']['id']}})['then'](handleEntityNotFound(_0x16b04e,null))[_0xef45('0x29')](function(_0x4f78ac){var _0x189f22;var _0x3fbc26={},_0x22fd64={};_0x22fd64['model']=_[_0xef45('0x35')](db[_0xef45('0x5a')]['rawAttributes']);_0x22fd64[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5676fb[_0xef45('0x34')]);_0x22fd64[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x22fd64[_0xef45('0x33')],_0x22fd64[_0xef45('0x34')]);_0x3fbc26[_0xef45('0x38')]=_['intersection'](_0x22fd64[_0xef45('0x33')],qs['fields'](_0x5676fb['query'][_0xef45('0x37')]));_0x3fbc26['attributes']=_0x3fbc26[_0xef45('0x38')][_0xef45('0x39')]?_0x3fbc26['attributes']:_0x22fd64[_0xef45('0x33')];if(!_0x5676fb[_0xef45('0x34')][_0xef45('0x3a')](_0xef45('0x3b'))){_0x3fbc26[_0xef45('0x20')]=qs[_0xef45('0x20')](_0x5676fb['query'][_0xef45('0x20')]);_0x3fbc26[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x5676fb[_0xef45('0x34')][_0xef45('0x1e')]);}_0x3fbc26['order']=qs[_0xef45('0x3d')](_0x5676fb['query'][_0xef45('0x3d')]);_0x3fbc26[_0xef45('0x41')]=qs['filters'](_[_0xef45('0x3e')](_0x5676fb[_0xef45('0x34')],_0x22fd64[_0xef45('0x3f')]));if(_0x5676fb['query']['filter']){_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'$or':_['map'](_0x3fbc26[_0xef45('0x38')],function(_0x3956b0){var _0x49131e={};_0x49131e[_0x3956b0]={'$like':'%'+_0x5676fb[_0xef45('0x34')]['filter']+'%'};return _0x49131e;})});}_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'mailboxuser':_0x4f78ac[_0xef45('0x5b')]});_0x3fbc26=_[_0xef45('0x42')]({},_0x3fbc26,_0x5676fb[_0xef45('0x44')]);return db[_0xef45('0x5a')][_0xef45('0x5c')](_0x3fbc26)['then'](respondWithFilteredResult(_0x16b04e,_0x3fbc26));})[_0xef45('0x48')](handleError(_0x16b04e,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b0b4bb3..1b27a18 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 _0x3ea2=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','../../config/logger','api','bluebird','rimraf'];(function(_0x21d717,_0x57342b){var _0xfdde90=function(_0x2994d9){while(--_0x2994d9){_0x21d717['push'](_0x21d717['shift']());}};_0xfdde90(++_0x57342b);}(_0x3ea2,0x1c2));var _0x23ea=function(_0x10eb38,_0x2086bd){_0x10eb38=_0x10eb38-0x0;var _0x5af9b5=_0x3ea2[_0x10eb38];return _0x5af9b5;};'use strict';var _=require(_0x23ea('0x0'));var util=require('util');var logger=require(_0x23ea('0x1'))(_0x23ea('0x2'));var moment=require('moment');var BPromise=require(_0x23ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x23ea('0x4'));var config=require(_0x23ea('0x5'));var attributes=require(_0x23ea('0x6'));module[_0x23ea('0x7')]=function(_0x4dabc3,_0x4225a9){return _0x4dabc3[_0x23ea('0x8')](_0x23ea('0x9'),attributes,{'tableName':_0x23ea('0xa'),'paranoid':![],'indexes':[{'name':_0x23ea('0xb'),'fields':['mailbox',_0x23ea('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0b7=['../../config/logger','api','moment','bluebird','path','rimraf','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util'];(function(_0x15e723,_0x5ddfb1){var _0x42d964=function(_0x1ab288){while(--_0x1ab288){_0x15e723['push'](_0x15e723['shift']());}};_0x42d964(++_0x5ddfb1);}(_0xe0b7,0x67));var _0x7e0b=function(_0x4cace9,_0x31cd15){_0x4cace9=_0x4cace9-0x0;var _0x58dd58=_0xe0b7[_0x4cace9];return _0x58dd58;};'use strict';var _=require(_0x7e0b('0x0'));var util=require(_0x7e0b('0x1'));var logger=require(_0x7e0b('0x2'))(_0x7e0b('0x3'));var moment=require(_0x7e0b('0x4'));var BPromise=require(_0x7e0b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e0b('0x6'));var rimraf=require(_0x7e0b('0x7'));var config=require('../../config/environment');var attributes=require(_0x7e0b('0x8'));module['exports']=function(_0x475470,_0x141d01){return _0x475470[_0x7e0b('0x9')](_0x7e0b('0xa'),attributes,{'tableName':_0x7e0b('0xb'),'paranoid':![],'indexes':[{'name':_0x7e0b('0xc'),'fields':[_0x7e0b('0xd'),_0x7e0b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index ea80e92..e3dd67b 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 _0xf298=['VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x392bcc,_0x4610b4){var _0x5cf7da=function(_0x5981ac){while(--_0x5981ac){_0x392bcc['push'](_0x392bcc['shift']());}};_0x5cf7da(++_0x4610b4);}(_0xf298,0xf8));var _0x8f29=function(_0x94fb7f,_0x16310b){_0x94fb7f=_0x94fb7f-0x0;var _0x30eb5e=_0xf298[_0x94fb7f];return _0x30eb5e;};'use strict';var _=require(_0x8f29('0x0'));var util=require(_0x8f29('0x1'));var moment=require(_0x8f29('0x2'));var BPromise=require(_0x8f29('0x3'));var rs=require(_0x8f29('0x4'));var fs=require('fs');var Redis=require(_0x8f29('0x5'));var db=require(_0x8f29('0x6'))['db'];var utils=require(_0x8f29('0x7'));var logger=require(_0x8f29('0x8'))(_0x8f29('0x9'));var config=require(_0x8f29('0xa'));var jayson=require(_0x8f29('0xb'));var client=jayson['client'][_0x8f29('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a69c7,_0x314018,_0x1920c8){return new BPromise(function(_0x584fd2,_0x4930d0){return client['request'](_0x4a69c7,_0x1920c8)[_0x8f29('0xd')](function(_0x59630a){logger['info'](_0x8f29('0xe'),_0x314018,_0x8f29('0xf'));logger['debug'](_0x8f29('0x10'),_0x314018,_0x8f29('0xf'),JSON['stringify'](_0x59630a));if(_0x59630a['error']){if(_0x59630a[_0x8f29('0x11')][_0x8f29('0x12')]===0x1f4){logger[_0x8f29('0x11')]('VoiceMail,\x20%s,\x20%s',_0x314018,_0x59630a[_0x8f29('0x11')]['message']);return _0x4930d0(_0x59630a[_0x8f29('0x11')][_0x8f29('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x314018,_0x59630a[_0x8f29('0x11')][_0x8f29('0x13')]);return _0x584fd2(_0x59630a[_0x8f29('0x11')]['message']);}else{logger[_0x8f29('0x14')](_0x8f29('0xe'),_0x314018,_0x8f29('0xf'));_0x584fd2(_0x59630a['result'][_0x8f29('0x13')]);}})[_0x8f29('0x15')](function(_0x4d1a6c){logger[_0x8f29('0x11')](_0x8f29('0xe'),_0x314018,_0x4d1a6c);_0x4930d0(_0x4d1a6c);});});} \ No newline at end of file +var _0xfa1b=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x312ece,_0x2b10f9){var _0x545c5e=function(_0x287124){while(--_0x287124){_0x312ece['push'](_0x312ece['shift']());}};_0x545c5e(++_0x2b10f9);}(_0xfa1b,0x106));var _0xbfa1=function(_0x3e9776,_0x30b05f){_0x3e9776=_0x3e9776-0x0;var _0x386e07=_0xfa1b[_0x3e9776];return _0x386e07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbfa1('0x0'));var BPromise=require(_0xbfa1('0x1'));var rs=require(_0xbfa1('0x2'));var fs=require('fs');var Redis=require(_0xbfa1('0x3'));var db=require(_0xbfa1('0x4'))['db'];var utils=require(_0xbfa1('0x5'));var logger=require(_0xbfa1('0x6'))('rpc');var config=require(_0xbfa1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbfa1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f6f9e,_0x2c6359,_0x16b12f){return new BPromise(function(_0x5a2c46,_0x44267b){return client[_0xbfa1('0x9')](_0x3f6f9e,_0x16b12f)[_0xbfa1('0xa')](function(_0x34aa7f){logger['info'](_0xbfa1('0xb'),_0x2c6359,_0xbfa1('0xc'));logger[_0xbfa1('0xd')](_0xbfa1('0xe'),_0x2c6359,_0xbfa1('0xc'),JSON[_0xbfa1('0xf')](_0x34aa7f));if(_0x34aa7f[_0xbfa1('0x10')]){if(_0x34aa7f['error']['code']===0x1f4){logger[_0xbfa1('0x10')](_0xbfa1('0xb'),_0x2c6359,_0x34aa7f[_0xbfa1('0x10')][_0xbfa1('0x11')]);return _0x44267b(_0x34aa7f['error'][_0xbfa1('0x11')]);}logger[_0xbfa1('0x10')](_0xbfa1('0xb'),_0x2c6359,_0x34aa7f[_0xbfa1('0x10')][_0xbfa1('0x11')]);return _0x5a2c46(_0x34aa7f[_0xbfa1('0x10')][_0xbfa1('0x11')]);}else{logger[_0xbfa1('0x12')](_0xbfa1('0xb'),_0x2c6359,_0xbfa1('0xc'));_0x5a2c46(_0x34aa7f[_0xbfa1('0x13')][_0xbfa1('0x11')]);}})[_0xbfa1('0x14')](function(_0x2dbf64){logger[_0xbfa1('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2c6359,_0x2dbf64);_0x44267b(_0x2dbf64);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index b27c13d..a45d5bb 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 _0xad42=['put','update','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','post'];(function(_0x3a5df2,_0x2b5517){var _0x3a65b6=function(_0x4e14db){while(--_0x4e14db){_0x3a5df2['push'](_0x3a5df2['shift']());}};_0x3a65b6(++_0x2b5517);}(_0xad42,0x168));var _0x2ad4=function(_0x1a800e,_0x3bfb01){_0x1a800e=_0x1a800e-0x0;var _0x4eb91e=_0xad42[_0x1a800e];return _0x4eb91e;};'use strict';var multer=require('multer');var util=require(_0x2ad4('0x0'));var path=require('path');var timeout=require(_0x2ad4('0x1'));var express=require(_0x2ad4('0x2'));var router=express[_0x2ad4('0x3')]();var fs_extra=require(_0x2ad4('0x4'));var auth=require(_0x2ad4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2ad4('0x6'));router[_0x2ad4('0x7')]('/',auth[_0x2ad4('0x8')](),controller['index']);router[_0x2ad4('0x7')](_0x2ad4('0x9'),auth[_0x2ad4('0x8')](),controller[_0x2ad4('0xa')]);router[_0x2ad4('0x7')](_0x2ad4('0xb'),auth[_0x2ad4('0x8')](),controller[_0x2ad4('0xc')]);router[_0x2ad4('0xd')]('/',auth[_0x2ad4('0x8')](),controller['create']);router[_0x2ad4('0xe')](_0x2ad4('0x9'),auth[_0x2ad4('0x8')](),controller[_0x2ad4('0xf')]);router['delete']('/:id',auth[_0x2ad4('0x8')](),controller[_0x2ad4('0x10')]);module['exports']=router; \ No newline at end of file +var _0xba38=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','show','get','/:id/download','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x47d5ca,_0x341796){var _0xd9de9a=function(_0x29bf5a){while(--_0x29bf5a){_0x47d5ca['push'](_0x47d5ca['shift']());}};_0xd9de9a(++_0x341796);}(_0xba38,0x1b1));var _0x8ba3=function(_0x336cbf,_0x44a37d){_0x336cbf=_0x336cbf-0x0;var _0x4696da=_0xba38[_0x336cbf];return _0x4696da;};'use strict';var multer=require(_0x8ba3('0x0'));var util=require('util');var path=require(_0x8ba3('0x1'));var timeout=require(_0x8ba3('0x2'));var express=require(_0x8ba3('0x3'));var router=express[_0x8ba3('0x4')]();var fs_extra=require(_0x8ba3('0x5'));var auth=require(_0x8ba3('0x6'));var interaction=require(_0x8ba3('0x7'));var config=require(_0x8ba3('0x8'));var controller=require(_0x8ba3('0x9'));router['get']('/',auth[_0x8ba3('0xa')](),controller[_0x8ba3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8ba3('0xc')]);router[_0x8ba3('0xd')](_0x8ba3('0xe'),auth[_0x8ba3('0xa')](),controller['download']);router[_0x8ba3('0xf')]('/',auth[_0x8ba3('0xa')](),controller[_0x8ba3('0x10')]);router[_0x8ba3('0x11')](_0x8ba3('0x12'),auth[_0x8ba3('0xa')](),controller[_0x8ba3('0x13')]);router[_0x8ba3('0x14')](_0x8ba3('0x12'),auth[_0x8ba3('0xa')](),controller[_0x8ba3('0x15')]);module[_0x8ba3('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 928ded9..b29e8ff 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 _0x5926=['literal','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5926,0x1cc));var _0x6592=function(_0x147ad9,_0x4719dd){_0x147ad9=_0x147ad9-0x0;var _0x207783=_0x5926[_0x147ad9];return _0x207783;};'use strict';var Sequelize=require('sequelize');module[_0x6592('0x0')]={'name':{'type':Sequelize[_0x6592('0x1')],'get':function(_0x45613e){return this[_0x6592('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x6592('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6592('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x6592('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6592('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6592('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x6592('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6592('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x6592('0x5')](_0x6592('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x6592('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x6592('0x7'),'defaultValue':Sequelize[_0x6592('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xa774=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING','BLOB','literal'];(function(_0x337c63,_0x359439){var _0x1f1af2=function(_0x55292b){while(--_0x55292b){_0x337c63['push'](_0x337c63['shift']());}};_0x1f1af2(++_0x359439);}(_0xa774,0x71));var _0x4a77=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xa774[_0xd1c39b];return _0x58f5bc;};'use strict';var Sequelize=require(_0x4a77('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a77('0x1')],'get':function(_0x54b36b){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x4a77('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4a77('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x4a77('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x4a77('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x4a77('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4a77('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x4a77('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x4a77('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4a77('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x4a77('0x5')](_0x4a77('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f08b975..9a0ba92 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 _0x4962=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','find','create','body','params','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes'];(function(_0x3fc6fd,_0x3f9081){var _0x1387c9=function(_0x2dc72b){while(--_0x2dc72b){_0x3fc6fd['push'](_0x3fc6fd['shift']());}};_0x1387c9(++_0x3f9081);}(_0x4962,0x1a9));var _0x2496=function(_0xef1e4c,_0x5cb9ae){_0xef1e4c=_0xef1e4c-0x0;var _0x203904=_0x4962[_0xef1e4c];return _0x203904;};'use strict';var emlformat=require(_0x2496('0x0'));var rimraf=require(_0x2496('0x1'));var zipdir=require(_0x2496('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2496('0x3'));var path=require(_0x2496('0x4'));var sox=require(_0x2496('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2496('0x6'));var _=require(_0x2496('0x7'));var squel=require(_0x2496('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2496('0x9'));var toCsv=require(_0x2496('0xa'));var querystring=require(_0x2496('0xb'));var Papa=require(_0x2496('0xc'));var Redis=require(_0x2496('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2496('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2496('0xf'));var logger=require(_0x2496('0x10'))(_0x2496('0x11'));var utils=require('../../config/utils');var config=require(_0x2496('0x12'));var licenseUtil=require(_0x2496('0x13'));var db=require(_0x2496('0x14'))['db'];function respondWithStatusCode(_0x52d3fe,_0x24b39c){_0x24b39c=_0x24b39c||0xcc;return function(_0x4abea7){if(_0x4abea7){return _0x52d3fe[_0x2496('0x15')](_0x24b39c);}return _0x52d3fe[_0x2496('0x16')](_0x24b39c)[_0x2496('0x17')]();};}function respondWithResult(_0x409b5d,_0x1349fe){_0x1349fe=_0x1349fe||0xc8;return function(_0x30898d){if(_0x30898d){return _0x409b5d[_0x2496('0x16')](_0x1349fe)[_0x2496('0x18')](_0x30898d);}};}function respondWithFilteredResult(_0x18577a,_0x4822da){return function(_0x4d98f6){if(_0x4d98f6){var _0x2a715c=typeof _0x4822da[_0x2496('0x19')]==='undefined'&&typeof _0x4822da['limit']==='undefined';var _0x40787c=_0x4d98f6[_0x2496('0x1a')];var _0x1686d5=_0x2a715c?0x0:_0x4822da['offset'];var _0x55b61f=_0x2a715c?_0x4d98f6['count']:_0x4822da['offset']+_0x4822da['limit'];var _0x75adde;if(_0x55b61f>=_0x40787c){_0x55b61f=_0x40787c;_0x75adde=0xc8;}else{_0x75adde=0xce;}_0x18577a[_0x2496('0x16')](_0x75adde);return _0x18577a[_0x2496('0x1b')](_0x2496('0x1c'),_0x1686d5+'-'+_0x55b61f+'/'+_0x40787c)[_0x2496('0x18')](_0x4d98f6);}return null;};}function patchUpdates(_0x1738fd){return function(_0x5e46ef){try{jsonpatch['apply'](_0x5e46ef,_0x1738fd,!![]);}catch(_0x368224){return BPromise[_0x2496('0x1d')](_0x368224);}return _0x5e46ef[_0x2496('0x1e')]();};}function saveUpdates(_0x3f54fe,_0x4aea83){return function(_0x4644c6){if(_0x4644c6){return _0x4644c6[_0x2496('0x1f')](_0x3f54fe)[_0x2496('0x20')](function(_0x263ae8){return _0x263ae8;});}return null;};}function removeEntity(_0x113e52,_0x132959){return function(_0x366c98){if(_0x366c98){return _0x366c98[_0x2496('0x21')]()[_0x2496('0x20')](function(){_0x113e52[_0x2496('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8dff4e,_0x47aa88){return function(_0x5526c3){if(!_0x5526c3){_0x8dff4e[_0x2496('0x15')](0x194);}return _0x5526c3;};}function handleError(_0x64022c,_0x3c0f65){_0x3c0f65=_0x3c0f65||0x1f4;return function(_0x39cd9b){logger['error'](_0x39cd9b[_0x2496('0x22')]);if(_0x39cd9b[_0x2496('0x23')]){delete _0x39cd9b[_0x2496('0x23')];}_0x64022c[_0x2496('0x16')](_0x3c0f65)['send'](_0x39cd9b);};}exports['index']=function(_0x4c0786,_0x5bb836){var _0x3d6b69={},_0x4fdf8b={},_0x4a675b={'count':0x0,'rows':[]};var _0x3ab7fc=_[_0x2496('0x24')](db[_0x2496('0x25')][_0x2496('0x26')],function(_0x5187b5){return{'name':_0x5187b5[_0x2496('0x27')],'type':_0x5187b5[_0x2496('0x28')][_0x2496('0x29')]};});_0x4fdf8b[_0x2496('0x2a')]=_[_0x2496('0x2b')](_[_0x2496('0x24')](_0x3ab7fc,'name'),[_0x2496('0x23')]);_0x4fdf8b[_0x2496('0x2c')]=_[_0x2496('0x2d')](_0x4c0786[_0x2496('0x2c')]);_0x4fdf8b[_0x2496('0x2e')]=_[_0x2496('0x2f')](_0x4fdf8b[_0x2496('0x2a')],_0x4fdf8b[_0x2496('0x2c')]);_0x3d6b69[_0x2496('0x30')]=_[_0x2496('0x2f')](_0x4fdf8b[_0x2496('0x2a')],qs[_0x2496('0x31')](_0x4c0786[_0x2496('0x2c')][_0x2496('0x31')]));_0x3d6b69[_0x2496('0x30')]=_0x3d6b69[_0x2496('0x30')][_0x2496('0x32')]?_0x3d6b69[_0x2496('0x30')]:_0x4fdf8b[_0x2496('0x2a')];if(!_0x4c0786[_0x2496('0x2c')][_0x2496('0x33')](_0x2496('0x34'))){_0x3d6b69[_0x2496('0x35')]=qs[_0x2496('0x35')](_0x4c0786[_0x2496('0x2c')][_0x2496('0x35')]);_0x3d6b69['offset']=qs[_0x2496('0x19')](_0x4c0786[_0x2496('0x2c')][_0x2496('0x19')]);}_0x3d6b69[_0x2496('0x36')]=qs[_0x2496('0x37')](_0x4c0786[_0x2496('0x2c')]['sort']);_0x3d6b69[_0x2496('0x38')]=qs[_0x2496('0x2e')](_[_0x2496('0x39')](_0x4c0786['query'],_0x4fdf8b['filters']),_0x3ab7fc);if(_0x4c0786[_0x2496('0x2c')]['filter']){_0x3d6b69[_0x2496('0x38')]=_[_0x2496('0x3a')](_0x3d6b69[_0x2496('0x38')],{'$or':_[_0x2496('0x24')](_0x3ab7fc,function(_0x1ee1e6){if(_0x1ee1e6[_0x2496('0x28')]!=='VIRTUAL'){var _0x26b911={};_0x26b911[_0x1ee1e6['name']]={'$like':'%'+_0x4c0786[_0x2496('0x2c')][_0x2496('0x3b')]+'%'};return _0x26b911;}})});}_0x3d6b69=_[_0x2496('0x3a')]({},_0x3d6b69,_0x4c0786[_0x2496('0x3c')]);var _0x12e288={'where':_0x3d6b69[_0x2496('0x38')]};return db[_0x2496('0x25')][_0x2496('0x1a')](_0x12e288)[_0x2496('0x20')](function(_0x54e263){_0x4a675b[_0x2496('0x1a')]=_0x54e263;if(_0x4c0786['query'][_0x2496('0x3d')]){_0x3d6b69[_0x2496('0x3e')]=[{'all':!![]}];}return db[_0x2496('0x25')][_0x2496('0x3f')](_0x3d6b69);})['then'](function(_0x1d6a3e){_0x4a675b[_0x2496('0x40')]=_0x1d6a3e;return _0x4a675b;})[_0x2496('0x20')](respondWithFilteredResult(_0x5bb836,_0x3d6b69))[_0x2496('0x41')](handleError(_0x5bb836,null));};exports['show']=function(_0x2637c6,_0x4b58f9){var _0x5cd5b6={'raw':!![],'where':{'id':_0x2637c6['params']['id']}},_0x5155d6={};_0x5155d6[_0x2496('0x2a')]=_[_0x2496('0x2d')](db[_0x2496('0x25')][_0x2496('0x26')]);_0x5155d6[_0x2496('0x2c')]=_[_0x2496('0x2d')](_0x2637c6[_0x2496('0x2c')]);_0x5155d6[_0x2496('0x2e')]=_['intersection'](_0x5155d6[_0x2496('0x2a')],_0x5155d6[_0x2496('0x2c')]);_0x5cd5b6[_0x2496('0x30')]=_[_0x2496('0x2f')](_0x5155d6[_0x2496('0x2a')],qs[_0x2496('0x31')](_0x2637c6['query'][_0x2496('0x31')]));_0x5cd5b6[_0x2496('0x30')]=_0x5cd5b6[_0x2496('0x30')][_0x2496('0x32')]?_0x5cd5b6['attributes']:_0x5155d6[_0x2496('0x2a')];if(_0x2637c6[_0x2496('0x2c')][_0x2496('0x3d')]){_0x5cd5b6[_0x2496('0x3e')]=[{'all':!![]}];}_0x5cd5b6=_['merge']({},_0x5cd5b6,_0x2637c6[_0x2496('0x3c')]);return db[_0x2496('0x25')][_0x2496('0x42')](_0x5cd5b6)[_0x2496('0x20')](handleEntityNotFound(_0x4b58f9,null))[_0x2496('0x20')](respondWithResult(_0x4b58f9,null))[_0x2496('0x41')](handleError(_0x4b58f9,null));};exports[_0x2496('0x43')]=function(_0x4496b6,_0x3a88a7){return db[_0x2496('0x25')][_0x2496('0x43')](_0x4496b6[_0x2496('0x44')],{})['then'](respondWithResult(_0x3a88a7,0xc9))[_0x2496('0x41')](handleError(_0x3a88a7,null));};exports[_0x2496('0x1f')]=function(_0x7cfde3,_0x51d586){if(_0x7cfde3[_0x2496('0x44')]['id']){delete _0x7cfde3[_0x2496('0x44')]['id'];}return db[_0x2496('0x25')][_0x2496('0x42')]({'where':{'id':_0x7cfde3[_0x2496('0x45')]['id']}})[_0x2496('0x20')](handleEntityNotFound(_0x51d586,null))[_0x2496('0x20')](saveUpdates(_0x7cfde3[_0x2496('0x44')],null))['then'](respondWithResult(_0x51d586,null))[_0x2496('0x41')](handleError(_0x51d586,null));};exports[_0x2496('0x21')]=function(_0x12d2ba,_0x433b71){return db[_0x2496('0x25')]['find']({'where':{'id':_0x12d2ba[_0x2496('0x45')]['id']}})[_0x2496('0x20')](handleEntityNotFound(_0x433b71,null))[_0x2496('0x20')](removeEntity(_0x433b71,null))['catch'](handleError(_0x433b71,null));};exports['download']=function(_0x2210c9,_0x80f56,_0x52e3bc){return db[_0x2496('0x25')][_0x2496('0x42')]({'where':{'id':_0x2210c9[_0x2496('0x45')]['id']},'attributes':['id',_0x2496('0x46'),'msg_id']})[_0x2496('0x20')](handleEntityNotFound(_0x80f56,null))[_0x2496('0x20')](function(_0x2fac5b){if(_0x2fac5b){if(!_0x2fac5b[_0x2496('0x46')]){throw new db['Sequelize'][(_0x2496('0x47'))](_0x2496('0x48'));}var _0x33b387={'Content-Type':_0x2496('0x49'),'Content-Disposition':_0x2496('0x4a')};if(_0x2fac5b[_0x2496('0x4b')]){_0x33b387['Content-Disposition']=_0x2496('0x4c')+_0x2fac5b[_0x2496('0x4b')]+_0x2496('0x4d');}_0x80f56[_0x2496('0x1b')](_0x33b387);return _0x80f56[_0x2496('0x4e')](new Buffer(_0x2fac5b[_0x2496('0x46')]));}})[_0x2496('0x41')](handleError(_0x80f56,null));}; \ No newline at end of file +var _0x589b=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','create','body','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x5503da,_0x16dc7c){var _0x13581e=function(_0x4ce140){while(--_0x4ce140){_0x5503da['push'](_0x5503da['shift']());}};_0x13581e(++_0x16dc7c);}(_0x589b,0x1e6));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb589('0x0'));var rimraf=require(_0xb589('0x1'));var zipdir=require(_0xb589('0x2'));var jsonpatch=require(_0xb589('0x3'));var rp=require('request-promise');var moment=require(_0xb589('0x4'));var BPromise=require(_0xb589('0x5'));var Mustache=require(_0xb589('0x6'));var util=require(_0xb589('0x7'));var path=require(_0xb589('0x8'));var sox=require(_0xb589('0x9'));var csv=require(_0xb589('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb589('0xb'));var _=require('lodash');var squel=require(_0xb589('0xc'));var crypto=require(_0xb589('0xd'));var jsforce=require(_0xb589('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb589('0xa'));var querystring=require(_0xb589('0xf'));var Papa=require('papaparse');var Redis=require(_0xb589('0x10'));var authService=require(_0xb589('0x11'));var qs=require(_0xb589('0x12'));var as=require(_0xb589('0x13'));var hardwareService=require(_0xb589('0x14'));var logger=require(_0xb589('0x15'))(_0xb589('0x16'));var utils=require('../../config/utils');var config=require(_0xb589('0x17'));var licenseUtil=require(_0xb589('0x18'));var db=require(_0xb589('0x19'))['db'];function respondWithStatusCode(_0x45c055,_0x5aff14){_0x5aff14=_0x5aff14||0xcc;return function(_0x5c457d){if(_0x5c457d){return _0x45c055[_0xb589('0x1a')](_0x5aff14);}return _0x45c055[_0xb589('0x1b')](_0x5aff14)[_0xb589('0x1c')]();};}function respondWithResult(_0x27b570,_0x2dd872){_0x2dd872=_0x2dd872||0xc8;return function(_0x24b249){if(_0x24b249){return _0x27b570[_0xb589('0x1b')](_0x2dd872)[_0xb589('0x1d')](_0x24b249);}};}function respondWithFilteredResult(_0x49ccf8,_0x4b4f4a){return function(_0x5ed8d2){if(_0x5ed8d2){var _0xa78541=typeof _0x4b4f4a[_0xb589('0x1e')]==='undefined'&&typeof _0x4b4f4a[_0xb589('0x1f')]===_0xb589('0x20');var _0xad4dff=_0x5ed8d2[_0xb589('0x21')];var _0x1665d3=_0xa78541?0x0:_0x4b4f4a[_0xb589('0x1e')];var _0x1543d8=_0xa78541?_0x5ed8d2[_0xb589('0x21')]:_0x4b4f4a[_0xb589('0x1e')]+_0x4b4f4a[_0xb589('0x1f')];var _0x3c55ec;if(_0x1543d8>=_0xad4dff){_0x1543d8=_0xad4dff;_0x3c55ec=0xc8;}else{_0x3c55ec=0xce;}_0x49ccf8['status'](_0x3c55ec);return _0x49ccf8[_0xb589('0x22')]('Content-Range',_0x1665d3+'-'+_0x1543d8+'/'+_0xad4dff)[_0xb589('0x1d')](_0x5ed8d2);}return null;};}function patchUpdates(_0x5bb8ac){return function(_0x705a80){try{jsonpatch[_0xb589('0x23')](_0x705a80,_0x5bb8ac,!![]);}catch(_0x531ba6){return BPromise[_0xb589('0x24')](_0x531ba6);}return _0x705a80[_0xb589('0x25')]();};}function saveUpdates(_0x4a612b,_0x59c7ac){return function(_0x27bfae){if(_0x27bfae){return _0x27bfae[_0xb589('0x26')](_0x4a612b)[_0xb589('0x27')](function(_0xad8538){return _0xad8538;});}return null;};}function removeEntity(_0x43b9dc,_0x3b758e){return function(_0x588b85){if(_0x588b85){return _0x588b85[_0xb589('0x28')]()[_0xb589('0x27')](function(){_0x43b9dc[_0xb589('0x1b')](0xcc)[_0xb589('0x1c')]();});}};}function handleEntityNotFound(_0x57b368,_0x18e141){return function(_0x5023c3){if(!_0x5023c3){_0x57b368[_0xb589('0x1a')](0x194);}return _0x5023c3;};}function handleError(_0x3f0b19,_0x378fb3){_0x378fb3=_0x378fb3||0x1f4;return function(_0x315fb4){logger[_0xb589('0x29')](_0x315fb4['stack']);if(_0x315fb4[_0xb589('0x2a')]){delete _0x315fb4['name'];}_0x3f0b19[_0xb589('0x1b')](_0x378fb3)[_0xb589('0x2b')](_0x315fb4);};}exports[_0xb589('0x2c')]=function(_0x523844,_0x247d05){var _0x178300={},_0x3e0abd={},_0x404d86={'count':0x0,'rows':[]};var _0x5be95a=_['map'](db[_0xb589('0x2d')][_0xb589('0x2e')],function(_0x132308){return{'name':_0x132308['fieldName'],'type':_0x132308[_0xb589('0x2f')][_0xb589('0x30')]};});_0x3e0abd[_0xb589('0x31')]=_[_0xb589('0x32')](_['map'](_0x5be95a,_0xb589('0x2a')),['name']);_0x3e0abd[_0xb589('0x33')]=_[_0xb589('0x34')](_0x523844['query']);_0x3e0abd[_0xb589('0x35')]=_['intersection'](_0x3e0abd[_0xb589('0x31')],_0x3e0abd[_0xb589('0x33')]);_0x178300[_0xb589('0x36')]=_[_0xb589('0x37')](_0x3e0abd[_0xb589('0x31')],qs['fields'](_0x523844[_0xb589('0x33')][_0xb589('0x38')]));_0x178300[_0xb589('0x36')]=_0x178300['attributes'][_0xb589('0x39')]?_0x178300['attributes']:_0x3e0abd[_0xb589('0x31')];if(!_0x523844[_0xb589('0x33')]['hasOwnProperty']('nolimit')){_0x178300[_0xb589('0x1f')]=qs[_0xb589('0x1f')](_0x523844['query'][_0xb589('0x1f')]);_0x178300['offset']=qs[_0xb589('0x1e')](_0x523844[_0xb589('0x33')][_0xb589('0x1e')]);}_0x178300[_0xb589('0x3a')]=qs[_0xb589('0x3b')](_0x523844[_0xb589('0x33')]['sort']);_0x178300[_0xb589('0x3c')]=qs[_0xb589('0x35')](_[_0xb589('0x3d')](_0x523844[_0xb589('0x33')],_0x3e0abd[_0xb589('0x35')]),_0x5be95a);if(_0x523844[_0xb589('0x33')][_0xb589('0x3e')]){_0x178300[_0xb589('0x3c')]=_[_0xb589('0x3f')](_0x178300['where'],{'$or':_['map'](_0x5be95a,function(_0x101546){if(_0x101546[_0xb589('0x2f')]!==_0xb589('0x40')){var _0x4baf9d={};_0x4baf9d[_0x101546[_0xb589('0x2a')]]={'$like':'%'+_0x523844[_0xb589('0x33')][_0xb589('0x3e')]+'%'};return _0x4baf9d;}})});}_0x178300=_[_0xb589('0x3f')]({},_0x178300,_0x523844['options']);var _0x3c13a6={'where':_0x178300[_0xb589('0x3c')]};return db[_0xb589('0x2d')][_0xb589('0x21')](_0x3c13a6)['then'](function(_0xf8f3c4){_0x404d86[_0xb589('0x21')]=_0xf8f3c4;if(_0x523844['query'][_0xb589('0x41')]){_0x178300['include']=[{'all':!![]}];}return db[_0xb589('0x2d')][_0xb589('0x42')](_0x178300);})[_0xb589('0x27')](function(_0x24c853){_0x404d86[_0xb589('0x43')]=_0x24c853;return _0x404d86;})[_0xb589('0x27')](respondWithFilteredResult(_0x247d05,_0x178300))[_0xb589('0x44')](handleError(_0x247d05,null));};exports[_0xb589('0x45')]=function(_0x5e0ac2,_0x550bc6){var _0x13fe38={'raw':!![],'where':{'id':_0x5e0ac2[_0xb589('0x46')]['id']}},_0x3b91a7={};_0x3b91a7['model']=_[_0xb589('0x34')](db[_0xb589('0x2d')][_0xb589('0x2e')]);_0x3b91a7[_0xb589('0x33')]=_[_0xb589('0x34')](_0x5e0ac2[_0xb589('0x33')]);_0x3b91a7[_0xb589('0x35')]=_['intersection'](_0x3b91a7[_0xb589('0x31')],_0x3b91a7[_0xb589('0x33')]);_0x13fe38[_0xb589('0x36')]=_[_0xb589('0x37')](_0x3b91a7[_0xb589('0x31')],qs[_0xb589('0x38')](_0x5e0ac2[_0xb589('0x33')][_0xb589('0x38')]));_0x13fe38['attributes']=_0x13fe38['attributes']['length']?_0x13fe38[_0xb589('0x36')]:_0x3b91a7['model'];if(_0x5e0ac2[_0xb589('0x33')]['includeAll']){_0x13fe38['include']=[{'all':!![]}];}_0x13fe38=_['merge']({},_0x13fe38,_0x5e0ac2[_0xb589('0x47')]);return db[_0xb589('0x2d')][_0xb589('0x48')](_0x13fe38)[_0xb589('0x27')](handleEntityNotFound(_0x550bc6,null))['then'](respondWithResult(_0x550bc6,null))[_0xb589('0x44')](handleError(_0x550bc6,null));};exports[_0xb589('0x49')]=function(_0x259647,_0xba9662){return db[_0xb589('0x2d')]['create'](_0x259647[_0xb589('0x4a')],{})[_0xb589('0x27')](respondWithResult(_0xba9662,0xc9))[_0xb589('0x44')](handleError(_0xba9662,null));};exports[_0xb589('0x26')]=function(_0x2f4b9a,_0x434756){if(_0x2f4b9a[_0xb589('0x4a')]['id']){delete _0x2f4b9a[_0xb589('0x4a')]['id'];}return db['VoiceMailMessage'][_0xb589('0x48')]({'where':{'id':_0x2f4b9a[_0xb589('0x46')]['id']}})[_0xb589('0x27')](handleEntityNotFound(_0x434756,null))[_0xb589('0x27')](saveUpdates(_0x2f4b9a[_0xb589('0x4a')],null))['then'](respondWithResult(_0x434756,null))[_0xb589('0x44')](handleError(_0x434756,null));};exports[_0xb589('0x28')]=function(_0x519157,_0x2f6205){return db[_0xb589('0x2d')][_0xb589('0x48')]({'where':{'id':_0x519157[_0xb589('0x46')]['id']}})[_0xb589('0x27')](handleEntityNotFound(_0x2f6205,null))[_0xb589('0x27')](removeEntity(_0x2f6205,null))[_0xb589('0x44')](handleError(_0x2f6205,null));};exports['download']=function(_0x24b366,_0x16f06f,_0x4d833e){return db[_0xb589('0x2d')][_0xb589('0x48')]({'where':{'id':_0x24b366['params']['id']},'attributes':['id','recording',_0xb589('0x4b')]})[_0xb589('0x27')](handleEntityNotFound(_0x16f06f,null))[_0xb589('0x27')](function(_0x3b97dc){if(_0x3b97dc){if(!_0x3b97dc[_0xb589('0x4c')]){throw new db[(_0xb589('0x4d'))][(_0xb589('0x4e'))](_0xb589('0x4f'));}var _0x335544={'Content-Type':_0xb589('0x50'),'Content-Disposition':_0xb589('0x51')};if(_0x3b97dc[_0xb589('0x4b')]){_0x335544[_0xb589('0x52')]=_0xb589('0x53')+_0x3b97dc['msg_id']+_0xb589('0x54');}_0x16f06f[_0xb589('0x22')](_0x335544);return _0x16f06f[_0xb589('0x2b')](new Buffer(_0x3b97dc['recording']));}})[_0xb589('0x44')](handleError(_0x16f06f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 6a83fe6..6652c3c 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 _0x7cde=['api','bluebird','request-promise','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x5346ca,_0x3c7aea){var _0x527679=function(_0xd7cde1){while(--_0xd7cde1){_0x5346ca['push'](_0x5346ca['shift']());}};_0x527679(++_0x3c7aea);}(_0x7cde,0x1c9));var _0xe7cd=function(_0x4cead9,_0x5be9fd){_0x4cead9=_0x4cead9-0x0;var _0x4e935e=_0x7cde[_0x4cead9];return _0x4e935e;};'use strict';var _=require(_0xe7cd('0x0'));var util=require(_0xe7cd('0x1'));var logger=require('../../config/logger')(_0xe7cd('0x2'));var moment=require('moment');var BPromise=require(_0xe7cd('0x3'));var rp=require(_0xe7cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe7cd('0x5'));module['exports']=function(_0x4557a2,_0x4601a7){return _0x4557a2['define'](_0xe7cd('0x6'),attributes,{'tableName':_0xe7cd('0x7'),'paranoid':![],'indexes':[{'name':_0xe7cd('0x8'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x174a=['../../config/environment','./voiceMailMessage.attributes','exports','define','dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x555402,_0xcde5e6){var _0x1524ef=function(_0x19b47a){while(--_0x19b47a){_0x555402['push'](_0x555402['shift']());}};_0x1524ef(++_0xcde5e6);}(_0x174a,0x1d9));var _0xa174=function(_0x48230e,_0x50f35a){_0x48230e=_0x48230e-0x0;var _0x26be90=_0x174a[_0x48230e];return _0x26be90;};'use strict';var _=require(_0xa174('0x0'));var util=require(_0xa174('0x1'));var logger=require('../../config/logger')(_0xa174('0x2'));var moment=require(_0xa174('0x3'));var BPromise=require(_0xa174('0x4'));var rp=require(_0xa174('0x5'));var fs=require('fs');var path=require(_0xa174('0x6'));var rimraf=require(_0xa174('0x7'));var config=require(_0xa174('0x8'));var attributes=require(_0xa174('0x9'));module[_0xa174('0xa')]=function(_0x31bb71,_0x2b6b44){return _0x31bb71[_0xa174('0xb')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xa174('0xc'),'fields':[_0xa174('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 6982152..4907427 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 _0xe4fd=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0xe4fd,0x169));var _0xde4f=function(_0x3fb39c,_0x13b9fd){_0x3fb39c=_0x3fb39c-0x0;var _0x1215f1=_0xe4fd[_0x3fb39c];return _0x1215f1;};'use strict';var _=require(_0xde4f('0x0'));var util=require('util');var moment=require(_0xde4f('0x1'));var BPromise=require(_0xde4f('0x2'));var rs=require(_0xde4f('0x3'));var fs=require('fs');var Redis=require(_0xde4f('0x4'));var db=require(_0xde4f('0x5'))['db'];var utils=require(_0xde4f('0x6'));var logger=require(_0xde4f('0x7'))(_0xde4f('0x8'));var config=require(_0xde4f('0x9'));var jayson=require(_0xde4f('0xa'));var client=jayson[_0xde4f('0xb')][_0xde4f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x658497,_0x3da5de,_0x518680){return new BPromise(function(_0x360242,_0x243154){return client[_0xde4f('0xd')](_0x658497,_0x518680)[_0xde4f('0xe')](function(_0x35371e){logger[_0xde4f('0xf')](_0xde4f('0x10'),_0x3da5de,_0xde4f('0x11'));logger[_0xde4f('0x12')](_0xde4f('0x13'),_0x3da5de,_0xde4f('0x11'),JSON[_0xde4f('0x14')](_0x35371e));if(_0x35371e[_0xde4f('0x15')]){if(_0x35371e[_0xde4f('0x15')][_0xde4f('0x16')]===0x1f4){logger[_0xde4f('0x15')](_0xde4f('0x10'),_0x3da5de,_0x35371e[_0xde4f('0x15')][_0xde4f('0x17')]);return _0x243154(_0x35371e[_0xde4f('0x15')]['message']);}logger[_0xde4f('0x15')](_0xde4f('0x10'),_0x3da5de,_0x35371e[_0xde4f('0x15')][_0xde4f('0x17')]);return _0x360242(_0x35371e['error'][_0xde4f('0x17')]);}else{logger[_0xde4f('0xf')](_0xde4f('0x10'),_0x3da5de,_0xde4f('0x11'));_0x360242(_0x35371e[_0xde4f('0x18')][_0xde4f('0x17')]);}})[_0xde4f('0x19')](function(_0x290e49){logger['error'](_0xde4f('0x10'),_0x3da5de,_0x290e49);_0x243154(_0x290e49);});});} \ No newline at end of file +var _0xa39e=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xa39e,0xdd));var _0xea39=function(_0x36bab3,_0x19ce33){_0x36bab3=_0x36bab3-0x0;var _0x2d3989=_0xa39e[_0x36bab3];return _0x2d3989;};'use strict';var _=require(_0xea39('0x0'));var util=require(_0xea39('0x1'));var moment=require(_0xea39('0x2'));var BPromise=require(_0xea39('0x3'));var rs=require(_0xea39('0x4'));var fs=require('fs');var Redis=require(_0xea39('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xea39('0x6'));var logger=require('../../config/logger')(_0xea39('0x7'));var config=require(_0xea39('0x8'));var jayson=require(_0xea39('0x9'));var client=jayson[_0xea39('0xa')][_0xea39('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x572126,_0x2dcb3c,_0x14a28f){return new BPromise(function(_0x4d33b6,_0x5dbc8d){return client[_0xea39('0xc')](_0x572126,_0x14a28f)[_0xea39('0xd')](function(_0x465fe0){logger[_0xea39('0xe')](_0xea39('0xf'),_0x2dcb3c,_0xea39('0x10'));logger['debug'](_0xea39('0x11'),_0x2dcb3c,_0xea39('0x10'),JSON[_0xea39('0x12')](_0x465fe0));if(_0x465fe0[_0xea39('0x13')]){if(_0x465fe0[_0xea39('0x13')][_0xea39('0x14')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2dcb3c,_0x465fe0[_0xea39('0x13')][_0xea39('0x15')]);return _0x5dbc8d(_0x465fe0[_0xea39('0x13')]['message']);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2dcb3c,_0x465fe0[_0xea39('0x13')][_0xea39('0x15')]);return _0x4d33b6(_0x465fe0[_0xea39('0x13')][_0xea39('0x15')]);}else{logger[_0xea39('0xe')](_0xea39('0xf'),_0x2dcb3c,_0xea39('0x10'));_0x4d33b6(_0x465fe0[_0xea39('0x16')][_0xea39('0x15')]);}})[_0xea39('0x17')](function(_0x24f21){logger[_0xea39('0x13')](_0xea39('0xf'),_0x2dcb3c,_0x24f21);_0x5dbc8d(_0x24f21);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3a11131..a5bf3e6 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 _0x2651=['update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id/sounds','getSounds','post','create','addSound','put','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2651,0x117));var _0x1265=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x2651[_0x166d93];return _0xba708;};'use strict';var multer=require(_0x1265('0x0'));var util=require('util');var path=require(_0x1265('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1265('0x2')]();var fs_extra=require(_0x1265('0x3'));var auth=require(_0x1265('0x4'));var interaction=require(_0x1265('0x5'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x1265('0x6')]('/',auth[_0x1265('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1265('0x6')](_0x1265('0x8'),auth[_0x1265('0x7')](),controller[_0x1265('0x9')]);router[_0x1265('0xa')]('/',auth[_0x1265('0x7')](),controller[_0x1265('0xb')]);router['post'](_0x1265('0x8'),auth[_0x1265('0x7')](),controller[_0x1265('0xc')]);router[_0x1265('0xd')](_0x1265('0xe'),auth[_0x1265('0x7')](),controller[_0x1265('0xf')]);router[_0x1265('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1265('0x11')]);router[_0x1265('0x10')](_0x1265('0x12'),auth[_0x1265('0x7')](),controller[_0x1265('0x13')]);module[_0x1265('0x14')]=router; \ No newline at end of file +var _0xacd0=['addSound','put','update','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create'];(function(_0xd1588d,_0x4e7a5e){var _0x72e94f=function(_0x46a23c){while(--_0x46a23c){_0xd1588d['push'](_0xd1588d['shift']());}};_0x72e94f(++_0x4e7a5e);}(_0xacd0,0x7e));var _0x0acd=function(_0x41ab5c,_0x14800f){_0x41ab5c=_0x41ab5c-0x0;var _0xab348=_0xacd0[_0x41ab5c];return _0xab348;};'use strict';var multer=require(_0x0acd('0x0'));var util=require(_0x0acd('0x1'));var path=require(_0x0acd('0x2'));var timeout=require(_0x0acd('0x3'));var express=require(_0x0acd('0x4'));var router=express[_0x0acd('0x5')]();var fs_extra=require(_0x0acd('0x6'));var auth=require(_0x0acd('0x7'));var interaction=require(_0x0acd('0x8'));var config=require(_0x0acd('0x9'));var controller=require(_0x0acd('0xa'));router['get']('/',auth[_0x0acd('0xb')](),controller['index']);router['get'](_0x0acd('0xc'),auth[_0x0acd('0xb')](),controller[_0x0acd('0xd')]);router['get'](_0x0acd('0xe'),auth[_0x0acd('0xb')](),controller[_0x0acd('0xf')]);router[_0x0acd('0x10')]('/',auth[_0x0acd('0xb')](),controller[_0x0acd('0x11')]);router[_0x0acd('0x10')](_0x0acd('0xe'),auth[_0x0acd('0xb')](),controller[_0x0acd('0x12')]);router[_0x0acd('0x13')](_0x0acd('0xc'),auth['isAuthenticated'](),controller[_0x0acd('0x14')]);router['delete'](_0x0acd('0xc'),auth['isAuthenticated'](),controller[_0x0acd('0x15')]);router['delete'](_0x0acd('0x16'),auth[_0x0acd('0xb')](),controller[_0x0acd('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index a257e19..78a2517 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 _0xad62=['sequelize','ENUM','custom','files','mp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN'];(function(_0x32a2a5,_0x42b27d){var _0x1b0185=function(_0x480536){while(--_0x480536){_0x32a2a5['push'](_0x32a2a5['shift']());}};_0x1b0185(++_0x42b27d);}(_0xad62,0xdc));var _0x2ad6=function(_0x3412e0,_0x5c4e4f){_0x3412e0=_0x3412e0-0x0;var _0x479b68=_0xad62[_0x3412e0];return _0x479b68;};'use strict';var Sequelize=require(_0x2ad6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x2ad6('0x1')](_0x2ad6('0x2'),_0x2ad6('0x3'),_0x2ad6('0x4'),'quietmp3nb',_0x2ad6('0x5'),_0x2ad6('0x6')),'allowNull':!![],'defaultValue':_0x2ad6('0x3')},'directory':{'type':Sequelize[_0x2ad6('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x2ad6('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2ad6('0x7')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2ad6('0x8')},'format':{'type':Sequelize[_0x2ad6('0x7')],'allowNull':!![]},'stamp':{'type':_0x2ad6('0x9')},'defaultEntry':{'type':Sequelize[_0x2ad6('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb4b6=['sequelize','exports','STRING','name','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0x546f99,_0x188aa0){var _0x3a131b=function(_0x5d9102){while(--_0x5d9102){_0x546f99['push'](_0x546f99['shift']());}};_0x3a131b(++_0x188aa0);}(_0xb4b6,0xa0));var _0x6b4b=function(_0x2a62d0,_0x59af7e){_0x2a62d0=_0x2a62d0-0x0;var _0x4c3556=_0xb4b6[_0x2a62d0];return _0x4c3556;};'use strict';var Sequelize=require(_0x6b4b('0x0'));module[_0x6b4b('0x1')]={'name':{'type':Sequelize[_0x6b4b('0x2')],'allowNull':![],'unique':_0x6b4b('0x3')},'mode':{'type':Sequelize['ENUM']('custom','files',_0x6b4b('0x4'),_0x6b4b('0x5'),'quietmp3',_0x6b4b('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x6b4b('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x6b4b('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x6b4b('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6b4b('0x2')],'allowNull':!![],'defaultValue':_0x6b4b('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x6b4b('0x8')},'defaultEntry':{'type':Sequelize[_0x6b4b('0x9')],'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 54765c3..26db4a7 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 _0x8628=['forEach','join','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','%s.%s','root','format','removeSound','id2','getSounds','Sound','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','body','transaction','mode','files','directory','server/files/moh','create','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','destroy','readdirSync'];(function(_0x1723cd,_0x2c1dc8){var _0x2c06ec=function(_0x68c4b){while(--_0x68c4b){_0x1723cd['push'](_0x1723cd['shift']());}};_0x2c06ec(++_0x2c1dc8);}(_0x8628,0x171));var _0x8862=function(_0x495ec6,_0x4c9d90){_0x495ec6=_0x495ec6-0x0;var _0x5210f1=_0x8628[_0x495ec6];return _0x5210f1;};'use strict';var emlformat=require(_0x8862('0x0'));var rimraf=require(_0x8862('0x1'));var zipdir=require(_0x8862('0x2'));var jsonpatch=require(_0x8862('0x3'));var rp=require(_0x8862('0x4'));var moment=require(_0x8862('0x5'));var BPromise=require(_0x8862('0x6'));var Mustache=require(_0x8862('0x7'));var util=require(_0x8862('0x8'));var path=require(_0x8862('0x9'));var sox=require('sox');var csv=require(_0x8862('0xa'));var ejs=require(_0x8862('0xb'));var fs=require('fs');var fs_extra=require(_0x8862('0xc'));var _=require(_0x8862('0xd'));var squel=require(_0x8862('0xe'));var crypto=require(_0x8862('0xf'));var jsforce=require(_0x8862('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8862('0xa'));var querystring=require('querystring');var Papa=require(_0x8862('0x11'));var Redis=require('ioredis');var authService=require(_0x8862('0x12'));var qs=require(_0x8862('0x13'));var as=require(_0x8862('0x14'));var hardwareService=require(_0x8862('0x15'));var logger=require(_0x8862('0x16'))(_0x8862('0x17'));var utils=require(_0x8862('0x18'));var config=require(_0x8862('0x19'));var licenseUtil=require(_0x8862('0x1a'));var db=require(_0x8862('0x1b'))['db'];function respondWithStatusCode(_0x5b0926,_0x766206){_0x766206=_0x766206||0xcc;return function(_0xc69cba){if(_0xc69cba){return _0x5b0926['sendStatus'](_0x766206);}return _0x5b0926['status'](_0x766206)[_0x8862('0x1c')]();};}function respondWithResult(_0x27c35e,_0xcbb57d){_0xcbb57d=_0xcbb57d||0xc8;return function(_0x442c9d){if(_0x442c9d){return _0x27c35e[_0x8862('0x1d')](_0xcbb57d)['json'](_0x442c9d);}};}function respondWithFilteredResult(_0x3ea33a,_0x1b0595){return function(_0x2d98ae){if(_0x2d98ae){var _0xace04d=typeof _0x1b0595[_0x8862('0x1e')]===_0x8862('0x1f')&&typeof _0x1b0595['limit']===_0x8862('0x1f');var _0x16d0eb=_0x2d98ae[_0x8862('0x20')];var _0x10d10d=_0xace04d?0x0:_0x1b0595[_0x8862('0x1e')];var _0x377258=_0xace04d?_0x2d98ae[_0x8862('0x20')]:_0x1b0595[_0x8862('0x1e')]+_0x1b0595[_0x8862('0x21')];var _0x34e76d;if(_0x377258>=_0x16d0eb){_0x377258=_0x16d0eb;_0x34e76d=0xc8;}else{_0x34e76d=0xce;}_0x3ea33a[_0x8862('0x1d')](_0x34e76d);return _0x3ea33a[_0x8862('0x22')](_0x8862('0x23'),_0x10d10d+'-'+_0x377258+'/'+_0x16d0eb)[_0x8862('0x24')](_0x2d98ae);}return null;};}function patchUpdates(_0x4d6994){return function(_0x21ed68){try{jsonpatch[_0x8862('0x25')](_0x21ed68,_0x4d6994,!![]);}catch(_0x3321c3){return BPromise[_0x8862('0x26')](_0x3321c3);}return _0x21ed68[_0x8862('0x27')]();};}function saveUpdates(_0x1f6f48,_0x16714e){return function(_0x3877bc){if(_0x3877bc){return _0x3877bc[_0x8862('0x28')](_0x1f6f48)[_0x8862('0x29')](function(_0x5073c3){return _0x5073c3;});}return null;};}function removeEntity(_0x2a4e9a,_0x184026){return function(_0x7718c2){if(_0x7718c2){return _0x7718c2['destroy']()[_0x8862('0x29')](function(){var _0x5e620d=_0x7718c2['get']({'plain':!![]});var _0x257357=_0x8862('0x2a');return db[_0x8862('0x2b')]['destroy']({'where':{'type':_0x257357,'resourceId':_0x5e620d['id']}})[_0x8862('0x29')](function(){return _0x7718c2;});})['then'](function(){_0x2a4e9a[_0x8862('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a58a3,_0x2bd2f1){return function(_0x40c345){if(!_0x40c345){_0x3a58a3[_0x8862('0x2c')](0x194);}return _0x40c345;};}function handleError(_0xaa1d16,_0x16c8fd){_0x16c8fd=_0x16c8fd||0x1f4;return function(_0x69e3dc){logger[_0x8862('0x2d')](_0x69e3dc[_0x8862('0x2e')]);if(_0x69e3dc[_0x8862('0x2f')]){delete _0x69e3dc['name'];}_0xaa1d16[_0x8862('0x1d')](_0x16c8fd)[_0x8862('0x30')](_0x69e3dc);};}exports[_0x8862('0x31')]=function(_0x52359e,_0x2d858b){var _0x514a4c={},_0x27414d={},_0x7730bc={'count':0x0,'rows':[]};var _0xd0a53d=_[_0x8862('0x32')](db[_0x8862('0x33')][_0x8862('0x34')],function(_0x55fa9d){return{'name':_0x55fa9d[_0x8862('0x35')],'type':_0x55fa9d['type'][_0x8862('0x36')]};});_0x27414d[_0x8862('0x37')]=_[_0x8862('0x32')](_0xd0a53d,_0x8862('0x2f'));_0x27414d['query']=_[_0x8862('0x38')](_0x52359e[_0x8862('0x39')]);_0x27414d[_0x8862('0x3a')]=_[_0x8862('0x3b')](_0x27414d['model'],_0x27414d[_0x8862('0x39')]);_0x514a4c[_0x8862('0x3c')]=_[_0x8862('0x3b')](_0x27414d['model'],qs['fields'](_0x52359e[_0x8862('0x39')][_0x8862('0x3d')]));_0x514a4c[_0x8862('0x3c')]=_0x514a4c[_0x8862('0x3c')][_0x8862('0x3e')]?_0x514a4c[_0x8862('0x3c')]:_0x27414d['model'];if(!_0x52359e[_0x8862('0x39')][_0x8862('0x3f')](_0x8862('0x40'))){_0x514a4c[_0x8862('0x21')]=qs[_0x8862('0x21')](_0x52359e[_0x8862('0x39')][_0x8862('0x21')]);_0x514a4c[_0x8862('0x1e')]=qs[_0x8862('0x1e')](_0x52359e[_0x8862('0x39')]['offset']);}_0x514a4c[_0x8862('0x41')]=qs['sort'](_0x52359e[_0x8862('0x39')][_0x8862('0x42')]);delete _0x52359e[_0x8862('0x39')][_0x8862('0x42')];_0x514a4c[_0x8862('0x43')]=qs[_0x8862('0x3a')](_[_0x8862('0x44')](_0x52359e[_0x8862('0x39')],_0x27414d[_0x8862('0x3a')]),_0xd0a53d);if(_0x52359e[_0x8862('0x39')][_0x8862('0x45')]){_0x514a4c[_0x8862('0x43')]=_[_0x8862('0x46')](_0x514a4c[_0x8862('0x43')],{'$or':_[_0x8862('0x32')](_0xd0a53d,function(_0x1d5afb){if(_0x1d5afb[_0x8862('0x47')]!==_0x8862('0x48')){var _0x5d4049={};_0x5d4049[_0x1d5afb[_0x8862('0x2f')]]={'$like':'%'+_0x52359e[_0x8862('0x39')][_0x8862('0x45')]+'%'};return _0x5d4049;}})});}_0x514a4c=_[_0x8862('0x46')]({},_0x514a4c,_0x52359e[_0x8862('0x49')]);var _0x3ae94c={'where':_0x514a4c[_0x8862('0x43')]};return db[_0x8862('0x33')][_0x8862('0x20')](_0x3ae94c)[_0x8862('0x29')](function(_0x7db342){_0x7730bc[_0x8862('0x20')]=_0x7db342;if(_0x52359e[_0x8862('0x39')][_0x8862('0x4a')]){_0x514a4c['include']=[{'all':!![]}];}return db[_0x8862('0x33')][_0x8862('0x4b')](_0x514a4c);})[_0x8862('0x29')](function(_0x1c003e){_0x7730bc['rows']=_0x1c003e;return _0x7730bc;})[_0x8862('0x29')](respondWithFilteredResult(_0x2d858b,_0x514a4c))[_0x8862('0x4c')](handleError(_0x2d858b,null));};exports[_0x8862('0x4d')]=function(_0x1b3ba1,_0x3ac490){var _0x5cf300={'raw':![],'where':{'id':_0x1b3ba1[_0x8862('0x4e')]['id']}},_0x436747={};_0x436747[_0x8862('0x37')]=_['keys'](db[_0x8862('0x33')][_0x8862('0x34')]);_0x436747['query']=_['keys'](_0x1b3ba1[_0x8862('0x39')]);_0x436747[_0x8862('0x3a')]=_['intersection'](_0x436747[_0x8862('0x37')],_0x436747[_0x8862('0x39')]);_0x5cf300['attributes']=_[_0x8862('0x3b')](_0x436747[_0x8862('0x37')],qs[_0x8862('0x3d')](_0x1b3ba1['query'][_0x8862('0x3d')]));_0x5cf300[_0x8862('0x3c')]=_0x5cf300[_0x8862('0x3c')]['length']?_0x5cf300[_0x8862('0x3c')]:_0x436747[_0x8862('0x37')];if(_0x1b3ba1['query'][_0x8862('0x4a')]){_0x5cf300[_0x8862('0x4f')]=[{'all':!![]}];}_0x5cf300=_[_0x8862('0x46')]({},_0x5cf300,_0x1b3ba1['options']);return db[_0x8862('0x33')][_0x8862('0x50')](_0x5cf300)[_0x8862('0x29')](handleEntityNotFound(_0x3ac490,null))[_0x8862('0x29')](respondWithResult(_0x3ac490,null))['catch'](handleError(_0x3ac490,null));};exports[_0x8862('0x28')]=function(_0x4c4c7a,_0x34e70b){if(_0x4c4c7a[_0x8862('0x51')]['id']){delete _0x4c4c7a[_0x8862('0x51')]['id'];}return db[_0x8862('0x33')][_0x8862('0x50')]({'where':{'id':_0x4c4c7a[_0x8862('0x4e')]['id']}})[_0x8862('0x29')](handleEntityNotFound(_0x34e70b,null))['then'](saveUpdates(_0x4c4c7a[_0x8862('0x51')],null))[_0x8862('0x29')](respondWithResult(_0x34e70b,null))[_0x8862('0x4c')](handleError(_0x34e70b,null));};exports['create']=function(_0x414134,_0x3be7a6,_0x7b182f){return db['sequelize'][_0x8862('0x52')](function(_0x486a4e){if(_0x414134['body'][_0x8862('0x53')]===_0x8862('0x54')){_0x414134[_0x8862('0x51')][_0x8862('0x55')]=path['join'](config['root'],_0x8862('0x56'),_0x414134[_0x8862('0x51')][_0x8862('0x2f')]);}return db[_0x8862('0x33')][_0x8862('0x57')](_0x414134[_0x8862('0x51')],{'transaction':_0x486a4e})[_0x8862('0x29')](function(_0x379b2b){if(_0x414134[_0x8862('0x51')]['mode']===_0x8862('0x54')){fs[_0x8862('0x58')](_0x379b2b[_0x8862('0x55')],parseInt(_0x8862('0x59'),0x8));}var _0x45c69e=_0x414134[_0x8862('0x5a')][_0x8862('0x5b')]({'plain':!![]});if(!_0x45c69e)throw new Error(_0x8862('0x5c'));if(_0x45c69e[_0x8862('0x5d')]==='user'){var _0x221adc=_0x379b2b['get']({'plain':!![]});return db['UserProfileSection'][_0x8862('0x50')]({'where':{'name':'MusicOnHolds','userProfileId':_0x45c69e[_0x8862('0x5e')]},'raw':!![]})[_0x8862('0x29')](function(_0x4f6bb1){if(_0x4f6bb1&&_0x4f6bb1['autoAssociation']===0x0){return db[_0x8862('0x2b')][_0x8862('0x57')]({'name':_0x221adc['name'],'resourceId':_0x221adc['id'],'type':_0x4f6bb1['name'],'sectionId':_0x4f6bb1['id']},{})[_0x8862('0x29')](function(){return _0x379b2b;});}else{return _0x379b2b;}})[_0x8862('0x4c')](function(_0xb03b9){logger['error'](_0x8862('0x5f'),_0xb03b9);});}return _0x379b2b;});})[_0x8862('0x29')](respondWithResult(_0x3be7a6,0xc9))[_0x8862('0x4c')](handleError(_0x3be7a6,null));};exports['destroy']=function(_0x148853,_0x494739,_0x5dfe15){var _0x6c28e2;return db[_0x8862('0x33')][_0x8862('0x50')]({'where':{'id':_0x148853['params']['id']}})[_0x8862('0x29')](function(_0x499a68){if(_0x499a68){return db[_0x8862('0x60')]['transaction'](function(_0x4f90a4){return _0x499a68[_0x8862('0x61')]({'transaction':_0x4f90a4,'raw':!![]})[_0x8862('0x29')](function(_0x4a691e){if(_0x4a691e[_0x8862('0x55')]){fs[_0x8862('0x62')](_0x4a691e[_0x8862('0x55')])[_0x8862('0x63')](function(_0x23551c){fs['unlinkSync'](path[_0x8862('0x64')](_0x4a691e[_0x8862('0x55')],_0x23551c));});fs[_0x8862('0x65')](_0x4a691e[_0x8862('0x55')]);}return _0x4a691e;});})[_0x8862('0x4c')](function(_0xcb43f9){throw new db[(_0x8862('0x66'))][(_0x8862('0x67'))](_0xcb43f9[_0x8862('0x68')]);});}})[_0x8862('0x29')](handleEntityNotFound(_0x494739,null))[_0x8862('0x29')](removeEntity(_0x494739,null))[_0x8862('0x4c')](handleError(_0x494739,null));};exports['addSound']=function(_0x54a843,_0x2804e4,_0x1e8f9f){return db[_0x8862('0x60')][_0x8862('0x52')](function(_0x274a3b){var _0x3ac153;return db[_0x8862('0x33')]['find']({'where':{'id':_0x54a843[_0x8862('0x4e')]['id']}})[_0x8862('0x29')](function(_0x172e4e){if(_0x172e4e){_0x3ac153=_0x172e4e;return _0x172e4e[_0x8862('0x69')](_0x54a843[_0x8862('0x51')]['id'],{'transaction':_0x274a3b});}})[_0x8862('0x29')](function(_0x58672b){if(_0x58672b){return db['Sound'][_0x8862('0x6a')]({'where':{'id':_0x54a843[_0x8862('0x51')]['id']},'attributes':['id',_0x8862('0x2f'),_0x8862('0x6b'),_0x8862('0x6c'),_0x8862('0x6d')],'raw':!![]});}})[_0x8862('0x29')](function(_0x19f7e3){if(_0x19f7e3){var _0x359fff=path[_0x8862('0x64')](config['root'],'server/files/sounds/converted',util['format'](_0x8862('0x6e'),path['basename'](_0x19f7e3[_0x8862('0x6b')],path['extname'](_0x19f7e3['save_name'])),_0x19f7e3['converted_format']));var _0x3357bf=path[_0x8862('0x64')](config[_0x8862('0x6f')],_0x8862('0x56'),_0x3ac153['name'],util[_0x8862('0x70')](_0x8862('0x6e'),_0x19f7e3[_0x8862('0x2f')],_0x19f7e3[_0x8862('0x6c')]));fs['symlinkSync'](_0x359fff,_0x3357bf);return _0x19f7e3;}})['catch'](function(_0x1fc0fe){throw new db[(_0x8862('0x66'))][(_0x8862('0x67'))](_0x1fc0fe['message']);});})[_0x8862('0x29')](handleEntityNotFound(_0x2804e4,null))[_0x8862('0x29')](respondWithResult(_0x2804e4,0xc9))[_0x8862('0x4c')](handleError(_0x2804e4,null));};exports['removeSound']=function(_0x4295fd,_0x176a9e,_0xbbbdce){return db[_0x8862('0x60')]['transaction'](function(_0x1a361e){var _0x3c9cbc;return db[_0x8862('0x33')]['findOne']({'where':{'id':_0x4295fd[_0x8862('0x4e')]['id']}})[_0x8862('0x29')](handleEntityNotFound(_0x176a9e,null))[_0x8862('0x29')](function(_0x209199){if(_0x209199){_0x3c9cbc=_0x209199;return _0x209199[_0x8862('0x71')](_0x4295fd[_0x8862('0x4e')][_0x8862('0x72')]);}})[_0x8862('0x29')](function(_0x2e985b){if(_0x2e985b){return db['Sound'][_0x8862('0x6a')]({'where':{'id':_0x4295fd[_0x8862('0x4e')][_0x8862('0x72')]},'attributes':['id',_0x8862('0x2f'),_0x8862('0x6b'),_0x8862('0x6c'),_0x8862('0x6d')],'raw':!![]});}})[_0x8862('0x29')](function(_0x120f43){if(_0x120f43){fs['unlinkSync'](path[_0x8862('0x64')](_0x3c9cbc[_0x8862('0x55')],util[_0x8862('0x70')](_0x8862('0x6e'),_0x120f43['name'],_0x120f43[_0x8862('0x6c')])));return _0x120f43;}})[_0x8862('0x4c')](function(_0xb0fb26){throw new db['Sequelize']['ValidationError'](_0xb0fb26[_0x8862('0x68')]);});})['then'](handleEntityNotFound(_0x176a9e,null))['then'](respondWithStatusCode(_0x176a9e,0xcc))[_0x8862('0x4c')](handleError(_0x176a9e,null));};exports[_0x8862('0x73')]=function(_0x5c4fb6,_0x3ed530,_0x528b17){var _0x5b376b={};var _0x43904b={};var _0x14af0a;var _0x5f496d;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5c4fb6[_0x8862('0x4e')]['id']}})[_0x8862('0x29')](handleEntityNotFound(_0x3ed530,null))[_0x8862('0x29')](function(_0x5f567a){if(_0x5f567a){_0x14af0a=_0x5f567a;_0x43904b[_0x8862('0x37')]=_[_0x8862('0x38')](db[_0x8862('0x74')]['rawAttributes']);_0x43904b['query']=_[_0x8862('0x38')](_0x5c4fb6[_0x8862('0x39')]);_0x43904b['filters']=_[_0x8862('0x3b')](_0x43904b[_0x8862('0x37')],_0x43904b[_0x8862('0x39')]);_0x5b376b[_0x8862('0x3c')]=_['intersection'](_0x43904b['model'],qs['fields'](_0x5c4fb6[_0x8862('0x39')][_0x8862('0x3d')]));_0x5b376b['attributes']=_0x5b376b[_0x8862('0x3c')][_0x8862('0x3e')]?_0x5b376b[_0x8862('0x3c')]:_0x43904b['model'];_0x5b376b['order']=qs[_0x8862('0x42')](_0x5c4fb6['query'][_0x8862('0x42')]);_0x5b376b[_0x8862('0x43')]=qs[_0x8862('0x3a')](_['pick'](_0x5c4fb6[_0x8862('0x39')],_0x43904b[_0x8862('0x3a')]));if(_0x5c4fb6[_0x8862('0x39')][_0x8862('0x45')]){_0x5b376b[_0x8862('0x43')]=_[_0x8862('0x46')](_0x5b376b[_0x8862('0x43')],{'$or':_[_0x8862('0x32')](_0x5b376b[_0x8862('0x3c')],function(_0x5db6f4){var _0x4ed342={};_0x4ed342[_0x5db6f4]={'$like':'%'+_0x5c4fb6[_0x8862('0x39')][_0x8862('0x45')]+'%'};return _0x4ed342;})});}_0x5b376b=_['merge']({},_0x5b376b,_0x5c4fb6[_0x8862('0x49')]);return _0x14af0a[_0x8862('0x73')](_0x5b376b);}})[_0x8862('0x29')](function(_0x4ff0ca){if(_0x4ff0ca){_0x5f496d=_0x4ff0ca[_0x8862('0x3e')];if(!_0x5c4fb6[_0x8862('0x39')]['hasOwnProperty']('nolimit')){_0x5b376b[_0x8862('0x21')]=qs['limit'](_0x5c4fb6[_0x8862('0x39')][_0x8862('0x21')]);_0x5b376b[_0x8862('0x1e')]=qs['offset'](_0x5c4fb6['query'][_0x8862('0x1e')]);}return _0x14af0a['getSounds'](_0x5b376b);}})['then'](function(_0x3bd965){if(_0x3bd965){return _0x3bd965?{'count':_0x5f496d,'rows':_0x3bd965}:null;}})[_0x8862('0x29')](respondWithResult(_0x3ed530,null))[_0x8862('0x4c')](handleError(_0x3ed530,null));}; \ No newline at end of file +var _0x6861=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','%s.%s','extname','format','symlinkSync','message','removeSound','id2','getSounds','keys','order','rimraf','request-promise','bluebird','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','sendStatus','error','name','index','map','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','options','where','includeAll','VoiceMusicOnHold','findAll','catch','show','params','rawAttributes','intersection','length','include','body','find','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','UserProfileSection','userProfileId'];(function(_0x2f2356,_0x7b0658){var _0x4df920=function(_0x315f40){while(--_0x315f40){_0x2f2356['push'](_0x2f2356['shift']());}};_0x4df920(++_0x7b0658);}(_0x6861,0x158));var _0x1686=function(_0x378fe2,_0x3e9d0a){_0x378fe2=_0x378fe2-0x0;var _0xea0660=_0x6861[_0x378fe2];return _0xea0660;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1686('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1686('0x1'));var moment=require('moment');var BPromise=require(_0x1686('0x2'));var Mustache=require('mustache');var util=require(_0x1686('0x3'));var path=require('path');var sox=require(_0x1686('0x4'));var csv=require(_0x1686('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1686('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1686('0x7'));var jsforce=require(_0x1686('0x8'));var deskjs=require(_0x1686('0x9'));var toCsv=require(_0x1686('0x5'));var querystring=require('querystring');var Papa=require(_0x1686('0xa'));var Redis=require(_0x1686('0xb'));var authService=require(_0x1686('0xc'));var qs=require(_0x1686('0xd'));var as=require(_0x1686('0xe'));var hardwareService=require(_0x1686('0xf'));var logger=require(_0x1686('0x10'))(_0x1686('0x11'));var utils=require(_0x1686('0x12'));var config=require(_0x1686('0x13'));var licenseUtil=require(_0x1686('0x14'));var db=require(_0x1686('0x15'))['db'];function respondWithStatusCode(_0x1bbe9d,_0x4c08b9){_0x4c08b9=_0x4c08b9||0xcc;return function(_0x240e6a){if(_0x240e6a){return _0x1bbe9d['sendStatus'](_0x4c08b9);}return _0x1bbe9d[_0x1686('0x16')](_0x4c08b9)[_0x1686('0x17')]();};}function respondWithResult(_0x4434cd,_0x4c7ee9){_0x4c7ee9=_0x4c7ee9||0xc8;return function(_0x5076a0){if(_0x5076a0){return _0x4434cd['status'](_0x4c7ee9)[_0x1686('0x18')](_0x5076a0);}};}function respondWithFilteredResult(_0x49c7e1,_0x37348e){return function(_0x3d4564){if(_0x3d4564){var _0xbf7cb2=typeof _0x37348e['offset']===_0x1686('0x19')&&typeof _0x37348e[_0x1686('0x1a')]===_0x1686('0x19');var _0xa2c4a8=_0x3d4564[_0x1686('0x1b')];var _0x3b356d=_0xbf7cb2?0x0:_0x37348e[_0x1686('0x1c')];var _0x44c30c=_0xbf7cb2?_0x3d4564[_0x1686('0x1b')]:_0x37348e[_0x1686('0x1c')]+_0x37348e[_0x1686('0x1a')];var _0x3d035d;if(_0x44c30c>=_0xa2c4a8){_0x44c30c=_0xa2c4a8;_0x3d035d=0xc8;}else{_0x3d035d=0xce;}_0x49c7e1[_0x1686('0x16')](_0x3d035d);return _0x49c7e1[_0x1686('0x1d')](_0x1686('0x1e'),_0x3b356d+'-'+_0x44c30c+'/'+_0xa2c4a8)['json'](_0x3d4564);}return null;};}function patchUpdates(_0x4ce73c){return function(_0x58e6cb){try{jsonpatch[_0x1686('0x1f')](_0x58e6cb,_0x4ce73c,!![]);}catch(_0x3c8dc6){return BPromise[_0x1686('0x20')](_0x3c8dc6);}return _0x58e6cb[_0x1686('0x21')]();};}function saveUpdates(_0x4f04af,_0xbb4112){return function(_0x55dd6a){if(_0x55dd6a){return _0x55dd6a[_0x1686('0x22')](_0x4f04af)[_0x1686('0x23')](function(_0x88ac7f){return _0x88ac7f;});}return null;};}function removeEntity(_0x590e1e,_0x513b7d){return function(_0x464096){if(_0x464096){return _0x464096['destroy']()[_0x1686('0x23')](function(){var _0x16aec2=_0x464096[_0x1686('0x24')]({'plain':!![]});var _0x291c79=_0x1686('0x25');return db[_0x1686('0x26')][_0x1686('0x27')]({'where':{'type':_0x291c79,'resourceId':_0x16aec2['id']}})[_0x1686('0x23')](function(){return _0x464096;});})[_0x1686('0x23')](function(){_0x590e1e[_0x1686('0x16')](0xcc)[_0x1686('0x17')]();});}};}function handleEntityNotFound(_0x4c2036,_0x40cbec){return function(_0x55adc3){if(!_0x55adc3){_0x4c2036[_0x1686('0x28')](0x194);}return _0x55adc3;};}function handleError(_0xd10212,_0x2357cb){_0x2357cb=_0x2357cb||0x1f4;return function(_0x1d67ce){logger[_0x1686('0x29')](_0x1d67ce['stack']);if(_0x1d67ce[_0x1686('0x2a')]){delete _0x1d67ce[_0x1686('0x2a')];}_0xd10212[_0x1686('0x16')](_0x2357cb)['send'](_0x1d67ce);};}exports[_0x1686('0x2b')]=function(_0x459d4c,_0x30d364){var _0x569677={},_0x15ef38={},_0x121ee1={'count':0x0,'rows':[]};var _0xbde227=_[_0x1686('0x2c')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x2a5eeb){return{'name':_0x2a5eeb['fieldName'],'type':_0x2a5eeb['type'][_0x1686('0x2d')]};});_0x15ef38[_0x1686('0x2e')]=_[_0x1686('0x2c')](_0xbde227,'name');_0x15ef38[_0x1686('0x2f')]=_['keys'](_0x459d4c[_0x1686('0x2f')]);_0x15ef38[_0x1686('0x30')]=_['intersection'](_0x15ef38[_0x1686('0x2e')],_0x15ef38[_0x1686('0x2f')]);_0x569677[_0x1686('0x31')]=_['intersection'](_0x15ef38['model'],qs['fields'](_0x459d4c['query'][_0x1686('0x32')]));_0x569677[_0x1686('0x31')]=_0x569677[_0x1686('0x31')]['length']?_0x569677['attributes']:_0x15ef38['model'];if(!_0x459d4c[_0x1686('0x2f')][_0x1686('0x33')](_0x1686('0x34'))){_0x569677['limit']=qs['limit'](_0x459d4c[_0x1686('0x2f')][_0x1686('0x1a')]);_0x569677[_0x1686('0x1c')]=qs[_0x1686('0x1c')](_0x459d4c['query']['offset']);}_0x569677['order']=qs['sort'](_0x459d4c['query'][_0x1686('0x35')]);delete _0x459d4c[_0x1686('0x2f')][_0x1686('0x35')];_0x569677['where']=qs[_0x1686('0x30')](_[_0x1686('0x36')](_0x459d4c[_0x1686('0x2f')],_0x15ef38[_0x1686('0x30')]),_0xbde227);if(_0x459d4c[_0x1686('0x2f')][_0x1686('0x37')]){_0x569677['where']=_[_0x1686('0x38')](_0x569677['where'],{'$or':_[_0x1686('0x2c')](_0xbde227,function(_0x3f5f41){if(_0x3f5f41['type']!=='VIRTUAL'){var _0x502489={};_0x502489[_0x3f5f41[_0x1686('0x2a')]]={'$like':'%'+_0x459d4c['query']['filter']+'%'};return _0x502489;}})});}_0x569677=_[_0x1686('0x38')]({},_0x569677,_0x459d4c[_0x1686('0x39')]);var _0x4ebc4e={'where':_0x569677[_0x1686('0x3a')]};return db['VoiceMusicOnHold'][_0x1686('0x1b')](_0x4ebc4e)[_0x1686('0x23')](function(_0x283a76){_0x121ee1[_0x1686('0x1b')]=_0x283a76;if(_0x459d4c[_0x1686('0x2f')][_0x1686('0x3b')]){_0x569677['include']=[{'all':!![]}];}return db[_0x1686('0x3c')][_0x1686('0x3d')](_0x569677);})['then'](function(_0x3f9ad5){_0x121ee1['rows']=_0x3f9ad5;return _0x121ee1;})[_0x1686('0x23')](respondWithFilteredResult(_0x30d364,_0x569677))[_0x1686('0x3e')](handleError(_0x30d364,null));};exports[_0x1686('0x3f')]=function(_0x98c981,_0x3e3497){var _0x95ba6b={'raw':![],'where':{'id':_0x98c981[_0x1686('0x40')]['id']}},_0x572d4b={};_0x572d4b[_0x1686('0x2e')]=_['keys'](db['VoiceMusicOnHold'][_0x1686('0x41')]);_0x572d4b['query']=_['keys'](_0x98c981[_0x1686('0x2f')]);_0x572d4b[_0x1686('0x30')]=_[_0x1686('0x42')](_0x572d4b[_0x1686('0x2e')],_0x572d4b[_0x1686('0x2f')]);_0x95ba6b['attributes']=_[_0x1686('0x42')](_0x572d4b['model'],qs[_0x1686('0x32')](_0x98c981[_0x1686('0x2f')]['fields']));_0x95ba6b[_0x1686('0x31')]=_0x95ba6b['attributes'][_0x1686('0x43')]?_0x95ba6b[_0x1686('0x31')]:_0x572d4b[_0x1686('0x2e')];if(_0x98c981[_0x1686('0x2f')][_0x1686('0x3b')]){_0x95ba6b[_0x1686('0x44')]=[{'all':!![]}];}_0x95ba6b=_[_0x1686('0x38')]({},_0x95ba6b,_0x98c981[_0x1686('0x39')]);return db['VoiceMusicOnHold']['find'](_0x95ba6b)[_0x1686('0x23')](handleEntityNotFound(_0x3e3497,null))[_0x1686('0x23')](respondWithResult(_0x3e3497,null))['catch'](handleError(_0x3e3497,null));};exports[_0x1686('0x22')]=function(_0x40250b,_0x2cb731){if(_0x40250b[_0x1686('0x45')]['id']){delete _0x40250b[_0x1686('0x45')]['id'];}return db[_0x1686('0x3c')][_0x1686('0x46')]({'where':{'id':_0x40250b[_0x1686('0x40')]['id']}})[_0x1686('0x23')](handleEntityNotFound(_0x2cb731,null))['then'](saveUpdates(_0x40250b[_0x1686('0x45')],null))[_0x1686('0x23')](respondWithResult(_0x2cb731,null))['catch'](handleError(_0x2cb731,null));};exports[_0x1686('0x47')]=function(_0x588c67,_0x22ebf3,_0x5c5236){return db[_0x1686('0x48')][_0x1686('0x49')](function(_0x356e2a){if(_0x588c67[_0x1686('0x45')][_0x1686('0x4a')]===_0x1686('0x4b')){_0x588c67['body'][_0x1686('0x4c')]=path[_0x1686('0x4d')](config[_0x1686('0x4e')],_0x1686('0x4f'),_0x588c67[_0x1686('0x45')]['name']);}return db[_0x1686('0x3c')][_0x1686('0x47')](_0x588c67[_0x1686('0x45')],{'transaction':_0x356e2a})[_0x1686('0x23')](function(_0x5a00c0){if(_0x588c67[_0x1686('0x45')]['mode']===_0x1686('0x4b')){fs['mkdirSync'](_0x5a00c0[_0x1686('0x4c')],parseInt(_0x1686('0x50'),0x8));}var _0x17cd36=_0x588c67[_0x1686('0x51')][_0x1686('0x24')]({'plain':!![]});if(!_0x17cd36)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17cd36['role']===_0x1686('0x51')){var _0x3b43c7=_0x5a00c0[_0x1686('0x24')]({'plain':!![]});return db[_0x1686('0x52')][_0x1686('0x46')]({'where':{'name':'MusicOnHolds','userProfileId':_0x17cd36[_0x1686('0x53')]},'raw':!![]})[_0x1686('0x23')](function(_0x5b8be1){if(_0x5b8be1&&_0x5b8be1[_0x1686('0x54')]===0x0){return db['UserProfileResource'][_0x1686('0x47')]({'name':_0x3b43c7['name'],'resourceId':_0x3b43c7['id'],'type':_0x5b8be1[_0x1686('0x2a')],'sectionId':_0x5b8be1['id']},{})['then'](function(){return _0x5a00c0;});}else{return _0x5a00c0;}})['catch'](function(_0x2478f8){logger['error'](_0x1686('0x55'),_0x2478f8);});}return _0x5a00c0;});})[_0x1686('0x23')](respondWithResult(_0x22ebf3,0xc9))[_0x1686('0x3e')](handleError(_0x22ebf3,null));};exports[_0x1686('0x27')]=function(_0x183448,_0x201b5c,_0x5fb9f6){var _0x49aa51;return db[_0x1686('0x3c')][_0x1686('0x46')]({'where':{'id':_0x183448[_0x1686('0x40')]['id']}})[_0x1686('0x23')](function(_0x40fd3c){if(_0x40fd3c){return db['sequelize']['transaction'](function(_0x41a091){return _0x40fd3c[_0x1686('0x27')]({'transaction':_0x41a091,'raw':!![]})['then'](function(_0x2edb01){if(_0x2edb01['directory']){fs[_0x1686('0x56')](_0x2edb01['directory'])['forEach'](function(_0x43681f){fs[_0x1686('0x57')](path[_0x1686('0x4d')](_0x2edb01[_0x1686('0x4c')],_0x43681f));});fs[_0x1686('0x58')](_0x2edb01[_0x1686('0x4c')]);}return _0x2edb01;});})['catch'](function(_0x17a9c0){throw new db[(_0x1686('0x59'))][(_0x1686('0x5a'))](_0x17a9c0['message']);});}})[_0x1686('0x23')](handleEntityNotFound(_0x201b5c,null))[_0x1686('0x23')](removeEntity(_0x201b5c,null))[_0x1686('0x3e')](handleError(_0x201b5c,null));};exports[_0x1686('0x5b')]=function(_0x391ecb,_0x20dcc4,_0xfd769f){return db[_0x1686('0x48')]['transaction'](function(_0x2c5f0e){var _0x5b503c;return db['VoiceMusicOnHold'][_0x1686('0x46')]({'where':{'id':_0x391ecb[_0x1686('0x40')]['id']}})[_0x1686('0x23')](function(_0x39c632){if(_0x39c632){_0x5b503c=_0x39c632;return _0x39c632[_0x1686('0x5b')](_0x391ecb['body']['id'],{'transaction':_0x2c5f0e});}})['then'](function(_0x10a441){if(_0x10a441){return db[_0x1686('0x5c')][_0x1686('0x5d')]({'where':{'id':_0x391ecb[_0x1686('0x45')]['id']},'attributes':['id',_0x1686('0x2a'),_0x1686('0x5e'),_0x1686('0x5f'),'createdAt'],'raw':!![]});}})[_0x1686('0x23')](function(_0x18cb0d){if(_0x18cb0d){var _0x46ada1=path[_0x1686('0x4d')](config[_0x1686('0x4e')],_0x1686('0x60'),util['format'](_0x1686('0x61'),path['basename'](_0x18cb0d[_0x1686('0x5e')],path[_0x1686('0x62')](_0x18cb0d[_0x1686('0x5e')])),_0x18cb0d[_0x1686('0x5f')]));var _0x44b181=path[_0x1686('0x4d')](config[_0x1686('0x4e')],_0x1686('0x4f'),_0x5b503c[_0x1686('0x2a')],util[_0x1686('0x63')](_0x1686('0x61'),_0x18cb0d['name'],_0x18cb0d[_0x1686('0x5f')]));fs[_0x1686('0x64')](_0x46ada1,_0x44b181);return _0x18cb0d;}})['catch'](function(_0x3e524e){throw new db[(_0x1686('0x59'))][(_0x1686('0x5a'))](_0x3e524e[_0x1686('0x65')]);});})['then'](handleEntityNotFound(_0x20dcc4,null))['then'](respondWithResult(_0x20dcc4,0xc9))[_0x1686('0x3e')](handleError(_0x20dcc4,null));};exports[_0x1686('0x66')]=function(_0x2f3344,_0x34be88,_0x4545bd){return db[_0x1686('0x48')]['transaction'](function(_0x6dee15){var _0x556417;return db[_0x1686('0x3c')]['findOne']({'where':{'id':_0x2f3344[_0x1686('0x40')]['id']}})[_0x1686('0x23')](handleEntityNotFound(_0x34be88,null))[_0x1686('0x23')](function(_0x31ad19){if(_0x31ad19){_0x556417=_0x31ad19;return _0x31ad19[_0x1686('0x66')](_0x2f3344[_0x1686('0x40')][_0x1686('0x67')]);}})[_0x1686('0x23')](function(_0x4a053b){if(_0x4a053b){return db[_0x1686('0x5c')][_0x1686('0x5d')]({'where':{'id':_0x2f3344[_0x1686('0x40')][_0x1686('0x67')]},'attributes':['id',_0x1686('0x2a'),_0x1686('0x5e'),_0x1686('0x5f'),'createdAt'],'raw':!![]});}})['then'](function(_0x50297e){if(_0x50297e){fs[_0x1686('0x57')](path[_0x1686('0x4d')](_0x556417['directory'],util['format'](_0x1686('0x61'),_0x50297e[_0x1686('0x2a')],_0x50297e[_0x1686('0x5f')])));return _0x50297e;}})[_0x1686('0x3e')](function(_0x513124){throw new db[(_0x1686('0x59'))]['ValidationError'](_0x513124[_0x1686('0x65')]);});})[_0x1686('0x23')](handleEntityNotFound(_0x34be88,null))[_0x1686('0x23')](respondWithStatusCode(_0x34be88,0xcc))['catch'](handleError(_0x34be88,null));};exports[_0x1686('0x68')]=function(_0x56b385,_0x34e586,_0x1d4aba){var _0x181da4={};var _0x5e5efa={};var _0x51a632;var _0x134ddd;return db[_0x1686('0x3c')][_0x1686('0x5d')]({'where':{'id':_0x56b385[_0x1686('0x40')]['id']}})[_0x1686('0x23')](handleEntityNotFound(_0x34e586,null))[_0x1686('0x23')](function(_0x2e00dd){if(_0x2e00dd){_0x51a632=_0x2e00dd;_0x5e5efa[_0x1686('0x2e')]=_[_0x1686('0x69')](db['Sound'][_0x1686('0x41')]);_0x5e5efa['query']=_['keys'](_0x56b385[_0x1686('0x2f')]);_0x5e5efa[_0x1686('0x30')]=_[_0x1686('0x42')](_0x5e5efa[_0x1686('0x2e')],_0x5e5efa['query']);_0x181da4[_0x1686('0x31')]=_[_0x1686('0x42')](_0x5e5efa[_0x1686('0x2e')],qs[_0x1686('0x32')](_0x56b385['query'][_0x1686('0x32')]));_0x181da4[_0x1686('0x31')]=_0x181da4[_0x1686('0x31')][_0x1686('0x43')]?_0x181da4['attributes']:_0x5e5efa[_0x1686('0x2e')];_0x181da4[_0x1686('0x6a')]=qs[_0x1686('0x35')](_0x56b385[_0x1686('0x2f')]['sort']);_0x181da4[_0x1686('0x3a')]=qs[_0x1686('0x30')](_[_0x1686('0x36')](_0x56b385['query'],_0x5e5efa[_0x1686('0x30')]));if(_0x56b385[_0x1686('0x2f')]['filter']){_0x181da4[_0x1686('0x3a')]=_['merge'](_0x181da4['where'],{'$or':_[_0x1686('0x2c')](_0x181da4[_0x1686('0x31')],function(_0x40cd48){var _0x49b5e2={};_0x49b5e2[_0x40cd48]={'$like':'%'+_0x56b385['query']['filter']+'%'};return _0x49b5e2;})});}_0x181da4=_[_0x1686('0x38')]({},_0x181da4,_0x56b385[_0x1686('0x39')]);return _0x51a632['getSounds'](_0x181da4);}})[_0x1686('0x23')](function(_0x342024){if(_0x342024){_0x134ddd=_0x342024['length'];if(!_0x56b385[_0x1686('0x2f')][_0x1686('0x33')]('nolimit')){_0x181da4[_0x1686('0x1a')]=qs['limit'](_0x56b385[_0x1686('0x2f')][_0x1686('0x1a')]);_0x181da4[_0x1686('0x1c')]=qs[_0x1686('0x1c')](_0x56b385[_0x1686('0x2f')][_0x1686('0x1c')]);}return _0x51a632[_0x1686('0x68')](_0x181da4);}})[_0x1686('0x23')](function(_0x16d55e){if(_0x16d55e){return _0x16d55e?{'count':_0x134ddd,'rows':_0x16d55e}:null;}})[_0x1686('0x23')](respondWithResult(_0x34e586,null))[_0x1686('0x3e')](handleError(_0x34e586,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 8f32c08..309e824 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 _0xfc38=['moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','util','api'];(function(_0x3126a7,_0xeab7ee){var _0x359314=function(_0x2b4f2e){while(--_0x2b4f2e){_0x3126a7['push'](_0x3126a7['shift']());}};_0x359314(++_0xeab7ee);}(_0xfc38,0x98));var _0x8fc3=function(_0x36e35b,_0x3a75c6){_0x36e35b=_0x36e35b-0x0;var _0x1aed7d=_0xfc38[_0x36e35b];return _0x1aed7d;};'use strict';var _=require('lodash');var util=require(_0x8fc3('0x0'));var logger=require('../../config/logger')(_0x8fc3('0x1'));var moment=require(_0x8fc3('0x2'));var BPromise=require(_0x8fc3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fc3('0x4'));var rimraf=require(_0x8fc3('0x5'));var config=require(_0x8fc3('0x6'));var attributes=require(_0x8fc3('0x7'));module[_0x8fc3('0x8')]=function(_0x4cdb8c,_0x5e0f12){return _0x4cdb8c[_0x8fc3('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x8fc3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x339e=['api','moment','request-promise','path','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x339e,0x152));var _0xe339=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0x339e[_0x2637ac];return _0x4a5758;};'use strict';var _=require(_0xe339('0x0'));var util=require(_0xe339('0x1'));var logger=require('../../config/logger')(_0xe339('0x2'));var moment=require(_0xe339('0x3'));var BPromise=require('bluebird');var rp=require(_0xe339('0x4'));var fs=require('fs');var path=require(_0xe339('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe339('0x6'));module[_0xe339('0x7')]=function(_0x5627a3,_0x3bb868){return _0x5627a3[_0xe339('0x8')](_0xe339('0x9'),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 09eea74..c634a8d 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4d0087,_0x579749){var _0x208bbd=function(_0x50a43d){while(--_0x50a43d){_0x4d0087['push'](_0x4d0087['shift']());}};_0x208bbd(++_0x579749);}(_0x34e8,0x12c));var _0x834e=function(_0x422bc1,_0x38366d){_0x422bc1=_0x422bc1-0x0;var _0x2044ab=_0x34e8[_0x422bc1];return _0x2044ab;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f12c1,_0x523c29){var _0x2ee2a1=function(_0x4286af){while(--_0x4286af){_0x1f12c1['push'](_0x1f12c1['shift']());}};_0x2ee2a1(++_0x523c29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 420652f..a5de5b1 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 _0x6dd1=['show','/:id/users','getAgents','getTeams','create','post','addAgents','/:id/teams','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/:id'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x6dd1,0x111));var _0x16dd=function(_0x22a991,_0x5524ef){_0x22a991=_0x22a991-0x0;var _0x16eb51=_0x6dd1[_0x22a991];return _0x16eb51;};'use strict';var multer=require(_0x16dd('0x0'));var util=require('util');var path=require(_0x16dd('0x1'));var timeout=require(_0x16dd('0x2'));var express=require('express');var router=express[_0x16dd('0x3')]();var fs_extra=require(_0x16dd('0x4'));var auth=require(_0x16dd('0x5'));var interaction=require(_0x16dd('0x6'));var config=require(_0x16dd('0x7'));var controller=require(_0x16dd('0x8'));router[_0x16dd('0x9')]('/',auth[_0x16dd('0xa')](),controller[_0x16dd('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x16dd('0x9')](_0x16dd('0xc'),auth[_0x16dd('0xa')](),controller[_0x16dd('0xd')]);router['get'](_0x16dd('0xe'),auth['isAuthenticated'](),controller[_0x16dd('0xf')]);router['get']('/:id/teams',auth[_0x16dd('0xa')](),controller[_0x16dd('0x10')]);router['post']('/',auth[_0x16dd('0xa')](),controller[_0x16dd('0x11')]);router[_0x16dd('0x12')]('/:id/users',auth[_0x16dd('0xa')](),controller[_0x16dd('0x13')]);router[_0x16dd('0x12')](_0x16dd('0x14'),auth[_0x16dd('0xa')](),controller['addTeams']);router['put'](_0x16dd('0xc'),auth['isAuthenticated'](),controller[_0x16dd('0x15')]);router[_0x16dd('0x16')](_0x16dd('0xc'),auth[_0x16dd('0xa')](),controller[_0x16dd('0x17')]);router[_0x16dd('0x16')](_0x16dd('0xe'),auth[_0x16dd('0xa')](),controller['removeAgents']);router[_0x16dd('0x16')](_0x16dd('0x14'),auth[_0x16dd('0xa')](),controller[_0x16dd('0x18')]);module[_0x16dd('0x19')]=router; \ No newline at end of file +var _0x8e52=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id/users','getAgents','post','addTeams','put','/:id','update','delete','destroy','/:id/teams','removeTeams','exports','util','path','connect-timeout','express','Router'];(function(_0x3de436,_0x9ccde9){var _0x4f332a=function(_0x87a19f){while(--_0x87a19f){_0x3de436['push'](_0x3de436['shift']());}};_0x4f332a(++_0x9ccde9);}(_0x8e52,0x1c6));var _0x28e5=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x8e52[_0xd0cd0b];return _0x59cced;};'use strict';var multer=require('multer');var util=require(_0x28e5('0x0'));var path=require(_0x28e5('0x1'));var timeout=require(_0x28e5('0x2'));var express=require(_0x28e5('0x3'));var router=express[_0x28e5('0x4')]();var fs_extra=require(_0x28e5('0x5'));var auth=require(_0x28e5('0x6'));var interaction=require(_0x28e5('0x7'));var config=require(_0x28e5('0x8'));var controller=require(_0x28e5('0x9'));router[_0x28e5('0xa')]('/',auth[_0x28e5('0xb')](),controller[_0x28e5('0xc')]);router[_0x28e5('0xa')](_0x28e5('0xd'),auth['isAuthenticated'](),controller[_0x28e5('0xe')]);router[_0x28e5('0xa')]('/:id',auth[_0x28e5('0xb')](),controller['show']);router[_0x28e5('0xa')](_0x28e5('0xf'),auth[_0x28e5('0xb')](),controller[_0x28e5('0x10')]);router[_0x28e5('0xa')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x28e5('0x11')]('/',auth[_0x28e5('0xb')](),controller['create']);router[_0x28e5('0x11')](_0x28e5('0xf'),auth[_0x28e5('0xb')](),controller['addAgents']);router[_0x28e5('0x11')]('/:id/teams',auth[_0x28e5('0xb')](),controller[_0x28e5('0x12')]);router[_0x28e5('0x13')](_0x28e5('0x14'),auth[_0x28e5('0xb')](),controller[_0x28e5('0x15')]);router[_0x28e5('0x16')](_0x28e5('0x14'),auth[_0x28e5('0xb')](),controller[_0x28e5('0x17')]);router[_0x28e5('0x16')](_0x28e5('0xf'),auth[_0x28e5('0xb')](),controller['removeAgents']);router['delete'](_0x28e5('0x18'),auth[_0x28e5('0xb')](),controller[_0x28e5('0x19')]);module[_0x28e5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 415d45a..5dd89fd 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 _0x1eb5=['VIRTUAL','getDataValue','name','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1eb5,0x148));var _0x51eb=function(_0xb40105,_0x8fd16b){_0xb40105=_0xb40105-0x0;var _0x14aa8b=_0x1eb5[_0xb40105];return _0x14aa8b;};'use strict';var Sequelize=require(_0x51eb('0x0'));module[_0x51eb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x51eb('0x2')],'get':function(_0x293399){return'system-'+this[_0x51eb('0x3')](_0x51eb('0x4'))+'-';}},'description':{'type':Sequelize[_0x51eb('0x5')]},'callerIdAll':{'type':Sequelize[_0x51eb('0x5')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfed5=['STRING','name','VIRTUAL','system-','getDataValue','sequelize','exports'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xfed5,0x1a2));var _0x5fed=function(_0x4eeb70,_0x20f2e3){_0x4eeb70=_0x4eeb70-0x0;var _0x25f4a1=_0xfed5[_0x4eeb70];return _0x25f4a1;};'use strict';var Sequelize=require(_0x5fed('0x0'));module[_0x5fed('0x1')]={'name':{'type':Sequelize[_0x5fed('0x2')],'allowNull':![],'unique':_0x5fed('0x3')},'prefix':{'type':Sequelize[_0x5fed('0x4')],'get':function(_0xa769b5){return _0x5fed('0x5')+this[_0x5fed('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x5fed('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'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 9599be6..1f3ce08 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 _0xd4f4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voicePrefix.socket','register','sendStatus','end','status','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','options','includeAll','include','VoicePrefix','rows','catch','show','keys','find','params','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','priority','prefix','NoOp','Voice\x20Prefix','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','goto','${EXTEN:','length','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','findAll','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','Team','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','union','compact','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x58039c,_0x2058c6){var _0x5a6f44=function(_0x50a5c0){while(--_0x50a5c0){_0x58039c['push'](_0x58039c['shift']());}};_0x5a6f44(++_0x2058c6);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x58cb55,_0x17428a){_0x58cb55=_0x58cb55-0x0;var _0x2c9474=_0xd4f4[_0x58cb55];return _0x2c9474;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x4d4f('0x1d')],{'host':_0x4d4f('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d4f('0x1d')]));require(_0x4d4f('0x1f'))[_0x4d4f('0x20')](socket);function respondWithStatusCode(_0x59252c,_0x145804){_0x145804=_0x145804||0xcc;return function(_0x2e736b){if(_0x2e736b){return _0x59252c[_0x4d4f('0x21')](_0x145804);}return _0x59252c['status'](_0x145804)[_0x4d4f('0x22')]();};}function respondWithResult(_0x5e4ff5,_0x18a528){_0x18a528=_0x18a528||0xc8;return function(_0x16f8e7){if(_0x16f8e7){return _0x5e4ff5[_0x4d4f('0x23')](_0x18a528)['json'](_0x16f8e7);}};}function respondWithFilteredResult(_0x30b6b1,_0x17a437){return function(_0x51dcf1){if(_0x51dcf1){var _0x5dbbeb=typeof _0x17a437['offset']==='undefined'&&typeof _0x17a437['limit']===_0x4d4f('0x24');var _0x15100a=_0x51dcf1[_0x4d4f('0x25')];var _0x3566a5=_0x5dbbeb?0x0:_0x17a437['offset'];var _0x5b2863=_0x5dbbeb?_0x51dcf1[_0x4d4f('0x25')]:_0x17a437['offset']+_0x17a437[_0x4d4f('0x26')];var _0x1e3e9a;if(_0x5b2863>=_0x15100a){_0x5b2863=_0x15100a;_0x1e3e9a=0xc8;}else{_0x1e3e9a=0xce;}_0x30b6b1[_0x4d4f('0x23')](_0x1e3e9a);return _0x30b6b1[_0x4d4f('0x27')](_0x4d4f('0x28'),_0x3566a5+'-'+_0x5b2863+'/'+_0x15100a)['json'](_0x51dcf1);}return null;};}function patchUpdates(_0x570520){return function(_0x4043f2){try{jsonpatch['apply'](_0x4043f2,_0x570520,!![]);}catch(_0x247077){return BPromise[_0x4d4f('0x29')](_0x247077);}return _0x4043f2[_0x4d4f('0x2a')]();};}function saveUpdates(_0x3f4a55,_0xf3f7a4){return function(_0x497cec){if(_0x497cec){return _0x497cec[_0x4d4f('0x2b')](_0x3f4a55)[_0x4d4f('0x2c')](function(_0x1cf365){return _0x1cf365;});}return null;};}function removeEntity(_0x28443b,_0x5cf9e7){return function(_0x51a7c5){if(_0x51a7c5){return _0x51a7c5[_0x4d4f('0x2d')]()[_0x4d4f('0x2c')](function(){var _0xa2492c=_0x51a7c5[_0x4d4f('0x2e')]({'plain':!![]});var _0x58acbe=_0x4d4f('0x2f');return db[_0x4d4f('0x30')][_0x4d4f('0x2d')]({'where':{'type':_0x58acbe,'resourceId':_0xa2492c['id']}})[_0x4d4f('0x2c')](function(){return _0x51a7c5;});})['then'](function(){_0x28443b[_0x4d4f('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1688bb,_0x333a40){return function(_0x550040){if(!_0x550040){_0x1688bb[_0x4d4f('0x21')](0x194);}return _0x550040;};}function handleError(_0x123383,_0x287a09){_0x287a09=_0x287a09||0x1f4;return function(_0x3d7f14){logger[_0x4d4f('0x31')](_0x3d7f14[_0x4d4f('0x32')]);if(_0x3d7f14['name']){delete _0x3d7f14[_0x4d4f('0x33')];}_0x123383[_0x4d4f('0x23')](_0x287a09)[_0x4d4f('0x34')](_0x3d7f14);};}exports[_0x4d4f('0x35')]=function(_0x104104,_0x4e47e5){var _0x2d6565={},_0x486e33={},_0x35f9e2={'count':0x0,'rows':[]};var _0x537a47=_['map'](db['VoicePrefix'][_0x4d4f('0x36')],function(_0x57fc2b){return{'name':_0x57fc2b[_0x4d4f('0x37')],'type':_0x57fc2b[_0x4d4f('0x38')][_0x4d4f('0x39')]};});_0x486e33['model']=_[_0x4d4f('0x3a')](_0x537a47,_0x4d4f('0x33'));_0x486e33[_0x4d4f('0x3b')]=_['keys'](_0x104104[_0x4d4f('0x3b')]);_0x486e33['filters']=_[_0x4d4f('0x3c')](_0x486e33[_0x4d4f('0x3d')],_0x486e33[_0x4d4f('0x3b')]);_0x2d6565[_0x4d4f('0x3e')]=_[_0x4d4f('0x3c')](_0x486e33[_0x4d4f('0x3d')],qs[_0x4d4f('0x3f')](_0x104104[_0x4d4f('0x3b')]['fields']));_0x2d6565['attributes']=_0x2d6565[_0x4d4f('0x3e')]['length']?_0x2d6565['attributes']:_0x486e33[_0x4d4f('0x3d')];if(!_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x40')](_0x4d4f('0x41'))){_0x2d6565[_0x4d4f('0x26')]=qs['limit'](_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x26')]);_0x2d6565['offset']=qs[_0x4d4f('0x42')](_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x42')]);}_0x2d6565[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x44')]);_0x2d6565[_0x4d4f('0x45')]=qs[_0x4d4f('0x46')](_['pick'](_0x104104['query'],_0x486e33[_0x4d4f('0x46')]),_0x537a47);if(_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x47')]){_0x2d6565[_0x4d4f('0x45')]=_['merge'](_0x2d6565['where'],{'$or':_[_0x4d4f('0x3a')](_0x537a47,function(_0x3c34bd){if(_0x3c34bd['type']!=='VIRTUAL'){var _0x3591b7={};_0x3591b7[_0x3c34bd[_0x4d4f('0x33')]]={'$like':'%'+_0x104104['query'][_0x4d4f('0x47')]+'%'};return _0x3591b7;}})});}_0x2d6565=_[_0x4d4f('0x48')]({},_0x2d6565,_0x104104[_0x4d4f('0x49')]);var _0x32c6ff={'where':_0x2d6565[_0x4d4f('0x45')]};return db['VoicePrefix'][_0x4d4f('0x25')](_0x32c6ff)['then'](function(_0x45a0c1){_0x35f9e2[_0x4d4f('0x25')]=_0x45a0c1;if(_0x104104['query'][_0x4d4f('0x4a')]){_0x2d6565[_0x4d4f('0x4b')]=[{'all':!![]}];}return db[_0x4d4f('0x4c')]['findAll'](_0x2d6565);})[_0x4d4f('0x2c')](function(_0x48caa2){_0x35f9e2[_0x4d4f('0x4d')]=_0x48caa2;return _0x35f9e2;})['then'](respondWithFilteredResult(_0x4e47e5,_0x2d6565))[_0x4d4f('0x4e')](handleError(_0x4e47e5,null));};exports[_0x4d4f('0x4f')]=function(_0x231134,_0x2939cb){var _0x198c3a={'raw':![],'where':{'id':_0x231134['params']['id']}},_0x4a53e4={};_0x4a53e4[_0x4d4f('0x3d')]=_[_0x4d4f('0x50')](db[_0x4d4f('0x4c')][_0x4d4f('0x36')]);_0x4a53e4['query']=_['keys'](_0x231134['query']);_0x4a53e4[_0x4d4f('0x46')]=_[_0x4d4f('0x3c')](_0x4a53e4[_0x4d4f('0x3d')],_0x4a53e4[_0x4d4f('0x3b')]);_0x198c3a[_0x4d4f('0x3e')]=_[_0x4d4f('0x3c')](_0x4a53e4[_0x4d4f('0x3d')],qs[_0x4d4f('0x3f')](_0x231134[_0x4d4f('0x3b')][_0x4d4f('0x3f')]));_0x198c3a[_0x4d4f('0x3e')]=_0x198c3a[_0x4d4f('0x3e')]['length']?_0x198c3a[_0x4d4f('0x3e')]:_0x4a53e4[_0x4d4f('0x3d')];if(_0x231134['query'][_0x4d4f('0x4a')]){_0x198c3a['include']=[{'all':!![]}];}_0x198c3a=_[_0x4d4f('0x48')]({},_0x198c3a,_0x231134[_0x4d4f('0x49')]);return db['VoicePrefix'][_0x4d4f('0x51')](_0x198c3a)[_0x4d4f('0x2c')](handleEntityNotFound(_0x2939cb,null))[_0x4d4f('0x2c')](respondWithResult(_0x2939cb,null))[_0x4d4f('0x4e')](handleError(_0x2939cb,null));};exports[_0x4d4f('0x2d')]=function(_0x3eae74,_0x11a63e){return db[_0x4d4f('0x4c')][_0x4d4f('0x51')]({'where':{'id':_0x3eae74[_0x4d4f('0x52')]['id']}})[_0x4d4f('0x2c')](handleEntityNotFound(_0x11a63e,null))[_0x4d4f('0x2c')](removeEntity(_0x11a63e,null))['catch'](handleError(_0x11a63e,null));};exports[_0x4d4f('0x53')]=function(_0x539088,_0x59d245){return db['VoicePrefix'][_0x4d4f('0x53')]()[_0x4d4f('0x2c')](respondWithResult(_0x59d245,null))['catch'](handleError(_0x59d245,null));};exports['create']=function(_0x2a3bc4,_0x4c80c4){var _0x5adc7b;return db[_0x4d4f('0x54')]['transaction'](function(_0x17b59e){return db[_0x4d4f('0x4c')][_0x4d4f('0x55')](_0x2a3bc4[_0x4d4f('0x56')],{'transaction':_0x17b59e})['then'](function(_0x224b83){_0x5adc7b=_0x224b83[_0x4d4f('0x2e')]({'plain':!![]});return db[_0x4d4f('0x57')][_0x4d4f('0x51')]({'where':{'id':_0x5adc7b[_0x4d4f('0x58')]},'raw':!![]})['then'](function(_0x10f94e){return createVoicePrefixExtensions(_0x5adc7b,_0x10f94e,_0x17b59e);});});})['then'](function(){var _0x32cba6=_0x2a3bc4['user'][_0x4d4f('0x2e')]({'plain':!![]});if(!_0x32cba6)throw new Error(_0x4d4f('0x59'));if(_0x32cba6['role']===_0x4d4f('0x5a')){var _0x1d8ae6=_0x5adc7b;return db['UserProfileSection'][_0x4d4f('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0x32cba6[_0x4d4f('0x5b')]},'raw':!![]})['then'](function(_0x48ad06){if(_0x48ad06&&_0x48ad06[_0x4d4f('0x5c')]===0x0){return db[_0x4d4f('0x30')][_0x4d4f('0x55')]({'name':_0x1d8ae6[_0x4d4f('0x33')],'resourceId':_0x1d8ae6['id'],'type':_0x48ad06[_0x4d4f('0x33')],'sectionId':_0x48ad06['id']},{})['then'](function(){return _0x5adc7b;});}else{return _0x5adc7b;}})['catch'](function(_0xeaccdd){logger['error'](_0x4d4f('0x5d'),_0xeaccdd);throw _0xeaccdd;});}return _0x5adc7b;})[_0x4d4f('0x2c')](respondWithResult(_0x4c80c4,null))[_0x4d4f('0x4e')](handleError(_0x4c80c4,null));};function Extension(_0x4585b5,_0x31aba3,_0x39ae15,_0x585764){this[_0x4d4f('0x5e')]=_0x4d4f('0x5f');this[_0x4d4f('0x60')]=_0x4585b5;this['app']=_0x39ae15;this[_0x4d4f('0x38')]=_0x4d4f('0x61');this[_0x4d4f('0x62')]='Voice\x20Prefix\x20Extension';this[_0x4d4f('0x63')]=_0x31aba3;this['appdata']=_0x585764;}function createVoicePrefixExtensions(_0xcdab8b,_0x2145ca,_0x1fe5ca){return new BPromise(function(_0xe8d3e2,_0x1edb3d){var _0x2e55f5=new Extension(formatPrefixName(_0xcdab8b[_0x4d4f('0x64')]),0x1,_0x4d4f('0x65'),_0x4d4f('0x66'));_0x2e55f5['VoicePrefixId']=_0xcdab8b['id'];return db[_0x4d4f('0x57')][_0x4d4f('0x55')](_0x2e55f5,{'transaction':_0x1fe5ca})['then'](function(_0x1bd4b1){var _0x2a3738=_0x1bd4b1[_0x4d4f('0x2e')]({'plain':!![]});var _0xae8fe=_['map'](addVoicePrefixExtensions(_0xcdab8b,_0x2145ca),function(_0x4013a9){_0x4013a9[_0x4d4f('0x58')]=_0x2a3738['id'];_0x4013a9['VoicePrefixId']=_0xcdab8b['id'];return _0x4013a9;});return db['VoiceExtension'][_0x4d4f('0x67')](_0xae8fe,{'transaction':_0x1fe5ca})[_0x4d4f('0x2c')](function(_0x53b2db){if(!_0x53b2db){return _0x1edb3d('Extensions\x20creation\x20failed');}else{return _0xe8d3e2(_0x53b2db);}})['catch'](function(_0x4752bd){return _0x1edb3d(_0x4752bd);});});;});};function addVoicePrefixExtensions(_0x351fb5,_0x5e0ead){var _0x347bb1=[];var _0xc596ea=formatPrefixName(_0x351fb5[_0x4d4f('0x64')]);_0x347bb1[_0x4d4f('0x68')](new Extension(_0xc596ea,0x2,_0x4d4f('0x69'),_0x4d4f('0x6a')+_0x351fb5[_0x4d4f('0x33')]));if(_0x351fb5[_0x4d4f('0x6b')]){_0x347bb1['push'](new Extension(_0xc596ea,0x3,_0x4d4f('0x69'),'PREFIX-CALLERIDALL='+_0x351fb5[_0x4d4f('0x6b')]));}else{_0x347bb1[_0x4d4f('0x68')](new Extension(_0xc596ea,0x3,_0x4d4f('0x65'),'No\x20callerid\x20available'));}_0x347bb1[_0x4d4f('0x68')](new Extension(_0xc596ea,0x4,_0x4d4f('0x6c'),_0x5e0ead[_0x4d4f('0x5e')]+','+_0x4d4f('0x6d')+(0x8+_0x351fb5['name'][_0x4d4f('0x6e')])+'}'+','+0x1));return _0x347bb1;}function formatPrefixName(_0x4bf7bd){var _0x268b34='_';for(var _0x50d0da=0x0;_0x50d0da<_0x4bf7bd['length'];_0x50d0da++){if(_0x4bf7bd[_0x4d4f('0x6f')](_0x50d0da)=='-'){_0x268b34+=_0x4bf7bd[_0x4d4f('0x6f')](_0x50d0da);}else{_0x268b34+='['+_0x4bf7bd['charAt'](_0x50d0da)+']';}}_0x268b34+='.';return _0x268b34;}exports[_0x4d4f('0x2b')]=function(_0x53a18b,_0x41ffe7,_0x4420f0){var _0x111c01=_0x53a18b[_0x4d4f('0x56')];_0x111c01['prefix']=_0x4d4f('0x70')+_0x111c01[_0x4d4f('0x33')]+'-';return db[_0x4d4f('0x54')]['transaction'](function(_0x781877){return db[_0x4d4f('0x4c')][_0x4d4f('0x2b')](_0x111c01,{'where':{'id':_0x111c01['id']},'transaction':_0x781877})[_0x4d4f('0x2c')](function(){return db[_0x4d4f('0x57')][_0x4d4f('0x2d')]({'where':{'VoicePrefixId':_0x111c01['id']},'transaction':_0x781877})['then'](function(){return db['VoiceExtension'][_0x4d4f('0x51')]({'where':{'id':_0x111c01[_0x4d4f('0x58')]},'raw':!![]})['then'](function(_0x26ed6f){return createVoicePrefixExtensions(_0x111c01,_0x26ed6f,_0x781877);});});});})[_0x4d4f('0x2c')](function(){return db[_0x4d4f('0x4c')][_0x4d4f('0x71')](_0x111c01['id']);})[_0x4d4f('0x2c')](respondWithResult(_0x41ffe7,null))[_0x4d4f('0x4e')](handleError(_0x41ffe7,null));};exports[_0x4d4f('0x72')]=function(_0x1c764b,_0x302cde,_0x44f0c2){return db[_0x4d4f('0x4c')][_0x4d4f('0x51')]({'where':{'id':_0x1c764b[_0x4d4f('0x52')]['id']}})[_0x4d4f('0x2c')](handleEntityNotFound(_0x302cde,null))[_0x4d4f('0x2c')](function(_0x518252){if(_0x518252){return _0x518252[_0x4d4f('0x72')](_0x1c764b[_0x4d4f('0x56')][_0x4d4f('0x73')],_[_0x4d4f('0x74')](_0x1c764b['body'],['ids','id'])||{})[_0x4d4f('0x75')](function(_0x3c8a64){for(var _0x4736db=0x0;_0x4736db<_0x1c764b[_0x4d4f('0x56')][_0x4d4f('0x73')][_0x4d4f('0x6e')];_0x4736db+=0x1){socket[_0x4d4f('0x76')](_0x4d4f('0x77'),{'UserId':Number(_0x1c764b[_0x4d4f('0x56')][_0x4d4f('0x73')][_0x4736db]),'VoicePrefixId':Number(_0x1c764b['params']['id'])});}return _0x3c8a64;});}})[_0x4d4f('0x2c')](respondWithResult(_0x302cde,null))[_0x4d4f('0x4e')](handleError(_0x302cde,null));};exports[_0x4d4f('0x78')]=function(_0x2c8c79,_0x584c53,_0x5240be){return db['VoicePrefix'][_0x4d4f('0x51')]({'where':{'id':_0x2c8c79['params']['id']}})[_0x4d4f('0x2c')](handleEntityNotFound(_0x584c53,null))[_0x4d4f('0x2c')](function(_0xa63721){if(_0xa63721){return _0xa63721[_0x4d4f('0x78')](_0x2c8c79[_0x4d4f('0x3b')][_0x4d4f('0x73')])[_0x4d4f('0x2c')](function(){if(_[_0x4d4f('0x79')](_0x2c8c79['query']['ids'])){for(var _0x42c66c=0x0;_0x42c66c<_0x2c8c79['query'][_0x4d4f('0x73')][_0x4d4f('0x6e')];_0x42c66c+=0x1){socket[_0x4d4f('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x2c8c79['query']['ids'][_0x42c66c]),'VoicePrefixId':Number(_0x2c8c79[_0x4d4f('0x52')]['id'])});}}else{socket['emit'](_0x4d4f('0x7a'),{'UserId':Number(_0x2c8c79['query'][_0x4d4f('0x73')]),'VoicePrefixId':Number(_0x2c8c79[_0x4d4f('0x52')]['id'])});}});}})[_0x4d4f('0x2c')](respondWithStatusCode(_0x584c53,null))[_0x4d4f('0x4e')](handleError(_0x584c53,null));};exports[_0x4d4f('0x7b')]=function(_0x1670fd,_0x548709,_0x18274e){var _0x3beacf={};var _0x4691b7={};var _0x1f62e0;var _0x328528;return db['VoicePrefix'][_0x4d4f('0x7c')]({'where':{'id':_0x1670fd['params']['id']}})[_0x4d4f('0x2c')](handleEntityNotFound(_0x548709,null))[_0x4d4f('0x2c')](function(_0x2511c8){if(_0x2511c8){_0x1f62e0=_0x2511c8;_0x4691b7[_0x4d4f('0x3d')]=_[_0x4d4f('0x50')](db[_0x4d4f('0x7d')][_0x4d4f('0x36')]);_0x4691b7['query']=_[_0x4d4f('0x50')](_0x1670fd[_0x4d4f('0x3b')]);_0x4691b7[_0x4d4f('0x46')]=_['intersection'](_0x4691b7[_0x4d4f('0x3d')],_0x4691b7['query']);_0x3beacf[_0x4d4f('0x3e')]=_['intersection'](_0x4691b7[_0x4d4f('0x3d')],qs[_0x4d4f('0x3f')](_0x1670fd[_0x4d4f('0x3b')]['fields']));_0x3beacf[_0x4d4f('0x3e')]=_0x3beacf[_0x4d4f('0x3e')][_0x4d4f('0x6e')]?_0x3beacf[_0x4d4f('0x3e')]:_0x4691b7['model'];_0x3beacf[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x1670fd['query'][_0x4d4f('0x44')]);_0x3beacf[_0x4d4f('0x45')]=qs[_0x4d4f('0x46')](_[_0x4d4f('0x7e')](_0x1670fd[_0x4d4f('0x3b')],_0x4691b7[_0x4d4f('0x46')]));if(_0x1670fd['query'][_0x4d4f('0x47')]){_0x3beacf[_0x4d4f('0x45')]=_['merge'](_0x3beacf[_0x4d4f('0x45')],{'$or':_[_0x4d4f('0x3a')](_0x3beacf[_0x4d4f('0x3e')],function(_0x4686b9){var _0x16d1f7={};_0x16d1f7[_0x4686b9]={'$like':'%'+_0x1670fd[_0x4d4f('0x3b')][_0x4d4f('0x47')]+'%'};return _0x16d1f7;})});}_0x3beacf=_[_0x4d4f('0x48')]({},_0x3beacf,_0x1670fd['options']);return _0x1f62e0[_0x4d4f('0x7b')](_0x3beacf);}})[_0x4d4f('0x2c')](function(_0x4dd3f6){if(_0x4dd3f6){_0x328528=_0x4dd3f6[_0x4d4f('0x6e')];if(!_0x1670fd['query'][_0x4d4f('0x40')]('nolimit')){_0x3beacf[_0x4d4f('0x26')]=qs[_0x4d4f('0x26')](_0x1670fd[_0x4d4f('0x3b')][_0x4d4f('0x26')]);_0x3beacf[_0x4d4f('0x42')]=qs[_0x4d4f('0x42')](_0x1670fd[_0x4d4f('0x3b')][_0x4d4f('0x42')]);}return _0x1f62e0[_0x4d4f('0x7b')](_0x3beacf);}})[_0x4d4f('0x2c')](function(_0x10f882){if(_0x10f882){return _0x10f882?{'count':_0x328528,'rows':_0x10f882}:null;}})[_0x4d4f('0x2c')](respondWithResult(_0x548709,null))['catch'](handleError(_0x548709,null));};exports['getTeams']=function(_0x41c81d,_0x5d6abf,_0x2208d8){var _0x2b096e={};var _0x4e6da6={};var _0x53817f;var _0x10955f;return db[_0x4d4f('0x4c')][_0x4d4f('0x7c')]({'where':{'id':_0x41c81d['params']['id']}})['then'](handleEntityNotFound(_0x5d6abf,null))[_0x4d4f('0x2c')](function(_0x274ff2){if(_0x274ff2){_0x53817f=_0x274ff2;_0x4e6da6[_0x4d4f('0x3d')]=_[_0x4d4f('0x50')](db['Team'][_0x4d4f('0x36')]);_0x4e6da6[_0x4d4f('0x3b')]=_[_0x4d4f('0x50')](_0x41c81d['query']);_0x4e6da6['filters']=_[_0x4d4f('0x3c')](_0x4e6da6[_0x4d4f('0x3d')],_0x4e6da6[_0x4d4f('0x3b')]);_0x2b096e[_0x4d4f('0x3e')]=_[_0x4d4f('0x3c')](_0x4e6da6['model'],qs[_0x4d4f('0x3f')](_0x41c81d[_0x4d4f('0x3b')][_0x4d4f('0x3f')]));_0x2b096e['attributes']=_0x2b096e[_0x4d4f('0x3e')]['length']?_0x2b096e[_0x4d4f('0x3e')]:_0x4e6da6[_0x4d4f('0x3d')];_0x2b096e[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x41c81d[_0x4d4f('0x3b')]['sort']);_0x2b096e[_0x4d4f('0x45')]=qs[_0x4d4f('0x46')](_[_0x4d4f('0x7e')](_0x41c81d[_0x4d4f('0x3b')],_0x4e6da6['filters']));if(_0x41c81d[_0x4d4f('0x3b')]['filter']){_0x2b096e['where']=_[_0x4d4f('0x48')](_0x2b096e[_0x4d4f('0x45')],{'$or':_['map'](_0x2b096e[_0x4d4f('0x3e')],function(_0x50b0a3){var _0x1177a3={};_0x1177a3[_0x50b0a3]={'$like':'%'+_0x41c81d[_0x4d4f('0x3b')][_0x4d4f('0x47')]+'%'};return _0x1177a3;})});}_0x2b096e=_[_0x4d4f('0x48')]({},_0x2b096e,_0x41c81d[_0x4d4f('0x49')]);return _0x53817f[_0x4d4f('0x7f')](_0x2b096e);}})[_0x4d4f('0x2c')](function(_0x3fe348){if(_0x3fe348){_0x10955f=_0x3fe348['length'];if(!_0x41c81d[_0x4d4f('0x3b')][_0x4d4f('0x40')]('nolimit')){_0x2b096e[_0x4d4f('0x26')]=qs['limit'](_0x41c81d[_0x4d4f('0x3b')][_0x4d4f('0x26')]);_0x2b096e[_0x4d4f('0x42')]=qs['offset'](_0x41c81d['query']['offset']);}return _0x53817f[_0x4d4f('0x7f')](_0x2b096e);}})['then'](function(_0xb5d71b){if(_0xb5d71b){return _0xb5d71b?{'count':_0x10955f,'rows':_0xb5d71b}:null;}})[_0x4d4f('0x2c')](respondWithResult(_0x5d6abf,null))[_0x4d4f('0x4e')](handleError(_0x5d6abf,null));};exports['addTeams']=function(_0x5b6061,_0x230ff0,_0x28ae80){var _0x42be25=_0x5b6061[_0x4d4f('0x56')][_0x4d4f('0x73')];var _0x13279e;return db['Team'][_0x4d4f('0x80')]({'where':{'id':_0x42be25},'attributes':['id'],'include':[{'model':db[_0x4d4f('0x7d')],'as':_0x4d4f('0x81'),'attributes':['id',_0x4d4f('0x33'),_0x4d4f('0x82'),_0x4d4f('0x83'),_0x4d4f('0x84')],'raw':!![]}]})[_0x4d4f('0x2c')](function(_0x1a1e6f){if(_0x1a1e6f){_0x13279e=_0x1a1e6f;var _0x152400=_[_0x4d4f('0x85')](_0x1a1e6f,function(_0x3c6f1b){var _0x25e63c=_0x3c6f1b[_0x4d4f('0x2e')]({'plain':!![]});return _0x25e63c['Agents'];});return db[_0x4d4f('0x4c')][_0x4d4f('0x51')]({'where':{'id':_0x5b6061[_0x4d4f('0x52')]['id']}})[_0x4d4f('0x2c')](function(_0xc01ac4){return db[_0x4d4f('0x54')][_0x4d4f('0x86')](function(_0x472938){return _0xc01ac4[_0x4d4f('0x87')](_0x42be25,{'transaction':_0x472938})['then'](function(){return BPromise[_0x4d4f('0x88')](_0x13279e,function(_0x72d583){return db[_0x4d4f('0x89')][_0x4d4f('0x8a')]({'TeamId':_0x72d583['id'],'VoicePrefixId':_0x5b6061[_0x4d4f('0x52')]['id']},{'transaction':_0x472938});});})[_0x4d4f('0x2c')](function(){return BPromise[_0x4d4f('0x88')](_0x152400,function(_0x28fd35){return db[_0x4d4f('0x8b')][_0x4d4f('0x8c')]({'where':{'UserId':_0x28fd35['id'],'VoicePrefixId':_0x5b6061['params']['id']},'transaction':_0x472938});});})['then'](function(){_0x152400[_0x4d4f('0x8d')](function(_0x8850a4){socket['emit'](_0x4d4f('0x77'),{'UserId':_0x8850a4['id'],'VoicePrefixId':_0xc01ac4['id']});});});});});}})[_0x4d4f('0x2c')](respondWithStatusCode(_0x230ff0,null))[_0x4d4f('0x4e')](handleError(_0x230ff0,null));};exports[_0x4d4f('0x8e')]=function(_0x15028c,_0x1659f6,_0x77dac1){return db[_0x4d4f('0x8f')][_0x4d4f('0x80')]({'where':{'id':_0x15028c[_0x4d4f('0x3b')][_0x4d4f('0x73')]},'attributes':['id'],'include':[{'model':db[_0x4d4f('0x7d')],'as':_0x4d4f('0x81'),'attributes':['id'],'raw':!![]}]})[_0x4d4f('0x2c')](handleEntityNotFound(_0x1659f6,null))['then'](function(_0x342b63){var _0x524ed0=_[_0x4d4f('0x3a')](_0x342b63,'id');var _0x3fd499=[];var _0x17a39f=[];var _0x27b4d6=squel['select']();_0x27b4d6[_0x4d4f('0x90')](_0x4d4f('0x91'))[_0x4d4f('0x92')](_0x4d4f('0x93'),'tq')[_0x4d4f('0x94')](_0x4d4f('0x95'),'ut',_0x4d4f('0x96'))['where'](_0x4d4f('0x97'),_0x15028c[_0x4d4f('0x52')]['id']);for(var _0x2f4bad=0x0;_0x2f4bad<_0x342b63[_0x4d4f('0x6e')];_0x2f4bad+=0x1){let _0x4501b5=_0x342b63[_0x2f4bad];for(var _0x12eda1=0x0;_0x12eda1<_0x4501b5['Agents']['length'];_0x12eda1+=0x1){let _0x11ee76=_0x4501b5['Agents'][_0x12eda1];var _0x2ea6b4=_0x27b4d6[_0x4d4f('0x98')]();_0x2ea6b4['where'](_0x4d4f('0x99'),_0x11ee76['id']);_0x17a39f[_0x4d4f('0x68')](db[_0x4d4f('0x54')][_0x4d4f('0x3b')](_0x2ea6b4[_0x4d4f('0x9a')](),{'type':db[_0x4d4f('0x54')][_0x4d4f('0x9b')]['SELECT']})[_0x4d4f('0x2c')](function(_0x5d05cb){if(_0x5d05cb[_0x4d4f('0x6e')]===0x1){return _0x11ee76['id'];}else{var _0x2d1337=_['every'](_['map'](_0x5d05cb,_0x4d4f('0x9c')),function(_0x17894c){return _[_0x4d4f('0x9d')](_0x524ed0,_0x17894c);});if(_0x2d1337){return _0x11ee76['id'];}}}));}}return BPromise['all'](_0x17a39f)[_0x4d4f('0x2c')](function(_0x118642){_0x3fd499=_(_0x3fd499)[_0x4d4f('0x9e')](_0x118642)[_0x4d4f('0x9f')]()[_0x4d4f('0xa0')]();return db[_0x4d4f('0x4c')][_0x4d4f('0x51')]({'where':{'id':_0x15028c[_0x4d4f('0x52')]['id']}})[_0x4d4f('0x2c')](function(_0x51e70f){return db[_0x4d4f('0x54')][_0x4d4f('0x86')](function(_0x23485f){return _0x51e70f[_0x4d4f('0x8e')](_0x15028c['query'][_0x4d4f('0x73')],{'transaction':_0x23485f})['then'](function(){if(!_['isEmpty'](_0x3fd499)){return _0x51e70f[_0x4d4f('0x78')](_0x3fd499,{'transaction':_0x23485f});}})[_0x4d4f('0x2c')](function(){_0x3fd499[_0x4d4f('0x8d')](function(_0x3de9b3){socket[_0x4d4f('0x76')](_0x4d4f('0x7a'),{'UserId':_0x3de9b3,'VoicePrefixId':_0x51e70f['id']});});});});});});})[_0x4d4f('0x2c')](respondWithStatusCode(_0x1659f6,null))[_0x4d4f('0x4e')](handleError(_0x1659f6,null));}; \ No newline at end of file +var _0x8952=['rawAttributes','fieldName','type','map','keys','filters','intersection','query','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','params','find','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','context','from-sip','exten','system','Voice\x20Prefix\x20Extension','prefix','Voice\x20Prefix','VoicePrefixId','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','findAll','Agents','online','interface','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','select','field','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','every','includes','all','union','compact','value','removeTeams','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','VoicePrefixes','error','stack','name','send','index','VoicePrefix'];(function(_0x4c4683,_0x241657){var _0x78ee7e=function(_0x4c9489){while(--_0x4c9489){_0x4c4683['push'](_0x4c4683['shift']());}};_0x78ee7e(++_0x241657);}(_0x8952,0x17e));var _0x2895=function(_0x2b2735,_0x2214c7){_0x2b2735=_0x2b2735-0x0;var _0x4480f3=_0x8952[_0x2b2735];return _0x4480f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];config[_0x2895('0x15')]=_['defaults'](config[_0x2895('0x15')],{'host':_0x2895('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2895('0x17'))[_0x2895('0x18')](socket);function respondWithStatusCode(_0x5777a0,_0x2198c3){_0x2198c3=_0x2198c3||0xcc;return function(_0xd8192e){if(_0xd8192e){return _0x5777a0[_0x2895('0x19')](_0x2198c3);}return _0x5777a0[_0x2895('0x1a')](_0x2198c3)[_0x2895('0x1b')]();};}function respondWithResult(_0x2627e6,_0x6a5c7e){_0x6a5c7e=_0x6a5c7e||0xc8;return function(_0x31bb7f){if(_0x31bb7f){return _0x2627e6[_0x2895('0x1a')](_0x6a5c7e)[_0x2895('0x1c')](_0x31bb7f);}};}function respondWithFilteredResult(_0x10a1bf,_0x183b05){return function(_0xbf8b63){if(_0xbf8b63){var _0x2cb505=typeof _0x183b05[_0x2895('0x1d')]===_0x2895('0x1e')&&typeof _0x183b05[_0x2895('0x1f')]===_0x2895('0x1e');var _0x5a8eab=_0xbf8b63['count'];var _0x493851=_0x2cb505?0x0:_0x183b05[_0x2895('0x1d')];var _0x12c2fb=_0x2cb505?_0xbf8b63[_0x2895('0x20')]:_0x183b05['offset']+_0x183b05[_0x2895('0x1f')];var _0x190b79;if(_0x12c2fb>=_0x5a8eab){_0x12c2fb=_0x5a8eab;_0x190b79=0xc8;}else{_0x190b79=0xce;}_0x10a1bf[_0x2895('0x1a')](_0x190b79);return _0x10a1bf[_0x2895('0x21')](_0x2895('0x22'),_0x493851+'-'+_0x12c2fb+'/'+_0x5a8eab)['json'](_0xbf8b63);}return null;};}function patchUpdates(_0x30c6c3){return function(_0x5e93a4){try{jsonpatch['apply'](_0x5e93a4,_0x30c6c3,!![]);}catch(_0x142e58){return BPromise[_0x2895('0x23')](_0x142e58);}return _0x5e93a4[_0x2895('0x24')]();};}function saveUpdates(_0x511286,_0x4e884f){return function(_0x3a72fa){if(_0x3a72fa){return _0x3a72fa[_0x2895('0x25')](_0x511286)[_0x2895('0x26')](function(_0x4a21cf){return _0x4a21cf;});}return null;};}function removeEntity(_0x3d3320,_0x3690ce){return function(_0x480604){if(_0x480604){return _0x480604[_0x2895('0x27')]()[_0x2895('0x26')](function(){var _0x2cd4df=_0x480604['get']({'plain':!![]});var _0x320661=_0x2895('0x28');return db['UserProfileResource'][_0x2895('0x27')]({'where':{'type':_0x320661,'resourceId':_0x2cd4df['id']}})['then'](function(){return _0x480604;});})['then'](function(){_0x3d3320[_0x2895('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa4f85,_0x381538){return function(_0x4fdd94){if(!_0x4fdd94){_0xfa4f85['sendStatus'](0x194);}return _0x4fdd94;};}function handleError(_0x32db49,_0x30dc2f){_0x30dc2f=_0x30dc2f||0x1f4;return function(_0x190e07){logger[_0x2895('0x29')](_0x190e07[_0x2895('0x2a')]);if(_0x190e07[_0x2895('0x2b')]){delete _0x190e07[_0x2895('0x2b')];}_0x32db49['status'](_0x30dc2f)[_0x2895('0x2c')](_0x190e07);};}exports[_0x2895('0x2d')]=function(_0x3625ba,_0x5546eb){var _0x1e9c13={},_0x458a55={},_0x31ab90={'count':0x0,'rows':[]};var _0x35a2e8=_['map'](db[_0x2895('0x2e')][_0x2895('0x2f')],function(_0x4765c9){return{'name':_0x4765c9[_0x2895('0x30')],'type':_0x4765c9[_0x2895('0x31')]['key']};});_0x458a55['model']=_[_0x2895('0x32')](_0x35a2e8,_0x2895('0x2b'));_0x458a55['query']=_[_0x2895('0x33')](_0x3625ba['query']);_0x458a55[_0x2895('0x34')]=_[_0x2895('0x35')](_0x458a55['model'],_0x458a55[_0x2895('0x36')]);_0x1e9c13['attributes']=_[_0x2895('0x35')](_0x458a55['model'],qs['fields'](_0x3625ba[_0x2895('0x36')][_0x2895('0x37')]));_0x1e9c13[_0x2895('0x38')]=_0x1e9c13['attributes'][_0x2895('0x39')]?_0x1e9c13[_0x2895('0x38')]:_0x458a55[_0x2895('0x3a')];if(!_0x3625ba[_0x2895('0x36')][_0x2895('0x3b')](_0x2895('0x3c'))){_0x1e9c13[_0x2895('0x1f')]=qs[_0x2895('0x1f')](_0x3625ba[_0x2895('0x36')][_0x2895('0x1f')]);_0x1e9c13['offset']=qs[_0x2895('0x1d')](_0x3625ba[_0x2895('0x36')][_0x2895('0x1d')]);}_0x1e9c13[_0x2895('0x3d')]=qs[_0x2895('0x3e')](_0x3625ba[_0x2895('0x36')][_0x2895('0x3e')]);_0x1e9c13['where']=qs['filters'](_[_0x2895('0x3f')](_0x3625ba[_0x2895('0x36')],_0x458a55[_0x2895('0x34')]),_0x35a2e8);if(_0x3625ba[_0x2895('0x36')][_0x2895('0x40')]){_0x1e9c13[_0x2895('0x41')]=_['merge'](_0x1e9c13['where'],{'$or':_[_0x2895('0x32')](_0x35a2e8,function(_0x20208f){if(_0x20208f['type']!=='VIRTUAL'){var _0x2a0eaf={};_0x2a0eaf[_0x20208f[_0x2895('0x2b')]]={'$like':'%'+_0x3625ba[_0x2895('0x36')][_0x2895('0x40')]+'%'};return _0x2a0eaf;}})});}_0x1e9c13=_[_0x2895('0x42')]({},_0x1e9c13,_0x3625ba[_0x2895('0x43')]);var _0x5d4e23={'where':_0x1e9c13[_0x2895('0x41')]};return db[_0x2895('0x2e')][_0x2895('0x20')](_0x5d4e23)[_0x2895('0x26')](function(_0x4af6d6){_0x31ab90[_0x2895('0x20')]=_0x4af6d6;if(_0x3625ba[_0x2895('0x36')][_0x2895('0x44')]){_0x1e9c13[_0x2895('0x45')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x1e9c13);})[_0x2895('0x26')](function(_0x19ce85){_0x31ab90[_0x2895('0x46')]=_0x19ce85;return _0x31ab90;})[_0x2895('0x26')](respondWithFilteredResult(_0x5546eb,_0x1e9c13))[_0x2895('0x47')](handleError(_0x5546eb,null));};exports['show']=function(_0x5bd425,_0x4b336c){var _0x28dd37={'raw':![],'where':{'id':_0x5bd425[_0x2895('0x48')]['id']}},_0x2130b2={};_0x2130b2[_0x2895('0x3a')]=_[_0x2895('0x33')](db[_0x2895('0x2e')]['rawAttributes']);_0x2130b2[_0x2895('0x36')]=_[_0x2895('0x33')](_0x5bd425[_0x2895('0x36')]);_0x2130b2[_0x2895('0x34')]=_[_0x2895('0x35')](_0x2130b2[_0x2895('0x3a')],_0x2130b2[_0x2895('0x36')]);_0x28dd37[_0x2895('0x38')]=_['intersection'](_0x2130b2[_0x2895('0x3a')],qs[_0x2895('0x37')](_0x5bd425[_0x2895('0x36')]['fields']));_0x28dd37[_0x2895('0x38')]=_0x28dd37[_0x2895('0x38')]['length']?_0x28dd37[_0x2895('0x38')]:_0x2130b2[_0x2895('0x3a')];if(_0x5bd425[_0x2895('0x36')][_0x2895('0x44')]){_0x28dd37[_0x2895('0x45')]=[{'all':!![]}];}_0x28dd37=_[_0x2895('0x42')]({},_0x28dd37,_0x5bd425[_0x2895('0x43')]);return db['VoicePrefix'][_0x2895('0x49')](_0x28dd37)[_0x2895('0x26')](handleEntityNotFound(_0x4b336c,null))['then'](respondWithResult(_0x4b336c,null))['catch'](handleError(_0x4b336c,null));};exports['destroy']=function(_0x212a1f,_0xe552b6){return db[_0x2895('0x2e')][_0x2895('0x49')]({'where':{'id':_0x212a1f[_0x2895('0x48')]['id']}})[_0x2895('0x26')](handleEntityNotFound(_0xe552b6,null))[_0x2895('0x26')](removeEntity(_0xe552b6,null))[_0x2895('0x47')](handleError(_0xe552b6,null));};exports[_0x2895('0x4a')]=function(_0x3d043c,_0x45302c){return db[_0x2895('0x2e')][_0x2895('0x4a')]()[_0x2895('0x26')](respondWithResult(_0x45302c,null))[_0x2895('0x47')](handleError(_0x45302c,null));};exports[_0x2895('0x4b')]=function(_0x2116a6,_0x3e0fde){var _0xbcf98;return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x90ed5d){return db[_0x2895('0x2e')][_0x2895('0x4b')](_0x2116a6[_0x2895('0x4e')],{'transaction':_0x90ed5d})[_0x2895('0x26')](function(_0x16ff3d){_0xbcf98=_0x16ff3d[_0x2895('0x4f')]({'plain':!![]});return db[_0x2895('0x50')][_0x2895('0x49')]({'where':{'id':_0xbcf98[_0x2895('0x51')]},'raw':!![]})['then'](function(_0xbc538a){return createVoicePrefixExtensions(_0xbcf98,_0xbc538a,_0x90ed5d);});});})[_0x2895('0x26')](function(){var _0x2bc573=_0x2116a6[_0x2895('0x52')][_0x2895('0x4f')]({'plain':!![]});if(!_0x2bc573)throw new Error(_0x2895('0x53'));if(_0x2bc573['role']===_0x2895('0x52')){var _0x5579b3=_0xbcf98;return db[_0x2895('0x54')][_0x2895('0x49')]({'where':{'name':_0x2895('0x28'),'userProfileId':_0x2bc573[_0x2895('0x55')]},'raw':!![]})[_0x2895('0x26')](function(_0x56a2c0){if(_0x56a2c0&&_0x56a2c0['autoAssociation']===0x0){return db[_0x2895('0x56')][_0x2895('0x4b')]({'name':_0x5579b3[_0x2895('0x2b')],'resourceId':_0x5579b3['id'],'type':_0x56a2c0['name'],'sectionId':_0x56a2c0['id']},{})[_0x2895('0x26')](function(){return _0xbcf98;});}else{return _0xbcf98;}})['catch'](function(_0x3c1f50){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c1f50);throw _0x3c1f50;});}return _0xbcf98;})['then'](respondWithResult(_0x3e0fde,null))['catch'](handleError(_0x3e0fde,null));};function Extension(_0x36177d,_0x2ff725,_0x402e00,_0x4336c){this[_0x2895('0x57')]=_0x2895('0x58');this[_0x2895('0x59')]=_0x36177d;this['app']=_0x402e00;this[_0x2895('0x31')]=_0x2895('0x5a');this['description']=_0x2895('0x5b');this['priority']=_0x2ff725;this['appdata']=_0x4336c;}function createVoicePrefixExtensions(_0x2a9194,_0x14d7f9,_0x50299a){return new BPromise(function(_0xf5be,_0x3c5e32){var _0x35d979=new Extension(formatPrefixName(_0x2a9194[_0x2895('0x5c')]),0x1,'NoOp',_0x2895('0x5d'));_0x35d979['VoicePrefixId']=_0x2a9194['id'];return db[_0x2895('0x50')]['create'](_0x35d979,{'transaction':_0x50299a})['then'](function(_0x1af031){var _0x58f96a=_0x1af031[_0x2895('0x4f')]({'plain':!![]});var _0x39a28b=_[_0x2895('0x32')](addVoicePrefixExtensions(_0x2a9194,_0x14d7f9),function(_0x559ef3){_0x559ef3[_0x2895('0x51')]=_0x58f96a['id'];_0x559ef3[_0x2895('0x5e')]=_0x2a9194['id'];return _0x559ef3;});return db['VoiceExtension']['bulkCreate'](_0x39a28b,{'transaction':_0x50299a})[_0x2895('0x26')](function(_0x347445){if(!_0x347445){return _0x3c5e32('Extensions\x20creation\x20failed');}else{return _0xf5be(_0x347445);}})[_0x2895('0x47')](function(_0x53f9d8){return _0x3c5e32(_0x53f9d8);});});;});};function addVoicePrefixExtensions(_0x567520,_0x98b64d){var _0x3241cb=[];var _0x16b39c=formatPrefixName(_0x567520['prefix']);_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x2,_0x2895('0x60'),_0x2895('0x61')+_0x567520[_0x2895('0x2b')]));if(_0x567520[_0x2895('0x62')]){_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x3,_0x2895('0x60'),'PREFIX-CALLERIDALL='+_0x567520[_0x2895('0x62')]));}else{_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x3,_0x2895('0x63'),_0x2895('0x64')));}_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x4,_0x2895('0x65'),_0x98b64d[_0x2895('0x57')]+','+_0x2895('0x66')+(0x8+_0x567520['name'][_0x2895('0x39')])+'}'+','+0x1));return _0x3241cb;}function formatPrefixName(_0x354718){var _0x16f369='_';for(var _0x2288ff=0x0;_0x2288ff<_0x354718[_0x2895('0x39')];_0x2288ff++){if(_0x354718[_0x2895('0x67')](_0x2288ff)=='-'){_0x16f369+=_0x354718[_0x2895('0x67')](_0x2288ff);}else{_0x16f369+='['+_0x354718[_0x2895('0x67')](_0x2288ff)+']';}}_0x16f369+='.';return _0x16f369;}exports[_0x2895('0x25')]=function(_0x2862aa,_0x53a270,_0x477385){var _0x1a2045=_0x2862aa[_0x2895('0x4e')];_0x1a2045[_0x2895('0x5c')]=_0x2895('0x68')+_0x1a2045[_0x2895('0x2b')]+'-';return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x203609){return db[_0x2895('0x2e')]['update'](_0x1a2045,{'where':{'id':_0x1a2045['id']},'transaction':_0x203609})[_0x2895('0x26')](function(){return db[_0x2895('0x50')][_0x2895('0x27')]({'where':{'VoicePrefixId':_0x1a2045['id']},'transaction':_0x203609})[_0x2895('0x26')](function(){return db[_0x2895('0x50')]['find']({'where':{'id':_0x1a2045[_0x2895('0x51')]},'raw':!![]})[_0x2895('0x26')](function(_0x4c569e){return createVoicePrefixExtensions(_0x1a2045,_0x4c569e,_0x203609);});});});})['then'](function(){return db['VoicePrefix'][_0x2895('0x69')](_0x1a2045['id']);})[_0x2895('0x26')](respondWithResult(_0x53a270,null))[_0x2895('0x47')](handleError(_0x53a270,null));};exports[_0x2895('0x6a')]=function(_0x31e21a,_0x48c014,_0x5e6a1f){return db[_0x2895('0x2e')]['find']({'where':{'id':_0x31e21a[_0x2895('0x48')]['id']}})['then'](handleEntityNotFound(_0x48c014,null))[_0x2895('0x26')](function(_0x3de634){if(_0x3de634){return _0x3de634['addAgents'](_0x31e21a[_0x2895('0x4e')][_0x2895('0x6b')],_[_0x2895('0x6c')](_0x31e21a[_0x2895('0x4e')],['ids','id'])||{})['spread'](function(_0x10ca0f){for(var _0x5dde20=0x0;_0x5dde20<_0x31e21a['body'][_0x2895('0x6b')][_0x2895('0x39')];_0x5dde20+=0x1){socket[_0x2895('0x6d')](_0x2895('0x6e'),{'UserId':Number(_0x31e21a['body'][_0x2895('0x6b')][_0x5dde20]),'VoicePrefixId':Number(_0x31e21a[_0x2895('0x48')]['id'])});}return _0x10ca0f;});}})[_0x2895('0x26')](respondWithResult(_0x48c014,null))[_0x2895('0x47')](handleError(_0x48c014,null));};exports[_0x2895('0x6f')]=function(_0x45e80c,_0x21d3dd,_0x3346c2){return db[_0x2895('0x2e')][_0x2895('0x49')]({'where':{'id':_0x45e80c[_0x2895('0x48')]['id']}})[_0x2895('0x26')](handleEntityNotFound(_0x21d3dd,null))['then'](function(_0x1a9c84){if(_0x1a9c84){return _0x1a9c84[_0x2895('0x6f')](_0x45e80c[_0x2895('0x36')]['ids'])[_0x2895('0x26')](function(){if(_[_0x2895('0x70')](_0x45e80c['query'][_0x2895('0x6b')])){for(var _0x1693b6=0x0;_0x1693b6<_0x45e80c[_0x2895('0x36')]['ids'][_0x2895('0x39')];_0x1693b6+=0x1){socket[_0x2895('0x6d')](_0x2895('0x71'),{'UserId':Number(_0x45e80c[_0x2895('0x36')]['ids'][_0x1693b6]),'VoicePrefixId':Number(_0x45e80c[_0x2895('0x48')]['id'])});}}else{socket[_0x2895('0x6d')](_0x2895('0x71'),{'UserId':Number(_0x45e80c['query'][_0x2895('0x6b')]),'VoicePrefixId':Number(_0x45e80c['params']['id'])});}});}})[_0x2895('0x26')](respondWithStatusCode(_0x21d3dd,null))[_0x2895('0x47')](handleError(_0x21d3dd,null));};exports[_0x2895('0x72')]=function(_0x253e07,_0x570dd9,_0x6eef86){var _0x46bbca={};var _0x413aa4={};var _0x5e892a;var _0x34898e;return db['VoicePrefix'][_0x2895('0x73')]({'where':{'id':_0x253e07[_0x2895('0x48')]['id']}})['then'](handleEntityNotFound(_0x570dd9,null))['then'](function(_0x3bd07c){if(_0x3bd07c){_0x5e892a=_0x3bd07c;_0x413aa4[_0x2895('0x3a')]=_['keys'](db[_0x2895('0x74')][_0x2895('0x2f')]);_0x413aa4['query']=_[_0x2895('0x33')](_0x253e07[_0x2895('0x36')]);_0x413aa4[_0x2895('0x34')]=_[_0x2895('0x35')](_0x413aa4[_0x2895('0x3a')],_0x413aa4['query']);_0x46bbca[_0x2895('0x38')]=_[_0x2895('0x35')](_0x413aa4[_0x2895('0x3a')],qs[_0x2895('0x37')](_0x253e07[_0x2895('0x36')]['fields']));_0x46bbca[_0x2895('0x38')]=_0x46bbca[_0x2895('0x38')][_0x2895('0x39')]?_0x46bbca[_0x2895('0x38')]:_0x413aa4['model'];_0x46bbca[_0x2895('0x3d')]=qs[_0x2895('0x3e')](_0x253e07[_0x2895('0x36')][_0x2895('0x3e')]);_0x46bbca['where']=qs[_0x2895('0x34')](_[_0x2895('0x3f')](_0x253e07[_0x2895('0x36')],_0x413aa4[_0x2895('0x34')]));if(_0x253e07[_0x2895('0x36')][_0x2895('0x40')]){_0x46bbca['where']=_[_0x2895('0x42')](_0x46bbca[_0x2895('0x41')],{'$or':_[_0x2895('0x32')](_0x46bbca['attributes'],function(_0x553af0){var _0x1ff21e={};_0x1ff21e[_0x553af0]={'$like':'%'+_0x253e07[_0x2895('0x36')][_0x2895('0x40')]+'%'};return _0x1ff21e;})});}_0x46bbca=_[_0x2895('0x42')]({},_0x46bbca,_0x253e07[_0x2895('0x43')]);return _0x5e892a['getAgents'](_0x46bbca);}})[_0x2895('0x26')](function(_0x837eef){if(_0x837eef){_0x34898e=_0x837eef[_0x2895('0x39')];if(!_0x253e07['query']['hasOwnProperty'](_0x2895('0x3c'))){_0x46bbca[_0x2895('0x1f')]=qs[_0x2895('0x1f')](_0x253e07['query'][_0x2895('0x1f')]);_0x46bbca[_0x2895('0x1d')]=qs[_0x2895('0x1d')](_0x253e07[_0x2895('0x36')]['offset']);}return _0x5e892a[_0x2895('0x72')](_0x46bbca);}})[_0x2895('0x26')](function(_0x71d436){if(_0x71d436){return _0x71d436?{'count':_0x34898e,'rows':_0x71d436}:null;}})[_0x2895('0x26')](respondWithResult(_0x570dd9,null))[_0x2895('0x47')](handleError(_0x570dd9,null));};exports[_0x2895('0x75')]=function(_0x3ae81f,_0x25f5c9,_0x2d6167){var _0x265c7a={};var _0x32baef={};var _0x3d2996;var _0x3d47d0;return db[_0x2895('0x2e')]['findOne']({'where':{'id':_0x3ae81f['params']['id']}})['then'](handleEntityNotFound(_0x25f5c9,null))['then'](function(_0x440fbf){if(_0x440fbf){_0x3d2996=_0x440fbf;_0x32baef[_0x2895('0x3a')]=_[_0x2895('0x33')](db[_0x2895('0x76')][_0x2895('0x2f')]);_0x32baef[_0x2895('0x36')]=_[_0x2895('0x33')](_0x3ae81f[_0x2895('0x36')]);_0x32baef[_0x2895('0x34')]=_[_0x2895('0x35')](_0x32baef[_0x2895('0x3a')],_0x32baef[_0x2895('0x36')]);_0x265c7a[_0x2895('0x38')]=_[_0x2895('0x35')](_0x32baef['model'],qs[_0x2895('0x37')](_0x3ae81f[_0x2895('0x36')][_0x2895('0x37')]));_0x265c7a['attributes']=_0x265c7a['attributes'][_0x2895('0x39')]?_0x265c7a[_0x2895('0x38')]:_0x32baef['model'];_0x265c7a[_0x2895('0x3d')]=qs['sort'](_0x3ae81f[_0x2895('0x36')][_0x2895('0x3e')]);_0x265c7a[_0x2895('0x41')]=qs[_0x2895('0x34')](_[_0x2895('0x3f')](_0x3ae81f[_0x2895('0x36')],_0x32baef[_0x2895('0x34')]));if(_0x3ae81f['query'][_0x2895('0x40')]){_0x265c7a[_0x2895('0x41')]=_['merge'](_0x265c7a[_0x2895('0x41')],{'$or':_[_0x2895('0x32')](_0x265c7a['attributes'],function(_0x1cf787){var _0x3c8ea2={};_0x3c8ea2[_0x1cf787]={'$like':'%'+_0x3ae81f[_0x2895('0x36')][_0x2895('0x40')]+'%'};return _0x3c8ea2;})});}_0x265c7a=_[_0x2895('0x42')]({},_0x265c7a,_0x3ae81f[_0x2895('0x43')]);return _0x3d2996[_0x2895('0x75')](_0x265c7a);}})[_0x2895('0x26')](function(_0xdbd16a){if(_0xdbd16a){_0x3d47d0=_0xdbd16a[_0x2895('0x39')];if(!_0x3ae81f[_0x2895('0x36')][_0x2895('0x3b')](_0x2895('0x3c'))){_0x265c7a[_0x2895('0x1f')]=qs['limit'](_0x3ae81f[_0x2895('0x36')][_0x2895('0x1f')]);_0x265c7a[_0x2895('0x1d')]=qs[_0x2895('0x1d')](_0x3ae81f[_0x2895('0x36')][_0x2895('0x1d')]);}return _0x3d2996[_0x2895('0x75')](_0x265c7a);}})['then'](function(_0x17055a){if(_0x17055a){return _0x17055a?{'count':_0x3d47d0,'rows':_0x17055a}:null;}})['then'](respondWithResult(_0x25f5c9,null))[_0x2895('0x47')](handleError(_0x25f5c9,null));};exports['addTeams']=function(_0x204af3,_0x3e2994,_0x1e85d9){var _0x53ccff=_0x204af3[_0x2895('0x4e')]['ids'];var _0x3f024f;return db[_0x2895('0x76')][_0x2895('0x77')]({'where':{'id':_0x53ccff},'attributes':['id'],'include':[{'model':db[_0x2895('0x74')],'as':_0x2895('0x78'),'attributes':['id',_0x2895('0x2b'),_0x2895('0x79'),'voicePause',_0x2895('0x7a')],'raw':!![]}]})[_0x2895('0x26')](function(_0x1b8f32){if(_0x1b8f32){_0x3f024f=_0x1b8f32;var _0x4b7c11=_['flatMap'](_0x1b8f32,function(_0x335da0){var _0x13e113=_0x335da0[_0x2895('0x4f')]({'plain':!![]});return _0x13e113['Agents'];});return db[_0x2895('0x2e')][_0x2895('0x49')]({'where':{'id':_0x204af3[_0x2895('0x48')]['id']}})[_0x2895('0x26')](function(_0x1dcc85){return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x2d6109){return _0x1dcc85[_0x2895('0x7b')](_0x53ccff,{'transaction':_0x2d6109})[_0x2895('0x26')](function(){return BPromise[_0x2895('0x7c')](_0x3f024f,function(_0x16ec29){return db[_0x2895('0x7d')][_0x2895('0x7e')]({'TeamId':_0x16ec29['id'],'VoicePrefixId':_0x204af3[_0x2895('0x48')]['id']},{'transaction':_0x2d6109});});})[_0x2895('0x26')](function(){return BPromise[_0x2895('0x7c')](_0x4b7c11,function(_0x2c6df4){return db[_0x2895('0x7f')]['findOrCreate']({'where':{'UserId':_0x2c6df4['id'],'VoicePrefixId':_0x204af3['params']['id']},'transaction':_0x2d6109});});})[_0x2895('0x26')](function(){_0x4b7c11[_0x2895('0x80')](function(_0x366ca5){socket[_0x2895('0x6d')](_0x2895('0x6e'),{'UserId':_0x366ca5['id'],'VoicePrefixId':_0x1dcc85['id']});});});});});}})[_0x2895('0x26')](respondWithStatusCode(_0x3e2994,null))['catch'](handleError(_0x3e2994,null));};exports['removeTeams']=function(_0x51b96a,_0x40d48c,_0x4f0b85){return db[_0x2895('0x76')][_0x2895('0x77')]({'where':{'id':_0x51b96a[_0x2895('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2895('0x74')],'as':_0x2895('0x78'),'attributes':['id'],'raw':!![]}]})[_0x2895('0x26')](handleEntityNotFound(_0x40d48c,null))['then'](function(_0x340cb7){var _0x2458f1=_[_0x2895('0x32')](_0x340cb7,'id');var _0x2e3651=[];var _0x2187ce=[];var _0x175202=squel[_0x2895('0x81')]();_0x175202[_0x2895('0x82')]('tq.TeamId')[_0x2895('0x83')](_0x2895('0x84'),'tq')[_0x2895('0x85')](_0x2895('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2895('0x87'),_0x51b96a[_0x2895('0x48')]['id']);for(var _0x53eef2=0x0;_0x53eef2<_0x340cb7[_0x2895('0x39')];_0x53eef2+=0x1){let _0x1e2311=_0x340cb7[_0x53eef2];for(var _0x368a30=0x0;_0x368a30<_0x1e2311['Agents'][_0x2895('0x39')];_0x368a30+=0x1){let _0x2dd3d9=_0x1e2311[_0x2895('0x78')][_0x368a30];var _0x233136=_0x175202['clone']();_0x233136[_0x2895('0x41')]('ut.UserId\x20=\x20?',_0x2dd3d9['id']);_0x2187ce['push'](db['sequelize'][_0x2895('0x36')](_0x233136['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x2bbb3e){if(_0x2bbb3e[_0x2895('0x39')]===0x1){return _0x2dd3d9['id'];}else{var _0x25969b=_[_0x2895('0x88')](_['map'](_0x2bbb3e,'TeamId'),function(_0x5cc9fc){return _[_0x2895('0x89')](_0x2458f1,_0x5cc9fc);});if(_0x25969b){return _0x2dd3d9['id'];}}}));}}return BPromise[_0x2895('0x8a')](_0x2187ce)[_0x2895('0x26')](function(_0x2ccc9f){_0x2e3651=_(_0x2e3651)[_0x2895('0x8b')](_0x2ccc9f)[_0x2895('0x8c')]()[_0x2895('0x8d')]();return db[_0x2895('0x2e')]['find']({'where':{'id':_0x51b96a[_0x2895('0x48')]['id']}})[_0x2895('0x26')](function(_0x16f74a){return db['sequelize'][_0x2895('0x4d')](function(_0x5d05d3){return _0x16f74a[_0x2895('0x8e')](_0x51b96a[_0x2895('0x36')][_0x2895('0x6b')],{'transaction':_0x5d05d3})[_0x2895('0x26')](function(){if(!_['isEmpty'](_0x2e3651)){return _0x16f74a[_0x2895('0x6f')](_0x2e3651,{'transaction':_0x5d05d3});}})[_0x2895('0x26')](function(){_0x2e3651[_0x2895('0x80')](function(_0x3fb18a){socket[_0x2895('0x6d')]('userVoicePrefix:remove',{'UserId':_0x3fb18a,'VoicePrefixId':_0x16f74a['id']});});});});});});})[_0x2895('0x26')](respondWithStatusCode(_0x40d48c,null))[_0x2895('0x47')](handleError(_0x40d48c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index a025dbe..ea3ba41 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 _0xb335=['events','../../mysqldb','VoicePrefix','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x3a825d,_0x10734e){var _0x6214b=function(_0x21f65c){while(--_0x21f65c){_0x3a825d['push'](_0x3a825d['shift']());}};_0x6214b(++_0x10734e);}(_0xb335,0x99));var _0x5b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb335[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5b33('0x0'));var VoicePrefix=require(_0x5b33('0x1'))['db'][_0x5b33('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x5b33('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b33('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4760ff){return function(_0x56702a,_0x17ec52,_0x134b8d){VoicePrefixEvents[_0x5b33('0x5')](_0x4760ff+':'+_0x56702a['id'],_0x56702a);VoicePrefixEvents['emit'](_0x4760ff,_0x56702a);_0x134b8d(null);};}for(var e in events){if(events[_0x5b33('0x6')](e)){var event=events[e];VoicePrefix[_0x5b33('0x7')](e,emitEvent(event));}}module[_0x5b33('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x4721=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x5300b9,_0x575bca){var _0x21ca78=function(_0x30e452){while(--_0x30e452){_0x5300b9['push'](_0x5300b9['shift']());}};_0x21ca78(++_0x575bca);}(_0x4721,0xf7));var _0x1472=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x4721[_0x2cd1fb];return _0x48fd2b;};'use strict';var EventEmitter=require(_0x1472('0x0'));var VoicePrefix=require(_0x1472('0x1'))['db'][_0x1472('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1472('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1472('0x4'),'afterDestroy':_0x1472('0x5')};function emitEvent(_0x572f4c){return function(_0x19bf63,_0x40c856,_0xa9444f){VoicePrefixEvents[_0x1472('0x6')](_0x572f4c+':'+_0x19bf63['id'],_0x19bf63);VoicePrefixEvents[_0x1472('0x6')](_0x572f4c,_0x19bf63);_0xa9444f(null);};}for(var e in events){if(events[_0x1472('0x7')](e)){var event=events[e];VoicePrefix[_0x1472('0x8')](e,emitEvent(event));}}module[_0x1472('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d6cf9aa..fcfc21b 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 _0xd7a4=['bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api'];(function(_0x25dd0b,_0xe3f968){var _0x110177=function(_0x165810){while(--_0x165810){_0x25dd0b['push'](_0x25dd0b['shift']());}};_0x110177(++_0xe3f968);}(_0xd7a4,0x101));var _0x4d7a=function(_0x5ce767,_0x592a43){_0x5ce767=_0x5ce767-0x0;var _0x398665=_0xd7a4[_0x5ce767];return _0x398665;};'use strict';var _=require(_0x4d7a('0x0'));var util=require(_0x4d7a('0x1'));var logger=require('../../config/logger')(_0x4d7a('0x2'));var moment=require('moment');var BPromise=require(_0x4d7a('0x3'));var rp=require(_0x4d7a('0x4'));var fs=require('fs');var path=require(_0x4d7a('0x5'));var rimraf=require(_0x4d7a('0x6'));var config=require(_0x4d7a('0x7'));var attributes=require(_0x4d7a('0x8'));module[_0x4d7a('0x9')]=function(_0x354374,_0x53375e){return _0x354374[_0x4d7a('0xa')](_0x4d7a('0xb'),attributes,{'tableName':_0x4d7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dfb=['VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x5b7a22,_0x400d85){var _0x1c58d4=function(_0x3a09e1){while(--_0x3a09e1){_0x5b7a22['push'](_0x5b7a22['shift']());}};_0x1c58d4(++_0x400d85);}(_0x0dfb,0xf0));var _0xb0df=function(_0x39f28f,_0x14b7e9){_0x39f28f=_0x39f28f-0x0;var _0x390dbf=_0x0dfb[_0x39f28f];return _0x390dbf;};'use strict';var _=require('lodash');var util=require(_0xb0df('0x0'));var logger=require(_0xb0df('0x1'))(_0xb0df('0x2'));var moment=require(_0xb0df('0x3'));var BPromise=require(_0xb0df('0x4'));var rp=require(_0xb0df('0x5'));var fs=require('fs');var path=require(_0xb0df('0x6'));var rimraf=require(_0xb0df('0x7'));var config=require(_0xb0df('0x8'));var attributes=require(_0xb0df('0x9'));module[_0xb0df('0xa')]=function(_0x2f6671,_0x43407b){return _0x2f6671[_0xb0df('0xb')](_0xb0df('0xc'),attributes,{'tableName':_0xb0df('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 7634212..4d05b51 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 _0x8aad=['socket.io-emitter','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','redis','localhost'];(function(_0x45b8be,_0x5e17e0){var _0x510327=function(_0x1ef616){while(--_0x1ef616){_0x45b8be['push'](_0x45b8be['shift']());}};_0x510327(++_0x5e17e0);}(_0x8aad,0x146));var _0xd8aa=function(_0x5714ac,_0xf99d53){_0x5714ac=_0x5714ac-0x0;var _0x59902e=_0x8aad[_0x5714ac];return _0x59902e;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});config[_0xd8aa('0x8')]=_['defaults'](config[_0xd8aa('0x8')],{'host':_0xd8aa('0x9'),'port':0x18eb});var socket=require(_0xd8aa('0xa'))(new Redis(config[_0xd8aa('0x8')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x24f3f1,_0x1d4cf6,_0x152c0a){return new BPromise(function(_0x228fda,_0x2c7edb){return client['request'](_0x24f3f1,_0x152c0a)[_0xd8aa('0xb')](function(_0x1619c6){logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x1d4cf6,_0xd8aa('0xe'));logger[_0xd8aa('0xf')](_0xd8aa('0x10'),_0x1d4cf6,_0xd8aa('0xe'),JSON[_0xd8aa('0x11')](_0x1619c6));if(_0x1619c6[_0xd8aa('0x12')]){if(_0x1619c6['error']['code']===0x1f4){logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x1619c6[_0xd8aa('0x12')]['message']);return _0x2c7edb(_0x1619c6[_0xd8aa('0x12')][_0xd8aa('0x13')]);}logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x1619c6['error'][_0xd8aa('0x13')]);return _0x228fda(_0x1619c6[_0xd8aa('0x12')]['message']);}else{logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x1d4cf6,_0xd8aa('0xe'));_0x228fda(_0x1619c6[_0xd8aa('0x14')][_0xd8aa('0x13')]);}})['catch'](function(_0x43d3fa){logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x43d3fa);_0x2c7edb(_0x43d3fa);});});} \ No newline at end of file +var _0x82c4=['then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request'];(function(_0x2739ec,_0x561b17){var _0x3c487c=function(_0x50a7c1){while(--_0x50a7c1){_0x2739ec['push'](_0x2739ec['shift']());}};_0x3c487c(++_0x561b17);}(_0x82c4,0x1ca));var _0x482c=function(_0xa1e030,_0x579969){_0xa1e030=_0xa1e030-0x0;var _0x1619bb=_0x82c4[_0xa1e030];return _0x1619bb;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});config[_0x482c('0xa')]=_[_0x482c('0xb')](config[_0x482c('0xa')],{'host':_0x482c('0xc'),'port':0x18eb});var socket=require(_0x482c('0xd'))(new Redis(config['redis']));require(_0x482c('0xe'))[_0x482c('0xf')](socket);function respondWithRpcPromise(_0x3859ad,_0xc59d41,_0x3c6c56){return new BPromise(function(_0x17e233,_0x51967f){return client[_0x482c('0x10')](_0x3859ad,_0x3c6c56)[_0x482c('0x11')](function(_0x1ed3ff){logger['info'](_0x482c('0x12'),_0xc59d41,_0x482c('0x13'));logger[_0x482c('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0xc59d41,'request\x20sent',JSON[_0x482c('0x15')](_0x1ed3ff));if(_0x1ed3ff[_0x482c('0x16')]){if(_0x1ed3ff['error']['code']===0x1f4){logger[_0x482c('0x16')](_0x482c('0x12'),_0xc59d41,_0x1ed3ff[_0x482c('0x16')][_0x482c('0x17')]);return _0x51967f(_0x1ed3ff[_0x482c('0x16')][_0x482c('0x17')]);}logger[_0x482c('0x16')](_0x482c('0x12'),_0xc59d41,_0x1ed3ff[_0x482c('0x16')][_0x482c('0x17')]);return _0x17e233(_0x1ed3ff[_0x482c('0x16')][_0x482c('0x17')]);}else{logger['info'](_0x482c('0x12'),_0xc59d41,'request\x20sent');_0x17e233(_0x1ed3ff[_0x482c('0x18')][_0x482c('0x17')]);}})['catch'](function(_0x4bd270){logger[_0x482c('0x16')]('VoicePrefix,\x20%s,\x20%s',_0xc59d41,_0x4bd270);_0x51967f(_0x4bd270);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7fcbad5..332ace5 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 _0xeebe=['register','length','voicePrefix:','./voicePrefix.events','remove','emit','removeListener'];(function(_0xd6fc2c,_0x4a415c){var _0x1531e0=function(_0x24fd15){while(--_0x24fd15){_0xd6fc2c['push'](_0xd6fc2c['shift']());}};_0x1531e0(++_0x4a415c);}(_0xeebe,0xff));var _0xeeeb=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xeebe[_0x2ec461];return _0x28603d;};'use strict';var VoicePrefixEvents=require(_0xeeeb('0x0'));var events=['save',_0xeeeb('0x1'),'update'];function createListener(_0x2794b0,_0x1a1a35){return function(_0xb434b3){_0x1a1a35[_0xeeeb('0x2')](_0x2794b0,_0xb434b3);};}function removeListener(_0x147b13,_0x33801b){return function(){VoicePrefixEvents[_0xeeeb('0x3')](_0x147b13,_0x33801b);};}exports[_0xeeeb('0x4')]=function(_0x2b23eb){for(var _0x39573a=0x0,_0x46c645=events[_0xeeeb('0x5')];_0x39573a<_0x46c645;_0x39573a++){var _0x41847e=events[_0x39573a];var _0x1f88ea=createListener(_0xeeeb('0x6')+_0x41847e,_0x2b23eb);VoicePrefixEvents['on'](_0x41847e,_0x1f88ea);}}; \ No newline at end of file +var _0x261b=['voicePrefix:','./voicePrefix.events','save','removeListener','length'];(function(_0x169931,_0x186821){var _0x25d8a7=function(_0xf86a5e){while(--_0xf86a5e){_0x169931['push'](_0x169931['shift']());}};_0x25d8a7(++_0x186821);}(_0x261b,0x15a));var _0xb261=function(_0x44036c,_0xc34294){_0x44036c=_0x44036c-0x0;var _0x1056fe=_0x261b[_0x44036c];return _0x1056fe;};'use strict';var VoicePrefixEvents=require(_0xb261('0x0'));var events=[_0xb261('0x1'),'remove','update'];function createListener(_0x5d9cfe,_0x48c7f0){return function(_0x392d5c){_0x48c7f0['emit'](_0x5d9cfe,_0x392d5c);};}function removeListener(_0x30540c,_0x589255){return function(){VoicePrefixEvents[_0xb261('0x2')](_0x30540c,_0x589255);};}exports['register']=function(_0x10f7ba){for(var _0xaf0725=0x0,_0x1264c8=events[_0xb261('0x3')];_0xaf0725<_0x1264c8;_0xaf0725++){var _0x5740e1=events[_0xaf0725];var _0x756381=createListener(_0xb261('0x4')+_0x5740e1,_0x10f7ba);VoicePrefixEvents['on'](_0x5740e1,_0x756381);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 2ff63aa..c41c454 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(_0x17976c,_0x1e7a52){var _0xf83a5e=function(_0x4efbae){while(--_0x4efbae){_0x17976c['push'](_0x17976c['shift']());}};_0xf83a5e(++_0x1e7a52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x4def54,_0x36de1d){var _0x137bee=function(_0x1dd6f4){while(--_0x1dd6f4){_0x4def54['push'](_0x4def54['shift']());}};_0x137bee(++_0x36de1d);}(_0xb10b,0x12a));var _0xbb10=function(_0x123623,_0x9694e2){_0x123623=_0x123623-0x0;var _0x3b00d1=_0xb10b[_0x123623];return _0x3b00d1;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0665fc1..28ddceb 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 _0x4688=['agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','STRING','name','inbound','outbound','default','ENUM','ringall','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','strategy','type','getDataValue','dialMethod','booked','roundrobin','includes','INTEGER','yes','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x4688,0x163));var _0x8468=function(_0x44e4e1,_0x5637b2){_0x44e4e1=_0x44e4e1-0x0;var _0x300cd2=_0x4688[_0x44e4e1];return _0x300cd2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8468('0x0')],'allowNull':![],'unique':_0x8468('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x8468('0x2'),_0x8468('0x3')),'allowNull':![],'defaultValue':_0x8468('0x2')},'musiconhold':{'type':Sequelize[_0x8468('0x0')],'defaultValue':_0x8468('0x4')},'announce':{'type':Sequelize[_0x8468('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8468('0x5')]('rr',_0x8468('0x6'),'leastrecent',_0x8468('0x7'),_0x8468('0x8'),_0x8468('0x9'),_0x8468('0xa'),_0x8468('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x8468('0x6'),'set':function(_0x564864){this[_0x8468('0xc')](_0x8468('0xd'),_0x564864?_0x564864:'rrmemory');},'get':function(){var _0xf1ba50=this['getDataValue'](_0x8468('0xe'));var _0x410e89=this[_0x8468('0xf')](_0x8468('0x10'));var _0x310daa=this[_0x8468('0xf')](_0x8468('0xd'));if(_0xf1ba50===_0x8468('0x3')){if(_0x410e89==='preview'){return null;}if(_0x410e89===_0x8468('0x11')&&![_0x8468('0x9'),_0x8468('0x12')][_0x8468('0x13')](_0x310daa)){this['setDataValue'](_0x8468('0xd'),_0x8468('0x9'));}}return _0x310daa;}},'servicelevel':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8468('0x14')](0xb)},'timeout':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8468('0x0')]},'weight':{'type':Sequelize[_0x8468('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x8468('0x15'),'no'),'defaultValue':_0x8468('0x15')},'autopause':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8468('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8468('0x5')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8468('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x8468('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x8468('0x15'),'no'),'defaultValue':_0x8468('0x15')},'announce_holdtime':{'type':Sequelize[_0x8468('0x5')]('yes','no',_0x8468('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x8468('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x8468('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8468('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8468('0x0')]},'queue_youarenext':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8468('0x0')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8468('0x0')]},'queue_quantity1':{'type':Sequelize[_0x8468('0x0')]},'queue_quantity2':{'type':Sequelize[_0x8468('0x0')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x8468('0x17')],'set':function(_0x2976d8){this['setDataValue']('periodic_announce',_0x2976d8?_0x2976d8['join'](','):[]);},'get':function(){return this[_0x8468('0xf')](_0x8468('0x18'))?this[_0x8468('0xf')](_0x8468('0x18'))[_0x8468('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x8468('0x0')],'defaultValue':_0x8468('0x15'),'set':function(_0xeb04b){this[_0x8468('0xc')](_0x8468('0x1a'),_0xeb04b?_0xeb04b[_0x8468('0x1b')](','):undefined);},'get':function(){return this[_0x8468('0xf')](_0x8468('0x1a'))?this[_0x8468('0xf')](_0x8468('0x1a'))[_0x8468('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8468('0x0')],'defaultValue':'no','set':function(_0x3e2968){this[_0x8468('0xc')](_0x8468('0x1c'),_0x3e2968?_0x3e2968[_0x8468('0x1b')](','):undefined);},'get':function(){return this[_0x8468('0xf')](_0x8468('0x1c'))?this[_0x8468('0xf')](_0x8468('0x1c'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x8468('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8468('0x5')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8468('0x0')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x8468('0x1d')],'defaultValue':0x0,'set':function(_0x476f42){this['setDataValue']('acw',_0x476f42);if(_0x476f42){if(this[_0x8468('0xf')](_0x8468('0x1e'))<0x2){this[_0x8468('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8468('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8468('0x1d')],'defaultValue':0x0,'comment':_0x8468('0x1f')},'dialMethod':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x20'),_0x8468('0x21'),_0x8468('0x22'),'predictive',_0x8468('0x11')),'defaultValue':_0x8468('0x21'),'comment':_0x8468('0x23')},'dialLimitChannel':{'type':Sequelize[_0x8468('0x14')](0x4)[_0x8468('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8468('0x25')},'dialLimitQueue':{'type':Sequelize[_0x8468('0x14')](0x4)[_0x8468('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8468('0x26')},'dialPowerLevel':{'type':Sequelize[_0x8468('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x28'),_0x8468('0x29')),'defaultValue':'dropRate','comment':_0x8468('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8468('0x27')](0x2)[_0x8468('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x8468('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8468('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8468('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8468('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8468('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x8468('0x2d'),'comment':_0x8468('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x8468('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8468('0x2f')},'dialQueueProject':{'type':Sequelize[_0x8468('0x0')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8468('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8468('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8468('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8468('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8468('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8468('0x24')],'defaultValue':0x3,'comment':_0x8468('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8468('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8468('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8468('0x0')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x8468('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8468('0x35'),_0x8468('0x36'),_0x8468('0x37')),'defaultValue':_0x8468('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8468('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x8468('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x8468('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8468('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8468('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8468('0x14')](0x9)[_0x8468('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x8468('0x14')](0x9)[_0x8468('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8468('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8468('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8468('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8468('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8468('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8468('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8468('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x8468('0x14')](0x5)[_0x8468('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8468('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x8468('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8468('0x5')](_0x8468('0x40'),_0x8468('0x41')),'defaultValue':_0x8468('0x40')},'dialQueueProject2':{'type':Sequelize[_0x8468('0x0')],'comment':_0x8468('0x42')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8468('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8468('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8468('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x8468('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8468('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8468('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8468('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8468('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x8468('0x14')](0x5)[_0x8468('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8468('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8468('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8468('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8468('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x8468('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8468('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8468('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8468('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8468('0x14')](0x5)[_0x8468('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8468('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x8468('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x8468('0x1d')],'defaultValue':![],'comment':_0x8468('0x4d'),'set':function(_0x9caebb){if(!_0x9caebb)this[_0x8468('0xc')]('mandatoryDispositionPauseId',null);this[_0x8468('0xc')](_0x8468('0x4e'),_0x9caebb);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8468('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x8468('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x8468('0x14')](0x3)[_0x8468('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x8468('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0xb3e6=['AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','exports','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','getDataValue','dialMethod','strategy','preview','roundrobin','includes','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC'];(function(_0x3d1b88,_0x308670){var _0x302e17=function(_0xcbcd9){while(--_0xcbcd9){_0x3d1b88['push'](_0x3d1b88['shift']());}};_0x302e17(++_0x308670);}(_0xb3e6,0xb0));var _0x6b3e=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0xb3e6[_0x82140];return _0x2b15a6;};'use strict';var Sequelize=require('sequelize');module[_0x6b3e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x2'),_0x6b3e('0x3')),'allowNull':![],'defaultValue':_0x6b3e('0x2')},'musiconhold':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':_0x6b3e('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x6b3e('0x1')]('rr',_0x6b3e('0x6'),_0x6b3e('0x7'),_0x6b3e('0x8'),_0x6b3e('0x9'),_0x6b3e('0xa'),_0x6b3e('0xb'),_0x6b3e('0xc'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x7b377){this[_0x6b3e('0xd')]('strategy',_0x7b377?_0x7b377:_0x6b3e('0xa'));},'get':function(){var _0xad25de=this[_0x6b3e('0xe')]('type');var _0x4b411d=this[_0x6b3e('0xe')](_0x6b3e('0xf'));var _0x4ba08b=this[_0x6b3e('0xe')](_0x6b3e('0x10'));if(_0xad25de==='outbound'){if(_0x4b411d===_0x6b3e('0x11')){return null;}if(_0x4b411d==='booked'&&![_0x6b3e('0xa'),_0x6b3e('0x12')][_0x6b3e('0x13')](_0x4ba08b)){this[_0x6b3e('0xd')](_0x6b3e('0x10'),_0x6b3e('0xa'));}}return _0x4ba08b;}},'servicelevel':{'type':Sequelize[_0x6b3e('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x6b3e('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x6b3e('0x4')]},'weight':{'type':Sequelize[_0x6b3e('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x6b3e('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x15'),'no'),'defaultValue':_0x6b3e('0x15')},'autopause':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x15'),'no',_0x6b3e('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6b3e('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x6b3e('0x1')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x6b3e('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x6b3e('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6b3e('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x6b3e('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x6b3e('0x1')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x6b3e('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x6b3e('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x6b3e('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x6b3e('0x4')]},'queue_youarenext':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x6b3e('0x4')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x6b3e('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0x6b3e('0x4')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x6b3e('0x17')],'set':function(_0x2f161d){this[_0x6b3e('0xd')](_0x6b3e('0x18'),_0x2f161d?_0x2f161d[_0x6b3e('0x19')](','):[]);},'get':function(){return this['getDataValue'](_0x6b3e('0x18'))?this[_0x6b3e('0xe')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':'yes','set':function(_0x4f70fa){this['setDataValue'](_0x6b3e('0x1a'),_0x4f70fa?_0x4f70fa[_0x6b3e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x6b3e('0x1a'))?this[_0x6b3e('0xe')]('joinempty')[_0x6b3e('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':'no','set':function(_0x977f8b){this['setDataValue'](_0x6b3e('0x1c'),_0x977f8b?_0x977f8b['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x6b3e('0x1c'))?this[_0x6b3e('0xe')](_0x6b3e('0x1c'))[_0x6b3e('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x6b3e('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6b3e('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x6b3e('0x1')](_0x6b3e('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6b3e('0x4')]},'description':{'type':Sequelize[_0x6b3e('0x4')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x58f71f){this[_0x6b3e('0xd')](_0x6b3e('0x1d'),_0x58f71f);if(_0x58f71f){if(this[_0x6b3e('0xe')](_0x6b3e('0x1e'))<0x2){this[_0x6b3e('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6b3e('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6b3e('0x1f')],'defaultValue':0x0,'comment':_0x6b3e('0x20')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x6b3e('0x21'),_0x6b3e('0x22'),_0x6b3e('0x23'),_0x6b3e('0x24')),'defaultValue':_0x6b3e('0x21'),'comment':_0x6b3e('0x25')},'dialLimitChannel':{'type':Sequelize[_0x6b3e('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6b3e('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x6b3e('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6b3e('0x28')},'dialPowerLevel':{'type':Sequelize[_0x6b3e('0x29')](0x2)[_0x6b3e('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x6b3e('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x6b3e('0x2b'),_0x6b3e('0x2c')),'defaultValue':_0x6b3e('0x2c'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x6b3e('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x6b3e('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6b3e('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6b3e('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b3e('0x2f')},'dialQueueProject':{'type':Sequelize[_0x6b3e('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b3e('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6b3e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b3e('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6b3e('0x14')](0x5)[_0x6b3e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b3e('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'defaultValue':0x3,'comment':_0x6b3e('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6b3e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b3e('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6b3e('0x35')},'dialTimezone':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x6b3e('0x36')},'dialPrefix':{'type':Sequelize[_0x6b3e('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x6b3e('0x1')]('always',_0x6b3e('0x37'),_0x6b3e('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x6b3e('0x1f')],'defaultValue':0x0,'comment':_0x6b3e('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x6b3e('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x6b3e('0x14')](0x9)[_0x6b3e('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6b3e('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6b3e('0x14')](0x9)[_0x6b3e('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6b3e('0x14')](0x9)[_0x6b3e('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6b3e('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6b3e('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6b3e('0x14')](0x9)[_0x6b3e('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6b3e('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6b3e('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6b3e('0x14')](0x5)[_0x6b3e('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6b3e('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6b3e('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6b3e('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x6b3e('0x14')](0x5)[_0x6b3e('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6b3e('0x40')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x6b3e('0x41'),_0x6b3e('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x6b3e('0x4')],'comment':_0x6b3e('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x6b3e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6b3e('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6b3e('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b3e('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6b3e('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b3e('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x6b3e('0x14')](0x5)[_0x6b3e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b3e('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6b3e('0x14')](0x5)[_0x6b3e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b3e('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b3e('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6b3e('0x14')](0x5)[_0x6b3e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b3e('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6b3e('0x14')](0x3)[_0x6b3e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b3e('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6b3e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b3e('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x6b3e('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x6b3e('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x27d9f7){if(!_0x27d9f7)this[_0x6b3e('0xd')](_0x6b3e('0x4f'),null);this['setDataValue'](_0x6b3e('0x50'),_0x27d9f7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x6b3e('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x6b3e('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x6b3e('0x14')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x6b3e('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index cf034d4..4fd239a 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 _0xed5c=['length','nolimit','order','sort','pick','where','merge','count','includeAll','include','VoiceQueue','rows','catch','show','params','create','body','role','user','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','SIP/%s','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ContactId','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','type','name','UserProfileResource','destroy','end','error','stack','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x139eb4,_0x42d7e6){var _0x32dd1d=function(_0x236d95){while(--_0x236d95){_0x139eb4['push'](_0x139eb4['shift']());}};_0x32dd1d(++_0x42d7e6);}(_0xed5c,0x81));var _0xced5=function(_0x520ef4,_0x2254c3){_0x520ef4=_0x520ef4-0x0;var _0x36d395=_0xed5c[_0x520ef4];return _0x36d395;};'use strict';var emlformat=require(_0xced5('0x0'));var rimraf=require(_0xced5('0x1'));var zipdir=require(_0xced5('0x2'));var jsonpatch=require(_0xced5('0x3'));var rp=require(_0xced5('0x4'));var moment=require(_0xced5('0x5'));var BPromise=require(_0xced5('0x6'));var Mustache=require(_0xced5('0x7'));var util=require(_0xced5('0x8'));var path=require(_0xced5('0x9'));var sox=require('sox');var csv=require(_0xced5('0xa'));var ejs=require(_0xced5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xced5('0xc'));var crypto=require(_0xced5('0xd'));var jsforce=require(_0xced5('0xe'));var deskjs=require(_0xced5('0xf'));var toCsv=require(_0xced5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xced5('0x10'));var authService=require(_0xced5('0x11'));var qs=require(_0xced5('0x12'));var as=require(_0xced5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced5('0x14'))('api');var utils=require(_0xced5('0x15'));var config=require(_0xced5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xced5('0x17'))['db'];config['redis']=_[_0xced5('0x18')](config[_0xced5('0x19')],{'host':_0xced5('0x1a'),'port':0x18eb});var socket=require(_0xced5('0x1b'))(new Redis(config[_0xced5('0x19')]));require(_0xced5('0x1c'))[_0xced5('0x1d')](socket);function respondWithStatusCode(_0x4bee02,_0x4b2533){_0x4b2533=_0x4b2533||0xcc;return function(_0x23ca09){if(_0x23ca09){return _0x4bee02[_0xced5('0x1e')](_0x4b2533);}return _0x4bee02[_0xced5('0x1f')](_0x4b2533)['end']();};}function respondWithResult(_0x4fa2a3,_0x456843){_0x456843=_0x456843||0xc8;return function(_0x1c8c90){if(_0x1c8c90){return _0x4fa2a3[_0xced5('0x1f')](_0x456843)[_0xced5('0x20')](_0x1c8c90);}};}function respondWithFilteredResult(_0x17e4eb,_0x13928f){return function(_0x54c5a4){if(_0x54c5a4){var _0x29a3ba=typeof _0x13928f[_0xced5('0x21')]==='undefined'&&typeof _0x13928f[_0xced5('0x22')]===_0xced5('0x23');var _0x14e3ec=_0x54c5a4['count'];var _0x127eb4=_0x29a3ba?0x0:_0x13928f[_0xced5('0x21')];var _0x2a5aca=_0x29a3ba?_0x54c5a4['count']:_0x13928f[_0xced5('0x21')]+_0x13928f[_0xced5('0x22')];var _0xf84ec;if(_0x2a5aca>=_0x14e3ec){_0x2a5aca=_0x14e3ec;_0xf84ec=0xc8;}else{_0xf84ec=0xce;}_0x17e4eb[_0xced5('0x1f')](_0xf84ec);return _0x17e4eb[_0xced5('0x24')](_0xced5('0x25'),_0x127eb4+'-'+_0x2a5aca+'/'+_0x14e3ec)['json'](_0x54c5a4);}return null;};}function patchUpdates(_0x1ba520){return function(_0x4a56a4){try{jsonpatch[_0xced5('0x26')](_0x4a56a4,_0x1ba520,!![]);}catch(_0x5b11c5){return BPromise[_0xced5('0x27')](_0x5b11c5);}return _0x4a56a4[_0xced5('0x28')]();};}function saveUpdates(_0x1c18e0,_0x45766f){return function(_0xe536f8){if(_0xe536f8){return _0xe536f8[_0xced5('0x29')](_0x1c18e0)[_0xced5('0x2a')](function(_0x2f092b){return _0x2f092b;});}return null;};}function removeEntity(_0x548cbb,_0x92ac47){return function(_0x4de26f){if(_0x4de26f){return _0x4de26f['destroy']()[_0xced5('0x2a')](function(){var _0x2cd6c4=_0x4de26f[_0xced5('0x2b')]({'plain':!![]});var _0x2e4774=[{'name':_0xced5('0x2c'),'value':_0xced5('0x2d'),'ignore':![]},{'name':_0xced5('0x2e'),'value':_0xced5('0x2f'),'ignore':![]}];var _0x239b32=_(_0x2e4774)[_0xced5('0x30')](_0xced5('0x31'))['map'](_0xced5('0x32'))[_0xced5('0x32')]();if(_['includes'](_0x239b32,_0x2cd6c4['type'])){return;}var _0x499040=_['find'](_0x2e4774,[_0xced5('0x32'),_0x2cd6c4[_0xced5('0x33')]])[_0xced5('0x34')];return db[_0xced5('0x35')][_0xced5('0x36')]({'where':{'type':_0x499040,'resourceId':_0x2cd6c4['id']}})['then'](function(){return _0x4de26f;});})[_0xced5('0x2a')](function(){_0x548cbb['status'](0xcc)[_0xced5('0x37')]();});}};}function handleEntityNotFound(_0x1fa141,_0x4d56c6){return function(_0x5d8f4f){if(!_0x5d8f4f){_0x1fa141[_0xced5('0x1e')](0x194);}return _0x5d8f4f;};}function handleError(_0x579b4a,_0x2faacb){_0x2faacb=_0x2faacb||0x1f4;return function(_0x3bd7d5){logger[_0xced5('0x38')](_0x3bd7d5[_0xced5('0x39')]);if(_0x3bd7d5[_0xced5('0x34')]){delete _0x3bd7d5[_0xced5('0x34')];}_0x579b4a[_0xced5('0x1f')](_0x2faacb)['send'](_0x3bd7d5);};}exports[_0xced5('0x3a')]=function(_0x213569,_0x5dca26){var _0x39fb2c={},_0x3ff95d={},_0x542afe={'count':0x0,'rows':[]};var _0x288ab0=_[_0xced5('0x3b')](db['VoiceQueue'][_0xced5('0x3c')],function(_0x4ea2fa){return{'name':_0x4ea2fa[_0xced5('0x3d')],'type':_0x4ea2fa['type'][_0xced5('0x3e')]};});_0x3ff95d[_0xced5('0x3f')]=_['map'](_0x288ab0,'name');_0x3ff95d[_0xced5('0x40')]=_[_0xced5('0x41')](_0x213569['query']);_0x3ff95d[_0xced5('0x42')]=_[_0xced5('0x43')](_0x3ff95d['model'],_0x3ff95d[_0xced5('0x40')]);_0x39fb2c[_0xced5('0x44')]=_[_0xced5('0x43')](_0x3ff95d['model'],qs[_0xced5('0x45')](_0x213569[_0xced5('0x40')][_0xced5('0x45')]));_0x39fb2c['attributes']=_0x39fb2c[_0xced5('0x44')][_0xced5('0x46')]?_0x39fb2c[_0xced5('0x44')]:_0x3ff95d['model'];if(!_0x213569[_0xced5('0x40')]['hasOwnProperty'](_0xced5('0x47'))){_0x39fb2c[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x213569[_0xced5('0x40')][_0xced5('0x22')]);_0x39fb2c[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x213569['query'][_0xced5('0x21')]);}_0x39fb2c[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x213569['query'][_0xced5('0x49')]);_0x39fb2c['where']=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x213569[_0xced5('0x40')],_0x3ff95d[_0xced5('0x42')]),_0x288ab0);if(_0x213569[_0xced5('0x40')][_0xced5('0x30')]){_0x39fb2c[_0xced5('0x4b')]=_['merge'](_0x39fb2c[_0xced5('0x4b')],{'$or':_['map'](_0x288ab0,function(_0x466e6a){if(_0x466e6a[_0xced5('0x33')]!=='VIRTUAL'){var _0x2f2a57={};_0x2f2a57[_0x466e6a[_0xced5('0x34')]]={'$like':'%'+_0x213569[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x2f2a57;}})});}_0x39fb2c=_[_0xced5('0x4c')]({},_0x39fb2c,_0x213569['options']);var _0x53636f={'where':_0x39fb2c[_0xced5('0x4b')]};return db['VoiceQueue'][_0xced5('0x4d')](_0x53636f)[_0xced5('0x2a')](function(_0xf38fab){_0x542afe[_0xced5('0x4d')]=_0xf38fab;if(_0x213569[_0xced5('0x40')][_0xced5('0x4e')]){_0x39fb2c[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x50')]['findAll'](_0x39fb2c);})['then'](function(_0x5c8a1c){_0x542afe[_0xced5('0x51')]=_0x5c8a1c;return _0x542afe;})[_0xced5('0x2a')](respondWithFilteredResult(_0x5dca26,_0x39fb2c))[_0xced5('0x52')](handleError(_0x5dca26,null));};exports[_0xced5('0x53')]=function(_0x1849b9,_0x1539a2){var _0xeb8839={'raw':![],'where':{'id':_0x1849b9[_0xced5('0x54')]['id']}},_0x1cab90={};_0x1cab90[_0xced5('0x3f')]=_[_0xced5('0x41')](db['VoiceQueue'][_0xced5('0x3c')]);_0x1cab90[_0xced5('0x40')]=_[_0xced5('0x41')](_0x1849b9[_0xced5('0x40')]);_0x1cab90[_0xced5('0x42')]=_[_0xced5('0x43')](_0x1cab90['model'],_0x1cab90[_0xced5('0x40')]);_0xeb8839[_0xced5('0x44')]=_[_0xced5('0x43')](_0x1cab90[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x1849b9[_0xced5('0x40')][_0xced5('0x45')]));_0xeb8839[_0xced5('0x44')]=_0xeb8839['attributes'][_0xced5('0x46')]?_0xeb8839[_0xced5('0x44')]:_0x1cab90[_0xced5('0x3f')];if(_0x1849b9[_0xced5('0x40')][_0xced5('0x4e')]){_0xeb8839[_0xced5('0x4f')]=[{'all':!![]}];}_0xeb8839=_['merge']({},_0xeb8839,_0x1849b9['options']);return db[_0xced5('0x50')]['find'](_0xeb8839)[_0xced5('0x2a')](handleEntityNotFound(_0x1539a2,null))['then'](respondWithResult(_0x1539a2,null))[_0xced5('0x52')](handleError(_0x1539a2,null));};exports['create']=function(_0xbefa95,_0xfda45c){return db[_0xced5('0x50')][_0xced5('0x55')](_0xbefa95[_0xced5('0x56')],{})[_0xced5('0x2a')](function(_0xcb1ec1){var _0x3a958f=_0xbefa95['user'][_0xced5('0x2b')]({'plain':!![]});if(!_0x3a958f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a958f[_0xced5('0x57')]===_0xced5('0x58')){var _0x4a47bb=_0xcb1ec1[_0xced5('0x2b')]({'plain':!![]});var _0x50e559=[{'name':_0xced5('0x2c'),'value':_0xced5('0x2d')},{'name':_0xced5('0x2e'),'value':_0xced5('0x2f')}];var _0x590def=_[_0xced5('0x59')](_0x50e559,[_0xced5('0x32'),_0x4a47bb[_0xced5('0x33')]])[_0xced5('0x34')];return db[_0xced5('0x5a')]['find']({'where':{'name':_0x590def,'userProfileId':_0x3a958f[_0xced5('0x5b')]},'raw':!![]})[_0xced5('0x2a')](function(_0xd6315d){if(_0xd6315d&&_0xd6315d[_0xced5('0x5c')]===0x0){return db[_0xced5('0x35')][_0xced5('0x55')]({'name':_0x4a47bb[_0xced5('0x34')],'resourceId':_0x4a47bb['id'],'type':_0xd6315d[_0xced5('0x34')],'sectionId':_0xd6315d['id']},{})[_0xced5('0x2a')](function(){return _0xcb1ec1;});}else{return _0xcb1ec1;}})[_0xced5('0x52')](function(_0x442094){logger[_0xced5('0x38')](_0xced5('0x5d'),_0x442094);throw _0x442094;});}return _0xcb1ec1;})[_0xced5('0x2a')](respondWithResult(_0xfda45c,0xc9))[_0xced5('0x52')](handleError(_0xfda45c,null));};exports[_0xced5('0x5e')]=function(_0x8301b8,_0x4a6e1d){var _0x44cb19={'where':{'id':_0x8301b8[_0xced5('0x54')]['id']}},_0x11f019={};_0x11f019[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x50')]['rawAttributes']);_0x44cb19[_0xced5('0x44')]=_['intersection'](_0x11f019[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x8301b8[_0xced5('0x40')][_0xced5('0x45')]));_0x44cb19[_0xced5('0x44')]=_0x44cb19[_0xced5('0x44')]['length']?_0x44cb19[_0xced5('0x44')]:_0x11f019[_0xced5('0x3f')];if(_0x8301b8['query'][_0xced5('0x4e')]){_0x44cb19['include']=[{'all':!![]}];}_0x44cb19=_['merge']({},_0x44cb19,_0x8301b8[_0xced5('0x5f')]);return db[_0xced5('0x50')][_0xced5('0x59')](_0x44cb19)[_0xced5('0x2a')](handleEntityNotFound(_0x4a6e1d,null))['then'](function(_0x2259d2){if(_0x2259d2){var _0xea78be=_0x2259d2[_0xced5('0x2b')]({'plain':!![]});_0xea78be=qs['omit'](_0xea78be,['id',_0xced5('0x60'),_0xced5('0x61')]);_0x8301b8['body']=_['omit'](_0x8301b8[_0xced5('0x56')],['id',_0xced5('0x60'),'updatedAt']);return db['VoiceQueue'][_0xced5('0x55')](_[_0xced5('0x4c')](_0xea78be,_0x8301b8[_0xced5('0x56')]),{'include':_0x8301b8['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x426b3b){var _0x599327=_0x8301b8[_0xced5('0x58')][_0xced5('0x2b')]({'plain':!![]});if(!_0x599327)throw new Error(_0xced5('0x62'));if(_0x599327[_0xced5('0x57')]===_0xced5('0x58')){var _0x50d5fd=_0x426b3b[_0xced5('0x2b')]({'plain':!![]});var _0x448a33=[{'name':_0xced5('0x2c'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xced5('0x2f')}];var _0x4dde63=_['find'](_0x448a33,[_0xced5('0x32'),_0x50d5fd['type']])[_0xced5('0x34')];return db['UserProfileSection'][_0xced5('0x59')]({'where':{'name':_0x4dde63,'userProfileId':_0x599327[_0xced5('0x5b')]},'raw':!![]})[_0xced5('0x2a')](function(_0x39a7f2){if(_0x39a7f2&&_0x39a7f2[_0xced5('0x5c')]===0x0){return db['UserProfileResource'][_0xced5('0x55')]({'name':_0x50d5fd[_0xced5('0x34')],'resourceId':_0x50d5fd['id'],'type':_0x39a7f2['name'],'sectionId':_0x39a7f2['id']},{})[_0xced5('0x2a')](function(){return _0x426b3b;});}else{return _0x426b3b;}})[_0xced5('0x52')](function(_0x546420){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x546420);throw _0x546420;});}return _0x426b3b;});}})[_0xced5('0x2a')](respondWithResult(_0x4a6e1d,0xc9))[_0xced5('0x52')](handleError(_0x4a6e1d,null));};exports[_0xced5('0x29')]=function(_0x3f202c,_0x248535){if(_0x3f202c[_0xced5('0x56')]['id']){delete _0x3f202c[_0xced5('0x56')]['id'];}return db[_0xced5('0x50')]['find']({'where':{'id':_0x3f202c[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x248535,null))[_0xced5('0x2a')](saveUpdates(_0x3f202c[_0xced5('0x56')],null))[_0xced5('0x2a')](respondWithResult(_0x248535,null))[_0xced5('0x52')](handleError(_0x248535,null));};exports[_0xced5('0x36')]=function(_0x425a1e,_0x474b1f){return db[_0xced5('0x50')]['find']({'where':{'id':_0x425a1e['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x474b1f,null))[_0xced5('0x2a')](removeEntity(_0x474b1f,null))[_0xced5('0x52')](handleError(_0x474b1f,null));};exports[_0xced5('0x63')]=function(_0x43abb9,_0x35a2d6,_0x5ed3bc){var _0x3dcfbc={'raw':![],'where':{}};var _0x216223={};var _0x451e90={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x43abb9['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x35a2d6,null))[_0xced5('0x2a')](function(_0x5d80d5){if(_0x5d80d5){_0x216223[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x65')][_0xced5('0x3c')]);_0x216223['query']=_[_0xced5('0x41')](_0x43abb9[_0xced5('0x40')]);_0x216223['filters']=_[_0xced5('0x43')](_0x216223[_0xced5('0x3f')],_0x216223[_0xced5('0x40')]);_0x3dcfbc[_0xced5('0x44')]=_[_0xced5('0x43')](_0x216223[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x43abb9[_0xced5('0x40')]['fields']));_0x3dcfbc[_0xced5('0x44')]=_0x3dcfbc[_0xced5('0x44')]['length']?_0x3dcfbc[_0xced5('0x44')]:_0x216223[_0xced5('0x3f')];if(!_0x43abb9['query'][_0xced5('0x66')](_0xced5('0x47'))){_0x3dcfbc['limit']=qs[_0xced5('0x22')](_0x43abb9[_0xced5('0x40')]['limit']);_0x3dcfbc[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x43abb9[_0xced5('0x40')][_0xced5('0x21')]);}_0x3dcfbc[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x43abb9[_0xced5('0x40')][_0xced5('0x49')]);_0x3dcfbc[_0xced5('0x4b')]=qs['filters'](_[_0xced5('0x4a')](_0x43abb9[_0xced5('0x40')],_0x216223[_0xced5('0x42')]));_0x3dcfbc[_0xced5('0x4b')][_0xced5('0x67')]=_0x5d80d5['id'];if(_0x43abb9[_0xced5('0x40')][_0xced5('0x30')]){_0x3dcfbc[_0xced5('0x4b')]=_['merge'](_0x3dcfbc['where'],{'$or':_[_0xced5('0x3b')](_0x3dcfbc[_0xced5('0x44')],function(_0x38abe9){var _0x262d48={};_0x262d48[_0x38abe9]={'$like':'%'+_0x43abb9[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x262d48;})});}_0x3dcfbc=_[_0xced5('0x4c')]({},_0x3dcfbc,_0x43abb9['options']);return db['CmHopper'][_0xced5('0x4d')]({'where':_0x3dcfbc['where']})[_0xced5('0x2a')](function(_0x2f9ae5){_0x451e90[_0xced5('0x4d')]=_0x2f9ae5;if(_0x43abb9[_0xced5('0x40')]['includeAll']){_0x3dcfbc[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x65')]['findAll'](_0x3dcfbc);})[_0xced5('0x2a')](function(_0x4bb793){_0x451e90[_0xced5('0x51')]=_0x4bb793;return _0x451e90;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x35a2d6,_0x3dcfbc))[_0xced5('0x52')](handleError(_0x35a2d6,null));};exports['getHopperHistories']=function(_0x38512b,_0x59b8ca,_0xcf0652){var _0x5e9b3f={'raw':!![],'where':{}};var _0x426915={};var _0x4eeb79={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x38512b['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x59b8ca,null))[_0xced5('0x2a')](function(_0x33bd7e){if(_0x33bd7e){_0x426915[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x68')][_0xced5('0x3c')]);_0x426915[_0xced5('0x40')]=_[_0xced5('0x41')](_0x38512b['query']);_0x426915[_0xced5('0x42')]=_[_0xced5('0x43')](_0x426915[_0xced5('0x3f')],_0x426915[_0xced5('0x40')]);_0x5e9b3f[_0xced5('0x44')]=_[_0xced5('0x43')](_0x426915['model'],qs[_0xced5('0x45')](_0x38512b['query'][_0xced5('0x45')]));_0x5e9b3f[_0xced5('0x44')]=_0x5e9b3f[_0xced5('0x44')][_0xced5('0x46')]?_0x5e9b3f[_0xced5('0x44')]:_0x426915[_0xced5('0x3f')];if(!_0x38512b[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x5e9b3f[_0xced5('0x22')]=qs['limit'](_0x38512b['query'][_0xced5('0x22')]);_0x5e9b3f['offset']=qs[_0xced5('0x21')](_0x38512b['query']['offset']);}_0x5e9b3f[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x38512b[_0xced5('0x40')]['sort']);_0x5e9b3f[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x38512b[_0xced5('0x40')],_0x426915['filters']));_0x5e9b3f[_0xced5('0x4b')]['VoiceQueueId']=_0x33bd7e['id'];if(_0x38512b[_0xced5('0x40')]['filter']){_0x5e9b3f[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x5e9b3f[_0xced5('0x4b')],{'$or':_['map'](_0x5e9b3f['attributes'],function(_0x5fcbed){var _0x1f412a={};_0x1f412a[_0x5fcbed]={'$like':'%'+_0x38512b['query'][_0xced5('0x30')]+'%'};return _0x1f412a;})});}_0x5e9b3f=_[_0xced5('0x4c')]({},_0x5e9b3f,_0x38512b[_0xced5('0x5f')]);return db[_0xced5('0x68')][_0xced5('0x4d')]({'where':_0x5e9b3f[_0xced5('0x4b')]})[_0xced5('0x2a')](function(_0x247b1e){_0x4eeb79[_0xced5('0x4d')]=_0x247b1e;if(_0x38512b[_0xced5('0x40')][_0xced5('0x4e')]){_0x5e9b3f[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x68')][_0xced5('0x69')](_0x5e9b3f);})[_0xced5('0x2a')](function(_0x582ef4){_0x4eeb79[_0xced5('0x51')]=_0x582ef4;return _0x4eeb79;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x59b8ca,_0x5e9b3f))[_0xced5('0x52')](handleError(_0x59b8ca,null));};exports[_0xced5('0x6a')]=function(_0x1c9857,_0x289ae2,_0xe8e587){var _0xd6dcbd={'raw':!![],'where':{}};var _0x302405={};var _0x535f56={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x1c9857[_0xced5('0x54')]['id']}})['then'](handleEntityNotFound(_0x289ae2,null))[_0xced5('0x2a')](function(_0x3380bd){if(_0x3380bd){_0x302405[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x6b')][_0xced5('0x3c')]);_0x302405[_0xced5('0x40')]=_[_0xced5('0x41')](_0x1c9857[_0xced5('0x40')]);_0x302405['filters']=_['intersection'](_0x302405[_0xced5('0x3f')],_0x302405['query']);_0xd6dcbd['attributes']=_[_0xced5('0x43')](_0x302405['model'],qs[_0xced5('0x45')](_0x1c9857['query'][_0xced5('0x45')]));_0xd6dcbd['attributes']=_0xd6dcbd['attributes'][_0xced5('0x46')]?_0xd6dcbd[_0xced5('0x44')]:_0x302405['model'];if(!_0x1c9857[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0xd6dcbd[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x1c9857[_0xced5('0x40')][_0xced5('0x22')]);_0xd6dcbd[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x1c9857[_0xced5('0x40')]['offset']);}_0xd6dcbd[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x1c9857[_0xced5('0x40')][_0xced5('0x49')]);_0xd6dcbd[_0xced5('0x4b')]=qs['filters'](_['pick'](_0x1c9857['query'],_0x302405[_0xced5('0x42')]));_0xd6dcbd['where'][_0xced5('0x67')]=_0x3380bd['id'];if(_0x1c9857['query']['filter']){_0xd6dcbd['where']=_[_0xced5('0x4c')](_0xd6dcbd['where'],{'$or':_['map'](_0xd6dcbd[_0xced5('0x44')],function(_0x31c1e1){var _0x5631a1={};_0x5631a1[_0x31c1e1]={'$like':'%'+_0x1c9857[_0xced5('0x40')]['filter']+'%'};return _0x5631a1;})});}_0xd6dcbd=_[_0xced5('0x4c')]({},_0xd6dcbd,_0x1c9857[_0xced5('0x5f')]);return db['CmHopperFinal'][_0xced5('0x4d')]({'where':_0xd6dcbd['where']})[_0xced5('0x2a')](function(_0x19753a){_0x535f56['count']=_0x19753a;if(_0x1c9857[_0xced5('0x40')][_0xced5('0x4e')]){_0xd6dcbd['include']=[{'all':!![]}];}return db[_0xced5('0x6b')]['findAll'](_0xd6dcbd);})[_0xced5('0x2a')](function(_0x482575){_0x535f56['rows']=_0x482575;return _0x535f56;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x289ae2,_0xd6dcbd))[_0xced5('0x52')](handleError(_0x289ae2,null));};exports['getHopperBlacks']=function(_0x1286d9,_0x44608e,_0x27ffad){var _0x7aac76={'raw':!![],'where':{}};var _0x31d78b={};var _0x206f87={'count':0x0,'rows':[]};return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x1286d9[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x44608e,null))[_0xced5('0x2a')](function(_0x52f53a){if(_0x52f53a){_0x31d78b['model']=_[_0xced5('0x41')](db[_0xced5('0x6c')][_0xced5('0x3c')]);_0x31d78b[_0xced5('0x40')]=_[_0xced5('0x41')](_0x1286d9['query']);_0x31d78b[_0xced5('0x42')]=_[_0xced5('0x43')](_0x31d78b[_0xced5('0x3f')],_0x31d78b['query']);_0x7aac76[_0xced5('0x44')]=_[_0xced5('0x43')](_0x31d78b[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x1286d9[_0xced5('0x40')][_0xced5('0x45')]));_0x7aac76[_0xced5('0x44')]=_0x7aac76['attributes'][_0xced5('0x46')]?_0x7aac76[_0xced5('0x44')]:_0x31d78b[_0xced5('0x3f')];if(!_0x1286d9[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x7aac76[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x1286d9['query'][_0xced5('0x22')]);_0x7aac76[_0xced5('0x21')]=qs['offset'](_0x1286d9[_0xced5('0x40')][_0xced5('0x21')]);}_0x7aac76[_0xced5('0x48')]=qs['sort'](_0x1286d9['query'][_0xced5('0x49')]);_0x7aac76[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x1286d9['query'],_0x31d78b[_0xced5('0x42')]));_0x7aac76['where'][_0xced5('0x67')]=_0x52f53a['id'];if(_0x1286d9['query']['filter']){_0x7aac76[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x7aac76[_0xced5('0x4b')],{'$or':_[_0xced5('0x3b')](_0x7aac76['attributes'],function(_0x541062){var _0x33646e={};_0x33646e[_0x541062]={'$like':'%'+_0x1286d9[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x33646e;})});}_0x7aac76=_[_0xced5('0x4c')]({},_0x7aac76,_0x1286d9[_0xced5('0x5f')]);return db[_0xced5('0x6c')][_0xced5('0x4d')]({'where':_0x7aac76[_0xced5('0x4b')]})[_0xced5('0x2a')](function(_0x13ad22){_0x206f87[_0xced5('0x4d')]=_0x13ad22;if(_0x1286d9['query'][_0xced5('0x4e')]){_0x7aac76[_0xced5('0x4f')]=[{'all':!![]}];}return db[_0xced5('0x6c')]['findAll'](_0x7aac76);})[_0xced5('0x2a')](function(_0x4a5e13){_0x206f87['rows']=_0x4a5e13;return _0x206f87;});}})[_0xced5('0x2a')](respondWithFilteredResult(_0x44608e,_0x7aac76))[_0xced5('0x52')](handleError(_0x44608e,null));};exports[_0xced5('0x6d')]=function(_0x151721,_0x5dd260,_0x2845af){var _0x4ce63f={};var _0x35668a={};var _0x338639;var _0x25dbb9;return db[_0xced5('0x50')]['findOne']({'where':{'id':_0x151721[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x5dd260,null))['then'](function(_0x5c2a19){if(_0x5c2a19){_0x338639=_0x5c2a19;_0x35668a['model']=_[_0xced5('0x41')](db[_0xced5('0x6e')][_0xced5('0x3c')]);_0x35668a[_0xced5('0x40')]=_[_0xced5('0x41')](_0x151721[_0xced5('0x40')]);_0x35668a[_0xced5('0x42')]=_[_0xced5('0x43')](_0x35668a['model'],_0x35668a[_0xced5('0x40')]);_0x4ce63f[_0xced5('0x44')]=_[_0xced5('0x43')](_0x35668a[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x151721[_0xced5('0x40')]['fields']));_0x4ce63f[_0xced5('0x44')]=_0x4ce63f[_0xced5('0x44')]['length']?_0x4ce63f['attributes']:_0x35668a[_0xced5('0x3f')];_0x4ce63f['order']=qs['sort'](_0x151721[_0xced5('0x40')][_0xced5('0x49')]);_0x4ce63f[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x151721[_0xced5('0x40')],_0x35668a[_0xced5('0x42')]));if(_0x151721[_0xced5('0x40')]['filter']){_0x4ce63f[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x4ce63f['where'],{'$or':_[_0xced5('0x3b')](_0x4ce63f[_0xced5('0x44')],function(_0x4a8b34){var _0x51d710={};_0x51d710[_0x4a8b34]={'$like':'%'+_0x151721['query'][_0xced5('0x30')]+'%'};return _0x51d710;})});}_0x4ce63f=_[_0xced5('0x4c')]({},_0x4ce63f,_0x151721[_0xced5('0x5f')]);return _0x338639[_0xced5('0x6d')](_0x4ce63f);}})[_0xced5('0x2a')](function(_0x3bed24){if(_0x3bed24){_0x25dbb9=_0x3bed24[_0xced5('0x46')];if(!_0x151721['query'][_0xced5('0x66')](_0xced5('0x47'))){_0x4ce63f[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x151721[_0xced5('0x40')][_0xced5('0x22')]);_0x4ce63f[_0xced5('0x21')]=qs['offset'](_0x151721[_0xced5('0x40')]['offset']);}return _0x338639['getTeams'](_0x4ce63f);}})[_0xced5('0x2a')](function(_0x44a238){if(_0x44a238){return _0x44a238?{'count':_0x25dbb9,'rows':_0x44a238}:null;}})[_0xced5('0x2a')](respondWithResult(_0x5dd260,null))[_0xced5('0x52')](handleError(_0x5dd260,null));};exports[_0xced5('0x6f')]=function(_0x40f724,_0x5e4e68,_0x512f23){var _0x573eb6=_0x40f724['body']['teams'];var _0x530bbc=_['map'](_0x573eb6,'id');return db[_0xced5('0x6e')]['findAll']({'where':{'id':_0x530bbc},'attributes':['id'],'include':[{'model':db[_0xced5('0x70')],'as':_0xced5('0x71'),'attributes':['id',_0xced5('0x34'),_0xced5('0x72'),'voicePause',_0xced5('0x73')],'raw':!![]}]})[_0xced5('0x2a')](function(_0x590f82){if(_0x590f82){var _0x575456=_[_0xced5('0x74')](_0x590f82,function(_0x1138b){var _0x973ffd=_0x1138b[_0xced5('0x2b')]({'plain':!![]});_0x973ffd[_0xced5('0x71')][_0xced5('0x75')](function(_0x37efb8){_0x37efb8['penalty']=_['find'](_0x573eb6,{'id':_0x973ffd['id']})[_0xced5('0x76')];});return _0x973ffd[_0xced5('0x71')];});return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x40f724[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](function(_0x2aa01c){return db[_0xced5('0x77')][_0xced5('0x78')](function(_0x52d75b){return _0x2aa01c['addTeams'](_0x530bbc,{'transaction':_0x52d75b})[_0xced5('0x2a')](function(){return BPromise[_0xced5('0x79')](_0x573eb6,function(_0x52d165){return db[_0xced5('0x7a')][_0xced5('0x7b')]({'TeamId':_0x52d165['id'],'VoiceQueueId':_0x40f724[_0xced5('0x54')]['id'],'penalty':_0x52d165[_0xced5('0x76')]},{'transaction':_0x52d75b});});})['then'](function(){return BPromise['each'](_0x575456,function(_0x1fb030){return db[_0xced5('0x7c')][_0xced5('0x7d')]({'where':{'UserId':_0x1fb030['id'],'VoiceQueueId':_0x40f724['params']['id']},'defaults':{'penalty':_0x1fb030[_0xced5('0x76')]},'transaction':_0x52d75b});});})['then'](function(){return BPromise[_0xced5('0x79')](_[_0xced5('0x30')](_0x575456,{'online':!![]}),function(_0x1ea70b){return db[_0xced5('0x7e')][_0xced5('0x7b')]({'membername':_0x1ea70b['name'],'UserId':_0x1ea70b['id'],'queue_name':_0x2aa01c[_0xced5('0x34')],'VoiceQueueId':_0x2aa01c['id'],'interface':_[_0xced5('0x7f')](_0x1ea70b[_0xced5('0x73')])?util[_0xced5('0x80')]('SIP/%s',_0x1ea70b['name']):_0x1ea70b[_0xced5('0x73')],'paused':_0x1ea70b[_0xced5('0x81')]||![],'penalty':_0x1ea70b[_0xced5('0x76')]},{'transaction':_0x52d75b});});})['then'](function(){_0x575456[_0xced5('0x75')](function(_0x42c06b){socket[_0xced5('0x82')](_0xced5('0x83'),{'UserId':_0x42c06b['id'],'VoiceQueueId':_0x2aa01c['id']});});});});});}})[_0xced5('0x2a')](respondWithStatusCode(_0x5e4e68,null))[_0xced5('0x52')](handleError(_0x5e4e68,null));};exports[_0xced5('0x84')]=function(_0x5cce35,_0x53b436,_0x3c8d00){return db[_0xced5('0x6e')][_0xced5('0x69')]({'where':{'id':_0x5cce35[_0xced5('0x40')][_0xced5('0x85')]},'attributes':['id'],'include':[{'model':db[_0xced5('0x70')],'as':_0xced5('0x71'),'attributes':['id'],'raw':!![]}]})[_0xced5('0x2a')](handleEntityNotFound(_0x53b436,null))[_0xced5('0x2a')](function(_0x5c0cc8){var _0x4fa3a0=_['map'](_0x5c0cc8,'id');var _0x15f48b=[];var _0x2e924f=[];var _0x2c698c=squel[_0xced5('0x86')]();_0x2c698c[_0xced5('0x87')](_0xced5('0x88'))[_0xced5('0x89')]('team_has_voice_queues','tq')[_0xced5('0x8a')](_0xced5('0x8b'),'ut',_0xced5('0x8c'))['where']('VoiceQueueId\x20=\x20?',_0x5cce35[_0xced5('0x54')]['id']);for(var _0x1cc673=0x0;_0x1cc673<_0x5c0cc8['length'];_0x1cc673+=0x1){let _0x4a755d=_0x5c0cc8[_0x1cc673];for(var _0x580ffb=0x0;_0x580ffb<_0x4a755d[_0xced5('0x71')][_0xced5('0x46')];_0x580ffb+=0x1){let _0x3de78a=_0x4a755d[_0xced5('0x71')][_0x580ffb];var _0x4cb9ca=_0x2c698c[_0xced5('0x5e')]();_0x4cb9ca[_0xced5('0x4b')]('ut.UserId\x20=\x20?',_0x3de78a['id']);_0x2e924f[_0xced5('0x8d')](db['sequelize']['query'](_0x4cb9ca['toString'](),{'type':db[_0xced5('0x77')][_0xced5('0x8e')]['SELECT']})[_0xced5('0x2a')](function(_0x2609a1){if(_0x2609a1['length']===0x1){return _0x3de78a['id'];}else{var _0x58d319=_[_0xced5('0x8f')](_[_0xced5('0x3b')](_0x2609a1,'TeamId'),function(_0x1afa96){return _[_0xced5('0x90')](_0x4fa3a0,_0x1afa96);});if(_0x58d319){return _0x3de78a['id'];}}}));}}return BPromise[_0xced5('0x91')](_0x2e924f)[_0xced5('0x2a')](function(_0x4c1e40){_0x15f48b=_(_0x15f48b)[_0xced5('0x92')](_0x4c1e40)[_0xced5('0x93')]()['value']();return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x5cce35['params']['id']}})[_0xced5('0x2a')](function(_0x20e3ca){return db[_0xced5('0x77')][_0xced5('0x78')](function(_0x335e8d){return _0x20e3ca[_0xced5('0x84')](_0x5cce35['query']['ids'],{'transaction':_0x335e8d})[_0xced5('0x2a')](function(){if(!_[_0xced5('0x94')](_0x15f48b)){return _0x20e3ca[_0xced5('0x95')](_0x15f48b,{'transaction':_0x335e8d})[_0xced5('0x2a')](function(){return db[_0xced5('0x7e')][_0xced5('0x36')]({'where':{'VoiceQueueId':_0x5cce35['params']['id'],'UserId':_0x15f48b},'transaction':_0x335e8d});});}})[_0xced5('0x2a')](function(){_0x15f48b[_0xced5('0x75')](function(_0x1a32a1){socket['emit'](_0xced5('0x96'),{'UserId':_0x1a32a1,'VoiceQueueId':_0x20e3ca['id']});});});});});});})['then'](respondWithStatusCode(_0x53b436,null))['catch'](handleError(_0x53b436,null));};exports['addAgents']=function(_0x14e5db,_0x2ac4d5,_0x30f57b){var _0x298cf8,_0x58522b;return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x14e5db['params']['id']}})['then'](handleEntityNotFound(_0x2ac4d5,null))['then'](function(_0x2690d7){if(_0x2690d7){_0x58522b=_0x2690d7;return _0x2690d7[_0xced5('0x97')](_0x14e5db[_0xced5('0x56')][_0xced5('0x85')],_[_0xced5('0x98')](_0x14e5db[_0xced5('0x56')],[_0xced5('0x85'),'id'])||{})[_0xced5('0x99')](function(_0x475083){for(var _0x28d57b=0x0;_0x28d57b<_0x14e5db['body'][_0xced5('0x85')][_0xced5('0x46')];_0x28d57b+=0x1){socket[_0xced5('0x82')](_0xced5('0x83'),{'UserId':Number(_0x14e5db[_0xced5('0x56')][_0xced5('0x85')][_0x28d57b]),'VoiceQueueId':Number(_0x14e5db[_0xced5('0x54')]['id'])});}return _0x475083;});}})[_0xced5('0x2a')](function(_0x25a584){_0x298cf8=_0x25a584||[];if(_0x58522b){return db['User']['findAll']({'where':{'id':_0x14e5db[_0xced5('0x56')][_0xced5('0x85')]},'attributes':['id',_0xced5('0x34'),_0xced5('0x72'),_0xced5('0x81'),_0xced5('0x73')],'raw':!![]});}})[_0xced5('0x2a')](function(_0x491fb7){if(!_[_0xced5('0x94')](_0x491fb7)){var _0x45a1d1=[];for(var _0x5e4dfe=0x0;_0x5e4dfe<_0x491fb7[_0xced5('0x46')];_0x5e4dfe++){if(_0x491fb7[_0x5e4dfe]['online']){_0x45a1d1['push'](db[_0xced5('0x7e')]['upsert']({'membername':_0x491fb7[_0x5e4dfe][_0xced5('0x34')],'UserId':_0x491fb7[_0x5e4dfe]['id'],'queue_name':_0x58522b[_0xced5('0x34')],'VoiceQueueId':_0x58522b['id'],'interface':_[_0xced5('0x7f')](_0x491fb7[_0x5e4dfe]['interface'])?util[_0xced5('0x80')](_0xced5('0x9a'),_0x491fb7[_0x5e4dfe][_0xced5('0x34')]):_0x491fb7[_0x5e4dfe][_0xced5('0x73')],'paused':_0x491fb7[_0x5e4dfe][_0xced5('0x81')]||![],'penalty':_0x14e5db[_0xced5('0x56')][_0xced5('0x76')]||0x0}));}}return BPromise['all'](_0x45a1d1);}})[_0xced5('0x2a')](function(){return _0x298cf8;})[_0xced5('0x2a')](respondWithResult(_0x2ac4d5,null))[_0xced5('0x52')](handleError(_0x2ac4d5,null));};exports[_0xced5('0x95')]=function(_0x46081c,_0x6d114f,_0x5545fb){return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x46081c['params']['id']}})['then'](handleEntityNotFound(_0x6d114f,null))[_0xced5('0x2a')](function(_0x2a4bf1){if(_0x2a4bf1){return _0x2a4bf1['removeAgents'](_0x46081c['query'][_0xced5('0x85')])[_0xced5('0x2a')](function(){if(_[_0xced5('0x9b')](_0x46081c[_0xced5('0x40')][_0xced5('0x85')])){for(var _0x1bc1e4=0x0;_0x1bc1e4<_0x46081c[_0xced5('0x40')]['ids'][_0xced5('0x46')];_0x1bc1e4+=0x1){socket[_0xced5('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0x46081c[_0xced5('0x40')][_0xced5('0x85')][_0x1bc1e4]),'VoiceQueueId':Number(_0x46081c['params']['id'])});}}else{socket['emit'](_0xced5('0x96'),{'UserId':Number(_0x46081c[_0xced5('0x40')]['ids']),'VoiceQueueId':Number(_0x46081c['params']['id'])});}});}})['then'](function(_0x542f0d){return db['UserVoiceQueueRt'][_0xced5('0x36')]({'where':{'VoiceQueueId':_0x46081c[_0xced5('0x54')]['id'],'UserId':_0x46081c['query'][_0xced5('0x85')]}})[_0xced5('0x2a')](function(){return _0x542f0d;});})['then'](respondWithStatusCode(_0x6d114f,null))[_0xced5('0x52')](handleError(_0x6d114f,null));};exports[_0xced5('0x9c')]=function(_0x40429e,_0x4b3d25,_0x47134b){var _0x121ddc={};var _0x1d7b28={};var _0x2a2eaa;var _0x53d0d8;return db[_0xced5('0x50')]['findOne']({'where':{'id':_0x40429e[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x4b3d25,null))['then'](function(_0x17087c){if(_0x17087c){_0x2a2eaa=_0x17087c;_0x1d7b28[_0xced5('0x3f')]=_[_0xced5('0x41')](db[_0xced5('0x70')][_0xced5('0x3c')]);_0x1d7b28[_0xced5('0x40')]=_[_0xced5('0x41')](_0x40429e[_0xced5('0x40')]);_0x1d7b28[_0xced5('0x42')]=_[_0xced5('0x43')](_0x1d7b28['model'],_0x1d7b28[_0xced5('0x40')]);_0x121ddc[_0xced5('0x44')]=_[_0xced5('0x43')](_0x1d7b28[_0xced5('0x3f')],qs[_0xced5('0x45')](_0x40429e['query']['fields']));_0x121ddc[_0xced5('0x44')]=_0x121ddc[_0xced5('0x44')][_0xced5('0x46')]?_0x121ddc[_0xced5('0x44')]:_0x1d7b28[_0xced5('0x3f')];_0x121ddc['order']=qs[_0xced5('0x49')](_0x40429e[_0xced5('0x40')]['sort']);_0x121ddc[_0xced5('0x4b')]=qs['filters'](_[_0xced5('0x4a')](_0x40429e[_0xced5('0x40')],_0x1d7b28[_0xced5('0x42')]));if(_0x40429e['query']['filter']){_0x121ddc[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x121ddc['where'],{'$or':_[_0xced5('0x3b')](_0x121ddc['attributes'],function(_0x2a1eb6){var _0x59c5cf={};_0x59c5cf[_0x2a1eb6]={'$like':'%'+_0x40429e['query'][_0xced5('0x30')]+'%'};return _0x59c5cf;})});}_0x121ddc=_[_0xced5('0x4c')]({},_0x121ddc,_0x40429e[_0xced5('0x5f')]);return _0x2a2eaa['getAgents'](_0x121ddc);}})[_0xced5('0x2a')](function(_0x206050){if(_0x206050){_0x53d0d8=_0x206050['length'];if(!_0x40429e[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x121ddc['limit']=qs[_0xced5('0x22')](_0x40429e[_0xced5('0x40')]['limit']);_0x121ddc[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x40429e[_0xced5('0x40')][_0xced5('0x21')]);}return _0x2a2eaa[_0xced5('0x9c')](_0x121ddc);}})[_0xced5('0x2a')](function(_0x211b7a){if(_0x211b7a){return _0x211b7a?{'count':_0x53d0d8,'rows':_0x211b7a}:null;}})[_0xced5('0x2a')](respondWithResult(_0x4b3d25,null))[_0xced5('0x52')](handleError(_0x4b3d25,null));};exports[_0xced5('0x9d')]=function(_0x435e14,_0x191fcb,_0x5487f4){var _0x47caa3={};var _0x1a2ab5={};var _0x28afb0;var _0x2b02f3;return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x435e14[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x191fcb,null))[_0xced5('0x2a')](function(_0x18c67e){if(_0x18c67e){_0x28afb0=_0x18c67e;_0x1a2ab5[_0xced5('0x3f')]=_[_0xced5('0x41')](db['UserVoiceQueueRt'][_0xced5('0x3c')]);_0x1a2ab5['query']=_[_0xced5('0x41')](_0x435e14[_0xced5('0x40')]);_0x1a2ab5[_0xced5('0x42')]=_[_0xced5('0x43')](_0x1a2ab5[_0xced5('0x3f')],_0x1a2ab5['query']);_0x47caa3[_0xced5('0x44')]=_[_0xced5('0x43')](_0x1a2ab5[_0xced5('0x3f')],qs['fields'](_0x435e14[_0xced5('0x40')][_0xced5('0x45')]));_0x47caa3[_0xced5('0x44')]=_0x47caa3['attributes']['length']?_0x47caa3[_0xced5('0x44')]:_0x1a2ab5[_0xced5('0x3f')];_0x47caa3[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x435e14['query'][_0xced5('0x49')]);_0x47caa3['where']=qs[_0xced5('0x42')](_['pick'](_0x435e14[_0xced5('0x40')],_0x1a2ab5[_0xced5('0x42')]));if(_0x435e14[_0xced5('0x40')][_0xced5('0x30')]){_0x47caa3[_0xced5('0x4b')]=_['merge'](_0x47caa3[_0xced5('0x4b')],{'$or':_[_0xced5('0x3b')](_0x47caa3[_0xced5('0x44')],function(_0x56d82b){var _0x56b4f2={};_0x56b4f2[_0x56d82b]={'$like':'%'+_0x435e14[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x56b4f2;})});}_0x47caa3=_[_0xced5('0x4c')]({},_0x47caa3,_0x435e14['options']);return _0x28afb0[_0xced5('0x9d')](_0x47caa3);}})[_0xced5('0x2a')](function(_0x21d5d2){if(_0x21d5d2){_0x2b02f3=_0x21d5d2[_0xced5('0x46')];if(!_0x435e14[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x47caa3[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x435e14['query']['limit']);_0x47caa3[_0xced5('0x21')]=qs['offset'](_0x435e14[_0xced5('0x40')][_0xced5('0x21')]);}return _0x28afb0[_0xced5('0x9d')](_0x47caa3);}})[_0xced5('0x2a')](function(_0x15395e){return _0x15395e?{'count':_0x2b02f3,'rows':_0x15395e}:null;})[_0xced5('0x2a')](respondWithResult(_0x191fcb,null))[_0xced5('0x52')](handleError(_0x191fcb,null));};exports['getLists']=function(_0x319be2,_0x2a3438,_0x527753){var _0x251991={};var _0x4650da={};var _0x4a5fcb;var _0xbc24ca;return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x319be2['params']['id']}})['then'](handleEntityNotFound(_0x2a3438,null))[_0xced5('0x2a')](function(_0x340608){if(_0x340608){_0x4a5fcb=_0x340608;_0x4650da[_0xced5('0x3f')]=_['keys'](db[_0xced5('0x9e')]['rawAttributes']);_0x4650da[_0xced5('0x40')]=_[_0xced5('0x41')](_0x319be2[_0xced5('0x40')]);_0x4650da[_0xced5('0x42')]=_['intersection'](_0x4650da['model'],_0x4650da[_0xced5('0x40')]);_0x251991[_0xced5('0x44')]=_[_0xced5('0x43')](_0x4650da['model'],qs[_0xced5('0x45')](_0x319be2[_0xced5('0x40')][_0xced5('0x45')]));_0x251991[_0xced5('0x44')]=_0x251991[_0xced5('0x44')][_0xced5('0x46')]?_0x251991[_0xced5('0x44')]:_0x4650da[_0xced5('0x3f')];_0x251991[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x319be2[_0xced5('0x40')][_0xced5('0x49')]);_0x251991[_0xced5('0x4b')]=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x319be2[_0xced5('0x40')],_0x4650da['filters']));if(_0x319be2[_0xced5('0x40')]['filter']){_0x251991[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x251991[_0xced5('0x4b')],{'$or':_['map'](_0x251991[_0xced5('0x44')],function(_0xa93acf){var _0x126cf0={};_0x126cf0[_0xa93acf]={'$like':'%'+_0x319be2[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x126cf0;})});}_0x251991=_[_0xced5('0x4c')]({},_0x251991,_0x319be2[_0xced5('0x5f')]);return _0x4a5fcb['getLists'](_0x251991);}})[_0xced5('0x2a')](function(_0x1a185b){if(_0x1a185b){_0xbc24ca=_0x1a185b[_0xced5('0x46')];if(!_0x319be2['query'][_0xced5('0x66')](_0xced5('0x47'))){_0x251991[_0xced5('0x22')]=qs[_0xced5('0x22')](_0x319be2[_0xced5('0x40')][_0xced5('0x22')]);_0x251991[_0xced5('0x21')]=qs['offset'](_0x319be2[_0xced5('0x40')]['offset']);}return _0x4a5fcb[_0xced5('0x9f')](_0x251991);}})[_0xced5('0x2a')](function(_0x18ff11){if(_0x18ff11){return _0x18ff11?{'count':_0xbc24ca,'rows':_0x18ff11}:null;}})['then'](respondWithResult(_0x2a3438,null))[_0xced5('0x52')](handleError(_0x2a3438,null));};exports[_0xced5('0xa0')]=function(_0x2b4903,_0x539393,_0x26e288){var _0x45dd46=moment()[_0xced5('0x80')]('YYYY-MM-DD\x20HH:mm:ss');var _0xab1896,_0x31da3c;return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x2b4903[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x539393,null))[_0xced5('0x2a')](function(_0x165f87){if(_0x165f87){_0x31da3c=_0x165f87;return _0x165f87[_0xced5('0xa0')](_0x2b4903[_0xced5('0x56')]['ids'],_['omit'](_0x2b4903[_0xced5('0x56')],[_0xced5('0x85'),'id'])||{});}return null;})['spread'](function(_0x835dbb){var _0x15f489;_0xab1896=_0x835dbb||[];var _0x2e2e46=[];if(_0x835dbb){for(var _0x15ba88=0x0;_0x15ba88<_0x835dbb['length'];_0x15ba88+=0x1){var _0x1dea62=_0x835dbb[_0x15ba88][_0xced5('0x2b')]({'plain':!![]});_0x31da3c[_0xced5('0xa1')]=_0x2b4903[_0xced5('0x56')][_0xced5('0xa1')]?_0x2b4903[_0xced5('0x56')][_0xced5('0xa1')]:_0x31da3c[_0xced5('0xa1')];switch(_0x31da3c[_0xced5('0xa1')]){case _0xced5('0xa2'):_0x15f489=squel[_0xced5('0xa3')]()[_0xced5('0xa4')](_0xced5('0xa5'))[_0xced5('0xa6')](['phone',_0xced5('0xa7'),'ContactId',_0xced5('0xa8'),_0xced5('0x67'),'createdAt',_0xced5('0x61')],squel['select']()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))['field']('\x27'+_0x45dd46+'\x27',_0xced5('0xa7'))[_0xced5('0x87')]('id','ContactId')[_0xced5('0x87')](_0x1dea62[_0xced5('0xaa')][_0xced5('0xab')](),_0xced5('0xa8'))[_0xced5('0x87')](_0x2b4903['params']['id'][_0xced5('0xab')](),_0xced5('0x67'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))['field']('\x27'+_0x45dd46+'\x27',_0xced5('0x61'))[_0xced5('0x89')](_0xced5('0xac'))[_0xced5('0x4b')](_0xced5('0xad'))[_0xced5('0x4b')]('ListId\x20=\x20?',_0x1dea62[_0xced5('0xaa')]['toString']())[_0xced5('0x4b')](_0xced5('0xae'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xaf'))[_0xced5('0x89')](_0xced5('0xb0'))['where'](_0xced5('0xb1'),_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')]()))['where'](_0xced5('0xb2'),squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xb3'))[_0xced5('0x89')](_0xced5('0xa5'))['where'](_0xced5('0xb1'),_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')]())))['toString']();break;case _0xced5('0xb4'):_0x15f489=squel[_0xced5('0xa3')]()[_0xced5('0xa4')]('cm_hopper')['fromQuery']([_0xced5('0xa9'),_0xced5('0xa7'),_0xced5('0xb5'),_0xced5('0xa8'),'VoiceQueueId','createdAt',_0xced5('0x61')],squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0xa7'))[_0xced5('0x87')]('id',_0xced5('0xb5'))['field'](_0x1dea62['CmListId']['toString'](),'ListId')[_0xced5('0x87')](_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')](),_0xced5('0x67'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x61'))[_0xced5('0x89')]('cm_contacts')['where'](_0xced5('0xad'))[_0xced5('0x4b')](_0xced5('0xb6'),_0x1dea62[_0xced5('0xaa')][_0xced5('0xab')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xced5('0x4b')](_0xced5('0xb2'),squel[_0xced5('0x86')]()['field']('COALESCE(phone,\x27\x27)')[_0xced5('0x89')](_0xced5('0xa5'))[_0xced5('0x4b')](_0xced5('0xb1'),_0x2b4903[_0xced5('0x54')]['id'][_0xced5('0xab')]())))['toString']();break;default:_0x15f489=squel[_0xced5('0xa3')]()['into'](_0xced5('0xa5'))[_0xced5('0xa6')]([_0xced5('0xa9'),'scheduledAt','ContactId',_0xced5('0xa8'),'VoiceQueueId',_0xced5('0x60'),_0xced5('0x61')],squel[_0xced5('0x86')]()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0xa7'))[_0xced5('0x87')]('id',_0xced5('0xb5'))[_0xced5('0x87')](_0x1dea62[_0xced5('0xaa')][_0xced5('0xab')](),_0xced5('0xa8'))['field'](_0x2b4903['params']['id'][_0xced5('0xab')](),_0xced5('0x67'))['field']('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27','updatedAt')[_0xced5('0x89')]('cm_contacts')[_0xced5('0x4b')](_0xced5('0xad'))[_0xced5('0x4b')](_0xced5('0xb6'),_0x1dea62['CmListId'][_0xced5('0xab')]())['where'](_0xced5('0xae')))[_0xced5('0xab')]();}_0x2e2e46[_0xced5('0x8d')](db[_0xced5('0x77')][_0xced5('0x40')](_0x15f489));}return BPromise[_0xced5('0x91')](_0x2e2e46);}})['then'](function(){var _0x1799ce=[];var _0x4b1af1=squel['insert']()[_0xced5('0xa4')](_0xced5('0xb7'))[_0xced5('0xa6')]([_0xced5('0xb8'),_0xced5('0xa9'),_0xced5('0xb9'),_0xced5('0x60'),'updatedAt'],squel[_0xced5('0x86')]()['field'](_0xced5('0xba'))[_0xced5('0x87')]('ci.item')[_0xced5('0x87')](_0xced5('0xbb'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x60'))[_0xced5('0x87')]('\x27'+_0x45dd46+'\x27',_0xced5('0x61'))[_0xced5('0x89')](_0xced5('0xbc'),'ci')['join']('cm_hopper','h',_0xced5('0xbd'))[_0xced5('0x4b')](_0xced5('0xbe'),_0x45dd46)[_0xced5('0x4b')](_0xced5('0xbf'),_0xced5('0xc0')))['toString']();_0x1799ce[_0xced5('0x8d')](db[_0xced5('0x77')][_0xced5('0x40')](_0x4b1af1));return BPromise[_0xced5('0x91')](_0x1799ce);})[_0xced5('0x2a')](function(){return _0xab1896;})[_0xced5('0x2a')](respondWithResult(_0x539393,null))[_0xced5('0x52')](handleError(_0x539393,null));};exports['removeLists']=function(_0x460edc,_0x2b5b8b,_0x1dbbd5){return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x460edc['params']['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x2b5b8b,null))[_0xced5('0x2a')](function(_0x3b306b){if(_0x3b306b){return _0x3b306b[_0xced5('0xc1')](_0x460edc[_0xced5('0x40')]['ids']);}})[_0xced5('0x2a')](function(_0x455fb9){if(_0x455fb9){return db[_0xced5('0x65')]['destroy']({'where':{'ListId':_0x460edc['query'][_0xced5('0x85')],'VoiceQueueId':_0x460edc[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](function(){return _0x455fb9;});}})[_0xced5('0x2a')](respondWithStatusCode(_0x2b5b8b,null))[_0xced5('0x52')](handleError(_0x2b5b8b,null));};exports['getBlackLists']=function(_0x422629,_0x2ae75c,_0xdd023d){var _0x471af0={};var _0x2c82c6={};var _0xa03e29;var _0x207cfc;return db[_0xced5('0x50')][_0xced5('0x64')]({'where':{'id':_0x422629[_0xced5('0x54')]['id']}})['then'](handleEntityNotFound(_0x2ae75c,null))[_0xced5('0x2a')](function(_0x2e9c49){if(_0x2e9c49){_0xa03e29=_0x2e9c49;_0x2c82c6['model']=_[_0xced5('0x41')](db[_0xced5('0x9e')][_0xced5('0x3c')]);_0x2c82c6[_0xced5('0x40')]=_[_0xced5('0x41')](_0x422629[_0xced5('0x40')]);_0x2c82c6['filters']=_[_0xced5('0x43')](_0x2c82c6[_0xced5('0x3f')],_0x2c82c6[_0xced5('0x40')]);_0x471af0[_0xced5('0x44')]=_[_0xced5('0x43')](_0x2c82c6[_0xced5('0x3f')],qs['fields'](_0x422629[_0xced5('0x40')]['fields']));_0x471af0[_0xced5('0x44')]=_0x471af0[_0xced5('0x44')][_0xced5('0x46')]?_0x471af0[_0xced5('0x44')]:_0x2c82c6[_0xced5('0x3f')];_0x471af0[_0xced5('0x48')]=qs[_0xced5('0x49')](_0x422629['query'][_0xced5('0x49')]);_0x471af0['where']=qs[_0xced5('0x42')](_[_0xced5('0x4a')](_0x422629['query'],_0x2c82c6[_0xced5('0x42')]));if(_0x422629['query'][_0xced5('0x30')]){_0x471af0[_0xced5('0x4b')]=_[_0xced5('0x4c')](_0x471af0['where'],{'$or':_['map'](_0x471af0[_0xced5('0x44')],function(_0x5d0b72){var _0x109cbd={};_0x109cbd[_0x5d0b72]={'$like':'%'+_0x422629[_0xced5('0x40')][_0xced5('0x30')]+'%'};return _0x109cbd;})});}_0x471af0=_[_0xced5('0x4c')]({},_0x471af0,_0x422629[_0xced5('0x5f')]);return _0xa03e29[_0xced5('0xc2')](_0x471af0);}})[_0xced5('0x2a')](function(_0x4be1c5){if(_0x4be1c5){_0x207cfc=_0x4be1c5[_0xced5('0x46')];if(!_0x422629[_0xced5('0x40')][_0xced5('0x66')](_0xced5('0x47'))){_0x471af0[_0xced5('0x22')]=qs['limit'](_0x422629[_0xced5('0x40')][_0xced5('0x22')]);_0x471af0[_0xced5('0x21')]=qs[_0xced5('0x21')](_0x422629[_0xced5('0x40')]['offset']);}return _0xa03e29[_0xced5('0xc2')](_0x471af0);}})[_0xced5('0x2a')](function(_0x2b5cf7){if(_0x2b5cf7){return _0x2b5cf7?{'count':_0x207cfc,'rows':_0x2b5cf7}:null;}})[_0xced5('0x2a')](respondWithResult(_0x2ae75c,null))[_0xced5('0x52')](handleError(_0x2ae75c,null));};exports[_0xced5('0xc3')]=function(_0x5e07ef,_0x261063,_0xe68a26){var _0x3600c2,_0x515afc;return db['VoiceQueue'][_0xced5('0x59')]({'where':{'id':_0x5e07ef[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x261063,null))[_0xced5('0x2a')](function(_0x215df1){if(_0x215df1){_0x515afc=_0x215df1;return _0x215df1[_0xced5('0xc3')](_0x5e07ef[_0xced5('0x56')][_0xced5('0x85')],_[_0xced5('0x98')](_0x5e07ef[_0xced5('0x56')],['ids','id'])||{});}return null;})[_0xced5('0x99')](function(_0x25277f){var _0x30e0fc;_0x3600c2=_0x25277f||[];var _0x269438=[];if(_0x25277f){for(var _0x5191c4=0x0;_0x5191c4<_0x25277f[_0xced5('0x46')];_0x5191c4+=0x1){var _0xc86886=_0x25277f[_0x5191c4][_0xced5('0x2b')]({'plain':!![]});_0x30e0fc=squel[_0xced5('0xa3')]()[_0xced5('0xa4')](_0xced5('0xc4'))[_0xced5('0xa6')]([_0xced5('0xa9'),_0xced5('0xb5'),_0xced5('0xa8'),_0xced5('0x67'),_0xced5('0x60'),_0xced5('0x61')],squel['select']()[_0xced5('0x87')](_0xced5('0xa9'),_0xced5('0xa9'))['field']('id','ContactId')['field'](_0xc86886[_0xced5('0xaa')][_0xced5('0xab')](),_0xced5('0xa8'))[_0xced5('0x87')](_0x5e07ef['params']['id'][_0xced5('0xab')](),_0xced5('0x67'))[_0xced5('0x87')]('NOW()',_0xced5('0x60'))['field'](_0xced5('0xc5'),'updatedAt')[_0xced5('0x89')](_0xced5('0xac'))[_0xced5('0x4b')]('deletedAt\x20IS\x20NULL')[_0xced5('0x4b')]('ListId\x20=\x20?',_0xc86886['CmListId'][_0xced5('0xab')]())[_0xced5('0x4b')](_0xced5('0xae')))[_0xced5('0xab')]();_0x269438[_0xced5('0x8d')](db['sequelize'][_0xced5('0x40')](_0x30e0fc));}return BPromise['all'](_0x269438);}})[_0xced5('0x2a')](function(){return _0x3600c2;})['then'](respondWithResult(_0x261063,null))['catch'](handleError(_0x261063,null));};exports[_0xced5('0xc6')]=function(_0x586f18,_0x1451dc,_0x2cb10d){return db[_0xced5('0x50')][_0xced5('0x59')]({'where':{'id':_0x586f18[_0xced5('0x54')]['id']}})[_0xced5('0x2a')](handleEntityNotFound(_0x1451dc,null))[_0xced5('0x2a')](function(_0x441118){if(_0x441118){return _0x441118[_0xced5('0xc6')](_0x586f18[_0xced5('0x40')][_0xced5('0x85')]);}})[_0xced5('0x2a')](function(_0x2b2da8){if(_0x2b2da8){return db[_0xced5('0x6c')][_0xced5('0x36')]({'where':{'ListId':_0x586f18['query']['ids'],'VoiceQueueId':_0x586f18['params']['id']}})[_0xced5('0x2a')](function(){return _0x2b2da8;});}})['then'](respondWithStatusCode(_0x1451dc,null))[_0xced5('0x52')](handleError(_0x1451dc,null));}; \ No newline at end of file +var _0x8458=['into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','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','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','offset','count','Content-Range','apply','reject','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','params','VoiceQueue','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','body','updatedAt','role','autoAssociation','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','ids','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','User','isNil','all','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert'];(function(_0x34b1e5,_0x301a05){var _0x11d5c6=function(_0x1cc29c){while(--_0x1cc29c){_0x34b1e5['push'](_0x34b1e5['shift']());}};_0x11d5c6(++_0x301a05);}(_0x8458,0x1a5));var _0x8845=function(_0x713a42,_0x384115){_0x713a42=_0x713a42-0x0;var _0x214127=_0x8458[_0x713a42];return _0x214127;};'use strict';var emlformat=require(_0x8845('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8845('0x1'));var jsonpatch=require(_0x8845('0x2'));var rp=require(_0x8845('0x3'));var moment=require(_0x8845('0x4'));var BPromise=require(_0x8845('0x5'));var Mustache=require('mustache');var util=require(_0x8845('0x6'));var path=require(_0x8845('0x7'));var sox=require(_0x8845('0x8'));var csv=require(_0x8845('0x9'));var ejs=require(_0x8845('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8845('0xb'));var squel=require('squel');var crypto=require(_0x8845('0xc'));var jsforce=require(_0x8845('0xd'));var deskjs=require(_0x8845('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8845('0xf'));var Papa=require(_0x8845('0x10'));var Redis=require('ioredis');var authService=require(_0x8845('0x11'));var qs=require(_0x8845('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8845('0x13'));var logger=require(_0x8845('0x14'))(_0x8845('0x15'));var utils=require(_0x8845('0x16'));var config=require(_0x8845('0x17'));var licenseUtil=require(_0x8845('0x18'));var db=require(_0x8845('0x19'))['db'];config[_0x8845('0x1a')]=_[_0x8845('0x1b')](config[_0x8845('0x1a')],{'host':_0x8845('0x1c'),'port':0x18eb});var socket=require(_0x8845('0x1d'))(new Redis(config[_0x8845('0x1a')]));require(_0x8845('0x1e'))['register'](socket);function respondWithStatusCode(_0x110541,_0x26d210){_0x26d210=_0x26d210||0xcc;return function(_0x5cb103){if(_0x5cb103){return _0x110541[_0x8845('0x1f')](_0x26d210);}return _0x110541[_0x8845('0x20')](_0x26d210)[_0x8845('0x21')]();};}function respondWithResult(_0x4e56d2,_0x578249){_0x578249=_0x578249||0xc8;return function(_0x5cd0e9){if(_0x5cd0e9){return _0x4e56d2[_0x8845('0x20')](_0x578249)[_0x8845('0x22')](_0x5cd0e9);}};}function respondWithFilteredResult(_0x41c8dc,_0x131faa){return function(_0x10f1d5){if(_0x10f1d5){var _0x27761f=typeof _0x131faa[_0x8845('0x23')]==='undefined'&&typeof _0x131faa['limit']==='undefined';var _0x2afdda=_0x10f1d5[_0x8845('0x24')];var _0x122c92=_0x27761f?0x0:_0x131faa[_0x8845('0x23')];var _0x49ec66=_0x27761f?_0x10f1d5[_0x8845('0x24')]:_0x131faa['offset']+_0x131faa['limit'];var _0x1ccdca;if(_0x49ec66>=_0x2afdda){_0x49ec66=_0x2afdda;_0x1ccdca=0xc8;}else{_0x1ccdca=0xce;}_0x41c8dc[_0x8845('0x20')](_0x1ccdca);return _0x41c8dc['set'](_0x8845('0x25'),_0x122c92+'-'+_0x49ec66+'/'+_0x2afdda)[_0x8845('0x22')](_0x10f1d5);}return null;};}function patchUpdates(_0x597fc5){return function(_0x1a40a9){try{jsonpatch[_0x8845('0x26')](_0x1a40a9,_0x597fc5,!![]);}catch(_0x2b7ad7){return BPromise[_0x8845('0x27')](_0x2b7ad7);}return _0x1a40a9['save']();};}function saveUpdates(_0x5cd766,_0x3b5e36){return function(_0x1e93f8){if(_0x1e93f8){return _0x1e93f8[_0x8845('0x28')](_0x5cd766)[_0x8845('0x29')](function(_0x3d2fca){return _0x3d2fca;});}return null;};}function removeEntity(_0x18819c,_0x37eea4){return function(_0x1233a4){if(_0x1233a4){return _0x1233a4[_0x8845('0x2a')]()[_0x8845('0x29')](function(){var _0x3e1e6e=_0x1233a4[_0x8845('0x2b')]({'plain':!![]});var _0x3d8c5d=[{'name':_0x8845('0x2c'),'value':_0x8845('0x2d'),'ignore':![]},{'name':_0x8845('0x2e'),'value':_0x8845('0x2f'),'ignore':![]}];var _0x5e30a4=_(_0x3d8c5d)['filter'](_0x8845('0x30'))[_0x8845('0x31')](_0x8845('0x32'))[_0x8845('0x32')]();if(_[_0x8845('0x33')](_0x5e30a4,_0x3e1e6e[_0x8845('0x34')])){return;}var _0x1844b6=_['find'](_0x3d8c5d,[_0x8845('0x32'),_0x3e1e6e[_0x8845('0x34')]])['name'];return db[_0x8845('0x35')][_0x8845('0x2a')]({'where':{'type':_0x1844b6,'resourceId':_0x3e1e6e['id']}})[_0x8845('0x29')](function(){return _0x1233a4;});})[_0x8845('0x29')](function(){_0x18819c[_0x8845('0x20')](0xcc)[_0x8845('0x21')]();});}};}function handleEntityNotFound(_0x369d85,_0x1a400d){return function(_0x482ccc){if(!_0x482ccc){_0x369d85['sendStatus'](0x194);}return _0x482ccc;};}function handleError(_0x3c6354,_0x5c7e4b){_0x5c7e4b=_0x5c7e4b||0x1f4;return function(_0x5acf88){logger[_0x8845('0x36')](_0x5acf88[_0x8845('0x37')]);if(_0x5acf88[_0x8845('0x38')]){delete _0x5acf88['name'];}_0x3c6354['status'](_0x5c7e4b)[_0x8845('0x39')](_0x5acf88);};}exports['index']=function(_0x19011a,_0x21e581){var _0x359581={},_0x4a2ee0={},_0x367b8e={'count':0x0,'rows':[]};var _0x28daab=_[_0x8845('0x31')](db['VoiceQueue'][_0x8845('0x3a')],function(_0x4db66f){return{'name':_0x4db66f[_0x8845('0x3b')],'type':_0x4db66f[_0x8845('0x34')][_0x8845('0x3c')]};});_0x4a2ee0[_0x8845('0x3d')]=_[_0x8845('0x31')](_0x28daab,_0x8845('0x38'));_0x4a2ee0[_0x8845('0x3e')]=_[_0x8845('0x3f')](_0x19011a['query']);_0x4a2ee0[_0x8845('0x40')]=_['intersection'](_0x4a2ee0[_0x8845('0x3d')],_0x4a2ee0['query']);_0x359581[_0x8845('0x41')]=_[_0x8845('0x42')](_0x4a2ee0['model'],qs[_0x8845('0x43')](_0x19011a['query'][_0x8845('0x43')]));_0x359581[_0x8845('0x41')]=_0x359581[_0x8845('0x41')][_0x8845('0x44')]?_0x359581[_0x8845('0x41')]:_0x4a2ee0[_0x8845('0x3d')];if(!_0x19011a[_0x8845('0x3e')][_0x8845('0x45')](_0x8845('0x46'))){_0x359581[_0x8845('0x47')]=qs['limit'](_0x19011a[_0x8845('0x3e')]['limit']);_0x359581[_0x8845('0x23')]=qs[_0x8845('0x23')](_0x19011a['query'][_0x8845('0x23')]);}_0x359581[_0x8845('0x48')]=qs[_0x8845('0x49')](_0x19011a['query'][_0x8845('0x49')]);_0x359581['where']=qs['filters'](_[_0x8845('0x4a')](_0x19011a[_0x8845('0x3e')],_0x4a2ee0[_0x8845('0x40')]),_0x28daab);if(_0x19011a[_0x8845('0x3e')][_0x8845('0x4b')]){_0x359581[_0x8845('0x4c')]=_['merge'](_0x359581['where'],{'$or':_[_0x8845('0x31')](_0x28daab,function(_0x12f59c){if(_0x12f59c[_0x8845('0x34')]!==_0x8845('0x4d')){var _0x2cc389={};_0x2cc389[_0x12f59c[_0x8845('0x38')]]={'$like':'%'+_0x19011a[_0x8845('0x3e')][_0x8845('0x4b')]+'%'};return _0x2cc389;}})});}_0x359581=_['merge']({},_0x359581,_0x19011a[_0x8845('0x4e')]);var _0x344105={'where':_0x359581[_0x8845('0x4c')]};return db['VoiceQueue'][_0x8845('0x24')](_0x344105)[_0x8845('0x29')](function(_0x3ac52c){_0x367b8e[_0x8845('0x24')]=_0x3ac52c;if(_0x19011a[_0x8845('0x3e')][_0x8845('0x4f')]){_0x359581['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x8845('0x50')](_0x359581);})[_0x8845('0x29')](function(_0x48ac10){_0x367b8e[_0x8845('0x51')]=_0x48ac10;return _0x367b8e;})[_0x8845('0x29')](respondWithFilteredResult(_0x21e581,_0x359581))[_0x8845('0x52')](handleError(_0x21e581,null));};exports['show']=function(_0x41738f,_0x596ff1){var _0x59af66={'raw':![],'where':{'id':_0x41738f[_0x8845('0x53')]['id']}},_0x1def62={};_0x1def62[_0x8845('0x3d')]=_[_0x8845('0x3f')](db[_0x8845('0x54')][_0x8845('0x3a')]);_0x1def62['query']=_[_0x8845('0x3f')](_0x41738f['query']);_0x1def62[_0x8845('0x40')]=_[_0x8845('0x42')](_0x1def62[_0x8845('0x3d')],_0x1def62[_0x8845('0x3e')]);_0x59af66['attributes']=_[_0x8845('0x42')](_0x1def62[_0x8845('0x3d')],qs[_0x8845('0x43')](_0x41738f[_0x8845('0x3e')][_0x8845('0x43')]));_0x59af66[_0x8845('0x41')]=_0x59af66[_0x8845('0x41')]['length']?_0x59af66[_0x8845('0x41')]:_0x1def62[_0x8845('0x3d')];if(_0x41738f[_0x8845('0x3e')][_0x8845('0x4f')]){_0x59af66[_0x8845('0x55')]=[{'all':!![]}];}_0x59af66=_['merge']({},_0x59af66,_0x41738f[_0x8845('0x4e')]);return db[_0x8845('0x54')][_0x8845('0x56')](_0x59af66)['then'](handleEntityNotFound(_0x596ff1,null))[_0x8845('0x29')](respondWithResult(_0x596ff1,null))[_0x8845('0x52')](handleError(_0x596ff1,null));};exports[_0x8845('0x57')]=function(_0x1a330e,_0x18804b){return db[_0x8845('0x54')]['create'](_0x1a330e['body'],{})[_0x8845('0x29')](function(_0x3d8589){var _0x56e565=_0x1a330e[_0x8845('0x58')][_0x8845('0x2b')]({'plain':!![]});if(!_0x56e565)throw new Error(_0x8845('0x59'));if(_0x56e565['role']===_0x8845('0x58')){var _0x2bb55d=_0x3d8589[_0x8845('0x2b')]({'plain':!![]});var _0x55fa92=[{'name':'VoiceQueues','value':_0x8845('0x2d')},{'name':_0x8845('0x2e'),'value':_0x8845('0x2f')}];var _0x1c21ad=_['find'](_0x55fa92,['value',_0x2bb55d[_0x8845('0x34')]])[_0x8845('0x38')];return db[_0x8845('0x5a')][_0x8845('0x56')]({'where':{'name':_0x1c21ad,'userProfileId':_0x56e565[_0x8845('0x5b')]},'raw':!![]})[_0x8845('0x29')](function(_0x20c676){if(_0x20c676&&_0x20c676['autoAssociation']===0x0){return db[_0x8845('0x35')]['create']({'name':_0x2bb55d[_0x8845('0x38')],'resourceId':_0x2bb55d['id'],'type':_0x20c676['name'],'sectionId':_0x20c676['id']},{})[_0x8845('0x29')](function(){return _0x3d8589;});}else{return _0x3d8589;}})[_0x8845('0x52')](function(_0x8ea040){logger[_0x8845('0x36')](_0x8845('0x5c'),_0x8ea040);throw _0x8ea040;});}return _0x3d8589;})[_0x8845('0x29')](respondWithResult(_0x18804b,0xc9))[_0x8845('0x52')](handleError(_0x18804b,null));};exports[_0x8845('0x5d')]=function(_0x58a1f3,_0x11952f){var _0x4483a2={'where':{'id':_0x58a1f3[_0x8845('0x53')]['id']}},_0x32f207={};_0x32f207['model']=_[_0x8845('0x3f')](db['VoiceQueue'][_0x8845('0x3a')]);_0x4483a2[_0x8845('0x41')]=_[_0x8845('0x42')](_0x32f207['model'],qs[_0x8845('0x43')](_0x58a1f3[_0x8845('0x3e')][_0x8845('0x43')]));_0x4483a2[_0x8845('0x41')]=_0x4483a2[_0x8845('0x41')][_0x8845('0x44')]?_0x4483a2['attributes']:_0x32f207[_0x8845('0x3d')];if(_0x58a1f3['query'][_0x8845('0x4f')]){_0x4483a2['include']=[{'all':!![]}];}_0x4483a2=_[_0x8845('0x5e')]({},_0x4483a2,_0x58a1f3[_0x8845('0x4e')]);return db[_0x8845('0x54')][_0x8845('0x56')](_0x4483a2)[_0x8845('0x29')](handleEntityNotFound(_0x11952f,null))[_0x8845('0x29')](function(_0x5f1dde){if(_0x5f1dde){var _0x39f260=_0x5f1dde[_0x8845('0x2b')]({'plain':!![]});_0x39f260=qs[_0x8845('0x5f')](_0x39f260,['id',_0x8845('0x60'),'updatedAt']);_0x58a1f3[_0x8845('0x61')]=_[_0x8845('0x5f')](_0x58a1f3[_0x8845('0x61')],['id',_0x8845('0x60'),_0x8845('0x62')]);return db[_0x8845('0x54')][_0x8845('0x57')](_[_0x8845('0x5e')](_0x39f260,_0x58a1f3[_0x8845('0x61')]),{'include':_0x58a1f3[_0x8845('0x3e')][_0x8845('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x50ee7e){var _0x1b42c8=_0x58a1f3['user'][_0x8845('0x2b')]({'plain':!![]});if(!_0x1b42c8)throw new Error(_0x8845('0x59'));if(_0x1b42c8[_0x8845('0x63')]===_0x8845('0x58')){var _0x48da6b=_0x50ee7e[_0x8845('0x2b')]({'plain':!![]});var _0x2ac74e=[{'name':_0x8845('0x2c'),'value':_0x8845('0x2d')},{'name':_0x8845('0x2e'),'value':_0x8845('0x2f')}];var _0x4f7101=_[_0x8845('0x56')](_0x2ac74e,[_0x8845('0x32'),_0x48da6b[_0x8845('0x34')]])[_0x8845('0x38')];return db[_0x8845('0x5a')][_0x8845('0x56')]({'where':{'name':_0x4f7101,'userProfileId':_0x1b42c8['userProfileId']},'raw':!![]})['then'](function(_0x4e76ab){if(_0x4e76ab&&_0x4e76ab[_0x8845('0x64')]===0x0){return db[_0x8845('0x35')][_0x8845('0x57')]({'name':_0x48da6b[_0x8845('0x38')],'resourceId':_0x48da6b['id'],'type':_0x4e76ab['name'],'sectionId':_0x4e76ab['id']},{})[_0x8845('0x29')](function(){return _0x50ee7e;});}else{return _0x50ee7e;}})[_0x8845('0x52')](function(_0xfd9b78){logger[_0x8845('0x36')](_0x8845('0x5c'),_0xfd9b78);throw _0xfd9b78;});}return _0x50ee7e;});}})['then'](respondWithResult(_0x11952f,0xc9))['catch'](handleError(_0x11952f,null));};exports[_0x8845('0x28')]=function(_0x25c7cf,_0x1fc488){if(_0x25c7cf['body']['id']){delete _0x25c7cf[_0x8845('0x61')]['id'];}return db[_0x8845('0x54')][_0x8845('0x56')]({'where':{'id':_0x25c7cf[_0x8845('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fc488,null))[_0x8845('0x29')](saveUpdates(_0x25c7cf[_0x8845('0x61')],null))['then'](respondWithResult(_0x1fc488,null))[_0x8845('0x52')](handleError(_0x1fc488,null));};exports['destroy']=function(_0x44f1da,_0x12c7fe){return db['VoiceQueue'][_0x8845('0x56')]({'where':{'id':_0x44f1da['params']['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x12c7fe,null))[_0x8845('0x29')](removeEntity(_0x12c7fe,null))['catch'](handleError(_0x12c7fe,null));};exports[_0x8845('0x65')]=function(_0x4834ac,_0x13c0c9,_0x399635){var _0x160f05={'raw':![],'where':{}};var _0x2e8c39={};var _0x341abf={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x8845('0x66')]({'where':{'id':_0x4834ac['params']['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x13c0c9,null))[_0x8845('0x29')](function(_0x4913b5){if(_0x4913b5){_0x2e8c39[_0x8845('0x3d')]=_[_0x8845('0x3f')](db['CmHopper'][_0x8845('0x3a')]);_0x2e8c39[_0x8845('0x3e')]=_[_0x8845('0x3f')](_0x4834ac['query']);_0x2e8c39[_0x8845('0x40')]=_[_0x8845('0x42')](_0x2e8c39[_0x8845('0x3d')],_0x2e8c39['query']);_0x160f05['attributes']=_['intersection'](_0x2e8c39[_0x8845('0x3d')],qs['fields'](_0x4834ac[_0x8845('0x3e')][_0x8845('0x43')]));_0x160f05[_0x8845('0x41')]=_0x160f05[_0x8845('0x41')][_0x8845('0x44')]?_0x160f05[_0x8845('0x41')]:_0x2e8c39[_0x8845('0x3d')];if(!_0x4834ac[_0x8845('0x3e')][_0x8845('0x45')](_0x8845('0x46'))){_0x160f05[_0x8845('0x47')]=qs[_0x8845('0x47')](_0x4834ac[_0x8845('0x3e')]['limit']);_0x160f05[_0x8845('0x23')]=qs[_0x8845('0x23')](_0x4834ac[_0x8845('0x3e')][_0x8845('0x23')]);}_0x160f05['order']=qs['sort'](_0x4834ac[_0x8845('0x3e')][_0x8845('0x49')]);_0x160f05[_0x8845('0x4c')]=qs[_0x8845('0x40')](_[_0x8845('0x4a')](_0x4834ac[_0x8845('0x3e')],_0x2e8c39[_0x8845('0x40')]));_0x160f05[_0x8845('0x4c')][_0x8845('0x67')]=_0x4913b5['id'];if(_0x4834ac[_0x8845('0x3e')][_0x8845('0x4b')]){_0x160f05[_0x8845('0x4c')]=_[_0x8845('0x5e')](_0x160f05[_0x8845('0x4c')],{'$or':_['map'](_0x160f05['attributes'],function(_0xfea3c0){var _0xc204c9={};_0xc204c9[_0xfea3c0]={'$like':'%'+_0x4834ac['query'][_0x8845('0x4b')]+'%'};return _0xc204c9;})});}_0x160f05=_[_0x8845('0x5e')]({},_0x160f05,_0x4834ac[_0x8845('0x4e')]);return db['CmHopper'][_0x8845('0x24')]({'where':_0x160f05['where']})['then'](function(_0xac281c){_0x341abf[_0x8845('0x24')]=_0xac281c;if(_0x4834ac['query']['includeAll']){_0x160f05[_0x8845('0x55')]=[{'all':!![]}];}return db[_0x8845('0x68')][_0x8845('0x50')](_0x160f05);})['then'](function(_0xea8a79){_0x341abf[_0x8845('0x51')]=_0xea8a79;return _0x341abf;});}})['then'](respondWithFilteredResult(_0x13c0c9,_0x160f05))[_0x8845('0x52')](handleError(_0x13c0c9,null));};exports[_0x8845('0x69')]=function(_0x2217ae,_0x2c289a,_0x2d8b21){var _0x20aecd={'raw':!![],'where':{}};var _0xfc3730={};var _0x584cf3={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2217ae[_0x8845('0x53')]['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x2c289a,null))['then'](function(_0x479738){if(_0x479738){_0xfc3730[_0x8845('0x3d')]=_[_0x8845('0x3f')](db[_0x8845('0x6a')][_0x8845('0x3a')]);_0xfc3730[_0x8845('0x3e')]=_[_0x8845('0x3f')](_0x2217ae[_0x8845('0x3e')]);_0xfc3730[_0x8845('0x40')]=_[_0x8845('0x42')](_0xfc3730[_0x8845('0x3d')],_0xfc3730['query']);_0x20aecd['attributes']=_['intersection'](_0xfc3730[_0x8845('0x3d')],qs[_0x8845('0x43')](_0x2217ae['query']['fields']));_0x20aecd[_0x8845('0x41')]=_0x20aecd[_0x8845('0x41')][_0x8845('0x44')]?_0x20aecd[_0x8845('0x41')]:_0xfc3730[_0x8845('0x3d')];if(!_0x2217ae['query']['hasOwnProperty']('nolimit')){_0x20aecd['limit']=qs[_0x8845('0x47')](_0x2217ae['query'][_0x8845('0x47')]);_0x20aecd[_0x8845('0x23')]=qs[_0x8845('0x23')](_0x2217ae['query'][_0x8845('0x23')]);}_0x20aecd['order']=qs[_0x8845('0x49')](_0x2217ae[_0x8845('0x3e')]['sort']);_0x20aecd[_0x8845('0x4c')]=qs[_0x8845('0x40')](_[_0x8845('0x4a')](_0x2217ae[_0x8845('0x3e')],_0xfc3730[_0x8845('0x40')]));_0x20aecd['where'][_0x8845('0x67')]=_0x479738['id'];if(_0x2217ae[_0x8845('0x3e')]['filter']){_0x20aecd['where']=_[_0x8845('0x5e')](_0x20aecd[_0x8845('0x4c')],{'$or':_[_0x8845('0x31')](_0x20aecd['attributes'],function(_0x25a44c){var _0x3e3f93={};_0x3e3f93[_0x25a44c]={'$like':'%'+_0x2217ae[_0x8845('0x3e')][_0x8845('0x4b')]+'%'};return _0x3e3f93;})});}_0x20aecd=_[_0x8845('0x5e')]({},_0x20aecd,_0x2217ae['options']);return db[_0x8845('0x6a')][_0x8845('0x24')]({'where':_0x20aecd[_0x8845('0x4c')]})[_0x8845('0x29')](function(_0x42f095){_0x584cf3[_0x8845('0x24')]=_0x42f095;if(_0x2217ae[_0x8845('0x3e')][_0x8845('0x4f')]){_0x20aecd[_0x8845('0x55')]=[{'all':!![]}];}return db[_0x8845('0x6a')][_0x8845('0x50')](_0x20aecd);})['then'](function(_0x4f2f78){_0x584cf3['rows']=_0x4f2f78;return _0x584cf3;});}})[_0x8845('0x29')](respondWithFilteredResult(_0x2c289a,_0x20aecd))[_0x8845('0x52')](handleError(_0x2c289a,null));};exports[_0x8845('0x6b')]=function(_0xb96442,_0x2aaad2,_0x2ae91c){var _0x521722={'raw':!![],'where':{}};var _0x4a4d10={};var _0x13707f={'count':0x0,'rows':[]};return db[_0x8845('0x54')][_0x8845('0x66')]({'where':{'id':_0xb96442[_0x8845('0x53')]['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x2aaad2,null))[_0x8845('0x29')](function(_0x466d9d){if(_0x466d9d){_0x4a4d10['model']=_[_0x8845('0x3f')](db['CmHopperFinal'][_0x8845('0x3a')]);_0x4a4d10[_0x8845('0x3e')]=_[_0x8845('0x3f')](_0xb96442[_0x8845('0x3e')]);_0x4a4d10[_0x8845('0x40')]=_['intersection'](_0x4a4d10['model'],_0x4a4d10['query']);_0x521722[_0x8845('0x41')]=_['intersection'](_0x4a4d10[_0x8845('0x3d')],qs[_0x8845('0x43')](_0xb96442['query']['fields']));_0x521722[_0x8845('0x41')]=_0x521722[_0x8845('0x41')][_0x8845('0x44')]?_0x521722['attributes']:_0x4a4d10[_0x8845('0x3d')];if(!_0xb96442['query'][_0x8845('0x45')](_0x8845('0x46'))){_0x521722[_0x8845('0x47')]=qs[_0x8845('0x47')](_0xb96442[_0x8845('0x3e')][_0x8845('0x47')]);_0x521722[_0x8845('0x23')]=qs[_0x8845('0x23')](_0xb96442['query'][_0x8845('0x23')]);}_0x521722[_0x8845('0x48')]=qs[_0x8845('0x49')](_0xb96442[_0x8845('0x3e')]['sort']);_0x521722[_0x8845('0x4c')]=qs[_0x8845('0x40')](_[_0x8845('0x4a')](_0xb96442[_0x8845('0x3e')],_0x4a4d10[_0x8845('0x40')]));_0x521722[_0x8845('0x4c')][_0x8845('0x67')]=_0x466d9d['id'];if(_0xb96442[_0x8845('0x3e')][_0x8845('0x4b')]){_0x521722[_0x8845('0x4c')]=_[_0x8845('0x5e')](_0x521722['where'],{'$or':_['map'](_0x521722[_0x8845('0x41')],function(_0x1e747c){var _0x14742d={};_0x14742d[_0x1e747c]={'$like':'%'+_0xb96442[_0x8845('0x3e')]['filter']+'%'};return _0x14742d;})});}_0x521722=_['merge']({},_0x521722,_0xb96442[_0x8845('0x4e')]);return db[_0x8845('0x6c')][_0x8845('0x24')]({'where':_0x521722[_0x8845('0x4c')]})['then'](function(_0x530867){_0x13707f[_0x8845('0x24')]=_0x530867;if(_0xb96442[_0x8845('0x3e')][_0x8845('0x4f')]){_0x521722[_0x8845('0x55')]=[{'all':!![]}];}return db[_0x8845('0x6c')][_0x8845('0x50')](_0x521722);})[_0x8845('0x29')](function(_0x55c381){_0x13707f['rows']=_0x55c381;return _0x13707f;});}})[_0x8845('0x29')](respondWithFilteredResult(_0x2aaad2,_0x521722))[_0x8845('0x52')](handleError(_0x2aaad2,null));};exports[_0x8845('0x6d')]=function(_0x316600,_0x252c4e,_0x123e27){var _0x48ab46={'raw':!![],'where':{}};var _0x33802a={};var _0x660caa={'count':0x0,'rows':[]};return db[_0x8845('0x54')][_0x8845('0x66')]({'where':{'id':_0x316600[_0x8845('0x53')]['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x252c4e,null))['then'](function(_0x599c69){if(_0x599c69){_0x33802a['model']=_['keys'](db[_0x8845('0x6e')]['rawAttributes']);_0x33802a[_0x8845('0x3e')]=_[_0x8845('0x3f')](_0x316600[_0x8845('0x3e')]);_0x33802a[_0x8845('0x40')]=_[_0x8845('0x42')](_0x33802a[_0x8845('0x3d')],_0x33802a[_0x8845('0x3e')]);_0x48ab46[_0x8845('0x41')]=_[_0x8845('0x42')](_0x33802a['model'],qs[_0x8845('0x43')](_0x316600['query'][_0x8845('0x43')]));_0x48ab46['attributes']=_0x48ab46[_0x8845('0x41')][_0x8845('0x44')]?_0x48ab46['attributes']:_0x33802a[_0x8845('0x3d')];if(!_0x316600[_0x8845('0x3e')][_0x8845('0x45')](_0x8845('0x46'))){_0x48ab46['limit']=qs[_0x8845('0x47')](_0x316600[_0x8845('0x3e')]['limit']);_0x48ab46[_0x8845('0x23')]=qs[_0x8845('0x23')](_0x316600[_0x8845('0x3e')]['offset']);}_0x48ab46['order']=qs[_0x8845('0x49')](_0x316600['query'][_0x8845('0x49')]);_0x48ab46[_0x8845('0x4c')]=qs[_0x8845('0x40')](_['pick'](_0x316600[_0x8845('0x3e')],_0x33802a[_0x8845('0x40')]));_0x48ab46[_0x8845('0x4c')][_0x8845('0x67')]=_0x599c69['id'];if(_0x316600['query'][_0x8845('0x4b')]){_0x48ab46[_0x8845('0x4c')]=_[_0x8845('0x5e')](_0x48ab46['where'],{'$or':_[_0x8845('0x31')](_0x48ab46[_0x8845('0x41')],function(_0x1458bb){var _0x2b7f20={};_0x2b7f20[_0x1458bb]={'$like':'%'+_0x316600[_0x8845('0x3e')]['filter']+'%'};return _0x2b7f20;})});}_0x48ab46=_['merge']({},_0x48ab46,_0x316600[_0x8845('0x4e')]);return db[_0x8845('0x6e')]['count']({'where':_0x48ab46[_0x8845('0x4c')]})[_0x8845('0x29')](function(_0x47f4e5){_0x660caa[_0x8845('0x24')]=_0x47f4e5;if(_0x316600['query']['includeAll']){_0x48ab46[_0x8845('0x55')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x8845('0x50')](_0x48ab46);})[_0x8845('0x29')](function(_0x2d4c36){_0x660caa['rows']=_0x2d4c36;return _0x660caa;});}})[_0x8845('0x29')](respondWithFilteredResult(_0x252c4e,_0x48ab46))[_0x8845('0x52')](handleError(_0x252c4e,null));};exports[_0x8845('0x6f')]=function(_0x54a797,_0x4bd955,_0x43c734){var _0x438b2c={};var _0x35d7aa={};var _0x4b6ad6;var _0x4b72ce;return db['VoiceQueue'][_0x8845('0x66')]({'where':{'id':_0x54a797[_0x8845('0x53')]['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x4bd955,null))[_0x8845('0x29')](function(_0x328c39){if(_0x328c39){_0x4b6ad6=_0x328c39;_0x35d7aa[_0x8845('0x3d')]=_['keys'](db[_0x8845('0x70')][_0x8845('0x3a')]);_0x35d7aa[_0x8845('0x3e')]=_[_0x8845('0x3f')](_0x54a797['query']);_0x35d7aa[_0x8845('0x40')]=_['intersection'](_0x35d7aa['model'],_0x35d7aa['query']);_0x438b2c['attributes']=_[_0x8845('0x42')](_0x35d7aa[_0x8845('0x3d')],qs[_0x8845('0x43')](_0x54a797[_0x8845('0x3e')]['fields']));_0x438b2c[_0x8845('0x41')]=_0x438b2c[_0x8845('0x41')]['length']?_0x438b2c[_0x8845('0x41')]:_0x35d7aa[_0x8845('0x3d')];_0x438b2c['order']=qs[_0x8845('0x49')](_0x54a797[_0x8845('0x3e')][_0x8845('0x49')]);_0x438b2c['where']=qs[_0x8845('0x40')](_['pick'](_0x54a797['query'],_0x35d7aa[_0x8845('0x40')]));if(_0x54a797[_0x8845('0x3e')][_0x8845('0x4b')]){_0x438b2c['where']=_[_0x8845('0x5e')](_0x438b2c[_0x8845('0x4c')],{'$or':_[_0x8845('0x31')](_0x438b2c[_0x8845('0x41')],function(_0x31de00){var _0x336665={};_0x336665[_0x31de00]={'$like':'%'+_0x54a797[_0x8845('0x3e')]['filter']+'%'};return _0x336665;})});}_0x438b2c=_[_0x8845('0x5e')]({},_0x438b2c,_0x54a797[_0x8845('0x4e')]);return _0x4b6ad6[_0x8845('0x6f')](_0x438b2c);}})[_0x8845('0x29')](function(_0x2749a1){if(_0x2749a1){_0x4b72ce=_0x2749a1[_0x8845('0x44')];if(!_0x54a797[_0x8845('0x3e')][_0x8845('0x45')](_0x8845('0x46'))){_0x438b2c[_0x8845('0x47')]=qs[_0x8845('0x47')](_0x54a797[_0x8845('0x3e')][_0x8845('0x47')]);_0x438b2c[_0x8845('0x23')]=qs[_0x8845('0x23')](_0x54a797['query']['offset']);}return _0x4b6ad6[_0x8845('0x6f')](_0x438b2c);}})['then'](function(_0x272151){if(_0x272151){return _0x272151?{'count':_0x4b72ce,'rows':_0x272151}:null;}})[_0x8845('0x29')](respondWithResult(_0x4bd955,null))[_0x8845('0x52')](handleError(_0x4bd955,null));};exports[_0x8845('0x71')]=function(_0x4a8a69,_0x403247,_0x4f8ec8){var _0x149ce6=_0x4a8a69[_0x8845('0x61')][_0x8845('0x72')];var _0x3a4c70=_[_0x8845('0x31')](_0x149ce6,'id');return db[_0x8845('0x70')][_0x8845('0x50')]({'where':{'id':_0x3a4c70},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8845('0x73'),'attributes':['id','name',_0x8845('0x74'),_0x8845('0x75'),_0x8845('0x76')],'raw':!![]}]})['then'](function(_0x23e74f){if(_0x23e74f){var _0x3ce32d=_['flatMap'](_0x23e74f,function(_0xdad8e7){var _0x47695b=_0xdad8e7[_0x8845('0x2b')]({'plain':!![]});_0x47695b[_0x8845('0x73')][_0x8845('0x77')](function(_0x279ff8){_0x279ff8[_0x8845('0x78')]=_['find'](_0x149ce6,{'id':_0x47695b['id']})[_0x8845('0x78')];});return _0x47695b['Agents'];});return db[_0x8845('0x54')][_0x8845('0x56')]({'where':{'id':_0x4a8a69['params']['id']}})[_0x8845('0x29')](function(_0x1d6983){return db[_0x8845('0x79')][_0x8845('0x7a')](function(_0x267c24){return _0x1d6983[_0x8845('0x71')](_0x3a4c70,{'transaction':_0x267c24})[_0x8845('0x29')](function(){return BPromise[_0x8845('0x7b')](_0x149ce6,function(_0x3f75f5){return db[_0x8845('0x7c')][_0x8845('0x7d')]({'TeamId':_0x3f75f5['id'],'VoiceQueueId':_0x4a8a69[_0x8845('0x53')]['id'],'penalty':_0x3f75f5[_0x8845('0x78')]},{'transaction':_0x267c24});});})[_0x8845('0x29')](function(){return BPromise[_0x8845('0x7b')](_0x3ce32d,function(_0x677d9d){return db[_0x8845('0x7e')]['findOrCreate']({'where':{'UserId':_0x677d9d['id'],'VoiceQueueId':_0x4a8a69['params']['id']},'defaults':{'penalty':_0x677d9d[_0x8845('0x78')]},'transaction':_0x267c24});});})['then'](function(){return BPromise[_0x8845('0x7b')](_[_0x8845('0x4b')](_0x3ce32d,{'online':!![]}),function(_0x34890d){return db[_0x8845('0x7f')][_0x8845('0x7d')]({'membername':_0x34890d[_0x8845('0x38')],'UserId':_0x34890d['id'],'queue_name':_0x1d6983[_0x8845('0x38')],'VoiceQueueId':_0x1d6983['id'],'interface':_['isNil'](_0x34890d['interface'])?util[_0x8845('0x80')](_0x8845('0x81'),_0x34890d['name']):_0x34890d[_0x8845('0x76')],'paused':_0x34890d['voicePause']||![],'penalty':_0x34890d[_0x8845('0x78')]},{'transaction':_0x267c24});});})['then'](function(){_0x3ce32d[_0x8845('0x77')](function(_0x181600){socket[_0x8845('0x82')](_0x8845('0x83'),{'UserId':_0x181600['id'],'VoiceQueueId':_0x1d6983['id']});});});});});}})[_0x8845('0x29')](respondWithStatusCode(_0x403247,null))[_0x8845('0x52')](handleError(_0x403247,null));};exports['removeTeams']=function(_0x438b15,_0x483152,_0x4165b3){return db[_0x8845('0x70')]['findAll']({'where':{'id':_0x438b15['query'][_0x8845('0x84')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8845('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x483152,null))[_0x8845('0x29')](function(_0x3bdecf){var _0x16d966=_['map'](_0x3bdecf,'id');var _0x17a9ae=[];var _0x5301c7=[];var _0x301ac4=squel[_0x8845('0x85')]();_0x301ac4['field'](_0x8845('0x86'))[_0x8845('0x87')](_0x8845('0x88'),'tq')[_0x8845('0x89')](_0x8845('0x8a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8845('0x4c')](_0x8845('0x8b'),_0x438b15[_0x8845('0x53')]['id']);for(var _0x1e2082=0x0;_0x1e2082<_0x3bdecf[_0x8845('0x44')];_0x1e2082+=0x1){let _0x32b6dd=_0x3bdecf[_0x1e2082];for(var _0x324dac=0x0;_0x324dac<_0x32b6dd[_0x8845('0x73')]['length'];_0x324dac+=0x1){let _0x15e7d3=_0x32b6dd[_0x8845('0x73')][_0x324dac];var _0x20bdac=_0x301ac4['clone']();_0x20bdac[_0x8845('0x4c')]('ut.UserId\x20=\x20?',_0x15e7d3['id']);_0x5301c7[_0x8845('0x8c')](db[_0x8845('0x79')][_0x8845('0x3e')](_0x20bdac['toString'](),{'type':db['sequelize'][_0x8845('0x8d')][_0x8845('0x8e')]})[_0x8845('0x29')](function(_0x3d097b){if(_0x3d097b['length']===0x1){return _0x15e7d3['id'];}else{var _0x531fc4=_[_0x8845('0x8f')](_[_0x8845('0x31')](_0x3d097b,_0x8845('0x90')),function(_0x2c44a4){return _[_0x8845('0x33')](_0x16d966,_0x2c44a4);});if(_0x531fc4){return _0x15e7d3['id'];}}}));}}return BPromise['all'](_0x5301c7)['then'](function(_0x1634f6){_0x17a9ae=_(_0x17a9ae)[_0x8845('0x91')](_0x1634f6)['compact']()[_0x8845('0x32')]();return db[_0x8845('0x54')][_0x8845('0x56')]({'where':{'id':_0x438b15[_0x8845('0x53')]['id']}})[_0x8845('0x29')](function(_0x206568){return db[_0x8845('0x79')]['transaction'](function(_0x3bb491){return _0x206568[_0x8845('0x92')](_0x438b15[_0x8845('0x3e')][_0x8845('0x84')],{'transaction':_0x3bb491})[_0x8845('0x29')](function(){if(!_[_0x8845('0x93')](_0x17a9ae)){return _0x206568[_0x8845('0x94')](_0x17a9ae,{'transaction':_0x3bb491})['then'](function(){return db[_0x8845('0x7f')][_0x8845('0x2a')]({'where':{'VoiceQueueId':_0x438b15[_0x8845('0x53')]['id'],'UserId':_0x17a9ae},'transaction':_0x3bb491});});}})[_0x8845('0x29')](function(){_0x17a9ae['forEach'](function(_0x4a0bf8){socket[_0x8845('0x82')](_0x8845('0x95'),{'UserId':_0x4a0bf8,'VoiceQueueId':_0x206568['id']});});});});});});})[_0x8845('0x29')](respondWithStatusCode(_0x483152,null))['catch'](handleError(_0x483152,null));};exports[_0x8845('0x96')]=function(_0x1261aa,_0x4c3063,_0xb37deb){var _0x45bdcc,_0x5edb52;return db[_0x8845('0x54')][_0x8845('0x56')]({'where':{'id':_0x1261aa[_0x8845('0x53')]['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x4c3063,null))['then'](function(_0x54e524){if(_0x54e524){_0x5edb52=_0x54e524;return _0x54e524[_0x8845('0x96')](_0x1261aa[_0x8845('0x61')]['ids'],_[_0x8845('0x5f')](_0x1261aa[_0x8845('0x61')],[_0x8845('0x84'),'id'])||{})['spread'](function(_0x3de2e3){for(var _0x263039=0x0;_0x263039<_0x1261aa[_0x8845('0x61')][_0x8845('0x84')]['length'];_0x263039+=0x1){socket['emit'](_0x8845('0x83'),{'UserId':Number(_0x1261aa[_0x8845('0x61')][_0x8845('0x84')][_0x263039]),'VoiceQueueId':Number(_0x1261aa[_0x8845('0x53')]['id'])});}return _0x3de2e3;});}})[_0x8845('0x29')](function(_0x4926f3){_0x45bdcc=_0x4926f3||[];if(_0x5edb52){return db[_0x8845('0x97')][_0x8845('0x50')]({'where':{'id':_0x1261aa[_0x8845('0x61')][_0x8845('0x84')]},'attributes':['id',_0x8845('0x38'),_0x8845('0x74'),_0x8845('0x75'),'interface'],'raw':!![]});}})[_0x8845('0x29')](function(_0x3bb82c){if(!_['isEmpty'](_0x3bb82c)){var _0x1bed5b=[];for(var _0x18a239=0x0;_0x18a239<_0x3bb82c['length'];_0x18a239++){if(_0x3bb82c[_0x18a239]['online']){_0x1bed5b[_0x8845('0x8c')](db[_0x8845('0x7f')][_0x8845('0x7d')]({'membername':_0x3bb82c[_0x18a239][_0x8845('0x38')],'UserId':_0x3bb82c[_0x18a239]['id'],'queue_name':_0x5edb52['name'],'VoiceQueueId':_0x5edb52['id'],'interface':_[_0x8845('0x98')](_0x3bb82c[_0x18a239][_0x8845('0x76')])?util[_0x8845('0x80')](_0x8845('0x81'),_0x3bb82c[_0x18a239][_0x8845('0x38')]):_0x3bb82c[_0x18a239][_0x8845('0x76')],'paused':_0x3bb82c[_0x18a239][_0x8845('0x75')]||![],'penalty':_0x1261aa[_0x8845('0x61')]['penalty']||0x0}));}}return BPromise[_0x8845('0x99')](_0x1bed5b);}})[_0x8845('0x29')](function(){return _0x45bdcc;})[_0x8845('0x29')](respondWithResult(_0x4c3063,null))[_0x8845('0x52')](handleError(_0x4c3063,null));};exports['removeAgents']=function(_0x1d0b5c,_0x3001a3,_0x440a82){return db[_0x8845('0x54')][_0x8845('0x56')]({'where':{'id':_0x1d0b5c['params']['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x3001a3,null))[_0x8845('0x29')](function(_0x1b9858){if(_0x1b9858){return _0x1b9858[_0x8845('0x94')](_0x1d0b5c['query'][_0x8845('0x84')])[_0x8845('0x29')](function(){if(_[_0x8845('0x9a')](_0x1d0b5c[_0x8845('0x3e')][_0x8845('0x84')])){for(var _0x4333a3=0x0;_0x4333a3<_0x1d0b5c[_0x8845('0x3e')][_0x8845('0x84')]['length'];_0x4333a3+=0x1){socket[_0x8845('0x82')](_0x8845('0x95'),{'UserId':Number(_0x1d0b5c[_0x8845('0x3e')][_0x8845('0x84')][_0x4333a3]),'VoiceQueueId':Number(_0x1d0b5c[_0x8845('0x53')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x1d0b5c[_0x8845('0x3e')][_0x8845('0x84')]),'VoiceQueueId':Number(_0x1d0b5c['params']['id'])});}});}})[_0x8845('0x29')](function(_0x2e6d35){return db[_0x8845('0x7f')][_0x8845('0x2a')]({'where':{'VoiceQueueId':_0x1d0b5c[_0x8845('0x53')]['id'],'UserId':_0x1d0b5c[_0x8845('0x3e')][_0x8845('0x84')]}})['then'](function(){return _0x2e6d35;});})[_0x8845('0x29')](respondWithStatusCode(_0x3001a3,null))[_0x8845('0x52')](handleError(_0x3001a3,null));};exports[_0x8845('0x9b')]=function(_0x1fdeb4,_0x5114de,_0x2f0993){var _0x6794c5={};var _0x17e024={};var _0x115f32;var _0x127876;return db[_0x8845('0x54')]['findOne']({'where':{'id':_0x1fdeb4[_0x8845('0x53')]['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x5114de,null))[_0x8845('0x29')](function(_0x5cdcc7){if(_0x5cdcc7){_0x115f32=_0x5cdcc7;_0x17e024['model']=_[_0x8845('0x3f')](db[_0x8845('0x97')]['rawAttributes']);_0x17e024[_0x8845('0x3e')]=_[_0x8845('0x3f')](_0x1fdeb4[_0x8845('0x3e')]);_0x17e024[_0x8845('0x40')]=_[_0x8845('0x42')](_0x17e024['model'],_0x17e024[_0x8845('0x3e')]);_0x6794c5[_0x8845('0x41')]=_[_0x8845('0x42')](_0x17e024[_0x8845('0x3d')],qs['fields'](_0x1fdeb4['query']['fields']));_0x6794c5[_0x8845('0x41')]=_0x6794c5[_0x8845('0x41')][_0x8845('0x44')]?_0x6794c5['attributes']:_0x17e024[_0x8845('0x3d')];_0x6794c5[_0x8845('0x48')]=qs['sort'](_0x1fdeb4[_0x8845('0x3e')][_0x8845('0x49')]);_0x6794c5[_0x8845('0x4c')]=qs[_0x8845('0x40')](_[_0x8845('0x4a')](_0x1fdeb4[_0x8845('0x3e')],_0x17e024[_0x8845('0x40')]));if(_0x1fdeb4[_0x8845('0x3e')][_0x8845('0x4b')]){_0x6794c5['where']=_[_0x8845('0x5e')](_0x6794c5[_0x8845('0x4c')],{'$or':_['map'](_0x6794c5[_0x8845('0x41')],function(_0x55993a){var _0x53db60={};_0x53db60[_0x55993a]={'$like':'%'+_0x1fdeb4[_0x8845('0x3e')][_0x8845('0x4b')]+'%'};return _0x53db60;})});}_0x6794c5=_[_0x8845('0x5e')]({},_0x6794c5,_0x1fdeb4[_0x8845('0x4e')]);return _0x115f32[_0x8845('0x9b')](_0x6794c5);}})[_0x8845('0x29')](function(_0x4e5e06){if(_0x4e5e06){_0x127876=_0x4e5e06[_0x8845('0x44')];if(!_0x1fdeb4[_0x8845('0x3e')][_0x8845('0x45')]('nolimit')){_0x6794c5[_0x8845('0x47')]=qs[_0x8845('0x47')](_0x1fdeb4[_0x8845('0x3e')]['limit']);_0x6794c5[_0x8845('0x23')]=qs[_0x8845('0x23')](_0x1fdeb4[_0x8845('0x3e')][_0x8845('0x23')]);}return _0x115f32['getAgents'](_0x6794c5);}})['then'](function(_0xfd1b6d){if(_0xfd1b6d){return _0xfd1b6d?{'count':_0x127876,'rows':_0xfd1b6d}:null;}})['then'](respondWithResult(_0x5114de,null))[_0x8845('0x52')](handleError(_0x5114de,null));};exports['getMembers']=function(_0x55d38c,_0x4643e3,_0x1ca662){var _0x7cd28={};var _0x2da358={};var _0x3ba334;var _0x38257f;return db[_0x8845('0x54')]['findOne']({'where':{'id':_0x55d38c[_0x8845('0x53')]['id']}})['then'](handleEntityNotFound(_0x4643e3,null))[_0x8845('0x29')](function(_0x46004d){if(_0x46004d){_0x3ba334=_0x46004d;_0x2da358[_0x8845('0x3d')]=_[_0x8845('0x3f')](db[_0x8845('0x7f')]['rawAttributes']);_0x2da358['query']=_[_0x8845('0x3f')](_0x55d38c['query']);_0x2da358[_0x8845('0x40')]=_[_0x8845('0x42')](_0x2da358[_0x8845('0x3d')],_0x2da358[_0x8845('0x3e')]);_0x7cd28[_0x8845('0x41')]=_[_0x8845('0x42')](_0x2da358[_0x8845('0x3d')],qs[_0x8845('0x43')](_0x55d38c[_0x8845('0x3e')]['fields']));_0x7cd28[_0x8845('0x41')]=_0x7cd28['attributes'][_0x8845('0x44')]?_0x7cd28['attributes']:_0x2da358[_0x8845('0x3d')];_0x7cd28[_0x8845('0x48')]=qs['sort'](_0x55d38c[_0x8845('0x3e')][_0x8845('0x49')]);_0x7cd28[_0x8845('0x4c')]=qs[_0x8845('0x40')](_['pick'](_0x55d38c[_0x8845('0x3e')],_0x2da358[_0x8845('0x40')]));if(_0x55d38c[_0x8845('0x3e')]['filter']){_0x7cd28['where']=_[_0x8845('0x5e')](_0x7cd28[_0x8845('0x4c')],{'$or':_[_0x8845('0x31')](_0x7cd28['attributes'],function(_0x2597ab){var _0xcf3745={};_0xcf3745[_0x2597ab]={'$like':'%'+_0x55d38c[_0x8845('0x3e')][_0x8845('0x4b')]+'%'};return _0xcf3745;})});}_0x7cd28=_[_0x8845('0x5e')]({},_0x7cd28,_0x55d38c[_0x8845('0x4e')]);return _0x3ba334[_0x8845('0x9c')](_0x7cd28);}})['then'](function(_0x8e4615){if(_0x8e4615){_0x38257f=_0x8e4615['length'];if(!_0x55d38c['query'][_0x8845('0x45')](_0x8845('0x46'))){_0x7cd28['limit']=qs['limit'](_0x55d38c[_0x8845('0x3e')][_0x8845('0x47')]);_0x7cd28[_0x8845('0x23')]=qs[_0x8845('0x23')](_0x55d38c[_0x8845('0x3e')][_0x8845('0x23')]);}return _0x3ba334[_0x8845('0x9c')](_0x7cd28);}})[_0x8845('0x29')](function(_0x488fd4){return _0x488fd4?{'count':_0x38257f,'rows':_0x488fd4}:null;})['then'](respondWithResult(_0x4643e3,null))['catch'](handleError(_0x4643e3,null));};exports[_0x8845('0x9d')]=function(_0x54132a,_0x41232c,_0xd3ed33){var _0x1f94b8={};var _0x14f0d8={};var _0x53b8cf;var _0x97269d;return db[_0x8845('0x54')]['findOne']({'where':{'id':_0x54132a[_0x8845('0x53')]['id']}})['then'](handleEntityNotFound(_0x41232c,null))[_0x8845('0x29')](function(_0x144f85){if(_0x144f85){_0x53b8cf=_0x144f85;_0x14f0d8[_0x8845('0x3d')]=_[_0x8845('0x3f')](db['CmList']['rawAttributes']);_0x14f0d8[_0x8845('0x3e')]=_['keys'](_0x54132a[_0x8845('0x3e')]);_0x14f0d8[_0x8845('0x40')]=_[_0x8845('0x42')](_0x14f0d8['model'],_0x14f0d8[_0x8845('0x3e')]);_0x1f94b8[_0x8845('0x41')]=_[_0x8845('0x42')](_0x14f0d8[_0x8845('0x3d')],qs['fields'](_0x54132a['query'][_0x8845('0x43')]));_0x1f94b8[_0x8845('0x41')]=_0x1f94b8[_0x8845('0x41')][_0x8845('0x44')]?_0x1f94b8['attributes']:_0x14f0d8[_0x8845('0x3d')];_0x1f94b8[_0x8845('0x48')]=qs['sort'](_0x54132a[_0x8845('0x3e')][_0x8845('0x49')]);_0x1f94b8[_0x8845('0x4c')]=qs[_0x8845('0x40')](_[_0x8845('0x4a')](_0x54132a[_0x8845('0x3e')],_0x14f0d8['filters']));if(_0x54132a['query'][_0x8845('0x4b')]){_0x1f94b8[_0x8845('0x4c')]=_['merge'](_0x1f94b8['where'],{'$or':_[_0x8845('0x31')](_0x1f94b8[_0x8845('0x41')],function(_0x36aa12){var _0x21da65={};_0x21da65[_0x36aa12]={'$like':'%'+_0x54132a['query'][_0x8845('0x4b')]+'%'};return _0x21da65;})});}_0x1f94b8=_['merge']({},_0x1f94b8,_0x54132a[_0x8845('0x4e')]);return _0x53b8cf[_0x8845('0x9d')](_0x1f94b8);}})[_0x8845('0x29')](function(_0x47318d){if(_0x47318d){_0x97269d=_0x47318d[_0x8845('0x44')];if(!_0x54132a[_0x8845('0x3e')]['hasOwnProperty']('nolimit')){_0x1f94b8[_0x8845('0x47')]=qs[_0x8845('0x47')](_0x54132a[_0x8845('0x3e')][_0x8845('0x47')]);_0x1f94b8[_0x8845('0x23')]=qs[_0x8845('0x23')](_0x54132a[_0x8845('0x3e')]['offset']);}return _0x53b8cf[_0x8845('0x9d')](_0x1f94b8);}})[_0x8845('0x29')](function(_0x51b8f8){if(_0x51b8f8){return _0x51b8f8?{'count':_0x97269d,'rows':_0x51b8f8}:null;}})['then'](respondWithResult(_0x41232c,null))[_0x8845('0x52')](handleError(_0x41232c,null));};exports[_0x8845('0x9e')]=function(_0x211cac,_0x2a81bf,_0x5a841a){var _0x5907be=moment()['format'](_0x8845('0x9f'));var _0x274405,_0x2c45a3;return db[_0x8845('0x54')][_0x8845('0x56')]({'where':{'id':_0x211cac[_0x8845('0x53')]['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x2a81bf,null))[_0x8845('0x29')](function(_0x5b2dfe){if(_0x5b2dfe){_0x2c45a3=_0x5b2dfe;return _0x5b2dfe['addLists'](_0x211cac['body'][_0x8845('0x84')],_['omit'](_0x211cac[_0x8845('0x61')],[_0x8845('0x84'),'id'])||{});}return null;})[_0x8845('0xa0')](function(_0x1664fc){var _0x5015b1;_0x274405=_0x1664fc||[];var _0x58450f=[];if(_0x1664fc){for(var _0x2cf089=0x0;_0x2cf089<_0x1664fc['length'];_0x2cf089+=0x1){var _0x4ef113=_0x1664fc[_0x2cf089][_0x8845('0x2b')]({'plain':!![]});_0x2c45a3['dialCheckDuplicateType']=_0x211cac[_0x8845('0x61')][_0x8845('0xa1')]?_0x211cac[_0x8845('0x61')][_0x8845('0xa1')]:_0x2c45a3['dialCheckDuplicateType'];switch(_0x2c45a3[_0x8845('0xa1')]){case _0x8845('0xa2'):_0x5015b1=squel[_0x8845('0xa3')]()[_0x8845('0xa4')](_0x8845('0xa5'))[_0x8845('0xa6')]([_0x8845('0xa7'),_0x8845('0xa8'),'ContactId',_0x8845('0xa9'),_0x8845('0x67'),_0x8845('0x60'),_0x8845('0x62')],squel[_0x8845('0x85')]()['field'](_0x8845('0xa7'),_0x8845('0xa7'))[_0x8845('0xaa')]('\x27'+_0x5907be+'\x27',_0x8845('0xa8'))[_0x8845('0xaa')]('id',_0x8845('0xab'))[_0x8845('0xaa')](_0x4ef113[_0x8845('0xac')][_0x8845('0xad')](),_0x8845('0xa9'))[_0x8845('0xaa')](_0x211cac[_0x8845('0x53')]['id'][_0x8845('0xad')](),'VoiceQueueId')[_0x8845('0xaa')]('\x27'+_0x5907be+'\x27',_0x8845('0x60'))[_0x8845('0xaa')]('\x27'+_0x5907be+'\x27',_0x8845('0x62'))[_0x8845('0x87')](_0x8845('0xae'))[_0x8845('0x4c')](_0x8845('0xaf'))[_0x8845('0x4c')]('ListId\x20=\x20?',_0x4ef113[_0x8845('0xac')][_0x8845('0xad')]())[_0x8845('0x4c')](_0x8845('0xb0'))[_0x8845('0x4c')](_0x8845('0xb1'),squel[_0x8845('0x85')]()[_0x8845('0xaa')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x8845('0xb2'))[_0x8845('0x4c')](_0x8845('0x8b'),_0x211cac[_0x8845('0x53')]['id'][_0x8845('0xad')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x8845('0xaa')](_0x8845('0xb3'))[_0x8845('0x87')](_0x8845('0xa5'))['where'](_0x8845('0x8b'),_0x211cac[_0x8845('0x53')]['id'][_0x8845('0xad')]())))[_0x8845('0xad')]();break;case'onlyIfOpen':_0x5015b1=squel[_0x8845('0xa3')]()[_0x8845('0xa4')](_0x8845('0xa5'))[_0x8845('0xa6')]([_0x8845('0xa7'),'scheduledAt',_0x8845('0xab'),_0x8845('0xa9'),'VoiceQueueId',_0x8845('0x60'),'updatedAt'],squel[_0x8845('0x85')]()[_0x8845('0xaa')](_0x8845('0xa7'),_0x8845('0xa7'))[_0x8845('0xaa')]('\x27'+_0x5907be+'\x27',_0x8845('0xa8'))[_0x8845('0xaa')]('id','ContactId')[_0x8845('0xaa')](_0x4ef113[_0x8845('0xac')][_0x8845('0xad')](),_0x8845('0xa9'))[_0x8845('0xaa')](_0x211cac['params']['id'][_0x8845('0xad')](),_0x8845('0x67'))['field']('\x27'+_0x5907be+'\x27',_0x8845('0x60'))['field']('\x27'+_0x5907be+'\x27','updatedAt')[_0x8845('0x87')](_0x8845('0xae'))[_0x8845('0x4c')](_0x8845('0xaf'))['where'](_0x8845('0xb4'),_0x4ef113[_0x8845('0xac')][_0x8845('0xad')]())[_0x8845('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0x8845('0x4c')](_0x8845('0xb1'),squel['select']()[_0x8845('0xaa')](_0x8845('0xb3'))['from'](_0x8845('0xa5'))[_0x8845('0x4c')](_0x8845('0x8b'),_0x211cac[_0x8845('0x53')]['id']['toString']())))[_0x8845('0xad')]();break;default:_0x5015b1=squel[_0x8845('0xa3')]()[_0x8845('0xa4')](_0x8845('0xa5'))[_0x8845('0xa6')](['phone','scheduledAt',_0x8845('0xab'),_0x8845('0xa9'),_0x8845('0x67'),_0x8845('0x60'),'updatedAt'],squel['select']()[_0x8845('0xaa')](_0x8845('0xa7'),'phone')['field']('\x27'+_0x5907be+'\x27',_0x8845('0xa8'))[_0x8845('0xaa')]('id',_0x8845('0xab'))[_0x8845('0xaa')](_0x4ef113[_0x8845('0xac')][_0x8845('0xad')](),_0x8845('0xa9'))[_0x8845('0xaa')](_0x211cac[_0x8845('0x53')]['id'][_0x8845('0xad')](),_0x8845('0x67'))[_0x8845('0xaa')]('\x27'+_0x5907be+'\x27','createdAt')['field']('\x27'+_0x5907be+'\x27',_0x8845('0x62'))[_0x8845('0x87')]('cm_contacts')[_0x8845('0x4c')]('deletedAt\x20IS\x20NULL')['where'](_0x8845('0xb4'),_0x4ef113[_0x8845('0xac')][_0x8845('0xad')]())[_0x8845('0x4c')]('phone\x20IS\x20NOT\x20NULL'))[_0x8845('0xad')]();}_0x58450f['push'](db['sequelize'][_0x8845('0x3e')](_0x5015b1));}return BPromise[_0x8845('0x99')](_0x58450f);}})[_0x8845('0x29')](function(){var _0x22e1c0=[];var _0x52e38a=squel[_0x8845('0xa3')]()[_0x8845('0xa4')]('cm_hopper_additional_phones')[_0x8845('0xa6')](['CmHopperId',_0x8845('0xa7'),_0x8845('0xb5'),_0x8845('0x60'),_0x8845('0x62')],squel[_0x8845('0x85')]()['field'](_0x8845('0xb6'))[_0x8845('0xaa')](_0x8845('0xb7'))[_0x8845('0xaa')](_0x8845('0xb8'))[_0x8845('0xaa')]('\x27'+_0x5907be+'\x27',_0x8845('0x60'))[_0x8845('0xaa')]('\x27'+_0x5907be+'\x27',_0x8845('0x62'))['from'](_0x8845('0xb9'),'ci')[_0x8845('0x89')](_0x8845('0xa5'),'h',_0x8845('0xba'))['where']('h.scheduledat=?',_0x5907be)[_0x8845('0x4c')](_0x8845('0xbb'),_0x8845('0xbc')))['toString']();_0x22e1c0[_0x8845('0x8c')](db[_0x8845('0x79')][_0x8845('0x3e')](_0x52e38a));return BPromise[_0x8845('0x99')](_0x22e1c0);})[_0x8845('0x29')](function(){return _0x274405;})[_0x8845('0x29')](respondWithResult(_0x2a81bf,null))[_0x8845('0x52')](handleError(_0x2a81bf,null));};exports['removeLists']=function(_0xeed662,_0x2be341,_0x169ca7){return db[_0x8845('0x54')][_0x8845('0x56')]({'where':{'id':_0xeed662[_0x8845('0x53')]['id']}})['then'](handleEntityNotFound(_0x2be341,null))['then'](function(_0x429c7e){if(_0x429c7e){return _0x429c7e[_0x8845('0xbd')](_0xeed662[_0x8845('0x3e')]['ids']);}})['then'](function(_0x50613a){if(_0x50613a){return db[_0x8845('0x68')][_0x8845('0x2a')]({'where':{'ListId':_0xeed662[_0x8845('0x3e')][_0x8845('0x84')],'VoiceQueueId':_0xeed662[_0x8845('0x53')]['id']}})['then'](function(){return _0x50613a;});}})['then'](respondWithStatusCode(_0x2be341,null))[_0x8845('0x52')](handleError(_0x2be341,null));};exports[_0x8845('0xbe')]=function(_0x1203b1,_0x5d5846,_0xf79bc5){var _0x43fc27={};var _0x23b90a={};var _0x49e649;var _0x1284de;return db[_0x8845('0x54')][_0x8845('0x66')]({'where':{'id':_0x1203b1[_0x8845('0x53')]['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x5d5846,null))[_0x8845('0x29')](function(_0x2b3937){if(_0x2b3937){_0x49e649=_0x2b3937;_0x23b90a[_0x8845('0x3d')]=_[_0x8845('0x3f')](db[_0x8845('0xbf')][_0x8845('0x3a')]);_0x23b90a[_0x8845('0x3e')]=_[_0x8845('0x3f')](_0x1203b1[_0x8845('0x3e')]);_0x23b90a[_0x8845('0x40')]=_[_0x8845('0x42')](_0x23b90a[_0x8845('0x3d')],_0x23b90a[_0x8845('0x3e')]);_0x43fc27[_0x8845('0x41')]=_[_0x8845('0x42')](_0x23b90a['model'],qs[_0x8845('0x43')](_0x1203b1['query'][_0x8845('0x43')]));_0x43fc27[_0x8845('0x41')]=_0x43fc27[_0x8845('0x41')]['length']?_0x43fc27[_0x8845('0x41')]:_0x23b90a['model'];_0x43fc27[_0x8845('0x48')]=qs['sort'](_0x1203b1[_0x8845('0x3e')][_0x8845('0x49')]);_0x43fc27[_0x8845('0x4c')]=qs[_0x8845('0x40')](_[_0x8845('0x4a')](_0x1203b1['query'],_0x23b90a[_0x8845('0x40')]));if(_0x1203b1[_0x8845('0x3e')][_0x8845('0x4b')]){_0x43fc27[_0x8845('0x4c')]=_[_0x8845('0x5e')](_0x43fc27[_0x8845('0x4c')],{'$or':_[_0x8845('0x31')](_0x43fc27[_0x8845('0x41')],function(_0x3d05b5){var _0x3ceb47={};_0x3ceb47[_0x3d05b5]={'$like':'%'+_0x1203b1[_0x8845('0x3e')][_0x8845('0x4b')]+'%'};return _0x3ceb47;})});}_0x43fc27=_[_0x8845('0x5e')]({},_0x43fc27,_0x1203b1[_0x8845('0x4e')]);return _0x49e649['getBlackLists'](_0x43fc27);}})[_0x8845('0x29')](function(_0x4a5300){if(_0x4a5300){_0x1284de=_0x4a5300[_0x8845('0x44')];if(!_0x1203b1[_0x8845('0x3e')][_0x8845('0x45')](_0x8845('0x46'))){_0x43fc27[_0x8845('0x47')]=qs['limit'](_0x1203b1[_0x8845('0x3e')][_0x8845('0x47')]);_0x43fc27[_0x8845('0x23')]=qs[_0x8845('0x23')](_0x1203b1['query']['offset']);}return _0x49e649[_0x8845('0xbe')](_0x43fc27);}})[_0x8845('0x29')](function(_0x184063){if(_0x184063){return _0x184063?{'count':_0x1284de,'rows':_0x184063}:null;}})[_0x8845('0x29')](respondWithResult(_0x5d5846,null))[_0x8845('0x52')](handleError(_0x5d5846,null));};exports['addBlackLists']=function(_0x17d1f4,_0x1bfbd4,_0x1d3261){var _0x99aaac,_0x5bf57d;return db[_0x8845('0x54')][_0x8845('0x56')]({'where':{'id':_0x17d1f4['params']['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x1bfbd4,null))[_0x8845('0x29')](function(_0x2d4277){if(_0x2d4277){_0x5bf57d=_0x2d4277;return _0x2d4277[_0x8845('0xc0')](_0x17d1f4[_0x8845('0x61')]['ids'],_['omit'](_0x17d1f4[_0x8845('0x61')],['ids','id'])||{});}return null;})[_0x8845('0xa0')](function(_0x311a48){var _0x432875;_0x99aaac=_0x311a48||[];var _0x534107=[];if(_0x311a48){for(var _0x5dbc5a=0x0;_0x5dbc5a<_0x311a48[_0x8845('0x44')];_0x5dbc5a+=0x1){var _0x42a910=_0x311a48[_0x5dbc5a][_0x8845('0x2b')]({'plain':!![]});_0x432875=squel[_0x8845('0xa3')]()[_0x8845('0xa4')]('cm_hopper_black')[_0x8845('0xa6')]([_0x8845('0xa7'),_0x8845('0xab'),_0x8845('0xa9'),_0x8845('0x67'),_0x8845('0x60'),_0x8845('0x62')],squel[_0x8845('0x85')]()['field'](_0x8845('0xa7'),_0x8845('0xa7'))[_0x8845('0xaa')]('id','ContactId')[_0x8845('0xaa')](_0x42a910['CmListId'][_0x8845('0xad')](),'ListId')[_0x8845('0xaa')](_0x17d1f4[_0x8845('0x53')]['id'][_0x8845('0xad')](),_0x8845('0x67'))['field']('NOW()',_0x8845('0x60'))[_0x8845('0xaa')](_0x8845('0xc1'),'updatedAt')['from'](_0x8845('0xae'))[_0x8845('0x4c')](_0x8845('0xaf'))['where']('ListId\x20=\x20?',_0x42a910['CmListId'][_0x8845('0xad')]())[_0x8845('0x4c')](_0x8845('0xb0')))[_0x8845('0xad')]();_0x534107['push'](db['sequelize'][_0x8845('0x3e')](_0x432875));}return BPromise[_0x8845('0x99')](_0x534107);}})[_0x8845('0x29')](function(){return _0x99aaac;})[_0x8845('0x29')](respondWithResult(_0x1bfbd4,null))[_0x8845('0x52')](handleError(_0x1bfbd4,null));};exports[_0x8845('0xc2')]=function(_0x4ef23f,_0x9d7b75,_0x2b6312){return db['VoiceQueue']['find']({'where':{'id':_0x4ef23f[_0x8845('0x53')]['id']}})[_0x8845('0x29')](handleEntityNotFound(_0x9d7b75,null))[_0x8845('0x29')](function(_0x3df855){if(_0x3df855){return _0x3df855['removeBlackLists'](_0x4ef23f[_0x8845('0x3e')][_0x8845('0x84')]);}})[_0x8845('0x29')](function(_0x523e96){if(_0x523e96){return db[_0x8845('0x6e')][_0x8845('0x2a')]({'where':{'ListId':_0x4ef23f[_0x8845('0x3e')]['ids'],'VoiceQueueId':_0x4ef23f[_0x8845('0x53')]['id']}})['then'](function(){return _0x523e96;});}})[_0x8845('0x29')](respondWithStatusCode(_0x9d7b75,null))[_0x8845('0x52')](handleError(_0x9d7b75,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6456487..c00f47d 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 _0x7868=['emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7868,0x93));var _0x8786=function(_0x6bc362,_0x56182e){_0x6bc362=_0x6bc362-0x0;var _0x2db519=_0x7868[_0x6bc362];return _0x2db519;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x8786('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8786('0x1')](0x0);var events={'afterCreate':_0x8786('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1a7432){return function(_0x31bfe2,_0x5e12a1,_0x31f99e){VoiceQueueEvents[_0x8786('0x3')](_0x1a7432+':'+_0x31bfe2['id'],_0x31bfe2);VoiceQueueEvents[_0x8786('0x3')](_0x1a7432,_0x31bfe2);_0x31f99e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x8786('0x4')](e,emitEvent(event));}}module[_0x8786('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0xc411=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','VoiceQueue'];(function(_0x517a2d,_0x21e839){var _0x42498c=function(_0x4451b9){while(--_0x4451b9){_0x517a2d['push'](_0x517a2d['shift']());}};_0x42498c(++_0x21e839);}(_0xc411,0xd7));var _0x1c41=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0xc411[_0x10dbf6];return _0x452147;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x1c41('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x1c41('0x1')](0x0);var events={'afterCreate':_0x1c41('0x2'),'afterUpdate':_0x1c41('0x3'),'afterDestroy':_0x1c41('0x4')};function emitEvent(_0xc861eb){return function(_0x382aca,_0x41b85b,_0x44a792){VoiceQueueEvents['emit'](_0xc861eb+':'+_0x382aca['id'],_0x382aca);VoiceQueueEvents[_0x1c41('0x5')](_0xc861eb,_0x382aca);_0x44a792(null);};}for(var e in events){if(events[_0x1c41('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x1c41('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c4db9b4..362d92e 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x008c,0x188));var _0xc008=function(_0x4c2cda,_0x5945b0){_0x4c2cda=_0x4c2cda-0x0;var _0x59c47d=_0x008c[_0x4c2cda];return _0x59c47d;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x5437e7,_0x4c992f){var _0x28f536=function(_0x5e6392){while(--_0x5e6392){_0x5437e7['push'](_0x5437e7['shift']());}};_0x28f536(++_0x4c992f);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index f4a870a..dec92bf 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 _0xbf2e=['findAll','options','raw','attributes','limit','map','include','model','ShowVoiceQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue'];(function(_0x4e40e4,_0xe34b01){var _0x33870c=function(_0x2aed03){while(--_0x2aed03){_0x4e40e4['push'](_0x4e40e4['shift']());}};_0x33870c(++_0xe34b01);}(_0xbf2e,0x172));var _0xebf2=function(_0x3c0fe6,_0x22a768){_0x3c0fe6=_0x3c0fe6-0x0;var _0x9cb132=_0xbf2e[_0x3c0fe6];return _0x9cb132;};'use strict';var _=require(_0xebf2('0x0'));var util=require(_0xebf2('0x1'));var moment=require(_0xebf2('0x2'));var BPromise=require('bluebird');var rs=require(_0xebf2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebf2('0x4'))['db'];var utils=require(_0xebf2('0x5'));var logger=require(_0xebf2('0x6'))(_0xebf2('0x7'));var config=require(_0xebf2('0x8'));var jayson=require(_0xebf2('0x9'));var client=jayson[_0xebf2('0xa')][_0xebf2('0xb')]({'port':0x232a});config[_0xebf2('0xc')]=_[_0xebf2('0xd')](config[_0xebf2('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebf2('0xc')]));require(_0xebf2('0xe'))['register'](socket);function respondWithRpcPromise(_0x31f18d,_0x2619c3,_0x4a7b35){return new BPromise(function(_0x249208,_0x363634){return client[_0xebf2('0xf')](_0x31f18d,_0x4a7b35)[_0xebf2('0x10')](function(_0x1c3687){logger[_0xebf2('0x11')](_0xebf2('0x12'),_0x2619c3,_0xebf2('0x13'));logger[_0xebf2('0x14')](_0xebf2('0x15'),_0x2619c3,_0xebf2('0x13'),JSON[_0xebf2('0x16')](_0x1c3687));if(_0x1c3687[_0xebf2('0x17')]){if(_0x1c3687['error'][_0xebf2('0x18')]===0x1f4){logger[_0xebf2('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x2619c3,_0x1c3687[_0xebf2('0x17')][_0xebf2('0x19')]);return _0x363634(_0x1c3687[_0xebf2('0x17')][_0xebf2('0x19')]);}logger['error'](_0xebf2('0x12'),_0x2619c3,_0x1c3687[_0xebf2('0x17')][_0xebf2('0x19')]);return _0x249208(_0x1c3687[_0xebf2('0x17')][_0xebf2('0x19')]);}else{logger['info'](_0xebf2('0x12'),_0x2619c3,_0xebf2('0x13'));_0x249208(_0x1c3687[_0xebf2('0x1a')][_0xebf2('0x19')]);}})[_0xebf2('0x1b')](function(_0x16daf4){logger[_0xebf2('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x2619c3,_0x16daf4);_0x363634(_0x16daf4);});});}exports[_0xebf2('0x1c')]=function(_0x607823){var _0x4ecc30=this;return new Promise(function(_0x4ed98a,_0x3d781b){return db[_0xebf2('0x1d')][_0xebf2('0x1e')]({'raw':_0x607823[_0xebf2('0x1f')]?_0x607823[_0xebf2('0x1f')][_0xebf2('0x20')]===undefined?!![]:![]:!![],'where':_0x607823[_0xebf2('0x1f')]?_0x607823[_0xebf2('0x1f')]['where']||null:null,'attributes':_0x607823[_0xebf2('0x1f')]?_0x607823[_0xebf2('0x1f')][_0xebf2('0x21')]||null:null,'limit':_0x607823[_0xebf2('0x1f')]?_0x607823[_0xebf2('0x1f')][_0xebf2('0x22')]||null:null,'include':_0x607823[_0xebf2('0x1f')]?_0x607823[_0xebf2('0x1f')]['include']?_[_0xebf2('0x23')](_0x607823[_0xebf2('0x1f')][_0xebf2('0x24')],function(_0x3d4e18){return{'model':db[_0x3d4e18[_0xebf2('0x25')]],'as':_0x3d4e18['as'],'attributes':_0x3d4e18[_0xebf2('0x21')],'include':_0x3d4e18['include']?_[_0xebf2('0x23')](_0x3d4e18[_0xebf2('0x24')],function(_0x52d610){return{'model':db[_0x52d610[_0xebf2('0x25')]],'as':_0x52d610['as'],'attributes':_0x52d610['attributes'],'include':_0x52d610[_0xebf2('0x24')]?_[_0xebf2('0x23')](_0x52d610[_0xebf2('0x24')],function(_0x169e34){return{'model':db[_0x169e34[_0xebf2('0x25')]],'as':_0x169e34['as'],'attributes':_0x169e34[_0xebf2('0x21')]};}):[]};}):[]};}):[]:[]})[_0xebf2('0x10')](function(_0x11638b){logger[_0xebf2('0x11')](_0xebf2('0x1c'),_0x607823);logger[_0xebf2('0x14')](_0xebf2('0x1c'),_0x607823,JSON['stringify'](_0x11638b));_0x4ed98a(_0x11638b);})['catch'](function(_0x1d93ff){logger['error'](_0xebf2('0x1c'),_0x1d93ff[_0xebf2('0x19')],_0x607823);_0x3d781b(_0x4ecc30['error'](0x1f4,_0x1d93ff[_0xebf2('0x19')]));});});};exports[_0xebf2('0x26')]=function(_0x19140a){var _0x39df98=this;return new Promise(function(_0x4adfec,_0x5cfc3a){return db[_0xebf2('0x1d')][_0xebf2('0x27')]({'raw':_0x19140a['options']?_0x19140a['options']['raw']===undefined?!![]:![]:!![],'where':_0x19140a[_0xebf2('0x1f')]?_0x19140a[_0xebf2('0x1f')]['where']||null:null,'attributes':_0x19140a[_0xebf2('0x1f')]?_0x19140a[_0xebf2('0x1f')][_0xebf2('0x21')]||null:null,'include':_0x19140a[_0xebf2('0x1f')]?_0x19140a['options']['include']?_['map'](_0x19140a[_0xebf2('0x1f')][_0xebf2('0x24')],function(_0x4fd18d){return{'model':db[_0x4fd18d[_0xebf2('0x25')]],'as':_0x4fd18d['as'],'attributes':_0x4fd18d[_0xebf2('0x21')],'include':_0x4fd18d['include']?_[_0xebf2('0x23')](_0x4fd18d[_0xebf2('0x24')],function(_0x17ead3){return{'model':db[_0x17ead3[_0xebf2('0x25')]],'as':_0x17ead3['as'],'attributes':_0x17ead3[_0xebf2('0x21')],'include':_0x17ead3['include']?_[_0xebf2('0x23')](_0x17ead3['include'],function(_0x2af9d5){return{'model':db[_0x2af9d5[_0xebf2('0x25')]],'as':_0x2af9d5['as'],'attributes':_0x2af9d5['attributes']};}):[]};}):[]};}):[]:[]})[_0xebf2('0x10')](function(_0x41ceb3){logger['info']('ShowVoiceQueue',_0x19140a);logger[_0xebf2('0x14')]('ShowVoiceQueue',_0x19140a,JSON[_0xebf2('0x16')](_0x41ceb3));_0x4adfec(_0x41ceb3);})[_0xebf2('0x1b')](function(_0x404499){logger[_0xebf2('0x17')](_0xebf2('0x26'),_0x404499[_0xebf2('0x19')],_0x19140a);_0x5cfc3a(_0x39df98[_0xebf2('0x17')](0x1f4,_0x404499[_0xebf2('0x19')]));});});}; \ No newline at end of file +var _0x6a7d=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueue','findAll','options','where','attributes','map','include','model','GetVoiceQueue','ShowVoiceQueue','find','lodash','util','moment','bluebird','ioredis'];(function(_0x3c36dc,_0x5aeb99){var _0x92c04b=function(_0x298cf3){while(--_0x298cf3){_0x3c36dc['push'](_0x3c36dc['shift']());}};_0x92c04b(++_0x5aeb99);}(_0x6a7d,0x67));var _0xd6a7=function(_0x64daf7,_0x3ce579){_0x64daf7=_0x64daf7-0x0;var _0x11d8d8=_0x6a7d[_0x64daf7];return _0x11d8d8;};'use strict';var _=require(_0xd6a7('0x0'));var util=require(_0xd6a7('0x1'));var moment=require(_0xd6a7('0x2'));var BPromise=require(_0xd6a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6a7('0x4'));var db=require(_0xd6a7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd6a7('0x6'));var config=require(_0xd6a7('0x7'));var jayson=require(_0xd6a7('0x8'));var client=jayson[_0xd6a7('0x9')]['http']({'port':0x232a});config[_0xd6a7('0xa')]=_['defaults'](config['redis'],{'host':_0xd6a7('0xb'),'port':0x18eb});var socket=require(_0xd6a7('0xc'))(new Redis(config[_0xd6a7('0xa')]));require('./voiceQueue.socket')[_0xd6a7('0xd')](socket);function respondWithRpcPromise(_0x59dc57,_0x51aace,_0x5b8742){return new BPromise(function(_0x37d840,_0x1960c8){return client['request'](_0x59dc57,_0x5b8742)[_0xd6a7('0xe')](function(_0x15e536){logger[_0xd6a7('0xf')](_0xd6a7('0x10'),_0x51aace,_0xd6a7('0x11'));logger[_0xd6a7('0x12')](_0xd6a7('0x13'),_0x51aace,_0xd6a7('0x11'),JSON[_0xd6a7('0x14')](_0x15e536));if(_0x15e536[_0xd6a7('0x15')]){if(_0x15e536[_0xd6a7('0x15')]['code']===0x1f4){logger['error'](_0xd6a7('0x10'),_0x51aace,_0x15e536[_0xd6a7('0x15')][_0xd6a7('0x16')]);return _0x1960c8(_0x15e536[_0xd6a7('0x15')][_0xd6a7('0x16')]);}logger['error'](_0xd6a7('0x10'),_0x51aace,_0x15e536['error']['message']);return _0x37d840(_0x15e536['error'][_0xd6a7('0x16')]);}else{logger[_0xd6a7('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x51aace,_0xd6a7('0x11'));_0x37d840(_0x15e536[_0xd6a7('0x17')][_0xd6a7('0x16')]);}})[_0xd6a7('0x18')](function(_0x123075){logger[_0xd6a7('0x15')](_0xd6a7('0x10'),_0x51aace,_0x123075);_0x1960c8(_0x123075);});});}exports['GetVoiceQueue']=function(_0x150bc7){var _0x58e8b4=this;return new Promise(function(_0x16aa7b,_0x493bde){return db[_0xd6a7('0x19')][_0xd6a7('0x1a')]({'raw':_0x150bc7[_0xd6a7('0x1b')]?_0x150bc7[_0xd6a7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x150bc7[_0xd6a7('0x1b')]?_0x150bc7[_0xd6a7('0x1b')][_0xd6a7('0x1c')]||null:null,'attributes':_0x150bc7['options']?_0x150bc7[_0xd6a7('0x1b')][_0xd6a7('0x1d')]||null:null,'limit':_0x150bc7[_0xd6a7('0x1b')]?_0x150bc7[_0xd6a7('0x1b')]['limit']||null:null,'include':_0x150bc7[_0xd6a7('0x1b')]?_0x150bc7['options']['include']?_[_0xd6a7('0x1e')](_0x150bc7['options'][_0xd6a7('0x1f')],function(_0x1eb4c4){return{'model':db[_0x1eb4c4[_0xd6a7('0x20')]],'as':_0x1eb4c4['as'],'attributes':_0x1eb4c4['attributes'],'include':_0x1eb4c4[_0xd6a7('0x1f')]?_[_0xd6a7('0x1e')](_0x1eb4c4[_0xd6a7('0x1f')],function(_0x201853){return{'model':db[_0x201853['model']],'as':_0x201853['as'],'attributes':_0x201853['attributes'],'include':_0x201853[_0xd6a7('0x1f')]?_[_0xd6a7('0x1e')](_0x201853[_0xd6a7('0x1f')],function(_0x116bbb){return{'model':db[_0x116bbb[_0xd6a7('0x20')]],'as':_0x116bbb['as'],'attributes':_0x116bbb[_0xd6a7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd6a7('0xe')](function(_0x5d62ed){logger['info'](_0xd6a7('0x21'),_0x150bc7);logger[_0xd6a7('0x12')](_0xd6a7('0x21'),_0x150bc7,JSON[_0xd6a7('0x14')](_0x5d62ed));_0x16aa7b(_0x5d62ed);})['catch'](function(_0x4977c5){logger[_0xd6a7('0x15')](_0xd6a7('0x21'),_0x4977c5[_0xd6a7('0x16')],_0x150bc7);_0x493bde(_0x58e8b4[_0xd6a7('0x15')](0x1f4,_0x4977c5[_0xd6a7('0x16')]));});});};exports[_0xd6a7('0x22')]=function(_0x2d259f){var _0x32da65=this;return new Promise(function(_0x3cbd67,_0x3d7d8c){return db[_0xd6a7('0x19')][_0xd6a7('0x23')]({'raw':_0x2d259f['options']?_0x2d259f[_0xd6a7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2d259f[_0xd6a7('0x1b')]?_0x2d259f['options'][_0xd6a7('0x1c')]||null:null,'attributes':_0x2d259f[_0xd6a7('0x1b')]?_0x2d259f[_0xd6a7('0x1b')][_0xd6a7('0x1d')]||null:null,'include':_0x2d259f[_0xd6a7('0x1b')]?_0x2d259f[_0xd6a7('0x1b')][_0xd6a7('0x1f')]?_[_0xd6a7('0x1e')](_0x2d259f['options'][_0xd6a7('0x1f')],function(_0x26947d){return{'model':db[_0x26947d['model']],'as':_0x26947d['as'],'attributes':_0x26947d['attributes'],'include':_0x26947d[_0xd6a7('0x1f')]?_['map'](_0x26947d[_0xd6a7('0x1f')],function(_0x33754b){return{'model':db[_0x33754b[_0xd6a7('0x20')]],'as':_0x33754b['as'],'attributes':_0x33754b[_0xd6a7('0x1d')],'include':_0x33754b[_0xd6a7('0x1f')]?_[_0xd6a7('0x1e')](_0x33754b['include'],function(_0x5c17ae){return{'model':db[_0x5c17ae[_0xd6a7('0x20')]],'as':_0x5c17ae['as'],'attributes':_0x5c17ae[_0xd6a7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd6a7('0xe')](function(_0x50d04f){logger[_0xd6a7('0xf')]('ShowVoiceQueue',_0x2d259f);logger[_0xd6a7('0x12')](_0xd6a7('0x22'),_0x2d259f,JSON[_0xd6a7('0x14')](_0x50d04f));_0x3cbd67(_0x50d04f);})[_0xd6a7('0x18')](function(_0x59ed67){logger['error'](_0xd6a7('0x22'),_0x59ed67[_0xd6a7('0x16')],_0x2d259f);_0x3d7d8c(_0x32da65[_0xd6a7('0x15')](0x1f4,_0x59ed67['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 67ebb71..98f1949 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 _0xc6ed=['remove','update','emit','removeListener','length','save'];(function(_0x496241,_0x25f7cd){var _0x1385f4=function(_0x1ccbfd){while(--_0x1ccbfd){_0x496241['push'](_0x496241['shift']());}};_0x1385f4(++_0x25f7cd);}(_0xc6ed,0x197));var _0xdc6e=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xc6ed[_0x9c2427];return _0x51984f;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xdc6e('0x0'),_0xdc6e('0x1'),_0xdc6e('0x2')];function createListener(_0x2bd23c,_0x3f0f0a){return function(_0x63d95b){_0x3f0f0a[_0xdc6e('0x3')](_0x2bd23c,_0x63d95b);};}function removeListener(_0xed65e8,_0xfa5d31){return function(){VoiceQueueEvents[_0xdc6e('0x4')](_0xed65e8,_0xfa5d31);};}exports['register']=function(_0x420108){for(var _0x3a5262=0x0,_0x215661=events[_0xdc6e('0x5')];_0x3a5262<_0x215661;_0x3a5262++){var _0x23beb2=events[_0x3a5262];var _0x1db159=createListener('voiceQueue:'+_0x23beb2,_0x420108);VoiceQueueEvents['on'](_0x23beb2,_0x1db159);}}; \ No newline at end of file +var _0x542c=['update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x5f33aa,_0x1a78d0){var _0x20a1bc=function(_0x34e544){while(--_0x34e544){_0x5f33aa['push'](_0x5f33aa['shift']());}};_0x20a1bc(++_0x1a78d0);}(_0x542c,0xa8));var _0xc542=function(_0x5e8c7e,_0x4ef9bd){_0x5e8c7e=_0x5e8c7e-0x0;var _0x8cb5c3=_0x542c[_0x5e8c7e];return _0x8cb5c3;};'use strict';var VoiceQueueEvents=require(_0xc542('0x0'));var events=[_0xc542('0x1'),_0xc542('0x2'),_0xc542('0x3')];function createListener(_0x320d9d,_0xd35365){return function(_0x3dd8b2){_0xd35365[_0xc542('0x4')](_0x320d9d,_0x3dd8b2);};}function removeListener(_0x6d540c,_0x10eb71){return function(){VoiceQueueEvents[_0xc542('0x5')](_0x6d540c,_0x10eb71);};}exports[_0xc542('0x6')]=function(_0x503ffc){for(var _0x2b1c63=0x0,_0x28fc6f=events[_0xc542('0x7')];_0x2b1c63<_0x28fc6f;_0x2b1c63++){var _0x1fe8ce=events[_0x2b1c63];var _0x31a7df=createListener(_0xc542('0x8')+_0x1fe8ce,_0x503ffc);VoiceQueueEvents['on'](_0x1fe8ce,_0x31a7df);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d23990d..d434867 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 _0x5106=['show','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id'];(function(_0x14501c,_0x3db08b){var _0x13cbab=function(_0x15b2e5){while(--_0x15b2e5){_0x14501c['push'](_0x14501c['shift']());}};_0x13cbab(++_0x3db08b);}(_0x5106,0x11d));var _0x6510=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5106[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x6510('0x0'));var util=require('util');var path=require(_0x6510('0x1'));var timeout=require(_0x6510('0x2'));var express=require(_0x6510('0x3'));var router=express[_0x6510('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6510('0x5'));var config=require(_0x6510('0x6'));var controller=require(_0x6510('0x7'));router[_0x6510('0x8')]('/',auth[_0x6510('0x9')](),controller[_0x6510('0xa')]);router[_0x6510('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6510('0xb')]);router[_0x6510('0x8')](_0x6510('0xc'),auth['isAuthenticated'](),controller[_0x6510('0xd')]);router[_0x6510('0x8')](_0x6510('0xe'),auth['isAuthenticated'](),controller[_0x6510('0xf')]);router['post']('/',auth[_0x6510('0x9')](),controller['create']);router[_0x6510('0x10')](_0x6510('0xe'),auth[_0x6510('0x9')](),controller[_0x6510('0x11')]);router[_0x6510('0x12')](_0x6510('0xe'),auth[_0x6510('0x9')](),controller['destroy']);module[_0x6510('0x13')]=router; \ No newline at end of file +var _0xacdd=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','/:id','create','put'];(function(_0x371d15,_0xd98587){var _0x32afdf=function(_0x587ba3){while(--_0x587ba3){_0x371d15['push'](_0x371d15['shift']());}};_0x32afdf(++_0xd98587);}(_0xacdd,0x1d0));var _0xdacd=function(_0x3c5f8d,_0x39891f){_0x3c5f8d=_0x3c5f8d-0x0;var _0x3b7beb=_0xacdd[_0x3c5f8d];return _0x3b7beb;};'use strict';var multer=require(_0xdacd('0x0'));var util=require('util');var path=require(_0xdacd('0x1'));var timeout=require(_0xdacd('0x2'));var express=require(_0xdacd('0x3'));var router=express[_0xdacd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdacd('0x5'));var interaction=require(_0xdacd('0x6'));var config=require('../../config/environment');var controller=require(_0xdacd('0x7'));router[_0xdacd('0x8')]('/',auth[_0xdacd('0x9')](),controller['index']);router['get'](_0xdacd('0xa'),auth[_0xdacd('0x9')](),controller[_0xdacd('0xb')]);router[_0xdacd('0x8')](_0xdacd('0xc'),auth[_0xdacd('0x9')](),controller['getVoiceQueuesReport']);router[_0xdacd('0x8')](_0xdacd('0xd'),auth[_0xdacd('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdacd('0xe')]);router[_0xdacd('0xf')](_0xdacd('0xd'),auth['isAuthenticated'](),controller[_0xdacd('0x10')]);router[_0xdacd('0x11')](_0xdacd('0xd'),auth[_0xdacd('0x9')](),controller[_0xdacd('0x12')]);module[_0xdacd('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index bf20aaf..efdb2ed 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 _0xe702=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','INTEGER','BOOLEAN'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0xe702,0x7b));var _0x2e70=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xe702[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x2e70('0x0')]},'uniqueid':{'type':Sequelize[_0x2e70('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2e70('0x0')]},'queuecallerjoinAt':{'type':Sequelize[_0x2e70('0x1')]},'queuecallerleaveAt':{'type':Sequelize[_0x2e70('0x1')],'set':function(_0x1a4887){var _0x1ea4ea=moment(_0x1a4887);var _0x4dac9c=moment(this[_0x2e70('0x2')]('queuecallerjoinAt'))[_0x2e70('0x3')](_0x2e70('0x4'));var _0x3e5961=_0x1ea4ea['diff'](_0x4dac9c,_0x2e70('0x5'));this['setDataValue']('queuecallerleaveAt',_0x1a4887);this[_0x2e70('0x6')]('holdtime',_0x3e5961||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x2e70('0x7')]},'queuecallerabandon':{'type':Sequelize[_0x2e70('0x8')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2e70('0x1')]},'queuecallerexit':{'type':Sequelize[_0x2e70('0x8')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2e70('0x1')]},'queuecallerexitreason':{'type':Sequelize[_0x2e70('0x0')],'comment':_0x2e70('0x9')},'originalposition':{'type':Sequelize[_0x2e70('0x7')]},'channel':{'type':Sequelize[_0x2e70('0x0')]},'connectedlinenum':{'type':Sequelize[_0x2e70('0x0')]},'connectedlinename':{'type':Sequelize[_0x2e70('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2e70('0x0')]},'exten':{'type':Sequelize[_0x2e70('0x0')]},'priority':{'type':Sequelize[_0x2e70('0x0')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2e70('0x7')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2e70('0x8')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2e70('0x8')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2e70('0x0')],'comment':_0x2e70('0xa')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2e70('0x0')]},'disposition':{'type':Sequelize[_0x2e70('0x0')]},'secondDisposition':{'type':Sequelize[_0x2e70('0x0')]},'thirdDisposition':{'type':Sequelize[_0x2e70('0x0')]},'queuecallerenterreason':{'type':Sequelize[_0x2e70('0x7')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d08=['STRING','DATE','getDataValue','queuecallerjoinAt','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports'];(function(_0x9ea933,_0x565d76){var _0x4fdcd0=function(_0x1b1b59){while(--_0x1b1b59){_0x9ea933['push'](_0x9ea933['shift']());}};_0x4fdcd0(++_0x565d76);}(_0x3d08,0xb4));var _0x83d0=function(_0x2e2524,_0xb35a6b){_0x2e2524=_0x2e2524-0x0;var _0xf581c=_0x3d08[_0x2e2524];return _0xf581c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x83d0('0x0'));module[_0x83d0('0x1')]={'type':{'type':Sequelize[_0x83d0('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x83d0('0x2')]},'calleridname':{'type':Sequelize[_0x83d0('0x2')]},'queue':{'type':Sequelize[_0x83d0('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x83d0('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x83d0('0x3')],'set':function(_0x512c9a){var _0x1ed555=moment(_0x512c9a);var _0x5751d3=moment(this[_0x83d0('0x4')](_0x83d0('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3d10f6=_0x1ed555[_0x83d0('0x6')](_0x5751d3,_0x83d0('0x7'));this[_0x83d0('0x8')](_0x83d0('0x9'),_0x512c9a);this[_0x83d0('0x8')]('holdtime',_0x3d10f6||null);}},'position':{'type':Sequelize[_0x83d0('0xa')]},'count':{'type':Sequelize[_0x83d0('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x83d0('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x83d0('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x83d0('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x83d0('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x83d0('0x2')],'comment':_0x83d0('0xc')},'originalposition':{'type':Sequelize[_0x83d0('0xa')]},'channel':{'type':Sequelize[_0x83d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x83d0('0x2')]},'connectedlinename':{'type':Sequelize[_0x83d0('0x2')]},'accountcode':{'type':Sequelize[_0x83d0('0x2')]},'context':{'type':Sequelize[_0x83d0('0x2')]},'exten':{'type':Sequelize[_0x83d0('0x2')]},'priority':{'type':Sequelize[_0x83d0('0x2')]},'holdtime':{'type':Sequelize[_0x83d0('0xa')]},'mohtime':{'type':Sequelize[_0x83d0('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x83d0('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x83d0('0x2')]},'transfer':{'type':Sequelize[_0x83d0('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x83d0('0x2')],'comment':_0x83d0('0xd')},'transferexten':{'type':Sequelize[_0x83d0('0x2')]},'transferuniqueid':{'type':Sequelize[_0x83d0('0x2')]},'disposition':{'type':Sequelize[_0x83d0('0x2')]},'secondDisposition':{'type':Sequelize[_0x83d0('0x2')]},'thirdDisposition':{'type':Sequelize[_0x83d0('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x83d0('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x83d0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 1599570..ce274b6 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 _0xd108=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','fields','length','find','catch','create','body','describe','getVoiceQueuesReport','options','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x9ce42d,_0x153723){var _0xcb720e=function(_0x4f931d){while(--_0x4f931d){_0x9ce42d['push'](_0x9ce42d['shift']());}};_0xcb720e(++_0x153723);}(_0xd108,0x191));var _0x8d10=function(_0x4e0e9b,_0x45999e){_0x4e0e9b=_0x4e0e9b-0x0;var _0x4790b2=_0xd108[_0x4e0e9b];return _0x4790b2;};'use strict';var emlformat=require(_0x8d10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d10('0x1'));var jsonpatch=require(_0x8d10('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8d10('0x3'));var Mustache=require(_0x8d10('0x4'));var util=require(_0x8d10('0x5'));var path=require('path');var sox=require(_0x8d10('0x6'));var csv=require(_0x8d10('0x7'));var ejs=require(_0x8d10('0x8'));var fs=require('fs');var fs_extra=require(_0x8d10('0x9'));var _=require(_0x8d10('0xa'));var squel=require('squel');var crypto=require(_0x8d10('0xb'));var jsforce=require(_0x8d10('0xc'));var deskjs=require(_0x8d10('0xd'));var toCsv=require(_0x8d10('0x7'));var querystring=require(_0x8d10('0xe'));var Papa=require(_0x8d10('0xf'));var Redis=require(_0x8d10('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8d10('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d10('0x12'));var logger=require(_0x8d10('0x13'))(_0x8d10('0x14'));var utils=require('../../config/utils');var config=require(_0x8d10('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8d10('0x16')]=_['defaults'](config['redis'],{'host':_0x8d10('0x17'),'port':0x18eb});var socket=require(_0x8d10('0x18'))(new Redis(config[_0x8d10('0x16')]));require(_0x8d10('0x19'))[_0x8d10('0x1a')](socket);function respondWithStatusCode(_0x50e5b0,_0x2f7fc0){_0x2f7fc0=_0x2f7fc0||0xcc;return function(_0x4bdb84){if(_0x4bdb84){return _0x50e5b0[_0x8d10('0x1b')](_0x2f7fc0);}return _0x50e5b0[_0x8d10('0x1c')](_0x2f7fc0)[_0x8d10('0x1d')]();};}function respondWithResult(_0xb74ab0,_0x178cb0){_0x178cb0=_0x178cb0||0xc8;return function(_0x5d35a5){if(_0x5d35a5){return _0xb74ab0[_0x8d10('0x1c')](_0x178cb0)[_0x8d10('0x1e')](_0x5d35a5);}};}function respondWithFilteredResult(_0x5c4d33,_0x27be30){return function(_0x1a29ad){if(_0x1a29ad){var _0x130a12=typeof _0x27be30[_0x8d10('0x1f')]===_0x8d10('0x20')&&typeof _0x27be30[_0x8d10('0x21')]===_0x8d10('0x20');var _0x3cc49e=_0x1a29ad[_0x8d10('0x22')];var _0x1a7a04=_0x130a12?0x0:_0x27be30[_0x8d10('0x1f')];var _0x55360e=_0x130a12?_0x1a29ad[_0x8d10('0x22')]:_0x27be30[_0x8d10('0x1f')]+_0x27be30[_0x8d10('0x21')];var _0x13409a;if(_0x55360e>=_0x3cc49e){_0x55360e=_0x3cc49e;_0x13409a=0xc8;}else{_0x13409a=0xce;}_0x5c4d33['status'](_0x13409a);return _0x5c4d33['set'](_0x8d10('0x23'),_0x1a7a04+'-'+_0x55360e+'/'+_0x3cc49e)[_0x8d10('0x1e')](_0x1a29ad);}return null;};}function patchUpdates(_0x2d73dc){return function(_0x363581){try{jsonpatch[_0x8d10('0x24')](_0x363581,_0x2d73dc,!![]);}catch(_0x209aa4){return BPromise[_0x8d10('0x25')](_0x209aa4);}return _0x363581[_0x8d10('0x26')]();};}function saveUpdates(_0x5b3a6f,_0xbf5920){return function(_0x2f5338){if(_0x2f5338){return _0x2f5338[_0x8d10('0x27')](_0x5b3a6f)[_0x8d10('0x28')](function(_0x4949a0){return _0x4949a0;});}return null;};}function removeEntity(_0x4ffba3,_0x3648bd){return function(_0x159cac){if(_0x159cac){return _0x159cac[_0x8d10('0x29')]()['then'](function(){_0x4ffba3['status'](0xcc)[_0x8d10('0x1d')]();});}};}function handleEntityNotFound(_0x4e4914,_0x5b7db9){return function(_0x1d5f1d){if(!_0x1d5f1d){_0x4e4914[_0x8d10('0x1b')](0x194);}return _0x1d5f1d;};}function handleError(_0x17e2ba,_0x22d4e6){_0x22d4e6=_0x22d4e6||0x1f4;return function(_0x5bd86e){logger[_0x8d10('0x2a')](_0x5bd86e[_0x8d10('0x2b')]);if(_0x5bd86e[_0x8d10('0x2c')]){delete _0x5bd86e[_0x8d10('0x2c')];}_0x17e2ba[_0x8d10('0x1c')](_0x22d4e6)[_0x8d10('0x2d')](_0x5bd86e);};}exports[_0x8d10('0x2e')]=function(_0x50ffcd,_0x2dc8c8){var _0x36bc17={},_0x5b357b={},_0x5dcd7c={'count':0x0,'rows':[]};var _0xbae41b=_[_0x8d10('0x2f')](db[_0x8d10('0x30')][_0x8d10('0x31')],function(_0x29034f){return{'name':_0x29034f[_0x8d10('0x32')],'type':_0x29034f['type'][_0x8d10('0x33')]};});_0x5b357b[_0x8d10('0x34')]=_['map'](_0xbae41b,_0x8d10('0x2c'));_0x5b357b['query']=_['keys'](_0x50ffcd[_0x8d10('0x35')]);_0x5b357b[_0x8d10('0x36')]=_[_0x8d10('0x37')](_0x5b357b[_0x8d10('0x34')],_0x5b357b[_0x8d10('0x35')]);_0x36bc17[_0x8d10('0x38')]=_[_0x8d10('0x37')](_0x5b357b[_0x8d10('0x34')],qs['fields'](_0x50ffcd[_0x8d10('0x35')]['fields']));_0x36bc17['attributes']=_0x36bc17['attributes']['length']?_0x36bc17[_0x8d10('0x38')]:_0x5b357b[_0x8d10('0x34')];if(!_0x50ffcd['query'][_0x8d10('0x39')](_0x8d10('0x3a'))){_0x36bc17[_0x8d10('0x21')]=qs['limit'](_0x50ffcd[_0x8d10('0x35')]['limit']);_0x36bc17[_0x8d10('0x1f')]=qs[_0x8d10('0x1f')](_0x50ffcd[_0x8d10('0x35')][_0x8d10('0x1f')]);}_0x36bc17[_0x8d10('0x3b')]=qs[_0x8d10('0x3c')](_0x50ffcd['query'][_0x8d10('0x3c')]);_0x36bc17['where']=qs[_0x8d10('0x36')](_[_0x8d10('0x3d')](_0x50ffcd[_0x8d10('0x35')],_0x5b357b[_0x8d10('0x36')]),_0xbae41b);if(_0x50ffcd[_0x8d10('0x35')][_0x8d10('0x3e')]){_0x36bc17['where']=_['merge'](_0x36bc17[_0x8d10('0x3f')],{'$or':_['map'](_0xbae41b,function(_0x1f6708){if(_0x1f6708['type']!==_0x8d10('0x40')){var _0x28dc21={};_0x28dc21[_0x1f6708['name']]={'$like':'%'+_0x50ffcd['query'][_0x8d10('0x3e')]+'%'};return _0x28dc21;}})});}_0x36bc17=_[_0x8d10('0x41')]({},_0x36bc17,_0x50ffcd['options']);var _0xfb4c6f={'where':_0x36bc17['where']};return db[_0x8d10('0x30')]['count'](_0xfb4c6f)[_0x8d10('0x28')](function(_0x1b3c2c){_0x5dcd7c[_0x8d10('0x22')]=_0x1b3c2c;if(_0x50ffcd[_0x8d10('0x35')][_0x8d10('0x42')]){_0x36bc17[_0x8d10('0x43')]=[{'all':!![]}];}return db[_0x8d10('0x30')][_0x8d10('0x44')](_0x36bc17);})[_0x8d10('0x28')](function(_0x543462){_0x5dcd7c[_0x8d10('0x45')]=_0x543462;return _0x5dcd7c;})[_0x8d10('0x28')](respondWithFilteredResult(_0x2dc8c8,_0x36bc17))['catch'](handleError(_0x2dc8c8,null));};exports[_0x8d10('0x46')]=function(_0x2d2930,_0x44ef1c){var _0x5df0cd={'raw':![],'where':{'id':_0x2d2930[_0x8d10('0x47')]['id']}},_0x124c48={};_0x124c48[_0x8d10('0x34')]=_['keys'](db[_0x8d10('0x30')][_0x8d10('0x31')]);_0x124c48[_0x8d10('0x35')]=_[_0x8d10('0x48')](_0x2d2930['query']);_0x124c48[_0x8d10('0x36')]=_['intersection'](_0x124c48[_0x8d10('0x34')],_0x124c48[_0x8d10('0x35')]);_0x5df0cd[_0x8d10('0x38')]=_['intersection'](_0x124c48[_0x8d10('0x34')],qs[_0x8d10('0x49')](_0x2d2930[_0x8d10('0x35')][_0x8d10('0x49')]));_0x5df0cd[_0x8d10('0x38')]=_0x5df0cd[_0x8d10('0x38')][_0x8d10('0x4a')]?_0x5df0cd[_0x8d10('0x38')]:_0x124c48[_0x8d10('0x34')];if(_0x2d2930[_0x8d10('0x35')][_0x8d10('0x42')]){_0x5df0cd[_0x8d10('0x43')]=[{'all':!![]}];}_0x5df0cd=_[_0x8d10('0x41')]({},_0x5df0cd,_0x2d2930['options']);return db['VoiceQueueReport'][_0x8d10('0x4b')](_0x5df0cd)['then'](handleEntityNotFound(_0x44ef1c,null))[_0x8d10('0x28')](respondWithResult(_0x44ef1c,null))[_0x8d10('0x4c')](handleError(_0x44ef1c,null));};exports[_0x8d10('0x4d')]=function(_0x4e59fa,_0x15ff16){return db[_0x8d10('0x30')][_0x8d10('0x4d')](_0x4e59fa[_0x8d10('0x4e')],{})['then'](respondWithResult(_0x15ff16,0xc9))[_0x8d10('0x4c')](handleError(_0x15ff16,null));};exports[_0x8d10('0x27')]=function(_0x5f23a3,_0x16dfbd){if(_0x5f23a3['body']['id']){delete _0x5f23a3['body']['id'];}return db[_0x8d10('0x30')]['find']({'where':{'id':_0x5f23a3['params']['id']}})[_0x8d10('0x28')](handleEntityNotFound(_0x16dfbd,null))[_0x8d10('0x28')](saveUpdates(_0x5f23a3[_0x8d10('0x4e')],null))[_0x8d10('0x28')](respondWithResult(_0x16dfbd,null))[_0x8d10('0x4c')](handleError(_0x16dfbd,null));};exports[_0x8d10('0x29')]=function(_0x1eb31c,_0x48fbd1){return db[_0x8d10('0x30')]['find']({'where':{'id':_0x1eb31c[_0x8d10('0x47')]['id']}})['then'](handleEntityNotFound(_0x48fbd1,null))['then'](removeEntity(_0x48fbd1,null))['catch'](handleError(_0x48fbd1,null));};exports[_0x8d10('0x4f')]=function(_0xa6cbfd,_0x38e8d4){return db[_0x8d10('0x30')]['describe']()[_0x8d10('0x28')](respondWithResult(_0x38e8d4,null))['catch'](handleError(_0x38e8d4,null));};exports[_0x8d10('0x50')]=function(_0x2e2324,_0x52d387){var _0xe8f108={},_0x5c182e={},_0x1bb82f={'count':0x0,'rows':[]};_0x5c182e[_0x8d10('0x34')]=_['keys'](db['VoiceQueueReport'][_0x8d10('0x31')]);_0x5c182e['query']=_[_0x8d10('0x48')](_0x2e2324['query']);_0x5c182e[_0x8d10('0x36')]=_[_0x8d10('0x37')](_0x5c182e[_0x8d10('0x34')],_0x5c182e[_0x8d10('0x35')]);_0xe8f108[_0x8d10('0x38')]=_[_0x8d10('0x37')](_0x5c182e[_0x8d10('0x34')],qs['fields'](_0x2e2324[_0x8d10('0x35')]['fields']));_0xe8f108[_0x8d10('0x38')]=_0xe8f108[_0x8d10('0x38')][_0x8d10('0x4a')]?_0xe8f108[_0x8d10('0x38')]:_0x5c182e[_0x8d10('0x34')];if(!_0x2e2324[_0x8d10('0x35')][_0x8d10('0x39')](_0x8d10('0x3a'))){_0xe8f108[_0x8d10('0x21')]=qs['limit'](_0x2e2324[_0x8d10('0x35')]['limit']);_0xe8f108['offset']=qs[_0x8d10('0x1f')](_0x2e2324['query'][_0x8d10('0x1f')]);}_0xe8f108[_0x8d10('0x3b')]=qs[_0x8d10('0x3c')](_0x2e2324['query'][_0x8d10('0x3c')]);_0xe8f108[_0x8d10('0x3f')]=qs[_0x8d10('0x36')](_['pick'](_0x2e2324['query'],_0x5c182e[_0x8d10('0x36')]));if(_0x2e2324['query'][_0x8d10('0x3e')]){_0xe8f108[_0x8d10('0x3f')]=_[_0x8d10('0x41')](_0xe8f108[_0x8d10('0x3f')],{'$or':_['map'](_0xe8f108['attributes'],function(_0x3b3f75){var _0x21657f={};_0x21657f[_0x3b3f75]={'$like':'%'+_0x2e2324[_0x8d10('0x35')][_0x8d10('0x3e')]+'%'};return _0x21657f;})});}_0xe8f108=_['merge']({},_0xe8f108,_0x2e2324[_0x8d10('0x51')]);var _0x2a9c7c={'where':_0xe8f108[_0x8d10('0x3f')]};return db[_0x8d10('0x30')][_0x8d10('0x22')](_0x2a9c7c)[_0x8d10('0x28')](function(_0x112517){_0x1bb82f[_0x8d10('0x22')]=_0x112517;if(_0x2e2324[_0x8d10('0x35')][_0x8d10('0x42')]){_0xe8f108['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x8d10('0x44')](_0xe8f108);})[_0x8d10('0x28')](function(_0x390933){_0x1bb82f[_0x8d10('0x45')]=_0x390933;return _0x1bb82f;})[_0x8d10('0x28')](respondWithFilteredResult(_0x52d387,_0xe8f108,_0x8d10('0x50')))[_0x8d10('0x4c')](handleError(_0x52d387,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xfd66=['keys','merge','find','create','body','update','describe','getVoiceQueuesReport','rawAttributes','hasOwnProperty','pick','rimraf','zip-dir','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','VoiceQueueReport','type','key','map','filters','intersection','model','query','attributes','fields','length','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x389e53,_0x5c712e){var _0x3de690=function(_0x38d22d){while(--_0x38d22d){_0x389e53['push'](_0x389e53['shift']());}};_0x3de690(++_0x5c712e);}(_0xfd66,0x196));var _0x6fd6=function(_0x180cfc,_0x3dea59){_0x180cfc=_0x180cfc-0x0;var _0x38ae66=_0xfd66[_0x180cfc];return _0x38ae66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6fd6('0x0'));var zipdir=require(_0x6fd6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6fd6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6fd6('0x3'));var util=require(_0x6fd6('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x6fd6('0x5'));var ejs=require(_0x6fd6('0x6'));var fs=require('fs');var fs_extra=require(_0x6fd6('0x7'));var _=require(_0x6fd6('0x8'));var squel=require(_0x6fd6('0x9'));var crypto=require(_0x6fd6('0xa'));var jsforce=require(_0x6fd6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6fd6('0x5'));var querystring=require(_0x6fd6('0xc'));var Papa=require(_0x6fd6('0xd'));var Redis=require(_0x6fd6('0xe'));var authService=require(_0x6fd6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6fd6('0x10'));var hardwareService=require(_0x6fd6('0x11'));var logger=require(_0x6fd6('0x12'))('api');var utils=require(_0x6fd6('0x13'));var config=require(_0x6fd6('0x14'));var licenseUtil=require(_0x6fd6('0x15'));var db=require('../../mysqldb')['db'];config[_0x6fd6('0x16')]=_['defaults'](config[_0x6fd6('0x16')],{'host':_0x6fd6('0x17'),'port':0x18eb});var socket=require(_0x6fd6('0x18'))(new Redis(config[_0x6fd6('0x16')]));require('./voiceQueueReport.socket')[_0x6fd6('0x19')](socket);function respondWithStatusCode(_0x14d849,_0x2f35d7){_0x2f35d7=_0x2f35d7||0xcc;return function(_0x3a8fc5){if(_0x3a8fc5){return _0x14d849[_0x6fd6('0x1a')](_0x2f35d7);}return _0x14d849[_0x6fd6('0x1b')](_0x2f35d7)[_0x6fd6('0x1c')]();};}function respondWithResult(_0x4860b7,_0x55ed4a){_0x55ed4a=_0x55ed4a||0xc8;return function(_0x951ae){if(_0x951ae){return _0x4860b7['status'](_0x55ed4a)[_0x6fd6('0x1d')](_0x951ae);}};}function respondWithFilteredResult(_0x31e02d,_0x59b4f7){return function(_0x6e2b5a){if(_0x6e2b5a){var _0x2cb476=typeof _0x59b4f7[_0x6fd6('0x1e')]===_0x6fd6('0x1f')&&typeof _0x59b4f7[_0x6fd6('0x20')]==='undefined';var _0x50a6aa=_0x6e2b5a[_0x6fd6('0x21')];var _0x6c5747=_0x2cb476?0x0:_0x59b4f7[_0x6fd6('0x1e')];var _0x268672=_0x2cb476?_0x6e2b5a[_0x6fd6('0x21')]:_0x59b4f7[_0x6fd6('0x1e')]+_0x59b4f7[_0x6fd6('0x20')];var _0x5d0f9e;if(_0x268672>=_0x50a6aa){_0x268672=_0x50a6aa;_0x5d0f9e=0xc8;}else{_0x5d0f9e=0xce;}_0x31e02d[_0x6fd6('0x1b')](_0x5d0f9e);return _0x31e02d[_0x6fd6('0x22')](_0x6fd6('0x23'),_0x6c5747+'-'+_0x268672+'/'+_0x50a6aa)[_0x6fd6('0x1d')](_0x6e2b5a);}return null;};}function patchUpdates(_0x1d8503){return function(_0x63a41b){try{jsonpatch['apply'](_0x63a41b,_0x1d8503,!![]);}catch(_0x546d54){return BPromise[_0x6fd6('0x24')](_0x546d54);}return _0x63a41b[_0x6fd6('0x25')]();};}function saveUpdates(_0x7d9d5,_0x4c5f29){return function(_0x356d39){if(_0x356d39){return _0x356d39['update'](_0x7d9d5)[_0x6fd6('0x26')](function(_0x4bd585){return _0x4bd585;});}return null;};}function removeEntity(_0x1915f4,_0x8fdbd1){return function(_0x257374){if(_0x257374){return _0x257374[_0x6fd6('0x27')]()[_0x6fd6('0x26')](function(){_0x1915f4[_0x6fd6('0x1b')](0xcc)[_0x6fd6('0x1c')]();});}};}function handleEntityNotFound(_0x419902,_0x404dfa){return function(_0x202051){if(!_0x202051){_0x419902[_0x6fd6('0x1a')](0x194);}return _0x202051;};}function handleError(_0x5ef1ea,_0x22e6e1){_0x22e6e1=_0x22e6e1||0x1f4;return function(_0x4b17c8){logger[_0x6fd6('0x28')](_0x4b17c8['stack']);if(_0x4b17c8[_0x6fd6('0x29')]){delete _0x4b17c8[_0x6fd6('0x29')];}_0x5ef1ea[_0x6fd6('0x1b')](_0x22e6e1)[_0x6fd6('0x2a')](_0x4b17c8);};}exports[_0x6fd6('0x2b')]=function(_0x343361,_0x44bc36){var _0xea2088={},_0x5cca7d={},_0x82b6d7={'count':0x0,'rows':[]};var _0x1c9f4a=_['map'](db[_0x6fd6('0x2c')]['rawAttributes'],function(_0x1bf8f7){return{'name':_0x1bf8f7['fieldName'],'type':_0x1bf8f7[_0x6fd6('0x2d')][_0x6fd6('0x2e')]};});_0x5cca7d['model']=_[_0x6fd6('0x2f')](_0x1c9f4a,_0x6fd6('0x29'));_0x5cca7d['query']=_['keys'](_0x343361['query']);_0x5cca7d[_0x6fd6('0x30')]=_[_0x6fd6('0x31')](_0x5cca7d[_0x6fd6('0x32')],_0x5cca7d[_0x6fd6('0x33')]);_0xea2088[_0x6fd6('0x34')]=_['intersection'](_0x5cca7d[_0x6fd6('0x32')],qs['fields'](_0x343361[_0x6fd6('0x33')][_0x6fd6('0x35')]));_0xea2088[_0x6fd6('0x34')]=_0xea2088[_0x6fd6('0x34')][_0x6fd6('0x36')]?_0xea2088[_0x6fd6('0x34')]:_0x5cca7d[_0x6fd6('0x32')];if(!_0x343361[_0x6fd6('0x33')]['hasOwnProperty']('nolimit')){_0xea2088[_0x6fd6('0x20')]=qs[_0x6fd6('0x20')](_0x343361[_0x6fd6('0x33')][_0x6fd6('0x20')]);_0xea2088['offset']=qs[_0x6fd6('0x1e')](_0x343361[_0x6fd6('0x33')]['offset']);}_0xea2088[_0x6fd6('0x37')]=qs[_0x6fd6('0x38')](_0x343361[_0x6fd6('0x33')][_0x6fd6('0x38')]);_0xea2088[_0x6fd6('0x39')]=qs[_0x6fd6('0x30')](_['pick'](_0x343361[_0x6fd6('0x33')],_0x5cca7d[_0x6fd6('0x30')]),_0x1c9f4a);if(_0x343361[_0x6fd6('0x33')]['filter']){_0xea2088[_0x6fd6('0x39')]=_['merge'](_0xea2088[_0x6fd6('0x39')],{'$or':_[_0x6fd6('0x2f')](_0x1c9f4a,function(_0x33e507){if(_0x33e507[_0x6fd6('0x2d')]!==_0x6fd6('0x3a')){var _0x4beefa={};_0x4beefa[_0x33e507['name']]={'$like':'%'+_0x343361['query'][_0x6fd6('0x3b')]+'%'};return _0x4beefa;}})});}_0xea2088=_['merge']({},_0xea2088,_0x343361[_0x6fd6('0x3c')]);var _0x2a66b2={'where':_0xea2088[_0x6fd6('0x39')]};return db[_0x6fd6('0x2c')][_0x6fd6('0x21')](_0x2a66b2)['then'](function(_0x3e97a0){_0x82b6d7[_0x6fd6('0x21')]=_0x3e97a0;if(_0x343361['query'][_0x6fd6('0x3d')]){_0xea2088[_0x6fd6('0x3e')]=[{'all':!![]}];}return db[_0x6fd6('0x2c')][_0x6fd6('0x3f')](_0xea2088);})[_0x6fd6('0x26')](function(_0x16fdce){_0x82b6d7[_0x6fd6('0x40')]=_0x16fdce;return _0x82b6d7;})['then'](respondWithFilteredResult(_0x44bc36,_0xea2088))[_0x6fd6('0x41')](handleError(_0x44bc36,null));};exports[_0x6fd6('0x42')]=function(_0x2b7298,_0x517d6b){var _0x5abb1e={'raw':![],'where':{'id':_0x2b7298[_0x6fd6('0x43')]['id']}},_0x44450c={};_0x44450c[_0x6fd6('0x32')]=_[_0x6fd6('0x44')](db[_0x6fd6('0x2c')]['rawAttributes']);_0x44450c[_0x6fd6('0x33')]=_[_0x6fd6('0x44')](_0x2b7298[_0x6fd6('0x33')]);_0x44450c['filters']=_[_0x6fd6('0x31')](_0x44450c[_0x6fd6('0x32')],_0x44450c[_0x6fd6('0x33')]);_0x5abb1e[_0x6fd6('0x34')]=_[_0x6fd6('0x31')](_0x44450c[_0x6fd6('0x32')],qs['fields'](_0x2b7298[_0x6fd6('0x33')]['fields']));_0x5abb1e['attributes']=_0x5abb1e['attributes']['length']?_0x5abb1e['attributes']:_0x44450c[_0x6fd6('0x32')];if(_0x2b7298[_0x6fd6('0x33')][_0x6fd6('0x3d')]){_0x5abb1e[_0x6fd6('0x3e')]=[{'all':!![]}];}_0x5abb1e=_[_0x6fd6('0x45')]({},_0x5abb1e,_0x2b7298[_0x6fd6('0x3c')]);return db[_0x6fd6('0x2c')][_0x6fd6('0x46')](_0x5abb1e)[_0x6fd6('0x26')](handleEntityNotFound(_0x517d6b,null))[_0x6fd6('0x26')](respondWithResult(_0x517d6b,null))[_0x6fd6('0x41')](handleError(_0x517d6b,null));};exports[_0x6fd6('0x47')]=function(_0xfc80cd,_0x25ba0e){return db[_0x6fd6('0x2c')][_0x6fd6('0x47')](_0xfc80cd[_0x6fd6('0x48')],{})[_0x6fd6('0x26')](respondWithResult(_0x25ba0e,0xc9))[_0x6fd6('0x41')](handleError(_0x25ba0e,null));};exports[_0x6fd6('0x49')]=function(_0x17593f,_0x55caf3){if(_0x17593f['body']['id']){delete _0x17593f[_0x6fd6('0x48')]['id'];}return db['VoiceQueueReport'][_0x6fd6('0x46')]({'where':{'id':_0x17593f['params']['id']}})['then'](handleEntityNotFound(_0x55caf3,null))[_0x6fd6('0x26')](saveUpdates(_0x17593f['body'],null))[_0x6fd6('0x26')](respondWithResult(_0x55caf3,null))[_0x6fd6('0x41')](handleError(_0x55caf3,null));};exports[_0x6fd6('0x27')]=function(_0x5dbdf0,_0x446524){return db[_0x6fd6('0x2c')][_0x6fd6('0x46')]({'where':{'id':_0x5dbdf0[_0x6fd6('0x43')]['id']}})['then'](handleEntityNotFound(_0x446524,null))['then'](removeEntity(_0x446524,null))[_0x6fd6('0x41')](handleError(_0x446524,null));};exports[_0x6fd6('0x4a')]=function(_0x716de7,_0x28c1aa){return db[_0x6fd6('0x2c')]['describe']()[_0x6fd6('0x26')](respondWithResult(_0x28c1aa,null))[_0x6fd6('0x41')](handleError(_0x28c1aa,null));};exports[_0x6fd6('0x4b')]=function(_0x490652,_0x3b4459){var _0x4cc86e={},_0x3194a4={},_0x17ee96={'count':0x0,'rows':[]};_0x3194a4[_0x6fd6('0x32')]=_['keys'](db[_0x6fd6('0x2c')][_0x6fd6('0x4c')]);_0x3194a4[_0x6fd6('0x33')]=_[_0x6fd6('0x44')](_0x490652['query']);_0x3194a4[_0x6fd6('0x30')]=_[_0x6fd6('0x31')](_0x3194a4[_0x6fd6('0x32')],_0x3194a4[_0x6fd6('0x33')]);_0x4cc86e[_0x6fd6('0x34')]=_[_0x6fd6('0x31')](_0x3194a4[_0x6fd6('0x32')],qs['fields'](_0x490652['query'][_0x6fd6('0x35')]));_0x4cc86e['attributes']=_0x4cc86e['attributes'][_0x6fd6('0x36')]?_0x4cc86e[_0x6fd6('0x34')]:_0x3194a4[_0x6fd6('0x32')];if(!_0x490652['query'][_0x6fd6('0x4d')]('nolimit')){_0x4cc86e[_0x6fd6('0x20')]=qs[_0x6fd6('0x20')](_0x490652[_0x6fd6('0x33')]['limit']);_0x4cc86e['offset']=qs[_0x6fd6('0x1e')](_0x490652[_0x6fd6('0x33')]['offset']);}_0x4cc86e[_0x6fd6('0x37')]=qs[_0x6fd6('0x38')](_0x490652[_0x6fd6('0x33')][_0x6fd6('0x38')]);_0x4cc86e[_0x6fd6('0x39')]=qs['filters'](_[_0x6fd6('0x4e')](_0x490652[_0x6fd6('0x33')],_0x3194a4[_0x6fd6('0x30')]));if(_0x490652['query'][_0x6fd6('0x3b')]){_0x4cc86e[_0x6fd6('0x39')]=_[_0x6fd6('0x45')](_0x4cc86e[_0x6fd6('0x39')],{'$or':_['map'](_0x4cc86e['attributes'],function(_0x38b36d){var _0x4149cf={};_0x4149cf[_0x38b36d]={'$like':'%'+_0x490652[_0x6fd6('0x33')][_0x6fd6('0x3b')]+'%'};return _0x4149cf;})});}_0x4cc86e=_[_0x6fd6('0x45')]({},_0x4cc86e,_0x490652['options']);var _0x914ecd={'where':_0x4cc86e[_0x6fd6('0x39')]};return db[_0x6fd6('0x2c')][_0x6fd6('0x21')](_0x914ecd)['then'](function(_0x3d6459){_0x17ee96[_0x6fd6('0x21')]=_0x3d6459;if(_0x490652[_0x6fd6('0x33')][_0x6fd6('0x3d')]){_0x4cc86e['include']=[{'all':!![]}];}return db[_0x6fd6('0x2c')][_0x6fd6('0x3f')](_0x4cc86e);})[_0x6fd6('0x26')](function(_0x353b28){_0x17ee96[_0x6fd6('0x40')]=_0x353b28;return _0x17ee96;})[_0x6fd6('0x26')](respondWithFilteredResult(_0x3b4459,_0x4cc86e,'getVoiceQueuesReport'))[_0x6fd6('0x41')](handleError(_0x3b4459,null,_0x6fd6('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index dcc2f85..e74a9b8 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 _0x8152=['events','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x7f99d5,_0x5df01b){var _0x169d49=function(_0x14ec9f){while(--_0x14ec9f){_0x7f99d5['push'](_0x7f99d5['shift']());}};_0x169d49(++_0x5df01b);}(_0x8152,0x1b0));var _0x2815=function(_0x2cdf30,_0x4b8095){_0x2cdf30=_0x2cdf30-0x0;var _0x305edc=_0x8152[_0x2cdf30];return _0x305edc;};'use strict';var EventEmitter=require(_0x2815('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x2815('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2815('0x2')](0x0);var events={'afterCreate':_0x2815('0x3'),'afterUpdate':_0x2815('0x4'),'afterDestroy':'remove'};function emitEvent(_0x398a67){return function(_0x341c6d,_0x1a5835,_0x4fa963){VoiceQueueReportEvents[_0x2815('0x5')](_0x398a67+':'+_0x341c6d['id'],_0x341c6d);VoiceQueueReportEvents[_0x2815('0x5')](_0x398a67,_0x341c6d);_0x4fa963(null);};}for(var e in events){if(events[_0x2815('0x6')](e)){var event=events[e];VoiceQueueReport[_0x2815('0x7')](e,emitEvent(event));}}module[_0x2815('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x475d=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x328c5d,_0x469708){var _0x2d17e9=function(_0x5221c9){while(--_0x5221c9){_0x328c5d['push'](_0x328c5d['shift']());}};_0x2d17e9(++_0x469708);}(_0x475d,0x103));var _0xd475=function(_0x318f46,_0x3ed5a9){_0x318f46=_0x318f46-0x0;var _0x125f88=_0x475d[_0x318f46];return _0x125f88;};'use strict';var EventEmitter=require(_0xd475('0x0'));var VoiceQueueReport=require(_0xd475('0x1'))['db'][_0xd475('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd475('0x3')](0x0);var events={'afterCreate':_0xd475('0x4'),'afterUpdate':_0xd475('0x5'),'afterDestroy':_0xd475('0x6')};function emitEvent(_0x16cc05){return function(_0x3f7250,_0x29fce7,_0x45cf61){VoiceQueueReportEvents[_0xd475('0x7')](_0x16cc05+':'+_0x3f7250['id'],_0x3f7250);VoiceQueueReportEvents['emit'](_0x16cc05,_0x3f7250);_0x45cf61(null);};}for(var e in events){if(events[_0xd475('0x8')](e)){var event=events[e];VoiceQueueReport[_0xd475('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 262287b..685df5d 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 _0x5848=['../../config/logger','api','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','calleridnum','lodash','util'];(function(_0x3b6e7b,_0x123301){var _0x3e6c79=function(_0x2174a1){while(--_0x2174a1){_0x3b6e7b['push'](_0x3b6e7b['shift']());}};_0x3e6c79(++_0x123301);}(_0x5848,0xcf));var _0x8584=function(_0x5d4e9c,_0x438e03){_0x5d4e9c=_0x5d4e9c-0x0;var _0x44d214=_0x5848[_0x5d4e9c];return _0x44d214;};'use strict';var _=require(_0x8584('0x0'));var util=require(_0x8584('0x1'));var logger=require(_0x8584('0x2'))(_0x8584('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8584('0x4'));var rimraf=require(_0x8584('0x5'));var config=require(_0x8584('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x8584('0x7')]=function(_0x303c9a,_0xb8f183){return _0x303c9a['define'](_0x8584('0x8'),attributes,{'tableName':_0x8584('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x8584('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8820=['calleridnum','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid'];(function(_0x356e0f,_0x323e6d){var _0x5222a8=function(_0x3243a9){while(--_0x3243a9){_0x356e0f['push'](_0x356e0f['shift']());}};_0x5222a8(++_0x323e6d);}(_0x8820,0xc4));var _0x0882=function(_0x222d60,_0x3e1ffb){_0x222d60=_0x222d60-0x0;var _0x3d44ea=_0x8820[_0x222d60];return _0x3d44ea;};'use strict';var _=require(_0x0882('0x0'));var util=require('util');var logger=require(_0x0882('0x1'))(_0x0882('0x2'));var moment=require(_0x0882('0x3'));var BPromise=require(_0x0882('0x4'));var rp=require(_0x0882('0x5'));var fs=require('fs');var path=require(_0x0882('0x6'));var rimraf=require(_0x0882('0x7'));var config=require(_0x0882('0x8'));var attributes=require(_0x0882('0x9'));module[_0x0882('0xa')]=function(_0x6c9f89,_0x13a6a2){return _0x6c9f89[_0x0882('0xb')](_0x0882('0xc'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x0882('0xd')]},{'fields':[_0x0882('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 7dbc042..2db05d6 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 _0x55d7=['VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','raw','options','where','limit','include','map','model','attributes','then','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voiceQueueReport.socket','info'];(function(_0x3831db,_0x226906){var _0x59c2ce=function(_0x53cdee){while(--_0x53cdee){_0x3831db['push'](_0x3831db['shift']());}};_0x59c2ce(++_0x226906);}(_0x55d7,0x152));var _0x755d=function(_0x4949ba,_0x5a9616){_0x4949ba=_0x4949ba-0x0;var _0x543b99=_0x55d7[_0x4949ba];return _0x543b99;};'use strict';var _=require(_0x755d('0x0'));var util=require('util');var moment=require(_0x755d('0x1'));var BPromise=require('bluebird');var rs=require(_0x755d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x755d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x755d('0x4'));var config=require(_0x755d('0x5'));var jayson=require(_0x755d('0x6'));var client=jayson['client'][_0x755d('0x7')]({'port':0x232a});config[_0x755d('0x8')]=_[_0x755d('0x9')](config[_0x755d('0x8')],{'host':_0x755d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x755d('0x8')]));require(_0x755d('0xb'))['register'](socket);function respondWithRpcPromise(_0x5d7ac2,_0x4d488b,_0x17b1c0){return new BPromise(function(_0xf84db8,_0xf2a002){return client['request'](_0x5d7ac2,_0x17b1c0)['then'](function(_0x1c3a8b){logger[_0x755d('0xc')](_0x755d('0xd'),_0x4d488b,_0x755d('0xe'));logger[_0x755d('0xf')](_0x755d('0x10'),_0x4d488b,_0x755d('0xe'),JSON['stringify'](_0x1c3a8b));if(_0x1c3a8b['error']){if(_0x1c3a8b[_0x755d('0x11')][_0x755d('0x12')]===0x1f4){logger[_0x755d('0x11')](_0x755d('0xd'),_0x4d488b,_0x1c3a8b[_0x755d('0x11')][_0x755d('0x13')]);return _0xf2a002(_0x1c3a8b[_0x755d('0x11')][_0x755d('0x13')]);}logger[_0x755d('0x11')](_0x755d('0xd'),_0x4d488b,_0x1c3a8b[_0x755d('0x11')][_0x755d('0x13')]);return _0xf84db8(_0x1c3a8b[_0x755d('0x11')][_0x755d('0x13')]);}else{logger[_0x755d('0xc')](_0x755d('0xd'),_0x4d488b,'request\x20sent');_0xf84db8(_0x1c3a8b[_0x755d('0x14')]['message']);}})[_0x755d('0x15')](function(_0x3cee83){logger[_0x755d('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x4d488b,_0x3cee83);_0xf2a002(_0x3cee83);});});}exports[_0x755d('0x16')]=function(_0x588db5){var _0x539acf=this;return new Promise(function(_0x345cd9,_0x58cc0b){return db[_0x755d('0x17')][_0x755d('0x18')]({'raw':_0x588db5['options']?_0x588db5['options'][_0x755d('0x19')]===undefined?!![]:![]:!![],'where':_0x588db5[_0x755d('0x1a')]?_0x588db5[_0x755d('0x1a')][_0x755d('0x1b')]||null:null,'attributes':_0x588db5[_0x755d('0x1a')]?_0x588db5[_0x755d('0x1a')]['attributes']||null:null,'limit':_0x588db5[_0x755d('0x1a')]?_0x588db5['options'][_0x755d('0x1c')]||null:null,'include':_0x588db5[_0x755d('0x1a')]?_0x588db5[_0x755d('0x1a')][_0x755d('0x1d')]?_[_0x755d('0x1e')](_0x588db5[_0x755d('0x1a')][_0x755d('0x1d')],function(_0x2c057d){return{'model':db[_0x2c057d[_0x755d('0x1f')]],'as':_0x2c057d['as'],'attributes':_0x2c057d['attributes'],'include':_0x2c057d['include']?_['map'](_0x2c057d[_0x755d('0x1d')],function(_0x2c325b){return{'model':db[_0x2c325b[_0x755d('0x1f')]],'as':_0x2c325b['as'],'attributes':_0x2c325b['attributes'],'include':_0x2c325b['include']?_[_0x755d('0x1e')](_0x2c325b[_0x755d('0x1d')],function(_0x5b0952){return{'model':db[_0x5b0952[_0x755d('0x1f')]],'as':_0x5b0952['as'],'attributes':_0x5b0952[_0x755d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x755d('0x21')](function(_0x1bb519){logger[_0x755d('0xc')](_0x755d('0x16'),_0x588db5);logger[_0x755d('0xf')](_0x755d('0x16'),_0x588db5,JSON['stringify'](_0x1bb519));_0x345cd9(_0x1bb519);})[_0x755d('0x15')](function(_0x46c2ba){logger['error'](_0x755d('0x16'),_0x46c2ba[_0x755d('0x13')],_0x588db5);_0x58cc0b(_0x539acf[_0x755d('0x11')](0x1f4,_0x46c2ba[_0x755d('0x13')]));});});};exports[_0x755d('0x22')]=function(_0x37fe7e){var _0x4446e0=this;return new Promise(function(_0x1dce7a,_0x1c2287){return db[_0x755d('0x17')][_0x755d('0x23')](_0x37fe7e[_0x755d('0x24')],{'raw':_0x37fe7e[_0x755d('0x1a')]?_0x37fe7e[_0x755d('0x1a')][_0x755d('0x19')]===undefined?!![]:![]:!![]})[_0x755d('0x21')](function(_0x497138){logger['info']('CreateVoiceQueueReport',_0x37fe7e);logger[_0x755d('0xf')](_0x755d('0x22'),_0x37fe7e,JSON[_0x755d('0x25')](_0x497138));_0x1dce7a(_0x497138);})[_0x755d('0x15')](function(_0x1d328d){logger[_0x755d('0x11')](_0x755d('0x22'),_0x1d328d['message'],_0x37fe7e);_0x1c2287(_0x4446e0[_0x755d('0x11')](0x1f4,_0x1d328d[_0x755d('0x13')]));});});};exports['UpdateVoiceQueueReport']=function(_0x41da5e){var _0x4c2f6a=this;return new Promise(function(_0x288943,_0x89f1c7){return db['VoiceQueueReport']['update'](_0x41da5e['body'],{'raw':_0x41da5e[_0x755d('0x1a')]?_0x41da5e[_0x755d('0x1a')][_0x755d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41da5e['options']?_0x41da5e[_0x755d('0x1a')][_0x755d('0x1b')]||null:null,'attributes':_0x41da5e[_0x755d('0x1a')]?_0x41da5e[_0x755d('0x1a')][_0x755d('0x20')]||null:null,'limit':_0x41da5e[_0x755d('0x1a')]?_0x41da5e[_0x755d('0x1a')][_0x755d('0x1c')]||null:null})[_0x755d('0x21')](function(_0x1822a8){logger[_0x755d('0xc')](_0x755d('0x26'),_0x41da5e);logger[_0x755d('0xf')]('UpdateVoiceQueueReport',_0x41da5e,JSON['stringify'](_0x1822a8));_0x288943(_0x1822a8);})['catch'](function(_0x251387){logger[_0x755d('0x11')](_0x755d('0x26'),_0x251387[_0x755d('0x13')],_0x41da5e);_0x89f1c7(_0x4c2f6a[_0x755d('0x11')](0x1f4,_0x251387[_0x755d('0x13')]));});});}; \ No newline at end of file +var _0xab07=['../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','findAll','options','limit','include','map','model','attributes','catch','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','where','util','bluebird','ioredis','../../mysqldb'];(function(_0x294b6,_0x2907ae){var _0x38bb97=function(_0x5aaa76){while(--_0x5aaa76){_0x294b6['push'](_0x294b6['shift']());}};_0x38bb97(++_0x2907ae);}(_0xab07,0x7a));var _0x7ab0=function(_0x298064,_0x1d2bfb){_0x298064=_0x298064-0x0;var _0x2512ea=_0xab07[_0x298064];return _0x2512ea;};'use strict';var _=require('lodash');var util=require(_0x7ab0('0x0'));var moment=require('moment');var BPromise=require(_0x7ab0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ab0('0x2'));var db=require(_0x7ab0('0x3'))['db'];var utils=require(_0x7ab0('0x4'));var logger=require(_0x7ab0('0x5'))(_0x7ab0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ab0('0x7')][_0x7ab0('0x8')]({'port':0x232a});config['redis']=_[_0x7ab0('0x9')](config[_0x7ab0('0xa')],{'host':_0x7ab0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ab0('0xa')]));require(_0x7ab0('0xc'))[_0x7ab0('0xd')](socket);function respondWithRpcPromise(_0x5c73b8,_0x539e31,_0x41a580){return new BPromise(function(_0x47b547,_0x96b64){return client[_0x7ab0('0xe')](_0x5c73b8,_0x41a580)[_0x7ab0('0xf')](function(_0x32a581){logger[_0x7ab0('0x10')](_0x7ab0('0x11'),_0x539e31,_0x7ab0('0x12'));logger[_0x7ab0('0x13')](_0x7ab0('0x14'),_0x539e31,_0x7ab0('0x12'),JSON[_0x7ab0('0x15')](_0x32a581));if(_0x32a581['error']){if(_0x32a581[_0x7ab0('0x16')][_0x7ab0('0x17')]===0x1f4){logger['error'](_0x7ab0('0x11'),_0x539e31,_0x32a581[_0x7ab0('0x16')][_0x7ab0('0x18')]);return _0x96b64(_0x32a581[_0x7ab0('0x16')][_0x7ab0('0x18')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x539e31,_0x32a581[_0x7ab0('0x16')][_0x7ab0('0x18')]);return _0x47b547(_0x32a581[_0x7ab0('0x16')][_0x7ab0('0x18')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x539e31,_0x7ab0('0x12'));_0x47b547(_0x32a581[_0x7ab0('0x19')][_0x7ab0('0x18')]);}})['catch'](function(_0x57cd96){logger[_0x7ab0('0x16')](_0x7ab0('0x11'),_0x539e31,_0x57cd96);_0x96b64(_0x57cd96);});});}exports[_0x7ab0('0x1a')]=function(_0x562dc1){var _0x47db6d=this;return new Promise(function(_0x96e676,_0x562c3c){return db['VoiceQueueReport'][_0x7ab0('0x1b')]({'raw':_0x562dc1[_0x7ab0('0x1c')]?_0x562dc1[_0x7ab0('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x562dc1[_0x7ab0('0x1c')]?_0x562dc1[_0x7ab0('0x1c')]['where']||null:null,'attributes':_0x562dc1[_0x7ab0('0x1c')]?_0x562dc1['options']['attributes']||null:null,'limit':_0x562dc1['options']?_0x562dc1[_0x7ab0('0x1c')][_0x7ab0('0x1d')]||null:null,'include':_0x562dc1['options']?_0x562dc1['options'][_0x7ab0('0x1e')]?_[_0x7ab0('0x1f')](_0x562dc1[_0x7ab0('0x1c')][_0x7ab0('0x1e')],function(_0x33abc8){return{'model':db[_0x33abc8[_0x7ab0('0x20')]],'as':_0x33abc8['as'],'attributes':_0x33abc8[_0x7ab0('0x21')],'include':_0x33abc8['include']?_[_0x7ab0('0x1f')](_0x33abc8[_0x7ab0('0x1e')],function(_0x1872cc){return{'model':db[_0x1872cc[_0x7ab0('0x20')]],'as':_0x1872cc['as'],'attributes':_0x1872cc['attributes'],'include':_0x1872cc[_0x7ab0('0x1e')]?_[_0x7ab0('0x1f')](_0x1872cc[_0x7ab0('0x1e')],function(_0x264864){return{'model':db[_0x264864[_0x7ab0('0x20')]],'as':_0x264864['as'],'attributes':_0x264864[_0x7ab0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7ab0('0xf')](function(_0x26cf92){logger['info'](_0x7ab0('0x1a'),_0x562dc1);logger[_0x7ab0('0x13')](_0x7ab0('0x1a'),_0x562dc1,JSON[_0x7ab0('0x15')](_0x26cf92));_0x96e676(_0x26cf92);})[_0x7ab0('0x22')](function(_0x41ff8f){logger[_0x7ab0('0x16')]('GetVoiceQueueReport',_0x41ff8f[_0x7ab0('0x18')],_0x562dc1);_0x562c3c(_0x47db6d[_0x7ab0('0x16')](0x1f4,_0x41ff8f['message']));});});};exports[_0x7ab0('0x23')]=function(_0x2e9a1b){var _0xe41586=this;return new Promise(function(_0x2a974a,_0xfe83bc){return db['VoiceQueueReport'][_0x7ab0('0x24')](_0x2e9a1b[_0x7ab0('0x25')],{'raw':_0x2e9a1b['options']?_0x2e9a1b[_0x7ab0('0x1c')][_0x7ab0('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0x206255){logger[_0x7ab0('0x10')](_0x7ab0('0x23'),_0x2e9a1b);logger[_0x7ab0('0x13')](_0x7ab0('0x23'),_0x2e9a1b,JSON[_0x7ab0('0x15')](_0x206255));_0x2a974a(_0x206255);})[_0x7ab0('0x22')](function(_0x5da478){logger[_0x7ab0('0x16')](_0x7ab0('0x23'),_0x5da478[_0x7ab0('0x18')],_0x2e9a1b);_0xfe83bc(_0xe41586['error'](0x1f4,_0x5da478['message']));});});};exports[_0x7ab0('0x27')]=function(_0x2aecf8){var _0x331f7e=this;return new Promise(function(_0x37e613,_0x545dcd){return db['VoiceQueueReport'][_0x7ab0('0x28')](_0x2aecf8['body'],{'raw':_0x2aecf8[_0x7ab0('0x1c')]?_0x2aecf8[_0x7ab0('0x1c')][_0x7ab0('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aecf8[_0x7ab0('0x1c')]?_0x2aecf8[_0x7ab0('0x1c')][_0x7ab0('0x29')]||null:null,'attributes':_0x2aecf8['options']?_0x2aecf8[_0x7ab0('0x1c')][_0x7ab0('0x21')]||null:null,'limit':_0x2aecf8['options']?_0x2aecf8[_0x7ab0('0x1c')]['limit']||null:null})[_0x7ab0('0xf')](function(_0x389713){logger[_0x7ab0('0x10')](_0x7ab0('0x27'),_0x2aecf8);logger[_0x7ab0('0x13')](_0x7ab0('0x27'),_0x2aecf8,JSON[_0x7ab0('0x15')](_0x389713));_0x37e613(_0x389713);})[_0x7ab0('0x22')](function(_0x514631){logger[_0x7ab0('0x16')]('UpdateVoiceQueueReport',_0x514631[_0x7ab0('0x18')],_0x2aecf8);_0x545dcd(_0x331f7e[_0x7ab0('0x16')](0x1f4,_0x514631[_0x7ab0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 2cb9774..dcced7f 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 _0x02a7=['length','voiceQueueReport:','save','emit','removeListener'];(function(_0x481bc6,_0x469246){var _0x23ee42=function(_0x259180){while(--_0x259180){_0x481bc6['push'](_0x481bc6['shift']());}};_0x23ee42(++_0x469246);}(_0x02a7,0x7a));var _0x702a=function(_0x491456,_0x168d63){_0x491456=_0x491456-0x0;var _0x5242be=_0x02a7[_0x491456];return _0x5242be;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x702a('0x0'),'remove','update'];function createListener(_0x30b64d,_0x30573e){return function(_0x325874){_0x30573e[_0x702a('0x1')](_0x30b64d,_0x325874);};}function removeListener(_0x4612ca,_0x1fc26b){return function(){VoiceQueueReportEvents[_0x702a('0x2')](_0x4612ca,_0x1fc26b);};}exports['register']=function(_0x1bcfe5){for(var _0x5b7d8c=0x0,_0x26b25e=events[_0x702a('0x3')];_0x5b7d8c<_0x26b25e;_0x5b7d8c++){var _0x3f2954=events[_0x5b7d8c];var _0x161dee=createListener(_0x702a('0x4')+_0x3f2954,_0x1bcfe5);VoiceQueueReportEvents['on'](_0x3f2954,_0x161dee);}}; \ No newline at end of file +var _0x4b68=['emit','register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x54ec7c,_0x328bf1){var _0x59b596=function(_0x545338){while(--_0x545338){_0x54ec7c['push'](_0x54ec7c['shift']());}};_0x59b596(++_0x328bf1);}(_0x4b68,0x129));var _0x84b6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4b68[_0x40a045];return _0x1a687c;};'use strict';var VoiceQueueReportEvents=require(_0x84b6('0x0'));var events=[_0x84b6('0x1'),_0x84b6('0x2'),_0x84b6('0x3')];function createListener(_0x345832,_0x4e277e){return function(_0x22304e){_0x4e277e[_0x84b6('0x4')](_0x345832,_0x22304e);};}function removeListener(_0x431bcf,_0x365748){return function(){VoiceQueueReportEvents['removeListener'](_0x431bcf,_0x365748);};}exports[_0x84b6('0x5')]=function(_0x2a0007){for(var _0x539956=0x0,_0x3892fd=events['length'];_0x539956<_0x3892fd;_0x539956++){var _0x20ba3a=events[_0x539956];var _0x3ff6e1=createListener(_0x84b6('0x6')+_0x20ba3a,_0x2a0007);VoiceQueueReportEvents['on'](_0x20ba3a,_0x3ff6e1);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 39c8bb3..778a23f 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 _0x1841=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x5da63e,_0x4d3503){var _0x442aca=function(_0x6d5bca){while(--_0x6d5bca){_0x5da63e['push'](_0x5da63e['shift']());}};_0x442aca(++_0x4d3503);}(_0x1841,0xdf));var _0x1184=function(_0x44ccf0,_0x446087){_0x44ccf0=_0x44ccf0-0x0;var _0x101f26=_0x1841[_0x44ccf0];return _0x101f26;};'use strict';var multer=require('multer');var util=require(_0x1184('0x0'));var path=require(_0x1184('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1184('0x2')]();var fs_extra=require(_0x1184('0x3'));var auth=require(_0x1184('0x4'));var interaction=require(_0x1184('0x5'));var config=require(_0x1184('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x1184('0x7')]('/',auth[_0x1184('0x8')](),controller[_0x1184('0x9')]);router[_0x1184('0x7')](_0x1184('0xa'),auth[_0x1184('0x8')](),controller[_0x1184('0xb')]);router[_0x1184('0xc')]('/',auth[_0x1184('0x8')](),controller[_0x1184('0xd')]);router[_0x1184('0xe')](_0x1184('0xa'),auth[_0x1184('0x8')](),controller[_0x1184('0xf')]);router[_0x1184('0x10')](_0x1184('0xa'),auth[_0x1184('0x8')](),controller[_0x1184('0x11')]);module[_0x1184('0x12')]=router; \ No newline at end of file +var _0x7c68=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x7c68,0x12a));var _0x87c6=function(_0x11bb5e,_0xc5cbe9){_0x11bb5e=_0x11bb5e-0x0;var _0x229cca=_0x7c68[_0x11bb5e];return _0x229cca;};'use strict';var multer=require('multer');var util=require(_0x87c6('0x0'));var path=require(_0x87c6('0x1'));var timeout=require(_0x87c6('0x2'));var express=require(_0x87c6('0x3'));var router=express[_0x87c6('0x4')]();var fs_extra=require(_0x87c6('0x5'));var auth=require(_0x87c6('0x6'));var interaction=require(_0x87c6('0x7'));var config=require(_0x87c6('0x8'));var controller=require(_0x87c6('0x9'));router[_0x87c6('0xa')]('/',auth[_0x87c6('0xb')](),controller[_0x87c6('0xc')]);router['get'](_0x87c6('0xd'),auth[_0x87c6('0xb')](),controller[_0x87c6('0xe')]);router[_0x87c6('0xf')]('/',auth[_0x87c6('0xb')](),controller['create']);router['put'](_0x87c6('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x87c6('0x10')](_0x87c6('0xd'),auth['isAuthenticated'](),controller[_0x87c6('0x11')]);module[_0x87c6('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 5979c39..3ed9f95 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 _0xaf44=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x51c360,_0x1d9d29){var _0x33dc40=function(_0x2ee072){while(--_0x2ee072){_0x51c360['push'](_0x51c360['shift']());}};_0x33dc40(++_0x1d9d29);}(_0xaf44,0xf4));var _0x4af4=function(_0x5e909d,_0x274e0d){_0x5e909d=_0x5e909d-0x0;var _0x24d4b5=_0xaf44[_0x5e909d];return _0x24d4b5;};'use strict';var Sequelize=require(_0x4af4('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x4af4('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4af4('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4af4('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4af4('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4af4('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4af4('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4af4('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4af4('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x4af4('0x3')](_0x4af4('0x4'))}}; \ No newline at end of file +var _0x801d=['exports','STRING','DATE','literal','sequelize','moment'];(function(_0x142838,_0x4261cd){var _0x5a3804=function(_0x336c8e){while(--_0x336c8e){_0x142838['push'](_0x142838['shift']());}};_0x5a3804(++_0x4261cd);}(_0x801d,0x1d2));var _0xd801=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x801d[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0xd801('0x0'));var moment=require(_0xd801('0x1'));module[_0xd801('0x2')]={'time':{'type':Sequelize[_0xd801('0x3')]},'callid':{'type':Sequelize[_0xd801('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd801('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd801('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd801('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd801('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd801('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd801('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd801('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd801('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd801('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xd801('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d5e8df4..7ade3f2 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 _0x2876=['request-promise','moment','bluebird','mustache','util','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','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','then','destroy','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','findAll','rows','catch','show','params','includeAll','body','update','find','zip-dir'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2876,0x162));var _0x6287=function(_0x22dd2b,_0x3b116a){_0x22dd2b=_0x22dd2b-0x0;var _0x2c816c=_0x2876[_0x22dd2b];return _0x2c816c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6287('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6287('0x1'));var moment=require(_0x6287('0x2'));var BPromise=require(_0x6287('0x3'));var Mustache=require(_0x6287('0x4'));var util=require(_0x6287('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6287('0x6'));var ejs=require(_0x6287('0x7'));var fs=require('fs');var fs_extra=require(_0x6287('0x8'));var _=require(_0x6287('0x9'));var squel=require(_0x6287('0xa'));var crypto=require(_0x6287('0xb'));var jsforce=require(_0x6287('0xc'));var deskjs=require(_0x6287('0xd'));var toCsv=require(_0x6287('0x6'));var querystring=require(_0x6287('0xe'));var Papa=require(_0x6287('0xf'));var Redis=require('ioredis');var authService=require(_0x6287('0x10'));var qs=require(_0x6287('0x11'));var as=require(_0x6287('0x12'));var hardwareService=require(_0x6287('0x13'));var logger=require('../../config/logger')(_0x6287('0x14'));var utils=require(_0x6287('0x15'));var config=require(_0x6287('0x16'));var licenseUtil=require(_0x6287('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12b459,_0x56b001){_0x56b001=_0x56b001||0xcc;return function(_0x1f1c60){if(_0x1f1c60){return _0x12b459[_0x6287('0x18')](_0x56b001);}return _0x12b459[_0x6287('0x19')](_0x56b001)[_0x6287('0x1a')]();};}function respondWithResult(_0x564a47,_0x3a653f){_0x3a653f=_0x3a653f||0xc8;return function(_0x4b6f2d){if(_0x4b6f2d){return _0x564a47[_0x6287('0x19')](_0x3a653f)['json'](_0x4b6f2d);}};}function respondWithFilteredResult(_0x4539f6,_0x20f48e){return function(_0x258eee){if(_0x258eee){var _0x3bc0fc=typeof _0x20f48e[_0x6287('0x1b')]===_0x6287('0x1c')&&typeof _0x20f48e[_0x6287('0x1d')]===_0x6287('0x1c');var _0x49a36a=_0x258eee[_0x6287('0x1e')];var _0x516d97=_0x3bc0fc?0x0:_0x20f48e['offset'];var _0x7ae99f=_0x3bc0fc?_0x258eee[_0x6287('0x1e')]:_0x20f48e[_0x6287('0x1b')]+_0x20f48e['limit'];var _0x15995e;if(_0x7ae99f>=_0x49a36a){_0x7ae99f=_0x49a36a;_0x15995e=0xc8;}else{_0x15995e=0xce;}_0x4539f6['status'](_0x15995e);return _0x4539f6[_0x6287('0x1f')]('Content-Range',_0x516d97+'-'+_0x7ae99f+'/'+_0x49a36a)[_0x6287('0x20')](_0x258eee);}return null;};}function patchUpdates(_0x1d33b0){return function(_0x44f4db){try{jsonpatch['apply'](_0x44f4db,_0x1d33b0,!![]);}catch(_0x1df75c){return BPromise[_0x6287('0x21')](_0x1df75c);}return _0x44f4db[_0x6287('0x22')]();};}function saveUpdates(_0x107365,_0x561e37){return function(_0x37f1b6){if(_0x37f1b6){return _0x37f1b6['update'](_0x107365)[_0x6287('0x23')](function(_0x5e547e){return _0x5e547e;});}return null;};}function removeEntity(_0x427599,_0x506f12){return function(_0x489059){if(_0x489059){return _0x489059[_0x6287('0x24')]()[_0x6287('0x23')](function(){_0x427599[_0x6287('0x19')](0xcc)[_0x6287('0x1a')]();});}};}function handleEntityNotFound(_0x152189,_0x39175b){return function(_0x51a1f7){if(!_0x51a1f7){_0x152189[_0x6287('0x18')](0x194);}return _0x51a1f7;};}function handleError(_0x17aa0b,_0x5130e0){_0x5130e0=_0x5130e0||0x1f4;return function(_0x1eaa2e){logger[_0x6287('0x25')](_0x1eaa2e['stack']);if(_0x1eaa2e[_0x6287('0x26')]){delete _0x1eaa2e[_0x6287('0x26')];}_0x17aa0b[_0x6287('0x19')](_0x5130e0)[_0x6287('0x27')](_0x1eaa2e);};}exports[_0x6287('0x28')]=function(_0x2559a0,_0x39c664){var _0x23f66b={},_0x35c0be={},_0x52cc79={'count':0x0,'rows':[]};var _0x5a92ec=_[_0x6287('0x29')](db[_0x6287('0x2a')][_0x6287('0x2b')],function(_0x477452){return{'name':_0x477452[_0x6287('0x2c')],'type':_0x477452[_0x6287('0x2d')][_0x6287('0x2e')]};});_0x35c0be[_0x6287('0x2f')]=_[_0x6287('0x29')](_0x5a92ec,_0x6287('0x26'));_0x35c0be['query']=_[_0x6287('0x30')](_0x2559a0['query']);_0x35c0be[_0x6287('0x31')]=_[_0x6287('0x32')](_0x35c0be[_0x6287('0x2f')],_0x35c0be['query']);_0x23f66b['attributes']=_[_0x6287('0x32')](_0x35c0be['model'],qs[_0x6287('0x33')](_0x2559a0[_0x6287('0x34')][_0x6287('0x33')]));_0x23f66b['attributes']=_0x23f66b[_0x6287('0x35')][_0x6287('0x36')]?_0x23f66b[_0x6287('0x35')]:_0x35c0be[_0x6287('0x2f')];if(!_0x2559a0['query'][_0x6287('0x37')](_0x6287('0x38'))){_0x23f66b[_0x6287('0x1d')]=qs[_0x6287('0x1d')](_0x2559a0[_0x6287('0x34')]['limit']);_0x23f66b['offset']=qs['offset'](_0x2559a0['query'][_0x6287('0x1b')]);}_0x23f66b[_0x6287('0x39')]=qs['sort'](_0x2559a0[_0x6287('0x34')]['sort']);_0x23f66b[_0x6287('0x3a')]=qs[_0x6287('0x31')](_[_0x6287('0x3b')](_0x2559a0['query'],_0x35c0be['filters']),_0x5a92ec);if(_0x2559a0['query'][_0x6287('0x3c')]){_0x23f66b[_0x6287('0x3a')]=_[_0x6287('0x3d')](_0x23f66b[_0x6287('0x3a')],{'$or':_['map'](_0x5a92ec,function(_0xc3da0a){if(_0xc3da0a['type']!=='VIRTUAL'){var _0x1fc545={};_0x1fc545[_0xc3da0a[_0x6287('0x26')]]={'$like':'%'+_0x2559a0[_0x6287('0x34')][_0x6287('0x3c')]+'%'};return _0x1fc545;}})});}_0x23f66b=_[_0x6287('0x3d')]({},_0x23f66b,_0x2559a0['options']);var _0x36ee6c={'where':_0x23f66b['where']};return db['VoiceQueuesLog'][_0x6287('0x1e')](_0x36ee6c)[_0x6287('0x23')](function(_0x374486){_0x52cc79[_0x6287('0x1e')]=_0x374486;if(_0x2559a0[_0x6287('0x34')]['includeAll']){_0x23f66b['include']=[{'all':!![]}];}return db[_0x6287('0x2a')][_0x6287('0x3e')](_0x23f66b);})[_0x6287('0x23')](function(_0x52606d){_0x52cc79[_0x6287('0x3f')]=_0x52606d;return _0x52cc79;})['then'](respondWithFilteredResult(_0x39c664,_0x23f66b))[_0x6287('0x40')](handleError(_0x39c664,null));};exports[_0x6287('0x41')]=function(_0x337c55,_0x3ff9c3){var _0x2898ed={'raw':!![],'where':{'id':_0x337c55[_0x6287('0x42')]['id']}},_0x167d53={};_0x167d53['model']=_[_0x6287('0x30')](db[_0x6287('0x2a')][_0x6287('0x2b')]);_0x167d53[_0x6287('0x34')]=_[_0x6287('0x30')](_0x337c55[_0x6287('0x34')]);_0x167d53[_0x6287('0x31')]=_[_0x6287('0x32')](_0x167d53[_0x6287('0x2f')],_0x167d53['query']);_0x2898ed['attributes']=_[_0x6287('0x32')](_0x167d53['model'],qs[_0x6287('0x33')](_0x337c55['query']['fields']));_0x2898ed[_0x6287('0x35')]=_0x2898ed[_0x6287('0x35')][_0x6287('0x36')]?_0x2898ed[_0x6287('0x35')]:_0x167d53[_0x6287('0x2f')];if(_0x337c55[_0x6287('0x34')][_0x6287('0x43')]){_0x2898ed['include']=[{'all':!![]}];}_0x2898ed=_['merge']({},_0x2898ed,_0x337c55['options']);return db[_0x6287('0x2a')]['find'](_0x2898ed)[_0x6287('0x23')](handleEntityNotFound(_0x3ff9c3,null))['then'](respondWithResult(_0x3ff9c3,null))['catch'](handleError(_0x3ff9c3,null));};exports['create']=function(_0xe73a6d,_0x376c85){return db[_0x6287('0x2a')]['create'](_0xe73a6d[_0x6287('0x44')],{})[_0x6287('0x23')](respondWithResult(_0x376c85,0xc9))[_0x6287('0x40')](handleError(_0x376c85,null));};exports[_0x6287('0x45')]=function(_0x312835,_0x45e820){if(_0x312835[_0x6287('0x44')]['id']){delete _0x312835[_0x6287('0x44')]['id'];}return db[_0x6287('0x2a')][_0x6287('0x46')]({'where':{'id':_0x312835['params']['id']}})[_0x6287('0x23')](handleEntityNotFound(_0x45e820,null))[_0x6287('0x23')](saveUpdates(_0x312835[_0x6287('0x44')],null))[_0x6287('0x23')](respondWithResult(_0x45e820,null))[_0x6287('0x40')](handleError(_0x45e820,null));};exports[_0x6287('0x24')]=function(_0x596213,_0x49f0d5){return db[_0x6287('0x2a')][_0x6287('0x46')]({'where':{'id':_0x596213['params']['id']}})[_0x6287('0x23')](handleEntityNotFound(_0x49f0d5,null))[_0x6287('0x23')](removeEntity(_0x49f0d5,null))[_0x6287('0x40')](handleError(_0x49f0d5,null));}; \ No newline at end of file +var _0x49de=['rows','show','fields','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','include','findAll'];(function(_0x50aa41,_0x2f5988){var _0x56d568=function(_0x59a604){while(--_0x59a604){_0x50aa41['push'](_0x50aa41['shift']());}};_0x56d568(++_0x2f5988);}(_0x49de,0xed));var _0xe49d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x49de[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0xe49d('0x0'));var rimraf=require(_0xe49d('0x1'));var zipdir=require(_0xe49d('0x2'));var jsonpatch=require(_0xe49d('0x3'));var rp=require(_0xe49d('0x4'));var moment=require(_0xe49d('0x5'));var BPromise=require(_0xe49d('0x6'));var Mustache=require('mustache');var util=require(_0xe49d('0x7'));var path=require(_0xe49d('0x8'));var sox=require(_0xe49d('0x9'));var csv=require(_0xe49d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe49d('0xb'));var squel=require('squel');var crypto=require(_0xe49d('0xc'));var jsforce=require(_0xe49d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe49d('0xe'));var Papa=require(_0xe49d('0xf'));var Redis=require(_0xe49d('0x10'));var authService=require(_0xe49d('0x11'));var qs=require(_0xe49d('0x12'));var as=require(_0xe49d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe49d('0x14'))(_0xe49d('0x15'));var utils=require(_0xe49d('0x16'));var config=require(_0xe49d('0x17'));var licenseUtil=require(_0xe49d('0x18'));var db=require(_0xe49d('0x19'))['db'];function respondWithStatusCode(_0x5849d2,_0x5230cb){_0x5230cb=_0x5230cb||0xcc;return function(_0x3734d5){if(_0x3734d5){return _0x5849d2[_0xe49d('0x1a')](_0x5230cb);}return _0x5849d2['status'](_0x5230cb)[_0xe49d('0x1b')]();};}function respondWithResult(_0x51c4c1,_0x56a239){_0x56a239=_0x56a239||0xc8;return function(_0x406306){if(_0x406306){return _0x51c4c1['status'](_0x56a239)[_0xe49d('0x1c')](_0x406306);}};}function respondWithFilteredResult(_0x1e4ba2,_0xdc3449){return function(_0x92d14){if(_0x92d14){var _0x20b2fd=typeof _0xdc3449[_0xe49d('0x1d')]===_0xe49d('0x1e')&&typeof _0xdc3449[_0xe49d('0x1f')]===_0xe49d('0x1e');var _0x1e1562=_0x92d14[_0xe49d('0x20')];var _0x9709e5=_0x20b2fd?0x0:_0xdc3449['offset'];var _0x4e3804=_0x20b2fd?_0x92d14[_0xe49d('0x20')]:_0xdc3449['offset']+_0xdc3449['limit'];var _0x2eb9c8;if(_0x4e3804>=_0x1e1562){_0x4e3804=_0x1e1562;_0x2eb9c8=0xc8;}else{_0x2eb9c8=0xce;}_0x1e4ba2[_0xe49d('0x21')](_0x2eb9c8);return _0x1e4ba2['set'](_0xe49d('0x22'),_0x9709e5+'-'+_0x4e3804+'/'+_0x1e1562)[_0xe49d('0x1c')](_0x92d14);}return null;};}function patchUpdates(_0x2c26c0){return function(_0x46bc40){try{jsonpatch[_0xe49d('0x23')](_0x46bc40,_0x2c26c0,!![]);}catch(_0x1957df){return BPromise[_0xe49d('0x24')](_0x1957df);}return _0x46bc40[_0xe49d('0x25')]();};}function saveUpdates(_0x2941d9,_0x284746){return function(_0x161960){if(_0x161960){return _0x161960[_0xe49d('0x26')](_0x2941d9)[_0xe49d('0x27')](function(_0xa0f5ff){return _0xa0f5ff;});}return null;};}function removeEntity(_0x374754,_0x54f46a){return function(_0x39c566){if(_0x39c566){return _0x39c566['destroy']()[_0xe49d('0x27')](function(){_0x374754[_0xe49d('0x21')](0xcc)[_0xe49d('0x1b')]();});}};}function handleEntityNotFound(_0x1ef3a0,_0x154960){return function(_0x19298f){if(!_0x19298f){_0x1ef3a0['sendStatus'](0x194);}return _0x19298f;};}function handleError(_0x550046,_0x4e7c30){_0x4e7c30=_0x4e7c30||0x1f4;return function(_0xcffe8a){logger['error'](_0xcffe8a[_0xe49d('0x28')]);if(_0xcffe8a['name']){delete _0xcffe8a[_0xe49d('0x29')];}_0x550046[_0xe49d('0x21')](_0x4e7c30)[_0xe49d('0x2a')](_0xcffe8a);};}exports[_0xe49d('0x2b')]=function(_0x4628fa,_0x4cf07e){var _0x20ae71={},_0x17fa1d={},_0x1ebb20={'count':0x0,'rows':[]};var _0x14b215=_[_0xe49d('0x2c')](db[_0xe49d('0x2d')][_0xe49d('0x2e')],function(_0x2af9e9){return{'name':_0x2af9e9[_0xe49d('0x2f')],'type':_0x2af9e9[_0xe49d('0x30')][_0xe49d('0x31')]};});_0x17fa1d[_0xe49d('0x32')]=_['map'](_0x14b215,_0xe49d('0x29'));_0x17fa1d[_0xe49d('0x33')]=_[_0xe49d('0x34')](_0x4628fa['query']);_0x17fa1d[_0xe49d('0x35')]=_[_0xe49d('0x36')](_0x17fa1d[_0xe49d('0x32')],_0x17fa1d[_0xe49d('0x33')]);_0x20ae71[_0xe49d('0x37')]=_[_0xe49d('0x36')](_0x17fa1d['model'],qs['fields'](_0x4628fa['query']['fields']));_0x20ae71[_0xe49d('0x37')]=_0x20ae71[_0xe49d('0x37')][_0xe49d('0x38')]?_0x20ae71[_0xe49d('0x37')]:_0x17fa1d['model'];if(!_0x4628fa[_0xe49d('0x33')][_0xe49d('0x39')](_0xe49d('0x3a'))){_0x20ae71[_0xe49d('0x1f')]=qs[_0xe49d('0x1f')](_0x4628fa[_0xe49d('0x33')]['limit']);_0x20ae71[_0xe49d('0x1d')]=qs[_0xe49d('0x1d')](_0x4628fa[_0xe49d('0x33')]['offset']);}_0x20ae71[_0xe49d('0x3b')]=qs['sort'](_0x4628fa[_0xe49d('0x33')]['sort']);_0x20ae71[_0xe49d('0x3c')]=qs['filters'](_[_0xe49d('0x3d')](_0x4628fa[_0xe49d('0x33')],_0x17fa1d[_0xe49d('0x35')]),_0x14b215);if(_0x4628fa[_0xe49d('0x33')]['filter']){_0x20ae71['where']=_['merge'](_0x20ae71[_0xe49d('0x3c')],{'$or':_['map'](_0x14b215,function(_0x2cf22f){if(_0x2cf22f[_0xe49d('0x30')]!=='VIRTUAL'){var _0x4ebd2f={};_0x4ebd2f[_0x2cf22f[_0xe49d('0x29')]]={'$like':'%'+_0x4628fa[_0xe49d('0x33')][_0xe49d('0x3e')]+'%'};return _0x4ebd2f;}})});}_0x20ae71=_[_0xe49d('0x3f')]({},_0x20ae71,_0x4628fa[_0xe49d('0x40')]);var _0x309f8c={'where':_0x20ae71['where']};return db[_0xe49d('0x2d')][_0xe49d('0x20')](_0x309f8c)[_0xe49d('0x27')](function(_0x339883){_0x1ebb20[_0xe49d('0x20')]=_0x339883;if(_0x4628fa['query']['includeAll']){_0x20ae71[_0xe49d('0x41')]=[{'all':!![]}];}return db[_0xe49d('0x2d')][_0xe49d('0x42')](_0x20ae71);})['then'](function(_0x2f6cd9){_0x1ebb20[_0xe49d('0x43')]=_0x2f6cd9;return _0x1ebb20;})['then'](respondWithFilteredResult(_0x4cf07e,_0x20ae71))['catch'](handleError(_0x4cf07e,null));};exports[_0xe49d('0x44')]=function(_0x363b1a,_0x14dc82){var _0xe17f26={'raw':!![],'where':{'id':_0x363b1a['params']['id']}},_0x245b32={};_0x245b32['model']=_[_0xe49d('0x34')](db[_0xe49d('0x2d')][_0xe49d('0x2e')]);_0x245b32['query']=_[_0xe49d('0x34')](_0x363b1a[_0xe49d('0x33')]);_0x245b32[_0xe49d('0x35')]=_[_0xe49d('0x36')](_0x245b32[_0xe49d('0x32')],_0x245b32[_0xe49d('0x33')]);_0xe17f26['attributes']=_['intersection'](_0x245b32[_0xe49d('0x32')],qs[_0xe49d('0x45')](_0x363b1a[_0xe49d('0x33')][_0xe49d('0x45')]));_0xe17f26[_0xe49d('0x37')]=_0xe17f26[_0xe49d('0x37')]['length']?_0xe17f26[_0xe49d('0x37')]:_0x245b32[_0xe49d('0x32')];if(_0x363b1a['query']['includeAll']){_0xe17f26[_0xe49d('0x41')]=[{'all':!![]}];}_0xe17f26=_[_0xe49d('0x3f')]({},_0xe17f26,_0x363b1a[_0xe49d('0x40')]);return db['VoiceQueuesLog'][_0xe49d('0x46')](_0xe17f26)[_0xe49d('0x27')](handleEntityNotFound(_0x14dc82,null))[_0xe49d('0x27')](respondWithResult(_0x14dc82,null))[_0xe49d('0x47')](handleError(_0x14dc82,null));};exports[_0xe49d('0x48')]=function(_0x5115f3,_0x40948){return db[_0xe49d('0x2d')]['create'](_0x5115f3[_0xe49d('0x49')],{})[_0xe49d('0x27')](respondWithResult(_0x40948,0xc9))[_0xe49d('0x47')](handleError(_0x40948,null));};exports[_0xe49d('0x26')]=function(_0x300745,_0x1fcf20){if(_0x300745[_0xe49d('0x49')]['id']){delete _0x300745[_0xe49d('0x49')]['id'];}return db[_0xe49d('0x2d')][_0xe49d('0x46')]({'where':{'id':_0x300745[_0xe49d('0x4a')]['id']}})[_0xe49d('0x27')](handleEntityNotFound(_0x1fcf20,null))[_0xe49d('0x27')](saveUpdates(_0x300745[_0xe49d('0x49')],null))['then'](respondWithResult(_0x1fcf20,null))[_0xe49d('0x47')](handleError(_0x1fcf20,null));};exports[_0xe49d('0x4b')]=function(_0x11bf37,_0x3adc2d){return db['VoiceQueuesLog']['find']({'where':{'id':_0x11bf37[_0xe49d('0x4a')]['id']}})[_0xe49d('0x27')](handleEntityNotFound(_0x3adc2d,null))[_0xe49d('0x27')](removeEntity(_0x3adc2d,null))['catch'](handleError(_0x3adc2d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 134e0b6..8e6dd54 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 _0x6d4f=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','moment'];(function(_0x4a8471,_0x3a4ff2){var _0x4fffe9=function(_0xc2e1fe){while(--_0xc2e1fe){_0x4a8471['push'](_0x4a8471['shift']());}};_0x4fffe9(++_0x3a4ff2);}(_0x6d4f,0xee));var _0xf6d4=function(_0x83420c,_0x50fd91){_0x83420c=_0x83420c-0x0;var _0x1057d7=_0x6d4f[_0x83420c];return _0x1057d7;};'use strict';var _=require(_0xf6d4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf6d4('0x1'));var BPromise=require(_0xf6d4('0x2'));var rp=require(_0xf6d4('0x3'));var fs=require('fs');var path=require(_0xf6d4('0x4'));var rimraf=require(_0xf6d4('0x5'));var config=require(_0xf6d4('0x6'));var attributes=require(_0xf6d4('0x7'));module[_0xf6d4('0x8')]=function(_0xac0926,_0x40088e){return _0xac0926[_0xf6d4('0x9')](_0xf6d4('0xa'),attributes,{'tableName':_0xf6d4('0xb'),'paranoid':![],'indexes':[{'name':_0xf6d4('0xc'),'fields':[_0xf6d4('0xd'),_0xf6d4('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x90a8=['path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1ed1d8,_0x384889){var _0x4f145d=function(_0x1c3380){while(--_0x1c3380){_0x1ed1d8['push'](_0x1ed1d8['shift']());}};_0x4f145d(++_0x384889);}(_0x90a8,0x14a));var _0x890a=function(_0xfba587,_0x380d16){_0xfba587=_0xfba587-0x0;var _0x172936=_0x90a8[_0xfba587];return _0x172936;};'use strict';var _=require(_0x890a('0x0'));var util=require(_0x890a('0x1'));var logger=require('../../config/logger')(_0x890a('0x2'));var moment=require(_0x890a('0x3'));var BPromise=require(_0x890a('0x4'));var rp=require(_0x890a('0x5'));var fs=require('fs');var path=require(_0x890a('0x6'));var rimraf=require(_0x890a('0x7'));var config=require(_0x890a('0x8'));var attributes=require(_0x890a('0x9'));module[_0x890a('0xa')]=function(_0x15a68a,_0xc82179){return _0x15a68a['define'](_0x890a('0xb'),attributes,{'tableName':_0x890a('0xc'),'paranoid':![],'indexes':[{'name':_0x890a('0xd'),'fields':[_0x890a('0xe'),_0x890a('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 1293f15..ec5b708 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 _0x4731=['util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x55b824,_0x3f0624){var _0x100ff7=function(_0x42cdab){while(--_0x42cdab){_0x55b824['push'](_0x55b824['shift']());}};_0x100ff7(++_0x3f0624);}(_0x4731,0xce));var _0x1473=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x4731[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0x1473('0x0'));var util=require(_0x1473('0x1'));var moment=require(_0x1473('0x2'));var BPromise=require(_0x1473('0x3'));var rs=require(_0x1473('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1473('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1473('0x6'));var config=require(_0x1473('0x7'));var jayson=require(_0x1473('0x8'));var client=jayson['client'][_0x1473('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c210a,_0x2b5f36,_0x6f4474){return new BPromise(function(_0x332abb,_0x4c3e0c){return client[_0x1473('0xa')](_0x2c210a,_0x6f4474)[_0x1473('0xb')](function(_0x2328a2){logger[_0x1473('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2b5f36,_0x1473('0xd'));logger[_0x1473('0xe')](_0x1473('0xf'),_0x2b5f36,_0x1473('0xd'),JSON[_0x1473('0x10')](_0x2328a2));if(_0x2328a2[_0x1473('0x11')]){if(_0x2328a2[_0x1473('0x11')][_0x1473('0x12')]===0x1f4){logger['error'](_0x1473('0x13'),_0x2b5f36,_0x2328a2[_0x1473('0x11')][_0x1473('0x14')]);return _0x4c3e0c(_0x2328a2[_0x1473('0x11')][_0x1473('0x14')]);}logger['error'](_0x1473('0x13'),_0x2b5f36,_0x2328a2[_0x1473('0x11')][_0x1473('0x14')]);return _0x332abb(_0x2328a2[_0x1473('0x11')][_0x1473('0x14')]);}else{logger['info'](_0x1473('0x13'),_0x2b5f36,'request\x20sent');_0x332abb(_0x2328a2[_0x1473('0x15')][_0x1473('0x14')]);}})[_0x1473('0x16')](function(_0x383006){logger[_0x1473('0x11')](_0x1473('0x13'),_0x2b5f36,_0x383006);_0x4c3e0c(_0x383006);});});} \ No newline at end of file +var _0x142b=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x2ed4ec,_0x3e598d){var _0x7bc26f=function(_0x34744a){while(--_0x34744a){_0x2ed4ec['push'](_0x2ed4ec['shift']());}};_0x7bc26f(++_0x3e598d);}(_0x142b,0x10e));var _0xb142=function(_0x42d545,_0x55019f){_0x42d545=_0x42d545-0x0;var _0x3ec84c=_0x142b[_0x42d545];return _0x3ec84c;};'use strict';var _=require(_0xb142('0x0'));var util=require(_0xb142('0x1'));var moment=require(_0xb142('0x2'));var BPromise=require(_0xb142('0x3'));var rs=require(_0xb142('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb142('0x5'))['db'];var utils=require(_0xb142('0x6'));var logger=require(_0xb142('0x7'))(_0xb142('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0101,_0x4d21ea,_0x341c57){return new BPromise(function(_0x2f6992,_0x4db0dd){return client[_0xb142('0x9')](_0x4e0101,_0x341c57)['then'](function(_0x5b6b4a){logger[_0xb142('0xa')](_0xb142('0xb'),_0x4d21ea,_0xb142('0xc'));logger['debug'](_0xb142('0xd'),_0x4d21ea,_0xb142('0xc'),JSON[_0xb142('0xe')](_0x5b6b4a));if(_0x5b6b4a['error']){if(_0x5b6b4a[_0xb142('0xf')]['code']===0x1f4){logger[_0xb142('0xf')](_0xb142('0xb'),_0x4d21ea,_0x5b6b4a[_0xb142('0xf')][_0xb142('0x10')]);return _0x4db0dd(_0x5b6b4a[_0xb142('0xf')][_0xb142('0x10')]);}logger[_0xb142('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4d21ea,_0x5b6b4a[_0xb142('0xf')][_0xb142('0x10')]);return _0x2f6992(_0x5b6b4a[_0xb142('0xf')]['message']);}else{logger['info'](_0xb142('0xb'),_0x4d21ea,'request\x20sent');_0x2f6992(_0x5b6b4a['result'][_0xb142('0x10')]);}})[_0xb142('0x11')](function(_0x406cec){logger[_0xb142('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4d21ea,_0x406cec);_0x4db0dd(_0x406cec);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c10ac71..67d4c54 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 _0xc4ff=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','isAuthenticated','index','/describe','describe','get','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','/:id','update','destroy','exports','multer','util','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc4ff,0x115));var _0xfc4f=function(_0x4e1216,_0x591de2){_0x4e1216=_0x4e1216-0x0;var _0x423cd8=_0xc4ff[_0x4e1216];return _0x423cd8;};'use strict';var multer=require(_0xfc4f('0x0'));var util=require(_0xfc4f('0x1'));var path=require(_0xfc4f('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc4f('0x3'));var router=express[_0xfc4f('0x4')]();var fs_extra=require(_0xfc4f('0x5'));var auth=require(_0xfc4f('0x6'));var interaction=require(_0xfc4f('0x7'));var config=require('../../config/environment');var controller=require(_0xfc4f('0x8'));router['get']('/',auth[_0xfc4f('0x9')](),controller[_0xfc4f('0xa')]);router['get'](_0xfc4f('0xb'),auth['isAuthenticated'](),controller[_0xfc4f('0xc')]);router[_0xfc4f('0xd')]('/:id',auth[_0xfc4f('0x9')](),controller[_0xfc4f('0xe')]);router[_0xfc4f('0xd')](_0xfc4f('0xf'),auth[_0xfc4f('0x9')](),controller[_0xfc4f('0x10')]);router['get'](_0xfc4f('0x11'),controller[_0xfc4f('0x12')]);router[_0xfc4f('0xd')](_0xfc4f('0x13'),auth[_0xfc4f('0x9')](),controller[_0xfc4f('0x14')]);router[_0xfc4f('0x15')]('/',auth['isAuthenticated'](),controller[_0xfc4f('0x16')]);router[_0xfc4f('0x15')](_0xfc4f('0x13'),auth[_0xfc4f('0x9')](),controller[_0xfc4f('0x17')]);router['put'](_0xfc4f('0x18'),auth[_0xfc4f('0x9')](),controller[_0xfc4f('0x19')]);router['delete']('/:id',auth[_0xfc4f('0x9')](),controller[_0xfc4f('0x1a')]);module[_0xfc4f('0x1b')]=router; \ No newline at end of file +var _0xa449=['/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceRecording.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x457a89,_0x1a1130){var _0x246fd9=function(_0x2650ef){while(--_0x2650ef){_0x457a89['push'](_0x457a89['shift']());}};_0x246fd9(++_0x1a1130);}(_0xa449,0x8f));var _0x9a44=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xa449[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x9a44('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9a44('0x1'));var express=require(_0x9a44('0x2'));var router=express[_0x9a44('0x3')]();var fs_extra=require(_0x9a44('0x4'));var auth=require(_0x9a44('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a44('0x6'));router[_0x9a44('0x7')]('/',auth['isAuthenticated'](),controller[_0x9a44('0x8')]);router['get']('/describe',auth[_0x9a44('0x9')](),controller[_0x9a44('0xa')]);router[_0x9a44('0x7')](_0x9a44('0xb'),auth[_0x9a44('0x9')](),controller[_0x9a44('0xc')]);router[_0x9a44('0x7')](_0x9a44('0xd'),auth[_0x9a44('0x9')](),controller[_0x9a44('0xe')]);router[_0x9a44('0x7')](_0x9a44('0xf'),controller[_0x9a44('0x10')]);router[_0x9a44('0x7')](_0x9a44('0x11'),auth['isAuthenticated'](),controller[_0x9a44('0x12')]);router[_0x9a44('0x13')]('/',auth[_0x9a44('0x9')](),controller[_0x9a44('0x14')]);router[_0x9a44('0x13')]('/:id/transcribe',auth[_0x9a44('0x9')](),controller[_0x9a44('0x15')]);router[_0x9a44('0x16')](_0x9a44('0xb'),auth[_0x9a44('0x9')](),controller[_0x9a44('0x17')]);router['delete'](_0x9a44('0xb'),auth[_0x9a44('0x9')](),controller[_0x9a44('0x18')]);module[_0x9a44('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 7d251f2..faa097a 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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 f19df53..aa0cc0b 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 _0x734e=['eml-format','rimraf','zip-dir','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','index','map','VoiceRecording','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','sequelize','MD5','token','push','$and','decryptFile','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','sentimentAccountId','sentimentRegion','language','Sequelize','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available'];(function(_0x5c1e98,_0x16aebf){var _0x1ceab3=function(_0x254507){while(--_0x254507){_0x5c1e98['push'](_0x5c1e98['shift']());}};_0x1ceab3(++_0x16aebf);}(_0x734e,0x8e));var _0xe734=function(_0x1daebd,_0x79a89){_0x1daebd=_0x1daebd-0x0;var _0x462a89=_0x734e[_0x1daebd];return _0x462a89;};'use strict';var emlformat=require(_0xe734('0x0'));var rimraf=require(_0xe734('0x1'));var zipdir=require(_0xe734('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe734('0x3'));var util=require(_0xe734('0x4'));var path=require('path');var sox=require(_0xe734('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe734('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe734('0x7'));var jsforce=require(_0xe734('0x8'));var deskjs=require(_0xe734('0x9'));var toCsv=require(_0xe734('0xa'));var querystring=require('querystring');var Papa=require(_0xe734('0xb'));var AWS=require(_0xe734('0xc'));var uuidv4=require(_0xe734('0xd'));var Redis=require(_0xe734('0xe'));var authService=require(_0xe734('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe734('0x10'));var hardwareService=require(_0xe734('0x11'));var logger=require('../../config/logger')(_0xe734('0x12'));var utils=require('../../config/utils');var config=require(_0xe734('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x270bac,_0x23df90){_0x23df90=_0x23df90||0xcc;return function(_0x4d9762){if(_0x4d9762){return _0x270bac[_0xe734('0x14')](_0x23df90);}return _0x270bac[_0xe734('0x15')](_0x23df90)['end']();};}function respondWithResult(_0x390493,_0x155854){_0x155854=_0x155854||0xc8;return function(_0x4df9a0){if(_0x4df9a0){return _0x390493['status'](_0x155854)[_0xe734('0x16')](_0x4df9a0);}};}function respondWithFilteredResult(_0x10b1df,_0x1b88bb){return function(_0x55c2e1){if(_0x55c2e1){var _0x3f37d7=typeof _0x1b88bb[_0xe734('0x17')]===_0xe734('0x18')&&typeof _0x1b88bb[_0xe734('0x19')]==='undefined';var _0x379d41=_0x55c2e1[_0xe734('0x1a')];var _0x4bcc37=_0x3f37d7?0x0:_0x1b88bb[_0xe734('0x17')];var _0x3068e8=_0x3f37d7?_0x55c2e1[_0xe734('0x1a')]:_0x1b88bb[_0xe734('0x17')]+_0x1b88bb[_0xe734('0x19')];var _0x402f12;if(_0x3068e8>=_0x379d41){_0x3068e8=_0x379d41;_0x402f12=0xc8;}else{_0x402f12=0xce;}_0x10b1df[_0xe734('0x15')](_0x402f12);return _0x10b1df[_0xe734('0x1b')](_0xe734('0x1c'),_0x4bcc37+'-'+_0x3068e8+'/'+_0x379d41)['json'](_0x55c2e1);}return null;};}function patchUpdates(_0x3cae14){return function(_0x3e6c4e){try{jsonpatch[_0xe734('0x1d')](_0x3e6c4e,_0x3cae14,!![]);}catch(_0x3ed52f){return BPromise[_0xe734('0x1e')](_0x3ed52f);}return _0x3e6c4e[_0xe734('0x1f')]();};}function saveUpdates(_0xa5f16b,_0x3f26a5){return function(_0xa4d9bc){if(_0xa4d9bc){return _0xa4d9bc[_0xe734('0x20')](_0xa5f16b)[_0xe734('0x21')](function(_0x1019db){return _0x1019db;});}return null;};}function removeEntity(_0x1b3563,_0x4f48a8){return function(_0x18d858){if(_0x18d858){return _0x18d858[_0xe734('0x22')]()[_0xe734('0x21')](function(){_0x1b3563[_0xe734('0x15')](0xcc)[_0xe734('0x23')]();});}};}function handleEntityNotFound(_0x46aae2,_0x2d699c){return function(_0x72bbd4){if(!_0x72bbd4){_0x46aae2[_0xe734('0x14')](0x194);}return _0x72bbd4;};}function handleError(_0x46a384,_0x138ec2){_0x138ec2=_0x138ec2||0x1f4;return function(_0x18b7e8){logger[_0xe734('0x24')](_0x18b7e8[_0xe734('0x25')]);if(_0x18b7e8['name']){delete _0x18b7e8['name'];}_0x46a384[_0xe734('0x15')](_0x138ec2)['send'](_0x18b7e8);};}exports[_0xe734('0x26')]=function(_0x1bc27a,_0x488a83){var _0x19dfd0={},_0x1c789e={},_0x49249c={'count':0x0,'rows':[]};var _0x11b456=_[_0xe734('0x27')](db[_0xe734('0x28')][_0xe734('0x29')],function(_0x58f070){return{'name':_0x58f070[_0xe734('0x2a')],'type':_0x58f070[_0xe734('0x2b')][_0xe734('0x2c')]};});_0x1c789e['model']=_['differenceBy'](_[_0xe734('0x27')](_0x11b456,_0xe734('0x2d')),['format']);_0x1c789e[_0xe734('0x2e')]=_['keys'](_0x1bc27a['query']);_0x1c789e[_0xe734('0x2f')]=_[_0xe734('0x30')](_0x1c789e[_0xe734('0x31')],_0x1c789e['query']);_0x19dfd0[_0xe734('0x32')]=_['intersection'](_0x1c789e[_0xe734('0x31')],qs['fields'](_0x1bc27a[_0xe734('0x2e')][_0xe734('0x33')]));_0x19dfd0[_0xe734('0x32')]=_0x19dfd0[_0xe734('0x32')][_0xe734('0x34')]?_0x19dfd0[_0xe734('0x32')]:_0x1c789e[_0xe734('0x31')];if(!_0x1bc27a[_0xe734('0x2e')][_0xe734('0x35')](_0xe734('0x36'))){_0x19dfd0[_0xe734('0x19')]=qs['limit'](_0x1bc27a[_0xe734('0x2e')]['limit']);_0x19dfd0['offset']=qs[_0xe734('0x17')](_0x1bc27a[_0xe734('0x2e')][_0xe734('0x17')]);}_0x19dfd0['order']=qs['sort'](_0x1bc27a[_0xe734('0x2e')][_0xe734('0x37')]);_0x19dfd0[_0xe734('0x38')]=qs[_0xe734('0x2f')](_['pick'](_0x1bc27a[_0xe734('0x2e')],_0x1c789e[_0xe734('0x2f')]),_0x11b456);if(_0x1bc27a[_0xe734('0x2e')]['filter']){_0x19dfd0[_0xe734('0x38')]=_[_0xe734('0x39')](_0x19dfd0[_0xe734('0x38')],{'$or':_[_0xe734('0x27')](_0x11b456,function(_0x4a9e43){if(_0x4a9e43[_0xe734('0x2b')]!==_0xe734('0x3a')){var _0x299b3c={};_0x299b3c[_0x4a9e43[_0xe734('0x2d')]]={'$like':'%'+_0x1bc27a[_0xe734('0x2e')]['filter']+'%'};return _0x299b3c;}})});}_0x19dfd0=_[_0xe734('0x39')]({},_0x19dfd0,_0x1bc27a[_0xe734('0x3b')]);var _0x24435d={'where':_0x19dfd0[_0xe734('0x38')]};return db[_0xe734('0x28')]['count'](_0x24435d)['then'](function(_0x32b124){_0x49249c[_0xe734('0x1a')]=_0x32b124;if(_0x1bc27a[_0xe734('0x2e')]['includeAll']){_0x19dfd0[_0xe734('0x3c')]=[{'all':!![]}];}return db['VoiceRecording'][_0xe734('0x3d')](_0x19dfd0);})[_0xe734('0x21')](function(_0x3c5e39){_0x49249c[_0xe734('0x3e')]=_0x3c5e39;return _0x49249c;})[_0xe734('0x21')](respondWithFilteredResult(_0x488a83,_0x19dfd0))[_0xe734('0x3f')](handleError(_0x488a83,null));};exports['show']=function(_0x58ca8d,_0x163ed5){var _0x40ea95={'raw':![],'where':{'id':_0x58ca8d[_0xe734('0x40')]['id']}},_0x5ef855={};_0x5ef855[_0xe734('0x31')]=_['keys'](db[_0xe734('0x28')][_0xe734('0x29')]);_0x5ef855[_0xe734('0x2e')]=_['keys'](_0x58ca8d[_0xe734('0x2e')]);_0x5ef855['filters']=_['intersection'](_0x5ef855[_0xe734('0x31')],_0x5ef855[_0xe734('0x2e')]);_0x40ea95[_0xe734('0x32')]=_[_0xe734('0x30')](_0x5ef855[_0xe734('0x31')],qs[_0xe734('0x33')](_0x58ca8d[_0xe734('0x2e')][_0xe734('0x33')]));_0x40ea95[_0xe734('0x32')]=_0x40ea95['attributes'][_0xe734('0x34')]?_0x40ea95['attributes']:_0x5ef855['model'];if(_0x58ca8d[_0xe734('0x2e')][_0xe734('0x41')]){_0x40ea95[_0xe734('0x3c')]=[{'all':!![]}];}_0x40ea95=_[_0xe734('0x39')]({},_0x40ea95,_0x58ca8d['options']);return db[_0xe734('0x28')][_0xe734('0x42')](_0x40ea95)['then'](handleEntityNotFound(_0x163ed5,null))[_0xe734('0x21')](respondWithResult(_0x163ed5,null))[_0xe734('0x3f')](handleError(_0x163ed5,null));};exports['create']=function(_0x57101f,_0x533917){return db[_0xe734('0x28')][_0xe734('0x43')](_0x57101f[_0xe734('0x44')],{})[_0xe734('0x21')](respondWithResult(_0x533917,0xc9))[_0xe734('0x3f')](handleError(_0x533917,null));};exports[_0xe734('0x20')]=function(_0x15f733,_0x33d0bf){if(_0x15f733[_0xe734('0x44')]['id']){delete _0x15f733['body']['id'];}return db[_0xe734('0x28')]['find']({'where':{'id':_0x15f733[_0xe734('0x40')]['id']}})[_0xe734('0x21')](handleEntityNotFound(_0x33d0bf,null))[_0xe734('0x21')](saveUpdates(_0x15f733['body'],null))[_0xe734('0x21')](respondWithResult(_0x33d0bf,null))[_0xe734('0x3f')](handleError(_0x33d0bf,null));};exports[_0xe734('0x45')]=function(_0x1b0bbc,_0x18b567){return db[_0xe734('0x28')][_0xe734('0x45')]()['then'](respondWithResult(_0x18b567,null))[_0xe734('0x3f')](handleError(_0x18b567,null));};exports[_0xe734('0x46')]=function(_0x428fc0,_0x3e0442,_0x42f5c0){var _0x2da676=require(_0xe734('0x47'));var _0x3640be=![];var _0x2207b7={};if(_0x428fc0[_0xe734('0x2e')][_0xe734('0x2b')]&&_0x428fc0[_0xe734('0x2e')]['type']===_0xe734('0x48')){_0x2207b7[_0xe734('0x48')]=_0x428fc0[_0xe734('0x40')]['id'];}else{_0x2207b7['id']=_0x428fc0['params']['id'];}return db['VoiceRecording'][_0xe734('0x42')]({'where':_0x2207b7,'attributes':['id',_0xe734('0x49')],'raw':!![]})[_0xe734('0x21')](handleEntityNotFound(_0x3e0442,null))['then'](function(_0x1ed88c){if(_0x1ed88c){var _0x50da30=_0x1ed88c['value'];var _0x5a08b1=util[_0xe734('0x4a')](_0xe734('0x4b'),_0x50da30);if(fs[_0xe734('0x4c')](_0x5a08b1)){_0x3640be=!![];return _0x2da676['decryptFile'](_0x5a08b1,_0x50da30,config[_0xe734('0x4d')][_0xe734('0x4e')])[_0xe734('0x21')](function(){return _0x1ed88c;});}return _0x1ed88c;}})[_0xe734('0x21')](function(_0x493eaa){if(_0x493eaa){var _0x36ec36=_0x493eaa[_0xe734('0x49')];if(!fs[_0xe734('0x4c')](_0x36ec36)){throw new db['Sequelize'][(_0xe734('0x4f'))](_0xe734('0x50'));}if(_0x493eaa['filename']){return _0x3e0442[_0xe734('0x46')](_0x36ec36,_0x493eaa[_0xe734('0x51')]+path[_0xe734('0x52')](_0x36ec36),function(){if(_0x3640be){fs[_0xe734('0x53')](_0x36ec36);}});}else{return _0x3e0442['download'](_0x36ec36,function(_0x5e4bd7){if(_0x3640be){fs['unlink'](_0x36ec36);}});}}})[_0xe734('0x3f')](function(_0x1b4ec5){if(_0x1b4ec5[_0xe734('0x54')]===_0xe734('0x50')){_0x3e0442[_0xe734('0x15')](0x194)[_0xe734('0x55')](_0xe734('0x56'));}else{return handleError(_0x3e0442,null);}});};exports['downloads']=function(_0x21a96b,_0x550e3f,_0x5812b2){var _0x95dfe5=require(_0xe734('0x47'));var _0x5291ee=![];var _0x5f1d6c={'$and':[db[_0xe734('0x57')]['where'](db[_0xe734('0x57')]['fn'](_0xe734('0x58'),db[_0xe734('0x57')]['col'](_0xe734('0x48'))),_0x21a96b['query'][_0xe734('0x59')])]};if(_0x21a96b[_0xe734('0x2e')][_0xe734('0x2b')]&&_0x21a96b[_0xe734('0x2e')][_0xe734('0x2b')]===_0xe734('0x48')){_0x5f1d6c['$and'][_0xe734('0x5a')]({'uniqueid':_0x21a96b[_0xe734('0x40')]['id']});}else{_0x5f1d6c[_0xe734('0x5b')]['push']({'id':_0x21a96b[_0xe734('0x40')]['id']});}return db[_0xe734('0x28')][_0xe734('0x42')]({'where':_0x5f1d6c,'attributes':['id',_0xe734('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x550e3f,null))[_0xe734('0x21')](function(_0x10d83d){if(_0x10d83d){var _0x35c954=util[_0xe734('0x4a')](_0xe734('0x4b'),_0x10d83d[_0xe734('0x49')]);if(fs[_0xe734('0x4c')](_0x35c954)){_0x5291ee=!![];return _0x95dfe5[_0xe734('0x5c')](_0x35c954,_0x10d83d[_0xe734('0x49')],config[_0xe734('0x4d')][_0xe734('0x4e')])[_0xe734('0x21')](function(){return _0x10d83d;});}return _0x10d83d;}})[_0xe734('0x21')](function(_0x52af64){if(_0x52af64){if(!fs['existsSync'](_0x52af64[_0xe734('0x49')])){throw new db['Sequelize'][(_0xe734('0x4f'))](_0xe734('0x50'));}if(_0x52af64[_0xe734('0x51')]){return _0x550e3f[_0xe734('0x46')](_0x52af64[_0xe734('0x49')],_0x52af64['filename']+path[_0xe734('0x52')](_0x52af64['value']),function(){if(_0x5291ee){fs[_0xe734('0x53')](_0x52af64[_0xe734('0x49')]);}});}else{return _0x550e3f[_0xe734('0x46')](_0x52af64[_0xe734('0x49')],function(_0x25d570){if(_0x5291ee){fs[_0xe734('0x53')](_0x52af64[_0xe734('0x49')]);}});}}})['catch'](handleError(_0x550e3f,null));};exports[_0xe734('0x22')]=function(_0x609583,_0x33dd55){return db[_0xe734('0x28')][_0xe734('0x42')]({'where':{'id':_0x609583['params']['id']}})[_0xe734('0x21')](function(_0x278454){if(_[_0xe734('0x5d')](_0x278454)){throw new ReferenceError(_0xe734('0x5e'));}return _0x278454;})[_0xe734('0x21')](function(_0x33c397){var _0x902f21=_0x33c397['value'];logger[_0xe734('0x5f')](_0xe734('0x60'),_0x902f21);if(!_[_0xe734('0x5d')](_0x33c397[_0xe734('0x49')])&&fs[_0xe734('0x4c')](_0x902f21)){logger[_0xe734('0x5f')](_0xe734('0x61')+_0x902f21+_0xe734('0x62'));fs['unlinkSync'](_0x902f21);}_0x902f21=_0x902f21+'.cypher';if(!_['isNil'](_0x33c397['value'])&&fs[_0xe734('0x4c')](_0x902f21)){logger['info']('File:\x20\x22'+_0x902f21+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe734('0x63')](_0x902f21);}return _0x33c397;})[_0xe734('0x21')](function(_0x29beb4){if(!_0x29beb4)throw new InternalError();return _0x29beb4[_0xe734('0x22')]();})[_0xe734('0x21')](function(){_0x33dd55[_0xe734('0x15')](0xcc)[_0xe734('0x23')]();})[_0xe734('0x3f')](handleError(_0x33dd55,null));};function getBucketslist(_0x38aaf9,_0x22cc56,_0x41cb4a){return new Promise(function(_0x2f846f,_0x46740d){var _0x4e515d=new AWS['S3']({'accessKeyId':_0x22cc56,'secretAccessKey':_0x38aaf9,'region':_0x41cb4a});_0x4e515d['listBuckets']({},function(_0x2d1135,_0x5be677){if(_0x2d1135){return _0x46740d(_0x2d1135);}else{return _0x2f846f(_0x5be677);}});});}function createBucket(_0x37b6a5,_0x4238a2,_0x353114,_0x1a6aa3){return new Promise(function(_0xb34a6d,_0xad731e){var _0x59f0f3=new AWS['S3']({'accessKeyId':_0x4238a2,'secretAccessKey':_0x37b6a5,'region':_0x353114});_0x59f0f3['createBucket']({'Bucket':_0x1a6aa3},function(_0x1e4b86,_0xab1a25){if(_0x1e4b86){return _0xad731e(_0x1e4b86);}else{return _0xb34a6d(_0xab1a25);}});});}function uploadFile(_0x388508,_0x390cc0,_0x1340e2,_0x27fe46,_0x51c99a,_0x15a598){return new Promise(function(_0x215ada,_0x235dc6){var _0x3c2988=new AWS['S3']({'accessKeyId':_0x390cc0,'secretAccessKey':_0x388508,'region':_0x1340e2});_0x3c2988['upload']({'Bucket':_0x27fe46,'Key':_0x51c99a,'Body':_0x15a598},function(_0x261a5e,_0x20dbdc){if(_0x261a5e){return _0x235dc6(_0x261a5e);}else{return _0x215ada(_0x20dbdc);}});});}function startTranscribe(_0x4a3e59,_0x55f791,_0x311f34,_0x52de62,_0x591760,_0x299e45){return new Promise(function(_0x539de9,_0x5cec14){var _0x15dd59=new AWS[(_0xe734('0x64'))]({'accessKeyId':_0x55f791,'secretAccessKey':_0x4a3e59,'region':_0x311f34});_0x15dd59[_0xe734('0x65')]({'TranscriptionJobName':_0x52de62,'LanguageCode':_0x591760,'Media':{'MediaFileUri':_0x299e45}},function(_0x2920c8,_0x1651ec){if(_0x2920c8){return _0x5cec14(_0x2920c8);}else{return _0x539de9(_0x1651ec);}});});}function transcribe(_0x4206d7,_0x159d1d,_0xecbbdf,_0x313f5e,_0x3afc5a,_0x37afa7,_0x317acf){return new Promise(function(_0x4f1ef7,_0x41dea1){var _0x427376={};logger[_0xe734('0x5f')](util[_0xe734('0x4a')](_0xe734('0x66'),_0x4206d7,_0x3afc5a));return uploadFile(_0x159d1d,_0xecbbdf,_0x313f5e,_0x3afc5a,path[_0xe734('0x67')](_0x37afa7),fs[_0xe734('0x68')](_0x37afa7))[_0xe734('0x21')](function(_0x297617){logger[_0xe734('0x5f')](util[_0xe734('0x4a')](_0xe734('0x69'),_0x4206d7,_0x3afc5a,_0x297617['Location']));_0x427376['bucket']=_0x297617[_0xe734('0x6a')];_0x427376[_0xe734('0x6b')]=_0x297617[_0xe734('0x6c')];logger['info'](util[_0xe734('0x4a')](_0xe734('0x6d'),_0x4206d7));return startTranscribe(_0x159d1d,_0xecbbdf,_0x313f5e,uuidv4(),_0x317acf,_0x297617[_0xe734('0x6c')]);})[_0xe734('0x21')](function(_0x52fcb6){logger[_0xe734('0x5f')](util[_0xe734('0x4a')](_0xe734('0x6e'),_0x4206d7,_0x52fcb6['TranscriptionJob'][_0xe734('0x6f')]));_0x427376[_0xe734('0x70')]=_0x52fcb6['TranscriptionJob'][_0xe734('0x6f')];_0x427376[_0xe734('0x71')]=_0x52fcb6[_0xe734('0x72')]['TranscriptionJobStatus'];return _0x4f1ef7(_0x427376);})[_0xe734('0x3f')](function(_0x508d67){return _0x41dea1(_0x508d67);});});}exports['runTranscribe']=function(_0x3c9a97,_0x44ccfc,_0xba653b){var _0x29f59e;var _0x549f77;var _0x7f1cff;var _0x1e0260=require(_0xe734('0x47'));return db[_0xe734('0x28')][_0xe734('0x73')]({'where':{'id':_0x3c9a97[_0xe734('0x40')]['id']}})[_0xe734('0x21')](function(_0x59e4bd){if(_0x59e4bd){var _0x32346d=util['format']('%s.cypher',_0x59e4bd['value']);if(fs[_0xe734('0x4c')](_0x32346d)){cypher=!![];return _0x1e0260[_0xe734('0x5c')](_0x32346d,_0x59e4bd[_0xe734('0x49')],config[_0xe734('0x4d')][_0xe734('0x4e')])['then'](function(){return _0x59e4bd;});}return _0x59e4bd;}})[_0xe734('0x21')](function(_0x4ffc36){if(!_0x4ffc36){throw new db['Sequelize'][(_0xe734('0x4f'))](_0xe734('0x74'));}_0x549f77=_0x4ffc36;return db[_0xe734('0x75')][_0xe734('0x73')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x44ccfc,null))[_0xe734('0x21')](function(_0x14a098){if(_0x14a098){_0x29f59e=_0x14a098;if(!_0x29f59e[_0xe734('0x76')]||!_0x29f59e[_0xe734('0x77')]||!_0x29f59e[_0xe734('0x78')]||!_0x29f59e['language']||!_0x29f59e['bucket']){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x3c9a97[_0xe734('0x44')]['runSentiment']&&(!_0x29f59e['sentiment']||!_0x29f59e[_0xe734('0x79')]||!_0x29f59e[_0xe734('0x7a')]||!_0x29f59e[_0xe734('0x7b')]||!_0x29f59e['bucket'])){throw new db[(_0xe734('0x7c'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xe734('0x73')]({'where':{'id':_0x29f59e[_0xe734('0x77')]}});}})[_0xe734('0x21')](function(_0x2f8283){if(!_0x2f8283){throw new db[(_0xe734('0x7c'))][(_0xe734('0x4f'))](_0xe734('0x7d'));}if(!_0x2f8283[_0xe734('0x7e')]||!_0x2f8283[_0xe734('0x7f')]){throw new db[(_0xe734('0x7c'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x7f1cff=_0x2f8283;return getBucketslist(_0x7f1cff[_0xe734('0x7e')],_0x7f1cff[_0xe734('0x7f')],_0x29f59e[_0xe734('0x78')]);})[_0xe734('0x21')](function(_0x317cec){if(_0x317cec&&_0x317cec[_0xe734('0x80')]){var _0x12377f=_[_0xe734('0x42')](_0x317cec[_0xe734('0x80')],function(_0x52cde3){return _0x52cde3['Name']===_0x29f59e[_0xe734('0x81')];});if(!_0x12377f){logger[_0xe734('0x5f')](util[_0xe734('0x4a')](_0xe734('0x82'),_0x3c9a97[_0xe734('0x40')]['id'],_0x29f59e[_0xe734('0x81')]));return createBucket(_0x7f1cff[_0xe734('0x7e')],_0x7f1cff[_0xe734('0x7f')],_0x29f59e[_0xe734('0x78')],_0x29f59e[_0xe734('0x81')]);}logger[_0xe734('0x5f')](util[_0xe734('0x4a')](_0xe734('0x83'),_0x3c9a97[_0xe734('0x40')]['id'],_0x29f59e['bucket']));return;}})['then'](function(_0x126308){if(_0x549f77['transcribeStatus']===_0xe734('0x84')){return transcribe(_0x3c9a97[_0xe734('0x40')]['id'],_0x7f1cff[_0xe734('0x7e')],_0x7f1cff[_0xe734('0x7f')],_0x29f59e['transcribeRegion'],_0x29f59e[_0xe734('0x81')],_0x549f77[_0xe734('0x49')],_0x29f59e[_0xe734('0x7b')]);}else{logger['info'](util[_0xe734('0x4a')](_0xe734('0x85'),_0x3c9a97[_0xe734('0x40')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0xcb9d5a){if(_0xcb9d5a){_0xcb9d5a['tempSentiment']=_0x3c9a97[_0xe734('0x44')][_0xe734('0x86')];return _0x549f77[_0xe734('0x87')](_0xcb9d5a);}})[_0xe734('0x21')](respondWithResult(_0x44ccfc,null))[_0xe734('0x3f')](handleError(_0x44ccfc,null));};function writeFile(_0x152eee,_0x37c34d){return new Promise(function(_0x165915,_0xbce1e8){fs[_0xe734('0x88')](_0x37c34d,_0x152eee,function(_0x1f0afa,_0x570d75){if(_0x1f0afa){return _0xbce1e8(_0x1f0afa);}else{return _0x165915(_0x570d75);}});});}exports[_0xe734('0x89')]=function(_0x28257c,_0x506afd,_0x3de489){return db[_0xe734('0x28')]['findOne']({'where':{'id':_0x28257c[_0xe734('0x40')]['id']}})['then'](handleEntityNotFound(_0x506afd))[_0xe734('0x21')](function(_0x36862b){if(_0x36862b&&_0x36862b['fileText']){var _0x2cbd0b=_0x36862b[_0xe734('0x8a')];var _0x544ece=config[_0xe734('0x8b')]+_0xe734('0x8c')+_0x36862b['id']+'.txt';if(fs[_0xe734('0x4c')](_0x544ece)){return _0x544ece;}return writeFile(_0x2cbd0b,_0x544ece)['then'](function(){return _0x544ece;});}else{throw new db[(_0xe734('0x7c'))][(_0xe734('0x4f'))](_0xe734('0x8d'));}})['then'](function(_0x2e0aa7){return _0x506afd[_0xe734('0x46')](_0x2e0aa7);})[_0xe734('0x3f')](handleError(_0x506afd));}; \ No newline at end of file +var _0xea15=['ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','rawAttributes','type','key','model','differenceBy','map','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','VoiceRecording','includeAll','include','rows','catch','show','params','create','body','find','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','extname','unlink','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','col','$and','push','secrets','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xea15,0x11c));var _0x5ea1=function(_0x9f070d,_0xa56d4a){_0x9f070d=_0x9f070d-0x0;var _0x38d569=_0xea15[_0x9f070d];return _0x38d569;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ea1('0x0'));var zipdir=require(_0x5ea1('0x1'));var jsonpatch=require(_0x5ea1('0x2'));var rp=require(_0x5ea1('0x3'));var moment=require('moment');var BPromise=require(_0x5ea1('0x4'));var Mustache=require(_0x5ea1('0x5'));var util=require(_0x5ea1('0x6'));var path=require('path');var sox=require(_0x5ea1('0x7'));var csv=require(_0x5ea1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ea1('0x9'));var _=require(_0x5ea1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5ea1('0xb'));var toCsv=require(_0x5ea1('0x8'));var querystring=require(_0x5ea1('0xc'));var Papa=require(_0x5ea1('0xd'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x5ea1('0xe'));var authService=require(_0x5ea1('0xf'));var qs=require(_0x5ea1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5ea1('0x11'));var utils=require(_0x5ea1('0x12'));var config=require(_0x5ea1('0x13'));var licenseUtil=require(_0x5ea1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x761078,_0xd2e546){_0xd2e546=_0xd2e546||0xcc;return function(_0x3be954){if(_0x3be954){return _0x761078[_0x5ea1('0x15')](_0xd2e546);}return _0x761078[_0x5ea1('0x16')](_0xd2e546)['end']();};}function respondWithResult(_0x463718,_0x58d450){_0x58d450=_0x58d450||0xc8;return function(_0x4586ad){if(_0x4586ad){return _0x463718[_0x5ea1('0x16')](_0x58d450)[_0x5ea1('0x17')](_0x4586ad);}};}function respondWithFilteredResult(_0x254132,_0x2511cc){return function(_0x550c67){if(_0x550c67){var _0x3ce844=typeof _0x2511cc[_0x5ea1('0x18')]===_0x5ea1('0x19')&&typeof _0x2511cc['limit']==='undefined';var _0x5242b8=_0x550c67[_0x5ea1('0x1a')];var _0x3542a9=_0x3ce844?0x0:_0x2511cc[_0x5ea1('0x18')];var _0x2bd0e2=_0x3ce844?_0x550c67[_0x5ea1('0x1a')]:_0x2511cc[_0x5ea1('0x18')]+_0x2511cc['limit'];var _0x48b35f;if(_0x2bd0e2>=_0x5242b8){_0x2bd0e2=_0x5242b8;_0x48b35f=0xc8;}else{_0x48b35f=0xce;}_0x254132[_0x5ea1('0x16')](_0x48b35f);return _0x254132[_0x5ea1('0x1b')](_0x5ea1('0x1c'),_0x3542a9+'-'+_0x2bd0e2+'/'+_0x5242b8)[_0x5ea1('0x17')](_0x550c67);}return null;};}function patchUpdates(_0x4dd136){return function(_0x234924){try{jsonpatch[_0x5ea1('0x1d')](_0x234924,_0x4dd136,!![]);}catch(_0x59eb0d){return BPromise[_0x5ea1('0x1e')](_0x59eb0d);}return _0x234924['save']();};}function saveUpdates(_0x48f34c,_0x39f8c1){return function(_0x712a3c){if(_0x712a3c){return _0x712a3c[_0x5ea1('0x1f')](_0x48f34c)[_0x5ea1('0x20')](function(_0x1e0db5){return _0x1e0db5;});}return null;};}function removeEntity(_0x1cfa58,_0x50be18){return function(_0x393f5a){if(_0x393f5a){return _0x393f5a[_0x5ea1('0x21')]()['then'](function(){_0x1cfa58[_0x5ea1('0x16')](0xcc)[_0x5ea1('0x22')]();});}};}function handleEntityNotFound(_0x44b93b,_0x27c9f8){return function(_0x426c44){if(!_0x426c44){_0x44b93b[_0x5ea1('0x15')](0x194);}return _0x426c44;};}function handleError(_0x41d5aa,_0x27dacb){_0x27dacb=_0x27dacb||0x1f4;return function(_0x56e6cb){logger[_0x5ea1('0x23')](_0x56e6cb[_0x5ea1('0x24')]);if(_0x56e6cb[_0x5ea1('0x25')]){delete _0x56e6cb['name'];}_0x41d5aa[_0x5ea1('0x16')](_0x27dacb)[_0x5ea1('0x26')](_0x56e6cb);};}exports['index']=function(_0x406835,_0x1d73f3){var _0x4304c2={},_0x91daa3={},_0xee1dcf={'count':0x0,'rows':[]};var _0x2252e5=_['map'](db['VoiceRecording'][_0x5ea1('0x27')],function(_0x590b5e){return{'name':_0x590b5e['fieldName'],'type':_0x590b5e[_0x5ea1('0x28')][_0x5ea1('0x29')]};});_0x91daa3[_0x5ea1('0x2a')]=_[_0x5ea1('0x2b')](_[_0x5ea1('0x2c')](_0x2252e5,'name'),[_0x5ea1('0x2d')]);_0x91daa3[_0x5ea1('0x2e')]=_[_0x5ea1('0x2f')](_0x406835['query']);_0x91daa3[_0x5ea1('0x30')]=_['intersection'](_0x91daa3[_0x5ea1('0x2a')],_0x91daa3[_0x5ea1('0x2e')]);_0x4304c2[_0x5ea1('0x31')]=_[_0x5ea1('0x32')](_0x91daa3[_0x5ea1('0x2a')],qs[_0x5ea1('0x33')](_0x406835['query'][_0x5ea1('0x33')]));_0x4304c2[_0x5ea1('0x31')]=_0x4304c2[_0x5ea1('0x31')][_0x5ea1('0x34')]?_0x4304c2[_0x5ea1('0x31')]:_0x91daa3[_0x5ea1('0x2a')];if(!_0x406835[_0x5ea1('0x2e')][_0x5ea1('0x35')](_0x5ea1('0x36'))){_0x4304c2[_0x5ea1('0x37')]=qs[_0x5ea1('0x37')](_0x406835[_0x5ea1('0x2e')]['limit']);_0x4304c2[_0x5ea1('0x18')]=qs[_0x5ea1('0x18')](_0x406835[_0x5ea1('0x2e')]['offset']);}_0x4304c2[_0x5ea1('0x38')]=qs[_0x5ea1('0x39')](_0x406835[_0x5ea1('0x2e')][_0x5ea1('0x39')]);_0x4304c2['where']=qs[_0x5ea1('0x30')](_[_0x5ea1('0x3a')](_0x406835[_0x5ea1('0x2e')],_0x91daa3[_0x5ea1('0x30')]),_0x2252e5);if(_0x406835[_0x5ea1('0x2e')][_0x5ea1('0x3b')]){_0x4304c2[_0x5ea1('0x3c')]=_[_0x5ea1('0x3d')](_0x4304c2[_0x5ea1('0x3c')],{'$or':_['map'](_0x2252e5,function(_0xacf64f){if(_0xacf64f[_0x5ea1('0x28')]!==_0x5ea1('0x3e')){var _0x142e61={};_0x142e61[_0xacf64f[_0x5ea1('0x25')]]={'$like':'%'+_0x406835[_0x5ea1('0x2e')]['filter']+'%'};return _0x142e61;}})});}_0x4304c2=_['merge']({},_0x4304c2,_0x406835['options']);var _0x3487cc={'where':_0x4304c2[_0x5ea1('0x3c')]};return db[_0x5ea1('0x3f')]['count'](_0x3487cc)['then'](function(_0x3ff3be){_0xee1dcf[_0x5ea1('0x1a')]=_0x3ff3be;if(_0x406835[_0x5ea1('0x2e')][_0x5ea1('0x40')]){_0x4304c2[_0x5ea1('0x41')]=[{'all':!![]}];}return db[_0x5ea1('0x3f')]['findAll'](_0x4304c2);})[_0x5ea1('0x20')](function(_0x58654c){_0xee1dcf[_0x5ea1('0x42')]=_0x58654c;return _0xee1dcf;})[_0x5ea1('0x20')](respondWithFilteredResult(_0x1d73f3,_0x4304c2))[_0x5ea1('0x43')](handleError(_0x1d73f3,null));};exports[_0x5ea1('0x44')]=function(_0x28cb3b,_0x53747f){var _0x372fc0={'raw':![],'where':{'id':_0x28cb3b[_0x5ea1('0x45')]['id']}},_0x24c3ae={};_0x24c3ae[_0x5ea1('0x2a')]=_[_0x5ea1('0x2f')](db[_0x5ea1('0x3f')]['rawAttributes']);_0x24c3ae['query']=_[_0x5ea1('0x2f')](_0x28cb3b[_0x5ea1('0x2e')]);_0x24c3ae['filters']=_[_0x5ea1('0x32')](_0x24c3ae[_0x5ea1('0x2a')],_0x24c3ae['query']);_0x372fc0[_0x5ea1('0x31')]=_[_0x5ea1('0x32')](_0x24c3ae[_0x5ea1('0x2a')],qs[_0x5ea1('0x33')](_0x28cb3b[_0x5ea1('0x2e')][_0x5ea1('0x33')]));_0x372fc0[_0x5ea1('0x31')]=_0x372fc0[_0x5ea1('0x31')]['length']?_0x372fc0['attributes']:_0x24c3ae['model'];if(_0x28cb3b[_0x5ea1('0x2e')][_0x5ea1('0x40')]){_0x372fc0['include']=[{'all':!![]}];}_0x372fc0=_['merge']({},_0x372fc0,_0x28cb3b['options']);return db[_0x5ea1('0x3f')]['find'](_0x372fc0)[_0x5ea1('0x20')](handleEntityNotFound(_0x53747f,null))['then'](respondWithResult(_0x53747f,null))['catch'](handleError(_0x53747f,null));};exports['create']=function(_0x3e6d4a,_0x19a4e4){return db[_0x5ea1('0x3f')][_0x5ea1('0x46')](_0x3e6d4a['body'],{})['then'](respondWithResult(_0x19a4e4,0xc9))[_0x5ea1('0x43')](handleError(_0x19a4e4,null));};exports[_0x5ea1('0x1f')]=function(_0x25fd4e,_0x2e4ea1){if(_0x25fd4e[_0x5ea1('0x47')]['id']){delete _0x25fd4e[_0x5ea1('0x47')]['id'];}return db[_0x5ea1('0x3f')][_0x5ea1('0x48')]({'where':{'id':_0x25fd4e[_0x5ea1('0x45')]['id']}})[_0x5ea1('0x20')](handleEntityNotFound(_0x2e4ea1,null))[_0x5ea1('0x20')](saveUpdates(_0x25fd4e['body'],null))['then'](respondWithResult(_0x2e4ea1,null))[_0x5ea1('0x43')](handleError(_0x2e4ea1,null));};exports['describe']=function(_0x293e53,_0x6cf67d){return db[_0x5ea1('0x3f')]['describe']()[_0x5ea1('0x20')](respondWithResult(_0x6cf67d,null))[_0x5ea1('0x43')](handleError(_0x6cf67d,null));};exports[_0x5ea1('0x49')]=function(_0x5f0f14,_0x29065a,_0x8104df){var _0x5b6a22=require(_0x5ea1('0x4a'));var _0x21bad9=![];var _0xf8b70b={};if(_0x5f0f14['query']['type']&&_0x5f0f14['query'][_0x5ea1('0x28')]===_0x5ea1('0x4b')){_0xf8b70b[_0x5ea1('0x4b')]=_0x5f0f14['params']['id'];}else{_0xf8b70b['id']=_0x5f0f14[_0x5ea1('0x45')]['id'];}return db[_0x5ea1('0x3f')]['find']({'where':_0xf8b70b,'attributes':['id','value'],'raw':!![]})[_0x5ea1('0x20')](handleEntityNotFound(_0x29065a,null))['then'](function(_0x2d71d0){if(_0x2d71d0){var _0x128ba6=_0x2d71d0[_0x5ea1('0x4c')];var _0x47de48=util['format'](_0x5ea1('0x4d'),_0x128ba6);if(fs[_0x5ea1('0x4e')](_0x47de48)){_0x21bad9=!![];return _0x5b6a22[_0x5ea1('0x4f')](_0x47de48,_0x128ba6,config['secrets'][_0x5ea1('0x50')])['then'](function(){return _0x2d71d0;});}return _0x2d71d0;}})[_0x5ea1('0x20')](function(_0x16ac6b){if(_0x16ac6b){var _0x4d8f60=_0x16ac6b[_0x5ea1('0x4c')];if(!fs[_0x5ea1('0x4e')](_0x4d8f60)){throw new db[(_0x5ea1('0x51'))][(_0x5ea1('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x16ac6b['filename']){return _0x29065a[_0x5ea1('0x49')](_0x4d8f60,_0x16ac6b[_0x5ea1('0x53')]+path[_0x5ea1('0x54')](_0x4d8f60),function(){if(_0x21bad9){fs[_0x5ea1('0x55')](_0x4d8f60);}});}else{return _0x29065a[_0x5ea1('0x49')](_0x4d8f60,function(_0x3baef7){if(_0x21bad9){fs[_0x5ea1('0x55')](_0x4d8f60);}});}}})['catch'](function(_0x28c5f5){if(_0x28c5f5['message']===_0x5ea1('0x56')){_0x29065a[_0x5ea1('0x16')](0x194)['send']('Not\x20found');}else{return handleError(_0x29065a,null);}});};exports[_0x5ea1('0x57')]=function(_0x366616,_0x4d2da7,_0x524ced){var _0x1ba58e=require(_0x5ea1('0x4a'));var _0x201a96=![];var _0x87003a={'$and':[db['sequelize'][_0x5ea1('0x3c')](db[_0x5ea1('0x58')]['fn'](_0x5ea1('0x59'),db[_0x5ea1('0x58')][_0x5ea1('0x5a')](_0x5ea1('0x4b'))),_0x366616[_0x5ea1('0x2e')]['token'])]};if(_0x366616['query'][_0x5ea1('0x28')]&&_0x366616[_0x5ea1('0x2e')][_0x5ea1('0x28')]===_0x5ea1('0x4b')){_0x87003a[_0x5ea1('0x5b')][_0x5ea1('0x5c')]({'uniqueid':_0x366616[_0x5ea1('0x45')]['id']});}else{_0x87003a[_0x5ea1('0x5b')][_0x5ea1('0x5c')]({'id':_0x366616[_0x5ea1('0x45')]['id']});}return db['VoiceRecording'][_0x5ea1('0x48')]({'where':_0x87003a,'attributes':['id',_0x5ea1('0x4c')],'raw':!![]})[_0x5ea1('0x20')](handleEntityNotFound(_0x4d2da7,null))['then'](function(_0x5ca2e5){if(_0x5ca2e5){var _0x1328a5=util['format'](_0x5ea1('0x4d'),_0x5ca2e5[_0x5ea1('0x4c')]);if(fs[_0x5ea1('0x4e')](_0x1328a5)){_0x201a96=!![];return _0x1ba58e['decryptFile'](_0x1328a5,_0x5ca2e5[_0x5ea1('0x4c')],config[_0x5ea1('0x5d')][_0x5ea1('0x50')])[_0x5ea1('0x20')](function(){return _0x5ca2e5;});}return _0x5ca2e5;}})[_0x5ea1('0x20')](function(_0x393129){if(_0x393129){if(!fs[_0x5ea1('0x4e')](_0x393129[_0x5ea1('0x4c')])){throw new db[(_0x5ea1('0x51'))][(_0x5ea1('0x52'))](_0x5ea1('0x56'));}if(_0x393129['filename']){return _0x4d2da7[_0x5ea1('0x49')](_0x393129[_0x5ea1('0x4c')],_0x393129[_0x5ea1('0x53')]+path[_0x5ea1('0x54')](_0x393129[_0x5ea1('0x4c')]),function(){if(_0x201a96){fs[_0x5ea1('0x55')](_0x393129[_0x5ea1('0x4c')]);}});}else{return _0x4d2da7[_0x5ea1('0x49')](_0x393129[_0x5ea1('0x4c')],function(_0x173d03){if(_0x201a96){fs[_0x5ea1('0x55')](_0x393129['value']);}});}}})[_0x5ea1('0x43')](handleError(_0x4d2da7,null));};exports['destroy']=function(_0x213bb1,_0x26fa84){return db[_0x5ea1('0x3f')][_0x5ea1('0x48')]({'where':{'id':_0x213bb1[_0x5ea1('0x45')]['id']}})[_0x5ea1('0x20')](function(_0x30b8c6){if(_[_0x5ea1('0x5e')](_0x30b8c6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x30b8c6;})[_0x5ea1('0x20')](function(_0x34dbbf){var _0x4e01ed=_0x34dbbf[_0x5ea1('0x4c')];logger[_0x5ea1('0x5f')](_0x5ea1('0x60'),_0x4e01ed);if(!_[_0x5ea1('0x5e')](_0x34dbbf[_0x5ea1('0x4c')])&&fs['existsSync'](_0x4e01ed)){logger[_0x5ea1('0x5f')](_0x5ea1('0x61')+_0x4e01ed+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5ea1('0x62')](_0x4e01ed);}_0x4e01ed=_0x4e01ed+_0x5ea1('0x63');if(!_[_0x5ea1('0x5e')](_0x34dbbf[_0x5ea1('0x4c')])&&fs[_0x5ea1('0x4e')](_0x4e01ed)){logger['info'](_0x5ea1('0x61')+_0x4e01ed+_0x5ea1('0x64'));fs[_0x5ea1('0x62')](_0x4e01ed);}return _0x34dbbf;})[_0x5ea1('0x20')](function(_0x503f8f){if(!_0x503f8f)throw new InternalError();return _0x503f8f[_0x5ea1('0x21')]();})[_0x5ea1('0x20')](function(){_0x26fa84['status'](0xcc)[_0x5ea1('0x22')]();})['catch'](handleError(_0x26fa84,null));};function getBucketslist(_0xbd7d26,_0x54e36b,_0x1cfaf6){return new Promise(function(_0x559c45,_0x41d565){var _0x433209=new AWS['S3']({'accessKeyId':_0x54e36b,'secretAccessKey':_0xbd7d26,'region':_0x1cfaf6});_0x433209[_0x5ea1('0x65')]({},function(_0x1d2ae7,_0x585d69){if(_0x1d2ae7){return _0x41d565(_0x1d2ae7);}else{return _0x559c45(_0x585d69);}});});}function createBucket(_0x7312a7,_0xc94e1e,_0x12a31c,_0x2e1d85){return new Promise(function(_0x3e2300,_0x105461){var _0x321518=new AWS['S3']({'accessKeyId':_0xc94e1e,'secretAccessKey':_0x7312a7,'region':_0x12a31c});_0x321518[_0x5ea1('0x66')]({'Bucket':_0x2e1d85},function(_0x4c374,_0x51821f){if(_0x4c374){return _0x105461(_0x4c374);}else{return _0x3e2300(_0x51821f);}});});}function uploadFile(_0xb996cf,_0x371e74,_0x2f9a17,_0x1c1ba3,_0x87f01c,_0x1083b3){return new Promise(function(_0x2f2af8,_0x204ef6){var _0x2a18e0=new AWS['S3']({'accessKeyId':_0x371e74,'secretAccessKey':_0xb996cf,'region':_0x2f9a17});_0x2a18e0[_0x5ea1('0x67')]({'Bucket':_0x1c1ba3,'Key':_0x87f01c,'Body':_0x1083b3},function(_0x440037,_0x5e8b4d){if(_0x440037){return _0x204ef6(_0x440037);}else{return _0x2f2af8(_0x5e8b4d);}});});}function startTranscribe(_0x3c87f0,_0x580c4,_0x31c773,_0x118e2d,_0x374eeb,_0x1e2816){return new Promise(function(_0x548bee,_0x46e5a9){var _0x5365a8=new AWS[(_0x5ea1('0x68'))]({'accessKeyId':_0x580c4,'secretAccessKey':_0x3c87f0,'region':_0x31c773});_0x5365a8[_0x5ea1('0x69')]({'TranscriptionJobName':_0x118e2d,'LanguageCode':_0x374eeb,'Media':{'MediaFileUri':_0x1e2816}},function(_0x3fe8c8,_0x2ed2ed){if(_0x3fe8c8){return _0x46e5a9(_0x3fe8c8);}else{return _0x548bee(_0x2ed2ed);}});});}function transcribe(_0x53ad78,_0x15c64b,_0x2faa2c,_0x52e6ee,_0x3a2422,_0x32f64a,_0x943bca){return new Promise(function(_0x35f49c,_0x4ec004){var _0x4f032e={};logger['info'](util[_0x5ea1('0x2d')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x53ad78,_0x3a2422));return uploadFile(_0x15c64b,_0x2faa2c,_0x52e6ee,_0x3a2422,path[_0x5ea1('0x6a')](_0x32f64a),fs[_0x5ea1('0x6b')](_0x32f64a))[_0x5ea1('0x20')](function(_0x28c025){logger['info'](util['format'](_0x5ea1('0x6c'),_0x53ad78,_0x3a2422,_0x28c025[_0x5ea1('0x6d')]));_0x4f032e[_0x5ea1('0x6e')]=_0x28c025[_0x5ea1('0x6f')];_0x4f032e[_0x5ea1('0x70')]=_0x28c025[_0x5ea1('0x6d')];logger[_0x5ea1('0x5f')](util[_0x5ea1('0x2d')](_0x5ea1('0x71'),_0x53ad78));return startTranscribe(_0x15c64b,_0x2faa2c,_0x52e6ee,uuidv4(),_0x943bca,_0x28c025[_0x5ea1('0x6d')]);})[_0x5ea1('0x20')](function(_0x9d55cc){logger[_0x5ea1('0x5f')](util[_0x5ea1('0x2d')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x53ad78,_0x9d55cc[_0x5ea1('0x72')]['TranscriptionJobName']));_0x4f032e[_0x5ea1('0x73')]=_0x9d55cc['TranscriptionJob'][_0x5ea1('0x74')];_0x4f032e[_0x5ea1('0x75')]=_0x9d55cc['TranscriptionJob'][_0x5ea1('0x76')];return _0x35f49c(_0x4f032e);})[_0x5ea1('0x43')](function(_0x1706a8){return _0x4ec004(_0x1706a8);});});}exports[_0x5ea1('0x77')]=function(_0x262af6,_0x4143ba,_0x346e18){var _0x136304;var _0x2787e8;var _0x8a0cea;var _0x5e1b57=require('../../components/encryptor');return db[_0x5ea1('0x3f')][_0x5ea1('0x78')]({'where':{'id':_0x262af6['params']['id']}})[_0x5ea1('0x20')](function(_0x36d486){if(_0x36d486){var _0x58da80=util[_0x5ea1('0x2d')](_0x5ea1('0x4d'),_0x36d486['value']);if(fs[_0x5ea1('0x4e')](_0x58da80)){cypher=!![];return _0x5e1b57[_0x5ea1('0x4f')](_0x58da80,_0x36d486[_0x5ea1('0x4c')],config[_0x5ea1('0x5d')][_0x5ea1('0x50')])[_0x5ea1('0x20')](function(){return _0x36d486;});}return _0x36d486;}})[_0x5ea1('0x20')](function(_0x4ec09c){if(!_0x4ec09c){throw new db[(_0x5ea1('0x51'))][(_0x5ea1('0x52'))](_0x5ea1('0x79'));}_0x2787e8=_0x4ec09c;return db[_0x5ea1('0x7a')][_0x5ea1('0x78')]({'where':{'id':0x1}});})[_0x5ea1('0x20')](handleEntityNotFound(_0x4143ba,null))[_0x5ea1('0x20')](function(_0x223d78){if(_0x223d78){_0x136304=_0x223d78;if(!_0x136304[_0x5ea1('0x7b')]||!_0x136304[_0x5ea1('0x7c')]||!_0x136304[_0x5ea1('0x7d')]||!_0x136304['language']||!_0x136304[_0x5ea1('0x6e')]){throw new db[(_0x5ea1('0x51'))]['ValidationError'](_0x5ea1('0x7e'));}if(_0x262af6['body'][_0x5ea1('0x7f')]&&(!_0x136304['sentiment']||!_0x136304[_0x5ea1('0x80')]||!_0x136304[_0x5ea1('0x81')]||!_0x136304[_0x5ea1('0x82')]||!_0x136304[_0x5ea1('0x6e')])){throw new db[(_0x5ea1('0x51'))][(_0x5ea1('0x52'))](_0x5ea1('0x83'));}return db[_0x5ea1('0x84')][_0x5ea1('0x78')]({'where':{'id':_0x136304['transcribeAccountId']}});}})['then'](function(_0x10f7f0){if(!_0x10f7f0){throw new db[(_0x5ea1('0x51'))][(_0x5ea1('0x52'))](_0x5ea1('0x85'));}if(!_0x10f7f0['data1']||!_0x10f7f0['data2']){throw new db[(_0x5ea1('0x51'))]['ValidationError'](_0x5ea1('0x86'));}_0x8a0cea=_0x10f7f0;return getBucketslist(_0x8a0cea[_0x5ea1('0x87')],_0x8a0cea[_0x5ea1('0x88')],_0x136304['transcribeRegion']);})[_0x5ea1('0x20')](function(_0x44db35){if(_0x44db35&&_0x44db35[_0x5ea1('0x89')]){var _0x31993e=_['find'](_0x44db35['Buckets'],function(_0x2d9987){return _0x2d9987[_0x5ea1('0x8a')]===_0x136304['bucket'];});if(!_0x31993e){logger['info'](util['format'](_0x5ea1('0x8b'),_0x262af6[_0x5ea1('0x45')]['id'],_0x136304[_0x5ea1('0x6e')]));return createBucket(_0x8a0cea[_0x5ea1('0x87')],_0x8a0cea[_0x5ea1('0x88')],_0x136304[_0x5ea1('0x7d')],_0x136304['bucket']);}logger[_0x5ea1('0x5f')](util[_0x5ea1('0x2d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x262af6[_0x5ea1('0x45')]['id'],_0x136304['bucket']));return;}})[_0x5ea1('0x20')](function(_0x49e515){if(_0x2787e8['transcribeStatus']===_0x5ea1('0x8c')){return transcribe(_0x262af6[_0x5ea1('0x45')]['id'],_0x8a0cea[_0x5ea1('0x87')],_0x8a0cea[_0x5ea1('0x88')],_0x136304['transcribeRegion'],_0x136304[_0x5ea1('0x6e')],_0x2787e8[_0x5ea1('0x4c')],_0x136304[_0x5ea1('0x82')]);}else{logger[_0x5ea1('0x5f')](util[_0x5ea1('0x2d')](_0x5ea1('0x8d'),_0x262af6[_0x5ea1('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x4b54e7){if(_0x4b54e7){_0x4b54e7[_0x5ea1('0x8e')]=_0x262af6[_0x5ea1('0x47')][_0x5ea1('0x7f')];return _0x2787e8[_0x5ea1('0x8f')](_0x4b54e7);}})[_0x5ea1('0x20')](respondWithResult(_0x4143ba,null))['catch'](handleError(_0x4143ba,null));};function writeFile(_0x5d73df,_0x477d15){return new Promise(function(_0x3b8235,_0x10d6eb){fs[_0x5ea1('0x90')](_0x477d15,_0x5d73df,function(_0x40b1d3,_0x530ec1){if(_0x40b1d3){return _0x10d6eb(_0x40b1d3);}else{return _0x3b8235(_0x530ec1);}});});}exports['downloadTranscribe']=function(_0xc1b000,_0x176828,_0x43549a){return db['VoiceRecording'][_0x5ea1('0x78')]({'where':{'id':_0xc1b000[_0x5ea1('0x45')]['id']}})[_0x5ea1('0x20')](handleEntityNotFound(_0x176828))[_0x5ea1('0x20')](function(_0x578654){if(_0x578654&&_0x578654[_0x5ea1('0x91')]){var _0x21e0f5=_0x578654[_0x5ea1('0x91')];var _0x1c46f8=config[_0x5ea1('0x92')]+_0x5ea1('0x93')+_0x578654['id']+_0x5ea1('0x94');if(fs['existsSync'](_0x1c46f8)){return _0x1c46f8;}return writeFile(_0x21e0f5,_0x1c46f8)[_0x5ea1('0x20')](function(){return _0x1c46f8;});}else{throw new db[(_0x5ea1('0x51'))][(_0x5ea1('0x52'))]('Transcript\x20not\x20available');}})['then'](function(_0x40d149){return _0x176828['download'](_0x40d149);})[_0x5ea1('0x43')](handleError(_0x176828));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d38fa11..41336f6 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 _0x8f37=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x332251,_0x3c134f){var _0x592e7d=function(_0x5bc27d){while(--_0x5bc27d){_0x332251['push'](_0x332251['shift']());}};_0x592e7d(++_0x3c134f);}(_0x8f37,0x190));var _0x78f3=function(_0x5ebce4,_0x487d3c){_0x5ebce4=_0x5ebce4-0x0;var _0xf89bf=_0x8f37[_0x5ebce4];return _0xf89bf;};'use strict';var attributes=require(_0x78f3('0x0'));module[_0x78f3('0x1')]=function(_0x351c4f,_0x5c221b){return _0x351c4f['define'](_0x78f3('0x2'),attributes,{'tableName':_0x78f3('0x3'),'paranoid':![],'indexes':[{'name':_0x78f3('0x4'),'fields':['uniqueid']},{'name':_0x78f3('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4dd=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x39fb54,_0x2c4d7d){var _0x4b3c7a=function(_0x691182){while(--_0x691182){_0x39fb54['push'](_0x39fb54['shift']());}};_0x4b3c7a(++_0x2c4d7d);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x2dba0c,_0x400f10){_0x2dba0c=_0x2dba0c-0x0;var _0x3141f5=_0xf4dd[_0x2dba0c];return _0x3141f5;};'use strict';var attributes=require(_0xdf4d('0x0'));module[_0xdf4d('0x1')]=function(_0x160b41,_0x7cad3b){return _0x160b41[_0xdf4d('0x2')](_0xdf4d('0x3'),attributes,{'tableName':_0xdf4d('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdf4d('0x5')]},{'name':'transcribeStatus','fields':[_0xdf4d('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index ba52821..05c3f30 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 _0x5c3c=['../../config/environment','jayson/promise','client','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x210cd8,_0x12799e){var _0x1af9e4=function(_0x15c56b){while(--_0x15c56b){_0x210cd8['push'](_0x210cd8['shift']());}};_0x1af9e4(++_0x12799e);}(_0x5c3c,0x132));var _0xc5c3=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x5c3c[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1d')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1e')]||null:null,'limit':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1f')]||null:null})[_0xc5c3('0xd')](function(_0x67445){logger[_0xc5c3('0x15')]('UpdateVoiceRecording',_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x67445));_0x28bae6(_0x67445);})['catch'](function(_0x5c7329){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x5c7329[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x5c7329['message']));});});};exports[_0xc5c3('0x20')]=function(_0x22f607){var _0x20c506=this;return new Promise(function(_0x29791c,_0x5caf85){var _0x21efd6=require('../../components/encryptor');var _0x2eacec;return db['Setting'][_0xc5c3('0x21')]({'attributes':['id',_0xc5c3('0x22')],'where':{'id':0x1},'raw':!![]})[_0xc5c3('0xd')](function(_0x4773c5){_0x2eacec=_0x4773c5;return db[_0xc5c3('0x18')][_0xc5c3('0x23')](_0x22f607[_0xc5c3('0x1a')]);})['then'](function(_0xbcafd6){if(_0x2eacec['callRecordingEncryption']&&fs[_0xc5c3('0x24')](_0xbcafd6[_0xc5c3('0x25')])){var _0x5b26e9=util['format'](_0xc5c3('0x26'),_0xbcafd6[_0xc5c3('0x25')]);return _0x21efd6[_0xc5c3('0x27')](_0xbcafd6[_0xc5c3('0x25')],_0x5b26e9,config['secrets'][_0xc5c3('0x28')])[_0xc5c3('0xd')](function(){fs[_0xc5c3('0x29')](_0xbcafd6[_0xc5c3('0x25')]);logger[_0xc5c3('0x15')](_0xc5c3('0x2a'));return _0xbcafd6;});}return _0xbcafd6;})[_0xc5c3('0xd')](function(_0x1e6749){logger[_0xc5c3('0x15')]('CreateVoiceRecording',_0x22f607);logger[_0xc5c3('0x2b')](_0xc5c3('0x20'),_0x22f607,JSON[_0xc5c3('0x11')](_0x1e6749));_0x29791c(_0x1e6749);})[_0xc5c3('0x2c')](function(_0x330391){logger[_0xc5c3('0x12')](_0xc5c3('0x20'),_0x330391['message'],_0x22f607);_0x5caf85(_0x20c506['error'](0x1f4,_0x330391[_0xc5c3('0x14')]));});});}; \ No newline at end of file +var _0x8f4c=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0x237569,_0x2f25f3){var _0x412473=function(_0x5d9985){while(--_0x5d9985){_0x237569['push'](_0x237569['shift']());}};_0x412473(++_0x2f25f3);}(_0x8f4c,0x113));var _0xc8f4=function(_0xf7dfd8,_0x2c1ef0){_0xf7dfd8=_0xf7dfd8-0x0;var _0x4b3099=_0x8f4c[_0xf7dfd8];return _0x4b3099;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108076[_0xc8f4('0x1b')]?_0x108076['options'][_0xc8f4('0x1d')]||null:null,'attributes':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1e')]||null:null,'limit':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x5e62aa){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON['stringify'](_0x5e62aa));_0x4763c1(_0x5e62aa);})[_0xc8f4('0x16')](function(_0x4a44e0){logger[_0xc8f4('0x11')]('UpdateVoiceRecording',_0x4a44e0[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0x4a44e0['message']));});});};exports[_0xc8f4('0x20')]=function(_0x21062f){var _0x11f766=this;return new Promise(function(_0x2fa052,_0x4ce586){var _0x3db490=require(_0xc8f4('0x21'));var _0x5db666;return db[_0xc8f4('0x22')][_0xc8f4('0x23')]({'attributes':['id',_0xc8f4('0x24')],'where':{'id':0x1},'raw':!![]})[_0xc8f4('0xb')](function(_0x24bef0){_0x5db666=_0x24bef0;return db[_0xc8f4('0x18')]['create'](_0x21062f[_0xc8f4('0x1a')]);})[_0xc8f4('0xb')](function(_0x1ea3d9){if(_0x5db666['callRecordingEncryption']&&fs[_0xc8f4('0x25')](_0x1ea3d9[_0xc8f4('0x26')])){var _0x5ab6cb=util['format']('%s.cypher',_0x1ea3d9[_0xc8f4('0x26')]);return _0x3db490[_0xc8f4('0x27')](_0x1ea3d9[_0xc8f4('0x26')],_0x5ab6cb,config[_0xc8f4('0x28')][_0xc8f4('0x29')])[_0xc8f4('0xb')](function(){fs[_0xc8f4('0x2a')](_0x1ea3d9[_0xc8f4('0x26')]);logger['info'](_0xc8f4('0x2b'));return _0x1ea3d9;});}return _0x1ea3d9;})[_0xc8f4('0xb')](function(_0x3910f3){logger['info'](_0xc8f4('0x20'),_0x21062f);logger[_0xc8f4('0xe')]('CreateVoiceRecording',_0x21062f,JSON[_0xc8f4('0x10')](_0x3910f3));_0x2fa052(_0x3910f3);})[_0xc8f4('0x16')](function(_0x36f24f){logger['error'](_0xc8f4('0x20'),_0x36f24f[_0xc8f4('0x13')],_0x21062f);_0x4ce586(_0x11f766[_0xc8f4('0x11')](0x1f4,_0x36f24f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a32d7e4..aec5767 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 _0xefbf=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x493b70,_0x168e73){var _0x4c2355=function(_0x1e0247){while(--_0x1e0247){_0x493b70['push'](_0x493b70['shift']());}};_0x4c2355(++_0x168e73);}(_0xefbf,0x93));var _0xfefb=function(_0x59fe3a,_0x26123c){_0x59fe3a=_0x59fe3a-0x0;var _0xe89c3e=_0xefbf[_0x59fe3a];return _0xe89c3e;};'use strict';var multer=require(_0xfefb('0x0'));var util=require(_0xfefb('0x1'));var path=require(_0xfefb('0x2'));var timeout=require('connect-timeout');var express=require(_0xfefb('0x3'));var router=express[_0xfefb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfefb('0x5'));var interaction=require(_0xfefb('0x6'));var config=require(_0xfefb('0x7'));var controller=require(_0xfefb('0x8'));router[_0xfefb('0x9')]('/',auth[_0xfefb('0xa')](),controller[_0xfefb('0xb')]);router['get'](_0xfefb('0xc'),auth[_0xfefb('0xa')](),controller[_0xfefb('0xd')]);router['get'](_0xfefb('0xe'),auth[_0xfefb('0xa')](),controller[_0xfefb('0xf')]);router[_0xfefb('0x10')]('/',auth[_0xfefb('0xa')](),controller[_0xfefb('0x11')]);router[_0xfefb('0x12')](_0xfefb('0xe'),auth[_0xfefb('0xa')](),controller[_0xfefb('0x13')]);router[_0xfefb('0x14')](_0xfefb('0xe'),auth[_0xfefb('0xa')](),controller[_0xfefb('0x15')]);module[_0xfefb('0x16')]=router; \ No newline at end of file +var _0xa182=['/:id','post','create','put','delete','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','index','get','isAuthenticated','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa182,0xa7));var _0x2a18=function(_0x23d9b8,_0x523a35){_0x23d9b8=_0x23d9b8-0x0;var _0x28782e=_0xa182[_0x23d9b8];return _0x28782e;};'use strict';var multer=require(_0x2a18('0x0'));var util=require('util');var path=require(_0x2a18('0x1'));var timeout=require('connect-timeout');var express=require(_0x2a18('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2a18('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2a18('0x4'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2a18('0x5')]);router[_0x2a18('0x6')]('/describe',auth[_0x2a18('0x7')](),controller[_0x2a18('0x8')]);router['get'](_0x2a18('0x9'),auth[_0x2a18('0x7')](),controller['show']);router[_0x2a18('0xa')]('/',auth[_0x2a18('0x7')](),controller[_0x2a18('0xb')]);router[_0x2a18('0xc')](_0x2a18('0x9'),auth[_0x2a18('0x7')](),controller['update']);router[_0x2a18('0xd')](_0x2a18('0x9'),auth[_0x2a18('0x7')](),controller[_0x2a18('0xe')]);module[_0x2a18('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 100d2f0..75ebf0a 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 _0x2e71=['ENUM','attended','STRING','Yes','sequelize','moment'];(function(_0x374e84,_0x1260ed){var _0x162826=function(_0x2f68e2){while(--_0x2f68e2){_0x374e84['push'](_0x374e84['shift']());}};_0x162826(++_0x1260ed);}(_0x2e71,0x18a));var _0x12e7=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x2e71[_0x173f10];return _0x53142d;};'use strict';var Sequelize=require(_0x12e7('0x0'));var moment=require(_0x12e7('0x1'));module['exports']={'type':{'type':Sequelize[_0x12e7('0x2')]('blind',_0x12e7('0x3'))},'result':{'type':Sequelize[_0x12e7('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x12e7('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x12e7('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x12e7('0x4')]},'transferercontext':{'type':Sequelize[_0x12e7('0x4')]},'transfererexten':{'type':Sequelize[_0x12e7('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x12e7('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x12e7('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x12e7('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x12e7('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x12e7('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x12e7('0x4')]},'transfereecontext':{'type':Sequelize[_0x12e7('0x4')]},'transfereeexten':{'type':Sequelize[_0x12e7('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x12e7('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x12e7('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x12e7('0x4')]}}; \ No newline at end of file +var _0x1473=['exports','ENUM','blind','attended','STRING','moment'];(function(_0xaf9497,_0x1c2483){var _0x4a426e=function(_0x188922){while(--_0x188922){_0xaf9497['push'](_0xaf9497['shift']());}};_0x4a426e(++_0x1c2483);}(_0x1473,0x125));var _0x3147=function(_0x471ba4,_0x3d3014){_0x471ba4=_0x471ba4-0x0;var _0x1cecf0=_0x1473[_0x471ba4];return _0x1cecf0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3147('0x0'));module[_0x3147('0x1')]={'type':{'type':Sequelize[_0x3147('0x2')](_0x3147('0x3'),_0x3147('0x4'))},'result':{'type':Sequelize[_0x3147('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x3147('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3147('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x3147('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x3147('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x3147('0x5')]},'transfereechannel':{'type':Sequelize[_0x3147('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x3147('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x3147('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3147('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3147('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x3147('0x5')]},'transfereecontext':{'type':Sequelize[_0x3147('0x5')]},'transfereeexten':{'type':Sequelize[_0x3147('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x3147('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x3147('0x5')]},'extension':{'type':Sequelize[_0x3147('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9e3936c..289374b 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 _0x2314=['../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','error','name','send','map','VoiceTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x1e4c55,_0x1415eb){var _0x511ab5=function(_0x2958cb){while(--_0x2958cb){_0x1e4c55['push'](_0x1e4c55['shift']());}};_0x511ab5(++_0x1415eb);}(_0x2314,0x7d));var _0x4231=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0x2314[_0x4d08b8];return _0x70214a;};'use strict';var emlformat=require(_0x4231('0x0'));var rimraf=require(_0x4231('0x1'));var zipdir=require(_0x4231('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4231('0x3'));var moment=require('moment');var BPromise=require(_0x4231('0x4'));var Mustache=require(_0x4231('0x5'));var util=require('util');var path=require(_0x4231('0x6'));var sox=require(_0x4231('0x7'));var csv=require(_0x4231('0x8'));var ejs=require(_0x4231('0x9'));var fs=require('fs');var fs_extra=require(_0x4231('0xa'));var _=require(_0x4231('0xb'));var squel=require(_0x4231('0xc'));var crypto=require(_0x4231('0xd'));var jsforce=require(_0x4231('0xe'));var deskjs=require(_0x4231('0xf'));var toCsv=require(_0x4231('0x8'));var querystring=require(_0x4231('0x10'));var Papa=require(_0x4231('0x11'));var Redis=require(_0x4231('0x12'));var authService=require(_0x4231('0x13'));var qs=require(_0x4231('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4231('0x15'));var logger=require('../../config/logger')(_0x4231('0x16'));var utils=require(_0x4231('0x17'));var config=require(_0x4231('0x18'));var licenseUtil=require(_0x4231('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bbe9a,_0x30a3c1){_0x30a3c1=_0x30a3c1||0xcc;return function(_0x49a9f0){if(_0x49a9f0){return _0x4bbe9a[_0x4231('0x1a')](_0x30a3c1);}return _0x4bbe9a['status'](_0x30a3c1)[_0x4231('0x1b')]();};}function respondWithResult(_0x3c258e,_0x59fab7){_0x59fab7=_0x59fab7||0xc8;return function(_0x3e895e){if(_0x3e895e){return _0x3c258e['status'](_0x59fab7)[_0x4231('0x1c')](_0x3e895e);}};}function respondWithFilteredResult(_0x339d87,_0x4a4ff0){return function(_0x33fb52){if(_0x33fb52){var _0x3ded5f=typeof _0x4a4ff0[_0x4231('0x1d')]===_0x4231('0x1e')&&typeof _0x4a4ff0[_0x4231('0x1f')]===_0x4231('0x1e');var _0x367969=_0x33fb52[_0x4231('0x20')];var _0xbaf48d=_0x3ded5f?0x0:_0x4a4ff0[_0x4231('0x1d')];var _0x168b39=_0x3ded5f?_0x33fb52[_0x4231('0x20')]:_0x4a4ff0[_0x4231('0x1d')]+_0x4a4ff0[_0x4231('0x1f')];var _0x52c88f;if(_0x168b39>=_0x367969){_0x168b39=_0x367969;_0x52c88f=0xc8;}else{_0x52c88f=0xce;}_0x339d87[_0x4231('0x21')](_0x52c88f);return _0x339d87[_0x4231('0x22')]('Content-Range',_0xbaf48d+'-'+_0x168b39+'/'+_0x367969)[_0x4231('0x1c')](_0x33fb52);}return null;};}function patchUpdates(_0x150805){return function(_0x382bab){try{jsonpatch[_0x4231('0x23')](_0x382bab,_0x150805,!![]);}catch(_0x449701){return BPromise[_0x4231('0x24')](_0x449701);}return _0x382bab['save']();};}function saveUpdates(_0x2eae45,_0x467dcf){return function(_0x5e951b){if(_0x5e951b){return _0x5e951b[_0x4231('0x25')](_0x2eae45)[_0x4231('0x26')](function(_0x34adb5){return _0x34adb5;});}return null;};}function removeEntity(_0x2bd52f,_0x1facc9){return function(_0x5da119){if(_0x5da119){return _0x5da119[_0x4231('0x27')]()[_0x4231('0x26')](function(){_0x2bd52f[_0x4231('0x21')](0xcc)[_0x4231('0x1b')]();});}};}function handleEntityNotFound(_0x36aa4f,_0x5aaf93){return function(_0x27946d){if(!_0x27946d){_0x36aa4f['sendStatus'](0x194);}return _0x27946d;};}function handleError(_0x44c3a3,_0x347dff){_0x347dff=_0x347dff||0x1f4;return function(_0x5e2306){logger[_0x4231('0x28')](_0x5e2306['stack']);if(_0x5e2306[_0x4231('0x29')]){delete _0x5e2306[_0x4231('0x29')];}_0x44c3a3[_0x4231('0x21')](_0x347dff)[_0x4231('0x2a')](_0x5e2306);};}exports['index']=function(_0x567563,_0x4d0ef5){var _0x40644a={},_0x10a632={},_0x16e2cd={'count':0x0,'rows':[]};var _0x5d6f49=_[_0x4231('0x2b')](db[_0x4231('0x2c')][_0x4231('0x2d')],function(_0x25427a){return{'name':_0x25427a['fieldName'],'type':_0x25427a[_0x4231('0x2e')]['key']};});_0x10a632[_0x4231('0x2f')]=_[_0x4231('0x2b')](_0x5d6f49,_0x4231('0x29'));_0x10a632[_0x4231('0x30')]=_[_0x4231('0x31')](_0x567563[_0x4231('0x30')]);_0x10a632['filters']=_[_0x4231('0x32')](_0x10a632['model'],_0x10a632[_0x4231('0x30')]);_0x40644a[_0x4231('0x33')]=_[_0x4231('0x32')](_0x10a632[_0x4231('0x2f')],qs[_0x4231('0x34')](_0x567563[_0x4231('0x30')][_0x4231('0x34')]));_0x40644a['attributes']=_0x40644a[_0x4231('0x33')]['length']?_0x40644a[_0x4231('0x33')]:_0x10a632[_0x4231('0x2f')];if(!_0x567563[_0x4231('0x30')][_0x4231('0x35')]('nolimit')){_0x40644a[_0x4231('0x1f')]=qs['limit'](_0x567563['query']['limit']);_0x40644a[_0x4231('0x1d')]=qs[_0x4231('0x1d')](_0x567563[_0x4231('0x30')]['offset']);}_0x40644a[_0x4231('0x36')]=qs[_0x4231('0x37')](_0x567563[_0x4231('0x30')][_0x4231('0x37')]);_0x40644a[_0x4231('0x38')]=qs[_0x4231('0x39')](_[_0x4231('0x3a')](_0x567563['query'],_0x10a632['filters']),_0x5d6f49);if(_0x567563[_0x4231('0x30')][_0x4231('0x3b')]){_0x40644a['where']=_[_0x4231('0x3c')](_0x40644a[_0x4231('0x38')],{'$or':_[_0x4231('0x2b')](_0x5d6f49,function(_0x43aba4){if(_0x43aba4[_0x4231('0x2e')]!==_0x4231('0x3d')){var _0x55a280={};_0x55a280[_0x43aba4[_0x4231('0x29')]]={'$like':'%'+_0x567563[_0x4231('0x30')]['filter']+'%'};return _0x55a280;}})});}_0x40644a=_[_0x4231('0x3c')]({},_0x40644a,_0x567563[_0x4231('0x3e')]);var _0x59cac4={'where':_0x40644a[_0x4231('0x38')]};return db[_0x4231('0x2c')][_0x4231('0x20')](_0x59cac4)[_0x4231('0x26')](function(_0x8dc618){_0x16e2cd['count']=_0x8dc618;if(_0x567563['query'][_0x4231('0x3f')]){_0x40644a[_0x4231('0x40')]=[{'all':!![]}];}return db[_0x4231('0x2c')][_0x4231('0x41')](_0x40644a);})[_0x4231('0x26')](function(_0x5d616c){_0x16e2cd[_0x4231('0x42')]=_0x5d616c;return _0x16e2cd;})[_0x4231('0x26')](respondWithFilteredResult(_0x4d0ef5,_0x40644a))[_0x4231('0x43')](handleError(_0x4d0ef5,null));};exports[_0x4231('0x44')]=function(_0xe40914,_0x4cb2fb){var _0xc9ab34={'raw':!![],'where':{'id':_0xe40914['params']['id']}},_0x21add7={};_0x21add7['model']=_[_0x4231('0x31')](db['VoiceTransferReport']['rawAttributes']);_0x21add7[_0x4231('0x30')]=_[_0x4231('0x31')](_0xe40914[_0x4231('0x30')]);_0x21add7['filters']=_[_0x4231('0x32')](_0x21add7[_0x4231('0x2f')],_0x21add7[_0x4231('0x30')]);_0xc9ab34[_0x4231('0x33')]=_[_0x4231('0x32')](_0x21add7[_0x4231('0x2f')],qs[_0x4231('0x34')](_0xe40914[_0x4231('0x30')]['fields']));_0xc9ab34[_0x4231('0x33')]=_0xc9ab34[_0x4231('0x33')][_0x4231('0x45')]?_0xc9ab34[_0x4231('0x33')]:_0x21add7['model'];if(_0xe40914['query'][_0x4231('0x3f')]){_0xc9ab34[_0x4231('0x40')]=[{'all':!![]}];}_0xc9ab34=_[_0x4231('0x3c')]({},_0xc9ab34,_0xe40914[_0x4231('0x3e')]);return db[_0x4231('0x2c')]['find'](_0xc9ab34)[_0x4231('0x26')](handleEntityNotFound(_0x4cb2fb,null))[_0x4231('0x26')](respondWithResult(_0x4cb2fb,null))[_0x4231('0x43')](handleError(_0x4cb2fb,null));};exports[_0x4231('0x46')]=function(_0x3ee4b3,_0x47d75d){return db[_0x4231('0x2c')][_0x4231('0x46')](_0x3ee4b3[_0x4231('0x47')],{})[_0x4231('0x26')](respondWithResult(_0x47d75d,0xc9))[_0x4231('0x43')](handleError(_0x47d75d,null));};exports[_0x4231('0x25')]=function(_0x8234b1,_0xaea746){if(_0x8234b1[_0x4231('0x47')]['id']){delete _0x8234b1[_0x4231('0x47')]['id'];}return db[_0x4231('0x2c')][_0x4231('0x48')]({'where':{'id':_0x8234b1['params']['id']}})[_0x4231('0x26')](handleEntityNotFound(_0xaea746,null))[_0x4231('0x26')](saveUpdates(_0x8234b1[_0x4231('0x47')],null))[_0x4231('0x26')](respondWithResult(_0xaea746,null))['catch'](handleError(_0xaea746,null));};exports[_0x4231('0x27')]=function(_0x4b1ca1,_0x24ddb5){return db[_0x4231('0x2c')][_0x4231('0x48')]({'where':{'id':_0x4b1ca1[_0x4231('0x49')]['id']}})[_0x4231('0x26')](handleEntityNotFound(_0x24ddb5,null))['then'](removeEntity(_0x24ddb5,null))[_0x4231('0x43')](handleError(_0x24ddb5,null));};exports[_0x4231('0x4a')]=function(_0x56bf7b,_0x5aef93){return db[_0x4231('0x2c')]['describe']()['then'](respondWithResult(_0x5aef93,null))[_0x4231('0x43')](handleError(_0x5aef93,null));}; \ No newline at end of file +var _0xb45a=['querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x239912,_0x400626){var _0x1557a7=function(_0xb75452){while(--_0xb75452){_0x239912['push'](_0x239912['shift']());}};_0x1557a7(++_0x400626);}(_0xb45a,0x8c));var _0xab45=function(_0x5d3276,_0xd38063){_0x5d3276=_0x5d3276-0x0;var _0x3562f5=_0xb45a[_0x5d3276];return _0x3562f5;};'use strict';var emlformat=require(_0xab45('0x0'));var rimraf=require(_0xab45('0x1'));var zipdir=require(_0xab45('0x2'));var jsonpatch=require(_0xab45('0x3'));var rp=require(_0xab45('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab45('0x5'));var util=require(_0xab45('0x6'));var path=require(_0xab45('0x7'));var sox=require(_0xab45('0x8'));var csv=require(_0xab45('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab45('0xa'));var _=require(_0xab45('0xb'));var squel=require(_0xab45('0xc'));var crypto=require(_0xab45('0xd'));var jsforce=require(_0xab45('0xe'));var deskjs=require(_0xab45('0xf'));var toCsv=require(_0xab45('0x9'));var querystring=require(_0xab45('0x10'));var Papa=require(_0xab45('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab45('0x12'));var hardwareService=require(_0xab45('0x13'));var logger=require(_0xab45('0x14'))(_0xab45('0x15'));var utils=require(_0xab45('0x16'));var config=require(_0xab45('0x17'));var licenseUtil=require(_0xab45('0x18'));var db=require(_0xab45('0x19'))['db'];function respondWithStatusCode(_0x1ce4e4,_0x366ad8){_0x366ad8=_0x366ad8||0xcc;return function(_0x432c55){if(_0x432c55){return _0x1ce4e4['sendStatus'](_0x366ad8);}return _0x1ce4e4['status'](_0x366ad8)[_0xab45('0x1a')]();};}function respondWithResult(_0x379f35,_0x20249d){_0x20249d=_0x20249d||0xc8;return function(_0xa9626d){if(_0xa9626d){return _0x379f35[_0xab45('0x1b')](_0x20249d)[_0xab45('0x1c')](_0xa9626d);}};}function respondWithFilteredResult(_0x1f0844,_0xbad0de){return function(_0x1b4dc8){if(_0x1b4dc8){var _0x2e95e5=typeof _0xbad0de[_0xab45('0x1d')]==='undefined'&&typeof _0xbad0de[_0xab45('0x1e')]===_0xab45('0x1f');var _0x45eee6=_0x1b4dc8[_0xab45('0x20')];var _0x22bfa6=_0x2e95e5?0x0:_0xbad0de[_0xab45('0x1d')];var _0x46a946=_0x2e95e5?_0x1b4dc8[_0xab45('0x20')]:_0xbad0de[_0xab45('0x1d')]+_0xbad0de[_0xab45('0x1e')];var _0x4eefb8;if(_0x46a946>=_0x45eee6){_0x46a946=_0x45eee6;_0x4eefb8=0xc8;}else{_0x4eefb8=0xce;}_0x1f0844[_0xab45('0x1b')](_0x4eefb8);return _0x1f0844[_0xab45('0x21')](_0xab45('0x22'),_0x22bfa6+'-'+_0x46a946+'/'+_0x45eee6)['json'](_0x1b4dc8);}return null;};}function patchUpdates(_0x52e64b){return function(_0x52eb63){try{jsonpatch[_0xab45('0x23')](_0x52eb63,_0x52e64b,!![]);}catch(_0x1d6148){return BPromise[_0xab45('0x24')](_0x1d6148);}return _0x52eb63[_0xab45('0x25')]();};}function saveUpdates(_0x5261d6,_0x1443a0){return function(_0x556bb9){if(_0x556bb9){return _0x556bb9[_0xab45('0x26')](_0x5261d6)[_0xab45('0x27')](function(_0x415ba4){return _0x415ba4;});}return null;};}function removeEntity(_0x59fd1e,_0x5f373c){return function(_0x3c7f31){if(_0x3c7f31){return _0x3c7f31[_0xab45('0x28')]()[_0xab45('0x27')](function(){_0x59fd1e['status'](0xcc)[_0xab45('0x1a')]();});}};}function handleEntityNotFound(_0x5ee66d,_0x41faad){return function(_0x4e82a9){if(!_0x4e82a9){_0x5ee66d[_0xab45('0x29')](0x194);}return _0x4e82a9;};}function handleError(_0x3b57dc,_0xefdff6){_0xefdff6=_0xefdff6||0x1f4;return function(_0x26f54b){logger['error'](_0x26f54b[_0xab45('0x2a')]);if(_0x26f54b['name']){delete _0x26f54b[_0xab45('0x2b')];}_0x3b57dc[_0xab45('0x1b')](_0xefdff6)[_0xab45('0x2c')](_0x26f54b);};}exports[_0xab45('0x2d')]=function(_0x5b21f9,_0x2fe2f2){var _0x489179={},_0x140f73={},_0x258762={'count':0x0,'rows':[]};var _0x123bad=_['map'](db[_0xab45('0x2e')][_0xab45('0x2f')],function(_0xe965cd){return{'name':_0xe965cd[_0xab45('0x30')],'type':_0xe965cd[_0xab45('0x31')][_0xab45('0x32')]};});_0x140f73[_0xab45('0x33')]=_['map'](_0x123bad,_0xab45('0x2b'));_0x140f73[_0xab45('0x34')]=_[_0xab45('0x35')](_0x5b21f9['query']);_0x140f73[_0xab45('0x36')]=_['intersection'](_0x140f73[_0xab45('0x33')],_0x140f73[_0xab45('0x34')]);_0x489179['attributes']=_[_0xab45('0x37')](_0x140f73[_0xab45('0x33')],qs[_0xab45('0x38')](_0x5b21f9[_0xab45('0x34')][_0xab45('0x38')]));_0x489179['attributes']=_0x489179[_0xab45('0x39')]['length']?_0x489179['attributes']:_0x140f73['model'];if(!_0x5b21f9[_0xab45('0x34')][_0xab45('0x3a')](_0xab45('0x3b'))){_0x489179[_0xab45('0x1e')]=qs[_0xab45('0x1e')](_0x5b21f9['query'][_0xab45('0x1e')]);_0x489179['offset']=qs[_0xab45('0x1d')](_0x5b21f9[_0xab45('0x34')][_0xab45('0x1d')]);}_0x489179[_0xab45('0x3c')]=qs[_0xab45('0x3d')](_0x5b21f9[_0xab45('0x34')][_0xab45('0x3d')]);_0x489179[_0xab45('0x3e')]=qs[_0xab45('0x36')](_['pick'](_0x5b21f9[_0xab45('0x34')],_0x140f73[_0xab45('0x36')]),_0x123bad);if(_0x5b21f9[_0xab45('0x34')][_0xab45('0x3f')]){_0x489179[_0xab45('0x3e')]=_['merge'](_0x489179['where'],{'$or':_['map'](_0x123bad,function(_0x58db08){if(_0x58db08['type']!==_0xab45('0x40')){var _0x5d3061={};_0x5d3061[_0x58db08[_0xab45('0x2b')]]={'$like':'%'+_0x5b21f9[_0xab45('0x34')][_0xab45('0x3f')]+'%'};return _0x5d3061;}})});}_0x489179=_[_0xab45('0x41')]({},_0x489179,_0x5b21f9['options']);var _0x4b46e1={'where':_0x489179[_0xab45('0x3e')]};return db['VoiceTransferReport'][_0xab45('0x20')](_0x4b46e1)[_0xab45('0x27')](function(_0x4eea14){_0x258762[_0xab45('0x20')]=_0x4eea14;if(_0x5b21f9['query'][_0xab45('0x42')]){_0x489179[_0xab45('0x43')]=[{'all':!![]}];}return db[_0xab45('0x2e')][_0xab45('0x44')](_0x489179);})['then'](function(_0x109a53){_0x258762[_0xab45('0x45')]=_0x109a53;return _0x258762;})['then'](respondWithFilteredResult(_0x2fe2f2,_0x489179))[_0xab45('0x46')](handleError(_0x2fe2f2,null));};exports[_0xab45('0x47')]=function(_0x352e9a,_0xf71507){var _0x270f4b={'raw':!![],'where':{'id':_0x352e9a[_0xab45('0x48')]['id']}},_0x40cdb8={};_0x40cdb8['model']=_[_0xab45('0x35')](db[_0xab45('0x2e')][_0xab45('0x2f')]);_0x40cdb8[_0xab45('0x34')]=_[_0xab45('0x35')](_0x352e9a['query']);_0x40cdb8[_0xab45('0x36')]=_[_0xab45('0x37')](_0x40cdb8[_0xab45('0x33')],_0x40cdb8[_0xab45('0x34')]);_0x270f4b[_0xab45('0x39')]=_['intersection'](_0x40cdb8[_0xab45('0x33')],qs[_0xab45('0x38')](_0x352e9a['query'][_0xab45('0x38')]));_0x270f4b[_0xab45('0x39')]=_0x270f4b[_0xab45('0x39')][_0xab45('0x49')]?_0x270f4b[_0xab45('0x39')]:_0x40cdb8[_0xab45('0x33')];if(_0x352e9a[_0xab45('0x34')][_0xab45('0x42')]){_0x270f4b[_0xab45('0x43')]=[{'all':!![]}];}_0x270f4b=_[_0xab45('0x41')]({},_0x270f4b,_0x352e9a[_0xab45('0x4a')]);return db['VoiceTransferReport'][_0xab45('0x4b')](_0x270f4b)[_0xab45('0x27')](handleEntityNotFound(_0xf71507,null))[_0xab45('0x27')](respondWithResult(_0xf71507,null))['catch'](handleError(_0xf71507,null));};exports['create']=function(_0x31915d,_0x5731f4){return db[_0xab45('0x2e')]['create'](_0x31915d[_0xab45('0x4c')],{})[_0xab45('0x27')](respondWithResult(_0x5731f4,0xc9))['catch'](handleError(_0x5731f4,null));};exports[_0xab45('0x26')]=function(_0x234c96,_0x3b9bdd){if(_0x234c96['body']['id']){delete _0x234c96[_0xab45('0x4c')]['id'];}return db[_0xab45('0x2e')]['find']({'where':{'id':_0x234c96[_0xab45('0x48')]['id']}})[_0xab45('0x27')](handleEntityNotFound(_0x3b9bdd,null))[_0xab45('0x27')](saveUpdates(_0x234c96[_0xab45('0x4c')],null))[_0xab45('0x27')](respondWithResult(_0x3b9bdd,null))[_0xab45('0x46')](handleError(_0x3b9bdd,null));};exports['destroy']=function(_0x11f7f2,_0x4316ca){return db['VoiceTransferReport'][_0xab45('0x4b')]({'where':{'id':_0x11f7f2[_0xab45('0x48')]['id']}})[_0xab45('0x27')](handleEntityNotFound(_0x4316ca,null))[_0xab45('0x27')](removeEntity(_0x4316ca,null))[_0xab45('0x46')](handleError(_0x4316ca,null));};exports[_0xab45('0x4d')]=function(_0x378e11,_0x4a847b){return db[_0xab45('0x2e')]['describe']()['then'](respondWithResult(_0x4a847b,null))['catch'](handleError(_0x4a847b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 79567f1..d8cb2df 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 _0x44ef=['moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api'];(function(_0x8044,_0x155838){var _0x57f882=function(_0x12c1ff){while(--_0x12c1ff){_0x8044['push'](_0x8044['shift']());}};_0x57f882(++_0x155838);}(_0x44ef,0x88));var _0xf44e=function(_0x2f78ee,_0x3e6339){_0x2f78ee=_0x2f78ee-0x0;var _0x30448f=_0x44ef[_0x2f78ee];return _0x30448f;};'use strict';var _=require(_0xf44e('0x0'));var util=require(_0xf44e('0x1'));var logger=require(_0xf44e('0x2'))(_0xf44e('0x3'));var moment=require(_0xf44e('0x4'));var BPromise=require(_0xf44e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf44e('0x6'));var rimraf=require(_0xf44e('0x7'));var config=require(_0xf44e('0x8'));var attributes=require(_0xf44e('0x9'));module[_0xf44e('0xa')]=function(_0x392679,_0x5f1409){return _0x392679[_0xf44e('0xb')](_0xf44e('0xc'),attributes,{'tableName':_0xf44e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e45=['rimraf','exports','define','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4151c1,_0x2f055b){var _0x160704=function(_0x39a41b){while(--_0x39a41b){_0x4151c1['push'](_0x4151c1['shift']());}};_0x160704(++_0x2f055b);}(_0x0e45,0x10c));var _0x50e4=function(_0x473ab6,_0x281afd){_0x473ab6=_0x473ab6-0x0;var _0x2ab805=_0x0e45[_0x473ab6];return _0x2ab805;};'use strict';var _=require(_0x50e4('0x0'));var util=require(_0x50e4('0x1'));var logger=require(_0x50e4('0x2'))(_0x50e4('0x3'));var moment=require(_0x50e4('0x4'));var BPromise=require(_0x50e4('0x5'));var rp=require(_0x50e4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x50e4('0x7'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x50e4('0x8')]=function(_0x51cf47,_0x57cda5){return _0x51cf47[_0x50e4('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x50e4('0xa'),'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 b4a0820..b65d4b0 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 _0xda0b=['then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceTransferReport','body','options','raw'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xda0b,0x18b));var _0xbda0=function(_0x419498,_0x42abeb){_0x419498=_0x419498-0x0;var _0x31eda5=_0xda0b[_0x419498];return _0x31eda5;};'use strict';var _=require(_0xbda0('0x0'));var util=require(_0xbda0('0x1'));var moment=require(_0xbda0('0x2'));var BPromise=require(_0xbda0('0x3'));var rs=require(_0xbda0('0x4'));var fs=require('fs');var Redis=require(_0xbda0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbda0('0x6'));var logger=require(_0xbda0('0x7'))(_0xbda0('0x8'));var config=require(_0xbda0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbda0('0xa')][_0xbda0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc90982,_0x11c1af,_0x3dfe56){return new BPromise(function(_0x2d0c02,_0x3861c0){return client[_0xbda0('0xc')](_0xc90982,_0x3dfe56)['then'](function(_0x7756fb){logger[_0xbda0('0xd')](_0xbda0('0xe'),_0x11c1af,_0xbda0('0xf'));logger['debug'](_0xbda0('0x10'),_0x11c1af,_0xbda0('0xf'),JSON[_0xbda0('0x11')](_0x7756fb));if(_0x7756fb[_0xbda0('0x12')]){if(_0x7756fb['error']['code']===0x1f4){logger['error'](_0xbda0('0xe'),_0x11c1af,_0x7756fb['error'][_0xbda0('0x13')]);return _0x3861c0(_0x7756fb['error'][_0xbda0('0x13')]);}logger[_0xbda0('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x11c1af,_0x7756fb['error'][_0xbda0('0x13')]);return _0x2d0c02(_0x7756fb['error']['message']);}else{logger[_0xbda0('0xd')](_0xbda0('0xe'),_0x11c1af,_0xbda0('0xf'));_0x2d0c02(_0x7756fb[_0xbda0('0x14')][_0xbda0('0x13')]);}})['catch'](function(_0x3ee8a4){logger['error'](_0xbda0('0xe'),_0x11c1af,_0x3ee8a4);_0x3861c0(_0x3ee8a4);});});}exports[_0xbda0('0x15')]=function(_0x5d6019){var _0xc43633=this;return new Promise(function(_0x26d8ed,_0x5ec6ec){return db['VoiceTransferReport']['create'](_0x5d6019[_0xbda0('0x16')],{'raw':_0x5d6019[_0xbda0('0x17')]?_0x5d6019['options'][_0xbda0('0x18')]===undefined?!![]:![]:!![]})[_0xbda0('0x19')](function(_0x280239){logger[_0xbda0('0xd')](_0xbda0('0x15'),_0x5d6019);logger[_0xbda0('0x1a')]('CreateVoiceTransferReport',_0x5d6019,JSON[_0xbda0('0x11')](_0x280239));_0x26d8ed(_0x280239);})[_0xbda0('0x1b')](function(_0x1f2aa8){logger[_0xbda0('0x12')](_0xbda0('0x15'),_0x1f2aa8[_0xbda0('0x13')],_0x5d6019);_0x5ec6ec(_0xc43633['error'](0x1f4,_0x1f2aa8['message']));});});}; \ No newline at end of file +var _0xa91b=['catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x5c3146,_0x13eef6){var _0x53e263=function(_0x3c63b2){while(--_0x3c63b2){_0x5c3146['push'](_0x5c3146['shift']());}};_0x53e263(++_0x13eef6);}(_0xa91b,0x165));var _0xba91=function(_0x161316,_0x2acc1e){_0x161316=_0x161316-0x0;var _0x33be5b=_0xa91b[_0x161316];return _0x33be5b;};'use strict';var _=require(_0xba91('0x0'));var util=require(_0xba91('0x1'));var moment=require(_0xba91('0x2'));var BPromise=require(_0xba91('0x3'));var rs=require(_0xba91('0x4'));var fs=require('fs');var Redis=require(_0xba91('0x5'));var db=require(_0xba91('0x6'))['db'];var utils=require(_0xba91('0x7'));var logger=require('../../config/logger')(_0xba91('0x8'));var config=require(_0xba91('0x9'));var jayson=require(_0xba91('0xa'));var client=jayson[_0xba91('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x384a3f,_0x710d58,_0x2c1b49){return new BPromise(function(_0x174da5,_0x1d1a6f){return client[_0xba91('0xc')](_0x384a3f,_0x2c1b49)[_0xba91('0xd')](function(_0x2fe1fe){logger[_0xba91('0xe')](_0xba91('0xf'),_0x710d58,'request\x20sent');logger['debug'](_0xba91('0x10'),_0x710d58,_0xba91('0x11'),JSON[_0xba91('0x12')](_0x2fe1fe));if(_0x2fe1fe[_0xba91('0x13')]){if(_0x2fe1fe[_0xba91('0x13')]['code']===0x1f4){logger[_0xba91('0x13')](_0xba91('0xf'),_0x710d58,_0x2fe1fe['error'][_0xba91('0x14')]);return _0x1d1a6f(_0x2fe1fe[_0xba91('0x13')]['message']);}logger[_0xba91('0x13')](_0xba91('0xf'),_0x710d58,_0x2fe1fe[_0xba91('0x13')][_0xba91('0x14')]);return _0x174da5(_0x2fe1fe[_0xba91('0x13')][_0xba91('0x14')]);}else{logger['info'](_0xba91('0xf'),_0x710d58,_0xba91('0x11'));_0x174da5(_0x2fe1fe['result'][_0xba91('0x14')]);}})[_0xba91('0x15')](function(_0x31eba9){logger[_0xba91('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x710d58,_0x31eba9);_0x1d1a6f(_0x31eba9);});});}exports[_0xba91('0x16')]=function(_0x3d2b3e){var _0x16af06=this;return new Promise(function(_0x44d7f7,_0x4536b2){return db[_0xba91('0x17')]['create'](_0x3d2b3e[_0xba91('0x18')],{'raw':_0x3d2b3e[_0xba91('0x19')]?_0x3d2b3e[_0xba91('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xba91('0xd')](function(_0x2a09c2){logger[_0xba91('0xe')](_0xba91('0x16'),_0x3d2b3e);logger[_0xba91('0x1a')](_0xba91('0x16'),_0x3d2b3e,JSON[_0xba91('0x12')](_0x2a09c2));_0x44d7f7(_0x2a09c2);})[_0xba91('0x15')](function(_0x4a4493){logger['error'](_0xba91('0x16'),_0x4a4493['message'],_0x3d2b3e);_0x4536b2(_0x16af06[_0xba91('0x13')](0x1f4,_0x4a4493[_0xba91('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 015a4ec..3ab71a4 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 _0x008c=['/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','/calls','calls'];(function(_0xa74764,_0x1e499c){var _0x3e4e57=function(_0x1db54e){while(--_0x1db54e){_0xa74764['push'](_0xa74764['shift']());}};_0x3e4e57(++_0x1e499c);}(_0x008c,0x188));var _0xc008=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x008c[_0x581960];return _0x4ee892;};'use strict';var express=require(_0xc008('0x0'));var router=express[_0xc008('0x1')]();var auth=require(_0xc008('0x2'));var controller=require(_0xc008('0x3'));router[_0xc008('0x4')]('/originate',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0x7')]);router[_0xc008('0x4')](_0xc008('0x8'),auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0x9')]);router[_0xc008('0x4')]('/answer',auth[_0xc008('0x5')](),auth['isWebrtcLicence'](),controller[_0xc008('0xa')]);router['post']('/hold',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller['hold']);router['post']('/unhold',auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller['unhold']);router[_0xc008('0x4')](_0xc008('0xb'),auth[_0xc008('0x5')](),auth[_0xc008('0x6')](),controller[_0xc008('0xc')]);router[_0xc008('0x4')](_0xc008('0xd'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0x37914d,_0x4209c0){var _0x2b4118=function(_0x10de2){while(--_0x10de2){_0x37914d['push'](_0x37914d['shift']());}};_0x2b4118(++_0x4209c0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5b32b6,_0x36f987){_0x5b32b6=_0x5b32b6-0x0;var _0x2ce6cd=_0x9bde[_0x5b32b6];return _0x2ce6cd;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 9d21d9c..69ae490 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 _0xb18e=['webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','../../mysqldb','util','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','status','send','request','then','error','code','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','validate','format'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0xb18e,0x181));var _0xeb18=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0xb18e[_0x48cb1f];return _0x172c4d;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xeb18('0x0'))['db'];var config=require('../../config/environment');var util=require(_0xeb18('0x1'));var BPromise=require('bluebird');var jayson=require(_0xeb18('0x2'));var amiClient=jayson[_0xeb18('0x3')]['http']({'port':0x232a});var logger=require(_0xeb18('0x4'))(_0xeb18('0x5'));var Redis=require(_0xeb18('0x6'));config[_0xeb18('0x7')]=_[_0xeb18('0x8')](config[_0xeb18('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xeb18('0x9'))(new Redis(config[_0xeb18('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xeb18('0xa'),'required':[!![],_0xeb18('0xb')]},'callNumber':{'type':_0xeb18('0xc'),'required':[!![],_0xeb18('0xd')]},'callerId':{'type':_0xeb18('0xc')},'callbackUrl':{'type':_0xeb18('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0xeb18('0xa'),'required':[!![],_0xeb18('0xb')]},'sessionId':{'type':_0xeb18('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xeb18('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xeb18('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xeb18('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xeb18('0xc'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0xeb18('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0xeb18('0xa'),'required':[!![],_0xeb18('0xb')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xeb18('0xb')]},'sessionId':{'type':_0xeb18('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xeb18('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0xeb18('0xa'),'required':[!![],_0xeb18('0xb')]}});function emit(_0x4b1e93,_0x314156,_0x1235b0){logger[_0xeb18('0xf')](_0x4b1e93,_0x314156,JSON[_0xeb18('0x10')](_0x1235b0));io['to'](_0x4b1e93)[_0xeb18('0x11')](_0x314156,_0x1235b0);}function handleError(_0x285400){return function(_0x284733){console['log'](_0xeb18('0x12'),_0x284733,_0x284733 instanceof RangeError);logger['error'](_0x284733[_0xeb18('0x13')]);if(_0x284733 instanceof RangeError){if(_0x284733[_0xeb18('0x14')]){delete _0x284733[_0xeb18('0x14')];}_0x285400[_0xeb18('0x15')](0x194)[_0xeb18('0x16')](_0x284733);}else{if(_0x284733['name']){delete _0x284733[_0xeb18('0x14')];}_0x285400[_0xeb18('0x15')](0x1f4)[_0xeb18('0x16')](_0x284733);}};}function checkError(){return function(_0x3ab7e5){if(!_0x3ab7e5){throw new RangeError('NotFound');}return _0x3ab7e5;};}function respondWithRpcPromise(_0x327dba,_0x279c99){return new BPromise(function(_0x22c7e4,_0x862fe3){var _0xaa824b=amiClient;return _0xaa824b[_0xeb18('0x17')](_0x327dba,_0x279c99)[_0xeb18('0x18')](function(_0x38f57a){if(_0x38f57a[_0xeb18('0x19')]){if(_0x38f57a[_0xeb18('0x19')][_0xeb18('0x1a')]===0x1f4){return _0x862fe3(_0x38f57a[_0xeb18('0x19')]['message']);}return _0x22c7e4(_0x38f57a[_0xeb18('0x19')]['message']);}else{_0x22c7e4(_0x38f57a['result']);}})[_0xeb18('0x1b')](function(_0x42ae48){_0x862fe3(_0x42ae48);});});}function getAgent(_0x3e1b84){return db[_0xeb18('0x1c')][_0xeb18('0x1d')]({'where':{'id':_0x3e1b84,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x693669,_0x8dc2a4){return new BPromise(function(_0x3312d8,_0x4c2270){var _0xde2775=respondWithRpcPromise(_0xeb18('0x1e'));var _0x5d2f33=getAgent(_0x693669);Promise[_0xeb18('0x1f')]([_0xde2775,_0x5d2f33])['then'](function(_0x54e62b){var _0x50c72f=_0x54e62b[0x0];var _0x4883e2=_0x54e62b[0x1];var _0x5120f6=_[_0xeb18('0x20')](_0x50c72f[_0xeb18('0x21')],function(_0x27455b){return _0x27455b[_0xeb18('0x22')]==_0x4883e2['id']&&_0x27455b[_0xeb18('0x23')]==_0x8dc2a4;});if(_0x5120f6[_0xeb18('0x24')]==0x1){_0x3312d8(_0x4883e2);}else{_0x4c2270(new RangeError('sessionId\x20'+_0x8dc2a4+_0xeb18('0x25')));}});});}exports[_0xeb18('0x26')]=function(_0xd3611f,_0x1445ba){logger[_0xeb18('0xf')](_0xeb18('0x27'),_0xd3611f[_0xeb18('0x28')]);var _0x26a368=originateValidation['validate'](_0xd3611f[_0xeb18('0x28')]);if(_0x26a368[_0xeb18('0x24')]>0x0){return _0x1445ba[_0xeb18('0x15')](0x190)[_0xeb18('0x29')](_0x26a368);}var _0x199d50=_0xd3611f[_0xeb18('0x28')][_0xeb18('0x2a')];var _0x599df7=_0xd3611f[_0xeb18('0x28')]['callNumber'];var _0x8f5471=_0xd3611f[_0xeb18('0x28')][_0xeb18('0x2b')];var _0x11d482=_0xd3611f['body'][_0xeb18('0x2c')];return getAgent(_0x199d50)[_0xeb18('0x18')](function(_0x44e381){logger[_0xeb18('0xf')](_0xeb18('0x2d'),_0x44e381[_0xeb18('0x14')]);emit(util['format'](_0xeb18('0x2e'),_0x44e381[_0xeb18('0x14')]),_0xeb18('0x2f'),{'callNumber':_0x599df7,'callerId':_0x8f5471,'callbackUrl':_0x11d482});return _0x1445ba[_0xeb18('0x15')](0xc8)[_0xeb18('0x29')]({'error':![],'message':_0xeb18('0x30')});})[_0xeb18('0x1b')](handleError(_0x1445ba));};exports[_0xeb18('0x31')]=function(_0x1b8b8d,_0x188950){logger[_0xeb18('0xf')](_0xeb18('0x32'),_0x1b8b8d['body']);var _0x386297=hangupValidation[_0xeb18('0x33')](_0x1b8b8d[_0xeb18('0x28')]);if(_0x386297[_0xeb18('0x24')]>0x0){return _0x188950[_0xeb18('0x15')](0x190)['json'](_0x386297);}var _0x33bbda=_0x1b8b8d[_0xeb18('0x28')][_0xeb18('0x2a')];var _0x40c626=_0x1b8b8d[_0xeb18('0x28')]['sessionId'];return getAgent(_0x33bbda)[_0xeb18('0x18')](function(_0x54d291){logger[_0xeb18('0xf')](_0xeb18('0x2d'),_0x54d291[_0xeb18('0x14')]);emit(util[_0xeb18('0x34')](_0xeb18('0x2e'),_0x54d291['name']),_0xeb18('0x35'),{'sessionId':_0x40c626});return _0x188950[_0xeb18('0x15')](0xc8)[_0xeb18('0x29')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x188950));};exports[_0xeb18('0x36')]=function(_0x291f35,_0x3fce34){logger[_0xeb18('0xf')](_0xeb18('0x37'),_0x291f35['body']);var _0x5189d3=answerValidation['validate'](_0x291f35[_0xeb18('0x28')]);if(_0x5189d3[_0xeb18('0x24')]>0x0){return _0x3fce34[_0xeb18('0x15')](0x190)['json'](_0x5189d3);}var _0x30a4b0=_0x291f35[_0xeb18('0x28')][_0xeb18('0x2a')];var _0x26d293=_0x291f35[_0xeb18('0x28')][_0xeb18('0x23')];return getAgent(_0x30a4b0)[_0xeb18('0x18')](function(_0x4ae2d5){logger[_0xeb18('0xf')](_0xeb18('0x2d'),_0x4ae2d5[_0xeb18('0x14')]);emit(util[_0xeb18('0x34')](_0xeb18('0x2e'),_0x4ae2d5[_0xeb18('0x14')]),_0xeb18('0x38'),{'sessionId':_0x26d293});return _0x3fce34['status'](0xc8)[_0xeb18('0x29')]({'error':![],'message':_0xeb18('0x39')});})[_0xeb18('0x1b')](handleError(_0x3fce34));};exports[_0xeb18('0x3a')]=function(_0x2d5a1f,_0x2fe4aa){logger[_0xeb18('0xf')](_0xeb18('0x3b'),_0x2d5a1f[_0xeb18('0x28')]);var _0x31ff0b=holdValidation[_0xeb18('0x33')](_0x2d5a1f['body']);if(_0x31ff0b['length']>0x0){return _0x2fe4aa[_0xeb18('0x15')](0x190)[_0xeb18('0x29')](_0x31ff0b);}var _0x4893e0=_0x2d5a1f[_0xeb18('0x28')]['userId'];var _0x12be15=_0x2d5a1f['body'][_0xeb18('0x23')];return getAgent(_0x4893e0)[_0xeb18('0x18')](function(_0x4b4fb4){logger[_0xeb18('0xf')](_0xeb18('0x2d'),_0x4b4fb4[_0xeb18('0x14')]);emit(util[_0xeb18('0x34')](_0xeb18('0x2e'),_0x4b4fb4[_0xeb18('0x14')]),_0xeb18('0x3c'),{'sessionId':_0x12be15});return _0x2fe4aa[_0xeb18('0x15')](0xc8)['json']({'error':![],'message':_0xeb18('0x3d')});})[_0xeb18('0x1b')](handleError(_0x2fe4aa));};exports['unhold']=function(_0x2fbcc7,_0x444dbb){logger[_0xeb18('0xf')]('unhold\x20fired:',_0x2fbcc7[_0xeb18('0x28')]);var _0x52673d=unholdValidation[_0xeb18('0x33')](_0x2fbcc7[_0xeb18('0x28')]);if(_0x52673d['length']>0x0){return _0x444dbb[_0xeb18('0x15')](0x190)[_0xeb18('0x29')](_0x52673d);}var _0x450152=_0x2fbcc7[_0xeb18('0x28')][_0xeb18('0x2a')];var _0x4a3233=_0x2fbcc7['body'][_0xeb18('0x23')];return getAgent(_0x450152)[_0xeb18('0x18')](function(_0x5c41a6){logger[_0xeb18('0xf')]('entityFound:',_0x5c41a6[_0xeb18('0x14')]);emit(util['format'](_0xeb18('0x2e'),_0x5c41a6[_0xeb18('0x14')]),_0xeb18('0x3e'),{'sessionId':_0x4a3233});return _0x444dbb[_0xeb18('0x15')](0xc8)[_0xeb18('0x29')]({'error':![],'message':_0xeb18('0x3f')});})[_0xeb18('0x1b')](handleError(_0x444dbb));};exports[_0xeb18('0x40')]=function(_0x1211ed,_0xdec9a4){logger['info'](_0xeb18('0x41'),_0xdec9a4[_0xeb18('0x28')]);var _0x2fa7c4=callsValidation['validate'](_0x1211ed['body']);if(_0x2fa7c4[_0xeb18('0x24')]>0x0){return _0xdec9a4['status'](0x190)['json'](_0x2fa7c4);}var _0x32ee3a=_0x1211ed[_0xeb18('0x28')]['userId'];var _0x4482a8=respondWithRpcPromise('VoiceChannels');var _0x394edc=getAgent(_0x32ee3a);return Promise[_0xeb18('0x1f')]([_0x4482a8,_0x394edc])[_0xeb18('0x18')](function(_0x4c9ce7){var _0x462f30=_0x4c9ce7[0x0];var _0x550400=_0x4c9ce7[0x1];var _0x24c427=_['filter'](_0x462f30[_0xeb18('0x21')],function(_0x71ee78){return _0x71ee78['UserId']==_0x550400['id'];});return _0xdec9a4[_0xeb18('0x15')](0xc8)['json']({'count':_0x24c427[_0xeb18('0x24')],'rows':_0x24c427});})[_0xeb18('0x1b')](handleError(_0xdec9a4));};exports[_0xeb18('0x42')]=function(_0x423468,_0x469f0f){logger[_0xeb18('0xf')]('conference\x20fired:',_0x423468['body']);var _0x12056d=conferenceValidation['validate'](_0x423468[_0xeb18('0x28')]);if(_0x12056d[_0xeb18('0x24')]>0x0){return _0x469f0f[_0xeb18('0x15')](0x190)[_0xeb18('0x29')](_0x12056d);}var _0x46507b=_0x423468[_0xeb18('0x28')][_0xeb18('0x2a')];return getAgent(_0x46507b)[_0xeb18('0x18')](function(_0x541cc9){logger['info']('entityFound:',_0x541cc9[_0xeb18('0x14')]);emit(util[_0xeb18('0x34')](_0xeb18('0x2e'),_0x541cc9[_0xeb18('0x14')]),_0xeb18('0x43'));return _0x469f0f['status'](0xc8)[_0xeb18('0x29')]({'error':![],'message':_0xeb18('0x44')});})[_0xeb18('0x1b')](handleError(_0x469f0f));};exports['transfer']=function(_0x50bf85,_0x260734){logger['info'](_0xeb18('0x45'),_0x50bf85[_0xeb18('0x28')]);var _0x28c4a8=transferValidation[_0xeb18('0x33')](_0x50bf85['body']);if(_0x28c4a8['length']>0x0){return _0x260734['status'](0x190)[_0xeb18('0x29')](_0x28c4a8);}var _0x3f4778=_0x50bf85['body']['userId'];var _0x2940fc=_0x50bf85['body'][_0xeb18('0x23')];var _0x27b482=_0x50bf85['body'][_0xeb18('0x46')];return getAgent(_0x3f4778)[_0xeb18('0x18')](function(_0x4b783b){logger[_0xeb18('0xf')](_0xeb18('0x2d'),_0x4b783b[_0xeb18('0x14')]);emit(util[_0xeb18('0x34')](_0xeb18('0x2e'),_0x4b783b[_0xeb18('0x14')]),_0xeb18('0x47'),{'sessionId':_0x2940fc,'transferNumber':_0x27b482});return _0x260734[_0xeb18('0x15')](0xc8)[_0xeb18('0x29')]({'error':![],'message':_0xeb18('0x48')});})[_0xeb18('0x1b')](handleError(_0x260734));}; \ No newline at end of file +var _0x54ef=['callerId','format','user:%s','webbar:originate','originate\x20executed!','hangup','validate','userId','entityFound:','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','defaults','redis','localhost','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','callNumber'];(function(_0x2bac93,_0x4897f9){var _0x3435ab=function(_0x1f9559){while(--_0x1f9559){_0x2bac93['push'](_0x2bac93['shift']());}};_0x3435ab(++_0x4897f9);}(_0x54ef,0x112));var _0xf54e=function(_0x20dc1a,_0x56f347){_0x20dc1a=_0x20dc1a-0x0;var _0x4ffbc0=_0x54ef[_0x20dc1a];return _0x4ffbc0;};'use strict';var path=require(_0xf54e('0x0'));var fs=require('fs');var _=require(_0xf54e('0x1'));var db=require(_0xf54e('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var jayson=require(_0xf54e('0x5'));var amiClient=jayson[_0xf54e('0x6')][_0xf54e('0x7')]({'port':0x232a});var logger=require(_0xf54e('0x8'))(_0xf54e('0x9'));var Redis=require('ioredis');config['redis']=_[_0xf54e('0xa')](config[_0xf54e('0xb')],{'host':_0xf54e('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'callNumber':{'type':'string','required':[!![],_0xf54e('0xf')]},'callerId':{'type':_0xf54e('0x10')},'callbackUrl':{'type':_0xf54e('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf54e('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'sessionId':{'type':_0xf54e('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf54e('0xe')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xf54e('0x10'),'required':[!![],_0xf54e('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'sessionId':{'type':_0xf54e('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]}});function emit(_0x3eb415,_0x5c5d00,_0x4af633){logger[_0xf54e('0x12')](_0x3eb415,_0x5c5d00,JSON[_0xf54e('0x13')](_0x4af633));io['to'](_0x3eb415)[_0xf54e('0x14')](_0x5c5d00,_0x4af633);}function handleError(_0x9647f){return function(_0x15cc48){console[_0xf54e('0x15')](_0xf54e('0x16'),_0x15cc48,_0x15cc48 instanceof RangeError);logger[_0xf54e('0x17')](_0x15cc48[_0xf54e('0x18')]);if(_0x15cc48 instanceof RangeError){if(_0x15cc48[_0xf54e('0x19')]){delete _0x15cc48[_0xf54e('0x19')];}_0x9647f['status'](0x194)['send'](_0x15cc48);}else{if(_0x15cc48[_0xf54e('0x19')]){delete _0x15cc48['name'];}_0x9647f[_0xf54e('0x1a')](0x1f4)[_0xf54e('0x1b')](_0x15cc48);}};}function checkError(){return function(_0x106362){if(!_0x106362){throw new RangeError(_0xf54e('0x1c'));}return _0x106362;};}function respondWithRpcPromise(_0xf64f12,_0x3887b0){return new BPromise(function(_0x388aa0,_0x11985e){var _0x3c0169=amiClient;return _0x3c0169[_0xf54e('0x1d')](_0xf64f12,_0x3887b0)[_0xf54e('0x1e')](function(_0x5b83df){if(_0x5b83df[_0xf54e('0x17')]){if(_0x5b83df['error'][_0xf54e('0x1f')]===0x1f4){return _0x11985e(_0x5b83df[_0xf54e('0x17')][_0xf54e('0x20')]);}return _0x388aa0(_0x5b83df[_0xf54e('0x17')][_0xf54e('0x20')]);}else{_0x388aa0(_0x5b83df[_0xf54e('0x21')]);}})[_0xf54e('0x22')](function(_0x43488d){_0x11985e(_0x43488d);});});}function getAgent(_0x2342a9){return db[_0xf54e('0x23')][_0xf54e('0x24')]({'where':{'id':_0x2342a9,'role':_0xf54e('0x25')}})[_0xf54e('0x1e')](checkError());}function getAgentCheckSession(_0x5390b8,_0xb3706e){return new BPromise(function(_0x4cbf7c,_0x282c63){var _0x5e63f4=respondWithRpcPromise(_0xf54e('0x26'));var _0x269f47=getAgent(_0x5390b8);Promise[_0xf54e('0x27')]([_0x5e63f4,_0x269f47])[_0xf54e('0x1e')](function(_0x25b643){var _0x3993e4=_0x25b643[0x0];var _0x36f985=_0x25b643[0x1];var _0x54bd8f=_['filter'](_0x3993e4[_0xf54e('0x28')],function(_0x258d29){return _0x258d29[_0xf54e('0x29')]==_0x36f985['id']&&_0x258d29[_0xf54e('0x2a')]==_0xb3706e;});if(_0x54bd8f[_0xf54e('0x2b')]==0x1){_0x4cbf7c(_0x36f985);}else{_0x282c63(new RangeError(_0xf54e('0x2c')+_0xb3706e+_0xf54e('0x2d')));}});});}exports[_0xf54e('0x2e')]=function(_0x3ae704,_0x12edc3){logger['info']('originate\x20fired:',_0x3ae704[_0xf54e('0x2f')]);var _0x3169dd=originateValidation['validate'](_0x3ae704[_0xf54e('0x2f')]);if(_0x3169dd[_0xf54e('0x2b')]>0x0){return _0x12edc3[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x3169dd);}var _0x576b46=_0x3ae704['body']['userId'];var _0x3c0cca=_0x3ae704[_0xf54e('0x2f')][_0xf54e('0x31')];var _0x399e68=_0x3ae704[_0xf54e('0x2f')][_0xf54e('0x32')];var _0x49ba1c=_0x3ae704['body']['callbackUrl'];return getAgent(_0x576b46)[_0xf54e('0x1e')](function(_0x734187){logger['info']('entityFound:',_0x734187[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x734187['name']),_0xf54e('0x35'),{'callNumber':_0x3c0cca,'callerId':_0x399e68,'callbackUrl':_0x49ba1c});return _0x12edc3[_0xf54e('0x1a')](0xc8)['json']({'error':![],'message':_0xf54e('0x36')});})[_0xf54e('0x22')](handleError(_0x12edc3));};exports[_0xf54e('0x37')]=function(_0x1eeeb4,_0x12ef97){logger[_0xf54e('0x12')]('hangup\x20fired:',_0x1eeeb4['body']);var _0x3d5a68=hangupValidation[_0xf54e('0x38')](_0x1eeeb4[_0xf54e('0x2f')]);if(_0x3d5a68['length']>0x0){return _0x12ef97[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x3d5a68);}var _0x448054=_0x1eeeb4[_0xf54e('0x2f')][_0xf54e('0x39')];var _0x23f297=_0x1eeeb4[_0xf54e('0x2f')][_0xf54e('0x2a')];return getAgent(_0x448054)[_0xf54e('0x1e')](function(_0x2087b3){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x2087b3[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x2087b3['name']),'webbar:hangup',{'sessionId':_0x23f297});return _0x12ef97['status'](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x3b')});})['catch'](handleError(_0x12ef97));};exports[_0xf54e('0x3c')]=function(_0x311ce1,_0x381c03){logger['info'](_0xf54e('0x3d'),_0x311ce1[_0xf54e('0x2f')]);var _0x1e016e=answerValidation[_0xf54e('0x38')](_0x311ce1[_0xf54e('0x2f')]);if(_0x1e016e[_0xf54e('0x2b')]>0x0){return _0x381c03[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x1e016e);}var _0x5b4ea1=_0x311ce1['body'][_0xf54e('0x39')];var _0x3447fd=_0x311ce1[_0xf54e('0x2f')][_0xf54e('0x2a')];return getAgent(_0x5b4ea1)[_0xf54e('0x1e')](function(_0x2fce4f){logger['info'](_0xf54e('0x3a'),_0x2fce4f['name']);emit(util[_0xf54e('0x33')]('user:%s',_0x2fce4f[_0xf54e('0x19')]),_0xf54e('0x3e'),{'sessionId':_0x3447fd});return _0x381c03[_0xf54e('0x1a')](0xc8)['json']({'error':![],'message':_0xf54e('0x3f')});})[_0xf54e('0x22')](handleError(_0x381c03));};exports[_0xf54e('0x40')]=function(_0x32fb46,_0x3a5a87){logger['info'](_0xf54e('0x41'),_0x32fb46[_0xf54e('0x2f')]);var _0x346bb4=holdValidation[_0xf54e('0x38')](_0x32fb46['body']);if(_0x346bb4[_0xf54e('0x2b')]>0x0){return _0x3a5a87[_0xf54e('0x1a')](0x190)['json'](_0x346bb4);}var _0x22c842=_0x32fb46[_0xf54e('0x2f')][_0xf54e('0x39')];var _0xca0141=_0x32fb46['body'][_0xf54e('0x2a')];return getAgent(_0x22c842)[_0xf54e('0x1e')](function(_0x2527f6){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x2527f6[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x2527f6[_0xf54e('0x19')]),_0xf54e('0x42'),{'sessionId':_0xca0141});return _0x3a5a87[_0xf54e('0x1a')](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x43')});})[_0xf54e('0x22')](handleError(_0x3a5a87));};exports[_0xf54e('0x44')]=function(_0xa6c305,_0x40d8ab){logger[_0xf54e('0x12')](_0xf54e('0x45'),_0xa6c305[_0xf54e('0x2f')]);var _0x4e25e4=unholdValidation['validate'](_0xa6c305[_0xf54e('0x2f')]);if(_0x4e25e4[_0xf54e('0x2b')]>0x0){return _0x40d8ab[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x4e25e4);}var _0xba297c=_0xa6c305[_0xf54e('0x2f')][_0xf54e('0x39')];var _0x149d0b=_0xa6c305[_0xf54e('0x2f')][_0xf54e('0x2a')];return getAgent(_0xba297c)[_0xf54e('0x1e')](function(_0x59c313){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x59c313[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x59c313[_0xf54e('0x19')]),_0xf54e('0x46'),{'sessionId':_0x149d0b});return _0x40d8ab['status'](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x47')});})[_0xf54e('0x22')](handleError(_0x40d8ab));};exports['calls']=function(_0x3ce832,_0x54ac1a){logger[_0xf54e('0x12')](_0xf54e('0x48'),_0x54ac1a[_0xf54e('0x2f')]);var _0x5b882f=callsValidation[_0xf54e('0x38')](_0x3ce832[_0xf54e('0x2f')]);if(_0x5b882f[_0xf54e('0x2b')]>0x0){return _0x54ac1a[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x5b882f);}var _0x2ec72a=_0x3ce832[_0xf54e('0x2f')]['userId'];var _0x55de5c=respondWithRpcPromise(_0xf54e('0x26'));var _0x9ab4c4=getAgent(_0x2ec72a);return Promise['all']([_0x55de5c,_0x9ab4c4])[_0xf54e('0x1e')](function(_0x49fd97){var _0xf39552=_0x49fd97[0x0];var _0x528a64=_0x49fd97[0x1];var _0x324167=_[_0xf54e('0x49')](_0xf39552[_0xf54e('0x28')],function(_0x241198){return _0x241198[_0xf54e('0x29')]==_0x528a64['id'];});return _0x54ac1a[_0xf54e('0x1a')](0xc8)['json']({'count':_0x324167['length'],'rows':_0x324167});})[_0xf54e('0x22')](handleError(_0x54ac1a));};exports[_0xf54e('0x4a')]=function(_0x493011,_0x57a48e){logger[_0xf54e('0x12')]('conference\x20fired:',_0x493011[_0xf54e('0x2f')]);var _0x43f9bf=conferenceValidation[_0xf54e('0x38')](_0x493011[_0xf54e('0x2f')]);if(_0x43f9bf[_0xf54e('0x2b')]>0x0){return _0x57a48e[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x43f9bf);}var _0x3d706a=_0x493011[_0xf54e('0x2f')][_0xf54e('0x39')];return getAgent(_0x3d706a)[_0xf54e('0x1e')](function(_0x2c6d0e){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x2c6d0e['name']);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x2c6d0e[_0xf54e('0x19')]),_0xf54e('0x4b'));return _0x57a48e[_0xf54e('0x1a')](0xc8)['json']({'error':![],'message':_0xf54e('0x4c')});})[_0xf54e('0x22')](handleError(_0x57a48e));};exports['transfer']=function(_0x51ec35,_0x2818cf){logger['info'](_0xf54e('0x4d'),_0x51ec35[_0xf54e('0x2f')]);var _0x105cf4=transferValidation[_0xf54e('0x38')](_0x51ec35['body']);if(_0x105cf4[_0xf54e('0x2b')]>0x0){return _0x2818cf['status'](0x190)[_0xf54e('0x30')](_0x105cf4);}var _0x3759d4=_0x51ec35[_0xf54e('0x2f')]['userId'];var _0x2d04db=_0x51ec35['body'][_0xf54e('0x2a')];var _0x3e2101=_0x51ec35['body'][_0xf54e('0x4e')];return getAgent(_0x3759d4)['then'](function(_0x3aa7e5){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x3aa7e5[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')]('user:%s',_0x3aa7e5[_0xf54e('0x19')]),_0xf54e('0x4f'),{'sessionId':_0x2d04db,'transferNumber':_0x3e2101});return _0x2818cf['status'](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x50')});})['catch'](handleError(_0x2818cf));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2a629b7..e30a368 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 _0x430c=['Router','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','multer','connect-timeout','express'];(function(_0x1341a6,_0x23816a){var _0x37658e=function(_0xbe0a4d){while(--_0xbe0a4d){_0x1341a6['push'](_0x1341a6['shift']());}};_0x37658e(++_0x23816a);}(_0x430c,0x1a1));var _0xc430=function(_0x2891d1,_0x2ddd3e){_0x2891d1=_0x2891d1-0x0;var _0x486948=_0x430c[_0x2891d1];return _0x486948;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('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(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['getAnswers']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0x5')](_0xc430('0xf'),auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc430('0x11')](_0xc430('0xc'),auth[_0xc430('0x8')](),controller[_0xc430('0x12')]);router[_0xc430('0x11')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['addAnswer']);router['post'](_0xc430('0x13'),auth[_0xc430('0x8')](),controller[_0xc430('0x14')]);router['post']('/:id/applications',auth[_0xc430('0x8')](),controller['addApplications']);router[_0xc430('0x11')]('/:id/notify',controller['notify']);router[_0xc430('0x11')]('/:id/send',auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router[_0xc430('0x16')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller['update']);router[_0xc430('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc430('0x18')]);router[_0xc430('0x17')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0x19')]);router['delete'](_0xc430('0x1a'),auth[_0xc430('0x8')](),controller['removeAnswers']);router[_0xc430('0x17')](_0xc430('0x13'),auth['isAuthenticated'](),controller[_0xc430('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x430c=['Router','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','multer','connect-timeout','express'];(function(_0x1d246a,_0x49be62){var _0x4f233b=function(_0x43ca54){while(--_0x43ca54){_0x1d246a['push'](_0x1d246a['shift']());}};_0x4f233b(++_0x49be62);}(_0x430c,0x1a1));var _0xc430=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0x430c[_0x2e819c];return _0x24e271;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('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(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['getAnswers']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0x5')](_0xc430('0xf'),auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc430('0x11')](_0xc430('0xc'),auth[_0xc430('0x8')](),controller[_0xc430('0x12')]);router[_0xc430('0x11')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['addAnswer']);router['post'](_0xc430('0x13'),auth[_0xc430('0x8')](),controller[_0xc430('0x14')]);router['post']('/:id/applications',auth[_0xc430('0x8')](),controller['addApplications']);router[_0xc430('0x11')]('/:id/notify',controller['notify']);router[_0xc430('0x11')]('/:id/send',auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router[_0xc430('0x16')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller['update']);router[_0xc430('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc430('0x18')]);router[_0xc430('0x17')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0x19')]);router['delete'](_0xc430('0x1a'),auth[_0xc430('0x8')](),controller['removeAnswers']);router[_0xc430('0x17')](_0xc430('0x13'),auth['isAuthenticated'](),controller[_0xc430('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b48ae18..38e51b4 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 _0x484e=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x3c942d,_0x417d7f){var _0x17a1d3=function(_0x1419bf){while(--_0x1419bf){_0x3c942d['push'](_0x3c942d['shift']());}};_0x17a1d3(++_0x417d7f);}(_0x484e,0x13b));var _0xe484=function(_0x4db5e3,_0x3cea3e){_0x4db5e3=_0x4db5e3-0x0;var _0x465846=_0x484e[_0x4db5e3];return _0x465846;};'use strict';var Sequelize=require(_0xe484('0x0'));var rs=require(_0xe484('0x1'));module[_0xe484('0x2')]={'name':{'type':Sequelize[_0xe484('0x3')],'unique':_0xe484('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xe484('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe484('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe484('0x3')],'defaultValue':function(){return rs[_0xe484('0x5')]();}},'phone':{'type':Sequelize[_0xe484('0x3')]},'type':{'type':Sequelize[_0xe484('0x6')](_0xe484('0x7'),_0xe484('0x8'))},'accountSid':{'type':Sequelize[_0xe484('0x3')]},'baseUrl':{'type':Sequelize[_0xe484('0x3')]},'authToken':{'type':Sequelize[_0xe484('0x3')]},'notificationTemplate':{'type':Sequelize[_0xe484('0x9')],'defaultValue':function(){return _0xe484('0xa');}},'notificationSound':{'type':Sequelize[_0xe484('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe484('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe484('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe484('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe484('0xc')],'comment':_0xe484('0xd')},'mandatoryDisposition':{'type':Sequelize[_0xe484('0xb')],'defaultValue':![],'comment':_0xe484('0xe'),'set':function(_0x4adff){if(!_0x4adff){this[_0xe484('0xf')]('mandatoryDispositionPauseId',null);}this[_0xe484('0xf')](_0xe484('0x10'),_0x4adff);}},'description':{'type':Sequelize[_0xe484('0x3')]}}; \ No newline at end of file +var _0x8351=['STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x8351,0x18f));var _0x1835=function(_0xce4fa,_0x300615){_0xce4fa=_0xce4fa-0x0;var _0x1e1b0a=_0x8351[_0xce4fa];return _0x1e1b0a;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1835('0x0')]={'name':{'type':Sequelize[_0x1835('0x1')],'unique':_0x1835('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x1835('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x1835('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1835('0x3')]();}},'phone':{'type':Sequelize[_0x1835('0x1')]},'type':{'type':Sequelize[_0x1835('0x4')](_0x1835('0x5'),_0x1835('0x6'))},'accountSid':{'type':Sequelize[_0x1835('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x1835('0x7')],'defaultValue':function(){return _0x1835('0x8');}},'notificationSound':{'type':Sequelize[_0x1835('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1835('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1835('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1835('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1835('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1835('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x1835('0x9')],'defaultValue':![],'comment':_0x1835('0xc'),'set':function(_0x2421ed){if(!_0x2421ed){this[_0x1835('0xd')](_0x1835('0xe'),null);}this[_0x1835('0xd')](_0x1835('0xf'),_0x2421ed);}},'description':{'type':Sequelize[_0x1835('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 23765b6..f239878 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 _0xd684=['zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','destroy','get','UserProfileResource','end','stack','name','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','include','findAll','rows','params','Pause','mandatoryDispositionPause','keys','includeAll','find','create','user','role','userProfileId','update','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','length','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','getAgents','User','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','account','sinch','statuses','WhatsappMessage','applications','orderBy','Applications','asc','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','from','From','messageId','MessageSid','notifications','from\x20is\x20mandatory','isNil','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Contacts','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','created','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','rimraf'];(function(_0x20778c,_0x9c81a0){var _0x32d193=function(_0x43ece6){while(--_0x43ece6){_0x20778c['push'](_0x20778c['shift']());}};_0x32d193(++_0x9c81a0);}(_0xd684,0xb6));var _0x4d68=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0xd684[_0x17784a];return _0x41aded;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d68('0x0'));var zipdir=require(_0x4d68('0x1'));var jsonpatch=require(_0x4d68('0x2'));var rp=require(_0x4d68('0x3'));var moment=require(_0x4d68('0x4'));var BPromise=require(_0x4d68('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d68('0x6'));var sox=require(_0x4d68('0x7'));var csv=require(_0x4d68('0x8'));var ejs=require(_0x4d68('0x9'));var fs=require('fs');var fs_extra=require(_0x4d68('0xa'));var _=require(_0x4d68('0xb'));var squel=require(_0x4d68('0xc'));var crypto=require(_0x4d68('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4d68('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4d68('0xf'));var Papa=require('papaparse');var Redis=require(_0x4d68('0x10'));var authService=require(_0x4d68('0x11'));var qs=require(_0x4d68('0x12'));var as=require(_0x4d68('0x13'));var hardwareService=require(_0x4d68('0x14'));var logger=require(_0x4d68('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d68('0x16'));var db=require(_0x4d68('0x17'))['db'];config[_0x4d68('0x18')]=_[_0x4d68('0x19')](config['redis'],{'host':_0x4d68('0x1a'),'port':0x18eb});var socket=require(_0x4d68('0x1b'))(new Redis(config[_0x4d68('0x18')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x4d68('0x1c'));var client=jayson['client'][_0x4d68('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x242491,_0x79299f,_0xcfb7d8,_0xd21bdf){return new BPromise(function(_0x2291db,_0x580e54){var _0x19b0f4=_0xd21bdf||client;return _0x19b0f4[_0x4d68('0x1e')](_0x242491,_0xcfb7d8)[_0x4d68('0x1f')](function(_0x42715b){logger[_0x4d68('0x20')](_0x4d68('0x21'),_0x79299f,_0x4d68('0x22'));logger[_0x4d68('0x23')](_0x4d68('0x24'),_0x79299f,_0x4d68('0x22'),JSON[_0x4d68('0x25')](_0x42715b));if(_0x42715b[_0x4d68('0x26')]){if(_0x42715b['error'][_0x4d68('0x27')]===0x1f4){logger['error'](_0x4d68('0x21'),_0x79299f,_0x42715b[_0x4d68('0x26')]['message']);return _0x580e54(_0x42715b[_0x4d68('0x26')][_0x4d68('0x28')]);}logger[_0x4d68('0x26')](_0x4d68('0x21'),_0x79299f,_0x42715b[_0x4d68('0x26')][_0x4d68('0x28')]);return _0x2291db(_0x42715b[_0x4d68('0x26')][_0x4d68('0x28')]);}else{logger[_0x4d68('0x20')](_0x4d68('0x21'),_0x79299f,_0x4d68('0x22'));_0x2291db(_0x42715b[_0x4d68('0x29')][_0x4d68('0x28')]);}})[_0x4d68('0x2a')](function(_0x139683){logger[_0x4d68('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x79299f,_0x139683);_0x580e54(_0x139683);});});}function respondWithStatusCode(_0x29b426,_0x420377){_0x420377=_0x420377||0xcc;return function(_0x3d9d06){if(_0x3d9d06){return _0x29b426[_0x4d68('0x2b')](_0x420377);}return _0x29b426[_0x4d68('0x2c')](_0x420377)['end']();};}function respondWithResult(_0x2b5d9e,_0xd5b5c2){_0xd5b5c2=_0xd5b5c2||0xc8;return function(_0x350d14){if(_0x350d14){return _0x2b5d9e[_0x4d68('0x2c')](_0xd5b5c2)[_0x4d68('0x2d')](_0x350d14);}};}function respondWithFilteredResult(_0x589adf,_0x26d129){return function(_0xd7b518){if(_0xd7b518){var _0x5e0429=typeof _0x26d129[_0x4d68('0x2e')]===_0x4d68('0x2f')&&typeof _0x26d129[_0x4d68('0x30')]===_0x4d68('0x2f');var _0x3632a8=_0xd7b518[_0x4d68('0x31')];var _0x556b1a=_0x5e0429?0x0:_0x26d129[_0x4d68('0x2e')];var _0x56450f=_0x5e0429?_0xd7b518[_0x4d68('0x31')]:_0x26d129['offset']+_0x26d129[_0x4d68('0x30')];var _0x1b0dd1;if(_0x56450f>=_0x3632a8){_0x56450f=_0x3632a8;_0x1b0dd1=0xc8;}else{_0x1b0dd1=0xce;}_0x589adf[_0x4d68('0x2c')](_0x1b0dd1);return _0x589adf[_0x4d68('0x32')]('Content-Range',_0x556b1a+'-'+_0x56450f+'/'+_0x3632a8)[_0x4d68('0x2d')](_0xd7b518);}return null;};}function patchUpdates(_0x4f73de){return function(_0x34fd18){try{jsonpatch['apply'](_0x34fd18,_0x4f73de,!![]);}catch(_0x2ae4e4){return BPromise[_0x4d68('0x33')](_0x2ae4e4);}return _0x34fd18[_0x4d68('0x34')]();};}function saveUpdates(_0x52f322,_0xb5058a){return function(_0x12632f){if(_0x12632f){return _0x12632f['update'](_0x52f322)['then'](function(_0x2e497b){return _0x2e497b;});}return null;};}function removeEntity(_0x712632,_0x3f1dcf){return function(_0x2f44df){if(_0x2f44df){return _0x2f44df[_0x4d68('0x35')]()[_0x4d68('0x1f')](function(){var _0x4a8147=_0x2f44df[_0x4d68('0x36')]({'plain':!![]});var _0x5b2130='WhatsappAccounts';return db[_0x4d68('0x37')]['destroy']({'where':{'type':_0x5b2130,'resourceId':_0x4a8147['id']}})[_0x4d68('0x1f')](function(){return _0x2f44df;});})['then'](function(){_0x712632[_0x4d68('0x2c')](0xcc)[_0x4d68('0x38')]();});}};}function handleEntityNotFound(_0x128825,_0x4ed456){return function(_0x7bd724){if(!_0x7bd724){_0x128825[_0x4d68('0x2b')](0x194);}return _0x7bd724;};}function handleError(_0x31df18,_0x548751){_0x548751=_0x548751||0x1f4;return function(_0x4d77c9){logger[_0x4d68('0x26')](_0x4d77c9[_0x4d68('0x39')]);if(_0x4d77c9[_0x4d68('0x3a')]){delete _0x4d77c9[_0x4d68('0x3a')];}_0x31df18[_0x4d68('0x2c')](_0x548751)['send'](_0x4d77c9);};}exports[_0x4d68('0x3b')]=function(_0x1e9959,_0x1830b3){var _0x21c5ee={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x44134f={},_0x27c45c={'count':0x0,'rows':[]};var _0x82c4f0=_[_0x4d68('0x3c')](db['WhatsappAccount'][_0x4d68('0x3d')],function(_0x1ed773){return{'name':_0x1ed773['fieldName'],'type':_0x1ed773[_0x4d68('0x3e')]['key']};});_0x44134f[_0x4d68('0x3f')]=_[_0x4d68('0x3c')](_0x82c4f0,_0x4d68('0x3a'));_0x44134f[_0x4d68('0x40')]=_['keys'](_0x1e9959[_0x4d68('0x40')]);_0x44134f[_0x4d68('0x41')]=_[_0x4d68('0x42')](_0x44134f[_0x4d68('0x3f')],_0x44134f['query']);_0x21c5ee[_0x4d68('0x43')]=_['intersection'](_0x44134f['model'],qs[_0x4d68('0x44')](_0x1e9959[_0x4d68('0x40')]['fields']));_0x21c5ee[_0x4d68('0x43')]=_0x21c5ee[_0x4d68('0x43')]['length']?_0x21c5ee[_0x4d68('0x43')]:_0x44134f[_0x4d68('0x3f')];if(!_0x1e9959['query'][_0x4d68('0x45')](_0x4d68('0x46'))){_0x21c5ee[_0x4d68('0x30')]=qs[_0x4d68('0x30')](_0x1e9959['query']['limit']);_0x21c5ee[_0x4d68('0x2e')]=qs[_0x4d68('0x2e')](_0x1e9959[_0x4d68('0x40')][_0x4d68('0x2e')]);}_0x21c5ee[_0x4d68('0x47')]=qs[_0x4d68('0x48')](_0x1e9959[_0x4d68('0x40')][_0x4d68('0x48')]);_0x21c5ee[_0x4d68('0x49')]=qs[_0x4d68('0x41')](_[_0x4d68('0x4a')](_0x1e9959[_0x4d68('0x40')],_0x44134f[_0x4d68('0x41')]),_0x82c4f0);if(_0x1e9959['query'][_0x4d68('0x4b')]){_0x21c5ee[_0x4d68('0x49')]=_[_0x4d68('0x4c')](_0x21c5ee['where'],{'$or':_['map'](_0x82c4f0,function(_0x49f3d9){if(_0x49f3d9[_0x4d68('0x3e')]!==_0x4d68('0x4d')){var _0xf04d0b={};_0xf04d0b[_0x49f3d9[_0x4d68('0x3a')]]={'$like':'%'+_0x1e9959[_0x4d68('0x40')][_0x4d68('0x4b')]+'%'};return _0xf04d0b;}})});}_0x21c5ee=_['merge']({},_0x21c5ee,_0x1e9959[_0x4d68('0x4e')]);var _0x1be874={'where':_0x21c5ee[_0x4d68('0x49')]};return db[_0x4d68('0x4f')][_0x4d68('0x31')](_0x1be874)[_0x4d68('0x1f')](function(_0x2d8890){_0x27c45c[_0x4d68('0x31')]=_0x2d8890;if(_0x1e9959[_0x4d68('0x40')]['includeAll']){_0x21c5ee[_0x4d68('0x50')]=[{'all':!![]}];}return db[_0x4d68('0x4f')][_0x4d68('0x51')](_0x21c5ee);})[_0x4d68('0x1f')](function(_0x3ea18a){_0x27c45c[_0x4d68('0x52')]=_0x3ea18a;return _0x27c45c;})[_0x4d68('0x1f')](respondWithFilteredResult(_0x1830b3,_0x21c5ee))[_0x4d68('0x2a')](handleError(_0x1830b3,null));};exports['show']=function(_0x2fc8b0,_0x5380a2){var _0x542429={'raw':![],'where':{'id':_0x2fc8b0[_0x4d68('0x53')]['id']},'include':[{'model':db[_0x4d68('0x54')],'as':_0x4d68('0x55')}]},_0x396f4f={};_0x396f4f['model']=_[_0x4d68('0x56')](db[_0x4d68('0x4f')][_0x4d68('0x3d')]);_0x396f4f[_0x4d68('0x40')]=_[_0x4d68('0x56')](_0x2fc8b0[_0x4d68('0x40')]);_0x396f4f['filters']=_[_0x4d68('0x42')](_0x396f4f[_0x4d68('0x3f')],_0x396f4f[_0x4d68('0x40')]);_0x542429[_0x4d68('0x43')]=_[_0x4d68('0x42')](_0x396f4f['model'],qs[_0x4d68('0x44')](_0x2fc8b0[_0x4d68('0x40')][_0x4d68('0x44')]));_0x542429[_0x4d68('0x43')]=_0x542429[_0x4d68('0x43')]['length']?_0x542429[_0x4d68('0x43')]:_0x396f4f[_0x4d68('0x3f')];if(_0x2fc8b0[_0x4d68('0x40')][_0x4d68('0x57')]){_0x542429[_0x4d68('0x50')]=[{'all':!![]}];}_0x542429=_[_0x4d68('0x4c')]({},_0x542429,_0x2fc8b0[_0x4d68('0x4e')]);return db[_0x4d68('0x4f')][_0x4d68('0x58')](_0x542429)[_0x4d68('0x1f')](handleEntityNotFound(_0x5380a2,null))[_0x4d68('0x1f')](respondWithResult(_0x5380a2,null))['catch'](handleError(_0x5380a2,null));};exports['create']=function(_0x267b5f,_0x5391e2){return db[_0x4d68('0x4f')][_0x4d68('0x59')](_0x267b5f['body'],{})[_0x4d68('0x1f')](function(_0x243aa1){var _0x595648=_0x267b5f[_0x4d68('0x5a')]['get']({'plain':!![]});if(!_0x595648)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x595648[_0x4d68('0x5b')]==='user'){var _0x8c140c=_0x243aa1[_0x4d68('0x36')]({'plain':!![]});var _0x1bb120='WhatsappAccounts';return db['UserProfileSection'][_0x4d68('0x58')]({'where':{'name':_0x1bb120,'userProfileId':_0x595648[_0x4d68('0x5c')]},'raw':!![]})['then'](function(_0x583435){if(_0x583435&&_0x583435['autoAssociation']===0x0){return db[_0x4d68('0x37')][_0x4d68('0x59')]({'name':_0x8c140c[_0x4d68('0x3a')],'resourceId':_0x8c140c['id'],'type':_0x583435[_0x4d68('0x3a')],'sectionId':_0x583435['id']},{})[_0x4d68('0x1f')](function(){return _0x243aa1;});}else{return _0x243aa1;}})['catch'](function(_0x2b2878){logger[_0x4d68('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b2878);throw _0x2b2878;});}return _0x243aa1;})['then'](respondWithResult(_0x5391e2,0xc9))[_0x4d68('0x2a')](handleError(_0x5391e2,null));};exports[_0x4d68('0x5d')]=function(_0xa8cfff,_0x108ba1){if(_0xa8cfff[_0x4d68('0x5e')]['id']){delete _0xa8cfff[_0x4d68('0x5e')]['id'];}return db[_0x4d68('0x4f')][_0x4d68('0x58')]({'where':{'id':_0xa8cfff['params']['id']},'include':[{'model':db[_0x4d68('0x54')],'as':'mandatoryDispositionPause'}]})[_0x4d68('0x1f')](handleEntityNotFound(_0x108ba1,null))[_0x4d68('0x1f')](saveUpdates(_0xa8cfff[_0x4d68('0x5e')],null))['then'](respondWithResult(_0x108ba1,null))['catch'](handleError(_0x108ba1,null));};exports[_0x4d68('0x35')]=function(_0x17cc9d,_0x19e42e){return db[_0x4d68('0x4f')]['find']({'where':{'id':_0x17cc9d[_0x4d68('0x53')]['id']}})[_0x4d68('0x1f')](handleEntityNotFound(_0x19e42e,null))[_0x4d68('0x1f')](removeEntity(_0x19e42e,null))[_0x4d68('0x2a')](handleError(_0x19e42e,null));};exports[_0x4d68('0x5f')]=function(_0x3cab77,_0x5e5290){return db['WhatsappAccount']['describe']()['then'](respondWithResult(_0x5e5290,null))[_0x4d68('0x2a')](handleError(_0x5e5290,null));};exports[_0x4d68('0x60')]=function(_0x53aa7b,_0x2fc5dd,_0x418ce1){if(_0x53aa7b[_0x4d68('0x5e')]['id']){delete _0x53aa7b[_0x4d68('0x5e')]['id'];}return db[_0x4d68('0x4f')][_0x4d68('0x58')]({'where':{'id':_0x53aa7b['params']['id']}})[_0x4d68('0x1f')](handleEntityNotFound(_0x2fc5dd,null))[_0x4d68('0x1f')](function(_0x3f9c15){if(_0x3f9c15){_0x53aa7b[_0x4d68('0x5e')][_0x4d68('0x61')]=_0x3f9c15['id'];return db[_0x4d68('0x62')]['create'](_0x53aa7b[_0x4d68('0x5e')]);}})[_0x4d68('0x1f')](respondWithResult(_0x2fc5dd,null))[_0x4d68('0x2a')](handleError(_0x2fc5dd,null));};exports[_0x4d68('0x63')]=function(_0x36c2dc,_0x28b525,_0x3de046){var _0x48710d={'raw':![],'where':{}};var _0x36f461={};var _0x133374={'count':0x0,'rows':[]};return db[_0x4d68('0x4f')]['findOne']({'where':{'id':_0x36c2dc[_0x4d68('0x53')]['id']}})[_0x4d68('0x1f')](handleEntityNotFound(_0x28b525,null))[_0x4d68('0x1f')](function(_0x4cedff){if(_0x4cedff){_0x36f461['model']=_[_0x4d68('0x56')](db[_0x4d68('0x62')][_0x4d68('0x3d')]);_0x36f461[_0x4d68('0x40')]=_['keys'](_0x36c2dc['query']);_0x36f461[_0x4d68('0x41')]=_['intersection'](_0x36f461[_0x4d68('0x3f')],_0x36f461['query']);_0x48710d[_0x4d68('0x43')]=_[_0x4d68('0x42')](_0x36f461[_0x4d68('0x3f')],qs[_0x4d68('0x44')](_0x36c2dc[_0x4d68('0x40')][_0x4d68('0x44')]));_0x48710d[_0x4d68('0x43')]=_0x48710d[_0x4d68('0x43')][_0x4d68('0x64')]?_0x48710d['attributes']:_0x36f461[_0x4d68('0x3f')];if(!_0x36c2dc[_0x4d68('0x40')]['hasOwnProperty'](_0x4d68('0x46'))){_0x48710d[_0x4d68('0x30')]=qs[_0x4d68('0x30')](_0x36c2dc[_0x4d68('0x40')][_0x4d68('0x30')]);_0x48710d['offset']=qs['offset'](_0x36c2dc[_0x4d68('0x40')][_0x4d68('0x2e')]);}_0x48710d[_0x4d68('0x47')]=qs[_0x4d68('0x48')](_0x36c2dc[_0x4d68('0x40')][_0x4d68('0x48')]);_0x48710d[_0x4d68('0x49')]=qs[_0x4d68('0x41')](_[_0x4d68('0x4a')](_0x36c2dc[_0x4d68('0x40')],_0x36f461[_0x4d68('0x41')]));_0x48710d[_0x4d68('0x49')]['WhatsappAccountId']=_0x4cedff['id'];if(_0x36c2dc['query'][_0x4d68('0x4b')]){_0x48710d['where']=_['merge'](_0x48710d[_0x4d68('0x49')],{'$or':_[_0x4d68('0x3c')](_0x48710d[_0x4d68('0x43')],function(_0x2e2c06){var _0x2790d0={};_0x2790d0[_0x2e2c06]={'$like':'%'+_0x36c2dc[_0x4d68('0x40')][_0x4d68('0x4b')]+'%'};return _0x2790d0;})});}_0x48710d=_['merge']({},_0x48710d,_0x36c2dc[_0x4d68('0x4e')]);return db[_0x4d68('0x62')][_0x4d68('0x31')]({'where':_0x48710d['where']})[_0x4d68('0x1f')](function(_0x2593e5){_0x133374[_0x4d68('0x31')]=_0x2593e5;if(_0x36c2dc[_0x4d68('0x40')][_0x4d68('0x57')]){_0x48710d[_0x4d68('0x50')]=[{'all':!![]}];}return db[_0x4d68('0x62')][_0x4d68('0x51')](_0x48710d);})[_0x4d68('0x1f')](function(_0x1b9d79){_0x133374[_0x4d68('0x52')]=_0x1b9d79;return _0x133374;});}})[_0x4d68('0x1f')](respondWithFilteredResult(_0x28b525,_0x48710d))[_0x4d68('0x2a')](handleError(_0x28b525,null));};exports[_0x4d68('0x65')]=function(_0x25b1b7,_0x1f2e4e,_0x332bc9){return db[_0x4d68('0x4f')][_0x4d68('0x58')]({'where':{'id':_0x25b1b7['params']['id']}})[_0x4d68('0x1f')](handleEntityNotFound(_0x1f2e4e,null))[_0x4d68('0x1f')](function(_0x401c3d){if(_0x401c3d){return _0x401c3d['removeDispositions'](_0x25b1b7[_0x4d68('0x40')][_0x4d68('0x66')]);}})[_0x4d68('0x1f')](respondWithStatusCode(_0x1f2e4e,null))[_0x4d68('0x2a')](handleError(_0x1f2e4e,null));};exports['addAnswer']=function(_0x1cf9ad,_0x554063,_0x547b17){if(_0x1cf9ad[_0x4d68('0x5e')]['id']){delete _0x1cf9ad['body']['id'];}return db[_0x4d68('0x4f')][_0x4d68('0x58')]({'where':{'id':_0x1cf9ad['params']['id']}})['then'](handleEntityNotFound(_0x554063,null))[_0x4d68('0x1f')](function(_0x46e5f7){if(_0x46e5f7){_0x1cf9ad[_0x4d68('0x5e')][_0x4d68('0x61')]=_0x46e5f7['id'];return db['CannedAnswer'][_0x4d68('0x59')](_0x1cf9ad['body']);}})[_0x4d68('0x1f')](respondWithResult(_0x554063,null))[_0x4d68('0x2a')](handleError(_0x554063,null));};exports[_0x4d68('0x67')]=function(_0x580d7a,_0x525e40,_0x4e48f0){var _0x2a4f3c={'raw':![],'where':{}};var _0x51bbfc={};var _0x44b8a5={'count':0x0,'rows':[]};return db[_0x4d68('0x4f')][_0x4d68('0x68')]({'where':{'id':_0x580d7a[_0x4d68('0x53')]['id']}})[_0x4d68('0x1f')](handleEntityNotFound(_0x525e40,null))[_0x4d68('0x1f')](function(_0x5c9bab){if(_0x5c9bab){_0x51bbfc['model']=_[_0x4d68('0x56')](db[_0x4d68('0x69')][_0x4d68('0x3d')]);_0x51bbfc[_0x4d68('0x40')]=_['keys'](_0x580d7a['query']);_0x51bbfc[_0x4d68('0x41')]=_[_0x4d68('0x42')](_0x51bbfc[_0x4d68('0x3f')],_0x51bbfc[_0x4d68('0x40')]);_0x2a4f3c['attributes']=_[_0x4d68('0x42')](_0x51bbfc[_0x4d68('0x3f')],qs[_0x4d68('0x44')](_0x580d7a[_0x4d68('0x40')][_0x4d68('0x44')]));_0x2a4f3c[_0x4d68('0x43')]=_0x2a4f3c[_0x4d68('0x43')][_0x4d68('0x64')]?_0x2a4f3c[_0x4d68('0x43')]:_0x51bbfc[_0x4d68('0x3f')];if(!_0x580d7a['query'][_0x4d68('0x45')](_0x4d68('0x46'))){_0x2a4f3c[_0x4d68('0x30')]=qs[_0x4d68('0x30')](_0x580d7a[_0x4d68('0x40')]['limit']);_0x2a4f3c['offset']=qs[_0x4d68('0x2e')](_0x580d7a[_0x4d68('0x40')][_0x4d68('0x2e')]);}_0x2a4f3c[_0x4d68('0x47')]=qs['sort'](_0x580d7a[_0x4d68('0x40')][_0x4d68('0x48')]);_0x2a4f3c[_0x4d68('0x49')]=qs[_0x4d68('0x41')](_[_0x4d68('0x4a')](_0x580d7a[_0x4d68('0x40')],_0x51bbfc[_0x4d68('0x41')]));_0x2a4f3c['where'][_0x4d68('0x61')]=_0x5c9bab['id'];if(_0x580d7a['query'][_0x4d68('0x4b')]){_0x2a4f3c['where']=_[_0x4d68('0x4c')](_0x2a4f3c[_0x4d68('0x49')],{'$or':_[_0x4d68('0x3c')](_0x2a4f3c[_0x4d68('0x43')],function(_0x45a605){var _0x2e8e62={};_0x2e8e62[_0x45a605]={'$like':'%'+_0x580d7a[_0x4d68('0x40')][_0x4d68('0x4b')]+'%'};return _0x2e8e62;})});}_0x2a4f3c=_[_0x4d68('0x4c')]({},_0x2a4f3c,_0x580d7a['options']);return db[_0x4d68('0x69')][_0x4d68('0x31')]({'where':_0x2a4f3c['where']})['then'](function(_0x29c06c){_0x44b8a5[_0x4d68('0x31')]=_0x29c06c;if(_0x580d7a[_0x4d68('0x40')]['includeAll']){_0x2a4f3c['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x4d68('0x51')](_0x2a4f3c);})[_0x4d68('0x1f')](function(_0x193f85){_0x44b8a5[_0x4d68('0x52')]=_0x193f85;return _0x44b8a5;});}})['then'](respondWithFilteredResult(_0x525e40,_0x2a4f3c))[_0x4d68('0x2a')](handleError(_0x525e40,null));};exports[_0x4d68('0x6a')]=function(_0x3ebf53,_0x60a352,_0x444d4b){return db[_0x4d68('0x4f')][_0x4d68('0x58')]({'where':{'id':_0x3ebf53[_0x4d68('0x53')]['id']}})[_0x4d68('0x1f')](handleEntityNotFound(_0x60a352,null))[_0x4d68('0x1f')](function(_0x164f44){if(_0x164f44){return _0x164f44[_0x4d68('0x6a')](_0x3ebf53['query'][_0x4d68('0x66')]);}})[_0x4d68('0x1f')](respondWithStatusCode(_0x60a352,null))[_0x4d68('0x2a')](handleError(_0x60a352,null));};exports[_0x4d68('0x6b')]=function(_0x5e14ac,_0x479243,_0x21e351){return db[_0x4d68('0x4f')][_0x4d68('0x58')]({'where':{'id':_0x5e14ac[_0x4d68('0x53')]['id']}})[_0x4d68('0x1f')](handleEntityNotFound(_0x479243,null))[_0x4d68('0x1f')](function(_0x247c9d){if(_0x247c9d){return _0x247c9d[_0x4d68('0x6b')](_0x5e14ac[_0x4d68('0x5e')]['ids'],_[_0x4d68('0x6c')](_0x5e14ac[_0x4d68('0x5e')],[_0x4d68('0x66'),'id'])||{})['spread'](function(_0x4c0b0d){for(var _0x3e1c00=0x0;_0x3e1c00<_0x5e14ac[_0x4d68('0x5e')][_0x4d68('0x66')]['length'];_0x3e1c00+=0x1){socket[_0x4d68('0x6d')](_0x4d68('0x6e'),{'UserId':Number(_0x5e14ac[_0x4d68('0x5e')]['ids'][_0x3e1c00]),'WhatsappAccountId':Number(_0x5e14ac['params']['id'])});}return _0x4c0b0d;});}})[_0x4d68('0x1f')](respondWithResult(_0x479243,null))['catch'](handleError(_0x479243,null));};exports[_0x4d68('0x6f')]=function(_0xe429d7,_0x588fd2,_0x3a4547){return db['WhatsappAccount']['find']({'where':{'id':_0xe429d7['params']['id']}})[_0x4d68('0x1f')](handleEntityNotFound(_0x588fd2,null))[_0x4d68('0x1f')](function(_0x298d3b){if(_0x298d3b){return _0x298d3b['removeAgents'](_0xe429d7['query']['ids'])[_0x4d68('0x1f')](function(){if(_[_0x4d68('0x70')](_0xe429d7[_0x4d68('0x40')][_0x4d68('0x66')])){for(var _0x58896d=0x0;_0x58896d<_0xe429d7[_0x4d68('0x40')][_0x4d68('0x66')][_0x4d68('0x64')];_0x58896d+=0x1){socket[_0x4d68('0x6d')]('userWhatsappAccount:remove',{'UserId':Number(_0xe429d7[_0x4d68('0x40')]['ids'][_0x58896d]),'WhatsappAccountId':Number(_0xe429d7[_0x4d68('0x53')]['id'])});}}else{socket[_0x4d68('0x6d')]('userWhatsappAccount:remove',{'UserId':Number(_0xe429d7['query']['ids']),'WhatsappAccountId':Number(_0xe429d7['params']['id'])});}});}})[_0x4d68('0x1f')](respondWithStatusCode(_0x588fd2,null))[_0x4d68('0x2a')](handleError(_0x588fd2,null));};exports[_0x4d68('0x71')]=function(_0x21b0a4,_0x5f4877,_0x9baa67){var _0x371709={};var _0x44c2c5={};var _0x22a8fd;var _0x19086f;return db[_0x4d68('0x4f')]['findOne']({'where':{'id':_0x21b0a4[_0x4d68('0x53')]['id']}})[_0x4d68('0x1f')](handleEntityNotFound(_0x5f4877,null))[_0x4d68('0x1f')](function(_0x125a21){if(_0x125a21){_0x22a8fd=_0x125a21;_0x44c2c5['model']=_[_0x4d68('0x56')](db[_0x4d68('0x72')][_0x4d68('0x3d')]);_0x44c2c5[_0x4d68('0x40')]=_['keys'](_0x21b0a4['query']);_0x44c2c5[_0x4d68('0x41')]=_[_0x4d68('0x42')](_0x44c2c5[_0x4d68('0x3f')],_0x44c2c5[_0x4d68('0x40')]);_0x371709[_0x4d68('0x43')]=_[_0x4d68('0x42')](_0x44c2c5['model'],qs['fields'](_0x21b0a4[_0x4d68('0x40')]['fields']));_0x371709['attributes']=_0x371709[_0x4d68('0x43')]['length']?_0x371709[_0x4d68('0x43')]:_0x44c2c5['model'];_0x371709['order']=qs[_0x4d68('0x48')](_0x21b0a4[_0x4d68('0x40')]['sort']);_0x371709[_0x4d68('0x49')]=qs['filters'](_[_0x4d68('0x4a')](_0x21b0a4[_0x4d68('0x40')],_0x44c2c5[_0x4d68('0x41')]));if(_0x21b0a4['query']['filter']){_0x371709[_0x4d68('0x49')]=_['merge'](_0x371709[_0x4d68('0x49')],{'$or':_[_0x4d68('0x3c')](_0x371709[_0x4d68('0x43')],function(_0x36c8b5){var _0x19d105={};_0x19d105[_0x36c8b5]={'$like':'%'+_0x21b0a4[_0x4d68('0x40')][_0x4d68('0x4b')]+'%'};return _0x19d105;})});}_0x371709=_[_0x4d68('0x4c')]({},_0x371709,_0x21b0a4[_0x4d68('0x4e')]);return _0x22a8fd[_0x4d68('0x71')](_0x371709);}})[_0x4d68('0x1f')](function(_0x55fbf1){if(_0x55fbf1){_0x19086f=_0x55fbf1['length'];if(!_0x21b0a4[_0x4d68('0x40')][_0x4d68('0x45')](_0x4d68('0x46'))){_0x371709[_0x4d68('0x30')]=qs['limit'](_0x21b0a4[_0x4d68('0x40')][_0x4d68('0x30')]);_0x371709[_0x4d68('0x2e')]=qs['offset'](_0x21b0a4[_0x4d68('0x40')][_0x4d68('0x2e')]);}return _0x22a8fd[_0x4d68('0x71')](_0x371709);}})[_0x4d68('0x1f')](function(_0x1132a0){if(_0x1132a0){return _0x1132a0?{'count':_0x19086f,'rows':_0x1132a0}:null;}})[_0x4d68('0x1f')](respondWithResult(_0x5f4877,null))[_0x4d68('0x2a')](handleError(_0x5f4877,null));};exports[_0x4d68('0x73')]=function(_0x12b2e5,_0x50843c){var _0x291c37=_0x12b2e5[_0x4d68('0x53')]['id'];var _0x3782b0=_0x12b2e5[_0x4d68('0x5e')];var _0x236209=0xc8;var _0x5c3784=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x4d68('0x74')][_0x4d68('0x75')][_0x4d68('0x76')]},function(_0x31c366){return db[_0x4d68('0x4f')][_0x4d68('0x68')]({'where':{'id':_0x291c37},'transaction':_0x31c366})[_0x4d68('0x1f')](function(_0x34bf72){if(_0x34bf72){return db[_0x4d68('0x77')][_0x4d68('0x35')]({'where':{'WhatsappAccountId':_0x291c37},'transaction':_0x31c366})['then'](function(){var _0x107d2e=_[_0x4d68('0x3c')](_0x3782b0,function(_0x53d374){_0x53d374[_0x4d68('0x61')]=_0x291c37;return _0x53d374;});return db[_0x4d68('0x77')][_0x4d68('0x78')](_0x107d2e,{'transaction':_0x31c366});});}else{_0x236209=0x194;_0x5c3784=[];}});})['then'](function(){if(_0x236209!==0x194){return db[_0x4d68('0x77')][_0x4d68('0x79')]({'where':{'WhatsappAccountId':_0x291c37},'order':_0x4d68('0x7a')})[_0x4d68('0x1f')](function(_0x1b189d){_0x5c3784=_0x1b189d;});}})['catch'](function(_0xff39d0){_0x236209=0x1f4;logger[_0x4d68('0x26')](_0xff39d0[_0x4d68('0x39')]);if(_0xff39d0[_0x4d68('0x3a')]){delete _0xff39d0['name'];}_0x5c3784=_0xff39d0;})[_0x4d68('0x7b')](function(){if(_0x5c3784===null){_0x50843c[_0x4d68('0x2b')](_0x236209);}else{if(_0x236209===0x1f4){_0x50843c[_0x4d68('0x2c')](_0x236209)[_0x4d68('0x7c')](_0x5c3784);}else{_0x50843c['status'](_0x236209)[_0x4d68('0x2d')](_0x5c3784);}}});};exports[_0x4d68('0x7d')]=function(_0x406cf4,_0x1e6413,_0x2e25d7){var _0x36e7d6={};var _0x46dbe2={};var _0x352e94;var _0x335a34;return db[_0x4d68('0x4f')][_0x4d68('0x68')]({'where':{'id':_0x406cf4[_0x4d68('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e6413,null))[_0x4d68('0x1f')](function(_0x2f0cd8){if(_0x2f0cd8){_0x352e94=_0x2f0cd8;_0x46dbe2[_0x4d68('0x3f')]=_[_0x4d68('0x56')](db[_0x4d68('0x77')][_0x4d68('0x3d')]);_0x46dbe2['query']=_[_0x4d68('0x56')](_0x406cf4[_0x4d68('0x40')]);_0x46dbe2[_0x4d68('0x41')]=_[_0x4d68('0x42')](_0x46dbe2['model'],_0x46dbe2['query']);_0x36e7d6[_0x4d68('0x43')]=_[_0x4d68('0x42')](_0x46dbe2[_0x4d68('0x3f')],qs[_0x4d68('0x44')](_0x406cf4['query']['fields']));_0x36e7d6[_0x4d68('0x43')]=_0x36e7d6[_0x4d68('0x43')][_0x4d68('0x64')]?_0x36e7d6[_0x4d68('0x43')]:_0x46dbe2[_0x4d68('0x3f')];_0x36e7d6[_0x4d68('0x47')]=qs['sort'](_0x406cf4[_0x4d68('0x40')]['sort']);_0x36e7d6[_0x4d68('0x49')]=qs[_0x4d68('0x41')](_['pick'](_0x406cf4['query'],_0x46dbe2[_0x4d68('0x41')]));if(_0x406cf4[_0x4d68('0x40')][_0x4d68('0x4b')]){_0x36e7d6[_0x4d68('0x49')]=_[_0x4d68('0x4c')](_0x36e7d6[_0x4d68('0x49')],{'$or':_[_0x4d68('0x3c')](_0x36e7d6['attributes'],function(_0x389f86){var _0x5e3217={};_0x5e3217[_0x389f86]={'$like':'%'+_0x406cf4[_0x4d68('0x40')][_0x4d68('0x4b')]+'%'};return _0x5e3217;})});}_0x36e7d6=_[_0x4d68('0x4c')]({},_0x36e7d6,_0x406cf4[_0x4d68('0x4e')]);return _0x352e94[_0x4d68('0x7d')](_0x36e7d6);}})[_0x4d68('0x1f')](function(_0x38e64c){if(_0x38e64c){_0x335a34=_0x38e64c[_0x4d68('0x64')];if(!_0x406cf4[_0x4d68('0x40')][_0x4d68('0x45')]('nolimit')){_0x36e7d6['limit']=qs[_0x4d68('0x30')](_0x406cf4[_0x4d68('0x40')][_0x4d68('0x30')]);_0x36e7d6[_0x4d68('0x2e')]=qs['offset'](_0x406cf4['query'][_0x4d68('0x2e')]);}return _0x352e94[_0x4d68('0x7d')](_0x36e7d6);}})[_0x4d68('0x1f')](function(_0x7da5ed){if(_0x7da5ed){return _0x7da5ed?{'count':_0x335a34,'rows':_0x7da5ed}:null;}})['then'](respondWithResult(_0x1e6413,null))[_0x4d68('0x2a')](handleError(_0x1e6413,null));};exports[_0x4d68('0x7e')]=function(_0xd66c60,_0x2e761d,_0x5e7d9c){var _0x7d3920={'channel':'whatsapp'};var _0x4a01d4=[];var _0x2e4066=[];var _0x1199f4={};return db['WhatsappAccount'][_0x4d68('0x58')]({'where':{'id':_0xd66c60[_0x4d68('0x53')]['id']},'include':[{'model':db[_0x4d68('0x77')],'as':'Applications'}]})[_0x4d68('0x1f')](handleEntityNotFound(_0x2e761d,null))['then'](function(_0x27bcea){_0x7d3920['account']=_0x27bcea;if(_0x7d3920[_0x4d68('0x7f')]&&_0x7d3920[_0x4d68('0x7f')][_0x4d68('0x3e')]===_0x4d68('0x80')&&_0xd66c60['body'][_0x4d68('0x81')]){if(_0xd66c60[_0x4d68('0x5e')][_0x4d68('0x81')][_0x4d68('0x64')]===0x0)return;if(_0xd66c60[_0x4d68('0x5e')][_0x4d68('0x81')][0x0]['state']!=='read')return;return db[_0x4d68('0x82')][_0x4d68('0x5d')]({'read':!![],'readAt':_0xd66c60[_0x4d68('0x5e')][_0x4d68('0x81')][0x0]['timestamp']},{'where':{'messageId':_0xd66c60[_0x4d68('0x5e')][_0x4d68('0x81')][0x0]['message_id']},'individualHooks':!![]})[_0x4d68('0x1f')](function(_0x8c380){return _0x2e761d[_0x4d68('0x2c')](0xc8)['json'](_0x8c380);});}_0x7d3920[_0x4d68('0x83')]=_[_0x4d68('0x84')](_0x27bcea[_0x4d68('0x85')],['priority'],[_0x4d68('0x86')]);if(_0x7d3920[_0x4d68('0x7f')][_0x4d68('0x85')]){delete _0x7d3920[_0x4d68('0x7f')][_0x4d68('0x85')];}return db[_0x4d68('0x87')][_0x4d68('0x5f')]()[_0x4d68('0x1f')](function(_0x591211){if(!_0x591211){throw new db[(_0x4d68('0x88'))]['ValidationError']('no\x20available\x20attributes');}_0x4a01d4=_[_0x4d68('0x89')](_['keys'](_0x591211),[_0x4d68('0x8a'),_0x4d68('0x8b')]);_0x2e4066=_['difference'](_[_0x4d68('0x56')](_0x591211),[_0x4d68('0x8a'),_0x4d68('0x8b'),_0x4d68('0x8c'),_0x4d68('0x8d')]);_0x7d3920[_0x4d68('0x5e')]={'mapKey':'mobile'};if(_0x7d3920[_0x4d68('0x7f')]&&_0x7d3920['account'][_0x4d68('0x3e')]==='twilio'){_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x8e')]=_0xd66c60[_0x4d68('0x5e')][_0x4d68('0x8f')]['replace']('whatsapp:','');_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x5e')]=_0xd66c60['body']['Body'];_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x90')]=_0xd66c60[_0x4d68('0x5e')][_0x4d68('0x91')];}if(_0x7d3920[_0x4d68('0x7f')]&&_0x7d3920[_0x4d68('0x7f')]['type']===_0x4d68('0x80')){_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x8e')]=_0xd66c60[_0x4d68('0x5e')][_0x4d68('0x92')][0x0]['from'];_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x5e')]=_0xd66c60[_0x4d68('0x5e')]['notifications'][0x0][_0x4d68('0x28')]['body'];_0x7d3920['body'][_0x4d68('0x90')]=_0xd66c60[_0x4d68('0x5e')]['notifications'][0x0]['message_id'];}if(_0x7d3920['body']['id']){delete _0x7d3920[_0x4d68('0x5e')]['id'];}if(_['isNil'](_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x8e')])){throw new db['Sequelize']['ValidationError'](_0x4d68('0x93'));}if(_[_0x4d68('0x94')](_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x5e')])||_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x5e')]===''){throw new db[(_0x4d68('0x88'))][(_0x4d68('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4d68('0x94')](_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x96')])){throw new db['Sequelize']['ValidationError'](_0x4d68('0x97')+_0x2e4066);}if(!_[_0x4d68('0x98')](_0x2e4066,_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x96')])){throw new db[(_0x4d68('0x88'))][(_0x4d68('0x95'))](_0x4d68('0x99')+_0x2e4066);}_0x1199f4[_0x7d3920['body'][_0x4d68('0x96')]]=_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x8e')];return db[_0x4d68('0x9a')][_0x4d68('0x58')]({'where':{'id':_0x7d3920[_0x4d68('0x7f')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1199f4,'limit':0x1,'order':[[_0x4d68('0x8b'),_0x4d68('0x9b')]]}]});})[_0x4d68('0x1f')](handleEntityNotFound(_0x2e761d,null))[_0x4d68('0x1f')](function(_0x1126fe){if(_0x1126fe){_0x7d3920['list']=_[_0x4d68('0x6c')](_0x1126fe,[_0x4d68('0x9c')]);if(_0x1126fe[_0x4d68('0x9c')]['length']){return _0x1126fe[_0x4d68('0x9c')][0x0];}var _0x357e20=_[_0x4d68('0x19')](_0x7d3920[_0x4d68('0x5e')],{'firstName':_0x7d3920['body'][_0x4d68('0x8e')],'ListId':_0x1126fe['id']});_0x357e20[_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x96')]]=_0x7d3920['body']['from'];return db['CmContact'][_0x4d68('0x59')](_0x357e20,{'fields':_0x4a01d4,'raw':!![]});}})[_0x4d68('0x1f')](handleEntityNotFound(_0x2e761d,null))[_0x4d68('0x1f')](function(_0x3c8da8){if(_0x3c8da8){_0x7d3920[_0x4d68('0x9d')]=_0x3c8da8;var _0x2b324c={'ContactId':_0x3c8da8['id'],'phone':_0x7d3920[_0x4d68('0x5e')]['from'],'WhatsappAccountId':_0xd66c60[_0x4d68('0x53')]['id']};var _0x13da4c={'ContactId':_0x3c8da8['id'],'WhatsappAccountId':_0xd66c60[_0x4d68('0x53')]['id'],'closed':![]};return db[_0x4d68('0x9e')][_0x4d68('0x58')]({'where':_0x13da4c})[_0x4d68('0x1f')](function(_0x4cc0e7){if(_0x4cc0e7){return[_0x4cc0e7,![]];}return db[_0x4d68('0x9e')][_0x4d68('0x59')](_0x2b324c)['then'](function(_0x8e058b){return[_0x8e058b,!![]];});});}})['spread'](function(_0x373b03,_0x3ded34){_0x7d3920[_0x4d68('0x9f')]=_0x373b03[_0x4d68('0x36')]({'plain':!![]});_0x7d3920['interaction']['created']=![];if(_0x3ded34){if(_0x7d3920['account'][_0x4d68('0xa0')]){_0x7d3920[_0x4d68('0x83')][_0x4d68('0xa1')]({'id':0x0,'priority':_0x7d3920[_0x4d68('0x83')][_0x4d68('0x64')]+0x1,'app':_0x4d68('0xa2'),'appdata':_0x4d68('0xa3'),'interval':'*,*,*,*'});}_0x7d3920['interaction'][_0x4d68('0xa4')]=!![];}return db[_0x4d68('0x82')][_0x4d68('0x59')]({'phone':_0x7d3920[_0x4d68('0x5e')][_0x4d68('0x8e')],'messageId':_0x7d3920['body'][_0x4d68('0x90')],'body':_0x7d3920['body'][_0x4d68('0x5e')],'WhatsappAccountId':_0xd66c60['params']['id'],'WhatsappInteractionId':_0x373b03['id'],'direction':'in','ContactId':_0x373b03['ContactId'],'AttachmentId':_0x7d3920[_0x4d68('0x5e')]['AttachmentId']});})['then'](function(_0x17f354){_0x7d3920[_0x4d68('0x28')]=_0x17f354;if(_0x7d3920[_0x4d68('0x9f')][_0x4d68('0xa5')]){return db[_0x4d68('0x72')][_0x4d68('0x58')]({'attributes':['id',_0x4d68('0x3a')],'where':{'id':_0x7d3920['interaction'][_0x4d68('0xa5')]}})[_0x4d68('0x1f')](function(_0x2b2c0a){if(_0x2b2c0a){_0x7d3920[_0x4d68('0x83')][_0x4d68('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2b2c0a['name']+','+(_0x7d3920['account'][_0x4d68('0xa7')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4d68('0xa8'),'startRouting',_0x7d3920);});}return respondWithRpcPromise('Start',_0x4d68('0xa9'),_0x7d3920);})['then'](function(_0x2d2fc4){if(_0x2d2fc4){var _0x1d47ce=0xc8;var _0x100930=_0x4d68('0xaa');logger[_0x4d68('0x20')](_0x4d68('0x24'),_0x100930,_0x1d47ce,'entity\x20found');logger['debug'](_0x4d68('0xab'),_0x100930,_0x1d47ce,_0x4d68('0xac'),JSON[_0x4d68('0x25')](_0x2d2fc4));if(_0x7d3920[_0x4d68('0x7f')]['type']===_0x4d68('0xad')){return _0x2e761d[_0x4d68('0x2c')](_0x1d47ce)[_0x4d68('0x32')](_0x4d68('0xae'),'text/xml')[_0x4d68('0x7c')](_0x4d68('0xaf'));}else{return _0x2e761d['status'](_0x1d47ce)[_0x4d68('0x2d')](_0x2d2fc4);}}});})[_0x4d68('0x2a')](handleError(_0x2e761d,null));};exports[_0x4d68('0x7c')]=function(_0x1e36c0,_0x34a9e9,_0x381cbd){var _0x82c59f,_0x5cf86b,_0x2f1d6d;if(_[_0x4d68('0x94')](_0x1e36c0[_0x4d68('0x5e')][_0x4d68('0x5e')])||_0x1e36c0[_0x4d68('0x5e')][_0x4d68('0x5e')]===''){throw new db[(_0x4d68('0x88'))][(_0x4d68('0x95'))](_0x4d68('0xb0'));}if(_[_0x4d68('0x94')](_0x1e36c0[_0x4d68('0x5e')]['to'])){throw new db[(_0x4d68('0x88'))][(_0x4d68('0x95'))](_0x4d68('0xb1'));}_0x82c59f=_0x1e36c0[_0x4d68('0x5e')]['to'];return db[_0x4d68('0x4f')]['find']({'where':{'id':_0x1e36c0[_0x4d68('0x53')]['id']},'include':[{'model':db[_0x4d68('0x9a')],'as':'List','include':[{'model':db[_0x4d68('0x87')],'as':_0x4d68('0x9c'),'where':{'mobile':_0x82c59f},'limit':0x1,'order':[[_0x4d68('0x8b'),_0x4d68('0x9b')]]}]}]})[_0x4d68('0x1f')](handleEntityNotFound(_0x34a9e9,null))[_0x4d68('0x1f')](function(_0x13ebb9){if(_0x13ebb9&&_0x13ebb9[_0x4d68('0xb2')]){_0x5cf86b=_0x13ebb9[_0x4d68('0x36')]({'plain':!![]});if(_0x5cf86b[_0x4d68('0xb2')]&&_0x5cf86b[_0x4d68('0xb2')]['Contacts'][_0x4d68('0x64')]){return _0x5cf86b[_0x4d68('0xb2')][_0x4d68('0x9c')][0x0];}return db['CmContact']['create'](_[_0x4d68('0x19')](_0x1e36c0[_0x4d68('0x5e')],{'firstName':_0x82c59f,'mobile':_0x82c59f,'phone':_0x82c59f,'ListId':_0x5cf86b[_0x4d68('0x8d')]}));}})['then'](handleEntityNotFound(_0x34a9e9,null))[_0x4d68('0x1f')](function(_0x3ce0ff){if(_0x3ce0ff){_0x2f1d6d=_0x3ce0ff;return db[_0x4d68('0x9e')][_0x4d68('0x58')]({'where':{'ContactId':_0x2f1d6d['id'],'closed':![],'WhatsappAccountId':_0x5cf86b['id']}})[_0x4d68('0x1f')](function(_0xd00ee3){if(_0xd00ee3){return[_0xd00ee3,![]];}return db[_0x4d68('0x9e')][_0x4d68('0x59')]({'UserId':_0x1e36c0[_0x4d68('0x5a')]['id'],'ContactId':_0x2f1d6d['id'],'WhatsappAccountId':_0x5cf86b['id'],'phone':_0x82c59f,'firstMsgDirection':_0x4d68('0xb3'),'Messages':[_[_0x4d68('0x4c')](_0x1e36c0['body'],{'read':![],'body':_0x1e36c0['body'][_0x4d68('0x5e')],'phone':_0x82c59f,'WhatsappAccountId':_0x5cf86b['id'],'UserId':_0x1e36c0[_0x4d68('0x5a')]['id'],'ContactId':_0x2f1d6d['id']})]},{'include':[{'model':db[_0x4d68('0x82')],'as':_0x4d68('0xb4')}]})[_0x4d68('0x1f')](function(_0xdeb8c){return[_0xdeb8c,!![]];});});}})[_0x4d68('0xb5')](function(_0x4f3fc9,_0x5171db){if(_0x5171db){return _0x4f3fc9;}return db[_0x4d68('0x82')]['create'](_[_0x4d68('0x4c')](_0x1e36c0['body'],{'read':![],'body':_0x1e36c0[_0x4d68('0x5e')][_0x4d68('0x5e')],'phone':_0x82c59f,'WhatsappAccountId':_0x5cf86b['id'],'WhatsappInteractionId':_0x4f3fc9['id'],'UserId':_0x1e36c0['user']['id'],'ContactId':_0x2f1d6d['id']}))[_0x4d68('0x1f')](function(_0x245d33){_0x4f3fc9['dataValues'][_0x4d68('0xb4')]=[];_0x4f3fc9[_0x4d68('0xb6')][_0x4d68('0xb4')][_0x4d68('0xa1')](_0x245d33[_0x4d68('0xb6')]);return _0x4f3fc9;});})['then'](respondWithResult(_0x34a9e9,null))[_0x4d68('0x2a')](handleError(_0x34a9e9,null));}; \ No newline at end of file +var _0x8dee=['WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','DESC','defaults','out','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','offset','undefined','count','set','Content-Range','json','apply','update','then','destroy','get','UserProfileResource','status','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','ids','getAnswers','CannedAnswer','rows','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','twilio','From','replace','Body','MessageSid','sinch','from','notifications','messageId','isNil','ValidationError','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','updatedAt','list','contact','WhatsappInteraction','interaction','created','unmanaged','*,*,*,*'];(function(_0x67e487,_0x3c3a6c){var _0x496ee1=function(_0x178577){while(--_0x178577){_0x67e487['push'](_0x67e487['shift']());}};_0x496ee1(++_0x3c3a6c);}(_0x8dee,0x19b));var _0xe8de=function(_0x4d714a,_0x2e0eb0){_0x4d714a=_0x4d714a-0x0;var _0x7333e0=_0x8dee[_0x4d714a];return _0x7333e0;};'use strict';var emlformat=require(_0xe8de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8de('0x1'));var jsonpatch=require(_0xe8de('0x2'));var rp=require(_0xe8de('0x3'));var moment=require(_0xe8de('0x4'));var BPromise=require(_0xe8de('0x5'));var Mustache=require('mustache');var util=require(_0xe8de('0x6'));var path=require(_0xe8de('0x7'));var sox=require(_0xe8de('0x8'));var csv=require(_0xe8de('0x9'));var ejs=require(_0xe8de('0xa'));var fs=require('fs');var fs_extra=require(_0xe8de('0xb'));var _=require(_0xe8de('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe8de('0xd'));var deskjs=require(_0xe8de('0xe'));var toCsv=require(_0xe8de('0x9'));var querystring=require(_0xe8de('0xf'));var Papa=require(_0xe8de('0x10'));var Redis=require(_0xe8de('0x11'));var authService=require(_0xe8de('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe8de('0x13'));var hardwareService=require(_0xe8de('0x14'));var logger=require(_0xe8de('0x15'))(_0xe8de('0x16'));var utils=require('../../config/utils');var config=require(_0xe8de('0x17'));var licenseUtil=require(_0xe8de('0x18'));var db=require(_0xe8de('0x19'))['db'];config[_0xe8de('0x1a')]=_['defaults'](config[_0xe8de('0x1a')],{'host':_0xe8de('0x1b'),'port':0x18eb});var socket=require(_0xe8de('0x1c'))(new Redis(config['redis']));require(_0xe8de('0x1d'))[_0xe8de('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xe8de('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x48d708,_0x7236a0,_0x3bd50f,_0x20c565){return new BPromise(function(_0x28ee5f,_0x562389){var _0x914012=_0x20c565||client;return _0x914012['request'](_0x48d708,_0x3bd50f)['then'](function(_0x182285){logger[_0xe8de('0x20')](_0xe8de('0x21'),_0x7236a0,_0xe8de('0x22'));logger[_0xe8de('0x23')](_0xe8de('0x24'),_0x7236a0,_0xe8de('0x22'),JSON[_0xe8de('0x25')](_0x182285));if(_0x182285[_0xe8de('0x26')]){if(_0x182285[_0xe8de('0x26')]['code']===0x1f4){logger['error'](_0xe8de('0x21'),_0x7236a0,_0x182285[_0xe8de('0x26')][_0xe8de('0x27')]);return _0x562389(_0x182285[_0xe8de('0x26')][_0xe8de('0x27')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x7236a0,_0x182285[_0xe8de('0x26')][_0xe8de('0x27')]);return _0x28ee5f(_0x182285[_0xe8de('0x26')][_0xe8de('0x27')]);}else{logger[_0xe8de('0x20')](_0xe8de('0x21'),_0x7236a0,_0xe8de('0x22'));_0x28ee5f(_0x182285[_0xe8de('0x28')][_0xe8de('0x27')]);}})[_0xe8de('0x29')](function(_0x29d7d7){logger[_0xe8de('0x26')](_0xe8de('0x21'),_0x7236a0,_0x29d7d7);_0x562389(_0x29d7d7);});});}function respondWithStatusCode(_0x550cbe,_0x3f9579){_0x3f9579=_0x3f9579||0xcc;return function(_0xcb9ff8){if(_0xcb9ff8){return _0x550cbe[_0xe8de('0x2a')](_0x3f9579);}return _0x550cbe['status'](_0x3f9579)[_0xe8de('0x2b')]();};}function respondWithResult(_0x361a5d,_0x5eda5b){_0x5eda5b=_0x5eda5b||0xc8;return function(_0xcdeb87){if(_0xcdeb87){return _0x361a5d['status'](_0x5eda5b)['json'](_0xcdeb87);}};}function respondWithFilteredResult(_0x585981,_0x139ac9){return function(_0x1630f3){if(_0x1630f3){var _0x231e7c=typeof _0x139ac9[_0xe8de('0x2c')]===_0xe8de('0x2d')&&typeof _0x139ac9['limit']===_0xe8de('0x2d');var _0x2c375e=_0x1630f3[_0xe8de('0x2e')];var _0x18bdb6=_0x231e7c?0x0:_0x139ac9[_0xe8de('0x2c')];var _0x28b9d6=_0x231e7c?_0x1630f3[_0xe8de('0x2e')]:_0x139ac9['offset']+_0x139ac9['limit'];var _0x43bfe5;if(_0x28b9d6>=_0x2c375e){_0x28b9d6=_0x2c375e;_0x43bfe5=0xc8;}else{_0x43bfe5=0xce;}_0x585981['status'](_0x43bfe5);return _0x585981[_0xe8de('0x2f')](_0xe8de('0x30'),_0x18bdb6+'-'+_0x28b9d6+'/'+_0x2c375e)[_0xe8de('0x31')](_0x1630f3);}return null;};}function patchUpdates(_0x5ef967){return function(_0x1ee9ef){try{jsonpatch[_0xe8de('0x32')](_0x1ee9ef,_0x5ef967,!![]);}catch(_0x146fbc){return BPromise['reject'](_0x146fbc);}return _0x1ee9ef['save']();};}function saveUpdates(_0x163e58,_0x1217d1){return function(_0x3dd18c){if(_0x3dd18c){return _0x3dd18c[_0xe8de('0x33')](_0x163e58)[_0xe8de('0x34')](function(_0xeb175e){return _0xeb175e;});}return null;};}function removeEntity(_0x111780,_0xf3af07){return function(_0x4e8216){if(_0x4e8216){return _0x4e8216[_0xe8de('0x35')]()['then'](function(){var _0x1a7900=_0x4e8216[_0xe8de('0x36')]({'plain':!![]});var _0x7cd235='WhatsappAccounts';return db[_0xe8de('0x37')][_0xe8de('0x35')]({'where':{'type':_0x7cd235,'resourceId':_0x1a7900['id']}})['then'](function(){return _0x4e8216;});})[_0xe8de('0x34')](function(){_0x111780[_0xe8de('0x38')](0xcc)[_0xe8de('0x2b')]();});}};}function handleEntityNotFound(_0x2195d6,_0x34df56){return function(_0x1c502c){if(!_0x1c502c){_0x2195d6[_0xe8de('0x2a')](0x194);}return _0x1c502c;};}function handleError(_0x1ba7d6,_0x30ae76){_0x30ae76=_0x30ae76||0x1f4;return function(_0x4dada3){logger[_0xe8de('0x26')](_0x4dada3[_0xe8de('0x39')]);if(_0x4dada3[_0xe8de('0x3a')]){delete _0x4dada3[_0xe8de('0x3a')];}_0x1ba7d6[_0xe8de('0x38')](_0x30ae76)[_0xe8de('0x3b')](_0x4dada3);};}exports[_0xe8de('0x3c')]=function(_0x31eed0,_0xc2ee61){var _0x138099={'include':[{'model':db[_0xe8de('0x3d')],'as':_0xe8de('0x3e')}]},_0x1dda2c={},_0x31d311={'count':0x0,'rows':[]};var _0x52b938=_['map'](db[_0xe8de('0x3f')]['rawAttributes'],function(_0x4028eb){return{'name':_0x4028eb[_0xe8de('0x40')],'type':_0x4028eb[_0xe8de('0x41')][_0xe8de('0x42')]};});_0x1dda2c[_0xe8de('0x43')]=_[_0xe8de('0x44')](_0x52b938,_0xe8de('0x3a'));_0x1dda2c['query']=_[_0xe8de('0x45')](_0x31eed0[_0xe8de('0x46')]);_0x1dda2c[_0xe8de('0x47')]=_[_0xe8de('0x48')](_0x1dda2c[_0xe8de('0x43')],_0x1dda2c[_0xe8de('0x46')]);_0x138099[_0xe8de('0x49')]=_[_0xe8de('0x48')](_0x1dda2c[_0xe8de('0x43')],qs['fields'](_0x31eed0['query'][_0xe8de('0x4a')]));_0x138099['attributes']=_0x138099[_0xe8de('0x49')][_0xe8de('0x4b')]?_0x138099[_0xe8de('0x49')]:_0x1dda2c[_0xe8de('0x43')];if(!_0x31eed0[_0xe8de('0x46')][_0xe8de('0x4c')](_0xe8de('0x4d'))){_0x138099[_0xe8de('0x4e')]=qs['limit'](_0x31eed0[_0xe8de('0x46')][_0xe8de('0x4e')]);_0x138099[_0xe8de('0x2c')]=qs['offset'](_0x31eed0[_0xe8de('0x46')][_0xe8de('0x2c')]);}_0x138099[_0xe8de('0x4f')]=qs[_0xe8de('0x50')](_0x31eed0[_0xe8de('0x46')][_0xe8de('0x50')]);_0x138099[_0xe8de('0x51')]=qs[_0xe8de('0x47')](_[_0xe8de('0x52')](_0x31eed0['query'],_0x1dda2c['filters']),_0x52b938);if(_0x31eed0['query'][_0xe8de('0x53')]){_0x138099[_0xe8de('0x51')]=_[_0xe8de('0x54')](_0x138099[_0xe8de('0x51')],{'$or':_[_0xe8de('0x44')](_0x52b938,function(_0x12b5ba){if(_0x12b5ba[_0xe8de('0x41')]!==_0xe8de('0x55')){var _0x53d0d3={};_0x53d0d3[_0x12b5ba[_0xe8de('0x3a')]]={'$like':'%'+_0x31eed0[_0xe8de('0x46')][_0xe8de('0x53')]+'%'};return _0x53d0d3;}})});}_0x138099=_[_0xe8de('0x54')]({},_0x138099,_0x31eed0['options']);var _0x49212e={'where':_0x138099[_0xe8de('0x51')]};return db[_0xe8de('0x3f')][_0xe8de('0x2e')](_0x49212e)[_0xe8de('0x34')](function(_0x1d6bdc){_0x31d311[_0xe8de('0x2e')]=_0x1d6bdc;if(_0x31eed0[_0xe8de('0x46')][_0xe8de('0x56')]){_0x138099[_0xe8de('0x57')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xe8de('0x58')](_0x138099);})[_0xe8de('0x34')](function(_0x10cc4b){_0x31d311['rows']=_0x10cc4b;return _0x31d311;})[_0xe8de('0x34')](respondWithFilteredResult(_0xc2ee61,_0x138099))[_0xe8de('0x29')](handleError(_0xc2ee61,null));};exports['show']=function(_0x87ce79,_0x3902fb){var _0x18361e={'raw':![],'where':{'id':_0x87ce79[_0xe8de('0x59')]['id']},'include':[{'model':db[_0xe8de('0x3d')],'as':'mandatoryDispositionPause'}]},_0x4bc7a7={};_0x4bc7a7[_0xe8de('0x43')]=_[_0xe8de('0x45')](db['WhatsappAccount'][_0xe8de('0x5a')]);_0x4bc7a7[_0xe8de('0x46')]=_[_0xe8de('0x45')](_0x87ce79[_0xe8de('0x46')]);_0x4bc7a7[_0xe8de('0x47')]=_[_0xe8de('0x48')](_0x4bc7a7[_0xe8de('0x43')],_0x4bc7a7[_0xe8de('0x46')]);_0x18361e[_0xe8de('0x49')]=_[_0xe8de('0x48')](_0x4bc7a7[_0xe8de('0x43')],qs[_0xe8de('0x4a')](_0x87ce79[_0xe8de('0x46')]['fields']));_0x18361e['attributes']=_0x18361e[_0xe8de('0x49')][_0xe8de('0x4b')]?_0x18361e[_0xe8de('0x49')]:_0x4bc7a7[_0xe8de('0x43')];if(_0x87ce79[_0xe8de('0x46')][_0xe8de('0x56')]){_0x18361e[_0xe8de('0x57')]=[{'all':!![]}];}_0x18361e=_[_0xe8de('0x54')]({},_0x18361e,_0x87ce79[_0xe8de('0x5b')]);return db['WhatsappAccount'][_0xe8de('0x5c')](_0x18361e)[_0xe8de('0x34')](handleEntityNotFound(_0x3902fb,null))[_0xe8de('0x34')](respondWithResult(_0x3902fb,null))[_0xe8de('0x29')](handleError(_0x3902fb,null));};exports[_0xe8de('0x5d')]=function(_0x23bd1a,_0x339ff3){return db[_0xe8de('0x3f')][_0xe8de('0x5d')](_0x23bd1a[_0xe8de('0x5e')],{})['then'](function(_0x2afd84){var _0x3f300c=_0x23bd1a[_0xe8de('0x5f')][_0xe8de('0x36')]({'plain':!![]});if(!_0x3f300c)throw new Error(_0xe8de('0x60'));if(_0x3f300c[_0xe8de('0x61')]===_0xe8de('0x5f')){var _0x4eb391=_0x2afd84[_0xe8de('0x36')]({'plain':!![]});var _0x2871d7='WhatsappAccounts';return db[_0xe8de('0x62')]['find']({'where':{'name':_0x2871d7,'userProfileId':_0x3f300c['userProfileId']},'raw':!![]})[_0xe8de('0x34')](function(_0x11c896){if(_0x11c896&&_0x11c896[_0xe8de('0x63')]===0x0){return db['UserProfileResource'][_0xe8de('0x5d')]({'name':_0x4eb391[_0xe8de('0x3a')],'resourceId':_0x4eb391['id'],'type':_0x11c896[_0xe8de('0x3a')],'sectionId':_0x11c896['id']},{})[_0xe8de('0x34')](function(){return _0x2afd84;});}else{return _0x2afd84;}})[_0xe8de('0x29')](function(_0x4b087d){logger[_0xe8de('0x26')](_0xe8de('0x64'),_0x4b087d);throw _0x4b087d;});}return _0x2afd84;})[_0xe8de('0x34')](respondWithResult(_0x339ff3,0xc9))[_0xe8de('0x29')](handleError(_0x339ff3,null));};exports[_0xe8de('0x33')]=function(_0x9c8aac,_0x449297){if(_0x9c8aac[_0xe8de('0x5e')]['id']){delete _0x9c8aac[_0xe8de('0x5e')]['id'];}return db[_0xe8de('0x3f')]['find']({'where':{'id':_0x9c8aac[_0xe8de('0x59')]['id']},'include':[{'model':db[_0xe8de('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x449297,null))['then'](saveUpdates(_0x9c8aac[_0xe8de('0x5e')],null))['then'](respondWithResult(_0x449297,null))['catch'](handleError(_0x449297,null));};exports[_0xe8de('0x35')]=function(_0x577a00,_0xf3864b){return db[_0xe8de('0x3f')][_0xe8de('0x5c')]({'where':{'id':_0x577a00[_0xe8de('0x59')]['id']}})[_0xe8de('0x34')](handleEntityNotFound(_0xf3864b,null))[_0xe8de('0x34')](removeEntity(_0xf3864b,null))[_0xe8de('0x29')](handleError(_0xf3864b,null));};exports[_0xe8de('0x65')]=function(_0x5593b9,_0x15de34){return db[_0xe8de('0x3f')][_0xe8de('0x65')]()['then'](respondWithResult(_0x15de34,null))['catch'](handleError(_0x15de34,null));};exports['addDisposition']=function(_0xb4dce4,_0x484115,_0x174cc1){if(_0xb4dce4[_0xe8de('0x5e')]['id']){delete _0xb4dce4[_0xe8de('0x5e')]['id'];}return db[_0xe8de('0x3f')][_0xe8de('0x5c')]({'where':{'id':_0xb4dce4[_0xe8de('0x59')]['id']}})['then'](handleEntityNotFound(_0x484115,null))[_0xe8de('0x34')](function(_0x29a52a){if(_0x29a52a){_0xb4dce4[_0xe8de('0x5e')]['WhatsappAccountId']=_0x29a52a['id'];return db[_0xe8de('0x66')][_0xe8de('0x5d')](_0xb4dce4['body']);}})[_0xe8de('0x34')](respondWithResult(_0x484115,null))[_0xe8de('0x29')](handleError(_0x484115,null));};exports[_0xe8de('0x67')]=function(_0xb0a3f3,_0x2d2146,_0x50dc8d){var _0x3647e0={'raw':![],'where':{}};var _0xb3ef73={};var _0x374bc0={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xe8de('0x68')]({'where':{'id':_0xb0a3f3[_0xe8de('0x59')]['id']}})[_0xe8de('0x34')](handleEntityNotFound(_0x2d2146,null))['then'](function(_0x3ea1ad){if(_0x3ea1ad){_0xb3ef73['model']=_[_0xe8de('0x45')](db[_0xe8de('0x66')]['rawAttributes']);_0xb3ef73[_0xe8de('0x46')]=_['keys'](_0xb0a3f3[_0xe8de('0x46')]);_0xb3ef73[_0xe8de('0x47')]=_[_0xe8de('0x48')](_0xb3ef73[_0xe8de('0x43')],_0xb3ef73[_0xe8de('0x46')]);_0x3647e0[_0xe8de('0x49')]=_[_0xe8de('0x48')](_0xb3ef73['model'],qs['fields'](_0xb0a3f3['query']['fields']));_0x3647e0[_0xe8de('0x49')]=_0x3647e0[_0xe8de('0x49')][_0xe8de('0x4b')]?_0x3647e0[_0xe8de('0x49')]:_0xb3ef73[_0xe8de('0x43')];if(!_0xb0a3f3[_0xe8de('0x46')][_0xe8de('0x4c')](_0xe8de('0x4d'))){_0x3647e0[_0xe8de('0x4e')]=qs['limit'](_0xb0a3f3[_0xe8de('0x46')][_0xe8de('0x4e')]);_0x3647e0[_0xe8de('0x2c')]=qs[_0xe8de('0x2c')](_0xb0a3f3[_0xe8de('0x46')]['offset']);}_0x3647e0[_0xe8de('0x4f')]=qs[_0xe8de('0x50')](_0xb0a3f3[_0xe8de('0x46')]['sort']);_0x3647e0[_0xe8de('0x51')]=qs[_0xe8de('0x47')](_['pick'](_0xb0a3f3['query'],_0xb3ef73[_0xe8de('0x47')]));_0x3647e0[_0xe8de('0x51')][_0xe8de('0x69')]=_0x3ea1ad['id'];if(_0xb0a3f3[_0xe8de('0x46')][_0xe8de('0x53')]){_0x3647e0['where']=_[_0xe8de('0x54')](_0x3647e0[_0xe8de('0x51')],{'$or':_[_0xe8de('0x44')](_0x3647e0[_0xe8de('0x49')],function(_0x1f8cd9){var _0xc375e5={};_0xc375e5[_0x1f8cd9]={'$like':'%'+_0xb0a3f3[_0xe8de('0x46')][_0xe8de('0x53')]+'%'};return _0xc375e5;})});}_0x3647e0=_['merge']({},_0x3647e0,_0xb0a3f3[_0xe8de('0x5b')]);return db['Disposition'][_0xe8de('0x2e')]({'where':_0x3647e0[_0xe8de('0x51')]})[_0xe8de('0x34')](function(_0x24d41a){_0x374bc0[_0xe8de('0x2e')]=_0x24d41a;if(_0xb0a3f3[_0xe8de('0x46')][_0xe8de('0x56')]){_0x3647e0['include']=[{'all':!![]}];}return db[_0xe8de('0x66')][_0xe8de('0x58')](_0x3647e0);})[_0xe8de('0x34')](function(_0x473abb){_0x374bc0['rows']=_0x473abb;return _0x374bc0;});}})[_0xe8de('0x34')](respondWithFilteredResult(_0x2d2146,_0x3647e0))['catch'](handleError(_0x2d2146,null));};exports[_0xe8de('0x6a')]=function(_0x12e44c,_0x395d09,_0xf0e99e){return db[_0xe8de('0x3f')][_0xe8de('0x5c')]({'where':{'id':_0x12e44c[_0xe8de('0x59')]['id']}})[_0xe8de('0x34')](handleEntityNotFound(_0x395d09,null))['then'](function(_0x308bfa){if(_0x308bfa){return _0x308bfa[_0xe8de('0x6a')](_0x12e44c[_0xe8de('0x46')][_0xe8de('0x6b')]);}})[_0xe8de('0x34')](respondWithStatusCode(_0x395d09,null))[_0xe8de('0x29')](handleError(_0x395d09,null));};exports['addAnswer']=function(_0x18298d,_0x5d2678,_0xee6bf6){if(_0x18298d['body']['id']){delete _0x18298d[_0xe8de('0x5e')]['id'];}return db['WhatsappAccount'][_0xe8de('0x5c')]({'where':{'id':_0x18298d[_0xe8de('0x59')]['id']}})[_0xe8de('0x34')](handleEntityNotFound(_0x5d2678,null))[_0xe8de('0x34')](function(_0x5dda24){if(_0x5dda24){_0x18298d[_0xe8de('0x5e')][_0xe8de('0x69')]=_0x5dda24['id'];return db['CannedAnswer']['create'](_0x18298d['body']);}})['then'](respondWithResult(_0x5d2678,null))[_0xe8de('0x29')](handleError(_0x5d2678,null));};exports[_0xe8de('0x6c')]=function(_0x3cc136,_0x19550b,_0xfb1e25){var _0x9e5dcc={'raw':![],'where':{}};var _0x1892f8={};var _0x17ad1d={'count':0x0,'rows':[]};return db[_0xe8de('0x3f')][_0xe8de('0x68')]({'where':{'id':_0x3cc136['params']['id']}})[_0xe8de('0x34')](handleEntityNotFound(_0x19550b,null))[_0xe8de('0x34')](function(_0x436557){if(_0x436557){_0x1892f8[_0xe8de('0x43')]=_['keys'](db[_0xe8de('0x6d')][_0xe8de('0x5a')]);_0x1892f8[_0xe8de('0x46')]=_[_0xe8de('0x45')](_0x3cc136['query']);_0x1892f8[_0xe8de('0x47')]=_[_0xe8de('0x48')](_0x1892f8[_0xe8de('0x43')],_0x1892f8['query']);_0x9e5dcc[_0xe8de('0x49')]=_[_0xe8de('0x48')](_0x1892f8[_0xe8de('0x43')],qs[_0xe8de('0x4a')](_0x3cc136[_0xe8de('0x46')][_0xe8de('0x4a')]));_0x9e5dcc[_0xe8de('0x49')]=_0x9e5dcc[_0xe8de('0x49')][_0xe8de('0x4b')]?_0x9e5dcc[_0xe8de('0x49')]:_0x1892f8[_0xe8de('0x43')];if(!_0x3cc136[_0xe8de('0x46')]['hasOwnProperty']('nolimit')){_0x9e5dcc[_0xe8de('0x4e')]=qs[_0xe8de('0x4e')](_0x3cc136[_0xe8de('0x46')]['limit']);_0x9e5dcc[_0xe8de('0x2c')]=qs['offset'](_0x3cc136[_0xe8de('0x46')][_0xe8de('0x2c')]);}_0x9e5dcc['order']=qs['sort'](_0x3cc136[_0xe8de('0x46')][_0xe8de('0x50')]);_0x9e5dcc[_0xe8de('0x51')]=qs['filters'](_[_0xe8de('0x52')](_0x3cc136[_0xe8de('0x46')],_0x1892f8[_0xe8de('0x47')]));_0x9e5dcc[_0xe8de('0x51')][_0xe8de('0x69')]=_0x436557['id'];if(_0x3cc136[_0xe8de('0x46')][_0xe8de('0x53')]){_0x9e5dcc[_0xe8de('0x51')]=_[_0xe8de('0x54')](_0x9e5dcc[_0xe8de('0x51')],{'$or':_[_0xe8de('0x44')](_0x9e5dcc['attributes'],function(_0x3e41a5){var _0x5cbff8={};_0x5cbff8[_0x3e41a5]={'$like':'%'+_0x3cc136[_0xe8de('0x46')][_0xe8de('0x53')]+'%'};return _0x5cbff8;})});}_0x9e5dcc=_[_0xe8de('0x54')]({},_0x9e5dcc,_0x3cc136[_0xe8de('0x5b')]);return db[_0xe8de('0x6d')][_0xe8de('0x2e')]({'where':_0x9e5dcc[_0xe8de('0x51')]})[_0xe8de('0x34')](function(_0x481555){_0x17ad1d[_0xe8de('0x2e')]=_0x481555;if(_0x3cc136[_0xe8de('0x46')][_0xe8de('0x56')]){_0x9e5dcc['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xe8de('0x58')](_0x9e5dcc);})[_0xe8de('0x34')](function(_0x54ec02){_0x17ad1d[_0xe8de('0x6e')]=_0x54ec02;return _0x17ad1d;});}})[_0xe8de('0x34')](respondWithFilteredResult(_0x19550b,_0x9e5dcc))['catch'](handleError(_0x19550b,null));};exports['removeAnswers']=function(_0xae55e,_0x43b1bd,_0x5aae19){return db[_0xe8de('0x3f')][_0xe8de('0x5c')]({'where':{'id':_0xae55e[_0xe8de('0x59')]['id']}})['then'](handleEntityNotFound(_0x43b1bd,null))[_0xe8de('0x34')](function(_0x13c932){if(_0x13c932){return _0x13c932['removeAnswers'](_0xae55e[_0xe8de('0x46')][_0xe8de('0x6b')]);}})[_0xe8de('0x34')](respondWithStatusCode(_0x43b1bd,null))[_0xe8de('0x29')](handleError(_0x43b1bd,null));};exports[_0xe8de('0x6f')]=function(_0x3aea2c,_0x3ede21,_0x14612b){return db[_0xe8de('0x3f')][_0xe8de('0x5c')]({'where':{'id':_0x3aea2c[_0xe8de('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ede21,null))[_0xe8de('0x34')](function(_0x5a3e30){if(_0x5a3e30){return _0x5a3e30[_0xe8de('0x6f')](_0x3aea2c['body']['ids'],_[_0xe8de('0x70')](_0x3aea2c[_0xe8de('0x5e')],['ids','id'])||{})[_0xe8de('0x71')](function(_0x457dba){for(var _0x309d23=0x0;_0x309d23<_0x3aea2c[_0xe8de('0x5e')][_0xe8de('0x6b')][_0xe8de('0x4b')];_0x309d23+=0x1){socket[_0xe8de('0x72')]('userWhatsappAccount:save',{'UserId':Number(_0x3aea2c[_0xe8de('0x5e')][_0xe8de('0x6b')][_0x309d23]),'WhatsappAccountId':Number(_0x3aea2c[_0xe8de('0x59')]['id'])});}return _0x457dba;});}})[_0xe8de('0x34')](respondWithResult(_0x3ede21,null))['catch'](handleError(_0x3ede21,null));};exports[_0xe8de('0x73')]=function(_0x45a2a9,_0x32b977,_0xb3addc){return db[_0xe8de('0x3f')]['find']({'where':{'id':_0x45a2a9['params']['id']}})[_0xe8de('0x34')](handleEntityNotFound(_0x32b977,null))[_0xe8de('0x34')](function(_0x318907){if(_0x318907){return _0x318907[_0xe8de('0x73')](_0x45a2a9[_0xe8de('0x46')][_0xe8de('0x6b')])[_0xe8de('0x34')](function(){if(_[_0xe8de('0x74')](_0x45a2a9[_0xe8de('0x46')][_0xe8de('0x6b')])){for(var _0x2e1516=0x0;_0x2e1516<_0x45a2a9[_0xe8de('0x46')][_0xe8de('0x6b')][_0xe8de('0x4b')];_0x2e1516+=0x1){socket[_0xe8de('0x72')](_0xe8de('0x75'),{'UserId':Number(_0x45a2a9['query'][_0xe8de('0x6b')][_0x2e1516]),'WhatsappAccountId':Number(_0x45a2a9[_0xe8de('0x59')]['id'])});}}else{socket[_0xe8de('0x72')](_0xe8de('0x75'),{'UserId':Number(_0x45a2a9[_0xe8de('0x46')]['ids']),'WhatsappAccountId':Number(_0x45a2a9[_0xe8de('0x59')]['id'])});}});}})[_0xe8de('0x34')](respondWithStatusCode(_0x32b977,null))[_0xe8de('0x29')](handleError(_0x32b977,null));};exports['getAgents']=function(_0x3304a7,_0x30b6ea,_0x3a2bba){var _0x5ec331={};var _0x225664={};var _0x14c73b;var _0x2eb9fc;return db[_0xe8de('0x3f')]['findOne']({'where':{'id':_0x3304a7[_0xe8de('0x59')]['id']}})[_0xe8de('0x34')](handleEntityNotFound(_0x30b6ea,null))['then'](function(_0x580376){if(_0x580376){_0x14c73b=_0x580376;_0x225664[_0xe8de('0x43')]=_['keys'](db[_0xe8de('0x76')]['rawAttributes']);_0x225664[_0xe8de('0x46')]=_['keys'](_0x3304a7['query']);_0x225664[_0xe8de('0x47')]=_[_0xe8de('0x48')](_0x225664['model'],_0x225664['query']);_0x5ec331[_0xe8de('0x49')]=_[_0xe8de('0x48')](_0x225664[_0xe8de('0x43')],qs[_0xe8de('0x4a')](_0x3304a7[_0xe8de('0x46')][_0xe8de('0x4a')]));_0x5ec331[_0xe8de('0x49')]=_0x5ec331[_0xe8de('0x49')]['length']?_0x5ec331['attributes']:_0x225664[_0xe8de('0x43')];_0x5ec331[_0xe8de('0x4f')]=qs[_0xe8de('0x50')](_0x3304a7['query'][_0xe8de('0x50')]);_0x5ec331['where']=qs[_0xe8de('0x47')](_['pick'](_0x3304a7[_0xe8de('0x46')],_0x225664[_0xe8de('0x47')]));if(_0x3304a7[_0xe8de('0x46')][_0xe8de('0x53')]){_0x5ec331['where']=_[_0xe8de('0x54')](_0x5ec331[_0xe8de('0x51')],{'$or':_[_0xe8de('0x44')](_0x5ec331[_0xe8de('0x49')],function(_0x24944e){var _0x3e0634={};_0x3e0634[_0x24944e]={'$like':'%'+_0x3304a7[_0xe8de('0x46')]['filter']+'%'};return _0x3e0634;})});}_0x5ec331=_['merge']({},_0x5ec331,_0x3304a7['options']);return _0x14c73b[_0xe8de('0x77')](_0x5ec331);}})[_0xe8de('0x34')](function(_0x3d0901){if(_0x3d0901){_0x2eb9fc=_0x3d0901['length'];if(!_0x3304a7[_0xe8de('0x46')][_0xe8de('0x4c')](_0xe8de('0x4d'))){_0x5ec331[_0xe8de('0x4e')]=qs['limit'](_0x3304a7[_0xe8de('0x46')][_0xe8de('0x4e')]);_0x5ec331[_0xe8de('0x2c')]=qs[_0xe8de('0x2c')](_0x3304a7[_0xe8de('0x46')][_0xe8de('0x2c')]);}return _0x14c73b[_0xe8de('0x77')](_0x5ec331);}})[_0xe8de('0x34')](function(_0xf19712){if(_0xf19712){return _0xf19712?{'count':_0x2eb9fc,'rows':_0xf19712}:null;}})[_0xe8de('0x34')](respondWithResult(_0x30b6ea,null))[_0xe8de('0x29')](handleError(_0x30b6ea,null));};exports[_0xe8de('0x78')]=function(_0x145af9,_0x3e233e){var _0x186402=_0x145af9[_0xe8de('0x59')]['id'];var _0x332143=_0x145af9[_0xe8de('0x5e')];var _0x2c2254=0xc8;var _0xe0eb7a=null;return db['sequelize'][_0xe8de('0x79')]({'isolationLevel':db[_0xe8de('0x7a')][_0xe8de('0x7b')]['ISOLATION_LEVELS'][_0xe8de('0x7c')]},function(_0xf8c02d){return db[_0xe8de('0x3f')][_0xe8de('0x68')]({'where':{'id':_0x186402},'transaction':_0xf8c02d})[_0xe8de('0x34')](function(_0xb206ce){if(_0xb206ce){return db[_0xe8de('0x7d')][_0xe8de('0x35')]({'where':{'WhatsappAccountId':_0x186402},'transaction':_0xf8c02d})['then'](function(){var _0x2f8ab0=_[_0xe8de('0x44')](_0x332143,function(_0x1a100e){_0x1a100e['WhatsappAccountId']=_0x186402;return _0x1a100e;});return db['WhatsappApplication']['bulkCreate'](_0x2f8ab0,{'transaction':_0xf8c02d});});}else{_0x2c2254=0x194;_0xe0eb7a=[];}});})[_0xe8de('0x34')](function(){if(_0x2c2254!==0x194){return db[_0xe8de('0x7d')][_0xe8de('0x7e')]({'where':{'WhatsappAccountId':_0x186402},'order':_0xe8de('0x7f')})[_0xe8de('0x34')](function(_0x54de30){_0xe0eb7a=_0x54de30;});}})[_0xe8de('0x29')](function(_0x3ef05f){_0x2c2254=0x1f4;logger[_0xe8de('0x26')](_0x3ef05f['stack']);if(_0x3ef05f[_0xe8de('0x3a')]){delete _0x3ef05f[_0xe8de('0x3a')];}_0xe0eb7a=_0x3ef05f;})[_0xe8de('0x80')](function(){if(_0xe0eb7a===null){_0x3e233e['sendStatus'](_0x2c2254);}else{if(_0x2c2254===0x1f4){_0x3e233e[_0xe8de('0x38')](_0x2c2254)['send'](_0xe0eb7a);}else{_0x3e233e[_0xe8de('0x38')](_0x2c2254)['json'](_0xe0eb7a);}}});};exports[_0xe8de('0x81')]=function(_0x47bef6,_0x307a83,_0x218316){var _0xd9974b={};var _0xb013b3={};var _0xdce56;var _0x37cc18;return db[_0xe8de('0x3f')][_0xe8de('0x68')]({'where':{'id':_0x47bef6[_0xe8de('0x59')]['id']}})['then'](handleEntityNotFound(_0x307a83,null))[_0xe8de('0x34')](function(_0x15fe5e){if(_0x15fe5e){_0xdce56=_0x15fe5e;_0xb013b3[_0xe8de('0x43')]=_[_0xe8de('0x45')](db[_0xe8de('0x7d')]['rawAttributes']);_0xb013b3[_0xe8de('0x46')]=_[_0xe8de('0x45')](_0x47bef6['query']);_0xb013b3[_0xe8de('0x47')]=_['intersection'](_0xb013b3[_0xe8de('0x43')],_0xb013b3['query']);_0xd9974b['attributes']=_['intersection'](_0xb013b3[_0xe8de('0x43')],qs[_0xe8de('0x4a')](_0x47bef6['query'][_0xe8de('0x4a')]));_0xd9974b[_0xe8de('0x49')]=_0xd9974b[_0xe8de('0x49')][_0xe8de('0x4b')]?_0xd9974b[_0xe8de('0x49')]:_0xb013b3['model'];_0xd9974b[_0xe8de('0x4f')]=qs[_0xe8de('0x50')](_0x47bef6[_0xe8de('0x46')][_0xe8de('0x50')]);_0xd9974b[_0xe8de('0x51')]=qs['filters'](_['pick'](_0x47bef6[_0xe8de('0x46')],_0xb013b3[_0xe8de('0x47')]));if(_0x47bef6['query'][_0xe8de('0x53')]){_0xd9974b[_0xe8de('0x51')]=_[_0xe8de('0x54')](_0xd9974b[_0xe8de('0x51')],{'$or':_[_0xe8de('0x44')](_0xd9974b[_0xe8de('0x49')],function(_0x3ee501){var _0x238cf5={};_0x238cf5[_0x3ee501]={'$like':'%'+_0x47bef6[_0xe8de('0x46')][_0xe8de('0x53')]+'%'};return _0x238cf5;})});}_0xd9974b=_[_0xe8de('0x54')]({},_0xd9974b,_0x47bef6['options']);return _0xdce56[_0xe8de('0x81')](_0xd9974b);}})[_0xe8de('0x34')](function(_0x2d81d2){if(_0x2d81d2){_0x37cc18=_0x2d81d2[_0xe8de('0x4b')];if(!_0x47bef6[_0xe8de('0x46')][_0xe8de('0x4c')](_0xe8de('0x4d'))){_0xd9974b[_0xe8de('0x4e')]=qs[_0xe8de('0x4e')](_0x47bef6[_0xe8de('0x46')]['limit']);_0xd9974b[_0xe8de('0x2c')]=qs[_0xe8de('0x2c')](_0x47bef6[_0xe8de('0x46')][_0xe8de('0x2c')]);}return _0xdce56[_0xe8de('0x81')](_0xd9974b);}})[_0xe8de('0x34')](function(_0x5481b9){if(_0x5481b9){return _0x5481b9?{'count':_0x37cc18,'rows':_0x5481b9}:null;}})[_0xe8de('0x34')](respondWithResult(_0x307a83,null))[_0xe8de('0x29')](handleError(_0x307a83,null));};exports[_0xe8de('0x82')]=function(_0x38d0ca,_0x3104d4,_0x57df23){var _0x2b0ab1={'channel':_0xe8de('0x83')};var _0x27c8a0=[];var _0x510ea9=[];var _0x8d7669={};return db[_0xe8de('0x3f')][_0xe8de('0x5c')]({'where':{'id':_0x38d0ca[_0xe8de('0x59')]['id']},'include':[{'model':db[_0xe8de('0x7d')],'as':_0xe8de('0x84')}]})['then'](handleEntityNotFound(_0x3104d4,null))['then'](function(_0x26aa23){_0x2b0ab1[_0xe8de('0x85')]=_0x26aa23;if(_0x2b0ab1[_0xe8de('0x85')]&&_0x2b0ab1['account']['type']==='sinch'&&_0x38d0ca[_0xe8de('0x5e')][_0xe8de('0x86')]){if(_0x38d0ca[_0xe8de('0x5e')][_0xe8de('0x86')][_0xe8de('0x4b')]===0x0)return;if(_0x38d0ca[_0xe8de('0x5e')][_0xe8de('0x86')][0x0][_0xe8de('0x87')]!==_0xe8de('0x88'))return;return db['WhatsappMessage'][_0xe8de('0x33')]({'read':!![],'readAt':_0x38d0ca['body'][_0xe8de('0x86')][0x0][_0xe8de('0x89')]},{'where':{'messageId':_0x38d0ca[_0xe8de('0x5e')][_0xe8de('0x86')][0x0][_0xe8de('0x8a')]},'individualHooks':!![]})[_0xe8de('0x34')](function(_0x579108){return _0x3104d4[_0xe8de('0x38')](0xc8)[_0xe8de('0x31')](_0x579108);});}_0x2b0ab1[_0xe8de('0x8b')]=_[_0xe8de('0x8c')](_0x26aa23[_0xe8de('0x84')],[_0xe8de('0x7f')],[_0xe8de('0x8d')]);if(_0x2b0ab1[_0xe8de('0x85')][_0xe8de('0x84')]){delete _0x2b0ab1['account']['Applications'];}return db[_0xe8de('0x8e')][_0xe8de('0x65')]()[_0xe8de('0x34')](function(_0x3b65bc){if(!_0x3b65bc){throw new db[(_0xe8de('0x8f'))]['ValidationError'](_0xe8de('0x90'));}_0x27c8a0=_[_0xe8de('0x91')](_[_0xe8de('0x45')](_0x3b65bc),[_0xe8de('0x92'),'updatedAt']);_0x510ea9=_[_0xe8de('0x91')](_[_0xe8de('0x45')](_0x3b65bc),['createdAt','updatedAt','CompanyId','ListId']);_0x2b0ab1[_0xe8de('0x5e')]={'mapKey':'mobile'};if(_0x2b0ab1[_0xe8de('0x85')]&&_0x2b0ab1[_0xe8de('0x85')][_0xe8de('0x41')]===_0xe8de('0x93')){_0x2b0ab1[_0xe8de('0x5e')]['from']=_0x38d0ca[_0xe8de('0x5e')][_0xe8de('0x94')][_0xe8de('0x95')]('whatsapp:','');_0x2b0ab1['body'][_0xe8de('0x5e')]=_0x38d0ca[_0xe8de('0x5e')][_0xe8de('0x96')];_0x2b0ab1[_0xe8de('0x5e')]['messageId']=_0x38d0ca[_0xe8de('0x5e')][_0xe8de('0x97')];}if(_0x2b0ab1['account']&&_0x2b0ab1['account']['type']===_0xe8de('0x98')){_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x99')]=_0x38d0ca['body']['notifications'][0x0][_0xe8de('0x99')];_0x2b0ab1['body']['body']=_0x38d0ca[_0xe8de('0x5e')][_0xe8de('0x9a')][0x0][_0xe8de('0x27')][_0xe8de('0x5e')];_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x9b')]=_0x38d0ca[_0xe8de('0x5e')][_0xe8de('0x9a')][0x0][_0xe8de('0x8a')];}if(_0x2b0ab1['body']['id']){delete _0x2b0ab1[_0xe8de('0x5e')]['id'];}if(_[_0xe8de('0x9c')](_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x99')])){throw new db['Sequelize'][(_0xe8de('0x9d'))]('from\x20is\x20mandatory');}if(_[_0xe8de('0x9c')](_0x2b0ab1[_0xe8de('0x5e')]['body'])||_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x5e')]===''){throw new db[(_0xe8de('0x8f'))][(_0xe8de('0x9d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe8de('0x9c')](_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x9e')])){throw new db[(_0xe8de('0x8f'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x510ea9);}if(!_[_0xe8de('0x9f')](_0x510ea9,_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x9e')])){throw new db[(_0xe8de('0x8f'))][(_0xe8de('0x9d'))](_0xe8de('0xa0')+_0x510ea9);}_0x8d7669[_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x9e')]]=_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x99')];return db['CmList']['find']({'where':{'id':_0x2b0ab1['account'][_0xe8de('0xa1')]},'include':[{'model':db[_0xe8de('0x8e')],'as':_0xe8de('0xa2'),'where':_0x8d7669,'limit':0x1,'order':[[_0xe8de('0xa3'),'DESC']]}]});})[_0xe8de('0x34')](handleEntityNotFound(_0x3104d4,null))[_0xe8de('0x34')](function(_0x1796a9){if(_0x1796a9){_0x2b0ab1[_0xe8de('0xa4')]=_[_0xe8de('0x70')](_0x1796a9,[_0xe8de('0xa2')]);if(_0x1796a9[_0xe8de('0xa2')][_0xe8de('0x4b')]){return _0x1796a9['Contacts'][0x0];}var _0x11785e=_['defaults'](_0x2b0ab1[_0xe8de('0x5e')],{'firstName':_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x99')],'ListId':_0x1796a9['id']});_0x11785e[_0x2b0ab1['body']['mapKey']]=_0x2b0ab1[_0xe8de('0x5e')]['from'];return db['CmContact'][_0xe8de('0x5d')](_0x11785e,{'fields':_0x27c8a0,'raw':!![]});}})[_0xe8de('0x34')](handleEntityNotFound(_0x3104d4,null))[_0xe8de('0x34')](function(_0x1403d1){if(_0x1403d1){_0x2b0ab1[_0xe8de('0xa5')]=_0x1403d1;var _0x4a93a6={'ContactId':_0x1403d1['id'],'phone':_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x99')],'WhatsappAccountId':_0x38d0ca[_0xe8de('0x59')]['id']};var _0x40955b={'ContactId':_0x1403d1['id'],'WhatsappAccountId':_0x38d0ca[_0xe8de('0x59')]['id'],'closed':![]};return db[_0xe8de('0xa6')][_0xe8de('0x5c')]({'where':_0x40955b})[_0xe8de('0x34')](function(_0x1ba08d){if(_0x1ba08d){return[_0x1ba08d,![]];}return db[_0xe8de('0xa6')][_0xe8de('0x5d')](_0x4a93a6)[_0xe8de('0x34')](function(_0x351287){return[_0x351287,!![]];});});}})[_0xe8de('0x71')](function(_0x1d5a33,_0x4df4b8){_0x2b0ab1[_0xe8de('0xa7')]=_0x1d5a33['get']({'plain':!![]});_0x2b0ab1[_0xe8de('0xa7')][_0xe8de('0xa8')]=![];if(_0x4df4b8){if(_0x2b0ab1['account']['autoclose']){_0x2b0ab1['applications']['push']({'id':0x0,'priority':_0x2b0ab1[_0xe8de('0x8b')][_0xe8de('0x4b')]+0x1,'app':'close','appdata':_0xe8de('0xa9'),'interval':_0xe8de('0xaa')});}_0x2b0ab1[_0xe8de('0xa7')][_0xe8de('0xa8')]=!![];}return db[_0xe8de('0xab')][_0xe8de('0x5d')]({'phone':_0x2b0ab1['body'][_0xe8de('0x99')],'messageId':_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0x9b')],'body':_0x2b0ab1['body'][_0xe8de('0x5e')],'WhatsappAccountId':_0x38d0ca['params']['id'],'WhatsappInteractionId':_0x1d5a33['id'],'direction':'in','ContactId':_0x1d5a33[_0xe8de('0xac')],'AttachmentId':_0x2b0ab1[_0xe8de('0x5e')][_0xe8de('0xad')]});})['then'](function(_0x866df4){_0x2b0ab1[_0xe8de('0x27')]=_0x866df4;if(_0x2b0ab1[_0xe8de('0xa7')][_0xe8de('0xae')]){return db[_0xe8de('0x76')][_0xe8de('0x5c')]({'attributes':['id',_0xe8de('0x3a')],'where':{'id':_0x2b0ab1['interaction']['UserId']}})[_0xe8de('0x34')](function(_0x4e05e6){if(_0x4e05e6){_0x2b0ab1[_0xe8de('0x8b')][_0xe8de('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4e05e6[_0xe8de('0x3a')]+','+(_0x2b0ab1[_0xe8de('0x85')][_0xe8de('0xb0')]||0xa),'interval':_0xe8de('0xaa')});}return respondWithRpcPromise('Start',_0xe8de('0xb1'),_0x2b0ab1);});}return respondWithRpcPromise(_0xe8de('0xb2'),_0xe8de('0xb1'),_0x2b0ab1);})['then'](function(_0x2adb5f){if(_0x2adb5f){var _0x410120=0xc8;var _0x3db709=_0xe8de('0xb3');logger['info'](_0xe8de('0x24'),_0x3db709,_0x410120,'entity\x20found');logger[_0xe8de('0x23')](_0xe8de('0xb4'),_0x3db709,_0x410120,_0xe8de('0xb5'),JSON['stringify'](_0x2adb5f));if(_0x2b0ab1[_0xe8de('0x85')][_0xe8de('0x41')]===_0xe8de('0x93')){return _0x3104d4['status'](_0x410120)[_0xe8de('0x2f')](_0xe8de('0xb6'),_0xe8de('0xb7'))['send'](_0xe8de('0xb8'));}else{return _0x3104d4['status'](_0x410120)['json'](_0x2adb5f);}}});})[_0xe8de('0x29')](handleError(_0x3104d4,null));};exports[_0xe8de('0x3b')]=function(_0x7a48d9,_0x36c1c4,_0x3f0e34){var _0x45e697,_0x2253ee,_0x13e596;if(_[_0xe8de('0x9c')](_0x7a48d9[_0xe8de('0x5e')][_0xe8de('0x5e')])||_0x7a48d9[_0xe8de('0x5e')]['body']===''){throw new db['Sequelize'][(_0xe8de('0x9d'))](_0xe8de('0xb9'));}if(_[_0xe8de('0x9c')](_0x7a48d9[_0xe8de('0x5e')]['to'])){throw new db[(_0xe8de('0x8f'))][(_0xe8de('0x9d'))]('to\x20is\x20mandatory');}_0x45e697=_0x7a48d9[_0xe8de('0x5e')]['to'];return db[_0xe8de('0x3f')]['find']({'where':{'id':_0x7a48d9[_0xe8de('0x59')]['id']},'include':[{'model':db[_0xe8de('0xba')],'as':_0xe8de('0xbb'),'include':[{'model':db[_0xe8de('0x8e')],'as':_0xe8de('0xa2'),'where':{'mobile':_0x45e697},'limit':0x1,'order':[[_0xe8de('0xa3'),_0xe8de('0xbc')]]}]}]})[_0xe8de('0x34')](handleEntityNotFound(_0x36c1c4,null))[_0xe8de('0x34')](function(_0x36ee74){if(_0x36ee74&&_0x36ee74['List']){_0x2253ee=_0x36ee74[_0xe8de('0x36')]({'plain':!![]});if(_0x2253ee[_0xe8de('0xbb')]&&_0x2253ee[_0xe8de('0xbb')][_0xe8de('0xa2')][_0xe8de('0x4b')]){return _0x2253ee[_0xe8de('0xbb')]['Contacts'][0x0];}return db[_0xe8de('0x8e')][_0xe8de('0x5d')](_[_0xe8de('0xbd')](_0x7a48d9[_0xe8de('0x5e')],{'firstName':_0x45e697,'mobile':_0x45e697,'phone':_0x45e697,'ListId':_0x2253ee[_0xe8de('0xa1')]}));}})[_0xe8de('0x34')](handleEntityNotFound(_0x36c1c4,null))['then'](function(_0x1d2a63){if(_0x1d2a63){_0x13e596=_0x1d2a63;return db[_0xe8de('0xa6')][_0xe8de('0x5c')]({'where':{'ContactId':_0x13e596['id'],'closed':![],'WhatsappAccountId':_0x2253ee['id']}})['then'](function(_0x40292d){if(_0x40292d){return[_0x40292d,![]];}return db[_0xe8de('0xa6')]['create']({'UserId':_0x7a48d9['user']['id'],'ContactId':_0x13e596['id'],'WhatsappAccountId':_0x2253ee['id'],'phone':_0x45e697,'firstMsgDirection':_0xe8de('0xbe'),'Messages':[_['merge'](_0x7a48d9[_0xe8de('0x5e')],{'read':![],'body':_0x7a48d9[_0xe8de('0x5e')][_0xe8de('0x5e')],'phone':_0x45e697,'WhatsappAccountId':_0x2253ee['id'],'UserId':_0x7a48d9[_0xe8de('0x5f')]['id'],'ContactId':_0x13e596['id']})]},{'include':[{'model':db[_0xe8de('0xab')],'as':_0xe8de('0xbf')}]})[_0xe8de('0x34')](function(_0x2a5e2d){return[_0x2a5e2d,!![]];});});}})[_0xe8de('0x71')](function(_0x5db131,_0x43aa38){if(_0x43aa38){return _0x5db131;}return db[_0xe8de('0xab')][_0xe8de('0x5d')](_[_0xe8de('0x54')](_0x7a48d9[_0xe8de('0x5e')],{'read':![],'body':_0x7a48d9['body'][_0xe8de('0x5e')],'phone':_0x45e697,'WhatsappAccountId':_0x2253ee['id'],'WhatsappInteractionId':_0x5db131['id'],'UserId':_0x7a48d9[_0xe8de('0x5f')]['id'],'ContactId':_0x13e596['id']}))['then'](function(_0x40d0b8){_0x5db131[_0xe8de('0xc0')]['Messages']=[];_0x5db131[_0xe8de('0xc0')][_0xe8de('0xbf')][_0xe8de('0xc1')](_0x40d0b8['dataValues']);return _0x5db131;});})[_0xe8de('0x34')](respondWithResult(_0x36c1c4,null))['catch'](handleError(_0x36c1c4,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 3520127..9567b8f 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 _0xd52a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xd52a,0x1e8));var _0xad52=function(_0x714a43,_0x1181e1){_0x714a43=_0x714a43-0x0;var _0x480734=_0xd52a[_0x714a43];return _0x480734;};'use strict';var EventEmitter=require(_0xad52('0x0'));var WhatsappAccount=require(_0xad52('0x1'))['db'][_0xad52('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xad52('0x3')](0x0);var events={'afterCreate':_0xad52('0x4'),'afterUpdate':_0xad52('0x5'),'afterDestroy':_0xad52('0x6')};function emitEvent(_0x397572){return function(_0x3e6593,_0x17669e,_0x5a117f){WhatsappAccountEvents[_0xad52('0x7')](_0x397572+':'+_0x3e6593['id'],_0x3e6593);WhatsappAccountEvents[_0xad52('0x7')](_0x397572,_0x3e6593);_0x5a117f(null);};}for(var e in events){if(events[_0xad52('0x8')](e)){var event=events[e];WhatsappAccount[_0xad52('0x9')](e,emitEvent(event));}}module[_0xad52('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0x3b6f=['WhatsappAccount','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3008b1,_0x2a89f){var _0x1922d9=function(_0x3ad7bf){while(--_0x3ad7bf){_0x3008b1['push'](_0x3008b1['shift']());}};_0x1922d9(++_0x2a89f);}(_0x3b6f,0x127));var _0xf3b6=function(_0x24d194,_0x5b51be){_0x24d194=_0x24d194-0x0;var _0x38e722=_0x3b6f[_0x24d194];return _0x38e722;};'use strict';var EventEmitter=require(_0xf3b6('0x0'));var WhatsappAccount=require(_0xf3b6('0x1'))['db'][_0xf3b6('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf3b6('0x3')](0x0);var events={'afterCreate':_0xf3b6('0x4'),'afterUpdate':_0xf3b6('0x5'),'afterDestroy':_0xf3b6('0x6')};function emitEvent(_0x501929){return function(_0x150e79,_0x3815a8,_0x52f4cb){WhatsappAccountEvents[_0xf3b6('0x7')](_0x501929+':'+_0x150e79['id'],_0x150e79);WhatsappAccountEvents[_0xf3b6('0x7')](_0x501929,_0x150e79);_0x52f4cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xf3b6('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 b88c560..25f5a51 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 _0xa022=['path','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0xade274,_0x13b8dc){var _0x45a9db=function(_0x30b3f9){while(--_0x30b3f9){_0xade274['push'](_0xade274['shift']());}};_0x45a9db(++_0x13b8dc);}(_0xa022,0xcc));var _0x2a02=function(_0x16ba0c,_0x5b2c36){_0x16ba0c=_0x16ba0c-0x0;var _0x454dd5=_0xa022[_0x16ba0c];return _0x454dd5;};'use strict';var _=require(_0x2a02('0x0'));var util=require('util');var logger=require(_0x2a02('0x1'))(_0x2a02('0x2'));var moment=require(_0x2a02('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a02('0x4'));var fs=require('fs');var path=require(_0x2a02('0x5'));var rimraf=require(_0x2a02('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a02('0x7'));module['exports']=function(_0x285958,_0x1c0882){return _0x285958[_0x2a02('0x8')](_0x2a02('0x9'),attributes,{'tableName':_0x2a02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12df=['exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x12df,0x12e));var _0xf12d=function(_0x2640a6,_0x3dcf95){_0x2640a6=_0x2640a6-0x0;var _0x3b6b5f=_0x12df[_0x2640a6];return _0x3b6b5f;};'use strict';var _=require(_0xf12d('0x0'));var util=require(_0xf12d('0x1'));var logger=require(_0xf12d('0x2'))(_0xf12d('0x3'));var moment=require(_0xf12d('0x4'));var BPromise=require(_0xf12d('0x5'));var rp=require(_0xf12d('0x6'));var fs=require('fs');var path=require(_0xf12d('0x7'));var rimraf=require(_0xf12d('0x8'));var config=require('../../config/environment');var attributes=require(_0xf12d('0x9'));module[_0xf12d('0xa')]=function(_0x470f7e,_0x2229c5){return _0x470f7e[_0xf12d('0xb')]('WhatsappAccount',attributes,{'tableName':_0xf12d('0xc'),'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 4f8603b..918f660 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 _0x24a9=['rpc','../../config/environment','jayson/promise','client','redis','defaults','register','request','then','info','request\x20sent','debug','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','ShowWhatsappAccount','find','options','where','attributes','model','include','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x28770f,_0x5cff78){var _0x51bfe2=function(_0x332e8c){while(--_0x332e8c){_0x28770f['push'](_0x28770f['shift']());}};_0x51bfe2(++_0x5cff78);}(_0x24a9,0xf9));var _0x924a=function(_0x1e7223,_0x1a2b0d){_0x1e7223=_0x1e7223-0x0;var _0x153a78=_0x24a9[_0x1e7223];return _0x153a78;};'use strict';var _=require(_0x924a('0x0'));var util=require(_0x924a('0x1'));var moment=require('moment');var BPromise=require(_0x924a('0x2'));var rs=require(_0x924a('0x3'));var fs=require('fs');var Redis=require(_0x924a('0x4'));var db=require(_0x924a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x924a('0x6'))(_0x924a('0x7'));var config=require(_0x924a('0x8'));var jayson=require(_0x924a('0x9'));var client=jayson[_0x924a('0xa')]['http']({'port':0x232a});config[_0x924a('0xb')]=_[_0x924a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x924a('0xb')]));require('./whatsappAccount.socket')[_0x924a('0xd')](socket);function respondWithRpcPromise(_0x40dade,_0xf0e80a,_0x2b1b12){return new BPromise(function(_0x50bd14,_0x44dfe4){return client[_0x924a('0xe')](_0x40dade,_0x2b1b12)[_0x924a('0xf')](function(_0x1e0907){logger[_0x924a('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0xf0e80a,_0x924a('0x11'));logger[_0x924a('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xf0e80a,_0x924a('0x11'),JSON['stringify'](_0x1e0907));if(_0x1e0907[_0x924a('0x13')]){if(_0x1e0907['error'][_0x924a('0x14')]===0x1f4){logger[_0x924a('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xf0e80a,_0x1e0907[_0x924a('0x13')][_0x924a('0x15')]);return _0x44dfe4(_0x1e0907['error'][_0x924a('0x15')]);}logger[_0x924a('0x13')](_0x924a('0x16'),_0xf0e80a,_0x1e0907[_0x924a('0x13')][_0x924a('0x15')]);return _0x50bd14(_0x1e0907[_0x924a('0x13')][_0x924a('0x15')]);}else{logger[_0x924a('0x10')](_0x924a('0x16'),_0xf0e80a,'request\x20sent');_0x50bd14(_0x1e0907[_0x924a('0x17')][_0x924a('0x15')]);}})[_0x924a('0x18')](function(_0x5c2e5f){logger[_0x924a('0x13')](_0x924a('0x16'),_0xf0e80a,_0x5c2e5f);_0x44dfe4(_0x5c2e5f);});});}exports[_0x924a('0x19')]=function(_0x390e71){var _0x48d54d=this;return new Promise(function(_0x157342,_0xb86ce5){return db['WhatsappAccount'][_0x924a('0x1a')]({'raw':_0x390e71[_0x924a('0x1b')]?_0x390e71['options']['raw']===undefined?!![]:![]:!![],'where':_0x390e71[_0x924a('0x1b')]?_0x390e71[_0x924a('0x1b')][_0x924a('0x1c')]||null:null,'attributes':_0x390e71['options']?_0x390e71[_0x924a('0x1b')][_0x924a('0x1d')]||null:null,'include':_0x390e71['options']?_0x390e71[_0x924a('0x1b')]['include']?_['map'](_0x390e71[_0x924a('0x1b')]['include'],function(_0x2734d2){return{'model':db[_0x2734d2[_0x924a('0x1e')]],'as':_0x2734d2['as'],'attributes':_0x2734d2[_0x924a('0x1d')],'include':_0x2734d2[_0x924a('0x1f')]?_['map'](_0x2734d2[_0x924a('0x1f')],function(_0x5f2dec){return{'model':db[_0x5f2dec[_0x924a('0x1e')]],'as':_0x5f2dec['as'],'attributes':_0x5f2dec['attributes'],'include':_0x5f2dec['include']?_['map'](_0x5f2dec[_0x924a('0x1f')],function(_0x5a67c5){return{'model':db[_0x5a67c5[_0x924a('0x1e')]],'as':_0x5a67c5['as'],'attributes':_0x5a67c5[_0x924a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x924a('0xf')](function(_0x157add){logger[_0x924a('0x10')](_0x924a('0x19'),_0x390e71);logger[_0x924a('0x12')](_0x924a('0x19'),_0x390e71,JSON['stringify'](_0x157add));_0x157342(_0x157add);})[_0x924a('0x18')](function(_0x3bed28){logger[_0x924a('0x13')](_0x924a('0x19'),_0x3bed28[_0x924a('0x15')],_0x390e71);_0xb86ce5(_0x48d54d[_0x924a('0x13')](0x1f4,_0x3bed28[_0x924a('0x15')]));});});}; \ No newline at end of file +var _0x7116=['socket.io-emitter','./whatsappAccount.socket','register','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappAccount','find','raw','options','where','attributes','include','map','model','ShowWhatsappAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost'];(function(_0x2fc5a7,_0x1fe320){var _0x99831=function(_0x297e6c){while(--_0x297e6c){_0x2fc5a7['push'](_0x2fc5a7['shift']());}};_0x99831(++_0x1fe320);}(_0x7116,0x17f));var _0x6711=function(_0x41be5f,_0xe91905){_0x41be5f=_0x41be5f-0x0;var _0x2f546a=_0x7116[_0x41be5f];return _0x2f546a;};'use strict';var _=require(_0x6711('0x0'));var util=require('util');var moment=require(_0x6711('0x1'));var BPromise=require(_0x6711('0x2'));var rs=require(_0x6711('0x3'));var fs=require('fs');var Redis=require(_0x6711('0x4'));var db=require(_0x6711('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6711('0x6'))(_0x6711('0x7'));var config=require(_0x6711('0x8'));var jayson=require(_0x6711('0x9'));var client=jayson[_0x6711('0xa')]['http']({'port':0x232a});config[_0x6711('0xb')]=_['defaults'](config[_0x6711('0xb')],{'host':_0x6711('0xc'),'port':0x18eb});var socket=require(_0x6711('0xd'))(new Redis(config['redis']));require(_0x6711('0xe'))[_0x6711('0xf')](socket);function respondWithRpcPromise(_0x46e804,_0x4216a5,_0x105f67){return new BPromise(function(_0x27c49b,_0x4bd938){return client['request'](_0x46e804,_0x105f67)['then'](function(_0x3533d7){logger[_0x6711('0x10')](_0x6711('0x11'),_0x4216a5,_0x6711('0x12'));logger[_0x6711('0x13')](_0x6711('0x14'),_0x4216a5,_0x6711('0x12'),JSON[_0x6711('0x15')](_0x3533d7));if(_0x3533d7[_0x6711('0x16')]){if(_0x3533d7[_0x6711('0x16')]['code']===0x1f4){logger[_0x6711('0x16')](_0x6711('0x11'),_0x4216a5,_0x3533d7['error'][_0x6711('0x17')]);return _0x4bd938(_0x3533d7[_0x6711('0x16')][_0x6711('0x17')]);}logger[_0x6711('0x16')](_0x6711('0x11'),_0x4216a5,_0x3533d7[_0x6711('0x16')][_0x6711('0x17')]);return _0x27c49b(_0x3533d7[_0x6711('0x16')][_0x6711('0x17')]);}else{logger[_0x6711('0x10')](_0x6711('0x11'),_0x4216a5,_0x6711('0x12'));_0x27c49b(_0x3533d7[_0x6711('0x18')][_0x6711('0x17')]);}})[_0x6711('0x19')](function(_0x2c685c){logger[_0x6711('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x4216a5,_0x2c685c);_0x4bd938(_0x2c685c);});});}exports['ShowWhatsappAccount']=function(_0x7d5d7e){var _0x284529=this;return new Promise(function(_0x5a3d3d,_0x15053d){return db[_0x6711('0x1a')][_0x6711('0x1b')]({'raw':_0x7d5d7e['options']?_0x7d5d7e['options'][_0x6711('0x1c')]===undefined?!![]:![]:!![],'where':_0x7d5d7e[_0x6711('0x1d')]?_0x7d5d7e['options'][_0x6711('0x1e')]||null:null,'attributes':_0x7d5d7e[_0x6711('0x1d')]?_0x7d5d7e[_0x6711('0x1d')][_0x6711('0x1f')]||null:null,'include':_0x7d5d7e[_0x6711('0x1d')]?_0x7d5d7e['options'][_0x6711('0x20')]?_[_0x6711('0x21')](_0x7d5d7e[_0x6711('0x1d')]['include'],function(_0x181c64){return{'model':db[_0x181c64[_0x6711('0x22')]],'as':_0x181c64['as'],'attributes':_0x181c64['attributes'],'include':_0x181c64[_0x6711('0x20')]?_['map'](_0x181c64[_0x6711('0x20')],function(_0x476fa2){return{'model':db[_0x476fa2[_0x6711('0x22')]],'as':_0x476fa2['as'],'attributes':_0x476fa2[_0x6711('0x1f')],'include':_0x476fa2[_0x6711('0x20')]?_[_0x6711('0x21')](_0x476fa2[_0x6711('0x20')],function(_0x2dea56){return{'model':db[_0x2dea56[_0x6711('0x22')]],'as':_0x2dea56['as'],'attributes':_0x2dea56[_0x6711('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2952e3){logger[_0x6711('0x10')](_0x6711('0x23'),_0x7d5d7e);logger[_0x6711('0x13')](_0x6711('0x23'),_0x7d5d7e,JSON['stringify'](_0x2952e3));_0x5a3d3d(_0x2952e3);})[_0x6711('0x19')](function(_0x17046e){logger[_0x6711('0x16')](_0x6711('0x23'),_0x17046e[_0x6711('0x17')],_0x7d5d7e);_0x15053d(_0x284529[_0x6711('0x16')](0x1f4,_0x17046e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 8ecebf2..a59cd61 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 _0xf356=['length','whatsappAccount:','save','emit','register'];(function(_0x4be163,_0x25b0d2){var _0x89068d=function(_0x39e66e){while(--_0x39e66e){_0x4be163['push'](_0x4be163['shift']());}};_0x89068d(++_0x25b0d2);}(_0xf356,0xbb));var _0x6f35=function(_0x3e8d6e,_0x7939b9){_0x3e8d6e=_0x3e8d6e-0x0;var _0x4969eb=_0xf356[_0x3e8d6e];return _0x4969eb;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x6f35('0x0'),'remove','update'];function createListener(_0x5afcd9,_0x598964){return function(_0x34b01d){_0x598964[_0x6f35('0x1')](_0x5afcd9,_0x34b01d);};}function removeListener(_0x9e105,_0x2699af){return function(){WhatsappAccountEvents['removeListener'](_0x9e105,_0x2699af);};}exports[_0x6f35('0x2')]=function(_0x16b01f){for(var _0x42e33b=0x0,_0x2c8cc0=events[_0x6f35('0x3')];_0x42e33b<_0x2c8cc0;_0x42e33b++){var _0x6d7cfa=events[_0x42e33b];var _0x3c1908=createListener(_0x6f35('0x4')+_0x6d7cfa,_0x16b01f);WhatsappAccountEvents['on'](_0x6d7cfa,_0x3c1908);}}; \ No newline at end of file +var _0x2ca2=['emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','remove','update'];(function(_0x2794ec,_0x4873f6){var _0x2e6c9e=function(_0x29d663){while(--_0x29d663){_0x2794ec['push'](_0x2794ec['shift']());}};_0x2e6c9e(++_0x4873f6);}(_0x2ca2,0x89));var _0x22ca=function(_0x3ff25a,_0x57edd9){_0x3ff25a=_0x3ff25a-0x0;var _0x4eb5de=_0x2ca2[_0x3ff25a];return _0x4eb5de;};'use strict';var WhatsappAccountEvents=require(_0x22ca('0x0'));var events=['save',_0x22ca('0x1'),_0x22ca('0x2')];function createListener(_0x46a0ce,_0xd5f8eb){return function(_0x11f62c){_0xd5f8eb[_0x22ca('0x3')](_0x46a0ce,_0x11f62c);};}function removeListener(_0x44a4ed,_0x4493bc){return function(){WhatsappAccountEvents[_0x22ca('0x4')](_0x44a4ed,_0x4493bc);};}exports[_0x22ca('0x5')]=function(_0x202926){for(var _0x50c021=0x0,_0x1d9d90=events['length'];_0x50c021<_0x1d9d90;_0x50c021++){var _0x5ddd0b=events[_0x50c021];var _0x3f8619=createListener(_0x22ca('0x6')+_0x5ddd0b,_0x202926);WhatsappAccountEvents['on'](_0x5ddd0b,_0x3f8619);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 489eb0b..fddbb61 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 _0x0470=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','index','get','show','/:id','isAuthenticated'];(function(_0x29ed0b,_0x5e924a){var _0x5e61f2=function(_0x2e0ff0){while(--_0x2e0ff0){_0x29ed0b['push'](_0x29ed0b['shift']());}};_0x5e61f2(++_0x5e924a);}(_0x0470,0x9c));var _0x0047=function(_0x21d1f5,_0x118802){_0x21d1f5=_0x21d1f5-0x0;var _0x1b2391=_0x0470[_0x21d1f5];return _0x1b2391;};'use strict';var multer=require(_0x0047('0x0'));var util=require(_0x0047('0x1'));var path=require('path');var timeout=require(_0x0047('0x2'));var express=require(_0x0047('0x3'));var router=express[_0x0047('0x4')]();var fs_extra=require(_0x0047('0x5'));var auth=require(_0x0047('0x6'));var interaction=require(_0x0047('0x7'));var config=require('../../config/environment');var controller=require(_0x0047('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0047('0x9')]);router[_0x0047('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0047('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0047('0xc'),auth[_0x0047('0xd')](),controller['update']);router[_0x0047('0xe')](_0x0047('0xc'),auth[_0x0047('0xd')](),controller[_0x0047('0xf')]);module[_0x0047('0x10')]=router; \ No newline at end of file +var _0x7b93=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x209ad0,_0x178ba3){var _0x1859dd=function(_0x592de6){while(--_0x592de6){_0x209ad0['push'](_0x209ad0['shift']());}};_0x1859dd(++_0x178ba3);}(_0x7b93,0x137));var _0x37b9=function(_0xadd0d2,_0x3bf5b9){_0xadd0d2=_0xadd0d2-0x0;var _0x2d564c=_0x7b93[_0xadd0d2];return _0x2d564c;};'use strict';var multer=require(_0x37b9('0x0'));var util=require(_0x37b9('0x1'));var path=require('path');var timeout=require(_0x37b9('0x2'));var express=require(_0x37b9('0x3'));var router=express[_0x37b9('0x4')]();var fs_extra=require(_0x37b9('0x5'));var auth=require(_0x37b9('0x6'));var interaction=require(_0x37b9('0x7'));var config=require(_0x37b9('0x8'));var controller=require(_0x37b9('0x9'));router[_0x37b9('0xa')]('/',auth[_0x37b9('0xb')](),controller[_0x37b9('0xc')]);router[_0x37b9('0xa')]('/:id',auth[_0x37b9('0xb')](),controller[_0x37b9('0xd')]);router[_0x37b9('0xe')]('/',auth['isAuthenticated'](),controller[_0x37b9('0xf')]);router[_0x37b9('0x10')](_0x37b9('0x11'),auth['isAuthenticated'](),controller[_0x37b9('0x12')]);router[_0x37b9('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x37b9('0x14')]);module[_0x37b9('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 14d6106..79b9acc 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 _0x47b3=['INTEGER','noop','TEXT','STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x47b3,0xee));var _0x347b=function(_0x2324b5,_0x48d454){_0x2324b5=_0x2324b5-0x0;var _0x574a40=_0x47b3[_0x2324b5];return _0x574a40;};'use strict';var Sequelize=require(_0x347b('0x0'));module[_0x347b('0x1')]={'priority':{'type':Sequelize[_0x347b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x347b('0x3')},'appdata':{'type':Sequelize[_0x347b('0x4')]()},'description':{'type':Sequelize[_0x347b('0x5')]},'interval':{'type':Sequelize[_0x347b('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf73b=['noop','*,*,*,*','exports','STRING'];(function(_0x995a02,_0x39cece){var _0x5280e3=function(_0x117ec4){while(--_0x117ec4){_0x995a02['push'](_0x995a02['shift']());}};_0x5280e3(++_0x39cece);}(_0xf73b,0x72));var _0xbf73=function(_0x33511e,_0x404cdf){_0x33511e=_0x33511e-0x0;var _0x38ed2b=_0xf73b[_0x33511e];return _0x38ed2b;};'use strict';var Sequelize=require('sequelize');module[_0xbf73('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbf73('0x1')],'allowNull':![],'defaultValue':_0xbf73('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbf73('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbf73('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 5312dcd..332e2a5 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 _0xf4c9=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','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','status','json','offset','undefined','limit','count','reject','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x3a8ada,_0xea1a8){var _0x4e80ba=function(_0x3da728){while(--_0x3da728){_0x3a8ada['push'](_0x3a8ada['shift']());}};_0x4e80ba(++_0xea1a8);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf4c9[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x9f4c('0x0'));var rimraf=require(_0x9f4c('0x1'));var zipdir=require(_0x9f4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f4c('0x3'));var moment=require('moment');var BPromise=require(_0x9f4c('0x4'));var Mustache=require(_0x9f4c('0x5'));var util=require(_0x9f4c('0x6'));var path=require('path');var sox=require(_0x9f4c('0x7'));var csv=require('to-csv');var ejs=require(_0x9f4c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f4c('0x9'));var jsforce=require(_0x9f4c('0xa'));var deskjs=require(_0x9f4c('0xb'));var toCsv=require(_0x9f4c('0xc'));var querystring=require(_0x9f4c('0xd'));var Papa=require(_0x9f4c('0xe'));var Redis=require('ioredis');var authService=require(_0x9f4c('0xf'));var qs=require(_0x9f4c('0x10'));var as=require(_0x9f4c('0x11'));var hardwareService=require(_0x9f4c('0x12'));var logger=require(_0x9f4c('0x13'))(_0x9f4c('0x14'));var utils=require(_0x9f4c('0x15'));var config=require(_0x9f4c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d71a9,_0x124492){_0x124492=_0x124492||0xcc;return function(_0x53159a){if(_0x53159a){return _0x4d71a9['sendStatus'](_0x124492);}return _0x4d71a9[_0x9f4c('0x17')](_0x124492)['end']();};}function respondWithResult(_0x5a9cb0,_0xf217d4){_0xf217d4=_0xf217d4||0xc8;return function(_0x4ce352){if(_0x4ce352){return _0x5a9cb0['status'](_0xf217d4)[_0x9f4c('0x18')](_0x4ce352);}};}function respondWithFilteredResult(_0x516787,_0x25f8ed){return function(_0x336fc2){if(_0x336fc2){var _0x46abfe=typeof _0x25f8ed[_0x9f4c('0x19')]===_0x9f4c('0x1a')&&typeof _0x25f8ed[_0x9f4c('0x1b')]==='undefined';var _0x2be1ba=_0x336fc2[_0x9f4c('0x1c')];var _0x143335=_0x46abfe?0x0:_0x25f8ed[_0x9f4c('0x19')];var _0x3f862c=_0x46abfe?_0x336fc2['count']:_0x25f8ed[_0x9f4c('0x19')]+_0x25f8ed[_0x9f4c('0x1b')];var _0x8efbfe;if(_0x3f862c>=_0x2be1ba){_0x3f862c=_0x2be1ba;_0x8efbfe=0xc8;}else{_0x8efbfe=0xce;}_0x516787['status'](_0x8efbfe);return _0x516787['set']('Content-Range',_0x143335+'-'+_0x3f862c+'/'+_0x2be1ba)['json'](_0x336fc2);}return null;};}function patchUpdates(_0x2040a5){return function(_0x47accd){try{jsonpatch['apply'](_0x47accd,_0x2040a5,!![]);}catch(_0x603a8d){return BPromise[_0x9f4c('0x1d')](_0x603a8d);}return _0x47accd['save']();};}function saveUpdates(_0x341693,_0x1d0df9){return function(_0x57b636){if(_0x57b636){return _0x57b636[_0x9f4c('0x1e')](_0x341693)['then'](function(_0x5e6632){return _0x5e6632;});}return null;};}function removeEntity(_0x36e15f,_0x49d6d6){return function(_0xa4a8e9){if(_0xa4a8e9){return _0xa4a8e9[_0x9f4c('0x1f')]()[_0x9f4c('0x20')](function(){_0x36e15f[_0x9f4c('0x17')](0xcc)[_0x9f4c('0x21')]();});}};}function handleEntityNotFound(_0x10c9a9,_0x53c2d3){return function(_0x25b775){if(!_0x25b775){_0x10c9a9[_0x9f4c('0x22')](0x194);}return _0x25b775;};}function handleError(_0x174552,_0x167126){_0x167126=_0x167126||0x1f4;return function(_0x2c7b7e){logger[_0x9f4c('0x23')](_0x2c7b7e[_0x9f4c('0x24')]);if(_0x2c7b7e[_0x9f4c('0x25')]){delete _0x2c7b7e[_0x9f4c('0x25')];}_0x174552[_0x9f4c('0x17')](_0x167126)[_0x9f4c('0x26')](_0x2c7b7e);};}exports[_0x9f4c('0x27')]=function(_0x168ed8,_0x3702bf){var _0x21ba20={},_0x246599={},_0x31d486={'count':0x0,'rows':[]};var _0x149ce5=_[_0x9f4c('0x28')](db[_0x9f4c('0x29')][_0x9f4c('0x2a')],function(_0x2158ac){return{'name':_0x2158ac['fieldName'],'type':_0x2158ac['type']['key']};});_0x246599[_0x9f4c('0x2b')]=_[_0x9f4c('0x28')](_0x149ce5,'name');_0x246599[_0x9f4c('0x2c')]=_[_0x9f4c('0x2d')](_0x168ed8[_0x9f4c('0x2c')]);_0x246599['filters']=_['intersection'](_0x246599[_0x9f4c('0x2b')],_0x246599[_0x9f4c('0x2c')]);_0x21ba20['attributes']=_[_0x9f4c('0x2e')](_0x246599['model'],qs['fields'](_0x168ed8[_0x9f4c('0x2c')][_0x9f4c('0x2f')]));_0x21ba20[_0x9f4c('0x30')]=_0x21ba20[_0x9f4c('0x30')][_0x9f4c('0x31')]?_0x21ba20[_0x9f4c('0x30')]:_0x246599['model'];if(!_0x168ed8[_0x9f4c('0x2c')][_0x9f4c('0x32')](_0x9f4c('0x33'))){_0x21ba20[_0x9f4c('0x1b')]=qs[_0x9f4c('0x1b')](_0x168ed8[_0x9f4c('0x2c')][_0x9f4c('0x1b')]);_0x21ba20[_0x9f4c('0x19')]=qs[_0x9f4c('0x19')](_0x168ed8[_0x9f4c('0x2c')][_0x9f4c('0x19')]);}_0x21ba20[_0x9f4c('0x34')]=qs[_0x9f4c('0x35')](_0x168ed8['query'][_0x9f4c('0x35')]);_0x21ba20['where']=qs[_0x9f4c('0x36')](_[_0x9f4c('0x37')](_0x168ed8[_0x9f4c('0x2c')],_0x246599[_0x9f4c('0x36')]),_0x149ce5);if(_0x168ed8[_0x9f4c('0x2c')][_0x9f4c('0x38')]){_0x21ba20[_0x9f4c('0x39')]=_[_0x9f4c('0x3a')](_0x21ba20[_0x9f4c('0x39')],{'$or':_[_0x9f4c('0x28')](_0x149ce5,function(_0x3bfdeb){if(_0x3bfdeb[_0x9f4c('0x3b')]!=='VIRTUAL'){var _0x3349a8={};_0x3349a8[_0x3bfdeb[_0x9f4c('0x25')]]={'$like':'%'+_0x168ed8[_0x9f4c('0x2c')]['filter']+'%'};return _0x3349a8;}})});}_0x21ba20=_[_0x9f4c('0x3a')]({},_0x21ba20,_0x168ed8[_0x9f4c('0x3c')]);var _0x198c59={'where':_0x21ba20['where']};return db[_0x9f4c('0x29')][_0x9f4c('0x1c')](_0x198c59)[_0x9f4c('0x20')](function(_0x332d0b){_0x31d486[_0x9f4c('0x1c')]=_0x332d0b;if(_0x168ed8[_0x9f4c('0x2c')][_0x9f4c('0x3d')]){_0x21ba20[_0x9f4c('0x3e')]=[{'all':!![]}];}return db[_0x9f4c('0x29')][_0x9f4c('0x3f')](_0x21ba20);})['then'](function(_0x167363){_0x31d486[_0x9f4c('0x40')]=_0x167363;return _0x31d486;})['then'](respondWithFilteredResult(_0x3702bf,_0x21ba20))[_0x9f4c('0x41')](handleError(_0x3702bf,null));};exports[_0x9f4c('0x42')]=function(_0xdbd03b,_0x5170a2){var _0x21f25b={'raw':!![],'where':{'id':_0xdbd03b[_0x9f4c('0x43')]['id']}},_0x4da3ed={};_0x4da3ed['model']=_[_0x9f4c('0x2d')](db[_0x9f4c('0x29')][_0x9f4c('0x2a')]);_0x4da3ed[_0x9f4c('0x2c')]=_[_0x9f4c('0x2d')](_0xdbd03b['query']);_0x4da3ed['filters']=_[_0x9f4c('0x2e')](_0x4da3ed[_0x9f4c('0x2b')],_0x4da3ed[_0x9f4c('0x2c')]);_0x21f25b['attributes']=_[_0x9f4c('0x2e')](_0x4da3ed['model'],qs['fields'](_0xdbd03b[_0x9f4c('0x2c')]['fields']));_0x21f25b[_0x9f4c('0x30')]=_0x21f25b[_0x9f4c('0x30')][_0x9f4c('0x31')]?_0x21f25b['attributes']:_0x4da3ed[_0x9f4c('0x2b')];if(_0xdbd03b['query'][_0x9f4c('0x3d')]){_0x21f25b[_0x9f4c('0x3e')]=[{'all':!![]}];}_0x21f25b=_[_0x9f4c('0x3a')]({},_0x21f25b,_0xdbd03b[_0x9f4c('0x3c')]);return db['WhatsappApplication'][_0x9f4c('0x44')](_0x21f25b)['then'](handleEntityNotFound(_0x5170a2,null))[_0x9f4c('0x20')](respondWithResult(_0x5170a2,null))['catch'](handleError(_0x5170a2,null));};exports[_0x9f4c('0x45')]=function(_0x1294da,_0x5f13c8){return db[_0x9f4c('0x29')][_0x9f4c('0x45')](_0x1294da['body'],{})[_0x9f4c('0x20')](respondWithResult(_0x5f13c8,0xc9))['catch'](handleError(_0x5f13c8,null));};exports[_0x9f4c('0x1e')]=function(_0x384f47,_0x5b8fca){if(_0x384f47['body']['id']){delete _0x384f47['body']['id'];}return db[_0x9f4c('0x29')][_0x9f4c('0x44')]({'where':{'id':_0x384f47['params']['id']}})[_0x9f4c('0x20')](handleEntityNotFound(_0x5b8fca,null))[_0x9f4c('0x20')](saveUpdates(_0x384f47[_0x9f4c('0x46')],null))['then'](respondWithResult(_0x5b8fca,null))[_0x9f4c('0x41')](handleError(_0x5b8fca,null));};exports['destroy']=function(_0x1830e7,_0x3af9de){return db['WhatsappApplication']['find']({'where':{'id':_0x1830e7[_0x9f4c('0x43')]['id']}})[_0x9f4c('0x20')](handleEntityNotFound(_0x3af9de,null))['then'](removeEntity(_0x3af9de,null))[_0x9f4c('0x41')](handleError(_0x3af9de,null));}; \ No newline at end of file +var _0xd663=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','create','body','find','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range'];(function(_0xc7ce12,_0xdfee9c){var _0x1bcfc4=function(_0x542a58){while(--_0x542a58){_0xc7ce12['push'](_0xc7ce12['shift']());}};_0x1bcfc4(++_0xdfee9c);}(_0xd663,0x1ed));var _0x3d66=function(_0xca4eb9,_0x8c5b4d){_0xca4eb9=_0xca4eb9-0x0;var _0x2e3260=_0xd663[_0xca4eb9];return _0x2e3260;};'use strict';var emlformat=require(_0x3d66('0x0'));var rimraf=require(_0x3d66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d66('0x2'));var rp=require(_0x3d66('0x3'));var moment=require(_0x3d66('0x4'));var BPromise=require(_0x3d66('0x5'));var Mustache=require(_0x3d66('0x6'));var util=require('util');var path=require(_0x3d66('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d66('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d66('0x9'));var deskjs=require(_0x3d66('0xa'));var toCsv=require(_0x3d66('0xb'));var querystring=require(_0x3d66('0xc'));var Papa=require(_0x3d66('0xd'));var Redis=require(_0x3d66('0xe'));var authService=require(_0x3d66('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x10'));var hardwareService=require(_0x3d66('0x11'));var logger=require(_0x3d66('0x12'))('api');var utils=require(_0x3d66('0x13'));var config=require(_0x3d66('0x14'));var licenseUtil=require(_0x3d66('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207712,_0x223de6){_0x223de6=_0x223de6||0xcc;return function(_0x288693){if(_0x288693){return _0x207712[_0x3d66('0x16')](_0x223de6);}return _0x207712['status'](_0x223de6)[_0x3d66('0x17')]();};}function respondWithResult(_0x5a940c,_0x15bba0){_0x15bba0=_0x15bba0||0xc8;return function(_0x290f29){if(_0x290f29){return _0x5a940c[_0x3d66('0x18')](_0x15bba0)[_0x3d66('0x19')](_0x290f29);}};}function respondWithFilteredResult(_0x30260d,_0x153b88){return function(_0x5628ae){if(_0x5628ae){var _0x5eba7e=typeof _0x153b88[_0x3d66('0x1a')]===_0x3d66('0x1b')&&typeof _0x153b88['limit']===_0x3d66('0x1b');var _0x24d137=_0x5628ae[_0x3d66('0x1c')];var _0x1dfd81=_0x5eba7e?0x0:_0x153b88[_0x3d66('0x1a')];var _0x239ffb=_0x5eba7e?_0x5628ae[_0x3d66('0x1c')]:_0x153b88[_0x3d66('0x1a')]+_0x153b88[_0x3d66('0x1d')];var _0x3902f1;if(_0x239ffb>=_0x24d137){_0x239ffb=_0x24d137;_0x3902f1=0xc8;}else{_0x3902f1=0xce;}_0x30260d[_0x3d66('0x18')](_0x3902f1);return _0x30260d[_0x3d66('0x1e')](_0x3d66('0x1f'),_0x1dfd81+'-'+_0x239ffb+'/'+_0x24d137)[_0x3d66('0x19')](_0x5628ae);}return null;};}function patchUpdates(_0x21cfd7){return function(_0x4c61ee){try{jsonpatch[_0x3d66('0x20')](_0x4c61ee,_0x21cfd7,!![]);}catch(_0x5e1516){return BPromise[_0x3d66('0x21')](_0x5e1516);}return _0x4c61ee[_0x3d66('0x22')]();};}function saveUpdates(_0x4486f5,_0x37ed73){return function(_0x11be7f){if(_0x11be7f){return _0x11be7f[_0x3d66('0x23')](_0x4486f5)[_0x3d66('0x24')](function(_0x1bfa81){return _0x1bfa81;});}return null;};}function removeEntity(_0x1eb922,_0x4e2c42){return function(_0x151364){if(_0x151364){return _0x151364[_0x3d66('0x25')]()[_0x3d66('0x24')](function(){_0x1eb922[_0x3d66('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59fe0a,_0x45628b){return function(_0x4302ad){if(!_0x4302ad){_0x59fe0a[_0x3d66('0x16')](0x194);}return _0x4302ad;};}function handleError(_0x4f0d9e,_0x402c4c){_0x402c4c=_0x402c4c||0x1f4;return function(_0x3e6712){logger[_0x3d66('0x26')](_0x3e6712[_0x3d66('0x27')]);if(_0x3e6712[_0x3d66('0x28')]){delete _0x3e6712[_0x3d66('0x28')];}_0x4f0d9e[_0x3d66('0x18')](_0x402c4c)[_0x3d66('0x29')](_0x3e6712);};}exports[_0x3d66('0x2a')]=function(_0x1271bf,_0x54ba13){var _0x28466b={},_0x1dff3b={},_0x197c5e={'count':0x0,'rows':[]};var _0xc128a7=_[_0x3d66('0x2b')](db[_0x3d66('0x2c')][_0x3d66('0x2d')],function(_0xabe382){return{'name':_0xabe382[_0x3d66('0x2e')],'type':_0xabe382[_0x3d66('0x2f')][_0x3d66('0x30')]};});_0x1dff3b['model']=_['map'](_0xc128a7,_0x3d66('0x28'));_0x1dff3b[_0x3d66('0x31')]=_[_0x3d66('0x32')](_0x1271bf[_0x3d66('0x31')]);_0x1dff3b[_0x3d66('0x33')]=_[_0x3d66('0x34')](_0x1dff3b[_0x3d66('0x35')],_0x1dff3b[_0x3d66('0x31')]);_0x28466b[_0x3d66('0x36')]=_[_0x3d66('0x34')](_0x1dff3b[_0x3d66('0x35')],qs[_0x3d66('0x37')](_0x1271bf[_0x3d66('0x31')][_0x3d66('0x37')]));_0x28466b[_0x3d66('0x36')]=_0x28466b[_0x3d66('0x36')][_0x3d66('0x38')]?_0x28466b[_0x3d66('0x36')]:_0x1dff3b[_0x3d66('0x35')];if(!_0x1271bf[_0x3d66('0x31')][_0x3d66('0x39')](_0x3d66('0x3a'))){_0x28466b[_0x3d66('0x1d')]=qs['limit'](_0x1271bf[_0x3d66('0x31')][_0x3d66('0x1d')]);_0x28466b[_0x3d66('0x1a')]=qs['offset'](_0x1271bf[_0x3d66('0x31')]['offset']);}_0x28466b[_0x3d66('0x3b')]=qs[_0x3d66('0x3c')](_0x1271bf['query'][_0x3d66('0x3c')]);_0x28466b[_0x3d66('0x3d')]=qs['filters'](_[_0x3d66('0x3e')](_0x1271bf[_0x3d66('0x31')],_0x1dff3b['filters']),_0xc128a7);if(_0x1271bf[_0x3d66('0x31')][_0x3d66('0x3f')]){_0x28466b[_0x3d66('0x3d')]=_[_0x3d66('0x40')](_0x28466b['where'],{'$or':_[_0x3d66('0x2b')](_0xc128a7,function(_0x58851d){if(_0x58851d[_0x3d66('0x2f')]!=='VIRTUAL'){var _0xc77eb5={};_0xc77eb5[_0x58851d[_0x3d66('0x28')]]={'$like':'%'+_0x1271bf[_0x3d66('0x31')]['filter']+'%'};return _0xc77eb5;}})});}_0x28466b=_[_0x3d66('0x40')]({},_0x28466b,_0x1271bf[_0x3d66('0x41')]);var _0x105726={'where':_0x28466b[_0x3d66('0x3d')]};return db[_0x3d66('0x2c')][_0x3d66('0x1c')](_0x105726)[_0x3d66('0x24')](function(_0x38633f){_0x197c5e[_0x3d66('0x1c')]=_0x38633f;if(_0x1271bf[_0x3d66('0x31')][_0x3d66('0x42')]){_0x28466b[_0x3d66('0x43')]=[{'all':!![]}];}return db[_0x3d66('0x2c')]['findAll'](_0x28466b);})[_0x3d66('0x24')](function(_0x4482a3){_0x197c5e[_0x3d66('0x44')]=_0x4482a3;return _0x197c5e;})['then'](respondWithFilteredResult(_0x54ba13,_0x28466b))['catch'](handleError(_0x54ba13,null));};exports[_0x3d66('0x45')]=function(_0x263e9f,_0x3deb7d){var _0x26350b={'raw':!![],'where':{'id':_0x263e9f[_0x3d66('0x46')]['id']}},_0x283395={};_0x283395[_0x3d66('0x35')]=_[_0x3d66('0x32')](db['WhatsappApplication'][_0x3d66('0x2d')]);_0x283395[_0x3d66('0x31')]=_[_0x3d66('0x32')](_0x263e9f['query']);_0x283395['filters']=_[_0x3d66('0x34')](_0x283395[_0x3d66('0x35')],_0x283395[_0x3d66('0x31')]);_0x26350b[_0x3d66('0x36')]=_[_0x3d66('0x34')](_0x283395[_0x3d66('0x35')],qs[_0x3d66('0x37')](_0x263e9f[_0x3d66('0x31')]['fields']));_0x26350b[_0x3d66('0x36')]=_0x26350b['attributes'][_0x3d66('0x38')]?_0x26350b[_0x3d66('0x36')]:_0x283395[_0x3d66('0x35')];if(_0x263e9f['query'][_0x3d66('0x42')]){_0x26350b[_0x3d66('0x43')]=[{'all':!![]}];}_0x26350b=_[_0x3d66('0x40')]({},_0x26350b,_0x263e9f[_0x3d66('0x41')]);return db['WhatsappApplication']['find'](_0x26350b)[_0x3d66('0x24')](handleEntityNotFound(_0x3deb7d,null))['then'](respondWithResult(_0x3deb7d,null))['catch'](handleError(_0x3deb7d,null));};exports[_0x3d66('0x47')]=function(_0x3c5b6d,_0x32edc2){return db[_0x3d66('0x2c')][_0x3d66('0x47')](_0x3c5b6d[_0x3d66('0x48')],{})[_0x3d66('0x24')](respondWithResult(_0x32edc2,0xc9))['catch'](handleError(_0x32edc2,null));};exports[_0x3d66('0x23')]=function(_0x2e05ce,_0x22c447){if(_0x2e05ce[_0x3d66('0x48')]['id']){delete _0x2e05ce[_0x3d66('0x48')]['id'];}return db['WhatsappApplication'][_0x3d66('0x49')]({'where':{'id':_0x2e05ce[_0x3d66('0x46')]['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x22c447,null))[_0x3d66('0x24')](saveUpdates(_0x2e05ce[_0x3d66('0x48')],null))[_0x3d66('0x24')](respondWithResult(_0x22c447,null))[_0x3d66('0x4a')](handleError(_0x22c447,null));};exports['destroy']=function(_0x4a6c1c,_0x505abb){return db[_0x3d66('0x2c')][_0x3d66('0x49')]({'where':{'id':_0x4a6c1c['params']['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x505abb,null))[_0x3d66('0x24')](removeEntity(_0x505abb,null))[_0x3d66('0x4a')](handleError(_0x505abb,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 32ba679..6910ed9 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 _0x097c=['bluebird','request-promise','path','../../config/environment','exports','define','whatsapp_applications','lodash','util','../../config/logger','moment'];(function(_0x4a698c,_0x3bed13){var _0x18cde6=function(_0x5c4a7d){while(--_0x5c4a7d){_0x4a698c['push'](_0x4a698c['shift']());}};_0x18cde6(++_0x3bed13);}(_0x097c,0x1d5));var _0xc097=function(_0xc685ff,_0x4a167a){_0xc685ff=_0xc685ff-0x0;var _0x32a276=_0x097c[_0xc685ff];return _0x32a276;};'use strict';var _=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var logger=require(_0xc097('0x2'))('api');var moment=require(_0xc097('0x3'));var BPromise=require(_0xc097('0x4'));var rp=require(_0xc097('0x5'));var fs=require('fs');var path=require(_0xc097('0x6'));var rimraf=require('rimraf');var config=require(_0xc097('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xc097('0x8')]=function(_0x3c9603,_0x31bc9a){return _0x3c9603[_0xc097('0x9')]('WhatsappApplication',attributes,{'tableName':_0xc097('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4bc3=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x39d38e,_0x3da1f7){var _0x18e737=function(_0x373eef){while(--_0x373eef){_0x39d38e['push'](_0x39d38e['shift']());}};_0x18e737(++_0x3da1f7);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x4bc3[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));module[_0x34bc('0x9')]=function(_0x2cc9c2,_0x4c63a1){return _0x2cc9c2[_0x34bc('0xa')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x34bc('0xb'),'collate':_0x34bc('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 49f7385..cc1cc9e 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x008c,0x188));var _0xc008=function(_0x4f4f59,_0x4215c1){_0x4f4f59=_0x4f4f59-0x0;var _0x322725=_0x008c[_0x4f4f59];return _0x322725;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x008c,0x188));var _0xc008=function(_0x411511,_0x13b21a){_0x411511=_0x411511-0x0;var _0xda7b33=_0x008c[_0x411511];return _0xda7b33;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c7b4d55..6b1bd9e 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 _0xe14b=['/:id','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','express','Router','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','put'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xe14b,0x93));var _0xbe14=function(_0x19efbe,_0x45c0e9){_0x19efbe=_0x19efbe-0x0;var _0x59f115=_0xe14b[_0x19efbe];return _0x59f115;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0xe')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0xe')](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x10')]);router[_0xbe14('0xe')](_0xbe14('0x11'),auth[_0xbe14('0x7')](),interaction[_0xbe14('0x12')](_0xbe14('0x13'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),interaction[_0xbe14('0x12')]('whatsapp',_0xbe14('0x16')),controller[_0xbe14('0x17')]);router[_0xbe14('0x18')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),interaction[_0xbe14('0x12')](_0xbe14('0x13'),'whatsappinteraction:destroy'),controller[_0xbe14('0x19')]);router[_0xbe14('0x18')](_0xbe14('0x11'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1a')]);module[_0xbe14('0x1b')]=router; \ No newline at end of file +var _0x2c8f=['Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2c8f,0x192));var _0xf2c8=function(_0x56ae0e,_0x2144bd){_0x56ae0e=_0x56ae0e-0x0;var _0x2ff1eb=_0x2c8f[_0x56ae0e];return _0x2ff1eb;};'use strict';var multer=require('multer');var util=require(_0xf2c8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf2c8('0x1')]();var fs_extra=require(_0xf2c8('0x2'));var auth=require(_0xf2c8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2c8('0x4'));router[_0xf2c8('0x5')]('/',auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x7')]);router[_0xf2c8('0x5')]('/describe',auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x8')]);router[_0xf2c8('0x5')](_0xf2c8('0x9'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0xa')]);router['get'](_0xf2c8('0xb'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0xc')]);router[_0xf2c8('0x5')](_0xf2c8('0xd'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0xe')]);router[_0xf2c8('0xf')]('/',auth['isAuthenticated'](),controller[_0xf2c8('0x10')]);router['post'](_0xf2c8('0xb'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x11')]);router[_0xf2c8('0xf')](_0xf2c8('0x12'),auth[_0xf2c8('0x6')](),interaction['tracked'](_0xf2c8('0x13'),_0xf2c8('0x14')),controller[_0xf2c8('0x15')]);router[_0xf2c8('0x16')](_0xf2c8('0x9'),auth[_0xf2c8('0x6')](),interaction[_0xf2c8('0x17')]('whatsapp',_0xf2c8('0x18')),controller[_0xf2c8('0x19')]);router[_0xf2c8('0x1a')](_0xf2c8('0x9'),auth[_0xf2c8('0x6')](),interaction['tracked']('whatsapp',_0xf2c8('0x1b')),controller[_0xf2c8('0x1c')]);router[_0xf2c8('0x1a')](_0xf2c8('0x12'),auth['isAuthenticated'](),controller[_0xf2c8('0x1d')]);module[_0xf2c8('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 9d1f92a..7d5c350 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 _0x0309=['STRING','ENUM','BOOLEAN','sequelize','exports','DATE'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x0309,0x165));var _0x9030=function(_0x387975,_0x37dc31){_0x387975=_0x387975-0x0;var _0x333de4=_0x0309[_0x387975];return _0x333de4;};'use strict';var Sequelize=require(_0x9030('0x0'));var moment=require('moment');module[_0x9030('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9030('0x2')]},'disposition':{'type':Sequelize[_0x9030('0x3')]},'secondDisposition':{'type':Sequelize[_0x9030('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9030('0x3')]},'note':{'type':Sequelize[_0x9030('0x3')]},'phone':{'type':Sequelize[_0x9030('0x3')]},'read1stAt':{'type':Sequelize[_0x9030('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9030('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9030('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9030('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x5e0c=['ENUM','out','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x5de10b,_0x5af540){_0x5de10b=_0x5de10b-0x0;var _0x477b4a=_0x5e0c[_0x5de10b];return _0x477b4a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc5e0('0x0'));module[_0xc5e0('0x1')]={'closed':{'type':Sequelize[_0xc5e0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc5e0('0x3')]},'disposition':{'type':Sequelize[_0xc5e0('0x4')]},'secondDisposition':{'type':Sequelize[_0xc5e0('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc5e0('0x4')]},'phone':{'type':Sequelize[_0xc5e0('0x4')]},'read1stAt':{'type':Sequelize[_0xc5e0('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc5e0('0x5')]('in',_0xc5e0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc5e0('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b40499d..3fad7b4 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 _0x1b89=['path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','json','limit','count','offset','then','end','error','name','send','index','map','type','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','WhatsappInteraction','rawAttributes','intersection','attributes','fields','length','includeAll','include','find','create','body','update','destroy','describe','addMessage','WhatsappMessage','omit','ids','filters','nolimit','order','sort','where','WhatsappInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','Tag','emit','removeTags','download','unix','toString','join','root','server','files','attachments','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','closed','closedAt','Messages','basename','existsSync','createReadStream','createWriteStream','out','secret','read','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x1b89,0x1d4));var _0x91b8=function(_0x290fd1,_0x5df6f1){_0x290fd1=_0x290fd1-0x0;var _0x5bdf49=_0x1b89[_0x290fd1];return _0x5bdf49;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x91b8('0x0'));var moment=require(_0x91b8('0x1'));var BPromise=require(_0x91b8('0x2'));var util=require(_0x91b8('0x3'));var path=require(_0x91b8('0x4'));var ejs=require(_0x91b8('0x5'));var fs=require('fs');var _=require(_0x91b8('0x6'));var Redis=require('ioredis');var interaction=require(_0x91b8('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x91b8('0x8'));var logger=require(_0x91b8('0x9'))(_0x91b8('0xa'));var config=require(_0x91b8('0xb'));var db=require(_0x91b8('0xc'))['db'];config[_0x91b8('0xd')]=_['defaults'](config[_0x91b8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x91b8('0xe'))(new Redis(config[_0x91b8('0xd')]));require('./whatsappInteraction.socket')[_0x91b8('0xf')](socket);function respondWithStatusCode(_0x5c43d2,_0x470919){_0x470919=_0x470919||0xcc;return function(_0x40af93){if(_0x40af93){return _0x5c43d2[_0x91b8('0x10')](_0x470919);}return _0x5c43d2[_0x91b8('0x11')](_0x470919)['end']();};}function respondWithResult(_0x56aec8,_0x37a020){_0x37a020=_0x37a020||0xc8;return function(_0x4ece7b){if(_0x4ece7b){return _0x56aec8[_0x91b8('0x11')](_0x37a020)[_0x91b8('0x12')](_0x4ece7b);}};}function respondWithFilteredResult(_0x293bdd,_0x2ba822){return function(_0x3981c2){if(_0x3981c2){var _0x494ddd=typeof _0x2ba822['offset']==='undefined'&&typeof _0x2ba822[_0x91b8('0x13')]==='undefined';var _0x2341c6=_0x3981c2[_0x91b8('0x14')];var _0x278b77=_0x494ddd?0x0:_0x2ba822[_0x91b8('0x15')];var _0x777f01=_0x494ddd?_0x3981c2[_0x91b8('0x14')]:_0x2ba822['offset']+_0x2ba822[_0x91b8('0x13')];var _0x2c10a3;if(_0x777f01>=_0x2341c6){_0x777f01=_0x2341c6;_0x2c10a3=0xc8;}else{_0x2c10a3=0xce;}_0x293bdd[_0x91b8('0x11')](_0x2c10a3);return _0x293bdd['set']('Content-Range',_0x278b77+'-'+_0x777f01+'/'+_0x2341c6)[_0x91b8('0x12')](_0x3981c2);}return null;};}function saveUpdates(_0x4b76bf){return function(_0x25d681){if(_0x25d681){return _0x25d681['update'](_0x4b76bf)[_0x91b8('0x16')](function(_0x2f7239){return _0x2f7239;});}return null;};}function removeEntity(_0x4138c8){return function(_0x1e2a77){if(_0x1e2a77){return _0x1e2a77['destroy']()['then'](function(){_0x4138c8[_0x91b8('0x11')](0xcc)[_0x91b8('0x17')]();});}};}function handleEntityNotFound(_0x9362a4){return function(_0x578d6a){if(!_0x578d6a){_0x9362a4[_0x91b8('0x10')](0x194);}return _0x578d6a;};}function handleError(_0x3134fa,_0x177b43){_0x177b43=_0x177b43||0x1f4;return function(_0x34e8e0){logger[_0x91b8('0x18')](_0x34e8e0['stack']);if(_0x34e8e0[_0x91b8('0x19')]){delete _0x34e8e0['name'];}_0x3134fa[_0x91b8('0x11')](_0x177b43)[_0x91b8('0x1a')](_0x34e8e0);};}exports[_0x91b8('0x1b')]=function(_0x4fdd4d,_0x2ab0a1){var _0xbcf7ff={};var _0x3ffea6=_[_0x91b8('0x1c')](db['WhatsappInteraction']['rawAttributes'],function(_0x675151){return{'name':_0x675151['fieldName'],'type':_0x675151[_0x91b8('0x1d')]['key']};});_0xbcf7ff=qs[_0x91b8('0x1e')](_0x3ffea6,_0x4fdd4d);return interaction[_0x91b8('0x1f')](_0x91b8('0x20'),_0x4fdd4d[_0x91b8('0x21')],_0x4fdd4d[_0x91b8('0x22')],_0xbcf7ff,_0x3ffea6)[_0x91b8('0x16')](respondWithFilteredResult(_0x2ab0a1,_0xbcf7ff))[_0x91b8('0x23')](handleError(_0x2ab0a1,null));};exports[_0x91b8('0x24')]=function(_0xc0e68c,_0x354128){var _0xcbe0b={'raw':![],'where':{'id':_0xc0e68c[_0x91b8('0x25')]['id']}},_0x596071={};_0x596071[_0x91b8('0x26')]=_[_0x91b8('0x27')](db[_0x91b8('0x28')][_0x91b8('0x29')]);_0x596071[_0x91b8('0x21')]=_[_0x91b8('0x27')](_0xc0e68c[_0x91b8('0x21')]);_0x596071['filters']=_[_0x91b8('0x2a')](_0x596071[_0x91b8('0x26')],_0x596071[_0x91b8('0x21')]);_0xcbe0b[_0x91b8('0x2b')]=_[_0x91b8('0x2a')](_0x596071[_0x91b8('0x26')],qs['fields'](_0xc0e68c[_0x91b8('0x21')][_0x91b8('0x2c')]));_0xcbe0b[_0x91b8('0x2b')]=_0xcbe0b[_0x91b8('0x2b')][_0x91b8('0x2d')]?_0xcbe0b[_0x91b8('0x2b')]:_0x596071[_0x91b8('0x26')];if(_0xc0e68c[_0x91b8('0x21')][_0x91b8('0x2e')]){_0xcbe0b[_0x91b8('0x2f')]=[{'all':!![]}];}_0xcbe0b=_['merge']({},_0xcbe0b,_0xc0e68c['options']);return db[_0x91b8('0x28')][_0x91b8('0x30')](_0xcbe0b)[_0x91b8('0x16')](handleEntityNotFound(_0x354128,null))[_0x91b8('0x16')](respondWithResult(_0x354128,null))[_0x91b8('0x23')](handleError(_0x354128,null));};exports[_0x91b8('0x31')]=function(_0x110ca6,_0x352316){return db[_0x91b8('0x28')]['create'](_0x110ca6[_0x91b8('0x32')],{})[_0x91b8('0x16')](respondWithResult(_0x352316,0xc9))['catch'](handleError(_0x352316,null));};exports[_0x91b8('0x33')]=function(_0x34912a,_0x5e1a93){if(_0x34912a[_0x91b8('0x32')]['id']){delete _0x34912a[_0x91b8('0x32')]['id'];}return db[_0x91b8('0x28')][_0x91b8('0x30')]({'where':{'id':_0x34912a['params']['id']}})['then'](handleEntityNotFound(_0x5e1a93,null))[_0x91b8('0x16')](saveUpdates(_0x34912a[_0x91b8('0x32')],null))['then'](respondWithResult(_0x5e1a93,null))['catch'](handleError(_0x5e1a93,null));};exports[_0x91b8('0x34')]=function(_0x3858e2,_0x36f1bf){return db[_0x91b8('0x28')][_0x91b8('0x30')]({'where':{'id':_0x3858e2[_0x91b8('0x25')]['id']}})['then'](handleEntityNotFound(_0x36f1bf,null))[_0x91b8('0x16')](removeEntity(_0x36f1bf,null))[_0x91b8('0x23')](handleError(_0x36f1bf,null));};exports[_0x91b8('0x35')]=function(_0x512720,_0x5f1a97){return db['WhatsappInteraction'][_0x91b8('0x35')]()['then'](respondWithResult(_0x5f1a97,null))[_0x91b8('0x23')](handleError(_0x5f1a97,null));};exports[_0x91b8('0x36')]=function(_0x539087,_0x5ca9aa){return db[_0x91b8('0x37')][_0x91b8('0x30')]({'where':{'id':_0x539087[_0x91b8('0x25')]['id']}})[_0x91b8('0x16')](handleEntityNotFound(_0x5ca9aa,null))[_0x91b8('0x16')](function(_0x26a9c1){if(_0x26a9c1){return _0x26a9c1[_0x91b8('0x36')](_0x539087[_0x91b8('0x32')]['ids'],_[_0x91b8('0x38')](_0x539087[_0x91b8('0x32')],[_0x91b8('0x39'),'id'])||{});}})[_0x91b8('0x16')](respondWithResult(_0x5ca9aa,null))[_0x91b8('0x23')](handleError(_0x5ca9aa,null));};exports['getMessages']=function(_0x18ab64,_0x2688b9){var _0x527e92={'raw':![],'where':{}};var _0x296a10={};var _0x31c55b={'count':0x0,'rows':[]};return db[_0x91b8('0x28')]['findOne']({'where':{'id':_0x18ab64[_0x91b8('0x25')]['id']}})['then'](handleEntityNotFound(_0x2688b9,null))[_0x91b8('0x16')](function(_0x1764fe){if(_0x1764fe){_0x296a10['model']=_['keys'](db[_0x91b8('0x37')][_0x91b8('0x29')]);_0x296a10['query']=_[_0x91b8('0x27')](_0x18ab64[_0x91b8('0x21')]);_0x296a10[_0x91b8('0x3a')]=_[_0x91b8('0x2a')](_0x296a10[_0x91b8('0x26')],_0x296a10[_0x91b8('0x21')]);_0x527e92[_0x91b8('0x2b')]=_[_0x91b8('0x2a')](_0x296a10[_0x91b8('0x26')],qs[_0x91b8('0x2c')](_0x18ab64[_0x91b8('0x21')][_0x91b8('0x2c')]));_0x527e92[_0x91b8('0x2b')]=_0x527e92[_0x91b8('0x2b')][_0x91b8('0x2d')]?_0x527e92['attributes']:_0x296a10[_0x91b8('0x26')];if(!_0x18ab64[_0x91b8('0x21')]['hasOwnProperty'](_0x91b8('0x3b'))){_0x527e92[_0x91b8('0x13')]=qs[_0x91b8('0x13')](_0x18ab64[_0x91b8('0x21')]['limit']);_0x527e92[_0x91b8('0x15')]=qs[_0x91b8('0x15')](_0x18ab64[_0x91b8('0x21')][_0x91b8('0x15')]);}_0x527e92[_0x91b8('0x3c')]=qs[_0x91b8('0x3d')](_0x18ab64[_0x91b8('0x21')][_0x91b8('0x3d')]);_0x527e92[_0x91b8('0x3e')]=qs[_0x91b8('0x3a')](_['pick'](_0x18ab64['query'],_0x296a10['filters']));_0x527e92['where'][_0x91b8('0x3f')]=_0x1764fe['id'];if(_0x18ab64['query'][_0x91b8('0x40')]){_0x527e92['where']=_[_0x91b8('0x41')](_0x527e92[_0x91b8('0x3e')],{'$or':_['map'](_0x527e92[_0x91b8('0x2b')],function(_0x220558){var _0x2c309b={};_0x2c309b[_0x220558]={'$like':'%'+_0x18ab64[_0x91b8('0x21')][_0x91b8('0x40')]+'%'};return _0x2c309b;})});}if(_0x18ab64[_0x91b8('0x21')][_0x91b8('0x42')]){var _0x4bca90=_0x18ab64['query'][_0x91b8('0x42')][_0x91b8('0x43')](',');var _0xe6d078={};_0xe6d078[_0x4bca90[0x0]]={'$gte':moment(_0x4bca90[0x1])[_0x91b8('0x44')](_0x91b8('0x45'))};_0x527e92['where']=_[_0x91b8('0x41')](_0x527e92[_0x91b8('0x3e')],_0xe6d078);}_0x527e92=_[_0x91b8('0x41')]({},_0x527e92,_0x18ab64['options']);return db[_0x91b8('0x37')][_0x91b8('0x14')]({'where':_0x527e92[_0x91b8('0x3e')]})[_0x91b8('0x16')](function(_0x8949ca){_0x31c55b['count']=_0x8949ca;if(_0x18ab64[_0x91b8('0x21')][_0x91b8('0x2e')]){_0x527e92[_0x91b8('0x2f')]=[{'all':!![]}];}return db[_0x91b8('0x37')][_0x91b8('0x1f')](_0x527e92);})[_0x91b8('0x16')](function(_0x4c4611){_0x31c55b['rows']=_0x4c4611;return _0x31c55b;});}})[_0x91b8('0x16')](respondWithFilteredResult(_0x2688b9,_0x527e92))[_0x91b8('0x23')](handleError(_0x2688b9,null));};exports[_0x91b8('0x46')]=function(_0x2b01f1,_0x45f2f1){return db['WhatsappInteraction'][_0x91b8('0x30')]({'where':{'id':_0x2b01f1[_0x91b8('0x25')]['id']}})['then'](handleEntityNotFound(_0x45f2f1,null))[_0x91b8('0x16')](function(_0x392064){if(_0x392064){return _0x392064[_0x91b8('0x47')](_0x2b01f1[_0x91b8('0x32')]['ids'],_[_0x91b8('0x38')](_0x2b01f1[_0x91b8('0x32')],[_0x91b8('0x39'),'id'])||{})['spread'](function(){return db[_0x91b8('0x48')]['findAll']({'attributes':['id',_0x91b8('0x19'),'color'],'where':{'id':_0x2b01f1[_0x91b8('0x32')][_0x91b8('0x39')]}});})['then'](function(_0x2c4b64){socket[_0x91b8('0x49')]('whatsappInteractionTags:save',{'id':Number(_0x2b01f1['params']['id']),'tags':_0x2c4b64||[]});return{'id':Number(_0x2b01f1[_0x91b8('0x25')]['id']),'tags':_0x2c4b64||[]};});}})[_0x91b8('0x16')](respondWithResult(_0x45f2f1,null))[_0x91b8('0x23')](handleError(_0x45f2f1,null));};exports[_0x91b8('0x4a')]=function(_0x51ccc1,_0x538431){return db[_0x91b8('0x28')][_0x91b8('0x30')]({'where':{'id':_0x51ccc1[_0x91b8('0x25')]['id']}})[_0x91b8('0x16')](handleEntityNotFound(_0x538431,null))['then'](function(_0xe0ca57){if(_0xe0ca57){return _0xe0ca57[_0x91b8('0x4a')](_0x51ccc1[_0x91b8('0x21')][_0x91b8('0x39')]);}})[_0x91b8('0x16')](respondWithStatusCode(_0x538431,null))[_0x91b8('0x23')](handleError(_0x538431,null));};exports[_0x91b8('0x4b')]=function(_0x439bac,_0x1b6d9e){var _0x547c4e=moment()[_0x91b8('0x4c')]()[_0x91b8('0x4d')]();var _0x5ebb1f=path[_0x91b8('0x4e')](config[_0x91b8('0x4f')],_0x91b8('0x50'),_0x91b8('0x51'),'tmp');var _0x3e0f34=path[_0x91b8('0x4e')](config[_0x91b8('0x4f')],_0x91b8('0x50'),_0x91b8('0x51'),_0x91b8('0x52'));var _0x4a3e23=path[_0x91b8('0x4e')](_0x5ebb1f,_0x547c4e);var _0x88a9e5=util[_0x91b8('0x44')]('transcript-%d-%s.zip',_0x439bac['params']['id'],_0x547c4e);var _0x2243fd=path['join'](_0x5ebb1f,_0x88a9e5);var _0x3f7df3=[];_0x3f7df3[_0x91b8('0x53')]({'model':db[_0x91b8('0x54')],'as':_0x91b8('0x54'),'attributes':['id',_0x91b8('0x55')],'raw':!![]});_0x3f7df3[_0x91b8('0x53')]({'model':db[_0x91b8('0x56')],'as':_0x91b8('0x57'),'attributes':['id',_0x91b8('0x58'),_0x91b8('0x59')],'raw':!![]});if(_0x439bac[_0x91b8('0x21')]['attachments']){_0x3f7df3['push']({'model':db[_0x91b8('0x5a')],'as':'Attachment','raw':!![]});}var _0x3d0eec=[{'model':db[_0x91b8('0x37')],'as':'Messages','attributes':['id',_0x91b8('0x32'),_0x91b8('0x5b'),_0x91b8('0x5c'),'secret','read'],'include':_0x3f7df3}];_0x3d0eec[_0x91b8('0x53')]({'model':db[_0x91b8('0x5d')],'as':_0x91b8('0x5e'),'attributes':['id','name']});_0x3d0eec['push']({'model':db[_0x91b8('0x54')],'as':_0x91b8('0x5f'),'attributes':['id',_0x91b8('0x55')]});return db[_0x91b8('0x28')]['find']({'where':{'id':_0x439bac['params']['id']},'include':_0x3d0eec})[_0x91b8('0x16')](handleEntityNotFound(_0x1b6d9e,null))['then'](function(_0x1a8242){if(_0x1a8242){var _0x58a8f1=_0x1a8242['get']({'plain':!![]});fs[_0x91b8('0x60')](_0x4a3e23);var _0x2010b3={'channel':_0x91b8('0x61'),'account':_0x58a8f1['Account'][_0x91b8('0x19')],'agent':_0x58a8f1['Owner']?_0x58a8f1[_0x91b8('0x5f')][_0x91b8('0x55')]:_0x91b8('0x62'),'createdAt':moment(_0x58a8f1[_0x91b8('0x5b')])[_0x91b8('0x44')](_0x91b8('0x45'))[_0x91b8('0x4d')](),'closedAt':_0x58a8f1[_0x91b8('0x63')]?moment(_0x58a8f1[_0x91b8('0x64')])[_0x91b8('0x44')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x58a8f1['disposition'],'messages':_(_0x58a8f1[_0x91b8('0x65')])[_0x91b8('0x40')]({'secret':![]})[_0x91b8('0x1c')](function(_0x2006d3){if(_0x2006d3['Attachment']){var _0x46b964=path[_0x91b8('0x4e')](_0x3e0f34,_0x2006d3['Attachment'][_0x91b8('0x66')]);if(fs[_0x91b8('0x67')](_0x46b964)){fs[_0x91b8('0x68')](_0x46b964)['pipe'](fs[_0x91b8('0x69')](path[_0x91b8('0x4e')](_0x4a3e23,_0x2006d3[_0x91b8('0x5a')][_0x91b8('0x66')])));}}return{'date':moment(_0x2006d3[_0x91b8('0x5b')])[_0x91b8('0x44')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2006d3[_0x91b8('0x5c')]==='out'?_0x2006d3['User']?_0x2006d3[_0x91b8('0x54')][_0x91b8('0x55')]:'System':_0x2006d3[_0x91b8('0x57')][_0x91b8('0x58')]+(_0x2006d3[_0x91b8('0x57')]['lastName']?'\x20'+_0x2006d3[_0x91b8('0x57')][_0x91b8('0x59')]:''),'body':_0x2006d3[_0x91b8('0x5a')]?_0x2006d3[_0x91b8('0x5a')][_0x91b8('0x66')]:_0x2006d3[_0x91b8('0x32')],'direction':_0x2006d3[_0x91b8('0x5c')]===_0x91b8('0x6a')?'A':'C','secret':_0x2006d3[_0x91b8('0x6b')],'read':_0x2006d3[_0x91b8('0x6c')],'attachment':_0x2006d3['Attachment']};})[_0x91b8('0x6d')]()};return ejs[_0x91b8('0x6e')](path[_0x91b8('0x4e')](config[_0x91b8('0x4f')],_0x91b8('0x50'),'views',_0x91b8('0x6f')),{'interaction':_0x2010b3})[_0x91b8('0x16')](function(_0xd5f765){var _0x1a73e0=path[_0x91b8('0x4e')](_0x4a3e23,_0x91b8('0x70')+_0x58a8f1['id']+'-'+_0x547c4e+_0x91b8('0x71'));var _0x30d53e={'path':_0x1a73e0,'channel':'Whatsapp','interactionId':_0x58a8f1['id']};return pdf[_0x91b8('0x72')](_0xd5f765,_0x30d53e);})[_0x91b8('0x16')](function(){return new BPromise(function(_0x33cc5e,_0x3e35b9){zipdir(_0x4a3e23,{'saveTo':_0x2243fd},function(_0x5002b9,_0x6dcdb4){if(_0x5002b9)return _0x3e35b9(_0x5002b9);return _0x33cc5e(_0x6dcdb4);});})[_0x91b8('0x16')](function(){return new BPromise(function(_0x21e72a,_0x4b122c){rimraf(_0x4a3e23,function(_0x5dd759){if(_0x5dd759)_0x4b122c(_0x5dd759);return _0x21e72a();});});})[_0x91b8('0x16')](function(){return _0x1b6d9e[_0x91b8('0x4b')](_0x2243fd,_0x88a9e5,function(_0x164d6e){if(_0x164d6e){console[_0x91b8('0x73')](_0x91b8('0x74'),_0x164d6e);}else{fs[_0x91b8('0x75')](_0x2243fd);}});});});}else{return _0x1b6d9e[_0x91b8('0x10')](0xc8);}})[_0x91b8('0x23')](handleError(_0x1b6d9e,null));}; \ No newline at end of file +var _0x5b92=['ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','pick','WhatsappInteractionId','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','Tag','emit','removeTags','download','unix','toString','join','root','files','server','User','fullname','push','Contact','firstName','lastName','attachments','Messages','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','createdAt','closedAt','format','disposition','Attachment','basename','existsSync','createReadStream','createWriteStream','direction','out','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','stack','name','send','map','WhatsappInteraction','rawAttributes','fieldName','type','key','whatsapp','query','user','catch','show','params','keys','filters','intersection','fields','attributes','model','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','WhatsappMessage'];(function(_0x1abf8a,_0x23ceec){var _0x4c9456=function(_0x267b3b){while(--_0x267b3b){_0x1abf8a['push'](_0x1abf8a['shift']());}};_0x4c9456(++_0x23ceec);}(_0x5b92,0x136));var _0x25b9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x5b92[_0x56482c];return _0x5aae7a;};'use strict';var rimraf=require(_0x25b9('0x0'));var zipdir=require(_0x25b9('0x1'));var moment=require(_0x25b9('0x2'));var BPromise=require('bluebird');var util=require(_0x25b9('0x3'));var path=require(_0x25b9('0x4'));var ejs=require(_0x25b9('0x5'));var fs=require('fs');var _=require(_0x25b9('0x6'));var Redis=require(_0x25b9('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x25b9('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x25b9('0x9'));var config=require(_0x25b9('0xa'));var db=require(_0x25b9('0xb'))['db'];config[_0x25b9('0xc')]=_[_0x25b9('0xd')](config[_0x25b9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x25b9('0xe'))(new Redis(config[_0x25b9('0xc')]));require(_0x25b9('0xf'))[_0x25b9('0x10')](socket);function respondWithStatusCode(_0x425758,_0x37cb24){_0x37cb24=_0x37cb24||0xcc;return function(_0x5eae1c){if(_0x5eae1c){return _0x425758[_0x25b9('0x11')](_0x37cb24);}return _0x425758[_0x25b9('0x12')](_0x37cb24)['end']();};}function respondWithResult(_0x4d825,_0x458b96){_0x458b96=_0x458b96||0xc8;return function(_0x33f723){if(_0x33f723){return _0x4d825[_0x25b9('0x12')](_0x458b96)[_0x25b9('0x13')](_0x33f723);}};}function respondWithFilteredResult(_0x3a2142,_0x4fc533){return function(_0x1d707b){if(_0x1d707b){var _0x14b5c0=typeof _0x4fc533[_0x25b9('0x14')]===_0x25b9('0x15')&&typeof _0x4fc533[_0x25b9('0x16')]===_0x25b9('0x15');var _0x4b3490=_0x1d707b['count'];var _0x109518=_0x14b5c0?0x0:_0x4fc533['offset'];var _0x3d0060=_0x14b5c0?_0x1d707b[_0x25b9('0x17')]:_0x4fc533[_0x25b9('0x14')]+_0x4fc533['limit'];var _0x4406b1;if(_0x3d0060>=_0x4b3490){_0x3d0060=_0x4b3490;_0x4406b1=0xc8;}else{_0x4406b1=0xce;}_0x3a2142[_0x25b9('0x12')](_0x4406b1);return _0x3a2142[_0x25b9('0x18')]('Content-Range',_0x109518+'-'+_0x3d0060+'/'+_0x4b3490)[_0x25b9('0x13')](_0x1d707b);}return null;};}function saveUpdates(_0x2ea238){return function(_0x302c7d){if(_0x302c7d){return _0x302c7d[_0x25b9('0x19')](_0x2ea238)[_0x25b9('0x1a')](function(_0xcef4a6){return _0xcef4a6;});}return null;};}function removeEntity(_0x270955){return function(_0xebd747){if(_0xebd747){return _0xebd747['destroy']()[_0x25b9('0x1a')](function(){_0x270955[_0x25b9('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4010ad){return function(_0x617037){if(!_0x617037){_0x4010ad[_0x25b9('0x11')](0x194);}return _0x617037;};}function handleError(_0x566bc6,_0x22ad12){_0x22ad12=_0x22ad12||0x1f4;return function(_0x2cea31){logger['error'](_0x2cea31[_0x25b9('0x1b')]);if(_0x2cea31['name']){delete _0x2cea31[_0x25b9('0x1c')];}_0x566bc6[_0x25b9('0x12')](_0x22ad12)[_0x25b9('0x1d')](_0x2cea31);};}exports['index']=function(_0x487c06,_0x187af9){var _0x40d3c0={};var _0xb5bfe2=_[_0x25b9('0x1e')](db[_0x25b9('0x1f')][_0x25b9('0x20')],function(_0x3a838a){return{'name':_0x3a838a[_0x25b9('0x21')],'type':_0x3a838a[_0x25b9('0x22')][_0x25b9('0x23')]};});_0x40d3c0=qs['getOptions'](_0xb5bfe2,_0x487c06);return interaction['findAll'](_0x25b9('0x24'),_0x487c06[_0x25b9('0x25')],_0x487c06[_0x25b9('0x26')],_0x40d3c0,_0xb5bfe2)['then'](respondWithFilteredResult(_0x187af9,_0x40d3c0))[_0x25b9('0x27')](handleError(_0x187af9,null));};exports[_0x25b9('0x28')]=function(_0x1f38a6,_0x2685da){var _0x133c79={'raw':![],'where':{'id':_0x1f38a6[_0x25b9('0x29')]['id']}},_0x5e6028={};_0x5e6028['model']=_[_0x25b9('0x2a')](db[_0x25b9('0x1f')][_0x25b9('0x20')]);_0x5e6028[_0x25b9('0x25')]=_[_0x25b9('0x2a')](_0x1f38a6[_0x25b9('0x25')]);_0x5e6028[_0x25b9('0x2b')]=_[_0x25b9('0x2c')](_0x5e6028['model'],_0x5e6028[_0x25b9('0x25')]);_0x133c79['attributes']=_[_0x25b9('0x2c')](_0x5e6028['model'],qs[_0x25b9('0x2d')](_0x1f38a6['query']['fields']));_0x133c79[_0x25b9('0x2e')]=_0x133c79['attributes']['length']?_0x133c79['attributes']:_0x5e6028[_0x25b9('0x2f')];if(_0x1f38a6[_0x25b9('0x25')][_0x25b9('0x30')]){_0x133c79[_0x25b9('0x31')]=[{'all':!![]}];}_0x133c79=_[_0x25b9('0x32')]({},_0x133c79,_0x1f38a6[_0x25b9('0x33')]);return db[_0x25b9('0x1f')][_0x25b9('0x34')](_0x133c79)[_0x25b9('0x1a')](handleEntityNotFound(_0x2685da,null))[_0x25b9('0x1a')](respondWithResult(_0x2685da,null))['catch'](handleError(_0x2685da,null));};exports[_0x25b9('0x35')]=function(_0x2b2d30,_0x1e4b75){return db['WhatsappInteraction'][_0x25b9('0x35')](_0x2b2d30[_0x25b9('0x36')],{})[_0x25b9('0x1a')](respondWithResult(_0x1e4b75,0xc9))[_0x25b9('0x27')](handleError(_0x1e4b75,null));};exports[_0x25b9('0x19')]=function(_0x1685b7,_0x3c4541){if(_0x1685b7[_0x25b9('0x36')]['id']){delete _0x1685b7[_0x25b9('0x36')]['id'];}return db[_0x25b9('0x1f')][_0x25b9('0x34')]({'where':{'id':_0x1685b7['params']['id']}})[_0x25b9('0x1a')](handleEntityNotFound(_0x3c4541,null))[_0x25b9('0x1a')](saveUpdates(_0x1685b7['body'],null))[_0x25b9('0x1a')](respondWithResult(_0x3c4541,null))[_0x25b9('0x27')](handleError(_0x3c4541,null));};exports[_0x25b9('0x37')]=function(_0x3c577a,_0x2d1b15){return db[_0x25b9('0x1f')][_0x25b9('0x34')]({'where':{'id':_0x3c577a[_0x25b9('0x29')]['id']}})['then'](handleEntityNotFound(_0x2d1b15,null))['then'](removeEntity(_0x2d1b15,null))[_0x25b9('0x27')](handleError(_0x2d1b15,null));};exports[_0x25b9('0x38')]=function(_0x4217e1,_0x34e24e){return db[_0x25b9('0x1f')][_0x25b9('0x38')]()[_0x25b9('0x1a')](respondWithResult(_0x34e24e,null))[_0x25b9('0x27')](handleError(_0x34e24e,null));};exports[_0x25b9('0x39')]=function(_0x422c84,_0xafdfc4){return db[_0x25b9('0x3a')][_0x25b9('0x34')]({'where':{'id':_0x422c84[_0x25b9('0x29')]['id']}})['then'](handleEntityNotFound(_0xafdfc4,null))[_0x25b9('0x1a')](function(_0xa302ef){if(_0xa302ef){return _0xa302ef[_0x25b9('0x39')](_0x422c84['body'][_0x25b9('0x3b')],_[_0x25b9('0x3c')](_0x422c84[_0x25b9('0x36')],[_0x25b9('0x3b'),'id'])||{});}})[_0x25b9('0x1a')](respondWithResult(_0xafdfc4,null))[_0x25b9('0x27')](handleError(_0xafdfc4,null));};exports[_0x25b9('0x3d')]=function(_0x29b9ae,_0x16f7c3){var _0x2a3cde={'raw':![],'where':{}};var _0x576abd={};var _0x35f4e3={'count':0x0,'rows':[]};return db[_0x25b9('0x1f')][_0x25b9('0x3e')]({'where':{'id':_0x29b9ae['params']['id']}})[_0x25b9('0x1a')](handleEntityNotFound(_0x16f7c3,null))[_0x25b9('0x1a')](function(_0x457145){if(_0x457145){_0x576abd[_0x25b9('0x2f')]=_[_0x25b9('0x2a')](db[_0x25b9('0x3a')][_0x25b9('0x20')]);_0x576abd['query']=_[_0x25b9('0x2a')](_0x29b9ae[_0x25b9('0x25')]);_0x576abd[_0x25b9('0x2b')]=_['intersection'](_0x576abd['model'],_0x576abd['query']);_0x2a3cde['attributes']=_[_0x25b9('0x2c')](_0x576abd[_0x25b9('0x2f')],qs[_0x25b9('0x2d')](_0x29b9ae[_0x25b9('0x25')][_0x25b9('0x2d')]));_0x2a3cde[_0x25b9('0x2e')]=_0x2a3cde[_0x25b9('0x2e')][_0x25b9('0x3f')]?_0x2a3cde[_0x25b9('0x2e')]:_0x576abd[_0x25b9('0x2f')];if(!_0x29b9ae['query'][_0x25b9('0x40')](_0x25b9('0x41'))){_0x2a3cde[_0x25b9('0x16')]=qs[_0x25b9('0x16')](_0x29b9ae[_0x25b9('0x25')][_0x25b9('0x16')]);_0x2a3cde[_0x25b9('0x14')]=qs[_0x25b9('0x14')](_0x29b9ae[_0x25b9('0x25')]['offset']);}_0x2a3cde[_0x25b9('0x42')]=qs['sort'](_0x29b9ae[_0x25b9('0x25')][_0x25b9('0x43')]);_0x2a3cde['where']=qs[_0x25b9('0x2b')](_[_0x25b9('0x44')](_0x29b9ae['query'],_0x576abd[_0x25b9('0x2b')]));_0x2a3cde['where'][_0x25b9('0x45')]=_0x457145['id'];if(_0x29b9ae[_0x25b9('0x25')]['filter']){_0x2a3cde['where']=_[_0x25b9('0x32')](_0x2a3cde[_0x25b9('0x46')],{'$or':_[_0x25b9('0x1e')](_0x2a3cde[_0x25b9('0x2e')],function(_0x34eac4){var _0x10fd17={};_0x10fd17[_0x34eac4]={'$like':'%'+_0x29b9ae['query'][_0x25b9('0x47')]+'%'};return _0x10fd17;})});}if(_0x29b9ae[_0x25b9('0x25')][_0x25b9('0x48')]){var _0x28e8b=_0x29b9ae[_0x25b9('0x25')][_0x25b9('0x48')][_0x25b9('0x49')](',');var _0x551612={};_0x551612[_0x28e8b[0x0]]={'$gte':moment(_0x28e8b[0x1])['format'](_0x25b9('0x4a'))};_0x2a3cde[_0x25b9('0x46')]=_['merge'](_0x2a3cde['where'],_0x551612);}_0x2a3cde=_['merge']({},_0x2a3cde,_0x29b9ae['options']);return db[_0x25b9('0x3a')]['count']({'where':_0x2a3cde[_0x25b9('0x46')]})[_0x25b9('0x1a')](function(_0xd9b457){_0x35f4e3[_0x25b9('0x17')]=_0xd9b457;if(_0x29b9ae[_0x25b9('0x25')][_0x25b9('0x30')]){_0x2a3cde['include']=[{'all':!![]}];}return db[_0x25b9('0x3a')][_0x25b9('0x4b')](_0x2a3cde);})[_0x25b9('0x1a')](function(_0xd9150d){_0x35f4e3['rows']=_0xd9150d;return _0x35f4e3;});}})['then'](respondWithFilteredResult(_0x16f7c3,_0x2a3cde))[_0x25b9('0x27')](handleError(_0x16f7c3,null));};exports[_0x25b9('0x4c')]=function(_0x34a532,_0x3fbc2c){return db[_0x25b9('0x1f')][_0x25b9('0x34')]({'where':{'id':_0x34a532['params']['id']}})[_0x25b9('0x1a')](handleEntityNotFound(_0x3fbc2c,null))[_0x25b9('0x1a')](function(_0x44d73b){if(_0x44d73b){return _0x44d73b['setTags'](_0x34a532['body'][_0x25b9('0x3b')],_[_0x25b9('0x3c')](_0x34a532[_0x25b9('0x36')],[_0x25b9('0x3b'),'id'])||{})['spread'](function(){return db[_0x25b9('0x4d')][_0x25b9('0x4b')]({'attributes':['id','name','color'],'where':{'id':_0x34a532[_0x25b9('0x36')][_0x25b9('0x3b')]}});})[_0x25b9('0x1a')](function(_0x22987f){socket[_0x25b9('0x4e')]('whatsappInteractionTags:save',{'id':Number(_0x34a532[_0x25b9('0x29')]['id']),'tags':_0x22987f||[]});return{'id':Number(_0x34a532[_0x25b9('0x29')]['id']),'tags':_0x22987f||[]};});}})['then'](respondWithResult(_0x3fbc2c,null))[_0x25b9('0x27')](handleError(_0x3fbc2c,null));};exports[_0x25b9('0x4f')]=function(_0x4bc810,_0x486215){return db[_0x25b9('0x1f')]['find']({'where':{'id':_0x4bc810[_0x25b9('0x29')]['id']}})[_0x25b9('0x1a')](handleEntityNotFound(_0x486215,null))[_0x25b9('0x1a')](function(_0x4a2b3c){if(_0x4a2b3c){return _0x4a2b3c[_0x25b9('0x4f')](_0x4bc810['query'][_0x25b9('0x3b')]);}})[_0x25b9('0x1a')](respondWithStatusCode(_0x486215,null))['catch'](handleError(_0x486215,null));};exports[_0x25b9('0x50')]=function(_0x189ee7,_0x21f124){var _0x3a555c=moment()[_0x25b9('0x51')]()[_0x25b9('0x52')]();var _0x3ccc32=path[_0x25b9('0x53')](config[_0x25b9('0x54')],'server',_0x25b9('0x55'),'tmp');var _0x54adff=path[_0x25b9('0x53')](config[_0x25b9('0x54')],_0x25b9('0x56'),_0x25b9('0x55'),'attachments');var _0x4e0870=path[_0x25b9('0x53')](_0x3ccc32,_0x3a555c);var _0x892254=util['format']('transcript-%d-%s.zip',_0x189ee7[_0x25b9('0x29')]['id'],_0x3a555c);var _0x4a05ee=path['join'](_0x3ccc32,_0x892254);var _0x38cc29=[];_0x38cc29['push']({'model':db[_0x25b9('0x57')],'as':'User','attributes':['id',_0x25b9('0x58')],'raw':!![]});_0x38cc29[_0x25b9('0x59')]({'model':db['CmContact'],'as':_0x25b9('0x5a'),'attributes':['id',_0x25b9('0x5b'),_0x25b9('0x5c')],'raw':!![]});if(_0x189ee7['query'][_0x25b9('0x5d')]){_0x38cc29[_0x25b9('0x59')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x68f84e=[{'model':db['WhatsappMessage'],'as':_0x25b9('0x5e'),'attributes':['id',_0x25b9('0x36'),'createdAt','direction','secret',_0x25b9('0x5f')],'include':_0x38cc29}];_0x68f84e[_0x25b9('0x59')]({'model':db[_0x25b9('0x60')],'as':_0x25b9('0x61'),'attributes':['id',_0x25b9('0x1c')]});_0x68f84e[_0x25b9('0x59')]({'model':db[_0x25b9('0x57')],'as':'Owner','attributes':['id',_0x25b9('0x58')]});return db['WhatsappInteraction'][_0x25b9('0x34')]({'where':{'id':_0x189ee7[_0x25b9('0x29')]['id']},'include':_0x68f84e})[_0x25b9('0x1a')](handleEntityNotFound(_0x21f124,null))[_0x25b9('0x1a')](function(_0x2aa161){if(_0x2aa161){var _0x1ddbc5=_0x2aa161[_0x25b9('0x62')]({'plain':!![]});fs[_0x25b9('0x63')](_0x4e0870);var _0xa9786={'channel':_0x25b9('0x64'),'account':_0x1ddbc5['Account']['name'],'agent':_0x1ddbc5[_0x25b9('0x65')]?_0x1ddbc5[_0x25b9('0x65')][_0x25b9('0x58')]:'N.A.','createdAt':moment(_0x1ddbc5[_0x25b9('0x66')])['format'](_0x25b9('0x4a'))[_0x25b9('0x52')](),'closedAt':_0x1ddbc5['closed']?moment(_0x1ddbc5[_0x25b9('0x67')])[_0x25b9('0x68')](_0x25b9('0x4a'))['toString']():'','disposition':_0x1ddbc5[_0x25b9('0x69')],'messages':_(_0x1ddbc5[_0x25b9('0x5e')])[_0x25b9('0x47')]({'secret':![]})[_0x25b9('0x1e')](function(_0x1d79c6){if(_0x1d79c6['Attachment']){var _0x25bdcb=path[_0x25b9('0x53')](_0x54adff,_0x1d79c6[_0x25b9('0x6a')][_0x25b9('0x6b')]);if(fs[_0x25b9('0x6c')](_0x25bdcb)){fs[_0x25b9('0x6d')](_0x25bdcb)['pipe'](fs[_0x25b9('0x6e')](path['join'](_0x4e0870,_0x1d79c6['Attachment']['basename'])));}}return{'date':moment(_0x1d79c6['createdAt'])[_0x25b9('0x68')](_0x25b9('0x4a'))[_0x25b9('0x52')](),'sender':_0x1d79c6[_0x25b9('0x6f')]==='out'?_0x1d79c6['User']?_0x1d79c6['User'][_0x25b9('0x58')]:'System':_0x1d79c6[_0x25b9('0x5a')][_0x25b9('0x5b')]+(_0x1d79c6[_0x25b9('0x5a')][_0x25b9('0x5c')]?'\x20'+_0x1d79c6[_0x25b9('0x5a')][_0x25b9('0x5c')]:''),'body':_0x1d79c6[_0x25b9('0x6a')]?_0x1d79c6['Attachment']['basename']:_0x1d79c6['body'],'direction':_0x1d79c6[_0x25b9('0x6f')]===_0x25b9('0x70')?'A':'C','secret':_0x1d79c6[_0x25b9('0x71')],'read':_0x1d79c6[_0x25b9('0x5f')],'attachment':_0x1d79c6['Attachment']};})[_0x25b9('0x72')]()};return ejs[_0x25b9('0x73')](path['join'](config[_0x25b9('0x54')],'server',_0x25b9('0x74'),_0x25b9('0x75')),{'interaction':_0xa9786})[_0x25b9('0x1a')](function(_0x28fa04){var _0x360bfa=path[_0x25b9('0x53')](_0x4e0870,_0x25b9('0x76')+_0x1ddbc5['id']+'-'+_0x3a555c+_0x25b9('0x77'));var _0x96f23a={'path':_0x360bfa,'channel':_0x25b9('0x64'),'interactionId':_0x1ddbc5['id']};return pdf[_0x25b9('0x78')](_0x28fa04,_0x96f23a);})[_0x25b9('0x1a')](function(){return new BPromise(function(_0x58e0d8,_0x1556b9){zipdir(_0x4e0870,{'saveTo':_0x4a05ee},function(_0x420412,_0x342905){if(_0x420412)return _0x1556b9(_0x420412);return _0x58e0d8(_0x342905);});})[_0x25b9('0x1a')](function(){return new BPromise(function(_0x4f7e7f,_0x3659ea){rimraf(_0x4e0870,function(_0x2c16b7){if(_0x2c16b7)_0x3659ea(_0x2c16b7);return _0x4f7e7f();});});})[_0x25b9('0x1a')](function(){return _0x21f124[_0x25b9('0x50')](_0x4a05ee,_0x892254,function(_0x108b42){if(_0x108b42){console[_0x25b9('0x79')]('err',_0x108b42);}else{fs[_0x25b9('0x7a')](_0x4a05ee);}});});});}else{return _0x21f124[_0x25b9('0x11')](0xc8);}})[_0x25b9('0x27')](handleError(_0x21f124,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index abb246e..978d7dc 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 _0xf4eb=['then','setDataValue','findAll','unreadMessages','length','catch','hook','exports','events','setMaxListeners','remove','getUsers'];(function(_0x211118,_0x47e09e){var _0x463d8c=function(_0x286e30){while(--_0x286e30){_0x211118['push'](_0x211118['shift']());}};_0x463d8c(++_0x47e09e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3df7b6,_0x454243){_0x3df7b6=_0x3df7b6-0x0;var _0x586432=_0xf4eb[_0x3df7b6];return _0x586432;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbf4e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbf4e('0x2')};function emitEvent(_0x1c7606){return function(_0x32d1d7,_0x18c665,_0xa4dcf5){_0x32d1d7[_0xbf4e('0x3')]({'attributes':['id'],'raw':!![]})[_0xbf4e('0x4')](function(_0x540736){_0x32d1d7[_0xbf4e('0x5')]('Users',_0x540736['map'](function(_0xa4280c){return{'id':_0xa4280c['id']};}));return WhatsappMessage[_0xbf4e('0x6')]({'where':{'WhatsappInteractionId':_0x32d1d7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbf4e('0x4')](function(_0xc86f04){_0x32d1d7[_0xbf4e('0x5')](_0xbf4e('0x7'),_0xc86f04[_0xbf4e('0x8')]);WhatsappInteractionEvents['emit'](_0x1c7606+':'+_0x32d1d7['id'],_0x32d1d7);WhatsappInteractionEvents['emit'](_0x1c7606,_0x32d1d7);_0xa4dcf5(null);})[_0xbf4e('0x9')](_0xa4dcf5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xbf4e('0xa')](e,emitEvent(event));}}module[_0xbf4e('0xb')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1123=['then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','getUsers'];(function(_0x3f9bcb,_0xb6a10a){var _0x169814=function(_0x41d543){while(--_0x41d543){_0x3f9bcb['push'](_0x3f9bcb['shift']());}};_0x169814(++_0xb6a10a);}(_0x1123,0x118));var _0x3112=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1123[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x3112('0x0')];var WhatsappMessage=require('../../mysqldb')['db'][_0x3112('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3112('0x2')](0x0);var events={'afterCreate':_0x3112('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3c1439){return function(_0x1c53cc,_0x21752a,_0x34ad01){_0x1c53cc[_0x3112('0x4')]({'attributes':['id'],'raw':!![]})[_0x3112('0x5')](function(_0x3bee38){_0x1c53cc[_0x3112('0x6')](_0x3112('0x7'),_0x3bee38['map'](function(_0x5f90e5){return{'id':_0x5f90e5['id']};}));return WhatsappMessage[_0x3112('0x8')]({'where':{'WhatsappInteractionId':_0x1c53cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3112('0x5')](function(_0x41a430){_0x1c53cc[_0x3112('0x6')](_0x3112('0x9'),_0x41a430['length']);WhatsappInteractionEvents['emit'](_0x3c1439+':'+_0x1c53cc['id'],_0x1c53cc);WhatsappInteractionEvents[_0x3112('0xa')](_0x3c1439,_0x1c53cc);_0x34ad01(null);})[_0x3112('0xb')](_0x34ad01(null));};}for(var e in events){if(events[_0x3112('0xc')](e)){var event=events[e];WhatsappInteraction[_0x3112('0xd')](e,emitEvent(event));}}module[_0x3112('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 5eee543..cbb4213 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 _0x4c5a=['define','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x15c166,_0xc6050f){var _0x55987e=function(_0x4837f5){while(--_0x4837f5){_0x15c166['push'](_0x15c166['shift']());}};_0x55987e(++_0xc6050f);}(_0x4c5a,0x1c0));var _0xa4c5=function(_0x1a5182,_0x25b2dd){_0x1a5182=_0x1a5182-0x0;var _0x37d275=_0x4c5a[_0x1a5182];return _0x37d275;};'use strict';var _=require(_0xa4c5('0x0'));var util=require(_0xa4c5('0x1'));var logger=require('../../config/logger')(_0xa4c5('0x2'));var moment=require(_0xa4c5('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4c5('0x4'));var fs=require('fs');var path=require(_0xa4c5('0x5'));var rimraf=require('rimraf');var config=require(_0xa4c5('0x6'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x748d28,_0x1141fe){return _0x748d28[_0xa4c5('0x7')](_0xa4c5('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43c5b9,_0x207168,_0x2e3958){if(_0x43c5b9[_0xa4c5('0x9')]('closed')){_0x43c5b9[_0xa4c5('0xa')]=moment()[_0xa4c5('0xb')](_0xa4c5('0xc'));}_0x2e3958(null,_0x43c5b9);}}});}; \ No newline at end of file +var _0x1ec2=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','changed','closedAt'];(function(_0x5232c1,_0x3c6738){var _0x14c81f=function(_0x512961){while(--_0x512961){_0x5232c1['push'](_0x5232c1['shift']());}};_0x14c81f(++_0x3c6738);}(_0x1ec2,0x182));var _0x21ec=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x1ec2[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x21ec('0x0'));var util=require(_0x21ec('0x1'));var logger=require(_0x21ec('0x2'))(_0x21ec('0x3'));var moment=require('moment');var BPromise=require(_0x21ec('0x4'));var rp=require(_0x21ec('0x5'));var fs=require('fs');var path=require(_0x21ec('0x6'));var rimraf=require(_0x21ec('0x7'));var config=require(_0x21ec('0x8'));var attributes=require(_0x21ec('0x9'));module[_0x21ec('0xa')]=function(_0x3d889e,_0x30f710){return _0x3d889e['define']('WhatsappInteraction',attributes,{'tableName':_0x21ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dafa1,_0x30d766,_0x10dca8){if(_0x1dafa1[_0x21ec('0xc')]('closed')){_0x1dafa1[_0x21ec('0xd')]=moment()[_0x21ec('0xe')](_0x21ec('0xf'));}_0x10dca8(null,_0x1dafa1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 64d8de0..09f4752 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 _0x9423=['addTags','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','catch','AddTagsToWhatsappInteraction','find','where'];(function(_0x107040,_0x1a65b2){var _0x212f01=function(_0x930fcc){while(--_0x930fcc){_0x107040['push'](_0x107040['shift']());}};_0x212f01(++_0x1a65b2);}(_0x9423,0xef));var _0x3942=function(_0x128689,_0x209c92){_0x128689=_0x128689-0x0;var _0x12c6ef=_0x9423[_0x128689];return _0x12c6ef;};'use strict';var _=require(_0x3942('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3942('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3942('0x2'));var db=require(_0x3942('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3942('0x4'))('rpc');var config=require(_0x3942('0x5'));var jayson=require(_0x3942('0x6'));var client=jayson[_0x3942('0x7')][_0x3942('0x8')]({'port':0x232a});config[_0x3942('0x9')]=_['defaults'](config[_0x3942('0x9')],{'host':_0x3942('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3942('0x9')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x79066b,_0x5b96f9,_0x2e3fff){return new BPromise(function(_0x5ded45,_0x3773e2){return client['request'](_0x79066b,_0x2e3fff)[_0x3942('0xb')](function(_0x19279f){logger[_0x3942('0xc')]('WhatsappInteraction,\x20%s,\x20%s',_0x5b96f9,_0x3942('0xd'));logger[_0x3942('0xe')](_0x3942('0xf'),_0x5b96f9,'request\x20sent',JSON[_0x3942('0x10')](_0x19279f));if(_0x19279f[_0x3942('0x11')]){if(_0x19279f['error'][_0x3942('0x12')]===0x1f4){logger[_0x3942('0x11')](_0x3942('0x13'),_0x5b96f9,_0x19279f[_0x3942('0x11')]['message']);return _0x3773e2(_0x19279f[_0x3942('0x11')][_0x3942('0x14')]);}logger['error'](_0x3942('0x13'),_0x5b96f9,_0x19279f[_0x3942('0x11')][_0x3942('0x14')]);return _0x5ded45(_0x19279f['error'][_0x3942('0x14')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x5b96f9,'request\x20sent');_0x5ded45(_0x19279f[_0x3942('0x15')]['message']);}})['catch'](function(_0x488c89){logger[_0x3942('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x5b96f9,_0x488c89);_0x3773e2(_0x488c89);});});}exports[_0x3942('0x16')]=function(_0x39b4c5){var _0x43cd81=this;return new Promise(function(_0x3943a2,_0x333548){return db[_0x3942('0x17')][_0x3942('0x18')](_0x39b4c5[_0x3942('0x19')],{'raw':_0x39b4c5[_0x3942('0x1a')]?_0x39b4c5[_0x3942('0x1a')][_0x3942('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39b4c5[_0x3942('0x1a')]?_0x39b4c5[_0x3942('0x1a')]['where']||null:null,'attributes':_0x39b4c5['options']?_0x39b4c5[_0x3942('0x1a')][_0x3942('0x1c')]||null:null,'limit':_0x39b4c5['options']?_0x39b4c5['options'][_0x3942('0x1d')]||null:null})[_0x3942('0xb')](function(_0x53fe46){logger[_0x3942('0xc')](_0x3942('0x16'),_0x39b4c5);logger[_0x3942('0xe')](_0x3942('0x16'),_0x39b4c5,JSON[_0x3942('0x10')](_0x53fe46));_0x3943a2(_0x53fe46);})[_0x3942('0x1e')](function(_0x20acc0){logger['error'](_0x3942('0x16'),_0x20acc0['message'],_0x39b4c5);_0x333548(_0x43cd81[_0x3942('0x11')](0x1f4,_0x20acc0[_0x3942('0x14')]));});});};exports[_0x3942('0x1f')]=function(_0x4d4122){return new Promise(function(_0xb8e36f,_0x120426){return db[_0x3942('0x17')][_0x3942('0x20')]({'where':_0x4d4122['options']?_0x4d4122[_0x3942('0x1a')][_0x3942('0x21')]||null:null})[_0x3942('0xb')](function(_0x3a86be){if(_0x3a86be){return _0x3a86be[_0x3942('0x22')](_0x4d4122[_0x3942('0x19')][_0x3942('0x23')],_[_0x3942('0x24')](_0x4d4122[_0x3942('0x19')],['ids','id'])||{});}})[_0x3942('0x25')](function(_0x301436){logger['info']('AddTags',_0x4d4122);logger[_0x3942('0xe')](_0x3942('0x26'),_0x4d4122,JSON[_0x3942('0x10')](_0x301436));_0xb8e36f(_0x301436);})[_0x3942('0x1e')](function(_0x426ea9){logger[_0x3942('0x11')](_0x3942('0x26'),_0x426ea9[_0x3942('0x14')],_0x4d4122);_0x120426(_this[_0x3942('0x11')](0x1f4,_0x426ea9[_0x3942('0x14')]));});});}; \ No newline at end of file +var _0x634b=['AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','update','body','options','where','attributes','limit','info','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','ids','omit','spread'];(function(_0x57e511,_0x4ed03d){var _0x181299=function(_0x388237){while(--_0x388237){_0x57e511['push'](_0x57e511['shift']());}};_0x181299(++_0x4ed03d);}(_0x634b,0x131));var _0xb634=function(_0x259e0e,_0x42722b){_0x259e0e=_0x259e0e-0x0;var _0x4c88ef=_0x634b[_0x259e0e];return _0x4c88ef;};'use strict';var _=require(_0xb634('0x0'));var util=require('util');var moment=require(_0xb634('0x1'));var BPromise=require(_0xb634('0x2'));var rs=require(_0xb634('0x3'));var fs=require('fs');var Redis=require(_0xb634('0x4'));var db=require(_0xb634('0x5'))['db'];var utils=require(_0xb634('0x6'));var logger=require('../../config/logger')(_0xb634('0x7'));var config=require(_0xb634('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb634('0x9')]=_['defaults'](config[_0xb634('0x9')],{'host':_0xb634('0xa'),'port':0x18eb});var socket=require(_0xb634('0xb'))(new Redis(config[_0xb634('0x9')]));require(_0xb634('0xc'))[_0xb634('0xd')](socket);function respondWithRpcPromise(_0x20eb02,_0x285d4e,_0x421a93){return new BPromise(function(_0x49af41,_0x4364f9){return client['request'](_0x20eb02,_0x421a93)[_0xb634('0xe')](function(_0x5c4b05){logger['info'](_0xb634('0xf'),_0x285d4e,_0xb634('0x10'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x285d4e,_0xb634('0x10'),JSON[_0xb634('0x11')](_0x5c4b05));if(_0x5c4b05[_0xb634('0x12')]){if(_0x5c4b05[_0xb634('0x12')][_0xb634('0x13')]===0x1f4){logger[_0xb634('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x285d4e,_0x5c4b05[_0xb634('0x12')][_0xb634('0x14')]);return _0x4364f9(_0x5c4b05[_0xb634('0x12')]['message']);}logger[_0xb634('0x12')](_0xb634('0xf'),_0x285d4e,_0x5c4b05[_0xb634('0x12')][_0xb634('0x14')]);return _0x49af41(_0x5c4b05[_0xb634('0x12')][_0xb634('0x14')]);}else{logger['info'](_0xb634('0xf'),_0x285d4e,_0xb634('0x10'));_0x49af41(_0x5c4b05['result'][_0xb634('0x14')]);}})[_0xb634('0x15')](function(_0x53ccc1){logger[_0xb634('0x12')](_0xb634('0xf'),_0x285d4e,_0x53ccc1);_0x4364f9(_0x53ccc1);});});}exports['UpdateWhatsappInteraction']=function(_0x3af195){var _0xbe8d50=this;return new Promise(function(_0x14bc51,_0x5ab2d3){return db['WhatsappInteraction'][_0xb634('0x16')](_0x3af195[_0xb634('0x17')],{'raw':_0x3af195[_0xb634('0x18')]?_0x3af195[_0xb634('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3af195[_0xb634('0x18')]?_0x3af195['options'][_0xb634('0x19')]||null:null,'attributes':_0x3af195[_0xb634('0x18')]?_0x3af195[_0xb634('0x18')][_0xb634('0x1a')]||null:null,'limit':_0x3af195[_0xb634('0x18')]?_0x3af195['options'][_0xb634('0x1b')]||null:null})[_0xb634('0xe')](function(_0x1e20f4){logger[_0xb634('0x1c')](_0xb634('0x1d'),_0x3af195);logger[_0xb634('0x1e')](_0xb634('0x1d'),_0x3af195,JSON[_0xb634('0x11')](_0x1e20f4));_0x14bc51(_0x1e20f4);})[_0xb634('0x15')](function(_0x4b7daa){logger['error'](_0xb634('0x1d'),_0x4b7daa[_0xb634('0x14')],_0x3af195);_0x5ab2d3(_0xbe8d50[_0xb634('0x12')](0x1f4,_0x4b7daa[_0xb634('0x14')]));});});};exports[_0xb634('0x1f')]=function(_0x1aa66){return new Promise(function(_0x31065f,_0xbc4265){return db[_0xb634('0x20')][_0xb634('0x21')]({'where':_0x1aa66[_0xb634('0x18')]?_0x1aa66[_0xb634('0x18')][_0xb634('0x19')]||null:null})['then'](function(_0x1260ce){if(_0x1260ce){return _0x1260ce['addTags'](_0x1aa66[_0xb634('0x17')][_0xb634('0x22')],_[_0xb634('0x23')](_0x1aa66[_0xb634('0x17')],[_0xb634('0x22'),'id'])||{});}})[_0xb634('0x24')](function(_0x441988){logger[_0xb634('0x1c')](_0xb634('0x25'),_0x1aa66);logger[_0xb634('0x1e')](_0xb634('0x25'),_0x1aa66,JSON['stringify'](_0x441988));_0x31065f(_0x441988);})[_0xb634('0x15')](function(_0x1c7a62){logger[_0xb634('0x12')](_0xb634('0x25'),_0x1c7a62[_0xb634('0x14')],_0x1aa66);_0xbc4265(_this[_0xb634('0x12')](0x1f4,_0x1c7a62[_0xb634('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1b224de..5736fc4 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 _0x8a72=['whatsappInteraction:','./whatsappInteraction.events','save','update','removeListener','length'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x8a72,0xd9));var _0x28a7=function(_0x18f590,_0x255344){_0x18f590=_0x18f590-0x0;var _0x37debb=_0x8a72[_0x18f590];return _0x37debb;};'use strict';var WhatsappInteractionEvents=require(_0x28a7('0x0'));var events=[_0x28a7('0x1'),'remove',_0x28a7('0x2')];function createListener(_0x34a2a4,_0x2aec0c){return function(_0x11af19){_0x2aec0c['emit'](_0x34a2a4,_0x11af19);};}function removeListener(_0x843661,_0x3d4fc5){return function(){WhatsappInteractionEvents[_0x28a7('0x3')](_0x843661,_0x3d4fc5);};}exports['register']=function(_0x3b074d){for(var _0x2452d9=0x0,_0x4e63e7=events[_0x28a7('0x4')];_0x2452d9<_0x4e63e7;_0x2452d9++){var _0x52dd28=events[_0x2452d9];var _0x3f4f6e=createListener(_0x28a7('0x5')+_0x52dd28,_0x3b074d);WhatsappInteractionEvents['on'](_0x52dd28,_0x3f4f6e);}}; \ No newline at end of file +var _0xcdaa=['remove','removeListener','./whatsappInteraction.events','save'];(function(_0x606704,_0x4a08f8){var _0x11a29d=function(_0x36cae3){while(--_0x36cae3){_0x606704['push'](_0x606704['shift']());}};_0x11a29d(++_0x4a08f8);}(_0xcdaa,0xea));var _0xacda=function(_0x30aa76,_0x3753d9){_0x30aa76=_0x30aa76-0x0;var _0x1187da=_0xcdaa[_0x30aa76];return _0x1187da;};'use strict';var WhatsappInteractionEvents=require(_0xacda('0x0'));var events=[_0xacda('0x1'),_0xacda('0x2'),'update'];function createListener(_0x1cf843,_0x506342){return function(_0x300e20){_0x506342['emit'](_0x1cf843,_0x300e20);};}function removeListener(_0x47af0b,_0x23b64b){return function(){WhatsappInteractionEvents[_0xacda('0x3')](_0x47af0b,_0x23b64b);};}exports['register']=function(_0x1037fb){for(var _0x396efe=0x0,_0x5883fc=events['length'];_0x396efe<_0x5883fc;_0x396efe++){var _0x79d3b0=events[_0x396efe];var _0x29fc5d=createListener('whatsappInteraction:'+_0x79d3b0,_0x1037fb);WhatsappInteractionEvents['on'](_0x79d3b0,_0x29fc5d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index c956928..8654ea6 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 _0x333d=['whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','tracked'];(function(_0xc8c3e2,_0x4aa48d){var _0x680c59=function(_0x4e9b08){while(--_0x4e9b08){_0xc8c3e2['push'](_0xc8c3e2['shift']());}};_0x680c59(++_0x4aa48d);}(_0x333d,0x193));var _0xd333=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x333d[_0x277107];return _0x1da046;};'use strict';var multer=require(_0xd333('0x0'));var util=require('util');var path=require(_0xd333('0x1'));var timeout=require(_0xd333('0x2'));var express=require(_0xd333('0x3'));var router=express[_0xd333('0x4')]();var fs_extra=require(_0xd333('0x5'));var auth=require(_0xd333('0x6'));var interaction=require(_0xd333('0x7'));var config=require(_0xd333('0x8'));var controller=require('./whatsappMessage.controller');router[_0xd333('0x9')]('/',auth[_0xd333('0xa')](),controller[_0xd333('0xb')]);router[_0xd333('0x9')](_0xd333('0xc'),auth[_0xd333('0xa')](),controller[_0xd333('0xd')]);router[_0xd333('0x9')](_0xd333('0xe'),auth[_0xd333('0xa')](),controller['show']);router[_0xd333('0xf')]('/',auth[_0xd333('0xa')](),interaction[_0xd333('0x10')](_0xd333('0x11'),_0xd333('0x12')),controller[_0xd333('0x13')]);router[_0xd333('0xf')](_0xd333('0x14'),controller[_0xd333('0x15')]);router[_0xd333('0x16')](_0xd333('0xe'),auth[_0xd333('0xa')](),controller[_0xd333('0x17')]);router[_0xd333('0x16')](_0xd333('0x18'),auth[_0xd333('0xa')](),controller[_0xd333('0x19')]);router[_0xd333('0x16')](_0xd333('0x1a'),auth[_0xd333('0xa')](),controller[_0xd333('0x1b')]);router['delete'](_0xd333('0xe'),auth['isAuthenticated'](),controller[_0xd333('0x1c')]);module[_0xd333('0x1d')]=router; \ No newline at end of file +var _0x5d5d=['describe','/:id','show','tracked','whatsapp','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x2a1d5e,_0xeb09){var _0x3e9eb0=function(_0x2bc638){while(--_0x2bc638){_0x2a1d5e['push'](_0x2a1d5e['shift']());}};_0x3e9eb0(++_0xeb09);}(_0x5d5d,0x1a6));var _0xd5d5=function(_0x1d2304,_0x5bfcfb){_0x1d2304=_0x1d2304-0x0;var _0x81d87a=_0x5d5d[_0x1d2304];return _0x81d87a;};'use strict';var multer=require(_0xd5d5('0x0'));var util=require(_0xd5d5('0x1'));var path=require(_0xd5d5('0x2'));var timeout=require(_0xd5d5('0x3'));var express=require(_0xd5d5('0x4'));var router=express[_0xd5d5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd5d5('0x6'));var config=require(_0xd5d5('0x7'));var controller=require(_0xd5d5('0x8'));router[_0xd5d5('0x9')]('/',auth[_0xd5d5('0xa')](),controller[_0xd5d5('0xb')]);router['get'](_0xd5d5('0xc'),auth[_0xd5d5('0xa')](),controller[_0xd5d5('0xd')]);router['get'](_0xd5d5('0xe'),auth[_0xd5d5('0xa')](),controller[_0xd5d5('0xf')]);router['post']('/',auth[_0xd5d5('0xa')](),interaction[_0xd5d5('0x10')](_0xd5d5('0x11'),'whatsappmessage:create'),controller[_0xd5d5('0x12')]);router['post'](_0xd5d5('0x13'),controller[_0xd5d5('0x14')]);router[_0xd5d5('0x15')]('/:id',auth[_0xd5d5('0xa')](),controller[_0xd5d5('0x16')]);router[_0xd5d5('0x15')](_0xd5d5('0x17'),auth[_0xd5d5('0xa')](),controller[_0xd5d5('0x18')]);router[_0xd5d5('0x15')](_0xd5d5('0x19'),auth[_0xd5d5('0xa')](),controller['reject']);router[_0xd5d5('0x1a')](_0xd5d5('0xe'),auth[_0xd5d5('0xa')](),controller[_0xd5d5('0x1b')]);module[_0xd5d5('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 0a6f573..997c8c3 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 _0xf78b=['BOOLEAN','sequelize','TEXT','medium','out','STRING','DATE'];(function(_0x55e113,_0x72aeb){var _0x2e287c=function(_0x5178d9){while(--_0x5178d9){_0x55e113['push'](_0x55e113['shift']());}};_0x2e287c(++_0x72aeb);}(_0xf78b,0x78));var _0xbf78=function(_0xa4c2e7,_0x4b67e9){_0xa4c2e7=_0xa4c2e7-0x0;var _0x5b34ae=_0xf78b[_0xa4c2e7];return _0x5b34ae;};'use strict';var Sequelize=require(_0xbf78('0x0'));module['exports']={'body':{'type':Sequelize[_0xbf78('0x1')](_0xbf78('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbf78('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbf78('0x4')](0xbe)},'phone':{'type':Sequelize[_0xbf78('0x4')]},'readAt':{'type':Sequelize[_0xbf78('0x5')]},'secret':{'type':Sequelize[_0xbf78('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbf78('0x4')]},'providerResponse':{'type':Sequelize[_0xbf78('0x1')]}}; \ No newline at end of file +var _0xa220=['medium','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x195385,_0x390cfb){var _0x357f8a=function(_0x1e3970){while(--_0x1e3970){_0x195385['push'](_0x195385['shift']());}};_0x357f8a(++_0x390cfb);}(_0xa220,0x100));var _0x0a22=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa220[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x0a22('0x0'));module[_0x0a22('0x1')]={'body':{'type':Sequelize[_0x0a22('0x2')](_0x0a22('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0a22('0x4')),'defaultValue':_0x0a22('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0a22('0x5')](0xbe)},'phone':{'type':Sequelize[_0x0a22('0x5')]},'readAt':{'type':Sequelize[_0x0a22('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0a22('0x5')]},'providerResponse':{'type':Sequelize[_0x0a22('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c554235..6d33a3a 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 _0xbf5b=['name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','email','manual','interface','motionChannel','channel','event','accept','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','RejectMessage','rejectMessage','ContactId','QueryTypes','internal','SIP/%s','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','stack'];(function(_0x3f25d9,_0x424937){var _0x311e21=function(_0x2ff3d9){while(--_0x2ff3d9){_0x3f25d9['push'](_0x3f25d9['shift']());}};_0x311e21(++_0x424937);}(_0xbf5b,0xeb));var _0xbbf5=function(_0x507c6e,_0x5b7703){_0x507c6e=_0x507c6e-0x0;var _0x236242=_0xbf5b[_0x507c6e];return _0x236242;};'use strict';var emlformat=require(_0xbbf5('0x0'));var rimraf=require(_0xbbf5('0x1'));var zipdir=require(_0xbbf5('0x2'));var jsonpatch=require(_0xbbf5('0x3'));var rp=require(_0xbbf5('0x4'));var moment=require(_0xbbf5('0x5'));var BPromise=require(_0xbbf5('0x6'));var Mustache=require(_0xbbf5('0x7'));var util=require('util');var path=require(_0xbbf5('0x8'));var sox=require('sox');var csv=require(_0xbbf5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbf5('0xa'));var _=require('lodash');var squel=require(_0xbbf5('0xb'));var crypto=require(_0xbbf5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbbf5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbbf5('0xe'));var Papa=require(_0xbbf5('0xf'));var Redis=require(_0xbbf5('0x10'));var authService=require(_0xbbf5('0x11'));var qs=require(_0xbbf5('0x12'));var as=require(_0xbbf5('0x13'));var hardwareService=require(_0xbbf5('0x14'));var logger=require(_0xbbf5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xbbf5('0x16'));var licenseUtil=require(_0xbbf5('0x17'));var db=require(_0xbbf5('0x18'))['db'];config[_0xbbf5('0x19')]=_[_0xbbf5('0x1a')](config[_0xbbf5('0x19')],{'host':_0xbbf5('0x1b'),'port':0x18eb});var socket=require(_0xbbf5('0x1c'))(new Redis(config['redis']));require(_0xbbf5('0x1d'))[_0xbbf5('0x1e')](socket);var jayson=require(_0xbbf5('0x1f'));var client=jayson[_0xbbf5('0x20')][_0xbbf5('0x21')]({'port':0x232c});var client9002=jayson[_0xbbf5('0x20')][_0xbbf5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5a56b3,_0x1502d9,_0x2b6ed4,_0x1b553d){return new BPromise(function(_0x3de047,_0x2a40b9){var _0x15f779=_0x1b553d||client;return _0x15f779[_0xbbf5('0x22')](_0x5a56b3,_0x2b6ed4)[_0xbbf5('0x23')](function(_0x1de06e){logger[_0xbbf5('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x1502d9,_0xbbf5('0x25'));logger[_0xbbf5('0x26')](_0xbbf5('0x27'),_0x1502d9,_0xbbf5('0x25'),JSON['stringify'](_0x1de06e));if(_0x1de06e[_0xbbf5('0x28')]){if(_0x1de06e['error'][_0xbbf5('0x29')]===0x1f4){logger[_0xbbf5('0x28')](_0xbbf5('0x2a'),_0x1502d9,_0x1de06e['error'][_0xbbf5('0x2b')]);return _0x2a40b9(_0x1de06e[_0xbbf5('0x28')][_0xbbf5('0x2b')]);}logger[_0xbbf5('0x28')](_0xbbf5('0x2a'),_0x1502d9,_0x1de06e[_0xbbf5('0x28')][_0xbbf5('0x2b')]);return _0x3de047(_0x1de06e[_0xbbf5('0x28')][_0xbbf5('0x2b')]);}else{logger[_0xbbf5('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x1502d9,_0xbbf5('0x25'));_0x3de047(_0x1de06e[_0xbbf5('0x2c')][_0xbbf5('0x2b')]);}})['catch'](function(_0x11f291){logger[_0xbbf5('0x28')](_0xbbf5('0x2a'),_0x1502d9,_0x11f291);_0x2a40b9(_0x11f291);});});}function respondWithStatusCode(_0x461499,_0x23fda8){_0x23fda8=_0x23fda8||0xcc;return function(_0x58b7a9){if(_0x58b7a9){return _0x461499[_0xbbf5('0x2d')](_0x23fda8);}return _0x461499[_0xbbf5('0x2e')](_0x23fda8)[_0xbbf5('0x2f')]();};}function respondWithResult(_0x1f6471,_0x43de0f){_0x43de0f=_0x43de0f||0xc8;return function(_0x25800a){if(_0x25800a){return _0x1f6471[_0xbbf5('0x2e')](_0x43de0f)[_0xbbf5('0x30')](_0x25800a);}};}function respondWithFilteredResult(_0x244b2d,_0x2074ee){return function(_0x3d5eaf){if(_0x3d5eaf){var _0x156a8e=typeof _0x2074ee[_0xbbf5('0x31')]===_0xbbf5('0x32')&&typeof _0x2074ee[_0xbbf5('0x33')]==='undefined';var _0x1b721f=_0x3d5eaf['count'];var _0x28751e=_0x156a8e?0x0:_0x2074ee[_0xbbf5('0x31')];var _0x31dab2=_0x156a8e?_0x3d5eaf[_0xbbf5('0x34')]:_0x2074ee[_0xbbf5('0x31')]+_0x2074ee['limit'];var _0x4d1325;if(_0x31dab2>=_0x1b721f){_0x31dab2=_0x1b721f;_0x4d1325=0xc8;}else{_0x4d1325=0xce;}_0x244b2d[_0xbbf5('0x2e')](_0x4d1325);return _0x244b2d['set'](_0xbbf5('0x35'),_0x28751e+'-'+_0x31dab2+'/'+_0x1b721f)[_0xbbf5('0x30')](_0x3d5eaf);}return null;};}function patchUpdates(_0x4bac66){return function(_0x3f1709){try{jsonpatch['apply'](_0x3f1709,_0x4bac66,!![]);}catch(_0x204950){return BPromise[_0xbbf5('0x36')](_0x204950);}return _0x3f1709['save']();};}function saveUpdates(_0x2b31a4,_0x410e13){return function(_0xbef36){if(_0xbef36){return _0xbef36[_0xbbf5('0x37')](_0x2b31a4)['then'](function(_0x5e269a){return _0x5e269a;});}return null;};}function removeEntity(_0x2273d8,_0x43c69e){return function(_0x47a519){if(_0x47a519){return _0x47a519['destroy']()['then'](function(){_0x2273d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x87f38a,_0x2e0e75){return function(_0xccc6a6){if(!_0xccc6a6){_0x87f38a[_0xbbf5('0x2d')](0x194);}return _0xccc6a6;};}function handleError(_0x1725f4,_0x128072){_0x128072=_0x128072||0x1f4;return function(_0x218811){logger['error'](_0x218811[_0xbbf5('0x38')]);if(_0x218811[_0xbbf5('0x39')]){delete _0x218811[_0xbbf5('0x39')];}_0x1725f4[_0xbbf5('0x2e')](_0x128072)[_0xbbf5('0x3a')](_0x218811);};}exports[_0xbbf5('0x3b')]=function(_0x4e4643,_0x4ccc3d){var _0x15db04={},_0x3ebcf3={},_0x25c435={'count':0x0,'rows':[]};var _0x4db800=_[_0xbbf5('0x3c')](db[_0xbbf5('0x3d')][_0xbbf5('0x3e')],function(_0x3afc36){return{'name':_0x3afc36[_0xbbf5('0x3f')],'type':_0x3afc36[_0xbbf5('0x40')]['key']};});_0x3ebcf3['model']=_[_0xbbf5('0x3c')](_0x4db800,_0xbbf5('0x39'));_0x3ebcf3['query']=_['keys'](_0x4e4643[_0xbbf5('0x41')]);_0x3ebcf3[_0xbbf5('0x42')]=_['intersection'](_0x3ebcf3[_0xbbf5('0x43')],_0x3ebcf3[_0xbbf5('0x41')]);_0x15db04[_0xbbf5('0x44')]=_[_0xbbf5('0x45')](_0x3ebcf3[_0xbbf5('0x43')],qs[_0xbbf5('0x46')](_0x4e4643[_0xbbf5('0x41')]['fields']));_0x15db04[_0xbbf5('0x44')]=_0x15db04['attributes']['length']?_0x15db04[_0xbbf5('0x44')]:_0x3ebcf3['model'];if(!_0x4e4643[_0xbbf5('0x41')][_0xbbf5('0x47')](_0xbbf5('0x48'))){_0x15db04[_0xbbf5('0x33')]=qs['limit'](_0x4e4643[_0xbbf5('0x41')][_0xbbf5('0x33')]);_0x15db04[_0xbbf5('0x31')]=qs[_0xbbf5('0x31')](_0x4e4643[_0xbbf5('0x41')]['offset']);}_0x15db04[_0xbbf5('0x49')]=qs['sort'](_0x4e4643[_0xbbf5('0x41')][_0xbbf5('0x4a')]);_0x15db04[_0xbbf5('0x4b')]=qs[_0xbbf5('0x42')](_[_0xbbf5('0x4c')](_0x4e4643['query'],_0x3ebcf3[_0xbbf5('0x42')]),_0x4db800);if(_0x4e4643[_0xbbf5('0x41')]['filter']){_0x15db04['where']=_[_0xbbf5('0x4d')](_0x15db04[_0xbbf5('0x4b')],{'$or':_[_0xbbf5('0x3c')](_0x4db800,function(_0x2c70e0){if(_0x2c70e0['type']!==_0xbbf5('0x4e')){var _0x259a2b={};_0x259a2b[_0x2c70e0['name']]={'$like':'%'+_0x4e4643[_0xbbf5('0x41')][_0xbbf5('0x4f')]+'%'};return _0x259a2b;}})});}_0x15db04=_[_0xbbf5('0x4d')]({},_0x15db04,_0x4e4643[_0xbbf5('0x50')]);var _0xc3b5c8={'where':_0x15db04[_0xbbf5('0x4b')]};return db[_0xbbf5('0x3d')][_0xbbf5('0x34')](_0xc3b5c8)[_0xbbf5('0x23')](function(_0x10b14b){_0x25c435[_0xbbf5('0x34')]=_0x10b14b;if(_0x4e4643['query'][_0xbbf5('0x51')]){_0x15db04[_0xbbf5('0x52')]=[{'all':!![]}];}return db[_0xbbf5('0x3d')][_0xbbf5('0x53')](_0x15db04);})['then'](function(_0x49fe41){_0x25c435[_0xbbf5('0x54')]=_0x49fe41;return _0x25c435;})[_0xbbf5('0x23')](respondWithFilteredResult(_0x4ccc3d,_0x15db04))[_0xbbf5('0x55')](handleError(_0x4ccc3d,null));};exports[_0xbbf5('0x56')]=function(_0x274f6d,_0x161e18){var _0x4572df={'raw':!![],'where':{'id':_0x274f6d[_0xbbf5('0x57')]['id']}},_0x5d89c5={};_0x5d89c5['model']=_[_0xbbf5('0x58')](db[_0xbbf5('0x3d')][_0xbbf5('0x3e')]);_0x5d89c5[_0xbbf5('0x41')]=_[_0xbbf5('0x58')](_0x274f6d[_0xbbf5('0x41')]);_0x5d89c5[_0xbbf5('0x42')]=_['intersection'](_0x5d89c5['model'],_0x5d89c5[_0xbbf5('0x41')]);_0x4572df[_0xbbf5('0x44')]=_[_0xbbf5('0x45')](_0x5d89c5[_0xbbf5('0x43')],qs['fields'](_0x274f6d['query'][_0xbbf5('0x46')]));_0x4572df[_0xbbf5('0x44')]=_0x4572df[_0xbbf5('0x44')][_0xbbf5('0x59')]?_0x4572df['attributes']:_0x5d89c5[_0xbbf5('0x43')];if(_0x274f6d[_0xbbf5('0x41')][_0xbbf5('0x51')]){_0x4572df[_0xbbf5('0x52')]=[{'all':!![]}];}_0x4572df=_['merge']({},_0x4572df,_0x274f6d['options']);return db['WhatsappMessage'][_0xbbf5('0x5a')](_0x4572df)['then'](handleEntityNotFound(_0x161e18,null))[_0xbbf5('0x23')](respondWithResult(_0x161e18,null))[_0xbbf5('0x55')](handleError(_0x161e18,null));};exports['create']=function(_0x2554e5,_0x1d1633){return db[_0xbbf5('0x3d')][_0xbbf5('0x5b')](_0x2554e5[_0xbbf5('0x5c')],{})[_0xbbf5('0x23')](respondWithResult(_0x1d1633,0xc9))[_0xbbf5('0x55')](handleError(_0x1d1633,null));};exports[_0xbbf5('0x37')]=function(_0x3ada0e,_0x4b8830){if(_0x3ada0e['body']['id']){delete _0x3ada0e[_0xbbf5('0x5c')]['id'];}return db['WhatsappMessage'][_0xbbf5('0x5a')]({'where':{'id':_0x3ada0e[_0xbbf5('0x57')]['id']}})['then'](handleEntityNotFound(_0x4b8830,null))[_0xbbf5('0x23')](saveUpdates(_0x3ada0e['body'],null))[_0xbbf5('0x23')](respondWithResult(_0x4b8830,null))['catch'](handleError(_0x4b8830,null));};exports['destroy']=function(_0x3a3aa6,_0x32d9c0){return db[_0xbbf5('0x3d')][_0xbbf5('0x5a')]({'where':{'id':_0x3a3aa6['params']['id']}})['then'](handleEntityNotFound(_0x32d9c0,null))[_0xbbf5('0x23')](removeEntity(_0x32d9c0,null))[_0xbbf5('0x55')](handleError(_0x32d9c0,null));};exports[_0xbbf5('0x5d')]=function(_0x1971f0,_0x5a74f6){return db[_0xbbf5('0x3d')]['describe']()[_0xbbf5('0x23')](respondWithResult(_0x5a74f6,null))[_0xbbf5('0x55')](handleError(_0x5a74f6,null));};var interaction_log=require(_0xbbf5('0x15'))(_0xbbf5('0x5e'));exports['accept']=function(_0x2c0645,_0x35fe73,_0x5e8901){var _0xd69634={'agent':{},'channel':_0xbbf5('0x5f')};if(_0x2c0645[_0xbbf5('0x5c')]['id']){delete _0x2c0645[_0xbbf5('0x5c')]['id'];}_0x2c0645['body'][_0xbbf5('0x60')]=!![];_0x2c0645[_0xbbf5('0x5c')][_0xbbf5('0x61')]=moment()[_0xbbf5('0x62')](_0xbbf5('0x63'));_0x2c0645[_0xbbf5('0x5c')][_0xbbf5('0x64')]=_0x2c0645[_0xbbf5('0x5c')][_0xbbf5('0x64')]||_0x2c0645[_0xbbf5('0x65')]['id'];_0xd69634[_0xbbf5('0x66')]['id']=_0x2c0645[_0xbbf5('0x5c')][_0xbbf5('0x64')];return db[_0xbbf5('0x3d')]['find']({'where':{'id':_0x2c0645[_0xbbf5('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35fe73,null))[_0xbbf5('0x23')](saveUpdates(_0x2c0645[_0xbbf5('0x5c')],null))[_0xbbf5('0x23')](function(_0x3fc003){if(_0x3fc003){_0xd69634[_0xbbf5('0x2b')]=_0x3fc003[_0xbbf5('0x67')]({'plain':!![]});return db[_0xbbf5('0x68')][_0xbbf5('0x5a')]({'where':{'id':_0x3fc003['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x35fe73,null))[_0xbbf5('0x23')](function(_0x350001){if(_0x350001){return _0x350001[_0xbbf5('0x37')]({'UserId':_0x2c0645[_0xbbf5('0x5c')][_0xbbf5('0x64')],'read1stAt':_[_0xbbf5('0x69')](_0x350001[_0xbbf5('0x6a')])?moment()[_0xbbf5('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1a4e5a){if(_0x1a4e5a){_0xd69634[_0xbbf5('0x6b')]=_0x1a4e5a[_0xbbf5('0x67')]({'plain':!![]});interaction_log[_0xbbf5('0x24')](_0xbbf5('0x6c'),_0x2c0645[_0xbbf5('0x65')]['id'],_0x2c0645[_0xbbf5('0x65')][_0xbbf5('0x39')],_0x2c0645[_0xbbf5('0x65')][_0xbbf5('0x6d')],_0xd69634[_0xbbf5('0x6b')]['id'],_0x2c0645[_0xbbf5('0x5c')]?JSON['stringify'](_0x2c0645[_0xbbf5('0x5c')]):'null');return respondWithRpcPromise(_0xbbf5('0x6e'),_0xbbf5('0x6f'),_0xd69634);}return null;})['then'](function(_0x28b187){var _0xec4403=_0xbbf5('0x70')+_0x28b187[_0xbbf5('0x2b')]['ContactId'];return db[_0xbbf5('0x71')][_0xbbf5('0x41')](_0xec4403,{'type':db[_0xbbf5('0x72')]['QueryTypes'][_0xbbf5('0x73')],'raw':!![]})[_0xbbf5('0x23')](function(_0x11b172){return _0x11b172;});})[_0xbbf5('0x23')](function(_0x4b865b){if(_0x4b865b){_0xd69634[_0xbbf5('0x2b')][_0xbbf5('0x74')]=_0x4b865b[0x0];if(!_0x2c0645[_0xbbf5('0x5c')][_0xbbf5('0x64')])return;return db[_0xbbf5('0x75')][_0xbbf5('0x5a')]({'where':{'id':_0x2c0645[_0xbbf5('0x5c')]['UserId'],'role':_0xbbf5('0x66')},'attributes':['id',_0xbbf5('0x39'),'fullname',_0xbbf5('0x76'),'internal'],'raw':!![]});}return null;})[_0xbbf5('0x23')](function(_0x3e9acc){if(!_0x3e9acc)return null;_0xd69634[_0xbbf5('0x2b')][_0xbbf5('0x66')]=_0x3e9acc;return _0xd69634;})[_0xbbf5('0x23')](function(_0x7a98b5){if(_0x7a98b5){if(_0x2c0645[_0xbbf5('0x5c')][_0xbbf5('0x77')]){_0xd69634[_0xbbf5('0x2b')][_0xbbf5('0x78')]=util[_0xbbf5('0x62')]('SIP/%s',_0x2c0645[_0xbbf5('0x65')][_0xbbf5('0x39')]);_0xd69634[_0xbbf5('0x2b')]['channel']=_0xd69634['channel'];_0xd69634[_0xbbf5('0x2b')][_0xbbf5('0x79')]=_0xd69634[_0xbbf5('0x7a')];_0xd69634['message'][_0xbbf5('0x7b')]=_0xbbf5('0x7c');return respondWithRpcPromise(_0xbbf5('0x7d'),_0xbbf5('0x7d'),{'event':_0xbbf5('0x7e'),'message':_0xd69634[_0xbbf5('0x2b')]},client9002)[_0xbbf5('0x23')](function(){return _0xd69634;});}return _0xd69634;}return null;})[_0xbbf5('0x23')](respondWithResult(_0x35fe73,null))[_0xbbf5('0x55')](handleError(_0x35fe73,null));};var interaction_log=require('../../config/logger')(_0xbbf5('0x5e'));exports[_0xbbf5('0x36')]=function(_0x357e3d,_0x477774,_0x4944d2){var _0x45f8b6={'agent':{},'channel':'whatsapp'};if(_0x357e3d[_0xbbf5('0x5c')]['id']){delete _0x357e3d['body']['id'];}_0x357e3d[_0xbbf5('0x5c')]['UserId']=_0x357e3d['body'][_0xbbf5('0x64')]||_0x357e3d['user']['id'];_0x45f8b6[_0xbbf5('0x66')]['id']=_0x357e3d[_0xbbf5('0x5c')][_0xbbf5('0x64')];return db['WhatsappMessage']['find']({'where':{'id':_0x357e3d['params']['id'],'UserId':null}})[_0xbbf5('0x23')](handleEntityNotFound(_0x477774,null))[_0xbbf5('0x23')](function(_0x5344f2){if(_0x5344f2){_0x45f8b6[_0xbbf5('0x2b')]=_0x5344f2[_0xbbf5('0x67')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x5344f2[_0xbbf5('0x7f')]}});}return null;})[_0xbbf5('0x23')](handleEntityNotFound(_0x477774,null))[_0xbbf5('0x23')](function(_0x39c627){if(_0x39c627){_0x45f8b6[_0xbbf5('0x6b')]=_0x39c627[_0xbbf5('0x67')]({'plain':!![]});interaction_log['info'](_0xbbf5('0x80'),_0x357e3d[_0xbbf5('0x65')]['id'],_0x357e3d[_0xbbf5('0x65')][_0xbbf5('0x39')],_0x357e3d['user']['role'],_0x45f8b6[_0xbbf5('0x6b')]['id'],_0x357e3d[_0xbbf5('0x5c')]?JSON[_0xbbf5('0x81')](_0x357e3d[_0xbbf5('0x5c')]):_0xbbf5('0x82'));return respondWithRpcPromise(_0xbbf5('0x83'),_0xbbf5('0x84'),_0x45f8b6);}return null;})[_0xbbf5('0x23')](function(_0x5cfd63){var _0x409af6=_0xbbf5('0x70')+_0x5cfd63[_0xbbf5('0x2b')][_0xbbf5('0x85')];return db[_0xbbf5('0x71')][_0xbbf5('0x41')](_0x409af6,{'type':db['Sequelize'][_0xbbf5('0x86')][_0xbbf5('0x73')],'raw':!![]})[_0xbbf5('0x23')](function(_0x4ff93e){return _0x4ff93e;});})[_0xbbf5('0x23')](function(_0x57b30e){if(_0x57b30e){_0x45f8b6[_0xbbf5('0x2b')][_0xbbf5('0x74')]=_0x57b30e[0x0];if(!_0x357e3d[_0xbbf5('0x5c')]['UserId'])return;return db[_0xbbf5('0x75')][_0xbbf5('0x5a')]({'where':{'id':_0x357e3d[_0xbbf5('0x5c')]['UserId'],'role':_0xbbf5('0x66')},'attributes':['id',_0xbbf5('0x39'),'fullname','email',_0xbbf5('0x87')],'raw':!![]});}return null;})[_0xbbf5('0x23')](function(_0x51d7d6){if(!_0x51d7d6)return null;_0x45f8b6[_0xbbf5('0x2b')][_0xbbf5('0x66')]=_0x51d7d6;return _0x45f8b6;})[_0xbbf5('0x23')](function(_0x12ce39){if(_0x12ce39){_0x12ce39[_0xbbf5('0x2b')][_0xbbf5('0x78')]=util['format'](_0xbbf5('0x88'),_0x357e3d[_0xbbf5('0x65')]['name']);_0x12ce39['message'][_0xbbf5('0x7a')]=_0x45f8b6[_0xbbf5('0x7a')];_0x12ce39[_0xbbf5('0x2b')][_0xbbf5('0x79')]=_0x45f8b6['channel'];_0x12ce39['message'][_0xbbf5('0x7b')]=_0xbbf5('0x36');respondWithRpcPromise(_0xbbf5('0x7d'),_0xbbf5('0x7d'),{'event':_0xbbf5('0x89'),'message':_0x12ce39[_0xbbf5('0x2b')]},client9002);return _0x45f8b6;}return null;})[_0xbbf5('0x23')](respondWithResult(_0x477774,null))[_0xbbf5('0x55')](handleError(_0x477774,null));};exports['status']=function(_0x440c62,_0xc4e402,_0xcbcc6b){if(_0x440c62[_0xbbf5('0x5c')]['id']){delete _0x440c62['body']['id'];}var _0x26a925;return db['WhatsappMessage'][_0xbbf5('0x5a')]({'where':{'id':_0x440c62['params']['id']}})[_0xbbf5('0x23')](handleEntityNotFound(_0xc4e402,null))[_0xbbf5('0x23')](function(_0x45017b){if(_0x45017b){_0x26a925=_0x45017b;return db['WhatsappAccount'][_0xbbf5('0x5a')]({'where':{'id':_0x45017b[_0xbbf5('0x8a')]}});}})[_0xbbf5('0x23')](handleEntityNotFound(_0xc4e402,null))['then'](function(_0x1b371e){if(_0x1b371e){logger[_0xbbf5('0x26')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xbbf5('0x2e'),_0xbbf5('0x8b'),_0x1b371e[_0xbbf5('0x40')],util[_0xbbf5('0x8c')](_0x440c62[_0xbbf5('0x5c')],{'showHidden':![],'depth':null}));switch(_0x1b371e['type']){case _0xbbf5('0x8d'):if(_0x440c62[_0xbbf5('0x5c')][_0xbbf5('0x8e')]&&_0x440c62[_0xbbf5('0x5c')]['MessageSid']===_0x26a925[_0xbbf5('0x8f')]&&_0x440c62[_0xbbf5('0x5c')][_0xbbf5('0x90')]&&_0x440c62[_0xbbf5('0x5c')][_0xbbf5('0x90')]===_0xbbf5('0x60')){return _0x26a925[_0xbbf5('0x37')]({'read':!![]});}else{logger[_0xbbf5('0x28')](_0xbbf5('0x91'),_0xbbf5('0x2e'),_0xbbf5('0x8d'),util[_0xbbf5('0x8c')](_0x440c62['body'],{'showHidden':![],'depth':null}));}break;}return _0x26a925;}})['then'](respondWithResult(_0xc4e402,null))[_0xbbf5('0x55')](handleError(_0xc4e402,null));}; \ No newline at end of file +var _0x1e53=['inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','stack','map','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','WhatsappMessage','findAll','rows','show','params','keys','include','find','create','body','describe','accept','whatsapp','read','readAt','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','User','agent','fullname','email','manual','interface','format','SIP/%s','motionChannel','channel','EventManager','acceptmessage','whatsapp-interactions','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','sequelize','Sequelize','contact','internal','event','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0x1e53,0x94));var _0x31e5=function(_0xde97d1,_0xce6de9){_0xde97d1=_0xde97d1-0x0;var _0x7da263=_0x1e53[_0xde97d1];return _0x7da263;};'use strict';var emlformat=require(_0x31e5('0x0'));var rimraf=require(_0x31e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31e5('0x2'));var rp=require(_0x31e5('0x3'));var moment=require(_0x31e5('0x4'));var BPromise=require(_0x31e5('0x5'));var Mustache=require(_0x31e5('0x6'));var util=require(_0x31e5('0x7'));var path=require(_0x31e5('0x8'));var sox=require('sox');var csv=require(_0x31e5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31e5('0xa'));var _=require('lodash');var squel=require(_0x31e5('0xb'));var crypto=require(_0x31e5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x31e5('0xd'));var Papa=require(_0x31e5('0xe'));var Redis=require(_0x31e5('0xf'));var authService=require(_0x31e5('0x10'));var qs=require(_0x31e5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x31e5('0x12'))(_0x31e5('0x13'));var utils=require(_0x31e5('0x14'));var config=require(_0x31e5('0x15'));var licenseUtil=require(_0x31e5('0x16'));var db=require(_0x31e5('0x17'))['db'];config[_0x31e5('0x18')]=_[_0x31e5('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x31e5('0x1a'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x31e5('0x1b')](socket);var jayson=require(_0x31e5('0x1c'));var client=jayson[_0x31e5('0x1d')][_0x31e5('0x1e')]({'port':0x232c});var client9002=jayson[_0x31e5('0x1d')][_0x31e5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1c8268,_0xce16d1,_0x497725,_0x1ec414){return new BPromise(function(_0x3c1723,_0x1d7a87){var _0x1bc59a=_0x1ec414||client;return _0x1bc59a[_0x31e5('0x1f')](_0x1c8268,_0x497725)[_0x31e5('0x20')](function(_0x7db71a){logger[_0x31e5('0x21')](_0x31e5('0x22'),_0xce16d1,_0x31e5('0x23'));logger[_0x31e5('0x24')](_0x31e5('0x25'),_0xce16d1,_0x31e5('0x23'),JSON['stringify'](_0x7db71a));if(_0x7db71a[_0x31e5('0x26')]){if(_0x7db71a[_0x31e5('0x26')][_0x31e5('0x27')]===0x1f4){logger[_0x31e5('0x26')](_0x31e5('0x22'),_0xce16d1,_0x7db71a[_0x31e5('0x26')][_0x31e5('0x28')]);return _0x1d7a87(_0x7db71a['error'][_0x31e5('0x28')]);}logger[_0x31e5('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0xce16d1,_0x7db71a[_0x31e5('0x26')]['message']);return _0x3c1723(_0x7db71a['error'][_0x31e5('0x28')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xce16d1,_0x31e5('0x23'));_0x3c1723(_0x7db71a[_0x31e5('0x29')][_0x31e5('0x28')]);}})[_0x31e5('0x2a')](function(_0x4f05a4){logger[_0x31e5('0x26')](_0x31e5('0x22'),_0xce16d1,_0x4f05a4);_0x1d7a87(_0x4f05a4);});});}function respondWithStatusCode(_0x5d7ca1,_0x225f9c){_0x225f9c=_0x225f9c||0xcc;return function(_0x24c00e){if(_0x24c00e){return _0x5d7ca1[_0x31e5('0x2b')](_0x225f9c);}return _0x5d7ca1[_0x31e5('0x2c')](_0x225f9c)[_0x31e5('0x2d')]();};}function respondWithResult(_0x49fb36,_0x8d3e7a){_0x8d3e7a=_0x8d3e7a||0xc8;return function(_0x5ac72b){if(_0x5ac72b){return _0x49fb36[_0x31e5('0x2c')](_0x8d3e7a)[_0x31e5('0x2e')](_0x5ac72b);}};}function respondWithFilteredResult(_0x514b72,_0x435017){return function(_0x543eb3){if(_0x543eb3){var _0x3a3cdd=typeof _0x435017[_0x31e5('0x2f')]===_0x31e5('0x30')&&typeof _0x435017[_0x31e5('0x31')]===_0x31e5('0x30');var _0x182db9=_0x543eb3[_0x31e5('0x32')];var _0x246f11=_0x3a3cdd?0x0:_0x435017[_0x31e5('0x2f')];var _0x295d91=_0x3a3cdd?_0x543eb3['count']:_0x435017[_0x31e5('0x2f')]+_0x435017['limit'];var _0x3d05f8;if(_0x295d91>=_0x182db9){_0x295d91=_0x182db9;_0x3d05f8=0xc8;}else{_0x3d05f8=0xce;}_0x514b72[_0x31e5('0x2c')](_0x3d05f8);return _0x514b72['set'](_0x31e5('0x33'),_0x246f11+'-'+_0x295d91+'/'+_0x182db9)[_0x31e5('0x2e')](_0x543eb3);}return null;};}function patchUpdates(_0x9ac7db){return function(_0x21d883){try{jsonpatch[_0x31e5('0x34')](_0x21d883,_0x9ac7db,!![]);}catch(_0x251b6c){return BPromise['reject'](_0x251b6c);}return _0x21d883[_0x31e5('0x35')]();};}function saveUpdates(_0xa8e68e,_0x3ddb5a){return function(_0x5b06d4){if(_0x5b06d4){return _0x5b06d4[_0x31e5('0x36')](_0xa8e68e)[_0x31e5('0x20')](function(_0x3d5551){return _0x3d5551;});}return null;};}function removeEntity(_0x5c174e,_0x328000){return function(_0x33e80f){if(_0x33e80f){return _0x33e80f[_0x31e5('0x37')]()[_0x31e5('0x20')](function(){_0x5c174e[_0x31e5('0x2c')](0xcc)[_0x31e5('0x2d')]();});}};}function handleEntityNotFound(_0x474ba4,_0x4a6962){return function(_0xa1c8da){if(!_0xa1c8da){_0x474ba4[_0x31e5('0x2b')](0x194);}return _0xa1c8da;};}function handleError(_0x39d684,_0xe49eef){_0xe49eef=_0xe49eef||0x1f4;return function(_0x22caf3){logger[_0x31e5('0x26')](_0x22caf3[_0x31e5('0x38')]);if(_0x22caf3['name']){delete _0x22caf3['name'];}_0x39d684[_0x31e5('0x2c')](_0xe49eef)['send'](_0x22caf3);};}exports['index']=function(_0xe9083e,_0x291808){var _0x18eafb={},_0x147670={},_0x115ca5={'count':0x0,'rows':[]};var _0x18fd24=_[_0x31e5('0x39')](db['WhatsappMessage'][_0x31e5('0x3a')],function(_0x207011){return{'name':_0x207011[_0x31e5('0x3b')],'type':_0x207011['type'][_0x31e5('0x3c')]};});_0x147670[_0x31e5('0x3d')]=_[_0x31e5('0x39')](_0x18fd24,_0x31e5('0x3e'));_0x147670[_0x31e5('0x3f')]=_['keys'](_0xe9083e[_0x31e5('0x3f')]);_0x147670[_0x31e5('0x40')]=_[_0x31e5('0x41')](_0x147670[_0x31e5('0x3d')],_0x147670[_0x31e5('0x3f')]);_0x18eafb[_0x31e5('0x42')]=_['intersection'](_0x147670[_0x31e5('0x3d')],qs[_0x31e5('0x43')](_0xe9083e[_0x31e5('0x3f')]['fields']));_0x18eafb[_0x31e5('0x42')]=_0x18eafb[_0x31e5('0x42')][_0x31e5('0x44')]?_0x18eafb[_0x31e5('0x42')]:_0x147670[_0x31e5('0x3d')];if(!_0xe9083e[_0x31e5('0x3f')]['hasOwnProperty'](_0x31e5('0x45'))){_0x18eafb['limit']=qs['limit'](_0xe9083e[_0x31e5('0x3f')][_0x31e5('0x31')]);_0x18eafb[_0x31e5('0x2f')]=qs[_0x31e5('0x2f')](_0xe9083e[_0x31e5('0x3f')][_0x31e5('0x2f')]);}_0x18eafb[_0x31e5('0x46')]=qs[_0x31e5('0x47')](_0xe9083e[_0x31e5('0x3f')]['sort']);_0x18eafb[_0x31e5('0x48')]=qs[_0x31e5('0x40')](_[_0x31e5('0x49')](_0xe9083e[_0x31e5('0x3f')],_0x147670[_0x31e5('0x40')]),_0x18fd24);if(_0xe9083e[_0x31e5('0x3f')][_0x31e5('0x4a')]){_0x18eafb['where']=_['merge'](_0x18eafb[_0x31e5('0x48')],{'$or':_[_0x31e5('0x39')](_0x18fd24,function(_0x1a5d77){if(_0x1a5d77[_0x31e5('0x4b')]!==_0x31e5('0x4c')){var _0x232d1c={};_0x232d1c[_0x1a5d77['name']]={'$like':'%'+_0xe9083e['query'][_0x31e5('0x4a')]+'%'};return _0x232d1c;}})});}_0x18eafb=_[_0x31e5('0x4d')]({},_0x18eafb,_0xe9083e[_0x31e5('0x4e')]);var _0x5b2b9a={'where':_0x18eafb[_0x31e5('0x48')]};return db['WhatsappMessage'][_0x31e5('0x32')](_0x5b2b9a)[_0x31e5('0x20')](function(_0xeb3358){_0x115ca5[_0x31e5('0x32')]=_0xeb3358;if(_0xe9083e[_0x31e5('0x3f')][_0x31e5('0x4f')]){_0x18eafb['include']=[{'all':!![]}];}return db[_0x31e5('0x50')][_0x31e5('0x51')](_0x18eafb);})[_0x31e5('0x20')](function(_0x3397b1){_0x115ca5[_0x31e5('0x52')]=_0x3397b1;return _0x115ca5;})[_0x31e5('0x20')](respondWithFilteredResult(_0x291808,_0x18eafb))[_0x31e5('0x2a')](handleError(_0x291808,null));};exports[_0x31e5('0x53')]=function(_0x2c0ef1,_0xe0fb1e){var _0x9e87b7={'raw':!![],'where':{'id':_0x2c0ef1[_0x31e5('0x54')]['id']}},_0x37eb05={};_0x37eb05['model']=_[_0x31e5('0x55')](db[_0x31e5('0x50')][_0x31e5('0x3a')]);_0x37eb05[_0x31e5('0x3f')]=_[_0x31e5('0x55')](_0x2c0ef1[_0x31e5('0x3f')]);_0x37eb05[_0x31e5('0x40')]=_[_0x31e5('0x41')](_0x37eb05[_0x31e5('0x3d')],_0x37eb05[_0x31e5('0x3f')]);_0x9e87b7['attributes']=_[_0x31e5('0x41')](_0x37eb05[_0x31e5('0x3d')],qs['fields'](_0x2c0ef1[_0x31e5('0x3f')][_0x31e5('0x43')]));_0x9e87b7[_0x31e5('0x42')]=_0x9e87b7[_0x31e5('0x42')]['length']?_0x9e87b7[_0x31e5('0x42')]:_0x37eb05[_0x31e5('0x3d')];if(_0x2c0ef1[_0x31e5('0x3f')][_0x31e5('0x4f')]){_0x9e87b7[_0x31e5('0x56')]=[{'all':!![]}];}_0x9e87b7=_[_0x31e5('0x4d')]({},_0x9e87b7,_0x2c0ef1[_0x31e5('0x4e')]);return db[_0x31e5('0x50')][_0x31e5('0x57')](_0x9e87b7)['then'](handleEntityNotFound(_0xe0fb1e,null))[_0x31e5('0x20')](respondWithResult(_0xe0fb1e,null))[_0x31e5('0x2a')](handleError(_0xe0fb1e,null));};exports[_0x31e5('0x58')]=function(_0x124999,_0x3dba40){return db[_0x31e5('0x50')][_0x31e5('0x58')](_0x124999[_0x31e5('0x59')],{})['then'](respondWithResult(_0x3dba40,0xc9))[_0x31e5('0x2a')](handleError(_0x3dba40,null));};exports[_0x31e5('0x36')]=function(_0x5c65a4,_0x4e8889){if(_0x5c65a4['body']['id']){delete _0x5c65a4[_0x31e5('0x59')]['id'];}return db[_0x31e5('0x50')][_0x31e5('0x57')]({'where':{'id':_0x5c65a4[_0x31e5('0x54')]['id']}})[_0x31e5('0x20')](handleEntityNotFound(_0x4e8889,null))[_0x31e5('0x20')](saveUpdates(_0x5c65a4[_0x31e5('0x59')],null))[_0x31e5('0x20')](respondWithResult(_0x4e8889,null))['catch'](handleError(_0x4e8889,null));};exports[_0x31e5('0x37')]=function(_0x5eefb1,_0x263fad){return db[_0x31e5('0x50')][_0x31e5('0x57')]({'where':{'id':_0x5eefb1[_0x31e5('0x54')]['id']}})['then'](handleEntityNotFound(_0x263fad,null))[_0x31e5('0x20')](removeEntity(_0x263fad,null))[_0x31e5('0x2a')](handleError(_0x263fad,null));};exports[_0x31e5('0x5a')]=function(_0x3919dc,_0x37209f){return db['WhatsappMessage'][_0x31e5('0x5a')]()[_0x31e5('0x20')](respondWithResult(_0x37209f,null))['catch'](handleError(_0x37209f,null));};var interaction_log=require(_0x31e5('0x12'))('whatsapp-interactions');exports[_0x31e5('0x5b')]=function(_0x5d8d6a,_0xcada3a,_0x2ad6b1){var _0x24fb04={'agent':{},'channel':_0x31e5('0x5c')};if(_0x5d8d6a[_0x31e5('0x59')]['id']){delete _0x5d8d6a[_0x31e5('0x59')]['id'];}_0x5d8d6a[_0x31e5('0x59')][_0x31e5('0x5d')]=!![];_0x5d8d6a[_0x31e5('0x59')][_0x31e5('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5d8d6a[_0x31e5('0x59')][_0x31e5('0x5f')]=_0x5d8d6a[_0x31e5('0x59')][_0x31e5('0x5f')]||_0x5d8d6a[_0x31e5('0x60')]['id'];_0x24fb04['agent']['id']=_0x5d8d6a[_0x31e5('0x59')][_0x31e5('0x5f')];return db[_0x31e5('0x50')][_0x31e5('0x57')]({'where':{'id':_0x5d8d6a['params']['id'],'UserId':null}})[_0x31e5('0x20')](handleEntityNotFound(_0xcada3a,null))[_0x31e5('0x20')](saveUpdates(_0x5d8d6a[_0x31e5('0x59')],null))[_0x31e5('0x20')](function(_0x7959a5){if(_0x7959a5){_0x24fb04[_0x31e5('0x28')]=_0x7959a5[_0x31e5('0x61')]({'plain':!![]});return db[_0x31e5('0x62')][_0x31e5('0x57')]({'where':{'id':_0x7959a5[_0x31e5('0x63')]}});}return null;})[_0x31e5('0x20')](handleEntityNotFound(_0xcada3a,null))[_0x31e5('0x20')](function(_0x12edca){if(_0x12edca){return _0x12edca['update']({'UserId':_0x5d8d6a['body'][_0x31e5('0x5f')],'read1stAt':_[_0x31e5('0x64')](_0x12edca['read1stAt'])?moment()['format'](_0x31e5('0x65')):undefined});}return null;})[_0x31e5('0x20')](function(_0x561cb5){if(_0x561cb5){_0x24fb04[_0x31e5('0x66')]=_0x561cb5[_0x31e5('0x61')]({'plain':!![]});interaction_log[_0x31e5('0x21')](_0x31e5('0x67'),_0x5d8d6a[_0x31e5('0x60')]['id'],_0x5d8d6a[_0x31e5('0x60')]['name'],_0x5d8d6a[_0x31e5('0x60')][_0x31e5('0x68')],_0x24fb04[_0x31e5('0x66')]['id'],_0x5d8d6a[_0x31e5('0x59')]?JSON[_0x31e5('0x69')](_0x5d8d6a['body']):_0x31e5('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x31e5('0x6b'),_0x24fb04);}return null;})['then'](function(_0x577191){var _0x5c5c74=_0x31e5('0x6c')+_0x577191[_0x31e5('0x28')]['ContactId'];return db['sequelize'][_0x31e5('0x3f')](_0x5c5c74,{'type':db['Sequelize'][_0x31e5('0x6d')][_0x31e5('0x6e')],'raw':!![]})['then'](function(_0x5ddb43){return _0x5ddb43;});})['then'](function(_0x74e4b){if(_0x74e4b){_0x24fb04[_0x31e5('0x28')]['contact']=_0x74e4b[0x0];if(!_0x5d8d6a[_0x31e5('0x59')][_0x31e5('0x5f')])return;return db[_0x31e5('0x6f')][_0x31e5('0x57')]({'where':{'id':_0x5d8d6a['body'][_0x31e5('0x5f')],'role':_0x31e5('0x70')},'attributes':['id',_0x31e5('0x3e'),_0x31e5('0x71'),_0x31e5('0x72'),'internal'],'raw':!![]});}return null;})[_0x31e5('0x20')](function(_0x21839a){if(!_0x21839a)return null;_0x24fb04[_0x31e5('0x28')]['agent']=_0x21839a;return _0x24fb04;})[_0x31e5('0x20')](function(_0x5dfea3){if(_0x5dfea3){if(_0x5d8d6a[_0x31e5('0x59')][_0x31e5('0x73')]){_0x24fb04['message'][_0x31e5('0x74')]=util[_0x31e5('0x75')](_0x31e5('0x76'),_0x5d8d6a['user'][_0x31e5('0x3e')]);_0x24fb04[_0x31e5('0x28')]['channel']=_0x24fb04['channel'];_0x24fb04['message'][_0x31e5('0x77')]=_0x24fb04[_0x31e5('0x78')];_0x24fb04[_0x31e5('0x28')]['event']=_0x31e5('0x5b');return respondWithRpcPromise(_0x31e5('0x79'),_0x31e5('0x79'),{'event':_0x31e5('0x7a'),'message':_0x24fb04[_0x31e5('0x28')]},client9002)[_0x31e5('0x20')](function(){return _0x24fb04;});}return _0x24fb04;}return null;})['then'](respondWithResult(_0xcada3a,null))[_0x31e5('0x2a')](handleError(_0xcada3a,null));};var interaction_log=require(_0x31e5('0x12'))(_0x31e5('0x7b'));exports[_0x31e5('0x7c')]=function(_0x2f913d,_0x4bfeb9,_0x3f8b28){var _0x5aba13={'agent':{},'channel':_0x31e5('0x5c')};if(_0x2f913d[_0x31e5('0x59')]['id']){delete _0x2f913d[_0x31e5('0x59')]['id'];}_0x2f913d[_0x31e5('0x59')][_0x31e5('0x5f')]=_0x2f913d[_0x31e5('0x59')][_0x31e5('0x5f')]||_0x2f913d[_0x31e5('0x60')]['id'];_0x5aba13[_0x31e5('0x70')]['id']=_0x2f913d[_0x31e5('0x59')][_0x31e5('0x5f')];return db['WhatsappMessage'][_0x31e5('0x57')]({'where':{'id':_0x2f913d['params']['id'],'UserId':null}})[_0x31e5('0x20')](handleEntityNotFound(_0x4bfeb9,null))[_0x31e5('0x20')](function(_0x356842){if(_0x356842){_0x5aba13[_0x31e5('0x28')]=_0x356842[_0x31e5('0x61')]({'plain':!![]});return db[_0x31e5('0x62')][_0x31e5('0x57')]({'where':{'id':_0x356842[_0x31e5('0x63')]}});}return null;})[_0x31e5('0x20')](handleEntityNotFound(_0x4bfeb9,null))[_0x31e5('0x20')](function(_0xee8314){if(_0xee8314){_0x5aba13[_0x31e5('0x66')]=_0xee8314[_0x31e5('0x61')]({'plain':!![]});interaction_log['info'](_0x31e5('0x7d'),_0x2f913d[_0x31e5('0x60')]['id'],_0x2f913d[_0x31e5('0x60')][_0x31e5('0x3e')],_0x2f913d[_0x31e5('0x60')]['role'],_0x5aba13['interaction']['id'],_0x2f913d[_0x31e5('0x59')]?JSON['stringify'](_0x2f913d[_0x31e5('0x59')]):_0x31e5('0x6a'));return respondWithRpcPromise(_0x31e5('0x7e'),'rejectMessage',_0x5aba13);}return null;})[_0x31e5('0x20')](function(_0x39e59e){var _0xfb9685=_0x31e5('0x6c')+_0x39e59e[_0x31e5('0x28')][_0x31e5('0x7f')];return db[_0x31e5('0x80')]['query'](_0xfb9685,{'type':db[_0x31e5('0x81')][_0x31e5('0x6d')][_0x31e5('0x6e')],'raw':!![]})[_0x31e5('0x20')](function(_0x4dca6b){return _0x4dca6b;});})[_0x31e5('0x20')](function(_0x2bab03){if(_0x2bab03){_0x5aba13['message'][_0x31e5('0x82')]=_0x2bab03[0x0];if(!_0x2f913d[_0x31e5('0x59')]['UserId'])return;return db[_0x31e5('0x6f')][_0x31e5('0x57')]({'where':{'id':_0x2f913d['body'][_0x31e5('0x5f')],'role':_0x31e5('0x70')},'attributes':['id',_0x31e5('0x3e'),_0x31e5('0x71'),'email',_0x31e5('0x83')],'raw':!![]});}return null;})[_0x31e5('0x20')](function(_0x3e6c94){if(!_0x3e6c94)return null;_0x5aba13[_0x31e5('0x28')][_0x31e5('0x70')]=_0x3e6c94;return _0x5aba13;})[_0x31e5('0x20')](function(_0x1ae69c){if(_0x1ae69c){_0x1ae69c['message']['interface']=util[_0x31e5('0x75')](_0x31e5('0x76'),_0x2f913d['user'][_0x31e5('0x3e')]);_0x1ae69c[_0x31e5('0x28')][_0x31e5('0x78')]=_0x5aba13['channel'];_0x1ae69c['message'][_0x31e5('0x77')]=_0x5aba13['channel'];_0x1ae69c[_0x31e5('0x28')][_0x31e5('0x84')]='reject';respondWithRpcPromise(_0x31e5('0x79'),'EventManager',{'event':_0x31e5('0x85'),'message':_0x1ae69c[_0x31e5('0x28')]},client9002);return _0x5aba13;}return null;})['then'](respondWithResult(_0x4bfeb9,null))[_0x31e5('0x2a')](handleError(_0x4bfeb9,null));};exports[_0x31e5('0x2c')]=function(_0x2becd4,_0xc38f58,_0x2ada56){if(_0x2becd4[_0x31e5('0x59')]['id']){delete _0x2becd4['body']['id'];}var _0x3daa45;return db[_0x31e5('0x50')][_0x31e5('0x57')]({'where':{'id':_0x2becd4['params']['id']}})[_0x31e5('0x20')](handleEntityNotFound(_0xc38f58,null))[_0x31e5('0x20')](function(_0x14fd18){if(_0x14fd18){_0x3daa45=_0x14fd18;return db['WhatsappAccount']['find']({'where':{'id':_0x14fd18[_0x31e5('0x86')]}});}})[_0x31e5('0x20')](handleEntityNotFound(_0xc38f58,null))[_0x31e5('0x20')](function(_0x27a2e5){if(_0x27a2e5){logger[_0x31e5('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x31e5('0x2c'),_0x31e5('0x87'),_0x27a2e5['type'],util[_0x31e5('0x88')](_0x2becd4[_0x31e5('0x59')],{'showHidden':![],'depth':null}));switch(_0x27a2e5[_0x31e5('0x4b')]){case'twilio':if(_0x2becd4[_0x31e5('0x59')][_0x31e5('0x89')]&&_0x2becd4['body'][_0x31e5('0x89')]===_0x3daa45[_0x31e5('0x8a')]&&_0x2becd4[_0x31e5('0x59')][_0x31e5('0x8b')]&&_0x2becd4[_0x31e5('0x59')]['MessageStatus']===_0x31e5('0x5d')){return _0x3daa45[_0x31e5('0x36')]({'read':!![]});}else{logger[_0x31e5('0x26')](_0x31e5('0x8c'),_0x31e5('0x2c'),_0x31e5('0x8d'),util[_0x31e5('0x88')](_0x2becd4[_0x31e5('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3daa45;}})[_0x31e5('0x20')](respondWithResult(_0xc38f58,null))['catch'](handleError(_0xc38f58,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index bf6d784..b56fd6d 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 _0x5eb1=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','WhatsappMessage'];(function(_0x3d0062,_0x4aa074){var _0x131d4c=function(_0x5c1091){while(--_0x5c1091){_0x3d0062['push'](_0x3d0062['shift']());}};_0x131d4c(++_0x4aa074);}(_0x5eb1,0x7c));var _0x15eb=function(_0x316efa,_0x20a1e1){_0x316efa=_0x316efa-0x0;var _0x4d96cc=_0x5eb1[_0x316efa];return _0x4d96cc;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x15eb('0x0'))['db'][_0x15eb('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x15eb('0x2')](0x0);var events={'afterCreate':_0x15eb('0x3'),'afterUpdate':_0x15eb('0x4'),'afterDestroy':_0x15eb('0x5')};function emitEvent(_0x5e1142){return function(_0x3ba774,_0x19d816,_0x1f38c6){WhatsappMessageEvents[_0x15eb('0x6')](_0x5e1142+':'+_0x3ba774['id'],_0x3ba774);WhatsappMessageEvents['emit'](_0x5e1142,_0x3ba774);_0x1f38c6(null);};}for(var e in events){if(events[_0x15eb('0x7')](e)){var event=events[e];WhatsappMessage[_0x15eb('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xb9be=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xb9be,0xc5));var _0xeb9b=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0xb9be[_0x43e4b3];return _0x10c655;};'use strict';var EventEmitter=require(_0xeb9b('0x0'));var WhatsappMessage=require(_0xeb9b('0x1'))['db'][_0xeb9b('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xeb9b('0x3')](0x0);var events={'afterCreate':_0xeb9b('0x4'),'afterUpdate':_0xeb9b('0x5'),'afterDestroy':_0xeb9b('0x6')};function emitEvent(_0x2003d4){return function(_0x288aaa,_0x579a7e,_0x5006b8){WhatsappMessageEvents[_0xeb9b('0x7')](_0x2003d4+':'+_0x288aaa['id'],_0x288aaa);WhatsappMessageEvents[_0xeb9b('0x7')](_0x2003d4,_0x288aaa);_0x5006b8(null);};}for(var e in events){if(events[_0xeb9b('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xeb9b('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 75413d8..b1405ed 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 _0x804d=['finally','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','findOne','then','update','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','/api/whatsapp/messages/','token','sid','catch','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x804d,0x170));var _0xd804=function(_0x38cdf2,_0x56d63a){_0x38cdf2=_0x38cdf2-0x0;var _0x59fc04=_0x804d[_0x38cdf2];return _0x59fc04;};'use strict';var _=require('lodash');var util=require(_0xd804('0x0'));var logger=require(_0xd804('0x1'))('api');var moment=require(_0xd804('0x2'));var BPromise=require(_0xd804('0x3'));var rp=require(_0xd804('0x4'));var fetch=require(_0xd804('0x5'));var fs=require('fs');var path=require(_0xd804('0x6'));var rimraf=require(_0xd804('0x7'));var config=require(_0xd804('0x8'));var attributes=require(_0xd804('0x9'));module[_0xd804('0xa')]=function(_0x5508da,_0x3e2072){return _0x5508da[_0xd804('0xb')](_0xd804('0xc'),attributes,{'tableName':_0xd804('0xd'),'paranoid':![],'indexes':[{'name':_0xd804('0xe'),'fields':[_0xd804('0xe')]},{'name':_0xd804('0xf'),'fields':[_0xd804('0x10')],'type':_0xd804('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x567532,_0x4a0f6a,_0xfe194d){var _0x5ae25d=_0x5508da[_0xd804('0x12')];var _0x363141=_0x567532[_0xd804('0x13')]({'plain':!![]});if(_0x363141[_0xd804('0x14')][_0xd804('0x15')]()==='in'||_0x363141['direction'][_0xd804('0x15')]()===_0xd804('0x16')&&!_0x363141[_0xd804('0x17')]&&!_['isNil'](_0x363141[_0xd804('0x18')])){_0x5ae25d['WhatsappInteraction'][_0xd804('0x19')]({'where':{'id':_0x363141['WhatsappInteractionId']}})[_0xd804('0x1a')](function(_0x381ce3){if(_0x381ce3){_0x381ce3[_0xd804('0x1b')]({'lastMsgAt':_0x363141['createdAt'],'lastMsgDirection':_0x363141[_0xd804('0x14')]['toLowerCase']()});}})['catch'](function(_0x51c71f){console[_0xd804('0x1c')](_0x51c71f);});}if(_0x363141['direction']==='out'&&!_0x363141[_0xd804('0x17')]){var _0x3d6df7;_0x5ae25d[_0xd804('0x1d')][_0xd804('0x1e')]({'where':{'id':_0x363141[_0xd804('0x1f')]},'raw':!![]})['then'](function(_0x4c20be){_0x3d6df7=_0x4c20be;if(_0x3d6df7&&_0x3d6df7[_0xd804('0x20')]){switch(_0x3d6df7[_0xd804('0x20')]){case _0xd804('0x21'):var _0x4028bd=require('twilio');if(_0x3d6df7[_0xd804('0x22')]&&_0x3d6df7[_0xd804('0x23')]&&_0x3d6df7['phone']){var _0x53002f=new _0x4028bd(_0x3d6df7['accountSid'],_0x3d6df7[_0xd804('0x23')]);_0x53002f[_0xd804('0x24')][_0xd804('0x25')]({'body':_0x363141[_0xd804('0x10')],'to':_0xd804('0x26')+_0x363141[_0xd804('0x27')],'from':_0xd804('0x26')+_0x3d6df7['phone'],'statusCallback':_0x3d6df7['remote']+_0xd804('0x28')+_0x363141['id']+'/status?token='+_0x3d6df7[_0xd804('0x29')]})['then'](function(_0x3bbd00){if(_0x3bbd00['sid']){return _0x567532[_0xd804('0x1b')]({'messageId':_0x3bbd00[_0xd804('0x2a')]});}})[_0xd804('0x2b')](function(_0x33979f){logger[_0xd804('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd804('0x2c'),_0xd804('0x21'),util[_0xd804('0x2d')](_0x33979f,{'showHidden':![],'depth':null}));});}else{logger[_0xd804('0x1c')](_0xd804('0x2e'),_0xd804('0x2c'),_0xd804('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xd804('0x2f'):var _0x57dda7=_0x3d6df7[_0xd804('0x22')];var _0x858964=_0x3d6df7[_0xd804('0x23')];var _0x5ecc73=_0x3d6df7[_0xd804('0x30')]+_0xd804('0x31')+_0x57dda7+_0xd804('0x32');var _0x569923={'to':[_0x363141[_0xd804('0x27')]],'message':{'type':_0xd804('0x33'),'text':_0x363141[_0xd804('0x10')]}};var _0x42ecc6={'method':_0xd804('0x34'),'uri':_0x5ecc73,'headers':{'Authorization':_0xd804('0x35')+_0x858964,'Content-Type':_0xd804('0x36')},'body':_0x569923,'json':!![]};rp(_0x42ecc6)[_0xd804('0x1a')](function(_0xaffd54){if(_0xaffd54[_0xd804('0x37')][0x0][_0xd804('0x38')]){return _0x567532[_0xd804('0x1b')]({'messageId':_0xaffd54[_0xd804('0x37')][0x0][_0xd804('0x38')]});}})['catch'](function(_0x5b026c){logger[_0xd804('0x39')](_0xd804('0x3a'),_0x5b026c);});break;}}})[_0xd804('0x3b')](function(){_0xfe194d();});}else{_0xfe194d();}}},'charset':'utf8mb4','collate':_0xd804('0x3c')});}; \ No newline at end of file +var _0xb73c=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','phone','text','POST','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','WhatsappInteractionId','createdAt','catch','error','out','find','then','type','authToken','accountSid','create','body','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio'];(function(_0x27db99,_0x4c446a){var _0xaa18cf=function(_0x1f137b){while(--_0x1f137b){_0x27db99['push'](_0x27db99['shift']());}};_0xaa18cf(++_0x4c446a);}(_0xb73c,0x1cd));var _0xcb73=function(_0x2b17fc,_0x163b7b){_0x2b17fc=_0x2b17fc-0x0;var _0x5e6b74=_0xb73c[_0x2b17fc];return _0x5e6b74;};'use strict';var _=require(_0xcb73('0x0'));var util=require('util');var logger=require(_0xcb73('0x1'))(_0xcb73('0x2'));var moment=require(_0xcb73('0x3'));var BPromise=require(_0xcb73('0x4'));var rp=require(_0xcb73('0x5'));var fetch=require(_0xcb73('0x6'));var fs=require('fs');var path=require(_0xcb73('0x7'));var rimraf=require('rimraf');var config=require(_0xcb73('0x8'));var attributes=require(_0xcb73('0x9'));module['exports']=function(_0x5a230f,_0x5e1e57){return _0x5a230f[_0xcb73('0xa')](_0xcb73('0xb'),attributes,{'tableName':_0xcb73('0xc'),'paranoid':![],'indexes':[{'name':_0xcb73('0xd'),'fields':[_0xcb73('0xd')]},{'name':_0xcb73('0xe'),'fields':['body'],'type':_0xcb73('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5660df,_0x45ce11,_0x405ef2){var _0xef845d=_0x5a230f[_0xcb73('0x10')];var _0x277320=_0x5660df['get']({'plain':!![]});if(_0x277320['direction']['toLowerCase']()==='in'||_0x277320[_0xcb73('0x11')][_0xcb73('0x12')]()==='out'&&!_0x277320[_0xcb73('0x13')]&&!_[_0xcb73('0x14')](_0x277320[_0xcb73('0x15')])){_0xef845d['WhatsappInteraction']['findOne']({'where':{'id':_0x277320[_0xcb73('0x16')]}})['then'](function(_0x4cdfd2){if(_0x4cdfd2){_0x4cdfd2['update']({'lastMsgAt':_0x277320[_0xcb73('0x17')],'lastMsgDirection':_0x277320[_0xcb73('0x11')]['toLowerCase']()});}})[_0xcb73('0x18')](function(_0x8d5ef5){console[_0xcb73('0x19')](_0x8d5ef5);});}if(_0x277320['direction']===_0xcb73('0x1a')&&!_0x277320['secret']){var _0x42673e;_0xef845d['WhatsappAccount'][_0xcb73('0x1b')]({'where':{'id':_0x277320['WhatsappAccountId']},'raw':!![]})[_0xcb73('0x1c')](function(_0x32af1c){_0x42673e=_0x32af1c;if(_0x42673e&&_0x42673e[_0xcb73('0x1d')]){switch(_0x42673e[_0xcb73('0x1d')]){case'twilio':var _0xdc2569=require('twilio');if(_0x42673e['accountSid']&&_0x42673e[_0xcb73('0x1e')]&&_0x42673e['phone']){var _0x4a8dfb=new _0xdc2569(_0x42673e[_0xcb73('0x1f')],_0x42673e['authToken']);_0x4a8dfb['messages'][_0xcb73('0x20')]({'body':_0x277320[_0xcb73('0x21')],'to':'whatsapp:'+_0x277320['phone'],'from':'whatsapp:'+_0x42673e['phone'],'statusCallback':_0x42673e[_0xcb73('0x22')]+_0xcb73('0x23')+_0x277320['id']+_0xcb73('0x24')+_0x42673e[_0xcb73('0x25')]})[_0xcb73('0x1c')](function(_0x1999dd){if(_0x1999dd[_0xcb73('0x26')]){return _0x5660df[_0xcb73('0x27')]({'messageId':_0x1999dd[_0xcb73('0x26')]});}})[_0xcb73('0x18')](function(_0x3339a2){logger['error'](_0xcb73('0x28'),_0xcb73('0x29'),_0xcb73('0x2a'),util['inspect'](_0x3339a2,{'showHidden':![],'depth':null}));});}else{logger[_0xcb73('0x19')](_0xcb73('0x28'),_0xcb73('0x29'),_0xcb73('0x2a'),_0xcb73('0x2b'));}break;case _0xcb73('0x2c'):var _0x12366f=_0x42673e[_0xcb73('0x1f')];var _0x4287d6=_0x42673e['authToken'];var _0x4a5011=_0x42673e['baseUrl']+_0xcb73('0x2d')+_0x12366f+'/messages/';var _0x25a62b={'to':[_0x277320[_0xcb73('0x2e')]],'message':{'type':_0xcb73('0x2f'),'text':_0x277320[_0xcb73('0x21')]}};var _0xab1269={'method':_0xcb73('0x30'),'uri':_0x4a5011,'headers':{'Authorization':'Bearer\x20'+_0x4287d6,'Content-Type':_0xcb73('0x31')},'body':_0x25a62b,'json':!![]};rp(_0xab1269)[_0xcb73('0x1c')](function(_0x56bee1){if(_0x56bee1[_0xcb73('0x32')][0x0][_0xcb73('0x33')]){return _0x5660df[_0xcb73('0x27')]({'messageId':_0x56bee1[_0xcb73('0x32')][0x0][_0xcb73('0x33')]});}})[_0xcb73('0x18')](function(_0x569ef6){logger['err'](_0xcb73('0x34'),_0x569ef6);});break;}}})[_0xcb73('0x35')](function(){_0x405ef2();});}else{_0x405ef2();}}},'charset':_0xcb73('0x36'),'collate':_0xcb73('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c17a13b..e0125d6 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 _0x8f7c=['options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','info','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body'];(function(_0x48df04,_0x1522b1){var _0x4de5fa=function(_0x3ae6db){while(--_0x3ae6db){_0x48df04['push'](_0x48df04['shift']());}};_0x4de5fa(++_0x1522b1);}(_0x8f7c,0x18f));var _0xc8f7=function(_0x4413cf,_0x3f70e8){_0x4413cf=_0x4413cf-0x0;var _0x9a1479=_0x8f7c[_0x4413cf];return _0x9a1479;};'use strict';var _=require(_0xc8f7('0x0'));var util=require(_0xc8f7('0x1'));var moment=require(_0xc8f7('0x2'));var BPromise=require(_0xc8f7('0x3'));var rs=require(_0xc8f7('0x4'));var fs=require('fs');var Redis=require(_0xc8f7('0x5'));var db=require(_0xc8f7('0x6'))['db'];var utils=require(_0xc8f7('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc8f7('0x8'));var jayson=require(_0xc8f7('0x9'));var client=jayson[_0xc8f7('0xa')]['http']({'port':0x232a});config[_0xc8f7('0xb')]=_[_0xc8f7('0xc')](config[_0xc8f7('0xb')],{'host':_0xc8f7('0xd'),'port':0x18eb});var socket=require(_0xc8f7('0xe'))(new Redis(config['redis']));require(_0xc8f7('0xf'))['register'](socket);function respondWithRpcPromise(_0x3f09a5,_0x2e39b4,_0x2c53cf){return new BPromise(function(_0x5850f3,_0x3a770c){return client[_0xc8f7('0x10')](_0x3f09a5,_0x2c53cf)['then'](function(_0x374125){logger[_0xc8f7('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x2e39b4,_0xc8f7('0x12'));logger[_0xc8f7('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2e39b4,_0xc8f7('0x12'),JSON[_0xc8f7('0x14')](_0x374125));if(_0x374125[_0xc8f7('0x15')]){if(_0x374125['error'][_0xc8f7('0x16')]===0x1f4){logger[_0xc8f7('0x15')](_0xc8f7('0x17'),_0x2e39b4,_0x374125['error']['message']);return _0x3a770c(_0x374125[_0xc8f7('0x15')][_0xc8f7('0x18')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2e39b4,_0x374125[_0xc8f7('0x15')]['message']);return _0x5850f3(_0x374125[_0xc8f7('0x15')][_0xc8f7('0x18')]);}else{logger['info'](_0xc8f7('0x17'),_0x2e39b4,_0xc8f7('0x12'));_0x5850f3(_0x374125['result'][_0xc8f7('0x18')]);}})[_0xc8f7('0x19')](function(_0x4afbe0){logger['error'](_0xc8f7('0x17'),_0x2e39b4,_0x4afbe0);_0x3a770c(_0x4afbe0);});});}exports[_0xc8f7('0x1a')]=function(_0x1f39b4){var _0x19e7bc=this;return new Promise(function(_0x5320c0,_0x5e6386){return db[_0xc8f7('0x1b')][_0xc8f7('0x1c')](_0x1f39b4[_0xc8f7('0x1d')],{'raw':_0x1f39b4[_0xc8f7('0x1e')]?_0x1f39b4[_0xc8f7('0x1e')][_0xc8f7('0x1f')]===undefined?!![]:![]:!![]})[_0xc8f7('0x20')](function(_0x4be8ce){logger[_0xc8f7('0x11')](_0xc8f7('0x1a'),_0x1f39b4);logger[_0xc8f7('0x13')]('CreateWhatsappMessage',_0x1f39b4,JSON[_0xc8f7('0x14')](_0x4be8ce));_0x5320c0(_0x4be8ce);})[_0xc8f7('0x19')](function(_0x59d985){logger[_0xc8f7('0x15')](_0xc8f7('0x1a'),_0x59d985[_0xc8f7('0x18')],_0x1f39b4);_0x5e6386(_0x19e7bc['error'](0x1f4,_0x59d985['message']));});});}; \ No newline at end of file +var _0x0045=['./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappMessage','WhatsappMessage','create','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','defaults','socket.io-emitter','redis'];(function(_0x3aac36,_0x287fe1){var _0x519fe0=function(_0x1da7de){while(--_0x1da7de){_0x3aac36['push'](_0x3aac36['shift']());}};_0x519fe0(++_0x287fe1);}(_0x0045,0x1e3));var _0x5004=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0045[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x5004('0x0'));var moment=require(_0x5004('0x1'));var BPromise=require(_0x5004('0x2'));var rs=require(_0x5004('0x3'));var fs=require('fs');var Redis=require(_0x5004('0x4'));var db=require(_0x5004('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5004('0x6'));var config=require('../../config/environment');var jayson=require(_0x5004('0x7'));var client=jayson[_0x5004('0x8')][_0x5004('0x9')]({'port':0x232a});config['redis']=_[_0x5004('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5004('0xb'))(new Redis(config[_0x5004('0xc')]));require(_0x5004('0xd'))['register'](socket);function respondWithRpcPromise(_0x56a232,_0x532749,_0x248435){return new BPromise(function(_0x5146ce,_0x391d76){return client[_0x5004('0xe')](_0x56a232,_0x248435)[_0x5004('0xf')](function(_0x434264){logger[_0x5004('0x10')](_0x5004('0x11'),_0x532749,_0x5004('0x12'));logger[_0x5004('0x13')](_0x5004('0x14'),_0x532749,_0x5004('0x12'),JSON[_0x5004('0x15')](_0x434264));if(_0x434264['error']){if(_0x434264[_0x5004('0x16')]['code']===0x1f4){logger[_0x5004('0x16')](_0x5004('0x11'),_0x532749,_0x434264[_0x5004('0x16')]['message']);return _0x391d76(_0x434264['error'][_0x5004('0x17')]);}logger[_0x5004('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x532749,_0x434264[_0x5004('0x16')]['message']);return _0x5146ce(_0x434264[_0x5004('0x16')]['message']);}else{logger[_0x5004('0x10')](_0x5004('0x11'),_0x532749,'request\x20sent');_0x5146ce(_0x434264[_0x5004('0x18')][_0x5004('0x17')]);}})['catch'](function(_0xc0dba2){logger['error'](_0x5004('0x11'),_0x532749,_0xc0dba2);_0x391d76(_0xc0dba2);});});}exports[_0x5004('0x19')]=function(_0x487a00){var _0x1485e1=this;return new Promise(function(_0x41b22e,_0x79087d){return db[_0x5004('0x1a')][_0x5004('0x1b')](_0x487a00['body'],{'raw':_0x487a00['options']?_0x487a00[_0x5004('0x1c')][_0x5004('0x1d')]===undefined?!![]:![]:!![]})[_0x5004('0xf')](function(_0x34e8a2){logger[_0x5004('0x10')]('CreateWhatsappMessage',_0x487a00);logger[_0x5004('0x13')](_0x5004('0x19'),_0x487a00,JSON[_0x5004('0x15')](_0x34e8a2));_0x41b22e(_0x34e8a2);})[_0x5004('0x1e')](function(_0x71bb3d){logger['error']('CreateWhatsappMessage',_0x71bb3d[_0x5004('0x17')],_0x487a00);_0x79087d(_0x1485e1[_0x5004('0x16')](0x1f4,_0x71bb3d[_0x5004('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index cacadc1..781d21b 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 _0x5293=['./whatsappMessage.events','save','emit','removeListener','register','whatsappMessage:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5293,0x138));var _0x3529=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x5293[_0x18a436];return _0x5c2cf8;};'use strict';var WhatsappMessageEvents=require(_0x3529('0x0'));var events=[_0x3529('0x1'),'remove','update'];function createListener(_0x1bd428,_0x43dace){return function(_0x603836){_0x43dace[_0x3529('0x2')](_0x1bd428,_0x603836);};}function removeListener(_0x4e576b,_0x2f5d09){return function(){WhatsappMessageEvents[_0x3529('0x3')](_0x4e576b,_0x2f5d09);};}exports[_0x3529('0x4')]=function(_0x554b71){for(var _0x5334a2=0x0,_0xb2184d=events['length'];_0x5334a2<_0xb2184d;_0x5334a2++){var _0x1d24cf=events[_0x5334a2];var _0x4a1ac5=createListener(_0x3529('0x5')+_0x1d24cf,_0x554b71);WhatsappMessageEvents['on'](_0x1d24cf,_0x4a1ac5);}}; \ No newline at end of file +var _0x03d6=['emit','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x03d6,0xfc));var _0x603d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x03d6[_0x2641f9];return _0x585741;};'use strict';var WhatsappMessageEvents=require(_0x603d('0x0'));var events=['save',_0x603d('0x1'),_0x603d('0x2')];function createListener(_0x505778,_0x1a91bc){return function(_0x553ab1){_0x1a91bc[_0x603d('0x3')](_0x505778,_0x553ab1);};}function removeListener(_0x3bcf4d,_0x5486a1){return function(){WhatsappMessageEvents['removeListener'](_0x3bcf4d,_0x5486a1);};}exports['register']=function(_0x46c4bd){for(var _0x596a47=0x0,_0x1bc3e3=events['length'];_0x596a47<_0x1bc3e3;_0x596a47++){var _0x16a5a4=events[_0x596a47];var _0x5316db=createListener(_0x603d('0x4')+_0x16a5a4,_0x46c4bd);WhatsappMessageEvents['on'](_0x16a5a4,_0x5316db);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index afe1ea1..6d66a55 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 _0xa046=['getAgents','addTeams','post','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x265034,_0x237402){var _0x5d18f0=function(_0x4da967){while(--_0x4da967){_0x265034['push'](_0x265034['shift']());}};_0x5d18f0(++_0x237402);}(_0xa046,0xab));var _0x6a04=function(_0x1a7d78,_0x54d6ff){_0x1a7d78=_0x1a7d78-0x0;var _0x3153ae=_0xa046[_0x1a7d78];return _0x3153ae;};'use strict';var multer=require(_0x6a04('0x0'));var util=require(_0x6a04('0x1'));var path=require(_0x6a04('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a04('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6a04('0x4'));var interaction=require(_0x6a04('0x5'));var config=require(_0x6a04('0x6'));var controller=require(_0x6a04('0x7'));router[_0x6a04('0x8')]('/',auth[_0x6a04('0x9')](),controller[_0x6a04('0xa')]);router[_0x6a04('0x8')](_0x6a04('0xb'),auth[_0x6a04('0x9')](),controller['describe']);router[_0x6a04('0x8')](_0x6a04('0xc'),auth[_0x6a04('0x9')](),controller['show']);router[_0x6a04('0x8')](_0x6a04('0xd'),auth['isAuthenticated'](),controller[_0x6a04('0xe')]);router[_0x6a04('0x8')](_0x6a04('0xf'),auth[_0x6a04('0x9')](),controller[_0x6a04('0x10')]);router[_0x6a04('0x8')](_0x6a04('0x11'),auth[_0x6a04('0x9')](),controller[_0x6a04('0x12')]);router['post']('/',auth[_0x6a04('0x9')](),controller['create']);router['post'](_0x6a04('0xf'),auth['isAuthenticated'](),controller[_0x6a04('0x13')]);router[_0x6a04('0x14')](_0x6a04('0x11'),auth[_0x6a04('0x9')](),controller[_0x6a04('0x15')]);router['put'](_0x6a04('0xc'),auth[_0x6a04('0x9')](),controller[_0x6a04('0x16')]);router[_0x6a04('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x6a04('0x18')]);router[_0x6a04('0x17')](_0x6a04('0xf'),auth['isAuthenticated'](),controller[_0x6a04('0x19')]);router['delete'](_0x6a04('0x11'),auth[_0x6a04('0x9')](),controller[_0x6a04('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xbaa3=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbaa3,0x100));var _0x3baa=function(_0x32a884,_0x183853){_0x32a884=_0x32a884-0x0;var _0x242f9b=_0xbaa3[_0x32a884];return _0x242f9b;};'use strict';var multer=require(_0x3baa('0x0'));var util=require(_0x3baa('0x1'));var path=require('path');var timeout=require(_0x3baa('0x2'));var express=require(_0x3baa('0x3'));var router=express[_0x3baa('0x4')]();var fs_extra=require(_0x3baa('0x5'));var auth=require(_0x3baa('0x6'));var interaction=require(_0x3baa('0x7'));var config=require(_0x3baa('0x8'));var controller=require(_0x3baa('0x9'));router[_0x3baa('0xa')]('/',auth[_0x3baa('0xb')](),controller[_0x3baa('0xc')]);router[_0x3baa('0xa')](_0x3baa('0xd'),auth[_0x3baa('0xb')](),controller[_0x3baa('0xe')]);router[_0x3baa('0xa')](_0x3baa('0xf'),auth[_0x3baa('0xb')](),controller[_0x3baa('0x10')]);router[_0x3baa('0xa')](_0x3baa('0x11'),auth['isAuthenticated'](),controller[_0x3baa('0x12')]);router['get'](_0x3baa('0x13'),auth[_0x3baa('0xb')](),controller[_0x3baa('0x14')]);router[_0x3baa('0xa')](_0x3baa('0x15'),auth[_0x3baa('0xb')](),controller['getAgents']);router[_0x3baa('0x16')]('/',auth[_0x3baa('0xb')](),controller['create']);router[_0x3baa('0x16')]('/:id/teams',auth[_0x3baa('0xb')](),controller[_0x3baa('0x17')]);router[_0x3baa('0x16')](_0x3baa('0x15'),auth[_0x3baa('0xb')](),controller[_0x3baa('0x18')]);router['put']('/:id',auth[_0x3baa('0xb')](),controller[_0x3baa('0x19')]);router[_0x3baa('0x1a')]('/:id',auth[_0x3baa('0xb')](),controller[_0x3baa('0x1b')]);router['delete'](_0x3baa('0x13'),auth[_0x3baa('0xb')](),controller['removeTeams']);router[_0x3baa('0x1a')](_0x3baa('0x15'),auth[_0x3baa('0xb')](),controller[_0x3baa('0x1c')]);module[_0x3baa('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index cea22ca..3386ef5 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 _0x13c0=['roundrobin','sequelize','exports','STRING','name','beepall'];(function(_0x181c09,_0x1abf25){var _0x20473e=function(_0x1b1320){while(--_0x1b1320){_0x181c09['push'](_0x181c09['shift']());}};_0x20473e(++_0x1abf25);}(_0x13c0,0x79));var _0x013c=function(_0xed6f46,_0x1c9006){_0xed6f46=_0xed6f46-0x0;var _0x5b267c=_0x13c0[_0xed6f46];return _0x5b267c;};'use strict';var Sequelize=require(_0x013c('0x0'));module[_0x013c('0x1')]={'name':{'type':Sequelize[_0x013c('0x2')],'unique':_0x013c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x013c('0x4'),_0x013c('0x5'))},'description':{'type':Sequelize[_0x013c('0x2')]}}; \ No newline at end of file +var _0x8482=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x15a56e,_0x44d0be){var _0x4c52b4=function(_0x50766c){while(--_0x50766c){_0x15a56e['push'](_0x15a56e['shift']());}};_0x4c52b4(++_0x44d0be);}(_0x8482,0x14e));var _0x2848=function(_0x54a192,_0x2e36ef){_0x54a192=_0x54a192-0x0;var _0x574982=_0x8482[_0x54a192];return _0x574982;};'use strict';var Sequelize=require('sequelize');module[_0x2848('0x0')]={'name':{'type':Sequelize[_0x2848('0x1')],'unique':_0x2848('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2848('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2848('0x4')](_0x2848('0x5'),_0x2848('0x6'),_0x2848('0x7'))},'description':{'type':Sequelize[_0x2848('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 7fd6340..9cd1b3f 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 _0x68c3=['ids','Team','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','forEach','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','get','WhatsappQueues','name','send','WhatsappQueue','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','User','findAndCountAll','agent','createdAt','%s/%s','SIP','whatsappPause','updatedAt','getTeams','findOne','addTeams'];(function(_0x96cc16,_0x5d27d6){var _0x42d571=function(_0x3ac280){while(--_0x3ac280){_0x96cc16['push'](_0x96cc16['shift']());}};_0x42d571(++_0x5d27d6);}(_0x68c3,0x1da));var _0x368c=function(_0x161ac3,_0x142e49){_0x161ac3=_0x161ac3-0x0;var _0x3bb837=_0x68c3[_0x161ac3];return _0x3bb837;};'use strict';var emlformat=require(_0x368c('0x0'));var rimraf=require(_0x368c('0x1'));var zipdir=require(_0x368c('0x2'));var jsonpatch=require(_0x368c('0x3'));var rp=require(_0x368c('0x4'));var moment=require(_0x368c('0x5'));var BPromise=require(_0x368c('0x6'));var Mustache=require(_0x368c('0x7'));var util=require(_0x368c('0x8'));var path=require('path');var sox=require(_0x368c('0x9'));var csv=require(_0x368c('0xa'));var ejs=require(_0x368c('0xb'));var fs=require('fs');var fs_extra=require(_0x368c('0xc'));var _=require(_0x368c('0xd'));var squel=require('squel');var crypto=require(_0x368c('0xe'));var jsforce=require(_0x368c('0xf'));var deskjs=require(_0x368c('0x10'));var toCsv=require(_0x368c('0xa'));var querystring=require(_0x368c('0x11'));var Papa=require(_0x368c('0x12'));var Redis=require(_0x368c('0x13'));var authService=require(_0x368c('0x14'));var qs=require(_0x368c('0x15'));var as=require(_0x368c('0x16'));var hardwareService=require(_0x368c('0x17'));var logger=require(_0x368c('0x18'))(_0x368c('0x19'));var utils=require('../../config/utils');var config=require(_0x368c('0x1a'));var licenseUtil=require(_0x368c('0x1b'));var db=require(_0x368c('0x1c'))['db'];config[_0x368c('0x1d')]=_[_0x368c('0x1e')](config[_0x368c('0x1d')],{'host':_0x368c('0x1f'),'port':0x18eb});var socket=require(_0x368c('0x20'))(new Redis(config['redis']));require(_0x368c('0x21'))[_0x368c('0x22')](socket);function respondWithStatusCode(_0xa7bbbb,_0x502f4e){_0x502f4e=_0x502f4e||0xcc;return function(_0x120729){if(_0x120729){return _0xa7bbbb[_0x368c('0x23')](_0x502f4e);}return _0xa7bbbb['status'](_0x502f4e)[_0x368c('0x24')]();};}function respondWithResult(_0x231fbb,_0x1bd2aa){_0x1bd2aa=_0x1bd2aa||0xc8;return function(_0x21c9c6){if(_0x21c9c6){return _0x231fbb['status'](_0x1bd2aa)[_0x368c('0x25')](_0x21c9c6);}};}function respondWithFilteredResult(_0x57765f,_0x3d0218){return function(_0x3ba16a){if(_0x3ba16a){var _0x232a8f=typeof _0x3d0218[_0x368c('0x26')]===_0x368c('0x27')&&typeof _0x3d0218[_0x368c('0x28')]===_0x368c('0x27');var _0x257815=_0x3ba16a['count'];var _0x3377e0=_0x232a8f?0x0:_0x3d0218['offset'];var _0x3f076c=_0x232a8f?_0x3ba16a[_0x368c('0x29')]:_0x3d0218[_0x368c('0x26')]+_0x3d0218[_0x368c('0x28')];var _0xc9ce3a;if(_0x3f076c>=_0x257815){_0x3f076c=_0x257815;_0xc9ce3a=0xc8;}else{_0xc9ce3a=0xce;}_0x57765f[_0x368c('0x2a')](_0xc9ce3a);return _0x57765f[_0x368c('0x2b')]('Content-Range',_0x3377e0+'-'+_0x3f076c+'/'+_0x257815)['json'](_0x3ba16a);}return null;};}function patchUpdates(_0x1fd21b){return function(_0x3452f6){try{jsonpatch[_0x368c('0x2c')](_0x3452f6,_0x1fd21b,!![]);}catch(_0x5bfe0c){return BPromise['reject'](_0x5bfe0c);}return _0x3452f6[_0x368c('0x2d')]();};}function saveUpdates(_0x59f594,_0x4dee48){return function(_0x44a919){if(_0x44a919){return _0x44a919[_0x368c('0x2e')](_0x59f594)[_0x368c('0x2f')](function(_0x244c35){return _0x244c35;});}return null;};}function removeEntity(_0x5411a2,_0x695d78){return function(_0xf9f4a2){if(_0xf9f4a2){return _0xf9f4a2[_0x368c('0x30')]()[_0x368c('0x2f')](function(){var _0x18bfb7=_0xf9f4a2[_0x368c('0x31')]({'plain':!![]});var _0x4f56c2=_0x368c('0x32');return db['UserProfileResource'][_0x368c('0x30')]({'where':{'type':_0x4f56c2,'resourceId':_0x18bfb7['id']}})[_0x368c('0x2f')](function(){return _0xf9f4a2;});})[_0x368c('0x2f')](function(){_0x5411a2[_0x368c('0x2a')](0xcc)[_0x368c('0x24')]();});}};}function handleEntityNotFound(_0x1721e5,_0x3ba210){return function(_0x2f83f2){if(!_0x2f83f2){_0x1721e5['sendStatus'](0x194);}return _0x2f83f2;};}function handleError(_0x2034fb,_0x58c4d3){_0x58c4d3=_0x58c4d3||0x1f4;return function(_0xfa461a){logger['error'](_0xfa461a['stack']);if(_0xfa461a[_0x368c('0x33')]){delete _0xfa461a[_0x368c('0x33')];}_0x2034fb[_0x368c('0x2a')](_0x58c4d3)[_0x368c('0x34')](_0xfa461a);};}exports['index']=function(_0x5a6bfc,_0x4c01b0){var _0x3a3905={},_0x42a4ba={},_0x4cf10f={'count':0x0,'rows':[]};var _0x1aec74=_['map'](db[_0x368c('0x35')][_0x368c('0x36')],function(_0x23a2a6){return{'name':_0x23a2a6['fieldName'],'type':_0x23a2a6[_0x368c('0x37')][_0x368c('0x38')]};});_0x42a4ba[_0x368c('0x39')]=_[_0x368c('0x3a')](_0x1aec74,'name');_0x42a4ba['query']=_[_0x368c('0x3b')](_0x5a6bfc[_0x368c('0x3c')]);_0x42a4ba['filters']=_[_0x368c('0x3d')](_0x42a4ba['model'],_0x42a4ba[_0x368c('0x3c')]);_0x3a3905[_0x368c('0x3e')]=_[_0x368c('0x3d')](_0x42a4ba[_0x368c('0x39')],qs[_0x368c('0x3f')](_0x5a6bfc['query'][_0x368c('0x3f')]));_0x3a3905[_0x368c('0x3e')]=_0x3a3905[_0x368c('0x3e')][_0x368c('0x40')]?_0x3a3905[_0x368c('0x3e')]:_0x42a4ba['model'];if(!_0x5a6bfc[_0x368c('0x3c')][_0x368c('0x41')](_0x368c('0x42'))){_0x3a3905['limit']=qs['limit'](_0x5a6bfc[_0x368c('0x3c')][_0x368c('0x28')]);_0x3a3905[_0x368c('0x26')]=qs[_0x368c('0x26')](_0x5a6bfc[_0x368c('0x3c')][_0x368c('0x26')]);}_0x3a3905[_0x368c('0x43')]=qs['sort'](_0x5a6bfc[_0x368c('0x3c')][_0x368c('0x44')]);_0x3a3905['where']=qs['filters'](_[_0x368c('0x45')](_0x5a6bfc[_0x368c('0x3c')],_0x42a4ba[_0x368c('0x46')]),_0x1aec74);if(_0x5a6bfc[_0x368c('0x3c')][_0x368c('0x47')]){_0x3a3905[_0x368c('0x48')]=_[_0x368c('0x49')](_0x3a3905[_0x368c('0x48')],{'$or':_[_0x368c('0x3a')](_0x1aec74,function(_0x5cd48e){if(_0x5cd48e[_0x368c('0x37')]!=='VIRTUAL'){var _0x39ff8f={};_0x39ff8f[_0x5cd48e[_0x368c('0x33')]]={'$like':'%'+_0x5a6bfc[_0x368c('0x3c')][_0x368c('0x47')]+'%'};return _0x39ff8f;}})});}_0x3a3905=_[_0x368c('0x49')]({},_0x3a3905,_0x5a6bfc[_0x368c('0x4a')]);var _0x2cb038={'where':_0x3a3905[_0x368c('0x48')]};return db['WhatsappQueue'][_0x368c('0x29')](_0x2cb038)[_0x368c('0x2f')](function(_0x4e098d){_0x4cf10f['count']=_0x4e098d;if(_0x5a6bfc[_0x368c('0x3c')][_0x368c('0x4b')]){_0x3a3905[_0x368c('0x4c')]=[{'all':!![]}];}return db[_0x368c('0x35')][_0x368c('0x4d')](_0x3a3905);})[_0x368c('0x2f')](function(_0x123ef7){_0x4cf10f[_0x368c('0x4e')]=_0x123ef7;return _0x4cf10f;})[_0x368c('0x2f')](respondWithFilteredResult(_0x4c01b0,_0x3a3905))[_0x368c('0x4f')](handleError(_0x4c01b0,null));};exports['show']=function(_0x74813c,_0x1a06ac){var _0x9c287a={'raw':!![],'where':{'id':_0x74813c[_0x368c('0x50')]['id']}},_0x454b26={};_0x454b26[_0x368c('0x39')]=_['keys'](db['WhatsappQueue'][_0x368c('0x36')]);_0x454b26[_0x368c('0x3c')]=_[_0x368c('0x3b')](_0x74813c[_0x368c('0x3c')]);_0x454b26[_0x368c('0x46')]=_[_0x368c('0x3d')](_0x454b26[_0x368c('0x39')],_0x454b26[_0x368c('0x3c')]);_0x9c287a[_0x368c('0x3e')]=_['intersection'](_0x454b26[_0x368c('0x39')],qs[_0x368c('0x3f')](_0x74813c[_0x368c('0x3c')][_0x368c('0x3f')]));_0x9c287a[_0x368c('0x3e')]=_0x9c287a[_0x368c('0x3e')]['length']?_0x9c287a['attributes']:_0x454b26[_0x368c('0x39')];if(_0x74813c['query'][_0x368c('0x4b')]){_0x9c287a[_0x368c('0x4c')]=[{'all':!![]}];}_0x9c287a=_[_0x368c('0x49')]({},_0x9c287a,_0x74813c[_0x368c('0x4a')]);return db[_0x368c('0x35')][_0x368c('0x51')](_0x9c287a)[_0x368c('0x2f')](handleEntityNotFound(_0x1a06ac,null))[_0x368c('0x2f')](respondWithResult(_0x1a06ac,null))[_0x368c('0x4f')](handleError(_0x1a06ac,null));};exports[_0x368c('0x52')]=function(_0x2709e7,_0x324112){return db['WhatsappQueue'][_0x368c('0x52')](_0x2709e7[_0x368c('0x53')],{})[_0x368c('0x2f')](function(_0x3c4756){var _0x24d207=_0x2709e7[_0x368c('0x54')]['get']({'plain':!![]});if(!_0x24d207)throw new Error(_0x368c('0x55'));if(_0x24d207[_0x368c('0x56')]===_0x368c('0x54')){var _0x4511b8=_0x3c4756[_0x368c('0x31')]({'plain':!![]});var _0xbbff47='WhatsappQueues';return db[_0x368c('0x57')][_0x368c('0x51')]({'where':{'name':_0xbbff47,'userProfileId':_0x24d207[_0x368c('0x58')]},'raw':!![]})[_0x368c('0x2f')](function(_0x4e6b7b){if(_0x4e6b7b&&_0x4e6b7b[_0x368c('0x59')]===0x0){return db[_0x368c('0x5a')][_0x368c('0x52')]({'name':_0x4511b8['name'],'resourceId':_0x4511b8['id'],'type':_0x4e6b7b[_0x368c('0x33')],'sectionId':_0x4e6b7b['id']},{})[_0x368c('0x2f')](function(){return _0x3c4756;});}else{return _0x3c4756;}})[_0x368c('0x4f')](function(_0x5e621c){logger['error'](_0x368c('0x5b'),_0x5e621c);throw _0x5e621c;});}return _0x3c4756;})['then'](respondWithResult(_0x324112,0xc9))[_0x368c('0x4f')](handleError(_0x324112,null));};exports['update']=function(_0x586d3d,_0x1f817c){if(_0x586d3d[_0x368c('0x53')]['id']){delete _0x586d3d['body']['id'];}return db[_0x368c('0x35')][_0x368c('0x51')]({'where':{'id':_0x586d3d[_0x368c('0x50')]['id']}})[_0x368c('0x2f')](handleEntityNotFound(_0x1f817c,null))[_0x368c('0x2f')](saveUpdates(_0x586d3d['body'],null))['then'](respondWithResult(_0x1f817c,null))[_0x368c('0x4f')](handleError(_0x1f817c,null));};exports[_0x368c('0x30')]=function(_0x58cc8f,_0x14dc26){return db[_0x368c('0x35')][_0x368c('0x51')]({'where':{'id':_0x58cc8f[_0x368c('0x50')]['id']}})[_0x368c('0x2f')](handleEntityNotFound(_0x14dc26,null))[_0x368c('0x2f')](removeEntity(_0x14dc26,null))[_0x368c('0x4f')](handleError(_0x14dc26,null));};exports['describe']=function(_0x233b8d,_0x3603a5){return db[_0x368c('0x35')][_0x368c('0x5c')]()[_0x368c('0x2f')](respondWithResult(_0x3603a5,null))['catch'](handleError(_0x3603a5,null));};exports[_0x368c('0x5d')]=function(_0x4ba82a,_0x29f992,_0x2e7861){var _0x9af92b={'raw':!![],'where':{}},_0xf2943a={},_0x553659;return db[_0x368c('0x35')]['findOne']({'where':{'id':_0x4ba82a[_0x368c('0x50')]['id']}})[_0x368c('0x2f')](handleEntityNotFound(_0x29f992,null))[_0x368c('0x2f')](function(_0x12f085){if(_0x12f085){_0x553659=_0x12f085[_0x368c('0x31')]({'plain':!![]});_0xf2943a[_0x368c('0x39')]=_[_0x368c('0x3b')](db[_0x368c('0x5e')][_0x368c('0x36')]);_0xf2943a['query']=_['keys'](_0x4ba82a[_0x368c('0x3c')]);_0xf2943a[_0x368c('0x46')]=_[_0x368c('0x3d')](_0xf2943a[_0x368c('0x39')],_0xf2943a['query']);_0x9af92b[_0x368c('0x3e')]=_['intersection'](_0xf2943a[_0x368c('0x39')],qs[_0x368c('0x3f')](_0x4ba82a[_0x368c('0x3c')][_0x368c('0x3f')]));_0x9af92b[_0x368c('0x3e')]=_0x9af92b[_0x368c('0x3e')]['length']?_0x9af92b[_0x368c('0x3e')]:_0xf2943a[_0x368c('0x39')];if(!_0x4ba82a[_0x368c('0x3c')][_0x368c('0x41')](_0x368c('0x42'))){_0x9af92b['limit']=qs[_0x368c('0x28')](_0x4ba82a[_0x368c('0x3c')][_0x368c('0x28')]);_0x9af92b[_0x368c('0x26')]=qs['offset'](_0x4ba82a[_0x368c('0x3c')][_0x368c('0x26')]);}_0x9af92b[_0x368c('0x43')]=qs['sort'](_0x4ba82a['query'][_0x368c('0x44')]);_0x9af92b[_0x368c('0x48')]=qs[_0x368c('0x46')](_[_0x368c('0x45')](_0x4ba82a['query'],_0xf2943a[_0x368c('0x46')]));_0x9af92b[_0x368c('0x48')]['WhatsappQueueId']=_0x12f085['id'];if(_0x4ba82a['query'][_0x368c('0x47')]){_0x9af92b[_0x368c('0x48')]=_[_0x368c('0x49')](_0x9af92b[_0x368c('0x48')],{'$or':_['map'](_0x9af92b['attributes'],function(_0x47694e){var _0x265527={};_0x265527[_0x47694e]={'$like':'%'+_0x4ba82a['query'][_0x368c('0x47')]+'%'};return _0x265527;})});}_0x9af92b=_['merge']({},_0x9af92b,_0x4ba82a[_0x368c('0x4a')]);return db[_0x368c('0x5e')][_0x368c('0x4d')](_0x9af92b);}})[_0x368c('0x2f')](function(_0x2f2240){if(_0x2f2240){return db[_0x368c('0x5f')][_0x368c('0x60')]({'where':{'id':_['map'](_0x2f2240,'UserId'),'role':_0x368c('0x61')},'attributes':['id',_0x368c('0x33'),'whatsappPause','updatedAt',_0x368c('0x62')]});}})['then'](function(_0x333f5b){if(_0x333f5b){return{'count':_0x333f5b[_0x368c('0x29')],'rows':_[_0x368c('0x3a')](_0x333f5b[_0x368c('0x4e')],function(_0x40f7a6){return{'membername':_0x40f7a6['name'],'UserId':_0x40f7a6['id'],'queue_name':_0x553659[_0x368c('0x33')],'WhatsappQueueId':_0x553659['id'],'interface':util['format'](_0x368c('0x63'),_0x368c('0x64'),_0x40f7a6[_0x368c('0x33')]),'penalty':0x0,'paused':_0x40f7a6[_0x368c('0x65')],'createdAt':_0x40f7a6[_0x368c('0x62')],'updatedAt':_0x40f7a6[_0x368c('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x368c('0x2f')](respondWithFilteredResult(_0x29f992,_0x9af92b))[_0x368c('0x4f')](handleError(_0x29f992,null));};exports[_0x368c('0x67')]=function(_0x3518ec,_0x22afb6,_0x45b09a){var _0x52fa42={};var _0x279779={};var _0x4c1868;var _0x18ab5e;return db['WhatsappQueue'][_0x368c('0x68')]({'where':{'id':_0x3518ec[_0x368c('0x50')]['id']}})['then'](handleEntityNotFound(_0x22afb6,null))[_0x368c('0x2f')](function(_0x280ab1){if(_0x280ab1){_0x4c1868=_0x280ab1;_0x279779[_0x368c('0x39')]=_['keys'](db['Team'][_0x368c('0x36')]);_0x279779[_0x368c('0x3c')]=_[_0x368c('0x3b')](_0x3518ec[_0x368c('0x3c')]);_0x279779['filters']=_[_0x368c('0x3d')](_0x279779[_0x368c('0x39')],_0x279779['query']);_0x52fa42['attributes']=_['intersection'](_0x279779['model'],qs['fields'](_0x3518ec[_0x368c('0x3c')][_0x368c('0x3f')]));_0x52fa42['attributes']=_0x52fa42[_0x368c('0x3e')][_0x368c('0x40')]?_0x52fa42[_0x368c('0x3e')]:_0x279779[_0x368c('0x39')];_0x52fa42[_0x368c('0x43')]=qs[_0x368c('0x44')](_0x3518ec['query'][_0x368c('0x44')]);_0x52fa42[_0x368c('0x48')]=qs[_0x368c('0x46')](_[_0x368c('0x45')](_0x3518ec['query'],_0x279779[_0x368c('0x46')]));if(_0x3518ec[_0x368c('0x3c')][_0x368c('0x47')]){_0x52fa42[_0x368c('0x48')]=_['merge'](_0x52fa42[_0x368c('0x48')],{'$or':_[_0x368c('0x3a')](_0x52fa42[_0x368c('0x3e')],function(_0x37f032){var _0x1c13e5={};_0x1c13e5[_0x37f032]={'$like':'%'+_0x3518ec[_0x368c('0x3c')][_0x368c('0x47')]+'%'};return _0x1c13e5;})});}_0x52fa42=_[_0x368c('0x49')]({},_0x52fa42,_0x3518ec[_0x368c('0x4a')]);return _0x4c1868[_0x368c('0x67')](_0x52fa42);}})['then'](function(_0x146c02){if(_0x146c02){_0x18ab5e=_0x146c02['length'];if(!_0x3518ec[_0x368c('0x3c')][_0x368c('0x41')](_0x368c('0x42'))){_0x52fa42[_0x368c('0x28')]=qs[_0x368c('0x28')](_0x3518ec['query']['limit']);_0x52fa42[_0x368c('0x26')]=qs['offset'](_0x3518ec[_0x368c('0x3c')][_0x368c('0x26')]);}return _0x4c1868['getTeams'](_0x52fa42);}})[_0x368c('0x2f')](function(_0x350b49){if(_0x350b49){return _0x350b49?{'count':_0x18ab5e,'rows':_0x350b49}:null;}})['then'](respondWithResult(_0x22afb6,null))[_0x368c('0x4f')](handleError(_0x22afb6,null));};exports[_0x368c('0x69')]=function(_0x4faa42,_0x739433,_0x448c76){var _0x3a18fd=_0x4faa42[_0x368c('0x53')][_0x368c('0x6a')];return db[_0x368c('0x6b')][_0x368c('0x4d')]({'where':{'id':_0x3a18fd},'attributes':['id'],'include':[{'model':db[_0x368c('0x5f')],'as':_0x368c('0x6c'),'attributes':['id','name',_0x368c('0x6d'),_0x368c('0x6e'),'interface'],'raw':!![]}]})[_0x368c('0x2f')](function(_0x48b0f5){if(_0x48b0f5){var _0x2b3aa2=_[_0x368c('0x6f')](_0x48b0f5,function(_0x4ed5f7){var _0x17ad7f=_0x4ed5f7['get']({'plain':!![]});return _0x17ad7f['Agents'];});return db[_0x368c('0x35')]['find']({'where':{'id':_0x4faa42[_0x368c('0x50')]['id']}})['then'](function(_0x4b0da0){return db[_0x368c('0x70')]['transaction'](function(_0x59b1ea){return _0x4b0da0[_0x368c('0x69')](_0x3a18fd,{'transaction':_0x59b1ea})[_0x368c('0x2f')](function(){return BPromise[_0x368c('0x71')](_0x2b3aa2,function(_0x56b6f0){return db[_0x368c('0x5e')][_0x368c('0x72')]({'where':{'UserId':_0x56b6f0['id'],'WhatsappQueueId':_0x4faa42[_0x368c('0x50')]['id']},'transaction':_0x59b1ea});});})[_0x368c('0x2f')](function(){_0x2b3aa2['forEach'](function(_0x362130){socket[_0x368c('0x73')](_0x368c('0x74'),{'UserId':_0x362130['id'],'WhatsappQueueId':_0x4b0da0['id']});});});});});}})[_0x368c('0x2f')](respondWithStatusCode(_0x739433,null))['catch'](handleError(_0x739433,null));};exports[_0x368c('0x75')]=function(_0xa3751b,_0x364281,_0x55795b){return db['Team'][_0x368c('0x4d')]({'where':{'id':_0xa3751b['query'][_0x368c('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x368c('0x5f')],'as':_0x368c('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x368c('0x2f')](handleEntityNotFound(_0x364281,null))['then'](function(_0x4e4b7b){var _0x907d44=_['map'](_0x4e4b7b,'id');var _0x15ff9f=[];var _0x14ce22=[];var _0x239645=squel[_0x368c('0x76')]();_0x239645['field'](_0x368c('0x77'))[_0x368c('0x78')](_0x368c('0x79'),'tq')[_0x368c('0x7a')](_0x368c('0x7b'),'ut',_0x368c('0x7c'))['where'](_0x368c('0x7d'),_0xa3751b[_0x368c('0x50')]['id']);for(var _0x1865f1=0x0;_0x1865f1<_0x4e4b7b['length'];_0x1865f1+=0x1){let _0x42efcd=_0x4e4b7b[_0x1865f1];for(var _0x574902=0x0;_0x574902<_0x42efcd[_0x368c('0x6c')][_0x368c('0x40')];_0x574902+=0x1){let _0x21668e=_0x42efcd[_0x368c('0x6c')][_0x574902];var _0x4fa236=_0x239645['clone']();_0x4fa236[_0x368c('0x48')](_0x368c('0x7e'),_0x21668e['id']);_0x14ce22[_0x368c('0x7f')](db['sequelize'][_0x368c('0x3c')](_0x4fa236['toString'](),{'type':db[_0x368c('0x70')]['QueryTypes'][_0x368c('0x80')]})[_0x368c('0x2f')](function(_0x258cce){if(_0x258cce[_0x368c('0x40')]===0x1){return _0x21668e['id'];}else{var _0x151257=_[_0x368c('0x81')](_[_0x368c('0x3a')](_0x258cce,_0x368c('0x82')),function(_0x2ebab4){return _[_0x368c('0x83')](_0x907d44,_0x2ebab4);});if(_0x151257){return _0x21668e['id'];}}}));}}return BPromise[_0x368c('0x84')](_0x14ce22)['then'](function(_0x5b9e09){_0x15ff9f=_(_0x15ff9f)[_0x368c('0x85')](_0x5b9e09)[_0x368c('0x86')]()[_0x368c('0x87')]();return db[_0x368c('0x35')][_0x368c('0x51')]({'where':{'id':_0xa3751b[_0x368c('0x50')]['id']}})[_0x368c('0x2f')](function(_0x5bcfc1){return db[_0x368c('0x70')][_0x368c('0x88')](function(_0x1a190e){return _0x5bcfc1[_0x368c('0x75')](_0xa3751b[_0x368c('0x3c')][_0x368c('0x6a')],{'transaction':_0x1a190e})['then'](function(){if(!_[_0x368c('0x89')](_0x15ff9f)){return _0x5bcfc1['removeAgents'](_0x15ff9f,{'transaction':_0x1a190e});}})[_0x368c('0x2f')](function(){_0x15ff9f[_0x368c('0x8a')](function(_0x1a2882){socket['emit'](_0x368c('0x8b'),{'UserId':_0x1a2882,'WhatsappQueueId':_0x5bcfc1['id']});});});});});});})['then'](respondWithStatusCode(_0x364281,null))[_0x368c('0x4f')](handleError(_0x364281,null));};exports[_0x368c('0x8c')]=function(_0x5b5595,_0x3e994a,_0x400987){return db[_0x368c('0x35')][_0x368c('0x51')]({'where':{'id':_0x5b5595[_0x368c('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e994a,null))[_0x368c('0x2f')](function(_0x114ee7){if(_0x114ee7){return _0x114ee7['addAgents'](_0x5b5595[_0x368c('0x53')][_0x368c('0x6a')],_['omit'](_0x5b5595[_0x368c('0x53')],['ids','id'])||{})[_0x368c('0x8d')](function(_0x367d00){for(var _0xdb3598=0x0;_0xdb3598<_0x5b5595[_0x368c('0x53')][_0x368c('0x6a')][_0x368c('0x40')];_0xdb3598+=0x1){socket[_0x368c('0x73')](_0x368c('0x74'),{'UserId':Number(_0x5b5595[_0x368c('0x53')][_0x368c('0x6a')][_0xdb3598]),'WhatsappQueueId':Number(_0x5b5595[_0x368c('0x50')]['id'])});}return _0x367d00;});}})[_0x368c('0x2f')](respondWithResult(_0x3e994a,null))['catch'](handleError(_0x3e994a,null));};exports['removeAgents']=function(_0x3efa99,_0x37a18e,_0x26a25d){return db['WhatsappQueue'][_0x368c('0x51')]({'where':{'id':_0x3efa99[_0x368c('0x50')]['id']}})[_0x368c('0x2f')](handleEntityNotFound(_0x37a18e,null))['then'](function(_0x37d865){if(_0x37d865){return _0x37d865[_0x368c('0x8e')](_0x3efa99[_0x368c('0x3c')][_0x368c('0x6a')])[_0x368c('0x2f')](function(){if(_[_0x368c('0x8f')](_0x3efa99[_0x368c('0x3c')][_0x368c('0x6a')])){for(var _0x14778c=0x0;_0x14778c<_0x3efa99[_0x368c('0x3c')][_0x368c('0x6a')][_0x368c('0x40')];_0x14778c+=0x1){socket[_0x368c('0x73')](_0x368c('0x8b'),{'UserId':Number(_0x3efa99[_0x368c('0x3c')]['ids'][_0x14778c]),'WhatsappQueueId':Number(_0x3efa99[_0x368c('0x50')]['id'])});}}else{socket[_0x368c('0x73')](_0x368c('0x8b'),{'UserId':Number(_0x3efa99[_0x368c('0x3c')][_0x368c('0x6a')]),'WhatsappQueueId':Number(_0x3efa99[_0x368c('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x37a18e,null))[_0x368c('0x4f')](handleError(_0x37a18e,null));};exports['getAgents']=function(_0x1fd209,_0x2406ca,_0x1249f8){var _0x22c9ff={};var _0x5689a5={};var _0x2eda88;var _0x49f37c;return db[_0x368c('0x35')]['findOne']({'where':{'id':_0x1fd209[_0x368c('0x50')]['id']}})[_0x368c('0x2f')](handleEntityNotFound(_0x2406ca,null))[_0x368c('0x2f')](function(_0x4d1316){if(_0x4d1316){_0x2eda88=_0x4d1316;_0x5689a5[_0x368c('0x39')]=_['keys'](db[_0x368c('0x5f')][_0x368c('0x36')]);_0x5689a5['query']=_[_0x368c('0x3b')](_0x1fd209[_0x368c('0x3c')]);_0x5689a5[_0x368c('0x46')]=_[_0x368c('0x3d')](_0x5689a5[_0x368c('0x39')],_0x5689a5[_0x368c('0x3c')]);_0x22c9ff['attributes']=_['intersection'](_0x5689a5[_0x368c('0x39')],qs['fields'](_0x1fd209[_0x368c('0x3c')][_0x368c('0x3f')]));_0x22c9ff[_0x368c('0x3e')]=_0x22c9ff[_0x368c('0x3e')][_0x368c('0x40')]?_0x22c9ff['attributes']:_0x5689a5['model'];_0x22c9ff['order']=qs[_0x368c('0x44')](_0x1fd209[_0x368c('0x3c')][_0x368c('0x44')]);_0x22c9ff[_0x368c('0x48')]=qs['filters'](_[_0x368c('0x45')](_0x1fd209[_0x368c('0x3c')],_0x5689a5['filters']));if(_0x1fd209['query'][_0x368c('0x47')]){_0x22c9ff['where']=_[_0x368c('0x49')](_0x22c9ff[_0x368c('0x48')],{'$or':_['map'](_0x22c9ff[_0x368c('0x3e')],function(_0x8f7da3){var _0x2624d3={};_0x2624d3[_0x8f7da3]={'$like':'%'+_0x1fd209[_0x368c('0x3c')][_0x368c('0x47')]+'%'};return _0x2624d3;})});}_0x22c9ff=_[_0x368c('0x49')]({},_0x22c9ff,_0x1fd209['options']);return _0x2eda88[_0x368c('0x90')](_0x22c9ff);}})['then'](function(_0x1954c5){if(_0x1954c5){_0x49f37c=_0x1954c5[_0x368c('0x40')];if(!_0x1fd209['query'][_0x368c('0x41')](_0x368c('0x42'))){_0x22c9ff[_0x368c('0x28')]=qs['limit'](_0x1fd209['query'][_0x368c('0x28')]);_0x22c9ff[_0x368c('0x26')]=qs['offset'](_0x1fd209[_0x368c('0x3c')][_0x368c('0x26')]);}return _0x2eda88[_0x368c('0x90')](_0x22c9ff);}})['then'](function(_0x146ad3){if(_0x146ad3){return _0x146ad3?{'count':_0x49f37c,'rows':_0x146ad3}:null;}})[_0x368c('0x2f')](respondWithResult(_0x2406ca,null))[_0x368c('0x4f')](handleError(_0x2406ca,null));}; \ No newline at end of file +var _0x470a=['clone','QueryTypes','SELECT','TeamId','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','WhatsappQueues','UserProfileResource','destroy','end','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','whatsappPause','updatedAt','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?'];(function(_0x1bd230,_0x1da01e){var _0x19a3e3=function(_0x3cb9fa){while(--_0x3cb9fa){_0x1bd230['push'](_0x1bd230['shift']());}};_0x19a3e3(++_0x1da01e);}(_0x470a,0x9a));var _0xa470=function(_0x324f93,_0xec7e3b){_0x324f93=_0x324f93-0x0;var _0x1413d5=_0x470a[_0x324f93];return _0x1413d5;};'use strict';var emlformat=require(_0xa470('0x0'));var rimraf=require(_0xa470('0x1'));var zipdir=require(_0xa470('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa470('0x3'));var moment=require(_0xa470('0x4'));var BPromise=require(_0xa470('0x5'));var Mustache=require('mustache');var util=require(_0xa470('0x6'));var path=require(_0xa470('0x7'));var sox=require(_0xa470('0x8'));var csv=require(_0xa470('0x9'));var ejs=require(_0xa470('0xa'));var fs=require('fs');var fs_extra=require(_0xa470('0xb'));var _=require('lodash');var squel=require(_0xa470('0xc'));var crypto=require(_0xa470('0xd'));var jsforce=require(_0xa470('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa470('0x9'));var querystring=require(_0xa470('0xf'));var Papa=require('papaparse');var Redis=require(_0xa470('0x10'));var authService=require(_0xa470('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa470('0x12'));var logger=require(_0xa470('0x13'))(_0xa470('0x14'));var utils=require(_0xa470('0x15'));var config=require(_0xa470('0x16'));var licenseUtil=require(_0xa470('0x17'));var db=require(_0xa470('0x18'))['db'];config[_0xa470('0x19')]=_[_0xa470('0x1a')](config[_0xa470('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa470('0x19')]));require(_0xa470('0x1b'))[_0xa470('0x1c')](socket);function respondWithStatusCode(_0x525ca5,_0x38391a){_0x38391a=_0x38391a||0xcc;return function(_0x50982d){if(_0x50982d){return _0x525ca5[_0xa470('0x1d')](_0x38391a);}return _0x525ca5[_0xa470('0x1e')](_0x38391a)['end']();};}function respondWithResult(_0x21f8c3,_0x4d2026){_0x4d2026=_0x4d2026||0xc8;return function(_0x4454d0){if(_0x4454d0){return _0x21f8c3['status'](_0x4d2026)[_0xa470('0x1f')](_0x4454d0);}};}function respondWithFilteredResult(_0x201d5a,_0x3b99d1){return function(_0x34cb20){if(_0x34cb20){var _0x119ade=typeof _0x3b99d1[_0xa470('0x20')]===_0xa470('0x21')&&typeof _0x3b99d1['limit']==='undefined';var _0x340c48=_0x34cb20[_0xa470('0x22')];var _0x218736=_0x119ade?0x0:_0x3b99d1['offset'];var _0xdbd4c9=_0x119ade?_0x34cb20[_0xa470('0x22')]:_0x3b99d1[_0xa470('0x20')]+_0x3b99d1[_0xa470('0x23')];var _0x158994;if(_0xdbd4c9>=_0x340c48){_0xdbd4c9=_0x340c48;_0x158994=0xc8;}else{_0x158994=0xce;}_0x201d5a[_0xa470('0x1e')](_0x158994);return _0x201d5a[_0xa470('0x24')](_0xa470('0x25'),_0x218736+'-'+_0xdbd4c9+'/'+_0x340c48)['json'](_0x34cb20);}return null;};}function patchUpdates(_0x576930){return function(_0x12fdeb){try{jsonpatch['apply'](_0x12fdeb,_0x576930,!![]);}catch(_0x524125){return BPromise[_0xa470('0x26')](_0x524125);}return _0x12fdeb[_0xa470('0x27')]();};}function saveUpdates(_0x51cab7,_0x295ed6){return function(_0x3d9330){if(_0x3d9330){return _0x3d9330[_0xa470('0x28')](_0x51cab7)[_0xa470('0x29')](function(_0x5ecce1){return _0x5ecce1;});}return null;};}function removeEntity(_0x25f020,_0x3c14b0){return function(_0x19cc9e){if(_0x19cc9e){return _0x19cc9e['destroy']()[_0xa470('0x29')](function(){var _0x354644=_0x19cc9e[_0xa470('0x2a')]({'plain':!![]});var _0x4ffe92=_0xa470('0x2b');return db[_0xa470('0x2c')][_0xa470('0x2d')]({'where':{'type':_0x4ffe92,'resourceId':_0x354644['id']}})[_0xa470('0x29')](function(){return _0x19cc9e;});})['then'](function(){_0x25f020[_0xa470('0x1e')](0xcc)[_0xa470('0x2e')]();});}};}function handleEntityNotFound(_0x1034e6,_0x421769){return function(_0x352658){if(!_0x352658){_0x1034e6[_0xa470('0x1d')](0x194);}return _0x352658;};}function handleError(_0x56bba8,_0x1bfd8e){_0x1bfd8e=_0x1bfd8e||0x1f4;return function(_0x14e9f4){logger[_0xa470('0x2f')](_0x14e9f4[_0xa470('0x30')]);if(_0x14e9f4[_0xa470('0x31')]){delete _0x14e9f4[_0xa470('0x31')];}_0x56bba8[_0xa470('0x1e')](_0x1bfd8e)[_0xa470('0x32')](_0x14e9f4);};}exports['index']=function(_0x23282a,_0x3680a3){var _0x40cca0={},_0x4c27f2={},_0xaee49c={'count':0x0,'rows':[]};var _0x5dd939=_[_0xa470('0x33')](db[_0xa470('0x34')][_0xa470('0x35')],function(_0x182a91){return{'name':_0x182a91[_0xa470('0x36')],'type':_0x182a91[_0xa470('0x37')]['key']};});_0x4c27f2[_0xa470('0x38')]=_[_0xa470('0x33')](_0x5dd939,'name');_0x4c27f2[_0xa470('0x39')]=_['keys'](_0x23282a[_0xa470('0x39')]);_0x4c27f2[_0xa470('0x3a')]=_[_0xa470('0x3b')](_0x4c27f2['model'],_0x4c27f2[_0xa470('0x39')]);_0x40cca0[_0xa470('0x3c')]=_['intersection'](_0x4c27f2[_0xa470('0x38')],qs[_0xa470('0x3d')](_0x23282a[_0xa470('0x39')][_0xa470('0x3d')]));_0x40cca0[_0xa470('0x3c')]=_0x40cca0['attributes']['length']?_0x40cca0[_0xa470('0x3c')]:_0x4c27f2[_0xa470('0x38')];if(!_0x23282a['query'][_0xa470('0x3e')]('nolimit')){_0x40cca0[_0xa470('0x23')]=qs[_0xa470('0x23')](_0x23282a[_0xa470('0x39')][_0xa470('0x23')]);_0x40cca0[_0xa470('0x20')]=qs[_0xa470('0x20')](_0x23282a[_0xa470('0x39')]['offset']);}_0x40cca0[_0xa470('0x3f')]=qs['sort'](_0x23282a['query'][_0xa470('0x40')]);_0x40cca0['where']=qs[_0xa470('0x3a')](_[_0xa470('0x41')](_0x23282a['query'],_0x4c27f2[_0xa470('0x3a')]),_0x5dd939);if(_0x23282a[_0xa470('0x39')][_0xa470('0x42')]){_0x40cca0[_0xa470('0x43')]=_[_0xa470('0x44')](_0x40cca0[_0xa470('0x43')],{'$or':_[_0xa470('0x33')](_0x5dd939,function(_0x593550){if(_0x593550[_0xa470('0x37')]!=='VIRTUAL'){var _0x5efbb8={};_0x5efbb8[_0x593550[_0xa470('0x31')]]={'$like':'%'+_0x23282a[_0xa470('0x39')]['filter']+'%'};return _0x5efbb8;}})});}_0x40cca0=_['merge']({},_0x40cca0,_0x23282a[_0xa470('0x45')]);var _0x4c61f9={'where':_0x40cca0[_0xa470('0x43')]};return db[_0xa470('0x34')][_0xa470('0x22')](_0x4c61f9)[_0xa470('0x29')](function(_0x3a8fe0){_0xaee49c[_0xa470('0x22')]=_0x3a8fe0;if(_0x23282a[_0xa470('0x39')][_0xa470('0x46')]){_0x40cca0[_0xa470('0x47')]=[{'all':!![]}];}return db[_0xa470('0x34')][_0xa470('0x48')](_0x40cca0);})['then'](function(_0x6937e8){_0xaee49c[_0xa470('0x49')]=_0x6937e8;return _0xaee49c;})['then'](respondWithFilteredResult(_0x3680a3,_0x40cca0))[_0xa470('0x4a')](handleError(_0x3680a3,null));};exports[_0xa470('0x4b')]=function(_0x83514f,_0x193750){var _0x5316fa={'raw':!![],'where':{'id':_0x83514f[_0xa470('0x4c')]['id']}},_0x2c9f6e={};_0x2c9f6e[_0xa470('0x38')]=_['keys'](db[_0xa470('0x34')][_0xa470('0x35')]);_0x2c9f6e['query']=_[_0xa470('0x4d')](_0x83514f['query']);_0x2c9f6e[_0xa470('0x3a')]=_[_0xa470('0x3b')](_0x2c9f6e[_0xa470('0x38')],_0x2c9f6e['query']);_0x5316fa[_0xa470('0x3c')]=_[_0xa470('0x3b')](_0x2c9f6e[_0xa470('0x38')],qs['fields'](_0x83514f[_0xa470('0x39')][_0xa470('0x3d')]));_0x5316fa[_0xa470('0x3c')]=_0x5316fa[_0xa470('0x3c')][_0xa470('0x4e')]?_0x5316fa['attributes']:_0x2c9f6e[_0xa470('0x38')];if(_0x83514f['query'][_0xa470('0x46')]){_0x5316fa[_0xa470('0x47')]=[{'all':!![]}];}_0x5316fa=_[_0xa470('0x44')]({},_0x5316fa,_0x83514f[_0xa470('0x45')]);return db[_0xa470('0x34')][_0xa470('0x4f')](_0x5316fa)[_0xa470('0x29')](handleEntityNotFound(_0x193750,null))[_0xa470('0x29')](respondWithResult(_0x193750,null))[_0xa470('0x4a')](handleError(_0x193750,null));};exports[_0xa470('0x50')]=function(_0x4ff76c,_0x30a0a7){return db['WhatsappQueue'][_0xa470('0x50')](_0x4ff76c[_0xa470('0x51')],{})['then'](function(_0x21efd9){var _0x5c9af6=_0x4ff76c[_0xa470('0x52')][_0xa470('0x2a')]({'plain':!![]});if(!_0x5c9af6)throw new Error(_0xa470('0x53'));if(_0x5c9af6['role']===_0xa470('0x52')){var _0x25b578=_0x21efd9[_0xa470('0x2a')]({'plain':!![]});var _0x552dcc=_0xa470('0x2b');return db[_0xa470('0x54')][_0xa470('0x4f')]({'where':{'name':_0x552dcc,'userProfileId':_0x5c9af6['userProfileId']},'raw':!![]})['then'](function(_0x454048){if(_0x454048&&_0x454048[_0xa470('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x25b578[_0xa470('0x31')],'resourceId':_0x25b578['id'],'type':_0x454048[_0xa470('0x31')],'sectionId':_0x454048['id']},{})[_0xa470('0x29')](function(){return _0x21efd9;});}else{return _0x21efd9;}})[_0xa470('0x4a')](function(_0x54ac3d){logger['error'](_0xa470('0x56'),_0x54ac3d);throw _0x54ac3d;});}return _0x21efd9;})[_0xa470('0x29')](respondWithResult(_0x30a0a7,0xc9))[_0xa470('0x4a')](handleError(_0x30a0a7,null));};exports[_0xa470('0x28')]=function(_0x23299a,_0x3a933f){if(_0x23299a['body']['id']){delete _0x23299a['body']['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x23299a[_0xa470('0x4c')]['id']}})[_0xa470('0x29')](handleEntityNotFound(_0x3a933f,null))[_0xa470('0x29')](saveUpdates(_0x23299a[_0xa470('0x51')],null))[_0xa470('0x29')](respondWithResult(_0x3a933f,null))[_0xa470('0x4a')](handleError(_0x3a933f,null));};exports[_0xa470('0x2d')]=function(_0x3c1cd3,_0x3bc7f8){return db[_0xa470('0x34')][_0xa470('0x4f')]({'where':{'id':_0x3c1cd3['params']['id']}})[_0xa470('0x29')](handleEntityNotFound(_0x3bc7f8,null))['then'](removeEntity(_0x3bc7f8,null))[_0xa470('0x4a')](handleError(_0x3bc7f8,null));};exports[_0xa470('0x57')]=function(_0xe80271,_0x291569){return db[_0xa470('0x34')][_0xa470('0x57')]()[_0xa470('0x29')](respondWithResult(_0x291569,null))[_0xa470('0x4a')](handleError(_0x291569,null));};exports[_0xa470('0x58')]=function(_0xa5fd5e,_0x1f3486,_0x1bb67a){var _0x4e1537={'raw':!![],'where':{}},_0x3414ed={},_0x5f6f7b;return db[_0xa470('0x34')][_0xa470('0x59')]({'where':{'id':_0xa5fd5e[_0xa470('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f3486,null))['then'](function(_0x4b2262){if(_0x4b2262){_0x5f6f7b=_0x4b2262['get']({'plain':!![]});_0x3414ed[_0xa470('0x38')]=_['keys'](db['UserWhatsappQueue'][_0xa470('0x35')]);_0x3414ed['query']=_[_0xa470('0x4d')](_0xa5fd5e['query']);_0x3414ed[_0xa470('0x3a')]=_[_0xa470('0x3b')](_0x3414ed[_0xa470('0x38')],_0x3414ed[_0xa470('0x39')]);_0x4e1537['attributes']=_[_0xa470('0x3b')](_0x3414ed[_0xa470('0x38')],qs[_0xa470('0x3d')](_0xa5fd5e[_0xa470('0x39')][_0xa470('0x3d')]));_0x4e1537[_0xa470('0x3c')]=_0x4e1537['attributes'][_0xa470('0x4e')]?_0x4e1537[_0xa470('0x3c')]:_0x3414ed['model'];if(!_0xa5fd5e['query'][_0xa470('0x3e')](_0xa470('0x5a'))){_0x4e1537[_0xa470('0x23')]=qs[_0xa470('0x23')](_0xa5fd5e[_0xa470('0x39')][_0xa470('0x23')]);_0x4e1537[_0xa470('0x20')]=qs[_0xa470('0x20')](_0xa5fd5e[_0xa470('0x39')][_0xa470('0x20')]);}_0x4e1537[_0xa470('0x3f')]=qs[_0xa470('0x40')](_0xa5fd5e['query'][_0xa470('0x40')]);_0x4e1537[_0xa470('0x43')]=qs[_0xa470('0x3a')](_['pick'](_0xa5fd5e[_0xa470('0x39')],_0x3414ed[_0xa470('0x3a')]));_0x4e1537[_0xa470('0x43')][_0xa470('0x5b')]=_0x4b2262['id'];if(_0xa5fd5e[_0xa470('0x39')][_0xa470('0x42')]){_0x4e1537['where']=_[_0xa470('0x44')](_0x4e1537[_0xa470('0x43')],{'$or':_['map'](_0x4e1537['attributes'],function(_0xf8ae0a){var _0x579ffe={};_0x579ffe[_0xf8ae0a]={'$like':'%'+_0xa5fd5e[_0xa470('0x39')][_0xa470('0x42')]+'%'};return _0x579ffe;})});}_0x4e1537=_[_0xa470('0x44')]({},_0x4e1537,_0xa5fd5e[_0xa470('0x45')]);return db[_0xa470('0x5c')][_0xa470('0x48')](_0x4e1537);}})[_0xa470('0x29')](function(_0x335789){if(_0x335789){return db[_0xa470('0x5d')][_0xa470('0x5e')]({'where':{'id':_['map'](_0x335789,_0xa470('0x5f')),'role':'agent'},'attributes':['id','name',_0xa470('0x60'),_0xa470('0x61'),'createdAt']});}})[_0xa470('0x29')](function(_0x36439a){if(_0x36439a){return{'count':_0x36439a[_0xa470('0x22')],'rows':_['map'](_0x36439a[_0xa470('0x49')],function(_0x13fdc6){return{'membername':_0x13fdc6['name'],'UserId':_0x13fdc6['id'],'queue_name':_0x5f6f7b[_0xa470('0x31')],'WhatsappQueueId':_0x5f6f7b['id'],'interface':util['format'](_0xa470('0x62'),_0xa470('0x63'),_0x13fdc6[_0xa470('0x31')]),'penalty':0x0,'paused':_0x13fdc6[_0xa470('0x60')],'createdAt':_0x13fdc6[_0xa470('0x64')],'updatedAt':_0x13fdc6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1f3486,_0x4e1537))[_0xa470('0x4a')](handleError(_0x1f3486,null));};exports[_0xa470('0x65')]=function(_0x18b004,_0x2cd02f,_0x25f83c){var _0x1240ba={};var _0x108dbf={};var _0x5aee3a;var _0x5b1578;return db[_0xa470('0x34')][_0xa470('0x59')]({'where':{'id':_0x18b004[_0xa470('0x4c')]['id']}})[_0xa470('0x29')](handleEntityNotFound(_0x2cd02f,null))[_0xa470('0x29')](function(_0x492192){if(_0x492192){_0x5aee3a=_0x492192;_0x108dbf[_0xa470('0x38')]=_[_0xa470('0x4d')](db[_0xa470('0x66')][_0xa470('0x35')]);_0x108dbf[_0xa470('0x39')]=_[_0xa470('0x4d')](_0x18b004[_0xa470('0x39')]);_0x108dbf['filters']=_[_0xa470('0x3b')](_0x108dbf[_0xa470('0x38')],_0x108dbf[_0xa470('0x39')]);_0x1240ba[_0xa470('0x3c')]=_[_0xa470('0x3b')](_0x108dbf[_0xa470('0x38')],qs[_0xa470('0x3d')](_0x18b004[_0xa470('0x39')]['fields']));_0x1240ba[_0xa470('0x3c')]=_0x1240ba['attributes'][_0xa470('0x4e')]?_0x1240ba[_0xa470('0x3c')]:_0x108dbf[_0xa470('0x38')];_0x1240ba['order']=qs[_0xa470('0x40')](_0x18b004[_0xa470('0x39')][_0xa470('0x40')]);_0x1240ba[_0xa470('0x43')]=qs[_0xa470('0x3a')](_[_0xa470('0x41')](_0x18b004[_0xa470('0x39')],_0x108dbf['filters']));if(_0x18b004[_0xa470('0x39')][_0xa470('0x42')]){_0x1240ba[_0xa470('0x43')]=_['merge'](_0x1240ba[_0xa470('0x43')],{'$or':_['map'](_0x1240ba[_0xa470('0x3c')],function(_0x3b1a91){var _0xaf7935={};_0xaf7935[_0x3b1a91]={'$like':'%'+_0x18b004[_0xa470('0x39')][_0xa470('0x42')]+'%'};return _0xaf7935;})});}_0x1240ba=_[_0xa470('0x44')]({},_0x1240ba,_0x18b004['options']);return _0x5aee3a['getTeams'](_0x1240ba);}})[_0xa470('0x29')](function(_0x9ddf7f){if(_0x9ddf7f){_0x5b1578=_0x9ddf7f[_0xa470('0x4e')];if(!_0x18b004[_0xa470('0x39')][_0xa470('0x3e')]('nolimit')){_0x1240ba[_0xa470('0x23')]=qs[_0xa470('0x23')](_0x18b004[_0xa470('0x39')][_0xa470('0x23')]);_0x1240ba[_0xa470('0x20')]=qs[_0xa470('0x20')](_0x18b004[_0xa470('0x39')][_0xa470('0x20')]);}return _0x5aee3a[_0xa470('0x65')](_0x1240ba);}})['then'](function(_0x141c25){if(_0x141c25){return _0x141c25?{'count':_0x5b1578,'rows':_0x141c25}:null;}})['then'](respondWithResult(_0x2cd02f,null))[_0xa470('0x4a')](handleError(_0x2cd02f,null));};exports[_0xa470('0x67')]=function(_0x220e7b,_0x370483,_0x142228){var _0x38d5b4=_0x220e7b['body'][_0xa470('0x68')];return db['Team'][_0xa470('0x48')]({'where':{'id':_0x38d5b4},'attributes':['id'],'include':[{'model':db[_0xa470('0x5d')],'as':_0xa470('0x69'),'attributes':['id','name',_0xa470('0x6a'),_0xa470('0x6b'),_0xa470('0x6c')],'raw':!![]}]})['then'](function(_0x1c02fa){if(_0x1c02fa){var _0x452ded=_[_0xa470('0x6d')](_0x1c02fa,function(_0x375b23){var _0x34ad21=_0x375b23['get']({'plain':!![]});return _0x34ad21['Agents'];});return db[_0xa470('0x34')][_0xa470('0x4f')]({'where':{'id':_0x220e7b[_0xa470('0x4c')]['id']}})[_0xa470('0x29')](function(_0x12b6ca){return db[_0xa470('0x6e')][_0xa470('0x6f')](function(_0x50fae9){return _0x12b6ca[_0xa470('0x67')](_0x38d5b4,{'transaction':_0x50fae9})[_0xa470('0x29')](function(){return BPromise[_0xa470('0x70')](_0x452ded,function(_0x19149f){return db['UserWhatsappQueue'][_0xa470('0x71')]({'where':{'UserId':_0x19149f['id'],'WhatsappQueueId':_0x220e7b[_0xa470('0x4c')]['id']},'transaction':_0x50fae9});});})[_0xa470('0x29')](function(){_0x452ded[_0xa470('0x72')](function(_0x189f3f){socket[_0xa470('0x73')](_0xa470('0x74'),{'UserId':_0x189f3f['id'],'WhatsappQueueId':_0x12b6ca['id']});});});});});}})[_0xa470('0x29')](respondWithStatusCode(_0x370483,null))[_0xa470('0x4a')](handleError(_0x370483,null));};exports[_0xa470('0x75')]=function(_0x59aaac,_0x5b9556,_0x505a18){return db['Team'][_0xa470('0x48')]({'where':{'id':_0x59aaac[_0xa470('0x39')][_0xa470('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa470('0x5d')],'as':_0xa470('0x69'),'attributes':['id'],'raw':!![]}]})[_0xa470('0x29')](handleEntityNotFound(_0x5b9556,null))[_0xa470('0x29')](function(_0x5626a1){var _0x140032=_[_0xa470('0x33')](_0x5626a1,'id');var _0x2188ca=[];var _0xbaabc4=[];var _0x5ba3b8=squel[_0xa470('0x76')]();_0x5ba3b8[_0xa470('0x77')](_0xa470('0x78'))[_0xa470('0x79')](_0xa470('0x7a'),'tq')[_0xa470('0x7b')](_0xa470('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xa470('0x7d'),_0x59aaac[_0xa470('0x4c')]['id']);for(var _0x11cd1b=0x0;_0x11cd1b<_0x5626a1['length'];_0x11cd1b+=0x1){let _0x48a458=_0x5626a1[_0x11cd1b];for(var _0x5401a7=0x0;_0x5401a7<_0x48a458['Agents']['length'];_0x5401a7+=0x1){let _0x21ca5e=_0x48a458[_0xa470('0x69')][_0x5401a7];var _0x302533=_0x5ba3b8[_0xa470('0x7e')]();_0x302533['where']('ut.UserId\x20=\x20?',_0x21ca5e['id']);_0xbaabc4['push'](db[_0xa470('0x6e')][_0xa470('0x39')](_0x302533['toString'](),{'type':db[_0xa470('0x6e')][_0xa470('0x7f')][_0xa470('0x80')]})[_0xa470('0x29')](function(_0x6041f6){if(_0x6041f6[_0xa470('0x4e')]===0x1){return _0x21ca5e['id'];}else{var _0x329f82=_['every'](_['map'](_0x6041f6,_0xa470('0x81')),function(_0x3a74ca){return _['includes'](_0x140032,_0x3a74ca);});if(_0x329f82){return _0x21ca5e['id'];}}}));}}return BPromise['all'](_0xbaabc4)[_0xa470('0x29')](function(_0x2f043e){_0x2188ca=_(_0x2188ca)[_0xa470('0x82')](_0x2f043e)[_0xa470('0x83')]()['value']();return db[_0xa470('0x34')][_0xa470('0x4f')]({'where':{'id':_0x59aaac[_0xa470('0x4c')]['id']}})['then'](function(_0x2e1ad1){return db[_0xa470('0x6e')][_0xa470('0x6f')](function(_0x578840){return _0x2e1ad1[_0xa470('0x75')](_0x59aaac[_0xa470('0x39')][_0xa470('0x68')],{'transaction':_0x578840})['then'](function(){if(!_[_0xa470('0x84')](_0x2188ca)){return _0x2e1ad1[_0xa470('0x85')](_0x2188ca,{'transaction':_0x578840});}})[_0xa470('0x29')](function(){_0x2188ca[_0xa470('0x72')](function(_0x330cb6){socket[_0xa470('0x73')](_0xa470('0x86'),{'UserId':_0x330cb6,'WhatsappQueueId':_0x2e1ad1['id']});});});});});});})[_0xa470('0x29')](respondWithStatusCode(_0x5b9556,null))[_0xa470('0x4a')](handleError(_0x5b9556,null));};exports['addAgents']=function(_0x48d45a,_0x43c0e0,_0x5f17fc){return db[_0xa470('0x34')][_0xa470('0x4f')]({'where':{'id':_0x48d45a[_0xa470('0x4c')]['id']}})[_0xa470('0x29')](handleEntityNotFound(_0x43c0e0,null))[_0xa470('0x29')](function(_0xc6f54c){if(_0xc6f54c){return _0xc6f54c[_0xa470('0x87')](_0x48d45a[_0xa470('0x51')]['ids'],_[_0xa470('0x88')](_0x48d45a[_0xa470('0x51')],['ids','id'])||{})[_0xa470('0x89')](function(_0x182fc3){for(var _0x3ee67f=0x0;_0x3ee67f<_0x48d45a[_0xa470('0x51')]['ids'][_0xa470('0x4e')];_0x3ee67f+=0x1){socket[_0xa470('0x73')](_0xa470('0x74'),{'UserId':Number(_0x48d45a[_0xa470('0x51')][_0xa470('0x68')][_0x3ee67f]),'WhatsappQueueId':Number(_0x48d45a['params']['id'])});}return _0x182fc3;});}})[_0xa470('0x29')](respondWithResult(_0x43c0e0,null))[_0xa470('0x4a')](handleError(_0x43c0e0,null));};exports[_0xa470('0x85')]=function(_0x5aae65,_0x2aa65c,_0x1788e9){return db[_0xa470('0x34')][_0xa470('0x4f')]({'where':{'id':_0x5aae65[_0xa470('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2aa65c,null))[_0xa470('0x29')](function(_0x2bd80f){if(_0x2bd80f){return _0x2bd80f[_0xa470('0x85')](_0x5aae65['query']['ids'])[_0xa470('0x29')](function(){if(_[_0xa470('0x8a')](_0x5aae65[_0xa470('0x39')][_0xa470('0x68')])){for(var _0x163e5d=0x0;_0x163e5d<_0x5aae65[_0xa470('0x39')][_0xa470('0x68')][_0xa470('0x4e')];_0x163e5d+=0x1){socket['emit'](_0xa470('0x86'),{'UserId':Number(_0x5aae65['query'][_0xa470('0x68')][_0x163e5d]),'WhatsappQueueId':Number(_0x5aae65[_0xa470('0x4c')]['id'])});}}else{socket['emit'](_0xa470('0x86'),{'UserId':Number(_0x5aae65[_0xa470('0x39')]['ids']),'WhatsappQueueId':Number(_0x5aae65[_0xa470('0x4c')]['id'])});}});}})[_0xa470('0x29')](respondWithStatusCode(_0x2aa65c,null))[_0xa470('0x4a')](handleError(_0x2aa65c,null));};exports['getAgents']=function(_0x11cd0d,_0x264b04,_0x18dc0f){var _0x9e615c={};var _0x2e8e20={};var _0x3df4eb;var _0xc0be17;return db['WhatsappQueue'][_0xa470('0x59')]({'where':{'id':_0x11cd0d[_0xa470('0x4c')]['id']}})[_0xa470('0x29')](handleEntityNotFound(_0x264b04,null))[_0xa470('0x29')](function(_0x9f3442){if(_0x9f3442){_0x3df4eb=_0x9f3442;_0x2e8e20[_0xa470('0x38')]=_[_0xa470('0x4d')](db[_0xa470('0x5d')][_0xa470('0x35')]);_0x2e8e20['query']=_['keys'](_0x11cd0d[_0xa470('0x39')]);_0x2e8e20[_0xa470('0x3a')]=_[_0xa470('0x3b')](_0x2e8e20['model'],_0x2e8e20[_0xa470('0x39')]);_0x9e615c[_0xa470('0x3c')]=_[_0xa470('0x3b')](_0x2e8e20[_0xa470('0x38')],qs['fields'](_0x11cd0d[_0xa470('0x39')][_0xa470('0x3d')]));_0x9e615c[_0xa470('0x3c')]=_0x9e615c[_0xa470('0x3c')][_0xa470('0x4e')]?_0x9e615c[_0xa470('0x3c')]:_0x2e8e20[_0xa470('0x38')];_0x9e615c['order']=qs[_0xa470('0x40')](_0x11cd0d[_0xa470('0x39')][_0xa470('0x40')]);_0x9e615c[_0xa470('0x43')]=qs[_0xa470('0x3a')](_[_0xa470('0x41')](_0x11cd0d['query'],_0x2e8e20[_0xa470('0x3a')]));if(_0x11cd0d[_0xa470('0x39')][_0xa470('0x42')]){_0x9e615c[_0xa470('0x43')]=_[_0xa470('0x44')](_0x9e615c[_0xa470('0x43')],{'$or':_[_0xa470('0x33')](_0x9e615c[_0xa470('0x3c')],function(_0x107b8d){var _0x46919d={};_0x46919d[_0x107b8d]={'$like':'%'+_0x11cd0d[_0xa470('0x39')][_0xa470('0x42')]+'%'};return _0x46919d;})});}_0x9e615c=_[_0xa470('0x44')]({},_0x9e615c,_0x11cd0d[_0xa470('0x45')]);return _0x3df4eb[_0xa470('0x8b')](_0x9e615c);}})['then'](function(_0x4a5708){if(_0x4a5708){_0xc0be17=_0x4a5708[_0xa470('0x4e')];if(!_0x11cd0d[_0xa470('0x39')][_0xa470('0x3e')](_0xa470('0x5a'))){_0x9e615c[_0xa470('0x23')]=qs[_0xa470('0x23')](_0x11cd0d[_0xa470('0x39')][_0xa470('0x23')]);_0x9e615c[_0xa470('0x20')]=qs[_0xa470('0x20')](_0x11cd0d['query']['offset']);}return _0x3df4eb[_0xa470('0x8b')](_0x9e615c);}})[_0xa470('0x29')](function(_0x1d6a7e){if(_0x1d6a7e){return _0x1d6a7e?{'count':_0xc0be17,'rows':_0x1d6a7e}:null;}})[_0xa470('0x29')](respondWithResult(_0x264b04,null))[_0xa470('0x4a')](handleError(_0x264b04,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f4549c4..a56facb 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 _0x318f=['save','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x181b4c,_0x1265bc){var _0x2b8ebb=function(_0x4370de){while(--_0x4370de){_0x181b4c['push'](_0x181b4c['shift']());}};_0x2b8ebb(++_0x1265bc);}(_0x318f,0xac));var _0xf318=function(_0x594b66,_0x2e2bd2){_0x594b66=_0x594b66-0x0;var _0x5a6e57=_0x318f[_0x594b66];return _0x5a6e57;};'use strict';var EventEmitter=require(_0xf318('0x0'));var WhatsappQueue=require(_0xf318('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf318('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4bb2e7){return function(_0x43c688,_0x155ba7,_0x2f9149){WhatsappQueueEvents['emit'](_0x4bb2e7+':'+_0x43c688['id'],_0x43c688);WhatsappQueueEvents[_0xf318('0x3')](_0x4bb2e7,_0x43c688);_0x2f9149(null);};}for(var e in events){if(events[_0xf318('0x4')](e)){var event=events[e];WhatsappQueue[_0xf318('0x5')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x4d38=['WhatsappQueue','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0xa07e87,_0x5bd080){var _0x50cce7=function(_0x4ef544){while(--_0x4ef544){_0xa07e87['push'](_0xa07e87['shift']());}};_0x50cce7(++_0x5bd080);}(_0x4d38,0xb7));var _0x84d3=function(_0x42e8f3,_0x5c8dba){_0x42e8f3=_0x42e8f3-0x0;var _0x47feab=_0x4d38[_0x42e8f3];return _0x47feab;};'use strict';var EventEmitter=require(_0x84d3('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x84d3('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x84d3('0x2')](0x0);var events={'afterCreate':_0x84d3('0x3'),'afterUpdate':_0x84d3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x491b0c){return function(_0x488f4e,_0x4f6528,_0x5e5336){WhatsappQueueEvents[_0x84d3('0x5')](_0x491b0c+':'+_0x488f4e['id'],_0x488f4e);WhatsappQueueEvents[_0x84d3('0x5')](_0x491b0c,_0x488f4e);_0x5e5336(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x84d3('0x6')](e,emitEvent(event));}}module[_0x84d3('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 33b042e..ee419ff 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 _0x6e6a=['WhatsappQueue','whatsapp_queues','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define'];(function(_0x197cac,_0x1af986){var _0x4a076c=function(_0x568a2c){while(--_0x568a2c){_0x197cac['push'](_0x197cac['shift']());}};_0x4a076c(++_0x1af986);}(_0x6e6a,0xfc));var _0xa6e6=function(_0xd75522,_0x36ae5d){_0xd75522=_0xd75522-0x0;var _0x135eb9=_0x6e6a[_0xd75522];return _0x135eb9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa6e6('0x0'));var moment=require(_0xa6e6('0x1'));var BPromise=require('bluebird');var rp=require(_0xa6e6('0x2'));var fs=require('fs');var path=require(_0xa6e6('0x3'));var rimraf=require(_0xa6e6('0x4'));var config=require(_0xa6e6('0x5'));var attributes=require(_0xa6e6('0x6'));module['exports']=function(_0x362666,_0x514dac){return _0x362666[_0xa6e6('0x7')](_0xa6e6('0x8'),attributes,{'tableName':_0xa6e6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8043=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash'];(function(_0x513a55,_0x46afcf){var _0x431dc3=function(_0x255b1e){while(--_0x255b1e){_0x513a55['push'](_0x513a55['shift']());}};_0x431dc3(++_0x46afcf);}(_0x8043,0x195));var _0x3804=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x8043[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x3804('0x0'));var util=require(_0x3804('0x1'));var logger=require(_0x3804('0x2'))(_0x3804('0x3'));var moment=require(_0x3804('0x4'));var BPromise=require(_0x3804('0x5'));var rp=require(_0x3804('0x6'));var fs=require('fs');var path=require(_0x3804('0x7'));var rimraf=require(_0x3804('0x8'));var config=require(_0x3804('0x9'));var attributes=require(_0x3804('0xa'));module[_0x3804('0xb')]=function(_0x3eaa7f,_0x5bf3d6){return _0x3eaa7f[_0x3804('0xc')](_0x3804('0xd'),attributes,{'tableName':'whatsapp_queues','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 6603ec8..e688d3a 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 _0x4ba6=['find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','WhatsappQueue,\x20%s,\x20%s','message','catch','WhatsappQueue','raw','options','where','attributes','limit','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0x4ba6,0x7c));var _0x64ba=function(_0x5cef48,_0x4f4b95){_0x5cef48=_0x5cef48-0x0;var _0x2486c6=_0x4ba6[_0x5cef48];return _0x2486c6;};'use strict';var _=require(_0x64ba('0x0'));var util=require(_0x64ba('0x1'));var moment=require(_0x64ba('0x2'));var BPromise=require(_0x64ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64ba('0x4'));var db=require(_0x64ba('0x5'))['db'];var utils=require(_0x64ba('0x6'));var logger=require(_0x64ba('0x7'))(_0x64ba('0x8'));var config=require(_0x64ba('0x9'));var jayson=require(_0x64ba('0xa'));var client=jayson[_0x64ba('0xb')][_0x64ba('0xc')]({'port':0x232a});config[_0x64ba('0xd')]=_[_0x64ba('0xe')](config[_0x64ba('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x64ba('0xf'))(new Redis(config[_0x64ba('0xd')]));require('./whatsappQueue.socket')[_0x64ba('0x10')](socket);function respondWithRpcPromise(_0x4470f4,_0x2d4900,_0x3069b9){return new BPromise(function(_0x244502,_0x1e04f3){return client[_0x64ba('0x11')](_0x4470f4,_0x3069b9)[_0x64ba('0x12')](function(_0x2d4e91){logger[_0x64ba('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x2d4900,_0x64ba('0x14'));logger[_0x64ba('0x15')](_0x64ba('0x16'),_0x2d4900,_0x64ba('0x14'),JSON['stringify'](_0x2d4e91));if(_0x2d4e91['error']){if(_0x2d4e91['error'][_0x64ba('0x17')]===0x1f4){logger[_0x64ba('0x18')](_0x64ba('0x19'),_0x2d4900,_0x2d4e91['error'][_0x64ba('0x1a')]);return _0x1e04f3(_0x2d4e91[_0x64ba('0x18')][_0x64ba('0x1a')]);}logger['error'](_0x64ba('0x19'),_0x2d4900,_0x2d4e91[_0x64ba('0x18')][_0x64ba('0x1a')]);return _0x244502(_0x2d4e91[_0x64ba('0x18')][_0x64ba('0x1a')]);}else{logger[_0x64ba('0x13')](_0x64ba('0x19'),_0x2d4900,_0x64ba('0x14'));_0x244502(_0x2d4e91['result'][_0x64ba('0x1a')]);}})[_0x64ba('0x1b')](function(_0x430c84){logger['error'](_0x64ba('0x19'),_0x2d4900,_0x430c84);_0x1e04f3(_0x430c84);});});}exports['GetWhatsappQueue']=function(_0x581734){var _0x5b40e7=this;return new Promise(function(_0x309393,_0x305d48){return db[_0x64ba('0x1c')]['findAll']({'raw':_0x581734['options']?_0x581734['options'][_0x64ba('0x1d')]===undefined?!![]:![]:!![],'where':_0x581734[_0x64ba('0x1e')]?_0x581734[_0x64ba('0x1e')][_0x64ba('0x1f')]||null:null,'attributes':_0x581734[_0x64ba('0x1e')]?_0x581734[_0x64ba('0x1e')][_0x64ba('0x20')]||null:null,'limit':_0x581734[_0x64ba('0x1e')]?_0x581734[_0x64ba('0x1e')][_0x64ba('0x21')]||null:null,'include':_0x581734[_0x64ba('0x1e')]?_0x581734[_0x64ba('0x1e')][_0x64ba('0x22')]?_[_0x64ba('0x23')](_0x581734[_0x64ba('0x1e')][_0x64ba('0x22')],function(_0x3a2a16){return{'model':db[_0x3a2a16[_0x64ba('0x24')]],'as':_0x3a2a16['as'],'attributes':_0x3a2a16[_0x64ba('0x20')],'include':_0x3a2a16['include']?_[_0x64ba('0x23')](_0x3a2a16['include'],function(_0x18b5cb){return{'model':db[_0x18b5cb[_0x64ba('0x24')]],'as':_0x18b5cb['as'],'attributes':_0x18b5cb[_0x64ba('0x20')],'include':_0x18b5cb['include']?_[_0x64ba('0x23')](_0x18b5cb[_0x64ba('0x22')],function(_0x3be8dd){return{'model':db[_0x3be8dd['model']],'as':_0x3be8dd['as'],'attributes':_0x3be8dd[_0x64ba('0x20')]};}):[]};}):[]};}):[]:[]})[_0x64ba('0x12')](function(_0x2673f6){logger[_0x64ba('0x13')](_0x64ba('0x25'),_0x581734);logger[_0x64ba('0x15')](_0x64ba('0x25'),_0x581734,JSON[_0x64ba('0x26')](_0x2673f6));_0x309393(_0x2673f6);})[_0x64ba('0x1b')](function(_0x487552){logger[_0x64ba('0x18')](_0x64ba('0x25'),_0x487552['message'],_0x581734);_0x305d48(_0x5b40e7[_0x64ba('0x18')](0x1f4,_0x487552[_0x64ba('0x1a')]));});});};exports[_0x64ba('0x27')]=function(_0x533dd2){var _0x5d4e98=this;return new Promise(function(_0x41f698,_0x4575c8){return db['WhatsappQueue'][_0x64ba('0x28')]({'raw':_0x533dd2[_0x64ba('0x1e')]?_0x533dd2[_0x64ba('0x1e')][_0x64ba('0x1d')]===undefined?!![]:![]:!![],'where':_0x533dd2[_0x64ba('0x1e')]?_0x533dd2['options'][_0x64ba('0x1f')]||null:null,'attributes':_0x533dd2['options']?_0x533dd2['options']['attributes']||null:null,'include':_0x533dd2[_0x64ba('0x1e')]?_0x533dd2[_0x64ba('0x1e')][_0x64ba('0x22')]?_['map'](_0x533dd2[_0x64ba('0x1e')]['include'],function(_0x5a2d62){return{'model':db[_0x5a2d62[_0x64ba('0x24')]],'as':_0x5a2d62['as'],'attributes':_0x5a2d62[_0x64ba('0x20')],'include':_0x5a2d62['include']?_[_0x64ba('0x23')](_0x5a2d62[_0x64ba('0x22')],function(_0x555474){return{'model':db[_0x555474['model']],'as':_0x555474['as'],'attributes':_0x555474[_0x64ba('0x20')],'include':_0x555474['include']?_[_0x64ba('0x23')](_0x555474[_0x64ba('0x22')],function(_0x4a0ece){return{'model':db[_0x4a0ece['model']],'as':_0x4a0ece['as'],'attributes':_0x4a0ece[_0x64ba('0x20')]};}):[]};}):[]};}):[]:[]})[_0x64ba('0x12')](function(_0x176df2){logger[_0x64ba('0x13')](_0x64ba('0x27'),_0x533dd2);logger[_0x64ba('0x15')](_0x64ba('0x27'),_0x533dd2,JSON[_0x64ba('0x26')](_0x176df2));_0x41f698(_0x176df2);})[_0x64ba('0x1b')](function(_0x4523e4){logger['error'](_0x64ba('0x27'),_0x4523e4[_0x64ba('0x1a')],_0x533dd2);_0x4575c8(_0x5d4e98[_0x64ba('0x18')](0x1f4,_0x4523e4['message']));});});}; \ No newline at end of file +var _0x841a=['then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','GetWhatsappQueue','findAll','raw','options','where','limit','include','map','model','attributes','stringify','ShowWhatsappQueue','WhatsappQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappQueue.socket','request'];(function(_0x17177d,_0x1e19fd){var _0x467438=function(_0x3c30e5){while(--_0x3c30e5){_0x17177d['push'](_0x17177d['shift']());}};_0x467438(++_0x1e19fd);}(_0x841a,0x192));var _0xa841=function(_0x48918c,_0x4d2dc4){_0x48918c=_0x48918c-0x0;var _0x413fd9=_0x841a[_0x48918c];return _0x413fd9;};'use strict';var _=require(_0xa841('0x0'));var util=require('util');var moment=require(_0xa841('0x1'));var BPromise=require('bluebird');var rs=require(_0xa841('0x2'));var fs=require('fs');var Redis=require(_0xa841('0x3'));var db=require(_0xa841('0x4'))['db'];var utils=require(_0xa841('0x5'));var logger=require(_0xa841('0x6'))(_0xa841('0x7'));var config=require(_0xa841('0x8'));var jayson=require(_0xa841('0x9'));var client=jayson[_0xa841('0xa')]['http']({'port':0x232a});config[_0xa841('0xb')]=_[_0xa841('0xc')](config[_0xa841('0xb')],{'host':_0xa841('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa841('0xb')]));require(_0xa841('0xe'))['register'](socket);function respondWithRpcPromise(_0x12a5d9,_0x5129df,_0xcf62a5){return new BPromise(function(_0x370e72,_0x374999){return client[_0xa841('0xf')](_0x12a5d9,_0xcf62a5)[_0xa841('0x10')](function(_0x188ab3){logger[_0xa841('0x11')](_0xa841('0x12'),_0x5129df,_0xa841('0x13'));logger[_0xa841('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5129df,_0xa841('0x13'),JSON['stringify'](_0x188ab3));if(_0x188ab3[_0xa841('0x15')]){if(_0x188ab3[_0xa841('0x15')]['code']===0x1f4){logger[_0xa841('0x15')](_0xa841('0x12'),_0x5129df,_0x188ab3[_0xa841('0x15')]['message']);return _0x374999(_0x188ab3[_0xa841('0x15')][_0xa841('0x16')]);}logger[_0xa841('0x15')](_0xa841('0x12'),_0x5129df,_0x188ab3['error'][_0xa841('0x16')]);return _0x370e72(_0x188ab3[_0xa841('0x15')][_0xa841('0x16')]);}else{logger[_0xa841('0x11')](_0xa841('0x12'),_0x5129df,_0xa841('0x13'));_0x370e72(_0x188ab3['result']['message']);}})[_0xa841('0x17')](function(_0x117311){logger[_0xa841('0x15')](_0xa841('0x12'),_0x5129df,_0x117311);_0x374999(_0x117311);});});}exports[_0xa841('0x18')]=function(_0x229d04){var _0x27845c=this;return new Promise(function(_0x13cd96,_0x1efdee){return db['WhatsappQueue'][_0xa841('0x19')]({'raw':_0x229d04['options']?_0x229d04['options'][_0xa841('0x1a')]===undefined?!![]:![]:!![],'where':_0x229d04[_0xa841('0x1b')]?_0x229d04[_0xa841('0x1b')][_0xa841('0x1c')]||null:null,'attributes':_0x229d04[_0xa841('0x1b')]?_0x229d04[_0xa841('0x1b')]['attributes']||null:null,'limit':_0x229d04[_0xa841('0x1b')]?_0x229d04['options'][_0xa841('0x1d')]||null:null,'include':_0x229d04[_0xa841('0x1b')]?_0x229d04[_0xa841('0x1b')][_0xa841('0x1e')]?_[_0xa841('0x1f')](_0x229d04[_0xa841('0x1b')][_0xa841('0x1e')],function(_0x5458bc){return{'model':db[_0x5458bc[_0xa841('0x20')]],'as':_0x5458bc['as'],'attributes':_0x5458bc[_0xa841('0x21')],'include':_0x5458bc[_0xa841('0x1e')]?_[_0xa841('0x1f')](_0x5458bc['include'],function(_0x4f0a73){return{'model':db[_0x4f0a73[_0xa841('0x20')]],'as':_0x4f0a73['as'],'attributes':_0x4f0a73[_0xa841('0x21')],'include':_0x4f0a73[_0xa841('0x1e')]?_['map'](_0x4f0a73[_0xa841('0x1e')],function(_0x35a2f4){return{'model':db[_0x35a2f4[_0xa841('0x20')]],'as':_0x35a2f4['as'],'attributes':_0x35a2f4['attributes']};}):[]};}):[]};}):[]:[]})[_0xa841('0x10')](function(_0x1854d3){logger['info']('GetWhatsappQueue',_0x229d04);logger['debug'](_0xa841('0x18'),_0x229d04,JSON[_0xa841('0x22')](_0x1854d3));_0x13cd96(_0x1854d3);})[_0xa841('0x17')](function(_0x4e4eff){logger[_0xa841('0x15')](_0xa841('0x18'),_0x4e4eff[_0xa841('0x16')],_0x229d04);_0x1efdee(_0x27845c[_0xa841('0x15')](0x1f4,_0x4e4eff[_0xa841('0x16')]));});});};exports[_0xa841('0x23')]=function(_0x394046){var _0x138aa9=this;return new Promise(function(_0x2c4569,_0x304782){return db[_0xa841('0x24')][_0xa841('0x25')]({'raw':_0x394046['options']?_0x394046['options'][_0xa841('0x1a')]===undefined?!![]:![]:!![],'where':_0x394046[_0xa841('0x1b')]?_0x394046[_0xa841('0x1b')][_0xa841('0x1c')]||null:null,'attributes':_0x394046['options']?_0x394046[_0xa841('0x1b')]['attributes']||null:null,'include':_0x394046['options']?_0x394046['options']['include']?_[_0xa841('0x1f')](_0x394046[_0xa841('0x1b')][_0xa841('0x1e')],function(_0x4fbcf5){return{'model':db[_0x4fbcf5[_0xa841('0x20')]],'as':_0x4fbcf5['as'],'attributes':_0x4fbcf5[_0xa841('0x21')],'include':_0x4fbcf5[_0xa841('0x1e')]?_[_0xa841('0x1f')](_0x4fbcf5[_0xa841('0x1e')],function(_0x1c9cd1){return{'model':db[_0x1c9cd1[_0xa841('0x20')]],'as':_0x1c9cd1['as'],'attributes':_0x1c9cd1['attributes'],'include':_0x1c9cd1[_0xa841('0x1e')]?_['map'](_0x1c9cd1[_0xa841('0x1e')],function(_0x1a8071){return{'model':db[_0x1a8071['model']],'as':_0x1a8071['as'],'attributes':_0x1a8071['attributes']};}):[]};}):[]};}):[]:[]})[_0xa841('0x10')](function(_0x5312f5){logger['info'](_0xa841('0x23'),_0x394046);logger[_0xa841('0x14')]('ShowWhatsappQueue',_0x394046,JSON[_0xa841('0x22')](_0x5312f5));_0x2c4569(_0x5312f5);})[_0xa841('0x17')](function(_0x50c716){logger[_0xa841('0x15')](_0xa841('0x23'),_0x50c716[_0xa841('0x16')],_0x394046);_0x304782(_0x138aa9[_0xa841('0x15')](0x1f4,_0x50c716[_0xa841('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 09990b1..1f4c438 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 _0x7e81=['removeListener','register','whatsappQueue:','./whatsappQueue.events','save','emit'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x7e81,0x1b3));var _0x17e8=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x7e81[_0xf50820];return _0x2a9b10;};'use strict';var WhatsappQueueEvents=require(_0x17e8('0x0'));var events=[_0x17e8('0x1'),'remove','update'];function createListener(_0x3a6ed0,_0x4e50ea){return function(_0x458e9f){_0x4e50ea[_0x17e8('0x2')](_0x3a6ed0,_0x458e9f);};}function removeListener(_0x489a82,_0xb34fe){return function(){WhatsappQueueEvents[_0x17e8('0x3')](_0x489a82,_0xb34fe);};}exports[_0x17e8('0x4')]=function(_0x36ea4f){for(var _0x2acb94=0x0,_0x59dcde=events['length'];_0x2acb94<_0x59dcde;_0x2acb94++){var _0xaa0ac1=events[_0x2acb94];var _0x3f01b0=createListener(_0x17e8('0x5')+_0xaa0ac1,_0x36ea4f);WhatsappQueueEvents['on'](_0xaa0ac1,_0x3f01b0);}}; \ No newline at end of file +var _0x0b31=['update','emit','length','whatsappQueue:','save','remove'];(function(_0x4d3882,_0xc5fbb){var _0x500a5e=function(_0x5554d0){while(--_0x5554d0){_0x4d3882['push'](_0x4d3882['shift']());}};_0x500a5e(++_0xc5fbb);}(_0x0b31,0x100));var _0x10b3=function(_0x48ba3d,_0x5c863c){_0x48ba3d=_0x48ba3d-0x0;var _0x159093=_0x0b31[_0x48ba3d];return _0x159093;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x10b3('0x0'),_0x10b3('0x1'),_0x10b3('0x2')];function createListener(_0x47f244,_0x1d5e8c){return function(_0x317ac2){_0x1d5e8c[_0x10b3('0x3')](_0x47f244,_0x317ac2);};}function removeListener(_0x40bf1b,_0x279f20){return function(){WhatsappQueueEvents['removeListener'](_0x40bf1b,_0x279f20);};}exports['register']=function(_0x105c25){for(var _0x1d77a2=0x0,_0x3b17d8=events[_0x10b3('0x4')];_0x1d77a2<_0x3b17d8;_0x1d77a2++){var _0x143181=events[_0x1d77a2];var _0x31cd28=createListener(_0x10b3('0x5')+_0x143181,_0x105c25);WhatsappQueueEvents['on'](_0x143181,_0x31cd28);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 6d64baf..1aa708c 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 _0xb10c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0xfd1fcd,_0x3182b7){var _0x1e0646=function(_0x4f4fa4){while(--_0x4f4fa4){_0xfd1fcd['push'](_0xfd1fcd['shift']());}};_0x1e0646(++_0x3182b7);}(_0xb10c,0xd8));var _0xcb10=function(_0x5a2db8,_0x409f2a){_0x5a2db8=_0x5a2db8-0x0;var _0x28b4f8=_0xb10c[_0x5a2db8];return _0x28b4f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcb10('0x0'));var timeout=require(_0xcb10('0x1'));var express=require(_0xcb10('0x2'));var router=express[_0xcb10('0x3')]();var fs_extra=require(_0xcb10('0x4'));var auth=require(_0xcb10('0x5'));var interaction=require(_0xcb10('0x6'));var config=require(_0xcb10('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0xcb10('0x8')](),controller[_0xcb10('0x9')]);router[_0xcb10('0xa')](_0xcb10('0xb'),auth[_0xcb10('0x8')](),controller[_0xcb10('0xc')]);router['get'](_0xcb10('0xd'),auth[_0xcb10('0x8')](),controller[_0xcb10('0xe')]);router['post']('/',auth[_0xcb10('0x8')](),controller[_0xcb10('0xf')]);router[_0xcb10('0x10')]('/:id',auth[_0xcb10('0x8')](),controller[_0xcb10('0x11')]);router['delete'](_0xcb10('0xd'),auth['isAuthenticated'](),controller[_0xcb10('0x12')]);module[_0xcb10('0x13')]=router; \ No newline at end of file +var _0x0a88=['get','/describe','post','create','put','/:id','update','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0a88,0xac));var _0x80a8=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x0a88[_0x286bfb];return _0x52b683;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x80a8('0x0'));var timeout=require(_0x80a8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x80a8('0x2'));var auth=require(_0x80a8('0x3'));var interaction=require(_0x80a8('0x4'));var config=require(_0x80a8('0x5'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x80a8('0x6')](),controller[_0x80a8('0x7')]);router[_0x80a8('0x8')](_0x80a8('0x9'),auth[_0x80a8('0x6')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x80a8('0xa')]('/',auth[_0x80a8('0x6')](),controller[_0x80a8('0xb')]);router[_0x80a8('0xc')](_0x80a8('0xd'),auth[_0x80a8('0x6')](),controller[_0x80a8('0xe')]);router['delete'](_0x80a8('0xd'),auth[_0x80a8('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e0bac12..8caeb7e 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(_0xd00153,_0x47e18c){var _0x1b5426=function(_0x3882ac){while(--_0x3882ac){_0xd00153['push'](_0xd00153['shift']());}};_0x1b5426(++_0x47e18c);}(_0x7a54,0x106));var _0x47a5=function(_0x12ec61,_0x569180){_0x12ec61=_0x12ec61-0x0;var _0x75408a=_0x7a54[_0x12ec61];return _0x75408a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x8ef11,_0x4d81a9){var _0x4abc8d=function(_0x482ac1){while(--_0x482ac1){_0x8ef11['push'](_0x8ef11['shift']());}};_0x4abc8d(++_0x4d81a9);}(_0x7a54,0x106));var _0x47a5=function(_0xa96704,_0x4d1519){_0xa96704=_0xa96704-0x0;var _0x10b4b9=_0x7a54[_0xa96704];return _0x10b4b9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c814f23..c4c4dbe 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 _0x3c81=['apply','reject','save','update','then','destroy','end','error','name','send','map','WhatsappQueueReport','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x7b5c52,_0x53948c){var _0x2e347d=function(_0x5ad3af){while(--_0x5ad3af){_0x7b5c52['push'](_0x7b5c52['shift']());}};_0x2e347d(++_0x53948c);}(_0x3c81,0x102));var _0x13c8=function(_0x1035b7,_0x46ee1e){_0x1035b7=_0x1035b7-0x0;var _0x3d31fe=_0x3c81[_0x1035b7];return _0x3d31fe;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x28')]();});}};}function handleEntityNotFound(_0x4aff35,_0x47e8ae){return function(_0x5ad0dc){if(!_0x5ad0dc){_0x4aff35[_0x13c8('0x19')](0x194);}return _0x5ad0dc;};}function handleError(_0xc7f1b6,_0x53ada9){_0x53ada9=_0x53ada9||0x1f4;return function(_0x4df077){logger[_0x13c8('0x29')](_0x4df077['stack']);if(_0x4df077['name']){delete _0x4df077[_0x13c8('0x2a')];}_0xc7f1b6[_0x13c8('0x1a')](_0x53ada9)[_0x13c8('0x2b')](_0x4df077);};}exports['index']=function(_0x5ef2f7,_0x277a89){var _0x1071a0={},_0x399840={},_0x441182={'count':0x0,'rows':[]};var _0x138017=_[_0x13c8('0x2c')](db[_0x13c8('0x2d')]['rawAttributes'],function(_0x109cb8){return{'name':_0x109cb8[_0x13c8('0x2e')],'type':_0x109cb8['type']['key']};});_0x399840[_0x13c8('0x2f')]=_[_0x13c8('0x2c')](_0x138017,'name');_0x399840[_0x13c8('0x30')]=_[_0x13c8('0x31')](_0x5ef2f7['query']);_0x399840[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],_0x399840[_0x13c8('0x30')]);_0x1071a0[_0x13c8('0x34')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x5ef2f7['query']['fields']));_0x1071a0[_0x13c8('0x34')]=_0x1071a0[_0x13c8('0x34')]['length']?_0x1071a0[_0x13c8('0x34')]:_0x399840['model'];if(!_0x5ef2f7[_0x13c8('0x30')]['hasOwnProperty'](_0x13c8('0x36'))){_0x1071a0[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x1d')]);_0x1071a0[_0x13c8('0x1c')]=qs[_0x13c8('0x1c')](_0x5ef2f7['query'][_0x13c8('0x1c')]);}_0x1071a0[_0x13c8('0x37')]=qs['sort'](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x38')]);_0x1071a0[_0x13c8('0x39')]=qs['filters'](_['pick'](_0x5ef2f7['query'],_0x399840[_0x13c8('0x32')]),_0x138017);if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]){_0x1071a0[_0x13c8('0x39')]=_[_0x13c8('0x3b')](_0x1071a0[_0x13c8('0x39')],{'$or':_[_0x13c8('0x2c')](_0x138017,function(_0xe19858){if(_0xe19858[_0x13c8('0x3c')]!=='VIRTUAL'){var _0x5b2a28={};_0x5b2a28[_0xe19858[_0x13c8('0x2a')]]={'$like':'%'+_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]+'%'};return _0x5b2a28;}})});}_0x1071a0=_[_0x13c8('0x3b')]({},_0x1071a0,_0x5ef2f7['options']);var _0x35e1e7={'where':_0x1071a0['where']};return db[_0x13c8('0x2d')][_0x13c8('0x1f')](_0x35e1e7)[_0x13c8('0x26')](function(_0x1cd02c){_0x441182[_0x13c8('0x1f')]=_0x1cd02c;if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3d')]){_0x1071a0[_0x13c8('0x3e')]=[{'all':!![]}];}return db[_0x13c8('0x2d')][_0x13c8('0x3f')](_0x1071a0);})[_0x13c8('0x26')](function(_0x416169){_0x441182[_0x13c8('0x40')]=_0x416169;return _0x441182;})[_0x13c8('0x26')](respondWithFilteredResult(_0x277a89,_0x1071a0))[_0x13c8('0x41')](handleError(_0x277a89,null));};exports[_0x13c8('0x42')]=function(_0x1b2ada,_0x1505fb){var _0xc5eb86={'raw':!![],'where':{'id':_0x1b2ada[_0x13c8('0x43')]['id']}},_0x1cff99={};_0x1cff99[_0x13c8('0x2f')]=_[_0x13c8('0x31')](db[_0x13c8('0x2d')][_0x13c8('0x44')]);_0x1cff99['query']=_[_0x13c8('0x31')](_0x1b2ada[_0x13c8('0x30')]);_0x1cff99[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],_0x1cff99['query']);_0xc5eb86['attributes']=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x1b2ada['query']['fields']));_0xc5eb86['attributes']=_0xc5eb86[_0x13c8('0x34')]['length']?_0xc5eb86[_0x13c8('0x34')]:_0x1cff99['model'];if(_0x1b2ada[_0x13c8('0x30')][_0x13c8('0x3d')]){_0xc5eb86[_0x13c8('0x3e')]=[{'all':!![]}];}_0xc5eb86=_[_0x13c8('0x3b')]({},_0xc5eb86,_0x1b2ada[_0x13c8('0x45')]);return db[_0x13c8('0x2d')]['find'](_0xc5eb86)[_0x13c8('0x26')](handleEntityNotFound(_0x1505fb,null))[_0x13c8('0x26')](respondWithResult(_0x1505fb,null))['catch'](handleError(_0x1505fb,null));};exports[_0x13c8('0x46')]=function(_0x26155d,_0x2e925f){return db[_0x13c8('0x2d')][_0x13c8('0x46')](_0x26155d['body'],{})[_0x13c8('0x26')](respondWithResult(_0x2e925f,0xc9))[_0x13c8('0x41')](handleError(_0x2e925f,null));};exports[_0x13c8('0x25')]=function(_0x38418b,_0x185d18){if(_0x38418b['body']['id']){delete _0x38418b[_0x13c8('0x47')]['id'];}return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x38418b[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x185d18,null))[_0x13c8('0x26')](saveUpdates(_0x38418b[_0x13c8('0x47')],null))[_0x13c8('0x26')](respondWithResult(_0x185d18,null))[_0x13c8('0x41')](handleError(_0x185d18,null));};exports[_0x13c8('0x27')]=function(_0x266f4e,_0x5e1fe5){return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x266f4e[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x5e1fe5,null))[_0x13c8('0x26')](removeEntity(_0x5e1fe5,null))[_0x13c8('0x41')](handleError(_0x5e1fe5,null));};exports['describe']=function(_0x341fd3,_0x416e4f){return db[_0x13c8('0x2d')]['describe']()['then'](respondWithResult(_0x416e4f,null))[_0x13c8('0x41')](handleError(_0x416e4f,null));}; \ No newline at end of file +var _0x13f6=['catch','params','rawAttributes','intersection','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','send','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x13f6,0x124));var _0x613f=function(_0x21d8a2,_0x6ec9d1){_0x21d8a2=_0x21d8a2-0x0;var _0x4d031c=_0x13f6[_0x21d8a2];return _0x4d031c;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){_0x51f376[_0x613f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30fb15,_0x204185){return function(_0x51bba1){if(!_0x51bba1){_0x30fb15[_0x613f('0x16')](0x194);}return _0x51bba1;};}function handleError(_0x5d4ff6,_0x32e747){_0x32e747=_0x32e747||0x1f4;return function(_0x4a878d){logger['error'](_0x4a878d['stack']);if(_0x4a878d[_0x613f('0x25')]){delete _0x4a878d['name'];}_0x5d4ff6[_0x613f('0x17')](_0x32e747)[_0x613f('0x26')](_0x4a878d);};}exports['index']=function(_0x121241,_0x2551c1){var _0x4c8aa1={},_0x4cff5d={},_0x4f892d={'count':0x0,'rows':[]};var _0x24be7c=_[_0x613f('0x27')](db[_0x613f('0x28')]['rawAttributes'],function(_0x23eda8){return{'name':_0x23eda8[_0x613f('0x29')],'type':_0x23eda8[_0x613f('0x2a')][_0x613f('0x2b')]};});_0x4cff5d['model']=_[_0x613f('0x27')](_0x24be7c,_0x613f('0x25'));_0x4cff5d[_0x613f('0x2c')]=_[_0x613f('0x2d')](_0x121241[_0x613f('0x2c')]);_0x4cff5d[_0x613f('0x2e')]=_['intersection'](_0x4cff5d[_0x613f('0x2f')],_0x4cff5d[_0x613f('0x2c')]);_0x4c8aa1[_0x613f('0x30')]=_['intersection'](_0x4cff5d[_0x613f('0x2f')],qs['fields'](_0x121241[_0x613f('0x2c')][_0x613f('0x31')]));_0x4c8aa1[_0x613f('0x30')]=_0x4c8aa1[_0x613f('0x30')][_0x613f('0x32')]?_0x4c8aa1[_0x613f('0x30')]:_0x4cff5d['model'];if(!_0x121241[_0x613f('0x2c')][_0x613f('0x33')](_0x613f('0x34'))){_0x4c8aa1[_0x613f('0x1a')]=qs[_0x613f('0x1a')](_0x121241['query']['limit']);_0x4c8aa1['offset']=qs[_0x613f('0x1d')](_0x121241[_0x613f('0x2c')][_0x613f('0x1d')]);}_0x4c8aa1[_0x613f('0x35')]=qs['sort'](_0x121241[_0x613f('0x2c')][_0x613f('0x36')]);_0x4c8aa1['where']=qs[_0x613f('0x2e')](_['pick'](_0x121241[_0x613f('0x2c')],_0x4cff5d['filters']),_0x24be7c);if(_0x121241[_0x613f('0x2c')]['filter']){_0x4c8aa1[_0x613f('0x37')]=_[_0x613f('0x38')](_0x4c8aa1[_0x613f('0x37')],{'$or':_['map'](_0x24be7c,function(_0x36eaa0){if(_0x36eaa0[_0x613f('0x2a')]!==_0x613f('0x39')){var _0x2fb3a6={};_0x2fb3a6[_0x36eaa0[_0x613f('0x25')]]={'$like':'%'+_0x121241[_0x613f('0x2c')][_0x613f('0x3a')]+'%'};return _0x2fb3a6;}})});}_0x4c8aa1=_[_0x613f('0x38')]({},_0x4c8aa1,_0x121241[_0x613f('0x3b')]);var _0x3313c1={'where':_0x4c8aa1['where']};return db[_0x613f('0x28')][_0x613f('0x1c')](_0x3313c1)[_0x613f('0x23')](function(_0x1e5af0){_0x4f892d[_0x613f('0x1c')]=_0x1e5af0;if(_0x121241[_0x613f('0x2c')][_0x613f('0x3c')]){_0x4c8aa1['include']=[{'all':!![]}];}return db[_0x613f('0x28')][_0x613f('0x3d')](_0x4c8aa1);})[_0x613f('0x23')](function(_0x3d2d7b){_0x4f892d[_0x613f('0x3e')]=_0x3d2d7b;return _0x4f892d;})[_0x613f('0x23')](respondWithFilteredResult(_0x2551c1,_0x4c8aa1))[_0x613f('0x3f')](handleError(_0x2551c1,null));};exports['show']=function(_0x343a59,_0x18f427){var _0x3bb605={'raw':!![],'where':{'id':_0x343a59[_0x613f('0x40')]['id']}},_0x2f584e={};_0x2f584e[_0x613f('0x2f')]=_[_0x613f('0x2d')](db[_0x613f('0x28')][_0x613f('0x41')]);_0x2f584e[_0x613f('0x2c')]=_[_0x613f('0x2d')](_0x343a59[_0x613f('0x2c')]);_0x2f584e[_0x613f('0x2e')]=_['intersection'](_0x2f584e[_0x613f('0x2f')],_0x2f584e[_0x613f('0x2c')]);_0x3bb605[_0x613f('0x30')]=_[_0x613f('0x42')](_0x2f584e['model'],qs[_0x613f('0x31')](_0x343a59[_0x613f('0x2c')][_0x613f('0x31')]));_0x3bb605[_0x613f('0x30')]=_0x3bb605[_0x613f('0x30')][_0x613f('0x32')]?_0x3bb605[_0x613f('0x30')]:_0x2f584e[_0x613f('0x2f')];if(_0x343a59[_0x613f('0x2c')][_0x613f('0x3c')]){_0x3bb605['include']=[{'all':!![]}];}_0x3bb605=_['merge']({},_0x3bb605,_0x343a59[_0x613f('0x3b')]);return db[_0x613f('0x28')]['find'](_0x3bb605)[_0x613f('0x23')](handleEntityNotFound(_0x18f427,null))[_0x613f('0x23')](respondWithResult(_0x18f427,null))[_0x613f('0x3f')](handleError(_0x18f427,null));};exports[_0x613f('0x43')]=function(_0x39b8b2,_0x1c0b07){return db[_0x613f('0x28')][_0x613f('0x43')](_0x39b8b2[_0x613f('0x44')],{})[_0x613f('0x23')](respondWithResult(_0x1c0b07,0xc9))[_0x613f('0x3f')](handleError(_0x1c0b07,null));};exports[_0x613f('0x22')]=function(_0x174e22,_0x17f8e5){if(_0x174e22[_0x613f('0x44')]['id']){delete _0x174e22[_0x613f('0x44')]['id'];}return db[_0x613f('0x28')][_0x613f('0x45')]({'where':{'id':_0x174e22['params']['id']}})['then'](handleEntityNotFound(_0x17f8e5,null))[_0x613f('0x23')](saveUpdates(_0x174e22[_0x613f('0x44')],null))['then'](respondWithResult(_0x17f8e5,null))['catch'](handleError(_0x17f8e5,null));};exports[_0x613f('0x24')]=function(_0x51729a,_0x513bf1){return db[_0x613f('0x28')][_0x613f('0x45')]({'where':{'id':_0x51729a[_0x613f('0x40')]['id']}})['then'](handleEntityNotFound(_0x513bf1,null))[_0x613f('0x23')](removeEntity(_0x513bf1,null))[_0x613f('0x3f')](handleError(_0x513bf1,null));};exports['describe']=function(_0x55e878,_0x1c0c8e){return db[_0x613f('0x28')][_0x613f('0x46')]()[_0x613f('0x23')](respondWithResult(_0x1c0c8e,null))[_0x613f('0x3f')](handleError(_0x1c0c8e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index bb423fc..0ecdb97 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 _0x2ad0=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x49edd6,_0x3eae3d){var _0x3c2d44=function(_0x32c168){while(--_0x32c168){_0x49edd6['push'](_0x49edd6['shift']());}};_0x3c2d44(++_0x3eae3d);}(_0x2ad0,0x1ee));var _0x02ad=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0x2ad0[_0x21c6b8];return _0x39d474;};'use strict';var _=require(_0x02ad('0x0'));var util=require(_0x02ad('0x1'));var logger=require('../../config/logger')(_0x02ad('0x2'));var moment=require(_0x02ad('0x3'));var BPromise=require(_0x02ad('0x4'));var rp=require(_0x02ad('0x5'));var fs=require('fs');var path=require(_0x02ad('0x6'));var rimraf=require(_0x02ad('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x02ad('0x8')]=function(_0x54f843,_0x14aece){return _0x54f843[_0x02ad('0x9')](_0x02ad('0xa'),attributes,{'tableName':_0x02ad('0xb'),'paranoid':![],'indexes':[{'name':_0x02ad('0xc'),'fields':[_0x02ad('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7074=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7074,0x1df));var _0x4707=function(_0x255a04,_0x4411e4){_0x255a04=_0x255a04-0x0;var _0x2aed14=_0x7074[_0x255a04];return _0x2aed14;};'use strict';var _=require('lodash');var util=require(_0x4707('0x0'));var logger=require(_0x4707('0x1'))(_0x4707('0x2'));var moment=require('moment');var BPromise=require(_0x4707('0x3'));var rp=require(_0x4707('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4707('0x5'));var attributes=require(_0x4707('0x6'));module[_0x4707('0x7')]=function(_0x57e1d5,_0x3cc948){return _0x57e1d5[_0x4707('0x8')](_0x4707('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x4707('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4ff374d..cccce2e 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 _0x4f26=['limit','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','UpdateWhatsappQueueReport','update','raw','where'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4f26,0xc8));var _0x64f2=function(_0x24092f,_0x28e911){_0x24092f=_0x24092f-0x0;var _0x134d1d=_0x4f26[_0x24092f];return _0x134d1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x64f2('0x0'));var BPromise=require(_0x64f2('0x1'));var rs=require(_0x64f2('0x2'));var fs=require('fs');var Redis=require(_0x64f2('0x3'));var db=require(_0x64f2('0x4'))['db'];var utils=require(_0x64f2('0x5'));var logger=require('../../config/logger')(_0x64f2('0x6'));var config=require(_0x64f2('0x7'));var jayson=require(_0x64f2('0x8'));var client=jayson[_0x64f2('0x9')][_0x64f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53f720,_0xee44b8,_0x12c937){return new BPromise(function(_0x3a6373,_0x155501){return client[_0x64f2('0xb')](_0x53f720,_0x12c937)[_0x64f2('0xc')](function(_0x45e878){logger[_0x64f2('0xd')](_0x64f2('0xe'),_0xee44b8,_0x64f2('0xf'));logger[_0x64f2('0x10')](_0x64f2('0x11'),_0xee44b8,_0x64f2('0xf'),JSON['stringify'](_0x45e878));if(_0x45e878['error']){if(_0x45e878[_0x64f2('0x12')][_0x64f2('0x13')]===0x1f4){logger[_0x64f2('0x12')](_0x64f2('0xe'),_0xee44b8,_0x45e878[_0x64f2('0x12')][_0x64f2('0x14')]);return _0x155501(_0x45e878[_0x64f2('0x12')][_0x64f2('0x14')]);}logger[_0x64f2('0x12')](_0x64f2('0xe'),_0xee44b8,_0x45e878[_0x64f2('0x12')]['message']);return _0x3a6373(_0x45e878[_0x64f2('0x12')]['message']);}else{logger['info'](_0x64f2('0xe'),_0xee44b8,'request\x20sent');_0x3a6373(_0x45e878[_0x64f2('0x15')][_0x64f2('0x14')]);}})[_0x64f2('0x16')](function(_0x5ecc48){logger[_0x64f2('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0xee44b8,_0x5ecc48);_0x155501(_0x5ecc48);});});}exports[_0x64f2('0x17')]=function(_0x5b42ae){var _0x23469e=this;return new Promise(function(_0x1d46e1,_0x4e5a99){return db[_0x64f2('0x18')]['create'](_0x5b42ae[_0x64f2('0x19')],{'raw':_0x5b42ae['options']?_0x5b42ae[_0x64f2('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x64f2('0xc')](function(_0x103008){logger[_0x64f2('0xd')](_0x64f2('0x17'),_0x5b42ae);logger[_0x64f2('0x10')]('CreateWhatsappQueueReport',_0x5b42ae,JSON['stringify'](_0x103008));_0x1d46e1(_0x103008);})[_0x64f2('0x16')](function(_0x31b210){logger[_0x64f2('0x12')](_0x64f2('0x17'),_0x31b210[_0x64f2('0x14')],_0x5b42ae);_0x4e5a99(_0x23469e['error'](0x1f4,_0x31b210[_0x64f2('0x14')]));});});};exports[_0x64f2('0x1b')]=function(_0x1286ec){var _0x2f0d30=this;return new Promise(function(_0x133ffb,_0x1bbd38){return db[_0x64f2('0x18')][_0x64f2('0x1c')](_0x1286ec[_0x64f2('0x19')],{'raw':_0x1286ec[_0x64f2('0x1a')]?_0x1286ec['options'][_0x64f2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1286ec['options']?_0x1286ec[_0x64f2('0x1a')][_0x64f2('0x1e')]||null:null,'attributes':_0x1286ec[_0x64f2('0x1a')]?_0x1286ec[_0x64f2('0x1a')]['attributes']||null:null,'limit':_0x1286ec[_0x64f2('0x1a')]?_0x1286ec[_0x64f2('0x1a')][_0x64f2('0x1f')]||null:null})[_0x64f2('0xc')](function(_0x31883e){logger[_0x64f2('0xd')](_0x64f2('0x1b'),_0x1286ec);logger[_0x64f2('0x10')](_0x64f2('0x1b'),_0x1286ec,JSON[_0x64f2('0x20')](_0x31883e));_0x133ffb(_0x31883e);})[_0x64f2('0x16')](function(_0x4a87ff){logger[_0x64f2('0x12')](_0x64f2('0x1b'),_0x4a87ff[_0x64f2('0x14')],_0x1286ec);_0x1bbd38(_0x2f0d30['error'](0x1f4,_0x4a87ff['message']));});});}; \ No newline at end of file +var _0xc468=['create','body','options','raw','info','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport'];(function(_0x1916fb,_0x5bce9f){var _0x58d8af=function(_0xc3bcde){while(--_0xc3bcde){_0x1916fb['push'](_0x1916fb['shift']());}};_0x58d8af(++_0x5bce9f);}(_0xc468,0xd0));var _0x8c46=function(_0x220a31,_0x2c7659){_0x220a31=_0x220a31-0x0;var _0x2c74f0=_0xc468[_0x220a31];return _0x2c74f0;};'use strict';var _=require(_0x8c46('0x0'));var util=require('util');var moment=require(_0x8c46('0x1'));var BPromise=require(_0x8c46('0x2'));var rs=require(_0x8c46('0x3'));var fs=require('fs');var Redis=require(_0x8c46('0x4'));var db=require(_0x8c46('0x5'))['db'];var utils=require(_0x8c46('0x6'));var logger=require(_0x8c46('0x7'))(_0x8c46('0x8'));var config=require(_0x8c46('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8c46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e258b,_0x404497,_0x32271){return new BPromise(function(_0x29e42c,_0x546f67){return client[_0x8c46('0xb')](_0x1e258b,_0x32271)[_0x8c46('0xc')](function(_0x3b40a2){logger['info'](_0x8c46('0xd'),_0x404497,_0x8c46('0xe'));logger[_0x8c46('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x404497,_0x8c46('0xe'),JSON[_0x8c46('0x10')](_0x3b40a2));if(_0x3b40a2[_0x8c46('0x11')]){if(_0x3b40a2[_0x8c46('0x11')]['code']===0x1f4){logger['error'](_0x8c46('0xd'),_0x404497,_0x3b40a2['error']['message']);return _0x546f67(_0x3b40a2[_0x8c46('0x11')][_0x8c46('0x12')]);}logger[_0x8c46('0x11')](_0x8c46('0xd'),_0x404497,_0x3b40a2[_0x8c46('0x11')][_0x8c46('0x12')]);return _0x29e42c(_0x3b40a2[_0x8c46('0x11')][_0x8c46('0x12')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x404497,_0x8c46('0xe'));_0x29e42c(_0x3b40a2[_0x8c46('0x13')][_0x8c46('0x12')]);}})[_0x8c46('0x14')](function(_0x2092ea){logger[_0x8c46('0x11')](_0x8c46('0xd'),_0x404497,_0x2092ea);_0x546f67(_0x2092ea);});});}exports[_0x8c46('0x15')]=function(_0x167855){var _0x36680f=this;return new Promise(function(_0x20f654,_0xfe89d0){return db[_0x8c46('0x16')][_0x8c46('0x17')](_0x167855[_0x8c46('0x18')],{'raw':_0x167855[_0x8c46('0x19')]?_0x167855[_0x8c46('0x19')][_0x8c46('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x106c8a){logger[_0x8c46('0x1b')](_0x8c46('0x15'),_0x167855);logger[_0x8c46('0xf')]('CreateWhatsappQueueReport',_0x167855,JSON['stringify'](_0x106c8a));_0x20f654(_0x106c8a);})['catch'](function(_0x5a44ae){logger[_0x8c46('0x11')](_0x8c46('0x15'),_0x5a44ae[_0x8c46('0x12')],_0x167855);_0xfe89d0(_0x36680f[_0x8c46('0x11')](0x1f4,_0x5a44ae[_0x8c46('0x12')]));});});};exports[_0x8c46('0x1c')]=function(_0x320805){var _0x38adf9=this;return new Promise(function(_0x58a7f0,_0x31a36c){return db[_0x8c46('0x16')][_0x8c46('0x1d')](_0x320805[_0x8c46('0x18')],{'raw':_0x320805['options']?_0x320805[_0x8c46('0x19')][_0x8c46('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x320805[_0x8c46('0x19')]?_0x320805[_0x8c46('0x19')][_0x8c46('0x1e')]||null:null,'attributes':_0x320805['options']?_0x320805[_0x8c46('0x19')][_0x8c46('0x1f')]||null:null,'limit':_0x320805[_0x8c46('0x19')]?_0x320805[_0x8c46('0x19')][_0x8c46('0x20')]||null:null})[_0x8c46('0xc')](function(_0x14de73){logger['info'](_0x8c46('0x1c'),_0x320805);logger[_0x8c46('0xf')](_0x8c46('0x1c'),_0x320805,JSON[_0x8c46('0x10')](_0x14de73));_0x58a7f0(_0x14de73);})[_0x8c46('0x14')](function(_0x42a27f){logger[_0x8c46('0x11')](_0x8c46('0x1c'),_0x42a27f['message'],_0x320805);_0x31a36c(_0x38adf9[_0x8c46('0x11')](0x1f4,_0x42a27f[_0x8c46('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7017d04..2357317 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 _0xf0e7=['describe','/:id','show','post','create','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','get'];(function(_0x11f28f,_0x30ebf9){var _0x413f1a=function(_0x537f8b){while(--_0x537f8b){_0x11f28f['push'](_0x11f28f['shift']());}};_0x413f1a(++_0x30ebf9);}(_0xf0e7,0x198));var _0x7f0e=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xf0e7[_0x3ba924];return _0x4cc1df;};'use strict';var multer=require(_0x7f0e('0x0'));var util=require('util');var path=require(_0x7f0e('0x1'));var timeout=require(_0x7f0e('0x2'));var express=require(_0x7f0e('0x3'));var router=express[_0x7f0e('0x4')]();var fs_extra=require(_0x7f0e('0x5'));var auth=require(_0x7f0e('0x6'));var interaction=require(_0x7f0e('0x7'));var config=require('../../config/environment');var controller=require(_0x7f0e('0x8'));router['get']('/',auth[_0x7f0e('0x9')](),controller[_0x7f0e('0xa')]);router[_0x7f0e('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7f0e('0xc')]);router[_0x7f0e('0xb')](_0x7f0e('0xd'),auth['isAuthenticated'](),controller[_0x7f0e('0xe')]);router[_0x7f0e('0xf')]('/',auth[_0x7f0e('0x9')](),controller[_0x7f0e('0x10')]);router[_0x7f0e('0x11')](_0x7f0e('0xd'),auth[_0x7f0e('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7f0e('0x12')]);module[_0x7f0e('0x13')]=router; \ No newline at end of file +var _0x0d3e=['express','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','/:id','show','create','update','destroy','util','path','connect-timeout'];(function(_0x9b3acc,_0x4050dd){var _0x426019=function(_0x41ba60){while(--_0x41ba60){_0x9b3acc['push'](_0x9b3acc['shift']());}};_0x426019(++_0x4050dd);}(_0x0d3e,0x97));var _0xe0d3=function(_0x5bf46c,_0x1fe508){_0x5bf46c=_0x5bf46c-0x0;var _0x5a37c4=_0x0d3e[_0x5bf46c];return _0x5a37c4;};'use strict';var multer=require('multer');var util=require(_0xe0d3('0x0'));var path=require(_0xe0d3('0x1'));var timeout=require(_0xe0d3('0x2'));var express=require(_0xe0d3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe0d3('0x4'));var interaction=require(_0xe0d3('0x5'));var config=require('../../config/environment');var controller=require(_0xe0d3('0x6'));router[_0xe0d3('0x7')]('/',auth[_0xe0d3('0x8')](),controller['index']);router['get']('/describe',auth[_0xe0d3('0x8')](),controller['describe']);router['get'](_0xe0d3('0x9'),auth[_0xe0d3('0x8')](),controller[_0xe0d3('0xa')]);router['post']('/',auth[_0xe0d3('0x8')](),controller[_0xe0d3('0xb')]);router['put'](_0xe0d3('0x9'),auth[_0xe0d3('0x8')](),controller[_0xe0d3('0xc')]);router['delete'](_0xe0d3('0x9'),auth['isAuthenticated'](),controller[_0xe0d3('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index afa74ba..1580997 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 _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb10b,0x12a));var _0xbb10=function(_0x4432f2,_0x22697a){_0x4432f2=_0x4432f2-0x0;var _0x1c97d6=_0xb10b[_0x4432f2];return _0x1c97d6;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0x4e2e=['exports','STRING','ENUM','account','agent','queue'];(function(_0x4b6b5b,_0x57b608){var _0x4420ae=function(_0x3cf0ce){while(--_0x3cf0ce){_0x4b6b5b['push'](_0x4b6b5b['shift']());}};_0x4420ae(++_0x57b608);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2525ba,_0x8ad785){_0x2525ba=_0x2525ba-0x0;var _0x4d8a92=_0x4e2e[_0x2525ba];return _0x4d8a92;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'uniqueid':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe4e2('0x2')](_0xe4e2('0x3'),_0xe4e2('0x4'),_0xe4e2('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 36dd126..08c9e30 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 _0x6c57=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','order','sort','where','pick','filter','merge','options','WhatsappTransferReport','includeAll','findAll','catch','show','params','fields','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json'];(function(_0xb99888,_0x39832c){var _0x13f105=function(_0x19cd40){while(--_0x19cd40){_0xb99888['push'](_0xb99888['shift']());}};_0x13f105(++_0x39832c);}(_0x6c57,0x76));var _0x76c5=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x6c57[_0x54d4fe];return _0x1ab5bb;};'use strict';var emlformat=require(_0x76c5('0x0'));var rimraf=require(_0x76c5('0x1'));var zipdir=require(_0x76c5('0x2'));var jsonpatch=require(_0x76c5('0x3'));var rp=require('request-promise');var moment=require(_0x76c5('0x4'));var BPromise=require(_0x76c5('0x5'));var Mustache=require(_0x76c5('0x6'));var util=require(_0x76c5('0x7'));var path=require(_0x76c5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76c5('0x9'));var fs=require('fs');var fs_extra=require(_0x76c5('0xa'));var _=require(_0x76c5('0xb'));var squel=require('squel');var crypto=require(_0x76c5('0xc'));var jsforce=require(_0x76c5('0xd'));var deskjs=require(_0x76c5('0xe'));var toCsv=require(_0x76c5('0xf'));var querystring=require(_0x76c5('0x10'));var Papa=require(_0x76c5('0x11'));var Redis=require(_0x76c5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x76c5('0x13'));var as=require(_0x76c5('0x14'));var hardwareService=require(_0x76c5('0x15'));var logger=require(_0x76c5('0x16'))(_0x76c5('0x17'));var utils=require(_0x76c5('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c03fa,_0x52b749){_0x52b749=_0x52b749||0xcc;return function(_0xc13406){if(_0xc13406){return _0x1c03fa[_0x76c5('0x19')](_0x52b749);}return _0x1c03fa[_0x76c5('0x1a')](_0x52b749)['end']();};}function respondWithResult(_0x22bfa6,_0x4834c5){_0x4834c5=_0x4834c5||0xc8;return function(_0x5e0d11){if(_0x5e0d11){return _0x22bfa6[_0x76c5('0x1a')](_0x4834c5)[_0x76c5('0x1b')](_0x5e0d11);}};}function respondWithFilteredResult(_0x2f7576,_0x1c100b){return function(_0x10062e){if(_0x10062e){var _0x407eb0=typeof _0x1c100b[_0x76c5('0x1c')]===_0x76c5('0x1d')&&typeof _0x1c100b['limit']===_0x76c5('0x1d');var _0xd162f=_0x10062e[_0x76c5('0x1e')];var _0x49874d=_0x407eb0?0x0:_0x1c100b[_0x76c5('0x1c')];var _0x4a01a3=_0x407eb0?_0x10062e[_0x76c5('0x1e')]:_0x1c100b['offset']+_0x1c100b[_0x76c5('0x1f')];var _0x51ae28;if(_0x4a01a3>=_0xd162f){_0x4a01a3=_0xd162f;_0x51ae28=0xc8;}else{_0x51ae28=0xce;}_0x2f7576[_0x76c5('0x1a')](_0x51ae28);return _0x2f7576[_0x76c5('0x20')](_0x76c5('0x21'),_0x49874d+'-'+_0x4a01a3+'/'+_0xd162f)['json'](_0x10062e);}return null;};}function patchUpdates(_0x32b3d1){return function(_0x116af0){try{jsonpatch['apply'](_0x116af0,_0x32b3d1,!![]);}catch(_0x1c05ce){return BPromise[_0x76c5('0x22')](_0x1c05ce);}return _0x116af0[_0x76c5('0x23')]();};}function saveUpdates(_0x10eab2,_0x3a9e12){return function(_0x312fdc){if(_0x312fdc){return _0x312fdc[_0x76c5('0x24')](_0x10eab2)['then'](function(_0x5b91ef){return _0x5b91ef;});}return null;};}function removeEntity(_0x565c49,_0x5b54df){return function(_0x2dca7d){if(_0x2dca7d){return _0x2dca7d['destroy']()[_0x76c5('0x25')](function(){_0x565c49[_0x76c5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ddaa,_0xff4b87){return function(_0x2c49fd){if(!_0x2c49fd){_0x48ddaa['sendStatus'](0x194);}return _0x2c49fd;};}function handleError(_0xb55ce,_0x50609b){_0x50609b=_0x50609b||0x1f4;return function(_0x1551fb){logger[_0x76c5('0x26')](_0x1551fb[_0x76c5('0x27')]);if(_0x1551fb[_0x76c5('0x28')]){delete _0x1551fb[_0x76c5('0x28')];}_0xb55ce[_0x76c5('0x1a')](_0x50609b)[_0x76c5('0x29')](_0x1551fb);};}exports[_0x76c5('0x2a')]=function(_0x1bb9c3,_0x33bf8f){var _0x113bac={},_0x513a05={},_0x57b537={'count':0x0,'rows':[]};var _0x12f873=_['map'](db['WhatsappTransferReport'][_0x76c5('0x2b')],function(_0x1c1434){return{'name':_0x1c1434[_0x76c5('0x2c')],'type':_0x1c1434[_0x76c5('0x2d')]['key']};});_0x513a05[_0x76c5('0x2e')]=_[_0x76c5('0x2f')](_0x12f873,_0x76c5('0x28'));_0x513a05[_0x76c5('0x30')]=_[_0x76c5('0x31')](_0x1bb9c3['query']);_0x513a05[_0x76c5('0x32')]=_[_0x76c5('0x33')](_0x513a05[_0x76c5('0x2e')],_0x513a05[_0x76c5('0x30')]);_0x113bac[_0x76c5('0x34')]=_[_0x76c5('0x33')](_0x513a05[_0x76c5('0x2e')],qs['fields'](_0x1bb9c3['query']['fields']));_0x113bac[_0x76c5('0x34')]=_0x113bac[_0x76c5('0x34')]['length']?_0x113bac['attributes']:_0x513a05['model'];if(!_0x1bb9c3[_0x76c5('0x30')]['hasOwnProperty']('nolimit')){_0x113bac[_0x76c5('0x1f')]=qs[_0x76c5('0x1f')](_0x1bb9c3[_0x76c5('0x30')]['limit']);_0x113bac[_0x76c5('0x1c')]=qs[_0x76c5('0x1c')](_0x1bb9c3[_0x76c5('0x30')]['offset']);}_0x113bac[_0x76c5('0x35')]=qs[_0x76c5('0x36')](_0x1bb9c3['query']['sort']);_0x113bac[_0x76c5('0x37')]=qs['filters'](_[_0x76c5('0x38')](_0x1bb9c3[_0x76c5('0x30')],_0x513a05[_0x76c5('0x32')]),_0x12f873);if(_0x1bb9c3[_0x76c5('0x30')][_0x76c5('0x39')]){_0x113bac[_0x76c5('0x37')]=_[_0x76c5('0x3a')](_0x113bac[_0x76c5('0x37')],{'$or':_['map'](_0x12f873,function(_0x37ea15){if(_0x37ea15[_0x76c5('0x2d')]!=='VIRTUAL'){var _0x4bdee5={};_0x4bdee5[_0x37ea15[_0x76c5('0x28')]]={'$like':'%'+_0x1bb9c3['query'][_0x76c5('0x39')]+'%'};return _0x4bdee5;}})});}_0x113bac=_[_0x76c5('0x3a')]({},_0x113bac,_0x1bb9c3[_0x76c5('0x3b')]);var _0x4fe12f={'where':_0x113bac[_0x76c5('0x37')]};return db[_0x76c5('0x3c')][_0x76c5('0x1e')](_0x4fe12f)[_0x76c5('0x25')](function(_0x79a65e){_0x57b537[_0x76c5('0x1e')]=_0x79a65e;if(_0x1bb9c3[_0x76c5('0x30')][_0x76c5('0x3d')]){_0x113bac['include']=[{'all':!![]}];}return db[_0x76c5('0x3c')][_0x76c5('0x3e')](_0x113bac);})[_0x76c5('0x25')](function(_0x1188c9){_0x57b537['rows']=_0x1188c9;return _0x57b537;})[_0x76c5('0x25')](respondWithFilteredResult(_0x33bf8f,_0x113bac))[_0x76c5('0x3f')](handleError(_0x33bf8f,null));};exports[_0x76c5('0x40')]=function(_0x115ae8,_0x32a983){var _0x250cf0={'raw':!![],'where':{'id':_0x115ae8[_0x76c5('0x41')]['id']}},_0x1352ed={};_0x1352ed[_0x76c5('0x2e')]=_[_0x76c5('0x31')](db[_0x76c5('0x3c')][_0x76c5('0x2b')]);_0x1352ed['query']=_[_0x76c5('0x31')](_0x115ae8[_0x76c5('0x30')]);_0x1352ed[_0x76c5('0x32')]=_[_0x76c5('0x33')](_0x1352ed[_0x76c5('0x2e')],_0x1352ed[_0x76c5('0x30')]);_0x250cf0[_0x76c5('0x34')]=_[_0x76c5('0x33')](_0x1352ed[_0x76c5('0x2e')],qs[_0x76c5('0x42')](_0x115ae8[_0x76c5('0x30')]['fields']));_0x250cf0[_0x76c5('0x34')]=_0x250cf0[_0x76c5('0x34')]['length']?_0x250cf0[_0x76c5('0x34')]:_0x1352ed[_0x76c5('0x2e')];if(_0x115ae8[_0x76c5('0x30')][_0x76c5('0x3d')]){_0x250cf0[_0x76c5('0x43')]=[{'all':!![]}];}_0x250cf0=_[_0x76c5('0x3a')]({},_0x250cf0,_0x115ae8['options']);return db[_0x76c5('0x3c')][_0x76c5('0x44')](_0x250cf0)['then'](handleEntityNotFound(_0x32a983,null))[_0x76c5('0x25')](respondWithResult(_0x32a983,null))[_0x76c5('0x3f')](handleError(_0x32a983,null));};exports[_0x76c5('0x45')]=function(_0xf67df4,_0x5cae1a){return db[_0x76c5('0x3c')][_0x76c5('0x45')](_0xf67df4[_0x76c5('0x46')],{})[_0x76c5('0x25')](respondWithResult(_0x5cae1a,0xc9))[_0x76c5('0x3f')](handleError(_0x5cae1a,null));};exports['update']=function(_0x43bdf6,_0x1cadd3){if(_0x43bdf6[_0x76c5('0x46')]['id']){delete _0x43bdf6[_0x76c5('0x46')]['id'];}return db[_0x76c5('0x3c')]['find']({'where':{'id':_0x43bdf6[_0x76c5('0x41')]['id']}})[_0x76c5('0x25')](handleEntityNotFound(_0x1cadd3,null))[_0x76c5('0x25')](saveUpdates(_0x43bdf6[_0x76c5('0x46')],null))[_0x76c5('0x25')](respondWithResult(_0x1cadd3,null))['catch'](handleError(_0x1cadd3,null));};exports[_0x76c5('0x47')]=function(_0x23323f,_0x4e34e4){return db['WhatsappTransferReport'][_0x76c5('0x44')]({'where':{'id':_0x23323f[_0x76c5('0x41')]['id']}})['then'](handleEntityNotFound(_0x4e34e4,null))['then'](removeEntity(_0x4e34e4,null))[_0x76c5('0x3f')](handleError(_0x4e34e4,null));};exports[_0x76c5('0x48')]=function(_0x152d08,_0x5bc3ff){return db[_0x76c5('0x3c')][_0x76c5('0x48')]()[_0x76c5('0x25')](respondWithResult(_0x5bc3ff,null))[_0x76c5('0x3f')](handleError(_0x5bc3ff,null));}; \ No newline at end of file +var _0x3d0a=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','includeAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x30f08d,_0x1814c9){var _0xcee806=function(_0x459970){while(--_0x459970){_0x30f08d['push'](_0x30f08d['shift']());}};_0xcee806(++_0x1814c9);}(_0x3d0a,0xd4));var _0xa3d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d0a[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xa3d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3d0('0x1'));var jsonpatch=require(_0xa3d0('0x2'));var rp=require(_0xa3d0('0x3'));var moment=require(_0xa3d0('0x4'));var BPromise=require(_0xa3d0('0x5'));var Mustache=require('mustache');var util=require(_0xa3d0('0x6'));var path=require(_0xa3d0('0x7'));var sox=require(_0xa3d0('0x8'));var csv=require(_0xa3d0('0x9'));var ejs=require(_0xa3d0('0xa'));var fs=require('fs');var fs_extra=require(_0xa3d0('0xb'));var _=require(_0xa3d0('0xc'));var squel=require(_0xa3d0('0xd'));var crypto=require(_0xa3d0('0xe'));var jsforce=require(_0xa3d0('0xf'));var deskjs=require(_0xa3d0('0x10'));var toCsv=require(_0xa3d0('0x9'));var querystring=require(_0xa3d0('0x11'));var Papa=require(_0xa3d0('0x12'));var Redis=require(_0xa3d0('0x13'));var authService=require(_0xa3d0('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa3d0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3d0('0x16'))(_0xa3d0('0x17'));var utils=require('../../config/utils');var config=require(_0xa3d0('0x18'));var licenseUtil=require(_0xa3d0('0x19'));var db=require(_0xa3d0('0x1a'))['db'];function respondWithStatusCode(_0x5e27f7,_0x2a6a88){_0x2a6a88=_0x2a6a88||0xcc;return function(_0x5c0e61){if(_0x5c0e61){return _0x5e27f7['sendStatus'](_0x2a6a88);}return _0x5e27f7['status'](_0x2a6a88)[_0xa3d0('0x1b')]();};}function respondWithResult(_0x141e33,_0x3e2a8c){_0x3e2a8c=_0x3e2a8c||0xc8;return function(_0x5910f9){if(_0x5910f9){return _0x141e33[_0xa3d0('0x1c')](_0x3e2a8c)['json'](_0x5910f9);}};}function respondWithFilteredResult(_0x2bd01b,_0x243bca){return function(_0x400b65){if(_0x400b65){var _0x3da978=typeof _0x243bca[_0xa3d0('0x1d')]===_0xa3d0('0x1e')&&typeof _0x243bca['limit']===_0xa3d0('0x1e');var _0x3caece=_0x400b65[_0xa3d0('0x1f')];var _0xd0e169=_0x3da978?0x0:_0x243bca[_0xa3d0('0x1d')];var _0x92586a=_0x3da978?_0x400b65['count']:_0x243bca[_0xa3d0('0x1d')]+_0x243bca[_0xa3d0('0x20')];var _0x1a0182;if(_0x92586a>=_0x3caece){_0x92586a=_0x3caece;_0x1a0182=0xc8;}else{_0x1a0182=0xce;}_0x2bd01b[_0xa3d0('0x1c')](_0x1a0182);return _0x2bd01b[_0xa3d0('0x21')](_0xa3d0('0x22'),_0xd0e169+'-'+_0x92586a+'/'+_0x3caece)[_0xa3d0('0x23')](_0x400b65);}return null;};}function patchUpdates(_0x49ab85){return function(_0x1bf0a6){try{jsonpatch[_0xa3d0('0x24')](_0x1bf0a6,_0x49ab85,!![]);}catch(_0x52ff4c){return BPromise[_0xa3d0('0x25')](_0x52ff4c);}return _0x1bf0a6[_0xa3d0('0x26')]();};}function saveUpdates(_0x1c7f6a,_0x352388){return function(_0x4619bb){if(_0x4619bb){return _0x4619bb[_0xa3d0('0x27')](_0x1c7f6a)[_0xa3d0('0x28')](function(_0x47e2ec){return _0x47e2ec;});}return null;};}function removeEntity(_0x37a0ed,_0xc7f1c8){return function(_0x115ed9){if(_0x115ed9){return _0x115ed9[_0xa3d0('0x29')]()['then'](function(){_0x37a0ed[_0xa3d0('0x1c')](0xcc)[_0xa3d0('0x1b')]();});}};}function handleEntityNotFound(_0x11bd90,_0x4a1d17){return function(_0x50c0e7){if(!_0x50c0e7){_0x11bd90[_0xa3d0('0x2a')](0x194);}return _0x50c0e7;};}function handleError(_0x180706,_0x3bacea){_0x3bacea=_0x3bacea||0x1f4;return function(_0x1643bc){logger[_0xa3d0('0x2b')](_0x1643bc[_0xa3d0('0x2c')]);if(_0x1643bc['name']){delete _0x1643bc[_0xa3d0('0x2d')];}_0x180706[_0xa3d0('0x1c')](_0x3bacea)['send'](_0x1643bc);};}exports[_0xa3d0('0x2e')]=function(_0x4a2e03,_0x4a73e2){var _0x166c6={},_0xe6ecd9={},_0x5b10cd={'count':0x0,'rows':[]};var _0x3e0ce6=_[_0xa3d0('0x2f')](db[_0xa3d0('0x30')][_0xa3d0('0x31')],function(_0x1791d3){return{'name':_0x1791d3[_0xa3d0('0x32')],'type':_0x1791d3[_0xa3d0('0x33')][_0xa3d0('0x34')]};});_0xe6ecd9[_0xa3d0('0x35')]=_[_0xa3d0('0x2f')](_0x3e0ce6,_0xa3d0('0x2d'));_0xe6ecd9[_0xa3d0('0x36')]=_[_0xa3d0('0x37')](_0x4a2e03[_0xa3d0('0x36')]);_0xe6ecd9[_0xa3d0('0x38')]=_['intersection'](_0xe6ecd9[_0xa3d0('0x35')],_0xe6ecd9['query']);_0x166c6[_0xa3d0('0x39')]=_[_0xa3d0('0x3a')](_0xe6ecd9[_0xa3d0('0x35')],qs[_0xa3d0('0x3b')](_0x4a2e03[_0xa3d0('0x36')][_0xa3d0('0x3b')]));_0x166c6[_0xa3d0('0x39')]=_0x166c6[_0xa3d0('0x39')][_0xa3d0('0x3c')]?_0x166c6[_0xa3d0('0x39')]:_0xe6ecd9['model'];if(!_0x4a2e03[_0xa3d0('0x36')]['hasOwnProperty'](_0xa3d0('0x3d'))){_0x166c6['limit']=qs[_0xa3d0('0x20')](_0x4a2e03[_0xa3d0('0x36')]['limit']);_0x166c6['offset']=qs[_0xa3d0('0x1d')](_0x4a2e03[_0xa3d0('0x36')]['offset']);}_0x166c6[_0xa3d0('0x3e')]=qs[_0xa3d0('0x3f')](_0x4a2e03['query'][_0xa3d0('0x3f')]);_0x166c6[_0xa3d0('0x40')]=qs[_0xa3d0('0x38')](_['pick'](_0x4a2e03[_0xa3d0('0x36')],_0xe6ecd9['filters']),_0x3e0ce6);if(_0x4a2e03['query']['filter']){_0x166c6[_0xa3d0('0x40')]=_[_0xa3d0('0x41')](_0x166c6['where'],{'$or':_[_0xa3d0('0x2f')](_0x3e0ce6,function(_0x5e11be){if(_0x5e11be[_0xa3d0('0x33')]!==_0xa3d0('0x42')){var _0x113fa0={};_0x113fa0[_0x5e11be[_0xa3d0('0x2d')]]={'$like':'%'+_0x4a2e03[_0xa3d0('0x36')]['filter']+'%'};return _0x113fa0;}})});}_0x166c6=_[_0xa3d0('0x41')]({},_0x166c6,_0x4a2e03['options']);var _0x482330={'where':_0x166c6[_0xa3d0('0x40')]};return db['WhatsappTransferReport']['count'](_0x482330)['then'](function(_0x7e4ed1){_0x5b10cd[_0xa3d0('0x1f')]=_0x7e4ed1;if(_0x4a2e03['query'][_0xa3d0('0x43')]){_0x166c6['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x166c6);})['then'](function(_0x4a6c8a){_0x5b10cd[_0xa3d0('0x44')]=_0x4a6c8a;return _0x5b10cd;})[_0xa3d0('0x28')](respondWithFilteredResult(_0x4a73e2,_0x166c6))[_0xa3d0('0x45')](handleError(_0x4a73e2,null));};exports[_0xa3d0('0x46')]=function(_0x7caf8b,_0xb00833){var _0x57b177={'raw':!![],'where':{'id':_0x7caf8b[_0xa3d0('0x47')]['id']}},_0x2dba56={};_0x2dba56[_0xa3d0('0x35')]=_['keys'](db['WhatsappTransferReport'][_0xa3d0('0x31')]);_0x2dba56[_0xa3d0('0x36')]=_[_0xa3d0('0x37')](_0x7caf8b[_0xa3d0('0x36')]);_0x2dba56['filters']=_[_0xa3d0('0x3a')](_0x2dba56[_0xa3d0('0x35')],_0x2dba56[_0xa3d0('0x36')]);_0x57b177[_0xa3d0('0x39')]=_[_0xa3d0('0x3a')](_0x2dba56[_0xa3d0('0x35')],qs[_0xa3d0('0x3b')](_0x7caf8b[_0xa3d0('0x36')][_0xa3d0('0x3b')]));_0x57b177['attributes']=_0x57b177[_0xa3d0('0x39')]['length']?_0x57b177[_0xa3d0('0x39')]:_0x2dba56['model'];if(_0x7caf8b[_0xa3d0('0x36')]['includeAll']){_0x57b177[_0xa3d0('0x48')]=[{'all':!![]}];}_0x57b177=_[_0xa3d0('0x41')]({},_0x57b177,_0x7caf8b['options']);return db['WhatsappTransferReport'][_0xa3d0('0x49')](_0x57b177)[_0xa3d0('0x28')](handleEntityNotFound(_0xb00833,null))[_0xa3d0('0x28')](respondWithResult(_0xb00833,null))[_0xa3d0('0x45')](handleError(_0xb00833,null));};exports[_0xa3d0('0x4a')]=function(_0x2c02fe,_0x20679c){return db[_0xa3d0('0x30')][_0xa3d0('0x4a')](_0x2c02fe[_0xa3d0('0x4b')],{})[_0xa3d0('0x28')](respondWithResult(_0x20679c,0xc9))[_0xa3d0('0x45')](handleError(_0x20679c,null));};exports[_0xa3d0('0x27')]=function(_0x399642,_0x17d800){if(_0x399642['body']['id']){delete _0x399642[_0xa3d0('0x4b')]['id'];}return db[_0xa3d0('0x30')][_0xa3d0('0x49')]({'where':{'id':_0x399642[_0xa3d0('0x47')]['id']}})['then'](handleEntityNotFound(_0x17d800,null))[_0xa3d0('0x28')](saveUpdates(_0x399642[_0xa3d0('0x4b')],null))[_0xa3d0('0x28')](respondWithResult(_0x17d800,null))[_0xa3d0('0x45')](handleError(_0x17d800,null));};exports[_0xa3d0('0x29')]=function(_0x46a573,_0x514b82){return db[_0xa3d0('0x30')][_0xa3d0('0x49')]({'where':{'id':_0x46a573['params']['id']}})[_0xa3d0('0x28')](handleEntityNotFound(_0x514b82,null))[_0xa3d0('0x28')](removeEntity(_0x514b82,null))[_0xa3d0('0x45')](handleError(_0x514b82,null));};exports['describe']=function(_0x3138de,_0x944d7b){return db[_0xa3d0('0x30')][_0xa3d0('0x4c')]()[_0xa3d0('0x28')](respondWithResult(_0x944d7b,null))[_0xa3d0('0x45')](handleError(_0x944d7b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fb6ee2d..a16443e 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 _0xd5ee=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x33daf4,_0xd0952){var _0x20f62a=function(_0x55c454){while(--_0x55c454){_0x33daf4['push'](_0x33daf4['shift']());}};_0x20f62a(++_0xd0952);}(_0xd5ee,0x159));var _0xed5e=function(_0x337800,_0x1e986e){_0x337800=_0x337800-0x0;var _0x2caa1d=_0xd5ee[_0x337800];return _0x2caa1d;};'use strict';var _=require(_0xed5e('0x0'));var util=require(_0xed5e('0x1'));var logger=require(_0xed5e('0x2'))('api');var moment=require(_0xed5e('0x3'));var BPromise=require(_0xed5e('0x4'));var rp=require(_0xed5e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed5e('0x6'));var config=require(_0xed5e('0x7'));var attributes=require(_0xed5e('0x8'));module[_0xed5e('0x9')]=function(_0x25f1ce,_0x2f2a7a){return _0x25f1ce['define']('WhatsappTransferReport',attributes,{'tableName':_0xed5e('0xa'),'paranoid':![],'indexes':[{'name':_0xed5e('0xb'),'fields':[_0xed5e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9aa=['uniqueid','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer'];(function(_0x5dde24,_0xf9bb3c){var _0x4761e9=function(_0x472de1){while(--_0x472de1){_0x5dde24['push'](_0x5dde24['shift']());}};_0x4761e9(++_0xf9bb3c);}(_0xf9aa,0x109));var _0xaf9a=function(_0x1ed579,_0x206ebc){_0x1ed579=_0x1ed579-0x0;var _0x793273=_0xf9aa[_0x1ed579];return _0x793273;};'use strict';var _=require('lodash');var util=require(_0xaf9a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xaf9a('0x1'));var BPromise=require(_0xaf9a('0x2'));var rp=require(_0xaf9a('0x3'));var fs=require('fs');var path=require(_0xaf9a('0x4'));var rimraf=require(_0xaf9a('0x5'));var config=require(_0xaf9a('0x6'));var attributes=require(_0xaf9a('0x7'));module[_0xaf9a('0x8')]=function(_0x59bc37,_0x211fa8){return _0x59bc37['define']('WhatsappTransferReport',attributes,{'tableName':_0xaf9a('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaf9a('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 503331e..7f92eea 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 _0xc69f=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c6689,_0x29eae4){var _0x372091=function(_0x522859){while(--_0x522859){_0x5c6689['push'](_0x5c6689['shift']());}};_0x372091(++_0x29eae4);}(_0xc69f,0x1b4));var _0xfc69=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc69f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc69('0x0'));var BPromise=require(_0xfc69('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc69('0x2'));var db=require(_0xfc69('0x3'))['db'];var utils=require(_0xfc69('0x4'));var logger=require(_0xfc69('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfc69('0x6'));var client=jayson[_0xfc69('0x7')][_0xfc69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23db8a,_0x474267,_0x4ea443){return new BPromise(function(_0x3e4535,_0x2425bd){return client[_0xfc69('0x9')](_0x23db8a,_0x4ea443)['then'](function(_0x464516){logger[_0xfc69('0xa')](_0xfc69('0xb'),_0x474267,_0xfc69('0xc'));logger[_0xfc69('0xd')](_0xfc69('0xe'),_0x474267,_0xfc69('0xc'),JSON['stringify'](_0x464516));if(_0x464516[_0xfc69('0xf')]){if(_0x464516['error']['code']===0x1f4){logger[_0xfc69('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x474267,_0x464516['error'][_0xfc69('0x10')]);return _0x2425bd(_0x464516[_0xfc69('0xf')][_0xfc69('0x10')]);}logger[_0xfc69('0xf')](_0xfc69('0xb'),_0x474267,_0x464516[_0xfc69('0xf')][_0xfc69('0x10')]);return _0x3e4535(_0x464516[_0xfc69('0xf')][_0xfc69('0x10')]);}else{logger[_0xfc69('0xa')](_0xfc69('0xb'),_0x474267,_0xfc69('0xc'));_0x3e4535(_0x464516[_0xfc69('0x11')][_0xfc69('0x10')]);}})['catch'](function(_0x115a15){logger[_0xfc69('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x474267,_0x115a15);_0x2425bd(_0x115a15);});});} \ No newline at end of file +var _0x6809=['util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x21e0e3,_0x2152ec){var _0x2c05c2=function(_0x4316be){while(--_0x4316be){_0x21e0e3['push'](_0x21e0e3['shift']());}};_0x2c05c2(++_0x2152ec);}(_0x6809,0xd7));var _0x9680=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x6809[_0x3227c1];return _0x31fd48;};'use strict';var _=require(_0x9680('0x0'));var util=require(_0x9680('0x1'));var moment=require('moment');var BPromise=require(_0x9680('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9680('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9680('0x4'))(_0x9680('0x5'));var config=require(_0x9680('0x6'));var jayson=require(_0x9680('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa692b,_0x54f762,_0x3dab4b){return new BPromise(function(_0x39bf2f,_0xc6ccf8){return client['request'](_0xa692b,_0x3dab4b)['then'](function(_0x1ce7d4){logger[_0x9680('0x8')](_0x9680('0x9'),_0x54f762,_0x9680('0xa'));logger[_0x9680('0xb')](_0x9680('0xc'),_0x54f762,_0x9680('0xa'),JSON['stringify'](_0x1ce7d4));if(_0x1ce7d4[_0x9680('0xd')]){if(_0x1ce7d4[_0x9680('0xd')][_0x9680('0xe')]===0x1f4){logger[_0x9680('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x54f762,_0x1ce7d4[_0x9680('0xd')][_0x9680('0xf')]);return _0xc6ccf8(_0x1ce7d4[_0x9680('0xd')][_0x9680('0xf')]);}logger['error'](_0x9680('0x9'),_0x54f762,_0x1ce7d4[_0x9680('0xd')][_0x9680('0xf')]);return _0x39bf2f(_0x1ce7d4[_0x9680('0xd')]['message']);}else{logger['info'](_0x9680('0x9'),_0x54f762,_0x9680('0xa'));_0x39bf2f(_0x1ce7d4[_0x9680('0x10')]['message']);}})[_0x9680('0x11')](function(_0x5e79b7){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x54f762,_0x5e79b7);_0xc6ccf8(_0x5e79b7);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ce72292..3bcf33e 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ca0=['sequelize','sync','then','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','app','./config/pm2','./config/schedule','./config/schedule/transcribe','./config/schedule/cloud-provider'];(function(_0x96f635,_0x582606){var _0x3b275a=function(_0x1ed897){while(--_0x1ed897){_0x96f635['push'](_0x96f635['shift']());}};_0x3b275a(++_0x582606);}(_0x9ca0,0x65));var _0x09ca=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x9ca0[_0xd39959];return _0x1ff69c;};'use strict';var _=require(_0x09ca('0x0'));var db=require(_0x09ca('0x1'))['db'];var seedDb=require(_0x09ca('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x09ca('0x3'));var config=require(_0x09ca('0x4'));var logger=require('./config/logger')(_0x09ca('0x5'));var pm2=require(_0x09ca('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x09ca('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x09ca('0x8'));var provider=require(_0x09ca('0x9'));function main(){return db[_0x09ca('0xa')][_0x09ca('0xb')]()[_0x09ca('0xc')](function(){if(config['seedDB']){return seedDb['default']();}})[_0x09ca('0xc')](function(){return checkLicense[_0x09ca('0xd')]();})['then'](function(){return rpc[_0x09ca('0xe')]();})[_0x09ca('0xc')](function(_0x34ea15){logger[_0x09ca('0xf')](_0x34ea15);return chat[_0x09ca('0x10')]();})[_0x09ca('0xc')](function(){return whatsapp['start']();})[_0x09ca('0xc')](function(){return schedule[_0x09ca('0x10')]();})['then'](function(){return transcribe[_0x09ca('0x10')]();})['then'](function(){return provider[_0x09ca('0x10')]();})[_0x09ca('0xc')](function(_0x4183aa){logger['info'](_0x4183aa);return pm2['start'](pm2Config);})[_0x09ca('0xc')](function(_0x2fa47e){var _0x51c520=_0x2fa47e[_0x09ca('0x11')](function(_0xdb0c26){return typeof _0xdb0c26[_0x09ca('0x12')]===_0x09ca('0x13')&&_0xdb0c26[_0x09ca('0x12')]>=0x0;});if(_0x51c520[_0x09ca('0x14')]>0x0){throw new Error(_0x51c520[_0x09ca('0x14')]+_0x09ca('0x15')+_[_0x09ca('0x16')](_0x51c520,function(_0x330b88){return'\x22'+_0x330b88[_0x09ca('0x17')][_0x09ca('0x18')]+'\x22';}));}logger['info'](_0x09ca('0x19'),_[_0x09ca('0x16')](_[_0x09ca('0x11')](_0x2fa47e,{'status':_0x09ca('0x1a')}),_0x09ca('0x18'))[_0x09ca('0x1b')]());logger[_0x09ca('0xf')](_0x09ca('0x1c'),_['map'](_[_0x09ca('0x11')](_0x2fa47e,function(_0xfe4fea){return _0xfe4fea[_0x09ca('0x1d')]!=='online';}),_0x09ca('0x18'))[_0x09ca('0x1b')]()||_0x09ca('0x1e'));console[_0x09ca('0x1f')]('App\x20Ready!');})[_0x09ca('0x20')](function(_0xdecfde){console[_0x09ca('0x1f')](_0x09ca('0x21'),_0xdecfde);logger[_0x09ca('0x22')](_0x09ca('0x23'),_0xdecfde);process[_0x09ca('0x24')](0x1);});}main(); \ No newline at end of file +var _0xa4dc=['./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sync','then','seedDB','default','info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','status','join','App\x20Ready!','catch','log','error','exit','lodash'];(function(_0x6a306b,_0x42d80a){var _0x29a0e9=function(_0x5606dd){while(--_0x5606dd){_0x6a306b['push'](_0x6a306b['shift']());}};_0x29a0e9(++_0x42d80a);}(_0xa4dc,0x16a));var _0xca4d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa4dc[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xca4d('0x0'));var db=require(_0xca4d('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0xca4d('0x2'));var config=require(_0xca4d('0x3'));var logger=require(_0xca4d('0x4'))(_0xca4d('0x5'));var pm2=require(_0xca4d('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xca4d('0x7'));var chat=require(_0xca4d('0x8'));var whatsapp=require(_0xca4d('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xca4d('0xa'));function main(){return db['sequelize'][_0xca4d('0xb')]()[_0xca4d('0xc')](function(){if(config[_0xca4d('0xd')]){return seedDb[_0xca4d('0xe')]();}})['then'](function(){return checkLicense[_0xca4d('0xe')]();})[_0xca4d('0xc')](function(){return rpc['listen']();})[_0xca4d('0xc')](function(_0x526d41){logger[_0xca4d('0xf')](_0x526d41);return chat[_0xca4d('0x10')]();})[_0xca4d('0xc')](function(){return whatsapp[_0xca4d('0x10')]();})[_0xca4d('0xc')](function(){return schedule[_0xca4d('0x10')]();})[_0xca4d('0xc')](function(){return transcribe[_0xca4d('0x10')]();})['then'](function(){return provider[_0xca4d('0x10')]();})['then'](function(_0x112ce3){logger[_0xca4d('0xf')](_0x112ce3);return pm2[_0xca4d('0x10')](pm2Config);})['then'](function(_0x47285f){var _0x583328=_0x47285f[_0xca4d('0x11')](function(_0x3dddc8){return typeof _0x3dddc8[_0xca4d('0x12')]===_0xca4d('0x13')&&_0x3dddc8[_0xca4d('0x12')]>=0x0;});if(_0x583328[_0xca4d('0x14')]>0x0){throw new Error(_0x583328[_0xca4d('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xca4d('0x15')](_0x583328,function(_0x20ed84){return'\x22'+_0x20ed84[_0xca4d('0x16')][_0xca4d('0x17')]+'\x22';}));}logger[_0xca4d('0xf')](_0xca4d('0x18'),_[_0xca4d('0x15')](_[_0xca4d('0x11')](_0x47285f,{'status':_0xca4d('0x19')}),'name')['join']());logger[_0xca4d('0xf')]('Offline\x20apps:',_[_0xca4d('0x15')](_['filter'](_0x47285f,function(_0x375efa){return _0x375efa[_0xca4d('0x1a')]!==_0xca4d('0x19');}),_0xca4d('0x17'))[_0xca4d('0x1b')]()||'None');console['log'](_0xca4d('0x1c'));})[_0xca4d('0x1d')](function(_0x371b14){console[_0xca4d('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x371b14);logger[_0xca4d('0x1f')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x371b14);process[_0xca4d('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 7026525..ccaf584 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 _0x54ef=['../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','moment','secrets','session','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','headers','authorization','Basic','User','find','name','authenticate','Wrong\x20credentials.','catch','startsWith','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','blocked','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','encryptString','join','promisify','sign','secret','payload','options','toString','hex','floor','HS512','../../mysqldb','../../config/environment'];(function(_0x2bdff1,_0x3faac6){var _0x491a00=function(_0x2bfe3d){while(--_0x2bfe3d){_0x2bdff1['push'](_0x2bdff1['shift']());}};_0x491a00(++_0x3faac6);}(_0x54ef,0x112));var _0xf54e=function(_0x1ba368,_0x4c6010){_0x1ba368=_0x1ba368-0x0;var _0x32a6a1=_0x54ef[_0x1ba368];return _0x32a6a1;};'use strict';var db=require(_0xf54e('0x0'))['db'];var config=require(_0xf54e('0x1'));var hardwareConf=require(_0xf54e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xf54e('0x3'));var _=require(_0xf54e('0x4'));var jwt=require(_0xf54e('0x5'));var expressJwt=require(_0xf54e('0x6'));var compose=require(_0xf54e('0x7'));var basicAuth=require(_0xf54e('0x8'));var crypto=require(_0xf54e('0x9'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xf54e('0xa'));var validateJwt=expressJwt({'secret':config[_0xf54e('0xb')][_0xf54e('0xc')]});var userAttributes=['id','role',_0xf54e('0xd'),'name',_0xf54e('0xe'),_0xf54e('0xf'),'userpic',_0xf54e('0x10'),_0xf54e('0x11'),_0xf54e('0x12'),_0xf54e('0x13'),'mailPause',_0xf54e('0x14'),_0xf54e('0x15'),_0xf54e('0x16'),_0xf54e('0x17'),'showWebBar',_0xf54e('0x18'),'lastPauseAt','crudPermissions',_0xf54e('0x19'),_0xf54e('0x1a'),_0xf54e('0x1b'),_0xf54e('0x1c'),'phoneBarAutoAnswerDelay',_0xf54e('0x1d'),_0xf54e('0x1e'),_0xf54e('0x1f'),_0xf54e('0x20'),'phoneBarExpires',_0xf54e('0x21'),_0xf54e('0x22'),_0xf54e('0x23'),'hotdesk','interface',_0xf54e('0x24'),_0xf54e('0x25'),_0xf54e('0x26'),_0xf54e('0x27'),_0xf54e('0x28'),_0xf54e('0x29'),_0xf54e('0x2a'),_0xf54e('0x2b'),_0xf54e('0x2c'),_0xf54e('0x2d'),_0xf54e('0x2e'),'emailAutoanswer','emailAutoanswerDelay',_0xf54e('0x2f'),'smsAutoanswerDelay',_0xf54e('0x30'),_0xf54e('0x31'),_0xf54e('0x32'),_0xf54e('0x33'),_0xf54e('0x34'),_0xf54e('0x35')];exports[_0xf54e('0x36')]=function(){return this[_0xf54e('0x37')](!![])[_0xf54e('0x38')](function(_0x5f9eea,_0x1c58bd,_0x5b83df){if(_0x5f9eea[_0xf54e('0x39')]){_0x5b83df();}else{return db['ChatInteraction'][_0xf54e('0x3a')]({'where':{'id':_0x5f9eea[_0xf54e('0x3b')]['id']},'attributes':['id',_0xf54e('0x3c'),_0xf54e('0x3d')],'raw':!![]})[_0xf54e('0x3e')](function(_0x160160){if(_0x160160&&_0x160160[_0xf54e('0x3c')]){return _0x1c58bd[_0xf54e('0x3f')](_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?0x195:0x193)[_0xf54e('0x41')]({'message':_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?'Unmanaged.':_0xf54e('0x42')});}else{_0x5b83df();}})['catch'](function(_0x282c63){_0x5b83df(_0x282c63);});}});};exports['isAuthenticated']=function isAuthenticated(_0x15b888){return compose()[_0xf54e('0x38')](function(_0x21ba00,_0xa13cd0,_0x25b643){var _0x3993e4;if(_0x21ba00[_0xf54e('0x43')]['authorization']){if(_['startsWith'](_0x21ba00[_0xf54e('0x43')][_0xf54e('0x44')],_0xf54e('0x45'))){var _0x16d00f=basicAuth(_0x21ba00);db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'name':_0x16d00f[_0xf54e('0x48')]}})[_0xf54e('0x3e')](function(_0x3ae704){if(!_0x3ae704||!_0x3ae704[_0xf54e('0x49')](_0x16d00f['pass'])){return _0xa13cd0['status'](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x4a')});}_0x21ba00['user']={'id':_0x3ae704['id']};_0x25b643();})[_0xf54e('0x4b')](function(_0x82e313){_0x25b643(_0x82e313);});}else if(_[_0xf54e('0x4c')](_0x21ba00[_0xf54e('0x43')]['authorization'],'Bearer')){validateJwt(_0x21ba00,_0xa13cd0,_0x25b643);}else{if(_0x15b888){_0x25b643();}else{return _0xa13cd0['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x4d')});}}}else if(_0x21ba00[_0xf54e('0x4e')][_0xf54e('0x4f')]){try{var _0x29dc39={'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x21ba00['query']['apikey'],_0x29dc39)[_0xf54e('0x3e')](function(_0x734187){return db['User']['find']({'where':{'id':_0x734187[_0xf54e('0x51')]}})[_0xf54e('0x3e')](function(_0x173e6c){_0x3993e4=_0x173e6c;return db['Setting'][_0xf54e('0x3a')]({'where':{'id':0x1},'attributes':[_0xf54e('0x52'),'blockDuration'],'raw':!![]});})[_0xf54e('0x3e')](function(_0x6e5bdf){if(!_0x3993e4||!_[_0xf54e('0x53')](_0x3993e4[_0xf54e('0x54')],_0x734187[_0xf54e('0x55')])){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3993e4[_0xf54e('0x56')]){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3993e4[_0xf54e('0x57')]){if(_0x6e5bdf[_0xf54e('0x58')]>0x0){if(moment(_0x3993e4[_0xf54e('0x59')])[_0xf54e('0x5a')](_0x6e5bdf[_0xf54e('0x58')],_0xf54e('0x5b'))>moment()){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}else{return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}_0x21ba00[_0xf54e('0x39')]={'id':_0x3993e4['id']};_0x25b643();});})[_0xf54e('0x4b')](function(){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x533423){_0x25b643(_0x533423);}}else if(_0x15b888){_0x25b643();}else{return _0xa13cd0[_0xf54e('0x3f')](0x193)[_0xf54e('0x41')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf54e('0x38')](function(_0x311ce1,_0x381c03,_0x4f61d7){if(_0x311ce1[_0xf54e('0x39')]){db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'id':_0x311ce1[_0xf54e('0x39')]['id']},'attributes':userAttributes})[_0xf54e('0x3e')](function(_0x143a39){if(!_0x143a39){return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5d')});}_0x311ce1['user']=_0x143a39;_0x4f61d7();})[_0xf54e('0x4b')](function(_0x3447fd){_0x4f61d7(_0x3447fd);});}else if(_0x15b888){_0x4f61d7();}else{return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5e')});}});};exports[_0xf54e('0x5f')]=function canUpdate(){return compose()['use'](function(_0x23a4a1,_0x59af72,_0x1d16e0){return licenseUtil['getLicense']()[_0xf54e('0x3e')](function(_0x331b16){if(_0x331b16[_0xf54e('0x60')]){_0x1d16e0();}else{return _0x59af72['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0x32fb46){_0x1d16e0(_0x32fb46);});});};exports[_0xf54e('0x62')]=function isWebrtcLicence(){return compose()['use'](function(_0x427799,_0x297737,_0x346bb4){return licenseUtil[_0xf54e('0x63')]()['then'](function(_0x1bdb5a){if(_0x1bdb5a[_0xf54e('0x64')]){_0x346bb4();}else{return _0x297737['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0xca0141){_0x346bb4(_0xca0141);});});};exports['isMiddleware']=function(_0x196e68,_0x2b645e,_0x2527f6){_0x196e68[_0xf54e('0x65')]=!![];return _0x2527f6();};exports[_0xf54e('0x66')]=function signToken(_0x3237ef){return signJwt(_0x3237ef);};exports[_0xf54e('0x67')]=function(_0xd7b0c5,_0x15bfef){if(!_0xd7b0c5[_0xf54e('0x39')]){return _0x15bfef[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x68')});}var _0x2de1fe={'payload':{'id':_0xd7b0c5[_0xf54e('0x39')]['id'],'role':_0xd7b0c5[_0xf54e('0x39')][_0xf54e('0x69')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2de1fe)[_0xf54e('0x3e')](function(_0x21fd80){_0x15bfef[_0xf54e('0x6a')]('motion.token',_0x21fd80);_0x15bfef['redirect'](_0xf54e('0x6b'));})[_0xf54e('0x4b')](function(_0x45861b){return _0x15bfef[_0xf54e('0x3f')](0x1f4)[_0xf54e('0x6c')](_0x45861b);});};exports[_0xf54e('0x6d')]=function(_0x22763f){if(_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x54')])||_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x6f')])){return null;}else{return createJwt(_0x22763f);}};exports['generateApiKey']=function(_0x2aacf6){_0x2aacf6[_0xf54e('0x54')]=generateNonce();_0x2aacf6[_0xf54e('0x6f')]=generateIssuedAt();return createJwt(_0x2aacf6);};exports[_0xf54e('0x70')]=function(_0x1b8f16,_0x30f53b){var _0x18a25f=_0x1b8f16['query'][_0xf54e('0x4f')];if(_0x18a25f){var _0x5fabd2={'nonce':_0x30f53b[_0xf54e('0x54')],'iat':_0x30f53b['apiKeyIat'],'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x18a25f,_0x5fabd2)[_0xf54e('0x3e')](function(){return generateApiKey(_0x30f53b);});}else{throw{'message':_0xf54e('0x71')};}};exports[_0xf54e('0x72')]=function(_0x5b882f){var _0x1d8ccf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1d8ccf[_0xf54e('0x73')](_0x5b882f))throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0xf54e('0x76'));return;};exports[_0xf54e('0x77')]=function(_0x21d485,_0x55d57f,_0x55de5c){var _0x4270e1=encryptor[_0xf54e('0x78')](_0x55d57f)['split'](',');for(var _0x29743e=0x0;_0x29743e<_0x55de5c;_0x29743e++){if(!_0x4270e1[_0x29743e])break;if(_0x21d485['toLowerCase']()===_0x4270e1[_0x29743e][_0xf54e('0x79')]()){var _0x528a64=util[_0xf54e('0x7a')](_0xf54e('0x7b'),_0x55de5c);if(_0x55de5c===0x1){_0x528a64=_0xf54e('0x7c');}throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0x528a64);}}return;};exports[_0xf54e('0x7d')]=function(_0x556e55,_0x479572){var _0x79345=_0x479572?encryptor[_0xf54e('0x78')](_0x479572)['split'](','):[];if(_0x79345['length']===0x5){_0x79345[_0xf54e('0x7e')](-0x1,0x1);}_0x79345['unshift'](_0x556e55);return encryptor[_0xf54e('0x7f')](_0x79345[_0xf54e('0x80')](','));};function signJwt(_0x47596c){var _0x2b11f8=BPromise[_0xf54e('0x81')](jwt[_0xf54e('0x82')],{'context':jwt});var _0x3bf476=_0x47596c[_0xf54e('0x83')]||config[_0xf54e('0xb')][_0xf54e('0xc')];return new BPromise(function(_0x1f9dad,_0x2c6d0e){_0x2b11f8(_0x47596c[_0xf54e('0x84')],_0x3bf476,_0x47596c[_0xf54e('0x85')])['then'](function(_0x302f3d){_0x1f9dad(_0x302f3d);})[_0xf54e('0x4b')](function(_0xb7ff4d){_0x2c6d0e(_0xb7ff4d);});});}function verifyJwt(_0x11908b,_0x1e4c0d,_0x494629){var _0xf50b1b=BPromise[_0xf54e('0x81')](jwt['verify'],{'context':jwt});var _0x51ec35=_0x494629||config[_0xf54e('0xb')]['session'];return new BPromise(function(_0x26322a,_0x39c5eb){_0xf50b1b(_0x11908b,_0x51ec35,_0x1e4c0d)[_0xf54e('0x3e')](function(_0x9789b9){_0x26322a(_0x9789b9);})['catch'](function(_0x2ecda1){_0x39c5eb(_0x2ecda1);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xf54e('0x86')](_0xf54e('0x87'));}function generateIssuedAt(){return Math[_0xf54e('0x88')](Date['now']()/0x3e8)[_0xf54e('0x86')]();}function createJwt(_0x504ec7){var _0x3f7224={'payload':{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce']},'options':{'algorithm':_0xf54e('0x89'),'subject':_0x504ec7['id']['toString'](),'issuer':hardwareConf[_0xf54e('0x50')](),'audience':hardwareConf[_0xf54e('0x50')]()}};return signJwt(_0x3f7224)[_0xf54e('0x3e')](function(_0x38405c){return{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce'],'token':_0x38405c};});} \ No newline at end of file +var _0x70e0=['express-jwt','composable-middleware','crypto','util','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','authenticate','Bearer','status','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','splice','encryptString','promisify','sign','secret','secrets','session','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken'];(function(_0x35b7b3,_0x62c34e){var _0x5afb26=function(_0x279557){while(--_0x279557){_0x35b7b3['push'](_0x35b7b3['shift']());}};_0x5afb26(++_0x62c34e);}(_0x70e0,0x17b));var _0x070e=function(_0x1f4b15,_0x41e2de){_0x1f4b15=_0x1f4b15-0x0;var _0x222f91=_0x70e0[_0x1f4b15];return _0x222f91;};'use strict';var db=require(_0x070e('0x0'))['db'];var config=require(_0x070e('0x1'));var hardwareConf=require(_0x070e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x070e('0x3'));var jwt=require(_0x070e('0x4'));var expressJwt=require(_0x070e('0x5'));var compose=require(_0x070e('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x070e('0x7'));var BPromise=require('bluebird');var util=require(_0x070e('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x070e('0x9'),_0x070e('0xa'),_0x070e('0xb'),_0x070e('0xc'),_0x070e('0xd'),_0x070e('0xe'),_0x070e('0xf'),'md5secret','voicePause',_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13'),_0x070e('0x14'),_0x070e('0x15'),_0x070e('0x16'),_0x070e('0x17'),_0x070e('0x18'),_0x070e('0x19'),_0x070e('0x1a'),'passwordResetAt','alias',_0x070e('0x1b'),'phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording',_0x070e('0x1c'),_0x070e('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0x070e('0x1e'),_0x070e('0x1f'),_0x070e('0x20'),_0x070e('0x21'),'userProfileId','privacyEnabled',_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26'),'ignorePauseForPreviewCalls',_0x070e('0x27'),_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a'),_0x070e('0x2b'),'smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer',_0x070e('0x2c'),_0x070e('0x2d'),_0x070e('0x2e'),'whatsappAutoanswer',_0x070e('0x2f')];exports['isChatInteractionAuthorized']=function(){return this[_0x070e('0x30')](!![])[_0x070e('0x31')](function(_0x27a01e,_0x33e8c6,_0x28a1c3){if(_0x27a01e[_0x070e('0x32')]){_0x28a1c3();}else{return db[_0x070e('0x33')][_0x070e('0x34')]({'where':{'id':_0x27a01e['params']['id']},'attributes':['id',_0x070e('0x35'),_0x070e('0x36')],'raw':!![]})[_0x070e('0x37')](function(_0x503f4d){if(_0x503f4d&&_0x503f4d[_0x070e('0x35')]){return _0x33e8c6['status'](_0x503f4d['disposition']===_0x070e('0x38')?0x195:0x193)[_0x070e('0x39')]({'message':_0x503f4d[_0x070e('0x36')]===_0x070e('0x38')?_0x070e('0x3a'):'Forbidden.'});}else{_0x28a1c3();}})[_0x070e('0x3b')](function(_0x219e48){_0x28a1c3(_0x219e48);});}});};exports[_0x070e('0x30')]=function isAuthenticated(_0x1d2a34){return compose()[_0x070e('0x31')](function(_0x28d7f2,_0x1a1892,_0x26373b){var _0x5e8326;if(_0x28d7f2[_0x070e('0x3c')][_0x070e('0x3d')]){if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x3f'))){var _0x46065c=basicAuth(_0x28d7f2);db[_0x070e('0x40')]['find']({'where':{'name':_0x46065c[_0x070e('0xb')]}})[_0x070e('0x37')](function(_0x3a9425){if(!_0x3a9425||!_0x3a9425[_0x070e('0x41')](_0x46065c['pass'])){return _0x1a1892['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x28d7f2[_0x070e('0x32')]={'id':_0x3a9425['id']};_0x26373b();})['catch'](function(_0x1dff97){_0x26373b(_0x1dff97);});}else if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x42'))){validateJwt(_0x28d7f2,_0x1a1892,_0x26373b);}else{if(_0x1d2a34){_0x26373b();}else{return _0x1a1892[_0x070e('0x43')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x28d7f2[_0x070e('0x44')][_0x070e('0x45')]){try{var _0x444d02={'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};verifyJwt(_0x28d7f2['query']['apikey'],_0x444d02)[_0x070e('0x37')](function(_0x3011c4){return db[_0x070e('0x40')][_0x070e('0x47')]({'where':{'id':_0x3011c4[_0x070e('0x48')]}})['then'](function(_0x22f3a9){_0x5e8326=_0x22f3a9;return db[_0x070e('0x49')]['findOne']({'where':{'id':0x1},'attributes':[_0x070e('0x4a'),_0x070e('0x4b')],'raw':!![]});})['then'](function(_0x4d4ee8){if(!_0x5e8326||!_['isEqual'](_0x5e8326[_0x070e('0x4c')],_0x3011c4[_0x070e('0x4d')])){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4e')});}if(_0x5e8326['disabled']){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}if(_0x5e8326['blocked']){if(_0x4d4ee8[_0x070e('0x4b')]>0x0){if(moment(_0x5e8326[_0x070e('0x50')])[_0x070e('0x51')](_0x4d4ee8['blockDuration'],_0x070e('0x52'))>moment()){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});}}else{return _0x1a1892['status'](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}}_0x28d7f2[_0x070e('0x32')]={'id':_0x5e8326['id']};_0x26373b();});})[_0x070e('0x3b')](function(){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});});}catch(_0x5db2ce){_0x26373b(_0x5db2ce);}}else if(_0x1d2a34){_0x26373b();}else{return _0x1a1892['status'](0x193)[_0x070e('0x39')]({'message':_0x070e('0x53')});}})[_0x070e('0x31')](function(_0x4d52ff,_0x2ad56c,_0x1223be){if(_0x4d52ff[_0x070e('0x32')]){db[_0x070e('0x40')]['find']({'where':{'id':_0x4d52ff[_0x070e('0x32')]['id']},'attributes':userAttributes})['then'](function(_0x544b53){if(!_0x544b53){return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':_0x070e('0x54')});}_0x4d52ff[_0x070e('0x32')]=_0x544b53;_0x1223be();})[_0x070e('0x3b')](function(_0x34f23e){_0x1223be(_0x34f23e);});}else if(_0x1d2a34){_0x1223be();}else{return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x070e('0x55')]=function canUpdate(){return compose()[_0x070e('0x31')](function(_0xff760c,_0x52fcea,_0x54285a){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x35349f){if(_0x35349f[_0x070e('0x57')]){_0x54285a();}else{return _0x52fcea[_0x070e('0x43')](0x193)['json']({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x48d836){_0x54285a(_0x48d836);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x070e('0x31')](function(_0x945901,_0x2d43ce,_0x1fc7c4){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x20b80e){if(_0x20b80e[_0x070e('0x59')]){_0x1fc7c4();}else{return _0x2d43ce[_0x070e('0x43')](0x193)[_0x070e('0x39')]({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x1f54d5){_0x1fc7c4(_0x1f54d5);});});};exports[_0x070e('0x5a')]=function(_0xd67987,_0x66a3f3,_0x210c4d){_0xd67987[_0x070e('0x5a')]=!![];return _0x210c4d();};exports[_0x070e('0x5b')]=function signToken(_0x216d27){return signJwt(_0x216d27);};exports[_0x070e('0x5c')]=function(_0x5e051a,_0x171621){if(!_0x5e051a[_0x070e('0x32')]){return _0x171621[_0x070e('0x43')](0x194)[_0x070e('0x39')]({'message':_0x070e('0x5d')});}var _0x3bd738={'payload':{'id':_0x5e051a[_0x070e('0x32')]['id'],'role':_0x5e051a[_0x070e('0x32')][_0x070e('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3bd738)['then'](function(_0x251696){_0x171621['cookie'](_0x070e('0x5e'),_0x251696);_0x171621[_0x070e('0x5f')]('/dashboards/general');})[_0x070e('0x3b')](function(_0x130a50){return _0x171621[_0x070e('0x43')](0x1f4)[_0x070e('0x60')](_0x130a50);});};exports[_0x070e('0x61')]=function(_0x1e8a4f){if(_[_0x070e('0x62')](_0x1e8a4f['apiKeyNonce'])||_[_0x070e('0x62')](_0x1e8a4f['apiKeyIat'])){return null;}else{return createJwt(_0x1e8a4f);}};exports['generateApiKey']=function(_0x3a06c6){_0x3a06c6[_0x070e('0x4c')]=generateNonce();_0x3a06c6[_0x070e('0x63')]=generateIssuedAt();return createJwt(_0x3a06c6);};exports[_0x070e('0x64')]=function(_0x202015,_0x7948ed){var _0x440fa1=_0x202015[_0x070e('0x44')]['apikey'];if(_0x440fa1){var _0x477e69={'nonce':_0x7948ed['apiKeyNonce'],'iat':_0x7948ed['apiKeyIat'],'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};return verifyJwt(_0x440fa1,_0x477e69)['then'](function(){return generateApiKey(_0x7948ed);});}else{throw{'message':_0x070e('0x65')};}};exports[_0x070e('0x66')]=function(_0x210f4a){var _0x2f8104=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2f8104[_0x070e('0x67')](_0x210f4a))throw new db[(_0x070e('0x68'))][(_0x070e('0x69'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x5943e3,_0x3087e5,_0x1948a5){var _0x29f497=encryptor[_0x070e('0x6a')](_0x3087e5)['split'](',');for(var _0x25f34c=0x0;_0x25f34c<_0x1948a5;_0x25f34c++){if(!_0x29f497[_0x25f34c])break;if(_0x5943e3['toLowerCase']()===_0x29f497[_0x25f34c][_0x070e('0x6b')]()){var _0x1cbb7e=util[_0x070e('0x6c')](_0x070e('0x6d'),_0x1948a5);if(_0x1948a5===0x1){_0x1cbb7e=_0x070e('0x6e');}throw new db[(_0x070e('0x68'))]['ValidationError'](_0x1cbb7e);}}return;};exports[_0x070e('0x6f')]=function(_0x18e8d0,_0x8aaf00){var _0x533431=_0x8aaf00?encryptor[_0x070e('0x6a')](_0x8aaf00)[_0x070e('0x70')](','):[];if(_0x533431['length']===0x5){_0x533431[_0x070e('0x71')](-0x1,0x1);}_0x533431['unshift'](_0x18e8d0);return encryptor[_0x070e('0x72')](_0x533431['join'](','));};function signJwt(_0x4cb86f){var _0x4b354d=BPromise[_0x070e('0x73')](jwt[_0x070e('0x74')],{'context':jwt});var _0x1100d8=_0x4cb86f[_0x070e('0x75')]||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x498bc6,_0x841c89){_0x4b354d(_0x4cb86f['payload'],_0x1100d8,_0x4cb86f[_0x070e('0x78')])['then'](function(_0x2e10f7){_0x498bc6(_0x2e10f7);})[_0x070e('0x3b')](function(_0x5b0b46){_0x841c89(_0x5b0b46);});});}function verifyJwt(_0x1bcdc3,_0x50399e,_0x1a9e25){var _0x139630=BPromise[_0x070e('0x73')](jwt[_0x070e('0x79')],{'context':jwt});var _0x764b06=_0x1a9e25||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x148f1d,_0x3ef9cc){_0x139630(_0x1bcdc3,_0x764b06,_0x50399e)[_0x070e('0x37')](function(_0x40c560){_0x148f1d(_0x40c560);})[_0x070e('0x3b')](function(_0x455bf2){_0x3ef9cc(_0x455bf2);});});}function generateNonce(){return crypto[_0x070e('0x7a')](0x10)['toString'](_0x070e('0x7b'));}function generateIssuedAt(){return Math[_0x070e('0x7c')](Date[_0x070e('0x7d')]()/0x3e8)[_0x070e('0x7e')]();}function createJwt(_0x5712d1){var _0x2ccd8d={'payload':{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')]},'options':{'algorithm':_0x070e('0x7f'),'subject':_0x5712d1['id'][_0x070e('0x7e')](),'issuer':hardwareConf[_0x070e('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2ccd8d)[_0x070e('0x37')](function(_0x7d154){return{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')],'token':_0x7d154};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 506e94e..108f3a2 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 _0x3f14=['../../mysqldb','findAll','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','where','fields','filter','user','skip','checkListsRestrictions','then','ids','tag','countFilteredContacts','count','User','buildContactsQuery','clause','getFilteredContacts','rows','catch','describe','CmContact','keys','CmCustomField','slice','all','length','cf_','fieldType','type','map','lodash','./sql-utils'];(function(_0x547c2a,_0x42e032){var _0x4206c9=function(_0x4ae715){while(--_0x4ae715){_0x547c2a['push'](_0x547c2a['shift']());}};_0x4206c9(++_0x42e032);}(_0x3f14,0xdc));var _0x43f1=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x3f14[_0x1deb72];return _0x18bbdf;};'use strict';var _=require(_0x43f1('0x0'));var sqlUtils=require(_0x43f1('0x1'));var db=require(_0x43f1('0x2'))['db'];exports[_0x43f1('0x3')]=function(_0x2bfebc,_0x5da12d,_0xb82bfc,_0x35ff8b){var _0x1d0ca8={'count':0x0,'rows':[]};var _0x33497e=sqlUtils['skipContactsQuery'](_0x5da12d,_0x2bfebc);if(_0x33497e){return Promise[_0x43f1('0x4')](_0x1d0ca8);}var _0x1c827e=sqlUtils[_0x43f1('0x5')]();var _0x52be8f={};var _0x398aca=![];var _0x1bba6f=![];return Promise[_0x43f1('0x4')]()['then'](function(){if(_0x2bfebc[_0x43f1('0x6')]){return sqlUtils[_0x43f1('0x7')](_0x2bfebc[_0x43f1('0x6')],_0x35ff8b);}else{return sqlUtils[_0x43f1('0x8')](_0x2bfebc,_0x35ff8b);}})['then'](function(_0x54865d){_0x1c827e[_0x43f1('0x9')](_0x54865d['default']);_0x1c827e['where'](_0x54865d[_0x43f1('0xa')]);_0x1c827e[_0x43f1('0x9')](_0x54865d[_0x43f1('0xb')]);_0x1c827e['where'](_0x54865d[_0x43f1('0xc')]['clause']);_0x52be8f=_0x54865d['tags'];_0x1bba6f=_0x54865d[_0x43f1('0xc')][_0x43f1('0xd')];return sqlUtils[_0x43f1('0xe')](_0x5da12d,_0x2bfebc,_0x1bba6f);})[_0x43f1('0xf')](function(_0x21f826){_0x1c827e[_0x43f1('0x9')](_0x21f826);var _0x3a838f=_0x2bfebc[_0x43f1('0x6')]?_0x52be8f[_0x43f1('0x10')]:_0x2bfebc[_0x43f1('0x11')];_0x398aca=_0x3a838f?!![]:![];return sqlUtils[_0x43f1('0x12')](_0x1c827e,_0x3a838f);})[_0x43f1('0xf')](function(_0xa24813){_0x1d0ca8[_0x43f1('0x13')]=_0xa24813;if(_0x1d0ca8[_0x43f1('0x13')]===0x0){return;}if(_0x2bfebc[_0x43f1('0x14')]){_0x1bba6f=!![];}return sqlUtils[_0x43f1('0x15')](_0x1c827e,_0x2bfebc[_0x43f1('0xa')],_0xb82bfc,_0x398aca,_0x52be8f[_0x43f1('0x16')],_0x1bba6f);})[_0x43f1('0xf')](function(_0x4672e0){if(!_0x4672e0){return[];}return sqlUtils[_0x43f1('0x17')](_0x4672e0,_0x2bfebc,_0xb82bfc);})[_0x43f1('0xf')](function(_0x325952){_0x1d0ca8[_0x43f1('0x18')]=_0x325952;return _0x1d0ca8;})[_0x43f1('0x19')](function(_0x59de8d){throw _0x59de8d;});};exports[_0x43f1('0x1a')]=function(){var _0x5ca098={};var _0x55ee4a=[];return db[_0x43f1('0x1b')][_0x43f1('0x1a')]()['then'](function(_0x792ba9){_0x5ca098=_0x792ba9;var _0x1a47e8=Object[_0x43f1('0x1c')](_0x5ca098)['filter'](function(_0x1e10a2){return _['startsWith'](_0x1e10a2,'cf_')?_0x1e10a2:undefined;});var _0xfed2e=_0x1a47e8['map'](function(_0x1dcd5b){return db[_0x43f1('0x1d')]['findOne']({'where':{'id':_0x1dcd5b[_0x43f1('0x1e')](0x3)},'raw':!![]});});return Promise[_0x43f1('0x1f')](_0xfed2e);})[_0x43f1('0xf')](function(_0x22e89a){for(var _0x1b1eeb=0x0;_0x1b1eeb<_0x22e89a[_0x43f1('0x20')];_0x1b1eeb++){if(_0x22e89a[_0x1b1eeb]){var _0x24d7bb=_0x43f1('0x21')+_0x22e89a[_0x1b1eeb]['id'];_0x5ca098[_0x24d7bb][_0x43f1('0x22')]=_0x22e89a[_0x1b1eeb][_0x43f1('0x23')];}}_0x55ee4a=_[_0x43f1('0x24')](Object[_0x43f1('0x1c')](_0x5ca098),function(_0x3ba274){return{'name':_0x3ba274,'type':_0x5ca098[_0x3ba274][_0x43f1('0x23')]};});return _0x55ee4a;})[_0x43f1('0x19')](function(_0x15f6cd){throw _0x15f6cd;});}; \ No newline at end of file +var _0x8501=['rows','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','slice','all','length','fieldType','type','catch','lodash','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','fields','filter','user','clause','tags','skip','checkListsRestrictions','tag','countFilteredContacts','count','User','getFilteredContacts'];(function(_0x33adf2,_0x3f8072){var _0x1dc978=function(_0x30b961){while(--_0x30b961){_0x33adf2['push'](_0x33adf2['shift']());}};_0x1dc978(++_0x3f8072);}(_0x8501,0x136));var _0x1850=function(_0x3256bc,_0x957b5c){_0x3256bc=_0x3256bc-0x0;var _0x51f4b7=_0x8501[_0x3256bc];return _0x51f4b7;};'use strict';var _=require(_0x1850('0x0'));var sqlUtils=require(_0x1850('0x1'));var db=require(_0x1850('0x2'))['db'];exports[_0x1850('0x3')]=function(_0xd96e7f,_0x3979b8,_0x414eae,_0x5813f3){var _0x53988c={'count':0x0,'rows':[]};var _0xbdc715=sqlUtils['skipContactsQuery'](_0x3979b8,_0xd96e7f);if(_0xbdc715){return Promise[_0x1850('0x4')](_0x53988c);}var _0x22037a=sqlUtils[_0x1850('0x5')]();var _0x43532a={};var _0x23a085=![];var _0x4348db=![];return Promise[_0x1850('0x4')]()[_0x1850('0x6')](function(){if(_0xd96e7f['search']){return sqlUtils[_0x1850('0x7')](_0xd96e7f[_0x1850('0x8')],_0x5813f3);}else{return sqlUtils[_0x1850('0x9')](_0xd96e7f,_0x5813f3);}})['then'](function(_0x509563){_0x22037a[_0x1850('0xa')](_0x509563['default']);_0x22037a[_0x1850('0xa')](_0x509563[_0x1850('0xb')]);_0x22037a[_0x1850('0xa')](_0x509563[_0x1850('0xc')]);_0x22037a['where'](_0x509563[_0x1850('0xd')][_0x1850('0xe')]);_0x43532a=_0x509563[_0x1850('0xf')];_0x4348db=_0x509563['user'][_0x1850('0x10')];return sqlUtils[_0x1850('0x11')](_0x3979b8,_0xd96e7f,_0x4348db);})[_0x1850('0x6')](function(_0x4ff200){_0x22037a[_0x1850('0xa')](_0x4ff200);var _0x3196a6=_0xd96e7f[_0x1850('0x8')]?_0x43532a['ids']:_0xd96e7f[_0x1850('0x12')];_0x23a085=_0x3196a6?!![]:![];return sqlUtils[_0x1850('0x13')](_0x22037a,_0x3196a6);})[_0x1850('0x6')](function(_0xf90ff0){_0x53988c[_0x1850('0x14')]=_0xf90ff0;if(_0x53988c['count']===0x0){return;}if(_0xd96e7f[_0x1850('0x15')]){_0x4348db=!![];}return sqlUtils['buildContactsQuery'](_0x22037a,_0xd96e7f[_0x1850('0xb')],_0x414eae,_0x23a085,_0x43532a[_0x1850('0xe')],_0x4348db);})['then'](function(_0x5e28f3){if(!_0x5e28f3){return[];}return sqlUtils[_0x1850('0x16')](_0x5e28f3,_0xd96e7f,_0x414eae);})[_0x1850('0x6')](function(_0x13c903){_0x53988c[_0x1850('0x17')]=_0x13c903;return _0x53988c;})['catch'](function(_0x39a0d1){throw _0x39a0d1;});};exports[_0x1850('0x18')]=function(){var _0x1ef35c={};var _0x467f21=[];return db[_0x1850('0x19')]['describe']()[_0x1850('0x6')](function(_0x3355ce){_0x1ef35c=_0x3355ce;var _0xf66803=Object[_0x1850('0x1a')](_0x1ef35c)[_0x1850('0xc')](function(_0x4495cd){return _[_0x1850('0x1b')](_0x4495cd,_0x1850('0x1c'))?_0x4495cd:undefined;});var _0x519289=_0xf66803[_0x1850('0x1d')](function(_0x11842e){return db[_0x1850('0x1e')]['findOne']({'where':{'id':_0x11842e[_0x1850('0x1f')](0x3)},'raw':!![]});});return Promise[_0x1850('0x20')](_0x519289);})['then'](function(_0x356804){for(var _0x3faf3c=0x0;_0x3faf3c<_0x356804[_0x1850('0x21')];_0x3faf3c++){if(_0x356804[_0x3faf3c]){var _0x2149a7='cf_'+_0x356804[_0x3faf3c]['id'];_0x1ef35c[_0x2149a7][_0x1850('0x22')]=_0x356804[_0x3faf3c]['type'];}}_0x467f21=_[_0x1850('0x1d')](Object[_0x1850('0x1a')](_0x1ef35c),function(_0x2e84bb){return{'name':_0x2e84bb,'type':_0x1ef35c[_0x2e84bb][_0x1850('0x23')]};});return _0x467f21;})[_0x1850('0x24')](function(_0x407410){throw _0x407410;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 0d1dd40..767e192 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 _0x29f5=['QueryTypes','SELECT','toString','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','fax','email','ListId','createdAt','updatedAt','deletedAt','TagIds','includes','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','castTo','DATE','type','default','text','value','start','end','Tag','map','tags','clause','and','User','user','skip','keys','some','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','resolve','then','fields','tag','filter','search','getLists','c.ListId\x20IS\x20NULL','limit','offset','group','subqry.id','having','order','DESC','subqry.','from','keyBy','Sequelize','CmContact','sequelize','query','Tags','clone','c.id','isEmpty','t.id\x20IN\x20?'];(function(_0x48a96f,_0x14e526){var _0x870119=function(_0x1bacd9){while(--_0x1bacd9){_0x48a96f['push'](_0x48a96f['shift']());}};_0x870119(++_0x14e526);}(_0x29f5,0x14f));var _0x529f=function(_0xbd493c,_0x3b2445){_0xbd493c=_0xbd493c-0x0;var _0x39a48b=_0x29f5[_0xbd493c];return _0x39a48b;};'use strict';var _=require(_0x529f('0x0'));var squel=require(_0x529f('0x1'));var as=require(_0x529f('0x2'));var qs=require(_0x529f('0x3'));var utils=require(_0x529f('0x4'));var db=require(_0x529f('0x5'))['db'];function skipContactsQuery(_0x1b4fdf,_0x3a03bc){var _0x525ceb=![];if(_0x1b4fdf[_0x529f('0x6')]===_0x529f('0x7')&&!_0x3a03bc['search']&&!_0x3a03bc['ListId']&&_0x3a03bc[_0x529f('0x8')]!==_0x529f('0x9')){_0x525ceb=!![];}return _0x525ceb;}function getContactsSubquery(){return squel[_0x529f('0xa')]()['from'](_0x529f('0xb'),'c')[_0x529f('0xc')](_0x529f('0xd'));}function applyJoinClauses(_0x23587f,_0x448774){var _0x259004=_0x448774?'c':_0x529f('0xe');_0x23587f[_0x529f('0xf')](_0x529f('0x10'),'uc',_0x529f('0x11')+_0x259004+_0x529f('0x12'))['left_join']('cm_contact_has_tags','ct','ct.CmContactId\x20=\x20'+_0x259004+_0x529f('0x12'))['left_join'](_0x529f('0x13'),'t',_0x529f('0x14'));return _0x23587f;}function addFieldsToQuery(_0xbdefba,_0x11b1ac,_0x481d15,_0x422c54,_0x2d8ac6){var _0x2c2ac9=_0x2d8ac6?'c':_0x529f('0xe');if(!_0x11b1ac){_0x11b1ac=['id',_0x529f('0x15'),_0x529f('0x16'),'phone','mobile',_0x529f('0x17'),_0x529f('0x18'),_0x529f('0x19'),'CompanyId',_0x529f('0x1a'),_0x529f('0x1b'),_0x529f('0x1c'),_0x529f('0x1d')];}else if(!_0x11b1ac[_0x529f('0x1e')]('id')){_0x11b1ac['push']('id');}var _0x5ca29a=_0x481d15&&_0x2d8ac6||!_0x481d15&&!_0x2d8ac6;if(_0x422c54){_0x5ca29a=_0x422c54&&_0x2d8ac6||!_0x422c54&&!_0x2d8ac6;}_0x11b1ac[_0x529f('0x1f')](function(_0x40b0e1){if(_0x40b0e1===_0x529f('0x1d')){if(_0x5ca29a){_0xbdefba[_0x529f('0x20')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x40b0e1);}else if(_0x481d15||_0x422c54){_0xbdefba[_0x529f('0x20')](_0x2c2ac9+'.'+_0x40b0e1);}}else{_0xbdefba[_0x529f('0x20')](_0x2c2ac9+'.'+_0x40b0e1);}});return _0xbdefba;}function getSqlClauses(){var _0x2b4479={'default':squel[_0x529f('0x21')](),'fields':squel['expr'](),'filter':squel[_0x529f('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x529f('0x21')](),'skip':![]}};return _0x2b4479;}function parseTagParameter(_0x15b8a6){var _0x168832=squel[_0x529f('0x21')]();if(_0x15b8a6){var _0x7c76d9=utils[_0x529f('0x22')](_0x15b8a6);_0x7c76d9[_0x529f('0x1f')](function(_0x5ef6f4){_0x168832['or'](_0x529f('0x23'),'%,'+_0x5ef6f4+',%');});}return _0x168832;}function parseSearchFilter(_0x224422){var _0x141099=squel[_0x529f('0x21')]();if(_0x224422){var _0x52fc25=_0x224422['replace']('\x5c','\x5c\x5c')[_0x529f('0x24')](/'/g,'\x27\x27');if(_0x52fc25[_0x529f('0x25')]('\x20')[_0x529f('0x26')]>0x1){_0x141099['or'](_0x529f('0x27'),qs['getFullTextValue'](_0x52fc25,!![]),null);}else{if(qs['isNumeric'](_0x52fc25)){_0x141099['or'](_0x529f('0x28'),_0x52fc25+'%');_0x141099['or'](_0x529f('0x29'),_0x52fc25+'%');_0x141099['or']('c.mobile\x20LIKE\x20?',_0x52fc25+'%');_0x141099['or'](_0x529f('0x2a'),_0x52fc25+'%');}else if(qs[_0x529f('0x2b')](_0x52fc25)){_0x141099['or']('c.email\x20LIKE\x20?',_0x52fc25+'%');}else{_0x141099['or'](_0x529f('0x2c'),'%'+_0x52fc25+'%');_0x141099['or'](_0x529f('0x2d'),'%'+_0x52fc25+'%');_0x141099['or'](_0x529f('0x2e'),'%'+_0x52fc25+'%');}}}return _0x141099;}function parseAdvancedSearchFilter(_0x582e4c,_0x33658b){var _0x442d63=getSqlClauses();var _0x4f43f0=as[_0x529f('0x2f')](_0x582e4c);var _0x42dab0=_0x4f43f0[_0x529f('0x30')];for(var _0x19f08a=0x0;_0x19f08a<_0x4f43f0[_0x529f('0x31')][_0x529f('0x26')];_0x19f08a++){var _0x4a8597=_0x4f43f0[_0x529f('0x31')][_0x19f08a];var _0x3a844a='c';var _0x2c22c5=_[_0x529f('0x32')](_0x33658b,[_0x529f('0x33'),_0x4a8597[_0x529f('0x20')]]);if(_0x2c22c5){if(_0x4a8597[_0x529f('0x20')]===_0x529f('0x34')||_0x2c22c5[_0x529f('0x35')]==='datetime'){_0x4a8597[_0x529f('0x36')]=_0x529f('0x37');}var _0xaea87c=as['buildExpression'](_0x3a844a,_0x2c22c5[_0x529f('0x38')],_0x4a8597);_0x442d63[_0x529f('0x39')][_0x42dab0](_0xaea87c[_0x529f('0x3a')],_0xaea87c[_0x529f('0x3b')][_0x529f('0x3c')],_0xaea87c[_0x529f('0x3b')][_0x529f('0x3d')]);}else{if(_0x4a8597[_0x529f('0x20')]===_0x529f('0x3e')){var _0x5be000=_0x4a8597[_0x529f('0x3b')][_0x529f('0x25')](',')[_0x529f('0x3f')](function(_0x31e120){return Number(_0x31e120);});var _0x1c9cda=parseTagParameter(_0x5be000);_0x442d63[_0x529f('0x40')][_0x529f('0x41')][_0x529f('0x42')](_0x1c9cda);_0x442d63[_0x529f('0x40')]['ids']=_0x5be000;}else if(_0x4a8597[_0x529f('0x20')]===_0x529f('0x43')){_0x442d63['user']['clause'][_0x529f('0x42')]('uc.UserId\x20=\x20?',_0x4a8597[_0x529f('0x3b')]);_0x442d63[_0x529f('0x44')][_0x529f('0x45')]=!![];}}}return _0x442d63;}function parseModelFields(_0xb75615,_0x1312bc){var _0x3b0ca0=squel[_0x529f('0x21')]();var _0x493bf0=_(_0xb75615)[_0x529f('0x46')]()[_0x529f('0x3f')](function(_0x130e12){return _[_0x529f('0x47')](_0x1312bc,[_0x529f('0x33'),_0x130e12])?_0x130e12:undefined;})['compact']()['value']();if(_0xb75615[_0x529f('0x48')]){_0x493bf0[_0x529f('0x49')]('Contact');}if(_0xb75615[_0x529f('0x43')]){_0x493bf0['push'](_0x529f('0x43'));}if(_0x493bf0[_0x529f('0x26')]>0x0){_0x493bf0['forEach'](function(_0x54f25c){if(_0x54f25c===_0x529f('0x19')){_0x3b0ca0[_0x529f('0x42')](_0x529f('0x4a'),[][_0x529f('0x4b')](_0xb75615[_0x54f25c]));}else if(_0x54f25c===_0x529f('0x48')){var _0x1c6d13='%'+_0xb75615[_0x54f25c]+'%';_0x3b0ca0['and'](_0x529f('0x4c'),_0x1c6d13);}else if(_0x54f25c===_0x529f('0x43')){_0x3b0ca0['and'](_0x529f('0x4d'),_0xb75615[_0x54f25c]);}else{_0x3b0ca0[_0x529f('0x42')]('c.'+_0x54f25c+'\x20=\x20?',_0xb75615[_0x54f25c]);}});}return _0x3b0ca0;}function parseQueryParameters(_0x586c50,_0x50a87f){var _0x4a7e6c=getSqlClauses();return Promise[_0x529f('0x4e')]()['then'](function(){return parseModelFields(_0x586c50,_0x50a87f);})[_0x529f('0x4f')](function(_0x2eef3f){_0x4a7e6c[_0x529f('0x50')][_0x529f('0x42')](_0x2eef3f);return parseTagParameter(_0x586c50[_0x529f('0x51')]);})['then'](function(_0x111a3b){_0x4a7e6c['tags']['clause'][_0x529f('0x42')](_0x111a3b);return parseSearchFilter(_0x586c50[_0x529f('0x52')]);})[_0x529f('0x4f')](function(_0x3f5a34){_0x4a7e6c[_0x529f('0x52')]=_0x3f5a34;return _0x4a7e6c;});}function checkListsRestrictions(_0x39967a,_0x4a8da9,_0x2d63a7){var _0x5e2e91=squel[_0x529f('0x21')]();return Promise[_0x529f('0x4e')]()['then'](function(){if(_0x4a8da9[_0x529f('0x53')]&&_0x39967a['role']===_0x529f('0x7')&&!_0x2d63a7){return _0x39967a[_0x529f('0x54')]({'attributes':['id'],'raw':!![]});}})[_0x529f('0x4f')](function(_0x33ce77){if(_0x33ce77){if(_0x33ce77[_0x529f('0x26')]===0x0){_0x5e2e91[_0x529f('0x42')](_0x529f('0x55'));}else{_0x5e2e91[_0x529f('0x42')](_0x529f('0x4a'),_[_0x529f('0x3f')](_0x33ce77,'id'));}}})[_0x529f('0x4f')](function(){return _0x5e2e91;});}function buildContactsQuery(_0x1b7ad3,_0x586000,_0x1cc546,_0x1c2bb7,_0x18a737,_0x1c90ff){if(_0x586000){_0x586000=_0x1cc546['attributes'];}_0x1b7ad3=addFieldsToQuery(_0x1b7ad3,_0x586000,_0x1c2bb7,_0x1c90ff,!![]);var _0x46e7af=squel[_0x529f('0xa')]();_0x46e7af=addFieldsToQuery(_0x46e7af,_0x586000,_0x1c2bb7,_0x1c90ff,![]);if(_0x1c2bb7||_0x1c90ff){_0x1b7ad3=applyJoinClauses(_0x1b7ad3,!![]);_0x1b7ad3['group']('c.id');if(_0x1cc546[_0x529f('0x56')]){_0x46e7af[_0x529f('0x56')](_0x1cc546['limit']);}if(_0x1cc546[_0x529f('0x57')]){_0x46e7af[_0x529f('0x57')](_0x1cc546[_0x529f('0x57')]);}}else{_0x46e7af=applyJoinClauses(_0x46e7af,![]);_0x46e7af[_0x529f('0x58')](_0x529f('0x59'));if(_0x1cc546[_0x529f('0x56')]){_0x1b7ad3['limit'](_0x1cc546[_0x529f('0x56')]);}if(_0x1cc546[_0x529f('0x57')]){_0x1b7ad3[_0x529f('0x57')](_0x1cc546[_0x529f('0x57')]);}}_0x46e7af[_0x529f('0x5a')](_0x18a737);if(_0x1cc546[_0x529f('0x5b')]){_0x1cc546[_0x529f('0x5b')][_0x529f('0x1f')](function(_0x21660c){_0x1b7ad3[_0x529f('0x5b')]('c.'+_0x21660c[0x0],_0x21660c[0x1]===_0x529f('0x5c')?![]:!![]);_0x46e7af[_0x529f('0x5b')](_0x529f('0x5d')+_0x21660c[0x0],_0x21660c[0x1]===_0x529f('0x5c')?![]:!![]);});}_0x46e7af[_0x529f('0x5e')](_0x1b7ad3,_0x529f('0xe'));return _0x46e7af;}function getFilteredContacts(_0x54d42c){var _0x2a91f3=[];return db[_0x529f('0x3e')]['findAll']({'attributes':['id','name','color'],'raw':!![]})['then'](function(_0x67f0d4){_0x2a91f3=_[_0x529f('0x5f')](_0x67f0d4,'id');var _0x1e28a2={'type':db[_0x529f('0x60')]['QueryTypes']['SELECT'],'model':db[_0x529f('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x529f('0x62')][_0x529f('0x63')](_0x54d42c['toString'](),_0x1e28a2);})['then'](function(_0x57f84d){_0x57f84d[_0x529f('0x1f')](function(_0x1857aa){if(_0x1857aa[_0x529f('0x1d')]){_0x1857aa[_0x529f('0x64')]=[];_0x1857aa[_0x529f('0x1d')][_0x529f('0x25')](',')['forEach'](function(_0x45f9c7){_0x1857aa[_0x529f('0x64')]['push'](_0x2a91f3[_0x45f9c7]);});}delete _0x1857aa[_0x529f('0x1d')];});return _0x57f84d;});}function countFilteredContacts(_0x4a4af7,_0x513ca1){var _0x1a4712=_0x4a4af7[_0x529f('0x65')]();_0x1a4712['field']('COUNT(*)');_0x1a4712=applyJoinClauses(_0x1a4712,!![]);_0x4a4af7[_0x529f('0x58')](_0x529f('0x66'));var _0x2a97b5=utils[_0x529f('0x22')](_0x513ca1);if(!_[_0x529f('0x67')](_0x2a97b5)){_0x1a4712[_0x529f('0xc')](_0x529f('0x68'),_0x2a97b5);}var _0x43bb3a={'type':db[_0x529f('0x60')][_0x529f('0x69')][_0x529f('0x6a')],'raw':!![]};return db[_0x529f('0x62')][_0x529f('0x63')](_0x1a4712[_0x529f('0x6b')](),_0x43bb3a)[_0x529f('0x4f')](function(_0x288879){return _0x288879[0x0][_0x529f('0x6c')];});}module[_0x529f('0x6d')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xb884=['fieldType','datetime','castTo','DATE','buildExpression','type','text','start','value','map','tags','clause','ids','User','user','and','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','then','tag','filter','resolve','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','DESC','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','TagIds','Tags','clone','COUNT(*)','lodash','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent','search','true','select','from','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','firstName','lastName','phone','fax','email','ListId','CompanyId','updatedAt','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth'];(function(_0x52f615,_0x10145a){var _0x32cf61=function(_0x2dc2fa){while(--_0x2dc2fa){_0x52f615['push'](_0x52f615['shift']());}};_0x32cf61(++_0x10145a);}(_0xb884,0x1ce));var _0x4b88=function(_0x21e97b,_0x65a77f){_0x21e97b=_0x21e97b-0x0;var _0x10ba44=_0xb884[_0x21e97b];return _0x10ba44;};'use strict';var _=require(_0x4b88('0x0'));var squel=require('squel');var as=require(_0x4b88('0x1'));var qs=require(_0x4b88('0x2'));var utils=require('../interaction/utils');var db=require(_0x4b88('0x3'))['db'];function skipContactsQuery(_0x3f3a85,_0x2489c5){var _0x4315fc=![];if(_0x3f3a85[_0x4b88('0x4')]===_0x4b88('0x5')&&!_0x2489c5[_0x4b88('0x6')]&&!_0x2489c5['ListId']&&_0x2489c5['autocomplete']!==_0x4b88('0x7')){_0x4315fc=!![];}return _0x4315fc;}function getContactsSubquery(){return squel[_0x4b88('0x8')]()[_0x4b88('0x9')]('cm_contacts','c')[_0x4b88('0xa')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x513f38,_0x2cca80){var _0xf352bd=_0x2cca80?'c':_0x4b88('0xb');_0x513f38[_0x4b88('0xc')](_0x4b88('0xd'),'uc',_0x4b88('0xe')+_0xf352bd+'.id')[_0x4b88('0xc')](_0x4b88('0xf'),'ct',_0x4b88('0x10')+_0xf352bd+'.id')[_0x4b88('0xc')](_0x4b88('0x11'),'t','t.id\x20=\x20ct.TagId');return _0x513f38;}function addFieldsToQuery(_0x148fb3,_0x4c7547,_0x16352e,_0x54b55c,_0xc3a3e9){var _0x40039b=_0xc3a3e9?'c':'subqry';if(!_0x4c7547){_0x4c7547=['id',_0x4b88('0x12'),_0x4b88('0x13'),_0x4b88('0x14'),'mobile',_0x4b88('0x15'),_0x4b88('0x16'),_0x4b88('0x17'),_0x4b88('0x18'),'createdAt',_0x4b88('0x19'),'deletedAt','TagIds'];}else if(!_0x4c7547['includes']('id')){_0x4c7547['push']('id');}var _0x5da8a3=_0x16352e&&_0xc3a3e9||!_0x16352e&&!_0xc3a3e9;if(_0x54b55c){_0x5da8a3=_0x54b55c&&_0xc3a3e9||!_0x54b55c&&!_0xc3a3e9;}_0x4c7547['forEach'](function(_0x45d85c){if(_0x45d85c==='TagIds'){if(_0x5da8a3){_0x148fb3[_0x4b88('0x1a')](_0x4b88('0x1b'),_0x45d85c);}else if(_0x16352e||_0x54b55c){_0x148fb3['field'](_0x40039b+'.'+_0x45d85c);}}else{_0x148fb3[_0x4b88('0x1a')](_0x40039b+'.'+_0x45d85c);}});return _0x148fb3;}function getSqlClauses(){var _0x159abb={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x4b88('0x1c')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x4b88('0x1c')](),'skip':![]}};return _0x159abb;}function parseTagParameter(_0x46e44d){var _0x235925=squel[_0x4b88('0x1c')]();if(_0x46e44d){var _0x567c8f=utils[_0x4b88('0x1d')](_0x46e44d);_0x567c8f[_0x4b88('0x1e')](function(_0x2bd930){_0x235925['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2bd930+',%');});}return _0x235925;}function parseSearchFilter(_0x2627fa){var _0x2482a6=squel['expr']();if(_0x2627fa){var _0x371070=_0x2627fa[_0x4b88('0x1f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x371070[_0x4b88('0x20')]('\x20')[_0x4b88('0x21')]>0x1){_0x2482a6['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4b88('0x22')](_0x371070,!![]),null);}else{if(qs[_0x4b88('0x23')](_0x371070)){_0x2482a6['or'](_0x4b88('0x24'),_0x371070+'%');_0x2482a6['or'](_0x4b88('0x25'),_0x371070+'%');_0x2482a6['or'](_0x4b88('0x26'),_0x371070+'%');_0x2482a6['or'](_0x4b88('0x27'),_0x371070+'%');}else if(qs['isEmail'](_0x371070)){_0x2482a6['or'](_0x4b88('0x28'),_0x371070+'%');}else{_0x2482a6['or'](_0x4b88('0x29'),'%'+_0x371070+'%');_0x2482a6['or'](_0x4b88('0x2a'),'%'+_0x371070+'%');_0x2482a6['or'](_0x4b88('0x28'),'%'+_0x371070+'%');}}}return _0x2482a6;}function parseAdvancedSearchFilter(_0x50af00,_0x18531f){var _0x5a5623=getSqlClauses();var _0x26aa63=as['parseSearch'](_0x50af00);var _0x5409a7=_0x26aa63[_0x4b88('0x2b')];for(var _0x55dec2=0x0;_0x55dec2<_0x26aa63['conditions'][_0x4b88('0x21')];_0x55dec2++){var _0x2004e4=_0x26aa63[_0x4b88('0x2c')][_0x55dec2];var _0x28ef14='c';var _0x330c62=_[_0x4b88('0x2d')](_0x18531f,[_0x4b88('0x2e'),_0x2004e4['field']]);if(_0x330c62){if(_0x2004e4[_0x4b88('0x1a')]===_0x4b88('0x2f')||_0x330c62[_0x4b88('0x30')]===_0x4b88('0x31')){_0x2004e4[_0x4b88('0x32')]=_0x4b88('0x33');}var _0x1ed00e=as[_0x4b88('0x34')](_0x28ef14,_0x330c62[_0x4b88('0x35')],_0x2004e4);_0x5a5623['default'][_0x5409a7](_0x1ed00e[_0x4b88('0x36')],_0x1ed00e['value'][_0x4b88('0x37')],_0x1ed00e[_0x4b88('0x38')]['end']);}else{if(_0x2004e4[_0x4b88('0x1a')]==='Tag'){var _0x2e4ed9=_0x2004e4[_0x4b88('0x38')][_0x4b88('0x20')](',')[_0x4b88('0x39')](function(_0x1ff9c7){return Number(_0x1ff9c7);});var _0x4b545d=parseTagParameter(_0x2e4ed9);_0x5a5623[_0x4b88('0x3a')][_0x4b88('0x3b')]['and'](_0x4b545d);_0x5a5623['tags'][_0x4b88('0x3c')]=_0x2e4ed9;}else if(_0x2004e4[_0x4b88('0x1a')]===_0x4b88('0x3d')){_0x5a5623[_0x4b88('0x3e')][_0x4b88('0x3b')][_0x4b88('0x3f')](_0x4b88('0x40'),_0x2004e4[_0x4b88('0x38')]);_0x5a5623[_0x4b88('0x3e')][_0x4b88('0x41')]=!![];}}}return _0x5a5623;}function parseModelFields(_0x11e859,_0x6740c6){var _0x19dd73=squel[_0x4b88('0x1c')]();var _0x2c0a2a=_(_0x11e859)[_0x4b88('0x42')]()[_0x4b88('0x39')](function(_0x4016db){return _[_0x4b88('0x43')](_0x6740c6,[_0x4b88('0x2e'),_0x4016db])?_0x4016db:undefined;})[_0x4b88('0x44')]()[_0x4b88('0x38')]();if(_0x11e859[_0x4b88('0x45')]){_0x2c0a2a[_0x4b88('0x46')](_0x4b88('0x45'));}if(_0x11e859['User']){_0x2c0a2a[_0x4b88('0x46')]('User');}if(_0x2c0a2a[_0x4b88('0x21')]>0x0){_0x2c0a2a[_0x4b88('0x1e')](function(_0x144f01){if(_0x144f01===_0x4b88('0x17')){_0x19dd73['and'](_0x4b88('0x47'),[][_0x4b88('0x48')](_0x11e859[_0x144f01]));}else if(_0x144f01===_0x4b88('0x45')){var _0x3f0147='%'+_0x11e859[_0x144f01]+'%';_0x19dd73['and'](_0x4b88('0x49'),_0x3f0147);}else if(_0x144f01===_0x4b88('0x3d')){_0x19dd73[_0x4b88('0x3f')]('uc.UserId\x20=\x20?',_0x11e859[_0x144f01]);}else{_0x19dd73[_0x4b88('0x3f')]('c.'+_0x144f01+'\x20=\x20?',_0x11e859[_0x144f01]);}});}return _0x19dd73;}function parseQueryParameters(_0x324de9,_0xbcfbf5){var _0x2fe71a=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x324de9,_0xbcfbf5);})[_0x4b88('0x4a')](function(_0x5c3ffc){_0x2fe71a['fields']['and'](_0x5c3ffc);return parseTagParameter(_0x324de9[_0x4b88('0x4b')]);})[_0x4b88('0x4a')](function(_0x20a088){_0x2fe71a['tags'][_0x4b88('0x3b')][_0x4b88('0x3f')](_0x20a088);return parseSearchFilter(_0x324de9[_0x4b88('0x4c')]);})[_0x4b88('0x4a')](function(_0x1acb86){_0x2fe71a[_0x4b88('0x4c')]=_0x1acb86;return _0x2fe71a;});}function checkListsRestrictions(_0x51c75a,_0x3f7879,_0x3e0d99){var _0x3858bc=squel['expr']();return Promise[_0x4b88('0x4d')]()[_0x4b88('0x4a')](function(){if(_0x3f7879[_0x4b88('0x6')]&&_0x51c75a[_0x4b88('0x4')]===_0x4b88('0x5')&&!_0x3e0d99){return _0x51c75a[_0x4b88('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0x4b88('0x4a')](function(_0x4c497c){if(_0x4c497c){if(_0x4c497c[_0x4b88('0x21')]===0x0){_0x3858bc[_0x4b88('0x3f')](_0x4b88('0x4f'));}else{_0x3858bc[_0x4b88('0x3f')](_0x4b88('0x47'),_[_0x4b88('0x39')](_0x4c497c,'id'));}}})[_0x4b88('0x4a')](function(){return _0x3858bc;});}function buildContactsQuery(_0x48be3c,_0x3cc942,_0x347a0d,_0x430025,_0x3733d4,_0x45468c){if(_0x3cc942){_0x3cc942=_0x347a0d[_0x4b88('0x50')];}_0x48be3c=addFieldsToQuery(_0x48be3c,_0x3cc942,_0x430025,_0x45468c,!![]);var _0x51e1ed=squel['select']();_0x51e1ed=addFieldsToQuery(_0x51e1ed,_0x3cc942,_0x430025,_0x45468c,![]);if(_0x430025||_0x45468c){_0x48be3c=applyJoinClauses(_0x48be3c,!![]);_0x48be3c[_0x4b88('0x51')]('c.id');if(_0x347a0d[_0x4b88('0x52')]){_0x51e1ed[_0x4b88('0x52')](_0x347a0d[_0x4b88('0x52')]);}if(_0x347a0d[_0x4b88('0x53')]){_0x51e1ed['offset'](_0x347a0d[_0x4b88('0x53')]);}}else{_0x51e1ed=applyJoinClauses(_0x51e1ed,![]);_0x51e1ed[_0x4b88('0x51')](_0x4b88('0x54'));if(_0x347a0d[_0x4b88('0x52')]){_0x48be3c['limit'](_0x347a0d[_0x4b88('0x52')]);}if(_0x347a0d[_0x4b88('0x53')]){_0x48be3c[_0x4b88('0x53')](_0x347a0d[_0x4b88('0x53')]);}}_0x51e1ed[_0x4b88('0x55')](_0x3733d4);if(_0x347a0d[_0x4b88('0x56')]){_0x347a0d[_0x4b88('0x56')][_0x4b88('0x1e')](function(_0x51358e){_0x48be3c[_0x4b88('0x56')]('c.'+_0x51358e[0x0],_0x51358e[0x1]==='DESC'?![]:!![]);_0x51e1ed['order']('subqry.'+_0x51358e[0x0],_0x51358e[0x1]===_0x4b88('0x57')?![]:!![]);});}_0x51e1ed[_0x4b88('0x9')](_0x48be3c,_0x4b88('0xb'));return _0x51e1ed;}function getFilteredContacts(_0x2adcf8){var _0x5b4127=[];return db['Tag'][_0x4b88('0x58')]({'attributes':['id',_0x4b88('0x2e'),_0x4b88('0x59')],'raw':!![]})[_0x4b88('0x4a')](function(_0x2957dd){_0x5b4127=_[_0x4b88('0x5a')](_0x2957dd,'id');var _0x304509={'type':db[_0x4b88('0x5b')][_0x4b88('0x5c')][_0x4b88('0x5d')],'model':db[_0x4b88('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x4b88('0x5f')][_0x4b88('0x60')](_0x2adcf8[_0x4b88('0x61')](),_0x304509);})['then'](function(_0xb2398e){_0xb2398e[_0x4b88('0x1e')](function(_0x506470){if(_0x506470[_0x4b88('0x62')]){_0x506470['Tags']=[];_0x506470[_0x4b88('0x62')]['split'](',')[_0x4b88('0x1e')](function(_0x9cce26){_0x506470[_0x4b88('0x63')][_0x4b88('0x46')](_0x5b4127[_0x9cce26]);});}delete _0x506470[_0x4b88('0x62')];});return _0xb2398e;});}function countFilteredContacts(_0x11cb0f,_0x5016d0){var _0xb50c02=_0x11cb0f[_0x4b88('0x64')]();_0xb50c02[_0x4b88('0x1a')](_0x4b88('0x65'));_0xb50c02=applyJoinClauses(_0xb50c02,!![]);_0x11cb0f[_0x4b88('0x51')]('c.id');var _0x18db68=utils[_0x4b88('0x1d')](_0x5016d0);if(!_['isEmpty'](_0x18db68)){_0xb50c02[_0x4b88('0xa')]('t.id\x20IN\x20?',_0x18db68);}var _0x2816f5={'type':db[_0x4b88('0x5b')][_0x4b88('0x5c')][_0x4b88('0x5d')],'raw':!![]};return db[_0x4b88('0x5f')][_0x4b88('0x60')](_0xb50c02[_0x4b88('0x61')](),_0x2816f5)[_0x4b88('0x4a')](function(_0x9869fc){return _0x9869fc[0x0][_0x4b88('0x65')];});}module['exports']={'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 3fff23c..16a0b17 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 _0xaf80=['createCipher','update','binary','end','final','write','close','unlink','decryptFile','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','secrets','session','aes192','encrypt','algorithm','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xaf80,0x150));var _0x0af8=function(_0x920178,_0x488c1f){_0x920178=_0x920178-0x0;var _0x3c41d2=_0xaf80[_0x920178];return _0x3c41d2;};'use strict';var crypto=require(_0x0af8('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x0af8('0x1'));var config=require(_0x0af8('0x2'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0af8('0x3')][_0x0af8('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x0af8('0x5')};if(config['encrypt']&&config[_0x0af8('0x6')][_0x0af8('0x7')]){var isSupported=isAlgorithmSupported(config[_0x0af8('0x6')][_0x0af8('0x7')]);if(isSupported){fileOptions[_0x0af8('0x7')]=config['encrypt'][_0x0af8('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x0af8('0x6')][_0x0af8('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x45367f){return AES_SUPPORTED_RX[_0x0af8('0x8')](_0x45367f);}function getSupportedCiphers(){return crypto[_0x0af8('0x9')]()[_0x0af8('0xa')](isASupportedCipher);}function isAlgorithmSupported(_0x442a97){return getSupportedCiphers()[_0x0af8('0xb')](_0x442a97)>-0x1;}function combineOptions(_0x22c6b0){var _0x1eebde={};for(var _0x1e007c in fileOptions){if(fileOptions[_0x0af8('0xc')](_0x1e007c)){_0x1eebde[_0x1e007c]=fileOptions[_0x1e007c];}}if(_0x22c6b0){for(var _0x4799d2 in _0x22c6b0){if(_0x22c6b0['hasOwnProperty'](_0x4799d2)){_0x1eebde[_0x4799d2]=_0x22c6b0[_0x4799d2];}}}return _0x1eebde;}exports[_0x0af8('0xd')]=function(_0x179285,_0x11b2ba,_0x23cd0b,_0x579ab8){return new BPromise(function(_0xc431,_0x21a0e3){_0x579ab8=combineOptions(_0x579ab8);var _0x3ecc21=new Buffer(_0x23cd0b);var _0x3154bd=fs[_0x0af8('0xe')](_0x179285);var _0x5381e0=fs[_0x0af8('0xf')](_0x11b2ba);var _0x2ba559=crypto[_0x0af8('0x10')](_0x579ab8[_0x0af8('0x7')],_0x3ecc21);_0x3154bd['on']('data',function(_0x30fde2){var _0x3a179d=new Buffer(_0x2ba559[_0x0af8('0x11')](_0x30fde2),_0x0af8('0x12'));_0x5381e0['write'](_0x3a179d);});_0x3154bd['on'](_0x0af8('0x13'),function(){try{var _0x18dbbd=new Buffer(_0x2ba559[_0x0af8('0x14')](_0x0af8('0x12')),_0x0af8('0x12'));_0x5381e0[_0x0af8('0x15')](_0x18dbbd);_0x5381e0[_0x0af8('0x13')]();_0x5381e0['on'](_0x0af8('0x16'),function(){return _0xc431(_0x11b2ba);});}catch(_0x1f497d){fs[_0x0af8('0x17')](_0x11b2ba);return _0x21a0e3(_0x1f497d);}});});};exports[_0x0af8('0x18')]=function(_0x4d8204,_0x22f343,_0x530b0f,_0x2ed5ce){return new BPromise(function(_0x5d4202,_0x3c23b9){_0x2ed5ce=combineOptions(_0x2ed5ce);var _0x2c37dd=new Buffer(_0x530b0f);var _0x348081=fs['createReadStream'](_0x4d8204);var _0x4110e4=fs[_0x0af8('0xf')](_0x22f343);var _0x581f4f=crypto[_0x0af8('0x19')](_0x2ed5ce[_0x0af8('0x7')],_0x2c37dd);_0x348081['on'](_0x0af8('0x1a'),function(_0x3991dd){var _0x21612d=new Buffer(_0x581f4f[_0x0af8('0x11')](_0x3991dd),_0x0af8('0x12'));_0x4110e4[_0x0af8('0x15')](_0x21612d);});_0x348081['on'](_0x0af8('0x13'),function(){try{var _0x2e743c=new Buffer(_0x581f4f[_0x0af8('0x14')](_0x0af8('0x12')),_0x0af8('0x12'));_0x4110e4['write'](_0x2e743c);_0x4110e4[_0x0af8('0x13')]();_0x4110e4['on'](_0x0af8('0x16'),function(){return _0x5d4202(_0x22f343);});}catch(_0x405725){fs['unlink'](_0x22f343);return _0x3c23b9(_0x405725);}});});};exports[_0x0af8('0x1b')]=function(_0x5f167d,_0x55b281,_0x17c664){var _0x50116d=_0x17c664||stringOptions[_0x0af8('0x7')];var _0x3d6af9=_0x55b281||stringOptions[_0x0af8('0x1c')];var _0x42948a=crypto[_0x0af8('0x10')](_0x50116d,_0x3d6af9);var _0x57a0a4=_0x42948a[_0x0af8('0x11')](_0x5f167d,_0x0af8('0x1d'),_0x0af8('0x1e'));_0x57a0a4+=_0x42948a[_0x0af8('0x14')](_0x0af8('0x1e'));return _0x57a0a4;};exports[_0x0af8('0x1f')]=function(_0x31f4d5,_0x5d20c8,_0x254067){var _0xb94da3=_0x254067||stringOptions[_0x0af8('0x7')];var _0x39e879=_0x5d20c8||stringOptions[_0x0af8('0x1c')];var _0x33caaa=crypto['createDecipher'](_0xb94da3,_0x39e879);var _0x253dc2=_0x33caaa[_0x0af8('0x11')](_0x31f4d5,_0x0af8('0x1e'),_0x0af8('0x1d'));_0x253dc2+=_0x33caaa['final']('utf8');return _0x253dc2;}; \ No newline at end of file +var _0xabd3=['createWriteStream','createCipher','data','binary','end','final','close','decryptFile','createReadStream','createDecipher','update','write','unlink','secret','utf8','base64','decryptString','crypto','../../config/logger','app','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty'];(function(_0x2a1c4d,_0x513217){var _0x2562ae=function(_0x5f3341){while(--_0x5f3341){_0x2a1c4d['push'](_0x2a1c4d['shift']());}};_0x2562ae(++_0x513217);}(_0xabd3,0x128));var _0x3abd=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0xabd3[_0x54d52];return _0x968345;};'use strict';var crypto=require(_0x3abd('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x3abd('0x1'))(_0x3abd('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x3abd('0x3')};const fileOptions={'algorithm':_0x3abd('0x4')};if(config[_0x3abd('0x5')]&&config['encrypt'][_0x3abd('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x3abd('0x6')]=config[_0x3abd('0x5')][_0x3abd('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3abd('0x7')](',\x20');logger[_0x3abd('0x8')](config[_0x3abd('0x5')][_0x3abd('0x6')],_0x3abd('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x416a56){return AES_SUPPORTED_RX[_0x3abd('0xa')](_0x416a56);}function getSupportedCiphers(){return crypto[_0x3abd('0xb')]()[_0x3abd('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x37c6ee){return getSupportedCiphers()['indexOf'](_0x37c6ee)>-0x1;}function combineOptions(_0x3bcd0){var _0x193485={};for(var _0x413674 in fileOptions){if(fileOptions[_0x3abd('0xd')](_0x413674)){_0x193485[_0x413674]=fileOptions[_0x413674];}}if(_0x3bcd0){for(var _0x3c0cff in _0x3bcd0){if(_0x3bcd0[_0x3abd('0xd')](_0x3c0cff)){_0x193485[_0x3c0cff]=_0x3bcd0[_0x3c0cff];}}}return _0x193485;}exports['encryptFile']=function(_0x484d28,_0x4e05b6,_0x3f2b2d,_0x42e6f1){return new BPromise(function(_0x4bf1eb,_0x37acb7){_0x42e6f1=combineOptions(_0x42e6f1);var _0x1ea3cf=new Buffer(_0x3f2b2d);var _0x113046=fs['createReadStream'](_0x484d28);var _0x36f107=fs[_0x3abd('0xe')](_0x4e05b6);var _0x137c0b=crypto[_0x3abd('0xf')](_0x42e6f1['algorithm'],_0x1ea3cf);_0x113046['on'](_0x3abd('0x10'),function(_0x588d60){var _0x58ba91=new Buffer(_0x137c0b['update'](_0x588d60),_0x3abd('0x11'));_0x36f107['write'](_0x58ba91);});_0x113046['on'](_0x3abd('0x12'),function(){try{var _0x3c95cc=new Buffer(_0x137c0b[_0x3abd('0x13')](_0x3abd('0x11')),_0x3abd('0x11'));_0x36f107['write'](_0x3c95cc);_0x36f107[_0x3abd('0x12')]();_0x36f107['on'](_0x3abd('0x14'),function(){return _0x4bf1eb(_0x4e05b6);});}catch(_0x302434){fs['unlink'](_0x4e05b6);return _0x37acb7(_0x302434);}});});};exports[_0x3abd('0x15')]=function(_0x324eb3,_0x3053fd,_0x2d8f60,_0xf4e040){return new BPromise(function(_0x13da97,_0x311d16){_0xf4e040=combineOptions(_0xf4e040);var _0x3d08e4=new Buffer(_0x2d8f60);var _0x1b6780=fs[_0x3abd('0x16')](_0x324eb3);var _0x300044=fs['createWriteStream'](_0x3053fd);var _0x2db0ad=crypto[_0x3abd('0x17')](_0xf4e040[_0x3abd('0x6')],_0x3d08e4);_0x1b6780['on'](_0x3abd('0x10'),function(_0x452f25){var _0x1e4a5e=new Buffer(_0x2db0ad[_0x3abd('0x18')](_0x452f25),_0x3abd('0x11'));_0x300044[_0x3abd('0x19')](_0x1e4a5e);});_0x1b6780['on'](_0x3abd('0x12'),function(){try{var _0x1dd87d=new Buffer(_0x2db0ad[_0x3abd('0x13')](_0x3abd('0x11')),_0x3abd('0x11'));_0x300044[_0x3abd('0x19')](_0x1dd87d);_0x300044[_0x3abd('0x12')]();_0x300044['on'](_0x3abd('0x14'),function(){return _0x13da97(_0x3053fd);});}catch(_0x56d375){fs[_0x3abd('0x1a')](_0x3053fd);return _0x311d16(_0x56d375);}});});};exports['encryptString']=function(_0x48f0ec,_0x34daf9,_0x116217){var _0x5d7da2=_0x116217||stringOptions[_0x3abd('0x6')];var _0x2f68de=_0x34daf9||stringOptions[_0x3abd('0x1b')];var _0x56624e=crypto[_0x3abd('0xf')](_0x5d7da2,_0x2f68de);var _0x454f6b=_0x56624e[_0x3abd('0x18')](_0x48f0ec,_0x3abd('0x1c'),_0x3abd('0x1d'));_0x454f6b+=_0x56624e[_0x3abd('0x13')](_0x3abd('0x1d'));return _0x454f6b;};exports[_0x3abd('0x1e')]=function(_0x44ba44,_0x1b5d96,_0x222065){var _0x554394=_0x222065||stringOptions['algorithm'];var _0x460564=_0x1b5d96||stringOptions[_0x3abd('0x1b')];var _0x44592e=crypto[_0x3abd('0x17')](_0x554394,_0x460564);var _0x4889cd=_0x44592e['update'](_0x44ba44,_0x3abd('0x1d'),_0x3abd('0x1c'));_0x4889cd+=_0x44592e[_0x3abd('0x13')](_0x3abd('0x1c'));return _0x4889cd;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f733ebb..96d6a0e 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 _0x7efb=['zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Setting','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','util','path','bluebird'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x7efb,0x10b));var _0xb7ef=function(_0x2c4378,_0x221bf8){_0x2c4378=_0x2c4378-0x0;var _0x3c312b=_0x7efb[_0x2c4378];return _0x3c312b;};'use strict';var util=require(_0xb7ef('0x0'));var path=require(_0xb7ef('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xb7ef('0x2'));var zipdir=require(_0xb7ef('0x3'));var rimraf=require('rimraf');var db=require(_0xb7ef('0x4'))['db'];var dbH=require(_0xb7ef('0x4'))[_0xb7ef('0x5')];var logger=require(_0xb7ef('0x6'))(_0xb7ef('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb7ef('0x8')][0x2]);var QUERY=process[_0xb7ef('0x8')][0x3];var PATH=process[_0xb7ef('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x22d07a,_0x259931){var _0xbb5387={'status':_0x22d07a};var _0x183b7a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x259931){_0xbb5387[_0xb7ef('0x9')]=_0x259931;}return db[_0xb7ef('0xa')][_0xb7ef('0xb')](_0xbb5387,_0x183b7a);}function main(){var _0x109c43=0x1388;var _0x48847d;logger['info'](util[_0xb7ef('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xb7ef('0xd')][_0xb7ef('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb7ef('0xf'),'splitSizeCsv']})[_0xb7ef('0x10')](function(_0xeebc14){if(_0xeebc14){_0x48847d=_0xeebc14;_0x109c43=_0x48847d[_0xb7ef('0x11')]||0x1388;}})[_0xb7ef('0x10')](function(){return dbH[_0xb7ef('0x12')][_0xb7ef('0x13')](util[_0xb7ef('0xc')](_0xb7ef('0x14'),QUERY),{'type':dbH[_0xb7ef('0x12')][_0xb7ef('0x15')][_0xb7ef('0x16')]});})[_0xb7ef('0x10')](function(_0x2b158e){if(!_0x2b158e[0x0][_0xb7ef('0x17')]){return analyticExtractedReport('Empty');}var _0x388968=[];var _0xb5fa15=0x0;if(_0x48847d[_0xb7ef('0xf')]){if(_0x2b158e&&_0x2b158e[_0xb7ef('0x18')]){var _0x210392=_[_0xb7ef('0x19')](_0x2b158e[0x0][_0xb7ef('0x17')]/_0x109c43);var _0x53f842=Number['isInteger'](_0x2b158e[0x0][_0xb7ef('0x17')]/_0x109c43)?_0x2b158e[0x0]['num']%_0x109c43:0x0;_0x210392[_0xb7ef('0x1a')](function(_0x327d4f){if(_0x327d4f>0x0){_0xb5fa15+=_0x109c43;}_0x388968[_0xb7ef('0x1b')](dbH['sequelize'][_0xb7ef('0x13')](util['format'](_0xb7ef('0x1c'),QUERY,_0x109c43,_0xb5fa15),{'type':dbH[_0xb7ef('0x12')][_0xb7ef('0x15')][_0xb7ef('0x16')]}));});if(_0x53f842>0x0){_0xb5fa15+=_0x109c43;_0x388968[_0xb7ef('0x1b')](dbH[_0xb7ef('0x12')][_0xb7ef('0x13')](util['format'](_0xb7ef('0x1c'),QUERY,_0x53f842,_0xb5fa15),{'type':dbH[_0xb7ef('0x12')][_0xb7ef('0x15')][_0xb7ef('0x16')]}));}}}else{_0x388968['push'](dbH[_0xb7ef('0x12')][_0xb7ef('0x13')](QUERY,{'type':dbH[_0xb7ef('0x12')]['QueryTypes'][_0xb7ef('0x16')]}));}var _0x1c2e1f=path['dirname'](PATH);var _0x287625=path['basename'](PATH,_0xb7ef('0x1d'));var _0x3e757f=_0x48847d[_0xb7ef('0xf')]&&_0x388968['length']>0x1;var _0x6d5201=[];if(!fs['existsSync'](path[_0xb7ef('0x1e')](_0x1c2e1f,_0x287625))&&_0x3e757f){fs[_0xb7ef('0x1f')](path[_0xb7ef('0x1e')](_0x1c2e1f,_0x287625));}return BPromise[_0xb7ef('0x20')](_0x388968,function(_0x577f8a){_0x6d5201[_0xb7ef('0x1b')](_0x577f8a);})[_0xb7ef('0x10')](function(){for(var _0x613afe=0x0;_0x613afe<_0x6d5201[_0xb7ef('0x18')];_0x613afe+=0x1){var _0x3aa751;var _0x12af39=_0x6d5201[_0x613afe];if(_0x3e757f){_0x3aa751=path[_0xb7ef('0x1e')](_0x1c2e1f,_0x287625,util[_0xb7ef('0xc')](_0xb7ef('0x21'),_0x287625,_0x613afe,'csv'));}else{_0x3aa751=path[_0xb7ef('0x1e')](_0x1c2e1f,util[_0xb7ef('0xc')](_0xb7ef('0x22'),_0x287625,_0xb7ef('0x23')));}fs[_0xb7ef('0x24')](_0x3aa751,csv(_0x12af39));}})['then'](function(){if(_0x3e757f){return new Promise(function(_0x421144){zipdir(path[_0xb7ef('0x1e')](_0x1c2e1f,_0x287625),{'saveTo':path['join'](_0x1c2e1f,util[_0xb7ef('0xc')](_0xb7ef('0x22'),_0x287625,_0xb7ef('0x25')))},function(_0x29be71,_0x194a74){rimraf(path[_0xb7ef('0x1e')](_0x1c2e1f,_0x287625),function(){});_0x421144('zip\x20finished');});});}})[_0xb7ef('0x10')](function(){logger['info'](util[_0xb7ef('0xc')](_0xb7ef('0x26'),EXTRACTED_REPORT_ID,_0xb7ef('0x27')));return analyticExtractedReport('Completed',_0x3e757f?util[_0xb7ef('0xc')](_0xb7ef('0x22'),_0x287625,_0x3e757f?_0xb7ef('0x25'):_0xb7ef('0x23')):null);});})[_0xb7ef('0x28')](function(_0x5f47b4){logger[_0xb7ef('0x29')](util['format'](_0xb7ef('0x2a'),EXTRACTED_REPORT_ID,_0xb7ef('0x27')),util['inspect'](_0x5f47b4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb7ef('0x2b'));})[_0xb7ef('0x2c')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7df1=['query','QueryTypes','SELECT','num','Empty','split','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','each','%s%d.%s','%s.%s','csv','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','path','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize'];(function(_0x4e7d5f,_0xedb34b){var _0x2a312c=function(_0x5b40fd){while(--_0x5b40fd){_0x4e7d5f['push'](_0x4e7d5f['shift']());}};_0x2a312c(++_0xedb34b);}(_0x7df1,0x136));var _0x17df=function(_0x23b3d7,_0x2801bf){_0x23b3d7=_0x23b3d7-0x0;var _0x4a827a=_0x7df1[_0x23b3d7];return _0x4a827a;};'use strict';var util=require(_0x17df('0x0'));var path=require(_0x17df('0x1'));var _=require('lodash');var csv=require(_0x17df('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x17df('0x3'));var rimraf=require(_0x17df('0x4'));var db=require(_0x17df('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x17df('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x17df('0x7')][0x2]);var QUERY=process[_0x17df('0x7')][0x3];var PATH=process[_0x17df('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc390,_0x5d8840){var _0x2ecec8={'status':_0x2cc390};var _0x428d51={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5d8840){_0x2ecec8[_0x17df('0x8')]=_0x5d8840;}return db[_0x17df('0x9')]['update'](_0x2ecec8,_0x428d51);}function main(){var _0x58f538=0x1388;var _0x3d9d76;logger[_0x17df('0xa')](util[_0x17df('0xb')](_0x17df('0xc'),EXTRACTED_REPORT_ID,_0x17df('0xd')));return db[_0x17df('0xe')][_0x17df('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x17df('0x10')]})[_0x17df('0x11')](function(_0x1ffabb){if(_0x1ffabb){_0x3d9d76=_0x1ffabb;_0x58f538=_0x3d9d76[_0x17df('0x10')]||0x1388;}})[_0x17df('0x11')](function(){return dbH[_0x17df('0x12')][_0x17df('0x13')](util[_0x17df('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x17df('0x12')][_0x17df('0x14')][_0x17df('0x15')]});})[_0x17df('0x11')](function(_0x213501){if(!_0x213501[0x0][_0x17df('0x16')]){return analyticExtractedReport(_0x17df('0x17'));}var _0x464c66=[];var _0x39bb83=0x0;if(_0x3d9d76[_0x17df('0x18')]){if(_0x213501&&_0x213501['length']){var _0x29b220=_[_0x17df('0x19')](_0x213501[0x0][_0x17df('0x16')]/_0x58f538);var _0x148620=Number[_0x17df('0x1a')](_0x213501[0x0][_0x17df('0x16')]/_0x58f538)?_0x213501[0x0][_0x17df('0x16')]%_0x58f538:0x0;_0x29b220[_0x17df('0x1b')](function(_0x23d67a){if(_0x23d67a>0x0){_0x39bb83+=_0x58f538;}_0x464c66[_0x17df('0x1c')](dbH[_0x17df('0x12')]['query'](util[_0x17df('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x58f538,_0x39bb83),{'type':dbH[_0x17df('0x12')][_0x17df('0x14')][_0x17df('0x15')]}));});if(_0x148620>0x0){_0x39bb83+=_0x58f538;_0x464c66[_0x17df('0x1c')](dbH['sequelize']['query'](util['format'](_0x17df('0x1d'),QUERY,_0x148620,_0x39bb83),{'type':dbH['sequelize'][_0x17df('0x14')][_0x17df('0x15')]}));}}}else{_0x464c66['push'](dbH[_0x17df('0x12')][_0x17df('0x13')](QUERY,{'type':dbH['sequelize'][_0x17df('0x14')][_0x17df('0x15')]}));}var _0x40d986=path[_0x17df('0x1e')](PATH);var _0x38dc36=path[_0x17df('0x1f')](PATH,_0x17df('0x20'));var _0x49551e=_0x3d9d76[_0x17df('0x18')]&&_0x464c66[_0x17df('0x21')]>0x1;var _0x260c0f=[];if(!fs[_0x17df('0x22')](path[_0x17df('0x23')](_0x40d986,_0x38dc36))&&_0x49551e){fs['mkdirSync'](path[_0x17df('0x23')](_0x40d986,_0x38dc36));}return BPromise[_0x17df('0x24')](_0x464c66,function(_0x23bc68){_0x260c0f['push'](_0x23bc68);})['then'](function(){for(var _0x1538b2=0x0;_0x1538b2<_0x260c0f[_0x17df('0x21')];_0x1538b2+=0x1){var _0x115aab;var _0x531b25=_0x260c0f[_0x1538b2];if(_0x49551e){_0x115aab=path[_0x17df('0x23')](_0x40d986,_0x38dc36,util['format'](_0x17df('0x25'),_0x38dc36,_0x1538b2,'csv'));}else{_0x115aab=path[_0x17df('0x23')](_0x40d986,util[_0x17df('0xb')](_0x17df('0x26'),_0x38dc36,_0x17df('0x27')));}fs['writeFileSync'](_0x115aab,csv(_0x531b25));}})[_0x17df('0x11')](function(){if(_0x49551e){return new Promise(function(_0x4e02a5){zipdir(path[_0x17df('0x23')](_0x40d986,_0x38dc36),{'saveTo':path[_0x17df('0x23')](_0x40d986,util[_0x17df('0xb')](_0x17df('0x26'),_0x38dc36,_0x17df('0x28')))},function(_0x48ac26,_0x3b5639){rimraf(path[_0x17df('0x23')](_0x40d986,_0x38dc36),function(){});_0x4e02a5('zip\x20finished');});});}})[_0x17df('0x11')](function(){logger[_0x17df('0xa')](util[_0x17df('0xb')](_0x17df('0x29'),EXTRACTED_REPORT_ID,_0x17df('0xd')));return analyticExtractedReport(_0x17df('0x2a'),_0x49551e?util[_0x17df('0xb')](_0x17df('0x26'),_0x38dc36,_0x49551e?_0x17df('0x28'):'csv'):null);});})[_0x17df('0x2b')](function(_0x7bdf82){logger['info'](util['format'](_0x17df('0x2c'),EXTRACTED_REPORT_ID,_0x17df('0xd')),util['inspect'](_0x7bdf82,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x17df('0x2d'));})['finally'](function(){process[_0x17df('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5d495ad..c14503a 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 _0xa341=['basename','existsSync','join','each','then','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','Arial','center','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','fill','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','pageBreak','before','margin','landscape','toString','footer','right','num','split','splitSizePdf','range','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0xa341,0xd2));var _0x1a34=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa341[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1a34('0x0'));var fs=require('fs');var util=require(_0x1a34('0x1'));var path=require(_0x1a34('0x2'));var moment=require(_0x1a34('0x3'));var htmlToPdfmake=require(_0x1a34('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x1a34('0x5'));var rimraf=require(_0x1a34('0x6'));var JSDOM=require(_0x1a34('0x7'))[_0x1a34('0x8')];var window=new JSDOM('')[_0x1a34('0x9')];var BPromise=require(_0x1a34('0xa'));var db=require(_0x1a34('0xb'))['db'];var dbH=require(_0x1a34('0xb'))[_0x1a34('0xc')];var logger=require('../../config/logger')(_0x1a34('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1a34('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x1a34('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4b1098,_0x3e3034){var _0x2b5c52={'status':_0x4b1098};var _0x2a27b5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e3034){_0x2b5c52[_0x1a34('0xf')]=_0x3e3034;}return db[_0x1a34('0x10')][_0x1a34('0x11')](_0x2b5c52,_0x2a27b5);}function getHeaders(_0x1f1f45){return _[_0x1a34('0x12')](_0x1f1f45,function(_0x16ee14){return{'text':_0x16ee14,'style':_0x1a34('0x13')};});}function getRows(_0x9609eb,_0x1c7589){return _[_0x1a34('0x12')](_0x1c7589,function(_0x55b690){return _(_0x55b690)[_0x1a34('0x14')](_0x9609eb)[_0x1a34('0x12')](function(_0xa766aa){return _0xa766aa?_['toString'](_0xa766aa):'';})['value']();});}function createTable(_0x105baf,_0x56f8fb){var _0x429afd={'widths':_[_0x1a34('0x15')](Array(_0x105baf[_0x1a34('0x16')]),0x91),'heights':function(_0x2ce8bc){return _0x2ce8bc===0x0?_0x1a34('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xf9e5cf=getHeaders(_0x105baf);_0x429afd['body']['push'](_0xf9e5cf);var _0x2680c7=getRows(_0x105baf,_0x56f8fb);_0x429afd[_0x1a34('0x18')]=_0x429afd['body'][_0x1a34('0x19')](_0x2680c7);return _0x429afd;}function createTables(_0x595750){var _0x32582d=[];var _0x394f04=_[_0x1a34('0x1a')](Object[_0x1a34('0x1b')](_0x595750[0x0]),0x5);_0x394f04[_0x1a34('0x1c')](function(_0xb83ac7){_0x32582d[_0x1a34('0x1d')](createTable(_0xb83ac7,_0x595750));});return _0x32582d;}function getPDFDocDefinition(_0x2ce4f1){var _0x541594=util[_0x1a34('0x1e')](_0x1a34('0x1f'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x1a34('0x20')])[_0x1a34('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x1a34('0x21')])[_0x1a34('0x1e')](FORMAT));var _0x88f4fc=[];for(var _0x192b56=0x0;_0x192b56<_0x2ce4f1[_0x1a34('0x16')];_0x192b56++){var _0x5823da=[];if(_0x192b56===0x0){_0x5823da[_0x1a34('0x1d')]({'text':_0x541594,'style':'header'});}var _0xf72303={'table':_0x2ce4f1[_0x192b56]};if(_0x192b56>0x0){_0xf72303[_0x1a34('0x22')]=_0x1a34('0x23');_0xf72303[_0x1a34('0x24')]=[0x0,0x46,0x0,0x0];}_0x5823da[_0x1a34('0x1d')](_0xf72303);_0x88f4fc[_0x1a34('0x1d')](_0x5823da);}return{'pageSize':'A4','pageOrientation':_0x1a34('0x25'),'content':_0x88f4fc,'footer':function(_0xae0ef7,_0x477326){return{'text':_0xae0ef7[_0x1a34('0x26')]()+'\x20/\x20'+_0x477326,'style':_0x1a34('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x1a34('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5eacd9){var _0x4e0755=0x1388;var _0xffc8c0;if(!_0x5eacd9[0x0][_0x1a34('0x29')]){return analyticExtractedReport('Empty');}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1a34('0x2a'),_0x1a34('0x2b')]})['then'](function(_0x5dc04d){if(_0x5dc04d){_0xffc8c0=_0x5dc04d;_0x4e0755=_0xffc8c0['splitSizePdf']||0x3e8;}})['then'](function(){var _0x50f6b6=[];var _0x1f1c74=0x0;if(_0xffc8c0['split']){if(_0x5eacd9&&_0x5eacd9[_0x1a34('0x16')]){var _0x270043=_[_0x1a34('0x2c')](_0x5eacd9[0x0]['num']/_0x4e0755);var _0x2af1b3=Number['isInteger'](_0x5eacd9[0x0][_0x1a34('0x29')]/_0x4e0755)?_0x5eacd9[0x0][_0x1a34('0x29')]%_0x4e0755:0x0;_0x270043[_0x1a34('0x1c')](function(_0x5028d4){if(_0x5028d4>0x0){_0x1f1c74+=_0x4e0755;}_0x50f6b6[_0x1a34('0x1d')](dbH[_0x1a34('0x2d')][_0x1a34('0x2e')](util[_0x1a34('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4e0755,_0x1f1c74),{'type':dbH['sequelize'][_0x1a34('0x2f')][_0x1a34('0x30')]}));});if(_0x2af1b3>0x0){_0x1f1c74+=_0x4e0755;_0x50f6b6[_0x1a34('0x1d')](dbH[_0x1a34('0x2d')][_0x1a34('0x2e')](util['format'](_0x1a34('0x31'),QUERY,_0x2af1b3,_0x1f1c74),{'type':dbH[_0x1a34('0x2d')][_0x1a34('0x2f')][_0x1a34('0x30')]}));}}}else{_0x50f6b6['push'](dbH[_0x1a34('0x2d')]['query'](QUERY,{'type':dbH[_0x1a34('0x2d')]['QueryTypes'][_0x1a34('0x30')]}));}var _0x41ad88=path[_0x1a34('0x32')](PATH);var _0x32220b=path[_0x1a34('0x33')](PATH,'.pdf');var _0x2ff23f=_0xffc8c0[_0x1a34('0x2a')]&&_0x50f6b6[_0x1a34('0x16')]>0x1;var _0x5303e8=[];if(!fs[_0x1a34('0x34')](path['join'](_0x41ad88,_0x32220b))&&_0x2ff23f){fs['mkdirSync'](path[_0x1a34('0x35')](_0x41ad88,_0x32220b));}return BPromise[_0x1a34('0x36')](_0x50f6b6,function(_0x36c13d){_0x5303e8[_0x1a34('0x1d')](_0x36c13d);})[_0x1a34('0x37')](function(){var _0xfdca7c=[];for(var _0x310a6b=0x0;_0x310a6b<_0x5303e8['length'];_0x310a6b+=0x1){var _0x14eb63=_0x5303e8[_0x310a6b];var _0x290e12=createTables(_['flatten'](_0x14eb63));var _0x5d9bc9;var _0x44fccf=getPDFDocDefinition(_0x290e12);var _0x39fba1=getPDFPrinter();var _0x5dfe79=_0x39fba1[_0x1a34('0x38')](_0x44fccf);if(_0x2ff23f){_0x5d9bc9=path['join'](_0x41ad88,_0x32220b,util[_0x1a34('0x1e')](_0x1a34('0x39'),_0x32220b,_0x310a6b,_0x1a34('0x3a')));}else{_0x5d9bc9=path['join'](_0x41ad88,util[_0x1a34('0x1e')]('%s.%s',_0x32220b,_0x1a34('0x3a')));}_0xfdca7c['push'](writePDFDocument(_0x5dfe79,_0x5d9bc9));}return Promise[_0x1a34('0x3b')](_0xfdca7c);})[_0x1a34('0x37')](function(){if(_0x2ff23f){return new Promise(function(_0x6a9f98){zipdir(path[_0x1a34('0x35')](_0x41ad88,_0x32220b),{'saveTo':path[_0x1a34('0x35')](_0x41ad88,util[_0x1a34('0x1e')](_0x1a34('0x3c'),_0x32220b,_0x1a34('0x3d')))},function(){rimraf(path[_0x1a34('0x35')](_0x41ad88,_0x32220b),function(){});_0x6a9f98('zip\x20finished');});});}})[_0x1a34('0x37')](function(){if(!_0x2ff23f)return;rimraf(path[_0x1a34('0x35')](_0x41ad88,_0x32220b),function(){});})['then'](function(){logger[_0x1a34('0x3e')](util[_0x1a34('0x1e')](_0x1a34('0x3f'),EXTRACTED_REPORT_ID,_0x1a34('0x40')));return analyticExtractedReport(_0x1a34('0x41'),_0x2ff23f?util[_0x1a34('0x1e')](_0x1a34('0x3c'),_0x32220b,_0x2ff23f?_0x1a34('0x3d'):_0x1a34('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1a34('0x3e')](util[_0x1a34('0x1e')](_0x1a34('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x1a34('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1a34('0x37')](function(_0x435883){EXTRACTED_REPORT=_0x435883;return dbH[_0x1a34('0x2d')][_0x1a34('0x2e')](util[_0x1a34('0x1e')](_0x1a34('0x44'),QUERY),{'type':dbH[_0x1a34('0x2d')][_0x1a34('0x2f')][_0x1a34('0x30')]});})['then'](extractReport)['catch'](function(_0x375535){logger['info'](util[_0x1a34('0x1e')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x1a34('0x45')](_0x375535,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x1a34('0x46')](function(){process[_0x1a34('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x346ff1=new PdfPrinter({'Arial':{'normal':__dirname+_0x1a34('0x48'),'bold':__dirname+_0x1a34('0x49'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x1a34('0x4a')}});return _0x346ff1;}function getPDFDocDefinitionFromHTML(_0x49440c,_0x4d685b){var _0x3fa34c=util[_0x1a34('0x1e')](_0x1a34('0x4b'),_0x4d685b[_0x1a34('0x4c')],_0x4d685b['interactionId']);var _0x373816=moment()['format'](_0x1a34('0x4d'))[_0x1a34('0x26')]();var _0xc2c02f=htmlToPdfmake(_0x49440c,{'window':window,'tableAutoSize':!![]});return{'content':[_0xc2c02f],'defaultStyle':{'font':_0x1a34('0x4e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1a34('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1a34('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x1a34('0x50')}];},'footer':function(_0x6edaed,_0x12d938){return[{'text':util[_0x1a34('0x1e')](_0x1a34('0x51'),_0x3fa34c,_0x6edaed,_0x12d938,_0x373816),'style':_0x1a34('0x27')}];}};}function writePDFDocument(_0x2f0ac3,_0x758918){return new Promise(function(_0x5bdfc5,_0x5aa886){var _0x71a23f=_0x2f0ac3[_0x1a34('0x52')](fs['createWriteStream'](_0x758918));_0x71a23f['on'](_0x1a34('0x53'),function(){_0x5bdfc5(_0x1a34('0x53'));});_0x71a23f['on'](_0x1a34('0x54'),function(_0x333653){_0x5aa886(_0x333653);});_0x2f0ac3['end']();});}exports[_0x1a34('0x55')]=function(_0x83272c,_0x578d68){var _0x2ac59f=getPDFPrinter();var _0x62b4f2=getPDFDocDefinitionFromHTML(_0x83272c,_0x578d68);var _0x10c374=_0x2ac59f[_0x1a34('0x38')](_0x62b4f2);return writePDFDocument(_0x10c374,_0x578d68[_0x1a34('0x2')])[_0x1a34('0x56')](function(_0xa222ab){throw _0xa222ab;});}; \ No newline at end of file +var _0x840f=['\x20/\x20','black','right','num','split','then','range','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','basename','.pdf','existsSync','join','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','info','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','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','length','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak','before','margin','landscape'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x840f,0x86));var _0xf840=function(_0x5b7433,_0x300e84){_0x5b7433=_0x5b7433-0x0;var _0x54aa9f=_0x840f[_0x5b7433];return _0x54aa9f;};'use strict';var _=require(_0xf840('0x0'));var fs=require('fs');var util=require(_0xf840('0x1'));var path=require(_0xf840('0x2'));var moment=require(_0xf840('0x3'));var htmlToPdfmake=require(_0xf840('0x4'));var PdfPrinter=require(_0xf840('0x5'));var zipdir=require('zip-dir');var rimraf=require(_0xf840('0x6'));var JSDOM=require(_0xf840('0x7'))[_0xf840('0x8')];var window=new JSDOM('')[_0xf840('0x9')];var BPromise=require(_0xf840('0xa'));var db=require(_0xf840('0xb'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0xf840('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xf840('0xd')][0x2]);var QUERY=process[_0xf840('0xd')][0x3];var PATH=process[_0xf840('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf840('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x64ab17,_0x33e30b){var _0x2dd78d={'status':_0x64ab17};var _0x4a6694={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33e30b){_0x2dd78d[_0xf840('0xf')]=_0x33e30b;}return db[_0xf840('0x10')][_0xf840('0x11')](_0x2dd78d,_0x4a6694);}function getHeaders(_0x4deca0){return _[_0xf840('0x12')](_0x4deca0,function(_0x54da27){return{'text':_0x54da27,'style':_0xf840('0x13')};});}function getRows(_0x2cee14,_0x5d25cf){return _[_0xf840('0x12')](_0x5d25cf,function(_0x2d1d31){return _(_0x2d1d31)['pick'](_0x2cee14)[_0xf840('0x12')](function(_0x4f0a93){return _0x4f0a93?_[_0xf840('0x14')](_0x4f0a93):'';})[_0xf840('0x15')]();});}function createTable(_0x465c93,_0x3f1b22){var _0x48795e={'widths':_['fill'](Array(_0x465c93[_0xf840('0x16')]),0x91),'heights':function(_0x423686){return _0x423686===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3270ca=getHeaders(_0x465c93);_0x48795e[_0xf840('0x17')]['push'](_0x3270ca);var _0xad69ae=getRows(_0x465c93,_0x3f1b22);_0x48795e[_0xf840('0x17')]=_0x48795e[_0xf840('0x17')][_0xf840('0x18')](_0xad69ae);return _0x48795e;}function createTables(_0x30d78b){var _0x463220=[];var _0x4cdf2a=_[_0xf840('0x19')](Object[_0xf840('0x1a')](_0x30d78b[0x0]),0x5);_0x4cdf2a[_0xf840('0x1b')](function(_0x4b2068){_0x463220[_0xf840('0x1c')](createTable(_0x4b2068,_0x30d78b));});return _0x463220;}function getPDFDocDefinition(_0x2f7c8b){var _0x37d0d9=util[_0xf840('0x1d')](_0xf840('0x1e'),NAME,EXTRACTED_REPORT[_0xf840('0x1f')],moment(EXTRACTED_REPORT[_0xf840('0x20')])[_0xf840('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xf840('0x21')])[_0xf840('0x1d')](FORMAT));var _0x23fa7f=[];for(var _0x24af9b=0x0;_0x24af9b<_0x2f7c8b[_0xf840('0x16')];_0x24af9b++){var _0x393af2=[];if(_0x24af9b===0x0){_0x393af2[_0xf840('0x1c')]({'text':_0x37d0d9,'style':'header'});}var _0x284f7c={'table':_0x2f7c8b[_0x24af9b]};if(_0x24af9b>0x0){_0x284f7c[_0xf840('0x22')]=_0xf840('0x23');_0x284f7c[_0xf840('0x24')]=[0x0,0x46,0x0,0x0];}_0x393af2[_0xf840('0x1c')](_0x284f7c);_0x23fa7f['push'](_0x393af2);}return{'pageSize':'A4','pageOrientation':_0xf840('0x25'),'content':_0x23fa7f,'footer':function(_0x14c528,_0x4bcea4){return{'text':_0x14c528[_0xf840('0x14')]()+_0xf840('0x26')+_0x4bcea4,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf840('0x27')},'footer':{'alignment':_0xf840('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2420ca){var _0x3787d7=0x1388;var _0x3500d1;if(!_0x2420ca[0x0][_0xf840('0x29')]){return analyticExtractedReport('Empty');}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf840('0x2a'),'splitSizePdf']})[_0xf840('0x2b')](function(_0xa1eec7){if(_0xa1eec7){_0x3500d1=_0xa1eec7;_0x3787d7=_0x3500d1['splitSizePdf']||0x3e8;}})[_0xf840('0x2b')](function(){var _0x350c37=[];var _0xa8ee17=0x0;if(_0x3500d1[_0xf840('0x2a')]){if(_0x2420ca&&_0x2420ca['length']){var _0x4390ab=_[_0xf840('0x2c')](_0x2420ca[0x0][_0xf840('0x29')]/_0x3787d7);var _0x1c4dc5=Number['isInteger'](_0x2420ca[0x0][_0xf840('0x29')]/_0x3787d7)?_0x2420ca[0x0][_0xf840('0x29')]%_0x3787d7:0x0;_0x4390ab['forEach'](function(_0x149c25){if(_0x149c25>0x0){_0xa8ee17+=_0x3787d7;}_0x350c37[_0xf840('0x1c')](dbH['sequelize'][_0xf840('0x2d')](util[_0xf840('0x1d')](_0xf840('0x2e'),QUERY,_0x3787d7,_0xa8ee17),{'type':dbH['sequelize'][_0xf840('0x2f')][_0xf840('0x30')]}));});if(_0x1c4dc5>0x0){_0xa8ee17+=_0x3787d7;_0x350c37[_0xf840('0x1c')](dbH[_0xf840('0x31')][_0xf840('0x2d')](util[_0xf840('0x1d')](_0xf840('0x2e'),QUERY,_0x1c4dc5,_0xa8ee17),{'type':dbH[_0xf840('0x31')][_0xf840('0x2f')]['SELECT']}));}}}else{_0x350c37[_0xf840('0x1c')](dbH[_0xf840('0x31')][_0xf840('0x2d')](QUERY,{'type':dbH[_0xf840('0x31')][_0xf840('0x2f')][_0xf840('0x30')]}));}var _0x22abdb=path['dirname'](PATH);var _0x34fdd9=path[_0xf840('0x32')](PATH,_0xf840('0x33'));var _0x2486a7=_0x3500d1[_0xf840('0x2a')]&&_0x350c37[_0xf840('0x16')]>0x1;var _0x18779b=[];if(!fs[_0xf840('0x34')](path[_0xf840('0x35')](_0x22abdb,_0x34fdd9))&&_0x2486a7){fs['mkdirSync'](path[_0xf840('0x35')](_0x22abdb,_0x34fdd9));}return BPromise['each'](_0x350c37,function(_0x4c49c6){_0x18779b[_0xf840('0x1c')](_0x4c49c6);})[_0xf840('0x2b')](function(){var _0x1ae0f7=[];for(var _0x221019=0x0;_0x221019<_0x18779b['length'];_0x221019+=0x1){var _0x326193=_0x18779b[_0x221019];var _0x5c509f=createTables(_[_0xf840('0x36')](_0x326193));var _0x50282d;var _0xa4cf28=getPDFDocDefinition(_0x5c509f);var _0x14e247=getPDFPrinter();var _0x33dd8a=_0x14e247[_0xf840('0x37')](_0xa4cf28);if(_0x2486a7){_0x50282d=path[_0xf840('0x35')](_0x22abdb,_0x34fdd9,util['format'](_0xf840('0x38'),_0x34fdd9,_0x221019,'pdf'));}else{_0x50282d=path['join'](_0x22abdb,util['format'](_0xf840('0x39'),_0x34fdd9,_0xf840('0x3a')));}_0x1ae0f7[_0xf840('0x1c')](writePDFDocument(_0x33dd8a,_0x50282d));}return Promise[_0xf840('0x3b')](_0x1ae0f7);})[_0xf840('0x2b')](function(){if(_0x2486a7){return new Promise(function(_0x659a7c){zipdir(path[_0xf840('0x35')](_0x22abdb,_0x34fdd9),{'saveTo':path['join'](_0x22abdb,util[_0xf840('0x1d')](_0xf840('0x39'),_0x34fdd9,_0xf840('0x3c')))},function(){rimraf(path[_0xf840('0x35')](_0x22abdb,_0x34fdd9),function(){});_0x659a7c(_0xf840('0x3d'));});});}})[_0xf840('0x2b')](function(){if(!_0x2486a7)return;rimraf(path[_0xf840('0x35')](_0x22abdb,_0x34fdd9),function(){});})[_0xf840('0x2b')](function(){logger[_0xf840('0x3e')](util[_0xf840('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf840('0x3f')));return analyticExtractedReport(_0xf840('0x40'),_0x2486a7?util[_0xf840('0x1d')](_0xf840('0x39'),_0x34fdd9,_0x2486a7?_0xf840('0x3c'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf840('0x3e')](util[_0xf840('0x1d')](_0xf840('0x41'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xf840('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf840('0x2b')](function(_0x512a05){EXTRACTED_REPORT=_0x512a05;return dbH[_0xf840('0x31')][_0xf840('0x2d')](util[_0xf840('0x1d')](_0xf840('0x42'),QUERY),{'type':dbH[_0xf840('0x31')][_0xf840('0x2f')][_0xf840('0x30')]});})[_0xf840('0x2b')](extractReport)[_0xf840('0x43')](function(_0x458fe1){logger[_0xf840('0x3e')](util[_0xf840('0x1d')](_0xf840('0x44'),EXTRACTED_REPORT_ID,_0xf840('0x3f')),util[_0xf840('0x45')](_0x458fe1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf840('0x46')](function(){process[_0xf840('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x53ca1b=new PdfPrinter({'Arial':{'normal':__dirname+_0xf840('0x48'),'bold':__dirname+_0xf840('0x49'),'italics':__dirname+_0xf840('0x4a'),'bolditalics':__dirname+_0xf840('0x4b')}});return _0x53ca1b;}function getPDFDocDefinitionFromHTML(_0x21266c,_0x16b6bb){var _0x2c827c=util['format'](_0xf840('0x4c'),_0x16b6bb['channel'],_0x16b6bb[_0xf840('0x4d')]);var _0x4923fd=moment()[_0xf840('0x1d')]('YYYY-MM-DD')['toString']();var _0x39643f=htmlToPdfmake(_0x21266c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x39643f],'defaultStyle':{'font':_0xf840('0x4e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf840('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xf840('0x4f')}},'header':function(){return[{'text':_0xf840('0x50'),'style':'header'}];},'footer':function(_0x423e6,_0x530311){return[{'text':util[_0xf840('0x1d')](_0xf840('0x51'),_0x2c827c,_0x423e6,_0x530311,_0x4923fd),'style':'footer'}];}};}function writePDFDocument(_0x29b4ec,_0xf52262){return new Promise(function(_0x312223,_0x354922){var _0x367a8a=_0x29b4ec[_0xf840('0x52')](fs[_0xf840('0x53')](_0xf52262));_0x367a8a['on'](_0xf840('0x54'),function(){_0x312223(_0xf840('0x54'));});_0x367a8a['on']('error',function(_0x8c08d2){_0x354922(_0x8c08d2);});_0x29b4ec['end']();});}exports[_0xf840('0x55')]=function(_0x1383cc,_0x11520e){var _0x2d6914=getPDFPrinter();var _0x2e1732=getPDFDocDefinitionFromHTML(_0x1383cc,_0x11520e);var _0x5d0e8c=_0x2d6914['createPdfKitDocument'](_0x2e1732);return writePDFDocument(_0x5d0e8c,_0x11520e['path'])[_0xf840('0x43')](function(_0x1a6b5e){throw _0x1a6b5e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5f585c7..ad4a381 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 _0x81b3=['sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','find','split','splitSizeXlsx','then'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x81b3,0x19d));var _0x381b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x81b3[_0x2be8c2];return _0x97f531;};'use strict';var util=require(_0x381b('0x0'));var path=require(_0x381b('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x381b('0x2'));var BPromise=require(_0x381b('0x3'));var zipdir=require(_0x381b('0x4'));var rimraf=require('rimraf');var db=require(_0x381b('0x5'))['db'];var dbH=require(_0x381b('0x5'))['dbH'];var logger=require(_0x381b('0x6'))(_0x381b('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x381b('0x8')][0x2]);var QUERY=process[_0x381b('0x8')][0x3];var PATH=process[_0x381b('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x717f71,_0x27a27a){var _0x28b42f={'status':_0x717f71};var _0x55f9f8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27a27a){_0x28b42f[_0x381b('0x9')]=_0x27a27a;}return db[_0x381b('0xa')][_0x381b('0xb')](_0x28b42f,_0x55f9f8);}function main(){var _0x3c7e9b=0x1388;var _0x4d0d46;logger[_0x381b('0xc')](util[_0x381b('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x381b('0xe')));return db['Setting'][_0x381b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x381b('0x10'),_0x381b('0x11')]})['then'](function(_0xb1f9e9){if(_0xb1f9e9){_0x4d0d46=_0xb1f9e9;_0x3c7e9b=_0x4d0d46[_0x381b('0x11')]||0x1388;}})[_0x381b('0x12')](function(){return dbH[_0x381b('0x13')][_0x381b('0x14')](util['format'](_0x381b('0x15'),QUERY),{'type':dbH[_0x381b('0x13')][_0x381b('0x16')]['SELECT']});})[_0x381b('0x12')](function(_0x4e0d8b){if(!_0x4e0d8b[0x0][_0x381b('0x17')]){return analyticExtractedReport(_0x381b('0x18'));}var _0x34ca81=[];var _0x5a5e4d=0x0;if(_0x4d0d46[_0x381b('0x10')]){if(_0x4e0d8b&&_0x4e0d8b[_0x381b('0x19')]){var _0x2d8ab4=_[_0x381b('0x1a')](_0x4e0d8b[0x0][_0x381b('0x17')]/_0x3c7e9b);var _0x7c4696=Number[_0x381b('0x1b')](_0x4e0d8b[0x0][_0x381b('0x17')]/_0x3c7e9b)?_0x4e0d8b[0x0][_0x381b('0x17')]%_0x3c7e9b:0x0;_0x2d8ab4[_0x381b('0x1c')](function(_0x42de3f){if(_0x42de3f>0x0){_0x5a5e4d+=_0x3c7e9b;}_0x34ca81['push'](dbH['sequelize'][_0x381b('0x14')](util['format'](_0x381b('0x1d'),QUERY,_0x3c7e9b,_0x5a5e4d),{'type':dbH[_0x381b('0x13')][_0x381b('0x16')][_0x381b('0x1e')]}));});if(_0x7c4696>0x0){_0x5a5e4d+=_0x3c7e9b;_0x34ca81[_0x381b('0x1f')](dbH[_0x381b('0x13')][_0x381b('0x14')](util[_0x381b('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x7c4696,_0x5a5e4d),{'type':dbH[_0x381b('0x13')]['QueryTypes'][_0x381b('0x1e')]}));}}}else{_0x34ca81[_0x381b('0x1f')](dbH[_0x381b('0x13')][_0x381b('0x14')](QUERY,{'type':dbH[_0x381b('0x13')][_0x381b('0x16')][_0x381b('0x1e')]}));}var _0x140825=path['dirname'](PATH);var _0x2585e7=path[_0x381b('0x20')](PATH,_0x381b('0x21'));var _0x18639b=_0x4d0d46['split']&&_0x34ca81[_0x381b('0x19')]>0x1;var _0x35b4ee=[];if(!fs[_0x381b('0x22')](path[_0x381b('0x23')](_0x140825,_0x2585e7))&&_0x18639b){fs[_0x381b('0x24')](path[_0x381b('0x23')](_0x140825,_0x2585e7));}return BPromise[_0x381b('0x25')](_0x34ca81,function(_0x358a41){_0x35b4ee[_0x381b('0x1f')](_0x358a41);})[_0x381b('0x12')](function(){for(var _0xf0b9b5=0x0;_0xf0b9b5<_0x35b4ee['length'];_0xf0b9b5+=0x1){var _0x1e39ba;var _0x464f2c=_0x35b4ee[_0xf0b9b5];if(_0x18639b){_0x1e39ba=path[_0x381b('0x23')](_0x140825,_0x2585e7,util[_0x381b('0xd')](_0x381b('0x26'),_0x2585e7,_0xf0b9b5,_0x381b('0x27')));}else{_0x1e39ba=path['join'](_0x140825,util['format'](_0x381b('0x28'),_0x2585e7,'xlsx'));}fs[_0x381b('0x29')](_0x1e39ba,json2xls(_0x464f2c),_0x381b('0x2a'));}})[_0x381b('0x12')](function(){if(_0x18639b){return new Promise(function(_0x4ab7cb){zipdir(path[_0x381b('0x23')](_0x140825,_0x2585e7),{'saveTo':path['join'](_0x140825,util[_0x381b('0xd')](_0x381b('0x28'),_0x2585e7,_0x381b('0x2b')))},function(_0x49c6da,_0x1c9d16){rimraf(path['join'](_0x140825,_0x2585e7),function(){});_0x4ab7cb(_0x381b('0x2c'));});});}})[_0x381b('0x12')](function(){logger[_0x381b('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x381b('0xe')));return analyticExtractedReport('Completed',_0x18639b?util[_0x381b('0xd')](_0x381b('0x28'),_0x2585e7,_0x18639b?_0x381b('0x2b'):_0x381b('0x27')):null);});})[_0x381b('0x2d')](function(_0x3316f7){logger['info'](util[_0x381b('0xd')](_0x381b('0x2e'),EXTRACTED_REPORT_ID,_0x381b('0xe')),util['inspect'](_0x3316f7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x381b('0x2f'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4189=['dbH','../../config/logger','analytics','argv','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','splitSizeXlsx','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','xlsx','writeFileSync','binary','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','lodash','json2xls','bluebird','zip-dir','../../mysqldb'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x4189,0x13c));var _0x9418=function(_0x33496c,_0x449c24){_0x33496c=_0x33496c-0x0;var _0x912562=_0x4189[_0x33496c];return _0x912562;};'use strict';var util=require(_0x9418('0x0'));var path=require('path');var _=require(_0x9418('0x1'));var fs=require('fs');var json2xls=require(_0x9418('0x2'));var BPromise=require(_0x9418('0x3'));var zipdir=require(_0x9418('0x4'));var rimraf=require('rimraf');var db=require(_0x9418('0x5'))['db'];var dbH=require('../../mysqldb')[_0x9418('0x6')];var logger=require(_0x9418('0x7'))(_0x9418('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9418('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1fa111,_0x564913){var _0x259864={'status':_0x1fa111};var _0x3bc57e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x564913){_0x259864['savename']=_0x564913;}return db['AnalyticExtractedReport'][_0x9418('0xa')](_0x259864,_0x3bc57e);}function main(){var _0x36d2b=0x1388;var _0x281ea6;logger[_0x9418('0xb')](util['format'](_0x9418('0xc'),EXTRACTED_REPORT_ID,_0x9418('0xd')));return db[_0x9418('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9418('0xf'),'splitSizeXlsx']})[_0x9418('0x10')](function(_0xac0acd){if(_0xac0acd){_0x281ea6=_0xac0acd;_0x36d2b=_0x281ea6[_0x9418('0x11')]||0x1388;}})['then'](function(){return dbH[_0x9418('0x12')]['query'](util[_0x9418('0x13')](_0x9418('0x14'),QUERY),{'type':dbH[_0x9418('0x12')][_0x9418('0x15')][_0x9418('0x16')]});})[_0x9418('0x10')](function(_0x19a9c4){if(!_0x19a9c4[0x0][_0x9418('0x17')]){return analyticExtractedReport('Empty');}var _0x27bf36=[];var _0x6f9669=0x0;if(_0x281ea6[_0x9418('0xf')]){if(_0x19a9c4&&_0x19a9c4[_0x9418('0x18')]){var _0x17378f=_['range'](_0x19a9c4[0x0]['num']/_0x36d2b);var _0xd45cdb=Number['isInteger'](_0x19a9c4[0x0]['num']/_0x36d2b)?_0x19a9c4[0x0][_0x9418('0x17')]%_0x36d2b:0x0;_0x17378f[_0x9418('0x19')](function(_0x6f3373){if(_0x6f3373>0x0){_0x6f9669+=_0x36d2b;}_0x27bf36[_0x9418('0x1a')](dbH[_0x9418('0x12')][_0x9418('0x1b')](util[_0x9418('0x13')](_0x9418('0x1c'),QUERY,_0x36d2b,_0x6f9669),{'type':dbH[_0x9418('0x12')][_0x9418('0x15')][_0x9418('0x16')]}));});if(_0xd45cdb>0x0){_0x6f9669+=_0x36d2b;_0x27bf36['push'](dbH[_0x9418('0x12')][_0x9418('0x1b')](util[_0x9418('0x13')](_0x9418('0x1c'),QUERY,_0xd45cdb,_0x6f9669),{'type':dbH[_0x9418('0x12')]['QueryTypes'][_0x9418('0x16')]}));}}}else{_0x27bf36['push'](dbH[_0x9418('0x12')][_0x9418('0x1b')](QUERY,{'type':dbH['sequelize'][_0x9418('0x15')][_0x9418('0x16')]}));}var _0x5cad09=path[_0x9418('0x1d')](PATH);var _0x4f4393=path[_0x9418('0x1e')](PATH,'.xlsx');var _0x4864d7=_0x281ea6[_0x9418('0xf')]&&_0x27bf36['length']>0x1;var _0x44577c=[];if(!fs[_0x9418('0x1f')](path[_0x9418('0x20')](_0x5cad09,_0x4f4393))&&_0x4864d7){fs[_0x9418('0x21')](path['join'](_0x5cad09,_0x4f4393));}return BPromise[_0x9418('0x22')](_0x27bf36,function(_0x5e24d2){_0x44577c[_0x9418('0x1a')](_0x5e24d2);})[_0x9418('0x10')](function(){for(var _0x54dfbe=0x0;_0x54dfbe<_0x44577c[_0x9418('0x18')];_0x54dfbe+=0x1){var _0x9849f1;var _0x19f462=_0x44577c[_0x54dfbe];if(_0x4864d7){_0x9849f1=path[_0x9418('0x20')](_0x5cad09,_0x4f4393,util['format']('%s%d.%s',_0x4f4393,_0x54dfbe,_0x9418('0x23')));}else{_0x9849f1=path[_0x9418('0x20')](_0x5cad09,util['format']('%s.%s',_0x4f4393,_0x9418('0x23')));}fs[_0x9418('0x24')](_0x9849f1,json2xls(_0x19f462),_0x9418('0x25'));}})[_0x9418('0x10')](function(){if(_0x4864d7){return new Promise(function(_0x571572){zipdir(path[_0x9418('0x20')](_0x5cad09,_0x4f4393),{'saveTo':path[_0x9418('0x20')](_0x5cad09,util[_0x9418('0x13')](_0x9418('0x26'),_0x4f4393,'zip'))},function(_0xcfa322,_0x4c0ad7){rimraf(path[_0x9418('0x20')](_0x5cad09,_0x4f4393),function(){});_0x571572(_0x9418('0x27'));});});}})[_0x9418('0x10')](function(){logger['info'](util[_0x9418('0x13')](_0x9418('0x28'),EXTRACTED_REPORT_ID,_0x9418('0xd')));return analyticExtractedReport(_0x9418('0x29'),_0x4864d7?util[_0x9418('0x13')](_0x9418('0x26'),_0x4f4393,_0x4864d7?'zip':_0x9418('0x23')):null);});})[_0x9418('0x2a')](function(_0x1de508){logger[_0x9418('0xb')](util[_0x9418('0x13')](_0x9418('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x1de508,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9418('0x2c')](function(){process[_0x9418('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 5c2bff7..1181005 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 _0xbd9f=['hasOwnProperty','extensions','find','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','priority','extension','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback'];(function(_0x109ca0,_0x1010c6){var _0x58a444=function(_0x860a1a){while(--_0x860a1a){_0x109ca0['push'](_0x109ca0['shift']());}};_0x58a444(++_0x1010c6);}(_0xbd9f,0xc6));var _0xfbd9=function(_0x5eb3c1,_0x2d0bab){_0x5eb3c1=_0x5eb3c1-0x0;var _0xfafed=_0xbd9f[_0x5eb3c1];return _0xfafed;};'use strict';var _=require('lodash');var util=require(_0xfbd9('0x0'));function rewrite(_0x5ebe51,_0x31eb0d){var _0x1a0531=this;return _0x5ebe51[_0xfbd9('0x1')][_0xfbd9('0x2')][_0xfbd9('0x3')]({'raw':!![]})[_0xfbd9('0x4')](function(_0x149f00){_0x1a0531[_0xfbd9('0x5')]=_0x149f00;return _0x5ebe51[_0xfbd9('0x1')][_0xfbd9('0x6')][_0xfbd9('0x3')]({'where':{'IntervalId':_0x31eb0d[_0xfbd9('0x7')]},'raw':!![]});})['then'](function(_0x4383de){return _0x5ebe51[_0xfbd9('0x1')][_0xfbd9('0x6')][_0xfbd9('0x3')]({'where':{'exten':{'$in':_[_0xfbd9('0x8')](_[_0xfbd9('0x9')](_0x4383de,_0xfbd9('0xa')))}},'order':[{'raw':_0xfbd9('0xb')}],'raw':!![]});})['then'](function(_0x32dd48){var _0x5291f2=_[_0xfbd9('0xc')](_0x32dd48,{'priority':'1'});var _0x2a10c9=_[_0xfbd9('0xc')](_0x32dd48,{'isApp':0x1});var _0x5e4b2a=_['groupBy'](_0x2a10c9,'exten');var _0x3f5aaf=[_0xfbd9('0xd'),_0xfbd9('0xe')];var _0x174d5f=[];var _0x1ed99b=[];for(var _0x2368af in _0x5e4b2a){if(_0x5e4b2a[_0xfbd9('0xf')](_0x2368af)){_0x1a0531['priority']=0x2;_0x1a0531[_0xfbd9('0x10')]=[];_0x1a0531['extension']=_[_0xfbd9('0x11')](_0x5291f2,{'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')]});_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x13')],'app':_0xfbd9('0x14'),'appdata':util[_0xfbd9('0x15')]('CDR(type)=%s',_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x13')]),'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0]['exten'],'priority':_0x1a0531['priority']++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});if(_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x13')]===_0xfbd9('0x18')){_0x1a0531['extensions']['push']({'type':_0x5e4b2a[_0x2368af][0x0]['type'],'app':'Set','appdata':_0xfbd9('0x19')+_0x5e4b2a[_0x2368af][0x0]['VoiceExtensionId'],'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531[_0xfbd9('0x1a')]++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});}else if(_0x5e4b2a[_0x2368af][0x0]['type']==='outbound'){if(_0x1a0531[_0xfbd9('0x1b')]){_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x13')],'app':_0xfbd9('0x14'),'appdata':'CDR(destination)='+(_0x1a0531[_0xfbd9('0x1b')][_0xfbd9('0x1c')]?_0xfbd9('0x1d')+_0x1a0531['extension'][_0xfbd9('0x1c')]+'}':_0xfbd9('0x1e')),'context':_0x5e4b2a[_0x2368af][0x0]['context'],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531[_0xfbd9('0x1a')]++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});}_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0]['type'],'app':_0xfbd9('0x14'),'appdata':_0xfbd9('0x19')+_0x5e4b2a[_0x2368af][0x0]['VoiceExtensionId'],'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531['priority']++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});var _0x57d6ff=_0x1a0531[_0xfbd9('0x1a')]++;_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0]['type'],'app':_0xfbd9('0x1f'),'appdata':_0xfbd9('0x20')+(_0x57d6ff+0x2)+_0xfbd9('0x21')+(_0x57d6ff+0x1)+')','context':_0x5e4b2a[_0x2368af][0x0]['context'],'exten':_0x5e4b2a[_0x2368af][0x0]['exten'],'priority':_0x57d6ff,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0]['VoiceExtensionId']});if(_0x1a0531[_0xfbd9('0x1b')]){_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x13')],'app':_0xfbd9('0x14'),'appdata':_0x1a0531[_0xfbd9('0x1b')]['cutdigits']?_0xfbd9('0x22')+_0x1a0531[_0xfbd9('0x1b')]['cutdigits']+'}':_0xfbd9('0x23'),'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531[_0xfbd9('0x1a')]++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0]['VoiceExtensionId']});}_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0]['type'],'app':_0xfbd9('0x14'),'appdata':_0xfbd9('0x24')+_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')],'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531[_0xfbd9('0x1a')]++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});if(_0x1a0531['extension']&&_0x1a0531[_0xfbd9('0x1b')][_0xfbd9('0xf')](_0xfbd9('0x25'))&&_0x1a0531[_0xfbd9('0x1b')][_0xfbd9('0x25')]!=='none'){_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x13')],'app':_0xfbd9('0x14'),'appdata':_0xfbd9('0x26'),'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531[_0xfbd9('0x1a')]++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0]['VoiceExtensionId']});_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0]['type'],'app':_0xfbd9('0x14'),'appdata':_0xfbd9('0x27')+_0x1a0531['extension'][_0xfbd9('0x25')]||'wav','context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531[_0xfbd9('0x1a')]++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});}}_0x1a0531['extensions'][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x13')],'app':_0xfbd9('0x14'),'appdata':_0xfbd9('0x28'),'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531['priority']++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x13')],'app':_0xfbd9('0x14'),'appdata':_0xfbd9('0x29'),'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531[_0xfbd9('0x1a')]++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0]['VoiceExtensionId']});_0x1a0531['extensions'][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x13')],'app':_0xfbd9('0x14'),'appdata':_0xfbd9('0x2a'),'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'priority':_0x1a0531['priority']++,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});for(var _0x16368a=0x0,_0x4dc3fb=0x0;_0x16368a<_0x5e4b2a[_0x2368af][_0xfbd9('0x2b')];_0x16368a+=0x1,_0x4dc3fb=0x0){var _0x5ba850=_0x5e4b2a[_0x2368af][_0x16368a];if(_0x5ba850[_0xfbd9('0x13')]){_0x5ba850[_0xfbd9('0x13')]=_0x5ba850[_0xfbd9('0x13')][_0xfbd9('0x2c')]();}var _0x1581d8=[];var _0x48c32b=[];delete _0x5ba850['id'];delete _0x5ba850[_0xfbd9('0x2d')];delete _0x5ba850[_0xfbd9('0x2e')];var _0x362d0d=_0x5ba850[_0xfbd9('0x2f')]!==_0xfbd9('0x30')?[_0x5ba850[_0xfbd9('0x2f')]]:_0x5ba850['IntervalId']?_[_0xfbd9('0x9')](_['filter'](_0x1a0531[_0xfbd9('0x5')],{'IntervalId':_0x5ba850[_0xfbd9('0x7')]}),_0xfbd9('0x2f')):[];if(_0x5ba850[_0xfbd9('0xf')](_0xfbd9('0x31'))){if(_0x5ba850[_0xfbd9('0x31')]&&_0x5ba850[_0xfbd9('0x31')]!=='--'){_0x1581d8[_0xfbd9('0x12')]({'type':_0x5ba850[_0xfbd9('0x13')],'app':_0xfbd9('0x14'),'appdata':_0xfbd9('0x32')+_0x5ba850[_0xfbd9('0x31')],'context':_0x5ba850[_0xfbd9('0x16')],'exten':_0x5ba850[_0xfbd9('0xa')],'priority':_0x362d0d['length']+_0x1a0531[_0xfbd9('0x1a')]+_0x4dc3fb++,'VoiceExtensionId':_0x5ba850[_0xfbd9('0x17')]});}}if(_0x5ba850[_0xfbd9('0x13')]===_0xfbd9('0x33')&&_0x5ba850[_0xfbd9('0xf')](_0xfbd9('0x34'))){if(_0x5ba850[_0xfbd9('0x34')]){_0x1581d8[_0xfbd9('0x12')]({'type':_0x5ba850[_0xfbd9('0x13')],'app':_0xfbd9('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5ba850[_0xfbd9('0x34')]+')','context':_0x5ba850['context'],'exten':_0x5ba850[_0xfbd9('0xa')],'priority':_0x362d0d['length']+_0x1a0531[_0xfbd9('0x1a')]+_0x4dc3fb++,'VoiceExtensionId':_0x5ba850[_0xfbd9('0x17')]});}else{_0x1581d8[_0xfbd9('0x12')]({'type':_0x5ba850[_0xfbd9('0x13')],'app':_0xfbd9('0x1f'),'appdata':_0xfbd9('0x35'),'context':_0x5ba850[_0xfbd9('0x16')],'exten':_0x5ba850[_0xfbd9('0xa')],'priority':_0x362d0d[_0xfbd9('0x2b')]+_0x1a0531[_0xfbd9('0x1a')]+_0x4dc3fb++,'VoiceExtensionId':_0x5ba850[_0xfbd9('0x17')]});}}if(_0x5ba850[_0xfbd9('0xf')](_0xfbd9('0x36'))){if(_0x3f5aaf['indexOf'](_0x5ba850[_0xfbd9('0x37')][_0xfbd9('0x2c')]())>=0x0&&_0x5ba850[_0xfbd9('0x38')]!==_0xfbd9('0x39')){if(_0x5ba850[_0xfbd9('0x36')]){_0x1581d8[_0xfbd9('0x12')]({'type':_0x5ba850['type'],'app':'ExecIf','appdata':_0xfbd9('0x3a'),'context':_0x5ba850[_0xfbd9('0x16')],'exten':_0x5ba850[_0xfbd9('0xa')],'priority':_0x362d0d[_0xfbd9('0x2b')]+_0x1a0531[_0xfbd9('0x1a')]+_0x4dc3fb++,'VoiceExtensionId':_0x5ba850[_0xfbd9('0x17')]});_0x1581d8[_0xfbd9('0x12')]({'type':_0x5ba850['type'],'app':_0xfbd9('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5ba850[_0xfbd9('0x16')],'exten':_0x5ba850[_0xfbd9('0xa')],'priority':_0x362d0d[_0xfbd9('0x2b')]+_0x1a0531['priority']+_0x4dc3fb++,'VoiceExtensionId':_0x5ba850[_0xfbd9('0x17')]});}else{_0x1581d8['push']({'type':_0x5ba850[_0xfbd9('0x13')],'app':_0xfbd9('0x1f'),'appdata':_0xfbd9('0x3b'),'context':_0x5ba850[_0xfbd9('0x16')],'exten':_0x5ba850[_0xfbd9('0xa')],'priority':_0x362d0d['length']+_0x1a0531['priority']+_0x4dc3fb++,'VoiceExtensionId':_0x5ba850['VoiceExtensionId']});_0x1581d8['push']({'type':_0x5ba850[_0xfbd9('0x13')],'app':_0xfbd9('0x14'),'appdata':_0xfbd9('0x3c'),'context':_0x5ba850[_0xfbd9('0x16')],'exten':_0x5ba850[_0xfbd9('0xa')],'priority':_0x362d0d[_0xfbd9('0x2b')]+_0x1a0531[_0xfbd9('0x1a')]+_0x4dc3fb++,'VoiceExtensionId':_0x5ba850[_0xfbd9('0x17')]});}}}for(var _0x3c0556=0x0;_0x3c0556<_0x362d0d[_0xfbd9('0x2b')];_0x3c0556+=0x1){var _0x301853=_0x1a0531['priority']+_0x362d0d['length'];var _0x3045a6=_0x3c0556===_0x362d0d['length']-0x1?_0x1a0531[_0xfbd9('0x1a')]+_0x1581d8[_0xfbd9('0x2b')]+_0x48c32b[_0xfbd9('0x2b')]+0x2:_0x1a0531[_0xfbd9('0x1a')]+_0x3c0556+0x1;_0x1581d8['splice'](_0x3c0556,0x0,{'type':_0x5ba850[_0xfbd9('0x13')],'app':_0xfbd9('0x3d'),'appdata':_0x362d0d[_0x3c0556]+'?'+_0x5ba850[_0xfbd9('0x16')]+_0xfbd9('0x3e')+_0x301853+':'+_0x5ba850[_0xfbd9('0x16')]+_0xfbd9('0x3e')+_0x3045a6,'exten':_0x5ba850['exten'],'context':_0x5ba850[_0xfbd9('0x16')],'priority':_0x1a0531['priority']+_0x3c0556,'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});}_0x5ba850[_0xfbd9('0x1a')]=_0x1581d8[_0xfbd9('0x2b')]?_[_0xfbd9('0x3f')](_0x1581d8)['priority']+0x1:_0x1a0531[_0xfbd9('0x1a')];_0x1a0531[_0xfbd9('0x1a')]=(_0x48c32b[_0xfbd9('0x2b')]?_['last'](_0x48c32b)[_0xfbd9('0x1a')]:_0x5ba850[_0xfbd9('0x1a')])+0x1;_0x1a0531[_0xfbd9('0x10')]=_[_0xfbd9('0x40')](_0x1a0531[_0xfbd9('0x10')],_0x1581d8,[_0x5ba850],_0x48c32b);}_0x1a0531[_0xfbd9('0x10')][_0xfbd9('0x12')]({'type':_0x5e4b2a[_0x2368af][0x0]['type'],'app':'Hangup','exten':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0xa')],'context':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x16')],'priority':_0x1a0531['priority'],'VoiceExtensionId':_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]});_0x174d5f['push'](_0x5e4b2a[_0x2368af][0x0][_0xfbd9('0x17')]);_0x1ed99b=_['concat'](_0x1ed99b,_0x1a0531[_0xfbd9('0x10')]);}}return _0x5ebe51[_0xfbd9('0x41')](function(_0x283ba2){return _0x5ebe51[_0xfbd9('0x1')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x174d5f}},'transaction':_0x283ba2})[_0xfbd9('0x4')](function(_0x3d7f75){return _0x5ebe51[_0xfbd9('0x1')]['VoiceExtension'][_0xfbd9('0x42')](_[_0xfbd9('0x43')](_0x1ed99b,_0xfbd9('0x1a')),{'transaction':_0x283ba2});});});})[_0xfbd9('0x44')](function(_0x54e868){console[_0xfbd9('0x45')](_0x54e868);});}exports[_0xfbd9('0x46')]=rewrite; \ No newline at end of file +var _0xe813=['CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','intervals','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','priority','extensions','find','push','CDR(type)=%s','context','VoiceExtensionId','type','inbound','Set'];(function(_0x5847b8,_0x47bf07){var _0x4b7c0e=function(_0x53039d){while(--_0x53039d){_0x5847b8['push'](_0x5847b8['shift']());}};_0x4b7c0e(++_0x47bf07);}(_0xe813,0xb7));var _0x3e81=function(_0x8cb470,_0x2b9757){_0x8cb470=_0x8cb470-0x0;var _0x2ca139=_0xe813[_0x8cb470];return _0x2ca139;};'use strict';var _=require(_0x3e81('0x0'));var util=require(_0x3e81('0x1'));function rewrite(_0x4b5709,_0x27cbc2){var _0x46cccd=this;return _0x4b5709[_0x3e81('0x2')][_0x3e81('0x3')][_0x3e81('0x4')]({'raw':!![]})[_0x3e81('0x5')](function(_0x305f44){_0x46cccd['intervals']=_0x305f44;return _0x4b5709[_0x3e81('0x2')][_0x3e81('0x6')][_0x3e81('0x4')]({'where':{'IntervalId':_0x27cbc2[_0x3e81('0x7')]},'raw':!![]});})[_0x3e81('0x5')](function(_0x48056a){return _0x4b5709[_0x3e81('0x2')]['VoiceExtension'][_0x3e81('0x4')]({'where':{'exten':{'$in':_[_0x3e81('0x8')](_[_0x3e81('0x9')](_0x48056a,_0x3e81('0xa')))}},'order':[{'raw':_0x3e81('0xb')}],'raw':!![]});})[_0x3e81('0x5')](function(_0x22c614){var _0x3a9a72=_['filter'](_0x22c614,{'priority':'1'});var _0x4b4494=_[_0x3e81('0xc')](_0x22c614,{'isApp':0x1});var _0x39c2a7=_['groupBy'](_0x4b4494,_0x3e81('0xa'));var _0xf7d3c7=[_0x3e81('0xd'),'playback'];var _0x3222a0=[];var _0xa1132f=[];for(var _0x492ee1 in _0x39c2a7){if(_0x39c2a7['hasOwnProperty'](_0x492ee1)){_0x46cccd[_0x3e81('0xe')]=0x2;_0x46cccd[_0x3e81('0xf')]=[];_0x46cccd['extension']=_[_0x3e81('0x10')](_0x3a9a72,{'exten':_0x39c2a7[_0x492ee1][0x0]['exten']});_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0]['type'],'app':'Set','appdata':util['format'](_0x3e81('0x12'),_0x39c2a7[_0x492ee1][0x0]['type']),'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0xa')],'priority':_0x46cccd['priority']++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});if(_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x15')]===_0x3e81('0x16')){_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0]['type'],'app':_0x3e81('0x17'),'appdata':_0x3e81('0x18')+_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')],'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0xa')],'priority':_0x46cccd[_0x3e81('0xe')]++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});}else if(_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x15')]===_0x3e81('0x19')){if(_0x46cccd[_0x3e81('0x1a')]){_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x15')],'app':'Set','appdata':_0x3e81('0x1b')+(_0x46cccd[_0x3e81('0x1a')][_0x3e81('0x1c')]?'${EXTEN:'+_0x46cccd[_0x3e81('0x1a')][_0x3e81('0x1c')]+'}':_0x3e81('0x1d')),'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0]['exten'],'priority':_0x46cccd['priority']++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});}_0x46cccd['extensions'][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0]['type'],'app':_0x3e81('0x17'),'appdata':_0x3e81('0x18')+_0x39c2a7[_0x492ee1][0x0]['VoiceExtensionId'],'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0xa')],'priority':_0x46cccd[_0x3e81('0xe')]++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});var _0x9bb501=_0x46cccd['priority']++;_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0]['type'],'app':_0x3e81('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x9bb501+0x2)+'):Goto('+(_0x9bb501+0x1)+')','context':_0x39c2a7[_0x492ee1][0x0]['context'],'exten':_0x39c2a7[_0x492ee1][0x0]['exten'],'priority':_0x9bb501,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});if(_0x46cccd['extension']){_0x46cccd['extensions']['push']({'type':_0x39c2a7[_0x492ee1][0x0]['type'],'app':_0x3e81('0x17'),'appdata':_0x46cccd['extension'][_0x3e81('0x1c')]?_0x3e81('0x1f')+_0x46cccd[_0x3e81('0x1a')][_0x3e81('0x1c')]+'}':_0x3e81('0x20'),'context':_0x39c2a7[_0x492ee1][0x0]['context'],'exten':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0xa')],'priority':_0x46cccd[_0x3e81('0xe')]++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0]['VoiceExtensionId']});}_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0]['type'],'app':_0x3e81('0x17'),'appdata':_0x3e81('0x21')+_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')],'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0]['exten'],'priority':_0x46cccd[_0x3e81('0xe')]++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0]['VoiceExtensionId']});if(_0x46cccd[_0x3e81('0x1a')]&&_0x46cccd['extension'][_0x3e81('0x22')](_0x3e81('0x23'))&&_0x46cccd[_0x3e81('0x1a')][_0x3e81('0x23')]!==_0x3e81('0x24')){_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x15')],'app':_0x3e81('0x17'),'appdata':_0x3e81('0x25'),'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0]['exten'],'priority':_0x46cccd['priority']++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x15')],'app':_0x3e81('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x46cccd[_0x3e81('0x1a')]['recordingFormat']||_0x3e81('0x26'),'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0xa')],'priority':_0x46cccd[_0x3e81('0xe')]++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});}}_0x46cccd['extensions'][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0]['type'],'app':_0x3e81('0x17'),'appdata':_0x3e81('0x27'),'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0xa')],'priority':_0x46cccd[_0x3e81('0xe')]++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0]['type'],'app':_0x3e81('0x17'),'appdata':_0x3e81('0x28'),'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0xa')],'priority':_0x46cccd[_0x3e81('0xe')]++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0]['type'],'app':_0x3e81('0x17'),'appdata':_0x3e81('0x29'),'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'exten':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0xa')],'priority':_0x46cccd['priority']++,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});for(var _0xd7c355=0x0,_0x5ad2dc=0x0;_0xd7c355<_0x39c2a7[_0x492ee1]['length'];_0xd7c355+=0x1,_0x5ad2dc=0x0){var _0x20a02f=_0x39c2a7[_0x492ee1][_0xd7c355];if(_0x20a02f[_0x3e81('0x15')]){_0x20a02f['type']=_0x20a02f['type'][_0x3e81('0x2a')]();}var _0x563138=[];var _0x45c1a7=[];delete _0x20a02f['id'];delete _0x20a02f[_0x3e81('0x2b')];delete _0x20a02f[_0x3e81('0x2c')];var _0x22ac2e=_0x20a02f['interval']!==_0x3e81('0x2d')?[_0x20a02f[_0x3e81('0x2e')]]:_0x20a02f[_0x3e81('0x7')]?_[_0x3e81('0x9')](_[_0x3e81('0xc')](_0x46cccd[_0x3e81('0x2f')],{'IntervalId':_0x20a02f[_0x3e81('0x7')]}),_0x3e81('0x2e')):[];if(_0x20a02f[_0x3e81('0x22')](_0x3e81('0x30'))){if(_0x20a02f[_0x3e81('0x30')]&&_0x20a02f[_0x3e81('0x30')]!=='--'){_0x563138[_0x3e81('0x11')]({'type':_0x20a02f[_0x3e81('0x15')],'app':_0x3e81('0x17'),'appdata':'CDR(tag)='+_0x20a02f[_0x3e81('0x30')],'context':_0x20a02f[_0x3e81('0x13')],'exten':_0x20a02f[_0x3e81('0xa')],'priority':_0x22ac2e[_0x3e81('0x31')]+_0x46cccd[_0x3e81('0xe')]+_0x5ad2dc++,'VoiceExtensionId':_0x20a02f[_0x3e81('0x14')]});}}if(_0x20a02f['type']===_0x3e81('0x19')&&_0x20a02f[_0x3e81('0x22')](_0x3e81('0x32'))){if(_0x20a02f[_0x3e81('0x32')]){_0x563138[_0x3e81('0x11')]({'type':_0x20a02f[_0x3e81('0x15')],'app':_0x3e81('0x1e'),'appdata':_0x3e81('0x33')+_0x20a02f['callerID']+')','context':_0x20a02f[_0x3e81('0x13')],'exten':_0x20a02f[_0x3e81('0xa')],'priority':_0x22ac2e['length']+_0x46cccd[_0x3e81('0xe')]+_0x5ad2dc++,'VoiceExtensionId':_0x20a02f[_0x3e81('0x14')]});}else{_0x563138[_0x3e81('0x11')]({'type':_0x20a02f['type'],'app':_0x3e81('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x20a02f[_0x3e81('0x13')],'exten':_0x20a02f['exten'],'priority':_0x22ac2e[_0x3e81('0x31')]+_0x46cccd[_0x3e81('0xe')]+_0x5ad2dc++,'VoiceExtensionId':_0x20a02f['VoiceExtensionId']});}}if(_0x20a02f[_0x3e81('0x22')]('answer')){if(_0xf7d3c7[_0x3e81('0x34')](_0x20a02f[_0x3e81('0x35')][_0x3e81('0x2a')]())>=0x0&&_0x20a02f[_0x3e81('0x36')]!==_0x3e81('0x37')){if(_0x20a02f['answer']){_0x563138['push']({'type':_0x20a02f['type'],'app':_0x3e81('0x1e'),'appdata':_0x3e81('0x38'),'context':_0x20a02f[_0x3e81('0x13')],'exten':_0x20a02f[_0x3e81('0xa')],'priority':_0x22ac2e[_0x3e81('0x31')]+_0x46cccd['priority']+_0x5ad2dc++,'VoiceExtensionId':_0x20a02f[_0x3e81('0x14')]});_0x563138[_0x3e81('0x11')]({'type':_0x20a02f['type'],'app':_0x3e81('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x20a02f[_0x3e81('0x13')],'exten':_0x20a02f[_0x3e81('0xa')],'priority':_0x22ac2e[_0x3e81('0x31')]+_0x46cccd[_0x3e81('0xe')]+_0x5ad2dc++,'VoiceExtensionId':_0x20a02f[_0x3e81('0x14')]});}else{_0x563138['push']({'type':_0x20a02f[_0x3e81('0x15')],'app':_0x3e81('0x1e'),'appdata':_0x3e81('0x39'),'context':_0x20a02f[_0x3e81('0x13')],'exten':_0x20a02f[_0x3e81('0xa')],'priority':_0x22ac2e['length']+_0x46cccd[_0x3e81('0xe')]+_0x5ad2dc++,'VoiceExtensionId':_0x20a02f[_0x3e81('0x14')]});_0x563138['push']({'type':_0x20a02f[_0x3e81('0x15')],'app':_0x3e81('0x17'),'appdata':_0x3e81('0x3a'),'context':_0x20a02f['context'],'exten':_0x20a02f[_0x3e81('0xa')],'priority':_0x22ac2e[_0x3e81('0x31')]+_0x46cccd[_0x3e81('0xe')]+_0x5ad2dc++,'VoiceExtensionId':_0x20a02f[_0x3e81('0x14')]});}}}for(var _0x490d5e=0x0;_0x490d5e<_0x22ac2e[_0x3e81('0x31')];_0x490d5e+=0x1){var _0x1539d6=_0x46cccd['priority']+_0x22ac2e['length'];var _0xf3282c=_0x490d5e===_0x22ac2e[_0x3e81('0x31')]-0x1?_0x46cccd[_0x3e81('0xe')]+_0x563138[_0x3e81('0x31')]+_0x45c1a7[_0x3e81('0x31')]+0x2:_0x46cccd['priority']+_0x490d5e+0x1;_0x563138[_0x3e81('0x3b')](_0x490d5e,0x0,{'type':_0x20a02f[_0x3e81('0x15')],'app':_0x3e81('0x3c'),'appdata':_0x22ac2e[_0x490d5e]+'?'+_0x20a02f[_0x3e81('0x13')]+_0x3e81('0x3d')+_0x1539d6+':'+_0x20a02f[_0x3e81('0x13')]+_0x3e81('0x3d')+_0xf3282c,'exten':_0x20a02f[_0x3e81('0xa')],'context':_0x20a02f[_0x3e81('0x13')],'priority':_0x46cccd['priority']+_0x490d5e,'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});}_0x20a02f[_0x3e81('0xe')]=_0x563138[_0x3e81('0x31')]?_['last'](_0x563138)[_0x3e81('0xe')]+0x1:_0x46cccd[_0x3e81('0xe')];_0x46cccd[_0x3e81('0xe')]=(_0x45c1a7['length']?_[_0x3e81('0x3e')](_0x45c1a7)[_0x3e81('0xe')]:_0x20a02f[_0x3e81('0xe')])+0x1;_0x46cccd[_0x3e81('0xf')]=_[_0x3e81('0x3f')](_0x46cccd[_0x3e81('0xf')],_0x563138,[_0x20a02f],_0x45c1a7);}_0x46cccd[_0x3e81('0xf')][_0x3e81('0x11')]({'type':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x15')],'app':'Hangup','exten':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0xa')],'context':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x13')],'priority':_0x46cccd['priority'],'VoiceExtensionId':_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]});_0x3222a0[_0x3e81('0x11')](_0x39c2a7[_0x492ee1][0x0][_0x3e81('0x14')]);_0xa1132f=_[_0x3e81('0x3f')](_0xa1132f,_0x46cccd[_0x3e81('0xf')]);}}return _0x4b5709[_0x3e81('0x40')](function(_0x522cde){return _0x4b5709['models']['VoiceExtension'][_0x3e81('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x3222a0}},'transaction':_0x522cde})[_0x3e81('0x5')](function(_0x5929a0){return _0x4b5709[_0x3e81('0x2')][_0x3e81('0x6')][_0x3e81('0x42')](_['sortBy'](_0xa1132f,_0x3e81('0xe')),{'transaction':_0x522cde});});});})['catch'](function(_0x5c7ff2){console[_0x3e81('0x43')](_0x5c7ff2);});}exports[_0x3e81('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 54c6ad0..23df258 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 _0x3e91=['errors','length','map','join','data','firstName','firstName\x20not\x20specified!','phone','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','cm_hopper','fromQuery','ContactId','updatedAt','select','field','toString','NOW()','createdAt','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','into','str','cm_hopper_black','VoiceQueue','findAll','CmList','Lists','get','dialCheckDuplicateType','sequelize','query','VoiceQueueId','catch','all','outbound','BlackLists','Campaign','always','CampaignId','onlyIfOpen','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!'];(function(_0x6f50af,_0x1b274b){var _0x5d8f7c=function(_0x332267){while(--_0x332267){_0x6f50af['push'](_0x6f50af['shift']());}};_0x5d8f7c(++_0x1b274b);}(_0x3e91,0x18f));var _0x13e9=function(_0x314079,_0x2b98a0){_0x314079=_0x314079-0x0;var _0x423351=_0x3e91[_0x314079];return _0x423351;};'use strict';var BPromise=require('bluebird');var util=require(_0x13e9('0x0'));var _=require(_0x13e9('0x1'));var fs=require('fs');var squel=require(_0x13e9('0x2'));var Papa=require(_0x13e9('0x3'));var Redis=require(_0x13e9('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x13e9('0x5'));var logger=require(_0x13e9('0x6'))(_0x13e9('0x7'));config[_0x13e9('0x8')]=_[_0x13e9('0x9')](config[_0x13e9('0x8')],{'host':_0x13e9('0xa'),'port':0x18eb});var socket=require(_0x13e9('0xb'))(new Redis(config[_0x13e9('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0x13e9('0xc')](socket);try{if(!process[_0x13e9('0xd')][0x2]||process[_0x13e9('0xd')][0x2]===_0x13e9('0xe')||process['argv'][0x2]===_0x13e9('0xf')){throw new Error(_0x13e9('0x10'));}var FILEPATH=process[_0x13e9('0xd')][0x2];if(!process['argv'][0x3]||process[_0x13e9('0xd')][0x3]===_0x13e9('0xe')||process['argv'][0x3]===_0x13e9('0xf')||!process[_0x13e9('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x13e9('0xd')][0x4]===_0x13e9('0xf')){throw new Error(_0x13e9('0x11'));}var FIELDS=_[_0x13e9('0x12')](process['argv'][0x3][_0x13e9('0x13')](','),process['argv'][0x4][_0x13e9('0x13')](','));if(!process[_0x13e9('0xd')][0x5]||process['argv'][0x5]===_0x13e9('0xe')||process[_0x13e9('0xd')][0x5]===_0x13e9('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x13e9('0xd')][0x6]&&process[_0x13e9('0xd')][0x6]!==_0x13e9('0xe')&&process[_0x13e9('0xd')][0x6]!==_0x13e9('0xf')?process[_0x13e9('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x13e9('0xd')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x13e9('0xf')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x13e9('0xd')][0x8]===_0x13e9('0xe')||process['argv'][0x8]===_0x13e9('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x13e9('0xd')][0x8];}catch(_0x1048c7){logger[_0x13e9('0x14')](_0x1048c7);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(_0x1ed14b,_0x56b71a,_0x465feb,_0x327642){var _0x479b5c={'message':_0x56b71a};_0x479b5c[_0x1ed14b]=!![];if(_0x465feb){_0x479b5c[_0x13e9('0x15')]=_0x465feb;}if(_0x327642){_0x479b5c[_0x13e9('0x16')]=_0x327642;}return _0x479b5c;}function isEmail(_0x1f77d7){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))*$/[_0x13e9('0x17')](_0x1f77d7);}function checkRow(_0x18c0d9,_0x3be6ca,_0x4b6609){return new BPromise(function(_0x2b4df2,_0x4a2db5){if(_['isNil'](_0x18c0d9)){return _0x4a2db5(handleCheckRowError(_0x13e9('0x14'),_0x13e9('0x18'),null,_0x4b6609));}if(_0x18c0d9[_0x13e9('0x19')]&&_0x18c0d9[_0x13e9('0x19')][_0x13e9('0x1a')]){var _0x40c207=_[_0x13e9('0x1b')](_0x18c0d9[_0x13e9('0x19')],'message')[_0x13e9('0x1c')](';');return _0x4a2db5(handleCheckRowError(_0x13e9('0x14'),_0x40c207,null,_0x4b6609));}var _0x144b56={};for(var _0x4bb74c in FIELDS){if(FIELDS['hasOwnProperty'](_0x4bb74c)&&FIELDS[_0x4bb74c]){_0x144b56[_0x4bb74c]=_0x18c0d9[_0x13e9('0x1d')][0x0][FIELDS[_0x4bb74c]]||_0x18c0d9['data'][0x0]['\ufeff'+FIELDS[_0x4bb74c]];}}if(!_0x144b56[_0x13e9('0x1e')]){return _0x4a2db5(handleCheckRowError(_0x13e9('0x14'),_0x13e9('0x1f'),null,_0x4b6609));}if(!_0x144b56[_0x13e9('0x20')]){return _0x4a2db5(handleCheckRowError(_0x13e9('0x14'),'phone\x20not\x20specified!',null,_0x4b6609));}if(_0x144b56['birthDate']){var _0x4cc483=moment(_0x144b56['birthDate'],'YYYY-MM-DD');if(!_0x4cc483[_0x13e9('0x21')]()){return _0x4a2db5(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4b6609));}}if(_0x144b56[_0x13e9('0x22')]){if(!isEmail(_0x144b56[_0x13e9('0x22')])){return _0x4a2db5(handleCheckRowError(_0x13e9('0x14'),_0x13e9('0x23'),null,_0x4b6609));}}_0x144b56[_0x13e9('0x24')]=LISTID;_0x144b56['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x13e9('0x1a')]&&_0x3be6ca){var _0x572aa5={};for(var _0x22d35e=0x0,_0x1e6d76=DUPLICATES['length'];_0x22d35e<_0x1e6d76;_0x22d35e+=0x1){_0x572aa5[DUPLICATES[_0x22d35e]]=_0x144b56[DUPLICATES[_0x22d35e]];}var _0x2158c2=_['find'](_0x3be6ca,_0x572aa5);if(_0x2158c2){return _0x4a2db5(handleCheckRowError(_0x13e9('0x25'),_0x13e9('0x26'),_0x2158c2,_0x4b6609));}}return db[_0x13e9('0x27')][_0x13e9('0x28')](_0x144b56,{'raw':!![],'hooks':![],'fields':_['keys'](_0x144b56)})[_0x13e9('0x29')](function(_0x48338e){if(DUPLICATES&&DUPLICATES[_0x13e9('0x1a')]&&_0x3be6ca){_0x3be6ca[_0x13e9('0x2a')](_[_0x13e9('0x2b')](_0x144b56,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x48338e['id'];return _0x2b4df2();})['catch'](function(_0x9ccea0){return _0x4a2db5(handleCheckRowError(_0x13e9('0x14'),_0x13e9('0x2c')+(_0x9ccea0[_0x13e9('0x2d')]||JSON[_0x13e9('0x2e')](_0x9ccea0)),null,_0x4b6609));});});}function checkHopper(){function _0x283d22(){return function(_0x571c65){logger[_0x13e9('0x14')](_0x13e9('0x2f'),_0x13e9('0x30'),util['inspect'](_0x571c65,{'showHidden':![],'depth':null}));};}var _0x1700bd=function(_0x3363b5,_0x4e1337){var _0x18f880=squel[_0x13e9('0x31')]()['into'](_0x13e9('0x32'))[_0x13e9('0x33')]([_0x13e9('0x20'),'scheduledAt',_0x13e9('0x34'),'ListId',_0x4e1337,'createdAt',_0x13e9('0x35')],squel[_0x13e9('0x36')]()['field'](_0x13e9('0x20'),_0x13e9('0x20'))[_0x13e9('0x37')]('NOW()','scheduledAt')[_0x13e9('0x37')]('id',_0x13e9('0x34'))['field'](LISTID[_0x13e9('0x38')](),_0x13e9('0x24'))[_0x13e9('0x37')](_0x3363b5['id']['toString'](),_0x4e1337)['field'](_0x13e9('0x39'),_0x13e9('0x3a'))[_0x13e9('0x37')](_0x13e9('0x39'),_0x13e9('0x35'))[_0x13e9('0x3b')](_0x13e9('0x3c'))[_0x13e9('0x3d')]('deletedAt\x20IS\x20NULL')[_0x13e9('0x3d')](_0x13e9('0x3e'),LISTID['toString']())['where'](_0x13e9('0x3f'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x13e9('0x36')]()[_0x13e9('0x37')](_0x13e9('0x20'))[_0x13e9('0x3b')]('cm_hopper')[_0x13e9('0x3d')](_0x4e1337+'\x20=\x20?',_0x3363b5['id']['toString']())))[_0x13e9('0x38')]();return _0x18f880;};var _0x3a222a=function(_0x225a21,_0x421bf2){var _0x3191d4=squel[_0x13e9('0x31')]()['into'](_0x13e9('0x32'))[_0x13e9('0x33')](['phone',_0x13e9('0x40'),_0x13e9('0x34'),'ListId',_0x421bf2,'createdAt','updatedAt'],squel[_0x13e9('0x36')]()[_0x13e9('0x37')]('phone',_0x13e9('0x20'))[_0x13e9('0x37')]('NOW()',_0x13e9('0x40'))[_0x13e9('0x37')]('id',_0x13e9('0x34'))[_0x13e9('0x37')](LISTID[_0x13e9('0x38')](),'ListId')['field'](_0x225a21['id']['toString'](),_0x421bf2)['field'](_0x13e9('0x39'),_0x13e9('0x3a'))['field'](_0x13e9('0x39'),'updatedAt')[_0x13e9('0x3b')](_0x13e9('0x3c'))[_0x13e9('0x3d')](_0x13e9('0x41'))[_0x13e9('0x3d')]('ListId\x20=\x20?',LISTID[_0x13e9('0x38')]())[_0x13e9('0x3d')](_0x13e9('0x42'),squel['str'](hopperContacts))['where'](_0x13e9('0x3f'))['where'](_0x13e9('0x43'),squel['select']()[_0x13e9('0x37')](_0x13e9('0x44'))[_0x13e9('0x3b')](_0x13e9('0x45'))[_0x13e9('0x3d')](_0x421bf2+_0x13e9('0x46'),_0x225a21['id'][_0x13e9('0x38')]()))['where'](_0x13e9('0x43'),squel[_0x13e9('0x36')]()[_0x13e9('0x37')](_0x13e9('0x20'))[_0x13e9('0x3b')]('cm_hopper')[_0x13e9('0x3d')](_0x421bf2+_0x13e9('0x46'),_0x225a21['id'][_0x13e9('0x38')]())))[_0x13e9('0x38')]();return _0x3191d4;};function _0x60502d(_0x1c1619,_0x178184){var _0x552f45=squel[_0x13e9('0x31')]()[_0x13e9('0x47')](_0x13e9('0x32'))[_0x13e9('0x33')]([_0x13e9('0x20'),_0x13e9('0x40'),_0x13e9('0x34'),'ListId',_0x178184,_0x13e9('0x3a'),_0x13e9('0x35')],squel[_0x13e9('0x36')]()['field']('phone','phone')[_0x13e9('0x37')]('NOW()',_0x13e9('0x40'))[_0x13e9('0x37')]('id',_0x13e9('0x34'))[_0x13e9('0x37')](LISTID[_0x13e9('0x38')](),_0x13e9('0x24'))['field'](_0x1c1619['id'][_0x13e9('0x38')](),_0x178184)[_0x13e9('0x37')](_0x13e9('0x39'),_0x13e9('0x3a'))['field'](_0x13e9('0x39'),_0x13e9('0x35'))[_0x13e9('0x3b')](_0x13e9('0x3c'))[_0x13e9('0x3d')]('deletedAt\x20IS\x20NULL')[_0x13e9('0x3d')](_0x13e9('0x3e'),LISTID[_0x13e9('0x38')]())[_0x13e9('0x3d')]('id\x20IN\x20?',squel[_0x13e9('0x48')](hopperContacts))['where'](_0x13e9('0x3f')))[_0x13e9('0x38')]();return _0x552f45;}function _0x4433c7(_0x57e6f4,_0x3121c2){var _0x519733=squel[_0x13e9('0x31')]()[_0x13e9('0x47')](_0x13e9('0x49'))[_0x13e9('0x33')]([_0x13e9('0x20'),_0x13e9('0x34'),_0x13e9('0x24'),_0x3121c2,'createdAt','updatedAt'],squel[_0x13e9('0x36')]()[_0x13e9('0x37')](_0x13e9('0x20'),_0x13e9('0x20'))[_0x13e9('0x37')]('id',_0x13e9('0x34'))[_0x13e9('0x37')](LISTID[_0x13e9('0x38')](),_0x13e9('0x24'))[_0x13e9('0x37')](_0x57e6f4['id'][_0x13e9('0x38')](),_0x3121c2)[_0x13e9('0x37')](_0x13e9('0x39'),_0x13e9('0x3a'))['field'](_0x13e9('0x39'),'updatedAt')[_0x13e9('0x3b')](_0x13e9('0x3c'))[_0x13e9('0x3d')]('deletedAt\x20IS\x20NULL')['where'](_0x13e9('0x3e'),LISTID[_0x13e9('0x38')]())[_0x13e9('0x3d')](_0x13e9('0x42'),squel['str'](hopperContacts))['where'](_0x13e9('0x3f')))[_0x13e9('0x38')]();return _0x519733;}return db[_0x13e9('0x4a')][_0x13e9('0x4b')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x13e9('0x4c')],'as':_0x13e9('0x4d'),'where':{'id':LISTID}}]})[_0x13e9('0x29')](function(_0x35603e){var _0x32065b=[];if(_0x35603e){var _0x107e9a;for(var _0x58fd15=0x0,_0x39b0d8;_0x58fd15<_0x35603e[_0x13e9('0x1a')];_0x58fd15+=0x1){_0x39b0d8=_0x35603e[_0x58fd15][_0x13e9('0x4e')]({'plain':!![]});switch(_0x39b0d8[_0x13e9('0x4f')]){case'always':_0x32065b[_0x13e9('0x2a')](db[_0x13e9('0x50')][_0x13e9('0x51')](_0x3a222a(_0x39b0d8,_0x13e9('0x52')))[_0x13e9('0x29')](function(){})[_0x13e9('0x53')](_0x283d22()));break;case'onlyIfOpen':_0x32065b[_0x13e9('0x2a')](db[_0x13e9('0x50')][_0x13e9('0x51')](_0x1700bd(_0x39b0d8,_0x13e9('0x52')))[_0x13e9('0x29')](function(){})[_0x13e9('0x53')](_0x283d22()));break;default:_0x32065b['push'](db[_0x13e9('0x50')][_0x13e9('0x51')](_0x60502d(_0x39b0d8,_0x13e9('0x52')))[_0x13e9('0x29')](function(){})['catch'](_0x283d22()));}}}return _0x32065b;})[_0x13e9('0x54')]()[_0x13e9('0x29')](function(){return db[_0x13e9('0x4a')]['findAll']({'where':{'type':_0x13e9('0x55')},'attributes':['id'],'include':[{'model':db[_0x13e9('0x4c')],'as':_0x13e9('0x56'),'where':{'id':LISTID}}]})['then'](function(_0xdaaf66){var _0x329443=[];if(_0xdaaf66){var _0x219038;for(var _0x28c5e9=0x0,_0x499a68;_0x28c5e9<_0xdaaf66[_0x13e9('0x1a')];_0x28c5e9+=0x1){_0x499a68=_0xdaaf66[_0x28c5e9][_0x13e9('0x4e')]({'plain':!![]});_0x329443[_0x13e9('0x2a')](db[_0x13e9('0x50')][_0x13e9('0x51')](_0x4433c7(_0x499a68,_0x13e9('0x52')))[_0x13e9('0x29')](function(){})[_0x13e9('0x53')](_0x283d22()));}}return _0x329443;})[_0x13e9('0x54')]();})[_0x13e9('0x29')](function(){return db[_0x13e9('0x57')][_0x13e9('0x4b')]({'attributes':['id',_0x13e9('0x4f')],'include':[{'model':db['CmList'],'as':_0x13e9('0x4d'),'where':{'id':LISTID}}]})[_0x13e9('0x29')](function(_0x55a24e){var _0x86df=[];if(_0x55a24e){for(var _0x2e4e04=0x0,_0x1595fc;_0x2e4e04<_0x55a24e[_0x13e9('0x1a')];_0x2e4e04+=0x1){_0x1595fc=_0x55a24e[_0x2e4e04][_0x13e9('0x4e')]({'plain':!![]});switch(_0x1595fc[_0x13e9('0x4f')]){case _0x13e9('0x58'):_0x86df[_0x13e9('0x2a')](db[_0x13e9('0x50')][_0x13e9('0x51')](_0x3a222a(_0x1595fc,_0x13e9('0x59')))[_0x13e9('0x29')](function(){})['catch'](_0x283d22()));break;case _0x13e9('0x5a'):_0x86df[_0x13e9('0x2a')](db[_0x13e9('0x50')][_0x13e9('0x51')](_0x1700bd(_0x1595fc,_0x13e9('0x59')))[_0x13e9('0x29')](function(){})[_0x13e9('0x53')](_0x283d22()));break;default:_0x86df[_0x13e9('0x2a')](db['sequelize']['query'](_0x60502d(_0x1595fc,_0x13e9('0x59')))[_0x13e9('0x29')](function(){})[_0x13e9('0x53')](_0x283d22()));}}}return _0x86df;})[_0x13e9('0x54')]();})[_0x13e9('0x29')](function(){return db[_0x13e9('0x57')][_0x13e9('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x13e9('0x4c')],'as':_0x13e9('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x355121){var _0x510578=[];if(_0x355121){for(var _0x27ad48=0x0,_0x201497;_0x27ad48<_0x355121[_0x13e9('0x1a')];_0x27ad48+=0x1){_0x201497=_0x355121[_0x27ad48][_0x13e9('0x4e')]({'plain':!![]});_0x510578[_0x13e9('0x2a')](db['sequelize']['query'](_0x4433c7(_0x201497,_0x13e9('0x59')))[_0x13e9('0x29')](function(){})[_0x13e9('0x53')](_0x283d22()));}}return _0x510578;})[_0x13e9('0x54')]();})['catch'](function(_0x2a9245){logger[_0x13e9('0x14')]('cmContact,\x20%s,\x20%s',_0x13e9('0x5b'),_0x2a9245['message']);});}var processPromises=function(_0x106499){return BPromise[_0x13e9('0x54')](promises)[_0x13e9('0x29')](function(_0x246858){})['catch'](function(_0x386529){logger[_0x13e9('0x14')](_0x13e9('0x5c'),JSON[_0x13e9('0x2e')](_0x386529));})['finally'](function(){socket[_0x13e9('0x5d')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x106499){return _0x106499['resume']();}});};var endCsv=function(){return BPromise[_0x13e9('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x13e9('0x29')](function(){socket[_0x13e9('0x5d')](_0x13e9('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x13e9('0x60')](FILEPATH);}catch(_0xb7ff2d){logger['error'](_0x13e9('0x61'),JSON[_0x13e9('0x2e')](_0xb7ff2d));}finally{process[_0x13e9('0x62')](0x0);}});};process['on'](_0x13e9('0x63'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x13e9('0x5e')]()[_0x13e9('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x13e9('0x13')](',');return db['CmContact'][_0x13e9('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x13e9('0x29')](function(_0x2c8c1a){var _0x2e2dca=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x13e9('0x64')](_0x2e2dca,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1972ab,_0x8655fd){total+=0x1;var _0x15b62e=total;promises[_0x13e9('0x2a')](checkRow(_0x1972ab,_0x2c8c1a,_0x15b62e)[_0x13e9('0x29')](function(){success+=0x1;})[_0x13e9('0x53')](function(_0x68ff84){if(_0x68ff84['error']){errors+=0x1;delete _0x68ff84['error'];}else if(_0x68ff84[_0x13e9('0x25')]){duplicates+=0x1;delete _0x68ff84[_0x13e9('0x25')];}rows[_0x13e9('0x2a')](_0x68ff84);}));if(total%0xc8===0x0){_0x8655fd[_0x13e9('0x65')]();return processPromises(_0x8655fd);}},'complete':function(){return processPromises()['then'](function(){logger[_0x13e9('0x66')](_0x13e9('0x67'));endCsv();});},'error':function(_0x323324,_0x5e3fa0){logger['info'](_0x13e9('0x68'),JSON['stringify'](_0x323324));endCsv();}});})[_0x13e9('0x53')](function(_0x3fd7f7){logger[_0x13e9('0x14')](_0x13e9('0x69'),JSON[_0x13e9('0x2e')](_0x3fd7f7));});}main(); \ No newline at end of file +var _0x292e=['cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','BlackLists','get','Lists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','bluebird','util','lodash','squel','../../../mysqldb','../../../config/environment','api','defaults','socket.io-emitter','redis','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','phone','field','NOW()','from'];(function(_0xe8163c,_0x781e8d){var _0x47b934=function(_0x178c4e){while(--_0x178c4e){_0xe8163c['push'](_0xe8163c['shift']());}};_0x47b934(++_0x781e8d);}(_0x292e,0x95));var _0xe292=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x292e[_0x21a9d9];return _0x46adce;};'use strict';var BPromise=require(_0xe292('0x0'));var util=require(_0xe292('0x1'));var _=require(_0xe292('0x2'));var fs=require('fs');var squel=require(_0xe292('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xe292('0x4'))['db'];var config=require(_0xe292('0x5'));var logger=require('../../../config/logger')(_0xe292('0x6'));config['redis']=_[_0xe292('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe292('0x8'))(new Redis(config[_0xe292('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0xe292('0xa')](socket);try{if(!process[_0xe292('0xb')][0x2]||process[_0xe292('0xb')][0x2]==='undefined'||process[_0xe292('0xb')][0x2]===_0xe292('0xc')){throw new Error(_0xe292('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0xe292('0xb')][0x3]||process[_0xe292('0xb')][0x3]===_0xe292('0xe')||process[_0xe292('0xb')][0x3]===_0xe292('0xc')||!process[_0xe292('0xb')][0x4]||process[_0xe292('0xb')][0x4]===_0xe292('0xe')||process[_0xe292('0xb')][0x4]===_0xe292('0xc')){throw new Error(_0xe292('0xf'));}var FIELDS=_[_0xe292('0x10')](process[_0xe292('0xb')][0x3]['split'](','),process[_0xe292('0xb')][0x4]['split'](','));if(!process[_0xe292('0xb')][0x5]||process[_0xe292('0xb')][0x5]===_0xe292('0xe')||process[_0xe292('0xb')][0x5]===_0xe292('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xe292('0xb')][0x6]&&process['argv'][0x6]!==_0xe292('0xe')&&process['argv'][0x6]!==_0xe292('0xc')?process[_0xe292('0xb')][0x6]:null;var DUPLICATES=process[_0xe292('0xb')][0x7]&&process[_0xe292('0xb')][0x7]!==_0xe292('0xe')&&process[_0xe292('0xb')][0x7]!==_0xe292('0xc')?process['argv'][0x7]:null;if(!process[_0xe292('0xb')][0x8]||process[_0xe292('0xb')][0x8]==='undefined'||process[_0xe292('0xb')][0x8]===_0xe292('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xe292('0xb')][0x8];}catch(_0x2ef951){logger[_0xe292('0x11')](_0x2ef951);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(_0x4150bc,_0x5e578b,_0x3ffb23,_0x4f4331){var _0x1bcd8c={'message':_0x5e578b};_0x1bcd8c[_0x4150bc]=!![];if(_0x3ffb23){_0x1bcd8c[_0xe292('0x12')]=_0x3ffb23;}if(_0x4f4331){_0x1bcd8c[_0xe292('0x13')]=_0x4f4331;}return _0x1bcd8c;}function isEmail(_0x1ac739){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))*$/[_0xe292('0x14')](_0x1ac739);}function checkRow(_0x596f43,_0x4f5c50,_0x5e5b50){return new BPromise(function(_0x528679,_0x254167){if(_[_0xe292('0x15')](_0x596f43)){return _0x254167(handleCheckRowError('error',_0xe292('0x16'),null,_0x5e5b50));}if(_0x596f43[_0xe292('0x17')]&&_0x596f43['errors']['length']){var _0x2433e7=_[_0xe292('0x18')](_0x596f43['errors'],_0xe292('0x19'))[_0xe292('0x1a')](';');return _0x254167(handleCheckRowError('error',_0x2433e7,null,_0x5e5b50));}var _0x248e2f={};for(var _0x49f6b4 in FIELDS){if(FIELDS['hasOwnProperty'](_0x49f6b4)&&FIELDS[_0x49f6b4]){_0x248e2f[_0x49f6b4]=_0x596f43[_0xe292('0x1b')][0x0][FIELDS[_0x49f6b4]]||_0x596f43[_0xe292('0x1b')][0x0]['\ufeff'+FIELDS[_0x49f6b4]];}}if(!_0x248e2f[_0xe292('0x1c')]){return _0x254167(handleCheckRowError(_0xe292('0x11'),_0xe292('0x1d'),null,_0x5e5b50));}if(!_0x248e2f['phone']){return _0x254167(handleCheckRowError('error',_0xe292('0x1e'),null,_0x5e5b50));}if(_0x248e2f[_0xe292('0x1f')]){var _0x4220fe=moment(_0x248e2f[_0xe292('0x1f')],_0xe292('0x20'));if(!_0x4220fe[_0xe292('0x21')]()){return _0x254167(handleCheckRowError(_0xe292('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x5e5b50));}}if(_0x248e2f[_0xe292('0x22')]){if(!isEmail(_0x248e2f['email'])){return _0x254167(handleCheckRowError(_0xe292('0x11'),_0xe292('0x23'),null,_0x5e5b50));}}_0x248e2f['ListId']=LISTID;_0x248e2f[_0xe292('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe292('0x25')]&&_0x4f5c50){var _0x44715f={};for(var _0x3dc5dc=0x0,_0x22fc18=DUPLICATES[_0xe292('0x25')];_0x3dc5dc<_0x22fc18;_0x3dc5dc+=0x1){_0x44715f[DUPLICATES[_0x3dc5dc]]=_0x248e2f[DUPLICATES[_0x3dc5dc]];}var _0xa12773=_[_0xe292('0x26')](_0x4f5c50,_0x44715f);if(_0xa12773){return _0x254167(handleCheckRowError('duplicate',_0xe292('0x27'),_0xa12773,_0x5e5b50));}}return db[_0xe292('0x28')][_0xe292('0x29')](_0x248e2f,{'raw':!![],'hooks':![],'fields':_[_0xe292('0x2a')](_0x248e2f)})[_0xe292('0x2b')](function(_0x6f2b70){if(DUPLICATES&&DUPLICATES[_0xe292('0x25')]&&_0x4f5c50){_0x4f5c50[_0xe292('0x2c')](_[_0xe292('0x2d')](_0x248e2f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x6f2b70['id'];return _0x528679();})[_0xe292('0x2e')](function(_0x2206df){return _0x254167(handleCheckRowError(_0xe292('0x11'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2206df[_0xe292('0x19')]||JSON[_0xe292('0x2f')](_0x2206df)),null,_0x5e5b50));});});}function checkHopper(){function _0x36023a(){return function(_0x3d4cd9){logger[_0xe292('0x11')]('cmContact','checkHopper',util[_0xe292('0x30')](_0x3d4cd9,{'showHidden':![],'depth':null}));};}var _0xa41de0=function(_0x50258c,_0x4c415c){var _0x251d13=squel[_0xe292('0x31')]()[_0xe292('0x32')](_0xe292('0x33'))[_0xe292('0x34')](['phone',_0xe292('0x35'),_0xe292('0x36'),_0xe292('0x37'),_0x4c415c,_0xe292('0x38'),_0xe292('0x39')],squel[_0xe292('0x3a')]()['field'](_0xe292('0x3b'),_0xe292('0x3b'))[_0xe292('0x3c')](_0xe292('0x3d'),_0xe292('0x35'))[_0xe292('0x3c')]('id',_0xe292('0x36'))['field'](LISTID['toString'](),'ListId')[_0xe292('0x3c')](_0x50258c['id']['toString'](),_0x4c415c)[_0xe292('0x3c')](_0xe292('0x3d'),_0xe292('0x38'))[_0xe292('0x3c')](_0xe292('0x3d'),_0xe292('0x39'))[_0xe292('0x3e')](_0xe292('0x3f'))[_0xe292('0x40')]('deletedAt\x20IS\x20NULL')[_0xe292('0x40')]('ListId\x20=\x20?',LISTID['toString']())[_0xe292('0x40')](_0xe292('0x41'))['where'](_0xe292('0x42'),squel[_0xe292('0x3a')]()[_0xe292('0x3c')](_0xe292('0x3b'))[_0xe292('0x3e')](_0xe292('0x33'))[_0xe292('0x40')](_0x4c415c+_0xe292('0x43'),_0x50258c['id'][_0xe292('0x44')]())))['toString']();return _0x251d13;};var _0x54b0fd=function(_0x526020,_0x5d40f){var _0x5b3e3c=squel[_0xe292('0x31')]()[_0xe292('0x32')](_0xe292('0x33'))[_0xe292('0x34')]([_0xe292('0x3b'),_0xe292('0x35'),_0xe292('0x36'),_0xe292('0x37'),_0x5d40f,_0xe292('0x38'),_0xe292('0x39')],squel['select']()['field'](_0xe292('0x3b'),'phone')[_0xe292('0x3c')](_0xe292('0x3d'),'scheduledAt')[_0xe292('0x3c')]('id',_0xe292('0x36'))[_0xe292('0x3c')](LISTID[_0xe292('0x44')](),_0xe292('0x37'))[_0xe292('0x3c')](_0x526020['id']['toString'](),_0x5d40f)['field'](_0xe292('0x3d'),'createdAt')[_0xe292('0x3c')](_0xe292('0x3d'),_0xe292('0x39'))[_0xe292('0x3e')]('cm_contacts')[_0xe292('0x40')](_0xe292('0x45'))[_0xe292('0x40')](_0xe292('0x46'),LISTID['toString']())[_0xe292('0x40')](_0xe292('0x47'),squel[_0xe292('0x48')](hopperContacts))[_0xe292('0x40')](_0xe292('0x41'))['where'](_0xe292('0x42'),squel['select']()[_0xe292('0x3c')](_0xe292('0x49'))['from']('cm_hopper_final')[_0xe292('0x40')](_0x5d40f+'\x20=\x20?',_0x526020['id']['toString']()))[_0xe292('0x40')](_0xe292('0x42'),squel[_0xe292('0x3a')]()['field']('phone')[_0xe292('0x3e')](_0xe292('0x33'))[_0xe292('0x40')](_0x5d40f+_0xe292('0x43'),_0x526020['id'][_0xe292('0x44')]())))[_0xe292('0x44')]();return _0x5b3e3c;};function _0x171007(_0x50b977,_0xbd6521){var _0x2d746e=squel[_0xe292('0x31')]()[_0xe292('0x32')]('cm_hopper')[_0xe292('0x34')]([_0xe292('0x3b'),_0xe292('0x35'),_0xe292('0x36'),_0xe292('0x37'),_0xbd6521,_0xe292('0x38'),_0xe292('0x39')],squel[_0xe292('0x3a')]()['field'](_0xe292('0x3b'),'phone')[_0xe292('0x3c')](_0xe292('0x3d'),_0xe292('0x35'))['field']('id',_0xe292('0x36'))[_0xe292('0x3c')](LISTID['toString'](),_0xe292('0x37'))[_0xe292('0x3c')](_0x50b977['id']['toString'](),_0xbd6521)[_0xe292('0x3c')]('NOW()',_0xe292('0x38'))['field']('NOW()','updatedAt')[_0xe292('0x3e')](_0xe292('0x3f'))[_0xe292('0x40')](_0xe292('0x45'))[_0xe292('0x40')](_0xe292('0x46'),LISTID[_0xe292('0x44')]())[_0xe292('0x40')]('id\x20IN\x20?',squel[_0xe292('0x48')](hopperContacts))['where'](_0xe292('0x41')))[_0xe292('0x44')]();return _0x2d746e;}function _0x363a5c(_0xce3ab4,_0xcd2e00){var _0x5d2fa3=squel[_0xe292('0x31')]()['into']('cm_hopper_black')[_0xe292('0x34')]([_0xe292('0x3b'),_0xe292('0x36'),_0xe292('0x37'),_0xcd2e00,_0xe292('0x38'),_0xe292('0x39')],squel[_0xe292('0x3a')]()['field'](_0xe292('0x3b'),_0xe292('0x3b'))[_0xe292('0x3c')]('id',_0xe292('0x36'))['field'](LISTID[_0xe292('0x44')](),_0xe292('0x37'))[_0xe292('0x3c')](_0xce3ab4['id'][_0xe292('0x44')](),_0xcd2e00)[_0xe292('0x3c')](_0xe292('0x3d'),'createdAt')[_0xe292('0x3c')](_0xe292('0x3d'),_0xe292('0x39'))[_0xe292('0x3e')](_0xe292('0x3f'))['where'](_0xe292('0x45'))[_0xe292('0x40')](_0xe292('0x46'),LISTID[_0xe292('0x44')]())[_0xe292('0x40')](_0xe292('0x47'),squel[_0xe292('0x48')](hopperContacts))[_0xe292('0x40')](_0xe292('0x41')))[_0xe292('0x44')]();return _0x5d2fa3;}return db[_0xe292('0x4a')][_0xe292('0x4b')]({'where':{'type':_0xe292('0x4c')},'attributes':['id',_0xe292('0x4d')],'include':[{'model':db[_0xe292('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0xe292('0x2b')](function(_0x56d8ea){var _0x43a236=[];if(_0x56d8ea){var _0x360a2d;for(var _0x2741c1=0x0,_0x4847c1;_0x2741c1<_0x56d8ea['length'];_0x2741c1+=0x1){_0x4847c1=_0x56d8ea[_0x2741c1]['get']({'plain':!![]});switch(_0x4847c1['dialCheckDuplicateType']){case _0xe292('0x4f'):_0x43a236[_0xe292('0x2c')](db[_0xe292('0x50')][_0xe292('0x51')](_0x54b0fd(_0x4847c1,'VoiceQueueId'))[_0xe292('0x2b')](function(){})['catch'](_0x36023a()));break;case _0xe292('0x52'):_0x43a236['push'](db[_0xe292('0x50')][_0xe292('0x51')](_0xa41de0(_0x4847c1,_0xe292('0x53')))[_0xe292('0x2b')](function(){})[_0xe292('0x2e')](_0x36023a()));break;default:_0x43a236[_0xe292('0x2c')](db[_0xe292('0x50')][_0xe292('0x51')](_0x171007(_0x4847c1,'VoiceQueueId'))['then'](function(){})[_0xe292('0x2e')](_0x36023a()));}}}return _0x43a236;})[_0xe292('0x54')]()['then'](function(){return db[_0xe292('0x4a')]['findAll']({'where':{'type':_0xe292('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xe292('0x55'),'where':{'id':LISTID}}]})[_0xe292('0x2b')](function(_0x1a13cb){var _0x35e98a=[];if(_0x1a13cb){var _0x2d7e8e;for(var _0x3b9e85=0x0,_0x34d7c9;_0x3b9e85<_0x1a13cb[_0xe292('0x25')];_0x3b9e85+=0x1){_0x34d7c9=_0x1a13cb[_0x3b9e85][_0xe292('0x56')]({'plain':!![]});_0x35e98a[_0xe292('0x2c')](db[_0xe292('0x50')][_0xe292('0x51')](_0x363a5c(_0x34d7c9,_0xe292('0x53')))['then'](function(){})[_0xe292('0x2e')](_0x36023a()));}}return _0x35e98a;})[_0xe292('0x54')]();})[_0xe292('0x2b')](function(){return db['Campaign'][_0xe292('0x4b')]({'attributes':['id',_0xe292('0x4d')],'include':[{'model':db[_0xe292('0x4e')],'as':_0xe292('0x57'),'where':{'id':LISTID}}]})[_0xe292('0x2b')](function(_0x2b64d5){var _0x57788e=[];if(_0x2b64d5){for(var _0xc701c8=0x0,_0x1d921b;_0xc701c8<_0x2b64d5[_0xe292('0x25')];_0xc701c8+=0x1){_0x1d921b=_0x2b64d5[_0xc701c8]['get']({'plain':!![]});switch(_0x1d921b['dialCheckDuplicateType']){case _0xe292('0x4f'):_0x57788e[_0xe292('0x2c')](db[_0xe292('0x50')][_0xe292('0x51')](_0x54b0fd(_0x1d921b,'CampaignId'))[_0xe292('0x2b')](function(){})['catch'](_0x36023a()));break;case _0xe292('0x52'):_0x57788e['push'](db[_0xe292('0x50')]['query'](_0xa41de0(_0x1d921b,_0xe292('0x58')))[_0xe292('0x2b')](function(){})['catch'](_0x36023a()));break;default:_0x57788e[_0xe292('0x2c')](db['sequelize']['query'](_0x171007(_0x1d921b,_0xe292('0x58')))[_0xe292('0x2b')](function(){})[_0xe292('0x2e')](_0x36023a()));}}}return _0x57788e;})[_0xe292('0x54')]();})[_0xe292('0x2b')](function(){return db[_0xe292('0x59')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xe292('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xe292('0x2b')](function(_0x8cb0d0){var _0x5c5d32=[];if(_0x8cb0d0){for(var _0x408457=0x0,_0x5c7357;_0x408457<_0x8cb0d0[_0xe292('0x25')];_0x408457+=0x1){_0x5c7357=_0x8cb0d0[_0x408457][_0xe292('0x56')]({'plain':!![]});_0x5c5d32[_0xe292('0x2c')](db['sequelize'][_0xe292('0x51')](_0x363a5c(_0x5c7357,_0xe292('0x58')))['then'](function(){})[_0xe292('0x2e')](_0x36023a()));}}return _0x5c5d32;})[_0xe292('0x54')]();})[_0xe292('0x2e')](function(_0x39423a){logger[_0xe292('0x11')](_0xe292('0x5a'),_0xe292('0x5b'),_0x39423a[_0xe292('0x19')]);});}var processPromises=function(_0x536077){return BPromise[_0xe292('0x54')](promises)['then'](function(_0x2a41d7){})['catch'](function(_0x3461f7){logger[_0xe292('0x11')](_0xe292('0x5c'),JSON[_0xe292('0x2f')](_0x3461f7));})['finally'](function(){socket[_0xe292('0x5d')](_0xe292('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x536077){return _0x536077[_0xe292('0x5f')]();}});};var endCsv=function(){return BPromise[_0xe292('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xe292('0x5d')](_0xe292('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe292('0x61')](FILEPATH);}catch(_0x473ac3){logger[_0xe292('0x11')](_0xe292('0x62'),JSON[_0xe292('0x2f')](_0x473ac3));}finally{process[_0xe292('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0xe292('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xe292('0x60')]()[_0xe292('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xe292('0x28')][_0xe292('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe292('0x2b')](function(_0x579eb2){var _0x1bbd1d=fs[_0xe292('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe292('0x66')](_0x1bbd1d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4e057c,_0x59d56b){total+=0x1;var _0x230797=total;promises[_0xe292('0x2c')](checkRow(_0x4e057c,_0x579eb2,_0x230797)['then'](function(){success+=0x1;})[_0xe292('0x2e')](function(_0x563371){if(_0x563371[_0xe292('0x11')]){errors+=0x1;delete _0x563371[_0xe292('0x11')];}else if(_0x563371[_0xe292('0x67')]){duplicates+=0x1;delete _0x563371[_0xe292('0x67')];}rows[_0xe292('0x2c')](_0x563371);}));if(total%0xc8===0x0){_0x59d56b[_0xe292('0x68')]();return processPromises(_0x59d56b);}},'complete':function(){return processPromises()['then'](function(){logger[_0xe292('0x64')](_0xe292('0x69'));endCsv();});},'error':function(_0x5758ec,_0x8727cb){logger[_0xe292('0x64')]('CSV\x20parse\x20error',JSON[_0xe292('0x2f')](_0x5758ec));endCsv();}});})[_0xe292('0x2e')](function(_0x5f10b5){logger[_0xe292('0x11')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xe292('0x2f')](_0x5f10b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6536fe5..e1fa7b6 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 _0x8dd4=['cm_contacts.ListId','insert','cm_hopper_black','fields','cm_contacts.createdAt\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','into','priority','.CmListId','\x22always\x22','\x22onlyIfOpen\x22','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','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?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','Received\x20SIGINT','error','message','exit','code','info','sequelize','query','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','offset','set','main','send','start','binding','clone','root','server/files/tmp','.csv','includes','ContactItemType','name','header','writeFileSync','parse','data','rows','errors','find','_description','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','then','length','all','AdditionalPhones','split','isNil','filter','push','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x8dd4,0x142));var _0x48dd=function(_0x9c0d3e,_0x5bad2d){_0x9c0d3e=_0x9c0d3e-0x0;var _0x124534=_0x8dd4[_0x9c0d3e];return _0x124534;};'use strict';var fs=require('fs');var path=require(_0x48dd('0x0'));var _=require(_0x48dd('0x1'));var Papa=require(_0x48dd('0x2'));var util=require(_0x48dd('0x3'));var BPromise=require(_0x48dd('0x4'));var moment=require(_0x48dd('0x5'));var squel=require(_0x48dd('0x6'));var Redis=require(_0x48dd('0x7'));var db=require(_0x48dd('0x8'))['db'];var config=require(_0x48dd('0x9'));var shared=require(_0x48dd('0xa'));var logger=require(_0x48dd('0xb'))(_0x48dd('0xc'));config[_0x48dd('0xd')]=_[_0x48dd('0xe')](config[_0x48dd('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x48dd('0xf'))(new Redis(config[_0x48dd('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x48dd('0x10')](_0x48dd('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x48dd('0x10')](_0x48dd('0x11'));function isEmail(_0x58f56f){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))*$/[_0x48dd('0x12')](_0x58f56f);}function selectNotIn(_0x2ba9e7,_0x8aae8e,_0x4c4c39,_0x39e9ee,_0x19ae24){return squel[_0x48dd('0x13')]()[_0x48dd('0x14')](_0x48dd('0x15'))[_0x48dd('0x16')](_0x39e9ee)['join'](_0x8aae8e,null,_0x8aae8e+_0x48dd('0x17')+_0x39e9ee+'.'+_0x4c4c39)[_0x48dd('0x18')](_0x39e9ee+'.'+_0x4c4c39+_0x48dd('0x19')+_0x2ba9e7+'.'+_0x4c4c39)[_0x48dd('0x18')](_0x8aae8e+_0x48dd('0x1a')+_0x19ae24[_0x48dd('0x1b')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4459eb,_0x59edf9){promisesAdditionalPhones=[];return db[_0x48dd('0x1c')][_0x48dd('0x1d')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x48dd('0x1e')](function(_0x51f18f){if(_0x51f18f!==null){var _0x1f38eb=[];for(var _0x24addf=0x0;_0x24addf<_0x51f18f[_0x48dd('0x1f')];_0x24addf++){var _0x237304=_0x51f18f[_0x24addf];_0x1f38eb['push'](insertAdditionalPhones(_0x237304));}}Promise[_0x48dd('0x20')](_0x1f38eb)[_0x48dd('0x1e')](function(){_0x4459eb({'val':0x1});});});});}function insertAdditionalPhones(_0xbf9a87){return new Promise(function(_0x1d8a25,_0x4b9873){var _0x3237af=_0xbf9a87[_0x48dd('0x21')];var _0x271be5=_0x3237af[_0x48dd('0x22')](';');var _0x215de8=[];orderBy=0x0;for(var _0x4f194a=0x0;_0x4f194a<_0x271be5[_0x48dd('0x1f')];_0x4f194a++){_0x215de8['push'](splitAdditionalPhone(_0xbf9a87['id'],_0x271be5[_0x4f194a]));}Promise[_0x48dd('0x20')](_0x215de8)[_0x48dd('0x1e')](function(){_0x1d8a25({'val':_0x271be5[_0x48dd('0x1f')]});});});}function splitAdditionalPhone(_0x109194,_0x1f5ac2){return new Promise(function(_0xa9df11,_0x2464a9){var _0x13d66c=_0x1f5ac2['split'](':');var _0x52d217=_0x13d66c[0x0];var _0x4707af=_0x13d66c[0x1];if(!_[_0x48dd('0x23')](_0x4707af)){var _0x82a065=_0x4707af['split']('|');var _0xf0244b=[];for(var _0x11c17c=0x0;_0x11c17c<_0x82a065[_0x48dd('0x1f')];_0x11c17c++){if(_0x82a065[_0x11c17c]!==''){var _0x2e5301=_[_0x48dd('0x24')](promisesAdditionalPhones,{'contactId':_0x109194,'phone':_0x82a065[_0x11c17c]});if(_0x2e5301[_0x48dd('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0x48dd('0x25')]({'contactId':_0x109194,'contactTypeId':_0x52d217,'phone':_0x82a065[_0x11c17c],'orderBy':orderBy});}}}_0xa9df11({'ok':0x1});}else _0xa9df11({'res':0x0});});}function createAdditionalPhone(_0x171a89,_0x19e20d,_0x422a53,_0x41bfc4){var _0x2e26d1='';var _0x4c3a7a='';var _0x1ddaf3=_0x422a53[_0x48dd('0x22')]('§');_0x2e26d1=_0x1ddaf3[0x0];if(_0x1ddaf3[_0x48dd('0x1f')]==0x2)_0x4c3a7a=_0x1ddaf3[0x1];return new Promise(function(_0x3a92b1,_0x4d3146){return db[_0x48dd('0x26')][_0x48dd('0x27')]({'where':{'CmContactId':_0x171a89,'item':_0x2e26d1}})[_0x48dd('0x1e')](function(_0x530e46){if(_0x530e46){return db[_0x48dd('0x26')][_0x48dd('0x28')]({'ItemTypeId':_0x19e20d,'description':_0x4c3a7a,'OrderBy':_0x41bfc4},{'where':{'CmContactId':_0x171a89,'item':_0x2e26d1}})[_0x48dd('0x1e')](function(_0x33d401){_0x3a92b1({'res':_0x48dd('0x29')});});}else{return db[_0x48dd('0x26')][_0x48dd('0x2a')]({'CmContactId':_0x171a89,'item':_0x2e26d1,'description':_0x4c3a7a,'ItemTypeId':_0x19e20d,'OrderBy':_0x41bfc4,'ItemClass':_0x48dd('0x2b')})[_0x48dd('0x1e')](function(_0x560b02){_0x3a92b1({'res':_0x48dd('0x2c')});});}});});}function insertCmHopper(_0x186fbd,_0x492ce8,_0x1b15b8,_0x5ee476,_0x1fc710){var _0x5238e0=[_0x48dd('0x2d'),'cm_contacts.scheduledat',_0x48dd('0x2e'),'cm_contacts.ListId',_0x492ce8+'.'+_0x5ee476,_0x48dd('0x2f'),_0x48dd('0x30'),'cm_contacts.priority',_0x48dd('0x31'),'\x22'+_0x1fc710+'\x22'];return squel['insert']()['into'](_0x48dd('0x32'))[_0x48dd('0x33')]([_0x48dd('0x15'),_0x48dd('0x34'),_0x48dd('0x35'),_0x48dd('0x36'),_0x5ee476,_0x48dd('0x37'),_0x48dd('0x38'),'priority',_0x48dd('0x39'),_0x48dd('0x3a')],squel[_0x48dd('0x13')]()['fields'](_0x5238e0)[_0x48dd('0x16')](_0x492ce8)[_0x48dd('0x1b')](_0x48dd('0x3b'),null,_0x48dd('0x3c')+_0x492ce8+'.CmListId')[_0x48dd('0x1b')](_0x1b15b8,null,_0x1b15b8+'.id\x20=\x20'+_0x492ce8+'.'+_0x5ee476)[_0x48dd('0x18')](_0x492ce8+_0x48dd('0x3d'),_0x186fbd)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x48dd('0x18')](_0x48dd('0x3e'),selectNotIn(_0x492ce8,_0x1b15b8,_0x5ee476,_0x48dd('0x32'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x48dd('0x18')](_0x48dd('0x3e'),selectNotIn(_0x492ce8,_0x1b15b8,_0x5ee476,'cm_hopper',['\x22always\x22'])))[_0x48dd('0x3f')]();}function insertCmHopperBlack(_0x2c81bd,_0xbed94,_0x39d455,_0x22b427){var _0x168fde=['cm_contacts.phone',_0x48dd('0x2e'),_0x48dd('0x40'),_0xbed94+'.'+_0x22b427,_0x48dd('0x2f'),_0x48dd('0x30')];return squel[_0x48dd('0x41')]()['into'](_0x48dd('0x42'))[_0x48dd('0x33')]([_0x48dd('0x15'),_0x48dd('0x35'),_0x48dd('0x36'),_0x22b427,_0x48dd('0x37'),_0x48dd('0x38')],squel['select']()[_0x48dd('0x43')](_0x168fde)[_0x48dd('0x16')](_0xbed94)['join'](_0x48dd('0x3b'),null,_0x48dd('0x3c')+_0xbed94+'.CmListId')[_0x48dd('0x1b')](_0x39d455,null,_0x39d455+_0x48dd('0x17')+_0xbed94+'.'+_0x22b427)[_0x48dd('0x18')](_0xbed94+'.CmListId\x20=\x20?',_0x2c81bd)['where'](_0x48dd('0x44'),NOW)[_0x48dd('0x18')](_0x48dd('0x3e'),squel[_0x48dd('0x13')]()[_0x48dd('0x14')](_0x48dd('0x15'))['from'](_0x48dd('0x42'))[_0x48dd('0x18')]('ListId\x20=\x20?',_0x2c81bd)[_0x48dd('0x18')](_0x22b427+_0x48dd('0x19')+_0xbed94+'.'+_0x22b427)))['toString']();}function insertTzCmHopper(_0x58eb64,_0xcf14cb,_0x4f1be9,_0x48e19a,_0x2fd658,_0x24922d){var _0x49aac4=[_0x48dd('0x2d'),_0x48dd('0x45')+_0x24922d+_0x48dd('0x46'),_0x48dd('0x2e'),_0x48dd('0x40'),_0xcf14cb+'.'+_0x48e19a,_0x48dd('0x2f'),'cm_contacts.updatedAt',_0x48dd('0x47'),_0x48dd('0x31'),'\x22'+_0x2fd658+'\x22'];var _0x43b6be=squel[_0x48dd('0x41')]()[_0x48dd('0x48')](_0x48dd('0x32'))[_0x48dd('0x33')]([_0x48dd('0x15'),_0x48dd('0x34'),_0x48dd('0x35'),_0x48dd('0x36'),_0x48e19a,_0x48dd('0x37'),_0x48dd('0x38'),_0x48dd('0x49'),_0x48dd('0x39'),_0x48dd('0x3a')],squel[_0x48dd('0x13')]()['fields'](_0x49aac4)['from'](_0xcf14cb)[_0x48dd('0x1b')](_0x48dd('0x3b'),null,_0x48dd('0x3c')+_0xcf14cb+_0x48dd('0x4a'))['join'](_0x4f1be9,null,_0x4f1be9+_0x48dd('0x17')+_0xcf14cb+'.'+_0x48e19a)[_0x48dd('0x1b')](_0x24922d,null,_0x24922d+'.id\x20=\x20'+_0xcf14cb+'.'+_0x48e19a)[_0x48dd('0x18')](_0xcf14cb+_0x48dd('0x3d'),_0x58eb64)['where'](_0x48dd('0x44'),NOW)[_0x48dd('0x18')](_0x48dd('0x3e'),selectNotIn(_0xcf14cb,_0x4f1be9,_0x48e19a,_0x48dd('0x32'),[_0x48dd('0x4b'),_0x48dd('0x4c')]))[_0x48dd('0x18')](_0x48dd('0x3e'),selectNotIn(_0xcf14cb,_0x4f1be9,_0x48e19a,_0x48dd('0x32'),[_0x48dd('0x4b')])))[_0x48dd('0x3f')]();return _0x43b6be;}function insertTzCmHopperBlack(_0x6d824d,_0x17150d,_0x2190d0,_0x37ab8b){var _0x1edb1c=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x17150d+'.'+_0x37ab8b,_0x48dd('0x2f'),_0x48dd('0x30')];return squel['insert']()[_0x48dd('0x48')]('cm_hopper_black')[_0x48dd('0x33')]([_0x48dd('0x15'),_0x48dd('0x35'),'ListId',_0x37ab8b,_0x48dd('0x37'),_0x48dd('0x38')],squel['select']()[_0x48dd('0x43')](_0x1edb1c)['from'](_0x17150d)[_0x48dd('0x1b')](_0x48dd('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x17150d+_0x48dd('0x4a'))[_0x48dd('0x1b')](_0x2190d0,null,_0x2190d0+_0x48dd('0x17')+_0x17150d+'.'+_0x37ab8b)[_0x48dd('0x18')](_0x17150d+'.CmListId\x20=\x20?',_0x6d824d)[_0x48dd('0x18')](_0x48dd('0x44'),NOW)['where'](_0x48dd('0x3e'),squel['select']()['field'](_0x48dd('0x15'))[_0x48dd('0x16')](_0x48dd('0x42'))[_0x48dd('0x18')](_0x48dd('0x4d'),_0x6d824d)[_0x48dd('0x18')](_0x37ab8b+_0x48dd('0x19')+_0x17150d+'.'+_0x37ab8b)))['toString']();}function insertCmHopperAdditionalPhones(_0x2d8a4f){var _0x34245c=[_0x48dd('0x4e'),'cm_contact_has_items.item',_0x48dd('0x4f'),'cm_contact_has_items.createdAt',_0x48dd('0x50')];return squel[_0x48dd('0x41')]()['into'](_0x48dd('0x51'))['fromQuery']([_0x48dd('0x52'),'phone','OrderBy',_0x48dd('0x37'),_0x48dd('0x38')],squel['select']()['fields'](_0x34245c)[_0x48dd('0x16')](_0x48dd('0x32'))[_0x48dd('0x1b')](_0x48dd('0x3b'),null,_0x48dd('0x53'))[_0x48dd('0x1b')](_0x48dd('0x54'),null,_0x48dd('0x55'))[_0x48dd('0x18')](_0x48dd('0x56'),_0x2d8a4f)[_0x48dd('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x48dd('0x3f')]();}function insertCmContact(_0x5e5796,_0x1e02ff,_0x115fdb,_0x5169a8){var _0x15fbe3=_['concat'](_[_0x48dd('0x57')](_0x5169a8),[_0x48dd('0x36'),_0x48dd('0x58'),_0x48dd('0x37'),_0x48dd('0x38')]);return squel[_0x48dd('0x41')]()['into'](_0x48dd('0x3b'))[_0x48dd('0x33')](_0x15fbe3,squel[_0x48dd('0x13')]()['fields'](_0x15fbe3)[_0x48dd('0x16')](_0x1e02ff)['where']('('+_0x115fdb[_0x48dd('0x1b')](',')+_0x48dd('0x59'),squel[_0x48dd('0x13')]()[_0x48dd('0x43')](_0x115fdb)['from']('cm_contacts')[_0x48dd('0x18')]('ListId\x20=\x20?',_0x5e5796)[_0x48dd('0x18')](_0x48dd('0x5a')))[_0x48dd('0x18')](_0x48dd('0x5b'),squel[_0x48dd('0x13')]()['field'](_0x48dd('0x5c'),'min_id')[_0x48dd('0x16')](_0x1e02ff)['group'](_0x115fdb[_0x48dd('0x1b')](','))))['toString']();}function handleStop(){logger['info'](_0x48dd('0x5d'));stopped=!![];}function handleUncaughtException(_0x45914f){logger[_0x48dd('0x5e')](_0x45914f[_0x48dd('0x5f')]);process[_0x48dd('0x60')](0x1);}function handleError(_0x5eb194,_0x4ef5f8){stats['errors'][_0x48dd('0x25')]({'name':_0x4ef5f8[_0x48dd('0x61')],'message':_0x4ef5f8[_0x48dd('0x5f')],'row':_0x5eb194});}function handleQuery(_0x236807){logger[_0x48dd('0x62')](_0x236807);return db[_0x48dd('0x63')][_0x48dd('0x64')](_0x236807)['spread'](function(_0x5dd89c){results['push'](_0x5dd89c);})[_0x48dd('0x65')](function(_0x2bbed3){logger['error'](_0x2bbed3[_0x48dd('0x5f')]);});}function updateTzCampaigns(_0x1e21fe){return new Promise(function(_0x5623cd,_0x30b885){var _0x3e4e2a=squel['select']()[_0x48dd('0x43')](['campaigns.id',_0x48dd('0x66')])['from'](_0x48dd('0x67'))['join'](_0x48dd('0x68'),null,_0x48dd('0x69'))[_0x48dd('0x18')](_0x48dd('0x6a')+_0x1e21fe);db['sequelize'][_0x48dd('0x64')](_0x3e4e2a[_0x48dd('0x3f')]())[_0x48dd('0x6b')](function(_0x44598b){var _0x3753b5=[];for(var _0x2efff6=0x0;_0x2efff6<_0x44598b[_0x48dd('0x1f')];_0x2efff6++){_0x3753b5[_0x48dd('0x25')](getTimezoneData(_0x44598b[_0x2efff6],tmp_campaigns));}BPromise[_0x48dd('0x20')](_0x3753b5)[_0x48dd('0x1e')](function(){_0x5623cd({'val':0x1});});})[_0x48dd('0x65')](function(_0x5ed452){logger['error'](_0x5ed452[_0x48dd('0x5f')]);_0x5623cd({'val':0x0});});});}function updateTzVoiceQueues(_0x5cdfa1){return new Promise(function(_0x418883,_0x254964){var _0x4bd0df=squel[_0x48dd('0x13')]()[_0x48dd('0x43')]([_0x48dd('0x6c'),_0x48dd('0x6d')])[_0x48dd('0x16')](_0x48dd('0x6e'))[_0x48dd('0x1b')]('voice_queues_has_cm_lists',null,_0x48dd('0x6f'))[_0x48dd('0x18')](_0x48dd('0x70')+_0x5cdfa1);db[_0x48dd('0x63')][_0x48dd('0x64')](_0x4bd0df[_0x48dd('0x3f')]())[_0x48dd('0x6b')](function(_0x3afc10){var _0x110d56=[];for(var _0x281a67=0x0;_0x281a67<_0x3afc10[_0x48dd('0x1f')];_0x281a67++){_0x110d56[_0x48dd('0x25')](getTimezoneData(_0x3afc10[_0x281a67],tmp_voice_queues));}BPromise[_0x48dd('0x20')](_0x110d56)['then'](function(){_0x418883({'val':0x1});});})['catch'](function(_0x5898de){logger[_0x48dd('0x5e')](_0x5898de[_0x48dd('0x5f')]);_0x418883({'val':0x0});});});}function getTimezoneData(_0x2730ad,_0x4b2ef1){return new Promise(function(_0x1ecf75,_0x142749){var _0x310ea1=shared[_0x48dd('0x71')];var _0x5a38b7=_0x310ea1[_0x2730ad[_0x48dd('0x72')]];if(_[_0x48dd('0x23')](_0x5a38b7)){_0x1ecf75({'ret':0x1});}else{var _0x52abb2=_0x5a38b7['utcOffset'];var _0x324d9e=squel[_0x48dd('0x41')]()[_0x48dd('0x48')](_0x4b2ef1)['set']('id',_0x2730ad['id'])['set'](_0x48dd('0x73'),_0x52abb2)[_0x48dd('0x74')](_0x48dd('0x72'),_0x2730ad[_0x48dd('0x72')])['toString']();return db[_0x48dd('0x63')][_0x48dd('0x64')](_0x324d9e)[_0x48dd('0x6b')](function(_0x3f3c4f){_0x1ecf75({'ret':0x1});})[_0x48dd('0x65')](function(_0x4b739f){logger['error'](_0x4b739f[_0x48dd('0x5f')]);_0x142749({'ret':0x1});});}});}function handleTZQuery(_0x5b8b3a){logger[_0x48dd('0x62')](_0x5b8b3a);return db[_0x48dd('0x63')]['query'](_0x5b8b3a)[_0x48dd('0x6b')](function(_0x46b195){})[_0x48dd('0x65')](function(_0x4f5e75){logger[_0x48dd('0x5e')](_0x4f5e75[_0x48dd('0x5f')]);});}function main(_0xffe10d,_0x591672,_0x29ca90,_0x3b86c5){logger['info'](_0x48dd('0x75'),_0xffe10d,JSON['stringify'](_0x591672));process[_0x48dd('0x76')](_0x48dd('0x77'));var _0xfe5e93=_0x591672[_0x48dd('0x78')];var _0x15af3f=_[_0x48dd('0x79')](_0xfe5e93);var _0x28a5fb=_0x591672['socket_timestamp'];var _0x32850b=path['join'](config[_0x48dd('0x7a')],_0x48dd('0x7b'),_0x28a5fb+_0x48dd('0x7c'));hasTZ=_[_0x48dd('0x57')](_0xfe5e93)[_0x48dd('0x7d')]('dialTimezone');var _0x5cea92=_[_0x48dd('0x57')](_0xfe5e93)['join']();logger[_0x48dd('0x62')]('header',_0x5cea92);db[_0x48dd('0x7e')][_0x48dd('0x1d')]({'raw':!![],'attributes':['id',_0x48dd('0x7f')]})['then'](function(_0x81fedc){for(var _0x3e4a7a=0x0;_0x3e4a7a<_0x81fedc['length'];_0x3e4a7a++){if(_0x81fedc[_0x3e4a7a]['name']in _0xfe5e93){contactItemTypes[_0x48dd('0x25')](_0x81fedc[_0x3e4a7a]);delete _0x15af3f[_0x81fedc[_0x3e4a7a][_0x48dd('0x7f')]];hasAdditionalPhones=!![];}for(var _0x5ed409 in _0xfe5e93){if(_0x81fedc[_0x3e4a7a][_0x48dd('0x7f')]+'_description'===_0x5ed409){phoneDescriptions[_0x48dd('0x25')]({'itemTypeId':_0x81fedc[_0x3e4a7a]['id'],'description':_0x5ed409});delete _0x15af3f[_0x5ed409];}}}if(hasAdditionalPhones)_0x15af3f['AdditionalPhones']='';var _0x52b880=_[_0x48dd('0x57')](_0x15af3f)['join']();logger['info'](_0x48dd('0x80'),_0x52b880);fs[_0x48dd('0x81')](_0x32850b,_0x52b880+'\x0a');Papa[_0x48dd('0x82')](fs['createReadStream'](_0xffe10d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x54f823,_0x1e4c10){try{for(var _0x40d75e=0x0,_0x1416ab=[];_0x40d75e<_0x54f823[_0x48dd('0x83')][_0x48dd('0x1f')];_0x40d75e++){stats[_0x48dd('0x84')]+=0x1;if(_0x54f823[_0x48dd('0x85')][_0x40d75e]){handleError(_0x54f823[_0x48dd('0x83')][_0x40d75e],_0x54f823['errors'][_0x40d75e]);}else{var _0x8d5382=[];var _0x3e3047=[];var _0x4978e7={};for(var _0x32b04a in _0xfe5e93){let _0x321bdd=contactItemTypes[_0x48dd('0x86')](_0x4ba6ca=>_0x4ba6ca[_0x48dd('0x7f')]===_0x32b04a);let _0x45ad42=contactItemTypes['find'](_0x532738=>_0x532738['name']+_0x48dd('0x87')===_0x32b04a);if(_[_0x48dd('0x23')](_0x321bdd)&&_[_0x48dd('0x23')](_0x45ad42)){if(_0xfe5e93[_0x48dd('0x88')](_0x32b04a)){if(_0x54f823[_0x48dd('0x83')][_0x40d75e][_0xfe5e93[_0x32b04a]]){var _0x4990c7=_[_0x48dd('0x89')](_0x54f823[_0x48dd('0x83')][_0x40d75e][_0xfe5e93[_0x32b04a]][_0x48dd('0x8a')](/"/g,'\x27'));switch(_0x32b04a){case _0x48dd('0x34'):var _0x49bfbb=moment(_0x4990c7,_0x48dd('0x11'),!![]);if(_0x49bfbb[_0x48dd('0x8b')]()){_0x1416ab['push']('\x22'+_0x4990c7+'\x22');}else{_0x8d5382[_0x48dd('0x25')](_0x48dd('0x8c'));}break;case _0x48dd('0x49'):var _0x38f3cf=parseInt(_0x4990c7);_0x4990c7=_[_0x48dd('0x8d')](_0x38f3cf)||_0x38f3cf<0x0||_0x38f3cf>0x4?_0x3b86c5?0x3:0x2:_0x38f3cf;_0x1416ab['push']('\x22'+_0x4990c7+'\x22');break;case'UserId':var _0x5b6efb=parseInt(_0x4990c7);if(_[_0x48dd('0x8e')](_0x5b6efb)&&_[_0x48dd('0x7d')](_0x29ca90,_0x5b6efb)){_0x1416ab[_0x48dd('0x25')]('\x22'+_0x5b6efb+'\x22');}else{_0x8d5382[_0x48dd('0x25')](_0x48dd('0x8f'));}break;case _0x48dd('0x90'):if(isEmail(_0x4990c7)){_0x1416ab[_0x48dd('0x25')]('\x22'+_0x4990c7+'\x22');}else{_0x8d5382['push']('email\x20wrong\x20format');}break;case _0x48dd('0x91'):var _0x459ae1=moment(_0x4990c7,_0x48dd('0x92'),!![]);if(_0x459ae1['isValid']()){_0x1416ab[_0x48dd('0x25')]('\x22'+_0x4990c7+'\x22');}else{_0x8d5382[_0x48dd('0x25')](_0x48dd('0x93'));}break;case'dialTimezone':var _0x222649=shared[_0x48dd('0x71')];var _0x42fc1c=_0x222649[_0x4990c7];if(!_[_0x48dd('0x23')](_0x42fc1c)){var _0x318676=_0x42fc1c[_0x48dd('0x94')];_0x1416ab['push']('\x22'+_0x4990c7+'\x22');_0x1416ab[_0x48dd('0x25')]('\x22'+_0x318676+'\x22');}break;default:_0x1416ab[_0x48dd('0x25')]('\x22'+_0x4990c7+'\x22');}}else{switch(_0x32b04a){case _0x48dd('0x95'):case _0x48dd('0x15'):_0x8d5382['push'](_0x32b04a+'\x20not\x20specified');break;default:_0x1416ab[_0x48dd('0x25')]('\x22\x22');}}}}else{var _0x2b87df='';if(!_[_0x48dd('0x23')](_0x321bdd)){if(!_0x4978e7[_0x48dd('0x88')](_0x321bdd['id'])){if(!_[_0x48dd('0x23')](_0x54f823[_0x48dd('0x83')][_0x40d75e][_0xfe5e93[_0x32b04a]])){var _0x4990c7=_['trim'](_0x54f823[_0x48dd('0x83')][_0x40d75e][_0xfe5e93[_0x32b04a]][_0x48dd('0x8a')](/"/g,'\x27'));var _0x298aea=phoneDescriptions[_0x48dd('0x86')](_0x39fca0=>_0x39fca0[_0x48dd('0x96')]===_0x321bdd['id']);if(!_['isNil'](_0x298aea)){var _0x4fd32e=_[_0x48dd('0x89')](_0x54f823[_0x48dd('0x83')][_0x40d75e][_0xfe5e93[_0x298aea[_0x48dd('0x97')]]][_0x48dd('0x8a')](/"/g,'\x27'));if(!_['isNil'](_0x4fd32e))_0x4990c7=_0x4990c7+'§'+_0x4fd32e;}if(_0x2b87df=='')_0x2b87df=_0x4990c7;else _0x2b87df+='|'+_0x4990c7;}_0x3e3047[_0x48dd('0x25')](_0x321bdd['id']+':'+_0x2b87df);_0x4978e7[_0x321bdd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1416ab[_0x48dd('0x25')]('\x22'+_0x3e3047[_0x48dd('0x1b')](';')+'\x22');}if(_0x8d5382[_0x48dd('0x1f')]){handleError(_0x54f823[_0x48dd('0x83')][_0x40d75e],{'code':_0x48dd('0x98'),'message':_0x8d5382[_0x48dd('0x1b')]()});}else{fs[_0x48dd('0x99')](_0x32850b,_0x1416ab['join']()+'\x0a');}_0x1416ab=[];}if(!(stats[_0x48dd('0x84')]%0xc8)){socket[_0x48dd('0x9a')](_0x48dd('0x9b')+_0x28a5fb,stats);stats[_0x48dd('0x85')]=[];}}if(stopped){logger[_0x48dd('0x62')]('Abort\x20parser');_0x1e4c10[_0x48dd('0x9c')]();}}catch(_0x1649f3){handleError(_0x54f823[_0x48dd('0x83')][_0x40d75e],{'code':_0x48dd('0x9d'),'message':_0x1649f3[_0x48dd('0x5f')]});logger[_0x48dd('0x5e')](_0x48dd('0x9e'),_0x1649f3['message']);}},'complete':function(){try{var _0x1aefe6=[];var _0x135172=[];var _0x386620=_0x48dd('0x3b');if(_0x591672[_0x48dd('0x9f')]&&_0x591672[_0x48dd('0x9f')]['length']){_0x386620=_0x48dd('0xa0')+_0x28a5fb;_0x1aefe6[_0x48dd('0x25')](_0x48dd('0xa1')+_0x386620+_0x48dd('0xa2'));}tmp_campaigns=_0x48dd('0xa3')+_0x28a5fb;tmp_voice_queues=_0x48dd('0xa4')+_0x28a5fb;_0x135172['push'](_0x48dd('0xa1')+tmp_campaigns+_0x48dd('0xa5'));_0x135172[_0x48dd('0x25')](_0x48dd('0xa1')+tmp_voice_queues+_0x48dd('0xa5'));BPromise[_0x48dd('0xa6')](_0x135172,handleTZQuery)['then'](function(_0x4794d9){updateTzCampaigns(_0x591672[_0x48dd('0x36')])[_0x48dd('0x1e')](function(_0x3e8e53){updateTzVoiceQueues(_0x591672['ListId'])[_0x48dd('0x1e')](function(_0x1f8615){if(hasTZ)_0x52b880=_0x52b880['replace']('dialTimezone',_0x48dd('0xa7'));var _0xc22941=util[_0x48dd('0x10')](_0x48dd('0xa8'),_0x32850b,_0x386620,_0x52b880,_0x591672[_0x48dd('0x36')],_0x591672[_0x48dd('0x58')]||null,NOW,NOW);if(_[_0x48dd('0x23')](_0xfe5e93['scheduledat'])){_0xc22941+=_0x48dd('0xa9');}_0x1aefe6[_0x48dd('0x25')](_0xc22941);if(_0x591672[_0x48dd('0x9f')]&&_0x591672[_0x48dd('0x9f')][_0x48dd('0x1f')]){_0x1aefe6[_0x48dd('0x25')](insertCmContact(_0x591672[_0x48dd('0x36')],_0x386620,_0x591672[_0x48dd('0x9f')],_0xfe5e93));_0x1aefe6['push']('DROP\x20TABLE\x20'+_0x386620+';');}BPromise[_0x48dd('0xa6')](_0x1aefe6,handleQuery)['then'](function(_0x19b9f9){BPromise[_0x48dd('0x20')]([handleAdditionalPhones()])['then'](function(){_0x1aefe6=[];for(var _0x383dfa=0x0;_0x383dfa\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','map','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','moment','squel','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','CmContactHasItem','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','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_contacts.updatedAt','.id\x20=\x20','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','UserId','cm_hopper_black','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','min_id','group','Received\x20SIGINT','error','message','errors','code','info','sequelize','query','spread'];(function(_0x37464d,_0x29bf11){var _0x4e7573=function(_0x4de5e3){while(--_0x4de5e3){_0x37464d['push'](_0x37464d['shift']());}};_0x4e7573(++_0x29bf11);}(_0x4089,0x1bf));var _0x9408=function(_0x58c7fa,_0x8cf29e){_0x58c7fa=_0x58c7fa-0x0;var _0x4f0f5b=_0x4089[_0x58c7fa];return _0x4f0f5b;};'use strict';var fs=require('fs');var path=require(_0x9408('0x0'));var _=require('lodash');var Papa=require(_0x9408('0x1'));var util=require(_0x9408('0x2'));var BPromise=require('bluebird');var moment=require(_0x9408('0x3'));var squel=require(_0x9408('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x9408('0x5'));var shared=require(_0x9408('0x6'));var logger=require(_0x9408('0x7'))('import');config[_0x9408('0x8')]=_[_0x9408('0x9')](config['redis'],{'host':_0x9408('0xa'),'port':0x18eb});var socket=require(_0x9408('0xb'))(new Redis(config[_0x9408('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x9408('0xc')](_0x9408('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x9408('0xc')](_0x9408('0xd'));function isEmail(_0x409387){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))*$/[_0x9408('0xe')](_0x409387);}function selectNotIn(_0x390380,_0x5c532,_0x350c68,_0x5e5e81,_0x2e4185){return squel[_0x9408('0xf')]()[_0x9408('0x10')](_0x9408('0x11'))[_0x9408('0x12')](_0x5e5e81)['join'](_0x5c532,null,_0x5c532+'.id\x20=\x20'+_0x5e5e81+'.'+_0x350c68)[_0x9408('0x13')](_0x5e5e81+'.'+_0x350c68+_0x9408('0x14')+_0x390380+'.'+_0x350c68)[_0x9408('0x13')](_0x5c532+_0x9408('0x15')+_0x2e4185[_0x9408('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1de4a0,_0x5d5a11){promisesAdditionalPhones=[];return db[_0x9408('0x17')][_0x9408('0x18')]({'raw':!![],'attributes':['id',_0x9408('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x9408('0x1a')](function(_0x5443b8){if(_0x5443b8!==null){var _0x2020a4=[];for(var _0x2de4a0=0x0;_0x2de4a0<_0x5443b8[_0x9408('0x1b')];_0x2de4a0++){var _0x111f2f=_0x5443b8[_0x2de4a0];_0x2020a4[_0x9408('0x1c')](insertAdditionalPhones(_0x111f2f));}}Promise[_0x9408('0x1d')](_0x2020a4)['then'](function(){_0x1de4a0({'val':0x1});});});});}function insertAdditionalPhones(_0x50283e){return new Promise(function(_0x4499be,_0x5af57f){var _0x3b5d0e=_0x50283e[_0x9408('0x19')];var _0x52dcff=_0x3b5d0e[_0x9408('0x1e')](';');var _0x1dd25b=[];orderBy=0x0;for(var _0x329e09=0x0;_0x329e09<_0x52dcff[_0x9408('0x1b')];_0x329e09++){_0x1dd25b[_0x9408('0x1c')](splitAdditionalPhone(_0x50283e['id'],_0x52dcff[_0x329e09]));}Promise['all'](_0x1dd25b)[_0x9408('0x1a')](function(){_0x4499be({'val':_0x52dcff[_0x9408('0x1b')]});});});}function splitAdditionalPhone(_0x3795ee,_0x2130e6){return new Promise(function(_0x361549,_0xc53029){var _0xedc6e7=_0x2130e6[_0x9408('0x1e')](':');var _0x3bfe93=_0xedc6e7[0x0];var _0x4b4095=_0xedc6e7[0x1];if(!_[_0x9408('0x1f')](_0x4b4095)){var _0x1cfd7e=_0x4b4095[_0x9408('0x1e')]('|');var _0x4ab355=[];for(var _0x51478e=0x0;_0x51478e<_0x1cfd7e['length'];_0x51478e++){if(_0x1cfd7e[_0x51478e]!==''){var _0xebc329=_['filter'](promisesAdditionalPhones,{'contactId':_0x3795ee,'phone':_0x1cfd7e[_0x51478e]});if(_0xebc329[_0x9408('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3795ee,'contactTypeId':_0x3bfe93,'phone':_0x1cfd7e[_0x51478e],'orderBy':orderBy});}}}_0x361549({'ok':0x1});}else _0x361549({'res':0x0});});}function createAdditionalPhone(_0x2370c2,_0x3cdbc9,_0x43f68a,_0x40b395){var _0x4ab16b='';var _0x3699e0='';var _0x5c5f28=_0x43f68a[_0x9408('0x1e')]('§');_0x4ab16b=_0x5c5f28[0x0];if(_0x5c5f28['length']==0x2)_0x3699e0=_0x5c5f28[0x1];return new Promise(function(_0xca7434,_0x3ec3e7){return db[_0x9408('0x20')]['findOne']({'where':{'CmContactId':_0x2370c2,'item':_0x4ab16b}})['then'](function(_0x5410d6){if(_0x5410d6){return db[_0x9408('0x20')]['update']({'ItemTypeId':_0x3cdbc9,'description':_0x3699e0,'OrderBy':_0x40b395},{'where':{'CmContactId':_0x2370c2,'item':_0x4ab16b}})[_0x9408('0x1a')](function(_0x25d7dc){_0xca7434({'res':_0x9408('0x21')});});}else{return db[_0x9408('0x20')]['create']({'CmContactId':_0x2370c2,'item':_0x4ab16b,'description':_0x3699e0,'ItemTypeId':_0x3cdbc9,'OrderBy':_0x40b395,'ItemClass':_0x9408('0x22')})['then'](function(_0x1366e1){_0xca7434({'res':_0x9408('0x23')});});}});});}function insertCmHopper(_0x372ede,_0x3fbaab,_0x2d6aae,_0x449bfd,_0x40456b){var _0x34acee=[_0x9408('0x24'),'cm_contacts.scheduledat',_0x9408('0x25'),_0x9408('0x26'),_0x3fbaab+'.'+_0x449bfd,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x9408('0x27'),'cm_contacts.UserId','\x22'+_0x40456b+'\x22'];return squel[_0x9408('0x28')]()[_0x9408('0x29')](_0x9408('0x2a'))[_0x9408('0x2b')]([_0x9408('0x11'),_0x9408('0x2c'),_0x9408('0x2d'),_0x9408('0x2e'),_0x449bfd,_0x9408('0x2f'),_0x9408('0x30'),_0x9408('0x31'),'UserId',_0x9408('0x32')],squel[_0x9408('0xf')]()[_0x9408('0x33')](_0x34acee)[_0x9408('0x12')](_0x3fbaab)['join'](_0x9408('0x34'),null,_0x9408('0x35')+_0x3fbaab+_0x9408('0x36'))[_0x9408('0x16')](_0x2d6aae,null,_0x2d6aae+'.id\x20=\x20'+_0x3fbaab+'.'+_0x449bfd)[_0x9408('0x13')](_0x3fbaab+_0x9408('0x37'),_0x372ede)[_0x9408('0x13')](_0x9408('0x38'),NOW)['where'](_0x9408('0x39'),selectNotIn(_0x3fbaab,_0x2d6aae,_0x449bfd,_0x9408('0x2a'),[_0x9408('0x3a'),_0x9408('0x3b')]))[_0x9408('0x13')](_0x9408('0x39'),selectNotIn(_0x3fbaab,_0x2d6aae,_0x449bfd,'cm_hopper',[_0x9408('0x3a')])))[_0x9408('0x3c')]();}function insertCmHopperBlack(_0xae690,_0x451e79,_0xbc6470,_0x2876cc){var _0x2fb27a=[_0x9408('0x24'),'cm_contacts.id',_0x9408('0x26'),_0x451e79+'.'+_0x2876cc,_0x9408('0x3d'),_0x9408('0x3e')];return squel[_0x9408('0x28')]()[_0x9408('0x29')]('cm_hopper_black')[_0x9408('0x2b')]([_0x9408('0x11'),'ContactId',_0x9408('0x2e'),_0x2876cc,'createdAt',_0x9408('0x30')],squel[_0x9408('0xf')]()[_0x9408('0x33')](_0x2fb27a)[_0x9408('0x12')](_0x451e79)[_0x9408('0x16')]('cm_contacts',null,_0x9408('0x35')+_0x451e79+_0x9408('0x36'))[_0x9408('0x16')](_0xbc6470,null,_0xbc6470+_0x9408('0x3f')+_0x451e79+'.'+_0x2876cc)[_0x9408('0x13')](_0x451e79+_0x9408('0x37'),_0xae690)[_0x9408('0x13')](_0x9408('0x38'),NOW)[_0x9408('0x13')](_0x9408('0x39'),squel[_0x9408('0xf')]()[_0x9408('0x10')](_0x9408('0x11'))[_0x9408('0x12')]('cm_hopper_black')[_0x9408('0x13')](_0x9408('0x40'),_0xae690)[_0x9408('0x13')](_0x2876cc+_0x9408('0x14')+_0x451e79+'.'+_0x2876cc)))[_0x9408('0x3c')]();}function insertTzCmHopper(_0x30a81f,_0x2a2df3,_0x244fc6,_0x106dd2,_0x152383,_0x2864e3){var _0x1c0914=['cm_contacts.phone',_0x9408('0x41')+_0x2864e3+_0x9408('0x42'),_0x9408('0x25'),_0x9408('0x26'),_0x2a2df3+'.'+_0x106dd2,_0x9408('0x3d'),_0x9408('0x3e'),_0x9408('0x27'),_0x9408('0x43'),'\x22'+_0x152383+'\x22'];var _0x4762ce=squel['insert']()[_0x9408('0x29')](_0x9408('0x2a'))[_0x9408('0x2b')]([_0x9408('0x11'),_0x9408('0x2c'),'ContactId',_0x9408('0x2e'),_0x106dd2,_0x9408('0x2f'),_0x9408('0x30'),_0x9408('0x31'),_0x9408('0x44'),_0x9408('0x32')],squel[_0x9408('0xf')]()[_0x9408('0x33')](_0x1c0914)['from'](_0x2a2df3)[_0x9408('0x16')](_0x9408('0x34'),null,_0x9408('0x35')+_0x2a2df3+_0x9408('0x36'))[_0x9408('0x16')](_0x244fc6,null,_0x244fc6+_0x9408('0x3f')+_0x2a2df3+'.'+_0x106dd2)[_0x9408('0x16')](_0x2864e3,null,_0x2864e3+_0x9408('0x3f')+_0x2a2df3+'.'+_0x106dd2)[_0x9408('0x13')](_0x2a2df3+_0x9408('0x37'),_0x30a81f)[_0x9408('0x13')](_0x9408('0x38'),NOW)['where'](_0x9408('0x39'),selectNotIn(_0x2a2df3,_0x244fc6,_0x106dd2,_0x9408('0x2a'),[_0x9408('0x3a'),_0x9408('0x3b')]))[_0x9408('0x13')](_0x9408('0x39'),selectNotIn(_0x2a2df3,_0x244fc6,_0x106dd2,_0x9408('0x2a'),[_0x9408('0x3a')])))[_0x9408('0x3c')]();return _0x4762ce;}function insertTzCmHopperBlack(_0x23dcac,_0x2d23d1,_0x5ab660,_0x583085){var _0x63911a=[_0x9408('0x24'),_0x9408('0x25'),_0x9408('0x26'),_0x2d23d1+'.'+_0x583085,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x9408('0x28')]()['into'](_0x9408('0x45'))[_0x9408('0x2b')]([_0x9408('0x11'),'ContactId',_0x9408('0x2e'),_0x583085,_0x9408('0x2f'),_0x9408('0x30')],squel[_0x9408('0xf')]()[_0x9408('0x33')](_0x63911a)[_0x9408('0x12')](_0x2d23d1)[_0x9408('0x16')](_0x9408('0x34'),null,_0x9408('0x35')+_0x2d23d1+'.CmListId')['join'](_0x5ab660,null,_0x5ab660+'.id\x20=\x20'+_0x2d23d1+'.'+_0x583085)[_0x9408('0x13')](_0x2d23d1+_0x9408('0x37'),_0x23dcac)['where'](_0x9408('0x38'),NOW)['where'](_0x9408('0x39'),squel[_0x9408('0xf')]()[_0x9408('0x10')]('phone')[_0x9408('0x12')](_0x9408('0x45'))['where']('ListId\x20=\x20?',_0x23dcac)[_0x9408('0x13')](_0x583085+_0x9408('0x14')+_0x2d23d1+'.'+_0x583085)))[_0x9408('0x3c')]();}function insertCmHopperAdditionalPhones(_0x6c4873){var _0x274d48=[_0x9408('0x46'),_0x9408('0x47'),_0x9408('0x48'),'cm_contact_has_items.createdAt',_0x9408('0x49')];return squel['insert']()[_0x9408('0x29')](_0x9408('0x4a'))['fromQuery']([_0x9408('0x4b'),_0x9408('0x11'),_0x9408('0x4c'),_0x9408('0x2f'),_0x9408('0x30')],squel[_0x9408('0xf')]()[_0x9408('0x33')](_0x274d48)[_0x9408('0x12')](_0x9408('0x2a'))[_0x9408('0x16')](_0x9408('0x34'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x9408('0x16')](_0x9408('0x4d'),null,_0x9408('0x4e'))['where'](_0x9408('0x4f'),_0x6c4873)['where'](_0x9408('0x38'),NOW))[_0x9408('0x3c')]();}function insertCmContact(_0x543d6d,_0x54f173,_0x47c544,_0x529a6c){var _0x1ef6a1=_[_0x9408('0x50')](_[_0x9408('0x51')](_0x529a6c),[_0x9408('0x2e'),_0x9408('0x52'),_0x9408('0x2f'),'updatedAt']);return squel[_0x9408('0x28')]()[_0x9408('0x29')](_0x9408('0x34'))['fromQuery'](_0x1ef6a1,squel[_0x9408('0xf')]()['fields'](_0x1ef6a1)[_0x9408('0x12')](_0x54f173)['where']('('+_0x47c544[_0x9408('0x16')](',')+_0x9408('0x53'),squel[_0x9408('0xf')]()['fields'](_0x47c544)[_0x9408('0x12')](_0x9408('0x34'))['where'](_0x9408('0x40'),_0x543d6d)[_0x9408('0x13')](_0x9408('0x54')))[_0x9408('0x13')]('id\x20IN\x20?',squel['select']()['field']('MIN(id)',_0x9408('0x55'))[_0x9408('0x12')](_0x54f173)[_0x9408('0x56')](_0x47c544[_0x9408('0x16')](','))))[_0x9408('0x3c')]();}function handleStop(){logger['info'](_0x9408('0x57'));stopped=!![];}function handleUncaughtException(_0x533023){logger[_0x9408('0x58')](_0x533023[_0x9408('0x59')]);process['exit'](0x1);}function handleError(_0x3f77e6,_0xf525b9){stats[_0x9408('0x5a')][_0x9408('0x1c')]({'name':_0xf525b9[_0x9408('0x5b')],'message':_0xf525b9[_0x9408('0x59')],'row':_0x3f77e6});}function handleQuery(_0x7a3805){logger[_0x9408('0x5c')](_0x7a3805);return db[_0x9408('0x5d')][_0x9408('0x5e')](_0x7a3805)[_0x9408('0x5f')](function(_0x30d73a){results[_0x9408('0x1c')](_0x30d73a);})['catch'](function(_0xa353){logger[_0x9408('0x58')](_0xa353[_0x9408('0x59')]);});}function updateTzCampaigns(_0x17395c){return new Promise(function(_0x290697,_0x56a805){var _0x5c8ad7=squel[_0x9408('0xf')]()[_0x9408('0x33')]([_0x9408('0x60'),_0x9408('0x61')])[_0x9408('0x12')](_0x9408('0x62'))[_0x9408('0x16')](_0x9408('0x63'),null,_0x9408('0x64'))['where'](_0x9408('0x65')+_0x17395c);db[_0x9408('0x5d')]['query'](_0x5c8ad7['toString']())[_0x9408('0x5f')](function(_0x55dd47){var _0x4964f4=[];for(var _0x221eef=0x0;_0x221eef<_0x55dd47[_0x9408('0x1b')];_0x221eef++){_0x4964f4[_0x9408('0x1c')](getTimezoneData(_0x55dd47[_0x221eef],tmp_campaigns));}BPromise['all'](_0x4964f4)[_0x9408('0x1a')](function(){_0x290697({'val':0x1});});})[_0x9408('0x66')](function(_0x284a99){logger[_0x9408('0x58')](_0x284a99[_0x9408('0x59')]);_0x290697({'val':0x0});});});}function updateTzVoiceQueues(_0x45e3b9){return new Promise(function(_0x8a9d7f,_0x279944){var _0x22dae5=squel[_0x9408('0xf')]()[_0x9408('0x33')]([_0x9408('0x67'),'voice_queues.dialTimezone'])[_0x9408('0x12')]('voice_queues')[_0x9408('0x16')](_0x9408('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x9408('0x13')](_0x9408('0x69')+_0x45e3b9);db[_0x9408('0x5d')][_0x9408('0x5e')](_0x22dae5[_0x9408('0x3c')]())[_0x9408('0x5f')](function(_0x368849){var _0x460aaf=[];for(var _0x3e17e7=0x0;_0x3e17e7<_0x368849[_0x9408('0x1b')];_0x3e17e7++){_0x460aaf[_0x9408('0x1c')](getTimezoneData(_0x368849[_0x3e17e7],tmp_voice_queues));}BPromise[_0x9408('0x1d')](_0x460aaf)[_0x9408('0x1a')](function(){_0x8a9d7f({'val':0x1});});})[_0x9408('0x66')](function(_0x2185d4){logger[_0x9408('0x58')](_0x2185d4[_0x9408('0x59')]);_0x8a9d7f({'val':0x0});});});}function getTimezoneData(_0x55574d,_0x69181){return new Promise(function(_0x2c6f25,_0x19c141){var _0x53b293=shared['timezones'];var _0x4aa741=_0x53b293[_0x55574d[_0x9408('0x6a')]];if(_[_0x9408('0x1f')](_0x4aa741)){_0x2c6f25({'ret':0x1});}else{var _0x267a2a=_0x4aa741[_0x9408('0x6b')];var _0x583c68=squel[_0x9408('0x28')]()[_0x9408('0x29')](_0x69181)[_0x9408('0x6c')]('id',_0x55574d['id'])[_0x9408('0x6c')](_0x9408('0x6d'),_0x267a2a)['set']('dialTimezone',_0x55574d['dialTimezone'])['toString']();return db[_0x9408('0x5d')][_0x9408('0x5e')](_0x583c68)[_0x9408('0x5f')](function(_0x24f518){_0x2c6f25({'ret':0x1});})[_0x9408('0x66')](function(_0x391e35){logger[_0x9408('0x58')](_0x391e35[_0x9408('0x59')]);_0x19c141({'ret':0x1});});}});}function handleTZQuery(_0x16ff92){logger[_0x9408('0x5c')](_0x16ff92);return db['sequelize'][_0x9408('0x5e')](_0x16ff92)[_0x9408('0x5f')](function(_0x27b9ba){})[_0x9408('0x66')](function(_0x575197){logger[_0x9408('0x58')](_0x575197['message']);});}function main(_0x88ffaf,_0x43584a,_0x607f71,_0x2b5198){logger[_0x9408('0x5c')](_0x9408('0x6e'),_0x88ffaf,JSON[_0x9408('0x6f')](_0x43584a));process[_0x9408('0x70')](_0x9408('0x71'));var _0x2a2301=_0x43584a[_0x9408('0x72')];var _0x5349c8=_['clone'](_0x2a2301);var _0xf0fad6=_0x43584a[_0x9408('0x73')];var _0x31ce6b=path['join'](config[_0x9408('0x74')],_0x9408('0x75'),_0xf0fad6+'.csv');hasTZ=_[_0x9408('0x51')](_0x2a2301)[_0x9408('0x76')](_0x9408('0x6a'));var _0x1b2579=_[_0x9408('0x51')](_0x2a2301)[_0x9408('0x16')]();logger[_0x9408('0x5c')]('header',_0x1b2579);db[_0x9408('0x77')][_0x9408('0x18')]({'raw':!![],'attributes':['id',_0x9408('0x78')]})['then'](function(_0x9c055f){for(var _0x7fac41=0x0;_0x7fac41<_0x9c055f[_0x9408('0x1b')];_0x7fac41++){if(_0x9c055f[_0x7fac41]['name']in _0x2a2301){contactItemTypes['push'](_0x9c055f[_0x7fac41]);delete _0x5349c8[_0x9c055f[_0x7fac41][_0x9408('0x78')]];hasAdditionalPhones=!![];}for(var _0x59b755 in _0x2a2301){if(_0x9c055f[_0x7fac41][_0x9408('0x78')]+_0x9408('0x79')===_0x59b755){phoneDescriptions[_0x9408('0x1c')]({'itemTypeId':_0x9c055f[_0x7fac41]['id'],'description':_0x59b755});delete _0x5349c8[_0x59b755];}}}if(hasAdditionalPhones)_0x5349c8[_0x9408('0x19')]='';var _0x4305c6=_['keys'](_0x5349c8)[_0x9408('0x16')]();logger[_0x9408('0x5c')](_0x9408('0x7a'),_0x4305c6);fs[_0x9408('0x7b')](_0x31ce6b,_0x4305c6+'\x0a');Papa['parse'](fs['createReadStream'](_0x88ffaf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4b7cb1,_0x3011da){try{for(var _0x939325=0x0,_0x42ea31=[];_0x939325<_0x4b7cb1['data'][_0x9408('0x1b')];_0x939325++){stats[_0x9408('0x7c')]+=0x1;if(_0x4b7cb1[_0x9408('0x5a')][_0x939325]){handleError(_0x4b7cb1['data'][_0x939325],_0x4b7cb1[_0x9408('0x5a')][_0x939325]);}else{var _0x587698=[];var _0x2905af=[];var _0x55d38d={};for(var _0x3edcab in _0x2a2301){let _0x359375=contactItemTypes['find'](_0x5a2915=>_0x5a2915[_0x9408('0x78')]===_0x3edcab);let _0x1f047e=contactItemTypes[_0x9408('0x7d')](_0x15abe0=>_0x15abe0[_0x9408('0x78')]+_0x9408('0x79')===_0x3edcab);if(_[_0x9408('0x1f')](_0x359375)&&_[_0x9408('0x1f')](_0x1f047e)){if(_0x2a2301[_0x9408('0x7e')](_0x3edcab)){if(_0x4b7cb1[_0x9408('0x7f')][_0x939325][_0x2a2301[_0x3edcab]]){var _0xc6bddd=_[_0x9408('0x80')](_0x4b7cb1[_0x9408('0x7f')][_0x939325][_0x2a2301[_0x3edcab]]['replace'](/"/g,'\x27'));switch(_0x3edcab){case _0x9408('0x2c'):var _0x5df015=moment(_0xc6bddd,_0x9408('0xd'),!![]);if(_0x5df015[_0x9408('0x81')]()){_0x42ea31[_0x9408('0x1c')]('\x22'+_0xc6bddd+'\x22');}else{_0x587698[_0x9408('0x1c')](_0x9408('0x82'));}break;case _0x9408('0x31'):var _0x2e2a12=parseInt(_0xc6bddd);_0xc6bddd=_[_0x9408('0x83')](_0x2e2a12)||_0x2e2a12<0x0||_0x2e2a12>0x4?_0x2b5198?0x3:0x2:_0x2e2a12;_0x42ea31[_0x9408('0x1c')]('\x22'+_0xc6bddd+'\x22');break;case _0x9408('0x44'):var _0x138862=parseInt(_0xc6bddd);if(_[_0x9408('0x84')](_0x138862)&&_[_0x9408('0x76')](_0x607f71,_0x138862)){_0x42ea31[_0x9408('0x1c')]('\x22'+_0x138862+'\x22');}else{_0x587698[_0x9408('0x1c')](_0x9408('0x85'));}break;case _0x9408('0x86'):if(isEmail(_0xc6bddd)){_0x42ea31[_0x9408('0x1c')]('\x22'+_0xc6bddd+'\x22');}else{_0x587698[_0x9408('0x1c')](_0x9408('0x87'));}break;case _0x9408('0x88'):var _0x218fa6=moment(_0xc6bddd,'YYYY-MM-DD',!![]);if(_0x218fa6[_0x9408('0x81')]()){_0x42ea31['push']('\x22'+_0xc6bddd+'\x22');}else{_0x587698['push'](_0x9408('0x89'));}break;case _0x9408('0x6a'):var _0x15c22c=shared[_0x9408('0x8a')];var _0x26f07c=_0x15c22c[_0xc6bddd];if(!_[_0x9408('0x1f')](_0x26f07c)){var _0x48b876=_0x26f07c[_0x9408('0x6b')];_0x42ea31[_0x9408('0x1c')]('\x22'+_0xc6bddd+'\x22');_0x42ea31[_0x9408('0x1c')]('\x22'+_0x48b876+'\x22');}break;default:_0x42ea31[_0x9408('0x1c')]('\x22'+_0xc6bddd+'\x22');}}else{switch(_0x3edcab){case _0x9408('0x8b'):case _0x9408('0x11'):_0x587698[_0x9408('0x1c')](_0x3edcab+_0x9408('0x8c'));break;default:_0x42ea31[_0x9408('0x1c')]('\x22\x22');}}}}else{var _0x365898='';if(!_['isNil'](_0x359375)){if(!_0x55d38d[_0x9408('0x7e')](_0x359375['id'])){if(!_[_0x9408('0x1f')](_0x4b7cb1[_0x9408('0x7f')][_0x939325][_0x2a2301[_0x3edcab]])){var _0xc6bddd=_[_0x9408('0x80')](_0x4b7cb1[_0x9408('0x7f')][_0x939325][_0x2a2301[_0x3edcab]]['replace'](/"/g,'\x27'));var _0x4cbb25=phoneDescriptions[_0x9408('0x7d')](_0x5b6826=>_0x5b6826['itemTypeId']===_0x359375['id']);if(!_[_0x9408('0x1f')](_0x4cbb25)){var _0x149edf=_[_0x9408('0x80')](_0x4b7cb1[_0x9408('0x7f')][_0x939325][_0x2a2301[_0x4cbb25[_0x9408('0x8d')]]][_0x9408('0x8e')](/"/g,'\x27'));if(!_[_0x9408('0x1f')](_0x149edf))_0xc6bddd=_0xc6bddd+'§'+_0x149edf;}if(_0x365898=='')_0x365898=_0xc6bddd;else _0x365898+='|'+_0xc6bddd;}_0x2905af[_0x9408('0x1c')](_0x359375['id']+':'+_0x365898);_0x55d38d[_0x359375['id']]=0x1;}}}}if(hasAdditionalPhones){_0x42ea31['push']('\x22'+_0x2905af[_0x9408('0x16')](';')+'\x22');}if(_0x587698[_0x9408('0x1b')]){handleError(_0x4b7cb1[_0x9408('0x7f')][_0x939325],{'code':'SystemRow','message':_0x587698['join']()});}else{fs[_0x9408('0x8f')](_0x31ce6b,_0x42ea31['join']()+'\x0a');}_0x42ea31=[];}if(!(stats[_0x9408('0x7c')]%0xc8)){socket[_0x9408('0x90')](_0x9408('0x91')+_0xf0fad6,stats);stats[_0x9408('0x5a')]=[];}}if(stopped){logger[_0x9408('0x5c')]('Abort\x20parser');_0x3011da[_0x9408('0x92')]();}}catch(_0x1f7dc1){handleError(_0x4b7cb1[_0x9408('0x7f')][_0x939325],{'code':_0x9408('0x93'),'message':_0x1f7dc1[_0x9408('0x59')]});logger[_0x9408('0x58')](_0x9408('0x94'),_0x1f7dc1[_0x9408('0x59')]);}},'complete':function(){try{var _0x185e26=[];var _0x1957c4=[];var _0x2411c2='cm_contacts';if(_0x43584a[_0x9408('0x95')]&&_0x43584a[_0x9408('0x95')]['length']){_0x2411c2='cm_contacts_'+_0xf0fad6;_0x185e26[_0x9408('0x1c')](_0x9408('0x96')+_0x2411c2+_0x9408('0x97'));}tmp_campaigns='campaigns_'+_0xf0fad6;tmp_voice_queues='voice_queues_'+_0xf0fad6;_0x1957c4[_0x9408('0x1c')](_0x9408('0x96')+tmp_campaigns+_0x9408('0x98'));_0x1957c4[_0x9408('0x1c')](_0x9408('0x96')+tmp_voice_queues+_0x9408('0x98'));BPromise[_0x9408('0x99')](_0x1957c4,handleTZQuery)['then'](function(_0xf3edb0){updateTzCampaigns(_0x43584a[_0x9408('0x2e')])[_0x9408('0x1a')](function(_0x1e1a09){updateTzVoiceQueues(_0x43584a[_0x9408('0x2e')])[_0x9408('0x1a')](function(_0x7abd0d){if(hasTZ)_0x4305c6=_0x4305c6[_0x9408('0x8e')](_0x9408('0x6a'),_0x9408('0x9a'));var _0x3d9f75=util['format'](_0x9408('0x9b'),_0x31ce6b,_0x2411c2,_0x4305c6,_0x43584a[_0x9408('0x2e')],_0x43584a['CompanyId']||null,NOW,NOW);if(_[_0x9408('0x1f')](_0x2a2301[_0x9408('0x2c')])){_0x3d9f75+=',\x20scheduledAt\x20=\x20NOW()';}_0x185e26[_0x9408('0x1c')](_0x3d9f75);if(_0x43584a['duplicates']&&_0x43584a[_0x9408('0x95')][_0x9408('0x1b')]){_0x185e26[_0x9408('0x1c')](insertCmContact(_0x43584a[_0x9408('0x2e')],_0x2411c2,_0x43584a[_0x9408('0x95')],_0x2a2301));_0x185e26[_0x9408('0x1c')](_0x9408('0x9c')+_0x2411c2+';');}BPromise[_0x9408('0x99')](_0x185e26,handleQuery)[_0x9408('0x1a')](function(_0x125f62){BPromise['all']([handleAdditionalPhones()])[_0x9408('0x1a')](function(){_0x185e26=[];for(var _0x169ab0=0x0;_0x169ab0_0x298a21[_0xb1e7('0x64')]===_0x19f732);let _0x125699=contactItemTypes[_0xb1e7('0x6c')](_0x13395f=>_0x13395f[_0xb1e7('0x64')]+_0xb1e7('0x65')===_0x19f732);if(_[_0xb1e7('0x1b')](_0x543652)&&_[_0xb1e7('0x1b')](_0x125699)){if(_0x352805[_0xb1e7('0x6d')](_0x19f732)){if(_0x47fb75[_0xb1e7('0x69')][_0x4a93e1][_0x352805[_0x19f732]]){var _0x2b5f66=_[_0xb1e7('0x6e')](_0x47fb75[_0xb1e7('0x69')][_0x4a93e1][_0x352805[_0x19f732]][_0xb1e7('0x6f')](/"/g,'\x27'));switch(_0x19f732){case _0xb1e7('0x70'):var _0x3f485e=moment(_0x2b5f66,_0xb1e7('0xd'),!![]);if(_0x3f485e[_0xb1e7('0x71')]()){_0x52e3f9[_0xb1e7('0x1e')]('\x22'+_0x2b5f66+'\x22');}else{_0x2e1ae5[_0xb1e7('0x1e')](_0xb1e7('0x72'));}break;case _0xb1e7('0x3a'):var _0x5b4a95=parseInt(_0x2b5f66);_0x2b5f66=_['isNaN'](_0x5b4a95)||_0x5b4a95<0x0||_0x5b4a95>0x4?_0xb182d4?0x3:0x2:_0x5b4a95;_0x52e3f9[_0xb1e7('0x1e')]('\x22'+_0x2b5f66+'\x22');break;case _0xb1e7('0x3b'):var _0x1c5594=parseInt(_0x2b5f66);if(_[_0xb1e7('0x73')](_0x1c5594)&&_[_0xb1e7('0x74')](_0x134297,_0x1c5594)){_0x52e3f9[_0xb1e7('0x1e')]('\x22'+_0x1c5594+'\x22');}else{_0x2e1ae5['push'](_0xb1e7('0x75'));}break;case _0xb1e7('0x76'):if(isEmail(_0x2b5f66)){_0x52e3f9[_0xb1e7('0x1e')]('\x22'+_0x2b5f66+'\x22');}else{_0x2e1ae5[_0xb1e7('0x1e')]('email\x20wrong\x20format');}break;case _0xb1e7('0x77'):var _0x311dc1=moment(_0x2b5f66,'YYYY-MM-DD',!![]);if(_0x311dc1[_0xb1e7('0x71')]()){_0x52e3f9[_0xb1e7('0x1e')]('\x22'+_0x2b5f66+'\x22');}else{_0x2e1ae5[_0xb1e7('0x1e')](_0xb1e7('0x78'));}break;default:_0x52e3f9[_0xb1e7('0x1e')]('\x22'+_0x2b5f66+'\x22');}}else{switch(_0x19f732){case'firstName':case _0xb1e7('0x1c'):_0x2e1ae5[_0xb1e7('0x1e')](_0x19f732+_0xb1e7('0x79'));break;default:_0x52e3f9[_0xb1e7('0x1e')]('\x22\x22');}}}}else{var _0x4f169e='';if(!_['isNil'](_0x543652)){if(!_0x21b9f6[_0xb1e7('0x6d')](_0x543652['id'])){for(var _0x2a8aa0=0x0;_0x2a8aa0<_0x352805[_0x19f732][_0xb1e7('0x1a')];_0x2a8aa0++){var _0x2b5f66=_[_0xb1e7('0x6e')](_0x47fb75[_0xb1e7('0x69')][_0x4a93e1][_0x352805[_0x19f732][_0x2a8aa0]][_0xb1e7('0x6f')](/"/g,'\x27'));var _0x136cb6=phoneDescriptions['find'](_0x33bce4=>_0x33bce4[_0xb1e7('0x7a')]===_0x543652['id']);if(!_[_0xb1e7('0x1b')](_0x136cb6)){var _0xa31872=_[_0xb1e7('0x6e')](_0x47fb75[_0xb1e7('0x69')][_0x4a93e1][_0x352805[_0x136cb6['description']][0x0]][_0xb1e7('0x6f')](/"/g,'\x27'));if(!_[_0xb1e7('0x1b')](_0xa31872))_0x2b5f66=_0x2b5f66+'§'+_0xa31872;}if(_0x4f169e=='')_0x4f169e=_0x2b5f66;else _0x4f169e+='|'+_0x2b5f66;}_0x659a8c[_0xb1e7('0x1e')](_0x543652['id']+':'+_0x4f169e);_0x21b9f6[_0x543652['id']]=0x1;}}}}if(hasAdditionalPhones){_0x52e3f9['push']('\x22'+_0x659a8c[_0xb1e7('0x13')](';')+'\x22');}if(_0x2e1ae5['length']){handleError(_0x47fb75['data'][_0x4a93e1],{'code':'SystemRow','message':_0x2e1ae5['join']()});}else{fs[_0xb1e7('0x7b')](_0x58dcd2,_0x52e3f9['join']()+'\x0a');}_0x52e3f9=[];}if(!(stats['rows']%0xc8)){socket[_0xb1e7('0x7c')](_0xb1e7('0x7d')+_0x5b0c10,stats);stats['errors']=[];}}if(stopped){logger[_0xb1e7('0x59')](_0xb1e7('0x7e'));_0x4440f5[_0xb1e7('0x7f')]();}}catch(_0x3564ae){handleError(_0x47fb75[_0xb1e7('0x69')][_0x4a93e1],{'code':'SystemError','message':_0x3564ae['message']});logger[_0xb1e7('0x22')](_0xb1e7('0x80'),_0x3564ae[_0xb1e7('0x23')]);}},'complete':function(){try{var _0x4895ad=[];var _0x29ca84=tempTableName;_0x4895ad[_0xb1e7('0x1e')](_0xb1e7('0x81')+_0x29ca84+_0xb1e7('0x82'));logger[_0xb1e7('0x59')](_0xb1e7('0x83'),contactItemTypes[_0xb1e7('0x1a')]);var _0xc9fe87=util[_0xb1e7('0xc')](_0xb1e7('0x84'),_0x58dcd2,_0x29ca84,_0x2eb9c1,_0x475dc5['ListId'],_0x475dc5[_0xb1e7('0x53')]||null,NOW,NOW);if(_[_0xb1e7('0x1b')](_0x352805[_0xb1e7('0x70')])){_0xc9fe87+=_0xb1e7('0x85');}_0x4895ad[_0xb1e7('0x1e')](_0xc9fe87);BPromise['each'](_0x4895ad,handleQuery)[_0xb1e7('0x20')](function(_0x3d201b){BPromise[_0xb1e7('0x1f')]([handleAdditionalPhones()])['then'](function(){_0x4895ad=[];for(var _0x3a3f50=0x0;_0x3a3f50\x20\x20');}var _0x474d6d=path[_0xb1e7('0x13')](config[_0xb1e7('0x8e')],_0xb1e7('0x61'),process[_0xb1e7('0x8d')][0x2]);if(!fs[_0xb1e7('0x8f')](_0x474d6d)){throw new Error(_0xb1e7('0x90'));}var _0x356d2d={};try{_0x356d2d=JSON[_0xb1e7('0x67')](process[_0xb1e7('0x8d')][0x3]);if(!_0x356d2d[_0xb1e7('0x5e')]){throw new Error(_0xb1e7('0x91'));}var _0x4b9d22=0x0;if(_0x356d2d['binding'][_0xb1e7('0x3b')]){_0x4b9d22=0x1;}if(!_0x356d2d[_0xb1e7('0x37')]){throw new Error(_0xb1e7('0x92'));}}catch(_0x3f00c5){throw new Error(_0xb1e7('0x93'));}var _0x13e7e9=[];try{_0x13e7e9=_[_0xb1e7('0x94')](JSON[_0xb1e7('0x67')](process[_0xb1e7('0x8d')][0x4]),'id');}catch(_0x4c8ced){logger[_0xb1e7('0x59')](_0xb1e7('0x95'));}main(_0x474d6d,_0x356d2d,_0x13e7e9,_0x4b9d22);}validate();process['on'](_0xb1e7('0x96'),handleStop);process['on'](_0xb1e7('0x97'),handleUncaughtException); \ No newline at end of file +var _0x3a15=['cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','errors','code','info','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','emit','Abort\x20parser','SystemError','step','\x20LIKE\x20cm_contacts;','format',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','orderBy','DROP\x20TABLE\x20','finish','contact:import:','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','papaparse','bluebird','moment','squel','../../../config/environment','defaults','localhost','socket.io-emitter','redis','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','all','then','catch','error','message','AdditionalPhones','split','filter','CmContactHasItem','findOne','update','updated','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','select','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.createdAt','createdAt','fields','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x3a15,0xde));var _0x53a1=function(_0x1393d4,_0x1264b3){_0x1393d4=_0x1393d4-0x0;var _0x5f58a2=_0x3a15[_0x1393d4];return _0x5f58a2;};'use strict';var fs=require('fs');var path=require(_0x53a1('0x0'));var _=require('lodash');var Papa=require(_0x53a1('0x1'));var util=require('util');var BPromise=require(_0x53a1('0x2'));var moment=require(_0x53a1('0x3'));var squel=require(_0x53a1('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x53a1('0x5'));var logger=require('../../../config/logger')('import');config['redis']=_[_0x53a1('0x6')](config['redis'],{'host':_0x53a1('0x7'),'port':0x18eb});var socket=require(_0x53a1('0x8'))(new Redis(config[_0x53a1('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()['format'](_0x53a1('0xa'));var tempTableName=_0x53a1('0xb')+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x526100){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))*$/[_0x53a1('0xc')](_0x526100);}function selectNotIn(_0x2db7a8,_0x1f7c1f,_0x2fc291,_0x5f51b0,_0x499f17){return squel['select']()[_0x53a1('0xd')](_0x53a1('0xe'))['from'](_0x5f51b0)[_0x53a1('0xf')](_0x1f7c1f,null,_0x1f7c1f+_0x53a1('0x10')+_0x5f51b0+'.'+_0x2fc291)[_0x53a1('0x11')](_0x5f51b0+'.'+_0x2fc291+'\x20=\x20'+_0x2db7a8+'.'+_0x2fc291)[_0x53a1('0x11')](_0x1f7c1f+_0x53a1('0x12')+_0x499f17[_0x53a1('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x36e275,_0x2dbca7){promisesAdditionalPhones=[];promisesContact=[];return db[_0x53a1('0x13')][_0x53a1('0x14')](_0x53a1('0x15')+tempTableName)[_0x53a1('0x16')](function(_0x552306){if(_0x552306!==null){var _0x367f3e=[];for(var _0xd7a6a4=0x0;_0xd7a6a4<_0x552306[_0x53a1('0x17')];_0xd7a6a4++){var _0x3dd7b3=_0x552306[_0xd7a6a4];if(!_[_0x53a1('0x18')](_0x3dd7b3[_0x53a1('0xe')])){if(!_[_0x53a1('0x18')](_0x3dd7b3['AdditionalPhones']))_0x367f3e[_0x53a1('0x19')](insertAdditionalPhones(_0x3dd7b3));promisesContact['push']({'contact':_0x3dd7b3});}}}Promise[_0x53a1('0x1a')](_0x367f3e)[_0x53a1('0x1b')](function(){_0x36e275({'val':0x1});});})[_0x53a1('0x1c')](function(_0x123e6c){logger[_0x53a1('0x1d')](_0x123e6c[_0x53a1('0x1e')]);});});}function insertAdditionalPhones(_0x5b6602){return new Promise(function(_0x16916f,_0x167671){var _0x4eb6bd=_0x5b6602[_0x53a1('0x1f')];if(_[_0x53a1('0x18')](_0x4eb6bd))_0x167671({'val':0x0});else{var _0x5553d9=_0x4eb6bd[_0x53a1('0x20')](';');var _0x11253c=[];orderBy=0x0;for(var _0x5173a3=0x0;_0x5173a3<_0x5553d9[_0x53a1('0x17')];_0x5173a3++){_0x11253c[_0x53a1('0x19')](splitAdditionalPhone(_0x5b6602['id'],_0x5553d9[_0x5173a3]));}Promise['all'](_0x11253c)[_0x53a1('0x1b')](function(){_0x16916f({'val':_0x5553d9[_0x53a1('0x17')]});});}});}function splitAdditionalPhone(_0x471e34,_0x26f84a){return new Promise(function(_0x4f81fd,_0x3fd2d6){var _0x428866=_0x26f84a[_0x53a1('0x20')](':');var _0x1027d4=_0x428866[0x0];var _0x3bf15c=_0x428866[0x1];if(_0x3bf15c!==''){var _0x30a0cc=_0x3bf15c['split']('|');var _0xc8a720=[];for(var _0xc86808=0x0;_0xc86808<_0x30a0cc[_0x53a1('0x17')];_0xc86808++){if(_0x30a0cc[_0xc86808]!==''){var _0x94b6bf=_[_0x53a1('0x21')](promisesAdditionalPhones,{'contactId':_0x471e34,'phone':_0x30a0cc[_0xc86808]});if(_0x94b6bf[_0x53a1('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x53a1('0x19')]({'contactId':_0x471e34,'contactTypeId':_0x1027d4,'phone':_0x30a0cc[_0xc86808],'orderBy':orderBy});}}}_0x4f81fd({'ok':0x1});}else _0x4f81fd({'res':0x0});});}function createAdditionalPhone(_0x477780,_0x322baf,_0x162bd1,_0x255768){var _0x15a530='';var _0x5cb95e='';var _0x61d58c=_0x162bd1[_0x53a1('0x20')]('§');_0x15a530=_0x61d58c[0x0];if(_0x61d58c[_0x53a1('0x17')]==0x2)_0x5cb95e=_0x61d58c[0x1];return new Promise(function(_0x300b4d,_0x442165){return db[_0x53a1('0x22')][_0x53a1('0x23')]({'where':{'CmContactId':_0x477780,'item':_0x15a530}})['then'](function(_0x5aba04){if(_0x5aba04){return db[_0x53a1('0x22')][_0x53a1('0x24')]({'ItemTypeId':_0x322baf,'description':_0x5cb95e,'OrderBy':_0x255768},{'where':{'CmContactId':_0x477780,'item':_0x15a530}})[_0x53a1('0x1b')](function(_0x4764fa){_0x300b4d({'res':_0x53a1('0x25')});});}else{return db[_0x53a1('0x22')]['create']({'CmContactId':_0x477780,'item':_0x15a530,'ItemTypeId':_0x322baf,'description':_0x5cb95e,'OrderBy':_0x255768,'ItemClass':'PHONE'})[_0x53a1('0x1b')](function(_0x37f834){_0x300b4d({'res':_0x53a1('0x26')});});}});});}function updateContact(_0x272952){return new Promise(function(_0x27c838,_0x321bee){var _0x4348a6=_0x272952['id'];delete _0x272952['id'];return db[_0x53a1('0x27')][_0x53a1('0x24')](_0x272952,{'where':{'id':_0x4348a6}})['then'](function(_0x4f1a3d){updatedRows+=0x1;return db[_0x53a1('0x28')][_0x53a1('0x24')]({'phone':_0x272952[_0x53a1('0xe')]},{'where':{'ContactId':_0x4348a6}})['then'](function(_0x296197){_0x27c838({'ret':'OK'});});});});}function insertCmHopper(_0x50525f,_0x1335a5,_0x1251bd,_0x1d9496,_0x33cbec){var _0x4c3bb8=[_0x53a1('0x29'),_0x53a1('0x2a'),_0x53a1('0x2b'),_0x53a1('0x2c'),_0x1335a5+'.'+_0x1d9496,'cm_contacts.createdAt',_0x53a1('0x2d'),'cm_contacts.priority',_0x53a1('0x2e'),'\x22'+_0x33cbec+'\x22'];return squel[_0x53a1('0x2f')]()[_0x53a1('0x30')](_0x53a1('0x31'))[_0x53a1('0x32')]([_0x53a1('0xe'),_0x53a1('0x33'),_0x53a1('0x34'),_0x53a1('0x35'),_0x1d9496,'createdAt',_0x53a1('0x36'),_0x53a1('0x37'),_0x53a1('0x38'),_0x53a1('0x39')],squel[_0x53a1('0x3a')]()['fields'](_0x4c3bb8)[_0x53a1('0x3b')](_0x1335a5)[_0x53a1('0xf')](_0x53a1('0x3c'),null,_0x53a1('0x3d')+_0x1335a5+_0x53a1('0x3e'))['join'](_0x1251bd,null,_0x1251bd+'.id\x20=\x20'+_0x1335a5+'.'+_0x1d9496)[_0x53a1('0x11')](_0x1335a5+_0x53a1('0x3f'),_0x50525f)[_0x53a1('0x11')](_0x53a1('0x40'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1335a5,_0x1251bd,_0x1d9496,'cm_hopper',[_0x53a1('0x41'),_0x53a1('0x42')]))[_0x53a1('0x11')](_0x53a1('0x43'),selectNotIn(_0x1335a5,_0x1251bd,_0x1d9496,'cm_hopper',[_0x53a1('0x41')])))['toString']();}function insertCmHopperBlack(_0x5c5c15,_0x21f531,_0x4baec9,_0x2e8242){var _0x2b12a4=['cm_contacts.phone',_0x53a1('0x2b'),'cm_contacts.ListId',_0x21f531+'.'+_0x2e8242,_0x53a1('0x44'),'cm_contacts.updatedAt'];return squel[_0x53a1('0x2f')]()['into']('cm_hopper_black')[_0x53a1('0x32')](['phone','ContactId',_0x53a1('0x35'),_0x2e8242,_0x53a1('0x45'),_0x53a1('0x36')],squel['select']()[_0x53a1('0x46')](_0x2b12a4)[_0x53a1('0x3b')](_0x21f531)[_0x53a1('0xf')](_0x53a1('0x3c'),null,_0x53a1('0x3d')+_0x21f531+'.CmListId')[_0x53a1('0xf')](_0x4baec9,null,_0x4baec9+_0x53a1('0x10')+_0x21f531+'.'+_0x2e8242)['where'](_0x21f531+_0x53a1('0x3f'),_0x5c5c15)[_0x53a1('0x11')](_0x53a1('0x40'),NOW)[_0x53a1('0x11')](_0x53a1('0x43'),squel['select']()[_0x53a1('0xd')](_0x53a1('0xe'))['from']('cm_hopper_black')[_0x53a1('0x11')](_0x53a1('0x47'),_0x5c5c15)[_0x53a1('0x11')](_0x2e8242+_0x53a1('0x48'),_0x21f531+'.'+_0x2e8242)))[_0x53a1('0x49')]();}function insertCmHopperAdditionalPhones(_0x34900d){var _0x1b8d85=[_0x53a1('0x4a'),_0x53a1('0x4b'),_0x53a1('0x4c'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x53a1('0x2f')]()['into'](_0x53a1('0x4d'))[_0x53a1('0x32')]([_0x53a1('0x4e'),'phone',_0x53a1('0x4f'),_0x53a1('0x45'),_0x53a1('0x36')],squel[_0x53a1('0x3a')]()[_0x53a1('0x46')](_0x1b8d85)['from'](_0x53a1('0x31'))[_0x53a1('0xf')](_0x53a1('0x3c'),null,_0x53a1('0x50'))[_0x53a1('0xf')](_0x53a1('0x51'),null,_0x53a1('0x52'))[_0x53a1('0x11')]('cm_hopper.ListId\x20=\x20?',_0x34900d)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x53a1('0x49')]();}function insertCmContact(_0x3d7a69,_0x1ecda2,_0x295e84,_0x54bf57){var _0x39f4d6=_['concat'](_[_0x53a1('0x53')](_0x54bf57),[_0x53a1('0x35'),_0x53a1('0x54'),_0x53a1('0x45'),'updatedAt']);return squel['insert']()[_0x53a1('0x30')](_0x53a1('0x3c'))[_0x53a1('0x32')](_0x39f4d6,squel[_0x53a1('0x3a')]()['fields'](_0x39f4d6)[_0x53a1('0x3b')](_0x1ecda2)[_0x53a1('0x11')]('('+_0x295e84['join'](',')+_0x53a1('0x55'),squel[_0x53a1('0x3a')]()[_0x53a1('0x46')](_0x295e84)[_0x53a1('0x3b')](_0x53a1('0x3c'))['where'](_0x53a1('0x47'),_0x3d7a69))[_0x53a1('0x11')](_0x53a1('0x56'),squel[_0x53a1('0x3a')]()[_0x53a1('0xd')]('MIN(id)',_0x53a1('0x57'))[_0x53a1('0x3b')](_0x1ecda2)[_0x53a1('0x58')](_0x295e84[_0x53a1('0xf')](','))))[_0x53a1('0x49')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1a23ce){logger[_0x53a1('0x1d')](_0x1a23ce[_0x53a1('0x1e')]);process['exit'](0x1);}function handleError(_0x30d328,_0x3a9bf2){stats[_0x53a1('0x59')]['push']({'name':_0x3a9bf2[_0x53a1('0x5a')],'message':_0x3a9bf2[_0x53a1('0x1e')],'row':_0x30d328});}function handleQuery(_0x193d33){logger[_0x53a1('0x5b')](_0x193d33);return db[_0x53a1('0x13')][_0x53a1('0x14')](_0x193d33)[_0x53a1('0x16')](function(_0xa51eb0){results['push'](_0xa51eb0);})['catch'](function(_0x12cee7){logger[_0x53a1('0x1d')](_0x12cee7[_0x53a1('0x1e')]);});}function main(_0x1fa942,_0xbd71a9,_0x57c9d1,_0x3bcaa4){logger['info'](_0x53a1('0x5c'),_0x1fa942,JSON[_0x53a1('0x5d')](_0xbd71a9));process[_0x53a1('0x5e')](_0x53a1('0x5f'));var _0x40850b=_0xbd71a9[_0x53a1('0x60')];var _0x538ffd=_[_0x53a1('0x61')](_0x40850b);var _0x3575b1=_0xbd71a9[_0x53a1('0x62')];var _0x43f571=path['join'](config[_0x53a1('0x63')],_0x53a1('0x64'),_0x3575b1+'.csv');logger['info']('body',_0xbd71a9);db[_0x53a1('0x65')][_0x53a1('0x66')]({'raw':!![],'attributes':['id','name']})[_0x53a1('0x1b')](function(_0x1e0767){for(var _0x32d71a=0x0;_0x32d71a<_0x1e0767[_0x53a1('0x17')];_0x32d71a++){if(_0x1e0767[_0x32d71a][_0x53a1('0x67')]in _0x40850b){contactItemTypes['push'](_0x1e0767[_0x32d71a]);delete _0x538ffd[_0x1e0767[_0x32d71a][_0x53a1('0x67')]];hasAdditionalPhones=!![];}for(var _0x14ac99 in _0x40850b){if(_0x1e0767[_0x32d71a][_0x53a1('0x67')]+_0x53a1('0x68')===_0x14ac99){phoneDescriptions['push']({'itemTypeId':_0x1e0767[_0x32d71a]['id'],'description':_0x14ac99});delete _0x538ffd[_0x14ac99];}}}if(hasAdditionalPhones)_0x538ffd[_0x53a1('0x1f')]='';var _0x530834=_[_0x53a1('0x53')](_0x538ffd)[_0x53a1('0xf')]();logger[_0x53a1('0x5b')](_0x53a1('0x69'),_0x530834);fs[_0x53a1('0x6a')](_0x43f571,_0x530834+'\x0a');Papa[_0x53a1('0x6b')](fs[_0x53a1('0x6c')](_0x1fa942),{'header':!![],'skipEmptyLines':!![],'step':function(_0x213039,_0x5735ea){try{for(var _0x221bbe=0x0,_0x43af71=[];_0x221bbe<_0x213039[_0x53a1('0x6d')][_0x53a1('0x17')];_0x221bbe++){stats[_0x53a1('0x6e')]+=0x1;if(_0x213039[_0x53a1('0x59')][_0x221bbe]){handleError(_0x213039[_0x53a1('0x6d')][_0x221bbe],_0x213039['errors'][_0x221bbe]);}else{var _0x53810c=[];var _0x70a48=[];var _0x14f5b6={};for(var _0x5db8de in _0x40850b){let _0x143524=contactItemTypes[_0x53a1('0x6f')](_0x1d609e=>_0x1d609e[_0x53a1('0x67')]===_0x5db8de);let _0x1ffc9c=contactItemTypes[_0x53a1('0x6f')](_0x215161=>_0x215161[_0x53a1('0x67')]+_0x53a1('0x68')===_0x5db8de);if(_[_0x53a1('0x18')](_0x143524)&&_[_0x53a1('0x18')](_0x1ffc9c)){if(_0x40850b[_0x53a1('0x70')](_0x5db8de)){if(_0x213039['data'][_0x221bbe][_0x40850b[_0x5db8de]]){var _0xb8eefb=_[_0x53a1('0x71')](_0x213039[_0x53a1('0x6d')][_0x221bbe][_0x40850b[_0x5db8de]][_0x53a1('0x72')](/"/g,'\x27'));switch(_0x5db8de){case _0x53a1('0x33'):var _0x5ca204=moment(_0xb8eefb,_0x53a1('0xa'),!![]);if(_0x5ca204[_0x53a1('0x73')]()){_0x43af71[_0x53a1('0x19')]('\x22'+_0xb8eefb+'\x22');}else{_0x53810c[_0x53a1('0x19')](_0x53a1('0x74'));}break;case _0x53a1('0x37'):var _0x4c30ae=parseInt(_0xb8eefb);_0xb8eefb=_[_0x53a1('0x75')](_0x4c30ae)||_0x4c30ae<0x0||_0x4c30ae>0x4?_0x3bcaa4?0x3:0x2:_0x4c30ae;_0x43af71[_0x53a1('0x19')]('\x22'+_0xb8eefb+'\x22');break;case _0x53a1('0x38'):var _0x48181b=parseInt(_0xb8eefb);if(_[_0x53a1('0x76')](_0x48181b)&&_[_0x53a1('0x77')](_0x57c9d1,_0x48181b)){_0x43af71['push']('\x22'+_0x48181b+'\x22');}else{_0x53810c[_0x53a1('0x19')]('agent\x20not\x20exists');}break;case _0x53a1('0x78'):if(isEmail(_0xb8eefb)){_0x43af71[_0x53a1('0x19')]('\x22'+_0xb8eefb+'\x22');}else{_0x53810c[_0x53a1('0x19')](_0x53a1('0x79'));}break;case'dateOfBirth':var _0x58f719=moment(_0xb8eefb,_0x53a1('0x7a'),!![]);if(_0x58f719[_0x53a1('0x73')]()){_0x43af71[_0x53a1('0x19')]('\x22'+_0xb8eefb+'\x22');}else{_0x53810c[_0x53a1('0x19')](_0x53a1('0x7b'));}break;default:_0x43af71[_0x53a1('0x19')]('\x22'+_0xb8eefb+'\x22');}}else{switch(_0x5db8de){case'firstName':case'phone':_0x53810c['push'](_0x5db8de+_0x53a1('0x7c'));break;default:_0x43af71['push']('\x22\x22');}}}}else{var _0x5ead36='';if(!_[_0x53a1('0x18')](_0x143524)){if(!_0x14f5b6[_0x53a1('0x70')](_0x143524['id'])){for(var _0x278a26=0x0;_0x278a26<_0x40850b[_0x5db8de][_0x53a1('0x17')];_0x278a26++){var _0xb8eefb=_[_0x53a1('0x71')](_0x213039[_0x53a1('0x6d')][_0x221bbe][_0x40850b[_0x5db8de][_0x278a26]][_0x53a1('0x72')](/"/g,'\x27'));var _0x2eb319=phoneDescriptions[_0x53a1('0x6f')](_0x43c8b8=>_0x43c8b8['itemTypeId']===_0x143524['id']);if(!_['isNil'](_0x2eb319)){var _0x38ddaf=_['trim'](_0x213039[_0x53a1('0x6d')][_0x221bbe][_0x40850b[_0x2eb319['description']][0x0]][_0x53a1('0x72')](/"/g,'\x27'));if(!_[_0x53a1('0x18')](_0x38ddaf))_0xb8eefb=_0xb8eefb+'§'+_0x38ddaf;}if(_0x5ead36=='')_0x5ead36=_0xb8eefb;else _0x5ead36+='|'+_0xb8eefb;}_0x70a48[_0x53a1('0x19')](_0x143524['id']+':'+_0x5ead36);_0x14f5b6[_0x143524['id']]=0x1;}}}}if(hasAdditionalPhones){_0x43af71[_0x53a1('0x19')]('\x22'+_0x70a48[_0x53a1('0xf')](';')+'\x22');}if(_0x53810c['length']){handleError(_0x213039['data'][_0x221bbe],{'code':_0x53a1('0x7d'),'message':_0x53810c[_0x53a1('0xf')]()});}else{fs['appendFileSync'](_0x43f571,_0x43af71['join']()+'\x0a');}_0x43af71=[];}if(!(stats[_0x53a1('0x6e')]%0xc8)){socket[_0x53a1('0x7e')]('contact:import:'+_0x3575b1,stats);stats[_0x53a1('0x59')]=[];}}if(stopped){logger[_0x53a1('0x5b')](_0x53a1('0x7f'));_0x5735ea['abort']();}}catch(_0x1b07fe){handleError(_0x213039['data'][_0x221bbe],{'code':_0x53a1('0x80'),'message':_0x1b07fe[_0x53a1('0x1e')]});logger[_0x53a1('0x1d')](_0x53a1('0x81'),_0x1b07fe['message']);}},'complete':function(){try{var _0x18e151=[];var _0x49b20a=tempTableName;_0x18e151[_0x53a1('0x19')]('CREATE\x20TABLE\x20'+_0x49b20a+_0x53a1('0x82'));logger[_0x53a1('0x5b')]('CIS\x20len',contactItemTypes[_0x53a1('0x17')]);var _0x2acc3c=util[_0x53a1('0x83')]('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',_0x43f571,_0x49b20a,_0x530834,_0xbd71a9[_0x53a1('0x35')],_0xbd71a9['CompanyId']||null,NOW,NOW);if(_[_0x53a1('0x18')](_0x40850b[_0x53a1('0x33')])){_0x2acc3c+=_0x53a1('0x84');}_0x18e151[_0x53a1('0x19')](_0x2acc3c);BPromise[_0x53a1('0x85')](_0x18e151,handleQuery)[_0x53a1('0x1b')](function(_0xba5c14){BPromise[_0x53a1('0x1a')]([handleAdditionalPhones()])[_0x53a1('0x1b')](function(){_0x18e151=[];for(var _0x2a65eb=0x0;_0x2a65eb\x20\x20');}var _0x5ef084=path[_0x53a1('0xf')](config[_0x53a1('0x63')],'server/files/tmp',process[_0x53a1('0x8f')][0x2]);if(!fs[_0x53a1('0x90')](_0x5ef084)){throw new Error(_0x53a1('0x91'));}var _0x458f87={};try{_0x458f87=JSON[_0x53a1('0x6b')](process[_0x53a1('0x8f')][0x3]);if(!_0x458f87[_0x53a1('0x60')]){throw new Error(_0x53a1('0x92'));}var _0x10d871=0x0;if(_0x458f87[_0x53a1('0x60')]['UserId']){_0x10d871=0x1;}if(!_0x458f87[_0x53a1('0x35')]){throw new Error(_0x53a1('0x93'));}}catch(_0xf0e99a){throw new Error(_0x53a1('0x94'));}var _0x44e7fe=[];try{_0x44e7fe=_['map'](JSON[_0x53a1('0x6b')](process[_0x53a1('0x8f')][0x4]),'id');}catch(_0x62df0f){logger['info']('No\x20agent\x20available');}main(_0x5ef084,_0x458f87,_0x44e7fe,_0x10d871);}validate();process['on'](_0x53a1('0x95'),handleStop);process['on'](_0x53a1('0x96'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 91122f6..e95388d 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb275=['destexten','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','outbound','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','voice','inbound','variable','queue','push','Outbound\x20Call','destcalleridnum','Caller\x20Number','calleridnum','keyValue','Caller\x20Name','Call\x20To'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb275,0xa1));var _0x5b27=function(_0x57a366,_0x212874){_0x57a366=_0x57a366-0x0;var _0xc0fbc5=_0xb275[_0x57a366];return _0xc0fbc5;};'use strict';exports[_0x5b27('0x0')]=function(_0x1c0857,_0x1226ac){var _0x80abe6=[{'type':_0x5b27('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x1c0857[_0x5b27('0x2')]()){case _0x5b27('0x3'):switch(_0x1226ac[_0x5b27('0x2')]()){case _0x5b27('0x4'):_0x80abe6['push']({'type':_0x5b27('0x5'),'content':'','variableName':_0x5b27('0x6')});_0x80abe6['push']({'type':_0x5b27('0x5'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x80abe6[_0x5b27('0x7')]({'type':_0x5b27('0x1'),'content':_0x5b27('0x8'),'variableName':null});_0x80abe6[_0x5b27('0x7')]({'type':_0x5b27('0x5'),'content':'','variableName':_0x5b27('0x9')});break;}}return _0x80abe6;};exports['getDescriptions']=function(_0x1e0350,_0x3c4a63){var _0x2d206f=[];switch(_0x1e0350[_0x5b27('0x2')]()){case _0x5b27('0x3'):switch(_0x3c4a63[_0x5b27('0x2')]()){case _0x5b27('0x4'):_0x2d206f=[{'type':_0x5b27('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x5b27('0xa'),'keyType':_0x5b27('0x5'),'variableName':_0x5b27('0xb')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0xd'),'keyType':_0x5b27('0x5'),'variableName':'calleridname'},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0xe'),'keyType':'variable','variableName':_0x5b27('0xf')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x10'),'keyType':_0x5b27('0x5'),'variableName':_0x5b27('0x6')},{'type':_0x5b27('0xc'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0x5b27('0x11')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x12'),'keyType':_0x5b27('0x5'),'variableName':_0x5b27('0x13')},{'type':_0x5b27('0x1'),'content':_0x5b27('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x15'),'keyType':_0x5b27('0x5'),'variableName':_0x5b27('0x16')},{'type':_0x5b27('0xc'),'content':'','key':'Agent\x20Number','keyType':_0x5b27('0x5'),'variableName':_0x5b27('0x9')},{'type':_0x5b27('0x1'),'content':_0x5b27('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x5b27('0x18'),'keyType':_0x5b27('0x5'),'variableName':_0x5b27('0x13')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x19'),'keyType':_0x5b27('0x5'),'variableName':_0x5b27('0x1a')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x1b'),'keyType':_0x5b27('0x5'),'variableName':_0x5b27('0x1c')},{'type':'keyValue','content':'','key':_0x5b27('0x1d'),'keyType':'variable','variableName':_0x5b27('0x1e')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x1f'),'keyType':'variable','variableName':'talktime'}];break;case _0x5b27('0x20'):_0x2d206f=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x21'),'keyType':_0x5b27('0x5'),'keyContent':'','variableName':_0x5b27('0x9')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x22'),'keyType':'variable','keyContent':'','variableName':_0x5b27('0x23')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x24'),'keyType':_0x5b27('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x5b27('0xc'),'content':'','key':'Date','keyType':_0x5b27('0x5'),'keyContent':'','variableName':_0x5b27('0x25')},{'type':_0x5b27('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0x5b27('0x26'),'keyType':_0x5b27('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0x5b27('0xc'),'content':'','key':'Complete\x20Time','keyType':_0x5b27('0x5'),'keyContent':'','variableName':_0x5b27('0x27')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x28'),'keyType':_0x5b27('0x5'),'keyContent':'','variableName':_0x5b27('0x29')},{'type':_0x5b27('0xc'),'content':'','key':_0x5b27('0x2a'),'keyType':_0x5b27('0x5'),'keyContent':'','variableName':_0x5b27('0x2b')}];break;}}return _0x2d206f;}; \ No newline at end of file +var _0x579d=['destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','outbound','Called\x20Number','Member\x20Name','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','Call\x20To'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x579d,0x173));var _0xd579=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x579d[_0x27af45];return _0x18df21;};'use strict';exports['getSubjects']=function(_0x58eb02,_0x1c1983){var _0x29d88e=[{'type':_0xd579('0x0'),'content':_0xd579('0x1'),'variableName':null}];switch(_0x58eb02[_0xd579('0x2')]()){case _0xd579('0x3'):switch(_0x1c1983['toLowerCase']()){case _0xd579('0x4'):_0x29d88e[_0xd579('0x5')]({'type':_0xd579('0x6'),'content':'','variableName':_0xd579('0x7')});_0x29d88e[_0xd579('0x5')]({'type':_0xd579('0x6'),'content':'','variableName':_0xd579('0x8')});break;case'outbound':_0x29d88e['push']({'type':_0xd579('0x0'),'content':'Outbound\x20Call','variableName':null});_0x29d88e[_0xd579('0x5')]({'type':_0xd579('0x6'),'content':'','variableName':_0xd579('0x9')});break;}}return _0x29d88e;};exports[_0xd579('0xa')]=function(_0x485376,_0x8a23f4){var _0x4a07d4=[];switch(_0x485376[_0xd579('0x2')]()){case _0xd579('0x3'):switch(_0x8a23f4['toLowerCase']()){case'inbound':_0x4a07d4=[{'type':_0xd579('0x0'),'content':_0xd579('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0xd579('0x6'),'variableName':'calleridnum'},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0xd'),'keyType':_0xd579('0x6'),'variableName':_0xd579('0xe')},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0xf'),'keyType':_0xd579('0x6'),'variableName':_0xd579('0x10')},{'type':'keyValue','content':'','key':_0xd579('0x11'),'keyType':_0xd579('0x6'),'variableName':'queue'},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x12'),'keyType':'variable','variableName':_0xd579('0x13')},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x14'),'keyType':_0xd579('0x6'),'variableName':_0xd579('0x15')},{'type':_0xd579('0x0'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0xd579('0x16')},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x17'),'keyType':_0xd579('0x6'),'variableName':_0xd579('0x9')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xd579('0x18'),'keyType':_0xd579('0x6'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0xd579('0x19'),'keyType':'variable','variableName':_0xd579('0x1a')},{'type':_0xd579('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0xd579('0x6'),'variableName':_0xd579('0x1b')},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x1c'),'keyType':_0xd579('0x6'),'variableName':'holdtime'},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x1d'),'keyType':'variable','variableName':_0xd579('0x1e')}];break;case _0xd579('0x1f'):_0x4a07d4=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':_0xd579('0x20'),'keyType':_0xd579('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x21'),'keyType':_0xd579('0x6'),'keyContent':'','variableName':_0xd579('0x22')},{'type':_0xd579('0xc'),'content':'','key':'UniqueId','keyType':_0xd579('0x6'),'keyContent':'','variableName':_0xd579('0x13')},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x14'),'keyType':_0xd579('0x6'),'keyContent':'','variableName':_0xd579('0x23')},{'type':_0xd579('0x0'),'content':_0xd579('0x24')},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x25'),'keyType':_0xd579('0x6'),'keyContent':'','variableName':_0xd579('0x26')},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x27'),'keyType':_0xd579('0x6'),'keyContent':'','variableName':_0xd579('0x28')},{'type':_0xd579('0xc'),'content':'','key':_0xd579('0x29'),'keyType':_0xd579('0x6'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0xd579('0x2a'),'keyType':_0xd579('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x4a07d4;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index f8ac537..9c38eb7 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9390=['omit','html','phone','fax','mobile','lodash','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseQueryParameters','where','body','contact','default','fields','filter','user','read','tags','checkAccountsRestrictions','group','i.id','tag','countFilteredInteractions','count','length','clause','order','forEach','contactName','closed','getClosedOrderClause','DESC','getFilteredInteractions','rows','catch','tracked'];(function(_0x5bdabb,_0x1b20f2){var _0x252348=function(_0x5175d0){while(--_0x5175d0){_0x5bdabb['push'](_0x5bdabb['shift']());}};_0x252348(++_0x1b20f2);}(_0x9390,0x195));var _0x0939=function(_0xa4e3c9,_0x389612){_0xa4e3c9=_0xa4e3c9-0x0;var _0x5b2725=_0x9390[_0xa4e3c9];return _0x5b2725;};'use strict';var _=require(_0x0939('0x0'));var sqlUtils=require('./sql-utils');var utils=require('./utils');exports[_0x0939('0x1')]=function(_0xa223b7,_0x41f55a,_0x84b90a,_0x6ad0db,_0x7e3299){var _0x985edf={'count':0x0,'rows':[]};var _0x5cb8bd=sqlUtils[_0x0939('0x2')](_0xa223b7,_0x84b90a,_0x41f55a);if(_0x5cb8bd){return Promise[_0x0939('0x3')](_0x985edf);}var _0x2718b3=sqlUtils[_0x0939('0x4')](_0xa223b7);var _0x496dc0={};return Promise[_0x0939('0x3')]()[_0x0939('0x5')](function(){if(_0x41f55a[_0x0939('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x41f55a[_0x0939('0x6')],_0x7e3299);}else{return sqlUtils[_0x0939('0x7')](_0xa223b7,_0x41f55a,_0x7e3299);}})[_0x0939('0x5')](function(_0x5511b1){_0x2718b3[_0x0939('0x8')](_0x5511b1[_0x0939('0x9')]);_0x2718b3[_0x0939('0x8')](_0x5511b1[_0x0939('0xa')]);_0x2718b3['where'](_0x5511b1[_0x0939('0xb')]);_0x2718b3[_0x0939('0x8')](_0x5511b1[_0x0939('0xc')]);_0x2718b3[_0x0939('0x8')](_0x5511b1[_0x0939('0xd')]);_0x2718b3[_0x0939('0x8')](_0x5511b1[_0x0939('0xe')]);_0x2718b3['having'](_0x5511b1[_0x0939('0xf')]);_0x496dc0=_0x5511b1[_0x0939('0x10')];return sqlUtils[_0x0939('0x11')](_0xa223b7,_0x84b90a,_0x41f55a);})[_0x0939('0x5')](function(_0x48e506){_0x2718b3['where'](_0x48e506);_0x2718b3[_0x0939('0x12')](_0x0939('0x13'));var _0x6f2593=_0x41f55a[_0x0939('0x6')]?_0x496dc0['ids']:_0x41f55a[_0x0939('0x14')];return sqlUtils[_0x0939('0x15')](_0x2718b3,_0x6f2593);})[_0x0939('0x5')](function(_0x500497){_0x985edf[_0x0939('0x16')]=_0x500497[_0x0939('0x17')];if(_0x985edf[_0x0939('0x16')]===0x0){return[];}_0x2718b3['having'](_0x496dc0[_0x0939('0x18')]);if(_0x6ad0db[_0x0939('0x19')]){_0x6ad0db[_0x0939('0x19')][_0x0939('0x1a')](function(_0x581968){var _0x25af92=_0x581968[0x0]===_0x0939('0x1b')?_0x581968[0x0]:'i.'+_0x581968[0x0];_0x2718b3[_0x0939('0x19')](_0x25af92,_0x581968[0x1]==='DESC'?![]:!![]);if(_0x581968[0x0]===_0x0939('0x1c')){var _0xc7f5ad=sqlUtils[_0x0939('0x1d')](_0xa223b7,_0x41f55a);_0x2718b3['order'](_0xc7f5ad,_0x581968[0x1]===_0x0939('0x1e')?![]:!![]);}});}return sqlUtils[_0x0939('0x1f')](_0xa223b7,_0x2718b3,_0x41f55a,_0x6ad0db);})[_0x0939('0x5')](function(_0x908fe9){_0x985edf[_0x0939('0x20')]=_0x908fe9;return _0x985edf;})[_0x0939('0x21')](function(_0x32f14d){throw _0x32f14d;});};exports[_0x0939('0x22')]=function(_0x67e040,_0x339279){return function(_0x5ccba6,_0x5a6316,_0x1ac25f){var _0x34ce78=_0x5ccba6[_0x0939('0xe')];var _0x216ce8={};var _0x240abc=_0x5ccba6['query'];if(_0x216ce8){_0x216ce8=_['clone'](_0x5ccba6[_0x0939('0x9')]);_0x216ce8=_[_0x0939('0x23')](_0x216ce8,[_0x0939('0x9'),_0x0939('0x24'),_0x0939('0x25'),_0x0939('0x26'),_0x0939('0x27')]);}utils['updateUser'](_0x34ce78,_0x216ce8,_0x240abc,_0x67e040,_0x339279);_0x1ac25f(null);};}; \ No newline at end of file +var _0x8a8d=['resolve','getInteractionsQuery','then','search','parseQueryParameters','where','body','contact','default','fields','filter','user','read','tags','checkAccountsRestrictions','group','i.id','count','length','clause','order','contactName','DESC','closed','getFilteredInteractions','tracked','query','clone','omit','html','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery'];(function(_0x3766d5,_0x27c59d){var _0x40c5e9=function(_0x28f16f){while(--_0x28f16f){_0x3766d5['push'](_0x3766d5['shift']());}};_0x40c5e9(++_0x27c59d);}(_0x8a8d,0x187));var _0xd8a8=function(_0x4eee48,_0x2a6260){_0x4eee48=_0x4eee48-0x0;var _0xc5a62b=_0x8a8d[_0x4eee48];return _0xc5a62b;};'use strict';var _=require(_0xd8a8('0x0'));var sqlUtils=require(_0xd8a8('0x1'));var utils=require(_0xd8a8('0x2'));exports[_0xd8a8('0x3')]=function(_0x183dd1,_0x18a78d,_0x5bbbb0,_0x40b32a,_0x267cfd){var _0x2b06ff={'count':0x0,'rows':[]};var _0x12b9f1=sqlUtils[_0xd8a8('0x4')](_0x183dd1,_0x5bbbb0,_0x18a78d);if(_0x12b9f1){return Promise[_0xd8a8('0x5')](_0x2b06ff);}var _0x5426ac=sqlUtils[_0xd8a8('0x6')](_0x183dd1);var _0x45242a={};return Promise[_0xd8a8('0x5')]()[_0xd8a8('0x7')](function(){if(_0x18a78d[_0xd8a8('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x18a78d[_0xd8a8('0x8')],_0x267cfd);}else{return sqlUtils[_0xd8a8('0x9')](_0x183dd1,_0x18a78d,_0x267cfd);}})['then'](function(_0x12c249){_0x5426ac[_0xd8a8('0xa')](_0x12c249[_0xd8a8('0xb')]);_0x5426ac[_0xd8a8('0xa')](_0x12c249[_0xd8a8('0xc')]);_0x5426ac[_0xd8a8('0xa')](_0x12c249[_0xd8a8('0xd')]);_0x5426ac[_0xd8a8('0xa')](_0x12c249[_0xd8a8('0xe')]);_0x5426ac[_0xd8a8('0xa')](_0x12c249[_0xd8a8('0xf')]);_0x5426ac[_0xd8a8('0xa')](_0x12c249[_0xd8a8('0x10')]);_0x5426ac['having'](_0x12c249[_0xd8a8('0x11')]);_0x45242a=_0x12c249[_0xd8a8('0x12')];return sqlUtils[_0xd8a8('0x13')](_0x183dd1,_0x5bbbb0,_0x18a78d);})[_0xd8a8('0x7')](function(_0x2b39f9){_0x5426ac[_0xd8a8('0xa')](_0x2b39f9);_0x5426ac[_0xd8a8('0x14')](_0xd8a8('0x15'));var _0x4b28b2=_0x18a78d[_0xd8a8('0x8')]?_0x45242a['ids']:_0x18a78d['tag'];return sqlUtils['countFilteredInteractions'](_0x5426ac,_0x4b28b2);})[_0xd8a8('0x7')](function(_0x25a5ec){_0x2b06ff[_0xd8a8('0x16')]=_0x25a5ec[_0xd8a8('0x17')];if(_0x2b06ff['count']===0x0){return[];}_0x5426ac['having'](_0x45242a[_0xd8a8('0x18')]);if(_0x40b32a[_0xd8a8('0x19')]){_0x40b32a['order']['forEach'](function(_0x21337d){var _0x4f1435=_0x21337d[0x0]===_0xd8a8('0x1a')?_0x21337d[0x0]:'i.'+_0x21337d[0x0];_0x5426ac['order'](_0x4f1435,_0x21337d[0x1]===_0xd8a8('0x1b')?![]:!![]);if(_0x21337d[0x0]===_0xd8a8('0x1c')){var _0x4641e0=sqlUtils['getClosedOrderClause'](_0x183dd1,_0x18a78d);_0x5426ac['order'](_0x4641e0,_0x21337d[0x1]===_0xd8a8('0x1b')?![]:!![]);}});}return sqlUtils[_0xd8a8('0x1d')](_0x183dd1,_0x5426ac,_0x18a78d,_0x40b32a);})[_0xd8a8('0x7')](function(_0x545030){_0x2b06ff['rows']=_0x545030;return _0x2b06ff;})['catch'](function(_0x329c41){throw _0x329c41;});};exports[_0xd8a8('0x1e')]=function(_0x2cd914,_0x38b99f){return function(_0x7f141b,_0x371258,_0x2e4c51){var _0x55f8e7=_0x7f141b[_0xd8a8('0x10')];var _0x5b7a11={};var _0x4a3f60=_0x7f141b[_0xd8a8('0x1f')];if(_0x5b7a11){_0x5b7a11=_[_0xd8a8('0x20')](_0x7f141b[_0xd8a8('0xb')]);_0x5b7a11=_[_0xd8a8('0x21')](_0x5b7a11,[_0xd8a8('0xb'),_0xd8a8('0x22'),'phone','fax','mobile']);}utils[_0xd8a8('0x23')](_0x55f8e7,_0x5b7a11,_0x4a3f60,_0x2cd914,_0x38b99f);_0x2e4c51(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 151403a..ae3f269 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f33=['messages','me.','\x20=\x20i.id','it.','expr','getSelectedTags','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','length','find','buildExpression','default','text','value','start','end','unreadMessages','read','and','Contact','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','split','tags','clause','ids','User','operator','user','UserId','body','plainBody','keys','some','compact','\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','tag','filter','capitalize','chat','Websites','search','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Interaction','Sequelize','QueryTypes','sequelize','query','toString','keyBy','fields','attributes','forEach','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','Account.email','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','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','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','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','SELECT','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','getAccountFK','agent','select','field','name','color','tools_tags','getInteractionFK','user_has_','u.id','u.fullname','ui.','from','left_join','where','map','interactions','cm_contacts','users','accounts','a.id\x20=\x20i.'];(function(_0x572165,_0x6a45cc){var _0x8c8709=function(_0x43faab){while(--_0x43faab){_0x572165['push'](_0x572165['shift']());}};_0x8c8709(++_0x6a45cc);}(_0x0f33,0x1dd));var _0x30f3=function(_0x5e618d,_0x28527e){_0x5e618d=_0x5e618d-0x0;var _0x24a942=_0x0f33[_0x5e618d];return _0x24a942;};'use strict';var _=require(_0x30f3('0x0'));var squel=require(_0x30f3('0x1'));var as=require(_0x30f3('0x2'));var qs=require(_0x30f3('0x3'));var updateInteraction=require(_0x30f3('0x4'))['updateInteraction'];var utils=require(_0x30f3('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x4ea91a,_0x5e61e8,_0x55f7ee){var _0x50bb57=![];var _0x2f50f7=utils[_0x30f3('0x6')](_0x4ea91a);if(_0x5e61e8['role']===_0x30f3('0x7')&&!_0x55f7ee['search']&&!_0x55f7ee[_0x2f50f7]){_0x50bb57=!![];}return _0x50bb57;}function getTagsQuery(){return squel[_0x30f3('0x8')]()[_0x30f3('0x9')]('id')[_0x30f3('0x9')](_0x30f3('0xa'))['field'](_0x30f3('0xb'))['from'](_0x30f3('0xc'));}function getUsersQuery(_0x51f1f2,_0x23454d){var _0x53afbb=utils[_0x30f3('0xd')](_0x51f1f2);var _0x935a39=_0x30f3('0xe')+_0x51f1f2+'_interactions';var _0x782c8e=squel[_0x30f3('0x8')]()[_0x30f3('0x9')](_0x30f3('0xf'))['field'](_0x30f3('0x10'))[_0x30f3('0x9')](_0x30f3('0x11')+_0x53afbb)[_0x30f3('0x12')](_0x935a39,'ui')[_0x30f3('0x13')]('users','u','u.id\x20=\x20ui.UserId');if(_0x23454d['length']>0x0){_0x782c8e[_0x30f3('0x14')](_0x30f3('0x11')+_0x53afbb+'\x20IN\x20?',_[_0x30f3('0x15')](_0x23454d,'id'));}return _0x782c8e;}function getInteractionsQuery(_0x39b2b4){var _0x1ad207=utils['getInteractionsTables'](_0x39b2b4);var _0x27a603=utils[_0x30f3('0x6')](_0x39b2b4);var _0x1c4072=utils[_0x30f3('0xd')](_0x39b2b4);return squel[_0x30f3('0x8')]()[_0x30f3('0x12')](_0x1ad207[_0x30f3('0x16')],'i')[_0x30f3('0x13')](_0x30f3('0x17'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x30f3('0x18'),'o','o.id\x20=\x20i.UserId')[_0x30f3('0x13')](_0x1ad207[_0x30f3('0x19')],'a',_0x30f3('0x1a')+_0x27a603)[_0x30f3('0x13')](_0x1ad207[_0x30f3('0x1b')],'me',_0x30f3('0x1c')+_0x1c4072+_0x30f3('0x1d'))[_0x30f3('0x13')](_0x1ad207['interactionsTags'],'it',_0x30f3('0x1e')+_0x1c4072+'\x20=\x20i.id')[_0x30f3('0x13')](_0x30f3('0xc'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x221fba={'body':squel[_0x30f3('0x1f')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x30f3('0x1f')](),'filter':squel['expr'](),'read':squel[_0x30f3('0x1f')](),'tags':{'clause':squel[_0x30f3('0x1f')](),'ids':null},'user':squel[_0x30f3('0x1f')]()};return _0x221fba;}function parseTagParameter(_0x3fd5f1){var _0x2c94ce=squel[_0x30f3('0x1f')]();if(_0x3fd5f1){var _0x1bf29a=utils[_0x30f3('0x20')](_0x3fd5f1);_0x1bf29a['forEach'](function(_0x429529){_0x2c94ce['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x429529+',%');});}return _0x2c94ce;}function parseReadParameter(_0x13fa48){var _0x51c4fd='';if(_0x13fa48){_0x51c4fd=_0x30f3('0x21');if(_0x13fa48==='1'){_0x51c4fd=_0x51c4fd[_0x30f3('0x22')](_0x30f3('0x23'),'=');}else{_0x51c4fd=_0x51c4fd[_0x30f3('0x22')]('{OPERATOR}','>');}}return _0x51c4fd;}function parseSearchFilter(_0xc83fef,_0x41641f){var _0x4da34d=squel['expr']();if(_0x41641f){var _0x49ffea=_0x41641f[_0x30f3('0x22')]('\x5c','\x5c\x5c')[_0x30f3('0x22')](/'/g,'\x27\x27');if(qs[_0x30f3('0x24')](_0x49ffea)){_0x4da34d['or'](_0x30f3('0x25'),_0x49ffea+'%');if([_0x30f3('0x26'),_0x30f3('0x27')][_0x30f3('0x28')](_0xc83fef)){_0x4da34d['or'](_0x30f3('0x29'),_0x49ffea+'%');}else if(_0xc83fef===_0x30f3('0x2a')){_0x4da34d['or'](_0x30f3('0x2b'),_0x49ffea+'%');}else if(_0xc83fef===_0x30f3('0x2c')){_0x4da34d['or'](_0x30f3('0x2d'),_0x49ffea+'%');}}else if(_0xc83fef===_0x30f3('0x2e')&&qs[_0x30f3('0x2f')](_0x49ffea)){_0x4da34d['or']('c.email\x20LIKE\x20?',_0x49ffea+'%');}else{if(_0xc83fef===_0x30f3('0x2e')){_0x4da34d['or'](_0x30f3('0x30'),qs[_0x30f3('0x31')](_0x49ffea,!![]))['or'](_0x30f3('0x32'),qs[_0x30f3('0x31')](_0x49ffea));}else if(_0xc83fef!==_0x30f3('0x2a')){_0x4da34d['or'](_0x30f3('0x33'),qs[_0x30f3('0x31')](_0x49ffea));}_0x4da34d['or'](_0x30f3('0x34'),qs[_0x30f3('0x31')](_0x49ffea,!![]),null);}}return _0x4da34d;}function parseAdvancedSearchFilter(_0x462e58,_0x161a9d){var _0x38f094=getSqlClauses();var _0x24879b=as[_0x30f3('0x35')](_0x462e58);var _0x5b8a67=_0x24879b['sqlOperator'];for(var _0x2969ea=0x0;_0x2969ea<_0x24879b[_0x30f3('0x36')][_0x30f3('0x37')];_0x2969ea++){var _0x3b0ae5=_0x24879b[_0x30f3('0x36')][_0x2969ea];var _0x20f28a='i';var _0x946754=_[_0x30f3('0x38')](_0x161a9d,['name',_0x3b0ae5[_0x30f3('0x9')]]);if(_0x946754){var _0x2e6a42=as[_0x30f3('0x39')](_0x20f28a,_0x946754['type'],_0x3b0ae5);_0x38f094[_0x30f3('0x3a')][_0x5b8a67](_0x2e6a42[_0x30f3('0x3b')],_0x2e6a42[_0x30f3('0x3c')][_0x30f3('0x3d')],_0x2e6a42[_0x30f3('0x3c')][_0x30f3('0x3e')]);}else{switch(_0x3b0ae5['field']){case _0x30f3('0x3f'):var _0x5c6c88=parseReadParameter(_0x3b0ae5[_0x30f3('0x3c')]);_0x38f094[_0x30f3('0x40')][_0x30f3('0x41')](_0x5c6c88);break;case _0x30f3('0x42'):if(_0x3b0ae5['operator']===_0x30f3('0x43')){if(_0x3b0ae5[_0x30f3('0x3c')]['split']('\x20')[_0x30f3('0x37')]>0x1){_0x38f094[_0x30f3('0x44')][_0x5b8a67](_0x30f3('0x34'),qs['getFullTextValue'](_0x3b0ae5[_0x30f3('0x3c')],!![]),null);}else{var _0x32ac81='%'+_0x3b0ae5[_0x30f3('0x3c')]+'%';_0x38f094[_0x30f3('0x44')][_0x5b8a67](_0x30f3('0x45'),_0x32ac81,_0x32ac81,_0x32ac81);}}else{_0x946754=_[_0x30f3('0x38')](_0x161a9d,[_0x30f3('0xa'),_0x30f3('0x46')]);_0x3b0ae5[_0x30f3('0x9')]=_0x30f3('0x46');_0x2e6a42=as['buildExpression'](_0x20f28a,_0x946754[_0x30f3('0x47')],_0x3b0ae5);_0x38f094[_0x30f3('0x44')][_0x5b8a67](_0x2e6a42[_0x30f3('0x3b')],_0x2e6a42[_0x30f3('0x3c')][_0x30f3('0x3d')],_0x2e6a42[_0x30f3('0x3c')][_0x30f3('0x3e')]);}break;case'Tag':var _0x45daa9=_0x3b0ae5[_0x30f3('0x3c')][_0x30f3('0x48')](',')[_0x30f3('0x15')](function(_0x133f40){return Number(_0x133f40);});var _0x4b45c1=parseTagParameter(_0x45daa9);_0x38f094[_0x30f3('0x49')][_0x30f3('0x4a')][_0x30f3('0x41')](_0x4b45c1);_0x38f094[_0x30f3('0x49')][_0x30f3('0x4b')]=_0x45daa9;break;case _0x30f3('0x4c'):if(_0x3b0ae5[_0x30f3('0x4d')]===_0x30f3('0x43')){_0x38f094[_0x30f3('0x4e')][_0x5b8a67]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3b0ae5[_0x30f3('0x3c')]+'%',null);}else{_0x946754=_[_0x30f3('0x38')](_0x161a9d,[_0x30f3('0xa'),_0x30f3('0x4f')]);_0x3b0ae5[_0x30f3('0x9')]=_0x30f3('0x4f');_0x2e6a42=as[_0x30f3('0x39')](_0x20f28a,_0x946754[_0x30f3('0x47')],_0x3b0ae5);_0x38f094[_0x30f3('0x4e')][_0x5b8a67](_0x2e6a42[_0x30f3('0x3b')],_0x2e6a42[_0x30f3('0x3c')][_0x30f3('0x3d')],_0x2e6a42[_0x30f3('0x3c')][_0x30f3('0x3e')]);}break;case _0x30f3('0x50'):case _0x30f3('0x51'):_0x2e6a42=as[_0x30f3('0x39')]('me',null,_0x3b0ae5);_0x38f094[_0x30f3('0x50')][_0x5b8a67](_0x2e6a42['text'],_0x2e6a42[_0x30f3('0x3c')][_0x30f3('0x3d')],_0x2e6a42[_0x30f3('0x3c')][_0x30f3('0x3e')]);break;}}}return _0x38f094;}function parseModelFields(_0x409cbb,_0x27b3cd,_0x5c22ca){var _0x10d5e2=utils[_0x30f3('0x6')](_0x409cbb);var _0x516e70=squel[_0x30f3('0x1f')]();var _0x4bd67d=_(_0x27b3cd)[_0x30f3('0x52')]()[_0x30f3('0x15')](function(_0x286d10){return _[_0x30f3('0x53')](_0x5c22ca,[_0x30f3('0xa'),_0x286d10])?_0x286d10:undefined;})[_0x30f3('0x54')]()[_0x30f3('0x3c')]();if(_0x4bd67d[_0x30f3('0x37')]>0x0){_0x4bd67d['forEach'](function(_0x131dd2){if(_0x131dd2===_0x10d5e2){_0x516e70[_0x30f3('0x41')]('i.'+_0x10d5e2+_0x30f3('0x55'),[][_0x30f3('0x56')](_0x27b3cd[_0x131dd2]));}else if(_0x131dd2===_0x30f3('0x57')){var _0x19643e=JSON['parse'](_0x27b3cd[_0x131dd2])[_0x30f3('0x58')];var _0x255c40=JSON[_0x30f3('0x59')](_0x27b3cd[_0x131dd2])[_0x30f3('0x5a')];_0x516e70['and'](_0x30f3('0x5b'),_0x19643e,_0x255c40);}else{if(_0x27b3cd[_0x131dd2]===_0x30f3('0x5c')){_0x516e70['and']('i.'+_0x131dd2+_0x30f3('0x5d'));}else{_0x516e70[_0x30f3('0x41')]('i.'+_0x131dd2+_0x30f3('0x5e'),_0x27b3cd[_0x131dd2]);}}});}return _0x516e70;}function parseQueryParameters(_0x26a518,_0x4d9374,_0x5e5f59){var _0x10c78d=getSqlClauses();return Promise[_0x30f3('0x5f')]()[_0x30f3('0x60')](function(){return parseModelFields(_0x26a518,_0x4d9374,_0x5e5f59);})['then'](function(_0x116d74){_0x10c78d['fields'][_0x30f3('0x41')](_0x116d74);return parseReadParameter(_0x4d9374[_0x30f3('0x40')]);})[_0x30f3('0x60')](function(_0x587018){_0x10c78d['read'][_0x30f3('0x41')](_0x587018);return parseTagParameter(_0x4d9374[_0x30f3('0x61')]);})['then'](function(_0x545ebe){_0x10c78d[_0x30f3('0x49')][_0x30f3('0x4a')]['and'](_0x545ebe);return parseSearchFilter(_0x26a518,_0x4d9374[_0x30f3('0x62')]);})['then'](function(_0x7ac7c6){_0x10c78d[_0x30f3('0x62')]=_0x7ac7c6;return _0x10c78d;});}function checkAccountsRestrictions(_0x368d60,_0x40d64d,_0x26d116){var _0x2c2550=utils[_0x30f3('0x6')](_0x368d60);var _0x4b9357='get'+_[_0x30f3('0x63')](_0x368d60)+(_0x368d60===_0x30f3('0x64')?_0x30f3('0x65'):'Accounts');var _0x1c1c04=squel['expr']();return Promise[_0x30f3('0x5f')]()[_0x30f3('0x60')](function(){if(_0x26d116[_0x30f3('0x66')]&&_0x40d64d[_0x30f3('0x67')]==='agent'){return _0x40d64d[_0x4b9357]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x489fb8){if(_0x489fb8){if(_0x489fb8[_0x30f3('0x37')]===0x0){_0x1c1c04[_0x30f3('0x41')]('i.'+_0x2c2550+_0x30f3('0x5d'));}else{_0x1c1c04['and']('i.'+_0x2c2550+_0x30f3('0x55'),_['map'](_0x489fb8,'id'));}}else if(!_0x26d116[_0x2c2550]){_0x1c1c04[_0x30f3('0x41')]('i.'+_0x2c2550+_0x30f3('0x68'));}})['then'](function(){return _0x1c1c04;});}function getClosedOrderClause(_0x4d5ca6,_0xa446a7){var _0x3ca8db='';var _0x5b36bd=[_0x30f3('0x69'),_0x30f3('0x6a'),_0x30f3('0x6b')];if(_0x4d5ca6===_0x30f3('0x2e')){_0x5b36bd[_0x30f3('0x6c')](_0x30f3('0x6d'));}if(_0xa446a7[_0x30f3('0x6e')]==='0'&&_0x4d5ca6===_0x30f3('0x2e')){_0x3ca8db=_0x30f3('0x6d');}else{if(_0xa446a7[_0x30f3('0x6e')]==='1'){_0x5b36bd[_0x30f3('0x6f')]();}_0x3ca8db='CONCAT_WS(\x27\x27,\x20'+_0x5b36bd[_0x30f3('0x70')](',\x20')+')';}return _0x3ca8db;}function getFilteredInteractions(_0x5ca02b,_0x32a347,_0x26e595,_0x292c73){var _0x2c4cae=utils['getInteractionFK'](_0x5ca02b);var _0x2b663e=_['capitalize'](_0x5ca02b)+_0x30f3('0x71');var _0x6477d8=[];var _0x5e6a6d=getTagsQuery();var _0x1b66a5={'type':db[_0x30f3('0x72')][_0x30f3('0x73')]['SELECT'],'raw':!![]};var _0x2293dc=[];var _0x38b619=[];return db[_0x30f3('0x74')][_0x30f3('0x75')](_0x5e6a6d[_0x30f3('0x76')](),_0x1b66a5)[_0x30f3('0x60')](function(_0x42559f){_0x6477d8=_[_0x30f3('0x77')](_0x42559f,'id');_0x1b66a5=_['merge'](_0x1b66a5,{'model':db[_0x2b663e],'mapToModel':!![],'nest':!![]});if(_0x26e595[_0x30f3('0x78')]){_0x292c73[_0x30f3('0x79')][_0x30f3('0x7a')](function(_0x2e06ea){_0x32a347[_0x30f3('0x9')]('i.'+_0x2e06ea);});}else{_0x32a347[_0x30f3('0x9')](_0x30f3('0x7b'),_0x30f3('0x3f'));_0x32a347['field'](_0x30f3('0x7c'),_0x30f3('0x7d'));_0x32a347[_0x30f3('0x9')]('a.mandatoryDisposition',_0x30f3('0x7e'));if(_0x5ca02b===_0x30f3('0x2e')){_0x32a347[_0x30f3('0x9')]('a.email',_0x30f3('0x7f'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x80'),_0x30f3('0x81'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x82'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x83'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x84'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x85'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x86'));_0x32a347[_0x30f3('0x9')]('i.attach');_0x32a347[_0x30f3('0x9')]('i.lastMsgAt');_0x32a347[_0x30f3('0x9')](_0x30f3('0x87'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x88'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x6b'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x6a'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x69'));_0x32a347[_0x30f3('0x9')]('i.substatus');_0x32a347[_0x30f3('0x9')](_0x30f3('0x89'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x8a'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x8b'));_0x32a347[_0x30f3('0x9')]('i.UserId');}else if(_0x5ca02b==='openchannel'){_0x32a347[_0x30f3('0x9')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x30f3('0x81'));}else{_0x32a347['field'](_0x30f3('0x8c'),'contactName');}if(_0x5ca02b!==_0x30f3('0x2e')){_0x32a347['field']('i.*');}_0x32a347['field'](_0x30f3('0x8d'),_0x30f3('0x8e'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x8f'),'Contact.lastName');_0x32a347['field'](_0x30f3('0x90'),_0x30f3('0x91'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x92'),_0x30f3('0x93'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x94'),_0x30f3('0x95'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x96'),_0x30f3('0x97'));_0x32a347[_0x30f3('0x9')]('o.fullname',_0x30f3('0x98'));_0x32a347[_0x30f3('0x9')](_0x30f3('0x99'),_0x30f3('0x9a'));_0x32a347['field'](_0x30f3('0x9b'),_0x30f3('0x9c'));}if(_0x292c73[_0x30f3('0x9d')]){_0x32a347[_0x30f3('0x9d')](_0x292c73['limit']);}if(_0x292c73[_0x30f3('0x9e')]){_0x32a347[_0x30f3('0x9e')](_0x292c73[_0x30f3('0x9e')]);}return db[_0x30f3('0x74')][_0x30f3('0x75')](_0x32a347[_0x30f3('0x76')](),_0x1b66a5);})[_0x30f3('0x60')](function(_0x581181){_0x2293dc=_0x581181;var _0x4c2907=getUsersQuery(_0x5ca02b,_0x2293dc);return db['sequelize']['query'](_0x4c2907[_0x30f3('0x76')](),_0x1b66a5);})[_0x30f3('0x60')](function(_0x297117){_0x38b619=_[_0x30f3('0x9f')](_0x297117,_0x2c4cae);if(_0x5ca02b===_0x30f3('0x2e')){return db[_0x30f3('0xa0')][_0x30f3('0xa1')]({'attributes':[_0x30f3('0xa2')],'raw':!![]});}})[_0x30f3('0x60')](function(_0x473105){var _0x45317e=_0x473105?_0x473105[_0x30f3('0xa2')]:undefined;var _0x57191b=_0x2293dc[_0x30f3('0x15')](function(_0x17f1ec){return updateInteraction(_0x17f1ec,_0x6477d8,_0x38b619,_0x45317e);});return Promise[_0x30f3('0xa3')](_0x57191b);});}function countFilteredInteractions(_0x5423e8,_0x386dbd){var _0x3c5f38=_0x5423e8[_0x30f3('0xa4')]();_0x3c5f38[_0x30f3('0x9')](_0x30f3('0xa5'));_0x3c5f38[_0x30f3('0x9')](_0x30f3('0x7b'),'unreadMessages');var _0x5b72d1=utils[_0x30f3('0x20')](_0x386dbd);if(!_[_0x30f3('0xa6')](_0x5b72d1)){_0x3c5f38['where']('t.id\x20IN\x20?',_0x5b72d1);}var _0x427c69={'type':db['Sequelize'][_0x30f3('0x73')][_0x30f3('0xa7')],'raw':!![]};return db['sequelize']['query'](_0x3c5f38[_0x30f3('0x76')](),_0x427c69);}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 _0x2484=['$substring','split','length','contact','ContactId','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','\x20IN\x20?','concat','createdAt','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','tag','capitalize','chat','Websites','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Interaction','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','i.id','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','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','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','enableEmailPreview','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','Sequelize','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','isEmail','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','buildExpression','type','default','text','value','start','end','read','and','Contact','operator'];(function(_0x5c8805,_0x4add82){var _0xbbdc2=function(_0x584309){while(--_0x584309){_0x5c8805['push'](_0x5c8805['shift']());}};_0xbbdc2(++_0x4add82);}(_0x2484,0xf8));var _0x4248=function(_0x4e3ee6,_0x1cac16){_0x4e3ee6=_0x4e3ee6-0x0;var _0x3a1887=_0x2484[_0x4e3ee6];return _0x3a1887;};'use strict';var _=require('lodash');var squel=require(_0x4248('0x0'));var as=require(_0x4248('0x1'));var qs=require(_0x4248('0x2'));var updateInteraction=require('./update-interaction')[_0x4248('0x3')];var utils=require('./utils');var db=require(_0x4248('0x4'))['db'];function skipInteractionsQuery(_0x3f842b,_0x3b9685,_0xc61e5e){var _0x25ffaf=![];var _0x514a22=utils[_0x4248('0x5')](_0x3f842b);if(_0x3b9685[_0x4248('0x6')]===_0x4248('0x7')&&!_0xc61e5e[_0x4248('0x8')]&&!_0xc61e5e[_0x514a22]){_0x25ffaf=!![];}return _0x25ffaf;}function getTagsQuery(){return squel[_0x4248('0x9')]()[_0x4248('0xa')]('id')['field'](_0x4248('0xb'))['field'](_0x4248('0xc'))[_0x4248('0xd')](_0x4248('0xe'));}function getUsersQuery(_0x4a4c92,_0x59fbf6){var _0x25c1db=utils[_0x4248('0xf')](_0x4a4c92);var _0x175015='user_has_'+_0x4a4c92+_0x4248('0x10');var _0x145961=squel['select']()[_0x4248('0xa')](_0x4248('0x11'))[_0x4248('0xa')](_0x4248('0x12'))[_0x4248('0xa')](_0x4248('0x13')+_0x25c1db)['from'](_0x175015,'ui')[_0x4248('0x14')]('users','u',_0x4248('0x15'));if(_0x59fbf6['length']>0x0){_0x145961['where']('ui.'+_0x25c1db+'\x20IN\x20?',_[_0x4248('0x16')](_0x59fbf6,'id'));}return _0x145961;}function getInteractionsQuery(_0x2ef685){var _0x2814c5=utils[_0x4248('0x17')](_0x2ef685);var _0x34b5c2=utils['getAccountFK'](_0x2ef685);var _0x4f5fc5=utils['getInteractionFK'](_0x2ef685);return squel[_0x4248('0x9')]()[_0x4248('0xd')](_0x2814c5[_0x4248('0x18')],'i')[_0x4248('0x14')]('cm_contacts','c',_0x4248('0x19'))['left_join'](_0x4248('0x1a'),'o','o.id\x20=\x20i.UserId')[_0x4248('0x14')](_0x2814c5['accounts'],'a',_0x4248('0x1b')+_0x34b5c2)[_0x4248('0x14')](_0x2814c5[_0x4248('0x1c')],'me',_0x4248('0x1d')+_0x4f5fc5+_0x4248('0x1e'))['left_join'](_0x2814c5[_0x4248('0x1f')],'it',_0x4248('0x20')+_0x4f5fc5+_0x4248('0x1e'))[_0x4248('0x14')](_0x4248('0xe'),'t',_0x4248('0x21'));}function getSqlClauses(){var _0x70c8ac={'body':squel[_0x4248('0x22')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x4248('0x22')](),'filter':squel[_0x4248('0x22')](),'read':squel['expr'](),'tags':{'clause':squel[_0x4248('0x22')](),'ids':null},'user':squel['expr']()};return _0x70c8ac;}function parseTagParameter(_0x469d6c){var _0x589c98=squel[_0x4248('0x22')]();if(_0x469d6c){var _0x25d213=utils[_0x4248('0x23')](_0x469d6c);_0x25d213[_0x4248('0x24')](function(_0x1bae1e){_0x589c98['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bae1e+',%');});}return _0x589c98;}function parseReadParameter(_0x142ce7){var _0x9cb069='';if(_0x142ce7){_0x9cb069=_0x4248('0x25');if(_0x142ce7==='1'){_0x9cb069=_0x9cb069[_0x4248('0x26')]('{OPERATOR}','=');}else{_0x9cb069=_0x9cb069['replace'](_0x4248('0x27'),'>');}}return _0x9cb069;}function parseSearchFilter(_0x41a063,_0x308e15){var _0x8939f1=squel[_0x4248('0x22')]();if(_0x308e15){var _0xc3976f=_0x308e15['replace']('\x5c','\x5c\x5c')[_0x4248('0x26')](/'/g,'\x27\x27');if(qs[_0x4248('0x28')](_0xc3976f)){_0x8939f1['or']('i.id\x20LIKE\x20?',_0xc3976f+'%');if([_0x4248('0x29'),_0x4248('0x2a')]['includes'](_0x41a063)){_0x8939f1['or'](_0x4248('0x2b'),_0xc3976f+'%');}else if(_0x41a063===_0x4248('0x2c')){_0x8939f1['or']('i.fax\x20LIKE\x20?',_0xc3976f+'%');}else if(_0x41a063===_0x4248('0x2d')){_0x8939f1['or'](_0x4248('0x2e'),_0xc3976f+'%');}}else if(_0x41a063==='mail'&&qs[_0x4248('0x2f')](_0xc3976f)){_0x8939f1['or']('c.email\x20LIKE\x20?',_0xc3976f+'%');}else{if(_0x41a063===_0x4248('0x30')){_0x8939f1['or'](_0x4248('0x31'),qs['getFullTextValue'](_0xc3976f,!![]))['or'](_0x4248('0x32'),qs[_0x4248('0x33')](_0xc3976f));}else if(_0x41a063!==_0x4248('0x2c')){_0x8939f1['or'](_0x4248('0x34'),qs[_0x4248('0x33')](_0xc3976f));}_0x8939f1['or'](_0x4248('0x35'),qs[_0x4248('0x33')](_0xc3976f,!![]),null);}}return _0x8939f1;}function parseAdvancedSearchFilter(_0x20b869,_0x28b9a8){var _0x39df3d=getSqlClauses();var _0x36fefb=as[_0x4248('0x36')](_0x20b869);var _0x271421=_0x36fefb['sqlOperator'];for(var _0x1ad230=0x0;_0x1ad230<_0x36fefb[_0x4248('0x37')]['length'];_0x1ad230++){var _0x39be33=_0x36fefb[_0x4248('0x37')][_0x1ad230];var _0x1033c0='i';var _0x5046df=_[_0x4248('0x38')](_0x28b9a8,[_0x4248('0xb'),_0x39be33[_0x4248('0xa')]]);if(_0x5046df){var _0x6d2760=as[_0x4248('0x39')](_0x1033c0,_0x5046df[_0x4248('0x3a')],_0x39be33);_0x39df3d[_0x4248('0x3b')][_0x271421](_0x6d2760[_0x4248('0x3c')],_0x6d2760[_0x4248('0x3d')][_0x4248('0x3e')],_0x6d2760[_0x4248('0x3d')][_0x4248('0x3f')]);}else{switch(_0x39be33[_0x4248('0xa')]){case'unreadMessages':var _0x3dc52d=parseReadParameter(_0x39be33['value']);_0x39df3d[_0x4248('0x40')][_0x4248('0x41')](_0x3dc52d);break;case _0x4248('0x42'):if(_0x39be33[_0x4248('0x43')]===_0x4248('0x44')){if(_0x39be33[_0x4248('0x3d')][_0x4248('0x45')]('\x20')[_0x4248('0x46')]>0x1){_0x39df3d['contact'][_0x271421](_0x4248('0x35'),qs['getFullTextValue'](_0x39be33[_0x4248('0x3d')],!![]),null);}else{var _0x3ca276='%'+_0x39be33['value']+'%';_0x39df3d[_0x4248('0x47')][_0x271421]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3ca276,_0x3ca276,_0x3ca276);}}else{_0x5046df=_[_0x4248('0x38')](_0x28b9a8,[_0x4248('0xb'),_0x4248('0x48')]);_0x39be33[_0x4248('0xa')]=_0x4248('0x48');_0x6d2760=as[_0x4248('0x39')](_0x1033c0,_0x5046df['type'],_0x39be33);_0x39df3d[_0x4248('0x47')][_0x271421](_0x6d2760['text'],_0x6d2760[_0x4248('0x3d')]['start'],_0x6d2760[_0x4248('0x3d')][_0x4248('0x3f')]);}break;case _0x4248('0x49'):var _0x303122=_0x39be33[_0x4248('0x3d')][_0x4248('0x45')](',')[_0x4248('0x16')](function(_0xa4887a){return Number(_0xa4887a);});var _0xa47eab=parseTagParameter(_0x303122);_0x39df3d[_0x4248('0x4a')][_0x4248('0x4b')][_0x4248('0x41')](_0xa47eab);_0x39df3d[_0x4248('0x4a')][_0x4248('0x4c')]=_0x303122;break;case _0x4248('0x4d'):if(_0x39be33[_0x4248('0x43')]===_0x4248('0x44')){_0x39df3d[_0x4248('0x4e')][_0x271421](_0x4248('0x4f'),'%'+_0x39be33['value']+'%',null);}else{_0x5046df=_[_0x4248('0x38')](_0x28b9a8,[_0x4248('0xb'),_0x4248('0x50')]);_0x39be33[_0x4248('0xa')]=_0x4248('0x50');_0x6d2760=as[_0x4248('0x39')](_0x1033c0,_0x5046df['type'],_0x39be33);_0x39df3d[_0x4248('0x4e')][_0x271421](_0x6d2760['text'],_0x6d2760[_0x4248('0x3d')][_0x4248('0x3e')],_0x6d2760['value'][_0x4248('0x3f')]);}break;case _0x4248('0x51'):case'plainBody':_0x6d2760=as['buildExpression']('me',null,_0x39be33);_0x39df3d[_0x4248('0x51')][_0x271421](_0x6d2760[_0x4248('0x3c')],_0x6d2760[_0x4248('0x3d')][_0x4248('0x3e')],_0x6d2760[_0x4248('0x3d')][_0x4248('0x3f')]);break;}}}return _0x39df3d;}function parseModelFields(_0x2590dd,_0x1cbfd0,_0x29a6fa){var _0x47641a=utils['getAccountFK'](_0x2590dd);var _0x5a03ae=squel[_0x4248('0x22')]();var _0x3e2136=_(_0x1cbfd0)[_0x4248('0x52')]()[_0x4248('0x16')](function(_0x1cbd34){return _[_0x4248('0x53')](_0x29a6fa,['name',_0x1cbd34])?_0x1cbd34:undefined;})['compact']()[_0x4248('0x3d')]();if(_0x3e2136['length']>0x0){_0x3e2136['forEach'](function(_0x171979){if(_0x171979===_0x47641a){_0x5a03ae[_0x4248('0x41')]('i.'+_0x47641a+_0x4248('0x54'),[][_0x4248('0x55')](_0x1cbfd0[_0x171979]));}else if(_0x171979===_0x4248('0x56')){var _0x59aef3=JSON['parse'](_0x1cbfd0[_0x171979])[_0x4248('0x57')];var _0x3b662a=JSON['parse'](_0x1cbfd0[_0x171979])[_0x4248('0x58')];_0x5a03ae[_0x4248('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x59aef3,_0x3b662a);}else{if(_0x1cbfd0[_0x171979]===_0x4248('0x59')){_0x5a03ae[_0x4248('0x41')]('i.'+_0x171979+_0x4248('0x5a'));}else{_0x5a03ae[_0x4248('0x41')]('i.'+_0x171979+_0x4248('0x5b'),_0x1cbfd0[_0x171979]);}}});}return _0x5a03ae;}function parseQueryParameters(_0x5cb38a,_0x358b9f,_0x3e09a2){var _0x1a0412=getSqlClauses();return Promise[_0x4248('0x5c')]()[_0x4248('0x5d')](function(){return parseModelFields(_0x5cb38a,_0x358b9f,_0x3e09a2);})[_0x4248('0x5d')](function(_0x5ab817){_0x1a0412['fields'][_0x4248('0x41')](_0x5ab817);return parseReadParameter(_0x358b9f[_0x4248('0x40')]);})[_0x4248('0x5d')](function(_0x2413dc){_0x1a0412[_0x4248('0x40')]['and'](_0x2413dc);return parseTagParameter(_0x358b9f[_0x4248('0x5e')]);})['then'](function(_0x49602e){_0x1a0412[_0x4248('0x4a')][_0x4248('0x4b')][_0x4248('0x41')](_0x49602e);return parseSearchFilter(_0x5cb38a,_0x358b9f['filter']);})[_0x4248('0x5d')](function(_0x1705af){_0x1a0412['filter']=_0x1705af;return _0x1a0412;});}function checkAccountsRestrictions(_0x58dc23,_0x5d81ee,_0x2a11b7){var _0x4d8f87=utils[_0x4248('0x5')](_0x58dc23);var _0x5cbef2='get'+_[_0x4248('0x5f')](_0x58dc23)+(_0x58dc23===_0x4248('0x60')?_0x4248('0x61'):'Accounts');var _0x5e8f09=squel['expr']();return Promise[_0x4248('0x5c')]()[_0x4248('0x5d')](function(){if(_0x2a11b7[_0x4248('0x8')]&&_0x5d81ee[_0x4248('0x6')]===_0x4248('0x7')){return _0x5d81ee[_0x5cbef2]({'attributes':['id'],'raw':!![]});}})[_0x4248('0x5d')](function(_0x1ed56f){if(_0x1ed56f){if(_0x1ed56f[_0x4248('0x46')]===0x0){_0x5e8f09[_0x4248('0x41')]('i.'+_0x4d8f87+_0x4248('0x5a'));}else{_0x5e8f09['and']('i.'+_0x4d8f87+_0x4248('0x54'),_['map'](_0x1ed56f,'id'));}}else if(!_0x2a11b7[_0x4d8f87]){_0x5e8f09[_0x4248('0x41')]('i.'+_0x4d8f87+_0x4248('0x62'));}})[_0x4248('0x5d')](function(){return _0x5e8f09;});}function getClosedOrderClause(_0x39d13d,_0x2b0140){var _0x37f57d='';var _0x3cef77=['i.thirdDisposition',_0x4248('0x63'),_0x4248('0x64')];if(_0x39d13d==='mail'){_0x3cef77[_0x4248('0x65')](_0x4248('0x66'));}if(_0x2b0140[_0x4248('0x67')]==='0'&&_0x39d13d===_0x4248('0x30')){_0x37f57d='i.substatus';}else{if(_0x2b0140[_0x4248('0x67')]==='1'){_0x3cef77[_0x4248('0x68')]();}_0x37f57d='CONCAT_WS(\x27\x27,\x20'+_0x3cef77[_0x4248('0x69')](',\x20')+')';}return _0x37f57d;}function getFilteredInteractions(_0x52ebbc,_0xc72fad,_0x32857c,_0x165f50){var _0x1961ec=utils['getInteractionFK'](_0x52ebbc);var _0x1a57e5=_[_0x4248('0x5f')](_0x52ebbc)+_0x4248('0x6a');var _0x242186=[];var _0x230e82=getTagsQuery();var _0x1a65b0={'type':db['Sequelize'][_0x4248('0x6b')][_0x4248('0x6c')],'raw':!![]};var _0xfdd82f=[];var _0x513e00=[];return db[_0x4248('0x6d')][_0x4248('0x6e')](_0x230e82[_0x4248('0x6f')](),_0x1a65b0)[_0x4248('0x5d')](function(_0x3721a1){_0x242186=_[_0x4248('0x70')](_0x3721a1,'id');_0x1a65b0=_[_0x4248('0x71')](_0x1a65b0,{'model':db[_0x1a57e5],'mapToModel':!![],'nest':!![]});if(_0x32857c[_0x4248('0x72')]){_0x165f50['attributes'][_0x4248('0x24')](function(_0x59664f){_0xc72fad[_0x4248('0xa')]('i.'+_0x59664f);});}else{_0xc72fad['field'](_0x4248('0x73'),_0x4248('0x74'));_0xc72fad[_0x4248('0xa')](_0x4248('0x75'),_0x4248('0x76'));_0xc72fad[_0x4248('0xa')](_0x4248('0x77'),_0x4248('0x78'));if(_0x52ebbc==='mail'){_0xc72fad[_0x4248('0xa')](_0x4248('0x79'),_0x4248('0x7a'));_0xc72fad[_0x4248('0xa')]('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','contactName');_0xc72fad['field'](_0x4248('0x7b'));_0xc72fad[_0x4248('0xa')](_0x4248('0x7c'));_0xc72fad['field']('i.updatedAt');_0xc72fad[_0x4248('0xa')](_0x4248('0x7d'));_0xc72fad[_0x4248('0xa')](_0x4248('0x7e'));_0xc72fad['field']('i.attach');_0xc72fad[_0x4248('0xa')](_0x4248('0x7f'));_0xc72fad[_0x4248('0xa')](_0x4248('0x80'));_0xc72fad[_0x4248('0xa')](_0x4248('0x81'));_0xc72fad[_0x4248('0xa')](_0x4248('0x64'));_0xc72fad[_0x4248('0xa')]('i.secondDisposition');_0xc72fad['field'](_0x4248('0x82'));_0xc72fad[_0x4248('0xa')](_0x4248('0x66'));_0xc72fad[_0x4248('0xa')](_0x4248('0x83'));_0xc72fad['field'](_0x4248('0x84'));_0xc72fad['field']('i.MailAccountId');_0xc72fad[_0x4248('0xa')](_0x4248('0x85'));}else if(_0x52ebbc==='openchannel'){_0xc72fad['field'](_0x4248('0x86'),'contactName');}else{_0xc72fad[_0x4248('0xa')]('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',_0x4248('0x87'));}if(_0x52ebbc!==_0x4248('0x30')){_0xc72fad['field'](_0x4248('0x88'));}_0xc72fad[_0x4248('0xa')](_0x4248('0x89'),_0x4248('0x8a'));_0xc72fad[_0x4248('0xa')]('c.lastName',_0x4248('0x8b'));_0xc72fad[_0x4248('0xa')]('c.email','Contact.email');_0xc72fad[_0x4248('0xa')](_0x4248('0x8c'),'Contact.phone');_0xc72fad['field'](_0x4248('0x8d'),_0x4248('0x8e'));_0xc72fad[_0x4248('0xa')]('c.fax',_0x4248('0x8f'));_0xc72fad[_0x4248('0xa')]('o.fullname','Owner.fullname');_0xc72fad['field'](_0x4248('0x90'),_0x4248('0x91'));_0xc72fad[_0x4248('0xa')](_0x4248('0x92'),_0x4248('0x93'));}if(_0x165f50[_0x4248('0x94')]){_0xc72fad['limit'](_0x165f50['limit']);}if(_0x165f50[_0x4248('0x95')]){_0xc72fad[_0x4248('0x95')](_0x165f50['offset']);}return db[_0x4248('0x6d')]['query'](_0xc72fad[_0x4248('0x6f')](),_0x1a65b0);})[_0x4248('0x5d')](function(_0x325d25){_0xfdd82f=_0x325d25;var _0x424297=getUsersQuery(_0x52ebbc,_0xfdd82f);return db['sequelize'][_0x4248('0x6e')](_0x424297[_0x4248('0x6f')](),_0x1a65b0);})[_0x4248('0x5d')](function(_0x43314c){_0x513e00=_['groupBy'](_0x43314c,_0x1961ec);if(_0x52ebbc===_0x4248('0x30')){return db[_0x4248('0x96')]['findOne']({'attributes':[_0x4248('0x97')],'raw':!![]});}})[_0x4248('0x5d')](function(_0x2e5838){var _0x4d68be=_0x2e5838?_0x2e5838['enableEmailPreview']:undefined;var _0x4c1199=_0xfdd82f[_0x4248('0x16')](function(_0x8e37b8){return updateInteraction(_0x8e37b8,_0x242186,_0x513e00,_0x4d68be);});return Promise['all'](_0x4c1199);});}function countFilteredInteractions(_0x3338d0,_0x5b6ffe){var _0x271d7a=_0x3338d0[_0x4248('0x98')]();_0x271d7a[_0x4248('0xa')](_0x4248('0x99'));_0x271d7a['field'](_0x4248('0x73'),_0x4248('0x74'));var _0x142d66=utils[_0x4248('0x23')](_0x5b6ffe);if(!_[_0x4248('0x9a')](_0x142d66)){_0x271d7a[_0x4248('0x9b')](_0x4248('0x9c'),_0x142d66);}var _0x40950d={'type':db[_0x4248('0x9d')][_0x4248('0x6b')][_0x4248('0x6c')],'raw':!![]};return db['sequelize'][_0x4248('0x6e')](_0x271d7a[_0x4248('0x6f')](),_0x40950d);}module['exports']={'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 1b945f4..d6afb6c 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 _0x690d=['lodash','map','push','waiting','talking','unmanaged','closed','disposition','abandoned','UserId','answered','total','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','then','Tags'];(function(_0x537d7a,_0x486335){var _0x233a65=function(_0x3fde2b){while(--_0x3fde2b){_0x537d7a['push'](_0x537d7a['shift']());}};_0x233a65(++_0x486335);}(_0x690d,0xc0));var _0xd690=function(_0x3956a2,_0x4a8d1c){_0x3956a2=_0x3956a2-0x0;var _0xae6aae=_0x690d[_0x3956a2];return _0xae6aae;};'use strict';var _=require(_0xd690('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x15e93f,_0x4afcc3){return new Promise(function(_0x4a44a8,_0x1ce28b){try{var _0x17240e=[];if(_0x4afcc3[_0x15e93f]){_0x17240e=_0x4afcc3[_0x15e93f][_0xd690('0x1')](function(_0x59b9d7){return{'id':_0x59b9d7['id'],'fullname':_0x59b9d7['fullname']};});}return _0x4a44a8(_0x17240e);}catch(_0x4e04e2){_0x1ce28b(_0x4e04e2);}});}function getInteractionTags(_0xbfb81e,_0x37ae5c){var _0x2abffa=[];if(_0xbfb81e){_0xbfb81e['split'](',')['forEach'](function(_0x968a92){_0x2abffa[_0xd690('0x2')](_0x37ae5c[_0x968a92]);});}return _0x2abffa;}function updateWaitingCounter(_0x33b6e4){if(_0x33b6e4[_0xd690('0x3')]){_0x33b6e4[_0xd690('0x3')]-=0x1;}}function updateInteractionCounters(_0x490812){_0x490812['waiting']=0x0;_0x490812[_0xd690('0x4')]=0x0;_0x490812['answered']=0x0;_0x490812[_0xd690('0x5')]=0x0;_0x490812['abandoned']=0x0;_0x490812['total']=0x0;if(_0x490812[_0xd690('0x6')]){if(_0x490812[_0xd690('0x7')]===_0xd690('0x8')){_0x490812[_0xd690('0x8')]+=0x1;updateWaitingCounter(_0x490812);}if(_0x490812[_0xd690('0x9')]){_0x490812[_0xd690('0xa')]+=0x1;if(_0x490812[_0xd690('0x4')]){_0x490812['talking']-=0x1;}}else{if(_0x490812[_0xd690('0x7')]){_0x490812[_0xd690('0x5')]+=0x1;updateWaitingCounter(_0x490812);}}}else{if(!_0x490812['UserId']){_0x490812[_0xd690('0x3')]+=0x1;}if(_0x490812[_0xd690('0x9')]){_0x490812[_0xd690('0x4')]+=0x1;updateWaitingCounter(_0x490812);}}_0x490812[_0xd690('0xb')]+=0x1;return _0x490812;}function getLastMessageText(_0x7f6eef){return db['MailMessage'][_0xd690('0xc')]({'where':{'$and':[{'MailInteractionId':_0x7f6eef['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xd690('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xd690('0xe')],'order':_0xd690('0xf'),'raw':!![]})['then'](function(_0x45c12a){if(_0x45c12a&&_0x45c12a['plainBody']){_0x7f6eef[_0xd690('0x10')]=_[_0xd690('0x11')](_0x45c12a[_0xd690('0xe')]);}return _0x7f6eef;})[_0xd690('0x12')](function(_0x54fe8e){throw _0x54fe8e;});}exports[_0xd690('0x13')]=function(_0x463d0b,_0x2b5234,_0x58c6ec,_0x3b16e5){return new Promise(function(_0x437f2c,_0x26aa77){return getInteractionUsers(_0x463d0b['id'],_0x58c6ec)['then'](function(_0x20c38f){_0x463d0b[_0xd690('0x14')]=_0x20c38f;return getInteractionTags(_0x463d0b[_0xd690('0x15')],_0x2b5234);})[_0xd690('0x16')](function(_0x5a6bdc){_0x463d0b[_0xd690('0x17')]=_0x5a6bdc;delete _0x463d0b[_0xd690('0x15')];return updateInteractionCounters(_0x463d0b);})['then'](function(_0x79b69f){if(_0x3b16e5){return getLastMessageText(_0x79b69f);}else{return _0x79b69f;}})[_0xd690('0x16')](function(_0x2ee2e1){_0x437f2c(_0x2ee2e1);})['catch'](function(_0x2439f8){_0x26aa77(_0x2439f8);});});}; \ No newline at end of file +var _0x3de7=['answered','unmanaged','total','closed','abandoned','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart','catch','TagIds','Tags','lodash','forEach','push','waiting','talking'];(function(_0x38fe6d,_0x33b3aa){var _0x32bcd2=function(_0x470ca9){while(--_0x470ca9){_0x38fe6d['push'](_0x38fe6d['shift']());}};_0x32bcd2(++_0x33b3aa);}(_0x3de7,0x13b));var _0x73de=function(_0x52d359,_0x3445cc){_0x52d359=_0x52d359-0x0;var _0x14a0e9=_0x3de7[_0x52d359];return _0x14a0e9;};'use strict';var _=require(_0x73de('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x252b4f,_0x23c3be){return new Promise(function(_0x38f7e9,_0x148c9f){try{var _0x404d6f=[];if(_0x23c3be[_0x252b4f]){_0x404d6f=_0x23c3be[_0x252b4f]['map'](function(_0x31e32e){return{'id':_0x31e32e['id'],'fullname':_0x31e32e['fullname']};});}return _0x38f7e9(_0x404d6f);}catch(_0x4823c2){_0x148c9f(_0x4823c2);}});}function getInteractionTags(_0x4684bf,_0x1b955c){var _0x5aef14=[];if(_0x4684bf){_0x4684bf['split'](',')[_0x73de('0x1')](function(_0x583253){_0x5aef14[_0x73de('0x2')](_0x1b955c[_0x583253]);});}return _0x5aef14;}function updateWaitingCounter(_0x58c42d){if(_0x58c42d[_0x73de('0x3')]){_0x58c42d['waiting']-=0x1;}}function updateInteractionCounters(_0x3768ff){_0x3768ff[_0x73de('0x3')]=0x0;_0x3768ff[_0x73de('0x4')]=0x0;_0x3768ff[_0x73de('0x5')]=0x0;_0x3768ff[_0x73de('0x6')]=0x0;_0x3768ff['abandoned']=0x0;_0x3768ff[_0x73de('0x7')]=0x0;if(_0x3768ff[_0x73de('0x8')]){if(_0x3768ff['disposition']===_0x73de('0x9')){_0x3768ff[_0x73de('0x9')]+=0x1;updateWaitingCounter(_0x3768ff);}if(_0x3768ff['UserId']){_0x3768ff[_0x73de('0x5')]+=0x1;if(_0x3768ff[_0x73de('0x4')]){_0x3768ff[_0x73de('0x4')]-=0x1;}}else{if(_0x3768ff['disposition']){_0x3768ff[_0x73de('0x6')]+=0x1;updateWaitingCounter(_0x3768ff);}}}else{if(!_0x3768ff['UserId']){_0x3768ff[_0x73de('0x3')]+=0x1;}if(_0x3768ff['UserId']){_0x3768ff[_0x73de('0x4')]+=0x1;updateWaitingCounter(_0x3768ff);}}_0x3768ff[_0x73de('0x7')]+=0x1;return _0x3768ff;}function getLastMessageText(_0x363219){return db[_0x73de('0xa')][_0x73de('0xb')]({'where':{'$and':[{'MailInteractionId':_0x363219['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x73de('0xc')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x73de('0xd')],'order':'-id','raw':!![]})[_0x73de('0xe')](function(_0x2d55aa){if(_0x2d55aa&&_0x2d55aa['plainBody']){_0x363219[_0x73de('0xf')]=_[_0x73de('0x10')](_0x2d55aa[_0x73de('0xd')]);}return _0x363219;})[_0x73de('0x11')](function(_0x5d65b4){throw _0x5d65b4;});}exports['updateInteraction']=function(_0x4c7bd0,_0x3e80cd,_0x4dc099,_0x534e75){return new Promise(function(_0x209150,_0x13550d){return getInteractionUsers(_0x4c7bd0['id'],_0x4dc099)[_0x73de('0xe')](function(_0x203598){_0x4c7bd0['Users']=_0x203598;return getInteractionTags(_0x4c7bd0[_0x73de('0x12')],_0x3e80cd);})['then'](function(_0x2e318b){_0x4c7bd0[_0x73de('0x13')]=_0x2e318b;delete _0x4c7bd0[_0x73de('0x12')];return updateInteractionCounters(_0x4c7bd0);})[_0x73de('0xe')](function(_0x356d01){if(_0x534e75){return getLastMessageText(_0x356d01);}else{return _0x356d01;}})[_0x73de('0xe')](function(_0x417fad){_0x209150(_0x417fad);})[_0x73de('0x11')](function(_0x352fef){_0x13550d(_0x352fef);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c026972..27404aa 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 _0x8c3c=['InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','update','info','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website'];(function(_0x57940d,_0x4ea4ca){var _0x17932b=function(_0x34e892){while(--_0x34e892){_0x57940d['push'](_0x57940d['shift']());}};_0x17932b(++_0x4ea4ca);}(_0x8c3c,0x1d5));var _0xc8c3=function(_0x1cddc6,_0x14d525){_0x1cddc6=_0x1cddc6-0x0;var _0x314846=_0x8c3c[_0x1cddc6];return _0x314846;};'use strict';var _=require(_0xc8c3('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xc8c3('0x1'))(_0xc8c3('0x2')),'mail':require(_0xc8c3('0x1'))(_0xc8c3('0x3')),'fax':require('../../config/logger')(_0xc8c3('0x4')),'sms':require(_0xc8c3('0x1'))(_0xc8c3('0x5')),'chat':require(_0xc8c3('0x1'))(_0xc8c3('0x6')),'whatsapp':require(_0xc8c3('0x1'))(_0xc8c3('0x7'))};function getAccountFK(_0x2fe60d){return _[_0xc8c3('0x8')](_0x2fe60d)+(_0x2fe60d===_0xc8c3('0x9')?_0xc8c3('0xa'):'Account')+'Id';}function getInteractionFK(_0x5f53d1){return _[_0xc8c3('0x8')](_0x5f53d1)+_0xc8c3('0xb');}function getInteractionId(_0x13c1a9,_0x3c742c,_0x195833){if(_0x13c1a9&&_0x13c1a9[_['upperFirst'](_0x195833)+_0xc8c3('0xb')]){return _0x13c1a9[_[_0xc8c3('0xc')](_0x195833)+'InteractionId'];}else if(_0x13c1a9&&_0x13c1a9['id']){return _0x13c1a9['id'];}else if(_0x3c742c&&_0x3c742c['id']){return _0x3c742c['id'];}else{return _0xc8c3('0xd');}}function getInteractionsTables(_0x18191e){return{'accounts':_0x18191e+'_'+(_0x18191e===_0xc8c3('0x9')?'websites':_0xc8c3('0xe')),'interactions':_0x18191e+_0xc8c3('0xf'),'interactionsTags':_0x18191e+_0xc8c3('0x10'),'messages':_0x18191e+_0xc8c3('0x11'),'userInteractions':_0xc8c3('0x12')+_0x18191e+_0xc8c3('0xf')};}function getSelectedTags(_0xb65490){var _0x1456b1=[];if(_0xb65490){_0x1456b1=Array[_0xc8c3('0x13')](_0xb65490)?_0xb65490:[_0xb65490];}return _0x1456b1;}function log(_0x245f1a,_0x26fefa,_0x3026e0,_0x16ac9a,_0x3bb57b,_0x54d800){loggers[_0x3bb57b[_0xc8c3('0x14')]()][_0x245f1a](_0xc8c3('0x15'),_0x54d800[_0xc8c3('0x16')](),_0x26fefa?_0x26fefa['id']:null,_0x26fefa?_0x26fefa[_0xc8c3('0x17')]:null,_0x26fefa?_0x26fefa['role']:null,getInteractionId(_0x3026e0,_0x16ac9a,_0x3bb57b),_0x3026e0?JSON[_0xc8c3('0x18')](_0x3026e0):_0xc8c3('0x19'));}function updateUser(_0x167acf,_0x96f557,_0x502703,_0xe7bf04,_0x4710c0){db[_[_0xc8c3('0xc')](_0xe7bf04)+_0xc8c3('0x1a')][_0xc8c3('0x1b')]({'where':{'id':getInteractionId(_0x96f557,_0x502703,_0xe7bf04)}})[_0xc8c3('0x1c')](function(_0x3562da){if(_0x3562da){return _0x3562da[_0xc8c3('0x1d')]({'UserId':_0x167acf?_0x167acf['id']:null});}})['then'](function(_0x151753){if(_0x151753){log(_0xc8c3('0x1e'),_0x167acf,_0x96f557,_0x502703,_0xe7bf04,_0x4710c0);}})['catch'](function(){log('error',_0x167acf,_0x96f557,_0x502703,_0xe7bf04,_0x4710c0);});}module[_0xc8c3('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x7634=['_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','update','info','catch','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','accounts','_interactions','_interaction_has_tags'];(function(_0x1249a6,_0x11d943){var _0x668a1e=function(_0x17bab3){while(--_0x17bab3){_0x1249a6['push'](_0x1249a6['shift']());}};_0x668a1e(++_0x11d943);}(_0x7634,0x1b3));var _0x4763=function(_0x1e88d6,_0x5eebd2){_0x1e88d6=_0x1e88d6-0x0;var _0x3c1af9=_0x7634[_0x1e88d6];return _0x3c1af9;};'use strict';var _=require('lodash');var db=require(_0x4763('0x0'))['db'];var loggers={'openchannel':require(_0x4763('0x1'))(_0x4763('0x2')),'mail':require(_0x4763('0x1'))(_0x4763('0x3')),'fax':require(_0x4763('0x1'))('fax-interactions'),'sms':require(_0x4763('0x1'))(_0x4763('0x4')),'chat':require(_0x4763('0x1'))(_0x4763('0x5')),'whatsapp':require(_0x4763('0x1'))('whatsapp-interactions')};function getAccountFK(_0x2ac980){return _[_0x4763('0x6')](_0x2ac980)+(_0x2ac980===_0x4763('0x7')?_0x4763('0x8'):_0x4763('0x9'))+'Id';}function getInteractionFK(_0x2d8dab){return _['capitalize'](_0x2d8dab)+'InteractionId';}function getInteractionId(_0x3aba22,_0x13a54a,_0x4a036e){if(_0x3aba22&&_0x3aba22[_[_0x4763('0xa')](_0x4a036e)+_0x4763('0xb')]){return _0x3aba22[_[_0x4763('0xa')](_0x4a036e)+_0x4763('0xb')];}else if(_0x3aba22&&_0x3aba22['id']){return _0x3aba22['id'];}else if(_0x13a54a&&_0x13a54a['id']){return _0x13a54a['id'];}else{return'unknown';}}function getInteractionsTables(_0x3273b5){return{'accounts':_0x3273b5+'_'+(_0x3273b5===_0x4763('0x7')?'websites':_0x4763('0xc')),'interactions':_0x3273b5+_0x4763('0xd'),'interactionsTags':_0x3273b5+_0x4763('0xe'),'messages':_0x3273b5+_0x4763('0xf'),'userInteractions':'user_has_'+_0x3273b5+'_interactions'};}function getSelectedTags(_0x258154){var _0x329b4e=[];if(_0x258154){_0x329b4e=Array[_0x4763('0x10')](_0x258154)?_0x258154:[_0x258154];}return _0x329b4e;}function log(_0xd90ebc,_0x24adf9,_0x4d5f0a,_0x11b7ed,_0x447aa8,_0x3359f7){loggers[_0x447aa8[_0x4763('0x11')]()][_0xd90ebc](_0x4763('0x12'),_0x3359f7[_0x4763('0x13')](),_0x24adf9?_0x24adf9['id']:null,_0x24adf9?_0x24adf9[_0x4763('0x14')]:null,_0x24adf9?_0x24adf9['role']:null,getInteractionId(_0x4d5f0a,_0x11b7ed,_0x447aa8),_0x4d5f0a?JSON[_0x4763('0x15')](_0x4d5f0a):_0x4763('0x16'));}function updateUser(_0x372db0,_0x53badf,_0x4cc081,_0x3b87e9,_0x330d8f){db[_[_0x4763('0xa')](_0x3b87e9)+_0x4763('0x17')][_0x4763('0x18')]({'where':{'id':getInteractionId(_0x53badf,_0x4cc081,_0x3b87e9)}})[_0x4763('0x19')](function(_0x4fb432){if(_0x4fb432){return _0x4fb432[_0x4763('0x1a')]({'UserId':_0x372db0?_0x372db0['id']:null});}})[_0x4763('0x19')](function(_0x4dc5b9){if(_0x4dc5b9){log(_0x4763('0x1b'),_0x372db0,_0x53badf,_0x4cc081,_0x3b87e9,_0x330d8f);}})[_0x4763('0x1c')](function(){log('error',_0x372db0,_0x53badf,_0x4cc081,_0x3b87e9,_0x330d8f);});}module[_0x4763('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index b43d25f..b8f3622 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 _0x7b13=['aes-256-ctr','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit','crypto','util','../../mysqldb','../../config/environment','license','split'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x7b13,0x118));var _0x37b1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7b13[_0x167cc1];return _0x10bc4b;};'use strict';var crypto=require(_0x37b1('0x0'));var util=require(_0x37b1('0x1'));var compose=require('composable-middleware');var db=require(_0x37b1('0x2'))['db'];var config=require(_0x37b1('0x3'));function getValueFromLicense(_0x22c31a,_0x425005){if(_0x22c31a&&_0x425005){if(_0x425005['data1']&&_0x425005['license']){var _0x5507cc=_0x425005['data1'];var _0x49d30e=_0x425005[_0x37b1('0x4')];var _0x1eab64=_0x5507cc[_0x37b1('0x5')]('-')[0x4];var _0x8a9fdd=_0x5507cc[_0x37b1('0x5')]('-')[0x0];var _0x220669=crypto['createDecipher'](_0x37b1('0x6'),util['format'](_0x37b1('0x7'),_0x1eab64,_0x5507cc,_0x8a9fdd));var _0x1d4f80=_0x220669[_0x37b1('0x8')](_0x49d30e,_0x37b1('0x9'),_0x37b1('0xa'));_0x1d4f80+=_0x220669[_0x37b1('0xb')](_0x37b1('0xa'));var _0x4d5456=JSON['parse'](_0x1d4f80);return _0x4d5456[_0x37b1('0xc')](_0x22c31a)?_0x4d5456[_0x22c31a]:null;}}return null;}function isLimit(_0x4af668,_0x506210,_0x253a00,_0x12835b){var _0x492f24=_0x506210;return compose()[_0x37b1('0xd')](function(_0x26c570,_0x4579a7,_0xf50ab2){return db[_0x37b1('0xe')][_0x37b1('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x37b1('0x10')](function(_0x395881){var _0x5b05a9=getValueFromLicense(_0x4af668,_0x395881);return _0x5b05a9?_0x5b05a9:_0x492f24;})[_0x37b1('0x10')](function(_0x59a515){_0x492f24=_0x59a515;return _0x253a00[_0x37b1('0x11')](_0x12835b);})[_0x37b1('0x10')](function(_0x5c6186){if(_0x5c6186>=_0x492f24){return _0x4579a7[_0x37b1('0x12')](0x193)[_0x37b1('0x13')]({'message':util[_0x37b1('0x14')](_0x37b1('0x15'),_0x4af668)});}_0xf50ab2();})['catch'](function(_0x32ca47){_0xf50ab2(_0x32ca47);});});}function isUserLimit(){return isLimit(_0x37b1('0x16'),0x1,db[_0x37b1('0x17')],{'where':{'$or':[{'role':_0x37b1('0x18')},{'role':'user'}]}});}exports[_0x37b1('0x19')]=isUserLimit; \ No newline at end of file +var _0x7de4=['parse','hasOwnProperty','use','License','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','final','utf8'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7de4,0x1d1));var _0x47de=function(_0x4a5ca3,_0x3dbae7){_0x4a5ca3=_0x4a5ca3-0x0;var _0x27f6d6=_0x7de4[_0x4a5ca3];return _0x27f6d6;};'use strict';var crypto=require(_0x47de('0x0'));var util=require(_0x47de('0x1'));var compose=require(_0x47de('0x2'));var db=require(_0x47de('0x3'))['db'];var config=require(_0x47de('0x4'));function getValueFromLicense(_0x65cb89,_0x6b5022){if(_0x65cb89&&_0x6b5022){if(_0x6b5022['data1']&&_0x6b5022['license']){var _0x42eac1=_0x6b5022[_0x47de('0x5')];var _0xa01b09=_0x6b5022[_0x47de('0x6')];var _0x569188=_0x42eac1[_0x47de('0x7')]('-')[0x4];var _0x2b4071=_0x42eac1[_0x47de('0x7')]('-')[0x0];var _0x445ac7=crypto[_0x47de('0x8')](_0x47de('0x9'),util['format'](_0x47de('0xa'),_0x569188,_0x42eac1,_0x2b4071));var _0x46a8b3=_0x445ac7[_0x47de('0xb')](_0xa01b09,_0x47de('0xc'),'utf8');_0x46a8b3+=_0x445ac7[_0x47de('0xd')](_0x47de('0xe'));var _0x525127=JSON[_0x47de('0xf')](_0x46a8b3);return _0x525127[_0x47de('0x10')](_0x65cb89)?_0x525127[_0x65cb89]:null;}}return null;}function isLimit(_0x56d520,_0x395ef1,_0x2a5c0a,_0x59f354){var _0x13ed57=_0x395ef1;return compose()[_0x47de('0x11')](function(_0x3e6661,_0x18b7f9,_0x19c558){return db[_0x47de('0x12')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x4ba78a){var _0x1e20c4=getValueFromLicense(_0x56d520,_0x4ba78a);return _0x1e20c4?_0x1e20c4:_0x13ed57;})[_0x47de('0x13')](function(_0x4b7c1b){_0x13ed57=_0x4b7c1b;return _0x2a5c0a[_0x47de('0x14')](_0x59f354);})[_0x47de('0x13')](function(_0x1600eb){if(_0x1600eb>=_0x13ed57){return _0x18b7f9[_0x47de('0x15')](0x193)[_0x47de('0x16')]({'message':util[_0x47de('0x17')](_0x47de('0x18'),_0x56d520)});}_0x19c558();})[_0x47de('0x19')](function(_0x5d1a6c){_0x19c558(_0x5d1a6c);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x47de('0x1a')],{'where':{'$or':[{'role':_0x47de('0x1b')},{'role':_0x47de('0x1c')}]}});}exports[_0x47de('0x1d')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8493a31..bc75253 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 _0xd7de=['buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$ne','$notIn','text','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','$between','utcOffset','format','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','split','length','forEach','shift','match','filter','map','conditions','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7de,0x12d));var _0xed7d=function(_0x1f0bc5,_0x51ddd5){_0x1f0bc5=_0x1f0bc5-0x0;var _0x16994d=_0xd7de[_0x1f0bc5];return _0x16994d;};'use strict';var _=require(_0xed7d('0x0'));var moment=require(_0xed7d('0x1'));exports[_0xed7d('0x2')]=function(_0xb7fc2b){var _0x52f6f1={'conditions':[]};_0x52f6f1[_0xed7d('0x3')]=_[_0xed7d('0x4')](_0xb7fc2b,_0xed7d('0x5'))?'or':'and';var _0x1db4ac=_0xb7fc2b[_0xed7d('0x6')](_0xed7d('0x7'),'')[_0xed7d('0x6')](_0xed7d('0x5'),'')[_0xed7d('0x8')]('||');for(var _0x1e1710=0x0;_0x1e1710<_0x1db4ac[_0xed7d('0x9')];_0x1e1710++){var _0x2d622e=_0x1db4ac[_0x1e1710][_0xed7d('0x8')](':=');var _0x5e47c8=_0x2d622e[0x0];var _0x4ab16e=_0x2d622e['slice'](0x1);_0x4ab16e[_0xed7d('0xa')](function(_0x9c0275){var _0x48fb8f=_0x9c0275[_0xed7d('0x8')]('[')[_0xed7d('0xb')]();var _0x3989cd=_0x9c0275[_0xed7d('0xc')](/\[(.*?)\]/g);_0x3989cd['forEach'](function(_0x48df8a){var _0x11ce09=_0x48df8a['split']('[')[_0xed7d('0xd')](function(_0x43547d){return _0x43547d['indexOf'](']')>-0x1;})[_0xed7d('0xe')](function(_0x9eaf94){return _0x9eaf94[_0xed7d('0x8')](']')[0x0];})[0x0];_0x52f6f1[_0xed7d('0xf')][_0xed7d('0x10')]({'field':_0x5e47c8,'operator':_0x48fb8f,'value':_0x11ce09});});});}return _0x52f6f1;};exports[_0xed7d('0x11')]=function(_0x2f4383,_0x2714c5,_0x4ee16e){var _0x3c3113={};if(_0x2714c5===_0xed7d('0x12')){if(_0x4ee16e[_0xed7d('0x13')]===_0xed7d('0x14')){_0x4ee16e['operator']='$between';_0x4ee16e[_0xed7d('0x15')]+=','+_0x4ee16e[_0xed7d('0x15')];}else if(_[_0xed7d('0x16')]([_0xed7d('0x17'),_0xed7d('0x18')],_0x4ee16e[_0xed7d('0x13')])){_0x4ee16e[_0xed7d('0x15')]=moment(_0x4ee16e[_0xed7d('0x15')])[_0xed7d('0x19')](0x1,_0xed7d('0x1a'))['format'](_0xed7d('0x1b'));}}if(_0x4ee16e[_0xed7d('0x1c')]){_0x2714c5=_0x4ee16e['castTo'];_0x3c3113['text']=_0xed7d('0x1d')+_0x2f4383+'.'+_0x4ee16e[_0xed7d('0x1e')]+_0xed7d('0x1f')+_0x4ee16e[_0xed7d('0x1c')]+')\x20'+parseOperator(_0x4ee16e[_0xed7d('0x13')]);}else{_0x3c3113['text']=_0x2f4383+'.'+_0x4ee16e['field']+'\x20'+parseOperator(_0x4ee16e[_0xed7d('0x13')]);}if(_[_0xed7d('0x16')]([_0xed7d('0x20'),_0xed7d('0x21')],_0x4ee16e[_0xed7d('0x13')]))_0x3c3113[_0xed7d('0x22')]='('+_0x3c3113[_0xed7d('0x22')]+'\x20OR\x20'+_0x2f4383+'.'+_0x4ee16e['field']+_0xed7d('0x23');_0x3c3113[_0xed7d('0x15')]=parseValue(_0x2714c5,_0x4ee16e[_0xed7d('0x13')],_0x4ee16e['value']);return _0x3c3113;};function parseOperator(_0x490b22){var _0x2e9d7a;switch(_0x490b22){case _0xed7d('0x24'):_0x2e9d7a='IN\x20?';break;case _0xed7d('0x21'):_0x2e9d7a=_0xed7d('0x25');break;case _0xed7d('0x14'):_0x2e9d7a='=\x20?';break;case _0xed7d('0x20'):_0x2e9d7a=_0xed7d('0x26');break;case _0xed7d('0x27'):case _0xed7d('0x28'):case _0xed7d('0x29'):_0x2e9d7a=_0xed7d('0x2a');break;case'$lt':_0x2e9d7a=_0xed7d('0x2b');break;case _0xed7d('0x17'):_0x2e9d7a=_0xed7d('0x2c');break;case'$lte':_0x2e9d7a=_0xed7d('0x2d');break;case _0xed7d('0x2e'):_0x2e9d7a=_0xed7d('0x2f');break;case'$between':_0x2e9d7a='BETWEEN\x20?\x20AND\x20?';break;}return _0x2e9d7a;}function parseValue(_0x7e7e2a,_0x25fa72,_0x4a3868){var _0x39dd1e={'start':undefined,'end':undefined};switch(_0x25fa72){case _0xed7d('0x24'):case _0xed7d('0x21'):_0x39dd1e[_0xed7d('0x30')]=_0x4a3868[_0xed7d('0x8')](',');break;case _0xed7d('0x27'):_0x39dd1e[_0xed7d('0x30')]='%'+_0x4a3868+'%';break;case'$startsWith':_0x39dd1e[_0xed7d('0x30')]=_0x4a3868+'%';break;case _0xed7d('0x29'):_0x39dd1e[_0xed7d('0x30')]='%'+_0x4a3868;break;case _0xed7d('0x31'):var _0x24bfd8=_0x4a3868['split'](',');var _0x4a3868=_0x24bfd8[_0xed7d('0xb')]();var _0x47aad8=_0x24bfd8['pop']();if(_0x7e7e2a==='DATE'){_0x4a3868=moment(_0x4a3868)[_0xed7d('0x32')](0x0,!![])[_0xed7d('0x33')]();_0x47aad8=moment(_0x47aad8)[_0xed7d('0x32')](0x0,!![])['add'](0x17,'hours')[_0xed7d('0x19')](0x3b,_0xed7d('0x34'))['add'](0x3b,'seconds')[_0xed7d('0x33')]();}_0x39dd1e={'start':_0x4a3868,'end':_0x47aad8};break;default:_0x39dd1e[_0xed7d('0x30')]=_0x4a3868;break;}return _0x39dd1e;} \ No newline at end of file +var _0x157e=['$gt','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','\x20OR\x20','\x20IS\x20NULL)','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','pop','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes'];(function(_0x19fc2f,_0x2509a1){var _0x24a68f=function(_0x544062){while(--_0x544062){_0x19fc2f['push'](_0x19fc2f['shift']());}};_0x24a68f(++_0x2509a1);}(_0x157e,0x1be));var _0xe157=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x157e[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xe157('0x0'));var moment=require(_0xe157('0x1'));exports[_0xe157('0x2')]=function(_0x5d0e41){var _0x32a9f4={'conditions':[]};_0x32a9f4[_0xe157('0x3')]=_[_0xe157('0x4')](_0x5d0e41,_0xe157('0x5'))?'or':_0xe157('0x6');var _0x54c344=_0x5d0e41['replace'](_0xe157('0x7'),'')[_0xe157('0x8')]('[$or]','')[_0xe157('0x9')]('||');for(var _0x5d342=0x0;_0x5d342<_0x54c344[_0xe157('0xa')];_0x5d342++){var _0xd6f813=_0x54c344[_0x5d342]['split'](':=');var _0x197cd7=_0xd6f813[0x0];var _0x414206=_0xd6f813[_0xe157('0xb')](0x1);_0x414206[_0xe157('0xc')](function(_0x26c8ac){var _0xd0539f=_0x26c8ac[_0xe157('0x9')]('[')[_0xe157('0xd')]();var _0x4dab38=_0x26c8ac['match'](/\[(.*?)\]/g);_0x4dab38[_0xe157('0xc')](function(_0x3abcf1){var _0x58706b=_0x3abcf1[_0xe157('0x9')]('[')[_0xe157('0xe')](function(_0x49c287){return _0x49c287[_0xe157('0xf')](']')>-0x1;})[_0xe157('0x10')](function(_0x4d1ae7){return _0x4d1ae7[_0xe157('0x9')](']')[0x0];})[0x0];_0x32a9f4[_0xe157('0x11')][_0xe157('0x12')]({'field':_0x197cd7,'operator':_0xd0539f,'value':_0x58706b});});});}return _0x32a9f4;};exports[_0xe157('0x13')]=function(_0x4169e7,_0x2746d6,_0x2f9437){var _0x32237d={};if(_0x2746d6===_0xe157('0x14')){if(_0x2f9437[_0xe157('0x15')]===_0xe157('0x16')){_0x2f9437[_0xe157('0x15')]=_0xe157('0x17');_0x2f9437[_0xe157('0x18')]+=','+_0x2f9437[_0xe157('0x18')];}else if(_[_0xe157('0x19')]([_0xe157('0x1a'),_0xe157('0x1b')],_0x2f9437[_0xe157('0x15')])){_0x2f9437[_0xe157('0x18')]=moment(_0x2f9437[_0xe157('0x18')])[_0xe157('0x1c')](0x1,_0xe157('0x1d'))[_0xe157('0x1e')](_0xe157('0x1f'));}}if(_0x2f9437[_0xe157('0x20')]){_0x2746d6=_0x2f9437['castTo'];_0x32237d['text']=_0xe157('0x21')+_0x4169e7+'.'+_0x2f9437[_0xe157('0x22')]+_0xe157('0x23')+_0x2f9437[_0xe157('0x20')]+')\x20'+parseOperator(_0x2f9437[_0xe157('0x15')]);}else{_0x32237d['text']=_0x4169e7+'.'+_0x2f9437[_0xe157('0x22')]+'\x20'+parseOperator(_0x2f9437[_0xe157('0x15')]);}if(_['includes'](['$ne','$notIn'],_0x2f9437[_0xe157('0x15')]))_0x32237d[_0xe157('0x24')]='('+_0x32237d['text']+_0xe157('0x25')+_0x4169e7+'.'+_0x2f9437[_0xe157('0x22')]+_0xe157('0x26');_0x32237d['value']=parseValue(_0x2746d6,_0x2f9437[_0xe157('0x15')],_0x2f9437['value']);return _0x32237d;};function parseOperator(_0xae629){var _0xb5bfbc;switch(_0xae629){case'$in':_0xb5bfbc='IN\x20?';break;case _0xe157('0x27'):_0xb5bfbc=_0xe157('0x28');break;case'$eq':_0xb5bfbc=_0xe157('0x29');break;case _0xe157('0x2a'):_0xb5bfbc=_0xe157('0x2b');break;case _0xe157('0x2c'):case'$startsWith':case _0xe157('0x2d'):_0xb5bfbc=_0xe157('0x2e');break;case _0xe157('0x2f'):_0xb5bfbc=_0xe157('0x30');break;case _0xe157('0x1a'):_0xb5bfbc=_0xe157('0x31');break;case _0xe157('0x1b'):_0xb5bfbc='<=\x20?';break;case _0xe157('0x32'):_0xb5bfbc='>=\x20?';break;case _0xe157('0x17'):_0xb5bfbc=_0xe157('0x33');break;}return _0xb5bfbc;}function parseValue(_0x36c637,_0x303d82,_0x11b39e){var _0xd545a5={'start':undefined,'end':undefined};switch(_0x303d82){case _0xe157('0x34'):case _0xe157('0x27'):_0xd545a5[_0xe157('0x35')]=_0x11b39e[_0xe157('0x9')](',');break;case'$substring':_0xd545a5[_0xe157('0x35')]='%'+_0x11b39e+'%';break;case _0xe157('0x36'):_0xd545a5[_0xe157('0x35')]=_0x11b39e+'%';break;case _0xe157('0x2d'):_0xd545a5[_0xe157('0x35')]='%'+_0x11b39e;break;case'$between':var _0x236a52=_0x11b39e[_0xe157('0x9')](',');var _0x11b39e=_0x236a52[_0xe157('0xd')]();var _0x46519e=_0x236a52[_0xe157('0x37')]();if(_0x36c637==='DATE'){_0x11b39e=moment(_0x11b39e)[_0xe157('0x38')](0x0,!![])[_0xe157('0x1e')]();_0x46519e=moment(_0x46519e)[_0xe157('0x38')](0x0,!![])[_0xe157('0x1c')](0x17,_0xe157('0x39'))[_0xe157('0x1c')](0x3b,_0xe157('0x3a'))[_0xe157('0x1c')](0x3b,'seconds')[_0xe157('0x1e')]();}_0xd545a5={'start':_0x11b39e,'end':_0x46519e};break;default:_0xd545a5[_0xe157('0x35')]=_0x11b39e;break;}return _0xd545a5;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index eea869f..3789320 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 _0x7651=['format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','map','priority','cast','unsigned','col','omit','isEmpty','isArray','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','limit','offset','sort','where','pick','object','filter','columns','value','VIRTUAL','lower','merge','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','forOwn','find','type','DATE','isPlainObject'];(function(_0x4b13a0,_0x2aec2a){var _0x486759=function(_0x534ad9){while(--_0x534ad9){_0x4b13a0['push'](_0x4b13a0['shift']());}};_0x486759(++_0x2aec2a);}(_0x7651,0xaf));var _0x1765=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7651[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1765('0x0'));var sequelize=require(_0x1765('0x1'));var moment=require(_0x1765('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xf59e1a){var _0x2eb2d1=['ne'];try{var _0x4c60b3=JSON[_0x1765('0x3')](_0xf59e1a);var _0x192379=Object[_0x1765('0x4')](_0x4c60b3)[0x0];return _0x2eb2d1[_0x1765('0x5')](_0x192379);}catch(_0x152e93){return![];}}function getOperatorValue(_0x49faec){var _0x5788ac=JSON['parse'](_0x49faec);var _0x5d1778=Object[_0x1765('0x4')](_0x5788ac)[0x0];var _0x574536=_0x5788ac[_0x5d1778];return{['$'+_0x5d1778]:_0x574536};}exports[_0x1765('0x6')]=function(_0x4a546a){var _0xa02a07=null;if(_0x4a546a){_0xa02a07=_0x4a546a[_0x1765('0x7')](',');}return _0xa02a07;};exports[_0x1765('0x8')]=function(_0x19021d,_0x9d0aa2){var _0x1cc950={};if(!_['isEmpty'](_0x19021d)){_[_0x1765('0x9')](_0x19021d,function(_0x21997d,_0xbbda21){try{if(_0x9d0aa2){var _0x13bc19=_[_0x1765('0xa')](_0x9d0aa2,{'name':_0xbbda21})||{};if(hasSequelizeOperator(_0x21997d)){_0x1cc950[_0xbbda21]=getOperatorValue(_0x21997d);}else if(_0x13bc19[_0x1765('0xb')]===_0x1765('0xc')&&_[_0x1765('0xd')](_0x21997d)){var _0x117380=JSON['parse'](_0x21997d);var _0x44ca88={'$gte':moment(moment(_0x117380['$gte'])[_0x1765('0xe')](_0x1765('0xf')))[_0x1765('0x10')]()[_0x1765('0xe')](),'$lte':moment(moment(_0x117380[_0x1765('0x11')])[_0x1765('0xe')](_0x1765('0xf')))[_0x1765('0x10')]()[_0x1765('0x12')](0x1,'s')[_0x1765('0xe')]()};_0x1cc950[_0xbbda21]=_0x44ca88;}else if(_0x13bc19[_0x1765('0x13')]===_0x1765('0x14')){_0x1cc950[_0xbbda21]=_0x21997d;}else{_0x1cc950[_0xbbda21]=_['isArray'](_0x21997d)?_0x21997d:JSON[_0x1765('0x3')](_0x21997d);}}else{_0x1cc950[_0xbbda21]=_['isArray'](_0x21997d)?_0x21997d:JSON[_0x1765('0x3')](_0x21997d);}}catch(_0x3985ab){_0x1cc950[_0xbbda21]=_0x21997d[_0x1765('0x7')](',');}});}return _0x1cc950;};exports['limit']=function(_0x2d84de){_0x2d84de=parseInt(_0x2d84de,0xa);if(!_0x2d84de||_0x2d84de<0x0){_0x2d84de=LIMIT_VALUE;}return _0x2d84de;};exports['offset']=function(_0x25dbb8){_0x25dbb8=parseInt(_0x25dbb8,0xa);if(!_0x25dbb8||_0x25dbb8<0x0){_0x25dbb8=0x0;}return _0x25dbb8;};exports['sort']=function(_0x3f3932){var _0x2d6447,_0x32d8ba=null;if(_0x3f3932){_0x2d6447=_0x3f3932[_0x1765('0x7')](',');_0x32d8ba=_[_0x1765('0x15')](_0x2d6447,function(_0x13b865){if(_0x13b865['indexOf']('-')===0x0){return[_0x13b865===_0x1765('0x16')?sequelize[_0x1765('0x17')](sequelize['col'](_0x1765('0x16')),_0x1765('0x18')):_0x13b865['substr'](0x1),'DESC'];}else{return[_0x13b865===_0x1765('0x16')?sequelize['cast'](sequelize[_0x1765('0x19')]('priority'),_0x1765('0x18')):_0x13b865,'ASC'];}});}return _0x32d8ba;};exports[_0x1765('0x1a')]=function(_0x4f557c,_0x5bc8ed){if(_[_0x1765('0x1b')](_0x4f557c)){return _0x4f557c;}if(_[_0x1765('0x1c')](_0x4f557c)){for(var _0x30c379=0x0;_0x30c379<_0x4f557c[_0x1765('0x1d')];_0x30c379+=0x1){_0x4f557c[_0x30c379]=this['omit'](_0x4f557c[_0x30c379],_0x5bc8ed);}return _0x4f557c;}if(!_[_0x1765('0x1e')](_0x4f557c)){return _0x4f557c;}if(_['isString'](_0x5bc8ed)){_0x5bc8ed=[_0x5bc8ed];}if(!_[_0x1765('0x1c')](_0x5bc8ed)){return _0x4f557c;}for(var _0x2192cd=0x0;_0x2192cd<_0x5bc8ed[_0x1765('0x1d')];_0x2192cd+=0x1){_[_0x1765('0x1f')](_0x4f557c,_0x5bc8ed[_0x2192cd]);}for(var _0x283f65 in _0x4f557c){if(_0x4f557c[_0x1765('0x20')](_0x283f65)){_0x4f557c[_0x283f65]=this[_0x1765('0x1a')](_0x4f557c[_0x283f65],_0x5bc8ed);}}return _0x4f557c;};exports[_0x1765('0x21')]=function(_0x55eaf8){return _0x55eaf8[_0x1765('0x22')](RegExp(_0x1765('0x23')))?!![]:![];};exports[_0x1765('0x24')]=function(_0x5b9b3c){return _0x5b9b3c[_0x1765('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x44eed1,_0x515ae8){var _0xda6637=[];var _0x4fa414=/[ `!@#$%^&*()_\-?~]/;var _0x45a524=_0x515ae8?_0x1765('0x25'):_0x1765('0x26');_0x44eed1[_0x1765('0x7')](/[ ,]+/)[_0x1765('0x27')](function(_0x50f5a3){_0x50f5a3=_0x50f5a3[_0x1765('0x28')](/([^:]")"+/g,'$1');_0x50f5a3='+'+_0x50f5a3+'*';var _0x5ddeb8=_0x50f5a3[_0x1765('0x22')](_0x4fa414);if(_0x5ddeb8){_0x50f5a3='\x22'+_0x50f5a3+'\x22';}_0xda6637[_0x1765('0x29')](_0x50f5a3);});_0x45a524=_0x45a524[_0x1765('0x28')](_0x1765('0x26'),_0xda6637[_0x1765('0x2a')]('\x20'));return _0x45a524;};exports[_0x1765('0x2b')]=function(_0x2b3412,_0x1191f3,_0x10f7b5){var _0x4bdb90={},_0x36c15b={};if(_0x1191f3[_0x1765('0x2c')][_0x1765('0x2d')]){_0x1191f3[_0x1765('0x2c')]['id']=_0x1191f3[_0x1765('0x2c')]['$id'];delete _0x1191f3[_0x1765('0x2c')][_0x1765('0x2d')];}_0x4bdb90[_0x1765('0x2e')]=_['map'](_0x2b3412,_0x1765('0x13'));_0x4bdb90[_0x1765('0x2c')]=_['keys'](_0x1191f3['query']);_0x4bdb90['filters']=_[_0x1765('0x2f')](_0x4bdb90[_0x1765('0x2e')],_0x4bdb90['query']);_0x36c15b[_0x1765('0x30')]=_['intersection'](_0x4bdb90[_0x1765('0x2e')],this[_0x1765('0x6')](_0x1191f3['query'][_0x1765('0x6')]));_0x36c15b['attributes']=_0x36c15b[_0x1765('0x30')][_0x1765('0x1d')]?_0x36c15b[_0x1765('0x30')]:_0x4bdb90[_0x1765('0x2e')];if(!_0x1191f3['query'][_0x1765('0x20')](_0x1765('0x31'))){_0x36c15b[_0x1765('0x32')]=this['limit'](_0x1191f3[_0x1765('0x2c')][_0x1765('0x32')]);_0x36c15b[_0x1765('0x33')]=this[_0x1765('0x33')](_0x1191f3[_0x1765('0x2c')][_0x1765('0x33')]);}_0x36c15b['order']=this[_0x1765('0x34')](_0x1191f3[_0x1765('0x2c')][_0x1765('0x34')]);_0x36c15b[_0x1765('0x35')]=this['filters'](_[_0x1765('0x36')](_0x1191f3[_0x1765('0x2c')],_0x4bdb90[_0x1765('0x8')]),_0x2b3412);if(_0x1191f3[_0x1765('0x2c')]['filter']){var _0x2f8df8=_0x2b3412;var _0x4ddade=_0x1191f3[_0x1765('0x2c')]['filter'];if(typeof _0x4ddade===_0x1765('0x37')){_0x2f8df8=_[_0x1765('0x38')](_0x2b3412,function(_0x4986df){return _['includes'](_0x4ddade[_0x1765('0x39')],_0x4986df[_0x1765('0x13')]);});_0x4ddade=_0x4ddade[_0x1765('0x3a')];}_0x36c15b[_0x1765('0x35')]=_['merge'](_0x36c15b[_0x1765('0x35')],{'$or':_['map'](_0x2f8df8,function(_0x46a148){if(_0x46a148[_0x1765('0xb')]!==_0x1765('0x3b')){if(_0x10f7b5){return sequelize['where'](sequelize['fn'](_0x1765('0x3c'),sequelize[_0x1765('0x19')](_0x46a148[_0x1765('0x13')])),{'$like':sequelize['fn'](_0x1765('0x3c'),'%'+_0x1191f3[_0x1765('0x2c')][_0x1765('0x38')]+'%')});}else{var _0xf27294={};_0xf27294[_0x46a148[_0x1765('0x13')]]={'$like':'%'+_0x1191f3[_0x1765('0x2c')][_0x1765('0x38')]+'%'};return _0xf27294;}}})});}_0x36c15b=_[_0x1765('0x3d')]({},_0x36c15b,_0x1191f3[_0x1765('0x3e')]);return _0x36c15b;}; \ No newline at end of file +var _0xe335=['forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','limit','order','sort','where','pick','filter','object','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','keys','includes','parse','fields','split','filters','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','map','indexOf','priority','unsigned','col','ASC','omit','isObject','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}'];(function(_0x340beb,_0x4987fa){var _0x431575=function(_0x1f66be){while(--_0x1f66be){_0x340beb['push'](_0x340beb['shift']());}};_0x431575(++_0x4987fa);}(_0xe335,0x1de));var _0x5e33=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe335[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x5e33('0x0'));var sequelize=require(_0x5e33('0x1'));var moment=require(_0x5e33('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x289974){var _0x16ed45=['ne'];try{var _0x2d72ce=JSON['parse'](_0x289974);var _0x2ed304=Object[_0x5e33('0x3')](_0x2d72ce)[0x0];return _0x16ed45[_0x5e33('0x4')](_0x2ed304);}catch(_0x190f63){return![];}}function getOperatorValue(_0x5a7952){var _0x13f5ed=JSON[_0x5e33('0x5')](_0x5a7952);var _0x33aba7=Object['keys'](_0x13f5ed)[0x0];var _0x5dcca1=_0x13f5ed[_0x33aba7];return{['$'+_0x33aba7]:_0x5dcca1};}exports[_0x5e33('0x6')]=function(_0x21b273){var _0x3d65fd=null;if(_0x21b273){_0x3d65fd=_0x21b273[_0x5e33('0x7')](',');}return _0x3d65fd;};exports[_0x5e33('0x8')]=function(_0x465574,_0x56128f){var _0x546a59={};if(!_[_0x5e33('0x9')](_0x465574)){_[_0x5e33('0xa')](_0x465574,function(_0xc96d68,_0x404076){try{if(_0x56128f){var _0x1747b8=_[_0x5e33('0xb')](_0x56128f,{'name':_0x404076})||{};if(hasSequelizeOperator(_0xc96d68)){_0x546a59[_0x404076]=getOperatorValue(_0xc96d68);}else if(_0x1747b8[_0x5e33('0xc')]===_0x5e33('0xd')&&_['isPlainObject'](_0xc96d68)){var _0x4b0751=JSON[_0x5e33('0x5')](_0xc96d68);var _0x451139={'$gte':moment(moment(_0x4b0751[_0x5e33('0xe')])[_0x5e33('0xf')](_0x5e33('0x10')))[_0x5e33('0x11')]()['format'](),'$lte':moment(moment(_0x4b0751[_0x5e33('0x12')])['format'](_0x5e33('0x10')))[_0x5e33('0x11')]()[_0x5e33('0x13')](0x1,'s')['format']()};_0x546a59[_0x404076]=_0x451139;}else if(_0x1747b8[_0x5e33('0x14')]===_0x5e33('0x15')){_0x546a59[_0x404076]=_0xc96d68;}else{_0x546a59[_0x404076]=_[_0x5e33('0x16')](_0xc96d68)?_0xc96d68:JSON[_0x5e33('0x5')](_0xc96d68);}}else{_0x546a59[_0x404076]=_[_0x5e33('0x16')](_0xc96d68)?_0xc96d68:JSON['parse'](_0xc96d68);}}catch(_0x195f15){_0x546a59[_0x404076]=_0xc96d68[_0x5e33('0x7')](',');}});}return _0x546a59;};exports['limit']=function(_0x31fe98){_0x31fe98=parseInt(_0x31fe98,0xa);if(!_0x31fe98||_0x31fe98<0x0){_0x31fe98=LIMIT_VALUE;}return _0x31fe98;};exports[_0x5e33('0x17')]=function(_0x291bb2){_0x291bb2=parseInt(_0x291bb2,0xa);if(!_0x291bb2||_0x291bb2<0x0){_0x291bb2=0x0;}return _0x291bb2;};exports['sort']=function(_0xf7e40a){var _0x50d622,_0x58fd6c=null;if(_0xf7e40a){_0x50d622=_0xf7e40a['split'](',');_0x58fd6c=_[_0x5e33('0x18')](_0x50d622,function(_0x1d8fdc){if(_0x1d8fdc[_0x5e33('0x19')]('-')===0x0){return[_0x1d8fdc===_0x5e33('0x1a')?sequelize['cast'](sequelize['col']('priority'),_0x5e33('0x1b')):_0x1d8fdc['substr'](0x1),'DESC'];}else{return[_0x1d8fdc===_0x5e33('0x1a')?sequelize['cast'](sequelize[_0x5e33('0x1c')]('priority'),_0x5e33('0x1b')):_0x1d8fdc,_0x5e33('0x1d')];}});}return _0x58fd6c;};exports[_0x5e33('0x1e')]=function(_0x2caf5e,_0x263e09){if(_[_0x5e33('0x9')](_0x2caf5e)){return _0x2caf5e;}if(_['isArray'](_0x2caf5e)){for(var _0x77bed3=0x0;_0x77bed3<_0x2caf5e['length'];_0x77bed3+=0x1){_0x2caf5e[_0x77bed3]=this[_0x5e33('0x1e')](_0x2caf5e[_0x77bed3],_0x263e09);}return _0x2caf5e;}if(!_[_0x5e33('0x1f')](_0x2caf5e)){return _0x2caf5e;}if(_['isString'](_0x263e09)){_0x263e09=[_0x263e09];}if(!_[_0x5e33('0x16')](_0x263e09)){return _0x2caf5e;}for(var _0x3c77c1=0x0;_0x3c77c1<_0x263e09[_0x5e33('0x20')];_0x3c77c1+=0x1){_[_0x5e33('0x21')](_0x2caf5e,_0x263e09[_0x3c77c1]);}for(var _0x3ad99a in _0x2caf5e){if(_0x2caf5e[_0x5e33('0x22')](_0x3ad99a)){_0x2caf5e[_0x3ad99a]=this['omit'](_0x2caf5e[_0x3ad99a],_0x263e09);}}return _0x2caf5e;};exports[_0x5e33('0x23')]=function(_0x517ec3){return _0x517ec3[_0x5e33('0x24')](RegExp(_0x5e33('0x25')))?!![]:![];};exports[_0x5e33('0x26')]=function(_0x1338f4){return _0x1338f4[_0x5e33('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x5e33('0x27')]=function(_0x1ec1c6,_0x51b1fc){var _0x3a4e83=[];var _0x329776=/[ `!@#$%^&*()_\-?~]/;var _0x1410be=_0x51b1fc?_0x5e33('0x28'):_0x5e33('0x29');_0x1ec1c6[_0x5e33('0x7')](/[ ,]+/)[_0x5e33('0x2a')](function(_0x1320e0){_0x1320e0=_0x1320e0[_0x5e33('0x2b')](/([^:]")"+/g,'$1');_0x1320e0='+'+_0x1320e0+'*';var _0x55dbbf=_0x1320e0[_0x5e33('0x24')](_0x329776);if(_0x55dbbf){_0x1320e0='\x22'+_0x1320e0+'\x22';}_0x3a4e83[_0x5e33('0x2c')](_0x1320e0);});_0x1410be=_0x1410be[_0x5e33('0x2b')](_0x5e33('0x29'),_0x3a4e83[_0x5e33('0x2d')]('\x20'));return _0x1410be;};exports[_0x5e33('0x2e')]=function(_0x5f3ade,_0x329dfb,_0x1d16f2){var _0x16c1f9={},_0x40c83f={};if(_0x329dfb[_0x5e33('0x2f')][_0x5e33('0x30')]){_0x329dfb[_0x5e33('0x2f')]['id']=_0x329dfb[_0x5e33('0x2f')][_0x5e33('0x30')];delete _0x329dfb[_0x5e33('0x2f')][_0x5e33('0x30')];}_0x16c1f9[_0x5e33('0x31')]=_[_0x5e33('0x18')](_0x5f3ade,_0x5e33('0x14'));_0x16c1f9[_0x5e33('0x2f')]=_[_0x5e33('0x3')](_0x329dfb['query']);_0x16c1f9[_0x5e33('0x8')]=_[_0x5e33('0x32')](_0x16c1f9[_0x5e33('0x31')],_0x16c1f9[_0x5e33('0x2f')]);_0x40c83f[_0x5e33('0x33')]=_[_0x5e33('0x32')](_0x16c1f9[_0x5e33('0x31')],this[_0x5e33('0x6')](_0x329dfb[_0x5e33('0x2f')][_0x5e33('0x6')]));_0x40c83f['attributes']=_0x40c83f[_0x5e33('0x33')][_0x5e33('0x20')]?_0x40c83f[_0x5e33('0x33')]:_0x16c1f9['model'];if(!_0x329dfb[_0x5e33('0x2f')][_0x5e33('0x22')](_0x5e33('0x34'))){_0x40c83f['limit']=this[_0x5e33('0x35')](_0x329dfb['query'][_0x5e33('0x35')]);_0x40c83f[_0x5e33('0x17')]=this[_0x5e33('0x17')](_0x329dfb[_0x5e33('0x2f')][_0x5e33('0x17')]);}_0x40c83f[_0x5e33('0x36')]=this[_0x5e33('0x37')](_0x329dfb[_0x5e33('0x2f')][_0x5e33('0x37')]);_0x40c83f[_0x5e33('0x38')]=this[_0x5e33('0x8')](_[_0x5e33('0x39')](_0x329dfb[_0x5e33('0x2f')],_0x16c1f9[_0x5e33('0x8')]),_0x5f3ade);if(_0x329dfb[_0x5e33('0x2f')][_0x5e33('0x3a')]){var _0x204cf3=_0x5f3ade;var _0x2affea=_0x329dfb['query'][_0x5e33('0x3a')];if(typeof _0x2affea===_0x5e33('0x3b')){_0x204cf3=_[_0x5e33('0x3a')](_0x5f3ade,function(_0x3e3882){return _[_0x5e33('0x4')](_0x2affea['columns'],_0x3e3882['name']);});_0x2affea=_0x2affea[_0x5e33('0x3c')];}_0x40c83f['where']=_[_0x5e33('0x3d')](_0x40c83f['where'],{'$or':_[_0x5e33('0x18')](_0x204cf3,function(_0x13b3a8){if(_0x13b3a8[_0x5e33('0xc')]!==_0x5e33('0x3e')){if(_0x1d16f2){return sequelize[_0x5e33('0x38')](sequelize['fn'](_0x5e33('0x3f'),sequelize['col'](_0x13b3a8['name'])),{'$like':sequelize['fn'](_0x5e33('0x3f'),'%'+_0x329dfb[_0x5e33('0x2f')][_0x5e33('0x3a')]+'%')});}else{var _0x517ea6={};_0x517ea6[_0x13b3a8[_0x5e33('0x14')]]={'$like':'%'+_0x329dfb[_0x5e33('0x2f')][_0x5e33('0x3a')]+'%'};return _0x517ea6;}}})});}_0x40c83f=_[_0x5e33('0x3d')]({},_0x40c83f,_0x329dfb[_0x5e33('0x40')]);return _0x40c83f;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 469b28b..df2cddc 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 _0x796d=['globalStatus','getSortedAgentsIdsByStatus','split','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','toLowerCase','online','lastLoginAt','lastPauseAt','chatCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','filterAgentAttributes','lodash','../../mysqldb','http','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','isArray','map','findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','User','findAll','name','fullname','chatPause','faxPause','mailPause','pauseType','find'];(function(_0x2052f7,_0x3ccf3a){var _0x40dd5f=function(_0x4f3d0f){while(--_0x4f3d0f){_0x2052f7['push'](_0x2052f7['shift']());}};_0x40dd5f(++_0x3ccf3a);}(_0x796d,0xc6));var _0xd796=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x796d[_0x1d1d09];return _0x8827e;};'use strict';var _=require(_0xd796('0x0'));var jayson=require('jayson/promise');var db=require(_0xd796('0x1'))['db'];var amiClient=jayson['client'][_0xd796('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0xd796('0x2')]({'port':0x232c});function isAgentPaused(_0x562ed1,_0x541ca2){var _0x12af8c=[_0x562ed1['chatPause'],_0x562ed1['faxPause'],_0x562ed1['mailPause'],_0x562ed1[_0xd796('0x3')],_0x562ed1[_0xd796('0x4')],_0x562ed1[_0xd796('0x5')],_0x562ed1[_0xd796('0x6')]];if(!_0x541ca2)return _[_0xd796('0x7')](_0x12af8c);var _0x204594=_[_0xd796('0x8')](_0x12af8c);return _0x204594['length']>0x0&&_0x204594[_0xd796('0x9')]<_0x12af8c[_0xd796('0x9')]?!![]:![];}function isIdle(_0x3c2060){return _0x3c2060===_0xd796('0xa')||_0x3c2060===_0xd796('0xb')||_0x3c2060===_0xd796('0xc')||_0x3c2060==='ringing'||_[_0xd796('0xd')](_0x3c2060);}function isAgentIdle(_0x4da4d4){if(_0x4da4d4['voiceStatus']!==_0xd796('0xa')&&_0x4da4d4[_0xd796('0x5')]){_0x4da4d4[_0xd796('0xe')]=_0xd796('0xf');return![];}return _[_0xd796('0x7')]([_0x4da4d4[_0xd796('0x10')],_0x4da4d4[_0xd796('0x11')],_0x4da4d4[_0xd796('0x12')],_0x4da4d4[_0xd796('0x13')],_0x4da4d4[_0xd796('0x14')],_0x4da4d4['voiceStatus'],_0x4da4d4[_0xd796('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xd796('0x16')](_0xd796('0x17'),{})[_0xd796('0x18')](function(_0x1e3721){if(_0x1e3721['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x5d2441=_0x1e3721[_0xd796('0x19')];return routingClient['request']('Agents',{})['then'](function(_0x49acae){if(_0x49acae[_0xd796('0x1a')]){throw new Error(_0xd796('0x1b'));}var _0xe7f583=_0x49acae[_0xd796('0x19')];return _[_0xd796('0x1c')]({},_0x5d2441,_0xe7f583);});})[_0xd796('0x1d')](function(_0x4a4dcc){throw _0x4a4dcc;});}exports[_0xd796('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x108806){var _0x1ed89d=_0xd796('0xb');if(isAgentPaused(_0x108806))_0x1ed89d=_0xd796('0xf');else if(isAgentPaused(_0x108806,!![]))_0x1ed89d=_0xd796('0x1f');else if(isAgentIdle(_0x108806))_0x1ed89d=_0xd796('0xa');else _0x1ed89d=_0xd796('0x20');return _0x1ed89d;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x3a8736,_0x4ff8af){var _0x29b4f0=_[_0xd796('0x21')](_0x3a8736)?_0x3a8736:[_0x3a8736];var _0x42f449=_['startCase'](_0x4ff8af)+'Queue';var _0x3e7822=_[_0xd796('0x22')](_0x29b4f0,function(_0x3ac8f5){return db[_0x42f449][_0xd796('0x23')]({'where':{'id':_0x3ac8f5}})[_0xd796('0x18')](function(_0x22a6de){if(!_0x22a6de)return[];return _0x22a6de[_0xd796('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd796('0x25')](_0x3e7822)[_0xd796('0x18')](function(_0x10c98a){var _0x5f5c55=_(_0x10c98a)[_0xd796('0x26')]()['map']('id')['uniq']()[_0xd796('0x27')]();return _0x5f5c55;});}exports[_0xd796('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5aee68,_0x2ec023,_0x45d0b6){try{if(_0x2ec023[_0xd796('0x9')]>0x0){_0x5aee68=_0x5aee68['filter'](function(_0x49cc51){return _0x2ec023[_0xd796('0x29')](_0x49cc51['id']);});}var _0x30f698=_0x5aee68[_0xd796('0x8')](function(_0x47d34d){var _0x1c4d8f=_0xd796('0x20');if(isAgentIdle(_0x47d34d)){_0x1c4d8f='idle';}return _0x1c4d8f===_0x45d0b6;});return _['map'](_0x30f698,'id');}catch(_0x5773a9){throw _0x5773a9;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x41a6c6,_0x5ad68a,_0x5146f1){return Promise['resolve']()[_0xd796('0x18')](function(){if(_0x5ad68a[_0xd796('0x9')]>0x0){_0x41a6c6=_0x41a6c6['filter'](function(_0x59a5b8){return _0x5ad68a['includes'](_0x59a5b8['id']);});}return _0x41a6c6;})['then'](function(){return db[_0xd796('0x2a')][_0xd796('0x2b')]({'attributes':['id',_0xd796('0x2c'),_0xd796('0x2d'),_0xd796('0x2e'),_0xd796('0x2f'),_0xd796('0x30'),'openchannelPause',_0xd796('0x4'),_0xd796('0x5'),'whatsappPause',_0xd796('0x31')],'where':{'id':{'$in':_[_0xd796('0x22')](_0x41a6c6,'id')}},'raw':!![]});})['then'](function(_0x2188bc){return _0x2188bc[_0xd796('0x22')](function(_0x29f3f5){var _0x53f34c=_[_0xd796('0x32')](_0x41a6c6,['id',_0x29f3f5['id']]);var _0xa9b354=filterAgentAttributes(_0x53f34c);_[_0xd796('0x1c')](_0x29f3f5,_0xa9b354);_0x29f3f5[_0xd796('0x33')]=getAgentStatus(_0x29f3f5);return _0x29f3f5;});})[_0xd796('0x18')](function(_0x1faecd){var _0x5f2707=sortAgentsByStatus(_0x1faecd,_0x5146f1);return _['map'](_0x5f2707,'id');})[_0xd796('0x1d')](function(_0x22f9c2){throw _0x22f9c2;});}exports[_0xd796('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1a50a2){var _0x3c3f82={'fields':[],'order':null};var _0x53d003=_0x1a50a2[_0xd796('0x35')](',');_0x3c3f82['fields']=_[_0xd796('0x8')](_0x53d003,function(_0x248c20){if(!_0x248c20[_0xd796('0x29')](_0xd796('0x33'))){return!![];}_0x3c3f82['order']=_[_0xd796('0x36')](_0x248c20,'-')?_0xd796('0x37'):_0xd796('0x38');return![];});return _0x3c3f82;}exports[_0xd796('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x4a1d61){if(_0x4a1d61[_0xd796('0x29')]('fullname')&&!_0x4a1d61[_0xd796('0x29')](_0xd796('0x3a'))){var _0x35f85e=_0x4a1d61[_0xd796('0x3b')](0x0,_0x4a1d61['indexOf']('fullname'));_0x4a1d61+=','+_0x35f85e+'internal';}return _0x4a1d61;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x110992,_0x1c149e){var _0x23fbda=_0x110992['sort'](function(_0x5bdd62,_0x130ad5){if(_0x5bdd62[_0xd796('0x33')]===_0x130ad5[_0xd796('0x33')]){if(_0x5bdd62[_0xd796('0x33')]==='pause'){if(_0x1c149e===_0xd796('0x37')){return(_0x5bdd62[_0xd796('0x31')]||'')<(_0x130ad5['pauseType']||'')||_0x5bdd62[_0xd796('0x2d')][_0xd796('0x3c')]()>_0x130ad5[_0xd796('0x2d')][_0xd796('0x3c')]()?0x1:-0x1;}else{return(_0x5bdd62['pauseType']||'')<(_0x130ad5[_0xd796('0x31')]||'')||_0x5bdd62[_0xd796('0x2d')]['toLowerCase']()>_0x130ad5[_0xd796('0x2d')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1c149e===_0xd796('0x37')){return _0x5bdd62[_0xd796('0x2d')][_0xd796('0x3c')]()<_0x130ad5['fullname'][_0xd796('0x3c')]()?0x1:-0x1;}else{return _0x5bdd62[_0xd796('0x2d')]['toLowerCase']()<_0x130ad5['fullname'][_0xd796('0x3c')]()?-0x1:0x1;}}}else{if(_0x1c149e==='DESC'){return _0x5bdd62[_0xd796('0x33')]<_0x130ad5['globalStatus']?0x1:-0x1;}else{return _0x5bdd62[_0xd796('0x33')]<_0x130ad5[_0xd796('0x33')]?-0x1:0x1;}}});return _0x23fbda;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x623048){var _0x1363d0=['userpic',_0xd796('0x3d'),_0xd796('0x3e'),'lastPauseAt',_0xd796('0x31'),_0xd796('0x3f'),_0xd796('0x3a'),'address','chatPause',_0xd796('0x3'),'mailPause','smsPause',_0xd796('0x6'),_0xd796('0x2f'),_0xd796('0x5'),_0xd796('0x40'),'openchannelCapacity','mailCapacity',_0xd796('0x41'),_0xd796('0x42'),_0xd796('0x43'),'chatCurrentCapacity',_0xd796('0x44'),_0xd796('0x45'),_0xd796('0x46'),_0xd796('0x47'),_0xd796('0x48'),_0xd796('0x10'),_0xd796('0x13'),_0xd796('0x12'),'smsStatus',_0xd796('0x15'),_0xd796('0x11'),_0xd796('0xe'),_0xd796('0x49'),_0xd796('0x4a'),'mailStatusTime',_0xd796('0x4b'),'whatsappStatusTime','faxStatusTime','voiceStatusTime',_0xd796('0x4c'),'destconnectedlinenum',_0xd796('0x4d'),_0xd796('0x4e'),_0xd796('0x4f'),_0xd796('0x50')];var _0x24671b=[_0xd796('0x2e'),'openchannelPause','mailPause',_0xd796('0x4'),_0xd796('0x6'),_0xd796('0x2f'),_0xd796('0x5'),_0xd796('0x3d')];var _0x1a417f=_(_0x623048)['omit'](_0x24671b)[_0xd796('0x51')](_0x1363d0)[_0xd796('0x27')]();return _0x1a417f;}exports[_0xd796('0x52')]=filterAgentAttributes; \ No newline at end of file +var _0x5500=['online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','faxStatus','chatStatusTime','mailStatusTime','faxStatusTime','queue','phoneBarEnableScreenRecordingByAgent','omit','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','every','length','unknown','unavailable','ringing','voiceStatus','idle','pause','chatStatus','mailStatus','smsStatus','whatsappStatus','Agents','then','error','result','request','merge','catch','getRealtimeAgents','*pause','isArray','startCase','Queue','map','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','busy','findAll','fullname','voicePause','whatsappPause','pauseType','find','globalStatus','split','fields','startsWith','DESC','ASC','substring','indexOf','internal','sort','toLowerCase','sortAgentsByStatus'];(function(_0x9fdcc2,_0x47dc85){var _0x8b67=function(_0x4374e7){while(--_0x4374e7){_0x9fdcc2['push'](_0x9fdcc2['shift']());}};_0x8b67(++_0x47dc85);}(_0x5500,0x1b5));var _0x0550=function(_0x35de43,_0x49ab03){_0x35de43=_0x35de43-0x0;var _0x549883=_0x5500[_0x35de43];return _0x549883;};'use strict';var _=require(_0x0550('0x0'));var jayson=require(_0x0550('0x1'));var db=require(_0x0550('0x2'))['db'];var amiClient=jayson[_0x0550('0x3')][_0x0550('0x4')]({'port':0x232a});var routingClient=jayson[_0x0550('0x3')][_0x0550('0x4')]({'port':0x232c});function isAgentPaused(_0x360b9a,_0x4d23cb){var _0x37994d=[_0x360b9a[_0x0550('0x5')],_0x360b9a[_0x0550('0x6')],_0x360b9a[_0x0550('0x7')],_0x360b9a[_0x0550('0x8')],_0x360b9a[_0x0550('0x9')],_0x360b9a['voicePause'],_0x360b9a['whatsappPause']];if(!_0x4d23cb)return _[_0x0550('0xa')](_0x37994d);var _0x40e4d9=_['filter'](_0x37994d);return _0x40e4d9[_0x0550('0xb')]>0x0&&_0x40e4d9[_0x0550('0xb')]<_0x37994d[_0x0550('0xb')]?!![]:![];}function isIdle(_0x447481){return _0x447481==='idle'||_0x447481===_0x0550('0xc')||_0x447481===_0x0550('0xd')||_0x447481===_0x0550('0xe')||_['isNil'](_0x447481);}function isAgentIdle(_0x33422){if(_0x33422[_0x0550('0xf')]!==_0x0550('0x10')&&_0x33422['voicePause']){_0x33422['voiceStatus']=_0x0550('0x11');return![];}return _[_0x0550('0xa')]([_0x33422[_0x0550('0x12')],_0x33422['faxStatus'],_0x33422[_0x0550('0x13')],_0x33422['openchannelStatus'],_0x33422[_0x0550('0x14')],_0x33422[_0x0550('0xf')],_0x33422[_0x0550('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x0550('0x16'),{})[_0x0550('0x17')](function(_0x48bf41){if(_0x48bf41[_0x0550('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x327f25=_0x48bf41[_0x0550('0x19')];return routingClient[_0x0550('0x1a')]('Agents',{})[_0x0550('0x17')](function(_0x1d20a6){if(_0x1d20a6[_0x0550('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x2d17f2=_0x1d20a6[_0x0550('0x19')];return _[_0x0550('0x1b')]({},_0x327f25,_0x2d17f2);});})[_0x0550('0x1c')](function(_0x57cb72){throw _0x57cb72;});}exports[_0x0550('0x1d')]=getRealtimeAgents;function getAgentStatus(_0xb701ff){var _0x4763b4=_0x0550('0xc');if(isAgentPaused(_0xb701ff))_0x4763b4=_0x0550('0x11');else if(isAgentPaused(_0xb701ff,!![]))_0x4763b4=_0x0550('0x1e');else if(isAgentIdle(_0xb701ff))_0x4763b4=_0x0550('0x10');else _0x4763b4='busy';return _0x4763b4;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x426491,_0x913e4f){var _0x14e787=_[_0x0550('0x1f')](_0x426491)?_0x426491:[_0x426491];var _0x201acd=_[_0x0550('0x20')](_0x913e4f)+_0x0550('0x21');var _0x2de5e4=_[_0x0550('0x22')](_0x14e787,function(_0x3f2360){return db[_0x201acd]['findOne']({'where':{'id':_0x3f2360}})[_0x0550('0x17')](function(_0x12580a){if(!_0x12580a)return[];return _0x12580a['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x0550('0x23')](_0x2de5e4)['then'](function(_0x357cf2){var _0x5dabd1=_(_0x357cf2)[_0x0550('0x24')]()[_0x0550('0x22')]('id')[_0x0550('0x25')]()[_0x0550('0x26')]();return _0x5dabd1;});}exports[_0x0550('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1d45c4,_0x4c5807,_0x176961){try{if(_0x4c5807[_0x0550('0xb')]>0x0){_0x1d45c4=_0x1d45c4[_0x0550('0x28')](function(_0x17a82d){return _0x4c5807[_0x0550('0x29')](_0x17a82d['id']);});}var _0x2f87f8=_0x1d45c4['filter'](function(_0x58160e){var _0x5ec948=_0x0550('0x2a');if(isAgentIdle(_0x58160e)){_0x5ec948='idle';}return _0x5ec948===_0x176961;});return _['map'](_0x2f87f8,'id');}catch(_0x57f56d){throw _0x57f56d;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4b1f2d,_0x20a56e,_0x52210f){return Promise['resolve']()[_0x0550('0x17')](function(){if(_0x20a56e[_0x0550('0xb')]>0x0){_0x4b1f2d=_0x4b1f2d[_0x0550('0x28')](function(_0x1d066a){return _0x20a56e['includes'](_0x1d066a['id']);});}return _0x4b1f2d;})['then'](function(){return db['User'][_0x0550('0x2b')]({'attributes':['id','name',_0x0550('0x2c'),'chatPause',_0x0550('0x6'),'mailPause',_0x0550('0x8'),_0x0550('0x9'),_0x0550('0x2d'),_0x0550('0x2e'),_0x0550('0x2f')],'where':{'id':{'$in':_[_0x0550('0x22')](_0x4b1f2d,'id')}},'raw':!![]});})[_0x0550('0x17')](function(_0x1d8716){return _0x1d8716[_0x0550('0x22')](function(_0x33f207){var _0x7e4eff=_[_0x0550('0x30')](_0x4b1f2d,['id',_0x33f207['id']]);var _0x325985=filterAgentAttributes(_0x7e4eff);_['merge'](_0x33f207,_0x325985);_0x33f207[_0x0550('0x31')]=getAgentStatus(_0x33f207);return _0x33f207;});})[_0x0550('0x17')](function(_0x5caaa1){var _0x5a8211=sortAgentsByStatus(_0x5caaa1,_0x52210f);return _[_0x0550('0x22')](_0x5a8211,'id');})[_0x0550('0x1c')](function(_0x19c3b6){throw _0x19c3b6;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xd9f1c0){var _0x39d18f={'fields':[],'order':null};var _0x2ca9e3=_0xd9f1c0[_0x0550('0x32')](',');_0x39d18f[_0x0550('0x33')]=_[_0x0550('0x28')](_0x2ca9e3,function(_0x552f83){if(!_0x552f83['includes'](_0x0550('0x31'))){return!![];}_0x39d18f['order']=_[_0x0550('0x34')](_0x552f83,'-')?_0x0550('0x35'):_0x0550('0x36');return![];});return _0x39d18f;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x5d8f4f){if(_0x5d8f4f[_0x0550('0x29')](_0x0550('0x2c'))&&!_0x5d8f4f[_0x0550('0x29')]('internal')){var _0x4557b5=_0x5d8f4f[_0x0550('0x37')](0x0,_0x5d8f4f[_0x0550('0x38')](_0x0550('0x2c')));_0x5d8f4f+=','+_0x4557b5+_0x0550('0x39');}return _0x5d8f4f;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x240a36,_0x10faa9){var _0x469740=_0x240a36[_0x0550('0x3a')](function(_0x4d3d40,_0x4ca1b2){if(_0x4d3d40[_0x0550('0x31')]===_0x4ca1b2['globalStatus']){if(_0x4d3d40['globalStatus']===_0x0550('0x11')){if(_0x10faa9===_0x0550('0x35')){return(_0x4d3d40[_0x0550('0x2f')]||'')<(_0x4ca1b2['pauseType']||'')||_0x4d3d40['fullname'][_0x0550('0x3b')]()>_0x4ca1b2[_0x0550('0x2c')][_0x0550('0x3b')]()?0x1:-0x1;}else{return(_0x4d3d40['pauseType']||'')<(_0x4ca1b2['pauseType']||'')||_0x4d3d40[_0x0550('0x2c')][_0x0550('0x3b')]()>_0x4ca1b2['fullname'][_0x0550('0x3b')]()?-0x1:0x1;}}else{if(_0x10faa9===_0x0550('0x35')){return _0x4d3d40['fullname'][_0x0550('0x3b')]()<_0x4ca1b2[_0x0550('0x2c')][_0x0550('0x3b')]()?0x1:-0x1;}else{return _0x4d3d40[_0x0550('0x2c')][_0x0550('0x3b')]()<_0x4ca1b2[_0x0550('0x2c')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x10faa9===_0x0550('0x35')){return _0x4d3d40[_0x0550('0x31')]<_0x4ca1b2['globalStatus']?0x1:-0x1;}else{return _0x4d3d40['globalStatus']<_0x4ca1b2[_0x0550('0x31')]?-0x1:0x1;}}});return _0x469740;}exports[_0x0550('0x3c')]=sortAgentsByStatus;function filterAgentAttributes(_0x5ae956){var _0x16b77d=['userpic',_0x0550('0x3d'),_0x0550('0x3e'),_0x0550('0x3f'),_0x0550('0x2f'),_0x0550('0x3f'),_0x0550('0x39'),_0x0550('0x40'),'chatPause',_0x0550('0x8'),'mailPause',_0x0550('0x9'),_0x0550('0x2e'),'faxPause',_0x0550('0x2d'),_0x0550('0x41'),_0x0550('0x42'),_0x0550('0x43'),_0x0550('0x44'),_0x0550('0x45'),'faxCapacity','chatCurrentCapacity',_0x0550('0x46'),_0x0550('0x47'),_0x0550('0x48'),_0x0550('0x49'),'faxCurrentCapacity',_0x0550('0x12'),_0x0550('0x4a'),_0x0550('0x13'),_0x0550('0x14'),_0x0550('0x15'),_0x0550('0x4b'),_0x0550('0xf'),_0x0550('0x4c'),'openchannelStatusTime',_0x0550('0x4d'),'smsStatusTime','whatsappStatusTime',_0x0550('0x4e'),'voiceStatusTime',_0x0550('0x4f'),'destconnectedlinenum','screenrecording',_0x0550('0x50'),'phoneBarEnableAutomaticScreenRecording','routealias'];var _0x2363b3=['chatPause','openchannelPause','mailPause',_0x0550('0x9'),_0x0550('0x2e'),'faxPause',_0x0550('0x2d'),'online'];var _0x1eb3a8=_(_0x5ae956)[_0x0550('0x51')](_0x2363b3)['pick'](_0x16b77d)[_0x0550('0x26')]();return _0x1eb3a8;}exports[_0x0550('0x52')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index c146f60..89f3105 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 _0x5876=['merge','pick','initializeQueues','jayson/promise','client','http','loggedIn','paused','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','Trunk','startProgressive','erlangCalls','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','error','format','result','catch','inbound','concat','outbound','map','loggedInDb','available','waiting','find'];(function(_0x5c6a5e,_0x5343d5){var _0x187fed=function(_0x18e64a){while(--_0x18e64a){_0x5c6a5e['push'](_0x5c6a5e['shift']());}};_0x187fed(++_0x5343d5);}(_0x5876,0x17b));var _0x6587=function(_0x2b8347,_0x14e3f2){_0x2b8347=_0x2b8347-0x0;var _0x15e93e=_0x5876[_0x2b8347];return _0x15e93e;};'use strict';var _=require('lodash');var jayson=require(_0x6587('0x0'));var util=require('util');var amiClient=jayson[_0x6587('0x1')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x6587('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x6587('0x3'),_0x6587('0x4'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x6587('0x5'),_0x6587('0x6'),'loggedInDb',_0x6587('0x7'),_0x6587('0x8'),_0x6587('0x9'),_0x6587('0xa'),_0x6587('0xb'),_0x6587('0xc'),_0x6587('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x6587('0xe'),_0x6587('0xf'),_0x6587('0x10'),_0x6587('0x11'),'dialActive','dialMethod',_0x6587('0x12'),'startPredictive',_0x6587('0x13'),_0x6587('0x14'),'erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor',_0x6587('0x15'),_0x6587('0x16'),_0x6587('0x17'),'predictiveIntervalAvailable',_0x6587('0x18'),'predictiveIntervalAnsweredCalls',_0x6587('0x19'),_0x6587('0x1a'),_0x6587('0x1b'),_0x6587('0x1c')];function getRealtimeQueues(_0x433488,_0xb20d55){var _0x54befb=_0xb20d55===_0x6587('0x1d')?amiClient:routingClient;return _0x54befb[_0x6587('0x1e')](_[_0x6587('0x1f')](_0xb20d55)+'Queues',_0x433488)['then'](function(_0x515dfd){if(_0x515dfd[_0x6587('0x20')])throw new Error(util[_0x6587('0x21')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0xb20d55));return _0x515dfd[_0x6587('0x22')];})[_0x6587('0x23')](function(_0x5cb8c9){throw _0x5cb8c9;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x2cabcc,_0x381288,_0x297a83,_0x503693){var _0x58ea72=DEFAULT_QUEUE_ATTRIBUTES;if(_0x297a83===_0x6587('0x1d')){if(_0x503693===_0x6587('0x24')){_0x58ea72=_0x58ea72[_0x6587('0x25')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x503693===_0x6587('0x26')){_0x58ea72=_0x58ea72[_0x6587('0x25')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2cabcc[_0x6587('0x27')](function(_0x3ad6ee){var _0x5ca3d5=_0x3ad6ee['get']({'plain':!![]});_0x5ca3d5[_0x6587('0x4')]=0x0;_0x5ca3d5[_0x6587('0x28')]=0x0;_0x5ca3d5[_0x6587('0x3')]=0x0;_0x5ca3d5[_0x6587('0x29')]=0x0;_0x5ca3d5[_0x6587('0x2a')]=0x0;if(_0x297a83===_0x6587('0x1d')){_0x5ca3d5[_0x6587('0xb')]=0x0;_0x5ca3d5['busy']=0x0;if(_0x503693==='outbound'){_0x5ca3d5[_0x6587('0xe')]=0x0;_0x5ca3d5['originated']=0x0;}}var _0x47250e=_[_0x6587('0x2b')](_0x381288,['id',_0x5ca3d5['id']]);if(_0x47250e){_[_0x6587('0x2c')](_0x5ca3d5,_[_0x6587('0x2d')](_0x47250e,_0x58ea72));}return _0x5ca3d5;});}exports[_0x6587('0x2e')]=initializeQueues; \ No newline at end of file +var _0xfbe2=['erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','result','catch','getRealtimeQueues','inbound','outbound','concat','get','available','merge','pick','initializeQueues','lodash','util','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','ringing','talking','unavailable','pTalking','originated','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x2082dc,_0x15312c){var _0x1957ef=function(_0x2d0e63){while(--_0x2d0e63){_0x2082dc['push'](_0x2082dc['shift']());}};_0x1957ef(++_0x15312c);}(_0xfbe2,0x1a4));var _0x2fbe=function(_0x224573,_0x214106){_0x224573=_0x224573-0x0;var _0x11e82c=_0xfbe2[_0x224573];return _0x11e82c;};'use strict';var _=require(_0x2fbe('0x0'));var jayson=require('jayson/promise');var util=require(_0x2fbe('0x1'));var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x2fbe('0x2'),_0x2fbe('0x3'),_0x2fbe('0x4')];var VOICE_QUEUE_ATTRIBUTES=[_0x2fbe('0x5'),_0x2fbe('0x6'),_0x2fbe('0x7'),_0x2fbe('0x8'),'notInUse','onHold',_0x2fbe('0x9'),'ringInUse',_0x2fbe('0xa'),_0x2fbe('0xb'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x2fbe('0xc'),_0x2fbe('0xd'),'message',_0x2fbe('0xe'),_0x2fbe('0xf'),'dialMethod',_0x2fbe('0x10'),_0x2fbe('0x11'),_0x2fbe('0x12'),'erlangCalls',_0x2fbe('0x13'),_0x2fbe('0x14'),_0x2fbe('0x15'),_0x2fbe('0x16'),_0x2fbe('0x17'),'dialPredictiveIntervalMinThreshold',_0x2fbe('0x18'),_0x2fbe('0x19'),_0x2fbe('0x1a'),_0x2fbe('0x1b'),_0x2fbe('0x1c'),_0x2fbe('0x1d'),_0x2fbe('0x1e')];function getRealtimeQueues(_0x112b86,_0xea301){var _0x41f424=_0xea301===_0x2fbe('0x1f')?amiClient:routingClient;return _0x41f424[_0x2fbe('0x20')](_[_0x2fbe('0x21')](_0xea301)+_0x2fbe('0x22'),_0x112b86)[_0x2fbe('0x23')](function(_0x67eb05){if(_0x67eb05[_0x2fbe('0x24')])throw new Error(util[_0x2fbe('0x25')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0xea301));return _0x67eb05[_0x2fbe('0x26')];})[_0x2fbe('0x27')](function(_0x3fc8a3){throw _0x3fc8a3;});}exports[_0x2fbe('0x28')]=getRealtimeQueues;function initializeQueues(_0x1e20ab,_0x40c081,_0x251c4b,_0xea113c){var _0x2a2779=DEFAULT_QUEUE_ATTRIBUTES;if(_0x251c4b===_0x2fbe('0x1f')){if(_0xea113c===_0x2fbe('0x29')){_0x2a2779=_0x2a2779['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0xea113c===_0x2fbe('0x2a')){_0x2a2779=_0x2a2779[_0x2fbe('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1e20ab['map'](function(_0x4f7418){var _0x5db67d=_0x4f7418[_0x2fbe('0x2c')]({'plain':!![]});_0x5db67d[_0x2fbe('0x3')]=0x0;_0x5db67d[_0x2fbe('0x8')]=0x0;_0x5db67d[_0x2fbe('0x2')]=0x0;_0x5db67d[_0x2fbe('0x2d')]=0x0;_0x5db67d[_0x2fbe('0x4')]=0x0;if(_0x251c4b===_0x2fbe('0x1f')){_0x5db67d[_0x2fbe('0xa')]=0x0;_0x5db67d[_0x2fbe('0x5')]=0x0;if(_0xea113c===_0x2fbe('0x2a')){_0x5db67d['pTalking']=0x0;_0x5db67d['originated']=0x0;}}var _0x50d438=_['find'](_0x40c081,['id',_0x5db67d['id']]);if(_0x50d438){_[_0x2fbe('0x2e')](_0x5db67d,_[_0x2fbe('0x2f')](_0x50d438,_0x2a2779));}return _0x5db67d;});}exports[_0x2fbe('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 758e27e..9db2023 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(_0x5cc35f,_0x5acd94){var _0x3f33eb=function(_0x1af690){while(--_0x1af690){_0x5cc35f['push'](_0x5cc35f['shift']());}};_0x3f33eb(++_0x5acd94);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 80d37cb..77b0029 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 _0x2e9c=['execSync','../environment','networkInterfaces','keys','length','filter','IPv4','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process'];(function(_0x44d40e,_0x385d76){var _0x49fa79=function(_0x4325c4){while(--_0x4325c4){_0x44d40e['push'](_0x44d40e['shift']());}};_0x49fa79(++_0x385d76);}(_0x2e9c,0x1a0));var _0xc2e9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2e9c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc2e9('0x0'));var os=require('os');var crypto=require(_0xc2e9('0x1'));var machine=require(_0xc2e9('0x2'));var exec=require(_0xc2e9('0x3'))[_0xc2e9('0x4')];var config=require(_0xc2e9('0x5'));function getInterfaces(){var _0x4927d7=[];var _0x17a32b=os[_0xc2e9('0x6')]();var _0x19f91c=_['orderBy'](_[_0xc2e9('0x7')](_0x17a32b));for(var _0x266196=0x0;_0x266196<_0x19f91c[_0xc2e9('0x8')];_0x266196++){var _0x13a63a=_0x17a32b[_0x19f91c[_0x266196]][_0xc2e9('0x9')](function(_0x18e870){return _0x18e870['family']===_0xc2e9('0xa')&&_0x18e870[_0xc2e9('0xb')]===![];});_0x4927d7=_0x4927d7['concat'](_0x13a63a);}return _0x4927d7;}function getFirstInterface(){var _0x29427a=_['head'](getInterfaces());return{'macAddress':_0x29427a&&_0x29427a[_0xc2e9('0xc')]?_0x29427a[_0xc2e9('0xc')]:_0xc2e9('0xd'),'ipAddress':_0x29427a&&_0x29427a[_0xc2e9('0xe')]?_0x29427a[_0xc2e9('0xe')]:_0xc2e9('0xf')};}exports[_0xc2e9('0x10')]=getFirstInterface;function getCPUhash(){var _0x33bf51=_['orderBy'](os[_0xc2e9('0x11')]()[_0xc2e9('0x12')](function(_0x3e3dbd){return _0x3e3dbd[_0xc2e9('0x13')];}))['join'](':');return crypto[_0xc2e9('0x14')](_0xc2e9('0x15'))[_0xc2e9('0x16')](_0x33bf51)[_0xc2e9('0x17')](_0xc2e9('0x18'));}exports['getUuid']=function(){var _0x30cca1=os[_0xc2e9('0x19')]();var _0x4a81bb=/[0-9a-f-]{36}/;if(config[_0xc2e9('0x1a')]&&_0x4a81bb[_0xc2e9('0x1b')](config[_0xc2e9('0x1a')])){return config[_0xc2e9('0x1a')];}else if(_0x30cca1===_0xc2e9('0x1c')){return exec(_0xc2e9('0x1d'),{'encoding':_0xc2e9('0x1e')})[_0xc2e9('0x1f')]('\x0d\x0a','');}else{var _0x377c8b=getFirstInterface();var _0x1b2ad0=getCPUhash();var _0x2f9310=_0x1b2ad0+'|'+os[_0xc2e9('0x20')]()+'|'+_0x377c8b['macAddress']+'|'+_0x377c8b[_0xc2e9('0x21')];var _0x3d867d=crypto[_0xc2e9('0x14')](_0xc2e9('0x15'))['update'](_0x2f9310)[_0xc2e9('0x17')](_0xc2e9('0x18'));return _0x3d867d[_0xc2e9('0x22')](0x0,0x8)+'-'+_0x3d867d[_0xc2e9('0x22')](0x8,0xc)+'-'+_0x3d867d[_0xc2e9('0x22')](0xc,0x10)+'-'+_0x3d867d[_0xc2e9('0x22')](0x10,0x14)+'-'+_0x3d867d[_0xc2e9('0x22')](0x14);}}; \ No newline at end of file +var _0x517f=['networkInterfaces','orderBy','keys','length','filter','family','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','md5','update','substring','lodash','crypto','bimedia-machine-uuid','../environment'];(function(_0x1d6472,_0x55284a){var _0x5d4516=function(_0x5407dd){while(--_0x5407dd){_0x1d6472['push'](_0x1d6472['shift']());}};_0x5d4516(++_0x55284a);}(_0x517f,0x188));var _0xf517=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x517f[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xf517('0x0'));var os=require('os');var crypto=require(_0xf517('0x1'));var machine=require(_0xf517('0x2'));var exec=require('child_process')['execSync'];var config=require(_0xf517('0x3'));function getInterfaces(){var _0x100f5b=[];var _0x5aafa8=os[_0xf517('0x4')]();var _0x16ffd8=_[_0xf517('0x5')](_[_0xf517('0x6')](_0x5aafa8));for(var _0x3dbeb2=0x0;_0x3dbeb2<_0x16ffd8[_0xf517('0x7')];_0x3dbeb2++){var _0x374e09=_0x5aafa8[_0x16ffd8[_0x3dbeb2]][_0xf517('0x8')](function(_0x3498e2){return _0x3498e2[_0xf517('0x9')]==='IPv4'&&_0x3498e2[_0xf517('0xa')]===![];});_0x100f5b=_0x100f5b[_0xf517('0xb')](_0x374e09);}return _0x100f5b;}function getFirstInterface(){var _0x390850=_[_0xf517('0xc')](getInterfaces());return{'macAddress':_0x390850&&_0x390850[_0xf517('0xd')]?_0x390850[_0xf517('0xd')]:'00:00:00:00:00:00','ipAddress':_0x390850&&_0x390850[_0xf517('0xe')]?_0x390850[_0xf517('0xe')]:_0xf517('0xf')};}exports[_0xf517('0x10')]=getFirstInterface;function getCPUhash(){var _0x3ffec0=_['orderBy'](os[_0xf517('0x11')]()['map'](function(_0x78c4b2){return _0x78c4b2[_0xf517('0x12')];}))[_0xf517('0x13')](':');return crypto[_0xf517('0x14')]('md5')['update'](_0x3ffec0)['digest'](_0xf517('0x15'));}exports[_0xf517('0x16')]=function(){var _0x3378ef=os[_0xf517('0x17')]();var _0x240b61=/[0-9a-f-]{36}/;if(config[_0xf517('0x18')]&&_0x240b61[_0xf517('0x19')](config[_0xf517('0x18')])){return config[_0xf517('0x18')];}else if(_0x3378ef==='win32'){return exec(_0xf517('0x1a'),{'encoding':'utf8'})[_0xf517('0x1b')]('\x0d\x0a','');}else{var _0x2a70cd=getFirstInterface();var _0x17a5c8=getCPUhash();var _0x32cc0f=_0x17a5c8+'|'+os[_0xf517('0x1c')]()+'|'+_0x2a70cd['macAddress']+'|'+_0x2a70cd[_0xf517('0x1d')];var _0x756643=crypto[_0xf517('0x14')](_0xf517('0x1e'))[_0xf517('0x1f')](_0x32cc0f)['digest']('hex');return _0x756643[_0xf517('0x20')](0x0,0x8)+'-'+_0x756643[_0xf517('0x20')](0x8,0xc)+'-'+_0x756643[_0xf517('0x20')](0xc,0x10)+'-'+_0x756643[_0xf517('0x20')](0x10,0x14)+'-'+_0x756643['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9bae5e4..5b7ac7a 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 _0xa7bc=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7bc,0x131));var _0xca7b=function(_0x21bc2b,_0x1f9cd5){_0x21bc2b=_0x21bc2b-0x0;var _0x34b38a=_0xa7bc[_0x21bc2b];return _0x34b38a;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0xca7b('0x0'));var BPromise=require(_0xca7b('0x1'));var pkginfo=require(_0xca7b('0x2'))(module,_0xca7b('0x3'));var db=require(_0xca7b('0x4'))['db'];var encryptor=require(_0xca7b('0x5'));var hardware=require(_0xca7b('0x6'));var logger=require(_0xca7b('0x7'))(_0xca7b('0x8'));var HOST=_0xca7b('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xee100d){return new BPromise(function(_0x536f37,_0x39c1bb){var _0x2f4ca5=util[_0xca7b('0xa')](_0xca7b('0xb'),HOST,_0xee100d,module['exports'][_0xca7b('0x3')]);if(oldToken){_0x2f4ca5=util['format'](_0xca7b('0xc'),HOST,_0xee100d,module[_0xca7b('0xd')][_0xca7b('0x3')],oldToken);}var _0x3cc192={'uri':_0x2f4ca5,'method':_0xca7b('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3cc192)[_0xca7b('0xf')](function(_0x55cc92){_0x536f37(_0x55cc92);})[_0xca7b('0x10')](function(_0x5f4674){_0x39c1bb(_0x5f4674);});});}function manageLicense(_0x4bc5d7,_0x381aa7){var _0x5ba2ef=_0x381aa7[_0xca7b('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x5ba2ef[_0xca7b('0x12')]!==_0x4bc5d7&&!_0x5ba2ef[_0xca7b('0x13')]){oldToken=_0x5ba2ef[_0xca7b('0x12')];}httpRequest(_0x4bc5d7)[_0xca7b('0xf')](function(_0x119e20){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x119e20[_0xca7b('0x14')]){isOldTokenSent=![];if(!_0x5ba2ef['license']&&_0x5ba2ef[_0xca7b('0x8')]!=_0x119e20[_0xca7b('0x8')]||_0x5ba2ef[_0xca7b('0x8')]&&_0x5ba2ef['data2']){logger[_0xca7b('0x15')](_0xca7b('0x16'));}if(_0x5ba2ef[_0xca7b('0x8')]&&!_0x5ba2ef[_0xca7b('0x13')]&&_0x5ba2ef[_0xca7b('0x8')]!=_0x119e20[_0xca7b('0x8')]){logger['info'](_0xca7b('0x17'));}if(_0x5ba2ef[_0xca7b('0x8')]&&!_0x5ba2ef[_0xca7b('0x13')]&&_0x5ba2ef[_0xca7b('0x8')]==_0x119e20['license']){return _0x381aa7;}return _0x381aa7[_0xca7b('0x18')]({'data1':_0x4bc5d7,'data2':null,'license':_0x119e20[_0xca7b('0x8')]});}else{if(_0x119e20[_0xca7b('0x8')]||_0x5ba2ef[_0xca7b('0x8')]){if(!_0x5ba2ef['data2']){if(_0x5ba2ef[_0xca7b('0x12')]==_0x4bc5d7){GRAY_PERIOD_REASON=_0xca7b('0x19');logger[_0xca7b('0x15')](_0xca7b('0x1a'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xca7b('0x15')](_0xca7b('0x1b'),_0x5ba2ef[_0xca7b('0x12')],_0x4bc5d7);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xca7b('0x1c')](),moment()[_0xca7b('0xa')](_0xca7b('0x1d')));return _0x381aa7['update']({'data2':encryptor[_0xca7b('0x1e')](moment()[_0xca7b('0xa')](_0xca7b('0x1d')))});}else{if(moment()[_0xca7b('0x1f')](encryptor[_0xca7b('0x20')](_0x5ba2ef[_0xca7b('0x13')]),'days')>DAYS){logger[_0xca7b('0x15')](_0xca7b('0x21'),moment()['format'](_0xca7b('0x1d')));isOldTokenSent=![];return _0x381aa7[_0xca7b('0x18')]({'data1':_0x4bc5d7,'data2':null,'license':null});}}}else{if(_0x5ba2ef['data1']!=_0x4bc5d7){logger[_0xca7b('0x15')](_0xca7b('0x1b'),_0x5ba2ef[_0xca7b('0x12')],_0x4bc5d7);return _0x381aa7[_0xca7b('0x18')]({'data1':_0x4bc5d7,'data2':null,'license':null});}}}return _0x381aa7;})[_0xca7b('0xf')](function(_0x56fa43){_0x381aa7=_0x56fa43;})[_0xca7b('0x10')](function(_0x24bc0d){logger[_0xca7b('0x22')](_0x24bc0d[_0xca7b('0x23')]);})[_0xca7b('0x24')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x381aa7);},TIME);});}function defaultLicense(){var _0x59c60e=hardware['getUuid']();if(_0x59c60e){return db[_0xca7b('0x25')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x59c60e}})[_0xca7b('0x26')](function(_0xca28fc,_0x46e885){logger[_0xca7b('0x15')](_0xca7b('0x27'),_0x59c60e);manageLicense(_0x59c60e,_0xca28fc);})[_0xca7b('0x10')](function(_0x303451){logger[_0xca7b('0x22')](_0x303451['message']);});}}exports[_0xca7b('0x28')]=defaultLicense; \ No newline at end of file +var _0x3a35=['bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment'];(function(_0xf077cb,_0x11cfa6){var _0x5549d9=function(_0x131d90){while(--_0x131d90){_0xf077cb['push'](_0xf077cb['shift']());}};_0x5549d9(++_0x11cfa6);}(_0x3a35,0x12b));var _0x53a3=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x3a35[_0x3635ce];return _0x97ecd0;};'use strict';var util=require(_0x53a3('0x0'));var moment=require(_0x53a3('0x1'));var rp=require('request-promise');var BPromise=require(_0x53a3('0x2'));var pkginfo=require(_0x53a3('0x3'))(module,_0x53a3('0x4'));var db=require(_0x53a3('0x5'))['db'];var encryptor=require(_0x53a3('0x6'));var hardware=require(_0x53a3('0x7'));var logger=require(_0x53a3('0x8'))(_0x53a3('0x9'));var HOST=_0x53a3('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x26a615){return new BPromise(function(_0x433c30,_0x4d63ab){var _0x455390=util[_0x53a3('0xb')](_0x53a3('0xc'),HOST,_0x26a615,module['exports'][_0x53a3('0x4')]);if(oldToken){_0x455390=util['format'](_0x53a3('0xd'),HOST,_0x26a615,module[_0x53a3('0xe')][_0x53a3('0x4')],oldToken);}var _0x3c8279={'uri':_0x455390,'method':_0x53a3('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x3c8279)[_0x53a3('0x10')](function(_0x1bb405){_0x433c30(_0x1bb405);})[_0x53a3('0x11')](function(_0x1e3c5a){_0x4d63ab(_0x1e3c5a);});});}function manageLicense(_0x45cd50,_0x2f1dea){var _0x41c713=_0x2f1dea[_0x53a3('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x41c713[_0x53a3('0x13')]!==_0x45cd50&&!_0x41c713[_0x53a3('0x14')]){oldToken=_0x41c713[_0x53a3('0x13')];}httpRequest(_0x45cd50)['then'](function(_0x90c2bc){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x90c2bc[_0x53a3('0x15')]){isOldTokenSent=![];if(!_0x41c713['license']&&_0x41c713['license']!=_0x90c2bc['license']||_0x41c713['license']&&_0x41c713[_0x53a3('0x14')]){logger[_0x53a3('0x16')](_0x53a3('0x17'));}if(_0x41c713[_0x53a3('0x9')]&&!_0x41c713[_0x53a3('0x14')]&&_0x41c713[_0x53a3('0x9')]!=_0x90c2bc['license']){logger['info'](_0x53a3('0x18'));}if(_0x41c713['license']&&!_0x41c713[_0x53a3('0x14')]&&_0x41c713[_0x53a3('0x9')]==_0x90c2bc[_0x53a3('0x9')]){return _0x2f1dea;}return _0x2f1dea[_0x53a3('0x19')]({'data1':_0x45cd50,'data2':null,'license':_0x90c2bc[_0x53a3('0x9')]});}else{if(_0x90c2bc[_0x53a3('0x9')]||_0x41c713[_0x53a3('0x9')]){if(!_0x41c713[_0x53a3('0x14')]){if(_0x41c713[_0x53a3('0x13')]==_0x45cd50){GRAY_PERIOD_REASON='Disabled';logger[_0x53a3('0x16')](_0x53a3('0x1a'));}else{GRAY_PERIOD_REASON=_0x53a3('0x1b');logger['info'](_0x53a3('0x1c'),_0x41c713[_0x53a3('0x13')],_0x45cd50);}logger[_0x53a3('0x16')](_0x53a3('0x1d'),GRAY_PERIOD_REASON[_0x53a3('0x1e')](),moment()[_0x53a3('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x2f1dea[_0x53a3('0x19')]({'data2':encryptor['encryptString'](moment()[_0x53a3('0xb')](_0x53a3('0x1f')))});}else{if(moment()[_0x53a3('0x20')](encryptor[_0x53a3('0x21')](_0x41c713['data2']),'days')>DAYS){logger[_0x53a3('0x16')](_0x53a3('0x22'),moment()['format'](_0x53a3('0x1f')));isOldTokenSent=![];return _0x2f1dea[_0x53a3('0x19')]({'data1':_0x45cd50,'data2':null,'license':null});}}}else{if(_0x41c713['data1']!=_0x45cd50){logger[_0x53a3('0x16')](_0x53a3('0x1c'),_0x41c713[_0x53a3('0x13')],_0x45cd50);return _0x2f1dea[_0x53a3('0x19')]({'data1':_0x45cd50,'data2':null,'license':null});}}}return _0x2f1dea;})[_0x53a3('0x10')](function(_0x4c1f07){_0x2f1dea=_0x4c1f07;})[_0x53a3('0x11')](function(_0x3da945){logger[_0x53a3('0x23')](_0x3da945[_0x53a3('0x24')]);})[_0x53a3('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0x53a3('0x26')](),_0x2f1dea);},TIME);});}function defaultLicense(){var _0x25eab5=hardware[_0x53a3('0x26')]();if(_0x25eab5){return db[_0x53a3('0x27')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x25eab5}})[_0x53a3('0x28')](function(_0x2dc38c,_0x367140){logger[_0x53a3('0x16')](_0x53a3('0x29'),_0x25eab5);manageLicense(_0x25eab5,_0x2dc38c);})[_0x53a3('0x11')](function(_0x1752b2){logger['error'](_0x1752b2[_0x53a3('0x24')]);});}}exports[_0x53a3('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7de5fbb..bbfe678 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 _0x5afd=['exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','gray','deadline','days','grayReason','uuid','machineUuid','changed','message','User','role','sequelize','COUNT','col','count','admin','users','telephones','user','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones'];(function(_0x40162e,_0x5aaf3d){var _0x39791c=function(_0x45a1d6){while(--_0x45a1d6){_0x40162e['push'](_0x40162e['shift']());}};_0x39791c(++_0x5aaf3d);}(_0x5afd,0x1c3));var _0xd5af=function(_0x2d9b4f,_0x597016){_0x2d9b4f=_0x2d9b4f-0x0;var _0x6c1c59=_0x5afd[_0x2d9b4f];return _0x6c1c59;};'use strict';var util=require(_0xd5af('0x0'));var _=require(_0xd5af('0x1'));var moment=require(_0xd5af('0x2'));var BPromise=require(_0xd5af('0x3'));var hardware=require(_0xd5af('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0xd5af('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd5af('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd5af('0x7'),'machineUuid':hardware[_0xd5af('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[_0xd5af('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1d54b2){return new BPromise(function(_0xf9cf59,_0x5328e1){return db['License'][_0xd5af('0x9')](_['defaults'](_0x1d54b2,{'raw':!![],'where':{'id':0x1}}))[_0xd5af('0xa')](function(_0xf4b543){return checkLicense(_0xf4b543,null);})['then'](function(_0x4e0d0d){_0xf9cf59(_0x4e0d0d);return;})[_0xd5af('0xb')](function(_0x1fe76b){_0x5328e1(_0x1fe76b);});});}function checkLicense(_0xb79a58,_0x122f23){if(!_0xb79a58){demoLicense['uuid']=_0xb79a58[_0xd5af('0xc')];return demoLicense;}try{var _0x58f0f0=_0x122f23||_0xb79a58[_0xd5af('0xd')];if(_[_0xd5af('0xe')](_0x58f0f0)){throw new Error(_0xd5af('0xf'));}var _0x315fea=_0xb79a58[_0xd5af('0xc')];var _0x214f7b=_0xb79a58[_0xd5af('0x10')];var _0x140447=_0x315fea[_0xd5af('0x11')]('-')[0x4];var _0x22aea7=_0x315fea[_0xd5af('0x11')]('-')[0x0];var _0xe222ae=encryptor[_0xd5af('0x12')](_0x58f0f0,util[_0xd5af('0x13')]('%s:%s:%s',_0x140447,_0x315fea,_0x22aea7));var _0xf0256=JSON[_0xd5af('0x14')](_0xe222ae);_0xf0256['demo']=![];_0xf0256['uuid']=_0x315fea;_0xf0256['machineUuid']=hardware[_0xd5af('0x8')]();if(_0x214f7b){var _0x1c9fcf=encryptor[_0xd5af('0x12')](_0x214f7b);_0xf0256[_0xd5af('0x15')]=_0x1c9fcf;_0xf0256[_0xd5af('0x16')]=moment(_0x1c9fcf)['add'](0x7,_0xd5af('0x17'))['format']();_0xf0256[_0xd5af('0x18')]=_0xf0256[_0xd5af('0x19')]!=_0xf0256[_0xd5af('0x1a')]?_0xd5af('0x1b'):'disabled';}return _0xf0256;}catch(_0x27353c){breakingLicense[_0xd5af('0x19')]=_0xb79a58[_0xd5af('0xc')];breakingLicense[_0xd5af('0x1c')]=_0x27353c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4460a6,_0x58d6c4){getLicense()['then'](function(_0x8e1483){return db[_0xd5af('0x1d')]['findAll']({'attributes':[_0xd5af('0x1e'),[db[_0xd5af('0x1f')]['fn'](_0xd5af('0x20'),db[_0xd5af('0x1f')][_0xd5af('0x21')](_0xd5af('0x1e'))),_0xd5af('0x22')]],'group':_0xd5af('0x1e'),'where':{'role':{'$or':[_0xd5af('0x23'),'user','telephone']}},'raw':!![]})[_0xd5af('0xa')](function(_0x27518f){var _0x34b6c4={'user':_0x8e1483[_0xd5af('0x24')]||0x0,'telephone':_0x8e1483[_0xd5af('0x25')]||0x0};_0x27518f['forEach'](function(_0x562887){var _0x4f9d76=_0x562887[_0xd5af('0x1e')]===_0xd5af('0x23')?_0xd5af('0x26'):_0x562887[_0xd5af('0x1e')];_0x34b6c4[_0x4f9d76]-=_0x562887[_0xd5af('0x22')];if(_0x34b6c4[_0x4f9d76]<0x0)_0x34b6c4[_0x4f9d76]=0x0;});_0x4460a6(_0x34b6c4);return;});})[_0xd5af('0xb')](function(_0x46e6de){_0x58d6c4(_0x46e6de);});});}function checkUserLimits(_0x39ffa4){return new BPromise(function(_0x4e454a,_0x2435c0){getLimits()[_0xd5af('0xa')](function(_0x557b96){var _0x35577f=_[_0xd5af('0x27')](_[_0xd5af('0x28')](_0x39ffa4,'role'),[_0xd5af('0x23'),_0xd5af('0x26'),'telephone']);var _0x52976e=(_0x35577f[_0xd5af('0x23')]||0x0)+(_0x35577f['user']||0x0);var _0x264346=_0x35577f[_0xd5af('0x29')]||0x0;if(_0x52976e>_0x557b96['user'])return _0x2435c0(_0xd5af('0x2a'));if(_0x264346>_0x557b96[_0xd5af('0x29')])return _0x2435c0(_0xd5af('0x2b'));return _0x4e454a();})['catch'](function(_0x5b416e){_0x2435c0(_0x5b416e);});});}module[_0xd5af('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xa0d1=['license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','deadline','add','days','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','users','forEach','catch','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Breaking\x20license','License','find','defaults','then','uuid','data1'];(function(_0x28e5af,_0x3a681b){var _0x5a0c1e=function(_0x28c49c){while(--_0x28c49c){_0x28e5af['push'](_0x28e5af['shift']());}};_0x5a0c1e(++_0x3a681b);}(_0xa0d1,0xb2));var _0x1a0d=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa0d1[_0x49b207];return _0x2dc8fa;};'use strict';var util=require(_0x1a0d('0x0'));var _=require(_0x1a0d('0x1'));var moment=require(_0x1a0d('0x2'));var BPromise=require(_0x1a0d('0x3'));var hardware=require(_0x1a0d('0x4'));var encryptor=require(_0x1a0d('0x5'));var db=require(_0x1a0d('0x6'))['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':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x1a0d('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x12e169){return new BPromise(function(_0x1c5f3c,_0x484d09){return db[_0x1a0d('0x8')][_0x1a0d('0x9')](_[_0x1a0d('0xa')](_0x12e169,{'raw':!![],'where':{'id':0x1}}))[_0x1a0d('0xb')](function(_0x274f3){return checkLicense(_0x274f3,null);})[_0x1a0d('0xb')](function(_0x2efd34){_0x1c5f3c(_0x2efd34);return;})['catch'](function(_0x24615a){_0x484d09(_0x24615a);});});}function checkLicense(_0x51641c,_0x29f704){if(!_0x51641c){demoLicense[_0x1a0d('0xc')]=_0x51641c[_0x1a0d('0xd')];return demoLicense;}try{var _0x4ec6f1=_0x29f704||_0x51641c[_0x1a0d('0xe')];if(_[_0x1a0d('0xf')](_0x4ec6f1)){throw new Error(_0x1a0d('0x10'));}var _0x33b948=_0x51641c[_0x1a0d('0xd')];var _0x3d55e0=_0x51641c[_0x1a0d('0x11')];var _0x2eb7fe=_0x33b948[_0x1a0d('0x12')]('-')[0x4];var _0x597d86=_0x33b948[_0x1a0d('0x12')]('-')[0x0];var _0x11e13e=encryptor[_0x1a0d('0x13')](_0x4ec6f1,util[_0x1a0d('0x14')](_0x1a0d('0x15'),_0x2eb7fe,_0x33b948,_0x597d86));var _0x21b22c=JSON[_0x1a0d('0x16')](_0x11e13e);_0x21b22c[_0x1a0d('0x17')]=![];_0x21b22c[_0x1a0d('0xc')]=_0x33b948;_0x21b22c['machineUuid']=hardware['getUuid']();if(_0x3d55e0){var _0x562b85=encryptor['decryptString'](_0x3d55e0);_0x21b22c['gray']=_0x562b85;_0x21b22c[_0x1a0d('0x18')]=moment(_0x562b85)[_0x1a0d('0x19')](0x7,_0x1a0d('0x1a'))[_0x1a0d('0x14')]();_0x21b22c['grayReason']=_0x21b22c['uuid']!=_0x21b22c[_0x1a0d('0x1b')]?_0x1a0d('0x1c'):_0x1a0d('0x1d');}return _0x21b22c;}catch(_0x18eff5){breakingLicense[_0x1a0d('0xc')]=_0x51641c[_0x1a0d('0xd')];breakingLicense[_0x1a0d('0x1e')]=_0x18eff5[_0x1a0d('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xd81833,_0x1e9cfd){getLicense()[_0x1a0d('0xb')](function(_0x107225){return db[_0x1a0d('0x1f')][_0x1a0d('0x20')]({'attributes':[_0x1a0d('0x21'),[db[_0x1a0d('0x22')]['fn'](_0x1a0d('0x23'),db[_0x1a0d('0x22')][_0x1a0d('0x24')]('role')),_0x1a0d('0x25')]],'group':_0x1a0d('0x21'),'where':{'role':{'$or':[_0x1a0d('0x26'),_0x1a0d('0x27'),'telephone']}},'raw':!![]})[_0x1a0d('0xb')](function(_0x52a721){var _0x3c931f={'user':_0x107225[_0x1a0d('0x28')]||0x0,'telephone':_0x107225['telephones']||0x0};_0x52a721[_0x1a0d('0x29')](function(_0x2e6f23){var _0x2a309a=_0x2e6f23['role']===_0x1a0d('0x26')?'user':_0x2e6f23[_0x1a0d('0x21')];_0x3c931f[_0x2a309a]-=_0x2e6f23['count'];if(_0x3c931f[_0x2a309a]<0x0)_0x3c931f[_0x2a309a]=0x0;});_0xd81833(_0x3c931f);return;});})[_0x1a0d('0x2a')](function(_0x4d3809){_0x1e9cfd(_0x4d3809);});});}function checkUserLimits(_0x2d8efa){return new BPromise(function(_0x348656,_0x497468){getLimits()[_0x1a0d('0xb')](function(_0xdbc251){var _0x2ee1ab=_[_0x1a0d('0x2b')](_[_0x1a0d('0x2c')](_0x2d8efa,'role'),[_0x1a0d('0x26'),_0x1a0d('0x27'),_0x1a0d('0x2d')]);var _0x54ed4d=(_0x2ee1ab[_0x1a0d('0x26')]||0x0)+(_0x2ee1ab[_0x1a0d('0x27')]||0x0);var _0x2f940d=_0x2ee1ab[_0x1a0d('0x2d')]||0x0;if(_0x54ed4d>_0xdbc251[_0x1a0d('0x27')])return _0x497468(_0x1a0d('0x2e'));if(_0x2f940d>_0xdbc251[_0x1a0d('0x2d')])return _0x497468('License\x20limit\x20reached\x20for\x20telephones');return _0x348656();})[_0x1a0d('0x2a')](function(_0x3c99af){_0x497468(_0x3c99af);});});}module[_0x1a0d('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 9b4e13e..bf76e3c 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3423=['app-id','secret','myappanuglar-secret'];(function(_0x2c4841,_0x1beaaf){var _0x5e4d4d=function(_0xc2d2f4){while(--_0xc2d2f4){_0x2c4841['push'](_0x2c4841['shift']());}};_0x5e4d4d(++_0x1beaaf);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3342('0x0'),'GOOGLE_ID':_0x3342('0x1'),'GOOGLE_SECRET':_0x3342('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x3de3=['exports','myappanuglar-secret','app-id'];(function(_0x164169,_0x1f0c8c){var _0x2709b7=function(_0x44616b){while(--_0x44616b){_0x164169['push'](_0x164169['shift']());}};_0x2709b7(++_0x1f0c8c);}(_0x3de3,0x1ce));var _0x33de=function(_0x564ed0,_0x17058f){_0x564ed0=_0x564ed0-0x0;var _0x4d2ee3=_0x3de3[_0x564ed0];return _0x4d2ee3;};'use strict';module[_0x33de('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x33de('0x1'),'GOOGLE_ID':_0x33de('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3c3217f..153d3b8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7db=['../utils/loggers','fileLogger','exports'];(function(_0x584875,_0x5509b0){var _0x1c170a=function(_0x38dc93){while(--_0x38dc93){_0x584875['push'](_0x584875['shift']());}};_0x1c170a(++_0x5509b0);}(_0xf7db,0x96));var _0xbf7d=function(_0xb04cdd,_0x42c6e7){_0xb04cdd=_0xb04cdd-0x0;var _0x5c2d03=_0xf7db[_0xb04cdd];return _0x5c2d03;};'use strict';var fileLogger=require(_0xbf7d('0x0'))[_0xbf7d('0x1')];module[_0xbf7d('0x2')]=fileLogger; \ No newline at end of file +var _0x4bf9=['exports','../utils/loggers'];(function(_0x96359,_0x220250){var _0x13ce0f=function(_0x41d54a){while(--_0x41d54a){_0x96359['push'](_0x96359['shift']());}};_0x13ce0f(++_0x220250);}(_0x4bf9,0x11f));var _0x94bf=function(_0x166646,_0x2fd83f){_0x166646=_0x166646-0x0;var _0x4ba672=_0x4bf9[_0x166646];return _0x4ba672;};'use strict';var fileLogger=require(_0x94bf('0x0'))['fileLogger'];module[_0x94bf('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index bef6cde..39d359d 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 _0x9996=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','../../config/environment','resolve','join','legacy-libs','../../services/express/index.js','ami'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0x9996,0x1e4));var _0x6999=function(_0x4a0ebf,_0x55ba40){_0x4a0ebf=_0x4a0ebf-0x0;var _0x181f1e=_0x9996[_0x4a0ebf];return _0x181f1e;};'use strict';var path=require('path');var cfg=require(_0x6999('0x0'));var env={'NODE_PATH':path[_0x6999('0x1')](path[_0x6999('0x2')](cfg['root'],_0x6999('0x3')))};var pm2config={'apps':[{'name':'express','script':path[_0x6999('0x2')](__dirname,_0x6999('0x4')),'env':env},{'name':_0x6999('0x5'),'script':path[_0x6999('0x2')](__dirname,_0x6999('0x6')),'env':env},{'name':_0x6999('0x7'),'script':path[_0x6999('0x2')](__dirname,_0x6999('0x8')),'env':env},{'name':_0x6999('0x9'),'script':path[_0x6999('0x2')](__dirname,_0x6999('0xa')),'env':env},{'name':'routing','script':path['join'](__dirname,_0x6999('0xb')),'env':env},{'name':_0x6999('0xc'),'script':path[_0x6999('0x2')](__dirname,_0x6999('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x20d2=['join','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','root','legacy-libs','express','../../services/express/index.js','ami'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x20d2,0x144));var _0x220d=function(_0x395db2,_0x15e96e){_0x395db2=_0x395db2-0x0;var _0xf377ba=_0x20d2[_0x395db2];return _0xf377ba;};'use strict';var path=require(_0x220d('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0x220d('0x1')],_0x220d('0x2')))};var pm2config={'apps':[{'name':_0x220d('0x3'),'script':path['join'](__dirname,_0x220d('0x4')),'env':env},{'name':_0x220d('0x5'),'script':path[_0x220d('0x6')](__dirname,_0x220d('0x7')),'env':env},{'name':_0x220d('0x8'),'script':path[_0x220d('0x6')](__dirname,_0x220d('0x9')),'env':env},{'name':'email','script':path[_0x220d('0x6')](__dirname,_0x220d('0xa')),'env':env},{'name':_0x220d('0xb'),'script':path[_0x220d('0x6')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x220d('0xc'),'script':path[_0x220d('0x6')](__dirname,_0x220d('0xd')),'env':env}]};module[_0x220d('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ef20215..9fd0480 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 _0xdda9=['then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xdda9,0x168));var _0x9dda=function(_0x2c4c48,_0x402353){_0x2c4c48=_0x2c4c48-0x0;var _0x5ee161=_0xdda9[_0x2c4c48];return _0x5ee161;};'use strict';var pm2=require(_0x9dda('0x0'));var BPromise=require(_0x9dda('0x1'));var config=require(_0x9dda('0x2'));function connect(){return new BPromise(function(_0x40821b,_0x292501){return pm2[_0x9dda('0x3')](function(_0x345364){if(_0x345364){return _0x292501(_0x345364);}return _0x40821b('connected');});});};exports['start']=function(_0x3e9dc8){return connect()[_0x9dda('0x4')](function(){return new BPromise(function(_0x125d4e,_0x33be75){return pm2[_0x9dda('0x5')](_0x3e9dc8,function(_0x5171b4,_0xda31e2){if(_0x5171b4){return _0x33be75(_0x5171b4);}pm2[_0x9dda('0x6')]();return _0x125d4e(_0xda31e2);});});});};exports[_0x9dda('0x7')]=function(_0x4e7b16){return connect()[_0x9dda('0x4')](function(){return new BPromise(function(_0x28aab2,_0x30b2f5){return pm2[_0x9dda('0x7')](_0x4e7b16,function(_0x53eff8,_0x18d20d){if(_0x53eff8){return _0x30b2f5(_0x53eff8);}pm2['disconnect']();return _0x28aab2(_0x18d20d);});});});};exports[_0x9dda('0x8')]=function(_0x4694ed){return connect()['then'](function(){return new BPromise(function(_0x5f57d1,_0x559e55){return pm2['restart'](_0x4694ed,function(_0x4ac269,_0x4b5f36){if(_0x4ac269){return _0x559e55(_0x4ac269);}pm2[_0x9dda('0x6')]();return _0x5f57d1(_0x4b5f36);});});});};exports[_0x9dda('0x9')]=function(){return connect()[_0x9dda('0x4')](function(){return new BPromise(function(_0x327a4a,_0xcee3a6){return pm2['list'](function(_0x39b688,_0x217130){if(_0x39b688){return _0xcee3a6(_0x39b688);}pm2['disconnect']();return _0x327a4a(_0x217130);});});});};exports[_0x9dda('0xa')]=function(_0x2390b4){return connect()['then'](function(){return new BPromise(function(_0x369f4b,_0x432aac){return pm2['describe'](_0x2390b4,function(_0x15a4a9,_0x31a8d9){if(_0x15a4a9){return _0x432aac(_0x15a4a9);}pm2['disconnect']();return _0x369f4b(_0x31a8d9);});});});};exports[_0x9dda('0xb')]=function(_0x51d7a2){return connect()[_0x9dda('0x4')](function(){return new BPromise(function(_0x388563,_0x46d87c){return pm2[_0x9dda('0xb')](_0x51d7a2,function(_0x55faa3,_0x50a3ea){if(_0x55faa3){return _0x46d87c(_0x55faa3);}pm2['disconnect']();return _0x388563(_0x50a3ea);});});});};exports['dump']=function(){return connect()[_0x9dda('0x4')](function(){return new BPromise(function(_0x34c43d,_0x465e49){return pm2[_0x9dda('0xc')](function(_0x511253){if(_0x511253){return _0x465e49(_0x511253);}return _0x34c43d(_0x9dda('0xd'));});});});}; \ No newline at end of file +var _0x3347=['delete','dump','saved','pm2','bluebird','./config','connect','connected','start','stop','then','disconnect','restart','list','describe'];(function(_0x32cefe,_0x1befba){var _0x283e79=function(_0x1609f1){while(--_0x1609f1){_0x32cefe['push'](_0x32cefe['shift']());}};_0x283e79(++_0x1befba);}(_0x3347,0x7b));var _0x7334=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x3347[_0xd158dc];return _0x12d25f;};'use strict';var pm2=require(_0x7334('0x0'));var BPromise=require(_0x7334('0x1'));var config=require(_0x7334('0x2'));function connect(){return new BPromise(function(_0x1f8076,_0x12f2b2){return pm2[_0x7334('0x3')](function(_0x395337){if(_0x395337){return _0x12f2b2(_0x395337);}return _0x1f8076(_0x7334('0x4'));});});};exports[_0x7334('0x5')]=function(_0x448fe5){return connect()['then'](function(){return new BPromise(function(_0x23635c,_0x2fad3f){return pm2[_0x7334('0x5')](_0x448fe5,function(_0x32b540,_0x197f7d){if(_0x32b540){return _0x2fad3f(_0x32b540);}pm2['disconnect']();return _0x23635c(_0x197f7d);});});});};exports[_0x7334('0x6')]=function(_0x4b8f4b){return connect()[_0x7334('0x7')](function(){return new BPromise(function(_0x16bb2f,_0x177869){return pm2[_0x7334('0x6')](_0x4b8f4b,function(_0x174a64,_0x509eaf){if(_0x174a64){return _0x177869(_0x174a64);}pm2[_0x7334('0x8')]();return _0x16bb2f(_0x509eaf);});});});};exports[_0x7334('0x9')]=function(_0x1060e6){return connect()[_0x7334('0x7')](function(){return new BPromise(function(_0x3adca1,_0x55af83){return pm2[_0x7334('0x9')](_0x1060e6,function(_0x496ed7,_0x3e32fe){if(_0x496ed7){return _0x55af83(_0x496ed7);}pm2[_0x7334('0x8')]();return _0x3adca1(_0x3e32fe);});});});};exports[_0x7334('0xa')]=function(){return connect()[_0x7334('0x7')](function(){return new BPromise(function(_0x47d554,_0x410b23){return pm2[_0x7334('0xa')](function(_0x3a7cb9,_0x5ecf75){if(_0x3a7cb9){return _0x410b23(_0x3a7cb9);}pm2[_0x7334('0x8')]();return _0x47d554(_0x5ecf75);});});});};exports[_0x7334('0xb')]=function(_0x3ee356){return connect()[_0x7334('0x7')](function(){return new BPromise(function(_0x77e7c3,_0xb5323e){return pm2['describe'](_0x3ee356,function(_0x1444a1,_0x2f8996){if(_0x1444a1){return _0xb5323e(_0x1444a1);}pm2[_0x7334('0x8')]();return _0x77e7c3(_0x2f8996);});});});};exports['delete']=function(_0x339b39){return connect()['then'](function(){return new BPromise(function(_0xaf8626,_0x595f77){return pm2[_0x7334('0xc')](_0x339b39,function(_0x34537a,_0x942f6a){if(_0x34537a){return _0x595f77(_0x34537a);}pm2[_0x7334('0x8')]();return _0xaf8626(_0x942f6a);});});});};exports[_0x7334('0xd')]=function(){return connect()[_0x7334('0x7')](function(){return new BPromise(function(_0x781d02,_0x552cbf){return pm2[_0x7334('0xd')](function(_0x435e84){if(_0x435e84){return _0x552cbf(_0x435e84);}return _0x781d02(_0x7334('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e951d93..48c30cb 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 _0x9070=['ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','lastMsgAt','subtract','minutes','then','length','map','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','start','moment'];(function(_0x3960d2,_0x1f82c5){var _0x2c02a2=function(_0x5d631b){while(--_0x5d631b){_0x3960d2['push'](_0x3960d2['shift']());}};_0x2c02a2(++_0x1f82c5);}(_0x9070,0x1cd));var _0x0907=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x9070[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require('lodash');var moment=require(_0x0907('0x0'));var Redis=require(_0x0907('0x1'));var util=require(_0x0907('0x2'));var config=require(_0x0907('0x3'));var db=require(_0x0907('0x4'))['db'];var logger=require(_0x0907('0x5'))(_0x0907('0x6'));config[_0x0907('0x7')]=_[_0x0907('0x8')](config[_0x0907('0x7')],{'host':_0x0907('0x9'),'port':0x18eb});var io=require(_0x0907('0xa'))(new Redis(config[_0x0907('0x7')]));function closeInteractions(){var _0x395946=0x0;var _0x47f43f=[];return db[_0x0907('0xb')]['find']({'raw':!![],'attributes':['id',_0x0907('0xc')],'where':{'id':0x1}})['then'](function(_0x49763b){_0x395946=_0x49763b[_0x0907('0xc')];if(_0x395946){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x0907('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0907('0xe')](_0x49763b[_0x0907('0xc')],_0x0907('0xf'))}}});}else{return[];}})[_0x0907('0x10')](function(_0x1c310c){if(_0x1c310c&&_0x1c310c[_0x0907('0x11')]){_0x47f43f=_[_0x0907('0x12')](_0x1c310c||[],'id');logger['info'](_0x0907('0x13'),_0x47f43f['join']());return db['ChatInteraction'][_0x0907('0x14')]({'closeReason':_0x0907('0x15'),'disposition':_0x0907('0x16'),'closed':!![],'closedAt':moment()[_0x0907('0x17')](_0x0907('0x18'))},{'where':{'id':_0x47f43f}});}})[_0x0907('0x10')](function(){if(_0x47f43f&&_0x47f43f['length']){logger[_0x0907('0x19')](_0x0907('0x1a'),_0x47f43f[_0x0907('0x1b')]());for(var _0x2f3808=0x0;_0x2f3808<_0x47f43f[_0x0907('0x11')];_0x2f3808++){io[_0x0907('0x1c')](_0x0907('0x1d'),{'id':_0x47f43f[_0x2f3808],'closed':!![]});}}})['catch'](function(_0x14f0b2){logger[_0x0907('0x1e')](_0x0907('0x1f'),_0x14f0b2?util['inspect'](_0x14f0b2,{'showHidden':![],'depth':null}):'');});}exports[_0x0907('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb723=['then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','join','system','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../mysqldb','schedule','defaults','redis','localhost','socket.io-emitter','find','chatTimeout'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb723,0x1a8));var _0x3b72=function(_0x3654c5,_0x2f4ecd){_0x3654c5=_0x3654c5-0x0;var _0xf5f082=_0xb723[_0x3654c5];return _0xf5f082;};'use strict';var _=require('lodash');var moment=require(_0x3b72('0x0'));var Redis=require(_0x3b72('0x1'));var util=require(_0x3b72('0x2'));var config=require('../../config/environment');var db=require(_0x3b72('0x3'))['db'];var logger=require('../logger')(_0x3b72('0x4'));config['redis']=_[_0x3b72('0x5')](config[_0x3b72('0x6')],{'host':_0x3b72('0x7'),'port':0x18eb});var io=require(_0x3b72('0x8'))(new Redis(config[_0x3b72('0x6')]));function closeInteractions(){var _0x216f00=0x0;var _0x59db1b=[];return db['Setting'][_0x3b72('0x9')]({'raw':!![],'attributes':['id',_0x3b72('0xa')],'where':{'id':0x1}})[_0x3b72('0xb')](function(_0x3443b7){_0x216f00=_0x3443b7[_0x3b72('0xa')];if(_0x216f00){return db[_0x3b72('0xc')][_0x3b72('0xd')]({'raw':!![],'attributes':['id',_0x3b72('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3b72('0xf')](_0x3443b7[_0x3b72('0xa')],_0x3b72('0x10'))}}});}else{return[];}})[_0x3b72('0xb')](function(_0xdc4fe8){if(_0xdc4fe8&&_0xdc4fe8[_0x3b72('0x11')]){_0x59db1b=_['map'](_0xdc4fe8||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x59db1b[_0x3b72('0x12')]());return db[_0x3b72('0xc')]['update']({'closeReason':_0x3b72('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x3b72('0x14')](_0x3b72('0x15'))},{'where':{'id':_0x59db1b}});}})[_0x3b72('0xb')](function(){if(_0x59db1b&&_0x59db1b[_0x3b72('0x11')]){logger[_0x3b72('0x16')](_0x3b72('0x17'),_0x59db1b[_0x3b72('0x12')]());for(var _0xc33e4d=0x0;_0xc33e4d<_0x59db1b[_0x3b72('0x11')];_0xc33e4d++){io[_0x3b72('0x18')](_0x3b72('0x19'),{'id':_0x59db1b[_0xc33e4d],'closed':!![]});}}})['catch'](function(_0x250783){logger[_0x3b72('0x1a')](_0x3b72('0x1b'),_0x250783?util['inspect'](_0x250783,{'showHidden':![],'depth':null}):'');});}exports[_0x3b72('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 f5c1367..24440d7 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 _0x7b88=['exports','startAllRefreshIntervals'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7b88,0x115));var _0x87b8=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x7b88[_0x12f688];return _0x59c3de;};'use strict';function start(){var _0x425796=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x425796[_0x87b8('0x0')]();}module[_0x87b8('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xd12e=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd12e,0x1af));var _0xed12=function(_0x29b9f0,_0x3d3c5d){_0x29b9f0=_0x29b9f0-0x0;var _0x5bf28c=_0xd12e[_0x29b9f0];return _0x5bf28c;};'use strict';function start(){var _0x35fb3b=require(_0xed12('0x0'));return _0x35fb3b['startAllRefreshIntervals']();}module[_0xed12('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 16afc8d..ee7e9d8 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 _0xa534=['getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','%s.%s','savename','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','empty\x20file,\x20email\x20not\x20sent','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','CloudProvider','keys','map','keyBy','toString','difference','intersection','exists','toRun','length','index','my\x20id','resolve','cron','active','endAt','add','start','add\x20cron','stop','deleteJob','isBetween','startAt','update\x20cron','stop\x20cron','run','util','path','lodash','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount'];(function(_0x22ada8,_0x23a7ea){var _0x506e36=function(_0xd6ed10){while(--_0xd6ed10){_0x22ada8['push'](_0x22ada8['shift']());}};_0x506e36(++_0x23a7ea);}(_0xa534,0x1cd));var _0x4a53=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa534[_0x4b369d];return _0x571a98;};'use strict';var fs=require('fs');var util=require(_0x4a53('0x0'));var path=require(_0x4a53('0x1'));var _=require(_0x4a53('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x4a53('0x3'));var logger=require(_0x4a53('0x4'))(_0x4a53('0x5'));var db=require(_0x4a53('0x6'))['db'];var analyticCustomReportController=require(_0x4a53('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x4a53('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2f3d91,_0x267b3e){return function(){logger[_0x4a53('0x9')](_0x4a53('0xa'),_0x2f3d91[_0x4a53('0xb')]);var _0xadfcea=!![];var _0x267be4=_0x2f3d91[_0x4a53('0xc')][_0x4a53('0xd')]();var _0x181d27={'account':_0x267be4,'message':{'from':util[_0x4a53('0xe')](_0x4a53('0xf'),_0x2f3d91[_0x4a53('0xc')]['name'],_0x2f3d91['MailAccount']['email']||_0x2f3d91['MailAccount'][_0x4a53('0x10')][_0x4a53('0x11')]),'to':_0x2f3d91[_0x4a53('0xb')],'cc':_0x2f3d91['cc'],'bcc':_0x2f3d91['bcc'],'subject':util[_0x4a53('0xe')](_0x4a53('0x12'),_0x267b3e[_0x4a53('0x13')],_0x2f3d91[_0x4a53('0x14')],_0x2f3d91[_0x4a53('0x15')])}};var _0x36baa3=path[_0x4a53('0x16')](__dirname,'../../files/reports');var _0x504da5=_0x267b3e['savename'];var _0x17eecc=util[_0x4a53('0xe')](_0x4a53('0x17'),path['basename'](_0x267b3e[_0x4a53('0x18')],path['extname'](_0x267b3e[_0x4a53('0x18')])),'zip');var _0x10c0e8=path[_0x4a53('0x16')](_0x36baa3,_0x504da5);var _0xabccd8=path[_0x4a53('0x16')](_0x36baa3,_0x17eecc);if(fs[_0x4a53('0x19')](_0x10c0e8)){_0x267b3e[_0x4a53('0x1a')]=_0x4a53('0x1b');_0x181d27[_0x4a53('0x1c')][_0x4a53('0x1d')]=[{'filename':_0x504da5,'path':_0x10c0e8}];_0x181d27['message'][_0x4a53('0x1e')]=util['format'](_0x4a53('0x1f'),JSON[_0x4a53('0x20')](_0x267b3e,null,0x2));}else if(fs[_0x4a53('0x19')](_0xabccd8)){_0x267b3e['status']=_0x4a53('0x1b');_0x181d27[_0x4a53('0x1c')][_0x4a53('0x1d')]=[{'filename':_0x17eecc,'path':_0xabccd8}];}else{_0x181d27[_0x4a53('0x1c')][_0x4a53('0x1e')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2f3d91['sendIfEmpty']){_0xadfcea=![];logger[_0x4a53('0x9')](_0x4a53('0x21'));}}if(_0xadfcea){return client['request'](_0x4a53('0x22'),_0x181d27)['then'](function(_0x131d41){if(_0x131d41[_0x4a53('0x23')]){return logger[_0x4a53('0x23')](_0x4a53('0x24'),JSON[_0x4a53('0x20')](_0x131d41));}return logger[_0x4a53('0x9')](_0x4a53('0x25'));})[_0x4a53('0x26')](function(_0x95b625){return logger[_0x4a53('0x23')](_0x4a53('0x24'),JSON['stringify'](_0x95b625));});}};}function handleError(){return function(_0x59dfce){return logger['error'](JSON[_0x4a53('0x20')](_0x59dfce));};}function handleResult(_0x441638){return function(_0x5bef3a){logger[_0x4a53('0x9')](_0x4a53('0x27'),JSON[_0x4a53('0x20')](_0x5bef3a));if(_0x441638[_0x4a53('0xc')]&&_0x441638[_0x4a53('0xc')][_0x4a53('0x10')]&&!_[_0x4a53('0x28')](_0x441638['email'])){setTimeout(handleSendEmail(_0x441638,_0x5bef3a),0x3c*0x3e8);}};}function handleJob(_0x5237e0){return function(){try{if(_[_0x4a53('0x28')](_0x5237e0[_0x4a53('0x14')])){return logger[_0x4a53('0x9')](_0x4a53('0x29'));}if(_['isNil'](_0x5237e0['subtractUnit'])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x357d4b={'startDate':moment()[_0x4a53('0x2a')](_0x5237e0[_0x4a53('0x14')],_0x5237e0[_0x4a53('0x15')])[_0x4a53('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x4a53('0x2b')),'type':_0x4a53('0x2c'),'output':_0x5237e0[_0x4a53('0x2d')],'name':_0x5237e0[_0x4a53('0x13')]};if(!_['isNil'](_0x5237e0[_0x4a53('0x2e')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x5237e0[_0x4a53('0x2e')]);return analyticDefaultReportController[_0x4a53('0x2f')]({'id':_0x5237e0[_0x4a53('0x2e')]},_0x357d4b)[_0x4a53('0x30')](handleResult(_0x5237e0))['catch'](handleError());}if(!_[_0x4a53('0x28')](_0x5237e0[_0x4a53('0x31')])){logger[_0x4a53('0x9')](_0x4a53('0x32'),_0x5237e0[_0x4a53('0x31')]);return analyticCustomReportController[_0x4a53('0x2f')]({'id':_0x5237e0[_0x4a53('0x31')]},_0x357d4b)[_0x4a53('0x30')](handleResult(_0x5237e0))[_0x4a53('0x26')](handleError());}}catch(_0x5ad37f){logger[_0x4a53('0x23')](JSON['stringify'](_0x5ad37f));}return logger[_0x4a53('0x9')](_0x4a53('0x33'));};}function getJobs(_0xfdcde){var _0x19588f={};if(_0xfdcde){_0x19588f['id']=_0xfdcde;}return db[_0x4a53('0x34')]['findAll']({'where':_0x19588f,'include':[{'model':db['MailAccount'],'attributes':['id',_0x4a53('0x13'),_0x4a53('0xb')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x4a53('0x35')],'as':_0x4a53('0x35')}]}]}]})['then'](function(_0x501339){var _0x40bf8c=_[_0x4a53('0x36')](manager['jobs']);var _0x3a03b2=_[_0x4a53('0x37')](_0x501339,function(_0x2a721f){return _0x2a721f['id']['toString']();});var _0x5a8151=_[_0x4a53('0x38')](_0x501339,function(_0x5abbf8){return _0x5abbf8['id'][_0x4a53('0x39')]();});var _0x4d45fc=_0xfdcde?_0x3a03b2:_[_0x4a53('0x3a')](_0x3a03b2,_0x40bf8c);var _0x29eb65=_[_0x4a53('0x3b')](_0x3a03b2,_0x40bf8c);var _0x946c46=_[_0x4a53('0x3a')](_0x40bf8c,_0x3a03b2);var _0x6334aa;var _0x1ff857;for(_0x6334aa=0x0;_0x6334aa<_0x946c46['length']&&!_0xfdcde;_0x6334aa+=0x1){_0x1ff857=_0x946c46[_0x6334aa][_0x4a53('0x39')]();if(manager[_0x4a53('0x3c')](_0x1ff857)){manager['stop'](_0x1ff857);manager['deleteJob'](_0x1ff857);logger[_0x4a53('0x9')]('delete\x20cron',_0x1ff857);}}logger['info'](_0x4a53('0x3d'),JSON[_0x4a53('0x20')](_0x4d45fc));for(_0x6334aa=0x0;_0x6334aa<_0x4d45fc[_0x4a53('0x3e')];_0x6334aa+=0x1){_0x1ff857=_0x4d45fc[_0x6334aa][_0x4a53('0x39')]();logger['info'](_0x4a53('0x3f'),_0x1ff857);if(_0xfdcde){logger[_0x4a53('0x9')](_0x4a53('0x40'),_0xfdcde);logger['info'](JSON[_0x4a53('0x20')](_0x5a8151[_0x1ff857]));BPromise[_0x4a53('0x41')]()[_0x4a53('0x30')](handleJob(_0x5a8151[_0x1ff857]));logger[_0x4a53('0x9')]('run\x20job',_0x5a8151[_0x1ff857][_0x4a53('0x13')],_0x5a8151[_0x1ff857][_0x4a53('0x42')]);}else if(_0x5a8151[_0x1ff857][_0x4a53('0x42')]&&_0x5a8151[_0x1ff857][_0x4a53('0x43')]&&moment()['isBetween'](_0x5a8151[_0x1ff857]['startAt'],_0x5a8151[_0x1ff857][_0x4a53('0x44')])){manager[_0x4a53('0x45')](_0x1ff857,_0x5a8151[_0x1ff857][_0x4a53('0x42')],handleJob(_0x5a8151[_0x1ff857]));manager[_0x4a53('0x46')](_0x1ff857);logger[_0x4a53('0x9')](_0x4a53('0x47'),_0x5a8151[_0x1ff857]['name'],_0x5a8151[_0x1ff857]['cron']);}else if(manager['exists'](_0x1ff857)){manager[_0x4a53('0x48')](_0x1ff857);manager[_0x4a53('0x49')](_0x1ff857);logger[_0x4a53('0x9')]('stop\x20cron',_0x5a8151[_0x1ff857][_0x4a53('0x13')],_0x5a8151[_0x1ff857][_0x4a53('0x42')]);}}for(_0x6334aa=0x0,_0x1ff857;_0x6334aa<_0x29eb65[_0x4a53('0x3e')]&&!_0xfdcde;_0x6334aa+=0x1){_0x1ff857=_0x29eb65[_0x6334aa][_0x4a53('0x39')]();if(manager[_0x4a53('0x3c')](_0x1ff857)){if(_0x5a8151[_0x1ff857]['cron']&&_0x5a8151[_0x1ff857][_0x4a53('0x43')]&&moment()[_0x4a53('0x4a')](_0x5a8151[_0x1ff857][_0x4a53('0x4b')],_0x5a8151[_0x1ff857][_0x4a53('0x44')])){manager['update'](_0x1ff857,_0x5a8151[_0x1ff857][_0x4a53('0x42')],handleJob(_0x5a8151[_0x1ff857]));logger[_0x4a53('0x9')](_0x4a53('0x4c'),_0x5a8151[_0x1ff857][_0x4a53('0x13')],_0x5a8151[_0x1ff857][_0x4a53('0x42')]);}else{manager[_0x4a53('0x48')](_0x1ff857);manager[_0x4a53('0x49')](_0x1ff857);logger[_0x4a53('0x9')](_0x4a53('0x4d'),_0x5a8151[_0x1ff857]['name'],_0x5a8151[_0x1ff857][_0x4a53('0x42')]);}}}})[_0x4a53('0x26')](function(_0x5d8cc4){logger[_0x4a53('0x23')](JSON[_0x4a53('0x20')](_0x5d8cc4));});}exports[_0x4a53('0x4e')]=function(_0x29d23e){return getJobs(_0x29d23e);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd5b4=['email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','info','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','CloudProvider','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','isBetween','endAt','add','start','add\x20cron','stop\x20cron','active','update','update\x20cron','run','util','path','moment','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xd5b4,0xa0));var _0x4d5b=function(_0x47849f,_0xc59d8a){_0x47849f=_0x47849f-0x0;var _0x191890=_0xd5b4[_0x47849f];return _0x191890;};'use strict';var fs=require('fs');var util=require(_0x4d5b('0x0'));var path=require(_0x4d5b('0x1'));var _=require('lodash');var moment=require(_0x4d5b('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x4d5b('0x3'))('schedule');var db=require(_0x4d5b('0x4'))['db'];var analyticCustomReportController=require(_0x4d5b('0x5'));var analyticDefaultReportController=require(_0x4d5b('0x6'));var client=jayson[_0x4d5b('0x7')][_0x4d5b('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4900e4,_0x2c9f13){return function(){logger['info'](_0x4d5b('0x9'),_0x4900e4[_0x4d5b('0xa')]);var _0x53b64e=!![];var _0xde85b1=_0x4900e4[_0x4d5b('0xb')]['getSmtpOptions']();var _0x3f1394={'account':_0xde85b1,'message':{'from':util[_0x4d5b('0xc')](_0x4d5b('0xd'),_0x4900e4[_0x4d5b('0xb')]['name'],_0x4900e4[_0x4d5b('0xb')]['email']||_0x4900e4['MailAccount'][_0x4d5b('0xe')][_0x4d5b('0xf')]),'to':_0x4900e4['email'],'cc':_0x4900e4['cc'],'bcc':_0x4900e4[_0x4d5b('0x10')],'subject':util['format'](_0x4d5b('0x11'),_0x2c9f13[_0x4d5b('0x12')],_0x4900e4['subtractNumber'],_0x4900e4[_0x4d5b('0x13')])}};var _0x4cf98f=path[_0x4d5b('0x14')](__dirname,_0x4d5b('0x15'));var _0xd57b75=_0x2c9f13[_0x4d5b('0x16')];var _0x3c4c30=util['format'](_0x4d5b('0x17'),path[_0x4d5b('0x18')](_0x2c9f13['savename'],path['extname'](_0x2c9f13['savename'])),_0x4d5b('0x19'));var _0xf68802=path[_0x4d5b('0x14')](_0x4cf98f,_0xd57b75);var _0x22d6b7=path[_0x4d5b('0x14')](_0x4cf98f,_0x3c4c30);if(fs[_0x4d5b('0x1a')](_0xf68802)){_0x2c9f13['status']=_0x4d5b('0x1b');_0x3f1394[_0x4d5b('0x1c')]['attachments']=[{'filename':_0xd57b75,'path':_0xf68802}];_0x3f1394[_0x4d5b('0x1c')][_0x4d5b('0x1d')]=util[_0x4d5b('0xc')](_0x4d5b('0x1e'),JSON[_0x4d5b('0x1f')](_0x2c9f13,null,0x2));}else if(fs[_0x4d5b('0x1a')](_0x22d6b7)){_0x2c9f13['status']='Sent';_0x3f1394[_0x4d5b('0x1c')][_0x4d5b('0x20')]=[{'filename':_0x3c4c30,'path':_0x22d6b7}];}else{_0x3f1394[_0x4d5b('0x1c')][_0x4d5b('0x1d')]=_0x4d5b('0x21');if(!_0x4900e4[_0x4d5b('0x22')]){_0x53b64e=![];logger['info'](_0x4d5b('0x23'));}}if(_0x53b64e){return client[_0x4d5b('0x24')](_0x4d5b('0x25'),_0x3f1394)[_0x4d5b('0x26')](function(_0x50d34d){if(_0x50d34d[_0x4d5b('0x27')]){return logger[_0x4d5b('0x27')](_0x4d5b('0x28'),JSON[_0x4d5b('0x1f')](_0x50d34d));}return logger['info'](_0x4d5b('0x29'));})[_0x4d5b('0x2a')](function(_0x2fec09){return logger['error'](_0x4d5b('0x28'),JSON[_0x4d5b('0x1f')](_0x2fec09));});}};}function handleError(){return function(_0x1539d1){return logger[_0x4d5b('0x27')](JSON[_0x4d5b('0x1f')](_0x1539d1));};}function handleResult(_0x11c397){return function(_0x106915){logger[_0x4d5b('0x2b')](_0x4d5b('0x2c'),JSON[_0x4d5b('0x1f')](_0x106915));if(_0x11c397[_0x4d5b('0xb')]&&_0x11c397['MailAccount'][_0x4d5b('0xe')]&&!_[_0x4d5b('0x2d')](_0x11c397['email'])){setTimeout(handleSendEmail(_0x11c397,_0x106915),0x3c*0x3e8);}};}function handleJob(_0x48d647){return function(){try{if(_[_0x4d5b('0x2d')](_0x48d647[_0x4d5b('0x2e')])){return logger[_0x4d5b('0x2b')](_0x4d5b('0x2f'));}if(_['isNil'](_0x48d647['subtractUnit'])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x1642df={'startDate':moment()[_0x4d5b('0x30')](_0x48d647[_0x4d5b('0x2e')],_0x48d647['subtractUnit'])['format'](_0x4d5b('0x31')),'endDate':moment()[_0x4d5b('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x4d5b('0x32'),'output':_0x48d647[_0x4d5b('0x33')],'name':_0x48d647[_0x4d5b('0x12')]};if(!_[_0x4d5b('0x2d')](_0x48d647[_0x4d5b('0x34')])){logger[_0x4d5b('0x2b')]('exec\x20defaul\x20report\x20id:%s',_0x48d647[_0x4d5b('0x34')]);return analyticDefaultReportController[_0x4d5b('0x35')]({'id':_0x48d647['DefaultReportId']},_0x1642df)[_0x4d5b('0x26')](handleResult(_0x48d647))[_0x4d5b('0x2a')](handleError());}if(!_[_0x4d5b('0x2d')](_0x48d647[_0x4d5b('0x36')])){logger[_0x4d5b('0x2b')](_0x4d5b('0x37'),_0x48d647[_0x4d5b('0x36')]);return analyticCustomReportController[_0x4d5b('0x35')]({'id':_0x48d647[_0x4d5b('0x36')]},_0x1642df)[_0x4d5b('0x26')](handleResult(_0x48d647))['catch'](handleError());}}catch(_0x215446){logger[_0x4d5b('0x27')](JSON[_0x4d5b('0x1f')](_0x215446));}return logger[_0x4d5b('0x2b')]('no\x20report\x20id');};}function getJobs(_0x127189){var _0x320dea={};if(_0x127189){_0x320dea['id']=_0x127189;}return db['Schedule'][_0x4d5b('0x38')]({'where':_0x320dea,'include':[{'model':db['MailAccount'],'attributes':['id',_0x4d5b('0x12'),'email'],'include':[{'model':db[_0x4d5b('0x39')],'as':_0x4d5b('0xe'),'include':[{'model':db[_0x4d5b('0x3a')],'as':_0x4d5b('0x3a')}]}]}]})[_0x4d5b('0x26')](function(_0x143084){var _0x1b044e=_['keys'](manager[_0x4d5b('0x3b')]);var _0x5dd383=_[_0x4d5b('0x3c')](_0x143084,function(_0x251cdf){return _0x251cdf['id']['toString']();});var _0x2033e5=_[_0x4d5b('0x3d')](_0x143084,function(_0x37d1cd){return _0x37d1cd['id'][_0x4d5b('0x3e')]();});var _0x376030=_0x127189?_0x5dd383:_[_0x4d5b('0x3f')](_0x5dd383,_0x1b044e);var _0x2710f7=_[_0x4d5b('0x40')](_0x5dd383,_0x1b044e);var _0x503158=_[_0x4d5b('0x3f')](_0x1b044e,_0x5dd383);var _0x5ef4e9;var _0x12f8f8;for(_0x5ef4e9=0x0;_0x5ef4e9<_0x503158[_0x4d5b('0x41')]&&!_0x127189;_0x5ef4e9+=0x1){_0x12f8f8=_0x503158[_0x5ef4e9]['toString']();if(manager[_0x4d5b('0x42')](_0x12f8f8)){manager[_0x4d5b('0x43')](_0x12f8f8);manager[_0x4d5b('0x44')](_0x12f8f8);logger[_0x4d5b('0x2b')](_0x4d5b('0x45'),_0x12f8f8);}}logger[_0x4d5b('0x2b')](_0x4d5b('0x46'),JSON[_0x4d5b('0x1f')](_0x376030));for(_0x5ef4e9=0x0;_0x5ef4e9<_0x376030[_0x4d5b('0x41')];_0x5ef4e9+=0x1){_0x12f8f8=_0x376030[_0x5ef4e9]['toString']();logger['info'](_0x4d5b('0x47'),_0x12f8f8);if(_0x127189){logger[_0x4d5b('0x2b')](_0x4d5b('0x48'),_0x127189);logger[_0x4d5b('0x2b')](JSON[_0x4d5b('0x1f')](_0x2033e5[_0x12f8f8]));BPromise[_0x4d5b('0x49')]()[_0x4d5b('0x26')](handleJob(_0x2033e5[_0x12f8f8]));logger[_0x4d5b('0x2b')]('run\x20job',_0x2033e5[_0x12f8f8][_0x4d5b('0x12')],_0x2033e5[_0x12f8f8][_0x4d5b('0x4a')]);}else if(_0x2033e5[_0x12f8f8][_0x4d5b('0x4a')]&&_0x2033e5[_0x12f8f8]['active']&&moment()[_0x4d5b('0x4b')](_0x2033e5[_0x12f8f8]['startAt'],_0x2033e5[_0x12f8f8][_0x4d5b('0x4c')])){manager[_0x4d5b('0x4d')](_0x12f8f8,_0x2033e5[_0x12f8f8]['cron'],handleJob(_0x2033e5[_0x12f8f8]));manager[_0x4d5b('0x4e')](_0x12f8f8);logger[_0x4d5b('0x2b')](_0x4d5b('0x4f'),_0x2033e5[_0x12f8f8][_0x4d5b('0x12')],_0x2033e5[_0x12f8f8][_0x4d5b('0x4a')]);}else if(manager[_0x4d5b('0x42')](_0x12f8f8)){manager[_0x4d5b('0x43')](_0x12f8f8);manager[_0x4d5b('0x44')](_0x12f8f8);logger[_0x4d5b('0x2b')](_0x4d5b('0x50'),_0x2033e5[_0x12f8f8][_0x4d5b('0x12')],_0x2033e5[_0x12f8f8][_0x4d5b('0x4a')]);}}for(_0x5ef4e9=0x0,_0x12f8f8;_0x5ef4e9<_0x2710f7[_0x4d5b('0x41')]&&!_0x127189;_0x5ef4e9+=0x1){_0x12f8f8=_0x2710f7[_0x5ef4e9]['toString']();if(manager['exists'](_0x12f8f8)){if(_0x2033e5[_0x12f8f8][_0x4d5b('0x4a')]&&_0x2033e5[_0x12f8f8][_0x4d5b('0x51')]&&moment()[_0x4d5b('0x4b')](_0x2033e5[_0x12f8f8]['startAt'],_0x2033e5[_0x12f8f8][_0x4d5b('0x4c')])){manager[_0x4d5b('0x52')](_0x12f8f8,_0x2033e5[_0x12f8f8][_0x4d5b('0x4a')],handleJob(_0x2033e5[_0x12f8f8]));logger[_0x4d5b('0x2b')](_0x4d5b('0x53'),_0x2033e5[_0x12f8f8][_0x4d5b('0x12')],_0x2033e5[_0x12f8f8][_0x4d5b('0x4a')]);}else{manager[_0x4d5b('0x43')](_0x12f8f8);manager[_0x4d5b('0x44')](_0x12f8f8);logger[_0x4d5b('0x2b')](_0x4d5b('0x50'),_0x2033e5[_0x12f8f8][_0x4d5b('0x12')],_0x2033e5[_0x12f8f8][_0x4d5b('0x4a')]);}}}})[_0x4d5b('0x2a')](function(_0x454285){logger[_0x4d5b('0x27')](JSON['stringify'](_0x454285));});}exports[_0x4d5b('0x54')]=function(_0x3dac91){return getJobs(_0x3dac91);};exports[_0x4d5b('0x4e')]=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 d12e4cc..45ee5f3 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 _0x720e=['TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Positive','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','push','lodash','aws-sdk','request-promise','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeRegion','then','transcribeName'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x720e,0x1cb));var _0xe720=function(_0x5c98ea,_0xa782aa){_0x5c98ea=_0x5c98ea-0x0;var _0x51e853=_0x720e[_0x5c98ea];return _0x51e853;};var _=require(_0xe720('0x0'));var AWS=require(_0xe720('0x1'));var rp=require(_0xe720('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0xe720('0x3'))['db'];var logger=require('../../config/logger')(_0xe720('0x4'));function getTranscriptionJob(_0x22eb1f,_0x42ebdc,_0x403cce,_0x92c299){return new Promise(function(_0x43463b,_0x3952f0){var _0x4ffe24=new AWS[(_0xe720('0x5'))]({'accessKeyId':_0x42ebdc,'secretAccessKey':_0x22eb1f,'region':_0x403cce});_0x4ffe24[_0xe720('0x6')]({'TranscriptionJobName':_0x92c299},function(_0x4e715c,_0x4a3b70){if(_0x4e715c){return _0x3952f0(_0x4e715c);}else{return _0x43463b(_0x4a3b70);}});});}function sentiment(_0x4ffad8,_0x812c3b,_0x2e08e7,_0x1891f7,_0x5b0926){return new Promise(function(_0x553bc8,_0x1d8689){var _0x189ca2=new AWS[(_0xe720('0x7'))]({'accessKeyId':_0x812c3b,'secretAccessKey':_0x4ffad8,'region':_0x2e08e7});_0x189ca2[_0xe720('0x8')]({'Text':_0x1891f7,'LanguageCode':_0x5b0926[_0xe720('0x9')](0x0,0x2)},function(_0x5ee664,_0x4d651f){if(_0x5ee664){return _0x1d8689(_0x5ee664);}else{return _0x553bc8(_0x4d651f);}});});}function checkTranscribeJob(_0x2dd7bc,_0x128830,_0x1a82cc){var _0xac0320;return new BPromise(function(_0xea1a0a,_0x42a109){logger[_0xe720('0xa')](util[_0xe720('0xb')](_0xe720('0xc'),_0x2dd7bc['id'],_0x2dd7bc['transcribeName']));return getTranscriptionJob(_0x1a82cc['data1'],_0x1a82cc[_0xe720('0xd')],_0x128830[_0xe720('0xe')],_0x2dd7bc['transcribeName'])[_0xe720('0xf')](function(_0x2fd06d){logger['info'](util[_0xe720('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x2dd7bc['id'],_0x2dd7bc[_0xe720('0x10')],_0x2fd06d[_0xe720('0x11')]['TranscriptionJobStatus']));if(!_0x2dd7bc[_0xe720('0x12')]){switch(_0x2fd06d['TranscriptionJob'][_0xe720('0x13')]){case _0xe720('0x14'):var _0x37928b={'transcribeStatus':_0x2fd06d['TranscriptionJob'][_0xe720('0x13')],'fileUri':_0x2fd06d['TranscriptionJob'][_0xe720('0x15')][_0xe720('0x16')]};logger[_0xe720('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x2dd7bc['id']));return rp({'uri':_0x2fd06d[_0xe720('0x11')]['Transcript'][_0xe720('0x16')],'json':!![]})[_0xe720('0xf')](function(_0xa0fa1a){logger[_0xe720('0xa')](util[_0xe720('0xb')](_0xe720('0x17'),_0x2dd7bc['id']));if(_0xa0fa1a&&_0xa0fa1a['results']&&_0xa0fa1a[_0xe720('0x18')][_0xe720('0x19')]&&_0xa0fa1a[_0xe720('0x18')]['transcripts'][_0xe720('0x1a')]){_0x37928b[_0xe720('0x12')]='';for(var _0x3bc303=0x0;_0x3bc303<_0xa0fa1a[_0xe720('0x18')][_0xe720('0x19')][_0xe720('0x1a')];_0x3bc303++){_0x37928b[_0xe720('0x12')]+=_0xa0fa1a[_0xe720('0x18')][_0xe720('0x19')][_0x3bc303][_0xe720('0x1b')]+'';}}return _0x2dd7bc[_0xe720('0x1c')](_0x37928b);})[_0xe720('0xf')](function(){logger['info'](util[_0xe720('0xb')](_0xe720('0x1d'),_0x2dd7bc['id']));if(!_0x2dd7bc[_0xe720('0x1e')]){throw new db[(_0xe720('0x1f'))]['ValidationError'](_0xe720('0x20'));}if(!_0x128830[_0xe720('0x21')]||!_0x128830[_0xe720('0x22')]||!_0x128830[_0xe720('0x23')]||!_0x128830[_0xe720('0x24')]||!_0x128830[_0xe720('0x25')]){throw new db[(_0xe720('0x1f'))][(_0xe720('0x26'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x37928b[_0xe720('0x12')]){throw new Error(_0xe720('0x27'));}if(_0x128830['sentimentAccountId']===_0x1a82cc['id']){return _0x1a82cc;}else{return db['CloudProvider'][_0xe720('0x28')]({'where':{'id':_settings[_0xe720('0x22')]}});}})[_0xe720('0xf')](function(_0x51b4ff){if(!_0x51b4ff){throw new db['Sequelize'][(_0xe720('0x26'))](_0xe720('0x29'));}if(!_0x51b4ff[_0xe720('0x2a')]||!_0x51b4ff[_0xe720('0xd')]){throw new db['Sequelize'][(_0xe720('0x26'))](_0xe720('0x2b'));}_0xac0320=_0x51b4ff;logger[_0xe720('0xa')](util[_0xe720('0xb')](_0xe720('0x2c'),_0x2dd7bc['id']));return sentiment(_0xac0320[_0xe720('0x2a')],_0xac0320[_0xe720('0xd')],_0x128830[_0xe720('0x23')],_0x37928b[_0xe720('0x12')],_0x128830['language']);})['then'](function(_0x43e06a){logger['info'](util[_0xe720('0xb')](_0xe720('0x2d'),_0x2dd7bc['id']));return _0x2dd7bc[_0xe720('0x1c')]({'sentiment':_0x43e06a[_0xe720('0x2e')],'sPositive':_0x43e06a[_0xe720('0x2f')]['Positive'],'sNegative':_0x43e06a[_0xe720('0x2f')]['Negative'],'sMixed':_0x43e06a[_0xe720('0x2f')][_0xe720('0x30')],'sNeutral':_0x43e06a[_0xe720('0x2f')]['Neutral']});})['then'](function(){logger[_0xe720('0xa')](util[_0xe720('0xb')](_0xe720('0x1d'),_0x2dd7bc['id']));_0xea1a0a();});case _0xe720('0x31'):return _0x2dd7bc[_0xe720('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x2fd06d[_0xe720('0x11')]['FailureReason']})['then'](function(){logger[_0xe720('0xa')](util[_0xe720('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2dd7bc['id']));_0xea1a0a();});default:logger[_0xe720('0xa')](util[_0xe720('0xb')](_0xe720('0x32'),_0x2dd7bc['id']));break;}}else{return BPromise[_0xe720('0x33')]()[_0xe720('0xf')](function(){if(!_0x2dd7bc['tempSentiment']){throw new db[(_0xe720('0x1f'))][(_0xe720('0x26'))](_0xe720('0x20'));}if(!_0x128830[_0xe720('0x21')]||!_0x128830[_0xe720('0x22')]||!_0x128830[_0xe720('0x23')]||!_0x128830[_0xe720('0x24')]||!_0x128830[_0xe720('0x25')]){throw new db[(_0xe720('0x1f'))][(_0xe720('0x26'))](_0xe720('0x34'));}if(!_0x2dd7bc[_0xe720('0x12')]){throw new Error(_0xe720('0x27'));}if(_0x128830[_0xe720('0x22')]===_0x1a82cc['id']){return _0x1a82cc;}else{return db[_0xe720('0x35')][_0xe720('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xe720('0xf')](function(_0x9b9279){if(!_0x9b9279){throw new db[(_0xe720('0x1f'))][(_0xe720('0x26'))](_0xe720('0x29'));}if(!_0x9b9279[_0xe720('0x2a')]||!_0x9b9279[_0xe720('0xd')]){throw new db[(_0xe720('0x1f'))][(_0xe720('0x26'))](_0xe720('0x2b'));}_0xac0320=_0x9b9279;logger[_0xe720('0xa')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2dd7bc['id']));return sentiment(_0xac0320[_0xe720('0x2a')],_0xac0320[_0xe720('0xd')],_0x128830[_0xe720('0x23')],_0x2dd7bc['fileText'],_0x128830[_0xe720('0x24')]);})['then'](function(_0x33ddec){logger[_0xe720('0xa')](util['format'](_0xe720('0x2d'),_0x2dd7bc['id']));return _0x2dd7bc[_0xe720('0x1c')]({'sentiment':_0x33ddec['Sentiment'],'sPositive':_0x33ddec[_0xe720('0x2f')][_0xe720('0x36')],'sNegative':_0x33ddec[_0xe720('0x2f')][_0xe720('0x37')],'sMixed':_0x33ddec[_0xe720('0x2f')]['Mixed'],'sNeutral':_0x33ddec[_0xe720('0x2f')]['Neutral'],'transcribeStatus':_0xe720('0x14')});})[_0xe720('0xf')](function(){logger[_0xe720('0xa')](util[_0xe720('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2dd7bc['id']));_0xea1a0a();});}})[_0xe720('0x38')](function(_0x28e23d){if(_0x28e23d){if(!_0x28e23d[_0xe720('0x39')]||_0x28e23d[_0xe720('0x39')]!==_0xe720('0x3a')){logger[_0xe720('0x3b')](util['format'](_0xe720('0x3c'),_0x2dd7bc['id']),util[_0xe720('0x3d')](_0x28e23d,{'showHidden':![],'depth':null}));}}_0xea1a0a();});});}function checkTranscribe(){var _0x5ec662;var _0x1f74bd;var _0x295f72;return db[_0xe720('0x3e')]['findAll']({'where':{'transcribeStatus':_0xe720('0x3f')}})[_0xe720('0xf')](function(_0x2278d5){if(!_0x2278d5||!_0x2278d5[_0xe720('0x1a')]){throw new db[(_0xe720('0x1f'))]['ValidationError'](_0xe720('0x40'));}_0x5ec662=_0x2278d5;return db['Setting'][_0xe720('0x28')]({'where':{'id':0x1}});})[_0xe720('0xf')](function(_0x4f2ede){if(!_0x4f2ede){throw new db[(_0xe720('0x1f'))][(_0xe720('0x26'))](_0xe720('0x41'));}_0x1f74bd=_0x4f2ede;if(!_0x1f74bd[_0xe720('0x4')]||!_0x1f74bd[_0xe720('0x42')]||!_0x1f74bd[_0xe720('0xe')]||!_0x1f74bd['language']||!_0x1f74bd[_0xe720('0x25')]){throw new db['Sequelize'][(_0xe720('0x26'))]('Transcribe\x20not\x20configured');}return db[_0xe720('0x35')][_0xe720('0x28')]({'where':{'id':_0x1f74bd[_0xe720('0x42')]}});})['then'](function(_0x5c1e87){if(!_0x5c1e87){throw new db[(_0xe720('0x1f'))][(_0xe720('0x26'))](_0xe720('0x29'));}if(!_0x5c1e87[_0xe720('0x2a')]||!_0x5c1e87[_0xe720('0xd')]){throw new db[(_0xe720('0x1f'))][(_0xe720('0x26'))](_0xe720('0x2b'));}_0x295f72=_0x5c1e87;var _0x2cf50a=[];_0x5ec662['forEach'](function(_0x2acfb7){_0x2cf50a[_0xe720('0x43')](checkTranscribeJob(_0x2acfb7,_0x1f74bd,_0x295f72));});return BPromise['all'](_0x2cf50a);})[_0xe720('0x38')](function(_0x131b9f){if(_0x131b9f){if(!_0x131b9f[_0xe720('0x39')]||_0x131b9f[_0xe720('0x39')]!==_0xe720('0x3a')){logger['error'](util[_0xe720('0x3d')](_0x131b9f,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2c91=['findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Neutral','catch','name','SequelizeValidationError','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','error','start','aws-sdk','util','bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','FAILED','resolve','Transcript\x20not\x20available'];(function(_0x4651bd,_0x12a42f){var _0xdf510d=function(_0x12e500){while(--_0x12e500){_0x4651bd['push'](_0x4651bd['shift']());}};_0xdf510d(++_0x12a42f);}(_0x2c91,0xe0));var _0x12c9=function(_0x446862,_0x279058){_0x446862=_0x446862-0x0;var _0x3375c7=_0x2c91[_0x446862];return _0x3375c7;};var _=require('lodash');var AWS=require(_0x12c9('0x0'));var rp=require('request-promise');var util=require(_0x12c9('0x1'));var BPromise=require(_0x12c9('0x2'));var db=require(_0x12c9('0x3'))['db'];var logger=require('../../config/logger')(_0x12c9('0x4'));function getTranscriptionJob(_0x57bc61,_0x389a44,_0x584299,_0x4b31ed){return new Promise(function(_0x57f5bb,_0x471299){var _0x15aa3a=new AWS[(_0x12c9('0x5'))]({'accessKeyId':_0x389a44,'secretAccessKey':_0x57bc61,'region':_0x584299});_0x15aa3a['getTranscriptionJob']({'TranscriptionJobName':_0x4b31ed},function(_0x33b83e,_0x49e4eb){if(_0x33b83e){return _0x471299(_0x33b83e);}else{return _0x57f5bb(_0x49e4eb);}});});}function sentiment(_0x1cbf4b,_0x4440ed,_0x58dbb1,_0x2a66cc,_0x3e7ca8){return new Promise(function(_0x3c2399,_0x3325ce){var _0x2cad41=new AWS[(_0x12c9('0x6'))]({'accessKeyId':_0x4440ed,'secretAccessKey':_0x1cbf4b,'region':_0x58dbb1});_0x2cad41[_0x12c9('0x7')]({'Text':_0x2a66cc,'LanguageCode':_0x3e7ca8[_0x12c9('0x8')](0x0,0x2)},function(_0x1552a9,_0x1949f5){if(_0x1552a9){return _0x3325ce(_0x1552a9);}else{return _0x3c2399(_0x1949f5);}});});}function checkTranscribeJob(_0x223787,_0x180d37,_0x503880){var _0x43c54d;return new BPromise(function(_0x4d22bc,_0x2527cd){logger[_0x12c9('0x9')](util[_0x12c9('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x223787['id'],_0x223787[_0x12c9('0xb')]));return getTranscriptionJob(_0x503880[_0x12c9('0xc')],_0x503880[_0x12c9('0xd')],_0x180d37['transcribeRegion'],_0x223787[_0x12c9('0xb')])[_0x12c9('0xe')](function(_0x1d4222){logger['info'](util[_0x12c9('0xa')](_0x12c9('0xf'),_0x223787['id'],_0x223787[_0x12c9('0xb')],_0x1d4222[_0x12c9('0x10')][_0x12c9('0x11')]));if(!_0x223787[_0x12c9('0x12')]){switch(_0x1d4222['TranscriptionJob'][_0x12c9('0x11')]){case _0x12c9('0x13'):var _0x3ae12f={'transcribeStatus':_0x1d4222[_0x12c9('0x10')][_0x12c9('0x11')],'fileUri':_0x1d4222[_0x12c9('0x10')]['Transcript']['TranscriptFileUri']};logger['info'](util[_0x12c9('0xa')](_0x12c9('0x14'),_0x223787['id']));return rp({'uri':_0x1d4222[_0x12c9('0x10')]['Transcript'][_0x12c9('0x15')],'json':!![]})[_0x12c9('0xe')](function(_0x16a2f5){logger['info'](util[_0x12c9('0xa')](_0x12c9('0x16'),_0x223787['id']));if(_0x16a2f5&&_0x16a2f5[_0x12c9('0x17')]&&_0x16a2f5[_0x12c9('0x17')]['transcripts']&&_0x16a2f5[_0x12c9('0x17')]['transcripts'][_0x12c9('0x18')]){_0x3ae12f[_0x12c9('0x12')]='';for(var _0x30998f=0x0;_0x30998f<_0x16a2f5[_0x12c9('0x17')]['transcripts'][_0x12c9('0x18')];_0x30998f++){_0x3ae12f[_0x12c9('0x12')]+=_0x16a2f5[_0x12c9('0x17')]['transcripts'][_0x30998f][_0x12c9('0x19')]+'';}}return _0x223787[_0x12c9('0x1a')](_0x3ae12f);})[_0x12c9('0xe')](function(){logger[_0x12c9('0x9')](util[_0x12c9('0xa')](_0x12c9('0x1b'),_0x223787['id']));if(!_0x223787[_0x12c9('0x1c')]){throw new db[(_0x12c9('0x1d'))][(_0x12c9('0x1e'))](_0x12c9('0x1f'));}if(!_0x180d37[_0x12c9('0x20')]||!_0x180d37['sentimentAccountId']||!_0x180d37[_0x12c9('0x21')]||!_0x180d37[_0x12c9('0x22')]||!_0x180d37[_0x12c9('0x23')]){throw new db[(_0x12c9('0x1d'))][(_0x12c9('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3ae12f[_0x12c9('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x180d37[_0x12c9('0x24')]===_0x503880['id']){return _0x503880;}else{return db[_0x12c9('0x25')]['findOne']({'where':{'id':_settings[_0x12c9('0x24')]}});}})[_0x12c9('0xe')](function(_0x2c368a){if(!_0x2c368a){throw new db['Sequelize'][(_0x12c9('0x1e'))](_0x12c9('0x26'));}if(!_0x2c368a[_0x12c9('0xc')]||!_0x2c368a[_0x12c9('0xd')]){throw new db[(_0x12c9('0x1d'))]['ValidationError'](_0x12c9('0x27'));}_0x43c54d=_0x2c368a;logger[_0x12c9('0x9')](util[_0x12c9('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x223787['id']));return sentiment(_0x43c54d[_0x12c9('0xc')],_0x43c54d['data2'],_0x180d37[_0x12c9('0x21')],_0x3ae12f[_0x12c9('0x12')],_0x180d37[_0x12c9('0x22')]);})[_0x12c9('0xe')](function(_0x25aa1b){logger['info'](util['format'](_0x12c9('0x28'),_0x223787['id']));return _0x223787['update']({'sentiment':_0x25aa1b['Sentiment'],'sPositive':_0x25aa1b[_0x12c9('0x29')][_0x12c9('0x2a')],'sNegative':_0x25aa1b[_0x12c9('0x29')][_0x12c9('0x2b')],'sMixed':_0x25aa1b['SentimentScore'][_0x12c9('0x2c')],'sNeutral':_0x25aa1b['SentimentScore']['Neutral']});})[_0x12c9('0xe')](function(){logger[_0x12c9('0x9')](util['format'](_0x12c9('0x1b'),_0x223787['id']));_0x4d22bc();});case _0x12c9('0x2d'):return _0x223787[_0x12c9('0x1a')]({'transcribeStatus':'FAILED','failureReason':_0x1d4222[_0x12c9('0x10')]['FailureReason']})[_0x12c9('0xe')](function(){logger[_0x12c9('0x9')](util[_0x12c9('0xa')](_0x12c9('0x1b'),_0x223787['id']));_0x4d22bc();});default:logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x223787['id']));break;}}else{return BPromise[_0x12c9('0x2e')]()[_0x12c9('0xe')](function(){if(!_0x223787['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x12c9('0x1f'));}if(!_0x180d37[_0x12c9('0x20')]||!_0x180d37[_0x12c9('0x24')]||!_0x180d37[_0x12c9('0x21')]||!_0x180d37['language']||!_0x180d37[_0x12c9('0x23')]){throw new db[(_0x12c9('0x1d'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x223787[_0x12c9('0x12')]){throw new Error(_0x12c9('0x2f'));}if(_0x180d37[_0x12c9('0x24')]===_0x503880['id']){return _0x503880;}else{return db[_0x12c9('0x25')][_0x12c9('0x30')]({'where':{'id':_settings[_0x12c9('0x24')]}});}})[_0x12c9('0xe')](function(_0x23b59e){if(!_0x23b59e){throw new db[(_0x12c9('0x1d'))][(_0x12c9('0x1e'))](_0x12c9('0x26'));}if(!_0x23b59e['data1']||!_0x23b59e['data2']){throw new db[(_0x12c9('0x1d'))][(_0x12c9('0x1e'))](_0x12c9('0x27'));}_0x43c54d=_0x23b59e;logger[_0x12c9('0x9')](util['format'](_0x12c9('0x31'),_0x223787['id']));return sentiment(_0x43c54d['data1'],_0x43c54d[_0x12c9('0xd')],_0x180d37['sentimentRegion'],_0x223787[_0x12c9('0x12')],_0x180d37[_0x12c9('0x22')]);})[_0x12c9('0xe')](function(_0x228cf9){logger[_0x12c9('0x9')](util['format'](_0x12c9('0x28'),_0x223787['id']));return _0x223787[_0x12c9('0x1a')]({'sentiment':_0x228cf9[_0x12c9('0x32')],'sPositive':_0x228cf9['SentimentScore']['Positive'],'sNegative':_0x228cf9['SentimentScore']['Negative'],'sMixed':_0x228cf9[_0x12c9('0x29')][_0x12c9('0x2c')],'sNeutral':_0x228cf9[_0x12c9('0x29')][_0x12c9('0x33')],'transcribeStatus':_0x12c9('0x13')});})['then'](function(){logger[_0x12c9('0x9')](util[_0x12c9('0xa')](_0x12c9('0x1b'),_0x223787['id']));_0x4d22bc();});}})[_0x12c9('0x34')](function(_0x126338){if(_0x126338){if(!_0x126338[_0x12c9('0x35')]||_0x126338[_0x12c9('0x35')]!==_0x12c9('0x36')){logger['error'](util[_0x12c9('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x223787['id']),util[_0x12c9('0x37')](_0x126338,{'showHidden':![],'depth':null}));}}_0x4d22bc();});});}function checkTranscribe(){var _0x39fb55;var _0xf993a7;var _0x3a00a3;return db['VoiceRecording'][_0x12c9('0x38')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3050ec){if(!_0x3050ec||!_0x3050ec[_0x12c9('0x18')]){throw new db[(_0x12c9('0x1d'))][(_0x12c9('0x1e'))](_0x12c9('0x39'));}_0x39fb55=_0x3050ec;return db[_0x12c9('0x3a')][_0x12c9('0x30')]({'where':{'id':0x1}});})[_0x12c9('0xe')](function(_0x1a36ad){if(!_0x1a36ad){throw new db['Sequelize'][(_0x12c9('0x1e'))](_0x12c9('0x3b'));}_0xf993a7=_0x1a36ad;if(!_0xf993a7['transcribe']||!_0xf993a7[_0x12c9('0x3c')]||!_0xf993a7[_0x12c9('0x3d')]||!_0xf993a7[_0x12c9('0x22')]||!_0xf993a7[_0x12c9('0x23')]){throw new db[(_0x12c9('0x1d'))][(_0x12c9('0x1e'))](_0x12c9('0x3e'));}return db[_0x12c9('0x25')]['findOne']({'where':{'id':_0xf993a7['transcribeAccountId']}});})['then'](function(_0x3da484){if(!_0x3da484){throw new db[(_0x12c9('0x1d'))][(_0x12c9('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3da484[_0x12c9('0xc')]||!_0x3da484[_0x12c9('0xd')]){throw new db[(_0x12c9('0x1d'))][(_0x12c9('0x1e'))](_0x12c9('0x27'));}_0x3a00a3=_0x3da484;var _0x53aba5=[];_0x39fb55[_0x12c9('0x3f')](function(_0x2b78f3){_0x53aba5[_0x12c9('0x40')](checkTranscribeJob(_0x2b78f3,_0xf993a7,_0x3a00a3));});return BPromise[_0x12c9('0x41')](_0x53aba5);})[_0x12c9('0x34')](function(_0x172adb){if(_0x172adb){if(!_0x172adb[_0x12c9('0x35')]||_0x172adb[_0x12c9('0x35')]!==_0x12c9('0x36')){logger[_0x12c9('0x42')](util['inspect'](_0x172adb,{'showHidden':![],'depth':null}));}}});}exports[_0x12c9('0x43')]=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 aadecf2..167aca3 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 _0x6233=['lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect'];(function(_0x251ba8,_0x5c04eb){var _0x19e422=function(_0x333f5d){while(--_0x333f5d){_0x251ba8['push'](_0x251ba8['shift']());}};_0x19e422(++_0x5c04eb);}(_0x6233,0xba));var _0x3623=function(_0x281c8a,_0x1bfb92){_0x281c8a=_0x281c8a-0x0;var _0x460c8d=_0x6233[_0x281c8a];return _0x460c8d;};'use strict';var _=require(_0x3623('0x0'));var moment=require('moment');var Redis=require(_0x3623('0x1'));var util=require('util');var config=require(_0x3623('0x2'));var db=require(_0x3623('0x3'))['db'];var logger=require(_0x3623('0x4'))(_0x3623('0x5'));config[_0x3623('0x6')]=_[_0x3623('0x7')](config[_0x3623('0x6')],{'host':_0x3623('0x8'),'port':0x18eb});var io=require(_0x3623('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x5bf1d2=[];return db[_0x3623('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x3623('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3623('0xc')](0x18,_0x3623('0xd'))}}})[_0x3623('0xe')](function(_0x1f264f){if(_0x1f264f&&_0x1f264f[_0x3623('0xf')]){_0x5bf1d2=_[_0x3623('0x10')](_0x1f264f||[],'id');logger[_0x3623('0x11')](_0x3623('0x12'),_0x5bf1d2[_0x3623('0x13')]());return db[_0x3623('0xa')][_0x3623('0x14')]({'closeReason':_0x3623('0x15'),'disposition':_0x3623('0x16'),'closed':!![],'closedAt':moment()[_0x3623('0x17')](_0x3623('0x18'))},{'where':{'id':_0x5bf1d2}});}})[_0x3623('0xe')](function(){if(_0x5bf1d2&&_0x5bf1d2[_0x3623('0xf')]){logger['info'](_0x3623('0x19'),_0x5bf1d2[_0x3623('0x13')]());for(var _0x531bb3=0x0;_0x531bb3<_0x5bf1d2[_0x3623('0xf')];_0x531bb3++){io[_0x3623('0x1a')]('whatsappInteraction:update',{'id':_0x5bf1d2[_0x531bb3],'closed':!![]});}}})[_0x3623('0x1b')](function(_0x1d7630){logger[_0x3623('0x1c')](_0x3623('0x1d'),_0x1d7630?util[_0x3623('0x1e')](_0x1d7630,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf9fa=['catch','error','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update'];(function(_0x3257f5,_0x579b22){var _0x54cfc1=function(_0x588452){while(--_0x588452){_0x3257f5['push'](_0x3257f5['shift']());}};_0x54cfc1(++_0x579b22);}(_0xf9fa,0x1b6));var _0xaf9f=function(_0x44c112,_0x43a2c1){_0x44c112=_0x44c112-0x0;var _0x2b1ca8=_0xf9fa[_0x44c112];return _0x2b1ca8;};'use strict';var _=require(_0xaf9f('0x0'));var moment=require(_0xaf9f('0x1'));var Redis=require(_0xaf9f('0x2'));var util=require(_0xaf9f('0x3'));var config=require(_0xaf9f('0x4'));var db=require(_0xaf9f('0x5'))['db'];var logger=require(_0xaf9f('0x6'))(_0xaf9f('0x7'));config['redis']=_[_0xaf9f('0x8')](config['redis'],{'host':_0xaf9f('0x9'),'port':0x18eb});var io=require(_0xaf9f('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x235929=[];return db[_0xaf9f('0xb')][_0xaf9f('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xaf9f('0xd'))}}})[_0xaf9f('0xe')](function(_0x560b46){if(_0x560b46&&_0x560b46[_0xaf9f('0xf')]){_0x235929=_[_0xaf9f('0x10')](_0x560b46||[],'id');logger[_0xaf9f('0x11')](_0xaf9f('0x12'),_0x235929[_0xaf9f('0x13')]());return db[_0xaf9f('0xb')][_0xaf9f('0x14')]({'closeReason':_0xaf9f('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xaf9f('0x16')](_0xaf9f('0x17'))},{'where':{'id':_0x235929}});}})[_0xaf9f('0xe')](function(){if(_0x235929&&_0x235929['length']){logger[_0xaf9f('0x11')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x235929[_0xaf9f('0x13')]());for(var _0xdc652f=0x0;_0xdc652f<_0x235929[_0xaf9f('0xf')];_0xdc652f++){io[_0xaf9f('0x18')](_0xaf9f('0x19'),{'id':_0x235929[_0xdc652f],'closed':!![]});}}})[_0xaf9f('0x1a')](function(_0x33803a){logger[_0xaf9f('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x33803a?util['inspect'](_0x33803a,{'showHidden':![],'depth':null}):'');});}exports[_0xaf9f('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 7e9f2f3..86a883b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe89f=['contacts2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1'];(function(_0x454166,_0x51a652){var _0x1404ee=function(_0x357bb1){while(--_0x357bb1){_0x454166['push'](_0x454166['shift']());}};_0x1404ee(++_0x51a652);}(_0xe89f,0xb6));var _0xfe89=function(_0x4072c2,_0x5987f9){_0x4072c2=_0x4072c2-0x0;var _0xd10bd7=_0xe89f[_0x4072c2];return _0xd10bd7;};'use strict';var util=require(_0xfe89('0x0'));var db=require(_0xfe89('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xfe89('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xfe89('0x3')+i,'phone':0xf879fb460+i,'email':_0xfe89('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xfe89('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xfe89('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xfe89('0x3')+i,'phone':0xf879fb460+i,'email':_0xfe89('0x4')+i+_0xfe89('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xfe89('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xfe89('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xfe89('0x5')](),'updatedAt':Date['now']()});}db[_0xfe89('0x7')][_0xfe89('0x8')]({'where':{}})[_0xfe89('0x9')](function(){return db[_0xfe89('0x7')][_0xfe89('0xa')](contacts);})['then'](function(){console[_0xfe89('0xb')](_0xfe89('0xc'),_0xfe89('0xd'));return db[_0xfe89('0xe')][_0xfe89('0x8')]({'where':{}});})['then'](function(){return db['CmHopper'][_0xfe89('0xa')](hopper);})[_0xfe89('0x9')](function(){console[_0xfe89('0xb')]('finished\x20populating',_0xfe89('0xf'));return db[_0xfe89('0x7')][_0xfe89('0xa')](contacts2);})[_0xfe89('0x9')](function(){console[_0xfe89('0xb')](_0xfe89('0xc'),_0xfe89('0x10'));return db[_0xfe89('0xe')][_0xfe89('0xa')](hopper2);})['then'](function(){console[_0xfe89('0xb')](_0xfe89('0xc'),'hopper2');})[_0xfe89('0x11')](function(_0x1afc45){console[_0xfe89('0xb')](_0x1afc45);}); \ No newline at end of file +var _0x1892=['@xcally.com','CmContact','then','bulkCreate','finished\x20populating','CmHopper','destroy','log','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','innocenzo.biondo','push','now'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1892,0x1a3));var _0x2189=function(_0x11262c,_0x4f6aff){_0x11262c=_0x11262c-0x0;var _0x2e488f=_0x1892[_0x11262c];return _0x2e488f;};'use strict';var util=require(_0x2189('0x0'));var db=require(_0x2189('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x2189('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2189('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2189('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2189('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2189('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2189('0x3')+i+_0x2189('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2189('0x5')](),'updatedAt':Date[_0x2189('0x5')]()});}db[_0x2189('0x7')]['destroy']({'where':{}})[_0x2189('0x8')](function(){return db[_0x2189('0x7')][_0x2189('0x9')](contacts);})[_0x2189('0x8')](function(){console['log'](_0x2189('0xa'),'contacts1');return db[_0x2189('0xb')][_0x2189('0xc')]({'where':{}});})['then'](function(){return db[_0x2189('0xb')][_0x2189('0x9')](hopper);})[_0x2189('0x8')](function(){console[_0x2189('0xd')](_0x2189('0xa'),'hopper1');return db[_0x2189('0x7')][_0x2189('0x9')](contacts2);})['then'](function(){console[_0x2189('0xd')]('finished\x20populating',_0x2189('0xe'));return db[_0x2189('0xb')][_0x2189('0x9')](hopper2);})[_0x2189('0x8')](function(){console[_0x2189('0xd')]('finished\x20populating',_0x2189('0xf'));})[_0x2189('0x10')](function(_0x3b8236){console['log'](_0x3b8236);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3b67f6b..cd58eab 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d20=['format','%s%s@xcally.com','password','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','util','../mysqldb','push','%s%s','agent'];(function(_0x131bc7,_0x5f0f52){var _0x2b887b=function(_0x212f71){while(--_0x212f71){_0x131bc7['push'](_0x131bc7['shift']());}};_0x2b887b(++_0x5f0f52);}(_0x5d20,0xc3));var _0x05d2=function(_0x142849,_0x4f35eb){_0x142849=_0x142849-0x0;var _0x59d465=_0x5d20[_0x142849];return _0x59d465;};'use strict';var util=require(_0x05d2('0x0'));var db=require(_0x05d2('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x05d2('0x2')]({'name':util['format'](_0x05d2('0x3'),_0x05d2('0x4'),i),'fullname':util[_0x05d2('0x5')](_0x05d2('0x3'),_0x05d2('0x4'),i),'email':util[_0x05d2('0x5')](_0x05d2('0x6'),_0x05d2('0x4'),i),'role':_0x05d2('0x4'),'password':_0x05d2('0x7'),'internal':0xfa0+i,'type':_0x05d2('0x8'),'transport':[_0x05d2('0x9'),'ws',_0x05d2('0xa')],'disallow':[_0x05d2('0xb')],'allow':['ulaw'],'defaultuser':util[_0x05d2('0x5')]('%s%s',_0x05d2('0x4'),i),'encryption':_0x05d2('0xc'),'avpf':'yes','force_avp':_0x05d2('0xc'),'icesupport':_0x05d2('0xc'),'dtlsenable':_0x05d2('0xc'),'dtlsverify':'no','dtlscertfile':_0x05d2('0xd'),'dtlsprivatekey':_0x05d2('0xe'),'dtlssetup':'actpass','callerid':util['format'](_0x05d2('0xf'),util[_0x05d2('0x5')](_0x05d2('0x3'),_0x05d2('0x4'),i),0xfa0+i)});}db['User'][_0x05d2('0x10')](users)[_0x05d2('0x11')](function(){console[_0x05d2('0x12')](_0x05d2('0x13'));})['catch'](function(_0x5b9a5e){console[_0x05d2('0x12')](_0x5b9a5e);}); \ No newline at end of file +var _0xce1d=['../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','add\x20user','catch','util'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xce1d,0x84));var _0xdce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce1d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xdce1('0x0'));var db=require(_0xdce1('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xdce1('0x2')]({'name':util[_0xdce1('0x3')](_0xdce1('0x4'),_0xdce1('0x5'),i),'fullname':util['format']('%s%s',_0xdce1('0x5'),i),'email':util[_0xdce1('0x3')](_0xdce1('0x6'),_0xdce1('0x5'),i),'role':'agent','password':_0xdce1('0x7'),'internal':0xfa0+i,'type':_0xdce1('0x8'),'transport':['udp','ws',_0xdce1('0x9')],'disallow':[_0xdce1('0xa')],'allow':['ulaw'],'defaultuser':util[_0xdce1('0x3')](_0xdce1('0x4'),_0xdce1('0x5'),i),'encryption':_0xdce1('0xb'),'avpf':'yes','force_avp':_0xdce1('0xb'),'icesupport':_0xdce1('0xb'),'dtlsenable':_0xdce1('0xb'),'dtlsverify':'no','dtlscertfile':_0xdce1('0xc'),'dtlsprivatekey':_0xdce1('0xd'),'dtlssetup':'actpass','callerid':util[_0xdce1('0x3')](_0xdce1('0xe'),util[_0xdce1('0x3')](_0xdce1('0x4'),_0xdce1('0x5'),i),0xfa0+i)});}db[_0xdce1('0xf')]['bulkCreate'](users)[_0xdce1('0x10')](function(){console['log'](_0xdce1('0x11'));})[_0xdce1('0x12')](function(_0x53836b){console['log'](_0x53836b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 2454cf6..aff1290 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9962=['role','telephone','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','format','%s:queue:%s','length','user:%s','handshake','query','User','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','FaxQueue','MailQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','ChatInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','address','request','remoteAddress','connection','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','Agents','name'];(function(_0x11b266,_0x5c8a35){var _0x3986e7=function(_0x1172e9){while(--_0x1172e9){_0x11b266['push'](_0x11b266['shift']());}};_0x3986e7(++_0x5c8a35);}(_0x9962,0xb8));var _0x2996=function(_0x113a85,_0x50f089){_0x113a85=_0x113a85-0x0;var _0x3c1387=_0x9962[_0x113a85];return _0x3c1387;};'use strict';var _=require(_0x2996('0x0'));var util=require('util');var BPromise=require(_0x2996('0x1'));var db=require(_0x2996('0x2'))['db'];var config=require(_0x2996('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x2996('0x4'),'model':db['User'],'attributes':['id',_0x2996('0x5'),_0x2996('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2996('0x5')],'where':{'role':_0x2996('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x2996('0x5')],'where':{'role':_0x2996('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2996('0x5'),_0x2996('0x9')],'where':{'type':_0x2996('0xa')}};function getAssociatedResources(_0x58a04e,_0x13b5a6,_0x5a24dd){return db[_0x2996('0xb')][_0x2996('0xc')]({'where':{'name':_0x58a04e,'userProfileId':_0x13b5a6},'raw':!![]})[_0x2996('0xd')](function(_0x35bcfe){if(_0x35bcfe){if(_0x35bcfe['autoAssociation']){switch(_0x58a04e){case _0x2996('0xe'):case _0x2996('0xf'):case _0x2996('0x10'):case _0x2996('0x11'):case'MailQueues':case _0x2996('0x12'):case _0x2996('0x13'):return db[_0x5a24dd][_0x2996('0x14')](queryQueues);case _0x2996('0x15'):return db[_0x5a24dd]['findAll'](queryTelephones);case _0x2996('0x16'):return db[_0x5a24dd]['findAll'](queryTrunks);case _0x2996('0x17'):return db[_0x5a24dd][_0x2996('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x2996('0x14')]({'attributes':[_0x2996('0x18')],'where':{'sectionId':_0x35bcfe['id']},'raw':!![]})[_0x2996('0xd')](function(_0x43e380){if(_0x43e380){var _0xc267fb={'where':{'id':_[_0x2996('0x19')](_0x43e380,_0x2996('0x18'))},'raw':!![]};switch(_0x5a24dd){case'User':_0xc267fb['where'][_0x2996('0x6')]=_0x2996('0x7');break;case'Campaign':_0xc267fb['where'][_0x2996('0x9')]=_0x2996('0xa');break;}return db[_0x5a24dd]['findAll'](_0xc267fb);}else{return[];}});}}else{return[];}})[_0x2996('0xd')](function(_0x11ef19){return _0x11ef19;});}function joinOrLeaveQueues(_0x9743ee,_0x330381,_0x289748,_0x350729){_0x9743ee[_0x330381](util[_0x2996('0x1a')](_0x2996('0x1b'),_0x289748,_0x350729[_0x2996('0x5')]));if(_0x350729[_0x2996('0x4')]){for(var _0x5bfc6d=0x0;_0x5bfc6d<_0x350729[_0x2996('0x4')][_0x2996('0x1c')];_0x5bfc6d+=0x1){_0x9743ee[_0x330381](util[_0x2996('0x1a')](_0x2996('0x1d'),_0x350729[_0x2996('0x4')][_0x5bfc6d]['name']));}}}function joinOrLeave(_0x161004,_0x42e5f5,_0x2bfb2b){var _0x4de34d;if(_0x161004[_0x2996('0x1e')][_0x2996('0x1f')]['id']){db[_0x2996('0x20')]['find']({'attributes':['id',_0x2996('0x5'),_0x2996('0x6'),_0x2996('0x21')],'where':{'id':_0x161004['handshake'][_0x2996('0x1f')]['id']},'include':[{'model':db[_0x2996('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2996('0x23')],'as':_0x2996('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x2996('0x25')],'as':_0x2996('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x2996('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2996('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x2996('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x3adddd){if(_0x3adddd){_0x4de34d=_0x3adddd;_0x161004[_0x42e5f5](util[_0x2996('0x1a')](_0x2996('0x1d'),_0x3adddd[_0x2996('0x5')]));var _0x4b3e5e=[];switch(_0x3adddd['role']){case _0x2996('0x2a'):_0x161004[_0x42e5f5](_0x2996('0x2b'));_0x161004[_0x42e5f5](_0x2996('0x2c'));if(queryQueues[_0x2996('0x2d')](_0x2996('0x2e'))){delete queryQueues[_0x2996('0x2e')];}_0x4b3e5e[_0x2996('0x2f')](db[_0x2996('0x30')]['findAll'](queryQueues));_0x4b3e5e[_0x2996('0x2f')](db[_0x2996('0x31')]['findAll'](queryQueues));_0x4b3e5e[_0x2996('0x2f')](db['FaxQueue'][_0x2996('0x14')](queryQueues));_0x4b3e5e[_0x2996('0x2f')](db[_0x2996('0x32')]['findAll'](queryQueues));_0x4b3e5e['push'](db[_0x2996('0x33')]['findAll'](queryQueues));_0x4b3e5e[_0x2996('0x2f')](db[_0x2996('0x34')]['findAll'](queryQueues));_0x4b3e5e[_0x2996('0x2f')](db[_0x2996('0x35')][_0x2996('0x14')](queryQueues));_0x4b3e5e[_0x2996('0x2f')](db[_0x2996('0x20')][_0x2996('0x14')](queryTelephones));_0x4b3e5e['push'](db['Trunk'][_0x2996('0x14')](queryTrunks));_0x4b3e5e[_0x2996('0x2f')](db[_0x2996('0x36')][_0x2996('0x14')](queryCampaigns));_0x4b3e5e[_0x2996('0x2f')](db[_0x2996('0x20')]['findAll'](queryAgents));break;case _0x2996('0x37'):_0x161004[_0x42e5f5](_0x2996('0x2b'));_0x161004[_0x42e5f5]('voice:outbound');_0x4b3e5e['push'](getAssociatedResources(_0x2996('0xe'),_0x3adddd[_0x2996('0x21')],'VoiceQueue'));_0x4b3e5e[_0x2996('0x2f')](getAssociatedResources(_0x2996('0xf'),_0x3adddd[_0x2996('0x21')],_0x2996('0x31')));_0x4b3e5e[_0x2996('0x2f')](getAssociatedResources(_0x2996('0x10'),_0x3adddd[_0x2996('0x21')],_0x2996('0x38')));_0x4b3e5e['push'](getAssociatedResources(_0x2996('0x11'),_0x3adddd[_0x2996('0x21')],_0x2996('0x32')));_0x4b3e5e['push'](getAssociatedResources(_0x2996('0x39'),_0x3adddd['userProfileId'],_0x2996('0x33')));_0x4b3e5e[_0x2996('0x2f')](getAssociatedResources(_0x2996('0x12'),_0x3adddd[_0x2996('0x21')],_0x2996('0x34')));_0x4b3e5e[_0x2996('0x2f')](getAssociatedResources(_0x2996('0x13'),_0x3adddd[_0x2996('0x21')],_0x2996('0x35')));_0x4b3e5e[_0x2996('0x2f')](getAssociatedResources('Telephones',_0x3adddd[_0x2996('0x21')],_0x2996('0x20')));_0x4b3e5e[_0x2996('0x2f')](getAssociatedResources('Trunks',_0x3adddd[_0x2996('0x21')],'Trunk'));_0x4b3e5e['push'](getAssociatedResources(_0x2996('0x17'),_0x3adddd[_0x2996('0x21')],_0x2996('0x36')));_0x4b3e5e['push'](db[_0x2996('0x20')][_0x2996('0x14')](queryAgents));break;case _0x2996('0x8'):_0x161004[_0x42e5f5](_0x2996('0x2b'));_0x161004[_0x42e5f5](_0x2996('0x2c'));_0x4b3e5e[_0x2996('0x2f')](_0x3adddd['getVoiceQueues']({'attributes':['id','name']}));_0x4b3e5e[_0x2996('0x2f')](_0x3adddd[_0x2996('0x3a')]({'attributes':['id',_0x2996('0x5')]}));_0x4b3e5e[_0x2996('0x2f')](_0x3adddd[_0x2996('0x3b')]({'attributes':['id',_0x2996('0x5')]}));_0x4b3e5e[_0x2996('0x2f')](_0x3adddd[_0x2996('0x3c')]({'attributes':['id','name']}));_0x4b3e5e['push'](_0x3adddd['getMailQueues']({'attributes':['id',_0x2996('0x5')]}));_0x4b3e5e[_0x2996('0x2f')](_0x3adddd['getOpenchannelQueues']({'attributes':['id',_0x2996('0x5')]}));_0x4b3e5e[_0x2996('0x2f')](_0x3adddd[_0x2996('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0x2996('0x3e')](_0x4b3e5e);}})[_0x2996('0xd')](function(_0x42fa23){if(_0x42fa23&&_0x42fa23[_0x2996('0x1c')]){for(var _0x1b6d7e=0x0;_0x1b6d7e<_0x42fa23[_0x2996('0x1c')];_0x1b6d7e+=0x1){for(var _0x3096d5=0x0;_0x3096d5<_0x42fa23[_0x1b6d7e][_0x2996('0x1c')];_0x3096d5+=0x1){switch(_0x1b6d7e){case 0x0:joinOrLeaveQueues(_0x161004,_0x42e5f5,_0x2996('0x3f'),_0x42fa23[_0x1b6d7e][_0x3096d5]);break;case 0x1:joinOrLeaveQueues(_0x161004,_0x42e5f5,_0x2996('0x40'),_0x42fa23[_0x1b6d7e][_0x3096d5]);break;case 0x2:joinOrLeaveQueues(_0x161004,_0x42e5f5,'fax',_0x42fa23[_0x1b6d7e][_0x3096d5]);break;case 0x3:joinOrLeaveQueues(_0x161004,_0x42e5f5,'sms',_0x42fa23[_0x1b6d7e][_0x3096d5]);break;case 0x4:joinOrLeaveQueues(_0x161004,_0x42e5f5,'mail',_0x42fa23[_0x1b6d7e][_0x3096d5]);break;case 0x5:joinOrLeaveQueues(_0x161004,_0x42e5f5,_0x2996('0x41'),_0x42fa23[_0x1b6d7e][_0x3096d5]);break;case 0x6:joinOrLeaveQueues(_0x161004,_0x42e5f5,_0x2996('0x42'),_0x42fa23[_0x1b6d7e][_0x3096d5]);break;case 0x7:if(_0x4de34d[_0x2996('0x6')]!==_0x2996('0x8'))_0x161004[_0x42e5f5](util[_0x2996('0x1a')](_0x2996('0x43'),_0x42fa23[_0x1b6d7e][_0x3096d5][_0x2996('0x5')]));break;case 0x8:if(_0x4de34d[_0x2996('0x6')]!==_0x2996('0x8'))_0x161004[_0x42e5f5](util[_0x2996('0x1a')]('trunk:%s',_0x42fa23[_0x1b6d7e][_0x3096d5]['name']));break;case 0x9:if(_0x4de34d[_0x2996('0x6')]!==_0x2996('0x8'))_0x161004[_0x42e5f5](util[_0x2996('0x1a')](_0x2996('0x44'),_0x42fa23[_0x1b6d7e][_0x3096d5][_0x2996('0x9')],_0x42fa23[_0x1b6d7e][_0x3096d5][_0x2996('0x5')]));break;case 0xa:_0x161004[_0x42e5f5](util[_0x2996('0x1a')]('user:%s',_0x42fa23[_0x1b6d7e][_0x3096d5][_0x2996('0x5')]));break;}}}}})[_0x2996('0xd')](function(){if(_0x42e5f5===_0x2996('0x45')){var _0x136e24=_[_0x2996('0x19')](_0x4de34d[_0x2996('0x46')],'id');return _0x4de34d['removeChatInteractions'](_0x136e24)[_0x2996('0xd')](function(){for(var _0x2e1ac7=0x0;_0x2e1ac7<_0x136e24[_0x2996('0x1c')];_0x2e1ac7+=0x1){_0x2bfb2b[_0x2996('0x47')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x136e24[_0x2e1ac7]),'UserId':Number(_0x4de34d['id'])});}});}})['then'](function(){if(_0x42e5f5===_0x2996('0x45')){var _0x270b74=_[_0x2996('0x19')](_0x4de34d[_0x2996('0x24')],'id');return _0x4de34d['removeMailInteractions'](_0x270b74)['then'](function(){for(var _0x50f343=0x0;_0x50f343<_0x270b74[_0x2996('0x1c')];_0x50f343+=0x1){_0x2bfb2b[_0x2996('0x47')](_0x2996('0x48'),{'MailInteractionId':Number(_0x270b74[_0x50f343]),'UserId':Number(_0x4de34d['id'])});}});}})['then'](function(){if(_0x42e5f5===_0x2996('0x45')){var _0x13fb1b=_[_0x2996('0x19')](_0x4de34d[_0x2996('0x26')],'id');return _0x4de34d['removeFaxInteractions'](_0x13fb1b)[_0x2996('0xd')](function(){for(var _0x22eba1=0x0;_0x22eba1<_0x13fb1b[_0x2996('0x1c')];_0x22eba1+=0x1){_0x2bfb2b[_0x2996('0x47')](_0x2996('0x49'),{'FaxInteractionId':Number(_0x13fb1b[_0x22eba1]),'UserId':Number(_0x4de34d['id'])});}});}})['then'](function(){if(_0x42e5f5===_0x2996('0x45')){var _0x1da797=_[_0x2996('0x19')](_0x4de34d[_0x2996('0x27')],'id');return _0x4de34d[_0x2996('0x4a')](_0x1da797)[_0x2996('0xd')](function(){for(var _0x2497a4=0x0;_0x2497a4<_0x1da797[_0x2996('0x1c')];_0x2497a4+=0x1){_0x2bfb2b[_0x2996('0x47')](_0x2996('0x4b'),{'SmsInteractionId':Number(_0x1da797[_0x2497a4]),'UserId':Number(_0x4de34d['id'])});}});}})['then'](function(){if(_0x42e5f5===_0x2996('0x45')){var _0x3c76aa=_[_0x2996('0x19')](_0x4de34d[_0x2996('0x4c')],'id');return _0x4de34d[_0x2996('0x4d')](_0x3c76aa)[_0x2996('0xd')](function(){for(var _0x52b0df=0x0;_0x52b0df<_0x3c76aa['length'];_0x52b0df+=0x1){_0x2bfb2b[_0x2996('0x47')](_0x2996('0x4e'),{'OpenchannelInteractionId':Number(_0x3c76aa[_0x52b0df]),'UserId':Number(_0x4de34d['id'])});}});}})[_0x2996('0xd')](function(){if(_0x42e5f5===_0x2996('0x45')){var _0x4bf78b=_[_0x2996('0x19')](_0x4de34d[_0x2996('0x29')],'id');return _0x4de34d[_0x2996('0x4f')](_0x4bf78b)[_0x2996('0xd')](function(){for(var _0x2a9f6b=0x0;_0x2a9f6b<_0x4bf78b['length'];_0x2a9f6b+=0x1){_0x2bfb2b[_0x2996('0x47')](_0x2996('0x50'),{'WhatsappInteractionId':Number(_0x4bf78b[_0x2a9f6b]),'UserId':Number(_0x4de34d['id'])});}});}})[_0x2996('0x51')](function(_0x3563eb){_0x161004[_0x2996('0x52')](_0x3563eb);});}}function onDisconnect(_0x562bcd,_0x33aac4){joinOrLeave(_0x562bcd,_0x2996('0x45'),_0x33aac4);}function onConnect(_0x50dde0){joinOrLeave(_0x50dde0,_0x2996('0x53'));}exports[_0x2996('0x54')]=function(_0xb09dbe){_0xb09dbe['on']('connection',function(_0x2e9b78){_0x2e9b78['setMaxListeners'](0x0);_0x2e9b78[_0x2996('0x55')]=_0x2e9b78[_0x2996('0x56')]['connection'][_0x2996('0x57')]+':'+_0x2e9b78['request'][_0x2996('0x58')]['remotePort'];_0x2e9b78[_0x2996('0x59')]=new Date();_0x2e9b78[_0x2996('0x52')]=function(_0x2a1a89){console[_0x2996('0x52')](_0x2996('0x5a')+_0x2e9b78[_0x2996('0x5b')][_0x2996('0x5')]+'['+_0x2e9b78['address']+']',_0x2a1a89);};_0x2e9b78['on'](_0x2996('0x5c'),function(){onDisconnect(_0x2e9b78,_0xb09dbe);_0x2e9b78[_0x2996('0x52')](_0x2996('0x5d'));});onConnect(_0x2e9b78);_0x2e9b78[_0x2996('0x52')](_0x2996('0x5e'));});}; \ No newline at end of file +var _0x68ee=['user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','default','setMaxListeners','address','request','connection','remoteAddress','connectedAt','SocketIO\x20','disconnect','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','SmsQueues','WhatsappQueue','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x68ee,0xd3));var _0xe68e=function(_0x2b040e,_0xbda33c){_0x2b040e=_0x2b040e-0x0;var _0x213439=_0x68ee[_0x2b040e];return _0x213439;};'use strict';var _=require(_0xe68e('0x0'));var util=require(_0xe68e('0x1'));var BPromise=require(_0xe68e('0x2'));var db=require(_0xe68e('0x3'))['db'];var config=require(_0xe68e('0x4'));var queryQueues={'attributes':['id',_0xe68e('0x5')],'include':[{'as':_0xe68e('0x6'),'model':db[_0xe68e('0x7')],'attributes':['id','name',_0xe68e('0x8')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe68e('0x5')],'where':{'role':_0xe68e('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xe68e('0x5')],'where':{'role':_0xe68e('0xa')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xe68e('0xb')],'where':{'type':_0xe68e('0xc')}};function getAssociatedResources(_0x4eaebe,_0x2fc0b,_0x13a0f4){return db['UserProfileSection'][_0xe68e('0xd')]({'where':{'name':_0x4eaebe,'userProfileId':_0x2fc0b},'raw':!![]})[_0xe68e('0xe')](function(_0x2b923d){if(_0x2b923d){if(_0x2b923d[_0xe68e('0xf')]){switch(_0x4eaebe){case _0xe68e('0x10'):case _0xe68e('0x11'):case'FaxQueues':case'SmsQueues':case _0xe68e('0x12'):case _0xe68e('0x13'):case _0xe68e('0x14'):return db[_0x13a0f4][_0xe68e('0x15')](queryQueues);case _0xe68e('0x16'):return db[_0x13a0f4]['findAll'](queryTelephones);case _0xe68e('0x17'):return db[_0x13a0f4]['findAll'](queryTrunks);case _0xe68e('0x18'):return db[_0x13a0f4][_0xe68e('0x15')](queryCampaigns);}}else{return db[_0xe68e('0x19')][_0xe68e('0x15')]({'attributes':[_0xe68e('0x1a')],'where':{'sectionId':_0x2b923d['id']},'raw':!![]})['then'](function(_0x115221){if(_0x115221){var _0x215a9e={'where':{'id':_[_0xe68e('0x1b')](_0x115221,_0xe68e('0x1a'))},'raw':!![]};switch(_0x13a0f4){case'User':_0x215a9e[_0xe68e('0x1c')][_0xe68e('0x8')]=_0xe68e('0x9');break;case _0xe68e('0x1d'):_0x215a9e[_0xe68e('0x1c')][_0xe68e('0xb')]=_0xe68e('0xc');break;}return db[_0x13a0f4][_0xe68e('0x15')](_0x215a9e);}else{return[];}});}}else{return[];}})[_0xe68e('0xe')](function(_0x2c17da){return _0x2c17da;});}function joinOrLeaveQueues(_0x1948e9,_0x3ea80c,_0x27bfd5,_0x4d24c7){_0x1948e9[_0x3ea80c](util[_0xe68e('0x1e')](_0xe68e('0x1f'),_0x27bfd5,_0x4d24c7['name']));if(_0x4d24c7[_0xe68e('0x6')]){for(var _0x223243=0x0;_0x223243<_0x4d24c7[_0xe68e('0x6')][_0xe68e('0x20')];_0x223243+=0x1){_0x1948e9[_0x3ea80c](util[_0xe68e('0x1e')](_0xe68e('0x21'),_0x4d24c7[_0xe68e('0x6')][_0x223243][_0xe68e('0x5')]));}}}function joinOrLeave(_0x222c69,_0x5e0475,_0x1efccc){var _0x4c6f55;if(_0x222c69[_0xe68e('0x22')][_0xe68e('0x23')]['id']){db[_0xe68e('0x7')][_0xe68e('0x24')]({'attributes':['id','name',_0xe68e('0x8'),_0xe68e('0x25')],'where':{'id':_0x222c69[_0xe68e('0x22')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xe68e('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe68e('0x27')],'as':_0xe68e('0x28'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xe68e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xe68e('0x2a')],'as':_0xe68e('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe68e('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xe68e('0xe')](function(_0x34938e){if(_0x34938e){_0x4c6f55=_0x34938e;_0x222c69[_0x5e0475](util[_0xe68e('0x1e')](_0xe68e('0x21'),_0x34938e[_0xe68e('0x5')]));var _0xb46b9d=[];switch(_0x34938e[_0xe68e('0x8')]){case'admin':_0x222c69[_0x5e0475](_0xe68e('0x2d'));_0x222c69[_0x5e0475](_0xe68e('0x2e'));if(queryQueues[_0xe68e('0x2f')](_0xe68e('0x30'))){delete queryQueues['include'];}_0xb46b9d[_0xe68e('0x31')](db[_0xe68e('0x32')][_0xe68e('0x15')](queryQueues));_0xb46b9d['push'](db[_0xe68e('0x33')]['findAll'](queryQueues));_0xb46b9d[_0xe68e('0x31')](db['FaxQueue'][_0xe68e('0x15')](queryQueues));_0xb46b9d['push'](db[_0xe68e('0x34')][_0xe68e('0x15')](queryQueues));_0xb46b9d['push'](db[_0xe68e('0x35')][_0xe68e('0x15')](queryQueues));_0xb46b9d['push'](db[_0xe68e('0x36')][_0xe68e('0x15')](queryQueues));_0xb46b9d[_0xe68e('0x31')](db['WhatsappQueue'][_0xe68e('0x15')](queryQueues));_0xb46b9d['push'](db[_0xe68e('0x7')][_0xe68e('0x15')](queryTelephones));_0xb46b9d[_0xe68e('0x31')](db[_0xe68e('0x37')][_0xe68e('0x15')](queryTrunks));_0xb46b9d[_0xe68e('0x31')](db['Campaign']['findAll'](queryCampaigns));_0xb46b9d[_0xe68e('0x31')](db[_0xe68e('0x7')][_0xe68e('0x15')](queryAgents));break;case _0xe68e('0x38'):_0x222c69[_0x5e0475](_0xe68e('0x2d'));_0x222c69[_0x5e0475](_0xe68e('0x2e'));_0xb46b9d[_0xe68e('0x31')](getAssociatedResources(_0xe68e('0x10'),_0x34938e[_0xe68e('0x25')],_0xe68e('0x32')));_0xb46b9d[_0xe68e('0x31')](getAssociatedResources(_0xe68e('0x11'),_0x34938e[_0xe68e('0x25')],'ChatQueue'));_0xb46b9d['push'](getAssociatedResources('FaxQueues',_0x34938e[_0xe68e('0x25')],'FaxQueue'));_0xb46b9d[_0xe68e('0x31')](getAssociatedResources(_0xe68e('0x39'),_0x34938e[_0xe68e('0x25')],_0xe68e('0x34')));_0xb46b9d['push'](getAssociatedResources(_0xe68e('0x12'),_0x34938e[_0xe68e('0x25')],_0xe68e('0x35')));_0xb46b9d['push'](getAssociatedResources(_0xe68e('0x13'),_0x34938e[_0xe68e('0x25')],_0xe68e('0x36')));_0xb46b9d[_0xe68e('0x31')](getAssociatedResources(_0xe68e('0x14'),_0x34938e['userProfileId'],_0xe68e('0x3a')));_0xb46b9d['push'](getAssociatedResources(_0xe68e('0x16'),_0x34938e[_0xe68e('0x25')],_0xe68e('0x7')));_0xb46b9d['push'](getAssociatedResources(_0xe68e('0x17'),_0x34938e[_0xe68e('0x25')],_0xe68e('0x37')));_0xb46b9d[_0xe68e('0x31')](getAssociatedResources(_0xe68e('0x18'),_0x34938e[_0xe68e('0x25')],'Campaign'));_0xb46b9d[_0xe68e('0x31')](db[_0xe68e('0x7')]['findAll'](queryAgents));break;case _0xe68e('0xa'):_0x222c69[_0x5e0475](_0xe68e('0x2d'));_0x222c69[_0x5e0475](_0xe68e('0x2e'));_0xb46b9d[_0xe68e('0x31')](_0x34938e['getVoiceQueues']({'attributes':['id',_0xe68e('0x5')]}));_0xb46b9d[_0xe68e('0x31')](_0x34938e[_0xe68e('0x3b')]({'attributes':['id','name']}));_0xb46b9d[_0xe68e('0x31')](_0x34938e[_0xe68e('0x3c')]({'attributes':['id',_0xe68e('0x5')]}));_0xb46b9d[_0xe68e('0x31')](_0x34938e[_0xe68e('0x3d')]({'attributes':['id',_0xe68e('0x5')]}));_0xb46b9d[_0xe68e('0x31')](_0x34938e[_0xe68e('0x3e')]({'attributes':['id',_0xe68e('0x5')]}));_0xb46b9d['push'](_0x34938e[_0xe68e('0x3f')]({'attributes':['id','name']}));_0xb46b9d[_0xe68e('0x31')](_0x34938e[_0xe68e('0x40')]({'attributes':['id',_0xe68e('0x5')]}));break;}return BPromise['all'](_0xb46b9d);}})['then'](function(_0x8bcdf4){if(_0x8bcdf4&&_0x8bcdf4[_0xe68e('0x20')]){for(var _0x197983=0x0;_0x197983<_0x8bcdf4[_0xe68e('0x20')];_0x197983+=0x1){for(var _0x4525a5=0x0;_0x4525a5<_0x8bcdf4[_0x197983][_0xe68e('0x20')];_0x4525a5+=0x1){switch(_0x197983){case 0x0:joinOrLeaveQueues(_0x222c69,_0x5e0475,_0xe68e('0x41'),_0x8bcdf4[_0x197983][_0x4525a5]);break;case 0x1:joinOrLeaveQueues(_0x222c69,_0x5e0475,'chat',_0x8bcdf4[_0x197983][_0x4525a5]);break;case 0x2:joinOrLeaveQueues(_0x222c69,_0x5e0475,'fax',_0x8bcdf4[_0x197983][_0x4525a5]);break;case 0x3:joinOrLeaveQueues(_0x222c69,_0x5e0475,_0xe68e('0x42'),_0x8bcdf4[_0x197983][_0x4525a5]);break;case 0x4:joinOrLeaveQueues(_0x222c69,_0x5e0475,_0xe68e('0x43'),_0x8bcdf4[_0x197983][_0x4525a5]);break;case 0x5:joinOrLeaveQueues(_0x222c69,_0x5e0475,_0xe68e('0x44'),_0x8bcdf4[_0x197983][_0x4525a5]);break;case 0x6:joinOrLeaveQueues(_0x222c69,_0x5e0475,_0xe68e('0x45'),_0x8bcdf4[_0x197983][_0x4525a5]);break;case 0x7:if(_0x4c6f55['role']!==_0xe68e('0xa'))_0x222c69[_0x5e0475](util['format'](_0xe68e('0x46'),_0x8bcdf4[_0x197983][_0x4525a5][_0xe68e('0x5')]));break;case 0x8:if(_0x4c6f55['role']!=='agent')_0x222c69[_0x5e0475](util[_0xe68e('0x1e')](_0xe68e('0x47'),_0x8bcdf4[_0x197983][_0x4525a5]['name']));break;case 0x9:if(_0x4c6f55['role']!==_0xe68e('0xa'))_0x222c69[_0x5e0475](util[_0xe68e('0x1e')](_0xe68e('0x48'),_0x8bcdf4[_0x197983][_0x4525a5][_0xe68e('0xb')],_0x8bcdf4[_0x197983][_0x4525a5]['name']));break;case 0xa:_0x222c69[_0x5e0475](util[_0xe68e('0x1e')](_0xe68e('0x21'),_0x8bcdf4[_0x197983][_0x4525a5][_0xe68e('0x5')]));break;}}}}})[_0xe68e('0xe')](function(){if(_0x5e0475===_0xe68e('0x49')){var _0x496c74=_['map'](_0x4c6f55[_0xe68e('0x26')],'id');return _0x4c6f55['removeChatInteractions'](_0x496c74)[_0xe68e('0xe')](function(){for(var _0x306622=0x0;_0x306622<_0x496c74[_0xe68e('0x20')];_0x306622+=0x1){_0x1efccc[_0xe68e('0x4a')](_0xe68e('0x4b'),{'ChatInteractionId':Number(_0x496c74[_0x306622]),'UserId':Number(_0x4c6f55['id'])});}});}})[_0xe68e('0xe')](function(){if(_0x5e0475==='leave'){var _0x2d0944=_[_0xe68e('0x1b')](_0x4c6f55[_0xe68e('0x28')],'id');return _0x4c6f55[_0xe68e('0x4c')](_0x2d0944)['then'](function(){for(var _0x3caa74=0x0;_0x3caa74<_0x2d0944[_0xe68e('0x20')];_0x3caa74+=0x1){_0x1efccc[_0xe68e('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2d0944[_0x3caa74]),'UserId':Number(_0x4c6f55['id'])});}});}})['then'](function(){if(_0x5e0475==='leave'){var _0x1a30e0=_[_0xe68e('0x1b')](_0x4c6f55[_0xe68e('0x29')],'id');return _0x4c6f55[_0xe68e('0x4d')](_0x1a30e0)[_0xe68e('0xe')](function(){for(var _0x309b22=0x0;_0x309b22<_0x1a30e0[_0xe68e('0x20')];_0x309b22+=0x1){_0x1efccc[_0xe68e('0x4a')](_0xe68e('0x4e'),{'FaxInteractionId':Number(_0x1a30e0[_0x309b22]),'UserId':Number(_0x4c6f55['id'])});}});}})[_0xe68e('0xe')](function(){if(_0x5e0475===_0xe68e('0x49')){var _0x1cecb9=_['map'](_0x4c6f55[_0xe68e('0x2b')],'id');return _0x4c6f55[_0xe68e('0x4f')](_0x1cecb9)[_0xe68e('0xe')](function(){for(var _0x52f76d=0x0;_0x52f76d<_0x1cecb9[_0xe68e('0x20')];_0x52f76d+=0x1){_0x1efccc[_0xe68e('0x4a')](_0xe68e('0x50'),{'SmsInteractionId':Number(_0x1cecb9[_0x52f76d]),'UserId':Number(_0x4c6f55['id'])});}});}})[_0xe68e('0xe')](function(){if(_0x5e0475==='leave'){var _0x10550a=_[_0xe68e('0x1b')](_0x4c6f55[_0xe68e('0x51')],'id');return _0x4c6f55[_0xe68e('0x52')](_0x10550a)['then'](function(){for(var _0x5533db=0x0;_0x5533db<_0x10550a[_0xe68e('0x20')];_0x5533db+=0x1){_0x1efccc[_0xe68e('0x4a')](_0xe68e('0x53'),{'OpenchannelInteractionId':Number(_0x10550a[_0x5533db]),'UserId':Number(_0x4c6f55['id'])});}});}})['then'](function(){if(_0x5e0475===_0xe68e('0x49')){var _0x89ab9f=_[_0xe68e('0x1b')](_0x4c6f55[_0xe68e('0x54')],'id');return _0x4c6f55[_0xe68e('0x55')](_0x89ab9f)[_0xe68e('0xe')](function(){for(var _0x45f41f=0x0;_0x45f41f<_0x89ab9f[_0xe68e('0x20')];_0x45f41f+=0x1){_0x1efccc[_0xe68e('0x4a')](_0xe68e('0x56'),{'WhatsappInteractionId':Number(_0x89ab9f[_0x45f41f]),'UserId':Number(_0x4c6f55['id'])});}});}})['catch'](function(_0x5e9a03){_0x222c69[_0xe68e('0x57')](_0x5e9a03);});}}function onDisconnect(_0x392cef,_0x530b6c){joinOrLeave(_0x392cef,'leave',_0x530b6c);}function onConnect(_0x154488){joinOrLeave(_0x154488,'join');}exports[_0xe68e('0x58')]=function(_0x15b71f){_0x15b71f['on']('connection',function(_0x22ade2){_0x22ade2[_0xe68e('0x59')](0x0);_0x22ade2[_0xe68e('0x5a')]=_0x22ade2[_0xe68e('0x5b')][_0xe68e('0x5c')][_0xe68e('0x5d')]+':'+_0x22ade2[_0xe68e('0x5b')]['connection']['remotePort'];_0x22ade2[_0xe68e('0x5e')]=new Date();_0x22ade2['log']=function(_0x46a1fc){console[_0xe68e('0x57')](_0xe68e('0x5f')+_0x22ade2['nsp']['name']+'['+_0x22ade2[_0xe68e('0x5a')]+']',_0x46a1fc);};_0x22ade2['on'](_0xe68e('0x60'),function(){onDisconnect(_0x22ade2,_0x15b71f);_0x22ade2[_0xe68e('0x57')]('DISCONNECTED');});onConnect(_0x22ade2);_0x22ade2[_0xe68e('0x57')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 86b6dc9..6d1c2b2 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 _0xdc26=['MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','SELECT','contact','UserId','interface','format','name','agent','incomingmessage','AfterCreateMessage','event','offlineMessage','opened','SIP/%s','AfterCreate','changed','closed','substatus','QueryTypes','AfterUpdate','User','find','fullname','email','internal','default','length','model','hook','callback','toLowerCase','util','jayson/promise','client','http','ChatInteraction','afterCreate','Chat','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail'];(function(_0x536295,_0x436f44){var _0x58879d=function(_0x28cd1b){while(--_0x28cd1b){_0x536295['push'](_0x536295['shift']());}};_0x58879d(++_0x436f44);}(_0xdc26,0x16a));var _0x6dc2=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0xdc26[_0x47cfa0];return _0x386b1d;};'use strict';var util=require(_0x6dc2('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6dc2('0x1'));var logger=require('../logger')('triggers');var client=jayson[_0x6dc2('0x2')][_0x6dc2('0x3')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x6dc2('0x4'),'event':_0x6dc2('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6dc2('0x6'),'model':_0x6dc2('0x4'),'event':'afterUpdate','condition':_0x6dc2('0x7'),'callback':afterUpdate},{'channel':_0x6dc2('0x6'),'model':_0x6dc2('0x8'),'event':'afterCreate','condition':_0x6dc2('0x9'),'callback':afterCreateMessage},{'channel':_0x6dc2('0x6'),'model':_0x6dc2('0xa'),'event':_0x6dc2('0x5'),'condition':_0x6dc2('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0x6dc2('0xb'),'model':_0x6dc2('0xc'),'event':_0x6dc2('0x5'),'condition':_0x6dc2('0xd'),'callback':afterCreate},{'channel':'Sms','model':_0x6dc2('0xc'),'event':_0x6dc2('0xe'),'condition':_0x6dc2('0x7'),'callback':afterUpdate},{'channel':'Sms','model':_0x6dc2('0xf'),'event':_0x6dc2('0x5'),'condition':_0x6dc2('0x9'),'callback':afterCreateMessage},{'channel':_0x6dc2('0x10'),'model':_0x6dc2('0x11'),'event':_0x6dc2('0x5'),'condition':_0x6dc2('0xd'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x6dc2('0x11'),'event':_0x6dc2('0xe'),'condition':_0x6dc2('0x7'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x6dc2('0x12'),'event':_0x6dc2('0x5'),'condition':_0x6dc2('0x9'),'callback':afterCreateMessage},{'channel':_0x6dc2('0x13'),'model':_0x6dc2('0x14'),'event':_0x6dc2('0x5'),'condition':_0x6dc2('0xd'),'callback':afterCreate},{'channel':_0x6dc2('0x13'),'model':_0x6dc2('0x14'),'event':'afterUpdate','condition':_0x6dc2('0x7'),'callback':afterUpdate},{'channel':_0x6dc2('0x13'),'model':_0x6dc2('0x15'),'event':_0x6dc2('0x5'),'condition':_0x6dc2('0x9'),'callback':afterCreateMessage},{'channel':_0x6dc2('0x16'),'model':_0x6dc2('0x17'),'event':_0x6dc2('0x5'),'condition':_0x6dc2('0xd'),'callback':afterCreate},{'channel':_0x6dc2('0x16'),'model':'MailInteraction','event':_0x6dc2('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6dc2('0x16'),'model':_0x6dc2('0x18'),'event':_0x6dc2('0x5'),'condition':_0x6dc2('0x9'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x6dc2('0x19'),'event':_0x6dc2('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6dc2('0x1a'),'model':_0x6dc2('0x19'),'event':_0x6dc2('0xe'),'condition':_0x6dc2('0x7'),'callback':afterUpdate},{'channel':_0x6dc2('0x1a'),'model':_0x6dc2('0x1b'),'event':_0x6dc2('0x5'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x3b49b4){return client[_0x6dc2('0x1c')](_0x6dc2('0x1d'),_0x3b49b4)[_0x6dc2('0x1e')](function(_0x225384){logger[_0x6dc2('0x1f')](_0x6dc2('0x20'),_0x6dc2('0x1d'),_0x225384);if(_0x225384[_0x6dc2('0x21')]){if(_0x225384[_0x6dc2('0x21')][_0x6dc2('0x22')]===0x1f4){logger[_0x6dc2('0x21')](_0x6dc2('0x20'),'EventManager',_0x225384['error']);}}})[_0x6dc2('0x23')](function(_0x50ce48){logger[_0x6dc2('0x21')](_0x6dc2('0x20'),_0x6dc2('0x1d'),_0x50ce48);});}function afterCreateMessage(_0x4175f4){return function(_0x15ef84){_0x15ef84=_0x15ef84[_0x6dc2('0x24')]({'plain':!![]});_0x15ef84[_0x6dc2('0x25')]=_0x4175f4;_0x15ef84[_0x6dc2('0x26')]=_0x4175f4;_0x15ef84['event']=_0x15ef84[_0x6dc2('0x27')];Promise[_0x6dc2('0x28')]()[_0x6dc2('0x1e')](function(){if(typeof _0x15ef84[_0x6dc2('0x29')]===_0x6dc2('0x2a'))return null;var _0x128e27=_0x6dc2('0x2b')+_0x15ef84[_0x6dc2('0x29')];return db[_0x6dc2('0x2c')][_0x6dc2('0x2d')](_0x128e27,{'type':db[_0x6dc2('0x2e')]['QueryTypes'][_0x6dc2('0x2f')],'raw':!![]});})[_0x6dc2('0x1e')](function(_0x2e7526){if(_0x2e7526){_0x15ef84[_0x6dc2('0x30')]=_0x2e7526[0x0];}if(typeof _0x15ef84[_0x6dc2('0x31')]===_0x6dc2('0x2a'))return;return getAgent(_0x15ef84[_0x6dc2('0x31')]);})['then'](function(_0x569469){if(_0x569469){_0x15ef84[_0x6dc2('0x32')]=util[_0x6dc2('0x33')]('SIP/%s',_0x569469[_0x6dc2('0x34')]);_0x15ef84[_0x6dc2('0x35')]=_0x569469;_0x15ef84[_0x6dc2('0x25')]=_0x4175f4;return request({'event':_0x6dc2('0x36'),'message':_0x15ef84});}else{return request({'event':'outgoingmessage','message':_0x15ef84});}})[_0x6dc2('0x23')](function(_0x3d699a){logger[_0x6dc2('0x21')](_0x6dc2('0x20'),_0x6dc2('0x37'),_0x3d699a);});};}function afterCreateOfflineMessage(_0x5a8beb){return function(_0x7cac88){_0x7cac88=_0x7cac88[_0x6dc2('0x24')]({'plain':!![]});_0x7cac88['channel']=_0x5a8beb;_0x7cac88[_0x6dc2('0x26')]=_0x5a8beb;_0x7cac88[_0x6dc2('0x38')]=_0x6dc2('0x39');return request({'event':_0x7cac88[_0x6dc2('0x38')],'message':_0x7cac88});};}function afterCreate(_0x6a00af,_0x1e24ce){return function(_0x17d71e){_0x17d71e=_0x17d71e[_0x6dc2('0x24')]({'plain':!![]});_0x17d71e[_0x6dc2('0x25')]=_0x6a00af;_0x17d71e[_0x6dc2('0x26')]=_0x6a00af;_0x17d71e[_0x6dc2('0x38')]=_0x6dc2('0x3a');Promise[_0x6dc2('0x28')]()[_0x6dc2('0x1e')](function(){var _0x37448a=_0x6dc2('0x2b')+_0x17d71e['ContactId'];return db[_0x6dc2('0x2c')][_0x6dc2('0x2d')](_0x37448a,{'type':db[_0x6dc2('0x2e')]['QueryTypes'][_0x6dc2('0x2f')],'raw':!![]});})[_0x6dc2('0x1e')](function(_0x5727ca){if(_0x5727ca){_0x17d71e['contact']=_0x5727ca[0x0];}if(typeof _0x17d71e[_0x6dc2('0x31')]===_0x6dc2('0x2a'))return;return getAgent(_0x17d71e[_0x6dc2('0x31')]);})[_0x6dc2('0x1e')](function(_0x2cfa51){if(_0x2cfa51){_0x17d71e['interface']=util[_0x6dc2('0x33')](_0x6dc2('0x3b'),_0x2cfa51[_0x6dc2('0x34')]);_0x17d71e[_0x6dc2('0x35')]=_0x2cfa51;}return request({'event':_0x1e24ce,'message':_0x17d71e});})[_0x6dc2('0x23')](function(_0x3bb67a){logger[_0x6dc2('0x21')]('Trigger,\x20%s',_0x6dc2('0x3c'),_0x3bb67a);});};}function afterUpdate(_0x5e7fbe){return function(_0xff1a5d){var _0x5d28a5=_0xff1a5d[_0x6dc2('0x3d')](_0x6dc2('0x3e'))&&_0xff1a5d[_0x6dc2('0x3e')];var _0x50d530=_0xff1a5d[_0x6dc2('0x3d')](_0x6dc2('0x3f'));if(_0x5d28a5||_0x50d530){var _0x46435e=_0x5d28a5?_0x6dc2('0x7'):_0x6dc2('0x3f');var _0x2dce88=_0xff1a5d[_0x6dc2('0x24')]({'plain':!![]});_0x2dce88['channel']=_0x5e7fbe;_0x2dce88[_0x6dc2('0x26')]=_0x5e7fbe;_0x2dce88['event']=_0x5d28a5?_0x6dc2('0x3e'):'substatus';var _0x3115ce=_0x6dc2('0x2b')+_0x2dce88[_0x6dc2('0x29')];return db[_0x6dc2('0x2c')]['query'](_0x3115ce,{'type':db[_0x6dc2('0x2e')][_0x6dc2('0x40')]['SELECT'],'raw':!![]})[_0x6dc2('0x1e')](function(_0x63d7b2){if(_0x63d7b2){_0x2dce88['contact']=_0x63d7b2[0x0];}if(typeof _0x2dce88[_0x6dc2('0x31')]==='undefined')return;return getAgent(_0x2dce88['UserId']);})['then'](function(_0x3cf8c7){if(_0x3cf8c7){_0x2dce88[_0x6dc2('0x32')]=util['format'](_0x6dc2('0x3b'),_0x3cf8c7['name']);_0x2dce88[_0x6dc2('0x35')]=_0x3cf8c7;}return request({'event':_0x46435e,'message':_0x2dce88});})[_0x6dc2('0x23')](function(_0x5eb1d8){logger['error'](_0x6dc2('0x20'),_0x6dc2('0x41'),_0x5eb1d8);});}};}function getAgent(_0x4ddaec){return db[_0x6dc2('0x42')][_0x6dc2('0x43')]({'where':{'id':_0x4ddaec},'attributes':['id',_0x6dc2('0x34'),_0x6dc2('0x44'),_0x6dc2('0x45'),_0x6dc2('0x46')],'raw':!![]})[_0x6dc2('0x1e')](function(_0x7e3a8e){return _0x7e3a8e;});}exports[_0x6dc2('0x47')]=function(){for(var _0x3891c8=0x0;_0x3891c8=_0x34fe1c['agents']){throw Error(_0x4eb5('0x10'));}_0x31d5d8(_0x14ee62);})['catch'](function(_0x2535d9){_0x35a29b(_0x2535d9);});});}; \ No newline at end of file +var _0x0318=['isUndefined','updateAttributes','role','User','count','getLicense','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','./license/util','voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser'];(function(_0x375441,_0x92e3fa){var _0x1676c8=function(_0x1c77c6){while(--_0x1c77c6){_0x375441['push'](_0x375441['shift']());}};_0x1676c8(++_0x92e3fa);}(_0x0318,0x14c));var _0x8031=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0318[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var BPromise=require(_0x8031('0x0'));var db=require('../mysqldb')['db'];var util=require(_0x8031('0x1'));var channels=[_0x8031('0x2'),_0x8031('0x3'),_0x8031('0x4'),_0x8031('0x5'),_0x8031('0x6'),'whatsapp',_0x8031('0x7')];exports[_0x8031('0x8')]=function(){return channels;};exports[_0x8031('0x9')]=function(_0x2c8b9c){_0x2c8b9c=_0x2c8b9c[_0x8031('0xa')]();return _[_0x8031('0xb')](channels,_0x2c8b9c);};exports[_0x8031('0xc')]=function(_0x165951,_0x274a35,_0x4320ae,_0x4e166d){var _0x5b36dd={'loginAttempts':_0x274a35,'blocked':_0x4320ae};if(!_[_0x8031('0xd')](_0x4e166d)){_0x5b36dd['blockedAt']=_0x4e166d;}return _0x165951[_0x8031('0xe')](_0x5b36dd);};exports['getLicense']=function(_0x1a7839){return new BPromise(function(_0x139e52,_0x4a9601){var _0x29460f=0x0;if(_0x1a7839[_0x8031('0xf')]!=='agent'){_0x139e52(_0x1a7839);}db[_0x8031('0x10')][_0x8031('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1a7839['id']}}})['then'](function(_0x4d474c){_0x29460f=_0x4d474c;return util[_0x8031('0x12')]();})[_0x8031('0x13')](function(_0x1eb77a){if(_0x1eb77a&&_0x1eb77a[_0x8031('0x14')]&&_0x29460f>=_0x1eb77a[_0x8031('0x14')]){throw Error(_0x8031('0x15'));}_0x139e52(_0x1a7839);})[_0x8031('0x16')](function(_0x3fb656){_0x4a9601(_0x3fb656);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index c00d2e9..bb0f568 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbec5=['error','stack','status','send','exports','util','../config/logger','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval'];(function(_0x478d7b,_0x4eaa36){var _0xeed206=function(_0x304287){while(--_0x304287){_0x478d7b['push'](_0x478d7b['shift']());}};_0xeed206(++_0x4eaa36);}(_0xbec5,0xe5));var _0x5bec=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0xbec5[_0x2b91c5];return _0xbd5531;};'use strict';var util=require(_0x5bec('0x0'));var logger=require(_0x5bec('0x1'))('api');var APIError=function(_0x1d4842,_0x38c81a){this[_0x5bec('0x2')]=_0x1d4842||_0x5bec('0x3');this[_0x5bec('0x4')]=_0x38c81a||'Error';util[_0x5bec('0x5')](APIError,Error);};var APIBadRequestError=function(_0x376cdb){this[_0x5bec('0x2')]=_0x376cdb||'Bad\x20Request';this[_0x5bec('0x4')]=_0x5bec('0x6');util[_0x5bec('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x406e65){this[_0x5bec('0x2')]=_0x406e65||_0x5bec('0x7');this[_0x5bec('0x4')]=_0x5bec('0x8');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x41a827){switch(_0x41a827){case'Bad\x20Request':return 0x190;case _0x5bec('0x9'),_0x5bec('0xa'):return 0x193;case _0x5bec('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a5482){return function(_0x288d1b){logger[_0x5bec('0xb')](_0x288d1b[_0x5bec('0xc')]);var _0x57ffc4=getStatusCode(_0x288d1b[_0x5bec('0x4')]);if(_0x288d1b[_0x5bec('0x4')])delete _0x288d1b['name'];return _0x4a5482[_0x5bec('0xd')](_0x57ffc4)[_0x5bec('0xe')](_0x288d1b);};}module[_0x5bec('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xda3f=['inherits','message','Bad\x20Request','Entity\x20not\x20found','name','Not\x20Found','Forbidden','OutOfInterval','error','stack','send','exports','../config/logger','api','Internal\x20Server\x20Error','Error'];(function(_0x357248,_0x5c18ec){var _0x4ef6e3=function(_0x294005){while(--_0x294005){_0x357248['push'](_0x357248['shift']());}};_0x4ef6e3(++_0x5c18ec);}(_0xda3f,0xec));var _0xfda3=function(_0x567dcc,_0x2eca03){_0x567dcc=_0x567dcc-0x0;var _0x2888cb=_0xda3f[_0x567dcc];return _0x2888cb;};'use strict';var util=require('util');var logger=require(_0xfda3('0x0'))(_0xfda3('0x1'));var APIError=function(_0x534697,_0x5299b0){this['message']=_0x534697||_0xfda3('0x2');this['name']=_0x5299b0||_0xfda3('0x3');util[_0xfda3('0x4')](APIError,Error);};var APIBadRequestError=function(_0x516500){this[_0xfda3('0x5')]=_0x516500||_0xfda3('0x6');this['name']='Bad\x20Request';util[_0xfda3('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x42476a){this[_0xfda3('0x5')]=_0x42476a||_0xfda3('0x7');this[_0xfda3('0x8')]=_0xfda3('0x9');util[_0xfda3('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x1b1ea6){switch(_0x1b1ea6){case _0xfda3('0x6'):return 0x190;case _0xfda3('0xa'),_0xfda3('0xb'):return 0x193;case _0xfda3('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x4d7841){return function(_0xe933f5){logger[_0xfda3('0xc')](_0xe933f5[_0xfda3('0xd')]);var _0x11afc1=getStatusCode(_0xe933f5[_0xfda3('0x8')]);if(_0xe933f5['name'])delete _0xe933f5[_0xfda3('0x8')];return _0x4d7841['status'](_0x11afc1)[_0xfda3('0xe')](_0xe933f5);};}module[_0xfda3('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 0e4bd37..30fa99d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4dd=['exports','404','status','render','json','send'];(function(_0x2360be,_0x91c64a){var _0x55cbee=function(_0x3cf856){while(--_0x3cf856){_0x2360be['push'](_0x2360be['shift']());}};_0x55cbee(++_0x91c64a);}(_0xc4dd,0x1bc));var _0xdc4d=function(_0x307590,_0x165010){_0x307590=_0x307590-0x0;var _0x2615b1=_0xc4dd[_0x307590];return _0x2615b1;};'use strict';module[_0xdc4d('0x0')][0x194]=function pageNotFound(_0x3e9c06,_0x1e35c4){var _0x11df43=_0xdc4d('0x1');var _0x24a80f=0x194;var _0x3e4a91={'status':_0x24a80f};_0x1e35c4['status'](_0x3e4a91[_0xdc4d('0x2')]);_0x1e35c4[_0xdc4d('0x3')](_0x11df43,{},function(_0x3e6dd8,_0x67b7f0){if(_0x3e6dd8){return _0x1e35c4['status'](_0x3e4a91[_0xdc4d('0x2')])[_0xdc4d('0x4')](_0x3e4a91);}_0x1e35c4[_0xdc4d('0x5')](_0x67b7f0);});}; \ No newline at end of file +var _0x18d9=['exports','404','status','render','send'];(function(_0x12c404,_0x3a510e){var _0x16ca7f=function(_0x56abfe){while(--_0x56abfe){_0x12c404['push'](_0x12c404['shift']());}};_0x16ca7f(++_0x3a510e);}(_0x18d9,0x1b8));var _0x918d=function(_0x315034,_0x19eee3){_0x315034=_0x315034-0x0;var _0x24f9bf=_0x18d9[_0x315034];return _0x24f9bf;};'use strict';module[_0x918d('0x0')][0x194]=function pageNotFound(_0x5e5de7,_0x22ecd4){var _0x262726=_0x918d('0x1');var _0x2ab607=0x194;var _0x3f6ae8={'status':_0x2ab607};_0x22ecd4[_0x918d('0x2')](_0x3f6ae8[_0x918d('0x2')]);_0x22ecd4[_0x918d('0x3')](_0x262726,{},function(_0x79c7c,_0x33a4e1){if(_0x79c7c){return _0x22ecd4['status'](_0x3f6ae8[_0x918d('0x2')])['json'](_0x3f6ae8);}_0x22ecd4[_0x918d('0x4')](_0x33a4e1);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 948eba0..f8a6a99 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e08=['../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../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','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmHopperAdditionalPhone','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','SquareProject','SquareRecording','SquareMessage','Team','License','Campaign','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','cascade','UserId','hasOne','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','UserProfile','belongsToMany','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','ScreenRecording','Messages','mailboxuser','mailbox','VoiceQueueReport','uniqueid','AgentReports','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Dispositions','CannedAnswer','Answers','Interactions','MailApplication','ListId','Template','Teams','MailInteractionId','Account','Contact','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','Dashboard','Items','FaxAccountId','Exntensions','List','mandatoryDispositionPause','TagId','FaxInteractionId','ContactId','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','Agent','ChatQueue','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CompanyId','CmContactHasItem','Phones','CmContactId','JscriptySessions','Company','cm_contact_has_tags','OwnerId','CampaignId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','ItemTypeId','Hopper','CmHopperId','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceConfiguration','Subjects','SubjectId','DescriptionId','Subject','Description','Field','FieldId','SugarcrmField','Descriptions','int_desk_configuration_has_tags','VariableId','ZohoField','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowAccount','FromId','ToId','JscriptyAnswerReport','ProjectId','user_has_teams','team_has_mail_queues','MailQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','VoicePrefix','userProfileId','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','ToQueueId','Smtp','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','name','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model'];(function(_0x1a593d,_0x2ed6c4){var _0x1f4858=function(_0x1a5701){while(--_0x1a5701){_0x1a593d['push'](_0x1a593d['shift']());}};_0x1f4858(++_0x2ed6c4);}(_0x7e08,0x1bc));var _0x87e0=function(_0xc9361f,_0x367857){_0xc9361f=_0xc9361f-0x0;var _0x5d1c01=_0x7e08[_0xc9361f];return _0x5d1c01;};'use strict';var config=require(_0x87e0('0x0'));var Sequelize=require(_0x87e0('0x1'));var _=require(_0x87e0('0x2'));var jstz=require(_0x87e0('0x3'));var timezone=jstz[_0x87e0('0x4')]();config[_0x87e0('0x1')]=_[_0x87e0('0x5')](config[_0x87e0('0x1')],{'database':_0x87e0('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x87e0('0x7'),'port':0xcea,'dialect':_0x87e0('0x8'),'dialectOptions':{'charset':_0x87e0('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x87e0('0xa'),'collate':_0x87e0('0xb')}}});config['sequelizeHistory']=_[_0x87e0('0x5')](config[_0x87e0('0xc')],{'database':_0x87e0('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x87e0('0x8'),'dialectOptions':{'charset':_0x87e0('0x9')},'logging':![],'timezone':timezone[_0x87e0('0xd')](),'define':{'charset':_0x87e0('0xa'),'collate':_0x87e0('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x87e0('0xe')],config[_0x87e0('0x1')][_0x87e0('0xf')],config[_0x87e0('0x1')][_0x87e0('0x10')],config[_0x87e0('0x1')][_0x87e0('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x87e0('0xc')]['database'],config[_0x87e0('0xc')][_0x87e0('0xf')],config[_0x87e0('0xc')][_0x87e0('0x10')],config['sequelizeHistory'][_0x87e0('0x11')])};db[_0x87e0('0x12')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x14'));db[_0x87e0('0x15')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x16'));db['VoiceContext']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x17'));db[_0x87e0('0x18')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x19'));db[_0x87e0('0x1a')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x1b'));db[_0x87e0('0x1c')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x1d'));db[_0x87e0('0x1e')]=db['sequelize'][_0x87e0('0x13')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x1f'));db[_0x87e0('0x20')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x21'));db[_0x87e0('0x22')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x23'));db[_0x87e0('0x24')]=db['sequelize']['import'](_0x87e0('0x25'));db[_0x87e0('0x26')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x27'));db[_0x87e0('0x28')]=db['sequelize']['import'](_0x87e0('0x29'));db['VoiceQueueReport']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x2a'));db[_0x87e0('0x2b')]=db[_0x87e0('0x1')]['import']('../api/memberReport/memberReport.model');db[_0x87e0('0x2c')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x2d'));db['VoiceTransferReport']=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x87e0('0x2e')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x2f'));db[_0x87e0('0x30')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x31'));db['UserChatQueue']=db[_0x87e0('0x1')]['import'](_0x87e0('0x32'));db['UserMailQueue']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x33'));db[_0x87e0('0x34')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x35'));db[_0x87e0('0x36')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x37'));db['UserOpenchannelQueue']=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x38'));db[_0x87e0('0x39')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x3a'));db[_0x87e0('0x3b')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x3c'));db[_0x87e0('0x3d')]=db[_0x87e0('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x87e0('0x3e')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/mailAccount/mailAccount.model');db[_0x87e0('0x3f')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x40'));db['MailSubstatus']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x41'));db[_0x87e0('0x42')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x43'));db[_0x87e0('0x44')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x45'));db['MailApplication']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x46'));db[_0x87e0('0x47')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x48'));db[_0x87e0('0x49')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x4a'));db[_0x87e0('0x4b')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x4c'));db[_0x87e0('0x4d')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x4e'));db[_0x87e0('0x4f')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x50'));db[_0x87e0('0x51')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x52'));db[_0x87e0('0x53')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x54'));db[_0x87e0('0x55')]=db[_0x87e0('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x87e0('0x56')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x57'));db[_0x87e0('0x58')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x59'));db[_0x87e0('0x5a')]=db['sequelize']['import'](_0x87e0('0x5b'));db['SmsMessage']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x5c'));db[_0x87e0('0x5d')]=db['sequelize'][_0x87e0('0x13')]('../api/smsQueue/smsQueue.model');db[_0x87e0('0x5e')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x87e0('0x5f')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0x87e0('0x60')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x61'));db[_0x87e0('0x62')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x63'));db['OpenchannelQueue']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x64'));db['ChatWebsite']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x65'));db[_0x87e0('0x66')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x67'));db[_0x87e0('0x68')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x69'));db[_0x87e0('0x6a')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x87e0('0x6b')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/chatMessage/chatMessage.model');db[_0x87e0('0x6c')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x6d'));db['ChatQueue']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x6e'));db[_0x87e0('0x6f')]=db['sequelize']['import']('../api/chatGroup/chatGroup.model');db[_0x87e0('0x70')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x71'));db[_0x87e0('0x72')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x73'));db['CmContact']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x74'));db[_0x87e0('0x75')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/cmHopper/cmHopper.model');db[_0x87e0('0x76')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x87e0('0x77')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x78'));db[_0x87e0('0x79')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x7a'));db['ReportAgentPreview']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x7b'));db[_0x87e0('0x7c')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x7d'));db[_0x87e0('0x7e')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x7f'));db[_0x87e0('0x80')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x81'));db['CannedAnswer']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x82'));db[_0x87e0('0x83')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x84'));db[_0x87e0('0x85')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x86'));db['Interval']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x87'));db[_0x87e0('0x88')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x89'));db[_0x87e0('0x8a')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x8b'));db[_0x87e0('0x8c')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x8d'));db[_0x87e0('0x8e')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x8f'));db[_0x87e0('0x90')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x91'));db[_0x87e0('0x92')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x93'));db[_0x87e0('0x94')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x95'));db['CmContactHasItem']=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x87e0('0x96')]=db['sequelize'][_0x87e0('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x87e0('0x1')]['import'](_0x87e0('0x97'));db[_0x87e0('0x98')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/trigger/trigger.model');db[_0x87e0('0x99')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x9a'));db[_0x87e0('0x9b')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x9c'));db[_0x87e0('0x9d')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x9e'));db[_0x87e0('0x9f')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xa0'));db['AnalyticDefaultReport']=db[_0x87e0('0x1')]['import'](_0x87e0('0xa1'));db[_0x87e0('0xa2')]=db['sequelize']['import'](_0x87e0('0xa3'));db[_0x87e0('0xa4')]=db[_0x87e0('0x1')]['import'](_0x87e0('0xa5'));db[_0x87e0('0xa6')]=db[_0x87e0('0x1')]['import'](_0x87e0('0xa7'));db['AnalyticTreeReport']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xa8'));db[_0x87e0('0xa9')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xaa'));db['SalesforceConfiguration']=db[_0x87e0('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x87e0('0xab')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xac'));db[_0x87e0('0xad')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xae'));db[_0x87e0('0xaf')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xb0'));db['SugarcrmField']=db[_0x87e0('0x1')]['import'](_0x87e0('0xb1'));db[_0x87e0('0xb2')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x87e0('0xb3')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xb4'));db[_0x87e0('0xb5')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/intDeskField/intDeskField.model');db[_0x87e0('0xb6')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x87e0('0xb7')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xb8'));db[_0x87e0('0xb9')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xba'));db['ZendeskConfiguration']=db['sequelize']['import'](_0x87e0('0xbb'));db[_0x87e0('0xbc')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xbd'));db[_0x87e0('0xbe')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xbf'));db[_0x87e0('0xc0')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xc1'));db[_0x87e0('0xc2')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xc3'));db['VtigerConfiguration']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xc4'));db['VtigerField']=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db['sequelize'][_0x87e0('0x13')](_0x87e0('0xc5'));db[_0x87e0('0xc6')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xc7'));db[_0x87e0('0xc8')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xc9'));db[_0x87e0('0xca')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xcb'));db[_0x87e0('0xcc')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xcd'));db[_0x87e0('0xce')]=db[_0x87e0('0x1')]['import'](_0x87e0('0xcf'));db[_0x87e0('0xd0')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x87e0('0xd1')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xd2'));db[_0x87e0('0xd3')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0xd4'));db[_0x87e0('0x9b')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x9c'));db[_0x87e0('0xd5')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/network/network.model');db[_0x87e0('0xd6')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xd7'));db[_0x87e0('0xd8')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db['sequelize'][_0x87e0('0x13')](_0x87e0('0xd9'));db[_0x87e0('0xda')]=db[_0x87e0('0x1')]['import'](_0x87e0('0xdb'));db[_0x87e0('0xdc')]=db[_0x87e0('0x1')]['import'](_0x87e0('0xdd'));db[_0x87e0('0xde')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xdf'));db[_0x87e0('0xe0')]=db[_0x87e0('0x1')]['import'](_0x87e0('0xe1'));db[_0x87e0('0xe2')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/setting/setting.model');db[_0x87e0('0xe3')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x87e0('0xe4')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/squareProject/squareProject.model');db[_0x87e0('0xe5')]=db[_0x87e0('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x87e0('0xe6')]=db[_0x87e0('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0x87e0('0xe7')]=db[_0x87e0('0x1')]['import']('../api/team/team.model');db[_0x87e0('0xe8')]=db[_0x87e0('0x1')]['import']('../api/license/license.model');db[_0x87e0('0xe9')]=db[_0x87e0('0x1')]['import']('../api/campaign/campaign.model');db[_0x87e0('0xea')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xeb'));db[_0x87e0('0xec')]=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/attachment/attachment.model');db['Plugin']=db['sequelize'][_0x87e0('0x13')](_0x87e0('0xed'));db[_0x87e0('0xee')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0xef'));db['ChatTransferReport']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xf0'));db[_0x87e0('0xf1')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0xf2'));db[_0x87e0('0xf3')]=db[_0x87e0('0x1')]['import'](_0x87e0('0xf4'));db['SmsTransferReport']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xf5'));db[_0x87e0('0xf6')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xf7'));db['VoicePrefix']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xf8'));db['UserProfile']=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0x87e0('0xf9')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xfa'));db[_0x87e0('0xfb')]=db[_0x87e0('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x87e0('0xfc')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0xfd'));db[_0x87e0('0xfe')]=db[_0x87e0('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x87e0('0xff')]=db['sequelize']['import']('../api/whatsappApplication/whatsappApplication.model');db[_0x87e0('0x100')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x101'));db[_0x87e0('0x102')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x103'));db[_0x87e0('0x104')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x105'));db[_0x87e0('0x106')]=db[_0x87e0('0x1')]['import'](_0x87e0('0x107'));db[_0x87e0('0x108')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x109'));db['CloudProvider']=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x10a'));db[_0x87e0('0x10b')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x10c'));db[_0x87e0('0x10d')]=db['sequelize'][_0x87e0('0x13')](_0x87e0('0x10e'));db['UserVoicePrefix']=db[_0x87e0('0x1')][_0x87e0('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x87e0('0x10f')]=db[_0x87e0('0x1')][_0x87e0('0x13')](_0x87e0('0x110'));db[_0x87e0('0x12')]['hasOne'](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x112')});db['User'][_0x87e0('0x113')](db[_0x87e0('0x10f')],{'as':_0x87e0('0x114'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x112')});db['User'][_0x87e0('0x115')](db[_0x87e0('0x1e')],{'as':_0x87e0('0x116'),'foreignKey':'UserId'});db[_0x87e0('0x12')][_0x87e0('0x115')](db[_0x87e0('0x2e')],{'as':_0x87e0('0x117'),'foreignKey':'UserId'});db[_0x87e0('0x12')]['hasMany'](db[_0x87e0('0x18')],{'as':_0x87e0('0x118'),'onDelete':_0x87e0('0x111'),'hooks':!![]});db[_0x87e0('0x12')][_0x87e0('0x115')](db[_0x87e0('0x77')],{'as':'HopperFinals','foreignKey':_0x87e0('0x112')});db[_0x87e0('0x12')][_0x87e0('0x115')](db[_0x87e0('0x79')],{'as':_0x87e0('0x119'),'foreignKey':'UserId'});db[_0x87e0('0x12')][_0x87e0('0x115')](db[_0x87e0('0x11a')],{'as':_0x87e0('0x11a'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x12')]['hasMany'](db[_0x87e0('0x60')],{'as':_0x87e0('0x11b'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x12')][_0x87e0('0x115')](db[_0x87e0('0x6a')],{'as':_0x87e0('0x11c'),'foreignKey':_0x87e0('0x112')});db['User'][_0x87e0('0x115')](db[_0x87e0('0x5a')],{'as':_0x87e0('0x11d'),'foreignKey':_0x87e0('0x112')});db['User'][_0x87e0('0x115')](db['FaxInteraction'],{'as':_0x87e0('0x11e'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x12')][_0x87e0('0x115')](db[_0x87e0('0x42')],{'as':_0x87e0('0x11f'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x12')][_0x87e0('0x115')](db[_0x87e0('0x100')],{'as':_0x87e0('0x120'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x12')][_0x87e0('0x115')](db[_0x87e0('0xfc')],{'as':'UserNotifications','foreignKey':_0x87e0('0x121')});db[_0x87e0('0x12')][_0x87e0('0x122')](db[_0x87e0('0x123')],{'as':_0x87e0('0x123'),'foreignKey':'userProfileId'});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0x6f')],{'as':'Groups','through':_0x87e0('0x125')});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0x126')],{'as':_0x87e0('0x127'),'through':_0x87e0('0x128')});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0xf6')],{'as':_0x87e0('0x129'),'through':_0x87e0('0x12a')});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0xe7')],{'through':'user_has_teams'});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0x42')],{'as':_0x87e0('0x11f'),'through':'user_has_mail_interactions'});db['User']['belongsToMany'](db[_0x87e0('0x6a')],{'as':_0x87e0('0x11c'),'through':_0x87e0('0x12b')});db[_0x87e0('0x12')]['belongsToMany'](db[_0x87e0('0x4f')],{'as':_0x87e0('0x11e'),'through':_0x87e0('0x12c')});db['User'][_0x87e0('0x124')](db[_0x87e0('0x5a')],{'as':_0x87e0('0x11d'),'through':_0x87e0('0x12d')});db[_0x87e0('0x12')][_0x87e0('0x124')](db['OpenchannelInteraction'],{'as':_0x87e0('0x11b'),'through':'user_has_openchannel_interactions'});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0x100')],{'as':_0x87e0('0x120'),'through':_0x87e0('0x12e')});db['User'][_0x87e0('0x124')](db[_0x87e0('0x1c')],{'as':_0x87e0('0x12f'),'through':_0x87e0('0x30'),'required':![]});db[_0x87e0('0x12')][_0x87e0('0x124')](db['VoicePrefix'],{'as':_0x87e0('0x130'),'through':_0x87e0('0x131'),'required':![]});db[_0x87e0('0x12')]['belongsToMany'](db[_0x87e0('0x3f')],{'as':'MailQueues','through':_0x87e0('0x132'),'required':![]});db[_0x87e0('0x12')]['belongsToMany'](db['ChatQueue'],{'as':_0x87e0('0x133'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0x87e0('0x53')],{'as':_0x87e0('0x134'),'through':_0x87e0('0x34'),'required':![]});db[_0x87e0('0x12')][_0x87e0('0x124')](db['SmsQueue'],{'as':_0x87e0('0x135'),'through':_0x87e0('0x36'),'required':![]});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0x136')],{'as':_0x87e0('0x137'),'through':_0x87e0('0x138'),'required':![]});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0x108')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0xf6')],{'through':_0x87e0('0x12a')});db[_0x87e0('0x12')][_0x87e0('0x124')](db['ChatWebsite'],{'as':_0x87e0('0x139'),'through':_0x87e0('0x13a')});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0x4b')],{'as':_0x87e0('0x13b'),'through':_0x87e0('0x13c')});db['User'][_0x87e0('0x124')](db[_0x87e0('0x3e')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0x5e')],{'as':_0x87e0('0x13d'),'through':_0x87e0('0x13e')});db['User'][_0x87e0('0x124')](db[_0x87e0('0x56')],{'as':_0x87e0('0x13f'),'through':_0x87e0('0x140')});db[_0x87e0('0x12')][_0x87e0('0x124')](db[_0x87e0('0xfe')],{'as':_0x87e0('0x141'),'through':'user_has_whatsapp_accounts'});db['VoiceChanSpy'][_0x87e0('0x115')](db['VoiceExtension'],{'as':_0x87e0('0x142'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x143')});db[_0x87e0('0x144')][_0x87e0('0x115')](db[_0x87e0('0x18')],{'onDelete':'cascade'});db[_0x87e0('0x18')][_0x87e0('0x115')](db[_0x87e0('0x18')],{'as':_0x87e0('0x145'),'onDelete':'cascade'});db[_0x87e0('0x1a')][_0x87e0('0x124')](db[_0x87e0('0x90')],{'as':_0x87e0('0x146'),'through':'moh_has_sounds'});db[_0x87e0('0x1c')][_0x87e0('0x115')](db[_0x87e0('0x2e')],{'as':_0x87e0('0x147'),'foreignKey':_0x87e0('0x148')});db[_0x87e0('0x1c')]['hasMany'](db['CmHopper'],{'as':_0x87e0('0x149'),'foreignKey':'VoiceQueueId'});db[_0x87e0('0x1c')][_0x87e0('0x115')](db[_0x87e0('0x77')],{'as':_0x87e0('0x14a'),'foreignKey':_0x87e0('0x148')});db[_0x87e0('0x1c')][_0x87e0('0x115')](db[_0x87e0('0x79')],{'as':_0x87e0('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x87e0('0x1c')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x87e0('0x1c')][_0x87e0('0x115')](db[_0x87e0('0x76')],{'as':_0x87e0('0x14c'),'foreignKey':'VoiceQueueId'});db[_0x87e0('0x1c')][_0x87e0('0x115')](db[_0x87e0('0xdc')],{'as':'JscriptySessions','foreignKey':_0x87e0('0x148')});db[_0x87e0('0x1c')][_0x87e0('0x122')](db['Trunk'],{'as':_0x87e0('0x2c'),'foreignKey':_0x87e0('0x14d')});db[_0x87e0('0x1c')][_0x87e0('0x122')](db[_0x87e0('0x2c')],{'as':_0x87e0('0x14e'),'foreignKey':_0x87e0('0x14f')});db[_0x87e0('0x1c')][_0x87e0('0x122')](db['Interval'],{'as':_0x87e0('0x150'),'foreignKey':_0x87e0('0x151')});db[_0x87e0('0x1c')]['belongsTo'](db[_0x87e0('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x87e0('0x152')});db[_0x87e0('0x1c')][_0x87e0('0x124')](db[_0x87e0('0xf6')],{'as':_0x87e0('0x129'),'through':_0x87e0('0x153')});db[_0x87e0('0x1c')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':_0x87e0('0x30')});db['VoiceQueue'][_0x87e0('0x124')](db['Team'],{'as':'Teams','through':_0x87e0('0x10b')});db[_0x87e0('0x1c')]['belongsToMany'](db[_0x87e0('0xf6')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':_0x87e0('0x12'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x155')][_0x87e0('0x122')](db['User'],{'as':_0x87e0('0x12'),'foreignKey':'UserId'});db[_0x87e0('0x20')]['hasMany'](db['VoiceMailMessage'],{'as':_0x87e0('0x156'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x157'),'sourceKey':_0x87e0('0x158')});db['VoiceMailMessage'][_0x87e0('0x122')](db[_0x87e0('0x20')],{'foreignKey':'mailboxuser','targetKey':_0x87e0('0x158')});db['VoiceCallReport'][_0x87e0('0x115')](db[_0x87e0('0x159')],{'as':'QueueCalls','foreignKey':_0x87e0('0x15a'),'constraints':![]});db[_0x87e0('0x24')][_0x87e0('0x115')](db['VoiceAgentReport'],{'as':_0x87e0('0x15b'),'foreignKey':_0x87e0('0x15a'),'constraints':![]});db[_0x87e0('0x24')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':'User','foreignKey':_0x87e0('0x112')});db[_0x87e0('0x24')][_0x87e0('0x122')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x87e0('0x3b')][_0x87e0('0x122')](db['MailAccount'],{'as':_0x87e0('0x3e'),'foreignKey':_0x87e0('0x15c')});db[_0x87e0('0x3b')][_0x87e0('0x122')](db['CloudProvider'],{'as':_0x87e0('0x15d'),'foreignKey':_0x87e0('0x15e'),'onDelete':'restrict'});db[_0x87e0('0x3d')]['belongsTo'](db['MailAccount'],{'as':_0x87e0('0x3e'),'foreignKey':_0x87e0('0x15c')});db[_0x87e0('0x3d')][_0x87e0('0x122')](db[_0x87e0('0x15d')],{'as':_0x87e0('0x15d'),'foreignKey':_0x87e0('0x15e'),'onDelete':_0x87e0('0x15f')});db['MailAccount'][_0x87e0('0x113')](db[_0x87e0('0x3b')],{'as':_0x87e0('0x160'),'onDelete':_0x87e0('0x111')});db['MailAccount'][_0x87e0('0x113')](db[_0x87e0('0x3d')],{'as':'Smtp','onDelete':_0x87e0('0x111')});db['MailAccount'][_0x87e0('0x115')](db[_0x87e0('0x83')],{'as':_0x87e0('0x161'),'foreignKey':_0x87e0('0x15c'),'onDelete':_0x87e0('0x111')});db[_0x87e0('0x3e')]['hasMany'](db[_0x87e0('0x162')],{'as':_0x87e0('0x163'),'foreignKey':_0x87e0('0x15c')});db[_0x87e0('0x3e')][_0x87e0('0x115')](db['MailMessage'],{'as':_0x87e0('0x156'),'foreignKey':_0x87e0('0x15c')});db[_0x87e0('0x3e')][_0x87e0('0x115')](db[_0x87e0('0x42')],{'as':_0x87e0('0x164')});db[_0x87e0('0x3e')][_0x87e0('0x115')](db[_0x87e0('0x165')],{'as':_0x87e0('0x145')});db[_0x87e0('0x3e')]['belongsTo'](db[_0x87e0('0xf6')],{'as':'List','foreignKey':_0x87e0('0x166')});db[_0x87e0('0x3e')][_0x87e0('0x122')](db[_0x87e0('0x167')],{'as':'Template','foreignKey':'TemplateId'});db['MailAccount'][_0x87e0('0x122')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':'user_has_mail_accounts'});db[_0x87e0('0x3f')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':'Agents','through':_0x87e0('0x132')});db['MailQueue'][_0x87e0('0x124')](db['Team'],{'through':'team_has_mail_queues','as':_0x87e0('0x168')});db[_0x87e0('0x42')]['hasMany'](db[_0x87e0('0x44')],{'as':_0x87e0('0x156'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x169')});db['MailInteraction'][_0x87e0('0x122')](db[_0x87e0('0x3e')],{'as':_0x87e0('0x16a'),'foreignKey':_0x87e0('0x15c')});db[_0x87e0('0x42')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':'ContactId'});db[_0x87e0('0x42')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':'Owner','foreignKey':_0x87e0('0x112')});db[_0x87e0('0x42')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':_0x87e0('0x16c'),'as':_0x87e0('0x16d')});db['MailInteraction'][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':'mail_interaction_has_tags','as':_0x87e0('0x16e')});db[_0x87e0('0x42')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x16f'),'through':_0x87e0('0x170'),'foreignKey':'MailInteractionId'});db[_0x87e0('0x44')]['hasMany'](db['Attachment'],{'as':_0x87e0('0x171'),'onDelete':_0x87e0('0x111')});db[_0x87e0('0x44')][_0x87e0('0x122')](db['User'],{'as':_0x87e0('0x12')});db['MailMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x87e0('0x16b')});db[_0x87e0('0x44')][_0x87e0('0x122')](db[_0x87e0('0x42')],{'as':'Interaction','foreignKey':_0x87e0('0x169')});db[_0x87e0('0x44')][_0x87e0('0x122')](db[_0x87e0('0x3e')],{'as':_0x87e0('0x16a'),'foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db[_0x87e0('0x172')],{'as':_0x87e0('0x172'),'foreignKey':_0x87e0('0x173')});db[_0x87e0('0x44')][_0x87e0('0x122')](db[_0x87e0('0x6c')],{'as':_0x87e0('0x6c'),'foreignKey':_0x87e0('0x174')});db[_0x87e0('0x165')][_0x87e0('0x122')](db['User'],{'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x165')][_0x87e0('0x122')](db[_0x87e0('0x3f')],{'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x165')][_0x87e0('0x122')](db[_0x87e0('0x3e')],{'onDelete':_0x87e0('0x15f')});db['MailApplication']['belongsTo'](db[_0x87e0('0x150')],{'onDelete':_0x87e0('0x15f'),'foreignKey':_0x87e0('0x151')});db[_0x87e0('0x165')][_0x87e0('0x122')](db[_0x87e0('0x92')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x87e0('0x47')]['belongsTo'](db['MailAccount'],{});db['MailQueueReport'][_0x87e0('0x122')](db[_0x87e0('0xf6')],{'as':'List','foreignKey':_0x87e0('0x166')});db[_0x87e0('0x47')]['belongsTo'](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':'ContactId'});db[_0x87e0('0x47')][_0x87e0('0x122')](db['MailInteraction'],{});db[_0x87e0('0x47')]['belongsTo'](db['MailMessage'],{});db[_0x87e0('0x47')]['belongsTo'](db[_0x87e0('0x12')],{});db['MailQueueReport'][_0x87e0('0x122')](db[_0x87e0('0x3f')],{});db[_0x87e0('0x175')][_0x87e0('0x115')](db['DashboardItem'],{'as':_0x87e0('0x176'),'onDelete':'cascade'});db[_0x87e0('0x4b')][_0x87e0('0x115')](db[_0x87e0('0x83')],{'as':_0x87e0('0x161'),'foreignKey':_0x87e0('0x177'),'onDelete':_0x87e0('0x111')});db[_0x87e0('0x4b')][_0x87e0('0x115')](db[_0x87e0('0x162')],{'as':_0x87e0('0x163'),'foreignKey':'FaxAccountId'});db[_0x87e0('0x4b')][_0x87e0('0x115')](db['FaxInteraction'],{'as':_0x87e0('0x164')});db['FaxAccount']['hasMany'](db[_0x87e0('0x4d')],{'as':_0x87e0('0x145')});db['FaxAccount'][_0x87e0('0x115')](db['VoiceExtension'],{'as':_0x87e0('0x178'),'onDelete':_0x87e0('0x111')});db['FaxAccount'][_0x87e0('0x115')](db['FaxMessage'],{'as':_0x87e0('0x156')});db[_0x87e0('0x4b')]['belongsTo'](db[_0x87e0('0x2c')],{'as':_0x87e0('0x2c')});db[_0x87e0('0x4b')]['belongsTo'](db[_0x87e0('0xf6')],{'as':_0x87e0('0x179'),'foreignKey':_0x87e0('0x166')});db[_0x87e0('0x4b')]['belongsTo'](db[_0x87e0('0x88')],{'as':_0x87e0('0x17a'),'foreignKey':_0x87e0('0x152')});db['FaxAccount'][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':'Agents','through':_0x87e0('0x13c')});db[_0x87e0('0x4d')]['belongsTo'](db['User'],{'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x4d')][_0x87e0('0x122')](db['FaxQueue'],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db['FaxAccount'],{'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x4d')][_0x87e0('0x122')](db[_0x87e0('0x92')],{'onDelete':'restrict','foreignKey':_0x87e0('0x17b')});db['FaxInteraction'][_0x87e0('0x115')](db[_0x87e0('0x51')],{'as':_0x87e0('0x156'),'onDelete':'cascade','foreignKey':_0x87e0('0x17c')});db[_0x87e0('0x4f')][_0x87e0('0x122')](db[_0x87e0('0x4b')],{'as':_0x87e0('0x16a'),'foreignKey':_0x87e0('0x177')});db[_0x87e0('0x4f')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x4f')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':_0x87e0('0x17e'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x4f')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':_0x87e0('0x17f'),'as':_0x87e0('0x16d')});db[_0x87e0('0x4f')][_0x87e0('0x124')](db['Tag'],{'through':_0x87e0('0x17f'),'as':_0x87e0('0x16e')});db[_0x87e0('0x4f')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x16f'),'through':_0x87e0('0x12c'),'foreignKey':_0x87e0('0x17c')});db[_0x87e0('0x51')]['belongsTo'](db[_0x87e0('0x12')],{'onDelete':_0x87e0('0x111'),'as':_0x87e0('0x12')});db['FaxMessage'][_0x87e0('0x122')](db[_0x87e0('0x4f')],{'as':'Interaction','foreignKey':_0x87e0('0x17c')});db[_0x87e0('0x51')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'onDelete':_0x87e0('0x111'),'as':_0x87e0('0x16b')});db[_0x87e0('0x51')][_0x87e0('0x122')](db['Attachment'],{'as':_0x87e0('0xec'),'foreignKey':_0x87e0('0x180')});db[_0x87e0('0x51')][_0x87e0('0x122')](db[_0x87e0('0x4b')],{'as':_0x87e0('0x16a'),'foreignKey':'FaxAccountId'});db[_0x87e0('0x53')]['belongsToMany'](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':_0x87e0('0x34')});db[_0x87e0('0x53')][_0x87e0('0x124')](db[_0x87e0('0xe7')],{'through':_0x87e0('0x181'),'as':'Teams'});db['FaxQueueReport'][_0x87e0('0x122')](db['FaxAccount'],{});db[_0x87e0('0x55')][_0x87e0('0x122')](db[_0x87e0('0xf6')],{'as':'List','foreignKey':_0x87e0('0x166')});db[_0x87e0('0x55')]['belongsTo'](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x55')][_0x87e0('0x122')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x87e0('0x122')](db[_0x87e0('0x51')],{});db[_0x87e0('0x55')][_0x87e0('0x122')](db[_0x87e0('0x12')],{});db[_0x87e0('0x55')][_0x87e0('0x122')](db[_0x87e0('0x53')],{});db[_0x87e0('0x56')][_0x87e0('0x115')](db['Disposition'],{'as':_0x87e0('0x161'),'foreignKey':_0x87e0('0x182'),'onDelete':'cascade'});db[_0x87e0('0x56')][_0x87e0('0x115')](db[_0x87e0('0x162')],{'as':_0x87e0('0x163'),'foreignKey':_0x87e0('0x182')});db[_0x87e0('0x56')]['hasMany'](db[_0x87e0('0x183')],{'as':'Messages','foreignKey':_0x87e0('0x182')});db[_0x87e0('0x56')]['hasMany'](db[_0x87e0('0x5a')],{'as':'Interactions'});db[_0x87e0('0x56')][_0x87e0('0x115')](db[_0x87e0('0x58')],{'as':'Applications'});db[_0x87e0('0x56')][_0x87e0('0x122')](db[_0x87e0('0xf6')],{'as':_0x87e0('0x179'),'foreignKey':_0x87e0('0x166')});db[_0x87e0('0x56')][_0x87e0('0x122')](db[_0x87e0('0x88')],{'as':_0x87e0('0x17a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x87e0('0x56')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':_0x87e0('0x140')});db[_0x87e0('0x58')]['belongsTo'](db[_0x87e0('0x12')],{'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x58')][_0x87e0('0x122')](db[_0x87e0('0x5d')],{'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x58')]['belongsTo'](db[_0x87e0('0x56')],{'onDelete':_0x87e0('0x15f')});db['SmsApplication'][_0x87e0('0x122')](db['Interval'],{'onDelete':_0x87e0('0x15f'),'foreignKey':_0x87e0('0x151')});db[_0x87e0('0x58')][_0x87e0('0x122')](db['Tag'],{'onDelete':_0x87e0('0x15f'),'foreignKey':_0x87e0('0x17b')});db[_0x87e0('0x5a')][_0x87e0('0x115')](db[_0x87e0('0x183')],{'as':_0x87e0('0x156'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x184')});db[_0x87e0('0x5a')][_0x87e0('0x122')](db[_0x87e0('0x56')],{'as':_0x87e0('0x16a'),'foreignKey':_0x87e0('0x182')});db[_0x87e0('0x5a')]['belongsTo'](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db['SmsInteraction'][_0x87e0('0x122')](db['User'],{'as':_0x87e0('0x17e'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x5a')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0x87e0('0x5a')][_0x87e0('0x124')](db['Tag'],{'through':_0x87e0('0x185'),'as':_0x87e0('0x16e')});db[_0x87e0('0x5a')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x16f'),'through':'user_has_sms_interactions','foreignKey':_0x87e0('0x184')});db['SmsMessage'][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':_0x87e0('0x12')});db['SmsMessage'][_0x87e0('0x122')](db[_0x87e0('0x126')],{'onDelete':'cascade','as':'Contact'});db[_0x87e0('0x183')]['belongsTo'](db[_0x87e0('0x5a')],{'onDelete':_0x87e0('0x111'),'as':'Interaction','foreignKey':_0x87e0('0x184')});db[_0x87e0('0x183')][_0x87e0('0x122')](db['SmsAccount'],{'as':_0x87e0('0x16a'),'foreignKey':'SmsAccountId'});db[_0x87e0('0x5d')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':'UserSmsQueue','foreignKey':_0x87e0('0x186')});db[_0x87e0('0x5d')][_0x87e0('0x124')](db[_0x87e0('0xe7')],{'through':_0x87e0('0x187'),'as':'Teams'});db['OpenchannelAccount'][_0x87e0('0x115')](db['Disposition'],{'as':_0x87e0('0x161'),'foreignKey':_0x87e0('0x188'),'onDelete':_0x87e0('0x111')});db[_0x87e0('0x5e')][_0x87e0('0x115')](db[_0x87e0('0x162')],{'as':_0x87e0('0x163'),'foreignKey':_0x87e0('0x188')});db[_0x87e0('0x5e')][_0x87e0('0x115')](db[_0x87e0('0x60')],{'as':_0x87e0('0x164'),'foreignKey':_0x87e0('0x188')});db['OpenchannelAccount'][_0x87e0('0x115')](db[_0x87e0('0x62')],{'as':_0x87e0('0x156'),'foreignKey':'OpenchannelAccountId'});db[_0x87e0('0x5e')][_0x87e0('0x115')](db[_0x87e0('0x5f')],{'as':_0x87e0('0x145'),'foreignKey':_0x87e0('0x188')});db['OpenchannelAccount'][_0x87e0('0x122')](db['CmList'],{'as':'List','foreignKey':_0x87e0('0x166')});db['OpenchannelAccount'][_0x87e0('0x122')](db[_0x87e0('0x88')],{'as':_0x87e0('0x17a'),'foreignKey':_0x87e0('0x152')});db[_0x87e0('0x5e')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':_0x87e0('0x13e')});db['OpenchannelApplication'][_0x87e0('0x122')](db[_0x87e0('0x12')],{'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x5f')][_0x87e0('0x122')](db[_0x87e0('0x136')],{'onDelete':_0x87e0('0x15f'),'foreignKey':_0x87e0('0x189')});db['OpenchannelApplication'][_0x87e0('0x122')](db[_0x87e0('0x5e')],{'onDelete':_0x87e0('0x15f'),'foreignKey':_0x87e0('0x188')});db['OpenchannelApplication'][_0x87e0('0x122')](db[_0x87e0('0x150')],{'onDelete':_0x87e0('0x15f'),'foreignKey':_0x87e0('0x151')});db[_0x87e0('0x5f')][_0x87e0('0x122')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x87e0('0x17b')});db[_0x87e0('0x60')][_0x87e0('0x115')](db[_0x87e0('0x62')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x87e0('0x18a')});db['OpenchannelInteraction'][_0x87e0('0x122')](db['OpenchannelAccount'],{'as':_0x87e0('0x16a'),'foreignKey':_0x87e0('0x188')});db[_0x87e0('0x60')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x60')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':_0x87e0('0x17e'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x60')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':_0x87e0('0x18b'),'as':_0x87e0('0x16d')});db[_0x87e0('0x60')]['belongsToMany'](db[_0x87e0('0x92')],{'through':_0x87e0('0x18b'),'as':'ThroughTags'});db[_0x87e0('0x60')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0x87e0('0x18a')});db[_0x87e0('0x62')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'onDelete':_0x87e0('0x111'),'as':_0x87e0('0x12')});db[_0x87e0('0x62')]['belongsTo'](db[_0x87e0('0x126')],{'onDelete':'cascade','as':_0x87e0('0x16b')});db[_0x87e0('0x62')][_0x87e0('0x122')](db[_0x87e0('0x60')],{'onDelete':_0x87e0('0x111'),'as':'Interaction','foreignKey':_0x87e0('0x18a')});db[_0x87e0('0x62')]['belongsTo'](db[_0x87e0('0xec')],{'as':_0x87e0('0xec'),'foreignKey':'AttachmentId'});db[_0x87e0('0x62')][_0x87e0('0x122')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x87e0('0x188')});db['OpenchannelQueue'][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':'UserOpenchannelQueue','foreignKey':_0x87e0('0x189')});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':_0x87e0('0x18c'),'as':'Teams'});db[_0x87e0('0x172')]['hasMany'](db[_0x87e0('0x83')],{'as':_0x87e0('0x161'),'foreignKey':_0x87e0('0x173'),'onDelete':_0x87e0('0x111')});db[_0x87e0('0x172')]['hasMany'](db['CannedAnswer'],{'as':_0x87e0('0x163'),'foreignKey':'ChatWebsiteId'});db[_0x87e0('0x172')][_0x87e0('0x115')](db[_0x87e0('0x70')],{'as':'ProactiveActions'});db[_0x87e0('0x172')][_0x87e0('0x115')](db[_0x87e0('0x6a')],{'as':'Interactions'});db[_0x87e0('0x172')][_0x87e0('0x115')](db['ChatApplication'],{'as':_0x87e0('0x145')});db[_0x87e0('0x172')][_0x87e0('0x115')](db[_0x87e0('0x6b')],{'as':_0x87e0('0x156')});db[_0x87e0('0x172')][_0x87e0('0x122')](db[_0x87e0('0xf6')],{'as':_0x87e0('0x179'),'foreignKey':_0x87e0('0x166')});db[_0x87e0('0x172')]['belongsTo'](db[_0x87e0('0x150')],{'as':_0x87e0('0x150'),'foreignKey':'IntervalId'});db[_0x87e0('0x172')][_0x87e0('0x122')](db[_0x87e0('0x3e')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x87e0('0x172')][_0x87e0('0x122')](db[_0x87e0('0x88')],{'as':_0x87e0('0x17a'),'foreignKey':_0x87e0('0x152')});db[_0x87e0('0x172')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':_0x87e0('0x13a')});db['OpenchannelQueueReport'][_0x87e0('0x122')](db[_0x87e0('0x5e')],{});db['OpenchannelQueueReport'][_0x87e0('0x122')](db['CmList'],{'as':_0x87e0('0x179'),'foreignKey':'ListId'});db[_0x87e0('0x66')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':'Contact','foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x66')]['belongsTo'](db[_0x87e0('0x60')],{});db[_0x87e0('0x66')][_0x87e0('0x122')](db['OpenchannelMessage'],{});db[_0x87e0('0x66')]['belongsTo'](db[_0x87e0('0x12')],{});db[_0x87e0('0x66')][_0x87e0('0x122')](db[_0x87e0('0x136')],{});db[_0x87e0('0x68')]['belongsTo'](db[_0x87e0('0x12')],{'as':_0x87e0('0x18d'),'foreignKey':_0x87e0('0x112'),'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x68')]['belongsTo'](db[_0x87e0('0x18e')],{'as':_0x87e0('0x18f'),'foreignKey':_0x87e0('0x190'),'onDelete':'restrict'});db[_0x87e0('0x68')]['belongsTo'](db[_0x87e0('0x172')],{'as':'Website','foreignKey':_0x87e0('0x173'),'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x68')][_0x87e0('0x122')](db[_0x87e0('0x92')],{'onDelete':'restrict','foreignKey':_0x87e0('0x17b')});db['ChatInteraction']['hasMany'](db[_0x87e0('0x6b')],{'as':'Messages','onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x191')});db[_0x87e0('0x6a')]['belongsTo'](db[_0x87e0('0x172')],{'as':_0x87e0('0x16a'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x6a')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':_0x87e0('0x17e'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x6a')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':'chat_interaction_has_tags','as':_0x87e0('0x16d')});db[_0x87e0('0x6a')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':_0x87e0('0x192'),'as':_0x87e0('0x16e')});db[_0x87e0('0x6a')]['belongsToMany'](db[_0x87e0('0x12')],{'as':_0x87e0('0x16f'),'through':'user_has_chat_interactions','foreignKey':_0x87e0('0x191')});db['ChatMessage']['belongsTo'](db[_0x87e0('0x12')],{'onDelete':'cascade','as':_0x87e0('0x12')});db[_0x87e0('0x6b')][_0x87e0('0x122')](db['CmContact'],{'onDelete':'cascade','as':_0x87e0('0x16b'),'foreignKey':'ContactId'});db['ChatMessage'][_0x87e0('0x122')](db[_0x87e0('0x6a')],{'onDelete':_0x87e0('0x111'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x87e0('0x6b')][_0x87e0('0x122')](db['Attachment'],{'as':'Attachment','foreignKey':_0x87e0('0x180')});db['ChatMessage'][_0x87e0('0x122')](db[_0x87e0('0x172')],{'as':'Account','foreignKey':_0x87e0('0x173')});db[_0x87e0('0x6c')][_0x87e0('0x115')](db[_0x87e0('0xec')],{'as':'Attachments','foreignKey':_0x87e0('0x174'),'onDelete':_0x87e0('0x111'),'hooks':!![]});db[_0x87e0('0x6c')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'onDelete':'cascade','as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x6c')][_0x87e0('0x122')](db[_0x87e0('0x172')],{'as':_0x87e0('0x16a'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x87e0('0x124')](db[_0x87e0('0xe7')],{'through':_0x87e0('0x193'),'as':_0x87e0('0x168')});db[_0x87e0('0x6f')][_0x87e0('0x115')](db[_0x87e0('0xd8')],{'as':_0x87e0('0x156'),'foreignKey':_0x87e0('0x194'),'onDelete':_0x87e0('0x111')});db[_0x87e0('0x6f')]['belongsToMany'](db[_0x87e0('0x12')],{'as':'Members','through':_0x87e0('0x125')});db['ChatProactiveAction']['belongsTo'](db['ChatWebsite'],{'as':_0x87e0('0x195'),'foreignKey':_0x87e0('0x173')});db[_0x87e0('0x72')][_0x87e0('0x115')](db[_0x87e0('0x126')],{'as':'Contacts','foreignKey':_0x87e0('0x196')});db[_0x87e0('0x126')][_0x87e0('0x115')](db[_0x87e0('0x197')],{'as':_0x87e0('0x198'),'foreignKey':_0x87e0('0x199')});db[_0x87e0('0x126')][_0x87e0('0x115')](db[_0x87e0('0x75')],{'as':_0x87e0('0x149'),'foreignKey':'ContactId'});db[_0x87e0('0x126')][_0x87e0('0x115')](db[_0x87e0('0x77')],{'as':_0x87e0('0x14a'),'foreignKey':_0x87e0('0x17d')});db['CmContact']['hasMany'](db[_0x87e0('0x79')],{'as':_0x87e0('0x14b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x126')][_0x87e0('0x115')](db['ReportAgentPreview'],{'as':_0x87e0('0x11a'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x126')]['hasMany'](db[_0x87e0('0xdc')],{'as':_0x87e0('0x19a'),'foreignKey':'ContactId'});db['CmContact'][_0x87e0('0x115')](db[_0x87e0('0x60')],{'as':_0x87e0('0x11b'),'foreignKey':_0x87e0('0x17d'),'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x126')][_0x87e0('0x115')](db[_0x87e0('0x6a')],{'as':_0x87e0('0x11c'),'foreignKey':'ContactId','onDelete':_0x87e0('0x15f')});db['CmContact'][_0x87e0('0x115')](db[_0x87e0('0x5a')],{'as':_0x87e0('0x11d'),'foreignKey':_0x87e0('0x17d'),'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x126')]['hasMany'](db['FaxInteraction'],{'as':_0x87e0('0x11e'),'foreignKey':_0x87e0('0x17d'),'onDelete':_0x87e0('0x15f')});db['CmContact'][_0x87e0('0x115')](db[_0x87e0('0x42')],{'as':'MailInteractions','foreignKey':_0x87e0('0x17d'),'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x126')][_0x87e0('0x122')](db[_0x87e0('0x72')],{'as':_0x87e0('0x19b'),'foreignKey':_0x87e0('0x196')});db[_0x87e0('0x126')][_0x87e0('0x122')](db[_0x87e0('0xf6')],{'as':_0x87e0('0x179'),'foreignKey':_0x87e0('0x166'),'onDelete':_0x87e0('0x111')});db['CmContact']['belongsToMany'](db['User'],{'as':_0x87e0('0x16f'),'through':_0x87e0('0x128')});db[_0x87e0('0x126')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'as':_0x87e0('0x16d'),'through':'cm_contact_has_tags'});db[_0x87e0('0x126')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':_0x87e0('0x19c'),'as':_0x87e0('0x16e')});db[_0x87e0('0x75')][_0x87e0('0x115')](db[_0x87e0('0x96')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0x87e0('0x75')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x87e0('0x111')});db['CmHopper']['belongsTo'](db[_0x87e0('0xf6')],{'as':_0x87e0('0x179'),'foreignKey':'ListId','onDelete':_0x87e0('0x111')});db[_0x87e0('0x75')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':_0x87e0('0x18d'),'foreignKey':_0x87e0('0x112')});db[_0x87e0('0x75')][_0x87e0('0x122')](db[_0x87e0('0x1c')],{'as':_0x87e0('0x18f'),'foreignKey':_0x87e0('0x148'),'onDelete':_0x87e0('0x111')});db['CmHopper']['belongsTo'](db['Campaign'],{'as':_0x87e0('0xe9'),'foreignKey':'CampaignId','onDelete':_0x87e0('0x111')});db[_0x87e0('0x75')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':_0x87e0('0x17e'),'foreignKey':_0x87e0('0x19d')});db[_0x87e0('0x76')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d'),'onDelete':_0x87e0('0x111')});db[_0x87e0('0x76')]['belongsTo'](db[_0x87e0('0xf6')],{'as':_0x87e0('0x179'),'foreignKey':'ListId','onDelete':_0x87e0('0x111')});db[_0x87e0('0x76')][_0x87e0('0x122')](db[_0x87e0('0x1c')],{'as':_0x87e0('0x18f'),'foreignKey':_0x87e0('0x148'),'onDelete':'cascade'});db[_0x87e0('0x76')][_0x87e0('0x122')](db[_0x87e0('0xe9')],{'as':'Campaign','foreignKey':_0x87e0('0x19e'),'onDelete':_0x87e0('0x111')});db[_0x87e0('0x80')][_0x87e0('0x115')](db['Condition'],{'as':{'plural':'All','singular':_0x87e0('0x19f')},'foreignKey':_0x87e0('0x1a0'),'onDelete':'cascade','hooks':!![]});db[_0x87e0('0x80')][_0x87e0('0x115')](db[_0x87e0('0x85')],{'as':{'plural':_0x87e0('0x1a1'),'singular':_0x87e0('0x1a2')},'foreignKey':_0x87e0('0x1a3'),'onDelete':_0x87e0('0x111'),'hooks':!![]});db[_0x87e0('0x80')]['hasMany'](db[_0x87e0('0x7e')],{'as':_0x87e0('0x1a4'),'foreignKey':_0x87e0('0x1a5'),'onDelete':_0x87e0('0x111'),'hooks':!![]});db[_0x87e0('0x83')][_0x87e0('0x115')](db[_0x87e0('0x83')],{'as':_0x87e0('0x161'),'foreignKey':_0x87e0('0x1a6'),'onDelete':'cascade'});db[_0x87e0('0x150')][_0x87e0('0x115')](db[_0x87e0('0x150')],{'as':_0x87e0('0x1a7'),'foreignKey':_0x87e0('0x151'),'onDelete':_0x87e0('0x111'),'hooks':!![],'required':![]});db['Interval'][_0x87e0('0x115')](db['VoiceExtension'],{'as':_0x87e0('0x118'),'foreignKey':_0x87e0('0x151'),'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x150')]['hasMany'](db[_0x87e0('0x165')],{'as':_0x87e0('0x1a8'),'foreignKey':'IntervalId'});db[_0x87e0('0x150')][_0x87e0('0x115')](db[_0x87e0('0x68')],{'as':_0x87e0('0x1a9'),'foreignKey':'IntervalId'});db[_0x87e0('0x150')][_0x87e0('0x115')](db[_0x87e0('0x4d')],{'as':_0x87e0('0x1aa'),'foreignKey':_0x87e0('0x151')});db[_0x87e0('0x150')][_0x87e0('0x115')](db[_0x87e0('0x58')],{'as':_0x87e0('0x1ab'),'foreignKey':_0x87e0('0x151')});db[_0x87e0('0x8e')]['belongsTo'](db[_0x87e0('0x3e')],{});db[_0x87e0('0x8e')][_0x87e0('0x122')](db['AnalyticDefaultReport'],{'foreignKey':_0x87e0('0x1ac')});db['Schedule'][_0x87e0('0x122')](db['AnalyticCustomReport'],{'foreignKey':_0x87e0('0x1ad')});db[_0x87e0('0x90')][_0x87e0('0x124')](db[_0x87e0('0x1a')],{'as':_0x87e0('0x1ae'),'through':_0x87e0('0x1af'),'onDelete':_0x87e0('0x15f')});db[_0x87e0('0x92')][_0x87e0('0x124')](db[_0x87e0('0x126')],{'through':'cm_contact_has_tags'});db[_0x87e0('0x92')]['belongsToMany'](db[_0x87e0('0x6a')],{'through':_0x87e0('0x192')});db[_0x87e0('0x92')][_0x87e0('0x124')](db[_0x87e0('0x42')],{'through':_0x87e0('0x16c')});db['Tag'][_0x87e0('0x124')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x87e0('0x92')][_0x87e0('0x124')](db[_0x87e0('0x4f')],{'through':_0x87e0('0x17f')});db['Tag'][_0x87e0('0x124')](db[_0x87e0('0x60')],{'through':'openchannel_interaction_has_tags'});db[_0x87e0('0x92')][_0x87e0('0x124')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x87e0('0x197')]['belongsTo'](db[_0x87e0('0x94')],{'as':'ItemType','foreignKey':_0x87e0('0x1b0')});db[_0x87e0('0x96')][_0x87e0('0x122')](db[_0x87e0('0x75')],{'as':_0x87e0('0x1b1'),'foreignKey':_0x87e0('0x1b2')});db[_0x87e0('0x197')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x199')});db['Trigger'][_0x87e0('0x115')](db[_0x87e0('0x85')],{'as':{'plural':_0x87e0('0x1b3'),'singular':_0x87e0('0x1b4')},'foreignKey':_0x87e0('0x1b5'),'onDelete':_0x87e0('0x111'),'hooks':!![]});db[_0x87e0('0x98')][_0x87e0('0x115')](db[_0x87e0('0x85')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x87e0('0x1b6'),'onDelete':_0x87e0('0x111'),'hooks':!![]});db[_0x87e0('0x98')][_0x87e0('0x115')](db[_0x87e0('0x7e')],{'as':_0x87e0('0x1a4'),'foreignKey':_0x87e0('0x1b7'),'onDelete':'cascade','hooks':!![]});db[_0x87e0('0x9f')][_0x87e0('0x115')](db[_0x87e0('0xa6')],{'as':_0x87e0('0x1b8'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1ad'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x87e0('0xa6')],{'as':_0x87e0('0x1b8'),'onDelete':'cascade','foreignKey':_0x87e0('0x1ac')});db[_0x87e0('0xa4')][_0x87e0('0x115')](db[_0x87e0('0xa6')],{'as':_0x87e0('0x1b8'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1b9')});db[_0x87e0('0xa6')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x87e0('0x115')](db['SalesforceConfiguration'],{'as':_0x87e0('0x1ba'),'onDelete':'cascade','foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0x1bc')]['hasMany'](db['SalesforceField'],{'as':_0x87e0('0x1bd'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1be')});db[_0x87e0('0x1bc')][_0x87e0('0x115')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0x1bc')][_0x87e0('0x115')](db['SalesforceField'],{'as':_0x87e0('0x1b8'),'onDelete':_0x87e0('0x111'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0x87e0('0x122')](db[_0x87e0('0xa9')],{'as':'Account','foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0xab')]['hasMany'](db[_0x87e0('0xab')],{'as':_0x87e0('0x1c0'),'foreignKey':_0x87e0('0x1be')});db['SalesforceField'][_0x87e0('0x115')](db[_0x87e0('0xab')],{'as':_0x87e0('0x1c1'),'foreignKey':_0x87e0('0x1bf')});db['SalesforceField'][_0x87e0('0x115')](db['SalesforceField'],{'as':_0x87e0('0x1c2'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xab')]['belongsTo'](db['Variable'],{'as':_0x87e0('0x99'),'foreignKey':'VariableId'});db[_0x87e0('0xad')]['hasMany'](db[_0x87e0('0xaf')],{'as':_0x87e0('0x1ba'),'onDelete':'cascade','foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0xaf')]['hasMany'](db[_0x87e0('0x1c4')],{'as':'Subjects','onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1be')});db[_0x87e0('0xaf')]['hasMany'](db[_0x87e0('0x1c4')],{'as':_0x87e0('0x1c5'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xaf')][_0x87e0('0x115')](db[_0x87e0('0x1c4')],{'as':'Fields','onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xaf')][_0x87e0('0x122')](db[_0x87e0('0xad')],{'as':_0x87e0('0x16a'),'foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0x1c4')][_0x87e0('0x115')](db['SugarcrmField'],{'as':_0x87e0('0x1c0'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0x87e0('0x115')](db[_0x87e0('0x1c4')],{'as':_0x87e0('0x1c1'),'foreignKey':'DescriptionId'});db[_0x87e0('0x1c4')][_0x87e0('0x115')](db[_0x87e0('0x1c4')],{'as':_0x87e0('0x1c2'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0x1c4')][_0x87e0('0x122')](db['Variable'],{'as':_0x87e0('0x99'),'foreignKey':'VariableId'});db[_0x87e0('0xb2')]['hasMany'](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0xb3')][_0x87e0('0x115')](db[_0x87e0('0xb5')],{'as':_0x87e0('0x1bd'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1be')});db['DeskConfiguration'][_0x87e0('0x115')](db[_0x87e0('0xb5')],{'as':'Descriptions','onDelete':_0x87e0('0x111'),'foreignKey':'DescriptionId'});db[_0x87e0('0xb3')][_0x87e0('0x115')](db[_0x87e0('0xb5')],{'as':_0x87e0('0x1b8'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xb3')][_0x87e0('0x122')](db[_0x87e0('0xb2')],{'as':_0x87e0('0x16a'),'foreignKey':'AccountId'});db[_0x87e0('0xb3')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':_0x87e0('0x1c6')});db['DeskField'][_0x87e0('0x115')](db[_0x87e0('0xb5')],{'as':'Subject','foreignKey':_0x87e0('0x1be')});db[_0x87e0('0xb5')]['hasMany'](db[_0x87e0('0xb5')],{'as':_0x87e0('0x1c1'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xb5')][_0x87e0('0x115')](db['DeskField'],{'as':_0x87e0('0x1c2'),'foreignKey':_0x87e0('0x1c3')});db['DeskField'][_0x87e0('0x122')](db[_0x87e0('0x99')],{'as':'Variable','foreignKey':_0x87e0('0x1c7')});db[_0x87e0('0xb6')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0x87e0('0x111'),'foreignKey':'AccountId'});db[_0x87e0('0xb7')]['hasMany'](db['ZohoField'],{'as':_0x87e0('0x1bd'),'onDelete':'cascade','foreignKey':_0x87e0('0x1be')});db[_0x87e0('0xb7')][_0x87e0('0x115')](db['ZohoField'],{'as':_0x87e0('0x1c5'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xb7')][_0x87e0('0x115')](db[_0x87e0('0x1c8')],{'as':_0x87e0('0x1b8'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xb7')][_0x87e0('0x122')](db[_0x87e0('0xb6')],{'as':'Account','foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0x1c8')][_0x87e0('0x115')](db[_0x87e0('0x1c8')],{'as':_0x87e0('0x1c0'),'foreignKey':'SubjectId'});db['ZohoField'][_0x87e0('0x115')](db[_0x87e0('0x1c8')],{'as':_0x87e0('0x1c1'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x87e0('0x115')](db[_0x87e0('0x1c8')],{'as':_0x87e0('0x1c2'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0x1c8')]['belongsTo'](db[_0x87e0('0x99')],{'as':_0x87e0('0x99'),'foreignKey':_0x87e0('0x1c7')});db['ZendeskAccount']['hasMany'](db[_0x87e0('0x1c9')],{'as':'Configurations','onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0x1c9')]['hasMany'](db[_0x87e0('0xbc')],{'as':'Subjects','foreignKey':_0x87e0('0x1be')});db[_0x87e0('0x1c9')][_0x87e0('0x115')](db[_0x87e0('0xbc')],{'as':_0x87e0('0x1c5'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0x1c9')][_0x87e0('0x115')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0x1c9')]['belongsTo'](db[_0x87e0('0xb9')],{'as':'Account','foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0x1c9')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':_0x87e0('0x1ca')});db[_0x87e0('0xbc')]['hasMany'](db[_0x87e0('0xbc')],{'as':_0x87e0('0x1c0'),'foreignKey':'SubjectId'});db[_0x87e0('0xbc')][_0x87e0('0x115')](db[_0x87e0('0xbc')],{'as':'Description','foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xbc')][_0x87e0('0x115')](db[_0x87e0('0xbc')],{'as':_0x87e0('0x1c2'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xbc')][_0x87e0('0x122')](db[_0x87e0('0x99')],{'as':_0x87e0('0x99'),'foreignKey':_0x87e0('0x1c7')});db['FreshdeskAccount'][_0x87e0('0x115')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0xbe')][_0x87e0('0x115')](db[_0x87e0('0xc0')],{'as':'Subjects','onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1be')});db[_0x87e0('0xbe')][_0x87e0('0x115')](db[_0x87e0('0xc0')],{'as':_0x87e0('0x1c5'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xbe')][_0x87e0('0x115')](db[_0x87e0('0xc0')],{'as':_0x87e0('0x1b8'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xbe')][_0x87e0('0x122')](db[_0x87e0('0x1cb')],{'as':_0x87e0('0x16a'),'foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0xbe')][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':_0x87e0('0x1cc')});db['FreshdeskField']['hasMany'](db[_0x87e0('0xc0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x87e0('0xc0')][_0x87e0('0x115')](db[_0x87e0('0xc0')],{'as':'Description','foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xc0')][_0x87e0('0x115')](db[_0x87e0('0xc0')],{'as':_0x87e0('0x1c2'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xc0')][_0x87e0('0x122')](db['Variable'],{'as':_0x87e0('0x99'),'foreignKey':_0x87e0('0x1c7')});db[_0x87e0('0xc2')]['hasMany'](db[_0x87e0('0x1cd')],{'as':_0x87e0('0x1ba'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0x1cd')][_0x87e0('0x115')](db['VtigerField'],{'as':_0x87e0('0x1bd'),'foreignKey':_0x87e0('0x1be')});db[_0x87e0('0x1cd')]['hasMany'](db['VtigerField'],{'as':_0x87e0('0x1c5'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0x1cd')]['hasMany'](db[_0x87e0('0x1ce')],{'as':_0x87e0('0x1b8'),'foreignKey':_0x87e0('0x1c3')});db['VtigerConfiguration'][_0x87e0('0x122')](db[_0x87e0('0xc2')],{'as':'Account','foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0x1ce')][_0x87e0('0x115')](db['VtigerField'],{'as':_0x87e0('0x1c0'),'foreignKey':_0x87e0('0x1be')});db[_0x87e0('0x1ce')][_0x87e0('0x115')](db[_0x87e0('0x1ce')],{'as':_0x87e0('0x1c1'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0x1ce')][_0x87e0('0x115')](db[_0x87e0('0x1ce')],{'as':'Field','foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0x1ce')][_0x87e0('0x122')](db[_0x87e0('0x99')],{'as':_0x87e0('0x99'),'foreignKey':'VariableId'});db[_0x87e0('0x1cf')][_0x87e0('0x115')](db[_0x87e0('0xc6')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x87e0('0x1bb')});db['ServicenowConfiguration'][_0x87e0('0x115')](db[_0x87e0('0xc8')],{'as':_0x87e0('0x1bd'),'foreignKey':_0x87e0('0x1be')});db['ServicenowConfiguration'][_0x87e0('0x115')](db[_0x87e0('0xc8')],{'as':_0x87e0('0x1c5'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration']['hasMany'](db[_0x87e0('0xc8')],{'as':'Fields','foreignKey':'FieldId'});db[_0x87e0('0xc6')][_0x87e0('0x122')](db[_0x87e0('0x1cf')],{'as':_0x87e0('0x16a'),'foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0xc8')][_0x87e0('0x115')](db[_0x87e0('0xc8')],{'as':_0x87e0('0x1c0'),'foreignKey':_0x87e0('0x1be')});db['ServicenowField'][_0x87e0('0x115')](db[_0x87e0('0xc8')],{'as':'Description','foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xc8')][_0x87e0('0x115')](db[_0x87e0('0xc8')],{'as':_0x87e0('0x1c2'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xc8')][_0x87e0('0x122')](db[_0x87e0('0x99')],{'as':'Variable','foreignKey':_0x87e0('0x1c7')});db['Dynamics365Account'][_0x87e0('0x115')](db[_0x87e0('0xcc')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x87e0('0x1bb')});db['Dynamics365Account'][_0x87e0('0x122')](db[_0x87e0('0x15d')],{'as':_0x87e0('0x15d'),'foreignKey':_0x87e0('0x15e')});db[_0x87e0('0xcc')][_0x87e0('0x115')](db['Dynamics365Field'],{'as':_0x87e0('0x1bd'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1be')});db['Dynamics365Configuration'][_0x87e0('0x115')](db[_0x87e0('0xce')],{'as':_0x87e0('0x1c5'),'onDelete':_0x87e0('0x111'),'foreignKey':'DescriptionId'});db[_0x87e0('0xcc')][_0x87e0('0x115')](db['Dynamics365Field'],{'as':_0x87e0('0x1b8'),'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1c3')});db['Dynamics365Configuration'][_0x87e0('0x122')](db['Dynamics365Account'],{'as':_0x87e0('0x16a'),'foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0xce')]['hasMany'](db[_0x87e0('0xce')],{'as':_0x87e0('0x1c0'),'foreignKey':_0x87e0('0x1be')});db[_0x87e0('0xce')][_0x87e0('0x115')](db[_0x87e0('0xce')],{'as':_0x87e0('0x1c1'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xce')][_0x87e0('0x115')](db[_0x87e0('0xce')],{'as':_0x87e0('0x1c2'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xce')][_0x87e0('0x122')](db[_0x87e0('0x99')],{'as':_0x87e0('0x99'),'foreignKey':'VariableId'});db[_0x87e0('0xd0')]['hasMany'](db[_0x87e0('0xd1')],{'as':_0x87e0('0x1ba'),'onDelete':'cascade','foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0xd1')][_0x87e0('0x115')](db[_0x87e0('0xd3')],{'as':_0x87e0('0x1bd'),'foreignKey':_0x87e0('0x1be')});db[_0x87e0('0xd1')][_0x87e0('0x115')](db[_0x87e0('0xd3')],{'as':'Descriptions','foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xd1')]['hasMany'](db[_0x87e0('0xd3')],{'as':_0x87e0('0x1b8'),'foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xd1')][_0x87e0('0x122')](db[_0x87e0('0xd0')],{'as':'Account','foreignKey':_0x87e0('0x1bb')});db[_0x87e0('0xd3')][_0x87e0('0x115')](db[_0x87e0('0xd3')],{'as':_0x87e0('0x1c0'),'foreignKey':_0x87e0('0x1be')});db['FreshsalesField']['hasMany'](db[_0x87e0('0xd3')],{'as':_0x87e0('0x1c1'),'foreignKey':_0x87e0('0x1bf')});db[_0x87e0('0xd3')]['hasMany'](db['FreshsalesField'],{'as':'Field','foreignKey':_0x87e0('0x1c3')});db[_0x87e0('0xd3')][_0x87e0('0x122')](db['Variable'],{'as':_0x87e0('0x99'),'foreignKey':_0x87e0('0x1c7')});db[_0x87e0('0xd6')][_0x87e0('0x122')](db[_0x87e0('0x172')],{});db[_0x87e0('0xd6')][_0x87e0('0x122')](db[_0x87e0('0xf6')],{'as':_0x87e0('0x179'),'foreignKey':_0x87e0('0x166')});db['ChatQueueReport'][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0xd6')][_0x87e0('0x122')](db[_0x87e0('0x6a')],{});db[_0x87e0('0xd6')][_0x87e0('0x122')](db[_0x87e0('0x6b')],{});db['ChatQueueReport'][_0x87e0('0x122')](db['User'],{});db[_0x87e0('0xd6')]['belongsTo'](db[_0x87e0('0x18e')],{});db[_0x87e0('0xd8')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'onDelete':_0x87e0('0x111'),'foreignKey':_0x87e0('0x1d0')});db['ChatInternalMessage'][_0x87e0('0x122')](db['User'],{'onDelete':'cascade','foreignKey':_0x87e0('0x1d1')});db['JscriptySessionReport'][_0x87e0('0x115')](db[_0x87e0('0xda')],{'foreignKey':'SessionId','onDelete':_0x87e0('0x111')});db['JscriptySessionReport']['hasMany'](db[_0x87e0('0x1d2')],{'foreignKey':'SessionId','onDelete':_0x87e0('0x111')});db['SmsQueueReport'][_0x87e0('0x122')](db[_0x87e0('0x56')],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':_0x87e0('0x179'),'foreignKey':_0x87e0('0x166')});db['SmsQueueReport'][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0xde')][_0x87e0('0x122')](db[_0x87e0('0x5a')],{});db['SmsQueueReport'][_0x87e0('0x122')](db['SmsMessage'],{});db[_0x87e0('0xde')][_0x87e0('0x122')](db[_0x87e0('0x12')],{});db[_0x87e0('0xde')][_0x87e0('0x122')](db[_0x87e0('0x5d')],{});db[_0x87e0('0xe0')][_0x87e0('0x115')](db[_0x87e0('0xdc')],{'foreignKey':_0x87e0('0x1d3')});db[_0x87e0('0xe0')][_0x87e0('0x115')](db[_0x87e0('0xda')],{'foreignKey':_0x87e0('0x1d3')});db[_0x87e0('0xe0')][_0x87e0('0x115')](db[_0x87e0('0x1d2')],{'foreignKey':_0x87e0('0x1d3')});db[_0x87e0('0xe7')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':'Agents','through':_0x87e0('0x1d4')});db['Team'][_0x87e0('0x124')](db[_0x87e0('0x1c')],{'through':_0x87e0('0x10b'),'as':'VoiceQueues'});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0x87e0('0x1d5'),'as':_0x87e0('0x1d6')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0x87e0('0x193'),'as':_0x87e0('0x133')});db[_0x87e0('0xe7')][_0x87e0('0x124')](db[_0x87e0('0x53')],{'through':_0x87e0('0x181'),'as':_0x87e0('0x134')});db['Team'][_0x87e0('0x124')](db[_0x87e0('0x5d')],{'through':'team_has_sms_queues','as':_0x87e0('0x135')});db[_0x87e0('0xe7')][_0x87e0('0x124')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db['Team'][_0x87e0('0x124')](db[_0x87e0('0x108')],{'through':_0x87e0('0x1d7'),'as':'WhatsappQueues'});db[_0x87e0('0xe7')][_0x87e0('0x124')](db['VoicePrefix'],{'through':_0x87e0('0x10d'),'as':_0x87e0('0x130')});db[_0x87e0('0xe9')][_0x87e0('0x115')](db['CmHopper'],{'as':_0x87e0('0x149'),'foreignKey':_0x87e0('0x19e')});db[_0x87e0('0xe9')][_0x87e0('0x115')](db[_0x87e0('0x77')],{'as':_0x87e0('0x14a'),'foreignKey':_0x87e0('0x19e')});db[_0x87e0('0xe9')]['hasMany'](db[_0x87e0('0x79')],{'as':_0x87e0('0x14b'),'foreignKey':_0x87e0('0x19e')});db[_0x87e0('0xe9')][_0x87e0('0x115')](db[_0x87e0('0x76')],{'as':_0x87e0('0x14c'),'foreignKey':_0x87e0('0x19e')});db[_0x87e0('0xe9')][_0x87e0('0x122')](db[_0x87e0('0x2c')],{'as':'Trunk','foreignKey':_0x87e0('0x14d')});db['Campaign'][_0x87e0('0x122')](db[_0x87e0('0x2c')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x87e0('0xe9')][_0x87e0('0x122')](db[_0x87e0('0x150')],{'as':_0x87e0('0x150'),'foreignKey':_0x87e0('0x151')});db[_0x87e0('0xe9')]['belongsTo'](db[_0x87e0('0xe4')],{'as':_0x87e0('0xe4'),'foreignKey':_0x87e0('0x1d8')});db[_0x87e0('0xe9')][_0x87e0('0x124')](db['CmList'],{'as':_0x87e0('0x129'),'through':_0x87e0('0x1d9')});db[_0x87e0('0xe9')][_0x87e0('0x124')](db[_0x87e0('0xf6')],{'as':_0x87e0('0x1da'),'through':'campaigns_has_cm_blacklists'});db[_0x87e0('0xec')]['belongsTo'](db[_0x87e0('0x6c')],{'as':_0x87e0('0x6c'),'foreignKey':_0x87e0('0x174')});db[_0x87e0('0xee')][_0x87e0('0x122')](db['MailMessage'],{});db['MailTransferReport']['belongsTo'](db[_0x87e0('0x42')],{});db['MailTransferReport'][_0x87e0('0x122')](db['MailAccount'],{'foreignKey':_0x87e0('0x1db'),'as':_0x87e0('0x1dc')});db[_0x87e0('0xee')]['belongsTo'](db[_0x87e0('0x12')],{'foreignKey':_0x87e0('0x1dd'),'as':_0x87e0('0x1de')});db[_0x87e0('0xee')]['belongsTo'](db['User'],{'foreignKey':_0x87e0('0x1df'),'as':'ToAgent'});db['MailTransferReport'][_0x87e0('0x122')](db[_0x87e0('0x3f')],{'foreignKey':_0x87e0('0x1e0'),'as':_0x87e0('0x1e1')});db[_0x87e0('0xee')]['belongsTo'](db[_0x87e0('0x3e')],{'foreignKey':_0x87e0('0x1e2'),'as':_0x87e0('0x1e3')});db[_0x87e0('0x1e4')]['belongsTo'](db[_0x87e0('0x6b')],{});db[_0x87e0('0x1e4')][_0x87e0('0x122')](db[_0x87e0('0x6a')],{});db[_0x87e0('0x1e4')][_0x87e0('0x122')](db[_0x87e0('0x172')],{'foreignKey':_0x87e0('0x1e5'),'as':_0x87e0('0x1dc')});db[_0x87e0('0x1e4')][_0x87e0('0x122')](db['User'],{'foreignKey':'FromUserId','as':_0x87e0('0x1de')});db['ChatTransferReport'][_0x87e0('0x122')](db[_0x87e0('0x12')],{'foreignKey':_0x87e0('0x1df'),'as':_0x87e0('0x1e6')});db[_0x87e0('0x1e4')][_0x87e0('0x122')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x87e0('0x1e1')});db[_0x87e0('0x1e4')][_0x87e0('0x122')](db[_0x87e0('0x172')],{'foreignKey':_0x87e0('0x1e7'),'as':_0x87e0('0x1e3')});db['FaxTransferReport'][_0x87e0('0x122')](db['FaxMessage'],{});db[_0x87e0('0xf1')]['belongsTo'](db[_0x87e0('0x4f')],{});db['FaxTransferReport'][_0x87e0('0x122')](db['FaxAccount'],{'foreignKey':_0x87e0('0x1e8'),'as':'FromAccount'});db[_0x87e0('0xf1')]['belongsTo'](db[_0x87e0('0x12')],{'foreignKey':_0x87e0('0x1dd'),'as':'FromAgent'});db[_0x87e0('0xf1')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'foreignKey':_0x87e0('0x1df'),'as':_0x87e0('0x1e6')});db[_0x87e0('0xf1')][_0x87e0('0x122')](db['FaxQueue'],{'foreignKey':_0x87e0('0x1e9'),'as':_0x87e0('0x1e1')});db['FaxTransferReport'][_0x87e0('0x122')](db['FaxAccount'],{'foreignKey':_0x87e0('0x1ea'),'as':_0x87e0('0x1e3')});db['OpenchannelTransferReport'][_0x87e0('0x122')](db['OpenchannelMessage'],{});db[_0x87e0('0xf3')][_0x87e0('0x122')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x87e0('0x5e')],{'foreignKey':_0x87e0('0x1eb'),'as':'FromAccount'});db[_0x87e0('0xf3')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'foreignKey':_0x87e0('0x1dd'),'as':_0x87e0('0x1de')});db['OpenchannelTransferReport'][_0x87e0('0x122')](db[_0x87e0('0x12')],{'foreignKey':_0x87e0('0x1df'),'as':'ToAgent'});db[_0x87e0('0xf3')]['belongsTo'](db[_0x87e0('0x136')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x87e0('0xf3')]['belongsTo'](db[_0x87e0('0x5e')],{'foreignKey':_0x87e0('0x1ec'),'as':_0x87e0('0x1e3')});db['SmsTransferReport'][_0x87e0('0x122')](db[_0x87e0('0x183')],{});db[_0x87e0('0x1ed')][_0x87e0('0x122')](db['SmsInteraction'],{});db[_0x87e0('0x1ed')][_0x87e0('0x122')](db['SmsAccount'],{'foreignKey':_0x87e0('0x1ee'),'as':_0x87e0('0x1dc')});db[_0x87e0('0x1ed')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'foreignKey':_0x87e0('0x1dd'),'as':_0x87e0('0x1de')});db[_0x87e0('0x1ed')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'foreignKey':_0x87e0('0x1df'),'as':_0x87e0('0x1e6')});db[_0x87e0('0x1ed')][_0x87e0('0x122')](db[_0x87e0('0x5d')],{'foreignKey':_0x87e0('0x1ef'),'as':'ToQueue'});db['SmsTransferReport'][_0x87e0('0x122')](db[_0x87e0('0x56')],{'foreignKey':_0x87e0('0x1f0'),'as':'ToAccount'});db[_0x87e0('0xf6')][_0x87e0('0x115')](db[_0x87e0('0x83')],{'as':_0x87e0('0x161'),'foreignKey':_0x87e0('0x166'),'onDelete':_0x87e0('0x111')});db['CmList']['hasMany'](db['CmCustomField'],{'as':_0x87e0('0x1f1'),'foreignKey':_0x87e0('0x166')});db[_0x87e0('0xf6')]['hasMany'](db[_0x87e0('0x126')],{'as':'Contacts','onDelete':_0x87e0('0x111'),'foreignKey':'ListId'});db[_0x87e0('0xf6')][_0x87e0('0x115')](db[_0x87e0('0x77')],{'as':_0x87e0('0x14a'),'foreignKey':_0x87e0('0x166')});db[_0x87e0('0xf6')]['hasMany'](db[_0x87e0('0x79')],{'as':_0x87e0('0x119'),'foreignKey':_0x87e0('0x166')});db[_0x87e0('0xf6')][_0x87e0('0x115')](db[_0x87e0('0x11a')],{'as':_0x87e0('0x11a'),'foreignKey':_0x87e0('0x166')});db[_0x87e0('0xf6')]['belongsToMany'](db[_0x87e0('0x1c')],{'as':_0x87e0('0x1f2'),'through':_0x87e0('0x153')});db[_0x87e0('0xf6')]['belongsToMany'](db['User'],{'as':_0x87e0('0x154'),'through':_0x87e0('0x12a')});db[_0x87e0('0x1f3')][_0x87e0('0x115')](db[_0x87e0('0x18')],{'as':_0x87e0('0x118'),'onDelete':'cascade'});db[_0x87e0('0x1f3')][_0x87e0('0x124')](db['User'],{'as':_0x87e0('0x154'),'through':_0x87e0('0x131')});db[_0x87e0('0x1f3')][_0x87e0('0x124')](db[_0x87e0('0xe7')],{'through':_0x87e0('0x10d'),'as':_0x87e0('0x168')});db[_0x87e0('0x123')][_0x87e0('0x115')](db[_0x87e0('0x12')],{'as':'Users','foreignKey':_0x87e0('0x1f4')});db[_0x87e0('0x123')]['hasMany'](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x87e0('0x111')});db[_0x87e0('0xf9')][_0x87e0('0x115')](db[_0x87e0('0xfb')],{'as':_0x87e0('0x1f5'),'foreignKey':_0x87e0('0x1f6'),'onDelete':_0x87e0('0x111')});db[_0x87e0('0xfe')][_0x87e0('0x115')](db[_0x87e0('0x83')],{'as':_0x87e0('0x161'),'foreignKey':_0x87e0('0x1f7'),'onDelete':_0x87e0('0x111')});db['WhatsappAccount'][_0x87e0('0x115')](db[_0x87e0('0x162')],{'as':'Answers','foreignKey':_0x87e0('0x1f7')});db['WhatsappAccount'][_0x87e0('0x115')](db[_0x87e0('0x102')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x87e0('0xfe')][_0x87e0('0x115')](db['WhatsappInteraction'],{'as':_0x87e0('0x164')});db[_0x87e0('0xfe')][_0x87e0('0x115')](db[_0x87e0('0xff')],{'as':_0x87e0('0x145')});db['WhatsappAccount'][_0x87e0('0x122')](db[_0x87e0('0xf6')],{'as':_0x87e0('0x179'),'foreignKey':_0x87e0('0x166')});db['WhatsappAccount'][_0x87e0('0x122')](db[_0x87e0('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x87e0('0x152')});db[_0x87e0('0xfe')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':_0x87e0('0x1f8')});db[_0x87e0('0xff')]['belongsTo'](db['User'],{'onDelete':_0x87e0('0x15f')});db[_0x87e0('0xff')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x87e0('0x15f')});db[_0x87e0('0xff')][_0x87e0('0x122')](db[_0x87e0('0xfe')],{'onDelete':'restrict'});db[_0x87e0('0xff')]['belongsTo'](db[_0x87e0('0x150')],{'onDelete':'restrict','foreignKey':_0x87e0('0x151')});db[_0x87e0('0xff')][_0x87e0('0x122')](db['Tag'],{'onDelete':_0x87e0('0x15f'),'foreignKey':_0x87e0('0x17b')});db['WhatsappInteraction'][_0x87e0('0x115')](db[_0x87e0('0x102')],{'as':_0x87e0('0x156'),'onDelete':'cascade','foreignKey':_0x87e0('0x1f9')});db[_0x87e0('0x100')][_0x87e0('0x122')](db['WhatsappAccount'],{'as':_0x87e0('0x16a'),'foreignKey':_0x87e0('0x1f7')});db['WhatsappInteraction'][_0x87e0('0x122')](db['CmContact'],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x100')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':'Owner','foreignKey':_0x87e0('0x112')});db['WhatsappInteraction'][_0x87e0('0x124')](db[_0x87e0('0x92')],{'through':_0x87e0('0x1fa'),'as':'Tags'});db['WhatsappInteraction'][_0x87e0('0x124')](db['Tag'],{'through':_0x87e0('0x1fa'),'as':_0x87e0('0x16e')});db[_0x87e0('0x100')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x16f'),'through':_0x87e0('0x12e'),'foreignKey':_0x87e0('0x1f9')});db[_0x87e0('0x102')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'as':_0x87e0('0x12')});db[_0x87e0('0x102')][_0x87e0('0x122')](db['CmContact'],{'onDelete':'cascade','as':_0x87e0('0x16b')});db[_0x87e0('0x102')][_0x87e0('0x122')](db[_0x87e0('0x100')],{'onDelete':_0x87e0('0x111'),'as':'Interaction','foreignKey':_0x87e0('0x1f9')});db[_0x87e0('0x102')][_0x87e0('0x122')](db[_0x87e0('0xfe')],{'as':'Account','foreignKey':_0x87e0('0x1f7')});db[_0x87e0('0x104')][_0x87e0('0x122')](db[_0x87e0('0xfe')],{});db[_0x87e0('0x104')]['belongsTo'](db[_0x87e0('0xf6')],{'as':_0x87e0('0x179'),'foreignKey':_0x87e0('0x166')});db[_0x87e0('0x104')][_0x87e0('0x122')](db[_0x87e0('0x126')],{'as':_0x87e0('0x16b'),'foreignKey':_0x87e0('0x17d')});db[_0x87e0('0x104')][_0x87e0('0x122')](db[_0x87e0('0x100')],{});db[_0x87e0('0x104')]['belongsTo'](db[_0x87e0('0x108')],{});db[_0x87e0('0x104')][_0x87e0('0x122')](db[_0x87e0('0x102')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x87e0('0x12')],{});db[_0x87e0('0x106')][_0x87e0('0x122')](db[_0x87e0('0x102')],{});db['WhatsappTransferReport'][_0x87e0('0x122')](db['WhatsappInteraction'],{});db[_0x87e0('0x106')]['belongsTo'](db[_0x87e0('0xfe')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x87e0('0x106')][_0x87e0('0x122')](db[_0x87e0('0xfe')],{'foreignKey':'ToWhatsappAccountId','as':_0x87e0('0x1e3')});db[_0x87e0('0x106')][_0x87e0('0x122')](db[_0x87e0('0x108')],{'foreignKey':_0x87e0('0x1fb'),'as':_0x87e0('0x1e1')});db[_0x87e0('0x106')][_0x87e0('0x122')](db['User'],{'foreignKey':_0x87e0('0x1dd'),'as':_0x87e0('0x1de')});db[_0x87e0('0x106')][_0x87e0('0x122')](db[_0x87e0('0x12')],{'foreignKey':_0x87e0('0x1df'),'as':_0x87e0('0x1e6')});db[_0x87e0('0x108')][_0x87e0('0x124')](db[_0x87e0('0x12')],{'as':_0x87e0('0x154'),'through':_0x87e0('0x39'),'foreignKey':'WhatsappQueueId'});db[_0x87e0('0x108')][_0x87e0('0x124')](db['Team'],{'through':_0x87e0('0x1d7'),'as':'Teams'});db[_0x87e0('0x10f')][_0x87e0('0x122')](db['User'],{'as':'user','foreignKey':_0x87e0('0x112'),'onDelete':_0x87e0('0x111'),'hooks':!![]});db[_0x87e0('0x15d')]['hasOne'](db[_0x87e0('0xca')],{'as':'Dynamics365Account','onDelete':_0x87e0('0x15f')});db[_0x87e0('0x15d')][_0x87e0('0x113')](db['MailServerIn'],{'as':_0x87e0('0x160'),'onDelete':'restrict'});db[_0x87e0('0x15d')][_0x87e0('0x113')](db['MailServerOut'],{'as':_0x87e0('0x1fc'),'onDelete':_0x87e0('0x15f')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa63d=['../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../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','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','belongsToMany','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','Team','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','UserMailQueue','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','Members','VoiceQueueId','Hoppers','CmHopperHistory','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','restrict','CloudProviderId','MailServerIn','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','MailInteractionId','mail_interaction_has_tags','Tags','Users','Attachment','Attachments','Interaction','Account','ChatWebsiteId','TagId','Items','FaxAccountId','Exntensions','FaxApplication','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','ThroughTags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatMessage','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','CmCompany','CompanyId','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','CampaignId','Condition','All','AutomationAllId','Automation','Any','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','AnalyticDefaultReport','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','FromId','ToId','SessionId','JscriptyProject','ProjectId','team_has_mail_queues','MailQueues','team_has_chat_queues','team_has_fax_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','TeamVoicePrefix','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','Imap','../config/environment','sequelize','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','sequelizeHistory','utf8mb4','utf8_general_ci','database','username','password','options','User','../api/user/user.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model'];(function(_0x21e008,_0x2eebfc){var _0x406bd3=function(_0x81485a){while(--_0x81485a){_0x21e008['push'](_0x21e008['shift']());}};_0x406bd3(++_0x2eebfc);}(_0xa63d,0x1ad));var _0xda63=function(_0xa1e975,_0x1dbc0e){_0xa1e975=_0xa1e975-0x0;var _0x2a99ef=_0xa63d[_0xa1e975];return _0x2a99ef;};'use strict';var config=require(_0xda63('0x0'));var Sequelize=require(_0xda63('0x1'));var _=require('lodash');var jstz=require(_0xda63('0x2'));var timezone=jstz['determine']();config[_0xda63('0x1')]=_[_0xda63('0x3')](config[_0xda63('0x1')],{'database':_0xda63('0x4'),'username':_0xda63('0x5'),'password':_0xda63('0x6'),'options':{'host':_0xda63('0x7'),'port':0xcea,'dialect':_0xda63('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xda63('0x9')](),'define':{'charset':_0xda63('0xa'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0xda63('0xb')],{'database':'motion2','username':'xcall','password':_0xda63('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xda63('0x8'),'dialectOptions':{'charset':_0xda63('0xc')},'logging':![],'timezone':timezone[_0xda63('0x9')](),'define':{'charset':_0xda63('0xa'),'collate':_0xda63('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xda63('0x1')][_0xda63('0xe')],config[_0xda63('0x1')][_0xda63('0xf')],config[_0xda63('0x1')][_0xda63('0x10')],config[_0xda63('0x1')][_0xda63('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xda63('0xb')][_0xda63('0xe')],config[_0xda63('0xb')]['username'],config[_0xda63('0xb')]['password'],config[_0xda63('0xb')][_0xda63('0x11')])};db[_0xda63('0x12')]=db[_0xda63('0x1')]['import'](_0xda63('0x13'));db['VoiceChanSpy']=db[_0xda63('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0xda63('0x14')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x16'));db[_0xda63('0x17')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x18'));db[_0xda63('0x19')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x1a'));db['VoiceQueue']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x1b'));db['VoiceRecording']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x1c'));db[_0xda63('0x1d')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x1e'));db[_0xda63('0x1f')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x20'));db[_0xda63('0x21')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x22'));db[_0xda63('0x23')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x24'));db['VoiceDialReport']=db['sequelize']['import'](_0xda63('0x25'));db[_0xda63('0x26')]=db['sequelize'][_0xda63('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xda63('0x27')]=db[_0xda63('0x1')]['import'](_0xda63('0x28'));db[_0xda63('0x29')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x2a'));db[_0xda63('0x2b')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x2c'));db[_0xda63('0x2d')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x2e'));db[_0xda63('0x2f')]=db['sequelize']['import'](_0xda63('0x30'));db[_0xda63('0x31')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x32'));db[_0xda63('0x33')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x34'));db['UserMailQueue']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x35'));db[_0xda63('0x36')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x37'));db[_0xda63('0x38')]=db[_0xda63('0x1')]['import'](_0xda63('0x39'));db[_0xda63('0x3a')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x3b'));db[_0xda63('0x3c')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x3d'));db['MailServerIn']=db[_0xda63('0x1')][_0xda63('0x15')]('../api/mailServerIn/mailServerIn.model');db[_0xda63('0x3e')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x3f'));db[_0xda63('0x40')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x41'));db[_0xda63('0x42')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x43'));db['MailSubstatus']=db['sequelize'][_0xda63('0x15')](_0xda63('0x44'));db[_0xda63('0x45')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x46'));db[_0xda63('0x47')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x48'));db[_0xda63('0x49')]=db['sequelize']['import'](_0xda63('0x4a'));db[_0xda63('0x4b')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x4c'));db[_0xda63('0x4d')]=db[_0xda63('0x1')]['import'](_0xda63('0x4e'));db['DashboardItem']=db['sequelize'][_0xda63('0x15')](_0xda63('0x4f'));db[_0xda63('0x50')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x51'));db[_0xda63('0x52')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0xda63('0x53')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x54'));db['FaxQueue']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x55'));db['FaxQueueReport']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x56'));db[_0xda63('0x57')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x58'));db[_0xda63('0x59')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x5a'));db['SmsInteraction']=db[_0xda63('0x1')][_0xda63('0x15')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db['sequelize']['import'](_0xda63('0x5b'));db[_0xda63('0x5c')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x5d'));db[_0xda63('0x5e')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x5f'));db['OpenchannelInteraction']=db[_0xda63('0x1')]['import'](_0xda63('0x60'));db[_0xda63('0x61')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x62'));db[_0xda63('0x63')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x64'));db[_0xda63('0x65')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/chatWebsite/chatWebsite.model');db[_0xda63('0x66')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x67'));db[_0xda63('0x68')]=db[_0xda63('0x1')]['import']('../api/chatApplication/chatApplication.model');db[_0xda63('0x69')]=db['sequelize']['import']('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xda63('0x1')][_0xda63('0x15')]('../api/chatMessage/chatMessage.model');db[_0xda63('0x6a')]=db[_0xda63('0x1')]['import'](_0xda63('0x6b'));db[_0xda63('0x6c')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/chatQueue/chatQueue.model');db[_0xda63('0x6d')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x6e'));db[_0xda63('0x6f')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db['sequelize']['import'](_0xda63('0x70'));db[_0xda63('0x71')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x72'));db[_0xda63('0x73')]=db['sequelize']['import'](_0xda63('0x74'));db[_0xda63('0x75')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x76'));db[_0xda63('0x77')]=db[_0xda63('0x1')]['import'](_0xda63('0x78'));db['CmHopperHistory']=db[_0xda63('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xda63('0x79')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x7a'));db[_0xda63('0x7b')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x7c'));db[_0xda63('0x7d')]=db[_0xda63('0x1')]['import']('../api/action/action.model');db['Automation']=db[_0xda63('0x1')][_0xda63('0x15')]('../api/automation/automation.model');db[_0xda63('0x7e')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x7f'));db[_0xda63('0x80')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/disposition/disposition.model');db['Condition']=db[_0xda63('0x1')]['import'](_0xda63('0x81'));db[_0xda63('0x82')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x83'));db['Pause']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x84'));db['Cdr']=db[_0xda63('0x1')]['import'](_0xda63('0x85'));db[_0xda63('0x86')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x87'));db[_0xda63('0x88')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x89'));db['Sound']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x8a'));db[_0xda63('0x8b')]=db['sequelize'][_0xda63('0x15')]('../api/tag/tag.model');db[_0xda63('0x8c')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x8d'));db[_0xda63('0x8e')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x8f'));db[_0xda63('0x90')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x91'));db[_0xda63('0x92')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x93'));db['Trigger']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x94'));db[_0xda63('0x95')]=db['sequelize']['import'](_0xda63('0x96'));db[_0xda63('0x97')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x98'));db[_0xda63('0x99')]=db['sequelize'][_0xda63('0x15')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db['sequelize']['import']('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xda63('0x1')][_0xda63('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xda63('0x9a')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x9b'));db[_0xda63('0x9c')]=db[_0xda63('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db[_0xda63('0x9d')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x9e'));db[_0xda63('0x9f')]=db['sequelize'][_0xda63('0x15')](_0xda63('0xa0'));db['SalesforceAccount']=db[_0xda63('0x1')]['import'](_0xda63('0xa1'));db[_0xda63('0xa2')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xa3'));db[_0xda63('0xa4')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xa5'));db[_0xda63('0xa6')]=db['sequelize'][_0xda63('0x15')](_0xda63('0xa7'));db[_0xda63('0xa8')]=db[_0xda63('0x1')]['import'](_0xda63('0xa9'));db[_0xda63('0xaa')]=db[_0xda63('0x1')]['import'](_0xda63('0xab'));db[_0xda63('0xac')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xad'));db['DeskConfiguration']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xae'));db[_0xda63('0xaf')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xb0'));db[_0xda63('0xb1')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/intZohoAccount/intZohoAccount.model');db[_0xda63('0xb2')]=db[_0xda63('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0xda63('0x1')][_0xda63('0x15')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xda63('0xb3')]=db[_0xda63('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xda63('0xb4')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xb5'));db[_0xda63('0xb6')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xda63('0xb7')]=db[_0xda63('0x1')]['import'](_0xda63('0xb8'));db[_0xda63('0xb9')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xba'));db[_0xda63('0xbb')]=db[_0xda63('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xbc'));db[_0xda63('0xbd')]=db['sequelize'][_0xda63('0x15')](_0xda63('0xbe'));db['ServicenowAccount']=db['sequelize'][_0xda63('0x15')](_0xda63('0xbf'));db[_0xda63('0xc0')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xda63('0xc1')]=db[_0xda63('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0xda63('0xc2')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xc3'));db[_0xda63('0xc4')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xc5'));db[_0xda63('0xc6')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xc7'));db[_0xda63('0xc8')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xda63('0xc9')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xca'));db[_0xda63('0xcb')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xcc'));db['Integration']=db[_0xda63('0x1')][_0xda63('0x15')]('../api/integration/integration.model');db[_0xda63('0xcd')]=db['sequelize'][_0xda63('0x15')](_0xda63('0xce'));db[_0xda63('0xcf')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xd0'));db[_0xda63('0xd1')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xd2'));db[_0xda63('0xd3')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xd4'));db[_0xda63('0xd5')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xd6'));db[_0xda63('0xd7')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xd8'));db[_0xda63('0xd9')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xda'));db[_0xda63('0xdb')]=db[_0xda63('0x1')]['import']('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xda63('0x1')]['import'](_0xda63('0xdc'));db['JscriptyProject']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xdd'));db[_0xda63('0xde')]=db['sequelize'][_0xda63('0x15')](_0xda63('0xdf'));db[_0xda63('0xe0')]=db['sequelize']['import'](_0xda63('0xe1'));db[_0xda63('0xe2')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/squareProject/squareProject.model');db[_0xda63('0xe3')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xe4'));db[_0xda63('0xe5')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xe6'));db['Team']=db[_0xda63('0x1')][_0xda63('0x15')]('../api/team/team.model');db[_0xda63('0xe7')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/license/license.model');db[_0xda63('0xe8')]=db[_0xda63('0x1')]['import'](_0xda63('0xe9'));db[_0xda63('0xea')]=db['sequelize'][_0xda63('0x15')](_0xda63('0xeb'));db['Attachment']=db['sequelize'][_0xda63('0x15')](_0xda63('0xec'));db[_0xda63('0xed')]=db['sequelize']['import'](_0xda63('0xee'));db[_0xda63('0xef')]=db[_0xda63('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0xda63('0xf0')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xf1'));db[_0xda63('0xf2')]=db[_0xda63('0x1')]['import'](_0xda63('0xf3'));db[_0xda63('0xf4')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xf5'));db['CmList']=db[_0xda63('0x1')]['import']('../api/cmList/cmList.model');db[_0xda63('0xf6')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/voicePrefix/voicePrefix.model');db[_0xda63('0xf7')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xf8'));db[_0xda63('0xf9')]=db['sequelize'][_0xda63('0x15')]('../api/userProfileSection/userProfileSection.model');db[_0xda63('0xfa')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xfb'));db[_0xda63('0xfc')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0xfd'));db[_0xda63('0xfe')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0xda63('0xff')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x100'));db[_0xda63('0x101')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x102'));db[_0xda63('0x103')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x104'));db[_0xda63('0x105')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize'][_0xda63('0x15')](_0xda63('0x106'));db[_0xda63('0x107')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x108'));db[_0xda63('0x109')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/cloudProvider/cloudProvider.model');db[_0xda63('0x10a')]=db[_0xda63('0x1')][_0xda63('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db['sequelize']['import'](_0xda63('0x10b'));db[_0xda63('0x10c')]=db[_0xda63('0x1')][_0xda63('0x15')](_0xda63('0x10d'));db[_0xda63('0x10e')]=db['sequelize'][_0xda63('0x15')](_0xda63('0x10f'));db['User'][_0xda63('0x110')](db[_0xda63('0x1f')],{'as':_0xda63('0x1f'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')][_0xda63('0x110')](db[_0xda63('0x10e')],{'as':_0xda63('0x113'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')][_0xda63('0x114')](db['VoiceRecording'],{'as':_0xda63('0x115'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')]['hasMany'](db[_0xda63('0x2f')],{'as':'VoiceQueuesRt','foreignKey':_0xda63('0x112')});db[_0xda63('0x12')]['hasMany'](db[_0xda63('0x17')],{'as':_0xda63('0x116'),'onDelete':_0xda63('0x111'),'hooks':!![]});db[_0xda63('0x12')][_0xda63('0x114')](db[_0xda63('0x77')],{'as':_0xda63('0x117'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')][_0xda63('0x114')](db['CmHopperHistory'],{'as':_0xda63('0x118'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')][_0xda63('0x114')](db[_0xda63('0x79')],{'as':_0xda63('0x79'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')][_0xda63('0x114')](db[_0xda63('0x119')],{'as':_0xda63('0x11a'),'foreignKey':'UserId'});db[_0xda63('0x12')]['hasMany'](db[_0xda63('0x69')],{'as':_0xda63('0x11b'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')][_0xda63('0x114')](db['SmsInteraction'],{'as':_0xda63('0x11c'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')][_0xda63('0x114')](db[_0xda63('0x52')],{'as':_0xda63('0x11d'),'foreignKey':'UserId'});db[_0xda63('0x12')][_0xda63('0x114')](db[_0xda63('0x45')],{'as':_0xda63('0x11e'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')][_0xda63('0x114')](db[_0xda63('0x101')],{'as':_0xda63('0x11f'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12')][_0xda63('0x114')](db[_0xda63('0xfc')],{'as':_0xda63('0x120'),'foreignKey':_0xda63('0x121')});db[_0xda63('0x12')][_0xda63('0x122')](db[_0xda63('0xf7')],{'as':_0xda63('0xf7'),'foreignKey':_0xda63('0x123')});db[_0xda63('0x12')]['belongsToMany'](db[_0xda63('0x6d')],{'as':_0xda63('0x124'),'through':'chat_group_has_users'});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x71')],{'as':_0xda63('0x126'),'through':_0xda63('0x127')});db[_0xda63('0x12')]['belongsToMany'](db[_0xda63('0x128')],{'as':_0xda63('0x129'),'through':_0xda63('0x12a')});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x12b')],{'through':_0xda63('0x12c')});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x45')],{'as':_0xda63('0x11e'),'through':'user_has_mail_interactions'});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x69')],{'as':_0xda63('0x11b'),'through':_0xda63('0x12d')});db['User']['belongsToMany'](db[_0xda63('0x52')],{'as':_0xda63('0x11d'),'through':_0xda63('0x12e')});db['User'][_0xda63('0x125')](db[_0xda63('0x12f')],{'as':_0xda63('0x11c'),'through':_0xda63('0x130')});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x119')],{'as':_0xda63('0x11a'),'through':'user_has_openchannel_interactions'});db['User'][_0xda63('0x125')](db[_0xda63('0x101')],{'as':_0xda63('0x11f'),'through':_0xda63('0x131')});db[_0xda63('0x12')]['belongsToMany'](db[_0xda63('0x132')],{'as':_0xda63('0x133'),'through':_0xda63('0x31'),'required':![]});db[_0xda63('0x12')][_0xda63('0x125')](db['VoicePrefix'],{'as':_0xda63('0x134'),'through':_0xda63('0x10c'),'required':![]});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x42')],{'as':'MailQueues','through':_0xda63('0x135'),'required':![]});db['User']['belongsToMany'](db['ChatQueue'],{'as':_0xda63('0x136'),'through':_0xda63('0x33'),'required':![],'hooks':!![]});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x137')],{'as':_0xda63('0x138'),'through':_0xda63('0x36'),'required':![]});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x5c')],{'as':_0xda63('0x139'),'through':_0xda63('0x38'),'required':![]});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x63')],{'as':_0xda63('0x13a'),'through':_0xda63('0x3a'),'required':![]});db[_0xda63('0x12')][_0xda63('0x125')](db['WhatsappQueue'],{'as':_0xda63('0x13b'),'through':_0xda63('0x3c'),'required':![]});db['User']['belongsToMany'](db[_0xda63('0x128')],{'through':'cm_user_has_lists'});db['User'][_0xda63('0x125')](db['ChatWebsite'],{'as':_0xda63('0x13c'),'through':_0xda63('0x13d')});db[_0xda63('0x12')]['belongsToMany'](db[_0xda63('0x50')],{'as':_0xda63('0x13e'),'through':_0xda63('0x13f')});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x40')],{'as':'MailAccounts','through':_0xda63('0x140')});db['User'][_0xda63('0x125')](db[_0xda63('0x141')],{'as':_0xda63('0x142'),'through':'user_has_openchannel_accounts'});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0x57')],{'as':_0xda63('0x143'),'through':_0xda63('0x144')});db[_0xda63('0x12')][_0xda63('0x125')](db[_0xda63('0xfe')],{'as':'WhatsappAccounts','through':_0xda63('0x145')});db['VoiceChanSpy'][_0xda63('0x114')](db[_0xda63('0x17')],{'as':_0xda63('0x146'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x147')});db[_0xda63('0x14')][_0xda63('0x114')](db['VoiceExtension'],{'onDelete':_0xda63('0x111')});db['VoiceExtension'][_0xda63('0x114')](db[_0xda63('0x17')],{'as':_0xda63('0x148'),'onDelete':_0xda63('0x111')});db[_0xda63('0x19')][_0xda63('0x125')](db[_0xda63('0x149')],{'as':_0xda63('0x14a'),'through':'moh_has_sounds'});db[_0xda63('0x132')][_0xda63('0x114')](db[_0xda63('0x2f')],{'as':_0xda63('0x14b'),'foreignKey':_0xda63('0x14c')});db[_0xda63('0x132')][_0xda63('0x114')](db[_0xda63('0x73')],{'as':_0xda63('0x14d'),'foreignKey':_0xda63('0x14c')});db[_0xda63('0x132')][_0xda63('0x114')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0xda63('0x132')][_0xda63('0x114')](db[_0xda63('0x14e')],{'as':'HopperHistories','foreignKey':_0xda63('0x14c')});db['VoiceQueue']['hasMany'](db[_0xda63('0x79')],{'as':_0xda63('0x79'),'foreignKey':_0xda63('0x14c')});db[_0xda63('0x132')][_0xda63('0x114')](db[_0xda63('0x75')],{'as':_0xda63('0x14f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xda63('0xd7')],{'as':'JscriptySessions','foreignKey':_0xda63('0x14c')});db[_0xda63('0x132')][_0xda63('0x122')](db[_0xda63('0x2b')],{'as':_0xda63('0x2b'),'foreignKey':_0xda63('0x150')});db[_0xda63('0x132')][_0xda63('0x122')](db[_0xda63('0x2b')],{'as':_0xda63('0x151'),'foreignKey':_0xda63('0x152')});db['VoiceQueue']['belongsTo'](db[_0xda63('0x82')],{'as':_0xda63('0x82'),'foreignKey':_0xda63('0x153')});db['VoiceQueue']['belongsTo'](db[_0xda63('0x154')],{'as':_0xda63('0x155'),'foreignKey':_0xda63('0x156')});db[_0xda63('0x132')][_0xda63('0x125')](db[_0xda63('0x128')],{'as':_0xda63('0x129'),'through':_0xda63('0x157')});db[_0xda63('0x132')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':'UserVoiceQueue'});db[_0xda63('0x132')][_0xda63('0x125')](db['Team'],{'as':_0xda63('0x159'),'through':'TeamVoiceQueue'});db[_0xda63('0x132')]['belongsToMany'](db['CmList'],{'as':_0xda63('0x15a'),'through':_0xda63('0x15b')});db[_0xda63('0x15c')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':_0xda63('0x12'),'foreignKey':_0xda63('0x112')});db['ScreenRecording'][_0xda63('0x122')](db[_0xda63('0x12')],{'as':'User','foreignKey':_0xda63('0x112')});db[_0xda63('0x1f')][_0xda63('0x114')](db[_0xda63('0x21')],{'as':_0xda63('0x15d'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x15e'),'sourceKey':_0xda63('0x15f')});db[_0xda63('0x21')][_0xda63('0x122')](db['VoiceMail'],{'foreignKey':_0xda63('0x15e'),'targetKey':'mailbox'});db[_0xda63('0x23')]['hasMany'](db[_0xda63('0x27')],{'as':_0xda63('0x160'),'foreignKey':_0xda63('0x161'),'constraints':![]});db[_0xda63('0x23')]['hasMany'](db['VoiceAgentReport'],{'as':_0xda63('0x162'),'foreignKey':_0xda63('0x161'),'constraints':![]});db[_0xda63('0x23')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':_0xda63('0x12'),'foreignKey':_0xda63('0x112')});db['VoiceCallReport']['belongsTo'](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164')});db['MailServerIn']['belongsTo'](db[_0xda63('0x40')],{'as':_0xda63('0x40'),'foreignKey':_0xda63('0x165')});db['MailServerIn'][_0xda63('0x122')](db[_0xda63('0x109')],{'as':_0xda63('0x109'),'foreignKey':'CloudProviderId','onDelete':_0xda63('0x166')});db['MailServerOut'][_0xda63('0x122')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xda63('0x165')});db['MailServerOut'][_0xda63('0x122')](db[_0xda63('0x109')],{'as':_0xda63('0x109'),'foreignKey':_0xda63('0x167'),'onDelete':_0xda63('0x166')});db[_0xda63('0x40')][_0xda63('0x110')](db[_0xda63('0x168')],{'as':'Imap','onDelete':_0xda63('0x111')});db[_0xda63('0x40')]['hasOne'](db['MailServerOut'],{'as':_0xda63('0x169'),'onDelete':_0xda63('0x111')});db[_0xda63('0x40')][_0xda63('0x114')](db['Disposition'],{'as':_0xda63('0x16a'),'foreignKey':'MailAccountId','onDelete':_0xda63('0x111')});db[_0xda63('0x40')][_0xda63('0x114')](db[_0xda63('0x7e')],{'as':_0xda63('0x16b'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xda63('0x114')](db[_0xda63('0x47')],{'as':_0xda63('0x15d'),'foreignKey':_0xda63('0x165')});db[_0xda63('0x40')]['hasMany'](db['MailInteraction'],{'as':_0xda63('0x16c')});db['MailAccount']['hasMany'](db['MailApplication'],{'as':_0xda63('0x148')});db['MailAccount'][_0xda63('0x122')](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e')});db[_0xda63('0x40')][_0xda63('0x122')](db[_0xda63('0x92')],{'as':_0xda63('0x92'),'foreignKey':_0xda63('0x16f')});db[_0xda63('0x40')][_0xda63('0x122')](db[_0xda63('0x154')],{'as':_0xda63('0x155'),'foreignKey':_0xda63('0x156')});db[_0xda63('0x40')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x140')});db[_0xda63('0x42')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x135')});db[_0xda63('0x42')][_0xda63('0x125')](db[_0xda63('0x12b')],{'through':'team_has_mail_queues','as':_0xda63('0x159')});db[_0xda63('0x45')][_0xda63('0x114')](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xda63('0x170')});db['MailInteraction']['belongsTo'](db[_0xda63('0x40')],{'as':'Account','foreignKey':_0xda63('0x165')});db[_0xda63('0x45')][_0xda63('0x122')](db[_0xda63('0x71')],{'as':'Contact','foreignKey':_0xda63('0x164')});db[_0xda63('0x45')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction'][_0xda63('0x125')](db[_0xda63('0x8b')],{'through':_0xda63('0x171'),'as':_0xda63('0x172')});db['MailInteraction'][_0xda63('0x125')](db[_0xda63('0x8b')],{'through':_0xda63('0x171'),'as':'ThroughTags'});db[_0xda63('0x45')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x173'),'through':'user_has_mail_interactions','foreignKey':_0xda63('0x170')});db[_0xda63('0x47')][_0xda63('0x114')](db[_0xda63('0x174')],{'as':_0xda63('0x175'),'onDelete':_0xda63('0x111')});db[_0xda63('0x47')]['belongsTo'](db[_0xda63('0x12')],{'as':_0xda63('0x12')});db['MailMessage'][_0xda63('0x122')](db[_0xda63('0x71')],{'onDelete':'cascade','as':'Contact'});db['MailMessage'][_0xda63('0x122')](db[_0xda63('0x45')],{'as':_0xda63('0x176'),'foreignKey':'MailInteractionId'});db[_0xda63('0x47')]['belongsTo'](db[_0xda63('0x40')],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x165')});db['MailMessage'][_0xda63('0x122')](db[_0xda63('0x65')],{'as':_0xda63('0x65'),'foreignKey':_0xda63('0x178')});db[_0xda63('0x47')][_0xda63('0x122')](db[_0xda63('0x6a')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xda63('0x49')][_0xda63('0x122')](db[_0xda63('0x12')],{'onDelete':_0xda63('0x166')});db['MailApplication'][_0xda63('0x122')](db['MailQueue'],{'onDelete':_0xda63('0x166')});db[_0xda63('0x49')][_0xda63('0x122')](db[_0xda63('0x40')],{'onDelete':'restrict'});db['MailApplication'][_0xda63('0x122')](db[_0xda63('0x82')],{'onDelete':_0xda63('0x166'),'foreignKey':'IntervalId'});db[_0xda63('0x49')][_0xda63('0x122')](db[_0xda63('0x8b')],{'onDelete':_0xda63('0x166'),'foreignKey':_0xda63('0x179')});db[_0xda63('0x4b')][_0xda63('0x122')](db[_0xda63('0x40')],{});db[_0xda63('0x4b')][_0xda63('0x122')](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e')});db['MailQueueReport'][_0xda63('0x122')](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164')});db[_0xda63('0x4b')][_0xda63('0x122')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0xda63('0x47')],{});db[_0xda63('0x4b')][_0xda63('0x122')](db[_0xda63('0x12')],{});db['MailQueueReport'][_0xda63('0x122')](db[_0xda63('0x42')],{});db['Dashboard'][_0xda63('0x114')](db['DashboardItem'],{'as':_0xda63('0x17a'),'onDelete':_0xda63('0x111')});db[_0xda63('0x50')][_0xda63('0x114')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xda63('0x17b'),'onDelete':_0xda63('0x111')});db[_0xda63('0x50')]['hasMany'](db[_0xda63('0x7e')],{'as':_0xda63('0x16b'),'foreignKey':'FaxAccountId'});db[_0xda63('0x50')]['hasMany'](db[_0xda63('0x52')],{'as':_0xda63('0x16c')});db['FaxAccount'][_0xda63('0x114')](db['FaxApplication'],{'as':'Applications'});db['FaxAccount'][_0xda63('0x114')](db['VoiceExtension'],{'as':_0xda63('0x17c'),'onDelete':'cascade'});db[_0xda63('0x50')][_0xda63('0x114')](db[_0xda63('0x53')],{'as':_0xda63('0x15d')});db[_0xda63('0x50')][_0xda63('0x122')](db[_0xda63('0x2b')],{'as':_0xda63('0x2b')});db[_0xda63('0x50')][_0xda63('0x122')](db['CmList'],{'as':'List','foreignKey':_0xda63('0x16e')});db[_0xda63('0x50')][_0xda63('0x122')](db[_0xda63('0x154')],{'as':_0xda63('0x155'),'foreignKey':_0xda63('0x156')});db[_0xda63('0x50')]['belongsToMany'](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':'user_has_fax_accounts'});db[_0xda63('0x17d')][_0xda63('0x122')](db['User'],{'onDelete':_0xda63('0x166')});db[_0xda63('0x17d')]['belongsTo'](db[_0xda63('0x137')],{'onDelete':_0xda63('0x166')});db[_0xda63('0x17d')][_0xda63('0x122')](db['FaxAccount'],{'onDelete':_0xda63('0x166')});db[_0xda63('0x17d')][_0xda63('0x122')](db[_0xda63('0x8b')],{'onDelete':_0xda63('0x166'),'foreignKey':_0xda63('0x179')});db[_0xda63('0x52')][_0xda63('0x114')](db[_0xda63('0x53')],{'as':_0xda63('0x15d'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x17e')});db['FaxInteraction'][_0xda63('0x122')](db[_0xda63('0x50')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xda63('0x52')]['belongsTo'](db[_0xda63('0x71')],{'as':'Contact','foreignKey':_0xda63('0x164')});db[_0xda63('0x52')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':_0xda63('0x17f'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x52')][_0xda63('0x125')](db[_0xda63('0x8b')],{'through':_0xda63('0x180'),'as':_0xda63('0x172')});db[_0xda63('0x52')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xda63('0x52')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x173'),'through':_0xda63('0x12e'),'foreignKey':_0xda63('0x17e')});db[_0xda63('0x53')][_0xda63('0x122')](db['User'],{'onDelete':_0xda63('0x111'),'as':_0xda63('0x12')});db['FaxMessage']['belongsTo'](db['FaxInteraction'],{'as':_0xda63('0x176'),'foreignKey':_0xda63('0x17e')});db[_0xda63('0x53')][_0xda63('0x122')](db['CmContact'],{'onDelete':_0xda63('0x111'),'as':'Contact'});db[_0xda63('0x53')][_0xda63('0x122')](db[_0xda63('0x174')],{'as':_0xda63('0x174'),'foreignKey':_0xda63('0x181')});db['FaxMessage']['belongsTo'](db[_0xda63('0x50')],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x17b')});db['FaxQueue'][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x36')});db['FaxQueue'][_0xda63('0x125')](db[_0xda63('0x12b')],{'through':'team_has_fax_queues','as':_0xda63('0x159')});db['FaxQueueReport']['belongsTo'](db['FaxAccount'],{});db[_0xda63('0x182')][_0xda63('0x122')](db['CmList'],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e')});db[_0xda63('0x182')][_0xda63('0x122')](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164')});db[_0xda63('0x182')][_0xda63('0x122')](db[_0xda63('0x52')],{});db[_0xda63('0x182')][_0xda63('0x122')](db[_0xda63('0x53')],{});db[_0xda63('0x182')][_0xda63('0x122')](db[_0xda63('0x12')],{});db[_0xda63('0x182')][_0xda63('0x122')](db['FaxQueue'],{});db[_0xda63('0x57')][_0xda63('0x114')](db[_0xda63('0x80')],{'as':_0xda63('0x16a'),'foreignKey':'SmsAccountId','onDelete':_0xda63('0x111')});db[_0xda63('0x57')]['hasMany'](db[_0xda63('0x7e')],{'as':_0xda63('0x16b'),'foreignKey':_0xda63('0x183')});db[_0xda63('0x57')][_0xda63('0x114')](db[_0xda63('0x184')],{'as':_0xda63('0x15d'),'foreignKey':_0xda63('0x183')});db[_0xda63('0x57')]['hasMany'](db[_0xda63('0x12f')],{'as':_0xda63('0x16c')});db[_0xda63('0x57')][_0xda63('0x114')](db[_0xda63('0x59')],{'as':_0xda63('0x148')});db[_0xda63('0x57')]['belongsTo'](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e')});db['SmsAccount']['belongsTo'](db[_0xda63('0x154')],{'as':_0xda63('0x155'),'foreignKey':_0xda63('0x156')});db['SmsAccount']['belongsToMany'](db['User'],{'as':_0xda63('0x158'),'through':_0xda63('0x144')});db[_0xda63('0x59')][_0xda63('0x122')](db[_0xda63('0x12')],{'onDelete':_0xda63('0x166')});db['SmsApplication'][_0xda63('0x122')](db[_0xda63('0x5c')],{'onDelete':'restrict'});db[_0xda63('0x59')][_0xda63('0x122')](db['SmsAccount'],{'onDelete':_0xda63('0x166')});db[_0xda63('0x59')]['belongsTo'](db[_0xda63('0x82')],{'onDelete':_0xda63('0x166'),'foreignKey':_0xda63('0x153')});db[_0xda63('0x59')][_0xda63('0x122')](db[_0xda63('0x8b')],{'onDelete':_0xda63('0x166'),'foreignKey':_0xda63('0x179')});db['SmsInteraction'][_0xda63('0x114')](db[_0xda63('0x184')],{'as':'Messages','onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x185')});db[_0xda63('0x12f')][_0xda63('0x122')](db[_0xda63('0x57')],{'as':_0xda63('0x177'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0xda63('0x122')](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':'ContactId'});db[_0xda63('0x12f')]['belongsTo'](db['User'],{'as':_0xda63('0x17f'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x12f')][_0xda63('0x125')](db[_0xda63('0x8b')],{'through':_0xda63('0x186'),'as':_0xda63('0x172')});db['SmsInteraction']['belongsToMany'](db['Tag'],{'through':_0xda63('0x186'),'as':_0xda63('0x187')});db['SmsInteraction'][_0xda63('0x125')](db['User'],{'as':_0xda63('0x173'),'through':'user_has_sms_interactions','foreignKey':_0xda63('0x185')});db[_0xda63('0x184')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':_0xda63('0x12')});db[_0xda63('0x184')][_0xda63('0x122')](db[_0xda63('0x71')],{'onDelete':_0xda63('0x111'),'as':'Contact'});db[_0xda63('0x184')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0xda63('0x111'),'as':_0xda63('0x176'),'foreignKey':_0xda63('0x185')});db[_0xda63('0x184')]['belongsTo'](db[_0xda63('0x57')],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x183')});db[_0xda63('0x5c')][_0xda63('0x125')](db['User'],{'as':_0xda63('0x158'),'through':_0xda63('0x38'),'foreignKey':_0xda63('0x188')});db[_0xda63('0x5c')][_0xda63('0x125')](db[_0xda63('0x12b')],{'through':_0xda63('0x189'),'as':_0xda63('0x159')});db['OpenchannelAccount'][_0xda63('0x114')](db[_0xda63('0x80')],{'as':_0xda63('0x16a'),'foreignKey':_0xda63('0x18a'),'onDelete':_0xda63('0x111')});db[_0xda63('0x141')][_0xda63('0x114')](db['CannedAnswer'],{'as':_0xda63('0x16b'),'foreignKey':_0xda63('0x18a')});db[_0xda63('0x141')]['hasMany'](db[_0xda63('0x119')],{'as':_0xda63('0x16c'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xda63('0x114')](db[_0xda63('0x61')],{'as':'Messages','foreignKey':_0xda63('0x18a')});db[_0xda63('0x141')][_0xda63('0x114')](db[_0xda63('0x5e')],{'as':'Applications','foreignKey':_0xda63('0x18a')});db[_0xda63('0x141')][_0xda63('0x122')](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e')});db['OpenchannelAccount']['belongsTo'](db['Pause'],{'as':_0xda63('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xda63('0x141')]['belongsToMany'](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x18b')});db[_0xda63('0x5e')][_0xda63('0x122')](db['User'],{'onDelete':_0xda63('0x166')});db[_0xda63('0x5e')][_0xda63('0x122')](db[_0xda63('0x63')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0xda63('0x5e')]['belongsTo'](db[_0xda63('0x141')],{'onDelete':'restrict','foreignKey':_0xda63('0x18a')});db[_0xda63('0x5e')]['belongsTo'](db[_0xda63('0x82')],{'onDelete':_0xda63('0x166'),'foreignKey':'IntervalId'});db[_0xda63('0x5e')][_0xda63('0x122')](db['Tag'],{'onDelete':_0xda63('0x166'),'foreignKey':_0xda63('0x179')});db['OpenchannelInteraction']['hasMany'](db[_0xda63('0x61')],{'as':_0xda63('0x15d'),'onDelete':_0xda63('0x111'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0xda63('0x122')](db[_0xda63('0x141')],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x18a')});db[_0xda63('0x119')][_0xda63('0x122')](db[_0xda63('0x71')],{'as':'Contact','foreignKey':_0xda63('0x164')});db[_0xda63('0x119')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':_0xda63('0x17f'),'foreignKey':'UserId'});db[_0xda63('0x119')][_0xda63('0x125')](db[_0xda63('0x8b')],{'through':_0xda63('0x18c'),'as':_0xda63('0x172')});db[_0xda63('0x119')][_0xda63('0x125')](db['Tag'],{'through':_0xda63('0x18c'),'as':'ThroughTags'});db[_0xda63('0x119')][_0xda63('0x125')](db['User'],{'as':'Users','through':_0xda63('0x18d'),'foreignKey':_0xda63('0x18e')});db[_0xda63('0x61')][_0xda63('0x122')](db[_0xda63('0x12')],{'onDelete':'cascade','as':_0xda63('0x12')});db['OpenchannelMessage'][_0xda63('0x122')](db[_0xda63('0x71')],{'onDelete':_0xda63('0x111'),'as':'Contact'});db[_0xda63('0x61')][_0xda63('0x122')](db[_0xda63('0x119')],{'onDelete':_0xda63('0x111'),'as':_0xda63('0x176'),'foreignKey':'OpenchannelInteractionId'});db[_0xda63('0x61')][_0xda63('0x122')](db[_0xda63('0x174')],{'as':_0xda63('0x174'),'foreignKey':_0xda63('0x181')});db[_0xda63('0x61')]['belongsTo'](db[_0xda63('0x141')],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x18a')});db['OpenchannelQueue'][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x3a'),'foreignKey':_0xda63('0x18f')});db[_0xda63('0x63')]['belongsToMany'](db[_0xda63('0x12b')],{'through':_0xda63('0x190'),'as':_0xda63('0x159')});db[_0xda63('0x65')][_0xda63('0x114')](db[_0xda63('0x80')],{'as':_0xda63('0x16a'),'foreignKey':_0xda63('0x178'),'onDelete':_0xda63('0x111')});db['ChatWebsite'][_0xda63('0x114')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xda63('0x114')](db['ChatProactiveAction'],{'as':_0xda63('0x191')});db['ChatWebsite'][_0xda63('0x114')](db[_0xda63('0x69')],{'as':'Interactions'});db[_0xda63('0x65')][_0xda63('0x114')](db['ChatApplication'],{'as':_0xda63('0x148')});db[_0xda63('0x65')]['hasMany'](db[_0xda63('0x192')],{'as':_0xda63('0x15d')});db['ChatWebsite'][_0xda63('0x122')](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e')});db[_0xda63('0x65')][_0xda63('0x122')](db[_0xda63('0x82')],{'as':_0xda63('0x82'),'foreignKey':_0xda63('0x153')});db[_0xda63('0x65')]['belongsTo'](db[_0xda63('0x40')],{'as':_0xda63('0x40'),'foreignKey':_0xda63('0x165')});db['ChatWebsite'][_0xda63('0x122')](db[_0xda63('0x154')],{'as':_0xda63('0x155'),'foreignKey':_0xda63('0x156')});db[_0xda63('0x65')]['belongsToMany'](db[_0xda63('0x12')],{'as':'Agents','through':_0xda63('0x13d')});db[_0xda63('0x66')]['belongsTo'](db['OpenchannelAccount'],{});db[_0xda63('0x66')][_0xda63('0x122')](db['CmList'],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e')});db['OpenchannelQueueReport']['belongsTo'](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164')});db[_0xda63('0x66')][_0xda63('0x122')](db['OpenchannelInteraction'],{});db[_0xda63('0x66')]['belongsTo'](db[_0xda63('0x61')],{});db[_0xda63('0x66')][_0xda63('0x122')](db[_0xda63('0x12')],{});db['OpenchannelQueueReport'][_0xda63('0x122')](db[_0xda63('0x63')],{});db[_0xda63('0x68')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':'Agent','foreignKey':_0xda63('0x112'),'onDelete':_0xda63('0x166')});db['ChatApplication'][_0xda63('0x122')](db[_0xda63('0x6c')],{'as':_0xda63('0x193'),'foreignKey':_0xda63('0x194'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xda63('0x65')],{'as':_0xda63('0x195'),'foreignKey':_0xda63('0x178'),'onDelete':'restrict'});db['ChatApplication'][_0xda63('0x122')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xda63('0x69')][_0xda63('0x114')](db[_0xda63('0x192')],{'as':_0xda63('0x15d'),'onDelete':'cascade','foreignKey':_0xda63('0x196')});db[_0xda63('0x69')][_0xda63('0x122')](db[_0xda63('0x65')],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x178')});db[_0xda63('0x69')][_0xda63('0x122')](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164')});db['ChatInteraction'][_0xda63('0x122')](db[_0xda63('0x12')],{'as':_0xda63('0x17f'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x69')][_0xda63('0x125')](db[_0xda63('0x8b')],{'through':'chat_interaction_has_tags','as':_0xda63('0x172')});db[_0xda63('0x69')][_0xda63('0x125')](db[_0xda63('0x8b')],{'through':_0xda63('0x197'),'as':_0xda63('0x187')});db['ChatInteraction']['belongsToMany'](db['User'],{'as':_0xda63('0x173'),'through':_0xda63('0x12d'),'foreignKey':_0xda63('0x196')});db[_0xda63('0x192')][_0xda63('0x122')](db[_0xda63('0x12')],{'onDelete':_0xda63('0x111'),'as':_0xda63('0x12')});db[_0xda63('0x192')][_0xda63('0x122')](db[_0xda63('0x71')],{'onDelete':_0xda63('0x111'),'as':_0xda63('0x163'),'foreignKey':'ContactId'});db[_0xda63('0x192')][_0xda63('0x122')](db[_0xda63('0x69')],{'onDelete':_0xda63('0x111'),'as':_0xda63('0x176'),'foreignKey':_0xda63('0x196')});db[_0xda63('0x192')][_0xda63('0x122')](db[_0xda63('0x174')],{'as':_0xda63('0x174'),'foreignKey':'AttachmentId'});db[_0xda63('0x192')][_0xda63('0x122')](db[_0xda63('0x65')],{'as':_0xda63('0x177'),'foreignKey':'ChatWebsiteId'});db[_0xda63('0x6a')][_0xda63('0x114')](db[_0xda63('0x174')],{'as':_0xda63('0x175'),'foreignKey':_0xda63('0x198'),'onDelete':'cascade','hooks':!![]});db[_0xda63('0x6a')][_0xda63('0x122')](db['CmContact'],{'onDelete':_0xda63('0x111'),'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164')});db[_0xda63('0x6a')][_0xda63('0x122')](db[_0xda63('0x65')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xda63('0x6c')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x33'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0xda63('0x12b')],{'through':'team_has_chat_queues','as':_0xda63('0x159')});db[_0xda63('0x6d')][_0xda63('0x114')](db[_0xda63('0xd1')],{'as':_0xda63('0x15d'),'foreignKey':'ChatGroupId','onDelete':_0xda63('0x111')});db['ChatGroup'][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x14b'),'through':'chat_group_has_users'});db[_0xda63('0x6f')][_0xda63('0x122')](db[_0xda63('0x65')],{'as':'Website','foreignKey':_0xda63('0x178')});db[_0xda63('0x199')][_0xda63('0x114')](db[_0xda63('0x71')],{'as':_0xda63('0x126'),'foreignKey':_0xda63('0x19a')});db[_0xda63('0x71')][_0xda63('0x114')](db[_0xda63('0x8e')],{'as':'Phones','foreignKey':_0xda63('0x19b')});db[_0xda63('0x71')]['hasMany'](db[_0xda63('0x73')],{'as':_0xda63('0x14d'),'foreignKey':_0xda63('0x164')});db['CmContact']['hasMany'](db[_0xda63('0x77')],{'as':_0xda63('0x117'),'foreignKey':_0xda63('0x164')});db['CmContact'][_0xda63('0x114')](db[_0xda63('0x14e')],{'as':'HopperHistories','foreignKey':_0xda63('0x164')});db['CmContact'][_0xda63('0x114')](db[_0xda63('0x79')],{'as':_0xda63('0x79'),'foreignKey':_0xda63('0x164')});db[_0xda63('0x71')][_0xda63('0x114')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xda63('0x164')});db[_0xda63('0x71')][_0xda63('0x114')](db[_0xda63('0x119')],{'as':_0xda63('0x11a'),'foreignKey':'ContactId','onDelete':_0xda63('0x166')});db[_0xda63('0x71')][_0xda63('0x114')](db['ChatInteraction'],{'as':_0xda63('0x11b'),'foreignKey':_0xda63('0x164'),'onDelete':'restrict'});db[_0xda63('0x71')][_0xda63('0x114')](db['SmsInteraction'],{'as':_0xda63('0x11c'),'foreignKey':_0xda63('0x164'),'onDelete':'restrict'});db[_0xda63('0x71')]['hasMany'](db[_0xda63('0x52')],{'as':_0xda63('0x11d'),'foreignKey':_0xda63('0x164'),'onDelete':_0xda63('0x166')});db['CmContact'][_0xda63('0x114')](db[_0xda63('0x45')],{'as':_0xda63('0x11e'),'foreignKey':_0xda63('0x164'),'onDelete':_0xda63('0x166')});db['CmContact'][_0xda63('0x122')](db['CmCompany'],{'as':_0xda63('0x19c'),'foreignKey':_0xda63('0x19a')});db['CmContact'][_0xda63('0x122')](db[_0xda63('0x128')],{'as':'List','foreignKey':_0xda63('0x16e'),'onDelete':_0xda63('0x111')});db['CmContact'][_0xda63('0x125')](db['User'],{'as':_0xda63('0x173'),'through':_0xda63('0x127')});db[_0xda63('0x71')]['belongsToMany'](db['Tag'],{'as':_0xda63('0x172'),'through':'cm_contact_has_tags'});db[_0xda63('0x71')][_0xda63('0x125')](db[_0xda63('0x8b')],{'through':_0xda63('0x19d'),'as':_0xda63('0x187')});db[_0xda63('0x73')][_0xda63('0x114')](db[_0xda63('0x90')],{'as':_0xda63('0x19e'),'foreignKey':_0xda63('0x19f')});db[_0xda63('0x73')][_0xda63('0x122')](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164'),'onDelete':_0xda63('0x111')});db['CmHopper'][_0xda63('0x122')](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e'),'onDelete':'cascade'});db[_0xda63('0x73')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':_0xda63('0x1a0'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x73')][_0xda63('0x122')](db['VoiceQueue'],{'as':_0xda63('0x193'),'foreignKey':_0xda63('0x14c'),'onDelete':_0xda63('0x111')});db[_0xda63('0x73')][_0xda63('0x122')](db[_0xda63('0xe8')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xda63('0x111')});db[_0xda63('0x73')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':'Owner','foreignKey':'OwnerId'});db[_0xda63('0x75')]['belongsTo'](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164'),'onDelete':'cascade'});db[_0xda63('0x75')][_0xda63('0x122')](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e'),'onDelete':_0xda63('0x111')});db[_0xda63('0x75')][_0xda63('0x122')](db['VoiceQueue'],{'as':_0xda63('0x193'),'foreignKey':_0xda63('0x14c'),'onDelete':_0xda63('0x111')});db[_0xda63('0x75')][_0xda63('0x122')](db[_0xda63('0xe8')],{'as':_0xda63('0xe8'),'foreignKey':_0xda63('0x1a1'),'onDelete':_0xda63('0x111')});db['Automation'][_0xda63('0x114')](db[_0xda63('0x1a2')],{'as':{'plural':_0xda63('0x1a3'),'singular':'OneAll'},'foreignKey':_0xda63('0x1a4'),'onDelete':'cascade','hooks':!![]});db[_0xda63('0x1a5')][_0xda63('0x114')](db[_0xda63('0x1a2')],{'as':{'plural':_0xda63('0x1a6'),'singular':'OneAny'},'foreignKey':_0xda63('0x1a7'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xda63('0x114')](db[_0xda63('0x7d')],{'as':_0xda63('0x1a8'),'foreignKey':'AutomationId','onDelete':_0xda63('0x111'),'hooks':!![]});db[_0xda63('0x80')][_0xda63('0x114')](db[_0xda63('0x80')],{'as':'Dispositions','foreignKey':_0xda63('0x1a9'),'onDelete':'cascade'});db[_0xda63('0x82')][_0xda63('0x114')](db[_0xda63('0x82')],{'as':_0xda63('0x1aa'),'foreignKey':_0xda63('0x153'),'onDelete':_0xda63('0x111'),'hooks':!![],'required':![]});db[_0xda63('0x82')][_0xda63('0x114')](db[_0xda63('0x17')],{'as':_0xda63('0x116'),'foreignKey':'IntervalId','onDelete':_0xda63('0x166')});db[_0xda63('0x82')]['hasMany'](db[_0xda63('0x49')],{'as':_0xda63('0x1ab'),'foreignKey':'IntervalId'});db['Interval'][_0xda63('0x114')](db[_0xda63('0x68')],{'as':_0xda63('0x1ac'),'foreignKey':_0xda63('0x153')});db[_0xda63('0x82')]['hasMany'](db[_0xda63('0x17d')],{'as':_0xda63('0x1ad'),'foreignKey':'IntervalId'});db[_0xda63('0x82')][_0xda63('0x114')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0xda63('0x153')});db[_0xda63('0x88')]['belongsTo'](db['MailAccount'],{});db[_0xda63('0x88')][_0xda63('0x122')](db['AnalyticDefaultReport'],{'foreignKey':_0xda63('0x1ae')});db[_0xda63('0x88')][_0xda63('0x122')](db[_0xda63('0x1af')],{'foreignKey':'CustomReportId'});db[_0xda63('0x149')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0xda63('0x166')});db[_0xda63('0x8b')][_0xda63('0x125')](db['CmContact'],{'through':_0xda63('0x19d')});db[_0xda63('0x8b')][_0xda63('0x125')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xda63('0x8b')][_0xda63('0x125')](db[_0xda63('0x45')],{'through':_0xda63('0x171')});db[_0xda63('0x8b')][_0xda63('0x125')](db['SmsInteraction'],{'through':_0xda63('0x186')});db[_0xda63('0x8b')]['belongsToMany'](db[_0xda63('0x52')],{'through':_0xda63('0x180')});db[_0xda63('0x8b')][_0xda63('0x125')](db['OpenchannelInteraction'],{'through':_0xda63('0x18c')});db[_0xda63('0x8b')][_0xda63('0x125')](db[_0xda63('0x101')],{'through':'whatsapp_interaction_has_tags'});db[_0xda63('0x8e')][_0xda63('0x122')](db[_0xda63('0x8c')],{'as':'ItemType','foreignKey':_0xda63('0x1b0')});db[_0xda63('0x90')][_0xda63('0x122')](db['CmHopper'],{'as':_0xda63('0x1b1'),'foreignKey':_0xda63('0x19f')});db[_0xda63('0x8e')][_0xda63('0x122')](db[_0xda63('0x71')],{'as':'Contact','foreignKey':_0xda63('0x19b')});db[_0xda63('0x1b2')]['hasMany'](db[_0xda63('0x1a2')],{'as':{'plural':_0xda63('0x1b3'),'singular':_0xda63('0x1b4')},'foreignKey':_0xda63('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0xda63('0x1b2')][_0xda63('0x114')](db[_0xda63('0x1a2')],{'as':{'plural':'AnyConditions','singular':_0xda63('0x1b6')},'foreignKey':_0xda63('0x1b7'),'onDelete':_0xda63('0x111'),'hooks':!![]});db[_0xda63('0x1b2')][_0xda63('0x114')](db[_0xda63('0x7d')],{'as':'Actions','foreignKey':_0xda63('0x1b8'),'onDelete':'cascade','hooks':!![]});db[_0xda63('0x1af')][_0xda63('0x114')](db[_0xda63('0x9d')],{'as':'Fields','onDelete':_0xda63('0x111'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xda63('0x1b9')]['hasMany'](db[_0xda63('0x9d')],{'as':_0xda63('0x1ba'),'onDelete':_0xda63('0x111'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0xda63('0x114')](db['AnalyticFieldReport'],{'as':_0xda63('0x1ba'),'onDelete':'cascade','foreignKey':_0xda63('0x1bb')});db[_0xda63('0x9d')][_0xda63('0x122')](db[_0xda63('0x9c')],{'foreignKey':_0xda63('0x1bb')});db[_0xda63('0x1bc')]['hasMany'](db[_0xda63('0xa2')],{'as':_0xda63('0x1bd'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0xa2')][_0xda63('0x114')](db[_0xda63('0xa4')],{'as':_0xda63('0x1bf'),'onDelete':'cascade','foreignKey':_0xda63('0x1c0')});db[_0xda63('0xa2')][_0xda63('0x114')](db[_0xda63('0xa4')],{'as':_0xda63('0x1c1'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0xa2')][_0xda63('0x114')](db[_0xda63('0xa4')],{'as':_0xda63('0x1ba'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c3')});db[_0xda63('0xa2')]['belongsTo'](db[_0xda63('0x1bc')],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0xa4')][_0xda63('0x114')](db[_0xda63('0xa4')],{'as':_0xda63('0x1c4'),'foreignKey':_0xda63('0x1c0')});db[_0xda63('0xa4')][_0xda63('0x114')](db[_0xda63('0xa4')],{'as':_0xda63('0x1c5'),'foreignKey':_0xda63('0x1c2')});db['SalesforceField'][_0xda63('0x114')](db[_0xda63('0xa4')],{'as':_0xda63('0x1c6'),'foreignKey':'FieldId'});db[_0xda63('0xa4')][_0xda63('0x122')](db[_0xda63('0x95')],{'as':_0xda63('0x95'),'foreignKey':_0xda63('0x1c7')});db[_0xda63('0xa6')][_0xda63('0x114')](db['SugarcrmConfiguration'],{'as':_0xda63('0x1bd'),'onDelete':'cascade','foreignKey':_0xda63('0x1be')});db['SugarcrmConfiguration'][_0xda63('0x114')](db[_0xda63('0xaa')],{'as':'Subjects','onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c0')});db['SugarcrmConfiguration'][_0xda63('0x114')](db[_0xda63('0xaa')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xda63('0x1c2')});db[_0xda63('0xa8')][_0xda63('0x114')](db[_0xda63('0xaa')],{'as':_0xda63('0x1ba'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c3')});db[_0xda63('0xa8')][_0xda63('0x122')](db[_0xda63('0xa6')],{'as':_0xda63('0x177'),'foreignKey':'AccountId'});db[_0xda63('0xaa')]['hasMany'](db['SugarcrmField'],{'as':_0xda63('0x1c4'),'foreignKey':_0xda63('0x1c0')});db['SugarcrmField'][_0xda63('0x114')](db[_0xda63('0xaa')],{'as':_0xda63('0x1c5'),'foreignKey':_0xda63('0x1c2')});db['SugarcrmField'][_0xda63('0x114')](db[_0xda63('0xaa')],{'as':'Field','foreignKey':'FieldId'});db['SugarcrmField'][_0xda63('0x122')](db[_0xda63('0x95')],{'as':_0xda63('0x95'),'foreignKey':_0xda63('0x1c7')});db['DeskAccount'][_0xda63('0x114')](db[_0xda63('0x1c8')],{'as':_0xda63('0x1bd'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0x1c8')][_0xda63('0x114')](db[_0xda63('0xaf')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xda63('0x1c0')});db[_0xda63('0x1c8')]['hasMany'](db['DeskField'],{'as':_0xda63('0x1c1'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0x1c8')][_0xda63('0x114')](db['DeskField'],{'as':'Fields','onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c3')});db[_0xda63('0x1c8')]['belongsTo'](db['DeskAccount'],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0x1c8')][_0xda63('0x125')](db['Tag'],{'through':_0xda63('0x1c9')});db['DeskField'][_0xda63('0x114')](db[_0xda63('0xaf')],{'as':'Subject','foreignKey':_0xda63('0x1c0')});db[_0xda63('0xaf')][_0xda63('0x114')](db[_0xda63('0xaf')],{'as':_0xda63('0x1c5'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0xaf')][_0xda63('0x114')](db['DeskField'],{'as':_0xda63('0x1c6'),'foreignKey':_0xda63('0x1c3')});db[_0xda63('0xaf')][_0xda63('0x122')](db[_0xda63('0x95')],{'as':_0xda63('0x95'),'foreignKey':_0xda63('0x1c7')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0xda63('0x1bd'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1be')});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c0')});db[_0xda63('0xb2')][_0xda63('0x114')](db[_0xda63('0x1ca')],{'as':'Descriptions','onDelete':_0xda63('0x111'),'foreignKey':'DescriptionId'});db[_0xda63('0xb2')][_0xda63('0x114')](db[_0xda63('0x1ca')],{'as':_0xda63('0x1ba'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c3')});db[_0xda63('0xb2')][_0xda63('0x122')](db[_0xda63('0xb1')],{'as':'Account','foreignKey':'AccountId'});db['ZohoField'][_0xda63('0x114')](db['ZohoField'],{'as':_0xda63('0x1c4'),'foreignKey':'SubjectId'});db[_0xda63('0x1ca')]['hasMany'](db['ZohoField'],{'as':_0xda63('0x1c5'),'foreignKey':'DescriptionId'});db[_0xda63('0x1ca')][_0xda63('0x114')](db['ZohoField'],{'as':_0xda63('0x1c6'),'foreignKey':_0xda63('0x1c3')});db['ZohoField'][_0xda63('0x122')](db[_0xda63('0x95')],{'as':'Variable','foreignKey':_0xda63('0x1c7')});db[_0xda63('0x1cb')][_0xda63('0x114')](db[_0xda63('0xb3')],{'as':'Configurations','onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0xb3')][_0xda63('0x114')](db['ZendeskField'],{'as':_0xda63('0x1bf'),'foreignKey':_0xda63('0x1c0')});db['ZendeskConfiguration'][_0xda63('0x114')](db[_0xda63('0xb4')],{'as':_0xda63('0x1c1'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0xb3')][_0xda63('0x114')](db['ZendeskField'],{'as':_0xda63('0x1ba'),'foreignKey':_0xda63('0x1c3')});db['ZendeskConfiguration'][_0xda63('0x122')](db[_0xda63('0x1cb')],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x1be')});db['ZendeskConfiguration']['belongsToMany'](db[_0xda63('0x8b')],{'through':_0xda63('0x1cc')});db['ZendeskField']['hasMany'](db[_0xda63('0xb4')],{'as':_0xda63('0x1c4'),'foreignKey':_0xda63('0x1c0')});db[_0xda63('0xb4')][_0xda63('0x114')](db[_0xda63('0xb4')],{'as':_0xda63('0x1c5'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0xb4')]['hasMany'](db[_0xda63('0xb4')],{'as':_0xda63('0x1c6'),'foreignKey':_0xda63('0x1c3')});db[_0xda63('0xb4')][_0xda63('0x122')](db[_0xda63('0x95')],{'as':'Variable','foreignKey':_0xda63('0x1c7')});db[_0xda63('0xb6')]['hasMany'](db[_0xda63('0xb7')],{'as':'Configurations','onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0xb7')][_0xda63('0x114')](db[_0xda63('0xb9')],{'as':'Subjects','onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c0')});db[_0xda63('0xb7')][_0xda63('0x114')](db['FreshdeskField'],{'as':_0xda63('0x1c1'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c2')});db['FreshdeskConfiguration'][_0xda63('0x114')](db[_0xda63('0xb9')],{'as':_0xda63('0x1ba'),'onDelete':_0xda63('0x111'),'foreignKey':'FieldId'});db[_0xda63('0xb7')][_0xda63('0x122')](db['FreshdeskAccount'],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0xb7')][_0xda63('0x125')](db[_0xda63('0x8b')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0xda63('0x114')](db[_0xda63('0xb9')],{'as':_0xda63('0x1c4'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0xda63('0x114')](db['FreshdeskField'],{'as':_0xda63('0x1c5'),'foreignKey':_0xda63('0x1c2')});db['FreshdeskField'][_0xda63('0x114')](db[_0xda63('0xb9')],{'as':_0xda63('0x1c6'),'foreignKey':_0xda63('0x1c3')});db[_0xda63('0xb9')][_0xda63('0x122')](db[_0xda63('0x95')],{'as':_0xda63('0x95'),'foreignKey':'VariableId'});db[_0xda63('0xbb')][_0xda63('0x114')](db[_0xda63('0x1cd')],{'as':_0xda63('0x1bd'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0x1cd')][_0xda63('0x114')](db['VtigerField'],{'as':_0xda63('0x1bf'),'foreignKey':_0xda63('0x1c0')});db['VtigerConfiguration'][_0xda63('0x114')](db[_0xda63('0xbd')],{'as':_0xda63('0x1c1'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0x1cd')][_0xda63('0x114')](db[_0xda63('0xbd')],{'as':'Fields','foreignKey':_0xda63('0x1c3')});db['VtigerConfiguration'][_0xda63('0x122')](db['VtigerAccount'],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0xbd')]['hasMany'](db[_0xda63('0xbd')],{'as':'Subject','foreignKey':_0xda63('0x1c0')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':_0xda63('0x1c2')});db[_0xda63('0xbd')][_0xda63('0x114')](db[_0xda63('0xbd')],{'as':'Field','foreignKey':_0xda63('0x1c3')});db['VtigerField'][_0xda63('0x122')](db[_0xda63('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0xda63('0x1ce')][_0xda63('0x114')](db[_0xda63('0xc0')],{'as':_0xda63('0x1bd'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1be')});db['ServicenowConfiguration'][_0xda63('0x114')](db[_0xda63('0xc1')],{'as':_0xda63('0x1bf'),'foreignKey':_0xda63('0x1c0')});db['ServicenowConfiguration'][_0xda63('0x114')](db[_0xda63('0xc1')],{'as':_0xda63('0x1c1'),'foreignKey':'DescriptionId'});db[_0xda63('0xc0')][_0xda63('0x114')](db[_0xda63('0xc1')],{'as':_0xda63('0x1ba'),'foreignKey':_0xda63('0x1c3')});db[_0xda63('0xc0')][_0xda63('0x122')](db[_0xda63('0x1ce')],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x1be')});db[_0xda63('0xc1')]['hasMany'](db[_0xda63('0xc1')],{'as':'Subject','foreignKey':_0xda63('0x1c0')});db[_0xda63('0xc1')][_0xda63('0x114')](db[_0xda63('0xc1')],{'as':_0xda63('0x1c5'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0xc1')][_0xda63('0x114')](db[_0xda63('0xc1')],{'as':_0xda63('0x1c6'),'foreignKey':_0xda63('0x1c3')});db[_0xda63('0xc1')]['belongsTo'](db[_0xda63('0x95')],{'as':_0xda63('0x95'),'foreignKey':_0xda63('0x1c7')});db[_0xda63('0xc2')]['hasMany'](db[_0xda63('0xc4')],{'as':_0xda63('0x1bd'),'onDelete':_0xda63('0x111'),'foreignKey':'AccountId'});db[_0xda63('0xc2')][_0xda63('0x122')](db[_0xda63('0x109')],{'as':_0xda63('0x109'),'foreignKey':_0xda63('0x167')});db[_0xda63('0xc4')]['hasMany'](db[_0xda63('0xc6')],{'as':_0xda63('0x1bf'),'onDelete':_0xda63('0x111'),'foreignKey':'SubjectId'});db[_0xda63('0xc4')]['hasMany'](db[_0xda63('0xc6')],{'as':_0xda63('0x1c1'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0xc4')][_0xda63('0x114')](db['Dynamics365Field'],{'as':_0xda63('0x1ba'),'onDelete':'cascade','foreignKey':_0xda63('0x1c3')});db['Dynamics365Configuration'][_0xda63('0x122')](db[_0xda63('0xc2')],{'as':'Account','foreignKey':_0xda63('0x1be')});db[_0xda63('0xc6')][_0xda63('0x114')](db[_0xda63('0xc6')],{'as':_0xda63('0x1c4'),'foreignKey':_0xda63('0x1c0')});db['Dynamics365Field'][_0xda63('0x114')](db['Dynamics365Field'],{'as':_0xda63('0x1c5'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0xc6')]['hasMany'](db[_0xda63('0xc6')],{'as':_0xda63('0x1c6'),'foreignKey':_0xda63('0x1c3')});db['Dynamics365Field'][_0xda63('0x122')](db[_0xda63('0x95')],{'as':_0xda63('0x95'),'foreignKey':_0xda63('0x1c7')});db[_0xda63('0xc8')][_0xda63('0x114')](db[_0xda63('0xc9')],{'as':_0xda63('0x1bd'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1be')});db['FreshsalesConfiguration'][_0xda63('0x114')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0xda63('0x1c0')});db[_0xda63('0xc9')][_0xda63('0x114')](db[_0xda63('0xcb')],{'as':_0xda63('0x1c1'),'foreignKey':_0xda63('0x1c2')});db[_0xda63('0xc9')]['hasMany'](db[_0xda63('0xcb')],{'as':_0xda63('0x1ba'),'foreignKey':_0xda63('0x1c3')});db['FreshsalesConfiguration'][_0xda63('0x122')](db[_0xda63('0xc8')],{'as':'Account','foreignKey':_0xda63('0x1be')});db[_0xda63('0xcb')][_0xda63('0x114')](db[_0xda63('0xcb')],{'as':_0xda63('0x1c4'),'foreignKey':_0xda63('0x1c0')});db[_0xda63('0xcb')][_0xda63('0x114')](db[_0xda63('0xcb')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xda63('0xcb')][_0xda63('0x114')](db[_0xda63('0xcb')],{'as':_0xda63('0x1c6'),'foreignKey':_0xda63('0x1c3')});db['FreshsalesField'][_0xda63('0x122')](db[_0xda63('0x95')],{'as':_0xda63('0x95'),'foreignKey':'VariableId'});db[_0xda63('0xcf')][_0xda63('0x122')](db[_0xda63('0x65')],{});db[_0xda63('0xcf')][_0xda63('0x122')](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':'ListId'});db[_0xda63('0xcf')][_0xda63('0x122')](db[_0xda63('0x71')],{'as':'Contact','foreignKey':_0xda63('0x164')});db[_0xda63('0xcf')]['belongsTo'](db[_0xda63('0x69')],{});db[_0xda63('0xcf')][_0xda63('0x122')](db[_0xda63('0x192')],{});db[_0xda63('0xcf')][_0xda63('0x122')](db[_0xda63('0x12')],{});db[_0xda63('0xcf')][_0xda63('0x122')](db[_0xda63('0x6c')],{});db[_0xda63('0xd1')][_0xda63('0x122')](db[_0xda63('0x12')],{'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1cf')});db['ChatInternalMessage'][_0xda63('0x122')](db[_0xda63('0x12')],{'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1d0')});db[_0xda63('0xd7')][_0xda63('0x114')](db[_0xda63('0xd5')],{'foreignKey':'SessionId','onDelete':_0xda63('0x111')});db[_0xda63('0xd7')][_0xda63('0x114')](db[_0xda63('0xd3')],{'foreignKey':_0xda63('0x1d1'),'onDelete':'cascade'});db[_0xda63('0xd9')][_0xda63('0x122')](db[_0xda63('0x57')],{});db['SmsQueueReport'][_0xda63('0x122')](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':'ListId'});db[_0xda63('0xd9')][_0xda63('0x122')](db['CmContact'],{'as':'Contact','foreignKey':_0xda63('0x164')});db[_0xda63('0xd9')]['belongsTo'](db[_0xda63('0x12f')],{});db[_0xda63('0xd9')][_0xda63('0x122')](db[_0xda63('0x184')],{});db['SmsQueueReport'][_0xda63('0x122')](db[_0xda63('0x12')],{});db[_0xda63('0xd9')][_0xda63('0x122')](db['SmsQueue'],{});db[_0xda63('0x1d2')]['hasMany'](db[_0xda63('0xd7')],{'foreignKey':_0xda63('0x1d3')});db['JscriptyProject'][_0xda63('0x114')](db[_0xda63('0xd5')],{'foreignKey':'ProjectId'});db[_0xda63('0x1d2')]['hasMany'](db[_0xda63('0xd3')],{'foreignKey':'ProjectId'});db[_0xda63('0x12b')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x12c')});db[_0xda63('0x12b')]['belongsToMany'](db['VoiceQueue'],{'through':_0xda63('0x10a'),'as':_0xda63('0x133')});db[_0xda63('0x12b')][_0xda63('0x125')](db[_0xda63('0x42')],{'through':_0xda63('0x1d4'),'as':_0xda63('0x1d5')});db[_0xda63('0x12b')][_0xda63('0x125')](db[_0xda63('0x6c')],{'through':_0xda63('0x1d6'),'as':_0xda63('0x136')});db[_0xda63('0x12b')]['belongsToMany'](db['FaxQueue'],{'through':_0xda63('0x1d7'),'as':_0xda63('0x138')});db[_0xda63('0x12b')]['belongsToMany'](db[_0xda63('0x5c')],{'through':_0xda63('0x189'),'as':_0xda63('0x139')});db[_0xda63('0x12b')][_0xda63('0x125')](db['OpenchannelQueue'],{'through':_0xda63('0x190'),'as':'OpenchannelQueues'});db[_0xda63('0x12b')][_0xda63('0x125')](db[_0xda63('0x107')],{'through':_0xda63('0x1d8'),'as':'WhatsappQueues'});db[_0xda63('0x12b')][_0xda63('0x125')](db[_0xda63('0xf6')],{'through':'TeamVoicePrefix','as':_0xda63('0x134')});db[_0xda63('0xe8')]['hasMany'](db[_0xda63('0x73')],{'as':_0xda63('0x14d'),'foreignKey':_0xda63('0x1a1')});db[_0xda63('0xe8')][_0xda63('0x114')](db[_0xda63('0x77')],{'as':'HopperFinals','foreignKey':_0xda63('0x1a1')});db[_0xda63('0xe8')][_0xda63('0x114')](db[_0xda63('0x14e')],{'as':'HopperHistories','foreignKey':_0xda63('0x1a1')});db[_0xda63('0xe8')]['hasMany'](db[_0xda63('0x75')],{'as':_0xda63('0x14f'),'foreignKey':'CampaignId'});db['Campaign'][_0xda63('0x122')](db[_0xda63('0x2b')],{'as':'Trunk','foreignKey':'TrunkId'});db['Campaign'][_0xda63('0x122')](db['Trunk'],{'as':_0xda63('0x151'),'foreignKey':_0xda63('0x152')});db[_0xda63('0xe8')]['belongsTo'](db[_0xda63('0x82')],{'as':_0xda63('0x82'),'foreignKey':'IntervalId'});db[_0xda63('0xe8')]['belongsTo'](db[_0xda63('0xe2')],{'as':_0xda63('0xe2'),'foreignKey':_0xda63('0x1d9')});db[_0xda63('0xe8')][_0xda63('0x125')](db[_0xda63('0x128')],{'as':'Lists','through':_0xda63('0x1da')});db[_0xda63('0xe8')][_0xda63('0x125')](db[_0xda63('0x128')],{'as':'BlackLists','through':_0xda63('0x1db')});db[_0xda63('0x174')][_0xda63('0x122')](db[_0xda63('0x6a')],{'as':_0xda63('0x6a'),'foreignKey':_0xda63('0x198')});db[_0xda63('0xef')][_0xda63('0x122')](db[_0xda63('0x47')],{});db[_0xda63('0xef')][_0xda63('0x122')](db[_0xda63('0x45')],{});db[_0xda63('0xef')][_0xda63('0x122')](db[_0xda63('0x40')],{'foreignKey':_0xda63('0x1dc'),'as':_0xda63('0x1dd')});db[_0xda63('0xef')][_0xda63('0x122')](db[_0xda63('0x12')],{'foreignKey':'FromUserId','as':_0xda63('0x1de')});db[_0xda63('0xef')]['belongsTo'](db[_0xda63('0x12')],{'foreignKey':_0xda63('0x1df'),'as':_0xda63('0x1e0')});db['MailTransferReport'][_0xda63('0x122')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0xda63('0x1e1')});db[_0xda63('0xef')][_0xda63('0x122')](db[_0xda63('0x40')],{'foreignKey':_0xda63('0x1e2'),'as':_0xda63('0x1e3')});db[_0xda63('0xf0')][_0xda63('0x122')](db[_0xda63('0x192')],{});db['ChatTransferReport'][_0xda63('0x122')](db[_0xda63('0x69')],{});db[_0xda63('0xf0')][_0xda63('0x122')](db[_0xda63('0x65')],{'foreignKey':_0xda63('0x1e4'),'as':'FromAccount'});db[_0xda63('0xf0')][_0xda63('0x122')](db[_0xda63('0x12')],{'foreignKey':_0xda63('0x1e5'),'as':_0xda63('0x1de')});db['ChatTransferReport'][_0xda63('0x122')](db[_0xda63('0x12')],{'foreignKey':'ToUserId','as':_0xda63('0x1e0')});db[_0xda63('0xf0')][_0xda63('0x122')](db[_0xda63('0x6c')],{'foreignKey':_0xda63('0x1e6'),'as':_0xda63('0x1e1')});db[_0xda63('0xf0')][_0xda63('0x122')](db[_0xda63('0x65')],{'foreignKey':_0xda63('0x1e7'),'as':_0xda63('0x1e3')});db[_0xda63('0x1e8')][_0xda63('0x122')](db[_0xda63('0x53')],{});db[_0xda63('0x1e8')][_0xda63('0x122')](db['FaxInteraction'],{});db[_0xda63('0x1e8')][_0xda63('0x122')](db[_0xda63('0x50')],{'foreignKey':_0xda63('0x1e9'),'as':'FromAccount'});db['FaxTransferReport'][_0xda63('0x122')](db[_0xda63('0x12')],{'foreignKey':_0xda63('0x1e5'),'as':_0xda63('0x1de')});db['FaxTransferReport'][_0xda63('0x122')](db['User'],{'foreignKey':_0xda63('0x1df'),'as':_0xda63('0x1e0')});db[_0xda63('0x1e8')]['belongsTo'](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0xda63('0x1e8')]['belongsTo'](db[_0xda63('0x50')],{'foreignKey':_0xda63('0x1ea'),'as':_0xda63('0x1e3')});db[_0xda63('0xf2')][_0xda63('0x122')](db['OpenchannelMessage'],{});db[_0xda63('0xf2')]['belongsTo'](db[_0xda63('0x119')],{});db[_0xda63('0xf2')][_0xda63('0x122')](db[_0xda63('0x141')],{'foreignKey':'FromOpenchannelAccountId','as':_0xda63('0x1dd')});db[_0xda63('0xf2')][_0xda63('0x122')](db[_0xda63('0x12')],{'foreignKey':'FromUserId','as':_0xda63('0x1de')});db['OpenchannelTransferReport']['belongsTo'](db[_0xda63('0x12')],{'foreignKey':_0xda63('0x1df'),'as':_0xda63('0x1e0')});db[_0xda63('0xf2')][_0xda63('0x122')](db[_0xda63('0x63')],{'foreignKey':_0xda63('0x1eb'),'as':'ToQueue'});db[_0xda63('0xf2')][_0xda63('0x122')](db[_0xda63('0x141')],{'foreignKey':'ToOpenchannelAccountId','as':_0xda63('0x1e3')});db[_0xda63('0xf4')][_0xda63('0x122')](db[_0xda63('0x184')],{});db['SmsTransferReport'][_0xda63('0x122')](db[_0xda63('0x12f')],{});db[_0xda63('0xf4')][_0xda63('0x122')](db[_0xda63('0x57')],{'foreignKey':_0xda63('0x1ec'),'as':'FromAccount'});db[_0xda63('0xf4')][_0xda63('0x122')](db[_0xda63('0x12')],{'foreignKey':_0xda63('0x1e5'),'as':_0xda63('0x1de')});db['SmsTransferReport'][_0xda63('0x122')](db[_0xda63('0x12')],{'foreignKey':_0xda63('0x1df'),'as':_0xda63('0x1e0')});db[_0xda63('0xf4')][_0xda63('0x122')](db[_0xda63('0x5c')],{'foreignKey':_0xda63('0x1ed'),'as':_0xda63('0x1e1')});db[_0xda63('0xf4')][_0xda63('0x122')](db[_0xda63('0x57')],{'foreignKey':_0xda63('0x1ee'),'as':'ToAccount'});db[_0xda63('0x128')][_0xda63('0x114')](db[_0xda63('0x80')],{'as':_0xda63('0x16a'),'foreignKey':'ListId','onDelete':_0xda63('0x111')});db[_0xda63('0x128')][_0xda63('0x114')](db[_0xda63('0x7b')],{'as':_0xda63('0x1ef'),'foreignKey':'ListId'});db[_0xda63('0x128')][_0xda63('0x114')](db[_0xda63('0x71')],{'as':'Contacts','onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x16e')});db[_0xda63('0x128')][_0xda63('0x114')](db['CmHopperFinal'],{'as':_0xda63('0x117'),'foreignKey':_0xda63('0x16e')});db[_0xda63('0x128')][_0xda63('0x114')](db[_0xda63('0x14e')],{'as':_0xda63('0x118'),'foreignKey':'ListId'});db['CmList'][_0xda63('0x114')](db[_0xda63('0x79')],{'as':_0xda63('0x79'),'foreignKey':_0xda63('0x16e')});db['CmList'][_0xda63('0x125')](db[_0xda63('0x132')],{'as':_0xda63('0x1f0'),'through':'voice_queues_has_cm_lists'});db[_0xda63('0x128')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x12a')});db[_0xda63('0xf6')][_0xda63('0x114')](db[_0xda63('0x17')],{'as':_0xda63('0x116'),'onDelete':_0xda63('0x111')});db[_0xda63('0xf6')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x10c')});db['VoicePrefix']['belongsToMany'](db['Team'],{'through':_0xda63('0x1f1'),'as':_0xda63('0x159')});db[_0xda63('0xf7')][_0xda63('0x114')](db[_0xda63('0x12')],{'as':_0xda63('0x173'),'foreignKey':'userProfileId'});db[_0xda63('0xf7')][_0xda63('0x114')](db[_0xda63('0xf9')],{'as':_0xda63('0x1f2'),'foreignKey':_0xda63('0x123'),'onDelete':_0xda63('0x111')});db[_0xda63('0xf9')][_0xda63('0x114')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0xda63('0x1f3'),'onDelete':'cascade'});db[_0xda63('0xfe')][_0xda63('0x114')](db[_0xda63('0x80')],{'as':_0xda63('0x16a'),'foreignKey':_0xda63('0x1f4'),'onDelete':_0xda63('0x111')});db[_0xda63('0xfe')][_0xda63('0x114')](db['CannedAnswer'],{'as':_0xda63('0x16b'),'foreignKey':'WhatsappAccountId'});db[_0xda63('0xfe')][_0xda63('0x114')](db[_0xda63('0x103')],{'as':_0xda63('0x15d'),'foreignKey':_0xda63('0x1f4')});db['WhatsappAccount'][_0xda63('0x114')](db[_0xda63('0x101')],{'as':_0xda63('0x16c')});db['WhatsappAccount'][_0xda63('0x114')](db['WhatsappApplication'],{'as':_0xda63('0x148')});db[_0xda63('0xfe')][_0xda63('0x122')](db['CmList'],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e')});db[_0xda63('0xfe')][_0xda63('0x122')](db[_0xda63('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0xda63('0x156')});db[_0xda63('0xfe')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x145')});db[_0xda63('0xff')]['belongsTo'](db[_0xda63('0x12')],{'onDelete':'restrict'});db[_0xda63('0xff')]['belongsTo'](db[_0xda63('0x107')],{'onDelete':_0xda63('0x166')});db[_0xda63('0xff')][_0xda63('0x122')](db[_0xda63('0xfe')],{'onDelete':_0xda63('0x166')});db[_0xda63('0xff')][_0xda63('0x122')](db[_0xda63('0x82')],{'onDelete':_0xda63('0x166'),'foreignKey':_0xda63('0x153')});db[_0xda63('0xff')][_0xda63('0x122')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xda63('0x101')]['hasMany'](db[_0xda63('0x103')],{'as':_0xda63('0x15d'),'onDelete':_0xda63('0x111'),'foreignKey':_0xda63('0x1f5')});db[_0xda63('0x101')][_0xda63('0x122')](db['WhatsappAccount'],{'as':_0xda63('0x177'),'foreignKey':_0xda63('0x1f4')});db[_0xda63('0x101')][_0xda63('0x122')](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164')});db[_0xda63('0x101')][_0xda63('0x122')](db[_0xda63('0x12')],{'as':_0xda63('0x17f'),'foreignKey':_0xda63('0x112')});db[_0xda63('0x101')]['belongsToMany'](db[_0xda63('0x8b')],{'through':_0xda63('0x1f6'),'as':'Tags'});db[_0xda63('0x101')][_0xda63('0x125')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xda63('0x187')});db[_0xda63('0x101')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x173'),'through':_0xda63('0x131'),'foreignKey':_0xda63('0x1f5')});db[_0xda63('0x103')]['belongsTo'](db['User'],{'as':_0xda63('0x12')});db['WhatsappMessage'][_0xda63('0x122')](db[_0xda63('0x71')],{'onDelete':_0xda63('0x111'),'as':'Contact'});db[_0xda63('0x103')][_0xda63('0x122')](db[_0xda63('0x101')],{'onDelete':_0xda63('0x111'),'as':_0xda63('0x176'),'foreignKey':_0xda63('0x1f5')});db[_0xda63('0x103')][_0xda63('0x122')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xda63('0x1f4')});db[_0xda63('0x105')]['belongsTo'](db['WhatsappAccount'],{});db[_0xda63('0x105')][_0xda63('0x122')](db[_0xda63('0x128')],{'as':_0xda63('0x16d'),'foreignKey':_0xda63('0x16e')});db[_0xda63('0x105')][_0xda63('0x122')](db[_0xda63('0x71')],{'as':_0xda63('0x163'),'foreignKey':_0xda63('0x164')});db[_0xda63('0x105')][_0xda63('0x122')](db[_0xda63('0x101')],{});db[_0xda63('0x105')][_0xda63('0x122')](db[_0xda63('0x107')],{});db[_0xda63('0x105')][_0xda63('0x122')](db[_0xda63('0x103')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xda63('0x12')],{});db[_0xda63('0x1f7')]['belongsTo'](db[_0xda63('0x103')],{});db[_0xda63('0x1f7')][_0xda63('0x122')](db['WhatsappInteraction'],{});db[_0xda63('0x1f7')][_0xda63('0x122')](db[_0xda63('0xfe')],{'foreignKey':_0xda63('0x1f8'),'as':_0xda63('0x1dd')});db['WhatsappTransferReport'][_0xda63('0x122')](db[_0xda63('0xfe')],{'foreignKey':_0xda63('0x1f9'),'as':'ToAccount'});db[_0xda63('0x1f7')]['belongsTo'](db[_0xda63('0x107')],{'foreignKey':_0xda63('0x1fa'),'as':_0xda63('0x1e1')});db['WhatsappTransferReport'][_0xda63('0x122')](db[_0xda63('0x12')],{'foreignKey':_0xda63('0x1e5'),'as':_0xda63('0x1de')});db[_0xda63('0x1f7')][_0xda63('0x122')](db['User'],{'foreignKey':_0xda63('0x1df'),'as':_0xda63('0x1e0')});db[_0xda63('0x107')][_0xda63('0x125')](db[_0xda63('0x12')],{'as':_0xda63('0x158'),'through':_0xda63('0x3c'),'foreignKey':'WhatsappQueueId'});db[_0xda63('0x107')][_0xda63('0x125')](db[_0xda63('0x12b')],{'through':_0xda63('0x1d8'),'as':'Teams'});db['UserSetting']['belongsTo'](db['User'],{'as':'user','foreignKey':_0xda63('0x112'),'onDelete':_0xda63('0x111'),'hooks':!![]});db['CloudProvider'][_0xda63('0x110')](db['Dynamics365Account'],{'as':_0xda63('0xc2'),'onDelete':_0xda63('0x166')});db['CloudProvider']['hasOne'](db[_0xda63('0x168')],{'as':_0xda63('0x1fb'),'onDelete':_0xda63('0x166')});db[_0xda63('0x109')]['hasOne'](db[_0xda63('0x3e')],{'as':'Smtp','onDelete':_0xda63('0x166')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8a76142..b930a3c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d6b=['/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','join','/apidoc','/www','static','root','/demo','/snippet','/plugins','route','get','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','/api/sms/interactions','/api/sms/messages','./api/smsMessage'];(function(_0x32766f,_0x11188c){var _0x5dfec0=function(_0x1412c4){while(--_0x1412c4){_0x32766f['push'](_0x32766f['shift']());}};_0x5dfec0(++_0x11188c);}(_0x5d6b,0xc9));var _0xb5d6=function(_0x2ce596,_0x10313b){_0x2ce596=_0x2ce596-0x0;var _0x2e65a4=_0x5d6b[_0x2ce596];return _0x2e65a4;};'use strict';var path=require(_0xb5d6('0x0'));var express=require(_0xb5d6('0x1'));var errors=require(_0xb5d6('0x2'));var config=require(_0xb5d6('0x3'));var setupLoggers=require(_0xb5d6('0x4'))[_0xb5d6('0x5')];var clientSideLogs=require(_0xb5d6('0x6'));exports[_0xb5d6('0x7')]=function(_0x37b45a){return setupLoggers(_0x37b45a)[_0xb5d6('0x8')](function(){_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xa'),require(_0xb5d6('0xb')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xc'),require(_0xb5d6('0xd')));_0x37b45a['use'](_0xb5d6('0xe'),require('./api/voiceContext'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xf'),require(_0xb5d6('0x10')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x11'),require(_0xb5d6('0x12')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x13'),require(_0xb5d6('0x14')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x15'),require(_0xb5d6('0x16')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x17'),require('./api/screenRecording'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x18'),require(_0xb5d6('0x19')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x1a'),require(_0xb5d6('0x1b')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x1c'),require(_0xb5d6('0x1d')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x1e'),require(_0xb5d6('0x1f')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x20'),require(_0xb5d6('0x21')));_0x37b45a[_0xb5d6('0x9')]('/api/voice/queues/reports',require(_0xb5d6('0x22')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x23'),require(_0xb5d6('0x24')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x25'),require(_0xb5d6('0x26')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x27'),require(_0xb5d6('0x28')));_0x37b45a[_0xb5d6('0x9')]('/api/mail/out_servers',require(_0xb5d6('0x29')));_0x37b45a[_0xb5d6('0x9')]('/api/mail/accounts',require(_0xb5d6('0x2a')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x2b'),require(_0xb5d6('0x2c')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x2d'),require(_0xb5d6('0x2e')));_0x37b45a[_0xb5d6('0x9')]('/api/mail/interactions',require(_0xb5d6('0x2f')));_0x37b45a['use'](_0xb5d6('0x30'),require(_0xb5d6('0x31')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x32'),require('./api/mailApplication'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x33'),require(_0xb5d6('0x34')));_0x37b45a['use'](_0xb5d6('0x35'),require('./api/dashboard'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x36'),require(_0xb5d6('0x37')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x38'),require('./api/faxAccount'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x39'),require(_0xb5d6('0x3a')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x3b'),require('./api/faxInteraction'));_0x37b45a['use'](_0xb5d6('0x3c'),require('./api/faxMessage'));_0x37b45a['use'](_0xb5d6('0x3d'),require(_0xb5d6('0x3e')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x3f'),require(_0xb5d6('0x40')));_0x37b45a[_0xb5d6('0x9')]('/api/sms/accounts',require(_0xb5d6('0x41')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x42'),require('./api/smsApplication'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x43'),require('./api/smsInteraction'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x44'),require(_0xb5d6('0x45')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x46'),require(_0xb5d6('0x47')));_0x37b45a['use'](_0xb5d6('0x48'),require(_0xb5d6('0x49')));_0x37b45a[_0xb5d6('0x9')]('/api/openchannel/applications',require(_0xb5d6('0x4a')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x4b'),require('./api/openchannelInteraction'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x4c'),require(_0xb5d6('0x4d')));_0x37b45a[_0xb5d6('0x9')]('/api/openchannel/queues',require(_0xb5d6('0x4e')));_0x37b45a[_0xb5d6('0x9')]('/api/chat/websites',require(_0xb5d6('0x4f')));_0x37b45a['use'](_0xb5d6('0x50'),require(_0xb5d6('0x51')));_0x37b45a['use'](_0xb5d6('0x52'),require(_0xb5d6('0x53')));_0x37b45a[_0xb5d6('0x9')]('/api/chat/interactions',require(_0xb5d6('0x54')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x55'),require('./api/chatMessage'));_0x37b45a['use']('/api/chat/offline_messages',require(_0xb5d6('0x56')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x57'),require(_0xb5d6('0x58')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x59'),require(_0xb5d6('0x5a')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x5b'),require(_0xb5d6('0x5c')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x5d'),require(_0xb5d6('0x5e')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x5f'),require(_0xb5d6('0x60')));_0x37b45a[_0xb5d6('0x9')]('/api/cm/hopper',require(_0xb5d6('0x61')));_0x37b45a['use'](_0xb5d6('0x62'),require(_0xb5d6('0x63')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x64'),require('./api/cmHopperFinal'));_0x37b45a['use'](_0xb5d6('0x65'),require(_0xb5d6('0x66')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x67'),require(_0xb5d6('0x68')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x69'),require('./api/action'));_0x37b45a['use'](_0xb5d6('0x6a'),require(_0xb5d6('0x6b')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x6c'),require(_0xb5d6('0x6d')));_0x37b45a[_0xb5d6('0x9')]('/api/dispositions',require(_0xb5d6('0x6e')));_0x37b45a['use']('/api/conditions',require('./api/condition'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x6f'),require(_0xb5d6('0x70')));_0x37b45a['use'](_0xb5d6('0x71'),require(_0xb5d6('0x72')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x73'),require('./api/cdr'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x74'),require(_0xb5d6('0x75')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x76'),require(_0xb5d6('0x77')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x78'),require(_0xb5d6('0x79')));_0x37b45a['use']('/api/tags',require('./api/tag'));_0x37b45a['use']('/api/contact_item_types',require(_0xb5d6('0x7a')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x7b'),require(_0xb5d6('0x7c')));_0x37b45a['use'](_0xb5d6('0x7d'),require(_0xb5d6('0x7e')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x7f'),require(_0xb5d6('0x80')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x81'),require(_0xb5d6('0x82')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x83'),require(_0xb5d6('0x84')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x85'),require(_0xb5d6('0x86')));_0x37b45a['use']('/api/integrations/reports',require('./api/integrationReport'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x87'),require(_0xb5d6('0x88')));_0x37b45a['use'](_0xb5d6('0x89'),require('./api/analyticDefaultReport'));_0x37b45a[_0xb5d6('0x9')]('/api/analytics/extracted_reports',require(_0xb5d6('0x8a')));_0x37b45a[_0xb5d6('0x9')]('/api/analytics/metrics',require(_0xb5d6('0x8b')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x8c'),require(_0xb5d6('0x8d')));_0x37b45a[_0xb5d6('0x9')]('/api/analytics/tree_reports',require(_0xb5d6('0x8e')));_0x37b45a[_0xb5d6('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x37b45a[_0xb5d6('0x9')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x37b45a['use'](_0xb5d6('0x8f'),require(_0xb5d6('0x90')));_0x37b45a[_0xb5d6('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x91'),require(_0xb5d6('0x92')));_0x37b45a['use']('/api/integrations/sugarcrm/fields',require(_0xb5d6('0x93')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x94'),require('./api/intDeskAccount'));_0x37b45a[_0xb5d6('0x9')]('/api/integrations/desk/configurations',require(_0xb5d6('0x95')));_0x37b45a['use'](_0xb5d6('0x96'),require(_0xb5d6('0x97')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x98'),require(_0xb5d6('0x99')));_0x37b45a['use'](_0xb5d6('0x9a'),require('./api/intZohoConfiguration'));_0x37b45a[_0xb5d6('0x9')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x9b'),require(_0xb5d6('0x9c')));_0x37b45a[_0xb5d6('0x9')]('/api/integrations/zendesk/configurations',require(_0xb5d6('0x9d')));_0x37b45a['use'](_0xb5d6('0x9e'),require(_0xb5d6('0x9f')));_0x37b45a['use'](_0xb5d6('0xa0'),require(_0xb5d6('0xa1')));_0x37b45a[_0xb5d6('0x9')]('/api/integrations/freshdesk/configurations',require(_0xb5d6('0xa2')));_0x37b45a['use'](_0xb5d6('0xa3'),require(_0xb5d6('0xa4')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xa5'),require('./api/intVtigerAccount'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xa6'),require(_0xb5d6('0xa7')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xa8'),require(_0xb5d6('0xa9')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xaa'),require('./api/intServicenowAccount'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xab'),require(_0xb5d6('0xac')));_0x37b45a[_0xb5d6('0x9')]('/api/integrations/servicenow/fields',require(_0xb5d6('0xad')));_0x37b45a['use']('/api/integrations/dynamics365/accounts',require(_0xb5d6('0xae')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xaf'),require('./api/intDynamics365Configuration'));_0x37b45a[_0xb5d6('0x9')]('/api/integrations/dynamics365/fields',require(_0xb5d6('0xb0')));_0x37b45a['use'](_0xb5d6('0xb1'),require('./api/intFreshsalesAccount'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xb2'),require(_0xb5d6('0xb3')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xb4'),require('./api/intFreshsalesField'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xb5'),require('./api/network'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xb6'),require('./api/chatQueueReport'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xb7'),require(_0xb5d6('0xb8')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xb9'),require('./api/jscriptyAnswerReport'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xba'),require(_0xb5d6('0xbb')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xbc'),require(_0xb5d6('0xbd')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xbe'),require(_0xb5d6('0xbf')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xc0'),require('./api/squareReport'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xc1'),require(_0xb5d6('0xc2')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xc3'),require(_0xb5d6('0xc4')));_0x37b45a['use'](_0xb5d6('0xc5'),require(_0xb5d6('0xc6')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xc7'),require(_0xb5d6('0xc8')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xc9'),require(_0xb5d6('0xca')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xcb'),require(_0xb5d6('0xcc')));_0x37b45a['use'](_0xb5d6('0xcd'),require('./api/squareMessage'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xce'),require(_0xb5d6('0xcf')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xd0'),require('./api/license'));_0x37b45a['use'](_0xb5d6('0xd1'),require('./api/campaign'));_0x37b45a['use']('/api/migrations',require(_0xb5d6('0xd2')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xd3'),require(_0xb5d6('0xd4')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xd5'),require(_0xb5d6('0xd6')));_0x37b45a['use']('/api/mail/reports/transfer',require(_0xb5d6('0xd7')));_0x37b45a['use']('/api/chat/reports/transfer',require(_0xb5d6('0xd8')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xd9'),require(_0xb5d6('0xda')));_0x37b45a['use']('/api/openchannel/reports/transfer',require(_0xb5d6('0xdb')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xdc'),require('./api/smsTransferReport'));_0x37b45a['use'](_0xb5d6('0xdd'),require(_0xb5d6('0xde')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xdf'),require('./api/voicePrefix'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xe0'),require(_0xb5d6('0xe1')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xe2'),require('./api/userProfileSection'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xe3'),require(_0xb5d6('0xe4')));_0x37b45a[_0xb5d6('0x9')]('/api/userNotifications',require('./api/userNotification'));_0x37b45a['use'](_0xb5d6('0xe5'),require(_0xb5d6('0xe6')));_0x37b45a['use']('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xe7'),require('./api/whatsappInteraction'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xe8'),require(_0xb5d6('0xe9')));_0x37b45a[_0xb5d6('0x9')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xea'),require(_0xb5d6('0xeb')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xec'),require('./api/whatsappQueue'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xed'),require(_0xb5d6('0xee')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xef'),require('./api/realtime'));_0x37b45a[_0xb5d6('0x9')]('/api/user-settings',require(_0xb5d6('0xf0')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xf1'),require(_0xb5d6('0xf2')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xf3'),require(_0xb5d6('0xf4')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xf5'),require(_0xb5d6('0xf6')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xf7'),require(_0xb5d6('0xf8')));_0x37b45a['use'](_0xb5d6('0xf9'),require(_0xb5d6('0xfa')));_0x37b45a['use'](_0xb5d6('0xfb'),require(_0xb5d6('0xfc')));_0x37b45a['use'](_0xb5d6('0xfd'),require(_0xb5d6('0xfe')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0xff'),require(_0xb5d6('0x100')));_0x37b45a['use'](_0xb5d6('0x101'),require('./api/webbar'));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x102'),clientSideLogs);_0x37b45a[_0xb5d6('0x9')]('/apidoc',express['static'](path[_0xb5d6('0x103')](config['root'],_0xb5d6('0x104'))));_0x37b45a['use'](_0xb5d6('0x105'),express[_0xb5d6('0x106')](path[_0xb5d6('0x103')](config[_0xb5d6('0x107')],'/www')));_0x37b45a['use'](_0xb5d6('0x108'),express[_0xb5d6('0x106')](path[_0xb5d6('0x103')](config[_0xb5d6('0x107')],'/demo')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x109'),express[_0xb5d6('0x106')](path[_0xb5d6('0x103')](config['root'],'snippet','3.1.0')));_0x37b45a[_0xb5d6('0x9')](_0xb5d6('0x10a'),express[_0xb5d6('0x106')](path[_0xb5d6('0x103')](config[_0xb5d6('0x107')],'/server/files/plugins')));_0x37b45a[_0xb5d6('0x10b')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xb5d6('0x10c')](errors[0x194]);_0x37b45a[_0xb5d6('0x10b')]('/*')[_0xb5d6('0x10c')](function(_0x611c83,_0x1a87cf){_0x1a87cf['sendFile'](path[_0xb5d6('0x10d')](_0x37b45a[_0xb5d6('0x10c')]('appPath')+_0xb5d6('0x10e')));});return _0x37b45a;});}; \ No newline at end of file +var _0x2833=['./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/user-settings','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','/index.html','path','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','/api/mail/reports/queue','/api/dashboards','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/custom_fields','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/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/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/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/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2833,0x64));var _0x3283=function(_0x44a056,_0x496468){_0x44a056=_0x44a056-0x0;var _0x24cadc=_0x2833[_0x44a056];return _0x24cadc;};'use strict';var path=require(_0x3283('0x0'));var express=require(_0x3283('0x1'));var errors=require(_0x3283('0x2'));var config=require(_0x3283('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0x3283('0x4')];var clientSideLogs=require(_0x3283('0x5'));exports[_0x3283('0x6')]=function(_0x2ab813){return setupLoggers(_0x2ab813)[_0x3283('0x7')](function(){_0x2ab813[_0x3283('0x8')](_0x3283('0x9'),require('./api/user'));_0x2ab813[_0x3283('0x8')](_0x3283('0xa'),require('./api/voiceChanSpy'));_0x2ab813['use'](_0x3283('0xb'),require(_0x3283('0xc')));_0x2ab813[_0x3283('0x8')](_0x3283('0xd'),require(_0x3283('0xe')));_0x2ab813['use'](_0x3283('0xf'),require(_0x3283('0x10')));_0x2ab813[_0x3283('0x8')](_0x3283('0x11'),require(_0x3283('0x12')));_0x2ab813[_0x3283('0x8')](_0x3283('0x13'),require(_0x3283('0x14')));_0x2ab813[_0x3283('0x8')]('/api/screen/recordings',require(_0x3283('0x15')));_0x2ab813['use'](_0x3283('0x16'),require(_0x3283('0x17')));_0x2ab813[_0x3283('0x8')]('/api/voice/mails/messages',require(_0x3283('0x18')));_0x2ab813[_0x3283('0x8')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x2ab813[_0x3283('0x8')](_0x3283('0x19'),require('./api/voiceDialReport'));_0x2ab813[_0x3283('0x8')](_0x3283('0x1a'),require(_0x3283('0x1b')));_0x2ab813[_0x3283('0x8')](_0x3283('0x1c'),require('./api/voiceQueueReport'));_0x2ab813[_0x3283('0x8')]('/api/members/reports',require('./api/memberReport'));_0x2ab813['use'](_0x3283('0x1d'),require('./api/trunk'));_0x2ab813[_0x3283('0x8')](_0x3283('0x1e'),require(_0x3283('0x1f')));_0x2ab813[_0x3283('0x8')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x2ab813[_0x3283('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x2ab813['use']('/api/mail/queues',require(_0x3283('0x20')));_0x2ab813[_0x3283('0x8')](_0x3283('0x21'),require(_0x3283('0x22')));_0x2ab813[_0x3283('0x8')](_0x3283('0x23'),require(_0x3283('0x24')));_0x2ab813[_0x3283('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x2ab813[_0x3283('0x8')](_0x3283('0x25'),require('./api/mailApplication'));_0x2ab813['use'](_0x3283('0x26'),require('./api/mailQueueReport'));_0x2ab813['use'](_0x3283('0x27'),require('./api/dashboard'));_0x2ab813[_0x3283('0x8')](_0x3283('0x28'),require('./api/dashboardItem'));_0x2ab813[_0x3283('0x8')](_0x3283('0x29'),require('./api/faxAccount'));_0x2ab813['use'](_0x3283('0x2a'),require(_0x3283('0x2b')));_0x2ab813[_0x3283('0x8')]('/api/fax/interactions',require(_0x3283('0x2c')));_0x2ab813[_0x3283('0x8')](_0x3283('0x2d'),require(_0x3283('0x2e')));_0x2ab813['use'](_0x3283('0x2f'),require(_0x3283('0x30')));_0x2ab813['use'](_0x3283('0x31'),require(_0x3283('0x32')));_0x2ab813[_0x3283('0x8')]('/api/sms/accounts',require(_0x3283('0x33')));_0x2ab813[_0x3283('0x8')](_0x3283('0x34'),require(_0x3283('0x35')));_0x2ab813[_0x3283('0x8')](_0x3283('0x36'),require(_0x3283('0x37')));_0x2ab813[_0x3283('0x8')]('/api/sms/messages',require('./api/smsMessage'));_0x2ab813[_0x3283('0x8')](_0x3283('0x38'),require('./api/smsQueue'));_0x2ab813[_0x3283('0x8')]('/api/openchannel/accounts',require(_0x3283('0x39')));_0x2ab813['use'](_0x3283('0x3a'),require('./api/openchannelApplication'));_0x2ab813[_0x3283('0x8')](_0x3283('0x3b'),require(_0x3283('0x3c')));_0x2ab813['use']('/api/openchannel/messages',require(_0x3283('0x3d')));_0x2ab813[_0x3283('0x8')](_0x3283('0x3e'),require(_0x3283('0x3f')));_0x2ab813['use'](_0x3283('0x40'),require(_0x3283('0x41')));_0x2ab813[_0x3283('0x8')](_0x3283('0x42'),require(_0x3283('0x43')));_0x2ab813[_0x3283('0x8')](_0x3283('0x44'),require(_0x3283('0x45')));_0x2ab813['use']('/api/chat/interactions',require(_0x3283('0x46')));_0x2ab813[_0x3283('0x8')](_0x3283('0x47'),require(_0x3283('0x48')));_0x2ab813[_0x3283('0x8')]('/api/chat/offline_messages',require(_0x3283('0x49')));_0x2ab813[_0x3283('0x8')](_0x3283('0x4a'),require(_0x3283('0x4b')));_0x2ab813['use'](_0x3283('0x4c'),require(_0x3283('0x4d')));_0x2ab813[_0x3283('0x8')](_0x3283('0x4e'),require(_0x3283('0x4f')));_0x2ab813[_0x3283('0x8')](_0x3283('0x50'),require(_0x3283('0x51')));_0x2ab813[_0x3283('0x8')](_0x3283('0x52'),require(_0x3283('0x53')));_0x2ab813[_0x3283('0x8')]('/api/cm/hopper',require(_0x3283('0x54')));_0x2ab813[_0x3283('0x8')](_0x3283('0x55'),require(_0x3283('0x56')));_0x2ab813[_0x3283('0x8')](_0x3283('0x57'),require('./api/cmHopperFinal'));_0x2ab813[_0x3283('0x8')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x2ab813[_0x3283('0x8')](_0x3283('0x58'),require('./api/cmCustomField'));_0x2ab813[_0x3283('0x8')]('/api/actions',require(_0x3283('0x59')));_0x2ab813[_0x3283('0x8')]('/api/automations',require(_0x3283('0x5a')));_0x2ab813[_0x3283('0x8')](_0x3283('0x5b'),require(_0x3283('0x5c')));_0x2ab813['use'](_0x3283('0x5d'),require(_0x3283('0x5e')));_0x2ab813[_0x3283('0x8')](_0x3283('0x5f'),require(_0x3283('0x60')));_0x2ab813[_0x3283('0x8')](_0x3283('0x61'),require('./api/interval'));_0x2ab813[_0x3283('0x8')](_0x3283('0x62'),require(_0x3283('0x63')));_0x2ab813[_0x3283('0x8')](_0x3283('0x64'),require(_0x3283('0x65')));_0x2ab813[_0x3283('0x8')]('/api/voiceQueuesLog',require(_0x3283('0x66')));_0x2ab813[_0x3283('0x8')](_0x3283('0x67'),require(_0x3283('0x68')));_0x2ab813[_0x3283('0x8')]('/api/sounds',require('./api/sound'));_0x2ab813[_0x3283('0x8')]('/api/tags',require(_0x3283('0x69')));_0x2ab813['use'](_0x3283('0x6a'),require(_0x3283('0x6b')));_0x2ab813[_0x3283('0x8')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x2ab813[_0x3283('0x8')](_0x3283('0x6c'),require(_0x3283('0x6d')));_0x2ab813[_0x3283('0x8')](_0x3283('0x6e'),require('./api/template'));_0x2ab813[_0x3283('0x8')](_0x3283('0x6f'),require(_0x3283('0x70')));_0x2ab813[_0x3283('0x8')]('/api/variables',require(_0x3283('0x71')));_0x2ab813['use'](_0x3283('0x72'),require(_0x3283('0x73')));_0x2ab813[_0x3283('0x8')](_0x3283('0x74'),require(_0x3283('0x75')));_0x2ab813[_0x3283('0x8')](_0x3283('0x76'),require('./api/analyticCustomReport'));_0x2ab813[_0x3283('0x8')](_0x3283('0x77'),require('./api/analyticDefaultReport'));_0x2ab813[_0x3283('0x8')](_0x3283('0x78'),require(_0x3283('0x79')));_0x2ab813['use'](_0x3283('0x7a'),require(_0x3283('0x7b')));_0x2ab813[_0x3283('0x8')](_0x3283('0x7c'),require(_0x3283('0x7d')));_0x2ab813[_0x3283('0x8')]('/api/analytics/tree_reports',require(_0x3283('0x7e')));_0x2ab813[_0x3283('0x8')](_0x3283('0x7f'),require(_0x3283('0x80')));_0x2ab813['use'](_0x3283('0x81'),require(_0x3283('0x82')));_0x2ab813[_0x3283('0x8')]('/api/integrations/salesforce/fields',require(_0x3283('0x83')));_0x2ab813[_0x3283('0x8')](_0x3283('0x84'),require(_0x3283('0x85')));_0x2ab813[_0x3283('0x8')](_0x3283('0x86'),require('./api/intSugarcrmConfiguration'));_0x2ab813[_0x3283('0x8')](_0x3283('0x87'),require('./api/intSugarcrmField'));_0x2ab813['use'](_0x3283('0x88'),require(_0x3283('0x89')));_0x2ab813[_0x3283('0x8')](_0x3283('0x8a'),require('./api/intDeskConfiguration'));_0x2ab813[_0x3283('0x8')]('/api/integrations/desk/fields',require(_0x3283('0x8b')));_0x2ab813['use']('/api/integrations/zoho/accounts',require(_0x3283('0x8c')));_0x2ab813['use'](_0x3283('0x8d'),require('./api/intZohoConfiguration'));_0x2ab813['use'](_0x3283('0x8e'),require(_0x3283('0x8f')));_0x2ab813[_0x3283('0x8')](_0x3283('0x90'),require(_0x3283('0x91')));_0x2ab813['use'](_0x3283('0x92'),require('./api/intZendeskConfiguration'));_0x2ab813[_0x3283('0x8')](_0x3283('0x93'),require('./api/intZendeskField'));_0x2ab813[_0x3283('0x8')](_0x3283('0x94'),require(_0x3283('0x95')));_0x2ab813[_0x3283('0x8')](_0x3283('0x96'),require(_0x3283('0x97')));_0x2ab813[_0x3283('0x8')](_0x3283('0x98'),require('./api/intFreshdeskField'));_0x2ab813[_0x3283('0x8')](_0x3283('0x99'),require('./api/intVtigerAccount'));_0x2ab813[_0x3283('0x8')](_0x3283('0x9a'),require(_0x3283('0x9b')));_0x2ab813[_0x3283('0x8')](_0x3283('0x9c'),require(_0x3283('0x9d')));_0x2ab813[_0x3283('0x8')](_0x3283('0x9e'),require(_0x3283('0x9f')));_0x2ab813[_0x3283('0x8')]('/api/integrations/servicenow/configurations',require(_0x3283('0xa0')));_0x2ab813[_0x3283('0x8')]('/api/integrations/servicenow/fields',require(_0x3283('0xa1')));_0x2ab813[_0x3283('0x8')](_0x3283('0xa2'),require(_0x3283('0xa3')));_0x2ab813[_0x3283('0x8')](_0x3283('0xa4'),require(_0x3283('0xa5')));_0x2ab813['use']('/api/integrations/dynamics365/fields',require(_0x3283('0xa6')));_0x2ab813[_0x3283('0x8')](_0x3283('0xa7'),require('./api/intFreshsalesAccount'));_0x2ab813[_0x3283('0x8')](_0x3283('0xa8'),require(_0x3283('0xa9')));_0x2ab813[_0x3283('0x8')](_0x3283('0xaa'),require(_0x3283('0xab')));_0x2ab813['use'](_0x3283('0xac'),require('./api/network'));_0x2ab813[_0x3283('0x8')](_0x3283('0xad'),require(_0x3283('0xae')));_0x2ab813[_0x3283('0x8')](_0x3283('0xaf'),require('./api/chatInternalMessage'));_0x2ab813['use'](_0x3283('0xb0'),require(_0x3283('0xb1')));_0x2ab813[_0x3283('0x8')](_0x3283('0xb2'),require(_0x3283('0xb3')));_0x2ab813[_0x3283('0x8')](_0x3283('0xb4'),require(_0x3283('0xb5')));_0x2ab813[_0x3283('0x8')](_0x3283('0xb6'),require(_0x3283('0xb7')));_0x2ab813['use']('/api/square/reports',require('./api/squareReport'));_0x2ab813[_0x3283('0x8')]('/api/square/details/reports',require(_0x3283('0xb8')));_0x2ab813[_0x3283('0x8')](_0x3283('0xb9'),require(_0x3283('0xba')));_0x2ab813['use']('/api/settings',require(_0x3283('0xbb')));_0x2ab813[_0x3283('0x8')](_0x3283('0xbc'),require(_0x3283('0xbd')));_0x2ab813[_0x3283('0x8')](_0x3283('0xbe'),require(_0x3283('0xbf')));_0x2ab813[_0x3283('0x8')](_0x3283('0xc0'),require(_0x3283('0xc1')));_0x2ab813[_0x3283('0x8')](_0x3283('0xc2'),require(_0x3283('0xc3')));_0x2ab813[_0x3283('0x8')](_0x3283('0xc4'),require(_0x3283('0xc5')));_0x2ab813[_0x3283('0x8')](_0x3283('0xc6'),require('./api/license'));_0x2ab813[_0x3283('0x8')]('/api/campaigns',require(_0x3283('0xc7')));_0x2ab813[_0x3283('0x8')](_0x3283('0xc8'),require(_0x3283('0xc9')));_0x2ab813[_0x3283('0x8')](_0x3283('0xca'),require('./api/attachment'));_0x2ab813[_0x3283('0x8')](_0x3283('0xcb'),require(_0x3283('0xcc')));_0x2ab813[_0x3283('0x8')](_0x3283('0xcd'),require(_0x3283('0xce')));_0x2ab813[_0x3283('0x8')](_0x3283('0xcf'),require('./api/chatTransferReport'));_0x2ab813[_0x3283('0x8')](_0x3283('0xd0'),require(_0x3283('0xd1')));_0x2ab813[_0x3283('0x8')](_0x3283('0xd2'),require(_0x3283('0xd3')));_0x2ab813['use']('/api/sms/reports/transfer',require(_0x3283('0xd4')));_0x2ab813['use'](_0x3283('0xd5'),require(_0x3283('0xd6')));_0x2ab813[_0x3283('0x8')](_0x3283('0xd7'),require('./api/voicePrefix'));_0x2ab813[_0x3283('0x8')](_0x3283('0xd8'),require(_0x3283('0xd9')));_0x2ab813[_0x3283('0x8')]('/api/userProfile/sections',require(_0x3283('0xda')));_0x2ab813[_0x3283('0x8')](_0x3283('0xdb'),require(_0x3283('0xdc')));_0x2ab813[_0x3283('0x8')](_0x3283('0xdd'),require('./api/userNotification'));_0x2ab813[_0x3283('0x8')](_0x3283('0xde'),require('./api/whatsappAccount'));_0x2ab813[_0x3283('0x8')](_0x3283('0xdf'),require('./api/whatsappApplication'));_0x2ab813[_0x3283('0x8')](_0x3283('0xe0'),require(_0x3283('0xe1')));_0x2ab813[_0x3283('0x8')]('/api/whatsapp/messages',require(_0x3283('0xe2')));_0x2ab813[_0x3283('0x8')](_0x3283('0xe3'),require(_0x3283('0xe4')));_0x2ab813['use']('/api/whatsapp/reports/transfer',require(_0x3283('0xe5')));_0x2ab813[_0x3283('0x8')](_0x3283('0xe6'),require(_0x3283('0xe7')));_0x2ab813['use']('/api/cloudProviders',require(_0x3283('0xe8')));_0x2ab813[_0x3283('0x8')]('/api/realtime',require(_0x3283('0xe9')));_0x2ab813[_0x3283('0x8')](_0x3283('0xea'),require('./api/user-setting'));_0x2ab813[_0x3283('0x8')]('/api/auth/local',require(_0x3283('0xeb')));_0x2ab813[_0x3283('0x8')](_0x3283('0xec'),require(_0x3283('0xed')));_0x2ab813['use'](_0x3283('0xee'),require(_0x3283('0xef')));_0x2ab813[_0x3283('0x8')](_0x3283('0xf0'),require(_0x3283('0xf1')));_0x2ab813[_0x3283('0x8')]('/api/rpc',require(_0x3283('0xf2')));_0x2ab813[_0x3283('0x8')](_0x3283('0xf3'),require('./api/version'));_0x2ab813['use'](_0x3283('0xf4'),require(_0x3283('0xf5')));_0x2ab813[_0x3283('0x8')]('/api/pm2',require(_0x3283('0xf6')));_0x2ab813['use'](_0x3283('0xf7'),require(_0x3283('0xf8')));_0x2ab813[_0x3283('0x8')](_0x3283('0xf9'),clientSideLogs);_0x2ab813['use'](_0x3283('0xfa'),express[_0x3283('0xfb')](path[_0x3283('0xfc')](config[_0x3283('0xfd')],'/apidoc')));_0x2ab813[_0x3283('0x8')](_0x3283('0xfe'),express[_0x3283('0xfb')](path['join'](config[_0x3283('0xfd')],_0x3283('0xfe'))));_0x2ab813[_0x3283('0x8')](_0x3283('0xff'),express[_0x3283('0xfb')](path[_0x3283('0xfc')](config['root'],_0x3283('0xff'))));_0x2ab813[_0x3283('0x8')](_0x3283('0x100'),express[_0x3283('0xfb')](path['join'](config[_0x3283('0xfd')],_0x3283('0x101'),_0x3283('0x102'))));_0x2ab813['use'](_0x3283('0x103'),express[_0x3283('0xfb')](path[_0x3283('0xfc')](config[_0x3283('0xfd')],_0x3283('0x104'))));_0x2ab813['route'](_0x3283('0x105'))[_0x3283('0x106')](errors[0x194]);_0x2ab813[_0x3283('0x107')]('/*')[_0x3283('0x106')](function(_0x5c5a75,_0x354465){_0x354465[_0x3283('0x108')](path['resolve'](_0x2ab813[_0x3283('0x106')]('appPath')+_0x3283('0x109')));});return _0x2ab813;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index f0720a6..e57f356 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a43=['../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.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/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc'];(function(_0x3ee35a,_0x4e2bc5){var _0x118dfc=function(_0x14efbb){while(--_0x14efbb){_0x3ee35a['push'](_0x3ee35a['shift']());}};_0x118dfc(++_0x4e2bc5);}(_0x5a43,0xd0));var _0x35a4=function(_0x2b0266,_0x10417d){_0x2b0266=_0x2b0266-0x0;var _0x5c81a7=_0x5a43[_0x2b0266];return _0x5c81a7;};'use strict';var jayson=require(_0x35a4('0x0'));var _=require(_0x35a4('0x1'));var config=require(_0x35a4('0x2'));exports[_0x35a4('0x3')]=function(){return new Promise(function(_0x53bd35,_0x1528ee){var _0x58c390={};_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x4')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x5')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x7')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x8')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x9')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0xa')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0xb')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0xc')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/trunk/trunk.rpc'));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0xd')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0xe')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0xf')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x10')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/mailInteraction/mailInteraction.rpc'));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x11')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x12')));_0x58c390=_['merge'](_0x58c390,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x13')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x14')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x15')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/faxMessage/faxMessage.rpc'));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x16')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x17')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/smsAccount/smsAccount.rpc'));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x18')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x19')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x1a')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x1b')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x1c')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x1d')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x1e')));_0x58c390=_['merge'](_0x58c390,require('../api/chatInteraction/chatInteraction.rpc'));_0x58c390=_['merge'](_0x58c390,require('../api/chatMessage/chatMessage.rpc'));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x1f')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x20')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x21')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x22')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x23')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x24')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/pause/pause.rpc'));_0x58c390=_['merge'](_0x58c390,require('../api/sound/sound.rpc'));_0x58c390=_['merge'](_0x58c390,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x25')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x26')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x27')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x28')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x29')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x2a')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x2b')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x2c')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x2d')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x2e')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x2f')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x30')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x31')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x32')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x33')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x34')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x35')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/squareOdbc/squareOdbc.rpc'));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x36')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x37')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x38')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x39')));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x3a')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/plugin/plugin.rpc'));_0x58c390=_['merge'](_0x58c390,require(_0x35a4('0x3b')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x3c')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x3d')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require(_0x35a4('0x3e')));_0x58c390=_[_0x35a4('0x6')](_0x58c390,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x49814b=jayson['server'](_0x58c390)[_0x35a4('0x3f')]();var _0x588660=config[_0x35a4('0x40')]['port']||config[_0x35a4('0x41')]+0x1;var _0xcf6eb9=config[_0x35a4('0x40')]['ip']||_0x35a4('0x42');_0x49814b['on'](_0x35a4('0x43'),function(_0x2287f8){return _0x1528ee(_0x2287f8);});_0x49814b[_0x35a4('0x3')](_0x588660,_0xcf6eb9,function(){console[_0x35a4('0x44')](_0x35a4('0x45'),_0xcf6eb9,_0x588660);require(_0x35a4('0x46'))[_0x35a4('0x47')]();return _0x53bd35('RPC\x20listening\x20on\x20'+_0xcf6eb9+':'+_0x588660);});});}; \ No newline at end of file +var _0xee5c=['../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.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/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc'];(function(_0x5f0d88,_0x1a70c1){var _0x30ae5c=function(_0x1297b3){while(--_0x1297b3){_0x5f0d88['push'](_0x5f0d88['shift']());}};_0x30ae5c(++_0x1a70c1);}(_0xee5c,0xcd));var _0xcee5=function(_0x3d2012,_0x3d02b9){_0x3d2012=_0x3d2012-0x0;var _0x53d542=_0xee5c[_0x3d2012];return _0x53d542;};'use strict';var jayson=require(_0xcee5('0x0'));var _=require(_0xcee5('0x1'));var config=require('../config/environment');exports[_0xcee5('0x2')]=function(){return new Promise(function(_0x422c61,_0x4f79ad){var _0x594a49={};_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x4')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x5')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x6')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/voiceRecording/voiceRecording.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x7')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x8')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x9')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0xa')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0xb')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0xc')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0xd')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0xe')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/mailQueue/mailQueue.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0xf')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x10')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x11')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x12')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/faxApplication/faxApplication.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x13')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x14')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x15')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x16')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x17')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/smsInteraction/smsInteraction.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x18')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x19')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x1a')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x1b')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x1c')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x1d')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x1e')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x1f')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x20')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x21')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x22')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x23')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x24')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x25')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x26')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x27')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x28')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/sound/sound.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x29')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x2a')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x2b')));_0x594a49=_['merge'](_0x594a49,require('../api/variable/variable.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x2c')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x2d')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x2e')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x2f')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x30')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x31')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x32')));_0x594a49=_['merge'](_0x594a49,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x33')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/squareReport/squareReport.rpc'));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x34')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x35')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x36')));_0x594a49=_['merge'](_0x594a49,require('../api/squareProject/squareProject.rpc'));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x37')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x38')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x39')));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x3a')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x3b')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x3c')));_0x594a49=_['merge'](_0x594a49,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x594a49=_['merge'](_0x594a49,require(_0xcee5('0x3d')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require(_0xcee5('0x3e')));_0x594a49=_[_0xcee5('0x3')](_0x594a49,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x4a7d29=jayson['server'](_0x594a49)['http']();var _0x508d1e=config[_0xcee5('0x3f')][_0xcee5('0x40')]||config[_0xcee5('0x40')]+0x1;var _0x259780=config[_0xcee5('0x3f')]['ip']||_0xcee5('0x41');_0x4a7d29['on'](_0xcee5('0x42'),function(_0x261593){return _0x4f79ad(_0x261593);});_0x4a7d29[_0xcee5('0x2')](_0x508d1e,_0x259780,function(){console[_0xcee5('0x43')](_0xcee5('0x44'),_0x259780,_0x508d1e);require(_0xcee5('0x45'))[_0xcee5('0x46')]();return _0x422c61(_0xcee5('0x47')+_0x259780+':'+_0x508d1e);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index fb4924f..891c606 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 _0x9f53=['setPriority','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','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','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','toLowerCase','emit','hangup','search','substring','no\x20code','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','close','inherits','prototype','sendRequest','command','sync','answer','ANSWER','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9f53,0xfb));var _0x39f5=function(_0xc7fe63,_0x1a2229){_0xc7fe63=_0xc7fe63-0x0;var _0x1af54b=_0x9f53[_0xc7fe63];return _0x1af54b;};'use strict';var util=require(_0x39f5('0x0'));var _=require(_0x39f5('0x1'));var EventEmitter=require(_0x39f5('0x2'))['EventEmitter'];var AGIReply=require(_0x39f5('0x3'));var AGIError=require(_0x39f5('0x4'));function AGIChannel(_0x5743c4){var _0x27c9ab=this,_0x3e2258=new AGIReply(),_0xa78506=![],_0x2ae252={};EventEmitter[_0x39f5('0x5')](_0x27c9ab);_0x5743c4[_0x39f5('0x6')](_0x39f5('0x7'));_0x5743c4[_0x39f5('0x8')](0x8*0x3c*0x3c*0x3e8);_0x3e2258[_0x39f5('0x6')]('utf8');_0x3e2258['on'](_0x39f5('0x9'),function(_0x416023){for(var _0x5e45b5 in _0x416023){_0x27c9ab[_0x5e45b5]=_0x416023[_0x5e45b5];}_0x27c9ab['emit']('ready');});_0x3e2258['on']('line',function(_0x21e6f8){if(_0x21e6f8[_0x39f5('0xa')]()=='hangup'){_0x27c9ab[_0x39f5('0xb')](_0x39f5('0xc'));return;}if(_0x21e6f8['substring'](0x0,0xb)=='520-Invalid'){_0xa78506=!![];}if(_0xa78506){_0x2ae252['rx']+=_0x21e6f8+'\x0a';if(_0x21e6f8[_0x39f5('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0xa78506=![];}}else{_0x2ae252['rx']=_0x21e6f8;}if(_0xa78506){return;}if(typeof _0x2ae252['cb']=='function'){var _0x26450e=_0x2ae252['rx'][_0x39f5('0xe')](0x0,0x3),_0x46f793=null,_0x19f6a0=null;_0x26450e=parseInt(_0x26450e);if(isNaN(_0x26450e)){_0x2ae252['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x39f5('0xf')});return;}if(_0x26450e!=0xc8){_0x2ae252['cb'](null,{'code':_0x26450e,'result':-0x1,'extra':'KO'});return;}_0x46f793=_0x2ae252['rx'][_0x39f5('0xe')](0x4)['replace']('result=','');if(_0x46f793[_0x39f5('0x10')]('\x20')!=-0x1){_0x46f793=_0x46f793['substr'](0x0,_0x46f793['indexOf']('\x20'));}if(_[_0x39f5('0x11')](_0x46f793,'-1')){_0x46f793=parseInt(_0x46f793);}_0x19f6a0=_0x2ae252['rx']['split']('\x20');if(_0x19f6a0['length']==0x3){_0x19f6a0=_0x19f6a0[0x2]['substring'](0x1,_0x19f6a0[0x2][_0x39f5('0x12')]-0x1);}else if(_0x19f6a0['length']>0x3){var _0x4d148f=/\((.+)\)/;var _0x25986e=_0x2ae252['rx'][_0x39f5('0x13')](_0x4d148f);if(_0x25986e){_0x19f6a0=_0x25986e[0x1];}else{_0x19f6a0=null;}}else{_0x19f6a0=null;}_0x2ae252['cb'](null,{'code':_0x26450e,'result':_0x46f793,'extra':_0x19f6a0});}});_0x5743c4['on'](_0x39f5('0x14'),function(_0x124c79){_0x27c9ab[_0x39f5('0xb')](_0x39f5('0x14'),new AGIError(_0x39f5('0x15'),_0x124c79['code']));});_0x5743c4['on']('close',function(){_0x27c9ab[_0x39f5('0xb')]('close',new AGIError(_0x39f5('0x16')));});_0x5743c4['on'](_0x39f5('0x17'),function(){_0x27c9ab[_0x39f5('0xb')]('timeout',new AGIError(_0x39f5('0x18')));_0x5743c4[_0x39f5('0x19')]();});_0x5743c4[_0x39f5('0x1a')](_0x3e2258);this['command']=function(_0x47d0ae,_0x387f8c){var _0x47d0ae=_0x47d0ae||'',_0x387f8c=typeof _0x387f8c=='function'?_0x387f8c:new Function();_0x2ae252={'tx':_0x47d0ae,'rx':'','cb':_0x387f8c};_0x5743c4[_0x39f5('0x1b')](_0x47d0ae+'\x0a');},this[_0x39f5('0x1c')]=function(){_0x5743c4[_0x39f5('0x19')]();};}util[_0x39f5('0x1d')](AGIChannel,EventEmitter);AGIChannel[_0x39f5('0x1e')][_0x39f5('0x1f')]=function(_0x2fd98e){return this[_0x39f5('0x20')][_0x39f5('0x21')](this,_0x2fd98e);};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x22')]=function(){return this['sendRequest'](_0x39f5('0x23'));};AGIChannel['prototype']['getData']=function(_0x46b90a,_0x2d0aa8,_0x48b128){_0x46b90a=_0x46b90a===undefined?'beep':_0x46b90a;_0x2d0aa8=_0x2d0aa8===undefined?'5':_0x2d0aa8;_0x48b128=_0x48b128===undefined?'1':_0x48b128;return this[_0x39f5('0x1f')](util['format'](_0x39f5('0x24'),_0x46b90a,_0x2d0aa8*0x3e8,_0x48b128));};AGIChannel[_0x39f5('0x1e')]['noop']=function(_0x41c3c6){_0x41c3c6=_0x41c3c6||_0x39f5('0x25');return this['sendRequest'](util[_0x39f5('0x26')]('VERBOSE\x20\x22%s\x22',_0x41c3c6));};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x27')]=function(_0x4d4428,_0x17c1f8){if(_[_0x39f5('0x28')](_0x17c1f8)){return this['sendRequest'](util['format'](_0x39f5('0x29'),_0x4d4428,_0x17c1f8[_0x39f5('0x2a')](',')));}return this['sendRequest'](util[_0x39f5('0x26')](_0x39f5('0x29'),_0x4d4428,_0x17c1f8));};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x2b')]=function(_0x241da5){return this[_0x39f5('0x1f')](util[_0x39f5('0x26')]('SET\x20CONTEXT\x20%s',_0x241da5));};AGIChannel[_0x39f5('0x1e')]['setExtension']=function(_0x5f1e8f){return this[_0x39f5('0x1f')](util[_0x39f5('0x26')](_0x39f5('0x2c'),_0x5f1e8f));};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x2d')]=function(_0x8919df){return this[_0x39f5('0x1f')](util[_0x39f5('0x26')]('SET\x20PRIORITY\x20%s',_0x8919df));};AGIChannel['prototype'][_0x39f5('0xc')]=function(){return this[_0x39f5('0x1f')]('HANGUP');};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x2e')]=function(_0x4c4066,_0x552892){var _0x43c973=_[_0x39f5('0x2f')](_0x552892)||_[_0x39f5('0x30')](_0x552892)?_0x552892['toString']():_0x552892;return this[_0x39f5('0x1f')](util['format'](_0x39f5('0x31'),_0x4c4066,_0x43c973?_0x43c973[_0x39f5('0x32')]()[_0x39f5('0x33')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x34')]=function(_0x3d8336,_0x7c93c7){return this[_0x39f5('0x1f')](util[_0x39f5('0x26')](_0x39f5('0x35'),_0x3d8336,_0x7c93c7));};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x36')]=function(_0x5f0b08,_0x2544a0){return this['sendRequest'](util['format'](_0x39f5('0x37'),_0x5f0b08,_0x2544a0));};AGIChannel['prototype'][_0x39f5('0x38')]=function(_0x989b3f,_0x4f55bc){return this[_0x39f5('0x1f')](util['format'](_0x39f5('0x39'),_0x989b3f,_0x4f55bc));};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x3a')]=function(_0x3c9bfc,_0xc541da,_0x5dc5c0){_0xc541da=_0xc541da||this['extension'];_0x5dc5c0=_0x5dc5c0||0x1;this['setContext'](_0x3c9bfc);this[_0x39f5('0x3b')](_0xc541da);this[_0x39f5('0x2d')](_0x5dc5c0);return this['noop'](util[_0x39f5('0x26')](_0x39f5('0x3c'),_0x3c9bfc,_0xc541da,_0x5dc5c0));};AGIChannel['prototype'][_0x39f5('0x3d')]=function(_0x2957c4){return this['sendRequest'](util[_0x39f5('0x26')](_0x39f5('0x3e'),_0x2957c4));};AGIChannel['prototype'][_0x39f5('0x3f')]=function(_0x1db56d,_0x5c9056,_0x3a2fb1,_0x555695,_0x239204,_0x53fe73){_0x5c9056=_0x5c9056||_0x39f5('0x40');_0x3a2fb1=_0x3a2fb1||'';_0x555695=_0x555695===undefined?-0x1:_0x555695==='-1'?-0x1:_0x555695*0x3e8;_0x239204=_0x239204===undefined?'':'s='+_0x239204;_0x53fe73=_0x53fe73?_0x39f5('0x41'):'';return this['sendRequest'](util[_0x39f5('0x26')](_0x39f5('0x42'),_0x1db56d,_0x5c9056,_0x3a2fb1,_0x555695,_0x53fe73,_0x239204));};AGIChannel[_0x39f5('0x1e')]['streamFile']=function(_0x17c442,_0x5c203e){_0x5c203e=_0x5c203e||'';return this[_0x39f5('0x1f')](util[_0x39f5('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x17c442,_0x5c203e));};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x43')]=function(_0x3f2dea){return this[_0x39f5('0x27')](_0x39f5('0x44'),_0x3f2dea);};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x45')]=function(_0xfe9197){return this[_0x39f5('0x27')](_0x39f5('0x46'),_0xfe9197);};AGIChannel[_0x39f5('0x1e')][_0x39f5('0x14')]=function(_0x52bef2,_0x27d8be){this['noop'](util[_0x39f5('0x26')](_0x39f5('0x47'),_0x52bef2['id'],_0x52bef2[_0x39f5('0x48')],_0x27d8be));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x39f5('0x49')]=AGIChannel; \ No newline at end of file +var _0xad40=['GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','headers','ready','line','toLowerCase','hangup','emit','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','result=','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xad40,0xfa));var _0x0ad4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xad40[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x0ad4('0x0'));var _=require(_0x0ad4('0x1'));var EventEmitter=require(_0x0ad4('0x2'))[_0x0ad4('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x0ad4('0x4'));function AGIChannel(_0x351b06){var _0x2d5a56=this,_0x3f47b3=new AGIReply(),_0x85c3b9=![],_0x34f7cb={};EventEmitter[_0x0ad4('0x5')](_0x2d5a56);_0x351b06['setEncoding'](_0x0ad4('0x6'));_0x351b06[_0x0ad4('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3f47b3[_0x0ad4('0x8')](_0x0ad4('0x6'));_0x3f47b3['on'](_0x0ad4('0x9'),function(_0x29f1ee){for(var _0x239e92 in _0x29f1ee){_0x2d5a56[_0x239e92]=_0x29f1ee[_0x239e92];}_0x2d5a56['emit'](_0x0ad4('0xa'));});_0x3f47b3['on'](_0x0ad4('0xb'),function(_0x90d11a){if(_0x90d11a[_0x0ad4('0xc')]()==_0x0ad4('0xd')){_0x2d5a56[_0x0ad4('0xe')](_0x0ad4('0xd'));return;}if(_0x90d11a['substring'](0x0,0xb)==_0x0ad4('0xf')){_0x85c3b9=!![];}if(_0x85c3b9){_0x34f7cb['rx']+=_0x90d11a+'\x0a';if(_0x90d11a[_0x0ad4('0x10')](_0x0ad4('0x11'))!=-0x1){_0x85c3b9=![];}}else{_0x34f7cb['rx']=_0x90d11a;}if(_0x85c3b9){return;}if(typeof _0x34f7cb['cb']==_0x0ad4('0x12')){var _0xff482=_0x34f7cb['rx'][_0x0ad4('0x13')](0x0,0x3),_0x3d310d=null,_0x36ebc2=null;_0xff482=parseInt(_0xff482);if(isNaN(_0xff482)){_0x34f7cb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x0ad4('0x14')});return;}if(_0xff482!=0xc8){_0x34f7cb['cb'](null,{'code':_0xff482,'result':-0x1,'extra':'KO'});return;}_0x3d310d=_0x34f7cb['rx'][_0x0ad4('0x13')](0x4)['replace'](_0x0ad4('0x15'),'');if(_0x3d310d['indexOf']('\x20')!=-0x1){_0x3d310d=_0x3d310d[_0x0ad4('0x16')](0x0,_0x3d310d['indexOf']('\x20'));}if(_[_0x0ad4('0x17')](_0x3d310d,'-1')){_0x3d310d=parseInt(_0x3d310d);}_0x36ebc2=_0x34f7cb['rx']['split']('\x20');if(_0x36ebc2[_0x0ad4('0x18')]==0x3){_0x36ebc2=_0x36ebc2[0x2]['substring'](0x1,_0x36ebc2[0x2][_0x0ad4('0x18')]-0x1);}else if(_0x36ebc2['length']>0x3){var _0x244474=/\((.+)\)/;var _0x2db65d=_0x34f7cb['rx']['match'](_0x244474);if(_0x2db65d){_0x36ebc2=_0x2db65d[0x1];}else{_0x36ebc2=null;}}else{_0x36ebc2=null;}_0x34f7cb['cb'](null,{'code':_0xff482,'result':_0x3d310d,'extra':_0x36ebc2});}});_0x351b06['on'](_0x0ad4('0x19'),function(_0x29f255){_0x2d5a56['emit'](_0x0ad4('0x19'),new AGIError(_0x0ad4('0x1a'),_0x29f255[_0x0ad4('0x1b')]));});_0x351b06['on'](_0x0ad4('0x1c'),function(){_0x2d5a56[_0x0ad4('0xe')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x351b06['on'](_0x0ad4('0x1d'),function(){_0x2d5a56['emit']('timeout',new AGIError(_0x0ad4('0x1e')));_0x351b06['destroy']();});_0x351b06[_0x0ad4('0x1f')](_0x3f47b3);this[_0x0ad4('0x20')]=function(_0x318035,_0x147361){var _0x318035=_0x318035||'',_0x147361=typeof _0x147361==_0x0ad4('0x12')?_0x147361:new Function();_0x34f7cb={'tx':_0x318035,'rx':'','cb':_0x147361};_0x351b06[_0x0ad4('0x21')](_0x318035+'\x0a');},this[_0x0ad4('0x1c')]=function(){_0x351b06[_0x0ad4('0x22')]();};}util[_0x0ad4('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x25')]=function(_0x15c432){return this['command'][_0x0ad4('0x26')](this,_0x15c432);};AGIChannel['prototype']['answer']=function(){return this[_0x0ad4('0x25')](_0x0ad4('0x27'));};AGIChannel['prototype'][_0x0ad4('0x28')]=function(_0x1827b2,_0x1f4579,_0x193a8a){_0x1827b2=_0x1827b2===undefined?'beep':_0x1827b2;_0x1f4579=_0x1f4579===undefined?'5':_0x1f4579;_0x193a8a=_0x193a8a===undefined?'1':_0x193a8a;return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')](_0x0ad4('0x2a'),_0x1827b2,_0x1f4579*0x3e8,_0x193a8a));};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x2b')]=function(_0x87b066){_0x87b066=_0x87b066||'NO\x20MESSAGE';return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')]('VERBOSE\x20\x22%s\x22',_0x87b066));};AGIChannel['prototype'][_0x0ad4('0x2c')]=function(_0x4eef53,_0x4c8393){if(_[_0x0ad4('0x2d')](_0x4c8393)){return this['sendRequest'](util[_0x0ad4('0x29')](_0x0ad4('0x2e'),_0x4eef53,_0x4c8393[_0x0ad4('0x2f')](',')));}return this['sendRequest'](util[_0x0ad4('0x29')](_0x0ad4('0x2e'),_0x4eef53,_0x4c8393));};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x30')]=function(_0x463165){return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')](_0x0ad4('0x31'),_0x463165));};AGIChannel['prototype'][_0x0ad4('0x32')]=function(_0x530090){return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')](_0x0ad4('0x33'),_0x530090));};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x34')]=function(_0x44e177){return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')]('SET\x20PRIORITY\x20%s',_0x44e177));};AGIChannel['prototype'][_0x0ad4('0xd')]=function(){return this['sendRequest'](_0x0ad4('0x35'));};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x36')]=function(_0x2abfc7,_0x1f0c84){var _0x1bf349=_['isBoolean'](_0x1f0c84)||_[_0x0ad4('0x37')](_0x1f0c84)?_0x1f0c84[_0x0ad4('0x38')]():_0x1f0c84;return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')](_0x0ad4('0x39'),_0x2abfc7,_0x1bf349?_0x1bf349['toString']()[_0x0ad4('0x3a')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x3b')]=function(_0x1e2e23,_0x3ca324){return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')](_0x0ad4('0x3c'),_0x1e2e23,_0x3ca324));};AGIChannel['prototype'][_0x0ad4('0x3d')]=function(_0x1055b6,_0x2ffd1e){return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')](_0x0ad4('0x3e'),_0x1055b6,_0x2ffd1e));};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x3f')]=function(_0x2ba088,_0x6cf405){return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')](_0x0ad4('0x40'),_0x2ba088,_0x6cf405));};AGIChannel[_0x0ad4('0x24')]['continueAt']=function(_0x35df9b,_0x2da8f0,_0xee590d){_0x2da8f0=_0x2da8f0||this[_0x0ad4('0x41')];_0xee590d=_0xee590d||0x1;this[_0x0ad4('0x30')](_0x35df9b);this[_0x0ad4('0x32')](_0x2da8f0);this[_0x0ad4('0x34')](_0xee590d);return this[_0x0ad4('0x2b')](util[_0x0ad4('0x29')](_0x0ad4('0x42'),_0x35df9b,_0x2da8f0,_0xee590d));};AGIChannel[_0x0ad4('0x24')]['getVariable']=function(_0x593ecb){return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')](_0x0ad4('0x43'),_0x593ecb));};AGIChannel['prototype'][_0x0ad4('0x44')]=function(_0x12f42d,_0x5b655d,_0x3e3a4a,_0x2aa94f,_0x503c20,_0x15c74a){_0x5b655d=_0x5b655d||_0x0ad4('0x45');_0x3e3a4a=_0x3e3a4a||'';_0x2aa94f=_0x2aa94f===undefined?-0x1:_0x2aa94f==='-1'?-0x1:_0x2aa94f*0x3e8;_0x503c20=_0x503c20===undefined?'':'s='+_0x503c20;_0x15c74a=_0x15c74a?_0x0ad4('0x46'):'';return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x12f42d,_0x5b655d,_0x3e3a4a,_0x2aa94f,_0x15c74a,_0x503c20));};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x47')]=function(_0x41cb87,_0x1699fb){_0x1699fb=_0x1699fb||'';return this[_0x0ad4('0x25')](util[_0x0ad4('0x29')](_0x0ad4('0x48'),_0x41cb87,_0x1699fb));};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x49')]=function(_0x5298ba){return this[_0x0ad4('0x2c')](_0x0ad4('0x4a'),_0x5298ba);};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x4b')]=function(_0x402ca7){return this[_0x0ad4('0x2c')]('WAIT',_0x402ca7);};AGIChannel[_0x0ad4('0x24')][_0x0ad4('0x19')]=function(_0x28ca12,_0x37c596){this[_0x0ad4('0x2b')](util[_0x0ad4('0x29')](_0x0ad4('0x4c'),_0x28ca12['id'],_0x28ca12[_0x0ad4('0x4d')],_0x37c596));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0ad4('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0d040d0..5ac49b4 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 _0x9c84=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x2621a8,_0x39473d){var _0xb40187=function(_0x49400d){while(--_0x49400d){_0x2621a8['push'](_0x2621a8['shift']());}};_0xb40187(++_0x39473d);}(_0x9c84,0x191));var _0x49c8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9c84[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x49c8('0x0'));var error={'E_AGI_UNDEFINED':_0x49c8('0x1'),'E_AGI_ARGUMENT_PORT':_0x49c8('0x2'),'E_AGI_SERVER_ERROR':_0x49c8('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x49c8('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x49c8('0x5'),'E_AGI_SOCKET_ERROR':_0x49c8('0x6'),'E_AGI_SOCKET_CLOSE':_0x49c8('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x49c8('0x8'),'E_AGI_COMMAND_EMPTY':_0x49c8('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x49c8('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5506e7){var _0x5506e7=_0x5506e7||null,_0x4bbc31=_0x4bbc31||[],_0x4a93c8=0x1,_0x25fd0d='';if(!error[_0x5506e7]){_0x5506e7=_0x49c8('0xb');}_0x4bbc31[_0x49c8('0xc')](error[_0x5506e7]);while(arguments[_0x4a93c8]){_0x4bbc31[_0x49c8('0xc')](arguments[_0x4a93c8]);_0x4a93c8++;}_0x25fd0d=util[_0x49c8('0xd')][_0x49c8('0xe')](util,_0x4bbc31);this['message']=_0x25fd0d;this[_0x49c8('0xf')]=_0x5506e7;}module[_0x49c8('0x10')]=AGIError; \ No newline at end of file +var _0xb7de=['message','name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb7de,0x183));var _0xeb7d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xb7de[_0x5bd426];return _0x23a7eb;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xeb7d('0x0'),'E_AGI_ARGUMENT_PORT':_0xeb7d('0x1'),'E_AGI_SERVER_ERROR':_0xeb7d('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xeb7d('0x3'),'E_AGI_SOCKET_ERROR':_0xeb7d('0x4'),'E_AGI_SOCKET_CLOSE':_0xeb7d('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xeb7d('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xeb7d('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2b1772){var _0x2b1772=_0x2b1772||null,_0x531088=_0x531088||[],_0x39b2ae=0x1,_0x1e2951='';if(!error[_0x2b1772]){_0x2b1772='E_AGI_UNDEFINED';}_0x531088[_0xeb7d('0x8')](error[_0x2b1772]);while(arguments[_0x39b2ae]){_0x531088['push'](arguments[_0x39b2ae]);_0x39b2ae++;}_0x1e2951=util['format']['apply'](util,_0x531088);this[_0xeb7d('0x9')]=_0x1e2951;this[_0xeb7d('0xa')]=_0x2b1772;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 57c8472..3efd648 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 _0x10a4=['ioredis','./error','../../config/environment','redis','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','projectUpdate','exports','lodash','events','EventEmitter'];(function(_0xbf7f20,_0x3f856e){var _0x5dc25d=function(_0x504cae){while(--_0x504cae){_0xbf7f20['push'](_0xbf7f20['shift']());}};_0x5dc25d(++_0x3f856e);}(_0x10a4,0x129));var _0x410a=function(_0x1a286f,_0x374d52){_0x1a286f=_0x1a286f-0x0;var _0x33e8b0=_0x10a4[_0x1a286f];return _0x33e8b0;};'use strict';var _=require(_0x410a('0x0'));var EventEmitter=require(_0x410a('0x1'))[_0x410a('0x2')];var Redis=require(_0x410a('0x3'));var AGIError=require(_0x410a('0x4'));var config=require(_0x410a('0x5'));config[_0x410a('0x6')]=_['defaults'](config[_0x410a('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x410a('0x6')]);sub[_0x410a('0x7')]('agi',function(_0x36bd77){if(_0x36bd77)return eventEmitter[_0x410a('0x8')](_0x410a('0x9'),new AGIError(_0x410a('0xa'),_0x36bd77));});sub['on'](_0x410a('0xb'),function(_0x401410,_0x178075){if(_0x401410!==_0x410a('0xc'))return;try{var _0x43705d=JSON['parse'](_0x178075);eventEmitter[_0x410a('0x8')](_0x410a('0xd'),_0x43705d);}catch(_0x22724f){eventEmitter[_0x410a('0x8')]('error',new AGIError(_0x410a('0xa'),_0x22724f));}});module[_0x410a('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x1d01=['localhost','subscribe','emit','error','message','agi','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','defaults','redis'];(function(_0x3386a6,_0x474678){var _0x362b74=function(_0x2f4fbb){while(--_0x2f4fbb){_0x3386a6['push'](_0x3386a6['shift']());}};_0x362b74(++_0x474678);}(_0x1d01,0x1cc));var _0x11d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d01[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11d0('0x0'));var EventEmitter=require(_0x11d0('0x1'))[_0x11d0('0x2')];var Redis=require(_0x11d0('0x3'));var AGIError=require(_0x11d0('0x4'));var config=require(_0x11d0('0x5'));config['redis']=_[_0x11d0('0x6')](config[_0x11d0('0x7')],{'host':_0x11d0('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x11d0('0x7')]);sub[_0x11d0('0x9')]('agi',function(_0x5c4efe){if(_0x5c4efe)return eventEmitter[_0x11d0('0xa')](_0x11d0('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x5c4efe));});sub['on'](_0x11d0('0xc'),function(_0x2ee48c,_0x57a4d6){if(_0x2ee48c!==_0x11d0('0xd'))return;try{var _0x5c4c95=JSON[_0x11d0('0xe')](_0x57a4d6);eventEmitter[_0x11d0('0xa')](_0x11d0('0xf'),_0x5c4c95);}catch(_0x783b50){eventEmitter['emit']('error',new AGIError(_0x11d0('0x10'),_0x783b50));}});module[_0x11d0('0x11')]={'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 da94dfe..f4f052a 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 _0x453d=['edges','numberOfEdges','prototype','addVertex','addEdge','size','getVertex','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','menu','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','getdigits','getsecretdigits','vertices'];(function(_0x45cce8,_0x350b5a){var _0x79a561=function(_0x32f167){while(--_0x32f167){_0x45cce8['push'](_0x45cce8['shift']());}};_0x79a561(++_0x350b5a);}(_0x453d,0x1cc));var _0xd453=function(_0x4f18af,_0xe0ed72){_0x4f18af=_0x4f18af-0x0;var _0x1693cb=_0x453d[_0x4f18af];return _0x1693cb;};'use strict';var _=require(_0xd453('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=['menu',_0xd453('0x1'),_0xd453('0x2')];var Graph=function(){this[_0xd453('0x3')]={};this[_0xd453('0x4')]={};this[_0xd453('0x5')]=0x0;};Graph[_0xd453('0x6')][_0xd453('0x7')]=function(_0xfc6e22){this[_0xd453('0x3')][_0xfc6e22['id']]=_0xfc6e22;this[_0xd453('0x4')][_0xfc6e22['id']]=[];};Graph[_0xd453('0x6')][_0xd453('0x8')]=function(_0x181a63,_0x3edcb1,_0x13a0b2){this['edges'][_0x181a63]['push']({'target':_0x3edcb1,'condition':_0x13a0b2});this['numberOfEdges']+=0x1;};Graph['prototype']['size']=function(){return _[_0xd453('0x9')](this['vertices']);};Graph['prototype']['relations']=function(){return this[_0xd453('0x5')];};Graph[_0xd453('0x6')][_0xd453('0xa')]=function(_0x30a4c6){return this[_0xd453('0x3')][_0x30a4c6];};Graph[_0xd453('0x6')]['traverseBFS']=function(_0x1913eb,_0x3b8e96){if(!this[_0xd453('0x3')][_0x1913eb]){return logger[_0xd453('0xb')](_0xd453('0xc'));}var _0x259253=_0x3b8e96(this[_0xd453('0x3')][_0x1913eb]);if(!_0x259253){return logger['info']('stop\x20traverse');}if(this['edges'][_0x1913eb][_0xd453('0xd')]===0x0){return logger[_0xd453('0xb')](_0xd453('0xe'));}for(var _0x2520db=0x0,_0x2fc76d=[],_0x5524b8=![];_0x2520db\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','stack','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','production','initialize','getLicense','then','voice','callysquare','getAll','[LICENSE]','./server','listening','connection','lodash','syncho','../../config/environment','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','nextTick','error','findIndex','deleted','splice'];(function(_0x4ad355,_0x433598){var _0x40acfd=function(_0x305e29){while(--_0x305e29){_0x4ad355['push'](_0x4ad355['shift']());}};_0x40acfd(++_0x433598);}(_0xb56b,0x12f));var _0xbb56=function(_0x3be82c,_0x3307d7){_0x3be82c=_0x3be82c-0x0;var _0x40d25a=_0xb56b[_0x3be82c];return _0x40d25a;};'use strict';var _=require(_0xbb56('0x0'));var syncho=require(_0xbb56('0x1'));var util=require('util');var config=require(_0xbb56('0x2'));var logger=require('../../config/logger')(_0xbb56('0x3'));var utilLicense=require(_0xbb56('0x4'));var rpc=require(_0xbb56('0x5'));var Project=require('./project');var AGIEmitter=require(_0xbb56('0x6'))[_0xbb56('0x7')];var projects=[];config[_0xbb56('0x3')]=_[_0xbb56('0x8')](config['agi'],{'ip':_0xbb56('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0xf8c874){process[_0xbb56('0xa')](function(){syncho(function(){try{setChannelVariables(_0xf8c874);agiHandler(_0xf8c874);}catch(_0x508396){logger[_0xbb56('0xb')](_0x508396['stack']);}});});}function projectUpdateHandler(_0xe7be17){try{var _0x3ff27e=_[_0xbb56('0xc')](projects,['id',_0xe7be17['id']]);if(_0x3ff27e>-0x1){if(_0xe7be17[_0xbb56('0xd')]===!![]){projects[_0xbb56('0xe')](_0x3ff27e,0x1);}else{projects[_0x3ff27e]=_0xe7be17;}}else{projects['push'](_0xe7be17);}}catch(_0x523071){logger[_0xbb56('0xb')](_0x523071['stack']);}}function listeningHandler(){console[_0xbb56('0xf')](_0xbb56('0x10'),config[_0xbb56('0x3')][_0xbb56('0x11')]);logger[_0xbb56('0x12')](util[_0xbb56('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xbb56('0x3')]['ip'],config['agi'][_0xbb56('0x11')]));}function errorHandler(_0x151a46){if(_0x151a46&&_0x151a46[_0xbb56('0x14')]&&_0x151a46[_0xbb56('0x15')]){logger[_0xbb56('0xb')](util['format']('[%s]\x20%s',_0x151a46['name'],_0x151a46[_0xbb56('0x15')]));}else{logger['error'](util[_0xbb56('0x13')]('[ERROR]\x20%s',_0x151a46['stack']));}}function closeHandler(){logger['info'](util[_0xbb56('0x13')](_0xbb56('0x16'),this['arg_1'],this['calleridname'],this[_0xbb56('0x17')],this[_0xbb56('0x18')],this[_0xbb56('0x19')]));try{createSquareReport(this);}catch(_0x3a5fc9){logger[_0xbb56('0xb')](_0x3a5fc9[_0xbb56('0x1a')]);}}function timeoutHandler(){logger[_0xbb56('0x12')](util[_0xbb56('0x13')](_0xbb56('0x1b'),this[_0xbb56('0x1c')],this[_0xbb56('0x1d')],this['callerid'],this[_0xbb56('0x18')],this[_0xbb56('0x19')]));}function hangupHandler(){logger[_0xbb56('0x12')](util[_0xbb56('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xbb56('0x1c')],this[_0xbb56('0x1d')],this['callerid'],this[_0xbb56('0x18')],this[_0xbb56('0x19')]));this[_0xbb56('0x1e')]=!![];}function createSquareReport(_0x83a4b4,_0x2953d7){rpc[_0xbb56('0x1f')](_0x83a4b4)['then'](function(_0x1387c3){if(_0x2953d7){_0x2953d7(null,_0x1387c3);}})[_0xbb56('0x20')](function(_0x24adc1){if(_0x2953d7){_0x2953d7(null,_0x24adc1);}});}function setChannelVariables(_0x18ae7b){for(var _0x3d6891 in _0x18ae7b){if(_0x18ae7b[_0xbb56('0x21')](_0x3d6891)){if(_0x3d6891[_0xbb56('0x22')](_0xbb56('0x23'))===0x0){_0x18ae7b[_0x3d6891[_0xbb56('0x24')](0x4)]=_0x18ae7b[_0x3d6891];delete _0x18ae7b[_0x3d6891];}}}}function agiHandler(_0x163ea7){logger[_0xbb56('0x25')](_0xbb56('0x26'),JSON[_0xbb56('0x27')](_0x163ea7,null,0x2));logger[_0xbb56('0x12')](util[_0xbb56('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x163ea7[_0xbb56('0x1c')],_0x163ea7['calleridname'],_0x163ea7['callerid'],_0x163ea7[_0xbb56('0x18')],_0x163ea7['uniqueid']));_0x163ea7['on'](_0xbb56('0xb'),errorHandler);_0x163ea7['on'](_0xbb56('0x28'),closeHandler);_0x163ea7['on'](_0xbb56('0x29'),timeoutHandler);_0x163ea7[_0xbb56('0x1e')]=![];_0x163ea7['on']('hangup',hangupHandler);var _0x2b05c1=_['find'](projects,[_0xbb56('0x14'),_0x163ea7[_0xbb56('0x1c')]]);if(!_0x2b05c1)return Project['handleNotFound'](_0x163ea7);if(!_0x2b05c1[_0xbb56('0x2a')])return Project['handleUnpublished'](_0x163ea7);return Project[_0xbb56('0x2b')](_0x2b05c1,_0x163ea7);}function main(){var _0xd01b85;return utilLicense[_0xbb56('0x2c')]()[_0xbb56('0x2d')](function(_0x2e2ebe){if(!_0x2e2ebe)return;if(_0x2e2ebe[_0xbb56('0x2e')]){if(_0x2e2ebe[_0xbb56('0x2f')]&&_0x2e2ebe['callysquare']>0x0){logger[_0xbb56('0x12')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x2e2ebe[_0xbb56('0x2f')]));_0xd01b85=_0x2e2ebe[_0xbb56('0x2f')];}else{logger[_0xbb56('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xbb56('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0xd01b85=-0x1;}})[_0xbb56('0x2d')](function(){return Project[_0xbb56('0x30')]();})['then'](function(_0x18d090){projects=_0x18d090;return;})[_0xbb56('0x20')](function(_0x560157){logger[_0xbb56('0xb')](_0xbb56('0x31'),_0x560157[_0xbb56('0x1a')]);})['finally'](function(){var _0x5761d9=require(_0xbb56('0x32'))(config['agi'][_0xbb56('0x11')],config[_0xbb56('0x3')]['ip'],_0xd01b85);_0x5761d9['on'](_0xbb56('0xb'),errorHandler);_0x5761d9['on'](_0xbb56('0x33'),listeningHandler);_0x5761d9['on'](_0xbb56('0x34'),connectionHandler);_0x5761d9['on'](_0xbb56('0x28'),closeHandler);});}main(); \ No newline at end of file +var _0xb95c=['./server','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','findIndex','deleted','splice','push','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','error','format','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','hangup','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally'];(function(_0x22cf51,_0x4510ba){var _0x293d6e=function(_0x4f15ff){while(--_0x4f15ff){_0x22cf51['push'](_0x22cf51['shift']());}};_0x293d6e(++_0x4510ba);}(_0xb95c,0xbe));var _0xcb95=function(_0x1b6754,_0x35b962){_0x1b6754=_0x1b6754-0x0;var _0x215595=_0xb95c[_0x1b6754];return _0x215595;};'use strict';var _=require(_0xcb95('0x0'));var syncho=require(_0xcb95('0x1'));var util=require('util');var config=require(_0xcb95('0x2'));var logger=require(_0xcb95('0x3'))(_0xcb95('0x4'));var utilLicense=require(_0xcb95('0x5'));var rpc=require(_0xcb95('0x6'));var Project=require(_0xcb95('0x7'));var AGIEmitter=require(_0xcb95('0x8'))[_0xcb95('0x9')];var projects=[];config[_0xcb95('0x4')]=_[_0xcb95('0xa')](config[_0xcb95('0x4')],{'ip':_0xcb95('0xb'),'port':0x11dd});AGIEmitter['on'](_0xcb95('0xc'),projectUpdateHandler);function connectionHandler(_0x40b3e1){process[_0xcb95('0xd')](function(){syncho(function(){try{setChannelVariables(_0x40b3e1);agiHandler(_0x40b3e1);}catch(_0x2d9305){logger['error'](_0x2d9305['stack']);}});});}function projectUpdateHandler(_0x57352a){try{var _0x4905a6=_[_0xcb95('0xe')](projects,['id',_0x57352a['id']]);if(_0x4905a6>-0x1){if(_0x57352a[_0xcb95('0xf')]===!![]){projects[_0xcb95('0x10')](_0x4905a6,0x1);}else{projects[_0x4905a6]=_0x57352a;}}else{projects[_0xcb95('0x11')](_0x57352a);}}catch(_0x330dd2){logger['error'](_0x330dd2[_0xcb95('0x12')]);}}function listeningHandler(){console[_0xcb95('0x13')](_0xcb95('0x14'),config[_0xcb95('0x4')][_0xcb95('0x15')]);logger[_0xcb95('0x16')](util['format'](_0xcb95('0x17'),config[_0xcb95('0x4')]['ip'],config['agi'][_0xcb95('0x15')]));}function errorHandler(_0x3ed712){if(_0x3ed712&&_0x3ed712['name']&&_0x3ed712['message']){logger[_0xcb95('0x18')](util[_0xcb95('0x19')]('[%s]\x20%s',_0x3ed712[_0xcb95('0x1a')],_0x3ed712['message']));}else{logger[_0xcb95('0x18')](util[_0xcb95('0x19')](_0xcb95('0x1b'),_0x3ed712[_0xcb95('0x12')]));}}function closeHandler(){logger['info'](util['format'](_0xcb95('0x1c'),this[_0xcb95('0x1d')],this[_0xcb95('0x1e')],this[_0xcb95('0x1f')],this[_0xcb95('0x20')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5b9320){logger[_0xcb95('0x18')](_0x5b9320[_0xcb95('0x12')]);}}function timeoutHandler(){logger['info'](util[_0xcb95('0x19')](_0xcb95('0x21'),this[_0xcb95('0x1d')],this['calleridname'],this['callerid'],this['dnid'],this[_0xcb95('0x22')]));}function hangupHandler(){logger[_0xcb95('0x16')](util[_0xcb95('0x19')](_0xcb95('0x23'),this[_0xcb95('0x1d')],this['calleridname'],this[_0xcb95('0x1f')],this[_0xcb95('0x20')],this[_0xcb95('0x22')]));this[_0xcb95('0x24')]=!![];}function createSquareReport(_0x18047b,_0x32eb9e){rpc['createSquareReport'](_0x18047b)[_0xcb95('0x25')](function(_0xa13712){if(_0x32eb9e){_0x32eb9e(null,_0xa13712);}})[_0xcb95('0x26')](function(_0x26bd96){if(_0x32eb9e){_0x32eb9e(null,_0x26bd96);}});}function setChannelVariables(_0x2d6d41){for(var _0x7e0bea in _0x2d6d41){if(_0x2d6d41[_0xcb95('0x27')](_0x7e0bea)){if(_0x7e0bea[_0xcb95('0x28')](_0xcb95('0x29'))===0x0){_0x2d6d41[_0x7e0bea[_0xcb95('0x2a')](0x4)]=_0x2d6d41[_0x7e0bea];delete _0x2d6d41[_0x7e0bea];}}}}function agiHandler(_0x7fa299){logger[_0xcb95('0x2b')](_0xcb95('0x2c'),JSON[_0xcb95('0x2d')](_0x7fa299,null,0x2));logger[_0xcb95('0x16')](util[_0xcb95('0x19')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x7fa299[_0xcb95('0x1d')],_0x7fa299[_0xcb95('0x1e')],_0x7fa299[_0xcb95('0x1f')],_0x7fa299[_0xcb95('0x20')],_0x7fa299[_0xcb95('0x22')]));_0x7fa299['on'](_0xcb95('0x18'),errorHandler);_0x7fa299['on'](_0xcb95('0x2e'),closeHandler);_0x7fa299['on'](_0xcb95('0x2f'),timeoutHandler);_0x7fa299[_0xcb95('0x24')]=![];_0x7fa299['on'](_0xcb95('0x30'),hangupHandler);var _0x44c3a5=_[_0xcb95('0x31')](projects,['name',_0x7fa299['arg_1']]);if(!_0x44c3a5)return Project[_0xcb95('0x32')](_0x7fa299);if(!_0x44c3a5[_0xcb95('0x33')])return Project['handleUnpublished'](_0x7fa299);return Project[_0xcb95('0x34')](_0x44c3a5,_0x7fa299);}function main(){var _0x497be7;return utilLicense[_0xcb95('0x35')]()[_0xcb95('0x25')](function(_0x429fad){if(!_0x429fad)return;if(_0x429fad[_0xcb95('0x36')]){if(_0x429fad[_0xcb95('0x37')]&&_0x429fad[_0xcb95('0x37')]>0x0){logger[_0xcb95('0x16')](util[_0xcb95('0x19')](_0xcb95('0x38'),_0x429fad['callysquare']));_0x497be7=_0x429fad[_0xcb95('0x37')];}else{logger[_0xcb95('0x16')](_0xcb95('0x39'));}}else{logger[_0xcb95('0x16')](_0xcb95('0x3a'));_0x497be7=-0x1;}})[_0xcb95('0x25')](function(){return Project[_0xcb95('0x3b')]();})[_0xcb95('0x25')](function(_0x22b7e0){projects=_0x22b7e0;return;})[_0xcb95('0x26')](function(_0x4770db){logger[_0xcb95('0x18')](_0xcb95('0x3c'),_0x4770db[_0xcb95('0x12')]);})[_0xcb95('0x3d')](function(){var _0x571a93=require(_0xcb95('0x3e'))(config[_0xcb95('0x4')][_0xcb95('0x15')],config[_0xcb95('0x4')]['ip'],_0x497be7);_0x571a93['on'](_0xcb95('0x18'),errorHandler);_0x571a93['on']('listening',listeningHandler);_0x571a93['on']('connection',connectionHandler);_0x571a93['on']('close',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 8b1f139..088271f 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 _0x9791=['http','request','then','error','message','result','catch','SendMail','bluebird','jayson/promise'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x9791,0x1e8));var _0x1979=function(_0x3907e2,_0x5bff31){_0x3907e2=_0x3907e2-0x0;var _0x3221a1=_0x9791[_0x3907e2];return _0x3221a1;};'use strict';var BPromise=require(_0x1979('0x0'));var jayson=require(_0x1979('0x1'));var client=jayson['client'][_0x1979('0x2')]({'port':0x232b});function request(_0x2b3eed,_0x5755d2){return new BPromise(function(_0x55132a,_0x338ea9){return client[_0x1979('0x3')](_0x2b3eed,_0x5755d2)[_0x1979('0x4')](function(_0x4c8992){if(_0x4c8992[_0x1979('0x5')]){return _0x338ea9(_0x4c8992['error'][_0x1979('0x6')]);}else{return _0x55132a(_0x4c8992[_0x1979('0x7')]);}})[_0x1979('0x8')](function(_0x374a90){return _0x338ea9(_0x374a90);});});}exports['sendMailMessage']=function(_0x12ba58,_0x2df159){return request(_0x1979('0x9'),{'account':_0x12ba58,'message':_0x2df159});}; \ No newline at end of file +var _0x82ec=['jayson/promise','client','http','error','catch','sendMailMessage','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x82ec,0x180));var _0xc82e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x82ec[_0x17d9e3];return _0x14192d;};'use strict';var BPromise=require(_0xc82e('0x0'));var jayson=require(_0xc82e('0x1'));var client=jayson[_0xc82e('0x2')][_0xc82e('0x3')]({'port':0x232b});function request(_0x4a73ae,_0x49ed30){return new BPromise(function(_0x4ad909,_0x34d4f7){return client['request'](_0x4a73ae,_0x49ed30)['then'](function(_0x28c142){if(_0x28c142[_0xc82e('0x4')]){return _0x34d4f7(_0x28c142[_0xc82e('0x4')]['message']);}else{return _0x4ad909(_0x28c142['result']);}})[_0xc82e('0x5')](function(_0x56c586){return _0x34d4f7(_0x56c586);});});}exports[_0xc82e('0x6')]=function(_0x50a6e3,_0x2c0fb8){return request('SendMail',{'account':_0x50a6e3,'message':_0x2c0fb8});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 31d7847..0a05c2b 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 _0x8bae=['agicommand','hasOwnProperty','maxRetry','retry','addVertex','mxCell','length','source','target','addEdge','toJson','root','production','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','info','context','extension','priority','response','code','result','evtHangup','isUndefined','agicommand\x20not\x20found','stack','finally','[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','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects'];(function(_0x5a125c,_0x155fa2){var _0x4c70af=function(_0x5dccb6){while(--_0x5dccb6){_0x5a125c['push'](_0x5a125c['shift']());}};_0x4c70af(++_0x155fa2);}(_0x8bae,0x1c5));var _0xe8ba=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8bae[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var moment=require(_0xe8ba('0x0'));var parser=require(_0xe8ba('0x1'));var util=require(_0xe8ba('0x2'));var logger=require(_0xe8ba('0x3'))(_0xe8ba('0x4'));var rpc=require(_0xe8ba('0x5'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xe8ba('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe8ba('0x7')]()[_0xe8ba('0x8')](function(_0x54fcc4){logger[_0xe8ba('0x9')](_0xe8ba('0xa'),_0x54fcc4['stack']);return[];});}function addVertex(_0x2a978a,_0x55d911,_0x3d81b5){_0x55d911[_0xe8ba('0xb')]=_0x3d81b5;if(_0x55d911[_0xe8ba('0xc')]('retry')){_0x55d911[_0xe8ba('0xd')]=parseInt(_0x55d911[_0xe8ba('0xe')],0xa);}_0x2a978a[_0xe8ba('0xf')](_['omit'](_0x55d911,_0xe8ba('0x10')));}function initGraph(_0x549e67,_0x1bddeb){var _0x1bb5ea=new Graph();for(var _0x57053a in _0x549e67){if(_0x549e67['hasOwnProperty'](_0x57053a)){if(_['isArray'](_0x549e67[_0x57053a])){for(var _0x26e086=0x0;_0x26e086<_0x549e67[_0x57053a]['length'];_0x26e086+=0x1){addVertex(_0x1bb5ea,_0x549e67[_0x57053a][_0x26e086],_0x57053a);}}else{addVertex(_0x1bb5ea,_0x549e67[_0x57053a],_0x57053a);}}}for(var _0xb0ce20=0x0;_0xb0ce20<_0x1bddeb[_0xe8ba('0x11')];_0xb0ce20+=0x1){if(_0x1bddeb[_0xb0ce20][_0xe8ba('0x12')]&&_0x1bddeb[_0xb0ce20][_0xe8ba('0x13')]){_0x1bb5ea[_0xe8ba('0x14')](_0x1bddeb[_0xb0ce20][_0xe8ba('0x12')],_0x1bddeb[_0xb0ce20][_0xe8ba('0x13')],_0x1bddeb[_0xb0ce20]['value']);}}return _0x1bb5ea;}function getRoot(_0x1f0661){return parser[_0xe8ba('0x15')](_0x1f0661,{'object':!![]})['mxGraphModel'][_0xe8ba('0x16')];}function inspect(_0x367029){return util['inspect'](_0x367029,{'showHidden':![],'depth':null});}function initialize(_0x4dc04b,_0x1564e8){var _0x34d3c4=getRoot(_0x4dc04b[_0xe8ba('0x17')]);if(!_0x34d3c4||!_0x34d3c4['start'])return;var _0x1f4908,_0x436089,_0x34a8a2;logger[_0xe8ba('0x18')]('root',JSON[_0xe8ba('0x19')](_0x34d3c4,null,0x2));_0x1564e8['joinAt']=moment()[_0xe8ba('0x1a')](_0xe8ba('0x1b'));_0x1f4908=initGraph(_[_0xe8ba('0x1c')](_0x34d3c4,'mxCell'),_0x34d3c4[_0xe8ba('0x10')]);_0x436089=new Vertices(_0x1564e8,rpc,mailRpc);logger['info'](util['format'](_0xe8ba('0x1d'),_0x1564e8[_0xe8ba('0x1e')],_0x1564e8[_0xe8ba('0x1f')],_0x1564e8[_0xe8ba('0x20')],_0x1564e8[_0xe8ba('0x21')],_0x1564e8[_0xe8ba('0x22')]));_0x1f4908[_0xe8ba('0x23')](_0x34d3c4['start']['id'],function(_0x1045d){try{_0x1045d=_0x436089[_0xe8ba('0x24')](_0x1045d);logger[_0xe8ba('0x18')](_0xe8ba('0x25'),JSON[_0xe8ba('0x19')](_0x1045d,null,0x2));if(_0x1045d[_0xe8ba('0xb')]===_0xe8ba('0x26')){logger[_0xe8ba('0x27')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1564e8[_0xe8ba('0x28')]=_0x1045d[_0xe8ba('0x28')]||_0x1564e8[_0xe8ba('0x28')];_0x1564e8[_0xe8ba('0x29')]=_0x1045d[_0xe8ba('0x29')];_0x1564e8[_0xe8ba('0x2a')]=_0x1045d['priority']?_0x1045d['priority']-0x1:0x1;return null;}else if(_0x1045d&&_0x436089[_0x1045d[_0xe8ba('0xb')]]){_0x34a8a2=_0x436089[_0x1045d[_0xe8ba('0xb')]](_0x1045d);logger['info'](_0xe8ba('0x2b'),JSON[_0xe8ba('0x19')](_0x34a8a2,null,0x2));if(_0x34a8a2&&_0x34a8a2[_0xe8ba('0x2c')]===AGI_CODE_SUCCESS&&_0x34a8a2[_0xe8ba('0x2d')]!==AGI_RESULT_ERROR&&!_0x1564e8[_0xe8ba('0x2e')]){logger[_0xe8ba('0x18')](_0xe8ba('0x2b'),inspect(_0x34a8a2));return _[_0xe8ba('0x2f')](_0x34a8a2['result'])?null:_0x34a8a2[_0xe8ba('0x2d')]['toString']();}else{logger[_0xe8ba('0x9')]('response',inspect(_0x34a8a2));return null;}}else{logger['error'](_0xe8ba('0x30'));return null;}}catch(_0x59de7f){logger[_0xe8ba('0x9')](_0x59de7f[_0xe8ba('0x31')]);return null;}});if(_0x34d3c4[_0xe8ba('0x32')]){logger[_0xe8ba('0x27')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1564e8[_0xe8ba('0x1e')],_0x1564e8[_0xe8ba('0x1f')],_0x1564e8[_0xe8ba('0x20')],_0x1564e8[_0xe8ba('0x21')],_0x1564e8['uniqueid']));_0x1f4908['traverseBFS'](_0x34d3c4['finally']['id'],function(_0x15882b){try{_0x15882b=_0x436089[_0xe8ba('0x24')](_0x15882b);logger[_0xe8ba('0x18')]('vertex',JSON[_0xe8ba('0x19')](_0x15882b,null,0x2));if(_0x15882b&&_0x436089[_0x15882b[_0xe8ba('0xb')]]){_0x34a8a2=_0x436089[_0x15882b['agicommand']](_0x15882b);if(_0x34a8a2){logger[_0xe8ba('0x18')](_0xe8ba('0x2b'),inspect(_0x34a8a2));return _['isUndefined'](_0x34a8a2[_0xe8ba('0x2d')])?null:_0x34a8a2[_0xe8ba('0x2d')]['toString']();}else{logger[_0xe8ba('0x9')](_0xe8ba('0x2b'),inspect(_0x34a8a2));return null;}}else{logger[_0xe8ba('0x9')](_0xe8ba('0x30'));return null;}}catch(_0x5550f9){logger[_0xe8ba('0x9')](_0x5550f9['stack']);return null;}});}logger['info'](util[_0xe8ba('0x1a')](_0xe8ba('0x33'),_0x1564e8['arg_1'],_0x1564e8['calleridname'],_0x1564e8[_0xe8ba('0x20')],_0x1564e8[_0xe8ba('0x21')],_0x1564e8['uniqueid']));logger[_0xe8ba('0x27')](util['format'](_0xe8ba('0x34'),_0x1564e8['context'],_0x1564e8['extension'],parseInt(_0x1564e8['priority'],0xa)+0x1));_0x1564e8['continueAt'](_0x1564e8[_0xe8ba('0x28')],_0x1564e8[_0xe8ba('0x29')],parseInt(_0x1564e8[_0xe8ba('0x2a')],0xa)+0x1);_0x1564e8[_0xe8ba('0x35')]();}function handleNotFound(_0x3572a4){logger['error'](util[_0xe8ba('0x1a')](_0xe8ba('0x36'),_0x3572a4['arg_1']));_0x3572a4[_0xe8ba('0x37')](_0x3572a4['context'],_0x3572a4['extension'],parseInt(_0x3572a4[_0xe8ba('0x2a')],0xa)+0x1);_0x3572a4['close']();}function handleUnpublished(_0x8dc7bd){logger['error'](util[_0xe8ba('0x1a')](_0xe8ba('0x38'),_0x8dc7bd[_0xe8ba('0x1e')]));_0x8dc7bd['continueAt'](_0x8dc7bd[_0xe8ba('0x28')],_0x8dc7bd['extension'],parseInt(_0x8dc7bd[_0xe8ba('0x2a')],0xa)+0x1);_0x8dc7bd[_0xe8ba('0x35')]();}module[_0xe8ba('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xf5ec=['[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','./rpc','./mailRpc','./graph','./vertices','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','maxRetry','retry','addVertex','omit','hasOwnProperty','length','source','target','toJson','mxGraphModel','root','inspect','production','start','stringify','joinAt','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','callerid','dnid','traverseBFS','clear','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','error','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','finally','isUndefined','agicommand\x20not\x20found'];(function(_0x2b975e,_0x20fde9){var _0xbb9b42=function(_0x2dfd52){while(--_0x2dfd52){_0x2b975e['push'](_0x2b975e['shift']());}};_0xbb9b42(++_0x20fde9);}(_0xf5ec,0xf6));var _0xcf5e=function(_0x122a24,_0x3a8446){_0x122a24=_0x122a24-0x0;var _0x50a30d=_0xf5ec[_0x122a24];return _0x50a30d;};'use strict';var _=require(_0xcf5e('0x0'));var moment=require('moment');var parser=require(_0xcf5e('0x1'));var util=require(_0xcf5e('0x2'));var logger=require(_0xcf5e('0x3'))('agi');var rpc=require(_0xcf5e('0x4'));var mailRpc=require(_0xcf5e('0x5'));var Graph=require(_0xcf5e('0x6'));var Vertices=require(_0xcf5e('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x371f17){logger['error'](_0xcf5e('0x8'),_0x371f17[_0xcf5e('0x9')]);return[];});}function addVertex(_0x475e58,_0x43c889,_0x2c3faa){_0x43c889[_0xcf5e('0xa')]=_0x2c3faa;if(_0x43c889['hasOwnProperty']('retry')){_0x43c889[_0xcf5e('0xb')]=parseInt(_0x43c889[_0xcf5e('0xc')],0xa);}_0x475e58[_0xcf5e('0xd')](_[_0xcf5e('0xe')](_0x43c889,'mxCell'));}function initGraph(_0x116bbc,_0x460ee0){var _0x10cae2=new Graph();for(var _0x42c6a3 in _0x116bbc){if(_0x116bbc[_0xcf5e('0xf')](_0x42c6a3)){if(_['isArray'](_0x116bbc[_0x42c6a3])){for(var _0x415416=0x0;_0x415416<_0x116bbc[_0x42c6a3][_0xcf5e('0x10')];_0x415416+=0x1){addVertex(_0x10cae2,_0x116bbc[_0x42c6a3][_0x415416],_0x42c6a3);}}else{addVertex(_0x10cae2,_0x116bbc[_0x42c6a3],_0x42c6a3);}}}for(var _0x41beae=0x0;_0x41beae<_0x460ee0[_0xcf5e('0x10')];_0x41beae+=0x1){if(_0x460ee0[_0x41beae][_0xcf5e('0x11')]&&_0x460ee0[_0x41beae][_0xcf5e('0x12')]){_0x10cae2['addEdge'](_0x460ee0[_0x41beae][_0xcf5e('0x11')],_0x460ee0[_0x41beae][_0xcf5e('0x12')],_0x460ee0[_0x41beae]['value']);}}return _0x10cae2;}function getRoot(_0x11546b){return parser[_0xcf5e('0x13')](_0x11546b,{'object':!![]})[_0xcf5e('0x14')][_0xcf5e('0x15')];}function inspect(_0x4325ce){return util[_0xcf5e('0x16')](_0x4325ce,{'showHidden':![],'depth':null});}function initialize(_0x31a46c,_0x316257){var _0x304002=getRoot(_0x31a46c[_0xcf5e('0x17')]);if(!_0x304002||!_0x304002[_0xcf5e('0x18')])return;var _0x28599a,_0x29a4a4,_0x45f052;logger['debug'](_0xcf5e('0x15'),JSON[_0xcf5e('0x19')](_0x304002,null,0x2));_0x316257[_0xcf5e('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x28599a=initGraph(_['omit'](_0x304002,_0xcf5e('0x1b')),_0x304002['mxCell']);_0x29a4a4=new Vertices(_0x316257,rpc,mailRpc);logger[_0xcf5e('0x1c')](util[_0xcf5e('0x1d')](_0xcf5e('0x1e'),_0x316257[_0xcf5e('0x1f')],_0x316257['calleridname'],_0x316257[_0xcf5e('0x20')],_0x316257[_0xcf5e('0x21')],_0x316257['uniqueid']));_0x28599a[_0xcf5e('0x22')](_0x304002[_0xcf5e('0x18')]['id'],function(_0x1014da){try{_0x1014da=_0x29a4a4[_0xcf5e('0x23')](_0x1014da);logger[_0xcf5e('0x24')](_0xcf5e('0x25'),JSON[_0xcf5e('0x19')](_0x1014da,null,0x2));if(_0x1014da[_0xcf5e('0xa')]===_0xcf5e('0x26')){logger[_0xcf5e('0x1c')](_0xcf5e('0x27'));_0x316257[_0xcf5e('0x28')]=_0x1014da['context']||_0x316257['context'];_0x316257[_0xcf5e('0x29')]=_0x1014da[_0xcf5e('0x29')];_0x316257[_0xcf5e('0x2a')]=_0x1014da[_0xcf5e('0x2a')]?_0x1014da[_0xcf5e('0x2a')]-0x1:0x1;return null;}else if(_0x1014da&&_0x29a4a4[_0x1014da[_0xcf5e('0xa')]]){_0x45f052=_0x29a4a4[_0x1014da[_0xcf5e('0xa')]](_0x1014da);logger[_0xcf5e('0x1c')]('response',JSON[_0xcf5e('0x19')](_0x45f052,null,0x2));if(_0x45f052&&_0x45f052[_0xcf5e('0x2b')]===AGI_CODE_SUCCESS&&_0x45f052[_0xcf5e('0x2c')]!==AGI_RESULT_ERROR&&!_0x316257[_0xcf5e('0x2d')]){logger['debug'](_0xcf5e('0x2e'),inspect(_0x45f052));return _['isUndefined'](_0x45f052[_0xcf5e('0x2c')])?null:_0x45f052[_0xcf5e('0x2c')]['toString']();}else{logger[_0xcf5e('0x2f')](_0xcf5e('0x2e'),inspect(_0x45f052));return null;}}else{logger[_0xcf5e('0x2f')]('agicommand\x20not\x20found');return null;}}catch(_0x21bd6a){logger[_0xcf5e('0x2f')](_0x21bd6a[_0xcf5e('0x9')]);return null;}});if(_0x304002['finally']){logger['info'](util[_0xcf5e('0x1d')](_0xcf5e('0x30'),_0x316257['arg_1'],_0x316257[_0xcf5e('0x31')],_0x316257[_0xcf5e('0x20')],_0x316257[_0xcf5e('0x21')],_0x316257[_0xcf5e('0x32')]));_0x28599a[_0xcf5e('0x22')](_0x304002[_0xcf5e('0x33')]['id'],function(_0x94b54){try{_0x94b54=_0x29a4a4[_0xcf5e('0x23')](_0x94b54);logger[_0xcf5e('0x24')]('vertex',JSON['stringify'](_0x94b54,null,0x2));if(_0x94b54&&_0x29a4a4[_0x94b54[_0xcf5e('0xa')]]){_0x45f052=_0x29a4a4[_0x94b54[_0xcf5e('0xa')]](_0x94b54);if(_0x45f052){logger[_0xcf5e('0x24')]('response',inspect(_0x45f052));return _[_0xcf5e('0x34')](_0x45f052[_0xcf5e('0x2c')])?null:_0x45f052[_0xcf5e('0x2c')]['toString']();}else{logger[_0xcf5e('0x2f')](_0xcf5e('0x2e'),inspect(_0x45f052));return null;}}else{logger[_0xcf5e('0x2f')](_0xcf5e('0x35'));return null;}}catch(_0x19607f){logger[_0xcf5e('0x2f')](_0x19607f[_0xcf5e('0x9')]);return null;}});}logger[_0xcf5e('0x1c')](util[_0xcf5e('0x1d')](_0xcf5e('0x36'),_0x316257[_0xcf5e('0x1f')],_0x316257['calleridname'],_0x316257[_0xcf5e('0x20')],_0x316257['dnid'],_0x316257[_0xcf5e('0x32')]));logger['info'](util[_0xcf5e('0x1d')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x316257[_0xcf5e('0x28')],_0x316257[_0xcf5e('0x29')],parseInt(_0x316257[_0xcf5e('0x2a')],0xa)+0x1));_0x316257[_0xcf5e('0x37')](_0x316257[_0xcf5e('0x28')],_0x316257[_0xcf5e('0x29')],parseInt(_0x316257[_0xcf5e('0x2a')],0xa)+0x1);_0x316257[_0xcf5e('0x38')]();}function handleNotFound(_0x14408f){logger[_0xcf5e('0x2f')](util[_0xcf5e('0x1d')](_0xcf5e('0x39'),_0x14408f[_0xcf5e('0x1f')]));_0x14408f[_0xcf5e('0x37')](_0x14408f[_0xcf5e('0x28')],_0x14408f['extension'],parseInt(_0x14408f[_0xcf5e('0x2a')],0xa)+0x1);_0x14408f[_0xcf5e('0x38')]();}function handleUnpublished(_0x3cc776){logger[_0xcf5e('0x2f')](util[_0xcf5e('0x1d')](_0xcf5e('0x3a'),_0x3cc776['arg_1']));_0x3cc776[_0xcf5e('0x37')](_0x3cc776[_0xcf5e('0x28')],_0x3cc776[_0xcf5e('0x29')],parseInt(_0x3cc776['priority'],0xa)+0x1);_0x3cc776['close']();}module[_0xcf5e('0x3b')]={'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 9cf34c0..76f336b 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 _0x29c4=['Transform','call','_localBuffer','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','line','exports','util'];(function(_0x412978,_0x338563){var _0xffb348=function(_0x48b78e){while(--_0x48b78e){_0x412978['push'](_0x412978['shift']());}};_0xffb348(++_0x338563);}(_0x29c4,0x155));var _0x429c=function(_0x25a5c2,_0x388137){_0x25a5c2=_0x25a5c2-0x0;var _0x4d134f=_0x29c4[_0x25a5c2];return _0x4d134f;};'use strict';var util=require(_0x429c('0x0'));var Transform=require('stream')[_0x429c('0x1')];function AGIReply(_0x4c1772){Transform[_0x429c('0x2')](this,_0x4c1772);this[_0x429c('0x3')]='';this[_0x429c('0x4')]=![];}util[_0x429c('0x5')](AGIReply,Transform);AGIReply[_0x429c('0x6')]['_transform']=function(_0x1e69c8,_0x502610,_0x130049){var _0x458905='\x0a',_0x23c289=['\x0a\x0a',_0x429c('0x7')],_0x3bd101=-0x1,_0x575b62=-0x1,_0x1d3f5e='',_0x1ae770=0x0,_0x4d8afc='',_0x197e5b='';this[_0x429c('0x3')]+=_0x1e69c8[_0x429c('0x8')]();_0x4d8afc=this[_0x429c('0x3')];if(!this[_0x429c('0x4')]){_0x1ae770=0x0;while(_0x23c289[_0x1ae770]){while((_0x575b62=_0x4d8afc[_0x429c('0x9')](_0x23c289[_0x1ae770]))!=-0x1){_0x1d3f5e=_0x23c289[_0x1ae770];_0x197e5b=_0x4d8afc['substring'](0x0,_0x575b62);_0x4d8afc=_0x4d8afc[_0x429c('0xa')](_0x575b62+_0x1d3f5e[_0x429c('0xb')]);var _0x45e8dd=_0x197e5b[_0x429c('0xc')](_0x458905),_0x444685=0x0,_0x2287ea={},_0x4bde6e='',_0x2ee2af='',_0x4e4052=-0x1;while(_0x45e8dd[_0x444685]){_0x4e4052=_0x45e8dd[_0x444685][_0x429c('0x9')](':');if(_0x4e4052!=-0x1){_0x4bde6e=_0x45e8dd[_0x444685][_0x429c('0xd')](0x0,_0x4e4052)[_0x429c('0xe')]();_0x2ee2af=_0x45e8dd[_0x444685][_0x429c('0xd')](_0x4e4052+0x1)['trim']();if(_0x4bde6e[_0x429c('0xb')]>0x0){_0x2287ea[_0x4bde6e]=_0x2ee2af;}}else{}_0x444685++;}this[_0x429c('0xf')]('headers',_0x2287ea);this[_0x429c('0x4')]=!![];}_0x1ae770++;}this['_localBuffer']=_0x4d8afc;}else{while((_0x3bd101=_0x4d8afc['indexOf'](_0x458905))!=-0x1){_0x197e5b=_0x4d8afc[_0x429c('0xa')](0x0,_0x3bd101);this[_0x429c('0xf')](_0x429c('0x10'),_0x197e5b);_0x4d8afc=_0x4d8afc[_0x429c('0xa')](_0x3bd101+_0x458905['length']);}this[_0x429c('0x3')]=_0x4d8afc;}_0x130049();};module[_0x429c('0x11')]=AGIReply; \ No newline at end of file +var _0xf929=['Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','emit','headers','line','exports','util'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0xf929,0x164));var _0x9f92=function(_0x466503,_0x251570){_0x466503=_0x466503-0x0;var _0x2ee6cf=_0xf929[_0x466503];return _0x2ee6cf;};'use strict';var util=require(_0x9f92('0x0'));var Transform=require('stream')[_0x9f92('0x1')];function AGIReply(_0x239b97){Transform['call'](this,_0x239b97);this[_0x9f92('0x2')]='';this[_0x9f92('0x3')]=![];}util[_0x9f92('0x4')](AGIReply,Transform);AGIReply[_0x9f92('0x5')][_0x9f92('0x6')]=function(_0x3a6e2d,_0x133c2e,_0x2fbe4d){var _0x396372='\x0a',_0x29a770=['\x0a\x0a',_0x9f92('0x7')],_0x77aa18=-0x1,_0x5f343f=-0x1,_0x98a2f5='',_0x2d4115=0x0,_0x11313e='',_0x194cd7='';this[_0x9f92('0x2')]+=_0x3a6e2d['toString']();_0x11313e=this[_0x9f92('0x2')];if(!this[_0x9f92('0x3')]){_0x2d4115=0x0;while(_0x29a770[_0x2d4115]){while((_0x5f343f=_0x11313e[_0x9f92('0x8')](_0x29a770[_0x2d4115]))!=-0x1){_0x98a2f5=_0x29a770[_0x2d4115];_0x194cd7=_0x11313e[_0x9f92('0x9')](0x0,_0x5f343f);_0x11313e=_0x11313e[_0x9f92('0x9')](_0x5f343f+_0x98a2f5[_0x9f92('0xa')]);var _0x11d1c=_0x194cd7[_0x9f92('0xb')](_0x396372),_0x1b5814=0x0,_0xe8fa06={},_0x77d0ca='',_0x27021c='',_0x4ecb67=-0x1;while(_0x11d1c[_0x1b5814]){_0x4ecb67=_0x11d1c[_0x1b5814][_0x9f92('0x8')](':');if(_0x4ecb67!=-0x1){_0x77d0ca=_0x11d1c[_0x1b5814][_0x9f92('0xc')](0x0,_0x4ecb67)['trim']();_0x27021c=_0x11d1c[_0x1b5814][_0x9f92('0xc')](_0x4ecb67+0x1)['trim']();if(_0x77d0ca[_0x9f92('0xa')]>0x0){_0xe8fa06[_0x77d0ca]=_0x27021c;}}else{}_0x1b5814++;}this[_0x9f92('0xd')](_0x9f92('0xe'),_0xe8fa06);this[_0x9f92('0x3')]=!![];}_0x2d4115++;}this[_0x9f92('0x2')]=_0x11313e;}else{while((_0x77aa18=_0x11313e['indexOf'](_0x396372))!=-0x1){_0x194cd7=_0x11313e['substring'](0x0,_0x77aa18);this[_0x9f92('0xd')](_0x9f92('0xf'),_0x194cd7);_0x11313e=_0x11313e[_0x9f92('0x9')](_0x77aa18+_0x396372[_0x9f92('0xa')]);}this['_localBuffer']=_0x11313e;}_0x2fbe4d();};module[_0x9f92('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index b0198fd..db44f0d 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 _0xac9d=['createCmContact','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','http','request','error','message','result','catch','getSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage'];(function(_0x15fc0c,_0x1e023b){var _0x1c9d81=function(_0x174e0b){while(--_0x174e0b){_0x15fc0c['push'](_0x15fc0c['shift']());}};_0x1c9d81(++_0x1e023b);}(_0xac9d,0x14d));var _0xdac9=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xac9d[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0xdac9('0x0'));var moment=require(_0xdac9('0x1'));var jayson=require(_0xdac9('0x2'));var client=jayson[_0xdac9('0x3')][_0xdac9('0x4')]({'port':0x2329});function request(_0x27eb7c,_0x25d1b3){return new Promise(function(_0x1b967e,_0x51a5d7){return client[_0xdac9('0x5')](_0x27eb7c,_0x25d1b3)['then'](function(_0x3d56ae){if(_0x3d56ae[_0xdac9('0x6')]){return _0x51a5d7(_0x3d56ae[_0xdac9('0x6')][_0xdac9('0x7')]);}else{return _0x1b967e(_0x3d56ae[_0xdac9('0x8')]);}})[_0xdac9('0x9')](function(_0x5531af){return _0x51a5d7(_0x5531af);});});}exports[_0xdac9('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xdac9('0xb'),_0xdac9('0xc')]}});};exports[_0xdac9('0xd')]=function(_0x1a4674){return request(_0xdac9('0xe'),{'options':{'raw':![],'where':{'name':_0x1a4674},'attributes':[_0xdac9('0xc')]}});};exports[_0xdac9('0xf')]=function(_0x1b604a){return request(_0xdac9('0x10'),{'options':{'raw':![],'where':{'id':_0x1b604a},'include':[{'model':'MailServerOut','as':_0xdac9('0x11'),'include':[{'model':_0xdac9('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0xdac9('0xb'),_0xdac9('0x13')],'smtp':!![]}});};exports[_0xdac9('0x14')]=function(_0x4b2436){return request(_0xdac9('0xe'),{'options':{'where':{'id':_0x4b2436},'attributes':[_0xdac9('0xb')]}});};exports[_0xdac9('0x15')]=function(_0x5f0bbd){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x5f0bbd},'attributes':[_0xdac9('0xb')]}});};exports[_0xdac9('0x16')]=function(_0x50f9fe){return request(_0xdac9('0x17'),{'options':{'where':{'id':_0x50f9fe},'attributes':[_0xdac9('0xb')]}});};exports[_0xdac9('0x18')]=function(_0x5b2f1b){return request(_0xdac9('0x19'),{'options':{'where':{'id':_0x5b2f1b},'attributes':[_0xdac9('0x1a')]}});};exports[_0xdac9('0x1b')]=function(_0xec1016){return request('ShowUser',{'options':{'where':{'id':_0xec1016},'attributes':[_0xdac9('0xb')]}});};exports[_0xdac9('0x1c')]=function(_0x571e07){return request(_0xdac9('0x1d'),{'options':{'where':{'phone':_0x571e07[_0xdac9('0x1e')]},'attributes':['id']}});};exports[_0xdac9('0x1f')]=function(_0x181d11){return request('ShowTrunk',{'options':{'where':{'id':_0x181d11},'attributes':['name']}});};exports[_0xdac9('0x20')]=function(_0x20ece3){return request(_0xdac9('0x21'),{'options':{'where':{'id':_0x20ece3},'attributes':[_0xdac9('0x22')]}});};exports['getIntervalById']=function(_0x23ee5e){return request(_0xdac9('0x23'),{'options':{'raw':![],'where':{'id':_0x23ee5e},'include':[{'model':_0xdac9('0x24'),'as':_0xdac9('0x25')}]}});};exports[_0xdac9('0x26')]=function(_0x42317c){return request(_0xdac9('0x27'),{'options':{'where':{'id':_0x42317c},'attributes':['id',_0xdac9('0xb')]}});};exports[_0xdac9('0x28')]=function(_0x33de5c){return request('CreateSmsMessage',{'body':_0x33de5c});};exports[_0xdac9('0x29')]=function(_0x11f4fd){return request(_0xdac9('0x2a'),{'body':_0x11f4fd});};exports[_0xdac9('0x2b')]=function(_0x5ca076){return request(_0xdac9('0x2c'),{'body':_['merge'](_0x5ca076,{'project_name':_0x5ca076[_0xdac9('0x2d')],'prev_project_name':_0x5ca076[_0xdac9('0x2e')]||'','is_subproject':_0x5ca076['arg_2']?!![]:![],'leaveAt':moment()[_0xdac9('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xdac9('0x30')]=function(_0x3743f7){return request(_0xdac9('0x31'),{'body':_0x3743f7});};exports[_0xdac9('0x32')]=function(_0x57d76a){return request('CreateSquareMessage',{'body':_0x57d76a});};exports[_0xdac9('0x33')]=function(_0x170afd){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x170afd['phone'],'ListId':_0x170afd[_0xdac9('0x34')]}}})[_0xdac9('0x35')](function(_0x13efba){if(_0x13efba){return _0x13efba;}return request(_0xdac9('0x36'),{'body':_0x170afd});});};exports[_0xdac9('0x37')]=function(_0x2247f8){return request(_0xdac9('0x38'),{'options':{'where':{'id':_0x2247f8},'attributes':[_0xdac9('0xb')]}});};exports[_0xdac9('0x39')]=function(_0x2f36f4,_0xb49c21){return request(_0xdac9('0x3a'),{'body':{'interface':_0xb49c21},'options':{'where':_0x2f36f4}});};exports[_0xdac9('0x3b')]=function(_0x336fd5,_0x410cec,_0x446080){return request(_0xdac9('0x3c'),{'body':{'type':_0x410cec,'uniqueid':_0x446080},'options':{'where':_0x336fd5}});};exports[_0xdac9('0x3d')]=function(_0x339f31){return request(_0xdac9('0x3e'),{'body':{},'options':{'where':_0x339f31}});};exports[_0xdac9('0x3f')]=function(_0x514eee){return request('LogoutUser',{'body':{},'options':{'where':_0x514eee}});}; \ No newline at end of file +var _0x80d9=['getSoundById','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','lodash','jayson/promise','client','http','request','then','error','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','getMailAccountById','MailServerOut','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk'];(function(_0x1b40df,_0x48fbea){var _0x115723=function(_0xefc7c6){while(--_0xefc7c6){_0x1b40df['push'](_0x1b40df['shift']());}};_0x115723(++_0x48fbea);}(_0x80d9,0x15c));var _0x980d=function(_0x260835,_0x5acbf8){_0x260835=_0x260835-0x0;var _0x367977=_0x80d9[_0x260835];return _0x367977;};'use strict';var _=require(_0x980d('0x0'));var moment=require('moment');var jayson=require(_0x980d('0x1'));var client=jayson[_0x980d('0x2')][_0x980d('0x3')]({'port':0x2329});function request(_0x5d4b87,_0x358d0a){return new Promise(function(_0x3a9d1e,_0x38d1b9){return client[_0x980d('0x4')](_0x5d4b87,_0x358d0a)[_0x980d('0x5')](function(_0x4a1d3f){if(_0x4a1d3f['error']){return _0x38d1b9(_0x4a1d3f[_0x980d('0x6')]['message']);}else{return _0x3a9d1e(_0x4a1d3f['result']);}})[_0x980d('0x7')](function(_0x758fc3){return _0x38d1b9(_0x758fc3);});});}exports[_0x980d('0x8')]=function(){return request(_0x980d('0x9'),{'options':{'raw':![],'attributes':['id',_0x980d('0xa'),_0x980d('0xb')]}});};exports[_0x980d('0xc')]=function(_0x5e7ecb){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x5e7ecb},'attributes':['production']}});};exports[_0x980d('0xd')]=function(_0x10872c){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x10872c},'include':[{'model':_0x980d('0xe'),'as':'Smtp','include':[{'model':_0x980d('0xf'),'as':'CloudProvider'}]}],'attributes':['id',_0x980d('0xa'),_0x980d('0x10')],'smtp':!![]}});};exports[_0x980d('0x11')]=function(_0x2d6e19){return request(_0x980d('0x12'),{'options':{'where':{'id':_0x2d6e19},'attributes':[_0x980d('0xa')]}});};exports[_0x980d('0x13')]=function(_0x3a317b){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x3a317b},'attributes':[_0x980d('0xa')]}});};exports[_0x980d('0x14')]=function(_0x3fc5f7){return request(_0x980d('0x15'),{'options':{'where':{'id':_0x3fc5f7},'attributes':[_0x980d('0xa')]}});};exports[_0x980d('0x16')]=function(_0x5824bf){return request(_0x980d('0x17'),{'options':{'where':{'id':_0x5824bf},'attributes':[_0x980d('0x18')]}});};exports['getUserById']=function(_0x1633cf){return request('ShowUser',{'options':{'where':{'id':_0x1633cf},'attributes':[_0x980d('0xa')]}});};exports[_0x980d('0x19')]=function(_0x39192b){return request(_0x980d('0x1a'),{'options':{'where':{'phone':_0x39192b[_0x980d('0x1b')]},'attributes':['id']}});};exports[_0x980d('0x1c')]=function(_0x3ef68b){return request(_0x980d('0x1d'),{'options':{'where':{'id':_0x3ef68b},'attributes':[_0x980d('0xa')]}});};exports[_0x980d('0x1e')]=function(_0x2f234f){return request('ShowSound',{'options':{'where':{'id':_0x2f234f},'attributes':['save_name']}});};exports[_0x980d('0x1f')]=function(_0x551339){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x551339},'include':[{'model':_0x980d('0x20'),'as':_0x980d('0x21')}]}});};exports[_0x980d('0x22')]=function(_0xbb89e3){return request('ShowSmsAccount',{'options':{'where':{'id':_0xbb89e3},'attributes':['id','name']}});};exports[_0x980d('0x23')]=function(_0x4fca61){return request(_0x980d('0x24'),{'body':_0x4fca61});};exports[_0x980d('0x25')]=function(_0x4da06c){return request(_0x980d('0x26'),{'body':_0x4da06c});};exports['createSquareReport']=function(_0x4e5af6){return request('CreateSquareReport',{'body':_[_0x980d('0x27')](_0x4e5af6,{'project_name':_0x4e5af6[_0x980d('0x28')],'prev_project_name':_0x4e5af6[_0x980d('0x29')]||'','is_subproject':_0x4e5af6[_0x980d('0x29')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x980d('0x2a')]=function(_0x1d5dad){return request(_0x980d('0x2b'),{'body':_0x1d5dad});};exports[_0x980d('0x2c')]=function(_0x3d5f19){return request('CreateSquareMessage',{'body':_0x3d5f19});};exports['createCmContact']=function(_0x2830e5){return request(_0x980d('0x2d'),{'options':{'raw':![],'where':{'phone':_0x2830e5[_0x980d('0x1b')],'ListId':_0x2830e5[_0x980d('0x2e')]}}})[_0x980d('0x5')](function(_0x25542b){if(_0x25542b){return _0x25542b;}return request('CreateCmContact',{'body':_0x2830e5});});};exports[_0x980d('0x2f')]=function(_0x471f52){return request(_0x980d('0x30'),{'options':{'where':{'id':_0x471f52},'attributes':[_0x980d('0xa')]}});};exports[_0x980d('0x31')]=function(_0x38470b,_0x868f1f){return request(_0x980d('0x32'),{'body':{'interface':_0x868f1f},'options':{'where':_0x38470b}});};exports[_0x980d('0x33')]=function(_0x59a847,_0x3671b8,_0xdc7c43){return request(_0x980d('0x34'),{'body':{'type':_0x3671b8,'uniqueid':_0xdc7c43},'options':{'where':_0x59a847}});};exports['agentUnpause']=function(_0x5d0771){return request(_0x980d('0x35'),{'body':{},'options':{'where':_0x5d0771}});};exports['agentLogout']=function(_0x3e398){return request('LogoutUser',{'body':{},'options':{'where':_0x3e398}});}; \ 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 7182d5f..fc0dcda 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 _0x2706=['exports','./lex'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x2706,0x107));var _0x6270=function(_0x46e0a0,_0x33bbb9){_0x46e0a0=_0x46e0a0-0x0;var _0x2f3aa2=_0x2706[_0x46e0a0];return _0x2f3aa2;};var polly=require('./polly');var lex=require(_0x6270('0x0'));module[_0x6270('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xac6a=['./lex','exports','./polly'];(function(_0x5a3468,_0x2b5c16){var _0x53ef64=function(_0x2cbe89){while(--_0x2cbe89){_0x5a3468['push'](_0x5a3468['shift']());}};_0x53ef64(++_0x2b5c16);}(_0xac6a,0xc2));var _0xaac6=function(_0x662a8d,_0x22c6a4){_0x662a8d=_0x662a8d-0x0;var _0x5aadb6=_0xac6a[_0x662a8d];return _0x5aadb6;};var polly=require(_0xaac6('0x0'));var lex=require(_0xaac6('0x1'));module[_0xaac6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 974e4dd..0fb860f 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 _0x6f0d=['exports'];(function(_0x3b32b2,_0x13397d){var _0xc3e55=function(_0x392d24){while(--_0x392d24){_0x3b32b2['push'](_0x3b32b2['shift']());}};_0xc3e55(++_0x13397d);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x39dac8,_0x981ece){_0x39dac8=_0x39dac8-0x0;var _0x310a98=_0x6f0d[_0x39dac8];return _0x310a98;};'use strict';var lex=require('./lib/api');module[_0xd6f0('0x0')]=function(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93){return lex(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93);}; \ No newline at end of file +var _0xaa88=['exports','./lib/api'];(function(_0x4144b4,_0x41790b){var _0x2187ec=function(_0x3a174b){while(--_0x3a174b){_0x4144b4['push'](_0x4144b4['shift']());}};_0x2187ec(++_0x41790b);}(_0xaa88,0x137));var _0x8aa8=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xaa88[_0x376b45];return _0x2341b3;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ 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 248af7b..2e89385 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(_0x40ad9e,_0x5b1278){var _0x45eaf7=function(_0x2c7c15){while(--_0x2c7c15){_0x40ad9e['push'](_0x40ad9e['shift']());}};_0x45eaf7(++_0x5b1278);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x57728f,_0x2fe1a0){var _0x5ee4a9=function(_0x18a9e9){while(--_0x18a9e9){_0x57728f['push'](_0x57728f['shift']());}};_0x5ee4a9(++_0x2fe1a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 1e7aa63..f4281af 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 _0x5b12=['./lib/api','exports'];(function(_0x4fddf9,_0x1ac6ae){var _0x21d1a9=function(_0x22e611){while(--_0x22e611){_0x4fddf9['push'](_0x4fddf9['shift']());}};_0x21d1a9(++_0x1ac6ae);}(_0x5b12,0xa6));var _0x25b1=function(_0x38d6d7,_0x20d153){_0x38d6d7=_0x38d6d7-0x0;var _0xb694c=_0x5b12[_0x38d6d7];return _0xb694c;};'use strict';var polly=require(_0x25b1('0x0'));module[_0x25b1('0x1')]=function(_0x25e9ca,_0x163046,_0x246cc5,_0x5b36de,_0x270767,_0x308bb6,_0x1110ea){return polly(_0x25e9ca,_0x163046,_0x246cc5,_0x5b36de,_0x270767,_0x308bb6,_0x1110ea);}; \ No newline at end of file +var _0xb738=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb738,0x161));var _0x8b73=function(_0x4e48b6,_0x2b4d04){_0x4e48b6=_0x4e48b6-0x0;var _0x28a8f2=_0xb738[_0x4e48b6];return _0x28a8f2;};'use strict';var polly=require(_0x8b73('0x0'));module[_0x8b73('0x1')]=function(_0x5a4e2c,_0x23f898,_0x1d8e51,_0x46e080,_0x3181dc,_0x4df336,_0x36674f){return polly(_0x5a4e2c,_0x23f898,_0x1d8e51,_0x46e080,_0x3181dc,_0x4df336,_0x36674f);}; \ 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 66bf41b..3f25d8e 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 _0xcd0e=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path'];(function(_0x6d070a,_0x47e825){var _0x2c065d=function(_0xd0565c){while(--_0xd0565c){_0x6d070a['push'](_0x6d070a['shift']());}};_0x2c065d(++_0x47e825);}(_0xcd0e,0x1ee));var _0xecd0=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0xcd0e[_0x43b08];return _0x5e05f4;};'use strict';var fs=require('fs');var path=require(_0xecd0('0x0'));var BPromise=require(_0xecd0('0x1'));var rs=require(_0xecd0('0x2'));var AWS=require(_0xecd0('0x3'));function pollyResult(_0x4440f5,_0x19aa57,_0x633076){return new BPromise(function(_0x354fab,_0x4fb4f9){_0x4440f5[_0xecd0('0x4')](_0x19aa57,function(_0x42b5d2,_0xa97e77){if(_0x42b5d2){_0x4fb4f9(_0x42b5d2);}else if(_0xa97e77){if(_0xa97e77[_0xecd0('0x5')]instanceof Buffer){fs[_0xecd0('0x6')](_0x633076,_0xa97e77[_0xecd0('0x5')],function(_0x2ec5f2){if(_0x2ec5f2){_0x4fb4f9(_0x2ec5f2);}else{_0x354fab();}});}else{_0x4fb4f9(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4fb4f9(new Error(_0xecd0('0x7')));}});});}module['exports']=function(_0x408b22,_0x2e67d5,_0x347116,_0x1d7336,_0x2e14b4,_0x2fb346,_0x143314){var _0xdee6d5=new AWS[(_0xecd0('0x8'))]({'accessKeyId':_0x408b22,'secretAccessKey':_0x2e67d5,'region':_0x347116});var _0x1d7d3d={'Text':_0x2e14b4,'TextType':_0x2fb346||_0xecd0('0x9'),'OutputFormat':_0xecd0('0xa'),'VoiceId':_0x1d7336};return pollyResult(_0xdee6d5,_0x1d7d3d,_0x143314);}; \ No newline at end of file +var _0xa619=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa619,0xca));var _0x9a61=function(_0xec3da3,_0x3fa86b){_0xec3da3=_0xec3da3-0x0;var _0xdb3100=_0xa619[_0xec3da3];return _0xdb3100;};'use strict';var fs=require('fs');var path=require(_0x9a61('0x0'));var BPromise=require(_0x9a61('0x1'));var rs=require(_0x9a61('0x2'));var AWS=require(_0x9a61('0x3'));function pollyResult(_0x57f4c5,_0x9bcd2f,_0x29fd17){return new BPromise(function(_0x4a8478,_0x5489d4){_0x57f4c5[_0x9a61('0x4')](_0x9bcd2f,function(_0x313fa8,_0x25a1e3){if(_0x313fa8){_0x5489d4(_0x313fa8);}else if(_0x25a1e3){if(_0x25a1e3[_0x9a61('0x5')]instanceof Buffer){fs[_0x9a61('0x6')](_0x29fd17,_0x25a1e3['AudioStream'],function(_0x4242fd){if(_0x4242fd){_0x5489d4(_0x4242fd);}else{_0x4a8478();}});}else{_0x5489d4(new Error(_0x9a61('0x7')));}}else{_0x5489d4(new Error(_0x9a61('0x8')));}});});}module[_0x9a61('0x9')]=function(_0x1d89f6,_0x492593,_0x1bc698,_0x4bf0c0,_0x24fec3,_0x402337,_0x2b9478){var _0x4cf2d4=new AWS[(_0x9a61('0xa'))]({'accessKeyId':_0x1d89f6,'secretAccessKey':_0x492593,'region':_0x1bc698});var _0x4d3ea0={'Text':_0x24fec3,'TextType':_0x402337||'text','OutputFormat':_0x9a61('0xb'),'VoiceId':_0x4bf0c0};return pollyResult(_0x4cf2d4,_0x4d3ea0,_0x2b9478);}; \ 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 3d182b9..cc4db01 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 _0x9f70=['exports','./lib/api'];(function(_0x3a3e24,_0x40a3c0){var _0x41db6a=function(_0x428338){while(--_0x428338){_0x3a3e24['push'](_0x3a3e24['shift']());}};_0x41db6a(++_0x40a3c0);}(_0x9f70,0x1c7));var _0x09f7=function(_0x38531d,_0x22bf04){_0x38531d=_0x38531d-0x0;var _0x2b8dd9=_0x9f70[_0x38531d];return _0x2b8dd9;};'use strict';var asr=require(_0x09f7('0x0'));module[_0x09f7('0x1')]=function(_0x4c57ba,_0x567917,_0x17e224,_0x2dc894){return asr(_0x4c57ba,_0x567917,_0x17e224);}; \ No newline at end of file +var _0x383e=['./lib/api'];(function(_0x44ebe1,_0x341668){var _0x56e811=function(_0xa86b2){while(--_0xa86b2){_0x44ebe1['push'](_0x44ebe1['shift']());}};_0x56e811(++_0x341668);}(_0x383e,0xb3));var _0xe383=function(_0x7dc3da,_0x3acb63){_0x7dc3da=_0x7dc3da-0x0;var _0x8fb0d7=_0x383e[_0x7dc3da];return _0x8fb0d7;};'use strict';var asr=require(_0xe383('0x0'));module['exports']=function(_0x471bfa,_0x433f02,_0xa6b54b,_0x5d3adf){return asr(_0x471bfa,_0x433f02,_0xa6b54b);}; \ 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 f07221d..26b880c 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 _0x7341=['https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x43d96d,_0x528146){var _0x42f48b=function(_0x579152){while(--_0x579152){_0x43d96d['push'](_0x43d96d['shift']());}};_0x42f48b(++_0x528146);}(_0x7341,0xe4));var _0x1734=function(_0x53d2a2,_0x5ac6db){_0x53d2a2=_0x53d2a2-0x0;var _0x5bca64=_0x7341[_0x53d2a2];return _0x5bca64;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x1734('0x0');module['exports']=function(_0x2cfd38,_0x36397c,_0x47c889){return new BPromise(function(_0x3bf99a,_0x42c26d){var _0x3010fd;if(typeof _0x2cfd38!==_0x1734('0x1')||_0x2cfd38[_0x1734('0x2')]===0x0){return _0x42c26d(_0x1734('0x3'));}if(typeof _0x36397c!==_0x1734('0x1')||_0x36397c['length']===0x0){return _0x42c26d(_0x1734('0x4'));}if(typeof _0x47c889!==_0x1734('0x5')&&(typeof _0x47c889!==_0x1734('0x1')||_0x47c889['length']===0x0)){return _0x42c26d(_0x1734('0x6'));}try{_0x3010fd=fs['readFileSync'](_0x2cfd38)['toString'](_0x1734('0x7'));}catch(_0xcf0632){return _0x42c26d(_0xcf0632);}return _0x3bf99a({'method':_0x1734('0x8'),'uri':host+_0x1734('0x9')+_0x36397c,'body':{'config':{'encoding':_0x1734('0xa'),'sampleRateHertz':_0x1734('0xb'),'languageCode':_0x47c889},'audio':{'content':_0x3010fd}},'json':!![]});});}; \ No newline at end of file +var _0x3f19=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','length','filepath\x20should\x20be\x20a\x20string','string'];(function(_0x1b779d,_0x1c5533){var _0x245b52=function(_0x39e39c){while(--_0x39e39c){_0x1b779d['push'](_0x1b779d['shift']());}};_0x245b52(++_0x1c5533);}(_0x3f19,0xc0));var _0x93f1=function(_0x301755,_0xd69dc3){_0x301755=_0x301755-0x0;var _0x2dac9a=_0x3f19[_0x301755];return _0x2dac9a;};'use strict';var url=require(_0x93f1('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x33bddc,_0x4d1cac,_0x452cf9){return new BPromise(function(_0x9a0ee0,_0x3bd3fa){var _0x2057aa;if(typeof _0x33bddc!=='string'||_0x33bddc[_0x93f1('0x1')]===0x0){return _0x3bd3fa(_0x93f1('0x2'));}if(typeof _0x4d1cac!==_0x93f1('0x3')||_0x4d1cac[_0x93f1('0x1')]===0x0){return _0x3bd3fa(_0x93f1('0x4'));}if(typeof _0x452cf9!==_0x93f1('0x5')&&(typeof _0x452cf9!=='string'||_0x452cf9[_0x93f1('0x1')]===0x0)){return _0x3bd3fa(_0x93f1('0x6'));}try{_0x2057aa=fs[_0x93f1('0x7')](_0x33bddc)[_0x93f1('0x8')](_0x93f1('0x9'));}catch(_0x558623){return _0x3bd3fa(_0x558623);}return _0x9a0ee0({'method':_0x93f1('0xa'),'uri':host+_0x93f1('0xb')+_0x4d1cac,'body':{'config':{'encoding':_0x93f1('0xc'),'sampleRateHertz':_0x93f1('0xd'),'languageCode':_0x452cf9},'audio':{'content':_0x2057aa}},'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 774ca7a..3f57e2e 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 _0x9c1e=['./asr'];(function(_0x27b42e,_0x5f5289){var _0xf59069=function(_0x2577b0){while(--_0x2577b0){_0x27b42e['push'](_0x27b42e['shift']());}};_0xf59069(++_0x5f5289);}(_0x9c1e,0x13a));var _0xe9c1=function(_0x4c492c,_0x1a9c4c){_0x4c492c=_0x4c492c-0x0;var _0x460e16=_0x9c1e[_0x4c492c];return _0x460e16;};var asr=require(_0xe9c1('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x0271=['exports'];(function(_0x52e251,_0x3b6303){var _0x5eee63=function(_0xf1cd77){while(--_0xf1cd77){_0x52e251['push'](_0x52e251['shift']());}};_0x5eee63(++_0x3b6303);}(_0x0271,0x1ab));var _0x1027=function(_0x53c0c0,_0x551183){_0x53c0c0=_0x53c0c0-0x0;var _0x55e1b3=_0x0271[_0x53c0c0];return _0x55e1b3;};var asr=require('./asr');module[_0x1027('0x0')]={'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 f3dd984..4564c0f 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 _0xc589=['null','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','result','source','actionIncomplete','fulfillment','status','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','queryText','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','WHAT_EVER','data','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','777','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','then','.mp3','from','writeFile','chmodSync','tmp','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0xc589,0x140));var _0x9c58=function(_0x4648cd,_0x167611){_0x4648cd=_0x4648cd-0x0;var _0x122956=_0xc589[_0x4648cd];return _0x122956;};'use strict';var apiai=require(_0x9c58('0x0'));var BPromise=require(_0x9c58('0x1'));var dialogflow=require(_0x9c58('0x2'));var fs=require('fs');var http=require(_0x9c58('0x3'));var https=require('https');var md5=require(_0x9c58('0x4'));var path=require(_0x9c58('0x5'));var querystring=require(_0x9c58('0x6'));var rp=require(_0x9c58('0x7'));var rs=require(_0x9c58('0x8'));var sox=require(_0x9c58('0x9'));var tts=require(_0x9c58('0xa'));var urlParse=require(_0x9c58('0xb'))[_0x9c58('0xc')];var util=require(_0x9c58('0xd'));var aws=require(_0x9c58('0xe'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x9c58('0xf'));var logger=require(_0x9c58('0x10'))(_0x9c58('0x11'));var ISPEECH_API=_0x9c58('0x12');function downloadFile(_0x2fc644,_0x23bdf5){return new BPromise(function(_0x1a944d,_0x365fbe){var _0x8aebf0=urlParse(_0x2fc644);var _0x41643b=_0x8aebf0[_0x9c58('0x13')]===_0x9c58('0x14')?https:http;var _0x42f174={'host':_0x8aebf0[_0x9c58('0x15')],'path':_0x8aebf0[_0x9c58('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x41643b[_0x9c58('0x16')](_0x42f174,function(_0x18c6a5){if(_0x18c6a5[_0x9c58('0x17')]!==0xc8){logger[_0x9c58('0x18')](_0x9c58('0x19')+_0x2fc644+_0x9c58('0x1a')+_0x18c6a5[_0x9c58('0x17')]+'\x20('+_0x18c6a5['statusMessage']+')');_0x365fbe(new Error('request\x20to\x20'+_0x2fc644+_0x9c58('0x1a')+_0x18c6a5['statusCode']+'\x20('+_0x18c6a5[_0x9c58('0x1b')]+')'));return;}var _0x2be868=fs['createWriteStream'](_0x23bdf5);_0x2be868['on'](_0x9c58('0x1c'),function(){logger['info'](_0x9c58('0x1d'));_0x2be868[_0x9c58('0x1e')](_0x1a944d);});_0x2be868['on']('error',function(_0x12cce9){fs[_0x9c58('0x1f')](_0x23bdf5);logger['error'](_0x9c58('0x20'),_0x12cce9);_0x365fbe(_0x12cce9);});_0x18c6a5[_0x9c58('0x21')](_0x2be868);})['on'](_0x9c58('0x18'),function(_0x1dc575){logger[_0x9c58('0x18')](_0x1dc575);_0x365fbe(_0x1dc575);})[_0x9c58('0x22')]();});}function uploadFile(_0x5b3c35){return new BPromise(function(_0x3a6a42,_0x5b8d8b){var _0xa9301c=urlParse(_0x5b3c35);var _0x407453=_0xa9301c[_0x9c58('0x13')]===_0x9c58('0x14')?https:http;var _0x7eeae6={'host':_0xa9301c[_0x9c58('0x15')],'path':_0xa9301c[_0x9c58('0x5')],'headers':{'user-agent':_0x9c58('0x23')}};_0x407453[_0x9c58('0x16')](_0x7eeae6,function(_0x25d725){if(_0x25d725[_0x9c58('0x17')]!==0xc8){_0x5b8d8b(new Error('request\x20to\x20'+_0x5b3c35+_0x9c58('0x1a')+_0x25d725[_0x9c58('0x17')]+'\x20('+_0x25d725[_0x9c58('0x1b')]+')'));return;}var _0x775dfe='';_0x25d725['on'](_0x9c58('0x24'),function(_0x574370){_0x775dfe+=_0x574370;});_0x25d725['on'](_0x9c58('0x22'),function(){_0x3a6a42(_0x775dfe);});})['on'](_0x9c58('0x18'),function(_0x121c8e){_0x5b8d8b(_0x121c8e);})[_0x9c58('0x22')]();});}function convertFile(_0xb762b8,_0x24fcb5){return new BPromise(function(_0x56e7cf,_0x28f705){var _0x4deeca=sox[_0x9c58('0x25')](_0xb762b8,_0x24fcb5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4deeca['on'](_0x9c58('0x18'),function(_0xe73e8e){logger[_0x9c58('0x18')](_0x9c58('0x26'),_0xe73e8e);_0x28f705(_0xe73e8e);});_0x4deeca['on']('end',function(){logger[_0x9c58('0x27')](_0x9c58('0x28'));_0x56e7cf();});_0x4deeca[_0x9c58('0x29')]();});}function base64Decode(_0x141c12,_0x53e39a){var _0x563f96=path[_0x9c58('0x2a')](__dirname,'tmp',rs[_0x9c58('0x2b')](0x4)+_0x9c58('0x2c'));fs[_0x9c58('0x2d')](_0x563f96,_0x141c12,_0x9c58('0x2e'));return convertFile(_0x563f96,_0x53e39a)['then'](function(){try{fs[_0x9c58('0x1f')](_0x563f96);fs['chmodSync'](_0x53e39a,_0x9c58('0x2f'));}catch(_0x16c3a2){logger[_0x9c58('0x18')](_0x16c3a2);}return _0x53e39a['split']('.')[0x0];});}function base64Encode(_0x1b94c5){var _0x23f5da=fs[_0x9c58('0x30')](_0x1b94c5);return new Buffer(_0x23f5da)[_0x9c58('0x31')](_0x9c58('0x2e'));}exports['googleCloudTTS']=function(_0xd177ef,_0x1d3343,_0x4995f4,_0x4bc77f,_0x2d5ae7,_0x591fd0){var _0x226097,_0x22eccf;var _0x4913b1=_0x9c58('0x32');var _0x2cb574=_0x9c58('0x33')+_0xd177ef;var _0x187e69={};if(_0x1d3343===_0x9c58('0x34')){_0x187e69['input']={'ssml':_0x4995f4};}else{_0x187e69[_0x9c58('0x35')]={'text':_0x4995f4};};_0x187e69[_0x9c58('0x36')]={'languageCode':_0x4bc77f,'ssmlGender':_0x2d5ae7};_0x187e69[_0x9c58('0x37')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x23a4bc={'url':_0x4913b1+_0x9c58('0x38')+_0x2cb574,'method':'POST','json':!![],'body':_0x187e69};return rp(_0x23a4bc)[_0x9c58('0x39')](function(_0x556065){return new BPromise(function(_0x5373e6,_0xae61cc){_0x226097=path['resolve'](__dirname,'tmp',rs[_0x9c58('0x2b')](0x4)+_0x9c58('0x3a'));var _0x4d2b25=Buffer[_0x9c58('0x3b')](_0x556065['audioContent'],_0x9c58('0x2e'));return fs[_0x9c58('0x3c')](_0x226097,_0x4d2b25,function(_0x559d71){_0xae61cc(_0x559d71);},function(_0x10b269){fs[_0x9c58('0x3d')](_0x226097,_0x9c58('0x2f'));_0x5373e6(_0x10b269);});});})['then'](function(_0x13d4ed){_0x22eccf=path[_0x9c58('0x2a')](__dirname,_0x9c58('0x3e'),rs[_0x9c58('0x2b')](0x4)+_0x9c58('0x2c'));return convertFile(_0x226097,_0x22eccf);})[_0x9c58('0x39')](function(){try{fs[_0x9c58('0x1f')](_0x226097);fs['chmodSync'](_0x22eccf,'777');}catch(_0x4aa9f0){logger['error'](_0x4aa9f0);}logger['info'](_0x9c58('0x3f'),_0x22eccf[_0x9c58('0x40')]('.')[0x0]);return _0x22eccf['split']('.')[0x0];});};exports[_0x9c58('0x41')]=function(_0x378eca,_0x18564f){var _0x5cecf9=_0x9c58('0x42');var _0x39603e,_0x58ec57;var _0x1e21a8;var _0x2e3a1e={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x5cecf9,'headers':{'Content-Type':_0x9c58('0x43')},'body':_0x9c58('0x44')+encodeURIComponent(JSON[_0x9c58('0x45')]([[['jQ1olc',JSON[_0x9c58('0x45')]([_0x378eca,_0x18564f||'en',![],_0x9c58('0x46')]),null,'generic']]]))};return rp(_0x2e3a1e)[_0x9c58('0x39')](function(_0x4cb861){try{_0x1e21a8=eval(_0x4cb861[_0x9c58('0x47')](0x5))[0x0][0x2];}catch(_0x433c66){throw new Error('parse\x20response\x20failed:\x0a'+_0x4cb861[_0x9c58('0x24')]);}if(!_0x1e21a8){if(_0x378eca[_0x9c58('0x48')]>0xc8){throw new Error(_0x9c58('0x49'));}else{throw new Error(_0x9c58('0x4a')+_0x18564f+'\x22\x20might\x20not\x20exist');}}try{_0x1e21a8=eval(_0x1e21a8)[0x0];}catch(_0x3bc322){throw new Error(_0x9c58('0x4b')+res[_0x9c58('0x24')]);}const _0x558b9c=_0x1e21a8;_0x39603e=path[_0x9c58('0x2a')](__dirname,'tmp',rs[_0x9c58('0x2b')](0x4)+_0x9c58('0x3a'));fs['writeFileSync'](_0x39603e,_0x1e21a8,{'encoding':'base64'});_0x58ec57=path[_0x9c58('0x2a')](__dirname,'tmp',rs[_0x9c58('0x2b')](0x4)+_0x9c58('0x2c'));return convertFile(_0x39603e,_0x58ec57);})[_0x9c58('0x39')](function(){try{fs[_0x9c58('0x1f')](_0x39603e);fs[_0x9c58('0x3d')](_0x58ec57,'777');}catch(_0x1c565e){logger[_0x9c58('0x18')](_0x1c565e);}logger[_0x9c58('0x27')](_0x9c58('0x4c'),_0x58ec57[_0x9c58('0x40')]('.')[0x0]);return _0x58ec57[_0x9c58('0x40')]('.')[0x0];});};exports['googleASR']=function(_0x108ad5,_0x5dae4b,_0x72dfbe){return google[_0x9c58('0x4d')](_0x108ad5,_0x5dae4b,_0x72dfbe)[_0x9c58('0x39')](function(_0xa74392){logger[_0x9c58('0x27')](_0xa74392['uri']);return rp(_0xa74392);})[_0x9c58('0x39')](function(_0x2bb595){var _0x329ad1='';var _0x143d0d=0x0;try{fs[_0x9c58('0x1f')](_0x108ad5);}catch(_0x3a5293){logger[_0x9c58('0x18')](_0x3a5293);}if(_0x2bb595&&_0x2bb595[_0x9c58('0x4e')]){_0x329ad1=_0x2bb595[_0x9c58('0x4e')]['map'](function(_0x55cb13){return _0x55cb13&&_0x55cb13['alternatives'][0x0]&&_0x55cb13[_0x9c58('0x4f')][0x0][_0x9c58('0x50')]?_0x55cb13['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x143d0d=_0x2bb595[_0x9c58('0x4e')][_0x9c58('0x51')](function(_0x467536){return _0x467536&&_0x467536[_0x9c58('0x4f')][0x0]&&_0x467536[_0x9c58('0x4f')][0x0][_0x9c58('0x52')]?_0x467536[_0x9c58('0x4f')][0x0][_0x9c58('0x52')]:0x0;})[_0x9c58('0x53')]('\x0a');}logger[_0x9c58('0x27')](_0x9c58('0x54'),_0x329ad1);logger[_0x9c58('0x27')]('googleASR\x20confidence',_0x143d0d);return{'transcript':_0x329ad1,'confidence':_0x143d0d};})[_0x9c58('0x55')](function(_0x4c836f){logger['error'](_0x9c58('0x56'),_0x4c836f[_0x9c58('0x17')],_0x4c836f[_0x9c58('0x57')],_0x4c836f['message']);});};exports['googleDialogflow']=function(_0x4dcd2e,_0x15e7b6,_0x14169f,_0x3203e3){var _0x504cbe=apiai(_0x15e7b6,{'language':_0x3203e3||'en'});return _0x504cbe['textRequest'](_0x14169f,{'sessionId':md5(_0x4dcd2e)})[_0x9c58('0x39')](function(_0x11e3ae){logger[_0x9c58('0x27')](JSON[_0x9c58('0x45')](_0x11e3ae));return{'source':_0x11e3ae[_0x9c58('0x58')][_0x9c58('0x59')],'resolvedQuery':_0x11e3ae['result']['resolvedQuery'],'action':_0x11e3ae[_0x9c58('0x58')]['action'],'actionIncomplete':_0x11e3ae[_0x9c58('0x58')][_0x9c58('0x5a')],'speech':_0x11e3ae[_0x9c58('0x58')][_0x9c58('0x5b')]['speech'],'score':_0x11e3ae['result']['score'],'statusCode':_0x11e3ae[_0x9c58('0x5c')]['code'],'endConversation':_0x11e3ae[_0x9c58('0x58')][_0x9c58('0x5d')]['endConversation']||![],'isFallbackIntent':_0x11e3ae[_0x9c58('0x58')][_0x9c58('0x5d')][_0x9c58('0x5e')]};});};exports[_0x9c58('0x5f')]=function(_0x45ede4,_0x484aac,_0x284885,_0xf35ebd,_0x8f142d,_0x308cfd){var _0x2d9f6f=_0xf35ebd['replace'](/\\n/g,'\x0a');var _0x1c4fe7={'credentials':{'private_key':_0x2d9f6f,'client_email':_0x284885}};var _0x2c0735=new dialogflow[(_0x9c58('0x60'))](_0x1c4fe7);var _0x2ec470=_0x2c0735[_0x9c58('0x61')](_0x484aac,md5(_0x45ede4));var _0x545e19={'session':_0x2ec470,'queryInput':{'text':{'text':_0x8f142d,'languageCode':_0x308cfd}}};return _0x2c0735['detectIntent'](_0x545e19)['then'](function(_0x2e365b){if(_0x2e365b&&_0x2e365b[_0x9c58('0x48')]){logger['info'](_0x9c58('0x62'),JSON[_0x9c58('0x45')](_0x2e365b));var _0xe6aa1c=_0x2e365b[0x0];if(_0xe6aa1c){var _0xf39a8d={'action':_0xe6aa1c[_0x9c58('0x63')][_0x9c58('0x64')],'allRequiredParamsPresent':_0xe6aa1c[_0x9c58('0x63')][_0x9c58('0x65')],'endConversation':_0xe6aa1c[_0x9c58('0x63')][_0x9c58('0x66')]&&_0xe6aa1c[_0x9c58('0x63')][_0x9c58('0x66')][_0x9c58('0x67')]?_0xe6aa1c['queryResult'][_0x9c58('0x66')][_0x9c58('0x67')][_0x9c58('0x68')][_0x9c58('0x69')]:![],'fulfillmentText':_0xe6aa1c[_0x9c58('0x63')][_0x9c58('0x6a')],'intentName':_0xe6aa1c['queryResult'][_0x9c58('0x6b')][_0x9c58('0x57')],'intentDisplayName':_0xe6aa1c['queryResult'][_0x9c58('0x6b')][_0x9c58('0x6c')],'isFallbackIntent':_0xe6aa1c[_0x9c58('0x63')][_0x9c58('0x6b')]['isFallback'],'languageCode':_0xe6aa1c[_0x9c58('0x63')]['languageCode'],'queryText':_0xe6aa1c[_0x9c58('0x63')][_0x9c58('0x6d')],'responseId':_0xe6aa1c['responseId'],'score':_0xe6aa1c[_0x9c58('0x63')]['intentDetectionConfidence'],'speech':_0xe6aa1c[_0x9c58('0x63')]['fulfillmentText'],'providerResponse':JSON[_0x9c58('0x45')](_0x2e365b)};return _0xf39a8d;}}});};exports[_0x9c58('0x6e')]=function(_0x294529,_0x2722f9,_0x58ab81,_0x438689){return tilde[_0x9c58('0x4d')](_0x294529,_0x2722f9,_0x58ab81,_0x438689)[_0x9c58('0x39')](function(_0x5974a5){try{fs[_0x9c58('0x1f')](_0x294529);}catch(_0x44b838){logger[_0x9c58('0x18')](_0x44b838);}logger[_0x9c58('0x27')](_0x9c58('0x6f'),_0x5974a5['transcript']);logger[_0x9c58('0x27')]('Tilde\x20ASR\x20confidence',_0x5974a5['confidence']);return _0x5974a5;});};exports[_0x9c58('0x70')]=function(_0x3540fe,_0x20fcfc,_0x23c3a0,_0x586d0f,_0x224c9a,_0x816ab1){var _0x431660=path[_0x9c58('0x2a')](__dirname,_0x9c58('0x3e'),rs[_0x9c58('0x2b')](0x4)+_0x9c58('0x3a'));var _0x5e3122;return aws[_0x9c58('0x71')](_0x3540fe,_0x20fcfc,_0x23c3a0,_0x586d0f,_0x224c9a,_0x816ab1,_0x431660)[_0x9c58('0x39')](function(){_0x5e3122=path['resolve'](__dirname,'tmp',rs[_0x9c58('0x2b')](0x4)+_0x9c58('0x2c'));return convertFile(_0x431660,_0x5e3122);})[_0x9c58('0x39')](function(){try{fs[_0x9c58('0x1f')](_0x431660);fs[_0x9c58('0x3d')](_0x5e3122,_0x9c58('0x2f'));}catch(_0x3f51b3){logger['error'](_0x3f51b3);}return _0x5e3122[_0x9c58('0x40')]('.')[0x0];});};exports[_0x9c58('0x72')]=function(_0x5d9af6,_0x3f2985,_0x23742c,_0x18066c,_0x96fec6,_0x2a736d){return aws[_0x9c58('0x73')](_0x5d9af6,_0x3f2985,_0x23742c,_0x18066c,_0x96fec6,_0x2a736d)[_0x9c58('0x39')](function(_0x1fdcc5){logger[_0x9c58('0x27')](JSON[_0x9c58('0x45')](_0x1fdcc5));return _0x1fdcc5;});};exports[_0x9c58('0x74')]=function(_0x22a0ef,_0x2f2116,_0x300555,_0x24bf4e){var _0x426571=util[_0x9c58('0x75')](_0x9c58('0x76'),ISPEECH_API,_0x22a0ef,encodeURIComponent(_0x2f2116),_0x300555,_0x24bf4e);var _0x3d2900=path[_0x9c58('0x2a')](__dirname,_0x9c58('0x3e'),rs[_0x9c58('0x2b')](0x4)+_0x9c58('0x3a'));var _0x8b39c4;return downloadFile(_0x426571,_0x3d2900)[_0x9c58('0x39')](function(){_0x8b39c4=path[_0x9c58('0x2a')](__dirname,_0x9c58('0x3e'),rs[_0x9c58('0x2b')](0x4)+_0x9c58('0x2c'));return convertFile(_0x3d2900,_0x8b39c4);})[_0x9c58('0x39')](function(){try{fs['unlink'](_0x3d2900);fs[_0x9c58('0x3d')](_0x8b39c4,'777');}catch(_0x5b8f39){logger[_0x9c58('0x18')](_0x5b8f39);}return _0x8b39c4[_0x9c58('0x40')]('.')[0x0];});};exports[_0x9c58('0x77')]=function(_0x433ec3,_0x1ca894,_0x3290ff,_0x2d0ec3){var _0x51974a=util[_0x9c58('0x75')](_0x9c58('0x78'),ISPEECH_API,_0x1ca894,_0x3290ff,base64Encode(_0x433ec3),_0x2d0ec3?util[_0x9c58('0x75')](_0x9c58('0x79'),encodeURIComponent(_0x2d0ec3)):_0x9c58('0x7a'));return uploadFile(_0x51974a)[_0x9c58('0x39')](function(_0x545b9c){return querystring[_0x9c58('0xc')](_0x545b9c);});};exports[_0x9c58('0x7b')]=function(_0x448283,_0x107259){return sestek[_0x9c58('0x7c')](_0x448283,_0x107259)['then'](function(_0x1f8df8){logger[_0x9c58('0x27')](JSON[_0x9c58('0x45')](_0x1f8df8));var _0x48e722={'speech':_0x1f8df8['text'],'action':_0x1f8df8[_0x9c58('0x7d')]?_0x1f8df8[_0x9c58('0x7d')][_0x9c58('0x7e')]:undefined,'actiondata':_0x1f8df8['channelData']?_0x1f8df8[_0x9c58('0x7d')][_0x9c58('0x7f')]:undefined};if(_0x1f8df8['channelData']&&_0x1f8df8[_0x9c58('0x7d')][_0x9c58('0x80')]){return base64Decode(_0x1f8df8[_0x9c58('0x7d')]['AudioFromTts']['Data'],path[_0x9c58('0x2a')](__dirname,_0x9c58('0x3e'),rs[_0x9c58('0x2b')](0x4)+'.wav'))[_0x9c58('0x39')](function(_0x54bb7a){_0x48e722['audiofile']=_0x54bb7a;return _0x48e722;});}return _0x48e722;});};exports[_0x9c58('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0x4596=['ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','message','googleDialogflow','source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','isFallback','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','bluebird','https','querystring','request-promise','google-tts-api','url','parse','util','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','path','WHAT_EVER','error','request\x20to\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','protocol','get','\x20failed,\x20status\x20code\x20=\x20','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','then','chmodSync','readFileSync','base64','https://texttospeech.googleapis.com/v1/','?key='];(function(_0x1c1aac,_0xc99325){var _0x52e05f=function(_0x414356){while(--_0x414356){_0x1c1aac['push'](_0x1c1aac['shift']());}};_0x52e05f(++_0xc99325);}(_0x4596,0x162));var _0x6459=function(_0x5571c4,_0x266be6){_0x5571c4=_0x5571c4-0x0;var _0x42912f=_0x4596[_0x5571c4];return _0x42912f;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x6459('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x6459('0x1'));var md5=require('md5');var path=require('path');var querystring=require(_0x6459('0x2'));var rp=require(_0x6459('0x3'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x6459('0x4'));var urlParse=require(_0x6459('0x5'))[_0x6459('0x6')];var util=require(_0x6459('0x7'));var aws=require('./aws');var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x6459('0x8'));var logger=require(_0x6459('0x9'))(_0x6459('0xa'));var ISPEECH_API=_0x6459('0xb');function downloadFile(_0x2b9a3e,_0x399427){return new BPromise(function(_0xe3cf43,_0x17548e){var _0x5215c7=urlParse(_0x2b9a3e);var _0x2affe8=_0x5215c7['protocol']==='https:'?https:http;var _0x4c4b1e={'host':_0x5215c7[_0x6459('0xc')],'path':_0x5215c7[_0x6459('0xd')],'headers':{'user-agent':_0x6459('0xe')}};_0x2affe8['get'](_0x4c4b1e,function(_0x42d9b2){if(_0x42d9b2['statusCode']!==0xc8){logger[_0x6459('0xf')](_0x6459('0x10')+_0x2b9a3e+'\x20failed,\x20status\x20code\x20=\x20'+_0x42d9b2[_0x6459('0x11')]+'\x20('+_0x42d9b2['statusMessage']+')');_0x17548e(new Error(_0x6459('0x10')+_0x2b9a3e+'\x20failed,\x20status\x20code\x20=\x20'+_0x42d9b2['statusCode']+'\x20('+_0x42d9b2[_0x6459('0x12')]+')'));return;}var _0x3c9ebe=fs[_0x6459('0x13')](_0x399427);_0x3c9ebe['on'](_0x6459('0x14'),function(){logger[_0x6459('0x15')](_0x6459('0x16'));_0x3c9ebe[_0x6459('0x17')](_0xe3cf43);});_0x3c9ebe['on']('error',function(_0xc19e86){fs[_0x6459('0x18')](_0x399427);logger[_0x6459('0xf')](_0x6459('0x19'),_0xc19e86);_0x17548e(_0xc19e86);});_0x42d9b2[_0x6459('0x1a')](_0x3c9ebe);})['on'](_0x6459('0xf'),function(_0x3edd5c){logger['error'](_0x3edd5c);_0x17548e(_0x3edd5c);})[_0x6459('0x1b')]();});}function uploadFile(_0x3d418c){return new BPromise(function(_0x44d36b,_0x24c75e){var _0x3372b0=urlParse(_0x3d418c);var _0x475316=_0x3372b0[_0x6459('0x1c')]==='https:'?https:http;var _0x38912a={'host':_0x3372b0[_0x6459('0xc')],'path':_0x3372b0[_0x6459('0xd')],'headers':{'user-agent':'WHAT_EVER'}};_0x475316[_0x6459('0x1d')](_0x38912a,function(_0x5efe00){if(_0x5efe00['statusCode']!==0xc8){_0x24c75e(new Error(_0x6459('0x10')+_0x3d418c+_0x6459('0x1e')+_0x5efe00[_0x6459('0x11')]+'\x20('+_0x5efe00['statusMessage']+')'));return;}var _0x4d9c9a='';_0x5efe00['on'](_0x6459('0x1f'),function(_0x229dd0){_0x4d9c9a+=_0x229dd0;});_0x5efe00['on']('end',function(){_0x44d36b(_0x4d9c9a);});})['on'](_0x6459('0xf'),function(_0x5a6345){_0x24c75e(_0x5a6345);})[_0x6459('0x1b')]();});}function convertFile(_0x48f5fe,_0x29337f){return new BPromise(function(_0x5a8d85,_0x314d1c){var _0x5e4753=sox[_0x6459('0x20')](_0x48f5fe,_0x29337f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5e4753['on'](_0x6459('0xf'),function(_0x2d6227){logger['error'](_0x6459('0x21'),_0x2d6227);_0x314d1c(_0x2d6227);});_0x5e4753['on']('end',function(){logger[_0x6459('0x15')](_0x6459('0x22'));_0x5a8d85();});_0x5e4753[_0x6459('0x23')]();});}function base64Decode(_0x30b21f,_0xba8c00){var _0x58b3bf=path[_0x6459('0x24')](__dirname,'tmp',rs[_0x6459('0x25')](0x4)+_0x6459('0x26'));fs['writeFileSync'](_0x58b3bf,_0x30b21f,'base64');return convertFile(_0x58b3bf,_0xba8c00)[_0x6459('0x27')](function(){try{fs[_0x6459('0x18')](_0x58b3bf);fs[_0x6459('0x28')](_0xba8c00,'777');}catch(_0x4ab640){logger['error'](_0x4ab640);}return _0xba8c00['split']('.')[0x0];});}function base64Encode(_0x3fe029){var _0x4abeb7=fs[_0x6459('0x29')](_0x3fe029);return new Buffer(_0x4abeb7)['toString'](_0x6459('0x2a'));}exports['googleCloudTTS']=function(_0xdfe171,_0x4d4861,_0x5aef09,_0x29693e,_0x43f0f6,_0x22be09){var _0x405ce5,_0x5bce54;var _0x3c47e2=_0x6459('0x2b');var _0xd54f34=_0x6459('0x2c')+_0xdfe171;var _0x191d97={};if(_0x4d4861===_0x6459('0x2d')){_0x191d97['input']={'ssml':_0x5aef09};}else{_0x191d97[_0x6459('0x2e')]={'text':_0x5aef09};};_0x191d97[_0x6459('0x2f')]={'languageCode':_0x29693e,'ssmlGender':_0x43f0f6};_0x191d97[_0x6459('0x30')]={'audioEncoding':_0x6459('0x31'),'sampleRateHertz':0x1f40};var _0x3acb34={'url':_0x3c47e2+_0x6459('0x32')+_0xd54f34,'method':_0x6459('0x33'),'json':!![],'body':_0x191d97};return rp(_0x3acb34)[_0x6459('0x27')](function(_0x1ab3d5){return new BPromise(function(_0x3829ac,_0x54d00e){_0x405ce5=path[_0x6459('0x24')](__dirname,_0x6459('0x34'),rs[_0x6459('0x25')](0x4)+_0x6459('0x35'));var _0x4d2780=Buffer[_0x6459('0x36')](_0x1ab3d5[_0x6459('0x37')],_0x6459('0x2a'));return fs[_0x6459('0x38')](_0x405ce5,_0x4d2780,function(_0x4c92e8){_0x54d00e(_0x4c92e8);},function(_0xabb603){fs[_0x6459('0x28')](_0x405ce5,'777');_0x3829ac(_0xabb603);});});})['then'](function(_0x4be8e7){_0x5bce54=path[_0x6459('0x24')](__dirname,_0x6459('0x34'),rs[_0x6459('0x25')](0x4)+_0x6459('0x26'));return convertFile(_0x405ce5,_0x5bce54);})['then'](function(){try{fs[_0x6459('0x18')](_0x405ce5);fs['chmodSync'](_0x5bce54,_0x6459('0x39'));}catch(_0x50342c){logger['error'](_0x50342c);}logger['info'](_0x6459('0x3a'),_0x5bce54[_0x6459('0x3b')]('.')[0x0]);return _0x5bce54['split']('.')[0x0];});};exports['googleTTS']=function(_0x4a78b3,_0x515aa2){var _0x556459=_0x6459('0x3c');var _0x5a2ff8,_0x172622;var _0x6b0f49;var _0x59b197={'encoding':_0x6459('0x3d'),'method':_0x6459('0x33'),'timeout':0x2710,'url':_0x556459,'headers':{'Content-Type':_0x6459('0x3e')},'body':_0x6459('0x3f')+encodeURIComponent(JSON['stringify']([[[_0x6459('0x40'),JSON[_0x6459('0x41')]([_0x4a78b3,_0x515aa2||'en',![],'null']),null,_0x6459('0x42')]]]))};return rp(_0x59b197)[_0x6459('0x27')](function(_0x2c9b5f){try{_0x6b0f49=eval(_0x2c9b5f[_0x6459('0x43')](0x5))[0x0][0x2];}catch(_0x2868b0){throw new Error(_0x6459('0x44')+_0x2c9b5f[_0x6459('0x1f')]);}if(!_0x6b0f49){if(_0x4a78b3[_0x6459('0x45')]>0xc8){throw new Error(_0x6459('0x46'));}else{throw new Error(_0x6459('0x47')+_0x515aa2+_0x6459('0x48'));}}try{_0x6b0f49=eval(_0x6b0f49)[0x0];}catch(_0xc36edc){throw new Error(_0x6459('0x44')+res[_0x6459('0x1f')]);}const _0x10393b=_0x6b0f49;_0x5a2ff8=path[_0x6459('0x24')](__dirname,'tmp',rs[_0x6459('0x25')](0x4)+_0x6459('0x35'));fs['writeFileSync'](_0x5a2ff8,_0x6b0f49,{'encoding':_0x6459('0x2a')});_0x172622=path[_0x6459('0x24')](__dirname,'tmp',rs[_0x6459('0x25')](0x4)+_0x6459('0x26'));return convertFile(_0x5a2ff8,_0x172622);})[_0x6459('0x27')](function(){try{fs[_0x6459('0x18')](_0x5a2ff8);fs[_0x6459('0x28')](_0x172622,'777');}catch(_0x86810d){logger[_0x6459('0xf')](_0x86810d);}logger['info'](_0x6459('0x49'),_0x172622['split']('.')[0x0]);return _0x172622[_0x6459('0x3b')]('.')[0x0];});};exports[_0x6459('0x4a')]=function(_0xda5f65,_0x397af7,_0x1c5431){return google[_0x6459('0x4b')](_0xda5f65,_0x397af7,_0x1c5431)[_0x6459('0x27')](function(_0x222006){logger[_0x6459('0x15')](_0x222006[_0x6459('0x4c')]);return rp(_0x222006);})['then'](function(_0x4e658c){var _0x159880='';var _0x289bbf=0x0;try{fs[_0x6459('0x18')](_0xda5f65);}catch(_0x1c794d){logger[_0x6459('0xf')](_0x1c794d);}if(_0x4e658c&&_0x4e658c[_0x6459('0x4d')]){_0x159880=_0x4e658c[_0x6459('0x4d')]['map'](function(_0x12bc69){return _0x12bc69&&_0x12bc69[_0x6459('0x4e')][0x0]&&_0x12bc69[_0x6459('0x4e')][0x0][_0x6459('0x4f')]?_0x12bc69[_0x6459('0x4e')][0x0]['transcript']:'';})[_0x6459('0x50')]('\x0a');_0x289bbf=_0x4e658c[_0x6459('0x4d')][_0x6459('0x51')](function(_0x4512dd){return _0x4512dd&&_0x4512dd[_0x6459('0x4e')][0x0]&&_0x4512dd[_0x6459('0x4e')][0x0][_0x6459('0x52')]?_0x4512dd[_0x6459('0x4e')][0x0]['confidence']:0x0;})[_0x6459('0x50')]('\x0a');}logger['info'](_0x6459('0x53'),_0x159880);logger[_0x6459('0x15')]('googleASR\x20confidence',_0x289bbf);return{'transcript':_0x159880,'confidence':_0x289bbf};})['catch'](function(_0x5173c9){logger[_0x6459('0xf')](_0x6459('0x54'),_0x5173c9[_0x6459('0x11')],_0x5173c9[_0x6459('0x55')],_0x5173c9[_0x6459('0x56')]);});};exports[_0x6459('0x57')]=function(_0x23df44,_0x137147,_0x57d711,_0x2ef696){var _0x59829a=apiai(_0x137147,{'language':_0x2ef696||'en'});return _0x59829a['textRequest'](_0x57d711,{'sessionId':md5(_0x23df44)})[_0x6459('0x27')](function(_0x45446e){logger[_0x6459('0x15')](JSON['stringify'](_0x45446e));return{'source':_0x45446e['result'][_0x6459('0x58')],'resolvedQuery':_0x45446e['result'][_0x6459('0x59')],'action':_0x45446e[_0x6459('0x5a')][_0x6459('0x5b')],'actionIncomplete':_0x45446e['result'][_0x6459('0x5c')],'speech':_0x45446e[_0x6459('0x5a')][_0x6459('0x5d')][_0x6459('0x5e')],'score':_0x45446e[_0x6459('0x5a')][_0x6459('0x5f')],'statusCode':_0x45446e[_0x6459('0x60')][_0x6459('0x61')],'endConversation':_0x45446e['result']['metadata'][_0x6459('0x62')]||![],'isFallbackIntent':_0x45446e[_0x6459('0x5a')][_0x6459('0x63')][_0x6459('0x64')]};});};exports[_0x6459('0x65')]=function(_0x2084f4,_0x45f766,_0x18f797,_0x28f306,_0x3905bf,_0x4d1c7b){var _0x194951=_0x28f306[_0x6459('0x66')](/\\n/g,'\x0a');var _0x75a922={'credentials':{'private_key':_0x194951,'client_email':_0x18f797}};var _0x397555=new dialogflow[(_0x6459('0x67'))](_0x75a922);var _0x5d8797=_0x397555['sessionPath'](_0x45f766,md5(_0x2084f4));var _0xd4d485={'session':_0x5d8797,'queryInput':{'text':{'text':_0x3905bf,'languageCode':_0x4d1c7b}}};return _0x397555['detectIntent'](_0xd4d485)[_0x6459('0x27')](function(_0x25226c){if(_0x25226c&&_0x25226c[_0x6459('0x45')]){logger[_0x6459('0x15')]('Dialogflow\x20V2\x20response:',JSON[_0x6459('0x41')](_0x25226c));var _0x41126a=_0x25226c[0x0];if(_0x41126a){var _0xff7290={'action':_0x41126a[_0x6459('0x68')][_0x6459('0x5b')],'allRequiredParamsPresent':_0x41126a[_0x6459('0x68')][_0x6459('0x69')],'endConversation':_0x41126a[_0x6459('0x68')][_0x6459('0x6a')]&&_0x41126a[_0x6459('0x68')][_0x6459('0x6a')]['fields']?_0x41126a[_0x6459('0x68')][_0x6459('0x6a')][_0x6459('0x6b')]['end_conversation'][_0x6459('0x6c')]:![],'fulfillmentText':_0x41126a[_0x6459('0x68')][_0x6459('0x6d')],'intentName':_0x41126a[_0x6459('0x68')]['intent'][_0x6459('0x55')],'intentDisplayName':_0x41126a[_0x6459('0x68')][_0x6459('0x6e')]['displayName'],'isFallbackIntent':_0x41126a[_0x6459('0x68')][_0x6459('0x6e')][_0x6459('0x6f')],'languageCode':_0x41126a[_0x6459('0x68')][_0x6459('0x70')],'queryText':_0x41126a[_0x6459('0x68')]['queryText'],'responseId':_0x41126a[_0x6459('0x71')],'score':_0x41126a[_0x6459('0x68')][_0x6459('0x72')],'speech':_0x41126a[_0x6459('0x68')][_0x6459('0x6d')],'providerResponse':JSON['stringify'](_0x25226c)};return _0xff7290;}}});};exports['tildeASR']=function(_0x1682e8,_0x4d16e9,_0x1391c1,_0xc74901){return tilde[_0x6459('0x4b')](_0x1682e8,_0x4d16e9,_0x1391c1,_0xc74901)[_0x6459('0x27')](function(_0x326186){try{fs[_0x6459('0x18')](_0x1682e8);}catch(_0x866a67){logger['error'](_0x866a67);}logger['info'](_0x6459('0x73'),_0x326186['transcript']);logger['info'](_0x6459('0x74'),_0x326186[_0x6459('0x52')]);return _0x326186;});};exports['awsPolly']=function(_0x7fc04,_0x212522,_0x355a74,_0x3147d3,_0xcf984,_0x3f766e){var _0x28ea94=path[_0x6459('0x24')](__dirname,_0x6459('0x34'),rs[_0x6459('0x25')](0x4)+_0x6459('0x35'));var _0x11d9e2;return aws[_0x6459('0x75')](_0x7fc04,_0x212522,_0x355a74,_0x3147d3,_0xcf984,_0x3f766e,_0x28ea94)['then'](function(){_0x11d9e2=path['resolve'](__dirname,_0x6459('0x34'),rs[_0x6459('0x25')](0x4)+_0x6459('0x26'));return convertFile(_0x28ea94,_0x11d9e2);})[_0x6459('0x27')](function(){try{fs['unlink'](_0x28ea94);fs[_0x6459('0x28')](_0x11d9e2,_0x6459('0x39'));}catch(_0x35f4ed){logger[_0x6459('0xf')](_0x35f4ed);}return _0x11d9e2['split']('.')[0x0];});};exports[_0x6459('0x76')]=function(_0x556801,_0x39dc92,_0x402e5b,_0x221fd2,_0x30d575,_0x416fa4){return aws[_0x6459('0x77')](_0x556801,_0x39dc92,_0x402e5b,_0x221fd2,_0x30d575,_0x416fa4)[_0x6459('0x27')](function(_0x2e91c6){logger[_0x6459('0x15')](JSON[_0x6459('0x41')](_0x2e91c6));return _0x2e91c6;});};exports[_0x6459('0x78')]=function(_0x9121bf,_0x341a3c,_0x457b12,_0x26badf){var _0x2eaf6f=util[_0x6459('0x79')](_0x6459('0x7a'),ISPEECH_API,_0x9121bf,encodeURIComponent(_0x341a3c),_0x457b12,_0x26badf);var _0x8fcdfa=path[_0x6459('0x24')](__dirname,'tmp',rs[_0x6459('0x25')](0x4)+'.mp3');var _0x2e4eed;return downloadFile(_0x2eaf6f,_0x8fcdfa)[_0x6459('0x27')](function(){_0x2e4eed=path['resolve'](__dirname,_0x6459('0x34'),rs[_0x6459('0x25')](0x4)+_0x6459('0x26'));return convertFile(_0x8fcdfa,_0x2e4eed);})[_0x6459('0x27')](function(){try{fs[_0x6459('0x18')](_0x8fcdfa);fs[_0x6459('0x28')](_0x2e4eed,_0x6459('0x39'));}catch(_0x278233){logger['error'](_0x278233);}return _0x2e4eed[_0x6459('0x3b')]('.')[0x0];});};exports['ispeechASR']=function(_0xb64dd4,_0x1ae987,_0x5c3371,_0x2fc1f1){var _0x4cada5=util[_0x6459('0x79')](_0x6459('0x7b'),ISPEECH_API,_0x1ae987,_0x5c3371,base64Encode(_0xb64dd4),_0x2fc1f1?util[_0x6459('0x79')](_0x6459('0x7c'),encodeURIComponent(_0x2fc1f1)):_0x6459('0x7d'));return uploadFile(_0x4cada5)[_0x6459('0x27')](function(_0x35479b){return querystring[_0x6459('0x6')](_0x35479b);});};exports[_0x6459('0x7e')]=function(_0x5d6006,_0x2b2a1b){return sestek[_0x6459('0x7f')](_0x5d6006,_0x2b2a1b)[_0x6459('0x27')](function(_0x45f14e){logger[_0x6459('0x15')](JSON[_0x6459('0x41')](_0x45f14e));var _0x4b1aa7={'speech':_0x45f14e['text'],'action':_0x45f14e[_0x6459('0x80')]?_0x45f14e[_0x6459('0x80')][_0x6459('0x81')]:undefined,'actiondata':_0x45f14e['channelData']?_0x45f14e['channelData'][_0x6459('0x82')]:undefined};if(_0x45f14e['channelData']&&_0x45f14e[_0x6459('0x80')][_0x6459('0x83')]){return base64Decode(_0x45f14e[_0x6459('0x80')][_0x6459('0x83')][_0x6459('0x84')],path[_0x6459('0x24')](__dirname,_0x6459('0x34'),rs[_0x6459('0x25')](0x4)+'.wav'))[_0x6459('0x27')](function(_0x35df14){_0x4b1aa7['audiofile']=_0x35df14;return _0x4b1aa7;});}return _0x4b1aa7;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 74f649b..5ee59a8 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 _0xef05=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xef05,0xf9));var _0x5ef0=function(_0x4d21ff,_0x23bc30){_0x4d21ff=_0x4d21ff-0x0;var _0x7c2559=_0xef05[_0x4d21ff];return _0x7c2559;};var nda=require('./nda');module[_0x5ef0('0x0')]={'nda':nda}; \ No newline at end of file +var _0x4997=['exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x4997,0x1df));var _0x7499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4997[_0x3dd15e];return _0x231fd0;};var nda=require('./nda');module[_0x7499('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 250bbee..966996d 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 _0xe9ad=['password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0xe9ad,0x82));var _0xde9a=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0xe9ad[_0x28578d];return _0x524826;};'use strict';var rp=require(_0xde9a('0x0'));var url=require(_0xde9a('0x1'));var logger=require(_0xde9a('0x2'))(_0xde9a('0x3'));module[_0xde9a('0x4')]=function(_0x398c3b,_0x11047e){var _0x4d2982={'method':_0xde9a('0x5'),'uri':url[_0xde9a('0x6')](_0x11047e[_0xde9a('0x7')],_0xde9a('0x8')),'form':{'grant_type':'password','username':_0x11047e[_0xde9a('0x9')],'password':_0x11047e[_0xde9a('0xa')]},'json':!![]};return rp(_0x4d2982)[_0xde9a('0xb')](function(_0x5d4412){var _0x45d4a7={'method':_0xde9a('0x5'),'uri':url[_0xde9a('0x6')](_0x11047e[_0xde9a('0xc')],_0xde9a('0xd')),'body':{'type':_0x11047e[_0xde9a('0xe')]||_0xde9a('0xf'),'channelId':_0xde9a('0x10'),'conversation':{'id':_0x398c3b[_0xde9a('0x11')]},'from':{'id':_0x398c3b['callerid'],'name':_0x398c3b[_0xde9a('0x12')]},'recipient':{'id':_0x398c3b[_0xde9a('0x13')],'name':_0x398c3b[_0xde9a('0x14')]},'text':_0x11047e[_0xde9a('0x15')],'channelData':{}},'headers':{'Authorization':_0xde9a('0x16')+_0x5d4412[_0xde9a('0x17')]},'json':!![]};if(_0x11047e[_0xde9a('0x18')]){_0x45d4a7[_0xde9a('0x19')][_0xde9a('0x1a')]['ProjectName']=_0x11047e[_0xde9a('0x18')];}if(_0x11047e[_0xde9a('0x1b')]=='1'){_0x45d4a7[_0xde9a('0x19')][_0xde9a('0x1a')][_0xde9a('0x1c')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xde9a('0x1d')};}if(_0x11047e[_0xde9a('0x1e')]){_0x45d4a7[_0xde9a('0x19')][_0xde9a('0x1a')][_0xde9a('0x1f')]=_0x11047e[_0xde9a('0x1e')];if(_0x11047e[_0xde9a('0x20')]){_0x45d4a7[_0xde9a('0x19')][_0xde9a('0x1a')][_0xde9a('0x21')]=_0x11047e[_0xde9a('0x20')];}}logger['info'](JSON[_0xde9a('0x22')](_0x45d4a7));return rp(_0x45d4a7);});}; \ No newline at end of file +var _0x4e34=['password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','agi','POST','resolve','ndauth_url','username'];(function(_0x4a83e1,_0xdd919a){var _0x374e60=function(_0x8f3f00){while(--_0x8f3f00){_0x4a83e1['push'](_0x4a83e1['shift']());}};_0x374e60(++_0xdd919a);}(_0x4e34,0x19e));var _0x44e3=function(_0xb23f3c,_0x2d2814){_0xb23f3c=_0xb23f3c-0x0;var _0x2143fc=_0x4e34[_0xb23f3c];return _0x2143fc;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x44e3('0x0'))(_0x44e3('0x1'));module['exports']=function(_0x511088,_0xdaba22){var _0x554c08={'method':_0x44e3('0x2'),'uri':url[_0x44e3('0x3')](_0xdaba22[_0x44e3('0x4')],'/token'),'form':{'grant_type':'password','username':_0xdaba22[_0x44e3('0x5')],'password':_0xdaba22[_0x44e3('0x6')]},'json':!![]};return rp(_0x554c08)[_0x44e3('0x7')](function(_0x1ca56e){var _0x37b7d4={'method':_0x44e3('0x2'),'uri':url[_0x44e3('0x3')](_0xdaba22['ndassistant_url'],_0x44e3('0x8')),'body':{'type':_0xdaba22[_0x44e3('0x9')]||'message','channelId':'Nda','conversation':{'id':_0x511088[_0x44e3('0xa')]},'from':{'id':_0x511088[_0x44e3('0xb')],'name':_0x511088['calleridname']},'recipient':{'id':_0x511088['dnid'],'name':_0x511088[_0x44e3('0xc')]},'text':_0xdaba22[_0x44e3('0xd')],'channelData':{}},'headers':{'Authorization':_0x44e3('0xe')+_0x1ca56e[_0x44e3('0xf')]},'json':!![]};if(_0xdaba22['project']){_0x37b7d4[_0x44e3('0x10')][_0x44e3('0x11')][_0x44e3('0x12')]=_0xdaba22[_0x44e3('0x13')];}if(_0xdaba22[_0x44e3('0x14')]=='1'){_0x37b7d4[_0x44e3('0x10')][_0x44e3('0x11')][_0x44e3('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0xdaba22[_0x44e3('0x16')]){_0x37b7d4['body'][_0x44e3('0x11')][_0x44e3('0x17')]=_0xdaba22['custom_action'];if(_0xdaba22[_0x44e3('0x18')]){_0x37b7d4[_0x44e3('0x10')][_0x44e3('0x11')][_0x44e3('0x19')]=_0xdaba22[_0x44e3('0x18')];}}logger[_0x44e3('0x1a')](JSON[_0x44e3('0x1b')](_0x37b7d4));return rp(_0x37b7d4);});}; \ 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 2f52954..9c84b6e 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 _0x3ef5=['exports'];(function(_0x55ac3e,_0x3336f6){var _0x23099e=function(_0x187715){while(--_0x187715){_0x55ac3e['push'](_0x55ac3e['shift']());}};_0x23099e(++_0x3336f6);}(_0x3ef5,0x115));var _0x53ef=function(_0x4a7bde,_0x5af865){_0x4a7bde=_0x4a7bde-0x0;var _0x5630be=_0x3ef5[_0x4a7bde];return _0x5630be;};'use strict';var asr=require('./lib/api');module[_0x53ef('0x0')]=function(_0x775e06,_0x4a029c,_0x4e1b04,_0x580fba){return asr(_0x775e06,_0x4a029c,_0x4e1b04,_0x580fba);}; \ No newline at end of file +var _0x84d6=['./lib/api','exports'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x84d6,0x180));var _0x684d=function(_0x221ef5,_0x148cf1){_0x221ef5=_0x221ef5-0x0;var _0x217766=_0x84d6[_0x221ef5];return _0x217766;};'use strict';var asr=require(_0x684d('0x0'));module[_0x684d('0x1')]=function(_0x276d7b,_0xbc9d17,_0x26a46e,_0x3d0cdd){return asr(_0x276d7b,_0xbc9d17,_0x26a46e,_0x3d0cdd);}; \ 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 03856cb..f75ddc9 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 _0xf948=['result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Close\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','crypto','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','status'];(function(_0x19dbb4,_0x1e7969){var _0x53e63f=function(_0x18b0e3){while(--_0x18b0e3){_0x19dbb4['push'](_0x19dbb4['shift']());}};_0x53e63f(++_0x1e7969);}(_0xf948,0xac));var _0x8f94=function(_0x568591,_0x12546f){_0x568591=_0x568591-0x0;var _0x37865c=_0xf948[_0x568591];return _0x37865c;};'use strict';var BPromise=require('bluebird');var _=require(_0x8f94('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x8f94('0x1'));var logger=require('../../../../../../config/logger')('agi');module[_0x8f94('0x2')]=function(_0x34891e,_0x1a8a85,_0x2121f6,_0x495e7f){return new BPromise(function(_0x3cc1bb,_0x29e32f){logger[_0x8f94('0x3')](_0x8f94('0x4'),_0x495e7f||_0x8f94('0x5'));var _0x4ce229=new WebSocket(_0x495e7f||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x10cb60='';var _0x19c13d='0';var _0x2b728c='1';var _0x29c5a1=_0x8f94('0x6');function _0x1c1cbc(_0x4905ce){var _0x43c05f=crypto[_0x8f94('0x7')]('sha1');_0x43c05f[_0x8f94('0x8')](_0x4905ce);return _0x43c05f[_0x8f94('0x9')]('hex');}function _0x5c049f(){try{logger[_0x8f94('0x3')](_0x8f94('0xa'));var _0x89d16c=moment()[_0x8f94('0xb')]();var _0x5a0270=_0x1c1cbc(_0x89d16c+_0x1a8a85+_0x2121f6);_0x4ce229[_0x8f94('0xc')](JSON[_0x8f94('0xd')]({'appID':_0x1a8a85,'timestamp':_0x89d16c,'appKey':_0x5a0270}));var _0x340c70=fs['createReadStream'](_0x34891e);_0x340c70['on'](_0x8f94('0xe'),function(_0xfa97d2){_0x4ce229[_0x8f94('0xc')](_0xfa97d2);});_0x340c70['on'](_0x8f94('0xf'),function(){_0x4ce229[_0x8f94('0xc')]('EOS');});}catch(_0x4c5723){logger[_0x8f94('0x10')](_0x8f94('0x11'),JSON[_0x8f94('0xd')](_0x4c5723));_0x4ce229[_0x8f94('0x12')]();}}function _0x427fb6(_0x38bc30){try{if(_0x38bc30){var _0x36f70e=JSON['parse'](_0x38bc30);switch(_0x36f70e[_0x8f94('0x13')]){case 0x0:if(_0x36f70e[_0x8f94('0x14')]){if(_0x36f70e[_0x8f94('0x14')][_0x8f94('0x15')]){logger[_0x8f94('0x3')]('Tilde\x20ASR\x20hypoteses',JSON[_0x8f94('0xd')](_0x36f70e[_0x8f94('0x14')][_0x8f94('0x16')]));_0x10cb60=_0x36f70e[_0x8f94('0x14')]['hypotheses'][0x0][_0x8f94('0x17')];_0x19c13d=_0x36f70e[_0x8f94('0x14')][_0x8f94('0x16')][0x0]['likelihood'];_0x2b728c='0';_0x29c5a1=_0x8f94('0x18');_0x4ce229[_0x8f94('0x12')]();}}break;case 0x1:logger[_0x8f94('0x3')](_0x8f94('0x6'));_0x2b728c='1';_0x29c5a1=_0x8f94('0x6');break;case 0x2:logger[_0x8f94('0x3')](_0x8f94('0x19'));_0x2b728c='2';_0x29c5a1=_0x8f94('0x19');break;case 0x9:logger[_0x8f94('0x3')](_0x8f94('0x1a'));_0x2b728c='9';_0x29c5a1=_0x8f94('0x1a');break;case 0xa:logger[_0x8f94('0x3')](_0x8f94('0x1b'));_0x2b728c='10';_0x29c5a1='Authentication\x20failed.';break;case 0xb:logger[_0x8f94('0x3')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2b728c='11';_0x29c5a1='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4f9f6b){logger[_0x8f94('0x10')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x8f94('0xd')](_0x4f9f6b));_0x4ce229[_0x8f94('0x12')]();}}function _0x2865c1(){logger['info'](_0x8f94('0x1c'));_0x3cc1bb({'transcript':_0x10cb60,'confidence':_0x19c13d,'status':_0x2b728c,'status_message':_0x29c5a1});}function _0x57b9db(_0x28660c){logger[_0x8f94('0x10')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x8f94('0x1d')](_0x28660c)){logger[_0x8f94('0x10')](_['isObject'](_0x28660c)?JSON[_0x8f94('0xd')](_0x28660c):_0x28660c);}}_0x4ce229['on'](_0x8f94('0x1e'),_0x5c049f);_0x4ce229['on'](_0x8f94('0x1f'),_0x427fb6);_0x4ce229['on']('close',_0x2865c1);_0x4ce229['on'](_0x8f94('0x10'),_0x57b9db);});}; \ No newline at end of file +var _0xedca=['result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','digest','hex','unix','stringify','createReadStream','data','close','send','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status'];(function(_0xa9b86b,_0x4d3964){var _0x4094f6=function(_0x576f1a){while(--_0x576f1a){_0xa9b86b['push'](_0xa9b86b['shift']());}};_0x4094f6(++_0x4d3964);}(_0xedca,0x160));var _0xaedc=function(_0x7d08bd,_0x75a0ed){_0x7d08bd=_0x7d08bd-0x0;var _0x2bd178=_0xedca[_0x7d08bd];return _0x2bd178;};'use strict';var BPromise=require(_0xaedc('0x0'));var _=require(_0xaedc('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xaedc('0x2'));var crypto=require(_0xaedc('0x3'));var logger=require(_0xaedc('0x4'))(_0xaedc('0x5'));module[_0xaedc('0x6')]=function(_0x4c3d57,_0x2e7b15,_0x236438,_0xa8d048){return new BPromise(function(_0x11f97c,_0x17b98c){logger[_0xaedc('0x7')](_0xaedc('0x8'),_0xa8d048||_0xaedc('0x9'));var _0x45ba39=new WebSocket(_0xa8d048||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0xd0c203='';var _0x5e9531='0';var _0x1d8094='1';var _0x588f4e='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2f0bfc(_0x206158){var _0x1f756a=crypto[_0xaedc('0xa')]('sha1');_0x1f756a[_0xaedc('0xb')](_0x206158);return _0x1f756a[_0xaedc('0xc')](_0xaedc('0xd'));}function _0x41499(){try{logger[_0xaedc('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x4701cb=moment()[_0xaedc('0xe')]();var _0x2ab4a6=_0x2f0bfc(_0x4701cb+_0x2e7b15+_0x236438);_0x45ba39['send'](JSON[_0xaedc('0xf')]({'appID':_0x2e7b15,'timestamp':_0x4701cb,'appKey':_0x2ab4a6}));var _0x58efd0=fs[_0xaedc('0x10')](_0x4c3d57);_0x58efd0['on'](_0xaedc('0x11'),function(_0x3fa111){_0x45ba39['send'](_0x3fa111);});_0x58efd0['on'](_0xaedc('0x12'),function(){_0x45ba39[_0xaedc('0x13')](_0xaedc('0x14'));});}catch(_0x40d9a0){logger[_0xaedc('0x15')](_0xaedc('0x16'),JSON['stringify'](_0x40d9a0));_0x45ba39[_0xaedc('0x17')]();}}function _0x321453(_0x1b97e9){try{if(_0x1b97e9){var _0x2f82dc=JSON[_0xaedc('0x18')](_0x1b97e9);switch(_0x2f82dc[_0xaedc('0x19')]){case 0x0:if(_0x2f82dc[_0xaedc('0x1a')]){if(_0x2f82dc[_0xaedc('0x1a')][_0xaedc('0x1b')]){logger[_0xaedc('0x7')](_0xaedc('0x1c'),JSON[_0xaedc('0xf')](_0x2f82dc[_0xaedc('0x1a')][_0xaedc('0x1d')]));_0xd0c203=_0x2f82dc[_0xaedc('0x1a')]['hypotheses'][0x0][_0xaedc('0x1e')];_0x5e9531=_0x2f82dc[_0xaedc('0x1a')][_0xaedc('0x1d')][0x0]['likelihood'];_0x1d8094='0';_0x588f4e='Success.';_0x45ba39['terminate']();}}break;case 0x1:logger['info'](_0xaedc('0x1f'));_0x1d8094='1';_0x588f4e=_0xaedc('0x1f');break;case 0x2:logger[_0xaedc('0x7')](_0xaedc('0x20'));_0x1d8094='2';_0x588f4e=_0xaedc('0x20');break;case 0x9:logger[_0xaedc('0x7')](_0xaedc('0x21'));_0x1d8094='9';_0x588f4e=_0xaedc('0x21');break;case 0xa:logger[_0xaedc('0x7')](_0xaedc('0x22'));_0x1d8094='10';_0x588f4e=_0xaedc('0x22');break;case 0xb:logger[_0xaedc('0x7')](_0xaedc('0x23'));_0x1d8094='11';_0x588f4e='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1a972c){logger[_0xaedc('0x15')](_0xaedc('0x24'),JSON[_0xaedc('0xf')](_0x1a972c));_0x45ba39[_0xaedc('0x17')]();}}function _0x2fdb15(){logger[_0xaedc('0x7')](_0xaedc('0x25'));_0x11f97c({'transcript':_0xd0c203,'confidence':_0x5e9531,'status':_0x1d8094,'status_message':_0x588f4e});}function _0x12b846(_0x50ee0f){logger[_0xaedc('0x15')](_0xaedc('0x26'));if(!_[_0xaedc('0x27')](_0x50ee0f)){logger[_0xaedc('0x15')](_['isObject'](_0x50ee0f)?JSON[_0xaedc('0xf')](_0x50ee0f):_0x50ee0f);}}_0x45ba39['on'](_0xaedc('0x28'),_0x41499);_0x45ba39['on'](_0xaedc('0x29'),_0x321453);_0x45ba39['on']('close',_0x2fdb15);_0x45ba39['on'](_0xaedc('0x15'),_0x12b846);});}; \ 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 b6d2b10..ec63d6b 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 _0x8daa=['./asr','exports'];(function(_0x2c8805,_0x320e32){var _0x31fd9f=function(_0x272c9f){while(--_0x272c9f){_0x2c8805['push'](_0x2c8805['shift']());}};_0x31fd9f(++_0x320e32);}(_0x8daa,0x10a));var _0xa8da=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0x8daa[_0x14476b];return _0x24e2e8;};var asr=require(_0xa8da('0x0'));module[_0xa8da('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe590=['./asr'];(function(_0x4ff394,_0x452c58){var _0x325ef1=function(_0x5e51e4){while(--_0x5e51e4){_0x4ff394['push'](_0x4ff394['shift']());}};_0x325ef1(++_0x452c58);}(_0xe590,0x132));var _0x0e59=function(_0x3c7c47,_0x11cd8f){_0x3c7c47=_0x3c7c47-0x0;var _0x678b91=_0xe590[_0x3c7c47];return _0x678b91;};var asr=require(_0x0e59('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b44f181..f8f425b 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index ff385dd..a0011ed 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 _0x13f6=['MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','createSquareMessage','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','response','test','mindigit','no\x20variable\x20found','generate','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','answer','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','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','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\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','getsecretdigits','rpc','mailRpc','prototype','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','arg_1','file','createCmContact','isEmpty','isNil','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','body','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured'];(function(_0x553ae0,_0x1ef5e4){var _0x41ade2=function(_0x111291){while(--_0x111291){_0x553ae0['push'](_0x553ae0['shift']());}};_0x41ade2(++_0x1ef5e4);}(_0x13f6,0x124));var _0x613f=function(_0xe22db5,_0x52829d){_0xe22db5=_0xe22db5-0x0;var _0x1f56cc=_0x13f6[_0xe22db5];return _0x1f56cc;};'use strict';var fs=require('fs');var util=require(_0x613f('0x0'));var _=require(_0x613f('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var Mustache=require(_0x613f('0x4'));var rp=require('request-promise');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var shared=require('../../config/environment/shared');var scripts=require(_0x613f('0x8'));var FILES_PATH=_0x613f('0x9');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=['menu','getdigits',_0x613f('0xa')];var AGIVertices=function(_0x1e6ca2,_0x363736,_0x35b672){this['channel']=_0x1e6ca2;this[_0x613f('0xb')]=_0x363736;this[_0x613f('0xc')]=_0x35b672;};AGIVertices[_0x613f('0xd')]['getVariable']=function(_0x2622f3,_0x164edf){this[_0x613f('0xb')]['getVariableById'](_0x2622f3)[_0x613f('0xe')](function(_0xa81fcd){_0x164edf(null,_0xa81fcd?_0xa81fcd['name']:![]);})['catch'](function(_0x517f57){_0x164edf(_0x517f57);});};AGIVertices[_0x613f('0xd')][_0x613f('0xf')]=function(_0x3832d8,_0x375db1){this[_0x613f('0xb')][_0x613f('0x10')](_0x3832d8)[_0x613f('0xe')](function(_0x291268){_0x375db1(null,_0x291268?_0x291268[_0x613f('0x11')]:![]);})[_0x613f('0x12')](function(_0x548218){_0x375db1(_0x548218);});};AGIVertices[_0x613f('0xd')]['getSquareProject']=function(_0x5c769c,_0x1bc605){this[_0x613f('0xb')]['getSquareProjectById'](_0x5c769c)[_0x613f('0xe')](function(_0x4f9dae){_0x1bc605(null,_0x4f9dae?_0x4f9dae[_0x613f('0x11')]:![]);})[_0x613f('0x12')](function(_0x431266){_0x1bc605(_0x431266);});};AGIVertices[_0x613f('0xd')][_0x613f('0x13')]=function(_0x1ba35f,_0x4e412c){this['rpc'][_0x613f('0x14')](_0x1ba35f)['then'](function(_0x48493c){_0x4e412c(null,_0x48493c?_0x48493c[_0x613f('0x15')]:![]);})[_0x613f('0x12')](function(_0x4f5a5a){_0x4e412c(_0x4f5a5a);});};AGIVertices[_0x613f('0xd')][_0x613f('0x16')]=function(_0x2aa14b,_0x48b28a){this['rpc'][_0x613f('0x17')](_0x2aa14b)[_0x613f('0xe')](function(_0x2acfcf){_0x48b28a(null,_0x2acfcf?_0x2acfcf['name']:![]);})[_0x613f('0x12')](function(_0x33e0c6){_0x48b28a(_0x33e0c6);});};AGIVertices[_0x613f('0xd')][_0x613f('0x18')]=function(_0x3013a1,_0x4e3d5a){this[_0x613f('0xb')][_0x613f('0x19')](_0x3013a1)['then'](function(_0x22035f){_0x4e3d5a(null,_0x22035f?_0x22035f[_0x613f('0x11')]:![]);})[_0x613f('0x12')](function(_0x4a878d){_0x4e3d5a(_0x4a878d);});};AGIVertices['prototype']['getSound']=function(_0x379920,_0x594c28){var _0x412269=this;this[_0x613f('0xb')]['getSoundById'](_0x379920)[_0x613f('0xe')](function(_0x2551c1){_0x594c28(null,_0x2551c1?_0x412269['getSoundPath'](_0x2551c1['save_name']):![]);})['catch'](function(_0x24be7c){_0x594c28(_0x24be7c);});};AGIVertices[_0x613f('0xd')][_0x613f('0x1a')]=function(_0x47f4af,_0x23eda8){this[_0x613f('0xb')][_0x613f('0x1b')](_0x47f4af)[_0x613f('0xe')](function(_0x4f8500){_0x23eda8(null,_0x4f8500?_0x4f8500:![]);})[_0x613f('0x12')](function(_0x5b2a1f){_0x23eda8(_0x5b2a1f);});};AGIVertices[_0x613f('0xd')][_0x613f('0x1c')]=function(_0x10fa2b,_0x1664f1,_0x5d7e9a){this[_0x613f('0xc')][_0x613f('0x1c')](_0x10fa2b,_0x1664f1)[_0x613f('0xe')](function(){_0x5d7e9a(null);})['catch'](function(_0x21a1d1){_0x5d7e9a(_0x21a1d1);});};AGIVertices['prototype'][_0x613f('0x1d')]=function(_0x11e7c2,_0xc8976c){this[_0x613f('0xb')][_0x613f('0x1e')](_0x11e7c2)[_0x613f('0xe')](function(_0x589157){if(_0x589157){if(_0x589157[_0x613f('0x1f')]){_0xc8976c(null,[_0x589157[_0x613f('0x20')]]);}else{_0xc8976c(null,_[_0x613f('0x21')](_0x589157[_0x613f('0x22')],_0x613f('0x20')));}}else{_0xc8976c(null,![]);}})['catch'](function(_0x59236e){_0xc8976c(_0x59236e);});};AGIVertices['prototype'][_0x613f('0x23')]=function(_0x72c804){return util[_0x613f('0x24')](_0x613f('0x25'),FILES_PATH,_0x72c804);};AGIVertices['prototype'][_0x613f('0x26')]=function(_0xaedbbd,_0x4ed25f,_0x45e6df){odbc['open'](_0xaedbbd,function(_0x310016){if(_0x310016){logger['error'](_0x613f('0x27'),_0x310016);_0x45e6df(_0x310016);}else{logger['info'](_0x613f('0x28'));odbc[_0x613f('0x29')](_0x4ed25f,function(_0x46842f,_0x511bb7){if(_0x46842f){logger[_0x613f('0x2a')](_0x613f('0x2b'),_0x4ed25f);_0x45e6df(_0x46842f);}else{logger[_0x613f('0x2a')](_0x613f('0x2c'),_0x4ed25f);odbc[_0x613f('0x2d')](function(_0x19708b){if(_0x19708b){logger[_0x613f('0x2e')](_0x613f('0x2f'),_0x19708b);}_0x45e6df(null,_0x511bb7);});}});}});};AGIVertices[_0x613f('0xd')][_0x613f('0x30')]=function(_0x4da8d3,_0x28b1bc){this[_0x613f('0xb')][_0x613f('0x31')](_0x4da8d3)[_0x613f('0xe')](function(_0x301d33){_0x28b1bc(null,_0x301d33?_0x301d33:![]);})[_0x613f('0x12')](function(_0xa76fff){_0x28b1bc(_0xa76fff);});};AGIVertices['prototype'][_0x613f('0x32')]=function(_0x696f16,_0x3b88d7){this[_0x613f('0xb')][_0x613f('0x32')](_0x696f16)[_0x613f('0xe')](function(_0x1040ba){_0x3b88d7(null,_0x1040ba);})['catch'](function(_0x343a59){_0x3b88d7(_0x343a59);});};AGIVertices[_0x613f('0xd')][_0x613f('0x33')]=function(_0x2f584e,_0x3952c9,_0x1c63ec){this[_0x613f('0xb')][_0x613f('0x33')]({'uniqueid':this[_0x613f('0x34')][_0x613f('0x35')],'node':_0x2f584e[_0x613f('0x36')],'application':_0x2f584e[_0x613f('0x37')],'data':_0x3952c9||null,'project_name':this[_0x613f('0x34')]['arg_1'],'callerid':this[_0x613f('0x34')][_0x613f('0x38')]})[_0x613f('0xe')](function(_0x4968dc){if(_0x1c63ec){_0x1c63ec(null,_0x4968dc);}})['catch'](function(_0x152a3c){if(_0x1c63ec){_0x1c63ec(_0x152a3c);}});};AGIVertices[_0x613f('0xd')][_0x613f('0x39')]=function(_0x16b288,_0xdaec43,_0x12c36f,_0x2d1a89){this[_0x613f('0xb')][_0x613f('0x39')]({'uniqueid':this[_0x613f('0x34')]['uniqueid'],'callerid':this['channel'][_0x613f('0x38')],'calleridname':this[_0x613f('0x34')]['calleridname'],'context':this[_0x613f('0x34')][_0x613f('0x3a')],'extension':this[_0x613f('0x34')][_0x613f('0x3b')],'priority':this[_0x613f('0x34')][_0x613f('0x3c')],'accountcode':this[_0x613f('0x34')][_0x613f('0x3d')],'dnid':this[_0x613f('0x34')][_0x613f('0x3e')],'projectName':this[_0x613f('0x34')][_0x613f('0x3f')],'saveName':_0xdaec43,'filename':_0x16b288[_0x613f('0x40')]||_0xdaec43,'savePath':_0x12c36f})[_0x613f('0xe')](function(_0x1fd46c){_0x2d1a89(null,_0x1fd46c);})[_0x613f('0x12')](function(_0x3adc7c){_0x2d1a89(_0x3adc7c);});};AGIVertices[_0x613f('0xd')]['createSquareMessage']=function(_0x47c84b,_0x114645,_0x69ea16,_0x5f0f73,_0x48d29a){this[_0x613f('0xb')]['createSquareMessage']({'uniqueid':this['channel'][_0x613f('0x35')],'body':_0x47c84b,'direction':_0x114645,'providerName':_0x69ea16,'providerResponse':_0x5f0f73})[_0x613f('0xe')](function(_0x26ba69){if(_0x48d29a){_0x48d29a(null,_0x26ba69);}})['catch'](function(_0x1e3298){if(_0x48d29a){_0x48d29a(_0x1e3298);}});};AGIVertices[_0x613f('0xd')]['createCmContact']=function(_0x55e878,_0x1c0c8e){this[_0x613f('0xb')][_0x613f('0x41')]({'firstName':_[_0x613f('0x42')](_0x55e878[_0x613f('0x11')])||_[_0x613f('0x43')](_0x55e878[_0x613f('0x11')])?'callback_'+Math['random']():_0x55e878[_0x613f('0x11')],'lastName':_['isEmpty'](_0x55e878['lastName'])||_[_0x613f('0x43')](_0x55e878[_0x613f('0x44')])?null:_0x55e878[_0x613f('0x44')],'phone':_0x55e878['phone'],'ListId':_0x55e878[_0x613f('0x45')],'scheduledat':_0x55e878[_0x613f('0x46')],'callbackUniqueid':this[_0x613f('0x34')][_0x613f('0x35')],'tags':_0x613f('0x47'),'description':_0x613f('0x48')+_0x55e878[_0x613f('0x46')]['toString'](),'priority':_0x55e878[_0x613f('0x49')]})['then'](function(_0x3ce3dd){_0x1c0c8e(null,_0x3ce3dd);})[_0x613f('0x12')](function(_0x33bbde){_0x1c0c8e(_0x33bbde);});};AGIVertices[_0x613f('0xd')][_0x613f('0x4a')]=function(_0x1df0c8,_0x2161f6){this[_0x613f('0xb')][_0x613f('0x4b')](_0x1df0c8)[_0x613f('0xe')](function(_0x2ebce1){_0x2161f6(null,_0x2ebce1?_0x2ebce1[_0x613f('0x11')]:![]);})[_0x613f('0x12')](function(_0x54ad8f){_0x2161f6(_0x54ad8f);});};AGIVertices['prototype'][_0x613f('0x4c')]=function(_0x4b6eb3,_0xcb1c9d,_0x3c3cd7){var _0x42a72b={'role':_0x613f('0x4d')};_0x42a72b[_0x4b6eb3]=this[_0x613f('0x34')][_0x613f('0x38')];this[_0x613f('0xb')][_0x613f('0x4c')](_0x42a72b,_0xcb1c9d,this[_0x613f('0x34')][_0x613f('0x35')])[_0x613f('0xe')](function(_0x588bba){_0x3c3cd7(null,_[_0x613f('0x43')](_0x588bba)?![]:!![]);})[_0x613f('0x12')](function(_0x2688cd){logger[_0x613f('0x2e')](_0x2688cd);_0x3c3cd7(null,![]);});};AGIVertices['prototype'][_0x613f('0x4e')]=function(_0xe28447,_0x4babc6){var _0x49ab25={'role':_0x613f('0x4d')};_0x49ab25[_0xe28447]=this['channel']['callerid'];this['rpc'][_0x613f('0x4e')](_0x49ab25)['then'](function(_0x49854b){_0x4babc6(null,_['isNil'](_0x49854b)?![]:!![]);})[_0x613f('0x12')](function(_0xbf0903){logger['error'](_0xbf0903);_0x4babc6(null,![]);});};AGIVertices[_0x613f('0xd')][_0x613f('0x4f')]=function(_0x8ba26d,_0x2a7ca7){var _0x5b8712={'role':_0x613f('0x4d')};_0x5b8712[_0x8ba26d]=this[_0x613f('0x34')]['callerid'];this[_0x613f('0xb')][_0x613f('0x4f')](_0x5b8712)[_0x613f('0xe')](function(_0x24bff9){_0x2a7ca7(null,_[_0x613f('0x43')](_0x24bff9)?![]:!![]);})[_0x613f('0x12')](function(_0xbead7c){logger[_0x613f('0x2e')](_0xbead7c);_0x2a7ca7(null,![]);});};AGIVertices[_0x613f('0xd')][_0x613f('0x50')]=function(_0x14f418,_0x2e5c06){var _0x50d7ca={'role':_0x613f('0x4d')};_0x50d7ca[_0x14f418]=this[_0x613f('0x34')][_0x613f('0x38')];var _0x36c3af=_0x14f418!=_0x613f('0x51')?util[_0x613f('0x24')]('%s/%s@from-sip/n',_0x613f('0x52'),this[_0x613f('0x34')][_0x613f('0x38')]):undefined;this[_0x613f('0xb')][_0x613f('0x50')](_0x50d7ca,_0x36c3af)[_0x613f('0xe')](function(_0x4ec334){_0x2e5c06(null,_['isNil'](_0x4ec334)?![]:!![]);})[_0x613f('0x12')](function(_0x25a550){logger[_0x613f('0x2e')](_0x25a550);_0x2e5c06(null,![]);});};AGIVertices[_0x613f('0xd')]['shellCommand']=function(_0x11d2f4,_0x29e5c8){sh[_0x613f('0x53')](_[_0x613f('0x54')](_0x11d2f4),function(_0x5af9c6,_0x282a9f){var _0x28005b=_0x282a9f[_0x613f('0x55')](/(\r\n|\n|\r)/gm,'');_0x29e5c8(null,_0x28005b);});};AGIVertices[_0x613f('0xd')][_0x613f('0x56')]=function(_0x45e933,_0x2892f4){scripts[_0x613f('0x56')](_0x45e933['apiKey'],_0x45e933[_0x613f('0x57')]||_0x613f('0x58'),_0x45e933[_0x613f('0x58')],_0x45e933[_0x613f('0x59')]||_0x613f('0x5a'),_0x45e933[_0x613f('0x5b')]||_0x613f('0x5c'),_0x45e933[_0x613f('0x5d')]||_0x613f('0x5e'))[_0x613f('0xe')](function(_0x4c4710){_0x2892f4(null,_0x4c4710);})[_0x613f('0x12')](function(_0x285424){_0x2892f4(_0x285424);});};AGIVertices[_0x613f('0xd')][_0x613f('0x5f')]=function(_0x3838cf,_0x418f53){scripts[_0x613f('0x5f')](_0x3838cf[_0x613f('0x58')],_0x3838cf[_0x613f('0x60')]||'en',0x1)[_0x613f('0xe')](function(_0x278fac){_0x418f53(null,_0x278fac);})['catch'](function(_0xb36b52){_0x418f53(_0xb36b52);});};AGIVertices[_0x613f('0xd')][_0x613f('0x61')]=function(_0x907273,_0x205957){var _0x2de316={'uri':_0x907273[_0x613f('0x62')],'method':_0x907273[_0x613f('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x907273[_0x613f('0x64')])===_0x613f('0x65')&&parseInt(_0x907273[_0x613f('0x64')])>=0x1?parseInt(_0x907273[_0x613f('0x64')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x613f('0x66'),_0x613f('0x67')],_0x2de316['method'][_0x613f('0x68')]())){try{_0x2de316['body']=_0x907273[_0x613f('0x69')]?JSON['parse'](_0x907273['rawBody']):{};}catch(_0x2587ad){logger[_0x613f('0x2e')](_0x613f('0x6a'),_0x2587ad);}}try{_0x2de316[_0x613f('0x6b')]=_0x907273[_0x613f('0x6c')]?JSON[_0x613f('0x6d')](_0x907273[_0x613f('0x6c')]):{};}catch(_0x5be071){logger[_0x613f('0x2e')](_0x613f('0x6e'),_0x5be071);}if(_0x907273[_0x613f('0x6f')]){try{var _0x2bc172=require(_0x907273[_0x613f('0x6f')])['sync'](this,_0x2de316);_0x2de316[_0x613f('0x70')]=Mustache[_0x613f('0x71')](_0x907273['url'],_0x2bc172,{},['$$','$$']);if(_0x2de316[_0x613f('0x6b')]){_0x2de316[_0x613f('0x6b')]=JSON[_0x613f('0x6d')](Mustache['render'](JSON['stringify'](_0x2de316['headers']),_0x2bc172,{},['$$','$$']));}if(_0x2de316[_0x613f('0x72')]){_0x2de316[_0x613f('0x72')]=JSON['parse'](Mustache[_0x613f('0x71')](JSON[_0x613f('0x73')](_0x2de316[_0x613f('0x72')]),_0x2bc172,{},['$$','$$']));}}catch(_0x59e0e1){logger[_0x613f('0x2e')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x59e0e1);}}rp(_0x2de316)[_0x613f('0xe')](function(_0x537763){var _0x4953e3={'statusCode':_0x537763[_0x613f('0x74')]||0xc8,'statusMessage':_0x537763[_0x613f('0x75')]||'OK','headers':_0x537763[_0x613f('0x6b')]||{},'body':_0x537763[_0x613f('0x72')]||{}};_0x205957(null,_0x4953e3);})[_0x613f('0x12')](function(_0x42a59b){var _0x107126={'statusCode':_0x42a59b[_0x613f('0x74')]||0x1f4,'statusMessage':_0x42a59b[_0x613f('0x76')]||_0x613f('0x77'),'headers':_0x42a59b[_0x613f('0x78')]['headers']||{},'body':_0x42a59b[_0x613f('0x78')][_0x613f('0x72')]||{}};_0x205957(null,_0x107126);});};AGIVertices[_0x613f('0xd')][_0x613f('0x79')]=function(_0x399491,_0x2b3220){scripts[_0x613f('0x79')](this['channel'][_0x613f('0x35')],_0x399491[_0x613f('0x7a')],_0x399491[_0x613f('0x58')],_0x399491[_0x613f('0x7b')]||'en')['then'](function(_0x102e35){_0x2b3220(null,_0x102e35);})[_0x613f('0x12')](function(_0x14c426){_0x2b3220(_0x14c426);});};AGIVertices[_0x613f('0xd')][_0x613f('0x7c')]=function(_0x2fb442,_0x5d3a30){scripts[_0x613f('0x7c')](this[_0x613f('0x34')]['uniqueid'],_0x2fb442[_0x613f('0x7d')],_0x2fb442[_0x613f('0x7e')],_0x2fb442[_0x613f('0x7f')],_0x2fb442[_0x613f('0x58')],_0x2fb442[_0x613f('0x80')]||'en')['then'](function(_0x275e85){_0x5d3a30(null,_0x275e85);})[_0x613f('0x12')](function(_0x443c3d){_0x5d3a30(_0x443c3d);});};AGIVertices[_0x613f('0xd')][_0x613f('0x81')]=function(_0x1f9c40,_0x52ad92){scripts['sestekNDA'](this[_0x613f('0x34')],_0x1f9c40)[_0x613f('0xe')](function(_0x2e7533){_0x52ad92(null,_0x2e7533);})['catch'](function(_0x3fa7aa){_0x52ad92(_0x3fa7aa);});};AGIVertices[_0x613f('0xd')][_0x613f('0x82')]=function(_0x3f93dc,_0x5bf46e){scripts[_0x613f('0x82')](_0x3f93dc[_0x613f('0x7a')],_0x3f93dc['text'],_0x3f93dc['ispeech_tts_language']||'en-US',_0x3f93dc[_0x613f('0x83')])['then'](function(_0x2dc994){_0x5bf46e(null,_0x2dc994);})[_0x613f('0x12')](function(_0x2be5a8){_0x5bf46e(_0x2be5a8);});};AGIVertices[_0x613f('0xd')]['ispeechASR']=function(_0x205b4f,_0x344ad7,_0x8d820f){scripts[_0x613f('0x84')](_0x344ad7,_0x205b4f[_0x613f('0x7a')],_0x205b4f[_0x613f('0x85')]||_0x613f('0x5a'),this['isConfigured'](_0x205b4f[_0x613f('0x86')])?_0x205b4f[_0x613f('0x86')]:undefined)[_0x613f('0xe')](function(_0x58c8f3){_0x8d820f(null,_0x58c8f3);})[_0x613f('0x12')](function(_0x446cf6){_0x8d820f(_0x446cf6);});};AGIVertices[_0x613f('0xd')]['awsPolly']=function(_0x3a4eca,_0xe74780){scripts[_0x613f('0x87')](_0x3a4eca[_0x613f('0x88')],_0x3a4eca[_0x613f('0x89')],_0x3a4eca[_0x613f('0x8a')],_0x3a4eca[_0x613f('0x8b')]||_0x613f('0x8c'),_0x3a4eca['text'],_0x3a4eca['aws_text_type']||_0x613f('0x58'))[_0x613f('0xe')](function(_0x27b2f1){_0xe74780(null,_0x27b2f1);})[_0x613f('0x12')](function(_0x13acaa){_0xe74780(_0x13acaa);});};AGIVertices['prototype'][_0x613f('0x8d')]=function(_0x4e560f,_0x1f72e7){scripts[_0x613f('0x8d')](this[_0x613f('0x34')][_0x613f('0x35')],_0x4e560f['aws_access_key_id'],_0x4e560f[_0x613f('0x89')],_0x4e560f[_0x613f('0x8e')],_0x4e560f['text'],_0x4e560f[_0x613f('0x8f')])['then'](function(_0x199494){_0x1f72e7(null,_0x199494);})[_0x613f('0x12')](function(_0x443f07){_0x1f72e7(_0x443f07);});};AGIVertices[_0x613f('0xd')][_0x613f('0x90')]=function(_0x5ac9d2,_0x3f11b3,_0xef032b){scripts['googleASR'](_0x3f11b3,_0x5ac9d2[_0x613f('0x7a')],_0x5ac9d2['google_asr_language']||_0x613f('0x5a'))[_0x613f('0xe')](function(_0x24c189){_0xef032b(null,_0x24c189);})[_0x613f('0x12')](function(_0x385d2a){_0xef032b(_0x385d2a);});};AGIVertices[_0x613f('0xd')][_0x613f('0x91')]=function(_0x5ef935,_0x46430f,_0x3aabf7){scripts[_0x613f('0x91')](_0x46430f,_0x5ef935[_0x613f('0x92')],_0x5ef935[_0x613f('0x93')],_0x5ef935[_0x613f('0x70')])[_0x613f('0xe')](function(_0x50d7ce){_0x3aabf7(null,_0x50d7ce);})[_0x613f('0x12')](function(_0xf41f3b){_0x3aabf7(_0xf41f3b);});};AGIVertices['prototype'][_0x613f('0x94')]=function(_0x280a4c){var _0x550975=_[_0x613f('0x95')](verticesWithRetry,_0x280a4c[_0x613f('0x37')])?_0x280a4c:_['clone'](_0x280a4c);for(var _0x28f494 in _0x550975){if(_0x550975[_0x613f('0x96')](_0x28f494)){if(_0x550975[_0x28f494]&&_[_0x613f('0x97')](_0x550975[_0x28f494])){if(_[_0x613f('0x95')](recursiveMapAttributes,_0x28f494)){_0x550975[_0x28f494]=this[_0x613f('0x98')](_0x550975[_0x28f494]);}else{_0x550975[_0x28f494]=this[_0x613f('0x99')](_0x550975[_0x28f494]);}}}}return _0x550975;};AGIVertices[_0x613f('0xd')][_0x613f('0x9a')]=function(_0x442bb8){for(var _0x1f21be in _0x442bb8){if(_0x442bb8[_0x613f('0x96')](_0x1f21be)){if(_[_0x613f('0x9b')](_0x442bb8[_0x1f21be])){this[_0x613f('0x9a')](_0x442bb8[_0x1f21be]);}else if(_[_0x613f('0x9c')](_0x442bb8[_0x1f21be])){for(var _0x6110c0=0x0;_0x6110c0<_0x442bb8[_0x1f21be][_0x613f('0x9d')];_0x6110c0++){this[_0x613f('0x9a')](_0x442bb8[_0x1f21be][_0x6110c0]);}}else if(_[_0x613f('0x97')](_0x442bb8[_0x1f21be])){_0x442bb8[_0x1f21be]=this[_0x613f('0x99')](_0x442bb8[_0x1f21be]);}}}};AGIVertices[_0x613f('0xd')]['saveRestApiResult']=function(_0x318874,_0x5d558e){for(var _0xf56397 in _0x318874){if(_0x318874[_0x613f('0x96')](_0xf56397)){if(_['isPlainObject'](_0x318874[_0xf56397])){if(!_[_0x613f('0x42')](_0x318874[_0xf56397])){this[_0x613f('0x9e')](_0x318874[_0xf56397],util[_0x613f('0x24')](_0x613f('0x9f'),_0x5d558e,_0xf56397));}}else if(_[_0x613f('0x9c')](_0x318874[_0xf56397])){for(var _0x442fca=0x0;_0x442fca<_0x318874[_0xf56397]['length'];_0x442fca++){this[_0x613f('0x9e')](_0x318874[_0xf56397][_0x442fca],util[_0x613f('0x24')]('%s.%s',_0x5d558e,_0xf56397+'['+_0x442fca+']'));}}else{if(!_[_0x613f('0x43')](_0x318874[_0xf56397])){this[_0x613f('0x34')][_0x613f('0xa0')](util[_0x613f('0x24')](_0x613f('0x9f'),_0x5d558e,_0xf56397),_0x318874[_0xf56397]);}}}}};AGIVertices[_0x613f('0xd')]['replaceObjectAllVariables']=function(_0xa5e108){try{var _0x456f89=JSON[_0x613f('0x6d')](_0xa5e108);this[_0x613f('0x9a')](_0x456f89);return JSON[_0x613f('0x73')](_0x456f89);}catch(_0x210674){return this[_0x613f('0x99')](_0xa5e108);}};AGIVertices[_0x613f('0xd')]['replaceAllVariables']=function(_0x3793f4){var _0x5aab24=_0x3793f4['split']('{');for(var _0x1ea4ba=0x1;_0x1ea4ba<_0x5aab24[_0x613f('0x9d')];_0x1ea4ba+=0x1){var _0x4a98af=_0x5aab24[_0x1ea4ba][_0x613f('0xa1')]('}');if(_0x4a98af[_0x613f('0x9d')]>0x1){_0x3793f4=_0x3793f4[_0x613f('0xa2')]('{'+_0x4a98af[0x0]+'}',this[_0x613f('0x34')][_0x613f('0xa3')](_0x4a98af[0x0])[_0x613f('0xa4')]||_0x4a98af[0x0]);}}if(_0x5aab24[_0x613f('0x9d')]===0x1){return _0x3793f4[_0x613f('0xa5')]();}return this[_0x613f('0x99')](_0x3793f4);};AGIVertices['prototype'][_0x613f('0xa6')]=function(_0x5cb8c5,_0x42be0a){var _0x36fb8a=this['channel'][_0x613f('0xa3')](_0x5cb8c5);if(_0x36fb8a['result']===-0x1){return _0x36fb8a;}logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0xa7'),_0x42be0a,_0x36fb8a['extra']));return this[_0x613f('0x34')][_0x613f('0xa0')](_0x42be0a,_0x36fb8a[_0x613f('0xa4')]);};AGIVertices[_0x613f('0xd')][_0x613f('0xa8')]=function(_0x459450){return _0x459450&&_0x459450!=='0'&&_0x459450!=='-1'&&_0x459450!=='';};AGIVertices[_0x613f('0xd')][_0x613f('0xa9')]=function(_0x20641d){this['createSquareDetailsReport'][_0x613f('0xaa')](this,_0x20641d,'-');_0x20641d[_0x613f('0xab')]=_0x20641d[_0x613f('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x613f('0xac')]=function(_0x22eedd){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0xad'),_0x22eedd[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x22eedd[_0x613f('0x58')])){return this['channel'][_0x613f('0xae')](_0x613f('0xaf'));}var _0x5ba82d='\x22'+_0x22eedd[_0x613f('0x58')]+'\x22';if(this[_0x613f('0xa8')](_0x22eedd[_0x613f('0x78')])){_0x5ba82d+=','+_0x22eedd[_0x613f('0x78')];}var _0x23e393=this['channel']['exec'](_0x613f('0xb0'),_0x5ba82d);if(_0x23e393[_0x613f('0xb1')]===-0x1){return _0x23e393;}return this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')](_0x613f('0xb2'),_0x5ba82d));};AGIVertices[_0x613f('0xd')]['mrcprecog']=function(_0x3571fc){logger['info'](util['format'](_0x613f('0xb3'),_0x3571fc[_0x613f('0x36')]));if(!this['isConfigured'](_0x3571fc[_0x613f('0xb4')])){return this[_0x613f('0x34')]['noop'](_0x613f('0xb5'));}var _0x262b83=_0x3571fc[_0x613f('0xb4')];if(this[_0x613f('0xa8')](_0x3571fc[_0x613f('0x78')])){_0x262b83+=','+_0x3571fc['options'];}var _0x4c5378=this[_0x613f('0x34')]['exec'](_0x613f('0xb6'),_0x262b83);if(_0x4c5378['result']===-0x1){return _0x4c5378;}var _0x41cbd4=this['getAndSetVariable'](_0x613f('0xb7'),'MRCP_RECOG_CONFIDENCE');if(_0x41cbd4['result']===-0x1){return _0x41cbd4;}var _0x115697=this[_0x613f('0xa6')]('RECOG_INPUT()',_0x613f('0xb8'));if(_0x115697['result']===-0x1){return _0x115697;}var _0x591a02=this['getAndSetVariable'](_0x613f('0xb9'),_0x613f('0xba'));if(_0x591a02[_0x613f('0xb1')]===-0x1){return _0x591a02;}return this['channel'][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0xbb'),_0x262b83));};AGIVertices['prototype'][_0x613f('0x6')]=function(_0x26b700){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0xbc'),_0x26b700[_0x613f('0x36')]));return this[_0x613f('0x34')]['agi']([_0x26b700[_0x613f('0xbd')],_0x26b700[_0x613f('0xbe')]]);};AGIVertices[_0x613f('0xd')]['answer']=function(_0xc10a6c){logger[_0x613f('0x2a')](util[_0x613f('0x24')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xc10a6c[_0x613f('0x36')]));if(this[_0x613f('0xa8')](_0xc10a6c[_0x613f('0x64')])){logger['info'](util[_0x613f('0x24')]('Wait\x20%s\x20seconds\x20before\x20answer',_0xc10a6c[_0x613f('0x64')]));var _0x172a31=this[_0x613f('0x34')][_0x613f('0xbf')](_0xc10a6c[_0x613f('0x64')]);if(_0x172a31[_0x613f('0xb1')]===-0x1){return _0x172a31;}}return this[_0x613f('0x34')]['answer']();};AGIVertices['prototype']['callback']=function(_0x38fcb2){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0xc0'),_0x38fcb2['label']));if(!this['isConfigured'](_0x38fcb2[_0x613f('0x45')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x38fcb2,_0x613f('0xc1'));}_0x38fcb2[_0x613f('0x46')]=moment();if(this['isConfigured'](_0x38fcb2['delay'])){_0x38fcb2[_0x613f('0x46')]=moment()[_0x613f('0xc2')](_0x38fcb2[_0x613f('0xc3')],_0x613f('0xc4'));}if(!this[_0x613f('0xa8')](_0x38fcb2['callback_priority'])){_0x38fcb2[_0x613f('0x49')]=0x2;}this[_0x613f('0x41')][_0x613f('0xaa')](this,_0x38fcb2);return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0xc5'),_0x38fcb2[_0x613f('0xc6')],_0x38fcb2[_0x613f('0x45')],_0x38fcb2[_0x613f('0x46')]));};AGIVertices[_0x613f('0xd')][_0x613f('0xc7')]=function(_0x19b90c){logger['info'](util[_0x613f('0x24')](_0x613f('0xc8'),_0x19b90c[_0x613f('0x36')]));var _0x29ae7a=this['channel'][_0x613f('0x53')](_0x19b90c[_0x613f('0xc9')],_0x19b90c['options']);if(_0x29ae7a[_0x613f('0xb1')]===-0x1){return _0x29ae7a;}return this['channel'][_0x613f('0xae')](util[_0x613f('0x24')]('Executed\x20command\x20%s\x20%s',_0x19b90c['application'],_0x19b90c[_0x613f('0x78')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x207687){logger[_0x613f('0x2a')](util['format'](_0x613f('0xca'),_0x207687['label']));if(!this[_0x613f('0xa8')](_0x207687['text'])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0xaf'));}var _0xff6615='\x22'+_0x207687['text']+'\x22';if(this[_0x613f('0xa8')](_0x207687[_0x613f('0x78')])){_0xff6615+=','+_0x207687[_0x613f('0x78')];}var _0x47ef95=this['channel']['exec'](_0x613f('0xb0'),_0xff6615);if(_0x47ef95['result']===-0x1){return _0x47ef95;}return this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')](_0x613f('0xb2'),_0xff6615));};AGIVertices[_0x613f('0xd')][_0x613f('0xcb')]=function(_0x14ac3b){logger[_0x613f('0x2a')](util['format'](_0x613f('0xcc'),_0x14ac3b[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x14ac3b['text'])){return this[_0x613f('0x34')]['noop'](_0x613f('0xaf'));}var _0x5fdaf8='\x22'+_0x14ac3b[_0x613f('0x58')]+'\x22';if(this['isConfigured'](_0x14ac3b[_0x613f('0x78')])){_0x5fdaf8+=','+_0x14ac3b['options'];}var _0x2d34f5=this['channel'][_0x613f('0x53')](_0x613f('0xb0'),_0x5fdaf8);if(_0x2d34f5[_0x613f('0xb1')]===-0x1){return _0x2d34f5;}return this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5fdaf8));};AGIVertices[_0x613f('0xd')][_0x613f('0xcd')]=function(_0x2648b0){logger['info'](util[_0x613f('0x24')](_0x613f('0xce'),_0x2648b0[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x2648b0[_0x613f('0xb4')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0xb5'));}var _0x292a88=_0x2648b0[_0x613f('0xb4')];if(this['isConfigured'](_0x2648b0['options'])){_0x292a88+=','+_0x2648b0[_0x613f('0x78')];}var _0xfeaf64=this['channel']['exec']('MRCPRecog',_0x292a88);if(_0xfeaf64[_0x613f('0xb1')]===-0x1){return _0xfeaf64;}var _0x58588a=this['getAndSetVariable'](_0x613f('0xb7'),_0x613f('0xcf'));if(_0x58588a['result']===-0x1){return _0x58588a;}var _0x2db077=this[_0x613f('0xa6')](_0x613f('0xd0'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2db077[_0x613f('0xb1')]===-0x1){return _0x2db077;}var _0x552891=this[_0x613f('0xa6')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x552891[_0x613f('0xb1')]===-0x1){return _0x552891;}return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0xbb'),_0x292a88));};AGIVertices['prototype'][_0x613f('0xd1')]=function(_0x4558d3){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0xd2'),_0x4558d3[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x4558d3[_0x613f('0xb4')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0xb5'));}var _0x256d75=_0x4558d3[_0x613f('0xb4')];if(this[_0x613f('0xa8')](_0x4558d3['options'])){_0x256d75+=','+_0x4558d3['options'];}var _0x30a7e2=this[_0x613f('0x34')][_0x613f('0x53')](_0x613f('0xb6'),_0x256d75);if(_0x30a7e2[_0x613f('0xb1')]===-0x1){return _0x30a7e2;}var _0x527fc3=this['getAndSetVariable'](_0x613f('0xb7'),_0x613f('0xd3'));if(_0x527fc3[_0x613f('0xb1')]===-0x1){return _0x527fc3;}var _0x3671b4=this['getAndSetVariable'](_0x613f('0xd0'),_0x613f('0xd4'));if(_0x3671b4[_0x613f('0xb1')]===-0x1){return _0x3671b4;}var _0x4e1ddd=this[_0x613f('0xa6')](_0x613f('0xb9'),_0x613f('0xd5'));if(_0x4e1ddd['result']===-0x1){return _0x4e1ddd;}return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0xbb'),_0x256d75));};AGIVertices['prototype'][_0x613f('0xd6')]=function(_0x1fd03f){logger[_0x613f('0x2a')](util['format'](_0x613f('0xd7'),_0x1fd03f[_0x613f('0x36')]));if(!this['isConfigured'](_0x1fd03f[_0x613f('0xd8')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x1fd03f,'no\x20database\x20selected');}var _0x22c00e=this['getSquareOdbc'][_0x613f('0xaa')](this,_0x1fd03f[_0x613f('0xd8')]);if(!_0x22c00e){return this['channel'][_0x613f('0x2e')](_0x1fd03f,_0x613f('0xd9'));}if(!this[_0x613f('0xa8')](_0x1fd03f['query'])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x1fd03f,'no\x20query\x20configured');}var _0x3df261=_0x1fd03f[_0x613f('0x29')][_0x613f('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x613f('0x34')]['noop'](util['format'](_0x613f('0xda'),_0x3df261));var _0x37c9ae=this[_0x613f('0x26')]['sync'](this,_0x22c00e,_0x3df261);this[_0x613f('0x33')]['sync'](this,_0x1fd03f,_0x3df261);if(!this['isConfigured'](_0x1fd03f['variable_id'])){return this['channel'][_0x613f('0xae')](_0x613f('0xdb'));}var _0x37a7ca=this[_0x613f('0xa3')][_0x613f('0xaa')](this,_0x1fd03f[_0x613f('0xdc')]);if(!_0x37a7ca){return this[_0x613f('0x34')]['error'](_0x1fd03f,'no\x20variable\x20found');}var _0x55e56a=this;_0x37c9ae['forEach'](function(_0x2dc9c3,_0x4cfb5d){Object[_0x613f('0xdd')](_0x2dc9c3)[_0x613f('0xde')](function(_0x1db7ac){_0x55e56a[_0x613f('0x34')][_0x613f('0xa0')](util['format'](_0x613f('0xdf'),_0x37a7ca,_0x4cfb5d,_0x1db7ac),_0x2dc9c3[_0x1db7ac]);});});this[_0x613f('0x34')][_0x613f('0xa0')](util['format'](_0x613f('0xe0'),_0x37a7ca),_0x37c9ae[_0x613f('0x9d')]);return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0xe1'),_0x37a7ca));};AGIVertices[_0x613f('0xd')][_0x613f('0xe2')]=function(_0x467fa5){logger['debug'](util['format'](_0x613f('0xe3'),_0x467fa5[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x467fa5[_0x613f('0xe4')])){return this['channel'][_0x613f('0x2e')](_0x467fa5,_0x613f('0xe5'));}var _0x234a6f=this['getUser'][_0x613f('0xaa')](this,_0x467fa5[_0x613f('0xe4')]);if(!_0x234a6f){return this['channel'][_0x613f('0x2e')](_0x467fa5,_0x613f('0xe6'));}var _0xb42c0=this[_0x613f('0x34')][_0x613f('0x53')]('DIAL',[util['format']('SIP/%s',_0x234a6f),_0x467fa5['timeout'],_0x467fa5[_0x613f('0xe7')],_0x467fa5[_0x613f('0x62')]]);if(_0xb42c0[_0x613f('0xb1')]===-0x1){return _0xb42c0;}return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0xe8'),_0x613f('0xe9')));};AGIVertices[_0x613f('0xd')]['dialogflow']=function(_0x1d933c){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0xea'),_0x1d933c[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x1d933c['key'])){return this[_0x613f('0x34')]['noop'](_0x613f('0xeb'));}if(!this['isConfigured'](_0x1d933c[_0x613f('0x58')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0xaf'));}this[_0x613f('0x34')][_0x613f('0xec')]=!![];this['createSquareDetailsReport'](_0x1d933c);this['createSquareMessage'](_0x1d933c[_0x613f('0x58')],'in','','');this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')](_0x613f('0xed'),_0x1d933c[_0x613f('0x58')]));var _0x5672e2=this[_0x613f('0x79')]['sync'](this,_0x1d933c);if(_0x5672e2){for(var _0x158480 in _0x5672e2){if(_0x5672e2[_0x613f('0x96')](_0x158480)){this[_0x613f('0x34')][_0x613f('0xa0')](util['format'](_0x613f('0xee'),_0x158480[_0x613f('0x68')]()),_0x5672e2[_0x158480]);}}this[_0x613f('0xef')](_0x5672e2[_0x613f('0xf0')],_0x613f('0xf1'),_0x613f('0xf2'),'');return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')]('Dialogflow\x20Result\x20%s',_0x5672e2[_0x613f('0xf0')]));}return this[_0x613f('0x34')]['error'](_0x1d933c,_0x613f('0xf3'));};AGIVertices[_0x613f('0xd')][_0x613f('0xf4')]=function(_0x34a8f3){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0xf5'),_0x34a8f3['label']));if(!this['isConfigured'](_0x34a8f3[_0x613f('0x7d')])){return this['channel'][_0x613f('0xae')](_0x613f('0xf6'));}if(!this[_0x613f('0xa8')](_0x34a8f3[_0x613f('0x7e')])){return this['channel'][_0x613f('0xae')](_0x613f('0xf7'));}if(!this[_0x613f('0xa8')](_0x34a8f3[_0x613f('0x7f')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0xf8'));}if(!this[_0x613f('0xa8')](_0x34a8f3[_0x613f('0x80')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0xf9'));}if(!this[_0x613f('0xa8')](_0x34a8f3[_0x613f('0x58')])){return this['channel'][_0x613f('0xae')](_0x613f('0xaf'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x34a8f3);this[_0x613f('0xef')](_0x34a8f3[_0x613f('0x58')],'in','','');this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0xfa'),_0x34a8f3[_0x613f('0x58')]));var _0x1220b8=this['googleDialogflowV2'][_0x613f('0xaa')](this,_0x34a8f3);if(_0x1220b8){for(var _0x558e54 in _0x1220b8){if(_0x1220b8[_0x613f('0x96')](_0x558e54)){if(_0x558e54!=='providerResponse'){this[_0x613f('0x34')]['setVariable'](util[_0x613f('0x24')]('DIALOGFLOW_%s',_0x558e54['toUpperCase']()),_0x1220b8[_0x558e54]);}}}this[_0x613f('0xef')](_0x1220b8['speech'],'out',_0x613f('0xf4'),_0x1220b8[_0x613f('0xfb')]);return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0xfc'),_0x1220b8[_0x613f('0xf0')]));}return this[_0x613f('0x34')]['error'](_0x34a8f3,_0x613f('0xfd'));};AGIVertices[_0x613f('0xd')][_0x613f('0xfe')]=function(_0xe40ecf){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0xff'),_0xe40ecf[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0xe40ecf[_0x613f('0x100')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x101'));}if(!this['isConfigured'](_0xe40ecf[_0x613f('0x102')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x103'));}if(!this[_0x613f('0xa8')](_0xe40ecf[_0x613f('0x104')])){return this[_0x613f('0x34')]['noop'](_0x613f('0x105'));}if(!this[_0x613f('0xa8')](_0xe40ecf[_0x613f('0x106')])){return this['channel'][_0x613f('0xae')](_0x613f('0xaf'));}this['channel'][_0x613f('0xec')]=!![];this['createSquareDetailsReport'](_0xe40ecf);this[_0x613f('0xef')](_0xe40ecf[_0x613f('0x58')],'in','','');this['channel'][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x107'),_0xe40ecf['text']));var _0x151ec5=this[_0x613f('0x81')][_0x613f('0xaa')](this,_0xe40ecf);if(_0x151ec5){for(var _0x1ed876 in _0x151ec5){if(_0x151ec5[_0x613f('0x96')](_0x1ed876)){this[_0x613f('0x34')]['setVariable'](util[_0x613f('0x24')](_0x613f('0x108'),_0x1ed876[_0x613f('0x68')]()),_0x151ec5[_0x1ed876]);}}this['createSquareMessage'](_0x151ec5[_0x613f('0xf0')],_0x613f('0xf1'),_0x613f('0xfe'),'');if(_0x151ec5[_0x613f('0x109')]){this['channel'][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x10a'),_0x151ec5['audiofile']));var _0x46858e=this[_0x613f('0x34')]['streamFile'](_0x151ec5['audiofile']);try{fs[_0x613f('0x10b')](_0x151ec5[_0x613f('0x109')]+_0x613f('0x10c'));}catch(_0x4ddc0f){logger['error'](_0x4ddc0f);}return _0x46858e;}else{return this[_0x613f('0x34')][_0x613f('0xae')](util['format'](_0x613f('0x10d'),_0x151ec5[_0x613f('0xf0')]));}}return this[_0x613f('0x34')][_0x613f('0x2e')](_0xe40ecf,_0x613f('0x10e'));};AGIVertices[_0x613f('0xd')][_0x613f('0x10f')]=function(_0xe24bd9){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x110'),_0xe24bd9['label']));return this[_0x613f('0x34')]['noop'](_0x613f('0x10f'));};AGIVertices[_0x613f('0xd')][_0x613f('0x111')]=function(_0x23f469){logger['info'](util[_0x613f('0x24')](_0x613f('0x112'),_0x23f469['label']));var _0x4d837e='';if(_0x23f469[_0x613f('0x113')]){if(!this['isConfigured'](_0x23f469[_0x613f('0x113')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x23f469,_0x613f('0x114'));}else{var _0x27a402=parseInt(_0x23f469[_0x613f('0x113')],0xa);if(isNaN(_0x27a402)){_0x4d837e=_0x23f469[_0x613f('0x113')];}else{_0x4d837e=this[_0x613f('0x18')][_0x613f('0xaa')](this,_0x23f469[_0x613f('0x113')]);if(!_0x4d837e){return this['channel'][_0x613f('0x2e')](_0x23f469,'no\x20trunk\x20found');}}}}else if(_0x23f469[_0x613f('0x115')]){_0x4d837e=_0x23f469[_0x613f('0x115')];}else{return this[_0x613f('0x34')][_0x613f('0x2e')](_0x23f469,_0x613f('0x114'));}var _0x45e15b=this[_0x613f('0x34')]['exec'](_0x613f('0xe9'),[util[_0x613f('0x24')](_0x613f('0x116'),_0x4d837e,_0x23f469[_0x613f('0xc6')]),_0x23f469[_0x613f('0x64')],_0x23f469[_0x613f('0xe7')],_0x23f469[_0x613f('0x62')]]);if(_0x45e15b['result']===-0x1){return _0x45e15b;}return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0xe8'),_0x613f('0xe9')));};AGIVertices[_0x613f('0xd')][_0x613f('0x117')]=function(_0x532254){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x118'),_0x532254['label']));return this[_0x613f('0x34')]['noop'](_0x613f('0x117'));};AGIVertices['prototype'][_0x613f('0x119')]=function(_0xb2c23b){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x11a'),_0xb2c23b['label']));if(_0xb2c23b[_0x613f('0xab')]===0x0){return this[_0x613f('0xa9')](_0xb2c23b);}_0xb2c23b[_0x613f('0xab')]-=0x1;if(!this['isConfigured'](_0xb2c23b[_0x613f('0x11b')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0xb2c23b,_0x613f('0x11c'));}var _0x36e2e0=this[_0x613f('0x11d')][_0x613f('0xaa')](this,_0xb2c23b[_0x613f('0x11b')]);if(!_0x36e2e0){return this[_0x613f('0x34')]['error'](_0xb2c23b,_0x613f('0x11e'));}if(!this[_0x613f('0xa8')](_0xb2c23b[_0x613f('0xdc')])){return this[_0x613f('0x34')]['error'](_0x613f('0xdb'));}var _0x574ee4=this['channel']['getData'](_0x36e2e0,_0xb2c23b[_0x613f('0x11f')],_0xb2c23b['maxdigit']);var _0x4d554f=_0x574ee4[_0x613f('0xb1')]?_0x574ee4[_0x613f('0xb1')]['toString']():'';logger['info'](_0x613f('0x120'),JSON[_0x613f('0x73')](_0x574ee4));if(_0x574ee4['result']===-0x1){this[_0x613f('0x33')][_0x613f('0xaa')](this,_0xb2c23b,_0x4d554f);return _0x574ee4;}else if(_0x574ee4[_0x613f('0xa4')]===_0x613f('0x64')){_0x574ee4[_0x613f('0xb1')]=_0x4d554f[_0x613f('0x9d')]>=parseInt(_0xb2c23b[_0x613f('0x121')])?'x':'i';}else{_0x574ee4[_0x613f('0xb1')]=_0x4d554f[_0x613f('0x9d')]>=parseInt(_0xb2c23b[_0x613f('0x121')])&&_0x4d554f[_0x613f('0x9d')]<=parseInt(_0xb2c23b['maxdigit'])?'x':'i';}var _0x28f525=this[_0x613f('0xa3')][_0x613f('0xaa')](this,_0xb2c23b[_0x613f('0xdc')]);if(!_0x28f525){return this[_0x613f('0x34')]['error'](_0xb2c23b,_0x613f('0x122'));}this[_0x613f('0x34')][_0x613f('0xa0')](_0x28f525,_0x4d554f);if(this[_0x613f('0xa8')](_0xb2c23b['hiddendigitsnum'])){var _0x185e59=parseInt(_0xb2c23b['hiddendigitsnum'],0xa);var _0x4e320=rs[_0x613f('0x123')]({'charset':'*','length':_0x185e59});var _0x177e0b=_0x4d554f['length'];if(_0x177e0b>0x0){if(_0x177e0b>_0x185e59){this[_0x613f('0x33')]['sync'](this,_0xb2c23b,_0xb2c23b['hiddendigitspos']===_0x613f('0x124')?_0x4e320+_0x4d554f[_0x613f('0x125')](_0x185e59):_0x4d554f[_0x613f('0x125')](0x0,_0x177e0b-_0x185e59)+_0x4e320);}else{this['createSquareDetailsReport'][_0x613f('0xaa')](this,_0xb2c23b,rs[_0x613f('0x123')]({'charset':'*','length':_0x177e0b}));}}else{this['createSquareDetailsReport'][_0x613f('0xaa')](this,_0xb2c23b,'');}}else{this[_0x613f('0x33')][_0x613f('0xaa')](this,_0xb2c23b,_0x4d554f);}return _0x574ee4;};AGIVertices[_0x613f('0xd')][_0x613f('0xa')]=function(_0x4735e2){logger[_0x613f('0x2a')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4735e2[_0x613f('0x36')]));return this[_0x613f('0x119')](_0x4735e2);};AGIVertices[_0x613f('0xd')][_0x613f('0x126')]=function(_0x34ddbb){logger['info'](util[_0x613f('0x24')](_0x613f('0x127'),_0x34ddbb[_0x613f('0x36')]));this[_0x613f('0x33')][_0x613f('0xaa')](this,_0x34ddbb,_0x34ddbb[_0x613f('0x128')]);return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x129'),_0x34ddbb[_0x613f('0x128')]));};AGIVertices[_0x613f('0xd')]['awspolly']=function(_0x2d0a43){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x12a'),_0x2d0a43['label']));if(!this[_0x613f('0xa8')](_0x2d0a43[_0x613f('0x88')])||!this[_0x613f('0xa8')](_0x2d0a43[_0x613f('0x89')])){return this['channel'][_0x613f('0xae')](_0x613f('0x12b'));}if(!this[_0x613f('0xa8')](_0x2d0a43[_0x613f('0x58')])){return this[_0x613f('0x34')]['noop'](_0x613f('0xaf'));}this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x12c'),_0x2d0a43[_0x613f('0x58')]));var _0x4ba17b=this[_0x613f('0x87')][_0x613f('0xaa')](this,_0x2d0a43);if(_0x4ba17b){this[_0x613f('0x34')][_0x613f('0xae')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x4ba17b));var _0x2928be=this['channel'][_0x613f('0x12d')](_0x4ba17b);try{fs[_0x613f('0x10b')](_0x4ba17b+'.wav');}catch(_0xb09b06){logger[_0x613f('0x2e')](_0xb09b06);}return _0x2928be;}return this['channel'][_0x613f('0x2e')](_0x2d0a43,_0x613f('0x12e'));};AGIVertices['prototype']['awslex']=function(_0x45fb3e){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x12f'),_0x45fb3e['label']));if(!this['isConfigured'](_0x45fb3e[_0x613f('0x88')])||!this[_0x613f('0xa8')](_0x45fb3e[_0x613f('0x89')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x12b'));}if(!this['isConfigured'](_0x45fb3e['aws_bot_name'])){return this['channel']['noop'](_0x613f('0x130'));}if(!this[_0x613f('0xa8')](_0x45fb3e[_0x613f('0x58')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0xaf'));}this[_0x613f('0x34')][_0x613f('0xec')]=!![];this['createSquareDetailsReport'](_0x45fb3e);this[_0x613f('0xef')](_0x45fb3e[_0x613f('0x58')],'in','','');this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x131'),_0x45fb3e[_0x613f('0x58')]));var _0x324dde=this['awsLex'][_0x613f('0xaa')](this,_0x45fb3e);if(_0x324dde){for(var _0x245315 in _0x324dde){if(_0x324dde['hasOwnProperty'](_0x245315)&&_[_0x613f('0x97')](_0x324dde[_0x245315])){this[_0x613f('0x34')]['setVariable'](util[_0x613f('0x24')](_0x613f('0x132'),_0x245315[_0x613f('0x68')]()),_0x324dde[_0x245315]);}}if(_['isNil'](_0x324dde[_0x613f('0x76')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x133'));}else{this[_0x613f('0xef')](_0x324dde['message'],'out','amazonlex','');return this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')](_0x613f('0x134'),_0x324dde[_0x613f('0x76')]));}}return this[_0x613f('0x34')][_0x613f('0x2e')](_0x45fb3e,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x613f('0xd')][_0x613f('0x135')]=function(_0x1a0128){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x136'),_0x1a0128['label'],_0x1a0128[_0x613f('0x64')]));if(!this[_0x613f('0xa8')](_0x1a0128[_0x613f('0x7a')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0xeb'));}var _0x12d2c9=_0x613f('0x137');var _0x1fbf87=util[_0x613f('0x24')](_0x613f('0x138'),FILES_PATH,rs['generate'](0x4));var _0xc13b26=util[_0x613f('0x24')](_0x613f('0x9f'),_0x1fbf87,_0x12d2c9);var _0x4905b1=!![];if(_0x1a0128[_0x613f('0x139')]==='NOBEEP'){_0x4905b1=![];}var _0x757d09=this[_0x613f('0x34')]['recordFile'](_0x1fbf87,_0x12d2c9,_0x1a0128[_0x613f('0x13a')],_0x1a0128[_0x613f('0x64')],undefined,_0x4905b1);if(_0x757d09['result']!==-0x1){this['channel'][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x13b'),_0xc13b26));var _0x102ea9=this[_0x613f('0x90')][_0x613f('0xaa')](this,_0x1a0128,_0xc13b26);if(_0x102ea9){for(var _0x54df29 in _0x102ea9){if(_0x102ea9[_0x613f('0x96')](_0x54df29)){this['channel']['setVariable'](util['format']('GOOGLE_ASR_%s',_0x54df29[_0x613f('0x68')]()),_0x102ea9[_0x54df29]);}}return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x13c'),JSON[_0x613f('0x73')](_0x102ea9)));}}return _0x757d09;};AGIVertices[_0x613f('0xd')][_0x613f('0x13d')]=function(_0x191867){logger['info'](util[_0x613f('0x24')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x191867[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x191867[_0x613f('0x92')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x13e'));}if(!this[_0x613f('0xa8')](_0x191867['appsecret'])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x13f'));}var _0x426656=_0x613f('0x137');var _0x23a868=util[_0x613f('0x24')](_0x613f('0x138'),FILES_PATH,rs['generate'](0x4));var _0x54c164=util['format'](_0x613f('0x9f'),_0x23a868,_0x426656);var _0x5949a4=!![];if(_0x191867['beep']===_0x613f('0x140')){_0x5949a4=![];}var _0xd3a49d=this[_0x613f('0x34')][_0x613f('0x141')](_0x23a868,_0x426656,_0x191867['intKey'],_0x191867[_0x613f('0x64')],undefined,_0x5949a4);if(_0xd3a49d[_0x613f('0xb1')]!==-0x1){this['channel'][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x142'),_0x54c164));var _0x104e6e=this[_0x613f('0x91')][_0x613f('0xaa')](this,_0x191867,_0x54c164);if(_0x104e6e){for(var _0x2836b2 in _0x104e6e){if(_0x104e6e['hasOwnProperty'](_0x2836b2)){this[_0x613f('0x34')][_0x613f('0xa0')](util[_0x613f('0x24')]('TILDE_ASR_%s',_0x2836b2[_0x613f('0x68')]()),_0x104e6e[_0x2836b2]);}}return this[_0x613f('0x34')][_0x613f('0xae')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x613f('0x73')](_0x104e6e)));}}return _0xd3a49d;};AGIVertices[_0x613f('0xd')][_0x613f('0x143')]=function(_0x24fc62){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x144'),_0x24fc62[_0x613f('0x36')]));return this['channel'][_0x613f('0x145')](_0x24fc62[_0x613f('0x3a')],_0x24fc62[_0x613f('0x3b')],_0x24fc62[_0x613f('0x3c')]);};AGIVertices[_0x613f('0xd')][_0x613f('0x146')]=function(_0x4cbfec){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x147'),_0x4cbfec['label']));if(!this[_0x613f('0xa8')](_0x4cbfec[_0x613f('0x148')])){return this['channel'][_0x613f('0x2e')](_0x4cbfec,_0x613f('0x149'));}try{var _0x196df0=eval(_0x4cbfec[_0x613f('0x148')])?_0x613f('0x14a'):'false';this[_0x613f('0x34')][_0x613f('0xae')](util['format'](_0x613f('0x14b'),_0x4cbfec[_0x613f('0x148')],_0x196df0));return{'code':0xc8,'result':_0x196df0};}catch(_0x592f1b){return{'code':0xc8,'result':_0x613f('0x14c')};}};AGIVertices[_0x613f('0xd')][_0x613f('0x14d')]=function(_0x57ad0b){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x14e'),_0x57ad0b[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x57ad0b[_0x613f('0x14f')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x57ad0b,_0x613f('0x150'));}var _0x2b9ec8=this['getIntervals'][_0x613f('0xaa')](this,_0x57ad0b['interval_id']);if(!_0x2b9ec8){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x57ad0b,_0x613f('0x151'));}for(var _0x3ef342=0x0;_0x3ef342<_0x2b9ec8[_0x613f('0x9d')];_0x3ef342+=0x1){var _0x564269=this['channel'][_0x613f('0xa3')](util[_0x613f('0x24')](_0x613f('0x152'),_0x2b9ec8[_0x3ef342]));if(_0x564269[_0x613f('0xb1')]===-0x1){return _0x564269;}logger[_0x613f('0x2a')](util['format'](_0x613f('0x153'),_0x2b9ec8[_0x3ef342],_0x564269['extra']));if(_0x564269[_0x613f('0xa4')]===_0x613f('0x14a')){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x153'),_0x2b9ec8[_0x3ef342],_0x613f('0x14a')));this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')]('IFTIME\x20%s\x20%s',_0x2b9ec8[_0x3ef342],_0x613f('0x14a')));return{'code':0xc8,'result':_0x613f('0x14a')};}else{logger[_0x613f('0x2a')](util['format'](_0x613f('0x153'),_0x2b9ec8[_0x3ef342],_0x613f('0x14c')));this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x153'),_0x2b9ec8[_0x3ef342],_0x613f('0x14c')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x613f('0xd')][_0x613f('0x154')]=function(_0x281576){logger[_0x613f('0x2a')](util['format'](_0x613f('0x155'),_0x281576[_0x613f('0x36')]));return this[_0x613f('0x34')][_0x613f('0x154')]();};AGIVertices['prototype'][_0x613f('0x156')]=function(_0x43631c){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x157'),_0x43631c[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x43631c[_0x613f('0x7a')])){return this['channel'][_0x613f('0xae')](_0x613f('0xeb'));}var _0x4ba3d5=_0x613f('0x137');var _0x4a70bf=util[_0x613f('0x24')](_0x613f('0x138'),FILES_PATH,rs[_0x613f('0x123')](0x4));var _0x388d56=util[_0x613f('0x24')](_0x613f('0x9f'),_0x4a70bf,_0x4ba3d5);var _0x8a5f52=!![];if(_0x43631c['beep']==='NOBEEP'){_0x8a5f52=![];}var _0x28c031=this[_0x613f('0x34')]['recordFile'](_0x4a70bf,_0x4ba3d5,_0x43631c['intKey'],_0x43631c[_0x613f('0x64')],undefined,_0x8a5f52);if(_0x28c031['result']!==-0x1){this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x158'),_0x388d56));var _0x2a14df=this[_0x613f('0x84')][_0x613f('0xaa')](this,_0x43631c,_0x388d56);if(_0x2a14df){for(var _0xc042ab in _0x2a14df){if(_0x2a14df[_0x613f('0x96')](_0xc042ab)){this[_0x613f('0x34')]['setVariable'](util[_0x613f('0x24')](_0x613f('0x159'),_0xc042ab['toUpperCase']()),_0x2a14df[_0xc042ab]);}}return this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x2a14df)));}}return _0x28c031;};AGIVertices[_0x613f('0xd')]['ispeechtts']=function(_0x4a0c9f){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x15a'),_0x4a0c9f[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x4a0c9f['key'])){return this[_0x613f('0x34')]['noop'](_0x613f('0xeb'));}if(!this['isConfigured'](_0x4a0c9f[_0x613f('0x58')])){return this[_0x613f('0x34')]['noop']('no\x20text\x20configured');}this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x15b'),_0x4a0c9f['text']));var _0x5be0d5=this['ispeechTTS'][_0x613f('0xaa')](this,_0x4a0c9f);if(_0x5be0d5){this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')]('ispeech\x20%s\x20file\x20created',_0x5be0d5));var _0x28984d=this[_0x613f('0x34')][_0x613f('0x12d')](_0x5be0d5,_0x4a0c9f[_0x613f('0x13a')]);try{fs[_0x613f('0x10b')](_0x5be0d5+_0x613f('0x10c'));}catch(_0x51f3bf){logger['error'](_0x51f3bf);}return _0x28984d;}return this['channel']['error'](_0x4a0c9f,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x613f('0xd')][_0x613f('0x15c')]=function(_0x4038c2){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x15d'),_0x4038c2['label']));if(!this['isConfigured'](_0x4038c2[_0x613f('0x15e')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x4038c2,_0x613f('0x15f'));}logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x160'),this['channel'][_0x613f('0x38')],_0x4038c2[_0x613f('0x15e')]));var _0x12b96b=this['agentLogin']['sync'](this,_0x4038c2[_0x613f('0x15e')]);if(_0x12b96b){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x161'),this[_0x613f('0x34')]['callerid'],_0x4038c2[_0x613f('0x15e')]));this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')](_0x613f('0x161'),this['channel'][_0x613f('0x38')],_0x4038c2[_0x613f('0x15e')]));return{'code':0xc8,'result':_0x613f('0x162')};}else{logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x163'),this[_0x613f('0x34')][_0x613f('0x38')],_0x4038c2['findBy']));this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x163'),this[_0x613f('0x34')][_0x613f('0x38')],_0x4038c2[_0x613f('0x15e')]));return{'code':0xc8,'result':_0x613f('0x164')};}};AGIVertices[_0x613f('0xd')]['logout']=function(_0x4da610){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x165'),_0x4da610[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x4da610[_0x613f('0x15e')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x4da610,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x613f('0x160'),this[_0x613f('0x34')][_0x613f('0x38')],_0x4da610[_0x613f('0x15e')]));var _0x424322=this[_0x613f('0x4f')][_0x613f('0xaa')](this,_0x4da610[_0x613f('0x15e')]);if(_0x424322){logger[_0x613f('0x2a')](util['format'](_0x613f('0x161'),this[_0x613f('0x34')]['callerid'],_0x4da610[_0x613f('0x15e')]));this['channel'][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x161'),this[_0x613f('0x34')]['callerid'],_0x4da610[_0x613f('0x15e')]));return{'code':0xc8,'result':_0x613f('0x162')};}else{logger[_0x613f('0x2a')](util['format'](_0x613f('0x163'),this['channel']['callerid'],_0x4da610[_0x613f('0x15e')]));this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x163'),this[_0x613f('0x34')][_0x613f('0x38')],_0x4da610[_0x613f('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x49b7cc){logger['info'](util['format'](_0x613f('0x166'),_0x49b7cc[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x49b7cc[_0x613f('0x167')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x49b7cc,_0x613f('0x168'));}this['channel'][_0x613f('0xae')](util['format'](_0x613f('0x169'),_0x49b7cc[_0x613f('0x167')]));var _0x54c68e=eval(_0x49b7cc[_0x613f('0x167')]);if(!this['isConfigured'](_0x49b7cc[_0x613f('0xdc')])){return this[_0x613f('0x34')]['noop'](_0x613f('0xdb'));}var _0x3ef8d6=this[_0x613f('0xa3')][_0x613f('0xaa')](this,_0x49b7cc[_0x613f('0xdc')]);if(!_0x3ef8d6){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x49b7cc,_0x613f('0x122'));}if(_['isArray'](_0x54c68e)){var _0x12cf88=this;_0x54c68e[_0x613f('0xde')](function(_0x87b86,_0x1ee08c){_0x12cf88['channel'][_0x613f('0xa0')](util['format'](_0x613f('0x16a'),_0x3ef8d6,_0x1ee08c),_0x87b86);});return this[_0x613f('0x34')][_0x613f('0xae')](util['format']('variable\x20%s[key]\x20set',_0x3ef8d6));}else{return this[_0x613f('0x34')][_0x613f('0xa0')](_0x3ef8d6,_0x54c68e);}};AGIVertices[_0x613f('0xd')][_0x613f('0x16b')]=function(_0x452434){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x16c'),_0x452434[_0x613f('0x36')]));if(_0x452434['retry']===0x0){return this[_0x613f('0xa9')](_0x452434);}_0x452434['retry']-=0x1;if(!this['isConfigured'](_0x452434['file_id'])){return this[_0x613f('0x34')]['error'](_0x452434,_0x613f('0x11c'));}var _0x57121b=this[_0x613f('0x11d')][_0x613f('0xaa')](this,_0x452434[_0x613f('0x11b')]);if(!_0x57121b){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x452434,'no\x20file\x20audio\x20found');}var _0x26d3d6=this[_0x613f('0x34')]['getData'](_0x57121b,_0x452434[_0x613f('0x11f')],_0x452434[_0x613f('0x16d')]);var _0x5e2b70=_0x26d3d6[_0x613f('0xb1')];if(_0x26d3d6['result']===-0x1){this[_0x613f('0x33')][_0x613f('0xaa')](this,_0x452434,'-1');return _0x26d3d6;}else if(_0x26d3d6['extra']===_0x613f('0x64')){_0x26d3d6[_0x613f('0xb1')]=_0x26d3d6[_0x613f('0xb1')][_0x613f('0x9d')]>0x0?_0x26d3d6[_0x613f('0xb1')]:'t';}else if(_['isEmpty'](_0x26d3d6[_0x613f('0xb1')])){_0x26d3d6['result']='#';_0x5e2b70='#';}if(!this['isConfigured'](_0x452434[_0x613f('0xdc')])){this[_0x613f('0x34')][_0x613f('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x58d037=this['getVariable'][_0x613f('0xaa')](this,_0x452434['variable_id']);if(!_0x58d037){return this[_0x613f('0x34')]['error'](_0x452434,'no\x20variable\x20found');}this[_0x613f('0x34')][_0x613f('0xa0')](_0x58d037,_0x5e2b70);}this['createSquareDetailsReport']['sync'](this,_0x452434,_0x5e2b70);return _0x26d3d6;};AGIVertices['prototype'][_0x613f('0xae')]=function(_0x298fc0){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x16e'),_0x298fc0[_0x613f('0x36')]));return this[_0x613f('0x34')][_0x613f('0xae')](_0x298fc0['output']||_0x298fc0[_0x613f('0x36')]);};AGIVertices[_0x613f('0xd')]['pause']=function(_0x444d05){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x16f'),_0x444d05[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x444d05['findBy'])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x444d05,'no\x20find\x20by\x20configured');}logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x160'),this[_0x613f('0x34')][_0x613f('0x38')],_0x444d05[_0x613f('0x15e')]));var _0x40873d=this['getPause'][_0x613f('0xaa')](this,_0x444d05[_0x613f('0x170')]);var _0xf3b6d1=this[_0x613f('0x4c')][_0x613f('0xaa')](this,_0x444d05['findBy'],_0x40873d);if(_0xf3b6d1){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x161'),this[_0x613f('0x34')][_0x613f('0x38')],_0x444d05['findBy']));this['channel'][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x161'),this[_0x613f('0x34')][_0x613f('0x38')],_0x444d05[_0x613f('0x15e')]));return{'code':0xc8,'result':_0x613f('0x162')};}else{logger['info'](util[_0x613f('0x24')](_0x613f('0x163'),this[_0x613f('0x34')]['callerid'],_0x444d05[_0x613f('0x15e')]));this['channel']['noop'](util['format'](_0x613f('0x161'),this[_0x613f('0x34')]['callerid'],_0x444d05[_0x613f('0x15e')]));return{'code':0xc8,'result':_0x613f('0x164')};}};AGIVertices[_0x613f('0xd')]['playback']=function(_0x15fec0){logger['info'](util[_0x613f('0x24')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x15fec0[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x15fec0['file_id'])){return this['channel'][_0x613f('0x2e')](_0x15fec0,_0x613f('0x11c'));}var _0x245155=this[_0x613f('0x11d')][_0x613f('0xaa')](this,_0x15fec0['file_id']);if(!_0x245155){return this['channel'][_0x613f('0x2e')](_0x15fec0,_0x613f('0x11e'));}var _0x3fd35e=this[_0x613f('0x34')][_0x613f('0x53')](_0x613f('0x171'),[_0x245155,_0x15fec0[_0x613f('0xe7')]]);if(_0x3fd35e['result']===-0x1){return _0x3fd35e;}return this[_0x613f('0x34')][_0x613f('0xae')](util['format'](_0x613f('0x172'),'PLAYBACK',_0x245155));};AGIVertices[_0x613f('0xd')][_0x613f('0x173')]=function(_0x167f19){logger['info'](util[_0x613f('0x24')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x167f19['label']));if(!this['isConfigured'](_0x167f19[_0x613f('0x174')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x167f19,_0x613f('0x175'));}var _0x5ade30='';var _0x202f25=parseInt(_0x167f19[_0x613f('0x174')],0xa);if(isNaN(_0x202f25)){_0x5ade30=_0x167f19[_0x613f('0x174')];}else{_0x5ade30=this[_0x613f('0xf')][_0x613f('0xaa')](this,_0x167f19[_0x613f('0x174')]);if(!_0x5ade30){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x167f19,_0x613f('0x176'));}}var _0x567a1a='';if(this[_0x613f('0xa8')](_0x167f19[_0x613f('0x11b')])){var _0x7740e9=this['getSound'][_0x613f('0xaa')](this,_0x167f19[_0x613f('0x11b')]);if(_0x7740e9){_0x567a1a=_0x7740e9;}}this[_0x613f('0x33')][_0x613f('0xaa')](this,_0x167f19,_0x5ade30);if(_0x167f19[_0x613f('0xe7')][_0x613f('0x177')]('x')<0x0){_0x167f19[_0x613f('0xe7')]+='x';}if(_0x167f19[_0x613f('0xe7')][_0x613f('0x177')]('X')<0x0){_0x167f19[_0x613f('0xe7')]+='X';}this[_0x613f('0x34')][_0x613f('0xa0')](_0x613f('0x178'),_0x5ade30?_0x5ade30[_0x613f('0x179')]():'');var _0x245a1f=this['channel'][_0x613f('0x53')](_0x613f('0x17a'),[_0x5ade30,_0x167f19['opts'],_0x167f19['url'],_0x567a1a,_0x167f19[_0x613f('0x64')],_0x167f19['agi'],_0x167f19[_0x613f('0x17b')],_0x167f19[_0x613f('0x17c')],'',_0x167f19[_0x613f('0x17d')]]);if(_0x245a1f[_0x613f('0xb1')]===-0x1){return _0x245a1f;}return this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')](_0x613f('0x172'),_0x613f('0x17a'),_0x5ade30));};AGIVertices[_0x613f('0xd')][_0x613f('0x17e')]=function(_0x7e0b85){logger['info'](util[_0x613f('0x24')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x7e0b85['label']));var _0x2b8dcd=_0x7e0b85[_0x613f('0x17f')]||_0x613f('0x137');var _0x3cd209=util[_0x613f('0x24')](_0x613f('0x180'),this[_0x613f('0x34')]['uniqueid'],rs[_0x613f('0x123')](0x5));var _0x1e3a68=util[_0x613f('0x24')]('%s/recordings/%s.%s',FILES_PATH,_0x3cd209,_0x2b8dcd);var _0x41e38c=util['format'](_0x613f('0x138'),FILES_PATH,_0x3cd209);this[_0x613f('0x39')][_0x613f('0xaa')](this,_0x7e0b85,_0x3cd209,_0x1e3a68);this['channel'][_0x613f('0xa0')](_0x613f('0x181'),_0x3cd209);logger[_0x613f('0x2a')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x41e38c,_0x2b8dcd,_0x7e0b85[_0x613f('0x182')],_0x7e0b85['timeout']);return this[_0x613f('0x34')][_0x613f('0x141')](_0x41e38c,_0x2b8dcd,_0x7e0b85['escape_digits'],_0x7e0b85[_0x613f('0x64')],undefined,!![]);};AGIVertices[_0x613f('0xd')][_0x613f('0x183')]=function(_0x29fa0b){logger[_0x613f('0x2a')](util['format'](_0x613f('0x184'),_0x29fa0b['label']));if(!this['isConfigured'](_0x29fa0b[_0x613f('0x62')])){return this[_0x613f('0x34')][_0x613f('0xae')]('no\x20url\x20configured');}var _0x384565=this[_0x613f('0x61')][_0x613f('0xaa')](this,_0x29fa0b);logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x185'),util[_0x613f('0x186')](_0x384565,{'showHidden':![],'depth':null})));if(!this[_0x613f('0xa8')](_0x29fa0b[_0x613f('0xdc')])){return this['channel'][_0x613f('0xae')](_0x613f('0x187'));}var _0x5c9b20=this['getVariable'][_0x613f('0xaa')](this,_0x29fa0b[_0x613f('0xdc')]);if(!_0x5c9b20){return this[_0x613f('0x34')]['error'](_0x29fa0b,_0x613f('0x122'));}this[_0x613f('0x34')][_0x613f('0xa0')](util['format'](_0x613f('0x188'),_0x5c9b20),_0x384565[_0x613f('0x74')]?_0x384565['statusCode']:'200');this[_0x613f('0x34')]['setVariable'](util[_0x613f('0x24')](_0x613f('0x189'),_0x5c9b20),_0x384565[_0x613f('0x75')]?_0x384565[_0x613f('0x75')]:'OK');if(_0x384565['body']){try{this[_0x613f('0x9e')](_0x384565[_0x613f('0x72')],_0x5c9b20);}catch(_0xbbda57){logger['error'](util['format'](_0x613f('0x18a'),_0x5c9b20));}}return this['channel']['noop'](util[_0x613f('0x24')](_0x613f('0xe1'),_0x5c9b20));};AGIVertices['prototype'][_0x613f('0x18b')]=function(_0x1db84a){logger['info'](util[_0x613f('0x24')](_0x613f('0x18c'),_0x1db84a['label']));return this[_0x613f('0x34')]['sayDigits'](_0x1db84a[_0x613f('0x18d')][_0x613f('0x55')](/\s+/g,''),_0x1db84a[_0x613f('0x182')]);};AGIVertices[_0x613f('0xd')][_0x613f('0x18e')]=function(_0x2a27f6){logger['info'](util[_0x613f('0x24')](_0x613f('0x18f'),_0x2a27f6[_0x613f('0x36')]));return this[_0x613f('0x34')]['sayNumber'](_0x2a27f6[_0x613f('0x65')][_0x613f('0x55')](/\s+/g,''),_0x2a27f6['escape_digits']);};AGIVertices[_0x613f('0xd')][_0x613f('0x190')]=function(_0x32aa73){logger['info'](util[_0x613f('0x24')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x32aa73[_0x613f('0x36')]));return this[_0x613f('0x34')][_0x613f('0x191')](_0x32aa73[_0x613f('0x58')],_0x32aa73[_0x613f('0x182')]);};AGIVertices[_0x613f('0xd')][_0x613f('0x192')]=function(_0x3bd23c){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x193'),_0x3bd23c[_0x613f('0x36')]));if(!this['isConfigured'](_0x3bd23c[_0x613f('0x194')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x195'));}var _0x4866c4=this[_0x613f('0x1a')][_0x613f('0xaa')](this,_0x3bd23c['account_id']);if(!_0x4866c4||!_0x4866c4[_0x613f('0x196')]){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x3bd23c,'no\x20mail\x20account\x20found');}var _0x393e58={'from':util[_0x613f('0x24')](_0x613f('0x197'),_0x4866c4[_0x613f('0x11')],_0x4866c4[_0x613f('0x198')]||_0x4866c4['Smtp'][_0x613f('0x199')]),'to':_0x3bd23c['to']||'','cc':_0x3bd23c['cc']||'','bcc':_0x3bd23c[_0x613f('0x19a')]||'','subject':_0x3bd23c[_0x613f('0x19b')],'html':_0x3bd23c[_0x613f('0x58')],'text':_0x3bd23c['text']};if(this[_0x613f('0xa8')](_0x3bd23c[_0x613f('0x19c')])){}logger['debug'](_0x613f('0x19d'),JSON[_0x613f('0x73')](_0x393e58));this[_0x613f('0x33')][_0x613f('0xaa')](this,_0x3bd23c,_0x3bd23c[_0x613f('0x194')]);this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')](_0x613f('0x19e'),_0x4866c4[_0x613f('0x11')]));this[_0x613f('0x1c')][_0x613f('0xaa')](this,_0x4866c4[_0x613f('0x19f')],_0x393e58);return this[_0x613f('0x34')][_0x613f('0xae')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x613f('0xd')][_0x613f('0x1a0')]=function(_0x28b1ae){logger['info'](util[_0x613f('0x24')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x28b1ae[_0x613f('0x36')]));return this[_0x613f('0x34')]['noop'](_0x613f('0x1a1'));};AGIVertices[_0x613f('0xd')]['sendSMS']=function(_0x471d67){logger[_0x613f('0x2a')](util[_0x613f('0x24')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x471d67[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x471d67[_0x613f('0x1a2')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x1a3'));}var _0x209865=this[_0x613f('0x30')][_0x613f('0xaa')](this,_0x471d67['sms_account_id']);if(!_0x209865){return this['channel'][_0x613f('0x2e')](_0x471d67,_0x613f('0x1a4'));}var _0x2ee7fd={'body':_0x471d67['sms_text'],'phone':_0x471d67['to']||'','SmsAccountId':_0x209865['id']};logger[_0x613f('0x1a5')](_0x613f('0x1a6'),JSON[_0x613f('0x73')](_0x2ee7fd));this[_0x613f('0x33')][_0x613f('0xaa')](this,_0x471d67,_0x471d67[_0x613f('0x1a2')]);this[_0x613f('0x34')][_0x613f('0xae')](util['format'](_0x613f('0x1a7'),_0x209865[_0x613f('0x11')]));this[_0x613f('0x32')][_0x613f('0xaa')](this,_0x2ee7fd);return this[_0x613f('0x34')]['noop'](_0x613f('0x1a8'));};AGIVertices[_0x613f('0xd')]['set']=function(_0xeb706f){logger[_0x613f('0x2a')](util['format'](_0x613f('0x1a9'),_0xeb706f['label']));if(!this[_0x613f('0xa8')](_0xeb706f['variable_id'])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0xeb706f,_0x613f('0x1aa'));}var _0x540015=this[_0x613f('0xa3')][_0x613f('0xaa')](this,_0xeb706f[_0x613f('0xdc')]);if(!_0x540015){return this['channel'][_0x613f('0x2e')](_0xeb706f,_0x613f('0x122'));}return this['channel']['setVariable'](_0x540015,_0xeb706f[_0x613f('0x1ab')]);};AGIVertices[_0x613f('0xd')][_0x613f('0x1ac')]=function(_0x1f4727){logger[_0x613f('0x2a')](util['format'](_0x613f('0x1ad'),_0x1f4727['label']));this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x1ae'));if(_0x1f4727[_0x613f('0x1af')]===_0x613f('0x1b0')){this[_0x613f('0x34')][_0x613f('0xae')]('Answer');return this[_0x613f('0x34')][_0x613f('0x1af')]();}return this['channel'][_0x613f('0xae')](_0x613f('0x1b1'));};AGIVertices['prototype'][_0x613f('0x1b2')]=function(_0x24e1ed){logger[_0x613f('0x2a')](util['format'](_0x613f('0x1b3'),_0x24e1ed[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x24e1ed[_0x613f('0x1b4')])){return this[_0x613f('0x34')]['error'](_0x24e1ed,_0x613f('0x1b5'));}var _0x31da44=this[_0x613f('0x1b6')][_0x613f('0xaa')](this,_0x24e1ed[_0x613f('0x1b4')]);if(!this[_0x613f('0xa8')](_0x31da44)){return this['channel']['error'](_0x24e1ed,util[_0x613f('0x24')](_0x613f('0x1b7'),_0x24e1ed[_0x613f('0x1b4')]));}if(_0x31da44===this['channel'][_0x613f('0x3f')]){return this[_0x613f('0x34')]['error'](_0x24e1ed,_0x613f('0x1b8'));}this[_0x613f('0x33')]['sync'](this,_0x24e1ed,_0x31da44);var _0x149ce6=this[_0x613f('0x34')][_0x613f('0x53')](_0x613f('0x1b9'),util[_0x613f('0x24')](_0x613f('0x1ba'),config['agi'][_0x613f('0x1bb')]||_0x613f('0x1bc'),_0x31da44,this['channel']['arg_1']));if(_0x149ce6[_0x613f('0xb1')]===-0x1){return _0x149ce6;}return this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')]('Executed\x20command\x20%s\x20%s','AGI',_0x31da44));};AGIVertices[_0x613f('0xd')][_0x613f('0x1bd')]=function(_0x253934){logger['info'](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x253934['label']));var _0x3fd5cd=this[_0x613f('0x1be')]['sync'](this,_0x253934[_0x613f('0xbd')]);this['createSquareDetailsReport'][_0x613f('0xaa')](this,_0x253934,_0x253934['command']);if(this[_0x613f('0xa8')](_0x253934[_0x613f('0xdc')])){var _0x3b98d5=this['getVariable'][_0x613f('0xaa')](this,_0x253934[_0x613f('0xdc')]);if(_0x3b98d5){this[_0x613f('0x34')][_0x613f('0xa0')](_0x3b98d5,_0x3fd5cd);return this['channel'][_0x613f('0xae')](util['format'](_0x613f('0x1bf'),_0x253934[_0x613f('0xbd')],_0x3b98d5));}}return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x1c0'),_0x253934[_0x613f('0xbd')]));};AGIVertices[_0x613f('0xd')][_0x613f('0x1c1')]=function(_0x213ea2){logger[_0x613f('0x2a')](util['format'](_0x613f('0x1c2'),_0x213ea2[_0x613f('0x36')]));_0x213ea2['text']=_0x213ea2[_0x613f('0x58')][_0x613f('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x613f('0xa8')](_0x213ea2['apiKey'])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0x1c3'));}if(!this['isConfigured'](_0x213ea2[_0x613f('0x58')])){return this[_0x613f('0x34')][_0x613f('0xae')](_0x613f('0xaf'));}this[_0x613f('0x34')]['noop'](util[_0x613f('0x24')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x213ea2[_0x613f('0x58')]));var _0x584a9c=this[_0x613f('0x56')]['sync'](this,_0x213ea2);if(_0x584a9c){this[_0x613f('0x34')][_0x613f('0xae')](util['format'](_0x613f('0x1c4'),_0x584a9c));var _0x295d18=this[_0x613f('0x34')][_0x613f('0x12d')](_0x584a9c);try{fs['unlink'](_0x584a9c+'.wav');}catch(_0x4015d7){logger[_0x613f('0x2e')](_0x4015d7);}return _0x295d18;}return this[_0x613f('0x34')][_0x613f('0x2e')](_0x213ea2,_0x613f('0x1c5'));};AGIVertices['prototype'][_0x613f('0x1c6')]=function(_0x4cae0b){logger[_0x613f('0x2a')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4cae0b[_0x613f('0x36')]));_0x4cae0b[_0x613f('0x58')]=_0x4cae0b[_0x613f('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x613f('0xa8')](_0x4cae0b[_0x613f('0x58')])){return this['channel'][_0x613f('0xae')]('no\x20text\x20configured');}this['channel'][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x1c7'),_0x4cae0b['text']));var _0x2294e1=this[_0x613f('0x5f')][_0x613f('0xaa')](this,_0x4cae0b);if(_0x2294e1){this['channel'][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x1c8'),_0x2294e1));var _0xf75e8c=this[_0x613f('0x34')][_0x613f('0x12d')](_0x2294e1);try{fs['unlink'](_0x2294e1+_0x613f('0x10c'));}catch(_0x406e5e){logger[_0x613f('0x2e')](_0x406e5e);}return _0xf75e8c;}return this[_0x613f('0x34')][_0x613f('0x2e')](_0x4cae0b,_0x613f('0x1c9'));};AGIVertices[_0x613f('0xd')][_0x613f('0x1ca')]=function(_0x2b719c){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x1cb'),_0x2b719c['label']));if(!this['isConfigured'](_0x2b719c[_0x613f('0x15e')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x2b719c,_0x613f('0x15f'));}logger[_0x613f('0x2a')](util['format'](_0x613f('0x160'),this[_0x613f('0x34')][_0x613f('0x38')],_0x2b719c[_0x613f('0x15e')]));var _0x1192d4=this[_0x613f('0x4e')][_0x613f('0xaa')](this,_0x2b719c[_0x613f('0x15e')]);if(_0x1192d4){logger[_0x613f('0x2a')](util['format'](_0x613f('0x161'),this[_0x613f('0x34')][_0x613f('0x38')],_0x2b719c[_0x613f('0x15e')]));this['channel'][_0x613f('0xae')](util[_0x613f('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x613f('0x34')][_0x613f('0x38')],_0x2b719c['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x613f('0x24')](_0x613f('0x163'),this['channel'][_0x613f('0x38')],_0x2b719c['findBy']));this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x163'),this['channel']['callerid'],_0x2b719c['findBy']));return{'code':0xc8,'result':_0x613f('0x164')};}};AGIVertices[_0x613f('0xd')][_0x613f('0x1cc')]=function(_0x4d804e){logger[_0x613f('0x2a')](util[_0x613f('0x24')](_0x613f('0x1cd'),_0x4d804e[_0x613f('0x36')]));var _0x4f42ec=this[_0x613f('0x34')]['exec'](_0x613f('0x1ce'),[_0x4d804e[_0x613f('0x1cf')],_0x4d804e['options']]);if(_0x4f42ec[_0x613f('0xb1')]===-0x1){return _0x4f42ec;}return this[_0x613f('0x34')][_0x613f('0xae')](util[_0x613f('0x24')](_0x613f('0x172'),_0x613f('0x1ce'),_0x4d804e['mailbox']));};AGIVertices[_0x613f('0xd')][_0x613f('0x1d0')]=function(_0x12ba07){logger['info'](util[_0x613f('0x24')](_0x613f('0x1d1'),_0x12ba07[_0x613f('0x36')]));if(!this[_0x613f('0xa8')](_0x12ba07[_0x613f('0xdc')])){return this[_0x613f('0x34')][_0x613f('0x2e')](_0x12ba07,'no\x20variable\x20selected');}var _0x4afd07=this['getVariable']['sync'](this,_0x12ba07['variable_id']);if(!_0x4afd07){return this[_0x613f('0x34')]['error'](_0x12ba07,_0x613f('0x122'));}var _0x3a6158=this[_0x613f('0x34')][_0x613f('0xa3')](_0x4afd07);return{'code':0xc8,'result':_0x3a6158[_0x613f('0xa4')]?_0x3a6158['extra']:'-'};};String[_0x613f('0xd')]['replaceAll']=function(_0x541fdc,_0x17adc9){return this[_0x613f('0xa1')](_0x541fdc)[_0x613f('0x1d2')](_0x17adc9);};module[_0x613f('0x1d3')]=AGIVertices; \ No newline at end of file +var _0x39c4=['agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','error','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MALE','MP3','googleTTS','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','parse','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','retry','maxRetry','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','variable_id','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','%s/recordings/%s','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','subproject','project_id','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','lodash','randomstring','moment','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareOdbc','getUser','getUserById','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0x39c4,0x174));var _0x439c=function(_0x571347,_0x4252ca){_0x571347=_0x571347-0x0;var _0x5223a3=_0x39c4[_0x571347];return _0x5223a3;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x439c('0x0'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x439c('0x1'));var moment=require(_0x439c('0x2'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x439c('0x3'))(_0x439c('0x4'));var config=require(_0x439c('0x5'));var shared=require(_0x439c('0x6'));var scripts=require(_0x439c('0x7'));var FILES_PATH=_0x439c('0x8');var recursiveMapAttributes=[_0x439c('0x9'),_0x439c('0xa')];var verticesWithRetry=[_0x439c('0xb'),_0x439c('0xc'),_0x439c('0xd')];var AGIVertices=function(_0x46a4f7,_0x253d9c,_0x340316){this[_0x439c('0xe')]=_0x46a4f7;this['rpc']=_0x253d9c;this[_0x439c('0xf')]=_0x340316;};AGIVertices[_0x439c('0x10')][_0x439c('0x11')]=function(_0x225570,_0x160858){this[_0x439c('0x12')][_0x439c('0x13')](_0x225570)[_0x439c('0x14')](function(_0x8241cc){_0x160858(null,_0x8241cc?_0x8241cc[_0x439c('0x15')]:![]);})[_0x439c('0x16')](function(_0x2bd89){_0x160858(_0x2bd89);});};AGIVertices['prototype'][_0x439c('0x17')]=function(_0x5d315a,_0x494f3c){this[_0x439c('0x12')][_0x439c('0x18')](_0x5d315a)[_0x439c('0x14')](function(_0x425c3f){_0x494f3c(null,_0x425c3f?_0x425c3f[_0x439c('0x15')]:![]);})['catch'](function(_0x4f5b71){_0x494f3c(_0x4f5b71);});};AGIVertices[_0x439c('0x10')]['getSquareProject']=function(_0x64d6d1,_0xa448bd){this[_0x439c('0x12')]['getSquareProjectById'](_0x64d6d1)[_0x439c('0x14')](function(_0x1f26f0){_0xa448bd(null,_0x1f26f0?_0x1f26f0[_0x439c('0x15')]:![]);})[_0x439c('0x16')](function(_0x569a31){_0xa448bd(_0x569a31);});};AGIVertices[_0x439c('0x10')][_0x439c('0x19')]=function(_0x39429e,_0x52fe98){this[_0x439c('0x12')]['getSquareOdbcById'](_0x39429e)['then'](function(_0x33de22){_0x52fe98(null,_0x33de22?_0x33de22['dsn']:![]);})[_0x439c('0x16')](function(_0xe58881){_0x52fe98(_0xe58881);});};AGIVertices[_0x439c('0x10')][_0x439c('0x1a')]=function(_0x35727a,_0x7cdb81){this[_0x439c('0x12')][_0x439c('0x1b')](_0x35727a)[_0x439c('0x14')](function(_0x5aa76d){_0x7cdb81(null,_0x5aa76d?_0x5aa76d[_0x439c('0x15')]:![]);})[_0x439c('0x16')](function(_0x49c1e3){_0x7cdb81(_0x49c1e3);});};AGIVertices[_0x439c('0x10')]['getTrunk']=function(_0x47d441,_0x3e9632){this['rpc'][_0x439c('0x1c')](_0x47d441)[_0x439c('0x14')](function(_0x349d75){_0x3e9632(null,_0x349d75?_0x349d75[_0x439c('0x15')]:![]);})[_0x439c('0x16')](function(_0x48cbf3){_0x3e9632(_0x48cbf3);});};AGIVertices['prototype'][_0x439c('0x1d')]=function(_0x4c177b,_0x2f779d){var _0x513bc6=this;this[_0x439c('0x12')][_0x439c('0x1e')](_0x4c177b)[_0x439c('0x14')](function(_0x2f670b){_0x2f779d(null,_0x2f670b?_0x513bc6['getSoundPath'](_0x2f670b[_0x439c('0x1f')]):![]);})[_0x439c('0x16')](function(_0x291ab0){_0x2f779d(_0x291ab0);});};AGIVertices[_0x439c('0x10')][_0x439c('0x20')]=function(_0x27ee3f,_0x3fd0b5){this[_0x439c('0x12')][_0x439c('0x21')](_0x27ee3f)[_0x439c('0x14')](function(_0x198acb){_0x3fd0b5(null,_0x198acb?_0x198acb:![]);})[_0x439c('0x16')](function(_0x22d632){_0x3fd0b5(_0x22d632);});};AGIVertices[_0x439c('0x10')]['sendMailMessage']=function(_0x563ab2,_0x25cb83,_0x1b4d19){this['mailRpc'][_0x439c('0x22')](_0x563ab2,_0x25cb83)[_0x439c('0x14')](function(){_0x1b4d19(null);})[_0x439c('0x16')](function(_0xf7b26f){_0x1b4d19(_0xf7b26f);});};AGIVertices[_0x439c('0x10')]['getIntervals']=function(_0x211196,_0x35f790){this['rpc'][_0x439c('0x23')](_0x211196)[_0x439c('0x14')](function(_0x3bf373){if(_0x3bf373){if(_0x3bf373[_0x439c('0x24')]){_0x35f790(null,[_0x3bf373[_0x439c('0x25')]]);}else{_0x35f790(null,_[_0x439c('0x26')](_0x3bf373[_0x439c('0x27')],_0x439c('0x25')));}}else{_0x35f790(null,![]);}})[_0x439c('0x16')](function(_0x31664a){_0x35f790(_0x31664a);});};AGIVertices[_0x439c('0x10')]['getSoundPath']=function(_0x1fa686){return util['format'](_0x439c('0x28'),FILES_PATH,_0x1fa686);};AGIVertices[_0x439c('0x10')]['getQueryOdbc']=function(_0x38401b,_0x1fc94e,_0x4e954e){odbc['open'](_0x38401b,function(_0x349afb){if(_0x349afb){logger['error'](_0x439c('0x29'),_0x349afb);_0x4e954e(_0x349afb);}else{logger['info'](_0x439c('0x2a'));odbc[_0x439c('0x2b')](_0x1fc94e,function(_0x993d42,_0x5734b8){if(_0x993d42){logger[_0x439c('0x2c')](_0x439c('0x2d'),_0x1fc94e);_0x4e954e(_0x993d42);}else{logger['info'](_0x439c('0x2e'),_0x1fc94e);odbc['close'](function(_0x2e5056){if(_0x2e5056){logger['error'](_0x439c('0x2f'),_0x2e5056);}_0x4e954e(null,_0x5734b8);});}});}});};AGIVertices[_0x439c('0x10')][_0x439c('0x30')]=function(_0x1a8d93,_0x12d09a){this[_0x439c('0x12')][_0x439c('0x31')](_0x1a8d93)['then'](function(_0x5d3e22){_0x12d09a(null,_0x5d3e22?_0x5d3e22:![]);})[_0x439c('0x16')](function(_0x783fc1){_0x12d09a(_0x783fc1);});};AGIVertices['prototype'][_0x439c('0x32')]=function(_0x54f101,_0x4d17cf){this[_0x439c('0x12')][_0x439c('0x32')](_0x54f101)[_0x439c('0x14')](function(_0x2797e9){_0x4d17cf(null,_0x2797e9);})[_0x439c('0x16')](function(_0x195791){_0x4d17cf(_0x195791);});};AGIVertices[_0x439c('0x10')]['createSquareDetailsReport']=function(_0x340e07,_0x45b24f,_0x2d001b){this[_0x439c('0x12')][_0x439c('0x33')]({'uniqueid':this['channel'][_0x439c('0x34')],'node':_0x340e07[_0x439c('0x35')],'application':_0x340e07[_0x439c('0x36')],'data':_0x45b24f||null,'project_name':this[_0x439c('0xe')]['arg_1'],'callerid':this[_0x439c('0xe')][_0x439c('0x37')]})['then'](function(_0x5be846){if(_0x2d001b){_0x2d001b(null,_0x5be846);}})['catch'](function(_0x4a62a3){if(_0x2d001b){_0x2d001b(_0x4a62a3);}});};AGIVertices[_0x439c('0x10')]['createSquareRecording']=function(_0x524589,_0x22e3cc,_0x23ecfd,_0x4c107c){this[_0x439c('0x12')][_0x439c('0x38')]({'uniqueid':this[_0x439c('0xe')][_0x439c('0x34')],'callerid':this[_0x439c('0xe')]['callerid'],'calleridname':this[_0x439c('0xe')][_0x439c('0x39')],'context':this[_0x439c('0xe')][_0x439c('0x3a')],'extension':this[_0x439c('0xe')][_0x439c('0x3b')],'priority':this[_0x439c('0xe')][_0x439c('0x3c')],'accountcode':this[_0x439c('0xe')][_0x439c('0x3d')],'dnid':this[_0x439c('0xe')][_0x439c('0x3e')],'projectName':this['channel'][_0x439c('0x3f')],'saveName':_0x22e3cc,'filename':_0x524589[_0x439c('0x40')]||_0x22e3cc,'savePath':_0x23ecfd})[_0x439c('0x14')](function(_0x4a5c56){_0x4c107c(null,_0x4a5c56);})[_0x439c('0x16')](function(_0x335d60){_0x4c107c(_0x335d60);});};AGIVertices[_0x439c('0x10')][_0x439c('0x41')]=function(_0x363870,_0x5bb679,_0x2bdb42,_0x329a43,_0x2fb7f5){this[_0x439c('0x12')][_0x439c('0x41')]({'uniqueid':this[_0x439c('0xe')][_0x439c('0x34')],'body':_0x363870,'direction':_0x5bb679,'providerName':_0x2bdb42,'providerResponse':_0x329a43})[_0x439c('0x14')](function(_0x550be){if(_0x2fb7f5){_0x2fb7f5(null,_0x550be);}})[_0x439c('0x16')](function(_0x5075fa){if(_0x2fb7f5){_0x2fb7f5(_0x5075fa);}});};AGIVertices[_0x439c('0x10')][_0x439c('0x42')]=function(_0x4d52ea,_0x44919e){this['rpc']['createCmContact']({'firstName':_[_0x439c('0x43')](_0x4d52ea[_0x439c('0x15')])||_[_0x439c('0x44')](_0x4d52ea['name'])?_0x439c('0x45')+Math[_0x439c('0x46')]():_0x4d52ea[_0x439c('0x15')],'lastName':_[_0x439c('0x43')](_0x4d52ea['lastName'])||_['isNil'](_0x4d52ea['lastName'])?null:_0x4d52ea[_0x439c('0x47')],'phone':_0x4d52ea[_0x439c('0x48')],'ListId':_0x4d52ea['list_id'],'scheduledat':_0x4d52ea[_0x439c('0x49')],'callbackUniqueid':this[_0x439c('0xe')][_0x439c('0x34')],'tags':_0x439c('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x4d52ea[_0x439c('0x49')][_0x439c('0x4b')](),'priority':_0x4d52ea[_0x439c('0x4c')]})[_0x439c('0x14')](function(_0x5efea6){_0x44919e(null,_0x5efea6);})[_0x439c('0x16')](function(_0x9b7561){_0x44919e(_0x9b7561);});};AGIVertices[_0x439c('0x10')][_0x439c('0x4d')]=function(_0x378aec,_0x2c8d4d){this['rpc'][_0x439c('0x4e')](_0x378aec)[_0x439c('0x14')](function(_0x42533e){_0x2c8d4d(null,_0x42533e?_0x42533e[_0x439c('0x15')]:![]);})[_0x439c('0x16')](function(_0x3ebff5){_0x2c8d4d(_0x3ebff5);});};AGIVertices[_0x439c('0x10')]['agentPause']=function(_0x43afbd,_0x5ce7e2,_0x8fba41){var _0x3d6e52={'role':_0x439c('0x4f')};_0x3d6e52[_0x43afbd]=this['channel']['callerid'];this[_0x439c('0x12')]['agentPause'](_0x3d6e52,_0x5ce7e2,this[_0x439c('0xe')][_0x439c('0x34')])[_0x439c('0x14')](function(_0x228d79){_0x8fba41(null,_[_0x439c('0x44')](_0x228d79)?![]:!![]);})[_0x439c('0x16')](function(_0x528e02){logger['error'](_0x528e02);_0x8fba41(null,![]);});};AGIVertices[_0x439c('0x10')][_0x439c('0x50')]=function(_0x14fd27,_0x593293){var _0x1ba3cd={'role':_0x439c('0x4f')};_0x1ba3cd[_0x14fd27]=this[_0x439c('0xe')]['callerid'];this[_0x439c('0x12')][_0x439c('0x50')](_0x1ba3cd)[_0x439c('0x14')](function(_0x284c97){_0x593293(null,_[_0x439c('0x44')](_0x284c97)?![]:!![]);})['catch'](function(_0xe27f3){logger['error'](_0xe27f3);_0x593293(null,![]);});};AGIVertices[_0x439c('0x10')][_0x439c('0x51')]=function(_0x57d102,_0x2aa589){var _0x5bb5c4={'role':_0x439c('0x4f')};_0x5bb5c4[_0x57d102]=this[_0x439c('0xe')][_0x439c('0x37')];this[_0x439c('0x12')][_0x439c('0x51')](_0x5bb5c4)[_0x439c('0x14')](function(_0x22c674){_0x2aa589(null,_[_0x439c('0x44')](_0x22c674)?![]:!![]);})['catch'](function(_0x5d10e0){logger['error'](_0x5d10e0);_0x2aa589(null,![]);});};AGIVertices[_0x439c('0x10')][_0x439c('0x52')]=function(_0x5c39e4,_0x562d4d){var _0x56f133={'role':_0x439c('0x4f')};_0x56f133[_0x5c39e4]=this[_0x439c('0xe')]['callerid'];var _0x5642f5=_0x5c39e4!=_0x439c('0x53')?util[_0x439c('0x54')](_0x439c('0x55'),_0x439c('0x56'),this[_0x439c('0xe')][_0x439c('0x37')]):undefined;this['rpc'][_0x439c('0x52')](_0x56f133,_0x5642f5)['then'](function(_0x1d32ad){_0x562d4d(null,_[_0x439c('0x44')](_0x1d32ad)?![]:!![]);})[_0x439c('0x16')](function(_0xe24971){logger[_0x439c('0x57')](_0xe24971);_0x562d4d(null,![]);});};AGIVertices[_0x439c('0x10')][_0x439c('0x58')]=function(_0x1ddd58,_0x4543f8){sh[_0x439c('0x59')](_[_0x439c('0x5a')](_0x1ddd58),function(_0xe0151,_0x592ae3){var _0x7ff032=_0x592ae3[_0x439c('0x5b')](/(\r\n|\n|\r)/gm,'');_0x4543f8(null,_0x7ff032);});};AGIVertices[_0x439c('0x10')][_0x439c('0x5c')]=function(_0xd3fdb0,_0x55903a){scripts[_0x439c('0x5c')](_0xd3fdb0[_0x439c('0x5d')],_0xd3fdb0[_0x439c('0x5e')]||'text',_0xd3fdb0[_0x439c('0x5f')],_0xd3fdb0['languageCode']||_0x439c('0x60'),_0xd3fdb0['ssmlGender']||_0x439c('0x61'),_0xd3fdb0['audioEncoding']||_0x439c('0x62'))['then'](function(_0x5a5205){_0x55903a(null,_0x5a5205);})[_0x439c('0x16')](function(_0x9ba6f2){_0x55903a(_0x9ba6f2);});};AGIVertices[_0x439c('0x10')][_0x439c('0x63')]=function(_0x357c9a,_0x2f4b65){scripts[_0x439c('0x63')](_0x357c9a[_0x439c('0x5f')],_0x357c9a['google_tts_language']||'en',0x1)[_0x439c('0x14')](function(_0x2ac2f7){_0x2f4b65(null,_0x2ac2f7);})[_0x439c('0x16')](function(_0x2fd8b6){_0x2f4b65(_0x2fd8b6);});};AGIVertices[_0x439c('0x10')][_0x439c('0x64')]=function(_0x5b7d59,_0x3c023c){var _0x593615={'uri':_0x5b7d59[_0x439c('0x65')],'method':_0x5b7d59['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5b7d59[_0x439c('0x66')])===_0x439c('0x67')&&parseInt(_0x5b7d59[_0x439c('0x66')])>=0x1?parseInt(_0x5b7d59[_0x439c('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x439c('0x68')]([_0x439c('0x69'),_0x439c('0x6a')],_0x593615[_0x439c('0x6b')][_0x439c('0x6c')]())){try{_0x593615[_0x439c('0x6d')]=_0x5b7d59[_0x439c('0xa')]?JSON[_0x439c('0x6e')](_0x5b7d59['rawBody']):{};}catch(_0x497f60){logger[_0x439c('0x57')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x497f60);}}try{_0x593615['headers']=_0x5b7d59['rawHeaders']?JSON[_0x439c('0x6e')](_0x5b7d59[_0x439c('0x9')]):{};}catch(_0x38da14){logger[_0x439c('0x57')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x38da14);}if(_0x5b7d59['computedVariables']){try{var _0x26a60d=require(_0x5b7d59[_0x439c('0x6f')])[_0x439c('0x70')](this,_0x593615);_0x593615[_0x439c('0x71')]=Mustache[_0x439c('0x72')](_0x5b7d59[_0x439c('0x65')],_0x26a60d,{},['$$','$$']);if(_0x593615['headers']){_0x593615[_0x439c('0x73')]=JSON['parse'](Mustache[_0x439c('0x72')](JSON[_0x439c('0x74')](_0x593615[_0x439c('0x73')]),_0x26a60d,{},['$$','$$']));}if(_0x593615[_0x439c('0x6d')]){_0x593615[_0x439c('0x6d')]=JSON[_0x439c('0x6e')](Mustache['render'](JSON[_0x439c('0x74')](_0x593615[_0x439c('0x6d')]),_0x26a60d,{},['$$','$$']));}}catch(_0x5ecda7){logger[_0x439c('0x57')](_0x439c('0x75'),_0x5ecda7);}}rp(_0x593615)[_0x439c('0x14')](function(_0x21fbba){var _0x40de54={'statusCode':_0x21fbba[_0x439c('0x76')]||0xc8,'statusMessage':_0x21fbba[_0x439c('0x77')]||'OK','headers':_0x21fbba[_0x439c('0x73')]||{},'body':_0x21fbba[_0x439c('0x6d')]||{}};_0x3c023c(null,_0x40de54);})[_0x439c('0x16')](function(_0x41985f){var _0x5f3b88={'statusCode':_0x41985f['statusCode']||0x1f4,'statusMessage':_0x41985f[_0x439c('0x78')]||_0x439c('0x79'),'headers':_0x41985f['options'][_0x439c('0x73')]||{},'body':_0x41985f[_0x439c('0x7a')][_0x439c('0x6d')]||{}};_0x3c023c(null,_0x5f3b88);});};AGIVertices[_0x439c('0x10')]['googleDialogflow']=function(_0x351a05,_0xb7c626){scripts[_0x439c('0x7b')](this['channel'][_0x439c('0x34')],_0x351a05[_0x439c('0x7c')],_0x351a05[_0x439c('0x5f')],_0x351a05[_0x439c('0x7d')]||'en')[_0x439c('0x14')](function(_0x34d4b0){_0xb7c626(null,_0x34d4b0);})[_0x439c('0x16')](function(_0x46169a){_0xb7c626(_0x46169a);});};AGIVertices[_0x439c('0x10')][_0x439c('0x7e')]=function(_0x30a49e,_0x48ebd9){scripts[_0x439c('0x7e')](this['channel'][_0x439c('0x34')],_0x30a49e[_0x439c('0x7f')],_0x30a49e[_0x439c('0x80')],_0x30a49e[_0x439c('0x81')],_0x30a49e[_0x439c('0x5f')],_0x30a49e['dialogflowV2_language']||'en')['then'](function(_0x455e48){_0x48ebd9(null,_0x455e48);})[_0x439c('0x16')](function(_0x166c04){_0x48ebd9(_0x166c04);});};AGIVertices[_0x439c('0x10')][_0x439c('0x82')]=function(_0x44b63f,_0x38411c){scripts[_0x439c('0x82')](this[_0x439c('0xe')],_0x44b63f)[_0x439c('0x14')](function(_0x19e50b){_0x38411c(null,_0x19e50b);})[_0x439c('0x16')](function(_0x236175){_0x38411c(_0x236175);});};AGIVertices[_0x439c('0x10')][_0x439c('0x83')]=function(_0x41fa10,_0x5c218d){scripts[_0x439c('0x83')](_0x41fa10[_0x439c('0x7c')],_0x41fa10['text'],_0x41fa10[_0x439c('0x84')]||_0x439c('0x60'),_0x41fa10['speed'])[_0x439c('0x14')](function(_0x4a0f16){_0x5c218d(null,_0x4a0f16);})['catch'](function(_0x5260f5){_0x5c218d(_0x5260f5);});};AGIVertices[_0x439c('0x10')]['ispeechASR']=function(_0x443840,_0x23ba44,_0x10cde2){scripts['ispeechASR'](_0x23ba44,_0x443840[_0x439c('0x7c')],_0x443840[_0x439c('0x85')]||_0x439c('0x60'),this[_0x439c('0x86')](_0x443840[_0x439c('0x87')])?_0x443840[_0x439c('0x87')]:undefined)[_0x439c('0x14')](function(_0x988484){_0x10cde2(null,_0x988484);})[_0x439c('0x16')](function(_0x11dc2e){_0x10cde2(_0x11dc2e);});};AGIVertices[_0x439c('0x10')][_0x439c('0x88')]=function(_0x2ad465,_0x15f690){scripts[_0x439c('0x88')](_0x2ad465[_0x439c('0x89')],_0x2ad465[_0x439c('0x8a')],_0x2ad465['aws_polly_region'],_0x2ad465[_0x439c('0x8b')]||'Amy',_0x2ad465[_0x439c('0x5f')],_0x2ad465[_0x439c('0x8c')]||_0x439c('0x5f'))[_0x439c('0x14')](function(_0x428fa4){_0x15f690(null,_0x428fa4);})[_0x439c('0x16')](function(_0x3d8968){_0x15f690(_0x3d8968);});};AGIVertices['prototype']['awsLex']=function(_0x28ba82,_0xc84406){scripts[_0x439c('0x8d')](this['channel']['uniqueid'],_0x28ba82[_0x439c('0x89')],_0x28ba82[_0x439c('0x8a')],_0x28ba82['aws_lex_region'],_0x28ba82['text'],_0x28ba82[_0x439c('0x8e')])[_0x439c('0x14')](function(_0x170680){_0xc84406(null,_0x170680);})[_0x439c('0x16')](function(_0x2ea0f0){_0xc84406(_0x2ea0f0);});};AGIVertices[_0x439c('0x10')][_0x439c('0x8f')]=function(_0x40b9e3,_0x389297,_0x527caa){scripts[_0x439c('0x8f')](_0x389297,_0x40b9e3[_0x439c('0x7c')],_0x40b9e3[_0x439c('0x90')]||_0x439c('0x60'))['then'](function(_0x219ef9){_0x527caa(null,_0x219ef9);})[_0x439c('0x16')](function(_0x4e6a80){_0x527caa(_0x4e6a80);});};AGIVertices[_0x439c('0x10')]['tildeASR']=function(_0x226beb,_0x14b187,_0x1f9a34){scripts[_0x439c('0x91')](_0x14b187,_0x226beb[_0x439c('0x92')],_0x226beb[_0x439c('0x93')],_0x226beb[_0x439c('0x71')])[_0x439c('0x14')](function(_0x3bc59b){_0x1f9a34(null,_0x3bc59b);})[_0x439c('0x16')](function(_0x1cb6bf){_0x1f9a34(_0x1cb6bf);});};AGIVertices['prototype'][_0x439c('0x94')]=function(_0x4738f6){var _0x454cd2=_[_0x439c('0x68')](verticesWithRetry,_0x4738f6[_0x439c('0x36')])?_0x4738f6:_[_0x439c('0x95')](_0x4738f6);for(var _0x42f2bb in _0x454cd2){if(_0x454cd2[_0x439c('0x96')](_0x42f2bb)){if(_0x454cd2[_0x42f2bb]&&_['isString'](_0x454cd2[_0x42f2bb])){if(_['includes'](recursiveMapAttributes,_0x42f2bb)){_0x454cd2[_0x42f2bb]=this[_0x439c('0x97')](_0x454cd2[_0x42f2bb]);}else{_0x454cd2[_0x42f2bb]=this[_0x439c('0x98')](_0x454cd2[_0x42f2bb]);}}}}return _0x454cd2;};AGIVertices[_0x439c('0x10')]['recursiveNodeIndex']=function(_0x2ea802){for(var _0x358966 in _0x2ea802){if(_0x2ea802[_0x439c('0x96')](_0x358966)){if(_[_0x439c('0x99')](_0x2ea802[_0x358966])){this[_0x439c('0x9a')](_0x2ea802[_0x358966]);}else if(_[_0x439c('0x9b')](_0x2ea802[_0x358966])){for(var _0x3ce670=0x0;_0x3ce670<_0x2ea802[_0x358966][_0x439c('0x9c')];_0x3ce670++){this[_0x439c('0x9a')](_0x2ea802[_0x358966][_0x3ce670]);}}else if(_[_0x439c('0x9d')](_0x2ea802[_0x358966])){_0x2ea802[_0x358966]=this[_0x439c('0x98')](_0x2ea802[_0x358966]);}}}};AGIVertices[_0x439c('0x10')][_0x439c('0x9e')]=function(_0x53e21b,_0x2fff49){for(var _0x5ecdb7 in _0x53e21b){if(_0x53e21b['hasOwnProperty'](_0x5ecdb7)){if(_[_0x439c('0x99')](_0x53e21b[_0x5ecdb7])){if(!_[_0x439c('0x43')](_0x53e21b[_0x5ecdb7])){this['saveRestApiResult'](_0x53e21b[_0x5ecdb7],util[_0x439c('0x54')](_0x439c('0x9f'),_0x2fff49,_0x5ecdb7));}}else if(_[_0x439c('0x9b')](_0x53e21b[_0x5ecdb7])){for(var _0x5e4f12=0x0;_0x5e4f12<_0x53e21b[_0x5ecdb7][_0x439c('0x9c')];_0x5e4f12++){this[_0x439c('0x9e')](_0x53e21b[_0x5ecdb7][_0x5e4f12],util[_0x439c('0x54')]('%s.%s',_0x2fff49,_0x5ecdb7+'['+_0x5e4f12+']'));}}else{if(!_['isNil'](_0x53e21b[_0x5ecdb7])){this[_0x439c('0xe')]['setVariable'](util[_0x439c('0x54')](_0x439c('0x9f'),_0x2fff49,_0x5ecdb7),_0x53e21b[_0x5ecdb7]);}}}}};AGIVertices[_0x439c('0x10')][_0x439c('0x97')]=function(_0x6b1723){try{var _0x1b601e=JSON[_0x439c('0x6e')](_0x6b1723);this[_0x439c('0x9a')](_0x1b601e);return JSON[_0x439c('0x74')](_0x1b601e);}catch(_0x10929a){return this[_0x439c('0x98')](_0x6b1723);}};AGIVertices[_0x439c('0x10')][_0x439c('0x98')]=function(_0x7784ab){var _0x3632b9=_0x7784ab['split']('{');for(var _0x534fb1=0x1;_0x534fb1<_0x3632b9[_0x439c('0x9c')];_0x534fb1+=0x1){var _0x5e06b1=_0x3632b9[_0x534fb1][_0x439c('0xa0')]('}');if(_0x5e06b1[_0x439c('0x9c')]>0x1){_0x7784ab=_0x7784ab[_0x439c('0xa1')]('{'+_0x5e06b1[0x0]+'}',this[_0x439c('0xe')]['getVariable'](_0x5e06b1[0x0])['extra']||_0x5e06b1[0x0]);}}if(_0x3632b9[_0x439c('0x9c')]===0x1){return _0x7784ab[_0x439c('0x4b')]();}return this[_0x439c('0x98')](_0x7784ab);};AGIVertices['prototype'][_0x439c('0xa2')]=function(_0x490e92,_0xb207f7){var _0x3623e2=this[_0x439c('0xe')]['getVariable'](_0x490e92);if(_0x3623e2[_0x439c('0xa3')]===-0x1){return _0x3623e2;}logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0xa4'),_0xb207f7,_0x3623e2[_0x439c('0xa5')]));return this[_0x439c('0xe')][_0x439c('0xa6')](_0xb207f7,_0x3623e2['extra']);};AGIVertices[_0x439c('0x10')]['isConfigured']=function(_0x159789){return _0x159789&&_0x159789!=='0'&&_0x159789!=='-1'&&_0x159789!=='';};AGIVertices['prototype']['maxRetry']=function(_0x2d2dc2){this['createSquareDetailsReport']['sync'](this,_0x2d2dc2,'-');_0x2d2dc2[_0x439c('0xa7')]=_0x2d2dc2[_0x439c('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x439c('0x10')]['mrcpsynth']=function(_0x15ff77){logger[_0x439c('0x2c')](util[_0x439c('0x54')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x15ff77[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x15ff77[_0x439c('0x5f')])){return this['channel'][_0x439c('0xa9')]('no\x20text\x20configured');}var _0x2508e3='\x22'+_0x15ff77[_0x439c('0x5f')]+'\x22';if(this[_0x439c('0x86')](_0x15ff77[_0x439c('0x7a')])){_0x2508e3+=','+_0x15ff77[_0x439c('0x7a')];}var _0xfe894e=this[_0x439c('0xe')][_0x439c('0x59')](_0x439c('0xaa'),_0x2508e3);if(_0xfe894e[_0x439c('0xa3')]===-0x1){return _0xfe894e;}return this[_0x439c('0xe')]['noop'](util[_0x439c('0x54')](_0x439c('0xab'),_0x2508e3));};AGIVertices[_0x439c('0x10')]['mrcprecog']=function(_0x4d110c){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0xac'),_0x4d110c[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x4d110c[_0x439c('0xad')])){return this[_0x439c('0xe')][_0x439c('0xa9')]('no\x20grammar\x20configured');}var _0x5531d1=_0x4d110c[_0x439c('0xad')];if(this[_0x439c('0x86')](_0x4d110c[_0x439c('0x7a')])){_0x5531d1+=','+_0x4d110c[_0x439c('0x7a')];}var _0x320a27=this[_0x439c('0xe')]['exec'](_0x439c('0xae'),_0x5531d1);if(_0x320a27['result']===-0x1){return _0x320a27;}var _0xbbd30a=this[_0x439c('0xa2')]('RECOG_CONFIDENCE()',_0x439c('0xaf'));if(_0xbbd30a[_0x439c('0xa3')]===-0x1){return _0xbbd30a;}var _0x437e36=this[_0x439c('0xa2')](_0x439c('0xb0'),_0x439c('0xb1'));if(_0x437e36[_0x439c('0xa3')]===-0x1){return _0x437e36;}var _0x2ce8eb=this[_0x439c('0xa2')](_0x439c('0xb2'),'MRCP_RECOG_INSTANCE');if(_0x2ce8eb[_0x439c('0xa3')]===-0x1){return _0x2ce8eb;}return this['channel'][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0xb3'),_0x5531d1));};AGIVertices['prototype']['agi']=function(_0x469bd7){logger['info'](util[_0x439c('0x54')](_0x439c('0xb4'),_0x469bd7[_0x439c('0x35')]));return this[_0x439c('0xe')]['agi']([_0x469bd7[_0x439c('0xb5')],_0x469bd7['args']]);};AGIVertices[_0x439c('0x10')][_0x439c('0xb6')]=function(_0x129142){logger[_0x439c('0x2c')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x129142[_0x439c('0x35')]));if(this[_0x439c('0x86')](_0x129142[_0x439c('0x66')])){logger[_0x439c('0x2c')](util['format'](_0x439c('0xb7'),_0x129142[_0x439c('0x66')]));var _0x3f0f0f=this['channel'][_0x439c('0xb8')](_0x129142['timeout']);if(_0x3f0f0f[_0x439c('0xa3')]===-0x1){return _0x3f0f0f;}}return this[_0x439c('0xe')][_0x439c('0xb6')]();};AGIVertices['prototype'][_0x439c('0x4a')]=function(_0x3fbe11){logger[_0x439c('0x2c')](util['format'](_0x439c('0xb9'),_0x3fbe11[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x3fbe11['list_id'])){return this['channel'][_0x439c('0x57')](_0x3fbe11,'no\x20list\x20selected');}_0x3fbe11[_0x439c('0x49')]=moment();if(this['isConfigured'](_0x3fbe11[_0x439c('0xba')])){_0x3fbe11['scheduledAt']=moment()[_0x439c('0xbb')](_0x3fbe11['delay'],_0x439c('0xbc'));}if(!this[_0x439c('0x86')](_0x3fbe11[_0x439c('0x4c')])){_0x3fbe11[_0x439c('0x4c')]=0x2;}this['createCmContact'][_0x439c('0x70')](this,_0x3fbe11);return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0xbd'),_0x3fbe11[_0x439c('0x48')],_0x3fbe11[_0x439c('0xbe')],_0x3fbe11[_0x439c('0x49')]));};AGIVertices[_0x439c('0x10')]['custom_app']=function(_0x445b12){logger[_0x439c('0x2c')](util['format'](_0x439c('0xbf'),_0x445b12[_0x439c('0x35')]));var _0x3856d7=this[_0x439c('0xe')][_0x439c('0x59')](_0x445b12[_0x439c('0xc0')],_0x445b12[_0x439c('0x7a')]);if(_0x3856d7[_0x439c('0xa3')]===-0x1){return _0x3856d7;}return this[_0x439c('0xe')][_0x439c('0xa9')](util['format'](_0x439c('0xc1'),_0x445b12[_0x439c('0xc0')],_0x445b12[_0x439c('0x7a')]));};AGIVertices[_0x439c('0x10')][_0x439c('0xc2')]=function(_0x3020b3){logger['info'](util[_0x439c('0x54')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x3020b3[_0x439c('0x35')]));if(!this['isConfigured'](_0x3020b3[_0x439c('0x5f')])){return this[_0x439c('0xe')]['noop']('no\x20text\x20configured');}var _0x4e9c47='\x22'+_0x3020b3[_0x439c('0x5f')]+'\x22';if(this[_0x439c('0x86')](_0x3020b3[_0x439c('0x7a')])){_0x4e9c47+=','+_0x3020b3[_0x439c('0x7a')];}var _0x3dbe6a=this[_0x439c('0xe')][_0x439c('0x59')](_0x439c('0xaa'),_0x4e9c47);if(_0x3dbe6a[_0x439c('0xa3')]===-0x1){return _0x3dbe6a;}return this[_0x439c('0xe')][_0x439c('0xa9')](util['format'](_0x439c('0xab'),_0x4e9c47));};AGIVertices[_0x439c('0x10')][_0x439c('0xc3')]=function(_0x160c48){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0xc4'),_0x160c48['label']));if(!this['isConfigured'](_0x160c48[_0x439c('0x5f')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xc5'));}var _0x1cb8f9='\x22'+_0x160c48[_0x439c('0x5f')]+'\x22';if(this[_0x439c('0x86')](_0x160c48['options'])){_0x1cb8f9+=','+_0x160c48[_0x439c('0x7a')];}var _0x550716=this[_0x439c('0xe')][_0x439c('0x59')](_0x439c('0xaa'),_0x1cb8f9);if(_0x550716[_0x439c('0xa3')]===-0x1){return _0x550716;}return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1cb8f9));};AGIVertices['prototype'][_0x439c('0xc6')]=function(_0x42ec7c){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0xc7'),_0x42ec7c[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x42ec7c[_0x439c('0xad')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xc8'));}var _0x189e56=_0x42ec7c[_0x439c('0xad')];if(this['isConfigured'](_0x42ec7c[_0x439c('0x7a')])){_0x189e56+=','+_0x42ec7c[_0x439c('0x7a')];}var _0x3e3fab=this[_0x439c('0xe')][_0x439c('0x59')](_0x439c('0xae'),_0x189e56);if(_0x3e3fab['result']===-0x1){return _0x3e3fab;}var _0x2678c5=this[_0x439c('0xa2')](_0x439c('0xc9'),_0x439c('0xca'));if(_0x2678c5[_0x439c('0xa3')]===-0x1){return _0x2678c5;}var _0x20cfb5=this[_0x439c('0xa2')](_0x439c('0xb0'),_0x439c('0xcb'));if(_0x20cfb5['result']===-0x1){return _0x20cfb5;}var _0x52bb91=this[_0x439c('0xa2')]('RECOG_INSTANCE()',_0x439c('0xcc'));if(_0x52bb91['result']===-0x1){return _0x52bb91;}return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0xb3'),_0x189e56));};AGIVertices[_0x439c('0x10')][_0x439c('0xcd')]=function(_0x3177fd){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0xce'),_0x3177fd[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x3177fd[_0x439c('0xad')])){return this[_0x439c('0xe')][_0x439c('0xa9')]('no\x20grammar\x20configured');}var _0x8742e4=_0x3177fd['grammar'];if(this[_0x439c('0x86')](_0x3177fd[_0x439c('0x7a')])){_0x8742e4+=','+_0x3177fd[_0x439c('0x7a')];}var _0x4c9be5=this[_0x439c('0xe')][_0x439c('0x59')](_0x439c('0xae'),_0x8742e4);if(_0x4c9be5[_0x439c('0xa3')]===-0x1){return _0x4c9be5;}var _0x4adb0b=this[_0x439c('0xa2')](_0x439c('0xc9'),_0x439c('0xcf'));if(_0x4adb0b[_0x439c('0xa3')]===-0x1){return _0x4adb0b;}var _0x4812b9=this[_0x439c('0xa2')](_0x439c('0xb0'),'SESTEK_ASR_TRANSCRIPT');if(_0x4812b9['result']===-0x1){return _0x4812b9;}var _0x264838=this['getAndSetVariable'](_0x439c('0xb2'),_0x439c('0xd0'));if(_0x264838['result']===-0x1){return _0x264838;}return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')]('Executed\x20command\x20MRCPRecog\x20%s',_0x8742e4));};AGIVertices[_0x439c('0x10')][_0x439c('0xd1')]=function(_0x5191d3){logger[_0x439c('0x2c')](util['format'](_0x439c('0xd2'),_0x5191d3['label']));if(!this[_0x439c('0x86')](_0x5191d3['odbc_id'])){return this[_0x439c('0xe')][_0x439c('0x57')](_0x5191d3,_0x439c('0xd3'));}var _0x167ae6=this[_0x439c('0x19')][_0x439c('0x70')](this,_0x5191d3[_0x439c('0xd4')]);if(!_0x167ae6){return this[_0x439c('0xe')][_0x439c('0x57')](_0x5191d3,'no\x20odbc\x20database\x20found');}if(!this[_0x439c('0x86')](_0x5191d3['query'])){return this[_0x439c('0xe')][_0x439c('0x57')](_0x5191d3,'no\x20query\x20configured');}var _0x306c30=_0x5191d3[_0x439c('0x2b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x439c('0xa9')](util['format'](_0x439c('0xd5'),_0x306c30));var _0x353de4=this[_0x439c('0xd6')][_0x439c('0x70')](this,_0x167ae6,_0x306c30);this[_0x439c('0x33')][_0x439c('0x70')](this,_0x5191d3,_0x306c30);if(!this[_0x439c('0x86')](_0x5191d3['variable_id'])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xd7'));}var _0x1bc8ce=this[_0x439c('0x11')][_0x439c('0x70')](this,_0x5191d3['variable_id']);if(!_0x1bc8ce){return this[_0x439c('0xe')][_0x439c('0x57')](_0x5191d3,_0x439c('0xd8'));}var _0x2db2a3=this;_0x353de4['forEach'](function(_0x2ffea5,_0x3cd958){Object[_0x439c('0xd9')](_0x2ffea5)[_0x439c('0xda')](function(_0x25d86f){_0x2db2a3[_0x439c('0xe')]['setVariable'](util[_0x439c('0x54')](_0x439c('0xdb'),_0x1bc8ce,_0x3cd958,_0x25d86f),_0x2ffea5[_0x25d86f]);});});this[_0x439c('0xe')][_0x439c('0xa6')](util['format'](_0x439c('0xdc'),_0x1bc8ce),_0x353de4[_0x439c('0x9c')]);return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0xdd'),_0x1bc8ce));};AGIVertices[_0x439c('0x10')]['dial']=function(_0xca8ecf){logger[_0x439c('0xde')](util['format'](_0x439c('0xdf'),_0xca8ecf[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0xca8ecf[_0x439c('0xe0')])){return this[_0x439c('0xe')][_0x439c('0x57')](_0xca8ecf,'no\x20user\x20selected');}var _0x3428d1=this[_0x439c('0x1a')][_0x439c('0x70')](this,_0xca8ecf[_0x439c('0xe0')]);if(!_0x3428d1){return this[_0x439c('0xe')]['error'](_0xca8ecf,_0x439c('0xe1'));}var _0x17f1d0=this[_0x439c('0xe')][_0x439c('0x59')](_0x439c('0xe2'),[util[_0x439c('0x54')](_0x439c('0xe3'),_0x3428d1),_0xca8ecf[_0x439c('0x66')],_0xca8ecf[_0x439c('0xe4')],_0xca8ecf[_0x439c('0x65')]]);if(_0x17f1d0[_0x439c('0xa3')]===-0x1){return _0x17f1d0;}return this[_0x439c('0xe')][_0x439c('0xa9')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x439c('0x10')][_0x439c('0xe5')]=function(_0x1f41ca){logger['info'](util[_0x439c('0x54')](_0x439c('0xe6'),_0x1f41ca['label']));if(!this[_0x439c('0x86')](_0x1f41ca[_0x439c('0x7c')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xe7'));}if(!this[_0x439c('0x86')](_0x1f41ca[_0x439c('0x5f')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xc5'));}this['channel']['bot']=!![];this[_0x439c('0x33')](_0x1f41ca);this[_0x439c('0x41')](_0x1f41ca[_0x439c('0x5f')],'in','','');this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')]('Trying\x20Dialogflow:\x20%s',_0x1f41ca[_0x439c('0x5f')]));var _0x3b9a90=this['googleDialogflow'][_0x439c('0x70')](this,_0x1f41ca);if(_0x3b9a90){for(var _0xc7f6c1 in _0x3b9a90){if(_0x3b9a90[_0x439c('0x96')](_0xc7f6c1)){this[_0x439c('0xe')]['setVariable'](util[_0x439c('0x54')]('DIALOGFLOW_%s',_0xc7f6c1[_0x439c('0x6c')]()),_0x3b9a90[_0xc7f6c1]);}}this[_0x439c('0x41')](_0x3b9a90[_0x439c('0xe8')],_0x439c('0xe9'),_0x439c('0xe5'),'');return this['channel']['noop'](util['format'](_0x439c('0xea'),_0x3b9a90['speech']));}return this[_0x439c('0xe')][_0x439c('0x57')](_0x1f41ca,_0x439c('0xeb'));};AGIVertices[_0x439c('0x10')][_0x439c('0xec')]=function(_0x96b45e){logger['info'](util[_0x439c('0x54')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x96b45e['label']));if(!this[_0x439c('0x86')](_0x96b45e[_0x439c('0x7f')])){return this[_0x439c('0xe')][_0x439c('0xa9')]('no\x20project_id\x20configured');}if(!this[_0x439c('0x86')](_0x96b45e[_0x439c('0x80')])){return this[_0x439c('0xe')]['noop']('no\x20client_email\x20configured');}if(!this[_0x439c('0x86')](_0x96b45e[_0x439c('0x81')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xed'));}if(!this[_0x439c('0x86')](_0x96b45e[_0x439c('0xee')])){return this['channel'][_0x439c('0xa9')](_0x439c('0xef'));}if(!this['isConfigured'](_0x96b45e[_0x439c('0x5f')])){return this[_0x439c('0xe')][_0x439c('0xa9')]('no\x20text\x20configured');}this[_0x439c('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x96b45e);this[_0x439c('0x41')](_0x96b45e[_0x439c('0x5f')],'in','','');this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0xf0'),_0x96b45e[_0x439c('0x5f')]));var _0x475831=this['googleDialogflowV2'][_0x439c('0x70')](this,_0x96b45e);if(_0x475831){for(var _0x9b946 in _0x475831){if(_0x475831[_0x439c('0x96')](_0x9b946)){if(_0x9b946!==_0x439c('0xf1')){this[_0x439c('0xe')][_0x439c('0xa6')](util[_0x439c('0x54')](_0x439c('0xf2'),_0x9b946[_0x439c('0x6c')]()),_0x475831[_0x9b946]);}}}this[_0x439c('0x41')](_0x475831[_0x439c('0xe8')],_0x439c('0xe9'),_0x439c('0xec'),_0x475831[_0x439c('0xf1')]);return this[_0x439c('0xe')][_0x439c('0xa9')](util['format'](_0x439c('0xf3'),_0x475831[_0x439c('0xe8')]));}return this[_0x439c('0xe')][_0x439c('0x57')](_0x96b45e,_0x439c('0xf4'));};AGIVertices[_0x439c('0x10')][_0x439c('0xf5')]=function(_0x456bc7){logger['info'](util[_0x439c('0x54')](_0x439c('0xf6'),_0x456bc7[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x456bc7[_0x439c('0xf7')])){return this[_0x439c('0xe')]['noop'](_0x439c('0xf8'));}if(!this[_0x439c('0x86')](_0x456bc7[_0x439c('0xf9')])){return this[_0x439c('0xe')][_0x439c('0xa9')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x456bc7[_0x439c('0xfa')])){return this['channel'][_0x439c('0xa9')](_0x439c('0xfb'));}if(!this[_0x439c('0x86')](_0x456bc7[_0x439c('0xfc')])){return this['channel'][_0x439c('0xa9')](_0x439c('0xc5'));}this['channel'][_0x439c('0xfd')]=!![];this[_0x439c('0x33')](_0x456bc7);this[_0x439c('0x41')](_0x456bc7[_0x439c('0x5f')],'in','','');this[_0x439c('0xe')]['noop'](util[_0x439c('0x54')](_0x439c('0xfe'),_0x456bc7[_0x439c('0x5f')]));var _0x20408b=this[_0x439c('0x82')][_0x439c('0x70')](this,_0x456bc7);if(_0x20408b){for(var _0x163ae4 in _0x20408b){if(_0x20408b[_0x439c('0x96')](_0x163ae4)){this[_0x439c('0xe')][_0x439c('0xa6')](util[_0x439c('0x54')](_0x439c('0xff'),_0x163ae4[_0x439c('0x6c')]()),_0x20408b[_0x163ae4]);}}this[_0x439c('0x41')](_0x20408b[_0x439c('0xe8')],_0x439c('0xe9'),_0x439c('0xf5'),'');if(_0x20408b['audiofile']){this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x100'),_0x20408b[_0x439c('0x101')]));var _0x5241dd=this['channel'][_0x439c('0x102')](_0x20408b[_0x439c('0x101')]);try{fs[_0x439c('0x103')](_0x20408b[_0x439c('0x101')]+'.wav');}catch(_0x3a5766){logger[_0x439c('0x57')](_0x3a5766);}return _0x5241dd;}else{return this['channel']['noop'](util['format'](_0x439c('0x104'),_0x20408b[_0x439c('0xe8')]));}}return this[_0x439c('0xe')][_0x439c('0x57')](_0x456bc7,_0x439c('0x105'));};AGIVertices[_0x439c('0x10')][_0x439c('0x106')]=function(_0x4bf712){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x107'),_0x4bf712[_0x439c('0x35')]));return this['channel'][_0x439c('0xa9')](_0x439c('0x106'));};AGIVertices[_0x439c('0x10')][_0x439c('0x108')]=function(_0x25b840){logger['info'](util[_0x439c('0x54')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x25b840[_0x439c('0x35')]));var _0x4c4bdc='';if(_0x25b840[_0x439c('0x109')]){if(!this[_0x439c('0x86')](_0x25b840[_0x439c('0x109')])){return this[_0x439c('0xe')][_0x439c('0x57')](_0x25b840,_0x439c('0x10a'));}else{var _0x1e9ade=parseInt(_0x25b840[_0x439c('0x109')],0xa);if(isNaN(_0x1e9ade)){_0x4c4bdc=_0x25b840[_0x439c('0x109')];}else{_0x4c4bdc=this['getTrunk']['sync'](this,_0x25b840[_0x439c('0x109')]);if(!_0x4c4bdc){return this[_0x439c('0xe')][_0x439c('0x57')](_0x25b840,_0x439c('0x10b'));}}}}else if(_0x25b840[_0x439c('0x10c')]){_0x4c4bdc=_0x25b840['trunk_name'];}else{return this[_0x439c('0xe')]['error'](_0x25b840,_0x439c('0x10a'));}var _0x5aebcb=this[_0x439c('0xe')][_0x439c('0x59')](_0x439c('0xe2'),[util['format']('SIP/%s/%s',_0x4c4bdc,_0x25b840['phone']),_0x25b840[_0x439c('0x66')],_0x25b840[_0x439c('0xe4')],_0x25b840[_0x439c('0x65')]]);if(_0x5aebcb[_0x439c('0xa3')]===-0x1){return _0x5aebcb;}return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x10d'),'DIAL'));};AGIVertices[_0x439c('0x10')]['finally']=function(_0x20ea80){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x10e'),_0x20ea80[_0x439c('0x35')]));return this[_0x439c('0xe')]['noop'](_0x439c('0x10f'));};AGIVertices[_0x439c('0x10')][_0x439c('0xc')]=function(_0x23dbc1){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x110'),_0x23dbc1[_0x439c('0x35')]));if(_0x23dbc1[_0x439c('0xa7')]===0x0){return this[_0x439c('0xa8')](_0x23dbc1);}_0x23dbc1[_0x439c('0xa7')]-=0x1;if(!this['isConfigured'](_0x23dbc1['file_id'])){return this[_0x439c('0xe')][_0x439c('0x57')](_0x23dbc1,_0x439c('0x111'));}var _0x519906=this[_0x439c('0x1d')][_0x439c('0x70')](this,_0x23dbc1[_0x439c('0x112')]);if(!_0x519906){return this[_0x439c('0xe')][_0x439c('0x57')](_0x23dbc1,_0x439c('0x113'));}if(!this[_0x439c('0x86')](_0x23dbc1['variable_id'])){return this[_0x439c('0xe')]['error'](_0x439c('0xd7'));}var _0x20d362=this[_0x439c('0xe')][_0x439c('0x114')](_0x519906,_0x23dbc1['response'],_0x23dbc1[_0x439c('0x115')]);var _0x5b0b3b=_0x20d362[_0x439c('0xa3')]?_0x20d362[_0x439c('0xa3')][_0x439c('0x4b')]():'';logger[_0x439c('0x2c')](_0x439c('0x116'),JSON[_0x439c('0x74')](_0x20d362));if(_0x20d362[_0x439c('0xa3')]===-0x1){this['createSquareDetailsReport'][_0x439c('0x70')](this,_0x23dbc1,_0x5b0b3b);return _0x20d362;}else if(_0x20d362[_0x439c('0xa5')]===_0x439c('0x66')){_0x20d362['result']=_0x5b0b3b[_0x439c('0x9c')]>=parseInt(_0x23dbc1[_0x439c('0x117')])?'x':'i';}else{_0x20d362[_0x439c('0xa3')]=_0x5b0b3b[_0x439c('0x9c')]>=parseInt(_0x23dbc1['mindigit'])&&_0x5b0b3b[_0x439c('0x9c')]<=parseInt(_0x23dbc1[_0x439c('0x115')])?'x':'i';}var _0x16be59=this[_0x439c('0x11')][_0x439c('0x70')](this,_0x23dbc1[_0x439c('0x118')]);if(!_0x16be59){return this[_0x439c('0xe')][_0x439c('0x57')](_0x23dbc1,'no\x20variable\x20found');}this[_0x439c('0xe')]['setVariable'](_0x16be59,_0x5b0b3b);if(this['isConfigured'](_0x23dbc1[_0x439c('0x119')])){var _0x1bf116=parseInt(_0x23dbc1['hiddendigitsnum'],0xa);var _0x4a893a=rs[_0x439c('0x11a')]({'charset':'*','length':_0x1bf116});var _0x1a3419=_0x5b0b3b['length'];if(_0x1a3419>0x0){if(_0x1a3419>_0x1bf116){this[_0x439c('0x33')][_0x439c('0x70')](this,_0x23dbc1,_0x23dbc1[_0x439c('0x11b')]==='first'?_0x4a893a+_0x5b0b3b[_0x439c('0x11c')](_0x1bf116):_0x5b0b3b[_0x439c('0x11c')](0x0,_0x1a3419-_0x1bf116)+_0x4a893a);}else{this[_0x439c('0x33')][_0x439c('0x70')](this,_0x23dbc1,rs['generate']({'charset':'*','length':_0x1a3419}));}}else{this[_0x439c('0x33')]['sync'](this,_0x23dbc1,'');}}else{this['createSquareDetailsReport'][_0x439c('0x70')](this,_0x23dbc1,_0x5b0b3b);}return _0x20d362;};AGIVertices['prototype'][_0x439c('0xd')]=function(_0x56b3ea){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x11d'),_0x56b3ea['label']));return this[_0x439c('0xc')](_0x56b3ea);};AGIVertices[_0x439c('0x10')][_0x439c('0x11e')]=function(_0x12c185){logger['info'](util[_0x439c('0x54')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x12c185['label']));this['createSquareDetailsReport']['sync'](this,_0x12c185,_0x12c185[_0x439c('0x11f')]);return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x120'),_0x12c185['goalname']));};AGIVertices[_0x439c('0x10')][_0x439c('0x121')]=function(_0x272b20){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x122'),_0x272b20[_0x439c('0x35')]));if(!this['isConfigured'](_0x272b20['aws_access_key_id'])||!this[_0x439c('0x86')](_0x272b20[_0x439c('0x8a')])){return this['channel'][_0x439c('0xa9')](_0x439c('0x123'));}if(!this[_0x439c('0x86')](_0x272b20[_0x439c('0x5f')])){return this[_0x439c('0xe')][_0x439c('0xa9')]('no\x20text\x20configured');}this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')]('Trying\x20aws\x20Polly\x20%s',_0x272b20[_0x439c('0x5f')]));var _0x43e8bf=this[_0x439c('0x88')]['sync'](this,_0x272b20);if(_0x43e8bf){this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x124'),_0x43e8bf));var _0x1fe26d=this[_0x439c('0xe')][_0x439c('0x102')](_0x43e8bf);try{fs[_0x439c('0x103')](_0x43e8bf+_0x439c('0x125'));}catch(_0x1a17b1){logger[_0x439c('0x57')](_0x1a17b1);}return _0x1fe26d;}return this[_0x439c('0xe')][_0x439c('0x57')](_0x272b20,_0x439c('0x126'));};AGIVertices['prototype'][_0x439c('0x127')]=function(_0xd7cb65){logger['info'](util[_0x439c('0x54')](_0x439c('0x128'),_0xd7cb65[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0xd7cb65[_0x439c('0x89')])||!this[_0x439c('0x86')](_0xd7cb65['aws_secret_access_key'])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0x123'));}if(!this[_0x439c('0x86')](_0xd7cb65[_0x439c('0x8e')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0x129'));}if(!this[_0x439c('0x86')](_0xd7cb65[_0x439c('0x5f')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xc5'));}this['channel'][_0x439c('0xfd')]=!![];this[_0x439c('0x33')](_0xd7cb65);this['createSquareMessage'](_0xd7cb65['text'],'in','','');this[_0x439c('0xe')]['noop'](util[_0x439c('0x54')]('Trying\x20Amazon\x20Lex:\x20%s',_0xd7cb65['text']));var _0x435168=this['awsLex'][_0x439c('0x70')](this,_0xd7cb65);if(_0x435168){for(var _0x5c2db1 in _0x435168){if(_0x435168['hasOwnProperty'](_0x5c2db1)&&_['isString'](_0x435168[_0x5c2db1])){this[_0x439c('0xe')][_0x439c('0xa6')](util[_0x439c('0x54')](_0x439c('0x12a'),_0x5c2db1[_0x439c('0x6c')]()),_0x435168[_0x5c2db1]);}}if(_['isNil'](_0x435168[_0x439c('0x78')])){return this[_0x439c('0xe')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x439c('0x41')](_0x435168[_0x439c('0x78')],_0x439c('0xe9'),_0x439c('0x12b'),'');return this[_0x439c('0xe')]['noop'](util[_0x439c('0x54')](_0x439c('0x12c'),_0x435168[_0x439c('0x78')]));}}return this[_0x439c('0xe')]['error'](_0xd7cb65,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x439c('0x10')][_0x439c('0x12d')]=function(_0x340764){logger['info'](util[_0x439c('0x54')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x340764[_0x439c('0x35')],_0x340764[_0x439c('0x66')]));if(!this[_0x439c('0x86')](_0x340764[_0x439c('0x7c')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xe7'));}var _0x59a285='wav';var _0x40ed2f=util[_0x439c('0x54')](_0x439c('0x12e'),FILES_PATH,rs[_0x439c('0x11a')](0x4));var _0x1b9bb4=util['format'](_0x439c('0x9f'),_0x40ed2f,_0x59a285);var _0x109640=!![];if(_0x340764['beep']===_0x439c('0x12f')){_0x109640=![];}var _0x4074cd=this['channel'][_0x439c('0x130')](_0x40ed2f,_0x59a285,_0x340764['intKey'],_0x340764[_0x439c('0x66')],undefined,_0x109640);if(_0x4074cd[_0x439c('0xa3')]!==-0x1){this[_0x439c('0xe')][_0x439c('0xa9')](util['format']('google\x20%s\x20file\x20created',_0x1b9bb4));var _0x1ca636=this['googleASR'][_0x439c('0x70')](this,_0x340764,_0x1b9bb4);if(_0x1ca636){for(var _0x1fd34b in _0x1ca636){if(_0x1ca636[_0x439c('0x96')](_0x1fd34b)){this['channel']['setVariable'](util[_0x439c('0x54')](_0x439c('0x131'),_0x1fd34b['toUpperCase']()),_0x1ca636[_0x1fd34b]);}}return this['channel']['noop'](util[_0x439c('0x54')](_0x439c('0x132'),JSON[_0x439c('0x74')](_0x1ca636)));}}return _0x4074cd;};AGIVertices[_0x439c('0x10')]['tildeasr']=function(_0x3fc9f5){logger['info'](util[_0x439c('0x54')](_0x439c('0x133'),_0x3fc9f5[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x3fc9f5[_0x439c('0x92')])){return this[_0x439c('0xe')]['noop'](_0x439c('0x134'));}if(!this[_0x439c('0x86')](_0x3fc9f5[_0x439c('0x93')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0x135'));}var _0xa82d7f=_0x439c('0x136');var _0x1b9f73=util[_0x439c('0x54')]('%s/recordings/%s',FILES_PATH,rs[_0x439c('0x11a')](0x4));var _0x94fd6e=util[_0x439c('0x54')](_0x439c('0x9f'),_0x1b9f73,_0xa82d7f);var _0xca7eb=!![];if(_0x3fc9f5[_0x439c('0x137')]==='NOBEEP'){_0xca7eb=![];}var _0x3f7f82=this[_0x439c('0xe')]['recordFile'](_0x1b9f73,_0xa82d7f,_0x3fc9f5['intKey'],_0x3fc9f5[_0x439c('0x66')],undefined,_0xca7eb);if(_0x3f7f82[_0x439c('0xa3')]!==-0x1){this[_0x439c('0xe')]['noop'](util[_0x439c('0x54')](_0x439c('0x138'),_0x94fd6e));var _0x55ceab=this[_0x439c('0x91')]['sync'](this,_0x3fc9f5,_0x94fd6e);if(_0x55ceab){for(var _0x28c895 in _0x55ceab){if(_0x55ceab['hasOwnProperty'](_0x28c895)){this[_0x439c('0xe')][_0x439c('0xa6')](util[_0x439c('0x54')]('TILDE_ASR_%s',_0x28c895[_0x439c('0x6c')]()),_0x55ceab[_0x28c895]);}}return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x139'),JSON['stringify'](_0x55ceab)));}}return _0x3f7f82;};AGIVertices['prototype'][_0x439c('0x13a')]=function(_0x17d492){logger[_0x439c('0x2c')](util['format'](_0x439c('0x13b'),_0x17d492[_0x439c('0x35')]));return this[_0x439c('0xe')][_0x439c('0x13c')](_0x17d492['context'],_0x17d492[_0x439c('0x3b')],_0x17d492[_0x439c('0x3c')]);};AGIVertices[_0x439c('0x10')]['gotoif']=function(_0x1e53b8){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x13d'),_0x1e53b8['label']));if(!this[_0x439c('0x86')](_0x1e53b8[_0x439c('0x13e')])){return this[_0x439c('0xe')]['error'](_0x1e53b8,'no\x20condition\x20configured');}try{var _0x132be4=eval(_0x1e53b8[_0x439c('0x13e')])?'true':_0x439c('0x13f');this['channel'][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x140'),_0x1e53b8[_0x439c('0x13e')],_0x132be4));return{'code':0xc8,'result':_0x132be4};}catch(_0x28c656){return{'code':0xc8,'result':_0x439c('0x13f')};}};AGIVertices['prototype'][_0x439c('0x141')]=function(_0x6c40e7){logger[_0x439c('0x2c')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x6c40e7[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x6c40e7[_0x439c('0x142')])){return this[_0x439c('0xe')][_0x439c('0x57')](_0x6c40e7,_0x439c('0x143'));}var _0x330fed=this[_0x439c('0x144')]['sync'](this,_0x6c40e7[_0x439c('0x142')]);if(!_0x330fed){return this[_0x439c('0xe')][_0x439c('0x57')](_0x6c40e7,_0x439c('0x145'));}for(var _0x5b8bc3=0x0;_0x5b8bc3<_0x330fed[_0x439c('0x9c')];_0x5b8bc3+=0x1){var _0x18902d=this['channel'][_0x439c('0x11')](util[_0x439c('0x54')](_0x439c('0x146'),_0x330fed[_0x5b8bc3]));if(_0x18902d['result']===-0x1){return _0x18902d;}logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x147'),_0x330fed[_0x5b8bc3],_0x18902d['extra']));if(_0x18902d['extra']===_0x439c('0x148')){logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x330fed[_0x5b8bc3],_0x439c('0x148')));this['channel'][_0x439c('0xa9')](util[_0x439c('0x54')]('IFTIME\x20%s\x20%s',_0x330fed[_0x5b8bc3],_0x439c('0x148')));return{'code':0xc8,'result':_0x439c('0x148')};}else{logger[_0x439c('0x2c')](util['format'](_0x439c('0x147'),_0x330fed[_0x5b8bc3],'false'));this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x147'),_0x330fed[_0x5b8bc3],_0x439c('0x13f')));}}return{'code':0xc8,'result':_0x439c('0x13f')};};AGIVertices[_0x439c('0x10')][_0x439c('0x149')]=function(_0x76c8be){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x14a'),_0x76c8be[_0x439c('0x35')]));return this['channel']['hangup']();};AGIVertices[_0x439c('0x10')][_0x439c('0x14b')]=function(_0x2adc58){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x14c'),_0x2adc58['label']));if(!this['isConfigured'](_0x2adc58[_0x439c('0x7c')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xe7'));}var _0x5c0afe='wav';var _0x927ee7=util[_0x439c('0x54')]('%s/recordings/%s',FILES_PATH,rs[_0x439c('0x11a')](0x4));var _0x44e5f5=util['format']('%s.%s',_0x927ee7,_0x5c0afe);var _0x37bee9=!![];if(_0x2adc58['beep']===_0x439c('0x12f')){_0x37bee9=![];}var _0x5948ac=this[_0x439c('0xe')][_0x439c('0x130')](_0x927ee7,_0x5c0afe,_0x2adc58[_0x439c('0x14d')],_0x2adc58[_0x439c('0x66')],undefined,_0x37bee9);if(_0x5948ac['result']!==-0x1){this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x14e'),_0x44e5f5));var _0x56565e=this['ispeechASR'][_0x439c('0x70')](this,_0x2adc58,_0x44e5f5);if(_0x56565e){for(var _0x5667c3 in _0x56565e){if(_0x56565e[_0x439c('0x96')](_0x5667c3)){this[_0x439c('0xe')][_0x439c('0xa6')](util[_0x439c('0x54')](_0x439c('0x14f'),_0x5667c3[_0x439c('0x6c')]()),_0x56565e[_0x5667c3]);}}return this[_0x439c('0xe')][_0x439c('0xa9')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x439c('0x74')](_0x56565e)));}}return _0x5948ac;};AGIVertices[_0x439c('0x10')][_0x439c('0x150')]=function(_0x1a38e8){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x151'),_0x1a38e8[_0x439c('0x35')]));if(!this['isConfigured'](_0x1a38e8[_0x439c('0x7c')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xe7'));}if(!this['isConfigured'](_0x1a38e8[_0x439c('0x5f')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xc5'));}this['channel']['noop'](util[_0x439c('0x54')](_0x439c('0x152'),_0x1a38e8[_0x439c('0x5f')]));var _0x3ffd96=this[_0x439c('0x83')]['sync'](this,_0x1a38e8);if(_0x3ffd96){this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x14e'),_0x3ffd96));var _0xf38c48=this[_0x439c('0xe')][_0x439c('0x102')](_0x3ffd96,_0x1a38e8['intKey']);try{fs[_0x439c('0x103')](_0x3ffd96+'.wav');}catch(_0x26cea6){logger[_0x439c('0x57')](_0x26cea6);}return _0xf38c48;}return this['channel'][_0x439c('0x57')](_0x1a38e8,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x439c('0x10')][_0x439c('0x153')]=function(_0x5bd57b){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x154'),_0x5bd57b[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x5bd57b[_0x439c('0x155')])){return this[_0x439c('0xe')][_0x439c('0x57')](_0x5bd57b,_0x439c('0x156'));}logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x157'),this[_0x439c('0xe')][_0x439c('0x37')],_0x5bd57b[_0x439c('0x155')]));var _0x2e3076=this[_0x439c('0x52')][_0x439c('0x70')](this,_0x5bd57b['findBy']);if(_0x2e3076){logger[_0x439c('0x2c')](util[_0x439c('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x439c('0xe')][_0x439c('0x37')],_0x5bd57b[_0x439c('0x155')]));this['channel'][_0x439c('0xa9')](util['format'](_0x439c('0x158'),this[_0x439c('0xe')]['callerid'],_0x5bd57b[_0x439c('0x155')]));return{'code':0xc8,'result':_0x439c('0x159')};}else{logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x15a'),this[_0x439c('0xe')][_0x439c('0x37')],_0x5bd57b[_0x439c('0x155')]));this[_0x439c('0xe')]['noop'](util['format'](_0x439c('0x15a'),this[_0x439c('0xe')][_0x439c('0x37')],_0x5bd57b['findBy']));return{'code':0xc8,'result':_0x439c('0x15b')};}};AGIVertices[_0x439c('0x10')][_0x439c('0x15c')]=function(_0x299af5){logger[_0x439c('0x2c')](util['format'](_0x439c('0x15d'),_0x299af5[_0x439c('0x35')]));if(!this['isConfigured'](_0x299af5[_0x439c('0x155')])){return this[_0x439c('0xe')][_0x439c('0x57')](_0x299af5,_0x439c('0x156'));}logger['info'](util['format'](_0x439c('0x157'),this[_0x439c('0xe')][_0x439c('0x37')],_0x299af5['findBy']));var _0x8629c8=this[_0x439c('0x51')]['sync'](this,_0x299af5[_0x439c('0x155')]);if(_0x8629c8){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x158'),this[_0x439c('0xe')][_0x439c('0x37')],_0x299af5['findBy']));this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x158'),this[_0x439c('0xe')]['callerid'],_0x299af5[_0x439c('0x155')]));return{'code':0xc8,'result':_0x439c('0x159')};}else{logger['info'](util[_0x439c('0x54')](_0x439c('0x15a'),this['channel']['callerid'],_0x299af5['findBy']));this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x15a'),this[_0x439c('0xe')]['callerid'],_0x299af5[_0x439c('0x155')]));return{'code':0xc8,'result':_0x439c('0x15b')};}};AGIVertices[_0x439c('0x10')]['math']=function(_0x80e0a7){logger[_0x439c('0x2c')](util['format'](_0x439c('0x15e'),_0x80e0a7[_0x439c('0x35')]));if(!this['isConfigured'](_0x80e0a7[_0x439c('0x15f')])){return this['channel'][_0x439c('0x57')](_0x80e0a7,_0x439c('0x160'));}this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x161'),_0x80e0a7[_0x439c('0x15f')]));var _0x192511=eval(_0x80e0a7[_0x439c('0x15f')]);if(!this[_0x439c('0x86')](_0x80e0a7[_0x439c('0x118')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xd7'));}var _0x84b4ea=this[_0x439c('0x11')]['sync'](this,_0x80e0a7[_0x439c('0x118')]);if(!_0x84b4ea){return this['channel']['error'](_0x80e0a7,_0x439c('0xd8'));}if(_[_0x439c('0x9b')](_0x192511)){var _0x577717=this;_0x192511[_0x439c('0xda')](function(_0xad55fe,_0x5da8c8){_0x577717['channel'][_0x439c('0xa6')](util[_0x439c('0x54')](_0x439c('0x162'),_0x84b4ea,_0x5da8c8),_0xad55fe);});return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x163'),_0x84b4ea));}else{return this['channel']['setVariable'](_0x84b4ea,_0x192511);}};AGIVertices[_0x439c('0x10')][_0x439c('0xb')]=function(_0x62a81d){logger[_0x439c('0x2c')](util['format'](_0x439c('0x164'),_0x62a81d[_0x439c('0x35')]));if(_0x62a81d[_0x439c('0xa7')]===0x0){return this[_0x439c('0xa8')](_0x62a81d);}_0x62a81d['retry']-=0x1;if(!this[_0x439c('0x86')](_0x62a81d['file_id'])){return this['channel'][_0x439c('0x57')](_0x62a81d,_0x439c('0x111'));}var _0x54e36c=this[_0x439c('0x1d')]['sync'](this,_0x62a81d[_0x439c('0x112')]);if(!_0x54e36c){return this[_0x439c('0xe')][_0x439c('0x57')](_0x62a81d,_0x439c('0x113'));}var _0x3b5349=this['channel']['getData'](_0x54e36c,_0x62a81d[_0x439c('0x165')],_0x62a81d[_0x439c('0x166')]);var _0x10500c=_0x3b5349[_0x439c('0xa3')];if(_0x3b5349[_0x439c('0xa3')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x62a81d,'-1');return _0x3b5349;}else if(_0x3b5349['extra']==='timeout'){_0x3b5349[_0x439c('0xa3')]=_0x3b5349[_0x439c('0xa3')][_0x439c('0x9c')]>0x0?_0x3b5349['result']:'t';}else if(_[_0x439c('0x43')](_0x3b5349[_0x439c('0xa3')])){_0x3b5349[_0x439c('0xa3')]='#';_0x10500c='#';}if(!this['isConfigured'](_0x62a81d[_0x439c('0x118')])){this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x38c000=this[_0x439c('0x11')][_0x439c('0x70')](this,_0x62a81d[_0x439c('0x118')]);if(!_0x38c000){return this[_0x439c('0xe')][_0x439c('0x57')](_0x62a81d,_0x439c('0xd8'));}this['channel'][_0x439c('0xa6')](_0x38c000,_0x10500c);}this[_0x439c('0x33')][_0x439c('0x70')](this,_0x62a81d,_0x10500c);return _0x3b5349;};AGIVertices[_0x439c('0x10')][_0x439c('0xa9')]=function(_0x579ba0){logger['info'](util[_0x439c('0x54')](_0x439c('0x167'),_0x579ba0[_0x439c('0x35')]));return this[_0x439c('0xe')][_0x439c('0xa9')](_0x579ba0['output']||_0x579ba0[_0x439c('0x35')]);};AGIVertices[_0x439c('0x10')][_0x439c('0x168')]=function(_0x3b629e){logger[_0x439c('0x2c')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3b629e[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x3b629e[_0x439c('0x155')])){return this['channel'][_0x439c('0x57')](_0x3b629e,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x439c('0x157'),this[_0x439c('0xe')][_0x439c('0x37')],_0x3b629e[_0x439c('0x155')]));var _0x292736=this[_0x439c('0x4d')][_0x439c('0x70')](this,_0x3b629e[_0x439c('0x169')]);var _0x165f22=this['agentPause'][_0x439c('0x70')](this,_0x3b629e[_0x439c('0x155')],_0x292736);if(_0x165f22){logger[_0x439c('0x2c')](util[_0x439c('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x439c('0x37')],_0x3b629e['findBy']));this[_0x439c('0xe')][_0x439c('0xa9')](util['format'](_0x439c('0x158'),this[_0x439c('0xe')]['callerid'],_0x3b629e[_0x439c('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x439c('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x439c('0xe')]['callerid'],_0x3b629e[_0x439c('0x155')]));this['channel']['noop'](util[_0x439c('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x439c('0xe')][_0x439c('0x37')],_0x3b629e[_0x439c('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x439c('0x10')][_0x439c('0x16a')]=function(_0x351128){logger[_0x439c('0x2c')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x351128[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x351128[_0x439c('0x112')])){return this[_0x439c('0xe')]['error'](_0x351128,_0x439c('0x111'));}var _0x29bff4=this[_0x439c('0x1d')][_0x439c('0x70')](this,_0x351128[_0x439c('0x112')]);if(!_0x29bff4){return this[_0x439c('0xe')][_0x439c('0x57')](_0x351128,_0x439c('0x113'));}var _0x233790=this['channel']['exec']('PLAYBACK',[_0x29bff4,_0x351128[_0x439c('0xe4')]]);if(_0x233790[_0x439c('0xa3')]===-0x1){return _0x233790;}return this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0xc1'),_0x439c('0x16b'),_0x29bff4));};AGIVertices['prototype'][_0x439c('0x16c')]=function(_0x3954c0){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x16d'),_0x3954c0[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x3954c0[_0x439c('0x16e')])){return this['channel'][_0x439c('0x57')](_0x3954c0,'no\x20queue\x20selected');}var _0x47ebc3='';var _0x508efc=parseInt(_0x3954c0['queue_id'],0xa);if(isNaN(_0x508efc)){_0x47ebc3=_0x3954c0['queue_id'];}else{_0x47ebc3=this[_0x439c('0x17')][_0x439c('0x70')](this,_0x3954c0[_0x439c('0x16e')]);if(!_0x47ebc3){return this[_0x439c('0xe')]['error'](_0x3954c0,'no\x20queue\x20found');}}var _0x4e2de4='';if(this[_0x439c('0x86')](_0x3954c0[_0x439c('0x112')])){var _0x2f2fca=this[_0x439c('0x1d')][_0x439c('0x70')](this,_0x3954c0[_0x439c('0x112')]);if(_0x2f2fca){_0x4e2de4=_0x2f2fca;}}this[_0x439c('0x33')][_0x439c('0x70')](this,_0x3954c0,_0x47ebc3);if(_0x3954c0['opts'][_0x439c('0x16f')]('x')<0x0){_0x3954c0['opts']+='x';}if(_0x3954c0['opts']['indexOf']('X')<0x0){_0x3954c0[_0x439c('0xe4')]+='X';}this[_0x439c('0xe')][_0x439c('0xa6')]('XMCS-QUEUE',_0x47ebc3?_0x47ebc3['toLowerCase']():'');var _0x25654f=this[_0x439c('0xe')][_0x439c('0x59')](_0x439c('0x170'),[_0x47ebc3,_0x3954c0[_0x439c('0xe4')],_0x3954c0[_0x439c('0x65')],_0x4e2de4,_0x3954c0[_0x439c('0x66')],_0x3954c0[_0x439c('0x4')],_0x3954c0['macro'],_0x3954c0[_0x439c('0x171')],'',_0x3954c0[_0x439c('0x172')]]);if(_0x25654f[_0x439c('0xa3')]===-0x1){return _0x25654f;}return this[_0x439c('0xe')][_0x439c('0xa9')](util['format'](_0x439c('0xc1'),_0x439c('0x170'),_0x47ebc3));};AGIVertices[_0x439c('0x10')][_0x439c('0x173')]=function(_0x64f86f){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x174'),_0x64f86f['label']));var _0x551944=_0x64f86f['recordingFormat']||_0x439c('0x136');var _0x3767a8=util[_0x439c('0x54')](_0x439c('0x175'),this[_0x439c('0xe')]['uniqueid'],rs['generate'](0x5));var _0x53e5d8=util[_0x439c('0x54')](_0x439c('0x176'),FILES_PATH,_0x3767a8,_0x551944);var _0x50a69a=util['format'](_0x439c('0x12e'),FILES_PATH,_0x3767a8);this[_0x439c('0x38')][_0x439c('0x70')](this,_0x64f86f,_0x3767a8,_0x53e5d8);this[_0x439c('0xe')][_0x439c('0xa6')](_0x439c('0x177'),_0x3767a8);logger[_0x439c('0x2c')](_0x439c('0x178'),_0x50a69a,_0x551944,_0x64f86f[_0x439c('0x179')],_0x64f86f[_0x439c('0x66')]);return this[_0x439c('0xe')][_0x439c('0x130')](_0x50a69a,_0x551944,_0x64f86f[_0x439c('0x179')],_0x64f86f[_0x439c('0x66')],undefined,!![]);};AGIVertices[_0x439c('0x10')][_0x439c('0x17a')]=function(_0x2d6cf6){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x17b'),_0x2d6cf6[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x2d6cf6[_0x439c('0x65')])){return this['channel'][_0x439c('0xa9')]('no\x20url\x20configured');}var _0x199569=this[_0x439c('0x64')]['sync'](this,_0x2d6cf6);logger[_0x439c('0x2c')](util[_0x439c('0x54')]('Response:',util[_0x439c('0x17c')](_0x199569,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2d6cf6[_0x439c('0x118')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0x17d'));}var _0x2344f8=this[_0x439c('0x11')][_0x439c('0x70')](this,_0x2d6cf6[_0x439c('0x118')]);if(!_0x2344f8){return this[_0x439c('0xe')][_0x439c('0x57')](_0x2d6cf6,_0x439c('0xd8'));}this['channel'][_0x439c('0xa6')](util[_0x439c('0x54')](_0x439c('0x17e'),_0x2344f8),_0x199569[_0x439c('0x76')]?_0x199569[_0x439c('0x76')]:'200');this[_0x439c('0xe')]['setVariable'](util[_0x439c('0x54')](_0x439c('0x17f'),_0x2344f8),_0x199569['statusMessage']?_0x199569[_0x439c('0x77')]:'OK');if(_0x199569[_0x439c('0x6d')]){try{this[_0x439c('0x9e')](_0x199569[_0x439c('0x6d')],_0x2344f8);}catch(_0x3d8abf){logger[_0x439c('0x57')](util[_0x439c('0x54')](_0x439c('0x180'),_0x2344f8));}}return this[_0x439c('0xe')]['noop'](util[_0x439c('0x54')](_0x439c('0xdd'),_0x2344f8));};AGIVertices[_0x439c('0x10')][_0x439c('0x181')]=function(_0x761527){logger[_0x439c('0x2c')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x761527['label']));return this[_0x439c('0xe')][_0x439c('0x182')](_0x761527[_0x439c('0x183')][_0x439c('0x5b')](/\s+/g,''),_0x761527[_0x439c('0x179')]);};AGIVertices[_0x439c('0x10')][_0x439c('0x184')]=function(_0x17544a){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x185'),_0x17544a[_0x439c('0x35')]));return this[_0x439c('0xe')]['sayNumber'](_0x17544a[_0x439c('0x67')]['replace'](/\s+/g,''),_0x17544a['escape_digits']);};AGIVertices[_0x439c('0x10')][_0x439c('0x186')]=function(_0x584bd3){logger[_0x439c('0x2c')](util['format'](_0x439c('0x187'),_0x584bd3[_0x439c('0x35')]));return this[_0x439c('0xe')][_0x439c('0x188')](_0x584bd3[_0x439c('0x5f')],_0x584bd3[_0x439c('0x179')]);};AGIVertices['prototype'][_0x439c('0x189')]=function(_0x5aeb24){logger[_0x439c('0x2c')](util['format'](_0x439c('0x18a'),_0x5aeb24['label']));if(!this['isConfigured'](_0x5aeb24[_0x439c('0x18b')])){return this[_0x439c('0xe')]['noop']('no\x20mail\x20account\x20configured');}var _0x571d36=this[_0x439c('0x20')][_0x439c('0x70')](this,_0x5aeb24['account_id']);if(!_0x571d36||!_0x571d36['Smtp']){return this['channel'][_0x439c('0x57')](_0x5aeb24,_0x439c('0x18c'));}var _0x3b52e7={'from':util[_0x439c('0x54')](_0x439c('0x18d'),_0x571d36['name'],_0x571d36[_0x439c('0x18e')]||_0x571d36['Smtp'][_0x439c('0x18f')]),'to':_0x5aeb24['to']||'','cc':_0x5aeb24['cc']||'','bcc':_0x5aeb24[_0x439c('0x190')]||'','subject':_0x5aeb24[_0x439c('0x191')],'html':_0x5aeb24[_0x439c('0x5f')],'text':_0x5aeb24['text']};if(this[_0x439c('0x86')](_0x5aeb24['template_id'])){}logger[_0x439c('0xde')](_0x439c('0x192'),JSON[_0x439c('0x74')](_0x3b52e7));this[_0x439c('0x33')]['sync'](this,_0x5aeb24,_0x5aeb24[_0x439c('0x18b')]);this[_0x439c('0xe')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x571d36[_0x439c('0x15')]));this[_0x439c('0x22')][_0x439c('0x70')](this,_0x571d36[_0x439c('0x193')],_0x3b52e7);return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0x194'));};AGIVertices[_0x439c('0x10')][_0x439c('0x195')]=function(_0x31b95c){logger[_0x439c('0x2c')](util[_0x439c('0x54')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x31b95c[_0x439c('0x35')]));return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0x196'));};AGIVertices[_0x439c('0x10')][_0x439c('0x197')]=function(_0x499d8d){logger['info'](util[_0x439c('0x54')](_0x439c('0x198'),_0x499d8d[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x499d8d['sms_account_id'])){return this['channel'][_0x439c('0xa9')](_0x439c('0x199'));}var _0xc71d19=this[_0x439c('0x30')]['sync'](this,_0x499d8d['sms_account_id']);if(!_0xc71d19){return this[_0x439c('0xe')][_0x439c('0x57')](_0x499d8d,_0x439c('0x19a'));}var _0x41329a={'body':_0x499d8d['sms_text'],'phone':_0x499d8d['to']||'','SmsAccountId':_0xc71d19['id']};logger[_0x439c('0xde')](_0x439c('0x19b'),JSON[_0x439c('0x74')](_0x41329a));this[_0x439c('0x33')][_0x439c('0x70')](this,_0x499d8d,_0x499d8d[_0x439c('0x19c')]);this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x19d'),_0xc71d19[_0x439c('0x15')]));this['createSmsMessage']['sync'](this,_0x41329a);return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0x19e'));};AGIVertices[_0x439c('0x10')][_0x439c('0x19f')]=function(_0xe03d22){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x1a0'),_0xe03d22[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0xe03d22[_0x439c('0x118')])){return this['channel']['error'](_0xe03d22,'no\x20variable\x20selected');}var _0x13eb12=this[_0x439c('0x11')][_0x439c('0x70')](this,_0xe03d22[_0x439c('0x118')]);if(!_0x13eb12){return this[_0x439c('0xe')]['error'](_0xe03d22,'no\x20variable\x20found');}return this[_0x439c('0xe')]['setVariable'](_0x13eb12,_0xe03d22['variable_value']);};AGIVertices[_0x439c('0x10')][_0x439c('0x1a1')]=function(_0x3a81a6){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x1a2'),_0x3a81a6[_0x439c('0x35')]));this[_0x439c('0xe')]['noop'](_0x439c('0x1a3'));if(_0x3a81a6[_0x439c('0xb6')]===_0x439c('0x1a4')){this[_0x439c('0xe')][_0x439c('0xa9')]('Answer');return this[_0x439c('0xe')]['answer']();}return this[_0x439c('0xe')][_0x439c('0xa9')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x439c('0x1a5')]=function(_0x205c8d){logger['info'](util[_0x439c('0x54')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x205c8d[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x205c8d[_0x439c('0x1a6')])){return this['channel']['error'](_0x205c8d,'no\x20subproject\x20selected');}var _0x10f35b=this[_0x439c('0x1a7')][_0x439c('0x70')](this,_0x205c8d[_0x439c('0x1a6')]);if(!this[_0x439c('0x86')](_0x10f35b)){return this[_0x439c('0xe')][_0x439c('0x57')](_0x205c8d,util[_0x439c('0x54')](_0x439c('0x1a8'),_0x205c8d[_0x439c('0x1a6')]));}if(_0x10f35b===this[_0x439c('0xe')]['arg_1']){return this['channel'][_0x439c('0x57')](_0x205c8d,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x439c('0x33')][_0x439c('0x70')](this,_0x205c8d,_0x10f35b);var _0x37bf9b=this[_0x439c('0xe')]['exec']('AGI',util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x439c('0x1a9')]||_0x439c('0x1aa'),_0x10f35b,this[_0x439c('0xe')][_0x439c('0x3f')]));if(_0x37bf9b['result']===-0x1){return _0x37bf9b;}return this[_0x439c('0xe')]['noop'](util['format'](_0x439c('0xc1'),_0x439c('0x1ab'),_0x10f35b));};AGIVertices[_0x439c('0x10')][_0x439c('0x1ac')]=function(_0x521060){logger[_0x439c('0x2c')](util['format'](_0x439c('0x1ad'),_0x521060[_0x439c('0x35')]));var _0x2920bb=this['shellCommand']['sync'](this,_0x521060['command']);this[_0x439c('0x33')][_0x439c('0x70')](this,_0x521060,_0x521060[_0x439c('0xb5')]);if(this[_0x439c('0x86')](_0x521060['variable_id'])){var _0x40e0a6=this['getVariable'][_0x439c('0x70')](this,_0x521060[_0x439c('0x118')]);if(_0x40e0a6){this[_0x439c('0xe')][_0x439c('0xa6')](_0x40e0a6,_0x2920bb);return this[_0x439c('0xe')][_0x439c('0xa9')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x521060[_0x439c('0xb5')],_0x40e0a6));}}return this['channel'][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x1ae'),_0x521060['command']));};AGIVertices[_0x439c('0x10')][_0x439c('0x1af')]=function(_0xfc7b87){logger['info'](util[_0x439c('0x54')](_0x439c('0x1b0'),_0xfc7b87[_0x439c('0x35')]));_0xfc7b87['text']=_0xfc7b87[_0x439c('0x5f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x439c('0x86')](_0xfc7b87[_0x439c('0x5d')])){return this['channel']['noop'](_0x439c('0x1b1'));}if(!this['isConfigured'](_0xfc7b87[_0x439c('0x5f')])){return this[_0x439c('0xe')][_0x439c('0xa9')](_0x439c('0xc5'));}this['channel'][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x1b2'),_0xfc7b87[_0x439c('0x5f')]));var _0x4ee40a=this[_0x439c('0x5c')]['sync'](this,_0xfc7b87);if(_0x4ee40a){this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x1b3'),_0x4ee40a));var _0x2819a6=this['channel'][_0x439c('0x102')](_0x4ee40a);try{fs['unlink'](_0x4ee40a+_0x439c('0x125'));}catch(_0x2d1361){logger[_0x439c('0x57')](_0x2d1361);}return _0x2819a6;}return this['channel'][_0x439c('0x57')](_0xfc7b87,_0x439c('0x1b4'));};AGIVertices[_0x439c('0x10')][_0x439c('0x1b5')]=function(_0x127d66){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x1b6'),_0x127d66['label']));_0x127d66[_0x439c('0x5f')]=_0x127d66[_0x439c('0x5f')][_0x439c('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x127d66[_0x439c('0x5f')])){return this[_0x439c('0xe')]['noop'](_0x439c('0xc5'));}this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x1b7'),_0x127d66['text']));var _0xb50d67=this[_0x439c('0x63')][_0x439c('0x70')](this,_0x127d66);if(_0xb50d67){this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x1b8'),_0xb50d67));var _0x191f42=this[_0x439c('0xe')][_0x439c('0x102')](_0xb50d67);try{fs['unlink'](_0xb50d67+_0x439c('0x125'));}catch(_0x3568cb){logger[_0x439c('0x57')](_0x3568cb);}return _0x191f42;}return this[_0x439c('0xe')][_0x439c('0x57')](_0x127d66,_0x439c('0x1b9'));};AGIVertices['prototype'][_0x439c('0x1ba')]=function(_0x7b6700){logger[_0x439c('0x2c')](util[_0x439c('0x54')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x7b6700[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x7b6700[_0x439c('0x155')])){return this[_0x439c('0xe')][_0x439c('0x57')](_0x7b6700,_0x439c('0x156'));}logger[_0x439c('0x2c')](util[_0x439c('0x54')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x439c('0xe')][_0x439c('0x37')],_0x7b6700[_0x439c('0x155')]));var _0x41a0d1=this['agentUnpause']['sync'](this,_0x7b6700['findBy']);if(_0x41a0d1){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x158'),this[_0x439c('0xe')][_0x439c('0x37')],_0x7b6700[_0x439c('0x155')]));this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')](_0x439c('0x158'),this[_0x439c('0xe')][_0x439c('0x37')],_0x7b6700[_0x439c('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x439c('0x2c')](util[_0x439c('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x439c('0xe')][_0x439c('0x37')],_0x7b6700[_0x439c('0x155')]));this[_0x439c('0xe')][_0x439c('0xa9')](util[_0x439c('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x439c('0xe')][_0x439c('0x37')],_0x7b6700[_0x439c('0x155')]));return{'code':0xc8,'result':_0x439c('0x15b')};}};AGIVertices[_0x439c('0x10')][_0x439c('0x1bb')]=function(_0x560013){logger[_0x439c('0x2c')](util[_0x439c('0x54')](_0x439c('0x1bc'),_0x560013[_0x439c('0x35')]));var _0x2831c3=this[_0x439c('0xe')][_0x439c('0x59')]('VOICEMAIL',[_0x560013[_0x439c('0x1bd')],_0x560013['options']]);if(_0x2831c3[_0x439c('0xa3')]===-0x1){return _0x2831c3;}return this[_0x439c('0xe')][_0x439c('0xa9')](util['format']('Executed\x20command\x20%s\x20%s',_0x439c('0x1be'),_0x560013[_0x439c('0x1bd')]));};AGIVertices[_0x439c('0x10')][_0x439c('0x1bf')]=function(_0x5cadde){logger['info'](util[_0x439c('0x54')](_0x439c('0x1c0'),_0x5cadde[_0x439c('0x35')]));if(!this[_0x439c('0x86')](_0x5cadde[_0x439c('0x118')])){return this[_0x439c('0xe')][_0x439c('0x57')](_0x5cadde,_0x439c('0x1c1'));}var _0x131e97=this['getVariable'][_0x439c('0x70')](this,_0x5cadde[_0x439c('0x118')]);if(!_0x131e97){return this[_0x439c('0xe')][_0x439c('0x57')](_0x5cadde,'no\x20variable\x20found');}var _0x47ec0f=this[_0x439c('0xe')][_0x439c('0x11')](_0x131e97);return{'code':0xc8,'result':_0x47ec0f[_0x439c('0xa5')]?_0x47ec0f[_0x439c('0xa5')]:'-'};};String[_0x439c('0x10')][_0x439c('0xa1')]=function(_0x3b61c1,_0x369af5){return this[_0x439c('0xa0')](_0x3b61c1)[_0x439c('0x1c2')](_0x369af5);};module[_0x439c('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d58a69a..f3546b5 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 _0xb863=['../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','syncHangup','bind','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','acwTimeout','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','timer','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','prototype','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','linkedid','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','acw'];(function(_0x5b346f,_0x339947){var _0x152f38=function(_0xbfc774){while(--_0xbfc774){_0x5b346f['push'](_0x5b346f['shift']());}};_0x152f38(++_0x339947);}(_0xb863,0x149));var _0x3b86=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb863[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x3b86('0x0'));var moment=require('moment');var ami=require(_0x3b86('0x1'));var logger=require('../../../config/logger')(_0x3b86('0x2'));var RpcUser=require(_0x3b86('0x3'));var RpcVoiceAgentReport=require(_0x3b86('0x4'));function Acw(_0x28b74b){this[_0x3b86('0x5')]=_0x28b74b[_0x3b86('0x5')];this[_0x3b86('0x6')]=_0x28b74b[_0x3b86('0x6')];this['timers']=_0x28b74b[_0x3b86('0x7')];this[_0x3b86('0x8')]={};ami['on'](_0x3b86('0x9'),this[_0x3b86('0xa')]['bind'](this));ami['on'](_0x3b86('0xb'),this[_0x3b86('0xc')]['bind'](this));ami['on']('hangup',this[_0x3b86('0xd')][_0x3b86('0xe')](this));ami['on'](_0x3b86('0xf'),this['syncAgentRingNoAnswer'][_0x3b86('0xe')](this));ami['on'](_0x3b86('0x10'),this[_0x3b86('0x11')]['bind'](this));ami['on'](_0x3b86('0x12'),this['syncBlindTransfer'][_0x3b86('0xe')](this));ami['on'](_0x3b86('0x13'),this[_0x3b86('0x14')][_0x3b86('0xe')](this));}function getDiff(_0x19fe3f){var _0xf252eb=moment()['milliseconds'](0x0);var _0x205417=moment(_0x19fe3f)[_0x3b86('0x15')](0x0);return _0xf252eb[_0x3b86('0x16')](_0x205417,_0x3b86('0x17'));}Acw['prototype'][_0x3b86('0x18')]=function(_0x2fffe3){try{var _0x2927cf=this;var _0xeca1fd=this['channels'][_0x2fffe3][_0x3b86('0x19')];var _0x168f97=this[_0x3b86('0x8')][_0x2fffe3][_0x3b86('0x1a')];var _0x38b045=this['voiceQueues'][_0x168f97];var _0x4d6233=![];var _0x449c7a=_0x3b86('0x1b');if(_0x38b045['mandatoryDisposition']){if(_0x38b045[_0x3b86('0x1c')][_0x3b86('0x1d')]){_0x4d6233=!![];_0x449c7a=_0x38b045[_0x3b86('0x1c')][_0x3b86('0x1d')];}}return ami['Action']({'action':_0x3b86('0x1e'),'interface':_0xeca1fd,'paused':!![],'reason':_0x449c7a})[_0x3b86('0x1f')](function(){if(_0x2927cf['agents'][_0xeca1fd]){return RpcUser[_0x3b86('0x20')](_0x2927cf[_0x3b86('0x6')][_0xeca1fd]['id'])[_0x3b86('0x1f')](function(_0xdc129){if(_0xdc129&&!_0xdc129[_0x3b86('0x21')]){logger[_0x3b86('0x22')](_0x3b86('0x23'),_0x2fffe3,_0xeca1fd,_0x168f97);var _0x414fc7=_0x2927cf[_0x3b86('0x8')][_0x2fffe3]['attended']&&_0x2927cf['channels'][_0x2fffe3][_0x3b86('0x24')]?_0x2927cf[_0x3b86('0x8')][_0x2fffe3][_0x3b86('0x24')]:_0x2fffe3;return RpcUser[_0x3b86('0x25')](_0x2927cf[_0x3b86('0x6')][_0xeca1fd],_0x449c7a,_0x414fc7)[_0x3b86('0x1f')](function(){if(!_0x4d6233){_0x2927cf['timers'][_0xeca1fd]={};logger[_0x3b86('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2fffe3,_0x2927cf[_0x3b86('0x5')][_0x168f97][_0x3b86('0x26')],_0xeca1fd,_0x168f97);_0x2927cf[_0x3b86('0x7')][_0xeca1fd]['timer']=setTimeout(_0x2927cf['stopAcw'][_0x3b86('0xe')](_0x2927cf,_0xeca1fd),_0x2927cf[_0x3b86('0x5')][_0x168f97][_0x3b86('0x26')]*0x3e8);_0x2927cf['timers'][_0xeca1fd]['lastPauseAt']=moment()['format'](_0x3b86('0x27'));_0x2927cf[_0x3b86('0x7')][_0xeca1fd][_0x3b86('0x28')]=_0x2fffe3;_0x2927cf[_0x3b86('0x7')][_0xeca1fd]['queue']=_0x168f97;_0x2927cf['timers'][_0xeca1fd][_0x3b86('0x29')]=function(){var _0x3de845=getDiff(_0x2927cf[_0x3b86('0x7')][_0xeca1fd][_0x3b86('0x2a')]);clearTimeout(_0x2927cf[_0x3b86('0x7')][_0xeca1fd]['timer']);_0x2927cf['timers'][_0xeca1fd][_0x3b86('0x2b')]=![];RpcVoiceAgentReport[_0x3b86('0x2c')]({'acwtime':_0x3de845},_0x2927cf[_0x3b86('0x7')][_0xeca1fd][_0x3b86('0x28')],_0xeca1fd)[_0x3b86('0x1f')](function(_0x46ad49){logger[_0x3b86('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x2fffe3,_0x3de845,_0x46ad49);})[_0x3b86('0x2d')](function(_0x363115){logger[_0x3b86('0x2e')](_0x3b86('0x2f'),_0x2fffe3,_0x363115);});delete _0x2927cf[_0x3b86('0x7')][_0xeca1fd];};}});}else{logger[_0x3b86('0x22')](_0x3b86('0x30'),_0x2fffe3,_0xeca1fd,_0x168f97);}});}})[_0x3b86('0x2d')](function(){logger[_0x3b86('0x2e')](_0x3b86('0x31'),_0x2fffe3,_0x2927cf[_0x3b86('0x5')][_0x168f97][_0x3b86('0x26')],_0xeca1fd,_0x168f97);})[_0x3b86('0x32')](function(){delete _0x2927cf[_0x3b86('0x8')][_0x2fffe3];});}catch(_0x4fa3eb){logger[_0x3b86('0x2e')]('[ACW][START]\x20%s',_0x4fa3eb[_0x3b86('0x33')]);}};Acw[_0x3b86('0x34')][_0x3b86('0x35')]=function(_0x556de8){try{var _0x3b48e1=this;if(_0x3b48e1[_0x3b86('0x7')][_0x556de8]){_0x3b48e1[_0x3b86('0x7')][_0x556de8][_0x3b86('0x2b')]=![];var _0x4973c3=_0x3b48e1[_0x3b86('0x7')][_0x556de8][_0x3b86('0x28')];var _0x1eaf86=_0x3b48e1['timers'][_0x556de8][_0x3b86('0x1a')];var _0xd9d94f=_0x3b48e1[_0x3b86('0x5')][_0x1eaf86][_0x3b86('0x26')];logger[_0x3b86('0x22')](_0x3b86('0x36'),_0x4973c3,_0x556de8);RpcUser[_0x3b86('0x37')](this['agents'][_0x556de8]);RpcVoiceAgentReport['update']({'acwtime':_0xd9d94f,'agentacw':!![]},_0x4973c3,_0x556de8)[_0x3b86('0x1f')](function(_0x5eea8b){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x4973c3,_0xd9d94f,_0x5eea8b);})[_0x3b86('0x2d')](function(_0x258500){logger[_0x3b86('0x2e')](_0x3b86('0x2f'),_0x4973c3,_0x258500);});}else{logger[_0x3b86('0x2e')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x556de8);if(_0x3b48e1['timers']){logger[_0x3b86('0x22')](_0x3b86('0x38'),JSON[_0x3b86('0x39')](_0x3b48e1[_0x3b86('0x7')]));}}}catch(_0x4adc4f){logger['error'](_0x3b86('0x3a'),_0x4adc4f['message']);}};Acw[_0x3b86('0x34')][_0x3b86('0xa')]=function(_0x539594){try{if(this[_0x3b86('0x5')][_0x539594[_0x3b86('0x1a')]]&&(this[_0x3b86('0x5')][_0x539594[_0x3b86('0x1a')]][_0x3b86('0x2')]||this[_0x3b86('0x5')][_0x539594[_0x3b86('0x1a')]][_0x3b86('0x3b')])){if(this[_0x3b86('0x6')][_0x539594[_0x3b86('0x19')]]){this[_0x3b86('0x8')][_0x539594[_0x3b86('0x28')]]={'queue':_0x539594[_0x3b86('0x1a')],'interface':_0x539594['interface'],'destlinkedid':_0x539594[_0x3b86('0x24')]};}}}catch(_0x53cdc8){logger[_0x3b86('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x53cdc8[_0x3b86('0x33')]);}};Acw[_0x3b86('0x34')][_0x3b86('0x14')]=function(_0xb287b){try{if(this[_0x3b86('0x5')][_0xb287b[_0x3b86('0x1a')]]&&(this[_0x3b86('0x5')][_0xb287b['queue']][_0x3b86('0x2')]||this[_0x3b86('0x5')][_0xb287b['queue']]['mandatoryDisposition'])){if(this[_0x3b86('0x6')][_0xb287b[_0x3b86('0x19')]]){this[_0x3b86('0x8')][_0xb287b[_0x3b86('0x28')]]={'queue':_0xb287b['queue'],'interface':_0xb287b[_0x3b86('0x19')]};}}}catch(_0x4c36d1){logger[_0x3b86('0x2e')](_0x3b86('0x3c'),_0x4c36d1['message']);}};Acw[_0x3b86('0x34')]['syncHangupRequest']=function(_0xa509aa){try{if(this[_0x3b86('0x8')][_0xa509aa['uniqueid']]&&_[_0x3b86('0x3d')](this[_0x3b86('0x8')][_0xa509aa['uniqueid']][_0x3b86('0x3e')])){logger[_0x3b86('0x22')]('[%s][HANGUP:UNIQUEID]',_0xa509aa[_0x3b86('0x28')]);this[_0x3b86('0x18')](_0xa509aa[_0x3b86('0x28')]);}else if(this['channels'][_0xa509aa[_0x3b86('0x3f')]]&&_['isUndefined'](this[_0x3b86('0x8')][_0xa509aa['linkedid']][_0x3b86('0x3e')])){logger[_0x3b86('0x22')]('[%s][HANGUP:LINKEDID]',_0xa509aa[_0x3b86('0x3f')]);this[_0x3b86('0x18')](_0xa509aa[_0x3b86('0x3f')]);}}catch(_0x5eba6f){logger[_0x3b86('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x5eba6f[_0x3b86('0x33')]);}};Acw['prototype'][_0x3b86('0xd')]=function(_0x166f19){try{if(this[_0x3b86('0x8')][_0x166f19['uniqueid']]&&this[_0x3b86('0x8')][_0x166f19['uniqueid']][_0x3b86('0x3e')]){logger[_0x3b86('0x22')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x166f19[_0x3b86('0x28')]);this[_0x3b86('0x18')](_0x166f19[_0x3b86('0x28')]);}else if(this[_0x3b86('0x8')][_0x166f19['linkedid']]&&this['channels'][_0x166f19['linkedid']][_0x3b86('0x3e')]){logger['info'](_0x3b86('0x40'),_0x166f19[_0x3b86('0x3f')]);this['startAcw'](_0x166f19[_0x3b86('0x3f')]);}}catch(_0x494211){logger[_0x3b86('0x2e')](_0x3b86('0x41'),_0x494211[_0x3b86('0x33')]);}};Acw[_0x3b86('0x34')][_0x3b86('0x11')]=function(_0xc4a38a){try{if(!_[_0x3b86('0x42')](this[_0x3b86('0x8')][_0xc4a38a[_0x3b86('0x43')]])){this[_0x3b86('0x18')](_0xc4a38a[_0x3b86('0x43')]);if(this['channels'][_0xc4a38a[_0x3b86('0x44')]]){this[_0x3b86('0x8')][_0xc4a38a[_0x3b86('0x44')]][_0x3b86('0x3e')]=!![];this['channels'][_0xc4a38a[_0x3b86('0x45')]]=this[_0x3b86('0x8')][_0xc4a38a['secondtransfereruniqueid']];delete this[_0x3b86('0x8')][_0xc4a38a[_0x3b86('0x44')]];}}else if(!_['isNil'](this['channels'][_0xc4a38a[_0x3b86('0x45')]])){this[_0x3b86('0x18')](_0xc4a38a[_0x3b86('0x45')]);if(this['channels'][_0xc4a38a[_0x3b86('0x46')]]){this[_0x3b86('0x8')][_0xc4a38a['origtransfereruniqueid']][_0x3b86('0x3e')]=!![];this[_0x3b86('0x8')][_0xc4a38a[_0x3b86('0x43')]]=this[_0x3b86('0x8')][_0xc4a38a[_0x3b86('0x46')]];delete this['channels'][_0xc4a38a[_0x3b86('0x46')]];}}}catch(_0x5c1bec){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x5c1bec[_0x3b86('0x33')]);}};Acw[_0x3b86('0x34')][_0x3b86('0x47')]=function(_0x50999b){try{if(this['channels'][_0x50999b[_0x3b86('0x48')]]){logger[_0x3b86('0x22')](_0x3b86('0x49'),JSON[_0x3b86('0x39')](_0x50999b['transfereruniqueid']));this[_0x3b86('0x18')](_0x50999b[_0x3b86('0x48')]);}else if(this[_0x3b86('0x8')][_0x50999b['transfererlinkedid']]){logger['info'](_0x3b86('0x4a'),JSON[_0x3b86('0x39')](_0x50999b[_0x3b86('0x4b')]));this[_0x3b86('0x18')](_0x50999b[_0x3b86('0x4b')]);}}catch(_0x44a569){logger[_0x3b86('0x2e')](_0x3b86('0x4c'),_0x44a569[_0x3b86('0x33')]);}};Acw[_0x3b86('0x34')][_0x3b86('0x4d')]=function(_0x1fe3e7){try{if(this[_0x3b86('0x5')][_0x1fe3e7[_0x3b86('0x1a')]]&&this['voiceQueues'][_0x1fe3e7[_0x3b86('0x1a')]][_0x3b86('0x4e')]===_0x3b86('0x4f')){if(this['agents'][_0x1fe3e7[_0x3b86('0x19')]]){logger[_0x3b86('0x22')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1fe3e7[_0x3b86('0x28')],_0x1fe3e7[_0x3b86('0x19')],_0x1fe3e7[_0x3b86('0x1a')]);return RpcUser[_0x3b86('0x25')](this[_0x3b86('0x6')][_0x1fe3e7[_0x3b86('0x19')]],_0x3b86('0x50'),_0x1fe3e7[_0x3b86('0x28')]);}}}catch(_0x4851cf){logger['error'](_0x3b86('0x51'),_0x4851cf[_0x3b86('0x33')]);}};module[_0x3b86('0x52')]=Acw; \ No newline at end of file +var _0x9915=['Action','then','getAgent','voicePause','info','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','uniqueid','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','lodash','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','name'];(function(_0x345d8d,_0x5231e3){var _0x21ac5c=function(_0x24889d){while(--_0x24889d){_0x345d8d['push'](_0x345d8d['shift']());}};_0x21ac5c(++_0x5231e3);}(_0x9915,0x1c3));var _0x5991=function(_0x2995d5,_0x3fcdf9){_0x2995d5=_0x2995d5-0x0;var _0xe8296a=_0x9915[_0x2995d5];return _0xe8296a;};'use strict';var _=require(_0x5991('0x0'));var moment=require('moment');var ami=require(_0x5991('0x1'));var logger=require(_0x5991('0x2'))(_0x5991('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x5991('0x4'));function Acw(_0xead108){this[_0x5991('0x5')]=_0xead108[_0x5991('0x5')];this[_0x5991('0x6')]=_0xead108['agents'];this[_0x5991('0x7')]=_0xead108[_0x5991('0x7')];this['channels']={};ami['on'](_0x5991('0x8'),this[_0x5991('0x9')][_0x5991('0xa')](this));ami['on'](_0x5991('0xb'),this['syncHangupRequest'][_0x5991('0xa')](this));ami['on'](_0x5991('0xc'),this[_0x5991('0xd')][_0x5991('0xa')](this));ami['on'](_0x5991('0xe'),this[_0x5991('0xf')][_0x5991('0xa')](this));ami['on'](_0x5991('0x10'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0x5991('0x11')][_0x5991('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0x5991('0x12')]['bind'](this));}function getDiff(_0x249f5a){var _0x35c9f5=moment()[_0x5991('0x13')](0x0);var _0x1259d1=moment(_0x249f5a)[_0x5991('0x13')](0x0);return _0x35c9f5[_0x5991('0x14')](_0x1259d1,'seconds');}Acw[_0x5991('0x15')][_0x5991('0x16')]=function(_0x746839){try{var _0x3af616=this;var _0x3a4590=this[_0x5991('0x17')][_0x746839][_0x5991('0x18')];var _0x4b4be9=this[_0x5991('0x17')][_0x746839][_0x5991('0x19')];var _0x24d429=this['voiceQueues'][_0x4b4be9];var _0x553a5e=![];var _0x3749c5=_0x5991('0x1a');if(_0x24d429[_0x5991('0x1b')]){if(_0x24d429['mandatoryDispositionPause'][_0x5991('0x1c')]){_0x553a5e=!![];_0x3749c5=_0x24d429['mandatoryDispositionPause'][_0x5991('0x1c')];}}return ami[_0x5991('0x1d')]({'action':'QueuePause','interface':_0x3a4590,'paused':!![],'reason':_0x3749c5})[_0x5991('0x1e')](function(){if(_0x3af616[_0x5991('0x6')][_0x3a4590]){return RpcUser[_0x5991('0x1f')](_0x3af616[_0x5991('0x6')][_0x3a4590]['id'])[_0x5991('0x1e')](function(_0x3e6784){if(_0x3e6784&&!_0x3e6784[_0x5991('0x20')]){logger[_0x5991('0x21')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x746839,_0x3a4590,_0x4b4be9);var _0x58e99c=_0x3af616[_0x5991('0x17')][_0x746839]['attended']&&_0x3af616[_0x5991('0x17')][_0x746839][_0x5991('0x22')]?_0x3af616[_0x5991('0x17')][_0x746839][_0x5991('0x22')]:_0x746839;return RpcUser[_0x5991('0x23')](_0x3af616[_0x5991('0x6')][_0x3a4590],_0x3749c5,_0x58e99c)['then'](function(){if(!_0x553a5e){_0x3af616[_0x5991('0x7')][_0x3a4590]={};logger[_0x5991('0x21')](_0x5991('0x24'),_0x746839,_0x3af616[_0x5991('0x5')][_0x4b4be9][_0x5991('0x25')],_0x3a4590,_0x4b4be9);_0x3af616[_0x5991('0x7')][_0x3a4590]['timer']=setTimeout(_0x3af616[_0x5991('0x26')][_0x5991('0xa')](_0x3af616,_0x3a4590),_0x3af616[_0x5991('0x5')][_0x4b4be9][_0x5991('0x25')]*0x3e8);_0x3af616[_0x5991('0x7')][_0x3a4590][_0x5991('0x27')]=moment()[_0x5991('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x3af616[_0x5991('0x7')][_0x3a4590][_0x5991('0x29')]=_0x746839;_0x3af616[_0x5991('0x7')][_0x3a4590][_0x5991('0x19')]=_0x4b4be9;_0x3af616[_0x5991('0x7')][_0x3a4590][_0x5991('0x2a')]=function(){var _0x426ebf=getDiff(_0x3af616[_0x5991('0x7')][_0x3a4590]['lastPauseAt']);clearTimeout(_0x3af616['timers'][_0x3a4590][_0x5991('0x2b')]);_0x3af616['timers'][_0x3a4590][_0x5991('0x2b')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x426ebf},_0x3af616[_0x5991('0x7')][_0x3a4590][_0x5991('0x29')],_0x3a4590)[_0x5991('0x1e')](function(_0x1bb8af){logger[_0x5991('0x21')](_0x5991('0x2c'),_0x746839,_0x426ebf,_0x1bb8af);})[_0x5991('0x2d')](function(_0x2d5183){logger[_0x5991('0x2e')](_0x5991('0x2f'),_0x746839,_0x2d5183);});delete _0x3af616['timers'][_0x3a4590];};}});}else{logger[_0x5991('0x21')](_0x5991('0x30'),_0x746839,_0x3a4590,_0x4b4be9);}});}})[_0x5991('0x2d')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x746839,_0x3af616[_0x5991('0x5')][_0x4b4be9][_0x5991('0x25')],_0x3a4590,_0x4b4be9);})['finally'](function(){delete _0x3af616[_0x5991('0x17')][_0x746839];});}catch(_0x3c1f13){logger['error'](_0x5991('0x31'),_0x3c1f13[_0x5991('0x32')]);}};Acw[_0x5991('0x15')][_0x5991('0x26')]=function(_0x5da48b){try{var _0x221ed9=this;if(_0x221ed9[_0x5991('0x7')][_0x5da48b]){_0x221ed9[_0x5991('0x7')][_0x5da48b]['timer']=![];var _0x1a6476=_0x221ed9[_0x5991('0x7')][_0x5da48b][_0x5991('0x29')];var _0x599773=_0x221ed9[_0x5991('0x7')][_0x5da48b][_0x5991('0x19')];var _0x124419=_0x221ed9[_0x5991('0x5')][_0x599773]['acwTimeout'];logger[_0x5991('0x21')](_0x5991('0x33'),_0x1a6476,_0x5da48b);RpcUser['saveUnpause'](this[_0x5991('0x6')][_0x5da48b]);RpcVoiceAgentReport['update']({'acwtime':_0x124419,'agentacw':!![]},_0x1a6476,_0x5da48b)['then'](function(_0x3450ab){logger[_0x5991('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x1a6476,_0x124419,_0x3450ab);})[_0x5991('0x2d')](function(_0xe192ca){logger[_0x5991('0x2e')](_0x5991('0x2f'),_0x1a6476,_0xe192ca);});}else{logger['error'](_0x5991('0x34'),_0x5da48b);if(_0x221ed9[_0x5991('0x7')]){logger[_0x5991('0x21')](_0x5991('0x35'),JSON[_0x5991('0x36')](_0x221ed9['timers']));}}}catch(_0x1e85a8){logger[_0x5991('0x2e')](_0x5991('0x37'),_0x1e85a8[_0x5991('0x32')]);}};Acw[_0x5991('0x15')][_0x5991('0x9')]=function(_0x5cc43f){try{if(this[_0x5991('0x5')][_0x5cc43f['queue']]&&(this['voiceQueues'][_0x5cc43f[_0x5991('0x19')]][_0x5991('0x3')]||this['voiceQueues'][_0x5cc43f[_0x5991('0x19')]][_0x5991('0x1b')])){if(this[_0x5991('0x6')][_0x5cc43f[_0x5991('0x18')]]){this[_0x5991('0x17')][_0x5cc43f[_0x5991('0x29')]]={'queue':_0x5cc43f[_0x5991('0x19')],'interface':_0x5cc43f[_0x5991('0x18')],'destlinkedid':_0x5cc43f[_0x5991('0x22')]};}}}catch(_0x4e6d00){logger[_0x5991('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x4e6d00['message']);}};Acw[_0x5991('0x15')][_0x5991('0x12')]=function(_0x5dfcb2){try{if(this[_0x5991('0x5')][_0x5dfcb2[_0x5991('0x19')]]&&(this[_0x5991('0x5')][_0x5dfcb2[_0x5991('0x19')]][_0x5991('0x3')]||this['voiceQueues'][_0x5dfcb2[_0x5991('0x19')]]['mandatoryDisposition'])){if(this[_0x5991('0x6')][_0x5dfcb2[_0x5991('0x18')]]){this[_0x5991('0x17')][_0x5dfcb2[_0x5991('0x29')]]={'queue':_0x5dfcb2['queue'],'interface':_0x5dfcb2['interface']};}}}catch(_0x5c3bb4){logger[_0x5991('0x2e')](_0x5991('0x38'),_0x5c3bb4[_0x5991('0x32')]);}};Acw[_0x5991('0x15')]['syncHangupRequest']=function(_0x26ccfd){try{if(this['channels'][_0x26ccfd['uniqueid']]&&_[_0x5991('0x39')](this[_0x5991('0x17')][_0x26ccfd[_0x5991('0x29')]][_0x5991('0x3a')])){logger[_0x5991('0x21')]('[%s][HANGUP:UNIQUEID]',_0x26ccfd[_0x5991('0x29')]);this[_0x5991('0x16')](_0x26ccfd[_0x5991('0x29')]);}else if(this[_0x5991('0x17')][_0x26ccfd[_0x5991('0x3b')]]&&_['isUndefined'](this[_0x5991('0x17')][_0x26ccfd['linkedid']]['attended'])){logger[_0x5991('0x21')](_0x5991('0x3c'),_0x26ccfd[_0x5991('0x3b')]);this[_0x5991('0x16')](_0x26ccfd[_0x5991('0x3b')]);}}catch(_0x333dec){logger['error'](_0x5991('0x3d'),_0x333dec[_0x5991('0x32')]);}};Acw[_0x5991('0x15')][_0x5991('0xd')]=function(_0x53d9c2){try{if(this[_0x5991('0x17')][_0x53d9c2[_0x5991('0x29')]]&&this[_0x5991('0x17')][_0x53d9c2[_0x5991('0x29')]]['attended']){logger[_0x5991('0x21')](_0x5991('0x3e'),_0x53d9c2['uniqueid']);this[_0x5991('0x16')](_0x53d9c2['uniqueid']);}else if(this[_0x5991('0x17')][_0x53d9c2['linkedid']]&&this[_0x5991('0x17')][_0x53d9c2['linkedid']][_0x5991('0x3a')]){logger[_0x5991('0x21')](_0x5991('0x3f'),_0x53d9c2[_0x5991('0x3b')]);this[_0x5991('0x16')](_0x53d9c2[_0x5991('0x3b')]);}}catch(_0x527322){logger[_0x5991('0x2e')](_0x5991('0x40'),_0x527322[_0x5991('0x32')]);}};Acw[_0x5991('0x15')][_0x5991('0x41')]=function(_0x8a0e79){try{if(!_['isNil'](this['channels'][_0x8a0e79[_0x5991('0x42')]])){this[_0x5991('0x16')](_0x8a0e79[_0x5991('0x42')]);if(this[_0x5991('0x17')][_0x8a0e79[_0x5991('0x43')]]){this[_0x5991('0x17')][_0x8a0e79['secondtransfereruniqueid']][_0x5991('0x3a')]=!![];this[_0x5991('0x17')][_0x8a0e79[_0x5991('0x44')]]=this[_0x5991('0x17')][_0x8a0e79[_0x5991('0x43')]];delete this['channels'][_0x8a0e79['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x5991('0x17')][_0x8a0e79[_0x5991('0x44')]])){this['startAcw'](_0x8a0e79[_0x5991('0x44')]);if(this['channels'][_0x8a0e79['origtransfereruniqueid']]){this['channels'][_0x8a0e79['origtransfereruniqueid']]['attended']=!![];this[_0x5991('0x17')][_0x8a0e79[_0x5991('0x42')]]=this['channels'][_0x8a0e79['origtransfereruniqueid']];delete this[_0x5991('0x17')][_0x8a0e79[_0x5991('0x45')]];}}}catch(_0x7d6bd1){logger[_0x5991('0x2e')](_0x5991('0x46'),_0x7d6bd1[_0x5991('0x32')]);}};Acw[_0x5991('0x15')][_0x5991('0x11')]=function(_0x1312bf){try{if(this['channels'][_0x1312bf['transfereruniqueid']]){logger['info'](_0x5991('0x47'),JSON['stringify'](_0x1312bf[_0x5991('0x48')]));this['startAcw'](_0x1312bf[_0x5991('0x48')]);}else if(this[_0x5991('0x17')][_0x1312bf[_0x5991('0x49')]]){logger[_0x5991('0x21')](_0x5991('0x4a'),JSON['stringify'](_0x1312bf[_0x5991('0x49')]));this[_0x5991('0x16')](_0x1312bf[_0x5991('0x49')]);}}catch(_0x2295bb){logger['error'](_0x5991('0x4b'),_0x2295bb['message']);}};Acw[_0x5991('0x15')][_0x5991('0xf')]=function(_0x12d9f9){try{if(this[_0x5991('0x5')][_0x12d9f9['queue']]&&this[_0x5991('0x5')][_0x12d9f9[_0x5991('0x19')]][_0x5991('0x4c')]===_0x5991('0x4d')){if(this['agents'][_0x12d9f9[_0x5991('0x18')]]){logger[_0x5991('0x21')](_0x5991('0x4e'),_0x12d9f9['uniqueid'],_0x12d9f9[_0x5991('0x18')],_0x12d9f9[_0x5991('0x19')]);return RpcUser[_0x5991('0x23')](this[_0x5991('0x6')][_0x12d9f9[_0x5991('0x18')]],'Auto-Pause',_0x12d9f9[_0x5991('0x29')]);}}}catch(_0xb019c){logger[_0x5991('0x2e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0xb019c['message']);}};module[_0x5991('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index a8273ea..dcc2668 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 _0x9aab=['util','../../config/logger','ami','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','asterisk-manager','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9aab,0x1d2));var _0xb9aa=function(_0x232f4a,_0x589b01){_0x232f4a=_0x232f4a-0x0;var _0x2fd6f7=_0x9aab[_0x232f4a];return _0x2fd6f7;};'use strict';var Manager=require(_0xb9aa('0x0'));var BPromise=require(_0xb9aa('0x1'));var util=require(_0xb9aa('0x2'));var logger=require(_0xb9aa('0x3'))(_0xb9aa('0x4'));var config=require(_0xb9aa('0x5'));var ami=new Manager(config[_0xb9aa('0x6')][_0xb9aa('0x7')],config[_0xb9aa('0x6')]['ip'],config[_0xb9aa('0x6')][_0xb9aa('0x8')],config[_0xb9aa('0x6')]['password'],!![]);ami[_0xb9aa('0x9')]();ami[_0xb9aa('0xa')]=BPromise[_0xb9aa('0xb')](ami[_0xb9aa('0xc')]);function error(_0x1d88af){logger[_0xb9aa('0xd')](util[_0xb9aa('0xe')](_0xb9aa('0xf'),config[_0xb9aa('0x6')][_0xb9aa('0x8')],config['asterisk']['ip'],config['asterisk'][_0xb9aa('0x7')],util[_0xb9aa('0x10')](_0x1d88af,![],null)));}function close(){logger['error'](util[_0xb9aa('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xb9aa('0x6')]['username'],config[_0xb9aa('0x6')]['ip'],config[_0xb9aa('0x6')][_0xb9aa('0x7')]));}ami[_0xb9aa('0x11')]=function(){return function(){return ami[_0xb9aa('0xa')]({'action':_0xb9aa('0x12')});};};ami[_0xb9aa('0x13')]=function(){return function(){return ami[_0xb9aa('0xa')]({'action':_0xb9aa('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xb9aa('0xa')]({'action':_0xb9aa('0x15')});};};ami[_0xb9aa('0x16')]=function(){return function(){return ami[_0xb9aa('0xa')]({'action':_0xb9aa('0x17')});};};ami[_0xb9aa('0x18')]=function(){return function(){return ami[_0xb9aa('0xa')]({'action':_0xb9aa('0x19')});};};function connect(){logger[_0xb9aa('0x1a')](util['format'](_0xb9aa('0x1b'),config[_0xb9aa('0x6')][_0xb9aa('0x8')],config[_0xb9aa('0x6')]['ip'],config['asterisk'][_0xb9aa('0x7')]));ami[_0xb9aa('0x1c')](_0xb9aa('0xd'),error);ami[_0xb9aa('0x1c')](_0xb9aa('0x1d'),close);}ami['on'](_0xb9aa('0x1e'),connect);ami['on']('shutdown',function(_0x59c8be){logger[_0xb9aa('0x1a')](util['format'](_0xb9aa('0x1f'),config[_0xb9aa('0x6')][_0xb9aa('0x8')],config[_0xb9aa('0x6')]['ip'],config[_0xb9aa('0x6')][_0xb9aa('0x7')],util[_0xb9aa('0x10')](_0x59c8be,![],null)));});ami['on'](_0xb9aa('0x20'),function(){logger[_0xb9aa('0x1a')](util['format'](_0xb9aa('0x21'),config[_0xb9aa('0x6')]['username'],config[_0xb9aa('0x6')]['ip'],config[_0xb9aa('0x6')][_0xb9aa('0x7')]));return Promise[_0xb9aa('0x22')]()[_0xb9aa('0x23')](ami[_0xb9aa('0x11')]())[_0xb9aa('0x23')](ami[_0xb9aa('0x13')]())['then'](ami[_0xb9aa('0x24')]())[_0xb9aa('0x23')](ami[_0xb9aa('0x16')]())[_0xb9aa('0x23')](ami[_0xb9aa('0x18')]())[_0xb9aa('0x25')](function(_0x530b44){logger[_0xb9aa('0xd')](_0xb9aa('0x26'),util['inspect'](_0x530b44,{'showHidden':![],'depth':null}));});});ami[_0xb9aa('0x1c')](_0xb9aa('0xd'),error);ami[_0xb9aa('0x1c')](_0xb9aa('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0xbf5e=['util','../../config/logger','ami','../../config/environment','asterisk','username','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','asterisk-manager','bluebird'];(function(_0x4b3661,_0x1be781){var _0x582d0c=function(_0x1a1ee4){while(--_0x1a1ee4){_0x4b3661['push'](_0x4b3661['shift']());}};_0x582d0c(++_0x1be781);}(_0xbf5e,0x1df));var _0xebf5=function(_0x13368a,_0x385056){_0x13368a=_0x13368a-0x0;var _0x5620ae=_0xbf5e[_0x13368a];return _0x5620ae;};'use strict';var Manager=require(_0xebf5('0x0'));var BPromise=require(_0xebf5('0x1'));var util=require(_0xebf5('0x2'));var logger=require(_0xebf5('0x3'))(_0xebf5('0x4'));var config=require(_0xebf5('0x5'));var ami=new Manager(config[_0xebf5('0x6')]['port'],config['asterisk']['ip'],config[_0xebf5('0x6')][_0xebf5('0x7')],config['asterisk']['password'],!![]);ami[_0xebf5('0x8')]();ami[_0xebf5('0x9')]=BPromise[_0xebf5('0xa')](ami[_0xebf5('0xb')]);function error(_0x57cebd){logger[_0xebf5('0xc')](util['format'](_0xebf5('0xd'),config['asterisk'][_0xebf5('0x7')],config[_0xebf5('0x6')]['ip'],config[_0xebf5('0x6')][_0xebf5('0xe')],util['inspect'](_0x57cebd,![],null)));}function close(){logger[_0xebf5('0xc')](util[_0xebf5('0xf')](_0xebf5('0x10'),config['asterisk']['username'],config[_0xebf5('0x6')]['ip'],config['asterisk'][_0xebf5('0xe')]));}ami[_0xebf5('0x11')]=function(){return function(){return ami[_0xebf5('0x9')]({'action':_0xebf5('0x12')});};};ami[_0xebf5('0x13')]=function(){return function(){return ami[_0xebf5('0x9')]({'action':_0xebf5('0x14')});};};ami[_0xebf5('0x15')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xebf5('0x16')]=function(){return function(){return ami[_0xebf5('0x9')]({'action':'queuesummary'});};};ami[_0xebf5('0x17')]=function(){return function(){return ami[_0xebf5('0x9')]({'action':_0xebf5('0x18')});};};function connect(){logger[_0xebf5('0x19')](util['format'](_0xebf5('0x1a'),config[_0xebf5('0x6')][_0xebf5('0x7')],config['asterisk']['ip'],config[_0xebf5('0x6')][_0xebf5('0xe')]));ami[_0xebf5('0x1b')]('error',error);ami['once'](_0xebf5('0x1c'),close);}ami['on'](_0xebf5('0x1d'),connect);ami['on'](_0xebf5('0x1e'),function(_0x7d6d29){logger[_0xebf5('0x19')](util[_0xebf5('0xf')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xebf5('0x7')],config[_0xebf5('0x6')]['ip'],config[_0xebf5('0x6')]['port'],util[_0xebf5('0x1f')](_0x7d6d29,![],null)));});ami['on'](_0xebf5('0x20'),function(){logger[_0xebf5('0x19')](util['format'](_0xebf5('0x21'),config['asterisk'][_0xebf5('0x7')],config[_0xebf5('0x6')]['ip'],config[_0xebf5('0x6')][_0xebf5('0xe')]));return Promise[_0xebf5('0x22')]()['then'](ami[_0xebf5('0x11')]())[_0xebf5('0x23')](ami[_0xebf5('0x13')]())[_0xebf5('0x23')](ami[_0xebf5('0x15')]())[_0xebf5('0x23')](ami[_0xebf5('0x16')]())['then'](ami[_0xebf5('0x17')]())[_0xebf5('0x24')](function(_0xf054ec){logger['error']('[ami.js][fullybooted]',util[_0xebf5('0x1f')](_0xf054ec,{'showHidden':![],'depth':null}));});});ami[_0xebf5('0x1b')](_0xebf5('0xc'),error);ami[_0xebf5('0x1b')](_0xebf5('0x1c'),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 7221d00..8d960a8 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xb7e7[_0x298ed3];return _0x5aad28;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x597e38,_0x551ac2){var _0x5305d2=function(_0x47dc5e){while(--_0x47dc5e){_0x597e38['push'](_0x597e38['shift']());}};_0x5305d2(++_0x551ac2);}(_0xac4a,0x13f));var _0xaac4=function(_0x229bab,_0x26956b){_0x229bab=_0x229bab-0x0;var _0x13c179=_0xac4a[_0x229bab];return _0x13c179;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 63a99f8..ee73f2c 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 _0x1919=['calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','verifyAdditionalPhones','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','roundrobin','isNil','locked','stateinterface','rrmemory','paused','strategy','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','updateOriginated','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','callProgressDetecting','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','AMD','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnosuchnumberretry','countagentrejectretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','[syncHangupIvr]','queuesSummary','running','statusMessage','getQueueCampaignStatusMessage','available','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','sequence','[Dialer][checkChannel]','getVoiceQueueRtPauses','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','checkPreviewRecallReminder','handleIvr','actionOriginate','object','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','NONE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','Trunk','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','phone','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','createStateFinal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','talking','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalAnsweredCalls','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','outboundQueuePauses','floor','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','originated','temp','getContactDialerIvr','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','checkContactEmpty','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','timezones','then','indexOf','iftime\x20%s,%s','content','true','catch','all','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','uniqueid','ivr','YYYY-MM-DD\x20HH:mm:ss','queue','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','state','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]'];(function(_0x3efa00,_0x42c22e){var _0x33b53a=function(_0x2ce45c){while(--_0x2ce45c){_0x3efa00['push'](_0x3efa00['shift']());}};_0x33b53a(++_0x42c22e);}(_0x1919,0x14a));var _0x9191=function(_0x2dec16,_0x598b21){_0x2dec16=_0x2dec16-0x0;var _0x2b5e45=_0x1919[_0x2dec16];return _0x2b5e45;};'use strict';var util=require(_0x9191('0x0'));var _=require(_0x9191('0x1'));var uuid=require(_0x9191('0x2'));var moment=require(_0x9191('0x3'));var rr=require('rr');var Redis=require(_0x9191('0x4'));var utils=require(_0x9191('0x5'));var hopperUtils=require(_0x9191('0x6'));var ut=require('../preview/util/util');var config=require(_0x9191('0x7'));var logger=require(_0x9191('0x8'))(_0x9191('0x9'));var loggerBooked=require(_0x9191('0x8'))(_0x9191('0xa'));var loggerPredictive=require(_0x9191('0x8'))(_0x9191('0xb'));var loggerPredictiveCalls=require(_0x9191('0x8'))(_0x9191('0xc'));var loggerSyncQueueSummary=require(_0x9191('0x8'))('syncQueueSummary');var ami=require(_0x9191('0xd'));config[_0x9191('0xe')]=_[_0x9191('0xf')](config[_0x9191('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x9191('0x10'))(new Redis(config[_0x9191('0xe')]));var cmHopper=require(_0x9191('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x9191('0x12'));var Interval=require(_0x9191('0x13'));var Action=require(_0x9191('0x14'));var History=require('./models/history');var Final=require(_0x9191('0x15'));var AgentComplete=require(_0x9191('0x16'));var QueueCallerAbandon=require(_0x9191('0x17'));var Hangup=require(_0x9191('0x18'));var ipAgi=process[_0x9191('0x19')][_0x9191('0x1a')]||_0x9191('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9191('0x1c')][_0x9191('0x1d')]=function(_0x530ff2){this[_0x9191('0x1e')]=this['tail']?this[_0x9191('0x1e')][_0x9191('0x1f')](_0x530ff2):_0x530ff2();};function Dialer(_0x14f4be,_0x476e08){this['sequence']=new Sequence();this[_0x9191('0x20')]=_0x476e08;this[_0x9191('0x21')]=_0x14f4be[_0x9191('0x21')];this[_0x9191('0x22')]=_0x14f4be['campaigns'];this['agents']=_0x14f4be[_0x9191('0x23')];this[_0x9191('0x24')]=_0x14f4be[_0x9191('0x24')];this['maxNumberOriginate']=config[_0x9191('0x25')]||0x2;this[_0x9191('0x26')]={};this[_0x9191('0x27')]={};this[_0x9191('0x28')]={};this[_0x9191('0x29')]={};this[_0x9191('0x2a')]={};this['startPredictive']={};this['startProgressive']={};this[_0x9191('0x2b')]={};this[_0x9191('0x2c')]={};this[_0x9191('0x2d')]={};this['queuesSummary']={};ami['on'](_0x9191('0x2e'),this[_0x9191('0x2f')][_0x9191('0x30')](this));ami['on']('queuecallerabandon',this[_0x9191('0x31')][_0x9191('0x30')](this));ami['on'](_0x9191('0x32'),this[_0x9191('0x33')][_0x9191('0x30')](this));ami['on'](_0x9191('0x34'),this[_0x9191('0x35')][_0x9191('0x30')](this));ami['on'](_0x9191('0x36'),this[_0x9191('0x37')][_0x9191('0x30')](this));ami['on'](_0x9191('0x38'),this[_0x9191('0x39')][_0x9191('0x30')](this));ami['on'](_0x9191('0x3a'),this[_0x9191('0x3b')]['bind'](this));ami['on']('newexten',this[_0x9191('0x3c')]['bind'](this));ami['on'](_0x9191('0x3d'),this[_0x9191('0x3e')][_0x9191('0x30')](this));ami['on'](_0x9191('0x3f'),this[_0x9191('0x40')]['bind'](this));ami['on'](_0x9191('0x41'),this[_0x9191('0x42')][_0x9191('0x30')](this));this[_0x9191('0x43')]();this[_0x9191('0x44')]();RpcSetting[_0x9191('0x45')]()['then'](function(_0x59659c){previewRecallmeReminderInterval=_0x59659c[_0x9191('0x46')];});}function isNotNull(_0x292e08){return _0x292e08!==null&&!_[_0x9191('0x47')](_0x292e08);}function msgResponse(_0x3e515d,_0x51bb3e,_0x52286a){return{'action':_0x3e515d,'response':_0x51bb3e,'message':_0x52286a,'stack':_0x52286a};}function emit(_0x1ea081,_0x87fb1c,_0x365b63){io['to'](_0x1ea081)[_0x9191('0x48')](_0x87fb1c,_0x365b63);}function emitOutboundVoiceQueueSummary(_0x278780){if(_0x278780[_0x9191('0x49')]===_0x9191('0x4a')){logger[_0x9191('0x4b')](_0x9191('0x4c'),util['inspect'](_0x278780,{'showHidden':![],'depth':null}));emit(util[_0x9191('0x4d')]('voice:queue:%s',_0x278780[_0x9191('0x4e')]),_0x9191('0x4f'),_0x278780);}}function checkGetDataPredictive(_0x1f5be1){if(isNotNull(_0x1f5be1)&&!_[_0x9191('0x50')](_0x1f5be1)){loggerPredictive[_0x9191('0x51')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x9191('0x51')](_0x9191('0x52'),_0x1f5be1['predictiveIntervalTotalCalls']);loggerPredictive[_0x9191('0x51')](_0x9191('0x53'),_0x1f5be1['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x9191('0x51')](_0x9191('0x54'),_0x1f5be1[_0x9191('0x55')]);loggerPredictive[_0x9191('0x51')](_0x9191('0x56'),_0x1f5be1[_0x9191('0x57')]);loggerPredictive['info'](_0x9191('0x58'),_0x1f5be1['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f5be1[_0x9191('0x59')]);loggerPredictive['info'](_0x9191('0x5a'));if(_0x1f5be1[_0x9191('0x5b')]>0x0){if(!_[_0x9191('0x47')](_0x1f5be1['predictiveIntervalAvgTalktime'])&&_0x1f5be1['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x9191('0x51')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x9191('0x47')](_0x1f5be1[_0x9191('0x5c')])&&_0x1f5be1[_0x9191('0x5c')]>0x0){return!![];}loggerPredictive[_0x9191('0x51')](_0x9191('0x5d'));}else{loggerPredictive['info'](_0x9191('0x5e'));}}else{loggerPredictive[_0x9191('0x51')](_0x9191('0x5f'));}return![];}function mergeDataErlangB(_0x33bed8){return function(_0x3ef6b5){loggerPredictive[_0x9191('0x51')](_0x9191('0x60'));loggerPredictive['info'](_0x9191('0x61'),_0x3ef6b5['erlangCalls']);loggerPredictive[_0x9191('0x51')](_0x9191('0x62'),_0x3ef6b5['erlangCallToSecond']);loggerPredictive[_0x9191('0x51')](_0x9191('0x63'),_0x3ef6b5[_0x9191('0x64')]);loggerPredictive[_0x9191('0x51')](_0x9191('0x65'),_0x3ef6b5[_0x9191('0x66')]);loggerPredictive[_0x9191('0x51')](_0x9191('0x63'),_0x3ef6b5[_0x9191('0x64')]);loggerPredictive[_0x9191('0x51')](_0x9191('0x5a'));_[_0x9191('0x67')](_0x33bed8,_0x3ef6b5);};}function ifInterval(_0xedf059,_0x31a346){if(_['isUndefined'](_0x31a346)){return![];}return utils[_0x9191('0x68')](undefined,_0x31a346)<_0xedf059*0x3c;}function clearPredictiveAttributes(_0x535dd7){if(_0x535dd7['startProgressive']){_0x535dd7[_0x9191('0x69')]=undefined;loggerPredictive[_0x9191('0x4b')](_0x535dd7[_0x9191('0x4e')],'startProgressive\x20value\x20cleared');}if(_0x535dd7[_0x9191('0x6a')]){_0x535dd7[_0x9191('0x6a')]=undefined;loggerPredictive[_0x9191('0x4b')](_0x535dd7['name'],_0x9191('0x6b'));}if(_0x535dd7[_0x9191('0x6c')]){clearInterval(_0x535dd7['handlePredictive']);_0x535dd7[_0x9191('0x6c')]=undefined;loggerPredictive[_0x9191('0x4b')](_0x535dd7[_0x9191('0x4e')],_0x9191('0x6d'));}}function loggerCatchPredictive(_0x85f32c,_0x7060e5){return function(_0x35862b){loggerPredictive[_0x9191('0x6e')](_0x7060e5[_0x9191('0x4e')],_0x85f32c);loggerPredictive[_0x9191('0x6e')](_0x35862b[_0x9191('0x6f')]);clearPredictiveAttributes(_0x7060e5);};}function loggerCatch(_0x586247){return function(_0x16f7c6){logger['error'](_0x586247,util[_0x9191('0x70')](_0x16f7c6,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x335b7f,_0x4ad6de,_0x4a4068){return function(_0x172da2){utils['checkContactLowerLimitOriginate'](_0x4ad6de,_0x4a4068,0x0);logger[_0x9191('0x6e')](_0x335b7f,util['inspect'](_0x172da2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x452b90){return function(_0x41ab0d){if(isNotNull(_0x41ab0d)&&isNotNull(_0x41ab0d[0x0])){if(_0x41ab0d[0x0]['contactsRescheduled']>0x0){_0x452b90[_0x9191('0x71')]=utils[_0x9191('0x72')][_0x9191('0x73')];logger[_0x9191('0x51')](_0x9191('0x74')+_0x452b90[_0x9191('0x4e')],_0x41ab0d[0x0][_0x9191('0x75')],_0x9191('0x76'));}else{_0x452b90[_0x9191('0x71')]=utils[_0x9191('0x72')][_0x9191('0x77')];logger[_0x9191('0x51')](_0x9191('0x78')+_0x452b90['name']);}}};}function createObjHistory(_0x50fb35,_0x3c3e53,_0x19ec7c,_0x498dbe,_0x14c094){_0x50fb35[_0x9191('0x71')]=_0x19ec7c;var _0x425a58=new Action(_0x50fb35,_0x3c3e53);var _0x53be0c=new History(_0x425a58);_0x53be0c['state']=_0x498dbe;_0x53be0c[_0x9191('0x79')]=_0x14c094;_0x53be0c[_0x9191('0x7a')]=_0x425a58[_0x9191('0x7b')];return _0x53be0c;}function unlockQueueStatus(_0x3b2321,_0x456e3d){setTimeout(function(){if(_[_0x9191('0x47')](_0x3b2321[_0x9191('0x7c')])){loggerBooked[_0x9191('0x6e')]('[unlockQueueStatus][undefined]',_0x456e3d);}_0x3b2321[_0x9191('0x7c')]=!![];loggerBooked['info'](_0x9191('0x7d'),_0x456e3d,JSON[_0x9191('0x7e')](_[_0x9191('0x7f')](_0x3b2321,['name',_0x9191('0x7c')])));},0x1f3);}function checkInterval(_0x3f25b8){return function(){if(!isNotNull(_0x3f25b8[_0x9191('0x80')])){_0x3f25b8[_0x9191('0x71')]=utils[_0x9191('0x72')]['NULL_INTERVAL'];throw _0x3f25b8[_0x9191('0x4e')]+_0x9191('0x81');}if(!isNotNull(_0x3f25b8[_0x9191('0x80')][_0x9191('0x82')])){_0x3f25b8[_0x9191('0x71')]=utils[_0x9191('0x72')][_0x9191('0x83')];throw _0x3f25b8[_0x9191('0x4e')]+_0x9191('0x81');}if(!isNotNull(_['isEmpty'](_0x3f25b8[_0x9191('0x80')][_0x9191('0x82')]))){_0x3f25b8[_0x9191('0x71')]=utils[_0x9191('0x72')]['NULL_INTERVAL'];throw _0x3f25b8[_0x9191('0x4e')]+_0x9191('0x81');}};}function checkIsIVRCampaignActive(_0x40d5f1){return function(){if(!utils[_0x9191('0x84')](_0x40d5f1)){_0x40d5f1['message']=utils['CAMPAIGN_STATUS'][_0x9191('0x85')];throw _0x40d5f1[_0x9191('0x4e')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0xd9e058){if(utils[_0x9191('0x86')](_0xd9e058)){emit(util[_0x9191('0x4d')](_0x9191('0x87'),_0xd9e058[_0x9191('0x4e')]),_0x9191('0x88'),_0xd9e058);}}function loggerCatchQueueSummary(_0x24f814,_0x1a8e8f){return function(_0x48e6b1){clearPredictiveAttributes(_0x1a8e8f);emitCampaignSummary(_0x1a8e8f);loggerSyncQueueSummary[_0x9191('0x4b')](_0x24f814,util[_0x9191('0x70')](_0x48e6b1,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0xa1a98d){if(_0xa1a98d['sendMessageOneNotActive']){if(_0xa1a98d['originated']===0x0){_0xa1a98d[_0x9191('0x89')]=![];_0xa1a98d['message']=utils['CAMPAIGN_STATUS'][_0x9191('0x85')];loggerSyncQueueSummary['debug'](_0x9191('0x8a'),_0xa1a98d[_0x9191('0x4e')],'is\x20not\x20active');}else{_0xa1a98d['message']=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0x9191('0x4b')](_0x9191('0x8a'),_0xa1a98d[_0x9191('0x4e')],_0x9191('0x8b'));}emitCampaignSummary(_0xa1a98d);}}function myreject(_0xe9ff95){return function(_0x66d2e9){return _0xe9ff95(msgResponse('[ifTime][Action]',_0x9191('0x8c'),JSON[_0x9191('0x7e')](_0x66d2e9)));};}Dialer['prototype'][_0x9191('0x8d')]=function(_0x4ef449){return!_[_0x9191('0x47')](_0x4ef449)&&_0x4ef449&&!_[_0x9191('0x47')](_0x4ef449[_0x9191('0x4e')])&&!_[_0x9191('0x47')](_0x4ef449['active'])&&_0x4ef449[_0x9191('0x8e')]&&(this['trunks'][util[_0x9191('0x4d')](_0x9191('0x8f'),_0x4ef449['name'])][_0x9191('0x90')]===_0x9191('0x91')||this[_0x9191('0x24')][util[_0x9191('0x4d')](_0x9191('0x8f'),_0x4ef449[_0x9191('0x4e')])][_0x9191('0x90')]===_0x9191('0x92'));};Dialer[_0x9191('0x1c')]['checkIsTrunkReachable']=function(_0x49b8d7){var _0x47ab90=this;return function(){if(!_0x47ab90['isTrunkReachable'](_0x49b8d7['Trunk'])){if(!_0x47ab90[_0x9191('0x8d')](_0x49b8d7['TrunkBackup'])){_0x49b8d7[_0x9191('0x71')]=utils[_0x9191('0x72')][_0x9191('0x93')];throw _0x49b8d7[_0x9191('0x4e')]+_0x9191('0x94');}}};};Dialer[_0x9191('0x1c')][_0x9191('0x95')]=function(_0x380d1a,_0x1cf393,_0x3d520d,_0x75efd6){var _0x52bab8=this;return function(){var _0x26a3fc=!![];return _0x52bab8['ifTimeIvr'](_0x380d1a,_0x1cf393,_0x3d520d,_0x75efd6,_0x26a3fc);};};Dialer[_0x9191('0x1c')][_0x9191('0x96')]=function(_0x48c0f6,_0x3ab9a5,_0x43f0a1,_0x38f4d7){var _0x9b99ed=this;return function(){var _0x162bfa=![];return _0x9b99ed['ifTimeIvr'](_0x48c0f6[_0x9191('0x82')],_0x3ab9a5,_0x43f0a1,_0x38f4d7,_0x162bfa);};};Dialer[_0x9191('0x1c')][_0x9191('0x97')]=function(_0x285486,_0x112d90,_0x5a6cbb,_0x5b2f28,_0x525d36){var _0x1c54f8=[];return new Promise(function(_0x333bb4,_0x10527e){if(!isNotNull(_0x285486)){_0x5b2f28['message']=utils[_0x9191('0x72')][_0x9191('0x83')];return _0x10527e(msgResponse(_0x9191('0x98'),_0x9191('0x99'),_0x5a6cbb+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x285486)){_0x5b2f28['message']=utils[_0x9191('0x72')][_0x9191('0x9a')];return _0x10527e(msgResponse(_0x9191('0x98'),_0x9191('0x99'),_0x5a6cbb+_0x9191('0x9b')));}if(_0x112d90&&_[_0x9191('0x47')](config['timezones'][_0x112d90])){_0x5b2f28['message']=utils[_0x9191('0x72')][_0x9191('0x9c')];return _0x10527e(msgResponse(_0x9191('0x98'),_0x9191('0x99'),_0x5a6cbb+_0x9191('0x9d')+_0x112d90));}if(_[_0x9191('0x9e')](_0x285486)){for(var _0x2acc1c=0x0;_0x2acc1c<_0x285486[_0x9191('0x9f')];_0x2acc1c+=0x1){_0x1c54f8[_0x9191('0xa0')](ami[_0x9191('0xa1')]({'action':_0x9191('0xa2'),'command':util[_0x9191('0x4d')]('iftime\x20%s,%s',_0x285486[_0x2acc1c][_0x9191('0xa3')],!_['isUndefined'](config[_0x9191('0xa4')][_0x112d90])?_0x112d90:'')})[_0x9191('0xa5')](function(_0x5dbff3){return _0x5dbff3['content'][_0x9191('0xa6')]('true')>=0x0;})['catch'](myreject(_0x10527e)));}}else{_0x1c54f8[_0x9191('0xa0')](ami[_0x9191('0xa1')]({'action':_0x9191('0xa2'),'command':util['format'](_0x9191('0xa7'),_0x285486,!_[_0x9191('0x47')](config[_0x9191('0xa4')][_0x112d90])?_0x112d90:'')})[_0x9191('0xa5')](function(_0x355402){return _0x355402[_0x9191('0xa8')]['indexOf'](_0x9191('0xa9'))>=0x0;})[_0x9191('0xaa')](myreject(_0x10527e)));}Promise[_0x9191('0xab')](_0x1c54f8)[_0x9191('0xa5')](function(_0x308166){var _0x54c801=_['some'](_0x308166);if(_0x54c801){return _0x333bb4(_0x54c801);}else{_0x5b2f28[_0x9191('0x71')]=_0x525d36?utils['CAMPAIGN_STATUS'][_0x9191('0xac')]:utils[_0x9191('0x72')]['OVERTIME_INTERVAL'];return _0x10527e(msgResponse(_0x9191('0xad'),_0x9191('0x99'),_0x9191('0xae')+_0x525d36+'\x20'+_0x5a6cbb+_0x9191('0xaf')+util[_0x9191('0x70')](_0x285486,{'showHidden':![],'depth':null})+_0x9191('0xb0')+_0x112d90));}})[_0x9191('0xaa')](function(_0x20ed12){return _0x10527e(msgResponse(_0x9191('0x98'),'Failure',JSON[_0x9191('0x7e')](_0x20ed12)));});});};Dialer[_0x9191('0x1c')][_0x9191('0x43')]=function(){var _0x2edf64=this;return cmHopper[_0x9191('0xb1')]({'active':![]},{'where':{'active':!![]}})[_0x9191('0xa5')](function(){setInterval(function(){_0x2edf64[_0x9191('0xb2')]();},0x3e8);});};Dialer[_0x9191('0x1c')][_0x9191('0xb2')]=function(){var _0x980b72=this;var _0x20be0f;for(var _0x1157ea in this[_0x9191('0x22')]){if(typeof this[_0x9191('0x22')][_0x1157ea]!==_0x9191('0xb3')){_0x20be0f=this[_0x9191('0x22')][_0x1157ea];if(utils[_0x9191('0x86')](_0x20be0f)&&utils[_0x9191('0x84')](_0x20be0f)){_0x20be0f[_0x9191('0x89')]=!![];Promise[_0x9191('0xb4')]()['then'](checkIsIVRCampaignActive(_0x20be0f))['then'](checkInterval(_0x20be0f))[_0x9191('0xa5')](_0x980b72['checkIsTrunkReachable'](_0x20be0f))[_0x9191('0xa5')](_0x980b72[_0x9191('0x95')](_0x20be0f['dialGlobalInterval'],_0x20be0f[_0x9191('0xb5')],_0x20be0f[_0x9191('0x4e')],_0x20be0f))['then'](_0x980b72[_0x9191('0x96')](_0x20be0f[_0x9191('0x80')],_0x20be0f[_0x9191('0xb5')],_0x20be0f[_0x9191('0x4e')],_0x20be0f))['then'](_0x980b72[_0x9191('0xb6')](_0x20be0f))['catch'](loggerCatchQueueSummary(_0x9191('0xb7'),_0x20be0f));}else{notSendMessagesCampaign(_0x20be0f);}}}};Dialer[_0x9191('0x1c')][_0x9191('0xb8')]=function(_0x160081){if(_0x160081['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x160081);}switch(_0x160081[_0x9191('0xb9')]){case'progressive':this[_0x9191('0xba')](_0x160081,0x1);break;case _0x9191('0xbb'):this[_0x9191('0xba')](_0x160081,_0x160081['dialPowerLevel']);break;case _0x9191('0xb'):this[_0x9191('0xb')](_0x160081);break;case _0x9191('0xa'):this['handlePower'](_0x160081,0x1);break;default:logger[_0x9191('0x6e')](_0x9191('0xbc'),_0x160081[_0x9191('0x4e')],_0x9191('0xbd'));}};Dialer[_0x9191('0x1c')][_0x9191('0x98')]=function(_0x2f71c0,_0x32613d){var _0x3594e7=_0x2f71c0[_0x9191('0xb5')];var _0x5d16a2=_0x32613d?_0x2f71c0['dialGlobalInterval']:_0x2f71c0['Interval'][_0x9191('0x82')];logger[_0x9191('0xbe')](_0x9191('0xbf'),_0x5d16a2,_0x3594e7,_0x2f71c0['name'],util[_0x9191('0x4d')](_0x9191('0xc0'),_0x2f71c0['name'],_0x2f71c0['id']));var _0x5757cd=null;return Interval[_0x9191('0xc1')](_0x5d16a2,_0x3594e7)[_0x9191('0xa5')](function(_0x2787ab){if(_0x2787ab===!![]){return _0x2787ab;}else{_0x2f71c0[_0x9191('0x71')]=_0x32613d?utils[_0x9191('0x72')][_0x9191('0xac')]:utils[_0x9191('0x72')][_0x9191('0xc2')];_0x5757cd=msgResponse('[ifTime][promiseAll]',_0x9191('0x99'),'Global:\x20'+_0x32613d+'\x20'+_0x2f71c0[_0x9191('0x4e')]+_0x9191('0xaf')+util[_0x9191('0x70')](_0x5d16a2,{'showHidden':![],'depth':null})+_0x9191('0xb0')+_0x3594e7);}if(_0x5757cd!==null){logger[_0x9191('0xbe')](_0x9191('0xc3'),_0x5757cd);_0x5757cd[_0x9191('0xc4')]=_0x32613d;throw _0x5757cd;}})[_0x9191('0xaa')](function(_0x40ed2a){logger[_0x9191('0x6e')](_0x9191('0xc5'),_0x40ed2a);throw msgResponse(_0x9191('0xc6'),_0x9191('0x8c'),util[_0x9191('0x70')](_0x40ed2a,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x9191('0x2f')]=function(_0x2516ff){if(this[_0x9191('0x21')][_0x2516ff['queue']]){if(this['uniqueId'][_0x2516ff[_0x9191('0xc7')]]&&this['uniqueId'][_0x2516ff[_0x9191('0xc7')]][_0x9191('0x49')]!==_0x9191('0xc8')){this['updateOriginated'](this[_0x9191('0x21')][_0x2516ff['queue']]);this['uniqueId'][_0x2516ff[_0x9191('0xc7')]]['answertime']=moment()['format'](_0x9191('0xc9'));}}};Dialer[_0x9191('0x1c')][_0x9191('0x35')]=function(_0x2080a9){var _0x54cee6=this['uniqueId'][_0x2080a9[_0x9191('0xc7')]];if(this[_0x9191('0x21')][_0x2080a9[_0x9191('0xca')]]){if(_0x54cee6&&_0x54cee6[_0x9191('0x49')]!==_0x9191('0xc8')){delete this[_0x9191('0x29')][_0x2080a9[_0x9191('0xc7')]];this[_0x9191('0x21')][_0x2080a9[_0x9191('0xca')]]['outboundAnswerCallsDay']+=0x1;var _0xe0bcdb=new AgentComplete(_0x54cee6,_0x2080a9);if(_0x2080a9[_0x9191('0xcb')]===_0x9191('0xcc')){_0xe0bcdb['agiafterat']=this[_0x9191('0x21')][_0x2080a9[_0x9191('0xca')]][_0x9191('0xcd')]&&this[_0x9191('0x21')][_0x2080a9[_0x9191('0xca')]][_0x9191('0xce')]?moment()['format'](_0x9191('0xc9')):undefined;}hopperUtils['createHistory'](_0xe0bcdb)[_0x9191('0xaa')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x9191('0xcf')](_0xe0bcdb)['catch'](loggerCatch(_0x9191('0xd0')));}}};Dialer['prototype'][_0x9191('0x31')]=function(_0x2ea2f4){var _0xa4088b=this[_0x9191('0x29')][_0x2ea2f4[_0x9191('0xc7')]];var _0x317f1a=this;var _0x4e4b77=![];var _0x5230cf;var _0x5ad6e9;if(this[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]]){if(_0xa4088b&&_0xa4088b[_0x9191('0x49')]!==_0x9191('0xc8')){delete this[_0x9191('0x29')][_0x2ea2f4[_0x9191('0xc7')]];this['updateOriginated'](this[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]]);_0xa4088b['droptime']=moment()[_0x9191('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4105c6=new QueueCallerAbandon(_0xa4088b,_0x2ea2f4);if(utils[_0x9191('0x68')](_0xa4088b[_0x9191('0xd1')],_0xa4088b['responsetime'])>=_0xa4088b[_0x9191('0xd2')]){this[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]][_0x9191('0x55')]+=0x1;this[_0x9191('0x21')][_0x2ea2f4['queue']][_0x9191('0xd3')]+=0x1;this[_0x9191('0x21')][_0x2ea2f4['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4105c6[_0x9191('0xd4')]=0xa;_0x4105c6[_0x9191('0x79')]=_0x9191('0xd5');_0x4105c6[_0x9191('0xd6')]=_0x9191('0xd7');_0x4105c6[_0x9191('0xd8')]=this['voiceQueues'][_0x2ea2f4[_0x9191('0xca')]][_0x9191('0xcd')]?moment()['format'](_0x9191('0xc9')):undefined;_0x4105c6[_0x9191('0xd9')]+=0x1;_0x4105c6['countglobal']+=0x1;_0x5230cf=this[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]][_0x9191('0xda')];_0x5ad6e9=this[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]][_0x9191('0xdb')];hopperUtils['verifyAdditionalPhones'](_0x4105c6,_0x4105c6[_0x9191('0xd4')],_0xa4088b[_0x9191('0xdc')])[_0x9191('0xa5')](function(_0xe40d7d){_0x4e4b77=_0xe40d7d[_0x9191('0xdd')]==0x1;if(_0x4105c6[_0x9191('0xd9')]>=_0x317f1a[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]]['dialDropMaxRetry']){_0x317f1a[_0x9191('0xde')](_0x4105c6,_0xe40d7d[_0x9191('0xdd')]);}else{hopperUtils[_0x9191('0xdf')]({'active':![],'countdropretry':_0x4105c6[_0x9191('0xd9')],'scheduledat':moment()[_0x9191('0xe0')](_0x317f1a[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]]['dialDropRetryFrequency'],_0x9191('0xe1'))[_0x9191('0x4d')](_0x9191('0xc9')),'ContactId':_0xa4088b[_0x9191('0xe2')],'ListId':_0xa4088b[_0x9191('0xe3')],'VoiceQueueId':_0xa4088b[_0x9191('0xe4')]||undefined,'CampaignId':_0xa4088b[_0x9191('0xe5')]||undefined})[_0x9191('0xaa')](loggerCatch(_0x9191('0xe6')));var _0x14702a=new History(_0x4105c6);_0x14702a['state']=0xa;_0x14702a[_0x9191('0x79')]=_0x9191('0xd5');_0x14702a[_0x9191('0x7b')]=moment()['format'](_0x9191('0xc9'));_0x14702a[_0x9191('0x7a')]=_0x14702a[_0x9191('0x7b')];_0x14702a[_0x9191('0xe7')]=_0x4105c6['calleridname'];_0x14702a[_0x9191('0xe8')]=_0x4105c6['calleridnum'];hopperUtils[_0x9191('0xe9')](_0x14702a)[_0x9191('0xaa')](loggerCatch(_0x9191('0xea')));}})[_0x9191('0xa5')](function(){if(_0x4e4b77)hopperUtils[_0x9191('0xeb')](_0x4105c6,_0x5230cf,_0x5ad6e9)[_0x9191('0xa5')](function(){return 0x1;});});}else{this[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]][_0x9191('0x57')]+=0x1;this[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]][_0x9191('0xec')]+=0x1;_0x4105c6[_0x9191('0xd4')]=0xb;_0x4105c6['statedesc']=_0x9191('0xed');_0x4105c6[_0x9191('0xd6')]=_0x9191('0xee');_0x4105c6[_0x9191('0xef')]+=0x1;_0x4105c6[_0x9191('0xf0')]+=0x1;_0x5230cf=this[_0x9191('0x21')][_0x2ea2f4['queue']]['dialAbandonedRetryFrequency'];_0x5ad6e9=this['voiceQueues'][_0x2ea2f4[_0x9191('0xca')]][_0x9191('0xdb')];hopperUtils[_0x9191('0xf1')](_0x4105c6,_0x4105c6['state'],_0xa4088b[_0x9191('0xdc')])[_0x9191('0xa5')](function(_0x5186e4){if(_0x4105c6['countabandonedretry']>=_0x317f1a['voiceQueues'][_0x2ea2f4[_0x9191('0xca')]]['dialAbandonedMaxRetry']){_0x317f1a['queueCallerAbandonCreateState'](_0x4105c6,_0x5186e4[_0x9191('0xdd')]);}else{hopperUtils[_0x9191('0xdf')]({'active':![],'countabandonedretry':_0x4105c6[_0x9191('0xef')],'scheduledat':moment()[_0x9191('0xe0')](_0x317f1a[_0x9191('0x21')][_0x2ea2f4[_0x9191('0xca')]][_0x9191('0xf2')],_0x9191('0xe1'))[_0x9191('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xa4088b[_0x9191('0xe2')],'ListId':_0xa4088b[_0x9191('0xe3')],'VoiceQueueId':_0xa4088b['VoiceQueueId']||undefined,'CampaignId':_0xa4088b[_0x9191('0xe5')]||undefined})[_0x9191('0xaa')](loggerCatch(_0x9191('0xf3')));var _0x5a23fe=new History(_0x4105c6);_0x5a23fe[_0x9191('0xd4')]=0xb;_0x5a23fe['statedesc']=_0x9191('0xed');_0x5a23fe[_0x9191('0x7b')]=moment()[_0x9191('0x4d')](_0x9191('0xc9'));_0x5a23fe['endtime']=_0x5a23fe[_0x9191('0x7b')];_0x5a23fe[_0x9191('0xe7')]=_0x4105c6[_0x9191('0xe7')];_0x5a23fe[_0x9191('0xe8')]=_0x4105c6[_0x9191('0xe8')];hopperUtils[_0x9191('0xe9')](_0x5a23fe)['catch'](loggerCatch(_0x9191('0xf4')));}})[_0x9191('0xa5')](function(){if(_0x4e4b77)hopperUtils[_0x9191('0xeb')](_0x4105c6,_0x5230cf,_0x5ad6e9)['then'](function(){return 0x1;});});}}}};Dialer[_0x9191('0x1c')][_0x9191('0x3c')]=function(_0x516e88){if(this[_0x9191('0x27')][_0x516e88[_0x9191('0xc7')]]){this[_0x9191('0x27')][_0x516e88[_0x9191('0xc7')]]['channel']=_0x516e88[_0x9191('0xf5')];}if(this[_0x9191('0x29')][_0x516e88[_0x9191('0xc7')]]){this[_0x9191('0x29')][_0x516e88[_0x9191('0xc7')]][_0x9191('0xf5')]=_0x516e88[_0x9191('0xf5')];}};Dialer[_0x9191('0x1c')][_0x9191('0x40')]=function(_0x31a146){if(!this[_0x9191('0x27')][_0x31a146['actionid']]){return;}var _0x4d445f=this[_0x9191('0x21')][this[_0x9191('0x27')][_0x31a146[_0x9191('0xf6')]]['queue']]['strategy']||'rrmemory';if(_0x4d445f===_0x9191('0xf7')){if(this[_0x9191('0x27')][_0x31a146[_0x9191('0xf6')]]&&_[_0x9191('0xf8')](this[_0x9191('0x27')][_0x31a146[_0x9191('0xf6')]][_0x9191('0xf9')])&&_0x31a146[_0x9191('0x90')]==='1'&&_0x31a146['paused']==='0'){if(this['agents'][_0x31a146['stateinterface']]){if(!this[_0x9191('0x23')][_0x31a146[_0x9191('0xfa')]][_0x9191('0xf9')]){this[_0x9191('0x23')][_0x31a146[_0x9191('0xfa')]][_0x9191('0xf9')]=!![];this[_0x9191('0x27')][_0x31a146[_0x9191('0xf6')]][_0x9191('0xf9')]=!![];this[_0x9191('0x27')][_0x31a146['actionid']][_0x9191('0xfa')]=_0x31a146['stateinterface'];}}}}else if(_0x4d445f===_0x9191('0xfb')){if(this[_0x9191('0x27')][_0x31a146[_0x9191('0xf6')]]){if(this['agents'][_0x31a146[_0x9191('0xfa')]]){this[_0x9191('0x27')][_0x31a146[_0x9191('0xf6')]][_0x9191('0xfa')]=_0x31a146[_0x9191('0xfa')];if(_[_0x9191('0xf8')](this[_0x9191('0x2c')][this['actions'][_0x31a146[_0x9191('0xf6')]][_0x9191('0xca')]])){this['queueBooked'][this['actions'][_0x31a146[_0x9191('0xf6')]][_0x9191('0xca')]]=[];}this['queueBooked'][this[_0x9191('0x27')][_0x31a146[_0x9191('0xf6')]]['queue']][_0x9191('0xa0')](_[_0x9191('0x67')](_[_0x9191('0x7f')](this[_0x9191('0x27')][_0x31a146[_0x9191('0xf6')]],['idHopper','stateinterface']),{'status':_0x31a146[_0x9191('0x90')],'paused':_0x31a146[_0x9191('0xfc')]}));}}}};Dialer[_0x9191('0x1c')][_0x9191('0x42')]=function(_0x4c5d07){if(!this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]]){return;}var _0xb76b64=this;var _0x443fe9=this[_0x9191('0x21')][this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xca')]];var _0x53f808=_0x443fe9[_0x9191('0xfd')]||_0x9191('0xfb');if(_0x53f808===_0x9191('0xf7')){if(this[_0x9191('0x27')][_0x4c5d07['actionid']]&&this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xfa')]){this['preview'][_0x9191('0xfe')](this[_0x9191('0x27')][_0x4c5d07['actionid']][_0x9191('0xff')],this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xfa')])[_0x9191('0xaa')](function(_0x2b5c13){logger[_0x9191('0x6e')](_0x9191('0x100'),util['inspect'](_0x2b5c13,{'showHidden':![],'depth':null}));})['finally'](function(){_0xb76b64['updateOriginated'](_0xb76b64[_0x9191('0x21')][_0xb76b64['actions'][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xca')]]);_0xb76b64[_0x9191('0x23')][_0xb76b64[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xfa')]][_0x9191('0xf9')]=![];delete _0xb76b64[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]];unlockQueueStatus(_0x443fe9);});}else{this['updateOriginated'](this['voiceQueues'][this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xca')]]);hopperUtils[_0x9191('0xdf')]({'active':![],'ContactId':this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xe2')],'ListId':this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xe3')],'VoiceQueueId':this['actions'][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xe4')]||undefined,'CampaignId':this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xe5')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x9191('0x27')][_0x4c5d07['actionid']];unlockQueueStatus(_0x443fe9);}}else if(_0x53f808===_0x9191('0xfb')){var _0x3d1b1e;if(this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]]&&!_['isEmpty'](this[_0x9191('0x2c')][this[_0x9191('0x27')][_0x4c5d07['actionid']][_0x9191('0xca')]])){if(this[_0x9191('0x2d')][_0xb76b64[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xca')]]){this['queueBookedRR'][_0xb76b64[_0x9191('0x27')][_0x4c5d07['actionid']][_0x9191('0xca')]]=this[_0x9191('0x2d')][this[_0x9191('0x27')][_0x4c5d07['actionid']][_0x9191('0xca')]]?this['queueBookedRR'][this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]]['queue']]:this[_0x9191('0x2c')][this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xca')]]?this[_0x9191('0x2c')][this['actions'][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xca')]][_0x9191('0x101')]||0x0:0x0;}this[_0x9191('0x2c')][this[_0x9191('0x27')][_0x4c5d07[_0x9191('0xf6')]][_0x9191('0xca')]][_0x9191('0x101')]=this[_0x9191('0x2d')][this['actions'][_0x4c5d07['actionid']]['queue']];for(var _0x59c1dc=0x0;_0x59c1dc=_0x215395[_0x9191('0x125')]){_0xf38f78['stateGlobal'](_0x2f0ee3,_0x2e0f2a,_0x174a2b,_0x9191('0x126'));}else{if(_0x2f0ee3[_0x9191('0x121')]>=_0x215395[_0x9191('0x127')]){_0xf38f78['createStateFinal'](_0x2f0ee3,_0x2e0f2a,_0x174a2b,_0x9191('0x128'));}else{hopperUtils[_0x9191('0xdf')]({'active':![],'countmachineretry':_0x2f0ee3['countmachineretry'],'scheduledat':moment()[_0x9191('0xe0')](_0x215395[_0x9191('0x129')],_0x9191('0xe1'))[_0x9191('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f0ee3['ContactId'],'ListId':_0x2f0ee3[_0x9191('0xe3')],'VoiceQueueId':_0x2f0ee3['VoiceQueueId']||undefined,'CampaignId':_0x2f0ee3[_0x9191('0xe5')]||undefined})[_0x9191('0xaa')](loggerCatch(_0x9191('0x12a')));_0x2e0f2a({'reschedule':0x1});}}});}if(_0x3cc7a0[_0x9191('0x49')]==='ivr'&&this['campaigns'][_0x3cc7a0[_0x9191('0xca')]]['dialAMDActive']&&_0x107bea[_0x9191('0x12b')]===_0x9191('0x114')){delete this[_0x9191('0x29')][_0x107bea[_0x9191('0xc7')]];this[_0x9191('0x105')](this[_0x9191('0x22')][_0x3cc7a0[_0x9191('0xca')]]);_0x2b3d4b=new Hangup(_0x3cc7a0,_0x107bea);_0x2b3d4b[_0x9191('0xd4')]=0x12;_0x2b3d4b['statedesc']=_0x9191('0x117');_0x2b3d4b[_0x9191('0x118')]=_0x9191('0x120');ami[_0x9191('0x48')](_0x9191('0x119'),ut[_0x9191('0x11a')](_0x2b3d4b,_0x9191('0x11b')));this[_0x9191('0x11c')](_0x2b3d4b,_0x9191('0x12c'),_0x9191('0x12d'));}if(_0x3cc7a0[_0x9191('0x49')]===_0x9191('0xc8')&&this[_0x9191('0x22')][_0x3cc7a0[_0x9191('0xca')]][_0x9191('0x113')]&&_0x107bea[_0x9191('0x12b')]==='MACHINE'){return new Promise(function(_0x4e5f2e,_0x5e5e46){delete _0xf38f78['uniqueId'][_0x107bea[_0x9191('0xc7')]];_0xf38f78[_0x9191('0x105')](_0xf38f78[_0x9191('0x22')][_0x3cc7a0['queue']]);_0xf38f78[_0x9191('0x22')][_0x3cc7a0[_0x9191('0xca')]][_0x9191('0x115')]+=0x1;_0xf38f78['campaigns'][_0x3cc7a0[_0x9191('0xca')]][_0x9191('0x116')]+=0x1;var _0x4864d1=_0xf38f78[_0x9191('0x22')][_0x3cc7a0[_0x9191('0xca')]];var _0x97bdad=new Hangup(_0x3cc7a0,_0x107bea);_0x97bdad[_0x9191('0xd4')]=0x13;_0x97bdad['statedesc']=_0x9191('0x11f');_0x97bdad[_0x9191('0x118')]=_0x9191('0x120');_0x97bdad[_0x9191('0x121')]+=0x1;_0x97bdad['countglobal']+=0x1;_0x97bdad[_0x9191('0x11b')]=!![];ami[_0x9191('0x48')](_0x9191('0x119'),ut[_0x9191('0x11a')](_0x97bdad,'amd'));hopperUtils[_0x9191('0xe9')](_0x97bdad)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x97bdad[_0x9191('0x123')]+_0x97bdad[_0x9191('0x124')]+_0x97bdad['countnoanswerretry']+_0x97bdad[_0x9191('0x12e')]+_0x97bdad[_0x9191('0xd9')]+_0x97bdad[_0x9191('0xef')]+_0x97bdad[_0x9191('0x121')]+_0x97bdad[_0x9191('0x12f')]>=_0x4864d1[_0x9191('0x125')]){_0xf38f78[_0x9191('0x130')](_0x97bdad,_0x4e5f2e,_0x5e5e46,_0x9191('0x126'));}else{if(_0x97bdad[_0x9191('0x121')]>=_0x4864d1[_0x9191('0x127')]){_0xf38f78['createStateFinal'](_0x97bdad,_0x4e5f2e,_0x5e5e46,_0x9191('0x128'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x97bdad[_0x9191('0x121')],'scheduledat':moment()[_0x9191('0xe0')](_0x4864d1[_0x9191('0x129')],_0x9191('0xe1'))[_0x9191('0x4d')](_0x9191('0xc9')),'ContactId':_0x97bdad[_0x9191('0xe2')],'ListId':_0x97bdad[_0x9191('0xe3')],'VoiceQueueId':_0x97bdad[_0x9191('0xe4')]||undefined,'CampaignId':_0x97bdad[_0x9191('0xe5')]||undefined})[_0x9191('0xaa')](loggerCatch(_0x9191('0x12a')));_0x4e5f2e({'reschedule':0x1});}}});}}};Dialer[_0x9191('0x1c')][_0x9191('0x3b')]=function(_0x10478b){var _0x534343=this[_0x9191('0x29')][_0x10478b['uniqueid']];var _0x154b4c;if(_0x534343&&_0x534343[_0x9191('0x49')]===_0x9191('0xc8')){delete this[_0x9191('0x29')][_0x10478b['uniqueid']];this[_0x9191('0x105')](this['campaigns'][_0x534343[_0x9191('0xca')]]);this[_0x9191('0x22')][_0x534343[_0x9191('0xca')]][_0x9191('0x131')]+=0x1;_0x154b4c=new Hangup(_0x534343,_0x10478b);hopperUtils['createHistory'](_0x154b4c)[_0x9191('0xaa')](loggerCatch(_0x9191('0x132')));hopperUtils[_0x9191('0xcf')](_0x154b4c)[_0x9191('0xaa')](loggerCatch('[syncHangupIvr]'));}if(_0x534343&&_0x534343[_0x9191('0x49')]!==_0x9191('0xc8')&&isNotNull(this[_0x9191('0x21')][_0x534343[_0x9191('0xca')]][_0x9191('0x133')])){delete this['uniqueId'][_0x10478b['uniqueid']];this[_0x9191('0x105')](this[_0x9191('0x21')][_0x534343[_0x9191('0xca')]]);this['voiceQueues'][_0x534343[_0x9191('0xca')]][_0x9191('0x115')]+=0x1;this[_0x9191('0x21')][_0x534343[_0x9191('0xca')]][_0x9191('0x116')]+=0x1;_0x154b4c=new Hangup(_0x534343,_0x10478b);_0x154b4c['state']=0x10;_0x154b4c['statedesc']=_0x9191('0x134');_0x154b4c[_0x9191('0x118')]=_0x9191('0x135');hopperUtils[_0x9191('0xe9')](_0x154b4c)[_0x9191('0xaa')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x9191('0xcf')](_0x154b4c)[_0x9191('0xaa')](loggerCatch('[syncHangupIvr]'));}if(_0x534343&&_0x534343[_0x9191('0x49')]!==_0x9191('0xc8')&&!isNotNull(this['voiceQueues'][_0x534343[_0x9191('0xca')]][_0x9191('0x133')])){delete this['uniqueId'][_0x10478b[_0x9191('0xc7')]];this[_0x9191('0x105')](this['voiceQueues'][_0x534343['queue']]);this[_0x9191('0x21')][_0x534343[_0x9191('0xca')]][_0x9191('0x136')]+=0x1;_0x154b4c=new Hangup(_0x534343,_0x10478b);_0x154b4c[_0x9191('0xd4')]=0xc;_0x154b4c['statedesc']=_0x10478b[_0x9191('0x137')];_0x154b4c[_0x9191('0x118')]=_0x9191('0x138');hopperUtils[_0x9191('0xe9')](_0x154b4c)[_0x9191('0xaa')](loggerCatch(_0x9191('0x132')));hopperUtils[_0x9191('0xcf')](_0x154b4c)['catch'](loggerCatch(_0x9191('0x139')));}};Dialer['prototype'][_0x9191('0x37')]=function(_0x1efa41){var _0x497dcb=this;if(!_0x497dcb[_0x9191('0x13a')][_0x1efa41[_0x9191('0x4e')]]){_0x497dcb['queuesSummary'][_0x1efa41['name']]={'running':![]};}else if(_0x497dcb[_0x9191('0x13a')][_0x1efa41[_0x9191('0x4e')]]['running']===!![]){return;}else if(_0x497dcb['queuesSummary'][_0x1efa41[_0x9191('0x4e')]][_0x9191('0x13b')]===![]){_0x497dcb['queuesSummary'][_0x1efa41[_0x9191('0x4e')]]['running']=!![];}var _0x625e94=_0x497dcb[_0x9191('0x21')][_0x1efa41[_0x9191('0x4e')]];var _0x5b9086=_0x625e94[_0x9191('0x71')]!==utils[_0x9191('0x72')][_0x9191('0x85')];var _0x19e1b3=utils['isPreviewCampaign'](_0x625e94);_0x625e94[_0x9191('0x13c')]=utils[_0x9191('0x13d')](_0x625e94,_0x497dcb['trunks']);Promise[_0x9191('0xb4')]()[_0x9191('0xa5')](function(){if(_0x625e94[_0x9191('0x13c')]===utils[_0x9191('0x72')][_0x9191('0x85')]){if(_0x5b9086){clearPredictiveAttributes(_0x625e94);_0x1efa41[_0x9191('0x6a')]=undefined;_0x1efa41[_0x9191('0x69')]=undefined;}if(_0x625e94[_0x9191('0x13c')]===utils[_0x9191('0x72')]['INACTIVE']){_0x1efa41[_0x9191('0x13e')]=0x0;_0x1efa41['paused']=0x0;_0x1efa41['inUse']=0x0;_0x1efa41['talking']=0x0;_0x1efa41[_0x9191('0x13f')]=0x0;}}else if(_0x625e94[_0x9191('0x13c')]===utils[_0x9191('0x72')][_0x9191('0x140')]&&!_0x19e1b3){return _0x497dcb[_0x9191('0x98')](_0x625e94,!![])[_0x9191('0xa5')](function(){return _0x497dcb[_0x9191('0x98')](_0x625e94,![]);})['then'](function(){return _0x497dcb[_0x9191('0xb8')](_0x625e94);})[_0x9191('0xaa')](function(_0x582e42){loggerSyncQueueSummary[_0x9191('0x4b')]('[syncQueueSummary]',util[_0x9191('0x70')](_0x582e42,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x625e94);});}else{clearPredictiveAttributes(_0x625e94);}})[_0x9191('0xa5')](function(){var _0x3a505b=_0x1efa41[_0x9191('0x141')](_0x625e94);if(_0x3a505b||_0x625e94[_0x9191('0x142')]){_0x625e94['queueSummaryCountersUpdated']=![];_0x1efa41[_0x9191('0x143')](_0x625e94);Object[_0x9191('0x144')](_0x625e94,_0x1efa41);emitOutboundVoiceQueueSummary(_0x1efa41);}_0x497dcb[_0x9191('0x13a')][_0x625e94[_0x9191('0x4e')]][_0x9191('0x13b')]=![];})[_0x9191('0xaa')](function(_0x4bac9c){logger[_0x9191('0x6e')](_0x9191('0x145'),util[_0x9191('0x70')](_0x4bac9c,{'showHidden':![],'depth':null}));_0x497dcb[_0x9191('0x13a')][_0x625e94['name']][_0x9191('0x13b')]=![];});};Dialer[_0x9191('0x1c')]['syncQueueSummaryComplete']=_[_0x9191('0x146')](function(){var _0x5eb62f=_[_0x9191('0x147')](this[_0x9191('0x21')],function(_0x1f8960){return _0x1f8960[_0x9191('0x148')];});var _0x37e3bf=_[_0x9191('0x147')](this['agents'],function(_0x28c1c3){return _0x28c1c3['online']&&_0x28c1c3[_0x9191('0x90')]===_0x9191('0x91');});if(_0x5eb62f[_0x9191('0x9f')]>0x0&&_0x37e3bf[_0x9191('0x9f')]>0x0){return Promise['resolve']()[_0x9191('0xa5')](cmHopper[_0x9191('0x149')](_['map'](_0x5eb62f,'id'),previewRecallmeReminderInterval,_[_0x9191('0x14a')](_0x37e3bf,'id')))[_0x9191('0xa5')](function(_0x5764e1){for(var _0x4be390=0x0;_0x4be390<_0x5764e1['length'];_0x4be390++){var _0x458027=_0x5764e1[_0x4be390][_0x9191('0x14b')][_0x9191('0x4e')];if(_0x458027)io['to'](util[_0x9191('0x4d')](_0x9191('0x14c'),_0x458027))[_0x9191('0x48')](_0x9191('0x14d'),{'hopper':_0x5764e1[_0x4be390]});}})[_0x9191('0xaa')](function(_0x1db0f0){logger[_0x9191('0x6e')]('checkPreviewRecallReminder',_0x1db0f0);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x9191('0x1c')][_0x9191('0x44')]=function(){var _0x3f5d92=this;setInterval(function(){_0x3f5d92['clearZombieChannels'](_0x3f5d92[_0x9191('0x29')],_0x9191('0x14e'));_0x3f5d92[_0x9191('0x14f')](_0x3f5d92[_0x9191('0x27')],_0x9191('0x150'));},0x32c8);};Dialer['prototype'][_0x9191('0x14f')]=function(_0x20e7ae,_0x3ca5fc){var _0x14ffc3=this;for(var _0x3c8080 in _0x20e7ae){if(typeof _0x20e7ae[_0x3c8080]!=='undefined'){this[_0x9191('0x151')][_0x9191('0x1d')](function(){if(!_[_0x9191('0xf8')](_0x20e7ae[_0x3c8080])){return ami['Action']({'action':_0x9191('0x90'),'channel':_0x20e7ae[_0x3c8080][_0x9191('0xf5')]})[_0x9191('0xaa')](function(_0x374a85){if(_0x374a85['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x20e7ae[_0x3c8080]&&_0x20e7ae[_0x3c8080]['type']!==_0x9191('0xc8')){_0x14ffc3['updateOriginated'](_0x14ffc3[_0x9191('0x21')][_0x20e7ae[_0x3c8080][_0x9191('0xca')]]);logger[_0x9191('0x6e')](_0x9191('0x152'),_0x3ca5fc,_0x3c8080,_0x20e7ae[_0x3c8080][_0x9191('0xca')]);delete _0x20e7ae[_0x3c8080];}if(_0x20e7ae[_0x3c8080]&&_0x20e7ae[_0x3c8080][_0x9191('0x49')]===_0x9191('0xc8')){_0x14ffc3['updateOriginated'](_0x14ffc3[_0x9191('0x22')][_0x20e7ae[_0x3c8080][_0x9191('0xca')]]);logger[_0x9191('0x6e')]('[Dialer][checkChannel][ivr]',_0x3ca5fc,_0x3c8080,_0x20e7ae[_0x3c8080][_0x9191('0xca')]);delete _0x20e7ae[_0x3c8080];}},0x2328);}});}});}}};Dialer[_0x9191('0x1c')][_0x9191('0x153')]=function(_0x5d3e55){return Promise[_0x9191('0xb4')]()[_0x9191('0xa5')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5d3e55))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0x9191('0x105')]=function(_0x4c1404){if(!_[_0x9191('0x47')](_0x4c1404)&&_0x4c1404!==null){if(typeof _0x4c1404['originated']!==_0x9191('0xb3')){if(_0x4c1404['originated']>0x0){_0x4c1404['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x9191('0x6e')](_0x9191('0x154'));}};Dialer[_0x9191('0x1c')][_0x9191('0x155')]=function(_0x2037e7,_0x5cbce8){var _0x23ef7d=this;return function(_0x530401){_0x23ef7d['updateOriginated'](_0x5cbce8);logger[_0x9191('0x6e')](_0x2037e7,util['inspect'](_0x530401,{'showHidden':![],'depth':null}));};};Dialer[_0x9191('0x1c')][_0x9191('0x156')]=function(_0x9766a0,_0x5cf529,_0x46b5f3){var _0x22b4dd={'state':0x19,'statedesc':_0x9191('0x157')};this['updateOriginated'](_0x5cf529);this[_0x9191('0x11c')](_['merge'](_0x22b4dd,_['pick'](_0x46b5f3,[_0x9191('0xe2'),_0x9191('0xe3'),_0x9191('0x158'),_0x9191('0xe4'),_0x9191('0xe5')])),_0x9191('0x159'),_0x9191('0x15a'));logger[_0x9191('0x6e')](_0x9766a0);};Dialer['prototype']['saveInDb']=function(_0x1f2a7a,_0x3fb081,_0x69cfdf){hopperUtils[_0x9191('0xe9')](_0x1f2a7a)['catch'](loggerCatch(_0x3fb081));hopperUtils[_0x9191('0xcf')](_0x1f2a7a)[_0x9191('0xaa')](loggerCatch(_0x69cfdf));};Dialer[_0x9191('0x1c')][_0x9191('0xde')]=function(_0x33e0c3,_0x1e0e15){hopperUtils[_0x9191('0xe9')](_0x33e0c3)['catch'](loggerCatch(_0x9191('0x15b')));if(_0x1e0e15==0x0){hopperUtils[_0x9191('0xcf')](_0x33e0c3)[_0x9191('0xaa')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x9191('0x1c')][_0x9191('0x15c')]=function(_0x28baac){return Promise[_0x9191('0xb4')]()[_0x9191('0xa5')](cmHopper[_0x9191('0x149')](_0x28baac['id'],previewRecallmeReminderInterval))[_0x9191('0xa5')](function(_0x1548ed){for(var _0x13e1e5=0x0;_0x13e1e5<_0x1548ed[_0x9191('0x9f')];_0x13e1e5++){var _0x36cb4=_0x1548ed[_0x13e1e5]['Agent']['name'];if(_0x36cb4)io['to'](util[_0x9191('0x4d')](_0x9191('0x14c'),_0x36cb4))[_0x9191('0x48')](_0x9191('0x14d'),{'hopper':_0x1548ed[_0x13e1e5]});}})[_0x9191('0xaa')](function(){});};Dialer[_0x9191('0x1c')][_0x9191('0xb6')]=function(_0x3d6aff){var _0xccc2aa=this;return function(){_0xccc2aa[_0x9191('0x15d')](_0x3d6aff);};};Dialer[_0x9191('0x1c')][_0x9191('0x15e')]=function(_0x4f943f,_0x5d3009){var _0x442640=this;var _0x44a275=uuid['v4']();this[_0x9191('0x27')][_0x44a275]=new Action(_0x4f943f,_0x5d3009,_0x44a275);return new Promise(function(_0xaf39fa,_0x1e2fed){if(_[_0x9191('0x47')](_0x4f943f)&&typeof _0x4f943f!==_0x9191('0x15f')){return _0x1e2fed(msgResponse(_0x9191('0x160'),_0x9191('0x99'),'voiceQueue\x20is\x20undefine'));}if(_[_0x9191('0x47')](_0x5d3009['phone'])||_0x5d3009['phone']===null){return _0x1e2fed(msgResponse(_0x9191('0x160'),_0x9191('0x99'),_0x9191('0x161')));}var _0x5cc397={'XMD-CALLERID':_0x442640[_0x9191('0x27')][_0x44a275][_0x9191('0x162')](),'XMD-AGI':_0x4f943f[_0x9191('0x133')]?util[_0x9191('0x4d')](_0x9191('0x163'),ipAgi,_0x4f943f[_0x9191('0x133')]):'NONE','XMD-AGIAFTER':_0x4f943f[_0x9191('0xcd')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4f943f[_0x9191('0xcd')]):'NONE','XMD-QUEUE':utils[_0x9191('0x164')](_0x4f943f)?util['format'](_0x9191('0x165'),_0x4f943f[_0x9191('0x4e')],_0x4f943f[_0x9191('0x166')]||'',_0x4f943f['dialAgiAfterHangupAgent']?'c':'',_0x4f943f['dialQueueTimeout']||0x3):_0x9191('0x167'),'XMD-CONTACTID':_0x5d3009['ContactId'],'XMD-CDRTYPE':_0x9191('0x9'),'CALLERID(all)':_0x442640[_0x9191('0x27')][_0x44a275][_0x9191('0x162')](),'XMD-AMD':_0x4f943f[_0x9191('0x113')]?_0x9191('0x140'):_0x9191('0x167'),'XMD-DESTINATION':_0x9191('0x112')};if(_0x4f943f[_0x9191('0x113')]){_0x5cc397[_0x9191('0x168')]=_0x4f943f[_0x9191('0x169')]||0x9c4;_0x5cc397['XMD-AMDGREETING']=_0x4f943f[_0x9191('0x16a')]||0x5dc;_0x5cc397[_0x9191('0x16b')]=_0x4f943f[_0x9191('0x16c')]||0x320;_0x5cc397[_0x9191('0x16d')]=_0x4f943f[_0x9191('0x16e')]||0x1388;_0x5cc397[_0x9191('0x16f')]=_0x4f943f[_0x9191('0x170')]||0x64;_0x5cc397['XMD-AMDBETWEENWORDSSILENCE']=_0x4f943f[_0x9191('0x171')]||0x32;_0x5cc397[_0x9191('0x172')]=_0x4f943f[_0x9191('0x173')]||0x3;_0x5cc397[_0x9191('0x174')]=_0x4f943f[_0x9191('0x175')]||0x100;_0x5cc397[_0x9191('0x176')]=_0x4f943f[_0x9191('0x177')]||0x1388;}if(utils[_0x9191('0x164')](_0x4f943f)){_0x5cc397[_0x9191('0x178')]=_0x5d3009[_0x9191('0xe4')];}else{_0x5cc397[_0x9191('0x179')]=_0x5d3009[_0x9191('0xe5')];}for(var _0x52ec6c in _0x5d3009[_0x9191('0x17a')]){if(typeof _0x5d3009[_0x9191('0x17a')][_0x52ec6c]!==_0x9191('0xb3')){if(isNotNull(_0x5d3009[_0x9191('0x17a')][_0x52ec6c])&&_0x52ec6c!=='id'&&_0x52ec6c!==_0x9191('0x17b')&&_0x52ec6c!=='createdAt'&&_0x52ec6c!==_0x9191('0x17c')){_0x5cc397[util[_0x9191('0x4d')](_0x9191('0x17d'),_0x9191('0x17e'),_[_0x9191('0x17f')](_0x52ec6c))]=_0x5d3009[_0x9191('0x17a')][_0x52ec6c];}}}var _0x1bc823=_0x442640['isTrunkReachable'](_0x4f943f[_0x9191('0x180')])?utils[_0x9191('0x181')](_0x4f943f[_0x9191('0x180')][_0x9191('0x182')],_0x4f943f['dialOriginateCallerIdName'],_0x4f943f[_0x9191('0x183')]>0x0?utils[_0x9191('0x184')](_0x4f943f[_0x9191('0x185')],_0x4f943f[_0x9191('0x183')]):_0x4f943f['dialOriginateCallerIdNumber']):utils[_0x9191('0x181')](_[_0x9191('0xf8')](_0x4f943f[_0x9191('0x186')])?_0x4f943f['Trunk'][_0x9191('0x182')]:_0x4f943f[_0x9191('0x186')]['callerid'],_0x4f943f['dialOriginateCallerIdName'],_0x4f943f[_0x9191('0x183')]>0x0?utils[_0x9191('0x184')](_0x4f943f[_0x9191('0x185')],_0x4f943f[_0x9191('0x183')]):_0x4f943f[_0x9191('0x185')]);if(_0x1bc823){_0x5cc397[_0x9191('0x187')]=_0x442640['actions'][_0x44a275][_0x9191('0x188')]=utils[_0x9191('0x189')](_0x1bc823);_0x5cc397['XMD-ORIGINATECALLERIDNUM']=_0x5d3009[_0x9191('0x18a')];}_0x4f943f['variables']=_0x5cc397;return ami['Action']({'actionid':_0x44a275,'action':_0x9191('0x160'),'channel':_0x442640[_0x9191('0x8d')](_0x4f943f[_0x9191('0x180')])?util['format'](_0x9191('0x18b'),_0x4f943f[_0x9191('0x180')][_0x9191('0x4e')],isNotNull(_0x4f943f['dialPrefix'])?_0x4f943f[_0x9191('0x18c')][_0x9191('0x18d')]()||'':'',_0x4f943f[_0x9191('0x18e')]>0x0?_0x5d3009[_0x9191('0x18a')]['substring'](_0x4f943f['dialCutDigit']):_0x5d3009['phone']):util['format']('SIP/%s/%s%s',_[_0x9191('0xf8')](_0x4f943f[_0x9191('0x186')])?_0x4f943f[_0x9191('0x180')][_0x9191('0x4e')]:_0x4f943f[_0x9191('0x186')]['name'],isNotNull(_0x4f943f[_0x9191('0x18c')])?_0x4f943f[_0x9191('0x18c')]['trim']()||'':'',_0x4f943f[_0x9191('0x18e')]>0x0?_0x5d3009[_0x9191('0x18a')][_0x9191('0x18f')](_0x4f943f[_0x9191('0x18e')]):_0x5d3009[_0x9191('0x18a')]),'callerid':_0x1bc823,'Exten':'xcally-motion-dialer','Context':_0x9191('0x190'),'Priority':'1','variable':_0x5cc397,'timeout':(_0x4f943f[_0x9191('0x191')]||0x1e)*0x3e8,'async':!![],'channelid':_0x44a275})[_0x9191('0xa5')](function(_0x34ff94){return _0xaf39fa(_0x34ff94);})['catch'](function(_0x32c08e){_0x4f943f[_0x9191('0x192')]+=0x1;var _0x35089d=new History(_0x442640[_0x9191('0x27')][_0x44a275]);logger[_0x9191('0x6e')](util['format']('[originateError]:\x20%s',JSON[_0x9191('0x7e')](_0x32c08e)));_0x35089d['state']=0xe;_0x35089d[_0x9191('0x79')]=_0x9191('0x193');_0x35089d[_0x9191('0x7b')]=moment()[_0x9191('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x35089d[_0x9191('0x7a')]=_0x35089d[_0x9191('0x7b')];hopperUtils[_0x9191('0xe9')](_0x35089d)[_0x9191('0xaa')](loggerCatch(_0x9191('0x194')));_0x442640[_0x9191('0xcf')](_0x35089d)[_0x9191('0xaa')](loggerCatch(_0x9191('0x194')))[_0x9191('0x1f')](function(){delete _0x442640['actions'][_0x44a275];return _0x1e2fed(msgResponse('originate',_0x9191('0x8c'),_0x9191('0x195')));});});});};Dialer['prototype'][_0x9191('0x196')]=function(_0x2c6c7e,_0x3224bc,_0x354d55){var _0x1d80aa=new History(_0x3224bc);if(_0x1d80aa[_0x9191('0x123')]+_0x1d80aa[_0x9191('0x124')]+_0x1d80aa[_0x9191('0x197')]+_0x1d80aa[_0x9191('0x12e')]+_0x1d80aa[_0x9191('0xd9')]+_0x1d80aa[_0x9191('0xef')]+_0x1d80aa['countmachineretry']+_0x1d80aa[_0x9191('0x12f')]>=_0x354d55[_0x9191('0x125')]-0x1){return!![];}switch(_0x2c6c7e){case 0x3:if(_0x1d80aa[_0x9191('0x197')]>=_0x354d55[_0x9191('0x198')]-0x1){return!![];}hopperUtils[_0x9191('0xdf')]({'active':![],'countnoanswerretry':_0x1d80aa['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x9191('0xe0')](_0x354d55['dialNoAnswerRetryFrequency'],_0x9191('0xe1'))[_0x9191('0x4d')](_0x9191('0xc9')),'ContactId':_0x1d80aa[_0x9191('0xe2')],'ListId':_0x1d80aa[_0x9191('0xe3')],'VoiceQueueId':_0x1d80aa[_0x9191('0xe4')]||undefined,'CampaignId':_0x1d80aa[_0x9191('0xe5')]||undefined})['catch'](loggerCatch(_0x9191('0x199')));break;case 0x5:if(_0x1d80aa[_0x9191('0x123')]>=_0x354d55[_0x9191('0x19a')]-0x1){return!![];}hopperUtils[_0x9191('0xdf')]({'active':![],'countbusyretry':_0x1d80aa[_0x9191('0x123')]+=0x1,'scheduledat':moment()['add'](_0x354d55[_0x9191('0x19b')],_0x9191('0xe1'))['format'](_0x9191('0xc9')),'ContactId':_0x1d80aa['ContactId'],'ListId':_0x1d80aa['ListId'],'VoiceQueueId':_0x1d80aa['VoiceQueueId']||undefined,'CampaignId':_0x1d80aa[_0x9191('0xe5')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x1d80aa[_0x9191('0x124')]>=_0x354d55[_0x9191('0x19c')]-0x1){return!![];}hopperUtils[_0x9191('0xdf')]({'active':![],'countcongestionretry':_0x1d80aa[_0x9191('0x124')]+=0x1,'scheduledat':moment()[_0x9191('0xe0')](_0x354d55[_0x9191('0x19d')],_0x9191('0xe1'))['format'](_0x9191('0xc9')),'ContactId':_0x1d80aa[_0x9191('0xe2')],'ListId':_0x1d80aa['ListId'],'VoiceQueueId':_0x1d80aa['VoiceQueueId']||undefined,'CampaignId':_0x1d80aa[_0x9191('0xe5')]||undefined})[_0x9191('0xaa')](loggerCatch(_0x9191('0x19e')));break;case 0x0:if(_0x1d80aa['countnosuchnumberretry']>=_0x354d55[_0x9191('0x19f')]-0x1){return!![];}else{hopperUtils[_0x9191('0xdf')]({'active':![],'countnosuchnumberretry':_0x1d80aa[_0x9191('0x12e')]+=0x1,'scheduledat':moment()['add'](_0x354d55['dialNoSuchNumberRetryFrequency'],_0x9191('0xe1'))[_0x9191('0x4d')](_0x9191('0xc9')),'ContactId':_0x1d80aa[_0x9191('0xe2')],'ListId':_0x1d80aa[_0x9191('0xe3')],'VoiceQueueId':_0x1d80aa[_0x9191('0xe4')]||undefined,'CampaignId':_0x1d80aa[_0x9191('0xe5')]||undefined})[_0x9191('0xaa')](loggerCatch(_0x9191('0x1a0')));}break;case 0xa:if(_0x1d80aa[_0x9191('0xd9')]>=_0x354d55[_0x9191('0x1a1')]-0x1){return!![];}hopperUtils[_0x9191('0xdf')]({'active':![],'countdropretry':_0x1d80aa['countdropretry']+=0x1,'scheduledat':moment()[_0x9191('0xe0')](_0x354d55[_0x9191('0xda')],_0x9191('0xe1'))[_0x9191('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d80aa['ContactId'],'ListId':_0x1d80aa[_0x9191('0xe3')],'VoiceQueueId':_0x1d80aa[_0x9191('0xe4')]||undefined,'CampaignId':_0x1d80aa[_0x9191('0xe5')]||undefined})[_0x9191('0xaa')](loggerCatch(_0x9191('0xe6')));break;case 0xb:if(_0x1d80aa['countabandonedretry']>=_0x354d55[_0x9191('0x1a2')]-0x1){return!![];}hopperUtils[_0x9191('0xdf')]({'active':![],'countabandonedretry':_0x1d80aa[_0x9191('0xef')]+=0x1,'scheduledat':moment()[_0x9191('0xe0')](_0x354d55[_0x9191('0xf2')],_0x9191('0xe1'))[_0x9191('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d80aa[_0x9191('0xe2')],'ListId':_0x1d80aa[_0x9191('0xe3')],'VoiceQueueId':_0x1d80aa[_0x9191('0xe4')]||undefined,'CampaignId':_0x1d80aa[_0x9191('0xe5')]||undefined})['catch'](loggerCatch(_0x9191('0xf3')));break;case 0x13:if(_0x1d80aa[_0x9191('0x121')]>=_0x354d55[_0x9191('0x127')]-0x1){return!![];}hopperUtils[_0x9191('0xdf')]({'active':![],'countmachineretry':_0x1d80aa[_0x9191('0x121')]+=0x1,'scheduledat':moment()[_0x9191('0xe0')](_0x354d55[_0x9191('0x129')],_0x9191('0xe1'))[_0x9191('0x4d')](_0x9191('0xc9')),'ContactId':_0x1d80aa[_0x9191('0xe2')],'ListId':_0x1d80aa['ListId'],'VoiceQueueId':_0x1d80aa[_0x9191('0xe4')]||undefined,'CampaignId':_0x1d80aa[_0x9191('0xe5')]||undefined})[_0x9191('0xaa')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x1d80aa['countagentrejectretry']>=_0x354d55['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x9191('0xdf')]({'active':![],'countagentrejectretry':_0x1d80aa['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x354d55[_0x9191('0x1a3')],_0x9191('0xe1'))[_0x9191('0x4d')](_0x9191('0xc9')),'ContactId':_0x1d80aa[_0x9191('0xe2')],'ListId':_0x1d80aa[_0x9191('0xe3')],'VoiceQueueId':_0x1d80aa[_0x9191('0xe4')]||undefined,'CampaignId':_0x1d80aa[_0x9191('0xe5')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x9191('0x1c')]['callProgressDetecting']=function(_0x31d353,_0x2eb370,_0x2d0b56){var _0x173b88=this;var _0x488b18=new History(_0x31d353);var _0x22eceb=![];var _0x5e0c55;var _0x421575;return new Promise(function(_0x332361,_0xbd1a7){if(_[_0x9191('0x47')](_0x2eb370)&&typeof _0x2eb370!==_0x9191('0x15f')){return _0xbd1a7(msgResponse(_0x9191('0x1a4'),_0x9191('0x99'),_0x9191('0x1a5')));}if(_[_0x9191('0x47')](_0x2d0b56)&&typeof _0x2d0b56!==_0x9191('0x15f')){return _0xbd1a7(msgResponse('[callProgressDetecting]','Failure',_0x9191('0x1a6')));}hopperUtils[_0x9191('0xf1')](_0x488b18,_0x2d0b56[_0x9191('0xcb')],_0x2eb370)[_0x9191('0xa5')](function(_0x12cb01){if(_0x12cb01[_0x9191('0xdd')]==0x1)_0x22eceb=!![];switch(_0x2d0b56[_0x9191('0xcb')]){case'0':_0x2eb370[_0x9191('0x1a7')]+=0x1;_0x488b18[_0x9191('0xd4')]=0x0;_0x488b18[_0x9191('0x79')]=_0x9191('0x1a8');_0x488b18['countnosuchnumberretry']+=0x1;_0x488b18[_0x9191('0xf0')]+=0x1;ami['emit'](_0x9191('0x1a9'),ut['buildObj'](_0x31d353,_0x9191('0x1aa')));_0x5e0c55=_0x2eb370[_0x9191('0x1ab')];_0x421575=_0x2eb370['callAdditionalPhoneAfterMin'];hopperUtils[_0x9191('0xe9')](_0x488b18)['catch'](loggerCatch(_0x9191('0x122')));if(_0x173b88['checkRetriveMax'](0x0,_0x31d353,_0x2eb370)&&!_0x22eceb){if(_0x488b18[_0x9191('0x12e')]>=_0x2eb370[_0x9191('0x19f')]){_0x173b88[_0x9191('0x1ac')](_0x488b18,_0x332361,_0xbd1a7,'reason\x200\x20no\x20such\x20number....');}else{_0x173b88['stateGlobal'](_0x488b18,_0x332361,_0xbd1a7,_0x9191('0x1ad'));}}break;case'3':_0x2eb370[_0x9191('0x1ae')]+=0x1;_0x488b18['state']=0x3;_0x488b18[_0x9191('0x79')]='NoAnswer';_0x488b18['countnoanswerretry']+=0x1;_0x488b18[_0x9191('0xf0')]+=0x1;var _0x51ae6a=ut[_0x9191('0x1af')](_0x31d353,_0x2eb370);ami[_0x9191('0x48')](_0x9191('0x1b0'),_0x51ae6a);_0x5e0c55=_0x2eb370[_0x9191('0x1b1')];_0x421575=_0x2eb370[_0x9191('0xdb')];hopperUtils['createHistory'](_0x488b18)[_0x9191('0xaa')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x173b88[_0x9191('0x196')](0x3,_0x31d353,_0x2eb370)&&!_0x22eceb){if(_0x488b18['countnoanswerretry']>=_0x2eb370[_0x9191('0x198')]){_0x173b88[_0x9191('0x1ac')](_0x488b18,_0x332361,_0xbd1a7,'reason\x203\x20ringing\x20no\x20answer');}else{_0x173b88[_0x9191('0x130')](_0x488b18,_0x332361,_0xbd1a7,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2eb370['outboundBusyCallsDay']+=0x1;_0x488b18[_0x9191('0xd4')]=0x5;_0x488b18[_0x9191('0x79')]='Busy';_0x488b18[_0x9191('0x123')]+=0x1;_0x488b18[_0x9191('0xf0')]+=0x1;ami[_0x9191('0x48')](_0x9191('0x1b2'),ut[_0x9191('0x11a')](_0x31d353,_0x9191('0x1b3')));_0x5e0c55=_0x2eb370[_0x9191('0x19b')];_0x421575=_0x2eb370[_0x9191('0xdb')];hopperUtils[_0x9191('0xe9')](_0x488b18)[_0x9191('0xaa')](loggerCatch(_0x9191('0x1b4')));if(_0x173b88[_0x9191('0x196')](0x5,_0x31d353,_0x2eb370)&&!_0x22eceb){if(_0x488b18['countbusyretry']>=_0x2eb370[_0x9191('0x19a')]){_0x173b88[_0x9191('0x1ac')](_0x488b18,_0x332361,_0xbd1a7,'reason\x205\x20busy');}else{_0x173b88['stateGlobal'](_0x488b18,_0x332361,_0xbd1a7,_0x9191('0x1b5'));}}break;case'8':_0x2eb370[_0x9191('0x1b6')]+=0x1;_0x488b18['state']=0x8;_0x488b18[_0x9191('0x79')]=_0x9191('0x1b7');_0x488b18[_0x9191('0x124')]+=0x1;_0x488b18[_0x9191('0xf0')]+=0x1;_0x5e0c55=_0x2eb370['dialCongestionRetryFrequency'];_0x421575=_0x2eb370[_0x9191('0xdb')];ami['emit'](_0x9191('0x1b8'),ut[_0x9191('0x11a')](_0x31d353,_0x9191('0x1b9')));hopperUtils[_0x9191('0xe9')](_0x488b18)[_0x9191('0xaa')](loggerCatch(_0x9191('0x1ba')));if(_0x173b88[_0x9191('0x196')](0x8,_0x31d353,_0x2eb370)&&!_0x22eceb){if(_0x488b18[_0x9191('0x124')]>=_0x2eb370[_0x9191('0x19c')]){_0x173b88[_0x9191('0x1ac')](_0x488b18,_0x332361,_0xbd1a7,_0x9191('0x1bb'));}else{_0x173b88[_0x9191('0x130')](_0x488b18,_0x332361,_0xbd1a7,_0x9191('0x1bb'));}}break;case'11':_0x2eb370[_0x9191('0x1bc')]+=0x1;_0x488b18[_0x9191('0xd4')]=0xb;_0x488b18[_0x9191('0x79')]=_0x9191('0xed');_0x488b18[_0x9191('0xef')]+=0x1;_0x488b18[_0x9191('0xf0')]+=0x1;_0x5e0c55=_0x2eb370[_0x9191('0xf2')];_0x421575=_0x2eb370['callAdditionalPhoneAfterMin'];hopperUtils[_0x9191('0xe9')](_0x488b18)['catch'](loggerCatch(_0x9191('0xf4')));if(_0x173b88[_0x9191('0x196')](0xb,_0x31d353,_0x2eb370)&&!_0x22eceb){if(_0x488b18[_0x9191('0xef')]>=_0x2eb370['dialAbandonedMaxRetry']){_0x173b88[_0x9191('0x1ac')](_0x488b18,_0x332361,_0xbd1a7,_0x9191('0x1bd'));}else{_0x173b88[_0x9191('0x130')](_0x488b18,_0x332361,_0xbd1a7,'reason\x2011\x20abandoned');}}break;case'20':_0x2eb370[_0x9191('0x1be')]+=0x1;_0x488b18[_0x9191('0xd4')]=0x14;_0x488b18['statedesc']=_0x9191('0x1bf');_0x488b18[_0x9191('0x12f')]+=0x1;_0x488b18[_0x9191('0xf0')]+=0x1;_0x5e0c55=_0x2eb370['dialAgentRejectRetryFrequency'];_0x421575=_0x2eb370[_0x9191('0xdb')];ami[_0x9191('0x48')]('custom:agentreject',ut[_0x9191('0x11a')](_0x31d353,_0x9191('0x1c0')));hopperUtils[_0x9191('0xe9')](_0x488b18)['catch'](loggerCatch(_0x9191('0x1c1')));if(_0x173b88[_0x9191('0x196')](0x14,_0x31d353,_0x2eb370)&&!_0x22eceb){if(_0x488b18[_0x9191('0x12f')]>=_0x2eb370[_0x9191('0x1c2')]){_0x173b88[_0x9191('0x1ac')](_0x488b18,_0x332361,_0xbd1a7,_0x9191('0x1c3'));}else{_0x173b88[_0x9191('0x130')](_0x488b18,_0x332361,_0xbd1a7,_0x9191('0x1c3'));}}break;default:_0x2eb370['outboundUnknownCallsDay']+=0x1;_0x488b18[_0x9191('0xd4')]=0xc;_0x488b18[_0x9191('0x79')]=_0x2d0b56['reason'];_0x5e0c55=_0x2eb370[_0x9191('0x1a3')];_0x421575=_0x2eb370[_0x9191('0xdb')];hopperUtils[_0x9191('0xe9')](_0x488b18)[_0x9191('0xaa')](loggerCatch(_0x9191('0x1c4')));if(_0x173b88['checkRetriveMax'](_0x2d0b56[_0x9191('0xcb')],_0x31d353,_0x2eb370)&&!_0x22eceb){if(_0x488b18['countbusyretry']+_0x488b18[_0x9191('0x124')]+_0x488b18[_0x9191('0x197')]+_0x488b18['countnosuchnumberretry']+_0x488b18[_0x9191('0xd9')]+_0x488b18[_0x9191('0xef')]+_0x488b18[_0x9191('0x121')]+_0x488b18[_0x9191('0x12f')]>=_0x2eb370[_0x9191('0x125')]){_0x173b88[_0x9191('0x130')](_0x488b18,_0x332361,_0xbd1a7,_0x2d0b56[_0x9191('0xcb')]);}else{_0x173b88['createStateFinal'](_0x488b18,_0x332361,_0xbd1a7,_0x2d0b56[_0x9191('0xcb')]);}}}})[_0x9191('0xa5')](function(){if(_0x22eceb){hopperUtils[_0x9191('0xeb')](_0x488b18,_0x5e0c55,_0x421575)['then'](function(){return _0x332361(0x1);});}});});};Dialer[_0x9191('0x1c')][_0x9191('0x130')]=function(_0x41a757,_0x4c0581,_0x1a9032,_0x266452){var _0x95abcb=new Final(_0x41a757);_0x95abcb[_0x9191('0xd4')]=0xf;_0x95abcb['statedesc']=_0x9191('0x1c5');this[_0x9191('0x1ac')](_0x95abcb,_0x4c0581,_0x1a9032,_0x266452);};Dialer['prototype']['createStateFinal']=function(_0x231b86,_0x3d3943,_0x2b0364,_0xd6b71c){hopperUtils[_0x9191('0xcf')](_0x231b86)[_0x9191('0xa5')](function(){return _0x3d3943(msgResponse('[callProgressDetecting]',_0x9191('0x1c6'),_0xd6b71c));})[_0x9191('0xaa')](function(){return _0x2b0364(msgResponse(_0x9191('0x1c7'),_0x9191('0x99'),_0x9191('0x1c8')));});};Dialer[_0x9191('0x1c')][_0x9191('0xb')]=function(_0x3a9510){var _0x17dad0=_0x3a9510[_0x9191('0x1c9')]/0x64;var _0x3c0294=_0x3a9510['outboundDropCallsDayTimeout']/(_0x3a9510[_0x9191('0xd3')]+_0x3a9510[_0x9191('0x115')]);var _0x1832e0=Math[_0x9191('0x1ca')](_0x3a9510[_0x9191('0x1cb')]*(_0x3a9510['predictiveIntervalMaxThreshold']/0x64));var _0x348b05=Math[_0x9191('0x1ca')](_0x3a9510[_0x9191('0x1cb')]*(_0x3a9510[_0x9191('0x1cc')]/0x64));var _0x33f592=_0x3a9510[_0x9191('0x13e')]+_0x3a9510[_0x9191('0x1cd')];var _0x1b8e53=Math['floor'](_0x3a9510[_0x9191('0x1ce')]*_0x3a9510[_0x9191('0x64')]*_0x3a9510[_0x9191('0x1cf')]*_0x3a9510['predictiveIntervalMultiplicativeFactor']);if(_[_0x9191('0x47')](_0x3a9510[_0x9191('0x69')])){if(!_[_0x9191('0x47')](_0x3a9510['startPredictive'])){_0x3a9510[_0x9191('0x6a')]=undefined;loggerPredictive[_0x9191('0x6e')](_0x9191('0x1d0'),_0x9191('0x1d1'));}if(!_[_0x9191('0x47')](_0x3a9510[_0x9191('0x6c')])){loggerPredictive[_0x9191('0x6e')](_0x9191('0x1d0'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3a9510[_0x9191('0x6c')]);_0x3a9510['handlePredictive']=undefined;}_0x3a9510[_0x9191('0x69')]=moment()[_0x9191('0x4d')](_0x9191('0xc9'));loggerPredictive['info'](_0x3a9510['name'],_0x9191('0x1d2'),_0x3a9510[_0x9191('0x69')]);this[_0x9191('0xba')](_0x3a9510,0x1);}else if(ifInterval(_0x3a9510[_0x9191('0x1d3')],_0x3a9510[_0x9191('0x69')])){this[_0x9191('0xba')](_0x3a9510,0x1);loggerPredictiveCalls[_0x9191('0x51')](_0x9191('0x1d4'),_0x3a9510[_0x9191('0x69')],_0x3a9510[_0x9191('0x4e')]);_0x3a9510[_0x9191('0x1ce')]=0x0;_0x3a9510[_0x9191('0x1d5')]=0x0;}else if(_0x17dad0<_0x3c0294&&_0x3a9510[_0x9191('0x1d6')]==='dropRate'){clearPredictiveAttributes(_0x3a9510);loggerPredictive[_0x9191('0x51')](_0x9191('0x1d7'),'Dropped\x20calls\x20day',_0x3c0294,_0x9191('0x69'),_0x3a9510[_0x9191('0x4e')]);}else if(_0x1b8e53<_0x3a9510[_0x9191('0x1d5')]&&_0x3a9510['dialPredictiveOptimization']===_0x9191('0x1d8')){clearPredictiveAttributes(_0x3a9510);loggerPredictive[_0x9191('0x51')](_0x9191('0x1d9'),_0x9191('0x1da'),_0x1b8e53,_0x9191('0x1db'),_0x3a9510['predictiveIntervalErlangCallsDroppedCalls'],_0x9191('0x69'),_0x3a9510[_0x9191('0x4e')]);}else if(!ifInterval(_0x3a9510[_0x9191('0x1d3')],_0x3a9510[_0x9191('0x69')])&&_[_0x9191('0x47')](_0x3a9510[_0x9191('0x6a')])&&!_[_0x9191('0x47')](_0x3a9510[_0x9191('0x69')])){_0x3a9510[_0x9191('0x6a')]=moment()['format'](_0x9191('0xc9'));loggerPredictive[_0x9191('0x51')](_0x3a9510[_0x9191('0x4e')],_0x9191('0x1dc'),_0x3a9510[_0x9191('0x6a')]);hopperUtils[_0x9191('0x1dd')](_0x3a9510[_0x9191('0x1d3')])[_0x9191('0xa5')](this[_0x9191('0x1de')](_0x3a9510))[_0x9191('0xa5')](mergeDataErlangB(_0x3a9510))['then'](this['startMethodPredictive'](_0x3a9510))[_0x9191('0xaa')](loggerCatchPredictive(_0x9191('0x1df'),_0x3a9510));}else if(!ifInterval(_0x3a9510[_0x9191('0x1d3')],_0x3a9510[_0x9191('0x6a')])){_0x3a9510[_0x9191('0x1d5')]=0x0;_0x3a9510[_0x9191('0x6a')]=moment()[_0x9191('0x4d')](_0x9191('0xc9'));loggerPredictive['info'](_0x3a9510[_0x9191('0x4e')],_0x9191('0x1e0'),_0x3a9510[_0x9191('0x6a')]);clearInterval(_0x3a9510[_0x9191('0x6c')]);_0x3a9510[_0x9191('0x6c')]=undefined;hopperUtils[_0x9191('0x1dd')](_0x3a9510[_0x9191('0x1d3')])[_0x9191('0xa5')](this[_0x9191('0x1de')](_0x3a9510))[_0x9191('0xa5')](mergeDataErlangB(_0x3a9510))[_0x9191('0xa5')](this[_0x9191('0x1e1')](_0x3a9510))[_0x9191('0xaa')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3a9510));}else if(_0x3a9510['predictiveIntervalAvailable']&&_0x33f592<_0x3a9510[_0x9191('0x1cb')]-_0x348b05){clearPredictiveAttributes(_0x3a9510);loggerPredictive[_0x9191('0x51')](_0x3a9510[_0x9191('0x4e')],_0x9191('0x1e2'),_0x33f592,_0x9191('0x1e3'),_0x3a9510[_0x9191('0x1cb')],'-',_0x348b05,'=',_0x3a9510['predictiveIntervalAvailable']-_0x348b05,')');}else if(_0x3a9510[_0x9191('0x1cb')]&&_0x33f592>_0x3a9510[_0x9191('0x1cb')]+_0x1832e0){clearPredictiveAttributes(_0x3a9510);loggerPredictive[_0x9191('0x51')](_0x3a9510[_0x9191('0x4e')],_0x9191('0x1e2'),_0x33f592,')\x20are\x20more\x20than\x20threshold\x20(',_0x3a9510[_0x9191('0x1cb')],'+',_0x1832e0,'=',_0x3a9510[_0x9191('0x1cb')]+_0x1832e0,')');}};Dialer[_0x9191('0x1c')][_0x9191('0x1de')]=function(_0x2cf22b){var _0x382447=this;return function(_0x3e4c6e){return new Promise(function(_0x3b1746,_0x286c32){_[_0x9191('0x67')](_0x2cf22b,_0x3e4c6e[0x0]);if(checkGetDataPredictive(_0x3e4c6e[0x0])){var _0x394880=_0x2cf22b[_0x9191('0x1cb')]=_0x2cf22b[_0x9191('0x1cd')]+_0x2cf22b['available'];var _0x22b12a=_0x2cf22b[_0x9191('0x1d3')]*0x3c;var _0x427439=_0x3e4c6e[0x0][_0x9191('0x59')]+_0x3e4c6e[0x0]['predictiveIntervalAvgHoldtime'];var _0x2e0736=(_0x3e4c6e[0x0]['predictiveIntervalAnsweredCalls']+_0x3e4c6e[0x0][_0x9191('0x55')]+_0x3e4c6e[0x0][_0x9191('0x57')])/_0x3e4c6e[0x0][_0x9191('0x5b')];_0x2cf22b[_0x9191('0x1cf')]=_0x2e0736>0x0?_0x2e0736:0x1;switch(_0x2cf22b[_0x9191('0x1d6')]){case _0x9191('0x1d8'):var _0x58ae14=_0x2cf22b[_0x9191('0x1c9')]/0x64;return _0x382447['abandonmentRate'](_0x394880,_0x22b12a,_0x427439,_0x2e0736,_0x58ae14)[_0x9191('0xa5')](function(_0x3be285){return _0x3b1746(_0x3be285);});case'agentBusyFactor':var _0x2af6b8=_0x2cf22b[_0x9191('0x1c9')]/0x64;return _0x382447[_0x9191('0x1e4')](_0x394880,_0x22b12a,_0x427439,_0x2e0736,_0x2af6b8)['then'](function(_0x174b27){return _0x3b1746(_0x174b27);});default:return _0x286c32(msgResponse(_0x9191('0x1e5'),_0x9191('0x99'),_0x9191('0x1e6')));}}else{return _0x286c32(msgResponse(_0x9191('0x1e5'),_0x9191('0x99'),_0x9191('0x1e7')));}});};};Dialer[_0x9191('0x1c')][_0x9191('0x1e8')]=function(_0xdbf965){var _0x47cb2a=this;return function(_0x1b2718){return new Promise(function(_0x259920,_0x5c9b5c){_['merge'](_0xdbf965,_0x1b2718[0x0]);if(checkGetDataPredictive(_0x1b2718[0x0])){loggerPredictive['info'](JSON[_0x9191('0x7e')](_0x1b2718[0x0]));if(_0xdbf965[_0x9191('0x1d6')]==='dropRate'){return _0x47cb2a[_0x9191('0x153')](_0xdbf965['id'])[_0x9191('0xa5')](function(_0x5c782c){var _0x1156d2=_0xdbf965[_0x9191('0x1e9')]-_0x5c782c[0x0]['outboundQueuePauses'];var _0x33e9fb=_0xdbf965['dialPredictiveInterval']*0x3c;var _0x5c8ea4=_0x1b2718[0x0]['predictiveIntervalAvgTalktime']+_0x1b2718[0x0][_0x9191('0x5c')];var _0x1be8bd=(_0x1b2718[0x0][_0x9191('0x1ea')]+_0x1b2718[0x0][_0x9191('0x55')]+_0x1b2718[0x0][_0x9191('0x57')])/_0x1b2718[0x0][_0x9191('0x5b')];var _0x513516=_0xdbf965[_0x9191('0x1c9')]/0x64;_0xdbf965[_0x9191('0x1eb')]=_0x5c782c[0x0]['outboundQueuePauses']||0x0;_0xdbf965[_0x9191('0x1cf')]=_0x1be8bd>0x0?_0x1be8bd:0x1;return _0x47cb2a['abandonmentRate'](_0x1156d2,_0x33e9fb,_0x5c8ea4,_0x1be8bd,_0x513516);})[_0x9191('0xa5')](function(_0x40699b){return _0x259920(_0x40699b);})[_0x9191('0xaa')](function(_0x3fa7ab){return _0x5c9b5c(msgResponse(_0x9191('0x1ec'),_0x9191('0x99'),JSON[_0x9191('0x7e')](_0x3fa7ab)));});}if(_0xdbf965['dialPredictiveOptimization']===_0x9191('0x1ed')){return _0x47cb2a[_0x9191('0x153')](_0xdbf965['id'])[_0x9191('0xa5')](function(_0x470687){var _0xd82e4f=_0xdbf965[_0x9191('0x1e9')]-_0x470687[0x0][_0x9191('0x1ee')];var _0x30cf05=_0xdbf965[_0x9191('0x1d3')]*0x3c;var _0x1fef60=_0x1b2718[0x0]['predictiveIntervalAvgTalktime']+_0x1b2718[0x0][_0x9191('0x5c')];var _0x3df2f3=(_0x1b2718[0x0][_0x9191('0x1ea')]+_0x1b2718[0x0][_0x9191('0x55')]+_0x1b2718[0x0][_0x9191('0x57')])/_0x1b2718[0x0][_0x9191('0x5b')];var _0xe2e507=_0xdbf965[_0x9191('0x1c9')]/0x64;_0xdbf965[_0x9191('0x1eb')]=_0x470687[0x0][_0x9191('0x1ee')]||0x0;_0xdbf965[_0x9191('0x1cf')]=_0x3df2f3>0x0?_0x3df2f3:0x1;return _0x47cb2a[_0x9191('0x1e4')](_0xd82e4f,_0x30cf05,_0x1fef60,_0x3df2f3,_0xe2e507);})['then'](function(_0x17975b){return _0x259920(_0x17975b);})[_0x9191('0xaa')](function(_0x20ea88){return _0x5c9b5c(msgResponse(_0x9191('0x1ec'),_0x9191('0x99'),JSON[_0x9191('0x7e')](_0x20ea88)));});}}else{return _0x5c9b5c(msgResponse(_0x9191('0x1e5'),'Failure',_0x9191('0x1e7')));}});};};Dialer['prototype'][_0x9191('0x1e1')]=function(_0x5303b0){var _0x3c657b=this;return function(){var _0x194569=0x0;var _0x12a1f8=Math[_0x9191('0x1ef')](_0x5303b0[_0x9191('0x1f0')]*0x3e8);if(_0x12a1f8>0x0){_0x12a1f8=_0x12a1f8<0x64?0x64:_0x12a1f8;loggerPredictive['info'](_0x5303b0[_0x9191('0x4e')],_0x9191('0x1f1'),_0x12a1f8,'milliseconds');_0x5303b0[_0x9191('0x6c')]=setInterval(function(){_0x3c657b['handlePredictive'](_0x5303b0);loggerPredictiveCalls[_0x9191('0x51')](_0x9191('0x1f2'),_0x194569+=0x1);},_0x12a1f8);}else{loggerPredictive['info'](_0x5303b0[_0x9191('0x4e')],_0x9191('0x1f3'));}};};Dialer[_0x9191('0x1c')][_0x9191('0x1f4')]=function(_0x32b857,_0x207692){var _0x4db3a5=this;return function(_0x1276da){if(_[_0x9191('0x50')](_0x1276da)){if(_['isNil'](_0x207692[_0x9191('0x158')])||!_0x207692[_0x9191('0x1f5')]){if(_0x32b857['dialMethod']===_0x9191('0xa')){_0x32b857[_0x9191('0x7c')]=_[_0x9191('0x47')](_0x32b857[_0x9191('0x7c')])?!![]:_0x32b857[_0x9191('0x7c')];var _0x6bbbaa=uuid['v4']();_0x4db3a5[_0x9191('0x27')][_0x6bbbaa]=new Action(_0x32b857,_0x207692,_0x6bbbaa);loggerBooked[_0x9191('0x51')](_0x9191('0x1f6'),_0x6bbbaa,_0x9191('0x1f7'),JSON[_0x9191('0x7e')](_0x32b857[_0x9191('0x7c')]),'Queue:\x20',_0x32b857[_0x9191('0x4e')]);if(_0x32b857[_0x9191('0x7c')]){_0x32b857['queueStatusComplete']=![];_0x4db3a5[_0x9191('0x2c')][_0x4db3a5[_0x9191('0x27')][_0x6bbbaa]['queue']]=[];ami[_0x9191('0xa1')]({'actionid':_0x6bbbaa,'action':_0x9191('0x1f8'),'queue':_0x32b857[_0x9191('0x4e')]})[_0x9191('0xaa')](function(){_0x4db3a5[_0x9191('0x105')](_0x32b857);hopperUtils[_0x9191('0xdf')]({'active':![],'ContactId':_0x4db3a5['actions'][_0x6bbbaa][_0x9191('0xe2')],'ListId':_0x4db3a5[_0x9191('0x27')][_0x6bbbaa][_0x9191('0xe3')],'VoiceQueueId':_0x4db3a5[_0x9191('0x27')][_0x6bbbaa][_0x9191('0xe4')]||undefined,'CampaignId':_0x4db3a5[_0x9191('0x27')][_0x6bbbaa]['CampaignId']||undefined})[_0x9191('0xaa')](loggerCatch(_0x9191('0x1f9')));delete _0x4db3a5[_0x9191('0x27')][_0x6bbbaa];});}else{loggerBooked[_0x9191('0x51')](_0x9191('0x1fa'),JSON[_0x9191('0x7e')](_0x32b857[_0x9191('0x7c')]),_0x9191('0x1fb'),_0x32b857[_0x9191('0x4e')]);_0x4db3a5[_0x9191('0x105')](_0x32b857);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4db3a5['actions'][_0x6bbbaa][_0x9191('0xe2')],'ListId':_0x4db3a5[_0x9191('0x27')][_0x6bbbaa][_0x9191('0xe3')],'VoiceQueueId':_0x4db3a5[_0x9191('0x27')][_0x6bbbaa][_0x9191('0xe4')]||undefined,'CampaignId':_0x4db3a5['actions'][_0x6bbbaa][_0x9191('0xe5')]||undefined})['catch'](loggerCatch(_0x9191('0x1f9')));delete _0x4db3a5[_0x9191('0x27')][_0x6bbbaa];}}else{return _0x4db3a5[_0x9191('0x15e')](_0x32b857,_0x207692);}}else{if(utils[_0x9191('0x68')](undefined,_0x207692['scheduledat'])<_0x32b857[_0x9191('0x1fc')]*0x3c){if(_0x207692['Agent']&&!_0x207692['Agent'][_0x9191('0x1fd')]){_0x4db3a5[_0x9191('0x20')][_0x9191('0xfe')](_0x207692['id'])[_0x9191('0x1f')](function(){_0x4db3a5['updateOriginated'](_0x32b857);});}else{hopperUtils['unlockContact']({'active':![]},_0x207692['id'],0x1)[_0x9191('0x1f')](function(){_0x4db3a5[_0x9191('0x105')](_0x32b857);});}}else{_0x32b857['outboundReCallsDay']+=0x1;_0x4db3a5[_0x9191('0x105')](_0x32b857);if(_0x32b857['dialRecallInQueue']){hopperUtils[_0x9191('0xdf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x207692[_0x9191('0xe2')],'ListId':_0x207692[_0x9191('0xe3')],'VoiceQueueId':_0x207692['VoiceQueueId']||undefined,'CampaignId':_0x207692[_0x9191('0xe5')]||undefined})[_0x9191('0xaa')](loggerCatch(_0x9191('0x1fe')));hopperUtils[_0x9191('0xe9')](createObjHistory(_0x32b857,_0x207692,utils[_0x9191('0x72')][_0x9191('0x1ff')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x9191('0x200')));}else{_0x4db3a5[_0x9191('0x11c')](createObjHistory(_0x32b857,_0x207692,utils[_0x9191('0x72')][_0x9191('0x201')],0x16,_0x9191('0x202')),_0x9191('0x203'),'[Originate][HistoryRecallClose]');}}}}else{_0x32b857[_0x9191('0x204')]+=0x1;_0x4db3a5['saveInDb'](createObjHistory(_0x32b857,_0x207692,utils[_0x9191('0x72')][_0x9191('0x205')],0xd,_0x9191('0x206')),'[Originate][historyBlacklist]',_0x9191('0x207'));throw _0x9191('0x208');}};};Dialer[_0x9191('0x1c')][_0x9191('0x15d')]=function(_0x33c13f){var _0x18229a=this;var _0x7554b7=_0x33c13f[_0x9191('0x209')]-_0x33c13f[_0x9191('0x20a')]-_0x33c13f['temp'];emitCampaignSummary(_0x33c13f);if(_0x7554b7>0x0){if(_0x7554b7>this['maxNumberOriginate']){_0x7554b7=this[_0x9191('0x25')];}_0x33c13f[_0x9191('0x20b')]+=_0x7554b7;hopperUtils[_0x9191('0x20c')](_0x33c13f['id'],_0x7554b7,_0x33c13f[_0x9191('0x20d')],_0x33c13f)['then'](function(_0x38de64){_0x33c13f[_0x9191('0x20b')]-=_0x7554b7;_0x33c13f['temp']=_0x33c13f[_0x9191('0x20b')]>0x0?_0x33c13f[_0x9191('0x20b')]:0x0;if(!utils['checkContactEmpty'](_0x38de64)){_0x33c13f[_0x9191('0x71')]=utils[_0x9191('0x72')]['NO_AVAILABLE_CONTACTS'];logger[_0x9191('0x51')]('[getContactCampaign2][Empty]'+_0x33c13f[_0x9191('0x4e')]);}else{_0x33c13f[_0x9191('0x20a')]+=_0x38de64[_0x9191('0x9f')];_0x33c13f['message']=utils[_0x9191('0x72')][_0x9191('0x20e')];for(var _0x3d9f29=0x0;_0x3d9f29<_0x38de64[_0x9191('0x9f')];_0x3d9f29+=0x1){_0x33c13f[_0x9191('0x20f')]+=0x1;if(_[_0x9191('0xf8')](_0x38de64[_0x3d9f29])||_['isNil'](_0x38de64[_0x3d9f29]['Contact'])||_[_0x9191('0xf8')](_0x38de64[_0x3d9f29][_0x9191('0x18a')])){_0x18229a['emptyContact'](_0x9191('0x210'),_0x33c13f,_0x38de64[_0x3d9f29]);}else{hopperUtils['checkIsBlackListIvr'](_['pick'](_0x38de64[_0x3d9f29],[_0x9191('0xe5'),'phone']))[_0x9191('0xa5')](_0x18229a[_0x9191('0x1f4')](_0x33c13f,_0x38de64[_0x3d9f29]))[_0x9191('0xaa')](_0x18229a['loggerHandler'](_0x9191('0x211'),_0x33c13f));}}}})[_0x9191('0xaa')](loggerGetContactDialer(_0x9191('0x212'),_0x33c13f,_0x7554b7));}};Dialer[_0x9191('0x1c')][_0x9191('0xba')]=function(_0x59b4c8,_0x4f62c3){var _0x51438c=this;var _0xb3e209=[];if(_0x4f62c3<0x1||_0x59b4c8[_0x9191('0xb9')]===_0x9191('0xa')){_0x4f62c3=0x1;}var _0x2e56c1=Math[_0x9191('0x1ef')](_0x59b4c8[_0x9191('0x13e')]*_0x4f62c3)-_0x59b4c8[_0x9191('0x20a')]-_0x59b4c8[_0x9191('0x20b')];if(_0x59b4c8[_0x9191('0x213')]>0x0){var _0x458767=_0x59b4c8['dialLimitQueue']-_0x59b4c8[_0x9191('0x20a')]-_0x59b4c8['talking']-_0x59b4c8['temp']-_0x59b4c8[_0x9191('0x13f')];if(_0x2e56c1>_0x458767){_0x2e56c1=_0x458767;}}if(_0x2e56c1>0x0){if(_0x59b4c8[_0x9191('0xb9')]===_0x9191('0xa')){_0x2e56c1=0x1;}if(_0x2e56c1>this[_0x9191('0x25')]){_0x2e56c1=this[_0x9191('0x25')];}_0x59b4c8[_0x9191('0x20b')]+=_0x2e56c1;for(var _0x24b60c in this['agents']){if(typeof this['agents'][_0x24b60c]!==_0x9191('0xb3')){if(this[_0x9191('0x23')][_0x24b60c][_0x9191('0xd4')]===_0x9191('0x214')&&this[_0x9191('0x23')][_0x24b60c][_0x9191('0x90')]===_0x9191('0x91')){_0xb3e209[_0x9191('0xa0')](this[_0x9191('0x23')][_0x24b60c]['id']);}}}hopperUtils['getContactDialer'](_0x59b4c8,_0xb3e209,_0x2e56c1)[_0x9191('0xa5')](function(_0x334271){_0x59b4c8[_0x9191('0x20b')]-=_0x2e56c1;_0x59b4c8['temp']=_0x59b4c8[_0x9191('0x20b')]>0x0?_0x59b4c8[_0x9191('0x20b')]:0x0;if(!utils['checkContactEmpty'](_0x334271)){hopperUtils[_0x9191('0x215')](_0x59b4c8)[_0x9191('0xa5')](sendMessageReschedule(_0x59b4c8))['catch'](loggerCatch(_0x9191('0x216')));}else{_0x59b4c8[_0x9191('0x20a')]+=_0x334271[_0x9191('0x9f')];_0x59b4c8[_0x9191('0x71')]=_0x59b4c8['dialMethod']===_0x9191('0xa')?utils[_0x9191('0x72')]['ACTIVE']:utils[_0x9191('0x72')][_0x9191('0x20e')];for(var _0x516f50=0x0;_0x516f50<_0x334271[_0x9191('0x9f')];_0x516f50+=0x1){if(_[_0x9191('0xf8')](_0x334271[_0x516f50])||_['isNil'](_0x334271[_0x516f50][_0x9191('0x17a')])||_[_0x9191('0xf8')](_0x334271[_0x516f50]['phone'])){_0x51438c[_0x9191('0x156')](_0x9191('0x210'),_0x59b4c8,_0x334271[_0x516f50]);}else{hopperUtils[_0x9191('0x217')](_[_0x9191('0x7f')](_0x334271[_0x516f50],[_0x9191('0xe4'),_0x9191('0x18a')]))[_0x9191('0xa5')](_0x51438c[_0x9191('0x1f4')](_0x59b4c8,_0x334271[_0x516f50]))[_0x9191('0xaa')](_0x51438c['loggerHandler'](_0x9191('0x210'),_0x59b4c8));}}}})['catch'](loggerGetContactDialer(_0x9191('0x218'),_0x59b4c8,_0x2e56c1));}};Dialer[_0x9191('0x1c')][_0x9191('0x6c')]=function(_0x34ab67){if(_0x34ab67[_0x9191('0x213')]>0x0){var _0x143b60=_0x34ab67['dialLimitQueue']-_0x34ab67[_0x9191('0x20a')]-_0x34ab67[_0x9191('0x1cd')];if(_0x143b60>0x0){this[_0x9191('0x219')](_0x34ab67);}else{loggerPredictiveCalls[_0x9191('0x51')](_0x9191('0x21a'));}}else{this[_0x9191('0x219')](_0x34ab67);}};Dialer[_0x9191('0x1c')][_0x9191('0x219')]=function(_0x508f65){var _0x36ef9c=this;var _0x58dd43=[];_0x508f65[_0x9191('0x20a')]+=0x1;for(var _0x2fa36b in this['agents']){if(typeof this[_0x9191('0x23')][_0x2fa36b]!=='undefined'){if(this[_0x9191('0x23')][_0x2fa36b][_0x9191('0xd4')]===_0x9191('0x214')&&this[_0x9191('0x23')][_0x2fa36b][_0x9191('0x90')]==='reachable'){_0x58dd43[_0x9191('0xa0')](this[_0x9191('0x23')][_0x2fa36b]['id']);}}}return this[_0x9191('0x21b')](_0x508f65['id'],_0x58dd43,0x1,_0x508f65[_0x9191('0x20d')],_0x508f65)['then'](function(_0x3560ba){if(!utils[_0x9191('0x21c')](_0x3560ba)){utils[_0x9191('0x21d')](_0x508f65,0x1,0x0);return hopperUtils[_0x9191('0x215')](_0x508f65)[_0x9191('0xa5')](sendMessageReschedule(_0x508f65))[_0x9191('0xaa')](loggerCatch('[countReScheduled]\x20'));}else{_0x508f65['message']=utils[_0x9191('0x72')][_0x9191('0x20e')];if(_['isNil'](_0x3560ba[0x0])||_[_0x9191('0xf8')](_0x3560ba[0x0]['Contact'])||_[_0x9191('0xf8')](_0x3560ba[0x0][_0x9191('0x18a')])){_0x36ef9c[_0x9191('0x156')](_0x9191('0x210'),_0x508f65,_0x3560ba[0x0]);}else{return hopperUtils[_0x9191('0x217')](_[_0x9191('0x7f')](_0x3560ba[0x0],['VoiceQueueId','phone']))['then'](_0x36ef9c[_0x9191('0x1f4')](_0x508f65,_0x3560ba[0x0]))[_0x9191('0xaa')](_0x36ef9c['loggerHandler'](_0x9191('0x21e'),_0x508f65));}}})[_0x9191('0xaa')](loggerGetContactDialer(_0x9191('0x21f'),_0x508f65,0x1));};Dialer[_0x9191('0x1c')][_0x9191('0x220')]=function(_0x557287,_0x5c27fb,_0x2d3d86,_0x3bb9cb,_0x595a9b,_0x2d71bf){loggerPredictive[_0x9191('0x51')](_0x9191('0x221'));loggerPredictive[_0x9191('0x51')]('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',_0x557287);loggerPredictive['info'](_0x9191('0x222'),_0x5c27fb);loggerPredictive[_0x9191('0x51')]('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',_0x2d3d86);loggerPredictive[_0x9191('0x51')](_0x9191('0x223'),_0x3bb9cb);loggerPredictive[_0x9191('0x51')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x595a9b);loggerPredictive['info'](_0x9191('0x5a'));return new Promise(function(_0x4e32f6,_0x285b01){if(_0x557287<=0x0||isNaN(_0x557287)){return _0x285b01(msgResponse(_0x9191('0x224'),_0x9191('0x8c'),_0x9191('0x225')+_0x557287));}if(_0x2d3d86<=0x0||isNaN(_0x2d3d86)){return _0x285b01(msgResponse(_0x9191('0x224'),_0x9191('0x8c'),'Ts\x20=\x20'+_0x2d3d86));}if(_0x3bb9cb<=0x0||isNaN(_0x3bb9cb)){return _0x285b01(msgResponse(_0x9191('0x224'),_0x9191('0x8c'),_0x9191('0x226')+_0x3bb9cb));}if(_0x5c27fb<=0x0||isNaN(_0x5c27fb)){return _0x285b01(msgResponse(_0x9191('0x224'),_0x9191('0x8c'),_0x9191('0x227')+_0x5c27fb));}if(_0x595a9b<=0x0||isNaN(_0x595a9b)){return _0x285b01(msgResponse(_0x9191('0x224'),_0x9191('0x8c'),'Amax\x20=\x20'+_0x595a9b));}_0x2d71bf=_0x2d71bf||0x0;var _0x56dd74=0x1/_0x2d3d86;var _0x3518ec=0x0;var _0x396c0d=0x0;var _0x45262d=0x0;var _0x1167b8=0x0;for(var _0x3a6118=0x0;_0x45262d<_0x595a9b;_0x3a6118+=0x1){_0x396c0d=_0x3a6118/_0x5c27fb;_0x3518ec=(_0x3bb9cb*_0x396c0d+_0x2d71bf)/_0x56dd74;_0x45262d=utils[_0x9191('0x228')](_0x3518ec,_0x557287);_0x1167b8=_0x3518ec/_0x557287*(0x1-utils[_0x9191('0x228')](_0x3518ec,_0x557287));}return _0x4e32f6({'erlangCalls':_0x3a6118,'erlangCallToSecond':_0x5c27fb/_0x3a6118,'erlangAbandonmentRate':_0x45262d,'erlangBusyFactor':_0x1167b8});});};Dialer[_0x9191('0x1c')][_0x9191('0x1e4')]=function(_0x122ce0,_0x1ce910,_0x739dd3,_0x8d9cdf,_0x446cb3,_0x58950b){loggerPredictive[_0x9191('0x51')](_0x9191('0x229'));loggerPredictive[_0x9191('0x51')](_0x9191('0x22a'),_0x122ce0);loggerPredictive[_0x9191('0x51')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1ce910);loggerPredictive['info'](_0x9191('0x22b'),_0x739dd3);loggerPredictive[_0x9191('0x51')](_0x9191('0x223'),_0x8d9cdf);loggerPredictive[_0x9191('0x51')](_0x9191('0x22c'),_0x446cb3);loggerPredictive[_0x9191('0x51')](_0x9191('0x5a'));return new Promise(function(_0x1eeb04,_0x27de1c){if(_0x122ce0<=0x0||isNaN(_0x122ce0)){return _0x27de1c(msgResponse(_0x9191('0x22d'),_0x9191('0x8c'),'m\x20=\x20'+_0x122ce0));}if(_0x739dd3<=0x0||isNaN(_0x739dd3)){return _0x27de1c(msgResponse('[busyFactor]',_0x9191('0x8c'),_0x9191('0x22e')+_0x739dd3));}if(_0x8d9cdf<=0x0||isNaN(_0x8d9cdf)){return _0x27de1c(msgResponse(_0x9191('0x22d'),'Error',_0x9191('0x226')+_0x8d9cdf));}if(_0x1ce910<=0x0||isNaN(_0x1ce910)){return _0x27de1c(msgResponse(_0x9191('0x22d'),_0x9191('0x8c'),_0x9191('0x227')+_0x1ce910));}if(_0x446cb3<=0x0||isNaN(_0x446cb3)){return _0x27de1c(msgResponse(_0x9191('0x22d'),'Error',_0x9191('0x22f')+_0x446cb3));}_0x58950b=_0x58950b||0x0;var _0x48ac61=0x1/_0x739dd3;var _0x5cd6b5=0x0;var _0x4b791c=0x0;var _0x4b7bfd=0x0;var _0x3ebc63=0x0;for(var _0x370b38=0x0;_0x3ebc63<_0x446cb3;_0x370b38+=0x1){_0x4b791c=_0x370b38/_0x1ce910;_0x5cd6b5=(_0x8d9cdf*_0x4b791c+_0x58950b)/_0x48ac61;_0x4b7bfd=utils['erlangb'](_0x5cd6b5,_0x122ce0);_0x3ebc63=_0x5cd6b5/_0x122ce0*(0x1-utils[_0x9191('0x228')](_0x5cd6b5,_0x122ce0));}return _0x1eeb04({'erlangCalls':_0x370b38,'erlangCallToSecond':_0x1ce910/_0x370b38,'erlangAbandonmentRate':_0x4b7bfd,'erlangBusyFactor':_0x3ebc63});});};module[_0x9191('0x230')]=Dialer; \ No newline at end of file +var _0xfbb2=['getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','custom:agentnosuchnumber','dialNoSuchNumberRetryFrequency','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','callAdditionalPhoneAfterMin','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','busyFactor','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','[actionOriginatePredictive]\x20','--------\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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','defaults','redis','localhost','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','previewRecallmeReminderInterval','isUndefined','emit','outbound','debug','inspect','format','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','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','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','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\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','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','stringify','prototype','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','then','indexOf','true','catch','content','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','predictive','booked','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','type','ivr','updateOriginated','answertime','outboundAnswerCallsDay','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','YYYY-MM-DD\x20HH:mm:ss','countdropretry','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','additional','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','statedesc','Drop','calleridname','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','actions','channel','strategy','rrmemory','roundrobin','actionid','isNil','locked','stateinterface','idHopper','paused','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','run','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countagentrejectretry','createStateFinal','reason\x2019\x20machine....','[syncHangupIvr][createHistory]','AnswerAGI','AGI','[syncHangupIvr]','dialQueueProject','outboundUnknownCallsDay','cause-txt','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','dialPreviewRecallmeReminder','online','length','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','[uniqueid]','clearZombieChannels','undefined','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','Agent','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','%s%s','XMD-','toUpper','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0xfbb2,0xa7));var _0x2fbb=function(_0x24003a,_0x4f4649){_0x24003a=_0x24003a-0x0;var _0x1d76b0=_0xfbb2[_0x24003a];return _0x1d76b0;};'use strict';var util=require(_0x2fbb('0x0'));var _=require('lodash');var uuid=require(_0x2fbb('0x1'));var moment=require(_0x2fbb('0x2'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x2fbb('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0x2fbb('0x4'));var config=require(_0x2fbb('0x5'));var logger=require(_0x2fbb('0x6'))(_0x2fbb('0x7'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x2fbb('0x6'))('predictive');var loggerPredictiveCalls=require(_0x2fbb('0x6'))(_0x2fbb('0x8'));var loggerSyncQueueSummary=require(_0x2fbb('0x6'))(_0x2fbb('0x9'));var ami=require('../ami');config['redis']=_[_0x2fbb('0xa')](config[_0x2fbb('0xb')],{'host':_0x2fbb('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2fbb('0xb')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x2fbb('0xd'));var Interval=require(_0x2fbb('0xe'));var Action=require(_0x2fbb('0xf'));var History=require(_0x2fbb('0x10'));var Final=require(_0x2fbb('0x11'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x2fbb('0x12'));var ipAgi=process[_0x2fbb('0x13')][_0x2fbb('0x14')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x2fbb('0x15')]=function(_0x1331f2){this['tail']=this[_0x2fbb('0x16')]?this[_0x2fbb('0x16')][_0x2fbb('0x17')](_0x1331f2):_0x1331f2();};function Dialer(_0x7a340d,_0x24a9ea){this[_0x2fbb('0x18')]=new Sequence();this[_0x2fbb('0x19')]=_0x24a9ea;this['voiceQueues']=_0x7a340d[_0x2fbb('0x1a')];this['campaigns']=_0x7a340d[_0x2fbb('0x1b')];this[_0x2fbb('0x1c')]=_0x7a340d['agents'];this[_0x2fbb('0x1d')]=_0x7a340d[_0x2fbb('0x1d')];this[_0x2fbb('0x1e')]=config[_0x2fbb('0x1e')]||0x2;this['channels']={};this['actions']={};this['contactsId']={};this[_0x2fbb('0x1f')]={};this['optionPredictive']={};this[_0x2fbb('0x20')]={};this[_0x2fbb('0x21')]={};this[_0x2fbb('0x22')]={};this[_0x2fbb('0x23')]={};this[_0x2fbb('0x24')]={};this[_0x2fbb('0x25')]={};ami['on'](_0x2fbb('0x26'),this[_0x2fbb('0x27')][_0x2fbb('0x28')](this));ami['on'](_0x2fbb('0x29'),this[_0x2fbb('0x2a')][_0x2fbb('0x28')](this));ami['on'](_0x2fbb('0x2b'),this[_0x2fbb('0x2c')][_0x2fbb('0x28')](this));ami['on']('agentcomplete',this[_0x2fbb('0x2d')][_0x2fbb('0x28')](this));ami['on'](_0x2fbb('0x2e'),this[_0x2fbb('0x9')][_0x2fbb('0x28')](this));ami['on'](_0x2fbb('0x2f'),this[_0x2fbb('0x30')][_0x2fbb('0x28')](this));ami['on'](_0x2fbb('0x31'),this[_0x2fbb('0x32')]['bind'](this));ami['on'](_0x2fbb('0x33'),this[_0x2fbb('0x34')][_0x2fbb('0x28')](this));ami['on']('varset',this[_0x2fbb('0x35')]['bind'](this));ami['on'](_0x2fbb('0x36'),this[_0x2fbb('0x37')][_0x2fbb('0x28')](this));ami['on'](_0x2fbb('0x38'),this[_0x2fbb('0x39')]['bind'](this));this[_0x2fbb('0x3a')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()['then'](function(_0x5122db){previewRecallmeReminderInterval=_0x5122db[_0x2fbb('0x3b')];});}function isNotNull(_0x58d058){return _0x58d058!==null&&!_[_0x2fbb('0x3c')](_0x58d058);}function msgResponse(_0x2c2dfa,_0x3559d0,_0x2540b3){return{'action':_0x2c2dfa,'response':_0x3559d0,'message':_0x2540b3,'stack':_0x2540b3};}function emit(_0x385e73,_0x5b2947,_0x505371){io['to'](_0x385e73)[_0x2fbb('0x3d')](_0x5b2947,_0x505371);}function emitOutboundVoiceQueueSummary(_0x29eebe){if(_0x29eebe['type']===_0x2fbb('0x3e')){logger[_0x2fbb('0x3f')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x2fbb('0x40')](_0x29eebe,{'showHidden':![],'depth':null}));emit(util[_0x2fbb('0x41')]('voice:queue:%s',_0x29eebe[_0x2fbb('0x42')]),_0x2fbb('0x43'),_0x29eebe);}}function checkGetDataPredictive(_0x1a3860){if(isNotNull(_0x1a3860)&&!_[_0x2fbb('0x44')](_0x1a3860)){loggerPredictive['info'](_0x2fbb('0x45'));loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x47'),_0x1a3860[_0x2fbb('0x48')]);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x49'),_0x1a3860[_0x2fbb('0x4a')]);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x4b'),_0x1a3860[_0x2fbb('0x4c')]);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x4d'),_0x1a3860[_0x2fbb('0x4e')]);loggerPredictive[_0x2fbb('0x46')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a3860[_0x2fbb('0x4f')]);loggerPredictive[_0x2fbb('0x46')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a3860[_0x2fbb('0x50')]);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x51'));if(_0x1a3860['predictiveIntervalTotalCalls']>0x0){if(!_[_0x2fbb('0x3c')](_0x1a3860['predictiveIntervalAvgTalktime'])&&_0x1a3860[_0x2fbb('0x50')]>0x0){return!![];}loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x52'));if(!_['isUndefined'](_0x1a3860[_0x2fbb('0x4f')])&&_0x1a3860['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x2fbb('0x46')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x2fbb('0x46')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x53'));}return![];}function mergeDataErlangB(_0x476282){return function(_0x7781b2){loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x54'));loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x55'),_0x7781b2['erlangCalls']);loggerPredictive['info'](_0x2fbb('0x56'),_0x7781b2[_0x2fbb('0x57')]);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x58'),_0x7781b2['erlangAbandonmentRate']);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x59'),_0x7781b2[_0x2fbb('0x5a')]);loggerPredictive['info'](_0x2fbb('0x58'),_0x7781b2[_0x2fbb('0x5b')]);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x51'));_[_0x2fbb('0x5c')](_0x476282,_0x7781b2);};}function ifInterval(_0xc9a43b,_0x4f370c){if(_[_0x2fbb('0x3c')](_0x4f370c)){return![];}return utils[_0x2fbb('0x5d')](undefined,_0x4f370c)<_0xc9a43b*0x3c;}function clearPredictiveAttributes(_0x5d6c91){if(_0x5d6c91['startProgressive']){_0x5d6c91[_0x2fbb('0x21')]=undefined;loggerPredictive[_0x2fbb('0x3f')](_0x5d6c91[_0x2fbb('0x42')],_0x2fbb('0x5e'));}if(_0x5d6c91[_0x2fbb('0x20')]){_0x5d6c91[_0x2fbb('0x20')]=undefined;loggerPredictive[_0x2fbb('0x3f')](_0x5d6c91[_0x2fbb('0x42')],_0x2fbb('0x5f'));}if(_0x5d6c91['handlePredictive']){clearInterval(_0x5d6c91[_0x2fbb('0x60')]);_0x5d6c91[_0x2fbb('0x60')]=undefined;loggerPredictive['debug'](_0x5d6c91['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x49ddb9,_0x1dc209){return function(_0x1c8d18){loggerPredictive[_0x2fbb('0x61')](_0x1dc209[_0x2fbb('0x42')],_0x49ddb9);loggerPredictive[_0x2fbb('0x61')](_0x1c8d18[_0x2fbb('0x62')]);clearPredictiveAttributes(_0x1dc209);};}function loggerCatch(_0x278116){return function(_0x4fd27c){logger['error'](_0x278116,util['inspect'](_0x4fd27c,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x438157,_0x33b5d3,_0x1b7918){return function(_0x4ce1f7){utils[_0x2fbb('0x63')](_0x33b5d3,_0x1b7918,0x0);logger[_0x2fbb('0x61')](_0x438157,util['inspect'](_0x4ce1f7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x40938b){return function(_0x18d62d){if(isNotNull(_0x18d62d)&&isNotNull(_0x18d62d[0x0])){if(_0x18d62d[0x0][_0x2fbb('0x64')]>0x0){_0x40938b[_0x2fbb('0x65')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger[_0x2fbb('0x46')]('[getContactDialer2][ReScheduled]'+_0x40938b[_0x2fbb('0x42')],_0x18d62d[0x0][_0x2fbb('0x64')],_0x2fbb('0x66'));}else{_0x40938b[_0x2fbb('0x65')]=utils[_0x2fbb('0x67')][_0x2fbb('0x68')];logger[_0x2fbb('0x46')]('[getContactDialer2][Empty]'+_0x40938b[_0x2fbb('0x42')]);}}};}function createObjHistory(_0x2a2cab,_0x422afb,_0x31c64b,_0x5edd36,_0x222e4f){_0x2a2cab[_0x2fbb('0x65')]=_0x31c64b;var _0x163a20=new Action(_0x2a2cab,_0x422afb);var _0x380699=new History(_0x163a20);_0x380699[_0x2fbb('0x69')]=_0x5edd36;_0x380699['statedesc']=_0x222e4f;_0x380699[_0x2fbb('0x6a')]=_0x163a20[_0x2fbb('0x6b')];return _0x380699;}function unlockQueueStatus(_0x4ffa7c,_0x221cfb){setTimeout(function(){if(_[_0x2fbb('0x3c')](_0x4ffa7c[_0x2fbb('0x6c')])){loggerBooked[_0x2fbb('0x61')](_0x2fbb('0x6d'),_0x221cfb);}_0x4ffa7c[_0x2fbb('0x6c')]=!![];loggerBooked[_0x2fbb('0x46')]('[booked][unlockQueueStatus]',_0x221cfb,JSON['stringify'](_['pick'](_0x4ffa7c,[_0x2fbb('0x42'),_0x2fbb('0x6c')])));},0x1f3);}function checkInterval(_0x4a4806){return function(){if(!isNotNull(_0x4a4806[_0x2fbb('0x6e')])){_0x4a4806[_0x2fbb('0x65')]=utils[_0x2fbb('0x67')][_0x2fbb('0x6f')];throw _0x4a4806[_0x2fbb('0x42')]+_0x2fbb('0x70');}if(!isNotNull(_0x4a4806['Interval'][_0x2fbb('0x71')])){_0x4a4806['message']=utils[_0x2fbb('0x67')]['NULL_INTERVAL'];throw _0x4a4806[_0x2fbb('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x2fbb('0x44')](_0x4a4806[_0x2fbb('0x6e')]['Intervals']))){_0x4a4806[_0x2fbb('0x65')]=utils['CAMPAIGN_STATUS'][_0x2fbb('0x6f')];throw _0x4a4806['name']+_0x2fbb('0x70');}};}function checkIsIVRCampaignActive(_0x269bde){return function(){if(!utils[_0x2fbb('0x72')](_0x269bde)){_0x269bde[_0x2fbb('0x65')]=utils[_0x2fbb('0x67')][_0x2fbb('0x73')];throw _0x269bde[_0x2fbb('0x42')]+_0x2fbb('0x74');}};}function emitCampaignSummary(_0x51bfae){if(utils[_0x2fbb('0x75')](_0x51bfae)){emit(util['format'](_0x2fbb('0x76'),_0x51bfae[_0x2fbb('0x42')]),_0x2fbb('0x77'),_0x51bfae);}}function loggerCatchQueueSummary(_0x5cc159,_0x4a996f){return function(_0x3340d5){clearPredictiveAttributes(_0x4a996f);emitCampaignSummary(_0x4a996f);loggerSyncQueueSummary[_0x2fbb('0x3f')](_0x5cc159,util['inspect'](_0x3340d5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3b120e){if(_0x3b120e[_0x2fbb('0x78')]){if(_0x3b120e[_0x2fbb('0x79')]===0x0){_0x3b120e[_0x2fbb('0x78')]=![];_0x3b120e[_0x2fbb('0x65')]=utils['CAMPAIGN_STATUS'][_0x2fbb('0x73')];loggerSyncQueueSummary[_0x2fbb('0x3f')](_0x2fbb('0x7a'),_0x3b120e[_0x2fbb('0x42')],_0x2fbb('0x7b'));}else{_0x3b120e[_0x2fbb('0x65')]=utils[_0x2fbb('0x67')][_0x2fbb('0x7c')];loggerSyncQueueSummary[_0x2fbb('0x3f')](_0x2fbb('0x7a'),_0x3b120e['name'],_0x2fbb('0x7d'));}emitCampaignSummary(_0x3b120e);}}function myreject(_0x45c0a8){return function(_0x334dd6){return _0x45c0a8(msgResponse(_0x2fbb('0x7e'),'Error',JSON[_0x2fbb('0x7f')](_0x334dd6)));};}Dialer[_0x2fbb('0x80')][_0x2fbb('0x81')]=function(_0xd5bfea){return!_[_0x2fbb('0x3c')](_0xd5bfea)&&_0xd5bfea&&!_[_0x2fbb('0x3c')](_0xd5bfea[_0x2fbb('0x42')])&&!_[_0x2fbb('0x3c')](_0xd5bfea[_0x2fbb('0x82')])&&_0xd5bfea[_0x2fbb('0x82')]&&(this[_0x2fbb('0x1d')][util[_0x2fbb('0x41')](_0x2fbb('0x83'),_0xd5bfea[_0x2fbb('0x42')])]['status']===_0x2fbb('0x84')||this[_0x2fbb('0x1d')][util[_0x2fbb('0x41')]('SIP/%s',_0xd5bfea[_0x2fbb('0x42')])][_0x2fbb('0x85')]===_0x2fbb('0x86'));};Dialer['prototype'][_0x2fbb('0x87')]=function(_0x38e924){var _0x58cf81=this;return function(){if(!_0x58cf81[_0x2fbb('0x81')](_0x38e924[_0x2fbb('0x88')])){if(!_0x58cf81['isTrunkReachable'](_0x38e924[_0x2fbb('0x89')])){_0x38e924['message']=utils['CAMPAIGN_STATUS'][_0x2fbb('0x8a')];throw _0x38e924[_0x2fbb('0x42')]+_0x2fbb('0x8b');}}};};Dialer[_0x2fbb('0x80')][_0x2fbb('0x8c')]=function(_0x383a94,_0x7990ec,_0x295e30,_0x272f35){var _0x34da89=this;return function(){var _0x1a5593=!![];return _0x34da89[_0x2fbb('0x8d')](_0x383a94,_0x7990ec,_0x295e30,_0x272f35,_0x1a5593);};};Dialer[_0x2fbb('0x80')]['checkIfTimeIntervals']=function(_0x4d1760,_0x51ad84,_0x304229,_0x56bcf8){var _0x7ee0b2=this;return function(){var _0x5300a9=![];return _0x7ee0b2[_0x2fbb('0x8d')](_0x4d1760[_0x2fbb('0x71')],_0x51ad84,_0x304229,_0x56bcf8,_0x5300a9);};};Dialer[_0x2fbb('0x80')]['ifTimeIvr']=function(_0x543426,_0x11f138,_0x2f84dc,_0x20b3e4,_0x3655f8){var _0x3cc3c5=[];return new Promise(function(_0x1eb82d,_0xf755cc){if(!isNotNull(_0x543426)){_0x20b3e4['message']=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0xf755cc(msgResponse('ifTime',_0x2fbb('0x8e'),_0x2f84dc+_0x2fbb('0x8f')));}if(_[_0x2fbb('0x44')](_0x543426)){_0x20b3e4[_0x2fbb('0x65')]=utils[_0x2fbb('0x67')][_0x2fbb('0x90')];return _0xf755cc(msgResponse(_0x2fbb('0x91'),'Failure',_0x2f84dc+_0x2fbb('0x92')));}if(_0x11f138&&_[_0x2fbb('0x3c')](config[_0x2fbb('0x93')][_0x11f138])){_0x20b3e4[_0x2fbb('0x65')]=utils[_0x2fbb('0x67')][_0x2fbb('0x94')];return _0xf755cc(msgResponse(_0x2fbb('0x91'),_0x2fbb('0x8e'),_0x2f84dc+_0x2fbb('0x95')+_0x11f138));}if(_[_0x2fbb('0x96')](_0x543426)){for(var _0x240557=0x0;_0x240557<_0x543426['length'];_0x240557+=0x1){_0x3cc3c5[_0x2fbb('0x97')](ami[_0x2fbb('0x98')]({'action':_0x2fbb('0x99'),'command':util[_0x2fbb('0x41')](_0x2fbb('0x9a'),_0x543426[_0x240557][_0x2fbb('0x9b')],!_[_0x2fbb('0x3c')](config[_0x2fbb('0x93')][_0x11f138])?_0x11f138:'')})[_0x2fbb('0x9c')](function(_0x8c90ca){return _0x8c90ca['content'][_0x2fbb('0x9d')](_0x2fbb('0x9e'))>=0x0;})[_0x2fbb('0x9f')](myreject(_0xf755cc)));}}else{_0x3cc3c5['push'](ami['Action']({'action':_0x2fbb('0x99'),'command':util[_0x2fbb('0x41')](_0x2fbb('0x9a'),_0x543426,!_[_0x2fbb('0x3c')](config[_0x2fbb('0x93')][_0x11f138])?_0x11f138:'')})['then'](function(_0x11ee61){return _0x11ee61[_0x2fbb('0xa0')][_0x2fbb('0x9d')](_0x2fbb('0x9e'))>=0x0;})[_0x2fbb('0x9f')](myreject(_0xf755cc)));}Promise[_0x2fbb('0xa1')](_0x3cc3c5)['then'](function(_0x19a51e){var _0x4aa292=_[_0x2fbb('0xa2')](_0x19a51e);if(_0x4aa292){return _0x1eb82d(_0x4aa292);}else{_0x20b3e4[_0x2fbb('0x65')]=_0x3655f8?utils[_0x2fbb('0x67')][_0x2fbb('0xa3')]:utils[_0x2fbb('0x67')][_0x2fbb('0xa4')];return _0xf755cc(msgResponse(_0x2fbb('0xa5'),'Failure',_0x2fbb('0xa6')+_0x3655f8+'\x20'+_0x2f84dc+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2fbb('0x40')](_0x543426,{'showHidden':![],'depth':null})+_0x2fbb('0xa7')+_0x11f138));}})[_0x2fbb('0x9f')](function(_0x1cf015){return _0xf755cc(msgResponse('ifTime','Failure',JSON['stringify'](_0x1cf015)));});});};Dialer[_0x2fbb('0x80')][_0x2fbb('0x3a')]=function(){var _0x180d18=this;return cmHopper[_0x2fbb('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0x2fbb('0x9c')](function(){setInterval(function(){_0x180d18['syncCampaigns']();},0x3e8);});};Dialer[_0x2fbb('0x80')][_0x2fbb('0xa9')]=function(){var _0x38fe88=this;var _0x3aef49;for(var _0x258607 in this[_0x2fbb('0x1b')]){if(typeof this['campaigns'][_0x258607]!=='undefined'){_0x3aef49=this[_0x2fbb('0x1b')][_0x258607];if(utils['isIVRCampaign'](_0x3aef49)&&utils['isIVRCampaignActive'](_0x3aef49)){_0x3aef49[_0x2fbb('0x78')]=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x3aef49))['then'](checkInterval(_0x3aef49))[_0x2fbb('0x9c')](_0x38fe88[_0x2fbb('0x87')](_0x3aef49))[_0x2fbb('0x9c')](_0x38fe88[_0x2fbb('0x8c')](_0x3aef49[_0x2fbb('0xaa')],_0x3aef49[_0x2fbb('0xab')],_0x3aef49['name'],_0x3aef49))[_0x2fbb('0x9c')](_0x38fe88[_0x2fbb('0xac')](_0x3aef49[_0x2fbb('0x6e')],_0x3aef49[_0x2fbb('0xab')],_0x3aef49[_0x2fbb('0x42')],_0x3aef49))[_0x2fbb('0x9c')](_0x38fe88[_0x2fbb('0xad')](_0x3aef49))['catch'](loggerCatchQueueSummary(_0x2fbb('0xae'),_0x3aef49));}else{notSendMessagesCampaign(_0x3aef49);}}}};Dialer[_0x2fbb('0x80')][_0x2fbb('0xaf')]=function(_0x3478b9){if(_0x3478b9[_0x2fbb('0xb0')]!=='predictive'){clearPredictiveAttributes(_0x3478b9);}switch(_0x3478b9[_0x2fbb('0xb0')]){case _0x2fbb('0xb1'):this[_0x2fbb('0xb2')](_0x3478b9,0x1);break;case _0x2fbb('0xb3'):this[_0x2fbb('0xb2')](_0x3478b9,_0x3478b9[_0x2fbb('0xb4')]);break;case _0x2fbb('0xb5'):this[_0x2fbb('0xb5')](_0x3478b9);break;case _0x2fbb('0xb6'):this[_0x2fbb('0xb2')](_0x3478b9,0x1);break;default:logger['error'](_0x2fbb('0xb7'),_0x3478b9[_0x2fbb('0x42')],_0x2fbb('0xb8'));}};Dialer[_0x2fbb('0x80')]['ifTime']=function(_0x3da0f2,_0x397219){var _0x45a302=_0x3da0f2[_0x2fbb('0xab')];var _0x13608e=_0x397219?_0x3da0f2['dialGlobalInterval']:_0x3da0f2[_0x2fbb('0x6e')][_0x2fbb('0x71')];logger['silly'](_0x2fbb('0xb9'),_0x13608e,_0x45a302,_0x3da0f2[_0x2fbb('0x42')],util[_0x2fbb('0x41')](_0x2fbb('0xba'),_0x3da0f2['name'],_0x3da0f2['id']));var _0xe60802=null;return Interval['intervalIftime'](_0x13608e,_0x45a302)[_0x2fbb('0x9c')](function(_0xa88d39){if(_0xa88d39===!![]){return _0xa88d39;}else{_0x3da0f2['message']=_0x397219?utils[_0x2fbb('0x67')][_0x2fbb('0xa3')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0xe60802=msgResponse(_0x2fbb('0xa5'),'Failure',_0x2fbb('0xa6')+_0x397219+'\x20'+_0x3da0f2[_0x2fbb('0x42')]+_0x2fbb('0xbb')+util[_0x2fbb('0x40')](_0x13608e,{'showHidden':![],'depth':null})+_0x2fbb('0xa7')+_0x45a302);}if(_0xe60802!==null){logger['silly'](_0x2fbb('0xbc'),_0xe60802);_0xe60802[_0x2fbb('0xbd')]=_0x397219;throw _0xe60802;}})[_0x2fbb('0x9f')](function(_0x358e84){logger[_0x2fbb('0x61')](_0x2fbb('0xbe'),_0x358e84);throw msgResponse(_0x2fbb('0x7e'),_0x2fbb('0xbf'),util['inspect'](_0x358e84,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x2fbb('0x27')]=function(_0x2b36ab){if(this[_0x2fbb('0x1a')][_0x2b36ab[_0x2fbb('0xc0')]]){if(this[_0x2fbb('0x1f')][_0x2b36ab[_0x2fbb('0xc1')]]&&this[_0x2fbb('0x1f')][_0x2b36ab[_0x2fbb('0xc1')]][_0x2fbb('0xc2')]!==_0x2fbb('0xc3')){this[_0x2fbb('0xc4')](this[_0x2fbb('0x1a')][_0x2b36ab['queue']]);this[_0x2fbb('0x1f')][_0x2b36ab['uniqueid']][_0x2fbb('0xc5')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x2fbb('0x80')]['syncAgentComplete']=function(_0x15a4cf){var _0x3862ff=this[_0x2fbb('0x1f')][_0x15a4cf[_0x2fbb('0xc1')]];if(this[_0x2fbb('0x1a')][_0x15a4cf[_0x2fbb('0xc0')]]){if(_0x3862ff&&_0x3862ff[_0x2fbb('0xc2')]!==_0x2fbb('0xc3')){delete this['uniqueId'][_0x15a4cf[_0x2fbb('0xc1')]];this[_0x2fbb('0x1a')][_0x15a4cf[_0x2fbb('0xc0')]][_0x2fbb('0xc6')]+=0x1;var _0x42b97b=new AgentComplete(_0x3862ff,_0x15a4cf);if(_0x15a4cf['reason']==='agent'){_0x42b97b[_0x2fbb('0xc7')]=this['voiceQueues'][_0x15a4cf['queue']][_0x2fbb('0xc8')]&&this[_0x2fbb('0x1a')][_0x15a4cf['queue']][_0x2fbb('0xc9')]?moment()[_0x2fbb('0x41')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x42b97b)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0xca')));hopperUtils[_0x2fbb('0xcb')](_0x42b97b)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0xcc')));}}};Dialer['prototype'][_0x2fbb('0x2a')]=function(_0x14d44d){var _0x395a3f=this[_0x2fbb('0x1f')][_0x14d44d['uniqueid']];var _0x4a493d=this;var _0x3c841a=![];var _0x25f1e1;var _0x64ed6b;if(this['voiceQueues'][_0x14d44d[_0x2fbb('0xc0')]]){if(_0x395a3f&&_0x395a3f[_0x2fbb('0xc2')]!==_0x2fbb('0xc3')){delete this[_0x2fbb('0x1f')][_0x14d44d['uniqueid']];this['updateOriginated'](this[_0x2fbb('0x1a')][_0x14d44d['queue']]);_0x395a3f['droptime']=moment()[_0x2fbb('0x41')]('YYYY-MM-DD\x20HH:mm:ss');var _0x46257a=new QueueCallerAbandon(_0x395a3f,_0x14d44d);if(utils[_0x2fbb('0x5d')](_0x395a3f[_0x2fbb('0xcd')],_0x395a3f[_0x2fbb('0xce')])>=_0x395a3f[_0x2fbb('0xcf')]){this['voiceQueues'][_0x14d44d[_0x2fbb('0xc0')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2fbb('0x1a')][_0x14d44d[_0x2fbb('0xc0')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x2fbb('0x1a')][_0x14d44d[_0x2fbb('0xc0')]][_0x2fbb('0xd0')]+=0x1;_0x46257a['state']=0xa;_0x46257a['statedesc']='Drop';_0x46257a[_0x2fbb('0xd1')]='TIMEOUT';_0x46257a[_0x2fbb('0xc7')]=this['voiceQueues'][_0x14d44d[_0x2fbb('0xc0')]][_0x2fbb('0xc8')]?moment()[_0x2fbb('0x41')](_0x2fbb('0xd2')):undefined;_0x46257a[_0x2fbb('0xd3')]+=0x1;_0x46257a['countglobal']+=0x1;_0x25f1e1=this['voiceQueues'][_0x14d44d[_0x2fbb('0xc0')]]['dialDropRetryFrequency'];_0x64ed6b=this[_0x2fbb('0x1a')][_0x14d44d[_0x2fbb('0xc0')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x2fbb('0xd4')](_0x46257a,_0x46257a[_0x2fbb('0x69')],_0x395a3f[_0x2fbb('0xd5')])[_0x2fbb('0x9c')](function(_0x2b07b8){_0x3c841a=_0x2b07b8['additional']==0x1;if(_0x46257a['countdropretry']>=_0x4a493d[_0x2fbb('0x1a')][_0x14d44d[_0x2fbb('0xc0')]][_0x2fbb('0xd6')]){_0x4a493d[_0x2fbb('0xd7')](_0x46257a,_0x2b07b8[_0x2fbb('0xd8')]);}else{hopperUtils[_0x2fbb('0xd9')]({'active':![],'countdropretry':_0x46257a['countdropretry'],'scheduledat':moment()[_0x2fbb('0xda')](_0x4a493d[_0x2fbb('0x1a')][_0x14d44d[_0x2fbb('0xc0')]][_0x2fbb('0xdb')],_0x2fbb('0xdc'))[_0x2fbb('0x41')](_0x2fbb('0xd2')),'ContactId':_0x395a3f[_0x2fbb('0xdd')],'ListId':_0x395a3f[_0x2fbb('0xde')],'VoiceQueueId':_0x395a3f[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x395a3f[_0x2fbb('0xe0')]||undefined})[_0x2fbb('0x9f')](loggerCatch('[rescheduleContact][Drop]'));var _0x2269b7=new History(_0x46257a);_0x2269b7[_0x2fbb('0x69')]=0xa;_0x2269b7[_0x2fbb('0xe1')]=_0x2fbb('0xe2');_0x2269b7['starttime']=moment()[_0x2fbb('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x2269b7[_0x2fbb('0x6a')]=_0x2269b7[_0x2fbb('0x6b')];_0x2269b7[_0x2fbb('0xe3')]=_0x46257a[_0x2fbb('0xe3')];_0x2269b7['calleridnum']=_0x46257a['calleridnum'];hopperUtils[_0x2fbb('0xe4')](_0x2269b7)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0xe5')));}})[_0x2fbb('0x9c')](function(){if(_0x3c841a)hopperUtils[_0x2fbb('0xe6')](_0x46257a,_0x25f1e1,_0x64ed6b)[_0x2fbb('0x9c')](function(){return 0x1;});});}else{this[_0x2fbb('0x1a')][_0x14d44d[_0x2fbb('0xc0')]][_0x2fbb('0x4e')]+=0x1;this[_0x2fbb('0x1a')][_0x14d44d[_0x2fbb('0xc0')]][_0x2fbb('0xe7')]+=0x1;_0x46257a[_0x2fbb('0x69')]=0xb;_0x46257a['statedesc']=_0x2fbb('0xe8');_0x46257a[_0x2fbb('0xd1')]='CALLEREXIT';_0x46257a[_0x2fbb('0xe9')]+=0x1;_0x46257a[_0x2fbb('0xea')]+=0x1;_0x25f1e1=this['voiceQueues'][_0x14d44d[_0x2fbb('0xc0')]][_0x2fbb('0xeb')];_0x64ed6b=this['voiceQueues'][_0x14d44d['queue']]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x46257a,_0x46257a[_0x2fbb('0x69')],_0x395a3f[_0x2fbb('0xd5')])[_0x2fbb('0x9c')](function(_0x4b2830){if(_0x46257a['countabandonedretry']>=_0x4a493d[_0x2fbb('0x1a')][_0x14d44d['queue']][_0x2fbb('0xec')]){_0x4a493d[_0x2fbb('0xd7')](_0x46257a,_0x4b2830[_0x2fbb('0xd8')]);}else{hopperUtils[_0x2fbb('0xd9')]({'active':![],'countabandonedretry':_0x46257a[_0x2fbb('0xe9')],'scheduledat':moment()[_0x2fbb('0xda')](_0x4a493d['voiceQueues'][_0x14d44d['queue']][_0x2fbb('0xeb')],_0x2fbb('0xdc'))['format'](_0x2fbb('0xd2')),'ContactId':_0x395a3f[_0x2fbb('0xdd')],'ListId':_0x395a3f[_0x2fbb('0xde')],'VoiceQueueId':_0x395a3f[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x395a3f[_0x2fbb('0xe0')]||undefined})[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0xed')));var _0x547039=new History(_0x46257a);_0x547039['state']=0xb;_0x547039['statedesc']=_0x2fbb('0xe8');_0x547039[_0x2fbb('0x6b')]=moment()['format'](_0x2fbb('0xd2'));_0x547039['endtime']=_0x547039[_0x2fbb('0x6b')];_0x547039[_0x2fbb('0xe3')]=_0x46257a[_0x2fbb('0xe3')];_0x547039[_0x2fbb('0xee')]=_0x46257a[_0x2fbb('0xee')];hopperUtils['createHistory'](_0x547039)['catch'](loggerCatch(_0x2fbb('0xef')));}})[_0x2fbb('0x9c')](function(){if(_0x3c841a)hopperUtils['swapAdditionalPhones'](_0x46257a,_0x25f1e1,_0x64ed6b)[_0x2fbb('0x9c')](function(){return 0x1;});});}}}};Dialer[_0x2fbb('0x80')]['syncNewExten']=function(_0x3e51d2){if(this['actions'][_0x3e51d2[_0x2fbb('0xc1')]]){this[_0x2fbb('0xf0')][_0x3e51d2['uniqueid']][_0x2fbb('0xf1')]=_0x3e51d2[_0x2fbb('0xf1')];}if(this[_0x2fbb('0x1f')][_0x3e51d2[_0x2fbb('0xc1')]]){this['uniqueId'][_0x3e51d2[_0x2fbb('0xc1')]]['channel']=_0x3e51d2[_0x2fbb('0xf1')];}};Dialer[_0x2fbb('0x80')][_0x2fbb('0x37')]=function(_0x31c2d1){if(!this['actions'][_0x31c2d1['actionid']]){return;}var _0x11489b=this[_0x2fbb('0x1a')][this['actions'][_0x31c2d1['actionid']][_0x2fbb('0xc0')]][_0x2fbb('0xf2')]||_0x2fbb('0xf3');if(_0x11489b===_0x2fbb('0xf4')){if(this[_0x2fbb('0xf0')][_0x31c2d1[_0x2fbb('0xf5')]]&&_[_0x2fbb('0xf6')](this['actions'][_0x31c2d1[_0x2fbb('0xf5')]][_0x2fbb('0xf7')])&&_0x31c2d1[_0x2fbb('0x85')]==='1'&&_0x31c2d1['paused']==='0'){if(this['agents'][_0x31c2d1[_0x2fbb('0xf8')]]){if(!this[_0x2fbb('0x1c')][_0x31c2d1[_0x2fbb('0xf8')]][_0x2fbb('0xf7')]){this[_0x2fbb('0x1c')][_0x31c2d1['stateinterface']][_0x2fbb('0xf7')]=!![];this[_0x2fbb('0xf0')][_0x31c2d1['actionid']][_0x2fbb('0xf7')]=!![];this['actions'][_0x31c2d1['actionid']]['stateinterface']=_0x31c2d1[_0x2fbb('0xf8')];}}}}else if(_0x11489b===_0x2fbb('0xf3')){if(this[_0x2fbb('0xf0')][_0x31c2d1['actionid']]){if(this[_0x2fbb('0x1c')][_0x31c2d1[_0x2fbb('0xf8')]]){this['actions'][_0x31c2d1['actionid']][_0x2fbb('0xf8')]=_0x31c2d1[_0x2fbb('0xf8')];if(_[_0x2fbb('0xf6')](this[_0x2fbb('0x23')][this[_0x2fbb('0xf0')][_0x31c2d1[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]])){this[_0x2fbb('0x23')][this['actions'][_0x31c2d1[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]]=[];}this[_0x2fbb('0x23')][this[_0x2fbb('0xf0')][_0x31c2d1[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]][_0x2fbb('0x97')](_['merge'](_['pick'](this[_0x2fbb('0xf0')][_0x31c2d1[_0x2fbb('0xf5')]],[_0x2fbb('0xf9'),_0x2fbb('0xf8')]),{'status':_0x31c2d1[_0x2fbb('0x85')],'paused':_0x31c2d1[_0x2fbb('0xfa')]}));}}}};Dialer['prototype'][_0x2fbb('0x39')]=function(_0x3e6547){if(!this[_0x2fbb('0xf0')][_0x3e6547['actionid']]){return;}var _0x382935=this;var _0x4a90a8=this[_0x2fbb('0x1a')][this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]];var _0x1e99af=_0x4a90a8['strategy']||_0x2fbb('0xf3');if(_0x1e99af===_0x2fbb('0xf4')){if(this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]]&&this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xf8')]){this[_0x2fbb('0x19')]['run'](this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xf9')],this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xf8')])[_0x2fbb('0x9f')](function(_0x83a4fd){logger[_0x2fbb('0x61')](_0x2fbb('0xfb'),util[_0x2fbb('0x40')](_0x83a4fd,{'showHidden':![],'depth':null}));})['finally'](function(){_0x382935[_0x2fbb('0xc4')](_0x382935[_0x2fbb('0x1a')][_0x382935[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]]['queue']]);_0x382935[_0x2fbb('0x1c')][_0x382935[_0x2fbb('0xf0')][_0x3e6547['actionid']][_0x2fbb('0xf8')]][_0x2fbb('0xf7')]=![];delete _0x382935[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]];unlockQueueStatus(_0x4a90a8);});}else{this[_0x2fbb('0xc4')](this[_0x2fbb('0x1a')][this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]]);hopperUtils[_0x2fbb('0xd9')]({'active':![],'ContactId':this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xdd')],'ListId':this[_0x2fbb('0xf0')][_0x3e6547['actionid']][_0x2fbb('0xde')],'VoiceQueueId':this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xdf')]||undefined,'CampaignId':this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xe0')]||undefined})[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0xfc')));delete this['actions'][_0x3e6547[_0x2fbb('0xf5')]];unlockQueueStatus(_0x4a90a8);}}else if(_0x1e99af===_0x2fbb('0xf3')){var _0x5e0220;if(this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]]&&!_['isEmpty'](this[_0x2fbb('0x23')][this['actions'][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]])){if(this[_0x2fbb('0x24')][_0x382935[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]]){this[_0x2fbb('0x24')][_0x382935[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]]=this[_0x2fbb('0x24')][this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]]?this[_0x2fbb('0x24')][this['actions'][_0x3e6547['actionid']][_0x2fbb('0xc0')]]:this[_0x2fbb('0x23')][this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]]?this[_0x2fbb('0x23')][this[_0x2fbb('0xf0')][_0x3e6547['actionid']][_0x2fbb('0xc0')]]['_rr']||0x0:0x0;}this[_0x2fbb('0x23')][this[_0x2fbb('0xf0')][_0x3e6547[_0x2fbb('0xf5')]][_0x2fbb('0xc0')]][_0x2fbb('0xfd')]=this[_0x2fbb('0x24')][this[_0x2fbb('0xf0')][_0x3e6547['actionid']][_0x2fbb('0xc0')]];for(var _0x5c805c=0x0;_0x5c805c=_0x3845d4[_0x2fbb('0x125')]){_0x5cf11d[_0x2fbb('0x126')](_0x19a50e,_0x2eb313,_0x114d91,_0x2fbb('0x127'));}else{if(_0x19a50e[_0x2fbb('0x124')]>=_0x3845d4[_0x2fbb('0x128')]){_0x5cf11d['createStateFinal'](_0x19a50e,_0x2eb313,_0x114d91,'reason\x2019\x20machine....');}else{hopperUtils[_0x2fbb('0xd9')]({'active':![],'countmachineretry':_0x19a50e[_0x2fbb('0x124')],'scheduledat':moment()[_0x2fbb('0xda')](_0x3845d4[_0x2fbb('0x129')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19a50e[_0x2fbb('0xdd')],'ListId':_0x19a50e[_0x2fbb('0xde')],'VoiceQueueId':_0x19a50e['VoiceQueueId']||undefined,'CampaignId':_0x19a50e[_0x2fbb('0xe0')]||undefined})[_0x2fbb('0x9f')](loggerCatch('[rescheduleContact][Machine]'));_0x2eb313({'reschedule':0x1});}}});}if(_0x51641b[_0x2fbb('0xc2')]===_0x2fbb('0xc3')&&this[_0x2fbb('0x1b')][_0x51641b['queue']][_0x2fbb('0x111')]&&_0x594e31[_0x2fbb('0x112')]===_0x2fbb('0x113')){delete this['uniqueId'][_0x594e31['uniqueid']];this[_0x2fbb('0xc4')](this['campaigns'][_0x51641b['queue']]);_0x409a6c=new Hangup(_0x51641b,_0x594e31);_0x409a6c[_0x2fbb('0x69')]=0x12;_0x409a6c[_0x2fbb('0xe1')]=_0x2fbb('0x115');_0x409a6c[_0x2fbb('0x116')]=_0x2fbb('0x117');ami[_0x2fbb('0x3d')](_0x2fbb('0x118'),ut['buildObj'](_0x409a6c,_0x2fbb('0x11a')));this[_0x2fbb('0x11b')](_0x409a6c,_0x2fbb('0x12a'),_0x2fbb('0x12b'));}if(_0x51641b['type']===_0x2fbb('0xc3')&&this[_0x2fbb('0x1b')][_0x51641b[_0x2fbb('0xc0')]][_0x2fbb('0x111')]&&_0x594e31[_0x2fbb('0x112')]===_0x2fbb('0x11e')){return new Promise(function(_0x3be8de,_0x1d910d){delete _0x5cf11d[_0x2fbb('0x1f')][_0x594e31['uniqueid']];_0x5cf11d[_0x2fbb('0xc4')](_0x5cf11d[_0x2fbb('0x1b')][_0x51641b[_0x2fbb('0xc0')]]);_0x5cf11d[_0x2fbb('0x1b')][_0x51641b[_0x2fbb('0xc0')]][_0x2fbb('0xc6')]+=0x1;_0x5cf11d[_0x2fbb('0x1b')][_0x51641b[_0x2fbb('0xc0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4561b6=_0x5cf11d['campaigns'][_0x51641b['queue']];var _0x41d7b7=new Hangup(_0x51641b,_0x594e31);_0x41d7b7[_0x2fbb('0x69')]=0x13;_0x41d7b7[_0x2fbb('0xe1')]=_0x2fbb('0x12c');_0x41d7b7[_0x2fbb('0x116')]=_0x2fbb('0x117');_0x41d7b7[_0x2fbb('0x124')]+=0x1;_0x41d7b7['countglobal']+=0x1;_0x41d7b7['amd']=!![];ami[_0x2fbb('0x3d')](_0x2fbb('0x118'),ut[_0x2fbb('0x119')](_0x41d7b7,_0x2fbb('0x11a')));hopperUtils[_0x2fbb('0xe4')](_0x41d7b7)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x11f')));if(_0x41d7b7[_0x2fbb('0x120')]+_0x41d7b7['countcongestionretry']+_0x41d7b7['countnoanswerretry']+_0x41d7b7[_0x2fbb('0x123')]+_0x41d7b7[_0x2fbb('0xd3')]+_0x41d7b7[_0x2fbb('0xe9')]+_0x41d7b7[_0x2fbb('0x124')]+_0x41d7b7[_0x2fbb('0x12d')]>=_0x4561b6[_0x2fbb('0x125')]){_0x5cf11d['stateGlobal'](_0x41d7b7,_0x3be8de,_0x1d910d,_0x2fbb('0x127'));}else{if(_0x41d7b7[_0x2fbb('0x124')]>=_0x4561b6[_0x2fbb('0x128')]){_0x5cf11d[_0x2fbb('0x12e')](_0x41d7b7,_0x3be8de,_0x1d910d,_0x2fbb('0x12f'));}else{hopperUtils[_0x2fbb('0xd9')]({'active':![],'countmachineretry':_0x41d7b7[_0x2fbb('0x124')],'scheduledat':moment()[_0x2fbb('0xda')](_0x4561b6[_0x2fbb('0x129')],_0x2fbb('0xdc'))[_0x2fbb('0x41')](_0x2fbb('0xd2')),'ContactId':_0x41d7b7[_0x2fbb('0xdd')],'ListId':_0x41d7b7[_0x2fbb('0xde')],'VoiceQueueId':_0x41d7b7[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x41d7b7[_0x2fbb('0xe0')]||undefined})[_0x2fbb('0x9f')](loggerCatch('[rescheduleContact][Machine]'));_0x3be8de({'reschedule':0x1});}}});}}};Dialer[_0x2fbb('0x80')][_0x2fbb('0x32')]=function(_0x39bdbc){var _0x48ba27=this[_0x2fbb('0x1f')][_0x39bdbc['uniqueid']];var _0x5b2909;if(_0x48ba27&&_0x48ba27[_0x2fbb('0xc2')]===_0x2fbb('0xc3')){delete this[_0x2fbb('0x1f')][_0x39bdbc[_0x2fbb('0xc1')]];this[_0x2fbb('0xc4')](this[_0x2fbb('0x1b')][_0x48ba27[_0x2fbb('0xc0')]]);this[_0x2fbb('0x1b')][_0x48ba27[_0x2fbb('0xc0')]]['ivrAnswerCallsDay']+=0x1;_0x5b2909=new Hangup(_0x48ba27,_0x39bdbc);hopperUtils[_0x2fbb('0xe4')](_0x5b2909)['catch'](loggerCatch(_0x2fbb('0x130')));hopperUtils['moveContactManagedDialer'](_0x5b2909)[_0x2fbb('0x9f')](loggerCatch('[syncHangupIvr]'));}if(_0x48ba27&&_0x48ba27[_0x2fbb('0xc2')]!==_0x2fbb('0xc3')&&isNotNull(this[_0x2fbb('0x1a')][_0x48ba27[_0x2fbb('0xc0')]]['dialQueueProject'])){delete this[_0x2fbb('0x1f')][_0x39bdbc[_0x2fbb('0xc1')]];this[_0x2fbb('0xc4')](this[_0x2fbb('0x1a')][_0x48ba27[_0x2fbb('0xc0')]]);this[_0x2fbb('0x1a')][_0x48ba27[_0x2fbb('0xc0')]][_0x2fbb('0xc6')]+=0x1;this[_0x2fbb('0x1a')][_0x48ba27['queue']][_0x2fbb('0x114')]+=0x1;_0x5b2909=new Hangup(_0x48ba27,_0x39bdbc);_0x5b2909['state']=0x10;_0x5b2909[_0x2fbb('0xe1')]=_0x2fbb('0x131');_0x5b2909[_0x2fbb('0x116')]=_0x2fbb('0x132');hopperUtils[_0x2fbb('0xe4')](_0x5b2909)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x130')));hopperUtils[_0x2fbb('0xcb')](_0x5b2909)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x133')));}if(_0x48ba27&&_0x48ba27[_0x2fbb('0xc2')]!==_0x2fbb('0xc3')&&!isNotNull(this[_0x2fbb('0x1a')][_0x48ba27[_0x2fbb('0xc0')]][_0x2fbb('0x134')])){delete this[_0x2fbb('0x1f')][_0x39bdbc[_0x2fbb('0xc1')]];this['updateOriginated'](this[_0x2fbb('0x1a')][_0x48ba27[_0x2fbb('0xc0')]]);this[_0x2fbb('0x1a')][_0x48ba27[_0x2fbb('0xc0')]][_0x2fbb('0x135')]+=0x1;_0x5b2909=new Hangup(_0x48ba27,_0x39bdbc);_0x5b2909[_0x2fbb('0x69')]=0xc;_0x5b2909[_0x2fbb('0xe1')]=_0x39bdbc[_0x2fbb('0x136')];_0x5b2909['membername']='Unknow';hopperUtils[_0x2fbb('0xe4')](_0x5b2909)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x130')));hopperUtils[_0x2fbb('0xcb')](_0x5b2909)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x133')));}};Dialer[_0x2fbb('0x80')][_0x2fbb('0x9')]=function(_0x3fa536){var _0x47dbd9=this;if(!_0x47dbd9[_0x2fbb('0x25')][_0x3fa536['name']]){_0x47dbd9[_0x2fbb('0x25')][_0x3fa536[_0x2fbb('0x42')]]={'running':![]};}else if(_0x47dbd9['queuesSummary'][_0x3fa536[_0x2fbb('0x42')]]['running']===!![]){return;}else if(_0x47dbd9['queuesSummary'][_0x3fa536['name']]['running']===![]){_0x47dbd9[_0x2fbb('0x25')][_0x3fa536[_0x2fbb('0x42')]][_0x2fbb('0x137')]=!![];}var _0x48b743=_0x47dbd9[_0x2fbb('0x1a')][_0x3fa536[_0x2fbb('0x42')]];var _0x83f804=_0x48b743['message']!==utils[_0x2fbb('0x67')]['INACTIVE'];var _0xa88624=utils[_0x2fbb('0x138')](_0x48b743);_0x48b743[_0x2fbb('0x139')]=utils[_0x2fbb('0x13a')](_0x48b743,_0x47dbd9[_0x2fbb('0x1d')]);Promise[_0x2fbb('0x13b')]()['then'](function(){if(_0x48b743['statusMessage']===utils[_0x2fbb('0x67')]['INACTIVE']){if(_0x83f804){clearPredictiveAttributes(_0x48b743);_0x3fa536[_0x2fbb('0x20')]=undefined;_0x3fa536['startProgressive']=undefined;}if(_0x48b743[_0x2fbb('0x139')]===utils['CAMPAIGN_STATUS'][_0x2fbb('0x73')]){_0x3fa536[_0x2fbb('0x13c')]=0x0;_0x3fa536[_0x2fbb('0xfa')]=0x0;_0x3fa536[_0x2fbb('0x13d')]=0x0;_0x3fa536[_0x2fbb('0x13e')]=0x0;_0x3fa536[_0x2fbb('0x13f')]=0x0;}}else if(_0x48b743[_0x2fbb('0x139')]===utils[_0x2fbb('0x67')]['ACTIVE']&&!_0xa88624){return _0x47dbd9['ifTime'](_0x48b743,!![])[_0x2fbb('0x9c')](function(){return _0x47dbd9[_0x2fbb('0x91')](_0x48b743,![]);})[_0x2fbb('0x9c')](function(){return _0x47dbd9[_0x2fbb('0xaf')](_0x48b743);})[_0x2fbb('0x9f')](function(_0x4a808d){loggerSyncQueueSummary['debug'](_0x2fbb('0x140'),util[_0x2fbb('0x40')](_0x4a808d,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x48b743);});}else{clearPredictiveAttributes(_0x48b743);}})[_0x2fbb('0x9c')](function(){var _0x311d36=_0x3fa536[_0x2fbb('0x141')](_0x48b743);if(_0x311d36||_0x48b743[_0x2fbb('0x142')]){_0x48b743[_0x2fbb('0x142')]=![];_0x3fa536[_0x2fbb('0x143')](_0x48b743);Object['assign'](_0x48b743,_0x3fa536);emitOutboundVoiceQueueSummary(_0x3fa536);}_0x47dbd9[_0x2fbb('0x25')][_0x48b743[_0x2fbb('0x42')]][_0x2fbb('0x137')]=![];})[_0x2fbb('0x9f')](function(_0x2cf88e){logger['error'](_0x2fbb('0x140'),util[_0x2fbb('0x40')](_0x2cf88e,{'showHidden':![],'depth':null}));_0x47dbd9[_0x2fbb('0x25')][_0x48b743[_0x2fbb('0x42')]][_0x2fbb('0x137')]=![];});};Dialer[_0x2fbb('0x80')][_0x2fbb('0x30')]=_[_0x2fbb('0x144')](function(){var _0x51a7d0=_['filter'](this[_0x2fbb('0x1a')],function(_0x19ef8d){return _0x19ef8d[_0x2fbb('0x145')];});var _0x1f841b=_['filter'](this[_0x2fbb('0x1c')],function(_0xa7201c){return _0xa7201c[_0x2fbb('0x146')]&&_0xa7201c['status']===_0x2fbb('0x84');});if(_0x51a7d0[_0x2fbb('0x147')]>0x0&&_0x1f841b[_0x2fbb('0x147')]>0x0){return Promise['resolve']()['then'](cmHopper[_0x2fbb('0x148')](_[_0x2fbb('0x149')](_0x51a7d0,'id'),previewRecallmeReminderInterval,_['map'](_0x1f841b,'id')))[_0x2fbb('0x9c')](function(_0x27c4f4){for(var _0x33e0b7=0x0;_0x33e0b7<_0x27c4f4[_0x2fbb('0x147')];_0x33e0b7++){var _0x4867c2=_0x27c4f4[_0x33e0b7]['Agent'][_0x2fbb('0x42')];if(_0x4867c2)io['to'](util[_0x2fbb('0x41')](_0x2fbb('0x14a'),_0x4867c2))[_0x2fbb('0x3d')](_0x2fbb('0x14b'),{'hopper':_0x27c4f4[_0x33e0b7]});}})['catch'](function(_0x3eb6f4){logger['error'](_0x2fbb('0x14c'),_0x3eb6f4);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x2fbb('0x14d')]=function(){var _0x4c47e4=this;setInterval(function(){_0x4c47e4['clearZombieChannels'](_0x4c47e4[_0x2fbb('0x1f')],_0x2fbb('0x14e'));_0x4c47e4[_0x2fbb('0x14f')](_0x4c47e4['actions'],'[actions]');},0x32c8);};Dialer['prototype'][_0x2fbb('0x14f')]=function(_0x423a0b,_0x5a43c3){var _0x43ab52=this;for(var _0x22499c in _0x423a0b){if(typeof _0x423a0b[_0x22499c]!==_0x2fbb('0x150')){this['sequence'][_0x2fbb('0x15')](function(){if(!_[_0x2fbb('0xf6')](_0x423a0b[_0x22499c])){return ami[_0x2fbb('0x98')]({'action':_0x2fbb('0x85'),'channel':_0x423a0b[_0x22499c][_0x2fbb('0xf1')]})[_0x2fbb('0x9f')](function(_0x173820){if(_0x173820['message']===_0x2fbb('0x151')){setTimeout(function(){if(_0x423a0b[_0x22499c]&&_0x423a0b[_0x22499c][_0x2fbb('0xc2')]!==_0x2fbb('0xc3')){_0x43ab52['updateOriginated'](_0x43ab52['voiceQueues'][_0x423a0b[_0x22499c][_0x2fbb('0xc0')]]);logger[_0x2fbb('0x61')](_0x2fbb('0x152'),_0x5a43c3,_0x22499c,_0x423a0b[_0x22499c][_0x2fbb('0xc0')]);delete _0x423a0b[_0x22499c];}if(_0x423a0b[_0x22499c]&&_0x423a0b[_0x22499c]['type']==='ivr'){_0x43ab52['updateOriginated'](_0x43ab52[_0x2fbb('0x1b')][_0x423a0b[_0x22499c][_0x2fbb('0xc0')]]);logger[_0x2fbb('0x61')]('[Dialer][checkChannel][ivr]',_0x5a43c3,_0x22499c,_0x423a0b[_0x22499c][_0x2fbb('0xc0')]);delete _0x423a0b[_0x22499c];}},0x2328);}});}});}}};Dialer['prototype'][_0x2fbb('0x153')]=function(_0x390570){return Promise['resolve']()[_0x2fbb('0x9c')](voiceQueueRt[_0x2fbb('0x153')](_0x390570))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x2fbb('0x80')][_0x2fbb('0xc4')]=function(_0x3ddb8b){if(!_[_0x2fbb('0x3c')](_0x3ddb8b)&&_0x3ddb8b!==null){if(typeof _0x3ddb8b[_0x2fbb('0x79')]!==_0x2fbb('0x150')){if(_0x3ddb8b[_0x2fbb('0x79')]>0x0){_0x3ddb8b[_0x2fbb('0x79')]-=0x1;}else{logger[_0x2fbb('0x61')](_0x2fbb('0x154'));}}}else{logger['error'](_0x2fbb('0x155'));}};Dialer[_0x2fbb('0x80')][_0x2fbb('0x156')]=function(_0x5b7e87,_0x57958b){var _0x10289a=this;return function(_0x248fa5){_0x10289a[_0x2fbb('0xc4')](_0x57958b);logger[_0x2fbb('0x61')](_0x5b7e87,util[_0x2fbb('0x40')](_0x248fa5,{'showHidden':![],'depth':null}));};};Dialer[_0x2fbb('0x80')][_0x2fbb('0x157')]=function(_0x2e9f17,_0x51b569,_0x50b695){var _0x17646e={'state':0x19,'statedesc':_0x2fbb('0x158')};this['updateOriginated'](_0x51b569);this[_0x2fbb('0x11b')](_['merge'](_0x17646e,_[_0x2fbb('0x159')](_0x50b695,['ContactId','ListId',_0x2fbb('0x15a'),_0x2fbb('0xdf'),_0x2fbb('0xe0')])),_0x2fbb('0x15b'),_0x2fbb('0x15c'));logger[_0x2fbb('0x61')](_0x2e9f17);};Dialer[_0x2fbb('0x80')]['saveInDb']=function(_0x5221ac,_0x48e058,_0x184811){hopperUtils[_0x2fbb('0xe4')](_0x5221ac)[_0x2fbb('0x9f')](loggerCatch(_0x48e058));hopperUtils[_0x2fbb('0xcb')](_0x5221ac)[_0x2fbb('0x9f')](loggerCatch(_0x184811));};Dialer[_0x2fbb('0x80')][_0x2fbb('0xd7')]=function(_0x190498,_0x191d35){hopperUtils[_0x2fbb('0xe4')](_0x190498)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0xca')));if(_0x191d35==0x0){hopperUtils[_0x2fbb('0xcb')](_0x190498)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x15d')));}};Dialer[_0x2fbb('0x80')][_0x2fbb('0x14c')]=function(_0x3ca505){return Promise[_0x2fbb('0x13b')]()[_0x2fbb('0x9c')](cmHopper[_0x2fbb('0x148')](_0x3ca505['id'],previewRecallmeReminderInterval))[_0x2fbb('0x9c')](function(_0x1f14d6){for(var _0x248677=0x0;_0x248677<_0x1f14d6[_0x2fbb('0x147')];_0x248677++){var _0x4d6d5d=_0x1f14d6[_0x248677][_0x2fbb('0x15e')]['name'];if(_0x4d6d5d)io['to'](util['format'](_0x2fbb('0x14a'),_0x4d6d5d))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x1f14d6[_0x248677]});}})[_0x2fbb('0x9f')](function(){});};Dialer[_0x2fbb('0x80')][_0x2fbb('0xad')]=function(_0x424741){var _0x5ab33c=this;return function(){_0x5ab33c[_0x2fbb('0x15f')](_0x424741);};};Dialer[_0x2fbb('0x80')]['actionOriginate']=function(_0x204941,_0xa88670){var _0x511fe8=this;var _0x408886=uuid['v4']();this['actions'][_0x408886]=new Action(_0x204941,_0xa88670,_0x408886);return new Promise(function(_0x1930ac,_0x499eda){if(_[_0x2fbb('0x3c')](_0x204941)&&typeof _0x204941!==_0x2fbb('0x160')){return _0x499eda(msgResponse(_0x2fbb('0x161'),_0x2fbb('0x8e'),_0x2fbb('0x162')));}if(_[_0x2fbb('0x3c')](_0xa88670[_0x2fbb('0x163')])||_0xa88670[_0x2fbb('0x163')]===null){return _0x499eda(msgResponse(_0x2fbb('0x161'),'Failure',_0x2fbb('0x164')));}var _0x1666a6={'XMD-CALLERID':_0x511fe8[_0x2fbb('0xf0')][_0x408886][_0x2fbb('0x165')](),'XMD-AGI':_0x204941[_0x2fbb('0x134')]?util[_0x2fbb('0x41')](_0x2fbb('0x166'),ipAgi,_0x204941['dialQueueProject']):_0x2fbb('0x167'),'XMD-AGIAFTER':_0x204941[_0x2fbb('0xc8')]?util[_0x2fbb('0x41')](_0x2fbb('0x166'),ipAgi,_0x204941[_0x2fbb('0xc8')]):_0x2fbb('0x167'),'XMD-QUEUE':utils[_0x2fbb('0x168')](_0x204941)?util[_0x2fbb('0x41')](_0x2fbb('0x169'),_0x204941[_0x2fbb('0x42')],_0x204941['dialQueueOptions']||'',_0x204941[_0x2fbb('0xc9')]?'c':'',_0x204941[_0x2fbb('0xcf')]||0x3):_0x2fbb('0x167'),'XMD-CONTACTID':_0xa88670[_0x2fbb('0xdd')],'XMD-CDRTYPE':_0x2fbb('0x7'),'CALLERID(all)':_0x511fe8['actions'][_0x408886][_0x2fbb('0x165')](),'XMD-AMD':_0x204941[_0x2fbb('0x111')]?_0x2fbb('0x16a'):_0x2fbb('0x167'),'XMD-DESTINATION':_0x2fbb('0x110')};if(_0x204941[_0x2fbb('0x111')]){_0x1666a6[_0x2fbb('0x16b')]=_0x204941['dialAMDInitialSilence']||0x9c4;_0x1666a6[_0x2fbb('0x16c')]=_0x204941['dialAMDGreeting']||0x5dc;_0x1666a6[_0x2fbb('0x16d')]=_0x204941[_0x2fbb('0x16e')]||0x320;_0x1666a6[_0x2fbb('0x16f')]=_0x204941[_0x2fbb('0x170')]||0x1388;_0x1666a6['XMD-AMDMINWORDLENGTH']=_0x204941[_0x2fbb('0x171')]||0x64;_0x1666a6[_0x2fbb('0x172')]=_0x204941[_0x2fbb('0x173')]||0x32;_0x1666a6['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x204941[_0x2fbb('0x174')]||0x3;_0x1666a6[_0x2fbb('0x175')]=_0x204941['dialAMDSilenceThreshold']||0x100;_0x1666a6['XMD-AMDMAXIMUMWORDLENGTH']=_0x204941[_0x2fbb('0x176')]||0x1388;}if(utils[_0x2fbb('0x168')](_0x204941)){_0x1666a6['XMD-VOICEQUEUEID']=_0xa88670[_0x2fbb('0xdf')];}else{_0x1666a6[_0x2fbb('0x177')]=_0xa88670[_0x2fbb('0xe0')];}for(var _0x3c31ce in _0xa88670[_0x2fbb('0x178')]){if(typeof _0xa88670[_0x2fbb('0x178')][_0x3c31ce]!=='undefined'){if(isNotNull(_0xa88670['Contact'][_0x3c31ce])&&_0x3c31ce!=='id'&&_0x3c31ce!==_0x2fbb('0x179')&&_0x3c31ce!=='createdAt'&&_0x3c31ce!=='updatedAt'){_0x1666a6[util[_0x2fbb('0x41')](_0x2fbb('0x17a'),_0x2fbb('0x17b'),_[_0x2fbb('0x17c')](_0x3c31ce))]=_0xa88670['Contact'][_0x3c31ce];}}}var _0x2b536c=_0x511fe8[_0x2fbb('0x81')](_0x204941[_0x2fbb('0x88')])?utils[_0x2fbb('0x17d')](_0x204941[_0x2fbb('0x88')][_0x2fbb('0x17e')],_0x204941[_0x2fbb('0x17f')],_0x204941[_0x2fbb('0x180')]>0x0?utils['getCallerIdRandom'](_0x204941[_0x2fbb('0x181')],_0x204941[_0x2fbb('0x180')]):_0x204941[_0x2fbb('0x181')]):utils[_0x2fbb('0x17d')](_[_0x2fbb('0xf6')](_0x204941[_0x2fbb('0x89')])?_0x204941['Trunk']['callerid']:_0x204941[_0x2fbb('0x89')][_0x2fbb('0x17e')],_0x204941[_0x2fbb('0x17f')],_0x204941[_0x2fbb('0x180')]>0x0?utils[_0x2fbb('0x182')](_0x204941[_0x2fbb('0x181')],_0x204941[_0x2fbb('0x180')]):_0x204941['dialOriginateCallerIdNumber']);if(_0x2b536c){_0x1666a6[_0x2fbb('0x183')]=_0x511fe8['actions'][_0x408886][_0x2fbb('0x184')]=utils[_0x2fbb('0x185')](_0x2b536c);_0x1666a6[_0x2fbb('0x186')]=_0xa88670[_0x2fbb('0x163')];}_0x204941[_0x2fbb('0x187')]=_0x1666a6;return ami['Action']({'actionid':_0x408886,'action':_0x2fbb('0x161'),'channel':_0x511fe8[_0x2fbb('0x81')](_0x204941[_0x2fbb('0x88')])?util[_0x2fbb('0x41')](_0x2fbb('0x188'),_0x204941['Trunk'][_0x2fbb('0x42')],isNotNull(_0x204941[_0x2fbb('0x189')])?_0x204941[_0x2fbb('0x189')]['trim']()||'':'',_0x204941[_0x2fbb('0x18a')]>0x0?_0xa88670['phone']['substring'](_0x204941['dialCutDigit']):_0xa88670[_0x2fbb('0x163')]):util['format'](_0x2fbb('0x188'),_[_0x2fbb('0xf6')](_0x204941[_0x2fbb('0x89')])?_0x204941[_0x2fbb('0x88')][_0x2fbb('0x42')]:_0x204941[_0x2fbb('0x89')][_0x2fbb('0x42')],isNotNull(_0x204941[_0x2fbb('0x189')])?_0x204941['dialPrefix']['trim']()||'':'',_0x204941['dialCutDigit']>0x0?_0xa88670[_0x2fbb('0x163')][_0x2fbb('0x18b')](_0x204941['dialCutDigit']):_0xa88670['phone']),'callerid':_0x2b536c,'Exten':_0x2fbb('0x110'),'Context':_0x2fbb('0x18c'),'Priority':'1','variable':_0x1666a6,'timeout':(_0x204941[_0x2fbb('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x408886})[_0x2fbb('0x9c')](function(_0x4d5197){return _0x1930ac(_0x4d5197);})['catch'](function(_0xb92616){_0x204941[_0x2fbb('0x18e')]+=0x1;var _0x51388f=new History(_0x511fe8[_0x2fbb('0xf0')][_0x408886]);logger[_0x2fbb('0x61')](util[_0x2fbb('0x41')]('[originateError]:\x20%s',JSON[_0x2fbb('0x7f')](_0xb92616)));_0x51388f['state']=0xe;_0x51388f[_0x2fbb('0xe1')]=_0x2fbb('0x18f');_0x51388f[_0x2fbb('0x6b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x51388f[_0x2fbb('0x6a')]=_0x51388f[_0x2fbb('0x6b')];hopperUtils[_0x2fbb('0xe4')](_0x51388f)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x190')));_0x511fe8[_0x2fbb('0xcb')](_0x51388f)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x190')))[_0x2fbb('0x17')](function(){delete _0x511fe8[_0x2fbb('0xf0')][_0x408886];return _0x499eda(msgResponse(_0x2fbb('0x161'),_0x2fbb('0xbf'),'originate\x20action\x20Error'));});});});};Dialer[_0x2fbb('0x80')]['checkRetriveMax']=function(_0x414439,_0x59c481,_0x1eb6e4){var _0x2cc926=new History(_0x59c481);if(_0x2cc926['countbusyretry']+_0x2cc926['countcongestionretry']+_0x2cc926[_0x2fbb('0x122')]+_0x2cc926['countnosuchnumberretry']+_0x2cc926[_0x2fbb('0xd3')]+_0x2cc926[_0x2fbb('0xe9')]+_0x2cc926['countmachineretry']+_0x2cc926[_0x2fbb('0x12d')]>=_0x1eb6e4[_0x2fbb('0x125')]-0x1){return!![];}switch(_0x414439){case 0x3:if(_0x2cc926[_0x2fbb('0x122')]>=_0x1eb6e4[_0x2fbb('0x191')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2cc926['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x2fbb('0xda')](_0x1eb6e4[_0x2fbb('0x192')],_0x2fbb('0xdc'))[_0x2fbb('0x41')](_0x2fbb('0xd2')),'ContactId':_0x2cc926[_0x2fbb('0xdd')],'ListId':_0x2cc926[_0x2fbb('0xde')],'VoiceQueueId':_0x2cc926[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x2cc926[_0x2fbb('0xe0')]||undefined})['catch'](loggerCatch(_0x2fbb('0x193')));break;case 0x5:if(_0x2cc926['countbusyretry']>=_0x1eb6e4[_0x2fbb('0x194')]-0x1){return!![];}hopperUtils[_0x2fbb('0xd9')]({'active':![],'countbusyretry':_0x2cc926[_0x2fbb('0x120')]+=0x1,'scheduledat':moment()['add'](_0x1eb6e4[_0x2fbb('0x195')],'minutes')[_0x2fbb('0x41')](_0x2fbb('0xd2')),'ContactId':_0x2cc926['ContactId'],'ListId':_0x2cc926[_0x2fbb('0xde')],'VoiceQueueId':_0x2cc926[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x2cc926[_0x2fbb('0xe0')]||undefined})[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x196')));break;case 0x8:if(_0x2cc926[_0x2fbb('0x121')]>=_0x1eb6e4[_0x2fbb('0x197')]-0x1){return!![];}hopperUtils[_0x2fbb('0xd9')]({'active':![],'countcongestionretry':_0x2cc926['countcongestionretry']+=0x1,'scheduledat':moment()[_0x2fbb('0xda')](_0x1eb6e4[_0x2fbb('0x198')],_0x2fbb('0xdc'))[_0x2fbb('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cc926[_0x2fbb('0xdd')],'ListId':_0x2cc926[_0x2fbb('0xde')],'VoiceQueueId':_0x2cc926[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x2cc926[_0x2fbb('0xe0')]||undefined})[_0x2fbb('0x9f')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2cc926['countnosuchnumberretry']>=_0x1eb6e4['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x2fbb('0xd9')]({'active':![],'countnosuchnumberretry':_0x2cc926['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x2fbb('0xda')](_0x1eb6e4['dialNoSuchNumberRetryFrequency'],_0x2fbb('0xdc'))[_0x2fbb('0x41')](_0x2fbb('0xd2')),'ContactId':_0x2cc926[_0x2fbb('0xdd')],'ListId':_0x2cc926[_0x2fbb('0xde')],'VoiceQueueId':_0x2cc926[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x2cc926['CampaignId']||undefined})[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x199')));}break;case 0xa:if(_0x2cc926['countdropretry']>=_0x1eb6e4['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x2fbb('0xd9')]({'active':![],'countdropretry':_0x2cc926[_0x2fbb('0xd3')]+=0x1,'scheduledat':moment()[_0x2fbb('0xda')](_0x1eb6e4[_0x2fbb('0xdb')],'minutes')[_0x2fbb('0x41')](_0x2fbb('0xd2')),'ContactId':_0x2cc926[_0x2fbb('0xdd')],'ListId':_0x2cc926[_0x2fbb('0xde')],'VoiceQueueId':_0x2cc926[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x2cc926[_0x2fbb('0xe0')]||undefined})[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x19a')));break;case 0xb:if(_0x2cc926[_0x2fbb('0xe9')]>=_0x1eb6e4[_0x2fbb('0xec')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2cc926[_0x2fbb('0xe9')]+=0x1,'scheduledat':moment()[_0x2fbb('0xda')](_0x1eb6e4[_0x2fbb('0xeb')],_0x2fbb('0xdc'))['format'](_0x2fbb('0xd2')),'ContactId':_0x2cc926[_0x2fbb('0xdd')],'ListId':_0x2cc926[_0x2fbb('0xde')],'VoiceQueueId':_0x2cc926[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x2cc926['CampaignId']||undefined})[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0xed')));break;case 0x13:if(_0x2cc926[_0x2fbb('0x124')]>=_0x1eb6e4[_0x2fbb('0x128')]-0x1){return!![];}hopperUtils[_0x2fbb('0xd9')]({'active':![],'countmachineretry':_0x2cc926[_0x2fbb('0x124')]+=0x1,'scheduledat':moment()[_0x2fbb('0xda')](_0x1eb6e4[_0x2fbb('0x129')],_0x2fbb('0xdc'))['format'](_0x2fbb('0xd2')),'ContactId':_0x2cc926[_0x2fbb('0xdd')],'ListId':_0x2cc926[_0x2fbb('0xde')],'VoiceQueueId':_0x2cc926[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x2cc926[_0x2fbb('0xe0')]||undefined})['catch'](loggerCatch(_0x2fbb('0x19b')));break;case 0x14:if(_0x2cc926[_0x2fbb('0x12d')]>=_0x1eb6e4[_0x2fbb('0x19c')]-0x1){return!![];}hopperUtils[_0x2fbb('0xd9')]({'active':![],'countagentrejectretry':_0x2cc926[_0x2fbb('0x12d')]+=0x1,'scheduledat':moment()[_0x2fbb('0xda')](_0x1eb6e4[_0x2fbb('0x19d')],_0x2fbb('0xdc'))[_0x2fbb('0x41')](_0x2fbb('0xd2')),'ContactId':_0x2cc926[_0x2fbb('0xdd')],'ListId':_0x2cc926[_0x2fbb('0xde')],'VoiceQueueId':_0x2cc926[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x2cc926[_0x2fbb('0xe0')]||undefined})[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x19e')));break;default:return!![];}};Dialer['prototype'][_0x2fbb('0x10b')]=function(_0x39c82f,_0x40a284,_0x255580){var _0x2eb447=this;var _0x52ebbb=new History(_0x39c82f);var _0x22ebea=![];var _0x123005;var _0x4b6a12;return new Promise(function(_0x33a382,_0x4faa81){if(_['isUndefined'](_0x40a284)&&typeof _0x40a284!=='object'){return _0x4faa81(msgResponse(_0x2fbb('0x19f'),'Failure','entity\x20is\x20undefine'));}if(_['isUndefined'](_0x255580)&&typeof _0x255580!==_0x2fbb('0x160')){return _0x4faa81(msgResponse(_0x2fbb('0x19f'),_0x2fbb('0x8e'),_0x2fbb('0x1a0')));}hopperUtils[_0x2fbb('0xd4')](_0x52ebbb,_0x255580[_0x2fbb('0x1a1')],_0x40a284)[_0x2fbb('0x9c')](function(_0x3af343){if(_0x3af343['additional']==0x1)_0x22ebea=!![];switch(_0x255580[_0x2fbb('0x1a1')]){case'0':_0x40a284[_0x2fbb('0x1a2')]+=0x1;_0x52ebbb['state']=0x0;_0x52ebbb[_0x2fbb('0xe1')]='NoSuchNumber';_0x52ebbb[_0x2fbb('0x123')]+=0x1;_0x52ebbb[_0x2fbb('0xea')]+=0x1;ami[_0x2fbb('0x3d')](_0x2fbb('0x1a3'),ut[_0x2fbb('0x119')](_0x39c82f,'nosuchnumber'));_0x123005=_0x40a284[_0x2fbb('0x1a4')];_0x4b6a12=_0x40a284['callAdditionalPhoneAfterMin'];hopperUtils[_0x2fbb('0xe4')](_0x52ebbb)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x11f')));if(_0x2eb447[_0x2fbb('0x1a5')](0x0,_0x39c82f,_0x40a284)&&!_0x22ebea){if(_0x52ebbb[_0x2fbb('0x123')]>=_0x40a284[_0x2fbb('0x1a6')]){_0x2eb447[_0x2fbb('0x12e')](_0x52ebbb,_0x33a382,_0x4faa81,'reason\x200\x20no\x20such\x20number....');}else{_0x2eb447[_0x2fbb('0x126')](_0x52ebbb,_0x33a382,_0x4faa81,_0x2fbb('0x1a7'));}}break;case'3':_0x40a284[_0x2fbb('0x1a8')]+=0x1;_0x52ebbb['state']=0x3;_0x52ebbb[_0x2fbb('0xe1')]=_0x2fbb('0x1a9');_0x52ebbb['countnoanswerretry']+=0x1;_0x52ebbb[_0x2fbb('0xea')]+=0x1;var _0x1f49b3=ut[_0x2fbb('0x1aa')](_0x39c82f,_0x40a284);ami[_0x2fbb('0x3d')](_0x2fbb('0x1ab'),_0x1f49b3);_0x123005=_0x40a284[_0x2fbb('0x192')];_0x4b6a12=_0x40a284['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x52ebbb)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x1ac')));if(_0x2eb447[_0x2fbb('0x1a5')](0x3,_0x39c82f,_0x40a284)&&!_0x22ebea){if(_0x52ebbb[_0x2fbb('0x122')]>=_0x40a284[_0x2fbb('0x191')]){_0x2eb447['createStateFinal'](_0x52ebbb,_0x33a382,_0x4faa81,_0x2fbb('0x1ad'));}else{_0x2eb447[_0x2fbb('0x126')](_0x52ebbb,_0x33a382,_0x4faa81,_0x2fbb('0x1ad'));}}break;case'5':_0x40a284[_0x2fbb('0x1ae')]+=0x1;_0x52ebbb[_0x2fbb('0x69')]=0x5;_0x52ebbb[_0x2fbb('0xe1')]='Busy';_0x52ebbb['countbusyretry']+=0x1;_0x52ebbb[_0x2fbb('0xea')]+=0x1;ami[_0x2fbb('0x3d')](_0x2fbb('0x1af'),ut[_0x2fbb('0x119')](_0x39c82f,_0x2fbb('0x1b0')));_0x123005=_0x40a284[_0x2fbb('0x195')];_0x4b6a12=_0x40a284[_0x2fbb('0x1b1')];hopperUtils['createHistory'](_0x52ebbb)[_0x2fbb('0x9f')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2eb447['checkRetriveMax'](0x5,_0x39c82f,_0x40a284)&&!_0x22ebea){if(_0x52ebbb[_0x2fbb('0x120')]>=_0x40a284[_0x2fbb('0x194')]){_0x2eb447[_0x2fbb('0x12e')](_0x52ebbb,_0x33a382,_0x4faa81,_0x2fbb('0x1b2'));}else{_0x2eb447[_0x2fbb('0x126')](_0x52ebbb,_0x33a382,_0x4faa81,_0x2fbb('0x1b2'));}}break;case'8':_0x40a284['outboundCongestionCallsDay']+=0x1;_0x52ebbb[_0x2fbb('0x69')]=0x8;_0x52ebbb[_0x2fbb('0xe1')]=_0x2fbb('0x1b3');_0x52ebbb[_0x2fbb('0x121')]+=0x1;_0x52ebbb['countglobal']+=0x1;_0x123005=_0x40a284[_0x2fbb('0x198')];_0x4b6a12=_0x40a284[_0x2fbb('0x1b1')];ami['emit'](_0x2fbb('0x1b4'),ut[_0x2fbb('0x119')](_0x39c82f,_0x2fbb('0x1b5')));hopperUtils['createHistory'](_0x52ebbb)[_0x2fbb('0x9f')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2eb447[_0x2fbb('0x1a5')](0x8,_0x39c82f,_0x40a284)&&!_0x22ebea){if(_0x52ebbb[_0x2fbb('0x121')]>=_0x40a284[_0x2fbb('0x197')]){_0x2eb447[_0x2fbb('0x12e')](_0x52ebbb,_0x33a382,_0x4faa81,_0x2fbb('0x1b6'));}else{_0x2eb447[_0x2fbb('0x126')](_0x52ebbb,_0x33a382,_0x4faa81,_0x2fbb('0x1b6'));}}break;case'11':_0x40a284[_0x2fbb('0x1b7')]+=0x1;_0x52ebbb['state']=0xb;_0x52ebbb[_0x2fbb('0xe1')]='Abandoned';_0x52ebbb[_0x2fbb('0xe9')]+=0x1;_0x52ebbb['countglobal']+=0x1;_0x123005=_0x40a284[_0x2fbb('0xeb')];_0x4b6a12=_0x40a284[_0x2fbb('0x1b1')];hopperUtils['createHistory'](_0x52ebbb)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0xef')));if(_0x2eb447[_0x2fbb('0x1a5')](0xb,_0x39c82f,_0x40a284)&&!_0x22ebea){if(_0x52ebbb[_0x2fbb('0xe9')]>=_0x40a284[_0x2fbb('0xec')]){_0x2eb447['createStateFinal'](_0x52ebbb,_0x33a382,_0x4faa81,'reason\x2011\x20abandoned');}else{_0x2eb447[_0x2fbb('0x126')](_0x52ebbb,_0x33a382,_0x4faa81,_0x2fbb('0x1b8'));}}break;case'20':_0x40a284[_0x2fbb('0x1b9')]+=0x1;_0x52ebbb[_0x2fbb('0x69')]=0x14;_0x52ebbb['statedesc']='AgentReject';_0x52ebbb[_0x2fbb('0x12d')]+=0x1;_0x52ebbb[_0x2fbb('0xea')]+=0x1;_0x123005=_0x40a284['dialAgentRejectRetryFrequency'];_0x4b6a12=_0x40a284[_0x2fbb('0x1b1')];ami[_0x2fbb('0x3d')](_0x2fbb('0x1ba'),ut[_0x2fbb('0x119')](_0x39c82f,_0x2fbb('0x1bb')));hopperUtils[_0x2fbb('0xe4')](_0x52ebbb)[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x1bc')));if(_0x2eb447[_0x2fbb('0x1a5')](0x14,_0x39c82f,_0x40a284)&&!_0x22ebea){if(_0x52ebbb[_0x2fbb('0x12d')]>=_0x40a284[_0x2fbb('0x19c')]){_0x2eb447[_0x2fbb('0x12e')](_0x52ebbb,_0x33a382,_0x4faa81,'reason\x2020\x20agentreject');}else{_0x2eb447['stateGlobal'](_0x52ebbb,_0x33a382,_0x4faa81,_0x2fbb('0x1bd'));}}break;default:_0x40a284[_0x2fbb('0x135')]+=0x1;_0x52ebbb[_0x2fbb('0x69')]=0xc;_0x52ebbb[_0x2fbb('0xe1')]=_0x255580[_0x2fbb('0x1a1')];_0x123005=_0x40a284['dialAgentRejectRetryFrequency'];_0x4b6a12=_0x40a284[_0x2fbb('0x1b1')];hopperUtils[_0x2fbb('0xe4')](_0x52ebbb)[_0x2fbb('0x9f')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x2eb447['checkRetriveMax'](_0x255580[_0x2fbb('0x1a1')],_0x39c82f,_0x40a284)&&!_0x22ebea){if(_0x52ebbb['countbusyretry']+_0x52ebbb[_0x2fbb('0x121')]+_0x52ebbb[_0x2fbb('0x122')]+_0x52ebbb[_0x2fbb('0x123')]+_0x52ebbb[_0x2fbb('0xd3')]+_0x52ebbb['countabandonedretry']+_0x52ebbb[_0x2fbb('0x124')]+_0x52ebbb['countagentrejectretry']>=_0x40a284['dialGlobalMaxRetry']){_0x2eb447[_0x2fbb('0x126')](_0x52ebbb,_0x33a382,_0x4faa81,_0x255580[_0x2fbb('0x1a1')]);}else{_0x2eb447[_0x2fbb('0x12e')](_0x52ebbb,_0x33a382,_0x4faa81,_0x255580[_0x2fbb('0x1a1')]);}}}})[_0x2fbb('0x9c')](function(){if(_0x22ebea){hopperUtils[_0x2fbb('0xe6')](_0x52ebbb,_0x123005,_0x4b6a12)['then'](function(){return _0x33a382(0x1);});}});});};Dialer[_0x2fbb('0x80')][_0x2fbb('0x126')]=function(_0x33a979,_0x4a4c79,_0x139994,_0x1915a2){var _0x295c58=new Final(_0x33a979);_0x295c58[_0x2fbb('0x69')]=0xf;_0x295c58[_0x2fbb('0xe1')]='Global';this[_0x2fbb('0x12e')](_0x295c58,_0x4a4c79,_0x139994,_0x1915a2);};Dialer[_0x2fbb('0x80')]['createStateFinal']=function(_0x293c58,_0x1baafc,_0x223ab0,_0x2d9e89){hopperUtils[_0x2fbb('0xcb')](_0x293c58)[_0x2fbb('0x9c')](function(){return _0x1baafc(msgResponse(_0x2fbb('0x19f'),_0x2fbb('0x10a'),_0x2d9e89));})[_0x2fbb('0x9f')](function(){return _0x223ab0(msgResponse(_0x2fbb('0x1be'),_0x2fbb('0x8e'),_0x2fbb('0x1bf')));});};Dialer['prototype'][_0x2fbb('0xb5')]=function(_0xc3703b){var _0x486a88=_0xc3703b[_0x2fbb('0x1c0')]/0x64;var _0x228dc1=_0xc3703b[_0x2fbb('0x1c1')]/(_0xc3703b[_0x2fbb('0x1c1')]+_0xc3703b[_0x2fbb('0xc6')]);var _0x5978ca=Math[_0x2fbb('0x1c2')](_0xc3703b[_0x2fbb('0x1c3')]*(_0xc3703b[_0x2fbb('0x1c4')]/0x64));var _0x1f0da1=Math[_0x2fbb('0x1c2')](_0xc3703b[_0x2fbb('0x1c3')]*(_0xc3703b[_0x2fbb('0x1c5')]/0x64));var _0x329df6=_0xc3703b[_0x2fbb('0x13c')]+_0xc3703b[_0x2fbb('0x13e')];var _0x20deef=Math[_0x2fbb('0x1c6')](_0xc3703b[_0x2fbb('0x1c7')]*_0xc3703b['erlangAbandonmentRate']*_0xc3703b[_0x2fbb('0x1c8')]*_0xc3703b[_0x2fbb('0x1c9')]);if(_['isUndefined'](_0xc3703b[_0x2fbb('0x21')])){if(!_[_0x2fbb('0x3c')](_0xc3703b[_0x2fbb('0x20')])){_0xc3703b[_0x2fbb('0x20')]=undefined;loggerPredictive['error'](_0x2fbb('0x1ca'),_0x2fbb('0x1cb'));}if(!_[_0x2fbb('0x3c')](_0xc3703b[_0x2fbb('0x60')])){loggerPredictive['error'](_0x2fbb('0x1ca'),_0x2fbb('0x1cc'));clearInterval(_0xc3703b[_0x2fbb('0x60')]);_0xc3703b['handlePredictive']=undefined;}_0xc3703b['startProgressive']=moment()[_0x2fbb('0x41')](_0x2fbb('0xd2'));loggerPredictive['info'](_0xc3703b[_0x2fbb('0x42')],_0x2fbb('0x1cd'),_0xc3703b['startProgressive']);this[_0x2fbb('0xb2')](_0xc3703b,0x1);}else if(ifInterval(_0xc3703b['dialPredictiveInterval'],_0xc3703b[_0x2fbb('0x21')])){this['handlePower'](_0xc3703b,0x1);loggerPredictiveCalls['info'](_0x2fbb('0x1ce'),_0xc3703b['startProgressive'],_0xc3703b[_0x2fbb('0x42')]);_0xc3703b[_0x2fbb('0x1c7')]=0x0;_0xc3703b[_0x2fbb('0xd0')]=0x0;}else if(_0x486a88<_0x228dc1&&_0xc3703b[_0x2fbb('0x1cf')]===_0x2fbb('0x1d0')){clearPredictiveAttributes(_0xc3703b);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x2fbb('0x1d1'),_0x228dc1,_0x2fbb('0x21'),_0xc3703b[_0x2fbb('0x42')]);}else if(_0x20deef<_0xc3703b[_0x2fbb('0xd0')]&&_0xc3703b[_0x2fbb('0x1cf')]===_0x2fbb('0x1d0')){clearPredictiveAttributes(_0xc3703b);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x1d2'),_0x2fbb('0x1d3'),_0x20deef,_0x2fbb('0x1d4'),_0xc3703b[_0x2fbb('0xd0')],_0x2fbb('0x21'),_0xc3703b[_0x2fbb('0x42')]);}else if(!ifInterval(_0xc3703b[_0x2fbb('0x1d5')],_0xc3703b[_0x2fbb('0x21')])&&_['isUndefined'](_0xc3703b['startPredictive'])&&!_['isUndefined'](_0xc3703b[_0x2fbb('0x21')])){_0xc3703b[_0x2fbb('0x20')]=moment()[_0x2fbb('0x41')](_0x2fbb('0xd2'));loggerPredictive[_0x2fbb('0x46')](_0xc3703b[_0x2fbb('0x42')],'started\x20in\x20predictive\x20at',_0xc3703b[_0x2fbb('0x20')]);hopperUtils['avgHandleTime'](_0xc3703b[_0x2fbb('0x1d5')])[_0x2fbb('0x9c')](this['getDataPredictive'](_0xc3703b))[_0x2fbb('0x9c')](mergeDataErlangB(_0xc3703b))[_0x2fbb('0x9c')](this[_0x2fbb('0x1d6')](_0xc3703b))[_0x2fbb('0x9f')](loggerCatchPredictive(_0x2fbb('0x1d7'),_0xc3703b));}else if(!ifInterval(_0xc3703b[_0x2fbb('0x1d5')],_0xc3703b[_0x2fbb('0x20')])){_0xc3703b['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0xc3703b[_0x2fbb('0x20')]=moment()[_0x2fbb('0x41')](_0x2fbb('0xd2'));loggerPredictive[_0x2fbb('0x46')](_0xc3703b['name'],_0x2fbb('0x1d8'),_0xc3703b[_0x2fbb('0x20')]);clearInterval(_0xc3703b[_0x2fbb('0x60')]);_0xc3703b['handlePredictive']=undefined;hopperUtils[_0x2fbb('0x1d9')](_0xc3703b[_0x2fbb('0x1d5')])[_0x2fbb('0x9c')](this[_0x2fbb('0x1da')](_0xc3703b))[_0x2fbb('0x9c')](mergeDataErlangB(_0xc3703b))[_0x2fbb('0x9c')](this[_0x2fbb('0x1d6')](_0xc3703b))['catch'](loggerCatchPredictive(_0x2fbb('0x1db'),_0xc3703b));}else if(_0xc3703b['predictiveIntervalAvailable']&&_0x329df6<_0xc3703b[_0x2fbb('0x1c3')]-_0x1f0da1){clearPredictiveAttributes(_0xc3703b);loggerPredictive['info'](_0xc3703b[_0x2fbb('0x42')],_0x2fbb('0x1dc'),_0x329df6,_0x2fbb('0x1dd'),_0xc3703b[_0x2fbb('0x1c3')],'-',_0x1f0da1,'=',_0xc3703b[_0x2fbb('0x1c3')]-_0x1f0da1,')');}else if(_0xc3703b[_0x2fbb('0x1c3')]&&_0x329df6>_0xc3703b[_0x2fbb('0x1c3')]+_0x5978ca){clearPredictiveAttributes(_0xc3703b);loggerPredictive[_0x2fbb('0x46')](_0xc3703b[_0x2fbb('0x42')],_0x2fbb('0x1dc'),_0x329df6,')\x20are\x20more\x20than\x20threshold\x20(',_0xc3703b[_0x2fbb('0x1c3')],'+',_0x5978ca,'=',_0xc3703b['predictiveIntervalAvailable']+_0x5978ca,')');}};Dialer['prototype'][_0x2fbb('0x1da')]=function(_0x27ba39){var _0x29e9a8=this;return function(_0x1f86ca){return new Promise(function(_0x40255f,_0x438a06){_[_0x2fbb('0x5c')](_0x27ba39,_0x1f86ca[0x0]);if(checkGetDataPredictive(_0x1f86ca[0x0])){var _0x2972c3=_0x27ba39['predictiveIntervalAvailable']=_0x27ba39[_0x2fbb('0x13e')]+_0x27ba39[_0x2fbb('0x13c')];var _0x52b9b6=_0x27ba39['dialPredictiveInterval']*0x3c;var _0x15ec6a=_0x1f86ca[0x0]['predictiveIntervalAvgTalktime']+_0x1f86ca[0x0][_0x2fbb('0x4f')];var _0x3c46e7=(_0x1f86ca[0x0][_0x2fbb('0x4a')]+_0x1f86ca[0x0][_0x2fbb('0x4c')]+_0x1f86ca[0x0][_0x2fbb('0x4e')])/_0x1f86ca[0x0][_0x2fbb('0x48')];_0x27ba39[_0x2fbb('0x1c8')]=_0x3c46e7>0x0?_0x3c46e7:0x1;switch(_0x27ba39[_0x2fbb('0x1cf')]){case _0x2fbb('0x1d0'):var _0x457863=_0x27ba39[_0x2fbb('0x1c0')]/0x64;return _0x29e9a8[_0x2fbb('0x1de')](_0x2972c3,_0x52b9b6,_0x15ec6a,_0x3c46e7,_0x457863)['then'](function(_0x508147){return _0x40255f(_0x508147);});case _0x2fbb('0x1df'):var _0x55a39a=_0x27ba39['dialPredictiveOptimizationPercentage']/0x64;return _0x29e9a8['busyFactor'](_0x2972c3,_0x52b9b6,_0x15ec6a,_0x3c46e7,_0x55a39a)[_0x2fbb('0x9c')](function(_0x525df8){return _0x40255f(_0x525df8);});default:return _0x438a06(msgResponse(_0x2fbb('0x1e0'),_0x2fbb('0x8e'),'Unknown\x20Predictive'));}}else{return _0x438a06(msgResponse('[getDataPredictive]',_0x2fbb('0x8e'),_0x2fbb('0x1e1')));}});};};Dialer['prototype'][_0x2fbb('0x1e2')]=function(_0x3f50f){var _0x4c9879=this;return function(_0x282407){return new Promise(function(_0x15d7de,_0x3b15ea){_[_0x2fbb('0x5c')](_0x3f50f,_0x282407[0x0]);if(checkGetDataPredictive(_0x282407[0x0])){loggerPredictive[_0x2fbb('0x46')](JSON['stringify'](_0x282407[0x0]));if(_0x3f50f['dialPredictiveOptimization']==='dropRate'){return _0x4c9879[_0x2fbb('0x153')](_0x3f50f['id'])[_0x2fbb('0x9c')](function(_0x5b0757){var _0x376486=_0x3f50f[_0x2fbb('0x1e3')]-_0x5b0757[0x0][_0x2fbb('0x1e4')];var _0x4c011a=_0x3f50f[_0x2fbb('0x1d5')]*0x3c;var _0x584ff0=_0x282407[0x0]['predictiveIntervalAvgTalktime']+_0x282407[0x0][_0x2fbb('0x4f')];var _0x2fffd7=(_0x282407[0x0][_0x2fbb('0x4a')]+_0x282407[0x0][_0x2fbb('0x4c')]+_0x282407[0x0][_0x2fbb('0x4e')])/_0x282407[0x0][_0x2fbb('0x48')];var _0x3b8f37=_0x3f50f[_0x2fbb('0x1c0')]/0x64;_0x3f50f[_0x2fbb('0x1e5')]=_0x5b0757[0x0][_0x2fbb('0x1e4')]||0x0;_0x3f50f[_0x2fbb('0x1c8')]=_0x2fffd7>0x0?_0x2fffd7:0x1;return _0x4c9879[_0x2fbb('0x1de')](_0x376486,_0x4c011a,_0x584ff0,_0x2fffd7,_0x3b8f37);})[_0x2fbb('0x9c')](function(_0x8555fb){return _0x15d7de(_0x8555fb);})[_0x2fbb('0x9f')](function(_0x41192f){return _0x3b15ea(msgResponse('[CatchErlangB]','Failure',JSON[_0x2fbb('0x7f')](_0x41192f)));});}if(_0x3f50f['dialPredictiveOptimization']==='agentBusyFactor'){return _0x4c9879[_0x2fbb('0x153')](_0x3f50f['id'])[_0x2fbb('0x9c')](function(_0x182f90){var _0x2d320f=_0x3f50f['loggedIn']-_0x182f90[0x0][_0x2fbb('0x1e4')];var _0x5ce731=_0x3f50f['dialPredictiveInterval']*0x3c;var _0x1991c6=_0x282407[0x0][_0x2fbb('0x50')]+_0x282407[0x0]['predictiveIntervalAvgHoldtime'];var _0x2e279b=(_0x282407[0x0][_0x2fbb('0x4a')]+_0x282407[0x0][_0x2fbb('0x4c')]+_0x282407[0x0][_0x2fbb('0x4e')])/_0x282407[0x0]['predictiveIntervalTotalCalls'];var _0x35b9eb=_0x3f50f['dialPredictiveOptimizationPercentage']/0x64;_0x3f50f[_0x2fbb('0x1e5')]=_0x182f90[0x0][_0x2fbb('0x1e4')]||0x0;_0x3f50f[_0x2fbb('0x1c8')]=_0x2e279b>0x0?_0x2e279b:0x1;return _0x4c9879[_0x2fbb('0x1e6')](_0x2d320f,_0x5ce731,_0x1991c6,_0x2e279b,_0x35b9eb);})['then'](function(_0x1a51cc){return _0x15d7de(_0x1a51cc);})[_0x2fbb('0x9f')](function(_0x1cc37a){return _0x3b15ea(msgResponse(_0x2fbb('0x1e7'),'Failure',JSON[_0x2fbb('0x7f')](_0x1cc37a)));});}}else{return _0x3b15ea(msgResponse(_0x2fbb('0x1e0'),_0x2fbb('0x8e'),_0x2fbb('0x1e1')));}});};};Dialer[_0x2fbb('0x80')]['startMethodPredictive']=function(_0x592090){var _0x4b20f1=this;return function(){var _0x2c4692=0x0;var _0x1b26de=Math['floor'](_0x592090[_0x2fbb('0x57')]*0x3e8);if(_0x1b26de>0x0){_0x1b26de=_0x1b26de<0x64?0x64:_0x1b26de;loggerPredictive[_0x2fbb('0x46')](_0x592090['name'],_0x2fbb('0x1e8'),_0x1b26de,_0x2fbb('0x1e9'));_0x592090[_0x2fbb('0x60')]=setInterval(function(){_0x4b20f1[_0x2fbb('0x60')](_0x592090);loggerPredictiveCalls[_0x2fbb('0x46')](_0x2fbb('0x1ea'),_0x2c4692+=0x1);},_0x1b26de);}else{loggerPredictive[_0x2fbb('0x46')](_0x592090[_0x2fbb('0x42')],_0x2fbb('0x1eb'));}};};Dialer[_0x2fbb('0x80')][_0x2fbb('0x1ec')]=function(_0x2f7626,_0x2522e0){var _0x1f3968=this;return function(_0x8c9b2a){if(_[_0x2fbb('0x44')](_0x8c9b2a)){if(_['isNil'](_0x2522e0[_0x2fbb('0x15a')])||!_0x2522e0[_0x2fbb('0x1ed')]){if(_0x2f7626['dialMethod']===_0x2fbb('0xb6')){_0x2f7626['queueStatusComplete']=_['isUndefined'](_0x2f7626[_0x2fbb('0x6c')])?!![]:_0x2f7626[_0x2fbb('0x6c')];var _0x504731=uuid['v4']();_0x1f3968[_0x2fbb('0xf0')][_0x504731]=new Action(_0x2f7626,_0x2522e0,_0x504731);loggerBooked[_0x2fbb('0x46')](_0x2fbb('0x1ee'),_0x504731,_0x2fbb('0x1ef'),JSON['stringify'](_0x2f7626['queueStatusComplete']),_0x2fbb('0x1f0'),_0x2f7626[_0x2fbb('0x42')]);if(_0x2f7626[_0x2fbb('0x6c')]){_0x2f7626['queueStatusComplete']=![];_0x1f3968[_0x2fbb('0x23')][_0x1f3968['actions'][_0x504731][_0x2fbb('0xc0')]]=[];ami[_0x2fbb('0x98')]({'actionid':_0x504731,'action':'queuestatus','queue':_0x2f7626[_0x2fbb('0x42')]})[_0x2fbb('0x9f')](function(){_0x1f3968[_0x2fbb('0xc4')](_0x2f7626);hopperUtils[_0x2fbb('0xd9')]({'active':![],'ContactId':_0x1f3968[_0x2fbb('0xf0')][_0x504731][_0x2fbb('0xdd')],'ListId':_0x1f3968[_0x2fbb('0xf0')][_0x504731]['ListId'],'VoiceQueueId':_0x1f3968[_0x2fbb('0xf0')][_0x504731][_0x2fbb('0xdf')]||undefined,'CampaignId':_0x1f3968[_0x2fbb('0xf0')][_0x504731]['CampaignId']||undefined})[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x1f1')));delete _0x1f3968[_0x2fbb('0xf0')][_0x504731];});}else{loggerBooked[_0x2fbb('0x46')](_0x2fbb('0x1f2'),JSON[_0x2fbb('0x7f')](_0x2f7626[_0x2fbb('0x6c')]),'Queue:\x20',_0x2f7626[_0x2fbb('0x42')]);_0x1f3968[_0x2fbb('0xc4')](_0x2f7626);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x1f3968[_0x2fbb('0xf0')][_0x504731]['ContactId'],'ListId':_0x1f3968['actions'][_0x504731]['ListId'],'VoiceQueueId':_0x1f3968[_0x2fbb('0xf0')][_0x504731][_0x2fbb('0xdf')]||undefined,'CampaignId':_0x1f3968[_0x2fbb('0xf0')][_0x504731]['CampaignId']||undefined})[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x1f1')));delete _0x1f3968[_0x2fbb('0xf0')][_0x504731];}}else{return _0x1f3968[_0x2fbb('0x1f3')](_0x2f7626,_0x2522e0);}}else{if(utils[_0x2fbb('0x5d')](undefined,_0x2522e0[_0x2fbb('0x1f4')])<_0x2f7626[_0x2fbb('0x1f5')]*0x3c){if(_0x2522e0['Agent']&&!_0x2522e0['Agent'][_0x2fbb('0x1f6')]){_0x1f3968[_0x2fbb('0x19')][_0x2fbb('0x101')](_0x2522e0['id'])[_0x2fbb('0x17')](function(){_0x1f3968[_0x2fbb('0xc4')](_0x2f7626);});}else{hopperUtils['unlockContact']({'active':![]},_0x2522e0['id'],0x1)['finally'](function(){_0x1f3968['updateOriginated'](_0x2f7626);});}}else{_0x2f7626[_0x2fbb('0x1f7')]+=0x1;_0x1f3968[_0x2fbb('0xc4')](_0x2f7626);if(_0x2f7626[_0x2fbb('0x1f8')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2522e0[_0x2fbb('0xdd')],'ListId':_0x2522e0[_0x2fbb('0xde')],'VoiceQueueId':_0x2522e0[_0x2fbb('0xdf')]||undefined,'CampaignId':_0x2522e0['CampaignId']||undefined})['catch'](loggerCatch(_0x2fbb('0x1f9')));hopperUtils[_0x2fbb('0xe4')](createObjHistory(_0x2f7626,_0x2522e0,utils['CAMPAIGN_STATUS'][_0x2fbb('0x1fa')],0x17,_0x2fbb('0x1fb')))['catch'](loggerCatch(_0x2fbb('0x1fc')));}else{_0x1f3968[_0x2fbb('0x11b')](createObjHistory(_0x2f7626,_0x2522e0,utils[_0x2fbb('0x67')]['RECALL_TIMEOUT'],0x16,_0x2fbb('0x1fd')),'[Originate][HistoryRecallClose][historyCatch]',_0x2fbb('0x1fe'));}}}}else{_0x2f7626['outboundBlacklistCallsDay']+=0x1;_0x1f3968[_0x2fbb('0x11b')](createObjHistory(_0x2f7626,_0x2522e0,utils[_0x2fbb('0x67')]['BLACKLIST'],0xd,_0x2fbb('0x1ff')),'[Originate][historyBlacklist]',_0x2fbb('0x200'));throw _0x2fbb('0x201');}};};Dialer[_0x2fbb('0x80')][_0x2fbb('0x15f')]=function(_0x3bc782){var _0x119006=this;var _0x302343=_0x3bc782[_0x2fbb('0x202')]-_0x3bc782[_0x2fbb('0x79')]-_0x3bc782[_0x2fbb('0x203')];emitCampaignSummary(_0x3bc782);if(_0x302343>0x0){if(_0x302343>this['maxNumberOriginate']){_0x302343=this['maxNumberOriginate'];}_0x3bc782[_0x2fbb('0x203')]+=_0x302343;hopperUtils[_0x2fbb('0x204')](_0x3bc782['id'],_0x302343,_0x3bc782[_0x2fbb('0x205')],_0x3bc782)['then'](function(_0x259a4c){_0x3bc782['temp']-=_0x302343;_0x3bc782['temp']=_0x3bc782[_0x2fbb('0x203')]>0x0?_0x3bc782[_0x2fbb('0x203')]:0x0;if(!utils[_0x2fbb('0x206')](_0x259a4c)){_0x3bc782[_0x2fbb('0x65')]=utils[_0x2fbb('0x67')][_0x2fbb('0x68')];logger[_0x2fbb('0x46')](_0x2fbb('0x207')+_0x3bc782['name']);}else{_0x3bc782[_0x2fbb('0x79')]+=_0x259a4c[_0x2fbb('0x147')];_0x3bc782[_0x2fbb('0x65')]=utils[_0x2fbb('0x67')]['RUNNING'];for(var _0x32e0fe=0x0;_0x32e0fe<_0x259a4c[_0x2fbb('0x147')];_0x32e0fe+=0x1){_0x3bc782[_0x2fbb('0x208')]+=0x1;if(_['isNil'](_0x259a4c[_0x32e0fe])||_[_0x2fbb('0xf6')](_0x259a4c[_0x32e0fe][_0x2fbb('0x178')])||_[_0x2fbb('0xf6')](_0x259a4c[_0x32e0fe][_0x2fbb('0x163')])){_0x119006[_0x2fbb('0x157')](_0x2fbb('0x209'),_0x3bc782,_0x259a4c[_0x32e0fe]);}else{hopperUtils[_0x2fbb('0x20a')](_[_0x2fbb('0x159')](_0x259a4c[_0x32e0fe],['CampaignId',_0x2fbb('0x163')]))[_0x2fbb('0x9c')](_0x119006[_0x2fbb('0x1ec')](_0x3bc782,_0x259a4c[_0x32e0fe]))[_0x2fbb('0x9f')](_0x119006[_0x2fbb('0x156')](_0x2fbb('0x20b'),_0x3bc782));}}}})['catch'](loggerGetContactDialer(_0x2fbb('0x20c'),_0x3bc782,_0x302343));}};Dialer['prototype'][_0x2fbb('0xb2')]=function(_0x2c17f8,_0x26d87c){var _0x5ae5f2=this;var _0x32e7c9=[];if(_0x26d87c<0x1||_0x2c17f8['dialMethod']==='booked'){_0x26d87c=0x1;}var _0x5422b2=Math[_0x2fbb('0x1c6')](_0x2c17f8[_0x2fbb('0x13c')]*_0x26d87c)-_0x2c17f8['originated']-_0x2c17f8['temp'];if(_0x2c17f8[_0x2fbb('0x20d')]>0x0){var _0x116bd3=_0x2c17f8['dialLimitQueue']-_0x2c17f8['originated']-_0x2c17f8['talking']-_0x2c17f8[_0x2fbb('0x203')]-_0x2c17f8['pTalking'];if(_0x5422b2>_0x116bd3){_0x5422b2=_0x116bd3;}}if(_0x5422b2>0x0){if(_0x2c17f8[_0x2fbb('0xb0')]===_0x2fbb('0xb6')){_0x5422b2=0x1;}if(_0x5422b2>this[_0x2fbb('0x1e')]){_0x5422b2=this[_0x2fbb('0x1e')];}_0x2c17f8['temp']+=_0x5422b2;for(var _0x57a1b3 in this[_0x2fbb('0x1c')]){if(typeof this['agents'][_0x57a1b3]!=='undefined'){if(this[_0x2fbb('0x1c')][_0x57a1b3]['state']===_0x2fbb('0x20e')&&this['agents'][_0x57a1b3][_0x2fbb('0x85')]===_0x2fbb('0x84')){_0x32e7c9[_0x2fbb('0x97')](this[_0x2fbb('0x1c')][_0x57a1b3]['id']);}}}hopperUtils['getContactDialer'](_0x2c17f8,_0x32e7c9,_0x5422b2)[_0x2fbb('0x9c')](function(_0x5290db){_0x2c17f8[_0x2fbb('0x203')]-=_0x5422b2;_0x2c17f8['temp']=_0x2c17f8[_0x2fbb('0x203')]>0x0?_0x2c17f8['temp']:0x0;if(!utils[_0x2fbb('0x206')](_0x5290db)){hopperUtils[_0x2fbb('0x20f')](_0x2c17f8)[_0x2fbb('0x9c')](sendMessageReschedule(_0x2c17f8))[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x210')));}else{_0x2c17f8[_0x2fbb('0x79')]+=_0x5290db[_0x2fbb('0x147')];_0x2c17f8[_0x2fbb('0x65')]=_0x2c17f8[_0x2fbb('0xb0')]===_0x2fbb('0xb6')?utils['CAMPAIGN_STATUS'][_0x2fbb('0x16a')]:utils['CAMPAIGN_STATUS'][_0x2fbb('0x211')];for(var _0x975e13=0x0;_0x975e13<_0x5290db[_0x2fbb('0x147')];_0x975e13+=0x1){if(_['isNil'](_0x5290db[_0x975e13])||_[_0x2fbb('0xf6')](_0x5290db[_0x975e13][_0x2fbb('0x178')])||_[_0x2fbb('0xf6')](_0x5290db[_0x975e13][_0x2fbb('0x163')])){_0x5ae5f2['emptyContact'](_0x2fbb('0x209'),_0x2c17f8,_0x5290db[_0x975e13]);}else{hopperUtils[_0x2fbb('0x212')](_[_0x2fbb('0x159')](_0x5290db[_0x975e13],['VoiceQueueId',_0x2fbb('0x163')]))['then'](_0x5ae5f2[_0x2fbb('0x1ec')](_0x2c17f8,_0x5290db[_0x975e13]))[_0x2fbb('0x9f')](_0x5ae5f2[_0x2fbb('0x156')](_0x2fbb('0x209'),_0x2c17f8));}}}})[_0x2fbb('0x9f')](loggerGetContactDialer(_0x2fbb('0x213'),_0x2c17f8,_0x5422b2));}};Dialer[_0x2fbb('0x80')][_0x2fbb('0x60')]=function(_0x48d2cf){if(_0x48d2cf[_0x2fbb('0x20d')]>0x0){var _0x5ab413=_0x48d2cf['dialLimitQueue']-_0x48d2cf[_0x2fbb('0x79')]-_0x48d2cf[_0x2fbb('0x13e')];if(_0x5ab413>0x0){this[_0x2fbb('0x214')](_0x48d2cf);}else{loggerPredictiveCalls['info'](_0x2fbb('0x215'));}}else{this[_0x2fbb('0x214')](_0x48d2cf);}};Dialer[_0x2fbb('0x80')][_0x2fbb('0x214')]=function(_0x53d2ea){var _0x363bb2=this;var _0x34d31e=[];_0x53d2ea[_0x2fbb('0x79')]+=0x1;for(var _0x12483e in this[_0x2fbb('0x1c')]){if(typeof this[_0x2fbb('0x1c')][_0x12483e]!==_0x2fbb('0x150')){if(this[_0x2fbb('0x1c')][_0x12483e][_0x2fbb('0x69')]==='not_inuse'&&this[_0x2fbb('0x1c')][_0x12483e][_0x2fbb('0x85')]===_0x2fbb('0x84')){_0x34d31e['push'](this[_0x2fbb('0x1c')][_0x12483e]['id']);}}}return this[_0x2fbb('0x216')](_0x53d2ea['id'],_0x34d31e,0x1,_0x53d2ea[_0x2fbb('0x205')],_0x53d2ea)[_0x2fbb('0x9c')](function(_0x254e99){if(!utils[_0x2fbb('0x206')](_0x254e99)){utils[_0x2fbb('0x63')](_0x53d2ea,0x1,0x0);return hopperUtils[_0x2fbb('0x20f')](_0x53d2ea)['then'](sendMessageReschedule(_0x53d2ea))[_0x2fbb('0x9f')](loggerCatch(_0x2fbb('0x210')));}else{_0x53d2ea['message']=utils[_0x2fbb('0x67')]['RUNNING'];if(_[_0x2fbb('0xf6')](_0x254e99[0x0])||_[_0x2fbb('0xf6')](_0x254e99[0x0][_0x2fbb('0x178')])||_[_0x2fbb('0xf6')](_0x254e99[0x0][_0x2fbb('0x163')])){_0x363bb2[_0x2fbb('0x157')]('[actionOriginate]\x20',_0x53d2ea,_0x254e99[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x2fbb('0x159')](_0x254e99[0x0],['VoiceQueueId','phone']))[_0x2fbb('0x9c')](_0x363bb2['checkContactBlack'](_0x53d2ea,_0x254e99[0x0]))[_0x2fbb('0x9f')](_0x363bb2[_0x2fbb('0x156')](_0x2fbb('0x217'),_0x53d2ea));}}})[_0x2fbb('0x9f')](loggerGetContactDialer('[getContactDialerPredictive]',_0x53d2ea,0x1));};Dialer['prototype'][_0x2fbb('0x1de')]=function(_0x268d4a,_0x1c55d3,_0x47de1b,_0x9c9406,_0x7846f,_0x4690ce){loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x218'));loggerPredictive['info'](_0x2fbb('0x219'),_0x268d4a);loggerPredictive[_0x2fbb('0x46')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c55d3);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x21a'),_0x47de1b);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x21b'),_0x9c9406);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x21c'),_0x7846f);loggerPredictive[_0x2fbb('0x46')]('---------------------------');return new Promise(function(_0xcb9410,_0x2b3498){if(_0x268d4a<=0x0||isNaN(_0x268d4a)){return _0x2b3498(msgResponse(_0x2fbb('0x21d'),_0x2fbb('0xbf'),_0x2fbb('0x21e')+_0x268d4a));}if(_0x47de1b<=0x0||isNaN(_0x47de1b)){return _0x2b3498(msgResponse('[abandonmentRate]','Error',_0x2fbb('0x21f')+_0x47de1b));}if(_0x9c9406<=0x0||isNaN(_0x9c9406)){return _0x2b3498(msgResponse(_0x2fbb('0x21d'),'Error',_0x2fbb('0x220')+_0x9c9406));}if(_0x1c55d3<=0x0||isNaN(_0x1c55d3)){return _0x2b3498(msgResponse(_0x2fbb('0x21d'),'Error',_0x2fbb('0x221')+_0x1c55d3));}if(_0x7846f<=0x0||isNaN(_0x7846f)){return _0x2b3498(msgResponse(_0x2fbb('0x21d'),_0x2fbb('0xbf'),_0x2fbb('0x222')+_0x7846f));}_0x4690ce=_0x4690ce||0x0;var _0x152846=0x1/_0x47de1b;var _0x378620=0x0;var _0x5a899f=0x0;var _0x2480a8=0x0;var _0x1adb49=0x0;for(var _0x337798=0x0;_0x2480a8<_0x7846f;_0x337798+=0x1){_0x5a899f=_0x337798/_0x1c55d3;_0x378620=(_0x9c9406*_0x5a899f+_0x4690ce)/_0x152846;_0x2480a8=utils['erlangb'](_0x378620,_0x268d4a);_0x1adb49=_0x378620/_0x268d4a*(0x1-utils[_0x2fbb('0x223')](_0x378620,_0x268d4a));}return _0xcb9410({'erlangCalls':_0x337798,'erlangCallToSecond':_0x1c55d3/_0x337798,'erlangAbandonmentRate':_0x2480a8,'erlangBusyFactor':_0x1adb49});});};Dialer['prototype'][_0x2fbb('0x1e6')]=function(_0x53a160,_0x1e080b,_0x5c828f,_0x4631e6,_0x138922,_0x453680){loggerPredictive[_0x2fbb('0x46')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x2fbb('0x219'),_0x53a160);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x224'),_0x1e080b);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x21a'),_0x5c828f);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x21b'),_0x4631e6);loggerPredictive[_0x2fbb('0x46')](_0x2fbb('0x225'),_0x138922);loggerPredictive['info'](_0x2fbb('0x51'));return new Promise(function(_0x21d9d0,_0x62d63c){if(_0x53a160<=0x0||isNaN(_0x53a160)){return _0x62d63c(msgResponse('[busyFactor]',_0x2fbb('0xbf'),_0x2fbb('0x21e')+_0x53a160));}if(_0x5c828f<=0x0||isNaN(_0x5c828f)){return _0x62d63c(msgResponse('[busyFactor]',_0x2fbb('0xbf'),_0x2fbb('0x21f')+_0x5c828f));}if(_0x4631e6<=0x0||isNaN(_0x4631e6)){return _0x62d63c(msgResponse(_0x2fbb('0x226'),'Error',_0x2fbb('0x220')+_0x4631e6));}if(_0x1e080b<=0x0||isNaN(_0x1e080b)){return _0x62d63c(msgResponse(_0x2fbb('0x226'),_0x2fbb('0xbf'),_0x2fbb('0x221')+_0x1e080b));}if(_0x138922<=0x0||isNaN(_0x138922)){return _0x62d63c(msgResponse('[busyFactor]',_0x2fbb('0xbf'),_0x2fbb('0x227')+_0x138922));}_0x453680=_0x453680||0x0;var _0x29bc27=0x1/_0x5c828f;var _0x24feef=0x0;var _0x441d1b=0x0;var _0x26bdcd=0x0;var _0xcfff37=0x0;for(var _0x11a9e5=0x0;_0xcfff37<_0x138922;_0x11a9e5+=0x1){_0x441d1b=_0x11a9e5/_0x1e080b;_0x24feef=(_0x4631e6*_0x441d1b+_0x453680)/_0x29bc27;_0x26bdcd=utils['erlangb'](_0x24feef,_0x53a160);_0xcfff37=_0x24feef/_0x53a160*(0x1-utils[_0x2fbb('0x223')](_0x24feef,_0x53a160));}return _0x21d9d0({'erlangCalls':_0x11a9e5,'erlangCallToSecond':_0x1e080b/_0x11a9e5,'erlangAbandonmentRate':_0x26bdcd,'erlangBusyFactor':_0xcfff37});});};module[_0x2fbb('0x228')]=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 7c4b51d..1dbbc66 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 _0x4a15=['originatecalleridname','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum'];(function(_0x3b1cf8,_0x5b79f9){var _0x5d0434=function(_0x1b6559){while(--_0x1b6559){_0x3b1cf8['push'](_0x3b1cf8['shift']());}};_0x5d0434(++_0x5b79f9);}(_0x4a15,0xb4));var _0x54a1=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0x4a15[_0x1399d6];return _0x4a9db4;};'use strict';var util=require(_0x54a1('0x0'));var _=require(_0x54a1('0x1'));var moment=require(_0x54a1('0x2'));function checkNameSurname(_0x5c6bab,_0x1c7b90,_0x3fb232){var _0x361303='';if(!_[_0x54a1('0x3')](_0x1c7b90)&&_0x54a1('0x4')===typeof _0x1c7b90){_0x361303+=_0x1c7b90;}if(!_[_0x54a1('0x3')](_0x3fb232)&&_0x54a1('0x4')===typeof _0x3fb232){_0x361303+='\x20'+_0x3fb232;}if(_0x361303!==''){return _0x361303;}return _0x5c6bab;}function Action(_0x1d03f7,_0x311651,_0x46d9bf){this['voiceQueue']=_0x1d03f7;this[_0x54a1('0x5')]=_0x46d9bf||undefined;this[_0x54a1('0x6')]=checkNameSurname(_0x311651[_0x54a1('0x7')][_0x54a1('0x8')],_0x311651['Contact'][_0x54a1('0x9')],_0x311651[_0x54a1('0x7')][_0x54a1('0xa')]);this[_0x54a1('0xb')]=_0x311651['phone'];this[_0x54a1('0xc')]=_0x1d03f7[_0x54a1('0x6')];this[_0x54a1('0xd')]=_0x311651[_0x54a1('0xd')]||![];this[_0x54a1('0xe')]=_0x1d03f7['type'];this[_0x54a1('0xf')]=_0x1d03f7[_0x54a1('0xf')]||0x3;this[_0x54a1('0x10')]=_0x311651[_0x54a1('0x10')];this[_0x54a1('0x11')]=_0x311651['countbusyretry'];this[_0x54a1('0x12')]=_0x311651['countcongestionretry'];this['countnoanswerretry']=_0x311651[_0x54a1('0x13')];this[_0x54a1('0x14')]=_0x311651[_0x54a1('0x14')];this[_0x54a1('0x15')]=_0x311651[_0x54a1('0x15')];this[_0x54a1('0x16')]=_0x311651[_0x54a1('0x16')];this[_0x54a1('0x17')]=_0x311651['countmachineretry'];this['countagentrejectretry']=_0x311651['countagentrejectretry'];this['ContactId']=_0x311651['ContactId'];this[_0x54a1('0x18')]=_0x311651[_0x54a1('0x18')];this[_0x54a1('0x19')]=_0x311651[_0x54a1('0x19')];this[_0x54a1('0x1a')]=_0x311651[_0x54a1('0x1a')];this[_0x54a1('0x1b')]=_0x311651[_0x54a1('0x1b')];this[_0x54a1('0x1c')]=_0x311651['id'];this['ContactFirstName']=_0x311651['Contact'][_0x54a1('0x9')]||'';this['starttime']=moment()[_0x54a1('0x1d')](_0x54a1('0x1e'));this[_0x54a1('0x1f')]=_0x311651['callback'];this[_0x54a1('0x20')]=_0x311651[_0x54a1('0x20')];this['callbackat']=_0x311651[_0x54a1('0x21')];this['recallme']=_0x311651['recallme'];this[_0x54a1('0x22')]='';this[_0x54a1('0x23')]='';}Action[_0x54a1('0x24')]['getCaller']=function(){return util[_0x54a1('0x1d')](_0x54a1('0x25'),this['name'],this[_0x54a1('0x26')][_0x54a1('0x27')]>0x0?this[_0x54a1('0xb')][_0x54a1('0x28')](this['voiceQueue'][_0x54a1('0x27')]):this[_0x54a1('0xb')]);};Action[_0x54a1('0x24')][_0x54a1('0x29')]=function(){return this[_0x54a1('0xc')];};module[_0x54a1('0x2a')]=Action; \ No newline at end of file +var _0x13a1=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','prototype','getCaller','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x5db198,_0x215ff0){var _0x3c6414=function(_0x540eca){while(--_0x540eca){_0x5db198['push'](_0x5db198['shift']());}};_0x3c6414(++_0x215ff0);}(_0x13a1,0x19e));var _0x113a=function(_0x2e77d1,_0x285710){_0x2e77d1=_0x2e77d1-0x0;var _0x2adecc=_0x13a1[_0x2e77d1];return _0x2adecc;};'use strict';var util=require(_0x113a('0x0'));var _=require(_0x113a('0x1'));var moment=require(_0x113a('0x2'));function checkNameSurname(_0x3ea4cb,_0x5e5c0f,_0x41f0ba){var _0xf80eb7='';if(!_[_0x113a('0x3')](_0x5e5c0f)&&_0x113a('0x4')===typeof _0x5e5c0f){_0xf80eb7+=_0x5e5c0f;}if(!_[_0x113a('0x3')](_0x41f0ba)&&_0x113a('0x4')===typeof _0x41f0ba){_0xf80eb7+='\x20'+_0x41f0ba;}if(_0xf80eb7!==''){return _0xf80eb7;}return _0x3ea4cb;}function Action(_0x241994,_0xffcf04,_0x24bc3b){this[_0x113a('0x5')]=_0x241994;this[_0x113a('0x6')]=_0x24bc3b||undefined;this[_0x113a('0x7')]=checkNameSurname(_0xffcf04[_0x113a('0x8')][_0x113a('0x9')],_0xffcf04[_0x113a('0x8')][_0x113a('0xa')],_0xffcf04[_0x113a('0x8')][_0x113a('0xb')]);this[_0x113a('0xc')]=_0xffcf04[_0x113a('0x9')];this[_0x113a('0xd')]=_0x241994[_0x113a('0x7')];this[_0x113a('0xe')]=_0xffcf04[_0x113a('0xe')]||![];this[_0x113a('0xf')]=_0x241994[_0x113a('0xf')];this['dialQueueTimeout']=_0x241994[_0x113a('0x10')]||0x3;this[_0x113a('0x11')]=_0xffcf04[_0x113a('0x11')];this['countbusyretry']=_0xffcf04[_0x113a('0x12')];this[_0x113a('0x13')]=_0xffcf04[_0x113a('0x13')];this[_0x113a('0x14')]=_0xffcf04['countnoanswerretry'];this[_0x113a('0x15')]=_0xffcf04[_0x113a('0x15')];this['countdropretry']=_0xffcf04[_0x113a('0x16')];this['countabandonedretry']=_0xffcf04[_0x113a('0x17')];this[_0x113a('0x18')]=_0xffcf04[_0x113a('0x18')];this['countagentrejectretry']=_0xffcf04[_0x113a('0x19')];this[_0x113a('0x1a')]=_0xffcf04[_0x113a('0x1a')];this[_0x113a('0x1b')]=_0xffcf04[_0x113a('0x1b')];this[_0x113a('0x1c')]=_0xffcf04['UserId'];this[_0x113a('0x1d')]=_0xffcf04[_0x113a('0x1d')];this[_0x113a('0x1e')]=_0xffcf04[_0x113a('0x1e')];this[_0x113a('0x1f')]=_0xffcf04['id'];this[_0x113a('0x20')]=_0xffcf04['Contact'][_0x113a('0xa')]||'';this['starttime']=moment()[_0x113a('0x21')](_0x113a('0x22'));this[_0x113a('0x23')]=_0xffcf04[_0x113a('0x23')];this[_0x113a('0x24')]=_0xffcf04[_0x113a('0x24')];this[_0x113a('0x25')]=_0xffcf04[_0x113a('0x25')];this[_0x113a('0x26')]=_0xffcf04['recallme'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x113a('0x27')][_0x113a('0x28')]=function(){return util[_0x113a('0x21')]('\x22%s\x22\x20<%s>',this[_0x113a('0x7')],this[_0x113a('0x5')][_0x113a('0x29')]>0x0?this[_0x113a('0xc')][_0x113a('0x2a')](this[_0x113a('0x5')][_0x113a('0x29')]):this[_0x113a('0xc')]);};Action['prototype']['getQueue']=function(){return this['queue'];};module[_0x113a('0x2b')]=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 a5975aa..ef94c77 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 _0xfdba=['agiafterat','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x58f2ff,_0x3de889){var _0x575a6f=function(_0x808da3){while(--_0x808da3){_0x58f2ff['push'](_0x58f2ff['shift']());}};_0x575a6f(++_0x3de889);}(_0xfdba,0xb1));var _0xafdb=function(_0x4554c0,_0x486ed1){_0x4554c0=_0x4554c0-0x0;var _0x4491bf=_0xfdba[_0x4554c0];return _0x4491bf;};'use strict';var moment=require(_0xafdb('0x0'));var utils=require(_0xafdb('0x1'));function AgentComplete(_0x45f89e,_0x100424){this[_0xafdb('0x2')]=0x4;this[_0xafdb('0x3')]=_0xafdb('0x4');this['scheduledat']=_0x45f89e[_0xafdb('0x5')];this[_0xafdb('0x6')]=_0x45f89e[_0xafdb('0x6')];this[_0xafdb('0x7')]=_0x45f89e[_0xafdb('0x6')]==='outbound'?'queue':_0x45f89e['type'];this[_0xafdb('0x8')]=_0x45f89e[_0xafdb('0x8')];this['countcongestionretry']=_0x45f89e[_0xafdb('0x9')];this[_0xafdb('0xa')]=_0x45f89e[_0xafdb('0xa')];this[_0xafdb('0xb')]=_0x45f89e['countbusyretry']+_0x45f89e['countcongestionretry']+_0x45f89e[_0xafdb('0xa')]+_0x45f89e[_0xafdb('0xc')]+_0x45f89e[_0xafdb('0xd')]+_0x45f89e[_0xafdb('0xe')]+_0x45f89e[_0xafdb('0xf')]+_0x45f89e['countagentrejectretry'];this[_0xafdb('0xc')]=_0x45f89e[_0xafdb('0xc')];this[_0xafdb('0xd')]=_0x45f89e['countdropretry'];this[_0xafdb('0xe')]=_0x45f89e[_0xafdb('0xe')];this[_0xafdb('0xf')]=_0x45f89e[_0xafdb('0xf')];this[_0xafdb('0x10')]=_0x45f89e[_0xafdb('0x10')];this[_0xafdb('0x11')]=_0x100424['uniqueid'];this['calleridname']=_0x45f89e[_0xafdb('0x12')];this['calleridnum']=_0x45f89e[_0xafdb('0x13')];this[_0xafdb('0x14')]=_0x45f89e['starttime'];this['responsetime']=_0x45f89e[_0xafdb('0x15')];this[_0xafdb('0x16')]=_0x45f89e['answertime'];this[_0xafdb('0x17')]=moment()[_0xafdb('0x18')](_0xafdb('0x19'));this[_0xafdb('0x1a')]=utils['getSeconds'](_0x45f89e[_0xafdb('0x15')],_0x45f89e['starttime']);this[_0xafdb('0x1b')]=utils['getSeconds'](_0x45f89e['answertime'],_0x45f89e[_0xafdb('0x15')]);this[_0xafdb('0x1c')]=utils[_0xafdb('0x1d')](this[_0xafdb('0x17')],_0x45f89e[_0xafdb('0x16')]);this[_0xafdb('0x1e')]=_0x100424[_0xafdb('0x1e')];this[_0xafdb('0x1f')]=_0x100424['membername'];this[_0xafdb('0x20')]=_0x100424[_0xafdb('0x20')];this[_0xafdb('0x21')]=_0x45f89e[_0xafdb('0x21')];this[_0xafdb('0x22')]=_0x45f89e[_0xafdb('0x22')];this['callbackat']=_0x45f89e['callbackat'];this[_0xafdb('0x23')]=_0x45f89e[_0xafdb('0x23')];this['ContactId']=_0x45f89e[_0xafdb('0x24')];this[_0xafdb('0x25')]=_0x45f89e[_0xafdb('0x25')];this['UserId']=_0x45f89e[_0xafdb('0x26')];this[_0xafdb('0x27')]=_0x45f89e['VoiceQueueId'];this['CampaignId']=_0x45f89e[_0xafdb('0x28')];this[_0xafdb('0x29')]=_0x45f89e[_0xafdb('0x29')]||'';this['originatecalleridname']=_0x45f89e[_0xafdb('0x2a')]||'';this[_0xafdb('0x2b')]=_0x45f89e[_0xafdb('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x9764=['name','calleridnum','number','starttime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x1f0024,_0x72cfd3){var _0x5a8eb5=function(_0x1b30cd){while(--_0x1b30cd){_0x1f0024['push'](_0x1f0024['shift']());}};_0x5a8eb5(++_0x72cfd3);}(_0x9764,0x7a));var _0x4976=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9764[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x4976('0x0'));var utils=require(_0x4976('0x1'));function AgentComplete(_0x2bde2c,_0x4a6b75){this[_0x4976('0x2')]=0x4;this[_0x4976('0x3')]=_0x4976('0x4');this[_0x4976('0x5')]=_0x2bde2c[_0x4976('0x5')];this['type']=_0x2bde2c[_0x4976('0x6')];this[_0x4976('0x7')]=_0x2bde2c[_0x4976('0x6')]==='outbound'?_0x4976('0x8'):_0x2bde2c[_0x4976('0x6')];this['countbusyretry']=_0x2bde2c[_0x4976('0x9')];this[_0x4976('0xa')]=_0x2bde2c[_0x4976('0xa')];this[_0x4976('0xb')]=_0x2bde2c[_0x4976('0xb')];this[_0x4976('0xc')]=_0x2bde2c[_0x4976('0x9')]+_0x2bde2c['countcongestionretry']+_0x2bde2c['countnoanswerretry']+_0x2bde2c[_0x4976('0xd')]+_0x2bde2c['countdropretry']+_0x2bde2c[_0x4976('0xe')]+_0x2bde2c[_0x4976('0xf')]+_0x2bde2c[_0x4976('0x10')];this[_0x4976('0xd')]=_0x2bde2c[_0x4976('0xd')];this['countdropretry']=_0x2bde2c['countdropretry'];this[_0x4976('0xe')]=_0x2bde2c[_0x4976('0xe')];this[_0x4976('0xf')]=_0x2bde2c['countmachineretry'];this[_0x4976('0x10')]=_0x2bde2c['countagentrejectretry'];this[_0x4976('0x11')]=_0x4a6b75[_0x4976('0x11')];this[_0x4976('0x12')]=_0x2bde2c[_0x4976('0x13')];this[_0x4976('0x14')]=_0x2bde2c[_0x4976('0x15')];this['starttime']=_0x2bde2c[_0x4976('0x16')];this['responsetime']=_0x2bde2c['responsetime'];this['answertime']=_0x2bde2c[_0x4976('0x17')];this[_0x4976('0x18')]=moment()[_0x4976('0x19')](_0x4976('0x1a'));this[_0x4976('0x1b')]=utils[_0x4976('0x1c')](_0x2bde2c[_0x4976('0x1d')],_0x2bde2c[_0x4976('0x16')]);this[_0x4976('0x1e')]=utils[_0x4976('0x1c')](_0x2bde2c['answertime'],_0x2bde2c[_0x4976('0x1d')]);this[_0x4976('0x1f')]=utils[_0x4976('0x1c')](this['endtime'],_0x2bde2c[_0x4976('0x17')]);this[_0x4976('0x8')]=_0x4a6b75[_0x4976('0x8')];this[_0x4976('0x20')]=_0x4a6b75[_0x4976('0x20')];this[_0x4976('0x21')]=_0x4a6b75[_0x4976('0x21')];this['callback']=_0x2bde2c[_0x4976('0x22')];this[_0x4976('0x23')]=_0x2bde2c[_0x4976('0x23')];this[_0x4976('0x24')]=_0x2bde2c['callbackat'];this['recallme']=_0x2bde2c[_0x4976('0x25')];this[_0x4976('0x26')]=_0x2bde2c[_0x4976('0x26')];this['ListId']=_0x2bde2c[_0x4976('0x27')];this[_0x4976('0x28')]=_0x2bde2c[_0x4976('0x28')];this[_0x4976('0x29')]=_0x2bde2c[_0x4976('0x29')];this[_0x4976('0x2a')]=_0x2bde2c[_0x4976('0x2a')];this[_0x4976('0x2b')]=_0x2bde2c[_0x4976('0x2b')]||'';this[_0x4976('0x2c')]=_0x2bde2c[_0x4976('0x2c')]||'';this[_0x4976('0x2d')]=_0x2bde2c[_0x4976('0x2d')];}module[_0x4976('0x2e')]=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 aa2a71b..1a48565 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 _0x8d1f=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime'];(function(_0x2a9a61,_0x454bc8){var _0x9ed4c2=function(_0x1ac86c){while(--_0x1ac86c){_0x2a9a61['push'](_0x2a9a61['shift']());}};_0x9ed4c2(++_0x454bc8);}(_0x8d1f,0x7a));var _0xf8d1=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8d1f[_0x3e5086];return _0xfeb102;};'use strict';function Final(_0x30ace3){this[_0xf8d1('0x0')]=_0x30ace3['uniqueid'];this[_0xf8d1('0x1')]=_0x30ace3[_0xf8d1('0x1')];this['type']=_0x30ace3[_0xf8d1('0x2')];this[_0xf8d1('0x3')]=_0x30ace3[_0xf8d1('0x2')]===_0xf8d1('0x4')?'queue':_0x30ace3[_0xf8d1('0x2')];this['countbusyretry']=_0x30ace3[_0xf8d1('0x5')];this['countcongestionretry']=_0x30ace3[_0xf8d1('0x6')];this['countnoanswerretry']=_0x30ace3[_0xf8d1('0x7')];this[_0xf8d1('0x8')]=_0x30ace3[_0xf8d1('0x5')]+_0x30ace3[_0xf8d1('0x6')]+_0x30ace3['countnoanswerretry']+_0x30ace3['countnosuchnumberretry']+_0x30ace3[_0xf8d1('0x9')]+_0x30ace3[_0xf8d1('0xa')]+_0x30ace3[_0xf8d1('0xb')]+_0x30ace3[_0xf8d1('0xc')];this['countnosuchnumberretry']=_0x30ace3[_0xf8d1('0xd')];this[_0xf8d1('0x9')]=_0x30ace3[_0xf8d1('0x9')];this[_0xf8d1('0xa')]=_0x30ace3[_0xf8d1('0xa')];this['countmachineretry']=_0x30ace3[_0xf8d1('0xb')];this['countagentrejectretry']=_0x30ace3[_0xf8d1('0xc')];this[_0xf8d1('0xe')]=_0x30ace3[_0xf8d1('0xe')];this[_0xf8d1('0xf')]=_0x30ace3[_0xf8d1('0xf')];this['calleridnum']=_0x30ace3[_0xf8d1('0x10')];this['starttime']=_0x30ace3[_0xf8d1('0x11')];this[_0xf8d1('0x12')]=_0x30ace3[_0xf8d1('0x12')];this[_0xf8d1('0x13')]=_0x30ace3['responsetime'];this['ringtime']=_0x30ace3[_0xf8d1('0x14')]||0x0;this['holdtime']=_0x30ace3[_0xf8d1('0x15')]||0x0;this[_0xf8d1('0x16')]=_0x30ace3['talktime']||0x0;this[_0xf8d1('0x17')]=_0x30ace3['callback'];this[_0xf8d1('0x18')]=_0x30ace3[_0xf8d1('0x18')];this[_0xf8d1('0x19')]=_0x30ace3[_0xf8d1('0x19')];this['recallme']=_0x30ace3[_0xf8d1('0x1a')];this[_0xf8d1('0x1b')]=_0x30ace3[_0xf8d1('0x1b')];this[_0xf8d1('0x1c')]=_0x30ace3[_0xf8d1('0x1c')];this[_0xf8d1('0x1d')]=_0x30ace3[_0xf8d1('0x1d')];this[_0xf8d1('0x1e')]=_0x30ace3['VoiceQueueId'];this[_0xf8d1('0x1f')]=_0x30ace3[_0xf8d1('0x1f')];this['originatecalleridnum']=_0x30ace3['originatecalleridnum']||'';this[_0xf8d1('0x20')]=_0x30ace3['originatecalleridname']||'';this[_0xf8d1('0x21')]=_0x30ace3[_0xf8d1('0x21')];this[_0xf8d1('0x22')]=_0x30ace3[_0xf8d1('0x22')];}module['exports']=Final; \ No newline at end of file +var _0x3fcf=['campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat'];(function(_0x372ee1,_0x45c637){var _0x31ea06=function(_0x3aba6a){while(--_0x3aba6a){_0x372ee1['push'](_0x372ee1['shift']());}};_0x31ea06(++_0x45c637);}(_0x3fcf,0x1e8));var _0xf3fc=function(_0x364344,_0x252a0d){_0x364344=_0x364344-0x0;var _0xde4dbc=_0x3fcf[_0x364344];return _0xde4dbc;};'use strict';function Final(_0x3db243){this[_0xf3fc('0x0')]=_0x3db243[_0xf3fc('0x0')];this['scheduledat']=_0x3db243[_0xf3fc('0x1')];this['type']=_0x3db243['type'];this[_0xf3fc('0x2')]=_0x3db243[_0xf3fc('0x3')]===_0xf3fc('0x4')?_0xf3fc('0x5'):_0x3db243[_0xf3fc('0x3')];this['countbusyretry']=_0x3db243[_0xf3fc('0x6')];this[_0xf3fc('0x7')]=_0x3db243['countcongestionretry'];this[_0xf3fc('0x8')]=_0x3db243[_0xf3fc('0x8')];this[_0xf3fc('0x9')]=_0x3db243[_0xf3fc('0x6')]+_0x3db243[_0xf3fc('0x7')]+_0x3db243[_0xf3fc('0x8')]+_0x3db243[_0xf3fc('0xa')]+_0x3db243['countdropretry']+_0x3db243[_0xf3fc('0xb')]+_0x3db243[_0xf3fc('0xc')]+_0x3db243[_0xf3fc('0xd')];this[_0xf3fc('0xa')]=_0x3db243[_0xf3fc('0xa')];this[_0xf3fc('0xe')]=_0x3db243['countdropretry'];this[_0xf3fc('0xb')]=_0x3db243[_0xf3fc('0xb')];this['countmachineretry']=_0x3db243[_0xf3fc('0xc')];this['countagentrejectretry']=_0x3db243[_0xf3fc('0xd')];this['queue']=_0x3db243['queue'];this['calleridname']=_0x3db243['calleridname'];this[_0xf3fc('0xf')]=_0x3db243[_0xf3fc('0xf')];this[_0xf3fc('0x10')]=_0x3db243['starttime'];this[_0xf3fc('0x11')]=_0x3db243[_0xf3fc('0x11')];this[_0xf3fc('0x12')]=_0x3db243[_0xf3fc('0x11')];this[_0xf3fc('0x13')]=_0x3db243['ringtime']||0x0;this[_0xf3fc('0x14')]=_0x3db243[_0xf3fc('0x14')]||0x0;this[_0xf3fc('0x15')]=_0x3db243[_0xf3fc('0x15')]||0x0;this[_0xf3fc('0x16')]=_0x3db243[_0xf3fc('0x16')];this[_0xf3fc('0x17')]=_0x3db243[_0xf3fc('0x17')];this[_0xf3fc('0x18')]=_0x3db243['callbackat'];this[_0xf3fc('0x19')]=_0x3db243[_0xf3fc('0x19')];this[_0xf3fc('0x1a')]=_0x3db243['ContactId'];this[_0xf3fc('0x1b')]=_0x3db243['ListId'];this[_0xf3fc('0x1c')]=_0x3db243[_0xf3fc('0x1c')];this[_0xf3fc('0x1d')]=_0x3db243[_0xf3fc('0x1d')];this[_0xf3fc('0x1e')]=_0x3db243[_0xf3fc('0x1e')];this[_0xf3fc('0x1f')]=_0x3db243[_0xf3fc('0x1f')]||'';this[_0xf3fc('0x20')]=_0x3db243[_0xf3fc('0x20')]||'';this[_0xf3fc('0x21')]=_0x3db243[_0xf3fc('0x21')];this['statedesc']=_0x3db243[_0xf3fc('0x22')];}module['exports']=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 8c6c927..4e54482 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 _0xc973=['exports','moment','../utils','state','statedesc','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId'];(function(_0x450a0d,_0x21839f){var _0x41e651=function(_0x174efa){while(--_0x174efa){_0x450a0d['push'](_0x450a0d['shift']());}};_0x41e651(++_0x21839f);}(_0xc973,0xf1));var _0x3c97=function(_0x10b41f,_0x883b07){_0x10b41f=_0x10b41f-0x0;var _0x179515=_0xc973[_0x10b41f];return _0x179515;};'use strict';var moment=require(_0x3c97('0x0'));var utils=require(_0x3c97('0x1'));function Hangup(_0x2efaab,_0x31fd0c){this[_0x3c97('0x2')]=0x4;this[_0x3c97('0x3')]='Answer';this[_0x3c97('0x4')]=_0x2efaab['scheduledat'];this[_0x3c97('0x5')]=_0x2efaab[_0x3c97('0x5')];this['campaigntype']=_0x2efaab[_0x3c97('0x5')]===_0x3c97('0x6')?_0x3c97('0x7'):_0x2efaab['type'];this[_0x3c97('0x8')]=_0x2efaab[_0x3c97('0x8')]||![];this[_0x3c97('0x9')]=_0x2efaab[_0x3c97('0x9')];this['countcongestionretry']=_0x2efaab[_0x3c97('0xa')];this[_0x3c97('0xb')]=_0x2efaab[_0x3c97('0xb')];this[_0x3c97('0xc')]=_0x2efaab[_0x3c97('0x9')]+_0x2efaab[_0x3c97('0xa')]+_0x2efaab[_0x3c97('0xb')]+_0x2efaab[_0x3c97('0xd')]+_0x2efaab[_0x3c97('0xe')]+_0x2efaab['countabandonedretry']+_0x2efaab[_0x3c97('0xf')]+_0x2efaab[_0x3c97('0x10')];this[_0x3c97('0xd')]=_0x2efaab[_0x3c97('0xd')];this[_0x3c97('0xe')]=_0x2efaab['countdropretry'];this[_0x3c97('0x11')]=_0x2efaab['countabandonedretry'];this[_0x3c97('0xf')]=_0x2efaab[_0x3c97('0xf')];this[_0x3c97('0x10')]=_0x2efaab['countagentrejectretry'];this[_0x3c97('0x12')]=_0x31fd0c['uniqueid'];this[_0x3c97('0x13')]=_0x2efaab['name'];this[_0x3c97('0x14')]=_0x2efaab[_0x3c97('0x15')];this[_0x3c97('0x16')]=_0x2efaab[_0x3c97('0x16')];this[_0x3c97('0x17')]=_0x2efaab['responsetime'];this[_0x3c97('0x18')]=moment()[_0x3c97('0x19')](_0x3c97('0x1a'));this['ringtime']=utils[_0x3c97('0x1b')](_0x2efaab[_0x3c97('0x17')],_0x2efaab['starttime']);this[_0x3c97('0x1c')]=0x0;this['talktime']=utils[_0x3c97('0x1b')](this[_0x3c97('0x18')],_0x2efaab['responsetime']);this[_0x3c97('0x7')]=_0x2efaab[_0x3c97('0x7')];this['membername']=_0x3c97('0x1d');this['reason']=_0x31fd0c[_0x3c97('0x1e')];this['callback']=_0x2efaab[_0x3c97('0x1f')];this[_0x3c97('0x20')]=_0x2efaab[_0x3c97('0x20')];this[_0x3c97('0x21')]=_0x2efaab[_0x3c97('0x21')];this[_0x3c97('0x22')]=_0x2efaab[_0x3c97('0x22')];this[_0x3c97('0x23')]=_0x2efaab[_0x3c97('0x23')];this[_0x3c97('0x24')]=_0x2efaab[_0x3c97('0x24')];this['UserId']=_0x2efaab['UserId'];this[_0x3c97('0x25')]=_0x2efaab['VoiceQueueId'];this[_0x3c97('0x26')]=_0x2efaab[_0x3c97('0x26')];}module[_0x3c97('0x27')]=Hangup; \ No newline at end of file +var _0x7f82=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x7f82,0x6f));var _0x27f8=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x7f82[_0x41d432];return _0x1650f9;};'use strict';var moment=require(_0x27f8('0x0'));var utils=require(_0x27f8('0x1'));function Hangup(_0x368b2e,_0x2f823d){this[_0x27f8('0x2')]=0x4;this[_0x27f8('0x3')]='Answer';this[_0x27f8('0x4')]=_0x368b2e['scheduledat'];this[_0x27f8('0x5')]=_0x368b2e[_0x27f8('0x5')];this['campaigntype']=_0x368b2e['type']===_0x27f8('0x6')?_0x27f8('0x7'):_0x368b2e[_0x27f8('0x5')];this[_0x27f8('0x8')]=_0x368b2e[_0x27f8('0x8')]||![];this[_0x27f8('0x9')]=_0x368b2e[_0x27f8('0x9')];this[_0x27f8('0xa')]=_0x368b2e['countcongestionretry'];this[_0x27f8('0xb')]=_0x368b2e[_0x27f8('0xb')];this[_0x27f8('0xc')]=_0x368b2e[_0x27f8('0x9')]+_0x368b2e[_0x27f8('0xa')]+_0x368b2e[_0x27f8('0xb')]+_0x368b2e[_0x27f8('0xd')]+_0x368b2e[_0x27f8('0xe')]+_0x368b2e[_0x27f8('0xf')]+_0x368b2e[_0x27f8('0x10')]+_0x368b2e[_0x27f8('0x11')];this[_0x27f8('0xd')]=_0x368b2e[_0x27f8('0xd')];this['countdropretry']=_0x368b2e['countdropretry'];this[_0x27f8('0xf')]=_0x368b2e[_0x27f8('0xf')];this[_0x27f8('0x10')]=_0x368b2e[_0x27f8('0x10')];this[_0x27f8('0x11')]=_0x368b2e[_0x27f8('0x11')];this['uniqueid']=_0x2f823d['uniqueid'];this[_0x27f8('0x12')]=_0x368b2e[_0x27f8('0x13')];this['calleridnum']=_0x368b2e[_0x27f8('0x14')];this[_0x27f8('0x15')]=_0x368b2e['starttime'];this[_0x27f8('0x16')]=_0x368b2e['responsetime'];this[_0x27f8('0x17')]=moment()[_0x27f8('0x18')](_0x27f8('0x19'));this[_0x27f8('0x1a')]=utils['getSeconds'](_0x368b2e[_0x27f8('0x16')],_0x368b2e[_0x27f8('0x15')]);this['holdtime']=0x0;this['talktime']=utils[_0x27f8('0x1b')](this[_0x27f8('0x17')],_0x368b2e[_0x27f8('0x16')]);this[_0x27f8('0x7')]=_0x368b2e[_0x27f8('0x7')];this[_0x27f8('0x1c')]=_0x27f8('0x1d');this[_0x27f8('0x1e')]=_0x2f823d['cause-txt'];this[_0x27f8('0x1f')]=_0x368b2e['callback'];this[_0x27f8('0x20')]=_0x368b2e[_0x27f8('0x20')];this[_0x27f8('0x21')]=_0x368b2e[_0x27f8('0x21')];this[_0x27f8('0x22')]=_0x368b2e['recallme'];this[_0x27f8('0x23')]=_0x368b2e['ContactId'];this[_0x27f8('0x24')]=_0x368b2e[_0x27f8('0x24')];this[_0x27f8('0x25')]=_0x368b2e[_0x27f8('0x25')];this[_0x27f8('0x26')]=_0x368b2e[_0x27f8('0x26')];this[_0x27f8('0x27')]=_0x368b2e[_0x27f8('0x27')];}module[_0x27f8('0x28')]=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 c147915..85bdcac 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 _0x6dc4=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x4da6d5,_0x41991c){var _0x1768fa=function(_0x3995b2){while(--_0x3995b2){_0x4da6d5['push'](_0x4da6d5['shift']());}};_0x1768fa(++_0x41991c);}(_0x6dc4,0x169));var _0x46dc=function(_0x1f6ed8,_0x246490){_0x1f6ed8=_0x1f6ed8-0x0;var _0x476cac=_0x6dc4[_0x1f6ed8];return _0x476cac;};'use strict';var utils=require(_0x46dc('0x0'));function History(_0x29c742){this[_0x46dc('0x1')]=_0x29c742['uniqueid'];this[_0x46dc('0x2')]=_0x29c742[_0x46dc('0x2')]||undefined;this[_0x46dc('0x3')]=_0x29c742['type'];this[_0x46dc('0x4')]=_0x29c742['type']===_0x46dc('0x5')?_0x46dc('0x6'):_0x29c742[_0x46dc('0x3')];this[_0x46dc('0x7')]=_0x29c742[_0x46dc('0x7')];this[_0x46dc('0x8')]=_0x29c742['countcongestionretry'];this['countnoanswerretry']=_0x29c742[_0x46dc('0x9')];this[_0x46dc('0xa')]=_0x29c742[_0x46dc('0x7')]+_0x29c742[_0x46dc('0x8')]+_0x29c742[_0x46dc('0x9')]+_0x29c742[_0x46dc('0xb')]+_0x29c742[_0x46dc('0xc')]+_0x29c742[_0x46dc('0xd')]+_0x29c742[_0x46dc('0xe')]+_0x29c742[_0x46dc('0xf')];this['countnosuchnumberretry']=_0x29c742[_0x46dc('0xb')];this['countdropretry']=_0x29c742[_0x46dc('0xc')];this[_0x46dc('0xd')]=_0x29c742[_0x46dc('0xd')];this['countmachineretry']=_0x29c742[_0x46dc('0xe')];this[_0x46dc('0xf')]=_0x29c742[_0x46dc('0xf')];this[_0x46dc('0x6')]=_0x29c742[_0x46dc('0x6')];this['calleridname']=_0x29c742[_0x46dc('0x10')];this[_0x46dc('0x11')]=_0x29c742['number'];this[_0x46dc('0x12')]=_0x29c742[_0x46dc('0x12')];this['responsetime']=_0x29c742[_0x46dc('0x13')];this[_0x46dc('0x14')]=_0x29c742[_0x46dc('0x13')];this[_0x46dc('0x15')]=utils[_0x46dc('0x16')](_0x29c742[_0x46dc('0x13')],_0x29c742['starttime']);this[_0x46dc('0x17')]=0x0;this[_0x46dc('0x18')]=0x0;this['callback']=_0x29c742[_0x46dc('0x19')];this[_0x46dc('0x1a')]=_0x29c742[_0x46dc('0x1a')];this[_0x46dc('0x1b')]=_0x29c742[_0x46dc('0x1b')];this[_0x46dc('0x1c')]=_0x29c742[_0x46dc('0x1c')];this[_0x46dc('0x1d')]=_0x29c742[_0x46dc('0x1d')];this[_0x46dc('0x1e')]=_0x29c742[_0x46dc('0x1e')];this[_0x46dc('0x1f')]=_0x29c742[_0x46dc('0x1f')];this[_0x46dc('0x20')]=_0x29c742['VoiceQueueId'];this[_0x46dc('0x21')]=_0x29c742['CampaignId'];this[_0x46dc('0x22')]=_0x29c742[_0x46dc('0x22')]||'';this[_0x46dc('0x23')]=_0x29c742[_0x46dc('0x23')]||'';this[_0x46dc('0x24')]=_0x29c742['state'];this[_0x46dc('0x25')]=_0x29c742[_0x46dc('0x25')];}module[_0x46dc('0x26')]=History; \ No newline at end of file +var _0x3e7b=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x50d6a1,_0x190b8a){var _0x3fec22=function(_0x2fb1cf){while(--_0x2fb1cf){_0x50d6a1['push'](_0x50d6a1['shift']());}};_0x3fec22(++_0x190b8a);}(_0x3e7b,0x1ce));var _0xb3e7=function(_0x2de96c,_0x1fd767){_0x2de96c=_0x2de96c-0x0;var _0x3fc80a=_0x3e7b[_0x2de96c];return _0x3fc80a;};'use strict';var utils=require(_0xb3e7('0x0'));function History(_0x147468){this[_0xb3e7('0x1')]=_0x147468[_0xb3e7('0x1')];this[_0xb3e7('0x2')]=_0x147468[_0xb3e7('0x2')]||undefined;this[_0xb3e7('0x3')]=_0x147468[_0xb3e7('0x3')];this[_0xb3e7('0x4')]=_0x147468['type']==='outbound'?_0xb3e7('0x5'):_0x147468[_0xb3e7('0x3')];this[_0xb3e7('0x6')]=_0x147468[_0xb3e7('0x6')];this[_0xb3e7('0x7')]=_0x147468[_0xb3e7('0x7')];this[_0xb3e7('0x8')]=_0x147468[_0xb3e7('0x8')];this[_0xb3e7('0x9')]=_0x147468[_0xb3e7('0x6')]+_0x147468[_0xb3e7('0x7')]+_0x147468[_0xb3e7('0x8')]+_0x147468[_0xb3e7('0xa')]+_0x147468['countdropretry']+_0x147468[_0xb3e7('0xb')]+_0x147468['countmachineretry']+_0x147468[_0xb3e7('0xc')];this[_0xb3e7('0xa')]=_0x147468[_0xb3e7('0xa')];this[_0xb3e7('0xd')]=_0x147468[_0xb3e7('0xd')];this[_0xb3e7('0xb')]=_0x147468['countabandonedretry'];this[_0xb3e7('0xe')]=_0x147468['countmachineretry'];this[_0xb3e7('0xc')]=_0x147468['countagentrejectretry'];this[_0xb3e7('0x5')]=_0x147468[_0xb3e7('0x5')];this[_0xb3e7('0xf')]=_0x147468[_0xb3e7('0x10')];this[_0xb3e7('0x11')]=_0x147468[_0xb3e7('0x12')];this[_0xb3e7('0x13')]=_0x147468[_0xb3e7('0x13')];this[_0xb3e7('0x14')]=_0x147468[_0xb3e7('0x14')];this[_0xb3e7('0x15')]=_0x147468['responsetime'];this[_0xb3e7('0x16')]=utils[_0xb3e7('0x17')](_0x147468[_0xb3e7('0x14')],_0x147468[_0xb3e7('0x13')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x147468[_0xb3e7('0x18')];this[_0xb3e7('0x19')]=_0x147468[_0xb3e7('0x19')];this['callbackat']=_0x147468[_0xb3e7('0x1a')];this[_0xb3e7('0x1b')]=_0x147468['recallme'];this[_0xb3e7('0x1c')]=_0x147468[_0xb3e7('0x1c')];this['ListId']=_0x147468[_0xb3e7('0x1d')];this[_0xb3e7('0x1e')]=_0x147468[_0xb3e7('0x1e')];this[_0xb3e7('0x1f')]=_0x147468[_0xb3e7('0x1f')];this[_0xb3e7('0x20')]=_0x147468['CampaignId'];this[_0xb3e7('0x21')]=_0x147468[_0xb3e7('0x21')]||'';this[_0xb3e7('0x22')]=_0x147468[_0xb3e7('0x22')]||'';this['state']=_0x147468[_0xb3e7('0x23')];this[_0xb3e7('0x24')]=_0x147468[_0xb3e7('0x24')];}module[_0xb3e7('0x25')]=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 88e1476..1ae87f3 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 _0x7600=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename'];(function(_0x316882,_0x55d02a){var _0x451a8d=function(_0x5aeeb6){while(--_0x5aeeb6){_0x316882['push'](_0x316882['shift']());}};_0x451a8d(++_0x55d02a);}(_0x7600,0x12d));var _0x0760=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x7600[_0x485b5a];return _0xd2b34d;};'use strict';var utils=require(_0x0760('0x0'));function QueueCallerAbandon(_0x493e17,_0x10535a){this['scheduledat']=_0x493e17[_0x0760('0x1')];this[_0x0760('0x2')]=_0x493e17[_0x0760('0x2')];this['campaigntype']=_0x493e17[_0x0760('0x2')]==='outbound'?_0x0760('0x3'):_0x493e17[_0x0760('0x2')];this[_0x0760('0x4')]=_0x493e17[_0x0760('0x4')];this['countcongestionretry']=_0x493e17[_0x0760('0x5')];this[_0x0760('0x6')]=_0x493e17[_0x0760('0x6')];this[_0x0760('0x7')]=_0x493e17[_0x0760('0x4')]+_0x493e17['countcongestionretry']+_0x493e17[_0x0760('0x6')]+_0x493e17[_0x0760('0x8')]+_0x493e17[_0x0760('0x9')]+_0x493e17[_0x0760('0xa')]+_0x493e17[_0x0760('0xb')]+_0x493e17[_0x0760('0xc')];this[_0x0760('0x8')]=_0x493e17[_0x0760('0x8')];this[_0x0760('0x9')]=_0x493e17[_0x0760('0x9')];this[_0x0760('0xa')]=_0x493e17[_0x0760('0xa')];this['countmachineretry']=_0x493e17[_0x0760('0xb')];this['countagentrejectretry']=_0x493e17[_0x0760('0xc')];this[_0x0760('0xd')]=_0x10535a[_0x0760('0xd')];this['calleridname']=_0x493e17[_0x0760('0xe')];this[_0x0760('0xf')]=_0x493e17[_0x0760('0x10')];this[_0x0760('0x11')]=_0x493e17['starttime'];this[_0x0760('0x12')]=_0x493e17[_0x0760('0x12')];this[_0x0760('0x13')]=_0x493e17['droptime'];this[_0x0760('0x14')]=_0x493e17[_0x0760('0x14')];this[_0x0760('0x15')]=this[_0x0760('0x13')];this[_0x0760('0x16')]=utils[_0x0760('0x17')](_0x493e17[_0x0760('0x12')],_0x493e17[_0x0760('0x11')]);this[_0x0760('0x18')]=utils[_0x0760('0x17')](this[_0x0760('0x13')],_0x493e17['responsetime']);this[_0x0760('0x19')]=0x0;this['queue']=_0x10535a[_0x0760('0x3')];this['membername']=_0x10535a[_0x0760('0x1a')];this[_0x0760('0x1b')]=_0x10535a[_0x0760('0x1b')];this[_0x0760('0x1c')]=_0x493e17[_0x0760('0x1c')];this[_0x0760('0x1d')]=_0x493e17[_0x0760('0x1d')];this['callbackat']=_0x493e17[_0x0760('0x1e')];this[_0x0760('0x1f')]=_0x493e17[_0x0760('0x1f')];this[_0x0760('0x20')]=_0x493e17[_0x0760('0x20')];this[_0x0760('0x21')]=_0x493e17[_0x0760('0x21')];this['UserId']=_0x493e17[_0x0760('0x22')];this[_0x0760('0x23')]=_0x493e17['VoiceQueueId'];this[_0x0760('0x24')]=_0x493e17[_0x0760('0x24')];this[_0x0760('0x25')]=_0x493e17[_0x0760('0x25')]||'';this[_0x0760('0x26')]=_0x493e17[_0x0760('0x26')]||'';this['agiafterat']=_0x493e17['agiafterat'];this[_0x0760('0x27')]=_0x493e17['state'];this['statedesc']=_0x493e17[_0x0760('0x28')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x7f91=['ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason'];(function(_0x1e3872,_0xaceee8){var _0x5178c8=function(_0x134387){while(--_0x134387){_0x1e3872['push'](_0x1e3872['shift']());}};_0x5178c8(++_0xaceee8);}(_0x7f91,0x93));var _0x17f9=function(_0x4eb9b7,_0x2b6622){_0x4eb9b7=_0x4eb9b7-0x0;var _0x3d8db5=_0x7f91[_0x4eb9b7];return _0x3d8db5;};'use strict';var utils=require(_0x17f9('0x0'));function QueueCallerAbandon(_0x484e9b,_0x2dd483){this['scheduledat']=_0x484e9b['scheduledat'];this[_0x17f9('0x1')]=_0x484e9b[_0x17f9('0x1')];this['campaigntype']=_0x484e9b[_0x17f9('0x1')]===_0x17f9('0x2')?_0x17f9('0x3'):_0x484e9b[_0x17f9('0x1')];this[_0x17f9('0x4')]=_0x484e9b['countbusyretry'];this['countcongestionretry']=_0x484e9b[_0x17f9('0x5')];this[_0x17f9('0x6')]=_0x484e9b['countnoanswerretry'];this['countglobal']=_0x484e9b[_0x17f9('0x4')]+_0x484e9b[_0x17f9('0x5')]+_0x484e9b[_0x17f9('0x6')]+_0x484e9b['countnosuchnumberretry']+_0x484e9b[_0x17f9('0x7')]+_0x484e9b[_0x17f9('0x8')]+_0x484e9b[_0x17f9('0x9')]+_0x484e9b[_0x17f9('0xa')];this[_0x17f9('0xb')]=_0x484e9b[_0x17f9('0xb')];this[_0x17f9('0x7')]=_0x484e9b['countdropretry'];this['countabandonedretry']=_0x484e9b['countabandonedretry'];this['countmachineretry']=_0x484e9b[_0x17f9('0x9')];this[_0x17f9('0xa')]=_0x484e9b['countagentrejectretry'];this[_0x17f9('0xc')]=_0x2dd483[_0x17f9('0xc')];this[_0x17f9('0xd')]=_0x484e9b[_0x17f9('0xe')];this[_0x17f9('0xf')]=_0x484e9b[_0x17f9('0x10')];this[_0x17f9('0x11')]=_0x484e9b[_0x17f9('0x11')];this[_0x17f9('0x12')]=_0x484e9b[_0x17f9('0x12')];this[_0x17f9('0x13')]=_0x484e9b[_0x17f9('0x13')];this[_0x17f9('0x14')]=_0x484e9b[_0x17f9('0x14')];this['endtime']=this[_0x17f9('0x13')];this[_0x17f9('0x15')]=utils[_0x17f9('0x16')](_0x484e9b[_0x17f9('0x12')],_0x484e9b[_0x17f9('0x11')]);this[_0x17f9('0x17')]=utils['getSeconds'](this[_0x17f9('0x13')],_0x484e9b['responsetime']);this[_0x17f9('0x18')]=0x0;this['queue']=_0x2dd483[_0x17f9('0x3')];this['membername']=_0x2dd483[_0x17f9('0x19')];this[_0x17f9('0x1a')]=_0x2dd483[_0x17f9('0x1a')];this[_0x17f9('0x1b')]=_0x484e9b[_0x17f9('0x1b')];this[_0x17f9('0x1c')]=_0x484e9b[_0x17f9('0x1c')];this['callbackat']=_0x484e9b[_0x17f9('0x1d')];this[_0x17f9('0x1e')]=_0x484e9b['recallme'];this[_0x17f9('0x1f')]=_0x484e9b[_0x17f9('0x1f')];this[_0x17f9('0x20')]=_0x484e9b[_0x17f9('0x20')];this[_0x17f9('0x21')]=_0x484e9b[_0x17f9('0x21')];this[_0x17f9('0x22')]=_0x484e9b['VoiceQueueId'];this[_0x17f9('0x23')]=_0x484e9b['CampaignId'];this[_0x17f9('0x24')]=_0x484e9b['originatecalleridnum']||'';this[_0x17f9('0x25')]=_0x484e9b[_0x17f9('0x25')]||'';this[_0x17f9('0x26')]=_0x484e9b[_0x17f9('0x26')];this['state']=_0x484e9b[_0x17f9('0x27')];this['statedesc']=_0x484e9b[_0x17f9('0x28')];}module[_0x17f9('0x29')]=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 77cccde..3481d8c 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x4837eb,_0x36c230){var _0x48bf8f=function(_0x16a2f2){while(--_0x16a2f2){_0x4837eb['push'](_0x4837eb['shift']());}};_0x48bf8f(++_0x36c230);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xa9e0=['catch','temp','getContactDialer','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','inspect','dialOrderByScheduledAt'];(function(_0x38a739,_0xab89fe){var _0x2b2305=function(_0x19f1b6){while(--_0x19f1b6){_0x38a739['push'](_0x38a739['shift']());}};_0x2b2305(++_0xab89fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0a9e('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x333808){return util[_0x0a9e('0x4')](_0x333808,{'showHidden':![],'depth':null});}function getContactDialer(_0x2ab90b,_0x991246,_0x981158){return cmHopper['getContactDialer'](_0x2ab90b['id'],_0x991246,_0x981158,_0x2ab90b[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x2cc193){_0x2ab90b['temp']-=_0x981158;if(_0x2ab90b['temp']<0x0){_0x2ab90b[_0x0a9e('0x7')]=0x0;}logger['error']('[getContactDialer]',inspectError(_0x2cc193));});}exports[_0x0a9e('0x8')]=getContactDialer;function getContactDialerIvr(_0xf81284,_0x307b3e){return cmHopper[_0x0a9e('0x9')](_0xf81284['id'],_0x307b3e,_0xf81284[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x4a4c56){_0xf81284['temp']-=_0x307b3e;if(_0xf81284['temp']<0x0){_0xf81284['temp']=0x0;}logger[_0x0a9e('0xa')](_0x0a9e('0xb'),inspectError(_0x4a4c56));});}exports[_0x0a9e('0x9')]=getContactDialerIvr;function countReScheduled(_0x26d672){return cmHopper[_0x0a9e('0xc')](_0x26d672)[_0x0a9e('0x6')](function(_0x5db4b0){logger[_0x0a9e('0xa')](_0x0a9e('0xd'),inspectError(_0x5db4b0));});}exports[_0x0a9e('0xc')]=countReScheduled;function rescheduleContact(_0x281129){return cmHopper[_0x0a9e('0xe')](_0x281129)[_0x0a9e('0x6')](function(_0x52a03d){logger[_0x0a9e('0xa')]('[rescheduleContact]',inspectError(_0x52a03d));});}exports[_0x0a9e('0xe')]=rescheduleContact;function unlockContact(_0x519dfd,_0x16033c,_0x12066b){return cmHopper['unlockContact'](_0x519dfd,_0x16033c,_0x12066b)[_0x0a9e('0x6')](function(_0x5a0a06){logger[_0x0a9e('0xa')](_0x0a9e('0xf'),inspectError(_0x5a0a06));});}exports[_0x0a9e('0x10')]=unlockContact;function moveContactManagedDialer(_0x205fd6){return cmHopper[_0x0a9e('0x11')](_0x205fd6)[_0x0a9e('0x6')](function(_0x530eb7){logger[_0x0a9e('0xa')](_0x0a9e('0x12'),inspectError(_0x530eb7));});}exports[_0x0a9e('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x1c696a){return cmHopperBlack[_0x0a9e('0x13')](_0x1c696a)['catch'](function(_0x2c3407){logger[_0x0a9e('0xa')]('[checkIsBlackList]',inspectError(_0x2c3407));});}exports[_0x0a9e('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5a09ef){return cmHopperBlack['checkIsBlackListIvr'](_0x5a09ef)[_0x0a9e('0x6')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x14'),inspectError(_0x432e56));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return cmHopperAdditionalPhone[_0x0a9e('0x15')](_0xfb6e48,_0x2fb0e4,_0x3b45bc)[_0x0a9e('0x6')](function(_0x42ac8f){logger[_0x0a9e('0xa')]('[verifyAdditionalPhone]',inspectError(_0x42ac8f));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x197ec0,_0x3a8e58,_0x40c424){return cmHopperAdditionalPhone[_0x0a9e('0x16')](_0x197ec0,_0x3a8e58,_0x40c424)['catch'](function(_0x384319){logger['error'](_0x0a9e('0x17'),inspectError(_0x384319));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x1dc186){return cmHopperHistory[_0x0a9e('0x18')](_0x1dc186)[_0x0a9e('0x6')](function(_0x14433c){logger[_0x0a9e('0xa')](_0x0a9e('0x19'),inspectError(_0x14433c));});}exports[_0x0a9e('0x18')]=avgHandleTime;function createHistory(_0x14de77){return cmHopperHistory['createHistory'](_0x14de77)[_0x0a9e('0x6')](function(_0x468813){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),inspectError(_0x468813));});}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 570058d..8221d79 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 _0xde54=['getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','outbound','isOutboundQueue','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','UNREACHABLE_TRUNK','DISACTIVED'];(function(_0x1b4c62,_0x294f75){var _0x5ab092=function(_0x1f9345){while(--_0x1f9345){_0x1b4c62['push'](_0x1b4c62['shift']());}};_0x5ab092(++_0x294f75);}(_0xde54,0x66));var _0x4de5=function(_0x205699,_0x3afccd){_0x205699=_0x205699-0x0;var _0xa3cf80=_0xde54[_0x205699];return _0xa3cf80;};'use strict';var _=require(_0x4de5('0x0'));var moment=require(_0x4de5('0x1'));var util=require(_0x4de5('0x2'));var logger=require(_0x4de5('0x3'))(_0x4de5('0x4'));var timezones=require(_0x4de5('0x5'))[_0x4de5('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x4de5('0x7'),'BLACKLIST':_0x4de5('0x8'),'CONTACTS_RESCHEDULED':_0x4de5('0x9'),'DEACTIVATED':_0x4de5('0xa'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x4de5('0xb'),'NO_AVAILABLE_CONTACTS':_0x4de5('0xc'),'NULL_INTERVAL':_0x4de5('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x4de5('0xe'),'QUEUE_RECALL':_0x4de5('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x4de5('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x4de5('0x11')};exports[_0x4de5('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x654556){return _0x654556[_0x4de5('0x13')]===_0x4de5('0x14');}exports[_0x4de5('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x4cd344){return _0x4cd344[_0x4de5('0x16')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x3de870){return _0x3de870[_0x4de5('0x16')]===_0x4de5('0x17');}exports[_0x4de5('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x270b5c){return _0x270b5c['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x27b1fd){return _0x27b1fd['active'];}exports[_0x4de5('0x19')]=isIVRCampaignActive;function getSeconds(_0x535c60,_0x1e5317){var _0x45d2ee=moment(_0x535c60)['milliseconds'](0x0);var _0x1e3d27=moment(_0x1e5317)[_0x4de5('0x1a')](0x0);return _0x45d2ee[_0x4de5('0x1b')](_0x1e3d27,_0x4de5('0x1c'));}exports[_0x4de5('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x260c91,_0x461f9b){var _0x384128=![];var _0x5c43ab=_0x260c91['dialMethod']!==_0x461f9b[_0x4de5('0x13')]||_0x260c91[_0x4de5('0x1e')]!==_0x461f9b['dialActive']||_0x260c91[_0x4de5('0x1f')]!==_0x461f9b[_0x4de5('0x1f')];var _0xc1aa39=_0x260c91['available']!==_0x461f9b['available']||_0x260c91[_0x4de5('0x20')]!==_0x461f9b[_0x4de5('0x20')]||_0x260c91[_0x4de5('0x21')]!==_0x461f9b['loggedInDb']||_0x260c91[_0x4de5('0x22')]!==_0x461f9b[_0x4de5('0x22')]||_0x260c91[_0x4de5('0x23')]!==_0x461f9b[_0x4de5('0x23')]||_0x260c91[_0x4de5('0x24')]!==_0x461f9b[_0x4de5('0x24')]||_0x260c91[_0x4de5('0x25')]!==_0x461f9b[_0x4de5('0x25')]||_0x260c91[_0x4de5('0x26')]!==_0x461f9b[_0x4de5('0x26')]||_0x260c91[_0x4de5('0x27')]!==_0x461f9b['originated'];if(_0x260c91[_0x4de5('0x28')]&&_0x461f9b['Trunk']){_0x384128=_0x260c91[_0x4de5('0x28')][_0x4de5('0x29')]!==_0x461f9b[_0x4de5('0x28')][_0x4de5('0x29')]||_0x260c91[_0x4de5('0x28')][_0x4de5('0x2a')]!==_0x461f9b[_0x4de5('0x28')][_0x4de5('0x2a')];}return _0x5c43ab||_0xc1aa39||_0x384128;}exports[_0x4de5('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x56290a){var _0x2b3953=null;var _0x282f73=_0x56290a[_0x4de5('0x2c')];if(_[_0x4de5('0x2d')](_0x56290a[_0x4de5('0x2e')])||_[_0x4de5('0x2d')](_0x56290a['Interval'])||_['isNil'](_0x56290a[_0x4de5('0x2f')][_0x4de5('0x30')])){_0x2b3953=CAMPAIGN_STATUS[_0x4de5('0x31')];}else if(_[_0x4de5('0x32')](_0x56290a[_0x4de5('0x2e')])||_[_0x4de5('0x32')](_0x56290a[_0x4de5('0x2f')][_0x4de5('0x30')])){_0x2b3953=CAMPAIGN_STATUS[_0x4de5('0x33')];}else if(_0x282f73&&!timezones[_0x282f73]){_0x2b3953=CAMPAIGN_STATUS[_0x4de5('0x34')];}return _0x2b3953;}function checkAnyValidTrunk(_0x4a4de4,_0x30189f){var _0x1f4924=null;var _0x444717=_0x4de5('0x35');var _0x2b6be3=[_0x4de5('0x36'),_0x4de5('0x37')];var _0x211ea4=!![];if(_0x4a4de4[_0x4de5('0x28')]&&_0x4a4de4[_0x4de5('0x28')][_0x4de5('0x2a')]){_0x444717+=_0x4a4de4[_0x4de5('0x28')]['name'];_0x1f4924=_0x30189f[_0x444717];_0x211ea4=_0x2b6be3['includes'](_0x1f4924[_0x4de5('0x38')]);}else if(_0x4a4de4[_0x4de5('0x39')]&&_0x4a4de4[_0x4de5('0x39')][_0x4de5('0x2a')]){_0x444717+=_0x4a4de4[_0x4de5('0x39')]['name'];_0x1f4924=_0x30189f[_0x444717];_0x211ea4=_0x2b6be3[_0x4de5('0x3a')](_0x1f4924[_0x4de5('0x38')]);}return _0x211ea4;}function getQueueCampaignStatusMessage(_0x6734c8,_0x566ef4){var _0x2fd2f0=CAMPAIGN_STATUS[_0x4de5('0x7')];var _0x37ea07=isPreviewCampaign(_0x6734c8);if(!isQueueCampaignActive(_0x6734c8)){if(_0x37ea07){_0x2fd2f0=CAMPAIGN_STATUS[_0x4de5('0x3b')];}else{if(_0x6734c8[_0x4de5('0x27')]===0x0&&_0x6734c8[_0x4de5('0x23')]===0x0&&_0x6734c8[_0x4de5('0x25')]===0x0&&(_0x6734c8[_0x4de5('0x24')]||0x0)===0x0){_0x2fd2f0=CAMPAIGN_STATUS[_0x4de5('0x3b')];}else{_0x2fd2f0=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x6734c8[_0x4de5('0x20')]===0x0){_0x2fd2f0=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x6734c8,_0x566ef4)){_0x2fd2f0=CAMPAIGN_STATUS[_0x4de5('0x3c')];}else if(!isPreviewCampaign(_0x6734c8)){var _0x22f00f=checkAnyValidQueueCampaignInterval(_0x6734c8);if(_0x22f00f){_0x2fd2f0=_0x22f00f;}}return _0x2fd2f0;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x41bf89){var _0xd2976a=CAMPAIGN_STATUS[_0x4de5('0x3d')];if(_0x41bf89['originated']===0x0&&_0x41bf89[_0x4de5('0x23')]===0x0&&_0x41bf89['waiting']===0x0&&(_0x41bf89[_0x4de5('0x24')]||0x0)===0x0){_0xd2976a=CAMPAIGN_STATUS['INACTIVE'];}return _0xd2976a;}exports[_0x4de5('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xde65ee){var _0x2331ee=_0xde65ee[_0x4de5('0x3f')](/"(.*?)"/);return _0x2331ee?_0x2331ee[0x1]:_0xde65ee;}exports[_0x4de5('0x40')]=extractCalleridName;function getCallerId(_0x1b861b,_0x729d5,_0x348671){if(!_[_0x4de5('0x41')](_0x348671)&&typeof _0x348671===_0x4de5('0x42')&&!_[_0x4de5('0x32')](_0x348671)){if(!_['isUndefined'](_0x729d5)&&typeof _0x729d5==='string'&&!_[_0x4de5('0x32')](_0x729d5)){return util[_0x4de5('0x43')](_0x4de5('0x44'),_0x729d5,_0x348671);}return util[_0x4de5('0x43')](_0x4de5('0x44'),_0x348671,_0x348671);}if(!_['isUndefined'](_0x1b861b)&&typeof _0x1b861b==='string'&&!_[_0x4de5('0x32')](_0x1b861b)){return _0x1b861b;}return'\x22\x22\x20<>';}exports[_0x4de5('0x45')]=getCallerId;function getCallerIdRandom(_0x4c156d,_0x55472a){var _0x3e0531;var _0x3ff9f6;var _0x5ee489;if(_0x55472a<=0x0){_0x55472a=0x1;}_0x3e0531=new RegExp(_0x4de5('0x46')+_0x55472a+'}$');_0x3ff9f6=Math[_0x4de5('0x47')](0xa,_0x55472a-0x1);_0x5ee489=Math[_0x4de5('0x47')](0xa,_0x55472a)-0x1;return util[_0x4de5('0x43')]('%s',_[_0x4de5('0x48')](_0x4c156d,_0x3e0531,_[_0x4de5('0x49')](_0x3ff9f6,_0x5ee489)[_0x4de5('0x4a')]()));}exports[_0x4de5('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x563063){if(_0x563063[_0x4de5('0x27')]&&_0x563063[_0x4de5('0x27')]>0x0){_0x563063['originated']-=0x1;}else{logger['error'](_0x4de5('0x4c'));}}exports[_0x4de5('0x4d')]=decrementOriginate;function checkContactEmpty(_0x25422b){return _0x25422b&&_0x25422b[_0x4de5('0x4e')]>0x0;}exports[_0x4de5('0x4f')]=checkContactEmpty;function erlangb(_0x56dd4d,_0x1baa34){if(_0x1baa34===0x0){return 0x0;}var _0xbceff9=0x1;for(var _0x5af8d9=0x1;_0x5af8d9<=_0x1baa34;_0x5af8d9+=0x1){_0xbceff9=0x1+_0xbceff9*_0x5af8d9/_0x56dd4d;}return 0x1/_0xbceff9;}exports[_0x4de5('0x50')]=erlangb;function checkContactLowerLimitOriginate(_0x2e2986,_0x250fb9,_0x2bc910){if(_0x250fb9>_0x2bc910){for(var _0x176ce4=0x0;_0x176ce4<_0x250fb9-_0x2bc910;_0x176ce4+=0x1){decrementOriginate(_0x2e2986);}}}exports[_0x4de5('0x51')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x7abb=['ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','dialGlobalInterval','isEmpty','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactLowerLimitOriginate','moment','util','dialer','../../../../config/environment/shared','timezones'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x7abb,0x1c9));var _0xb7ab=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7abb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var moment=require(_0xb7ab('0x0'));var util=require(_0xb7ab('0x1'));var logger=require('../../../../config/logger')(_0xb7ab('0x2'));var timezones=require(_0xb7ab('0x3'))[_0xb7ab('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xb7ab('0x5'),'BLACKLIST':_0xb7ab('0x6'),'CONTACTS_RESCHEDULED':_0xb7ab('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xb7ab('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xb7ab('0x9'),'NO_AVAILABLE_CONTACTS':_0xb7ab('0xa'),'NULL_INTERVAL':_0xb7ab('0xb'),'OVERTIME_INTERVAL':_0xb7ab('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xb7ab('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xb7ab('0xe'),'RUNNING':_0xb7ab('0xf'),'UNKNOWN_TIMEZONE':_0xb7ab('0x10'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xb7ab('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x10c956){return _0x10c956[_0xb7ab('0x12')]===_0xb7ab('0x13');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x579a30){return _0x579a30['type']===_0xb7ab('0x14');}exports[_0xb7ab('0x15')]=isIVRCampaign;function isOutboundQueue(_0x1fbe32){return _0x1fbe32['type']==='outbound';}exports[_0xb7ab('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x2d1e3f){return _0x2d1e3f[_0xb7ab('0x17')];}exports[_0xb7ab('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x279469){return _0x279469[_0xb7ab('0x19')];}exports[_0xb7ab('0x1a')]=isIVRCampaignActive;function getSeconds(_0xcce67b,_0x23f524){var _0x26194a=moment(_0xcce67b)[_0xb7ab('0x1b')](0x0);var _0x633131=moment(_0x23f524)['milliseconds'](0x0);return _0x26194a[_0xb7ab('0x1c')](_0x633131,'seconds');}exports[_0xb7ab('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x594572,_0x44cb66){var _0x48bb94=![];var _0x554541=_0x594572[_0xb7ab('0x12')]!==_0x44cb66['dialMethod']||_0x594572[_0xb7ab('0x17')]!==_0x44cb66[_0xb7ab('0x17')]||_0x594572[_0xb7ab('0x1e')]!==_0x44cb66['message'];var _0x238102=_0x594572[_0xb7ab('0x1f')]!==_0x44cb66['available']||_0x594572['loggedIn']!==_0x44cb66[_0xb7ab('0x20')]||_0x594572['loggedInDb']!==_0x44cb66[_0xb7ab('0x21')]||_0x594572[_0xb7ab('0x22')]!==_0x44cb66[_0xb7ab('0x22')]||_0x594572[_0xb7ab('0x23')]!==_0x44cb66[_0xb7ab('0x23')]||_0x594572[_0xb7ab('0x24')]!==_0x44cb66[_0xb7ab('0x24')]||_0x594572['waiting']!==_0x44cb66[_0xb7ab('0x25')]||_0x594572['inUse']!==_0x44cb66[_0xb7ab('0x26')]||_0x594572[_0xb7ab('0x27')]!==_0x44cb66[_0xb7ab('0x27')];if(_0x594572[_0xb7ab('0x28')]&&_0x44cb66[_0xb7ab('0x28')]){_0x48bb94=_0x594572['Trunk'][_0xb7ab('0x29')]!==_0x44cb66[_0xb7ab('0x28')][_0xb7ab('0x29')]||_0x594572[_0xb7ab('0x28')][_0xb7ab('0x19')]!==_0x44cb66[_0xb7ab('0x28')][_0xb7ab('0x19')];}return _0x554541||_0x238102||_0x48bb94;}exports[_0xb7ab('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x291781){var _0x2ebd36=null;var _0x2ce2b4=_0x291781[_0xb7ab('0x2b')];if(_[_0xb7ab('0x2c')](_0x291781['dialGlobalInterval'])||_[_0xb7ab('0x2c')](_0x291781[_0xb7ab('0x2d')])||_[_0xb7ab('0x2c')](_0x291781['Interval'][_0xb7ab('0x2e')])){_0x2ebd36=CAMPAIGN_STATUS[_0xb7ab('0x2f')];}else if(_['isEmpty'](_0x291781[_0xb7ab('0x30')])||_[_0xb7ab('0x31')](_0x291781['Interval'][_0xb7ab('0x2e')])){_0x2ebd36=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x2ce2b4&&!timezones[_0x2ce2b4]){_0x2ebd36=CAMPAIGN_STATUS[_0xb7ab('0x32')];}return _0x2ebd36;}function checkAnyValidTrunk(_0x377b0c,_0x44fcf1){var _0x14a623=null;var _0x5899aa=_0xb7ab('0x33');var _0xdb9f72=['reachable',_0xb7ab('0x34')];var _0x2da5fb=!![];if(_0x377b0c['Trunk']&&_0x377b0c[_0xb7ab('0x28')][_0xb7ab('0x19')]){_0x5899aa+=_0x377b0c[_0xb7ab('0x28')][_0xb7ab('0x29')];_0x14a623=_0x44fcf1[_0x5899aa];_0x2da5fb=_0xdb9f72[_0xb7ab('0x35')](_0x14a623['status']);}else if(_0x377b0c[_0xb7ab('0x36')]&&_0x377b0c['TrunkBackup']['active']){_0x5899aa+=_0x377b0c[_0xb7ab('0x36')][_0xb7ab('0x29')];_0x14a623=_0x44fcf1[_0x5899aa];_0x2da5fb=_0xdb9f72[_0xb7ab('0x35')](_0x14a623['status']);}return _0x2da5fb;}function getQueueCampaignStatusMessage(_0xdb8a9e,_0x472916){var _0x177c37=CAMPAIGN_STATUS[_0xb7ab('0x5')];var _0x5e9b6d=isPreviewCampaign(_0xdb8a9e);if(!isQueueCampaignActive(_0xdb8a9e)){if(_0x5e9b6d){_0x177c37=CAMPAIGN_STATUS[_0xb7ab('0x37')];}else{if(_0xdb8a9e[_0xb7ab('0x27')]===0x0&&_0xdb8a9e['talking']===0x0&&_0xdb8a9e[_0xb7ab('0x25')]===0x0&&(_0xdb8a9e[_0xb7ab('0x24')]||0x0)===0x0){_0x177c37=CAMPAIGN_STATUS[_0xb7ab('0x37')];}else{_0x177c37=CAMPAIGN_STATUS[_0xb7ab('0x38')];}}}else if(_0xdb8a9e[_0xb7ab('0x20')]===0x0){_0x177c37=CAMPAIGN_STATUS[_0xb7ab('0x39')];}else if(!checkAnyValidTrunk(_0xdb8a9e,_0x472916)){_0x177c37=CAMPAIGN_STATUS[_0xb7ab('0x3a')];}else if(!isPreviewCampaign(_0xdb8a9e)){var _0x210960=checkAnyValidQueueCampaignInterval(_0xdb8a9e);if(_0x210960){_0x177c37=_0x210960;}}return _0x177c37;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3b7ec4){var _0x4b2574=CAMPAIGN_STATUS['DISACTIVED'];if(_0x3b7ec4['originated']===0x0&&_0x3b7ec4[_0xb7ab('0x23')]===0x0&&_0x3b7ec4[_0xb7ab('0x25')]===0x0&&(_0x3b7ec4[_0xb7ab('0x24')]||0x0)===0x0){_0x4b2574=CAMPAIGN_STATUS['INACTIVE'];}return _0x4b2574;}exports[_0xb7ab('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x25fd08){var _0x551e36=_0x25fd08[_0xb7ab('0x3c')](/"(.*?)"/);return _0x551e36?_0x551e36[0x1]:_0x25fd08;}exports[_0xb7ab('0x3d')]=extractCalleridName;function getCallerId(_0x213150,_0x2813b1,_0x1fde0c){if(!_[_0xb7ab('0x3e')](_0x1fde0c)&&typeof _0x1fde0c===_0xb7ab('0x3f')&&!_[_0xb7ab('0x31')](_0x1fde0c)){if(!_[_0xb7ab('0x3e')](_0x2813b1)&&typeof _0x2813b1==='string'&&!_[_0xb7ab('0x31')](_0x2813b1)){return util[_0xb7ab('0x40')](_0xb7ab('0x41'),_0x2813b1,_0x1fde0c);}return util[_0xb7ab('0x40')](_0xb7ab('0x41'),_0x1fde0c,_0x1fde0c);}if(!_[_0xb7ab('0x3e')](_0x213150)&&typeof _0x213150===_0xb7ab('0x3f')&&!_[_0xb7ab('0x31')](_0x213150)){return _0x213150;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0xb5cf53,_0xc8bbf5){var _0x577adf;var _0x493478;var _0x4a80b0;if(_0xc8bbf5<=0x0){_0xc8bbf5=0x1;}_0x577adf=new RegExp(_0xb7ab('0x42')+_0xc8bbf5+'}$');_0x493478=Math[_0xb7ab('0x43')](0xa,_0xc8bbf5-0x1);_0x4a80b0=Math[_0xb7ab('0x43')](0xa,_0xc8bbf5)-0x1;return util['format']('%s',_[_0xb7ab('0x44')](_0xb5cf53,_0x577adf,_[_0xb7ab('0x45')](_0x493478,_0x4a80b0)[_0xb7ab('0x46')]()));}exports[_0xb7ab('0x47')]=getCallerIdRandom;function decrementOriginate(_0x2429d9){if(_0x2429d9[_0xb7ab('0x27')]&&_0x2429d9[_0xb7ab('0x27')]>0x0){_0x2429d9['originated']-=0x1;}else{logger[_0xb7ab('0x48')](_0xb7ab('0x49'));}}exports[_0xb7ab('0x4a')]=decrementOriginate;function checkContactEmpty(_0x25107){return _0x25107&&_0x25107[_0xb7ab('0x4b')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x24bdb7,_0x516503){if(_0x516503===0x0){return 0x0;}var _0x15fa72=0x1;for(var _0x52a527=0x1;_0x52a527<=_0x516503;_0x52a527+=0x1){_0x15fa72=0x1+_0x15fa72*_0x52a527/_0x24bdb7;}return 0x1/_0x15fa72;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x336d38,_0x4894d9,_0x56c9ae){if(_0x4894d9>_0x56c9ae){for(var _0x24a889=0x0;_0x24a889<_0x4894d9-_0x56c9ae;_0x24a889+=0x1){decrementOriginate(_0x336d38);}}}exports[_0xb7ab('0x4c')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a6aa3f6..4b3437d 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(_0x22a263,_0x560c72){var _0x2b1a24=function(_0x3477d3){while(--_0x3477d3){_0x22a263['push'](_0x22a263['shift']());}};_0x2b1a24(++_0x560c72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x4af3db,_0x22db80){var _0x291346=function(_0x502afd){while(--_0x502afd){_0x4af3db['push'](_0x4af3db['shift']());}};_0x291346(++_0x22db80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 e43e061..ba8bd0a 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 _0x7b33=['util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','./rpcDb','./channel','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','prototype','channelstate','channelstatedesc','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','create','parse','.pdf','application/pdf','notify','fax','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','pick','reason','[Fax][Message][Error][Updated]','logger','updateStatus','AttachmentId','update','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','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','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20path','Is\x20Valid','exports'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0x7b33,0x6f));var _0x37b3=function(_0x26b284,_0x1328ca){_0x26b284=_0x26b284-0x0;var _0x26dcaa=_0x7b33[_0x26b284];return _0x26dcaa;};'use strict';var util=require(_0x37b3('0x0'));var _=require(_0x37b3('0x1'));var BPromise=require(_0x37b3('0x2'));var uuid=require('uuid');var moment=require(_0x37b3('0x3'));var path=require(_0x37b3('0x4'));var tiff2pdf=require(_0x37b3('0x5'));var gs=require(_0x37b3('0x6'));var logger=require(_0x37b3('0x7'))('fax');var ami=require('../ami');var rpcDb=require(_0x37b3('0x8'));var Channel=require(_0x37b3('0x9'));var ut=require('./util/util');var Action=require(_0x37b3('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x37b3('0xb'));function Fax(_0x1e303e){this[_0x37b3('0xc')]={};this[_0x37b3('0xd')]=_0x1e303e[_0x37b3('0xd')];this[_0x37b3('0xe')]=_0x1e303e[_0x37b3('0xe')];this[_0x37b3('0xf')]={};ami['on']('newchannel',this[_0x37b3('0x10')][_0x37b3('0x11')](this));ami['on'](_0x37b3('0x12'),this[_0x37b3('0x13')][_0x37b3('0x11')](this));ami['on'](_0x37b3('0x14'),this[_0x37b3('0x15')]['bind'](this));ami['on'](_0x37b3('0x16'),this[_0x37b3('0x17')]['bind'](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x37b3('0x11')](this));ami['on'](_0x37b3('0x18'),this[_0x37b3('0x19')]['bind'](this));ami['on'](_0x37b3('0x1a'),this[_0x37b3('0x1b')][_0x37b3('0x11')](this));ami['on'](_0x37b3('0x1c'),this[_0x37b3('0x1d')]['bind'](this));}Fax['prototype']['syncNewchannel']=function(_0x4aa5b8){if(_0x4aa5b8[_0x37b3('0x1e')]==='from-voip-provider'){for(var _0xe7dc65 in this[_0x37b3('0xd')]){if(this[_0x37b3('0xd')]['hasOwnProperty'](_0xe7dc65)){if(_0x4aa5b8[_0x37b3('0x1f')]===this['faxAccounts'][_0xe7dc65]['localstationid']){this[_0x37b3('0xc')][_0x4aa5b8[_0x37b3('0x20')]]={};this[_0x37b3('0xc')][_0x4aa5b8[_0x37b3('0x20')]][_0x37b3('0x21')]=_0x4aa5b8[_0x37b3('0x21')];this[_0x37b3('0xc')][_0x4aa5b8[_0x37b3('0x20')]]['id']=this[_0x37b3('0xd')][_0xe7dc65]['id'];this[_0x37b3('0xc')][_0x4aa5b8[_0x37b3('0x20')]][_0x37b3('0x22')]=this['faxAccounts'][_0xe7dc65][_0x37b3('0x22')];logger[_0x37b3('0x23')](_0x4aa5b8['uniqueid'],_0x37b3('0x24'));}}}}if(this[_0x37b3('0xf')][_0x4aa5b8[_0x37b3('0x20')]]){this[_0x37b3('0xc')][_0x4aa5b8[_0x37b3('0x20')]]={};this['channels'][_0x4aa5b8[_0x37b3('0x20')]][_0x37b3('0x21')]=_0x4aa5b8[_0x37b3('0x21')];logger['info'](_0x4aa5b8['uniqueid'],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x37b3('0x13')]=function(_0x1b5f72){if(this[_0x37b3('0xc')][_0x1b5f72[_0x37b3('0x20')]]){for(var _0x1c5d5b in _0x1b5f72[_0x37b3('0x25')]){if(_0x1b5f72[_0x37b3('0x25')][_0x37b3('0x26')](_0x1c5d5b)){this[_0x37b3('0xc')][_0x1b5f72[_0x37b3('0x20')]][_0x1c5d5b]=_0x1b5f72[_0x37b3('0x27')];}}}};Fax[_0x37b3('0x28')][_0x37b3('0x15')]=function(_0x115907){if(this['channels'][_0x115907[_0x37b3('0x20')]]){this[_0x37b3('0xc')][_0x115907[_0x37b3('0x20')]][_0x37b3('0x29')]=_0x115907[_0x37b3('0x29')];this['channels'][_0x115907[_0x37b3('0x20')]][_0x37b3('0x2a')]=_0x115907['channelstatedesc'];}};Fax[_0x37b3('0x28')][_0x37b3('0x17')]=function(_0xad124e){if(this[_0x37b3('0xc')][_0xad124e['uniqueid']]){for(var _0x2b6069 in _0xad124e[_0x37b3('0x25')]){if(_0xad124e[_0x37b3('0x25')][_0x37b3('0x26')](_0x2b6069)){this[_0x37b3('0xc')][_0xad124e[_0x37b3('0x20')]][_0x2b6069]=_0xad124e['value'];}}}};Fax[_0x37b3('0x28')][_0x37b3('0x2b')]=function(_0x2d7abf){if(this['channels'][_0x2d7abf['uniqueid']]){this[_0x37b3('0xc')][_0x2d7abf[_0x37b3('0x20')]][_0x37b3('0x2c')]=_0x2d7abf['operation'];this[_0x37b3('0xc')][_0x2d7abf[_0x37b3('0x20')]]['status']=_0x2d7abf[_0x37b3('0x2d')];this[_0x37b3('0xc')][_0x2d7abf[_0x37b3('0x20')]][_0x37b3('0x2e')]=_0x2d7abf['localstationid'];this[_0x37b3('0xc')][_0x2d7abf[_0x37b3('0x20')]][_0x37b3('0x2f')]=_0x2d7abf[_0x37b3('0x2f')];logger[_0x37b3('0x23')](_0x2d7abf[_0x37b3('0x20')],_0x37b3('0x30'));}};Fax[_0x37b3('0x28')][_0x37b3('0x19')]=function(_0x241073){var _0x2d6e0f=this;if(this[_0x37b3('0xc')][_0x241073[_0x37b3('0x20')]]){var _0x17371b=this[_0x37b3('0xc')][_0x241073[_0x37b3('0x20')]]['id'];this[_0x37b3('0xc')][_0x241073[_0x37b3('0x20')]][_0x37b3('0x31')]=_0x241073[_0x37b3('0x31')];this[_0x37b3('0xc')][_0x241073[_0x37b3('0x20')]][_0x37b3('0x32')]=_0x241073[_0x37b3('0x32')];this[_0x37b3('0xc')][_0x241073[_0x37b3('0x20')]]['localstationid']=_0x241073['localstationid'];this[_0x37b3('0xc')][_0x241073[_0x37b3('0x20')]][_0x37b3('0x33')]=_0x241073['resolution'];this[_0x37b3('0xc')][_0x241073[_0x37b3('0x20')]]['transferrate']=_0x241073[_0x37b3('0x34')];this[_0x37b3('0xc')][_0x241073['uniqueid']][_0x37b3('0x2f')]=_0x241073[_0x37b3('0x2f')];this[_0x37b3('0xc')][_0x241073[_0x37b3('0x20')]][_0x37b3('0x35')]=_0x241073[_0x37b3('0x35')];if(this[_0x37b3('0xc')][_0x241073[_0x37b3('0x20')]][_0x37b3('0x32')]>0x0){tiff2pdf(_0x241073['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x4c6942){logger[_0x37b3('0x23')](_0x241073[_0x37b3('0x20')],'\x20result\x20conversion\x20file\x20',_0x4c6942[_0x37b3('0x36')]);attachment[_0x37b3('0x37')]({'name':path['parse'](_0x241073[_0x37b3('0x2f')])['name'],'basename':path[_0x37b3('0x38')](_0x241073[_0x37b3('0x2f')])[_0x37b3('0x22')]+_0x37b3('0x39'),'type':_0x37b3('0x3a')})['then'](function(_0x12de45){faxAccount[_0x37b3('0x3b')](_0x17371b,{'from':_0x241073[_0x37b3('0x35')],'mapKey':_0x37b3('0x3c'),'body':path[_0x37b3('0x38')](_0x241073['filename'])[_0x37b3('0x22')]+_0x37b3('0x39'),'AttachmentId':_0x12de45['id']})['catch'](function(_0x458c09){logger[_0x37b3('0x3d')](_0x241073[_0x37b3('0x20')],_0x37b3('0x3e'),JSON[_0x37b3('0x3f')](_0x458c09));});})[_0x37b3('0x40')](function(_0x1cc3b9){logger[_0x37b3('0x3d')](_0x241073['uniqueid'],_0x37b3('0x41'),JSON[_0x37b3('0x3f')](_0x1cc3b9));});});}logger[_0x37b3('0x23')](_0x241073[_0x37b3('0x20')],'\x20receiveFax\x20');}};Fax[_0x37b3('0x28')][_0x37b3('0x1d')]=function(_0x245119){if(this[_0x37b3('0xf')][_0x245119['uniqueid']]){_['merge'](this[_0x37b3('0xc')][_0x245119[_0x37b3('0x20')]],_[_0x37b3('0x42')](_0x245119,['response',_0x37b3('0x43')]));}};function updateStatus(_0x184b45){if(_0x184b45['AttachmentId']){faxMessage['update'](_0x184b45['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x305d3e){ut['logger'](_0x37b3('0x44'),_0x305d3e);})[_0x37b3('0x40')](function(_0x5d7deb){ut[_0x37b3('0x45')]('[Fax][Message][Error][NoUpdate1]',_0x5d7deb);});}else{ut[_0x37b3('0x45')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x37b3('0x28')][_0x37b3('0x46')]=function(_0x4de148,_0x4b35fc,_0xea0548){var _0x2d7c64=this;var _0x1bd5cf={};if(_0x4b35fc){_0x1bd5cf={'read':_0x4b35fc};}else{_0x1bd5cf={'failMessage':_0xea0548};}if(this[_0x37b3('0xf')][_0x4de148][_0x37b3('0x47')]){faxMessage[_0x37b3('0x48')](this[_0x37b3('0xf')][_0x4de148][_0x37b3('0x47')],_0x1bd5cf)[_0x37b3('0x49')](function(_0x44dc1d){ut[_0x37b3('0x45')](_0x37b3('0x4a'),_0x44dc1d);})[_0x37b3('0x40')](function(_0x582550){ut[_0x37b3('0x45')](_0x37b3('0x4b'),_0x582550);})[_0x37b3('0x4c')](function(){delete _0x2d7c64[_0x37b3('0xc')][_0x4de148];delete _0x2d7c64[_0x37b3('0xf')][_0x4de148];});}else{ut[_0x37b3('0x45')](_0x37b3('0x4d'));delete this[_0x37b3('0xc')][_0x4de148];delete this[_0x37b3('0xf')][_0x4de148];}};Fax['prototype']['syncHangup']=function(_0x5c0f19){var _0x3dd6dd=this;if(this['channels'][_0x5c0f19[_0x37b3('0x20')]]){if(this['actions'][_0x5c0f19[_0x37b3('0x20')]]){this['channels'][_0x5c0f19[_0x37b3('0x20')]]['id']=this['actions'][_0x5c0f19[_0x37b3('0x20')]]['id'];this['channels'][_0x5c0f19['uniqueid']][_0x37b3('0x22')]=this[_0x37b3('0xf')][_0x5c0f19['uniqueid']][_0x37b3('0x22')];}logger[_0x37b3('0x23')](_0x5c0f19[_0x37b3('0x20')],this['actions'][_0x5c0f19[_0x37b3('0x20')]]?_0x37b3('0x4e'):_0x37b3('0x4f'),JSON[_0x37b3('0x3f')](this[_0x37b3('0xc')][_0x5c0f19[_0x37b3('0x20')]]));if(this['actions'][_0x5c0f19[_0x37b3('0x20')]]){if(this['channels'][_0x5c0f19['uniqueid']][_0x37b3('0x50')]>0x0&&this[_0x37b3('0xc')][_0x5c0f19['uniqueid']][_0x37b3('0x51')]==='SUCCESS'){this[_0x37b3('0x46')](_0x5c0f19[_0x37b3('0x20')],!![]);}else{this['updateStatus'](_0x5c0f19[_0x37b3('0x20')],![],this[_0x37b3('0xc')][_0x5c0f19[_0x37b3('0x20')]][_0x37b3('0x52')]?_0x37b3('0x53')+this[_0x37b3('0xc')][_0x5c0f19[_0x37b3('0x20')]]['faxstatusstring']:_0x37b3('0x54'));}}}};Fax[_0x37b3('0x28')]['send']=function(_0x2fb846){var _0xe1fe24=this;return new BPromise(function(_0xc32690,_0x27fffe){_0xe1fe24[_0x37b3('0x55')](_0x2fb846,_0xe1fe24[_0x37b3('0xd')][_0x2fb846[_0x37b3('0x56')]])[_0x37b3('0x49')](function(_0x51879b){ut[_0x37b3('0x45')](_0x37b3('0x57'),_0x51879b);_0xc32690(ut['message']('Fax\x20received'));})[_0x37b3('0x40')](function(_0x2bfaf7){ut[_0x37b3('0x45')](_0x37b3('0x58'),_0x2bfaf7);updateStatus(_0x2fb846);_0x27fffe(ut[_0x37b3('0x36')]('Fax\x20failed'));});});};Fax[_0x37b3('0x28')][_0x37b3('0x59')]=function(_0x1873a2){var _0x340803=this;return new BPromise(function(_0x20359f,_0x51005a){var _0x3541fb=_0x340803[_0x37b3('0x5a')](_0x340803[_0x37b3('0xd')][_0x1873a2[_0x37b3('0x56')]][_0x37b3('0x5b')],_0x1873a2);if(_0x3541fb['isValid']){_0x20359f(ut['message']('Trunk\x20Reachable'));}else{_0x51005a(ut['message'](_0x3541fb[_0x37b3('0x36')]));}});};function originate(_0x22ca06,_0x2155f2,_0x51252f){return new BPromise(function(_0x2f56d4,_0x3e35b4){if(_0x51252f){var _0x3488a5=util[_0x37b3('0x5c')](_0x37b3('0x5d'),path[_0x37b3('0x38')](_0x22ca06[_0x37b3('0x4')])[_0x37b3('0x22')],_0x22ca06[_0x37b3('0x4')]);gs[_0x37b3('0x5e')](_0x3488a5)['then'](function(){_0x22ca06[_0x37b3('0x4')]=util[_0x37b3('0x5c')](_0x37b3('0x5f'),path['parse'](_0x22ca06[_0x37b3('0x4')])[_0x37b3('0x60')],path[_0x37b3('0x38')](_0x22ca06[_0x37b3('0x4')])['name']);_0x2155f2[_0x37b3('0x61')]=_0x22ca06[_0x37b3('0x4')];ut[_0x37b3('0x45')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut['variablesAction'](_0x22ca06,_0x2155f2))[_0x37b3('0x49')](function(_0x4f19ea){_0x2f56d4(_0x4f19ea);})['catch'](function(_0x2f8129){_0x3e35b4(_0x2f8129);});})['catch'](function(_0x5c0240){_0x3e35b4(_0x5c0240);});}else{ami[_0x37b3('0x62')](ut['variablesAction'](_0x22ca06,_0x2155f2))[_0x37b3('0x49')](function(_0x197e10){_0x2f56d4(_0x197e10);})[_0x37b3('0x40')](function(_0x4ea954){_0x3e35b4(_0x4ea954);});}});}Fax['prototype'][_0x37b3('0x55')]=function(_0x1bbd8f,_0x3c9d5c){var _0x19c659=this;return new BPromise(function(_0xe9a7e1,_0x5d6122){var _0x28498c=uuid['v4']();var _0x40c309=ut[_0x37b3('0x63')](_0x1bbd8f,_0x3c9d5c);_0x19c659[_0x37b3('0xf')][_0x28498c]=new Action(_0x28498c,_0x3c9d5c,_0x1bbd8f);var _0x49e7d9=_0x19c659[_0x37b3('0xf')][_0x28498c];if(path['parse'](_0x1bbd8f[_0x37b3('0x4')])['ext']===_0x37b3('0x39')){originate(_0x49e7d9,_0x40c309,!![])[_0x37b3('0x49')](function(_0x543ae4){_0xe9a7e1(_0x543ae4);})[_0x37b3('0x40')](function(_0xf0155e){_0x5d6122(_0xf0155e);});}else{originate(_0x49e7d9,_0x40c309,![])['then'](function(_0x44b699){_0xe9a7e1(_0x44b699);})[_0x37b3('0x40')](function(_0x12dc4b){_0x5d6122(_0x12dc4b);});}});};Fax[_0x37b3('0x28')][_0x37b3('0x64')]=function(_0x82bafe){return!_[_0x37b3('0x65')](_0x82bafe)&&!_[_0x37b3('0x65')](_0x82bafe['name'])&&!_[_0x37b3('0x65')](_0x82bafe[_0x37b3('0x66')])&&_0x82bafe[_0x37b3('0x66')]&&!_[_0x37b3('0x65')](this[_0x37b3('0xe')][util[_0x37b3('0x5c')](_0x37b3('0x67'),_0x82bafe[_0x37b3('0x22')])])&&!_[_0x37b3('0x65')](this['trunks'][util[_0x37b3('0x5c')](_0x37b3('0x67'),_0x82bafe['name'])][_0x37b3('0x2d')])&&(this[_0x37b3('0xe')][util[_0x37b3('0x5c')](_0x37b3('0x67'),_0x82bafe[_0x37b3('0x22')])][_0x37b3('0x2d')]===_0x37b3('0x68')||this['trunks'][util[_0x37b3('0x5c')](_0x37b3('0x67'),_0x82bafe['name'])][_0x37b3('0x2d')]===_0x37b3('0x69'));};Fax[_0x37b3('0x28')][_0x37b3('0x5a')]=function(_0x558e74,_0xd52412){if(!this[_0x37b3('0x64')](_0x558e74)){ut[_0x37b3('0x45')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0x558e74)?'':_0x558e74['name']+_0x37b3('0x6a'));return{'isValid':![],'message':_0x37b3('0x6b')};}if(_['isNil'](_0xd52412[_0x37b3('0x3c')])){ut[_0x37b3('0x45')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x37b3('0x3f')](_0xd52412));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0xd52412[_0x37b3('0x4')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x37b3('0x3f')](_0xd52412));return{'isValid':![],'message':_0x37b3('0x6c')};}return{'isValid':!![],'message':_0x37b3('0x6d')};};module[_0x37b3('0x6e')]=Fax; \ No newline at end of file +var _0xf4ba=['pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','actions','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','varset','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','context','from-voip-provider','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','variable','hasOwnProperty','value','channelstate','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','calleridnum','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf4ba,0x17e));var _0xaf4b=function(_0x20edb9,_0x54c849){_0x20edb9=_0x20edb9-0x0;var _0x5c398e=_0xf4ba[_0x20edb9];return _0x5c398e;};'use strict';var util=require(_0xaf4b('0x0'));var _=require(_0xaf4b('0x1'));var BPromise=require(_0xaf4b('0x2'));var uuid=require(_0xaf4b('0x3'));var moment=require(_0xaf4b('0x4'));var path=require(_0xaf4b('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xaf4b('0x6'));var logger=require(_0xaf4b('0x7'))('fax');var ami=require(_0xaf4b('0x8'));var rpcDb=require(_0xaf4b('0x9'));var Channel=require(_0xaf4b('0xa'));var ut=require(_0xaf4b('0xb'));var Action=require(_0xaf4b('0xc'));var faxAccount=require(_0xaf4b('0xd'));var attachment=require(_0xaf4b('0xe'));var faxMessage=require(_0xaf4b('0xf'));function Fax(_0x151a9a){this[_0xaf4b('0x10')]={};this[_0xaf4b('0x11')]=_0x151a9a['faxAccounts'];this[_0xaf4b('0x12')]=_0x151a9a[_0xaf4b('0x12')];this['actions']={};ami['on'](_0xaf4b('0x13'),this['syncNewchannel'][_0xaf4b('0x14')](this));ami['on'](_0xaf4b('0x15'),this['syncVarSet'][_0xaf4b('0x14')](this));ami['on']('newstate',this['syncNewState'][_0xaf4b('0x14')](this));ami['on']('newexten',this[_0xaf4b('0x16')][_0xaf4b('0x14')](this));ami['on'](_0xaf4b('0x17'),this[_0xaf4b('0x18')][_0xaf4b('0x14')](this));ami['on'](_0xaf4b('0x19'),this['syncReceiveFax']['bind'](this));ami['on'](_0xaf4b('0x1a'),this[_0xaf4b('0x1b')][_0xaf4b('0x14')](this));ami['on'](_0xaf4b('0x1c'),this['syncOriginateResponse'][_0xaf4b('0x14')](this));}Fax['prototype']['syncNewchannel']=function(_0x2485d8){if(_0x2485d8[_0xaf4b('0x1d')]===_0xaf4b('0x1e')){for(var _0x5b03a9 in this[_0xaf4b('0x11')]){if(this[_0xaf4b('0x11')]['hasOwnProperty'](_0x5b03a9)){if(_0x2485d8['exten']===this[_0xaf4b('0x11')][_0x5b03a9]['localstationid']){this['channels'][_0x2485d8[_0xaf4b('0x1f')]]={};this[_0xaf4b('0x10')][_0x2485d8[_0xaf4b('0x1f')]][_0xaf4b('0x20')]=_0x2485d8[_0xaf4b('0x20')];this['channels'][_0x2485d8[_0xaf4b('0x1f')]]['id']=this['faxAccounts'][_0x5b03a9]['id'];this[_0xaf4b('0x10')][_0x2485d8[_0xaf4b('0x1f')]][_0xaf4b('0x21')]=this['faxAccounts'][_0x5b03a9][_0xaf4b('0x21')];logger['info'](_0x2485d8['uniqueid'],_0xaf4b('0x22'));}}}}if(this['actions'][_0x2485d8[_0xaf4b('0x1f')]]){this[_0xaf4b('0x10')][_0x2485d8[_0xaf4b('0x1f')]]={};this[_0xaf4b('0x10')][_0x2485d8['uniqueid']]['channel']=_0x2485d8[_0xaf4b('0x20')];logger[_0xaf4b('0x23')](_0x2485d8['uniqueid'],_0xaf4b('0x22'));}};Fax[_0xaf4b('0x24')]['syncVarSet']=function(_0x2c59c7){if(this[_0xaf4b('0x10')][_0x2c59c7['uniqueid']]){for(var _0x3a7600 in _0x2c59c7[_0xaf4b('0x25')]){if(_0x2c59c7[_0xaf4b('0x25')][_0xaf4b('0x26')](_0x3a7600)){this[_0xaf4b('0x10')][_0x2c59c7['uniqueid']][_0x3a7600]=_0x2c59c7[_0xaf4b('0x27')];}}}};Fax[_0xaf4b('0x24')]['syncNewState']=function(_0x2d48b7){if(this[_0xaf4b('0x10')][_0x2d48b7['uniqueid']]){this['channels'][_0x2d48b7[_0xaf4b('0x1f')]][_0xaf4b('0x28')]=_0x2d48b7[_0xaf4b('0x28')];this[_0xaf4b('0x10')][_0x2d48b7['uniqueid']]['channelstatedesc']=_0x2d48b7['channelstatedesc'];}};Fax[_0xaf4b('0x24')][_0xaf4b('0x16')]=function(_0x64240a){if(this['channels'][_0x64240a['uniqueid']]){for(var _0x1c4700 in _0x64240a[_0xaf4b('0x25')]){if(_0x64240a[_0xaf4b('0x25')][_0xaf4b('0x26')](_0x1c4700)){this[_0xaf4b('0x10')][_0x64240a['uniqueid']][_0x1c4700]=_0x64240a[_0xaf4b('0x27')];}}}};Fax[_0xaf4b('0x24')]['syncFaxStatus']=function(_0x1a744d){if(this[_0xaf4b('0x10')][_0x1a744d['uniqueid']]){this[_0xaf4b('0x10')][_0x1a744d['uniqueid']][_0xaf4b('0x29')]=_0x1a744d[_0xaf4b('0x29')];this[_0xaf4b('0x10')][_0x1a744d[_0xaf4b('0x1f')]][_0xaf4b('0x2a')]=_0x1a744d[_0xaf4b('0x2a')];this[_0xaf4b('0x10')][_0x1a744d['uniqueid']][_0xaf4b('0x2b')]=_0x1a744d[_0xaf4b('0x2b')];this[_0xaf4b('0x10')][_0x1a744d[_0xaf4b('0x1f')]][_0xaf4b('0x2c')]=_0x1a744d[_0xaf4b('0x2c')];logger[_0xaf4b('0x23')](_0x1a744d['uniqueid'],_0xaf4b('0x2d'));}};Fax[_0xaf4b('0x24')]['syncReceiveFax']=function(_0x3ed91d){var _0x25cbb0=this;if(this[_0xaf4b('0x10')][_0x3ed91d[_0xaf4b('0x1f')]]){var _0x463884=this['channels'][_0x3ed91d[_0xaf4b('0x1f')]]['id'];this[_0xaf4b('0x10')][_0x3ed91d[_0xaf4b('0x1f')]]['remotestationid']=_0x3ed91d[_0xaf4b('0x2e')];this['channels'][_0x3ed91d[_0xaf4b('0x1f')]][_0xaf4b('0x2f')]=_0x3ed91d['pagestransferred'];this[_0xaf4b('0x10')][_0x3ed91d['uniqueid']]['localstationid']=_0x3ed91d['localstationid'];this[_0xaf4b('0x10')][_0x3ed91d[_0xaf4b('0x1f')]][_0xaf4b('0x30')]=_0x3ed91d[_0xaf4b('0x30')];this[_0xaf4b('0x10')][_0x3ed91d[_0xaf4b('0x1f')]][_0xaf4b('0x31')]=_0x3ed91d[_0xaf4b('0x31')];this[_0xaf4b('0x10')][_0x3ed91d['uniqueid']][_0xaf4b('0x2c')]=_0x3ed91d['filename'];this[_0xaf4b('0x10')][_0x3ed91d[_0xaf4b('0x1f')]]['calleridnum']=_0x3ed91d['calleridnum'];if(this['channels'][_0x3ed91d['uniqueid']][_0xaf4b('0x2f')]>0x0){tiff2pdf(_0x3ed91d[_0xaf4b('0x2c')],_0xaf4b('0x32'),function(_0x34fe92){logger['info'](_0x3ed91d[_0xaf4b('0x1f')],'\x20result\x20conversion\x20file\x20',_0x34fe92[_0xaf4b('0x33')]);attachment[_0xaf4b('0x34')]({'name':path[_0xaf4b('0x35')](_0x3ed91d['filename'])[_0xaf4b('0x21')],'basename':path[_0xaf4b('0x35')](_0x3ed91d['filename'])[_0xaf4b('0x21')]+_0xaf4b('0x36'),'type':_0xaf4b('0x37')})[_0xaf4b('0x38')](function(_0x4fd11a){faxAccount['notify'](_0x463884,{'from':_0x3ed91d[_0xaf4b('0x39')],'mapKey':_0xaf4b('0x3a'),'body':path['parse'](_0x3ed91d['filename'])['name']+_0xaf4b('0x36'),'AttachmentId':_0x4fd11a['id']})[_0xaf4b('0x3b')](function(_0xd8cd91){logger[_0xaf4b('0x3c')](_0x3ed91d['uniqueid'],_0xaf4b('0x3d'),JSON[_0xaf4b('0x3e')](_0xd8cd91));});})[_0xaf4b('0x3b')](function(_0x250b20){logger['error'](_0x3ed91d[_0xaf4b('0x1f')],'\x20receiveFax\x20',JSON[_0xaf4b('0x3e')](_0x250b20));});});}logger[_0xaf4b('0x23')](_0x3ed91d['uniqueid'],_0xaf4b('0x3f'));}};Fax[_0xaf4b('0x24')][_0xaf4b('0x40')]=function(_0x2ed8bc){if(this['actions'][_0x2ed8bc[_0xaf4b('0x1f')]]){_[_0xaf4b('0x41')](this[_0xaf4b('0x10')][_0x2ed8bc['uniqueid']],_[_0xaf4b('0x42')](_0x2ed8bc,['response',_0xaf4b('0x43')]));}};function updateStatus(_0x5871a1){if(_0x5871a1[_0xaf4b('0x44')]){faxMessage[_0xaf4b('0x45')](_0x5871a1[_0xaf4b('0x44')],{'failMessage':_0xaf4b('0x46')})[_0xaf4b('0x38')](function(_0x3a6c8a){ut['logger']('[Fax][Message][Error][Updated]',_0x3a6c8a);})[_0xaf4b('0x3b')](function(_0x4c65bd){ut['logger'](_0xaf4b('0x47'),_0x4c65bd);});}else{ut[_0xaf4b('0x48')](_0xaf4b('0x49'));}}Fax[_0xaf4b('0x24')]['updateStatus']=function(_0x285d64,_0x41ae1b,_0x3c87f0){var _0x483a5d=this;var _0x5221e1={};if(_0x41ae1b){_0x5221e1={'read':_0x41ae1b};}else{_0x5221e1={'failMessage':_0x3c87f0};}if(this[_0xaf4b('0x4a')][_0x285d64][_0xaf4b('0x44')]){faxMessage[_0xaf4b('0x45')](this[_0xaf4b('0x4a')][_0x285d64]['AttachmentId'],_0x5221e1)['then'](function(_0x594956){ut[_0xaf4b('0x48')]('[Fax][Message][Updated]',_0x594956);})['catch'](function(_0x41b366){ut[_0xaf4b('0x48')](_0xaf4b('0x4b'),_0x41b366);})['finally'](function(){delete _0x483a5d['channels'][_0x285d64];delete _0x483a5d[_0xaf4b('0x4a')][_0x285d64];});}else{ut[_0xaf4b('0x48')](_0xaf4b('0x4c'));delete this[_0xaf4b('0x10')][_0x285d64];delete this['actions'][_0x285d64];}};Fax[_0xaf4b('0x24')][_0xaf4b('0x1b')]=function(_0x17d431){var _0x117eb6=this;if(this[_0xaf4b('0x10')][_0x17d431['uniqueid']]){if(this[_0xaf4b('0x4a')][_0x17d431[_0xaf4b('0x1f')]]){this[_0xaf4b('0x10')][_0x17d431[_0xaf4b('0x1f')]]['id']=this[_0xaf4b('0x4a')][_0x17d431[_0xaf4b('0x1f')]]['id'];this[_0xaf4b('0x10')][_0x17d431[_0xaf4b('0x1f')]][_0xaf4b('0x21')]=this[_0xaf4b('0x4a')][_0x17d431[_0xaf4b('0x1f')]]['name'];}logger[_0xaf4b('0x23')](_0x17d431['uniqueid'],this['actions'][_0x17d431[_0xaf4b('0x1f')]]?_0xaf4b('0x4d'):_0xaf4b('0x4e'),JSON[_0xaf4b('0x3e')](this[_0xaf4b('0x10')][_0x17d431['uniqueid']]));if(this[_0xaf4b('0x4a')][_0x17d431['uniqueid']]){if(this[_0xaf4b('0x10')][_0x17d431[_0xaf4b('0x1f')]][_0xaf4b('0x4f')]>0x0&&this[_0xaf4b('0x10')][_0x17d431[_0xaf4b('0x1f')]][_0xaf4b('0x17')]===_0xaf4b('0x50')){this['updateStatus'](_0x17d431[_0xaf4b('0x1f')],!![]);}else{this['updateStatus'](_0x17d431[_0xaf4b('0x1f')],![],this[_0xaf4b('0x10')][_0x17d431[_0xaf4b('0x1f')]][_0xaf4b('0x51')]?_0xaf4b('0x52')+this[_0xaf4b('0x10')][_0x17d431['uniqueid']][_0xaf4b('0x51')]:_0xaf4b('0x53'));}}}};Fax['prototype']['send']=function(_0x3c1561){var _0x39520d=this;return new BPromise(function(_0x31da90,_0x1127c4){_0x39520d[_0xaf4b('0x54')](_0x3c1561,_0x39520d[_0xaf4b('0x11')][_0x3c1561[_0xaf4b('0x55')]])[_0xaf4b('0x38')](function(_0x55512b){ut[_0xaf4b('0x48')]('[Fax][execOriginate][success]',_0x55512b);_0x31da90(ut[_0xaf4b('0x33')]('Fax\x20received'));})[_0xaf4b('0x3b')](function(_0x80732c){ut[_0xaf4b('0x48')]('[Fax][execOriginate][failure]',_0x80732c);updateStatus(_0x3c1561);_0x1127c4(ut[_0xaf4b('0x33')](_0xaf4b('0x56')));});});};Fax[_0xaf4b('0x24')][_0xaf4b('0x57')]=function(_0x5488fc){var _0x59adc3=this;return new BPromise(function(_0x527100,_0x464556){var _0x3f7c31=_0x59adc3[_0xaf4b('0x58')](_0x59adc3[_0xaf4b('0x11')][_0x5488fc['FaxAccountId']][_0xaf4b('0x59')],_0x5488fc);if(_0x3f7c31['isValid']){_0x527100(ut[_0xaf4b('0x33')](_0xaf4b('0x5a')));}else{_0x464556(ut[_0xaf4b('0x33')](_0x3f7c31[_0xaf4b('0x33')]));}});};function originate(_0x452d54,_0xd11df3,_0x101c40){return new BPromise(function(_0x287931,_0x46d4e8){if(_0x101c40){var _0x1d0feb=util[_0xaf4b('0x5b')](_0xaf4b('0x5c'),path[_0xaf4b('0x35')](_0x452d54[_0xaf4b('0x5')])[_0xaf4b('0x21')],_0x452d54[_0xaf4b('0x5')]);gs[_0xaf4b('0x5d')](_0x1d0feb)[_0xaf4b('0x38')](function(){_0x452d54[_0xaf4b('0x5')]=util[_0xaf4b('0x5b')](_0xaf4b('0x5e'),path[_0xaf4b('0x35')](_0x452d54[_0xaf4b('0x5')])[_0xaf4b('0x5f')],path['parse'](_0x452d54[_0xaf4b('0x5')])['name']);_0xd11df3[_0xaf4b('0x60')]=_0x452d54[_0xaf4b('0x5')];ut[_0xaf4b('0x48')](_0xaf4b('0x61'),'');ami[_0xaf4b('0x62')](ut[_0xaf4b('0x63')](_0x452d54,_0xd11df3))[_0xaf4b('0x38')](function(_0x579982){_0x287931(_0x579982);})['catch'](function(_0x1547a2){_0x46d4e8(_0x1547a2);});})[_0xaf4b('0x3b')](function(_0x245c72){_0x46d4e8(_0x245c72);});}else{ami['Action'](ut[_0xaf4b('0x63')](_0x452d54,_0xd11df3))[_0xaf4b('0x38')](function(_0x5ee463){_0x287931(_0x5ee463);})[_0xaf4b('0x3b')](function(_0x35aa2a){_0x46d4e8(_0x35aa2a);});}});}Fax[_0xaf4b('0x24')][_0xaf4b('0x54')]=function(_0x571ab5,_0x539d07){var _0x535f2d=this;return new BPromise(function(_0x594919,_0x17ff94){var _0x4b012d=uuid['v4']();var _0x38b020=ut[_0xaf4b('0x64')](_0x571ab5,_0x539d07);_0x535f2d[_0xaf4b('0x4a')][_0x4b012d]=new Action(_0x4b012d,_0x539d07,_0x571ab5);var _0x729399=_0x535f2d['actions'][_0x4b012d];if(path[_0xaf4b('0x35')](_0x571ab5[_0xaf4b('0x5')])[_0xaf4b('0x65')]==='.pdf'){originate(_0x729399,_0x38b020,!![])[_0xaf4b('0x38')](function(_0x804969){_0x594919(_0x804969);})[_0xaf4b('0x3b')](function(_0x2f4009){_0x17ff94(_0x2f4009);});}else{originate(_0x729399,_0x38b020,![])[_0xaf4b('0x38')](function(_0x9673c){_0x594919(_0x9673c);})[_0xaf4b('0x3b')](function(_0x149005){_0x17ff94(_0x149005);});}});};Fax[_0xaf4b('0x24')][_0xaf4b('0x66')]=function(_0x92e89c){return!_[_0xaf4b('0x67')](_0x92e89c)&&!_['isNil'](_0x92e89c[_0xaf4b('0x21')])&&!_[_0xaf4b('0x67')](_0x92e89c[_0xaf4b('0x68')])&&_0x92e89c[_0xaf4b('0x68')]&&!_[_0xaf4b('0x67')](this[_0xaf4b('0x12')][util[_0xaf4b('0x5b')](_0xaf4b('0x69'),_0x92e89c['name'])])&&!_[_0xaf4b('0x67')](this[_0xaf4b('0x12')][util[_0xaf4b('0x5b')]('SIP/%s',_0x92e89c['name'])][_0xaf4b('0x2a')])&&(this[_0xaf4b('0x12')][util[_0xaf4b('0x5b')]('SIP/%s',_0x92e89c[_0xaf4b('0x21')])][_0xaf4b('0x2a')]===_0xaf4b('0x6a')||this[_0xaf4b('0x12')][util[_0xaf4b('0x5b')](_0xaf4b('0x69'),_0x92e89c['name'])][_0xaf4b('0x2a')]===_0xaf4b('0x6b'));};Fax[_0xaf4b('0x24')]['checkTrunk']=function(_0x35ee6d,_0x21a0e8){if(!this['isTrunkReachable'](_0x35ee6d)){ut[_0xaf4b('0x48')](_0xaf4b('0x6c'),_[_0xaf4b('0x67')](_0x35ee6d)?'':_0x35ee6d[_0xaf4b('0x21')]+_0xaf4b('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xaf4b('0x67')](_0x21a0e8[_0xaf4b('0x3a')])){ut[_0xaf4b('0x48')](_0xaf4b('0x6e'),JSON[_0xaf4b('0x3e')](_0x21a0e8));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x21a0e8[_0xaf4b('0x5')])){ut[_0xaf4b('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xaf4b('0x3e')](_0x21a0e8));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xaf4b('0x6f')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index da176d5..ecbfe6a 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 _0x660a=['error','notify','resolve','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x660a,0x124));var _0xa660=function(_0xe9e6cf,_0x395f6d){_0xe9e6cf=_0xe9e6cf-0x0;var _0x2b8851=_0x660a[_0xe9e6cf];return _0x2b8851;};'use strict';var util=require(_0xa660('0x0'));var BPromise=require(_0xa660('0x1'));var logger=require(_0xa660('0x2'))(_0xa660('0x3'));var _=require(_0xa660('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x27f0b5){return function(_0x1bf143){logger[_0xa660('0x5')](_0x27f0b5,util['inspect'](_0x1bf143,{'showHidden':![],'depth':null}));};}exports[_0xa660('0x6')]=function(_0x2b811d,_0x54e135){return BPromise[_0xa660('0x7')]()['then'](faxAccount[_0xa660('0x6')](_0x2b811d,_0x54e135))['catch'](loggerCatch(_0xa660('0x8')));}; \ No newline at end of file +var _0x79fe=['resolve','then','catch','[Notify]\x20','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect'];(function(_0x2ab3c5,_0x35a3ef){var _0x2733aa=function(_0x338802){while(--_0x338802){_0x2ab3c5['push'](_0x2ab3c5['shift']());}};_0x2733aa(++_0x35a3ef);}(_0x79fe,0xe0));var _0xe79f=function(_0x86112a,_0x127b68){_0x86112a=_0x86112a-0x0;var _0x1f433b=_0x79fe[_0x86112a];return _0x1f433b;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xe79f('0x0'))(_0xe79f('0x1'));var _=require(_0xe79f('0x2'));var faxAccount=require(_0xe79f('0x3'));function loggerCatch(_0x15f07e){return function(_0xabb9dd){logger[_0xe79f('0x4')](_0x15f07e,util[_0xe79f('0x5')](_0xabb9dd,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3cedd4,_0x18cd3a){return BPromise[_0xe79f('0x6')]()[_0xe79f('0x7')](faxAccount['notify'](_0x3cedd4,_0x18cd3a))[_0xe79f('0x8')](loggerCatch(_0xe79f('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c6369f6..90cb47b 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 _0xd5d5=['Exec\x20gs','inspect','fax','bluebird','child_process','exec','execute','info'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd5d5,0xea));var _0x5d5d=function(_0x39782f,_0x4aa931){_0x39782f=_0x39782f-0x0;var _0x47768c=_0xd5d5[_0x39782f];return _0x47768c;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x5d5d('0x0'));var BPromise=require(_0x5d5d('0x1'));var exec=require(_0x5d5d('0x2'))[_0x5d5d('0x3')];exports[_0x5d5d('0x4')]=function(_0x1d718c){return new BPromise(function(_0x45d51c,_0x595d7b){exec(_0x1d718c,function(_0x139d78,_0x3f3f08,_0x57169a){logger[_0x5d5d('0x5')]('Exec\x20gs',_0x3f3f08);if(_0x139d78){logger[_0x5d5d('0x5')](_0x5d5d('0x6'),'\x20Error\x20:',util[_0x5d5d('0x7')](_0x139d78,{'showHidden':![],'depth':null}),_0x3f3f08,_0x57169a);_0x595d7b(_0x139d78);}_0x45d51c(_0x3f3f08);});});}; \ No newline at end of file +var _0x0df2=['\x20Error\x20:','inspect','util','bluebird','child_process','execute','info'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x0df2,0x16e));var _0x20df=function(_0x5bd1fc,_0x5a5d57){_0x5bd1fc=_0x5bd1fc-0x0;var _0x4f9cfa=_0x0df2[_0x5bd1fc];return _0x4f9cfa;};'use strict';var util=require(_0x20df('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x20df('0x1'));var exec=require(_0x20df('0x2'))['exec'];exports[_0x20df('0x3')]=function(_0x588e82){return new BPromise(function(_0x4c6eaa,_0x18820d){exec(_0x588e82,function(_0x18a4b5,_0x359cac,_0x53b42e){logger['info']('Exec\x20gs',_0x359cac);if(_0x18a4b5){logger[_0x20df('0x4')]('Exec\x20gs',_0x20df('0x5'),util[_0x20df('0x6')](_0x18a4b5,{'showHidden':![],'depth':null}),_0x359cac,_0x53b42e);_0x18820d(_0x18a4b5);}_0x4c6eaa(_0x359cac);});});}; \ 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 c1d626b..aa30b76 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 _0x07c2=['moment','fax','message','logger','inspect','addVariables','ecm','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','uniqueid','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x07c2,0xf1));var _0x207c=function(_0x51f99e,_0x70684d){_0x51f99e=_0x51f99e-0x0;var _0x5b12cd=_0x07c2[_0x51f99e];return _0x5b12cd;};'use strict';var util=require(_0x207c('0x0'));var _=require('lodash');var moment=require(_0x207c('0x1'));var logger=require('../../../../config/logger')(_0x207c('0x2'));exports[_0x207c('0x3')]=function(_0xfd76c1){return{'message':_0xfd76c1};};exports[_0x207c('0x4')]=function(_0x15df8d,_0x475331){logger['info'](_0x15df8d,util[_0x207c('0x5')](_0x475331,{'showHidden':![],'depth':null}));};exports[_0x207c('0x6')]=function(_0x40db91,_0x397d0f){var _0x538561={'XMF-ECM':_0x397d0f[_0x207c('0x7')],'XMF-HEADERINFO':_0x397d0f['headerinfo'],'XMF-MINRATE':_0x397d0f['minrate'],'XMF-MAXRATE':_0x397d0f[_0x207c('0x8')],'XMF-MODEM':util[_0x207c('0x9')](_0x207c('0xa'),_0x397d0f[_0x207c('0xb')]),'XMF-GATEWAY':_0x397d0f['gateway'],'XMF-FAXDETECT':_0x397d0f[_0x207c('0xc')],'XMF-T38TIMEOUT':_0x397d0f[_0x207c('0xd')],'XMF-LOCALSTATIONID':_0x397d0f[_0x207c('0xe')],'XMF-PATH':_0x40db91[_0x207c('0xf')]};return _0x538561;};exports[_0x207c('0x10')]=function(_0x28be07,_0x3ba361){return{'actionid':_0x28be07['uniqueid'],'action':_0x207c('0x11'),'channel':_0x28be07['channel'],'Exten':_0x207c('0x12'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x207c('0x13'),_0x28be07[_0x207c('0x14')]?_0x28be07['headerinfo']:'',_0x28be07[_0x207c('0xe')]),'variable':_0x3ba361,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x28be07[_0x207c('0x15')]};}; \ No newline at end of file +var _0x5e79=['uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','faxdetect','t38timeout','localstationid','variablesAction'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5e79,0x9c));var _0x95e7=function(_0x5276e1,_0x57f018){_0x5276e1=_0x5276e1-0x0;var _0xa8a15a=_0x5e79[_0x5276e1];return _0xa8a15a;};'use strict';var util=require(_0x95e7('0x0'));var _=require('lodash');var moment=require(_0x95e7('0x1'));var logger=require(_0x95e7('0x2'))(_0x95e7('0x3'));exports[_0x95e7('0x4')]=function(_0x15086e){return{'message':_0x15086e};};exports[_0x95e7('0x5')]=function(_0x103999,_0x10c490){logger[_0x95e7('0x6')](_0x103999,util[_0x95e7('0x7')](_0x10c490,{'showHidden':![],'depth':null}));};exports[_0x95e7('0x8')]=function(_0x335712,_0x8abdfc){var _0x3b0b07={'XMF-ECM':_0x8abdfc[_0x95e7('0x9')],'XMF-HEADERINFO':_0x8abdfc[_0x95e7('0xa')],'XMF-MINRATE':_0x8abdfc[_0x95e7('0xb')],'XMF-MAXRATE':_0x8abdfc[_0x95e7('0xc')],'XMF-MODEM':util[_0x95e7('0xd')]('\x22%s\x22',_0x8abdfc[_0x95e7('0xe')]),'XMF-GATEWAY':_0x8abdfc['gateway'],'XMF-FAXDETECT':_0x8abdfc[_0x95e7('0xf')],'XMF-T38TIMEOUT':_0x8abdfc[_0x95e7('0x10')],'XMF-LOCALSTATIONID':_0x8abdfc[_0x95e7('0x11')],'XMF-PATH':_0x335712['path']};return _0x3b0b07;};exports[_0x95e7('0x12')]=function(_0x17774e,_0x3b528a){return{'actionid':_0x17774e[_0x95e7('0x13')],'action':_0x95e7('0x14'),'channel':_0x17774e[_0x95e7('0x15')],'Exten':_0x95e7('0x16'),'Context':_0x95e7('0x17'),'Priority':'1','callerid':util['format'](_0x95e7('0x18'),_0x17774e[_0x95e7('0xa')]?_0x17774e[_0x95e7('0xa')]:'',_0x17774e[_0x95e7('0x11')]),'variable':_0x3b528a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x17774e['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 56f0cbc..190fb98 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 _0x504f=['[index.js][main]','inspect','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','hour','get','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','[index.js][initParams]','listen','error'];(function(_0xf9afbd,_0x5b6760){var _0x47f3ad=function(_0x29a958){while(--_0x29a958){_0xf9afbd['push'](_0xf9afbd['shift']());}};_0x47f3ad(++_0x5b6760);}(_0x504f,0x1be));var _0xf504=function(_0x57babc,_0x4f29a7){_0x57babc=_0x57babc-0x0;var _0x71c58b=_0x504f[_0x57babc];return _0x71c58b;};'use strict';var util=require(_0xf504('0x0'));var moment=require(_0xf504('0x1'));var server=require('./server');var Realtime=require(_0xf504('0x2'));var Report=require(_0xf504('0x3'));var Acw=require(_0xf504('0x4'));var Trigger=require(_0xf504('0x5'));var Dialer=require(_0xf504('0x6'));var Preview=require(_0xf504('0x7'));var Fax=require(_0xf504('0x8'));var user=require(_0xf504('0x9'));var voiceQueue=require(_0xf504('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xf504('0xb'));var trunk=require(_0xf504('0xc'));var trigger=require(_0xf504('0xd'));var template=require(_0xf504('0xe'));var cmHopperHistory=require(_0xf504('0xf'));var campaign=require(_0xf504('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xf504('0x11'));var zendesk=require(_0xf504('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xf504('0x13'));var freshdesk=require(_0xf504('0x14'));var desk=require(_0xf504('0x15'));var zoho=require(_0xf504('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xf504('0x17'));var dynamics365=require(_0xf504('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('../../config/logger')(_0xf504('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xf504('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf504('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xf504('0x1c')]()['then'](user[_0xf504('0x1d')]())[_0xf504('0x1e')](realtime[_0xf504('0x1f')]())[_0xf504('0x1e')](user[_0xf504('0x20')]())['then'](realtime[_0xf504('0x21')]())[_0xf504('0x1e')](trunk[_0xf504('0x22')]())['then'](realtime[_0xf504('0x23')]())[_0xf504('0x1e')](voiceQueue[_0xf504('0x24')]())[_0xf504('0x1e')](realtime[_0xf504('0x25')]())[_0xf504('0x1e')](trigger[_0xf504('0x26')]())[_0xf504('0x1e')](realtime[_0xf504('0x27')]())[_0xf504('0x1e')](template[_0xf504('0x28')]())['then'](realtime[_0xf504('0x29')]())['then'](zendesk['getZendeskAccounts']())['then'](realtime[_0xf504('0x2a')]())[_0xf504('0x1e')](salesforce['getSalesforceAccounts']())[_0xf504('0x1e')](realtime[_0xf504('0x2b')]())[_0xf504('0x1e')](sugarcrm[_0xf504('0x2c')]())[_0xf504('0x1e')](realtime[_0xf504('0x2d')]())[_0xf504('0x1e')](freshdesk['getFreshdeskAccounts']())[_0xf504('0x1e')](realtime[_0xf504('0x2e')]())[_0xf504('0x1e')](desk[_0xf504('0x2f')]())['then'](realtime[_0xf504('0x30')]())[_0xf504('0x1e')](zoho['getZohoAccounts']())[_0xf504('0x1e')](realtime[_0xf504('0x31')]())[_0xf504('0x1e')](vtiger[_0xf504('0x32')]())['then'](realtime[_0xf504('0x33')]())['then'](freshsales[_0xf504('0x34')]())[_0xf504('0x1e')](realtime[_0xf504('0x35')]())[_0xf504('0x1e')](servicenow[_0xf504('0x36')]())[_0xf504('0x1e')](realtime[_0xf504('0x37')]())[_0xf504('0x1e')](dynamics365[_0xf504('0x38')]())[_0xf504('0x1e')](realtime[_0xf504('0x39')]())[_0xf504('0x1e')](campaign['getCampaigns']())['then'](realtime[_0xf504('0x3a')]())[_0xf504('0x1e')](voiceExtension[_0xf504('0x3b')]())[_0xf504('0x1e')](realtime[_0xf504('0x3c')]())['then'](faxAccount[_0xf504('0x3d')]())[_0xf504('0x1e')](realtime[_0xf504('0x3e')]())[_0xf504('0x1e')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xf504('0x1e')](voiceQueueReport['getVoiceQueueReports']())[_0xf504('0x1e')](realtime['initVoiceQueueReports']())[_0xf504('0x1e')](cmHopperHistory[_0xf504('0x3f')]())['then'](realtime[_0xf504('0x40')]())[_0xf504('0x1e')](cmHopperHistory[_0xf504('0x41')]())['then'](realtime[_0xf504('0x42')]())[_0xf504('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xf504('0x1e')](realtime[_0xf504('0x43')]())[_0xf504('0x44')](function(_0x236283){logger['error'](_0xf504('0x45'),util['inspect'](_0x236283,{'showHidden':![],'depth':null}));});}function main(){return server[_0xf504('0x46')](realtime,preview,fax)[_0xf504('0x1e')](function(){return initRealtime();})[_0xf504('0x1e')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xf504('0x44')](function(_0x29c146){logger[_0xf504('0x47')](_0xf504('0x48'),util[_0xf504('0x49')](_0x29c146,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xcc5f=['getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0xcc5f,0x98));var _0xfcc5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc5f[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xfcc5('0x0'));var moment=require(_0xfcc5('0x1'));var server=require(_0xfcc5('0x2'));var Realtime=require('./realtime');var Report=require(_0xfcc5('0x3'));var Acw=require(_0xfcc5('0x4'));var Trigger=require(_0xfcc5('0x5'));var Dialer=require(_0xfcc5('0x6'));var Preview=require(_0xfcc5('0x7'));var Fax=require('./fax');var user=require(_0xfcc5('0x8'));var voiceQueue=require(_0xfcc5('0x9'));var voiceQueueReport=require(_0xfcc5('0xa'));var voiceCallReport=require(_0xfcc5('0xb'));var trunk=require(_0xfcc5('0xc'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xfcc5('0xd'));var voiceExtension=require(_0xfcc5('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xfcc5('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xfcc5('0x10'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xfcc5('0x11'));var zoho=require(_0xfcc5('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xfcc5('0x13'));var servicenow=require(_0xfcc5('0x14'));var dynamics365=require(_0xfcc5('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(_0xfcc5('0x16'))(_0xfcc5('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xfcc5('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xfcc5('0x19')](_0xfcc5('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xfcc5('0x1a')]()[_0xfcc5('0x1b')](user[_0xfcc5('0x1c')]())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x1d')]())[_0xfcc5('0x1b')](user[_0xfcc5('0x1e')]())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x1f')]())['then'](trunk[_0xfcc5('0x20')]())[_0xfcc5('0x1b')](realtime['initTrunks']())[_0xfcc5('0x1b')](voiceQueue[_0xfcc5('0x21')]())['then'](realtime[_0xfcc5('0x22')]())[_0xfcc5('0x1b')](trigger[_0xfcc5('0x23')]())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x24')]())[_0xfcc5('0x1b')](template['getTemplates']())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x25')]())[_0xfcc5('0x1b')](zendesk[_0xfcc5('0x26')]())['then'](realtime[_0xfcc5('0x27')]())[_0xfcc5('0x1b')](salesforce['getSalesforceAccounts']())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x28')]())[_0xfcc5('0x1b')](sugarcrm[_0xfcc5('0x29')]())[_0xfcc5('0x1b')](realtime['initSugarcrmAccounts']())[_0xfcc5('0x1b')](freshdesk[_0xfcc5('0x2a')]())['then'](realtime[_0xfcc5('0x2b')]())['then'](desk[_0xfcc5('0x2c')]())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x2d')]())[_0xfcc5('0x1b')](zoho[_0xfcc5('0x2e')]())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x2f')]())[_0xfcc5('0x1b')](vtiger[_0xfcc5('0x30')]())['then'](realtime[_0xfcc5('0x31')]())[_0xfcc5('0x1b')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xfcc5('0x32')]())['then'](servicenow[_0xfcc5('0x33')]())[_0xfcc5('0x1b')](realtime['initServicenowAccounts']())[_0xfcc5('0x1b')](dynamics365[_0xfcc5('0x34')]())['then'](realtime['initDynamics365Accounts']())[_0xfcc5('0x1b')](campaign[_0xfcc5('0x35')]())[_0xfcc5('0x1b')](realtime['initCampaigns']())[_0xfcc5('0x1b')](voiceExtension[_0xfcc5('0x36')]())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x37')]())[_0xfcc5('0x1b')](faxAccount[_0xfcc5('0x38')]())[_0xfcc5('0x1b')](realtime['initFaxAccounts']())[_0xfcc5('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0xfcc5('0x1a')]()['then'](voiceQueueReport[_0xfcc5('0x39')]())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x3a')]())[_0xfcc5('0x1b')](cmHopperHistory[_0xfcc5('0x3b')]())['then'](realtime[_0xfcc5('0x3c')]())[_0xfcc5('0x1b')](cmHopperHistory[_0xfcc5('0x3d')]())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x3e')]())['then'](voiceCallReport['getVoiceCallReports']())[_0xfcc5('0x1b')](realtime[_0xfcc5('0x3f')]())[_0xfcc5('0x40')](function(_0x4d014d){logger[_0xfcc5('0x41')](_0xfcc5('0x42'),util[_0xfcc5('0x43')](_0x4d014d,{'showHidden':![],'depth':null}));});}function main(){return server[_0xfcc5('0x44')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0xfcc5('0x1b')](function(){return initParams();})['then'](function(){report[_0xfcc5('0x45')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x45bcea){logger['error'](_0xfcc5('0x46'),util[_0xfcc5('0x43')](_0x45bcea,{'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 6bab2ac..67da777 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 _0x4912=['emit','user:save','user:presence','exports','util','moment','md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','status','interface','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','stateTime','online','onhold','stringify'];(function(_0x15bce1,_0x24588b){var _0x189fca=function(_0x4f2525){while(--_0x4f2525){_0x15bce1['push'](_0x15bce1['shift']());}};_0x189fca(++_0x24588b);}(_0x4912,0x1c0));var _0x2491=function(_0x3a630a,_0xba3ded){_0x3a630a=_0x3a630a-0x0;var _0x341063=_0x4912[_0x3a630a];return _0x341063;};'use strict';var _=require('lodash');var util=require(_0x2491('0x0'));var moment=require(_0x2491('0x1'));var md5=require(_0x2491('0x2'));var Redis=require(_0x2491('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x2491('0x4')](config[_0x2491('0x5')],{'host':_0x2491('0x6'),'port':0x18eb});var io=require(_0x2491('0x7'))(new Redis(config[_0x2491('0x5')]));function Agent(_0x1594e8){this['id']=_0x1594e8['id']||0x0;this[_0x2491('0x8')]=_0x1594e8[_0x2491('0x8')]||'';this['email']=_0x1594e8[_0x2491('0x9')]||'';this[_0x2491('0xa')]=_0x1594e8[_0x2491('0xa')]||'';this[_0x2491('0xb')]=_0x1594e8[_0x2491('0xb')]||'';this['state']=_0x2491('0xc');this['stateTime']=0x0;this[_0x2491('0xd')]=_0x2491('0xc');this['address']='';this['phone']='';this['mobile']='';this[_0x2491('0xe')]='';this['online']=_0x1594e8['online']||![];this[_0x2491('0xf')]=_0x2491('0xc');this[_0x2491('0x10')]=0x0;this[_0x2491('0x11')]='';this[_0x2491('0x12')]='';this['onhold']=![];this['local']=![];this[_0x2491('0x2')]='';}Agent['prototype'][_0x2491('0x13')]=function(_0x10b7bc){var _0x56b815;if(_0x10b7bc&&_0x10b7bc[_0x2491('0x14')]){_0x56b815=_0x10b7bc[_0x2491('0x14')][_0x2491('0x15')]();switch(_0x56b815){case _0x2491('0x16'):_0x56b815=_0x2491('0x17');break;case _0x2491('0x18'):_0x56b815=_0x2491('0x19');break;}}if(_0x56b815&&this['voiceStatus']!==_0x56b815||_0x10b7bc[_0x2491('0x1a')]){this[_0x2491('0x10')]=_[_0x2491('0x1b')](moment()[_0x2491('0x1c')]('x'));}if(_0x56b815){this[_0x2491('0xf')]=_0x56b815;}var _0x2472ee={'id':this['id'],'name':this[_0x2491('0x8')],'email':this[_0x2491('0x9')],'accountcode':this[_0x2491('0xa')],'fullname':this[_0x2491('0xb')],'state':this[_0x2491('0x14')],'stateTime':this[_0x2491('0x1d')],'status':this[_0x2491('0xd')],'address':this['address'],'online':this[_0x2491('0x1e')],'voiceStatus':this[_0x2491('0xf')],'voiceStatusTime':this[_0x2491('0x10')],'voiceStatusCallerIdNumber':this[_0x2491('0x11')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x2491('0xe')],'onhold':this[_0x2491('0x1f')]};var _0x34f6e6=md5(JSON[_0x2491('0x20')](_0x2472ee));if(this[_0x2491('0x2')]!==_0x34f6e6){this['md5']=_0x34f6e6;io['to'](util[_0x2491('0x1c')]('user:%s',_0x2472ee[_0x2491('0x8')]))[_0x2491('0x21')](_0x2491('0x22'),_0x2472ee);io[_0x2491('0x21')](_0x2491('0x23'),_0x2472ee);}};module[_0x2491('0x24')]=Agent; \ No newline at end of file +var _0xd9fb=['idle','inuse','talking','voiceStatusTime','toNumber','status','voiceStatusQueue','stringify','user:%s','emit','exports','lodash','util','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','local','prototype','updateStatusRealtime','toLowerCase','not_inuse'];(function(_0x62db2d,_0x424e36){var _0xf89297=function(_0x4b31cc){while(--_0x4b31cc){_0x62db2d['push'](_0x62db2d['shift']());}};_0xf89297(++_0x424e36);}(_0xd9fb,0x9f));var _0xbd9f=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xd9fb[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var moment=require('moment');var md5=require(_0xbd9f('0x2'));var Redis=require(_0xbd9f('0x3'));var config=require('../../../config/environment');config[_0xbd9f('0x4')]=_[_0xbd9f('0x5')](config['redis'],{'host':_0xbd9f('0x6'),'port':0x18eb});var io=require(_0xbd9f('0x7'))(new Redis(config[_0xbd9f('0x4')]));function Agent(_0x5b0468){this['id']=_0x5b0468['id']||0x0;this['name']=_0x5b0468[_0xbd9f('0x8')]||'';this[_0xbd9f('0x9')]=_0x5b0468[_0xbd9f('0x9')]||'';this[_0xbd9f('0xa')]=_0x5b0468[_0xbd9f('0xa')]||'';this[_0xbd9f('0xb')]=_0x5b0468[_0xbd9f('0xb')]||'';this[_0xbd9f('0xc')]=_0xbd9f('0xd');this[_0xbd9f('0xe')]=0x0;this['status']=_0xbd9f('0xd');this[_0xbd9f('0xf')]='';this['phone']='';this[_0xbd9f('0x10')]='';this[_0xbd9f('0x11')]='';this[_0xbd9f('0x12')]=_0x5b0468['online']||![];this[_0xbd9f('0x13')]=_0xbd9f('0xd');this['voiceStatusTime']=0x0;this[_0xbd9f('0x14')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0xbd9f('0x15')]=![];this[_0xbd9f('0x2')]='';}Agent[_0xbd9f('0x16')][_0xbd9f('0x17')]=function(_0x450003){var _0x1cffd1;if(_0x450003&&_0x450003['state']){_0x1cffd1=_0x450003[_0xbd9f('0xc')][_0xbd9f('0x18')]();switch(_0x1cffd1){case _0xbd9f('0x19'):_0x1cffd1=_0xbd9f('0x1a');break;case _0xbd9f('0x1b'):_0x1cffd1=_0xbd9f('0x1c');break;}}if(_0x1cffd1&&this[_0xbd9f('0x13')]!==_0x1cffd1||_0x450003['statePause']){this[_0xbd9f('0x1d')]=_[_0xbd9f('0x1e')](moment()['format']('x'));}if(_0x1cffd1){this[_0xbd9f('0x13')]=_0x1cffd1;}var _0x36e059={'id':this['id'],'name':this[_0xbd9f('0x8')],'email':this[_0xbd9f('0x9')],'accountcode':this['accountcode'],'fullname':this[_0xbd9f('0xb')],'state':this[_0xbd9f('0xc')],'stateTime':this[_0xbd9f('0xe')],'status':this[_0xbd9f('0x1f')],'address':this[_0xbd9f('0xf')],'online':this[_0xbd9f('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xbd9f('0x1d')],'voiceStatusCallerIdNumber':this[_0xbd9f('0x14')],'voiceStatusQueue':this[_0xbd9f('0x20')],'interface':this[_0xbd9f('0x11')],'onhold':this['onhold']};var _0x330f7a=md5(JSON[_0xbd9f('0x21')](_0x36e059));if(this[_0xbd9f('0x2')]!==_0x330f7a){this[_0xbd9f('0x2')]=_0x330f7a;io['to'](util['format'](_0xbd9f('0x22'),_0x36e059[_0xbd9f('0x8')]))[_0xbd9f('0x23')]('user:save',_0x36e059);io[_0xbd9f('0x23')]('user:presence',_0x36e059);}};module[_0xbd9f('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index e4bdfea..5e9eaf7 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 _0xa2d6=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x55e92e,_0x29df69){var _0x276969=function(_0x28791e){while(--_0x28791e){_0x55e92e['push'](_0x55e92e['shift']());}};_0x276969(++_0x29df69);}(_0xa2d6,0x124));var _0x6a2d=function(_0x125425,_0x4b6bab){_0x125425=_0x125425-0x0;var _0xd04dc4=_0xa2d6[_0x125425];return _0xd04dc4;};'use strict';function Campaign(_0x797e18){this['id']=_0x797e18['id']||0x0;this[_0x6a2d('0x0')]=_0x797e18[_0x6a2d('0x0')]||'';this['type']=_0x797e18[_0x6a2d('0x1')]||_0x6a2d('0x2');this[_0x6a2d('0x3')]=0x0;this[_0x6a2d('0x4')]=0x0;this[_0x6a2d('0x5')]=0x0;this[_0x6a2d('0x6')]=0x0;this[_0x6a2d('0x7')]='';this[_0x6a2d('0x8')]=!![];this[_0x6a2d('0x9')]=_0x797e18[_0x6a2d('0x9')];this['limitCalls']=_0x797e18[_0x6a2d('0xa')];this[_0x6a2d('0xb')]=_0x797e18['dialTimezone']||null;this[_0x6a2d('0xc')]=_0x797e18[_0x6a2d('0xc')]?_0x797e18[_0x6a2d('0xc')]:null;this['dialOriginateCallerIdName']=_0x797e18['dialOriginateCallerIdName'];this[_0x6a2d('0xd')]=_0x797e18['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x797e18[_0x6a2d('0xe')]||0x1e;this[_0x6a2d('0xf')]=_0x797e18['dialCongestionMaxRetry'];this[_0x6a2d('0x10')]=_0x797e18[_0x6a2d('0x10')];this[_0x6a2d('0x11')]=_0x797e18[_0x6a2d('0x11')];this[_0x6a2d('0x12')]=_0x797e18['dialBusyRetryFrequency'];this[_0x6a2d('0x13')]=_0x797e18[_0x6a2d('0x13')];this[_0x6a2d('0x14')]=_0x797e18[_0x6a2d('0x14')];this[_0x6a2d('0x15')]=_0x797e18[_0x6a2d('0x15')];this[_0x6a2d('0x16')]=_0x797e18[_0x6a2d('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x797e18[_0x6a2d('0x17')]||0x96;this[_0x6a2d('0x18')]=_0x797e18[_0x6a2d('0x18')]||0x3;this['dialDropRetryFrequency']=_0x797e18[_0x6a2d('0x19')]||0x96;this[_0x6a2d('0x1a')]=_0x797e18[_0x6a2d('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x797e18[_0x6a2d('0x1b')]||0x96;this[_0x6a2d('0x1c')]=_0x797e18['dialMachineMaxRetry']||0x3;this[_0x6a2d('0x1d')]=_0x797e18[_0x6a2d('0x1d')]||0x96;this[_0x6a2d('0x1e')]=_0x797e18[_0x6a2d('0x1e')]||0x3;this[_0x6a2d('0x1f')]=_0x797e18[_0x6a2d('0x1f')]||0x96;this[_0x6a2d('0x20')]=_0x797e18['dialOrderByScheduledAt']||_0x6a2d('0x21');this[_0x6a2d('0x22')]=_0x797e18[_0x6a2d('0x22')]||undefined;this[_0x6a2d('0x23')]=_0x797e18['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6a2d('0x24')]=_0x797e18[_0x6a2d('0x24')]||undefined;this[_0x6a2d('0x25')]=_0x797e18[_0x6a2d('0x25')]?_0x797e18[_0x6a2d('0x25')]:undefined;this[_0x6a2d('0x26')]=_0x797e18['Trunk']?_0x797e18[_0x6a2d('0x26')]:undefined;this[_0x6a2d('0x27')]=_0x797e18[_0x6a2d('0x27')]?_0x797e18[_0x6a2d('0x27')]:undefined;this[_0x6a2d('0x28')]=_0x797e18['SquareProject']?_0x797e18[_0x6a2d('0x28')]:undefined;this[_0x6a2d('0x29')]=_0x797e18[_0x6a2d('0x28')]?_0x797e18[_0x6a2d('0x28')][_0x6a2d('0x0')]:undefined;this[_0x6a2d('0x2a')]=_0x797e18[_0x6a2d('0x2a')]||![];this['dialAMDInitialSilence']=_0x797e18[_0x6a2d('0x2b')];this[_0x6a2d('0x2c')]=_0x797e18[_0x6a2d('0x2c')];this['dialAMDAfterGreetingSilence']=_0x797e18[_0x6a2d('0x2d')];this[_0x6a2d('0x2e')]=_0x797e18[_0x6a2d('0x2e')];this[_0x6a2d('0x2f')]=_0x797e18[_0x6a2d('0x2f')];this[_0x6a2d('0x30')]=_0x797e18[_0x6a2d('0x30')];this[_0x6a2d('0x31')]=_0x797e18['dialAMDMaximumNumberOfWords'];this[_0x6a2d('0x32')]=_0x797e18[_0x6a2d('0x32')];this[_0x6a2d('0x33')]=_0x797e18['dialAMDMaximumWordLength'];}module[_0x6a2d('0x34')]=Campaign; \ No newline at end of file +var _0xb2c5=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2c5,0x1e4));var _0x5b2c=function(_0x3af21a,_0x41400d){_0x3af21a=_0x3af21a-0x0;var _0x31334b=_0xb2c5[_0x3af21a];return _0x31334b;};'use strict';function Campaign(_0x5ef0f1){this['id']=_0x5ef0f1['id']||0x0;this[_0x5b2c('0x0')]=_0x5ef0f1[_0x5b2c('0x0')]||'';this[_0x5b2c('0x1')]=_0x5ef0f1[_0x5b2c('0x1')]||_0x5b2c('0x2');this[_0x5b2c('0x3')]=0x0;this['temp']=0x0;this[_0x5b2c('0x4')]=0x0;this[_0x5b2c('0x5')]=0x0;this['message']='';this[_0x5b2c('0x6')]=!![];this[_0x5b2c('0x7')]=_0x5ef0f1[_0x5b2c('0x7')];this[_0x5b2c('0x8')]=_0x5ef0f1['limitCalls'];this[_0x5b2c('0x9')]=_0x5ef0f1[_0x5b2c('0x9')]||null;this['dialGlobalInterval']=_0x5ef0f1[_0x5b2c('0xa')]?_0x5ef0f1['dialGlobalInterval']:null;this[_0x5b2c('0xb')]=_0x5ef0f1[_0x5b2c('0xb')];this['dialOriginateCallerIdNumber']=_0x5ef0f1['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x5ef0f1[_0x5b2c('0xc')]||0x1e;this[_0x5b2c('0xd')]=_0x5ef0f1['dialCongestionMaxRetry'];this[_0x5b2c('0xe')]=_0x5ef0f1[_0x5b2c('0xe')];this[_0x5b2c('0xf')]=_0x5ef0f1[_0x5b2c('0xf')];this[_0x5b2c('0x10')]=_0x5ef0f1[_0x5b2c('0x10')];this['dialNoAnswerMaxRetry']=_0x5ef0f1['dialNoAnswerMaxRetry'];this[_0x5b2c('0x11')]=_0x5ef0f1[_0x5b2c('0x11')];this[_0x5b2c('0x12')]=_0x5ef0f1[_0x5b2c('0x12')];this[_0x5b2c('0x13')]=_0x5ef0f1['dialNoSuchNumberMaxRetry']||0x3;this[_0x5b2c('0x14')]=_0x5ef0f1['dialNoSuchNumberRetryFrequency']||0x96;this[_0x5b2c('0x15')]=_0x5ef0f1[_0x5b2c('0x15')]||0x3;this['dialDropRetryFrequency']=_0x5ef0f1[_0x5b2c('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x5ef0f1[_0x5b2c('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x5ef0f1['dialAbandonedRetryFrequency']||0x96;this[_0x5b2c('0x18')]=_0x5ef0f1[_0x5b2c('0x18')]||0x3;this[_0x5b2c('0x19')]=_0x5ef0f1[_0x5b2c('0x19')]||0x96;this[_0x5b2c('0x1a')]=_0x5ef0f1['dialAgentRejectMaxRetry']||0x3;this[_0x5b2c('0x1b')]=_0x5ef0f1[_0x5b2c('0x1b')]||0x96;this[_0x5b2c('0x1c')]=_0x5ef0f1[_0x5b2c('0x1c')]||_0x5b2c('0x1d');this[_0x5b2c('0x1e')]=_0x5ef0f1[_0x5b2c('0x1e')]||undefined;this[_0x5b2c('0x1f')]=_0x5ef0f1[_0x5b2c('0x1f')]||undefined;this[_0x5b2c('0x20')]=_0x5ef0f1['dialCutDigit']||undefined;this['TrunkBackup']=_0x5ef0f1[_0x5b2c('0x21')]?_0x5ef0f1[_0x5b2c('0x21')]:undefined;this[_0x5b2c('0x22')]=_0x5ef0f1[_0x5b2c('0x22')]?_0x5ef0f1[_0x5b2c('0x22')]:undefined;this['Interval']=_0x5ef0f1[_0x5b2c('0x23')]?_0x5ef0f1['Interval']:undefined;this[_0x5b2c('0x24')]=_0x5ef0f1[_0x5b2c('0x24')]?_0x5ef0f1[_0x5b2c('0x24')]:undefined;this[_0x5b2c('0x25')]=_0x5ef0f1['SquareProject']?_0x5ef0f1['SquareProject'][_0x5b2c('0x0')]:undefined;this[_0x5b2c('0x26')]=_0x5ef0f1[_0x5b2c('0x26')]||![];this[_0x5b2c('0x27')]=_0x5ef0f1[_0x5b2c('0x27')];this[_0x5b2c('0x28')]=_0x5ef0f1['dialAMDGreeting'];this[_0x5b2c('0x29')]=_0x5ef0f1[_0x5b2c('0x29')];this[_0x5b2c('0x2a')]=_0x5ef0f1['dialAMDTotalAnalysisTime'];this[_0x5b2c('0x2b')]=_0x5ef0f1['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x5ef0f1[_0x5b2c('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x5ef0f1['dialAMDMaximumNumberOfWords'];this[_0x5b2c('0x2d')]=_0x5ef0f1[_0x5b2c('0x2d')];this['dialAMDMaximumWordLength']=_0x5ef0f1['dialAMDMaximumWordLength'];}module[_0x5b2c('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2058f71..c93d0db 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 _0x8ff9=['disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','type','tag'];(function(_0x4ea8a1,_0x3ac827){var _0x29ed69=function(_0x8d79ab){while(--_0x8d79ab){_0x4ea8a1['push'](_0x4ea8a1['shift']());}};_0x29ed69(++_0x3ac827);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x3a3143,_0x5e832f){_0x3a3143=_0x3a3143-0x0;var _0x50a900=_0x8ff9[_0x3a3143];return _0x50a900;};'use strict';function Channel(){this[_0x98ff('0x0')]=null;this[_0x98ff('0x1')]='';this[_0x98ff('0x2')]='';this[_0x98ff('0x3')]=0x0;this[_0x98ff('0x4')]='';this[_0x98ff('0x5')]=undefined;this[_0x98ff('0x6')]=undefined;this[_0x98ff('0x7')]=0x0;this[_0x98ff('0x8')]='';this[_0x98ff('0x9')]=0x0;this[_0x98ff('0xa')]=0x0;this['exten']=0x0;this[_0x98ff('0xb')]=![];this[_0x98ff('0xc')]=null;this[_0x98ff('0xd')]=null;this[_0x98ff('0xe')]=![];this[_0x98ff('0xf')]=![];this[_0x98ff('0x10')]='';this['lastdata']='';this[_0x98ff('0x11')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x98ff('0x12')]=null;this[_0x98ff('0x13')]=null;this[_0x98ff('0x14')]=null;this[_0x98ff('0x15')]=![];this[_0x98ff('0x16')]=null;this['queue']=null;this[_0x98ff('0x17')]=[];this['transfercalleridnum']=undefined;this[_0x98ff('0x18')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x98ff('0x19')]=Channel; \ No newline at end of file +var _0x0733=['transfercalleridnum','transferconnectedlinenum','transferType','mohtime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','holdtime','type','disposition','queue','monitors'];(function(_0x2fcfde,_0x14e84a){var _0x3570fe=function(_0x1a1431){while(--_0x1a1431){_0x2fcfde['push'](_0x2fcfde['shift']());}};_0x3570fe(++_0x14e84a);}(_0x0733,0xc4));var _0x3073=function(_0x3ba353,_0x15130a){_0x3ba353=_0x3ba353-0x0;var _0x1592cf=_0x0733[_0x3ba353];return _0x1592cf;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x3073('0x0')]='';this[_0x3073('0x1')]=0x0;this[_0x3073('0x2')]='';this['connectedlinenum']=undefined;this[_0x3073('0x3')]=undefined;this[_0x3073('0x4')]=0x0;this['context']='';this[_0x3073('0x5')]=0x0;this[_0x3073('0x6')]=0x0;this[_0x3073('0x7')]=0x0;this[_0x3073('0x8')]=![];this[_0x3073('0x9')]=null;this[_0x3073('0xa')]=null;this[_0x3073('0xb')]=![];this[_0x3073('0xc')]=![];this[_0x3073('0xd')]='';this[_0x3073('0xe')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x3073('0xf')]=0x0;this[_0x3073('0x10')]=null;this['tag']=null;this[_0x3073('0x11')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x3073('0x12')]=null;this[_0x3073('0x13')]=[];this[_0x3073('0x14')]=undefined;this[_0x3073('0x15')]=undefined;this[_0x3073('0x16')]=undefined;this[_0x3073('0x17')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 420d809..8a94c0c 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 _0x2f5a=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret','type'];(function(_0x1cfd38,_0x15a1b0){var _0x5dd1fc=function(_0x6bf1){while(--_0x6bf1){_0x1cfd38['push'](_0x1cfd38['shift']());}};_0x5dd1fc(++_0x15a1b0);}(_0x2f5a,0x12f));var _0xa2f5=function(_0x28ff30,_0x342f9c){_0x28ff30=_0x28ff30-0x0;var _0x453c8b=_0x2f5a[_0x28ff30];return _0x453c8b;};'use strict';function DeskAccount(_0x6e3e9d){this['id']=_0x6e3e9d['id']||0x0;this[_0xa2f5('0x0')]=_0x6e3e9d[_0xa2f5('0x0')]||'';this[_0xa2f5('0x1')]=_0x6e3e9d[_0xa2f5('0x1')]||'';this['remoteUri']=_0x6e3e9d[_0xa2f5('0x2')]||'';this[_0xa2f5('0x3')]=_0x6e3e9d[_0xa2f5('0x3')]||'';this[_0xa2f5('0x4')]=_0x6e3e9d['password']||'';this[_0xa2f5('0x5')]=_0x6e3e9d['consumerKey']||'';this['consumerSecret']=_0x6e3e9d['consumerSecret']||'';this[_0xa2f5('0x6')]=_0x6e3e9d[_0xa2f5('0x6')]||'';this[_0xa2f5('0x7')]=_0x6e3e9d['tokenSecret']||'';this[_0xa2f5('0x8')]=_0x6e3e9d[_0xa2f5('0x8')]||'';this[_0xa2f5('0x9')]=_0x6e3e9d[_0xa2f5('0x9')]||'';this[_0xa2f5('0xa')]=_0x6e3e9d['Configurations']||{};}module[_0xa2f5('0xb')]=DeskAccount; \ No newline at end of file +var _0x024e=['serverUrl','Configurations','exports','name','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x177452,_0x76dd98){var _0x4e41fa=function(_0x5826bc){while(--_0x5826bc){_0x177452['push'](_0x177452['shift']());}};_0x4e41fa(++_0x76dd98);}(_0x024e,0xf5));var _0xe024=function(_0x48c2ae,_0x4cea90){_0x48c2ae=_0x48c2ae-0x0;var _0x8f7531=_0x024e[_0x48c2ae];return _0x8f7531;};'use strict';function DeskAccount(_0x38aa75){this['id']=_0x38aa75['id']||0x0;this[_0xe024('0x0')]=_0x38aa75[_0xe024('0x0')]||'';this['username']=_0x38aa75['username']||'';this[_0xe024('0x1')]=_0x38aa75[_0xe024('0x1')]||'';this[_0xe024('0x2')]=_0x38aa75['authType']||'';this['password']=_0x38aa75['password']||'';this['consumerKey']=_0x38aa75[_0xe024('0x3')]||'';this['consumerSecret']=_0x38aa75[_0xe024('0x4')]||'';this[_0xe024('0x5')]=_0x38aa75[_0xe024('0x5')]||'';this[_0xe024('0x6')]=_0x38aa75['tokenSecret']||'';this[_0xe024('0x7')]=_0x38aa75['type']||'';this['serverUrl']=_0x38aa75[_0xe024('0x8')]||'';this['Configurations']=_0x38aa75[_0xe024('0x9')]||{};}module[_0xe024('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 56f7732..d515205 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 _0x729b=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x3634d8,_0xbfa70b){var _0x2c1369=function(_0x27b79a){while(--_0x27b79a){_0x3634d8['push'](_0x3634d8['shift']());}};_0x2c1369(++_0xbfa70b);}(_0x729b,0x1d6));var _0xb729=function(_0x155c70,_0x8cae07){_0x155c70=_0x155c70-0x0;var _0x479bf2=_0x729b[_0x155c70];return _0x479bf2;};'use strict';function Dynamics365Account(_0x164177){this['id']=_0x164177['id']||0x0;this['name']=_0x164177[_0xb729('0x0')]||'';this['username']=_0x164177[_0xb729('0x1')]||'';this[_0xb729('0x2')]=_0x164177[_0xb729('0x2')]||'';this[_0xb729('0x3')]=_0x164177['remoteUri']||'';this['tenantId']=_0x164177[_0xb729('0x4')]||'';this[_0xb729('0x5')]=_0x164177[_0xb729('0x5')]||'';this['clientSecret']=_0x164177[_0xb729('0x6')]||{};this[_0xb729('0x7')]=_0x164177[_0xb729('0x7')]||'';this[_0xb729('0x8')]=_0x164177[_0xb729('0x8')]||![];this[_0xb729('0x9')]=_0x164177[_0xb729('0x9')]||{};this[_0xb729('0xa')]=_0x164177['CloudProvider']||{};}module[_0xb729('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x6b7e=['tenantId','clientId','clientSecret','serverUrl','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b7e,0x167));var _0xe6b7=function(_0x2026ff,_0x4d5b46){_0x2026ff=_0x2026ff-0x0;var _0x409300=_0x6b7e[_0x2026ff];return _0x409300;};'use strict';function Dynamics365Account(_0x433825){this['id']=_0x433825['id']||0x0;this[_0xe6b7('0x0')]=_0x433825['name']||'';this[_0xe6b7('0x1')]=_0x433825['username']||'';this['password']=_0x433825[_0xe6b7('0x2')]||'';this[_0xe6b7('0x3')]=_0x433825['remoteUri']||'';this[_0xe6b7('0x4')]=_0x433825[_0xe6b7('0x4')]||'';this[_0xe6b7('0x5')]=_0x433825[_0xe6b7('0x5')]||'';this[_0xe6b7('0x6')]=_0x433825[_0xe6b7('0x6')]||{};this['serverUrl']=_0x433825[_0xe6b7('0x7')]||'';this['modernAuthentication']=_0x433825['modernAuthentication']||![];this[_0xe6b7('0x8')]=_0x433825[_0xe6b7('0x8')]||{};this[_0xe6b7('0x9')]=_0x433825[_0xe6b7('0x9')]||{};}module[_0xe6b7('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 d74611f..a07f891 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 _0x1df2=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key'];(function(_0x45c262,_0x2e3ce5){var _0x4f2ba6=function(_0x4912d1){while(--_0x4912d1){_0x45c262['push'](_0x45c262['shift']());}};_0x4f2ba6(++_0x2e3ce5);}(_0x1df2,0x1d1));var _0x21df=function(_0x197be8,_0x45411c){_0x197be8=_0x197be8-0x0;var _0x4d5115=_0x1df2[_0x197be8];return _0x4d5115;};'use strict';function FaxAccount(_0x342792){this['id']=_0x342792['id']||0x0;this[_0x21df('0x0')]=_0x342792[_0x21df('0x0')]||'';this[_0x21df('0x1')]=_0x342792[_0x21df('0x1')];this[_0x21df('0x2')]=_0x342792[_0x21df('0x2')];this[_0x21df('0x3')]=_0x342792[_0x21df('0x3')];this['localstationid']=_0x342792[_0x21df('0x4')];this[_0x21df('0x5')]=_0x342792[_0x21df('0x5')]||0x960;this[_0x21df('0x6')]=_0x342792[_0x21df('0x6')]||0x3840;this['modem']=_0x342792['modem']||_0x21df('0x7');this['gateway']=_0x342792[_0x21df('0x8')]||'no';this[_0x21df('0x9')]=_0x342792['faxdetect']||'no';this[_0x21df('0xa')]=_0x342792['t38timeout']||0x1388;this[_0x21df('0xb')]=_0x342792[_0x21df('0xb')]||_0x21df('0xc');this['Trunk']=_0x342792[_0x21df('0xd')]?_0x342792[_0x21df('0xd')]:undefined;this['ListId']=_0x342792['ListId'];this[_0x21df('0xe')]=_0x342792['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x9d83=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x9d83,0x12f));var _0x39d8=function(_0x13a621,_0x29b45c){_0x13a621=_0x13a621-0x0;var _0x19c55d=_0x9d83[_0x13a621];return _0x19c55d;};'use strict';function FaxAccount(_0x487f28){this['id']=_0x487f28['id']||0x0;this[_0x39d8('0x0')]=_0x487f28[_0x39d8('0x0')]||'';this[_0x39d8('0x1')]=_0x487f28[_0x39d8('0x1')];this[_0x39d8('0x2')]=_0x487f28[_0x39d8('0x2')];this[_0x39d8('0x3')]=_0x487f28[_0x39d8('0x3')];this[_0x39d8('0x4')]=_0x487f28[_0x39d8('0x4')];this['minrate']=_0x487f28[_0x39d8('0x5')]||0x960;this[_0x39d8('0x6')]=_0x487f28[_0x39d8('0x6')]||0x3840;this[_0x39d8('0x7')]=_0x487f28[_0x39d8('0x7')]||_0x39d8('0x8');this[_0x39d8('0x9')]=_0x487f28[_0x39d8('0x9')]||'no';this[_0x39d8('0xa')]=_0x487f28[_0x39d8('0xa')]||'no';this[_0x39d8('0xb')]=_0x487f28[_0x39d8('0xb')]||0x1388;this['tech']=_0x487f28['tech']||_0x39d8('0xc');this[_0x39d8('0xd')]=_0x487f28[_0x39d8('0xd')]?_0x487f28['Trunk']:undefined;this[_0x39d8('0xe')]=_0x487f28[_0x39d8('0xe')];this['key']=_0x487f28[_0x39d8('0xf')];}module[_0x39d8('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 856fa11..c760fb0 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 _0xee55=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x19f4ee,_0x208b6a){var _0x2cc923=function(_0x515950){while(--_0x515950){_0x19f4ee['push'](_0x19f4ee['shift']());}};_0x2cc923(++_0x208b6a);}(_0xee55,0x154));var _0x5ee5=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xee55[_0x1399d6];return _0x4a9db4;};'use strict';function FreshdeskAccount(_0x3dadbc){this['id']=_0x3dadbc['id']||0x0;this[_0x5ee5('0x0')]=_0x3dadbc[_0x5ee5('0x0')]||'';this[_0x5ee5('0x1')]=_0x3dadbc[_0x5ee5('0x1')]||'';this[_0x5ee5('0x2')]=_0x3dadbc[_0x5ee5('0x3')]||'';this[_0x5ee5('0x4')]=_0x3dadbc[_0x5ee5('0x4')]||'';this[_0x5ee5('0x5')]=_0x3dadbc[_0x5ee5('0x5')]||'';this[_0x5ee5('0x6')]=_0x3dadbc[_0x5ee5('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x5919=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x34872f,_0x518199){var _0x1138e3=function(_0x303ce6){while(--_0x303ce6){_0x34872f['push'](_0x34872f['shift']());}};_0x1138e3(++_0x518199);}(_0x5919,0x68));var _0x9591=function(_0x25ad30,_0x4d9cb8){_0x25ad30=_0x25ad30-0x0;var _0x97c45e=_0x5919[_0x25ad30];return _0x97c45e;};'use strict';function FreshdeskAccount(_0x1db975){this['id']=_0x1db975['id']||0x0;this[_0x9591('0x0')]=_0x1db975['name']||'';this[_0x9591('0x1')]=_0x1db975['username']||'';this[_0x9591('0x2')]=_0x1db975[_0x9591('0x3')]||'';this[_0x9591('0x4')]=_0x1db975['remoteUri']||'';this[_0x9591('0x5')]=_0x1db975[_0x9591('0x5')]||'';this[_0x9591('0x6')]=_0x1db975[_0x9591('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e532cf2..56abf98 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 _0xbf4e=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf4e,0x172));var _0xebf4=function(_0x571066,_0x55c6b0){_0x571066=_0x571066-0x0;var _0x388f47=_0xbf4e[_0x571066];return _0x388f47;};'use strict';function FreshsalesAccount(_0x4047f){this['id']=_0x4047f['id']||0x0;this[_0xebf4('0x0')]=_0x4047f[_0xebf4('0x0')]||'';this[_0xebf4('0x1')]=_0x4047f[_0xebf4('0x1')]||'';this[_0xebf4('0x2')]=_0x4047f['token']||'';this[_0xebf4('0x3')]=_0x4047f['remoteUri']||'';this['serverUrl']=_0x4047f[_0xebf4('0x4')]||'';this[_0xebf4('0x5')]=_0x4047f['Configurations']||{};}module[_0xebf4('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x2087=['apiKey','token','remoteUri','Configurations','exports','name','username'];(function(_0x488ed0,_0x202821){var _0xc2767b=function(_0x47a1e9){while(--_0x47a1e9){_0x488ed0['push'](_0x488ed0['shift']());}};_0xc2767b(++_0x202821);}(_0x2087,0xf3));var _0x7208=function(_0x8a9e09,_0x13c855){_0x8a9e09=_0x8a9e09-0x0;var _0x2c5459=_0x2087[_0x8a9e09];return _0x2c5459;};'use strict';function FreshsalesAccount(_0x31d8e7){this['id']=_0x31d8e7['id']||0x0;this[_0x7208('0x0')]=_0x31d8e7[_0x7208('0x0')]||'';this[_0x7208('0x1')]=_0x31d8e7['username']||'';this[_0x7208('0x2')]=_0x31d8e7[_0x7208('0x3')]||'';this[_0x7208('0x4')]=_0x31d8e7[_0x7208('0x4')]||'';this['serverUrl']=_0x31d8e7['serverUrl']||'';this[_0x7208('0x5')]=_0x31d8e7['Configurations']||{};}module[_0x7208('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 1921283..0d63f59 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 _0x7ece=['context','priority','holdtime','lastAssignedTo','motionChannel','routealias','mohtime','variables','exports','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x4bab92,_0x497266){var _0x5ebe8b=function(_0x229d91){while(--_0x229d91){_0x4bab92['push'](_0x4bab92['shift']());}};_0x5ebe8b(++_0x497266);}(_0x7ece,0xc9));var _0xe7ec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7ece[_0xfae23b];return _0x200640;};'use strict';function QueueReport(){this['type']=_0xe7ec('0x0');this[_0xe7ec('0x1')]='';this['calleridnum']='';this[_0xe7ec('0x2')]='';this[_0xe7ec('0x3')]='';this[_0xe7ec('0x4')]=null;this[_0xe7ec('0x5')]=null;this[_0xe7ec('0x6')]=0x1;this[_0xe7ec('0x7')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xe7ec('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xe7ec('0x9')]=![];this[_0xe7ec('0xa')]=null;this[_0xe7ec('0xb')]=0x1;this[_0xe7ec('0xc')]='';this[_0xe7ec('0xd')]='';this[_0xe7ec('0xe')]='';this['accountcode']='';this[_0xe7ec('0xf')]='';this['exten']='';this[_0xe7ec('0x10')]='';this[_0xe7ec('0x11')]=0x0;this['assigned']=![];this[_0xe7ec('0x12')]='';this[_0xe7ec('0x13')]='voice';this[_0xe7ec('0x14')]=null;this[_0xe7ec('0x15')]=0x0;this[_0xe7ec('0x16')]={};}module[_0xe7ec('0x17')]=QueueReport; \ No newline at end of file +var _0xe981=['position','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','variables','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt'];(function(_0x20495c,_0x32670a){var _0x2c2f2a=function(_0x4d0fe1){while(--_0x4d0fe1){_0x20495c['push'](_0x20495c['shift']());}};_0x2c2f2a(++_0x32670a);}(_0xe981,0x77));var _0x1e98=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0xe981[_0x5bfa44];return _0x43815f;};'use strict';function QueueReport(){this[_0x1e98('0x0')]=_0x1e98('0x1');this[_0x1e98('0x2')]='';this['calleridnum']='';this[_0x1e98('0x3')]='';this[_0x1e98('0x4')]='';this[_0x1e98('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x1e98('0x6')]=0x1;this['count']=0x1;this[_0x1e98('0x7')]=![];this[_0x1e98('0x8')]=null;this['queuecallercomplete']=![];this[_0x1e98('0x9')]=null;this[_0x1e98('0xa')]=![];this[_0x1e98('0xb')]=null;this[_0x1e98('0xc')]=0x1;this[_0x1e98('0xd')]='';this['connectedlinenum']='';this[_0x1e98('0xe')]='';this['accountcode']='';this[_0x1e98('0xf')]='';this[_0x1e98('0x10')]='';this[_0x1e98('0x11')]='';this[_0x1e98('0x12')]=0x0;this[_0x1e98('0x13')]=![];this[_0x1e98('0x14')]='';this[_0x1e98('0x15')]=_0x1e98('0x16');this[_0x1e98('0x17')]=null;this['mohtime']=0x0;this[_0x1e98('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index bcd40c3..79a146c 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 _0x4a08=['serverUrl','Configurations','exports','name','username','password','clientId','clientSecret','type','integrationTab'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x4a08,0x11b));var _0x84a0=function(_0x49197e,_0xb3373f){_0x49197e=_0x49197e-0x0;var _0x4e883e=_0x4a08[_0x49197e];return _0x4e883e;};'use strict';function SalesforceAccount(_0x17cc12){this['id']=_0x17cc12['id']||0x0;this['name']=_0x17cc12[_0x84a0('0x0')]||'';this[_0x84a0('0x1')]=_0x17cc12[_0x84a0('0x1')]||'';this['remoteUri']=_0x17cc12['remoteUri']||'';this[_0x84a0('0x2')]=_0x17cc12[_0x84a0('0x2')]||'';this['clientId']=_0x17cc12[_0x84a0('0x3')]||'';this['clientSecret']=_0x17cc12[_0x84a0('0x4')]||'';this['securityToken']=_0x17cc12['securityToken']||'';this[_0x84a0('0x5')]=_0x17cc12['type']||_0x84a0('0x6');this[_0x84a0('0x7')]=_0x17cc12[_0x84a0('0x7')]||'';this[_0x84a0('0x8')]=_0x17cc12[_0x84a0('0x8')]||{};}module[_0x84a0('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x175c=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x175c,0x120));var _0xc175=function(_0x1c7d3e,_0x243ff7){_0x1c7d3e=_0x1c7d3e-0x0;var _0x3a9cdd=_0x175c[_0x1c7d3e];return _0x3a9cdd;};'use strict';function SalesforceAccount(_0x59bac7){this['id']=_0x59bac7['id']||0x0;this[_0xc175('0x0')]=_0x59bac7['name']||'';this['username']=_0x59bac7[_0xc175('0x1')]||'';this[_0xc175('0x2')]=_0x59bac7[_0xc175('0x2')]||'';this[_0xc175('0x3')]=_0x59bac7[_0xc175('0x3')]||'';this[_0xc175('0x4')]=_0x59bac7[_0xc175('0x4')]||'';this[_0xc175('0x5')]=_0x59bac7[_0xc175('0x5')]||'';this[_0xc175('0x6')]=_0x59bac7[_0xc175('0x6')]||'';this[_0xc175('0x7')]=_0x59bac7[_0xc175('0x7')]||_0xc175('0x8');this[_0xc175('0x9')]=_0x59bac7[_0xc175('0x9')]||'';this[_0xc175('0xa')]=_0x59bac7['Configurations']||{};}module[_0xc175('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 5aeb300..626e7d8 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 _0x141b=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x582db3,_0x4a7a22){var _0x4f920f=function(_0x40b4e6){while(--_0x40b4e6){_0x582db3['push'](_0x582db3['shift']());}};_0x4f920f(++_0x4a7a22);}(_0x141b,0x138));var _0xb141=function(_0x24d46f,_0x2f7b71){_0x24d46f=_0x24d46f-0x0;var _0x2713e8=_0x141b[_0x24d46f];return _0x2713e8;};'use strict';function ServicenowAccount(_0x297534){this['id']=_0x297534['id']||0x0;this[_0xb141('0x0')]=_0x297534[_0xb141('0x0')]||'';this[_0xb141('0x1')]=_0x297534[_0xb141('0x1')]||'';this[_0xb141('0x2')]=_0x297534[_0xb141('0x2')]||'';this[_0xb141('0x3')]=_0x297534[_0xb141('0x3')]||'';this[_0xb141('0x4')]=_0x297534[_0xb141('0x4')]||'';this[_0xb141('0x5')]=_0x297534[_0xb141('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x4efc=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x4efc,0x1a2));var _0xc4ef=function(_0x337d38,_0x5cb203){_0x337d38=_0x337d38-0x0;var _0x502d8b=_0x4efc[_0x337d38];return _0x502d8b;};'use strict';function ServicenowAccount(_0x6e5da1){this['id']=_0x6e5da1['id']||0x0;this['name']=_0x6e5da1[_0xc4ef('0x0')]||'';this[_0xc4ef('0x1')]=_0x6e5da1[_0xc4ef('0x1')]||'';this[_0xc4ef('0x2')]=_0x6e5da1[_0xc4ef('0x2')]||'';this[_0xc4ef('0x3')]=_0x6e5da1['remoteUri']||'';this['serverUrl']=_0x6e5da1[_0xc4ef('0x4')]||'';this[_0xc4ef('0x5')]=_0x6e5da1[_0xc4ef('0x5')]||{};}module[_0xc4ef('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index dc4489f..189f04d 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 _0x440a=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x440a,0xfb));var _0xa440=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x440a[_0x17d9e3];return _0x14192d;};'use strict';function SugarcrmAccount(_0x37bb5b){this['id']=_0x37bb5b['id']||0x0;this['name']=_0x37bb5b[_0xa440('0x0')]||'';this[_0xa440('0x1')]=_0x37bb5b[_0xa440('0x1')]||'';this['password']=_0x37bb5b[_0xa440('0x2')]||'';this[_0xa440('0x3')]=_0x37bb5b[_0xa440('0x3')]||'';this[_0xa440('0x4')]=_0x37bb5b['serverUrl']||'';this[_0xa440('0x5')]=_0x37bb5b[_0xa440('0x5')]||{};}module[_0xa440('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xe080=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x49a898,_0x32b4c9){var _0x4dd272=function(_0x4d4630){while(--_0x4d4630){_0x49a898['push'](_0x49a898['shift']());}};_0x4dd272(++_0x32b4c9);}(_0xe080,0x141));var _0x0e08=function(_0x1308be,_0x2d1236){_0x1308be=_0x1308be-0x0;var _0xcd7c1f=_0xe080[_0x1308be];return _0xcd7c1f;};'use strict';function SugarcrmAccount(_0x3e4ded){this['id']=_0x3e4ded['id']||0x0;this[_0x0e08('0x0')]=_0x3e4ded[_0x0e08('0x0')]||'';this['username']=_0x3e4ded[_0x0e08('0x1')]||'';this[_0x0e08('0x2')]=_0x3e4ded[_0x0e08('0x2')]||'';this['remoteUri']=_0x3e4ded[_0x0e08('0x3')]||'';this[_0x0e08('0x4')]=_0x3e4ded[_0x0e08('0x4')]||'';this[_0x0e08('0x5')]=_0x3e4ded[_0x0e08('0x5')]||{};}module[_0x0e08('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 9f9fecb..7df148b 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 _0xe3af=['accountcode','state','unknown','stateTime','status','address','exports','name'];(function(_0x23e51d,_0x1b848b){var _0x5291a3=function(_0x49241e){while(--_0x49241e){_0x23e51d['push'](_0x23e51d['shift']());}};_0x5291a3(++_0x1b848b);}(_0xe3af,0x18f));var _0xfe3a=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0xe3af[_0x4347ec];return _0x4c8314;};'use strict';function Telephone(_0x3ee29d){this['id']=_0x3ee29d['id']||0x0;this[_0xfe3a('0x0')]=_0x3ee29d[_0xfe3a('0x0')]||'';this[_0xfe3a('0x1')]=_0x3ee29d['accountcode']||'';this[_0xfe3a('0x2')]=_0xfe3a('0x3');this[_0xfe3a('0x4')]=0x0;this[_0xfe3a('0x5')]=_0xfe3a('0x3');this[_0xfe3a('0x6')]='';}module[_0xfe3a('0x7')]=Telephone; \ No newline at end of file +var _0xe605=['address','exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x1968fc,_0x269841){var _0x32ecf0=function(_0x475cff){while(--_0x475cff){_0x1968fc['push'](_0x1968fc['shift']());}};_0x32ecf0(++_0x269841);}(_0xe605,0x92));var _0x5e60=function(_0x56d3d7,_0xae37d6){_0x56d3d7=_0x56d3d7-0x0;var _0x11dfd5=_0xe605[_0x56d3d7];return _0x11dfd5;};'use strict';function Telephone(_0x4cf32c){this['id']=_0x4cf32c['id']||0x0;this[_0x5e60('0x0')]=_0x4cf32c['name']||'';this[_0x5e60('0x1')]=_0x4cf32c[_0x5e60('0x1')]||'';this[_0x5e60('0x2')]=_0x5e60('0x3');this[_0x5e60('0x4')]=0x0;this[_0x5e60('0x5')]=_0x5e60('0x3');this[_0x5e60('0x6')]='';}module[_0x5e60('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 c221e24..3609b90 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(_0x408247,_0x3310fb){var _0x5abfa7=function(_0x2e6a29){while(--_0x2e6a29){_0x408247['push'](_0x408247['shift']());}};_0x5abfa7(++_0x3310fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x297b7a,_0x1a77e9){var _0x5beef9=function(_0x332725){while(--_0x332725){_0x297b7a['push'](_0x297b7a['shift']());}};_0x5beef9(++_0x1a77e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c50cf,_0x98e708){_0x3c50cf=_0x3c50cf-0x0;var _0x10214a=_0xb10b[_0x3c50cf];return _0x10214a;};'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 3c67dc6..a8bdf90 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(_0x4a69be,_0x12b879){var _0x35b8d6=function(_0x4b3018){while(--_0x4b3018){_0x4a69be['push'](_0x4a69be['shift']());}};_0x35b8d6(++_0x12b879);}(_0x757a,0xde));var _0xa757=function(_0x2829a8,_0xaa10b9){_0x2829a8=_0x2829a8-0x0;var _0x1d05ff=_0x757a[_0x2829a8];return _0x1d05ff;};'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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x587d76,_0x308045){var _0x31e80a=function(_0x2c2408){while(--_0x2c2408){_0x587d76['push'](_0x587d76['shift']());}};_0x31e80a(++_0x308045);}(_0xda2d,0x102));var _0xdda2=function(_0x31b4c5,_0x48ec78){_0x31b4c5=_0x31b4c5-0x0;var _0x3c060b=_0xda2d[_0x31b4c5];return _0x3c060b;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 4d318b1..05c029e 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 _0x0af3=['refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown','status','registry','indexOf','split','port','domain','domainport'];(function(_0x541090,_0x982a26){var _0x21d833=function(_0x5a29fb){while(--_0x5a29fb){_0x541090['push'](_0x541090['shift']());}};_0x21d833(++_0x982a26);}(_0x0af3,0xa5));var _0x30af=function(_0x20f0bf,_0x30bc2a){_0x20f0bf=_0x20f0bf-0x0;var _0x3a54e8=_0x0af3[_0x20f0bf];return _0x3a54e8;};'use strict';function Trunk(_0x1f136c){this['id']=_0x1f136c['id']||0x0;this['active']=_0x1f136c[_0x30af('0x0')]||![];this[_0x30af('0x1')]=_0x1f136c[_0x30af('0x1')]||'';this[_0x30af('0x2')]=_0x30af('0x3');this['stateTime']=0x0;this[_0x30af('0x4')]=_0x30af('0x3');this['registry']=_0x1f136c[_0x30af('0x5')]&&_0x1f136c[_0x30af('0x5')][_0x30af('0x6')](':')?_0x1f136c['registry'][_0x30af('0x7')](':')[0x0]:'';this['host']='';this[_0x30af('0x8')]='';this[_0x30af('0x9')]='';this[_0x30af('0xa')]='';this[_0x30af('0xb')]='';this[_0x30af('0xc')]=_0x30af('0x3');this['registrationtime']='';this[_0x30af('0xd')]='';this[_0x30af('0xe')]=_0x1f136c[_0x30af('0xe')]||'';}module[_0x30af('0xf')]=Trunk; \ No newline at end of file +var _0xd202=['defaultuser','exports','name','state','stateTime','status','unknown','registry','split','host','port','domain','domainport','stateRegistry','registrationtime','address'];(function(_0x2e1e80,_0x459d8f){var _0x525b43=function(_0x542e7){while(--_0x542e7){_0x2e1e80['push'](_0x2e1e80['shift']());}};_0x525b43(++_0x459d8f);}(_0xd202,0x172));var _0x2d20=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xd202[_0x4b2863];return _0x567d67;};'use strict';function Trunk(_0x4a0f9e){this['id']=_0x4a0f9e['id']||0x0;this['active']=_0x4a0f9e['active']||![];this[_0x2d20('0x0')]=_0x4a0f9e[_0x2d20('0x0')]||'';this[_0x2d20('0x1')]='unknown';this[_0x2d20('0x2')]=0x0;this[_0x2d20('0x3')]=_0x2d20('0x4');this['registry']=_0x4a0f9e[_0x2d20('0x5')]&&_0x4a0f9e['registry']['indexOf'](':')?_0x4a0f9e[_0x2d20('0x5')][_0x2d20('0x6')](':')[0x0]:'';this[_0x2d20('0x7')]='';this[_0x2d20('0x8')]='';this[_0x2d20('0x9')]='';this[_0x2d20('0xa')]='';this['refresh']='';this[_0x2d20('0xb')]='unknown';this[_0x2d20('0xc')]='';this[_0x2d20('0xd')]='';this[_0x2d20('0xe')]=_0x4a0f9e[_0x2d20('0xe')]||'';}module[_0x2d20('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 42411a4..049c90d 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 _0x939e=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x4ca81c,_0x55f2a0){var _0x5a902c=function(_0x5d7862){while(--_0x5d7862){_0x4ca81c['push'](_0x4ca81c['shift']());}};_0x5a902c(++_0x55f2a0);}(_0x939e,0xfb));var _0xe939=function(_0x59a1d9,_0x181115){_0x59a1d9=_0x59a1d9-0x0;var _0x577f9c=_0x939e[_0x59a1d9];return _0x577f9c;};'use strict';function voiceExtension(_0x41a74b){this['id']=_0x41a74b['id']||0x0;this[_0xe939('0x0')]=_0x41a74b[_0xe939('0x0')]||'';this[_0xe939('0x1')]=_0x41a74b[_0xe939('0x1')]||_0xe939('0x2');this['mandatoryDisposition']=_0x41a74b[_0xe939('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xb353=['exports','recordingFormat'];(function(_0x36763f,_0x462596){var _0x37ec9a=function(_0x2556b9){while(--_0x2556b9){_0x36763f['push'](_0x36763f['shift']());}};_0x37ec9a(++_0x462596);}(_0xb353,0x1d1));var _0x3b35=function(_0x3e9c6d,_0x35b323){_0x3e9c6d=_0x3e9c6d-0x0;var _0x24958d=_0xb353[_0x3e9c6d];return _0x24958d;};'use strict';function voiceExtension(_0x4b1e10){this['id']=_0x4b1e10['id']||0x0;this['exten']=_0x4b1e10['exten']||'';this['recordingFormat']=_0x4b1e10[_0x3b35('0x0')]||'none';this['mandatoryDisposition']=_0x4b1e10['mandatoryDisposition']||![];}module[_0x3b35('0x1')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index c9559ac..e94d438 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 _0xbc3a=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','inbound','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','onHold','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry'];(function(_0x1cc3f1,_0x5153ff){var _0x18fd43=function(_0x509c65){while(--_0x509c65){_0x1cc3f1['push'](_0x1cc3f1['shift']());}};_0x18fd43(++_0x5153ff);}(_0xbc3a,0xc1));var _0xabc3=function(_0x5b6ce8,_0x332e64){_0x5b6ce8=_0x5b6ce8-0x0;var _0x296142=_0xbc3a[_0x5b6ce8];return _0x296142;};'use strict';var monitorFormat={'wav':_0xabc3('0x0'),'wav49':'wav49','gsm':_0xabc3('0x1')};var strategy={'fewestcalls':_0xabc3('0x2'),'leastrecent':_0xabc3('0x3'),'linear':_0xabc3('0x4'),'random':_0xabc3('0x5'),'ringall':_0xabc3('0x6'),'rr':_0xabc3('0x7'),'rrmemory':_0xabc3('0x8'),'rrordered':_0xabc3('0x9'),'wrandom':_0xabc3('0xa')};function VoiceQueue(_0x229b7f){this['id']=_0x229b7f['id']||0x0;this[_0xabc3('0xb')]=_0x229b7f[_0xabc3('0xb')]||'';this[_0xabc3('0xc')]=_0x229b7f['monitor_format']||'';this['type']=_0x229b7f['type']||_0xabc3('0xd');this['waiting']=0x0;this[_0xabc3('0xe')]=0x0;this[_0xabc3('0xf')]=0x0;this['sumDuration']=0x0;this[_0xabc3('0x10')]=0x0;this[_0xabc3('0x11')]=0x0;this[_0xabc3('0x12')]=0x0;this[_0xabc3('0x13')]=0x0;this[_0xabc3('0x14')]=0x0;this[_0xabc3('0x15')]=0x0;this[_0xabc3('0x16')]=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0xabc3('0x17')]=0x0;this['paused']=0x0;this[_0xabc3('0x18')]=0x0;this[_0xabc3('0x19')]=0x0;this[_0xabc3('0x1a')]=0x0;this[_0xabc3('0x1b')]=0x0;this[_0xabc3('0x1c')]=0x0;this[_0xabc3('0x1d')]=_0x229b7f[_0xabc3('0x1d')]||![];this[_0xabc3('0x1e')]=_0x229b7f[_0xabc3('0x1e')]||0xa;this[_0xabc3('0x1f')]=_0x229b7f[_0xabc3('0x1f')]||'no';this[_0xabc3('0x20')]=!![];this[_0xabc3('0x21')]='';this['statusMessage']='';this['originated']=0x0;this['temp']=0x0;this[_0xabc3('0x22')]=_0x229b7f[_0xabc3('0x22')]||null;this[_0xabc3('0x23')]=_0x229b7f['dialGlobalInterval']?_0x229b7f['dialGlobalInterval']:null;this[_0xabc3('0x24')]=_0x229b7f[_0xabc3('0x24')];this[_0xabc3('0x25')]=_0x229b7f[_0xabc3('0x25')]||'progressive';this['dialLimitChannel']=_0x229b7f['dialLimitChannel']||0x0;this[_0xabc3('0x26')]=_0x229b7f[_0xabc3('0x26')]||0x0;this[_0xabc3('0x27')]=_0x229b7f[_0xabc3('0x27')]||0x1;this[_0xabc3('0x28')]=_0x229b7f[_0xabc3('0x28')]||_0xabc3('0x29');this[_0xabc3('0x2a')]=_0x229b7f[_0xabc3('0x2a')]||0.03;this[_0xabc3('0x2b')]=_0x229b7f['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x229b7f[_0xabc3('0x2c')]||'anonymous';this[_0xabc3('0x2d')]=_0x229b7f[_0xabc3('0x2d')]||_0xabc3('0x2e');this[_0xabc3('0x2f')]=_0x229b7f[_0xabc3('0x2f')]||0x1e;this[_0xabc3('0x30')]=_0x229b7f[_0xabc3('0x30')]||_0xabc3('0x31');this[_0xabc3('0x32')]=_0x229b7f[_0xabc3('0x32')]||0x3;this[_0xabc3('0x33')]=_0x229b7f[_0xabc3('0x33')]||undefined;this[_0xabc3('0x34')]=_0x229b7f[_0xabc3('0x34')]||0x3;this[_0xabc3('0x35')]=_0x229b7f[_0xabc3('0x35')]||0x96;this['dialBusyMaxRetry']=_0x229b7f[_0xabc3('0x36')]||0x3;this[_0xabc3('0x37')]=_0x229b7f[_0xabc3('0x37')]||0x96;this['dialNoAnswerMaxRetry']=_0x229b7f[_0xabc3('0x38')]||0x3;this[_0xabc3('0x39')]=_0x229b7f[_0xabc3('0x39')]||0x96;this[_0xabc3('0x3a')]=_0x229b7f['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x229b7f[_0xabc3('0x3b')]||0x96;this[_0xabc3('0x3c')]=_0x229b7f[_0xabc3('0x3c')]||0x3;this[_0xabc3('0x3d')]=_0x229b7f['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x229b7f[_0xabc3('0x3e')]||0x3;this[_0xabc3('0x3f')]=_0x229b7f[_0xabc3('0x3f')]||0x96;this[_0xabc3('0x40')]=_0x229b7f[_0xabc3('0x40')]||0x3;this['dialMachineRetryFrequency']=_0x229b7f['dialMachineRetryFrequency']||0x96;this[_0xabc3('0x41')]=_0x229b7f['dialAgentRejectMaxRetry']||0x3;this[_0xabc3('0x42')]=_0x229b7f['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x229b7f[_0xabc3('0x43')]||0x3;this[_0xabc3('0x44')]=_0x229b7f['dialGlobalMaxRetry']||0x4;this[_0xabc3('0x45')]=_0x229b7f['Trunk']?_0x229b7f[_0xabc3('0x45')]:undefined;this['TrunkBackup']=_0x229b7f[_0xabc3('0x46')]?_0x229b7f[_0xabc3('0x46')]:undefined;this[_0xabc3('0x47')]=_0x229b7f[_0xabc3('0x47')]||undefined;this[_0xabc3('0x48')]=_0x229b7f[_0xabc3('0x48')]?_0x229b7f['Interval']:undefined;this['dialOrderByScheduledAt']=_0x229b7f[_0xabc3('0x49')]||'DESC';this[_0xabc3('0x4a')]=_0x229b7f[_0xabc3('0x4a')]||undefined;this[_0xabc3('0x4b')]=_0x229b7f[_0xabc3('0x4b')]||undefined;this[_0xabc3('0x4c')]=strategy[_0x229b7f[_0xabc3('0x4c')]];this[_0xabc3('0x4d')]=!![];this['dialAMDActive']=_0x229b7f[_0xabc3('0x4e')]||![];this[_0xabc3('0x4f')]=_0x229b7f[_0xabc3('0x4f')];this[_0xabc3('0x50')]=_0x229b7f[_0xabc3('0x50')];this['dialAMDAfterGreetingSilence']=_0x229b7f[_0xabc3('0x51')];this[_0xabc3('0x52')]=_0x229b7f['dialAMDTotalAnalysisTime'];this[_0xabc3('0x53')]=_0x229b7f[_0xabc3('0x53')];this[_0xabc3('0x54')]=_0x229b7f[_0xabc3('0x54')];this['dialAMDMaximumNumberOfWords']=_0x229b7f[_0xabc3('0x55')];this[_0xabc3('0x56')]=_0x229b7f[_0xabc3('0x56')];this[_0xabc3('0x57')]=_0x229b7f[_0xabc3('0x57')];this[_0xabc3('0x58')]=0x0;this['pTalking']=0x0;this['timeout']=_0x229b7f[_0xabc3('0x59')];this[_0xabc3('0x5a')]=0x0;this[_0xabc3('0x5b')]=0x0;this[_0xabc3('0x5c')]=0x0;this[_0xabc3('0x5d')]=0x0;this[_0xabc3('0x5e')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xabc3('0x5f')]=0x0;this[_0xabc3('0x60')]=0x0;this[_0xabc3('0x61')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xabc3('0x62')]=0x0;this[_0xabc3('0x63')]=0x0;this[_0xabc3('0x64')]=undefined;this['startPredictive']=undefined;this[_0xabc3('0x65')]=undefined;this[_0xabc3('0x66')]=1.05;this[_0xabc3('0x67')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xabc3('0x68')]=0x0;this[_0xabc3('0x69')]=0x0;this[_0xabc3('0x6a')]=0x0;this[_0xabc3('0x6b')]=0x0;this[_0xabc3('0x6c')]=_0x229b7f[_0xabc3('0x6d')]||0x14;this[_0xabc3('0x6e')]=_0x229b7f[_0xabc3('0x6d')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xabc3('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xabc3('0x70')]=0x0;this['erlangCallToSecond']=0x0;this[_0xabc3('0x71')]=0x0;this[_0xabc3('0x72')]=0x0;this[_0xabc3('0x73')]=_0x229b7f[_0xabc3('0x73')]||0x1e;this[_0xabc3('0x74')]=_0x229b7f['dialRecallInQueue']||![];this[_0xabc3('0x75')]=!!_0x229b7f['dialPreviewAutoRecallMe']||![];this[_0xabc3('0x76')]=!!_0x229b7f[_0xabc3('0x76')]||![];this[_0xabc3('0x77')]=_0x229b7f[_0xabc3('0x77')]||undefined;this[_0xabc3('0x78')]=_0x229b7f[_0xabc3('0x78')]||![];this['dialAgiAfterHangupAgent']=_0x229b7f[_0xabc3('0x79')]||![];this['monitor_format']=monitorFormat[_0x229b7f[_0xabc3('0xc')]]?monitorFormat[_0x229b7f[_0xabc3('0xc')]]:undefined;this['mandatoryDisposition']=_0x229b7f[_0xabc3('0x7a')]||![];this[_0xabc3('0x7b')]=_0x229b7f[_0xabc3('0x7b')]?_0x229b7f[_0xabc3('0x7b')]:undefined;this[_0xabc3('0x7c')]=![];}module[_0xabc3('0x7d')]=VoiceQueue; \ No newline at end of file +var _0xa2a8=['ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','leastrecent','random'];(function(_0xed9c99,_0x2217b1){var _0x5443a1=function(_0xb7c751){while(--_0xb7c751){_0xed9c99['push'](_0xed9c99['shift']());}};_0x5443a1(++_0x2217b1);}(_0xa2a8,0xf9));var _0x8a2a=function(_0x3337c1,_0x25aa29){_0x3337c1=_0x3337c1-0x0;var _0x1dba2f=_0xa2a8[_0x3337c1];return _0x1dba2f;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x8a2a('0x0'),'gsm':_0x8a2a('0x1')};var strategy={'fewestcalls':_0x8a2a('0x2'),'leastrecent':_0x8a2a('0x3'),'linear':'linear','random':_0x8a2a('0x4'),'ringall':_0x8a2a('0x5'),'rr':_0x8a2a('0x6'),'rrmemory':_0x8a2a('0x7'),'rrordered':_0x8a2a('0x8'),'wrandom':_0x8a2a('0x9')};function VoiceQueue(_0x570fef){this['id']=_0x570fef['id']||0x0;this['name']=_0x570fef[_0x8a2a('0xa')]||'';this[_0x8a2a('0xb')]=_0x570fef[_0x8a2a('0xb')]||'';this[_0x8a2a('0xc')]=_0x570fef[_0x8a2a('0xc')]||_0x8a2a('0xd');this['waiting']=0x0;this[_0x8a2a('0xe')]=0x0;this[_0x8a2a('0xf')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x8a2a('0x10')]=0x0;this[_0x8a2a('0x11')]=0x0;this[_0x8a2a('0x12')]=0x0;this[_0x8a2a('0x13')]=0x0;this[_0x8a2a('0x14')]=0x0;this[_0x8a2a('0x15')]=0x0;this[_0x8a2a('0x16')]=0x0;this[_0x8a2a('0x17')]=0x0;this[_0x8a2a('0x18')]=0x0;this[_0x8a2a('0x19')]=0x0;this['ringing']=0x0;this[_0x8a2a('0x1a')]=0x0;this[_0x8a2a('0x1b')]=0x0;this[_0x8a2a('0x1c')]=0x0;this[_0x8a2a('0x1d')]=0x0;this[_0x8a2a('0x1e')]=_0x570fef[_0x8a2a('0x1e')]||![];this['acwTimeout']=_0x570fef[_0x8a2a('0x1f')]||0xa;this[_0x8a2a('0x20')]=_0x570fef[_0x8a2a('0x20')]||'no';this['sendMessageOneNotActive']=!![];this[_0x8a2a('0x21')]='';this[_0x8a2a('0x22')]='';this['originated']=0x0;this[_0x8a2a('0x23')]=0x0;this[_0x8a2a('0x24')]=_0x570fef['dialTimezone']||null;this[_0x8a2a('0x25')]=_0x570fef[_0x8a2a('0x25')]?_0x570fef[_0x8a2a('0x25')]:null;this[_0x8a2a('0x26')]=_0x570fef[_0x8a2a('0x26')];this[_0x8a2a('0x27')]=_0x570fef['dialMethod']||_0x8a2a('0x28');this[_0x8a2a('0x29')]=_0x570fef[_0x8a2a('0x29')]||0x0;this['dialLimitQueue']=_0x570fef[_0x8a2a('0x2a')]||0x0;this[_0x8a2a('0x2b')]=_0x570fef[_0x8a2a('0x2b')]||0x1;this[_0x8a2a('0x2c')]=_0x570fef[_0x8a2a('0x2c')]||_0x8a2a('0x2d');this[_0x8a2a('0x2e')]=_0x570fef[_0x8a2a('0x2e')]||0.03;this['dialPredictiveInterval']=_0x570fef[_0x8a2a('0x2f')]||0x258;this[_0x8a2a('0x30')]=_0x570fef['dialOriginateCallerIdName']||'anonymous';this[_0x8a2a('0x31')]=_0x570fef[_0x8a2a('0x31')]||_0x8a2a('0x32');this[_0x8a2a('0x33')]=_0x570fef[_0x8a2a('0x33')]||0x1e;this[_0x8a2a('0x34')]=_0x570fef[_0x8a2a('0x34')]||_0x8a2a('0x35');this[_0x8a2a('0x36')]=_0x570fef[_0x8a2a('0x36')]||0x3;this[_0x8a2a('0x37')]=_0x570fef['dialQueueProject']||undefined;this[_0x8a2a('0x38')]=_0x570fef[_0x8a2a('0x38')]||0x3;this[_0x8a2a('0x39')]=_0x570fef['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x570fef['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x570fef[_0x8a2a('0x3a')]||0x96;this[_0x8a2a('0x3b')]=_0x570fef[_0x8a2a('0x3b')]||0x3;this[_0x8a2a('0x3c')]=_0x570fef['dialNoAnswerRetryFrequency']||0x96;this[_0x8a2a('0x3d')]=_0x570fef[_0x8a2a('0x3d')]||0x3;this[_0x8a2a('0x3e')]=_0x570fef[_0x8a2a('0x3e')]||0x96;this['dialDropMaxRetry']=_0x570fef[_0x8a2a('0x3f')]||0x3;this['dialDropRetryFrequency']=_0x570fef['dialDropRetryFrequency']||0x96;this[_0x8a2a('0x40')]=_0x570fef[_0x8a2a('0x40')]||0x3;this[_0x8a2a('0x41')]=_0x570fef['dialAbandonedRetryFrequency']||0x96;this[_0x8a2a('0x42')]=_0x570fef[_0x8a2a('0x42')]||0x3;this['dialMachineRetryFrequency']=_0x570fef['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x570fef['dialAgentRejectMaxRetry']||0x3;this[_0x8a2a('0x43')]=_0x570fef[_0x8a2a('0x43')]||0x96;this[_0x8a2a('0x44')]=_0x570fef[_0x8a2a('0x44')]||0x3;this[_0x8a2a('0x45')]=_0x570fef[_0x8a2a('0x45')]||0x4;this[_0x8a2a('0x46')]=_0x570fef[_0x8a2a('0x46')]?_0x570fef[_0x8a2a('0x46')]:undefined;this[_0x8a2a('0x47')]=_0x570fef['TrunkBackup']?_0x570fef['TrunkBackup']:undefined;this[_0x8a2a('0x48')]=_0x570fef[_0x8a2a('0x48')]||undefined;this['Interval']=_0x570fef['Interval']?_0x570fef[_0x8a2a('0x49')]:undefined;this[_0x8a2a('0x4a')]=_0x570fef[_0x8a2a('0x4a')]||_0x8a2a('0x4b');this[_0x8a2a('0x4c')]=_0x570fef[_0x8a2a('0x4c')]||undefined;this[_0x8a2a('0x4d')]=_0x570fef['dialCutDigit']||undefined;this[_0x8a2a('0x4e')]=strategy[_0x570fef[_0x8a2a('0x4e')]];this[_0x8a2a('0x4f')]=!![];this['dialAMDActive']=_0x570fef[_0x8a2a('0x50')]||![];this[_0x8a2a('0x51')]=_0x570fef[_0x8a2a('0x51')];this[_0x8a2a('0x52')]=_0x570fef['dialAMDGreeting'];this[_0x8a2a('0x53')]=_0x570fef[_0x8a2a('0x53')];this[_0x8a2a('0x54')]=_0x570fef[_0x8a2a('0x54')];this['dialAMDMinWordLength']=_0x570fef[_0x8a2a('0x55')];this[_0x8a2a('0x56')]=_0x570fef[_0x8a2a('0x56')];this[_0x8a2a('0x57')]=_0x570fef[_0x8a2a('0x57')];this['dialAMDSilenceThreshold']=_0x570fef['dialAMDSilenceThreshold'];this[_0x8a2a('0x58')]=_0x570fef[_0x8a2a('0x58')];this[_0x8a2a('0x59')]=0x0;this['pTalking']=0x0;this[_0x8a2a('0x5a')]=_0x570fef['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x8a2a('0x5b')]=0x0;this[_0x8a2a('0x5c')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x8a2a('0x5d')]=0x0;this[_0x8a2a('0x5e')]=0x0;this[_0x8a2a('0x5f')]=0x0;this[_0x8a2a('0x60')]=0x0;this[_0x8a2a('0x61')]=0x0;this[_0x8a2a('0x62')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x8a2a('0x63')]=0x0;this[_0x8a2a('0x64')]=0x0;this[_0x8a2a('0x65')]=0x0;this['startProgressive']=undefined;this[_0x8a2a('0x66')]=undefined;this['handlePredictive']=undefined;this[_0x8a2a('0x67')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x8a2a('0x68')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x8a2a('0x69')]=0x0;this[_0x8a2a('0x6a')]=0x0;this[_0x8a2a('0x6b')]=_0x570fef[_0x8a2a('0x6c')]||0x14;this[_0x8a2a('0x6d')]=_0x570fef[_0x8a2a('0x6c')]||0xa;this[_0x8a2a('0x6e')]=0x0;this[_0x8a2a('0x6f')]=0x0;this[_0x8a2a('0x70')]=0x1;this[_0x8a2a('0x71')]=0x0;this['erlangCallToSecond']=0x0;this[_0x8a2a('0x72')]=0x0;this[_0x8a2a('0x73')]=0x0;this['dialRecallMeTimeout']=_0x570fef[_0x8a2a('0x74')]||0x1e;this['dialRecallInQueue']=_0x570fef[_0x8a2a('0x75')]||![];this[_0x8a2a('0x76')]=!!_0x570fef[_0x8a2a('0x76')]||![];this[_0x8a2a('0x77')]=!!_0x570fef['dialPreviewRecallmeReminder']||![];this[_0x8a2a('0x78')]=_0x570fef[_0x8a2a('0x78')]||undefined;this[_0x8a2a('0x79')]=_0x570fef[_0x8a2a('0x79')]||![];this['dialAgiAfterHangupAgent']=_0x570fef[_0x8a2a('0x7a')]||![];this['monitor_format']=monitorFormat[_0x570fef[_0x8a2a('0xb')]]?monitorFormat[_0x570fef[_0x8a2a('0xb')]]:undefined;this[_0x8a2a('0x7b')]=_0x570fef[_0x8a2a('0x7b')]||![];this[_0x8a2a('0x7c')]=_0x570fef['mandatoryDispositionPause']?_0x570fef['mandatoryDispositionPause']:undefined;this[_0x8a2a('0x7d')]=![];}module[_0x8a2a('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7219bc6..45c7036 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 _0x432b=['exten','xcally-motion-preview','compareToInboundQueue','some','preview','available','loggedInDb','paused','ringing','talking','answered','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','waiting','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','incall','includes','booked','keys','length','dialer'];(function(_0x1fd563,_0x196466){var _0x4673f3=function(_0x15e015){while(--_0x15e015){_0x1fd563['push'](_0x1fd563['shift']());}};_0x4673f3(++_0x196466);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var INBOUND_COUNTERS=[_0xb432('0x0'),'loggedIn',_0xb432('0x1'),_0xb432('0x2'),_0xb432('0x3'),_0xb432('0x4'),'waiting'];var OUTBOUND_COUNTERS=['available',_0xb432('0x5'),'inUse',_0xb432('0x6'),'loggedInDb',_0xb432('0x7'),_0xb432('0x8'),_0xb432('0x9'),_0xb432('0xa'),_0xb432('0xb'),_0xb432('0xc'),_0xb432('0xd'),_0xb432('0xe'),'outboundReCallsDay',_0xb432('0xf'),_0xb432('0x10'),_0xb432('0x2'),_0xb432('0x11'),_0xb432('0x4'),_0xb432('0x12'),'sumDuration','total',_0xb432('0x13')];function VoiceQueueSummary(_0x255773){this['id']=_0x255773['id'];this['name']=_0x255773[_0xb432('0x14')];this[_0xb432('0x15')]=_0x255773[_0xb432('0x15')];this['abandoned']=_0x255773[_0xb432('0x16')]||0x0;this[_0xb432('0x5')]=_0x255773['answered']||0x0;this[_0xb432('0x0')]=_0x255773[_0xb432('0x0')]||0x0;this[_0xb432('0x17')]=_0x255773[_0xb432('0x17')]||0x0;this[_0xb432('0x18')]=_0x255773['inUse']||0x0;this['invalid']=_0x255773[_0xb432('0x19')]||0x0;this[_0xb432('0x6')]=_0x255773[_0xb432('0x6')]||0x0;this[_0xb432('0x1')]=_0x255773[_0xb432('0x1')]||0x0;this[_0xb432('0x1a')]=_0x255773[_0xb432('0x1a')]||0x0;this[_0xb432('0x1b')]=_0x255773[_0xb432('0x1b')]||0x0;this[_0xb432('0x2')]=_0x255773['paused']||0x0;this['ringing']=_0x255773[_0xb432('0x3')]||0x0;this[_0xb432('0x1c')]=_0x255773[_0xb432('0x1c')];this[_0xb432('0x12')]=_0x255773['sumBillable'];this[_0xb432('0x1d')]=_0x255773[_0xb432('0x1d')];this[_0xb432('0x1e')]=_0x255773[_0xb432('0x1e')]||0x0;this[_0xb432('0x4')]=_0x255773[_0xb432('0x4')]||0x0;this[_0xb432('0x1f')]=_0x255773[_0xb432('0x1f')]||0x0;this['type']=_0x255773[_0xb432('0x20')];this[_0xb432('0x21')]=_0x255773['unavailable']||0x0;this[_0xb432('0x22')]=_0x255773[_0xb432('0x22')]||0x0;this[_0xb432('0x23')]=_0x255773[_0xb432('0x23')]||0x0;this[_0xb432('0x13')]=_0x255773[_0xb432('0x13')]||0x0;if(_0x255773[_0xb432('0x20')]===_0xb432('0x24')){this[_0xb432('0x11')]=_0x255773[_0xb432('0x11')]||0x0;this['dialActive']=_0x255773[_0xb432('0x25')];this[_0xb432('0x26')]=_0x255773[_0xb432('0x26')];this[_0xb432('0x27')]=_0x255773[_0xb432('0x27')];this[_0xb432('0x28')]=_0x255773['dialOriginateCallerIdNumber'];this[_0xb432('0x29')]=_0x255773[_0xb432('0x29')];this[_0xb432('0x2a')]=_0x255773[_0xb432('0x2a')];this[_0xb432('0x2b')]=_0x255773[_0xb432('0x2b')];this[_0xb432('0x2c')]=_0x255773[_0xb432('0x2c')];this[_0xb432('0x9')]=_0x255773['outboundAnswerCallsDay'];this[_0xb432('0xa')]=_0x255773[_0xb432('0xa')];this[_0xb432('0xb')]=_0x255773[_0xb432('0xb')];this[_0xb432('0xc')]=_0x255773[_0xb432('0xc')];this[_0xb432('0x2d')]=_0x255773[_0xb432('0x2d')];this[_0xb432('0x2e')]=_0x255773[_0xb432('0x2e')];this[_0xb432('0x2f')]=_0x255773[_0xb432('0x2f')];this['outboundNoAnswerCallsDay']=_0x255773[_0xb432('0xd')];this['outboundNoSuchCallsDay']=_0x255773[_0xb432('0xe')];this[_0xb432('0x30')]=_0x255773[_0xb432('0x30')];this[_0xb432('0x31')]=_0x255773[_0xb432('0x31')];this[_0xb432('0xf')]=_0x255773['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x255773['outboundUnknownCallsDay'];this[_0xb432('0x32')]=_0x255773[_0xb432('0x32')];this[_0xb432('0x33')]=_0x255773[_0xb432('0x33')];this['predictiveIntervalAvgTalktime']=_0x255773['predictiveIntervalAvgTalktime'];this[_0xb432('0x34')]=_0x255773['predictiveIntervalDroppedCallsCallersExit'];this[_0xb432('0x35')]=_0x255773[_0xb432('0x35')];this['predictiveIntervalErlangCalls']=_0x255773[_0xb432('0x36')];this[_0xb432('0x37')]=_0x255773[_0xb432('0x37')];this[_0xb432('0x38')]=_0x255773[_0xb432('0x38')];this['predictiveIntervalMultiplicativeFactor']=_0x255773[_0xb432('0x39')];this[_0xb432('0x3a')]=_0x255773[_0xb432('0x3a')];this[_0xb432('0x3b')]=_0x255773[_0xb432('0x3b')];this[_0xb432('0x3c')]=_0x255773[_0xb432('0x3c')];this['originated']=_0x255773['originated'];this[_0xb432('0x3d')]=_0x255773[_0xb432('0x3d')];this['erlangCallToSecond']=_0x255773[_0xb432('0x3e')];this[_0xb432('0x3f')]=_0x255773[_0xb432('0x3f')];this[_0xb432('0x40')]=_0x255773[_0xb432('0x40')];this['startPredictive']=_0x255773[_0xb432('0x41')];this[_0xb432('0x42')]=_0x255773[_0xb432('0x42')];this[_0xb432('0x43')]=_0x255773[_0xb432('0x43')];this[_0xb432('0x44')]=_0x255773[_0xb432('0x44')];}if(_0x255773[_0xb432('0x45')]){this[_0xb432('0x45')]={'id':_0x255773['Trunk']['id'],'name':_0x255773['Trunk'][_0xb432('0x14')],'active':_0x255773[_0xb432('0x45')][_0xb432('0x46')],'callerid':_0x255773[_0xb432('0x45')][_0xb432('0x47')]};}}VoiceQueueSummary[_0xb432('0x48')][_0xb432('0x49')]=function(_0x456bce,_0x4a1e3a,_0x504535,_0x4d4a73){this[_0xb432('0x1')]=0x0;this[_0xb432('0x4')]=0x0;this[_0xb432('0x2')]=0x0;this[_0xb432('0x22')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0xb432('0x17')]=0x0;this[_0xb432('0x19')]=0x0;this['unavailable']=0x0;this[_0xb432('0x3')]=0x0;this['ringInUse']=0x0;this[_0xb432('0x1a')]=0x0;if(_0x504535){if(_0x504535[_0xb432('0x0')]){this['available']=Number(_0x504535['available']);}if(_0x504535[_0xb432('0x4a')]){this['loggedIn']=Number(_0x504535[_0xb432('0x4a')]);}if(_0x504535[_0xb432('0x4b')]){this['waiting']=Number(_0x504535[_0xb432('0x4b')]);}}for(var _0x4b1763=0x0;_0x4b1763<_0x456bce['length'];_0x4b1763++){var _0x58010e=_0x4a1e3a['SIP/'+_0x456bce[_0x4b1763][_0xb432('0x14')]];if(_0x58010e&&_0x58010e['online']){this[_0xb432('0x1')]+=0x1;}if(_0x456bce[_0x4b1763][_0xb432('0x4c')]==='1'){this['talking']+=0x1;}if(_0x456bce[_0x4b1763]['paused']==='1'&&!['2','7','8'][_0xb432('0x4d')](_0x456bce[_0x4b1763]['status'])){this[_0xb432('0x2')]+=0x1;}switch(_0x456bce[_0x4b1763]['status']){case'0':this[_0xb432('0x22')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xb432('0x18')]+=0x1;break;case'3':this[_0xb432('0x17')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xb432('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0xb432('0x4e')){var _0x2a4fc1=Object[_0xb432('0x4f')](_0x4d4a73);for(var _0x4487ac=0x0;_0x4487ac<_0x2a4fc1[_0xb432('0x50')];_0x4487ac++){var _0x16f2bc=_0x2a4fc1[_0x4487ac];var _0x4b9c9c=_0x4d4a73[_0x16f2bc];if(_0x4b9c9c['queue']===this['name']&&_0x4b9c9c['type']===_0xb432('0x51')&&_0x4b9c9c[_0xb432('0x52')]===_0xb432('0x53')){this[_0xb432('0x4')]+=0x1;}}if(this[_0xb432('0x4')]>this[_0xb432('0x18')]){this[_0xb432('0x4')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0xb432('0x54')]=function(_0x20b75c){var _0x43737b=![];if(_0x20b75c){_0x43737b=INBOUND_COUNTERS[_0xb432('0x55')](function(_0x244bd8){return this[_0x244bd8]!==_0x20b75c[_0x244bd8];},this);}return _0x43737b;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x18527c){var _0x360362=![];var _0x8882ad=![];var _0x2cef6d=![];if(_0x18527c){_0x360362=this['dialMethod']!==_0x18527c[_0xb432('0x26')]||this[_0xb432('0x25')]!==_0x18527c['dialActive']||this[_0xb432('0x43')]!==_0x18527c[_0xb432('0x43')]||this[_0xb432('0x44')]!==_0x18527c[_0xb432('0x44')];_0x8882ad=OUTBOUND_COUNTERS[_0xb432('0x55')](function(_0x294d0c){return this[_0x294d0c]!==_0x18527c[_0x294d0c];},this);if(this[_0xb432('0x45')]&&_0x18527c[_0xb432('0x45')]){_0x2cef6d=this[_0xb432('0x45')][_0xb432('0x14')]!==_0x18527c[_0xb432('0x45')][_0xb432('0x14')]||this[_0xb432('0x45')][_0xb432('0x46')]!==_0x18527c[_0xb432('0x45')]['active'];}}return _0x360362||_0x8882ad||_0x2cef6d;};VoiceQueueSummary[_0xb432('0x48')]['updateReportFromOutboundQueue']=function(_0x1cb7d5){this[_0xb432('0x5')]=_0x1cb7d5['answered'];this['message']=_0x1cb7d5[_0xb432('0x43')];this[_0xb432('0x44')]=_0x1cb7d5[_0xb432('0x44')];this[_0xb432('0x7')]=_0x1cb7d5[_0xb432('0x7')];this[_0xb432('0x8')]=_0x1cb7d5[_0xb432('0x8')];this[_0xb432('0x9')]=_0x1cb7d5[_0xb432('0x9')];this[_0xb432('0xa')]=_0x1cb7d5[_0xb432('0xa')];this[_0xb432('0xb')]=_0x1cb7d5[_0xb432('0xb')];this['outboundCongestionCallsDay']=_0x1cb7d5[_0xb432('0xc')];this['outboundNoAnswerCallsDay']=_0x1cb7d5[_0xb432('0xd')];this[_0xb432('0xe')]=_0x1cb7d5[_0xb432('0xe')];this[_0xb432('0x31')]=_0x1cb7d5[_0xb432('0x31')];this[_0xb432('0xf')]=_0x1cb7d5[_0xb432('0xf')];this['outboundUnknownCallsDay']=_0x1cb7d5[_0xb432('0x10')];this[_0xb432('0x12')]=_0x1cb7d5[_0xb432('0x12')];this[_0xb432('0x1d')]=_0x1cb7d5[_0xb432('0x1d')];this[_0xb432('0x1f')]=_0x1cb7d5[_0xb432('0x1f')];if(this['dialMethod']===_0xb432('0x56')){this[_0xb432('0x11')]=_0x1cb7d5[_0xb432('0x11')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xef39=['type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','loggedin','callers','SIP/','online','incall','includes','status','booked','length','queue','exten','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','available','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime'];(function(_0xf03341,_0x535ea8){var _0xc4b1d=function(_0x5c5532){while(--_0x5c5532){_0xf03341['push'](_0xf03341['shift']());}};_0xc4b1d(++_0x535ea8);}(_0xef39,0x92));var _0x9ef3=function(_0x29079d,_0x259032){_0x29079d=_0x29079d-0x0;var _0x4e67f4=_0xef39[_0x29079d];return _0x4e67f4;};'use strict';var INBOUND_COUNTERS=['available',_0x9ef3('0x0'),_0x9ef3('0x1'),_0x9ef3('0x2'),_0x9ef3('0x3'),_0x9ef3('0x4'),_0x9ef3('0x5')];var OUTBOUND_COUNTERS=[_0x9ef3('0x6'),_0x9ef3('0x7'),_0x9ef3('0x8'),_0x9ef3('0x0'),_0x9ef3('0x1'),_0x9ef3('0x9'),'outboundAbandonedCallsDay',_0x9ef3('0xa'),_0x9ef3('0xb'),_0x9ef3('0xc'),_0x9ef3('0xd'),_0x9ef3('0xe'),_0x9ef3('0xf'),_0x9ef3('0x10'),_0x9ef3('0x11'),_0x9ef3('0x12'),_0x9ef3('0x2'),_0x9ef3('0x13'),_0x9ef3('0x4'),_0x9ef3('0x14'),'sumDuration',_0x9ef3('0x15'),_0x9ef3('0x5')];function VoiceQueueSummary(_0x201074){this['id']=_0x201074['id'];this[_0x9ef3('0x16')]=_0x201074[_0x9ef3('0x16')];this[_0x9ef3('0x17')]=_0x201074['strategy'];this[_0x9ef3('0x18')]=_0x201074[_0x9ef3('0x18')]||0x0;this[_0x9ef3('0x7')]=_0x201074['answered']||0x0;this[_0x9ef3('0x6')]=_0x201074[_0x9ef3('0x6')]||0x0;this['busy']=_0x201074[_0x9ef3('0x19')]||0x0;this[_0x9ef3('0x8')]=_0x201074[_0x9ef3('0x8')]||0x0;this[_0x9ef3('0x1a')]=_0x201074[_0x9ef3('0x1a')]||0x0;this[_0x9ef3('0x0')]=_0x201074['loggedIn']||0x0;this[_0x9ef3('0x1')]=_0x201074[_0x9ef3('0x1')]||0x0;this[_0x9ef3('0x1b')]=_0x201074['onHold']||0x0;this[_0x9ef3('0x1c')]=_0x201074[_0x9ef3('0x1c')]||0x0;this['paused']=_0x201074['paused']||0x0;this['ringing']=_0x201074[_0x9ef3('0x3')]||0x0;this[_0x9ef3('0x1d')]=_0x201074['ringInUse'];this['sumBillable']=_0x201074['sumBillable'];this[_0x9ef3('0x1e')]=_0x201074['sumDuration'];this[_0x9ef3('0x1f')]=_0x201074['sumHoldTime']||0x0;this[_0x9ef3('0x4')]=_0x201074[_0x9ef3('0x4')]||0x0;this[_0x9ef3('0x15')]=_0x201074['total']||0x0;this[_0x9ef3('0x20')]=_0x201074[_0x9ef3('0x20')];this[_0x9ef3('0x21')]=_0x201074['unavailable']||0x0;this[_0x9ef3('0x22')]=_0x201074[_0x9ef3('0x22')]||0x0;this[_0x9ef3('0x23')]=_0x201074[_0x9ef3('0x23')]||0x0;this[_0x9ef3('0x5')]=_0x201074[_0x9ef3('0x5')]||0x0;if(_0x201074['type']===_0x9ef3('0x24')){this[_0x9ef3('0x13')]=_0x201074[_0x9ef3('0x13')]||0x0;this['dialActive']=_0x201074[_0x9ef3('0x25')];this[_0x9ef3('0x26')]=_0x201074[_0x9ef3('0x26')];this[_0x9ef3('0x27')]=_0x201074[_0x9ef3('0x27')];this[_0x9ef3('0x28')]=_0x201074[_0x9ef3('0x28')];this[_0x9ef3('0x29')]=_0x201074[_0x9ef3('0x29')];this[_0x9ef3('0x2a')]=_0x201074['dialPrefix'];this[_0x9ef3('0x2b')]=_0x201074['temp'];this[_0x9ef3('0x2c')]=_0x201074[_0x9ef3('0x2c')];this[_0x9ef3('0xa')]=_0x201074[_0x9ef3('0xa')];this[_0x9ef3('0xb')]=_0x201074[_0x9ef3('0xb')];this[_0x9ef3('0xc')]=_0x201074[_0x9ef3('0xc')];this[_0x9ef3('0xd')]=_0x201074[_0x9ef3('0xd')];this['outboundDropCallsDayACS']=_0x201074[_0x9ef3('0x2d')];this[_0x9ef3('0x2e')]=_0x201074['outboundDropCallsDayCallersExit'];this[_0x9ef3('0x2f')]=_0x201074[_0x9ef3('0x2f')];this[_0x9ef3('0xe')]=_0x201074['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x201074[_0x9ef3('0xf')];this[_0x9ef3('0x30')]=_0x201074[_0x9ef3('0x30')];this['outboundReCallsDay']=_0x201074[_0x9ef3('0x10')];this[_0x9ef3('0x11')]=_0x201074[_0x9ef3('0x11')];this[_0x9ef3('0x12')]=_0x201074[_0x9ef3('0x12')];this[_0x9ef3('0x31')]=_0x201074['predictiveIntervalAnsweredCalls'];this[_0x9ef3('0x32')]=_0x201074['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x201074['predictiveIntervalAvgTalktime'];this[_0x9ef3('0x33')]=_0x201074['predictiveIntervalDroppedCallsCallersExit'];this[_0x9ef3('0x34')]=_0x201074[_0x9ef3('0x34')];this[_0x9ef3('0x35')]=_0x201074[_0x9ef3('0x35')];this[_0x9ef3('0x36')]=_0x201074[_0x9ef3('0x36')];this[_0x9ef3('0x37')]=_0x201074['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x201074[_0x9ef3('0x38')];this[_0x9ef3('0x39')]=_0x201074[_0x9ef3('0x39')];this[_0x9ef3('0x3a')]=_0x201074[_0x9ef3('0x3a')];this['predictiveIntervalTotalCalls']=_0x201074['predictiveIntervalTotalCalls'];this[_0x9ef3('0x9')]=_0x201074[_0x9ef3('0x9')];this[_0x9ef3('0x3b')]=_0x201074[_0x9ef3('0x3b')];this[_0x9ef3('0x3c')]=_0x201074['erlangCallToSecond'];this[_0x9ef3('0x3d')]=_0x201074[_0x9ef3('0x3d')];this['erlangBusyFactor']=_0x201074[_0x9ef3('0x3e')];this[_0x9ef3('0x3f')]=_0x201074[_0x9ef3('0x3f')];this[_0x9ef3('0x40')]=_0x201074[_0x9ef3('0x40')];this[_0x9ef3('0x41')]=_0x201074['message'];this['statusMessage']=_0x201074[_0x9ef3('0x42')];}if(_0x201074['Trunk']){this[_0x9ef3('0x43')]={'id':_0x201074['Trunk']['id'],'name':_0x201074[_0x9ef3('0x43')][_0x9ef3('0x16')],'active':_0x201074['Trunk'][_0x9ef3('0x44')],'callerid':_0x201074[_0x9ef3('0x43')][_0x9ef3('0x45')]};}}VoiceQueueSummary[_0x9ef3('0x46')]['createReport']=function(_0x4def98,_0x5b57af,_0x4126a4,_0x5e76a9){this[_0x9ef3('0x1')]=0x0;this[_0x9ef3('0x4')]=0x0;this[_0x9ef3('0x2')]=0x0;this['unknown']=0x0;this[_0x9ef3('0x1c')]=0x0;this[_0x9ef3('0x8')]=0x0;this[_0x9ef3('0x19')]=0x0;this[_0x9ef3('0x1a')]=0x0;this['unavailable']=0x0;this[_0x9ef3('0x3')]=0x0;this['ringInUse']=0x0;this[_0x9ef3('0x1b')]=0x0;if(_0x4126a4){if(_0x4126a4[_0x9ef3('0x6')]){this['available']=Number(_0x4126a4[_0x9ef3('0x6')]);}if(_0x4126a4[_0x9ef3('0x47')]){this['loggedIn']=Number(_0x4126a4[_0x9ef3('0x47')]);}if(_0x4126a4[_0x9ef3('0x48')]){this[_0x9ef3('0x5')]=Number(_0x4126a4[_0x9ef3('0x48')]);}}for(var _0x141ed0=0x0;_0x141ed0<_0x4def98['length'];_0x141ed0++){var _0x3d34ad=_0x5b57af[_0x9ef3('0x49')+_0x4def98[_0x141ed0][_0x9ef3('0x16')]];if(_0x3d34ad&&_0x3d34ad[_0x9ef3('0x4a')]){this[_0x9ef3('0x1')]+=0x1;}if(_0x4def98[_0x141ed0][_0x9ef3('0x4b')]==='1'){this[_0x9ef3('0x4')]+=0x1;}if(_0x4def98[_0x141ed0][_0x9ef3('0x2')]==='1'&&!['2','7','8'][_0x9ef3('0x4c')](_0x4def98[_0x141ed0][_0x9ef3('0x4d')])){this[_0x9ef3('0x2')]+=0x1;}switch(_0x4def98[_0x141ed0][_0x9ef3('0x4d')]){case'0':this[_0x9ef3('0x22')]+=0x1;break;case'1':this[_0x9ef3('0x1c')]+=0x1;break;case'2':this[_0x9ef3('0x8')]+=0x1;break;case'3':this[_0x9ef3('0x19')]+=0x1;break;case'4':this[_0x9ef3('0x1a')]+=0x1;break;case'5':this[_0x9ef3('0x21')]+=0x1;break;case'6':this[_0x9ef3('0x3')]+=0x1;break;case'7':this[_0x9ef3('0x1d')]+=0x1;break;case'8':this[_0x9ef3('0x1b')]+=0x1;break;}}if(this[_0x9ef3('0x26')]===_0x9ef3('0x4e')){var _0x184b13=Object['keys'](_0x5e76a9);for(var _0x341670=0x0;_0x341670<_0x184b13[_0x9ef3('0x4f')];_0x341670++){var _0x3a3f60=_0x184b13[_0x341670];var _0x206e0e=_0x5e76a9[_0x3a3f60];if(_0x206e0e[_0x9ef3('0x50')]===this[_0x9ef3('0x16')]&&_0x206e0e[_0x9ef3('0x20')]==='dialer'&&_0x206e0e[_0x9ef3('0x51')]===_0x9ef3('0x52')){this[_0x9ef3('0x4')]+=0x1;}}if(this[_0x9ef3('0x4')]>this[_0x9ef3('0x8')]){this[_0x9ef3('0x4')]=this[_0x9ef3('0x8')];}this[_0x9ef3('0x13')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x9ef3('0x53')]=function(_0x5c6c30){var _0x19089b=![];if(_0x5c6c30){_0x19089b=INBOUND_COUNTERS[_0x9ef3('0x54')](function(_0x5d5ea9){return this[_0x5d5ea9]!==_0x5c6c30[_0x5d5ea9];},this);}return _0x19089b;};VoiceQueueSummary[_0x9ef3('0x46')]['compareToOutboundQueue']=function(_0x27a238){var _0xaa339=![];var _0x14e1f2=![];var _0x49d2db=![];if(_0x27a238){_0xaa339=this[_0x9ef3('0x26')]!==_0x27a238['dialMethod']||this['dialActive']!==_0x27a238[_0x9ef3('0x25')]||this[_0x9ef3('0x41')]!==_0x27a238[_0x9ef3('0x41')]||this[_0x9ef3('0x42')]!==_0x27a238['statusMessage'];_0x14e1f2=OUTBOUND_COUNTERS[_0x9ef3('0x54')](function(_0x1d0d85){return this[_0x1d0d85]!==_0x27a238[_0x1d0d85];},this);if(this['Trunk']&&_0x27a238[_0x9ef3('0x43')]){_0x49d2db=this[_0x9ef3('0x43')]['name']!==_0x27a238[_0x9ef3('0x43')][_0x9ef3('0x16')]||this[_0x9ef3('0x43')][_0x9ef3('0x44')]!==_0x27a238[_0x9ef3('0x43')]['active'];}}return _0xaa339||_0x14e1f2||_0x49d2db;};VoiceQueueSummary[_0x9ef3('0x46')][_0x9ef3('0x55')]=function(_0x40f2ca){this[_0x9ef3('0x7')]=_0x40f2ca[_0x9ef3('0x7')];this[_0x9ef3('0x41')]=_0x40f2ca[_0x9ef3('0x41')];this[_0x9ef3('0x42')]=_0x40f2ca[_0x9ef3('0x42')];this[_0x9ef3('0x9')]=_0x40f2ca[_0x9ef3('0x9')];this['outboundAbandonedCallsDay']=_0x40f2ca[_0x9ef3('0x56')];this['outboundAnswerCallsDay']=_0x40f2ca[_0x9ef3('0xa')];this[_0x9ef3('0xb')]=_0x40f2ca[_0x9ef3('0xb')];this['outboundBusyCallsDay']=_0x40f2ca[_0x9ef3('0xc')];this[_0x9ef3('0xd')]=_0x40f2ca[_0x9ef3('0xd')];this[_0x9ef3('0xe')]=_0x40f2ca['outboundNoAnswerCallsDay'];this[_0x9ef3('0xf')]=_0x40f2ca[_0x9ef3('0xf')];this[_0x9ef3('0x10')]=_0x40f2ca['outboundReCallsDay'];this[_0x9ef3('0x11')]=_0x40f2ca['outboundRejectCallsDay'];this[_0x9ef3('0x12')]=_0x40f2ca[_0x9ef3('0x12')];this[_0x9ef3('0x14')]=_0x40f2ca[_0x9ef3('0x14')];this[_0x9ef3('0x1e')]=_0x40f2ca[_0x9ef3('0x1e')];this['total']=_0x40f2ca[_0x9ef3('0x15')];if(this['dialMethod']===_0x9ef3('0x57')){this['pTalking']=_0x40f2ca[_0x9ef3('0x13')];}};module[_0x9ef3('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 ef97294..495ef40 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 _0x1321=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x1cb9e4,_0x2a66cd){var _0x27afe5=function(_0x37f7cc){while(--_0x37f7cc){_0x1cb9e4['push'](_0x1cb9e4['shift']());}};_0x27afe5(++_0x2a66cd);}(_0x1321,0x1ca));var _0x1132=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1321[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x468cc3){this['id']=_0x468cc3['id']||0x0;this[_0x1132('0x0')]=_0x468cc3[_0x1132('0x0')]||'';this[_0x1132('0x1')]=_0x468cc3[_0x1132('0x1')]||'';this[_0x1132('0x2')]=_0x468cc3[_0x1132('0x2')]||'';this[_0x1132('0x3')]=_0x468cc3[_0x1132('0x3')]||'';this[_0x1132('0x4')]=_0x468cc3['serverUrl']||'';this[_0x1132('0x5')]=_0x468cc3[_0x1132('0x5')]||{};}module[_0x1132('0x6')]=VtigerAccount; \ No newline at end of file +var _0x1eca=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x1eca,0x10f));var _0xa1ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1eca[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x409033){this['id']=_0x409033['id']||0x0;this[_0xa1ec('0x0')]=_0x409033['name']||'';this[_0xa1ec('0x1')]=_0x409033[_0xa1ec('0x1')]||'';this['accessKey']=_0x409033['accessKey']||'';this[_0xa1ec('0x2')]=_0x409033[_0xa1ec('0x2')]||'';this[_0xa1ec('0x3')]=_0x409033[_0xa1ec('0x3')]||'';this[_0xa1ec('0x4')]=_0x409033[_0xa1ec('0x4')]||{};}module[_0xa1ec('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index aa66384..e8ba7a1 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 _0xf5a4=['type','integrationTab','Configurations','name','username','password','token','remoteUri','authType'];(function(_0x466aeb,_0x46d8c0){var _0x5073f8=function(_0x2383b5){while(--_0x2383b5){_0x466aeb['push'](_0x466aeb['shift']());}};_0x5073f8(++_0x46d8c0);}(_0xf5a4,0x1e0));var _0x4f5a=function(_0x5c2e2b,_0x8e9b19){_0x5c2e2b=_0x5c2e2b-0x0;var _0x3b10aa=_0xf5a4[_0x5c2e2b];return _0x3b10aa;};'use strict';function ZendeskAccount(_0x54bfe0){this['id']=_0x54bfe0['id']||0x0;this[_0x4f5a('0x0')]=_0x54bfe0[_0x4f5a('0x0')]||'';this[_0x4f5a('0x1')]=_0x54bfe0[_0x4f5a('0x1')]||'';this[_0x4f5a('0x2')]=_0x54bfe0[_0x4f5a('0x2')]||'';this[_0x4f5a('0x3')]=_0x54bfe0['token']||'';this[_0x4f5a('0x4')]=_0x54bfe0[_0x4f5a('0x4')]||'';this[_0x4f5a('0x5')]=_0x54bfe0[_0x4f5a('0x5')]||'';this['type']=_0x54bfe0[_0x4f5a('0x6')]||_0x4f5a('0x7');this['serverUrl']=_0x54bfe0['serverUrl']||'';this['Configurations']=_0x54bfe0[_0x4f5a('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x7d54=['Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0x7d54,0x157));var _0x47d5=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x7d54[_0x3e2fcf];return _0x497db7;};'use strict';function ZendeskAccount(_0x473a86){this['id']=_0x473a86['id']||0x0;this['name']=_0x473a86[_0x47d5('0x0')]||'';this['username']=_0x473a86[_0x47d5('0x1')]||'';this[_0x47d5('0x2')]=_0x473a86[_0x47d5('0x2')]||'';this[_0x47d5('0x3')]=_0x473a86[_0x47d5('0x3')]||'';this[_0x47d5('0x4')]=_0x473a86[_0x47d5('0x4')]||'';this['authType']=_0x473a86[_0x47d5('0x5')]||'';this[_0x47d5('0x6')]=_0x473a86[_0x47d5('0x6')]||_0x47d5('0x7');this[_0x47d5('0x8')]=_0x473a86['serverUrl']||'';this[_0x47d5('0x9')]=_0x473a86[_0x47d5('0x9')]||{};}module[_0x47d5('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index b7d669e..ac74661 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 _0x6e63=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','zone','clientId'];(function(_0x2fc375,_0x157399){var _0xc5a092=function(_0x1d9fc3){while(--_0x1d9fc3){_0x2fc375['push'](_0x2fc375['shift']());}};_0xc5a092(++_0x157399);}(_0x6e63,0x74));var _0x36e6=function(_0x2893a0,_0x472eb1){_0x2893a0=_0x2893a0-0x0;var _0x96a726=_0x6e63[_0x2893a0];return _0x96a726;};'use strict';function ZohoAccount(_0x163de9){this['id']=_0x163de9['id']||0x0;this[_0x36e6('0x0')]=_0x163de9['name']||'';this['description']=_0x163de9[_0x36e6('0x1')]||'';this['host']=_0x163de9['host']||'';this['zone']=_0x163de9[_0x36e6('0x2')]||'';this[_0x36e6('0x3')]=_0x163de9[_0x36e6('0x3')]||'';this[_0x36e6('0x4')]=_0x163de9[_0x36e6('0x4')]||'';this[_0x36e6('0x5')]=_0x163de9[_0x36e6('0x5')]||'';this[_0x36e6('0x6')]=_0x163de9[_0x36e6('0x6')]||'';this[_0x36e6('0x7')]=_0x163de9[_0x36e6('0x7')]||'';this[_0x36e6('0x8')]=_0x163de9[_0x36e6('0x8')]||{};}module[_0x36e6('0x9')]=ZohoAccount; \ No newline at end of file +var _0xa6a1=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x6ee3e,_0x2351eb){var _0x323cb0=function(_0x500f98){while(--_0x500f98){_0x6ee3e['push'](_0x6ee3e['shift']());}};_0x323cb0(++_0x2351eb);}(_0xa6a1,0xb5));var _0x1a6a=function(_0x1e1cee,_0x224208){_0x1e1cee=_0x1e1cee-0x0;var _0x3cbe93=_0xa6a1[_0x1e1cee];return _0x3cbe93;};'use strict';function ZohoAccount(_0x5b13ba){this['id']=_0x5b13ba['id']||0x0;this[_0x1a6a('0x0')]=_0x5b13ba['name']||'';this['description']=_0x5b13ba[_0x1a6a('0x1')]||'';this['host']=_0x5b13ba[_0x1a6a('0x2')]||'';this['zone']=_0x5b13ba[_0x1a6a('0x3')]||'';this[_0x1a6a('0x4')]=_0x5b13ba[_0x1a6a('0x4')]||'';this[_0x1a6a('0x5')]=_0x5b13ba[_0x1a6a('0x5')]||'';this[_0x1a6a('0x6')]=_0x5b13ba[_0x1a6a('0x6')]||'';this[_0x1a6a('0x7')]=_0x5b13ba['code']||'';this[_0x1a6a('0x8')]=_0x5b13ba[_0x1a6a('0x8')]||'';this['Configurations']=_0x5b13ba[_0x1a6a('0x9')]||{};}module[_0x1a6a('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f8338df..e41b20f 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 _0x7334=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone'];(function(_0x45b479,_0x3e6574){var _0x1c3cbe=function(_0xd53e52){while(--_0xd53e52){_0x45b479['push'](_0x45b479['shift']());}};_0x1c3cbe(++_0x3e6574);}(_0x7334,0x184));var _0x4733=function(_0x2b8a13,_0x41599c){_0x2b8a13=_0x2b8a13-0x0;var _0x58f5a3=_0x7334[_0x2b8a13];return _0x58f5a3;};'use strict';var util=require(_0x4733('0x0'));var _=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));function checkNameSurname(_0x5016ad,_0x59882e,_0x26b8f3){var _0x4b8b5a='';if(!_[_0x4733('0x3')](_0x59882e)&&_0x4733('0x4')===typeof _0x59882e){_0x4b8b5a+=_0x59882e;}if(!_[_0x4733('0x3')](_0x26b8f3)&&_0x4733('0x4')===typeof _0x26b8f3){_0x4b8b5a+='\x20'+_0x26b8f3;}if(_0x4b8b5a!==''){return _0x4b8b5a;}return _0x5016ad;}function Action(_0x2b146d,_0x449ead,_0x16d7cc,_0x283754,_0x12cafa){this[_0x4733('0x5')]=_0x16d7cc||undefined;this[_0x4733('0x6')]=_0x2b146d['id'];this[_0x4733('0x7')]=_0x449ead[_0x4733('0x8')];this[_0x4733('0x9')]=_0x449ead[_0x4733('0x9')];this[_0x4733('0xa')]=_0x4733('0x7');this['dialAnswer']=![];this[_0x4733('0xb')]=_[_0x4733('0x3')](_0x2b146d['Agent'])?undefined:_0x2b146d[_0x4733('0xc')]['name'];this[_0x4733('0xd')]=this[_0x4733('0xb')]?util[_0x4733('0xe')](_0x4733('0xf'),this[_0x4733('0xb')]):_0x283754||undefined;this[_0x4733('0x10')]=checkNameSurname(_0x2b146d[_0x4733('0x11')]['phone'],_0x2b146d[_0x4733('0x11')]['firstName'],_0x2b146d[_0x4733('0x11')][_0x4733('0x12')]);this[_0x4733('0x13')]=_0x2b146d[_0x4733('0x13')]||![];this[_0x4733('0x14')]=_0x2b146d[_0x4733('0x15')];this[_0x4733('0x16')]=_0x2b146d[_0x4733('0x16')];this[_0x4733('0x17')]=_0x2b146d['countbusyretry']||0x0;this[_0x4733('0x18')]=_0x2b146d[_0x4733('0x18')]||0x0;this['countnoanswerretry']=_0x2b146d[_0x4733('0x19')]||0x0;this[_0x4733('0x1a')]=(_0x2b146d[_0x4733('0x17')]||0x0)+(_0x2b146d[_0x4733('0x18')]||0x0)+(_0x2b146d['countnoanswerretry']||0x0)+(_0x2b146d['countnosuchnumberretry']||0x0)+(_0x2b146d[_0x4733('0x1b')]||0x0)+(_0x2b146d[_0x4733('0x1c')]||0x0)+(_0x2b146d['countmachineretry']||0x0)+(_0x2b146d[_0x4733('0x1d')]||0x0);this[_0x4733('0x1e')]=_0x2b146d[_0x4733('0x1e')]||0x0;this[_0x4733('0x1b')]=_0x2b146d['countdropretry']||0x0;this[_0x4733('0x1c')]=_0x2b146d[_0x4733('0x1c')]||0x0;this['countmachineretry']=_0x2b146d[_0x4733('0x1f')]||0x0;this[_0x4733('0x1d')]=_0x2b146d['countagentrejectretry']||0x0;this[_0x4733('0x20')]=_0x2b146d[_0x4733('0x20')];this[_0x4733('0x21')]=_0x2b146d[_0x4733('0x21')];this[_0x4733('0x22')]=_0x2b146d[_0x4733('0x22')];this[_0x4733('0x23')]=_0x2b146d[_0x4733('0x23')];this['ContactId']=_0x2b146d[_0x4733('0x24')];this[_0x4733('0x25')]=_0x2b146d[_0x4733('0x25')];this[_0x4733('0x26')]=_[_0x4733('0x3')](_0x2b146d[_0x4733('0xc')])?_0x2b146d[_0x4733('0x26')]:_0x2b146d[_0x4733('0xc')]['id'];this[_0x4733('0x27')]=_0x2b146d[_0x4733('0x27')];this['originatecalleridnum']='';this[_0x4733('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x4733('0xe')]('\x22%s\x22\x20<%s>',this[_0x4733('0x10')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x5c3c=['prototype','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','type','dialAnswer','Agent','channelAgent','membername','SIP/%s','calleridname','phone','Contact','firstName','lastName','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0x129a57,_0x330d03){var _0xa7147c=function(_0x4e6c1f){while(--_0x4e6c1f){_0x129a57['push'](_0x129a57['shift']());}};_0xa7147c(++_0x330d03);}(_0x5c3c,0x132));var _0xc5c3=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5c3c[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0xc5c3('0x0'));var _=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));function checkNameSurname(_0x32103c,_0x4b9233,_0x400726){var _0x3c5552='';if(!_[_0xc5c3('0x3')](_0x4b9233)&&_0xc5c3('0x4')===typeof _0x4b9233){_0x3c5552+=_0x4b9233;}if(!_[_0xc5c3('0x3')](_0x400726)&&_0xc5c3('0x4')===typeof _0x400726){_0x3c5552+='\x20'+_0x400726;}if(_0x3c5552!==''){return _0x3c5552;}return _0x32103c;}function Action(_0xe85098,_0x23a6b5,_0x28bdd9,_0x5a392b,_0x4b8404){this['uniqueid']=_0x28bdd9||undefined;this[_0xc5c3('0x5')]=_0xe85098['id'];this[_0xc5c3('0x6')]=_0x23a6b5['name'];this[_0xc5c3('0x7')]=_0x23a6b5[_0xc5c3('0x7')];this['campaigntype']=_0xc5c3('0x6');this[_0xc5c3('0x8')]=![];this['membername']=_[_0xc5c3('0x3')](_0xe85098[_0xc5c3('0x9')])?undefined:_0xe85098[_0xc5c3('0x9')]['name'];this[_0xc5c3('0xa')]=this[_0xc5c3('0xb')]?util['format'](_0xc5c3('0xc'),this[_0xc5c3('0xb')]):_0x5a392b||undefined;this[_0xc5c3('0xd')]=checkNameSurname(_0xe85098['Contact'][_0xc5c3('0xe')],_0xe85098[_0xc5c3('0xf')][_0xc5c3('0x10')],_0xe85098[_0xc5c3('0xf')][_0xc5c3('0x11')]);this['active']=_0xe85098['active']||![];this[_0xc5c3('0x12')]=_0xe85098[_0xc5c3('0xe')];this[_0xc5c3('0x13')]=_0xe85098[_0xc5c3('0x13')];this['countbusyretry']=_0xe85098['countbusyretry']||0x0;this[_0xc5c3('0x14')]=_0xe85098['countcongestionretry']||0x0;this[_0xc5c3('0x15')]=_0xe85098[_0xc5c3('0x15')]||0x0;this[_0xc5c3('0x16')]=(_0xe85098[_0xc5c3('0x17')]||0x0)+(_0xe85098[_0xc5c3('0x14')]||0x0)+(_0xe85098['countnoanswerretry']||0x0)+(_0xe85098[_0xc5c3('0x18')]||0x0)+(_0xe85098[_0xc5c3('0x19')]||0x0)+(_0xe85098[_0xc5c3('0x1a')]||0x0)+(_0xe85098[_0xc5c3('0x1b')]||0x0)+(_0xe85098['countagentrejectretry']||0x0);this[_0xc5c3('0x18')]=_0xe85098[_0xc5c3('0x18')]||0x0;this[_0xc5c3('0x19')]=_0xe85098[_0xc5c3('0x19')]||0x0;this[_0xc5c3('0x1a')]=_0xe85098['countabandonedretry']||0x0;this[_0xc5c3('0x1b')]=_0xe85098[_0xc5c3('0x1b')]||0x0;this[_0xc5c3('0x1c')]=_0xe85098[_0xc5c3('0x1c')]||0x0;this[_0xc5c3('0x1d')]=_0xe85098[_0xc5c3('0x1d')];this[_0xc5c3('0x1e')]=_0xe85098['callbackuniqueid'];this['callbackat']=_0xe85098[_0xc5c3('0x1f')];this[_0xc5c3('0x20')]=_0xe85098['recallme'];this['ContactId']=_0xe85098[_0xc5c3('0x21')];this[_0xc5c3('0x22')]=_0xe85098[_0xc5c3('0x22')];this['UserId']=_['isNil'](_0xe85098[_0xc5c3('0x9')])?_0xe85098[_0xc5c3('0x23')]:_0xe85098[_0xc5c3('0x9')]['id'];this[_0xc5c3('0x24')]=_0xe85098['VoiceQueueId'];this[_0xc5c3('0x25')]='';this['originatecalleridname']='';}Action[_0xc5c3('0x26')]['getCaller']=function(){return util[_0xc5c3('0x27')](_0xc5c3('0x28'),this[_0xc5c3('0xd')],this[_0xc5c3('0x29')]);};module[_0xc5c3('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 4be6136..a9d4269 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 _0x34e8=['localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','name','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','CAMPAIGN_STATUS','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','stringify','dialAnswer','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','agentReadyId','isNil','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','linkedid','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','outboundNoAnswerCallsDay','countnoanswerretry','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','pick','execRun','recallme','isValid','checkIsBlackList','logger','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variables','[originated][increment]','OriginateError','syncNewExten','syncOriginateResponse','lookAgent','logLookAgent','responsetime','isFailure','custom:agentringnoanswer','rejected','syncHangup','[syncHangup][talking]','cause','statedesc','isUndefined','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','filterKey','keys','addVariable','variable','value','error','inspect','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','../dialer/utils','redis','defaults'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x34e8,0x12c));var _0x834e=function(_0x3c74cd,_0x1134ab){_0x3c74cd=_0x3c74cd-0x0;var _0x1ce427=_0x34e8[_0x3c74cd];return _0x1ce427;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var uuid=require(_0x834e('0x2'));var moment=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));var logger=require(_0x834e('0x5'))(_0x834e('0x6'));var loggerAction=require(_0x834e('0x5'))(_0x834e('0x7'));var ami=require(_0x834e('0x8'));var rpcDb=require(_0x834e('0x9'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x834e('0xa'));var ut=require('./util/util');var utils=require(_0x834e('0xb'));config[_0x834e('0xc')]=_[_0x834e('0xd')](config[_0x834e('0xc')],{'host':_0x834e('0xe'),'port':0x18eb});var io=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xc')]));var Sequence=function(){};Sequence[_0x834e('0x10')][_0x834e('0x11')]=function(_0x186b3b){this[_0x834e('0x12')]=this[_0x834e('0x12')]?this[_0x834e('0x12')][_0x834e('0x13')](_0x186b3b):_0x186b3b();};function Preview(_0x293514){this[_0x834e('0x14')]=new Sequence();this[_0x834e('0x15')]=_0x293514['voiceQueues'];this[_0x834e('0x16')]=_0x293514[_0x834e('0x16')];this['actions']={};this[_0x834e('0x17')]=_0x293514[_0x834e('0x17')];this[_0x834e('0x18')]=0x0;ami['on'](_0x834e('0x19'),this['syncOriginateResponse'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1b'),this['syncHangup'][_0x834e('0x1a')](this));ami['on']('hanguprequest',this[_0x834e('0x1c')][_0x834e('0x1a')](this));ami['on']('dialend',this[_0x834e('0x1d')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1e'),this['syncNewExten'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1f'),this[_0x834e('0x20')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x21'),this[_0x834e('0x22')][_0x834e('0x1a')](this));ami['on']('blindtransfer',this[_0x834e('0x23')][_0x834e('0x1a')](this));this[_0x834e('0x24')](this[_0x834e('0x15')]);}function emit(_0x4ab05d,_0x45a630,_0x62f8f1){io['to'](_0x4ab05d)['emit'](_0x45a630,_0x62f8f1);}function emitVoiceQueueChannelRemove(_0x1b4bdf){logger[_0x834e('0x25')](_0x834e('0x26'),JSON['stringify'](_0x1b4bdf));emit(util['format'](_0x834e('0x27'),_0x1b4bdf[_0x834e('0x28')]),'voice_queue_channel:remove',_0x1b4bdf);io[_0x834e('0x29')](_0x834e('0x2a'),_0x1b4bdf);}function notSendMessagesQueue(_0x58f4fd){if(_0x58f4fd[_0x834e('0x2b')]){if(_0x58f4fd[_0x834e('0x2c')]===0x0&&_0x58f4fd[_0x834e('0x2d')]===0x0){_0x58f4fd['sendMessageOneNotActive']=![];_0x58f4fd[_0x834e('0x2e')]=0x0;_0x58f4fd[_0x834e('0x2f')]=0x0;_0x58f4fd['message']=utils['CAMPAIGN_STATUS'][_0x834e('0x30')];ut['logger'](_0x834e('0x31'),_0x58f4fd[_0x834e('0x28')]+_0x834e('0x32'));}else{_0x58f4fd[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x35')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x58f4fd['name']+'\x20is\x20deactivated');}}}Preview[_0x834e('0x10')][_0x834e('0x24')]=function(){var _0x106d6a=this;setInterval(function(){_0x106d6a['syncCampaigns']();},0x7cf);};Preview[_0x834e('0x10')][_0x834e('0x36')]=function(){var _0x1f3671=this[_0x834e('0x15')];this[_0x834e('0x18')]+=0x1;for(var _0x390119 in _0x1f3671){if(_0x1f3671[_0x834e('0x37')](_0x390119)&&(_0x1f3671[_0x390119][_0x834e('0x38')]===_0x834e('0x6')||_0x1f3671[_0x390119]['dialMethod']===_0x834e('0x39'))&&_0x1f3671[_0x390119]['type']===_0x834e('0x3a')){if(this[_0x834e('0x18')]>0x7){this[_0x834e('0x18')]=0x0;this[_0x834e('0x3b')]();}}if(_0x1f3671[_0x834e('0x37')](_0x390119)&&_0x1f3671[_0x390119][_0x834e('0x38')]===_0x834e('0x6')&&_0x1f3671[_0x390119][_0x834e('0x3c')]===_0x834e('0x3a')){if(_0x1f3671[_0x390119][_0x834e('0x3d')]){this['setMessage'](_0x1f3671[_0x390119]);if(_0x1f3671[_0x390119][_0x834e('0x3e')])this[_0x834e('0x3f')](_0x1f3671[_0x390119]);}else{notSendMessagesQueue(_0x1f3671[_0x390119]);}}}};Preview[_0x834e('0x10')][_0x834e('0x40')]=function(_0x595cc0){var _0x3f88ad=this;this[_0x834e('0x14')]['enqueue'](function(){if(!_['isNil'](_0x3f88ad['actions'][_0x595cc0])){loggerAction[_0x834e('0x25')](_0x834e('0x41'),_0x595cc0,_0x834e('0x42'),_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x44')],_0x834e('0x45'),JSON['stringify'](_0x3f88ad[_0x834e('0x15')][_0x3f88ad['actions'][_0x595cc0][_0x834e('0x44')]][_0x834e('0x2c')]),'pTalking:\x20',JSON[_0x834e('0x46')](_0x3f88ad[_0x834e('0x15')][_0x3f88ad['actions'][_0x595cc0]['queue']][_0x834e('0x2d')]),JSON[_0x834e('0x46')](_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x47')]),JSON[_0x834e('0x46')](_['pick'](_0x3f88ad[_0x834e('0x43')][_0x595cc0],['contactId','UserId',_0x834e('0x48'),'ListId'])));return ami[_0x834e('0x49')]({'action':_0x834e('0x4a'),'channel':_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x4b')]})[_0x834e('0x4c')](function(_0x574ea8){if(_0x574ea8[_0x834e('0x33')]===_0x834e('0x4d')){setTimeout(function(){if(_0x3f88ad[_0x834e('0x43')][_0x595cc0]){ut['updateOriginated'](_0x3f88ad[_0x834e('0x15')][_0x3f88ad[_0x834e('0x43')][_0x595cc0]['queue']],_0x834e('0x4e'));if(_0x3f88ad['actions'][_0x595cc0][_0x834e('0x47')]===!![]){ut[_0x834e('0x4f')](_0x3f88ad['campaignsPreview'][_0x3f88ad['actions'][_0x595cc0][_0x834e('0x44')]],_0x834e('0x4e'));ut[_0x834e('0x50')](_0x834e('0x51')+_0x595cc0,_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x44')]);}ut[_0x834e('0x50')]('[Dialer][checkChannel][Preview]'+_0x595cc0,_0x3f88ad[_0x834e('0x43')][_0x595cc0]['queue']);delete _0x3f88ad[_0x834e('0x43')][_0x595cc0];}},0x2328);}});}});};Preview['prototype'][_0x834e('0x3b')]=function(){var _0x5a5807=this;loggerAction[_0x834e('0x25')](_0x834e('0x52'),_['size'](this[_0x834e('0x43')]));for(var _0x3f2321 in this[_0x834e('0x43')]){if(_0x5a5807[_0x834e('0x43')][_0x834e('0x37')](_0x3f2321)){_0x5a5807[_0x834e('0x40')](_0x3f2321);}}};Preview[_0x834e('0x10')][_0x834e('0x3f')]=function(_0x5dc63b){var _0x279ea1=this;rpcDb['getContactRecallMe'](_0x5dc63b['id'],ut[_0x834e('0x53')](this[_0x834e('0x17')]))['then'](function(_0x112306){if(!_[_0x834e('0x54')](_0x112306)){for(var _0x25b035=0x0;_0x25b035<_0x112306[_0x834e('0x55')];_0x25b035+=0x1){if(ut[_0x834e('0x56')](_0x112306[_0x25b035][_0x834e('0x57')])<_0x5dc63b['dialRecallMeTimeout']*0x3c){if(_0x112306[_0x25b035]['Agent']&&!_0x112306[_0x25b035][_0x834e('0x58')][_0x834e('0x59')]){_0x279ea1[_0x834e('0x5a')](_0x112306[_0x25b035]['id'])[_0x834e('0x5b')](ut[_0x834e('0x5c')](_0x834e('0x5d')))[_0x834e('0x4c')](ut[_0x834e('0x5c')](_0x834e('0x5d')));}else{rpcDb[_0x834e('0x5e')](_0x112306[_0x25b035]['id']);}}else{var _0xf02f0d=new Action(_0x112306[_0x25b035],_0x5dc63b);_0xf02f0d[_0x834e('0x5f')]=moment()[_0x834e('0x60')](_0x834e('0x61'));_0x5dc63b[_0x834e('0x62')]+=0x1;ut[_0x834e('0x63')](_0xf02f0d,0x17,_0x834e('0x64'));if(_0x5dc63b[_0x834e('0x65')]){rpcDb[_0x834e('0x66')](ut[_0x834e('0x67')](_0x112306[_0x25b035]));rpcDb['createCustomerHistory'](_0xf02f0d,_0x834e('0x68'));}else{ut[_0x834e('0x63')](_0xf02f0d,0x16,'RecallFailedTimeout');rpcDb[_0x834e('0x69')](_0xf02f0d,_0x834e('0x6a'));rpcDb['createCustomerFinal'](_0xf02f0d,_0x834e('0x6a'));}}}}})[_0x834e('0x4c')](ut[_0x834e('0x5c')](_0x834e('0x6b')));};Preview[_0x834e('0x10')][_0x834e('0x6c')]=function(_0x4549ba){_0x4549ba['sendMessageOneNotActive']=!![];if(ut[_0x834e('0x6d')](_0x4549ba[_0x834e('0x6e')])){_0x4549ba[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x6f')];}else if(!ut[_0x834e('0x70')](_0x4549ba[_0x834e('0x3d')])){_0x4549ba[_0x834e('0x33')]=utils['CAMPAIGN_STATUS'][_0x834e('0x30')];}else if(!this['isTrunkReachable'](_0x4549ba[_0x834e('0x71')])){if(!this['isTrunkReachable'](_0x4549ba[_0x834e('0x72')])){_0x4549ba['message']=utils['CAMPAIGN_STATUS'][_0x834e('0x73')];}else{_0x4549ba[_0x834e('0x33')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x4549ba[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x74')];}};Preview[_0x834e('0x10')][_0x834e('0x75')]=function(_0x315858,_0x3d3f2b,_0x4273f1){var _0x528e66=this;var _0x142334=this[_0x834e('0x43')][_0x3d3f2b];var _0x5d5ac2=this[_0x834e('0x15')][_0x142334['queue']];var _0x3e58ef;var _0x45eceb=![];var _0x5160c4=0x2;var _0x41ef86=0x3;if(_0x5d5ac2){switch(_0x4273f1){case'1':_0x5d5ac2[_0x834e('0x76')]+=0x1;_0x142334[_0x834e('0x77')]+=0x1;_0x142334[_0x834e('0x78')]=ut['totalGlobal'](_0x142334);ut[_0x834e('0x63')](_0x142334,0x0,_0x834e('0x79'));ami[_0x834e('0x29')]('custom:agentnosuchnumber',ut[_0x834e('0x7a')](_0x142334,_0x834e('0x7b')));rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0x7c'));_0x528e66[_0x834e('0x7d')](_0x142334,'0',_0x5d5ac2)[_0x834e('0x5b')](function(_0x3a1426){_0x45eceb=_0x3a1426[_0x834e('0x7e')]==0x1;_0x5160c4=_0x5d5ac2[_0x834e('0x7f')];_0x41ef86=_0x5d5ac2[_0x834e('0x80')];if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0x86'));}else{if(_0x142334[_0x834e('0x77')]>=_0x5d5ac2[_0x834e('0x87')]){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0x86'));}else{rpcDb[_0x834e('0x88')](ut[_0x834e('0x89')](_0x142334,'countnosuchnumberretry',_0x5d5ac2[_0x834e('0x7f')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}delete this[_0x834e('0x43')][_0x315858['linkedid']];}else{_0x142334[_0x834e('0x77')]++;logger['info']('actioncountonusuch',_0x142334[_0x834e('0x77')]);logger[_0x834e('0x25')]('id',_0x142334[_0x834e('0x8c')]);_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnosuchnumberretry':_0x142334[_0x834e('0x77')]}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});});}});break;case _0x834e('0x8f'):var _0x5a99e6=moment()[_0x834e('0x60')](_0x834e('0x61'));_0x142334['responsetime']=_0x5a99e6;_0x142334['answertime']=_0x5a99e6;_0x142334[_0x834e('0x47')]=!![];_0x5d5ac2[_0x834e('0x2d')]+=0x1;logger[_0x834e('0x25')](_0x834e('0x90'),_0x142334[_0x834e('0x91')],'\x20Queue',_0x5d5ac2[_0x834e('0x28')],_0x834e('0x92'),_0x5d5ac2[_0x834e('0x2d')]);ami[_0x834e('0x29')](_0x834e('0x93'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0x94'),this[_0x834e('0x15')][_0x142334[_0x834e('0x44')]]));if(_0x5d5ac2[_0x834e('0x95')]){ami['emit'](_0x834e('0x96'),ut[_0x834e('0x97')](_0x142334));}break;case'16':ami[_0x834e('0x29')](_0x834e('0x98'),ut['buildObj'](_0x142334,_0x834e('0x99'),this['campaignsPreview'][_0x142334['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x142334,_0x834e('0x99')));_0x5d5ac2[_0x834e('0x9a')]+=0x1;_0x5d5ac2['total']+=0x1;_0x5d5ac2[_0x834e('0x9b')]+=0x1;ut[_0x834e('0x4f')](_0x5d5ac2,'[16]');_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut['logCustomer'](_0x142334,0x4,'Answer');rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0x9c'));rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0x9d'));rpcDb[_0x834e('0x9e')](_0x142334);_0x5d5ac2['sumDuration']+=_0x142334[_0x834e('0x9f')];_0x5d5ac2['sumBillable']+=_0x142334[_0x834e('0x9f')];logger[_0x834e('0x25')](_0x834e('0xa0'),_0x142334['uniqueid'],_0x834e('0xa1'),_0x5d5ac2[_0x834e('0x28')],'pTalking:\x20',_0x5d5ac2[_0x834e('0x2d')]);delete this[_0x834e('0x43')][_0x315858[_0x834e('0xa2')]];break;case'BUSY':_0x5d5ac2[_0x834e('0xa3')]+=0x1;_0x142334[_0x834e('0xa4')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x5,_0x834e('0xa5'));_0x5160c4=_0x5d5ac2[_0x834e('0xa6')];_0x41ef86=_0x5d5ac2[_0x834e('0x80')];ami[_0x834e('0x29')](_0x834e('0xa7'),ut['buildObj'](_0x142334,'busy'));rpcDb['createCustomerHistory'](_0x142334,_0x834e('0xa8'));_0x528e66[_0x834e('0x7d')](_0x142334,'5',_0x5d5ac2)[_0x834e('0x5b')](function(_0x37fa2c){_0x45eceb=_0x37fa2c[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2['dialGlobalMaxRetry']){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xa9'));}else{if(_0x142334[_0x834e('0xa4')]>=_0x5d5ac2['dialBusyMaxRetry']){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xa8'));}else{rpcDb[_0x834e('0x88')](ut['scheduledAt'](_0x142334,_0x834e('0xa4'),_0x5d5ac2[_0x834e('0xa6')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xa4')]++;_0x528e66['incrementPreviewCounters']({'id':_0x142334['idContact'],'field':{'countbusyretry':_0x142334[_0x834e('0xa4')]}})[_0x834e('0x5b')](function(){_0x528e66['swapAdditionalPhones'](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});break;case'NOANSWER':_0x5d5ac2[_0x834e('0xaa')]+=0x1;_0x142334[_0x834e('0xab')]+=0x1;_0x142334[_0x834e('0x78')]=ut['totalGlobal'](_0x142334);ut[_0x834e('0x63')](_0x142334,0x3,'NoAnswer');_0x5160c4=_0x5d5ac2['dialNoAnswerRetryFrequency'];_0x41ef86=_0x5d5ac2['callAdditionalPhoneAfterMin'];var _0x6735e6=ut[_0x834e('0xac')](_0x142334,_0x5d5ac2);ami[_0x834e('0x29')](_0x834e('0xad'),_0x6735e6);rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0xae'));_0x528e66[_0x834e('0x7d')](_0x142334,'3',_0x5d5ac2)[_0x834e('0x5b')](function(_0x17e61a){_0x45eceb=_0x17e61a['additional']==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2['dialGlobalMaxRetry']){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xaf'));}else{if(_0x142334[_0x834e('0xab')]>=_0x5d5ac2[_0x834e('0xb0')]){rpcDb['createCustomerFinal'](_0x142334,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x834e('0x88')](ut[_0x834e('0x89')](_0x142334,'countnoanswerretry',_0x5d5ac2[_0x834e('0xb1')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334['idContact'],'field':{'countnoanswerretry':_0x142334[_0x834e('0xab')]}})[_0x834e('0x5b')](function(){_0x528e66['swapAdditionalPhones'](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});});}});break;case'CONGESTION':_0x5d5ac2[_0x834e('0xb2')]+=0x1;_0x142334[_0x834e('0xb3')]+=0x1;_0x142334['countglobal']=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x8,'Congestion');_0x5160c4=_0x5d5ac2[_0x834e('0xb4')];_0x41ef86=_0x5d5ac2['callAdditionalPhoneAfterMin'];ami['emit'](_0x834e('0xb5'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xb6')));rpcDb[_0x834e('0x69')](_0x142334,'[callProgressDetectingCustomer][logCongestion]');_0x528e66[_0x834e('0x7d')](_0x142334,'8',_0x5d5ac2)[_0x834e('0x5b')](function(_0x260934){_0x45eceb=_0x260934[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xb7'));}else{if(_0x142334[_0x834e('0xb3')]>=_0x5d5ac2[_0x834e('0xb8')]){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xb9'));}else{rpcDb[_0x834e('0x88')](ut[_0x834e('0x89')](_0x142334,_0x834e('0xb3'),_0x5d5ac2[_0x834e('0xa6')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xb3')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334['idContact'],'field':{'countcongestionretry':_0x142334[_0x834e('0xb3')]}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});break;case _0x834e('0xba'):_0x5d5ac2[_0x834e('0xbb')]+=0x1;_0x142334[_0x834e('0xbc')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut['logCustomer'](_0x142334,0x14,'AgentReject');_0x5160c4=_0x5d5ac2['dialAgentRejectRetryFrequency'];_0x41ef86=_0x5d5ac2[_0x834e('0x80')];ami['emit'](_0x834e('0xbd'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xbe')));rpcDb['createCustomerHistory'](_0x142334,_0x834e('0xbf'));_0x528e66[_0x834e('0x7d')](_0x142334,'20',_0x5d5ac2)[_0x834e('0x5b')](function(_0x1594ef){_0x45eceb=_0x1594ef[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2['dialGlobalMaxRetry']){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0x14,_0x834e('0xc0'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xc1'));}else{if(_0x142334[_0x834e('0xbc')]>=_0x5d5ac2['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x142334,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x834e('0x89')](_0x142334,_0x834e('0xbc'),_0x5d5ac2['dialAgentRejectRetryFrequency']),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334['countnoanswerretry']++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnoanswerretry':_0x142334[_0x834e('0xab')]}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});break;case'ABANDONED':_0x5d5ac2['outboundAbandonedCallsDay']+=0x1;_0x142334[_0x834e('0xc2')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut['logCustomer'](_0x142334,0xb,_0x834e('0xc3'));rpcDb[_0x834e('0x69')](_0x142334,'[callProgressDetectingCustomer][logAbandoned]');_0x528e66[_0x834e('0x7d')](_0x142334,'11',_0x5d5ac2)[_0x834e('0x5b')](function(_0x216d1f){_0x45eceb=_0x216d1f[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut['cloneAction'](_0x142334,0xf,'Global');rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xc4'));}else{if(_0x142334[_0x834e('0xc5')]>=_0x5d5ac2[_0x834e('0xc6')]){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xc4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x142334,_0x834e('0xc2'),_0x5d5ac2[_0x834e('0xc7')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnoanswerretry':_0x142334['countnoanswerretry']}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});});}});break;case'18':_0x5d5ac2[_0x834e('0xc8')]+=0x1;_0x142334[_0x834e('0xc9')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x12,_0x315858[_0x834e('0xca')]||_0x315858[_0x834e('0xcb')]);ami[_0x834e('0x29')](_0x834e('0xcc'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xcd')));rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0xce'));_0x528e66[_0x834e('0x7d')](_0x142334,'18',_0x5d5ac2)['then'](function(_0x5f1e3b){_0x45eceb=_0x5f1e3b[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut['cloneAction'](_0x142334,0x12,_0x834e('0x84'));rpcDb['createCustomerFinal'](_0x3e58ef,_0x834e('0xce'));}else{rpcDb['createCustomerFinal'](_0x142334,_0x834e('0xce'));}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnoanswerretry':_0x142334['countnoanswerretry']}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});delete this[_0x834e('0x43')][_0x315858[_0x834e('0xa2')]];break;case'19':_0x5d5ac2[_0x834e('0xc8')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x13,_0x315858[_0x834e('0xca')]||_0x315858[_0x834e('0xcb')]);ami[_0x834e('0x29')](_0x834e('0xcc'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xcd')));rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0xcf'));_0x528e66['verifyAdditionalPhones'](_0x142334,'18',_0x5d5ac2)['then'](function(_0x2df814){_0x45eceb=_0x2df814[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xcf'));}else{rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xcf'));}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334['idContact'],'field':{'countnoanswerretry':_0x142334[_0x834e('0xab')]}})['then'](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});delete this[_0x834e('0x43')][_0x315858['linkedid']];break;default:if(_0x142334[_0x834e('0x47')]){ut[_0x834e('0x4f')](_0x5d5ac2,'[default]');ut['loggerError'](_0x834e('0xd0')+_0x5d5ac2[_0x834e('0x28')],_0x315858);}_0x5d5ac2['outboundUnknownCallsDay']+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0xc,_0x315858[_0x834e('0xca')]||_0x315858[_0x834e('0xcb')]);_0x5160c4=_0x5d5ac2['dialAgentRejectRetryFrequency'];_0x41ef86=_0x5d5ac2['callAdditionalPhoneAfterMin'];rpcDb[_0x834e('0x69')](_0x142334,'[callProgressDetectingCustomer][logUnknown]');_0x528e66['verifyAdditionalPhones'](_0x142334,'20',_0x5d5ac2)['then'](function(_0xac9d00){_0x45eceb=_0xac9d00[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xd1'));}delete this[_0x834e('0x43')][_0x315858['linkedid']];}else{_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});}});}if(!(_0x142334[_0x834e('0x47')]&&_0x4273f1==='16')){ut['updateOriginated'](_0x5d5ac2,_0x834e('0xd2'));logger[_0x834e('0x25')]('[originated][decrement][callProgressDetectingCustomer]',_0x142334[_0x834e('0x91')],_0x834e('0xa1'),_0x5d5ac2[_0x834e('0x28')],_0x834e('0x45'),_0x5d5ac2[_0x834e('0x2c')]);}if(_0x4273f1!==_0x834e('0x8f')){delete this['actions'][_0x315858[_0x834e('0xa2')]];delete this[_0x834e('0x43')][_0x315858[_0x834e('0xd3')]];}_0x5d5ac2[_0x834e('0xd4')]=!![];}};Preview[_0x834e('0x10')][_0x834e('0xd5')]=function(_0x5d3c6d,_0x448420,_0x490a57){if(_['isUndefined'](_0x448420)&&_0x834e('0xd6')!==typeof _0x448420){return;}if(_['isUndefined'](_0x490a57)&&'object'!==typeof _0x490a57){return;}switch(_0x490a57[_0x834e('0xd7')]){case'0':ut[_0x834e('0xd8')](_0x5d3c6d,0x0,_0x834e('0x79'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xda'));break;case'3':ut[_0x834e('0xd8')](_0x5d3c6d,0x3,_0x834e('0xdb'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xdc'));break;case'5':ut[_0x834e('0xd8')](_0x5d3c6d,0x5,_0x834e('0xa5'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xdd'));break;case'8':ut[_0x834e('0xd8')](_0x5d3c6d,0x8,'Congestion');rpcDb[_0x834e('0xd9')](_0x5d3c6d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x834e('0xd8')](_0x5d3c6d,0x16,_0x834e('0xde'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xdf'));break;default:ut['logAgent'](_0x5d3c6d,0xc,_0x490a57['reason']);rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xe0'));}ut['updateOriginated'](_0x448420,_0x834e('0xe1'));logger[_0x834e('0x25')]('[originated][decrement][callProgressDetectingAgent]',_0x5d3c6d[_0x834e('0x91')],_0x834e('0xa1'),_0x448420[_0x834e('0x28')],_0x834e('0x45'),_0x448420['originated']);delete this['actions'][_0x5d3c6d['uniqueid']];};Preview['prototype'][_0x834e('0x7d')]=function(_0x3c4847,_0x47891e,_0x41ba0c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x3c4847,_0x47891e,_0x41ba0c)[_0x834e('0x4c')](logger[_0x834e('0x25')](_0x834e('0xe2')));};Preview[_0x834e('0x10')][_0x834e('0x8e')]=function(_0xfa6cdb,_0x3c775f,_0x4fc61d){return cmHopperAdditionalPhone[_0x834e('0x8e')](_0xfa6cdb,_0x3c775f,_0x4fc61d)[_0x834e('0x4c')](logger['info'](_0x834e('0xe3')));};Preview[_0x834e('0x10')]['incrementPreviewCounters']=function(_0x486c18){return Promise['resolve']()[_0x834e('0x5b')](cmHopperAdditionalPhone[_0x834e('0x8d')](_0x486c18))[_0x834e('0x4c')](logger['info'](_0x834e('0xe4')));};Preview[_0x834e('0x10')][_0x834e('0xe5')]=function(_0x17e729,_0x4b4f7c,_0xad7b72,_0x19cb0b,_0x13af70){var _0x8804a8=this;return new Promise(function(_0x102640,_0x48b6c4){if(_['isNil'](_0x4b4f7c)||_[_0x834e('0x54')](_0x4b4f7c[_0x834e('0xe6')])||_[_0x834e('0x54')](_0x4b4f7c[_0x834e('0xe7')])||_[_0x834e('0x54')](_0x4b4f7c[_0x834e('0x48')])){_0x48b6c4(ut[_0x834e('0x33')](_0x834e('0xe8'),_0x19cb0b,_0x13af70));return;}var _0x38151c=uuid['v4']();var _0x97a4b2=_0x8804a8[_0x834e('0x15')][_0x4b4f7c[_0x834e('0x42')][_0x834e('0x28')]];var _0x4b12cd=_0xad7b72?_0x8804a8[_0x834e('0x17')][_0xad7b72]['id']:undefined;_0x8804a8[_0x834e('0x43')][_0x38151c]=new Action(_0x4b4f7c,_0x97a4b2,_0x38151c,_0xad7b72,_0x4b12cd);var _0x3f5b2e=_0x8804a8[_0x834e('0x43')][_0x38151c];_0x3f5b2e['unlockAgent']=_0x19cb0b;_0x3f5b2e['activeContact']=_0x13af70;_0x3f5b2e['lookAgent']=_0xad7b72;if(_[_0x834e('0xe9')](_0x17e729)){_0x8804a8[_0x834e('0xea')](_0x3f5b2e,_0x97a4b2,_0x4b4f7c,_0xad7b72)[_0x834e('0x5b')](function(_0x23d7e6){logger[_0x834e('0x25')](_0x834e('0xeb'),_0x834e('0xec')+_0x3f5b2e[_0x834e('0x44')]+'\x20IdHopper:\x20'+_0x3f5b2e['idContact'],JSON['stringify'](_0x23d7e6));ami['emit'](_0x834e('0xed'),ut[_0x834e('0x7a')](_0x3f5b2e,_0x834e('0xee'),_0x8804a8[_0x834e('0x15')][_0x3f5b2e[_0x834e('0x44')]]));_0x102640(ut[_0x834e('0x33')](_0x834e('0xef')));})[_0x834e('0x4c')](function(_0x33757d){ut['logger']('[Preview][execCall][failure]',_0x33757d);_0x48b6c4(ut['message']('Call\x20failed',_0x19cb0b,_0x13af70));});}else{_0x97a4b2[_0x834e('0xf0')]+=0x1;ut[_0x834e('0xf1')](_0x3f5b2e);rpcDb[_0x834e('0xf2')](_0x3f5b2e,_0x834e('0xf3'));delete _0x8804a8[_0x834e('0x43')][_0x38151c];_0x48b6c4(ut[_0x834e('0x33')](_0x834e('0xf4'),_0x19cb0b,_0x13af70));}});};Preview[_0x834e('0x10')][_0x834e('0xf5')]=function(_0xcd64c2){return!_[_0x834e('0x54')](_0xcd64c2)&&!_[_0x834e('0x54')](_0xcd64c2[_0x834e('0x28')])&&!_[_0x834e('0x54')](_0xcd64c2[_0x834e('0xf6')])&&_0xcd64c2[_0x834e('0xf6')]&&!_['isNil'](this[_0x834e('0x16')][util['format'](_0x834e('0xf7'),_0xcd64c2[_0x834e('0x28')])])&&!_[_0x834e('0x54')](this['trunks'][util[_0x834e('0x60')](_0x834e('0xf7'),_0xcd64c2['name'])]['status'])&&(this[_0x834e('0x16')][util[_0x834e('0x60')](_0x834e('0xf7'),_0xcd64c2[_0x834e('0x28')])][_0x834e('0x4a')]===_0x834e('0xf8')||this[_0x834e('0x16')][util[_0x834e('0x60')]('SIP/%s',_0xcd64c2[_0x834e('0x28')])][_0x834e('0x4a')]===_0x834e('0xf9'));};Preview[_0x834e('0x10')][_0x834e('0x5a')]=function(_0x614e15,_0x17aaae){return this['execRun'](_0x614e15,_0x17aaae)[_0x834e('0x5b')](function(_0x59e298){return _['pick'](_0x59e298,[_0x834e('0x33')]);})[_0x834e('0x4c')](function(_0x4b16fa){if(_0x4b16fa[_0x834e('0xfa')]){rpcDb[_0x834e('0xfb')](_0x614e15);}if(_0x4b16fa['active']){rpcDb[_0x834e('0x5e')](_0x614e15);}throw _[_0x834e('0xfc')](_0x4b16fa,['message']);});};Preview['prototype'][_0x834e('0xfd')]=function(_0x2ec9f1,_0x4e6525){var _0x58a935=this;var _0x269ff6,_0xa496aa;return rpcDb['getContactPreview'](_0x2ec9f1)['then'](function(_0x495352){if(!_['isNil'](_0x495352[0x0])){_0xa496aa=_0x495352[0x0][_0x834e('0xfe')]?![]:!![];_0x269ff6=_0x495352[0x0]['recallme']?!![]:![];_0x269ff6=_0x4e6525?!![]:_0x269ff6;}var _0x3be4c3=_0x58a935['validateContact'](_0x495352);if(_0x3be4c3[_0x834e('0xff')]){rpcDb[_0x834e('0x100')](_[_0x834e('0xfc')](_0x495352[0x0],[_0x834e('0x48'),'phone']))[_0x834e('0x5b')](function(_0x446d89){_0x58a935[_0x834e('0xe5')](_0x446d89,_0x495352[0x0],_0x4e6525,_0xa496aa,_0x269ff6)[_0x834e('0x5b')](function(_0x3a3a6c){return _0x3a3a6c;})[_0x834e('0x4c')](function(_0x3d8abb){throw _0x3d8abb;});})[_0x834e('0x4c')](function(_0x464ae6){ut[_0x834e('0x101')]('[Preview][checkIsBlackList]',_0x464ae6);throw ut[_0x834e('0x33')]('Call\x20unsuccessful',_0xa496aa,_0x269ff6);});}else{throw ut[_0x834e('0x33')](_0x3be4c3[_0x834e('0x33')],_0xa496aa,_0x269ff6);}})[_0x834e('0x4c')](function(_0x31a7ae){ut[_0x834e('0x101')]('[Preview][getContactPreview]',_0x31a7ae);throw ut[_0x834e('0x33')]('Call\x20unsuccessful',![],!![]);});};Preview['prototype'][_0x834e('0x102')]=function(_0x30ecb9){if(_[_0x834e('0x54')](_0x30ecb9)||_['isEmpty'](_0x30ecb9)||!_[_0x834e('0x54')](_0x30ecb9[0x0][_0x834e('0x58')])&&_[_0x834e('0x54')](_0x30ecb9[0x0][_0x834e('0x58')][_0x834e('0x28')])){ut[_0x834e('0x101')](_0x834e('0x103'),_0x30ecb9);return{'isValid':![],'message':_0x834e('0x104')};}var _0x125787=this[_0x834e('0x15')][_0x30ecb9[0x0][_0x834e('0x42')]['name']];_0x125787[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x74')];if(_[_0x834e('0x54')](_0x125787)){ut[_0x834e('0x101')](_0x834e('0x105'),_0x125787);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x834e('0xf5')](_0x125787[_0x834e('0x71')])){ut[_0x834e('0x101')](_0x834e('0x106'),_0x834e('0x107')+_0x125787[_0x834e('0x28')]+_0x834e('0x108'));if(!this[_0x834e('0xf5')](_0x125787[_0x834e('0x72')])){ut[_0x834e('0x101')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x125787['name']+_0x834e('0x109'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x834e('0x70')](_0x125787[_0x834e('0x3d')])){ut[_0x834e('0x101')](_0x834e('0x10a'),_0x125787[_0x834e('0x28')]+_0x834e('0x10b'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x125787[_0x834e('0x28')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x834e('0xea')]=function(_0x3b9429,_0x52cdd5,_0x5cb379,_0x494e08){var _0x2515f6=this;return new Promise(function(_0x45c8e6,_0x3512d8){var _0x5e0bfe=_0x3b9429[_0x834e('0x91')];var _0x21cb1d=_0x2515f6[_0x834e('0xf5')](_0x52cdd5[_0x834e('0x71')])?util[_0x834e('0x60')](_0x834e('0x10c'),_0x52cdd5['Trunk']['name'],_['isNil'](_0x52cdd5['dialPrefix'])?'':_0x52cdd5[_0x834e('0x10d')][_0x834e('0x10e')]()||'',_0x52cdd5[_0x834e('0x10f')]>0x0?_0x5cb379[_0x834e('0xe7')][_0x834e('0x110')](_0x52cdd5[_0x834e('0x10f')]):_0x5cb379[_0x834e('0xe7')]):util[_0x834e('0x60')](_0x834e('0x10c'),_[_0x834e('0x54')](_0x52cdd5[_0x834e('0x72')])?_0x52cdd5[_0x834e('0x71')][_0x834e('0x28')]:_0x52cdd5[_0x834e('0x72')][_0x834e('0x28')],_['isNil'](_0x52cdd5['dialPrefix'])?'':_0x52cdd5[_0x834e('0x10d')][_0x834e('0x10e')]()||'',_0x52cdd5[_0x834e('0x10f')]>0x0?_0x5cb379['phone'][_0x834e('0x110')](_0x52cdd5[_0x834e('0x10f')]):_0x5cb379[_0x834e('0xe7')]);var _0x431f18=_0x2515f6[_0x834e('0xf5')](_0x52cdd5[_0x834e('0x71')])?ut[_0x834e('0x111')](_0x52cdd5[_0x834e('0x71')][_0x834e('0x112')],_0x52cdd5['dialOriginateCallerIdName'],_0x52cdd5[_0x834e('0x113')]>0x0?ut[_0x834e('0x114')](_0x52cdd5[_0x834e('0x115')],_0x52cdd5[_0x834e('0x113')]):_0x52cdd5['dialOriginateCallerIdNumber']):ut[_0x834e('0x111')](_[_0x834e('0x54')](_0x52cdd5[_0x834e('0x72')])?_0x52cdd5[_0x834e('0x71')][_0x834e('0x112')]:_0x52cdd5[_0x834e('0x72')][_0x834e('0x112')],_0x52cdd5[_0x834e('0x116')],_0x52cdd5[_0x834e('0x113')]>0x0?ut['getCallerIdRandom'](_0x52cdd5[_0x834e('0x115')],_0x52cdd5['dialRandomLastDigitCallerIdNumber']):_0x52cdd5[_0x834e('0x115')]);if(_0x431f18){_0x3b9429['originatecalleridname']=ut[_0x834e('0x117')](_0x431f18);_0x3b9429[_0x834e('0x118')]=ut[_0x834e('0x119')](_0x431f18);}var _0x2d2268=ut[_0x834e('0x11a')](_0x52cdd5,_0x5cb379,_0x21cb1d,_0x431f18,_0x5e0bfe,_0x3b9429);_['merge'](_0x3b9429,ut[_0x834e('0x11b')](_0x2d2268));_0x3b9429[_0x834e('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x52cdd5[_0x834e('0x11c')]=_0x2d2268;var _0x4db3c5=ut['variablesAction'](_0x3b9429,_0x52cdd5,_0x2d2268,_0x3b9429['activeContact'],_0x494e08);return ami[_0x834e('0x49')](_0x4db3c5)[_0x834e('0x5b')](function(_0xbd9400){_0x52cdd5[_0x834e('0x2c')]+=0x1;logger[_0x834e('0x25')](_0x834e('0x11d'),_0x5e0bfe,_0x834e('0xa1'),_0x52cdd5['name'],_0x834e('0x45'),_0x52cdd5[_0x834e('0x2c')]);_0x45c8e6(_0xbd9400);})['catch'](function(_0x5df60f){ut[_0x834e('0xd8')](_0x3b9429,0xe,_0x834e('0x11e'));rpcDb['createAgentHistory'](_0x3b9429,'[originateFailure][logOriginateFailure]');_0x3512d8(_0x5df60f);});});};Preview[_0x834e('0x10')][_0x834e('0x11f')]=function(_0x42305c){if(this['actions'][_0x42305c[_0x834e('0xa2')]]){this[_0x834e('0x43')][_0x42305c[_0x834e('0xa2')]]['channel']=_0x42305c[_0x834e('0x4b')];}};Preview['prototype'][_0x834e('0x120')]=function(_0x1debf7){var _0x3a1328=this;var _0x10971d=this[_0x834e('0x43')][_0x1debf7['actionid']];if(_0x10971d){if(_0x10971d[_0x834e('0x121')]&&this[_0x834e('0x17')][_0x10971d[_0x834e('0x121')]]){ut[_0x834e('0x122')](_0x10971d,this[_0x834e('0x17')][_0x10971d['lookAgent']]['name'],this[_0x834e('0x17')][_0x10971d[_0x834e('0x121')]]['id']);}var _0x13d670=_['clone'](_0x10971d);_0x13d670[_0x834e('0x123')]=moment()[_0x834e('0x60')](_0x834e('0x61'));var _0x386b73=_0x3a1328['campaignsPreview'][_0x10971d[_0x834e('0x44')]];if(ut[_0x834e('0x124')](_0x1debf7['response'])){if(_0x10971d[_0x834e('0x8a')]){rpcDb[_0x834e('0xfb')](_0x10971d[_0x834e('0x8c')]);}if(_0x10971d[_0x834e('0x8b')]){rpcDb['disableContact'](_0x10971d[_0x834e('0x8c')]);}ami['emit'](_0x834e('0x125'),ut[_0x834e('0x7a')](_0x10971d,_0x834e('0x126'),this[_0x834e('0x15')][_0x10971d[_0x834e('0x44')]]));this[_0x834e('0xd5')](_0x13d670,_0x386b73,_0x1debf7);}else{_0x10971d['starttime']=moment()['format'](_0x834e('0x61'));ut[_0x834e('0xd8')](_0x13d670,0x4,'Answer');rpcDb[_0x834e('0xd9')](_0x13d670,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x834e('0x10')][_0x834e('0x127')]=function(_0x319d6c){var _0x151b58=this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]];var _0x36836f;if(_0x151b58){_0x36836f=this['campaignsPreview'][_0x151b58[_0x834e('0x44')]];logger[_0x834e('0x25')](_0x834e('0x128'),_0x319d6c[_0x834e('0xa2')],_0x834e('0xa1'),_0x36836f['name'],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);}if(this[_0x834e('0x43')][_0x319d6c['linkedid']]&&_0x319d6c['linkedid']!==_0x319d6c['uniqueid']){if(_0x319d6c[_0x834e('0x129')]==='16'&&this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){this[_0x834e('0x75')](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')]);}else if(this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){logger[_0x834e('0x25')]('[syncHangup][talking][cause]',_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')],_0x834e('0xa1'),_0x36836f[_0x834e('0x28')],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);this[_0x834e('0x75')](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c['cause']);}}else if(_0x151b58&&_[_0x834e('0x54')](_0x151b58[_0x834e('0x12a')])&&_0x36836f['dialQueueProject']&&_0x319d6c[_0x834e('0xa2')]===_0x319d6c[_0x834e('0x91')]&&_[_0x834e('0x54')](_0x319d6c[_0x834e('0xd7')])&&_0x319d6c['cause']==='16'&&_0x319d6c['channelstate']==='6'&&_[_0x834e('0x12b')](_0x151b58['transfer'])){if(_0x151b58[_0x834e('0x8a')]){rpcDb[_0x834e('0xfb')](_0x151b58[_0x834e('0x8c')]);}if(_0x151b58[_0x834e('0x8b')]){rpcDb[_0x834e('0x5e')](_0x151b58['idContact']);}_0x319d6c[_0x834e('0xd7')]='22';this['callProgressDetectingAgent'](_0x151b58,_0x36836f,_0x319d6c);}else if(_0x151b58&&_0x151b58['transfer']){if(_0x319d6c[_0x834e('0x129')]==='16'&&this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){logger[_0x834e('0x25')](_0x834e('0x12c'),_0x319d6c['linkedid'],_0x319d6c[_0x834e('0x129')],_0x834e('0xa1'),_0x36836f['name'],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);this['callProgressDetectingCustomer'](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')]);}else if(this['actions'][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){logger[_0x834e('0x25')](_0x834e('0x12d'),_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')],_0x834e('0xa1'),_0x36836f[_0x834e('0x28')],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);this['callProgressDetectingCustomer'](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')]);}}};Preview[_0x834e('0x10')][_0x834e('0x1d')]=function(_0x371767){if(this[_0x834e('0x43')][_0x371767[_0x834e('0xd3')]]&&_0x371767[_0x834e('0xd3')]!==_0x371767[_0x834e('0x12e')]){this[_0x834e('0x75')](_0x371767,_0x371767[_0x834e('0xd3')],_0x371767[_0x834e('0xcb')]);}};Preview['prototype'][_0x834e('0x1c')]=function(_0x1cd122){if(this['actions'][_0x1cd122['linkedid']]&&_0x1cd122['linkedid']!==_0x1cd122[_0x834e('0x91')]&&!this[_0x834e('0x43')][_0x1cd122[_0x834e('0xa2')]][_0x834e('0x47')]){if(_0x1cd122[_0x834e('0x129')]==='1'){this[_0x834e('0x75')](_0x1cd122,_0x1cd122[_0x834e('0xa2')],_0x1cd122['cause']);}}};Preview['prototype']['addVariable']=function(_0x47947b,_0x684a97,_0x3c8fc2){if(this[_0x834e('0x43')][_0x47947b]){if(_['isNil'](this['actions'][_0x47947b]['variables'])){this[_0x834e('0x43')][_0x47947b]['variables']={};}this['actions'][_0x47947b][_0x834e('0x11c')][_0x684a97]=_0x3c8fc2;}};Preview[_0x834e('0x10')][_0x834e('0x20')]=function(_0x1acdbd){try{if(!_[_0x834e('0x54')](_0x1acdbd)){if(ut[_0x834e('0x12f')](_[_0x834e('0x130')](_0x1acdbd['variable'])[0x0])){this[_0x834e('0x131')](_0x1acdbd[_0x834e('0x91')],_[_0x834e('0x130')](_0x1acdbd[_0x834e('0x132')])[0x0],_0x1acdbd[_0x834e('0x133')]);}}}catch(_0x488f82){logger[_0x834e('0x134')]('[syncVarSet][Preview]',util[_0x834e('0x135')](_0x488f82,{'showHidden':![],'depth':null}));}};Preview[_0x834e('0x10')][_0x834e('0x22')]=function(_0x57714a){if(_0x57714a){if(this['actions'][_0x57714a['transfertargetlinkedid']]){this['actions'][_0x57714a[_0x834e('0x136')]][_0x834e('0x137')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x20d61c){if(_0x20d61c){if(this[_0x834e('0x43')][_0x20d61c[_0x834e('0x138')]]){this['actions'][_0x20d61c[_0x834e('0x138')]][_0x834e('0x137')]=!![];}}};module[_0x834e('0x139')]=Preview; \ No newline at end of file +var _0xb43b=['custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','logAgent','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','called','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','isTrunkReachable','active','trunks','SIP/%s','reachable','execRun','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','phone','substring','TrunkBackup','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','agents','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./action','../dialer/utils','redis','defaults','localhost','prototype','tail','finally','campaignsPreview','voiceQueues','actions','clockClearZombieChannels','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncAttendedTransfer','loopCampaigns','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','name','\x20is\x20deactivated','syncCampaigns','dialMethod','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','countglobal','Busy','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusy]','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus'];(function(_0x293bbb,_0x258282){var _0xdc5c6b=function(_0xfd0fe4){while(--_0xfd0fe4){_0x293bbb['push'](_0x293bbb['shift']());}};_0xdc5c6b(++_0x258282);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5d6c8e,_0x45db92){_0x5d6c8e=_0x5d6c8e-0x0;var _0x57f3ea=_0xb43b[_0x5d6c8e];return _0x57f3ea;};'use strict';var util=require(_0xbb43('0x0'));var _=require(_0xbb43('0x1'));var uuid=require('uuid');var moment=require(_0xbb43('0x2'));var Redis=require(_0xbb43('0x3'));var config=require(_0xbb43('0x4'));var logger=require('../../../config/logger')(_0xbb43('0x5'));var loggerAction=require(_0xbb43('0x6'))(_0xbb43('0x7'));var ami=require(_0xbb43('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xbb43('0x9'));var ut=require('./util/util');var utils=require(_0xbb43('0xa'));config[_0xbb43('0xb')]=_[_0xbb43('0xc')](config[_0xbb43('0xb')],{'host':_0xbb43('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb43('0xb')]));var Sequence=function(){};Sequence[_0xbb43('0xe')]['enqueue']=function(_0x7e0fc2){this[_0xbb43('0xf')]=this[_0xbb43('0xf')]?this[_0xbb43('0xf')][_0xbb43('0x10')](_0x7e0fc2):_0x7e0fc2();};function Preview(_0x2bef86){this['sequence']=new Sequence();this[_0xbb43('0x11')]=_0x2bef86[_0xbb43('0x12')];this['trunks']=_0x2bef86['trunks'];this[_0xbb43('0x13')]={};this['agents']=_0x2bef86['agents'];this[_0xbb43('0x14')]=0x0;ami['on']('originateresponse',this[_0xbb43('0x15')][_0xbb43('0x16')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xbb43('0x17'),this[_0xbb43('0x18')]['bind'](this));ami['on']('dialend',this[_0xbb43('0x19')]['bind'](this));ami['on']('newexten',this[_0xbb43('0x1a')][_0xbb43('0x16')](this));ami['on'](_0xbb43('0x1b'),this['syncVarSet'][_0xbb43('0x16')](this));ami['on']('attendedtransfer',this[_0xbb43('0x1c')][_0xbb43('0x16')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xbb43('0x16')](this));this[_0xbb43('0x1d')](this[_0xbb43('0x11')]);}function emit(_0x2bf2d4,_0x5bcce7,_0x40a650){io['to'](_0x2bf2d4)['emit'](_0x5bcce7,_0x40a650);}function emitVoiceQueueChannelRemove(_0x3a257d){logger['info'](_0xbb43('0x1e'),JSON['stringify'](_0x3a257d));emit(util[_0xbb43('0x1f')](_0xbb43('0x20'),_0x3a257d['name']),_0xbb43('0x21'),_0x3a257d);io['emit'](_0xbb43('0x22'),_0x3a257d);}function notSendMessagesQueue(_0x298ce2){if(_0x298ce2[_0xbb43('0x23')]){if(_0x298ce2['originated']===0x0&&_0x298ce2['pTalking']===0x0){_0x298ce2['sendMessageOneNotActive']=![];_0x298ce2[_0xbb43('0x24')]=0x0;_0x298ce2[_0xbb43('0x25')]=0x0;_0x298ce2['message']=utils[_0xbb43('0x26')][_0xbb43('0x27')];ut[_0xbb43('0x28')](_0xbb43('0x29'),_0x298ce2['name']+'\x20is\x20not\x20active');}else{_0x298ce2[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x2b')];ut[_0xbb43('0x28')](_0xbb43('0x29'),_0x298ce2[_0xbb43('0x2c')]+_0xbb43('0x2d'));}}}Preview[_0xbb43('0xe')]['loopCampaigns']=function(){var _0x2ad6da=this;setInterval(function(){_0x2ad6da['syncCampaigns']();},0x7cf);};Preview[_0xbb43('0xe')][_0xbb43('0x2e')]=function(){var _0x34f5b2=this[_0xbb43('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0x157d62 in _0x34f5b2){if(_0x34f5b2['hasOwnProperty'](_0x157d62)&&(_0x34f5b2[_0x157d62]['dialMethod']==='preview'||_0x34f5b2[_0x157d62][_0xbb43('0x2f')]==='booked')&&_0x34f5b2[_0x157d62][_0xbb43('0x30')]===_0xbb43('0x31')){if(this[_0xbb43('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xbb43('0x32')]();}}if(_0x34f5b2[_0xbb43('0x33')](_0x157d62)&&_0x34f5b2[_0x157d62][_0xbb43('0x2f')]===_0xbb43('0x5')&&_0x34f5b2[_0x157d62][_0xbb43('0x30')]===_0xbb43('0x31')){if(_0x34f5b2[_0x157d62][_0xbb43('0x34')]){this[_0xbb43('0x35')](_0x34f5b2[_0x157d62]);if(_0x34f5b2[_0x157d62]['dialPreviewAutoRecallMe'])this[_0xbb43('0x36')](_0x34f5b2[_0x157d62]);}else{notSendMessagesQueue(_0x34f5b2[_0x157d62]);}}}};Preview[_0xbb43('0xe')][_0xbb43('0x37')]=function(_0x244d66){var _0x4015ec=this;this[_0xbb43('0x38')][_0xbb43('0x39')](function(){if(!_[_0xbb43('0x3a')](_0x4015ec[_0xbb43('0x13')][_0x244d66])){loggerAction[_0xbb43('0x3b')](_0xbb43('0x3c'),_0x244d66,_0xbb43('0x3d'),_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')],_0xbb43('0x3f'),JSON[_0xbb43('0x40')](_0x4015ec['campaignsPreview'][_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]]['originated']),_0xbb43('0x41'),JSON[_0xbb43('0x40')](_0x4015ec[_0xbb43('0x11')][_0x4015ec['actions'][_0x244d66]['queue']]['pTalking']),JSON[_0xbb43('0x40')](_0x4015ec[_0xbb43('0x13')][_0x244d66]['dialAnswer']),JSON['stringify'](_[_0xbb43('0x42')](_0x4015ec[_0xbb43('0x13')][_0x244d66],[_0xbb43('0x43'),_0xbb43('0x44'),_0xbb43('0x45'),'ListId'])));return ami[_0xbb43('0x46')]({'action':_0xbb43('0x47'),'channel':_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x48')]})[_0xbb43('0x49')](function(_0x531d96){if(_0x531d96[_0xbb43('0x2a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4015ec[_0xbb43('0x13')][_0x244d66]){ut[_0xbb43('0x4a')](_0x4015ec['campaignsPreview'][_0x4015ec[_0xbb43('0x13')][_0x244d66]['queue']],_0xbb43('0x4b'));if(_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x4c')]===!![]){ut[_0xbb43('0x4d')](_0x4015ec['campaignsPreview'][_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]],'[clearZombieChannel]');ut[_0xbb43('0x4e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x244d66,_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]);}ut[_0xbb43('0x4e')](_0xbb43('0x4f')+_0x244d66,_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]);delete _0x4015ec['actions'][_0x244d66];}},0x2328);}});}});};Preview[_0xbb43('0xe')]['clearZombieChannels']=function(){var _0x307f1e=this;loggerAction[_0xbb43('0x3b')](_0xbb43('0x50'),_[_0xbb43('0x51')](this['actions']));for(var _0x4622ea in this[_0xbb43('0x13')]){if(_0x307f1e[_0xbb43('0x13')][_0xbb43('0x33')](_0x4622ea)){_0x307f1e[_0xbb43('0x37')](_0x4622ea);}}};Preview[_0xbb43('0xe')][_0xbb43('0x36')]=function(_0x3592fb){var _0x5a662b=this;rpcDb[_0xbb43('0x52')](_0x3592fb['id'],ut[_0xbb43('0x53')](this['agents']))[_0xbb43('0x54')](function(_0x5d4c19){if(!_['isNil'](_0x5d4c19)){for(var _0x4d7034=0x0;_0x4d7034<_0x5d4c19['length'];_0x4d7034+=0x1){if(ut[_0xbb43('0x55')](_0x5d4c19[_0x4d7034]['scheduledat'])<_0x3592fb[_0xbb43('0x56')]*0x3c){if(_0x5d4c19[_0x4d7034]['Agent']&&!_0x5d4c19[_0x4d7034][_0xbb43('0x57')][_0xbb43('0x58')]){_0x5a662b[_0xbb43('0x59')](_0x5d4c19[_0x4d7034]['id'])['then'](ut[_0xbb43('0x5a')]('[RecallMe]'))[_0xbb43('0x49')](ut[_0xbb43('0x5a')](_0xbb43('0x5b')));}else{rpcDb[_0xbb43('0x5c')](_0x5d4c19[_0x4d7034]['id']);}}else{var _0x417ad9=new Action(_0x5d4c19[_0x4d7034],_0x3592fb);_0x417ad9[_0xbb43('0x5d')]=moment()[_0xbb43('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3592fb[_0xbb43('0x5e')]+=0x1;ut[_0xbb43('0x5f')](_0x417ad9,0x17,_0xbb43('0x60'));if(_0x3592fb[_0xbb43('0x61')]){rpcDb['rescheduleContactInQueue'](ut[_0xbb43('0x62')](_0x5d4c19[_0x4d7034]));rpcDb[_0xbb43('0x63')](_0x417ad9,_0xbb43('0x64'));}else{ut[_0xbb43('0x5f')](_0x417ad9,0x16,'RecallFailedTimeout');rpcDb[_0xbb43('0x63')](_0x417ad9,_0xbb43('0x65'));rpcDb[_0xbb43('0x66')](_0x417ad9,'[HistoryRecallClose]');}}}}})[_0xbb43('0x49')](ut[_0xbb43('0x5a')](_0xbb43('0x67')));};Preview[_0xbb43('0xe')][_0xbb43('0x35')]=function(_0x59c805){_0x59c805['sendMessageOneNotActive']=!![];if(ut[_0xbb43('0x68')](_0x59c805['loggedIn'])){_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xbb43('0x69')](_0x59c805[_0xbb43('0x34')])){_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x27')];}else if(!this['isTrunkReachable'](_0x59c805[_0xbb43('0x6a')])){if(!this['isTrunkReachable'](_0x59c805['TrunkBackup'])){_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x6b')];}else{_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')]['ACTIVE'];}}else{_0x59c805['message']=utils[_0xbb43('0x26')][_0xbb43('0x6c')];}};Preview[_0xbb43('0xe')][_0xbb43('0x6d')]=function(_0x99cb09,_0x38d540,_0x44691b){var _0x14fce0=this;var _0x1a3f98=this['actions'][_0x38d540];var _0x1b6f96=this[_0xbb43('0x11')][_0x1a3f98[_0xbb43('0x3e')]];var _0x3675d9;var _0x22bceb=![];var _0x1fae27=0x2;var _0x3f7262=0x3;if(_0x1b6f96){switch(_0x44691b){case'1':_0x1b6f96[_0xbb43('0x6e')]+=0x1;_0x1a3f98[_0xbb43('0x6f')]+=0x1;_0x1a3f98['countglobal']=ut['totalGlobal'](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x0,_0xbb43('0x70'));ami[_0xbb43('0x71')](_0xbb43('0x72'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0x74')));rpcDb[_0xbb43('0x63')](_0x1a3f98,'[callProgressDetectingCustomer][logNoSuch]');_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'0',_0x1b6f96)['then'](function(_0x5a6ff0){_0x22bceb=_0x5a6ff0[_0xbb43('0x76')]==0x1;_0x1fae27=_0x1b6f96[_0xbb43('0x77')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x1a3f98['countnosuchnumberretry']>=_0x1b6f96[_0xbb43('0x7d')]){rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0x7e'));}else{rpcDb[_0xbb43('0x7f')](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0x6f'),_0x1b6f96[_0xbb43('0x77')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98[_0xbb43('0x82')]);}}delete this['actions'][_0x99cb09[_0xbb43('0x83')]];}else{_0x1a3f98[_0xbb43('0x6f')]++;logger[_0xbb43('0x3b')](_0xbb43('0x84'),_0x1a3f98[_0xbb43('0x6f')]);logger[_0xbb43('0x3b')]('id',_0x1a3f98['idContact']);_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnosuchnumberretry':_0x1a3f98[_0xbb43('0x6f')]}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case _0xbb43('0x88'):var _0x6f04b3=moment()[_0xbb43('0x1f')](_0xbb43('0x89'));_0x1a3f98[_0xbb43('0x8a')]=_0x6f04b3;_0x1a3f98[_0xbb43('0x8b')]=_0x6f04b3;_0x1a3f98[_0xbb43('0x4c')]=!![];_0x1b6f96[_0xbb43('0x8c')]+=0x1;logger[_0xbb43('0x3b')](_0xbb43('0x8d'),_0x1a3f98['uniqueid'],_0xbb43('0x8e'),_0x1b6f96['name'],_0xbb43('0x41'),_0x1b6f96[_0xbb43('0x8c')]);ami[_0xbb43('0x71')](_0xbb43('0x8f'),ut[_0xbb43('0x73')](_0x1a3f98,'connect',this['campaignsPreview'][_0x1a3f98[_0xbb43('0x3e')]]));if(_0x1b6f96[_0xbb43('0x90')]){ami['emit'](_0xbb43('0x91'),ut[_0xbb43('0x92')](_0x1a3f98));}break;case'16':ami[_0xbb43('0x71')](_0xbb43('0x93'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0x94'),this[_0xbb43('0x11')][_0x1a3f98[_0xbb43('0x3e')]]));emitVoiceQueueChannelRemove(ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0x94')));_0x1b6f96[_0xbb43('0x95')]+=0x1;_0x1b6f96[_0xbb43('0x96')]+=0x1;_0x1b6f96[_0xbb43('0x97')]+=0x1;ut[_0xbb43('0x4d')](_0x1b6f96,'[16]');_0x1a3f98['countglobal']=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x4,_0xbb43('0x98'));rpcDb['createCustomerHistory'](_0x1a3f98,_0xbb43('0x99'));rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0x9a'));rpcDb[_0xbb43('0x9b')](_0x1a3f98);_0x1b6f96[_0xbb43('0x9c')]+=_0x1a3f98['talktime'];_0x1b6f96[_0xbb43('0x9d')]+=_0x1a3f98[_0xbb43('0x9e')];logger[_0xbb43('0x3b')]('[syncHangup][talking][decrement]',_0x1a3f98[_0xbb43('0x9f')],_0xbb43('0x8e'),_0x1b6f96[_0xbb43('0x2c')],_0xbb43('0x41'),_0x1b6f96[_0xbb43('0x8c')]);delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0x83')]];break;case _0xbb43('0xa0'):_0x1b6f96[_0xbb43('0xa1')]+=0x1;_0x1a3f98[_0xbb43('0xa2')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut['totalGlobal'](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x5,_0xbb43('0xa4'));_0x1fae27=_0x1b6f96[_0xbb43('0xa5')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];ami[_0xbb43('0x71')]('custom:agentbusy',ut['buildObj'](_0x1a3f98,'busy'));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xa6'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'5',_0x1b6f96)[_0xbb43('0x54')](function(_0x8d5a8d){_0x22bceb=_0x8d5a8d[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96['dialGlobalMaxRetry']){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x1a3f98[_0xbb43('0xa2')]>=_0x1b6f96['dialBusyMaxRetry']){rpcDb[_0xbb43('0x66')](_0x1a3f98,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xbb43('0x7f')](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0xa2'),_0x1b6f96[_0xbb43('0xa5')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98[_0xbb43('0x82')]);}}}else{_0x1a3f98[_0xbb43('0xa2')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98['idContact'],'field':{'countbusyretry':_0x1a3f98[_0xbb43('0xa2')]}})[_0xbb43('0x54')](function(){_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)[_0xbb43('0x54')](function(){});});}});break;case _0xbb43('0xa7'):_0x1b6f96[_0xbb43('0xa8')]+=0x1;_0x1a3f98['countnoanswerretry']+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x3,_0xbb43('0xa9'));_0x1fae27=_0x1b6f96[_0xbb43('0xaa')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];var _0x4f356d=ut[_0xbb43('0xab')](_0x1a3f98,_0x1b6f96);ami['emit'](_0xbb43('0xac'),_0x4f356d);rpcDb[_0xbb43('0x63')](_0x1a3f98,'[callProgressDetectingCustomer][logNoAnswer]');_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'3',_0x1b6f96)[_0xbb43('0x54')](function(_0x4d9668){_0x22bceb=_0x4d9668['additional']==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xad'));}else{if(_0x1a3f98[_0xbb43('0xae')]>=_0x1b6f96[_0xbb43('0xaf')]){rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0xb0'));}else{rpcDb['rescheduleContact'](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0xae'),_0x1b6f96[_0xbb43('0xaa')]),_0x1a3f98['unlockAgent'],_0x1a3f98['activeContact']);}}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98[_0xbb43('0xae')]}})['then'](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case _0xbb43('0xb1'):_0x1b6f96[_0xbb43('0xb2')]+=0x1;_0x1a3f98[_0xbb43('0xb3')]+=0x1;_0x1a3f98['countglobal']=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x8,'Congestion');_0x1fae27=_0x1b6f96['dialCongestionRetryFrequency'];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];ami[_0xbb43('0x71')](_0xbb43('0xb4'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0xb5')));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xb6'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'8',_0x1b6f96)['then'](function(_0xaa42f9){_0x22bceb=_0xaa42f9[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut['cloneAction'](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb['createCustomerFinal'](_0x3675d9,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1a3f98[_0xbb43('0xb3')]>=_0x1b6f96[_0xbb43('0xb7')]){rpcDb[_0xbb43('0x66')](_0x1a3f98,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1a3f98,_0xbb43('0xb3'),_0x1b6f96[_0xbb43('0xa5')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98[_0xbb43('0x82')]);}}}else{_0x1a3f98[_0xbb43('0xb3')]++;_0x14fce0['incrementPreviewCounters']({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countcongestionretry':_0x1a3f98['countcongestionretry']}})[_0xbb43('0x54')](function(){_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case'CANCEL':_0x1b6f96[_0xbb43('0xb8')]+=0x1;_0x1a3f98[_0xbb43('0xb9')]+=0x1;_0x1a3f98['countglobal']=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x14,_0xbb43('0xba'));_0x1fae27=_0x1b6f96[_0xbb43('0xbb')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];ami[_0xbb43('0x71')](_0xbb43('0xbc'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0xbd')));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xbe'));_0x14fce0['verifyAdditionalPhones'](_0x1a3f98,'20',_0x1b6f96)[_0xbb43('0x54')](function(_0x5bbbf4){_0x22bceb=_0x5bbbf4[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0x14,_0xbb43('0xba'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xbf'));}else{if(_0x1a3f98[_0xbb43('0xb9')]>=_0x1b6f96[_0xbb43('0xc0')]){rpcDb['createCustomerFinal'](_0x1a3f98,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xbb43('0x7f')](ut[_0xbb43('0x80')](_0x1a3f98,'countagentrejectretry',_0x1b6f96[_0xbb43('0xbb')]),_0x1a3f98['unlockAgent'],_0x1a3f98[_0xbb43('0x82')]);}}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98[_0xbb43('0xae')]}})[_0xbb43('0x54')](function(){_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)[_0xbb43('0x54')](function(){});});}});break;case _0xbb43('0xc1'):_0x1b6f96[_0xbb43('0xc2')]+=0x1;_0x1a3f98[_0xbb43('0xc3')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0xb,_0xbb43('0xc4'));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xc5'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'11',_0x1b6f96)[_0xbb43('0x54')](function(_0x14cd97){_0x22bceb=_0x14cd97[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96['dialGlobalMaxRetry']){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb['createCustomerFinal'](_0x3675d9,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1a3f98[_0xbb43('0xc6')]>=_0x1b6f96['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x1a3f98,_0xbb43('0xc5'));}else{rpcDb['rescheduleContact'](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0xc3'),_0x1b6f96[_0xbb43('0xc7')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98['activeContact']);}}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98['countnoanswerretry']}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case'18':_0x1b6f96[_0xbb43('0xc8')]+=0x1;_0x1a3f98[_0xbb43('0xc9')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x12,_0x99cb09[_0xbb43('0xca')]||_0x99cb09[_0xbb43('0xcb')]);ami[_0xbb43('0x71')](_0xbb43('0xcc'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0xcd')));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xce'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'18',_0x1b6f96)['then'](function(_0x1f5a0a){_0x22bceb=_0x1f5a0a[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut['cloneAction'](_0x1a3f98,0x12,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xce'));}else{rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0xce'));}}else{_0x1a3f98['countnoanswerretry']++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98['countnoanswerretry']}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0x83')]];break;case'19':_0x1b6f96[_0xbb43('0xc8')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut['logCustomer'](_0x1a3f98,0x13,_0x99cb09[_0xbb43('0xca')]||_0x99cb09[_0xbb43('0xcb')]);ami[_0xbb43('0x71')](_0xbb43('0xcc'),ut[_0xbb43('0x73')](_0x1a3f98,'amd'));rpcDb[_0xbb43('0x63')](_0x1a3f98,'[callProgressDetectingCustomer][machine]');_0x14fce0['verifyAdditionalPhones'](_0x1a3f98,'18',_0x1b6f96)[_0xbb43('0x54')](function(_0x54fd3b){_0x22bceb=_0x54fd3b[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,'Global');rpcDb['createCustomerFinal'](_0x3675d9,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0xcf'));}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98[_0xbb43('0xae')]}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});delete this[_0xbb43('0x13')][_0x99cb09['linkedid']];break;default:if(_0x1a3f98[_0xbb43('0x4c')]){ut[_0xbb43('0x4d')](_0x1b6f96,_0xbb43('0xd0'));ut[_0xbb43('0x4e')](_0xbb43('0xd1')+_0x1b6f96[_0xbb43('0x2c')],_0x99cb09);}_0x1b6f96[_0xbb43('0xc8')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut['logCustomer'](_0x1a3f98,0xc,_0x99cb09[_0xbb43('0xca')]||_0x99cb09[_0xbb43('0xcb')]);_0x1fae27=_0x1b6f96[_0xbb43('0xbb')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xd2'));_0x14fce0['verifyAdditionalPhones'](_0x1a3f98,'20',_0x1b6f96)[_0xbb43('0x54')](function(_0x2965ec){_0x22bceb=_0x2965ec[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xd3'));}else{rpcDb['createCustomerFinal'](_0x1a3f98,_0xbb43('0xd3'));}delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0x83')]];}else{_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)[_0xbb43('0x54')](function(){});}});}if(!(_0x1a3f98['dialAnswer']&&_0x44691b==='16')){ut['updateOriginated'](_0x1b6f96,_0xbb43('0xd4'));logger[_0xbb43('0x3b')]('[originated][decrement][callProgressDetectingCustomer]',_0x1a3f98[_0xbb43('0x9f')],'\x20Queue',_0x1b6f96[_0xbb43('0x2c')],_0xbb43('0x3f'),_0x1b6f96[_0xbb43('0xd5')]);}if(_0x44691b!=='ANSWER'){delete this['actions'][_0x99cb09['linkedid']];delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0xd6')]];}_0x1b6f96[_0xbb43('0xd7')]=!![];}};Preview[_0xbb43('0xe')][_0xbb43('0xd8')]=function(_0x53b9ee,_0xb54a91,_0x7271d0){if(_[_0xbb43('0xd9')](_0xb54a91)&&_0xbb43('0xda')!==typeof _0xb54a91){return;}if(_[_0xbb43('0xd9')](_0x7271d0)&&_0xbb43('0xda')!==typeof _0x7271d0){return;}switch(_0x7271d0['reason']){case'0':ut['logAgent'](_0x53b9ee,0x0,_0xbb43('0x70'));rpcDb[_0xbb43('0xdb')](_0x53b9ee,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x53b9ee,0x3,_0xbb43('0xa9'));rpcDb['createAgentHistory'](_0x53b9ee,_0xbb43('0xdc'));break;case'5':ut[_0xbb43('0xdd')](_0x53b9ee,0x5,_0xbb43('0xa4'));rpcDb[_0xbb43('0xdb')](_0x53b9ee,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xbb43('0xdd')](_0x53b9ee,0x8,_0xbb43('0xde'));rpcDb[_0xbb43('0xdb')](_0x53b9ee,_0xbb43('0xdf'));break;case'22':ut[_0xbb43('0xdd')](_0x53b9ee,0x16,_0xbb43('0xe0'));rpcDb['createAgentHistory'](_0x53b9ee,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xbb43('0xdd')](_0x53b9ee,0xc,_0x7271d0[_0xbb43('0xe1')]);rpcDb[_0xbb43('0xdb')](_0x53b9ee,_0xbb43('0xdf'));}ut[_0xbb43('0x4a')](_0xb54a91,'[callProgressDetectingAgent]');logger['info'](_0xbb43('0xe2'),_0x53b9ee[_0xbb43('0x9f')],_0xbb43('0x8e'),_0xb54a91['name'],_0xbb43('0x3f'),_0xb54a91[_0xbb43('0xd5')]);delete this[_0xbb43('0x13')][_0x53b9ee['uniqueid']];};Preview[_0xbb43('0xe')]['verifyAdditionalPhones']=function(_0x2719ce,_0x235409,_0x3386bc){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2719ce,_0x235409,_0x3386bc)[_0xbb43('0x49')](logger[_0xbb43('0x3b')](_0xbb43('0xe3')));};Preview[_0xbb43('0xe')][_0xbb43('0x87')]=function(_0x34e8b8,_0x339b30,_0x4122e7){return cmHopperAdditionalPhone[_0xbb43('0x87')](_0x34e8b8,_0x339b30,_0x4122e7)[_0xbb43('0x49')](logger[_0xbb43('0x3b')](_0xbb43('0xe4')));};Preview[_0xbb43('0xe')][_0xbb43('0x85')]=function(_0x5e2afe){return Promise[_0xbb43('0xe5')]()[_0xbb43('0x54')](cmHopperAdditionalPhone[_0xbb43('0x85')](_0x5e2afe))[_0xbb43('0x49')](logger[_0xbb43('0x3b')](_0xbb43('0xe6')));};Preview[_0xbb43('0xe')][_0xbb43('0xe7')]=function(_0x1f8f78,_0x3a05be,_0x2dd161,_0x2d2127,_0x3c537a){var _0x36af9a=this;return new Promise(function(_0x199b58,_0x357e45){if(_[_0xbb43('0x3a')](_0x3a05be)||_['isNil'](_0x3a05be[_0xbb43('0xe8')])||_['isNil'](_0x3a05be['phone'])||_[_0xbb43('0x3a')](_0x3a05be[_0xbb43('0x45')])){_0x357e45(ut['message']('Contact\x20is\x20undefined',_0x2d2127,_0x3c537a));return;}var _0x3fce74=uuid['v4']();var _0x5911fc=_0x36af9a['campaignsPreview'][_0x3a05be[_0xbb43('0x3d')]['name']];var _0x41f3fe=_0x2dd161?_0x36af9a['agents'][_0x2dd161]['id']:undefined;_0x36af9a[_0xbb43('0x13')][_0x3fce74]=new Action(_0x3a05be,_0x5911fc,_0x3fce74,_0x2dd161,_0x41f3fe);var _0x5fdbcd=_0x36af9a['actions'][_0x3fce74];_0x5fdbcd[_0xbb43('0x81')]=_0x2d2127;_0x5fdbcd[_0xbb43('0x82')]=_0x3c537a;_0x5fdbcd[_0xbb43('0xe9')]=_0x2dd161;if(_[_0xbb43('0xea')](_0x1f8f78)){_0x36af9a[_0xbb43('0xeb')](_0x5fdbcd,_0x5911fc,_0x3a05be,_0x2dd161)['then'](function(_0x6b0dd){logger[_0xbb43('0x3b')](_0xbb43('0xec'),_0xbb43('0xed')+_0x5fdbcd[_0xbb43('0x3e')]+'\x20IdHopper:\x20'+_0x5fdbcd[_0xbb43('0x86')],JSON[_0xbb43('0x40')](_0x6b0dd));ami[_0xbb43('0x71')]('custom:agentcalled',ut['buildObj'](_0x5fdbcd,_0xbb43('0xee'),_0x36af9a[_0xbb43('0x11')][_0x5fdbcd[_0xbb43('0x3e')]]));_0x199b58(ut['message']('Calling'));})[_0xbb43('0x49')](function(_0x1ab4c4){ut[_0xbb43('0x28')](_0xbb43('0xef'),_0x1ab4c4);_0x357e45(ut[_0xbb43('0x2a')]('Call\x20failed',_0x2d2127,_0x3c537a));});}else{_0x5911fc[_0xbb43('0xf0')]+=0x1;ut[_0xbb43('0xf1')](_0x5fdbcd);rpcDb[_0xbb43('0xf2')](_0x5fdbcd,_0xbb43('0xf3'));delete _0x36af9a[_0xbb43('0x13')][_0x3fce74];_0x357e45(ut[_0xbb43('0x2a')]('Contact\x20in\x20black\x20List',_0x2d2127,_0x3c537a));}});};Preview[_0xbb43('0xe')][_0xbb43('0xf4')]=function(_0x12f7a9){return!_['isNil'](_0x12f7a9)&&!_[_0xbb43('0x3a')](_0x12f7a9['name'])&&!_[_0xbb43('0x3a')](_0x12f7a9[_0xbb43('0xf5')])&&_0x12f7a9[_0xbb43('0xf5')]&&!_[_0xbb43('0x3a')](this['trunks'][util[_0xbb43('0x1f')]('SIP/%s',_0x12f7a9[_0xbb43('0x2c')])])&&!_[_0xbb43('0x3a')](this[_0xbb43('0xf6')][util[_0xbb43('0x1f')](_0xbb43('0xf7'),_0x12f7a9['name'])][_0xbb43('0x47')])&&(this[_0xbb43('0xf6')][util[_0xbb43('0x1f')](_0xbb43('0xf7'),_0x12f7a9[_0xbb43('0x2c')])]['status']===_0xbb43('0xf8')||this[_0xbb43('0xf6')][util[_0xbb43('0x1f')]('SIP/%s',_0x12f7a9[_0xbb43('0x2c')])]['status']==='unmonitored');};Preview['prototype']['run']=function(_0x44b3de,_0x5d7629){return this[_0xbb43('0xf9')](_0x44b3de,_0x5d7629)[_0xbb43('0x54')](function(_0x20be22){return _[_0xbb43('0x42')](_0x20be22,['message']);})[_0xbb43('0x49')](function(_0x12c97f){if(_0x12c97f['unlock']){rpcDb[_0xbb43('0xfa')](_0x44b3de);}if(_0x12c97f[_0xbb43('0xf5')]){rpcDb['disableContact'](_0x44b3de);}throw _['pick'](_0x12c97f,[_0xbb43('0x2a')]);});};Preview[_0xbb43('0xe')][_0xbb43('0xf9')]=function(_0x5d6ec2,_0x17065d){var _0x59fc4a=this;var _0x448d75,_0x33edab;return rpcDb[_0xbb43('0xfb')](_0x5d6ec2)[_0xbb43('0x54')](function(_0x55df31){if(!_[_0xbb43('0x3a')](_0x55df31[0x0])){_0x33edab=_0x55df31[0x0][_0xbb43('0xfc')]?![]:!![];_0x448d75=_0x55df31[0x0][_0xbb43('0xfc')]?!![]:![];_0x448d75=_0x17065d?!![]:_0x448d75;}var _0x7c7f55=_0x59fc4a[_0xbb43('0xfd')](_0x55df31);if(_0x7c7f55['isValid']){rpcDb[_0xbb43('0xfe')](_[_0xbb43('0x42')](_0x55df31[0x0],['VoiceQueueId','phone']))[_0xbb43('0x54')](function(_0x4d0023){_0x59fc4a[_0xbb43('0xe7')](_0x4d0023,_0x55df31[0x0],_0x17065d,_0x33edab,_0x448d75)[_0xbb43('0x54')](function(_0x36fddb){return _0x36fddb;})[_0xbb43('0x49')](function(_0x6bbd30){throw _0x6bbd30;});})[_0xbb43('0x49')](function(_0x21a044){ut[_0xbb43('0x28')](_0xbb43('0xff'),_0x21a044);throw ut[_0xbb43('0x2a')]('Call\x20unsuccessful',_0x33edab,_0x448d75);});}else{throw ut[_0xbb43('0x2a')](_0x7c7f55[_0xbb43('0x2a')],_0x33edab,_0x448d75);}})[_0xbb43('0x49')](function(_0x544418){ut[_0xbb43('0x28')](_0xbb43('0x100'),_0x544418);throw ut[_0xbb43('0x2a')](_0xbb43('0x101'),![],!![]);});};Preview[_0xbb43('0xe')]['validateContact']=function(_0x3f4ab7){if(_['isNil'](_0x3f4ab7)||_['isEmpty'](_0x3f4ab7)||!_['isNil'](_0x3f4ab7[0x0]['Agent'])&&_[_0xbb43('0x3a')](_0x3f4ab7[0x0][_0xbb43('0x57')][_0xbb43('0x2c')])){ut[_0xbb43('0x28')](_0xbb43('0x102'),_0x3f4ab7);return{'isValid':![],'message':_0xbb43('0x103')};}var _0x108e6d=this['campaignsPreview'][_0x3f4ab7[0x0][_0xbb43('0x3d')][_0xbb43('0x2c')]];_0x108e6d[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x6c')];if(_[_0xbb43('0x3a')](_0x108e6d)){ut[_0xbb43('0x28')](_0xbb43('0x104'),_0x108e6d);return{'isValid':![],'message':_0xbb43('0x105')};}if(!this[_0xbb43('0xf4')](_0x108e6d[_0xbb43('0x6a')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xbb43('0x106')+_0x108e6d[_0xbb43('0x2c')]+_0xbb43('0x107'));if(!this[_0xbb43('0xf4')](_0x108e6d['TrunkBackup'])){ut[_0xbb43('0x28')](_0xbb43('0x108'),_0x108e6d[_0xbb43('0x2c')]+_0xbb43('0x109'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x108e6d[_0xbb43('0x34')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x108e6d[_0xbb43('0x2c')]+_0xbb43('0x10a'));return{'isValid':![],'message':_0xbb43('0x106')+_0x108e6d[_0xbb43('0x2c')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xbb43('0x10b')};};Preview[_0xbb43('0xe')][_0xbb43('0xeb')]=function(_0x581645,_0x4e7cdb,_0x3eaada,_0x1c9c7f){var _0x1d5376=this;return new Promise(function(_0x2ba34c,_0x30e984){var _0x5d7a43=_0x581645[_0xbb43('0x9f')];var _0x540b8d=_0x1d5376[_0xbb43('0xf4')](_0x4e7cdb[_0xbb43('0x6a')])?util[_0xbb43('0x1f')](_0xbb43('0x10c'),_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x2c')],_['isNil'](_0x4e7cdb[_0xbb43('0x10d')])?'':_0x4e7cdb[_0xbb43('0x10d')]['trim']()||'',_0x4e7cdb[_0xbb43('0x10e')]>0x0?_0x3eaada[_0xbb43('0x10f')][_0xbb43('0x110')](_0x4e7cdb[_0xbb43('0x10e')]):_0x3eaada[_0xbb43('0x10f')]):util[_0xbb43('0x1f')](_0xbb43('0x10c'),_[_0xbb43('0x3a')](_0x4e7cdb['TrunkBackup'])?_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x2c')]:_0x4e7cdb[_0xbb43('0x111')][_0xbb43('0x2c')],_['isNil'](_0x4e7cdb[_0xbb43('0x10d')])?'':_0x4e7cdb[_0xbb43('0x10d')][_0xbb43('0x112')]()||'',_0x4e7cdb[_0xbb43('0x10e')]>0x0?_0x3eaada[_0xbb43('0x10f')][_0xbb43('0x110')](_0x4e7cdb[_0xbb43('0x10e')]):_0x3eaada[_0xbb43('0x10f')]);var _0x1f211d=_0x1d5376[_0xbb43('0xf4')](_0x4e7cdb['Trunk'])?ut[_0xbb43('0x113')](_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x114')],_0x4e7cdb['dialOriginateCallerIdName'],_0x4e7cdb[_0xbb43('0x115')]>0x0?ut[_0xbb43('0x116')](_0x4e7cdb[_0xbb43('0x117')],_0x4e7cdb[_0xbb43('0x115')]):_0x4e7cdb[_0xbb43('0x117')]):ut['getCallerId'](_[_0xbb43('0x3a')](_0x4e7cdb[_0xbb43('0x111')])?_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x114')]:_0x4e7cdb[_0xbb43('0x111')][_0xbb43('0x114')],_0x4e7cdb['dialOriginateCallerIdName'],_0x4e7cdb[_0xbb43('0x115')]>0x0?ut[_0xbb43('0x116')](_0x4e7cdb[_0xbb43('0x117')],_0x4e7cdb[_0xbb43('0x115')]):_0x4e7cdb[_0xbb43('0x117')]);if(_0x1f211d){_0x581645[_0xbb43('0x118')]=ut[_0xbb43('0x119')](_0x1f211d);_0x581645[_0xbb43('0x11a')]=ut[_0xbb43('0x11b')](_0x1f211d);}var _0x19260c=ut[_0xbb43('0x11c')](_0x4e7cdb,_0x3eaada,_0x540b8d,_0x1f211d,_0x5d7a43,_0x581645);_[_0xbb43('0x11d')](_0x581645,ut[_0xbb43('0x11e')](_0x19260c));_0x581645[_0xbb43('0x5d')]=moment()['format'](_0xbb43('0x89'));_0x4e7cdb[_0xbb43('0x11f')]=_0x19260c;var _0x1baf8c=ut[_0xbb43('0x120')](_0x581645,_0x4e7cdb,_0x19260c,_0x581645[_0xbb43('0x82')],_0x1c9c7f);return ami[_0xbb43('0x46')](_0x1baf8c)['then'](function(_0x4345e4){_0x4e7cdb[_0xbb43('0xd5')]+=0x1;logger[_0xbb43('0x3b')](_0xbb43('0x121'),_0x5d7a43,_0xbb43('0x8e'),_0x4e7cdb[_0xbb43('0x2c')],_0xbb43('0x3f'),_0x4e7cdb[_0xbb43('0xd5')]);_0x2ba34c(_0x4345e4);})[_0xbb43('0x49')](function(_0x510584){ut[_0xbb43('0xdd')](_0x581645,0xe,_0xbb43('0x122'));rpcDb[_0xbb43('0xdb')](_0x581645,_0xbb43('0x123'));_0x30e984(_0x510584);});});};Preview[_0xbb43('0xe')]['syncNewExten']=function(_0x26825d){if(this['actions'][_0x26825d['linkedid']]){this['actions'][_0x26825d[_0xbb43('0x83')]][_0xbb43('0x48')]=_0x26825d['channel'];}};Preview['prototype'][_0xbb43('0x15')]=function(_0x59d31f){var _0x400c6e=this;var _0x26c450=this[_0xbb43('0x13')][_0x59d31f[_0xbb43('0x124')]];if(_0x26c450){if(_0x26c450[_0xbb43('0xe9')]&&this['agents'][_0x26c450[_0xbb43('0xe9')]]){ut[_0xbb43('0x125')](_0x26c450,this[_0xbb43('0x126')][_0x26c450[_0xbb43('0xe9')]][_0xbb43('0x2c')],this[_0xbb43('0x126')][_0x26c450['lookAgent']]['id']);}var _0x756278=_[_0xbb43('0x127')](_0x26c450);_0x756278[_0xbb43('0x8a')]=moment()[_0xbb43('0x1f')](_0xbb43('0x89'));var _0x4cd83a=_0x400c6e[_0xbb43('0x11')][_0x26c450[_0xbb43('0x3e')]];if(ut[_0xbb43('0x128')](_0x59d31f[_0xbb43('0x129')])){if(_0x26c450[_0xbb43('0x81')]){rpcDb[_0xbb43('0xfa')](_0x26c450[_0xbb43('0x86')]);}if(_0x26c450[_0xbb43('0x82')]){rpcDb[_0xbb43('0x5c')](_0x26c450['idContact']);}ami[_0xbb43('0x71')](_0xbb43('0x12a'),ut[_0xbb43('0x73')](_0x26c450,_0xbb43('0x12b'),this[_0xbb43('0x11')][_0x26c450[_0xbb43('0x3e')]]));this[_0xbb43('0xd8')](_0x756278,_0x4cd83a,_0x59d31f);}else{_0x26c450['starttime']=moment()[_0xbb43('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xbb43('0xdd')](_0x756278,0x4,'Answer');rpcDb[_0xbb43('0xdb')](_0x756278,_0xbb43('0x12c'));}}};Preview[_0xbb43('0xe')][_0xbb43('0x12d')]=function(_0x31d75c){var _0x570d24=this['actions'][_0x31d75c['linkedid']];var _0x1d4d0b;if(_0x570d24){_0x1d4d0b=this[_0xbb43('0x11')][_0x570d24['queue']];logger['info'](_0xbb43('0x12e'),_0x31d75c[_0xbb43('0x83')],_0xbb43('0x8e'),_0x1d4d0b[_0xbb43('0x2c')],_0xbb43('0x41'),_0x1d4d0b['pTalking']);}if(this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]]&&_0x31d75c['linkedid']!==_0x31d75c['uniqueid']){if(_0x31d75c[_0xbb43('0x12f')]==='16'&&this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]]['dialAnswer']){this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c['linkedid'],_0x31d75c[_0xbb43('0x12f')]);}else if(this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]][_0xbb43('0x4c')]){logger[_0xbb43('0x3b')]('[syncHangup][talking][cause]',_0x31d75c[_0xbb43('0x83')],_0x31d75c[_0xbb43('0x12f')],_0xbb43('0x8e'),_0x1d4d0b[_0xbb43('0x2c')],_0xbb43('0x41'),_0x1d4d0b['pTalking']);this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c[_0xbb43('0x83')],_0x31d75c['cause']);}}else if(_0x570d24&&_['isNil'](_0x570d24[_0xbb43('0x130')])&&_0x1d4d0b[_0xbb43('0x131')]&&_0x31d75c['linkedid']===_0x31d75c['uniqueid']&&_[_0xbb43('0x3a')](_0x31d75c[_0xbb43('0xe1')])&&_0x31d75c[_0xbb43('0x12f')]==='16'&&_0x31d75c[_0xbb43('0x132')]==='6'&&_['isUndefined'](_0x570d24[_0xbb43('0x133')])){if(_0x570d24['unlockAgent']){rpcDb[_0xbb43('0xfa')](_0x570d24[_0xbb43('0x86')]);}if(_0x570d24[_0xbb43('0x82')]){rpcDb['disableContact'](_0x570d24[_0xbb43('0x86')]);}_0x31d75c[_0xbb43('0xe1')]='22';this[_0xbb43('0xd8')](_0x570d24,_0x1d4d0b,_0x31d75c);}else if(_0x570d24&&_0x570d24[_0xbb43('0x133')]){if(_0x31d75c[_0xbb43('0x12f')]==='16'&&this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]]['dialAnswer']){logger[_0xbb43('0x3b')]('[syncHangup][talking][transfer]',_0x31d75c[_0xbb43('0x83')],_0x31d75c[_0xbb43('0x12f')],_0xbb43('0x8e'),_0x1d4d0b[_0xbb43('0x2c')],'pTalking:\x20',_0x1d4d0b[_0xbb43('0x8c')]);this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c['linkedid'],_0x31d75c[_0xbb43('0x12f')]);}else if(this['actions'][_0x31d75c[_0xbb43('0x83')]][_0xbb43('0x4c')]){logger[_0xbb43('0x3b')]('[syncHangup][talking][cause]',_0x31d75c['linkedid'],_0x31d75c[_0xbb43('0x12f')],'\x20Queue',_0x1d4d0b[_0xbb43('0x2c')],'pTalking:\x20',_0x1d4d0b[_0xbb43('0x8c')]);this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c[_0xbb43('0x83')],_0x31d75c[_0xbb43('0x12f')]);}}};Preview[_0xbb43('0xe')][_0xbb43('0x19')]=function(_0xa1e9ba){if(this[_0xbb43('0x13')][_0xa1e9ba['destlinkedid']]&&_0xa1e9ba[_0xbb43('0xd6')]!==_0xa1e9ba[_0xbb43('0x134')]){this[_0xbb43('0x6d')](_0xa1e9ba,_0xa1e9ba[_0xbb43('0xd6')],_0xa1e9ba['dialstatus']);}};Preview[_0xbb43('0xe')][_0xbb43('0x18')]=function(_0x3178f7){if(this[_0xbb43('0x13')][_0x3178f7[_0xbb43('0x83')]]&&_0x3178f7[_0xbb43('0x83')]!==_0x3178f7['uniqueid']&&!this['actions'][_0x3178f7['linkedid']][_0xbb43('0x4c')]){if(_0x3178f7['cause']==='1'){this[_0xbb43('0x6d')](_0x3178f7,_0x3178f7[_0xbb43('0x83')],_0x3178f7['cause']);}}};Preview[_0xbb43('0xe')][_0xbb43('0x135')]=function(_0xea8659,_0x157391,_0x2b60f0){if(this['actions'][_0xea8659]){if(_[_0xbb43('0x3a')](this[_0xbb43('0x13')][_0xea8659]['variables'])){this['actions'][_0xea8659][_0xbb43('0x11f')]={};}this['actions'][_0xea8659][_0xbb43('0x11f')][_0x157391]=_0x2b60f0;}};Preview[_0xbb43('0xe')]['syncVarSet']=function(_0x18a8d3){try{if(!_[_0xbb43('0x3a')](_0x18a8d3)){if(ut['filterKey'](_[_0xbb43('0x136')](_0x18a8d3['variable'])[0x0])){this['addVariable'](_0x18a8d3['uniqueid'],_['keys'](_0x18a8d3[_0xbb43('0x137')])[0x0],_0x18a8d3[_0xbb43('0x138')]);}}}catch(_0x21ba01){logger[_0xbb43('0x139')](_0xbb43('0x13a'),util[_0xbb43('0x13b')](_0x21ba01,{'showHidden':![],'depth':null}));}};Preview[_0xbb43('0xe')][_0xbb43('0x1c')]=function(_0x53b812){if(_0x53b812){if(this[_0xbb43('0x13')][_0x53b812[_0xbb43('0x13c')]]){this[_0xbb43('0x13')][_0x53b812[_0xbb43('0x13c')]][_0xbb43('0x133')]=!![];}}};Preview[_0xbb43('0xe')]['syncBlindTransfer']=function(_0x47c884){if(_0x47c884){if(this[_0xbb43('0x13')][_0x47c884[_0xbb43('0x13d')]]){this[_0xbb43('0x13')][_0x47c884['transfererlinkedid']][_0xbb43('0x133')]=!![];}}};module[_0xbb43('0x13e')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 947c987..b85b18c 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 _0x51fd=['queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','resolve','createAgentHistory','createCustomerHistory','UserId','active','rescheduleContact','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete'];(function(_0x2a829f,_0x1b0c15){var _0x5737c3=function(_0x2376f9){while(--_0x2376f9){_0x2a829f['push'](_0x2a829f['shift']());}};_0x5737c3(++_0x1b0c15);}(_0x51fd,0x1c0));var _0xd51f=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x51fd[_0x255d5b];return _0x3e141a;};'use strict';var util=require('util');var BPromise=require(_0xd51f('0x0'));var logger=require(_0xd51f('0x1'))('preview');var cmHopper=require(_0xd51f('0x2'));var cmHopperHistory=require(_0xd51f('0x3'));var cmHopperBlack=require(_0xd51f('0x4'));var agentReportPreview=require(_0xd51f('0x5'));var voiceQueueReport=require(_0xd51f('0x6'));function loggerCatch(_0x1410d6){return function(_0x4d9a8e){logger[_0xd51f('0x7')](_0x1410d6,util[_0xd51f('0x8')](_0x4d9a8e,{'showHidden':![],'depth':null}));};}function create(_0x130d3b){return cmHopperHistory[_0xd51f('0x9')](_0x130d3b)[_0xd51f('0xa')](loggerCatch(_0xd51f('0xb')));}function createAgent(_0x5dddb0){return BPromise['resolve']()[_0xd51f('0xc')](agentReportPreview[_0xd51f('0x9')](_0x5dddb0))[_0xd51f('0xa')](loggerCatch(_0xd51f('0xb')));}function moveContact(_0x119a82){return cmHopper[_0xd51f('0xd')](_0x119a82,!![])[_0xd51f('0xa')](loggerCatch(_0xd51f('0xe')));}exports['checkIsBlackList']=function(_0x4878af){return cmHopperBlack['checkIsBlackList'](_0x4878af)[_0xd51f('0xa')](loggerCatch(_0xd51f('0xf')));};exports[_0xd51f('0x10')]=function(_0x1afb21){return BPromise[_0xd51f('0x11')]()['then'](cmHopper[_0xd51f('0x10')](_0x1afb21))[_0xd51f('0xa')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x1d1b03,_0x2481c2){create(_0x1d1b03)[_0xd51f('0xa')](loggerCatch(_0x2481c2));moveContact(_0x1d1b03)['catch'](loggerCatch(_0x2481c2));};exports[_0xd51f('0x12')]=function(_0x3f889a,_0x5a7bac){createAgent(_0x3f889a)[_0xd51f('0xa')](loggerCatch(_0x5a7bac));};exports[_0xd51f('0x13')]=function(_0x5948f8,_0x5c33c5){create(_0x5948f8)[_0xd51f('0xa')](loggerCatch(_0x5c33c5));};exports['createCustomerFinal']=function(_0x2c6bd9,_0x29e11b){moveContact(_0x2c6bd9)[_0xd51f('0xa')](loggerCatch(_0x29e11b));};exports['rescheduleContact']=function(_0x29dc20,_0x58635b,_0x3b3669){if(_0x58635b){_0x29dc20[_0xd51f('0x14')]=null;}if(_0x3b3669){_0x29dc20[_0xd51f('0x15')]=![];}return cmHopper[_0xd51f('0x16')](_0x29dc20)['catch'](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x44654c){return cmHopper[_0xd51f('0x17')](_0x44654c)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xd51f('0x18')]=function(_0x24caa1){return cmHopper[_0xd51f('0x18')]({'UserId':null},_0x24caa1,0x1)[_0xd51f('0xa')](loggerCatch(_0xd51f('0x19')));};exports[_0xd51f('0x1a')]=function(_0x30cfe3){return cmHopper[_0xd51f('0x18')]({'active':![]},_0x30cfe3,0x1)[_0xd51f('0xa')](loggerCatch(_0xd51f('0x1b')));};exports[_0xd51f('0x1c')]=function(_0x2f9b35){var _0x5ac402={};_0x5ac402[_0xd51f('0x1d')]=_0x2f9b35[_0xd51f('0x1d')];_0x5ac402[_0xd51f('0x1e')]=_0x2f9b35[_0xd51f('0x1e')];_0x5ac402[_0xd51f('0x1f')]=_0x2f9b35['calleridnum'];_0x5ac402[_0xd51f('0x20')]=_0x2f9b35['calleridname'];_0x5ac402[_0xd51f('0x21')]=_0x2f9b35[_0xd51f('0x21')];_0x5ac402[_0xd51f('0x22')]=_0x2f9b35[_0xd51f('0x23')];_0x5ac402[_0xd51f('0x24')]=_0x2f9b35['answertime'];_0x5ac402[_0xd51f('0x25')]=0x1;_0x5ac402[_0xd51f('0x26')]=_0x2f9b35[_0xd51f('0x27')];_0x5ac402['connectedlinename']=_0x2f9b35[_0xd51f('0x28')];_0x5ac402[_0xd51f('0x29')]=_0xd51f('0x2a');_0x5ac402[_0xd51f('0x2b')]=_0xd51f('0x2c');_0x5ac402['holdtime']=0x0;_0x5ac402[_0xd51f('0x2d')]=0x1;_0x5ac402[_0xd51f('0x2e')]=_0x2f9b35[_0xd51f('0x28')];_0x5ac402[_0xd51f('0x2f')]=_0xd51f('0x30');return BPromise['resolve']()[_0xd51f('0xc')](voiceQueueReport[_0xd51f('0x31')](_0x5ac402))['catch'](loggerCatch(_0xd51f('0x32')));};exports[_0xd51f('0x33')]=function(_0x27187d,_0xdf0def){return BPromise[_0xd51f('0x11')]()['then'](cmHopper[_0xd51f('0x33')](_0x27187d,_0xdf0def))[_0xd51f('0xa')](loggerCatch(_0xd51f('0x34')));};exports[_0xd51f('0x35')]=function(_0xec2588){return cmHopper[_0xd51f('0x16')](_0xec2588,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xc6ae=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20'];(function(_0x2bafc9,_0x35dda5){var _0x3aa5f0=function(_0x1ae08d){while(--_0x1ae08d){_0x2bafc9['push'](_0x2bafc9['shift']());}};_0x3aa5f0(++_0x35dda5);}(_0xc6ae,0xc2));var _0xec6a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc6ae[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xec6a('0x0'));var BPromise=require(_0xec6a('0x1'));var logger=require('../../../config/logger')(_0xec6a('0x2'));var cmHopper=require(_0xec6a('0x3'));var cmHopperHistory=require(_0xec6a('0x4'));var cmHopperBlack=require(_0xec6a('0x5'));var agentReportPreview=require(_0xec6a('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x172b87){return function(_0x1b8641){logger[_0xec6a('0x7')](_0x172b87,util[_0xec6a('0x8')](_0x1b8641,{'showHidden':![],'depth':null}));};}function create(_0x1f8bb8){return cmHopperHistory['createHistory'](_0x1f8bb8)[_0xec6a('0x9')](loggerCatch(_0xec6a('0xa')));}function createAgent(_0x441efc){return BPromise[_0xec6a('0xb')]()['then'](agentReportPreview['createHistory'](_0x441efc))[_0xec6a('0x9')](loggerCatch(_0xec6a('0xa')));}function moveContact(_0x181078){return cmHopper[_0xec6a('0xc')](_0x181078,!![])[_0xec6a('0x9')](loggerCatch(_0xec6a('0xd')));}exports[_0xec6a('0xe')]=function(_0x1eaaa6){return cmHopperBlack['checkIsBlackList'](_0x1eaaa6)[_0xec6a('0x9')](loggerCatch(_0xec6a('0xf')));};exports[_0xec6a('0x10')]=function(_0x2fbd1e){return BPromise[_0xec6a('0xb')]()[_0xec6a('0x11')](cmHopper[_0xec6a('0x10')](_0x2fbd1e))[_0xec6a('0x9')](loggerCatch(_0xec6a('0x12')));};exports['createHistory']=function(_0x154935,_0x2595e6){create(_0x154935)[_0xec6a('0x9')](loggerCatch(_0x2595e6));moveContact(_0x154935)[_0xec6a('0x9')](loggerCatch(_0x2595e6));};exports[_0xec6a('0x13')]=function(_0x4472d7,_0x2165e2){createAgent(_0x4472d7)['catch'](loggerCatch(_0x2165e2));};exports[_0xec6a('0x14')]=function(_0x5da6f6,_0x302c96){create(_0x5da6f6)['catch'](loggerCatch(_0x302c96));};exports[_0xec6a('0x15')]=function(_0x1d1435,_0x5eff0f){moveContact(_0x1d1435)[_0xec6a('0x9')](loggerCatch(_0x5eff0f));};exports[_0xec6a('0x16')]=function(_0x585e5f,_0x479326,_0x310548){if(_0x479326){_0x585e5f[_0xec6a('0x17')]=null;}if(_0x310548){_0x585e5f[_0xec6a('0x18')]=![];}return cmHopper[_0xec6a('0x16')](_0x585e5f)[_0xec6a('0x9')](loggerCatch(_0xec6a('0x19')));};exports[_0xec6a('0x1a')]=function(_0x61b146){return cmHopper['countReScheduled'](_0x61b146)['catch'](loggerCatch(_0xec6a('0x1b')));};exports[_0xec6a('0x1c')]=function(_0x4c07fc){return cmHopper[_0xec6a('0x1c')]({'UserId':null},_0x4c07fc,0x1)[_0xec6a('0x9')](loggerCatch(_0xec6a('0x1d')));};exports[_0xec6a('0x1e')]=function(_0x6a9f69){return cmHopper[_0xec6a('0x1c')]({'active':![]},_0x6a9f69,0x1)[_0xec6a('0x9')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x1e6b65){var _0x289069={};_0x289069[_0xec6a('0x1f')]=_0x1e6b65['type'];_0x289069[_0xec6a('0x20')]=_0x1e6b65['uniqueid'];_0x289069[_0xec6a('0x21')]=_0x1e6b65[_0xec6a('0x21')];_0x289069[_0xec6a('0x22')]=_0x1e6b65['calleridname'];_0x289069[_0xec6a('0x23')]=_0x1e6b65[_0xec6a('0x23')];_0x289069[_0xec6a('0x24')]=_0x1e6b65[_0xec6a('0x25')];_0x289069[_0xec6a('0x26')]=_0x1e6b65['answertime'];_0x289069[_0xec6a('0x27')]=0x1;_0x289069['queuecallercompleteAt']=_0x1e6b65[_0xec6a('0x28')];_0x289069[_0xec6a('0x29')]=_0x1e6b65[_0xec6a('0x2a')];_0x289069[_0xec6a('0x2b')]='from-sip';_0x289069[_0xec6a('0x2c')]=_0xec6a('0x2d');_0x289069[_0xec6a('0x2e')]=0x0;_0x289069[_0xec6a('0x2f')]=0x1;_0x289069[_0xec6a('0x30')]=_0x1e6b65[_0xec6a('0x2a')];_0x289069[_0xec6a('0x31')]='COMPLETED';return BPromise[_0xec6a('0xb')]()['then'](voiceQueueReport[_0xec6a('0x32')](_0x289069))[_0xec6a('0x9')](loggerCatch(_0xec6a('0x33')));};exports['getContactRecallMe']=function(_0x5e6e70,_0xa7ecb9){return BPromise[_0xec6a('0xb')]()['then'](cmHopper[_0xec6a('0x34')](_0x5e6e70,_0xa7ecb9))['catch'](loggerCatch(_0xec6a('0x35')));};exports['rescheduleContactInQueue']=function(_0x193843){return cmHopper[_0xec6a('0x16')](_0x193843,!![],!![])[_0xec6a('0x9')](loggerCatch(_0xec6a('0x36')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 9e7d16f..f0e1ebe 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 _0x8661=['uniqueid','originate','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','name','queue','interface','channelAgent','voice','buildObj','not_inuse','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','logAgent','ringtime','getSeconds','membername','UserId','logCustomer','statedesc','endtime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED'];(function(_0xaee9b2,_0x4f74cf){var _0x8c26c1=function(_0x252b5a){while(--_0x252b5a){_0xaee9b2['push'](_0xaee9b2['shift']());}};_0x8c26c1(++_0x4f74cf);}(_0x8661,0xe0));var _0x1866=function(_0x79da7c,_0x266dd4){_0x79da7c=_0x79da7c-0x0;var _0x9e8ade=_0x8661[_0x79da7c];return _0x9e8ade;};'use strict';var util=require(_0x1866('0x0'));var _=require(_0x1866('0x1'));var moment=require(_0x1866('0x2'));var logger=require(_0x1866('0x3'))(_0x1866('0x4'));var ipAgi=process[_0x1866('0x5')][_0x1866('0x6')]||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0x1866('0x7')]=function(_0x580a45){return function(_0x2ba533){logger[_0x1866('0x8')](_0x580a45,util[_0x1866('0x9')](_0x2ba533,{'showHidden':![],'depth':null}));};};exports[_0x1866('0xa')]=function(_0x2c5644,_0x3ff9d8){logger[_0x1866('0xb')](_0x2c5644,util[_0x1866('0x9')](_0x3ff9d8,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4f6a31,_0x410e42){logger[_0x1866('0x8')](_0x4f6a31,util[_0x1866('0x9')](_0x410e42,{'showHidden':![],'depth':null}));};exports[_0x1866('0xc')]=function(_0x3a8c89){return function(_0x3f44a3){logger[_0x1866('0xb')](_0x3a8c89,util[_0x1866('0x9')](_0x3f44a3,{'showHidden':![],'depth':null}));};};exports[_0x1866('0xd')]=function(_0x4cd8c4,_0x1283e8,_0x51d307){return{'message':_0x4cd8c4,'unlock':_0x1283e8,'active':_0x51d307};};exports[_0x1866('0xe')]=function(_0x3c218f,_0x18a0d7,_0x2608b8){if(!_[_0x1866('0xf')](_0x2608b8)&&_0x1866('0x10')===typeof _0x2608b8&&!_['isEmpty'](_0x2608b8)){if(!_[_0x1866('0xf')](_0x18a0d7)&&'string'===typeof _0x18a0d7&&!_[_0x1866('0x11')](_0x18a0d7)){return util[_0x1866('0x12')](_0x1866('0x13'),_0x18a0d7,_0x2608b8);}return util[_0x1866('0x12')](_0x1866('0x13'),_0x2608b8,_0x2608b8);}if(!_['isUndefined'](_0x3c218f)&&_0x1866('0x10')===typeof _0x3c218f&&!_[_0x1866('0x11')](_0x3c218f)){return _0x3c218f;}return _0x1866('0x14');};exports[_0x1866('0x15')]=function(_0x426ee6){if(_[_0x1866('0x16')](_0x426ee6)){return![];}return _0x426ee6;};exports[_0x1866('0x17')]=function(_0x143f3b,_0x2ac08d,_0xa306a0,_0x257544,_0x27446a,_0x38cdb6){var _0x1a7a54={'XMD-QUEUE':_0x2ac08d[_0x1866('0x18')]?_0x2ac08d[_0x1866('0x18')]['name']:'','XMD-CALLERID':_0x257544,'XMD-CALLERID-PREVIEW':_0x38cdb6?util[_0x1866('0x12')](_0x1866('0x13'),_0x38cdb6[_0x1866('0x19')],_0x38cdb6[_0x1866('0x1a')]):_0x257544,'XMD-DIALID':_0x27446a,'XMD-CONTACTID':_0x2ac08d[_0x1866('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x257544,'XMD-VOICEQUEUEID':_0x2ac08d[_0x1866('0x1c')],'XMD-DIALCHANNEL':_0xa306a0,'XMD-DIALTIMEOUT':_0x143f3b['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x1866('0x12')](_0x1866('0x1d'),_0x143f3b[_0x1866('0x1e')]?'g':'',_[_0x1866('0x11')](_0x143f3b[_0x1866('0x1f')])?'':_0x1866('0x20')),'XMD-DIALURL':_0x143f3b['dialPreviewUrl']||'','XMD-AGI':_0x143f3b[_0x1866('0x21')]?util[_0x1866('0x12')](_0x1866('0x22'),ipAgi,_0x143f3b['dialQueueProject']):_0x1866('0x23'),'XMD-AGIAFTER':_0x143f3b[_0x1866('0x1e')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x143f3b['dialQueueProject2']):_0x1866('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x38cdb6?_0x38cdb6[_0x1866('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x38cdb6?_0x38cdb6['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x1866('0x25')};if(!_[_0x1866('0x11')](_0x143f3b[_0x1866('0x1f')])){_0x1a7a54[util[_0x1866('0x12')]('%s',_0x1866('0x26'))]=_0x143f3b[_0x1866('0x1f')];_0x1a7a54[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x27446a;}if(_0x2ac08d&&_0x2ac08d[_0x1866('0x27')]){for(var _0x31c603 in _0x2ac08d[_0x1866('0x27')]){if(_0x2ac08d[_0x1866('0x27')][_0x1866('0x28')](_0x31c603)){if(!_[_0x1866('0x16')](_0x2ac08d[_0x1866('0x27')][_0x31c603])&&_0x31c603!=='id'&&_0x31c603!=='tags'&&_0x31c603!=='createdAt'&&_0x31c603!==_0x1866('0x29')){_0x1a7a54[util[_0x1866('0x12')](_0x1866('0x2a'),_0x1866('0x2b'),_['toUpper'](_0x31c603))]=_0x2ac08d[_0x1866('0x27')][_0x31c603];}}}}return _0x1a7a54;};exports[_0x1866('0x2c')]=function(_0x43a295){var _0x56799c={};for(var _0x1f9b8f in _0x43a295){if(_0x43a295[_0x1866('0x28')](_0x1f9b8f)){_0x56799c[util['format']('%s',_[_0x1866('0x2d')](_0x1f9b8f))]=_0x43a295[_0x1f9b8f];}}return{'variables':_0x56799c};};exports[_0x1866('0x2e')]=function(_0x20308d,_0x3c7fcb){if(!_['isNil'](_0x20308d)){if(_0x20308d[_0x1866('0x28')](_0x1866('0x2f'))){if(_0x20308d[_0x1866('0x2f')]>0x0){_0x20308d[_0x1866('0x2f')]-=0x1;}else{logger[_0x1866('0x8')](_0x1866('0x30'),_0x3c7fcb);}}}else{logger['error'](_0x1866('0x31'),_0x3c7fcb);}};exports[_0x1866('0x32')]=function(_0x558770){var _0x347d89=moment()[_0x1866('0x12')](_0x1866('0x33'));_0x558770[_0x1866('0x34')]=0xd;_0x558770['statedesc']=_0x1866('0x35');_0x558770[_0x1866('0x36')]=_0x347d89;_0x558770[_0x1866('0x37')]=_0x347d89;_0x558770['endtime']=_0x347d89;};exports[_0x1866('0x38')]=function(_0x5e0fc9,_0x20ab31,_0x2e043b){var _0x7b651d=moment()[_0x1866('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e0fc9[_0x1866('0x34')]=_0x20ab31;_0x5e0fc9['statedesc']=_0x2e043b;_0x5e0fc9[_0x1866('0x37')]=_0x7b651d;_0x5e0fc9[_0x1866('0x39')]=utils[_0x1866('0x3a')](_0x5e0fc9[_0x1866('0x37')],_0x5e0fc9[_0x1866('0x36')]);};exports['logLookAgent']=function(_0x1e137b,_0x48da74,_0x56163e){_0x1e137b[_0x1866('0x3b')]=_0x48da74;_0x1e137b[_0x1866('0x3c')]=_0x56163e;};exports[_0x1866('0x3d')]=function(_0x5ce8e0,_0x21d5f4,_0x3c8f01){var _0x511efb=moment()[_0x1866('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ce8e0[_0x1866('0x34')]=_0x21d5f4;_0x5ce8e0[_0x1866('0x3e')]=_0x3c8f01;_0x5ce8e0[_0x1866('0x37')]=_0x5ce8e0[_0x1866('0x37')]?_0x5ce8e0[_0x1866('0x37')]:_0x511efb;_0x5ce8e0[_0x1866('0x3f')]=_0x5ce8e0['endtime']?_0x5ce8e0[_0x1866('0x3f')]:_0x511efb;_0x5ce8e0[_0x1866('0x39')]=utils['getSeconds'](_0x5ce8e0[_0x1866('0x37')]||0x0,_0x5ce8e0[_0x1866('0x36')]||0x0);_0x5ce8e0['talktime']=_0x5ce8e0[_0x1866('0x40')]?utils['getSeconds'](_0x5ce8e0['endtime'],_0x5ce8e0[_0x1866('0x40')]):0x0;};exports[_0x1866('0x41')]=function(_0x56005e){return _0x56005e===_0x1866('0x42');};exports[_0x1866('0x43')]=function(_0x251725,_0x42b7eb,_0x35d54d,_0x22ca38,_0x198ce1){var _0x3cace6=_0x22ca38?_0x1866('0x44'):_0x251725[_0x1866('0x19')];_0x3cace6=_0x198ce1?_0x1866('0x45'):_0x3cace6;return{'actionid':_0x251725[_0x1866('0x46')],'action':_0x1866('0x47'),'channel':_0x251725['channelAgent'],'callerid':util[_0x1866('0x12')]('\x22%s\x22\x20<%s>',_0x3cace6,_0x251725['calleridnum']),'Exten':_0x1866('0x48'),'Context':_0x1866('0x49'),'Priority':'1','variable':_0x35d54d,'timeout':(_0x42b7eb[_0x1866('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x251725['uniqueid']};};exports[_0x1866('0x4b')]=function(_0x205317){return _0x205317[_0x1866('0x4c')]+_0x205317['countcongestionretry']+_0x205317[_0x1866('0x4d')]+_0x205317[_0x1866('0x4e')]+_0x205317[_0x1866('0x4f')];};exports[_0x1866('0x50')]=function(_0x2e88ed){var _0x271148=_[_0x1866('0x51')](_0x2e88ed);_0x271148[_0x1866('0x34')]=0xf;_0x271148[_0x1866('0x3e')]=_0x1866('0x52');return _0x271148;};exports[_0x1866('0x53')]=function(_0x23ca64,_0x46318c,_0xd1878f){var _0x336b5b={};_0x336b5b[_0x46318c]=_0x23ca64[_0x46318c];_0x336b5b[_0x1866('0x54')]=![];_0x336b5b[_0x1866('0x55')]=moment()['add'](_0xd1878f,_0x1866('0x56'))[_0x1866('0x12')](_0x1866('0x33'));_0x336b5b['ContactId']=_0x23ca64[_0x1866('0x1b')];_0x336b5b[_0x1866('0x57')]=_0x23ca64[_0x1866('0x57')];_0x336b5b[_0x1866('0x1c')]=_0x23ca64[_0x1866('0x1c')]||undefined;return _0x336b5b;};exports[_0x1866('0x58')]=function(_0xa1b3b,_0x14894f){if(!_[_0x1866('0x16')](_0xa1b3b)){if(_0xa1b3b[_0x1866('0x59')]>0x0){_0xa1b3b[_0x1866('0x59')]-=0x1;}else{logger[_0x1866('0x8')](_0x14894f,_0x1866('0x5a'));}}else{logger[_0x1866('0x8')](_0x14894f,_0x1866('0x5b'));}};exports['IsNotLoggedIn']=function(_0x3e4355){if(_0x3e4355<=0x0){return!![];}return![];};function buildObj(_0x1735a4,_0x337daa,_0x10dd2b){_0x1735a4['lastevent']=_0x337daa;_0x1735a4[_0x1866('0x5c')]=_0x1735a4[_0x1866('0x5d')];_0x1735a4[_0x1866('0x5e')]=_0x1735a4[_0x1866('0x5f')];_0x1735a4['motionChannel']=_0x1866('0x60');if(_0x10dd2b){_0x1735a4['mandatoryDisposition']=_0x10dd2b['mandatoryDisposition'];}return _0x1735a4;}exports[_0x1866('0x61')]=buildObj;exports['buildAcw']=function(_0x191bc3){var _0xdb1dd={};_0xdb1dd[_0x1866('0x5d')]=_0x191bc3['queue'];_0xdb1dd[_0x1866('0x5e')]=_0x191bc3[_0x1866('0x5f')];_0xdb1dd[_0x1866('0x46')]=_0x191bc3[_0x1866('0x46')];return _0xdb1dd;};exports['agentReadyId']=function(_0x20fbbe){var _0x59a34b=[];for(var _0x1d315f in _0x20fbbe){if(_0x20fbbe[_0x1866('0x28')](_0x1d315f)){if(!_[_0x1866('0x16')](_0x20fbbe[_0x1d315f])&&_0x20fbbe[_0x1d315f][_0x1866('0x34')]===_0x1866('0x62')&&_0x20fbbe[_0x1d315f]['status']==='reachable'){_0x59a34b[_0x1866('0x63')](_0x20fbbe[_0x1d315f]['id']);}}}return _0x59a34b;};exports[_0x1866('0x64')]=function(_0x48ad97){var _0xc58dd0=moment()[_0x1866('0x65')](0x0);var _0x37f390=moment(_0x48ad97)[_0x1866('0x65')](0x0);return _0xc58dd0[_0x1866('0x66')](_0x37f390,_0x1866('0x67'));};exports[_0x1866('0x68')]=function(_0x12aa79){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x12aa79[_0x1866('0x1b')],'ListId':_0x12aa79[_0x1866('0x57')],'VoiceQueueId':_0x12aa79[_0x1866('0x1c')]||undefined,'CampaignId':_0x12aa79[_0x1866('0x69')]||undefined};};exports[_0x1866('0x6a')]=function(_0x2200f7){if(_0x2200f7===_0x1866('0x46')||_0x2200f7==='idContact'||_0x2200f7===_0x1866('0x5d')||_0x2200f7===_0x1866('0x6b')||_0x2200f7===_0x1866('0x6c')||_0x2200f7===_0x1866('0x6d')||_0x2200f7===_0x1866('0x3b')||_0x2200f7===_0x1866('0x5f')||_0x2200f7===_0x1866('0x19')||_0x2200f7==='active'||_0x2200f7===_0x1866('0x1a')||_0x2200f7===_0x1866('0x55')||_0x2200f7===_0x1866('0x4c')||_0x2200f7===_0x1866('0x6e')||_0x2200f7===_0x1866('0x4d')||_0x2200f7===_0x1866('0x6f')||_0x2200f7==='callback'||_0x2200f7===_0x1866('0x70')||_0x2200f7===_0x1866('0x71')||_0x2200f7==='recallme'||_0x2200f7==='ContactId'||_0x2200f7==='ListId'||_0x2200f7===_0x1866('0x3c')||_0x2200f7==='VoiceQueueId'||_0x2200f7===_0x1866('0x72')||_0x2200f7===_0x1866('0x73')||_0x2200f7===_0x1866('0x74')||_0x2200f7==='xmd-phone'||_0x2200f7===_0x1866('0x75')||_0x2200f7===_0x1866('0x76')||_0x2200f7===_0x1866('0x77')||_0x2200f7===_0x1866('0x78')||_0x2200f7===_0x1866('0x79')||_0x2200f7===_0x1866('0x7a')||_0x2200f7===_0x1866('0x7b')||_0x2200f7===_0x1866('0x7c')||_0x2200f7===_0x1866('0x7d')||_0x2200f7===_0x1866('0x7e')||_0x2200f7==='xmd-agi'||_0x2200f7===_0x1866('0x7f')||_0x2200f7===_0x1866('0x80')||_0x2200f7===_0x1866('0x81')||_0x2200f7==='rtpaudioqosjitterbridged'||_0x2200f7===_0x1866('0x82')||_0x2200f7==='rtpaudioqoslossbridged'||_0x2200f7===_0x1866('0x83')||_0x2200f7===_0x1866('0x84')||_0x2200f7===_0x1866('0x7f')||_0x2200f7===_0x1866('0x80')||_0x2200f7===_0x1866('0x81')||_0x2200f7===_0x1866('0x85')||_0x2200f7==='rtpaudioqosloss'||_0x2200f7===_0x1866('0x86')||_0x2200f7===_0x1866('0x83')||_0x2200f7===_0x1866('0x84')||_0x2200f7===_0x1866('0x87')||_0x2200f7===_0x1866('0x88')||_0x2200f7===_0x1866('0x34')||_0x2200f7===_0x1866('0x3e')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x1ea194,_0x4dc3dc){var _0x5650bc,_0x1ef230,_0x5b8976;if(_0x4dc3dc<=0x0){_0x4dc3dc=0x1;}_0x5650bc=new RegExp('\x5cw{0,'+_0x4dc3dc+'}$');_0x1ef230=Math['pow'](0xa,_0x4dc3dc-0x1);_0x5b8976=Math['pow'](0xa,_0x4dc3dc)-0x1;return util[_0x1866('0x12')]('%s',_[_0x1866('0x89')](_0x1ea194,_0x5650bc,_[_0x1866('0x8a')](_0x1ef230,_0x5b8976)));};exports[_0x1866('0x8b')]=function(_0x581465){var _0x305846=_0x581465[_0x1866('0x8c')](/"(.*?)"/);return _0x305846?_0x305846[0x1]:_0x581465;};exports[_0x1866('0x8d')]=function(_0x53d58b){var _0x5bbeb7=_0x53d58b[_0x1866('0x8c')](/<(.*?)>/);return _0x5bbeb7?_0x5bbeb7[0x1]:_0x53d58b;};function buildNoAnswerEventPayload(_0x2af4a6,_0x460d1d){var _0x950f03=buildObj(_0x2af4a6,_0x1866('0x8e'));if(!_['isEmpty'](_0x460d1d[_0x1866('0x8f')])){Object['keys'](_0x460d1d[_0x1866('0x8f')])[_0x1866('0x90')](function(_0x2c717d){_0x950f03[_0x2c717d[_0x1866('0x91')]()]=_0x460d1d[_0x1866('0x8f')][_0x2c717d];});}return _0x950f03;}exports[_0x1866('0x92')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xe954=['queue','agentReadyId','not_inuse','status','reachable','push','milliseconds','diff','createBody','CampaignId','filterKey','type','campaigntype','calleridname','countnoanswerretry','countglobal','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','util','moment','preview','env','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','info','loggerError','inspect','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','logCustomer','YYYY-MM-DD\x20HH:mm:ss','answertime','RECALL','BOOKED','originate','from-sip','uniqueid','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','interface','channelAgent','voice','mandatoryDisposition'];(function(_0x295572,_0x58a177){var _0x285bef=function(_0x3d284e){while(--_0x3d284e){_0x295572['push'](_0x295572['shift']());}};_0x285bef(++_0x58a177);}(_0xe954,0x150));var _0x4e95=function(_0x25b332,_0x465525){_0x25b332=_0x25b332-0x0;var _0x31259c=_0xe954[_0x25b332];return _0x31259c;};'use strict';var util=require(_0x4e95('0x0'));var _=require('lodash');var moment=require(_0x4e95('0x1'));var logger=require('../../../../config/logger')(_0x4e95('0x2'));var ipAgi=process[_0x4e95('0x3')]['XCALLY_IP_AGI']||_0x4e95('0x4');var utils=require(_0x4e95('0x5'));exports[_0x4e95('0x6')]=function(_0x4cfcdd){return function(_0x32ae6a){logger[_0x4e95('0x7')](_0x4cfcdd,util['inspect'](_0x32ae6a,{'showHidden':![],'depth':null}));};};exports[_0x4e95('0x8')]=function(_0x159bce,_0x25e014){logger[_0x4e95('0x9')](_0x159bce,util['inspect'](_0x25e014,{'showHidden':![],'depth':null}));};exports[_0x4e95('0xa')]=function(_0x54fa94,_0x52cff8){logger['error'](_0x54fa94,util[_0x4e95('0xb')](_0x52cff8,{'showHidden':![],'depth':null}));};exports[_0x4e95('0xc')]=function(_0x2dc123){return function(_0x4a89de){logger[_0x4e95('0x9')](_0x2dc123,util[_0x4e95('0xb')](_0x4a89de,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x4e1e82,_0x32a36b,_0x31d08f){return{'message':_0x4e1e82,'unlock':_0x32a36b,'active':_0x31d08f};};exports[_0x4e95('0xd')]=function(_0x422151,_0xa7b300,_0x14c81e){if(!_[_0x4e95('0xe')](_0x14c81e)&&_0x4e95('0xf')===typeof _0x14c81e&&!_[_0x4e95('0x10')](_0x14c81e)){if(!_[_0x4e95('0xe')](_0xa7b300)&&_0x4e95('0xf')===typeof _0xa7b300&&!_[_0x4e95('0x10')](_0xa7b300)){return util[_0x4e95('0x11')](_0x4e95('0x12'),_0xa7b300,_0x14c81e);}return util[_0x4e95('0x11')]('\x22%s\x22\x20<%s>',_0x14c81e,_0x14c81e);}if(!_['isUndefined'](_0x422151)&&_0x4e95('0xf')===typeof _0x422151&&!_[_0x4e95('0x10')](_0x422151)){return _0x422151;}return _0x4e95('0x13');};exports[_0x4e95('0x14')]=function(_0x5e330f){if(_[_0x4e95('0x15')](_0x5e330f)){return![];}return _0x5e330f;};exports['addVariables']=function(_0x5f4f8c,_0x454a9f,_0x3d402e,_0x1be603,_0x69067e,_0x554273){var _0x3bb26c={'XMD-QUEUE':_0x454a9f[_0x4e95('0x16')]?_0x454a9f['Queue'][_0x4e95('0x17')]:'','XMD-CALLERID':_0x1be603,'XMD-CALLERID-PREVIEW':_0x554273?util['format'](_0x4e95('0x12'),_0x554273['calleridname'],_0x554273[_0x4e95('0x18')]):_0x1be603,'XMD-DIALID':_0x69067e,'XMD-CONTACTID':_0x454a9f[_0x4e95('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1be603,'XMD-VOICEQUEUEID':_0x454a9f[_0x4e95('0x1a')],'XMD-DIALCHANNEL':_0x3d402e,'XMD-DIALTIMEOUT':_0x5f4f8c['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x4e95('0x11')](_0x4e95('0x1b'),_0x5f4f8c[_0x4e95('0x1c')]?'g':'',_[_0x4e95('0x10')](_0x5f4f8c[_0x4e95('0x1d')])?'':_0x4e95('0x1e')),'XMD-DIALURL':_0x5f4f8c[_0x4e95('0x1f')]||'','XMD-AGI':_0x5f4f8c['dialQueueProject']?util[_0x4e95('0x11')](_0x4e95('0x20'),ipAgi,_0x5f4f8c[_0x4e95('0x21')]):_0x4e95('0x22'),'XMD-AGIAFTER':_0x5f4f8c[_0x4e95('0x1c')]?util['format'](_0x4e95('0x20'),ipAgi,_0x5f4f8c[_0x4e95('0x1c')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x554273?_0x554273[_0x4e95('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x554273?_0x554273['originatecalleridname']:'','XMD-DESTINATION':_0x4e95('0x24'),'SIPADDHEADER':_0x4e95('0x25')};if(!_[_0x4e95('0x10')](_0x5f4f8c[_0x4e95('0x1d')])){_0x3bb26c[util[_0x4e95('0x11')]('%s',_0x4e95('0x26'))]=_0x5f4f8c[_0x4e95('0x1d')];_0x3bb26c[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x69067e;}if(_0x454a9f&&_0x454a9f[_0x4e95('0x27')]){for(var _0x57d303 in _0x454a9f[_0x4e95('0x27')]){if(_0x454a9f[_0x4e95('0x27')][_0x4e95('0x28')](_0x57d303)){if(!_[_0x4e95('0x15')](_0x454a9f[_0x4e95('0x27')][_0x57d303])&&_0x57d303!=='id'&&_0x57d303!==_0x4e95('0x29')&&_0x57d303!==_0x4e95('0x2a')&&_0x57d303!=='updatedAt'){_0x3bb26c[util[_0x4e95('0x11')](_0x4e95('0x2b'),_0x4e95('0x2c'),_[_0x4e95('0x2d')](_0x57d303))]=_0x454a9f['Contact'][_0x57d303];}}}}return _0x3bb26c;};exports[_0x4e95('0x2e')]=function(_0x2aeec9){var _0x333197={};for(var _0x134728 in _0x2aeec9){if(_0x2aeec9[_0x4e95('0x28')](_0x134728)){_0x333197[util[_0x4e95('0x11')]('%s',_['toLower'](_0x134728))]=_0x2aeec9[_0x134728];}}return{'variables':_0x333197};};exports['updateOriginated']=function(_0x34a039,_0x46a43f){if(!_['isNil'](_0x34a039)){if(_0x34a039[_0x4e95('0x28')](_0x4e95('0x2f'))){if(_0x34a039[_0x4e95('0x2f')]>0x0){_0x34a039[_0x4e95('0x2f')]-=0x1;}else{logger[_0x4e95('0x7')](_0x4e95('0x30'),_0x46a43f);}}}else{logger[_0x4e95('0x7')](_0x4e95('0x31'),_0x46a43f);}};exports[_0x4e95('0x32')]=function(_0x3d833e){var _0x102eed=moment()[_0x4e95('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d833e[_0x4e95('0x33')]=0xd;_0x3d833e[_0x4e95('0x34')]=_0x4e95('0x35');_0x3d833e[_0x4e95('0x36')]=_0x102eed;_0x3d833e[_0x4e95('0x37')]=_0x102eed;_0x3d833e[_0x4e95('0x38')]=_0x102eed;};exports[_0x4e95('0x39')]=function(_0xbb6aeb,_0x545a98,_0x46c1f9){var _0x38c9ba=moment()[_0x4e95('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0xbb6aeb[_0x4e95('0x33')]=_0x545a98;_0xbb6aeb['statedesc']=_0x46c1f9;_0xbb6aeb['responsetime']=_0x38c9ba;_0xbb6aeb[_0x4e95('0x3a')]=utils[_0x4e95('0x3b')](_0xbb6aeb[_0x4e95('0x37')],_0xbb6aeb['starttime']);};exports[_0x4e95('0x3c')]=function(_0x30865d,_0x36f7a,_0x4855cf){_0x30865d[_0x4e95('0x3d')]=_0x36f7a;_0x30865d['UserId']=_0x4855cf;};exports[_0x4e95('0x3e')]=function(_0x5caeeb,_0x926c1f,_0x49c154){var _0x185d30=moment()['format'](_0x4e95('0x3f'));_0x5caeeb[_0x4e95('0x33')]=_0x926c1f;_0x5caeeb[_0x4e95('0x34')]=_0x49c154;_0x5caeeb[_0x4e95('0x37')]=_0x5caeeb['responsetime']?_0x5caeeb[_0x4e95('0x37')]:_0x185d30;_0x5caeeb[_0x4e95('0x38')]=_0x5caeeb[_0x4e95('0x38')]?_0x5caeeb[_0x4e95('0x38')]:_0x185d30;_0x5caeeb['ringtime']=utils[_0x4e95('0x3b')](_0x5caeeb[_0x4e95('0x37')]||0x0,_0x5caeeb[_0x4e95('0x36')]||0x0);_0x5caeeb['talktime']=_0x5caeeb[_0x4e95('0x40')]?utils[_0x4e95('0x3b')](_0x5caeeb[_0x4e95('0x38')],_0x5caeeb['answertime']):0x0;};exports['isFailure']=function(_0x1c296f){return _0x1c296f==='Failure';};exports['variablesAction']=function(_0x52e33a,_0x40d227,_0x24684c,_0x46109b,_0x25e595){var _0x915493=_0x46109b?_0x4e95('0x41'):_0x52e33a['calleridname'];_0x915493=_0x25e595?_0x4e95('0x42'):_0x915493;return{'actionid':_0x52e33a['uniqueid'],'action':_0x4e95('0x43'),'channel':_0x52e33a['channelAgent'],'callerid':util[_0x4e95('0x11')]('\x22%s\x22\x20<%s>',_0x915493,_0x52e33a[_0x4e95('0x18')]),'Exten':_0x4e95('0x24'),'Context':_0x4e95('0x44'),'Priority':'1','variable':_0x24684c,'timeout':(_0x40d227['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x52e33a[_0x4e95('0x45')]};};exports['totalGlobal']=function(_0x47c4d4){return _0x47c4d4[_0x4e95('0x46')]+_0x47c4d4[_0x4e95('0x47')]+_0x47c4d4['countnoanswerretry']+_0x47c4d4[_0x4e95('0x48')]+_0x47c4d4[_0x4e95('0x49')];};exports[_0x4e95('0x4a')]=function(_0x3ddfa9){var _0x403161=_['clone'](_0x3ddfa9);_0x403161[_0x4e95('0x33')]=0xf;_0x403161[_0x4e95('0x34')]='Global';return _0x403161;};exports[_0x4e95('0x4b')]=function(_0x2e2881,_0x22ee87,_0x4e5c2f){var _0xf571bd={};_0xf571bd[_0x22ee87]=_0x2e2881[_0x22ee87];_0xf571bd[_0x4e95('0x4c')]=![];_0xf571bd[_0x4e95('0x4d')]=moment()[_0x4e95('0x4e')](_0x4e5c2f,_0x4e95('0x4f'))[_0x4e95('0x11')](_0x4e95('0x3f'));_0xf571bd[_0x4e95('0x19')]=_0x2e2881[_0x4e95('0x19')];_0xf571bd[_0x4e95('0x50')]=_0x2e2881[_0x4e95('0x50')];_0xf571bd['VoiceQueueId']=_0x2e2881['VoiceQueueId']||undefined;return _0xf571bd;};exports[_0x4e95('0x51')]=function(_0x3b9464,_0x4bad75){if(!_[_0x4e95('0x15')](_0x3b9464)){if(_0x3b9464[_0x4e95('0x52')]>0x0){_0x3b9464[_0x4e95('0x52')]-=0x1;}else{logger[_0x4e95('0x7')](_0x4bad75,_0x4e95('0x53'));}}else{logger[_0x4e95('0x7')](_0x4bad75,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x4e95('0x54')]=function(_0x3f9415){if(_0x3f9415<=0x0){return!![];}return![];};function buildObj(_0x52122b,_0x13baf6,_0x23b83b){_0x52122b[_0x4e95('0x55')]=_0x13baf6;_0x52122b[_0x4e95('0x17')]=_0x52122b['queue'];_0x52122b[_0x4e95('0x56')]=_0x52122b[_0x4e95('0x57')];_0x52122b['motionChannel']=_0x4e95('0x58');if(_0x23b83b){_0x52122b[_0x4e95('0x59')]=_0x23b83b['mandatoryDisposition'];}return _0x52122b;}exports['buildObj']=buildObj;exports['buildAcw']=function(_0x17499c){var _0x9b5332={};_0x9b5332[_0x4e95('0x5a')]=_0x17499c[_0x4e95('0x5a')];_0x9b5332['interface']=_0x17499c[_0x4e95('0x57')];_0x9b5332[_0x4e95('0x45')]=_0x17499c['uniqueid'];return _0x9b5332;};exports[_0x4e95('0x5b')]=function(_0x17dbbf){var _0xa1b7fb=[];for(var _0x3741a3 in _0x17dbbf){if(_0x17dbbf[_0x4e95('0x28')](_0x3741a3)){if(!_['isNil'](_0x17dbbf[_0x3741a3])&&_0x17dbbf[_0x3741a3][_0x4e95('0x33')]===_0x4e95('0x5c')&&_0x17dbbf[_0x3741a3][_0x4e95('0x5d')]===_0x4e95('0x5e')){_0xa1b7fb[_0x4e95('0x5f')](_0x17dbbf[_0x3741a3]['id']);}}}return _0xa1b7fb;};exports['getDiff']=function(_0x34487e){var _0x2bd540=moment()['milliseconds'](0x0);var _0x1488a7=moment(_0x34487e)[_0x4e95('0x60')](0x0);return _0x2bd540[_0x4e95('0x61')](_0x1488a7,'seconds');};exports[_0x4e95('0x62')]=function(_0x32ef7d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x32ef7d['ContactId'],'ListId':_0x32ef7d[_0x4e95('0x50')],'VoiceQueueId':_0x32ef7d[_0x4e95('0x1a')]||undefined,'CampaignId':_0x32ef7d[_0x4e95('0x63')]||undefined};};exports[_0x4e95('0x64')]=function(_0x5260e0){if(_0x5260e0==='uniqueid'||_0x5260e0==='idContact'||_0x5260e0===_0x4e95('0x5a')||_0x5260e0===_0x4e95('0x65')||_0x5260e0===_0x4e95('0x66')||_0x5260e0==='dialAnswer'||_0x5260e0===_0x4e95('0x3d')||_0x5260e0===_0x4e95('0x57')||_0x5260e0===_0x4e95('0x67')||_0x5260e0===_0x4e95('0x4c')||_0x5260e0===_0x4e95('0x18')||_0x5260e0===_0x4e95('0x4d')||_0x5260e0===_0x4e95('0x46')||_0x5260e0==='countcongestionretry'||_0x5260e0===_0x4e95('0x68')||_0x5260e0===_0x4e95('0x69')||_0x5260e0==='callback'||_0x5260e0==='callbackuniqueid'||_0x5260e0===_0x4e95('0x6a')||_0x5260e0===_0x4e95('0x6b')||_0x5260e0===_0x4e95('0x19')||_0x5260e0===_0x4e95('0x50')||_0x5260e0==='UserId'||_0x5260e0===_0x4e95('0x1a')||_0x5260e0===_0x4e95('0x6c')||_0x5260e0===_0x4e95('0x6d')||_0x5260e0===_0x4e95('0x6e')||_0x5260e0==='xmd-phone'||_0x5260e0===_0x4e95('0x6f')||_0x5260e0==='xmd-dialurl'||_0x5260e0===_0x4e95('0x70')||_0x5260e0===_0x4e95('0x71')||_0x5260e0===_0x4e95('0x72')||_0x5260e0===_0x4e95('0x73')||_0x5260e0===_0x4e95('0x74')||_0x5260e0===_0x4e95('0x75')||_0x5260e0===_0x4e95('0x76')||_0x5260e0==='xmd-agiafter'||_0x5260e0===_0x4e95('0x77')||_0x5260e0===_0x4e95('0x78')||_0x5260e0===_0x4e95('0x79')||_0x5260e0===_0x4e95('0x7a')||_0x5260e0===_0x4e95('0x7b')||_0x5260e0===_0x4e95('0x7c')||_0x5260e0===_0x4e95('0x7d')||_0x5260e0===_0x4e95('0x7e')||_0x5260e0===_0x4e95('0x7f')||_0x5260e0===_0x4e95('0x78')||_0x5260e0==='rtpaudioqosbridged'||_0x5260e0===_0x4e95('0x7a')||_0x5260e0==='rtpaudioqosjitterbridged'||_0x5260e0===_0x4e95('0x7c')||_0x5260e0===_0x4e95('0x7d')||_0x5260e0==='rtpaudioqosrtt'||_0x5260e0===_0x4e95('0x7f')||_0x5260e0==='bridgepeer'||_0x5260e0===_0x4e95('0x80')||_0x5260e0===_0x4e95('0x33')||_0x5260e0===_0x4e95('0x34')){return![];}return!![];};exports[_0x4e95('0x81')]=function(_0x3a4046,_0x4ecfe2){var _0x248251,_0xdf1663,_0x393c79;if(_0x4ecfe2<=0x0){_0x4ecfe2=0x1;}_0x248251=new RegExp(_0x4e95('0x82')+_0x4ecfe2+'}$');_0xdf1663=Math[_0x4e95('0x83')](0xa,_0x4ecfe2-0x1);_0x393c79=Math[_0x4e95('0x83')](0xa,_0x4ecfe2)-0x1;return util['format']('%s',_[_0x4e95('0x84')](_0x3a4046,_0x248251,_[_0x4e95('0x85')](_0xdf1663,_0x393c79)));};exports[_0x4e95('0x86')]=function(_0x16e5ec){var _0x4241e6=_0x16e5ec[_0x4e95('0x87')](/"(.*?)"/);return _0x4241e6?_0x4241e6[0x1]:_0x16e5ec;};exports[_0x4e95('0x88')]=function(_0x5d20dc){var _0x352f39=_0x5d20dc[_0x4e95('0x87')](/<(.*?)>/);return _0x352f39?_0x352f39[0x1]:_0x5d20dc;};function buildNoAnswerEventPayload(_0x11daf1,_0x3e4370){var _0x4fec56=buildObj(_0x11daf1,_0x4e95('0x89'));if(!_['isEmpty'](_0x3e4370[_0x4e95('0x8a')])){Object[_0x4e95('0x8b')](_0x3e4370[_0x4e95('0x8a')])[_0x4e95('0x8c')](function(_0x2969aa){_0x4fec56[_0x2969aa[_0x4e95('0x8d')]()]=_0x3e4370[_0x4e95('0x8a')][_0x2969aa];});}return _0x4fec56;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e9a0241..77a0ee8 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 _0xc8f1=['voicequeuechannelhangup','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc8f1,0x1d5));var _0x1c8f=function(_0x544854,_0x13a980){_0x544854=_0x544854-0x0;var _0x7b14f6=_0xc8f1[_0x544854];return _0x7b14f6;};'use strict';exports['queueadd']={'queue':{'type':_0x1c8f('0x0'),'required':!![]},'interface':{'type':_0x1c8f('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x1c8f('0x1'),'required':![]},'paused':{'type':_0x1c8f('0x2'),'required':![]}};exports[_0x1c8f('0x3')]={'queue':{'type':_0x1c8f('0x0'),'required':!![]},'interface':{'type':_0x1c8f('0x0'),'required':!![]}};exports[_0x1c8f('0x4')]={'interface':{'type':_0x1c8f('0x0'),'required':!![]},'paused':{'type':_0x1c8f('0x2')},'reason':{'type':_0x1c8f('0x0'),'required':![]}};exports[_0x1c8f('0x5')]={'module':{'type':_0x1c8f('0x0'),'required':![]}};exports[_0x1c8f('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x1c8f('0x7')]={'uniqueid':{'type':_0x1c8f('0x0'),'required':!![]},'filename':{'type':_0x1c8f('0x0')},'format':{'type':_0x1c8f('0x0')},'mixmonitorid':{'type':'string'}};exports[_0x1c8f('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x1c8f('0x0'),'required':!![]},'context':{'type':_0x1c8f('0x0')}}; \ No newline at end of file +var _0xad13=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string','number'];(function(_0x1e34a3,_0x28861a){var _0x44d1c0=function(_0x7bfc1d){while(--_0x7bfc1d){_0x1e34a3['push'](_0x1e34a3['shift']());}};_0x44d1c0(++_0x28861a);}(_0xad13,0x10b));var _0x3ad1=function(_0x40e174,_0x56f057){_0x40e174=_0x40e174-0x0;var _0x3e3098=_0xad13[_0x40e174];return _0x3e3098;};'use strict';exports[_0x3ad1('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x3ad1('0x1'),'required':!![]},'penalty':{'type':_0x3ad1('0x2'),'required':![]},'paused':{'type':_0x3ad1('0x3'),'required':![]}};exports[_0x3ad1('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x3ad1('0x1'),'required':!![]}};exports[_0x3ad1('0x5')]={'interface':{'type':_0x3ad1('0x1'),'required':!![]},'paused':{'type':_0x3ad1('0x3')},'reason':{'type':_0x3ad1('0x1'),'required':![]}};exports[_0x3ad1('0x6')]={'module':{'type':_0x3ad1('0x1'),'required':![]}};exports[_0x3ad1('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x3ad1('0x1'),'required':!![]},'filename':{'type':_0x3ad1('0x1')},'format':{'type':_0x3ad1('0x1')},'mixmonitorid':{'type':_0x3ad1('0x1')}};exports[_0x3ad1('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x3ad1('0x1'),'required':!![]},'context':{'type':_0x3ad1('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index bf0b3f5..1e4a9a6 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 _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2032,0xd9));var _0x2203=function(_0x237b76,_0x1150ea){_0x237b76=_0x237b76-0x0;var _0x4a8e01=_0x2032[_0x237b76];return _0x4a8e01;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file +var _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2032,0xd9));var _0x2203=function(_0x458929,_0x4b2299){_0x458929=_0x458929-0x0;var _0x4a5664=_0x2032[_0x458929];return _0x4a5664;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 2f2079c..9b7be87 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 _0x45f7=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x40311a,_0x3f9f7f){var _0x43fa18=function(_0x4d5e04){while(--_0x4d5e04){_0x40311a['push'](_0x40311a['shift']());}};_0x43fa18(++_0x3f9f7f);}(_0x45f7,0xb1));var _0x745f=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x45f7[_0x540dcb];return _0x49353c;};'use strict';function mergeDBDataToRealtime(_0x36da5b,_0x2c1f12){var _0xf8b8b9=Object[_0x745f('0x0')]({},_0x36da5b);for(var _0x39526b in _0x2c1f12){if(_0xf8b8b9[_0x745f('0x1')](_0x39526b)){_0xf8b8b9[_0x39526b]=_0x2c1f12[_0x39526b];}}return _0xf8b8b9;}exports[_0x745f('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xd383=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x6fe87f,_0x42d190){var _0x9dddc5=function(_0x138ec5){while(--_0x138ec5){_0x6fe87f['push'](_0x6fe87f['shift']());}};_0x9dddc5(++_0x42d190);}(_0xd383,0xf2));var _0x3d38=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xd383[_0x119d5a];return _0x15bff4;};'use strict';function mergeDBDataToRealtime(_0x1ac645,_0xd548ce){var _0x542d52=Object[_0x3d38('0x0')]({},_0x1ac645);for(var _0x59ee0a in _0xd548ce){if(_0x542d52[_0x3d38('0x1')](_0x59ee0a)){_0x542d52[_0x59ee0a]=_0xd548ce[_0x59ee0a];}}return _0x542d52;}exports[_0x3d38('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 c0d64ad..3402e4a 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 _0x42dd=['create','monitor','monitors','createdAt','xcally-motion-preview','connectedlinenum','connectedlinename','membername','isArray','Local','substring','indexOf','mobile','phone','lastIndexOf','findAgent','transfererlinkedid','attendedTransfer','lodash','moment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','find','accountcode','name','isNil','interface','length','lastAssignedTo','format','SIP/%s','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','lastdata','queue','callerid','from-sip','calleridpreview','originatecalleridnum','channel','disposition','ANSWERED','calleridname','transfers','linkedid','UserId','split'];(function(_0x16d411,_0x5e0970){var _0x20336d=function(_0x15d8aa){while(--_0x15d8aa){_0x16d411['push'](_0x16d411['shift']());}};_0x20336d(++_0x5e0970);}(_0x42dd,0x1bb));var _0xd42d=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x42dd[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xd42d('0x0'));var moment=require(_0xd42d('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0xd42d('0x2'));var RpcVoiceAgentReport=require(_0xd42d('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xd42d('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xd42d('0x5'));var RpcVoiceRecording=require(_0xd42d('0x6'));var RpcVoiceTransferReport=require(_0xd42d('0x7'));var VoiceQueueReport=require(_0xd42d('0x8'));var VoiceCallReport=require(_0xd42d('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xd42d('0xa'));var UserReport=require(_0xd42d('0xb'));function Report(_0x435295){this['realtime']=_0x435295;this['agents']=_0x435295[_0xd42d('0xc')];this[_0xd42d('0xd')]=_0x435295[_0xd42d('0xd')];}Report[_0xd42d('0xe')][_0xd42d('0xf')]=function(_0x4ef4c2){var _0x301bfd=new VoiceQueueReport(this[_0xd42d('0x10')]);var _0xdab5ff=new VoiceAgentReport(this[_0xd42d('0x10')]);var _0x2072e2=new VoiceDialReport(this[_0xd42d('0x10')]);var _0x1a4229=new VoiceCallReport(this[_0xd42d('0x10')]);var _0x54a277=new UserReport(this[_0xd42d('0x10')]);if(config[_0xd42d('0x11')]&&config[_0xd42d('0x11')][_0xd42d('0x12')]){ami['on'](_0xd42d('0x13'),this[_0xd42d('0x14')][_0xd42d('0x15')](this));ami['on'](_0xd42d('0x16'),this[_0xd42d('0x17')][_0xd42d('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0xd42d('0x18')][_0xd42d('0x15')](this));ami['on']('custom:voiceDialReport',this[_0xd42d('0x19')][_0xd42d('0x15')](this));ami['on'](_0xd42d('0x1a'),this[_0xd42d('0x1b')][_0xd42d('0x15')](this));ami['on'](_0xd42d('0x1c'),this['attendedTransfer'][_0xd42d('0x15')](this));}};Report[_0xd42d('0xe')]['findAgent']=function(_0x117d67){var _0xa33270;_0xa33270=_[_0xd42d('0x1d')](this[_0xd42d('0xc')],function(_0x3ad2ad){return _0x3ad2ad[_0xd42d('0x1e')]==_0x117d67||_0x3ad2ad[_0xd42d('0x1f')]==_0x117d67;});if(_[_0xd42d('0x20')](_0xa33270)){var _0x5a4e37=_[_0xd42d('0x1d')](this[_0xd42d('0xd')],function(_0x1523d6){return _0x1523d6[_0xd42d('0x1e')]==_0x117d67||_0x1523d6['name']==_0x117d67;});if(_0x5a4e37){_0xa33270=_[_0xd42d('0x1d')](this[_0xd42d('0xc')],function(_0x2e40ea){return _0x2e40ea[_0xd42d('0x21')]==util['format']('SIP/%s',_0x5a4e37[_0xd42d('0x1f')]);});}}return _0xa33270;};Report[_0xd42d('0xe')][_0xd42d('0x14')]=function(_0x2a4fee){for(var _0x12abe3=0x0;_0x12abe3<_0x2a4fee[_0xd42d('0x22')];_0x12abe3+=0x1){var _0xb390b1=this['findAgent'](_0x2a4fee[_0x12abe3]['connectedlinenum']);if(_0xb390b1){_0x2a4fee[_0x12abe3]['accountcode']=_0xb390b1[_0xd42d('0x1e')];_0x2a4fee[_0x12abe3]['assigned']=!![];_0x2a4fee[_0x12abe3][_0xd42d('0x23')]=_0xb390b1[_0xd42d('0x1f')];_0x2a4fee[_0x12abe3][_0xd42d('0x21')]=_[_0xd42d('0x20')](_0xb390b1[_0xd42d('0x21')])?util[_0xd42d('0x24')](_0xd42d('0x25'),_0xb390b1[_0xd42d('0x1f')]):_0xb390b1[_0xd42d('0x21')];if(_0x2a4fee[_0x12abe3]['queuecallercomplete']){_0x2a4fee[_0x12abe3][_0xd42d('0x26')]=moment()['format'](_0xd42d('0x27'));}if(_0x2a4fee[_0x12abe3]['queuecallerexit']){_0x2a4fee[_0x12abe3][_0xd42d('0x28')]=moment()['format'](_0xd42d('0x27'));}RpcMemberReport['voiceQueueReport'](_0x2a4fee[_0x12abe3]);}RpcVoiceQueueReport['create'](_0x2a4fee[_0x12abe3]);}};function extractCalleridNumber(_0x50b9a4){var _0xe08e20=_0x50b9a4[_0xd42d('0x29')](/<(.*?)>/);return _0xe08e20?_0xe08e20[0x1]:_0x50b9a4;}Report[_0xd42d('0xe')][_0xd42d('0x2a')]=function(_0x378b10){for(var _0x394555=0x0;_0x394555',_0x11b09e[_0xd42d('0x3e')],_0x11b09e[_0xd42d('0x2d')]);}if(RpcVoiceTransferReport[_0xd42d('0x3f')][_0x11b09e[_0xd42d('0x40')]]){var _0x45a01b=RpcVoiceTransferReport[_0xd42d('0x3f')][_0x11b09e[_0xd42d('0x40')]];_0x45a01b['transfereelinkedid']=_0x11b09e['uniqueid'];RpcVoiceTransferReport[_0xd42d('0x1b')](_0x45a01b);delete RpcVoiceTransferReport[_0xd42d('0x3f')][_0x11b09e[_0xd42d('0x40')]];}if(_[_0xd42d('0x20')](_0x11b09e[_0xd42d('0x32')])){_0x11b09e[_0xd42d('0x32')]=this[_0xd42d('0x2c')](_0x11b09e);}if(_[_0xd42d('0x20')](_0x11b09e[_0xd42d('0x41')])){var _0x107574=_0x11b09e[_0xd42d('0x3b')][_0xd42d('0x42')]('-')[0x0];var _0x2c3189=this[_0xd42d('0xc')][_0x107574];if(!_0x2c3189)_0x2c3189=this['getAgentByInternal'](_0x11b09e[_0xd42d('0x1e')]);if(_0x2c3189){_0x11b09e[_0xd42d('0x41')]=_0x2c3189['id'];_0x11b09e['membername']=_0x2c3189[_0xd42d('0x1f')];}}RpcVoiceCallReport[_0xd42d('0x43')](_0x11b09e);if(_0x11b09e[_0xd42d('0x44')]){for(var _0x38ecc2=0x0;_0x38ecc2<_0x11b09e[_0xd42d('0x45')][_0xd42d('0x22')];_0x38ecc2+=0x1){_0x11b09e['monitorFilename']=_0x11b09e[_0xd42d('0x45')][_0x38ecc2]['filename'];_0x11b09e['createdAt']=_0x11b09e[_0xd42d('0x45')][_0x38ecc2][_0xd42d('0x46')];if(_0x11b09e[_0xd42d('0x31')]==_0xd42d('0x47')){_0x11b09e[_0xd42d('0x2d')]=_0x11b09e[_0xd42d('0x48')];_0x11b09e[_0xd42d('0x3e')]=_0x11b09e[_0xd42d('0x49')];_0x11b09e[_0xd42d('0x48')]=_0x11b09e[_0xd42d('0x1e')];_0x11b09e[_0xd42d('0x49')]=_0x11b09e[_0xd42d('0x4a')];_0x11b09e[_0xd42d('0x31')]=_0x11b09e[_0xd42d('0x3a')];}else if(_0x11b09e['exten']=='xcally-motion-dialer'){_0x11b09e[_0xd42d('0x2d')]=_0x11b09e[_0xd42d('0x30')];_0x11b09e[_0xd42d('0x31')]=_0x11b09e[_0xd42d('0x3a')];}RpcVoiceRecording[_0xd42d('0x43')](_0x11b09e);}}};Report[_0xd42d('0xe')][_0xd42d('0x18')]=function(_0x2322a6){if(_[_0xd42d('0x4b')](_0x2322a6)){_0x2322a6['forEach'](function(_0x5e116b){RpcVoiceAgentReport[_0xd42d('0x43')](_0x5e116b);});}else{RpcVoiceAgentReport[_0xd42d('0x43')](_0x2322a6);}};Report[_0xd42d('0xe')][_0xd42d('0x19')]=function(_0x15cd7f){RpcVoiceDialReport[_0xd42d('0x43')](_0x15cd7f);var _0x3e285f;var _0xd87043;var _0x819276=_0x15cd7f[_0xd42d('0x3b')];if(_['startsWith'](_0x819276,_0xd42d('0x4c'))){_0xd87043=_0x819276[_0xd42d('0x4d')](_0x819276[_0xd42d('0x4e')]('/')+0x1,_0x819276[_0xd42d('0x4e')]('@'));_0x3e285f=_[_0xd42d('0x1d')](this['agents'],function(_0x35fdf7){return _0x35fdf7[_0xd42d('0x4f')]==_0xd87043||_0x35fdf7[_0xd42d('0x50')]==_0xd87043||_0x35fdf7['accountcode']==_0xd87043;});}else{_0xd87043=_0x819276[_0xd42d('0x4d')](_0x819276[_0xd42d('0x4e')]('/')+0x1,_0x819276[_0xd42d('0x51')]('-'));_0x3e285f=this[_0xd42d('0x52')](_0xd87043);}if(_0x3e285f){_0x15cd7f[_0xd42d('0x21')]=_[_0xd42d('0x20')](_0x3e285f['interface'])?util[_0xd42d('0x24')](_0xd42d('0x25'),_0x3e285f['name']):_0x3e285f[_0xd42d('0x21')];_0x15cd7f[_0xd42d('0x4a')]=_0x3e285f[_0xd42d('0x1f')];_0x15cd7f['accountcode']=_0x3e285f['accountcode'];RpcMemberReport[_0xd42d('0x19')](_0x15cd7f);}};Report[_0xd42d('0xe')][_0xd42d('0x1b')]=function(_0xd3c2b6){RpcVoiceTransferReport['transfers'][_0xd3c2b6[_0xd42d('0x53')]]=_0xd3c2b6;};Report[_0xd42d('0xe')][_0xd42d('0x54')]=function(_0x58d57e){RpcVoiceTransferReport[_0xd42d('0x54')](_0x58d57e);};module['exports']=Report; \ No newline at end of file +var _0x4a6c=['internal','destination','exten','type','lastapplication','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','uniqueid','UserId','membername','create','monitorFilename','filename','monitors','createdAt','connectedlinename','xcally-motion-dialer','forEach','startsWith','indexOf','phone','transfererlinkedid','attendedTransfer','lodash','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','prototype','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','assigned','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','channel','split','outbound'];(function(_0x49d1bf,_0x5c4add){var _0x5cc744=function(_0x57eee3){while(--_0x57eee3){_0x49d1bf['push'](_0x49d1bf['shift']());}};_0x5cc744(++_0x5c4add);}(_0x4a6c,0x74));var _0xc4a6=function(_0x566a2f,_0x405c7b){_0x566a2f=_0x566a2f-0x0;var _0x186c75=_0x4a6c[_0x566a2f];return _0x186c75;};'use strict';var _=require(_0xc4a6('0x0'));var moment=require('moment');var util=require('util');var config=require('../../../config/environment');var ami=require(_0xc4a6('0x1'));var RpcVoiceAgentReport=require(_0xc4a6('0x2'));var RpcVoiceCallReport=require(_0xc4a6('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xc4a6('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xc4a6('0x5'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xc4a6('0x6'));var VoiceCallReport=require(_0xc4a6('0x7'));var VoiceAgentReport=require(_0xc4a6('0x8'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xc4a6('0x9'));function Report(_0x1e23fc){this[_0xc4a6('0xa')]=_0x1e23fc;this[_0xc4a6('0xb')]=_0x1e23fc['agents'];this['telephones']=_0x1e23fc['telephones'];}Report[_0xc4a6('0xc')]['sync']=function(_0x3307c){var _0x4ad7af=new VoiceQueueReport(this[_0xc4a6('0xa')]);var _0x1ca209=new VoiceAgentReport(this[_0xc4a6('0xa')]);var _0xbbf2e1=new VoiceDialReport(this[_0xc4a6('0xa')]);var _0x49a720=new VoiceCallReport(this[_0xc4a6('0xa')]);var _0x1f0b77=new UserReport(this[_0xc4a6('0xa')]);if(config['xdr']&&config['xdr']['disabled']){ami['on'](_0xc4a6('0xd'),this[_0xc4a6('0xe')][_0xc4a6('0xf')](this));ami['on']('custom:voiceCallReport',this[_0xc4a6('0x10')][_0xc4a6('0xf')](this));ami['on']('custom:voiceAgentReport',this[_0xc4a6('0x11')]['bind'](this));ami['on'](_0xc4a6('0x12'),this[_0xc4a6('0x13')]['bind'](this));ami['on']('blindtransfer',this[_0xc4a6('0x14')]['bind'](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xc4a6('0xf')](this));}};Report[_0xc4a6('0xc')][_0xc4a6('0x15')]=function(_0x51c710){var _0x442479;_0x442479=_[_0xc4a6('0x16')](this[_0xc4a6('0xb')],function(_0x2deb9f){return _0x2deb9f[_0xc4a6('0x17')]==_0x51c710||_0x2deb9f[_0xc4a6('0x18')]==_0x51c710;});if(_[_0xc4a6('0x19')](_0x442479)){var _0x3792d6=_[_0xc4a6('0x16')](this['telephones'],function(_0x3c3aed){return _0x3c3aed[_0xc4a6('0x17')]==_0x51c710||_0x3c3aed['name']==_0x51c710;});if(_0x3792d6){_0x442479=_['find'](this[_0xc4a6('0xb')],function(_0x463441){return _0x463441[_0xc4a6('0x1a')]==util[_0xc4a6('0x1b')](_0xc4a6('0x1c'),_0x3792d6[_0xc4a6('0x18')]);});}}return _0x442479;};Report[_0xc4a6('0xc')][_0xc4a6('0xe')]=function(_0x2a1336){for(var _0x3eb21c=0x0;_0x3eb21c<_0x2a1336[_0xc4a6('0x1d')];_0x3eb21c+=0x1){var _0x50188f=this['findAgent'](_0x2a1336[_0x3eb21c]['connectedlinenum']);if(_0x50188f){_0x2a1336[_0x3eb21c][_0xc4a6('0x17')]=_0x50188f[_0xc4a6('0x17')];_0x2a1336[_0x3eb21c][_0xc4a6('0x1e')]=!![];_0x2a1336[_0x3eb21c]['lastAssignedTo']=_0x50188f[_0xc4a6('0x18')];_0x2a1336[_0x3eb21c]['interface']=_[_0xc4a6('0x19')](_0x50188f[_0xc4a6('0x1a')])?util[_0xc4a6('0x1b')](_0xc4a6('0x1c'),_0x50188f[_0xc4a6('0x18')]):_0x50188f[_0xc4a6('0x1a')];if(_0x2a1336[_0x3eb21c][_0xc4a6('0x1f')]){_0x2a1336[_0x3eb21c]['queuecallercompleteAt']=moment()[_0xc4a6('0x1b')](_0xc4a6('0x20'));}if(_0x2a1336[_0x3eb21c][_0xc4a6('0x21')]){_0x2a1336[_0x3eb21c][_0xc4a6('0x22')]=moment()[_0xc4a6('0x1b')](_0xc4a6('0x20'));}RpcMemberReport[_0xc4a6('0xe')](_0x2a1336[_0x3eb21c]);}RpcVoiceQueueReport['create'](_0x2a1336[_0x3eb21c]);}};function extractCalleridNumber(_0x5cb91d){var _0x4078bb=_0x5cb91d[_0xc4a6('0x23')](/<(.*?)>/);return _0x4078bb?_0x4078bb[0x1]:_0x5cb91d;}Report[_0xc4a6('0xc')][_0xc4a6('0x24')]=function(_0x47c451){for(var _0x409998=0x0;_0x4099980x0?!![]:![];if(!_0x31b115){return this['syncQueueSummaryComplete'](this[_0xe6dc('0x12')][_0xe6dc('0x6d')]);}};VoiceQueueReport[_0xe6dc('0x9')][_0xe6dc('0x16')]=function(_0x37e1ed){var _0x36eff0=this[_0xe6dc('0x12')]['id'];if(this[_0xe6dc('0x12')]['queuestatus'][_0x36eff0]&&this['summary'][_0xe6dc('0x62')][_0x36eff0][_0x37e1ed['actionid']]){this['summary']['queuestatus'][_0x36eff0][_0x37e1ed['actionid']][_0xe6dc('0xe')]['push'](_0x37e1ed);}};VoiceQueueReport[_0xe6dc('0x9')]['syncQueueSummary']=function(_0x5095ee){var _0x424665=this;try{if(this[_0xe6dc('0x5b')](_0x5095ee)&&this[_0xe6dc('0x5b')](_0x5095ee[_0xe6dc('0x4e')])){logger[_0xe6dc('0x52')](_0xe6dc('0x6e'),util[_0xe6dc('0x43')](_0x5095ee,{'showHidden':![],'depth':null}));var _0x478f1d=this['voiceQueues'][_0x5095ee['queue']];if(_0x478f1d){logger[_0xe6dc('0x6f')](_0xe6dc('0x70'),_0x478f1d[_0xe6dc('0x69')]);this[_0xe6dc('0x12')]['queues'][_0x478f1d[_0xe6dc('0x69')]]={'summaryEvent':_0x5095ee};this['summary'][_0xe6dc('0x6c')]+=0x1;return ami[_0xe6dc('0x3a')]({'action':_0xe6dc('0x62'),'queue':_0x478f1d[_0xe6dc('0x69')]})['then'](function(_0x3fa190){if(!_0x424665[_0xe6dc('0x12')][_0xe6dc('0x62')][_0x5095ee[_0xe6dc('0x60')]]){_0x424665[_0xe6dc('0x12')][_0xe6dc('0x62')][_0x5095ee[_0xe6dc('0x60')]]={};}_0x424665[_0xe6dc('0x12')][_0xe6dc('0x62')][_0x5095ee[_0xe6dc('0x60')]][_0x3fa190['actionid']]={'queue':_0x478f1d['name'],'agents':[]};})[_0xe6dc('0x3c')](function(_0x479e7e){throw _0x479e7e;});}}}catch(_0xbc530a){logger['error'](_0xe6dc('0x71'),util[_0xe6dc('0x43')](_0xbc530a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6dc('0x9')][_0xe6dc('0x72')]=function(_0x276842){if(this['summary'][_0xe6dc('0x6c')]>0x0){this[_0xe6dc('0x12')][_0xe6dc('0x6d')]=_0x276842;return;}logger[_0xe6dc('0x52')](_0xe6dc('0x73'),util[_0xe6dc('0x43')](_0x276842,{'showHidden':![],'depth':null}));this[_0xe6dc('0x12')]=initializeSummary();ami[_0xe6dc('0x47')](_0xe6dc('0x74'),{});};VoiceQueueReport[_0xe6dc('0x9')][_0xe6dc('0x19')]=function(_0x5e14ef){try{if(this[_0xe6dc('0x5b')](_0x5e14ef)){logger[_0xe6dc('0x52')](_0xe6dc('0x75'),_0x5e14ef[_0xe6dc('0x4b')],util['inspect'](_0x5e14ef,{'showHidden':![],'depth':null}));if(_[_0xe6dc('0x5c')](this[_0xe6dc('0x41')][_0x5e14ef['uniqueid']])){this[_0xe6dc('0x41')][_0x5e14ef[_0xe6dc('0x4b')]]=[];}if(_['isUndefined'](this['channels'][_0x5e14ef['uniqueid']])){this[_0xe6dc('0x37')][_0x5e14ef['uniqueid']]={};}var _0x405a42=new QueueReport();_0x405a42[_0xe6dc('0x4e')]=_0x5e14ef[_0xe6dc('0x4e')];_0x405a42['type']=this[_0xe6dc('0x10')][_0x405a42[_0xe6dc('0x4e')]]&&this[_0xe6dc('0x10')][_0x405a42['queue']][_0xe6dc('0x58')]?this[_0xe6dc('0x10')][_0x405a42[_0xe6dc('0x4e')]][_0xe6dc('0x58')]||'inbound':_0xe6dc('0x59');_0x405a42['queuecallerjoinAt']=moment()[_0xe6dc('0x4c')](_0xe6dc('0x76'));_0x405a42[_0xe6dc('0x77')]=_0x5e14ef[_0xe6dc('0x77')];_0x405a42[_0xe6dc('0x78')]=_0x5e14ef[_0xe6dc('0x78')];_0x405a42[_0xe6dc('0x4b')]=_0x5e14ef[_0xe6dc('0x4b')];_0x405a42[_0xe6dc('0x79')]=this[_0xe6dc('0x37')][_0x5e14ef['uniqueid']][_0xe6dc('0x79')];logger['info'](_0xe6dc('0x7a'),_0x405a42[_0xe6dc('0x4e')],_0x405a42[_0xe6dc('0x58')]);_[_0xe6dc('0x7b')](_0x405a42,_['pick'](_0x5e14ef,_[_0xe6dc('0x7c')](_0x405a42)));this[_0xe6dc('0x41')][_0x5e14ef[_0xe6dc('0x4b')]][_0xe6dc('0x7d')](_0x405a42);this[_0xe6dc('0x37')][_0x5e14ef[_0xe6dc('0x4b')]]=_0x405a42;this['emitVoiceQueueChannelSave'](_0x405a42,_0xe6dc('0x18'));}}catch(_0x101950){logger['error'](_0xe6dc('0x75'),_0x5e14ef[_0xe6dc('0x4b')],util[_0xe6dc('0x43')](_0x101950,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6dc('0x9')]['syncQueueCallerAbandon']=function(_0x300f3c){try{if(this[_0xe6dc('0x5b')](_0x300f3c)){logger[_0xe6dc('0x52')](_0xe6dc('0x7e'),_0x300f3c['uniqueid'],util['inspect'](_0x300f3c,{'showHidden':![],'depth':null}));if(this[_0xe6dc('0x41')][_0x300f3c['uniqueid']]){var _0x14de0f=_[_0xe6dc('0x7f')](this[_0xe6dc('0x41')][_0x300f3c[_0xe6dc('0x4b')]]);_0x14de0f['queuecallercomplete']=![];_0x14de0f[_0xe6dc('0x80')]=null;_0x14de0f[_0xe6dc('0x81')]=_0x300f3c[_0xe6dc('0x81')];_0x14de0f[_0xe6dc('0x82')]=_0x300f3c[_0xe6dc('0x82')];_0x14de0f[_0xe6dc('0x1a')]=!![];_0x14de0f['queuecallerabandonAt']=moment()[_0xe6dc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x14de0f[_0xe6dc('0x83')]=_0xe6dc('0x84');_0x14de0f[_0xe6dc('0x85')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x14de0f[_0xe6dc('0x4e')],_0x14de0f['type']);this[_0xe6dc('0x37')][_0x300f3c[_0xe6dc('0x4b')]]=_0x14de0f;this[_0xe6dc('0x51')](_0x14de0f,'queuecallerabandon');}}}catch(_0xd5439d){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x300f3c[_0xe6dc('0x4b')],util[_0xe6dc('0x43')](_0xd5439d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6dc('0x9')][_0xe6dc('0x1c')]=function(_0x26e7f1){try{if(this[_0xe6dc('0x5b')](_0x26e7f1)){logger[_0xe6dc('0x52')](_0xe6dc('0x86'),_0x26e7f1[_0xe6dc('0x4b')],util['inspect'](_0x26e7f1,{'showHidden':![],'depth':null}));if(this[_0xe6dc('0x41')][_0x26e7f1['uniqueid']]){var _0x3fb8a6=_['last'](this['queueReports'][_0x26e7f1[_0xe6dc('0x4b')]]);_0x3fb8a6[_0xe6dc('0x87')]=moment()['format'](_0xe6dc('0x76'));_0x3fb8a6[_0xe6dc('0x88')]=_0x26e7f1[_0xe6dc('0x88')];_0x3fb8a6[_0xe6dc('0x89')]=_0x26e7f1['connectedlinename'];logger[_0xe6dc('0x6f')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3fb8a6[_0xe6dc('0x4e')],_0x3fb8a6[_0xe6dc('0x58')],_0x26e7f1['connectedlinenum'],_0x26e7f1['connectedlinename']);this[_0xe6dc('0x37')][_0x26e7f1[_0xe6dc('0x4b')]]=_0x3fb8a6;this[_0xe6dc('0x48')](_0x3fb8a6,'queuecallerleave');}}}catch(_0xef66d1){logger[_0xe6dc('0x3f')](_0xe6dc('0x86'),_0x26e7f1[_0xe6dc('0x4b')],util[_0xe6dc('0x43')](_0xef66d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6dc('0x9')][_0xe6dc('0x1f')]=function(_0x1bd698){try{if(this[_0xe6dc('0x5b')](_0x1bd698)){logger[_0xe6dc('0x52')](_0xe6dc('0x8a'),_0x1bd698[_0xe6dc('0x4b')],util[_0xe6dc('0x43')](_0x1bd698,{'showHidden':![],'depth':null}));if(this[_0xe6dc('0x41')][_0x1bd698[_0xe6dc('0x4b')]]){var _0x5da265=_[_0xe6dc('0x7f')](this[_0xe6dc('0x41')][_0x1bd698[_0xe6dc('0x4b')]]);_0x5da265[_0xe6dc('0x8b')]=!![];_0x5da265[_0xe6dc('0x83')]=_0xe6dc('0x8c');logger[_0xe6dc('0x6f')](_0xe6dc('0x8d'),_0x5da265['queue'],_0x5da265[_0xe6dc('0x58')]);}}}catch(_0xcb202a){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x1bd698[_0xe6dc('0x4b')],util[_0xe6dc('0x43')](_0xcb202a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6dc('0x9')][_0xe6dc('0x8e')]=function(_0x5309da){try{if(this[_0xe6dc('0x5b')](_0x5309da)){logger[_0xe6dc('0x52')](_0xe6dc('0x8f'),_0x5309da['uniqueid'],util[_0xe6dc('0x43')](_0x5309da,{'showHidden':![],'depth':null}));if(this[_0xe6dc('0x41')][_0x5309da[_0xe6dc('0x4b')]]){var _0x55bf8f=_[_0xe6dc('0x7f')](this['queueReports'][_0x5309da[_0xe6dc('0x4b')]]);_0x55bf8f[_0xe6dc('0x1a')]=![];_0x55bf8f[_0xe6dc('0x90')]=null;_0x55bf8f[_0xe6dc('0x91')]=!![];_0x55bf8f[_0xe6dc('0x85')]=_0x5309da[_0xe6dc('0x92')];_0x55bf8f[_0xe6dc('0x81')]=_0x5309da[_0xe6dc('0x81')];_0x55bf8f[_0xe6dc('0x8b')]=!![];_0x55bf8f[_0xe6dc('0x93')]=![];_0x55bf8f[_0xe6dc('0x94')]=null;if(!_0x55bf8f[_0xe6dc('0x95')]){if(_0x5309da[_0xe6dc('0x96')]==_0xe6dc('0x95')){_0x55bf8f[_0xe6dc('0x83')]='COMPLETED';logger['info'](_0xe6dc('0x97'),_0x55bf8f['queue'],_0x55bf8f[_0xe6dc('0x58')]);}else{if(_[_0xe6dc('0x98')](_0x5309da[_0xe6dc('0x99')][_0xe6dc('0x9a')](),_0xe6dc('0x9b'))){if(this[_0xe6dc('0x41')][_0x5309da['linkedid']]){var _0x5ad4b8=_['last'](this['queueReports'][_0x5309da[_0xe6dc('0x9c')]]);_0x5ad4b8['queuecallercomplete']=![];_0x5ad4b8[_0xe6dc('0x93')]=!![];_0x5ad4b8[_0xe6dc('0x94')]=moment(_0x55bf8f[_0xe6dc('0x9d')])['add'](_0x5309da['holdtime'],_0xe6dc('0x9e'))[_0xe6dc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ad4b8['queuecallerexitreason']='FORWARDTRANSFER';_0x5ad4b8[_0xe6dc('0x95')]=!![];_0x5ad4b8[_0xe6dc('0x9f')]=_0xe6dc('0xa0');_0x5ad4b8[_0xe6dc('0xa1')]=_0x5309da[_0xe6dc('0xa2')];_0x5ad4b8[_0xe6dc('0xa3')]=_0x5309da[_0xe6dc('0x4b')];logger['info'](_0xe6dc('0xa4'),_0x5ad4b8[_0xe6dc('0x4e')],_0x5ad4b8['type']);var _0x41744a=this['queueReports'][_0x5309da[_0xe6dc('0x9c')]];this[_0xe6dc('0x41')][_0x5309da['linkedid']]=this[_0xe6dc('0x41')][_0x5309da[_0xe6dc('0x4b')]];this[_0xe6dc('0x41')][_0x5309da['uniqueid']]=_0x41744a;}}else{_0x55bf8f[_0xe6dc('0x83')]=_0xe6dc('0xa5')+_0x5309da[_0xe6dc('0x96')]['toUpperCase']();logger[_0xe6dc('0x6f')](_0xe6dc('0xa6'),_0x55bf8f[_0xe6dc('0x4e')],_0x55bf8f[_0xe6dc('0x58')],_0x55bf8f[_0xe6dc('0x83')]);}}}this['channels'][_0x5309da['uniqueid']]=_0x55bf8f;}}}catch(_0x5a7249){logger[_0xe6dc('0x3f')](_0xe6dc('0x8f'),_0x5309da[_0xe6dc('0x4b')],util['inspect'](_0x5a7249,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6dc('0x9')][_0xe6dc('0x21')]=function(_0x594198){try{if(this[_0xe6dc('0x5b')](_0x594198)){logger['debug'](_0xe6dc('0xa7'),_0x594198[_0xe6dc('0x4b')],util[_0xe6dc('0x43')](_0x594198,{'showHidden':![],'depth':null}));this['addVariable'](_0x594198[_0xe6dc('0x4b')],_[_0xe6dc('0x7c')](_0x594198[_0xe6dc('0xa8')])[0x0],_0x594198[_0xe6dc('0xa9')]);if(this['queueReports'][_0x594198[_0xe6dc('0x4b')]]){var _0x33d49d=_[_0xe6dc('0x7f')](this[_0xe6dc('0x41')][_0x594198['uniqueid']]);if(_0x33d49d){if(this[_0xe6dc('0x5b')](_0x594198[_0xe6dc('0xa8')])&&this['isNotNull'](_0x594198[_0xe6dc('0xa8')][_0xe6dc('0x62')])){switch(_0x594198[_0xe6dc('0xa9')]){case _0xe6dc('0xaa'):_0x33d49d['queuecallerexit']=![];_0x33d49d[_0xe6dc('0x94')]=null;break;case'TIMEOUT':_0x33d49d['lastevent']=_0xe6dc('0xab');_0x33d49d[_0xe6dc('0x93')]=!![];_0x33d49d[_0xe6dc('0x94')]=moment()[_0xe6dc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x33d49d[_0xe6dc('0x87')]=moment()[_0xe6dc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xe6dc('0xac'),_0x594198['uniqueid'],util['inspect'](_0x33d49d,{'showHidden':![],'depth':null}));ami[_0xe6dc('0x47')](_0xe6dc('0xad'),_0x33d49d);break;default:_0x33d49d['queuecallerexit']=!![];_0x33d49d[_0xe6dc('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x33d49d[_0xe6dc('0x87')]=moment()['format'](_0xe6dc('0x76'));}_0x33d49d[_0xe6dc('0x1a')]=![];_0x33d49d[_0xe6dc('0x90')]=null;_0x33d49d[_0xe6dc('0x83')]=_0x594198[_0xe6dc('0xa9')];this[_0xe6dc('0x37')][_0x594198[_0xe6dc('0x4b')]]=_0x33d49d;this[_0xe6dc('0x51')](_0x33d49d,_0xe6dc('0x20'));}else if(this[_0xe6dc('0x5b')](_0x594198[_0xe6dc('0xa8')])&&this[_0xe6dc('0x5b')](_0x594198[_0xe6dc('0xa8')]['queueposition'])){if(!_0x33d49d[_0xe6dc('0x1a')]){_0x33d49d[_0xe6dc('0x93')]=!![];_0x33d49d[_0xe6dc('0x94')]=moment()[_0xe6dc('0x4c')](_0xe6dc('0x76'));_0x33d49d[_0xe6dc('0x83')]='EXITWITHKEY';_0x33d49d[_0xe6dc('0x87')]=moment()[_0xe6dc('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe6dc('0x37')][_0x594198[_0xe6dc('0x4b')]]=_0x33d49d;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x594198['uniqueid'],_0x33d49d[_0xe6dc('0x4e')],_0x33d49d[_0xe6dc('0x58')],_[_0xe6dc('0x7c')](_0x594198[_0xe6dc('0xa8')])[0x0],_0x594198[_0xe6dc('0xa9')]);_0x33d49d[_0xe6dc('0x44')]=this[_0xe6dc('0x44')][_0x594198['uniqueid']];}}}}catch(_0x5ee330){logger[_0xe6dc('0x3f')](_0xe6dc('0xa7'),_0x594198[_0xe6dc('0x4b')],util[_0xe6dc('0x43')](_0x5ee330,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe6dc('0x9')]['addVariable']=function(_0x33f003,_0x564568,_0x5e33bd){var _0x2c1e1e=[_0xe6dc('0xae'),'rtpaudioqosbridged',_0xe6dc('0xaf'),_0xe6dc('0xb0'),_0xe6dc('0xb1'),_0xe6dc('0xb2'),_0xe6dc('0xb3'),'rtpaudioqosrttbridged','sipcallid',_0xe6dc('0xb4'),'bridgepeer',_0xe6dc('0xb5'),_0xe6dc('0xb6'),_0xe6dc('0xb7'),_0xe6dc('0xb8'),'memberlastcall',_0xe6dc('0x92'),'memberpenalty',_0xe6dc('0xb9')];if(!_['isNil'](_0x564568)&&!_['includes'](_0x2c1e1e,_0x564568)){if(_[_0xe6dc('0x5c')](this[_0xe6dc('0x44')][_0x33f003])){this[_0xe6dc('0x44')][_0x33f003]={};}this[_0xe6dc('0x44')][_0x33f003][_0x564568]=_0x5e33bd;}};VoiceQueueReport[_0xe6dc('0x9')][_0xe6dc('0xba')]=function(_0x5ed3f3,_0x54f000,_0x4fc745){var _0x589b5d={};for(var _0x3ae956=0x0;_0x3ae9560x0?!![]:![];if(!_0x3d9419){return this[_0x9cc2('0x18')](this['summary']['completeEvent']);}};VoiceQueueReport[_0x9cc2('0xa')]['syncQueueMember']=function(_0xf53c3f){var _0x55621c=this[_0x9cc2('0x13')]['id'];if(this['summary'][_0x9cc2('0x64')][_0x55621c]&&this['summary'][_0x9cc2('0x64')][_0x55621c][_0xf53c3f[_0x9cc2('0x62')]]){this[_0x9cc2('0x13')][_0x9cc2('0x64')][_0x55621c][_0xf53c3f[_0x9cc2('0x62')]]['agents'][_0x9cc2('0x6f')](_0xf53c3f);}};VoiceQueueReport[_0x9cc2('0xa')][_0x9cc2('0x15')]=function(_0x1f1801){var _0x8fb246=this;try{if(this[_0x9cc2('0x5b')](_0x1f1801)&&this['isNotNull'](_0x1f1801[_0x9cc2('0x4f')])){logger[_0x9cc2('0x4a')](_0x9cc2('0x70'),util[_0x9cc2('0x44')](_0x1f1801,{'showHidden':![],'depth':null}));var _0x21b6bb=this[_0x9cc2('0x11')][_0x1f1801[_0x9cc2('0x4f')]];if(_0x21b6bb){logger[_0x9cc2('0x71')](_0x9cc2('0x72'),_0x21b6bb[_0x9cc2('0x59')]);this[_0x9cc2('0x13')]['queues'][_0x21b6bb[_0x9cc2('0x59')]]={'summaryEvent':_0x1f1801};this[_0x9cc2('0x13')][_0x9cc2('0x6e')]+=0x1;return ami[_0x9cc2('0x3a')]({'action':'queuestatus','queue':_0x21b6bb[_0x9cc2('0x59')]})[_0x9cc2('0x61')](function(_0x1ffe12){if(!_0x8fb246[_0x9cc2('0x13')][_0x9cc2('0x64')][_0x1f1801['actionid']]){_0x8fb246['summary'][_0x9cc2('0x64')][_0x1f1801[_0x9cc2('0x62')]]={};}_0x8fb246[_0x9cc2('0x13')][_0x9cc2('0x64')][_0x1f1801['actionid']][_0x1ffe12['actionid']]={'queue':_0x21b6bb[_0x9cc2('0x59')],'agents':[]};})[_0x9cc2('0x3d')](function(_0x4f41e3){throw _0x4f41e3;});}}}catch(_0x6ebf2b){logger[_0x9cc2('0x40')](_0x9cc2('0x73'),util[_0x9cc2('0x44')](_0x6ebf2b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9cc2('0x18')]=function(_0x1eef4a){if(this[_0x9cc2('0x13')][_0x9cc2('0x6e')]>0x0){this[_0x9cc2('0x13')]['completeEvent']=_0x1eef4a;return;}logger[_0x9cc2('0x4a')](_0x9cc2('0x74'),util['inspect'](_0x1eef4a,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x9cc2('0x48')](_0x9cc2('0x75'),{});};VoiceQueueReport[_0x9cc2('0xa')][_0x9cc2('0x1e')]=function(_0x3a9fc4){try{if(this[_0x9cc2('0x5b')](_0x3a9fc4)){logger[_0x9cc2('0x4a')](_0x9cc2('0x76'),_0x3a9fc4[_0x9cc2('0x52')],util['inspect'](_0x3a9fc4,{'showHidden':![],'depth':null}));if(_[_0x9cc2('0x5c')](this[_0x9cc2('0xc')][_0x3a9fc4['uniqueid']])){this[_0x9cc2('0xc')][_0x3a9fc4['uniqueid']]=[];}if(_[_0x9cc2('0x5c')](this['channels'][_0x3a9fc4['uniqueid']])){this['channels'][_0x3a9fc4[_0x9cc2('0x52')]]={};}var _0x145ccb=new QueueReport();_0x145ccb['queue']=_0x3a9fc4[_0x9cc2('0x4f')];_0x145ccb[_0x9cc2('0x57')]=this['voiceQueues'][_0x145ccb['queue']]&&this[_0x9cc2('0x11')][_0x145ccb[_0x9cc2('0x4f')]]['type']?this[_0x9cc2('0x11')][_0x145ccb[_0x9cc2('0x4f')]][_0x9cc2('0x57')]||_0x9cc2('0x6b'):'inbound';_0x145ccb[_0x9cc2('0x77')]=moment()['format'](_0x9cc2('0x78'));_0x145ccb[_0x9cc2('0x79')]=_0x3a9fc4['position'];_0x145ccb[_0x9cc2('0x7a')]=_0x3a9fc4[_0x9cc2('0x7a')];_0x145ccb['uniqueid']=_0x3a9fc4['uniqueid'];_0x145ccb['routealias']=this[_0x9cc2('0xf')][_0x3a9fc4[_0x9cc2('0x52')]][_0x9cc2('0x7b')];logger[_0x9cc2('0x71')](_0x9cc2('0x7c'),_0x145ccb[_0x9cc2('0x4f')],_0x145ccb[_0x9cc2('0x57')]);_['merge'](_0x145ccb,_[_0x9cc2('0x7d')](_0x3a9fc4,_['keys'](_0x145ccb)));this['queueReports'][_0x3a9fc4[_0x9cc2('0x52')]]['push'](_0x145ccb);this[_0x9cc2('0xf')][_0x3a9fc4['uniqueid']]=_0x145ccb;this[_0x9cc2('0x49')](_0x145ccb,_0x9cc2('0x1d'));}}catch(_0x16a3b8){logger[_0x9cc2('0x40')](_0x9cc2('0x76'),_0x3a9fc4[_0x9cc2('0x52')],util[_0x9cc2('0x44')](_0x16a3b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x67832d){try{if(this['isNotNull'](_0x67832d)){logger[_0x9cc2('0x4a')](_0x9cc2('0x7e'),_0x67832d[_0x9cc2('0x52')],util[_0x9cc2('0x44')](_0x67832d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x67832d['uniqueid']]){var _0x161718=_[_0x9cc2('0x7f')](this[_0x9cc2('0xc')][_0x67832d[_0x9cc2('0x52')]]);_0x161718[_0x9cc2('0x80')]=![];_0x161718[_0x9cc2('0x81')]=null;_0x161718[_0x9cc2('0x82')]=_0x67832d[_0x9cc2('0x82')];_0x161718[_0x9cc2('0x83')]=_0x67832d['originalposition'];_0x161718[_0x9cc2('0x1f')]=!![];_0x161718[_0x9cc2('0x84')]=moment()[_0x9cc2('0x4d')](_0x9cc2('0x78'));_0x161718[_0x9cc2('0x53')]=_0x9cc2('0x85');_0x161718['lastAssignedTo']=null;logger[_0x9cc2('0x71')](_0x9cc2('0x86'),_0x161718['queue'],_0x161718[_0x9cc2('0x57')]);this['channels'][_0x67832d['uniqueid']]=_0x161718;this[_0x9cc2('0x51')](_0x161718,_0x9cc2('0x1f'));}}}catch(_0x4cc05c){logger[_0x9cc2('0x40')](_0x9cc2('0x7e'),_0x67832d[_0x9cc2('0x52')],util[_0x9cc2('0x44')](_0x4cc05c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9cc2('0xa')][_0x9cc2('0x22')]=function(_0x4dee29){try{if(this['isNotNull'](_0x4dee29)){logger[_0x9cc2('0x4a')](_0x9cc2('0x87'),_0x4dee29[_0x9cc2('0x52')],util[_0x9cc2('0x44')](_0x4dee29,{'showHidden':![],'depth':null}));if(this[_0x9cc2('0xc')][_0x4dee29[_0x9cc2('0x52')]]){var _0xb99cf7=_[_0x9cc2('0x7f')](this['queueReports'][_0x4dee29[_0x9cc2('0x52')]]);_0xb99cf7[_0x9cc2('0x88')]=moment()[_0x9cc2('0x4d')](_0x9cc2('0x78'));_0xb99cf7['connectedlinenum']=_0x4dee29[_0x9cc2('0x89')];_0xb99cf7['connectedlinename']=_0x4dee29['connectedlinename'];logger[_0x9cc2('0x71')](_0x9cc2('0x8a'),_0xb99cf7[_0x9cc2('0x4f')],_0xb99cf7[_0x9cc2('0x57')],_0x4dee29[_0x9cc2('0x89')],_0x4dee29[_0x9cc2('0x8b')]);this[_0x9cc2('0xf')][_0x4dee29['uniqueid']]=_0xb99cf7;this[_0x9cc2('0x49')](_0xb99cf7,_0x9cc2('0x21'));}}}catch(_0x467606){logger['error'](_0x9cc2('0x87'),_0x4dee29[_0x9cc2('0x52')],util[_0x9cc2('0x44')](_0x467606,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9cc2('0xa')]['syncAgentConnect']=function(_0x3493cf){try{if(this[_0x9cc2('0x5b')](_0x3493cf)){logger[_0x9cc2('0x4a')](_0x9cc2('0x8c'),_0x3493cf['uniqueid'],util[_0x9cc2('0x44')](_0x3493cf,{'showHidden':![],'depth':null}));if(this[_0x9cc2('0xc')][_0x3493cf[_0x9cc2('0x52')]]){var _0x2221fa=_[_0x9cc2('0x7f')](this[_0x9cc2('0xc')][_0x3493cf[_0x9cc2('0x52')]]);_0x2221fa['queuecallercomplete']=!![];_0x2221fa['queuecallerexitreason']=_0x9cc2('0x8d');logger['info'](_0x9cc2('0x8e'),_0x2221fa['queue'],_0x2221fa[_0x9cc2('0x57')]);}}}catch(_0x1274a4){logger[_0x9cc2('0x40')](_0x9cc2('0x8c'),_0x3493cf[_0x9cc2('0x52')],util['inspect'](_0x1274a4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9cc2('0x23')]=function(_0x40dc22){try{if(this[_0x9cc2('0x5b')](_0x40dc22)){logger[_0x9cc2('0x4a')](_0x9cc2('0x8f'),_0x40dc22[_0x9cc2('0x52')],util[_0x9cc2('0x44')](_0x40dc22,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x40dc22[_0x9cc2('0x52')]]){var _0x42b4ea=_[_0x9cc2('0x7f')](this[_0x9cc2('0xc')][_0x40dc22[_0x9cc2('0x52')]]);_0x42b4ea[_0x9cc2('0x1f')]=![];_0x42b4ea[_0x9cc2('0x84')]=null;_0x42b4ea[_0x9cc2('0x90')]=!![];_0x42b4ea[_0x9cc2('0x91')]=_0x40dc22['membername'];_0x42b4ea[_0x9cc2('0x82')]=_0x40dc22['holdtime'];_0x42b4ea[_0x9cc2('0x80')]=!![];_0x42b4ea[_0x9cc2('0x92')]=![];_0x42b4ea[_0x9cc2('0x93')]=null;if(!_0x42b4ea['transfer']){if(_0x40dc22[_0x9cc2('0x94')]==_0x9cc2('0x95')){_0x42b4ea[_0x9cc2('0x53')]=_0x9cc2('0x96');logger[_0x9cc2('0x71')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x42b4ea[_0x9cc2('0x4f')],_0x42b4ea[_0x9cc2('0x57')]);}else{if(_[_0x9cc2('0x97')](_0x40dc22[_0x9cc2('0x3c')]['toLowerCase'](),_0x9cc2('0x98'))){if(this['queueReports'][_0x40dc22[_0x9cc2('0x99')]]){var _0x539b34=_[_0x9cc2('0x7f')](this[_0x9cc2('0xc')][_0x40dc22[_0x9cc2('0x99')]]);_0x539b34[_0x9cc2('0x80')]=![];_0x539b34[_0x9cc2('0x92')]=!![];_0x539b34['queuecallerexitAt']=moment(_0x42b4ea[_0x9cc2('0x77')])[_0x9cc2('0x9a')](_0x40dc22[_0x9cc2('0x82')],_0x9cc2('0x9b'))['format'](_0x9cc2('0x78'));_0x539b34[_0x9cc2('0x53')]='FORWARDTRANSFER';_0x539b34[_0x9cc2('0x95')]=!![];_0x539b34['transfertype']='FORWARD';_0x539b34[_0x9cc2('0x9c')]=_0x40dc22[_0x9cc2('0x9d')];_0x539b34[_0x9cc2('0x9e')]=_0x40dc22[_0x9cc2('0x52')];logger['info'](_0x9cc2('0x9f'),_0x539b34[_0x9cc2('0x4f')],_0x539b34[_0x9cc2('0x57')]);var _0x5dec04=this[_0x9cc2('0xc')][_0x40dc22['linkedid']];this[_0x9cc2('0xc')][_0x40dc22[_0x9cc2('0x99')]]=this[_0x9cc2('0xc')][_0x40dc22['uniqueid']];this[_0x9cc2('0xc')][_0x40dc22[_0x9cc2('0x52')]]=_0x5dec04;}}else{_0x42b4ea[_0x9cc2('0x53')]=_0x9cc2('0xa0')+_0x40dc22[_0x9cc2('0x94')][_0x9cc2('0xa1')]();logger[_0x9cc2('0x71')](_0x9cc2('0xa2'),_0x42b4ea[_0x9cc2('0x4f')],_0x42b4ea['type'],_0x42b4ea['queuecallerexitreason']);}}}this[_0x9cc2('0xf')][_0x40dc22[_0x9cc2('0x52')]]=_0x42b4ea;}}}catch(_0x2db25){logger[_0x9cc2('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x40dc22[_0x9cc2('0x52')],util[_0x9cc2('0x44')](_0x2db25,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9cc2('0xa')][_0x9cc2('0xa3')]=function(_0x1252a6){try{if(this[_0x9cc2('0x5b')](_0x1252a6)){logger['debug']('[%s][voiceQueueReport][varset]',_0x1252a6[_0x9cc2('0x52')],util['inspect'](_0x1252a6,{'showHidden':![],'depth':null}));this['addVariable'](_0x1252a6[_0x9cc2('0x52')],_['keys'](_0x1252a6[_0x9cc2('0xa4')])[0x0],_0x1252a6[_0x9cc2('0xa5')]);if(this['queueReports'][_0x1252a6[_0x9cc2('0x52')]]){var _0x67a5d5=_['last'](this[_0x9cc2('0xc')][_0x1252a6['uniqueid']]);if(_0x67a5d5){if(this[_0x9cc2('0x5b')](_0x1252a6['variable'])&&this[_0x9cc2('0x5b')](_0x1252a6[_0x9cc2('0xa4')][_0x9cc2('0x64')])){switch(_0x1252a6[_0x9cc2('0xa5')]){case _0x9cc2('0xa6'):_0x67a5d5[_0x9cc2('0x92')]=![];_0x67a5d5['queuecallerexitAt']=null;break;case _0x9cc2('0xa7'):_0x67a5d5[_0x9cc2('0xa8')]=_0x9cc2('0xa9');_0x67a5d5[_0x9cc2('0x92')]=!![];_0x67a5d5[_0x9cc2('0x93')]=moment()[_0x9cc2('0x4d')](_0x9cc2('0x78'));_0x67a5d5['queuecallerleaveAt']=moment()[_0x9cc2('0x4d')](_0x9cc2('0x78'));logger['debug'](_0x9cc2('0xaa'),_0x1252a6['uniqueid'],util[_0x9cc2('0x44')](_0x67a5d5,{'showHidden':![],'depth':null}));ami['emit'](_0x9cc2('0xab'),_0x67a5d5);break;default:_0x67a5d5[_0x9cc2('0x92')]=!![];_0x67a5d5[_0x9cc2('0x93')]=moment()[_0x9cc2('0x4d')](_0x9cc2('0x78'));_0x67a5d5[_0x9cc2('0x88')]=moment()[_0x9cc2('0x4d')](_0x9cc2('0x78'));}_0x67a5d5[_0x9cc2('0x1f')]=![];_0x67a5d5[_0x9cc2('0x84')]=null;_0x67a5d5[_0x9cc2('0x53')]=_0x1252a6[_0x9cc2('0xa5')];this[_0x9cc2('0xf')][_0x1252a6['uniqueid']]=_0x67a5d5;this[_0x9cc2('0x51')](_0x67a5d5,_0x9cc2('0xac'));}else if(this['isNotNull'](_0x1252a6[_0x9cc2('0xa4')])&&this[_0x9cc2('0x5b')](_0x1252a6[_0x9cc2('0xa4')][_0x9cc2('0xad')])){if(!_0x67a5d5[_0x9cc2('0x1f')]){_0x67a5d5[_0x9cc2('0x92')]=!![];_0x67a5d5['queuecallerexitAt']=moment()[_0x9cc2('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x67a5d5['queuecallerexitreason']=_0x9cc2('0xae');_0x67a5d5[_0x9cc2('0x88')]=moment()['format'](_0x9cc2('0x78'));this[_0x9cc2('0xf')][_0x1252a6['uniqueid']]=_0x67a5d5;}}logger['info'](_0x9cc2('0xaf'),_0x1252a6['uniqueid'],_0x67a5d5['queue'],_0x67a5d5[_0x9cc2('0x57')],_['keys'](_0x1252a6[_0x9cc2('0xa4')])[0x0],_0x1252a6[_0x9cc2('0xa5')]);_0x67a5d5[_0x9cc2('0x14')]=this[_0x9cc2('0x14')][_0x1252a6[_0x9cc2('0x52')]];}}}}catch(_0x315157){logger['error'](_0x9cc2('0xb0'),_0x1252a6[_0x9cc2('0x52')],util[_0x9cc2('0x44')](_0x315157,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9cc2('0xa')][_0x9cc2('0xb1')]=function(_0x59bb5d,_0x4ad7d8,_0x3ced48){var _0x5459d4=['rtpaudioqos',_0x9cc2('0xb2'),_0x9cc2('0xb3'),_0x9cc2('0xb4'),_0x9cc2('0xb5'),_0x9cc2('0xb6'),_0x9cc2('0xb7'),'rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer',_0x9cc2('0xb8'),_0x9cc2('0xb9'),_0x9cc2('0xba'),'memberinterface',_0x9cc2('0xbb'),'membername','memberpenalty',_0x9cc2('0xbc')];if(!_[_0x9cc2('0x39')](_0x4ad7d8)&&!_[_0x9cc2('0xbd')](_0x5459d4,_0x4ad7d8)){if(_[_0x9cc2('0x5c')](this[_0x9cc2('0x14')][_0x59bb5d])){this['variables'][_0x59bb5d]={};}this['variables'][_0x59bb5d][_0x4ad7d8]=_0x3ced48;}};VoiceQueueReport[_0x9cc2('0xa')]['handleHangup']=function(_0x2e528c,_0x172c0e,_0x36817d){var _0x2f6f04={};for(var _0xf9d111=0x0;_0xf9d111=0x0?moment(_0x593e5a['endtime'])[_0xb4d0('0xb')](_0x593e5a[_0xb4d0('0x16')],'seconds'):null,'data1':_0xb4d0('0x17'),'data2':_0x593e5a[_0xb4d0('0x11')],'data3':_0x593e5a[_0xb4d0('0xe')],'data4':_0x593e5a[_0xb4d0('0x18')]||null,'role':_0xb4d0('0x10'),'internal':_0x593e5a[_0xb4d0('0x11')]?_[_0xb4d0('0x12')](_0x593e5a[_0xb4d0('0x11')]):undefined,'uniqueid':_0x593e5a[_0xb4d0('0x19')]},'log':_0xb4d0('0x5')});}; \ No newline at end of file +var _0x3b37=['../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','isNil','interface','format','SIP/%s','queuecallerleaveAt','seconds','inbound','queue','agent','accountcode','uniqueid','CreateMemberReport','membername','TALKING','endtime','starttime','diff','outbound','toNumber','moment','lodash'];(function(_0x37e543,_0xeb89c9){var _0x50c2c6=function(_0x5968d6){while(--_0x5968d6){_0x37e543['push'](_0x37e543['shift']());}};_0x50c2c6(++_0xeb89c9);}(_0x3b37,0x85));var _0x73b3=function(_0x3c828e,_0x4580ab){_0x3c828e=_0x3c828e-0x0;var _0x5a38af=_0x3b37[_0x3c828e];return _0x5a38af;};'use strict';var moment=require(_0x73b3('0x0'));var _=require(_0x73b3('0x1'));var util=require('util');var client=require(_0x73b3('0x2'));exports[_0x73b3('0x3')]=function(_0x14120a){var _0x5c465f=_0x14120a[_0x73b3('0x4')]||_0x14120a[_0x73b3('0x5')];return client[_0x73b3('0x6')]('CreateMemberReport',{'body':{'channel':_0x73b3('0x7'),'membername':_0x14120a['lastAssignedTo'],'interface':_[_0x73b3('0x8')](_0x14120a[_0x73b3('0x9')])?util[_0x73b3('0xa')](_0x73b3('0xb'),_0x14120a['lastAssignedTo']):_0x14120a[_0x73b3('0x9')],'type':'TALKING','enterAt':_0x14120a['queuecallerleaveAt'],'exitAt':_0x5c465f,'duration':moment(_0x5c465f)['diff'](_0x14120a[_0x73b3('0xc')],_0x73b3('0xd')),'data1':_0x73b3('0xe'),'data2':_0x14120a['calleridnum'],'data3':_0x14120a['exten'],'data4':null,'data5':_0x14120a[_0x73b3('0xf')],'role':_0x73b3('0x10'),'internal':_0x14120a[_0x73b3('0x11')]?_['toNumber'](_0x14120a[_0x73b3('0x11')]):undefined,'uniqueid':_0x14120a[_0x73b3('0x12')]},'log':_0x73b3('0x13')});};exports['voiceDialReport']=function(_0x41e846){return client['Request'](_0x73b3('0x13'),{'body':{'channel':_0x73b3('0x7'),'membername':_0x41e846[_0x73b3('0x14')],'interface':_0x41e846[_0x73b3('0x9')],'type':_0x73b3('0x15'),'enterAt':_0x41e846['starttime'],'exitAt':_0x41e846[_0x73b3('0x16')],'duration':moment(_0x41e846[_0x73b3('0x16')])['diff'](_0x41e846[_0x73b3('0x17')],_0x73b3('0xd'))>=0x0?moment(_0x41e846[_0x73b3('0x16')])[_0x73b3('0x18')](_0x41e846[_0x73b3('0x17')],'seconds'):null,'data1':_0x73b3('0x19'),'data2':_0x41e846[_0x73b3('0x11')],'data3':_0x41e846['exten'],'data4':_0x41e846['dialstring']||null,'role':_0x73b3('0x10'),'internal':_0x41e846[_0x73b3('0x11')]?_[_0x73b3('0x1a')](_0x41e846[_0x73b3('0x11')]):undefined,'uniqueid':_0x41e846[_0x73b3('0x12')]},'log':_0x73b3('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 8c2a0e1..143fd0a 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 _0xb299=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request','ShowSetting'];(function(_0x3e94b1,_0x14218b){var _0x4b8663=function(_0x138ce0){while(--_0x138ce0){_0x3e94b1['push'](_0x3e94b1['shift']());}};_0x4b8663(++_0x14218b);}(_0xb299,0x19b));var _0x9b29=function(_0x1fdc46,_0x5e9a3e){_0x1fdc46=_0x1fdc46-0x0;var _0x3302d4=_0xb299[_0x1fdc46];return _0x3302d4;};'use strict';var client=require(_0x9b29('0x0'));exports['getSettings']=function(){return client[_0x9b29('0x1')](_0x9b29('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9b29('0x3'),_0x9b29('0x4')]},'log':_0x9b29('0x5')});}; \ No newline at end of file +var _0xaac0=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings'];(function(_0x591e11,_0x363e09){var _0x23a0a=function(_0x43734d){while(--_0x43734d){_0x591e11['push'](_0x591e11['shift']());}};_0x23a0a(++_0x363e09);}(_0xaac0,0x10c));var _0x0aac=function(_0x49588f,_0x3e56ea){_0x49588f=_0x49588f-0x0;var _0x41b293=_0xaac0[_0x49588f];return _0x41b293;};'use strict';var client=require(_0x0aac('0x0'));exports[_0x0aac('0x1')]=function(){return client['Request'](_0x0aac('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0aac('0x3'),_0x0aac('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0479af6..57456a9 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 _0x50c1=['GetTemplate','html','../client','Request'];(function(_0x1cb0e8,_0x3b2000){var _0x281865=function(_0x4585ea){while(--_0x4585ea){_0x1cb0e8['push'](_0x1cb0e8['shift']());}};_0x281865(++_0x3b2000);}(_0x50c1,0x1b6));var _0x150c=function(_0x3ad9fb,_0x3bcd86){_0x3ad9fb=_0x3ad9fb-0x0;var _0x5dbd8c=_0x50c1[_0x3ad9fb];return _0x5dbd8c;};'use strict';var client=require(_0x150c('0x0'));exports['getTemplates']=function(_0x29da4e){return function(_0x4c4e4d){return client[_0x150c('0x1')](_0x150c('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x150c('0x3')]},'log':_0x150c('0x2')});};}; \ No newline at end of file +var _0x326b=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326b,0x1dc));var _0xb326=function(_0x222550,_0x3c0a0c){_0x222550=_0x222550-0x0;var _0x58ac61=_0x326b[_0x222550];return _0x58ac61;};'use strict';var client=require(_0xb326('0x0'));exports[_0xb326('0x1')]=function(_0x7dbc90){return function(_0x267e5e){return client[_0xb326('0x2')](_0xb326('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xb326('0x4')]},'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 4329a8f..ab01ef6 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 _0x467b=['Action','Actions','action','data1','data4','data5','data6','data7','getTriggers','GetTrigger','name','status','Condition','AllConditions','operator','value','AnyConditions','field'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x467b,0x1a6));var _0xb467=function(_0x38e31a,_0x5d3ade){_0x38e31a=_0x38e31a-0x0;var _0x3292f0=_0x467b[_0x38e31a];return _0x3292f0;};'use strict';var client=require('../client');exports[_0xb467('0x0')]=function(_0x143598){return function(_0x4b925f){return client['Request'](_0xb467('0x1'),{'options':{'raw':![],'attributes':['id',_0xb467('0x2'),'channel',_0xb467('0x3')],'include':[{'model':_0xb467('0x4'),'as':_0xb467('0x5'),'attributes':['id','field',_0xb467('0x6'),_0xb467('0x7')]},{'model':_0xb467('0x4'),'as':_0xb467('0x8'),'attributes':['id',_0xb467('0x9'),_0xb467('0x6'),'value']},{'model':_0xb467('0xa'),'as':_0xb467('0xb'),'attributes':['id',_0xb467('0xc'),_0xb467('0xd'),'data2','data3',_0xb467('0xe'),_0xb467('0xf'),_0xb467('0x10'),_0xb467('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xc142=['../client','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','action','data1','data2','data4','data5','data7'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xc142,0x90));var _0x2c14=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0xc142[_0x358806];return _0x19fdcb;};'use strict';var client=require(_0x2c14('0x0'));exports[_0x2c14('0x1')]=function(_0x425467){return function(_0x11c500){return client[_0x2c14('0x2')](_0x2c14('0x3'),{'options':{'raw':![],'attributes':['id',_0x2c14('0x4'),_0x2c14('0x5'),'status'],'include':[{'model':_0x2c14('0x6'),'as':_0x2c14('0x7'),'attributes':['id',_0x2c14('0x8'),_0x2c14('0x9'),_0x2c14('0xa')]},{'model':'Condition','as':_0x2c14('0xb'),'attributes':['id','field',_0x2c14('0x9'),'value']},{'model':'Action','as':'Actions','attributes':['id',_0x2c14('0xc'),_0x2c14('0xd'),_0x2c14('0xe'),'data3',_0x2c14('0xf'),_0x2c14('0x10'),'data6',_0x2c14('0x11')]}]},'log':_0x2c14('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c4166ad..3749910 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 _0x39d5=['name','registry','defaultuser','GetTrunk','../client','getTrunks','Request'];(function(_0xeb6bb1,_0xc83c4c){var _0x387e00=function(_0x55a427){while(--_0x55a427){_0xeb6bb1['push'](_0xeb6bb1['shift']());}};_0x387e00(++_0xc83c4c);}(_0x39d5,0x11c));var _0x539d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x39d5[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x539d('0x0'));exports[_0x539d('0x1')]=function(_0x2a580c){return function(_0x2a5b2e){return client[_0x539d('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x539d('0x3'),_0x539d('0x4'),_0x539d('0x5')]},'log':_0x539d('0x6')});};}; \ No newline at end of file +var _0x7e35=['../client','getTrunks','Request','GetTrunk','registry','defaultuser'];(function(_0x416f7b,_0x41a1e1){var _0x5d4353=function(_0x2ccf5d){while(--_0x2ccf5d){_0x416f7b['push'](_0x416f7b['shift']());}};_0x5d4353(++_0x41a1e1);}(_0x7e35,0xcc));var _0x57e3=function(_0x2968a0,_0xb3f771){_0x2968a0=_0x2968a0-0x0;var _0x13aae0=_0x7e35[_0x2968a0];return _0x13aae0;};'use strict';var client=require(_0x57e3('0x0'));exports[_0x57e3('0x1')]=function(_0x2ec2d6){return function(_0x352b65){return client[_0x57e3('0x2')](_0x57e3('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x57e3('0x4'),_0x57e3('0x5')]},'log':_0x57e3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 40703ad..ab519aa 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe706,0xa3));var _0x6e70=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0xe706[_0x53b93b];return _0x485761;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x20f426,_0x2ed3c4){var _0x4acd9a=function(_0x4ee3d4){while(--_0x4ee3d4){_0x20f426['push'](_0x20f426['shift']());}};_0x4acd9a(++_0x2ed3c4);}(_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 fcc222f..6536b9e 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 _0x4ea4=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0x4ea4,0x196));var _0x44ea=function(_0x389a61,_0x20216c){_0x389a61=_0x389a61-0x0;var _0x1acde9=_0x4ea4[_0x389a61];return _0x1acde9;};'use strict';var client=require(_0x44ea('0x0'));exports[_0x44ea('0x1')]=function(_0x25d83f){return client[_0x44ea('0x2')](_0x44ea('0x3'),{'body':_0x25d83f,'log':_0x44ea('0x3')});};exports['update']=function(_0x5cf575,_0x2d784f,_0x486ae2){return client[_0x44ea('0x2')](_0x44ea('0x4'),{'body':_0x5cf575,'options':{'where':{'uniqueid':_0x2d784f,'interface':_0x486ae2,'agentcomplete':!![]}},'log':_0x44ea('0x4')});}; \ No newline at end of file +var _0xf43d=['../client','CreateVoiceAgentReport','Request','UpdateVoiceAgentReport'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf43d,0xe4));var _0xdf43=function(_0x3b344c,_0x3f24e7){_0x3b344c=_0x3b344c-0x0;var _0x2708af=_0xf43d[_0x3b344c];return _0x2708af;};'use strict';var client=require(_0xdf43('0x0'));exports['create']=function(_0x5424e3){return client['Request'](_0xdf43('0x1'),{'body':_0x5424e3,'log':_0xdf43('0x1')});};exports['update']=function(_0x552837,_0x1db820,_0x775fe1){return client[_0xdf43('0x2')](_0xdf43('0x3'),{'body':_0x552837,'options':{'where':{'uniqueid':_0x1db820,'interface':_0x775fe1,'agentcomplete':!![]}},'log':_0xdf43('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 4286ebe..a2eefb3 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 _0x6fa8=['getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','billableseconds','moment','lodash','CreateVoiceCallReport','merge','context','DOCUMENTATION'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x6fa8,0xda));var _0x86fa=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x6fa8[_0x8dc04d];return _0x2f5f28;};'use strict';var moment=require(_0x86fa('0x0'));var util=require('util');var _=require(_0x86fa('0x1'));var client=require('../client');exports['create']=function(_0x1eb29c){return client['Request'](_0x86fa('0x2'),{'body':_[_0x86fa('0x3')](_0x1eb29c,{'source':_0x1eb29c['calleridnum'],'destinationcontext':_0x1eb29c[_0x86fa('0x4')],'callerid':_0x1eb29c['callerid'],'amaflags':_0x86fa('0x5')}),'log':'CreateVoiceCallReport'});};exports[_0x86fa('0x6')]=function(){return function(){return client['Request'](_0x86fa('0x7'),{'options':{'where':{'type':[_0x86fa('0x8')],'createdAt':{'$between':[moment()[_0x86fa('0x9')](_0x86fa('0xa'))['format'](_0x86fa('0xb')),moment()[_0x86fa('0xc')]('day')[_0x86fa('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x86fa('0xe'),'disposition','duration',_0x86fa('0xf')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xe129=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0xe129,0x17a));var _0x9e12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe129[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x9e12('0x0'));var util=require(_0x9e12('0x1'));var _=require(_0x9e12('0x2'));var client=require(_0x9e12('0x3'));exports[_0x9e12('0x4')]=function(_0x5d6a6d){return client[_0x9e12('0x5')](_0x9e12('0x6'),{'body':_[_0x9e12('0x7')](_0x5d6a6d,{'source':_0x5d6a6d[_0x9e12('0x8')],'destinationcontext':_0x5d6a6d[_0x9e12('0x9')],'callerid':_0x5d6a6d[_0x9e12('0xa')],'amaflags':_0x9e12('0xb')}),'log':'CreateVoiceCallReport'});};exports[_0x9e12('0xc')]=function(){return function(){return client[_0x9e12('0x5')](_0x9e12('0xd'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x9e12('0xe')](_0x9e12('0xf'))[_0x9e12('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x9e12('0x11')](_0x9e12('0xf'))['format'](_0x9e12('0x12'))]}},'attributes':[_0x9e12('0x13'),_0x9e12('0x14'),_0x9e12('0x15'),_0x9e12('0x16')]},'log':_0x9e12('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index adbb20e..7db639d 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 _0x53d0=['Request','CreateVoiceDialReport','create'];(function(_0x2992d7,_0x1077e6){var _0x313c6e=function(_0x3fb91a){while(--_0x3fb91a){_0x2992d7['push'](_0x2992d7['shift']());}};_0x313c6e(++_0x1077e6);}(_0x53d0,0x1c7));var _0x053d=function(_0x32af67,_0xd5da7b){_0x32af67=_0x32af67-0x0;var _0x82acc6=_0x53d0[_0x32af67];return _0x82acc6;};'use strict';var client=require('../client');exports[_0x053d('0x0')]=function(_0x2547be){return client[_0x053d('0x1')](_0x053d('0x2'),{'body':_0x2547be,'log':_0x053d('0x2')});}; \ No newline at end of file +var _0x35ed=['create','Request','../client'];(function(_0x287c90,_0x567074){var _0x5eabda=function(_0x2329d0){while(--_0x2329d0){_0x287c90['push'](_0x287c90['shift']());}};_0x5eabda(++_0x567074);}(_0x35ed,0x119));var _0xd35e=function(_0x5e06f5,_0x12cf6e){_0x5e06f5=_0x5e06f5-0x0;var _0x5797eb=_0x35ed[_0x5e06f5];return _0x5797eb;};'use strict';var client=require(_0xd35e('0x0'));exports[_0xd35e('0x1')]=function(_0x435f33){return client[_0xd35e('0x2')]('CreateVoiceDialReport',{'body':_0x435f33,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 1c06178..6280903 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 _0x0e9f=['getVoiceExtensions','exten','../client'];(function(_0x5cd1e1,_0x24e90a){var _0x195aba=function(_0x1e0e7b){while(--_0x1e0e7b){_0x5cd1e1['push'](_0x5cd1e1['shift']());}};_0x195aba(++_0x24e90a);}(_0x0e9f,0x116));var _0xf0e9=function(_0x59c2c2,_0xd7fc5d){_0x59c2c2=_0x59c2c2-0x0;var _0x2e872c=_0x0e9f[_0x59c2c2];return _0x2e872c;};'use strict';var client=require(_0xf0e9('0x0'));exports[_0xf0e9('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xf0e9('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x5d70=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x1fe018,_0x4abe07){var _0x590864=function(_0x38a021){while(--_0x38a021){_0x1fe018['push'](_0x1fe018['shift']());}};_0x590864(++_0x4abe07);}(_0x5d70,0x8d));var _0x05d7=function(_0x426e26,_0xd8e1a8){_0x426e26=_0x426e26-0x0;var _0x3c20af=_0x5d70[_0x426e26];return _0x3c20af;};'use strict';var client=require(_0x05d7('0x0'));exports[_0x05d7('0x1')]=function(){return function(){return client['Request'](_0x05d7('0x2'),{'options':{'raw':!![],'attributes':['id',_0x05d7('0x3'),_0x05d7('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x05d7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c3e553e..620d960 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 _0x85c3=['dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x334a9f,_0x7d9273){var _0x13bf1c=function(_0x3ac392){while(--_0x3ac392){_0x334a9f['push'](_0x334a9f['shift']());}};_0x13bf1c(++_0x7d9273);}(_0x85c3,0xd2));var _0x385c=function(_0x480100,_0x9f8588){_0x480100=_0x480100-0x0;var _0x2cdaea=_0x85c3[_0x480100];return _0x2cdaea;};'use strict';var client=require('../client');exports[_0x385c('0x0')]=function(){return function(){return client[_0x385c('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x385c('0x2'),'acw',_0x385c('0x3'),_0x385c('0x4'),_0x385c('0x5'),_0x385c('0x6'),'dialActive',_0x385c('0x7'),_0x385c('0x8'),'dialLimitQueue',_0x385c('0x9'),_0x385c('0xa'),_0x385c('0xb'),_0x385c('0xc'),'dialOriginateCallerIdName',_0x385c('0xd'),_0x385c('0xe'),'dialQueueOptions',_0x385c('0xf'),_0x385c('0x10'),_0x385c('0x11'),'dialCongestionRetryFrequency',_0x385c('0x12'),_0x385c('0x13'),_0x385c('0x14'),_0x385c('0x15'),_0x385c('0x16'),'dialTimezone','dialGlobalInterval',_0x385c('0x17'),_0x385c('0x18'),_0x385c('0x19'),_0x385c('0x1a'),_0x385c('0x1b'),_0x385c('0x1c'),_0x385c('0x1d'),'dialAMDMinWordLength',_0x385c('0x1e'),_0x385c('0x1f'),_0x385c('0x20'),_0x385c('0x21'),_0x385c('0x22'),_0x385c('0x23'),_0x385c('0x24'),'dialOrderByScheduledAt',_0x385c('0x25'),_0x385c('0x26'),_0x385c('0x27'),_0x385c('0x5'),'strategy',_0x385c('0x28'),_0x385c('0x29'),_0x385c('0x2a'),_0x385c('0x2b'),_0x385c('0x2c'),_0x385c('0x2d'),_0x385c('0x2e'),'dialAbandonedRetryFrequency',_0x385c('0x2f'),_0x385c('0x30'),_0x385c('0x31'),_0x385c('0x32'),_0x385c('0x33'),_0x385c('0x34'),_0x385c('0x35'),_0x385c('0x36'),_0x385c('0x37')],'include':[{'model':_0x385c('0x38'),'as':_0x385c('0x38'),'attributes':['id',_0x385c('0x2'),_0x385c('0x39'),_0x385c('0x3a')]},{'model':_0x385c('0x3b'),'as':'mandatoryDispositionPause','attributes':['id',_0x385c('0x2')]},{'model':_0x385c('0x38'),'as':_0x385c('0x3c'),'attributes':['id',_0x385c('0x2'),_0x385c('0x39'),_0x385c('0x3a')]},{'model':_0x385c('0x3d'),'as':'Interval','attributes':['id',_0x385c('0x2')],'include':[{'model':'Interval','as':_0x385c('0x3e'),'attributes':['id',_0x385c('0x2'),_0x385c('0x3f')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x9b5b=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','Interval','../client','getVoiceQueues','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x11d95f,_0x34f442){var _0x2b1a14=function(_0x3a4fa5){while(--_0x3a4fa5){_0x11d95f['push'](_0x11d95f['shift']());}};_0x2b1a14(++_0x34f442);}(_0x9b5b,0x1e1));var _0xb9b5=function(_0x48a133,_0x3ec052){_0x48a133=_0x48a133-0x0;var _0x3a8654=_0x9b5b[_0x48a133];return _0x3a8654;};'use strict';var client=require(_0xb9b5('0x0'));exports[_0xb9b5('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xb9b5('0x2'),_0xb9b5('0x3'),_0xb9b5('0x4'),_0xb9b5('0x5'),_0xb9b5('0x6'),_0xb9b5('0x7'),'dialMethod',_0xb9b5('0x8'),_0xb9b5('0x9'),_0xb9b5('0xa'),_0xb9b5('0xb'),_0xb9b5('0xc'),_0xb9b5('0xd'),'dialOriginateCallerIdName',_0xb9b5('0xe'),_0xb9b5('0xf'),_0xb9b5('0x10'),_0xb9b5('0x11'),'dialQueueProject',_0xb9b5('0x12'),_0xb9b5('0x13'),_0xb9b5('0x14'),_0xb9b5('0x15'),_0xb9b5('0x16'),'dialNoAnswerRetryFrequency',_0xb9b5('0x17'),'dialTimezone',_0xb9b5('0x18'),'dialPrefix',_0xb9b5('0x19'),_0xb9b5('0x1a'),_0xb9b5('0x1b'),_0xb9b5('0x1c'),_0xb9b5('0x1d'),_0xb9b5('0x1e'),_0xb9b5('0x1f'),_0xb9b5('0x20'),_0xb9b5('0x21'),'dialAMDSilenceThreshold',_0xb9b5('0x22'),_0xb9b5('0x23'),_0xb9b5('0x24'),_0xb9b5('0x25'),_0xb9b5('0x26'),_0xb9b5('0x27'),'dialAgiAfterHangupClient',_0xb9b5('0x28'),_0xb9b5('0x5'),'strategy',_0xb9b5('0x29'),'dialCutDigit',_0xb9b5('0x2a'),_0xb9b5('0x2b'),'dialDropMaxRetry','dialDropRetryFrequency',_0xb9b5('0x2c'),_0xb9b5('0x2d'),_0xb9b5('0x2e'),_0xb9b5('0x2f'),_0xb9b5('0x30'),_0xb9b5('0x31'),_0xb9b5('0x32'),_0xb9b5('0x33'),_0xb9b5('0x34'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0xb9b5('0x35'),'as':'Trunk','attributes':['id',_0xb9b5('0x36'),_0xb9b5('0x37'),_0xb9b5('0x38')]},{'model':_0xb9b5('0x39'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xb9b5('0x35'),'as':'TrunkBackup','attributes':['id','name',_0xb9b5('0x37'),'active']},{'model':_0xb9b5('0x3a'),'as':_0xb9b5('0x3a'),'attributes':['id',_0xb9b5('0x36')],'include':[{'model':_0xb9b5('0x3a'),'as':'Intervals','attributes':['id',_0xb9b5('0x36'),'interval']}]}]},'log':_0xb9b5('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 78801db..1197e9c 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(_0x16bec2,_0x2fad50){var _0x52a48b=function(_0x58ddf1){while(--_0x58ddf1){_0x16bec2['push'](_0x16bec2['shift']());}};_0x52a48b(++_0x2fad50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x46e9f0,_0x41091a){var _0x115380=function(_0x3d5d1f){while(--_0x3d5d1f){_0x46e9f0['push'](_0x46e9f0['shift']());}};_0x115380(++_0x41091a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 b7a3215..00140be 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 _0x9694=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x27200b,_0x580ca6){var _0x56ec10=function(_0x56b783){while(--_0x56b783){_0x27200b['push'](_0x27200b['shift']());}};_0x56ec10(++_0x580ca6);}(_0x9694,0xd4));var _0x4969=function(_0x5e3e02,_0x197125){_0x5e3e02=_0x5e3e02-0x0;var _0x5c0f2f=_0x9694[_0x5e3e02];return _0x5c0f2f;};'use strict';var client=require(_0x4969('0x0'));exports[_0x4969('0x1')]=function(_0x2cad04){return function(){return client[_0x4969('0x2')](_0x4969('0x3'),{'options':{'where':{'VoiceQueueId':_0x2cad04,'paused':!![]},'raw':!![]},'log':_0x4969('0x1')});};}; \ No newline at end of file +var _0xedc6=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x59aefd,_0x36209e){var _0x3c0255=function(_0x5c7ba0){while(--_0x5c7ba0){_0x59aefd['push'](_0x59aefd['shift']());}};_0x3c0255(++_0x36209e);}(_0xedc6,0x67));var _0x6edc=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xedc6[_0x2a6809];return _0x11c371;};'use strict';var client=require(_0x6edc('0x0'));exports[_0x6edc('0x1')]=function(_0x1698d2){return function(){return client[_0x6edc('0x2')](_0x6edc('0x3'),{'options':{'where':{'VoiceQueueId':_0x1698d2,'paused':!![]},'raw':!![]},'log':_0x6edc('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6607d10..6575fac 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x1c736b,_0x12d351){var _0x430036=function(_0x587e7a){while(--_0x587e7a){_0x1c736b['push'](_0x1c736b['shift']());}};_0x430036(++_0x12d351);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2244cd,_0x3a98a2){var _0x2b5ae6=function(_0x284515){while(--_0x284515){_0x2244cd['push'](_0x2244cd['shift']());}};_0x2b5ae6(++_0x3a98a2);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index df885e2..fdce7f1 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 _0x5940=['Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid','context','extension','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5940,0x166));var _0x0594=function(_0x1b5b37,_0x3da7e1){_0x1b5b37=_0x1b5b37-0x0;var _0x21fb01=_0x5940[_0x1b5b37];return _0x21fb01;};'use strict';var client=require('../client');exports[_0x0594('0x0')]={};exports[_0x0594('0x1')]=function(_0x511452){return client[_0x0594('0x2')](_0x0594('0x3'),{'body':{'result':_0x511452[_0x0594('0x4')],'transfererchannel':_0x511452[_0x0594('0x5')],'transferercalleridnum':_0x511452[_0x0594('0x6')],'transferercalleridname':_0x511452[_0x0594('0x7')],'transfererconnectedlinenum':_0x511452[_0x0594('0x8')],'transfererconnectedlinename':_0x511452[_0x0594('0x9')],'transfereraccountcode':_0x511452['transfereraccountcode'],'transferercontext':_0x511452[_0x0594('0xa')],'transfererexten':_0x511452[_0x0594('0xb')],'transfererlinkedid':_0x511452[_0x0594('0xc')],'transfereechannel':_0x511452[_0x0594('0xd')],'transfereecalleridnum':_0x511452[_0x0594('0xe')],'transfereecalleridname':_0x511452[_0x0594('0xf')],'transfereeconnectedlinenum':_0x511452[_0x0594('0x10')],'transfereeconnectedlinename':_0x511452[_0x0594('0x11')],'transfereeaccountcode':_0x511452['transfereeaccountcode'],'transfereecontext':_0x511452[_0x0594('0x12')],'transfereeexten':_0x511452['transfereeexten'],'transfereelinkedid':_0x511452[_0x0594('0x13')],'isexternal':_0x511452['isexternal'],'context':_0x511452[_0x0594('0x14')],'extension':_0x511452[_0x0594('0x15')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x0594('0x16')]=function(_0x11d19f){return client['Request'](_0x0594('0x3'),{'body':{'result':_0x11d19f[_0x0594('0x4')],'transfererchannel':_0x11d19f['origtransfererchannel'],'transferercalleridnum':_0x11d19f['origtransferercalleridnum'],'transferercalleridname':_0x11d19f[_0x0594('0x17')],'transfererconnectedlinenum':_0x11d19f[_0x0594('0x18')],'transfererconnectedlinename':_0x11d19f[_0x0594('0x19')],'transfereraccountcode':_0x11d19f[_0x0594('0x1a')],'transferercontext':_0x11d19f['secondtransferercontext'],'transfererexten':_0x11d19f[_0x0594('0x1b')],'transfererlinkedid':_0x11d19f[_0x0594('0x1c')],'transfereechannel':_0x11d19f['transfertargetchannel'],'transfereecalleridnum':_0x11d19f[_0x0594('0x1d')],'transfereecalleridname':_0x11d19f[_0x0594('0x1e')],'transfereeconnectedlinenum':_0x11d19f[_0x0594('0x1f')],'transfereeconnectedlinename':_0x11d19f['transfertargetconnectedlinename'],'transfereeaccountcode':_0x11d19f[_0x0594('0x20')],'transfereecontext':_0x11d19f[_0x0594('0x21')],'transfereeexten':_0x11d19f[_0x0594('0x22')],'transfereelinkedid':_0x11d19f[_0x0594('0x23')],'isexternal':_0x11d19f[_0x0594('0x24')],'context':_0x11d19f[_0x0594('0x25')],'extension':_0x11d19f[_0x0594('0x26')],'type':_0x0594('0x27')},'log':_0x0594('0x3')});}; \ No newline at end of file +var _0x0b30=['transfereeexten','transfereelinkedid','isexternal','extension','blind','CreateVoiceTransferReport','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','transfertargetcalleridnum','transfertargetcalleridname','transfertargetcontext','origtransferercontext','attended','../client','transfers','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext'];(function(_0x9ec5fd,_0x1b6c53){var _0x30f04b=function(_0x9dacb){while(--_0x9dacb){_0x9ec5fd['push'](_0x9ec5fd['shift']());}};_0x30f04b(++_0x1b6c53);}(_0x0b30,0xdd));var _0x00b3=function(_0x46c6ee,_0x2a1730){_0x46c6ee=_0x46c6ee-0x0;var _0x47a49a=_0x0b30[_0x46c6ee];return _0x47a49a;};'use strict';var client=require(_0x00b3('0x0'));exports[_0x00b3('0x1')]={};exports[_0x00b3('0x2')]=function(_0x545456){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x545456[_0x00b3('0x3')],'transfererchannel':_0x545456[_0x00b3('0x4')],'transferercalleridnum':_0x545456[_0x00b3('0x5')],'transferercalleridname':_0x545456[_0x00b3('0x6')],'transfererconnectedlinenum':_0x545456[_0x00b3('0x7')],'transfererconnectedlinename':_0x545456['transfererconnectedlinename'],'transfereraccountcode':_0x545456['transfereraccountcode'],'transferercontext':_0x545456[_0x00b3('0x8')],'transfererexten':_0x545456[_0x00b3('0x9')],'transfererlinkedid':_0x545456[_0x00b3('0xa')],'transfereechannel':_0x545456[_0x00b3('0xb')],'transfereecalleridnum':_0x545456[_0x00b3('0xc')],'transfereecalleridname':_0x545456[_0x00b3('0xd')],'transfereeconnectedlinenum':_0x545456['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x545456[_0x00b3('0xe')],'transfereeaccountcode':_0x545456[_0x00b3('0xf')],'transfereecontext':_0x545456[_0x00b3('0x10')],'transfereeexten':_0x545456[_0x00b3('0x11')],'transfereelinkedid':_0x545456[_0x00b3('0x12')],'isexternal':_0x545456[_0x00b3('0x13')],'context':_0x545456['context'],'extension':_0x545456[_0x00b3('0x14')],'type':_0x00b3('0x15')},'log':_0x00b3('0x16')});};exports['attendedTransfer']=function(_0x36c01e){return client[_0x00b3('0x17')](_0x00b3('0x16'),{'body':{'result':_0x36c01e[_0x00b3('0x3')],'transfererchannel':_0x36c01e[_0x00b3('0x18')],'transferercalleridnum':_0x36c01e[_0x00b3('0x19')],'transferercalleridname':_0x36c01e[_0x00b3('0x1a')],'transfererconnectedlinenum':_0x36c01e[_0x00b3('0x1b')],'transfererconnectedlinename':_0x36c01e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x36c01e[_0x00b3('0x1c')],'transferercontext':_0x36c01e['secondtransferercontext'],'transfererexten':_0x36c01e['secondtransfererexten'],'transfererlinkedid':_0x36c01e['origtransfererlinkedid'],'transfereechannel':_0x36c01e['transfertargetchannel'],'transfereecalleridnum':_0x36c01e[_0x00b3('0x1d')],'transfereecalleridname':_0x36c01e[_0x00b3('0x1e')],'transfereeconnectedlinenum':_0x36c01e['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x36c01e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x36c01e['transfertargetaccountcode'],'transfereecontext':_0x36c01e[_0x00b3('0x1f')],'transfereeexten':_0x36c01e['transfertargetexten'],'transfereelinkedid':_0x36c01e['transfertargetlinkedid'],'isexternal':_0x36c01e[_0x00b3('0x13')],'context':_0x36c01e[_0x00b3('0x20')],'extension':_0x36c01e['origtransfererexten'],'type':_0x00b3('0x21')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 34bc681..148ab78 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 _0xb138=['Channel\x20doesn\x27t\x20exist','queueChannels','type','inbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','context','telephones','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','checkAfterSend','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../model/voiceQueueSummary','listen','format','%s/%s','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','asterisk','command','Command','content','error','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','MixMonitor\x20Success','resolve','destinationchannel','StopMixMonitor','stop'];(function(_0x352580,_0x40db47){var _0x459385=function(_0x40b0ef){while(--_0x40b0ef){_0x352580['push'](_0x352580['shift']());}};_0x459385(++_0x40db47);}(_0xb138,0x1dd));var _0x8b13=function(_0x287c1d,_0x4c4991){_0x287c1d=_0x287c1d-0x0;var _0x48341c=_0xb138[_0x287c1d];return _0x48341c;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var jayson=require(_0x8b13('0x2'));var schema=require(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var config=require(_0x8b13('0x5'));var properties=require(_0x8b13('0x6'));var ami=require('../ami');var VoiceQueueSummary=require(_0x8b13('0x7'));exports[_0x8b13('0x8')]=function(_0x3af81a,_0x5ae5b2,_0xd19a0f){return new Promise(function(_0x13f7bd,_0x5d51b1){var _0x3fdf4d={'QueuePause':function(_0x33d1a7){return new Promise(function(_0x22e157){var _0x498832=util[_0x8b13('0x9')](_0x8b13('0xa'),'SIP',_0x33d1a7['name']);if(_0x3af81a[_0x8b13('0xb')]&&_0x3af81a[_0x8b13('0xb')][_0x498832]&&_0x3af81a[_0x8b13('0xb')][_0x498832][_0x8b13('0xc')]){_0x3af81a[_0x8b13('0xb')][_0x498832]['updateAcw']();}if(_0x3af81a[_0x8b13('0xd')][_0x498832]){_0x3af81a[_0x8b13('0xd')][_0x498832][_0x8b13('0xe')]({'statePause':_0x33d1a7[_0x8b13('0xf')]?!![]:![]});}_0x22e157({'code':0xc8,'message':_0x8b13('0x10')});});},'Reload':function(_0x1893b1){var _0x58f97e=this;return new Promise(function(_0x50e7a4,_0x3dcde6){if(ami[_0x8b13('0x11')]()==![]){return _0x3dcde6(_0x58f97e['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x8b13('0x12')],_0x8b13('0x13')][_0x8b13('0x14')]('\x20')));}_0x1893b1=_[_0x8b13('0x15')](_0x1893b1,_[_0x8b13('0x16')](properties['reload'][_0x8b13('0x17')]));_0x1893b1[_0x8b13('0x18')]=_0x8b13('0x19');return ami[_0x8b13('0x1a')](_0x1893b1)[_0x8b13('0x1b')](function(_0x1fcfe6){_0x50e7a4({'code':0xc8,'message':_0x1fcfe6[_0x8b13('0x1c')]});})[_0x8b13('0x1d')](function(_0x4989d3){_0x3dcde6(_0x58f97e['error'](0x1f5,_0x4989d3[_0x8b13('0x1c')]));});});},'Command':function(_0x335709){var _0x14a8ac=this;return new Promise(function(_0x9c03b4,_0x1e0fe3){if(ami[_0x8b13('0x11')]()==![]){return _0x1e0fe3(_0x14a8ac['error'](0x1f4,[config[_0x8b13('0x1e')]['ip'],config[_0x8b13('0x1e')][_0x8b13('0x12')],'ami\x20disconnected']['join']('\x20')));}_0x335709=_[_0x8b13('0x15')](_0x335709,_0x8b13('0x1f'));_0x335709['action']=_0x8b13('0x20');return ami[_0x8b13('0x1a')](_0x335709)[_0x8b13('0x1b')](function(_0x213280){_0x9c03b4({'code':0xc8,'message':_0x213280[_0x8b13('0x21')]});})['catch'](function(_0x339271){_0x1e0fe3(_0x14a8ac[_0x8b13('0x22')](0x1f5,_0x339271['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x33422f){var _0x4fdd1c=[];for(var _0x420772 in _0x3af81a[_0x8b13('0x23')]){if(_0x3af81a['voiceQueues'][_0x8b13('0x24')](_0x420772)){var _0x3223d8=_0x3af81a['voiceQueues'][_0x420772];var _0x134c5e=new VoiceQueueSummary(_0x3223d8);_0x4fdd1c[_0x8b13('0x25')](_0x134c5e);}}_0x33422f({'count':_0x4fdd1c[_0x8b13('0x26')],'rows':_0x4fdd1c});});},'UpdateVoiceQueue':function(_0x4048e4){return new Promise(function(_0x27fef3,_0x54cdfc){var _0x6023f5=_[_0x8b13('0x27')](_0x3af81a[_0x8b13('0x23')],{'id':parseInt(_0x4048e4['id'])});var _0x1511bf=_[_0x8b13('0x28')](_0x4048e4,['id']);if(_0x6023f5){for(var _0x2bb51d in _0x1511bf){if(typeof _0x1511bf[_0x2bb51d]!=='undefined'&&typeof _0x6023f5[_0x2bb51d]!==_0x8b13('0x29')){_0x6023f5[_0x2bb51d]=_0x1511bf[_0x2bb51d];}}_0x27fef3(_0x6023f5);}else{_0x54cdfc();}});},'VoiceChannels':function(){return new Promise(function(_0xfec033){var _0x109f0e=_[_0x8b13('0x2a')](_0x3af81a[_0x8b13('0x2b')]);_0xfec033({'count':_0x109f0e[_0x8b13('0x26')],'rows':_0x109f0e});});},'VoiceChannelMixMonitor':function(_0x3304bd){var _0x44bce2=this;return new Promise(function(_0x36f732,_0x5751db){if(ami[_0x8b13('0x11')]()==![]){return _0x5751db(_0x44bce2[_0x8b13('0x22')](0x1f4,[config[_0x8b13('0x1e')]['ip'],config[_0x8b13('0x1e')]['username'],'ami\x20disconnected'][_0x8b13('0x14')]('\x20')));}var _0x5cedea=schema(properties['voicechannel'])[_0x8b13('0x3')](_0x3304bd);if(_0x5cedea['length']>0x0){return _0x5751db(_0x44bce2[_0x8b13('0x22')](0x1f4,_[_0x8b13('0x2c')](_0x5cedea,_0x8b13('0x1c'))[_0x8b13('0x14')](',\x20')));}var _0x11657e=_[_0x8b13('0x27')](_0x3af81a[_0x8b13('0x2b')],{'uniqueid':_0x3304bd[_0x8b13('0x2d')]});if(_0x11657e&&_0x11657e[_0x8b13('0x2e')]){var _0x1b313d=util['format'](_0x8b13('0x2f'),_0x3304bd[_0x8b13('0x30')]||_0x3304bd[_0x8b13('0x2d')],_0x3304bd[_0x8b13('0x9')]||_0x8b13('0x31'));return ami[_0x8b13('0x1a')]({'action':_0x8b13('0x32'),'channel':_0x11657e[_0x8b13('0x2e')],'file':_0x1b313d,'options':'ai(mixmonitorid)'})[_0x8b13('0x1b')](function(_0x5089c6){var _0x3826a5=_[_0x8b13('0x27')](_0x11657e[_0x8b13('0x33')],{'filename':_0x8b13('0x34')+_0x1b313d[_0x8b13('0x35')]()});if(_[_0x8b13('0x36')](_0x3826a5)){_0x11657e['monitors']['push']({'filename':_0x8b13('0x34')+_0x1b313d['toLowerCase'](),'createdAt':moment()[_0x8b13('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5089c6[_0x8b13('0x37')],'status':_0x8b13('0x38')});}else{_0x3826a5[_0x8b13('0x37')]=_0x5089c6[_0x8b13('0x37')];_0x3826a5[_0x8b13('0x39')]='rec';}_0x36f732({'code':0xc8,'message':[_0x3304bd['uniqueid'],_0x8b13('0x3a'),_0x5089c6['mixmonitorid']][_0x8b13('0x14')]('\x20'),'mixmonitorid':_0x5089c6[_0x8b13('0x37')]});})['catch'](function(_0x1012eb){_0x5751db(_0x44bce2[_0x8b13('0x22')](0x1f5,[_0x3304bd[_0x8b13('0x2d')],_0x1012eb[_0x8b13('0x1c')][_0x8b13('0x35')]()][_0x8b13('0x14')]('\x20')));});}else{return _0x5751db(_0x44bce2[_0x8b13('0x22')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5a3f5c){var _0x56a3d1=this;return new Promise(function(_0x3eb3c5,_0x16ec3){if(ami[_0x8b13('0x11')]()==![]){return _0x16ec3(_0x56a3d1[_0x8b13('0x22')](0x1f4,[config[_0x8b13('0x1e')]['ip'],config[_0x8b13('0x1e')]['username'],_0x8b13('0x13')]['join']('\x20')));}var _0x13d0ef=schema(properties['voicechannel'])[_0x8b13('0x3')](_0x5a3f5c);if(_0x13d0ef[_0x8b13('0x26')]>0x0){return _0x16ec3(_0x56a3d1[_0x8b13('0x22')](0x1f4,_[_0x8b13('0x2c')](_0x13d0ef,_0x8b13('0x1c'))[_0x8b13('0x14')](',\x20')));}var _0x2009a1=_['find'](_0x3af81a['channels'],{'uniqueid':_0x5a3f5c['uniqueid']});if(_0x2009a1){return Promise[_0x8b13('0x3b')]()[_0x8b13('0x1b')](function(){if(_0x2009a1[_0x8b13('0x2e')]){return ami[_0x8b13('0x1a')]({'action':'StopMixMonitor','channel':_0x2009a1['channel'],'mixmonitorid':_0x5a3f5c[_0x8b13('0x37')]})['catch'](function(){});}})[_0x8b13('0x1b')](function(){if(_0x2009a1[_0x8b13('0x3c')]){return ami[_0x8b13('0x1a')]({'action':_0x8b13('0x3d'),'channel':_0x2009a1[_0x8b13('0x3c')],'mixmonitorid':_0x5a3f5c['mixmonitorid']})[_0x8b13('0x1d')](function(){});}})[_0x8b13('0x1b')](function(){var _0x302db5=_[_0x8b13('0x27')](_0x2009a1[_0x8b13('0x33')],{'mixmonitorid':_0x5a3f5c[_0x8b13('0x37')]});if(_0x302db5){_0x302db5[_0x8b13('0x39')]=_0x8b13('0x3e');}})[_0x8b13('0x1b')](function(){var _0x518298=util[_0x8b13('0x9')]('%s.%s',_0x5a3f5c[_0x8b13('0x30')]||_0x5a3f5c[_0x8b13('0x2d')],_0x5a3f5c[_0x8b13('0x9')]||'wav');var _0x148efb=_[_0x8b13('0x27')](_0x2009a1[_0x8b13('0x33')],{'filename':_0x8b13('0x34')+_0x518298[_0x8b13('0x35')]()});if(_0x148efb){_0x148efb[_0x8b13('0x39')]=_0x8b13('0x3e');}})['then'](function(){_0x3eb3c5({'code':0xc8,'message':[_0x5a3f5c[_0x8b13('0x2d')],'StopMixMonitor\x20Success'][_0x8b13('0x14')]('\x20')});})[_0x8b13('0x1d')](function(_0x193338){_0x16ec3(_0x56a3d1[_0x8b13('0x22')](0x1f5,[_0x5a3f5c[_0x8b13('0x2d')],_0x193338[_0x8b13('0x1c')][_0x8b13('0x35')]()][_0x8b13('0x14')]('\x20')));});}else{return _0x16ec3(_0x56a3d1[_0x8b13('0x22')](0x1f5,_0x8b13('0x3f')));}});},'VoiceQueuesChannels':function(_0x14d456){var _0xddac8e=this;return new Promise(function(_0xd55f3b){var _0x2bdfae=_[_0x8b13('0x2a')](_0x3af81a[_0x8b13('0x40')]);var _0xa1942a={'count':_0x2bdfae['length'],'rows':_0x2bdfae};if(_0x14d456&&_0x14d456[_0x8b13('0x41')]){if(![_0x8b13('0x42'),'outbound'][_0x8b13('0x43')](_0x14d456[_0x8b13('0x41')])){return _0x5d51b1(_0xddac8e[_0x8b13('0x22')](0x190,_0x8b13('0x44')));}var _0x25cb45=_[_0x8b13('0x45')](_0x2bdfae,function(_0x934f){return _0x934f[_0x8b13('0x41')]===_0x14d456[_0x8b13('0x41')];});_0xa1942a[_0x8b13('0x46')]=_0x25cb45[_0x8b13('0x26')];_0xa1942a[_0x8b13('0x47')]=_0x25cb45;}_0xd55f3b(_0xa1942a);});},'VoiceQueuesChannel':function(_0x137e8c){var _0x25ab1f=this;return new Promise(function(_0x22e7a6,_0x49e5f4){var _0x1e0b0b=schema(properties[_0x8b13('0x48')])['validate'](_0x137e8c);if(_0x1e0b0b[_0x8b13('0x26')]>0x0){return _0x49e5f4(_0x25ab1f[_0x8b13('0x22')](0x1f4,_[_0x8b13('0x2c')](_0x1e0b0b,_0x8b13('0x1c'))[_0x8b13('0x14')](',\x20')));}var _0x4f81ae=_[_0x8b13('0x27')](_0x3af81a[_0x8b13('0x40')],{'uniqueid':_0x137e8c[_0x8b13('0x2d')]});if(_0x4f81ae){_0x22e7a6(_0x4f81ae);}else{return _0x49e5f4(_0x25ab1f['error'](0x1f5,_0x8b13('0x3f')));}});},'VoiceQueuesChannelHangup':function(_0x17ab12){var _0x585392=this;return new Promise(function(_0x1a026f,_0x348c11){if(ami[_0x8b13('0x11')]()==![]){return _0x348c11(_0x585392[_0x8b13('0x22')](0x1f4,[config['asterisk']['ip'],config[_0x8b13('0x1e')][_0x8b13('0x12')],'ami\x20disconnected'][_0x8b13('0x14')]('\x20')));}var _0x130704=schema(properties[_0x8b13('0x49')])[_0x8b13('0x3')](_0x17ab12);if(_0x130704['length']>0x0){return _0x348c11(_0x585392[_0x8b13('0x22')](0x1f4,_[_0x8b13('0x2c')](_0x130704,_0x8b13('0x1c'))[_0x8b13('0x14')](',\x20')));}var _0xa06720=_[_0x8b13('0x27')](_0x3af81a['queueChannels'],{'uniqueid':_0x17ab12[_0x8b13('0x2d')]});if(_0xa06720&&_0xa06720[_0x8b13('0x2e')]){return ami[_0x8b13('0x1a')]({'action':'Hangup','channel':_0xa06720[_0x8b13('0x2e')]})[_0x8b13('0x1b')](function(_0x122ea2){_0x1a026f({'code':0xc8,'message':[_0x17ab12[_0x8b13('0x2d')],_0x122ea2['message']['toLowerCase']()]['join']('\x20')});})['catch'](function(_0x4fedbf){_0x348c11(_0x585392[_0x8b13('0x22')](0x1f5,[_0x17ab12[_0x8b13('0x2d')],_0x4fedbf['message'][_0x8b13('0x35')]()]['join']('\x20')));});}else{return _0x348c11(_0x585392[_0x8b13('0x22')](0x1f5,_0x8b13('0x3f')));}});},'VoiceQueuesChannelRedirect':function(_0x42790f){var _0x22c4d4=this;return new Promise(function(_0x43f12a,_0x2ff9c3){if(ami[_0x8b13('0x11')]()==![]){return _0x2ff9c3(_0x22c4d4['error'](0x1f4,[config[_0x8b13('0x1e')]['ip'],config['asterisk'][_0x8b13('0x12')],_0x8b13('0x13')][_0x8b13('0x14')]('\x20')));}var _0x11a4ba=schema(properties[_0x8b13('0x4a')])[_0x8b13('0x3')](_0x42790f);if(_0x11a4ba[_0x8b13('0x26')]>0x0){return _0x2ff9c3(_0x22c4d4['error'](0x1f4,_[_0x8b13('0x2c')](_0x11a4ba,'message')[_0x8b13('0x14')](',\x20')));}var _0x1c3544=_[_0x8b13('0x27')](_0x3af81a[_0x8b13('0x40')],{'uniqueid':_0x42790f[_0x8b13('0x2d')]});if(_0x1c3544&&_0x1c3544['channel']){return ami['Action']({'action':_0x8b13('0x4b'),'channel':_0x1c3544[_0x8b13('0x2e')],'exten':_0x42790f['exten'],'context':_0x42790f[_0x8b13('0x4c')]||_0x1c3544[_0x8b13('0x4c')],'priority':0x1})[_0x8b13('0x1b')](function(_0x51545e){_0x43f12a({'code':0xc8,'message':[_0x42790f[_0x8b13('0x2d')],_0x51545e[_0x8b13('0x1c')][_0x8b13('0x35')]()][_0x8b13('0x14')]('\x20')});})['catch'](function(_0x2a6c62){_0x2ff9c3(_0x22c4d4[_0x8b13('0x22')](0x1f5,[_0x42790f['uniqueid'],_0x2a6c62[_0x8b13('0x1c')][_0x8b13('0x35')]()][_0x8b13('0x14')]('\x20')));});}else{return _0x2ff9c3(_0x22c4d4[_0x8b13('0x22')](0x1f5,_0x8b13('0x3f')));}});},'Agents':function(_0x1243f8){return new Promise(function(_0x4334c1){var _0x1bb954=_[_0x8b13('0x2a')](_0x3af81a[_0x8b13('0xd')]);if(_0x1243f8&&_0x1243f8['id']){var _0x2f2bc5=_[_0x8b13('0x27')](_0x1bb954,function(_0x26b888){return _0x26b888['id']===_0x1243f8['id'];});_0x4334c1(_0x2f2bc5);}else{_0x4334c1({'count':_0x1bb954[_0x8b13('0x26')],'rows':_0x1bb954});}});},'Telephones':function(){return new Promise(function(_0x5bc4d6){var _0x28fb76=_['values'](_0x3af81a[_0x8b13('0x4d')]);_0x5bc4d6({'count':_0x28fb76[_0x8b13('0x26')],'rows':_0x28fb76});});},'Trunks':function(){return new Promise(function(_0x31fc95){var _0x132b81=_['values'](_0x3af81a['trunks']);_0x31fc95({'count':_0x132b81[_0x8b13('0x26')],'rows':_0x132b81});});},'OutboundChannels':function(){return new Promise(function(_0x2236b5){var _0x4d8c62=_[_0x8b13('0x2a')](_0x3af81a[_0x8b13('0x4e')]);_0x2236b5({'count':_0x4d8c62[_0x8b13('0x26')],'rows':_0x4d8c62});});},'Outbound':function(){return new Promise(function(_0x2d7c51){_0x2d7c51(_0x3af81a[_0x8b13('0x4f')]);});},'Campaigns':function(){return new Promise(function(_0x12aa48){var _0x15b553=_[_0x8b13('0x2a')](_0x3af81a[_0x8b13('0x50')]);_0x12aa48({'count':_0x15b553[_0x8b13('0x26')],'rows':_0x15b553});});},'VoiceQueuesPreview':function(_0x48fd36){var _0x2a1fd3=this;return new Promise(function(_0x2e7477,_0x5ac2c4){_0x5ae5b2[_0x8b13('0x51')](_0x48fd36['id'])[_0x8b13('0x1b')](function(_0x58138e){_0x2e7477({'code':0xc8,'message':_0x58138e[_0x8b13('0x1c')]});})[_0x8b13('0x1d')](function(_0x1f77b1){_0x5ac2c4(_0x2a1fd3[_0x8b13('0x22')](0x1f4,_0x1f77b1[_0x8b13('0x1c')]));});});},'EventManager':function(_0xe81c2e){var _0x142886=this;return new Promise(function(_0x1fde8b,_0x5d60f4){if(!_0xe81c2e[_0x8b13('0x52')]){return _0x5d60f4(_0x142886[_0x8b13('0x22')](0x1f4,_0x8b13('0x53')));}ami['emit'](_0x8b13('0x54')+_0xe81c2e['event'],_0xe81c2e[_0x8b13('0x1c')]);_0x1fde8b({'code':0xc8,'message':_0xe81c2e});});},'FaxAccounts':function(){return new Promise(function(_0x383d56){var _0x38a1ce=_[_0x8b13('0x2a')](_0x3af81a[_0x8b13('0x55')]);_0x383d56({'count':_0x38a1ce[_0x8b13('0x26')],'rows':_0x38a1ce});});},'SendFax':function(_0x41cefe){var _0x418eb4=this;return new Promise(function(_0xc73698,_0x2ae970){_0xd19a0f['send'](_0x41cefe)[_0x8b13('0x1b')](function(_0x111a4f){_0xc73698({'code':0xc8,'message':_0x111a4f[_0x8b13('0x1c')]});})[_0x8b13('0x1d')](function(_0x15f169){_0x2ae970(_0x418eb4[_0x8b13('0x22')](0x1f4,_0x15f169[_0x8b13('0x1c')]));});});},'CheckAfterSend':function(_0x9173d){var _0x5cb836=this;return new Promise(function(_0x188cc5,_0x291962){_0xd19a0f[_0x8b13('0x56')](_0x9173d)[_0x8b13('0x1b')](function(_0x4bb71a){_0x188cc5({'code':0xc8,'message':_0x4bb71a['message']});})[_0x8b13('0x1d')](function(_0x512f30){_0x291962(_0x5cb836[_0x8b13('0x22')](0x1f4,_0x512f30[_0x8b13('0x1c')]));});});}};var _0x57c9af=jayson['server'](_0x3fdf4d)[_0x8b13('0x57')]();_0x57c9af['on'](_0x8b13('0x22'),function(_0x3f5502){return _0x5d51b1(_0x3f5502);});_0x57c9af[_0x8b13('0x8')](0x232a,_0x8b13('0x58'),function(){console['log'](_0x8b13('0x59'),0x232a);return _0x13f7bd('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xee14=['rec','mixmonitorid','status','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','destinationchannel','StopMixMonitor','stop','queueChannels','type','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','map','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','custom:','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','reload','module','action','Reload','Action','then','message','catch','pick','command','Command','content','voiceQueues','push','length','omit','undefined','values','find','channels','uniqueid','channel','%s.%s','filename','MixMonitor','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xe2f86d,_0x3e8e21){var _0x16b6c6=function(_0x2475c2){while(--_0x2475c2){_0xe2f86d['push'](_0xe2f86d['shift']());}};_0x16b6c6(++_0x3e8e21);}(_0xee14,0x13a));var _0x4ee1=function(_0x418dde,_0x3e3744){_0x418dde=_0x418dde-0x0;var _0x24de37=_0xee14[_0x418dde];return _0x24de37;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x4ee1('0x0'));var schema=require(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var config=require(_0x4ee1('0x3'));var properties=require(_0x4ee1('0x4'));var ami=require(_0x4ee1('0x5'));var VoiceQueueSummary=require(_0x4ee1('0x6'));exports[_0x4ee1('0x7')]=function(_0x3ccbc6,_0x4bc729,_0xba6d36){return new Promise(function(_0x573700,_0x327c18){var _0x3a45a3={'QueuePause':function(_0x187656){return new Promise(function(_0x293d5f){var _0xdfe9c1=util[_0x4ee1('0x8')]('%s/%s',_0x4ee1('0x9'),_0x187656[_0x4ee1('0xa')]);if(_0x3ccbc6['timers']&&_0x3ccbc6[_0x4ee1('0xb')][_0xdfe9c1]&&_0x3ccbc6[_0x4ee1('0xb')][_0xdfe9c1][_0x4ee1('0xc')]){_0x3ccbc6[_0x4ee1('0xb')][_0xdfe9c1]['updateAcw']();}if(_0x3ccbc6[_0x4ee1('0xd')][_0xdfe9c1]){_0x3ccbc6[_0x4ee1('0xd')][_0xdfe9c1][_0x4ee1('0xe')]({'statePause':_0x187656[_0x4ee1('0xf')]?!![]:![]});}_0x293d5f({'code':0xc8,'message':_0x4ee1('0x10')});});},'Reload':function(_0x174427){var _0x5616d6=this;return new Promise(function(_0x390aab,_0x461f99){if(ami[_0x4ee1('0x11')]()==![]){return _0x461f99(_0x5616d6[_0x4ee1('0x12')](0x1f4,[config[_0x4ee1('0x13')]['ip'],config[_0x4ee1('0x13')][_0x4ee1('0x14')],_0x4ee1('0x15')][_0x4ee1('0x16')]('\x20')));}_0x174427=_['pick'](_0x174427,_[_0x4ee1('0x17')](properties[_0x4ee1('0x18')][_0x4ee1('0x19')]));_0x174427[_0x4ee1('0x1a')]=_0x4ee1('0x1b');return ami[_0x4ee1('0x1c')](_0x174427)[_0x4ee1('0x1d')](function(_0x2b8f0e){_0x390aab({'code':0xc8,'message':_0x2b8f0e[_0x4ee1('0x1e')]});})[_0x4ee1('0x1f')](function(_0x274de5){_0x461f99(_0x5616d6['error'](0x1f5,_0x274de5[_0x4ee1('0x1e')]));});});},'Command':function(_0x3db827){var _0x173388=this;return new Promise(function(_0x1034fb,_0x43f9a2){if(ami[_0x4ee1('0x11')]()==![]){return _0x43f9a2(_0x173388['error'](0x1f4,[config[_0x4ee1('0x13')]['ip'],config[_0x4ee1('0x13')][_0x4ee1('0x14')],_0x4ee1('0x15')][_0x4ee1('0x16')]('\x20')));}_0x3db827=_[_0x4ee1('0x20')](_0x3db827,_0x4ee1('0x21'));_0x3db827[_0x4ee1('0x1a')]=_0x4ee1('0x22');return ami[_0x4ee1('0x1c')](_0x3db827)['then'](function(_0x53d43f){_0x1034fb({'code':0xc8,'message':_0x53d43f[_0x4ee1('0x23')]});})[_0x4ee1('0x1f')](function(_0xaf87e7){_0x43f9a2(_0x173388[_0x4ee1('0x12')](0x1f5,_0xaf87e7[_0x4ee1('0x1e')]));});});},'VoiceQueues':function(){return new Promise(function(_0x28efdc){var _0x57d45d=[];for(var _0x5cc0b5 in _0x3ccbc6[_0x4ee1('0x24')]){if(_0x3ccbc6[_0x4ee1('0x24')]['hasOwnProperty'](_0x5cc0b5)){var _0x35900d=_0x3ccbc6[_0x4ee1('0x24')][_0x5cc0b5];var _0x36654c=new VoiceQueueSummary(_0x35900d);_0x57d45d[_0x4ee1('0x25')](_0x36654c);}}_0x28efdc({'count':_0x57d45d[_0x4ee1('0x26')],'rows':_0x57d45d});});},'UpdateVoiceQueue':function(_0x3c7b2a){return new Promise(function(_0x45bd0d,_0x56c4d3){var _0x1f7b74=_['find'](_0x3ccbc6[_0x4ee1('0x24')],{'id':parseInt(_0x3c7b2a['id'])});var _0x4ec408=_[_0x4ee1('0x27')](_0x3c7b2a,['id']);if(_0x1f7b74){for(var _0x1d91be in _0x4ec408){if(typeof _0x4ec408[_0x1d91be]!==_0x4ee1('0x28')&&typeof _0x1f7b74[_0x1d91be]!==_0x4ee1('0x28')){_0x1f7b74[_0x1d91be]=_0x4ec408[_0x1d91be];}}_0x45bd0d(_0x1f7b74);}else{_0x56c4d3();}});},'VoiceChannels':function(){return new Promise(function(_0x19ba11){var _0x4d5331=_[_0x4ee1('0x29')](_0x3ccbc6['channels']);_0x19ba11({'count':_0x4d5331[_0x4ee1('0x26')],'rows':_0x4d5331});});},'VoiceChannelMixMonitor':function(_0x3d5e6c){var _0x33fd38=this;return new Promise(function(_0x37bc2e,_0xac31e9){if(ami['isConnected']()==![]){return _0xac31e9(_0x33fd38[_0x4ee1('0x12')](0x1f4,[config[_0x4ee1('0x13')]['ip'],config[_0x4ee1('0x13')][_0x4ee1('0x14')],_0x4ee1('0x15')][_0x4ee1('0x16')]('\x20')));}var _0x5dbb15=schema(properties['voicechannel'])[_0x4ee1('0x1')](_0x3d5e6c);if(_0x5dbb15[_0x4ee1('0x26')]>0x0){return _0xac31e9(_0x33fd38[_0x4ee1('0x12')](0x1f4,_['map'](_0x5dbb15,_0x4ee1('0x1e'))[_0x4ee1('0x16')](',\x20')));}var _0x264aed=_[_0x4ee1('0x2a')](_0x3ccbc6[_0x4ee1('0x2b')],{'uniqueid':_0x3d5e6c[_0x4ee1('0x2c')]});if(_0x264aed&&_0x264aed[_0x4ee1('0x2d')]){var _0x199e11=util[_0x4ee1('0x8')](_0x4ee1('0x2e'),_0x3d5e6c[_0x4ee1('0x2f')]||_0x3d5e6c[_0x4ee1('0x2c')],_0x3d5e6c[_0x4ee1('0x8')]||'wav');return ami[_0x4ee1('0x1c')]({'action':_0x4ee1('0x30'),'channel':_0x264aed[_0x4ee1('0x2d')],'file':_0x199e11,'options':'ai(mixmonitorid)'})['then'](function(_0x257f67){var _0x84480e=_[_0x4ee1('0x2a')](_0x264aed[_0x4ee1('0x31')],{'filename':'/var/spool/asterisk/monitor/'+_0x199e11[_0x4ee1('0x32')]()});if(_[_0x4ee1('0x33')](_0x84480e)){_0x264aed[_0x4ee1('0x31')][_0x4ee1('0x25')]({'filename':_0x4ee1('0x34')+_0x199e11[_0x4ee1('0x32')](),'createdAt':moment()[_0x4ee1('0x8')](_0x4ee1('0x35')),'mixmonitorid':_0x257f67['mixmonitorid'],'status':_0x4ee1('0x36')});}else{_0x84480e[_0x4ee1('0x37')]=_0x257f67[_0x4ee1('0x37')];_0x84480e[_0x4ee1('0x38')]=_0x4ee1('0x36');}_0x37bc2e({'code':0xc8,'message':[_0x3d5e6c[_0x4ee1('0x2c')],'MixMonitor\x20Success',_0x257f67[_0x4ee1('0x37')]][_0x4ee1('0x16')]('\x20'),'mixmonitorid':_0x257f67[_0x4ee1('0x37')]});})[_0x4ee1('0x1f')](function(_0x6600f5){_0xac31e9(_0x33fd38[_0x4ee1('0x12')](0x1f5,[_0x3d5e6c[_0x4ee1('0x2c')],_0x6600f5[_0x4ee1('0x1e')][_0x4ee1('0x32')]()][_0x4ee1('0x16')]('\x20')));});}else{return _0xac31e9(_0x33fd38[_0x4ee1('0x12')](0x1f5,_0x4ee1('0x39')));}});},'VoiceChannelStopMixMonitor':function(_0x34fc7a){var _0x51fd40=this;return new Promise(function(_0x3b3bed,_0x40a3e3){if(ami['isConnected']()==![]){return _0x40a3e3(_0x51fd40[_0x4ee1('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x4ee1('0x13')]['username'],_0x4ee1('0x15')][_0x4ee1('0x16')]('\x20')));}var _0x557126=schema(properties[_0x4ee1('0x3a')])[_0x4ee1('0x1')](_0x34fc7a);if(_0x557126[_0x4ee1('0x26')]>0x0){return _0x40a3e3(_0x51fd40[_0x4ee1('0x12')](0x1f4,_['map'](_0x557126,_0x4ee1('0x1e'))[_0x4ee1('0x16')](',\x20')));}var _0x1a4157=_['find'](_0x3ccbc6['channels'],{'uniqueid':_0x34fc7a[_0x4ee1('0x2c')]});if(_0x1a4157){return Promise[_0x4ee1('0x3b')]()[_0x4ee1('0x1d')](function(){if(_0x1a4157[_0x4ee1('0x2d')]){return ami[_0x4ee1('0x1c')]({'action':'StopMixMonitor','channel':_0x1a4157['channel'],'mixmonitorid':_0x34fc7a[_0x4ee1('0x37')]})[_0x4ee1('0x1f')](function(){});}})[_0x4ee1('0x1d')](function(){if(_0x1a4157[_0x4ee1('0x3c')]){return ami['Action']({'action':_0x4ee1('0x3d'),'channel':_0x1a4157[_0x4ee1('0x3c')],'mixmonitorid':_0x34fc7a['mixmonitorid']})[_0x4ee1('0x1f')](function(){});}})[_0x4ee1('0x1d')](function(){var _0x21edeb=_[_0x4ee1('0x2a')](_0x1a4157[_0x4ee1('0x31')],{'mixmonitorid':_0x34fc7a[_0x4ee1('0x37')]});if(_0x21edeb){_0x21edeb[_0x4ee1('0x38')]=_0x4ee1('0x3e');}})[_0x4ee1('0x1d')](function(){var _0x4ebb28=util['format'](_0x4ee1('0x2e'),_0x34fc7a[_0x4ee1('0x2f')]||_0x34fc7a[_0x4ee1('0x2c')],_0x34fc7a[_0x4ee1('0x8')]||'wav');var _0x35edf5=_[_0x4ee1('0x2a')](_0x1a4157[_0x4ee1('0x31')],{'filename':_0x4ee1('0x34')+_0x4ebb28[_0x4ee1('0x32')]()});if(_0x35edf5){_0x35edf5['status']=_0x4ee1('0x3e');}})[_0x4ee1('0x1d')](function(){_0x3b3bed({'code':0xc8,'message':[_0x34fc7a[_0x4ee1('0x2c')],'StopMixMonitor\x20Success'][_0x4ee1('0x16')]('\x20')});})['catch'](function(_0x572bbd){_0x40a3e3(_0x51fd40['error'](0x1f5,[_0x34fc7a[_0x4ee1('0x2c')],_0x572bbd['message'][_0x4ee1('0x32')]()]['join']('\x20')));});}else{return _0x40a3e3(_0x51fd40[_0x4ee1('0x12')](0x1f5,_0x4ee1('0x39')));}});},'VoiceQueuesChannels':function(_0x2db9ce){var _0x5f4f78=this;return new Promise(function(_0x3368ed){var _0x4118d7=_[_0x4ee1('0x29')](_0x3ccbc6[_0x4ee1('0x3f')]);var _0x3cde18={'count':_0x4118d7[_0x4ee1('0x26')],'rows':_0x4118d7};if(_0x2db9ce&&_0x2db9ce[_0x4ee1('0x40')]){if(!['inbound','outbound'][_0x4ee1('0x41')](_0x2db9ce[_0x4ee1('0x40')])){return _0x327c18(_0x5f4f78[_0x4ee1('0x12')](0x190,_0x4ee1('0x42')));}var _0x44e65f=_[_0x4ee1('0x43')](_0x4118d7,function(_0x2c819f){return _0x2c819f[_0x4ee1('0x40')]===_0x2db9ce[_0x4ee1('0x40')];});_0x3cde18[_0x4ee1('0x44')]=_0x44e65f[_0x4ee1('0x26')];_0x3cde18[_0x4ee1('0x45')]=_0x44e65f;}_0x3368ed(_0x3cde18);});},'VoiceQueuesChannel':function(_0x3c2e42){var _0x5e3172=this;return new Promise(function(_0x1bafa8,_0x547c6c){var _0x147224=schema(properties[_0x4ee1('0x46')])['validate'](_0x3c2e42);if(_0x147224[_0x4ee1('0x26')]>0x0){return _0x547c6c(_0x5e3172[_0x4ee1('0x12')](0x1f4,_['map'](_0x147224,'message')[_0x4ee1('0x16')](',\x20')));}var _0x49df21=_[_0x4ee1('0x2a')](_0x3ccbc6[_0x4ee1('0x3f')],{'uniqueid':_0x3c2e42['uniqueid']});if(_0x49df21){_0x1bafa8(_0x49df21);}else{return _0x547c6c(_0x5e3172[_0x4ee1('0x12')](0x1f5,_0x4ee1('0x39')));}});},'VoiceQueuesChannelHangup':function(_0x475bb5){var _0x44eb11=this;return new Promise(function(_0x1a68e1,_0x433b9c){if(ami[_0x4ee1('0x11')]()==![]){return _0x433b9c(_0x44eb11['error'](0x1f4,[config['asterisk']['ip'],config[_0x4ee1('0x13')][_0x4ee1('0x14')],'ami\x20disconnected'][_0x4ee1('0x16')]('\x20')));}var _0x1b15c8=schema(properties[_0x4ee1('0x47')])['validate'](_0x475bb5);if(_0x1b15c8[_0x4ee1('0x26')]>0x0){return _0x433b9c(_0x44eb11['error'](0x1f4,_[_0x4ee1('0x48')](_0x1b15c8,'message')['join'](',\x20')));}var _0x17d663=_[_0x4ee1('0x2a')](_0x3ccbc6[_0x4ee1('0x3f')],{'uniqueid':_0x475bb5[_0x4ee1('0x2c')]});if(_0x17d663&&_0x17d663[_0x4ee1('0x2d')]){return ami['Action']({'action':_0x4ee1('0x49'),'channel':_0x17d663[_0x4ee1('0x2d')]})[_0x4ee1('0x1d')](function(_0x58eb1d){_0x1a68e1({'code':0xc8,'message':[_0x475bb5[_0x4ee1('0x2c')],_0x58eb1d[_0x4ee1('0x1e')][_0x4ee1('0x32')]()][_0x4ee1('0x16')]('\x20')});})[_0x4ee1('0x1f')](function(_0x18e999){_0x433b9c(_0x44eb11[_0x4ee1('0x12')](0x1f5,[_0x475bb5[_0x4ee1('0x2c')],_0x18e999[_0x4ee1('0x1e')][_0x4ee1('0x32')]()][_0x4ee1('0x16')]('\x20')));});}else{return _0x433b9c(_0x44eb11[_0x4ee1('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x10cc37){var _0x5bf5e9=this;return new Promise(function(_0x25cfc3,_0x4b9baa){if(ami[_0x4ee1('0x11')]()==![]){return _0x4b9baa(_0x5bf5e9[_0x4ee1('0x12')](0x1f4,[config[_0x4ee1('0x13')]['ip'],config[_0x4ee1('0x13')][_0x4ee1('0x14')],_0x4ee1('0x15')][_0x4ee1('0x16')]('\x20')));}var _0x447060=schema(properties[_0x4ee1('0x4a')])[_0x4ee1('0x1')](_0x10cc37);if(_0x447060[_0x4ee1('0x26')]>0x0){return _0x4b9baa(_0x5bf5e9[_0x4ee1('0x12')](0x1f4,_['map'](_0x447060,_0x4ee1('0x1e'))[_0x4ee1('0x16')](',\x20')));}var _0x1fddb6=_['find'](_0x3ccbc6['queueChannels'],{'uniqueid':_0x10cc37[_0x4ee1('0x2c')]});if(_0x1fddb6&&_0x1fddb6[_0x4ee1('0x2d')]){return ami['Action']({'action':_0x4ee1('0x4b'),'channel':_0x1fddb6[_0x4ee1('0x2d')],'exten':_0x10cc37[_0x4ee1('0x4c')],'context':_0x10cc37[_0x4ee1('0x4d')]||_0x1fddb6[_0x4ee1('0x4d')],'priority':0x1})[_0x4ee1('0x1d')](function(_0x243856){_0x25cfc3({'code':0xc8,'message':[_0x10cc37[_0x4ee1('0x2c')],_0x243856[_0x4ee1('0x1e')][_0x4ee1('0x32')]()]['join']('\x20')});})[_0x4ee1('0x1f')](function(_0x40a90b){_0x4b9baa(_0x5bf5e9['error'](0x1f5,[_0x10cc37['uniqueid'],_0x40a90b[_0x4ee1('0x1e')][_0x4ee1('0x32')]()][_0x4ee1('0x16')]('\x20')));});}else{return _0x4b9baa(_0x5bf5e9[_0x4ee1('0x12')](0x1f5,_0x4ee1('0x39')));}});},'Agents':function(_0x26b0ab){return new Promise(function(_0x18c937){var _0x57aafd=_[_0x4ee1('0x29')](_0x3ccbc6[_0x4ee1('0xd')]);if(_0x26b0ab&&_0x26b0ab['id']){var _0x44af66=_[_0x4ee1('0x2a')](_0x57aafd,function(_0x463e55){return _0x463e55['id']===_0x26b0ab['id'];});_0x18c937(_0x44af66);}else{_0x18c937({'count':_0x57aafd['length'],'rows':_0x57aafd});}});},'Telephones':function(){return new Promise(function(_0x316899){var _0x552e50=_[_0x4ee1('0x29')](_0x3ccbc6[_0x4ee1('0x4e')]);_0x316899({'count':_0x552e50['length'],'rows':_0x552e50});});},'Trunks':function(){return new Promise(function(_0x4f490e){var _0x448439=_[_0x4ee1('0x29')](_0x3ccbc6['trunks']);_0x4f490e({'count':_0x448439[_0x4ee1('0x26')],'rows':_0x448439});});},'OutboundChannels':function(){return new Promise(function(_0x5aacf1){var _0x58dd6c=_[_0x4ee1('0x29')](_0x3ccbc6[_0x4ee1('0x4f')]);_0x5aacf1({'count':_0x58dd6c[_0x4ee1('0x26')],'rows':_0x58dd6c});});},'Outbound':function(){return new Promise(function(_0x3bee28){_0x3bee28(_0x3ccbc6[_0x4ee1('0x50')]);});},'Campaigns':function(){return new Promise(function(_0x38698a){var _0x4a2278=_[_0x4ee1('0x29')](_0x3ccbc6['campaigns']);_0x38698a({'count':_0x4a2278['length'],'rows':_0x4a2278});});},'VoiceQueuesPreview':function(_0x465e06){var _0x2c1c65=this;return new Promise(function(_0x411c99,_0xa5c1a){_0x4bc729[_0x4ee1('0x51')](_0x465e06['id'])[_0x4ee1('0x1d')](function(_0x215f01){_0x411c99({'code':0xc8,'message':_0x215f01[_0x4ee1('0x1e')]});})['catch'](function(_0x163d45){_0xa5c1a(_0x2c1c65[_0x4ee1('0x12')](0x1f4,_0x163d45['message']));});});},'EventManager':function(_0x1f4da8){var _0x3aad89=this;return new Promise(function(_0xcd0dd9,_0x3fa913){if(!_0x1f4da8[_0x4ee1('0x52')]){return _0x3fa913(_0x3aad89[_0x4ee1('0x12')](0x1f4,_0x4ee1('0x53')));}ami['emit'](_0x4ee1('0x54')+_0x1f4da8['event'],_0x1f4da8[_0x4ee1('0x1e')]);_0xcd0dd9({'code':0xc8,'message':_0x1f4da8});});},'FaxAccounts':function(){return new Promise(function(_0xc913a1){var _0x19e2aa=_[_0x4ee1('0x29')](_0x3ccbc6['faxAccounts']);_0xc913a1({'count':_0x19e2aa[_0x4ee1('0x26')],'rows':_0x19e2aa});});},'SendFax':function(_0xce88e3){var _0x30557f=this;return new Promise(function(_0x4c3b1d,_0x4b8765){_0xba6d36[_0x4ee1('0x55')](_0xce88e3)['then'](function(_0x3976a6){_0x4c3b1d({'code':0xc8,'message':_0x3976a6[_0x4ee1('0x1e')]});})[_0x4ee1('0x1f')](function(_0x5690a9){_0x4b8765(_0x30557f['error'](0x1f4,_0x5690a9[_0x4ee1('0x1e')]));});});},'CheckAfterSend':function(_0x1e2360){var _0x33af51=this;return new Promise(function(_0x40c927,_0x3f940b){_0xba6d36[_0x4ee1('0x56')](_0x1e2360)[_0x4ee1('0x1d')](function(_0x5727ef){_0x40c927({'code':0xc8,'message':_0x5727ef['message']});})['catch'](function(_0x3fba19){_0x3f940b(_0x33af51[_0x4ee1('0x12')](0x1f4,_0x3fba19[_0x4ee1('0x1e')]));});});}};var _0xd919bc=jayson['server'](_0x3a45a3)[_0x4ee1('0x57')]();_0xd919bc['on']('error',function(_0x307fd6){return _0x327c18(_0x307fd6);});_0xd919bc[_0x4ee1('0x7')](0x232a,_0x4ee1('0x58'),function(){console[_0x4ee1('0x59')](_0x4ee1('0x5a'),0x232a);return _0x573700(_0x4ee1('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 a97ed12..057efbf 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 _0x4885=['emit','exec','data2','isNil','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','updatedAt','union','resolve','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','toLowerCase','merge','length','lodash','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify'];(function(_0x3edb26,_0x9613b4){var _0x4ad9f5=function(_0x5cb828){while(--_0x5cb828){_0x3edb26['push'](_0x3edb26['shift']());}};_0x4ad9f5(++_0x9613b4);}(_0x4885,0x12e));var _0x5488=function(_0xf15d06,_0x205368){_0xf15d06=_0xf15d06-0x0;var _0x387ebe=_0x4885[_0xf15d06];return _0x387ebe;};'use strict';var _=require(_0x5488('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x5488('0x1'))(_0x5488('0x2'));var cmContactRpc=require(_0x5488('0x3'));config[_0x5488('0x4')]=_[_0x5488('0x5')](config['redis'],{'host':_0x5488('0x6'),'port':0x18eb});var io=require(_0x5488('0x7'))(new Redis(config[_0x5488('0x4')]));function emit(_0x563c98,_0x35c9b1,_0xf14f4d,_0x516e04,_0x1a1806){logger[_0x5488('0x8')]('[CM][%s][%s]',_0x563c98,_0x35c9b1['id'],_0xf14f4d,_0x516e04,JSON[_0x5488('0x9')](_0x1a1806));io['to'](_0xf14f4d)[_0x5488('0xa')](_0x516e04,_0x1a1806);}exports[_0x5488('0xb')]=function(_0x46d1c2,_0x2c49d8,_0x15a8fa,_0x3b2bfa){var _0x3da30e,_0x3bd06f;var _0x35c0a6={};var _0x4520bd;var _0x3f8c1f=Number(_0x15a8fa['data1']);var _0x1b9a7f=_0x15a8fa[_0x5488('0xc')]?Boolean(Number(_0x15a8fa[_0x5488('0xc')])):![];var _0x2ad302;var _0x300b36=![];if(!_[_0x5488('0xd')](_0x15a8fa['data5'])){if(_0x15a8fa['data5']=='1')_0x300b36=!![];}if(!_0x300b36){if(_0x3b2bfa[_0x5488('0xe')]){_0x35c0a6['id']=_0x3b2bfa[_0x5488('0xe')];}}if(!_0x35c0a6['id']){_0x35c0a6['ListId']=_0x3f8c1f;_0x2ad302=_0x15a8fa[_0x5488('0xf')]&&_0x15a8fa['data3']!=='0'?_0x15a8fa['data3'][_0x5488('0x10')](','):[_0x5488('0x11')];_0x35c0a6[_0x5488('0x12')]=_[_0x5488('0x13')](_0x2ad302,function(_0x1084bf){var _0x25ada9={};_0x25ada9[_0x1084bf]=_0x3b2bfa[_0x5488('0x14')]?_0x3b2bfa[_0x5488('0x15')]:_0x3b2bfa[_0x5488('0x16')];return _0x25ada9;});_0x4520bd=_0x3b2bfa['routeId']?_0x3b2bfa[_0x5488('0x15')]:_0x3b2bfa['calleridnum'];}var _0x3a8ef8=['id',_0x5488('0x17'),_0x5488('0x18'),_0x5488('0x11'),_0x5488('0x19'),_0x5488('0x1a'),_0x5488('0x1b'),_0x5488('0x1c'),'scheduledAt',_0x5488('0x1d')];var _0x5a1b88=_[_0x5488('0x1e')](_0x3a8ef8,_0x2ad302);BPromise[_0x5488('0x1f')]()[_0x5488('0x20')](cmContactRpc[_0x5488('0x21')]({'attributes':_0x5a1b88,'where':_0x35c0a6,'phone':_0x4520bd}))['then'](function(_0x30c516){_0x3bd06f=_0x30c516;if(!_['isEmpty'](_0x3bd06f)){if(_0x3bd06f['length']===0x1){_0x3da30e=_0x3bd06f[0x0];logger['info'](_0x5488('0x22'),_0x3b2bfa['uniqueid'],_0x2c49d8['id'],_0x3da30e['id']);}else{logger[_0x5488('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3b2bfa[_0x5488('0x23')],_0x2c49d8['id'],_[_0x5488('0x13')](_0x3bd06f,'id')[_0x5488('0x24')](','));}return;}else{logger[_0x5488('0x8')](_0x5488('0x25'),_0x3b2bfa[_0x5488('0x23')],_0x2c49d8['id']);var _0x1e1a54={'ListId':_0x3f8c1f};var _0x48182d=_0x15a8fa[_0x5488('0x26')]&&_0x15a8fa[_0x5488('0x26')]!=='0'?_0x15a8fa[_0x5488('0x26')]:_0x5488('0x11');if(_0x1b9a7f){logger[_0x5488('0x8')](_0x5488('0x27'),_0x3b2bfa[_0x5488('0x23')],_0x2c49d8['id']);_0x1e1a54[_0x48182d]=_[_0x5488('0xd')](_0x3b2bfa['routeId'])?_0x3b2bfa[_0x5488('0x16')]:_0x3b2bfa[_0x5488('0x15')];if(_[_0x5488('0xd')](_0x3b2bfa[_0x5488('0x14')])){_0x1e1a54[_0x5488('0x17')]=_0x3b2bfa[_0x5488('0x28')]&&_0x3b2bfa['calleridname']!==''?_0x3b2bfa['calleridname']:_0x5488('0x29');}else{_0x1e1a54[_0x5488('0x17')]=_0x3b2bfa['destcalleridname']&&_0x3b2bfa[_0x5488('0x2a')]!==''?_0x3b2bfa[_0x5488('0x2a')]:_0x5488('0x29');}return BPromise['resolve']()[_0x5488('0x20')](cmContactRpc[_0x5488('0x2b')](_0x1e1a54))[_0x5488('0x20')](function(_0x33cd24){_0x3da30e=_0x33cd24;_0x3bd06f[_0x5488('0x2c')](_0x33cd24);if(_0x3da30e){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x3b2bfa[_0x5488('0x23')],_0x2c49d8['id'],_0x3da30e['id']);}return;});}else{logger[_0x5488('0x8')](_0x5488('0x2d'),_0x3b2bfa[_0x5488('0x23')],_0x2c49d8['id']);_0x1e1a54[_0x48182d]=_[_0x5488('0xd')](_0x3b2bfa[_0x5488('0x14')])?_0x3b2bfa[_0x5488('0x16')]:_0x3b2bfa[_0x5488('0x15')];if(_['isNil'](_0x3b2bfa[_0x5488('0x14')])){_0x1e1a54[_0x5488('0x17')]=_0x3b2bfa['calleridname']&&_0x3b2bfa['calleridname']!==''?_0x3b2bfa[_0x5488('0x28')]:_0x5488('0x29');}else{_0x1e1a54[_0x5488('0x17')]=_0x3b2bfa[_0x5488('0x2a')]&&_0x3b2bfa[_0x5488('0x2a')]!==''?_0x3b2bfa[_0x5488('0x2a')]:_0x5488('0x29');}_0x3da30e=_0x1e1a54;_0x3bd06f[_0x5488('0x2c')](_0x1e1a54);return;}}})[_0x5488('0x20')](function(){if(_0x46d1c2){emit(_0x3b2bfa[_0x5488('0x23')],_0x2c49d8,util[_0x5488('0x2e')]('user:%s',_0x46d1c2[_0x5488('0x2f')]),util[_0x5488('0x2e')](_0x5488('0x30'),_0x15a8fa['action'][_0x5488('0x31')]()),{'evt':_[_0x5488('0x32')](_0x3b2bfa,{'autoCreate':_0x1b9a7f}),'contact':_0x3da30e===undefined?{}:_0x3da30e,'contacts':_0x3bd06f[_0x5488('0x33')]===0x0?undefined:_0x3bd06f});}});}; \ No newline at end of file +var _0xb64b=['isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','routeId','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','stringify','exec','data1'];(function(_0x568c13,_0x1ed985){var _0x4eb193=function(_0x5d411b){while(--_0x5d411b){_0x568c13['push'](_0x568c13['shift']());}};_0x4eb193(++_0x1ed985);}(_0xb64b,0x150));var _0xbb64=function(_0x12306d,_0x2b8f14){_0x12306d=_0x12306d-0x0;var _0x16804f=_0xb64b[_0x12306d];return _0x16804f;};'use strict';var _=require(_0xbb64('0x0'));var BPromise=require(_0xbb64('0x1'));var Redis=require(_0xbb64('0x2'));var util=require(_0xbb64('0x3'));var config=require(_0xbb64('0x4'));var logger=require(_0xbb64('0x5'))(_0xbb64('0x6'));var cmContactRpc=require(_0xbb64('0x7'));config[_0xbb64('0x8')]=_['defaults'](config[_0xbb64('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xbb64('0x9'))(new Redis(config[_0xbb64('0x8')]));function emit(_0x2df55f,_0x3801b9,_0x20fe7c,_0x5c083c,_0x2f1ce1){logger[_0xbb64('0xa')]('[CM][%s][%s]',_0x2df55f,_0x3801b9['id'],_0x20fe7c,_0x5c083c,JSON[_0xbb64('0xb')](_0x2f1ce1));io['to'](_0x20fe7c)['emit'](_0x5c083c,_0x2f1ce1);}exports[_0xbb64('0xc')]=function(_0x292166,_0x5910a6,_0x4681a0,_0x23236f){var _0x19cdb2,_0x216092;var _0x551149={};var _0x12bdbd;var _0x1358be=Number(_0x4681a0[_0xbb64('0xd')]);var _0x4750ea=_0x4681a0['data2']?Boolean(Number(_0x4681a0['data2'])):![];var _0xe8c579;var _0x10493e=![];if(!_[_0xbb64('0xe')](_0x4681a0[_0xbb64('0xf')])){if(_0x4681a0[_0xbb64('0xf')]=='1')_0x10493e=!![];}if(!_0x10493e){if(_0x23236f[_0xbb64('0x10')]){_0x551149['id']=_0x23236f[_0xbb64('0x10')];}}if(!_0x551149['id']){_0x551149[_0xbb64('0x11')]=_0x1358be;_0xe8c579=_0x4681a0[_0xbb64('0x12')]&&_0x4681a0[_0xbb64('0x12')]!=='0'?_0x4681a0[_0xbb64('0x12')][_0xbb64('0x13')](','):[_0xbb64('0x14')];_0x551149[_0xbb64('0x15')]=_[_0xbb64('0x16')](_0xe8c579,function(_0x28b743){var _0x664ef6={};_0x664ef6[_0x28b743]=_0x23236f['routeId']?_0x23236f[_0xbb64('0x17')]:_0x23236f[_0xbb64('0x18')];return _0x664ef6;});_0x12bdbd=_0x23236f[_0xbb64('0x19')]?_0x23236f[_0xbb64('0x17')]:_0x23236f['calleridnum'];}var _0x469d30=['id',_0xbb64('0x1a'),'lastName',_0xbb64('0x14'),_0xbb64('0x1b'),_0xbb64('0x1c'),_0xbb64('0x11'),_0xbb64('0x1d'),_0xbb64('0x1e'),_0xbb64('0x1f')];var _0x2cf64a=_['union'](_0x469d30,_0xe8c579);BPromise[_0xbb64('0x20')]()[_0xbb64('0x21')](cmContactRpc['getContacts']({'attributes':_0x2cf64a,'where':_0x551149,'phone':_0x12bdbd}))['then'](function(_0x33a27f){_0x216092=_0x33a27f;if(!_['isEmpty'](_0x216092)){if(_0x216092['length']===0x1){_0x19cdb2=_0x216092[0x0];logger[_0xbb64('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x23236f[_0xbb64('0x22')],_0x5910a6['id'],_0x19cdb2['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x23236f['uniqueid'],_0x5910a6['id'],_[_0xbb64('0x16')](_0x216092,'id')[_0xbb64('0x23')](','));}return;}else{logger['info'](_0xbb64('0x24'),_0x23236f[_0xbb64('0x22')],_0x5910a6['id']);var _0x538b82={'ListId':_0x1358be};var _0x17789c=_0x4681a0[_0xbb64('0x25')]&&_0x4681a0['data4']!=='0'?_0x4681a0[_0xbb64('0x25')]:_0xbb64('0x14');if(_0x4750ea){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x23236f[_0xbb64('0x22')],_0x5910a6['id']);_0x538b82[_0x17789c]=_['isNil'](_0x23236f[_0xbb64('0x19')])?_0x23236f[_0xbb64('0x18')]:_0x23236f[_0xbb64('0x17')];if(_[_0xbb64('0xe')](_0x23236f['routeId'])){_0x538b82['firstName']=_0x23236f[_0xbb64('0x26')]&&_0x23236f['calleridname']!==_0xbb64('0x27')?_0x23236f[_0xbb64('0x26')]:_0xbb64('0x28');}else{_0x538b82[_0xbb64('0x1a')]=_0x23236f[_0xbb64('0x29')]&&_0x23236f[_0xbb64('0x29')]!==''?_0x23236f[_0xbb64('0x29')]:_0xbb64('0x28');}return BPromise[_0xbb64('0x20')]()[_0xbb64('0x21')](cmContactRpc['createContact'](_0x538b82))['then'](function(_0x16278a){_0x19cdb2=_0x16278a;_0x216092[_0xbb64('0x2a')](_0x16278a);if(_0x19cdb2){logger[_0xbb64('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x23236f[_0xbb64('0x22')],_0x5910a6['id'],_0x19cdb2['id']);}return;});}else{logger[_0xbb64('0xa')](_0xbb64('0x2b'),_0x23236f[_0xbb64('0x22')],_0x5910a6['id']);_0x538b82[_0x17789c]=_['isNil'](_0x23236f[_0xbb64('0x19')])?_0x23236f[_0xbb64('0x18')]:_0x23236f[_0xbb64('0x17')];if(_['isNil'](_0x23236f[_0xbb64('0x19')])){_0x538b82[_0xbb64('0x1a')]=_0x23236f['calleridname']&&_0x23236f[_0xbb64('0x26')]!==_0xbb64('0x27')?_0x23236f['calleridname']:'Unknown';}else{_0x538b82[_0xbb64('0x1a')]=_0x23236f['destcalleridname']&&_0x23236f[_0xbb64('0x29')]!==_0xbb64('0x27')?_0x23236f[_0xbb64('0x29')]:_0xbb64('0x28');}_0x19cdb2=_0x538b82;_0x216092[_0xbb64('0x2a')](_0x538b82);return;}}})[_0xbb64('0x21')](function(){if(_0x292166){emit(_0x23236f[_0xbb64('0x22')],_0x5910a6,util[_0xbb64('0x2c')]('user:%s',_0x292166['name']),util['format'](_0xbb64('0x2d'),_0x4681a0[_0xbb64('0x2e')][_0xbb64('0x2f')]()),{'evt':_[_0xbb64('0x30')](_0x23236f,{'autoCreate':_0x4750ea}),'contact':_0x19cdb2===undefined?{}:_0x19cdb2,'contacts':_0x216092[_0xbb64('0x31')]===0x0?undefined:_0x216092});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 60a3417..699dd49 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 _0xc5c8=['urlforward','script','buildUri','parse','query','search','replace','AllConditions','length','checkConditions','channel','AnyConditions','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','routeId','mailSubstatus','substatus','offlineMessage','created','exports','util','lodash','url','ioredis','./cmContact','./script','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','triggers','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','salesforceAccounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','undefined','voice','agents','interface','checkTriggers','hasOwnProperty','checkTrigger','variables','Actions','toLowerCase','contactmanager','motionbar','data1','data2','templates','html','template\x20not\x20found','uri','isNil','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winapp','winApplication','render','winArguments','data3','user:%s','format','trigger:%s:%s','merge','jscripty','name','trigger:%s','action','exec','integration','accounts','queue'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0xc5c8,0x118));var _0x8c5c=function(_0xd79aab,_0x19c44b){_0xd79aab=_0xd79aab-0x0;var _0x39f8e0=_0xc5c8[_0xd79aab];return _0x39f8e0;};'use strict';var util=require(_0x8c5c('0x0'));var _=require(_0x8c5c('0x1'));var url=require(_0x8c5c('0x2'));var Mustache=require('mustache');var Redis=require(_0x8c5c('0x3'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0x8c5c('0x4'));var script=require(_0x8c5c('0x5'));var config=require('../../../config/environment');var logger=require(_0x8c5c('0x6'))(_0x8c5c('0x7'));var ami=require(_0x8c5c('0x8'));config[_0x8c5c('0x9')]=_[_0x8c5c('0xa')](config[_0x8c5c('0x9')],{'host':_0x8c5c('0xb'),'port':0x18eb});var io=require(_0x8c5c('0xc'))(new Redis(config[_0x8c5c('0x9')]));var operators={'equals':function(_0x1a47ef,_0x5a9a26){return _0x1a47ef==_0x5a9a26;},'not_equals':function(_0x552b87,_0x577081){return _0x552b87!=_0x577081;}};var barAndWebActions=[_0x8c5c('0xd'),_0x8c5c('0x2'),'winapp'];function Trigger(_0x5a24e8){this[_0x8c5c('0xe')]=_0x5a24e8[_0x8c5c('0xe')];this['agents']=_0x5a24e8['agents'];this[_0x8c5c('0xf')]=_0x5a24e8[_0x8c5c('0xf')];this['templates']=_0x5a24e8['templates'];this[_0x8c5c('0x10')]=_0x5a24e8[_0x8c5c('0x10')];this[_0x8c5c('0x11')]=_0x5a24e8['zendeskAccounts'];this[_0x8c5c('0x12')]=_0x5a24e8[_0x8c5c('0x12')];this['salesforceAccounts']=_0x5a24e8['salesforceAccounts'];this[_0x8c5c('0x13')]=_0x5a24e8['sugarcrmAccounts'];this[_0x8c5c('0x14')]=_0x5a24e8[_0x8c5c('0x14')];this[_0x8c5c('0x15')]=_0x5a24e8[_0x8c5c('0x15')];this[_0x8c5c('0x16')]=_0x5a24e8[_0x8c5c('0x16')];this[_0x8c5c('0x17')]=_0x5a24e8[_0x8c5c('0x17')];this[_0x8c5c('0x18')]=_0x5a24e8[_0x8c5c('0x18')];this['freshsalesAccounts']=_0x5a24e8['freshsalesAccounts'];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x8c5c('0x19')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x8c5c('0x13')],'zoho':this[_0x8c5c('0x14')],'desk':this[_0x8c5c('0x15')],'vtiger':this[_0x8c5c('0x16')],'dynamics365':this[_0x8c5c('0x18')],'freshsales':this[_0x8c5c('0x1a')],'servicenow':this[_0x8c5c('0x17')]};ami['on'](_0x8c5c('0x1b'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on']('custom:agentconnect',this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x1e'),this['syncCustomEvent'][_0x8c5c('0x1d')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent']['bind'](this));ami['on'](_0x8c5c('0x1f'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x20'),this[_0x8c5c('0x1c')]['bind'](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x21'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x22'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x23'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x24'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on']('custom:timeout',this[_0x8c5c('0x1c')]['bind'](this));ami['on'](_0x8c5c('0x25'),this[_0x8c5c('0x26')][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x27'),this[_0x8c5c('0x26')]['bind'](this));ami['on']('custom:dialend',this[_0x8c5c('0x26')][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x28'),this[_0x8c5c('0x1c')]['bind'](this));ami['on'](_0x8c5c('0x29'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x2a'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on']('custom:outgoingmessage',this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x2b'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x2c'),this['syncCustomEvent'][_0x8c5c('0x1d')](this));ami['on'](_0x8c5c('0x2d'),this[_0x8c5c('0x1c')][_0x8c5c('0x1d')](this));}Trigger[_0x8c5c('0x2e')][_0x8c5c('0x2f')]=function(_0x54ec0e,_0x359a5f,_0xdcceef){logger[_0x8c5c('0x30')](_0x54ec0e,_0x359a5f,JSON['stringify'](_0xdcceef));io['to'](_0x54ec0e)[_0x8c5c('0x2f')](_0x359a5f,_0xdcceef);};Trigger[_0x8c5c('0x2e')][_0x8c5c('0x1c')]=function(_0xdd0670){var _0x333cab=_[_0x8c5c('0x31')](_0xdd0670);if(typeof _0x333cab[_0x8c5c('0x32')]===_0x8c5c('0x33')){_0x333cab[_0x8c5c('0x32')]=_0x8c5c('0x34');}this['checkTriggers'](_0x333cab);};Trigger[_0x8c5c('0x2e')][_0x8c5c('0x26')]=function(_0x32d75b){if(this[_0x8c5c('0x35')][_0x32d75b[_0x8c5c('0x36')]]){this[_0x8c5c('0x1c')](_0x32d75b);}};Trigger['prototype'][_0x8c5c('0x37')]=function(_0x303beb){var _0x493353;for(var _0x1d8f2c in this['triggers']){if(this['triggers'][_0x8c5c('0x38')](_0x1d8f2c)){if(this[_0x8c5c('0xe')][_0x1d8f2c]['status']){_0x493353=this[_0x8c5c('0x39')](this[_0x8c5c('0xe')][_0x1d8f2c],_0x303beb);if(_0x493353){_['merge'](_0x303beb,_0x303beb[_0x8c5c('0x3a')]);for(var _0x3fa3f1=0x0,_0x3b5a9e,_0x120182,_0x196fdc;_0x3fa3f10x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x326f,0xd1));var _0xf326=function(_0x40ba23,_0x45d0b3){_0x40ba23=_0x40ba23-0x0;var _0x4e0335=_0x326f[_0x40ba23];return _0x4e0335;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 2c3b1e1..d6cbbb6 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 _0xdc33=['/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','toLowerCase','\x20eq\x20\x27','replace','%2b','enduserId','contactid','length','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','info',']\x20Agent\x20found\x20','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','internalemailaddress','systemuserid','catch','outbound','destcalleridnum','calleridnum','contacts'];(function(_0x5b501f,_0x2be032){var _0x4c10c7=function(_0x48d091){while(--_0x48d091){_0x5b501f['push'](_0x5b501f['shift']());}};_0x4c10c7(++_0x2be032);}(_0xdc33,0x187));var _0x3dc3=function(_0x5c4679,_0x404702){_0x5c4679=_0x5c4679-0x0;var _0x2fb236=_0xdc33[_0x5c4679];return _0x2fb236;};'use strict';var _=require(_0x3dc3('0x0'));var rp=require(_0x3dc3('0x1'));var util=require('util');var intUtil=require(_0x3dc3('0x2'));var md5=require(_0x3dc3('0x3'));var Redis=require(_0x3dc3('0x4'));var logger=require('../../../../config/logger')(_0x3dc3('0x5'));var config=require(_0x3dc3('0x6'));config[_0x3dc3('0x7')]=_[_0x3dc3('0x8')](config[_0x3dc3('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3dc3('0x9'))(new Redis(config[_0x3dc3('0x7')]));function getAuthToken(_0x18b7c0,_0x153ed8,_0x19a383){if(_0x18b7c0[_0x3dc3('0xa')]){_0x18b7c0[_0x3dc3('0xb')]=_0x18b7c0[_0x3dc3('0xc')][_0x3dc3('0xd')];_0x18b7c0[_0x3dc3('0xe')]=_0x18b7c0[_0x3dc3('0xc')][_0x3dc3('0xf')];return Promise['resolve'](_0x18b7c0[_0x3dc3('0xc')][_0x3dc3('0x10')]);}var _0x1568f8={'method':_0x3dc3('0x11'),'uri':_0x153ed8,'form':{'client_id':_0x18b7c0['clientId'],'resource':_0x18b7c0[_0x3dc3('0xb')],'username':_0x18b7c0[_0x3dc3('0x12')],'password':_0x18b7c0[_0x3dc3('0x13')],'grant_type':_0x3dc3('0x13'),'client_secret':_0x18b7c0['clientSecret']},'json':!![]};return rp(_0x1568f8)[_0x3dc3('0x14')](function(_0x3f3d41){return _0x3f3d41[_0x3dc3('0x15')];})['catch'](function(_0x20b8cf){logger[_0x3dc3('0x16')]('['+[_0x19a383[_0x3dc3('0x17')]()]+_0x3dc3('0x18'));return _0x20b8cf[_0x3dc3('0x19')];});}function getUser(_0x1c9263,_0x364b61,_0x335e4e,_0x3e77e6,_0x26fc84,_0x38eabf){return new Promise(function(_0x419e19,_0x3e5287){return getAuthToken(_0x364b61,_0x3e77e6,_0x38eabf)[_0x3dc3('0x14')](function(_0x323db3){var _0x45eed7={'method':_0x3dc3('0x1a'),'uri':_0x26fc84+_0x3dc3('0x1b'),'headers':{'Authorization':_0x3dc3('0x1c')+_0x323db3,'OData-Version':_0x3dc3('0x1d')},'json':!![]};return rp(_0x45eed7);})[_0x3dc3('0x14')](function(_0x4d10a6){var _0x5c48a9=_0x4d10a6[_0x3dc3('0x1e')];var _0x2341dc=![];var _0x4175d3=null;if(!_[_0x3dc3('0x1f')](_0x335e4e)){if(intUtil['validateEmail'](_0x335e4e[_0x3dc3('0x20')])){_0x1c9263['userEmail']=_0x335e4e[_0x3dc3('0x20')];for(_0x4175d3=0x0;_0x4175d3<_0x5c48a9['length'];_0x4175d3++){if(_0x5c48a9[_0x4175d3]['internalemailaddress']===_0x335e4e[_0x3dc3('0x20')]&&!_0x5c48a9[_0x4175d3]['isdisabled']){_0x2341dc=!![];logger[_0x3dc3('0x21')]('['+[_0x38eabf[_0x3dc3('0x17')]()]+_0x3dc3('0x22')+_0x5c48a9[_0x4175d3]['systemuserid']+'!');_0x1c9263[_0x3dc3('0x23')]=_0x5c48a9[_0x4175d3]['systemuserid'];}}}}if(!_0x2341dc){logger['info']('['+[_0x38eabf[_0x3dc3('0x17')]()]+_0x3dc3('0x24'));_0x1c9263[_0x3dc3('0x25')]=_0x364b61[_0x3dc3('0x12')];for(_0x4175d3=0x0;_0x4175d3<_0x5c48a9['length'];_0x4175d3++){if(_0x5c48a9[_0x4175d3][_0x3dc3('0x26')]===_0x364b61[_0x3dc3('0x12')]){_0x1c9263[_0x3dc3('0x23')]=_0x5c48a9[_0x4175d3][_0x3dc3('0x27')];}}}_0x419e19(_0x1c9263);})[_0x3dc3('0x28')](function(_0x48e912){_0x3e5287(_0x48e912[_0x3dc3('0x19')]);});});}function createEndUser(_0x486502,_0x492e3,_0x1fa668,_0xf774ab,_0x2a56ea,_0x517be2,_0x15e925){return new Promise(function(_0x1e9ba3,_0x1ae8b0){return getAuthToken(_0x492e3,_0x1fa668,_0x517be2)[_0x3dc3('0x14')](function(_0x4de76f){var _0x326299=_0x517be2['toLowerCase']()===_0x3dc3('0x29')?_0x2a56ea[_0x3dc3('0x2a')]:_0x2a56ea[_0x3dc3('0x2b')];var _0x304f56={'method':_0x3dc3('0x11'),'uri':_0xf774ab+_0x3dc3('0x2c'),'body':{'fullname':_0x326299,'firstname':_0x326299,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3dc3('0x2d')+_0x486502[_0x3dc3('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4de76f,'OData-Version':_0x3dc3('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x304f56[_0x3dc3('0x2e')][_0x15e925]=_0x326299;return rp(_0x304f56);})[_0x3dc3('0x14')](function(_0xdd42c){var _0x30693d=_0xdd42c[_0x3dc3('0x2f')][_0x3dc3('0x30')];var _0x9fdd91=_0x30693d[_0x3dc3('0x31')](_0x30693d[_0x3dc3('0x32')]('(')+0x1,_0x30693d[_0x3dc3('0x32')](')'));_0x486502['enduserId']=_0x9fdd91;_0x1e9ba3(_0x486502);})[_0x3dc3('0x28')](function(_0x86785d){_0x1ae8b0(_0x86785d[_0x3dc3('0x19')]);});});}function getEndUser(_0x5f2b6c,_0x3a7b1b,_0xf4b1bf,_0x3c8db,_0x4414f0,_0x1ab521,_0x5c6c43,_0x4b0054){var _0x15ad2f=_0x1ab521[_0x3dc3('0x33')]()==='outbound'?_0x4414f0['destcalleridnum']:_0x4414f0[_0x3dc3('0x2b')];return getAuthToken(_0x3a7b1b,_0xf4b1bf,_0x1ab521)['then'](function(_0x105229){_0x4b0054=_0x4b0054?_0x4b0054:'telephone1';var _0x21c9ff={'method':_0x3dc3('0x1a'),'uri':_0x3c8db+'contacts?$select='+_0x4b0054+'&$filter='+_0x4b0054+_0x3dc3('0x34')+_0x15ad2f[_0x3dc3('0x35')]('+',_0x3dc3('0x36'))+'\x27','headers':{'Authorization':_0x3dc3('0x1c')+_0x105229,'If-None-Match':null,'OData-Version':_0x3dc3('0x1d')},'json':!![]};return rp(_0x21c9ff);})['then'](function(_0x577403){var _0xa367c3=![];if(!_0x577403)return _0xa367c3;var _0xd364=_0x577403['value'];for(var _0x41b832=0x0;_0x41b832<_0xd364['length'];_0x41b832++){if(_0xd364[_0x41b832][_0x4b0054]===_0x15ad2f){_0xa367c3=!![];_0x5f2b6c[_0x3dc3('0x37')]=_0xd364[_0x41b832][_0x3dc3('0x38')];}}return _0xa367c3;})[_0x3dc3('0x14')](function(_0x491291){if(_0x491291)return _0x5f2b6c;if(_0x5c6c43==='nothing'){logger[_0x3dc3('0x21')]('['+[_0x1ab521[_0x3dc3('0x17')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x5f2b6c;}return createEndUser(_0x5f2b6c,_0x3a7b1b,_0xf4b1bf,_0x3c8db,_0x4414f0,_0x1ab521,_0x4b0054)[_0x3dc3('0x14')](function(_0x173fbc){logger['info']('['+[_0x1ab521[_0x3dc3('0x17')]()]+']\x20Enduser\x20created!',_0x173fbc[_0x3dc3('0x37')]);return _0x173fbc;});});}function getCustomFields(_0x3485c7,_0x605ae3,_0x565845){var _0x580aec={};if(_0x3485c7[_0x3dc3('0x39')]>0x0){_[_0x3dc3('0x3a')](_0x3485c7,function(_0x3b59c2){if(_[_0x3dc3('0x3b')](['string',_0x3dc3('0x3c')],_0x3b59c2[_0x3dc3('0x3d')])&&_0x3b59c2[_0x3dc3('0x3e')]&&!_0x3b59c2[_0x3dc3('0x3f')]){var _0x5e2ad0=_0x3b59c2[_0x3dc3('0x40')][_0x3dc3('0x33')]();var _0x276bc9=_0x5e2ad0[_0x3dc3('0x31')](0x0,_0x5e2ad0[_0x3dc3('0x41')]('_'));var _0xed7740=_0x5e2ad0['substring'](_0x5e2ad0[_0x3dc3('0x41')]('_')+0x1);if(_0x276bc9===_0x565845){_0x580aec[_0xed7740]=_0x3b59c2[_0x3dc3('0x42')];}}});}return _0x580aec;}function getTicket(_0x43b495,_0x4501bb,_0x5a4fdf,_0x34fca3,_0x50d06e,_0xd56a46,_0x1be8fc){return new Promise(function(_0x28ccd0,_0x110fa3){var _0x2ae713;return getAuthToken(_0x4501bb,_0x5a4fdf,_0x1be8fc)['then'](function(_0x340a18){if(_0xd56a46[_0x3dc3('0x43')]===_0x3dc3('0x44')){_0x2ae713={'method':_0x3dc3('0x11'),'uri':_0x34fca3+'incidents','body':Object[_0x3dc3('0x45')]({},{'title':intUtil[_0x3dc3('0x46')](_0xd56a46[_0x3dc3('0x47')],_0x50d06e,'\x20'),'description':intUtil['getString'](_0xd56a46[_0x3dc3('0x48')],_0x50d06e,'\x0a'),'customerid_contact@odata.bind':_0x43b495[_0x3dc3('0x37')]?_0x3dc3('0x49')+_0x43b495[_0x3dc3('0x37')]+')':undefined,'ownerid@odata.bind':_0x3dc3('0x2d')+_0x43b495['userId']+')','caseorigincode':'1'},getCustomFields(_0xd56a46[_0x3dc3('0x4a')],_0x50d06e,_0xd56a46['ticketType'])),'headers':{'Authorization':_0x3dc3('0x1c')+_0x340a18,'OData-Version':_0x3dc3('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xd56a46[_0x3dc3('0x43')]===_0x3dc3('0x4b')){var _0x413031=_0x43b495[_0x3dc3('0x37')]?[{'partyid_systemuser@odata.bind':_0x3dc3('0x2d')+_0x43b495[_0x3dc3('0x23')]+')','participationtypemask':_0x43b495[_0x3dc3('0x4c')]===_0x3dc3('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x3dc3('0x49')+_0x43b495['enduserId']+')','participationtypemask':_0x43b495[_0x3dc3('0x4c')]===_0x3dc3('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x43b495['userId']+')','participationtypemask':_0x43b495[_0x3dc3('0x4c')]==='queue'?0x2:0x1}];_0x2ae713={'method':_0x3dc3('0x11'),'uri':_0x34fca3+_0x3dc3('0x4e'),'body':Object[_0x3dc3('0x45')]({},{'subject':intUtil[_0x3dc3('0x46')](_0xd56a46[_0x3dc3('0x47')],_0x50d06e,'\x20'),'phonenumber':String(_0x50d06e[_0x3dc3('0x2b')]),'description':intUtil[_0x3dc3('0x46')](_0xd56a46[_0x3dc3('0x48')],_0x50d06e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x43b495['enduserId']?'/contacts('+_0x43b495['enduserId']+')':undefined,'ownerid@odata.bind':_0x3dc3('0x2d')+_0x43b495['userId']+')','directioncode':_0x43b495[_0x3dc3('0x4c')]===_0x3dc3('0x4d')?![]:!![],'phonecall_activity_parties':_0x413031},getCustomFields(_0xd56a46[_0x3dc3('0x4a')],_0x50d06e,_0xd56a46[_0x3dc3('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x340a18,'OData-Version':_0x3dc3('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2ae713);})[_0x3dc3('0x14')](function(_0x294be6){var _0x2bdb08=_0x294be6['headers']['odata-entityid'];var _0x16e582=_0x2bdb08[_0x3dc3('0x31')](_0x2bdb08[_0x3dc3('0x32')]('(')+0x1,_0x2bdb08[_0x3dc3('0x32')](')'));_0x43b495['ticketId']=_0x16e582;_0x28ccd0(_0x43b495);})['catch'](function(_0x21a9eb){_0x110fa3(_0x21a9eb[_0x3dc3('0x19')]);});});}function emit(_0x511bde,_0x26ca23,_0x127371,_0x16e614){var _0x3879a9={'uri':util[_0x3dc3('0x4f')](_0x3dc3('0x50'),_0x511bde,_0x127371,_0x16e614)};io['to'](util['format'](_0x3dc3('0x51'),_0x26ca23))[_0x3dc3('0x52')](_0x3dc3('0x53'),_0x3879a9);}exports['cs']=function(_0x51f950,_0x50d494,_0x1691c5,_0x4c53d9,_0x2752ff,_0x582b94,_0x21b1d9,_0x9f212a){var _0x2eb92a={};_0x582b94['remoteUri']=_0x582b94[_0x3dc3('0xa')]?intUtil[_0x3dc3('0x54')](_0x582b94[_0x3dc3('0xc')][_0x3dc3('0xd')]):intUtil[_0x3dc3('0x54')](_0x582b94['remoteUri']);_0x582b94['serverUrl']=intUtil[_0x3dc3('0x54')](_0x582b94[_0x3dc3('0x55')]);_0x2eb92a['callDirection']=_0x9f212a===_0x3dc3('0x4d')||_0x9f212a===_0x3dc3('0x56')?'queue':_0x3dc3('0x29');var _0x350e12=_0x582b94[_0x3dc3('0xa')]?util['format'](_0x3dc3('0x57'),_0x582b94['CloudProvider']['data7']):util['format']('%s/api/data/v9.0/',_0x582b94[_0x3dc3('0xb')]);var _0x4b4a5f=util[_0x3dc3('0x4f')](_0x3dc3('0x58'),_0x582b94['tenantId']);var _0x42e0b7=util[_0x3dc3('0x4f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x582b94[_0x3dc3('0x55')],_0x50d494[_0x3dc3('0x59')],md5(_0x50d494[_0x3dc3('0x59')]));if(_0x2752ff&&_0x2752ff[_0x3dc3('0x5a')]){logger[_0x3dc3('0x21')]('[QUEUE]',_0x3dc3('0x5b'));_0x50d494[_0x3dc3('0x5c')]=_0x42e0b7;}else if(_0x21b1d9&&_0x21b1d9['recordingFormat']&&_0x21b1d9[_0x3dc3('0x5d')]!==_0x3dc3('0x5e')){logger[_0x3dc3('0x21')](_0x3dc3('0x5f'),_0x3dc3('0x5b'));_0x50d494[_0x3dc3('0x5c')]=_0x42e0b7;}else{_0x50d494[_0x3dc3('0x5c')]='';}return getUser(_0x2eb92a,_0x582b94,_0x4c53d9,_0x4b4a5f,_0x350e12,_0x9f212a)['then'](function(_0x4afae9){logger[_0x3dc3('0x21')]('['+_0x9f212a[_0x3dc3('0x17')]()+_0x3dc3('0x60'),_0x4afae9[_0x3dc3('0x23')]);logger[_0x3dc3('0x21')]('['+_0x9f212a[_0x3dc3('0x17')]()+_0x3dc3('0x61'),_0x4afae9[_0x3dc3('0x25')]);return getEndUser(_0x4afae9,_0x582b94,_0x4b4a5f,_0x350e12,_0x50d494,_0x9f212a,_0x1691c5[_0x3dc3('0x62')],_0x1691c5[_0x3dc3('0x63')]);})[_0x3dc3('0x14')](function(_0x5a64d8){logger[_0x3dc3('0x21')]('['+_0x9f212a[_0x3dc3('0x17')]()+_0x3dc3('0x64'),_0x5a64d8[_0x3dc3('0x37')]);logger[_0x3dc3('0x21')]('['+_0x9f212a['toUpperCase']()+_0x3dc3('0x65'),_0x50d494['calleridnum']);return getTicket(_0x5a64d8,_0x582b94,_0x4b4a5f,_0x350e12,_0x50d494,_0x1691c5,_0x9f212a);})[_0x3dc3('0x14')](function(_0x522a39){logger['info'](util['format']('['+_0x9f212a[_0x3dc3('0x17')]()+_0x3dc3('0x66'),_0x1691c5[_0x3dc3('0x43')],_0x522a39[_0x3dc3('0x67')]));logger[_0x3dc3('0x21')](util[_0x3dc3('0x4f')]('['+_0x9f212a[_0x3dc3('0x17')]()+_0x3dc3('0x68'),_0x9f212a));if(_0x9f212a!==_0x3dc3('0x56')&&_0x1691c5['openNewTab']){logger['info']('['+_0x9f212a[_0x3dc3('0x17')]()+']',_0x3dc3('0x69'));emit(_0x582b94[_0x3dc3('0xb')],_0x4c53d9[_0x3dc3('0x6a')],_0x1691c5['ticketType'],_0x522a39[_0x3dc3('0x67')]);}})[_0x3dc3('0x28')](function(_0x32113f){logger['error']('['+_0x9f212a[_0x3dc3('0x17')]()+_0x3dc3('0x6b'),_0x32113f[_0x3dc3('0x19')]);console[_0x3dc3('0x16')](_0x3dc3('0x6c'),_0x32113f);});}; \ No newline at end of file +var _0x2e4f=['replace','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','Descriptions','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','username','password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','message','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','Bearer\x20','headers','substring','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','&$filter='];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x2e4f,0x9e));var _0xf2e4=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x2e4f[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xf2e4('0x0'));var rp=require(_0xf2e4('0x1'));var util=require(_0xf2e4('0x2'));var intUtil=require('./util');var md5=require(_0xf2e4('0x3'));var Redis=require(_0xf2e4('0x4'));var logger=require('../../../../config/logger')(_0xf2e4('0x5'));var config=require(_0xf2e4('0x6'));config[_0xf2e4('0x7')]=_['defaults'](config['redis'],{'host':_0xf2e4('0x8'),'port':0x18eb});var io=require(_0xf2e4('0x9'))(new Redis(config[_0xf2e4('0x7')]));function getAuthToken(_0x2a1220,_0x5b6f37,_0x52326a){if(_0x2a1220[_0xf2e4('0xa')]){_0x2a1220[_0xf2e4('0xb')]=_0x2a1220[_0xf2e4('0xc')][_0xf2e4('0xd')];_0x2a1220[_0xf2e4('0xe')]=_0x2a1220['CloudProvider'][_0xf2e4('0xf')];return Promise[_0xf2e4('0x10')](_0x2a1220['CloudProvider'][_0xf2e4('0x11')]);}var _0x3b1c69={'method':'POST','uri':_0x5b6f37,'form':{'client_id':_0x2a1220['clientId'],'resource':_0x2a1220['remoteUri'],'username':_0x2a1220[_0xf2e4('0x12')],'password':_0x2a1220[_0xf2e4('0x13')],'grant_type':_0xf2e4('0x13'),'client_secret':_0x2a1220[_0xf2e4('0x14')]},'json':!![]};return rp(_0x3b1c69)[_0xf2e4('0x15')](function(_0x4e1cee){return _0x4e1cee['access_token'];})[_0xf2e4('0x16')](function(_0x2e5ab3){logger[_0xf2e4('0x17')]('['+[_0x52326a[_0xf2e4('0x18')]()]+_0xf2e4('0x19'));return _0x2e5ab3['message'];});}function getUser(_0x4a1b25,_0x2af554,_0x13692e,_0x553ec0,_0x53a50f,_0x538c5e){return new Promise(function(_0x494aa2,_0x438aca){return getAuthToken(_0x2af554,_0x553ec0,_0x538c5e)[_0xf2e4('0x15')](function(_0x557e9b){var _0x4d184c={'method':'GET','uri':_0x53a50f+_0xf2e4('0x1a'),'headers':{'Authorization':'Bearer\x20'+_0x557e9b,'OData-Version':_0xf2e4('0x1b')},'json':!![]};return rp(_0x4d184c);})[_0xf2e4('0x15')](function(_0x364688){var _0x270c48=_0x364688[_0xf2e4('0x1c')];var _0x13679d=![];var _0x2af6f3=null;if(!_[_0xf2e4('0x1d')](_0x13692e)){if(intUtil['validateEmail'](_0x13692e[_0xf2e4('0x1e')])){_0x4a1b25[_0xf2e4('0x1f')]=_0x13692e['email'];for(_0x2af6f3=0x0;_0x2af6f3<_0x270c48[_0xf2e4('0x20')];_0x2af6f3++){if(_0x270c48[_0x2af6f3][_0xf2e4('0x21')]===_0x13692e['email']&&!_0x270c48[_0x2af6f3][_0xf2e4('0x22')]){_0x13679d=!![];logger[_0xf2e4('0x23')]('['+[_0x538c5e[_0xf2e4('0x18')]()]+_0xf2e4('0x24')+_0x270c48[_0x2af6f3][_0xf2e4('0x25')]+'!');_0x4a1b25['userId']=_0x270c48[_0x2af6f3]['systemuserid'];}}}}if(!_0x13679d){logger[_0xf2e4('0x23')]('['+[_0x538c5e[_0xf2e4('0x18')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4a1b25['userEmail']=_0x2af554[_0xf2e4('0x12')];for(_0x2af6f3=0x0;_0x2af6f3<_0x270c48[_0xf2e4('0x20')];_0x2af6f3++){if(_0x270c48[_0x2af6f3]['internalemailaddress']===_0x2af554[_0xf2e4('0x12')]){_0x4a1b25[_0xf2e4('0x26')]=_0x270c48[_0x2af6f3]['systemuserid'];}}}_0x494aa2(_0x4a1b25);})[_0xf2e4('0x16')](function(_0xb9d95b){_0x438aca(_0xb9d95b[_0xf2e4('0x27')]);});});}function createEndUser(_0x3e33b0,_0x454876,_0x57a0ad,_0xccbbcc,_0x58da54,_0x31a46d,_0x340e32){return new Promise(function(_0x4da565,_0x368370){return getAuthToken(_0x454876,_0x57a0ad,_0x31a46d)[_0xf2e4('0x15')](function(_0x5cdfb1){var _0x1093db=_0x31a46d[_0xf2e4('0x28')]()===_0xf2e4('0x29')?_0x58da54[_0xf2e4('0x2a')]:_0x58da54[_0xf2e4('0x2b')];var _0x40816b={'method':_0xf2e4('0x2c'),'uri':_0xccbbcc+_0xf2e4('0x2d'),'body':{'fullname':_0x1093db,'firstname':_0x1093db,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf2e4('0x2e')+_0x3e33b0[_0xf2e4('0x26')]+')'},'headers':{'Authorization':_0xf2e4('0x2f')+_0x5cdfb1,'OData-Version':_0xf2e4('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x40816b['body'][_0x340e32]=_0x1093db;return rp(_0x40816b);})['then'](function(_0x5352f1){var _0x17241=_0x5352f1[_0xf2e4('0x30')]['odata-entityid'];var _0x2934d3=_0x17241[_0xf2e4('0x31')](_0x17241['lastIndexOf']('(')+0x1,_0x17241[_0xf2e4('0x32')](')'));_0x3e33b0[_0xf2e4('0x33')]=_0x2934d3;_0x4da565(_0x3e33b0);})[_0xf2e4('0x16')](function(_0x1e108f){_0x368370(_0x1e108f['message']);});});}function getEndUser(_0x1d88ce,_0x5b42b2,_0x2826ee,_0x1ac288,_0x44a19b,_0x624a0d,_0x5a3ad6,_0x19c2ec){var _0x18327c=_0x624a0d[_0xf2e4('0x28')]()==='outbound'?_0x44a19b['destcalleridnum']:_0x44a19b[_0xf2e4('0x2b')];return getAuthToken(_0x5b42b2,_0x2826ee,_0x624a0d)[_0xf2e4('0x15')](function(_0x93798f){_0x19c2ec=_0x19c2ec?_0x19c2ec:_0xf2e4('0x34');var _0x4d8c83={'method':_0xf2e4('0x35'),'uri':_0x1ac288+_0xf2e4('0x36')+_0x19c2ec+_0xf2e4('0x37')+_0x19c2ec+'\x20eq\x20\x27'+_0x18327c[_0xf2e4('0x38')]('+',_0xf2e4('0x39'))+'\x27','headers':{'Authorization':_0xf2e4('0x2f')+_0x93798f,'If-None-Match':null,'OData-Version':_0xf2e4('0x1b')},'json':!![]};return rp(_0x4d8c83);})['then'](function(_0x45d73c){var _0x5799ed=![];if(!_0x45d73c)return _0x5799ed;var _0x244360=_0x45d73c[_0xf2e4('0x1c')];for(var _0x5b5ccc=0x0;_0x5b5ccc<_0x244360['length'];_0x5b5ccc++){if(_0x244360[_0x5b5ccc][_0x19c2ec]===_0x18327c){_0x5799ed=!![];_0x1d88ce['enduserId']=_0x244360[_0x5b5ccc][_0xf2e4('0x3a')];}}return _0x5799ed;})[_0xf2e4('0x15')](function(_0x3065d7){if(_0x3065d7)return _0x1d88ce;if(_0x5a3ad6===_0xf2e4('0x3b')){logger[_0xf2e4('0x23')]('['+[_0x624a0d[_0xf2e4('0x18')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x1d88ce;}return createEndUser(_0x1d88ce,_0x5b42b2,_0x2826ee,_0x1ac288,_0x44a19b,_0x624a0d,_0x19c2ec)[_0xf2e4('0x15')](function(_0x2c432d){logger['info']('['+[_0x624a0d[_0xf2e4('0x18')]()]+_0xf2e4('0x3c'),_0x2c432d[_0xf2e4('0x33')]);return _0x2c432d;});});}function getCustomFields(_0x498834,_0x371ff6,_0x2ba535){var _0x36d956={};if(_0x498834[_0xf2e4('0x20')]>0x0){_[_0xf2e4('0x3d')](_0x498834,function(_0x4fb5f0){if(_[_0xf2e4('0x3e')]([_0xf2e4('0x3f'),'picklist'],_0x4fb5f0[_0xf2e4('0x40')])&&_0x4fb5f0[_0xf2e4('0x41')]&&!_0x4fb5f0[_0xf2e4('0x42')]){var _0x2b3417=_0x4fb5f0['idField'][_0xf2e4('0x28')]();var _0x42b075=_0x2b3417['substring'](0x0,_0x2b3417[_0xf2e4('0x43')]('_'));var _0x3886fa=_0x2b3417['substring'](_0x2b3417[_0xf2e4('0x43')]('_')+0x1);if(_0x42b075===_0x2ba535){_0x36d956[_0x3886fa]=_0x4fb5f0[_0xf2e4('0x44')];}}});}return _0x36d956;}function getTicket(_0x82ed92,_0x2add58,_0x265d80,_0x43623d,_0x1aea86,_0x554ce2,_0xd2ad6c){return new Promise(function(_0x3edc8e,_0x5e6517){var _0x3a3761;return getAuthToken(_0x2add58,_0x265d80,_0xd2ad6c)[_0xf2e4('0x15')](function(_0xa82682){if(_0x554ce2[_0xf2e4('0x45')]===_0xf2e4('0x46')){_0x3a3761={'method':_0xf2e4('0x2c'),'uri':_0x43623d+_0xf2e4('0x47'),'body':Object[_0xf2e4('0x48')]({},{'title':intUtil[_0xf2e4('0x49')](_0x554ce2[_0xf2e4('0x4a')],_0x1aea86,'\x20'),'description':intUtil[_0xf2e4('0x49')](_0x554ce2['Descriptions'],_0x1aea86,'\x0a'),'customerid_contact@odata.bind':_0x82ed92[_0xf2e4('0x33')]?_0xf2e4('0x4b')+_0x82ed92[_0xf2e4('0x33')]+')':undefined,'ownerid@odata.bind':_0xf2e4('0x2e')+_0x82ed92['userId']+')','caseorigincode':'1'},getCustomFields(_0x554ce2[_0xf2e4('0x4c')],_0x1aea86,_0x554ce2['ticketType'])),'headers':{'Authorization':_0xf2e4('0x2f')+_0xa82682,'OData-Version':_0xf2e4('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x554ce2[_0xf2e4('0x45')]===_0xf2e4('0x4d')){var _0x1c894f=_0x82ed92[_0xf2e4('0x33')]?[{'partyid_systemuser@odata.bind':_0xf2e4('0x2e')+_0x82ed92['userId']+')','participationtypemask':_0x82ed92[_0xf2e4('0x4e')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xf2e4('0x4b')+_0x82ed92[_0xf2e4('0x33')]+')','participationtypemask':_0x82ed92[_0xf2e4('0x4e')]===_0xf2e4('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf2e4('0x2e')+_0x82ed92[_0xf2e4('0x26')]+')','participationtypemask':_0x82ed92['callDirection']===_0xf2e4('0x4f')?0x2:0x1}];_0x3a3761={'method':'POST','uri':_0x43623d+_0xf2e4('0x50'),'body':Object[_0xf2e4('0x48')]({},{'subject':intUtil['getString'](_0x554ce2[_0xf2e4('0x4a')],_0x1aea86,'\x20'),'phonenumber':String(_0x1aea86[_0xf2e4('0x2b')]),'description':intUtil['getString'](_0x554ce2[_0xf2e4('0x51')],_0x1aea86,'\x0a'),'regardingobjectid_contact@odata.bind':_0x82ed92[_0xf2e4('0x33')]?_0xf2e4('0x4b')+_0x82ed92[_0xf2e4('0x33')]+')':undefined,'ownerid@odata.bind':_0xf2e4('0x2e')+_0x82ed92[_0xf2e4('0x26')]+')','directioncode':_0x82ed92[_0xf2e4('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x1c894f},getCustomFields(_0x554ce2[_0xf2e4('0x4c')],_0x1aea86,_0x554ce2[_0xf2e4('0x45')])),'headers':{'Authorization':_0xf2e4('0x2f')+_0xa82682,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3a3761);})[_0xf2e4('0x15')](function(_0x7cc873){var _0x44cc19=_0x7cc873['headers'][_0xf2e4('0x52')];var _0x26999a=_0x44cc19[_0xf2e4('0x31')](_0x44cc19[_0xf2e4('0x32')]('(')+0x1,_0x44cc19['lastIndexOf'](')'));_0x82ed92[_0xf2e4('0x53')]=_0x26999a;_0x3edc8e(_0x82ed92);})[_0xf2e4('0x16')](function(_0x3ef2f9){_0x5e6517(_0x3ef2f9[_0xf2e4('0x27')]);});});}function emit(_0x104774,_0x2f3ea2,_0x170d4d,_0x8c79ce){var _0x3a30c7={'uri':util[_0xf2e4('0x54')](_0xf2e4('0x55'),_0x104774,_0x170d4d,_0x8c79ce)};io['to'](util['format'](_0xf2e4('0x56'),_0x2f3ea2))['emit'](_0xf2e4('0x57'),_0x3a30c7);}exports['cs']=function(_0x2d9b1d,_0x4d844d,_0x51abd2,_0xaf5506,_0x11bce5,_0x202450,_0x17c414,_0x13909a){var _0x39b28d={};_0x202450['remoteUri']=_0x202450[_0xf2e4('0xa')]?intUtil[_0xf2e4('0x58')](_0x202450[_0xf2e4('0xc')][_0xf2e4('0xd')]):intUtil[_0xf2e4('0x58')](_0x202450['remoteUri']);_0x202450['serverUrl']=intUtil[_0xf2e4('0x58')](_0x202450['serverUrl']);_0x39b28d[_0xf2e4('0x4e')]=_0x13909a===_0xf2e4('0x4f')||_0x13909a===_0xf2e4('0x59')?_0xf2e4('0x4f'):_0xf2e4('0x29');var _0x3731d4=_0x202450[_0xf2e4('0xa')]?util[_0xf2e4('0x54')](_0xf2e4('0x5a'),_0x202450[_0xf2e4('0xc')][_0xf2e4('0xd')]):util['format'](_0xf2e4('0x5a'),_0x202450[_0xf2e4('0xb')]);var _0x593817=util[_0xf2e4('0x54')](_0xf2e4('0x5b'),_0x202450[_0xf2e4('0xe')]);var _0x3e1a14=util['format'](_0xf2e4('0x5c'),_0x202450[_0xf2e4('0x5d')],_0x4d844d['uniqueid'],md5(_0x4d844d['uniqueid']));if(_0x11bce5&&_0x11bce5[_0xf2e4('0x5e')]){logger[_0xf2e4('0x23')](_0xf2e4('0x5f'),_0xf2e4('0x60'));_0x4d844d[_0xf2e4('0x61')]=_0x3e1a14;}else if(_0x17c414&&_0x17c414[_0xf2e4('0x62')]&&_0x17c414['recordingFormat']!==_0xf2e4('0x63')){logger[_0xf2e4('0x23')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4d844d[_0xf2e4('0x61')]=_0x3e1a14;}else{_0x4d844d[_0xf2e4('0x61')]='';}return getUser(_0x39b28d,_0x202450,_0xaf5506,_0x593817,_0x3731d4,_0x13909a)[_0xf2e4('0x15')](function(_0x3b68fc){logger[_0xf2e4('0x23')]('['+_0x13909a[_0xf2e4('0x18')]()+']\x20The\x20User\x20ID\x20is:',_0x3b68fc['userId']);logger[_0xf2e4('0x23')]('['+_0x13909a[_0xf2e4('0x18')]()+_0xf2e4('0x64'),_0x3b68fc[_0xf2e4('0x1f')]);return getEndUser(_0x3b68fc,_0x202450,_0x593817,_0x3731d4,_0x4d844d,_0x13909a,_0x51abd2['moduleCreate'],_0x51abd2['additionalSearchContact']);})['then'](function(_0x2ee6b6){logger['info']('['+_0x13909a[_0xf2e4('0x18')]()+_0xf2e4('0x65'),_0x2ee6b6[_0xf2e4('0x33')]);logger[_0xf2e4('0x23')]('['+_0x13909a['toUpperCase']()+_0xf2e4('0x66'),_0x4d844d[_0xf2e4('0x2b')]);return getTicket(_0x2ee6b6,_0x202450,_0x593817,_0x3731d4,_0x4d844d,_0x51abd2,_0x13909a);})[_0xf2e4('0x15')](function(_0x3034e3){logger[_0xf2e4('0x23')](util['format']('['+_0x13909a[_0xf2e4('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x51abd2[_0xf2e4('0x45')],_0x3034e3[_0xf2e4('0x53')]));logger[_0xf2e4('0x23')](util['format']('['+_0x13909a['toUpperCase']()+_0xf2e4('0x67'),_0x13909a));if(_0x13909a!==_0xf2e4('0x59')&&_0x51abd2['openNewTab']){logger[_0xf2e4('0x23')]('['+_0x13909a[_0xf2e4('0x18')]()+']',_0xf2e4('0x68'));emit(_0x202450['remoteUri'],_0xaf5506['name'],_0x51abd2['ticketType'],_0x3034e3[_0xf2e4('0x53')]);}})[_0xf2e4('0x16')](function(_0x24359e){logger[_0xf2e4('0x17')]('['+_0x13909a[_0xf2e4('0x18')]()+_0xf2e4('0x69'),_0x24359e[_0xf2e4('0x27')]);console[_0xf2e4('0x17')](_0xf2e4('0x6a'),_0x24359e);});}; \ 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 9986970..985b4d9 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 _0x48eb=['variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','monitor_format','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','base64','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','push'];(function(_0x32715c,_0x317ddb){var _0x101baf=function(_0x20db55){while(--_0x20db55){_0x32715c['push'](_0x32715c['shift']());}};_0x101baf(++_0x317ddb);}(_0x48eb,0x1df));var _0xb48e=function(_0x349a2c,_0x4655dc){_0x349a2c=_0x349a2c-0x0;var _0x93d984=_0x48eb[_0x349a2c];return _0x93d984;};'use strict';var _=require('lodash');var rp=require(_0xb48e('0x0'));var md5=require(_0xb48e('0x1'));var util=require('util');var Redis=require(_0xb48e('0x2'));var intUtil=require(_0xb48e('0x3'));var config=require(_0xb48e('0x4'));var logger=require(_0xb48e('0x5'))(_0xb48e('0x6'));config['redis']=_['defaults'](config[_0xb48e('0x7')],{'host':_0xb48e('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0xb48e('0x9'),'Accept':'application/json'};function emit(_0x35c6ec,_0x1e569b,_0x53b6ba){io['to'](_0x35c6ec)[_0xb48e('0xa')](_0x1e569b,_0x53b6ba);}function getTicket(_0x42e414,_0x3ab270,_0x35a4bd,_0x4d109b,_0x1e2d4b){logger[_0xb48e('0xb')]('Creating\x20new\x20ticket...');var _0x4e9105=_[_0xb48e('0xc')]({'responder_id':_0x3ab270['id'],'requester_id':_0x35a4bd['id'],'name':util[_0xb48e('0xd')](_0xb48e('0xe'),_0x1e2d4b['calleridname']),'phone':_0x1e2d4b[_0xb48e('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb48e('0x10')](_0x4d109b[_0xb48e('0x11')],_0x1e2d4b,'\x20'),'description':intUtil['getString'](_0x4d109b['Descriptions'],_0x1e2d4b,_0xb48e('0x12')),'tags':getTags(_0x4d109b[_0xb48e('0x13')],_0xb48e('0x14'))},getCustomFields(_0x4d109b[_0xb48e('0x15')],_0x1e2d4b));_0x4e9105[_0xb48e('0x16')]=_[_0xb48e('0x17')](_[_0xb48e('0x18')](_0x4e9105['custom_fields'],'id'),'value');return request({'uri':util[_0xb48e('0xd')](_0xb48e('0x19'),_0x42e414[_0xb48e('0x1a')]),'method':_0xb48e('0x1b'),'body':_0x4e9105})[_0xb48e('0x1c')](function(_0x406554){logger[_0xb48e('0xb')](_0xb48e('0x1d'));return _0x406554;});}function getUser(_0x14e6cd,_0x49f620){if(intUtil[_0xb48e('0x1e')](_0x49f620)){return request({'uri':util[_0xb48e('0xd')]('%s/api/v2/agents',_0x14e6cd['remoteUri']),'qs':{'email':_0x49f620}})[_0xb48e('0x1c')](function(_0x317291){if(_0x317291[_0xb48e('0x1f')]){logger[_0xb48e('0xb')](_0xb48e('0x20'));return _[_0xb48e('0x21')](_0x317291,function(_0x9b946b){return _0x9b946b[_0xb48e('0x22')][_0xb48e('0x23')]===_0x49f620;});}else{logger[_0xb48e('0xb')](_0xb48e('0x24'));return request({'uri':util[_0xb48e('0xd')](_0xb48e('0x25'),_0x14e6cd[_0xb48e('0x1a')])})[_0xb48e('0x1c')](function(_0x333f01){logger['info'](_0xb48e('0x26'));return _0x333f01;});}});}else{logger[_0xb48e('0xb')](_0xb48e('0x27'));return request({'uri':util['format'](_0xb48e('0x25'),_0x14e6cd[_0xb48e('0x1a')])})['then'](function(_0xeb73f){logger[_0xb48e('0xb')](_0xb48e('0x26'));return _0xeb73f;});}}function getEndUser(_0x22783a,_0x2be19b,_0x433e97){logger[_0xb48e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x433e97);return request({'uri':util[_0xb48e('0xd')]('%s/api/v2/contacts',_0x22783a['remoteUri']),'qs':{'phone':_0x433e97}})[_0xb48e('0x1c')](function(_0x496de3){if(_0x496de3[_0xb48e('0x1f')]){logger[_0xb48e('0xb')](_0xb48e('0x28'));return _[_0xb48e('0x21')](_0x496de3,{'phone':_0x433e97});}else{logger[_0xb48e('0xb')](_0xb48e('0x29'));return request({'uri':util[_0xb48e('0xd')](_0xb48e('0x2a'),_0x22783a[_0xb48e('0x1a')]),'method':_0xb48e('0x1b'),'body':{'name':_0x2be19b,'phone':_0x433e97}})[_0xb48e('0x1c')](function(_0x361d12){logger[_0xb48e('0xb')]('Enduser\x20created.');return _0x361d12;});}});}function getAuth(_0x135f03){return util[_0xb48e('0xd')](_0xb48e('0x2b'),new Buffer(_0x135f03[_0xb48e('0x2c')]+':X')[_0xb48e('0x2d')](_0xb48e('0x2e')));}function request(_0x4287cb){logger['debug']('[HTTP]',JSON[_0xb48e('0x2f')](_0x4287cb));return rp(_['defaults'](_0x4287cb,{'method':_0xb48e('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x22a94a,_0x54a77b){var _0x5087e0=[];if(_0x22a94a&&_0x22a94a[_0xb48e('0x1f')]>0x0){_0x5087e0=_[_0xb48e('0x31')](_0x22a94a,_0x54a77b);}return _0x5087e0;}function getCustomFields(_0x1fa375,_0x1dbf44){var _0x54236d=[];var _0xaeb732={'custom_fields':[]};if(_0x1fa375[_0xb48e('0x1f')]>0x0){_[_0xb48e('0x32')](_0x1fa375,function(_0x3df4c1){if(_[_0xb48e('0x33')]([_0xb48e('0x34'),_0xb48e('0x35')],_0x3df4c1[_0xb48e('0x36')])&&_0x3df4c1[_0xb48e('0x37')]&&!_0x3df4c1['customField']){_0xaeb732[_0x3df4c1[_0xb48e('0x37')][_0xb48e('0x38')]()]=_0x3df4c1[_0xb48e('0x39')][_0xb48e('0x2d')]();}else if(_[_0xb48e('0x33')](['string',_0xb48e('0x35')],_0x3df4c1[_0xb48e('0x36')])&&_0x3df4c1[_0xb48e('0x3a')]&&_0x3df4c1[_0xb48e('0x3b')]){_0xaeb732[_0xb48e('0x16')][_0xb48e('0x3c')]({'id':_0x3df4c1[_0xb48e('0x3a')],'value':_0x3df4c1[_0xb48e('0x39')][_0xb48e('0x2d')]()});}else if(_0x3df4c1[_0xb48e('0x36')]===_0xb48e('0x3d')&&_0x3df4c1[_0xb48e('0x3e')]&&_0x3df4c1[_0xb48e('0x3a')]&&_0x3df4c1['customField']){_0x1dbf44[_0x3df4c1[_0xb48e('0x3e')]]&&_0xaeb732['custom_fields']['push']({'id':_0x3df4c1[_0xb48e('0x3a')],'value':_0x1dbf44[_0x3df4c1[_0xb48e('0x3e')]]['toString']()});}else if(_0x3df4c1[_0xb48e('0x36')]===_0xb48e('0x3f')&&_0x3df4c1['Variable']&&_0x3df4c1[_0xb48e('0x40')]['name']&&_0x3df4c1[_0xb48e('0x3a')]&&_0x3df4c1[_0xb48e('0x3b')]){_0x1dbf44[_0x3df4c1[_0xb48e('0x40')]['name'][_0xb48e('0x38')]()]&&_0xaeb732[_0xb48e('0x16')][_0xb48e('0x3c')]({'id':_0x3df4c1['idField'],'value':_0x1dbf44[_0x3df4c1[_0xb48e('0x40')][_0xb48e('0x14')][_0xb48e('0x38')]()][_0xb48e('0x2d')]()});}});}return _0xaeb732;}exports['queue']=function(_0x3b0fd9,_0x5a08d3,_0x164796,_0x54dfcd,_0x533d21,_0x12984c){var _0x15642d,_0x1eb406;_0x12984c[_0xb48e('0x1a')]=intUtil[_0xb48e('0x41')](_0x12984c[_0xb48e('0x1a')]);_0x12984c[_0xb48e('0x42')]=intUtil[_0xb48e('0x41')](_0x12984c[_0xb48e('0x42')]);if(_0x533d21&&_0x533d21['monitor_format']){logger[_0xb48e('0xb')](_0xb48e('0x43'),_0xb48e('0x44'));_0x5a08d3[_0xb48e('0x45')]=util[_0xb48e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12984c[_0xb48e('0x42')],_0x5a08d3['uniqueid'],md5(_0x5a08d3[_0xb48e('0x46')]));}else{_0x5a08d3[_0xb48e('0x45')]='';}headers['Authorization']=getAuth(_0x12984c);return getUser(_0x12984c,_0x54dfcd[_0xb48e('0x23')])[_0xb48e('0x1c')](function(_0x53d874){_0x15642d=_0x53d874;logger[_0xb48e('0xb')](_0xb48e('0x47'),_0x15642d['id']);return getEndUser(_0x12984c,_0x5a08d3[_0xb48e('0x48')],_0x5a08d3[_0xb48e('0xf')]);})[_0xb48e('0x1c')](function(_0xfe8263){_0x1eb406=_0xfe8263;logger['info'](_0xb48e('0x49'),_0x1eb406['id']);return getTicket(_0x12984c,_0x15642d,_0x1eb406,_0x164796,_0x5a08d3);})['then'](function(_0x196d9b){if(_0x196d9b&&_0x196d9b['id']){logger[_0xb48e('0xb')](_0xb48e('0x1d'));logger[_0xb48e('0xb')](_0xb48e('0x4a'),_0x196d9b['id']);logger['info'](_0xb48e('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb48e('0xd')](_0xb48e('0x4b'),_0x54dfcd[_0xb48e('0x14')]),_0xb48e('0x4c'),{'uri':util[_0xb48e('0xd')](_0xb48e('0x4d'),_0x12984c['remoteUri'],_0x196d9b['id'])});}})[_0xb48e('0x4e')](function(_0x40cab0){logger[_0xb48e('0x4f')](_0xb48e('0x43'),JSON['stringify'](_0x40cab0));});};exports[_0xb48e('0x50')]=function(_0xc46e38,_0x42559b,_0x5ad769,_0x387a30,_0x2542e7,_0x364dec,_0x2b92d5){var _0x2eaf87,_0x4856c1;_0x364dec[_0xb48e('0x1a')]=intUtil['stripTrailingSlash'](_0x364dec[_0xb48e('0x1a')]);_0x364dec[_0xb48e('0x42')]=intUtil[_0xb48e('0x41')](_0x364dec['serverUrl']);if(_0x2b92d5&&_0x2b92d5[_0xb48e('0x51')]&&_0x2b92d5[_0xb48e('0x51')]!==_0xb48e('0x52')){logger[_0xb48e('0xb')](_0xb48e('0x53'),_0xb48e('0x44'));_0x42559b[_0xb48e('0x45')]=util['format'](_0xb48e('0x54'),_0x364dec['serverUrl'],_0x42559b[_0xb48e('0x46')],md5(_0x42559b[_0xb48e('0x46')]));}headers[_0xb48e('0x55')]=getAuth(_0x364dec);return getUser(_0x364dec,_0x387a30[_0xb48e('0x23')])[_0xb48e('0x1c')](function(_0x357828){_0x2eaf87=_0x357828;logger[_0xb48e('0xb')](_0xb48e('0x47'),_0x2eaf87['id']);return getEndUser(_0x364dec,_0x42559b[_0xb48e('0x56')],_0x42559b['destcalleridnum']);})['then'](function(_0x59a857){_0x4856c1=_0x59a857;logger[_0xb48e('0xb')](_0xb48e('0x49'),_0x4856c1['id']);return getTicket(_0x364dec,_0x2eaf87,_0x4856c1,_0x5ad769,_0x42559b);})[_0xb48e('0x1c')](function(_0x4621e8){if(_0x4621e8&&_0x4621e8['id']){logger[_0xb48e('0xb')]('Ticket\x20created!');logger['info'](_0xb48e('0x4a'),_0x4621e8['id']);logger[_0xb48e('0xb')](_0xb48e('0x53'),_0xb48e('0x57'));emit(util[_0xb48e('0xd')](_0xb48e('0x4b'),_0x387a30[_0xb48e('0x14')]),'trigger:browser:url',{'uri':util[_0xb48e('0xd')](_0xb48e('0x4d'),_0x364dec['remoteUri'],_0x4621e8['id'])});}})[_0xb48e('0x4e')](function(_0x4ef6a5){logger[_0xb48e('0x4f')]('[OUTBOUND]',JSON[_0xb48e('0x2f')](_0x4ef6a5));});};exports['unmanaged']=function(_0xd439e5,_0x1658dd,_0x32dee3,_0x2d9a57,_0x2bc780,_0x39c476){var _0x5970d9,_0x3c42ff;_0x39c476[_0xb48e('0x1a')]=intUtil[_0xb48e('0x41')](_0x39c476[_0xb48e('0x1a')]);_0x39c476[_0xb48e('0x42')]=intUtil['stripTrailingSlash'](_0x39c476[_0xb48e('0x42')]);if(_0x2bc780&&_0x2bc780[_0xb48e('0x58')]){logger[_0xb48e('0xb')]('['+_0x1658dd['lastevent'][_0xb48e('0x59')]()+']',_0xb48e('0x44'));_0x1658dd[_0xb48e('0x45')]=util[_0xb48e('0xd')](_0xb48e('0x54'),_0x39c476[_0xb48e('0x42')],_0x1658dd[_0xb48e('0x46')],md5(_0x1658dd[_0xb48e('0x46')]));}else{_0x1658dd[_0xb48e('0x45')]='';}headers['Authorization']=getAuth(_0x39c476);return getUser(_0x39c476,'')[_0xb48e('0x1c')](function(_0x32f050){_0x5970d9=_0x32f050;logger[_0xb48e('0xb')]('The\x20User\x20ID\x20is:',_0x5970d9['id']);return getEndUser(_0x39c476,_0x1658dd[_0xb48e('0x48')],_0x1658dd[_0xb48e('0xf')]);})[_0xb48e('0x1c')](function(_0x25165b){_0x3c42ff=_0x25165b;logger[_0xb48e('0xb')](_0xb48e('0x49'),_0x3c42ff['id']);return getTicket(_0x39c476,_0x5970d9,_0x3c42ff,_0x32dee3,_0x1658dd);})[_0xb48e('0x1c')](function(_0x4974e1){if(_0x4974e1){logger[_0xb48e('0xb')](_0xb48e('0x1d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4974e1['id']);}})[_0xb48e('0x4e')](function(_0xda7efe){logger[_0xb48e('0x4f')]('['+_0x1658dd['lastevent'][_0xb48e('0x59')]()+']',JSON[_0xb48e('0x2f')](_0xda7efe));});}; \ No newline at end of file +var _0x6864=['catch','toUpperCase','lodash','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','string','picklist','toLowerCase','content','includes','customField','idField','type','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','lastevent'];(function(_0x439ae3,_0x3dd0c9){var _0x5f2c7f=function(_0x11252b){while(--_0x11252b){_0x439ae3['push'](_0x439ae3['shift']());}};_0x5f2c7f(++_0x3dd0c9);}(_0x6864,0x1c4));var _0x4686=function(_0x2eaa0a,_0xea4422){_0x2eaa0a=_0x2eaa0a-0x0;var _0x20e928=_0x6864[_0x2eaa0a];return _0x20e928;};'use strict';var _=require(_0x4686('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0x4686('0x1'));var intUtil=require(_0x4686('0x2'));var config=require(_0x4686('0x3'));var logger=require(_0x4686('0x4'))(_0x4686('0x5'));config[_0x4686('0x6')]=_[_0x4686('0x7')](config[_0x4686('0x6')],{'host':_0x4686('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x4686('0x9'),'Accept':_0x4686('0x9')};function emit(_0x175600,_0xca684b,_0x239f88){io['to'](_0x175600)[_0x4686('0xa')](_0xca684b,_0x239f88);}function getTicket(_0x1e8da4,_0x5d3a70,_0x4a3a67,_0x99fc77,_0x4ac746){logger[_0x4686('0xb')](_0x4686('0xc'));var _0x2e5e2a=_[_0x4686('0xd')]({'responder_id':_0x5d3a70['id'],'requester_id':_0x4a3a67['id'],'name':util[_0x4686('0xe')](_0x4686('0xf'),_0x4ac746['calleridname']),'phone':_0x4ac746[_0x4686('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4686('0x11')](_0x99fc77[_0x4686('0x12')],_0x4ac746,'\x20'),'description':intUtil[_0x4686('0x11')](_0x99fc77[_0x4686('0x13')],_0x4ac746,'
'),'tags':getTags(_0x99fc77[_0x4686('0x14')],_0x4686('0x15'))},getCustomFields(_0x99fc77[_0x4686('0x16')],_0x4ac746));_0x2e5e2a[_0x4686('0x17')]=_[_0x4686('0x18')](_['keyBy'](_0x2e5e2a[_0x4686('0x17')],'id'),_0x4686('0x19'));return request({'uri':util['format'](_0x4686('0x1a'),_0x1e8da4[_0x4686('0x1b')]),'method':_0x4686('0x1c'),'body':_0x2e5e2a})[_0x4686('0x1d')](function(_0x5ea624){logger[_0x4686('0xb')]('Ticket\x20created!');return _0x5ea624;});}function getUser(_0x4371d4,_0x32b657){if(intUtil[_0x4686('0x1e')](_0x32b657)){return request({'uri':util[_0x4686('0xe')](_0x4686('0x1f'),_0x4371d4['remoteUri']),'qs':{'email':_0x32b657}})[_0x4686('0x1d')](function(_0x1b342a){if(_0x1b342a[_0x4686('0x20')]){logger[_0x4686('0xb')](_0x4686('0x21'));return _[_0x4686('0x22')](_0x1b342a,function(_0x480265){return _0x480265[_0x4686('0x23')][_0x4686('0x24')]===_0x32b657;});}else{logger[_0x4686('0xb')](_0x4686('0x25'));return request({'uri':util['format'](_0x4686('0x26'),_0x4371d4[_0x4686('0x1b')])})[_0x4686('0x1d')](function(_0x21c78e){logger[_0x4686('0xb')](_0x4686('0x27'));return _0x21c78e;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4686('0xe')](_0x4686('0x26'),_0x4371d4['remoteUri'])})[_0x4686('0x1d')](function(_0x4788c5){logger['info'](_0x4686('0x27'));return _0x4788c5;});}}function getEndUser(_0x46a39c,_0x5c2358,_0x56509f){logger['info']('Searching\x20enduser\x20with\x20phone',_0x56509f);return request({'uri':util[_0x4686('0xe')](_0x4686('0x28'),_0x46a39c[_0x4686('0x1b')]),'qs':{'phone':_0x56509f}})[_0x4686('0x1d')](function(_0x437e6b){if(_0x437e6b[_0x4686('0x20')]){logger[_0x4686('0xb')](_0x4686('0x29'));return _['find'](_0x437e6b,{'phone':_0x56509f});}else{logger[_0x4686('0xb')](_0x4686('0x2a'));return request({'uri':util[_0x4686('0xe')]('%s/api/v2/contacts',_0x46a39c[_0x4686('0x1b')]),'method':_0x4686('0x1c'),'body':{'name':_0x5c2358,'phone':_0x56509f}})[_0x4686('0x1d')](function(_0x5c2648){logger[_0x4686('0xb')](_0x4686('0x2b'));return _0x5c2648;});}});}function getAuth(_0x32c1ba){return util[_0x4686('0xe')](_0x4686('0x2c'),new Buffer(_0x32c1ba['apiKey']+':X')[_0x4686('0x2d')]('base64'));}function request(_0x3e2df2){logger[_0x4686('0x2e')](_0x4686('0x2f'),JSON[_0x4686('0x30')](_0x3e2df2));return rp(_[_0x4686('0x7')](_0x3e2df2,{'method':_0x4686('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x44eaed,_0x56cb60){var _0x10675f=[];if(_0x44eaed&&_0x44eaed[_0x4686('0x20')]>0x0){_0x10675f=_[_0x4686('0x32')](_0x44eaed,_0x56cb60);}return _0x10675f;}function getCustomFields(_0x446712,_0x4d952e){var _0x133d85=[];var _0x24f347={'custom_fields':[]};if(_0x446712['length']>0x0){_['forEach'](_0x446712,function(_0x5a1f07){if(_['includes']([_0x4686('0x33'),_0x4686('0x34')],_0x5a1f07['type'])&&_0x5a1f07['nameField']&&!_0x5a1f07['customField']){_0x24f347[_0x5a1f07['nameField'][_0x4686('0x35')]()]=_0x5a1f07[_0x4686('0x36')][_0x4686('0x2d')]();}else if(_[_0x4686('0x37')]([_0x4686('0x33'),_0x4686('0x34')],_0x5a1f07['type'])&&_0x5a1f07['idField']&&_0x5a1f07[_0x4686('0x38')]){_0x24f347[_0x4686('0x17')]['push']({'id':_0x5a1f07[_0x4686('0x39')],'value':_0x5a1f07[_0x4686('0x36')]['toString']()});}else if(_0x5a1f07[_0x4686('0x3a')]==='variable'&&_0x5a1f07[_0x4686('0x3b')]&&_0x5a1f07[_0x4686('0x39')]&&_0x5a1f07[_0x4686('0x38')]){_0x4d952e[_0x5a1f07[_0x4686('0x3b')]]&&_0x24f347['custom_fields'][_0x4686('0x3c')]({'id':_0x5a1f07[_0x4686('0x39')],'value':_0x4d952e[_0x5a1f07[_0x4686('0x3b')]]['toString']()});}else if(_0x5a1f07[_0x4686('0x3a')]===_0x4686('0x3d')&&_0x5a1f07[_0x4686('0x3e')]&&_0x5a1f07[_0x4686('0x3e')][_0x4686('0x15')]&&_0x5a1f07[_0x4686('0x39')]&&_0x5a1f07[_0x4686('0x38')]){_0x4d952e[_0x5a1f07['Variable'][_0x4686('0x15')][_0x4686('0x35')]()]&&_0x24f347[_0x4686('0x17')][_0x4686('0x3c')]({'id':_0x5a1f07['idField'],'value':_0x4d952e[_0x5a1f07[_0x4686('0x3e')][_0x4686('0x15')][_0x4686('0x35')]()][_0x4686('0x2d')]()});}});}return _0x24f347;}exports[_0x4686('0x3f')]=function(_0x5d58a2,_0xfc2546,_0x19bfe3,_0x4d59a8,_0x4f735b,_0x280aab){var _0x10de6b,_0x2480ed;_0x280aab[_0x4686('0x1b')]=intUtil[_0x4686('0x40')](_0x280aab['remoteUri']);_0x280aab[_0x4686('0x41')]=intUtil['stripTrailingSlash'](_0x280aab[_0x4686('0x41')]);if(_0x4f735b&&_0x4f735b[_0x4686('0x42')]){logger[_0x4686('0xb')](_0x4686('0x43'),_0x4686('0x44'));_0xfc2546[_0x4686('0x45')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x280aab[_0x4686('0x41')],_0xfc2546[_0x4686('0x46')],md5(_0xfc2546['uniqueid']));}else{_0xfc2546[_0x4686('0x45')]='';}headers[_0x4686('0x47')]=getAuth(_0x280aab);return getUser(_0x280aab,_0x4d59a8['email'])[_0x4686('0x1d')](function(_0x426b81){_0x10de6b=_0x426b81;logger['info'](_0x4686('0x48'),_0x10de6b['id']);return getEndUser(_0x280aab,_0xfc2546[_0x4686('0x49')],_0xfc2546[_0x4686('0x10')]);})[_0x4686('0x1d')](function(_0x2b16ce){_0x2480ed=_0x2b16ce;logger[_0x4686('0xb')](_0x4686('0x4a'),_0x2480ed['id']);return getTicket(_0x280aab,_0x10de6b,_0x2480ed,_0x19bfe3,_0xfc2546);})[_0x4686('0x1d')](function(_0x393801){if(_0x393801&&_0x393801['id']){logger[_0x4686('0xb')](_0x4686('0x4b'));logger[_0x4686('0xb')](_0x4686('0x4c'),_0x393801['id']);logger[_0x4686('0xb')](_0x4686('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4686('0xe')](_0x4686('0x4d'),_0x4d59a8[_0x4686('0x15')]),'trigger:browser:url',{'uri':util[_0x4686('0xe')](_0x4686('0x4e'),_0x280aab[_0x4686('0x1b')],_0x393801['id'])});}})['catch'](function(_0x34b734){logger[_0x4686('0x4f')](_0x4686('0x43'),JSON[_0x4686('0x30')](_0x34b734));});};exports[_0x4686('0x50')]=function(_0x5fea7c,_0x3e3755,_0x94e146,_0x555d9f,_0x3069c2,_0xe8fa63,_0x5c99a7){var _0x26803b,_0x124518;_0xe8fa63[_0x4686('0x1b')]=intUtil[_0x4686('0x40')](_0xe8fa63[_0x4686('0x1b')]);_0xe8fa63[_0x4686('0x41')]=intUtil[_0x4686('0x40')](_0xe8fa63[_0x4686('0x41')]);if(_0x5c99a7&&_0x5c99a7[_0x4686('0x51')]&&_0x5c99a7[_0x4686('0x51')]!=='none'){logger['info'](_0x4686('0x52'),'Recording\x20is\x20enabled!');_0x3e3755[_0x4686('0x45')]=util['format'](_0x4686('0x53'),_0xe8fa63['serverUrl'],_0x3e3755[_0x4686('0x46')],md5(_0x3e3755[_0x4686('0x46')]));}headers[_0x4686('0x47')]=getAuth(_0xe8fa63);return getUser(_0xe8fa63,_0x555d9f[_0x4686('0x24')])[_0x4686('0x1d')](function(_0x47f83a){_0x26803b=_0x47f83a;logger['info'](_0x4686('0x48'),_0x26803b['id']);return getEndUser(_0xe8fa63,_0x3e3755['destcalleridname'],_0x3e3755[_0x4686('0x54')]);})[_0x4686('0x1d')](function(_0x38eabb){_0x124518=_0x38eabb;logger[_0x4686('0xb')](_0x4686('0x4a'),_0x124518['id']);return getTicket(_0xe8fa63,_0x26803b,_0x124518,_0x94e146,_0x3e3755);})[_0x4686('0x1d')](function(_0x2a6be2){if(_0x2a6be2&&_0x2a6be2['id']){logger['info']('Ticket\x20created!');logger['info'](_0x4686('0x4c'),_0x2a6be2['id']);logger[_0x4686('0xb')](_0x4686('0x52'),_0x4686('0x55'));emit(util[_0x4686('0xe')]('user:%s',_0x555d9f['name']),_0x4686('0x56'),{'uri':util[_0x4686('0xe')]('%s/helpdesk/tickets/%d',_0xe8fa63['remoteUri'],_0x2a6be2['id'])});}})['catch'](function(_0x60937){logger['error']('[OUTBOUND]',JSON['stringify'](_0x60937));});};exports['unmanaged']=function(_0x4fb4db,_0x3946a9,_0x3a4ec3,_0x51af94,_0x423322,_0x7cac88){var _0x116e8c,_0x3806c9;_0x7cac88[_0x4686('0x1b')]=intUtil['stripTrailingSlash'](_0x7cac88['remoteUri']);_0x7cac88[_0x4686('0x41')]=intUtil[_0x4686('0x40')](_0x7cac88['serverUrl']);if(_0x423322&&_0x423322[_0x4686('0x42')]){logger[_0x4686('0xb')]('['+_0x3946a9[_0x4686('0x57')]['toUpperCase']()+']',_0x4686('0x44'));_0x3946a9[_0x4686('0x45')]=util[_0x4686('0xe')](_0x4686('0x53'),_0x7cac88[_0x4686('0x41')],_0x3946a9[_0x4686('0x46')],md5(_0x3946a9[_0x4686('0x46')]));}else{_0x3946a9[_0x4686('0x45')]='';}headers['Authorization']=getAuth(_0x7cac88);return getUser(_0x7cac88,'')[_0x4686('0x1d')](function(_0x214c8e){_0x116e8c=_0x214c8e;logger['info'](_0x4686('0x48'),_0x116e8c['id']);return getEndUser(_0x7cac88,_0x3946a9['calleridname'],_0x3946a9[_0x4686('0x10')]);})[_0x4686('0x1d')](function(_0x9c453f){_0x3806c9=_0x9c453f;logger[_0x4686('0xb')](_0x4686('0x4a'),_0x3806c9['id']);return getTicket(_0x7cac88,_0x116e8c,_0x3806c9,_0x3a4ec3,_0x3946a9);})['then'](function(_0x57f560){if(_0x57f560){logger[_0x4686('0xb')](_0x4686('0x4b'));logger['info'](_0x4686('0x4c'),_0x57f560['id']);}})[_0x4686('0x58')](function(_0x36ac67){logger[_0x4686('0x4f')]('['+_0x3946a9[_0x4686('0x57')][_0x4686('0x59')]()+']',JSON[_0x4686('0x30')](_0x36ac67));});}; \ 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 7caaa0f..a217730 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 _0xaee0=['serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%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','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','catch','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','message','/api/tasks','getString','Subjects','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:','ticketId','user:%s','emit'];(function(_0x2e6a36,_0x44f57c){var _0xa10173=function(_0x155270){while(--_0x155270){_0x2e6a36['push'](_0x2e6a36['shift']());}};_0xa10173(++_0x44f57c);}(_0xaee0,0xbb));var _0x0aee=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0xaee0[_0x3438cf];return _0x278698;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x0aee('0x0'));var util=require(_0x0aee('0x1'));var moment=require(_0x0aee('0x2'));var Promise=require(_0x0aee('0x3'));var Redis=require(_0x0aee('0x4'));var intUtil=require(_0x0aee('0x5'));var config=require(_0x0aee('0x6'));var logger=require('../../../../config/logger')(_0x0aee('0x7'));config[_0x0aee('0x8')]=_[_0x0aee('0x9')](config['redis'],{'host':_0x0aee('0xa'),'port':0x18eb});var io=require(_0x0aee('0xb'))(new Redis(config[_0x0aee('0x8')]));function getAdminId(_0x369728,_0x19e1ea,_0x24a8a5,_0x193683){return new Promise(function(_0x4824c5,_0xa5cd3b){var _0x3c1a5d=![];var _0x1bd7c4={'method':_0x0aee('0xc'),'uri':_0x193683+_0x0aee('0xd'),'json':!![]};_0x1bd7c4[_0x0aee('0xe')]=_0x24a8a5;logger[_0x0aee('0xf')](_0x0aee('0x10'));return rp(_0x1bd7c4)[_0x0aee('0x11')](function(_0x5ba0d9){if(_0x5ba0d9){var _0xb069d8=_0x5ba0d9[_0x0aee('0x12')];var _0x4b83a2=null;for(_0x4b83a2=0x0;_0x4b83a2<_0xb069d8['length'];_0x4b83a2++){if(_0xb069d8[_0x4b83a2][_0x0aee('0x13')]===_0x369728[_0x0aee('0x14')]){_0x369728['adminId']=_0xb069d8[_0x4b83a2]['id'];_0x3c1a5d=!![];}}if(_0x3c1a5d){logger[_0x0aee('0xf')](_0x0aee('0x15'),_0x369728[_0x0aee('0x16')]);_0x4824c5(_0x369728);}else{_0xa5cd3b({'statusCode':0x194,'message':_0x0aee('0x17')});}}else{_0xa5cd3b({'statusCode':0x194,'message':_0x0aee('0x17')});}})['catch'](function(_0x348bf2){logger[_0x0aee('0x18')]('['+[_0x19e1ea['toUpperCase']()]+']',_0x348bf2['message']);_0xa5cd3b(_0x348bf2);});});}function getUser(_0x3de061,_0x12287f,_0x13b40d){return function(_0x4f729a){return new Promise(function(_0x53ab14,_0x5d67cd){var _0x179f9f={'method':_0x0aee('0xc'),'uri':_0x13b40d+'/api/selector/owners','json':!![]};_0x179f9f[_0x0aee('0xe')]=_0x12287f;logger[_0x0aee('0xf')]('Getting\x20user\x20list');return rp(_0x179f9f)[_0x0aee('0x11')](function(_0x2b277a){if(_0x2b277a){var _0x251c01=_0x2b277a['users'];var _0x4ea472=![];var _0x4cd896=null;if(_0x4f729a[_0x0aee('0x19')]!==null){logger[_0x0aee('0xf')](_0x0aee('0x1a'),_0x4f729a['agentEmail']);_0x4f729a[_0x0aee('0x1b')]=_0x4f729a[_0x0aee('0x19')];for(_0x4cd896=0x0;_0x4cd896<_0x251c01['length'];_0x4cd896++){if(_0x251c01[_0x4cd896]['email']===_0x4f729a[_0x0aee('0x19')]){_0x4ea472=!![];_0x4f729a[_0x0aee('0x1c')]=_0x251c01[_0x4cd896]['id'];logger[_0x0aee('0xf')](_0x0aee('0x1d'),_0x4f729a[_0x0aee('0x1c')]);}}}if(!_0x4ea472){logger['info']('Admin\x20selected');_0x4f729a[_0x0aee('0x1b')]=_0x4f729a[_0x0aee('0x14')];_0x4f729a['userId']=_0x4f729a[_0x0aee('0x16')];_0x4ea472=!![];}if(_0x4ea472){_0x53ab14(_0x4f729a);}else{_0x5d67cd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5d67cd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x5d68fd){logger[_0x0aee('0x18')]('['+[_0x3de061[_0x0aee('0x1e')]()]+']',_0x5d68fd['message']);_0x5d67cd(_0x5d68fd);});});};}function searchContact(_0x5a1272,_0x11e861,_0x14dfc8,_0x373b4c){return new Promise(function(_0x49a5e0,_0x27898f){var _0x5e13af={'method':_0x0aee('0xc'),'headers':_0x11e861,'uri':_0x5a1272+_0x0aee('0x1f')+_0x373b4c+_0x0aee('0x20')+_0x14dfc8+_0x0aee('0x21'),'json':!![]};rp(_0x5e13af)[_0x0aee('0x11')](function(_0x43b428){var _0x42927e=_[_0x0aee('0x22')](_0x43b428[_0x0aee('0x23')][_0x0aee('0x23')],[_0x14dfc8,_0x373b4c]);_0x49a5e0(_0x42927e);})[_0x0aee('0x24')](function(_0x1bab42){_0x27898f(_0x1bab42);});});}function getEndUser(_0x7c69a6,_0x1b2542,_0x40bd94){return function(_0x38d3e2){return new Promise(function(_0x43950f,_0xa4f668){logger[_0x0aee('0xf')](util['format'](_0x0aee('0x25'),_0x38d3e2[_0x0aee('0x26')]));searchContact(_0x40bd94,_0x1b2542,_0x0aee('0x27'),_0x38d3e2[_0x0aee('0x26')])[_0x0aee('0x11')](function(_0x875184){if(_0x875184){_0x38d3e2[_0x0aee('0x28')]=_0x875184['id'];logger[_0x0aee('0xf')](_0x0aee('0x29'),_0x38d3e2['endUserId']);return _0x43950f(_0x38d3e2);}searchContact(_0x40bd94,_0x1b2542,'work_number',_0x38d3e2[_0x0aee('0x26')])[_0x0aee('0x11')](function(_0xde0e6a){if(_0xde0e6a){_0x38d3e2[_0x0aee('0x28')]=_0xde0e6a['id'];logger['info'](_0x0aee('0x2a'),_0x38d3e2[_0x0aee('0x28')]);return _0x43950f(_0x38d3e2);}createEndUser(_0x38d3e2,_0x7c69a6,_0x1b2542,_0x40bd94)[_0x0aee('0x11')](function(_0x5964d3){logger[_0x0aee('0xf')](_0x0aee('0x2b'),_0x5964d3[_0x0aee('0x28')]);return _0x43950f(_0x5964d3);});});})['catch'](function(_0x4b5fb3){_0xa4f668(_0x4b5fb3);});});};}function createEndUser(_0x58a237,_0x1c4160,_0x35f18d,_0x3aae58){return new Promise(function(_0x54e7d2,_0x3dac3d){var _0x5daa2e=moment();var _0x4fc8e1={'method':_0x0aee('0x2c'),'uri':_0x3aae58+_0x0aee('0x2d'),'body':{'contact':{'last_name':_0x58a237[_0x0aee('0x26')],'work_number':_0x58a237['contactNumber'],'mobile_number':_0x58a237[_0x0aee('0x26')],'owner_id':_0x58a237[_0x0aee('0x1c')],'created_at':_0x5daa2e[_0x0aee('0x2e')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4fc8e1[_0x0aee('0xe')]=_0x35f18d;logger[_0x0aee('0xf')](_0x0aee('0x2f'));return rp(_0x4fc8e1)[_0x0aee('0x11')](function(_0x260ec8){_0x58a237[_0x0aee('0x28')]=_0x260ec8[_0x0aee('0x30')]['id'];_0x54e7d2(_0x58a237);})[_0x0aee('0x24')](function(_0x163c2a){logger[_0x0aee('0x18')]('['+[_0x1c4160['toUpperCase']()]+']',_0x163c2a[_0x0aee('0x31')]);_0x3dac3d(_0x163c2a[_0x0aee('0x31')]);});});}function getTicket(_0x2e2b7d,_0x382098,_0x248c33,_0x57c486,_0x4ca5be){return function(_0x34ac18){logger[_0x0aee('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x308c0b,_0xed7bc7){var _0xf17cdb=moment();var _0x154257={'method':_0x0aee('0x2c'),'uri':_0x248c33+_0x0aee('0x32'),'body':{'title':intUtil[_0x0aee('0x33')](_0x57c486[_0x0aee('0x34')],_0x4ca5be,'\x20'),'description':intUtil[_0x0aee('0x33')](_0x57c486['Descriptions'],_0x4ca5be,'\x0a'),'owner_id':_0x34ac18[_0x0aee('0x1c')],'creater_id':_0x34ac18[_0x0aee('0x16')],'targetable_id':_0x34ac18[_0x0aee('0x28')],'targetable_type':'Contact','created_at':_0xf17cdb['format'](_0x0aee('0x35')),'due_date':_0xf17cdb['add'](0x1e,'m')[_0x0aee('0x2e')](_0x0aee('0x35'))},'json':!![]};_0x154257[_0x0aee('0xe')]=_0x382098;return rp(_0x154257)['then'](function(_0xd15261){_0x34ac18['ticketId']=_0xd15261[_0x0aee('0x36')]['id'];logger[_0x0aee('0xf')](_0x0aee('0x37'),_0x34ac18[_0x0aee('0x38')]);_0x308c0b(_0x34ac18);})[_0x0aee('0x24')](function(_0x4cc2bb){logger[_0x0aee('0x18')]('['+[_0x2e2b7d[_0x0aee('0x1e')]()]+']',_0x4cc2bb['message']);_0xed7bc7(_0x4cc2bb[_0x0aee('0x31')]);});});};}function emit(_0x2d757c,_0x917a60,_0x351467){var _0x53685c={'uri':_0x2d757c+'/contacts/'+_0x351467};io['to'](util[_0x0aee('0x2e')](_0x0aee('0x39'),_0x917a60))[_0x0aee('0x3a')]('trigger:browser:url',_0x53685c);}exports['cs']=function(_0x5b6ed1,_0x7ea412,_0x1e9c90,_0x233da8,_0x3f6a9f,_0x3ec767,_0x385d43,_0x4af146){var _0x4c1e7f={};var _0x455d1f={'Authorization':'Token\x20token='+_0x3ec767['apiKey']};_0x3ec767['remoteUri']=intUtil['stripTrailingSlash'](_0x3ec767['remoteUri']);_0x3ec767[_0x0aee('0x3b')]=intUtil[_0x0aee('0x3c')](_0x3ec767[_0x0aee('0x3b')]);var _0x421b2e=_0x3ec767['remoteUri'];_0x4c1e7f[_0x0aee('0x14')]=_0x3ec767[_0x0aee('0x3d')];_0x4c1e7f[_0x0aee('0x26')]=_0x4af146[_0x0aee('0x3e')]()==='outbound'?_0x7ea412[_0x0aee('0x3f')]:_0x7ea412[_0x0aee('0x40')];_0x4c1e7f[_0x0aee('0x41')]=_0x4af146===_0x0aee('0x42')||_0x4af146===_0x0aee('0x43')?_0x0aee('0x42'):_0x0aee('0x44');if(_0x233da8){_0x4c1e7f['agentEmail']=_0x233da8[_0x0aee('0x13')];}var _0x48d2d6=util['format'](_0x0aee('0x45'),_0x3ec767[_0x0aee('0x3b')],_0x7ea412[_0x0aee('0x46')],md5(_0x7ea412[_0x0aee('0x46')]));if(_0x3f6a9f&&_0x3f6a9f[_0x0aee('0x47')]){logger[_0x0aee('0xf')](_0x0aee('0x48'),_0x0aee('0x49'));_0x7ea412[_0x0aee('0x4a')]=_0x48d2d6;}else if(_0x385d43&&_0x385d43[_0x0aee('0x4b')]&&_0x385d43[_0x0aee('0x4b')]!==_0x0aee('0x4c')){logger[_0x0aee('0xf')]('[OUTBOUND]',_0x0aee('0x49'));_0x7ea412[_0x0aee('0x4a')]=_0x48d2d6;}else{_0x7ea412[_0x0aee('0x4a')]='';}return getAdminId(_0x4c1e7f,_0x4af146,_0x455d1f,_0x421b2e)[_0x0aee('0x11')](getUser(_0x4af146,_0x455d1f,_0x421b2e))[_0x0aee('0x11')](getEndUser(_0x4af146,_0x455d1f,_0x421b2e))[_0x0aee('0x11')](getTicket(_0x4af146,_0x455d1f,_0x421b2e,_0x1e9c90,_0x7ea412))[_0x0aee('0x11')](function(_0x55bfea){logger['info'](util[_0x0aee('0x2e')](_0x0aee('0x4d'),_0x55bfea['ticketId']));if(_0x4af146!==_0x0aee('0x43')){logger[_0x0aee('0xf')]('['+[_0x4af146[_0x0aee('0x1e')]()]+']',_0x0aee('0x4e'));emit(_0x421b2e,_0x233da8[_0x0aee('0x4f')],_0x55bfea['endUserId']);}})[_0x0aee('0x24')](function(_0x196e20){logger[_0x0aee('0x18')]('['+[_0x4af146[_0x0aee('0x1e')]()]+_0x0aee('0x50'),util[_0x0aee('0x51')](_0x196e20,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xed43=['ioredis','./util','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','then','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','task','Task\x20created:','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','callDirection','unmanaged','serverUrl','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','util','moment','bluebird'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xed43,0x186));var _0x3ed4=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0xed43[_0x4de877];return _0xb2cfeb;};'use strict';var _=require(_0x3ed4('0x0'));var rp=require(_0x3ed4('0x1'));var md5=require('md5');var util=require(_0x3ed4('0x2'));var moment=require(_0x3ed4('0x3'));var Promise=require(_0x3ed4('0x4'));var Redis=require(_0x3ed4('0x5'));var intUtil=require(_0x3ed4('0x6'));var config=require('../../../../config/environment');var logger=require(_0x3ed4('0x7'))(_0x3ed4('0x8'));config['redis']=_[_0x3ed4('0x9')](config[_0x3ed4('0xa')],{'host':_0x3ed4('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3ed4('0xa')]));function getAdminId(_0x4f5c31,_0x128a81,_0x586392,_0x4ea411){return new Promise(function(_0x1c2a58,_0x2ef6e7){var _0x5c89bc=![];var _0x4cc69f={'method':_0x3ed4('0xc'),'uri':_0x4ea411+_0x3ed4('0xd'),'json':!![]};_0x4cc69f[_0x3ed4('0xe')]=_0x586392;logger[_0x3ed4('0xf')](_0x3ed4('0x10'));return rp(_0x4cc69f)['then'](function(_0x245dca){if(_0x245dca){var _0x1bd5db=_0x245dca[_0x3ed4('0x11')];var _0x1fc5c2=null;for(_0x1fc5c2=0x0;_0x1fc5c2<_0x1bd5db[_0x3ed4('0x12')];_0x1fc5c2++){if(_0x1bd5db[_0x1fc5c2]['email']===_0x4f5c31[_0x3ed4('0x13')]){_0x4f5c31[_0x3ed4('0x14')]=_0x1bd5db[_0x1fc5c2]['id'];_0x5c89bc=!![];}}if(_0x5c89bc){logger[_0x3ed4('0xf')](_0x3ed4('0x15'),_0x4f5c31[_0x3ed4('0x14')]);_0x1c2a58(_0x4f5c31);}else{_0x2ef6e7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2ef6e7({'statusCode':0x194,'message':_0x3ed4('0x16')});}})[_0x3ed4('0x17')](function(_0x4fa602){logger[_0x3ed4('0x18')]('['+[_0x128a81[_0x3ed4('0x19')]()]+']',_0x4fa602[_0x3ed4('0x1a')]);_0x2ef6e7(_0x4fa602);});});}function getUser(_0x1df7cf,_0x2ddd57,_0x496440){return function(_0x214d2c){return new Promise(function(_0x40eed7,_0x3f39ad){var _0x3c4a48={'method':_0x3ed4('0xc'),'uri':_0x496440+_0x3ed4('0xd'),'json':!![]};_0x3c4a48[_0x3ed4('0xe')]=_0x2ddd57;logger[_0x3ed4('0xf')](_0x3ed4('0x1b'));return rp(_0x3c4a48)['then'](function(_0x22f7a5){if(_0x22f7a5){var _0x210218=_0x22f7a5[_0x3ed4('0x11')];var _0x387ba5=![];var _0x14d05e=null;if(_0x214d2c[_0x3ed4('0x1c')]!==null){logger['info'](_0x3ed4('0x1d'),_0x214d2c[_0x3ed4('0x1c')]);_0x214d2c[_0x3ed4('0x1e')]=_0x214d2c['agentEmail'];for(_0x14d05e=0x0;_0x14d05e<_0x210218[_0x3ed4('0x12')];_0x14d05e++){if(_0x210218[_0x14d05e][_0x3ed4('0x1f')]===_0x214d2c[_0x3ed4('0x1c')]){_0x387ba5=!![];_0x214d2c['userId']=_0x210218[_0x14d05e]['id'];logger['info']('User\x20found:',_0x214d2c['userId']);}}}if(!_0x387ba5){logger['info']('Admin\x20selected');_0x214d2c[_0x3ed4('0x1e')]=_0x214d2c[_0x3ed4('0x13')];_0x214d2c[_0x3ed4('0x20')]=_0x214d2c[_0x3ed4('0x14')];_0x387ba5=!![];}if(_0x387ba5){_0x40eed7(_0x214d2c);}else{_0x3f39ad({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3f39ad({'statusCode':0x194,'message':_0x3ed4('0x16')});}})[_0x3ed4('0x17')](function(_0x54e259){logger[_0x3ed4('0x18')]('['+[_0x1df7cf['toUpperCase']()]+']',_0x54e259[_0x3ed4('0x1a')]);_0x3f39ad(_0x54e259);});});};}function searchContact(_0xde9b41,_0x31d131,_0x279f31,_0xc26e2d){return new Promise(function(_0x5d459e,_0x3af30b){var _0x44446f={'method':_0x3ed4('0xc'),'headers':_0x31d131,'uri':_0xde9b41+'/api/lookup?q='+_0xc26e2d+'&f='+_0x279f31+'&entities=contact','json':!![]};rp(_0x44446f)[_0x3ed4('0x21')](function(_0x2b3fa6){var _0x487c45=_['find'](_0x2b3fa6[_0x3ed4('0x22')][_0x3ed4('0x22')],[_0x279f31,_0xc26e2d]);_0x5d459e(_0x487c45);})[_0x3ed4('0x17')](function(_0x536087){_0x3af30b(_0x536087);});});}function getEndUser(_0x42f2e5,_0x238cbd,_0x5bbfdb){return function(_0x335f4f){return new Promise(function(_0xb07c75,_0x3dee05){logger[_0x3ed4('0xf')](util[_0x3ed4('0x23')](_0x3ed4('0x24'),_0x335f4f['contactNumber']));searchContact(_0x5bbfdb,_0x238cbd,'mobile_number',_0x335f4f[_0x3ed4('0x25')])[_0x3ed4('0x21')](function(_0x36fee7){if(_0x36fee7){_0x335f4f[_0x3ed4('0x26')]=_0x36fee7['id'];logger[_0x3ed4('0xf')](_0x3ed4('0x27'),_0x335f4f[_0x3ed4('0x26')]);return _0xb07c75(_0x335f4f);}searchContact(_0x5bbfdb,_0x238cbd,_0x3ed4('0x28'),_0x335f4f['contactNumber'])[_0x3ed4('0x21')](function(_0x3a4e86){if(_0x3a4e86){_0x335f4f[_0x3ed4('0x26')]=_0x3a4e86['id'];logger[_0x3ed4('0xf')](_0x3ed4('0x29'),_0x335f4f[_0x3ed4('0x26')]);return _0xb07c75(_0x335f4f);}createEndUser(_0x335f4f,_0x42f2e5,_0x238cbd,_0x5bbfdb)['then'](function(_0x165294){logger[_0x3ed4('0xf')]('Contact\x20created:',_0x165294['endUserId']);return _0xb07c75(_0x165294);});});})[_0x3ed4('0x17')](function(_0x7a4117){_0x3dee05(_0x7a4117);});});};}function createEndUser(_0x4c76c1,_0x3e7b4b,_0x5f0fde,_0x2c90ff){return new Promise(function(_0x14931e,_0x199b50){var _0x4ec714=moment();var _0x31007e={'method':_0x3ed4('0x2a'),'uri':_0x2c90ff+_0x3ed4('0x2b'),'body':{'contact':{'last_name':_0x4c76c1[_0x3ed4('0x25')],'work_number':_0x4c76c1[_0x3ed4('0x25')],'mobile_number':_0x4c76c1[_0x3ed4('0x25')],'owner_id':_0x4c76c1[_0x3ed4('0x20')],'created_at':_0x4ec714['format'](_0x3ed4('0x2c'))}},'json':!![]};_0x31007e['headers']=_0x5f0fde;logger[_0x3ed4('0xf')](_0x3ed4('0x2d'));return rp(_0x31007e)['then'](function(_0xfc6398){_0x4c76c1[_0x3ed4('0x26')]=_0xfc6398['contact']['id'];_0x14931e(_0x4c76c1);})[_0x3ed4('0x17')](function(_0x481d95){logger[_0x3ed4('0x18')]('['+[_0x3e7b4b[_0x3ed4('0x19')]()]+']',_0x481d95[_0x3ed4('0x1a')]);_0x199b50(_0x481d95[_0x3ed4('0x1a')]);});});}function getTicket(_0x5cd7a0,_0x195a6f,_0xc0a1f,_0x5af965,_0x450353){return function(_0x364d12){logger[_0x3ed4('0xf')](_0x3ed4('0x2e'));return new Promise(function(_0x54ea35,_0xa0f902){var _0x6a895b=moment();var _0x4d2b09={'method':'POST','uri':_0xc0a1f+_0x3ed4('0x2f'),'body':{'title':intUtil[_0x3ed4('0x30')](_0x5af965[_0x3ed4('0x31')],_0x450353,'\x20'),'description':intUtil[_0x3ed4('0x30')](_0x5af965[_0x3ed4('0x32')],_0x450353,'\x0a'),'owner_id':_0x364d12[_0x3ed4('0x20')],'creater_id':_0x364d12[_0x3ed4('0x14')],'targetable_id':_0x364d12[_0x3ed4('0x26')],'targetable_type':_0x3ed4('0x33'),'created_at':_0x6a895b[_0x3ed4('0x23')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x6a895b[_0x3ed4('0x34')](0x1e,'m')['format'](_0x3ed4('0x2c'))},'json':!![]};_0x4d2b09['headers']=_0x195a6f;return rp(_0x4d2b09)[_0x3ed4('0x21')](function(_0x2623ce){_0x364d12['ticketId']=_0x2623ce[_0x3ed4('0x35')]['id'];logger['info'](_0x3ed4('0x36'),_0x364d12[_0x3ed4('0x37')]);_0x54ea35(_0x364d12);})['catch'](function(_0x5c92f2){logger[_0x3ed4('0x18')]('['+[_0x5cd7a0[_0x3ed4('0x19')]()]+']',_0x5c92f2[_0x3ed4('0x1a')]);_0xa0f902(_0x5c92f2['message']);});});};}function emit(_0x17f0a5,_0x31af41,_0x8d3c25){var _0x24c924={'uri':_0x17f0a5+'/contacts/'+_0x8d3c25};io['to'](util[_0x3ed4('0x23')](_0x3ed4('0x38'),_0x31af41))[_0x3ed4('0x39')](_0x3ed4('0x3a'),_0x24c924);}exports['cs']=function(_0xf85fe,_0x155709,_0x508967,_0x55d266,_0x880c6c,_0x199085,_0x5ac6c9,_0x5dd2ac){var _0xf2b7f3={};var _0x901224={'Authorization':_0x3ed4('0x3b')+_0x199085['apiKey']};_0x199085[_0x3ed4('0x3c')]=intUtil[_0x3ed4('0x3d')](_0x199085[_0x3ed4('0x3c')]);_0x199085['serverUrl']=intUtil[_0x3ed4('0x3d')](_0x199085['serverUrl']);var _0xe6a569=_0x199085[_0x3ed4('0x3c')];_0xf2b7f3[_0x3ed4('0x13')]=_0x199085[_0x3ed4('0x3e')];_0xf2b7f3[_0x3ed4('0x25')]=_0x5dd2ac[_0x3ed4('0x3f')]()===_0x3ed4('0x40')?_0x155709[_0x3ed4('0x41')]:_0x155709['calleridnum'];_0xf2b7f3[_0x3ed4('0x42')]=_0x5dd2ac==='queue'||_0x5dd2ac===_0x3ed4('0x43')?'queue':_0x3ed4('0x40');if(_0x55d266){_0xf2b7f3[_0x3ed4('0x1c')]=_0x55d266[_0x3ed4('0x1f')];}var _0x2fb27d=util[_0x3ed4('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x199085[_0x3ed4('0x44')],_0x155709[_0x3ed4('0x45')],md5(_0x155709['uniqueid']));if(_0x880c6c&&_0x880c6c[_0x3ed4('0x46')]){logger[_0x3ed4('0xf')]('[QUEUE]',_0x3ed4('0x47'));_0x155709['recordingURL']=_0x2fb27d;}else if(_0x5ac6c9&&_0x5ac6c9['recordingFormat']&&_0x5ac6c9[_0x3ed4('0x48')]!==_0x3ed4('0x49')){logger['info']('[OUTBOUND]',_0x3ed4('0x47'));_0x155709[_0x3ed4('0x4a')]=_0x2fb27d;}else{_0x155709[_0x3ed4('0x4a')]='';}return getAdminId(_0xf2b7f3,_0x5dd2ac,_0x901224,_0xe6a569)['then'](getUser(_0x5dd2ac,_0x901224,_0xe6a569))[_0x3ed4('0x21')](getEndUser(_0x5dd2ac,_0x901224,_0xe6a569))[_0x3ed4('0x21')](getTicket(_0x5dd2ac,_0x901224,_0xe6a569,_0x508967,_0x155709))[_0x3ed4('0x21')](function(_0x5c6d28){logger['info'](util[_0x3ed4('0x23')](_0x3ed4('0x4b'),_0x5c6d28[_0x3ed4('0x37')]));if(_0x5dd2ac!==_0x3ed4('0x43')){logger['info']('['+[_0x5dd2ac[_0x3ed4('0x19')]()]+']',_0x3ed4('0x4c'));emit(_0xe6a569,_0x55d266[_0x3ed4('0x4d')],_0x5c6d28[_0x3ed4('0x26')]);}})['catch'](function(_0x1428a1){logger['error']('['+[_0x5dd2ac[_0x3ed4('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x3ed4('0x4e')](_0x1428a1,{'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 20c6557..8030984 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 _0xf2b1=['find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','zoho','vtiger','freshsales','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','zendesk','freshdesk','desk','dynamics365','exec','includes','data1','toLowerCase','data2'];(function(_0x421096,_0x327fb3){var _0x4e9a4c=function(_0x4b0e89){while(--_0x4b0e89){_0x421096['push'](_0x421096['shift']());}};_0x4e9a4c(++_0x327fb3);}(_0xf2b1,0xf8));var _0x1f2b=function(_0x1726e1,_0x1cc1f4){_0x1726e1=_0x1726e1-0x0;var _0x44eccc=_0xf2b1[_0x1726e1];return _0x44eccc;};'use strict';var _=require(_0x1f2b('0x0'));var util=require('util');var zendesk=require(_0x1f2b('0x1'));var salesforce=require(_0x1f2b('0x2'));var sugarcrm=require(_0x1f2b('0x3'));var freshdesk=require(_0x1f2b('0x4'));var zoho=require(_0x1f2b('0x5'));var desk=require(_0x1f2b('0x6'));var vtiger=require(_0x1f2b('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x1f2b('0x8'));var freshsales=require('./freshsales');var integrations=[_0x1f2b('0x9'),'salesforce','sugarcrm',_0x1f2b('0xa'),'zoho',_0x1f2b('0xb'),'vtiger',_0x1f2b('0xc'),'freshsales','servicenow'];exports[_0x1f2b('0xd')]=function(_0x243885,_0x310a6b,_0x410488,_0x2a6317,_0x3c0a66,_0x545e1b){if(_0x410488){if(_[_0x1f2b('0xe')](integrations,_0x243885[_0x1f2b('0xf')][_0x1f2b('0x10')]())){try{var _0x129ee1=null;var _0xd513e6='';var _0x1b6489=_0x410488[_0x243885[_0x1f2b('0xf')][_0x1f2b('0x10')]()];if(_0x1b6489){var _0x47a653=_0x1b6489[_0x243885[_0x1f2b('0x11')]];if(_0x47a653){var _0x138db4=_[_0x1f2b('0x12')](_0x47a653[_0x1f2b('0x13')],{'id':parseInt(_0x243885[_0x1f2b('0x14')],0xa)});if(_0x138db4){if(_0x2a6317){if(_0x3c0a66&&_0x310a6b[_0x1f2b('0x15')]){_0xd513e6=_0x1f2b('0x15');}else if(_0x310a6b[_0x1f2b('0x16')]){_0xd513e6='outbound';}else{console[_0x1f2b('0x17')](_0x1f2b('0x18'),_0x310a6b);}}else{_0xd513e6=_0x1f2b('0x19');}switch(_0x243885['data1'][_0x1f2b('0x10')]()){case _0x1f2b('0x9'):zendesk[_0xd513e6](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b);break;case'salesforce':salesforce[_0xd513e6](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b);break;case _0x1f2b('0x1a'):sugarcrm[_0xd513e6](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b);break;case'freshdesk':freshdesk[_0xd513e6](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b);break;case _0x1f2b('0x1b'):zoho[_0xd513e6](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b);break;case _0x1f2b('0xb'):desk[_0xd513e6](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b);break;case _0x1f2b('0x1c'):vtiger[_0xd513e6](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b);break;case _0x1f2b('0x1d'):freshsales['cs'](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b,_0xd513e6);break;case _0x1f2b('0x1e'):servicenow['cs'](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b,_0xd513e6);break;case _0x1f2b('0xc'):dynamics365['cs'](_0x243885,_0x310a6b,_0x138db4,_0x2a6317,_0x3c0a66,_0x47a653,_0x545e1b,_0xd513e6);break;default:console[_0x1f2b('0x17')](_0x1f2b('0x1f'));}}else{_0x129ee1=require(_0x1f2b('0x20'))(_0x243885['data1'][_0x1f2b('0x10')]());_0x129ee1[_0x1f2b('0x21')](_0x1f2b('0x22'),util[_0x1f2b('0x23')](_0x1f2b('0x24'),_0x243885['data1'][_0x1f2b('0x10')](),_0x243885['data3']));}}else{_0x129ee1=require('../../../../config/logger')(_0x243885['data1']['toLowerCase']());_0x129ee1[_0x1f2b('0x21')](_0x1f2b('0x22'),util['format'](_0x1f2b('0x25'),_0x243885[_0x1f2b('0xf')][_0x1f2b('0x10')](),_0x243885[_0x1f2b('0x11')]));}}else{}}catch(_0x3a75ef){console[_0x1f2b('0x21')](_0x3a75ef);}}}}; \ No newline at end of file +var _0x3e57=['./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','vtiger','includes','data1','toLowerCase','data2','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','zoho','desk','dynamics365','../../../../config/logger','[EXEC]','format','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk'];(function(_0x5626d8,_0x5b2b4f){var _0x29f754=function(_0x24270b){while(--_0x24270b){_0x5626d8['push'](_0x5626d8['shift']());}};_0x29f754(++_0x5b2b4f);}(_0x3e57,0x16e));var _0x73e5=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0x3e57[_0x37b3e5];return _0x207f20;};'use strict';var _=require(_0x73e5('0x0'));var util=require(_0x73e5('0x1'));var zendesk=require(_0x73e5('0x2'));var salesforce=require(_0x73e5('0x3'));var sugarcrm=require(_0x73e5('0x4'));var freshdesk=require(_0x73e5('0x5'));var zoho=require(_0x73e5('0x6'));var desk=require(_0x73e5('0x7'));var vtiger=require('./vtiger');var servicenow=require(_0x73e5('0x8'));var dynamics365=require(_0x73e5('0x9'));var freshsales=require('./freshsales');var integrations=[_0x73e5('0xa'),_0x73e5('0xb'),_0x73e5('0xc'),_0x73e5('0xd'),'zoho','desk',_0x73e5('0xe'),'dynamics365','freshsales','servicenow'];exports['exec']=function(_0x3727b8,_0x21e436,_0x40f009,_0x256f1c,_0x89c2c9,_0x3b1241){if(_0x40f009){if(_[_0x73e5('0xf')](integrations,_0x3727b8[_0x73e5('0x10')][_0x73e5('0x11')]())){try{var _0x1a2ae3=null;var _0x1c1f95='';var _0x440a1d=_0x40f009[_0x3727b8[_0x73e5('0x10')][_0x73e5('0x11')]()];if(_0x440a1d){var _0x519379=_0x440a1d[_0x3727b8[_0x73e5('0x12')]];if(_0x519379){var _0xda3c06=_[_0x73e5('0x13')](_0x519379['Configurations'],{'id':parseInt(_0x3727b8[_0x73e5('0x14')],0xa)});if(_0xda3c06){if(_0x256f1c){if(_0x89c2c9&&_0x21e436[_0x73e5('0x15')]){_0x1c1f95='queue';}else if(_0x21e436[_0x73e5('0x16')]){_0x1c1f95=_0x73e5('0x17');}else{console[_0x73e5('0x18')](_0x73e5('0x19'),_0x21e436);}}else{_0x1c1f95='unmanaged';}switch(_0x3727b8['data1'][_0x73e5('0x11')]()){case _0x73e5('0xa'):zendesk[_0x1c1f95](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241);break;case _0x73e5('0xb'):salesforce[_0x1c1f95](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241);break;case'sugarcrm':sugarcrm[_0x1c1f95](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241);break;case'freshdesk':freshdesk[_0x1c1f95](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241);break;case _0x73e5('0x1a'):zoho[_0x1c1f95](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241);break;case _0x73e5('0x1b'):desk[_0x1c1f95](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241);break;case _0x73e5('0xe'):vtiger[_0x1c1f95](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241);break;case'freshsales':freshsales['cs'](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241,_0x1c1f95);break;case'servicenow':servicenow['cs'](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241,_0x1c1f95);break;case _0x73e5('0x1c'):dynamics365['cs'](_0x3727b8,_0x21e436,_0xda3c06,_0x256f1c,_0x89c2c9,_0x519379,_0x3b1241,_0x1c1f95);break;default:console[_0x73e5('0x18')]('unknown\x20integration');}}else{_0x1a2ae3=require(_0x73e5('0x1d'))(_0x3727b8[_0x73e5('0x10')][_0x73e5('0x11')]());_0x1a2ae3['error'](_0x73e5('0x1e'),util[_0x73e5('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3727b8[_0x73e5('0x10')]['toLowerCase'](),_0x3727b8['data3']));}}else{_0x1a2ae3=require(_0x73e5('0x1d'))(_0x3727b8[_0x73e5('0x10')][_0x73e5('0x11')]());_0x1a2ae3[_0x73e5('0x20')](_0x73e5('0x1e'),util[_0x73e5('0x1f')](_0x73e5('0x21'),_0x3727b8[_0x73e5('0x10')][_0x73e5('0x11')](),_0x3727b8[_0x73e5('0x12')]));}}else{}}catch(_0x4af8e8){console[_0x73e5('0x20')](_0x4af8e8);}}}}; \ 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 0a82f26..aa119a7 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 _0x4f5b=['execute','length','find','Email','Agent\x20%s\x20found.','resolve','identity','then','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','','format','LastName','Company','No\x20Company','upperFirst','create','forEach','includes','string','picklist','type','idField','variable','variableName','toString','Variable','name','password','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','jsforce','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','endUserType','WhoId','account','WhatId','Case','contact','ContactId','AccountId','lead','leadId','info','sobject','isNil','validateEmail'];(function(_0x31bf50,_0x14d03d){var _0x906bc=function(_0x25cb6e){while(--_0x25cb6e){_0x31bf50['push'](_0x31bf50['shift']());}};_0x906bc(++_0x14d03d);}(_0x4f5b,0x16a));var _0xb4f5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4f5b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb4f5('0x0'));var rp=require(_0xb4f5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xb4f5('0x2'));var jsforce=require(_0xb4f5('0x3'));var util=require('util');var Redis=require(_0xb4f5('0x4'));var intUtil=require(_0xb4f5('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb4f5('0x6'))(_0xb4f5('0x7'));config[_0xb4f5('0x8')]=_[_0xb4f5('0x9')](config[_0xb4f5('0x8')],{'host':_0xb4f5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb4f5('0x8')]));function emit(_0x38e43f,_0x5eabb9,_0x3cd339){io['to'](_0x38e43f)[_0xb4f5('0xb')](_0x5eabb9,_0x3cd339);}function getTicket(_0x42b774,_0x213d3e,_0x411832,_0x2e9fea,_0x595353,_0x104e4b,_0x2b8821,_0x420cbf){var _0x444cf9=Object[_0xb4f5('0xc')]({},{'OwnerId':_0x213d3e['id'],'Subject':intUtil[_0xb4f5('0xd')](_0x2e9fea[_0xb4f5('0xe')],_0x595353,'\x20'),'Description':intUtil['getString'](_0x2e9fea[_0xb4f5('0xf')],_0x595353,'\x0a')},getCustomFields(_0x104e4b,_0x595353));if(_0x411832){if(_0x2e9fea[_0xb4f5('0x10')]==='Task'){_0x444cf9[_0xb4f5('0x11')]=moment[_0xb4f5('0x12')]();_0x444cf9[_0xb4f5('0x13')]=![];_0x444cf9['IsRecurrence']=![];if(_0x411832[_0xb4f5('0x14')]==='contact'||_0x411832[_0xb4f5('0x14')]==='lead'){_0x444cf9[_0xb4f5('0x15')]=_0x411832['id'];}else if(_0x411832[_0xb4f5('0x14')]===_0xb4f5('0x16')){_0x444cf9[_0xb4f5('0x17')]=_0x411832['id'];}}else if(_0x2e9fea[_0xb4f5('0x10')]===_0xb4f5('0x18')){if(_0x411832['endUserType']===_0xb4f5('0x19')){_0x444cf9[_0xb4f5('0x1a')]=_0x411832['id'];}else if(_0x411832[_0xb4f5('0x14')]==='account'){_0x444cf9[_0xb4f5('0x1b')]=_0x411832['id'];}else if(_0x411832[_0xb4f5('0x14')]===_0xb4f5('0x1c')&&_0x2e9fea[_0xb4f5('0x1d')]){_0x444cf9[_0x2e9fea[_0xb4f5('0x1d')]]=_0x411832['id'];}else{logger[_0xb4f5('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2b8821[_0xb4f5('0x1f')](_0x2e9fea[_0xb4f5('0x10')])['create'](_0x444cf9);}function getUser(_0x24139b,_0xdc7a1,_0xb9fcf6){if(!_[_0xb4f5('0x20')](_0xdc7a1)&&intUtil[_0xb4f5('0x21')](_0xdc7a1)){var _0x131926={'Email':_0xdc7a1};var _0x385bad={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xb9fcf6['sobject']('User')['find'](_0x131926,_0x385bad)[_0xb4f5('0x22')]()['then'](function(_0x3de158){if(_0x3de158[_0xb4f5('0x23')]){var _0x582c6f=_[_0xb4f5('0x24')](_0x3de158,function(_0x18428f){return _0x18428f[_0xb4f5('0x25')]===_0xdc7a1;});if(_0x582c6f){logger['info'](_0xb4f5('0x26'),_0xdc7a1);return BPromise[_0xb4f5('0x27')]({'id':_0x582c6f['Id'],'name':_0x582c6f['Name']});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xdc7a1);return _0xb9fcf6[_0xb4f5('0x28')]()[_0xb4f5('0x29')](function(_0x412cee){return BPromise['resolve']({'id':_0x412cee[_0xb4f5('0x2a')],'name':_0x412cee[_0xb4f5('0x2b')]});});}});}else{logger[_0xb4f5('0x1e')](_0xb4f5('0x2c'),_0xdc7a1);return _0xb9fcf6[_0xb4f5('0x28')]()[_0xb4f5('0x29')](function(_0x2db8ba){return BPromise[_0xb4f5('0x27')]({'id':_0x2db8ba[_0xb4f5('0x2a')],'name':_0x2db8ba['display_name']});});}}function getEndUser(_0x3d2a34,_0x15f9a9,_0x53eb44,_0x2d4828,_0x2febc8){var _0x4189dc={'$or':{'Phone':_0x2d4828}};var _0x243a21={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb4f5('0x27')]()['then'](function(){logger[_0xb4f5('0x1e')](_0xb4f5('0x2d'),_0x2d4828,_0x15f9a9[_0xb4f5('0x2e')]);switch(_0x15f9a9[_0xb4f5('0x2e')]){case _0xb4f5('0x2f'):var _0x8da1fe=_['cloneDeep'](_0x4189dc);if(_0x15f9a9[_0xb4f5('0x30')]){var _0x26fb3e={};_0x26fb3e[_0x15f9a9['additionalSearchContact']]=_0x2d4828;_[_0xb4f5('0x31')](_0x8da1fe[_0xb4f5('0x32')],_0x26fb3e);}return _0x2febc8[_0xb4f5('0x1f')](_0xb4f5('0x33'))[_0xb4f5('0x24')](_0x8da1fe,_0x243a21)[_0xb4f5('0x22')]()[_0xb4f5('0x29')](function(_0x40576a){if(_0x40576a&&_0x40576a[_0xb4f5('0x23')]){return _0x40576a;}else{var _0x42b40a=_[_0xb4f5('0x34')](_0x4189dc);if(_0x15f9a9[_0xb4f5('0x35')]){var _0x3f3d14={};_0x3f3d14[_0x15f9a9['additionalSearchLead']]=_0x2d4828;_['merge'](_0x42b40a['$or'],_0x3f3d14);}return _0x2febc8['sobject'](_0xb4f5('0x36'))[_0xb4f5('0x24')](_0x42b40a,_0x243a21);}});case _0xb4f5('0x37'):var _0x37cfd2=_['cloneDeep'](_0x4189dc);if(_0x15f9a9[_0xb4f5('0x38')]){var _0x26fb3e={};_0x26fb3e[_0x15f9a9[_0xb4f5('0x38')]]=_0x2d4828;_[_0xb4f5('0x31')](_0x37cfd2['$or'],_0x26fb3e);}return _0x2febc8[_0xb4f5('0x1f')]('Account')[_0xb4f5('0x24')](_0x37cfd2,_0x243a21)[_0xb4f5('0x22')]()['then'](function(_0x12de7f){if(_0x12de7f&&_0x12de7f[_0xb4f5('0x23')]){return _0x12de7f;}else{var _0x2fce1c=_[_0xb4f5('0x34')](_0x4189dc);if(_0x15f9a9[_0xb4f5('0x30')]){var _0x31688c={};_0x31688c[_0x15f9a9['additionalSearchContact']]=_0x2d4828;_[_0xb4f5('0x31')](_0x2fce1c[_0xb4f5('0x32')],_0x31688c);}return _0x2febc8[_0xb4f5('0x1f')](_0xb4f5('0x33'))[_0xb4f5('0x24')](_0x2fce1c,_0x243a21)[_0xb4f5('0x29')](function(_0x85a7cf){if(_0x85a7cf&&_0x85a7cf['length']){return _0x85a7cf;}else{var _0x2f49f4=_['cloneDeep'](_0x4189dc);if(_0x15f9a9[_0xb4f5('0x35')]){var _0x13abaf={};_0x13abaf[_0x15f9a9[_0xb4f5('0x35')]]=_0x2d4828;_[_0xb4f5('0x31')](_0x2f49f4['$or'],_0x13abaf);}return _0x2febc8[_0xb4f5('0x1f')](_0xb4f5('0x36'))[_0xb4f5('0x24')](_0x2f49f4,_0x243a21);}});}});case _0xb4f5('0x19'):var _0x8da1fe=_[_0xb4f5('0x34')](_0x4189dc);if(_0x15f9a9[_0xb4f5('0x30')]){var _0x26fb3e={};_0x26fb3e[_0x15f9a9[_0xb4f5('0x30')]]=_0x2d4828;_[_0xb4f5('0x31')](_0x8da1fe[_0xb4f5('0x32')],_0x26fb3e);}return _0x2febc8[_0xb4f5('0x1f')](_0xb4f5('0x33'))[_0xb4f5('0x24')](_0x8da1fe,_0x243a21)[_0xb4f5('0x22')]();case _0xb4f5('0x1c'):var _0x57c836=_['cloneDeep'](_0x4189dc);if(_0x15f9a9['additionalSearchLead']){var _0x26fb3e={};_0x26fb3e[_0x15f9a9['additionalSearchLead']]=_0x2d4828;_['merge'](_0x57c836[_0xb4f5('0x32')],_0x26fb3e);}return _0x2febc8[_0xb4f5('0x1f')](_0xb4f5('0x36'))[_0xb4f5('0x24')](_0x57c836,_0x243a21);case _0xb4f5('0x16'):var _0x37cfd2=_[_0xb4f5('0x34')](_0x4189dc);if(_0x15f9a9[_0xb4f5('0x38')]){var _0x26fb3e={};_0x26fb3e[_0x15f9a9[_0xb4f5('0x38')]]=_0x2d4828;_[_0xb4f5('0x31')](_0x37cfd2[_0xb4f5('0x32')],_0x26fb3e);}return _0x2febc8[_0xb4f5('0x1f')](_0xb4f5('0x39'))['find'](_0x37cfd2,_0x243a21);default:return null;}})[_0xb4f5('0x29')](function(_0x390705){if(_0x390705&&_0x390705[_0xb4f5('0x23')]){var _0x136da1=_[_0xb4f5('0x3a')](_0x390705);if(_0x136da1){return BPromise[_0xb4f5('0x27')]({'id':_0x136da1['Id'],'name':_0x136da1[_0xb4f5('0x3b')],'phone':_0x136da1[_0xb4f5('0x3c')],'endUserType':_0x136da1[_0xb4f5('0x3d')]['type'][_0xb4f5('0x3e')]()});}}})['then'](function(_0xef4690){if(_0xef4690){logger[_0xb4f5('0x1e')](_0xb4f5('0x3f'),_0xef4690[_0xb4f5('0x14')],_0x2d4828);return BPromise[_0xb4f5('0x27')](_0xef4690);}else{logger['info'](_0xb4f5('0x40'),_0x2d4828);var _0x2ddc94={'Phone':_0x2d4828};if(_0x15f9a9['moduleCreate']){if(_0x15f9a9['moduleCreate']==='contact'){logger[_0xb4f5('0x1e')](_0xb4f5('0x41'),_0x2d4828,_0x15f9a9[_0xb4f5('0x42')]);_0x2ddc94['LastName']=_0x53eb44!==_0xb4f5('0x43')?_0x53eb44:util[_0xb4f5('0x44')]('Caller\x20-\x20%s',_0x2d4828);}else if(_0x15f9a9[_0xb4f5('0x42')]==='lead'){logger[_0xb4f5('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2d4828,_0x15f9a9[_0xb4f5('0x42')]);_0x2ddc94[_0xb4f5('0x45')]=_0x53eb44!==_0xb4f5('0x43')?_0x53eb44:util[_0xb4f5('0x44')]('Caller\x20-\x20%s',_0x2d4828);_0x2ddc94[_0xb4f5('0x46')]=_0xb4f5('0x47');}else if(_0x15f9a9[_0xb4f5('0x42')]===_0xb4f5('0x16')){logger[_0xb4f5('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2d4828,_0x15f9a9['moduleCreate']);_0x2ddc94['Name']=_0x53eb44!==''?_0x53eb44:util[_0xb4f5('0x44')]('Caller\x20-\x20%s',_0x2d4828);}else{return null;}}return _0x2febc8[_0xb4f5('0x1f')](_[_0xb4f5('0x48')](_0x15f9a9[_0xb4f5('0x42')]))[_0xb4f5('0x49')](_0x2ddc94)[_0xb4f5('0x29')](function(_0x32bd3c){return BPromise[_0xb4f5('0x27')]({'id':_0x32bd3c['id'],'endUserType':_0x15f9a9['moduleCreate']});});}});}function getCustomFields(_0xce1311,_0x202354){var _0x18aef2={};if(_0xce1311[_0xb4f5('0x23')]>0x0){_[_0xb4f5('0x4a')](_0xce1311,function(_0x5ca31c){if(_[_0xb4f5('0x4b')]([_0xb4f5('0x4c'),_0xb4f5('0x4d')],_0x5ca31c[_0xb4f5('0x4e')])&&_0x5ca31c['idField']){_0x18aef2[_0x5ca31c[_0xb4f5('0x4f')]]=_0x5ca31c['content']['toString']();}else if(_0x5ca31c['type']===_0xb4f5('0x50')&&_0x5ca31c[_0xb4f5('0x51')]&&_0x5ca31c[_0xb4f5('0x4f')]){_0x202354[_0x5ca31c['variableName']]&&(_0x18aef2[_0x5ca31c[_0xb4f5('0x4f')]]=_0x202354[_0x5ca31c[_0xb4f5('0x51')]][_0xb4f5('0x52')]());}else if(_0x5ca31c['type']==='customVariable'&&_0x5ca31c[_0xb4f5('0x53')]&&_0x5ca31c[_0xb4f5('0x53')][_0xb4f5('0x54')]&&_0x5ca31c[_0xb4f5('0x4f')]){_0x202354[_0x5ca31c[_0xb4f5('0x53')][_0xb4f5('0x54')][_0xb4f5('0x3e')]()]&&(_0x18aef2[_0x5ca31c[_0xb4f5('0x4f')]]=_0x202354[_0x5ca31c['Variable'][_0xb4f5('0x54')][_0xb4f5('0x3e')]()][_0xb4f5('0x52')]());}});}return _0x18aef2;}function getConnection(_0x4c8602){var _0x5f15e9=_0x4c8602[_0xb4f5('0x55')]['concat'](_0x4c8602['securityToken']);var _0x362cde=new jsforce[(_0xb4f5('0x56'))]({'oauth2':{'loginUrl':_0x4c8602['remoteUri']||_0xb4f5('0x57'),'clientId':_0x4c8602[_0xb4f5('0x58')],'clientSecret':_0x4c8602[_0xb4f5('0x59')]}});return _0x362cde[_0xb4f5('0x5a')](_0x4c8602[_0xb4f5('0x5b')],_0x5f15e9)[_0xb4f5('0x29')](function(){logger[_0xb4f5('0x1e')](_0xb4f5('0x5c'));return _0x362cde;});}exports[_0xb4f5('0x5d')]=function(_0x36d410,_0x3c7b4c,_0x4c6e61,_0x49037e,_0x36572e,_0x2a0483){var _0x4934be,_0x118821,_0x258a4b,_0x5d6c91;_0x2a0483[_0xb4f5('0x5e')]=intUtil[_0xb4f5('0x5f')](_0x2a0483[_0xb4f5('0x5e')]);_0x2a0483[_0xb4f5('0x60')]=intUtil['stripTrailingSlash'](_0x2a0483['remoteUri']);if(_0x36572e&&_0x36572e[_0xb4f5('0x61')]){logger[_0xb4f5('0x1e')](_0xb4f5('0x62'),'Recording\x20is\x20enabled!');_0x3c7b4c[_0xb4f5('0x63')]=util[_0xb4f5('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a0483[_0xb4f5('0x5e')],_0x3c7b4c[_0xb4f5('0x64')],md5(_0x3c7b4c[_0xb4f5('0x64')]));}else{_0x3c7b4c['recordingURL']='';}return getConnection(_0x2a0483)['then'](function(_0x561310){_0x5d6c91=_0x561310;return getUser(_0x2a0483,_0x49037e[_0xb4f5('0x65')],_0x5d6c91);})[_0xb4f5('0x29')](function(_0x54f1e2){_0x4934be=_0x54f1e2;return getEndUser(_0x2a0483,_0x4c6e61,_0x3c7b4c['calleridname'],_0x3c7b4c[_0xb4f5('0x66')],_0x5d6c91);})[_0xb4f5('0x29')](function(_0xc2b1e4){_0x118821=_0xc2b1e4;return getTicket(_0x2a0483,_0x4934be,_0x118821,_0x4c6e61,_0x3c7b4c,_0x4c6e61[_0xb4f5('0x67')],_0x5d6c91,_0xb4f5('0x5d'));})[_0xb4f5('0x29')](function(_0x114ab4){_0x258a4b=_0x114ab4;logger['info'](_0xb4f5('0x68'),_0x258a4b['id']);logger[_0xb4f5('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x258a4b['id'],_0x49037e['name'],_0x2a0483[_0xb4f5('0x4e')]);switch(_0x2a0483['type']){case _0xb4f5('0x69'):emit(util[_0xb4f5('0x44')](_0xb4f5('0x6a'),_0x49037e[_0xb4f5('0x54')]),_0xb4f5('0x6b'),{'recordId':_0x258a4b['id']});break;case _0xb4f5('0x6c'):emit(util[_0xb4f5('0x44')](_0xb4f5('0x6a'),_0x49037e['name']),_0xb4f5('0x6d'),{'uri':util['format'](_0xb4f5('0x6e'),_0x5d6c91['instanceUrl'],_0x258a4b['id'])});break;default:logger[_0xb4f5('0x6f')](_0xb4f5('0x70'));}})[_0xb4f5('0x71')](function(_0x359576){logger[_0xb4f5('0x6f')](_0xb4f5('0x62'),_0x359576);});};exports[_0xb4f5('0x72')]=function(_0x59696a,_0x22c286,_0x563362,_0x183051,_0x565729,_0x39b335,_0x184936){var _0x382d4d,_0x201b88,_0x287260,_0x7d7b44;_0x39b335['serverUrl']=intUtil['stripTrailingSlash'](_0x39b335['serverUrl']);_0x39b335[_0xb4f5('0x60')]=intUtil['stripTrailingSlash'](_0x39b335[_0xb4f5('0x60')]);if(_0x184936&&_0x184936[_0xb4f5('0x73')]&&_0x184936[_0xb4f5('0x73')]!==_0xb4f5('0x74')){logger[_0xb4f5('0x1e')]('[OUTBOUND]',_0xb4f5('0x75'));_0x22c286[_0xb4f5('0x63')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39b335[_0xb4f5('0x5e')],_0x22c286[_0xb4f5('0x64')],md5(_0x22c286[_0xb4f5('0x64')]));}return getConnection(_0x39b335)[_0xb4f5('0x29')](function(_0x1e5b7f){_0x7d7b44=_0x1e5b7f;return getUser(_0x39b335,_0x183051['email'],_0x7d7b44);})[_0xb4f5('0x29')](function(_0x21899b){_0x382d4d=_0x21899b;return getEndUser(_0x39b335,_0x563362,_0x22c286[_0xb4f5('0x76')],_0x22c286[_0xb4f5('0x77')],_0x7d7b44);})['then'](function(_0x595244){_0x201b88=_0x595244;return getTicket(_0x39b335,_0x382d4d,_0x201b88,_0x563362,_0x22c286,_0x563362[_0xb4f5('0x67')],_0x7d7b44,_0xb4f5('0x72'));})['then'](function(_0x3a2e6b){_0x287260=_0x3a2e6b;logger[_0xb4f5('0x1e')](_0xb4f5('0x78'),_0x287260['id']);logger['info'](_0xb4f5('0x79'),_0x287260['id'],_0x183051[_0xb4f5('0x54')],_0x39b335[_0xb4f5('0x4e')]);switch(_0x39b335[_0xb4f5('0x4e')]){case _0xb4f5('0x69'):emit(util['format'](_0xb4f5('0x6a'),_0x183051['name']),_0xb4f5('0x6b'),{'recordId':_0x287260['id']});break;case _0xb4f5('0x6c'):emit(util[_0xb4f5('0x44')]('user:%s',_0x183051[_0xb4f5('0x54')]),'trigger:browser:url',{'uri':util[_0xb4f5('0x44')](_0xb4f5('0x6e'),_0x7d7b44[_0xb4f5('0x7a')],_0x287260['id'])});break;default:logger[_0xb4f5('0x6f')]('[OUTBOUND]',_0xb4f5('0x7b'));}})['catch'](function(_0x2a6f38){logger['error'](_0xb4f5('0x7c'),_0x2a6f38);});};exports[_0xb4f5('0x7d')]=function(_0x51985c,_0x46c177,_0x3ec3c9,_0x55c794,_0x3174a7,_0x10cb50){var _0x3cad43,_0x396679,_0x8a4ea1,_0x1fcb32;_0x10cb50[_0xb4f5('0x5e')]=intUtil[_0xb4f5('0x5f')](_0x10cb50[_0xb4f5('0x5e')]);_0x10cb50[_0xb4f5('0x60')]=intUtil[_0xb4f5('0x5f')](_0x10cb50[_0xb4f5('0x60')]);if(_0x3174a7&&_0x3174a7['monitor_format']){logger[_0xb4f5('0x1e')]('['+_0x46c177[_0xb4f5('0x7e')]['toUpperCase']()+']',_0xb4f5('0x75'));_0x46c177[_0xb4f5('0x63')]=util[_0xb4f5('0x44')](_0xb4f5('0x7f'),_0x10cb50[_0xb4f5('0x5e')],_0x46c177[_0xb4f5('0x64')],md5(_0x46c177[_0xb4f5('0x64')]));}else{_0x46c177[_0xb4f5('0x63')]='';}return getConnection(_0x10cb50)[_0xb4f5('0x29')](function(_0x5e35a6){_0x1fcb32=_0x5e35a6;if(!_['isNil'](_0x55c794)){return getUser(_0x10cb50,_0x55c794[_0xb4f5('0x54')],_0x1fcb32);}else{return getUser(_0x10cb50,null,_0x1fcb32);}})['then'](function(_0x2feeb4){_0x3cad43=_0x2feeb4;return getEndUser(_0x10cb50,_0x3ec3c9,_0x46c177[_0xb4f5('0x80')],_0x46c177[_0xb4f5('0x66')],_0x1fcb32);})[_0xb4f5('0x29')](function(_0x4cf02c){_0x396679=_0x4cf02c;return getTicket(_0x10cb50,_0x3cad43,_0x396679,_0x3ec3c9,_0x46c177,_0x3ec3c9[_0xb4f5('0x67')],_0x1fcb32);})[_0xb4f5('0x29')](function(_0x56ef8e){_0x8a4ea1=_0x56ef8e;logger[_0xb4f5('0x1e')]('['+_0x46c177[_0xb4f5('0x7e')]['toUpperCase']()+_0xb4f5('0x81'),_0x8a4ea1['id']);logger[_0xb4f5('0x1e')]('['+_0x46c177[_0xb4f5('0x7e')][_0xb4f5('0x82')]()+_0xb4f5('0x83'),_0x10cb50[_0xb4f5('0x4e')]);})[_0xb4f5('0x71')](function(_0x24a8a5){logger[_0xb4f5('0x6f')]('['+_0x46c177[_0xb4f5('0x7e')][_0xb4f5('0x82')]()+']',_0x24a8a5);});}; \ No newline at end of file +var _0xa98c=['integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','lastevent','toUpperCase','Recording\x20is\x20enabled!',']\x20Ticket\x20%s\x20created.','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','account','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','sobject','find','execute','length','Email','resolve','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','string','picklist','idField','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','recordingURL','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0xb1ab75,_0x4b8d9f){var _0x1ed9cc=function(_0x303656){while(--_0x303656){_0xb1ab75['push'](_0xb1ab75['shift']());}};_0x1ed9cc(++_0x4b8d9f);}(_0xa98c,0x94));var _0xca98=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xa98c[_0x239dba];return _0x1ceb11;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xca98('0x0'));var BPromise=require(_0xca98('0x1'));var md5=require(_0xca98('0x2'));var jsforce=require(_0xca98('0x3'));var util=require(_0xca98('0x4'));var Redis=require('ioredis');var intUtil=require(_0xca98('0x5'));var config=require(_0xca98('0x6'));var logger=require(_0xca98('0x7'))(_0xca98('0x8'));config[_0xca98('0x9')]=_['defaults'](config[_0xca98('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x53926d,_0x234981,_0x17478b){io['to'](_0x53926d)[_0xca98('0xa')](_0x234981,_0x17478b);}function getTicket(_0x397901,_0xc1eb06,_0x125509,_0x52baed,_0x5df787,_0x2e03ef,_0x3d3185,_0x4d45de){var _0x325fb8=Object[_0xca98('0xb')]({},{'OwnerId':_0xc1eb06['id'],'Subject':intUtil[_0xca98('0xc')](_0x52baed[_0xca98('0xd')],_0x5df787,'\x20'),'Description':intUtil[_0xca98('0xc')](_0x52baed[_0xca98('0xe')],_0x5df787,'\x0a')},getCustomFields(_0x2e03ef,_0x5df787));if(_0x125509){if(_0x52baed[_0xca98('0xf')]===_0xca98('0x10')){_0x325fb8[_0xca98('0x11')]=moment[_0xca98('0x12')]();_0x325fb8[_0xca98('0x13')]=![];_0x325fb8[_0xca98('0x14')]=![];if(_0x125509[_0xca98('0x15')]===_0xca98('0x16')||_0x125509[_0xca98('0x15')]===_0xca98('0x17')){_0x325fb8[_0xca98('0x18')]=_0x125509['id'];}else if(_0x125509[_0xca98('0x15')]==='account'){_0x325fb8[_0xca98('0x19')]=_0x125509['id'];}}else if(_0x52baed['ticketType']===_0xca98('0x1a')){if(_0x125509[_0xca98('0x15')]==='contact'){_0x325fb8[_0xca98('0x1b')]=_0x125509['id'];}else if(_0x125509[_0xca98('0x15')]===_0xca98('0x1c')){_0x325fb8['AccountId']=_0x125509['id'];}else if(_0x125509[_0xca98('0x15')]===_0xca98('0x17')&&_0x52baed[_0xca98('0x1d')]){_0x325fb8[_0x52baed[_0xca98('0x1d')]]=_0x125509['id'];}else{logger[_0xca98('0x1e')](_0xca98('0x1f'));}}}return _0x3d3185['sobject'](_0x52baed[_0xca98('0xf')])[_0xca98('0x20')](_0x325fb8);}function getUser(_0xade712,_0x2fb2f2,_0x5a5b1d){if(!_[_0xca98('0x21')](_0x2fb2f2)&&intUtil['validateEmail'](_0x2fb2f2)){var _0x1b2494={'Email':_0x2fb2f2};var _0x3a0f71={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5a5b1d[_0xca98('0x22')]('User')[_0xca98('0x23')](_0x1b2494,_0x3a0f71)[_0xca98('0x24')]()['then'](function(_0x41e085){if(_0x41e085[_0xca98('0x25')]){var _0x539b28=_[_0xca98('0x23')](_0x41e085,function(_0x575c97){return _0x575c97[_0xca98('0x26')]===_0x2fb2f2;});if(_0x539b28){logger[_0xca98('0x1e')]('Agent\x20%s\x20found.',_0x2fb2f2);return BPromise[_0xca98('0x27')]({'id':_0x539b28['Id'],'name':_0x539b28['Name']});}}else{logger[_0xca98('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2fb2f2);return _0x5a5b1d[_0xca98('0x28')]()[_0xca98('0x29')](function(_0x5cea17){return BPromise['resolve']({'id':_0x5cea17[_0xca98('0x2a')],'name':_0x5cea17[_0xca98('0x2b')]});});}});}else{logger[_0xca98('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2fb2f2);return _0x5a5b1d[_0xca98('0x28')]()[_0xca98('0x29')](function(_0x1c58a5){return BPromise[_0xca98('0x27')]({'id':_0x1c58a5[_0xca98('0x2a')],'name':_0x1c58a5[_0xca98('0x2b')]});});}}function getEndUser(_0x5697f3,_0x27ff6a,_0x27d6cd,_0x355c0b,_0x50ffc1){var _0x1beb64={'$or':{'Phone':_0x355c0b}};var _0x2da557={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xca98('0x27')]()[_0xca98('0x29')](function(){logger[_0xca98('0x1e')](_0xca98('0x2c'),_0x355c0b,_0x27ff6a['moduleSearch']);switch(_0x27ff6a[_0xca98('0x2d')]){case'contact_lead':var _0x4c83a7=_['cloneDeep'](_0x1beb64);if(_0x27ff6a[_0xca98('0x2e')]){var _0x309696={};_0x309696[_0x27ff6a[_0xca98('0x2e')]]=_0x355c0b;_[_0xca98('0x2f')](_0x4c83a7[_0xca98('0x30')],_0x309696);}return _0x50ffc1[_0xca98('0x22')](_0xca98('0x31'))[_0xca98('0x23')](_0x4c83a7,_0x2da557)[_0xca98('0x24')]()['then'](function(_0x2f1a07){if(_0x2f1a07&&_0x2f1a07['length']){return _0x2f1a07;}else{var _0x1dbe8e=_[_0xca98('0x32')](_0x1beb64);if(_0x27ff6a[_0xca98('0x33')]){var _0x30b2e8={};_0x30b2e8[_0x27ff6a['additionalSearchLead']]=_0x355c0b;_['merge'](_0x1dbe8e[_0xca98('0x30')],_0x30b2e8);}return _0x50ffc1['sobject'](_0xca98('0x34'))[_0xca98('0x23')](_0x1dbe8e,_0x2da557);}});case _0xca98('0x35'):var _0x5c1313=_[_0xca98('0x32')](_0x1beb64);if(_0x27ff6a['additionalSearchAccount']){var _0x309696={};_0x309696[_0x27ff6a[_0xca98('0x36')]]=_0x355c0b;_[_0xca98('0x2f')](_0x5c1313[_0xca98('0x30')],_0x309696);}return _0x50ffc1[_0xca98('0x22')](_0xca98('0x37'))[_0xca98('0x23')](_0x5c1313,_0x2da557)[_0xca98('0x24')]()[_0xca98('0x29')](function(_0x2f078e){if(_0x2f078e&&_0x2f078e[_0xca98('0x25')]){return _0x2f078e;}else{var _0x36e04f=_[_0xca98('0x32')](_0x1beb64);if(_0x27ff6a[_0xca98('0x2e')]){var _0x4db172={};_0x4db172[_0x27ff6a[_0xca98('0x2e')]]=_0x355c0b;_[_0xca98('0x2f')](_0x36e04f[_0xca98('0x30')],_0x4db172);}return _0x50ffc1[_0xca98('0x22')]('Contact')[_0xca98('0x23')](_0x36e04f,_0x2da557)[_0xca98('0x29')](function(_0x378528){if(_0x378528&&_0x378528[_0xca98('0x25')]){return _0x378528;}else{var _0x3996ae=_[_0xca98('0x32')](_0x1beb64);if(_0x27ff6a['additionalSearchLead']){var _0x512e4d={};_0x512e4d[_0x27ff6a['additionalSearchLead']]=_0x355c0b;_[_0xca98('0x2f')](_0x3996ae[_0xca98('0x30')],_0x512e4d);}return _0x50ffc1['sobject'](_0xca98('0x34'))[_0xca98('0x23')](_0x3996ae,_0x2da557);}});}});case'contact':var _0x4c83a7=_[_0xca98('0x32')](_0x1beb64);if(_0x27ff6a[_0xca98('0x2e')]){var _0x309696={};_0x309696[_0x27ff6a[_0xca98('0x2e')]]=_0x355c0b;_[_0xca98('0x2f')](_0x4c83a7[_0xca98('0x30')],_0x309696);}return _0x50ffc1[_0xca98('0x22')](_0xca98('0x31'))[_0xca98('0x23')](_0x4c83a7,_0x2da557)[_0xca98('0x24')]();case _0xca98('0x17'):var _0x921b29=_[_0xca98('0x32')](_0x1beb64);if(_0x27ff6a['additionalSearchLead']){var _0x309696={};_0x309696[_0x27ff6a[_0xca98('0x33')]]=_0x355c0b;_[_0xca98('0x2f')](_0x921b29[_0xca98('0x30')],_0x309696);}return _0x50ffc1['sobject'](_0xca98('0x34'))[_0xca98('0x23')](_0x921b29,_0x2da557);case _0xca98('0x1c'):var _0x5c1313=_[_0xca98('0x32')](_0x1beb64);if(_0x27ff6a[_0xca98('0x36')]){var _0x309696={};_0x309696[_0x27ff6a['additionalSearchAccount']]=_0x355c0b;_[_0xca98('0x2f')](_0x5c1313[_0xca98('0x30')],_0x309696);}return _0x50ffc1[_0xca98('0x22')](_0xca98('0x37'))['find'](_0x5c1313,_0x2da557);default:return null;}})[_0xca98('0x29')](function(_0x2638e6){if(_0x2638e6&&_0x2638e6['length']){var _0xe5e995=_[_0xca98('0x38')](_0x2638e6);if(_0xe5e995){return BPromise[_0xca98('0x27')]({'id':_0xe5e995['Id'],'name':_0xe5e995[_0xca98('0x39')],'phone':_0xe5e995[_0xca98('0x3a')],'endUserType':_0xe5e995[_0xca98('0x3b')][_0xca98('0x3c')][_0xca98('0x3d')]()});}}})[_0xca98('0x29')](function(_0x35bdb3){if(_0x35bdb3){logger[_0xca98('0x1e')](_0xca98('0x3e'),_0x35bdb3[_0xca98('0x15')],_0x355c0b);return BPromise[_0xca98('0x27')](_0x35bdb3);}else{logger[_0xca98('0x1e')](_0xca98('0x3f'),_0x355c0b);var _0x1bbfc1={'Phone':_0x355c0b};if(_0x27ff6a[_0xca98('0x40')]){if(_0x27ff6a[_0xca98('0x40')]===_0xca98('0x16')){logger[_0xca98('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x355c0b,_0x27ff6a['moduleCreate']);_0x1bbfc1[_0xca98('0x41')]=_0x27d6cd!==_0xca98('0x42')?_0x27d6cd:util[_0xca98('0x43')]('Caller\x20-\x20%s',_0x355c0b);}else if(_0x27ff6a[_0xca98('0x40')]===_0xca98('0x17')){logger[_0xca98('0x1e')](_0xca98('0x44'),_0x355c0b,_0x27ff6a[_0xca98('0x40')]);_0x1bbfc1['LastName']=_0x27d6cd!==_0xca98('0x42')?_0x27d6cd:util['format'](_0xca98('0x45'),_0x355c0b);_0x1bbfc1[_0xca98('0x46')]=_0xca98('0x47');}else if(_0x27ff6a[_0xca98('0x40')]===_0xca98('0x1c')){logger[_0xca98('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x355c0b,_0x27ff6a[_0xca98('0x40')]);_0x1bbfc1[_0xca98('0x39')]=_0x27d6cd!==''?_0x27d6cd:util[_0xca98('0x43')](_0xca98('0x45'),_0x355c0b);}else{return null;}}return _0x50ffc1[_0xca98('0x22')](_[_0xca98('0x48')](_0x27ff6a[_0xca98('0x40')]))[_0xca98('0x20')](_0x1bbfc1)[_0xca98('0x29')](function(_0x5399aa){return BPromise['resolve']({'id':_0x5399aa['id'],'endUserType':_0x27ff6a[_0xca98('0x40')]});});}});}function getCustomFields(_0x56cf0d,_0x420035){var _0x5f3e48={};if(_0x56cf0d['length']>0x0){_['forEach'](_0x56cf0d,function(_0x4dbb18){if(_['includes']([_0xca98('0x49'),_0xca98('0x4a')],_0x4dbb18[_0xca98('0x3c')])&&_0x4dbb18['idField']){_0x5f3e48[_0x4dbb18[_0xca98('0x4b')]]=_0x4dbb18['content']['toString']();}else if(_0x4dbb18[_0xca98('0x3c')]===_0xca98('0x4c')&&_0x4dbb18[_0xca98('0x4d')]&&_0x4dbb18[_0xca98('0x4b')]){_0x420035[_0x4dbb18[_0xca98('0x4d')]]&&(_0x5f3e48[_0x4dbb18['idField']]=_0x420035[_0x4dbb18[_0xca98('0x4d')]]['toString']());}else if(_0x4dbb18['type']===_0xca98('0x4e')&&_0x4dbb18[_0xca98('0x4f')]&&_0x4dbb18['Variable'][_0xca98('0x50')]&&_0x4dbb18['idField']){_0x420035[_0x4dbb18['Variable'][_0xca98('0x50')][_0xca98('0x3d')]()]&&(_0x5f3e48[_0x4dbb18[_0xca98('0x4b')]]=_0x420035[_0x4dbb18[_0xca98('0x4f')][_0xca98('0x50')]['toLowerCase']()]['toString']());}});}return _0x5f3e48;}function getConnection(_0xeb7416){var _0x357b39=_0xeb7416[_0xca98('0x51')][_0xca98('0x52')](_0xeb7416['securityToken']);var _0x4688f1=new jsforce[(_0xca98('0x53'))]({'oauth2':{'loginUrl':_0xeb7416[_0xca98('0x54')]||_0xca98('0x55'),'clientId':_0xeb7416['clientId'],'clientSecret':_0xeb7416[_0xca98('0x56')]}});return _0x4688f1[_0xca98('0x57')](_0xeb7416['username'],_0x357b39)[_0xca98('0x29')](function(){logger[_0xca98('0x1e')](_0xca98('0x58'));return _0x4688f1;});}exports['queue']=function(_0x1a8240,_0xa6d2a7,_0x3498bd,_0x4ad31f,_0x433b51,_0x3183a6){var _0x42d45b,_0x324a42,_0x52bcc8,_0x3c6df5;_0x3183a6['serverUrl']=intUtil[_0xca98('0x59')](_0x3183a6[_0xca98('0x5a')]);_0x3183a6[_0xca98('0x54')]=intUtil[_0xca98('0x59')](_0x3183a6['remoteUri']);if(_0x433b51&&_0x433b51[_0xca98('0x5b')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0xa6d2a7[_0xca98('0x5c')]=util[_0xca98('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3183a6['serverUrl'],_0xa6d2a7[_0xca98('0x5d')],md5(_0xa6d2a7['uniqueid']));}else{_0xa6d2a7[_0xca98('0x5c')]='';}return getConnection(_0x3183a6)[_0xca98('0x29')](function(_0xaed067){_0x3c6df5=_0xaed067;return getUser(_0x3183a6,_0x4ad31f[_0xca98('0x5e')],_0x3c6df5);})[_0xca98('0x29')](function(_0x177b75){_0x42d45b=_0x177b75;return getEndUser(_0x3183a6,_0x3498bd,_0xa6d2a7[_0xca98('0x5f')],_0xa6d2a7[_0xca98('0x60')],_0x3c6df5);})[_0xca98('0x29')](function(_0x4d0885){_0x324a42=_0x4d0885;return getTicket(_0x3183a6,_0x42d45b,_0x324a42,_0x3498bd,_0xa6d2a7,_0x3498bd['Fields'],_0x3c6df5,'queue');})[_0xca98('0x29')](function(_0x426815){_0x52bcc8=_0x426815;logger[_0xca98('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x52bcc8['id']);logger[_0xca98('0x1e')](_0xca98('0x61'),_0x52bcc8['id'],_0x4ad31f['name'],_0x3183a6[_0xca98('0x3c')]);switch(_0x3183a6[_0xca98('0x3c')]){case _0xca98('0x62'):emit(util[_0xca98('0x43')](_0xca98('0x63'),_0x4ad31f[_0xca98('0x50')]),_0xca98('0x64'),{'recordId':_0x52bcc8['id']});break;case _0xca98('0x65'):emit(util['format']('user:%s',_0x4ad31f['name']),_0xca98('0x66'),{'uri':util[_0xca98('0x43')](_0xca98('0x67'),_0x3c6df5[_0xca98('0x68')],_0x52bcc8['id'])});break;default:logger[_0xca98('0x69')](_0xca98('0x6a'));}})[_0xca98('0x6b')](function(_0x231d95){logger['error'](_0xca98('0x6c'),_0x231d95);});};exports[_0xca98('0x6d')]=function(_0xc4b24e,_0x360876,_0x38c8d0,_0x3eec3e,_0x4a1fad,_0x19feb9,_0x91070d){var _0x240f5b,_0x404da6,_0x1c394b,_0x144439;_0x19feb9[_0xca98('0x5a')]=intUtil[_0xca98('0x59')](_0x19feb9[_0xca98('0x5a')]);_0x19feb9[_0xca98('0x54')]=intUtil[_0xca98('0x59')](_0x19feb9[_0xca98('0x54')]);if(_0x91070d&&_0x91070d[_0xca98('0x6e')]&&_0x91070d['recordingFormat']!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x360876[_0xca98('0x5c')]=util[_0xca98('0x43')](_0xca98('0x6f'),_0x19feb9['serverUrl'],_0x360876[_0xca98('0x5d')],md5(_0x360876[_0xca98('0x5d')]));}return getConnection(_0x19feb9)[_0xca98('0x29')](function(_0x3f32ac){_0x144439=_0x3f32ac;return getUser(_0x19feb9,_0x3eec3e[_0xca98('0x5e')],_0x144439);})[_0xca98('0x29')](function(_0x1eb3d3){_0x240f5b=_0x1eb3d3;return getEndUser(_0x19feb9,_0x38c8d0,_0x360876[_0xca98('0x70')],_0x360876[_0xca98('0x71')],_0x144439);})[_0xca98('0x29')](function(_0x1763b9){_0x404da6=_0x1763b9;return getTicket(_0x19feb9,_0x240f5b,_0x404da6,_0x38c8d0,_0x360876,_0x38c8d0[_0xca98('0x72')],_0x144439,_0xca98('0x6d'));})[_0xca98('0x29')](function(_0x412ddf){_0x1c394b=_0x412ddf;logger[_0xca98('0x1e')](_0xca98('0x73'),_0x1c394b['id']);logger[_0xca98('0x1e')](_0xca98('0x74'),_0x1c394b['id'],_0x3eec3e[_0xca98('0x50')],_0x19feb9[_0xca98('0x3c')]);switch(_0x19feb9[_0xca98('0x3c')]){case _0xca98('0x62'):emit(util[_0xca98('0x43')](_0xca98('0x63'),_0x3eec3e['name']),'trigger:salesforce:display',{'recordId':_0x1c394b['id']});break;case'newTab':emit(util['format']('user:%s',_0x3eec3e[_0xca98('0x50')]),_0xca98('0x66'),{'uri':util['format'](_0xca98('0x67'),_0x144439[_0xca98('0x68')],_0x1c394b['id'])});break;default:logger[_0xca98('0x69')]('[OUTBOUND]',_0xca98('0x75'));}})[_0xca98('0x6b')](function(_0x576812){logger[_0xca98('0x69')](_0xca98('0x76'),_0x576812);});};exports['unmanaged']=function(_0x3407c9,_0x312a14,_0x3e8c6c,_0x10e53e,_0x1c9c02,_0x5b8385){var _0x1beebf,_0x29592b,_0x3ec7a1,_0x6259b2;_0x5b8385[_0xca98('0x5a')]=intUtil[_0xca98('0x59')](_0x5b8385[_0xca98('0x5a')]);_0x5b8385[_0xca98('0x54')]=intUtil[_0xca98('0x59')](_0x5b8385[_0xca98('0x54')]);if(_0x1c9c02&&_0x1c9c02[_0xca98('0x5b')]){logger[_0xca98('0x1e')]('['+_0x312a14[_0xca98('0x77')][_0xca98('0x78')]()+']',_0xca98('0x79'));_0x312a14[_0xca98('0x5c')]=util[_0xca98('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b8385[_0xca98('0x5a')],_0x312a14[_0xca98('0x5d')],md5(_0x312a14[_0xca98('0x5d')]));}else{_0x312a14['recordingURL']='';}return getConnection(_0x5b8385)[_0xca98('0x29')](function(_0x4257c1){_0x6259b2=_0x4257c1;if(!_[_0xca98('0x21')](_0x10e53e)){return getUser(_0x5b8385,_0x10e53e['name'],_0x6259b2);}else{return getUser(_0x5b8385,null,_0x6259b2);}})['then'](function(_0x1ac55b){_0x1beebf=_0x1ac55b;return getEndUser(_0x5b8385,_0x3e8c6c,_0x312a14[_0xca98('0x5f')],_0x312a14[_0xca98('0x60')],_0x6259b2);})[_0xca98('0x29')](function(_0x52efc3){_0x29592b=_0x52efc3;return getTicket(_0x5b8385,_0x1beebf,_0x29592b,_0x3e8c6c,_0x312a14,_0x3e8c6c['Fields'],_0x6259b2);})[_0xca98('0x29')](function(_0x52c93f){_0x3ec7a1=_0x52c93f;logger[_0xca98('0x1e')]('['+_0x312a14[_0xca98('0x77')][_0xca98('0x78')]()+_0xca98('0x7a'),_0x3ec7a1['id']);logger['info']('['+_0x312a14[_0xca98('0x77')][_0xca98('0x78')]()+']\x20Integration\x20account\x20type\x20%s.',_0x5b8385[_0xca98('0x3c')]);})[_0xca98('0x6b')](function(_0x572345){logger[_0xca98('0x69')]('['+_0x312a14[_0xca98('0x77')][_0xca98('0x78')]()+']',_0x572345);});}; \ 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 40e0533..8b4f81d 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 _0x9fa2=['customField','toLowerCase','toString','picklist','type','idField','content','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','true','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','isNil','email','destcalleridnum','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','length','active','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','string'];(function(_0x4128dc,_0xf49703){var _0x3902ae=function(_0x358fc4){while(--_0x358fc4){_0x4128dc['push'](_0x4128dc['shift']());}};_0x3902ae(++_0xf49703);}(_0x9fa2,0x104));var _0x29fa=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x9fa2[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0x29fa('0x0'));var Promise=require(_0x29fa('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x29fa('0x2'));var Redis=require(_0x29fa('0x3'));var intUtil=require('./util');var config=require(_0x29fa('0x4'));var logger=require(_0x29fa('0x5'))(_0x29fa('0x6'));config[_0x29fa('0x7')]=_[_0x29fa('0x8')](config[_0x29fa('0x7')],{'host':_0x29fa('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x29b962,_0x2efcd9,_0x53d1cb,_0x3b0579,_0x46ae41,_0x52d1e1){return new Promise(function(_0x24382d,_0xd7fa53){var _0x24b7a4={'method':_0x29fa('0xa'),'uri':_0x3b0579+_0x29fa('0xb')+'&'+_0x46ae41+'&'+_0x52d1e1,'auth':_0x2efcd9,'json':!![]};return rp(_0x24b7a4)['then'](function(_0x19ffd2){if(_0x19ffd2[_0x29fa('0xc')]['length']>0x0){_0x53d1cb[_0x29fa('0xd')]=_0x19ffd2[_0x29fa('0xc')][0x0][_0x29fa('0xe')];}logger[_0x29fa('0xf')]('['+[_0x29b962[_0x29fa('0x10')]()]+'],\x20getAdminUser\x20crm',_0x53d1cb);_0x24382d(_0x53d1cb);})['catch'](function(_0x556e92){logger[_0x29fa('0x11')]('['+[_0x29b962['toUpperCase']()]+']',_0x556e92[_0x29fa('0x12')]);_0xd7fa53(_0x556e92[_0x29fa('0x12')]);});});}function getUser(_0x59fe63,_0x4e8082,_0x3551e2,_0x4462f7,_0x2a4d77){return function(_0x4d8d1a){logger['info']('['+[_0x59fe63['toUpperCase']()]+_0x29fa('0x13'),_0x4d8d1a);return new Promise(function(_0x246ef2,_0x2e806c){if(intUtil[_0x29fa('0x14')](_0x4d8d1a[_0x29fa('0x15')])){var _0xcb5796={'method':_0x29fa('0xa'),'uri':_0x3551e2+_0x29fa('0x16')+_0x4d8d1a[_0x29fa('0x15')]+'&'+_0x4462f7+'&'+_0x2a4d77,'auth':_0x4e8082,'json':!![]};logger[_0x29fa('0xf')]('['+[_0x59fe63[_0x29fa('0x10')]()]+_0x29fa('0x17'),_0xcb5796);return rp(_0xcb5796)[_0x29fa('0x18')](function(_0x1b1708){logger[_0x29fa('0xf')]('['+[_0x59fe63['toUpperCase']()]+_0x29fa('0x19'),_0x1b1708);if(_0x1b1708[_0x29fa('0xc')][_0x29fa('0x1a')]>0x0&&String(_0x1b1708[_0x29fa('0xc')][0x0][_0x29fa('0x1b')])==='true'){_0x4d8d1a[_0x29fa('0x1c')]=_0x1b1708['result'][0x0][_0x29fa('0xe')];}else{_0x4d8d1a[_0x29fa('0x1c')]=_0x4d8d1a[_0x29fa('0xd')];_0x4d8d1a['userEmail']=_0x4d8d1a['adminEmail'];}logger[_0x29fa('0xf')]('['+[_0x59fe63[_0x29fa('0x10')]()]+_0x29fa('0x1d'),_0x4d8d1a);_0x246ef2(_0x4d8d1a);})[_0x29fa('0x1e')](function(_0x255d07){logger[_0x29fa('0x11')]('['+[_0x59fe63[_0x29fa('0x10')]()]+']',_0x255d07[_0x29fa('0x12')]);_0x2e806c(_0x255d07[_0x29fa('0x12')]);});}else{logger[_0x29fa('0xf')]('['+[_0x59fe63[_0x29fa('0x10')]()]+_0x29fa('0x1f'));_0x4d8d1a[_0x29fa('0x1c')]=_0x4d8d1a[_0x29fa('0xd')];_0x4d8d1a[_0x29fa('0x15')]=_0x4d8d1a[_0x29fa('0x20')];_0x246ef2(_0x4d8d1a);}});};}function createEndUser(_0x3630ed,_0x364e12,_0x4ad13b,_0x2bd71c,_0x5968ea){logger[_0x29fa('0xf')]('['+[_0x3630ed['toUpperCase']()]+_0x29fa('0x21'),_0x4ad13b);return new Promise(function(_0x10b62b,_0x503945){var _0x5ca8f8={'method':_0x29fa('0x22'),'uri':_0x2bd71c+_0x29fa('0x23')+_0x5968ea,'body':{'user_name':_0x4ad13b[_0x29fa('0x24')],'roles':_0x29fa('0x25'),'first_name':_0x4ad13b[_0x29fa('0x24')],'active':'true','date_format':'System','phone':_0x4ad13b[_0x29fa('0x24')]},'auth':_0x364e12,'json':!![]};return rp(_0x5ca8f8)[_0x29fa('0x18')](function(_0x18171a){logger[_0x29fa('0xf')]('['+[_0x3630ed[_0x29fa('0x10')]()]+_0x29fa('0x26'),_0x18171a[_0x29fa('0xc')]);_0x4ad13b[_0x29fa('0x27')]=_0x18171a[_0x29fa('0xc')][_0x29fa('0xe')];_0x10b62b(_0x4ad13b);})[_0x29fa('0x1e')](function(_0x5a6ed8){logger[_0x29fa('0x11')]('['+[_0x3630ed[_0x29fa('0x10')]()]+']',_0x5a6ed8['message']);_0x503945(_0x5a6ed8[_0x29fa('0x12')]);});});}function getEndUser(_0x58b5c9,_0x3c54bc,_0x530900,_0x275aab,_0xf84f46){return function(_0x105d76){logger[_0x29fa('0xf')]('['+[_0x58b5c9['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x105d76);return new Promise(function(_0x34ddb2,_0x5b1591){var _0x2a210d={'method':_0x29fa('0xa'),'uri':_0x530900+_0x29fa('0x28')+_0x105d76[_0x29fa('0x24')]+'&'+_0x275aab+'&'+_0xf84f46,'auth':_0x3c54bc,'json':!![]};return rp(_0x2a210d)[_0x29fa('0x18')](function(_0x4e7a78){if(_0x4e7a78[_0x29fa('0xc')][_0x29fa('0x1a')]>0x0){_0x105d76[_0x29fa('0x27')]=_0x4e7a78[_0x29fa('0xc')][0x0][_0x29fa('0xe')];logger[_0x29fa('0xf')]('['+[_0x58b5c9[_0x29fa('0x10')]()]+'],\x20getEndUser\x20crm',_0x105d76);_0x34ddb2(_0x105d76);}else{return createEndUser(_0x58b5c9,_0x3c54bc,_0x105d76,_0x530900,_0x275aab)[_0x29fa('0x18')](function(_0x36ebed){logger[_0x29fa('0xf')]('['+[_0x58b5c9[_0x29fa('0x10')]()]+_0x29fa('0x29'),_0x36ebed);_0x34ddb2(_0x36ebed);});}})[_0x29fa('0x1e')](function(_0x4a0fe3){logger['error']('['+[_0x58b5c9[_0x29fa('0x10')]()]+']',_0x4a0fe3[_0x29fa('0x12')]);_0x5b1591(_0x4a0fe3[_0x29fa('0x12')]);});});};}function getCustomFields(_0x2ed9b8,_0x5a0ba4){var _0x2da941={};if(_0x2ed9b8['length']>0x0){_['forEach'](_0x2ed9b8,function(_0xf3dc31){if(_['includes']([_0x29fa('0x2a'),'picklist'],_0xf3dc31['type'])&&_0xf3dc31['nameField']&&!_0xf3dc31[_0x29fa('0x2b')]){_0x2da941[_0xf3dc31['nameField'][_0x29fa('0x2c')]()]=_0xf3dc31['content'][_0x29fa('0x2d')]();}else if(_['includes']([_0x29fa('0x2a'),_0x29fa('0x2e')],_0xf3dc31[_0x29fa('0x2f')])&&_0xf3dc31[_0x29fa('0x30')]&&_0xf3dc31[_0x29fa('0x2b')]){_0x2da941[_0xf3dc31[_0x29fa('0x30')][_0x29fa('0x2c')]()]=_0xf3dc31[_0x29fa('0x31')]['toString']();}else if(_0xf3dc31[_0x29fa('0x2f')]==='variable'&&_0xf3dc31[_0x29fa('0x32')]&&_0xf3dc31[_0x29fa('0x30')]&&_0xf3dc31['customField']){_0x2da941[_0xf3dc31[_0x29fa('0x30')][_0x29fa('0x2c')]()]=_0x5a0ba4[_0xf3dc31[_0x29fa('0x32')]]['toString']();}else if(_0xf3dc31[_0x29fa('0x2f')]==='customVariable'&&_0xf3dc31[_0x29fa('0x33')]&&_0xf3dc31[_0x29fa('0x33')][_0x29fa('0x34')]&&_0xf3dc31[_0x29fa('0x30')]&&_0xf3dc31[_0x29fa('0x2b')]){_0x2da941[_0xf3dc31[_0x29fa('0x30')]['toLowerCase']()]=_0x5a0ba4[_0xf3dc31[_0x29fa('0x33')][_0x29fa('0x34')][_0x29fa('0x2c')]()]['toString']();}});}return _0x2da941;}function getTicket(_0x509d73,_0x35851c,_0x109a11,_0x3812b7,_0x2000d9,_0x468ec9){return function(_0x27704d){logger[_0x29fa('0xf')]('['+[_0x509d73[_0x29fa('0x10')]()]+_0x29fa('0x35'),_0x27704d);return new Promise(function(_0x63b0e5,_0x5a7ebf){var _0x2f988a=_0x509d73[_0x29fa('0x2c')]()===_0x29fa('0x36')?_0x27704d['userId']:_0x27704d['endUserId'];var _0x5d348c={'method':_0x29fa('0x22'),'uri':_0x109a11+_0x29fa('0x37')+'?'+_0x468ec9,'body':Object[_0x29fa('0x38')]({},{'active':_0x29fa('0x39'),'caller_id':_0x2f988a,'assigned_to':_0x27704d[_0x29fa('0x1c')],'short_description':intUtil['getString'](_0x3812b7[_0x29fa('0x3a')],_0x2000d9,'\x20'),'description':intUtil[_0x29fa('0x3b')](_0x3812b7[_0x29fa('0x3c')],_0x2000d9,'\x0a')},getCustomFields(_0x3812b7[_0x29fa('0x3d')],_0x2000d9)),'auth':_0x35851c,'json':!![]};return rp(_0x5d348c)[_0x29fa('0x18')](function(_0x53c61){logger[_0x29fa('0xf')]('['+[_0x509d73[_0x29fa('0x10')]()]+_0x29fa('0x3e'),_0x53c61[_0x29fa('0xc')]);_0x27704d[_0x29fa('0x3f')]=_0x53c61[_0x29fa('0xc')][_0x29fa('0xe')];_0x27704d[_0x29fa('0x40')]=_0x53c61[_0x29fa('0xc')]['number'];logger[_0x29fa('0xf')]('['+[_0x509d73['toUpperCase']()]+_0x29fa('0x41'),_0x27704d);_0x63b0e5(_0x27704d);})['catch'](function(_0x55c726){logger[_0x29fa('0x11')]('['+[_0x509d73['toUpperCase']()]+']',_0x55c726['message']);_0x5a7ebf(_0x55c726[_0x29fa('0x12')]);});});};}function createRemoteTag(_0x14ce77,_0x16a004,_0x2c1ff6,_0x15006c){return new Promise(function(_0x1ed0a3,_0x21e9ed){var _0x51b2ab={'method':_0x29fa('0x22'),'uri':_0x2c1ff6+_0x29fa('0x42')+'?'+_0x15006c,'body':{'short_description':_0x14ce77,'global':!![],'active':!![],'name':_0x14ce77},'auth':_0x16a004,'json':!![]};return rp(_0x51b2ab)[_0x29fa('0x18')](function(_0x2d6859){var _0x1deb49=_0x2d6859[_0x29fa('0xc')][_0x29fa('0xe')];_0x1ed0a3(_0x1deb49);});});}function getRemoteTag(_0x6287a1,_0x2bc410,_0x28c9ec,_0xe3d8a4,_0x2145ab){return new Promise(function(_0x127b17,_0xc144a4){var _0x57170d={'method':_0x29fa('0xa'),'uri':_0x28c9ec+_0x29fa('0x42')+_0x29fa('0x43')+_0x6287a1+'&'+_0xe3d8a4,'auth':_0x2bc410,'json':!![]};return rp(_0x57170d)[_0x29fa('0x18')](function(_0x37be99){if(_0x37be99[_0x29fa('0xc')][_0x29fa('0x1a')]>0x0){var _0x292504=_0x37be99[_0x29fa('0xc')][0x0]['sys_id'];_0x127b17(_0x292504);}else{return createRemoteTag(_0x6287a1,_0x2bc410,_0x28c9ec,_0xe3d8a4)['then'](function(_0x4e14f0){_0x127b17(_0x4e14f0);});}});});}function assignTagToIncident(_0x29d3dc,_0x9769a2,_0x252441,_0x10785e,_0x537f41){return new Promise(function(_0x14b75a,_0x24429f){var _0x33f2de={'method':'POST','uri':_0x252441+'label_entry'+'?'+_0x537f41,'body':{'label':_0x29d3dc,'table':'incident','id_type':_0x29fa('0x44'),'table_key':_0x10785e['ticketId'],'title':_0x29fa('0x45')+_0x10785e['ticketNumber'],'id_display':_0x10785e[_0x29fa('0x40')]},'auth':_0x9769a2,'json':!![]};return rp(_0x33f2de)[_0x29fa('0x18')](function(_0x1a134e){_0x14b75a();})[_0x29fa('0x1e')](function(){_0x14b75a();});});}function manageTags(_0xa224f5,_0x2b4545,_0xac15d,_0x41d40e,_0x148803,_0x1961d7,_0x4e0a29){return new Promise(function(_0x10bcbe,_0x435568){var _0x109aac=[];_0x2b4545[_0x29fa('0x46')](function(_0xb1d4de){_0x109aac[_0x29fa('0x47')](getRemoteTag(_0xb1d4de,_0xac15d,_0x41d40e,_0x1961d7,_0x4e0a29));});return Promise[_0x29fa('0x48')](_0x109aac)[_0x29fa('0x18')](function(_0x278a33){if(_0x278a33[_0x29fa('0x1a')]){logger['info']('['+[_0xa224f5[_0x29fa('0x10')]()]+_0x29fa('0x49'),_0x278a33);var _0x4832e6=[];_0x278a33[_0x29fa('0x46')](function(_0xf0ec44){_0x4832e6[_0x29fa('0x47')](assignTagToIncident(_0xf0ec44,_0xac15d,_0x41d40e,_0x148803,_0x1961d7));});return Promise['all'](_0x4832e6)[_0x29fa('0x18')](function(){_0x10bcbe();})['catch'](function(){_0x10bcbe();});}else{_0x10bcbe();}});});}function getTags(_0x4494f6,_0x2eaec8,_0x1afc31,_0x2e999a,_0x8b0c1d,_0x378744){return function(_0x5d7db5){return new Promise(function(_0x405eaf,_0x1942fa){var _0x393e8c=[];var _0x2a5195=_0x2e999a['Tags'];if(_0x2a5195&&_0x2a5195[_0x29fa('0x1a')]>0x0){_0x393e8c=_['map'](_0x2a5195,_0x29fa('0x34'));}if(_0x393e8c['length']>0x0){return manageTags(_0x4494f6,_0x393e8c,_0x2eaec8,_0x1afc31,_0x5d7db5,_0x8b0c1d,_0x378744)[_0x29fa('0x18')](function(){_0x405eaf(_0x5d7db5);});}else{_0x405eaf(_0x5d7db5);}});};}function emit(_0x17ab3f,_0x8722dd,_0x233ad2){var _0x4953ca='%26sysparm_record_target%3Dincident'+_0x29fa('0x4a')+_0x29fa('0x4b')+'%255EORDERBYDESCnumber';var _0x20ed9b={'uri':_0x17ab3f+_0x29fa('0x4c')+_0x233ad2+_0x4953ca};io['to'](util[_0x29fa('0x4d')]('user:%s',_0x8722dd))['emit']('trigger:browser:url',_0x20ed9b);}exports['cs']=function(_0x322b06,_0x3c0194,_0x5803f3,_0x116169,_0x2b69db,_0x4e20c6,_0x3c265e,_0x3e8c9d){var _0x3e7118={};var _0x4c4711={'user':_0x4e20c6[_0x29fa('0x4e')],'pass':_0x4e20c6[_0x29fa('0x4f')]};var _0x4af79e=_0x29fa('0x50');var _0xfbef24=_0x29fa('0x51');_0x4e20c6['remoteUri']=intUtil[_0x29fa('0x52')](_0x4e20c6['remoteUri']);_0x4e20c6[_0x29fa('0x53')]=intUtil[_0x29fa('0x52')](_0x4e20c6[_0x29fa('0x53')]);var _0x1558f1=util['format'](_0x29fa('0x54'),_0x4e20c6[_0x29fa('0x55')]);_0x3e7118[_0x29fa('0x15')]=!_[_0x29fa('0x56')](_0x116169)?_0x116169['email']:null;_0x3e7118[_0x29fa('0x20')]=_0x4e20c6[_0x29fa('0x57')];_0x3e7118[_0x29fa('0x24')]=_0x3e8c9d[_0x29fa('0x2c')]()===_0x29fa('0x36')?_0x3c0194[_0x29fa('0x58')]:_0x3c0194[_0x29fa('0x59')];_0x3e7118[_0x29fa('0x5a')]=_0x3e8c9d==='queue'||_0x3e8c9d==='unmanaged'?'queue':_0x29fa('0x36');var _0xe09b25=util[_0x29fa('0x4d')](_0x29fa('0x5b'),_0x4e20c6[_0x29fa('0x53')],_0x3c0194[_0x29fa('0x5c')],md5(_0x3c0194[_0x29fa('0x5c')]));if(_0x2b69db&&_0x2b69db['monitor_format']){logger[_0x29fa('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3c0194['recordingURL']=_0xe09b25;}else if(_0x3c265e&&_0x3c265e[_0x29fa('0x5d')]&&_0x3c265e[_0x29fa('0x5d')]!==_0x29fa('0x5e')){logger[_0x29fa('0xf')](_0x29fa('0x5f'),_0x29fa('0x60'));_0x3c0194[_0x29fa('0x61')]=_0xe09b25;}else{_0x3c0194[_0x29fa('0x61')]='';}return getAdminUser(_0x3e8c9d,_0x4c4711,_0x3e7118,_0x1558f1,_0xfbef24,_0x4af79e)['then'](getUser(_0x3e8c9d,_0x4c4711,_0x1558f1,_0xfbef24,_0x4af79e))[_0x29fa('0x18')](getEndUser(_0x3e8c9d,_0x4c4711,_0x1558f1,_0xfbef24,_0x4af79e))[_0x29fa('0x18')](getTicket(_0x3e8c9d,_0x4c4711,_0x1558f1,_0x5803f3,_0x3c0194,_0xfbef24))['then'](function(_0x2438a4){logger[_0x29fa('0xf')](util[_0x29fa('0x4d')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2438a4[_0x29fa('0x3f')]));logger[_0x29fa('0xf')](util[_0x29fa('0x4d')](_0x29fa('0x62'),_0x3e8c9d));if(_0x3e8c9d!==_0x29fa('0x63')){logger['info']('['+[_0x3e8c9d[_0x29fa('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4e20c6[_0x29fa('0x55')],_0x116169[_0x29fa('0x34')],_0x2438a4[_0x29fa('0x3f')]);}})[_0x29fa('0x1e')](function(_0x483f15){logger[_0x29fa('0x11')]('['+[_0x3e8c9d[_0x29fa('0x10')]()]+_0x29fa('0x64'),util['inspect'](_0x483f15,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc5a1=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','push','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','isNil','email','calleridnum','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','then','result','length','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','customField','toLowerCase','toString','includes','idField','content','variable','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20'];(function(_0x2d1667,_0x4b7a0f){var _0x2ae9ad=function(_0x3274c5){while(--_0x3274c5){_0x2d1667['push'](_0x2d1667['shift']());}};_0x2ae9ad(++_0x4b7a0f);}(_0xc5a1,0x8b));var _0x1c5a=function(_0x46939d,_0xc1b36d){_0x46939d=_0x46939d-0x0;var _0x5105e8=_0xc5a1[_0x46939d];return _0x5105e8;};'use strict';var _=require('lodash');var Promise=require(_0x1c5a('0x0'));var rp=require(_0x1c5a('0x1'));var util=require(_0x1c5a('0x2'));var md5=require('md5');var Redis=require(_0x1c5a('0x3'));var intUtil=require(_0x1c5a('0x4'));var config=require(_0x1c5a('0x5'));var logger=require(_0x1c5a('0x6'))(_0x1c5a('0x7'));config['redis']=_[_0x1c5a('0x8')](config[_0x1c5a('0x9')],{'host':_0x1c5a('0xa'),'port':0x18eb});var io=require(_0x1c5a('0xb'))(new Redis(config[_0x1c5a('0x9')]));function getAdminUser(_0x737ce5,_0x491bf8,_0x5831bb,_0x5c2ac1,_0x379925,_0x53b877){return new Promise(function(_0x5c7792,_0x100185){var _0x3cfbca={'method':_0x1c5a('0xc'),'uri':_0x5c2ac1+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x379925+'&'+_0x53b877,'auth':_0x491bf8,'json':!![]};return rp(_0x3cfbca)[_0x1c5a('0xd')](function(_0x5608f3){if(_0x5608f3[_0x1c5a('0xe')][_0x1c5a('0xf')]>0x0){_0x5831bb[_0x1c5a('0x10')]=_0x5608f3['result'][0x0][_0x1c5a('0x11')];}logger[_0x1c5a('0x12')]('['+[_0x737ce5[_0x1c5a('0x13')]()]+'],\x20getAdminUser\x20crm',_0x5831bb);_0x5c7792(_0x5831bb);})[_0x1c5a('0x14')](function(_0x54e818){logger[_0x1c5a('0x15')]('['+[_0x737ce5[_0x1c5a('0x13')]()]+']',_0x54e818[_0x1c5a('0x16')]);_0x100185(_0x54e818[_0x1c5a('0x16')]);});});}function getUser(_0x334e3f,_0x467980,_0x5b0a05,_0x34b5cb,_0x1b5fc4){return function(_0x5b2256){logger[_0x1c5a('0x12')]('['+[_0x334e3f[_0x1c5a('0x13')]()]+_0x1c5a('0x17'),_0x5b2256);return new Promise(function(_0x421a3b,_0xe0af67){if(intUtil[_0x1c5a('0x18')](_0x5b2256[_0x1c5a('0x19')])){var _0x18053f={'method':_0x1c5a('0xc'),'uri':_0x5b0a05+_0x1c5a('0x1a')+_0x5b2256['userEmail']+'&'+_0x34b5cb+'&'+_0x1b5fc4,'auth':_0x467980,'json':!![]};logger['info']('['+[_0x334e3f[_0x1c5a('0x13')]()]+_0x1c5a('0x1b'),_0x18053f);return rp(_0x18053f)['then'](function(_0x74ad12){logger[_0x1c5a('0x12')]('['+[_0x334e3f[_0x1c5a('0x13')]()]+'],\x20getUser\x20entity',_0x74ad12);if(_0x74ad12[_0x1c5a('0xe')][_0x1c5a('0xf')]>0x0&&String(_0x74ad12['result'][0x0][_0x1c5a('0x1c')])==='true'){_0x5b2256[_0x1c5a('0x1d')]=_0x74ad12[_0x1c5a('0xe')][0x0][_0x1c5a('0x11')];}else{_0x5b2256[_0x1c5a('0x1d')]=_0x5b2256['adminId'];_0x5b2256['userEmail']=_0x5b2256[_0x1c5a('0x1e')];}logger[_0x1c5a('0x12')]('['+[_0x334e3f[_0x1c5a('0x13')]()]+_0x1c5a('0x1f'),_0x5b2256);_0x421a3b(_0x5b2256);})[_0x1c5a('0x14')](function(_0x48acc1){logger[_0x1c5a('0x15')]('['+[_0x334e3f[_0x1c5a('0x13')]()]+']',_0x48acc1['message']);_0xe0af67(_0x48acc1[_0x1c5a('0x16')]);});}else{logger['info']('['+[_0x334e3f['toUpperCase']()]+_0x1c5a('0x20'));_0x5b2256[_0x1c5a('0x1d')]=_0x5b2256[_0x1c5a('0x10')];_0x5b2256[_0x1c5a('0x19')]=_0x5b2256[_0x1c5a('0x1e')];_0x421a3b(_0x5b2256);}});};}function createEndUser(_0x183069,_0x4ddd4d,_0x5eb171,_0x5402ff,_0x4a5385){logger[_0x1c5a('0x12')]('['+[_0x183069[_0x1c5a('0x13')]()]+_0x1c5a('0x21'),_0x5eb171);return new Promise(function(_0x436722,_0x36afcf){var _0x50934f={'method':_0x1c5a('0x22'),'uri':_0x5402ff+_0x1c5a('0x23')+_0x4a5385,'body':{'user_name':_0x5eb171[_0x1c5a('0x24')],'roles':_0x1c5a('0x25'),'first_name':_0x5eb171[_0x1c5a('0x24')],'active':_0x1c5a('0x26'),'date_format':_0x1c5a('0x27'),'phone':_0x5eb171[_0x1c5a('0x24')]},'auth':_0x4ddd4d,'json':!![]};return rp(_0x50934f)['then'](function(_0x3db7ed){logger[_0x1c5a('0x12')]('['+[_0x183069[_0x1c5a('0x13')]()]+'],\x20EndUser\x20schema',_0x3db7ed['result']);_0x5eb171[_0x1c5a('0x28')]=_0x3db7ed['result']['sys_id'];_0x436722(_0x5eb171);})[_0x1c5a('0x14')](function(_0x1d1e88){logger[_0x1c5a('0x15')]('['+[_0x183069[_0x1c5a('0x13')]()]+']',_0x1d1e88[_0x1c5a('0x16')]);_0x36afcf(_0x1d1e88[_0x1c5a('0x16')]);});});}function getEndUser(_0x5c0a33,_0x222055,_0x1f95b1,_0x52746f,_0x264e53){return function(_0x3fc1f6){logger[_0x1c5a('0x12')]('['+[_0x5c0a33['toUpperCase']()]+_0x1c5a('0x29'),_0x3fc1f6);return new Promise(function(_0x3d2812,_0x4b4327){var _0x5565ab={'method':_0x1c5a('0xc'),'uri':_0x1f95b1+_0x1c5a('0x2a')+_0x3fc1f6['endUserNumber']+'&'+_0x52746f+'&'+_0x264e53,'auth':_0x222055,'json':!![]};return rp(_0x5565ab)[_0x1c5a('0xd')](function(_0x289ebe){if(_0x289ebe[_0x1c5a('0xe')]['length']>0x0){_0x3fc1f6[_0x1c5a('0x28')]=_0x289ebe[_0x1c5a('0xe')][0x0][_0x1c5a('0x11')];logger[_0x1c5a('0x12')]('['+[_0x5c0a33[_0x1c5a('0x13')]()]+_0x1c5a('0x2b'),_0x3fc1f6);_0x3d2812(_0x3fc1f6);}else{return createEndUser(_0x5c0a33,_0x222055,_0x3fc1f6,_0x1f95b1,_0x52746f)['then'](function(_0x3a66cd){logger[_0x1c5a('0x12')]('['+[_0x5c0a33[_0x1c5a('0x13')]()]+_0x1c5a('0x2c'),_0x3a66cd);_0x3d2812(_0x3a66cd);});}})[_0x1c5a('0x14')](function(_0x50dd2f){logger[_0x1c5a('0x15')]('['+[_0x5c0a33[_0x1c5a('0x13')]()]+']',_0x50dd2f[_0x1c5a('0x16')]);_0x4b4327(_0x50dd2f[_0x1c5a('0x16')]);});});};}function getCustomFields(_0x4e3b68,_0x44038e){var _0x4447a1={};if(_0x4e3b68['length']>0x0){_['forEach'](_0x4e3b68,function(_0x239e46){if(_['includes']([_0x1c5a('0x2d'),_0x1c5a('0x2e')],_0x239e46[_0x1c5a('0x2f')])&&_0x239e46['nameField']&&!_0x239e46[_0x1c5a('0x30')]){_0x4447a1[_0x239e46['nameField'][_0x1c5a('0x31')]()]=_0x239e46['content'][_0x1c5a('0x32')]();}else if(_[_0x1c5a('0x33')]([_0x1c5a('0x2d'),_0x1c5a('0x2e')],_0x239e46[_0x1c5a('0x2f')])&&_0x239e46['idField']&&_0x239e46[_0x1c5a('0x30')]){_0x4447a1[_0x239e46[_0x1c5a('0x34')][_0x1c5a('0x31')]()]=_0x239e46[_0x1c5a('0x35')]['toString']();}else if(_0x239e46[_0x1c5a('0x2f')]===_0x1c5a('0x36')&&_0x239e46[_0x1c5a('0x37')]&&_0x239e46[_0x1c5a('0x34')]&&_0x239e46['customField']){_0x4447a1[_0x239e46['idField']['toLowerCase']()]=_0x44038e[_0x239e46[_0x1c5a('0x37')]]['toString']();}else if(_0x239e46[_0x1c5a('0x2f')]===_0x1c5a('0x38')&&_0x239e46['Variable']&&_0x239e46[_0x1c5a('0x39')][_0x1c5a('0x3a')]&&_0x239e46[_0x1c5a('0x34')]&&_0x239e46['customField']){_0x4447a1[_0x239e46[_0x1c5a('0x34')]['toLowerCase']()]=_0x44038e[_0x239e46['Variable'][_0x1c5a('0x3a')][_0x1c5a('0x31')]()]['toString']();}});}return _0x4447a1;}function getTicket(_0x575d5c,_0x1f92c0,_0x5d0037,_0x52ffa1,_0x2b3063,_0xbf3fa7){return function(_0x3545e8){logger[_0x1c5a('0x12')]('['+[_0x575d5c['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x3545e8);return new Promise(function(_0x19b744,_0x3dc771){var _0x589571=_0x575d5c['toLowerCase']()===_0x1c5a('0x3b')?_0x3545e8[_0x1c5a('0x1d')]:_0x3545e8[_0x1c5a('0x28')];var _0x2113c7={'method':_0x1c5a('0x22'),'uri':_0x5d0037+_0x1c5a('0x3c')+'?'+_0xbf3fa7,'body':Object[_0x1c5a('0x3d')]({},{'active':_0x1c5a('0x26'),'caller_id':_0x589571,'assigned_to':_0x3545e8[_0x1c5a('0x1d')],'short_description':intUtil[_0x1c5a('0x3e')](_0x52ffa1[_0x1c5a('0x3f')],_0x2b3063,'\x20'),'description':intUtil[_0x1c5a('0x3e')](_0x52ffa1[_0x1c5a('0x40')],_0x2b3063,'\x0a')},getCustomFields(_0x52ffa1[_0x1c5a('0x41')],_0x2b3063)),'auth':_0x1f92c0,'json':!![]};return rp(_0x2113c7)[_0x1c5a('0xd')](function(_0x55094e){logger[_0x1c5a('0x12')]('['+[_0x575d5c[_0x1c5a('0x13')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x55094e[_0x1c5a('0xe')]);_0x3545e8[_0x1c5a('0x42')]=_0x55094e['result'][_0x1c5a('0x11')];_0x3545e8[_0x1c5a('0x43')]=_0x55094e[_0x1c5a('0xe')][_0x1c5a('0x44')];logger[_0x1c5a('0x12')]('['+[_0x575d5c[_0x1c5a('0x13')]()]+_0x1c5a('0x45'),_0x3545e8);_0x19b744(_0x3545e8);})[_0x1c5a('0x14')](function(_0x303811){logger['error']('['+[_0x575d5c[_0x1c5a('0x13')]()]+']',_0x303811[_0x1c5a('0x16')]);_0x3dc771(_0x303811['message']);});});};}function createRemoteTag(_0xe3e18,_0x211f37,_0xb03587,_0x112833){return new Promise(function(_0x3e612e,_0x3b7c3a){var _0x40c2a6={'method':_0x1c5a('0x22'),'uri':_0xb03587+'label'+'?'+_0x112833,'body':{'short_description':_0xe3e18,'global':!![],'active':!![],'name':_0xe3e18},'auth':_0x211f37,'json':!![]};return rp(_0x40c2a6)[_0x1c5a('0xd')](function(_0x5c7843){var _0x260657=_0x5c7843[_0x1c5a('0xe')]['sys_id'];_0x3e612e(_0x260657);});});}function getRemoteTag(_0x48c798,_0x2a3475,_0x160287,_0x1f2da0,_0x3b768f){return new Promise(function(_0x194a06,_0x32c267){var _0x580b3a={'method':'GET','uri':_0x160287+_0x1c5a('0x46')+_0x1c5a('0x47')+_0x48c798+'&'+_0x1f2da0,'auth':_0x2a3475,'json':!![]};return rp(_0x580b3a)[_0x1c5a('0xd')](function(_0x5729d3){if(_0x5729d3[_0x1c5a('0xe')][_0x1c5a('0xf')]>0x0){var _0x17ec26=_0x5729d3[_0x1c5a('0xe')][0x0][_0x1c5a('0x11')];_0x194a06(_0x17ec26);}else{return createRemoteTag(_0x48c798,_0x2a3475,_0x160287,_0x1f2da0)['then'](function(_0x27bca9){_0x194a06(_0x27bca9);});}});});}function assignTagToIncident(_0x4a3bf1,_0x17b4b5,_0x370552,_0x4ee610,_0xc0b624){return new Promise(function(_0x171228,_0x5aa41e){var _0x1d7007={'method':_0x1c5a('0x22'),'uri':_0x370552+_0x1c5a('0x48')+'?'+_0xc0b624,'body':{'label':_0x4a3bf1,'table':_0x1c5a('0x3c'),'id_type':_0x1c5a('0x49'),'table_key':_0x4ee610['ticketId'],'title':_0x1c5a('0x4a')+_0x4ee610[_0x1c5a('0x43')],'id_display':_0x4ee610[_0x1c5a('0x43')]},'auth':_0x17b4b5,'json':!![]};return rp(_0x1d7007)[_0x1c5a('0xd')](function(_0x5eed21){_0x171228();})[_0x1c5a('0x14')](function(){_0x171228();});});}function manageTags(_0x5bd56a,_0x52c3f9,_0x3a5c01,_0x55af55,_0x453410,_0xc2e789,_0x4f5ea8){return new Promise(function(_0x297b04,_0x161fd4){var _0x1bc5a7=[];_0x52c3f9['forEach'](function(_0x4b04ab){_0x1bc5a7['push'](getRemoteTag(_0x4b04ab,_0x3a5c01,_0x55af55,_0xc2e789,_0x4f5ea8));});return Promise[_0x1c5a('0x4b')](_0x1bc5a7)[_0x1c5a('0xd')](function(_0x4f343e){if(_0x4f343e['length']){logger['info']('['+[_0x5bd56a['toUpperCase']()]+_0x1c5a('0x4c'),_0x4f343e);var _0x3cf49c=[];_0x4f343e[_0x1c5a('0x4d')](function(_0x57793a){_0x3cf49c[_0x1c5a('0x4e')](assignTagToIncident(_0x57793a,_0x3a5c01,_0x55af55,_0x453410,_0xc2e789));});return Promise['all'](_0x3cf49c)[_0x1c5a('0xd')](function(){_0x297b04();})['catch'](function(){_0x297b04();});}else{_0x297b04();}});});}function getTags(_0xb97f0b,_0x2edc85,_0x46e750,_0x19059b,_0x36aa22,_0x1f9e52){return function(_0x2cab37){return new Promise(function(_0x39087a,_0x394aa){var _0xdbbf96=[];var _0x349f58=_0x19059b[_0x1c5a('0x4f')];if(_0x349f58&&_0x349f58[_0x1c5a('0xf')]>0x0){_0xdbbf96=_['map'](_0x349f58,_0x1c5a('0x3a'));}if(_0xdbbf96[_0x1c5a('0xf')]>0x0){return manageTags(_0xb97f0b,_0xdbbf96,_0x2edc85,_0x46e750,_0x2cab37,_0x36aa22,_0x1f9e52)['then'](function(){_0x39087a(_0x2cab37);});}else{_0x39087a(_0x2cab37);}});};}function emit(_0x4f0862,_0x14cf4a,_0x3bd094){var _0x5addce=_0x1c5a('0x50')+_0x1c5a('0x51')+_0x1c5a('0x52')+_0x1c5a('0x53');var _0x3054b1={'uri':_0x4f0862+_0x1c5a('0x54')+_0x3bd094+_0x5addce};io['to'](util['format']('user:%s',_0x14cf4a))[_0x1c5a('0x55')](_0x1c5a('0x56'),_0x3054b1);}exports['cs']=function(_0x34c6e0,_0x2ec537,_0x3b3143,_0x145431,_0x1e07a8,_0x3bcdb9,_0x22199d,_0x4e22e9){var _0x1e601a={};var _0x4eac3e={'user':_0x3bcdb9[_0x1c5a('0x57')],'pass':_0x3bcdb9[_0x1c5a('0x58')]};var _0x5b38a0=_0x1c5a('0x59');var _0x4e007b='sysparm_display_value=true';_0x3bcdb9[_0x1c5a('0x5a')]=intUtil[_0x1c5a('0x5b')](_0x3bcdb9[_0x1c5a('0x5a')]);_0x3bcdb9[_0x1c5a('0x5c')]=intUtil[_0x1c5a('0x5b')](_0x3bcdb9['serverUrl']);var _0x1077bc=util['format']('%s/api/now/table/',_0x3bcdb9[_0x1c5a('0x5a')]);_0x1e601a[_0x1c5a('0x19')]=!_[_0x1c5a('0x5d')](_0x145431)?_0x145431[_0x1c5a('0x5e')]:null;_0x1e601a[_0x1c5a('0x1e')]=_0x3bcdb9['email'];_0x1e601a[_0x1c5a('0x24')]=_0x4e22e9['toLowerCase']()==='outbound'?_0x2ec537['destcalleridnum']:_0x2ec537[_0x1c5a('0x5f')];_0x1e601a['callDirection']=_0x4e22e9==='queue'||_0x4e22e9==='unmanaged'?'queue':'outbound';var _0x6d8a58=util[_0x1c5a('0x60')](_0x1c5a('0x61'),_0x3bcdb9[_0x1c5a('0x5c')],_0x2ec537[_0x1c5a('0x62')],md5(_0x2ec537[_0x1c5a('0x62')]));if(_0x1e07a8&&_0x1e07a8[_0x1c5a('0x63')]){logger['info']('[QUEUE]',_0x1c5a('0x64'));_0x2ec537['recordingURL']=_0x6d8a58;}else if(_0x22199d&&_0x22199d[_0x1c5a('0x65')]&&_0x22199d[_0x1c5a('0x65')]!=='none'){logger[_0x1c5a('0x12')](_0x1c5a('0x66'),_0x1c5a('0x64'));_0x2ec537['recordingURL']=_0x6d8a58;}else{_0x2ec537['recordingURL']='';}return getAdminUser(_0x4e22e9,_0x4eac3e,_0x1e601a,_0x1077bc,_0x4e007b,_0x5b38a0)['then'](getUser(_0x4e22e9,_0x4eac3e,_0x1077bc,_0x4e007b,_0x5b38a0))[_0x1c5a('0xd')](getEndUser(_0x4e22e9,_0x4eac3e,_0x1077bc,_0x4e007b,_0x5b38a0))[_0x1c5a('0xd')](getTicket(_0x4e22e9,_0x4eac3e,_0x1077bc,_0x3b3143,_0x2ec537,_0x4e007b))[_0x1c5a('0xd')](function(_0x3bd2ab){logger[_0x1c5a('0x12')](util['format'](_0x1c5a('0x67'),_0x3bd2ab[_0x1c5a('0x42')]));logger[_0x1c5a('0x12')](util['format'](_0x1c5a('0x68'),_0x4e22e9));if(_0x4e22e9!=='unmanaged'){logger['info']('['+[_0x4e22e9[_0x1c5a('0x13')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3bcdb9['remoteUri'],_0x145431['name'],_0x3bd2ab['ticketId']);}})[_0x1c5a('0x14')](function(_0x31162b){logger[_0x1c5a('0x15')]('['+[_0x4e22e9[_0x1c5a('0x13')]()]+_0x1c5a('0x69'),util[_0x1c5a('0x6a')](_0x31162b,{'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 65ce978..20ddd27 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 _0x9e10=['password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridname','Inbound','request-promise','md5','util','ioredis','./util','sugarcrm','redis','localhost','socket.io-emitter','emit','info','getString','Subjects','assigned_user_id','created_by','description','Descriptions','slice','replace','duration_hours','parent_name','length','variableName','push','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','then','entry_list','Agent\x20found!','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','stringify','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','map','forEach','type','string','customField','nameField','content','toString','idField','custom_fields','variable','customVariable','Variable','toLowerCase','login','username'];(function(_0x37a45b,_0x1056ef){var _0x35f3bb=function(_0x5d73cd){while(--_0x5d73cd){_0x37a45b['push'](_0x37a45b['shift']());}};_0x35f3bb(++_0x1056ef);}(_0x9e10,0x185));var _0x09e1=function(_0x41e589,_0x28c7e9){_0x41e589=_0x41e589-0x0;var _0x1d345f=_0x9e10[_0x41e589];return _0x1d345f;};'use strict';var _=require('lodash');var rp=require(_0x09e1('0x0'));var BPromise=require('bluebird');var md5=require(_0x09e1('0x1'));var util=require(_0x09e1('0x2'));var Redis=require(_0x09e1('0x3'));var intUtil=require(_0x09e1('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x09e1('0x5'));config['redis']=_['defaults'](config[_0x09e1('0x6')],{'host':_0x09e1('0x7'),'port':0x18eb});var io=require(_0x09e1('0x8'))(new Redis(config[_0x09e1('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x2f7bdf,_0x4c0613,_0x565593){io['to'](_0x2f7bdf)[_0x09e1('0x9')](_0x4c0613,_0x565593);}function getTicket(_0x569d08,_0x58dd9b,_0x5bc81d,_0x2cd437,_0x214449,_0x3f67ea,_0x21d17c,_0x2e6ca3){logger[_0x09e1('0xa')]('Creating\x20new\x20ticket...');var _0x3b79f2=new Date();var _0x450984=[{'name':'name','value':intUtil[_0x09e1('0xb')](_0x2cd437[_0x09e1('0xc')],_0x214449,'\x20')},{'name':_0x09e1('0xd'),'value':_0x58dd9b['id']},{'name':_0x09e1('0xe'),'value':_0x58dd9b['id']},{'name':_0x09e1('0xf'),'value':intUtil[_0x09e1('0xb')](_0x2cd437[_0x09e1('0x10')],_0x214449,'\x0a')},{'name':'date_start','value':_0x3b79f2['toISOString']()[_0x09e1('0x11')](0x0,0x13)[_0x09e1('0x12')]('T','\x20')},{'name':_0x09e1('0x13'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x5bc81d['id']},{'name':'parent_type','value':'Contacts'},{'name':_0x09e1('0x14'),'value':_0x5bc81d['name']},{'name':'direction','value':_0x2e6ca3}];if(_0x3f67ea[_0x09e1('0x15')]){_['forEach'](_0x3f67ea,function(_0x4ad29b){if(_0x214449[_0x4ad29b[_0x09e1('0x16')]]){_0x450984[_0x09e1('0x17')]({'name':_0x4ad29b['idField'],'value':_0x214449[_0x4ad29b[_0x09e1('0x16')]]});}});}return request({'form':{'method':_0x09e1('0x18'),'input_type':_0x09e1('0x19'),'response_type':_0x09e1('0x19'),'rest_data':JSON['stringify']({'session':_0x21d17c['id'],'module_name':_0x09e1('0x1a'),'name_value_list':_0x450984})}});}function getAuth(_0x380900){return util[_0x09e1('0x1b')](_0x09e1('0x1c'),new Buffer(_0x380900[_0x09e1('0x1d')]+':X')['toString'](_0x09e1('0x1e')));}function getServerInfo(_0x55b379){return request({'form':{'method':_0x09e1('0x1f'),'input_type':_0x09e1('0x19'),'response_type':_0x09e1('0x19'),'rest_data':JSON['stringify']({'session':_0x55b379['id']})}});}function getUser(_0x350f0a,_0x24db1b,_0x4ca656){if(!_['isNil'](_0x24db1b)){logger[_0x09e1('0xa')](_0x09e1('0x20'),_0x24db1b);return request({'form':{'method':_0x09e1('0x21'),'input_type':_0x09e1('0x19'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4ca656['id'],'module_name':_0x09e1('0x22'),'query':util[_0x09e1('0x1b')](_0x09e1('0x23'),_0x24db1b),'order_by':'','offset':'0','select_fields':['id',_0x09e1('0x24'),_0x09e1('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x09e1('0x26')](function(_0x43c4d7){if(_0x43c4d7[_0x09e1('0x27')][_0x09e1('0x15')]){var _0x22b5dd=_['find'](_0x43c4d7[_0x09e1('0x27')],function(_0x4857d6){return _0x4857d6['name_value_list'][_0x09e1('0x25')]['value']===_0x24db1b;});if(_0x22b5dd){logger[_0x09e1('0xa')](_0x09e1('0x28'));return BPromise[_0x09e1('0x29')]({'id':_0x22b5dd[_0x09e1('0x2a')]['id'][_0x09e1('0x2b')],'name':_0x22b5dd[_0x09e1('0x2a')][_0x09e1('0x24')][_0x09e1('0x2b')]});}}logger['info'](_0x09e1('0x2c'));return BPromise[_0x09e1('0x29')]({'id':_0x4ca656[_0x09e1('0x2a')][_0x09e1('0x2d')]['value'],'name':_0x4ca656[_0x09e1('0x2a')]['user_name'][_0x09e1('0x2b')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4ca656['name_value_list'][_0x09e1('0x2d')][_0x09e1('0x2b')],'name':_0x4ca656[_0x09e1('0x2a')][_0x09e1('0x25')]['value']});}}function getEndUser(_0x3d1cf3,_0xc68cb0,_0x303b4c,_0x5bd26c){logger[_0x09e1('0xa')]('Searching\x20enduser\x20with\x20phone',_0x303b4c);return request({'form':{'method':_0x09e1('0x21'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x09e1('0x2e')]({'session':_0x5bd26c['id'],'module_name':'Contacts','query':util['format'](_0x09e1('0x2f'),_0x303b4c),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x09e1('0x26')](function(_0x40079d){if(_0x40079d[_0x09e1('0x27')][_0x09e1('0x15')]){var _0x14fd65=_[_0x09e1('0x30')](_0x40079d[_0x09e1('0x27')],function(_0xe6de43){return _0xe6de43['name_value_list']['phone_home']['value']===_0x303b4c;});if(_0x14fd65){logger[_0x09e1('0xa')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x14fd65[_0x09e1('0x2a')]['id'][_0x09e1('0x2b')],'name':_0x14fd65['name_value_list']['name'][_0x09e1('0x2b')],'phone':_0x14fd65[_0x09e1('0x2a')][_0x09e1('0x31')][_0x09e1('0x2b')]});}}else{logger[_0x09e1('0xa')](_0x09e1('0x32'));return request({'form':{'method':_0x09e1('0x18'),'input_type':_0x09e1('0x19'),'response_type':'JSON','rest_data':JSON[_0x09e1('0x2e')]({'session':_0x5bd26c['id'],'module_name':'Contacts','name_value_list':[{'name':_0x09e1('0x33'),'value':_0xc68cb0!==_0x09e1('0x34')?_0xc68cb0:util[_0x09e1('0x1b')](_0x09e1('0x35'),_0x303b4c)},{'name':_0x09e1('0x31'),'value':_0x303b4c}]})}})[_0x09e1('0x26')](function(_0xbea9f8){logger[_0x09e1('0xa')](_0x09e1('0x36'));return BPromise['resolve']({'id':_0xbea9f8['id'],'name':_0xbea9f8[_0x09e1('0x27')][_0x09e1('0x33')]['value'],'phone':_0xbea9f8['entry_list'][_0x09e1('0x31')][_0x09e1('0x2b')]});});}});}function request(_0x180f00){logger['debug']('[HTTP]',JSON['stringify'](_0x180f00));return rp(_['merge'](def,_0x180f00));}function getTags(_0x2a1035,_0x2781f3){var _0xdea336=[];if(_0x2a1035&&_0x2a1035[_0x09e1('0x15')]>0x0){_0xdea336=_[_0x09e1('0x37')](_0x2a1035,_0x2781f3);}return _0xdea336;}function getCustomFields(_0x5df16b,_0x331925){var _0x2a558e=[];var _0x39fc1a={'custom_fields':[]};if(_0x5df16b[_0x09e1('0x15')]>0x0){_[_0x09e1('0x38')](_0x5df16b,function(_0xb12717){if(_0xb12717[_0x09e1('0x39')]===_0x09e1('0x3a')&&_0xb12717['nameField']&&!_0xb12717[_0x09e1('0x3b')]){_0x39fc1a[_0xb12717[_0x09e1('0x3c')]['toLowerCase']()]=_0xb12717[_0x09e1('0x3d')][_0x09e1('0x3e')]();}else if(_0xb12717[_0x09e1('0x39')]===_0x09e1('0x3a')&&_0xb12717[_0x09e1('0x3f')]&&_0xb12717['customField']){_0x39fc1a[_0x09e1('0x40')][_0x09e1('0x17')]({'id':_0xb12717[_0x09e1('0x3f')],'value':_0xb12717[_0x09e1('0x3d')][_0x09e1('0x3e')]()});}else if(_0xb12717[_0x09e1('0x39')]===_0x09e1('0x41')&&_0xb12717[_0x09e1('0x16')]&&_0xb12717[_0x09e1('0x3f')]&&_0xb12717[_0x09e1('0x3b')]){_0x331925[_0xb12717[_0x09e1('0x16')]]&&_0x39fc1a[_0x09e1('0x40')][_0x09e1('0x17')]({'id':_0xb12717['idField'],'value':_0x331925[_0xb12717['variableName']][_0x09e1('0x3e')]()});}else if(_0xb12717[_0x09e1('0x39')]===_0x09e1('0x42')&&_0xb12717['Variable']&&_0xb12717[_0x09e1('0x43')][_0x09e1('0x24')]&&_0xb12717['idField']&&_0xb12717[_0x09e1('0x3b')]){_0x331925[_0xb12717['Variable']['name'][_0x09e1('0x44')]()]&&_0x39fc1a[_0x09e1('0x40')]['push']({'id':_0xb12717[_0x09e1('0x3f')],'value':_0x331925[_0xb12717[_0x09e1('0x43')][_0x09e1('0x24')]['toLowerCase']()][_0x09e1('0x3e')]()});}});}return _0x39fc1a;}function getConnection(_0x2d2faf){return request({'method':'POST','form':{'method':_0x09e1('0x45'),'input_type':'JSON','response_type':_0x09e1('0x19'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2d2faf[_0x09e1('0x46')],'password':_0x2d2faf[_0x09e1('0x47')],'encryption':_0x09e1('0x48')},'application':_0x09e1('0x49')})}})[_0x09e1('0x26')](function(_0x2b9679){var _0x4b3355=_0x2b9679;if(_0x4b3355['id']){def[_0x09e1('0x4a')]=_0x4b3355['id'];return BPromise[_0x09e1('0x29')](_0x4b3355);}else{throw new Error(util[_0x09e1('0x1b')](_0x09e1('0x4b'),_0x2d2faf['id']));}});}function setRelationship(_0xc8c6e4,_0x55ee69,_0x6f34f0,_0xaccda2){return request({'form':{'method':_0x09e1('0x4c'),'input_type':_0x09e1('0x19'),'response_type':'JSON','rest_data':JSON[_0x09e1('0x2e')]({'session':_0xc8c6e4['id'],'module_name':_0x09e1('0x1a'),'module_id':_0x6f34f0['id'],'link_field_name':_0xaccda2,'related_ids':[_0x55ee69['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x09e1('0x4d')]=function(_0x4a4960,_0x1d3999,_0x398f14,_0x5a527e,_0x569cdc,_0x4bbc21){var _0x5db07e,_0x3c121d,_0x15f99e,_0x5c27cb;_0x4bbc21[_0x09e1('0x4e')]=intUtil[_0x09e1('0x4f')](_0x4bbc21[_0x09e1('0x4e')]);_0x4bbc21['serverUrl']=intUtil[_0x09e1('0x4f')](_0x4bbc21['serverUrl']);def[_0x09e1('0x50')]=util[_0x09e1('0x1b')](_0x09e1('0x51'),_0x4bbc21[_0x09e1('0x4e')]);if(_0x569cdc&&_0x569cdc['monitor_format']){logger[_0x09e1('0xa')](_0x09e1('0x52'),'Recording\x20is\x20enabled!');_0x1d3999['recordingURL']=util[_0x09e1('0x1b')](_0x09e1('0x53'),_0x4bbc21[_0x09e1('0x54')],_0x1d3999[_0x09e1('0x55')],md5(_0x1d3999[_0x09e1('0x55')]));}else{_0x1d3999['recordingURL']='';}return getConnection(_0x4bbc21)[_0x09e1('0x26')](function(_0xec4045){_0x5c27cb=_0xec4045;return getUser(_0x4bbc21,_0x5a527e['name'],_0x5c27cb);})[_0x09e1('0x26')](function(_0x5253e0){_0x5db07e=_0x5253e0;logger[_0x09e1('0xa')]('The\x20User\x20ID\x20is:',_0x5db07e['id']);return getEndUser(_0x4bbc21,_0x1d3999['calleridname'],_0x1d3999[_0x09e1('0x56')],_0x5c27cb);})[_0x09e1('0x26')](function(_0x35700e){_0x3c121d=_0x35700e;logger['info'](_0x09e1('0x57'),_0x3c121d['id']);return getTicket(_0x4bbc21,_0x5db07e,_0x3c121d,_0x398f14,_0x1d3999,_0x398f14[_0x09e1('0x58')],_0x5c27cb,'Inbound');})[_0x09e1('0x26')](function(_0x55d7c8){_0x15f99e=_0x55d7c8;logger['info'](_0x09e1('0x59'));logger['info'](_0x09e1('0x5a'),_0x15f99e['id']);return setRelationship(_0x5c27cb,_0x5db07e,_0x15f99e,'users');})[_0x09e1('0x26')](function(){return setRelationship(_0x5c27cb,_0x3c121d,_0x15f99e,_0x09e1('0x5b'));})[_0x09e1('0x26')](function(){return getServerInfo(_0x5c27cb);})[_0x09e1('0x26')](function(_0x587d58){var _0x44a6dd=parseInt(_0x587d58[_0x09e1('0x5c')][_0x09e1('0x5d')](0x0));var _0x4ec4e7=util[_0x09e1('0x1b')](_0x09e1('0x5e'),_0x4bbc21['remoteUri'],_0x15f99e['id']);if(_0x44a6dd>0x6){_0x4ec4e7=util[_0x09e1('0x1b')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4bbc21[_0x09e1('0x4e')],_0x15f99e['id']);}logger['info']('[QUEUE]',_0x09e1('0x5f'));emit(util[_0x09e1('0x1b')](_0x09e1('0x60'),_0x5a527e['name']),_0x09e1('0x61'),{'uri':_0x4ec4e7});})[_0x09e1('0x62')](function(_0x1316f2){logger[_0x09e1('0x63')](_0x09e1('0x52'),JSON[_0x09e1('0x2e')](_0x1316f2));});};exports[_0x09e1('0x64')]=function(_0x54e83c,_0x523f1b,_0x62157c,_0x3e759e,_0xcf8b43,_0x6bfdfe,_0x5b6935){var _0x3f320f,_0x39f408,_0x31ffe8,_0x212282;_0x6bfdfe[_0x09e1('0x4e')]=intUtil[_0x09e1('0x4f')](_0x6bfdfe[_0x09e1('0x4e')]);_0x6bfdfe['serverUrl']=intUtil['stripTrailingSlash'](_0x6bfdfe['serverUrl']);def[_0x09e1('0x50')]=util[_0x09e1('0x1b')](_0x09e1('0x51'),_0x6bfdfe[_0x09e1('0x4e')]);if(_0x5b6935&&_0x5b6935[_0x09e1('0x65')]&&_0x5b6935['recordingFormat']!==_0x09e1('0x66')){logger[_0x09e1('0xa')](_0x09e1('0x67'),'Recording\x20is\x20enabled!');_0x523f1b[_0x09e1('0x68')]=util[_0x09e1('0x1b')](_0x09e1('0x53'),_0x6bfdfe[_0x09e1('0x54')],_0x523f1b['uniqueid'],md5(_0x523f1b[_0x09e1('0x55')]));}return getConnection(_0x6bfdfe)[_0x09e1('0x26')](function(_0x8cd02f){_0x212282=_0x8cd02f;return getUser(_0x6bfdfe,_0x3e759e[_0x09e1('0x24')],_0x212282);})[_0x09e1('0x26')](function(_0x132252){_0x3f320f=_0x132252;logger[_0x09e1('0xa')](_0x09e1('0x69'),_0x3f320f['id']);return getEndUser(_0x6bfdfe,_0x523f1b['destcalleridname'],_0x523f1b[_0x09e1('0x6a')],_0x212282);})[_0x09e1('0x26')](function(_0x43ac84){_0x39f408=_0x43ac84;logger[_0x09e1('0xa')](_0x09e1('0x57'),_0x39f408['id']);return getTicket(_0x6bfdfe,_0x3f320f,_0x39f408,_0x62157c,_0x523f1b,_0x62157c['Fields'],_0x212282,_0x09e1('0x6b'));})[_0x09e1('0x26')](function(_0x1f41db){_0x31ffe8=_0x1f41db;logger['info']('Ticket\x20created!');logger[_0x09e1('0xa')](_0x09e1('0x5a'),_0x31ffe8['id']);return setRelationship(_0x212282,_0x3f320f,_0x31ffe8,_0x09e1('0x6c'));})[_0x09e1('0x26')](function(){return setRelationship(_0x212282,_0x39f408,_0x31ffe8,_0x09e1('0x5b'));})['then'](function(){return getServerInfo(_0x212282);})[_0x09e1('0x26')](function(_0x373dab){var _0x2a6bec=parseInt(_0x373dab['version']['charAt'](0x0));var _0x41072a=util[_0x09e1('0x1b')](_0x09e1('0x5e'),_0x6bfdfe['remoteUri'],_0x31ffe8['id']);if(_0x2a6bec>0x6){_0x41072a=util['format'](_0x09e1('0x6d'),_0x6bfdfe['remoteUri'],_0x31ffe8['id']);}logger['info']('[OUTBOUND]',_0x09e1('0x5f'));emit(util[_0x09e1('0x1b')](_0x09e1('0x60'),_0x3e759e['name']),_0x09e1('0x61'),{'uri':_0x41072a});})[_0x09e1('0x62')](function(_0x157865){logger['error'](_0x09e1('0x67'),JSON[_0x09e1('0x2e')](_0x157865));});};exports['unmanaged']=function(_0x511913,_0x47a66b,_0x49e2b2,_0x48574b,_0x251d4c,_0x159f56){var _0x586840,_0xe9fe2b,_0x43fb84,_0x2cb5fa;_0x159f56[_0x09e1('0x4e')]=intUtil[_0x09e1('0x4f')](_0x159f56['remoteUri']);_0x159f56[_0x09e1('0x54')]=intUtil[_0x09e1('0x4f')](_0x159f56[_0x09e1('0x54')]);def[_0x09e1('0x50')]=util[_0x09e1('0x1b')]('%s/service/v4_1/rest.php',_0x159f56[_0x09e1('0x4e')]);if(_0x251d4c&&_0x251d4c['monitor_format']){logger[_0x09e1('0xa')]('['+_0x47a66b[_0x09e1('0x6e')][_0x09e1('0x6f')]()+']',_0x09e1('0x70'));_0x47a66b['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x159f56['serverUrl'],_0x47a66b['uniqueid'],md5(_0x47a66b[_0x09e1('0x55')]));}else{_0x47a66b[_0x09e1('0x68')]='';}return getConnection(_0x159f56)[_0x09e1('0x26')](function(_0x1006f6){_0x2cb5fa=_0x1006f6;if(!_['isNil'](_0x48574b)){return getUser(_0x159f56,_0x48574b[_0x09e1('0x24')],_0x2cb5fa);}else{return getUser(_0x159f56,null,_0x2cb5fa);}})[_0x09e1('0x26')](function(_0x4fe21a){_0x586840=_0x4fe21a;logger[_0x09e1('0xa')](_0x09e1('0x69'),_0x586840['id']);return getEndUser(_0x159f56,_0x47a66b[_0x09e1('0x71')],_0x47a66b['calleridnum'],_0x2cb5fa);})['then'](function(_0x385e20){_0xe9fe2b=_0x385e20;logger[_0x09e1('0xa')](_0x09e1('0x57'),_0xe9fe2b['id']);return getTicket(_0x159f56,_0x586840,_0xe9fe2b,_0x49e2b2,_0x47a66b,_0x49e2b2[_0x09e1('0x58')],_0x2cb5fa,_0x09e1('0x72'));})[_0x09e1('0x26')](function(_0x4d80fb){_0x43fb84=_0x4d80fb;logger[_0x09e1('0xa')](_0x09e1('0x59'));logger[_0x09e1('0xa')](_0x09e1('0x5a'),_0x43fb84['id']);return setRelationship(_0x2cb5fa,_0x586840,_0x43fb84,_0x09e1('0x6c'));})['then'](function(){return setRelationship(_0x2cb5fa,_0xe9fe2b,_0x43fb84,'contacts');})[_0x09e1('0x26')](function(){return getServerInfo(_0x2cb5fa);})['catch'](function(_0x32c0e1){logger[_0x09e1('0x63')]('['+_0x47a66b['lastevent'][_0x09e1('0x6f')]()+']',JSON[_0x09e1('0x2e')](_0x32c0e1));});}; \ No newline at end of file +var _0xc294=['trigger:browser:url','error','unmanaged','lastevent','toUpperCase','isNil','Inbound','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','JSON','Calls','Basic\x20%s','base64','get_server_info','stringify','info','Getting\x20agent\x20with\x20name','get_entry_list','format','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','customVariable','Variable','login','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','[QUEUE]','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s'];(function(_0x78b19f,_0x8c17e4){var _0x210dc3=function(_0x59768d){while(--_0x59768d){_0x78b19f['push'](_0x78b19f['shift']());}};_0x210dc3(++_0x8c17e4);}(_0xc294,0x1f3));var _0x4c29=function(_0x57db3a,_0x32dc3f){_0x57db3a=_0x57db3a-0x0;var _0x18dc71=_0xc294[_0x57db3a];return _0x18dc71;};'use strict';var _=require(_0x4c29('0x0'));var rp=require(_0x4c29('0x1'));var BPromise=require('bluebird');var md5=require(_0x4c29('0x2'));var util=require(_0x4c29('0x3'));var Redis=require(_0x4c29('0x4'));var intUtil=require(_0x4c29('0x5'));var config=require(_0x4c29('0x6'));var logger=require(_0x4c29('0x7'))(_0x4c29('0x8'));config['redis']=_['defaults'](config[_0x4c29('0x9')],{'host':_0x4c29('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c29('0x9')]));var def={'method':_0x4c29('0xb'),'json':!![]};function emit(_0x1f709e,_0x108003,_0x5d0a42){io['to'](_0x1f709e)[_0x4c29('0xc')](_0x108003,_0x5d0a42);}function getTicket(_0x43579e,_0x4d8b7f,_0x463c3a,_0xc52539,_0x338dc3,_0x466617,_0x26a8ae,_0x3d678f){logger['info'](_0x4c29('0xd'));var _0x5887f4=new Date();var _0x541dd1=[{'name':_0x4c29('0xe'),'value':intUtil[_0x4c29('0xf')](_0xc52539[_0x4c29('0x10')],_0x338dc3,'\x20')},{'name':_0x4c29('0x11'),'value':_0x4d8b7f['id']},{'name':_0x4c29('0x12'),'value':_0x4d8b7f['id']},{'name':_0x4c29('0x13'),'value':intUtil[_0x4c29('0xf')](_0xc52539['Descriptions'],_0x338dc3,'\x0a')},{'name':_0x4c29('0x14'),'value':_0x5887f4[_0x4c29('0x15')]()['slice'](0x0,0x13)[_0x4c29('0x16')]('T','\x20')},{'name':_0x4c29('0x17'),'value':'0'},{'name':_0x4c29('0x18'),'value':'15'},{'name':_0x4c29('0x19'),'value':_0x463c3a['id']},{'name':_0x4c29('0x1a'),'value':_0x4c29('0x1b')},{'name':_0x4c29('0x1c'),'value':_0x463c3a[_0x4c29('0xe')]},{'name':_0x4c29('0x1d'),'value':_0x3d678f}];if(_0x466617[_0x4c29('0x1e')]){_[_0x4c29('0x1f')](_0x466617,function(_0x5b5fcd){if(_0x338dc3[_0x5b5fcd[_0x4c29('0x20')]]){_0x541dd1[_0x4c29('0x21')]({'name':_0x5b5fcd[_0x4c29('0x22')],'value':_0x338dc3[_0x5b5fcd['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x4c29('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x26a8ae['id'],'module_name':_0x4c29('0x24'),'name_value_list':_0x541dd1})}});}function getAuth(_0x3fd2d5){return util['format'](_0x4c29('0x25'),new Buffer(_0x3fd2d5['apiKey']+':X')['toString'](_0x4c29('0x26')));}function getServerInfo(_0x488202){return request({'form':{'method':_0x4c29('0x27'),'input_type':_0x4c29('0x23'),'response_type':_0x4c29('0x23'),'rest_data':JSON[_0x4c29('0x28')]({'session':_0x488202['id']})}});}function getUser(_0x2da68b,_0x502dda,_0x5908d4){if(!_['isNil'](_0x502dda)){logger[_0x4c29('0x29')](_0x4c29('0x2a'),_0x502dda);return request({'form':{'method':_0x4c29('0x2b'),'input_type':_0x4c29('0x23'),'response_type':_0x4c29('0x23'),'rest_data':JSON[_0x4c29('0x28')]({'session':_0x5908d4['id'],'module_name':'Employees','query':util[_0x4c29('0x2c')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x502dda),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4c29('0x2d')](function(_0x3fbdcb){if(_0x3fbdcb[_0x4c29('0x2e')][_0x4c29('0x1e')]){var _0x21bef1=_['find'](_0x3fbdcb[_0x4c29('0x2e')],function(_0x227b6b){return _0x227b6b['name_value_list']['user_name'][_0x4c29('0x2f')]===_0x502dda;});if(_0x21bef1){logger[_0x4c29('0x29')](_0x4c29('0x30'));return BPromise[_0x4c29('0x31')]({'id':_0x21bef1['name_value_list']['id'][_0x4c29('0x2f')],'name':_0x21bef1[_0x4c29('0x32')][_0x4c29('0xe')]['value']});}}logger[_0x4c29('0x29')](_0x4c29('0x33'));return BPromise[_0x4c29('0x31')]({'id':_0x5908d4[_0x4c29('0x32')][_0x4c29('0x34')][_0x4c29('0x2f')],'name':_0x5908d4[_0x4c29('0x32')][_0x4c29('0x35')]['value']});});}else{logger[_0x4c29('0x29')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4c29('0x31')]({'id':_0x5908d4['name_value_list']['user_id'][_0x4c29('0x2f')],'name':_0x5908d4[_0x4c29('0x32')][_0x4c29('0x35')][_0x4c29('0x2f')]});}}function getEndUser(_0x23db9e,_0x5bdbd2,_0x13e7c2,_0x25be47){logger[_0x4c29('0x29')](_0x4c29('0x36'),_0x13e7c2);return request({'form':{'method':_0x4c29('0x2b'),'input_type':_0x4c29('0x23'),'response_type':'JSON','rest_data':JSON[_0x4c29('0x28')]({'session':_0x25be47['id'],'module_name':_0x4c29('0x1b'),'query':util['format'](_0x4c29('0x37'),_0x13e7c2),'order_by':'','offset':'0','select_fields':['id','name',_0x4c29('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x31fa6a){if(_0x31fa6a['entry_list'][_0x4c29('0x1e')]){var _0x1b8314=_['find'](_0x31fa6a[_0x4c29('0x2e')],function(_0x17738d){return _0x17738d[_0x4c29('0x32')][_0x4c29('0x38')]['value']===_0x13e7c2;});if(_0x1b8314){logger[_0x4c29('0x29')](_0x4c29('0x39'));return BPromise[_0x4c29('0x31')]({'id':_0x1b8314[_0x4c29('0x32')]['id'][_0x4c29('0x2f')],'name':_0x1b8314['name_value_list'][_0x4c29('0xe')][_0x4c29('0x2f')],'phone':_0x1b8314[_0x4c29('0x32')]['phone_home'][_0x4c29('0x2f')]});}}else{logger[_0x4c29('0x29')](_0x4c29('0x3a'));return request({'form':{'method':_0x4c29('0x3b'),'input_type':_0x4c29('0x23'),'response_type':_0x4c29('0x23'),'rest_data':JSON['stringify']({'session':_0x25be47['id'],'module_name':_0x4c29('0x1b'),'name_value_list':[{'name':_0x4c29('0x3c'),'value':_0x5bdbd2!==_0x4c29('0x3d')?_0x5bdbd2:util[_0x4c29('0x2c')](_0x4c29('0x3e'),_0x13e7c2)},{'name':_0x4c29('0x38'),'value':_0x13e7c2}]})}})[_0x4c29('0x2d')](function(_0x1090ca){logger[_0x4c29('0x29')]('Enduser\x20created.');return BPromise[_0x4c29('0x31')]({'id':_0x1090ca['id'],'name':_0x1090ca[_0x4c29('0x2e')][_0x4c29('0x3c')][_0x4c29('0x2f')],'phone':_0x1090ca[_0x4c29('0x2e')][_0x4c29('0x38')]['value']});});}});}function request(_0x4455a7){logger['debug'](_0x4c29('0x3f'),JSON[_0x4c29('0x28')](_0x4455a7));return rp(_[_0x4c29('0x40')](def,_0x4455a7));}function getTags(_0xf248db,_0x3932da){var _0x103ed3=[];if(_0xf248db&&_0xf248db[_0x4c29('0x1e')]>0x0){_0x103ed3=_[_0x4c29('0x41')](_0xf248db,_0x3932da);}return _0x103ed3;}function getCustomFields(_0x20b46e,_0x3a39cc){var _0x35973c=[];var _0x61f208={'custom_fields':[]};if(_0x20b46e[_0x4c29('0x1e')]>0x0){_[_0x4c29('0x1f')](_0x20b46e,function(_0x566e63){if(_0x566e63[_0x4c29('0x42')]===_0x4c29('0x43')&&_0x566e63[_0x4c29('0x44')]&&!_0x566e63[_0x4c29('0x45')]){_0x61f208[_0x566e63[_0x4c29('0x44')][_0x4c29('0x46')]()]=_0x566e63[_0x4c29('0x47')][_0x4c29('0x48')]();}else if(_0x566e63['type']===_0x4c29('0x43')&&_0x566e63[_0x4c29('0x22')]&&_0x566e63['customField']){_0x61f208[_0x4c29('0x49')][_0x4c29('0x21')]({'id':_0x566e63[_0x4c29('0x22')],'value':_0x566e63[_0x4c29('0x47')][_0x4c29('0x48')]()});}else if(_0x566e63[_0x4c29('0x42')]==='variable'&&_0x566e63[_0x4c29('0x20')]&&_0x566e63[_0x4c29('0x22')]&&_0x566e63[_0x4c29('0x45')]){_0x3a39cc[_0x566e63[_0x4c29('0x20')]]&&_0x61f208[_0x4c29('0x49')][_0x4c29('0x21')]({'id':_0x566e63[_0x4c29('0x22')],'value':_0x3a39cc[_0x566e63[_0x4c29('0x20')]][_0x4c29('0x48')]()});}else if(_0x566e63['type']===_0x4c29('0x4a')&&_0x566e63[_0x4c29('0x4b')]&&_0x566e63[_0x4c29('0x4b')]['name']&&_0x566e63[_0x4c29('0x22')]&&_0x566e63[_0x4c29('0x45')]){_0x3a39cc[_0x566e63[_0x4c29('0x4b')][_0x4c29('0xe')][_0x4c29('0x46')]()]&&_0x61f208[_0x4c29('0x49')][_0x4c29('0x21')]({'id':_0x566e63['idField'],'value':_0x3a39cc[_0x566e63[_0x4c29('0x4b')]['name'][_0x4c29('0x46')]()][_0x4c29('0x48')]()});}});}return _0x61f208;}function getConnection(_0x4af990){return request({'method':_0x4c29('0xb'),'form':{'method':_0x4c29('0x4c'),'input_type':_0x4c29('0x23'),'response_type':_0x4c29('0x23'),'rest_data':JSON[_0x4c29('0x28')]({'user_auth':{'user_name':_0x4af990['username'],'password':_0x4af990[_0x4c29('0x4d')],'encryption':'PLAIN'},'application':_0x4c29('0x4e')})}})[_0x4c29('0x2d')](function(_0x580aea){var _0x37ab2e=_0x580aea;if(_0x37ab2e['id']){def[_0x4c29('0x4f')]=_0x37ab2e['id'];return BPromise[_0x4c29('0x31')](_0x37ab2e);}else{throw new Error(util[_0x4c29('0x2c')](_0x4c29('0x50'),_0x4af990['id']));}});}function setRelationship(_0x23143e,_0x364a54,_0x4084cf,_0x37eb47){return request({'form':{'method':_0x4c29('0x51'),'input_type':_0x4c29('0x23'),'response_type':_0x4c29('0x23'),'rest_data':JSON[_0x4c29('0x28')]({'session':_0x23143e['id'],'module_name':_0x4c29('0x24'),'module_id':_0x4084cf['id'],'link_field_name':_0x37eb47,'related_ids':[_0x364a54['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4c29('0x52')]=function(_0x3f06ad,_0x23c98f,_0x163105,_0x459cc2,_0x41cf56,_0x4ea32b){var _0x781b73,_0x2f51e4,_0x26c75b,_0x5ea675;_0x4ea32b[_0x4c29('0x53')]=intUtil[_0x4c29('0x54')](_0x4ea32b[_0x4c29('0x53')]);_0x4ea32b[_0x4c29('0x55')]=intUtil[_0x4c29('0x54')](_0x4ea32b[_0x4c29('0x55')]);def['uri']=util[_0x4c29('0x2c')](_0x4c29('0x56'),_0x4ea32b['remoteUri']);if(_0x41cf56&&_0x41cf56[_0x4c29('0x57')]){logger['info']('[QUEUE]',_0x4c29('0x58'));_0x23c98f[_0x4c29('0x59')]=util[_0x4c29('0x2c')](_0x4c29('0x5a'),_0x4ea32b[_0x4c29('0x55')],_0x23c98f['uniqueid'],md5(_0x23c98f[_0x4c29('0x5b')]));}else{_0x23c98f[_0x4c29('0x59')]='';}return getConnection(_0x4ea32b)[_0x4c29('0x2d')](function(_0x4af7e1){_0x5ea675=_0x4af7e1;return getUser(_0x4ea32b,_0x459cc2[_0x4c29('0xe')],_0x5ea675);})[_0x4c29('0x2d')](function(_0x52ee04){_0x781b73=_0x52ee04;logger[_0x4c29('0x29')](_0x4c29('0x5c'),_0x781b73['id']);return getEndUser(_0x4ea32b,_0x23c98f[_0x4c29('0x5d')],_0x23c98f[_0x4c29('0x5e')],_0x5ea675);})[_0x4c29('0x2d')](function(_0x58b051){_0x2f51e4=_0x58b051;logger['info'](_0x4c29('0x5f'),_0x2f51e4['id']);return getTicket(_0x4ea32b,_0x781b73,_0x2f51e4,_0x163105,_0x23c98f,_0x163105['Fields'],_0x5ea675,'Inbound');})[_0x4c29('0x2d')](function(_0x52fdf1){_0x26c75b=_0x52fdf1;logger[_0x4c29('0x29')](_0x4c29('0x60'));logger[_0x4c29('0x29')](_0x4c29('0x61'),_0x26c75b['id']);return setRelationship(_0x5ea675,_0x781b73,_0x26c75b,'users');})[_0x4c29('0x2d')](function(){return setRelationship(_0x5ea675,_0x2f51e4,_0x26c75b,_0x4c29('0x62'));})[_0x4c29('0x2d')](function(){return getServerInfo(_0x5ea675);})[_0x4c29('0x2d')](function(_0x37fe94){var _0x57a940=parseInt(_0x37fe94[_0x4c29('0x63')][_0x4c29('0x64')](0x0));var _0x9d76df=util[_0x4c29('0x2c')](_0x4c29('0x65'),_0x4ea32b[_0x4c29('0x53')],_0x26c75b['id']);if(_0x57a940>0x6){_0x9d76df=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4ea32b['remoteUri'],_0x26c75b['id']);}logger[_0x4c29('0x29')]('[QUEUE]',_0x4c29('0x66'));emit(util[_0x4c29('0x2c')](_0x4c29('0x67'),_0x459cc2[_0x4c29('0xe')]),'trigger:browser:url',{'uri':_0x9d76df});})[_0x4c29('0x68')](function(_0x56f826){logger['error'](_0x4c29('0x69'),JSON[_0x4c29('0x28')](_0x56f826));});};exports[_0x4c29('0x6a')]=function(_0x495d97,_0x27fd25,_0x4e986b,_0x3a3ff3,_0xbd97b1,_0x51fc38,_0x16e132){var _0x1f0139,_0x4e6e87,_0x1a591d,_0x28b8dc;_0x51fc38[_0x4c29('0x53')]=intUtil[_0x4c29('0x54')](_0x51fc38['remoteUri']);_0x51fc38['serverUrl']=intUtil[_0x4c29('0x54')](_0x51fc38[_0x4c29('0x55')]);def[_0x4c29('0x6b')]=util['format']('%s/service/v4_1/rest.php',_0x51fc38[_0x4c29('0x53')]);if(_0x16e132&&_0x16e132[_0x4c29('0x6c')]&&_0x16e132['recordingFormat']!==_0x4c29('0x6d')){logger[_0x4c29('0x29')](_0x4c29('0x6e'),_0x4c29('0x58'));_0x27fd25[_0x4c29('0x59')]=util[_0x4c29('0x2c')](_0x4c29('0x5a'),_0x51fc38[_0x4c29('0x55')],_0x27fd25[_0x4c29('0x5b')],md5(_0x27fd25[_0x4c29('0x5b')]));}return getConnection(_0x51fc38)[_0x4c29('0x2d')](function(_0x759acc){_0x28b8dc=_0x759acc;return getUser(_0x51fc38,_0x3a3ff3[_0x4c29('0xe')],_0x28b8dc);})['then'](function(_0x38108b){_0x1f0139=_0x38108b;logger[_0x4c29('0x29')](_0x4c29('0x5c'),_0x1f0139['id']);return getEndUser(_0x51fc38,_0x27fd25[_0x4c29('0x6f')],_0x27fd25['destcalleridnum'],_0x28b8dc);})[_0x4c29('0x2d')](function(_0x48b66b){_0x4e6e87=_0x48b66b;logger[_0x4c29('0x29')](_0x4c29('0x5f'),_0x4e6e87['id']);return getTicket(_0x51fc38,_0x1f0139,_0x4e6e87,_0x4e986b,_0x27fd25,_0x4e986b[_0x4c29('0x70')],_0x28b8dc,_0x4c29('0x71'));})[_0x4c29('0x2d')](function(_0x39e5d5){_0x1a591d=_0x39e5d5;logger['info'](_0x4c29('0x60'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x1a591d['id']);return setRelationship(_0x28b8dc,_0x1f0139,_0x1a591d,_0x4c29('0x72'));})[_0x4c29('0x2d')](function(){return setRelationship(_0x28b8dc,_0x4e6e87,_0x1a591d,_0x4c29('0x62'));})[_0x4c29('0x2d')](function(){return getServerInfo(_0x28b8dc);})[_0x4c29('0x2d')](function(_0x4ac574){var _0x5e1ef2=parseInt(_0x4ac574[_0x4c29('0x63')][_0x4c29('0x64')](0x0));var _0x1ef65c=util[_0x4c29('0x2c')](_0x4c29('0x65'),_0x51fc38[_0x4c29('0x53')],_0x1a591d['id']);if(_0x5e1ef2>0x6){_0x1ef65c=util[_0x4c29('0x2c')](_0x4c29('0x73'),_0x51fc38['remoteUri'],_0x1a591d['id']);}logger[_0x4c29('0x29')](_0x4c29('0x6e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4c29('0x2c')](_0x4c29('0x67'),_0x3a3ff3[_0x4c29('0xe')]),_0x4c29('0x74'),{'uri':_0x1ef65c});})['catch'](function(_0x4b7c56){logger[_0x4c29('0x75')](_0x4c29('0x6e'),JSON[_0x4c29('0x28')](_0x4b7c56));});};exports[_0x4c29('0x76')]=function(_0x34a389,_0x1077fc,_0x3a4a2d,_0x2f934b,_0x2e87ec,_0x4e70f1){var _0x4dd1d6,_0x3d32d2,_0x4f8b68,_0x1832f7;_0x4e70f1[_0x4c29('0x53')]=intUtil[_0x4c29('0x54')](_0x4e70f1[_0x4c29('0x53')]);_0x4e70f1[_0x4c29('0x55')]=intUtil['stripTrailingSlash'](_0x4e70f1[_0x4c29('0x55')]);def[_0x4c29('0x6b')]=util['format'](_0x4c29('0x56'),_0x4e70f1[_0x4c29('0x53')]);if(_0x2e87ec&&_0x2e87ec[_0x4c29('0x57')]){logger[_0x4c29('0x29')]('['+_0x1077fc[_0x4c29('0x77')][_0x4c29('0x78')]()+']',_0x4c29('0x58'));_0x1077fc[_0x4c29('0x59')]=util[_0x4c29('0x2c')](_0x4c29('0x5a'),_0x4e70f1[_0x4c29('0x55')],_0x1077fc[_0x4c29('0x5b')],md5(_0x1077fc[_0x4c29('0x5b')]));}else{_0x1077fc[_0x4c29('0x59')]='';}return getConnection(_0x4e70f1)[_0x4c29('0x2d')](function(_0x368985){_0x1832f7=_0x368985;if(!_[_0x4c29('0x79')](_0x2f934b)){return getUser(_0x4e70f1,_0x2f934b[_0x4c29('0xe')],_0x1832f7);}else{return getUser(_0x4e70f1,null,_0x1832f7);}})[_0x4c29('0x2d')](function(_0x2eb516){_0x4dd1d6=_0x2eb516;logger[_0x4c29('0x29')](_0x4c29('0x5c'),_0x4dd1d6['id']);return getEndUser(_0x4e70f1,_0x1077fc[_0x4c29('0x5d')],_0x1077fc[_0x4c29('0x5e')],_0x1832f7);})[_0x4c29('0x2d')](function(_0x10256e){_0x3d32d2=_0x10256e;logger[_0x4c29('0x29')](_0x4c29('0x5f'),_0x3d32d2['id']);return getTicket(_0x4e70f1,_0x4dd1d6,_0x3d32d2,_0x3a4a2d,_0x1077fc,_0x3a4a2d[_0x4c29('0x70')],_0x1832f7,_0x4c29('0x7a'));})['then'](function(_0x1ccfa9){_0x4f8b68=_0x1ccfa9;logger[_0x4c29('0x29')](_0x4c29('0x60'));logger['info'](_0x4c29('0x61'),_0x4f8b68['id']);return setRelationship(_0x1832f7,_0x4dd1d6,_0x4f8b68,_0x4c29('0x72'));})[_0x4c29('0x2d')](function(){return setRelationship(_0x1832f7,_0x3d32d2,_0x4f8b68,_0x4c29('0x62'));})['then'](function(){return getServerInfo(_0x1832f7);})['catch'](function(_0x4ccb90){logger[_0x4c29('0x75')]('['+_0x1077fc['lastevent'][_0x4c29('0x78')]()+']',JSON[_0x4c29('0x28')](_0x4ccb90));});}; \ 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 8438c3d..f02f8a7 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 _0x0085=['util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','join','slice','substring','lastIndexOf','validateEmail','isNil','test'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0085,0x138));var _0x5008=function(_0x4a3dc5,_0xa878cd){_0x4a3dc5=_0x4a3dc5-0x0;var _0x27ff50=_0x0085[_0x4a3dc5];return _0x27ff50;};'use strict';var _=require('lodash');var util=require(_0x5008('0x0'));exports[_0x5008('0x1')]=function(_0x104ab7,_0x567641,_0x12d403){var _0x5e5504=[];if(_0x104ab7[_0x5008('0x2')]>0x0){var _0xc2dd9d=_[_0x5008('0x3')](_0x104ab7,['id']);for(var _0x24ead7=0x0;_0x24ead7<_0xc2dd9d[_0x5008('0x2')];_0x24ead7++){var _0x315a7e=_0xc2dd9d[_0x24ead7];if(_0x315a7e[_0x5008('0x4')]===_0x5008('0x5')){_0x5e5504[_0x5008('0x6')](_0x315a7e['content']);}else if(_0x315a7e[_0x5008('0x4')]===_0x5008('0x7')&&_0x315a7e[_0x5008('0x8')]){_0x567641[_0x315a7e[_0x5008('0x8')]]&&_0x5e5504[_0x5008('0x6')](_0x567641[_0x315a7e[_0x5008('0x8')]][_0x5008('0x9')]());}else if(_0x315a7e[_0x5008('0x4')]===_0x5008('0xa')&&_0x315a7e[_0x5008('0xb')]&&_0x315a7e[_0x5008('0xb')]['name']){_0x567641[_0x315a7e[_0x5008('0xb')][_0x5008('0xc')][_0x5008('0xd')]()]&&_0x5e5504[_0x5008('0x6')](_0x567641[_0x315a7e[_0x5008('0xb')]['name']['toLowerCase']()][_0x5008('0x9')]());}else if(_0x315a7e['type']===_0x5008('0xe')){if(_0x315a7e[_0x5008('0xf')]===_0x5008('0x5')&&_0x315a7e['key']){_0x5e5504[_0x5008('0x6')](util[_0x5008('0x10')](_0x5008('0x11'),_0x315a7e[_0x5008('0x12')],_0x315a7e['keyContent']));}else if(_0x315a7e[_0x5008('0xf')]===_0x5008('0x7')&&_0x315a7e['variableName']&&_0x315a7e['key']){_0x567641[_0x315a7e['variableName']]&&_0x5e5504[_0x5008('0x6')](util[_0x5008('0x10')]('%s:\x20%s',_0x315a7e[_0x5008('0x12')],_0x567641[_0x315a7e[_0x5008('0x8')]]));}else if(_0x315a7e['keyType']===_0x5008('0xa')&&_0x315a7e[_0x5008('0xb')]&&_0x315a7e[_0x5008('0xb')][_0x5008('0xc')]&&_0x315a7e[_0x5008('0x12')]){_0x567641[_0x315a7e['Variable'][_0x5008('0xc')]['toLowerCase']()]&&_0x5e5504[_0x5008('0x6')](util[_0x5008('0x10')](_0x5008('0x11'),_0x315a7e[_0x5008('0x12')],_0x567641[_0x315a7e[_0x5008('0xb')][_0x5008('0xc')][_0x5008('0xd')]()]));}}}}return _0x5e5504[_0x5008('0x13')](_0x12d403);};exports['stripTrailingSlash']=function(_0x203944){var _0x4883c4=_0x203944[_0x5008('0x14')](-0x1);if(_0x4883c4==='/'){_0x203944=_0x203944[_0x5008('0x15')](0x0,_0x203944[_0x5008('0x16')](_0x4883c4));}return _0x203944;};exports[_0x5008('0x17')]=function(_0x3bc48e){if(!_[_0x5008('0x18')](_0x3bc48e)&&_0x3bc48e!==''){var _0x1841d0=/^(([^<>()\[\]\\.,;:\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 _0x1841d0[_0x5008('0x19')](String(_0x3bc48e)[_0x5008('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x2319=['keyContent','customVariable','toLowerCase','join','stripTrailingSlash','isNil','test','lodash','util','getString','length','type','string','push','content','variable','variableName','Variable','name','toString','keyType','key','format','%s:\x20%s'];(function(_0x55772e,_0x3a63c3){var _0x465cf4=function(_0x288dce){while(--_0x288dce){_0x55772e['push'](_0x55772e['shift']());}};_0x465cf4(++_0x3a63c3);}(_0x2319,0x187));var _0x9231=function(_0x38f794,_0x238ced){_0x38f794=_0x38f794-0x0;var _0x5cf07e=_0x2319[_0x38f794];return _0x5cf07e;};'use strict';var _=require(_0x9231('0x0'));var util=require(_0x9231('0x1'));exports[_0x9231('0x2')]=function(_0x337b76,_0x4c2b73,_0x47fd40){var _0x189641=[];if(_0x337b76[_0x9231('0x3')]>0x0){var _0x23f213=_['sortBy'](_0x337b76,['id']);for(var _0x12749c=0x0;_0x12749c<_0x23f213['length'];_0x12749c++){var _0x40a147=_0x23f213[_0x12749c];if(_0x40a147[_0x9231('0x4')]===_0x9231('0x5')){_0x189641[_0x9231('0x6')](_0x40a147[_0x9231('0x7')]);}else if(_0x40a147[_0x9231('0x4')]===_0x9231('0x8')&&_0x40a147[_0x9231('0x9')]){_0x4c2b73[_0x40a147[_0x9231('0x9')]]&&_0x189641[_0x9231('0x6')](_0x4c2b73[_0x40a147[_0x9231('0x9')]]['toString']());}else if(_0x40a147[_0x9231('0x4')]==='customVariable'&&_0x40a147[_0x9231('0xa')]&&_0x40a147[_0x9231('0xa')][_0x9231('0xb')]){_0x4c2b73[_0x40a147[_0x9231('0xa')][_0x9231('0xb')]['toLowerCase']()]&&_0x189641[_0x9231('0x6')](_0x4c2b73[_0x40a147[_0x9231('0xa')][_0x9231('0xb')]['toLowerCase']()][_0x9231('0xc')]());}else if(_0x40a147[_0x9231('0x4')]==='keyValue'){if(_0x40a147[_0x9231('0xd')]===_0x9231('0x5')&&_0x40a147[_0x9231('0xe')]){_0x189641[_0x9231('0x6')](util[_0x9231('0xf')](_0x9231('0x10'),_0x40a147[_0x9231('0xe')],_0x40a147[_0x9231('0x11')]));}else if(_0x40a147[_0x9231('0xd')]===_0x9231('0x8')&&_0x40a147[_0x9231('0x9')]&&_0x40a147[_0x9231('0xe')]){_0x4c2b73[_0x40a147['variableName']]&&_0x189641[_0x9231('0x6')](util['format'](_0x9231('0x10'),_0x40a147[_0x9231('0xe')],_0x4c2b73[_0x40a147[_0x9231('0x9')]]));}else if(_0x40a147[_0x9231('0xd')]===_0x9231('0x12')&&_0x40a147[_0x9231('0xa')]&&_0x40a147[_0x9231('0xa')][_0x9231('0xb')]&&_0x40a147[_0x9231('0xe')]){_0x4c2b73[_0x40a147[_0x9231('0xa')]['name'][_0x9231('0x13')]()]&&_0x189641['push'](util['format'](_0x9231('0x10'),_0x40a147[_0x9231('0xe')],_0x4c2b73[_0x40a147[_0x9231('0xa')][_0x9231('0xb')][_0x9231('0x13')]()]));}}}}return _0x189641[_0x9231('0x14')](_0x47fd40);};exports[_0x9231('0x15')]=function(_0x2fc27f){var _0x52917f=_0x2fc27f['slice'](-0x1);if(_0x52917f==='/'){_0x2fc27f=_0x2fc27f['substring'](0x0,_0x2fc27f['lastIndexOf'](_0x52917f));}return _0x2fc27f;};exports['validateEmail']=function(_0x537011){if(!_[_0x9231('0x16')](_0x537011)&&_0x537011!==''){var _0xa77750=/^(([^<>()\[\]\\.,;:\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 _0xa77750[_0x9231('0x17')](String(_0x537011)[_0x9231('0x13')]());}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 e412ec7..e37677a 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(_0x3e6440,_0xa10c2b){var _0xc0b1bf=function(_0x200b12){while(--_0x200b12){_0x3e6440['push'](_0x3e6440['shift']());}};_0xc0b1bf(++_0xa10c2b);}(_0xe706,0xa3));var _0x6e70=function(_0x874a49,_0x5b07bc){_0x874a49=_0x874a49-0x0;var _0x343d2f=_0xe706[_0x874a49];return _0x343d2f;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x53db21,_0x3c4a12){var _0x299779=function(_0x156e73){while(--_0x156e73){_0x53db21['push'](_0x53db21['shift']());}};_0x299779(++_0x3c4a12);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 9b3dd69..cd99992 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 _0x49cf=['idField','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','trigger:browser:url','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','localhost','socket.io-emitter','redis','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.','%s/users/me.json','type:user\x20role:end-user\x20phone:%s','filter','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','nameField','toLowerCase','content','string','type','customField','custom_fields','push','variable','variableName'];(function(_0x4ee9dd,_0x2277f3){var _0x5d0a1e=function(_0x1230f3){while(--_0x1230f3){_0x4ee9dd['push'](_0x4ee9dd['shift']());}};_0x5d0a1e(++_0x2277f3);}(_0x49cf,0x9c));var _0xf49c=function(_0x39c2f4,_0x1d571e){_0x39c2f4=_0x39c2f4-0x0;var _0x119804=_0x49cf[_0x39c2f4];return _0x119804;};'use strict';var _=require(_0xf49c('0x0'));var rp=require(_0xf49c('0x1'));var md5=require(_0xf49c('0x2'));var util=require(_0xf49c('0x3'));var Redis=require(_0xf49c('0x4'));var intUtil=require(_0xf49c('0x5'));var config=require(_0xf49c('0x6'));var logger=require(_0xf49c('0x7'))(_0xf49c('0x8'));config['redis']=_[_0xf49c('0x9')](config['redis'],{'host':_0xf49c('0xa'),'port':0x18eb});var io=require(_0xf49c('0xb'))(new Redis(config[_0xf49c('0xc')]));function emit(_0x871600,_0x5c2ce8,_0x1d3200){io['to'](_0x871600)['emit'](_0x5c2ce8,_0x1d3200);}var headers={'Content-Type':'application/json','Accept':_0xf49c('0xd')};function getTicket(_0x29fb01,_0x38e84a,_0xc1dc7e,_0x25b483,_0x4d1325){logger[_0xf49c('0xe')](_0xf49c('0xf'));return request({'uri':util[_0xf49c('0x10')]('%s/tickets.json',_0x29fb01[_0xf49c('0x11')]),'method':_0xf49c('0x12'),'body':{'ticket':_['merge']({'requester_id':_0xc1dc7e['id'],'submitter_id':_0x38e84a?_0x38e84a['id']:undefined,'assignee_id':_0x38e84a?_0x38e84a['id']:undefined,'tags':getTags(_0x25b483[_0xf49c('0x13')],_0xf49c('0x14')),'subject':intUtil[_0xf49c('0x15')](_0x25b483[_0xf49c('0x16')],_0x4d1325,'\x20'),'description':intUtil[_0xf49c('0x15')](_0x25b483[_0xf49c('0x17')],_0x4d1325,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf49c('0x15')](_0x25b483[_0xf49c('0x17')],_0x4d1325,'\x0a')}},getCustomFields(_0x25b483['Fields'],_0x4d1325))}})[_0xf49c('0x18')](function(_0x165dd6){logger[_0xf49c('0xe')]('Ticket\x20created!');return _0x165dd6[_0xf49c('0x19')];});}function getUser(_0x34916e,_0x2d3f60){if(intUtil[_0xf49c('0x1a')](_0x2d3f60)){logger['info'](_0xf49c('0x1b'),_0x2d3f60);return request({'uri':util[_0xf49c('0x10')](_0xf49c('0x1c'),_0x34916e['remoteUri']),'qs':{'query':util[_0xf49c('0x10')](_0xf49c('0x1d'),_0x2d3f60)}})[_0xf49c('0x18')](function(_0x474cd3){if(_0x474cd3[_0xf49c('0x1e')]){logger['info'](_0xf49c('0x1f'));return _[_0xf49c('0x20')](_0x474cd3[_0xf49c('0x21')],{'email':_0x2d3f60,'role':_0xf49c('0x22')});}else{logger[_0xf49c('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf49c('0x10')]('%s/users/me.json',_0x34916e[_0xf49c('0x11')])})[_0xf49c('0x18')](function(_0x23c818){logger['info'](_0xf49c('0x23'));return _0x23c818['user'];});}});}else{logger[_0xf49c('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf49c('0x10')](_0xf49c('0x24'),_0x34916e[_0xf49c('0x11')])})[_0xf49c('0x18')](function(_0x99dec9){logger[_0xf49c('0xe')](_0xf49c('0x23'));return _0x99dec9['user'];});}}function getEndUser(_0x2a7bbb,_0x198eb6,_0x5b5b74){logger[_0xf49c('0xe')]('Searching\x20enduser\x20with\x20phone',_0x5b5b74);return request({'uri':util[_0xf49c('0x10')]('%s/search.json',_0x2a7bbb[_0xf49c('0x11')]),'qs':{'query':util[_0xf49c('0x10')](_0xf49c('0x25'),_0x5b5b74)}})[_0xf49c('0x18')](function(_0x2070ee){var _0x375de2;if(_0x2070ee['results']['length']){_0x2070ee['results']=_[_0xf49c('0x26')](_0x2070ee[_0xf49c('0x21')],{'suspended':![],'role':'end-user'});if(_0x2070ee['results'][_0xf49c('0x27')]){_0x375de2=_['first'](_0x2070ee[_0xf49c('0x21')]);}}if(_0x375de2){logger[_0xf49c('0xe')](_0xf49c('0x28'));return _0x375de2;}else{logger['info'](_0xf49c('0x29'));return request({'uri':util['format'](_0xf49c('0x2a'),_0x2a7bbb[_0xf49c('0x11')]),'method':_0xf49c('0x12'),'body':{'user':{'role':_0xf49c('0x2b'),'name':util['format'](_0xf49c('0x2c'),_0x198eb6||_0x5b5b74),'phone':_0x5b5b74}}})[_0xf49c('0x18')](function(_0x3cd3a3){logger[_0xf49c('0xe')](_0xf49c('0x2d'));return _0x3cd3a3[_0xf49c('0x2e')];});}});}function getAuth(_0x2d3101){var _0x2483b7;if(_0x2d3101[_0xf49c('0x2f')]===_0xf49c('0x30')){_0x2483b7=util[_0xf49c('0x10')](_0xf49c('0x31'),_0x2d3101['username'],_0x2d3101[_0xf49c('0x30')]);}else if(_0x2d3101[_0xf49c('0x2f')]===_0xf49c('0x32')){_0x2483b7=util[_0xf49c('0x10')](_0xf49c('0x33'),_0x2d3101[_0xf49c('0x34')],_0x2d3101[_0xf49c('0x32')]);}return util['format'](_0xf49c('0x35'),new Buffer(_0x2483b7)[_0xf49c('0x36')](_0xf49c('0x37')));}function request(_0x5bc6b3){logger[_0xf49c('0x38')](_0xf49c('0x39'),JSON[_0xf49c('0x3a')](_0x5bc6b3));return rp(_[_0xf49c('0x9')](_0x5bc6b3,{'method':_0xf49c('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x267a21,_0x50f4cc){var _0x12f02e=[];if(_0x267a21&&_0x267a21[_0xf49c('0x27')]>0x0){_0x12f02e=_[_0xf49c('0x3c')](_0x267a21,_0x50f4cc);}return _0x12f02e;}function getCustomFields(_0x2774f3,_0x1e93ce){var _0x4e13f2=[];var _0x2b428c={'custom_fields':[]};if(_0x2774f3[_0xf49c('0x27')]>0x0){_[_0xf49c('0x3d')](_0x2774f3,function(_0x53f0c8){if(_[_0xf49c('0x3e')](['string',_0xf49c('0x3f')],_0x53f0c8['type'])&&_0x53f0c8['nameField']&&!_0x53f0c8['customField']){_0x2b428c[_0x53f0c8[_0xf49c('0x40')][_0xf49c('0x41')]()]=_0x53f0c8[_0xf49c('0x42')][_0xf49c('0x36')]();}else if(_[_0xf49c('0x3e')]([_0xf49c('0x43'),_0xf49c('0x3f')],_0x53f0c8[_0xf49c('0x44')])&&_0x53f0c8['idField']&&_0x53f0c8[_0xf49c('0x45')]){_0x2b428c[_0xf49c('0x46')][_0xf49c('0x47')]({'id':_0x53f0c8['idField'],'value':_0x53f0c8[_0xf49c('0x42')][_0xf49c('0x36')]()});}else if(_0x53f0c8[_0xf49c('0x44')]===_0xf49c('0x48')&&_0x53f0c8[_0xf49c('0x49')]&&_0x53f0c8['idField']&&_0x53f0c8['customField']){_0x1e93ce[_0x53f0c8[_0xf49c('0x49')]]&&_0x2b428c[_0xf49c('0x46')][_0xf49c('0x47')]({'id':_0x53f0c8[_0xf49c('0x4a')],'value':_0x1e93ce[_0x53f0c8[_0xf49c('0x49')]][_0xf49c('0x36')]()});}else if(_0x53f0c8['type']===_0xf49c('0x4b')&&_0x53f0c8[_0xf49c('0x4c')]&&_0x53f0c8[_0xf49c('0x4c')]['name']&&_0x53f0c8[_0xf49c('0x4a')]&&_0x53f0c8[_0xf49c('0x45')]){_0x1e93ce[_0x53f0c8[_0xf49c('0x4c')]['name'][_0xf49c('0x41')]()]&&_0x2b428c[_0xf49c('0x46')][_0xf49c('0x47')]({'id':_0x53f0c8['idField'],'value':_0x1e93ce[_0x53f0c8[_0xf49c('0x4c')][_0xf49c('0x14')]['toLowerCase']()][_0xf49c('0x36')]()});}});}return _0x2b428c;}exports['queue']=function(_0x466c61,_0x133791,_0x42538e,_0x38e910,_0x29385a,_0x296d11){var _0x472e8f,_0x24733b;_0x296d11[_0xf49c('0x11')]=intUtil[_0xf49c('0x4d')](_0x296d11[_0xf49c('0x11')]);_0x296d11[_0xf49c('0x4e')]=intUtil[_0xf49c('0x4d')](_0x296d11[_0xf49c('0x4e')]);if(_0x29385a&&_0x29385a['monitor_format']){logger[_0xf49c('0xe')](_0xf49c('0x4f'),_0xf49c('0x50'));_0x133791['recordingURL']=util['format'](_0xf49c('0x51'),_0x296d11[_0xf49c('0x4e')],_0x133791['uniqueid'],md5(_0x133791[_0xf49c('0x52')]));}else{_0x133791[_0xf49c('0x53')]='';}headers[_0xf49c('0x54')]=getAuth(_0x296d11);return getUser(_0x296d11,_0x38e910[_0xf49c('0x55')])[_0xf49c('0x18')](function(_0x16a5cc){_0x472e8f=_0x16a5cc;logger[_0xf49c('0xe')](_0xf49c('0x56'),_0x472e8f['id']);return getEndUser(_0x296d11,_0x133791[_0xf49c('0x57')],_0x133791[_0xf49c('0x58')]);})[_0xf49c('0x18')](function(_0x246910){_0x24733b=_0x246910;logger[_0xf49c('0xe')](_0xf49c('0x59'),_0x24733b['id']);return getTicket(_0x296d11,_0x472e8f,_0x24733b,_0x42538e,_0x133791);})['then'](function(_0x156caf){if(_0x156caf){logger[_0xf49c('0xe')](_0xf49c('0x5a'),_0x156caf['id']);switch(_0x296d11[_0xf49c('0x44')]){case _0xf49c('0x5b'):logger['info'](_0xf49c('0x4f'),_0xf49c('0x5c'));return request({'uri':util['format'](_0xf49c('0x5d'),_0x296d11['remoteUri'],_0x472e8f['id'],_0x156caf['id']),'method':'POST'});case _0xf49c('0x5e'):logger['info']('[QUEUE]',_0xf49c('0x5f'));emit(util['format']('user:%s',_0x38e910[_0xf49c('0x14')]),'trigger:browser:url',{'uri':util[_0xf49c('0x10')]('%s/agent/tickets/%s',_0x296d11['remoteUri'][_0xf49c('0x60')]('/api/v2',''),_0x156caf['id'])});break;default:logger[_0xf49c('0x61')](_0xf49c('0x4f'),_0xf49c('0x62'));}}})[_0xf49c('0x63')](function(_0xa777cd){logger['error'](_0xf49c('0x64'),util[_0xf49c('0x65')](_0xa777cd,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x2bf0f9,_0xf908dc,_0x264020,_0x585fab,_0x1c7e45,_0x261c2f,_0x961679){var _0x4e8ca9,_0x3356c7;_0x261c2f[_0xf49c('0x11')]=intUtil['stripTrailingSlash'](_0x261c2f[_0xf49c('0x11')]);_0x261c2f[_0xf49c('0x4e')]=intUtil['stripTrailingSlash'](_0x261c2f[_0xf49c('0x4e')]);if(_0x961679&&_0x961679[_0xf49c('0x66')]&&_0x961679[_0xf49c('0x66')]!==_0xf49c('0x67')){logger['info']('[OUTBOUND]',_0xf49c('0x50'));_0xf908dc[_0xf49c('0x53')]=util[_0xf49c('0x10')](_0xf49c('0x51'),_0x261c2f['serverUrl'],_0xf908dc[_0xf49c('0x52')],md5(_0xf908dc[_0xf49c('0x52')]));}headers[_0xf49c('0x54')]=getAuth(_0x261c2f);return getUser(_0x261c2f,_0x585fab['email'])[_0xf49c('0x18')](function(_0x5a2a27){_0x4e8ca9=_0x5a2a27;logger['info'](_0xf49c('0x56'),_0x4e8ca9['id']);return getEndUser(_0x261c2f,_0xf908dc[_0xf49c('0x68')],_0xf908dc[_0xf49c('0x69')]);})[_0xf49c('0x18')](function(_0x3de6f3){_0x3356c7=_0x3de6f3;logger[_0xf49c('0xe')](_0xf49c('0x59'),_0x3356c7['id']);return getTicket(_0x261c2f,_0x4e8ca9,_0x3356c7,_0x264020,_0xf908dc);})[_0xf49c('0x18')](function(_0x23ffd4){if(_0x23ffd4){logger[_0xf49c('0xe')](_0xf49c('0x5a'),_0x23ffd4['id']);switch(_0x261c2f[_0xf49c('0x44')]){case _0xf49c('0x5b'):logger[_0xf49c('0xe')](_0xf49c('0x6a'),_0xf49c('0x5c'));return request({'uri':util['format'](_0xf49c('0x5d'),_0x261c2f[_0xf49c('0x11')],_0x4e8ca9['id'],_0x23ffd4['id']),'method':_0xf49c('0x12')});case _0xf49c('0x5e'):logger[_0xf49c('0xe')]('[OUTBOUND]',_0xf49c('0x5f'));emit(util[_0xf49c('0x10')]('user:%s',_0x585fab['name']),_0xf49c('0x6b'),{'uri':util[_0xf49c('0x10')](_0xf49c('0x6c'),_0x261c2f[_0xf49c('0x11')][_0xf49c('0x60')]('/api/v2',''),_0x23ffd4['id'])});break;default:logger['error'](_0xf49c('0x6a'),_0xf49c('0x62'));}}})[_0xf49c('0x63')](function(_0x156c1c){logger[_0xf49c('0x61')](_0xf49c('0x6d'),util['inspect'](_0x156c1c,{'showHidden':!![],'depth':null}));});};exports[_0xf49c('0x6e')]=function(_0x11227e,_0x3e64b5,_0x3bf877,_0x2c89d3,_0x217451,_0x1690e7){var _0x1d3a4d,_0x463fb1;_0x1690e7[_0xf49c('0x11')]=intUtil[_0xf49c('0x4d')](_0x1690e7[_0xf49c('0x11')]);_0x1690e7[_0xf49c('0x4e')]=intUtil[_0xf49c('0x4d')](_0x1690e7[_0xf49c('0x4e')]);if(_0x217451&&_0x217451[_0xf49c('0x6f')]){logger[_0xf49c('0xe')]('['+_0x3e64b5[_0xf49c('0x70')]['toUpperCase']()+']',_0xf49c('0x50'));_0x3e64b5[_0xf49c('0x53')]=util['format'](_0xf49c('0x51'),_0x1690e7[_0xf49c('0x4e')],_0x3e64b5[_0xf49c('0x52')],md5(_0x3e64b5[_0xf49c('0x52')]));}else{_0x3e64b5[_0xf49c('0x53')]='';}headers['Authorization']=getAuth(_0x1690e7);return getUser(_0x1690e7)['then'](function(_0x4c5115){_0x1d3a4d=_0x4c5115;logger[_0xf49c('0xe')](_0xf49c('0x56'),_0x1d3a4d['id']);return getEndUser(_0x1690e7,_0x3e64b5['calleridname'],_0x3e64b5[_0xf49c('0x58')]);})[_0xf49c('0x18')](function(_0x1bf689){_0x463fb1=_0x1bf689;logger['info'](_0xf49c('0x59'),_0x463fb1['id']);return getTicket(_0x1690e7,_0x1d3a4d,_0x463fb1,_0x3bf877,_0x3e64b5);})[_0xf49c('0x18')](function(_0x21086d){if(_0x21086d){logger['info'](_0xf49c('0x5a'),_0x21086d['id']);}})['catch'](function(_0x4e1e77){logger[_0xf49c('0x61')]('['+_0x3e64b5[_0xf49c('0x70')][_0xf49c('0x71')]()+']'+_0xf49c('0x72'),util[_0xf49c('0x65')](_0x4e1e77,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3f46=['monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','format','%s/tickets.json','remoteUri','merge','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','stringify','map','forEach','includes','string','picklist','type','nameField','customField','content','custom_fields','push','idField','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl'];(function(_0x48c09f,_0x4afbb2){var _0x4167df=function(_0x243638){while(--_0x243638){_0x48c09f['push'](_0x48c09f['shift']());}};_0x4167df(++_0x4afbb2);}(_0x3f46,0x93));var _0x63f4=function(_0x2223be,_0x4e4034){_0x2223be=_0x2223be-0x0;var _0x453496=_0x3f46[_0x2223be];return _0x453496;};'use strict';var _=require(_0x63f4('0x0'));var rp=require(_0x63f4('0x1'));var md5=require('md5');var util=require(_0x63f4('0x2'));var Redis=require(_0x63f4('0x3'));var intUtil=require(_0x63f4('0x4'));var config=require(_0x63f4('0x5'));var logger=require(_0x63f4('0x6'))(_0x63f4('0x7'));config[_0x63f4('0x8')]=_[_0x63f4('0x9')](config[_0x63f4('0x8')],{'host':_0x63f4('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x63f4('0x8')]));function emit(_0x4c3b26,_0xa757d0,_0x4b4d05){io['to'](_0x4c3b26)[_0x63f4('0xb')](_0xa757d0,_0x4b4d05);}var headers={'Content-Type':_0x63f4('0xc'),'Accept':_0x63f4('0xc')};function getTicket(_0x11b9fa,_0x3867bd,_0xdfba1,_0x1a9bc1,_0x2aae22){logger[_0x63f4('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x63f4('0xe')](_0x63f4('0xf'),_0x11b9fa[_0x63f4('0x10')]),'method':'POST','body':{'ticket':_[_0x63f4('0x11')]({'requester_id':_0xdfba1['id'],'submitter_id':_0x3867bd?_0x3867bd['id']:undefined,'assignee_id':_0x3867bd?_0x3867bd['id']:undefined,'tags':getTags(_0x1a9bc1['Tags'],_0x63f4('0x12')),'subject':intUtil[_0x63f4('0x13')](_0x1a9bc1['Subjects'],_0x2aae22,'\x20'),'description':intUtil['getString'](_0x1a9bc1[_0x63f4('0x14')],_0x2aae22,'\x0a'),'comment':{'public':![],'body':intUtil[_0x63f4('0x13')](_0x1a9bc1['Descriptions'],_0x2aae22,'\x0a')}},getCustomFields(_0x1a9bc1[_0x63f4('0x15')],_0x2aae22))}})[_0x63f4('0x16')](function(_0x1eb889){logger[_0x63f4('0xd')](_0x63f4('0x17'));return _0x1eb889[_0x63f4('0x18')];});}function getUser(_0x408191,_0x27ec80){if(intUtil['validateEmail'](_0x27ec80)){logger[_0x63f4('0xd')](_0x63f4('0x19'),_0x27ec80);return request({'uri':util[_0x63f4('0xe')]('%s/search.json',_0x408191[_0x63f4('0x10')]),'qs':{'query':util['format'](_0x63f4('0x1a'),_0x27ec80)}})['then'](function(_0x59e1bb){if(_0x59e1bb[_0x63f4('0x1b')]){logger[_0x63f4('0xd')](_0x63f4('0x1c'));return _[_0x63f4('0x1d')](_0x59e1bb[_0x63f4('0x1e')],{'email':_0x27ec80,'role':_0x63f4('0x1f')});}else{logger[_0x63f4('0xd')](_0x63f4('0x20'));return request({'uri':util[_0x63f4('0xe')](_0x63f4('0x21'),_0x408191['remoteUri'])})[_0x63f4('0x16')](function(_0x647939){logger[_0x63f4('0xd')]('Admin\x20account\x20selected.');return _0x647939[_0x63f4('0x22')];});}});}else{logger[_0x63f4('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x63f4('0xe')]('%s/users/me.json',_0x408191[_0x63f4('0x10')])})[_0x63f4('0x16')](function(_0x18d039){logger[_0x63f4('0xd')](_0x63f4('0x23'));return _0x18d039[_0x63f4('0x22')];});}}function getEndUser(_0x532892,_0x148bac,_0x5e7a3f){logger[_0x63f4('0xd')]('Searching\x20enduser\x20with\x20phone',_0x5e7a3f);return request({'uri':util[_0x63f4('0xe')](_0x63f4('0x24'),_0x532892[_0x63f4('0x10')]),'qs':{'query':util['format'](_0x63f4('0x25'),_0x5e7a3f)}})['then'](function(_0x42484c){var _0x2ae1eb;if(_0x42484c[_0x63f4('0x1e')][_0x63f4('0x26')]){_0x42484c[_0x63f4('0x1e')]=_[_0x63f4('0x27')](_0x42484c['results'],{'suspended':![],'role':_0x63f4('0x28')});if(_0x42484c[_0x63f4('0x1e')][_0x63f4('0x26')]){_0x2ae1eb=_[_0x63f4('0x29')](_0x42484c['results']);}}if(_0x2ae1eb){logger[_0x63f4('0xd')](_0x63f4('0x2a'));return _0x2ae1eb;}else{logger['info'](_0x63f4('0x2b'));return request({'uri':util[_0x63f4('0xe')](_0x63f4('0x2c'),_0x532892[_0x63f4('0x10')]),'method':_0x63f4('0x2d'),'body':{'user':{'role':_0x63f4('0x28'),'name':util[_0x63f4('0xe')](_0x63f4('0x2e'),_0x148bac||_0x5e7a3f),'phone':_0x5e7a3f}}})[_0x63f4('0x16')](function(_0x43147e){logger['info'](_0x63f4('0x2f'));return _0x43147e[_0x63f4('0x22')];});}});}function getAuth(_0x2c8f17){var _0x385293;if(_0x2c8f17[_0x63f4('0x30')]===_0x63f4('0x31')){_0x385293=util[_0x63f4('0xe')](_0x63f4('0x32'),_0x2c8f17['username'],_0x2c8f17[_0x63f4('0x31')]);}else if(_0x2c8f17[_0x63f4('0x30')]===_0x63f4('0x33')){_0x385293=util[_0x63f4('0xe')](_0x63f4('0x34'),_0x2c8f17[_0x63f4('0x35')],_0x2c8f17[_0x63f4('0x33')]);}return util['format'](_0x63f4('0x36'),new Buffer(_0x385293)[_0x63f4('0x37')](_0x63f4('0x38')));}function request(_0x20181d){logger['debug']('[HTTP]',JSON[_0x63f4('0x39')](_0x20181d));return rp(_[_0x63f4('0x9')](_0x20181d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x48ac94,_0x133553){var _0x516076=[];if(_0x48ac94&&_0x48ac94['length']>0x0){_0x516076=_[_0x63f4('0x3a')](_0x48ac94,_0x133553);}return _0x516076;}function getCustomFields(_0x427f3c,_0x489839){var _0x1370e6=[];var _0x29e05c={'custom_fields':[]};if(_0x427f3c[_0x63f4('0x26')]>0x0){_[_0x63f4('0x3b')](_0x427f3c,function(_0x4e28fb){if(_[_0x63f4('0x3c')]([_0x63f4('0x3d'),_0x63f4('0x3e')],_0x4e28fb[_0x63f4('0x3f')])&&_0x4e28fb[_0x63f4('0x40')]&&!_0x4e28fb[_0x63f4('0x41')]){_0x29e05c[_0x4e28fb[_0x63f4('0x40')]['toLowerCase']()]=_0x4e28fb[_0x63f4('0x42')][_0x63f4('0x37')]();}else if(_[_0x63f4('0x3c')]([_0x63f4('0x3d'),'picklist'],_0x4e28fb[_0x63f4('0x3f')])&&_0x4e28fb['idField']&&_0x4e28fb['customField']){_0x29e05c[_0x63f4('0x43')][_0x63f4('0x44')]({'id':_0x4e28fb[_0x63f4('0x45')],'value':_0x4e28fb[_0x63f4('0x42')]['toString']()});}else if(_0x4e28fb[_0x63f4('0x3f')]===_0x63f4('0x46')&&_0x4e28fb[_0x63f4('0x47')]&&_0x4e28fb['idField']&&_0x4e28fb['customField']){_0x489839[_0x4e28fb[_0x63f4('0x47')]]&&_0x29e05c['custom_fields'][_0x63f4('0x44')]({'id':_0x4e28fb['idField'],'value':_0x489839[_0x4e28fb[_0x63f4('0x47')]][_0x63f4('0x37')]()});}else if(_0x4e28fb[_0x63f4('0x3f')]==='customVariable'&&_0x4e28fb[_0x63f4('0x48')]&&_0x4e28fb['Variable'][_0x63f4('0x12')]&&_0x4e28fb[_0x63f4('0x45')]&&_0x4e28fb[_0x63f4('0x41')]){_0x489839[_0x4e28fb['Variable']['name'][_0x63f4('0x49')]()]&&_0x29e05c[_0x63f4('0x43')][_0x63f4('0x44')]({'id':_0x4e28fb[_0x63f4('0x45')],'value':_0x489839[_0x4e28fb[_0x63f4('0x48')][_0x63f4('0x12')][_0x63f4('0x49')]()][_0x63f4('0x37')]()});}});}return _0x29e05c;}exports[_0x63f4('0x4a')]=function(_0x1af86d,_0x3ce536,_0x4c8672,_0x39fcc5,_0x1b58b6,_0x205dd4){var _0x513ab0,_0x2c8ca5;_0x205dd4[_0x63f4('0x10')]=intUtil[_0x63f4('0x4b')](_0x205dd4[_0x63f4('0x10')]);_0x205dd4[_0x63f4('0x4c')]=intUtil[_0x63f4('0x4b')](_0x205dd4[_0x63f4('0x4c')]);if(_0x1b58b6&&_0x1b58b6[_0x63f4('0x4d')]){logger[_0x63f4('0xd')]('[QUEUE]',_0x63f4('0x4e'));_0x3ce536[_0x63f4('0x4f')]=util[_0x63f4('0xe')](_0x63f4('0x50'),_0x205dd4[_0x63f4('0x4c')],_0x3ce536[_0x63f4('0x51')],md5(_0x3ce536[_0x63f4('0x51')]));}else{_0x3ce536['recordingURL']='';}headers[_0x63f4('0x52')]=getAuth(_0x205dd4);return getUser(_0x205dd4,_0x39fcc5[_0x63f4('0x53')])[_0x63f4('0x16')](function(_0x187321){_0x513ab0=_0x187321;logger[_0x63f4('0xd')]('The\x20User\x20ID\x20is:',_0x513ab0['id']);return getEndUser(_0x205dd4,_0x3ce536[_0x63f4('0x54')],_0x3ce536[_0x63f4('0x55')]);})[_0x63f4('0x16')](function(_0x23815f){_0x2c8ca5=_0x23815f;logger[_0x63f4('0xd')]('The\x20Enduser\x20ID\x20is:',_0x2c8ca5['id']);return getTicket(_0x205dd4,_0x513ab0,_0x2c8ca5,_0x4c8672,_0x3ce536);})[_0x63f4('0x16')](function(_0x515409){if(_0x515409){logger[_0x63f4('0xd')](_0x63f4('0x56'),_0x515409['id']);switch(_0x205dd4['type']){case _0x63f4('0x57'):logger[_0x63f4('0xd')](_0x63f4('0x58'),_0x63f4('0x59'));return request({'uri':util[_0x63f4('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x205dd4[_0x63f4('0x10')],_0x513ab0['id'],_0x515409['id']),'method':_0x63f4('0x2d')});case _0x63f4('0x5a'):logger[_0x63f4('0xd')]('[QUEUE]',_0x63f4('0x5b'));emit(util[_0x63f4('0xe')](_0x63f4('0x5c'),_0x39fcc5[_0x63f4('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x63f4('0x5d'),_0x205dd4['remoteUri'][_0x63f4('0x5e')](_0x63f4('0x5f'),''),_0x515409['id'])});break;default:logger[_0x63f4('0x60')](_0x63f4('0x58'),_0x63f4('0x61'));}}})[_0x63f4('0x62')](function(_0x108161){logger[_0x63f4('0x60')](_0x63f4('0x63'),util[_0x63f4('0x64')](_0x108161,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x43e530,_0x502a16,_0x2c4ce4,_0x4a158e,_0x359652,_0x2046a7,_0x3fd523){var _0x43edbd,_0x36b44a;_0x2046a7[_0x63f4('0x10')]=intUtil[_0x63f4('0x4b')](_0x2046a7['remoteUri']);_0x2046a7[_0x63f4('0x4c')]=intUtil[_0x63f4('0x4b')](_0x2046a7['serverUrl']);if(_0x3fd523&&_0x3fd523[_0x63f4('0x65')]&&_0x3fd523[_0x63f4('0x65')]!==_0x63f4('0x66')){logger[_0x63f4('0xd')](_0x63f4('0x67'),'Recording\x20is\x20enabled!');_0x502a16[_0x63f4('0x4f')]=util[_0x63f4('0xe')](_0x63f4('0x50'),_0x2046a7[_0x63f4('0x4c')],_0x502a16['uniqueid'],md5(_0x502a16[_0x63f4('0x51')]));}headers[_0x63f4('0x52')]=getAuth(_0x2046a7);return getUser(_0x2046a7,_0x4a158e[_0x63f4('0x53')])[_0x63f4('0x16')](function(_0x5b6e7e){_0x43edbd=_0x5b6e7e;logger['info'](_0x63f4('0x68'),_0x43edbd['id']);return getEndUser(_0x2046a7,_0x502a16[_0x63f4('0x69')],_0x502a16['destcalleridnum']);})[_0x63f4('0x16')](function(_0x1cec54){_0x36b44a=_0x1cec54;logger[_0x63f4('0xd')](_0x63f4('0x6a'),_0x36b44a['id']);return getTicket(_0x2046a7,_0x43edbd,_0x36b44a,_0x2c4ce4,_0x502a16);})[_0x63f4('0x16')](function(_0x4eaec8){if(_0x4eaec8){logger[_0x63f4('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4eaec8['id']);switch(_0x2046a7['type']){case _0x63f4('0x57'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x63f4('0xe')](_0x63f4('0x6b'),_0x2046a7[_0x63f4('0x10')],_0x43edbd['id'],_0x4eaec8['id']),'method':_0x63f4('0x2d')});case'newTab':logger[_0x63f4('0xd')](_0x63f4('0x67'),_0x63f4('0x5b'));emit(util[_0x63f4('0xe')]('user:%s',_0x4a158e[_0x63f4('0x12')]),_0x63f4('0x6c'),{'uri':util[_0x63f4('0xe')]('%s/agent/tickets/%s',_0x2046a7['remoteUri']['replace'](_0x63f4('0x5f'),''),_0x4eaec8['id'])});break;default:logger[_0x63f4('0x60')](_0x63f4('0x67'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x63f4('0x62')](function(_0x1e3fe2){logger[_0x63f4('0x60')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1e3fe2,{'showHidden':!![],'depth':null}));});};exports[_0x63f4('0x6d')]=function(_0x1b0f85,_0x2d742f,_0x12ca2e,_0x5bd2bf,_0x4f8ea0,_0xdc1b77){var _0x4b81e2,_0x236051;_0xdc1b77[_0x63f4('0x10')]=intUtil[_0x63f4('0x4b')](_0xdc1b77[_0x63f4('0x10')]);_0xdc1b77['serverUrl']=intUtil[_0x63f4('0x4b')](_0xdc1b77[_0x63f4('0x4c')]);if(_0x4f8ea0&&_0x4f8ea0[_0x63f4('0x4d')]){logger[_0x63f4('0xd')]('['+_0x2d742f[_0x63f4('0x6e')]['toUpperCase']()+']',_0x63f4('0x4e'));_0x2d742f['recordingURL']=util[_0x63f4('0xe')](_0x63f4('0x50'),_0xdc1b77[_0x63f4('0x4c')],_0x2d742f['uniqueid'],md5(_0x2d742f[_0x63f4('0x51')]));}else{_0x2d742f[_0x63f4('0x4f')]='';}headers[_0x63f4('0x52')]=getAuth(_0xdc1b77);return getUser(_0xdc1b77)[_0x63f4('0x16')](function(_0x53bdd8){_0x4b81e2=_0x53bdd8;logger[_0x63f4('0xd')](_0x63f4('0x68'),_0x4b81e2['id']);return getEndUser(_0xdc1b77,_0x2d742f['calleridname'],_0x2d742f[_0x63f4('0x55')]);})[_0x63f4('0x16')](function(_0x5b4cd6){_0x236051=_0x5b4cd6;logger[_0x63f4('0xd')]('The\x20Enduser\x20ID\x20is:',_0x236051['id']);return getTicket(_0xdc1b77,_0x4b81e2,_0x236051,_0x12ca2e,_0x2d742f);})[_0x63f4('0x16')](function(_0x3225fe){if(_0x3225fe){logger[_0x63f4('0xd')](_0x63f4('0x56'),_0x3225fe['id']);}})[_0x63f4('0x62')](function(_0x469db9){logger['error']('['+_0x2d742f[_0x63f4('0x6e')][_0x63f4('0x6f')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x63f4('0x64')](_0x469db9,{'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 a1d1dd7..49048cc 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 _0x9e93=['Full_Name','First_Name','Last_Name','What_Id','$se_module','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','complete','connect','Call_Result','Answered','Rejected','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','SUCCESS','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','destcalleridnum','user:%s','unmanaged','toUpperCase','lodash','md5','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','[HTTP]','stringify','length','includes','string','picklist','type','idField','toString','variableName','customVariable','name','toLowerCase','indexOf','split','isNil','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','details','enduserType','Error:\x20','log','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id'];(function(_0x38193f,_0x2c6649){var _0x283b66=function(_0x1da004){while(--_0x1da004){_0x38193f['push'](_0x38193f['shift']());}};_0x283b66(++_0x2c6649);}(_0x9e93,0xca));var _0x39e9=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x9e93[_0x502598];return _0xbdee21;};'use strict';var _=require(_0x39e9('0x0'));var rp=require('request-promise');var md5=require(_0x39e9('0x1'));var util=require('util');var intUtil=require(_0x39e9('0x2'));var moment=require(_0x39e9('0x3'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x39e9('0x4'));var logger=require(_0x39e9('0x5'))(_0x39e9('0x6'));config[_0x39e9('0x7')]=_[_0x39e9('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x39e9('0x9'))(new Redis(config['redis']));function emit(_0x61f709,_0x63d54a,_0x3cb80e){io['to'](_0x61f709)['emit'](_0x63d54a,_0x3cb80e);}function request(_0xc4e8b0){logger['debug'](_0x39e9('0xa'),JSON[_0x39e9('0xb')](_0xc4e8b0));return rp(_0xc4e8b0);}function getCustomFields(_0x2a2607,_0x2b2771){var _0x1d49c3={};if(_0x2a2607[_0x39e9('0xc')]>0x0){_['forEach'](_0x2a2607,function(_0x240fa2){if(_[_0x39e9('0xd')]([_0x39e9('0xe'),_0x39e9('0xf')],_0x240fa2[_0x39e9('0x10')])&&_0x240fa2[_0x39e9('0x11')]){_0x1d49c3[_0x240fa2[_0x39e9('0x11')]]=_0x240fa2['content'][_0x39e9('0x12')]();}else if(_0x240fa2[_0x39e9('0x10')]==='variable'&&_0x240fa2[_0x39e9('0x13')]&&_0x240fa2[_0x39e9('0x11')]&&_0x2b2771[_0x240fa2['variableName']]){_0x1d49c3[_0x240fa2[_0x39e9('0x11')]]=_0x2b2771[_0x240fa2[_0x39e9('0x13')]][_0x39e9('0x12')]();}else if(_0x240fa2[_0x39e9('0x10')]===_0x39e9('0x14')&&_0x240fa2['Variable']&&_0x240fa2['Variable'][_0x39e9('0x15')]&&_0x240fa2[_0x39e9('0x11')]&&_0x2b2771[_0x240fa2['Variable']['name'][_0x39e9('0x16')]()]){_0x1d49c3[_0x240fa2[_0x39e9('0x11')]]=_0x2b2771[_0x240fa2['Variable'][_0x39e9('0x15')][_0x39e9('0x16')]()][_0x39e9('0x12')]();}});}return _0x1d49c3;}function getName(_0x1c75fa){if(_0x1c75fa[_0x39e9('0x17')]('\x20')>0x0){var _0x31aa4e=_0x1c75fa[_0x39e9('0x18')](/ (.+)/);if(_0x31aa4e[0x1]){return _0x31aa4e;}}return[_0x1c75fa,_0x1c75fa];}var accountsTokens={};function getAccessToken(_0x1dd1b2){return new Promise(function(_0x8d203e,_0xcf70ff){if(!_[_0x39e9('0x19')](accountsTokens[_0x1dd1b2['id']])&&!_[_0x39e9('0x19')](accountsTokens[_0x1dd1b2['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x1dd1b2['id']][_0x39e9('0x1a')])){_0x8d203e(accountsTokens[_0x1dd1b2['id']]['access_token']);}}var _0x583b3c;switch(_0x1dd1b2[_0x39e9('0x1b')]){case'US':_0x583b3c='https://accounts.zoho.com';break;case'AU':_0x583b3c='https://accounts.zoho.com.au';break;case'EU':_0x583b3c=_0x39e9('0x1c');break;case'IN':_0x583b3c='https://accounts.zoho.in';break;case'CN':_0x583b3c=_0x39e9('0x1d');break;default:_0x583b3c=_0x39e9('0x1c');break;}var _0x227307={'method':_0x39e9('0x1e'),'uri':_0x583b3c+_0x39e9('0x1f'),'qs':{'refresh_token':_0x1dd1b2[_0x39e9('0x20')],'client_id':_0x1dd1b2[_0x39e9('0x21')],'client_secret':_0x1dd1b2[_0x39e9('0x22')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x227307)['then'](function(_0x310e37){accountsTokens[_0x1dd1b2['id']]={'access_token':_0x310e37[_0x39e9('0x23')],'expires_in':moment()[_0x39e9('0x24')](_0x310e37[_0x39e9('0x1a')],_0x39e9('0x25'))};_0x8d203e(_0x310e37[_0x39e9('0x23')]);})[_0x39e9('0x26')](function(_0x7429b8){logger[_0x39e9('0x27')](_0x39e9('0x28'),_0x7429b8[_0x39e9('0x29')]);_0xcf70ff(_0x7429b8);});});}function getUser(_0x119d81,_0x5365d6,_0x567cfe,_0x2d5274){logger[_0x39e9('0x2a')]('Search\x20user');return request({'method':_0x39e9('0x2b'),'uri':util[_0x39e9('0x2c')](_0x39e9('0x2d'),_0x5365d6),'qs':{'type':_0x39e9('0x2e')},'headers':{'Authorization':_0x39e9('0x2f')+_0x119d81},'json':!![]})[_0x39e9('0x30')](function(_0x13efb9){if(_0x13efb9['users']){var _0x3846bd=-0x1;if(_[_0x39e9('0x31')](_0x13efb9[_0x39e9('0x32')])){if(!_[_0x39e9('0x19')](_0x2d5274)){_0x3846bd=_['findIndex'](_0x13efb9[_0x39e9('0x32')],function(_0x8462c6){return _0x8462c6[_0x39e9('0x33')]===_0x2d5274;});}if(_0x3846bd>=0x0){logger[_0x39e9('0x2a')](_0x39e9('0x34'));}else{logger[_0x39e9('0x2a')](_0x39e9('0x35'));_0x3846bd=_['findIndex'](_0x13efb9[_0x39e9('0x32')],function(_0x3f2615){return _0x3f2615['profile'][_0x39e9('0x15')]===_0x39e9('0x36');});}return _0x13efb9[_0x39e9('0x32')][_0x3846bd];}else{if(_0x13efb9[_0x39e9('0x37')][_0x39e9('0x38')][_0x39e9('0x15')]===_0x39e9('0x36')){logger[_0x39e9('0x2a')]('Using\x20the\x20admin\x20account!');user=_0x13efb9[_0x39e9('0x37')];return user;}else{logger[_0x39e9('0x27')](_0x39e9('0x39'),JSON[_0x39e9('0xb')](_0x13efb9));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x39e9('0xb')](_0x13efb9));}}}else{logger[_0x39e9('0x27')](_0x39e9('0x39'),JSON[_0x39e9('0xb')](_0x13efb9));throw new Error(_0x39e9('0x3a')+JSON[_0x39e9('0xb')](_0x13efb9));}})[_0x39e9('0x26')](function(_0x44c834){console['error'](_0x44c834);});}function getZohoUser(_0x1c4920,_0x613310){return new BPromise(function(_0xe9a38b,_0x361e1a){request(_0x1c4920)[_0x39e9('0x30')](function(_0x27d800){var _0x531682=null;if(_0x27d800){_0x531682=_0x27d800[_0x39e9('0x3b')][0x0];_0x531682['enduserType']=_0x613310;}_0xe9a38b(_0x531682);})[_0x39e9('0x26')](function(_0x1223d7){_0x361e1a(_0x1223d7);});});}function createEndUser(_0x370e88,_0x115a34,_0x449594,_0x18ab20,_0x23a45a,_0x227a1a){var _0x449594=getName(_0x449594);return request({'method':_0x39e9('0x1e'),'uri':_0x39e9('0x3c')+_0x115a34+'/crm/v2/'+_[_0x39e9('0x3d')](_0x227a1a[_0x39e9('0x3e')])+'s','body':{'data':[{'Last_Name':_0x449594[0x1],'First_Name':_0x449594[0x0],'Phone':_0x18ab20,'Owner':{'name':!_[_0x39e9('0x19')](_0x23a45a[_0x39e9('0x3f')][_0x39e9('0x15')])?_0x23a45a[_0x39e9('0x3f')][_0x39e9('0x15')]:!_[_0x39e9('0x19')](_0x23a45a[_0x39e9('0x40')])?_0x23a45a[_0x39e9('0x40')]+'\x20'+_0x23a45a[_0x39e9('0x41')]:_0x23a45a['last_name'],'id':_0x23a45a['id']}}]},'headers':{'Authorization':_0x39e9('0x2f')+_0x370e88},'json':!![]})[_0x39e9('0x30')](function(_0x496f4d){if(_0x496f4d&&_0x496f4d[_0x39e9('0x3b')][0x0][_0x39e9('0x42')]==='SUCCESS'){var _0xfe485c=_0x496f4d[_0x39e9('0x3b')][0x0][_0x39e9('0x43')];_0xfe485c[_0x39e9('0x44')]=_[_0x39e9('0x3d')](_0x227a1a[_0x39e9('0x3e')])+'s';return _0xfe485c;}logger[_0x39e9('0x27')](_0x39e9('0x39'),JSON[_0x39e9('0xb')](data));throw new Error(_0x39e9('0x45')+JSON[_0x39e9('0xb')](data));})[_0x39e9('0x26')](function(_0x5ab035){console[_0x39e9('0x46')]('CREATE\x20ERROR',_0x5ab035);});}function getEndUser(_0x3e7f73,_0x3bfabb,_0x4f8a7f,_0x5e16b2,_0x3bdf37,_0x4f2471,_0xfeedd3){var _0xb9abb9={'method':_0x39e9('0x2b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3e7f73},'json':!![]};switch(_0xfeedd3[_0x39e9('0x47')]){case _0x39e9('0x48'):_0xb9abb9[_0x39e9('0x49')]=_0x39e9('0x3c')+_0x3bfabb+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3bdf37+'))';return getZohoUser(_0xb9abb9,_0x39e9('0x4a'))[_0x39e9('0x30')](function(_0x375dea){if(_0x375dea)return _0x375dea;_0xb9abb9[_0x39e9('0x49')]=_0x39e9('0x3c')+_0x3bfabb+_0x39e9('0x4b')+_0x3bdf37+'))';return getZohoUser(_0xb9abb9,_0x39e9('0x4c'))[_0x39e9('0x30')](function(_0x3fd528){if(_0x3fd528)return _0x3fd528;if(_0xfeedd3['moduleCreate']!=_0x39e9('0x4d')){return createEndUser(_0x3e7f73,_0x3bfabb,_0x5e16b2,_0x3bdf37,_0x4f2471,_0xfeedd3);}else{return{};}});});break;case _0x39e9('0x4e'):_0xb9abb9['uri']=_0x39e9('0x3c')+_0x3bfabb+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3bdf37+'))';return getZohoUser(_0xb9abb9,_0x39e9('0x4a'))[_0x39e9('0x30')](function(_0x37660c){if(_0x37660c)return _0x37660c;if(_0xfeedd3[_0x39e9('0x3e')]!='nothing'){return createEndUser(_0x3e7f73,_0x3bfabb,_0x5e16b2,_0x3bdf37,_0x4f2471,_0xfeedd3);}else{return{};}});break;case _0x39e9('0x4f'):_0xb9abb9[_0x39e9('0x49')]=_0x39e9('0x3c')+_0x3bfabb+_0x39e9('0x4b')+_0x3bdf37+'))';return getZohoUser(_0xb9abb9,_0x39e9('0x4c'))[_0x39e9('0x30')](function(_0x35d816){if(_0x35d816)return _0x35d816;if(_0xfeedd3[_0x39e9('0x3e')]!='nothing'){return createEndUser(_0x3e7f73,_0x3bfabb,_0x5e16b2,_0x3bdf37,_0x4f2471,_0xfeedd3);}else{return{};}});break;}}function getCall(_0x55aadc,_0x118036,_0x4859c4,_0x2d360f,_0x14e0ac,_0x29279c,_0x2a86ce,_0x575f2c){logger['info'](_0x39e9('0x50'));var _0x1f049e={};_0x1f049e['Owner']={'name':!_[_0x39e9('0x19')](_0x2d360f[_0x39e9('0x3f')][_0x39e9('0x15')])&&!_['isNil'](_0x2d360f['profile'][_0x39e9('0x15')])&&_0x2d360f[_0x39e9('0x38')][_0x39e9('0x15')]===_0x39e9('0x51')?_0x2d360f[_0x39e9('0x3f')][_0x39e9('0x15')]:!_['isNil'](_0x2d360f['first_name'])?_0x2d360f['first_name']+'\x20'+_0x2d360f[_0x39e9('0x41')]:_0x2d360f[_0x39e9('0x41')],'id':_0x2d360f['id']};_0x1f049e[_0x39e9('0x52')]=intUtil[_0x39e9('0x53')](_0x29279c[_0x39e9('0x54')],_0x2a86ce,'\x20');_0x1f049e[_0x39e9('0x55')]=intUtil[_0x39e9('0x53')](_0x29279c[_0x39e9('0x56')],_0x2a86ce,'\x0a');if(_0x14e0ac[_0x39e9('0x44')]==='Contacts'){_0x1f049e[_0x39e9('0x57')]={'name':!_['isNil'](_0x14e0ac[_0x39e9('0x58')])?_0x14e0ac['Full_Name']:!_[_0x39e9('0x19')](_0x14e0ac[_0x39e9('0x59')])?_0x14e0ac['First_Name']+'\x20'+_0x14e0ac[_0x39e9('0x5a')]:_0x14e0ac[_0x39e9('0x5a')],'id':_0x14e0ac['id']};}if(_0x14e0ac[_0x39e9('0x44')]===_0x39e9('0x4c')){_0x1f049e[_0x39e9('0x5b')]={'name':!_[_0x39e9('0x19')](_0x14e0ac[_0x39e9('0x58')])?_0x14e0ac[_0x39e9('0x58')]:!_[_0x39e9('0x19')](_0x14e0ac[_0x39e9('0x59')])?_0x14e0ac[_0x39e9('0x59')]+'\x20'+_0x14e0ac[_0x39e9('0x5a')]:_0x14e0ac[_0x39e9('0x5a')],'id':_0x14e0ac['id']};_0x1f049e[_0x39e9('0x5c')]=_[_0x39e9('0x3d')](_0x14e0ac[_0x39e9('0x44')]);}if(_0x2a86ce['talktime']){_0x1f049e['Call_Duration']=moment[_0x39e9('0x5d')](parseInt(_0x2a86ce['talktime'])*0x3e8)[_0x39e9('0x2c')](_0x39e9('0x5e'));}else if(_0x2a86ce[_0x39e9('0x5f')]&&_0x2a86ce[_0x39e9('0x60')]){_0x1f049e[_0x39e9('0x61')]=moment['utc'](moment(_0x2a86ce['endtime'],_0x39e9('0x62'))['diff'](moment(_0x2a86ce[_0x39e9('0x63')],'YYYY-MM-DDTHH:mm:ss')))[_0x39e9('0x2c')](_0x39e9('0x5e'));}switch(_0x2a86ce[_0x39e9('0x64')]){case _0x39e9('0x65'):_0x1f049e['Call_Result']='Called';break;case _0x39e9('0x66'):case _0x39e9('0x67'):_0x1f049e[_0x39e9('0x68')]=_0x39e9('0x69');break;case'rejected':_0x1f049e['Call_Result']=_0x39e9('0x6a');break;case'abandoned':_0x1f049e[_0x39e9('0x68')]=_0x39e9('0x6b');break;case _0x39e9('0x6c'):_0x1f049e[_0x39e9('0x68')]='Timeout';default:}_0x1f049e[_0x39e9('0x6d')]=(_0x575f2c===_0x39e9('0x6e')?moment(_0x2a86ce[_0x39e9('0x63')])[_0x39e9('0x2c')](_0x39e9('0x62')):moment(_0x2a86ce[_0x39e9('0x6f')])[_0x39e9('0x2c')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x39e9('0x2c')](_0x39e9('0x62'));_0x1f049e['Call_Type']=_0x575f2c||_0x39e9('0x70');_0x1f049e=_[_0x39e9('0x71')](_0x1f049e,getCustomFields(_0x29279c[_0x39e9('0x72')],_0x2a86ce));return request({'method':'POST','uri':_0x39e9('0x3c')+_0x118036+'/crm/v2/Calls','headers':{'Authorization':_0x39e9('0x2f')+_0x55aadc},'body':{'data':[_0x1f049e]},'json':!![]})['then'](function(_0x43f84d){if(_0x43f84d&&_0x43f84d[_0x39e9('0x3b')][0x0][_0x39e9('0x42')]===_0x39e9('0x73')){logger[_0x39e9('0x2a')](_0x39e9('0x74'));return{'id':_0x43f84d['data'][0x0][_0x39e9('0x43')]['id']};}})[_0x39e9('0x26')](function(_0x3b3881){logger['info']('err',_0x3b3881[_0x39e9('0x29')]);console['log'](_0x39e9('0x75'),_0x3b3881);});}exports['queue']=function(_0x17b35a,_0x2da8b2,_0x2eacec,_0x141938,_0x17347d,_0x3b8ff7){var _0x3cee7a,_0x5ae3fb,_0x3fb3e5;_0x3b8ff7[_0x39e9('0x76')]=intUtil[_0x39e9('0x77')](_0x3b8ff7[_0x39e9('0x76')]);_0x3b8ff7[_0x39e9('0x78')]=intUtil[_0x39e9('0x77')](_0x3b8ff7[_0x39e9('0x78')]);if(_0x17347d&&_0x17347d[_0x39e9('0x79')]){logger[_0x39e9('0x2a')](_0x39e9('0x7a'),'Recording\x20is\x20enabled!');_0x2da8b2[_0x39e9('0x7b')]=_0x3b8ff7[_0x39e9('0x78')]+'/api/voice/recordings/'+_0x2da8b2[_0x39e9('0x7c')]+'/downloads?type=uniqueid&token='+md5(_0x2da8b2[_0x39e9('0x7c')]);}else{_0x2da8b2[_0x39e9('0x7b')]='';}var _0x55871c=_0x3b8ff7[_0x39e9('0x76')]==='zoho.eu'?'eu':_0x39e9('0x7d');return getAccessToken(_0x3b8ff7)[_0x39e9('0x30')](function(_0x10af09){_0x3fb3e5=_0x10af09;return getUser(_0x3fb3e5,_0x55871c,_0x3b8ff7,_0x141938[_0x39e9('0x33')]);})['then'](function(_0xfec6f8){_0x3cee7a=_0xfec6f8;logger[_0x39e9('0x2a')]('The\x20User\x20ID\x20is:',_0x3cee7a['id']);return getEndUser(_0x3fb3e5,_0x55871c,_0x3b8ff7,_0x2da8b2[_0x39e9('0x7e')],_0x2da8b2[_0x39e9('0x7f')],_0x3cee7a,_0x2eacec);})['then'](function(_0x1ff6c2){_0x5ae3fb=_0x1ff6c2;return getCall(_0x3fb3e5,_0x55871c,_0x3b8ff7,_0x3cee7a,_0x5ae3fb,_0x2eacec,_0x2da8b2,_0x39e9('0x70'));})[_0x39e9('0x30')](function(_0x3159e1){if(_0x3159e1){logger[_0x39e9('0x2a')](_0x39e9('0x80'),_0x3159e1['id']);logger[_0x39e9('0x2a')](_0x39e9('0x7a'),_0x39e9('0x81'));emit(util[_0x39e9('0x2c')]('user:%s',_0x141938[_0x39e9('0x15')]),_0x39e9('0x82'),{'uri':_0x39e9('0x83')+_0x3b8ff7[_0x39e9('0x76')]+_0x39e9('0x84')+_0x3159e1['id']});}})[_0x39e9('0x26')](function(_0x453628){logger['error']('[QUEUE]',JSON['stringify'](_0x453628));});};exports['outbound']=function(_0x1ec124,_0x1759ef,_0x34a962,_0x2353e3,_0x3e57d4,_0x2029ba,_0x5a0159){var _0x1af8a9,_0x365a0c,_0x2d49bb;_0x2029ba[_0x39e9('0x76')]=intUtil[_0x39e9('0x77')](_0x2029ba['host']);_0x2029ba[_0x39e9('0x78')]=intUtil[_0x39e9('0x77')](_0x2029ba[_0x39e9('0x78')]);if(_0x5a0159&&_0x5a0159['recordingFormat']&&_0x5a0159[_0x39e9('0x85')]!==_0x39e9('0x86')){logger[_0x39e9('0x2a')](_0x39e9('0x87'),_0x39e9('0x88'));_0x1759ef[_0x39e9('0x7b')]=_0x2029ba[_0x39e9('0x78')]+_0x39e9('0x89')+_0x1759ef[_0x39e9('0x7c')]+_0x39e9('0x8a')+md5(_0x1759ef[_0x39e9('0x7c')]);}var _0x5b716c=_0x2029ba[_0x39e9('0x76')]===_0x39e9('0x8b')?'eu':_0x39e9('0x7d');return getAccessToken(_0x2029ba)[_0x39e9('0x30')](function(_0x4c5f97){_0x2d49bb=_0x4c5f97;return getUser(_0x2d49bb,_0x5b716c,_0x2029ba,_0x2353e3[_0x39e9('0x33')]);})[_0x39e9('0x30')](function(_0x2c603f){_0x1af8a9=_0x2c603f;logger[_0x39e9('0x2a')](_0x39e9('0x8c'),_0x1af8a9['id']);return getEndUser(_0x2d49bb,_0x5b716c,_0x2029ba,_0x1759ef['destcalleridname'],_0x1759ef[_0x39e9('0x8d')],_0x1af8a9,_0x34a962);})['then'](function(_0x5a4057){_0x365a0c=_0x5a4057;return getCall(_0x2d49bb,_0x5b716c,_0x2029ba,_0x1af8a9,_0x365a0c,_0x34a962,_0x1759ef,'Outbound');})[_0x39e9('0x30')](function(_0x2368ed){if(_0x2368ed){logger[_0x39e9('0x2a')](_0x39e9('0x80'),_0x2368ed['id']);logger[_0x39e9('0x2a')](_0x39e9('0x87'),_0x39e9('0x81'));emit(util['format'](_0x39e9('0x8e'),_0x2353e3[_0x39e9('0x15')]),_0x39e9('0x82'),{'uri':_0x39e9('0x83')+_0x2029ba['host']+_0x39e9('0x84')+_0x2368ed['id']});}})[_0x39e9('0x26')](function(_0x21ce34){logger['error'](_0x39e9('0x87'),JSON[_0x39e9('0xb')](_0x21ce34));});};exports[_0x39e9('0x8f')]=function(_0x195b56,_0x1baecc,_0x5ae8fe,_0x305ea0,_0x30e553,_0x5bf3f2){var _0x2afb42,_0xe0b432,_0x3a03f2;_0x5bf3f2[_0x39e9('0x76')]=intUtil[_0x39e9('0x77')](_0x5bf3f2['host']);_0x5bf3f2[_0x39e9('0x78')]=intUtil['stripTrailingSlash'](_0x5bf3f2['serverUrl']);if(_0x30e553&&_0x30e553['monitor_format']){logger[_0x39e9('0x2a')]('['+_0x1baecc[_0x39e9('0x64')][_0x39e9('0x90')]()+']','Recording\x20is\x20enabled!');_0x1baecc[_0x39e9('0x7b')]=_0x5bf3f2[_0x39e9('0x78')]+_0x39e9('0x89')+_0x1baecc[_0x39e9('0x7c')]+_0x39e9('0x8a')+md5(_0x1baecc[_0x39e9('0x7c')]);}else{_0x1baecc[_0x39e9('0x7b')]='';}var _0x5de460=_0x5bf3f2[_0x39e9('0x76')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x5bf3f2)[_0x39e9('0x30')](function(_0x16a5c8){_0x3a03f2=_0x16a5c8;return getUser(_0x3a03f2,_0x5de460,_0x5bf3f2);})[_0x39e9('0x30')](function(_0x50f696){_0x2afb42=_0x50f696;logger['info'](_0x39e9('0x8c'),_0x2afb42['id']);return getEndUser(_0x3a03f2,_0x5de460,_0x5bf3f2,_0x1baecc[_0x39e9('0x7e')],_0x1baecc[_0x39e9('0x7f')],_0x2afb42,_0x5ae8fe);})[_0x39e9('0x30')](function(_0x322171){_0xe0b432=_0x322171;return getCall(_0x3a03f2,_0x5de460,_0x5bf3f2,_0x2afb42,_0xe0b432,_0x5ae8fe,_0x1baecc,_0x39e9('0x70'));})['then'](function(_0x1cb51f){if(_0x1cb51f){logger['info'](_0x39e9('0x80'),_0x1cb51f['id']);}})[_0x39e9('0x26')](function(_0x529102){logger['error']('['+_0x1baecc['lastevent'][_0x39e9('0x90')]()+']',JSON[_0x39e9('0xb')](_0x529102));});}; \ No newline at end of file +var _0xe80c=['emit','stringify','length','forEach','includes','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','clientId','refresh_token','then','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','Call_Duration','talktime','mm:ss','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','uniqueid','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','/api/voice/recordings/','toUpperCase','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost'];(function(_0x458848,_0x2dcecd){var _0x20469e=function(_0x41de26){while(--_0x41de26){_0x458848['push'](_0x458848['shift']());}};_0x20469e(++_0x2dcecd);}(_0xe80c,0x1c2));var _0xce80=function(_0x50ca90,_0x38dad7){_0x50ca90=_0x50ca90-0x0;var _0x230354=_0xe80c[_0x50ca90];return _0x230354;};'use strict';var _=require('lodash');var rp=require(_0xce80('0x0'));var md5=require(_0xce80('0x1'));var util=require(_0xce80('0x2'));var intUtil=require(_0xce80('0x3'));var moment=require(_0xce80('0x4'));var Redis=require('ioredis');var BPromise=require(_0xce80('0x5'));var config=require(_0xce80('0x6'));var logger=require(_0xce80('0x7'))(_0xce80('0x8'));config['redis']=_[_0xce80('0x9')](config[_0xce80('0xa')],{'host':_0xce80('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xce80('0xa')]));function emit(_0x4c2e58,_0x40ee29,_0x58543e){io['to'](_0x4c2e58)[_0xce80('0xc')](_0x40ee29,_0x58543e);}function request(_0x3331d6){logger['debug']('[HTTP]',JSON[_0xce80('0xd')](_0x3331d6));return rp(_0x3331d6);}function getCustomFields(_0x159969,_0x490265){var _0x53b6df={};if(_0x159969[_0xce80('0xe')]>0x0){_[_0xce80('0xf')](_0x159969,function(_0x26261c){if(_[_0xce80('0x10')](['string',_0xce80('0x11')],_0x26261c[_0xce80('0x12')])&&_0x26261c[_0xce80('0x13')]){_0x53b6df[_0x26261c['idField']]=_0x26261c['content'][_0xce80('0x14')]();}else if(_0x26261c[_0xce80('0x12')]===_0xce80('0x15')&&_0x26261c[_0xce80('0x16')]&&_0x26261c['idField']&&_0x490265[_0x26261c[_0xce80('0x16')]]){_0x53b6df[_0x26261c['idField']]=_0x490265[_0x26261c[_0xce80('0x16')]]['toString']();}else if(_0x26261c[_0xce80('0x12')]===_0xce80('0x17')&&_0x26261c['Variable']&&_0x26261c['Variable']['name']&&_0x26261c[_0xce80('0x13')]&&_0x490265[_0x26261c[_0xce80('0x18')][_0xce80('0x19')][_0xce80('0x1a')]()]){_0x53b6df[_0x26261c[_0xce80('0x13')]]=_0x490265[_0x26261c['Variable'][_0xce80('0x19')][_0xce80('0x1a')]()]['toString']();}});}return _0x53b6df;}function getName(_0x56865a){if(_0x56865a['indexOf']('\x20')>0x0){var _0x1b82f5=_0x56865a[_0xce80('0x1b')](/ (.+)/);if(_0x1b82f5[0x1]){return _0x1b82f5;}}return[_0x56865a,_0x56865a];}var accountsTokens={};function getAccessToken(_0x468b61){return new Promise(function(_0x44f399,_0x4d9822){if(!_[_0xce80('0x1c')](accountsTokens[_0x468b61['id']])&&!_[_0xce80('0x1c')](accountsTokens[_0x468b61['id']][_0xce80('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x468b61['id']]['expires_in'])){_0x44f399(accountsTokens[_0x468b61['id']][_0xce80('0x1d')]);}}var _0x49fbc8;switch(_0x468b61[_0xce80('0x1e')]){case'US':_0x49fbc8=_0xce80('0x1f');break;case'AU':_0x49fbc8=_0xce80('0x20');break;case'EU':_0x49fbc8=_0xce80('0x21');break;case'IN':_0x49fbc8='https://accounts.zoho.in';break;case'CN':_0x49fbc8=_0xce80('0x22');break;default:_0x49fbc8='https://accounts.zoho.eu';break;}var _0x42a1dd={'method':_0xce80('0x23'),'uri':_0x49fbc8+'/oauth/v2/token','qs':{'refresh_token':_0x468b61['refreshToken'],'client_id':_0x468b61[_0xce80('0x24')],'client_secret':_0x468b61['clientSecret'],'grant_type':_0xce80('0x25')},'json':!![]};return rp(_0x42a1dd)[_0xce80('0x26')](function(_0x2a935a){accountsTokens[_0x468b61['id']]={'access_token':_0x2a935a[_0xce80('0x1d')],'expires_in':moment()['add'](_0x2a935a[_0xce80('0x27')],_0xce80('0x28'))};_0x44f399(_0x2a935a[_0xce80('0x1d')]);})[_0xce80('0x29')](function(_0x2e19da){logger[_0xce80('0x2a')](_0xce80('0x2b'),_0x2e19da[_0xce80('0x2c')]);_0x4d9822(_0x2e19da);});});}function getUser(_0x51b5bf,_0x40cd7e,_0x43ffb6,_0xa861d8){logger[_0xce80('0x2d')](_0xce80('0x2e'));return request({'method':_0xce80('0x2f'),'uri':util[_0xce80('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0x40cd7e),'qs':{'type':_0xce80('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x51b5bf},'json':!![]})['then'](function(_0x376ad8){if(_0x376ad8[_0xce80('0x32')]){var _0x39c1c0=-0x1;if(_[_0xce80('0x33')](_0x376ad8[_0xce80('0x32')])){if(!_[_0xce80('0x1c')](_0xa861d8)){_0x39c1c0=_[_0xce80('0x34')](_0x376ad8[_0xce80('0x32')],function(_0x5e2df9){return _0x5e2df9[_0xce80('0x35')]===_0xa861d8;});}if(_0x39c1c0>=0x0){logger['info'](_0xce80('0x36'));}else{logger[_0xce80('0x2d')](_0xce80('0x37'));_0x39c1c0=_[_0xce80('0x34')](_0x376ad8[_0xce80('0x32')],function(_0x3e07b8){return _0x3e07b8['profile'][_0xce80('0x19')]===_0xce80('0x38');});}return _0x376ad8[_0xce80('0x32')][_0x39c1c0];}else{if(_0x376ad8[_0xce80('0x39')][_0xce80('0x3a')][_0xce80('0x19')]==='Administrator'){logger['info'](_0xce80('0x37'));user=_0x376ad8[_0xce80('0x39')];return user;}else{logger[_0xce80('0x2a')](_0xce80('0x3b'),JSON[_0xce80('0xd')](_0x376ad8));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xce80('0xd')](_0x376ad8));}}}else{logger[_0xce80('0x2a')](_0xce80('0x3b'),JSON[_0xce80('0xd')](_0x376ad8));throw new Error(_0xce80('0x3c')+JSON[_0xce80('0xd')](_0x376ad8));}})[_0xce80('0x29')](function(_0x1a934d){console[_0xce80('0x2a')](_0x1a934d);});}function getZohoUser(_0x45e175,_0x5ddb23){return new BPromise(function(_0xd8dc54,_0x48939f){request(_0x45e175)[_0xce80('0x26')](function(_0x10a2ae){var _0x3111a9=null;if(_0x10a2ae){_0x3111a9=_0x10a2ae[_0xce80('0x3d')][0x0];_0x3111a9[_0xce80('0x3e')]=_0x5ddb23;}_0xd8dc54(_0x3111a9);})['catch'](function(_0x25c36c){_0x48939f(_0x25c36c);});});}function createEndUser(_0x4273dd,_0x5d0b1b,_0x53715e,_0x1d2dbe,_0x4908c8,_0x3d4781){var _0x53715e=getName(_0x53715e);return request({'method':_0xce80('0x23'),'uri':_0xce80('0x3f')+_0x5d0b1b+_0xce80('0x40')+_[_0xce80('0x41')](_0x3d4781['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x53715e[0x1],'First_Name':_0x53715e[0x0],'Phone':_0x1d2dbe,'Owner':{'name':!_[_0xce80('0x1c')](_0x4908c8[_0xce80('0x42')][_0xce80('0x19')])?_0x4908c8[_0xce80('0x42')]['name']:!_[_0xce80('0x1c')](_0x4908c8['first_name'])?_0x4908c8[_0xce80('0x43')]+'\x20'+_0x4908c8[_0xce80('0x44')]:_0x4908c8[_0xce80('0x44')],'id':_0x4908c8['id']}}]},'headers':{'Authorization':_0xce80('0x45')+_0x4273dd},'json':!![]})[_0xce80('0x26')](function(_0x5ecae9){if(_0x5ecae9&&_0x5ecae9[_0xce80('0x3d')][0x0][_0xce80('0x46')]===_0xce80('0x47')){var _0x5ef5a2=_0x5ecae9[_0xce80('0x3d')][0x0][_0xce80('0x48')];_0x5ef5a2[_0xce80('0x3e')]=_['startCase'](_0x3d4781[_0xce80('0x49')])+'s';return _0x5ef5a2;}logger[_0xce80('0x2a')](_0xce80('0x3b'),JSON['stringify'](data));throw new Error(_0xce80('0x4a')+JSON['stringify'](data));})[_0xce80('0x29')](function(_0xe3dda){console[_0xce80('0x4b')]('CREATE\x20ERROR',_0xe3dda);});}function getEndUser(_0x3b2ca,_0x1f489b,_0x2754fb,_0x4d10a0,_0x41c485,_0x55dbc1,_0x56d12d){var _0x3fa4ef={'method':_0xce80('0x2f'),'uri':'','headers':{'Authorization':_0xce80('0x45')+_0x3b2ca},'json':!![]};switch(_0x56d12d[_0xce80('0x4c')]){case _0xce80('0x4d'):_0x3fa4ef[_0xce80('0x4e')]=_0xce80('0x3f')+_0x1f489b+_0xce80('0x4f')+_0x41c485+'))';return getZohoUser(_0x3fa4ef,'Contacts')[_0xce80('0x26')](function(_0x563ff1){if(_0x563ff1)return _0x563ff1;_0x3fa4ef[_0xce80('0x4e')]=_0xce80('0x3f')+_0x1f489b+_0xce80('0x50')+_0x41c485+'))';return getZohoUser(_0x3fa4ef,_0xce80('0x51'))[_0xce80('0x26')](function(_0x118583){if(_0x118583)return _0x118583;if(_0x56d12d['moduleCreate']!=_0xce80('0x52')){return createEndUser(_0x3b2ca,_0x1f489b,_0x4d10a0,_0x41c485,_0x55dbc1,_0x56d12d);}else{return{};}});});break;case'contact':_0x3fa4ef[_0xce80('0x4e')]='https://www.zohoapis.'+_0x1f489b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x41c485+'))';return getZohoUser(_0x3fa4ef,_0xce80('0x53'))[_0xce80('0x26')](function(_0x38ca9f){if(_0x38ca9f)return _0x38ca9f;if(_0x56d12d[_0xce80('0x49')]!='nothing'){return createEndUser(_0x3b2ca,_0x1f489b,_0x4d10a0,_0x41c485,_0x55dbc1,_0x56d12d);}else{return{};}});break;case _0xce80('0x54'):_0x3fa4ef[_0xce80('0x4e')]='https://www.zohoapis.'+_0x1f489b+_0xce80('0x50')+_0x41c485+'))';return getZohoUser(_0x3fa4ef,_0xce80('0x51'))[_0xce80('0x26')](function(_0x62d2ee){if(_0x62d2ee)return _0x62d2ee;if(_0x56d12d['moduleCreate']!='nothing'){return createEndUser(_0x3b2ca,_0x1f489b,_0x4d10a0,_0x41c485,_0x55dbc1,_0x56d12d);}else{return{};}});break;}}function getCall(_0x4a1ce1,_0x4671d0,_0x2bd460,_0x2735e9,_0x5ddacc,_0x5d69f2,_0x18e21c,_0x5d4667){logger[_0xce80('0x2d')](_0xce80('0x55'));var _0x37de63={};_0x37de63[_0xce80('0x56')]={'name':!_[_0xce80('0x1c')](_0x2735e9[_0xce80('0x42')][_0xce80('0x19')])&&!_[_0xce80('0x1c')](_0x2735e9[_0xce80('0x3a')][_0xce80('0x19')])&&_0x2735e9[_0xce80('0x3a')]['name']===_0xce80('0x57')?_0x2735e9[_0xce80('0x42')][_0xce80('0x19')]:!_[_0xce80('0x1c')](_0x2735e9['first_name'])?_0x2735e9[_0xce80('0x43')]+'\x20'+_0x2735e9['last_name']:_0x2735e9[_0xce80('0x44')],'id':_0x2735e9['id']};_0x37de63[_0xce80('0x58')]=intUtil[_0xce80('0x59')](_0x5d69f2[_0xce80('0x5a')],_0x18e21c,'\x20');_0x37de63[_0xce80('0x5b')]=intUtil[_0xce80('0x59')](_0x5d69f2[_0xce80('0x5c')],_0x18e21c,'\x0a');if(_0x5ddacc[_0xce80('0x3e')]===_0xce80('0x53')){_0x37de63[_0xce80('0x5d')]={'name':!_['isNil'](_0x5ddacc[_0xce80('0x5e')])?_0x5ddacc[_0xce80('0x5e')]:!_[_0xce80('0x1c')](_0x5ddacc[_0xce80('0x5f')])?_0x5ddacc[_0xce80('0x5f')]+'\x20'+_0x5ddacc[_0xce80('0x60')]:_0x5ddacc[_0xce80('0x60')],'id':_0x5ddacc['id']};}if(_0x5ddacc[_0xce80('0x3e')]===_0xce80('0x51')){_0x37de63[_0xce80('0x61')]={'name':!_[_0xce80('0x1c')](_0x5ddacc[_0xce80('0x5e')])?_0x5ddacc[_0xce80('0x5e')]:!_[_0xce80('0x1c')](_0x5ddacc['First_Name'])?_0x5ddacc[_0xce80('0x5f')]+'\x20'+_0x5ddacc[_0xce80('0x60')]:_0x5ddacc[_0xce80('0x60')],'id':_0x5ddacc['id']};_0x37de63['$se_module']=_[_0xce80('0x41')](_0x5ddacc['enduserType']);}if(_0x18e21c['talktime']){_0x37de63[_0xce80('0x62')]=moment['utc'](parseInt(_0x18e21c[_0xce80('0x63')])*0x3e8)[_0xce80('0x30')](_0xce80('0x64'));}else if(_0x18e21c['answertime']&&_0x18e21c['endtime']){_0x37de63['Call_Duration']=moment[_0xce80('0x65')](moment(_0x18e21c[_0xce80('0x66')],_0xce80('0x67'))[_0xce80('0x68')](moment(_0x18e21c[_0xce80('0x69')],_0xce80('0x67'))))[_0xce80('0x30')](_0xce80('0x64'));}switch(_0x18e21c[_0xce80('0x6a')]){case _0xce80('0x6b'):_0x37de63[_0xce80('0x6c')]=_0xce80('0x6d');break;case'complete':case'connect':_0x37de63[_0xce80('0x6c')]=_0xce80('0x6e');break;case _0xce80('0x6f'):_0x37de63['Call_Result']=_0xce80('0x70');break;case _0xce80('0x71'):_0x37de63[_0xce80('0x6c')]='Abandoned';break;case _0xce80('0x72'):_0x37de63[_0xce80('0x6c')]=_0xce80('0x73');default:}_0x37de63[_0xce80('0x74')]=(_0x5d4667==='outbound'?moment(_0x18e21c[_0xce80('0x69')])['format'](_0xce80('0x67')):moment(_0x18e21c[_0xce80('0x75')])[_0xce80('0x30')](_0xce80('0x67')))||moment()[_0xce80('0x30')](_0xce80('0x67'));_0x37de63[_0xce80('0x76')]=_0x5d4667||_0xce80('0x77');_0x37de63=_[_0xce80('0x78')](_0x37de63,getCustomFields(_0x5d69f2[_0xce80('0x79')],_0x18e21c));return request({'method':_0xce80('0x23'),'uri':_0xce80('0x3f')+_0x4671d0+_0xce80('0x7a'),'headers':{'Authorization':_0xce80('0x45')+_0x4a1ce1},'body':{'data':[_0x37de63]},'json':!![]})[_0xce80('0x26')](function(_0x5b3e9a){if(_0x5b3e9a&&_0x5b3e9a['data'][0x0]['code']===_0xce80('0x47')){logger[_0xce80('0x2d')](_0xce80('0x7b'));return{'id':_0x5b3e9a[_0xce80('0x3d')][0x0]['details']['id']};}})[_0xce80('0x29')](function(_0x9215aa){logger[_0xce80('0x2d')](_0xce80('0x7c'),_0x9215aa[_0xce80('0x2c')]);console[_0xce80('0x4b')](_0xce80('0x7c'),_0x9215aa);});}exports['queue']=function(_0x2770bc,_0x10f274,_0x319e2a,_0x4bdada,_0x432794,_0x5802f4){var _0x2f7de5,_0xda8771,_0x5f036d;_0x5802f4[_0xce80('0x7d')]=intUtil['stripTrailingSlash'](_0x5802f4[_0xce80('0x7d')]);_0x5802f4[_0xce80('0x7e')]=intUtil[_0xce80('0x7f')](_0x5802f4[_0xce80('0x7e')]);if(_0x432794&&_0x432794[_0xce80('0x80')]){logger[_0xce80('0x2d')]('[QUEUE]',_0xce80('0x81'));_0x10f274['recordingURL']=_0x5802f4['serverUrl']+'/api/voice/recordings/'+_0x10f274['uniqueid']+_0xce80('0x82')+md5(_0x10f274[_0xce80('0x83')]);}else{_0x10f274[_0xce80('0x84')]='';}var _0x808faa=_0x5802f4[_0xce80('0x7d')]===_0xce80('0x85')?'eu':_0xce80('0x86');return getAccessToken(_0x5802f4)['then'](function(_0x26cd17){_0x5f036d=_0x26cd17;return getUser(_0x5f036d,_0x808faa,_0x5802f4,_0x4bdada['email']);})[_0xce80('0x26')](function(_0x1b5614){_0x2f7de5=_0x1b5614;logger[_0xce80('0x2d')](_0xce80('0x87'),_0x2f7de5['id']);return getEndUser(_0x5f036d,_0x808faa,_0x5802f4,_0x10f274[_0xce80('0x88')],_0x10f274[_0xce80('0x89')],_0x2f7de5,_0x319e2a);})[_0xce80('0x26')](function(_0x2e7424){_0xda8771=_0x2e7424;return getCall(_0x5f036d,_0x808faa,_0x5802f4,_0x2f7de5,_0xda8771,_0x319e2a,_0x10f274,_0xce80('0x77'));})[_0xce80('0x26')](function(_0x8c90e5){if(_0x8c90e5){logger[_0xce80('0x2d')](_0xce80('0x8a'),_0x8c90e5['id']);logger[_0xce80('0x2d')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xce80('0x8b'),_0x4bdada['name']),_0xce80('0x8c'),{'uri':_0xce80('0x8d')+_0x5802f4['host']+_0xce80('0x8e')+_0x8c90e5['id']});}})['catch'](function(_0x452a5c){logger['error'](_0xce80('0x8f'),JSON[_0xce80('0xd')](_0x452a5c));});};exports[_0xce80('0x90')]=function(_0x34be91,_0x107b2a,_0x41fdd7,_0x129fd5,_0x2156e7,_0x46f718,_0x57a591){var _0x55f246,_0x2a8b37,_0x3ba757;_0x46f718[_0xce80('0x7d')]=intUtil[_0xce80('0x7f')](_0x46f718['host']);_0x46f718[_0xce80('0x7e')]=intUtil[_0xce80('0x7f')](_0x46f718[_0xce80('0x7e')]);if(_0x57a591&&_0x57a591[_0xce80('0x91')]&&_0x57a591[_0xce80('0x91')]!==_0xce80('0x92')){logger['info'](_0xce80('0x93'),_0xce80('0x81'));_0x107b2a['recordingURL']=_0x46f718['serverUrl']+'/api/voice/recordings/'+_0x107b2a[_0xce80('0x83')]+_0xce80('0x82')+md5(_0x107b2a[_0xce80('0x83')]);}var _0x572197=_0x46f718[_0xce80('0x7d')]===_0xce80('0x85')?'eu':_0xce80('0x86');return getAccessToken(_0x46f718)['then'](function(_0x158bc3){_0x3ba757=_0x158bc3;return getUser(_0x3ba757,_0x572197,_0x46f718,_0x129fd5[_0xce80('0x35')]);})[_0xce80('0x26')](function(_0x3a0019){_0x55f246=_0x3a0019;logger[_0xce80('0x2d')](_0xce80('0x87'),_0x55f246['id']);return getEndUser(_0x3ba757,_0x572197,_0x46f718,_0x107b2a[_0xce80('0x94')],_0x107b2a[_0xce80('0x95')],_0x55f246,_0x41fdd7);})['then'](function(_0x35eac6){_0x2a8b37=_0x35eac6;return getCall(_0x3ba757,_0x572197,_0x46f718,_0x55f246,_0x2a8b37,_0x41fdd7,_0x107b2a,'Outbound');})[_0xce80('0x26')](function(_0x49445a){if(_0x49445a){logger['info']('The\x20Call\x20ID\x20is:',_0x49445a['id']);logger[_0xce80('0x2d')]('[OUTBOUND]',_0xce80('0x96'));emit(util[_0xce80('0x30')](_0xce80('0x8b'),_0x129fd5[_0xce80('0x19')]),_0xce80('0x8c'),{'uri':_0xce80('0x8d')+_0x46f718[_0xce80('0x7d')]+_0xce80('0x8e')+_0x49445a['id']});}})[_0xce80('0x29')](function(_0x536fbe){logger[_0xce80('0x2a')](_0xce80('0x93'),JSON[_0xce80('0xd')](_0x536fbe));});};exports[_0xce80('0x97')]=function(_0x1e4b20,_0x223295,_0x1572de,_0x144073,_0x8e521a,_0x46c9b5){var _0x198004,_0x5c079d,_0x3e1f1a;_0x46c9b5[_0xce80('0x7d')]=intUtil['stripTrailingSlash'](_0x46c9b5[_0xce80('0x7d')]);_0x46c9b5[_0xce80('0x7e')]=intUtil[_0xce80('0x7f')](_0x46c9b5[_0xce80('0x7e')]);if(_0x8e521a&&_0x8e521a[_0xce80('0x80')]){logger[_0xce80('0x2d')]('['+_0x223295[_0xce80('0x6a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x223295['recordingURL']=_0x46c9b5[_0xce80('0x7e')]+_0xce80('0x98')+_0x223295['uniqueid']+_0xce80('0x82')+md5(_0x223295[_0xce80('0x83')]);}else{_0x223295['recordingURL']='';}var _0x3213b2=_0x46c9b5['host']==='zoho.eu'?'eu':_0xce80('0x86');return getAccessToken(_0x46c9b5)[_0xce80('0x26')](function(_0x3f31bb){_0x3e1f1a=_0x3f31bb;return getUser(_0x3e1f1a,_0x3213b2,_0x46c9b5);})['then'](function(_0x457e83){_0x198004=_0x457e83;logger['info'](_0xce80('0x87'),_0x198004['id']);return getEndUser(_0x3e1f1a,_0x3213b2,_0x46c9b5,_0x223295[_0xce80('0x88')],_0x223295[_0xce80('0x89')],_0x198004,_0x1572de);})[_0xce80('0x26')](function(_0x517f4a){_0x5c079d=_0x517f4a;return getCall(_0x3e1f1a,_0x3213b2,_0x46c9b5,_0x198004,_0x5c079d,_0x1572de,_0x223295,_0xce80('0x77'));})[_0xce80('0x26')](function(_0x3fe69b){if(_0x3fe69b){logger[_0xce80('0x2d')]('The\x20Call\x20ID\x20is:',_0x3fe69b['id']);}})[_0xce80('0x29')](function(_0x37e4ec){logger[_0xce80('0x2a')]('['+_0x223295[_0xce80('0x6a')][_0xce80('0x99')]()+']',JSON[_0xce80('0xd')](_0x37e4ec));});}; \ 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 c26a7e5..c43f60e 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 _0xfbc4=['shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x36593b,_0x3eb553){var _0x2b25ac=function(_0x2e173a){while(--_0x2e173a){_0x36593b['push'](_0x36593b['shift']());}};_0x2b25ac(++_0x3eb553);}(_0xfbc4,0x84));var _0x4fbc=function(_0x44d5bd,_0x2b0625){_0x44d5bd=_0x44d5bd-0x0;var _0x13589f=_0xfbc4[_0x44d5bd];return _0x13589f;};'use strict';var util=require('util');var sh=require(_0x4fbc('0x0'));var Mustache=require(_0x4fbc('0x1'));var logger=require(_0x4fbc('0x2'))(_0x4fbc('0x3'));exports[_0x4fbc('0x4')]=function(_0x26c106,_0x151542){var _0x93d107=_0x26c106['data2']?_0x26c106[_0x4fbc('0x5')]:'Script';var _0x23e652=_0x26c106[_0x4fbc('0x6')]?Mustache[_0x4fbc('0x7')](_0x26c106[_0x4fbc('0x6')],_0x151542):_0x151542;sh[_0x4fbc('0x4')](_0x23e652,function(_0x2d2183,_0x79faec,_0x1375de){if(_0x2d2183!==0x0){logger['error'](util[_0x4fbc('0x8')](_0x4fbc('0x9'),_0x93d107,_0x23e652,_0x2d2183,_0x1375de));}else{logger[_0x4fbc('0xa')](util[_0x4fbc('0x8')](_0x4fbc('0xb'),_0x93d107,_0x23e652,_0x79faec));}});}; \ No newline at end of file +var _0x424b=['render','exec','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','trigger','data2','Script','data3'];(function(_0x3ac025,_0xb973a5){var _0x5777f1=function(_0x388cb2){while(--_0x388cb2){_0x3ac025['push'](_0x3ac025['shift']());}};_0x5777f1(++_0xb973a5);}(_0x424b,0xf6));var _0xb424=function(_0x525673,_0xb429c2){_0x525673=_0x525673-0x0;var _0x8f7574=_0x424b[_0x525673];return _0x8f7574;};'use strict';var util=require(_0xb424('0x0'));var sh=require('shelljs');var Mustache=require(_0xb424('0x1'));var logger=require('../../../../config/logger')(_0xb424('0x2'));exports['exec']=function(_0xf769c7,_0x112dd8){var _0x34d819=_0xf769c7[_0xb424('0x3')]?_0xf769c7['data2']:_0xb424('0x4');var _0x5e882a=_0xf769c7[_0xb424('0x5')]?Mustache[_0xb424('0x6')](_0xf769c7['data3'],_0x112dd8):_0x112dd8;sh[_0xb424('0x7')](_0x5e882a,function(_0x38a831,_0x125989,_0x4d3eb4){if(_0x38a831!==0x0){logger['error'](util[_0xb424('0x8')](_0xb424('0x9'),_0x34d819,_0x5e882a,_0x38a831,_0x4d3eb4));}else{logger[_0xb424('0xa')](util[_0xb424('0x8')](_0xb424('0xb'),_0x34d819,_0x5e882a,_0x125989));}});}; \ 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 1ea1a76..26dd486 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 _0x146e=['render','data2','data5','number','headers','data6','parse','error','stack','data1','GET','POST','PUT','body','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','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','../../../../config/logger','exec','toUpperCase'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x146e,0x9a));var _0xe146=function(_0x3911a0,_0x399077){_0x3911a0=_0x3911a0-0x0;var _0xf3dd14=_0x146e[_0x3911a0];return _0xf3dd14;};'use strict';var rp=require(_0xe146('0x0'));var util=require(_0xe146('0x1'));var _=require(_0xe146('0x2'));var Mustache=require('mustache');var logger=require(_0xe146('0x3'))('trigger');exports[_0xe146('0x4')]=function(_0x3c51bc,_0x4123d3){var _0x538fc0,_0x6d6468;var _0x1f6171={'method':_0x3c51bc['data1'][_0xe146('0x5')](),'uri':Mustache[_0xe146('0x6')](_0x3c51bc[_0xe146('0x7')],_0x4123d3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3c51bc[_0xe146('0x8')])===_0xe146('0x9')&&parseInt(_0x3c51bc[_0xe146('0x8')])>=0x1&&parseInt(_0x3c51bc[_0xe146('0x8')])<=0xa?parseInt(_0x3c51bc[_0xe146('0x8')])*0x3e8:0x5*0x3e8};try{_0x1f6171[_0xe146('0xa')]=_0x3c51bc[_0xe146('0xb')]?JSON[_0xe146('0xc')](Mustache[_0xe146('0x6')](_0x3c51bc[_0xe146('0xb')],_0x4123d3)):{};}catch(_0x555808){logger[_0xe146('0xd')](_0x555808[_0xe146('0xe')]);}switch(_0x3c51bc[_0xe146('0xf')]['toUpperCase']()){case _0xe146('0x10'):case'DELETE':_0x538fc0=null;_0x1f6171['qs']=_0x4123d3;break;case _0xe146('0x11'):case _0xe146('0x12'):if(_0x3c51bc['data7']){try{_0x538fc0=JSON[_0xe146('0xc')](Mustache[_0xe146('0x6')](_0x3c51bc['data7'],_0x4123d3));_0x1f6171[_0xe146('0x13')]=_0x538fc0;}catch(_0x226e3c){logger[_0xe146('0xd')](_0x226e3c[_0xe146('0xe')]);logger[_0xe146('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x538fc0=_0x4123d3;_0x1f6171['body']=_0x538fc0;}break;}logger[_0xe146('0x14')](util[_0xe146('0x15')](_0xe146('0x16'),_0x3c51bc[_0xe146('0xf')],_0x3c51bc['data2'],JSON[_0xe146('0x17')](_0x1f6171)));rp(_0x1f6171)[_0xe146('0x18')](function(_0x5cf07a){_0x538fc0=!_[_0xe146('0x19')](_0x538fc0)?_0xe146('0x1a')+_0x538fc0:'';_0x6d6468=typeof _0x5cf07a[_0xe146('0x13')]==='object'?JSON[_0xe146('0x17')](_0x5cf07a[_0xe146('0x13')]):_0x5cf07a['body'];logger[_0xe146('0x14')](util[_0xe146('0x15')](_0xe146('0x1b'),_0x3c51bc['data1'],_0x3c51bc[_0xe146('0x7')],_0x5cf07a[_0xe146('0x1c')],_0x6d6468));})['catch'](function(_0xfc8f34){logger[_0xe146('0xd')](util[_0xe146('0x15')](_0xe146('0x1d'),_0x3c51bc[_0xe146('0xf')],_0x3c51bc[_0xe146('0x7')],_0xfc8f34[_0xe146('0x1c')],_0xfc8f34[_0xe146('0x1e')],_0xfc8f34[_0xe146('0x1f')]));});}; \ No newline at end of file +var _0x05d9=['error','GET','DELETE','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','object','%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','message','request-promise','util','lodash','mustache','trigger','data1','toUpperCase','render','data2','data5','number','headers','parse'];(function(_0x10b3ba,_0x16ae34){var _0x5449df=function(_0x1d75c6){while(--_0x1d75c6){_0x10b3ba['push'](_0x10b3ba['shift']());}};_0x5449df(++_0x16ae34);}(_0x05d9,0x133));var _0x905d=function(_0xcb0f2e,_0x688634){_0xcb0f2e=_0xcb0f2e-0x0;var _0x2b457d=_0x05d9[_0xcb0f2e];return _0x2b457d;};'use strict';var rp=require(_0x905d('0x0'));var util=require(_0x905d('0x1'));var _=require(_0x905d('0x2'));var Mustache=require(_0x905d('0x3'));var logger=require('../../../../config/logger')(_0x905d('0x4'));exports['exec']=function(_0x719d57,_0x3683b7){var _0x2b4983,_0x58226f;var _0x29d0c4={'method':_0x719d57[_0x905d('0x5')][_0x905d('0x6')](),'uri':Mustache[_0x905d('0x7')](_0x719d57[_0x905d('0x8')],_0x3683b7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x719d57[_0x905d('0x9')])===_0x905d('0xa')&&parseInt(_0x719d57[_0x905d('0x9')])>=0x1&&parseInt(_0x719d57[_0x905d('0x9')])<=0xa?parseInt(_0x719d57[_0x905d('0x9')])*0x3e8:0x5*0x3e8};try{_0x29d0c4[_0x905d('0xb')]=_0x719d57['data6']?JSON[_0x905d('0xc')](Mustache[_0x905d('0x7')](_0x719d57['data6'],_0x3683b7)):{};}catch(_0x1d5b44){logger[_0x905d('0xd')](_0x1d5b44['stack']);}switch(_0x719d57[_0x905d('0x5')]['toUpperCase']()){case _0x905d('0xe'):case _0x905d('0xf'):_0x2b4983=null;_0x29d0c4['qs']=_0x3683b7;break;case'POST':case _0x905d('0x10'):if(_0x719d57[_0x905d('0x11')]){try{_0x2b4983=JSON[_0x905d('0xc')](Mustache['render'](_0x719d57[_0x905d('0x11')],_0x3683b7));_0x29d0c4[_0x905d('0x12')]=_0x2b4983;}catch(_0x479db5){logger[_0x905d('0xd')](_0x479db5[_0x905d('0x13')]);logger[_0x905d('0xd')](_0x905d('0x14'));}}else{_0x2b4983=_0x3683b7;_0x29d0c4[_0x905d('0x12')]=_0x2b4983;}break;}logger[_0x905d('0x15')](util[_0x905d('0x16')](_0x905d('0x17'),_0x719d57[_0x905d('0x5')],_0x719d57[_0x905d('0x8')],JSON[_0x905d('0x18')](_0x29d0c4)));rp(_0x29d0c4)[_0x905d('0x19')](function(_0x38ca49){_0x2b4983=!_['isNil'](_0x2b4983)?',\x20request\x20body:\x20'+_0x2b4983:'';_0x58226f=typeof _0x38ca49['body']===_0x905d('0x1a')?JSON['stringify'](_0x38ca49[_0x905d('0x12')]):_0x38ca49[_0x905d('0x12')];logger[_0x905d('0x15')](util[_0x905d('0x16')](_0x905d('0x1b'),_0x719d57[_0x905d('0x5')],_0x719d57['data2'],_0x38ca49[_0x905d('0x1c')],_0x58226f));})[_0x905d('0x1d')](function(_0x2c4768){logger[_0x905d('0xd')](util[_0x905d('0x16')](_0x905d('0x1e'),_0x719d57[_0x905d('0x5')],_0x719d57[_0x905d('0x8')],_0x2c4768[_0x905d('0x1c')],_0x2c4768['name'],_0x2c4768[_0x905d('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index a7e5e1c..dfadcf8 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 _0x5531=['error','message','jayson/promise','bluebird','client','Request','request','then','debug','rpc','routing'];(function(_0x3ce857,_0x304c70){var _0x26c60f=function(_0x1462a5){while(--_0x1462a5){_0x3ce857['push'](_0x3ce857['shift']());}};_0x26c60f(++_0x304c70);}(_0x5531,0x183));var _0x1553=function(_0x4c0984,_0x4e3c82){_0x4c0984=_0x4c0984-0x0;var _0x242f18=_0x5531[_0x4c0984];return _0x242f18;};'use strict';var jayson=require(_0x1553('0x0'));var BPromise=require(_0x1553('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x1553('0x2')]['http']({'port':0x2329});client[_0x1553('0x3')]=function(_0x55620b,_0x232c2b){return new BPromise(function(_0x2d190f,_0x1fa2eb){return client[_0x1553('0x4')](_0x55620b,_0x232c2b)[_0x1553('0x5')](function(_0x3c4a88){logger[_0x1553('0x6')](_0x1553('0x7'),_0x1553('0x8'),_0x55620b,_0x232c2b,_0x3c4a88);if(_0x3c4a88['error']){logger[_0x1553('0x9')](_0x1553('0x7'),_0x1553('0x8'),_0x55620b,_0x3c4a88[_0x1553('0x9')][_0x1553('0xa')],_0x232c2b);return _0x1fa2eb(_0x3c4a88[_0x1553('0x9')][_0x1553('0xa')]);}else{return _0x2d190f(_0x3c4a88['result']);}})['catch'](function(_0x24c354){logger['error'](_0x1553('0x7'),_0x1553('0x8'),_0x55620b,_0x24c354,_0x232c2b);return _0x1fa2eb(_0x24c354);});});};module['exports']=client; \ No newline at end of file +var _0x4aa9=['routing','client','Request','request','then','debug','rpc','error','message','result','catch','exports','bluebird'];(function(_0x514883,_0x4b9fb1){var _0x287a0d=function(_0x3242ac){while(--_0x3242ac){_0x514883['push'](_0x514883['shift']());}};_0x287a0d(++_0x4b9fb1);}(_0x4aa9,0x185));var _0x94aa=function(_0x182caa,_0x2d25cf){_0x182caa=_0x182caa-0x0;var _0x18f0ac=_0x4aa9[_0x182caa];return _0x18f0ac;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x94aa('0x0'));var logger=require('../../config/logger')(_0x94aa('0x1'));var client=jayson[_0x94aa('0x2')]['http']({'port':0x2329});client[_0x94aa('0x3')]=function(_0x1ab10b,_0x4ff877){return new BPromise(function(_0x56c17a,_0x1d1c87){return client[_0x94aa('0x4')](_0x1ab10b,_0x4ff877)[_0x94aa('0x5')](function(_0x347f44){logger[_0x94aa('0x6')](_0x94aa('0x7'),_0x94aa('0x1'),_0x1ab10b,_0x4ff877,_0x347f44);if(_0x347f44[_0x94aa('0x8')]){logger['error'](_0x94aa('0x7'),_0x94aa('0x1'),_0x1ab10b,_0x347f44[_0x94aa('0x8')][_0x94aa('0x9')],_0x4ff877);return _0x1d1c87(_0x347f44[_0x94aa('0x8')]['message']);}else{return _0x56c17a(_0x347f44[_0x94aa('0xa')]);}})[_0x94aa('0xb')](function(_0x4b0c64){logger['error']('rpc',_0x94aa('0x1'),_0x1ab10b,_0x4b0c64,_0x4ff877);return _0x1d1c87(_0x4b0c64);});});};module[_0x94aa('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 132adac..4f70d69 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 _0x950a=['refresh','mailAccounts','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./lib/email','./rpc/mailAccount','email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x950a,0xf0));var _0xa950=function(_0x44da0a,_0x37814d){_0x44da0a=_0x44da0a-0x0;var _0x10f937=_0x950a[_0x44da0a];return _0x10f937;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0xa950('0x0'));var mailAccount=require(_0xa950('0x1'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0xa950('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa950('0x3')]()[_0xa950('0x4')](mailAccount[_0xa950('0x5')]())['then'](realtime[_0xa950('0x6')]())[_0xa950('0x4')](function(){email[_0xa950('0x7')](realtime[_0xa950('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xa950('0x9')]();})[_0xa950('0x4')](function(_0x227870){return setInterval(initRealtime,_0x227870[_0xa950('0xa')]*0x3e8);})['catch'](function(_0x495a0f){logger[_0xa950('0xb')](_0xa950('0xc'),_0x495a0f);});}main(); \ No newline at end of file +var _0xb285=['refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x1ef04e,_0x26c2fd){var _0x59a3c8=function(_0x18fc2e){while(--_0x18fc2e){_0x1ef04e['push'](_0x1ef04e['shift']());}};_0x59a3c8(++_0x26c2fd);}(_0xb285,0x15a));var _0x5b28=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xb285[_0x40be86];return _0xda3c3b;};'use strict';var server=require(_0x5b28('0x0'));var Realtime=require(_0x5b28('0x1'));var EmailChannel=require(_0x5b28('0x2'));var mailAccount=require(_0x5b28('0x3'));var setting=require(_0x5b28('0x4'));var logger=require(_0x5b28('0x5'))(_0x5b28('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x5b28('0x7')]()[_0x5b28('0x8')](mailAccount[_0x5b28('0x9')]())[_0x5b28('0x8')](realtime[_0x5b28('0xa')]())[_0x5b28('0x8')](function(){email[_0x5b28('0xb')](realtime[_0x5b28('0xc')]);return realtime;});}function main(){return server[_0x5b28('0xd')](realtime,email)[_0x5b28('0x8')](function(){return initRealtime();})[_0x5b28('0x8')](function(){return setting[_0x5b28('0xe')]();})['then'](function(_0x2d1f0a){return setInterval(initRealtime,_0x2d1f0a[_0x5b28('0xf')]*0x3e8);})['catch'](function(_0x17a09b){logger[_0x5b28('0x10')]('Email\x20service\x20initialization',_0x17a09b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 5b675a7..add6583 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 _0x9b9c=['info','mailAccounts','imapAccounts','prototype','emit','name','key','status','Imap','messageStatus','total','isNil','mailAccount:update','refresh','hasOwnProperty','active','service','provider','custom','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount'];(function(_0x5c88c9,_0x5b6789){var _0x167455=function(_0x34741b){while(--_0x34741b){_0x5c88c9['push'](_0x5c88c9['shift']());}};_0x167455(++_0x5b6789);}(_0x9b9c,0x1c3));var _0xc9b9=function(_0x56ad87,_0x184d05){_0x56ad87=_0x56ad87-0x0;var _0x1c3218=_0x9b9c[_0x56ad87];return _0x1c3218;};'use strict';var _=require(_0xc9b9('0x0'));var moment=require(_0xc9b9('0x1'));var BPromise=require('bluebird');var md5=require(_0xc9b9('0x2'));var Redis=require(_0xc9b9('0x3'));var config=require(_0xc9b9('0x4'));var logger=require(_0xc9b9('0x5'))(_0xc9b9('0x6'));config[_0xc9b9('0x7')]=_[_0xc9b9('0x8')](config[_0xc9b9('0x7')],{'host':_0xc9b9('0x9'),'port':0x18eb});var io=require(_0xc9b9('0xa'))(new Redis(config['redis']));var EmailImap=require(_0xc9b9('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xc9b9('0xc'));var md5Accounts={};function EmailChannel(_0x341655){logger[_0xc9b9('0xd')]('start\x20email\x20channel');this[_0xc9b9('0xe')]=_0x341655[_0xc9b9('0xe')];this[_0xc9b9('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xc9b9('0x10')][_0xc9b9('0x11')]=function(_0x57966f){var _0x456ea1=this['mailAccounts'][_0x57966f];var _0x4fc5d1={'id':_0x456ea1['id'],'name':_0x456ea1[_0xc9b9('0x12')],'key':_0x456ea1[_0xc9b9('0x13')],'active':_0x456ea1['active'],'Imap':{'status':_0x456ea1['Imap'][_0xc9b9('0x14')],'messageStatus':_0x456ea1[_0xc9b9('0x15')][_0xc9b9('0x16')],'total':_0x456ea1['Imap'][_0xc9b9('0x17')]}};if(_[_0xc9b9('0x18')](md5Accounts[_0x57966f])){md5Accounts[_0x57966f]={};}var _0x2421d8=md5(JSON['stringify'](_0x4fc5d1));if(md5Accounts[_0x57966f][_0xc9b9('0x2')]!==_0x2421d8){md5Accounts[_0x57966f][_0xc9b9('0x2')]=_0x2421d8;io[_0xc9b9('0x11')](_0xc9b9('0x19'),_0x4fc5d1);}};EmailChannel[_0xc9b9('0x10')][_0xc9b9('0x1a')]=function(_0x349947){for(var _0x5d04fe in _0x349947){if(_0x349947[_0xc9b9('0x1b')](_0x5d04fe)){if(_0x349947[_0x5d04fe][_0xc9b9('0x15')]&&_0x349947[_0x5d04fe][_0xc9b9('0x1c')]){var _0x2ebad5=_0x349947[_0x5d04fe][_0xc9b9('0x15')];if(!_0x2ebad5[_0xc9b9('0x1d')]&&_0x349947[_0x5d04fe][_0xc9b9('0x1e')]!==_0xc9b9('0x1f'))_0x2ebad5['service']=_0x349947[_0x5d04fe][_0xc9b9('0x1e')];if(!this[_0xc9b9('0xf')]['hasOwnProperty'](_0x2ebad5['id'])){this[_0xc9b9('0xf')][_0x2ebad5['id']]=new EmailImap(_0x2ebad5,_0x349947[_0x5d04fe][_0xc9b9('0x6')]);this['imapAccounts'][_0x2ebad5['id']]['on']('box',this[_0xc9b9('0x20')]['bind'](this,_0x5d04fe));this['imapAccounts'][_0x2ebad5['id']]['on'](_0xc9b9('0x6'),this[_0xc9b9('0x21')][_0xc9b9('0x22')](this,_0x5d04fe));this[_0xc9b9('0xf')][_0x2ebad5['id']]['on'](_0xc9b9('0x23'),this[_0xc9b9('0x24')][_0xc9b9('0x22')](this,_0x5d04fe));this[_0xc9b9('0xf')][_0x2ebad5['id']]['on'](_0xc9b9('0x25'),this[_0xc9b9('0x26')]['bind'](this,_0x5d04fe));}}else{if(_[_0xc9b9('0x18')](this[_0xc9b9('0xe')][_0x5d04fe][_0xc9b9('0x15')])){this[_0xc9b9('0xe')][_0x5d04fe]['Imap']={};}this['mailAccounts'][_0x5d04fe]['Imap'][_0xc9b9('0x14')]=_0xc9b9('0x27');this['mailAccounts'][_0x5d04fe]['Imap'][_0xc9b9('0x16')]='';this['emit'](_0x5d04fe);}}}};EmailChannel['prototype'][_0xc9b9('0x20')]=function(_0x4a85c6,_0x30dfb0){if(this[_0xc9b9('0xe')][_0x4a85c6]){this[_0xc9b9('0xe')][_0x4a85c6]['Imap'][_0xc9b9('0x14')]=_0xc9b9('0x28');this['mailAccounts'][_0x4a85c6]['Imap'][_0xc9b9('0x16')]=_0x30dfb0[_0xc9b9('0x12')];if(_0x30dfb0[_0xc9b9('0x29')]){this[_0xc9b9('0xe')][_0x4a85c6][_0xc9b9('0x15')][_0xc9b9('0x17')]=_0x30dfb0['messages'][_0xc9b9('0x17')];}return this['emit'](_0x4a85c6);}};EmailChannel[_0xc9b9('0x10')][_0xc9b9('0x21')]=function(_0x1cbbcd,_0xffdcca){logger[_0xc9b9('0xd')](_0xc9b9('0x2a'),_0xffdcca['firstName'],_0xffdcca['lastName'],_0xffdcca[_0xc9b9('0x2b')],_0x1cbbcd);if(this[_0xc9b9('0xe')][_0x1cbbcd]){return mailAccount['notify'](_0x1cbbcd,_0xffdcca)[_0xc9b9('0x2c')](function(_0x31cda1){if(_0x31cda1){logger[_0xc9b9('0xd')](_0xc9b9('0x2d'));}})['catch'](function(_0x7269de){logger[_0xc9b9('0x25')](_0xc9b9('0x2e'),JSON[_0xc9b9('0x2f')](_0x7269de));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x4f7bf3){if(this[_0xc9b9('0xe')][_0x4f7bf3]&&this[_0xc9b9('0xe')][_0x4f7bf3]['Imap']){if(this[_0xc9b9('0xf')][this[_0xc9b9('0xe')][_0x4f7bf3][_0xc9b9('0x15')]['id']]){delete this[_0xc9b9('0xf')][this['mailAccounts'][_0x4f7bf3][_0xc9b9('0x15')]['id']];}this[_0xc9b9('0xe')][_0x4f7bf3][_0xc9b9('0x15')][_0xc9b9('0x30')]=moment();this['emit'](_0x4f7bf3);}};EmailChannel[_0xc9b9('0x10')][_0xc9b9('0x26')]=function(_0x4b15a7,_0x47c43a){if(this[_0xc9b9('0xe')][_0x4b15a7]){this[_0xc9b9('0xe')][_0x4b15a7][_0xc9b9('0x15')][_0xc9b9('0x14')]='error';this[_0xc9b9('0xe')][_0x4b15a7][_0xc9b9('0x15')][_0xc9b9('0x16')]=_0x47c43a;return this[_0xc9b9('0x11')](_0x4b15a7);}};EmailChannel[_0xc9b9('0x10')][_0xc9b9('0x31')]=function(_0x4e016d,_0x2b1509){return this[_0xc9b9('0x32')][_0xc9b9('0x33')](_0x4e016d,_0x2b1509);};EmailChannel[_0xc9b9('0x10')][_0xc9b9('0x34')]=function(_0x1d18a2){var _0x3cab73=this;if(this['mailAccounts'][_0x1d18a2['id']]){if(_[_0xc9b9('0x18')](this[_0xc9b9('0xe')][_0x1d18a2['id']][_0xc9b9('0x35')])){this[_0xc9b9('0xe')][_0x1d18a2['id']][_0xc9b9('0x35')]={};}this[_0xc9b9('0xe')][_0x1d18a2['id']]['Smtp'][_0xc9b9('0x30')]=moment();return new BPromise(function(_0x1c5214,_0xf9f075){return _0x3cab73[_0xc9b9('0x32')][_0xc9b9('0x36')](_0x1d18a2)['then'](function(_0x9d7778){_0x3cab73[_0xc9b9('0xe')][_0x1d18a2['id']][_0xc9b9('0x35')][_0xc9b9('0x14')]=_0xc9b9('0x37');_0x3cab73['mailAccounts'][_0x1d18a2['id']][_0xc9b9('0x35')][_0xc9b9('0x16')]='';_0x3cab73[_0xc9b9('0x11')](_0x1d18a2['id']);_0x1c5214(_0x9d7778);})[_0xc9b9('0x38')](function(_0x411fc4){_0x3cab73[_0xc9b9('0xe')][_0x1d18a2['id']][_0xc9b9('0x35')][_0xc9b9('0x14')]='error';_0x3cab73[_0xc9b9('0xe')][_0x1d18a2['id']][_0xc9b9('0x35')][_0xc9b9('0x16')]=_0x411fc4;_0x3cab73['emit'](_0x1d18a2['id']);_0xf9f075(_0x411fc4);});});}return this[_0xc9b9('0x32')][_0xc9b9('0x36')](_0x1d18a2);};module[_0xc9b9('0x39')]=EmailChannel; \ No newline at end of file +var _0x196b=['mailAccounts','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEnd','error','handleImapError','disabled','connected','messages','handleImapEmail','lastName','from','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','then','verified','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','imapAccounts','smtp','prototype','emit'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x196b,0x1c4));var _0xb196=function(_0x531e0d,_0x546db6){_0x531e0d=_0x531e0d-0x0;var _0x2fed77=_0x196b[_0x531e0d];return _0x2fed77;};'use strict';var _=require(_0xb196('0x0'));var moment=require(_0xb196('0x1'));var BPromise=require(_0xb196('0x2'));var md5=require(_0xb196('0x3'));var Redis=require(_0xb196('0x4'));var config=require(_0xb196('0x5'));var logger=require(_0xb196('0x6'))(_0xb196('0x7'));config[_0xb196('0x8')]=_[_0xb196('0x9')](config['redis'],{'host':_0xb196('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb196('0x8')]));var EmailImap=require(_0xb196('0xb'));var EmailSmtp=require(_0xb196('0xc'));var mailAccount=require(_0xb196('0xd'));var md5Accounts={};function EmailChannel(_0x1364ab){logger[_0xb196('0xe')](_0xb196('0xf'));this['mailAccounts']=_0x1364ab['mailAccounts'];this[_0xb196('0x10')]={};this[_0xb196('0x11')]=new EmailSmtp();}EmailChannel[_0xb196('0x12')][_0xb196('0x13')]=function(_0x350f75){var _0x44e414=this[_0xb196('0x14')][_0x350f75];var _0x5cbda2={'id':_0x44e414['id'],'name':_0x44e414[_0xb196('0x15')],'key':_0x44e414[_0xb196('0x16')],'active':_0x44e414[_0xb196('0x17')],'Imap':{'status':_0x44e414[_0xb196('0x18')][_0xb196('0x19')],'messageStatus':_0x44e414[_0xb196('0x18')][_0xb196('0x1a')],'total':_0x44e414[_0xb196('0x18')][_0xb196('0x1b')]}};if(_[_0xb196('0x1c')](md5Accounts[_0x350f75])){md5Accounts[_0x350f75]={};}var _0x23b797=md5(JSON[_0xb196('0x1d')](_0x5cbda2));if(md5Accounts[_0x350f75][_0xb196('0x3')]!==_0x23b797){md5Accounts[_0x350f75][_0xb196('0x3')]=_0x23b797;io[_0xb196('0x13')](_0xb196('0x1e'),_0x5cbda2);}};EmailChannel[_0xb196('0x12')][_0xb196('0x1f')]=function(_0x387274){for(var _0x1729db in _0x387274){if(_0x387274[_0xb196('0x20')](_0x1729db)){if(_0x387274[_0x1729db][_0xb196('0x18')]&&_0x387274[_0x1729db][_0xb196('0x17')]){var _0x7ba2af=_0x387274[_0x1729db][_0xb196('0x18')];if(!_0x7ba2af[_0xb196('0x21')]&&_0x387274[_0x1729db][_0xb196('0x22')]!==_0xb196('0x23'))_0x7ba2af['service']=_0x387274[_0x1729db]['provider'];if(!this[_0xb196('0x10')][_0xb196('0x20')](_0x7ba2af['id'])){this['imapAccounts'][_0x7ba2af['id']]=new EmailImap(_0x7ba2af,_0x387274[_0x1729db]['email']);this[_0xb196('0x10')][_0x7ba2af['id']]['on'](_0xb196('0x24'),this[_0xb196('0x25')][_0xb196('0x26')](this,_0x1729db));this[_0xb196('0x10')][_0x7ba2af['id']]['on'](_0xb196('0x7'),this['handleImapEmail']['bind'](this,_0x1729db));this[_0xb196('0x10')][_0x7ba2af['id']]['on']('end',this[_0xb196('0x27')][_0xb196('0x26')](this,_0x1729db));this[_0xb196('0x10')][_0x7ba2af['id']]['on'](_0xb196('0x28'),this[_0xb196('0x29')][_0xb196('0x26')](this,_0x1729db));}}else{if(_[_0xb196('0x1c')](this[_0xb196('0x14')][_0x1729db][_0xb196('0x18')])){this[_0xb196('0x14')][_0x1729db]['Imap']={};}this[_0xb196('0x14')][_0x1729db][_0xb196('0x18')]['status']=_0xb196('0x2a');this['mailAccounts'][_0x1729db][_0xb196('0x18')]['messageStatus']='';this[_0xb196('0x13')](_0x1729db);}}}};EmailChannel[_0xb196('0x12')][_0xb196('0x25')]=function(_0x440222,_0x559801){if(this['mailAccounts'][_0x440222]){this[_0xb196('0x14')][_0x440222][_0xb196('0x18')][_0xb196('0x19')]=_0xb196('0x2b');this[_0xb196('0x14')][_0x440222][_0xb196('0x18')][_0xb196('0x1a')]=_0x559801[_0xb196('0x15')];if(_0x559801['messages']){this['mailAccounts'][_0x440222][_0xb196('0x18')][_0xb196('0x1b')]=_0x559801[_0xb196('0x2c')][_0xb196('0x1b')];}return this[_0xb196('0x13')](_0x440222);}};EmailChannel[_0xb196('0x12')][_0xb196('0x2d')]=function(_0x424cf9,_0x45d992){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x45d992['firstName'],_0x45d992[_0xb196('0x2e')],_0x45d992[_0xb196('0x2f')],_0x424cf9);if(this['mailAccounts'][_0x424cf9]){return mailAccount['notify'](_0x424cf9,_0x45d992)['then'](function(_0xe698e6){if(_0xe698e6){logger[_0xb196('0xe')]('Mail\x20accepted\x20from\x20routing');}})[_0xb196('0x30')](function(_0x3e4792){logger[_0xb196('0x28')](_0xb196('0x31'),JSON[_0xb196('0x1d')](_0x3e4792));});}};EmailChannel[_0xb196('0x12')][_0xb196('0x27')]=function(_0x28c138){if(this['mailAccounts'][_0x28c138]&&this['mailAccounts'][_0x28c138][_0xb196('0x18')]){if(this[_0xb196('0x10')][this[_0xb196('0x14')][_0x28c138][_0xb196('0x18')]['id']]){delete this[_0xb196('0x10')][this[_0xb196('0x14')][_0x28c138][_0xb196('0x18')]['id']];}this['mailAccounts'][_0x28c138][_0xb196('0x18')][_0xb196('0x32')]=moment();this[_0xb196('0x13')](_0x28c138);}};EmailChannel['prototype'][_0xb196('0x29')]=function(_0x563307,_0x3ef0d8){if(this[_0xb196('0x14')][_0x563307]){this[_0xb196('0x14')][_0x563307]['Imap']['status']='error';this[_0xb196('0x14')][_0x563307][_0xb196('0x18')][_0xb196('0x1a')]=_0x3ef0d8;return this['emit'](_0x563307);}};EmailChannel['prototype'][_0xb196('0x33')]=function(_0x22eeae,_0x21d814){return this['smtp'][_0xb196('0x34')](_0x22eeae,_0x21d814);};EmailChannel[_0xb196('0x12')][_0xb196('0x35')]=function(_0x2bca60){var _0x2b8e72=this;if(this['mailAccounts'][_0x2bca60['id']]){if(_[_0xb196('0x1c')](this['mailAccounts'][_0x2bca60['id']][_0xb196('0x36')])){this['mailAccounts'][_0x2bca60['id']][_0xb196('0x36')]={};}this[_0xb196('0x14')][_0x2bca60['id']][_0xb196('0x36')][_0xb196('0x32')]=moment();return new BPromise(function(_0x5edaca,_0x5cf5ce){return _0x2b8e72[_0xb196('0x11')]['verify'](_0x2bca60)[_0xb196('0x37')](function(_0x2ad63e){_0x2b8e72[_0xb196('0x14')][_0x2bca60['id']]['Smtp'][_0xb196('0x19')]=_0xb196('0x38');_0x2b8e72[_0xb196('0x14')][_0x2bca60['id']][_0xb196('0x36')][_0xb196('0x1a')]='';_0x2b8e72[_0xb196('0x13')](_0x2bca60['id']);_0x5edaca(_0x2ad63e);})[_0xb196('0x30')](function(_0x49e689){_0x2b8e72[_0xb196('0x14')][_0x2bca60['id']][_0xb196('0x36')][_0xb196('0x19')]='error';_0x2b8e72['mailAccounts'][_0x2bca60['id']][_0xb196('0x36')][_0xb196('0x1a')]=_0x49e689;_0x2b8e72['emit'](_0x2bca60['id']);_0x5cf5ce(_0x49e689);});});}return this['smtp'][_0xb196('0x39')](_0x2bca60);};module[_0xb196('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 22e6b2b..01c2605 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 _0xc119=['length','fetch','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchError','textCode','hasOwnProperty','exports','lodash','util','imap','iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount','ready','handleReady','once','handleEnd','bind','error','connect','inherits','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','prototype','emit','box','handleCloseBox','handleError','end','UNSEEN','handleReadUnseen'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xc119,0xb9));var _0x9c11=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0xc119[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0x9c11('0x0'));var util=require(_0x9c11('0x1'));var Imap=require(_0x9c11('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x9c11('0x3'))['Iconv'];var EventEmitter=require(_0x9c11('0x4'))[_0x9c11('0x5')];var utils=require(_0x9c11('0x6'));var logger=require('../../../config/logger')(_0x9c11('0x7'));function EmailImap(_0x57f5f7,_0x56b42e){this[_0x9c11('0x8')]=_0x57f5f7[_0x9c11('0x8')];this[_0x9c11('0x9')]=this[_0x9c11('0xa')](_0x57f5f7,_0x56b42e);this[_0x9c11('0x2')]=new Imap(this['account']);this[_0x9c11('0x2')]['once'](_0x9c11('0xb'),this[_0x9c11('0xc')]['bind'](this));this[_0x9c11('0x2')][_0x9c11('0xd')]('end',this[_0x9c11('0xe')][_0x9c11('0xf')](this));this[_0x9c11('0x2')]['on'](_0x9c11('0x10'),this['handleError'][_0x9c11('0xf')](this));this[_0x9c11('0x2')][_0x9c11('0x11')]();}util[_0x9c11('0x12')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x23aad9,_0x2a3eb8){var _0x44967b={'connTimeout':_0x23aad9[_0x9c11('0x13')]?_0x23aad9['connTimeout']*0x3e8:0x2710,'authTimeout':_0x23aad9['authTimeout']?_0x23aad9[_0x9c11('0x14')]*0x3e8:0x1388};if(_0x23aad9[_0x9c11('0x15')]){_0x44967b['user']=_0x23aad9[_0x9c11('0x16')];if(_0x23aad9[_0x9c11('0x17')]){_0x44967b[_0x9c11('0x18')]=utils['generateXOAuth2Token'](_0x23aad9['CloudProvider'][_0x9c11('0x19')],_0x23aad9[_0x9c11('0x16')]);}else{_0x44967b[_0x9c11('0x1a')]=_0x23aad9[_0x9c11('0x1a')];}}else{if(_0x23aad9[_0x9c11('0x1b')]){_0x44967b[_0x9c11('0x16')]=_0x23aad9[_0x9c11('0x16')];_0x44967b[_0x9c11('0x1a')]=_0x23aad9['password'];}}_0x44967b[_0x9c11('0x7')]=_0x2a3eb8||_0x23aad9[_0x9c11('0x16')]||'anonymous@xcally.com';_0x44967b['host']=_0x23aad9[_0x9c11('0x1c')];_0x44967b['port']=_0x23aad9[_0x9c11('0x1d')]||0x3e1;if(_0x23aad9[_0x9c11('0x1e')]){_0x44967b[_0x9c11('0x1e')]=!![];}else{_0x44967b[_0x9c11('0x1e')]=![];_0x44967b[_0x9c11('0x1f')]=_0x9c11('0x20');}return _0x44967b;};EmailImap['prototype'][_0x9c11('0xc')]=function(){this[_0x9c11('0x2')][_0x9c11('0x21')](this[_0x9c11('0x8')],![],this[_0x9c11('0x22')][_0x9c11('0xf')](this));};EmailImap[_0x9c11('0x23')][_0x9c11('0x22')]=function(_0x1c6c23,_0x4eee23){if(_0x1c6c23){this['handleError'](_0x1c6c23,!![]);}else{this[_0x9c11('0x24')](_0x9c11('0x25'),_0x4eee23);this['readUnseen']();}};EmailImap['prototype'][_0x9c11('0x26')]=function(_0x2fdb3e){if(_0x2fdb3e){this[_0x9c11('0x27')](_0x2fdb3e,!![]);}else{this[_0x9c11('0x2')][_0x9c11('0x28')]();}};EmailImap[_0x9c11('0x23')]['readUnseen']=function(){this['imap']['search']([_0x9c11('0x29')],this[_0x9c11('0x2a')][_0x9c11('0xf')](this));};EmailImap[_0x9c11('0x23')][_0x9c11('0x2a')]=function(_0x32587b,_0x7b24b2){if(_0x32587b){this[_0x9c11('0x27')](_0x32587b,!![]);}else{if(_0x7b24b2[_0x9c11('0x2b')]){try{var _0x22f2a2=this[_0x9c11('0x2')][_0x9c11('0x2c')](_0x7b24b2,{'bodies':'','markSeen':!![]});_0x22f2a2['on']('message',this['handleFetchMessage']['bind'](this));_0x22f2a2[_0x9c11('0xd')]('error',this['handleFetchError'][_0x9c11('0xf')](this));_0x22f2a2[_0x9c11('0xd')]('end',this[_0x9c11('0x2d')][_0x9c11('0xf')](this));}catch(_0x2b6799){logger['error'](_0x2b6799);}}else{this[_0x9c11('0x2')][_0x9c11('0x2e')](!![],this['handleCloseBox'][_0x9c11('0xf')](this));}}};EmailImap['prototype'][_0x9c11('0x2f')]=function(_0x1faa8e){_0x1faa8e['on']('body',this[_0x9c11('0x30')][_0x9c11('0xf')](this));_0x1faa8e['once'](_0x9c11('0x31'),this[_0x9c11('0x32')][_0x9c11('0xf')](this));_0x1faa8e[_0x9c11('0xd')](_0x9c11('0x28'),this[_0x9c11('0x33')]['bind'](this));};EmailImap[_0x9c11('0x23')]['handleMessageBody']=function(_0x21af11){simpleParser(_0x21af11,{'Iconv':Iconv},this[_0x9c11('0x34')]['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x9c11('0x33')]=function(){};EmailImap['prototype'][_0x9c11('0x34')]=function(_0x289786,_0x22d94c){if(_0x289786){logger['error'](_0x289786);}else{var _0xb60bf5=this;utils['parser'](this['account'],_0x22d94c,function(_0xbc52dc){_0xb60bf5['emit'](_0x9c11('0x7'),_0xbc52dc);});}};EmailImap['prototype'][_0x9c11('0x2d')]=function(){this[_0x9c11('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x9c11('0xf')](this));};EmailImap[_0x9c11('0x23')][_0x9c11('0x35')]=function(_0x1d2c42){this[_0x9c11('0x27')](_0x1d2c42);this[_0x9c11('0x2')][_0x9c11('0x2e')](!![],this[_0x9c11('0x26')][_0x9c11('0xf')](this));};EmailImap['prototype'][_0x9c11('0xe')]=function(){this[_0x9c11('0x24')]('end');};EmailImap['prototype'][_0x9c11('0x27')]=function(_0x36d882,_0x32a899){logger[_0x9c11('0x10')](_0x9c11('0x27'),this[_0x9c11('0x9')][_0x9c11('0x7')],JSON['stringify'](_0x36d882));var _0x28f6f5='';if(_0x36d882){if(_0x36d882[_0x9c11('0x36')]){_0x28f6f5=_0x36d882[_0x9c11('0x36')];}else{for(var _0x373f97 in _0x36d882){if(_0x36d882[_0x9c11('0x37')](_0x373f97)){_0x28f6f5+=_['upperFirst'](_0x373f97)+':\x20'+_0x36d882[_0x373f97]+'\x0a';}}}}if(_0x32a899){this['imap'][_0x9c11('0x28')]();}else{this['emit']('error',_0x28f6f5);this[_0x9c11('0x24')]('end');}};module[_0x9c11('0x38')]=EmailImap; \ No newline at end of file +var _0xeb2f=['handleCloseBox','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageBody','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','simpleParser','iconv','Iconv','./utils','email','mailbox','getAccount','account','once','ready','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','port','tls','autotls','required','handleOpenBox','emit','box','readUnseen'];(function(_0x5d1b02,_0xbcf431){var _0x33fca0=function(_0x38abfd){while(--_0x38abfd){_0x5d1b02['push'](_0x5d1b02['shift']());}};_0x33fca0(++_0xbcf431);}(_0xeb2f,0x1e3));var _0xfeb2=function(_0x563c0b,_0x391c64){_0x563c0b=_0x563c0b-0x0;var _0x2ed720=_0xeb2f[_0x563c0b];return _0x2ed720;};'use strict';var _=require(_0xfeb2('0x0'));var util=require(_0xfeb2('0x1'));var Imap=require(_0xfeb2('0x2'));var simpleParser=require('mailparser')[_0xfeb2('0x3')];var Iconv=require(_0xfeb2('0x4'))[_0xfeb2('0x5')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0xfeb2('0x6'));var logger=require('../../../config/logger')(_0xfeb2('0x7'));function EmailImap(_0x467195,_0x2199a0){this[_0xfeb2('0x8')]=_0x467195[_0xfeb2('0x8')];this['account']=this[_0xfeb2('0x9')](_0x467195,_0x2199a0);this[_0xfeb2('0x2')]=new Imap(this[_0xfeb2('0xa')]);this[_0xfeb2('0x2')][_0xfeb2('0xb')](_0xfeb2('0xc'),this['handleReady'][_0xfeb2('0xd')](this));this[_0xfeb2('0x2')][_0xfeb2('0xb')](_0xfeb2('0xe'),this[_0xfeb2('0xf')][_0xfeb2('0xd')](this));this[_0xfeb2('0x2')]['on'](_0xfeb2('0x10'),this[_0xfeb2('0x11')][_0xfeb2('0xd')](this));this['imap'][_0xfeb2('0x12')]();}util[_0xfeb2('0x13')](EmailImap,EventEmitter);EmailImap[_0xfeb2('0x14')][_0xfeb2('0x9')]=function(_0x9663dd,_0x2fc5cf){var _0x3319e6={'connTimeout':_0x9663dd[_0xfeb2('0x15')]?_0x9663dd[_0xfeb2('0x15')]*0x3e8:0x2710,'authTimeout':_0x9663dd[_0xfeb2('0x16')]?_0x9663dd[_0xfeb2('0x16')]*0x3e8:0x1388};if(_0x9663dd['service']){_0x3319e6[_0xfeb2('0x17')]=_0x9663dd[_0xfeb2('0x17')];if(_0x9663dd[_0xfeb2('0x18')]){_0x3319e6[_0xfeb2('0x19')]=utils[_0xfeb2('0x1a')](_0x9663dd[_0xfeb2('0x1b')]['data5'],_0x9663dd[_0xfeb2('0x17')]);}else{_0x3319e6[_0xfeb2('0x1c')]=_0x9663dd[_0xfeb2('0x1c')];}}else{if(_0x9663dd[_0xfeb2('0x1d')]){_0x3319e6[_0xfeb2('0x17')]=_0x9663dd[_0xfeb2('0x17')];_0x3319e6[_0xfeb2('0x1c')]=_0x9663dd[_0xfeb2('0x1c')];}}_0x3319e6['email']=_0x2fc5cf||_0x9663dd[_0xfeb2('0x17')]||_0xfeb2('0x1e');_0x3319e6['host']=_0x9663dd['host'];_0x3319e6[_0xfeb2('0x1f')]=_0x9663dd[_0xfeb2('0x1f')]||0x3e1;if(_0x9663dd[_0xfeb2('0x20')]){_0x3319e6[_0xfeb2('0x20')]=!![];}else{_0x3319e6[_0xfeb2('0x20')]=![];_0x3319e6[_0xfeb2('0x21')]=_0xfeb2('0x22');}return _0x3319e6;};EmailImap['prototype']['handleReady']=function(){this[_0xfeb2('0x2')]['openBox'](this['mailbox'],![],this[_0xfeb2('0x23')][_0xfeb2('0xd')](this));};EmailImap[_0xfeb2('0x14')][_0xfeb2('0x23')]=function(_0x21d311,_0x5be9e1){if(_0x21d311){this[_0xfeb2('0x11')](_0x21d311,!![]);}else{this[_0xfeb2('0x24')](_0xfeb2('0x25'),_0x5be9e1);this[_0xfeb2('0x26')]();}};EmailImap['prototype'][_0xfeb2('0x27')]=function(_0x688116){if(_0x688116){this['handleError'](_0x688116,!![]);}else{this[_0xfeb2('0x2')][_0xfeb2('0xe')]();}};EmailImap[_0xfeb2('0x14')][_0xfeb2('0x26')]=function(){this[_0xfeb2('0x2')]['search'](['UNSEEN'],this[_0xfeb2('0x28')]['bind'](this));};EmailImap[_0xfeb2('0x14')][_0xfeb2('0x28')]=function(_0xaf70a6,_0x57d8f0){if(_0xaf70a6){this['handleError'](_0xaf70a6,!![]);}else{if(_0x57d8f0[_0xfeb2('0x29')]){try{var _0x32ec8d=this['imap'][_0xfeb2('0x2a')](_0x57d8f0,{'bodies':'','markSeen':!![]});_0x32ec8d['on']('message',this[_0xfeb2('0x2b')][_0xfeb2('0xd')](this));_0x32ec8d['once'](_0xfeb2('0x10'),this[_0xfeb2('0x2c')][_0xfeb2('0xd')](this));_0x32ec8d[_0xfeb2('0xb')](_0xfeb2('0xe'),this[_0xfeb2('0x2d')][_0xfeb2('0xd')](this));}catch(_0x2da7bf){logger[_0xfeb2('0x10')](_0x2da7bf);}}else{this[_0xfeb2('0x2')][_0xfeb2('0x2e')](!![],this[_0xfeb2('0x27')][_0xfeb2('0xd')](this));}}};EmailImap[_0xfeb2('0x14')]['handleFetchMessage']=function(_0x1f3486){_0x1f3486['on'](_0xfeb2('0x2f'),this['handleMessageBody'][_0xfeb2('0xd')](this));_0x1f3486[_0xfeb2('0xb')](_0xfeb2('0x30'),this[_0xfeb2('0x31')][_0xfeb2('0xd')](this));_0x1f3486['once'](_0xfeb2('0xe'),this['handleMessageEnd'][_0xfeb2('0xd')](this));};EmailImap[_0xfeb2('0x14')][_0xfeb2('0x32')]=function(_0x787003){simpleParser(_0x787003,{'Iconv':Iconv},this['handleSimpleParser'][_0xfeb2('0xd')](this));};EmailImap[_0xfeb2('0x14')][_0xfeb2('0x31')]=function(){};EmailImap[_0xfeb2('0x14')][_0xfeb2('0x33')]=function(){};EmailImap[_0xfeb2('0x14')][_0xfeb2('0x34')]=function(_0x4faa31,_0x4b539f){if(_0x4faa31){logger[_0xfeb2('0x10')](_0x4faa31);}else{var _0x59af12=this;utils['parser'](this['account'],_0x4b539f,function(_0x13638){_0x59af12[_0xfeb2('0x24')](_0xfeb2('0x7'),_0x13638);});}};EmailImap[_0xfeb2('0x14')]['handleFetchEnd']=function(){this[_0xfeb2('0x2')][_0xfeb2('0x2e')](!![],this[_0xfeb2('0x27')][_0xfeb2('0xd')](this));};EmailImap[_0xfeb2('0x14')]['handleFetchError']=function(_0xcf5c32){this[_0xfeb2('0x11')](_0xcf5c32);this[_0xfeb2('0x2')]['closeBox'](!![],this[_0xfeb2('0x27')][_0xfeb2('0xd')](this));};EmailImap[_0xfeb2('0x14')][_0xfeb2('0xf')]=function(){this[_0xfeb2('0x24')]('end');};EmailImap[_0xfeb2('0x14')][_0xfeb2('0x11')]=function(_0x4d2132,_0x3f92f2){logger[_0xfeb2('0x10')](_0xfeb2('0x11'),this[_0xfeb2('0xa')][_0xfeb2('0x7')],JSON[_0xfeb2('0x35')](_0x4d2132));var _0x39f41d='';if(_0x4d2132){if(_0x4d2132[_0xfeb2('0x36')]){_0x39f41d=_0x4d2132[_0xfeb2('0x36')];}else{for(var _0xe4b0af in _0x4d2132){if(_0x4d2132[_0xfeb2('0x37')](_0xe4b0af)){_0x39f41d+=_[_0xfeb2('0x38')](_0xe4b0af)+':\x20'+_0x4d2132[_0xe4b0af]+'\x0a';}}}}if(_0x3f92f2){this['imap'][_0xfeb2('0xe')]();}else{this[_0xfeb2('0x24')](_0xfeb2('0x10'),_0x39f41d);this[_0xfeb2('0x24')](_0xfeb2('0xe'));}};module[_0xfeb2('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 88e6e57..aad69d2 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 _0xcd27=['verify','toString','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail'];(function(_0x7a5e28,_0x6bc7de){var _0xada9f3=function(_0x78af33){while(--_0x78af33){_0x7a5e28['push'](_0x7a5e28['shift']());}};_0xada9f3(++_0x6bc7de);}(_0xcd27,0x11a));var _0x7cd2=function(_0x32c6ff,_0x269896){_0x32c6ff=_0x32c6ff-0x0;var _0x14222d=_0xcd27[_0x32c6ff];return _0x14222d;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x7cd2('0x0'));function EmailSmtp(){}EmailSmtp[_0x7cd2('0x1')][_0x7cd2('0x2')]=function(_0x4fc932,_0x4eb33b){return new Promise(function(_0x446f5d,_0x48fa36){var _0x239705=nodemailer[_0x7cd2('0x3')](_0x4fc932);_0x239705['use'](_0x7cd2('0x4'),inlineBase64());_0x239705[_0x7cd2('0x5')](_0x4eb33b,function(_0x45b658,_0x102211){if(_0x45b658){_0x48fa36(_0x45b658['toString']());}else{_0x446f5d(_0x102211);}});});};EmailSmtp[_0x7cd2('0x1')]['verify']=function(_0x311feb){return new Promise(function(_0x1fa595,_0xa545e7){var _0x490c85=nodemailer['createTransport'](_0x311feb);_0x490c85[_0x7cd2('0x6')](function(_0x4a5342,_0x2c84d5){if(_0x4a5342){_0xa545e7(_0x4a5342[_0x7cd2('0x7')]());}else{if(_0x2c84d5){_0x1fa595(_0x2c84d5);}else{_0xa545e7('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x28e2=['use','compile','sendMail','toString','verify','createTransport','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28e2,0x140));var _0x228e=function(_0x1aef20,_0x508eaf){_0x1aef20=_0x1aef20-0x0;var _0x33f0c3=_0x28e2[_0x1aef20];return _0x33f0c3;};'use strict';var nodemailer=require(_0x228e('0x0'));var inlineBase64=require(_0x228e('0x1'));function EmailSmtp(){}EmailSmtp[_0x228e('0x2')][_0x228e('0x3')]=function(_0x27b26a,_0x4e19e6){return new Promise(function(_0x56be85,_0x5f1f85){var _0x12d80e=nodemailer['createTransport'](_0x27b26a);_0x12d80e[_0x228e('0x4')](_0x228e('0x5'),inlineBase64());_0x12d80e[_0x228e('0x6')](_0x4e19e6,function(_0x3591a4,_0x4b8c28){if(_0x3591a4){_0x5f1f85(_0x3591a4[_0x228e('0x7')]());}else{_0x56be85(_0x4b8c28);}});});};EmailSmtp[_0x228e('0x2')][_0x228e('0x8')]=function(_0x511402){return new Promise(function(_0x5a7d8d,_0x1e8a41){var _0x117516=nodemailer[_0x228e('0x9')](_0x511402);_0x117516['verify'](function(_0x554d17,_0x44362f){if(_0x554d17){_0x1e8a41(_0x554d17['toString']());}else{if(_0x44362f){_0x5a7d8d(_0x44362f);}else{_0x1e8a41(_0x228e('0xa'));}}});});};module[_0x228e('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index bb802ca..3c6bee1 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 _0xb45b=['html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','path','node-tnef','../../../config/logger','../../../config/environment','head','value','address','@xcally.com','substring','name','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous'];(function(_0x18aca1,_0x27937d){var _0x571c90=function(_0x252ad6){while(--_0x252ad6){_0x18aca1['push'](_0x18aca1['shift']());}};_0x571c90(++_0x27937d);}(_0xb45b,0x1e3));var _0xbb45=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0xb45b[_0x2ef44b];return _0x2405b9;};'use strict';var _=require(_0xbb45('0x0'));var moment=require('moment');var random=require(_0xbb45('0x1'));var fs=require('fs');var path=require(_0xbb45('0x2'));var util=require('util');var tnef=require(_0xbb45('0x3'));var logger=require(_0xbb45('0x4'))('email');var config=require(_0xbb45('0x5'));function getAddress(_0x30a184){var _0x34279e=_[_0xbb45('0x6')](_0x30a184[_0xbb45('0x7')]);return _0x34279e&&_0x34279e[_0xbb45('0x8')]?_0x34279e[_0xbb45('0x8')]:'anonymous'+random['generate'](0x6)+_0xbb45('0x9');}function getFirstName(_0x1f5732){var _0x971db5=_[_0xbb45('0x6')](_0x1f5732[_0xbb45('0x7')]);if(_0x971db5&&_0x971db5['name']){if(_0x971db5['name']==_0x971db5[_0xbb45('0x8')]){return _0x971db5['name'][_0xbb45('0xa')](0x0,_0x971db5[_0xbb45('0xb')][_0xbb45('0xc')]('@'));}var _0x458af2=_0x971db5['name'][_0xbb45('0xd')](/\s+/);return _0x458af2[_0xbb45('0xe')]>0x1?_0x458af2[_0xbb45('0xf')](0x0,-0x1)[_0xbb45('0x10')]('\x20'):_0x971db5[_0xbb45('0xb')];}return _0xbb45('0x11');}function getLastName(_0x30e527){var _0x47d66e=_[_0xbb45('0x6')](_0x30e527[_0xbb45('0x7')]);if(_0x47d66e&&_0x47d66e[_0xbb45('0xb')]){var _0x1fc0da=_0x47d66e[_0xbb45('0xb')][_0xbb45('0xd')](/\s+/);return _0x1fc0da[_0xbb45('0xe')]>0x1?_0x1fc0da[_0xbb45('0x12')]():'';}return'';}function getMails(_0x11178c,_0x4d6f50){var _0x27d1d6='';for(var _0x2491f9=0x0;_0x2491f9<_0x4d6f50[_0xbb45('0x7')]['length'];_0x2491f9+=0x1){if(_0x4d6f50['value'][_0x2491f9][_0xbb45('0x8')]!==_0x11178c){if(!_[_0xbb45('0x13')](_0x27d1d6)){_0x27d1d6+=',';}_0x27d1d6+=_0x4d6f50[_0xbb45('0x7')][_0x2491f9][_0xbb45('0xb')]||_0x4d6f50['value'][_0x2491f9][_0xbb45('0x8')]||'';_0x27d1d6+='\x20<';_0x27d1d6+=_0x4d6f50['value'][_0x2491f9][_0xbb45('0x8')]?_0x4d6f50[_0xbb45('0x7')][_0x2491f9][_0xbb45('0x8')]:_0xbb45('0x14')+random['generate'](0x6)+'@xcally.com';_0x27d1d6+='>';}}return _0x27d1d6;}function parseEmail(_0x599df6,_0x54c5fb,_0x23baf6){if(_0x54c5fb[_0xbb45('0x15')]){var _0x92a7a=/)<[^<]*)*<\/script>/gi;while(_0x92a7a[_0xbb45('0x16')](_0x54c5fb[_0xbb45('0x15')])){_0x54c5fb[_0xbb45('0x15')]=_0x54c5fb['html']['replace'](_0x92a7a,'');}if(_0x54c5fb[_0xbb45('0x15')][_0xbb45('0x17')](_0xbb45('0x18'))){var _0x5d6f6a=[];_0x54c5fb[_0xbb45('0x19')][_0xbb45('0x1a')](_0x4e5995=>{_0x5d6f6a[_0xbb45('0x1b')](_0x4e5995['filename']);});var _0x488c29=/]+>/g;var _0x3da900=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x57d1fc=_0x54c5fb[_0xbb45('0x15')][_0xbb45('0x1c')](_0x3da900,_0xbb45('0x1d'));var _0x8bc462=_0x57d1fc['replace'](_0x488c29,_0xbb45('0x1e'));for(let _0x542ab2=0x0;_0x542ab2<_0x5d6f6a[_0xbb45('0xe')];_0x542ab2++){var _0x30d774=_0x8bc462[_0xbb45('0x1c')](_0xbb45('0x1e'),_0xbb45('0x1f')+_0x5d6f6a[_0x542ab2]+_0xbb45('0x20'));_0x8bc462=_0x30d774;}_0x54c5fb['html']=_0x8bc462;}_0x23baf6[_0xbb45('0x21')]=_0x54c5fb[_0xbb45('0x15')];}else{_0x23baf6[_0xbb45('0x21')]=_0x54c5fb[_0xbb45('0x22')];}if(_0x23baf6['body']){_0x23baf6[_0xbb45('0x21')]=_0x23baf6['body'][_0xbb45('0x1c')](/0x0){var _0x9486db=['Auto-Submitted:\x20auto-replied',_0xbb45('0x31'),_0xbb45('0x32')];for(var _0x26bfd1=0x0;_0x26bfd1<_0x54c5fb[_0xbb45('0x30')][_0xbb45('0xe')];_0x26bfd1++){var _0x335b35=_[_0xbb45('0xc')](_0x9486db,_0x54c5fb[_0xbb45('0x30')][_0x26bfd1][_0xbb45('0x33')]);if(_0x335b35>=0x0){_0x23baf6[_0xbb45('0x34')]=!![];}}}return _0x23baf6;}exports['parser']=function(_0x15073b,_0xc3facb,_0x49b2c7){var _0x25c4f8={'from':getAddress(_0xc3facb[_0xbb45('0x35')]),'firstName':getFirstName(_0xc3facb[_0xbb45('0x35')]),'lastName':getLastName(_0xc3facb['from']),'mapKey':_0xbb45('0x25'),'message':{'from':getMails(_0x15073b[_0xbb45('0x25')],_0xc3facb[_0xbb45('0x35')]),'to':_0x15073b[_0xbb45('0x25')],'cc':'','subject':_0xc3facb[_0xbb45('0x36')]||'','messageId':_0xc3facb['messageId'],'inReplyTo':_0xc3facb[_0xbb45('0x37')],'sentAt':moment(_0xc3facb['date'])['format'](_0xbb45('0x38')),'attach':![],'attachments':[]}};if(!_0xc3facb[_0xbb45('0x15')]&&!_0xc3facb[_0xbb45('0x22')]){var _0x51a57f=_[_0xbb45('0x39')](_0xc3facb[_0xbb45('0x19')],{'contentType':_0xbb45('0x3a')});if(_0x51a57f['length']){logger[_0xbb45('0x3b')](util[_0xbb45('0x2c')](_0xbb45('0x3c'),_0xc3facb[_0xbb45('0x3d')]));tnef['parseBuffer'](_[_0xbb45('0x3e')](_0x51a57f)[_0xbb45('0x2f')],function(_0x598b5f,_0x451859){if(_0x451859){_0xc3facb[_0xbb45('0x15')]=_0x451859['BodyHTML']||_0xbb45('0x3f');if(_0x451859[_0xbb45('0x40')]){for(var _0x5ac758=0x0;_0x5ac758<_0x451859['Attachments']['length'];_0x5ac758++){var _0x3d31a8=_0x451859[_0xbb45('0x40')][_0x5ac758];_0x25c4f8['message'][_0xbb45('0x19')]['push']({'filename':_0x3d31a8[_0xbb45('0x41')],'content':Buffer[_0xbb45('0x35')](_0x3d31a8[_0xbb45('0x42')])});}}}_0x49b2c7(parseEmail(_0x15073b,_0xc3facb,_0x25c4f8));});}else{_0xc3facb['html']=_0xbb45('0x3f');_0x49b2c7(parseEmail(_0x15073b,_0xc3facb,_0x25c4f8));}}else{_0x49b2c7(parseEmail(_0x15073b,_0xc3facb,_0x25c4f8));}};exports['generateXOAuth2Token']=function(_0x28dd6e,_0x173225){var _0x1a35db=[_0xbb45('0x43')+(_0x173225||''),_0xbb45('0x44')+_0x28dd6e,'',''];return Buffer['from'](_0x1a35db[_0xbb45('0x10')](''),_0xbb45('0x45'))[_0xbb45('0x46')](_0xbb45('0x47'));}; \ No newline at end of file +var _0xe763=['path','util','node-tnef','../../../config/logger','email','head','address','generate','@xcally.com','value','name','substring','indexOf','split','slice','Anonymous','length','test','html','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','body','0x1?_0x494bf1[_0x3e76('0x11')](0x0,-0x1)['join']('\x20'):_0x5d3c4b[_0x3e76('0xd')];}return _0x3e76('0x12');}function getLastName(_0x52bf01){var _0x41f71d=_['head'](_0x52bf01['value']);if(_0x41f71d&&_0x41f71d[_0x3e76('0xd')]){var _0x3462ef=_0x41f71d[_0x3e76('0xd')][_0x3e76('0x10')](/\s+/);return _0x3462ef[_0x3e76('0x13')]>0x1?_0x3462ef['pop']():'';}return'';}function getMails(_0x10ff31,_0x40646e){var _0x360334='';for(var _0x4205c6=0x0;_0x4205c6<_0x40646e[_0x3e76('0xc')]['length'];_0x4205c6+=0x1){if(_0x40646e[_0x3e76('0xc')][_0x4205c6][_0x3e76('0x9')]!==_0x10ff31){if(!_['isEmpty'](_0x360334)){_0x360334+=',';}_0x360334+=_0x40646e['value'][_0x4205c6][_0x3e76('0xd')]||_0x40646e[_0x3e76('0xc')][_0x4205c6][_0x3e76('0x9')]||'';_0x360334+='\x20<';_0x360334+=_0x40646e[_0x3e76('0xc')][_0x4205c6][_0x3e76('0x9')]?_0x40646e['value'][_0x4205c6][_0x3e76('0x9')]:'anonymous'+random['generate'](0x6)+_0x3e76('0xb');_0x360334+='>';}}return _0x360334;}function parseEmail(_0x363f90,_0x57e591,_0x5e8eae){if(_0x57e591['html']){var _0x2b3172=/)<[^<]*)*<\/script>/gi;while(_0x2b3172[_0x3e76('0x14')](_0x57e591[_0x3e76('0x15')])){_0x57e591[_0x3e76('0x15')]=_0x57e591[_0x3e76('0x15')][_0x3e76('0x16')](_0x2b3172,'');}if(_0x57e591[_0x3e76('0x15')][_0x3e76('0x17')]('{_0x15ee58[_0x3e76('0x1a')](_0x397d6c[_0x3e76('0x1b')]);});var _0x13446f=/]+>/g;var _0x13a39f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2549fe=_0x57e591['html'][_0x3e76('0x16')](_0x13a39f,_0x3e76('0x1c'));var _0x560998=_0x2549fe[_0x3e76('0x16')](_0x13446f,_0x3e76('0x1d'));for(let _0x38a338=0x0;_0x38a338<_0x15ee58[_0x3e76('0x13')];_0x38a338++){var _0x3ecce2=_0x560998[_0x3e76('0x16')](_0x3e76('0x1d'),_0x3e76('0x1e')+_0x15ee58[_0x38a338]+'\x20]');_0x560998=_0x3ecce2;}_0x57e591[_0x3e76('0x15')]=_0x560998;}_0x5e8eae[_0x3e76('0x1f')]=_0x57e591[_0x3e76('0x15')];}else{_0x5e8eae[_0x3e76('0x1f')]=_0x57e591['textAsHtml'];}if(_0x5e8eae[_0x3e76('0x1f')]){_0x5e8eae[_0x3e76('0x1f')]=_0x5e8eae[_0x3e76('0x1f')][_0x3e76('0x16')](/0x0){var _0x557889=[_0x3e76('0x2f'),_0x3e76('0x30'),_0x3e76('0x31')];for(var _0x5eec55=0x0;_0x5eec55<_0x57e591[_0x3e76('0x2e')]['length'];_0x5eec55++){var _0x299ba2=_[_0x3e76('0xf')](_0x557889,_0x57e591[_0x3e76('0x2e')][_0x5eec55][_0x3e76('0x32')]);if(_0x299ba2>=0x0){_0x5e8eae['isAutoreply']=!![];}}}return _0x5e8eae;}exports[_0x3e76('0x33')]=function(_0x440eb7,_0x2df0e2,_0x31b1c7){var _0x4eeada={'from':getAddress(_0x2df0e2[_0x3e76('0x34')]),'firstName':getFirstName(_0x2df0e2[_0x3e76('0x34')]),'lastName':getLastName(_0x2df0e2[_0x3e76('0x34')]),'mapKey':_0x3e76('0x7'),'message':{'from':getMails(_0x440eb7[_0x3e76('0x7')],_0x2df0e2[_0x3e76('0x34')]),'to':_0x440eb7[_0x3e76('0x7')],'cc':'','subject':_0x2df0e2[_0x3e76('0x35')]||'','messageId':_0x2df0e2['messageId'],'inReplyTo':_0x2df0e2[_0x3e76('0x36')],'sentAt':moment(_0x2df0e2[_0x3e76('0x37')])[_0x3e76('0x28')](_0x3e76('0x38')),'attach':![],'attachments':[]}};if(!_0x2df0e2['html']&&!_0x2df0e2['textAsHtml']){var _0x3e875c=_[_0x3e76('0x39')](_0x2df0e2['attachments'],{'contentType':_0x3e76('0x3a')});if(_0x3e875c[_0x3e76('0x13')]){logger[_0x3e76('0x3b')](util[_0x3e76('0x28')](_0x3e76('0x3c'),_0x2df0e2[_0x3e76('0x3d')]));tnef['parseBuffer'](_['first'](_0x3e875c)['content'],function(_0x1c8e43,_0x255ab6){if(_0x255ab6){_0x2df0e2[_0x3e76('0x15')]=_0x255ab6[_0x3e76('0x3e')]||'

Empty\x20message

';if(_0x255ab6['Attachments']){for(var _0x4723dc=0x0;_0x4723dc<_0x255ab6[_0x3e76('0x3f')][_0x3e76('0x13')];_0x4723dc++){var _0x28ca74=_0x255ab6[_0x3e76('0x3f')][_0x4723dc];_0x4eeada[_0x3e76('0x21')][_0x3e76('0x18')][_0x3e76('0x1a')]({'filename':_0x28ca74['Title'],'content':Buffer[_0x3e76('0x34')](_0x28ca74['Data'])});}}}_0x31b1c7(parseEmail(_0x440eb7,_0x2df0e2,_0x4eeada));});}else{_0x2df0e2[_0x3e76('0x15')]='

Empty\x20message

';_0x31b1c7(parseEmail(_0x440eb7,_0x2df0e2,_0x4eeada));}}else{_0x31b1c7(parseEmail(_0x440eb7,_0x2df0e2,_0x4eeada));}};exports[_0x3e76('0x40')]=function(_0x478060,_0x1480f1){var _0x531ed4=[_0x3e76('0x41')+(_0x1480f1||''),_0x3e76('0x42')+_0x478060,'',''];return Buffer[_0x3e76('0x34')](_0x531ed4[_0x3e76('0x2a')](''),_0x3e76('0x43'))[_0x3e76('0x44')](_0x3e76('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 5b70b17..7cf8d7f 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 _0xa4f4=['key','SERV','active','Imap','Smtp','exports','name','Service'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xa4f4,0xf6));var _0x4a4f=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xa4f4[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');function MailAccount(_0x148d28){this['id']=_0x148d28['id']||0x0;this[_0x4a4f('0x0')]=_0x148d28[_0x4a4f('0x0')]||_0x4a4f('0x1');this[_0x4a4f('0x2')]=_0x148d28[_0x4a4f('0x2')]||_0x4a4f('0x3');this[_0x4a4f('0x4')]=_0x148d28[_0x4a4f('0x4')]||![];this[_0x4a4f('0x5')]=_0x148d28[_0x4a4f('0x5')]||[];this[_0x4a4f('0x6')]=_0x148d28[_0x4a4f('0x6')]||[];}module[_0x4a4f('0x7')]=MailAccount; \ No newline at end of file +var _0x0663=['key','active','Imap','Smtp','exports','lodash','name'];(function(_0x2642b3,_0x2fa0b7){var _0x443747=function(_0x56389f){while(--_0x56389f){_0x2642b3['push'](_0x2642b3['shift']());}};_0x443747(++_0x2fa0b7);}(_0x0663,0x91));var _0x3066=function(_0x41bee9,_0x488434){_0x41bee9=_0x41bee9-0x0;var _0xe48148=_0x0663[_0x41bee9];return _0xe48148;};'use strict';var _=require(_0x3066('0x0'));function MailAccount(_0x5c62b2){this['id']=_0x5c62b2['id']||0x0;this[_0x3066('0x1')]=_0x5c62b2['name']||'Service';this[_0x3066('0x2')]=_0x5c62b2['key']||'SERV';this[_0x3066('0x3')]=_0x5c62b2['active']||![];this[_0x3066('0x4')]=_0x5c62b2[_0x3066('0x4')]||[];this[_0x3066('0x5')]=_0x5c62b2['Smtp']||[];}module[_0x3066('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 1b58abd..47491ca 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 _0x4936=['mapKeys','hasOwnProperty','mergeFromDatabase','length','isUndefined','merge','../model/mailAccount','mailAccounts'];(function(_0x229484,_0x220fa4){var _0x575cfa=function(_0x5f1a93){while(--_0x5f1a93){_0x229484['push'](_0x229484['shift']());}};_0x575cfa(++_0x220fa4);}(_0x4936,0x96));var _0x6493=function(_0x215224,_0x1b923b){_0x215224=_0x215224-0x0;var _0x3d4cf4=_0x4936[_0x215224];return _0x3d4cf4;};'use strict';var _=require('lodash');var MailAccount=require(_0x6493('0x0'));var Realtime=function(){this[_0x6493('0x1')]={};};function freeIsNotKey(_0x432d8d,_0x507027,_0x9af7af){var _0x29a074=_[_0x6493('0x2')](_0x432d8d,function(_0xc70562,_0x1925c5){return _0xc70562[_0x9af7af];});for(var _0x556e11 in _0x507027){if(_0x507027[_0x6493('0x3')](_0x556e11)){if(!_0x29a074[_0x556e11]){delete _0x507027[_0x556e11];}}}}Realtime['prototype'][_0x6493('0x4')]=function(_0x3db644,_0x42acd5){for(var _0x565434 in _0x42acd5){if(_0x3db644[_0x6493('0x3')](_0x565434)){_0x3db644[_0x565434]=_0x42acd5[_0x565434];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x4784ff=this;return function(_0x4880b5){if(_0x4880b5){freeIsNotKey(_0x4880b5,_0x4784ff[_0x6493('0x1')],'id');for(var _0x3fdbe7=0x0,_0x4f8d46={},_0x1143f8={};_0x3fdbe7<_0x4880b5[_0x6493('0x5')];_0x3fdbe7+=0x1){_0x4f8d46=_0x4880b5[_0x3fdbe7];if(_[_0x6493('0x6')](_0x4784ff['mailAccounts'][_0x4f8d46['id']])){_0x4784ff[_0x6493('0x1')][_0x4f8d46['id']]=new MailAccount(_0x4f8d46);}else{_[_0x6493('0x7')](_0x4784ff[_0x6493('0x1')][_0x4f8d46['id']],_0x4f8d46);}}}return _0x4784ff['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xdda0=['lodash','mailAccounts','hasOwnProperty','prototype','isUndefined','merge','exports'];(function(_0x2d2fcc,_0x12095e){var _0x1edf09=function(_0xcc939f){while(--_0xcc939f){_0x2d2fcc['push'](_0x2d2fcc['shift']());}};_0x1edf09(++_0x12095e);}(_0xdda0,0x173));var _0x0dda=function(_0x41423b,_0x218a55){_0x41423b=_0x41423b-0x0;var _0xc5d9d=_0xdda0[_0x41423b];return _0xc5d9d;};'use strict';var _=require(_0x0dda('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x0dda('0x1')]={};};function freeIsNotKey(_0x16d61e,_0x2bed09,_0x14b670){var _0x3af403=_['mapKeys'](_0x16d61e,function(_0x2df85b,_0x241b41){return _0x2df85b[_0x14b670];});for(var _0x46f976 in _0x2bed09){if(_0x2bed09[_0x0dda('0x2')](_0x46f976)){if(!_0x3af403[_0x46f976]){delete _0x2bed09[_0x46f976];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x38fb80,_0x2ebe06){for(var _0x3c659e in _0x2ebe06){if(_0x38fb80[_0x0dda('0x2')](_0x3c659e)){_0x38fb80[_0x3c659e]=_0x2ebe06[_0x3c659e];}}};Realtime[_0x0dda('0x3')]['initMailAccounts']=function(){var _0xcd81b0=this;return function(_0x4b5597){if(_0x4b5597){freeIsNotKey(_0x4b5597,_0xcd81b0[_0x0dda('0x1')],'id');for(var _0x4f64fd=0x0,_0xd0a7d={},_0x568574={};_0x4f64fd<_0x4b5597['length'];_0x4f64fd+=0x1){_0xd0a7d=_0x4b5597[_0x4f64fd];if(_[_0x0dda('0x4')](_0xcd81b0[_0x0dda('0x1')][_0xd0a7d['id']])){_0xcd81b0[_0x0dda('0x1')][_0xd0a7d['id']]=new MailAccount(_0xd0a7d);}else{_[_0x0dda('0x5')](_0xcd81b0[_0x0dda('0x1')][_0xd0a7d['id']],_0xd0a7d);}}}return _0xcd81b0['mailAccounts'];};};module[_0x0dda('0x6')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index e3ac11c..ec40da8 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 _0xda42=['GetMailAccount','name','provider','service','active','ListId','CloudProvider','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x3dc8ab,_0x4fd9ae){var _0x2337e6=function(_0x2347b9){while(--_0x2347b9){_0x3dc8ab['push'](_0x3dc8ab['shift']());}};_0x2337e6(++_0x4fd9ae);}(_0xda42,0x1bd));var _0x2da4=function(_0x17287c,_0x36814a){_0x17287c=_0x17287c-0x0;var _0x3f26a7=_0xda42[_0x17287c];return _0x3f26a7;};'use strict';var client=require(_0x2da4('0x0'));exports[_0x2da4('0x1')]=function(){return function(){return client[_0x2da4('0x2')](_0x2da4('0x3'),{'options':{'attributes':['id',_0x2da4('0x4'),_0x2da4('0x5'),_0x2da4('0x6'),'email',_0x2da4('0x7'),'key',_0x2da4('0x8'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x2da4('0x9'),'attributes':['id',_0x2da4('0x4'),_0x2da4('0x6'),_0x2da4('0xa'),_0x2da4('0xb')],'as':_0x2da4('0x9')}]},{'model':_0x2da4('0xc'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x2da4('0x4'),_0x2da4('0x6'),_0x2da4('0xa'),'data5'],'as':_0x2da4('0x9')}]}]},'log':_0x2da4('0xd')});};};exports[_0x2da4('0xe')]=function(_0x400a40,_0x208170){return client[_0x2da4('0x2')](_0x2da4('0xf'),{'account':{'id':_0x400a40},'body':_0x208170,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x75d2=['name','provider','service','active','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount'];(function(_0x500d75,_0x4f6667){var _0x2d0e03=function(_0x37cf4e){while(--_0x37cf4e){_0x500d75['push'](_0x500d75['shift']());}};_0x2d0e03(++_0x4f6667);}(_0x75d2,0x152));var _0x275d=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0x75d2[_0x29ce14];return _0x48f289;};'use strict';var client=require(_0x275d('0x0'));exports[_0x275d('0x1')]=function(){return function(){return client[_0x275d('0x2')](_0x275d('0x3'),{'options':{'attributes':['id',_0x275d('0x4'),_0x275d('0x5'),_0x275d('0x6'),'email',_0x275d('0x7'),'key',_0x275d('0x8'),_0x275d('0x9')],'raw':![],'include':[{'model':_0x275d('0xa'),'as':_0x275d('0xb'),'include':[{'model':_0x275d('0xc'),'attributes':['id',_0x275d('0x4'),'service',_0x275d('0xd'),_0x275d('0xe')],'as':_0x275d('0xc')}]},{'model':_0x275d('0xf'),'as':'Smtp','include':[{'model':_0x275d('0xc'),'attributes':['id',_0x275d('0x4'),_0x275d('0x6'),_0x275d('0xd'),_0x275d('0xe')],'as':_0x275d('0xc')}]}]},'log':_0x275d('0x10')});};};exports[_0x275d('0x11')]=function(_0x28ea5d,_0x349df6){return client[_0x275d('0x2')](_0x275d('0x12'),{'account':{'id':_0x28ea5d},'body':_0x349df6,'log':_0x275d('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 57e4880..ac1cb61 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 _0x35a3=['../client','ShowSetting','loginMailFrequency'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x35a3,0x162));var _0x335a=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x35a3[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x335a('0x0'));exports['getSettings']=function(){return client['Request'](_0x335a('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x335a('0x2')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x83d0=['../client','getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x2064bc,_0x15f271){var _0x2dc2c9=function(_0x1cbc1f){while(--_0x1cbc1f){_0x2064bc['push'](_0x2064bc['shift']());}};_0x2dc2c9(++_0x15f271);}(_0x83d0,0x186));var _0x083d=function(_0x2b937c,_0x68b422){_0x2b937c=_0x2b937c-0x0;var _0x29dedd=_0x83d0[_0x2b937c];return _0x29dedd;};'use strict';var client=require(_0x083d('0x0'));exports[_0x083d('0x1')]=function(){return client['Request'](_0x083d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x083d('0x3')]},'log':_0x083d('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 61b41f0..9405ea6 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 f4dea35..96cb994 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 _0x5656=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default'];(function(_0xe7d5c7,_0x2a6fb6){var _0x15a9c6=function(_0x4ac384){while(--_0x4ac384){_0xe7d5c7['push'](_0xe7d5c7['shift']());}};_0x15a9c6(++_0x2a6fb6);}(_0x5656,0x14a));var _0x6565=function(_0x11a796,_0x11a8f2){_0x11a796=_0x11a796-0x0;var _0x5a1439=_0x5656[_0x11a796];return _0x5a1439;};'use strict';var _=require(_0x6565('0x0'));var http=require(_0x6565('0x1'));var express=require(_0x6565('0x2'));var sticky=require(_0x6565('0x3'));var Redis=require(_0x6565('0x4'));var config=require(_0x6565('0x5'));var app=express();var server=http[_0x6565('0x6')](app);server[_0x6565('0x7')]=0xdbba0;if(sticky[_0x6565('0x8')](server,config[_0x6565('0x9')])){var socketio=require(_0x6565('0xa'))(server,{'transports':[_0x6565('0xb'),_0x6565('0xc')]});config['redis']=_[_0x6565('0xd')](config[_0x6565('0xe')],{'host':_0x6565('0xf'),'port':0x18eb});socketio[_0x6565('0x10')](require(_0x6565('0x11'))({'pubClient':new Redis(config[_0x6565('0xe')]),'subClient':new Redis(config[_0x6565('0xe')])}));require(_0x6565('0x12'))['default']();require('../../config/socketio')[_0x6565('0x13')](socketio);require('../../config/express')[_0x6565('0x13')](app);require('../../routes')[_0x6565('0x13')](app);}else{server[_0x6565('0x14')](_0x6565('0x15'),function(){console[_0x6565('0x16')](_0x6565('0x17'),config[_0x6565('0x9')]);});}exports=module[_0x6565('0x18')]=app; \ No newline at end of file +var _0xcf66=['../../routes','once','listening','log','exports','lodash','http','express','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf66,0x19d));var _0x6cf6=function(_0x2590d6,_0x13e137){_0x2590d6=_0x2590d6-0x0;var _0x4c2e40=_0xcf66[_0x2590d6];return _0x4c2e40;};'use strict';var _=require(_0x6cf6('0x0'));var http=require(_0x6cf6('0x1'));var express=require(_0x6cf6('0x2'));var sticky=require('sticky-session');var Redis=require(_0x6cf6('0x3'));var config=require(_0x6cf6('0x4'));var app=express();var server=http[_0x6cf6('0x5')](app);server[_0x6cf6('0x6')]=0xdbba0;if(sticky[_0x6cf6('0x7')](server,config[_0x6cf6('0x8')])){var socketio=require(_0x6cf6('0x9'))(server,{'transports':['websocket',_0x6cf6('0xa')]});config[_0x6cf6('0xb')]=_['defaults'](config[_0x6cf6('0xb')],{'host':_0x6cf6('0xc'),'port':0x18eb});socketio[_0x6cf6('0xd')](require(_0x6cf6('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x6cf6('0xb')])}));require(_0x6cf6('0xf'))[_0x6cf6('0x10')]();require(_0x6cf6('0x11'))[_0x6cf6('0x10')](socketio);require(_0x6cf6('0x12'))[_0x6cf6('0x10')](app);require(_0x6cf6('0x13'))[_0x6cf6('0x10')](app);}else{server[_0x6cf6('0x14')](_0x6cf6('0x15'),function(){console[_0x6cf6('0x16')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x6cf6('0x8')]);});}exports=module[_0x6cf6('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 42fcce2..4c776f2 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 _0xa03d=['exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','rpc','error','message'];(function(_0x2a7e56,_0x3e8ddd){var _0x1e9436=function(_0x26be80){while(--_0x26be80){_0x2a7e56['push'](_0x2a7e56['shift']());}};_0x1e9436(++_0x3e8ddd);}(_0xa03d,0x1ed));var _0xda03=function(_0x167af2,_0x56bbca){_0x167af2=_0x167af2-0x0;var _0x774212=_0xa03d[_0x167af2];return _0x774212;};'use strict';var jayson=require(_0xda03('0x0'));var BPromise=require(_0xda03('0x1'));var logger=require(_0xda03('0x2'))(_0xda03('0x3'));var client=jayson['client'][_0xda03('0x4')]({'port':0x2329});client[_0xda03('0x5')]=function(_0x5a5f56,_0x3a4e40){return new BPromise(function(_0x35db23,_0xedb6e3){return client[_0xda03('0x6')](_0x5a5f56,_0x3a4e40)[_0xda03('0x7')](function(_0x25bd20){logger['debug'](_0xda03('0x8'),_0xda03('0x3'),_0x5a5f56,_0x3a4e40,_0x25bd20);if(_0x25bd20[_0xda03('0x9')]){logger[_0xda03('0x9')](_0xda03('0x8'),_0xda03('0x3'),_0x5a5f56,_0x25bd20[_0xda03('0x9')]['message'],_0x3a4e40);return _0xedb6e3(_0x25bd20['error'][_0xda03('0xa')]);}else{return _0x35db23(_0x25bd20['result']);}})['catch'](function(_0x105e5a){logger['error'](_0xda03('0x8'),_0xda03('0x3'),_0x5a5f56,_0x105e5a,_0x3a4e40);return _0xedb6e3(_0x105e5a);});});};module[_0xda03('0xb')]=client; \ No newline at end of file +var _0xcfae=['error','message','catch','bluebird','routing','client','Request','request','debug','rpc'];(function(_0x53fc4a,_0x28cc39){var _0x25999c=function(_0x501c9e){while(--_0x501c9e){_0x53fc4a['push'](_0x53fc4a['shift']());}};_0x25999c(++_0x28cc39);}(_0xcfae,0x1d9));var _0xecfa=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xcfae[_0x1e7b16];return _0x37fadc;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xecfa('0x0'));var logger=require('../../config/logger')(_0xecfa('0x1'));var client=jayson[_0xecfa('0x2')]['http']({'port':0x2329});client[_0xecfa('0x3')]=function(_0x15899a,_0x12dc19){return new BPromise(function(_0x3640cc,_0x202ae6){return client[_0xecfa('0x4')](_0x15899a,_0x12dc19)['then'](function(_0x5a55ff){logger[_0xecfa('0x5')](_0xecfa('0x6'),_0xecfa('0x1'),_0x15899a,_0x12dc19,_0x5a55ff);if(_0x5a55ff['error']){logger[_0xecfa('0x7')](_0xecfa('0x6'),_0xecfa('0x1'),_0x15899a,_0x5a55ff[_0xecfa('0x7')]['message'],_0x12dc19);return _0x202ae6(_0x5a55ff[_0xecfa('0x7')][_0xecfa('0x8')]);}else{return _0x3640cc(_0x5a55ff['result']);}})[_0xecfa('0x9')](function(_0x3e8dd1){logger[_0xecfa('0x7')](_0xecfa('0x6'),_0xecfa('0x1'),_0x15899a,_0x3e8dd1,_0x12dc19);return _0x202ae6(_0x3e8dd1);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index eaed77f..6b68784 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 _0x8dd5=['initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','resolve','then','getAgents'];(function(_0x3baaf2,_0x894e3d){var _0x50e8b0=function(_0x35dd6f){while(--_0x35dd6f){_0x3baaf2['push'](_0x3baaf2['shift']());}};_0x50e8b0(++_0x894e3d);}(_0x8dd5,0x141));var _0x58dd=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x8dd5[_0x149ca0];return _0x56b6b9;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x58dd('0x0'));var user=require(_0x58dd('0x1'));var interval=require(_0x58dd('0x2'));var openchannelQueue=require(_0x58dd('0x3'));var chatQueue=require(_0x58dd('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x58dd('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x58dd('0x6')]()[_0x58dd('0x7')](user[_0x58dd('0x8')]())[_0x58dd('0x7')](realtime[_0x58dd('0x9')]())['then'](interval['getIntervals']())[_0x58dd('0x7')](realtime[_0x58dd('0xa')]())[_0x58dd('0x7')](openchannelQueue[_0x58dd('0xb')]())[_0x58dd('0x7')](realtime[_0x58dd('0xc')]())[_0x58dd('0x7')](chatQueue[_0x58dd('0xd')]())[_0x58dd('0x7')](realtime[_0x58dd('0xe')]())['then'](smsQueue['getSmsQueues']())['then'](realtime[_0x58dd('0xf')]())[_0x58dd('0x7')](mailQueue['getMailQueues']())[_0x58dd('0x7')](realtime[_0x58dd('0x10')]())['then'](faxQueue[_0x58dd('0x11')]())[_0x58dd('0x7')](realtime[_0x58dd('0x12')]())['then'](whatsappQueue[_0x58dd('0x13')]())[_0x58dd('0x7')](realtime[_0x58dd('0x14')]())[_0x58dd('0x7')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x58dd('0x7')](function(_0x116fdc){return initRealtime();})[_0x58dd('0x7')](function(_0x30f153){return setInterval(initRealtime,0x1388);})[_0x58dd('0x15')](function(_0x3cf2c4){console['log'](_0x3cf2c4);});}main(); \ No newline at end of file +var _0xcac7=['initIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','initAgents','getIntervals'];(function(_0x4fd5df,_0x470622){var _0x5dd4b0=function(_0x1e576b){while(--_0x1e576b){_0x4fd5df['push'](_0x4fd5df['shift']());}};_0x5dd4b0(++_0x470622);}(_0xcac7,0x113));var _0x7cac=function(_0x4fd75e,_0x14a705){_0x4fd75e=_0x4fd75e-0x0;var _0x3e57dd=_0xcac7[_0x4fd75e];return _0x3e57dd;};'use strict';var BPromise=require('bluebird');var server=require(_0x7cac('0x0'));var Realtime=require(_0x7cac('0x1'));var user=require(_0x7cac('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x7cac('0x3'));var smsQueue=require(_0x7cac('0x4'));var mailQueue=require(_0x7cac('0x5'));var faxQueue=require(_0x7cac('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x7cac('0x7')]()[_0x7cac('0x8')](user['getAgents']())['then'](realtime[_0x7cac('0x9')]())[_0x7cac('0x8')](interval[_0x7cac('0xa')]())['then'](realtime[_0x7cac('0xb')]())['then'](openchannelQueue[_0x7cac('0xc')]())[_0x7cac('0x8')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())[_0x7cac('0x8')](realtime[_0x7cac('0xd')]())[_0x7cac('0x8')](smsQueue[_0x7cac('0xe')]())[_0x7cac('0x8')](realtime[_0x7cac('0xf')]())[_0x7cac('0x8')](mailQueue['getMailQueues']())[_0x7cac('0x8')](realtime['initMailQueues']())['then'](faxQueue[_0x7cac('0x10')]())['then'](realtime[_0x7cac('0x11')]())['then'](whatsappQueue[_0x7cac('0x12')]())[_0x7cac('0x8')](realtime[_0x7cac('0x13')]())[_0x7cac('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x7cac('0x8')](function(_0x6b3cb7){return initRealtime();})['then'](function(_0x159e66){return setInterval(initRealtime,0x1388);})[_0x7cac('0x14')](function(_0x32b5ba){console[_0x7cac('0x15')](_0x32b5ba);});}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 f137730..e5605b6 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x278f6e,_0x27b846){var _0x503930=function(_0x4b9a49){while(--_0x4b9a49){_0x278f6e['push'](_0x278f6e['shift']());}};_0x503930(++_0x27b846);}(_0x7a54,0x106));var _0x47a5=function(_0x56cc23,_0xcc2472){_0x56cc23=_0x56cc23-0x0;var _0x4c8145=_0x7a54[_0x56cc23];return _0x4c8145;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x29dba6,_0xb7ad45){var _0x1c2b76=function(_0x41da4e){while(--_0x41da4e){_0x29dba6['push'](_0x29dba6['shift']());}};_0x1c2b76(++_0xb7ad45);}(_0x2ef3,0xba));var _0x32ef=function(_0x23ce01,_0x2fd9fc){_0x23ce01=_0x23ce01-0x0;var _0x4ed7a5=_0x2ef3[_0x23ce01];return _0x4ed7a5;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 45cbb50..514f5cd 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 _0x04c0=['result','SendMail','bluebird','jayson/promise','then','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04c0,0x116));var _0x004c=function(_0x463efb,_0x4c094c){_0x463efb=_0x463efb-0x0;var _0x2c7cbd=_0x04c0[_0x463efb];return _0x2c7cbd;};'use strict';var BPromise=require(_0x004c('0x0'));var jayson=require(_0x004c('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x44e738,_0x5cab1f){return new BPromise(function(_0x4defc9,_0x4a3139){return client['request'](_0x44e738,_0x5cab1f)[_0x004c('0x2')](function(_0x4352c7){if(_0x4352c7[_0x004c('0x3')]){return _0x4a3139(_0x4352c7[_0x004c('0x3')]['message']);}else{return _0x4defc9(_0x4352c7[_0x004c('0x4')]);}})['catch'](function(_0x1adbe2){return _0x4a3139(_0x1adbe2);});});}exports['sendMailMessage']=function(_0xc3bcae,_0xa89f34){return request(_0x004c('0x5'),{'account':_0xc3bcae,'message':_0xa89f34});}; \ No newline at end of file +var _0x8ea0=['SendMail','jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ea0,0x191));var _0x08ea=function(_0x10905b,_0x1e51b2){_0x10905b=_0x10905b-0x0;var _0x298364=_0x8ea0[_0x10905b];return _0x298364;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x08ea('0x0'));var client=jayson[_0x08ea('0x1')][_0x08ea('0x2')]({'port':0x232b});function request(_0x43d6a9,_0x111eb1){return new BPromise(function(_0x19aae4,_0x3d9238){return client[_0x08ea('0x3')](_0x43d6a9,_0x111eb1)[_0x08ea('0x4')](function(_0x500b2a){if(_0x500b2a[_0x08ea('0x5')]){return _0x3d9238(_0x500b2a[_0x08ea('0x5')][_0x08ea('0x6')]);}else{return _0x19aae4(_0x500b2a[_0x08ea('0x7')]);}})[_0x08ea('0x8')](function(_0x5aef57){return _0x3d9238(_0x5aef57);});});}exports['sendMailMessage']=function(_0x2e1b4a,_0x3d4fb0){return request(_0x08ea('0x9'),{'account':_0x2e1b4a,'message':_0x3d4fb0});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index d4800c9..4128597 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 _0x36c7=['faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busy','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','updateRealtime','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','voicePause','smsPause','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappStatusTime','openchannelCapacity','mailWaitingInteractions','stringify','emit','user:save','exports','lodash','moment','ioredis','defaults','localhost','redis','name','online','chatPause','mailPause'];(function(_0x24127e,_0x689f53){var _0x12d2b8=function(_0x5c855f){while(--_0x5c855f){_0x24127e['push'](_0x24127e['shift']());}};_0x12d2b8(++_0x689f53);}(_0x36c7,0x194));var _0x736c=function(_0x2b02f7,_0x399b57){_0x2b02f7=_0x2b02f7-0x0;var _0x141c43=_0x36c7[_0x2b02f7];return _0x141c43;};'use strict';var _=require(_0x736c('0x0'));var moment=require(_0x736c('0x1'));var md5=require('md5');var Redis=require(_0x736c('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x736c('0x3')](config['redis'],{'host':_0x736c('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x736c('0x5')]));function Agent(_0xa58854){this['id']=_0xa58854['id']||0x0;this[_0x736c('0x6')]=_0xa58854[_0x736c('0x6')]||'';this[_0x736c('0x7')]=_0xa58854[_0x736c('0x7')]||!![];this['voicePause']=_0xa58854['voicePause']||![];this[_0x736c('0x8')]=_0xa58854[_0x736c('0x8')]||![];this[_0x736c('0x9')]=_0xa58854[_0x736c('0x9')]||![];this['faxPause']=_0xa58854[_0x736c('0xa')]||![];this['smsPause']=_0xa58854['smsPause']||![];this[_0x736c('0xb')]=_0xa58854[_0x736c('0xb')]||![];this[_0x736c('0xc')]=_0x736c('0xd');this[_0x736c('0xe')]=0x0;this[_0x736c('0xf')]=_0xa58854[_0x736c('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x736c('0x10')]=_0x736c('0xd');this[_0x736c('0x11')]=0x0;this[_0x736c('0x12')]=_0xa58854[_0x736c('0x12')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x736c('0x13')]=_0x736c('0xd');this[_0x736c('0x14')]=0x0;this[_0x736c('0x15')]=_0xa58854[_0x736c('0x15')]||0x0;this[_0x736c('0x16')]=0x0;this[_0x736c('0x17')]='unknown';this[_0x736c('0x18')]=0x0;this[_0x736c('0x19')]=_0xa58854['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x736c('0x1a')]='unknown';this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0xa58854[_0x736c('0x1b')]||0x0;this[_0x736c('0x1c')]=0x0;this[_0x736c('0x1d')]='unknown';this[_0x736c('0x1e')]=0x0;this['openchannelCapacity']=_0xa58854['openchannelCapacity']||0x0;this[_0x736c('0x1f')]=0x0;this[_0x736c('0x20')]=![];this[_0x736c('0x21')]=undefined;this[_0x736c('0x22')]='';this[_0x736c('0x23')]={};this[_0x736c('0x24')]={};this['mailWaitingInteractions']={};this[_0x736c('0x25')]={};this[_0x736c('0x26')]={};this[_0x736c('0x27')]={};this['updateRealtime']();}Agent[_0x736c('0x28')][_0x736c('0x29')]=function(_0x16e72b){if(this[_0x16e72b+_0x736c('0x2a')]>0x0){if(this[_0x16e72b+_0x736c('0x2b')]>0x0&&this[_0x16e72b+'CurrentCapacity']>=this[_0x16e72b+_0x736c('0x2b')]){return _0x736c('0x2c');}else{return'working';}}else{return _0x736c('0x2d');}};Agent['prototype'][_0x736c('0x2e')]=function(){var _0x28782d=[_0x736c('0x2f'),'chat',_0x736c('0x30'),_0x736c('0x31'),_0x736c('0x32'),_0x736c('0x33')];for(var _0x30c5b1=0x0;_0x30c5b1<_0x28782d[_0x736c('0x34')];_0x30c5b1+=0x1){var _0x8a317b=this[_0x736c('0x29')](_0x28782d[_0x30c5b1]);if(this[_0x28782d[_0x30c5b1]+_0x736c('0x35')]!==_0x8a317b){this[_0x28782d[_0x30c5b1]+_0x736c('0x36')]=_[_0x736c('0x37')](moment()[_0x736c('0x38')]('x'));}this[_0x28782d[_0x30c5b1]+_0x736c('0x35')]=_0x8a317b;}var _0x375489={'id':this['id'],'name':this[_0x736c('0x6')],'online':this['online'],'voicePause':this[_0x736c('0x39')],'chatPause':this[_0x736c('0x8')],'mailPause':this[_0x736c('0x9')],'smsPause':this[_0x736c('0x3a')],'faxPause':this['faxPause'],'openchannelPause':this[_0x736c('0xb')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x736c('0xe')],'chatCapacity':this[_0x736c('0xf')],'chatCurrentCapacity':this[_0x736c('0x3b')],'mailStatus':this[_0x736c('0x10')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x736c('0x12')],'mailCurrentCapacity':this[_0x736c('0x3c')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x736c('0x15')],'faxCurrentCapacity':this[_0x736c('0x16')],'smsStatus':this[_0x736c('0x17')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x736c('0x19')],'smsCurrentCapacity':this[_0x736c('0x3d')],'whatsappStatus':this[_0x736c('0x1a')],'whatsappStatusTime':this[_0x736c('0x3e')],'whatsappCapacity':this[_0x736c('0x1b')],'whatsappCurrentCapacity':this[_0x736c('0x1c')],'openchannelStatus':this[_0x736c('0x1d')],'openchannelStatusTime':this[_0x736c('0x1e')],'openchannelCapacity':this[_0x736c('0x3f')],'openchannelCurrentCapacity':this[_0x736c('0x1f')],'busy':this[_0x736c('0x20')],'busyQueue':this[_0x736c('0x21')],'chatWaitingInteractions':this[_0x736c('0x23')],'faxWaitingInteractions':this[_0x736c('0x24')],'mailWaitingInteractions':this[_0x736c('0x40')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x736c('0x26')],'whatsappWaitingInteractions':this[_0x736c('0x27')]};var _0x4435be=md5(JSON[_0x736c('0x41')](_0x375489));if(this[_0x736c('0x22')]!==_0x4435be){this[_0x736c('0x22')]=_0x4435be;io[_0x736c('0x42')](_0x736c('0x43'),_0x375489);}};module[_0x736c('0x44')]=Agent; \ No newline at end of file +var _0x31e6=['maxcapacity','working','idle','mail','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','mailStatus','faxStatusTime','openchannelCapacity','faxWaitingInteractions','emit','user:save','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0x31e6,0x1d9));var _0x631e=function(_0xf5ae62,_0xd8d91c){_0xf5ae62=_0xf5ae62-0x0;var _0x355af9=_0x31e6[_0xf5ae62];return _0x355af9;};'use strict';var _=require(_0x631e('0x0'));var moment=require('moment');var md5=require(_0x631e('0x1'));var Redis=require('ioredis');var config=require(_0x631e('0x2'));config[_0x631e('0x3')]=_['defaults'](config[_0x631e('0x3')],{'host':_0x631e('0x4'),'port':0x18eb});var io=require(_0x631e('0x5'))(new Redis(config['redis']));function Agent(_0x43e1d5){this['id']=_0x43e1d5['id']||0x0;this['name']=_0x43e1d5[_0x631e('0x6')]||'';this[_0x631e('0x7')]=_0x43e1d5['online']||!![];this[_0x631e('0x8')]=_0x43e1d5[_0x631e('0x8')]||![];this[_0x631e('0x9')]=_0x43e1d5['chatPause']||![];this[_0x631e('0xa')]=_0x43e1d5[_0x631e('0xa')]||![];this[_0x631e('0xb')]=_0x43e1d5[_0x631e('0xb')]||![];this[_0x631e('0xc')]=_0x43e1d5[_0x631e('0xc')]||![];this['openchannelPause']=_0x43e1d5[_0x631e('0xd')]||![];this[_0x631e('0xe')]=_0x631e('0xf');this[_0x631e('0x10')]=0x0;this[_0x631e('0x11')]=_0x43e1d5[_0x631e('0x11')]||0x0;this[_0x631e('0x12')]=0x0;this['mailStatus']=_0x631e('0xf');this[_0x631e('0x13')]=0x0;this[_0x631e('0x14')]=_0x43e1d5['mailCapacity']||0x0;this[_0x631e('0x15')]=0x0;this[_0x631e('0x16')]=_0x631e('0xf');this['faxStatusTime']=0x0;this['faxCapacity']=_0x43e1d5[_0x631e('0x17')]||0x0;this[_0x631e('0x18')]=0x0;this[_0x631e('0x19')]='unknown';this[_0x631e('0x1a')]=0x0;this[_0x631e('0x1b')]=_0x43e1d5[_0x631e('0x1b')]||0x0;this[_0x631e('0x1c')]=0x0;this[_0x631e('0x1d')]=_0x631e('0xf');this[_0x631e('0x1e')]=0x0;this[_0x631e('0x1f')]=_0x43e1d5[_0x631e('0x1f')]||0x0;this[_0x631e('0x20')]=0x0;this[_0x631e('0x21')]=_0x631e('0xf');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x43e1d5['openchannelCapacity']||0x0;this[_0x631e('0x22')]=0x0;this[_0x631e('0x23')]=![];this[_0x631e('0x24')]=undefined;this[_0x631e('0x1')]='';this[_0x631e('0x25')]={};this['faxWaitingInteractions']={};this[_0x631e('0x26')]={};this[_0x631e('0x27')]={};this[_0x631e('0x28')]={};this[_0x631e('0x29')]={};this[_0x631e('0x2a')]();}Agent[_0x631e('0x2b')][_0x631e('0x2c')]=function(_0x498e34){if(this[_0x498e34+_0x631e('0x2d')]>0x0){if(this[_0x498e34+_0x631e('0x2e')]>0x0&&this[_0x498e34+_0x631e('0x2d')]>=this[_0x498e34+_0x631e('0x2e')]){return _0x631e('0x2f');}else{return _0x631e('0x30');}}else{return _0x631e('0x31');}};Agent['prototype'][_0x631e('0x2a')]=function(){var _0x5e4c36=[_0x631e('0x32'),'chat',_0x631e('0x33'),_0x631e('0x34'),_0x631e('0x35'),_0x631e('0x36')];for(var _0x3c7862=0x0;_0x3c7862<_0x5e4c36[_0x631e('0x37')];_0x3c7862+=0x1){var _0x193188=this[_0x631e('0x2c')](_0x5e4c36[_0x3c7862]);if(this[_0x5e4c36[_0x3c7862]+_0x631e('0x38')]!==_0x193188){this[_0x5e4c36[_0x3c7862]+'StatusTime']=_[_0x631e('0x39')](moment()[_0x631e('0x3a')]('x'));}this[_0x5e4c36[_0x3c7862]+_0x631e('0x38')]=_0x193188;}var _0x385f22={'id':this['id'],'name':this[_0x631e('0x6')],'online':this[_0x631e('0x7')],'voicePause':this[_0x631e('0x8')],'chatPause':this[_0x631e('0x9')],'mailPause':this[_0x631e('0xa')],'smsPause':this[_0x631e('0xc')],'faxPause':this[_0x631e('0xb')],'openchannelPause':this[_0x631e('0xd')],'chatStatus':this[_0x631e('0xe')],'chatStatusTime':this[_0x631e('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x631e('0x12')],'mailStatus':this[_0x631e('0x3b')],'mailStatusTime':this[_0x631e('0x13')],'mailCapacity':this[_0x631e('0x14')],'mailCurrentCapacity':this[_0x631e('0x15')],'faxStatus':this[_0x631e('0x16')],'faxStatusTime':this[_0x631e('0x3c')],'faxCapacity':this[_0x631e('0x17')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x631e('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x631e('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x631e('0x1d')],'whatsappStatusTime':this[_0x631e('0x1e')],'whatsappCapacity':this[_0x631e('0x1f')],'whatsappCurrentCapacity':this[_0x631e('0x20')],'openchannelStatus':this[_0x631e('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x631e('0x3d')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x631e('0x24')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x631e('0x3e')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x631e('0x27')],'smsWaitingInteractions':this[_0x631e('0x28')],'whatsappWaitingInteractions':this[_0x631e('0x29')]};var _0x447f44=md5(JSON['stringify'](_0x385f22));if(this[_0x631e('0x1')]!==_0x447f44){this[_0x631e('0x1')]=_0x447f44;io[_0x631e('0x3f')](_0x631e('0x40'),_0x385f22);}};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 f8d540b..90ba624 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 _0xebdb=['timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name'];(function(_0x54aea3,_0xae7d81){var _0x21ae46=function(_0xe16dbc){while(--_0xe16dbc){_0x54aea3['push'](_0x54aea3['shift']());}};_0x21ae46(++_0xae7d81);}(_0xebdb,0xa6));var _0xbebd=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0xebdb[_0x37ae26];return _0x1b1902;};'use strict';var _=require(_0xbebd('0x0'));var md5=require(_0xbebd('0x1'));var util=require('util');var Redis=require(_0xbebd('0x2'));var config=require(_0xbebd('0x3'));config[_0xbebd('0x4')]=_[_0xbebd('0x5')](config[_0xbebd('0x4')],{'host':_0xbebd('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x3a5010){this['id']=_0x3a5010['id']||0x0;this[_0xbebd('0x7')]=_0x3a5010['name']||'';this['timeout']=_0x3a5010[_0xbebd('0x8')]||0xa;this['strategy']=_0x3a5010['strategy']||_0xbebd('0x9');this[_0xbebd('0xa')]=_0x3a5010['Agents'];this[_0xbebd('0xb')]={};this[_0xbebd('0xc')]=0x0;this[_0xbebd('0x1')]='';this[_0xbebd('0xd')]();this[_0xbebd('0xe')]();}ChatQueue[_0xbebd('0xf')][_0xbebd('0xd')]=function(){var _0x2621e1=this[_0xbebd('0xb')][_0xbebd('0x10')];this[_0xbebd('0xb')]=_[_0xbebd('0x11')](this[_0xbebd('0xa')],'id');this['mapAgentsId'][_0xbebd('0x10')]=_0x2621e1;};ChatQueue[_0xbebd('0xf')][_0xbebd('0xe')]=function(){this[_0xbebd('0x12')]=0x0;this[_0xbebd('0x13')]=0x0;for(var _0x52b7fc=0x0;_0x52b7fc=0x0?this[_0xbebd('0x17')]:0x0;var _0x432c17={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbebd('0x12')],'name':this['name'],'paused':this[_0xbebd('0x13')],'waiting':this[_0xbebd('0xc')]};var _0x1f1452=md5(JSON[_0xbebd('0x18')](_0x432c17));if(this[_0xbebd('0x1')]!==_0x1f1452){this['md5']=_0x1f1452;io['to'](util['format'](_0xbebd('0x19'),_0x432c17[_0xbebd('0x7')]))[_0xbebd('0x1a')](_0xbebd('0x1b'),_0x432c17);}};module[_0xbebd('0x1c')]=ChatQueue; \ No newline at end of file +var _0x2729=['available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','length','loggedIn','paused'];(function(_0x2fbf5c,_0x43e082){var _0x11b8a9=function(_0x1c2ef5){while(--_0x1c2ef5){_0x2fbf5c['push'](_0x2fbf5c['shift']());}};_0x11b8a9(++_0x43e082);}(_0x2729,0x10a));var _0x9272=function(_0x13ffab,_0x449a1c){_0x13ffab=_0x13ffab-0x0;var _0x11cfda=_0x2729[_0x13ffab];return _0x11cfda;};'use strict';var _=require(_0x9272('0x0'));var md5=require(_0x9272('0x1'));var util=require(_0x9272('0x2'));var Redis=require('ioredis');var config=require(_0x9272('0x3'));config['redis']=_[_0x9272('0x4')](config[_0x9272('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9272('0x6'))(new Redis(config['redis']));function ChatQueue(_0x43a654){this['id']=_0x43a654['id']||0x0;this[_0x9272('0x7')]=_0x43a654[_0x9272('0x7')]||'';this[_0x9272('0x8')]=_0x43a654[_0x9272('0x8')]||0xa;this[_0x9272('0x9')]=_0x43a654['strategy']||'beepall';this[_0x9272('0xa')]=_0x43a654[_0x9272('0xa')];this[_0x9272('0xb')]={};this[_0x9272('0xc')]=0x0;this['md5']='';this[_0x9272('0xd')]();this[_0x9272('0xe')]();}ChatQueue[_0x9272('0xf')]['updateRouting']=function(){var _0x5f0fb1=this[_0x9272('0xb')][_0x9272('0x10')];this['mapAgentsId']=_['map'](this[_0x9272('0xa')],'id');this[_0x9272('0xb')]['_rr']=_0x5f0fb1;};ChatQueue[_0x9272('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5d24f6=0x0;_0x5d24f6=0x0?this[_0x9272('0x14')]:0x0;var _0x416c85={'id':this['id'],'available':this[_0x9272('0x14')],'loggedIn':this[_0x9272('0x12')],'name':this[_0x9272('0x7')],'paused':this[_0x9272('0x13')],'waiting':this[_0x9272('0xc')]};var _0xa72669=md5(JSON['stringify'](_0x416c85));if(this[_0x9272('0x1')]!==_0xa72669){this[_0x9272('0x1')]=_0xa72669;io['to'](util[_0x9272('0x15')](_0x9272('0x16'),_0x416c85[_0x9272('0x7')]))[_0x9272('0x17')](_0x9272('0x18'),_0x416c85);}};module[_0x9272('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index b52a938..c55979f 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 _0x465c=['updateRealtime','loggedIn','paused','online','available','waiting','format','fax_queue:save','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','prototype','updateRouting','map','_rr'];(function(_0x238850,_0x521207){var _0x166f2f=function(_0x12a596){while(--_0x12a596){_0x238850['push'](_0x238850['shift']());}};_0x166f2f(++_0x521207);}(_0x465c,0xd7));var _0xc465=function(_0x5d95b2,_0x405c2e){_0x5d95b2=_0x5d95b2-0x0;var _0x234baf=_0x465c[_0x5d95b2];return _0x234baf;};'use strict';var _=require(_0xc465('0x0'));var md5=require(_0xc465('0x1'));var util=require(_0xc465('0x2'));var Redis=require('ioredis');var config=require(_0xc465('0x3'));config['redis']=_['defaults'](config[_0xc465('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc465('0x5'))(new Redis(config[_0xc465('0x4')]));function FaxQueue(_0x282030){this['id']=_0x282030['id']||0x0;this['name']=_0x282030[_0xc465('0x6')]||'';this[_0xc465('0x7')]=_0x282030['timeout']||0xa;this['strategy']=_0x282030[_0xc465('0x8')]||'beepall';this['Agents']=_0x282030[_0xc465('0x9')];this[_0xc465('0xa')]={};this['waiting']=0x0;this[_0xc465('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xc465('0xb')][_0xc465('0xc')]=function(){var _0xfd2b2e=this[_0xc465('0xa')]['_rr'];this[_0xc465('0xa')]=_[_0xc465('0xd')](this[_0xc465('0x9')],'id');this[_0xc465('0xa')][_0xc465('0xe')]=_0xfd2b2e;};FaxQueue['prototype'][_0xc465('0xf')]=function(){this[_0xc465('0x10')]=0x0;this[_0xc465('0x11')]=0x0;for(var _0xd6e41b=0x0;_0xd6e41b=0x0?this[_0xc465('0x13')]:0x0;var _0x4ddaf6={'id':this['id'],'available':this[_0xc465('0x13')],'loggedIn':this[_0xc465('0x10')],'name':this[_0xc465('0x6')],'paused':this[_0xc465('0x11')],'waiting':this[_0xc465('0x14')]};var _0x344fd4=md5(JSON['stringify'](_0x4ddaf6));if(this[_0xc465('0x1')]!==_0x344fd4){this[_0xc465('0x1')]=_0x344fd4;io['to'](util[_0xc465('0x15')]('fax:queue:%s',_0x4ddaf6[_0xc465('0x6')]))['emit'](_0xc465('0x16'),_0x4ddaf6);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x975d=['exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','paused','length','faxPause','available','loggedIn','name','stringify','fax:queue:%s','fax_queue:save'];(function(_0x3e69ae,_0x3aa834){var _0x54acca=function(_0x520902){while(--_0x520902){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x54acca(++_0x3aa834);}(_0x975d,0xaf));var _0xd975=function(_0xda7f08,_0x3e1078){_0xda7f08=_0xda7f08-0x0;var _0x3ef3f5=_0x975d[_0xda7f08];return _0x3ef3f5;};'use strict';var _=require('lodash');var md5=require(_0xd975('0x0'));var util=require(_0xd975('0x1'));var Redis=require(_0xd975('0x2'));var config=require(_0xd975('0x3'));config[_0xd975('0x4')]=_[_0xd975('0x5')](config[_0xd975('0x4')],{'host':_0xd975('0x6'),'port':0x18eb});var io=require(_0xd975('0x7'))(new Redis(config[_0xd975('0x4')]));function FaxQueue(_0x359e44){this['id']=_0x359e44['id']||0x0;this['name']=_0x359e44['name']||'';this[_0xd975('0x8')]=_0x359e44['timeout']||0xa;this[_0xd975('0x9')]=_0x359e44[_0xd975('0x9')]||_0xd975('0xa');this['Agents']=_0x359e44[_0xd975('0xb')];this['mapAgentsId']={};this[_0xd975('0xc')]=0x0;this['md5']='';this[_0xd975('0xd')]();this[_0xd975('0xe')]();}FaxQueue['prototype'][_0xd975('0xd')]=function(){var _0x3f1879=this[_0xd975('0xf')][_0xd975('0x10')];this[_0xd975('0xf')]=_[_0xd975('0x11')](this[_0xd975('0xb')],'id');this[_0xd975('0xf')][_0xd975('0x10')]=_0x3f1879;};FaxQueue[_0xd975('0x12')][_0xd975('0xe')]=function(){this['loggedIn']=0x0;this[_0xd975('0x13')]=0x0;for(var _0x24005c=0x0;_0x24005c=0x0?this[_0xd975('0x16')]:0x0;var _0x3c04a9={'id':this['id'],'available':this[_0xd975('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xd975('0x18')],'paused':this['paused'],'waiting':this['waiting']};var _0x1d9a6e=md5(JSON[_0xd975('0x19')](_0x3c04a9));if(this[_0xd975('0x0')]!==_0x1d9a6e){this[_0xd975('0x0')]=_0x1d9a6e;io['to'](util['format'](_0xd975('0x1a'),_0x3c04a9[_0xd975('0x18')]))['emit'](_0xd975('0x1b'),_0x3c04a9);}};module[_0xd975('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 90b3b4f..d2c69a0 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 _0x68cb=['name','Intervals'];(function(_0x56ca01,_0x413d47){var _0x719266=function(_0x1560ac){while(--_0x1560ac){_0x56ca01['push'](_0x56ca01['shift']());}};_0x719266(++_0x413d47);}(_0x68cb,0x112));var _0xb68c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x68cb[_0x321bb2];return _0x9c12ed;};'use strict';function Interval(_0xfe71bc){this['id']=_0xfe71bc['id']||0x0;this['name']=_0xfe71bc[_0xb68c('0x0')]||'';this[_0xb68c('0x1')]=_0xfe71bc[_0xb68c('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xa2fe=['Intervals','name'];(function(_0x41923d,_0x97965f){var _0x2a63a0=function(_0x38199c){while(--_0x38199c){_0x41923d['push'](_0x41923d['shift']());}};_0x2a63a0(++_0x97965f);}(_0xa2fe,0x1f1));var _0xea2f=function(_0x3fcf7a,_0x599ecc){_0x3fcf7a=_0x3fcf7a-0x0;var _0x34cc20=_0xa2fe[_0x3fcf7a];return _0x34cc20;};'use strict';function Interval(_0x1b1cb0){this['id']=_0x1b1cb0['id']||0x0;this[_0xea2f('0x0')]=_0x1b1cb0[_0xea2f('0x0')]||'';this[_0xea2f('0x1')]=_0x1b1cb0[_0xea2f('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 2749c89..a54ec95 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 _0x61db=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','online','mailPause','paused','available','waiting','mail:queue:%s','emit','mail_queue:save'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x61db,0xaf));var _0xb61d=function(_0x25dc1c,_0x5e66b8){_0x25dc1c=_0x25dc1c-0x0;var _0x2fee52=_0x61db[_0x25dc1c];return _0x2fee52;};'use strict';var _=require(_0xb61d('0x0'));var md5=require(_0xb61d('0x1'));var util=require(_0xb61d('0x2'));var Redis=require(_0xb61d('0x3'));var config=require(_0xb61d('0x4'));config[_0xb61d('0x5')]=_[_0xb61d('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb61d('0x7'))(new Redis(config[_0xb61d('0x5')]));function MailQueue(_0x3b2e54){this['id']=_0x3b2e54['id']||0x0;this[_0xb61d('0x8')]=_0x3b2e54['name']||'';this['timeout']=_0x3b2e54[_0xb61d('0x9')]||0xa;this[_0xb61d('0xa')]=_0x3b2e54[_0xb61d('0xa')]||_0xb61d('0xb');this[_0xb61d('0xc')]=_0x3b2e54[_0xb61d('0xc')];this[_0xb61d('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0xb61d('0xe')]();this[_0xb61d('0xf')]();}MailQueue['prototype']['updateRouting']=function(){var _0x4aa0fa=this['mapAgentsId'][_0xb61d('0x10')];this['mapAgentsId']=_[_0xb61d('0x11')](this['Agents'],'id');this[_0xb61d('0xd')]['_rr']=_0x4aa0fa;};MailQueue[_0xb61d('0x12')]['updateRealtime']=function(){this[_0xb61d('0x13')]=0x0;this['paused']=0x0;for(var _0x5ad317=0x0;_0x5ad317=0x0?this[_0xb61d('0x17')]:0x0;var _0x5ba95d={'id':this['id'],'available':this[_0xb61d('0x17')],'loggedIn':this[_0xb61d('0x13')],'name':this[_0xb61d('0x8')],'paused':this['paused'],'waiting':this[_0xb61d('0x18')]};var _0x4c55ac=md5(JSON['stringify'](_0x5ba95d));if(this[_0xb61d('0x1')]!==_0x4c55ac){this[_0xb61d('0x1')]=_0x4c55ac;io['to'](util['format'](_0xb61d('0x19'),_0x5ba95d[_0xb61d('0x8')]))[_0xb61d('0x1a')](_0xb61d('0x1b'),_0x5ba95d);}};module[_0xb61d('0x1c')]=MailQueue; \ No newline at end of file +var _0x9045=['available','stringify','format','exports','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','map','updateRealtime','loggedIn','paused','length','mailPause'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x9045,0x15d));var _0x5904=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x9045[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require('lodash');var md5=require(_0x5904('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x5904('0x1'));config[_0x5904('0x2')]=_[_0x5904('0x3')](config[_0x5904('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x5904('0x4'))(new Redis(config[_0x5904('0x2')]));function MailQueue(_0x5793f1){this['id']=_0x5793f1['id']||0x0;this[_0x5904('0x5')]=_0x5793f1[_0x5904('0x5')]||'';this[_0x5904('0x6')]=_0x5793f1['timeout']||0xa;this[_0x5904('0x7')]=_0x5793f1[_0x5904('0x7')]||_0x5904('0x8');this[_0x5904('0x9')]=_0x5793f1[_0x5904('0x9')];this[_0x5904('0xa')]={};this[_0x5904('0xb')]=0x0;this[_0x5904('0x0')]='';this[_0x5904('0xc')]();this['updateRealtime']();}MailQueue['prototype']['updateRouting']=function(){var _0x3e68b5=this[_0x5904('0xa')]['_rr'];this[_0x5904('0xa')]=_[_0x5904('0xd')](this[_0x5904('0x9')],'id');this[_0x5904('0xa')]['_rr']=_0x3e68b5;};MailQueue['prototype'][_0x5904('0xe')]=function(){this[_0x5904('0xf')]=0x0;this[_0x5904('0x10')]=0x0;for(var _0x560de3=0x0;_0x560de3=0x0?this[_0x5904('0x13')]:0x0;var _0x396c2f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x5904('0xb')]};var _0x45c4d6=md5(JSON[_0x5904('0x14')](_0x396c2f));if(this['md5']!==_0x45c4d6){this['md5']=_0x45c4d6;io['to'](util[_0x5904('0x15')]('mail:queue:%s',_0x396c2f['name']))['emit']('mail_queue:save',_0x396c2f);}};module[_0x5904('0x16')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 35990b4..98a1680 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x326f,0xd1));var _0xf326=function(_0x48dfe3,_0x502dde){_0x48dfe3=_0x48dfe3-0x0;var _0x25d516=_0x326f[_0x48dfe3];return _0x25d516;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _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(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x7a54,0x106));var _0x47a5=function(_0x4925cc,_0x8d0d43){_0x4925cc=_0x4925cc-0x0;var _0x28d75a=_0x7a54[_0x4925cc];return _0x28d75a;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c502cdf..0186de9 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 _0xca8d=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','smsPause','available','waiting','stringify','format','sms:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x3a28df,_0x186024){var _0x7414ac=function(_0x35ed81){while(--_0x35ed81){_0x3a28df['push'](_0x3a28df['shift']());}};_0x7414ac(++_0x186024);}(_0xca8d,0x172));var _0xdca8=function(_0x26ef45,_0xe8ca61){_0x26ef45=_0x26ef45-0x0;var _0x45d365=_0xca8d[_0x26ef45];return _0x45d365;};'use strict';var _=require(_0xdca8('0x0'));var md5=require(_0xdca8('0x1'));var util=require(_0xdca8('0x2'));var Redis=require(_0xdca8('0x3'));var config=require(_0xdca8('0x4'));config[_0xdca8('0x5')]=_[_0xdca8('0x6')](config[_0xdca8('0x5')],{'host':_0xdca8('0x7'),'port':0x18eb});var io=require(_0xdca8('0x8'))(new Redis(config[_0xdca8('0x5')]));function SmsQueue(_0x32e549){this['id']=_0x32e549['id']||0x0;this['name']=_0x32e549[_0xdca8('0x9')]||'';this[_0xdca8('0xa')]=_0x32e549[_0xdca8('0xa')]||0xa;this[_0xdca8('0xb')]=_0x32e549[_0xdca8('0xb')]||'beepall';this[_0xdca8('0xc')]=_0x32e549[_0xdca8('0xc')];this[_0xdca8('0xd')]={};this['waiting']=0x0;this[_0xdca8('0x1')]='';this[_0xdca8('0xe')]();this[_0xdca8('0xf')]();}SmsQueue[_0xdca8('0x10')][_0xdca8('0xe')]=function(){var _0x349f88=this[_0xdca8('0xd')][_0xdca8('0x11')];this[_0xdca8('0xd')]=_['map'](this['Agents'],'id');this[_0xdca8('0xd')][_0xdca8('0x11')]=_0x349f88;};SmsQueue[_0xdca8('0x10')][_0xdca8('0xf')]=function(){this[_0xdca8('0x12')]=0x0;this[_0xdca8('0x13')]=0x0;for(var _0x3ea305=0x0;_0x3ea305=0x0?this[_0xdca8('0x17')]:0x0;var _0x490650={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdca8('0x12')],'name':this[_0xdca8('0x9')],'paused':this[_0xdca8('0x13')],'waiting':this[_0xdca8('0x18')]};var _0x4ffe19=md5(JSON[_0xdca8('0x19')](_0x490650));if(this[_0xdca8('0x1')]!==_0x4ffe19){this['md5']=_0x4ffe19;io['to'](util[_0xdca8('0x1a')](_0xdca8('0x1b'),_0x490650[_0xdca8('0x9')]))['emit']('sms_queue:save',_0x490650);}};module[_0xdca8('0x1c')]=SmsQueue; \ No newline at end of file +var _0x00bb=['name','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','map','mapAgentsId','_rr','paused','length','available','loggedIn'];(function(_0x40116e,_0x177da7){var _0x2f2e83=function(_0x4fe596){while(--_0x4fe596){_0x40116e['push'](_0x40116e['shift']());}};_0x2f2e83(++_0x177da7);}(_0x00bb,0x1d8));var _0xb00b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x00bb[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xb00b('0x0'));var md5=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var Redis=require('ioredis');var config=require(_0xb00b('0x3'));config['redis']=_[_0xb00b('0x4')](config[_0xb00b('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xb00b('0x6'))(new Redis(config[_0xb00b('0x5')]));function SmsQueue(_0x5b3b34){this['id']=_0x5b3b34['id']||0x0;this['name']=_0x5b3b34['name']||'';this[_0xb00b('0x7')]=_0x5b3b34[_0xb00b('0x7')]||0xa;this[_0xb00b('0x8')]=_0x5b3b34[_0xb00b('0x8')]||_0xb00b('0x9');this[_0xb00b('0xa')]=_0x5b3b34['Agents'];this['mapAgentsId']={};this[_0xb00b('0xb')]=0x0;this[_0xb00b('0x1')]='';this[_0xb00b('0xc')]();this[_0xb00b('0xd')]();}SmsQueue[_0xb00b('0xe')]['updateRouting']=function(){var _0x3182db=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xb00b('0xf')](this[_0xb00b('0xa')],'id');this[_0xb00b('0x10')][_0xb00b('0x11')]=_0x3182db;};SmsQueue[_0xb00b('0xe')][_0xb00b('0xd')]=function(){this['loggedIn']=0x0;this[_0xb00b('0x12')]=0x0;for(var _0xb0d42e=0x0;_0xb0d42e=0x0?this[_0xb00b('0x14')]:0x0;var _0x599347={'id':this['id'],'available':this[_0xb00b('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xb00b('0x16')],'paused':this['paused'],'waiting':this[_0xb00b('0xb')]};var _0x3355a3=md5(JSON['stringify'](_0x599347));if(this['md5']!==_0x3355a3){this[_0xb00b('0x1')]=_0x3355a3;io['to'](util['format'](_0xb00b('0x17'),_0x599347[_0xb00b('0x16')]))[_0xb00b('0x18')](_0xb00b('0x19'),_0x599347);}};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 85cfeae..10607d9 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 _0x0917=['exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','online','loggedIn','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0917,0x1c3));var _0x7091=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0x0917[_0x4cd846];return _0x2f2a7d;};'use strict';var _=require(_0x7091('0x0'));var md5=require(_0x7091('0x1'));var util=require(_0x7091('0x2'));var Redis=require(_0x7091('0x3'));var config=require(_0x7091('0x4'));config['redis']=_[_0x7091('0x5')](config[_0x7091('0x6')],{'host':_0x7091('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7091('0x6')]));function WhatsappQueue(_0x388bab){this['id']=_0x388bab['id']||0x0;this[_0x7091('0x8')]=_0x388bab['name']||'';this[_0x7091('0x9')]=_0x388bab[_0x7091('0x9')]||0xa;this[_0x7091('0xa')]=_0x388bab[_0x7091('0xa')]||_0x7091('0xb');this[_0x7091('0xc')]=_0x388bab[_0x7091('0xc')];this['mapAgentsId']={};this[_0x7091('0xd')]=0x0;this['md5']='';this[_0x7091('0xe')]();this[_0x7091('0xf')]();}WhatsappQueue[_0x7091('0x10')][_0x7091('0xe')]=function(){var _0x5997b5=this[_0x7091('0x11')]['_rr'];this['mapAgentsId']=_[_0x7091('0x12')](this[_0x7091('0xc')],'id');this[_0x7091('0x11')][_0x7091('0x13')]=_0x5997b5;};WhatsappQueue['prototype'][_0x7091('0xf')]=function(){this['loggedIn']=0x0;this[_0x7091('0x14')]=0x0;for(var _0xc4c2bf=0x0;_0xc4c2bf=0x0?this[_0x7091('0x17')]:0x0;var _0x37bab9={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7091('0x16')],'name':this[_0x7091('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x38a0ba=md5(JSON[_0x7091('0x18')](_0x37bab9));if(this[_0x7091('0x1')]!==_0x38a0ba){this[_0x7091('0x1')]=_0x38a0ba;io['to'](util[_0x7091('0x19')](_0x7091('0x1a'),_0x37bab9[_0x7091('0x8')]))[_0x7091('0x1b')](_0x7091('0x1c'),_0x37bab9);}};module[_0x7091('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xd862=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy'];(function(_0x4a563b,_0x36f42d){var _0x2935ef=function(_0x32593f){while(--_0x32593f){_0x4a563b['push'](_0x4a563b['shift']());}};_0x2935ef(++_0x36f42d);}(_0xd862,0x18c));var _0x2d86=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xd862[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x2d86('0x0'));var md5=require(_0x2d86('0x1'));var util=require(_0x2d86('0x2'));var Redis=require(_0x2d86('0x3'));var config=require(_0x2d86('0x4'));config[_0x2d86('0x5')]=_[_0x2d86('0x6')](config[_0x2d86('0x5')],{'host':_0x2d86('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2d86('0x5')]));function WhatsappQueue(_0x7f14c7){this['id']=_0x7f14c7['id']||0x0;this['name']=_0x7f14c7[_0x2d86('0x8')]||'';this['timeout']=_0x7f14c7['timeout']||0xa;this[_0x2d86('0x9')]=_0x7f14c7['strategy']||'beepall';this[_0x2d86('0xa')]=_0x7f14c7[_0x2d86('0xa')];this[_0x2d86('0xb')]={};this[_0x2d86('0xc')]=0x0;this[_0x2d86('0x1')]='';this[_0x2d86('0xd')]();this[_0x2d86('0xe')]();}WhatsappQueue[_0x2d86('0xf')][_0x2d86('0xd')]=function(){var _0xdf363e=this['mapAgentsId'][_0x2d86('0x10')];this[_0x2d86('0xb')]=_[_0x2d86('0x11')](this[_0x2d86('0xa')],'id');this[_0x2d86('0xb')]['_rr']=_0xdf363e;};WhatsappQueue[_0x2d86('0xf')][_0x2d86('0xe')]=function(){this[_0x2d86('0x12')]=0x0;this[_0x2d86('0x13')]=0x0;for(var _0x37db85=0x0;_0x37db85=0x0?this['available']:0x0;var _0x2ec4ec={'id':this['id'],'available':this[_0x2d86('0x16')],'loggedIn':this[_0x2d86('0x12')],'name':this['name'],'paused':this[_0x2d86('0x13')],'waiting':this['waiting']};var _0x14330f=md5(JSON[_0x2d86('0x17')](_0x2ec4ec));if(this[_0x2d86('0x1')]!==_0x14330f){this[_0x2d86('0x1')]=_0x14330f;io['to'](util[_0x2d86('0x18')](_0x2d86('0x19'),_0x2ec4ec[_0x2d86('0x8')]))[_0x2d86('0x1a')](_0x2d86('0x1b'),_0x2ec4ec);}};module[_0x2d86('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 898a4e2..98c66d7 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(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 6ee8d93..293087f 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 _0x9e1c=['addTags','AddTagsToChatInteraction','../client','Request'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9e1c,0x1f2));var _0xc9e1=function(_0x1df7b9,_0x3c28be){_0x1df7b9=_0x1df7b9-0x0;var _0x3f92a0=_0x9e1c[_0x1df7b9];return _0x3f92a0;};'use strict';var client=require(_0xc9e1('0x0'));exports['update']=function(_0x4799cc,_0x28ac4c){return client[_0xc9e1('0x1')]('UpdateChatInteraction',{'body':_0x28ac4c,'options':{'where':{'id':_0x4799cc}},'log':'updateChatInteraction'});};exports[_0xc9e1('0x2')]=function(_0x3ea24e,_0x31d1bc){return client[_0xc9e1('0x1')](_0xc9e1('0x3'),{'body':_0x31d1bc,'options':{'where':{'id':_0x3ea24e}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6ee5=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x9ce42d,_0x153723){var _0xcb720e=function(_0x4f931d){while(--_0x4f931d){_0x9ce42d['push'](_0x9ce42d['shift']());}};_0xcb720e(++_0x153723);}(_0x6ee5,0x1a3));var _0x56ee=function(_0x491772,_0x45a808){_0x491772=_0x491772-0x0;var _0x391687=_0x6ee5[_0x491772];return _0x391687;};'use strict';var client=require(_0x56ee('0x0'));exports[_0x56ee('0x1')]=function(_0x2e450a,_0x70561c){return client['Request'](_0x56ee('0x2'),{'body':_0x70561c,'options':{'where':{'id':_0x2e450a}},'log':_0x56ee('0x3')});};exports[_0x56ee('0x4')]=function(_0xc7f966,_0xb3c68e){return client[_0x56ee('0x5')](_0x56ee('0x6'),{'body':_0xb3c68e,'options':{'where':{'id':_0xc7f966}},'log':_0x56ee('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 710c8fc..9497aa3 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 _0x4e29=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x4e29,0x150));var _0x94e2=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x4e29[_0x4715d2];return _0x141811;};'use strict';var client=require(_0x94e2('0x0'));exports[_0x94e2('0x1')]=function(_0x18fd8f){return client[_0x94e2('0x2')](_0x94e2('0x3'),{'body':_0x18fd8f,'log':_0x94e2('0x4')});}; \ No newline at end of file +var _0xc934=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x55e04a,_0x49c84e){var _0x407e6b=function(_0x251209){while(--_0x251209){_0x55e04a['push'](_0x55e04a['shift']());}};_0x407e6b(++_0x49c84e);}(_0xc934,0x17f));var _0x4c93=function(_0x39dd1d,_0x2461de){_0x39dd1d=_0x39dd1d-0x0;var _0x6858d=_0xc934[_0x39dd1d];return _0x6858d;};'use strict';var client=require(_0x4c93('0x0'));exports[_0x4c93('0x1')]=function(_0x3c5cce){return client[_0x4c93('0x2')](_0x4c93('0x3'),{'body':_0x3c5cce,'log':_0x4c93('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index e2dab90..0dac623 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 _0x5447=['getChatQueues','../client','Request','GetChatQueue','timeout','User','Agents','name','online','chatPause'];(function(_0x1858d8,_0x12ee8a){var _0x2f0227=function(_0xf1c2e7){while(--_0xf1c2e7){_0x1858d8['push'](_0x1858d8['shift']());}};_0x2f0227(++_0x12ee8a);}(_0x5447,0xf1));var _0x7544=function(_0x47e078,_0xb59c5d){_0x47e078=_0x47e078-0x0;var _0x5ecc71=_0x5447[_0x47e078];return _0x5ecc71;};'use strict';var client=require(_0x7544('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x7544('0x1')](_0x7544('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7544('0x3'),'strategy'],'include':[{'model':_0x7544('0x4'),'as':_0x7544('0x5'),'attributes':['id',_0x7544('0x6'),_0x7544('0x7'),_0x7544('0x8')]}]},'log':_0x7544('0x9')});};}; \ No newline at end of file +var _0x3d6d=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online','../client'];(function(_0xf864fb,_0x53b5bc){var _0x316ae2=function(_0x390fe6){while(--_0x390fe6){_0xf864fb['push'](_0xf864fb['shift']());}};_0x316ae2(++_0x53b5bc);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x27a1e0,_0x3ff2cb){_0x27a1e0=_0x27a1e0-0x0;var _0x1ca624=_0x3d6d[_0x27a1e0];return _0x1ca624;};'use strict';var client=require(_0xd3d6('0x0'));exports[_0xd3d6('0x1')]=function(){return function(){return client[_0xd3d6('0x2')](_0xd3d6('0x3'),{'options':{'raw':![],'attributes':['id',_0xd3d6('0x4'),_0xd3d6('0x5'),_0xd3d6('0x6')],'include':[{'model':_0xd3d6('0x7'),'as':_0xd3d6('0x8'),'attributes':['id',_0xd3d6('0x4'),_0xd3d6('0x9'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 47910f1..2438e84 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 _0xf452=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x481525,_0x3c9229){var _0x1dd0c0=function(_0x216ad5){while(--_0x216ad5){_0x481525['push'](_0x481525['shift']());}};_0x1dd0c0(++_0x3c9229);}(_0xf452,0x13b));var _0x2f45=function(_0x18ff55,_0x3eb10f){_0x18ff55=_0x18ff55-0x0;var _0x134643=_0xf452[_0x18ff55];return _0x134643;};'use strict';var client=require(_0x2f45('0x0'));exports[_0x2f45('0x1')]=function(_0x55d48e){return client[_0x2f45('0x2')](_0x2f45('0x3'),{'body':_0x55d48e,'log':_0x2f45('0x3')});};exports[_0x2f45('0x4')]=function(_0x602b00,_0x3f0b30){return client[_0x2f45('0x2')](_0x2f45('0x5'),{'body':_0x3f0b30,'options':{'where':{'uniqueid':_0x602b00},'order':[['id',_0x2f45('0x6')]],'limit':0x1},'log':_0x2f45('0x5')});}; \ No newline at end of file +var _0x97d5=['UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','DESC'];(function(_0x1241b1,_0x55a7c8){var _0x3aa14d=function(_0x334b40){while(--_0x334b40){_0x1241b1['push'](_0x1241b1['shift']());}};_0x3aa14d(++_0x55a7c8);}(_0x97d5,0x199));var _0x597d=function(_0x3a4545,_0xa6fc01){_0x3a4545=_0x3a4545-0x0;var _0x30d832=_0x97d5[_0x3a4545];return _0x30d832;};'use strict';var client=require(_0x597d('0x0'));exports[_0x597d('0x1')]=function(_0x2366b3){return client[_0x597d('0x2')](_0x597d('0x3'),{'body':_0x2366b3,'log':_0x597d('0x3')});};exports['update']=function(_0x3324dc,_0x2d89ef){return client[_0x597d('0x2')]('UpdateChatQueueReport',{'body':_0x2d89ef,'options':{'where':{'uniqueid':_0x3324dc},'order':[['id',_0x597d('0x4')]],'limit':0x1},'log':_0x597d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 3179bdb..eaa6d6a 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x7a54,0x106));var _0x47a5=function(_0x11e699,_0x4af31f){_0x11e699=_0x11e699-0x0;var _0x5d276d=_0x7a54[_0x11e699];return _0x5d276d;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1b46a8,_0x27da6d){var _0x44c92a=function(_0x2f0bce){while(--_0x2f0bce){_0x1b46a8['push'](_0x1b46a8['shift']());}};_0x44c92a(++_0x27da6d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 1b8f44b..1ff5e7d 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 _0x695a=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x695a,0x180));var _0xa695=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x695a[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports['create']=function(_0x57ff41){return client[_0xa695('0x0')](_0xa695('0x1'),{'body':_0x57ff41,'log':_0xa695('0x2')});}; \ No newline at end of file +var _0x6835=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x5700ba,_0x27b208){var _0x1efa89=function(_0x21e6e3){while(--_0x21e6e3){_0x5700ba['push'](_0x5700ba['shift']());}};_0x1efa89(++_0x27b208);}(_0x6835,0x78));var _0x5683=function(_0x7076b7,_0x45da1a){_0x7076b7=_0x7076b7-0x0;var _0x2f7b94=_0x6835[_0x7076b7];return _0x2f7b94;};'use strict';var client=require('../client');exports['create']=function(_0x2bf0b){return client[_0x5683('0x0')](_0x5683('0x1'),{'body':_0x2bf0b,'log':_0x5683('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index c3939ca..91ca015 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 _0xef81=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','Agents'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xef81,0x188));var _0x1ef8=function(_0x2e3e61,_0x4b9941){_0x2e3e61=_0x2e3e61-0x0;var _0x466cae=_0xef81[_0x2e3e61];return _0x466cae;};'use strict';var client=require(_0x1ef8('0x0'));exports[_0x1ef8('0x1')]=function(){return function(){return client[_0x1ef8('0x2')](_0x1ef8('0x3'),{'options':{'raw':![],'attributes':['id',_0x1ef8('0x4'),_0x1ef8('0x5'),_0x1ef8('0x6')],'include':[{'model':'User','as':_0x1ef8('0x7'),'attributes':['id',_0x1ef8('0x4'),'online','faxPause']}]},'log':_0x1ef8('0x1')});};}; \ No newline at end of file +var _0xe85c=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x1ba75d,_0x2253c4){var _0x5cbfea=function(_0x1aaaab){while(--_0x1aaaab){_0x1ba75d['push'](_0x1ba75d['shift']());}};_0x5cbfea(++_0x2253c4);}(_0xe85c,0x12e));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xce85('0x0'));exports[_0xce85('0x1')]=function(){return function(){return client[_0xce85('0x2')](_0xce85('0x3'),{'options':{'raw':![],'attributes':['id',_0xce85('0x4'),_0xce85('0x5'),_0xce85('0x6')],'include':[{'model':_0xce85('0x7'),'as':_0xce85('0x8'),'attributes':['id',_0xce85('0x4'),_0xce85('0x9'),_0xce85('0xa')]}]},'log':_0xce85('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 580e7b1..4aadb24 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 _0xc70c=['Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','../client','create'];(function(_0x138293,_0x197e7f){var _0x34c4a2=function(_0x20192b){while(--_0x20192b){_0x138293['push'](_0x138293['shift']());}};_0x34c4a2(++_0x197e7f);}(_0xc70c,0xa6));var _0xcc70=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc70c[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0xcc70('0x0'));exports[_0xcc70('0x1')]=function(_0x463727){return client[_0xcc70('0x2')](_0xcc70('0x3'),{'body':_0x463727,'log':'CreateFaxQueueReport'});};exports[_0xcc70('0x4')]=function(_0x5342e1,_0x77ff1d){return client[_0xcc70('0x2')]('UpdateFaxQueueReport',{'body':_0x77ff1d,'options':{'where':{'uniqueid':_0x5342e1},'order':[['id',_0xcc70('0x5')]],'limit':0x1},'log':_0xcc70('0x6')});}; \ No newline at end of file +var _0x60df=['update','UpdateFaxQueueReport','../client','create','CreateFaxQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60df,0x66));var _0xf60d=function(_0x34fb19,_0x4a1e47){_0x34fb19=_0x34fb19-0x0;var _0x576153=_0x60df[_0x34fb19];return _0x576153;};'use strict';var client=require(_0xf60d('0x0'));exports[_0xf60d('0x1')]=function(_0x2d5543){return client['Request'](_0xf60d('0x2'),{'body':_0x2d5543,'log':_0xf60d('0x2')});};exports[_0xf60d('0x3')]=function(_0x58e7a7,_0x31ae08){return client['Request'](_0xf60d('0x4'),{'body':_0x31ae08,'options':{'where':{'uniqueid':_0x58e7a7},'order':[['id','DESC']],'limit':0x1},'log':_0xf60d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2a415b5..a75de41 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 _0xeef6=['Intervals','name','interval','../client','getIntervals','Interval'];(function(_0x32c95,_0x3c5580){var _0x5065ae=function(_0x151a25){while(--_0x151a25){_0x32c95['push'](_0x32c95['shift']());}};_0x5065ae(++_0x3c5580);}(_0xeef6,0x19b));var _0x6eef=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xeef6[_0x178e48];return _0x440d7e;};'use strict';var client=require(_0x6eef('0x0'));exports[_0x6eef('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x6eef('0x2'),'as':_0x6eef('0x3'),'attributes':['id',_0x6eef('0x4'),_0x6eef('0x5')]}]},'log':_0x6eef('0x1')});};}; \ No newline at end of file +var _0x5d07=['getIntervals','Request','GetInterval','Interval','Intervals','name','interval','../client'];(function(_0x10250a,_0x274183){var _0x391046=function(_0x292d84){while(--_0x292d84){_0x10250a['push'](_0x10250a['shift']());}};_0x391046(++_0x274183);}(_0x5d07,0x1b7));var _0x75d0=function(_0x5e91a1,_0x131837){_0x5e91a1=_0x5e91a1-0x0;var _0x1b0f85=_0x5d07[_0x5e91a1];return _0x1b0f85;};'use strict';var client=require(_0x75d0('0x0'));exports[_0x75d0('0x1')]=function(){return function(){return client[_0x75d0('0x2')](_0x75d0('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x75d0('0x4'),'as':_0x75d0('0x5'),'attributes':['id',_0x75d0('0x6'),_0x75d0('0x7')]}]},'log':_0x75d0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index df66bef..facb5e5 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 _0x28f2=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0xfafb2b,_0x176236){var _0x30aafd=function(_0x78dfa6){while(--_0x78dfa6){_0xfafb2b['push'](_0xfafb2b['shift']());}};_0x30aafd(++_0x176236);}(_0x28f2,0x193));var _0x228f=function(_0x17749b,_0x4b4e3e){_0x17749b=_0x17749b-0x0;var _0x37ad41=_0x28f2[_0x17749b];return _0x37ad41;};'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 +var _0x583c=['update','UpdateMailInteraction','updateMailInteraction','Request','addTagsToChatInteraction','../client'];(function(_0x40c499,_0x38a649){var _0x12a5bc=function(_0x1e79ec){while(--_0x1e79ec){_0x40c499['push'](_0x40c499['shift']());}};_0x12a5bc(++_0x38a649);}(_0x583c,0x12b));var _0xc583=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x583c[_0x22ee1e];return _0x49a5c9;};'use strict';var client=require(_0xc583('0x0'));exports[_0xc583('0x1')]=function(_0xdc6797,_0x30ca4e){return client['Request'](_0xc583('0x2'),{'body':_0x30ca4e,'options':{'where':{'id':_0xdc6797}},'log':_0xc583('0x3')});};exports['addTags']=function(_0x4ca8e3,_0x13b8a7){return client[_0xc583('0x4')]('AddTagsToMailInteraction',{'body':_0x13b8a7,'options':{'where':{'id':_0x4ca8e3}},'log':_0xc583('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 76ef835..1fc5135 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 _0x7cb3=['Request','../client','create'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0x7cb3,0x1ed));var _0x37cb=function(_0x1bd492,_0x21d7d5){_0x1bd492=_0x1bd492-0x0;var _0x19c0d2=_0x7cb3[_0x1bd492];return _0x19c0d2;};'use strict';var client=require(_0x37cb('0x0'));exports[_0x37cb('0x1')]=function(_0x213b3b){return client[_0x37cb('0x2')]('CreateMailMessage',{'body':_0x213b3b,'log':'createMailMessage'});}; \ No newline at end of file +var _0x03e3=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x53e0c8,_0x5916e0){var _0x326705=function(_0x39cd11){while(--_0x39cd11){_0x53e0c8['push'](_0x53e0c8['shift']());}};_0x326705(++_0x5916e0);}(_0x03e3,0xc4));var _0x303e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x03e3[_0x422905];return _0x33dc6c;};'use strict';var client=require('../client');exports[_0x303e('0x0')]=function(_0x281a80){return client[_0x303e('0x1')](_0x303e('0x2'),{'body':_0x281a80,'log':_0x303e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 6c615ec..ae64bd4 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 _0x8407=['../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents','online'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8407,0x105));var _0x7840=function(_0xc931e,_0x51f200){_0xc931e=_0xc931e-0x0;var _0x56adfb=_0x8407[_0xc931e];return _0x56adfb;};'use strict';var client=require(_0x7840('0x0'));exports[_0x7840('0x1')]=function(){return function(){return client[_0x7840('0x2')](_0x7840('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7840('0x4'),_0x7840('0x5')],'include':[{'model':_0x7840('0x6'),'as':_0x7840('0x7'),'attributes':['id','name',_0x7840('0x8'),'mailPause']}]},'log':_0x7840('0x1')});};}; \ No newline at end of file +var _0x72d9=['GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','Request'];(function(_0xdde54b,_0x17a577){var _0x52752e=function(_0x2e0af9){while(--_0x2e0af9){_0xdde54b['push'](_0xdde54b['shift']());}};_0x52752e(++_0x17a577);}(_0x72d9,0xa1));var _0x972d=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x72d9[_0x2abc3d];return _0x252745;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x972d('0x0')](_0x972d('0x1'),{'options':{'raw':![],'attributes':['id',_0x972d('0x2'),_0x972d('0x3'),_0x972d('0x4')],'include':[{'model':_0x972d('0x5'),'as':_0x972d('0x6'),'attributes':['id','name',_0x972d('0x7'),_0x972d('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 5341b60..c619229 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 _0x0e1a=['update','../client','create','Request','CreateMailQueueReport'];(function(_0x4139c5,_0x213f76){var _0x3dbccd=function(_0x4043a5){while(--_0x4043a5){_0x4139c5['push'](_0x4139c5['shift']());}};_0x3dbccd(++_0x213f76);}(_0x0e1a,0x1e1));var _0xa0e1=function(_0x368aa5,_0x4d98b4){_0x368aa5=_0x368aa5-0x0;var _0x14e13b=_0x0e1a[_0x368aa5];return _0x14e13b;};'use strict';var client=require(_0xa0e1('0x0'));exports[_0xa0e1('0x1')]=function(_0x1e5993){return client[_0xa0e1('0x2')]('CreateMailQueueReport',{'body':_0x1e5993,'log':_0xa0e1('0x3')});};exports[_0xa0e1('0x4')]=function(_0x1b9f64,_0x4bc2e9){return client[_0xa0e1('0x2')]('UpdateMailQueueReport',{'body':_0x4bc2e9,'options':{'where':{'uniqueid':_0x1b9f64},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x317d=['update','UpdateMailQueueReport','create','Request'];(function(_0x5f0488,_0x6c662f){var _0x27740d=function(_0xf30fbe){while(--_0xf30fbe){_0x5f0488['push'](_0x5f0488['shift']());}};_0x27740d(++_0x6c662f);}(_0x317d,0x196));var _0xd317=function(_0x269c45,_0x54a063){_0x269c45=_0x269c45-0x0;var _0x2c43c2=_0x317d[_0x269c45];return _0x2c43c2;};'use strict';var client=require('../client');exports[_0xd317('0x0')]=function(_0xb19f83){return client[_0xd317('0x1')]('CreateMailQueueReport',{'body':_0xb19f83,'log':'CreateMailQueueReport'});};exports[_0xd317('0x2')]=function(_0x50d5b9,_0x380312){return client['Request'](_0xd317('0x3'),{'body':_0x380312,'options':{'where':{'uniqueid':_0x50d5b9},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 3578f77..8d29d6a 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 _0x2d81=['UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d81,0x1d8));var _0x12d8=function(_0xcd46d2,_0x218838){_0xcd46d2=_0xcd46d2-0x0;var _0x4bd8a7=_0x2d81[_0xcd46d2];return _0x4bd8a7;};'use strict';var client=require('../client');exports[_0x12d8('0x0')]=function(_0x1bc652,_0x1f6057){return client[_0x12d8('0x1')](_0x12d8('0x2'),{'body':_0x1f6057,'options':{'where':{'id':_0x1bc652}},'log':'updateOpenchannelInteraction'});};exports[_0x12d8('0x3')]=function(_0x34f3b9,_0x4bf34a){return client[_0x12d8('0x1')](_0x12d8('0x4'),{'body':_0x4bf34a,'options':{'where':{'id':_0x34f3b9}},'log':_0x12d8('0x5')});}; \ No newline at end of file +var _0x0add=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','updateOpenchannelInteraction','addTags'];(function(_0x57d6c5,_0x579f6e){var _0x2b0eeb=function(_0x420894){while(--_0x420894){_0x57d6c5['push'](_0x57d6c5['shift']());}};_0x2b0eeb(++_0x579f6e);}(_0x0add,0x188));var _0xd0ad=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x0add[_0xcd0918];return _0x250704;};'use strict';var client=require('../client');exports[_0xd0ad('0x0')]=function(_0x3369ad,_0x543adb){return client[_0xd0ad('0x1')]('UpdateOpenchannelInteraction',{'body':_0x543adb,'options':{'where':{'id':_0x3369ad}},'log':_0xd0ad('0x2')});};exports[_0xd0ad('0x3')]=function(_0x34d607,_0x36b25f){return client[_0xd0ad('0x1')](_0xd0ad('0x4'),{'body':_0x36b25f,'options':{'where':{'id':_0x34d607}},'log':_0xd0ad('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 6908152..4ea14da 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 _0xc1c2=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x1bc675,_0x2cae36){var _0x1ff010=function(_0x2ae1c1){while(--_0x2ae1c1){_0x1bc675['push'](_0x1bc675['shift']());}};_0x1ff010(++_0x2cae36);}(_0xc1c2,0x10f));var _0x2c1c=function(_0x19f382,_0x1e095e){_0x19f382=_0x19f382-0x0;var _0x577e16=_0xc1c2[_0x19f382];return _0x577e16;};'use strict';var client=require(_0x2c1c('0x0'));exports['create']=function(_0x16e727){return client[_0x2c1c('0x1')](_0x2c1c('0x2'),{'body':_0x16e727,'log':_0x2c1c('0x3')});}; \ No newline at end of file +var _0xfa4e=['CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0xf72ecc,_0x5976f4){var _0x4e360a=function(_0x109379){while(--_0x109379){_0xf72ecc['push'](_0xf72ecc['shift']());}};_0x4e360a(++_0x5976f4);}(_0xfa4e,0x182));var _0xefa4=function(_0xe4e372,_0x1942af){_0xe4e372=_0xe4e372-0x0;var _0x17df2f=_0xfa4e[_0xe4e372];return _0x17df2f;};'use strict';var client=require(_0xefa4('0x0'));exports['create']=function(_0x3bcc2f){return client['Request'](_0xefa4('0x1'),{'body':_0x3bcc2f,'log':_0xefa4('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f7c14bc..cf7d4af 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 _0xb93e=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','../client'];(function(_0x186684,_0xca280d){var _0x4d7362=function(_0x4640a7){while(--_0x4640a7){_0x186684['push'](_0x186684['shift']());}};_0x4d7362(++_0xca280d);}(_0xb93e,0x6d));var _0xeb93=function(_0xb6c736,_0x4a49b6){_0xb6c736=_0xb6c736-0x0;var _0x409a88=_0xb93e[_0xb6c736];return _0x409a88;};'use strict';var client=require(_0xeb93('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xeb93('0x1')](_0xeb93('0x2'),{'options':{'raw':![],'attributes':['id',_0xeb93('0x3'),_0xeb93('0x4'),_0xeb93('0x5')],'include':[{'model':_0xeb93('0x6'),'as':_0xeb93('0x7'),'attributes':['id',_0xeb93('0x3'),_0xeb93('0x8'),_0xeb93('0x9')]}]},'log':_0xeb93('0xa')});};}; \ No newline at end of file +var _0x7f1a=['timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0x7f1a,0x15a));var _0xa7f1=function(_0x1832d3,_0x2fb3a7){_0x1832d3=_0x1832d3-0x0;var _0x5f348d=_0x7f1a[_0x1832d3];return _0x5f348d;};'use strict';var client=require(_0xa7f1('0x0'));exports[_0xa7f1('0x1')]=function(){return function(){return client['Request'](_0xa7f1('0x2'),{'options':{'raw':![],'attributes':['id',_0xa7f1('0x3'),_0xa7f1('0x4'),_0xa7f1('0x5')],'include':[{'model':_0xa7f1('0x6'),'as':_0xa7f1('0x7'),'attributes':['id',_0xa7f1('0x3'),_0xa7f1('0x8'),_0xa7f1('0x9')]}]},'log':_0xa7f1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index cd9634e..d155456 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 _0x2379=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x279994,_0x582317){var _0x353d7a=function(_0x2c101f){while(--_0x2c101f){_0x279994['push'](_0x279994['shift']());}};_0x353d7a(++_0x582317);}(_0x2379,0x82));var _0x9237=function(_0x2133d6,_0x582bfe){_0x2133d6=_0x2133d6-0x0;var _0x279c03=_0x2379[_0x2133d6];return _0x279c03;};'use strict';var client=require('../client');exports['create']=function(_0x5131de){return client[_0x9237('0x0')](_0x9237('0x1'),{'body':_0x5131de,'log':_0x9237('0x1')});};exports[_0x9237('0x2')]=function(_0x170a61,_0x418d1f){return client[_0x9237('0x0')](_0x9237('0x3'),{'body':_0x418d1f,'options':{'where':{'uniqueid':_0x170a61},'order':[['id',_0x9237('0x4')]],'limit':0x1},'log':_0x9237('0x3')});}; \ No newline at end of file +var _0x6e00=['create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x22eaca,_0x398454){var _0x1b8d10=function(_0x3ec507){while(--_0x3ec507){_0x22eaca['push'](_0x22eaca['shift']());}};_0x1b8d10(++_0x398454);}(_0x6e00,0xb9));var _0x06e0=function(_0x1060e0,_0x511ab8){_0x1060e0=_0x1060e0-0x0;var _0xa34025=_0x6e00[_0x1060e0];return _0xa34025;};'use strict';var client=require(_0x06e0('0x0'));exports[_0x06e0('0x1')]=function(_0x42e0d8){return client[_0x06e0('0x2')](_0x06e0('0x3'),{'body':_0x42e0d8,'log':_0x06e0('0x3')});};exports['update']=function(_0xd4260d,_0x5975d5){return client[_0x06e0('0x2')](_0x06e0('0x4'),{'body':_0x5975d5,'options':{'where':{'uniqueid':_0xd4260d},'order':[['id',_0x06e0('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 71c9e9d..858e7be 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 _0x34f8=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','addTags'];(function(_0x128f92,_0x3a2239){var _0xdd2067=function(_0x2094af){while(--_0x2094af){_0x128f92['push'](_0x128f92['shift']());}};_0xdd2067(++_0x3a2239);}(_0x34f8,0x80));var _0x834f=function(_0x299c6d,_0x2d2072){_0x299c6d=_0x299c6d-0x0;var _0x35d9a5=_0x34f8[_0x299c6d];return _0x35d9a5;};'use strict';var client=require(_0x834f('0x0'));exports[_0x834f('0x1')]=function(_0x2a7837,_0x45ec5b){return client[_0x834f('0x2')]('UpdateSmsInteraction',{'body':_0x45ec5b,'options':{'where':{'id':_0x2a7837}},'log':'updateSmsInteraction'});};exports[_0x834f('0x3')]=function(_0x92264b,_0x4d23b1){return client[_0x834f('0x2')](_0x834f('0x4'),{'body':_0x4d23b1,'options':{'where':{'id':_0x92264b}},'log':_0x834f('0x5')});}; \ No newline at end of file +var _0xfd2f=['../client','update','Request','updateSmsInteraction','addTags'];(function(_0x864329,_0x179a56){var _0x345451=function(_0x3da7a6){while(--_0x3da7a6){_0x864329['push'](_0x864329['shift']());}};_0x345451(++_0x179a56);}(_0xfd2f,0x14a));var _0xffd2=function(_0x1a2261,_0x19799b){_0x1a2261=_0x1a2261-0x0;var _0x3ad327=_0xfd2f[_0x1a2261];return _0x3ad327;};'use strict';var client=require(_0xffd2('0x0'));exports[_0xffd2('0x1')]=function(_0x296e43,_0x5204b6){return client[_0xffd2('0x2')]('UpdateSmsInteraction',{'body':_0x5204b6,'options':{'where':{'id':_0x296e43}},'log':_0xffd2('0x3')});};exports[_0xffd2('0x4')]=function(_0x492c33,_0x983987){return client[_0xffd2('0x2')]('AddTagsToSmsInteraction',{'body':_0x983987,'options':{'where':{'id':_0x492c33}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 9a9563b..f3a4a7d 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 _0xa2b7=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x10e8ed,_0x384a0d){var _0x4aea4a=function(_0x486ad1){while(--_0x486ad1){_0x10e8ed['push'](_0x10e8ed['shift']());}};_0x4aea4a(++_0x384a0d);}(_0xa2b7,0xfd));var _0x7a2b=function(_0x5cb3fb,_0x255290){_0x5cb3fb=_0x5cb3fb-0x0;var _0x23739b=_0xa2b7[_0x5cb3fb];return _0x23739b;};'use strict';var client=require(_0x7a2b('0x0'));exports[_0x7a2b('0x1')]=function(_0xf9bd83){return client[_0x7a2b('0x2')](_0x7a2b('0x3'),{'body':_0xf9bd83,'log':_0x7a2b('0x4')});}; \ No newline at end of file +var _0xd6c7=['create','Request','../client'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xd6c7,0x155));var _0x7d6c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd6c7[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x7d6c('0x0'));exports[_0x7d6c('0x1')]=function(_0x34be3d){return client[_0x7d6c('0x2')]('CreateSmsMessage',{'body':_0x34be3d,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index fc2a281..dc777d8 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x333259,_0x1ada7b){var _0x39e421=function(_0x24803f){while(--_0x24803f){_0x333259['push'](_0x333259['shift']());}};_0x39e421(++_0x1ada7b);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x32a0d5,_0x355432){var _0x3eacf0=function(_0x239c5d){while(--_0x239c5d){_0x32a0d5['push'](_0x32a0d5['shift']());}};_0x3eacf0(++_0x355432);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index df0954a..12859a8 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0xedd9,0xfc));var _0x9edd=function(_0x32cae3,_0x3075fe){_0x32cae3=_0x32cae3-0x0;var _0x25526b=_0xedd9[_0x32cae3];return _0x25526b;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x31dc95,_0x1b2753){var _0x2f330a=function(_0x85194d){while(--_0x85194d){_0x31dc95['push'](_0x31dc95['shift']());}};_0x2f330a(++_0x1b2753);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index d51642d..0897aaf 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(_0x57cbfb,_0x2efcc6){var _0x196987=function(_0x1805c7){while(--_0x1805c7){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x196987(++_0x2efcc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x3c635e,_0x337c90){var _0x1fce5a=function(_0x494e5d){while(--_0x494e5d){_0x3c635e['push'](_0x3c635e['shift']());}};_0x1fce5a(++_0x337c90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 84c77cd..440a0ff 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 _0xc61d=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x5f1456,_0x3f70da){var _0x4b6fd5=function(_0x350d4e){while(--_0x350d4e){_0x5f1456['push'](_0x5f1456['shift']());}};_0x4b6fd5(++_0x3f70da);}(_0xc61d,0xfb));var _0xdc61=function(_0x519bea,_0x406ee5){_0x519bea=_0x519bea-0x0;var _0x5ccfe4=_0xc61d[_0x519bea];return _0x5ccfe4;};'use strict';var client=require(_0xdc61('0x0'));exports[_0xdc61('0x1')]=function(_0x3078b6,_0x444fd6){return client[_0xdc61('0x2')](_0xdc61('0x3'),{'body':_0x444fd6,'options':{'where':{'id':_0x3078b6}},'log':'updateWhatsappInteraction'});};exports[_0xdc61('0x4')]=function(_0x237baa,_0x4ebd75){return client[_0xdc61('0x2')](_0xdc61('0x5'),{'body':_0x4ebd75,'options':{'where':{'id':_0x237baa}},'log':_0xdc61('0x6')});}; \ No newline at end of file +var _0xe3da=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x47c195,_0x6304ba){var _0x3f6afb=function(_0x41736e){while(--_0x41736e){_0x47c195['push'](_0x47c195['shift']());}};_0x3f6afb(++_0x6304ba);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xae3d('0x0'));exports[_0xae3d('0x1')]=function(_0x2788fe,_0x405f17){return client[_0xae3d('0x2')](_0xae3d('0x3'),{'body':_0x405f17,'options':{'where':{'id':_0x2788fe}},'log':_0xae3d('0x4')});};exports[_0xae3d('0x5')]=function(_0xb2dfd3,_0x22bacf){return client[_0xae3d('0x2')](_0xae3d('0x6'),{'body':_0x22bacf,'options':{'where':{'id':_0xb2dfd3}},'log':_0xae3d('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3011c80..4aec3e6 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 _0x6534=['Request','CreateWhatsappMessage','../client','create'];(function(_0x34cea1,_0x16d860){var _0x2d796a=function(_0x11e340){while(--_0x11e340){_0x34cea1['push'](_0x34cea1['shift']());}};_0x2d796a(++_0x16d860);}(_0x6534,0x192));var _0x4653=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6534[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x4653('0x0'));exports[_0x4653('0x1')]=function(_0x51ee05){return client[_0x4653('0x2')](_0x4653('0x3'),{'body':_0x51ee05,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xaf10=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x452c05,_0x4d4af5){var _0x530fdc=function(_0x1a32ef){while(--_0x1a32ef){_0x452c05['push'](_0x452c05['shift']());}};_0x530fdc(++_0x4d4af5);}(_0xaf10,0x1b7));var _0x0af1=function(_0x16f68e,_0x962cb6){_0x16f68e=_0x16f68e-0x0;var _0xaf7f8c=_0xaf10[_0x16f68e];return _0xaf7f8c;};'use strict';var client=require(_0x0af1('0x0'));exports[_0x0af1('0x1')]=function(_0x37d6a0){return client[_0x0af1('0x2')](_0x0af1('0x3'),{'body':_0x37d6a0,'log':_0x0af1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 93af3cb..5004753 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 _0x6d28=['GetWhatsappQueue','name','timeout','User','Agents','../client','getWhatsappQueues','Request'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0x6d28,0x1d5));var _0x86d2=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x6d28[_0x2d994d];return _0xd54be4;};'use strict';var client=require(_0x86d2('0x0'));exports[_0x86d2('0x1')]=function(){return function(){return client[_0x86d2('0x2')](_0x86d2('0x3'),{'options':{'raw':![],'attributes':['id',_0x86d2('0x4'),_0x86d2('0x5'),'strategy'],'include':[{'model':_0x86d2('0x6'),'as':_0x86d2('0x7'),'attributes':['id',_0x86d2('0x4'),'online','whatsappPause']}]},'log':_0x86d2('0x1')});};}; \ No newline at end of file +var _0x36ed=['online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','timeout','Agents'];(function(_0xdef19b,_0x5ec560){var _0x4e2b02=function(_0x14667d){while(--_0x14667d){_0xdef19b['push'](_0xdef19b['shift']());}};_0x4e2b02(++_0x5ec560);}(_0x36ed,0x152));var _0xd36e=function(_0x23f692,_0x16eb2f){_0x23f692=_0x23f692-0x0;var _0x5232fe=_0x36ed[_0x23f692];return _0x5232fe;};'use strict';var client=require('../client');exports[_0xd36e('0x0')]=function(){return function(){return client['Request'](_0xd36e('0x1'),{'options':{'raw':![],'attributes':['id',_0xd36e('0x2'),_0xd36e('0x3'),'strategy'],'include':[{'model':'User','as':_0xd36e('0x4'),'attributes':['id',_0xd36e('0x2'),_0xd36e('0x5'),_0xd36e('0x6')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 28ac478..82c6a8f 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 _0xa8c5=['UpdateWhatsappQueueReport','../client','CreateWhatsappQueueReport','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa8c5,0xd9));var _0x5a8c=function(_0x1bcb4a,_0x4c6e6d){_0x1bcb4a=_0x1bcb4a-0x0;var _0x4655c6=_0xa8c5[_0x1bcb4a];return _0x4655c6;};'use strict';var client=require(_0x5a8c('0x0'));exports['create']=function(_0x481ba4){return client['Request'](_0x5a8c('0x1'),{'body':_0x481ba4,'log':'CreateWhatsappQueueReport'});};exports[_0x5a8c('0x2')]=function(_0x5750a7,_0x34e676){return client['Request'](_0x5a8c('0x3'),{'body':_0x34e676,'options':{'where':{'uniqueid':_0x5750a7},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x696c=['../client','create','update','Request','DESC','UpdateWhatsappQueueReport'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x696c,0xc6));var _0xc696=function(_0x2b441f,_0x249bac){_0x2b441f=_0x2b441f-0x0;var _0x1cc771=_0x696c[_0x2b441f];return _0x1cc771;};'use strict';var client=require(_0xc696('0x0'));exports[_0xc696('0x1')]=function(_0x107bb9){return client['Request']('CreateWhatsappQueueReport',{'body':_0x107bb9,'log':'CreateWhatsappQueueReport'});};exports[_0xc696('0x2')]=function(_0x36b03f,_0x54fb09){return client[_0xc696('0x3')]('UpdateWhatsappQueueReport',{'body':_0x54fb09,'options':{'where':{'uniqueid':_0x36b03f},'order':[['id',_0xc696('0x4')]],'limit':0x1},'log':_0xc696('0x5')});}; \ 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 9be625b..7a87c55 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 _0xcbd2=['map','join','stop','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s'];(function(_0x4790d4,_0x1aba85){var _0x4b7ac1=function(_0x4eaa53){while(--_0x4eaa53){_0x4790d4['push'](_0x4790d4['shift']());}};_0x4b7ac1(++_0x1aba85);}(_0xcbd2,0x64));var _0x2cbd=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0xcbd2[_0x44b7d6];return _0x5346f0;};'use strict';var schema=require('validate');var _=require(_0x2cbd('0x0'));var util=require(_0x2cbd('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x2cbd('0x2'))(_0x2cbd('0x3'));var strategy=require(_0x2cbd('0x4'));var queue=schema({'name':{'type':_0x2cbd('0x5'),'required':!![],'message':_0x2cbd('0x6')},'timeout':{'type':_0x2cbd('0x7'),'message':_0x2cbd('0x8')}});function writeLog(_0x2b8edb,_0xfe0b64,_0x3af425){return logger[_0x2cbd('0x9')](util['format'](_0x2cbd('0xa'),_0x2b8edb,_0xfe0b64[_0x2cbd('0xb')],_0x3af425));}function handleFindAgent(_0x434064){return function(_0x605a9a){return _0x605a9a[_0x2cbd('0xb')][_0x2cbd('0xc')]()===_0x434064[_0x2cbd('0xc')]();};}exports[_0x2cbd('0xd')]=function(_0x159973,_0x64833d,_0x27c961,_0xf3ccb1){return function(_0x137a0b){try{var _0x453fc0={'name':_0x64833d[0x0],'timeout':_0x64833d[0x1]};var _0x2b5ca9=queue[_0x2cbd('0xe')](_0x453fc0,{'typecast':!![]});if(_0x2b5ca9[_0x2cbd('0xf')]){logger['error'](_0x2cbd('0x10'),_0x159973,_[_0x2cbd('0x11')](_0x2b5ca9,'message')[_0x2cbd('0x12')](',\x20'));_0x137a0b[_0x2cbd('0x13')]();}else{var _0xb8d8bd=_['find'](_0x27c961[_0x2cbd('0x14')],handleFindAgent(_0x453fc0[_0x2cbd('0xb')]));if(_0xb8d8bd){var _0x208561=(_0x453fc0[_0x2cbd('0x15')]||0xa)*0x3e8;var _0x17a88b,_0x5c47e4;var _0x1d8d2c=seqqueue[_0x2cbd('0x16')](_0x208561);_0x1d8d2c['id']=_0x159973;_0x1d8d2c[_0x2cbd('0x17')]=_0x208561;_0x1d8d2c['channel']=_0xf3ccb1[_0x2cbd('0x18')];writeLog(_0x159973,_0xb8d8bd,util[_0x2cbd('0x19')](_0x2cbd('0x1a'),_0x208561));_0x27c961[_0x2cbd('0x1b')][_0x159973]['on'](_0x2cbd('0x1c'),function(){logger[_0x2cbd('0x9')](_0x2cbd('0x1d'),_0x159973);clearTimeout(_0x5c47e4);_0x5c47e4=undefined;_0x1d8d2c[_0x2cbd('0x1e')]();if(_0x27c961[_0x2cbd('0x1b')][_0x159973]){delete _0x27c961['rules'][_0x159973];}_0x137a0b['stop']();});_0x27c961[_0x2cbd('0x1b')][_0x159973]['on'](_0x2cbd('0x1f'),function(){if(_0x27c961[_0x2cbd('0x1b')][_0x159973]){delete _0x27c961[_0x2cbd('0x1b')][_0x159973];}});_0x5c47e4=setTimeout(function(){logger[_0x2cbd('0x9')](_0x2cbd('0x20'),_0x159973);clearTimeout(_0x5c47e4);_0x1d8d2c[_0x2cbd('0x1e')]();_0x137a0b[_0x2cbd('0x21')]();},_0x208561);strategy['agent'](_0x1d8d2c,_0xb8d8bd,_0x27c961,_0xf3ccb1);}else{logger[_0x2cbd('0x22')](_0x2cbd('0x23'),_0x159973,_0x453fc0[_0x2cbd('0xb')]);_0x137a0b[_0x2cbd('0x13')]();}}}catch(_0x32a0ff){console[_0x2cbd('0x24')](_0x32a0ff);logger[_0x2cbd('0x22')](_0x2cbd('0x25'),_0x159973,_0x32a0ff[_0x2cbd('0x26')]);_0x137a0b[_0x2cbd('0x13')]();}};}; \ No newline at end of file +var _0x56f0=['timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','find','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','number'];(function(_0x5790ae,_0x4e22e2){var _0x47d65d=function(_0x5c29d2){while(--_0x5c29d2){_0x5790ae['push'](_0x5790ae['shift']());}};_0x47d65d(++_0x4e22e2);}(_0x56f0,0x145));var _0x056f=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0x56f0[_0x5cca9f];return _0x55edda;};'use strict';var schema=require(_0x056f('0x0'));var _=require(_0x056f('0x1'));var util=require('util');var seqqueue=require(_0x056f('0x2'));var logger=require(_0x056f('0x3'))(_0x056f('0x4'));var strategy=require(_0x056f('0x5'));var queue=schema({'name':{'type':_0x056f('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x056f('0x7'),'message':_0x056f('0x8')}});function writeLog(_0x3cb2ef,_0xa5b214,_0x31bdec){return logger[_0x056f('0x9')](util[_0x056f('0xa')](_0x056f('0xb'),_0x3cb2ef,_0xa5b214['name'],_0x31bdec));}function handleFindAgent(_0x27a743){return function(_0x332fbb){return _0x332fbb[_0x056f('0xc')][_0x056f('0xd')]()===_0x27a743[_0x056f('0xd')]();};}exports[_0x056f('0xe')]=function(_0x19b3c6,_0x20e606,_0x1c1537,_0x4faf9c){return function(_0xb50e79){try{var _0xc6173e={'name':_0x20e606[0x0],'timeout':_0x20e606[0x1]};var _0x19c967=queue[_0x056f('0x0')](_0xc6173e,{'typecast':!![]});if(_0x19c967[_0x056f('0xf')]){logger[_0x056f('0x10')](_0x056f('0x11'),_0x19b3c6,_['map'](_0x19c967,_0x056f('0x12'))['join'](',\x20'));_0xb50e79['stop']();}else{var _0x3f0d91=_[_0x056f('0x13')](_0x1c1537[_0x056f('0x14')],handleFindAgent(_0xc6173e[_0x056f('0xc')]));if(_0x3f0d91){var _0x4d3a61=(_0xc6173e[_0x056f('0x15')]||0xa)*0x3e8;var _0x13d8ef,_0x2d18fd;var _0x491eff=seqqueue[_0x056f('0x16')](_0x4d3a61);_0x491eff['id']=_0x19b3c6;_0x491eff['atimeout']=_0x4d3a61;_0x491eff[_0x056f('0x17')]=_0x4faf9c[_0x056f('0x17')];writeLog(_0x19b3c6,_0x3f0d91,util['format'](_0x056f('0x18'),_0x4d3a61));_0x1c1537[_0x056f('0x19')][_0x19b3c6]['on'](_0x056f('0x1a'),function(){logger['info'](_0x056f('0x1b'),_0x19b3c6);clearTimeout(_0x2d18fd);_0x2d18fd=undefined;_0x491eff['close']();if(_0x1c1537['rules'][_0x19b3c6]){delete _0x1c1537['rules'][_0x19b3c6];}_0xb50e79[_0x056f('0x1c')]();});_0x1c1537[_0x056f('0x19')][_0x19b3c6]['on'](_0x056f('0x1d'),function(){if(_0x1c1537[_0x056f('0x19')][_0x19b3c6]){delete _0x1c1537['rules'][_0x19b3c6];}});_0x2d18fd=setTimeout(function(){logger['info'](_0x056f('0x1e'),_0x19b3c6);clearTimeout(_0x2d18fd);_0x491eff[_0x056f('0x1f')]();_0xb50e79[_0x056f('0x20')]();},_0x4d3a61);strategy[_0x056f('0x21')](_0x491eff,_0x3f0d91,_0x1c1537,_0x4faf9c);}else{logger[_0x056f('0x10')](_0x056f('0x22'),_0x19b3c6,_0xc6173e['name']);_0xb50e79[_0x056f('0x1c')]();}}}catch(_0x6d51aa){console['log'](_0x6d51aa);logger[_0x056f('0x10')](_0x056f('0x23'),_0x19b3c6,_0x6d51aa[_0x056f('0x24')]);_0xb50e79[_0x056f('0x1c')]();}};}; \ 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 98cf4a9..5502587 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 _0xa7eb=['error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','Message','Failed','moment','aws-sdk','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','body','catch'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xa7eb,0x1d1));var _0xba7e=function(_0x214934,_0x4e23b8){_0x214934=_0x214934-0x0;var _0xef1672=_0xa7eb[_0x214934];return _0xef1672;};'use strict';var _=require('lodash');var moment=require(_0xba7e('0x0'));var AWS=require(_0xba7e('0x1'));var utils=require('./utils');var logger=require(_0xba7e('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xba7e('0x3')),'mailMessage':require(_0xba7e('0x4')),'smsMessage':require(_0xba7e('0x5')),'faxMessage':require(_0xba7e('0x6')),'whatsappMessage':require(_0xba7e('0x7'))};exports[_0xba7e('0x8')]=function(_0x3f16fb,_0x8fd25){return function(_0x252ac1){try{if(!_['isNil'](this[_0xba7e('0x9')]['UserId'])){logger[_0xba7e('0xa')](_0xba7e('0xb'),_0x3f16fb,_0xba7e('0xc'));return _0x252ac1[_0xba7e('0xd')]();}var _0x27a0b2={'ContactId':this[_0xba7e('0xe')]['id'],'sentAt':moment()[_0xba7e('0xf')](_0xba7e('0x10')),'direction':_0xba7e('0x11')};if(this[_0xba7e('0x12')]===_0xba7e('0x13')||this[_0xba7e('0x12')]===_0xba7e('0x14')){_0x27a0b2[_0xba7e('0x15')]=this[_0xba7e('0x9')][_0xba7e('0x15')];}var _0x565a23=this['channel'];if(_0x565a23===_0xba7e('0x16')){_0x27a0b2[_0xba7e('0x17')]=this[_0xba7e('0x18')]['id'];}else{_0x27a0b2[_[_0xba7e('0x19')](_0x565a23)+_0xba7e('0x1a')]=this[_0xba7e('0x18')]['id'];}_0x27a0b2[_[_0xba7e('0x19')](_0x565a23)+_0xba7e('0x1b')]=this[_0xba7e('0x9')]['id'];if(this[_0xba7e('0x9')][_0xba7e('0x1c')]){var _0x136d48=_0x8fd25[0x4];if(!_[_0xba7e('0x1d')](_0x136d48)){_0x27a0b2['body']=utils[_0xba7e('0x1e')](_0x136d48,this);return rpc[_0x565a23+'Message'][_0xba7e('0x1f')](_0x27a0b2)[_0xba7e('0x20')](function(_0x1f25c1){logger[_0xba7e('0xa')](_0xba7e('0xb'),_0x3f16fb,_0x27a0b2[_0xba7e('0x21')]);})[_0xba7e('0x22')](function(_0x4043f1){logger[_0xba7e('0x23')](_0xba7e('0xb'),_0x3f16fb,JSON[_0xba7e('0x24')](_0x4043f1));})['finally'](function(){logger['info'](_0xba7e('0x25'),_0x3f16fb);_0x252ac1['stop']();});}else{logger[_0xba7e('0xa')](_0xba7e('0x26'),_0x3f16fb);_0x252ac1[_0xba7e('0x27')]();}}else{var _0x34d273=this;var _0x1f07fe=new AWS[(_0xba7e('0x28'))]({'accessKeyId':_0x8fd25[0x0],'secretAccessKey':_0x8fd25[0x1],'region':_0x8fd25[0x2]});var _0x18ab87={'botAlias':_0xba7e('0x29'),'botName':_0x8fd25[0x3],'inputText':this[_0xba7e('0x2a')][_0xba7e('0x21')],'userId':this[_0xba7e('0x12')]+':'+this[_0xba7e('0x9')]['id'][_0xba7e('0x2b')]()};_0x1f07fe[_0xba7e('0x2c')](_0x18ab87,function(_0x1920a3,_0x2fa51a){if(_0x1920a3){logger['error'](_0xba7e('0xb'),_0x3f16fb,_0x1920a3[_0xba7e('0x2a')]);_0x252ac1[_0xba7e('0xd')]();}else if(_0x2fa51a&&_0x2fa51a[_0xba7e('0x2a')]){_0x34d273[_0xba7e('0x21')][_0xba7e('0x2d')]=_0x2fa51a;_0x27a0b2[_0xba7e('0x21')]=_0x2fa51a['message'];_0x27a0b2[_0xba7e('0x2e')]='amazonlex';_0x27a0b2[_0xba7e('0x2f')]=JSON[_0xba7e('0x24')](_0x2fa51a);return rpc[_0x565a23+_0xba7e('0x30')]['create'](_0x27a0b2)['then'](function(_0x5841a6){logger[_0xba7e('0xa')](_0xba7e('0xb'),_0x3f16fb,_0x27a0b2[_0xba7e('0x21')]);if(_0x2fa51a['dialogState']==_0xba7e('0x31')){_0x252ac1[_0xba7e('0xd')]();}else{_0x252ac1['stop']();}})['catch'](function(_0x2e2e40){logger[_0xba7e('0x23')](_0xba7e('0xb'),_0x3f16fb,JSON['stringify'](_0x2e2e40));_0x252ac1['next']();});}else{_0x252ac1[_0xba7e('0xd')]();}});}}catch(_0x181569){logger[_0xba7e('0x23')](_0xba7e('0xb'),_0x3f16fb,JSON[_0xba7e('0x24')](_0x181569));_0x252ac1[_0xba7e('0x27')]();}};}; \ No newline at end of file +var _0x959f=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','body','Message','create','then','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText','amazonlex','providerResponse','dialogState','catch','moment','./utils','../../../../config/logger'];(function(_0x33bf75,_0x10114e){var _0x163d5d=function(_0x4698a5){while(--_0x4698a5){_0x33bf75['push'](_0x33bf75['shift']());}};_0x163d5d(++_0x10114e);}(_0x959f,0x81));var _0xf959=function(_0x4b79f8,_0xfdab1){_0x4b79f8=_0x4b79f8-0x0;var _0x5537fe=_0x959f[_0x4b79f8];return _0x5537fe;};'use strict';var _=require('lodash');var moment=require(_0xf959('0x0'));var AWS=require('aws-sdk');var utils=require(_0xf959('0x1'));var logger=require(_0xf959('0x2'))(_0xf959('0x3'));var rpc={'chatMessage':require(_0xf959('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf959('0x5')),'smsMessage':require(_0xf959('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf959('0x7'))};exports[_0xf959('0x8')]=function(_0x477e3c,_0x43d51e){return function(_0x5385d3){try{if(!_[_0xf959('0x9')](this[_0xf959('0xa')][_0xf959('0xb')])){logger[_0xf959('0xc')](_0xf959('0xd'),_0x477e3c,_0xf959('0xe'));return _0x5385d3[_0xf959('0xf')]();}var _0x1a2d90={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xf959('0x10')),'direction':_0xf959('0x11')};if(this[_0xf959('0x12')]===_0xf959('0x13')||this[_0xf959('0x12')]===_0xf959('0x14')){_0x1a2d90[_0xf959('0x15')]=this[_0xf959('0xa')]['phone'];}var _0x4d957e=this[_0xf959('0x12')];if(_0x4d957e===_0xf959('0x16')){_0x1a2d90[_0xf959('0x17')]=this[_0xf959('0x18')]['id'];}else{_0x1a2d90[_[_0xf959('0x19')](_0x4d957e)+'AccountId']=this[_0xf959('0x18')]['id'];}_0x1a2d90[_[_0xf959('0x19')](_0x4d957e)+'InteractionId']=this[_0xf959('0xa')]['id'];if(this[_0xf959('0xa')][_0xf959('0x1a')]){var _0x471a3c=_0x43d51e[0x4];if(!_[_0xf959('0x1b')](_0x471a3c)){_0x1a2d90[_0xf959('0x1c')]=utils['getMustacheRender'](_0x471a3c,this);return rpc[_0x4d957e+_0xf959('0x1d')][_0xf959('0x1e')](_0x1a2d90)[_0xf959('0x1f')](function(_0xa218ba){logger[_0xf959('0xc')](_0xf959('0xd'),_0x477e3c,_0x1a2d90[_0xf959('0x1c')]);})['catch'](function(_0x287f4b){logger[_0xf959('0x20')](_0xf959('0xd'),_0x477e3c,JSON[_0xf959('0x21')](_0x287f4b));})[_0xf959('0x22')](function(){logger[_0xf959('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x477e3c);_0x5385d3[_0xf959('0x23')]();});}else{logger[_0xf959('0xc')](_0xf959('0x24'),_0x477e3c);_0x5385d3[_0xf959('0x23')]();}}else{var _0x311c69=this;var _0x467121=new AWS[(_0xf959('0x25'))]({'accessKeyId':_0x43d51e[0x0],'secretAccessKey':_0x43d51e[0x1],'region':_0x43d51e[0x2]});var _0x25caad={'botAlias':'$LATEST','botName':_0x43d51e[0x3],'inputText':this[_0xf959('0x26')][_0xf959('0x1c')],'userId':this[_0xf959('0x12')]+':'+this[_0xf959('0xa')]['id']['toString']()};_0x467121[_0xf959('0x27')](_0x25caad,function(_0x4f470b,_0x4fbfa3){if(_0x4f470b){logger[_0xf959('0x20')](_0xf959('0xd'),_0x477e3c,_0x4f470b[_0xf959('0x26')]);_0x5385d3[_0xf959('0xf')]();}else if(_0x4fbfa3&&_0x4fbfa3[_0xf959('0x26')]){_0x311c69['body'][_0xf959('0x28')]=_0x4fbfa3;_0x1a2d90[_0xf959('0x1c')]=_0x4fbfa3[_0xf959('0x26')];_0x1a2d90['providerName']='amazonlex';_0x1a2d90[_0xf959('0x29')]=JSON[_0xf959('0x21')](_0x4fbfa3);return rpc[_0x4d957e+'Message'][_0xf959('0x1e')](_0x1a2d90)[_0xf959('0x1f')](function(_0x237a07){logger[_0xf959('0xc')](_0xf959('0xd'),_0x477e3c,_0x1a2d90[_0xf959('0x1c')]);if(_0x4fbfa3[_0xf959('0x2a')]=='Failed'){_0x5385d3[_0xf959('0xf')]();}else{_0x5385d3[_0xf959('0x23')]();}})[_0xf959('0x2b')](function(_0x437e3e){logger[_0xf959('0x20')]('[%s][AMAZONLEX]\x20%s',_0x477e3c,JSON['stringify'](_0x437e3e));_0x5385d3[_0xf959('0xf')]();});}else{_0x5385d3[_0xf959('0xf')]();}});}}catch(_0x28706c){logger[_0xf959('0x20')]('[%s][AMAZONLEX]\x20%s',_0x477e3c,JSON[_0xf959('0x21')](_0x28706c));_0x5385d3[_0xf959('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index b723e92..b30af37 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 _0x749f=['isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','info','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','InteractionId','inReplyTo','messageId','html','','replace','';_0x23bd28['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xf749('0x2e'),'Precedence':'auto_reply'};return mailRpc[_0xf749('0x2f')](this[_0xf749('0x24')]['smtpOptions'],_0x23bd28)[_0xf749('0x30')](function(_0x2dea58){logger[_0xf749('0x14')](_0xf749('0x31'),_0x44f81e);_0x23bd28[_0xf749('0x28')]=_0x2dea58[_0xf749('0x1c')]['messageId'];return rpc[_0x2bc5d0+_0xf749('0x32')]['create'](_0x23bd28);})[_0xf749('0x30')](function(_0x41181d){logger['info'](_0xf749('0x11'),_0x44f81e,JSON['stringify'](_0x41181d));})['catch'](function(_0x332ecc){logger[_0xf749('0x33')](_0xf749('0x34'),_0x44f81e,JSON['stringify'](_0x332ecc));})[_0xf749('0x35')](function(){Promise[_0xf749('0x36')]()[_0xf749('0x30')](function(){if(_0x255072[0x0]!=='2'||_0x57886c['autoreplyExecuted'])return;return rpc[_0x2bc5d0+'Interaction']['update'](_0x57886c['id'],{'autoreplyExecuted':!![]})[_0xf749('0x30')](function(_0x19e8d5){logger[_0xf749('0x14')](_0xf749('0x18'),_0x44f81e,JSON[_0xf749('0x37')](_0x19e8d5));})['catch'](function(_0x5b0161){logger[_0xf749('0x33')](_0xf749('0x38'),_0x44f81e,JSON[_0xf749('0x37')](_0x5b0161));});})[_0xf749('0x30')](function(){_0x4664b7[_0xf749('0x16')]();});});}else{return rpc[this['channel']+'Message'][_0xf749('0x39')](_0x23bd28)['then'](function(){logger[_0xf749('0x14')](_0xf749('0x11'),_0x44f81e,_0x23bd28['body']);})['catch'](function(_0x24a52a){logger['error'](_0xf749('0x11'),_0x44f81e,JSON[_0xf749('0x37')](_0x24a52a));})[_0xf749('0x35')](function(){Promise[_0xf749('0x36')]()['then'](function(){if(_0x255072[0x0]!=='2'||_0x57886c[_0xf749('0x17')])return;return rpc[_0x2bc5d0+_0xf749('0x3a')][_0xf749('0x3b')](_0x57886c['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1706e3){logger[_0xf749('0x14')](_0xf749('0x18'),_0x44f81e,JSON[_0xf749('0x37')](_0x1706e3));})[_0xf749('0x3c')](function(_0x25a3e5){logger[_0xf749('0x33')](_0xf749('0x38'),_0x44f81e,JSON[_0xf749('0x37')](_0x25a3e5));});})[_0xf749('0x30')](function(){_0x4664b7['next']();});});}}}catch(_0x313b11){logger[_0xf749('0x33')](_0xf749('0x11'),_0x44f81e,JSON[_0xf749('0x37')](_0x313b11));_0x4664b7[_0xf749('0x3d')]();}};}; \ No newline at end of file +var _0xe588=['[RPC][%s][AUTOREPLY]\x20%s','resolve','autoreplyExecuted','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','Interaction','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','next','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','AccountId','account','InteractionId','Message','','replace','','headers','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch'];(function(_0x177be1,_0x41a17d){var _0x1913e0=function(_0x4668ee){while(--_0x4668ee){_0x177be1['push'](_0x177be1['shift']());}};_0x1913e0(++_0x41a17d);}(_0xe588,0x1d7));var _0x8e58=function(_0x2f275b,_0x4ee0ab){_0x2f275b=_0x2f275b-0x0;var _0x3c2c76=_0xe588[_0x2f275b];return _0x3c2c76;};'use strict';var _=require(_0x8e58('0x0'));var moment=require('moment');var utils=require(_0x8e58('0x1'));var logger=require(_0x8e58('0x2'))('routing');var rpc={'chatMessage':require(_0x8e58('0x3')),'openchannelMessage':require(_0x8e58('0x4')),'mailMessage':require(_0x8e58('0x5')),'smsMessage':require(_0x8e58('0x6')),'faxMessage':require(_0x8e58('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x8e58('0x8')),'openchannelInteraction':require(_0x8e58('0x9')),'mailInteraction':require(_0x8e58('0xa')),'smsInteraction':require(_0x8e58('0xb')),'faxInteraction':require(_0x8e58('0xc')),'whatsappInteraction':require(_0x8e58('0xd'))};var mailRpc=require(_0x8e58('0xe'));exports[_0x8e58('0xf')]=function(_0x1ee97b,_0xc91fcb,_0x2c620b,_0x1cb854){return function(_0x5bece2){try{var _0x46c662=this[_0x8e58('0x10')];if(_0x46c662===_0x8e58('0x11')&&_0x1cb854[_0x8e58('0x12')][_0x8e58('0x13')]){logger[_0x8e58('0x14')]('[%s][AUTOREPLY]\x20%s',_0x1ee97b,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x5bece2[_0x8e58('0x15')]();}if(_0xc91fcb[0x0]==='1'&&(_[_0x8e58('0x16')](this['interaction'][_0x8e58('0x17')])||!this[_0x8e58('0x18')]['created'])){logger[_0x8e58('0x14')](_0x8e58('0x19'),_0x1ee97b,'Autoreply\x20already\x20sent');return _0x5bece2[_0x8e58('0x15')]();}if(_0xc91fcb[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x8e58('0x14')](_0x8e58('0x1a'),_0x1ee97b,_0x8e58('0x1b'));return _0x5bece2[_0x8e58('0x15')]();}var _0x399571={'ContactId':this[_0x8e58('0x1c')]['id'],'sentAt':moment()[_0x8e58('0x1d')](_0x8e58('0x1e')),'direction':'out'};if(this[_0x8e58('0x10')]===_0x8e58('0x11')){_0x399571[_0x8e58('0x12')]=utils['getMustacheRender'](_0xc91fcb[0x2],this);}else{_0x399571['body']=utils[_0x8e58('0x1f')](_0xc91fcb[0x1],this);}if(this[_0x8e58('0x20')]){_0x399571['to']=this['message']['from']||'';if(this[_0x8e58('0x10')]===_0x8e58('0x11')&&_0xc91fcb[0x1]==='1'){_0x399571['cc']=this['message']['cc']||'';}_0x399571[_0x8e58('0x21')]=this[_0x8e58('0x20')]['to']||'';_0x399571[_0x8e58('0x22')]=this[_0x8e58('0x20')][_0x8e58('0x22')]||'';_0x399571[_0x8e58('0x23')]=!![];if(this['message']['subject']){_0x399571[_0x8e58('0x24')]='';_0x399571[_0x8e58('0x24')]+=_[_0x8e58('0x25')](this[_0x8e58('0x20')]['subject'],_0x8e58('0x26'))?'':_0x8e58('0x27');_0x399571['subject']+=this[_0x8e58('0x20')][_0x8e58('0x24')];}}if(this[_0x8e58('0x10')]===_0x8e58('0x28')){_0x399571[_0x8e58('0x29')]=this['account']['id'];}else{_0x399571[_['upperFirst'](this[_0x8e58('0x10')])+_0x8e58('0x2a')]=this[_0x8e58('0x2b')]['id'];}_0x399571[_['upperFirst'](this['channel'])+_0x8e58('0x2c')]=this['interaction']['id'];var _0x4be988=this[_0x8e58('0x18')];if(rpc[this['channel']+_0x8e58('0x2d')]){if(this[_0x8e58('0x10')]===_0x8e58('0x11')){_0x399571['inReplyTo']=this[_0x8e58('0x20')]['messageId'];_0x399571['html']=_0x8e58('0x2e')+_[_0x8e58('0x2f')](_0x399571['body'],']+(>|$)/g,''),'priorityTrue':_0x55d5e7[0x1],'priorityFalse':_0x55d5e7[0x2]};var _0x4d7f28=gotoif[_0x6cf0('0x0')](_0x28e5c1,{'typecast':!![]});if(_0x4d7f28[_0x6cf0('0xc')]){logger[_0x6cf0('0xd')]('[%s][GOTOIF]\x20%s',_0x378a35,_[_0x6cf0('0xe')](_0x4d7f28,_0x6cf0('0xf'))['join'](',\x20'));_0x1fc08e[_0x6cf0('0x10')]();}else{try{var _0x1306fe=eval('('+_0x28e5c1[_0x6cf0('0x11')]+')');var _0x2a3420=_0x1306fe?_0x28e5c1[_0x6cf0('0x12')]:_0x28e5c1[_0x6cf0('0x13')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x378a35,_0x28e5c1[_0x6cf0('0x11')],_0x1306fe,_0x2a3420||_0x6cf0('0x14'));if(_0x2a3420){var _0x419158=_[_0x6cf0('0x15')](_0x1fc08e[_0x6cf0('0x16')](),{'p':_0x2a3420});if(_0x419158>=0x0){logger[_0x6cf0('0x17')](_0x6cf0('0x18'),_0x378a35,_0x2a3420||_0x6cf0('0x14'),_0x419158);_0x1fc08e['next'](_0x419158);}else{logger['info'](_0x6cf0('0x19'),_0x378a35,_0x2a3420||_0x6cf0('0x14'));_0x1fc08e['stop']();}}else{_0x1fc08e['next']();}}catch(_0x32c704){logger[_0x6cf0('0xd')](_0x6cf0('0x1a'),_0x378a35,_0x32c704['message']);_0x1fc08e[_0x6cf0('0x10')]();}}}catch(_0x515085){logger['error'](_0x6cf0('0x1b'),_0x378a35,JSON[_0x6cf0('0x1c')](_0x515085));_0x1fc08e[_0x6cf0('0x10')]();}};}; \ No newline at end of file +var _0xe10e=['message','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','info','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s'];(function(_0xf7b93d,_0x3c4714){var _0x57cb14=function(_0x1e0fb4){while(--_0x1e0fb4){_0xf7b93d['push'](_0xf7b93d['shift']());}};_0x57cb14(++_0x3c4714);}(_0xe10e,0x130));var _0xee10=function(_0x1f2446,_0x405cfc){_0x1f2446=_0x1f2446-0x0;var _0x468bfa=_0xe10e[_0x1f2446];return _0x468bfa;};'use strict';var schema=require(_0xee10('0x0'));var _=require(_0xee10('0x1'));var htmlToText=require(_0xee10('0x2'));var utils=require('./utils');var logger=require(_0xee10('0x3'))(_0xee10('0x4'));var gotoif=schema({'condition':{'type':_0xee10('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xee10('0x6'),'message':_0xee10('0x7')},'priorityFalse':{'type':_0xee10('0x6'),'message':_0xee10('0x8')}});exports['consequence']=function(_0x1d80f3,_0x51d006){return function(_0x501be3){try{var _0xa139ed={'condition':htmlToText[_0xee10('0x9')](utils[_0xee10('0xa')](_0x51d006[0x0],this),{'wordwrap':![]})[_0xee10('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x51d006[0x1],'priorityFalse':_0x51d006[0x2]};var _0x260383=gotoif[_0xee10('0x0')](_0xa139ed,{'typecast':!![]});if(_0x260383[_0xee10('0xc')]){logger[_0xee10('0xd')](_0xee10('0xe'),_0x1d80f3,_['map'](_0x260383,_0xee10('0xf'))[_0xee10('0x10')](',\x20'));_0x501be3[_0xee10('0x11')]();}else{try{var _0x4ab0e6=eval('('+_0xa139ed[_0xee10('0x12')]+')');var _0x237161=_0x4ab0e6?_0xa139ed[_0xee10('0x13')]:_0xa139ed[_0xee10('0x14')];logger['info'](_0xee10('0x15'),_0x1d80f3,_0xa139ed['condition'],_0x4ab0e6,_0x237161||'next');if(_0x237161){var _0x3b43cb=_[_0xee10('0x16')](_0x501be3[_0xee10('0x17')](),{'p':_0x237161});if(_0x3b43cb>=0x0){logger[_0xee10('0x18')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1d80f3,_0x237161||_0xee10('0x19'),_0x3b43cb);_0x501be3[_0xee10('0x19')](_0x3b43cb);}else{logger[_0xee10('0x18')](_0xee10('0x1a'),_0x1d80f3,_0x237161||'next');_0x501be3[_0xee10('0x11')]();}}else{_0x501be3[_0xee10('0x19')]();}}catch(_0x11882b){logger[_0xee10('0xd')](_0xee10('0x1b'),_0x1d80f3,_0x11882b[_0xee10('0xf')]);_0x501be3[_0xee10('0x11')]();}}}catch(_0x3f6d9c){logger[_0xee10('0xd')]('[%s][GOTOIF]\x20%s',_0x1d80f3,JSON[_0xee10('0x1c')](_0x3f6d9c));_0x501be3[_0xee10('0x11')]();}};}; \ 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 ec14ad0..62918c9 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 _0xad60=['lodash','../../../../config/logger','routing','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate'];(function(_0x15a8fa,_0x4652b2){var _0x1355c2=function(_0x203292){while(--_0x203292){_0x15a8fa['push'](_0x15a8fa['shift']());}};_0x1355c2(++_0x4652b2);}(_0xad60,0x1da));var _0x0ad6=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xad60[_0x46e363];return _0x3fb059;};'use strict';var schema=require(_0x0ad6('0x0'));var _=require(_0x0ad6('0x1'));var logger=require(_0x0ad6('0x2'))(_0x0ad6('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x0ad6('0x4')]=function(_0x56dfbf,_0x4ebebc){return function(_0x9f2fb9){try{var _0x212418={'priority':_0x4ebebc[0x0]};var _0x4b377f=gotop['validate'](_0x212418,{'typecast':!![]});if(_0x4b377f[_0x0ad6('0x5')]){logger[_0x0ad6('0x6')](_0x0ad6('0x7'),_0x56dfbf,_['map'](_0x4b377f,_0x0ad6('0x8'))[_0x0ad6('0x9')](',\x20'));_0x9f2fb9[_0x0ad6('0xa')]();}else{logger['info'](_0x0ad6('0xb'),_0x56dfbf,_0x212418[_0x0ad6('0xc')]);if(_0x212418[_0x0ad6('0xc')]){var _0x56d8b2=_['findIndex'](_0x9f2fb9[_0x0ad6('0xd')](),{'p':_0x212418[_0x0ad6('0xc')]});if(_0x56d8b2>=0x0){logger[_0x0ad6('0xe')](_0x0ad6('0xf'),_0x56dfbf,_0x212418[_0x0ad6('0xc')]||_0x0ad6('0x10'),_0x56d8b2);_0x9f2fb9[_0x0ad6('0x10')](_0x56d8b2);}else{logger['info'](_0x0ad6('0x11'),_0x56dfbf,_0x212418[_0x0ad6('0xc')]||_0x0ad6('0x10'));_0x9f2fb9[_0x0ad6('0xa')]();}}else{_0x9f2fb9[_0x0ad6('0x10')]();}}}catch(_0x29bb68){logger[_0x0ad6('0x6')](_0x0ad6('0x7'),_0x56dfbf,JSON[_0x0ad6('0x12')](_0x29bb68));_0x9f2fb9[_0x0ad6('0xa')]();}};}; \ No newline at end of file +var _0x336a=['next','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x677d29,_0x51090b){var _0x277152=function(_0x86e8e2){while(--_0x86e8e2){_0x677d29['push'](_0x677d29['shift']());}};_0x277152(++_0x51090b);}(_0x336a,0xc9));var _0xa336=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x336a[_0x39c734];return _0xb2a2f9;};'use strict';var schema=require(_0xa336('0x0'));var _=require(_0xa336('0x1'));var logger=require(_0xa336('0x2'))(_0xa336('0x3'));var gotop=schema({'priority':{'type':_0xa336('0x4'),'required':!![],'message':_0xa336('0x5')}});exports[_0xa336('0x6')]=function(_0x13cd0a,_0x1afcc4){return function(_0x556df1){try{var _0x185e4b={'priority':_0x1afcc4[0x0]};var _0x21fc61=gotop['validate'](_0x185e4b,{'typecast':!![]});if(_0x21fc61[_0xa336('0x7')]){logger[_0xa336('0x8')](_0xa336('0x9'),_0x13cd0a,_['map'](_0x21fc61,_0xa336('0xa'))[_0xa336('0xb')](',\x20'));_0x556df1[_0xa336('0xc')]();}else{logger[_0xa336('0xd')](_0xa336('0xe'),_0x13cd0a,_0x185e4b['priority']);if(_0x185e4b[_0xa336('0xf')]){var _0x5f5d31=_[_0xa336('0x10')](_0x556df1[_0xa336('0x11')](),{'p':_0x185e4b[_0xa336('0xf')]});if(_0x5f5d31>=0x0){logger[_0xa336('0xd')](_0xa336('0x12'),_0x13cd0a,_0x185e4b[_0xa336('0xf')]||_0xa336('0x13'),_0x5f5d31);_0x556df1[_0xa336('0x13')](_0x5f5d31);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x13cd0a,_0x185e4b[_0xa336('0xf')]||_0xa336('0x13'));_0x556df1[_0xa336('0xc')]();}}else{_0x556df1['next']();}}}catch(_0x85b95){logger['error']('[%s][GOTOP]\x20%s',_0x13cd0a,JSON['stringify'](_0x85b95));_0x556df1['stop']();}};}; \ 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 12a633b..87be854 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 _0x3306=['catch','error','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body'];(function(_0x498c9a,_0x43cd7f){var _0x63ef27=function(_0x7f9370){while(--_0x7f9370){_0x498c9a['push'](_0x498c9a['shift']());}};_0x63ef27(++_0x43cd7f);}(_0x3306,0x107));var _0x6330=function(_0x3bebc0,_0x232a27){_0x3bebc0=_0x3bebc0-0x0;var _0x1330b0=_0x3306[_0x3bebc0];return _0x1330b0;};'use strict';var _=require(_0x6330('0x0'));var utils=require(_0x6330('0x1'));var logger=require(_0x6330('0x2'))(_0x6330('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6330('0x4')),'mailMessage':require(_0x6330('0x5')),'smsMessage':require(_0x6330('0x6')),'faxMessage':require(_0x6330('0x7')),'whatsappMessage':require(_0x6330('0x8'))};exports['consequence']=function(_0x2f26ed,_0x457797){return function(_0x2942ec){try{var _0x1f164b={'body':utils[_0x6330('0x9')](_0x457797[0x0],this),'ContactId':this[_0x6330('0xa')]['id']};if(this[_0x6330('0xb')]===_0x6330('0xc')){_0x1f164b[_0x6330('0xd')]=this[_0x6330('0xe')]['id'];}else{_0x1f164b[_['upperFirst'](this[_0x6330('0xb')])+'AccountId']=this[_0x6330('0xe')]['id'];}_0x1f164b[_[_0x6330('0xf')](this[_0x6330('0xb')])+_0x6330('0x10')]=this[_0x6330('0x11')]['id'];if(rpc[this[_0x6330('0xb')]+_0x6330('0x12')]){return rpc[this[_0x6330('0xb')]+'Message']['create'](_0x1f164b)[_0x6330('0x13')](function(_0x27ff9a){logger[_0x6330('0x14')](_0x6330('0x15'),_0x2f26ed,_0x1f164b[_0x6330('0x16')]);_0x2942ec['next']();})[_0x6330('0x17')](function(_0x38367a){logger[_0x6330('0x18')](_0x6330('0x15'),_0x2f26ed,JSON['stringify'](_0x38367a));_0x2942ec['stop']();});}}catch(_0x32b59f){logger[_0x6330('0x18')](_0x6330('0x15'),_0x2f26ed,JSON['stringify'](_0x32b59f));_0x2942ec[_0x6330('0x19')]();}};}; \ No newline at end of file +var _0x65aa=['../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x4653e8,_0x2133b9){var _0xaa702a=function(_0xe20b01){while(--_0xe20b01){_0x4653e8['push'](_0x4653e8['shift']());}};_0xaa702a(++_0x2133b9);}(_0x65aa,0x142));var _0xa65a=function(_0x1fb677,_0x2ef276){_0x1fb677=_0x1fb677-0x0;var _0x15d994=_0x65aa[_0x1fb677];return _0x15d994;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xa65a('0x0'))('routing');var rpc={'chatMessage':require(_0xa65a('0x1')),'openchannelMessage':require(_0xa65a('0x2')),'mailMessage':require(_0xa65a('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa65a('0x4')),'whatsappMessage':require(_0xa65a('0x5'))};exports[_0xa65a('0x6')]=function(_0x20e97d,_0xae21e9){return function(_0x2b387d){try{var _0x5c9a59={'body':utils[_0xa65a('0x7')](_0xae21e9[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xa65a('0x8')){_0x5c9a59['ChatWebsiteId']=this[_0xa65a('0x9')]['id'];}else{_0x5c9a59[_[_0xa65a('0xa')](this[_0xa65a('0xb')])+_0xa65a('0xc')]=this[_0xa65a('0x9')]['id'];}_0x5c9a59[_[_0xa65a('0xa')](this[_0xa65a('0xb')])+_0xa65a('0xd')]=this[_0xa65a('0xe')]['id'];if(rpc[this[_0xa65a('0xb')]+_0xa65a('0xf')]){return rpc[this[_0xa65a('0xb')]+_0xa65a('0xf')][_0xa65a('0x10')](_0x5c9a59)['then'](function(_0x1a52fc){logger[_0xa65a('0x11')](_0xa65a('0x12'),_0x20e97d,_0x5c9a59[_0xa65a('0x13')]);_0x2b387d[_0xa65a('0x14')]();})[_0xa65a('0x15')](function(_0x3a9409){logger[_0xa65a('0x16')]('[%s][MESSAGE]\x20%s',_0x20e97d,JSON[_0xa65a('0x17')](_0x3a9409));_0x2b387d[_0xa65a('0x18')]();});}}catch(_0xede8bd){logger[_0xa65a('0x16')](_0xa65a('0x12'),_0x20e97d,JSON[_0xa65a('0x17')](_0xede8bd));_0x2b387d[_0xa65a('0x18')]();}};}; \ 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 ea30456..73134eb 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 _0x3824=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','./utils'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0x3824,0x167));var _0x4382=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x3824[_0x261b8a];return _0x3455e8;};'use strict';var utils=require(_0x4382('0x0'));var logger=require(_0x4382('0x1'))(_0x4382('0x2'));exports[_0x4382('0x3')]=function(_0x59212b,_0x8f1bc){return function(_0x864215){try{logger[_0x4382('0x4')](_0x4382('0x5'),_0x59212b,utils[_0x4382('0x6')](_0x8f1bc[0x0],this));_0x864215['next']();}catch(_0x16bbca){logger[_0x4382('0x7')](_0x4382('0x5'),_0x59212b,JSON[_0x4382('0x8')](_0x16bbca));_0x864215['stop']();}};}; \ No newline at end of file +var _0x0aa1=['next','stringify','stop','./utils','routing','info','[%s][NOOP]\x20%s'];(function(_0x53ba30,_0x210d1e){var _0x46e47a=function(_0x39a06d){while(--_0x39a06d){_0x53ba30['push'](_0x53ba30['shift']());}};_0x46e47a(++_0x210d1e);}(_0x0aa1,0x129));var _0x10aa=function(_0x503d1f,_0x29a09c){_0x503d1f=_0x503d1f-0x0;var _0x3305ad=_0x0aa1[_0x503d1f];return _0x3305ad;};'use strict';var utils=require(_0x10aa('0x0'));var logger=require('../../../../config/logger')(_0x10aa('0x1'));exports['consequence']=function(_0x202f65,_0xa41f88){return function(_0x305d3f){try{logger[_0x10aa('0x2')](_0x10aa('0x3'),_0x202f65,utils['getMustacheRender'](_0xa41f88[0x0],this));_0x305d3f[_0x10aa('0x4')]();}catch(_0x20bcf7){logger['error']('[%s][NOOP]\x20%s',_0x202f65,JSON[_0x10aa('0x5')](_0x20bcf7));_0x305d3f[_0x10aa('0x6')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index b489840..250c88b 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 _0x330e=['catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','message','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','socket.io-emitter','queue_id','account','from','joinAt','clone','queue','push','capitalize','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','chat','AccountId','WebsiteId','info','name','QueueReport','create'];(function(_0x1564a3,_0x4e3d5c){var _0x25fa98=function(_0x4e5125){while(--_0x4e5125){_0x1564a3['push'](_0x1564a3['shift']());}};_0x25fa98(++_0x4e3d5c);}(_0x330e,0x15e));var _0xe330=function(_0x51424a,_0x21ae65){_0x51424a=_0x51424a-0x0;var _0x5748f3=_0x330e[_0x51424a];return _0x5748f3;};'use strict';var schema=require(_0xe330('0x0'));var _=require(_0xe330('0x1'));var util=require('util');var seqqueue=require(_0xe330('0x2'));var moment=require(_0xe330('0x3'));var Redis=require(_0xe330('0x4'));var config=require('../../../../config/environment');var logger=require(_0xe330('0x5'))(_0xe330('0x6'));var strategy=require(_0xe330('0x7'));config[_0xe330('0x8')]=_['defaults'](config[_0xe330('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe330('0x9'))(new Redis(config[_0xe330('0x8')]));var attributes=['id',_0xe330('0xa'),_0xe330('0xb'),'queue',_0xe330('0xc'),_0xe330('0xd')];function emit(_0xb9baa1,_0x11685b,_0x43a46b){io['to'](_0xb9baa1)['emit'](_0x11685b,_0x43a46b);}function emitChannelQueueInteraction(_0x53622f,_0x518eb4,_0x275e5,_0x4d40fe,_0x338e04,_0x370b8c,_0x4acaa6,_0x5d422f){var _0x5b8076=_[_0xe330('0xe')](_0x275e5);_0x5b8076[_0xe330('0xa')]=_0x5d422f;_0x5b8076[_0xe330('0xf')]=_0x518eb4;_0x5b8076[_0xe330('0xb')]=_0x4d40fe;_0x5b8076['id']=_0x338e04;if(_0x370b8c){attributes[_0xe330('0x10')](_[_0xe330('0x11')](_0x53622f)+'InteractionId');_0x4acaa6[util[_0xe330('0x12')]('%sQueuesWaitingInteractions',_0x53622f)][_0x338e04]=_[_0xe330('0x13')](_0x5b8076,attributes);}else{delete _0x4acaa6[util[_0xe330('0x12')](_0xe330('0x14'),_0x53622f)][_0x338e04];}emit(util['format'](_0xe330('0x15'),_0x53622f,_0x518eb4),util['format']('%s_queue_waiting_interaction:%s',_0x53622f,_0x370b8c?_0xe330('0x16'):_0xe330('0x17')),_[_0xe330('0x13')](_0x5b8076,attributes));}var rpc={'openchannelQueueReport':require(_0xe330('0x18')),'mailQueueReport':require(_0xe330('0x19')),'chatQueueReport':require(_0xe330('0x1a')),'smsQueueReport':require(_0xe330('0x1b')),'faxQueueReport':require(_0xe330('0x1c')),'whatsappQueueReport':require(_0xe330('0x1d'))};var queue=schema({'name':{'type':_0xe330('0x1e'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xe330('0x1f'),'message':_0xe330('0x20')}});function startRouting(_0x27b361,_0x54e9fb,_0x157d04,_0x3f4389){if(_0x27b361&&_0x54e9fb&&_0x157d04){_0x54e9fb[_0xe330('0x21')]+=0x1;var _0x42f185={'uniqueid':_0x27b361,'from':_0x157d04[_0xe330('0x22')]?_0x157d04['body']['from']:'','joinAt':moment()[_0xe330('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x157d04[_0xe330('0x23')]?_0x157d04[_0xe330('0x23')]['id']:null,'ListId':_0x157d04[_0xe330('0x24')]?_0x157d04[_0xe330('0x24')]['id']:null};_0x42f185[_[_0xe330('0x25')](_0x157d04['channel'])+_0xe330('0x26')]=_0x54e9fb['id']||null;_0x42f185[_['upperFirst'](_0x157d04[_0xe330('0x27')])+_0xe330('0x28')]=_0x157d04[_0xe330('0x29')]?_0x157d04[_0xe330('0x29')]['id']:null;_0x42f185[_[_0xe330('0x25')](_0x157d04['channel'])+_0xe330('0x2a')]=_0x157d04['message']?_0x157d04['message']['id']:null;_0x42f185[_[_0xe330('0x25')](_0x157d04[_0xe330('0x27')])+(_0x157d04[_0xe330('0x27')]!==_0xe330('0x2b')?_0xe330('0x2c'):_0xe330('0x2d'))]=_0x157d04[_0xe330('0xb')]?_0x157d04[_0xe330('0xb')]['id']:null;logger[_0xe330('0x2e')](util[_0xe330('0x12')]('[%s][START:QUEUE][NAME:%s]',_0x27b361,_0x54e9fb[_0xe330('0x2f')]));emitChannelQueueInteraction(_0x157d04['channel'],_0x54e9fb['name'],_0x42f185,_0x157d04['account'][_0xe330('0x2f')],_0x157d04['message']['id'],!![],_0x3f4389,_0x54e9fb['id']);if(rpc[_0x157d04[_0xe330('0x27')]+_0xe330('0x30')]){return rpc[_0x157d04['channel']+_0xe330('0x30')][_0xe330('0x31')](_0x42f185)[_0xe330('0x32')](function(_0x575381){logger[_0xe330('0x33')]('create\x20queue\x20report');});}}}function stopRouting(_0x41861b,_0x1d85ad,_0x1eb129,_0x688e42){if(_0x41861b&&_0x1d85ad){_0x1d85ad['waiting']-=0x1;var _0xbc9548={'leaveAt':moment()[_0xe330('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0xe330('0x34')),'reason':_0xe330('0x35')};logger[_0xe330('0x2e')](util[_0xe330('0x12')](_0xe330('0x36'),_0x41861b,_0x1d85ad[_0xe330('0x2f')]));emitChannelQueueInteraction(_0x1eb129[_0xe330('0x27')],_0x1d85ad['name'],_0x1eb129[_0xe330('0x22')],_0x1eb129[_0xe330('0xb')]['name'],_0x1eb129[_0xe330('0x37')]['id'],![],_0x688e42,_0x1d85ad['id']);if(rpc[_0x1eb129[_0xe330('0x27')]+_0xe330('0x30')]){return rpc[_0x1eb129[_0xe330('0x27')]+_0xe330('0x30')][_0xe330('0x38')](_0x41861b,_0xbc9548)[_0xe330('0x32')](function(_0x1ce4dd){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x38dfd5,_0xdc0338,_0x5e4f03,_0x40a2cc){if(_0x38dfd5&&_0xdc0338){_0xdc0338[_0xe330('0x21')]-=0x1;var _0x262c17={'leaveAt':moment()['format'](_0xe330('0x34')),'exitAt':moment()[_0xe330('0x12')](_0xe330('0x34')),'reason':_0xe330('0x39')};logger[_0xe330('0x2e')](util[_0xe330('0x12')](_0xe330('0x3a'),_0x38dfd5,_0xdc0338[_0xe330('0x2f')]));emitChannelQueueInteraction(_0x5e4f03[_0xe330('0x27')],_0xdc0338[_0xe330('0x2f')],_0x5e4f03[_0xe330('0x22')],_0x5e4f03[_0xe330('0xb')][_0xe330('0x2f')],_0x5e4f03[_0xe330('0x37')]['id'],![],_0x40a2cc);if(rpc[_0x5e4f03['channel']+_0xe330('0x30')]){return rpc[_0x5e4f03['channel']+_0xe330('0x30')]['update'](_0x38dfd5,_0x262c17)[_0xe330('0x32')](function(_0x2eec1c){logger[_0xe330('0x33')](_0xe330('0x3b'));});}}}function handleFindQueue(_0x16e818){return function(_0x589c80){return _0x589c80['name'][_0xe330('0x3c')]()===_0x16e818[_0xe330('0x3c')]();};}exports[_0xe330('0x3d')]=function(_0x291b41,_0x5c71c3,_0x12e5a7,_0x275e0){return function(_0x370245){try{var _0x46dde2={'name':_0x5c71c3[0x0],'timeout':_0x5c71c3[0x1]};var _0x1fe80f=queue['validate'](_0x46dde2,{'typecast':!![]});if(_0x1fe80f['length']){logger['error'](_0xe330('0x3e'),_0x291b41,_[_0xe330('0x3f')](_0x1fe80f,_0xe330('0x37'))[_0xe330('0x40')](',\x20'));_0x370245[_0xe330('0x41')]();}else{var _0x3bb15d=_[_0xe330('0x42')](_0x12e5a7[_0x275e0[_0xe330('0x27')]+_0xe330('0x43')],handleFindQueue(_0x46dde2['name']));if(_0x3bb15d){startRouting(_0x291b41,_0x3bb15d,_0x275e0,_0x12e5a7);var _0x2879c9=(_0x3bb15d[_0xe330('0x39')]||0xa)*0x3e8;var _0x4dcdc1=(_0x46dde2['timeout']||0x14)*0x3e8;var _0x5dae4a;if(_0x2879c9>_0x4dcdc1){_0x4dcdc1=_0x2879c9;}var _0x4b0534=seqqueue['createQueue'](_0x2879c9);_0x4b0534['id']=_0x291b41;_0x4b0534[_0xe330('0x44')]=_0x2879c9;_0x4b0534['qtimeout']=_0x4dcdc1;_0x4b0534[_0xe330('0x27')]=_0x275e0['channel'];_0x12e5a7[_0xe330('0x45')][_0x291b41]['on'](_0xe330('0x46'),function(){logger[_0xe330('0x2e')](_0xe330('0x47'),_0x291b41);stopRouting(_0x291b41,_0x3bb15d,_0x275e0,_0x12e5a7);clearTimeout(_0x5dae4a);_0x5dae4a=undefined;_0x4b0534['close'](!![]);if(_0x12e5a7[_0xe330('0x45')][_0x291b41]){delete _0x12e5a7[_0xe330('0x45')][_0x291b41];}_0x370245['stop']();});_0x12e5a7[_0xe330('0x45')][_0x291b41]['on'](_0xe330('0x48'),function(){if(_0x12e5a7[_0xe330('0x45')][_0x291b41]){delete _0x12e5a7[_0xe330('0x45')][_0x291b41];}});_0x5dae4a=setTimeout(function(){logger[_0xe330('0x2e')](_0xe330('0x49'),_0x291b41);endRouting(_0x291b41,_0x3bb15d,_0x275e0,_0x12e5a7);clearTimeout(_0x5dae4a);_0x4b0534[_0xe330('0x4a')](!![]);_0x370245[_0xe330('0x4b')]();},_0x4dcdc1);switch(_0x3bb15d[_0xe330('0x4c')]){case _0xe330('0x4d'):strategy['rrmemory'](_0x4b0534,_0x3bb15d,_0x12e5a7,_0x275e0);break;default:strategy['beepall'](_0x4b0534,_0x3bb15d,_0x12e5a7,_0x275e0);}}else{logger[_0xe330('0x33')](_0xe330('0x4e'),_0x291b41,_0x46dde2['name']);_0x370245['stop']();}}}catch(_0x8a12b6){console[_0xe330('0x4f')](_0x8a12b6);logger[_0xe330('0x33')](_0xe330('0x3e'),_0x291b41,_0x8a12b6['stack']);_0x370245['stop']();}};}; \ No newline at end of file +var _0x1d61=['rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','queue','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close'];(function(_0x24eb8c,_0x14be03){var _0xc895b1=function(_0xf60f78){while(--_0xf60f78){_0x24eb8c['push'](_0x24eb8c['shift']());}};_0xc895b1(++_0x14be03);}(_0x1d61,0xad));var _0x11d6=function(_0x279741,_0x18728c){_0x279741=_0x279741-0x0;var _0xb55ec4=_0x1d61[_0x279741];return _0xb55ec4;};'use strict';var schema=require(_0x11d6('0x0'));var _=require(_0x11d6('0x1'));var util=require(_0x11d6('0x2'));var seqqueue=require(_0x11d6('0x3'));var moment=require(_0x11d6('0x4'));var Redis=require(_0x11d6('0x5'));var config=require(_0x11d6('0x6'));var logger=require(_0x11d6('0x7'))(_0x11d6('0x8'));var strategy=require(_0x11d6('0x9'));config[_0x11d6('0xa')]=_['defaults'](config[_0x11d6('0xa')],{'host':_0x11d6('0xb'),'port':0x18eb});var io=require(_0x11d6('0xc'))(new Redis(config['redis']));var attributes=['id',_0x11d6('0xd'),_0x11d6('0xe'),'queue',_0x11d6('0xf'),_0x11d6('0x10')];function emit(_0xfb31cf,_0x35102d,_0x2a04f2){io['to'](_0xfb31cf)[_0x11d6('0x11')](_0x35102d,_0x2a04f2);}function emitChannelQueueInteraction(_0x52fc71,_0x4e31a7,_0x4aeec3,_0xf4a6ea,_0x4b52d8,_0x227652,_0x38677a,_0x4ad5d6){var _0x107b36=_['clone'](_0x4aeec3);_0x107b36[_0x11d6('0xd')]=_0x4ad5d6;_0x107b36[_0x11d6('0x12')]=_0x4e31a7;_0x107b36[_0x11d6('0xe')]=_0xf4a6ea;_0x107b36['id']=_0x4b52d8;if(_0x227652){attributes['push'](_[_0x11d6('0x13')](_0x52fc71)+_0x11d6('0x14'));_0x38677a[util[_0x11d6('0x15')](_0x11d6('0x16'),_0x52fc71)][_0x4b52d8]=_[_0x11d6('0x17')](_0x107b36,attributes);}else{delete _0x38677a[util[_0x11d6('0x15')](_0x11d6('0x16'),_0x52fc71)][_0x4b52d8];}emit(util[_0x11d6('0x15')](_0x11d6('0x18'),_0x52fc71,_0x4e31a7),util[_0x11d6('0x15')](_0x11d6('0x19'),_0x52fc71,_0x227652?_0x11d6('0x1a'):_0x11d6('0x1b')),_[_0x11d6('0x17')](_0x107b36,attributes));}var rpc={'openchannelQueueReport':require(_0x11d6('0x1c')),'mailQueueReport':require(_0x11d6('0x1d')),'chatQueueReport':require(_0x11d6('0x1e')),'smsQueueReport':require(_0x11d6('0x1f')),'faxQueueReport':require(_0x11d6('0x20')),'whatsappQueueReport':require(_0x11d6('0x21'))};var queue=schema({'name':{'type':_0x11d6('0x22'),'required':!![],'message':_0x11d6('0x23')},'timeout':{'type':_0x11d6('0x24'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xe07e66,_0x2ffa7d,_0x2e1b2a,_0x34a181){if(_0xe07e66&&_0x2ffa7d&&_0x2e1b2a){_0x2ffa7d[_0x11d6('0x25')]+=0x1;var _0x4592cf={'uniqueid':_0xe07e66,'from':_0x2e1b2a[_0x11d6('0x26')]?_0x2e1b2a[_0x11d6('0x26')]['from']:'','joinAt':moment()[_0x11d6('0x15')](_0x11d6('0x27')),'ContactId':_0x2e1b2a[_0x11d6('0x28')]?_0x2e1b2a[_0x11d6('0x28')]['id']:null,'ListId':_0x2e1b2a[_0x11d6('0x29')]?_0x2e1b2a[_0x11d6('0x29')]['id']:null};_0x4592cf[_['upperFirst'](_0x2e1b2a[_0x11d6('0x2a')])+_0x11d6('0x2b')]=_0x2ffa7d['id']||null;_0x4592cf[_[_0x11d6('0x2c')](_0x2e1b2a[_0x11d6('0x2a')])+_0x11d6('0x14')]=_0x2e1b2a['interaction']?_0x2e1b2a[_0x11d6('0x2d')]['id']:null;_0x4592cf[_[_0x11d6('0x2c')](_0x2e1b2a[_0x11d6('0x2a')])+_0x11d6('0x2e')]=_0x2e1b2a[_0x11d6('0x2f')]?_0x2e1b2a['message']['id']:null;_0x4592cf[_[_0x11d6('0x2c')](_0x2e1b2a[_0x11d6('0x2a')])+(_0x2e1b2a[_0x11d6('0x2a')]!=='chat'?_0x11d6('0x30'):_0x11d6('0x31'))]=_0x2e1b2a['account']?_0x2e1b2a[_0x11d6('0xe')]['id']:null;logger[_0x11d6('0x32')](util[_0x11d6('0x15')](_0x11d6('0x33'),_0xe07e66,_0x2ffa7d[_0x11d6('0x34')]));emitChannelQueueInteraction(_0x2e1b2a['channel'],_0x2ffa7d[_0x11d6('0x34')],_0x4592cf,_0x2e1b2a['account'][_0x11d6('0x34')],_0x2e1b2a[_0x11d6('0x2f')]['id'],!![],_0x34a181,_0x2ffa7d['id']);if(rpc[_0x2e1b2a[_0x11d6('0x2a')]+'QueueReport']){return rpc[_0x2e1b2a[_0x11d6('0x2a')]+_0x11d6('0x35')][_0x11d6('0x36')](_0x4592cf)[_0x11d6('0x37')](function(_0x24b758){logger[_0x11d6('0x38')]('create\x20queue\x20report');});}}}function stopRouting(_0x59cbfa,_0x4c4db4,_0x34f819,_0x58ad60){if(_0x59cbfa&&_0x4c4db4){_0x4c4db4[_0x11d6('0x25')]-=0x1;var _0x5bf179={'leaveAt':moment()['format'](_0x11d6('0x27')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x11d6('0x39')};logger['info'](util[_0x11d6('0x15')](_0x11d6('0x3a'),_0x59cbfa,_0x4c4db4['name']));emitChannelQueueInteraction(_0x34f819[_0x11d6('0x2a')],_0x4c4db4[_0x11d6('0x34')],_0x34f819[_0x11d6('0x26')],_0x34f819[_0x11d6('0xe')]['name'],_0x34f819[_0x11d6('0x2f')]['id'],![],_0x58ad60,_0x4c4db4['id']);if(rpc[_0x34f819['channel']+_0x11d6('0x35')]){return rpc[_0x34f819[_0x11d6('0x2a')]+'QueueReport']['update'](_0x59cbfa,_0x5bf179)['catch'](function(_0x1a4a7e){logger[_0x11d6('0x38')](_0x11d6('0x3b'));});}}}function endRouting(_0x1cb4f6,_0x37f998,_0x4a8ae8,_0x2239ba){if(_0x1cb4f6&&_0x37f998){_0x37f998['waiting']-=0x1;var _0x32cb92={'leaveAt':moment()[_0x11d6('0x15')](_0x11d6('0x27')),'exitAt':moment()[_0x11d6('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x11d6('0x3c')};logger[_0x11d6('0x32')](util[_0x11d6('0x15')](_0x11d6('0x3d'),_0x1cb4f6,_0x37f998['name']));emitChannelQueueInteraction(_0x4a8ae8[_0x11d6('0x2a')],_0x37f998['name'],_0x4a8ae8[_0x11d6('0x26')],_0x4a8ae8['account'][_0x11d6('0x34')],_0x4a8ae8[_0x11d6('0x2f')]['id'],![],_0x2239ba);if(rpc[_0x4a8ae8[_0x11d6('0x2a')]+_0x11d6('0x35')]){return rpc[_0x4a8ae8[_0x11d6('0x2a')]+_0x11d6('0x35')][_0x11d6('0x3e')](_0x1cb4f6,_0x32cb92)['catch'](function(_0x5108e1){logger[_0x11d6('0x38')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x4d932e){return function(_0x405abc){return _0x405abc[_0x11d6('0x34')][_0x11d6('0x3f')]()===_0x4d932e[_0x11d6('0x3f')]();};}exports[_0x11d6('0x40')]=function(_0xba1531,_0x37a93,_0xc942d4,_0x1e3112){return function(_0x5a5647){try{var _0x338615={'name':_0x37a93[0x0],'timeout':_0x37a93[0x1]};var _0x2fc63f=queue['validate'](_0x338615,{'typecast':!![]});if(_0x2fc63f['length']){logger[_0x11d6('0x38')](_0x11d6('0x41'),_0xba1531,_['map'](_0x2fc63f,_0x11d6('0x2f'))[_0x11d6('0x42')](',\x20'));_0x5a5647[_0x11d6('0x43')]();}else{var _0x210a37=_[_0x11d6('0x44')](_0xc942d4[_0x1e3112[_0x11d6('0x2a')]+_0x11d6('0x45')],handleFindQueue(_0x338615['name']));if(_0x210a37){startRouting(_0xba1531,_0x210a37,_0x1e3112,_0xc942d4);var _0xc55540=(_0x210a37[_0x11d6('0x3c')]||0xa)*0x3e8;var _0x4889aa=(_0x338615[_0x11d6('0x3c')]||0x14)*0x3e8;var _0x1cf826;if(_0xc55540>_0x4889aa){_0x4889aa=_0xc55540;}var _0x1a380d=seqqueue[_0x11d6('0x46')](_0xc55540);_0x1a380d['id']=_0xba1531;_0x1a380d[_0x11d6('0x47')]=_0xc55540;_0x1a380d[_0x11d6('0x48')]=_0x4889aa;_0x1a380d['channel']=_0x1e3112[_0x11d6('0x2a')];_0xc942d4['rules'][_0xba1531]['on'](_0x11d6('0x49'),function(){logger[_0x11d6('0x32')](_0x11d6('0x4a'),_0xba1531);stopRouting(_0xba1531,_0x210a37,_0x1e3112,_0xc942d4);clearTimeout(_0x1cf826);_0x1cf826=undefined;_0x1a380d[_0x11d6('0x4b')](!![]);if(_0xc942d4[_0x11d6('0x4c')][_0xba1531]){delete _0xc942d4[_0x11d6('0x4c')][_0xba1531];}_0x5a5647[_0x11d6('0x43')]();});_0xc942d4['rules'][_0xba1531]['on'](_0x11d6('0x4d'),function(){if(_0xc942d4[_0x11d6('0x4c')][_0xba1531]){delete _0xc942d4[_0x11d6('0x4c')][_0xba1531];}});_0x1cf826=setTimeout(function(){logger[_0x11d6('0x32')](_0x11d6('0x4e'),_0xba1531);endRouting(_0xba1531,_0x210a37,_0x1e3112,_0xc942d4);clearTimeout(_0x1cf826);_0x1a380d[_0x11d6('0x4b')](!![]);_0x5a5647['next']();},_0x4889aa);switch(_0x210a37['strategy']){case'rrmemory':strategy[_0x11d6('0x4f')](_0x1a380d,_0x210a37,_0xc942d4,_0x1e3112);break;default:strategy[_0x11d6('0x50')](_0x1a380d,_0x210a37,_0xc942d4,_0x1e3112);}}else{logger[_0x11d6('0x38')](_0x11d6('0x51'),_0xba1531,_0x338615['name']);_0x5a5647['stop']();}}}catch(_0x1e90ab){console[_0x11d6('0x52')](_0x1e90ab);logger[_0x11d6('0x38')](_0x11d6('0x41'),_0xba1531,_0x1e90ab['stack']);_0x5a5647[_0x11d6('0x43')]();}};}; \ 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 c69f44a..545e11b 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 _0xd67b=['handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push'];(function(_0x2cf65e,_0x24b694){var _0x5d76ff=function(_0x129112){while(--_0x129112){_0x2cf65e['push'](_0x2cf65e['shift']());}};_0x5d76ff(++_0x24b694);}(_0xd67b,0x133));var _0xbd67=function(_0x2a77b4,_0x33578d){_0x2a77b4=_0x2a77b4-0x0;var _0x386fb4=_0xd67b[_0x2a77b4];return _0x386fb4;};'use strict';var _=require('lodash');var uuid=require(_0xbd67('0x0'));var util=require('./util');var logger=require(_0xbd67('0x1'))(_0xbd67('0x2'));var Agent=function(_0x317e33,_0x5e967b,_0x40e384,_0x50da5a){this[_0xbd67('0x3')]=uuid['v4']();this['squeue']=_0x317e33;this[_0xbd67('0x4')]=_0x5e967b;this[_0xbd67('0x5')]=_0x40e384;this[_0xbd67('0x2')]=_0x50da5a;this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this[_0xbd67('0x6')]['on'](_0xbd67('0xb'),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this['squeue']['on']('drained',this[_0xbd67('0xc')]['bind'](this));};Agent[_0xbd67('0xd')][_0xbd67('0x7')]=function(){this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));};Agent[_0xbd67('0xd')][_0xbd67('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xbd67('0xd')][_0xbd67('0x8')]=function(){logger[_0xbd67('0xe')](_0xbd67('0xf'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this[_0xbd67('0x7')]['bind'](this),0x3e8);}else{if(this[_0xbd67('0x2')][_0xbd67('0x12')]||util[_0xbd67('0x13')](this['squeue']['id'],this[_0xbd67('0x5')]['agents'][this[_0xbd67('0x4')]['id']],this[_0xbd67('0x6')][_0xbd67('0x14')],![])){this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=!![];this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']]['busyQueue']=undefined;util[_0xbd67('0x16')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this[_0xbd67('0x6')][_0xbd67('0x14')]);util[_0xbd67('0x17')](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this[_0xbd67('0x2')]);util['writeLog'](this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],_0xbd67('0x18')+(this[_0xbd67('0x2')]['forcedOwnership']?_0xbd67('0x19'):''));}else{logger[_0xbd67('0xe')](_0xbd67('0x1a'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xbd67('0xd')][_0xbd67('0xa')]=function(_0x4675ac){if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){return logger[_0xbd67('0xe')](_0xbd67('0x1b'),this[_0xbd67('0x6')]['id'],this['agent']['id']);}else{logger['debug'](_0xbd67('0x1c'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);util['hideNotification'](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this['routing']);this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=![];this['realtime']['agents'][this[_0xbd67('0x4')]['id']][_0xbd67('0x1d')]=undefined;util[_0xbd67('0x1e')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this['squeue'][_0xbd67('0x14')]);util[_0xbd67('0x1f')](this[_0xbd67('0x6')]['id'],this['realtime'][_0xbd67('0x11')][this['agent']['id']],_0x4675ac?_0xbd67('0x20'):_0xbd67('0x21'));}if(!_0x4675ac){setTimeout(this['push'][_0xbd67('0x9')](this),0x3e8);}};function agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777){return new Agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777);}module[_0xbd67('0x22')]=agent; \ No newline at end of file +var _0x29d4=['routing','notificationId','squeue','agent','realtime','push','bind','timeout','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger'];(function(_0x2b02e7,_0x5594c6){var _0x227043=function(_0x52720e){while(--_0x52720e){_0x2b02e7['push'](_0x2b02e7['shift']());}};_0x227043(++_0x5594c6);}(_0x29d4,0x1a1));var _0x429d=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x29d4[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x429d('0x0'));var uuid=require('uuid');var util=require(_0x429d('0x1'));var logger=require(_0x429d('0x2'))(_0x429d('0x3'));var Agent=function(_0x472fc9,_0x45df1c,_0x4e287b,_0xc3989d){this[_0x429d('0x4')]=uuid['v4']();this[_0x429d('0x5')]=_0x472fc9;this[_0x429d('0x6')]=_0x45df1c;this[_0x429d('0x7')]=_0x4e287b;this[_0x429d('0x3')]=_0xc3989d;this[_0x429d('0x5')][_0x429d('0x8')](this['handleRun'][_0x429d('0x9')](this),this['handleTimeout'][_0x429d('0x9')](this));this[_0x429d('0x5')]['on'](_0x429d('0xa'),this['handleTimeout'][_0x429d('0x9')](this));this[_0x429d('0x5')]['on']('drained',this[_0x429d('0xb')][_0x429d('0x9')](this));};Agent[_0x429d('0xc')]['push']=function(){this[_0x429d('0x5')][_0x429d('0x8')](this[_0x429d('0xd')][_0x429d('0x9')](this),this['handleTimeout'][_0x429d('0x9')](this));};Agent[_0x429d('0xc')][_0x429d('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0x429d('0xc')][_0x429d('0xd')]=function(){logger['debug'](_0x429d('0xe'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);if(_[_0x429d('0xf')](this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']])){logger[_0x429d('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}else{if(this['routing'][_0x429d('0x12')]||util[_0x429d('0x13')](this[_0x429d('0x5')]['id'],this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']],this[_0x429d('0x5')][_0x429d('0x14')],![])){this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']][_0x429d('0x15')]=!![];this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']][_0x429d('0x16')]=undefined;util[_0x429d('0x17')](this[_0x429d('0x7')],this[_0x429d('0x3')],this[_0x429d('0x6')],this[_0x429d('0x5')]['channel']);util[_0x429d('0x18')](this[_0x429d('0x4')],this['squeue']['id'],this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']],null,this[_0x429d('0x3')]);util['writeLog'](this[_0x429d('0x5')]['id'],this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']],_0x429d('0x19')+(this['routing'][_0x429d('0x12')]?_0x429d('0x1a'):''));}else{logger[_0x429d('0x11')](_0x429d('0x1b'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}}};Agent[_0x429d('0xc')]['handleTimeout']=function(_0x31cae6){if(_[_0x429d('0xf')](this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']])){return logger[_0x429d('0x11')](_0x429d('0x1c'),this[_0x429d('0x5')]['id'],this['agent']['id']);}else{logger[_0x429d('0x11')](_0x429d('0x1d'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);util[_0x429d('0x1e')](this[_0x429d('0x4')],this['squeue']['id'],this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']],null,this['routing']);this['realtime'][_0x429d('0x10')][this['agent']['id']][_0x429d('0x15')]=![];this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']]['busyQueue']=undefined;util[_0x429d('0x1f')](this[_0x429d('0x7')],this['routing'],this['agent'],this['squeue']['channel']);util['writeLog'](this[_0x429d('0x5')]['id'],this['realtime']['agents'][this[_0x429d('0x6')]['id']],_0x31cae6?_0x429d('0x20'):_0x429d('0x21'));}if(!_0x31cae6){setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}};function agent(_0x1a5d80,_0x4b23ab,_0x423dc8,_0x2c5fa5){return new Agent(_0x1a5d80,_0x4b23ab,_0x423dc8,_0x2c5fa5);}module[_0x429d('0x22')]=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 510ef9a..432b38d 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 _0x046f=['prototype','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','removeWaitingNotification','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','routing','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained'];(function(_0x204af0,_0x5aee56){var _0x4a0d63=function(_0x61183b){while(--_0x61183b){_0x204af0['push'](_0x204af0['shift']());}};_0x4a0d63(++_0x5aee56);}(_0x046f,0x102));var _0xf046=function(_0x16e8aa,_0xc049e9){_0x16e8aa=_0x16e8aa-0x0;var _0x3bd93f=_0x046f[_0x16e8aa];return _0x3bd93f;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xf046('0x0'));var logger=require(_0xf046('0x1'))('routing');var Beepall=function(_0x2b2390,_0x4dfd79,_0x14a363,_0x1ace31){this[_0xf046('0x2')]=uuid['v4']();this[_0xf046('0x3')]=_0x2b2390;this[_0xf046('0x4')]=_0x4dfd79;this[_0xf046('0x5')]=_0x14a363;this[_0xf046('0x6')]=_0x1ace31;this['squeue'][_0xf046('0x7')](this[_0xf046('0x8')]['bind'](this),this[_0xf046('0x9')][_0xf046('0xa')](this));this['squeue']['on'](_0xf046('0xb'),this[_0xf046('0x9')]['bind'](this));this[_0xf046('0x3')]['on'](_0xf046('0xc'),this[_0xf046('0xd')][_0xf046('0xa')](this));};Beepall[_0xf046('0xe')][_0xf046('0x7')]=function(){this[_0xf046('0x3')]['push'](this[_0xf046('0x8')][_0xf046('0xa')](this),this[_0xf046('0x9')][_0xf046('0xa')](this));};Beepall[_0xf046('0xe')][_0xf046('0xd')]=function(){this[_0xf046('0x9')](!![]);};Beepall[_0xf046('0xe')]['handleRun']=function(){var _0x5dfcc9=!![];if(!_['isNil'](this[_0xf046('0x4')])&&!_['isNil'](this[_0xf046('0x4')][_0xf046('0xf')])&&this[_0xf046('0x4')][_0xf046('0xf')][_0xf046('0x10')]>0x0){for(var _0x3b40c9=0x0,_0x8700b;_0x3b40c90x0){for(var _0x2269dd=0x0,_0x1139bd;_0x2269dd0x0&&_0x2a9fd6[_0x4dde89+'CurrentCapacity']>=_0x2a9fd6[_0x4dde89+_0xa8b5('0x20')]){writeLog(_0x2ae048,_0x2a9fd6,_0x4dde89[_0xa8b5('0x22')]()+_0xa8b5('0x23'));return![];}}return!![];};exports[_0xa8b5('0x24')]=function(_0x131577,_0x2e95ae,_0x40743f,_0x61abc1,_0x34f256){return sendNotification(!![],_0x131577,_0x2e95ae,_0x40743f,_0x61abc1,_0x34f256);};exports['hideNotification']=function(_0xeb0cdd,_0x4e7d11,_0xcb5810,_0x3e5de3,_0x444c3a){return sendNotification(![],_0xeb0cdd,_0x4e7d11,_0xcb5810,_0x3e5de3,_0x444c3a);};exports[_0xa8b5('0x25')]=function(_0x78c2a5,_0x2a83e2,_0x2eff18){var _0x2043ae=_0x2a83e2[_0xa8b5('0x26')][_0xa8b5('0x27')];if(!_0x2043ae&&_0x2eff18){_0x2043ae=_0x2eff18['id'];}var _0x2da242=_[_0xa8b5('0x28')](_0x78c2a5[_0x2a83e2[_0xa8b5('0x29')]+_0xa8b5('0x2a')],function(_0x574736){var _0x36dac9=_[_0xa8b5('0x2b')](_0x2a83e2[_0xa8b5('0x29')])+_0xa8b5('0x2c');return _0x574736[_0x36dac9]===_0x2a83e2[_0xa8b5('0x26')]['id'];});if(!_0x2da242&&_0x2043ae){_0x2da242=_[_0xa8b5('0x28')](_0x78c2a5[_0xa8b5('0x2d')][_0x2043ae][_0x2a83e2[_0xa8b5('0x29')]+_0xa8b5('0x2e')],function(_0x4f1ffc){return _0x4f1ffc['id']===_0x2a83e2['interaction']['id'];});}return _0x2da242;};exports[_0xa8b5('0x2f')]=function(_0x25100c,_0x645281,_0x27f474,_0x5f2709){_0x25100c['agents'][_0x27f474['id']][_0x5f2709+_0xa8b5('0x2e')][_0x645281[_0xa8b5('0x16')]['id']]={'id':_0x645281[_0xa8b5('0x26')]['id']};};exports[_0xa8b5('0x30')]=function(_0x20e6e6,_0x520734,_0x30aff0,_0xaeebb){delete _0x20e6e6[_0xa8b5('0x2d')][_0x30aff0['id']][_0xaeebb+_0xa8b5('0x2e')][_0x520734[_0xa8b5('0x16')]['id']];};exports[_0xa8b5('0x31')]=writeLog; \ No newline at end of file +var _0x9ab5=['split','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','UserId','some','channel','QueuesWaitingInteractions','capitalize','interaction','agents','saveWaitingNotification','WaitingInteractions','removeWaitingNotification','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','socket.io-emitter','format','emit'];(function(_0x343502,_0x45326f){var _0x1b38b9=function(_0x472a17){while(--_0x472a17){_0x343502['push'](_0x343502['shift']());}};_0x1b38b9(++_0x45326f);}(_0x9ab5,0xf0));var _0x59ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9ab5[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x59ab('0x0'));var util=require('util');var utils=require(_0x59ab('0x1'));var Redis=require(_0x59ab('0x2'));var config=require(_0x59ab('0x3'));var logger=require(_0x59ab('0x4'))(_0x59ab('0x5'));config['redis']=_['defaults'](config[_0x59ab('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x59ab('0x7'))(new Redis(config[_0x59ab('0x6')]));function sendNotification(_0x560ae6,_0x278789,_0x612be6,_0x33d33f,_0x4f1fd3,_0x52f9da){io['to'](util[_0x59ab('0x8')]('user:%s',_0x33d33f['name']))[_0x59ab('0x9')]('user:save',_0x33d33f);var _0x184d81=_0x52f9da||{};var _0xa61145=_0x612be6[_0x59ab('0xa')]('.');var _0x24c823={'uniqueid':_0x278789,'channel':_0xa61145[0x0],'id':_0xa61145[0x1],'title':_0xa61145[0x0]+'\x20interaction','interactionId':_0xa61145[0x2],'queue':_0x4f1fd3?_0x4f1fd3[_0x59ab('0xb')]:null,'sound':_0x184d81[_0x59ab('0xc')][_0x59ab('0xd')],'shake':_0x184d81[_0x59ab('0xc')][_0x59ab('0xe')]};try{if(!_0x184d81['body']){_0x184d81['body']={};}if(_0x4f1fd3){_0x184d81[_0x59ab('0xf')]['queue']=_0x4f1fd3;}else if(_0x184d81[_0x59ab('0xf')][_0x59ab('0x10')]){delete _0x184d81[_0x59ab('0xf')][_0x59ab('0x10')];}_0x24c823[_0x59ab('0x11')]=utils[_0x59ab('0x12')](_0x184d81[_0x59ab('0xc')][_0x59ab('0x13')],_0x184d81);}catch(_0x3aef5b){_0x24c823[_0x59ab('0x11')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x59ab('0x14')](util[_0x59ab('0x8')](_0x59ab('0x15'),_0x278789,_0x3aef5b[_0x59ab('0x16')]));}io['to'](util[_0x59ab('0x8')]('user:%s',_0x33d33f[_0x59ab('0xb')]))[_0x59ab('0x9')](util['format'](_0x59ab('0x17'),_0x560ae6?_0x59ab('0x18'):_0x59ab('0x19')),_0x24c823);}function writeLog(_0x535749,_0x4d294c,_0x153f2e){return logger[_0x59ab('0x1a')](util['format'](_0x59ab('0x1b'),_0x535749,_0x4d294c[_0x59ab('0xb')],_0x153f2e));}exports[_0x59ab('0x1c')]=function(_0x59fa54,_0x1e6d23,_0x18270e,_0x3dc2dd){if(_0x1e6d23[_0x59ab('0x1d')]){writeLog(_0x59fa54,_0x1e6d23,'BUSY');return![];}if(!_0x1e6d23[_0x59ab('0x1e')]){writeLog(_0x59fa54,_0x1e6d23,'OFFLINE');return![];}if(_0x1e6d23[_0x18270e+_0x59ab('0x1f')]){writeLog(_0x59fa54,_0x1e6d23,_0x59ab('0x20'));return![];}if(_0x3dc2dd&&_0x1e6d23[_0x59ab('0x21')](_0x18270e+_0x59ab('0x22'))&&_0x1e6d23['hasOwnProperty'](_0x18270e+_0x59ab('0x23'))){if(_0x1e6d23[_0x18270e+_0x59ab('0x22')]>0x0&&_0x1e6d23[_0x18270e+_0x59ab('0x23')]>=_0x1e6d23[_0x18270e+_0x59ab('0x22')]){writeLog(_0x59fa54,_0x1e6d23,_0x18270e[_0x59ab('0x24')]()+_0x59ab('0x25'));return![];}}return!![];};exports[_0x59ab('0x26')]=function(_0x4ccb51,_0xb2e8db,_0x36c55f,_0x59cf30,_0x369983){return sendNotification(!![],_0x4ccb51,_0xb2e8db,_0x36c55f,_0x59cf30,_0x369983);};exports['hideNotification']=function(_0x3aaaab,_0x153716,_0x248582,_0x1b78c4,_0x4a3ae5){return sendNotification(![],_0x3aaaab,_0x153716,_0x248582,_0x1b78c4,_0x4a3ae5);};exports[_0x59ab('0x27')]=function(_0x577858,_0x598465,_0x208ca8){var _0x3cae16=_0x598465['interaction'][_0x59ab('0x28')];if(!_0x3cae16&&_0x208ca8){_0x3cae16=_0x208ca8['id'];}var _0xd531f6=_[_0x59ab('0x29')](_0x577858[_0x598465[_0x59ab('0x2a')]+_0x59ab('0x2b')],function(_0x1ed88f){var _0x5b9059=_[_0x59ab('0x2c')](_0x598465[_0x59ab('0x2a')])+'InteractionId';return _0x1ed88f[_0x5b9059]===_0x598465[_0x59ab('0x2d')]['id'];});if(!_0xd531f6&&_0x3cae16){_0xd531f6=_[_0x59ab('0x29')](_0x577858[_0x59ab('0x2e')][_0x3cae16][_0x598465['channel']+'WaitingInteractions'],function(_0x35ebd0){return _0x35ebd0['id']===_0x598465[_0x59ab('0x2d')]['id'];});}return _0xd531f6;};exports[_0x59ab('0x2f')]=function(_0xe8e269,_0x37d282,_0x42e8fc,_0x569f77){_0xe8e269[_0x59ab('0x2e')][_0x42e8fc['id']][_0x569f77+_0x59ab('0x30')][_0x37d282[_0x59ab('0x16')]['id']]={'id':_0x37d282['interaction']['id']};};exports[_0x59ab('0x31')]=function(_0x11794a,_0x2083bc,_0x2e36f9,_0x54ae5d){delete _0x11794a[_0x59ab('0x2e')][_0x2e36f9['id']][_0x54ae5d+_0x59ab('0x30')][_0x2083bc[_0x59ab('0x16')]['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 972b50b..a8c368b 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 _0x8bea=['message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','validate','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][SYSTEM]\x20%s','map'];(function(_0x56906a,_0x1f68ad){var _0x3d9358=function(_0x42162e){while(--_0x42162e){_0x56906a['push'](_0x56906a['shift']());}};_0x3d9358(++_0x1f68ad);}(_0x8bea,0x116));var _0xa8be=function(_0x2627df,_0x3887e9){_0x2627df=_0x2627df-0x0;var _0x388825=_0x8bea[_0x2627df];return _0x388825;};'use strict';var schema=require(_0xa8be('0x0'));var sh=require('shelljs');var _=require(_0xa8be('0x1'));var utils=require(_0xa8be('0x2'));var logger=require('../../../../config/logger')(_0xa8be('0x3'));var system=schema({'command':{'type':_0xa8be('0x4'),'required':!![],'message':_0xa8be('0x5')}});exports['consequence']=function(_0x557c2f,_0x1cf3d3){return function(_0xdac608){try{var _0x3d6800={'command':_0x1cf3d3[0x0]};var _0x25dc1b=system[_0xa8be('0x0')](_0x3d6800,{'typecast':!![]});if(_0x25dc1b['length']){logger['error'](_0xa8be('0x6'),_0x557c2f,_[_0xa8be('0x7')](_0x25dc1b,_0xa8be('0x8'))[_0xa8be('0x9')](',\x20'));logger[_0xa8be('0xa')](_0xa8be('0xb'),_0x557c2f);_0xdac608[_0xa8be('0xc')]();}else{var _0x5ec25f=this;var _0x1fe10e=utils[_0xa8be('0xd')](_0x1cf3d3[0x0],this);logger[_0xa8be('0xa')](_0xa8be('0xe'),_0x557c2f,_0x1fe10e);sh[_0xa8be('0xf')](_[_0xa8be('0x10')](_0x1fe10e),function(_0x5a24ba,_0x105f84){logger[_0xa8be('0xa')](_0xa8be('0x11'),_0x557c2f,_0x5a24ba);if(_0x5a24ba==0x0){var _0x4b97da=_0x105f84[_0xa8be('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xa8be('0x13')](_0x1cf3d3[0x1])||_[_0xa8be('0x14')](_0x1cf3d3[0x1])){logger[_0xa8be('0xa')](_0xa8be('0x15'),_0x557c2f);_0x5ec25f[_0xa8be('0x16')][_0x1cf3d3[0x1]]=_0x4b97da;}else{logger[_0xa8be('0xa')](_0xa8be('0x17'),_0x557c2f,_0x1cf3d3[0x1],_0x4b97da);_0x5ec25f[_0xa8be('0x16')][_0x1cf3d3[0x1]]=_0x4b97da;}}_0xdac608[_0xa8be('0xc')]();});}}catch(_0x10fafe){logger[_0xa8be('0x18')](_0xa8be('0x6'),_0x557c2f,_[_0xa8be('0x19')](_0x10fafe)?JSON['stringify'](_0x10fafe):_0x10fafe);logger['info'](_0xa8be('0xb'),_0x557c2f);_0xdac608[_0xa8be('0xc')]();}};}; \ No newline at end of file +var _0x0748=['shelljs','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','validate'];(function(_0x24d223,_0x3a063d){var _0x4356ff=function(_0x4c78c0){while(--_0x4c78c0){_0x24d223['push'](_0x24d223['shift']());}};_0x4356ff(++_0x3a063d);}(_0x0748,0xc7));var _0x8074=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0x0748[_0x26b8b5];return _0x2150a9;};'use strict';var schema=require(_0x8074('0x0'));var sh=require(_0x8074('0x1'));var _=require('lodash');var utils=require(_0x8074('0x2'));var logger=require(_0x8074('0x3'))(_0x8074('0x4'));var system=schema({'command':{'type':_0x8074('0x5'),'required':!![],'message':_0x8074('0x6')}});exports['consequence']=function(_0xc8705a,_0xf139bd){return function(_0x36e601){try{var _0x52985e={'command':_0xf139bd[0x0]};var _0x31cb6f=system[_0x8074('0x0')](_0x52985e,{'typecast':!![]});if(_0x31cb6f['length']){logger[_0x8074('0x7')]('[%s][SYSTEM]\x20%s',_0xc8705a,_['map'](_0x31cb6f,_0x8074('0x8'))[_0x8074('0x9')](',\x20'));logger[_0x8074('0xa')](_0x8074('0xb'),_0xc8705a);_0x36e601[_0x8074('0xc')]();}else{var _0x3861fd=this;var _0x5d28d0=utils[_0x8074('0xd')](_0xf139bd[0x0],this);logger[_0x8074('0xa')](_0x8074('0xe'),_0xc8705a,_0x5d28d0);sh[_0x8074('0xf')](_[_0x8074('0x10')](_0x5d28d0),function(_0x35b0f1,_0x596136){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0xc8705a,_0x35b0f1);if(_0x35b0f1==0x0){var _0x57d004=_0x596136[_0x8074('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xf139bd[0x1])||_[_0x8074('0x12')](_0xf139bd[0x1])){logger['info'](_0x8074('0x13'),_0xc8705a);_0x3861fd[_0x8074('0x14')][_0xf139bd[0x1]]=_0x57d004;}else{logger[_0x8074('0xa')](_0x8074('0x15'),_0xc8705a,_0xf139bd[0x1],_0x57d004);_0x3861fd['body'][_0xf139bd[0x1]]=_0x57d004;}}_0x36e601[_0x8074('0xc')]();});}}catch(_0x2e99b5){logger[_0x8074('0x7')](_0x8074('0x16'),_0xc8705a,_[_0x8074('0x17')](_0x2e99b5)?JSON[_0x8074('0x18')](_0x2e99b5):_0x2e99b5);logger[_0x8074('0xa')](_0x8074('0xb'),_0xc8705a);_0x36e601[_0x8074('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 0b25219..a706b09 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 _0x8be4=['channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8be4,0x18a));var _0x48be=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x8be4[_0x5ba549];return _0x36e3a1;};'use strict';var schema=require(_0x48be('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x48be('0x1')),'openchannelInteraction':require(_0x48be('0x2')),'smsInteraction':require(_0x48be('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x48be('0x4'))};var logger=require(_0x48be('0x5'))(_0x48be('0x6'));var tag=schema({'tag':{'type':_0x48be('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x55eb20,_0x25a307,_0x525c1d,_0x4aa637){return function(_0x4fd053){try{var _0x49aa22={'tag':_0x25a307[0x0]};var _0x22ba12=tag[_0x48be('0x0')](_0x49aa22,{'typecast':!![]});if(_0x22ba12[_0x48be('0x8')]){logger[_0x48be('0x9')](_0x48be('0xa'),_0x55eb20,_[_0x48be('0xb')](_0x22ba12,'message')['join'](',\x20'));logger[_0x48be('0xc')](_0x48be('0xd'),_0x55eb20);_0x4fd053['next']();}else{var _0x698dac={'ids':[_0x25a307[0x0]]};if(rpc[_0x4aa637[_0x48be('0xe')]+_0x48be('0xf')]){rpc[_0x4aa637['channel']+'Interaction'][_0x48be('0x10')](_0x4aa637['interaction']['id'],_0x698dac)[_0x48be('0x11')](function(_0x3b23e8){logger[_0x48be('0xc')](_0x48be('0x12'),_0x55eb20,_0x25a307[0x1],_0x4aa637[_0x48be('0xe')],_0x4aa637[_0x48be('0x13')]['id']);})[_0x48be('0x14')](function(_0x59df04){logger['error']('[%s][TAG]\x20%s',_0x55eb20,JSON[_0x48be('0x15')](_0x59df04));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x55eb20);})[_0x48be('0x16')](function(){_0x4fd053[_0x48be('0x17')]();});}}}catch(_0x3fe463){logger['error']('[%s][TAG]\x20%s',_0x55eb20,_['isObject'](_0x3fe463)?JSON[_0x48be('0x15')](_0x3fe463):_0x3fe463);logger[_0x48be('0xc')](_0x48be('0xd'),_0x55eb20);_0x4fd053[_0x48be('0x17')]();}};}; \ No newline at end of file +var _0x48ae=['channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','error','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x561343,_0x2a2c51){var _0x219516=function(_0xd78e7e){while(--_0xd78e7e){_0x561343['push'](_0x561343['shift']());}};_0x219516(++_0x2a2c51);}(_0x48ae,0xb9));var _0xe48a=function(_0x40d101,_0x48d2fc){_0x40d101=_0x40d101-0x0;var _0x501994=_0x48ae[_0x40d101];return _0x501994;};'use strict';var schema=require(_0xe48a('0x0'));var _=require(_0xe48a('0x1'));var rpc={'chatInteraction':require(_0xe48a('0x2')),'openchannelInteraction':require(_0xe48a('0x3')),'smsInteraction':require(_0xe48a('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xe48a('0x5'))};var logger=require(_0xe48a('0x6'))(_0xe48a('0x7'));var tag=schema({'tag':{'type':_0xe48a('0x8'),'required':!![],'message':_0xe48a('0x9')}});exports[_0xe48a('0xa')]=function(_0x30dccc,_0x45a35f,_0x535e73,_0x17886b){return function(_0x2c637d){try{var _0x286130={'tag':_0x45a35f[0x0]};var _0x3883c6=tag['validate'](_0x286130,{'typecast':!![]});if(_0x3883c6[_0xe48a('0xb')]){logger['error']('[%s][TAG]\x20%s',_0x30dccc,_[_0xe48a('0xc')](_0x3883c6,_0xe48a('0xd'))[_0xe48a('0xe')](',\x20'));logger[_0xe48a('0xf')](_0xe48a('0x10'),_0x30dccc);_0x2c637d[_0xe48a('0x11')]();}else{var _0x1bdf06={'ids':[_0x45a35f[0x0]]};if(rpc[_0x17886b[_0xe48a('0x12')]+_0xe48a('0x13')]){rpc[_0x17886b[_0xe48a('0x12')]+_0xe48a('0x13')]['addTags'](_0x17886b[_0xe48a('0x14')]['id'],_0x1bdf06)[_0xe48a('0x15')](function(_0x498989){logger[_0xe48a('0xf')](_0xe48a('0x16'),_0x30dccc,_0x45a35f[0x1],_0x17886b[_0xe48a('0x12')],_0x17886b[_0xe48a('0x14')]['id']);})[_0xe48a('0x17')](function(_0x246d6c){logger['error'](_0xe48a('0x18'),_0x30dccc,JSON[_0xe48a('0x19')](_0x246d6c));logger['info'](_0xe48a('0x10'),_0x30dccc);})[_0xe48a('0x1a')](function(){_0x2c637d[_0xe48a('0x11')]();});}}}catch(_0x325709){logger[_0xe48a('0x1b')]('[%s][TAG]\x20%s',_0x30dccc,_[_0xe48a('0x1c')](_0x325709)?JSON[_0xe48a('0x19')](_0x325709):_0x325709);logger[_0xe48a('0xf')](_0xe48a('0x10'),_0x30dccc);_0x2c637d[_0xe48a('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 52b94be..53a9c78 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 _0x729b=['replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','2.0','method','login','params','utf8','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','consequence'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x729b,0x114));var _0xb729=function(_0x3636fc,_0x32d1d5){_0x3636fc=_0x3636fc-0x0;var _0x15601e=_0x729b[_0x3636fc];return _0x15601e;};'use strict';var rp=require(_0xb729('0x0'));var logger=require(_0xb729('0x1'))(_0xb729('0x2'));var _=require('lodash');var arr=[];exports[_0xb729('0x3')]=function(_0x29f258,_0x282fd0){return function(_0x1fedff){var _0x4e2597=_0x282fd0[0xa];var _0x30e817=_0x282fd0[0xb];var _0x245705=_0x282fd0[0xc];var _0x131f63=_0x282fd0[0xd];var _0x429018=_0x282fd0[0xe];var _0x4f82d4=_0x282fd0[0xf][_0xb729('0x4')](/\n/g,_0xb729('0x5'));var _0x363567=_0x282fd0[0x10][_0xb729('0x4')](/\n/g,'\x20');if(!arr[_0xb729('0x6')](_0x30e817)){arr[_0xb729('0x7')](_0x30e817);var _0xbf3eb0=_0x282fd0[0x3];var _0x53e8a3=_0x282fd0[0x4];var _0x8de817=_0x282fd0[0x1];var _0x1983a5=_0x282fd0[0x0];var _0x5a4a8f={};_0x5a4a8f[_0xb729('0x8')]=_0x282fd0[0x8]+'?params='+_0x245705+'|'+_0x4e2597+'|'+_0x131f63+'|'+_0x30e817+'|'+_0x429018;_0x5a4a8f[_0xb729('0x9')]=_0x282fd0[0x7]+_0xb729('0xa')+_0x245705+'|'+_0x4e2597+'|'+_0x131f63+'|'+_0x30e817+'|'+_0x429018+'|'+_0x4f82d4+'|'+_0x363567;_0x5a4a8f[_0xb729('0xb')]=_0x282fd0[0x9];var _0x1ccc86={};_0x1ccc86[_0xb729('0xc')]=_0xb729('0xd');_0x1ccc86[_0xb729('0xe')]=_0xb729('0xf');var _0xa0376e=[];_0xa0376e[_0xb729('0x7')](_0x282fd0[0x2]);_0xa0376e[_0xb729('0x7')](_0x282fd0[0x5]);_0xa0376e[_0xb729('0x7')](_0x282fd0[0x6]);_0x1ccc86[_0xb729('0x10')]=_0xa0376e;_0x1ccc86['id']=0x1;var _0x530b81=JSON['stringify'](_0x1ccc86);var _0x59bbc1={'encoding':_0xb729('0x11'),'method':_0xb729('0x12'),'timeout':0x2710,'url':_0xbf3eb0,'headers':{'Content-Type':_0xb729('0x13')},'body':_0x530b81};return rp(_0x59bbc1)[_0xb729('0x14')](function(_0x33cd21){const _0x274eb8=JSON[_0xb729('0x15')](_0x33cd21);if(!_0x274eb8['result'][_0xb729('0x16')]){throw new Error(_0xb729('0x17'));}var _0x2ddfd5=_0x30e817;var _0x435f46=_0xb729('0x18')+_0x8de817+_0xb729('0x19')+_0x1983a5+_0xb729('0x1a')+_0x2ddfd5+_0xb729('0x1b')+JSON['stringify'](_0x5a4a8f);var _0x4fc460=_0x53e8a3+'?'+_0x435f46;return rp(_0x4fc460);})[_0xb729('0x14')](function(_0x1649c4){logger['info'](_0xb729('0x1c'),_0x29f258,_0x1649c4);_0x1fedff[_0xb729('0x1d')]();})['catch'](function(_0x3f8081){logger[_0xb729('0x1e')]('[%s][TVOX]\x20%s',_0x29f258,_[_0xb729('0x1f')](_0x3f8081)?JSON[_0xb729('0x20')](_0x3f8081):_0x3f8081);_0x1fedff[_0xb729('0x1d')]();});}else{logger['info'](_0xb729('0x21'),_0x29f258);_0x1fedff[_0xb729('0x22')]();}};}; \ No newline at end of file +var _0x95fd=['request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','params','utf8','POST','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','next'];(function(_0x3cd133,_0x222fcb){var _0x2512c8=function(_0x484491){while(--_0x484491){_0x3cd133['push'](_0x3cd133['shift']());}};_0x2512c8(++_0x222fcb);}(_0x95fd,0x18c));var _0xd95f=function(_0x1e2fac,_0x4e60a4){_0x1e2fac=_0x1e2fac-0x0;var _0x4e78d3=_0x95fd[_0x1e2fac];return _0x4e78d3;};'use strict';var rp=require(_0xd95f('0x0'));var logger=require(_0xd95f('0x1'))('routing');var _=require(_0xd95f('0x2'));var arr=[];exports[_0xd95f('0x3')]=function(_0x4efcd6,_0x22d7c6){return function(_0x17ec00){var _0x83937c=_0x22d7c6[0xa];var _0x549846=_0x22d7c6[0xb];var _0x36ad09=_0x22d7c6[0xc];var _0x39d214=_0x22d7c6[0xd];var _0x580a2a=_0x22d7c6[0xe];var _0x1cc274=_0x22d7c6[0xf][_0xd95f('0x4')](/\n/g,_0xd95f('0x5'));var _0x50341b=_0x22d7c6[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x549846)){arr[_0xd95f('0x6')](_0x549846);var _0x139b33=_0x22d7c6[0x3];var _0x50fe50=_0x22d7c6[0x4];var _0xf591ed=_0x22d7c6[0x1];var _0x2ff899=_0x22d7c6[0x0];var _0x2bc7ae={};_0x2bc7ae[_0xd95f('0x7')]=_0x22d7c6[0x8]+_0xd95f('0x8')+_0x36ad09+'|'+_0x83937c+'|'+_0x39d214+'|'+_0x549846+'|'+_0x580a2a;_0x2bc7ae['urlOnRing']=_0x22d7c6[0x7]+_0xd95f('0x8')+_0x36ad09+'|'+_0x83937c+'|'+_0x39d214+'|'+_0x549846+'|'+_0x580a2a+'|'+_0x1cc274+'|'+_0x50341b;_0x2bc7ae[_0xd95f('0x9')]=_0x22d7c6[0x9];var _0x477321={};_0x477321[_0xd95f('0xa')]=_0xd95f('0xb');_0x477321[_0xd95f('0xc')]='login';var _0x4a7bc6=[];_0x4a7bc6[_0xd95f('0x6')](_0x22d7c6[0x2]);_0x4a7bc6[_0xd95f('0x6')](_0x22d7c6[0x5]);_0x4a7bc6[_0xd95f('0x6')](_0x22d7c6[0x6]);_0x477321[_0xd95f('0xd')]=_0x4a7bc6;_0x477321['id']=0x1;var _0x46a025=JSON['stringify'](_0x477321);var _0x1e52e9={'encoding':_0xd95f('0xe'),'method':_0xd95f('0xf'),'timeout':0x2710,'url':_0x139b33,'headers':{'Content-Type':'application/json-rpc'},'body':_0x46a025};return rp(_0x1e52e9)[_0xd95f('0x10')](function(_0x50da7b){const _0x8fb8b5=JSON[_0xd95f('0x11')](_0x50da7b);if(!_0x8fb8b5[_0xd95f('0x12')][_0xd95f('0x13')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x11e7af=_0x549846;var _0xc90064=_0xd95f('0x14')+_0xf591ed+_0xd95f('0x15')+_0x2ff899+_0xd95f('0x16')+_0x11e7af+_0xd95f('0x17')+JSON[_0xd95f('0x18')](_0x2bc7ae);var _0x48e4cd=_0x50fe50+'?'+_0xc90064;return rp(_0x48e4cd);})['then'](function(_0x2ec725){logger[_0xd95f('0x19')](_0xd95f('0x1a'),_0x4efcd6,_0x2ec725);_0x17ec00['stop']();})[_0xd95f('0x1b')](function(_0x44613c){logger[_0xd95f('0x1c')](_0xd95f('0x1d'),_0x4efcd6,_[_0xd95f('0x1e')](_0x44613c)?JSON[_0xd95f('0x18')](_0x44613c):_0x44613c);_0x17ec00[_0xd95f('0x1f')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x4efcd6);_0x17ec00[_0xd95f('0x20')]();}};}; \ 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 494a6ac..efa8d0d 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x5ac5e2,_0x2ff97d){var _0x5249e1=function(_0x3e6f37){while(--_0x3e6f37){_0x5ac5e2['push'](_0x5ac5e2['shift']());}};_0x5249e1(++_0x2ff97d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 +var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x4aa958,_0x5bab9d){var _0x21a99e=function(_0x20c2f6){while(--_0x20c2f6){_0x4aa958['push'](_0x4aa958['shift']());}};_0x21a99e(++_0x5bab9d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 63b52fc..b635a5d 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 _0x2ee2=['.js','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','execute','Applications\x20executed','matchPath','emit','error','stack','agent','agents','busy','busyQueue','end','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','paused','waiting','mailQueues','available','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','listen','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','map','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','length','join','app'];(function(_0x5b2e73,_0x2eeb88){var _0x27ee32=function(_0x56f90b){while(--_0x56f90b){_0x5b2e73['push'](_0x5b2e73['shift']());}};_0x27ee32(++_0x2eeb88);}(_0x2ee2,0xaa));var _0x22ee=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x2ee2[_0x178f52];return _0x556f99;};'use strict';var _=require(_0x22ee('0x0'));var util=require(_0x22ee('0x1'));var path=require(_0x22ee('0x2'));var fs=require('fs');var jayson=require(_0x22ee('0x3'));var BPromise=require(_0x22ee('0x4'));var utils=require(_0x22ee('0x5'));var sUtils=require(_0x22ee('0x6'));var logger=require('../../../config/logger')(_0x22ee('0x7'));var rpc={'openchannelQueueReport':require(_0x22ee('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x22ee('0x9')),'smsQueueReport':require(_0x22ee('0xa')),'faxQueueReport':require(_0x22ee('0xb')),'whatsappQueueReport':require(_0x22ee('0xc'))};var RuleEngine=require(_0x22ee('0xd'));function getId(_0xcf66da,_0x2a2442,_0xb9e223){return util[_0x22ee('0xe')](_0x22ee('0xf'),_0xcf66da,_0x2a2442||0x0,_0xb9e223||0x0);}function getIntervals(_0x15d5ea,_0x46dff9){var _0x4843c7=[];if(!_['isNil'](_0x46dff9[_0x22ee('0x10')])&&!_[_0x22ee('0x11')](_0x15d5ea[_0x46dff9[_0x22ee('0x10')]])&&!_[_0x22ee('0x11')](_0x15d5ea[_0x46dff9[_0x22ee('0x10')]]['Intervals'])){_0x4843c7=_[_0x22ee('0x12')](_0x15d5ea[_0x46dff9[_0x22ee('0x10')]][_0x22ee('0x13')],_0x22ee('0x14'));}else if(!_[_0x22ee('0x11')](_0x46dff9[_0x22ee('0x14')])){_0x4843c7=[_0x46dff9[_0x22ee('0x14')]];}return _0x4843c7;}exports['listen']=function(_0x5ee171){_0x5ee171[_0x22ee('0x15')]={};return new BPromise(function(_0x5760dc,_0x4f4bdc){var _0x1ebef1={'Start':function(_0x1d3888){var _0x2729dc=this;return new Promise(function(_0x98c770,_0x459b3a){if(_0x1d3888){try{var _0x1ca4ec=[];var _0x486e71=getId(_0x1d3888[_0x22ee('0x16')],_0x1d3888[_0x22ee('0x17')]?_0x1d3888[_0x22ee('0x17')]['id']:0x0,_0x1d3888['interaction']?_0x1d3888[_0x22ee('0x18')]['id']:0x0);var _0x55c56a=sUtils[_0x22ee('0x19')](_0x5ee171,_0x1d3888);if(!_0x55c56a&&_0x1d3888['applications']&&_['isArray'](_0x1d3888[_0x22ee('0x1a')])&&_0x1d3888[_0x22ee('0x1a')][_0x22ee('0x1b')]){for(var _0x465401=0x0;_0x465401<_0x1d3888[_0x22ee('0x1a')][_0x22ee('0x1b')];_0x465401+=0x1){var _0x3f4f56=_0x1d3888[_0x22ee('0x1a')][_0x465401];if(fs['existsSync'](path[_0x22ee('0x1c')](__dirname,_0x22ee('0x1a'),_0x3f4f56[_0x22ee('0x1d')]+_0x22ee('0x1e')))){var _0x4477bd=[];switch(_0x3f4f56[_0x22ee('0x1d')]['toLowerCase']()){case _0x22ee('0x1f'):var _0x207607=_0x3f4f56[_0x22ee('0x20')][_0x22ee('0x21')](',');if(_0x1d3888[_0x22ee('0x16')]==='mail'){_0x4477bd['push'](_0x207607[0x0]);_0x4477bd[_0x22ee('0x22')](_0x207607[0x1]);_0x4477bd[_0x22ee('0x22')](_0x207607[_0x22ee('0x23')](0x2,_0x207607[_0x22ee('0x1b')])[_0x22ee('0x1c')](','));}else{_0x4477bd['push'](_0x207607[0x0]);_0x4477bd[_0x22ee('0x22')](_0x207607[_0x22ee('0x23')](0x1,_0x207607[_0x22ee('0x1b')])[_0x22ee('0x1c')](','));}break;case _0x22ee('0x24'):var _0x5482b4=_0x3f4f56[_0x22ee('0x20')][_0x22ee('0x21')](',');_0x4477bd[_0x22ee('0x22')](_0x5482b4[0x0]);_0x4477bd[_0x22ee('0x22')](_0x5482b4[0x1]);_0x4477bd[_0x22ee('0x22')](_0x5482b4[_0x22ee('0x23')](0x2,_0x5482b4[_0x22ee('0x1b')])[_0x22ee('0x1c')](','));break;case _0x22ee('0x25'):var _0x17687c=_0x3f4f56['appdata'][_0x22ee('0x21')](',');_0x4477bd[_0x22ee('0x22')](_0x17687c[0x0]);_0x4477bd['push'](_0x17687c[0x1]);_0x4477bd['push'](_0x17687c[0x2]);_0x4477bd[_0x22ee('0x22')](_0x17687c[0x3]);_0x4477bd[_0x22ee('0x22')](_0x17687c['slice'](0x4,_0x17687c[_0x22ee('0x1b')])[_0x22ee('0x1c')](','));break;case _0x22ee('0x26'):var _0x2ca4ef=_0x3f4f56[_0x22ee('0x20')]['split'](',');_0x4477bd[_0x22ee('0x22')](_0x2ca4ef[0x0]);_0x4477bd[_0x22ee('0x22')](_0x2ca4ef[0x1]);_0x4477bd[_0x22ee('0x22')](_0x2ca4ef[0x2]);_0x4477bd[_0x22ee('0x22')](_0x2ca4ef[0x3]);_0x4477bd['push'](_0x2ca4ef[_0x22ee('0x23')](0x4,_0x2ca4ef[_0x22ee('0x1b')])[_0x22ee('0x1c')](','));break;case _0x22ee('0x17'):_0x4477bd[_0x22ee('0x22')](_0x3f4f56[_0x22ee('0x20')]);break;case _0x22ee('0x27'):_0x4477bd[_0x22ee('0x22')](_0x3f4f56[_0x22ee('0x28')]);_0x4477bd[_0x22ee('0x22')](_0x3f4f56[_0x22ee('0x20')]);break;case _0x22ee('0x29'):var _0x5237a7=utils[_0x22ee('0x2a')](_0x1d3888[_0x22ee('0x2b')]['notificationTemplate'],_0x1d3888);var _0x1fdb26=_0x3f4f56[_0x22ee('0x20')][_0x22ee('0x21')](',');_0x4477bd[_0x22ee('0x22')](_0x1fdb26[0x0]);_0x4477bd[_0x22ee('0x22')](_0x1fdb26[0x1]);_0x4477bd[_0x22ee('0x22')](_0x1fdb26[0x2]);_0x4477bd[_0x22ee('0x22')](_0x1fdb26[0x3]);_0x4477bd[_0x22ee('0x22')](_0x1fdb26[0x4]);_0x4477bd['push'](_0x1fdb26[0x5]);_0x4477bd['push'](_0x1fdb26[0x6]);_0x4477bd[_0x22ee('0x22')](_0x1fdb26[0x7]);_0x4477bd[_0x22ee('0x22')](_0x1fdb26[0x8]);_0x4477bd[_0x22ee('0x22')](_0x1fdb26[0x9]);_0x4477bd[_0x22ee('0x22')](_0x1fdb26[0xa]);_0x4477bd['push'](_0x1d3888[_0x22ee('0x18')]['id']);_0x4477bd[_0x22ee('0x22')](_0x1d3888[_0x22ee('0x17')]['id']);_0x4477bd['push'](_0x3f4f56[_0x22ee('0x2c')]);_0x4477bd['push'](_0x1d3888[_0x22ee('0x18')][_0x22ee('0x2d')]);_0x4477bd[_0x22ee('0x22')](_0x1d3888[_0x22ee('0x2e')]['body']);_0x4477bd['push'](_0x5237a7);break;default:_0x4477bd=_['isNil'](_0x3f4f56[_0x22ee('0x20')])?[]:_0x3f4f56[_0x22ee('0x20')][_0x22ee('0x21')](',');}var _0x31a4b2={'id':util[_0x22ee('0xe')](_0x22ee('0x2f'),_0x486e71,_0x3f4f56['id'],_0x3f4f56['app']),'condition':require(_0x22ee('0x30'))[_0x22ee('0x31')](_0x486e71,getIntervals(_0x5ee171[_0x22ee('0x32')],_0x3f4f56),_0x5ee171),'consequence':require(_0x22ee('0x33')+_0x3f4f56[_0x22ee('0x1d')])[_0x22ee('0x34')](_0x486e71,_0x4477bd,_0x5ee171,_0x1d3888),'p':_0x3f4f56[_0x22ee('0x35')]||0x0};logger[_0x22ee('0x36')](_0x22ee('0x37'),_0x31a4b2['id'],_0x22ee('0x38'),getIntervals(_0x5ee171[_0x22ee('0x32')],_0x3f4f56)['join'](_0x22ee('0x39')));_0x1ca4ec['push'](_0x31a4b2);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x22ee('0x1c')](__dirname,_0x22ee('0x1a'),_0x3f4f56['app']+_0x22ee('0x1e')));}}_0x5ee171[_0x22ee('0x15')][_0x486e71]=new RuleEngine(_0x1ca4ec);_0x5ee171[_0x22ee('0x15')][_0x486e71][_0x22ee('0x3a')](_0x1d3888,function(_0x7da048){logger[_0x22ee('0x36')](_0x22ee('0x3b'),JSON['stringify'](_0x7da048[_0x22ee('0x3c')]));if(_0x5ee171[_0x22ee('0x15')][_0x486e71]){_0x5ee171['rules'][_0x486e71][_0x22ee('0x3d')]('complete');}});return _0x98c770({'code':0xc8,'message':_0x1d3888});}else{if(_0x55c56a){logger[_0x22ee('0x36')](util['format']('Skipped\x20routing\x20for\x20%s',_0x486e71));}else{logger[_0x22ee('0x36')]('No\x20applications\x20to\x20execute');}return _0x98c770({'code':0xc8,'message':_0x1d3888});}}catch(_0x7dcc2){logger[_0x22ee('0x3e')](_0x7dcc2[_0x22ee('0x3f')]);return _0x459b3a(_0x2729dc[_0x22ee('0x3e')](0x1f4,_0x7dcc2));}}return _0x459b3a('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2d31f6){var _0x373feb=this;return new Promise(function(_0x61a7db,_0x323778){if(_0x2d31f6[_0x22ee('0x40')]&&_0x2d31f6[_0x22ee('0x40')]['id']){if(_0x5ee171['agents'][_0x2d31f6[_0x22ee('0x40')]['id']]){_0x5ee171[_0x22ee('0x41')][_0x2d31f6[_0x22ee('0x40')]['id']][_0x22ee('0x42')]=![];_0x5ee171[_0x22ee('0x41')][_0x2d31f6[_0x22ee('0x40')]['id']][_0x22ee('0x43')]=undefined;}}if(_0x2d31f6[_0x22ee('0x17')]&&_0x2d31f6['message']['id']){try{var _0x7d2a8e=getId(_0x2d31f6[_0x22ee('0x16')],_0x2d31f6[_0x22ee('0x17')]?_0x2d31f6['message']['id']:0x0,_0x2d31f6[_0x22ee('0x18')]?_0x2d31f6[_0x22ee('0x18')]['id']:0x0);if(_0x5ee171[_0x22ee('0x15')][_0x7d2a8e]){_0x5ee171[_0x22ee('0x15')][_0x7d2a8e][_0x22ee('0x3d')](_0x22ee('0x44'));if(rpc[_0x2d31f6[_0x22ee('0x16')]+'QueueReport']){rpc[_0x2d31f6[_0x22ee('0x16')]+_0x22ee('0x45')]['update'](_0x7d2a8e,{'UserId':_0x2d31f6[_0x22ee('0x17')][_0x22ee('0x46')]})['catch'](function(){logger[_0x22ee('0x3e')](_0x22ee('0x47'));});}}return _0x61a7db({'code':0xc8,'message':_0x2d31f6});}catch(_0x354d56){logger[_0x22ee('0x3e')](_0x354d56['stack']);return _0x323778(_0x373feb[_0x22ee('0x3e')](0x1f4,_0x354d56));}}logger[_0x22ee('0x3e')](_0x22ee('0x48'));return _0x323778(_0x373feb[_0x22ee('0x3e')](0x1f4,_0x22ee('0x48')));});},'RejectMessage':function(_0x848054){var _0x3ac619=this;return new Promise(function(_0x25cfaf,_0x355492){if(_0x848054['agent']&&_0x848054[_0x22ee('0x40')]['id']){try{if(_0x5ee171[_0x22ee('0x41')][_0x848054['agent']['id']]){_0x5ee171[_0x22ee('0x41')][_0x848054[_0x22ee('0x40')]['id']]['busy']=![];_0x5ee171['agents'][_0x848054[_0x22ee('0x40')]['id']][_0x22ee('0x43')]=undefined;}return _0x25cfaf({'code':0xc8,'message':_0x848054});}catch(_0x281689){logger[_0x22ee('0x3e')](_0x281689['stack']);return _0x355492(_0x3ac619[_0x22ee('0x3e')](0x1f4,_0x281689));}}logger['error'](_0x22ee('0x48'));return _0x355492(_0x3ac619[_0x22ee('0x3e')](0x1f4,_0x22ee('0x48')));});},'AbandonInteraction':function(_0x3a78ed){var _0x31ff9e=this;return new Promise(function(_0xd73e83,_0x2e9d3e){if(_0x3a78ed[_0x22ee('0x16')]&&_0x3a78ed[_0x22ee('0x18')]&&_0x3a78ed['interaction']['id']){try{var _0x519583=getId(_0x3a78ed['channel'],_0x3a78ed[_0x22ee('0x17')]?_0x3a78ed['message']['id']:0x0,_0x3a78ed[_0x22ee('0x18')]?_0x3a78ed[_0x22ee('0x18')]['id']:0x0);if(_0x5ee171[_0x22ee('0x15')][_0x519583]){_0x5ee171[_0x22ee('0x15')][_0x519583][_0x22ee('0x3d')](_0x22ee('0x44'));}return _0xd73e83({'code':0xc8,'message':_0x3a78ed});}catch(_0x29c7b9){logger[_0x22ee('0x3e')](_0x29c7b9[_0x22ee('0x3f')]);return _0x2e9d3e(_0x31ff9e['error'](0x1f4,_0x29c7b9));}}logger[_0x22ee('0x3e')](_0x22ee('0x48'));return _0x2e9d3e(_0x31ff9e[_0x22ee('0x3e')](0x1f4,_0x22ee('0x48')));});},'AgentCapacity':function(_0x325781){var _0x5142fa=this;return new Promise(function(_0x57247a,_0x194abc){if(_0x5ee171[_0x22ee('0x41')][_0x22ee('0x49')](_0x325781['id'])){for(var _0x2128b1 in _0x325781['capacity']){if(_0x325781[_0x22ee('0x4a')][_0x22ee('0x49')](_0x2128b1)){if(_0x5ee171[_0x22ee('0x41')][_0x325781['id']][_0x22ee('0x49')](_0x2128b1+_0x22ee('0x4b'))){_0x5ee171[_0x22ee('0x41')][_0x325781['id']][_0x2128b1+_0x22ee('0x4b')]=parseInt(_0x325781['capacity'][_0x2128b1],0xa);}}}_0x5ee171[_0x22ee('0x41')][_0x325781['id']][_0x22ee('0x4c')]();return _0x57247a({'code':0xc8,'message':_0x5ee171[_0x22ee('0x41')][_0x325781['id']]});}else{return _0x194abc(_0x5142fa[_0x22ee('0x3e')](0x1f4,_0x22ee('0x4d')));}});},'Agents':function(_0x4ead76){return new Promise(function(_0x45243c){var _0xe299d2=_[_0x22ee('0x4e')](_0x5ee171[_0x22ee('0x41')]);if(_0x4ead76&&_0x4ead76['id']){var _0x5f1bf1=_[_0x22ee('0x4f')](_0xe299d2,function(_0x285b8c){return _0x285b8c['id']===_0x4ead76['id'];});_0x45243c(_0x5f1bf1);}else{_0x45243c({'count':_0xe299d2[_0x22ee('0x1b')],'rows':_0xe299d2});}});},'ChatQueues':function(){return new Promise(function(_0x51c331){var _0x4d2de3=[];for(var _0x4b14ca in _0x5ee171[_0x22ee('0x50')]){if(_0x5ee171['chatQueues'][_0x22ee('0x49')](_0x4b14ca)){var _0x4136f8=_0x5ee171[_0x22ee('0x50')][_0x4b14ca];var _0x46a4a8={'id':_0x4136f8['id'],'available':_0x4136f8['available'],'loggedIn':_0x4136f8[_0x22ee('0x51')],'name':_0x4136f8['name'],'paused':_0x4136f8[_0x22ee('0x52')],'waiting':_0x4136f8[_0x22ee('0x53')]};_0x4d2de3['push'](_0x46a4a8);}}_0x51c331({'count':_0x4d2de3[_0x22ee('0x1b')],'rows':_0x4d2de3});});},'MailQueues':function(){return new Promise(function(_0xbcccad){var _0xea9b63=[];for(var _0x37bd57 in _0x5ee171[_0x22ee('0x54')]){if(_0x5ee171[_0x22ee('0x54')][_0x22ee('0x49')](_0x37bd57)){var _0x40c9d2=_0x5ee171[_0x22ee('0x54')][_0x37bd57];var _0x23b824={'id':_0x40c9d2['id'],'available':_0x40c9d2[_0x22ee('0x55')],'loggedIn':_0x40c9d2[_0x22ee('0x51')],'name':_0x40c9d2[_0x22ee('0x56')],'paused':_0x40c9d2[_0x22ee('0x52')],'waiting':_0x40c9d2['waiting']};_0xea9b63['push'](_0x23b824);}}_0xbcccad({'count':_0xea9b63[_0x22ee('0x1b')],'rows':_0xea9b63});});},'OpenchannelQueues':function(){return new Promise(function(_0x4f27ea){var _0x4ea070=[];for(var _0x373b77 in _0x5ee171[_0x22ee('0x57')]){if(_0x5ee171[_0x22ee('0x57')]['hasOwnProperty'](_0x373b77)){var _0x10293a=_0x5ee171[_0x22ee('0x57')][_0x373b77];var _0x4b7ba9={'id':_0x10293a['id'],'available':_0x10293a[_0x22ee('0x55')],'loggedIn':_0x10293a[_0x22ee('0x51')],'name':_0x10293a[_0x22ee('0x56')],'paused':_0x10293a[_0x22ee('0x52')],'waiting':_0x10293a['waiting']};_0x4ea070['push'](_0x4b7ba9);}}_0x4f27ea({'count':_0x4ea070['length'],'rows':_0x4ea070});});},'SmsQueues':function(){return new Promise(function(_0x2e57be){var _0xa53fb7=[];for(var _0x39b7c4 in _0x5ee171[_0x22ee('0x58')]){if(_0x5ee171[_0x22ee('0x58')]['hasOwnProperty'](_0x39b7c4)){var _0x2c28f0=_0x5ee171[_0x22ee('0x58')][_0x39b7c4];var _0x3eb7b4={'id':_0x2c28f0['id'],'available':_0x2c28f0[_0x22ee('0x55')],'loggedIn':_0x2c28f0[_0x22ee('0x51')],'name':_0x2c28f0[_0x22ee('0x56')],'paused':_0x2c28f0[_0x22ee('0x52')],'waiting':_0x2c28f0[_0x22ee('0x53')]};_0xa53fb7[_0x22ee('0x22')](_0x3eb7b4);}}_0x2e57be({'count':_0xa53fb7[_0x22ee('0x1b')],'rows':_0xa53fb7});});},'FaxQueues':function(){return new Promise(function(_0x8d71f7){var _0x26d9a6=[];for(var _0xb13ae in _0x5ee171[_0x22ee('0x59')]){if(_0x5ee171['faxQueues']['hasOwnProperty'](_0xb13ae)){var _0x5e94fa=_0x5ee171[_0x22ee('0x59')][_0xb13ae];var _0x2fbd2c={'id':_0x5e94fa['id'],'available':_0x5e94fa[_0x22ee('0x55')],'loggedIn':_0x5e94fa[_0x22ee('0x51')],'name':_0x5e94fa[_0x22ee('0x56')],'paused':_0x5e94fa[_0x22ee('0x52')],'waiting':_0x5e94fa[_0x22ee('0x53')]};_0x26d9a6[_0x22ee('0x22')](_0x2fbd2c);}}_0x8d71f7({'count':_0x26d9a6[_0x22ee('0x1b')],'rows':_0x26d9a6});});},'WhatsappQueues':function(){return new Promise(function(_0x2997be){var _0x5b0d1e=[];for(var _0x10b422 in _0x5ee171['whatsappQueues']){if(_0x5ee171['whatsappQueues'][_0x22ee('0x49')](_0x10b422)){var _0x2c7691=_0x5ee171[_0x22ee('0x5a')][_0x10b422];var _0x53c820={'id':_0x2c7691['id'],'available':_0x2c7691[_0x22ee('0x55')],'loggedIn':_0x2c7691[_0x22ee('0x51')],'name':_0x2c7691['name'],'paused':_0x2c7691[_0x22ee('0x52')],'waiting':_0x2c7691[_0x22ee('0x53')]};_0x5b0d1e['push'](_0x53c820);}}_0x2997be({'count':_0x5b0d1e[_0x22ee('0x1b')],'rows':_0x5b0d1e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1ef20f){var _0x5f4ab2=_[_0x22ee('0x4e')](_0x5ee171[_0x22ee('0x5b')]);_0x1ef20f({'count':_0x5f4ab2[_0x22ee('0x1b')],'rows':_0x5f4ab2});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1bee99){var _0x2c82df=_[_0x22ee('0x4e')](_0x5ee171[_0x22ee('0x5c')]);_0x1bee99({'count':_0x2c82df['length'],'rows':_0x2c82df});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xe87c0d){var _0x3d9ea3=_[_0x22ee('0x4e')](_0x5ee171['openchannelQueuesWaitingInteractions']);_0xe87c0d({'count':_0x3d9ea3[_0x22ee('0x1b')],'rows':_0x3d9ea3});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x21b348){var _0x27287c=_[_0x22ee('0x4e')](_0x5ee171[_0x22ee('0x5d')]);_0x21b348({'count':_0x27287c[_0x22ee('0x1b')],'rows':_0x27287c});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x58f3bf){var _0x1a12aa=_['values'](_0x5ee171[_0x22ee('0x5e')]);_0x58f3bf({'count':_0x1a12aa[_0x22ee('0x1b')],'rows':_0x1a12aa});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x26bdf9){var _0x269127=_[_0x22ee('0x4e')](_0x5ee171[_0x22ee('0x5f')]);_0x26bdf9({'count':_0x269127[_0x22ee('0x1b')],'rows':_0x269127});});}};var _0x1556f7=jayson[_0x22ee('0x60')](_0x1ebef1)['http']();_0x1556f7['on']('error',function(_0x1ca27b){logger[_0x22ee('0x3e')](JSON[_0x22ee('0x61')](_0x1ca27b));return _0x4f4bdc(_0x1ca27b);});_0x1556f7[_0x22ee('0x62')](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x5760dc(_0x22ee('0x63')+0x232c);});});}; \ No newline at end of file +var _0xc80b=['format','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','applications','length','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflowv2','amazonlex','tag','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','condition','intervals','./applications/','consequence','info','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine'];(function(_0xdcad6,_0x5b7cc9){var _0x294c34=function(_0xf415c){while(--_0xf415c){_0xdcad6['push'](_0xdcad6['shift']());}};_0x294c34(++_0x5b7cc9);}(_0xc80b,0x1cb));var _0xbc80=function(_0xd772c0,_0x5940c9){_0xd772c0=_0xd772c0-0x0;var _0x12eb5a=_0xc80b[_0xd772c0];return _0x12eb5a;};'use strict';var _=require(_0xbc80('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0xbc80('0x1'));var BPromise=require('bluebird');var utils=require(_0xbc80('0x2'));var sUtils=require(_0xbc80('0x3'));var logger=require(_0xbc80('0x4'))(_0xbc80('0x5'));var rpc={'openchannelQueueReport':require(_0xbc80('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xbc80('0x7')),'smsQueueReport':require(_0xbc80('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbc80('0x9'))};var RuleEngine=require(_0xbc80('0xa'));function getId(_0x3b2b5d,_0x325be5,_0x1c656b){return util[_0xbc80('0xb')]('%s.%s.%s',_0x3b2b5d,_0x325be5||0x0,_0x1c656b||0x0);}function getIntervals(_0x22b4dc,_0x2570fa){var _0x2798b8=[];if(!_[_0xbc80('0xc')](_0x2570fa['IntervalId'])&&!_[_0xbc80('0xc')](_0x22b4dc[_0x2570fa[_0xbc80('0xd')]])&&!_[_0xbc80('0xc')](_0x22b4dc[_0x2570fa[_0xbc80('0xd')]]['Intervals'])){_0x2798b8=_['map'](_0x22b4dc[_0x2570fa[_0xbc80('0xd')]][_0xbc80('0xe')],_0xbc80('0xf'));}else if(!_['isNil'](_0x2570fa[_0xbc80('0xf')])){_0x2798b8=[_0x2570fa[_0xbc80('0xf')]];}return _0x2798b8;}exports[_0xbc80('0x10')]=function(_0x314a1f){_0x314a1f[_0xbc80('0x11')]={};return new BPromise(function(_0x5467ea,_0x448819){var _0x19961f={'Start':function(_0x18a0b9){var _0x28e915=this;return new Promise(function(_0x38d275,_0x288d5f){if(_0x18a0b9){try{var _0x344a69=[];var _0x36bb80=getId(_0x18a0b9[_0xbc80('0x12')],_0x18a0b9[_0xbc80('0x13')]?_0x18a0b9['message']['id']:0x0,_0x18a0b9['interaction']?_0x18a0b9[_0xbc80('0x14')]['id']:0x0);var _0x45ed2d=sUtils['checkWaitingNotifications'](_0x314a1f,_0x18a0b9);if(!_0x45ed2d&&_0x18a0b9[_0xbc80('0x15')]&&_['isArray'](_0x18a0b9[_0xbc80('0x15')])&&_0x18a0b9[_0xbc80('0x15')][_0xbc80('0x16')]){for(var _0x34d68e=0x0;_0x34d68e<_0x18a0b9[_0xbc80('0x15')][_0xbc80('0x16')];_0x34d68e+=0x1){var _0x382a8c=_0x18a0b9[_0xbc80('0x15')][_0x34d68e];if(fs['existsSync'](path[_0xbc80('0x17')](__dirname,'applications',_0x382a8c[_0xbc80('0x18')]+_0xbc80('0x19')))){var _0x2d942b=[];switch(_0x382a8c['app'][_0xbc80('0x1a')]()){case _0xbc80('0x1b'):var _0x72e1b9=_0x382a8c[_0xbc80('0x1c')][_0xbc80('0x1d')](',');if(_0x18a0b9[_0xbc80('0x12')]==='mail'){_0x2d942b[_0xbc80('0x1e')](_0x72e1b9[0x0]);_0x2d942b[_0xbc80('0x1e')](_0x72e1b9[0x1]);_0x2d942b[_0xbc80('0x1e')](_0x72e1b9[_0xbc80('0x1f')](0x2,_0x72e1b9[_0xbc80('0x16')])[_0xbc80('0x17')](','));}else{_0x2d942b[_0xbc80('0x1e')](_0x72e1b9[0x0]);_0x2d942b[_0xbc80('0x1e')](_0x72e1b9[_0xbc80('0x1f')](0x1,_0x72e1b9[_0xbc80('0x16')])[_0xbc80('0x17')](','));}break;case'dialogflow':var _0xe807d=_0x382a8c[_0xbc80('0x1c')]['split'](',');_0x2d942b[_0xbc80('0x1e')](_0xe807d[0x0]);_0x2d942b[_0xbc80('0x1e')](_0xe807d[0x1]);_0x2d942b['push'](_0xe807d[_0xbc80('0x1f')](0x2,_0xe807d['length'])[_0xbc80('0x17')](','));break;case _0xbc80('0x20'):var _0x477ac1=_0x382a8c[_0xbc80('0x1c')]['split'](',');_0x2d942b[_0xbc80('0x1e')](_0x477ac1[0x0]);_0x2d942b[_0xbc80('0x1e')](_0x477ac1[0x1]);_0x2d942b['push'](_0x477ac1[0x2]);_0x2d942b['push'](_0x477ac1[0x3]);_0x2d942b[_0xbc80('0x1e')](_0x477ac1['slice'](0x4,_0x477ac1['length'])[_0xbc80('0x17')](','));break;case _0xbc80('0x21'):var _0x2c5b1d=_0x382a8c['appdata']['split'](',');_0x2d942b[_0xbc80('0x1e')](_0x2c5b1d[0x0]);_0x2d942b[_0xbc80('0x1e')](_0x2c5b1d[0x1]);_0x2d942b[_0xbc80('0x1e')](_0x2c5b1d[0x2]);_0x2d942b[_0xbc80('0x1e')](_0x2c5b1d[0x3]);_0x2d942b[_0xbc80('0x1e')](_0x2c5b1d[_0xbc80('0x1f')](0x4,_0x2c5b1d[_0xbc80('0x16')])[_0xbc80('0x17')](','));break;case _0xbc80('0x13'):_0x2d942b['push'](_0x382a8c[_0xbc80('0x1c')]);break;case _0xbc80('0x22'):_0x2d942b[_0xbc80('0x1e')](_0x382a8c['TagId']);_0x2d942b[_0xbc80('0x1e')](_0x382a8c[_0xbc80('0x1c')]);break;case'tvox':var _0x23a631=utils[_0xbc80('0x23')](_0x18a0b9[_0xbc80('0x24')][_0xbc80('0x25')],_0x18a0b9);var _0x7631d1=_0x382a8c[_0xbc80('0x1c')][_0xbc80('0x1d')](',');_0x2d942b[_0xbc80('0x1e')](_0x7631d1[0x0]);_0x2d942b[_0xbc80('0x1e')](_0x7631d1[0x1]);_0x2d942b[_0xbc80('0x1e')](_0x7631d1[0x2]);_0x2d942b[_0xbc80('0x1e')](_0x7631d1[0x3]);_0x2d942b[_0xbc80('0x1e')](_0x7631d1[0x4]);_0x2d942b[_0xbc80('0x1e')](_0x7631d1[0x5]);_0x2d942b['push'](_0x7631d1[0x6]);_0x2d942b['push'](_0x7631d1[0x7]);_0x2d942b[_0xbc80('0x1e')](_0x7631d1[0x8]);_0x2d942b[_0xbc80('0x1e')](_0x7631d1[0x9]);_0x2d942b[_0xbc80('0x1e')](_0x7631d1[0xa]);_0x2d942b[_0xbc80('0x1e')](_0x18a0b9[_0xbc80('0x14')]['id']);_0x2d942b[_0xbc80('0x1e')](_0x18a0b9['message']['id']);_0x2d942b[_0xbc80('0x1e')](_0x382a8c[_0xbc80('0x26')]);_0x2d942b['push'](_0x18a0b9['interaction'][_0xbc80('0x27')]);_0x2d942b[_0xbc80('0x1e')](_0x18a0b9[_0xbc80('0x28')][_0xbc80('0x28')]);_0x2d942b[_0xbc80('0x1e')](_0x23a631);break;default:_0x2d942b=_[_0xbc80('0xc')](_0x382a8c['appdata'])?[]:_0x382a8c[_0xbc80('0x1c')]['split'](',');}var _0x3848e9={'id':util[_0xbc80('0xb')]('%s:%s:%s',_0x36bb80,_0x382a8c['id'],_0x382a8c[_0xbc80('0x18')]),'condition':require('./interval')[_0xbc80('0x29')](_0x36bb80,getIntervals(_0x314a1f[_0xbc80('0x2a')],_0x382a8c),_0x314a1f),'consequence':require(_0xbc80('0x2b')+_0x382a8c[_0xbc80('0x18')])[_0xbc80('0x2c')](_0x36bb80,_0x2d942b,_0x314a1f,_0x18a0b9),'p':_0x382a8c['priority']||0x0};logger[_0xbc80('0x2d')]('Push\x20new\x20rule',_0x3848e9['id'],_0xbc80('0x2e'),getIntervals(_0x314a1f[_0xbc80('0x2a')],_0x382a8c)[_0xbc80('0x17')]('\x20|\x20'));_0x344a69[_0xbc80('0x1e')](_0x3848e9);}else{logger[_0xbc80('0x2f')](_0xbc80('0x30'),path[_0xbc80('0x17')](__dirname,_0xbc80('0x15'),_0x382a8c[_0xbc80('0x18')]+_0xbc80('0x19')));}}_0x314a1f[_0xbc80('0x11')][_0x36bb80]=new RuleEngine(_0x344a69);_0x314a1f[_0xbc80('0x11')][_0x36bb80]['execute'](_0x18a0b9,function(_0x1a2f85){logger['info'](_0xbc80('0x31'),JSON[_0xbc80('0x32')](_0x1a2f85['matchPath']));if(_0x314a1f[_0xbc80('0x11')][_0x36bb80]){_0x314a1f['rules'][_0x36bb80]['emit']('complete');}});return _0x38d275({'code':0xc8,'message':_0x18a0b9});}else{if(_0x45ed2d){logger[_0xbc80('0x2d')](util['format'](_0xbc80('0x33'),_0x36bb80));}else{logger[_0xbc80('0x2d')](_0xbc80('0x34'));}return _0x38d275({'code':0xc8,'message':_0x18a0b9});}}catch(_0x1b5e68){logger[_0xbc80('0x2f')](_0x1b5e68[_0xbc80('0x35')]);return _0x288d5f(_0x28e915[_0xbc80('0x2f')](0x1f4,_0x1b5e68));}}return _0x288d5f(_0xbc80('0x36'));});},'AcceptMessage':function(_0x543d19){var _0x11fe3e=this;return new Promise(function(_0x3f2b86,_0x187124){if(_0x543d19[_0xbc80('0x37')]&&_0x543d19[_0xbc80('0x37')]['id']){if(_0x314a1f[_0xbc80('0x38')][_0x543d19[_0xbc80('0x37')]['id']]){_0x314a1f['agents'][_0x543d19[_0xbc80('0x37')]['id']][_0xbc80('0x39')]=![];_0x314a1f[_0xbc80('0x38')][_0x543d19[_0xbc80('0x37')]['id']][_0xbc80('0x3a')]=undefined;}}if(_0x543d19[_0xbc80('0x13')]&&_0x543d19['message']['id']){try{var _0x2963b7=getId(_0x543d19[_0xbc80('0x12')],_0x543d19[_0xbc80('0x13')]?_0x543d19[_0xbc80('0x13')]['id']:0x0,_0x543d19['interaction']?_0x543d19['interaction']['id']:0x0);if(_0x314a1f[_0xbc80('0x11')][_0x2963b7]){_0x314a1f[_0xbc80('0x11')][_0x2963b7][_0xbc80('0x3b')](_0xbc80('0x3c'));if(rpc[_0x543d19[_0xbc80('0x12')]+_0xbc80('0x3d')]){rpc[_0x543d19[_0xbc80('0x12')]+_0xbc80('0x3d')][_0xbc80('0x3e')](_0x2963b7,{'UserId':_0x543d19[_0xbc80('0x13')][_0xbc80('0x3f')]})[_0xbc80('0x40')](function(){logger[_0xbc80('0x2f')](_0xbc80('0x41'));});}}return _0x3f2b86({'code':0xc8,'message':_0x543d19});}catch(_0x5c689a){logger['error'](_0x5c689a[_0xbc80('0x35')]);return _0x187124(_0x11fe3e[_0xbc80('0x2f')](0x1f4,_0x5c689a));}}logger[_0xbc80('0x2f')]('message\x20is\x20empty');return _0x187124(_0x11fe3e['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xef58ed){var _0x20ab89=this;return new Promise(function(_0x4c83fe,_0xc5969b){if(_0xef58ed[_0xbc80('0x37')]&&_0xef58ed['agent']['id']){try{if(_0x314a1f[_0xbc80('0x38')][_0xef58ed[_0xbc80('0x37')]['id']]){_0x314a1f[_0xbc80('0x38')][_0xef58ed[_0xbc80('0x37')]['id']]['busy']=![];_0x314a1f[_0xbc80('0x38')][_0xef58ed[_0xbc80('0x37')]['id']][_0xbc80('0x3a')]=undefined;}return _0x4c83fe({'code':0xc8,'message':_0xef58ed});}catch(_0x32f421){logger[_0xbc80('0x2f')](_0x32f421['stack']);return _0xc5969b(_0x20ab89[_0xbc80('0x2f')](0x1f4,_0x32f421));}}logger[_0xbc80('0x2f')](_0xbc80('0x42'));return _0xc5969b(_0x20ab89[_0xbc80('0x2f')](0x1f4,_0xbc80('0x42')));});},'AbandonInteraction':function(_0x588cfc){var _0x1f5341=this;return new Promise(function(_0x34264a,_0x12745d){if(_0x588cfc[_0xbc80('0x12')]&&_0x588cfc[_0xbc80('0x14')]&&_0x588cfc['interaction']['id']){try{var _0x592f70=getId(_0x588cfc['channel'],_0x588cfc['message']?_0x588cfc[_0xbc80('0x13')]['id']:0x0,_0x588cfc[_0xbc80('0x14')]?_0x588cfc[_0xbc80('0x14')]['id']:0x0);if(_0x314a1f[_0xbc80('0x11')][_0x592f70]){_0x314a1f[_0xbc80('0x11')][_0x592f70][_0xbc80('0x3b')](_0xbc80('0x3c'));}return _0x34264a({'code':0xc8,'message':_0x588cfc});}catch(_0x2c7272){logger['error'](_0x2c7272[_0xbc80('0x35')]);return _0x12745d(_0x1f5341[_0xbc80('0x2f')](0x1f4,_0x2c7272));}}logger[_0xbc80('0x2f')](_0xbc80('0x42'));return _0x12745d(_0x1f5341[_0xbc80('0x2f')](0x1f4,_0xbc80('0x42')));});},'AgentCapacity':function(_0x1d687f){var _0x1b3e29=this;return new Promise(function(_0x15f815,_0x4d59ca){if(_0x314a1f[_0xbc80('0x38')][_0xbc80('0x43')](_0x1d687f['id'])){for(var _0x878d1e in _0x1d687f['capacity']){if(_0x1d687f[_0xbc80('0x44')][_0xbc80('0x43')](_0x878d1e)){if(_0x314a1f[_0xbc80('0x38')][_0x1d687f['id']][_0xbc80('0x43')](_0x878d1e+_0xbc80('0x45'))){_0x314a1f['agents'][_0x1d687f['id']][_0x878d1e+_0xbc80('0x45')]=parseInt(_0x1d687f['capacity'][_0x878d1e],0xa);}}}_0x314a1f[_0xbc80('0x38')][_0x1d687f['id']][_0xbc80('0x46')]();return _0x15f815({'code':0xc8,'message':_0x314a1f['agents'][_0x1d687f['id']]});}else{return _0x4d59ca(_0x1b3e29[_0xbc80('0x2f')](0x1f4,_0xbc80('0x47')));}});},'Agents':function(_0xa99391){return new Promise(function(_0x501277){var _0x567acb=_['values'](_0x314a1f[_0xbc80('0x38')]);if(_0xa99391&&_0xa99391['id']){var _0x486bc8=_[_0xbc80('0x48')](_0x567acb,function(_0xe187e7){return _0xe187e7['id']===_0xa99391['id'];});_0x501277(_0x486bc8);}else{_0x501277({'count':_0x567acb[_0xbc80('0x16')],'rows':_0x567acb});}});},'ChatQueues':function(){return new Promise(function(_0x2bd4fd){var _0x566b83=[];for(var _0x365127 in _0x314a1f[_0xbc80('0x49')]){if(_0x314a1f[_0xbc80('0x49')][_0xbc80('0x43')](_0x365127)){var _0x394a0b=_0x314a1f[_0xbc80('0x49')][_0x365127];var _0x42160a={'id':_0x394a0b['id'],'available':_0x394a0b[_0xbc80('0x4a')],'loggedIn':_0x394a0b[_0xbc80('0x4b')],'name':_0x394a0b[_0xbc80('0x4c')],'paused':_0x394a0b[_0xbc80('0x4d')],'waiting':_0x394a0b[_0xbc80('0x4e')]};_0x566b83[_0xbc80('0x1e')](_0x42160a);}}_0x2bd4fd({'count':_0x566b83[_0xbc80('0x16')],'rows':_0x566b83});});},'MailQueues':function(){return new Promise(function(_0x46e6c5){var _0xbd282c=[];for(var _0x8a48c5 in _0x314a1f[_0xbc80('0x4f')]){if(_0x314a1f[_0xbc80('0x4f')][_0xbc80('0x43')](_0x8a48c5)){var _0x12c853=_0x314a1f[_0xbc80('0x4f')][_0x8a48c5];var _0x5b64fa={'id':_0x12c853['id'],'available':_0x12c853[_0xbc80('0x4a')],'loggedIn':_0x12c853[_0xbc80('0x4b')],'name':_0x12c853[_0xbc80('0x4c')],'paused':_0x12c853[_0xbc80('0x4d')],'waiting':_0x12c853[_0xbc80('0x4e')]};_0xbd282c['push'](_0x5b64fa);}}_0x46e6c5({'count':_0xbd282c[_0xbc80('0x16')],'rows':_0xbd282c});});},'OpenchannelQueues':function(){return new Promise(function(_0x2424fb){var _0xa0ab51=[];for(var _0x4b570d in _0x314a1f[_0xbc80('0x50')]){if(_0x314a1f['openchannelQueues'][_0xbc80('0x43')](_0x4b570d)){var _0x35c464=_0x314a1f[_0xbc80('0x50')][_0x4b570d];var _0xb8f88a={'id':_0x35c464['id'],'available':_0x35c464[_0xbc80('0x4a')],'loggedIn':_0x35c464[_0xbc80('0x4b')],'name':_0x35c464['name'],'paused':_0x35c464[_0xbc80('0x4d')],'waiting':_0x35c464[_0xbc80('0x4e')]};_0xa0ab51[_0xbc80('0x1e')](_0xb8f88a);}}_0x2424fb({'count':_0xa0ab51[_0xbc80('0x16')],'rows':_0xa0ab51});});},'SmsQueues':function(){return new Promise(function(_0x60eca1){var _0x448bcd=[];for(var _0x3171fa in _0x314a1f[_0xbc80('0x51')]){if(_0x314a1f[_0xbc80('0x51')]['hasOwnProperty'](_0x3171fa)){var _0x22562e=_0x314a1f[_0xbc80('0x51')][_0x3171fa];var _0x27a4de={'id':_0x22562e['id'],'available':_0x22562e[_0xbc80('0x4a')],'loggedIn':_0x22562e['loggedIn'],'name':_0x22562e[_0xbc80('0x4c')],'paused':_0x22562e[_0xbc80('0x4d')],'waiting':_0x22562e[_0xbc80('0x4e')]};_0x448bcd[_0xbc80('0x1e')](_0x27a4de);}}_0x60eca1({'count':_0x448bcd[_0xbc80('0x16')],'rows':_0x448bcd});});},'FaxQueues':function(){return new Promise(function(_0x4b1be5){var _0x5967b1=[];for(var _0x54a015 in _0x314a1f[_0xbc80('0x52')]){if(_0x314a1f[_0xbc80('0x52')][_0xbc80('0x43')](_0x54a015)){var _0x4d3f55=_0x314a1f[_0xbc80('0x52')][_0x54a015];var _0x10b717={'id':_0x4d3f55['id'],'available':_0x4d3f55['available'],'loggedIn':_0x4d3f55[_0xbc80('0x4b')],'name':_0x4d3f55[_0xbc80('0x4c')],'paused':_0x4d3f55[_0xbc80('0x4d')],'waiting':_0x4d3f55[_0xbc80('0x4e')]};_0x5967b1[_0xbc80('0x1e')](_0x10b717);}}_0x4b1be5({'count':_0x5967b1[_0xbc80('0x16')],'rows':_0x5967b1});});},'WhatsappQueues':function(){return new Promise(function(_0x2e2246){var _0x389ca4=[];for(var _0x1d8fcd in _0x314a1f['whatsappQueues']){if(_0x314a1f[_0xbc80('0x53')][_0xbc80('0x43')](_0x1d8fcd)){var _0x437322=_0x314a1f['whatsappQueues'][_0x1d8fcd];var _0x1ecb6e={'id':_0x437322['id'],'available':_0x437322['available'],'loggedIn':_0x437322['loggedIn'],'name':_0x437322[_0xbc80('0x4c')],'paused':_0x437322[_0xbc80('0x4d')],'waiting':_0x437322[_0xbc80('0x4e')]};_0x389ca4[_0xbc80('0x1e')](_0x1ecb6e);}}_0x2e2246({'count':_0x389ca4[_0xbc80('0x16')],'rows':_0x389ca4});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1d2e92){var _0x2ac37c=_[_0xbc80('0x54')](_0x314a1f[_0xbc80('0x55')]);_0x1d2e92({'count':_0x2ac37c['length'],'rows':_0x2ac37c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x565c40){var _0x3ae2ac=_[_0xbc80('0x54')](_0x314a1f[_0xbc80('0x56')]);_0x565c40({'count':_0x3ae2ac[_0xbc80('0x16')],'rows':_0x3ae2ac});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3c1cb0){var _0x2e6e50=_[_0xbc80('0x54')](_0x314a1f[_0xbc80('0x57')]);_0x3c1cb0({'count':_0x2e6e50[_0xbc80('0x16')],'rows':_0x2e6e50});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x932c98){var _0x47f071=_[_0xbc80('0x54')](_0x314a1f[_0xbc80('0x58')]);_0x932c98({'count':_0x47f071[_0xbc80('0x16')],'rows':_0x47f071});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x391915){var _0x4e7b54=_['values'](_0x314a1f['faxQueuesWaitingInteractions']);_0x391915({'count':_0x4e7b54['length'],'rows':_0x4e7b54});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1f9a5d){var _0x4459d3=_[_0xbc80('0x54')](_0x314a1f[_0xbc80('0x59')]);_0x1f9a5d({'count':_0x4459d3[_0xbc80('0x16')],'rows':_0x4459d3});});}};var _0x43d26b=jayson[_0xbc80('0x5a')](_0x19961f)[_0xbc80('0x5b')]();_0x43d26b['on'](_0xbc80('0x2f'),function(_0x592e7c){logger['error'](JSON[_0xbc80('0x32')](_0x592e7c));return _0x448819(_0x592e7c);});_0x43d26b[_0xbc80('0x10')](0x232c,'127.0.0.1',function(){console[_0xbc80('0x5c')](_0xbc80('0x5d'),0x232c);return _0x5467ea('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c72c19e..0214d3e 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 _0x0d25=['error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','then','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','jayson/promise','lodash','http'];(function(_0x4dcbea,_0x304889){var _0x2f31d9=function(_0x457898){while(--_0x457898){_0x4dcbea['push'](_0x4dcbea['shift']());}};_0x2f31d9(++_0x304889);}(_0x0d25,0x1b6));var _0x50d2=function(_0x1b664d,_0x1d8695){_0x1b664d=_0x1b664d-0x0;var _0x43af6b=_0x0d25[_0x1b664d];return _0x43af6b;};'use strict';var util=require(_0x50d2('0x0'));var BPromise=require('bluebird');var jayson=require(_0x50d2('0x1'));var _=require(_0x50d2('0x2'));var logger=require('../../../config/logger')('routing');var client=jayson['client'][_0x50d2('0x3')]({'port':0x232a});function request(_0x13e55b,_0x290e44){return new BPromise(function(_0x3a8f1f,_0x1822e8){return client['request'](_0x13e55b,_0x290e44)['then'](function(_0x40efde){if(_0x40efde[_0x50d2('0x4')]){return _0x1822e8(_0x40efde[_0x50d2('0x4')][_0x50d2('0x5')]);}else{return _0x3a8f1f(_0x40efde[_0x50d2('0x6')]);}})[_0x50d2('0x7')](function(_0x17ca41){return _0x1822e8(_0x17ca41);});});}exports['condition']=function(_0x1ef158,_0x47aec7,_0x3d5208){return function(_0x109af5){if(_0x3d5208[_0x50d2('0x8')]&&!_0x3d5208['rules'][_0x1ef158]){logger[_0x50d2('0x9')](_0x50d2('0xa'),_0x1ef158);return _0x109af5[_0x50d2('0xb')]();}var _0x526d0c=[];for(var _0x1fced4=0x0;_0x1fced4<_0x47aec7[_0x50d2('0xc')];_0x1fced4+=0x1){_0x526d0c[_0x50d2('0xd')](request('Command',{'command':util[_0x50d2('0xe')](_0x50d2('0xf'),_0x47aec7[_0x1fced4])})[_0x50d2('0x10')](function(_0x1ddd6b){return _0x1ddd6b&&_0x1ddd6b[_0x50d2('0x5')]&&_0x1ddd6b[_0x50d2('0x5')]['indexOf'](_0x50d2('0x11'))>=0x0?!![]:![];})[_0x50d2('0x7')](function(_0x43bf2e){logger['error'](_0x50d2('0x12'),_0x1ef158,_0x47aec7[_0x1fced4]);}));}BPromise['all'](_0x526d0c)[_0x50d2('0x10')](function(_0x15b932){var _0xb75d57=_[_0x50d2('0x13')](_0x15b932);logger['info'](_0x50d2('0x14'),_0x1ef158,_0x47aec7[_0x50d2('0x15')](_0x50d2('0x16')),_0xb75d57);_0x109af5[_0x50d2('0x17')](_0xb75d57);})[_0x50d2('0x7')](function(_0x20feef){console[_0x50d2('0x18')](_0x20feef);logger['error'](_0x50d2('0x14'),_0x1ef158,_0x47aec7[_0x50d2('0x15')]('\x20|\x20'),_0x20feef[_0x50d2('0x19')]);_0x109af5[_0x50d2('0xb')]();});};}; \ No newline at end of file +var _0xc6a3=['some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','stop','jayson/promise','lodash','client','http','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','iftime\x20%s','message','true'];(function(_0x54ed06,_0x92e127){var _0x8cf41b=function(_0x1609b3){while(--_0x1609b3){_0x54ed06['push'](_0x54ed06['shift']());}};_0x8cf41b(++_0x92e127);}(_0xc6a3,0x96));var _0x3c6a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc6a3[_0x1035c1];return _0x308d67;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x3c6a('0x0'));var _=require(_0x3c6a('0x1'));var logger=require('../../../config/logger')('routing');var client=jayson[_0x3c6a('0x2')][_0x3c6a('0x3')]({'port':0x232a});function request(_0xd0c11d,_0x259778){return new BPromise(function(_0x48faeb,_0x23e91c){return client['request'](_0xd0c11d,_0x259778)[_0x3c6a('0x4')](function(_0x582a55){if(_0x582a55[_0x3c6a('0x5')]){return _0x23e91c(_0x582a55[_0x3c6a('0x5')]['message']);}else{return _0x48faeb(_0x582a55[_0x3c6a('0x6')]);}})[_0x3c6a('0x7')](function(_0x2351db){return _0x23e91c(_0x2351db);});});}exports[_0x3c6a('0x8')]=function(_0x5d67c2,_0x4c6211,_0x12847a){return function(_0x2ff917){if(_0x12847a[_0x3c6a('0x9')]&&!_0x12847a[_0x3c6a('0x9')][_0x5d67c2]){logger[_0x3c6a('0xa')](_0x3c6a('0xb'),_0x5d67c2);return _0x2ff917['stop']();}var _0x3ea522=[];for(var _0x44f41b=0x0;_0x44f41b<_0x4c6211[_0x3c6a('0xc')];_0x44f41b+=0x1){_0x3ea522[_0x3c6a('0xd')](request(_0x3c6a('0xe'),{'command':util['format'](_0x3c6a('0xf'),_0x4c6211[_0x44f41b])})[_0x3c6a('0x4')](function(_0x4be0c7){return _0x4be0c7&&_0x4be0c7[_0x3c6a('0x10')]&&_0x4be0c7['message']['indexOf'](_0x3c6a('0x11'))>=0x0?!![]:![];})[_0x3c6a('0x7')](function(_0x5dcbe9){logger[_0x3c6a('0x5')]('[%s][INTERVAL]\x20%s',_0x5d67c2,_0x4c6211[_0x44f41b]);}));}BPromise['all'](_0x3ea522)[_0x3c6a('0x4')](function(_0xd6d795){var _0x52ea8f=_[_0x3c6a('0x12')](_0xd6d795);logger[_0x3c6a('0xa')](_0x3c6a('0x13'),_0x5d67c2,_0x4c6211[_0x3c6a('0x14')](_0x3c6a('0x15')),_0x52ea8f);_0x2ff917['when'](_0x52ea8f);})[_0x3c6a('0x7')](function(_0x86c3f7){console['log'](_0x86c3f7);logger['error'](_0x3c6a('0x13'),_0x5d67c2,_0x4c6211[_0x3c6a('0x14')]('\x20|\x20'),_0x86c3f7[_0x3c6a('0x16')]);_0x2ff917[_0x3c6a('0x17')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index f24de83..a00aabb 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 _0x97c1=['connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','holdtime','ringtime','talktime','push','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','forIn','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','calleridnum','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','called'];(function(_0x17de62,_0x561f1b){var _0x1014d4=function(_0x4dd9f1){while(--_0x4dd9f1){_0x17de62['push'](_0x17de62['shift']());}};_0x1014d4(++_0x561f1b);}(_0x97c1,0xdf));var _0x197c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x97c1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e2e81,_0x498f9c){utils['info'](util[_0x197c('0x2')](_0x197c('0x3'),_0x5e2e81[_0x197c('0x4')],_0x5e2e81[_0x197c('0x5')],_0x5e2e81[_0x197c('0x6')],_0x5e2e81['membername'],_0x5e2e81['interface'],_0x5e2e81[_0x197c('0x7')],_0x5e2e81[_0x197c('0x8')],_0x5e2e81[_0x197c('0x9')]));if(_0x5e2e81[_0x197c('0x6')]){utils['getVoiceQueueByName'](_0x5e2e81['queue'])[_0x197c('0xa')](function(_0x5cffb8){if(_0x5cffb8){_0x5e2e81[_0x197c('0xb')]=_0x5cffb8[_0x197c('0xb')];_0x5e2e81[_0x197c('0xc')]=_0x5e2e81[_0x197c('0xd')]?_0x5cffb8['acw']:![];_0x5e2e81[_0x197c('0xe')]=_0x5e2e81[_0x197c('0xc')]?_0x5cffb8[_0x197c('0xf')]:0x0;}utils[_0x197c('0x10')](_0x197c('0x11'),_0x5e2e81);});}else{utils['request'](_0x197c('0x11'),_0x5e2e81);}if(_0x498f9c){delete transfers[_0x5e2e81[_0x197c('0x4')]];}else{delete agents[_0x5e2e81[_0x197c('0x12')]];}}exports[_0x197c('0x13')]=function(_0x567658){try{utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x15'),_0x567658[_0x197c('0x4')]),_0x567658);agents[_0x567658[_0x197c('0x12')]]=_0x567658;agents[_0x567658[_0x197c('0x12')]]['agentcalledAt']=utils['now']();agents[_0x567658[_0x197c('0x12')]][_0x197c('0x9')]=_0x197c('0x16');agents[_0x567658[_0x197c('0x12')]][_0x197c('0x8')]=null;agents[_0x567658[_0x197c('0x12')]][_0x197c('0x17')]=null;utils[_0x197c('0x18')](util['format'](_0x197c('0x19'),_0x567658['uniqueid'],agents[_0x567658['destuniqueid']][_0x197c('0x1a')],_0x567658[_0x197c('0x12')]));}catch(_0x2eca5e){utils[_0x197c('0x1b')](util['format'](_0x197c('0x15'),_0x567658[_0x197c('0x4')]),_0x2eca5e);}};exports[_0x197c('0x1c')]=function(_0x5c278a){try{if(!_[_0x197c('0x1d')](agents[_0x5c278a[_0x197c('0x12')]])){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x1e'),_0x5c278a[_0x197c('0x4')]),_0x5c278a);utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x1f'),_0x5c278a[_0x197c('0x4')],agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x1a')],_0x5c278a[_0x197c('0x12')]));agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x1c')]=!![];agents[_0x5c278a[_0x197c('0x12')]]['agentringnoanswerAt']=utils[_0x197c('0x20')]();agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x9')]='timeout';agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x21')]='timeout';agents[_0x5c278a['destuniqueid']][_0x197c('0x22')]=_0x5c278a['ringtime']?parseInt(_0x5c278a[_0x197c('0x23')])/0x3e8:0x0;agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x24')]=0x0;unanswered[_0x197c('0x25')](_0x5c278a[_0x197c('0x12')]);}}catch(_0x3cdcd8){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x1e'),_0x5c278a['uniqueid']),_0x3cdcd8);}};exports['queuecallerabandon']=function(_0x574274){try{_['forIn'](agents,function(_0x5f7425,_0x4c9256){if(_0x5f7425[_0x197c('0x4')]==_0x574274[_0x197c('0x4')]&&!_['includes'](unanswered,_0x5f7425[_0x197c('0x12')])){utils['debug'](util[_0x197c('0x2')](_0x197c('0x26'),_0x574274[_0x197c('0x4')]),_0x574274);utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x27'),_0x574274[_0x197c('0x4')],_0x5f7425[_0x197c('0x1a')],_0x5f7425[_0x197c('0x12')]));_0x5f7425['agentringnoanswer']=!![];_0x5f7425['agentringnoanswerAt']=utils[_0x197c('0x20')]();_0x5f7425[_0x197c('0x9')]=_0x197c('0x28');_0x5f7425[_0x197c('0x21')]=_0x197c('0x28');_0x5f7425[_0x197c('0x22')]=_0x574274[_0x197c('0x22')];_0x5f7425['talktime']=0x0;writeDB(_0x5f7425);}});}catch(_0x54e6be){utils[_0x197c('0x1b')](util[_0x197c('0x2')]('[%s][agents][queuecallerabandon]',_0x574274['uniqueid']),_0x54e6be);}};exports[_0x197c('0x29')]=function(_0x2a884b){try{if(agents[_0x2a884b[_0x197c('0x12')]]){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x2a'),_0x2a884b[_0x197c('0x4')]),_0x2a884b);utils[_0x197c('0x18')](util[_0x197c('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2a884b[_0x197c('0x4')],agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x1a')],_0x2a884b[_0x197c('0x12')]));agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x2b')]=utils['now']();agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x8')]=_0x2a884b[_0x197c('0x8')];agents[_0x2a884b['destuniqueid']][_0x197c('0x17')]=_0x2a884b[_0x197c('0x17')];agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x22')]=_0x2a884b[_0x197c('0x23')];agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x9')]=_0x197c('0x2c');_[_0x197c('0x2d')](agents,function(_0x1dc01b,_0x4a12fc){if(_0x1dc01b[_0x197c('0x12')]!=_0x2a884b[_0x197c('0x12')]&&_0x1dc01b['uniqueid']==_0x2a884b['uniqueid']){_0x1dc01b[_0x197c('0x24')]=0x0;_0x1dc01b[_0x197c('0x22')]=_0x2a884b[_0x197c('0x23')];_0x1dc01b[_0x197c('0x1c')]=!![];_0x1dc01b[_0x197c('0x2e')]=utils['now']();_0x1dc01b[_0x197c('0x9')]=_0x197c('0x2f');_0x1dc01b[_0x197c('0x21')]=_0x197c('0x2f');_0x1dc01b[_0x197c('0x30')]=_0x2a884b['destuniqueid'];_0x1dc01b[_0x197c('0x31')]=_0x2a884b[_0x197c('0x1a')];writeDB(_0x1dc01b);}});}}catch(_0x6d7bda){utils[_0x197c('0x1b')](util[_0x197c('0x2')]('[%s][agents][agentconnect]',_0x2a884b[_0x197c('0x4')]),_0x6d7bda);}};exports[_0x197c('0xd')]=function(_0x3b7fc1){try{if(!_[_0x197c('0x1d')](agents[_0x3b7fc1[_0x197c('0x12')]])){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x32'),_0x3b7fc1[_0x197c('0x4')]),_0x3b7fc1);utils[_0x197c('0x18')](util[_0x197c('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3b7fc1['uniqueid'],agents[_0x3b7fc1['destuniqueid']]['membername'],_0x3b7fc1[_0x197c('0x12')]));agents[_0x3b7fc1[_0x197c('0x12')]]['agentcomplete']=!![];agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x33')]=utils['now']();agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x24')]=utils['diffTime'](agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x33')],agents[_0x3b7fc1['destuniqueid']][_0x197c('0x2b')]);agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x21')]=_0x3b7fc1['reason'];agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x9')]=_0x197c('0x34');writeDB(agents[_0x3b7fc1[_0x197c('0x12')]]);}}catch(_0x53295b){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x32'),_0x3b7fc1['uniqueid']),_0x53295b);}};exports['blindtransfer']=function(_0x3a5089){try{if(!_[_0x197c('0x1d')](agents[_0x3a5089[_0x197c('0x35')]])){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x36'),_0x3a5089['uniqueid']),_0x3a5089);utils[_0x197c('0x18')](util['format'](_0x197c('0x37'),_0x3a5089[_0x197c('0x4')],agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x1a')],agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x4')]));agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x38')]=!![];agents[_0x3a5089['transfereruniqueid']][_0x197c('0x39')]=_0x197c('0x3a');agents[_0x3a5089[_0x197c('0x35')]]['transferexten']=_0x3a5089[_0x197c('0x3b')];agents[_0x3a5089['transfereruniqueid']][_0x197c('0x3c')]=agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x4')];}}catch(_0x22a106){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x36'),_0x3a5089[_0x197c('0x4')]),_0x22a106);}};exports['attendedtransfer']=function(_0x3e3176){try{utils[_0x197c('0x14')](util[_0x197c('0x2')]('[%s][agents][attendedtransfer]',_0x3e3176[_0x197c('0x3d')]),_0x3e3176);if(_0x3e3176[_0x197c('0x3d')]==_0x3e3176[_0x197c('0x3e')]){if(!_[_0x197c('0x1d')](agents[_0x3e3176[_0x197c('0x3f')]])){utils['info'](util['format'](_0x197c('0x40'),_0x3e3176[_0x197c('0x3d')],agents[_0x3e3176[_0x197c('0x3f')]][_0x197c('0x1a')]));agents[_0x3e3176[_0x197c('0x3f')]]['transfer']=!![];agents[_0x3e3176['secondtransfereruniqueid']][_0x197c('0x39')]=_0x197c('0x41');agents[_0x3e3176['secondtransfereruniqueid']][_0x197c('0x42')]=_0x3e3176[_0x197c('0x43')];agents[_0x3e3176[_0x197c('0x3f')]][_0x197c('0x3c')]=_0x3e3176[_0x197c('0x3d')];}if(_0x3e3176[_0x197c('0x44')]&&agents[_0x3e3176['transfereeuniqueid']]){agents[_0x3e3176[_0x197c('0x44')]][_0x197c('0x45')]=0x1;transfers[_0x3e3176['transfereeuniqueid']]=_['clone'](agents[_0x3e3176[_0x197c('0x44')]]);transfers[_0x3e3176['transfereeuniqueid']][_0x197c('0x7')]=agents[_0x3e3176[_0x197c('0x3f')]][_0x197c('0x7')];transfers[_0x3e3176['transfereeuniqueid']][_0x197c('0x46')]=agents[_0x3e3176[_0x197c('0x3f')]]['calleridname'];transfers[_0x3e3176[_0x197c('0x44')]][_0x197c('0x47')]=utils[_0x197c('0x20')]();transfers[_0x3e3176['transfereeuniqueid']][_0x197c('0x2b')]=utils[_0x197c('0x20')]();transfers[_0x3e3176['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x3e3176[_0x197c('0x44')]][_0x197c('0x45')]=0x2;}}else if(_0x3e3176[_0x197c('0x3f')]==_0x3e3176['secondtransfererlinkedid']){if(!_[_0x197c('0x1d')](agents[_0x3e3176[_0x197c('0x3d')]])){utils[_0x197c('0x18')](util['format'](_0x197c('0x40'),_0x3e3176[_0x197c('0x3d')],agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x1a')]));agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x38')]=!![];agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x39')]=_0x197c('0x41');agents[_0x3e3176[_0x197c('0x3d')]]['transferexten']=_0x3e3176[_0x197c('0x48')];agents[_0x3e3176['origtransfereruniqueid']]['transferuniqueid']=_0x3e3176['secondtransfereruniqueid'];}if(_0x3e3176['transfertargetuniqueid']&&agents[_0x3e3176[_0x197c('0x49')]]){agents[_0x3e3176[_0x197c('0x49')]][_0x197c('0x45')]=0x1;transfers[_0x3e3176[_0x197c('0x49')]]=_['clone'](agents[_0x3e3176[_0x197c('0x49')]]);transfers[_0x3e3176['transfertargetuniqueid']][_0x197c('0x7')]=agents[_0x3e3176['origtransfereruniqueid']][_0x197c('0x7')];transfers[_0x3e3176['transfertargetuniqueid']][_0x197c('0x46')]=agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x46')];transfers[_0x3e3176[_0x197c('0x49')]]['agentcalledAt']=utils[_0x197c('0x20')]();transfers[_0x3e3176[_0x197c('0x49')]][_0x197c('0x2b')]=utils['now']();transfers[_0x3e3176[_0x197c('0x49')]][_0x197c('0x22')]=0x0;transfers[_0x3e3176[_0x197c('0x49')]][_0x197c('0x45')]=0x2;}}}catch(_0x5596f3){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x4a'),_0x3e3176[_0x197c('0x3d')]),_0x5596f3);}};exports[_0x197c('0x4b')]=function(_0x342efa){try{utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x4c'),_0x342efa[_0x197c('0x4')]),_0x342efa);if(agents[_0x342efa[_0x197c('0x4')]]&&agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')]==='timeout'){if(_0x342efa['cause']==='21'){agents[_0x342efa['uniqueid']][_0x197c('0x21')]='rejected';agents[_0x342efa[_0x197c('0x4')]]['lastevent']='rejected';}utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x4d'),_0x342efa['uniqueid'],agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x1a')],agents[_0x342efa['uniqueid']][_0x197c('0x21')],agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x9')]));writeDB(agents[_0x342efa[_0x197c('0x4')]]);var _0x54206a=unanswered[_0x197c('0x4e')](_0x342efa['uniqueid']);if(_0x54206a>-0x1){unanswered[_0x197c('0x4f')](_0x54206a,0x1);}}if(transfers[_0x342efa['uniqueid']]){transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0xd')]=!![];transfers[_0x342efa[_0x197c('0x4')]]['agentcompleteAt']=utils[_0x197c('0x20')]();transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x24')]=utils['diffTime'](transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x33')],transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x2b')]);transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')]='agent';transfers[_0x342efa[_0x197c('0x4')]]['lastevent']='complete';utils[_0x197c('0x18')](util[_0x197c('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x342efa[_0x197c('0x4')],transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x1a')],transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')],transfers[_0x342efa['uniqueid']]['lastevent']));writeDB(transfers[_0x342efa['uniqueid']],!![]);}if(agents[_0x342efa['uniqueid']]&&agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x2b')]){agents[_0x342efa['uniqueid']]['agentcomplete']=!![];agents[_0x342efa[_0x197c('0x4')]]['agentcompleteAt']=utils['now']();agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x24')]=utils[_0x197c('0x50')](agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x33')],agents[_0x342efa[_0x197c('0x4')]]['agentconnectAt']);agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')]=agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x38')]?_0x197c('0x38'):_0x197c('0x51');agents[_0x342efa[_0x197c('0x4')]]['lastevent']=_0x197c('0x34');utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x4d'),_0x342efa[_0x197c('0x4')],agents[_0x342efa[_0x197c('0x4')]]['membername'],agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')],agents[_0x342efa['uniqueid']][_0x197c('0x9')]));writeDB(agents[_0x342efa[_0x197c('0x4')]]);}}catch(_0x173303){utils[_0x197c('0x1b')](util[_0x197c('0x2')]('[%s][agents][hangup]',_0x342efa['uniqueid']),_0x173303);}}; \ No newline at end of file +var _0xb7e7=['answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','./utils','format','uniqueid','channel','queue','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','holdtime','ringtime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere'];(function(_0x19493c,_0x15548e){var _0x364648=function(_0x1a6bb7){while(--_0x1a6bb7){_0x19493c['push'](_0x19493c['shift']());}};_0x364648(++_0x15548e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var utils=require(_0x7b7e('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x518dc6,_0x1b7cc7){utils['info'](util[_0x7b7e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x518dc6[_0x7b7e('0x3')],_0x518dc6[_0x7b7e('0x4')],_0x518dc6[_0x7b7e('0x5')],_0x518dc6['membername'],_0x518dc6['interface'],_0x518dc6[_0x7b7e('0x6')],_0x518dc6[_0x7b7e('0x7')],_0x518dc6[_0x7b7e('0x8')]));if(_0x518dc6['queue']){utils[_0x7b7e('0x9')](_0x518dc6[_0x7b7e('0x5')])[_0x7b7e('0xa')](function(_0x1647e5){if(_0x1647e5){_0x518dc6[_0x7b7e('0xb')]=_0x1647e5[_0x7b7e('0xb')];_0x518dc6[_0x7b7e('0xc')]=_0x518dc6['agentcomplete']?_0x1647e5[_0x7b7e('0xd')]:![];_0x518dc6[_0x7b7e('0xe')]=_0x518dc6[_0x7b7e('0xc')]?_0x1647e5[_0x7b7e('0xf')]:0x0;}utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);});}else{utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);}if(_0x1b7cc7){delete transfers[_0x518dc6[_0x7b7e('0x3')]];}else{delete agents[_0x518dc6['destuniqueid']];}}exports[_0x7b7e('0x12')]=function(_0x430eab){try{utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][agentcalled]',_0x430eab['uniqueid']),_0x430eab);agents[_0x430eab[_0x7b7e('0x13')]]=_0x430eab;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();agents[_0x430eab[_0x7b7e('0x13')]]['lastevent']='called';agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x7')]=null;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x16')]=null;utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x18'),_0x430eab[_0x7b7e('0x3')],agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x430eab[_0x7b7e('0x13')]));}catch(_0x14f4fe){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x1b'),_0x430eab[_0x7b7e('0x3')]),_0x14f4fe);}};exports[_0x7b7e('0x1c')]=function(_0x49eddb){try{if(!_[_0x7b7e('0x1d')](agents[_0x49eddb[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util['format'](_0x7b7e('0x1f'),_0x49eddb[_0x7b7e('0x3')]),_0x49eddb);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x20'),_0x49eddb[_0x7b7e('0x3')],agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x49eddb['destuniqueid']));agents[_0x49eddb['destuniqueid']]['agentringnoanswer']=!![];agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();agents[_0x49eddb['destuniqueid']]['lastevent']='timeout';agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x7b7e('0x23');agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x49eddb['ringtime']?parseInt(_0x49eddb[_0x7b7e('0x25')])/0x3e8:0x0;agents[_0x49eddb[_0x7b7e('0x13')]]['talktime']=0x0;unanswered['push'](_0x49eddb['destuniqueid']);}}catch(_0x12ef0b){utils[_0x7b7e('0x1a')](util['format'](_0x7b7e('0x1f'),_0x49eddb['uniqueid']),_0x12ef0b);}};exports[_0x7b7e('0x26')]=function(_0xb9b6bf){try{_[_0x7b7e('0x27')](agents,function(_0x5515ca,_0x3960b8){if(_0x5515ca[_0x7b7e('0x3')]==_0xb9b6bf[_0x7b7e('0x3')]&&!_[_0x7b7e('0x28')](unanswered,_0x5515ca[_0x7b7e('0x13')])){utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][queuecallerabandon]',_0xb9b6bf[_0x7b7e('0x3')]),_0xb9b6bf);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x29'),_0xb9b6bf[_0x7b7e('0x3')],_0x5515ca[_0x7b7e('0x19')],_0x5515ca[_0x7b7e('0x13')]));_0x5515ca['agentringnoanswer']=!![];_0x5515ca['agentringnoanswerAt']=utils[_0x7b7e('0x15')]();_0x5515ca[_0x7b7e('0x8')]='abandoned';_0x5515ca[_0x7b7e('0x22')]=_0x7b7e('0x2a');_0x5515ca[_0x7b7e('0x24')]=_0xb9b6bf['holdtime'];_0x5515ca[_0x7b7e('0x2b')]=0x0;writeDB(_0x5515ca);}});}catch(_0x256908){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x2c'),_0xb9b6bf[_0x7b7e('0x3')]),_0x256908);}};exports[_0x7b7e('0x2d')]=function(_0x202f04){try{if(agents[_0x202f04[_0x7b7e('0x13')]]){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x2e'),_0x202f04[_0x7b7e('0x3')]),_0x202f04);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x2f'),_0x202f04['uniqueid'],agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x202f04[_0x7b7e('0x13')]));agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x7')]=_0x202f04[_0x7b7e('0x7')];agents[_0x202f04[_0x7b7e('0x13')]]['connectedlinename']=_0x202f04[_0x7b7e('0x16')];agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];agents[_0x202f04['destuniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x31');_[_0x7b7e('0x27')](agents,function(_0x5c58c0,_0x4a2888){if(_0x5c58c0[_0x7b7e('0x13')]!=_0x202f04['destuniqueid']&&_0x5c58c0[_0x7b7e('0x3')]==_0x202f04[_0x7b7e('0x3')]){_0x5c58c0['talktime']=0x0;_0x5c58c0[_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];_0x5c58c0[_0x7b7e('0x1c')]=!![];_0x5c58c0[_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();_0x5c58c0[_0x7b7e('0x8')]=_0x7b7e('0x32');_0x5c58c0[_0x7b7e('0x22')]=_0x7b7e('0x32');_0x5c58c0['answeredelsewheredestinationuniqueid']=_0x202f04['destuniqueid'];_0x5c58c0[_0x7b7e('0x33')]=_0x202f04['membername'];writeDB(_0x5c58c0);}});}}catch(_0x41c8a6){utils['error'](util['format'](_0x7b7e('0x2e'),_0x202f04['uniqueid']),_0x41c8a6);}};exports[_0x7b7e('0x34')]=function(_0x52051c){try{if(!_[_0x7b7e('0x1d')](agents[_0x52051c[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')]('[%s][agents][agentcomplete]',_0x52051c[_0x7b7e('0x3')]),_0x52051c);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x35'),_0x52051c[_0x7b7e('0x3')],agents[_0x52051c[_0x7b7e('0x13')]]['membername'],_0x52051c['destuniqueid']));agents[_0x52051c['destuniqueid']][_0x7b7e('0x34')]=!![];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x2b')]=utils['diffTime'](agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')],agents[_0x52051c['destuniqueid']]['agentconnectAt']);agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x52051c[_0x7b7e('0x22')];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x8')]=_0x7b7e('0x37');writeDB(agents[_0x52051c['destuniqueid']]);}}catch(_0x2673eb){utils['error'](util[_0x7b7e('0x2')](_0x7b7e('0x38'),_0x52051c[_0x7b7e('0x3')]),_0x2673eb);}};exports[_0x7b7e('0x39')]=function(_0x58e4e6){try{if(!_[_0x7b7e('0x1d')](agents[_0x58e4e6[_0x7b7e('0x3a')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6['uniqueid']),_0x58e4e6);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x3c'),_0x58e4e6[_0x7b7e('0x3')],agents[_0x58e4e6[_0x7b7e('0x3a')]]['membername'],agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3')]));agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3d')]=!![];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3e')]=_0x7b7e('0x3f');agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x40')]=_0x58e4e6['extension'];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x41')]=agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x3')];}}catch(_0x44e3a0){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6[_0x7b7e('0x3')]),_0x44e3a0);}};exports[_0x7b7e('0x42')]=function(_0x5f15ce){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x5f15ce);if(_0x5f15ce['origtransfereruniqueid']==_0x5f15ce['origtransfererlinkedid']){if(!_['isNil'](agents[_0x5f15ce[_0x7b7e('0x45')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5f15ce['origtransfereruniqueid'],agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x19')]));agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x40')]=_0x5f15ce['origtransfererexten'];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x41')]=_0x5f15ce[_0x7b7e('0x44')];}if(_0x5f15ce[_0x7b7e('0x46')]&&agents[_0x5f15ce[_0x7b7e('0x46')]]){agents[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x46')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfereeuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x6')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x49')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x2;}}else if(_0x5f15ce[_0x7b7e('0x45')]==_0x5f15ce['secondtransfererlinkedid']){if(!_[_0x7b7e('0x1d')](agents[_0x5f15ce[_0x7b7e('0x44')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x4a'),_0x5f15ce[_0x7b7e('0x44')],agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x19')]));agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x40')]=_0x5f15ce[_0x7b7e('0x4b')];agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x41')]=_0x5f15ce['secondtransfereruniqueid'];}if(_0x5f15ce[_0x7b7e('0x4c')]&&agents[_0x5f15ce[_0x7b7e('0x4c')]]){agents[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x4c')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfertargetuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x4c')]]['calleridnum']=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce['transfertargetuniqueid']][_0x7b7e('0x49')]=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentcalledAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentconnectAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x2;}}}catch(_0x2147d9){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x2147d9);}};exports['hangup']=function(_0x59ecf9){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9[_0x7b7e('0x3')]),_0x59ecf9);if(agents[_0x59ecf9[_0x7b7e('0x3')]]&&agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]==='timeout'){if(_0x59ecf9[_0x7b7e('0x4e')]==='21'){agents[_0x59ecf9[_0x7b7e('0x3')]]['reason']=_0x7b7e('0x4f');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x4f');}utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]]['reason'],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);var _0x122053=unanswered[_0x7b7e('0x51')](_0x59ecf9[_0x7b7e('0x3')]);if(_0x122053>-0x1){unanswered[_0x7b7e('0x52')](_0x122053,0x1);}}if(transfers[_0x59ecf9['uniqueid']]){transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x34')]=!![];transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt']=utils[_0x7b7e('0x15')]();transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt'],transfers[_0x59ecf9['uniqueid']]['agentconnectAt']);transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=_0x7b7e('0x54');transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x22')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(transfers[_0x59ecf9[_0x7b7e('0x3')]],!![]);}if(agents[_0x59ecf9['uniqueid']]&&agents[_0x59ecf9['uniqueid']][_0x7b7e('0x30')]){agents[_0x59ecf9['uniqueid']][_0x7b7e('0x34')]=!![];agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x59ecf9['uniqueid']][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x30')]);agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x3d')]?_0x7b7e('0x3d'):_0x7b7e('0x54');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')],agents[_0x59ecf9[_0x7b7e('0x3')]]['lastevent']));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);}}catch(_0x3880be){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9['uniqueid']),_0x3880be);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b714db7..d3c34da 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 _0x5d0a=['xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','substring','lastIndexOf','includes','hangup','execif','gotoif','lastapplication','[%s][calls][newexten]','lodash','util','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<'];(function(_0x2f1f5a,_0xe16335){var _0x113ec4=function(_0x232b79){while(--_0x232b79){_0x2f1f5a['push'](_0x2f1f5a['shift']());}};_0x113ec4(++_0xe16335);}(_0x5d0a,0x173));var _0xa5d0=function(_0x1894f2,_0x1fa9db){_0x1894f2=_0x1894f2-0x0;var _0x9c2a8c=_0x5d0a[_0x1894f2];return _0x9c2a8c;};'use strict';var _=require(_0xa5d0('0x0'));var util=require(_0xa5d0('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xa5d0('0x2'),_0xa5d0('0x2'),_0xa5d0('0x3'),_0xa5d0('0x3'),_0xa5d0('0x3'),_0xa5d0('0x4'),_0xa5d0('0x5'),_0xa5d0('0x2'),'FAILED',_0xa5d0('0x2')];var channels={};function writeDB(_0x56c62a){var _0x42574b;if(transfers[_0xa5d0('0x6')][_0x56c62a[_0xa5d0('0x7')]]){_0x42574b=_0x56c62a[_0xa5d0('0x7')];_0x56c62a[_0xa5d0('0x7')]=transfers[_0xa5d0('0x6')][_0x56c62a[_0xa5d0('0x7')]][_0xa5d0('0x8')];}utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')](_0xa5d0('0xb'),_0x56c62a[_0xa5d0('0x7')],_0x56c62a[_0xa5d0('0xc')],_0x56c62a[_0xa5d0('0xd')],_0x56c62a['membername'],_0x56c62a[_0xa5d0('0xe')],_0x56c62a[_0xa5d0('0xf')],_0x56c62a[_0xa5d0('0x10')],_0x56c62a[_0xa5d0('0x11')]));if(_0x56c62a[_0xa5d0('0x12')]){utils[_0xa5d0('0x13')](_0x56c62a[_0xa5d0('0x12')])[_0xa5d0('0x14')](function(_0x5f0754){if(_0x5f0754){_0x56c62a[_0xa5d0('0x15')]=_0x5f0754['id'];}utils[_0xa5d0('0x16')](_0xa5d0('0x17'),_0x56c62a);});}else{utils['request'](_0xa5d0('0x17'),_0x56c62a);}if(channels[_0x56c62a[_0xa5d0('0x7')]]){delete channels[_0x56c62a[_0xa5d0('0x7')]];}else if(_0x42574b&&channels[_0x42574b]){if(!transfers[_0xa5d0('0x6')][_0x42574b]['recording'])delete transfers[_0xa5d0('0x6')][_0x42574b];delete channels[_0x42574b];}}exports[_0xa5d0('0x18')]=function(_0x2095f7){try{utils['debug'](util[_0xa5d0('0xa')](_0xa5d0('0x19'),_0x2095f7['uniqueid']),_0x2095f7);if(_0x2095f7[_0xa5d0('0x7')]==_0x2095f7['linkedid']&&_0x2095f7[_0xa5d0('0xc')]!=_0xa5d0('0x1a')){utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')](_0xa5d0('0x1b'),_0x2095f7[_0xa5d0('0x7')],_0x2095f7[_0xa5d0('0x1c')],_0x2095f7[_0xa5d0('0x1d')]));channels[_0x2095f7[_0xa5d0('0x7')]]={'uniqueid':_0x2095f7[_0xa5d0('0x7')],'accountcode':_0x2095f7[_0xa5d0('0x12')],'source':_0x2095f7[_0xa5d0('0xf')],'destination':_0x2095f7[_0xa5d0('0x1d')],'destinationcontext':_0x2095f7[_0xa5d0('0x1c')],'channel':_0x2095f7['channel'],'starttime':utils[_0xa5d0('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa5d0('0x3'),'amaflags':_0xa5d0('0x1f')};}}catch(_0x583794){utils[_0xa5d0('0x20')](util[_0xa5d0('0xa')]('[%s][calls][newchannel]',_0x2095f7[_0xa5d0('0x7')]),_0x583794);}};exports[_0xa5d0('0x21')]=function(_0x7841ca){try{utils[_0xa5d0('0x22')](util[_0xa5d0('0xa')](_0xa5d0('0x23'),_0x7841ca[_0xa5d0('0x7')]),_0x7841ca);if(!_[_0xa5d0('0x24')](channels[_0x7841ca[_0xa5d0('0x7')]])&&_0x7841ca[_0xa5d0('0x25')]==0x6){utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')](_0xa5d0('0x26'),_0x7841ca[_0xa5d0('0x7')],_0x7841ca[_0xa5d0('0x1c')],_0x7841ca['channel']));if(_[_0xa5d0('0x24')](channels[_0x7841ca[_0xa5d0('0x7')]][_0xa5d0('0x27')])){channels[_0x7841ca['uniqueid']]['systemanswertime']=utils[_0xa5d0('0x1e')]();}}else if(!_[_0xa5d0('0x24')](channels[_0x7841ca[_0xa5d0('0x28')]])&&_0x7841ca[_0xa5d0('0x25')]==0x6&&_0x7841ca[_0xa5d0('0x1c')]!=_0xa5d0('0x29')){utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')](_0xa5d0('0x2a'),_0x7841ca[_0xa5d0('0x7')],_0x7841ca[_0xa5d0('0x28')],_0x7841ca[_0xa5d0('0x1c')],_0x7841ca[_0xa5d0('0xc')]));channels[_0x7841ca['linkedid']]['accountcode']=_0x7841ca['accountcode'];channels[_0x7841ca[_0xa5d0('0x28')]][_0xa5d0('0x2b')]=_0x7841ca[_0xa5d0('0xc')];if(_[_0xa5d0('0x24')](channels[_0x7841ca['linkedid']]['answertime'])){channels[_0x7841ca[_0xa5d0('0x28')]][_0xa5d0('0x2c')]=utils[_0xa5d0('0x1e')]();}channels[_0x7841ca[_0xa5d0('0x28')]][_0xa5d0('0x2d')]=dispositions[_[_0xa5d0('0x2e')](_0x7841ca[_0xa5d0('0x25')])]||_0xa5d0('0x4');}}catch(_0x4faf93){utils[_0xa5d0('0x20')](util[_0xa5d0('0xa')](_0xa5d0('0x23'),_0x7841ca[_0xa5d0('0x7')]),_0x4faf93);}};exports['hangup']=function(_0x399185){try{if(!_['isNil'](channels[_0x399185[_0xa5d0('0x7')]])){utils['debug'](util[_0xa5d0('0xa')](_0xa5d0('0x2f'),_0x399185['uniqueid']),_0x399185);if(_[_0xa5d0('0x24')](channels[_0x399185[_0xa5d0('0x7')]][_0xa5d0('0x30')])){channels[_0x399185[_0xa5d0('0x7')]][_0xa5d0('0x30')]=_0x399185[_0xa5d0('0x31')]+'\x20<'+_0x399185['calleridnum']+'>';}utils['info'](util[_0xa5d0('0xa')](_0xa5d0('0x32'),_0x399185[_0xa5d0('0x7')],channels[_0x399185[_0xa5d0('0x7')]][_0xa5d0('0x30')],_0x399185[_0xa5d0('0x33')]));channels[_0x399185[_0xa5d0('0x7')]][_0xa5d0('0x34')]=utils[_0xa5d0('0x1e')]();channels[_0x399185[_0xa5d0('0x7')]]['duration']=utils[_0xa5d0('0x35')](channels[_0x399185['uniqueid']][_0xa5d0('0x34')],channels[_0x399185[_0xa5d0('0x7')]][_0xa5d0('0x36')]);channels[_0x399185[_0xa5d0('0x7')]]['billableseconds']=channels[_0x399185['uniqueid']][_0xa5d0('0x2c')]?utils['diffTime'](channels[_0x399185[_0xa5d0('0x7')]][_0xa5d0('0x34')],channels[_0x399185[_0xa5d0('0x7')]][_0xa5d0('0x2c')]):0x0;writeDB(channels[_0x399185[_0xa5d0('0x7')]]);}}catch(_0x4388f8){utils[_0xa5d0('0x20')](util[_0xa5d0('0xa')](_0xa5d0('0x2f'),_0x399185[_0xa5d0('0x7')]),_0x4388f8);}};exports[_0xa5d0('0x37')]=function(_0x289c3e){try{if(!_['isNil'](channels[_0x289c3e['localtwolinkedid']])){utils[_0xa5d0('0x22')](util[_0xa5d0('0xa')](_0xa5d0('0x38'),_0x289c3e[_0xa5d0('0x39')]),_0x289c3e);if(channels[_0x289c3e[_0xa5d0('0x3a')]][_0xa5d0('0xc')]==_0x289c3e[_0xa5d0('0x3b')]){utils[_0xa5d0('0x9')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x289c3e['origtransfereruniqueid'],_0x289c3e[_0xa5d0('0x3a')],_0x289c3e[_0xa5d0('0x3c')]));channels[_0x289c3e[_0xa5d0('0x3a')]][_0xa5d0('0x2b')]=_0x289c3e[_0xa5d0('0x3c')];channels[_0x289c3e[_0xa5d0('0x3a')]][_0xa5d0('0x3d')]=_0xa5d0('0x3e');}else if(channels[_0x289c3e['localtwolinkedid']][_0xa5d0('0xc')]=_0x289c3e[_0xa5d0('0x3f')]){utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x289c3e['origtransfereruniqueid'],_0x289c3e['localtwolinkedid'],_0x289c3e[_0xa5d0('0x40')]));channels[_0x289c3e[_0xa5d0('0x3a')]][_0xa5d0('0x2b')]=_0x289c3e[_0xa5d0('0x40')];channels[_0x289c3e[_0xa5d0('0x3a')]][_0xa5d0('0x3d')]=_0xa5d0('0x3e');}}}catch(_0x265f60){utils['error'](util['format'](_0xa5d0('0x38'),_0x289c3e[_0xa5d0('0x39')]),_0x265f60);}};exports[_0xa5d0('0x41')]=function(_0x5916a7){try{if(!_[_0xa5d0('0x24')](channels[_0x5916a7[_0xa5d0('0x7')]])){utils[_0xa5d0('0x22')](util[_0xa5d0('0xa')](_0xa5d0('0x42'),_0x5916a7[_0xa5d0('0x7')]),_0x5916a7);channels[_0x5916a7[_0xa5d0('0x7')]]['musiconholdstartAt']=utils['now']();utils['info'](util[_0xa5d0('0xa')](_0xa5d0('0x43'),_0x5916a7[_0xa5d0('0x7')],channels[_0x5916a7[_0xa5d0('0x7')]][_0xa5d0('0x44')]));}}catch(_0x2ee350){utils[_0xa5d0('0x20')](util[_0xa5d0('0xa')](_0xa5d0('0x42'),_0x5916a7['uniqueid']),_0x2ee350);}};exports[_0xa5d0('0x45')]=function(_0x6d9e59){try{if(!_[_0xa5d0('0x24')](channels[_0x6d9e59['uniqueid']])){utils[_0xa5d0('0x22')](util['format'](_0xa5d0('0x46'),_0x6d9e59[_0xa5d0('0x7')]),_0x6d9e59);if(!_[_0xa5d0('0x24')](channels[_0x6d9e59['uniqueid']][_0xa5d0('0x44')])){channels[_0x6d9e59[_0xa5d0('0x7')]][_0xa5d0('0x47')]+=utils[_0xa5d0('0x35')](utils[_0xa5d0('0x1e')](),channels[_0x6d9e59[_0xa5d0('0x7')]][_0xa5d0('0x44')]);utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')](_0xa5d0('0x48'),_0x6d9e59['uniqueid'],channels[_0x6d9e59[_0xa5d0('0x7')]][_0xa5d0('0x47')]));delete channels[_0x6d9e59[_0xa5d0('0x7')]][_0xa5d0('0x44')];}}}catch(_0x587140){utils['error'](util[_0xa5d0('0xa')](_0xa5d0('0x46'),_0x6d9e59['uniqueid']),_0x587140);}};exports[_0xa5d0('0x49')]=function(_0x2a96b4){try{if(!_[_0xa5d0('0x24')](channels[_0x2a96b4[_0xa5d0('0x7')]])){utils[_0xa5d0('0x22')](util['format']('[%s][calls][varset]',_0x2a96b4[_0xa5d0('0x7')]),_0x2a96b4);if(!_[_0xa5d0('0x24')](_0x2a96b4[_0xa5d0('0x4a')]['xmd-originatecalleridnum'])){utils['info'](util[_0xa5d0('0xa')](_0xa5d0('0x4b'),_0x2a96b4['uniqueid'],_0x2a96b4['value']));channels[_0x2a96b4[_0xa5d0('0x7')]]['source']=_0x2a96b4[_0xa5d0('0x4c')];}if(!_[_0xa5d0('0x24')](_0x2a96b4['variable'][_0xa5d0('0x4d')])){utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')](_0xa5d0('0x4e'),_0x2a96b4['uniqueid'],_0x2a96b4[_0xa5d0('0x4c')]));channels[_0x2a96b4[_0xa5d0('0x7')]][_0xa5d0('0x4f')]=_0x2a96b4[_0xa5d0('0x4c')];channels[_0x2a96b4[_0xa5d0('0x7')]][_0xa5d0('0x30')]='\x22'+_0x2a96b4[_0xa5d0('0x4c')]+_0xa5d0('0x50')+_0x2a96b4[_0xa5d0('0x4c')]+'>';}if(!_['isNil'](_0x2a96b4['variable'][_0xa5d0('0x51')])||!_[_0xa5d0('0x24')](_0x2a96b4[_0xa5d0('0x4a')][_0xa5d0('0x52')])){utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')](_0xa5d0('0x53'),_0x2a96b4[_0xa5d0('0x7')],!_['isNil'](_0x2a96b4[_0xa5d0('0x4a')][_0xa5d0('0x51')])?_0xa5d0('0x51'):_0xa5d0('0x52'),_0x2a96b4[_0xa5d0('0x4c')]));channels[_0x2a96b4[_0xa5d0('0x7')]][_0xa5d0('0x30')]=_0x2a96b4[_0xa5d0('0x4c')];}if(!_[_0xa5d0('0x24')](_0x2a96b4['variable']['xmd-queue'])||!_[_0xa5d0('0x24')](_0x2a96b4['variable'][_0xa5d0('0x54')])){utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')](_0xa5d0('0x53'),_0x2a96b4[_0xa5d0('0x7')],!_[_0xa5d0('0x24')](_0x2a96b4[_0xa5d0('0x4a')][_0xa5d0('0x55')])?_0xa5d0('0x55'):_0xa5d0('0x54'),_0x2a96b4[_0xa5d0('0x4c')]));channels[_0x2a96b4[_0xa5d0('0x7')]]['lastapplication']=_0xa5d0('0x56');channels[_0x2a96b4['uniqueid']][_0xa5d0('0x57')]=_0x2a96b4['value'];channels[_0x2a96b4[_0xa5d0('0x7')]][_0xa5d0('0xd')]=!![];}if(!_[_0xa5d0('0x24')](_0x2a96b4[_0xa5d0('0x4a')][_0xa5d0('0x58')])){utils['info'](util[_0xa5d0('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x2a96b4[_0xa5d0('0x7')],_0x2a96b4[_0xa5d0('0x4c')]));channels[_0x2a96b4['uniqueid']][_0xa5d0('0x59')]=_0x2a96b4[_0xa5d0('0x4c')];}if(!_[_0xa5d0('0x24')](_0x2a96b4[_0xa5d0('0x4a')][_0xa5d0('0x5a')])){utils['info'](util[_0xa5d0('0xa')](_0xa5d0('0x5b'),_0x2a96b4[_0xa5d0('0x7')],_0x2a96b4[_0xa5d0('0x4c')]));channels[_0x2a96b4[_0xa5d0('0x7')]][_0xa5d0('0x5c')]=_0x2a96b4['value'];}if(!_[_0xa5d0('0x24')](_0x2a96b4[_0xa5d0('0x4a')][_0xa5d0('0x5d')])){utils[_0xa5d0('0x9')](util[_0xa5d0('0xa')](_0xa5d0('0x5e'),_0x2a96b4['uniqueid'],_0x2a96b4['value']));channels[_0x2a96b4[_0xa5d0('0x7')]][_0xa5d0('0x5f')]=_0x2a96b4['value'];}if(!_[_0xa5d0('0x24')](_0x2a96b4[_0xa5d0('0x4a')]['sipcallid'])){utils['info'](util[_0xa5d0('0xa')](_0xa5d0('0x60'),_0x2a96b4[_0xa5d0('0x7')],_0x2a96b4[_0xa5d0('0x4c')]));channels[_0x2a96b4[_0xa5d0('0x7')]][_0xa5d0('0x61')]=_0x2a96b4[_0xa5d0('0x4c')];}}}catch(_0x4db3d4){utils['error'](util[_0xa5d0('0xa')]('[%s][calls][varset]',_0x2a96b4['uniqueid']),_0x4db3d4);}};exports[_0xa5d0('0x62')]=function(_0x3c0e5c){try{if(!_[_0xa5d0('0x24')](channels[_0x3c0e5c['uniqueid']])){utils[_0xa5d0('0x22')](util[_0xa5d0('0xa')]('[%s][calls][newexten]',_0x3c0e5c['uniqueid']),_0x3c0e5c);utils['info'](util[_0xa5d0('0xa')](_0xa5d0('0x63'),_0x3c0e5c[_0xa5d0('0x7')],_0x3c0e5c['application'],_0x3c0e5c['appdata']));if(_0x3c0e5c[_0xa5d0('0x64')][_0xa5d0('0x65')]()==_0xa5d0('0x66')&&_['startsWith'](_0x3c0e5c[_0xa5d0('0x67')][_0xa5d0('0x65')](),'cdr')){var _0x1cc139=_0x3c0e5c['appdata'][_0xa5d0('0x68')]('=');var _0x40a7d5=_0x1cc139[0x0][_0xa5d0('0x69')](_0x1cc139[0x0][_0xa5d0('0x6a')]('(')+0x1,_0x1cc139[0x0][_0xa5d0('0x6a')](')'));var _0x23095e=_0x1cc139[0x1];channels[_0x3c0e5c['uniqueid']][_0x40a7d5]=_0x23095e;}if(!_[_0xa5d0('0x6b')]([_0xa5d0('0x6c'),'noop',_0xa5d0('0x6d'),_0xa5d0('0x66'),_0xa5d0('0x6e')],_0x3c0e5c[_0xa5d0('0x64')]['toLowerCase']())){channels[_0x3c0e5c[_0xa5d0('0x7')]][_0xa5d0('0x6f')]=_0x3c0e5c[_0xa5d0('0x64')];channels[_0x3c0e5c['uniqueid']][_0xa5d0('0x57')]=_0x3c0e5c['appdata'];}}}catch(_0x1394d8){utils['error'](util[_0xa5d0('0xa')](_0xa5d0('0x70'),_0x3c0e5c[_0xa5d0('0x7')]),_0x1394d8);}}; \ No newline at end of file +var _0x6003=['diffTime','starttime','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','substring','lastIndexOf','includes','noop','execif','set','gotoif','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration'];(function(_0x497393,_0x962359){var _0x2d8920=function(_0x2272ae){while(--_0x2272ae){_0x497393['push'](_0x497393['shift']());}};_0x2d8920(++_0x962359);}(_0x6003,0xae));var _0x3600=function(_0x1f48bc,_0xdeb35f){_0x1f48bc=_0x1f48bc-0x0;var _0x38fb9f=_0x6003[_0x1f48bc];return _0x38fb9f;};'use strict';var _=require(_0x3600('0x0'));var util=require(_0x3600('0x1'));var utils=require(_0x3600('0x2'));var transfers=require(_0x3600('0x3'));var dispositions=['NO\x20ANSWER','FAILED',_0x3600('0x4'),_0x3600('0x5'),_0x3600('0x5'),'NO\x20ANSWER',_0x3600('0x6'),_0x3600('0x7'),'FAILED',_0x3600('0x4'),'FAILED'];var channels={};function writeDB(_0x4880c7){var _0x177f11;if(transfers['blinds'][_0x4880c7[_0x3600('0x8')]]){_0x177f11=_0x4880c7['uniqueid'];_0x4880c7[_0x3600('0x8')]=transfers[_0x3600('0x9')][_0x4880c7[_0x3600('0x8')]][_0x3600('0xa')];}utils['info'](util[_0x3600('0xb')](_0x3600('0xc'),_0x4880c7[_0x3600('0x8')],_0x4880c7[_0x3600('0xd')],_0x4880c7[_0x3600('0xe')],_0x4880c7[_0x3600('0xf')],_0x4880c7[_0x3600('0x10')],_0x4880c7[_0x3600('0x11')],_0x4880c7[_0x3600('0x12')],_0x4880c7[_0x3600('0x13')]));if(_0x4880c7[_0x3600('0x14')]){utils[_0x3600('0x15')](_0x4880c7['accountcode'])[_0x3600('0x16')](function(_0x5704a0){if(_0x5704a0){_0x4880c7['UserId']=_0x5704a0['id'];}utils[_0x3600('0x17')](_0x3600('0x18'),_0x4880c7);});}else{utils[_0x3600('0x17')]('CreateVoiceCallReport',_0x4880c7);}if(channels[_0x4880c7[_0x3600('0x8')]]){delete channels[_0x4880c7['uniqueid']];}else if(_0x177f11&&channels[_0x177f11]){if(!transfers[_0x3600('0x9')][_0x177f11]['recording'])delete transfers[_0x3600('0x9')][_0x177f11];delete channels[_0x177f11];}}exports[_0x3600('0x19')]=function(_0x2d47ff){try{utils['debug'](util['format'](_0x3600('0x1a'),_0x2d47ff[_0x3600('0x8')]),_0x2d47ff);if(_0x2d47ff[_0x3600('0x8')]==_0x2d47ff[_0x3600('0x1b')]&&_0x2d47ff['channel']!=_0x3600('0x1c')){utils['info'](util[_0x3600('0xb')](_0x3600('0x1d'),_0x2d47ff[_0x3600('0x8')],_0x2d47ff['context'],_0x2d47ff[_0x3600('0x1e')]));channels[_0x2d47ff['uniqueid']]={'uniqueid':_0x2d47ff[_0x3600('0x8')],'accountcode':_0x2d47ff[_0x3600('0x14')],'source':_0x2d47ff[_0x3600('0x11')],'destination':_0x2d47ff[_0x3600('0x1e')],'destinationcontext':_0x2d47ff[_0x3600('0x1f')],'channel':_0x2d47ff['channel'],'starttime':utils[_0x3600('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3600('0x5'),'amaflags':_0x3600('0x21')};}}catch(_0x708430){utils[_0x3600('0x22')](util[_0x3600('0xb')](_0x3600('0x1a'),_0x2d47ff[_0x3600('0x8')]),_0x708430);}};exports[_0x3600('0x23')]=function(_0x328a0f){try{utils[_0x3600('0x24')](util['format'](_0x3600('0x25'),_0x328a0f['uniqueid']),_0x328a0f);if(!_[_0x3600('0x26')](channels[_0x328a0f['uniqueid']])&&_0x328a0f[_0x3600('0x27')]==0x6){utils[_0x3600('0x28')](util[_0x3600('0xb')](_0x3600('0x29'),_0x328a0f[_0x3600('0x8')],_0x328a0f[_0x3600('0x1f')],_0x328a0f['channel']));if(_[_0x3600('0x26')](channels[_0x328a0f[_0x3600('0x8')]]['systemanswertime'])){channels[_0x328a0f[_0x3600('0x8')]][_0x3600('0x2a')]=utils[_0x3600('0x20')]();}}else if(!_[_0x3600('0x26')](channels[_0x328a0f[_0x3600('0x1b')]])&&_0x328a0f[_0x3600('0x27')]==0x6&&_0x328a0f[_0x3600('0x1f')]!=_0x3600('0x2b')){utils['info'](util['format'](_0x3600('0x2c'),_0x328a0f['uniqueid'],_0x328a0f[_0x3600('0x1b')],_0x328a0f[_0x3600('0x1f')],_0x328a0f[_0x3600('0xd')]));channels[_0x328a0f['linkedid']]['accountcode']=_0x328a0f[_0x3600('0x14')];channels[_0x328a0f[_0x3600('0x1b')]]['destinationchannel']=_0x328a0f[_0x3600('0xd')];if(_[_0x3600('0x26')](channels[_0x328a0f[_0x3600('0x1b')]]['answertime'])){channels[_0x328a0f[_0x3600('0x1b')]][_0x3600('0x2d')]=utils[_0x3600('0x20')]();}channels[_0x328a0f[_0x3600('0x1b')]][_0x3600('0x2e')]=dispositions[_[_0x3600('0x2f')](_0x328a0f[_0x3600('0x27')])]||_0x3600('0x6');}}catch(_0x1d65c8){utils[_0x3600('0x22')](util[_0x3600('0xb')](_0x3600('0x25'),_0x328a0f[_0x3600('0x8')]),_0x1d65c8);}};exports['hangup']=function(_0xbb7470){try{if(!_['isNil'](channels[_0xbb7470[_0x3600('0x8')]])){utils['debug'](util[_0x3600('0xb')]('[%s][calls][hangup]',_0xbb7470[_0x3600('0x8')]),_0xbb7470);if(_[_0x3600('0x26')](channels[_0xbb7470[_0x3600('0x8')]][_0x3600('0x30')])){channels[_0xbb7470[_0x3600('0x8')]][_0x3600('0x30')]=_0xbb7470[_0x3600('0x31')]+'\x20<'+_0xbb7470[_0x3600('0x11')]+'>';}utils['info'](util['format'](_0x3600('0x32'),_0xbb7470[_0x3600('0x8')],channels[_0xbb7470[_0x3600('0x8')]]['callerid'],_0xbb7470[_0x3600('0x33')]));channels[_0xbb7470['uniqueid']][_0x3600('0x34')]=utils[_0x3600('0x20')]();channels[_0xbb7470['uniqueid']][_0x3600('0x35')]=utils[_0x3600('0x36')](channels[_0xbb7470[_0x3600('0x8')]][_0x3600('0x34')],channels[_0xbb7470[_0x3600('0x8')]][_0x3600('0x37')]);channels[_0xbb7470['uniqueid']]['billableseconds']=channels[_0xbb7470[_0x3600('0x8')]][_0x3600('0x2d')]?utils['diffTime'](channels[_0xbb7470['uniqueid']][_0x3600('0x34')],channels[_0xbb7470['uniqueid']][_0x3600('0x2d')]):0x0;writeDB(channels[_0xbb7470[_0x3600('0x8')]]);}}catch(_0x8fb4c8){utils[_0x3600('0x22')](util[_0x3600('0xb')]('[%s][calls][hangup]',_0xbb7470['uniqueid']),_0x8fb4c8);}};exports['attendedtransfer']=function(_0x954824){try{if(!_['isNil'](channels[_0x954824['localtwolinkedid']])){utils[_0x3600('0x24')](util[_0x3600('0xb')](_0x3600('0x38'),_0x954824[_0x3600('0x39')]),_0x954824);if(channels[_0x954824[_0x3600('0x3a')]]['channel']==_0x954824[_0x3600('0x3b')]){utils[_0x3600('0x28')](util[_0x3600('0xb')](_0x3600('0x3c'),_0x954824[_0x3600('0x39')],_0x954824[_0x3600('0x3a')],_0x954824[_0x3600('0x3d')]));channels[_0x954824[_0x3600('0x3a')]][_0x3600('0x3e')]=_0x954824[_0x3600('0x3d')];channels[_0x954824[_0x3600('0x3a')]][_0x3600('0x3f')]=_0x3600('0x40');}else if(channels[_0x954824[_0x3600('0x3a')]]['channel']=_0x954824[_0x3600('0x41')]){utils[_0x3600('0x28')](util['format'](_0x3600('0x3c'),_0x954824['origtransfereruniqueid'],_0x954824[_0x3600('0x3a')],_0x954824[_0x3600('0x42')]));channels[_0x954824[_0x3600('0x3a')]]['destinationchannel']=_0x954824[_0x3600('0x42')];channels[_0x954824[_0x3600('0x3a')]][_0x3600('0x3f')]=_0x3600('0x40');}}}catch(_0x4eeb22){utils[_0x3600('0x22')](util['format']('[%s][calls][attendedtransfer]',_0x954824['origtransfereruniqueid']),_0x4eeb22);}};exports[_0x3600('0x43')]=function(_0x5024dc){try{if(!_[_0x3600('0x26')](channels[_0x5024dc[_0x3600('0x8')]])){utils['debug'](util[_0x3600('0xb')](_0x3600('0x44'),_0x5024dc[_0x3600('0x8')]),_0x5024dc);channels[_0x5024dc[_0x3600('0x8')]]['musiconholdstartAt']=utils[_0x3600('0x20')]();utils[_0x3600('0x28')](util[_0x3600('0xb')](_0x3600('0x45'),_0x5024dc[_0x3600('0x8')],channels[_0x5024dc[_0x3600('0x8')]][_0x3600('0x46')]));}}catch(_0x490cfa){utils[_0x3600('0x22')](util[_0x3600('0xb')]('[%s][calls][musiconholdstart]',_0x5024dc[_0x3600('0x8')]),_0x490cfa);}};exports[_0x3600('0x47')]=function(_0x2a30ab){try{if(!_[_0x3600('0x26')](channels[_0x2a30ab[_0x3600('0x8')]])){utils[_0x3600('0x24')](util[_0x3600('0xb')](_0x3600('0x48'),_0x2a30ab[_0x3600('0x8')]),_0x2a30ab);if(!_[_0x3600('0x26')](channels[_0x2a30ab[_0x3600('0x8')]][_0x3600('0x46')])){channels[_0x2a30ab[_0x3600('0x8')]][_0x3600('0x49')]+=utils[_0x3600('0x36')](utils['now'](),channels[_0x2a30ab[_0x3600('0x8')]][_0x3600('0x46')]);utils[_0x3600('0x28')](util[_0x3600('0xb')](_0x3600('0x4a'),_0x2a30ab[_0x3600('0x8')],channels[_0x2a30ab['uniqueid']][_0x3600('0x49')]));delete channels[_0x2a30ab[_0x3600('0x8')]][_0x3600('0x46')];}}}catch(_0x39ce35){utils[_0x3600('0x22')](util[_0x3600('0xb')](_0x3600('0x48'),_0x2a30ab[_0x3600('0x8')]),_0x39ce35);}};exports[_0x3600('0x4b')]=function(_0x5bd8a1){try{if(!_[_0x3600('0x26')](channels[_0x5bd8a1[_0x3600('0x8')]])){utils[_0x3600('0x24')](util[_0x3600('0xb')](_0x3600('0x4c'),_0x5bd8a1[_0x3600('0x8')]),_0x5bd8a1);if(!_['isNil'](_0x5bd8a1[_0x3600('0x4d')][_0x3600('0x4e')])){utils[_0x3600('0x28')](util[_0x3600('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5bd8a1[_0x3600('0x8')],_0x5bd8a1[_0x3600('0x4f')]));channels[_0x5bd8a1[_0x3600('0x8')]][_0x3600('0x50')]=_0x5bd8a1['value'];}if(!_[_0x3600('0x26')](_0x5bd8a1['variable'][_0x3600('0x51')])){utils[_0x3600('0x28')](util[_0x3600('0xb')](_0x3600('0x52'),_0x5bd8a1[_0x3600('0x8')],_0x5bd8a1[_0x3600('0x4f')]));channels[_0x5bd8a1[_0x3600('0x8')]][_0x3600('0x53')]=_0x5bd8a1[_0x3600('0x4f')];channels[_0x5bd8a1[_0x3600('0x8')]][_0x3600('0x30')]='\x22'+_0x5bd8a1[_0x3600('0x4f')]+'\x22\x20<'+_0x5bd8a1[_0x3600('0x4f')]+'>';}if(!_[_0x3600('0x26')](_0x5bd8a1[_0x3600('0x4d')]['xmd-callerid-preview'])||!_[_0x3600('0x26')](_0x5bd8a1['variable'][_0x3600('0x54')])){utils[_0x3600('0x28')](util[_0x3600('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5bd8a1['uniqueid'],!_[_0x3600('0x26')](_0x5bd8a1['variable']['xmd-callerid-preview'])?_0x3600('0x55'):_0x3600('0x54'),_0x5bd8a1[_0x3600('0x4f')]));channels[_0x5bd8a1[_0x3600('0x8')]][_0x3600('0x30')]=_0x5bd8a1[_0x3600('0x4f')];}if(!_[_0x3600('0x26')](_0x5bd8a1[_0x3600('0x4d')][_0x3600('0x56')])||!_[_0x3600('0x26')](_0x5bd8a1[_0x3600('0x4d')][_0x3600('0x57')])){utils['info'](util['format'](_0x3600('0x58'),_0x5bd8a1['uniqueid'],!_[_0x3600('0x26')](_0x5bd8a1[_0x3600('0x4d')]['xmd-queue'])?_0x3600('0x56'):'xmcs-queue',_0x5bd8a1['value']));channels[_0x5bd8a1[_0x3600('0x8')]][_0x3600('0x59')]=_0x3600('0x5a');channels[_0x5bd8a1[_0x3600('0x8')]][_0x3600('0x5b')]=_0x5bd8a1[_0x3600('0x4f')];channels[_0x5bd8a1[_0x3600('0x8')]]['queue']=!![];}if(!_['isNil'](_0x5bd8a1[_0x3600('0x4d')]['xmd-contactid'])){utils[_0x3600('0x28')](util[_0x3600('0xb')](_0x3600('0x5c'),_0x5bd8a1['uniqueid'],_0x5bd8a1[_0x3600('0x4f')]));channels[_0x5bd8a1['uniqueid']][_0x3600('0x5d')]=_0x5bd8a1['value'];}if(!_[_0x3600('0x26')](_0x5bd8a1[_0x3600('0x4d')][_0x3600('0x5e')])){utils['info'](util[_0x3600('0xb')](_0x3600('0x5f'),_0x5bd8a1[_0x3600('0x8')],_0x5bd8a1['value']));channels[_0x5bd8a1[_0x3600('0x8')]]['type']=_0x5bd8a1[_0x3600('0x4f')];}if(!_['isNil'](_0x5bd8a1[_0x3600('0x4d')][_0x3600('0x60')])){utils[_0x3600('0x28')](util['format'](_0x3600('0x61'),_0x5bd8a1['uniqueid'],_0x5bd8a1['value']));channels[_0x5bd8a1['uniqueid']][_0x3600('0x62')]=_0x5bd8a1['value'];}if(!_[_0x3600('0x26')](_0x5bd8a1[_0x3600('0x4d')]['sipcallid'])){utils[_0x3600('0x28')](util[_0x3600('0xb')](_0x3600('0x63'),_0x5bd8a1[_0x3600('0x8')],_0x5bd8a1[_0x3600('0x4f')]));channels[_0x5bd8a1[_0x3600('0x8')]]['sipcallid']=_0x5bd8a1[_0x3600('0x4f')];}}}catch(_0x4ccc23){utils[_0x3600('0x22')](util[_0x3600('0xb')](_0x3600('0x4c'),_0x5bd8a1[_0x3600('0x8')]),_0x4ccc23);}};exports[_0x3600('0x64')]=function(_0x547508){try{if(!_[_0x3600('0x26')](channels[_0x547508[_0x3600('0x8')]])){utils[_0x3600('0x24')](util['format'](_0x3600('0x65'),_0x547508['uniqueid']),_0x547508);utils['info'](util[_0x3600('0xb')](_0x3600('0x66'),_0x547508['uniqueid'],_0x547508[_0x3600('0x67')],_0x547508[_0x3600('0x68')]));if(_0x547508['application'][_0x3600('0x69')]()=='set'&&_[_0x3600('0x6a')](_0x547508[_0x3600('0x68')][_0x3600('0x69')](),'cdr')){var _0x326c15=_0x547508[_0x3600('0x68')]['split']('=');var _0x4a0946=_0x326c15[0x0][_0x3600('0x6b')](_0x326c15[0x0][_0x3600('0x6c')]('(')+0x1,_0x326c15[0x0][_0x3600('0x6c')](')'));var _0x45e3b2=_0x326c15[0x1];channels[_0x547508[_0x3600('0x8')]][_0x4a0946]=_0x45e3b2;}if(!_[_0x3600('0x6d')](['hangup',_0x3600('0x6e'),_0x3600('0x6f'),_0x3600('0x70'),_0x3600('0x71')],_0x547508[_0x3600('0x67')][_0x3600('0x69')]())){channels[_0x547508[_0x3600('0x8')]]['lastapplication']=_0x547508[_0x3600('0x67')];channels[_0x547508['uniqueid']]['lastdata']=_0x547508[_0x3600('0x68')];}}}catch(_0x242fbb){utils[_0x3600('0x22')](util[_0x3600('0xb')](_0x3600('0x65'),_0x547508[_0x3600('0x8')]),_0x242fbb);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c0e609d..ae7781f 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 _0xed21=['[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x20210e,_0x1603f6){var _0x439c00=function(_0x5b4cc2){while(--_0x5b4cc2){_0x20210e['push'](_0x20210e['shift']());}};_0x439c00(++_0x1603f6);}(_0xed21,0x9e));var _0x1ed2=function(_0xf3c5e,_0x22fcc1){_0xf3c5e=_0xf3c5e-0x0;var _0x562f2b=_0xed21[_0xf3c5e];return _0x562f2b;};'use strict';var utils=require(_0x1ed2('0x0'));exports[_0x1ed2('0x1')]=function(){utils[_0x1ed2('0x2')](_0x1ed2('0x3'));};exports['shutdown']=function(){utils[_0x1ed2('0x2')](_0x1ed2('0x4'));};exports[_0x1ed2('0x5')]=function(){utils[_0x1ed2('0x2')](_0x1ed2('0x6'));};exports[_0x1ed2('0x7')]=function(_0x1f92d6){utils[_0x1ed2('0x7')](_0x1ed2('0x8'),_0x1f92d6);};exports[_0x1ed2('0x9')]=function(){utils[_0x1ed2('0x2')](_0x1ed2('0xa'));};exports[_0x1ed2('0xb')]=function(_0x27a300){}; \ No newline at end of file +var _0x689b=['connect','info','shutdown','fullybooted','[core]\x20fullybooted','close','[core]\x20close','managerevent','./utils'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0x689b,0x1a6));var _0xb689=function(_0x3019fc,_0x2dd93e){_0x3019fc=_0x3019fc-0x0;var _0x44c26c=_0x689b[_0x3019fc];return _0x44c26c;};'use strict';var utils=require(_0xb689('0x0'));exports[_0xb689('0x1')]=function(){utils[_0xb689('0x2')]('[core]\x20connected');};exports[_0xb689('0x3')]=function(){utils[_0xb689('0x2')]('[core]\x20shutdown');};exports[_0xb689('0x4')]=function(){utils[_0xb689('0x2')](_0xb689('0x5'));};exports['error']=function(_0x477059){utils['error']('[core]\x20error',_0x477059);};exports[_0xb689('0x6')]=function(){utils[_0xb689('0x2')](_0xb689('0x7'));};exports[_0xb689('0x8')]=function(_0x1a9d0b){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b8f5351..50a75b6 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 _0x04b3=['error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialend]','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','complete','duration','diffTime','endtime','billableseconds','lodash','util','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split'];(function(_0x10bf5c,_0x2fdc30){var _0x4c5791=function(_0x38be8a){while(--_0x38be8a){_0x10bf5c['push'](_0x10bf5c['shift']());}};_0x4c5791(++_0x2fdc30);}(_0x04b3,0x10c));var _0x304b=function(_0x30b289,_0x4bd0a9){_0x30b289=_0x30b289-0x0;var _0xa92a8e=_0x04b3[_0x30b289];return _0xa92a8e;};'use strict';var _=require(_0x304b('0x0'));var util=require(_0x304b('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x49b7da){utils['info'](util[_0x304b('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x49b7da[_0x304b('0x3')],_0x49b7da[_0x304b('0x4')],_0x49b7da[_0x304b('0x5')],_0x49b7da[_0x304b('0x6')],_0x49b7da[_0x304b('0x7')],_0x49b7da['dialstatus']));utils['request'](_0x304b('0x8'),_0x49b7da);delete dials[_0x49b7da[_0x304b('0x3')]];}exports[_0x304b('0x9')]=function(_0x5e9032){try{utils[_0x304b('0xa')](util[_0x304b('0x2')](_0x304b('0xb'),_0x5e9032['uniqueid']),_0x5e9032);utils[_0x304b('0xc')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x5e9032[_0x304b('0x3')],_0x5e9032[_0x304b('0xd')],_0x5e9032[_0x304b('0xe')]));if(_0x5e9032['application']['toLowerCase']()==_0x304b('0xf')&&_[_0x304b('0x10')](_0x5e9032['appdata'][_0x304b('0x11')](),_0x304b('0x12'))){var _0x17dda5=_0x5e9032[_0x304b('0xe')][_0x304b('0x13')]('=');dials[_0x5e9032[_0x304b('0x3')]]={'routeId':_0x17dda5[0x1]};}}catch(_0x314e91){utils[_0x304b('0x14')](util['format'](_0x304b('0xb'),_0x5e9032[_0x304b('0x3')]),_0x314e91);}};exports[_0x304b('0x15')]=function(_0x2ab640){try{utils['debug'](util[_0x304b('0x2')](_0x304b('0x16'),_0x2ab640[_0x304b('0x3')]),_0x2ab640);if(!_[_0x304b('0x17')](_0x2ab640[_0x304b('0x18')][_0x304b('0x19')])){utils[_0x304b('0xc')](util[_0x304b('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x2ab640['uniqueid'],_0x2ab640[_0x304b('0x1a')]));dials[_0x2ab640[_0x304b('0x3')]]={'routeId':_0x2ab640['value']};}}catch(_0x18f94a){utils[_0x304b('0x14')](util[_0x304b('0x2')]('[%s][dials][varset]',_0x2ab640[_0x304b('0x3')]),_0x18f94a);}};exports[_0x304b('0x1b')]=function(_0x6873d2){try{if(!_['isNil'](dials[_0x6873d2[_0x304b('0x3')]])){utils['debug'](util['format'](_0x304b('0x1c'),_0x6873d2['uniqueid']),_0x6873d2);dials[_0x6873d2['uniqueid']]=_[_0x304b('0x1d')](dials[_0x6873d2['uniqueid']],_0x6873d2);dials[_0x6873d2['uniqueid']]['starttime']=utils[_0x304b('0x1e')]();dials[_0x6873d2[_0x304b('0x3')]][_0x304b('0x1f')]=_0x304b('0x20');utils['info'](util[_0x304b('0x2')](_0x304b('0x21'),_0x6873d2[_0x304b('0x3')],dials[_0x6873d2['uniqueid']][_0x304b('0x22')]));}}catch(_0x61dc6a){utils['error'](util[_0x304b('0x2')](_0x304b('0x1c'),_0x6873d2[_0x304b('0x3')]),_0x61dc6a);}};exports['dialend']=function(_0x3cc924){try{if(!_[_0x304b('0x17')](dials[_0x3cc924[_0x304b('0x3')]])){utils[_0x304b('0xa')](util[_0x304b('0x2')](_0x304b('0x23'),_0x3cc924[_0x304b('0x3')]),_0x3cc924);dials[_0x3cc924['uniqueid']][_0x304b('0x24')]=_0x3cc924[_0x304b('0x24')];if(_0x3cc924[_0x304b('0x24')]=='ANSWER'){dials[_0x3cc924[_0x304b('0x3')]]=_[_0x304b('0x1d')](dials[_0x3cc924[_0x304b('0x3')]],_0x3cc924);dials[_0x3cc924['uniqueid']][_0x304b('0x25')]=utils['now']();dials[_0x3cc924[_0x304b('0x3')]][_0x304b('0x1f')]=_0x304b('0x26');utils[_0x304b('0xc')](util[_0x304b('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3cc924[_0x304b('0x3')],_0x3cc924['dialstatus'],dials[_0x3cc924['uniqueid']][_0x304b('0x25')]));}else{utils[_0x304b('0xc')](util['format'](_0x304b('0x27'),_0x3cc924[_0x304b('0x3')],_0x3cc924[_0x304b('0x24')]));}}}catch(_0x4f4511){utils['error'](util[_0x304b('0x2')](_0x304b('0x23'),_0x3cc924[_0x304b('0x3')]),_0x4f4511);}};exports[_0x304b('0x28')]=function(_0x587bc2){try{if(!_[_0x304b('0x17')](dials[_0x587bc2['uniqueid']])){utils[_0x304b('0xa')](util[_0x304b('0x2')](_0x304b('0x29'),_0x587bc2[_0x304b('0x3')]),_0x587bc2);utils[_0x304b('0xc')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x587bc2['uniqueid'],_0x587bc2[_0x304b('0x6')],_0x587bc2[_0x304b('0x2a')],_0x587bc2['cause-txt']));dials[_0x587bc2[_0x304b('0x3')]]=_[_0x304b('0x1d')](dials[_0x587bc2[_0x304b('0x3')]],{'endtime':utils[_0x304b('0x1e')](),'lastevent':_0x304b('0x2b')});dials[_0x587bc2['uniqueid']][_0x304b('0x2c')]=utils[_0x304b('0x2d')](dials[_0x587bc2[_0x304b('0x3')]][_0x304b('0x2e')],dials[_0x587bc2[_0x304b('0x3')]][_0x304b('0x22')]);dials[_0x587bc2[_0x304b('0x3')]]['holdtime']=utils['diffTime'](dials[_0x587bc2[_0x304b('0x3')]][_0x304b('0x25')]||dials[_0x587bc2[_0x304b('0x3')]][_0x304b('0x2e')],dials[_0x587bc2[_0x304b('0x3')]]['starttime']);dials[_0x587bc2[_0x304b('0x3')]][_0x304b('0x2f')]=dials[_0x587bc2[_0x304b('0x3')]][_0x304b('0x25')]?utils[_0x304b('0x2d')](dials[_0x587bc2[_0x304b('0x3')]]['endtime'],dials[_0x587bc2[_0x304b('0x3')]][_0x304b('0x25')]):0x0;writeDB(dials[_0x587bc2[_0x304b('0x3')]]);}}catch(_0x2bbb4a){utils[_0x304b('0x14')](util[_0x304b('0x2')]('[%s][dials][hangup]',_0x587bc2['uniqueid']),_0x2bbb4a);}}; \ No newline at end of file +var _0xf33d=['split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','dialstatus','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','duration','endtime','diffTime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith'];(function(_0x127cfa,_0x1a0f68){var _0x3cdba7=function(_0x2e5e0a){while(--_0x2e5e0a){_0x127cfa['push'](_0x127cfa['shift']());}};_0x3cdba7(++_0x1a0f68);}(_0xf33d,0x87));var _0xdf33=function(_0x1273bb,_0x193a23){_0x1273bb=_0x1273bb-0x0;var _0x107662=_0xf33d[_0x1273bb];return _0x107662;};'use strict';var _=require('lodash');var util=require(_0xdf33('0x0'));var utils=require(_0xdf33('0x1'));var dials={};function writeDB(_0xcc2fdf){utils[_0xdf33('0x2')](util[_0xdf33('0x3')](_0xdf33('0x4'),_0xcc2fdf[_0xdf33('0x5')],_0xcc2fdf[_0xdf33('0x6')],_0xcc2fdf[_0xdf33('0x7')],_0xcc2fdf[_0xdf33('0x8')],_0xcc2fdf[_0xdf33('0x9')],_0xcc2fdf['dialstatus']));utils[_0xdf33('0xa')](_0xdf33('0xb'),_0xcc2fdf);delete dials[_0xcc2fdf[_0xdf33('0x5')]];}exports[_0xdf33('0xc')]=function(_0x5935c5){try{utils[_0xdf33('0xd')](util[_0xdf33('0x3')](_0xdf33('0xe'),_0x5935c5[_0xdf33('0x5')]),_0x5935c5);utils[_0xdf33('0x2')](util['format'](_0xdf33('0xf'),_0x5935c5[_0xdf33('0x5')],_0x5935c5[_0xdf33('0x10')],_0x5935c5[_0xdf33('0x11')]));if(_0x5935c5[_0xdf33('0x10')][_0xdf33('0x12')]()==_0xdf33('0x13')&&_[_0xdf33('0x14')](_0x5935c5[_0xdf33('0x11')][_0xdf33('0x12')](),'cdr(routeid)')){var _0x5f21f=_0x5935c5[_0xdf33('0x11')][_0xdf33('0x15')]('=');dials[_0x5935c5[_0xdf33('0x5')]]={'routeId':_0x5f21f[0x1]};}}catch(_0x2ff5e9){utils['error'](util[_0xdf33('0x3')](_0xdf33('0xe'),_0x5935c5[_0xdf33('0x5')]),_0x2ff5e9);}};exports[_0xdf33('0x16')]=function(_0x57d067){try{utils[_0xdf33('0xd')](util[_0xdf33('0x3')](_0xdf33('0x17'),_0x57d067['uniqueid']),_0x57d067);if(!_[_0xdf33('0x18')](_0x57d067[_0xdf33('0x19')][_0xdf33('0x1a')])){utils[_0xdf33('0x2')](util[_0xdf33('0x3')](_0xdf33('0x1b'),_0x57d067['uniqueid'],_0x57d067[_0xdf33('0x1c')]));dials[_0x57d067['uniqueid']]={'routeId':_0x57d067['value']};}}catch(_0x3f9d9a){utils[_0xdf33('0x1d')](util[_0xdf33('0x3')](_0xdf33('0x17'),_0x57d067[_0xdf33('0x5')]),_0x3f9d9a);}};exports[_0xdf33('0x1e')]=function(_0x2d9e0b){try{if(!_[_0xdf33('0x18')](dials[_0x2d9e0b['uniqueid']])){utils[_0xdf33('0xd')](util[_0xdf33('0x3')](_0xdf33('0x1f'),_0x2d9e0b['uniqueid']),_0x2d9e0b);dials[_0x2d9e0b['uniqueid']]=_[_0xdf33('0x20')](dials[_0x2d9e0b[_0xdf33('0x5')]],_0x2d9e0b);dials[_0x2d9e0b[_0xdf33('0x5')]][_0xdf33('0x21')]=utils[_0xdf33('0x22')]();dials[_0x2d9e0b['uniqueid']][_0xdf33('0x23')]=_0xdf33('0x24');utils[_0xdf33('0x2')](util[_0xdf33('0x3')](_0xdf33('0x25'),_0x2d9e0b[_0xdf33('0x5')],dials[_0x2d9e0b[_0xdf33('0x5')]][_0xdf33('0x21')]));}}catch(_0x26cbbe){utils[_0xdf33('0x1d')](util[_0xdf33('0x3')](_0xdf33('0x1f'),_0x2d9e0b['uniqueid']),_0x26cbbe);}};exports['dialend']=function(_0x21034a){try{if(!_[_0xdf33('0x18')](dials[_0x21034a['uniqueid']])){utils['debug'](util[_0xdf33('0x3')](_0xdf33('0x26'),_0x21034a[_0xdf33('0x5')]),_0x21034a);dials[_0x21034a['uniqueid']][_0xdf33('0x27')]=_0x21034a[_0xdf33('0x27')];if(_0x21034a[_0xdf33('0x27')]==_0xdf33('0x28')){dials[_0x21034a[_0xdf33('0x5')]]=_[_0xdf33('0x20')](dials[_0x21034a[_0xdf33('0x5')]],_0x21034a);dials[_0x21034a['uniqueid']][_0xdf33('0x29')]=utils['now']();dials[_0x21034a['uniqueid']]['lastevent']='connect';utils[_0xdf33('0x2')](util[_0xdf33('0x3')](_0xdf33('0x2a'),_0x21034a[_0xdf33('0x5')],_0x21034a['dialstatus'],dials[_0x21034a[_0xdf33('0x5')]][_0xdf33('0x29')]));}else{utils[_0xdf33('0x2')](util[_0xdf33('0x3')](_0xdf33('0x2b'),_0x21034a[_0xdf33('0x5')],_0x21034a['dialstatus']));}}}catch(_0x38dc9a){utils[_0xdf33('0x1d')](util['format'](_0xdf33('0x26'),_0x21034a[_0xdf33('0x5')]),_0x38dc9a);}};exports[_0xdf33('0x2c')]=function(_0x437047){try{if(!_[_0xdf33('0x18')](dials[_0x437047[_0xdf33('0x5')]])){utils[_0xdf33('0xd')](util[_0xdf33('0x3')](_0xdf33('0x2d'),_0x437047[_0xdf33('0x5')]),_0x437047);utils[_0xdf33('0x2')](util[_0xdf33('0x3')](_0xdf33('0x2e'),_0x437047[_0xdf33('0x5')],_0x437047[_0xdf33('0x8')],_0x437047[_0xdf33('0x2f')],_0x437047['cause-txt']));dials[_0x437047[_0xdf33('0x5')]]=_[_0xdf33('0x20')](dials[_0x437047[_0xdf33('0x5')]],{'endtime':utils[_0xdf33('0x22')](),'lastevent':'complete'});dials[_0x437047[_0xdf33('0x5')]][_0xdf33('0x30')]=utils['diffTime'](dials[_0x437047[_0xdf33('0x5')]][_0xdf33('0x31')],dials[_0x437047[_0xdf33('0x5')]][_0xdf33('0x21')]);dials[_0x437047['uniqueid']]['holdtime']=utils[_0xdf33('0x32')](dials[_0x437047[_0xdf33('0x5')]][_0xdf33('0x29')]||dials[_0x437047[_0xdf33('0x5')]][_0xdf33('0x31')],dials[_0x437047[_0xdf33('0x5')]][_0xdf33('0x21')]);dials[_0x437047[_0xdf33('0x5')]][_0xdf33('0x33')]=dials[_0x437047[_0xdf33('0x5')]][_0xdf33('0x29')]?utils[_0xdf33('0x32')](dials[_0x437047['uniqueid']][_0xdf33('0x31')],dials[_0x437047['uniqueid']][_0xdf33('0x29')]):0x0;writeDB(dials[_0x437047['uniqueid']]);}}catch(_0xfb2e8d){utils[_0xdf33('0x1d')](util[_0xdf33('0x3')](_0xdf33('0x2d'),_0x437047[_0xdf33('0x5')]),_0xfb2e8d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e5a2ca7..3c8810c 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 _0xc76d=['agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','production','local','asterisk','port','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xc76d,0x9f));var _0xdc76=function(_0x32cd29,_0x29f6bb){_0x32cd29=_0x32cd29-0x0;var _0x2f7e6e=_0xc76d[_0x32cd29];return _0x2f7e6e;};var AsteriskManager=require(_0xdc76('0x0'));var config=require(_0xdc76('0x1'));var utils=require(_0xdc76('0x2'));var util=require('util');var isXDREnabled=config[_0xdc76('0x3')]&&config[_0xdc76('0x3')][_0xdc76('0x4')]?!config['xdr'][_0xdc76('0x4')]:!![];var isProduction=config['env']===_0xdc76('0x5')||![];var isLocalAsterisk=config[_0xdc76('0x3')]&&config['xdr'][_0xdc76('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xdc76('0x7')][_0xdc76('0x8')],config[_0xdc76('0x7')]['ip'],config[_0xdc76('0x7')]['username'],config[_0xdc76('0x7')][_0xdc76('0x9')],!![]);ami[_0xdc76('0xa')]();if(!isXDREnabled){utils[_0xdc76('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xdc76('0xc'));}else{var agents=require(_0xdc76('0xd'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0xdc76('0xe'));var members=require(_0xdc76('0xf'));var dials=require(_0xdc76('0x10'));var transfers=require(_0xdc76('0x11'));var core=require('./core.controller');ami['on'](_0xdc76('0x12'),core[_0xdc76('0x12')]);ami['on'](_0xdc76('0x13'),core[_0xdc76('0x13')]);ami['on'](_0xdc76('0x14'),core[_0xdc76('0x14')]);ami['on'](_0xdc76('0x15'),core[_0xdc76('0x15')]);ami['on'](_0xdc76('0x16'),core[_0xdc76('0x16')]);ami['on']('managerevent',core[_0xdc76('0x17')]);ami['on']('devicestatechange',function(_0x164b1f){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')]('[%s][index][devicestatechange]',_0x164b1f[_0xdc76('0x1a')]),_0x164b1f);members['devicestatechange'](_0x164b1f);}catch(_0x277a1f){utils[_0xdc76('0x15')](util[_0xdc76('0x19')](_0xdc76('0x1b'),_0x164b1f['device']),_0x277a1f);}});ami['on'](_0xdc76('0x1c'),function(_0x24f847){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')](_0xdc76('0x1d'),_0x24f847[_0xdc76('0x1e')]),_0x24f847);agents['agentcalled'](_0x24f847);}catch(_0x593830){utils[_0xdc76('0x15')](util[_0xdc76('0x19')](_0xdc76('0x1d'),_0x24f847['uniqueid']),_0x593830);}});ami['on'](_0xdc76('0x1f'),function(_0x4a5936){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')]('[%s][index][agentringnoanswer]',_0x4a5936[_0xdc76('0x1e')]),_0x4a5936);agents['agentringnoanswer'](_0x4a5936);}catch(_0x4b3e86){utils[_0xdc76('0x15')](util[_0xdc76('0x19')](_0xdc76('0x20'),_0x4a5936['uniqueid']),_0x4b3e86);}});ami['on'](_0xdc76('0x21'),function(_0x1847c2){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')]('[%s][index][agentconnect]',_0x1847c2[_0xdc76('0x1e')]),_0x1847c2);agents[_0xdc76('0x21')](_0x1847c2);queues[_0xdc76('0x21')](_0x1847c2);}catch(_0xbbe9b4){utils[_0xdc76('0x15')](util[_0xdc76('0x19')]('[%s][index][agentconnect]',_0x1847c2[_0xdc76('0x1e')]),_0xbbe9b4);}});ami['on'](_0xdc76('0x22'),function(_0x267846){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')](_0xdc76('0x23'),_0x267846[_0xdc76('0x1e')]),_0x267846);agents[_0xdc76('0x22')](_0x267846);queues[_0xdc76('0x22')](_0x267846);members['agentcomplete'](_0x267846);}catch(_0x4b1455){utils[_0xdc76('0x15')](util[_0xdc76('0x19')](_0xdc76('0x23'),_0x267846['uniqueid']),_0x4b1455);}});ami['on'](_0xdc76('0x24'),function(_0x1a12d5){try{utils['debug'](util['format'](_0xdc76('0x25'),_0x1a12d5[_0xdc76('0x1e')]),_0x1a12d5);agents[_0xdc76('0x24')](_0x1a12d5);queues[_0xdc76('0x24')](_0x1a12d5);}catch(_0x1321fb){utils[_0xdc76('0x15')](util[_0xdc76('0x19')](_0xdc76('0x25'),_0x1a12d5[_0xdc76('0x1e')]),_0x1321fb);}});ami['on'](_0xdc76('0x26'),function(_0x27fc56){try{utils['debug'](util[_0xdc76('0x19')](_0xdc76('0x27'),_0x27fc56[_0xdc76('0x1e')]),_0x27fc56);queues['queuecallerjoin'](_0x27fc56);recordings[_0xdc76('0x26')](_0x27fc56);}catch(_0x472d3e){utils['error'](util[_0xdc76('0x19')](_0xdc76('0x27'),_0x27fc56[_0xdc76('0x1e')]),_0x472d3e);}});ami['on'](_0xdc76('0x28'),function(_0x40ce05){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')]('[%s][index][queuecallerleave]',_0x40ce05['uniqueid']),_0x40ce05);queues[_0xdc76('0x28')](_0x40ce05);}catch(_0x1e49af){utils[_0xdc76('0x15')](util['format'](_0xdc76('0x29'),_0x40ce05['uniqueid']),_0x1e49af);}});ami['on'](_0xdc76('0x2a'),function(_0x256a2e){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')](_0xdc76('0x2b'),_0x256a2e[_0xdc76('0x1e')]),_0x256a2e);queues[_0xdc76('0x2a')](_0x256a2e);calls[_0xdc76('0x2a')](_0x256a2e);}catch(_0x11010a){utils['error'](util[_0xdc76('0x19')](_0xdc76('0x2b'),_0x256a2e[_0xdc76('0x1e')]),_0x11010a);}});ami['on'](_0xdc76('0x2c'),function(_0x22bf80){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')](_0xdc76('0x2d'),_0x22bf80[_0xdc76('0x1e')]),_0x22bf80);queues[_0xdc76('0x2c')](_0x22bf80);calls['musiconholdstop'](_0x22bf80);}catch(_0xb6ab61){utils['error'](util[_0xdc76('0x19')](_0xdc76('0x2d'),_0x22bf80[_0xdc76('0x1e')]),_0xb6ab61);}});ami['on']('newstate',function(_0x25aa2d){try{utils['debug'](util['format'](_0xdc76('0x2e'),_0x25aa2d[_0xdc76('0x1e')]),_0x25aa2d);calls['newstate'](_0x25aa2d);recordings['newstate'](_0x25aa2d);}catch(_0x61d566){utils[_0xdc76('0x15')](util[_0xdc76('0x19')](_0xdc76('0x2e'),_0x25aa2d['uniqueid']),_0x61d566);}});ami['on'](_0xdc76('0x2f'),function(_0x58caa7){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')](_0xdc76('0x30'),_0x58caa7[_0xdc76('0x1e')]),_0x58caa7);calls['hangup'](_0x58caa7);recordings['hangup'](_0x58caa7);dials[_0xdc76('0x2f')](_0x58caa7);agents['hangup'](_0x58caa7);queues[_0xdc76('0x2f')](_0x58caa7);}catch(_0x46f219){utils[_0xdc76('0x15')](util[_0xdc76('0x19')](_0xdc76('0x30'),_0x58caa7[_0xdc76('0x1e')]),_0x46f219);}});ami['on']('cdr',function(_0x3bba12){try{utils[_0xdc76('0x18')](util['format'](_0xdc76('0x31'),_0x3bba12[_0xdc76('0x1e')]),_0x3bba12);members['cdr'](_0x3bba12);}catch(_0x36ab90){utils[_0xdc76('0x15')](util['format'](_0xdc76('0x31'),_0x3bba12[_0xdc76('0x1e')]),_0x36ab90);}});ami['on'](_0xdc76('0x32'),function(_0x55ead4){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')](_0xdc76('0x33'),_0x55ead4[_0xdc76('0x1e')]),_0x55ead4);queues[_0xdc76('0x32')](_0x55ead4);agents[_0xdc76('0x32')](_0x55ead4);transfers[_0xdc76('0x32')](_0x55ead4);recordings[_0xdc76('0x32')](_0x55ead4);}catch(_0x232daa){utils[_0xdc76('0x15')](util[_0xdc76('0x19')](_0xdc76('0x33'),_0x55ead4[_0xdc76('0x1e')]),_0x232daa);}});ami['on'](_0xdc76('0x34'),function(_0x50aa77){try{utils['debug'](util[_0xdc76('0x19')](_0xdc76('0x35'),_0x50aa77[_0xdc76('0x36')]),_0x50aa77);queues['attendedtransfer'](_0x50aa77);transfers[_0xdc76('0x34')](_0x50aa77);agents[_0xdc76('0x34')](_0x50aa77);calls[_0xdc76('0x34')](_0x50aa77);}catch(_0x5bdc96){utils[_0xdc76('0x15')](util[_0xdc76('0x19')]('[%s][index][attendedtransfer]',_0x50aa77[_0xdc76('0x36')]),_0x5bdc96);}});ami['on'](_0xdc76('0x37'),function(_0x4234e6){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')]('[%s][index][varset]',_0x4234e6[_0xdc76('0x1e')]),_0x4234e6);queues[_0xdc76('0x37')](_0x4234e6);recordings[_0xdc76('0x37')](_0x4234e6);calls[_0xdc76('0x37')](_0x4234e6);dials[_0xdc76('0x37')](_0x4234e6);}catch(_0x151362){utils['error'](util[_0xdc76('0x19')](_0xdc76('0x38'),_0x4234e6[_0xdc76('0x1e')]),_0x151362);}});ami['on'](_0xdc76('0x39'),function(_0x10d6ae){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')]('[%s][index][newexten]',_0x10d6ae[_0xdc76('0x1e')]),_0x10d6ae);calls[_0xdc76('0x39')](_0x10d6ae);recordings['newexten'](_0x10d6ae);dials['newexten'](_0x10d6ae);}catch(_0x4fe872){utils['error'](util['format'](_0xdc76('0x3a'),_0x10d6ae[_0xdc76('0x1e')]),_0x4fe872);}});ami['on'](_0xdc76('0x3b'),function(_0x2edca1){try{utils[_0xdc76('0x18')](util[_0xdc76('0x19')]('[%s][index][newchannel]',_0x2edca1[_0xdc76('0x1e')]),_0x2edca1);calls[_0xdc76('0x3b')](_0x2edca1);recordings[_0xdc76('0x3b')](_0x2edca1);}catch(_0x13226a){utils['error'](util['format']('[%s][index][newchannel]',_0x2edca1[_0xdc76('0x1e')]),_0x13226a);}});ami['on'](_0xdc76('0x3c'),function(_0x355a7d){try{utils[_0xdc76('0x18')](util['format']('[%s][index][dialbegin]',_0x355a7d[_0xdc76('0x1e')]),_0x355a7d);dials[_0xdc76('0x3c')](_0x355a7d);}catch(_0x35c686){utils[_0xdc76('0x15')](util['format'](_0xdc76('0x3d'),_0x355a7d['uniqueid']),_0x35c686);}});ami['on'](_0xdc76('0x3e'),function(_0x2fe020){try{utils['debug'](util['format'](_0xdc76('0x3f'),_0x2fe020[_0xdc76('0x1e')]),_0x2fe020);dials[_0xdc76('0x3e')](_0x2fe020);}catch(_0x8d56e6){utils['error'](util['format'](_0xdc76('0x3f'),_0x2fe020[_0xdc76('0x1e')]),_0x8d56e6);}});} \ No newline at end of file +var _0x73d9=['connect','shutdown','fullybooted','error','close','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentcomplete]','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]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','XDR\x20DISABLED','info','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x73d9,0x14e));var _0x973d=function(_0x8aeba6,_0xdc647f){_0x8aeba6=_0x8aeba6-0x0;var _0xe6ba21=_0x73d9[_0x8aeba6];return _0xe6ba21;};var AsteriskManager=require(_0x973d('0x0'));var config=require('../../config/environment');var utils=require(_0x973d('0x1'));var util=require(_0x973d('0x2'));var isXDREnabled=config[_0x973d('0x3')]&&config[_0x973d('0x3')][_0x973d('0x4')]?!config[_0x973d('0x3')][_0x973d('0x4')]:!![];var isProduction=config[_0x973d('0x5')]===_0x973d('0x6')||![];var isLocalAsterisk=config[_0x973d('0x3')]&&config[_0x973d('0x3')][_0x973d('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x973d('0x8')][_0x973d('0x9')],config['asterisk']['ip'],config[_0x973d('0x8')][_0x973d('0xa')],config[_0x973d('0x8')][_0x973d('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x973d('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x973d('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x973d('0xe'));var queues=require(_0x973d('0xf'));var recordings=require(_0x973d('0x10'));var members=require(_0x973d('0x11'));var dials=require(_0x973d('0x12'));var transfers=require(_0x973d('0x13'));var core=require(_0x973d('0x14'));ami['on']('connect',core[_0x973d('0x15')]);ami['on'](_0x973d('0x16'),core[_0x973d('0x16')]);ami['on']('fullybooted',core[_0x973d('0x17')]);ami['on'](_0x973d('0x18'),core['error']);ami['on'](_0x973d('0x19'),core[_0x973d('0x19')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x973d('0x1a'),function(_0x5dfcca){try{utils[_0x973d('0x1b')](util['format'](_0x973d('0x1c'),_0x5dfcca[_0x973d('0x1d')]),_0x5dfcca);members[_0x973d('0x1a')](_0x5dfcca);}catch(_0x2c8b2c){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x1c'),_0x5dfcca['device']),_0x2c8b2c);}});ami['on'](_0x973d('0x1f'),function(_0x37e85f){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x20'),_0x37e85f[_0x973d('0x21')]),_0x37e85f);agents[_0x973d('0x1f')](_0x37e85f);}catch(_0x168186){utils[_0x973d('0x18')](util['format'](_0x973d('0x20'),_0x37e85f[_0x973d('0x21')]),_0x168186);}});ami['on'](_0x973d('0x22'),function(_0x53d9f3){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x23'),_0x53d9f3[_0x973d('0x21')]),_0x53d9f3);agents[_0x973d('0x22')](_0x53d9f3);}catch(_0x464fd8){utils[_0x973d('0x18')](util['format'](_0x973d('0x23'),_0x53d9f3['uniqueid']),_0x464fd8);}});ami['on'](_0x973d('0x24'),function(_0x5a5637){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')]('[%s][index][agentconnect]',_0x5a5637['uniqueid']),_0x5a5637);agents[_0x973d('0x24')](_0x5a5637);queues[_0x973d('0x24')](_0x5a5637);}catch(_0x3c4722){utils[_0x973d('0x18')](util[_0x973d('0x1e')]('[%s][index][agentconnect]',_0x5a5637['uniqueid']),_0x3c4722);}});ami['on']('agentcomplete',function(_0x578144){try{utils[_0x973d('0x1b')](util['format'](_0x973d('0x25'),_0x578144[_0x973d('0x21')]),_0x578144);agents[_0x973d('0x26')](_0x578144);queues[_0x973d('0x26')](_0x578144);members['agentcomplete'](_0x578144);}catch(_0x343cab){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x25'),_0x578144[_0x973d('0x21')]),_0x343cab);}});ami['on'](_0x973d('0x27'),function(_0x5d5fa4){try{utils['debug'](util[_0x973d('0x1e')](_0x973d('0x28'),_0x5d5fa4['uniqueid']),_0x5d5fa4);agents[_0x973d('0x27')](_0x5d5fa4);queues[_0x973d('0x27')](_0x5d5fa4);}catch(_0x50b985){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x28'),_0x5d5fa4['uniqueid']),_0x50b985);}});ami['on'](_0x973d('0x29'),function(_0x19450c){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')]('[%s][index][queuecallerjoin]',_0x19450c[_0x973d('0x21')]),_0x19450c);queues[_0x973d('0x29')](_0x19450c);recordings['queuecallerjoin'](_0x19450c);}catch(_0x175cf4){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x2a'),_0x19450c[_0x973d('0x21')]),_0x175cf4);}});ami['on'](_0x973d('0x2b'),function(_0x74e8c5){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x2c'),_0x74e8c5[_0x973d('0x21')]),_0x74e8c5);queues[_0x973d('0x2b')](_0x74e8c5);}catch(_0x2145e9){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x2c'),_0x74e8c5['uniqueid']),_0x2145e9);}});ami['on'](_0x973d('0x2d'),function(_0x5cebce){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')]('[%s][index][musiconholdstart]',_0x5cebce[_0x973d('0x21')]),_0x5cebce);queues[_0x973d('0x2d')](_0x5cebce);calls[_0x973d('0x2d')](_0x5cebce);}catch(_0x5433fb){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x2e'),_0x5cebce[_0x973d('0x21')]),_0x5433fb);}});ami['on'](_0x973d('0x2f'),function(_0x16a384){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x30'),_0x16a384[_0x973d('0x21')]),_0x16a384);queues[_0x973d('0x2f')](_0x16a384);calls[_0x973d('0x2f')](_0x16a384);}catch(_0x5d13d9){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x30'),_0x16a384[_0x973d('0x21')]),_0x5d13d9);}});ami['on'](_0x973d('0x31'),function(_0x5e6bfc){try{utils[_0x973d('0x1b')](util['format'](_0x973d('0x32'),_0x5e6bfc[_0x973d('0x21')]),_0x5e6bfc);calls['newstate'](_0x5e6bfc);recordings[_0x973d('0x31')](_0x5e6bfc);}catch(_0x5f2a75){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x32'),_0x5e6bfc[_0x973d('0x21')]),_0x5f2a75);}});ami['on'](_0x973d('0x33'),function(_0x427eb0){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x34'),_0x427eb0[_0x973d('0x21')]),_0x427eb0);calls[_0x973d('0x33')](_0x427eb0);recordings[_0x973d('0x33')](_0x427eb0);dials[_0x973d('0x33')](_0x427eb0);agents[_0x973d('0x33')](_0x427eb0);queues[_0x973d('0x33')](_0x427eb0);}catch(_0x212ede){utils[_0x973d('0x18')](util['format'](_0x973d('0x34'),_0x427eb0[_0x973d('0x21')]),_0x212ede);}});ami['on'](_0x973d('0x35'),function(_0x1d210e){try{utils['debug'](util[_0x973d('0x1e')](_0x973d('0x36'),_0x1d210e['uniqueid']),_0x1d210e);members[_0x973d('0x35')](_0x1d210e);}catch(_0x5d50b0){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x36'),_0x1d210e[_0x973d('0x21')]),_0x5d50b0);}});ami['on'](_0x973d('0x37'),function(_0x422990){try{utils[_0x973d('0x1b')](util['format'](_0x973d('0x38'),_0x422990[_0x973d('0x21')]),_0x422990);queues[_0x973d('0x37')](_0x422990);agents['blindtransfer'](_0x422990);transfers[_0x973d('0x37')](_0x422990);recordings[_0x973d('0x37')](_0x422990);}catch(_0x5b722a){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x38'),_0x422990['uniqueid']),_0x5b722a);}});ami['on'](_0x973d('0x39'),function(_0x5bd182){try{utils['debug'](util[_0x973d('0x1e')](_0x973d('0x3a'),_0x5bd182[_0x973d('0x3b')]),_0x5bd182);queues[_0x973d('0x39')](_0x5bd182);transfers[_0x973d('0x39')](_0x5bd182);agents[_0x973d('0x39')](_0x5bd182);calls['attendedtransfer'](_0x5bd182);}catch(_0x5a42c3){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x3a'),_0x5bd182[_0x973d('0x3b')]),_0x5a42c3);}});ami['on'](_0x973d('0x3c'),function(_0x51934b){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x3d'),_0x51934b[_0x973d('0x21')]),_0x51934b);queues[_0x973d('0x3c')](_0x51934b);recordings['varset'](_0x51934b);calls[_0x973d('0x3c')](_0x51934b);dials['varset'](_0x51934b);}catch(_0x2a81f6){utils[_0x973d('0x18')](util['format'](_0x973d('0x3d'),_0x51934b[_0x973d('0x21')]),_0x2a81f6);}});ami['on'](_0x973d('0x3e'),function(_0x7f98d3){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x3f'),_0x7f98d3[_0x973d('0x21')]),_0x7f98d3);calls[_0x973d('0x3e')](_0x7f98d3);recordings['newexten'](_0x7f98d3);dials[_0x973d('0x3e')](_0x7f98d3);}catch(_0x35f958){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x3f'),_0x7f98d3[_0x973d('0x21')]),_0x35f958);}});ami['on']('newchannel',function(_0x4a74b0){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x40'),_0x4a74b0[_0x973d('0x21')]),_0x4a74b0);calls[_0x973d('0x41')](_0x4a74b0);recordings[_0x973d('0x41')](_0x4a74b0);}catch(_0x4e0554){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x40'),_0x4a74b0[_0x973d('0x21')]),_0x4e0554);}});ami['on'](_0x973d('0x42'),function(_0x406d47){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x43'),_0x406d47['uniqueid']),_0x406d47);dials[_0x973d('0x42')](_0x406d47);}catch(_0x1a2317){utils[_0x973d('0x18')](util['format'](_0x973d('0x44'),_0x406d47[_0x973d('0x21')]),_0x1a2317);}});ami['on'](_0x973d('0x45'),function(_0x5d9378){try{utils[_0x973d('0x1b')](util[_0x973d('0x1e')](_0x973d('0x46'),_0x5d9378['uniqueid']),_0x5d9378);dials[_0x973d('0x45')](_0x5d9378);}catch(_0x2e64b0){utils[_0x973d('0x18')](util[_0x973d('0x1e')](_0x973d('0x46'),_0x5d9378[_0x973d('0x21')]),_0x2e64b0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 37de066..c88d731 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 _0x190b=['[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Queue:','info','format','uniqueid','interface','channel','data2','membername','type','then','request','CreateMemberReport','getUserByName','split','name','internal','catch','error','startsWith','debug'];(function(_0x3652cf,_0x8143a4){var _0x6d1a47=function(_0x3437e1){while(--_0x3437e1){_0x3652cf['push'](_0x3652cf['shift']());}};_0x6d1a47(++_0x8143a4);}(_0x190b,0x1ab));var _0xb190=function(_0x494bfc,_0x2e27e8){_0x494bfc=_0x494bfc-0x0;var _0x32eafa=_0x190b[_0x494bfc];return _0x32eafa;};'use strict';var _=require(_0xb190('0x0'));var util=require(_0xb190('0x1'));var utils=require(_0xb190('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xb190('0x3')];function writeDB(_0x39f291){utils[_0xb190('0x4')](util[_0xb190('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x39f291[_0xb190('0x6')],_0x39f291[_0xb190('0x7')],_0x39f291[_0xb190('0x8')],_0x39f291[_0xb190('0x9')],_0x39f291[_0xb190('0xa')],_0x39f291[_0xb190('0xb')]));if(_0x39f291['interface']){utils['getUserByInterface'](_0x39f291[_0xb190('0x7')])[_0xb190('0xc')](function(_0x3a0c29){if(_0x3a0c29){_0x39f291[_0xb190('0xa')]=_0x3a0c29['name'];_0x39f291['internal']=_0x3a0c29['internal'];utils[_0xb190('0xd')](_0xb190('0xe'),_0x39f291);}else{utils[_0xb190('0xf')](_0x39f291['interface'][_0xb190('0x10')]('/')[0x1])['then'](function(_0x39f6b3){if(_0x39f6b3){_0x39f291[_0xb190('0xa')]=_0x39f6b3[_0xb190('0x11')];_0x39f291[_0xb190('0x12')]=_0x39f6b3[_0xb190('0x12')];utils[_0xb190('0xd')](_0xb190('0xe'),_0x39f291);}});}})[_0xb190('0x13')](function(_0x1edc49){utils[_0xb190('0x14')](util[_0xb190('0x5')]('[%s][members][writeDB]',_0x39f291[_0xb190('0x6')]),_0x1edc49);});}delete members[_0x39f291['interface']];}function startsWith(_0x358cc6,_0x4ec5a0){return _['some'](_0x358cc6,function(_0x7badc5){return _[_0xb190('0x15')](_0x4ec5a0,_0x7badc5);});}exports['devicestatechange']=function(_0x554cb1){try{utils[_0xb190('0x16')](util[_0xb190('0x5')](_0xb190('0x17'),members[_0x554cb1[_0xb190('0x18')]]?members[_0x554cb1['device']]['uniqueid']:_0x554cb1[_0xb190('0x18')]),_0x554cb1);utils['info'](util[_0xb190('0x5')](_0xb190('0x19'),members[_0x554cb1['device']]?members[_0x554cb1['device']][_0xb190('0x6')]:_0x554cb1['device'],_0x554cb1[_0xb190('0x1a')],_0x554cb1[_0xb190('0x18')]));switch(_0x554cb1[_0xb190('0x1a')]){case _0xb190('0x1b'):case _0xb190('0x1c'):if(!startsWith(exclude,_0x554cb1[_0xb190('0x18')])){members[_0x554cb1['device']]={'channel':_0xb190('0x1d'),'interface':_0x554cb1[_0xb190('0x18')],'type':'TALKING','enterAt':utils[_0xb190('0x1e')](),'role':_0xb190('0x1f')};}break;case _0xb190('0x20'):if(!_[_0xb190('0x21')](members[_0x554cb1[_0xb190('0x18')]])){members[_0x554cb1[_0xb190('0x18')]][_0xb190('0x22')]=utils[_0xb190('0x1e')]();members[_0x554cb1[_0xb190('0x18')]][_0xb190('0x23')]=utils['diffTime'](members[_0x554cb1[_0xb190('0x18')]][_0xb190('0x22')],members[_0x554cb1[_0xb190('0x18')]][_0xb190('0x24')]);if(members[_0x554cb1[_0xb190('0x18')]][_0xb190('0x6')]){writeDB(members[_0x554cb1[_0xb190('0x18')]]);}}break;default:break;}}catch(_0xe58fbc){utils[_0xb190('0x14')](util[_0xb190('0x5')]('[%s][members][devicestatechange]',members[_0x554cb1[_0xb190('0x18')]]?members[_0x554cb1['device']][_0xb190('0x6')]:_0x554cb1[_0xb190('0x18')]),_0xe58fbc);}};exports[_0xb190('0x25')]=function(_0x1b298c){try{if(!_[_0xb190('0x21')](members[_0x1b298c['interface']])){utils[_0xb190('0x16')](util['format'](_0xb190('0x26'),_0x1b298c[_0xb190('0x6')]),_0x1b298c);utils[_0xb190('0x4')](util[_0xb190('0x5')](_0xb190('0x27'),_0x1b298c[_0xb190('0x6')],_0x1b298c[_0xb190('0x7')],_0x1b298c['queue']));members[_0x1b298c[_0xb190('0x7')]]=_[_0xb190('0x28')](members[_0x1b298c['interface']],{'data4':_0x1b298c[_0xb190('0x29')],'uniqueid':_0x1b298c['uniqueid']});}}catch(_0x70be87){utils['error'](util[_0xb190('0x5')](_0xb190('0x26'),_0x1b298c[_0xb190('0x6')]),_0x70be87);}};exports[_0xb190('0x2a')]=function(_0x420784){try{utils[_0xb190('0x16')](util['format'](_0xb190('0x2b'),_0x420784['uniqueid']),_0x420784);if(_0x420784[_0xb190('0x8')]){var _0x14ff23=_0x420784[_0xb190('0x8')][_0xb190('0x10')]('-')[0x0];if(!_[_0xb190('0x21')](members[_0x14ff23])){members[_0x14ff23]=_[_0xb190('0x28')](members[_0x14ff23],{'data1':members[_0x14ff23][_0xb190('0x2c')]||_0x420784[_0xb190('0xb')],'data2':members[_0x14ff23][_0xb190('0x9')]||_0x420784[_0xb190('0x2d')],'data3':members[_0x14ff23][_0xb190('0x2e')]||_0x420784[_0xb190('0x2f')],'uniqueid':members[_0x14ff23]['uniqueid']||_0x420784[_0xb190('0x6')]});utils[_0xb190('0x4')](util[_0xb190('0x5')](_0xb190('0x30'),_0x420784[_0xb190('0x6')],members[_0x14ff23][_0xb190('0x2c')],members[_0x14ff23][_0xb190('0x9')],members[_0x14ff23][_0xb190('0x2e')]));if(members[_0x14ff23][_0xb190('0x22')]){writeDB(members[_0x14ff23]);}}}if(_0x420784[_0xb190('0x31')]){var _0x30ea30=_0x420784[_0xb190('0x31')][_0xb190('0x10')]('-')[0x0];if(!_[_0xb190('0x21')](members[_0x30ea30])){members[_0x30ea30]=_[_0xb190('0x28')](members[_0x30ea30],{'data1':members[_0x30ea30][_0xb190('0x2c')]||_0x420784['type'],'data2':members[_0x30ea30][_0xb190('0x9')]||_0x420784[_0xb190('0x2d')],'data3':members[_0x30ea30]['data3']||_0x420784[_0xb190('0x2f')],'uniqueid':members[_0x30ea30][_0xb190('0x6')]||_0x420784[_0xb190('0x6')]});utils['info'](util[_0xb190('0x5')](_0xb190('0x30'),_0x420784[_0xb190('0x6')],members[_0x30ea30][_0xb190('0x2c')],members[_0x30ea30][_0xb190('0x9')],members[_0x30ea30][_0xb190('0x2e')]));if(members[_0x30ea30]['exitAt']){writeDB(members[_0x30ea30]);}}}}catch(_0x55ee7f){utils[_0xb190('0x14')](util[_0xb190('0x5')]('[%s][members][cdr]',_0x420784[_0xb190('0x6')]),_0x55ee7f);}}; \ No newline at end of file +var _0xf0e8=['debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','assign','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','[%s][members][cdr]','lodash','util','Local/_attended@transfer','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','getUserByInterface','then','membername','internal','request','getUserByName','split','name','catch','format','[%s][members][writeDB]','startsWith'];(function(_0x555cca,_0x519441){var _0x31772d=function(_0x47e4d1){while(--_0x47e4d1){_0x555cca['push'](_0x555cca['shift']());}};_0x31772d(++_0x519441);}(_0xf0e8,0x81));var _0x8f0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf0e8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8f0e('0x0'));var util=require(_0x8f0e('0x1'));var utils=require('./utils');var members={};var exclude=[_0x8f0e('0x2'),'Queue:'];function writeDB(_0x22a343){utils[_0x8f0e('0x3')](util['format'](_0x8f0e('0x4'),_0x22a343[_0x8f0e('0x5')],_0x22a343[_0x8f0e('0x6')],_0x22a343[_0x8f0e('0x7')],_0x22a343[_0x8f0e('0x8')],_0x22a343['membername'],_0x22a343['type']));if(_0x22a343[_0x8f0e('0x6')]){utils[_0x8f0e('0x9')](_0x22a343['interface'])[_0x8f0e('0xa')](function(_0x2dca8a){if(_0x2dca8a){_0x22a343[_0x8f0e('0xb')]=_0x2dca8a['name'];_0x22a343['internal']=_0x2dca8a[_0x8f0e('0xc')];utils[_0x8f0e('0xd')]('CreateMemberReport',_0x22a343);}else{utils[_0x8f0e('0xe')](_0x22a343[_0x8f0e('0x6')][_0x8f0e('0xf')]('/')[0x1])[_0x8f0e('0xa')](function(_0x589980){if(_0x589980){_0x22a343[_0x8f0e('0xb')]=_0x589980[_0x8f0e('0x10')];_0x22a343[_0x8f0e('0xc')]=_0x589980['internal'];utils[_0x8f0e('0xd')]('CreateMemberReport',_0x22a343);}});}})[_0x8f0e('0x11')](function(_0x41c923){utils['error'](util[_0x8f0e('0x12')](_0x8f0e('0x13'),_0x22a343[_0x8f0e('0x5')]),_0x41c923);});}delete members[_0x22a343[_0x8f0e('0x6')]];}function startsWith(_0xe3c4da,_0x24914a){return _['some'](_0xe3c4da,function(_0x10d3e5){return _[_0x8f0e('0x14')](_0x24914a,_0x10d3e5);});}exports['devicestatechange']=function(_0x3c4073){try{utils[_0x8f0e('0x15')](util[_0x8f0e('0x12')](_0x8f0e('0x16'),members[_0x3c4073['device']]?members[_0x3c4073['device']]['uniqueid']:_0x3c4073[_0x8f0e('0x17')]),_0x3c4073);utils[_0x8f0e('0x3')](util[_0x8f0e('0x12')](_0x8f0e('0x18'),members[_0x3c4073[_0x8f0e('0x17')]]?members[_0x3c4073[_0x8f0e('0x17')]][_0x8f0e('0x5')]:_0x3c4073[_0x8f0e('0x17')],_0x3c4073[_0x8f0e('0x19')],_0x3c4073[_0x8f0e('0x17')]));switch(_0x3c4073[_0x8f0e('0x19')]){case _0x8f0e('0x1a'):case'BUSY':if(!startsWith(exclude,_0x3c4073[_0x8f0e('0x17')])){members[_0x3c4073[_0x8f0e('0x17')]]={'channel':_0x8f0e('0x1b'),'interface':_0x3c4073['device'],'type':_0x8f0e('0x1c'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x8f0e('0x1d'):if(!_[_0x8f0e('0x1e')](members[_0x3c4073[_0x8f0e('0x17')]])){members[_0x3c4073[_0x8f0e('0x17')]][_0x8f0e('0x1f')]=utils[_0x8f0e('0x20')]();members[_0x3c4073['device']][_0x8f0e('0x21')]=utils[_0x8f0e('0x22')](members[_0x3c4073[_0x8f0e('0x17')]][_0x8f0e('0x1f')],members[_0x3c4073[_0x8f0e('0x17')]][_0x8f0e('0x23')]);if(members[_0x3c4073[_0x8f0e('0x17')]][_0x8f0e('0x5')]){writeDB(members[_0x3c4073['device']]);}}break;default:break;}}catch(_0x3edd18){utils[_0x8f0e('0x24')](util['format'](_0x8f0e('0x16'),members[_0x3c4073[_0x8f0e('0x17')]]?members[_0x3c4073[_0x8f0e('0x17')]][_0x8f0e('0x5')]:_0x3c4073[_0x8f0e('0x17')]),_0x3edd18);}};exports[_0x8f0e('0x25')]=function(_0x2e600f){try{if(!_[_0x8f0e('0x1e')](members[_0x2e600f[_0x8f0e('0x6')]])){utils['debug'](util[_0x8f0e('0x12')](_0x8f0e('0x26'),_0x2e600f['uniqueid']),_0x2e600f);utils[_0x8f0e('0x3')](util[_0x8f0e('0x12')](_0x8f0e('0x27'),_0x2e600f[_0x8f0e('0x5')],_0x2e600f['interface'],_0x2e600f['queue']));members[_0x2e600f[_0x8f0e('0x6')]]=_['assign'](members[_0x2e600f[_0x8f0e('0x6')]],{'data4':_0x2e600f[_0x8f0e('0x28')],'uniqueid':_0x2e600f[_0x8f0e('0x5')]});}}catch(_0x3d6ef9){utils[_0x8f0e('0x24')](util[_0x8f0e('0x12')]('[%s][members][agentcomplete]',_0x2e600f[_0x8f0e('0x5')]),_0x3d6ef9);}};exports[_0x8f0e('0x29')]=function(_0x5b2cc1){try{utils[_0x8f0e('0x15')](util[_0x8f0e('0x12')]('[%s][members][cdr]',_0x5b2cc1[_0x8f0e('0x5')]),_0x5b2cc1);if(_0x5b2cc1[_0x8f0e('0x7')]){var _0x1b46c7=_0x5b2cc1['channel'][_0x8f0e('0xf')]('-')[0x0];if(!_[_0x8f0e('0x1e')](members[_0x1b46c7])){members[_0x1b46c7]=_[_0x8f0e('0x2a')](members[_0x1b46c7],{'data1':members[_0x1b46c7][_0x8f0e('0x2b')]||_0x5b2cc1['type'],'data2':members[_0x1b46c7][_0x8f0e('0x8')]||_0x5b2cc1[_0x8f0e('0x2c')],'data3':members[_0x1b46c7][_0x8f0e('0x2d')]||_0x5b2cc1['destination'],'uniqueid':members[_0x1b46c7]['uniqueid']||_0x5b2cc1[_0x8f0e('0x5')]});utils[_0x8f0e('0x3')](util[_0x8f0e('0x12')](_0x8f0e('0x2e'),_0x5b2cc1[_0x8f0e('0x5')],members[_0x1b46c7][_0x8f0e('0x2b')],members[_0x1b46c7][_0x8f0e('0x8')],members[_0x1b46c7][_0x8f0e('0x2d')]));if(members[_0x1b46c7][_0x8f0e('0x1f')]){writeDB(members[_0x1b46c7]);}}}if(_0x5b2cc1[_0x8f0e('0x2f')]){var _0x30c37d=_0x5b2cc1[_0x8f0e('0x2f')][_0x8f0e('0xf')]('-')[0x0];if(!_[_0x8f0e('0x1e')](members[_0x30c37d])){members[_0x30c37d]=_[_0x8f0e('0x2a')](members[_0x30c37d],{'data1':members[_0x30c37d]['data1']||_0x5b2cc1['type'],'data2':members[_0x30c37d][_0x8f0e('0x8')]||_0x5b2cc1[_0x8f0e('0x2c')],'data3':members[_0x30c37d][_0x8f0e('0x2d')]||_0x5b2cc1[_0x8f0e('0x30')],'uniqueid':members[_0x30c37d]['uniqueid']||_0x5b2cc1[_0x8f0e('0x5')]});utils[_0x8f0e('0x3')](util[_0x8f0e('0x12')](_0x8f0e('0x2e'),_0x5b2cc1[_0x8f0e('0x5')],members[_0x30c37d][_0x8f0e('0x2b')],members[_0x30c37d]['data2'],members[_0x30c37d][_0x8f0e('0x2d')]));if(members[_0x30c37d][_0x8f0e('0x1f')]){writeDB(members[_0x30c37d]);}}}}catch(_0x1167e3){utils['error'](util[_0x8f0e('0x12')](_0x8f0e('0x31'),_0x5b2cc1[_0x8f0e('0x5')]),_0x1167e3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 594c21c..93c5931 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 _0xf450=['transfertype','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','info','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','assigned','accountcode','destaccountcode','lastAssignedTo','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]'];(function(_0x1aa835,_0x23e8ac){var _0x5ad5c7=function(_0x4aed6e){while(--_0x4aed6e){_0x1aa835['push'](_0x1aa835['shift']());}};_0x5ad5c7(++_0x23e8ac);}(_0xf450,0x168));var _0x0f45=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf450[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x0f45('0x0'));var utils=require(_0x0f45('0x1'));var queues={};function writeDB(_0x73d7e6){utils['info'](util[_0x0f45('0x2')](_0x0f45('0x3'),_0x73d7e6[_0x0f45('0x4')],_0x73d7e6[_0x0f45('0x5')],_0x73d7e6[_0x0f45('0x6')],_0x73d7e6['lastAssignedTo'],_0x73d7e6[_0x0f45('0x7')],_0x73d7e6['accountcode'],_0x73d7e6[_0x0f45('0x8')]));if(_0x73d7e6['queue']){utils[_0x0f45('0x9')](_0x73d7e6[_0x0f45('0x6')])[_0x0f45('0xa')](function(_0x6aa1da){if(_0x6aa1da){_0x73d7e6['type']=_0x6aa1da[_0x0f45('0xb')];}utils[_0x0f45('0xc')](_0x0f45('0xd'),_0x73d7e6);});}else{utils['request'](_0x0f45('0xd'),_0x73d7e6);}if(_0x73d7e6[_0x0f45('0xe')]){delete queues[_0x73d7e6[_0x0f45('0xe')]];}else{delete queues[_0x73d7e6[_0x0f45('0x4')]];}}exports[_0x0f45('0xf')]=function(_0x2654a3){try{utils[_0x0f45('0x10')](util[_0x0f45('0x2')](_0x0f45('0x11'),_0x2654a3[_0x0f45('0x4')]),_0x2654a3);utils['info'](util[_0x0f45('0x2')](_0x0f45('0x12'),_0x2654a3['uniqueid'],_0x2654a3[_0x0f45('0x6')],_0x2654a3[_0x0f45('0x13')]));queues[_0x2654a3[_0x0f45('0x4')]]=_[_0x0f45('0x14')](_0x2654a3,{'originalposition':_0x2654a3[_0x0f45('0x13')],'queuecallerjoinAt':utils[_0x0f45('0x15')](),'mohtime':0x0});}catch(_0x18d68c){utils[_0x0f45('0x16')](util['format'](_0x0f45('0x11'),_0x2654a3[_0x0f45('0x4')]),_0x18d68c);}};exports[_0x0f45('0x17')]=function(_0x355e1b){try{if(!_[_0x0f45('0x18')](queues[_0x355e1b['uniqueid']])){utils[_0x0f45('0x10')](util['format'](_0x0f45('0x19'),_0x355e1b['uniqueid']),_0x355e1b);if(queues[_0x355e1b[_0x0f45('0x4')]]['queuecallerleaveAt']){if(!queues[_0x355e1b[_0x0f45('0x4')]][_0x0f45('0x1a')]&&!queues[_0x355e1b[_0x0f45('0x4')]][_0x0f45('0x1b')]){queues[_0x355e1b['uniqueid']][_0x0f45('0x1c')]=!![];queues[_0x355e1b['uniqueid']][_0x0f45('0x1d')]=utils[_0x0f45('0x15')]();queues[_0x355e1b[_0x0f45('0x4')]][_0x0f45('0x8')]=_0x0f45('0x1e');}utils[_0x0f45('0x1f')](util[_0x0f45('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x355e1b[_0x0f45('0x4')],queues[_0x355e1b['uniqueid']][_0x0f45('0x20')],queues[_0x355e1b[_0x0f45('0x4')]][_0x0f45('0x8')]));writeDB(queues[_0x355e1b[_0x0f45('0x4')]]);}else if(queues[_0x355e1b[_0x0f45('0x4')]][_0x0f45('0xe')]){utils[_0x0f45('0x1f')](util['format'](_0x0f45('0x21'),_0x355e1b[_0x0f45('0x4')],queues[_0x355e1b['uniqueid']][_0x0f45('0x20')],queues[_0x355e1b[_0x0f45('0x4')]][_0x0f45('0xe')]));queues[queues[_0x355e1b[_0x0f45('0x4')]]['transfereduniqueid']]=queues[_0x355e1b[_0x0f45('0x4')]];queues[queues[_0x355e1b[_0x0f45('0x4')]]['transfereduniqueid']][_0x0f45('0x22')]=0x2;delete queues[_0x355e1b[_0x0f45('0x4')]];}}}catch(_0x3f7796){utils['error'](util['format']('[%s][queues][hangup]',_0x355e1b[_0x0f45('0x4')]),_0x3f7796);}};exports['varset']=function(_0x25abe7){try{utils['debug'](util[_0x0f45('0x2')](_0x0f45('0x23'),_0x25abe7['uniqueid']),_0x25abe7);if(!_[_0x0f45('0x18')](_0x25abe7[_0x0f45('0x24')][_0x0f45('0x25')])&&_0x25abe7[_0x0f45('0x26')][_0x0f45('0x27')]()!==_0x0f45('0x28')){if(!_['isNil'](queues[_0x25abe7[_0x0f45('0x4')]])){queues[_0x25abe7[_0x0f45('0x4')]]['queuecallerabandon']=![];queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x29')]=null;queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x1b')]=!![];queues[_0x25abe7['uniqueid']][_0x0f45('0x2a')]=utils[_0x0f45('0x15')]();queues[_0x25abe7['uniqueid']]['queuecallerexitreason']=_0x25abe7[_0x0f45('0x26')][_0x0f45('0x27')]();utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x2b'),_0x25abe7['uniqueid'],queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x20')],_0x25abe7[_0x0f45('0x26')],queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x8')]));writeDB(queues[_0x25abe7[_0x0f45('0x4')]]);}}else if(!_[_0x0f45('0x18')](_0x25abe7[_0x0f45('0x24')][_0x0f45('0x2c')])){if(!_['isNil'](queues[_0x25abe7['uniqueid']])&&!queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x1a')]){queues[_0x25abe7['uniqueid']][_0x0f45('0x1a')]=![];queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x29')]=null;queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x1b')]=!![];queues[_0x25abe7['uniqueid']][_0x0f45('0x2a')]=utils[_0x0f45('0x15')]();queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x8')]=_0x0f45('0x2d');utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x2e'),_0x25abe7[_0x0f45('0x4')],queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x20')],_0x25abe7['value'],queues[_0x25abe7[_0x0f45('0x4')]][_0x0f45('0x8')]));}}}catch(_0x28151e){utils[_0x0f45('0x16')](util[_0x0f45('0x2')](_0x0f45('0x23'),_0x25abe7['uniqueid']),_0x28151e);}};exports[_0x0f45('0x1a')]=function(_0x5ca20){try{if(!_['isNil'](queues[_0x5ca20[_0x0f45('0x4')]])){utils['debug'](util[_0x0f45('0x2')](_0x0f45('0x2f'),_0x5ca20[_0x0f45('0x4')]),_0x5ca20);queues[_0x5ca20['uniqueid']][_0x0f45('0x1b')]=![];queues[_0x5ca20['uniqueid']][_0x0f45('0x2a')]=null;queues[_0x5ca20['uniqueid']][_0x0f45('0x1a')]=!![];queues[_0x5ca20['uniqueid']]['queuecallerabandonAt']=utils['now']();queues[_0x5ca20['uniqueid']]['queuecallerexitreason']=_0x0f45('0x30');utils['info'](util['format'](_0x0f45('0x31'),_0x5ca20[_0x0f45('0x4')],queues[_0x5ca20[_0x0f45('0x4')]][_0x0f45('0x20')],queues[_0x5ca20[_0x0f45('0x4')]]['queuecallerexitreason']));}}catch(_0x49efdb){utils[_0x0f45('0x16')](util[_0x0f45('0x2')](_0x0f45('0x2f'),_0x5ca20[_0x0f45('0x4')]),_0x49efdb);}};exports[_0x0f45('0x32')]=function(_0x257307){try{if(!_[_0x0f45('0x18')](queues[_0x257307[_0x0f45('0x4')]])){utils[_0x0f45('0x10')](util[_0x0f45('0x2')](_0x0f45('0x33'),_0x257307[_0x0f45('0x4')]),_0x257307);utils[_0x0f45('0x1f')](util['format'](_0x0f45('0x34'),_0x257307[_0x0f45('0x4')],queues[_0x257307[_0x0f45('0x4')]][_0x0f45('0x20')],_0x257307['connectedlinenum'],_0x257307[_0x0f45('0x35')]));queues[_0x257307[_0x0f45('0x4')]]['queuecallerleave']=!![];queues[_0x257307[_0x0f45('0x4')]][_0x0f45('0x36')]=utils[_0x0f45('0x15')]();queues[_0x257307[_0x0f45('0x4')]][_0x0f45('0x37')]=utils[_0x0f45('0x38')](queues[_0x257307[_0x0f45('0x4')]][_0x0f45('0x36')],queues[_0x257307[_0x0f45('0x4')]][_0x0f45('0x39')]);queues[_0x257307[_0x0f45('0x4')]][_0x0f45('0x13')]=_0x257307[_0x0f45('0x13')];queues[_0x257307[_0x0f45('0x4')]][_0x0f45('0x3a')]=_0x257307[_0x0f45('0x3a')];queues[_0x257307[_0x0f45('0x4')]][_0x0f45('0x3b')]=_0x257307[_0x0f45('0x3b')];queues[_0x257307['uniqueid']]['connectedlinename']=_0x257307['connectedlinename'];}}catch(_0x43a4ff){utils[_0x0f45('0x16')](util['format']('[%s][queues][queuecallerleave]',_0x257307[_0x0f45('0x4')]),_0x43a4ff);}};exports[_0x0f45('0x3c')]=function(_0x75464b){try{if(!_[_0x0f45('0x18')](queues[_0x75464b['uniqueid']])){utils[_0x0f45('0x10')](util['format'](_0x0f45('0x3d'),_0x75464b['uniqueid']),_0x75464b);utils['info'](util[_0x0f45('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x75464b[_0x0f45('0x4')],queues[_0x75464b[_0x0f45('0x4')]][_0x0f45('0x20')],_0x75464b[_0x0f45('0x3e')],_0x75464b['destaccountcode']));queues[_0x75464b[_0x0f45('0x4')]][_0x0f45('0x1a')]=![];queues[_0x75464b[_0x0f45('0x4')]][_0x0f45('0x1a')]=![];queues[_0x75464b['uniqueid']][_0x0f45('0x29')]=null;queues[_0x75464b[_0x0f45('0x4')]][_0x0f45('0x1b')]=![];queues[_0x75464b[_0x0f45('0x4')]][_0x0f45('0x8')]=null;queues[_0x75464b[_0x0f45('0x4')]]['queuecallerexitAt']=null;queues[_0x75464b['uniqueid']][_0x0f45('0x3f')]=!![];queues[_0x75464b[_0x0f45('0x4')]][_0x0f45('0x40')]=_0x75464b[_0x0f45('0x41')];queues[_0x75464b[_0x0f45('0x4')]][_0x0f45('0x42')]=_0x75464b[_0x0f45('0x3e')];}}catch(_0x333f6e){utils[_0x0f45('0x16')](util[_0x0f45('0x2')](_0x0f45('0x3d'),_0x75464b[_0x0f45('0x4')]),_0x333f6e);}};exports[_0x0f45('0x43')]=function(_0x3b752e){try{if(!_[_0x0f45('0x18')](queues[_0x3b752e['uniqueid']])){if(queues[_0x3b752e[_0x0f45('0x4')]]['queuecallerleaveAt']){utils[_0x0f45('0x10')](util[_0x0f45('0x2')]('[%s][queues][agentcomplete]',_0x3b752e[_0x0f45('0x4')]),_0x3b752e);queues[_0x3b752e[_0x0f45('0x4')]][_0x0f45('0x1a')]=![];queues[_0x3b752e[_0x0f45('0x4')]][_0x0f45('0x1a')]=![];queues[_0x3b752e[_0x0f45('0x4')]]['queuecallerabandonAt']=null;queues[_0x3b752e[_0x0f45('0x4')]][_0x0f45('0x1b')]=![];queues[_0x3b752e[_0x0f45('0x4')]][_0x0f45('0x2a')]=null;queues[_0x3b752e['uniqueid']]['assigned']=!![];queues[_0x3b752e['uniqueid']][_0x0f45('0x42')]=_0x3b752e['membername'];queues[_0x3b752e['uniqueid']][_0x0f45('0x1c')]=!![];queues[_0x3b752e[_0x0f45('0x4')]]['queuecallercompleteAt']=utils[_0x0f45('0x15')]();if(_0x3b752e[_0x0f45('0x44')]==_0x0f45('0x45')){if(!queues[_0x3b752e[_0x0f45('0x4')]][_0x0f45('0x45')]){queues[_0x3b752e[_0x0f45('0x4')]][_0x0f45('0x8')]=_0x0f45('0x46');}}else{queues[_0x3b752e[_0x0f45('0x4')]][_0x0f45('0x8')]=_0x0f45('0x47')+_0x3b752e[_0x0f45('0x44')][_0x0f45('0x27')]();}utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x48'),_0x3b752e['uniqueid'],queues[_0x3b752e[_0x0f45('0x4')]][_0x0f45('0x20')],_0x3b752e['membername'],queues[_0x3b752e['uniqueid']][_0x0f45('0x8')]));writeDB(queues[_0x3b752e['uniqueid']]);}}}catch(_0x4f2db1){utils[_0x0f45('0x16')](util[_0x0f45('0x2')](_0x0f45('0x49'),_0x3b752e[_0x0f45('0x4')]),_0x4f2db1);}};exports['blindtransfer']=function(_0x5197cc){try{if(!_['isNil'](queues[_0x5197cc[_0x0f45('0x4a')]])){utils['debug'](util[_0x0f45('0x2')](_0x0f45('0x4b'),_0x5197cc['uniqueid']),_0x5197cc);queues[_0x5197cc[_0x0f45('0x4a')]][_0x0f45('0x45')]=!![];queues[_0x5197cc[_0x0f45('0x4a')]][_0x0f45('0x4c')]=_0x0f45('0x4d');queues[_0x5197cc['transfereeuniqueid']][_0x0f45('0x4e')]=_0x5197cc['extension'];queues[_0x5197cc[_0x0f45('0x4a')]][_0x0f45('0x4f')]=_0x5197cc[_0x0f45('0x4a')];queues[_0x5197cc['transfereeuniqueid']][_0x0f45('0x8')]='BLINDTRANSFER';utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x50'),_0x5197cc[_0x0f45('0x4')],queues[_0x5197cc['transfereeuniqueid']][_0x0f45('0x20')],_0x5197cc['transfereeuniqueid'],_0x5197cc[_0x0f45('0x51')]));}}catch(_0x5a4efa){utils[_0x0f45('0x16')](util['format']('[%s][queues][blindtransfer]',_0x5197cc[_0x0f45('0x4')]),_0x5a4efa);}};exports[_0x0f45('0x52')]=function(_0x4b1c10){try{utils[_0x0f45('0x10')](util[_0x0f45('0x2')](_0x0f45('0x53'),_0x4b1c10[_0x0f45('0x54')]),_0x4b1c10);if(_0x4b1c10[_0x0f45('0x54')]==_0x4b1c10[_0x0f45('0x55')]){if(!_[_0x0f45('0x18')](queues[_0x4b1c10[_0x0f45('0x56')]])){utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x57'),_0x4b1c10[_0x0f45('0x54')],queues[_0x4b1c10['secondtransfererlinkedid']][_0x0f45('0x20')],_0x4b1c10[_0x0f45('0x58')]));queues[_0x4b1c10[_0x0f45('0x56')]][_0x0f45('0x45')]=!![];queues[_0x4b1c10[_0x0f45('0x56')]]['transfertype']=_0x0f45('0x59');queues[_0x4b1c10[_0x0f45('0x56')]][_0x0f45('0x4e')]=_0x4b1c10[_0x0f45('0x58')];queues[_0x4b1c10[_0x0f45('0x56')]][_0x0f45('0x4f')]=_0x4b1c10['origtransfereruniqueid'];queues[_0x4b1c10[_0x0f45('0x56')]][_0x0f45('0x8')]=_0x0f45('0x5a');}if(!_['isNil'](queues[_0x4b1c10[_0x0f45('0x55')]])){if(_0x4b1c10[_0x0f45('0x5b')]&&queues[_0x4b1c10[_0x0f45('0x5b')]]){queues[_0x4b1c10[_0x0f45('0x5b')]][_0x0f45('0x22')]=0x1;queues[_0x4b1c10['transfereeuniqueid']]=_[_0x0f45('0x5c')](queues[_0x4b1c10[_0x0f45('0x5b')]]);queues[_0x4b1c10[_0x0f45('0x4a')]]['transfereduniqueid']=_0x4b1c10['transfertargetuniqueid'];queues[_0x4b1c10[_0x0f45('0x4a')]][_0x0f45('0x22')]=0x2;queues[_0x4b1c10[_0x0f45('0x4a')]][_0x0f45('0x7')]=queues[_0x4b1c10[_0x0f45('0x56')]][_0x0f45('0x7')];queues[_0x4b1c10['transfereeuniqueid']]['calleridname']=queues[_0x4b1c10[_0x0f45('0x56')]][_0x0f45('0x5d')];queues[_0x4b1c10[_0x0f45('0x4a')]]['queuecallerjoinAt']=utils[_0x0f45('0x15')]();queues[_0x4b1c10['transfereeuniqueid']][_0x0f45('0x36')]=utils['now']();queues[_0x4b1c10[_0x0f45('0x4a')]][_0x0f45('0x37')]=0x0;queues[_0x4b1c10[_0x0f45('0x4a')]][_0x0f45('0x5e')]=0x0;utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x5f'),_0x4b1c10[_0x0f45('0x54')],queues[_0x4b1c10['transfereeuniqueid']][_0x0f45('0x20')],queues[_0x4b1c10[_0x0f45('0x4a')]][_0x0f45('0x7')],queues[_0x4b1c10[_0x0f45('0x4a')]][_0x0f45('0x5d')]));}else{utils['info'](util[_0x0f45('0x2')](_0x0f45('0x60'),_0x4b1c10['origtransfereruniqueid'],queues[_0x4b1c10['origtransfererlinkedid']][_0x0f45('0x20')],_0x4b1c10[_0x0f45('0x56')]));queues[_0x4b1c10[_0x0f45('0x55')]][_0x0f45('0xe')]=_0x4b1c10[_0x0f45('0x56')];}}}else if(_0x4b1c10['secondtransfereruniqueid']==_0x4b1c10[_0x0f45('0x56')]){if(!_[_0x0f45('0x18')](queues[_0x4b1c10[_0x0f45('0x55')]])){utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x61'),_0x4b1c10[_0x0f45('0x54')],queues[_0x4b1c10[_0x0f45('0x55')]][_0x0f45('0x20')],_0x4b1c10['secondtransfereruniqueid'],_0x4b1c10[_0x0f45('0x62')]));queues[_0x4b1c10[_0x0f45('0x55')]][_0x0f45('0x45')]=!![];queues[_0x4b1c10[_0x0f45('0x55')]][_0x0f45('0x4c')]=_0x0f45('0x59');queues[_0x4b1c10[_0x0f45('0x55')]][_0x0f45('0x4e')]=_0x4b1c10[_0x0f45('0x62')];queues[_0x4b1c10[_0x0f45('0x55')]][_0x0f45('0x4f')]=_0x4b1c10[_0x0f45('0x63')];queues[_0x4b1c10[_0x0f45('0x55')]][_0x0f45('0x8')]=_0x0f45('0x5a');}if(!_[_0x0f45('0x18')](queues[_0x4b1c10[_0x0f45('0x56')]])){if(_0x4b1c10[_0x0f45('0x64')]&&queues[_0x4b1c10[_0x0f45('0x64')]]){queues[_0x4b1c10['transfertargetlinkedid']][_0x0f45('0x22')]=0x1;queues[_0x4b1c10[_0x0f45('0x65')]]=_[_0x0f45('0x5c')](queues[_0x4b1c10[_0x0f45('0x64')]]);queues[_0x4b1c10[_0x0f45('0x65')]][_0x0f45('0xe')]=_0x4b1c10[_0x0f45('0x65')];queues[_0x4b1c10[_0x0f45('0x65')]][_0x0f45('0x22')]=0x2;queues[_0x4b1c10['transfertargetuniqueid']][_0x0f45('0x7')]=queues[_0x4b1c10[_0x0f45('0x55')]][_0x0f45('0x7')];queues[_0x4b1c10[_0x0f45('0x65')]][_0x0f45('0x5d')]=queues[_0x4b1c10[_0x0f45('0x55')]][_0x0f45('0x5d')];queues[_0x4b1c10['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x0f45('0x15')]();queues[_0x4b1c10['transfertargetuniqueid']][_0x0f45('0x36')]=utils[_0x0f45('0x15')]();queues[_0x4b1c10[_0x0f45('0x65')]][_0x0f45('0x37')]=0x0;queues[_0x4b1c10['transfertargetuniqueid']][_0x0f45('0x5e')]=0x0;utils['info'](util[_0x0f45('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x4b1c10[_0x0f45('0x54')],queues[_0x4b1c10[_0x0f45('0x65')]][_0x0f45('0x20')],queues[_0x4b1c10[_0x0f45('0x65')]][_0x0f45('0xe')],queues[_0x4b1c10[_0x0f45('0x65')]][_0x0f45('0x7')],queues[_0x4b1c10[_0x0f45('0x65')]]['calleridname']));}else{utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x60'),_0x4b1c10['origtransfereruniqueid'],queues[_0x4b1c10[_0x0f45('0x56')]][_0x0f45('0x20')],_0x4b1c10[_0x0f45('0x55')]));queues[_0x4b1c10[_0x0f45('0x56')]][_0x0f45('0xe')]=_0x4b1c10[_0x0f45('0x55')];}}}}catch(_0x4f1f8f){utils[_0x0f45('0x16')](util['format']('[%s][queues][attendedtransfer]',_0x4b1c10[_0x0f45('0x54')]),_0x4f1f8f);}};exports[_0x0f45('0x66')]=function(_0x2256ad){try{if(!_[_0x0f45('0x18')](queues[_0x2256ad[_0x0f45('0x4')]])){utils['debug'](util[_0x0f45('0x2')](_0x0f45('0x67'),_0x2256ad[_0x0f45('0x4')]),_0x2256ad);queues[_0x2256ad[_0x0f45('0x4')]][_0x0f45('0x68')]=utils['now']();utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x69'),_0x2256ad[_0x0f45('0x4')],queues[_0x2256ad[_0x0f45('0x4')]][_0x0f45('0x20')],queues[_0x2256ad[_0x0f45('0x4')]]['musiconholdstartAt']));}}catch(_0x32b3c6){utils[_0x0f45('0x16')](util[_0x0f45('0x2')](_0x0f45('0x67'),_0x2256ad[_0x0f45('0x4')]),_0x32b3c6);}};exports[_0x0f45('0x6a')]=function(_0x446441){try{if(!_[_0x0f45('0x18')](queues[_0x446441[_0x0f45('0x4')]])){if(!_[_0x0f45('0x18')](queues[_0x446441[_0x0f45('0x4')]]['musiconholdstartAt'])){utils['debug'](util[_0x0f45('0x2')](_0x0f45('0x6b'),_0x446441[_0x0f45('0x4')]),_0x446441);queues[_0x446441['uniqueid']][_0x0f45('0x5e')]+=utils[_0x0f45('0x38')](utils[_0x0f45('0x15')](),queues[_0x446441[_0x0f45('0x4')]]['musiconholdstartAt']);utils[_0x0f45('0x1f')](util[_0x0f45('0x2')](_0x0f45('0x6c'),_0x446441['uniqueid'],queues[_0x446441[_0x0f45('0x4')]][_0x0f45('0x20')],queues[_0x446441[_0x0f45('0x4')]][_0x0f45('0x5e')]));delete queues[_0x446441[_0x0f45('0x4')]][_0x0f45('0x68')];}}}catch(_0xdbda20){utils[_0x0f45('0x16')](util[_0x0f45('0x2')](_0x0f45('0x6b'),_0x446441['uniqueid']),_0xdbda20);}}; \ No newline at end of file +var _0x18e9=['transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','queuecallerjoinAt','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','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','info','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]','variable','toUpperCase','queuecallerabandon','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexitAt','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','queuecallerleaveAt','holdtime','diffTime','count','connectedlinename','agentconnect','assigned','destaccountcode','membername','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension'];(function(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0x18e9,0x149));var _0x918e=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x18e9[_0x4dab14];return _0xf41aa;};'use strict';var _=require(_0x918e('0x0'));var util=require(_0x918e('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x56fd16){utils[_0x918e('0x2')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x56fd16[_0x918e('0x3')],_0x56fd16[_0x918e('0x4')],_0x56fd16[_0x918e('0x5')],_0x56fd16[_0x918e('0x6')],_0x56fd16[_0x918e('0x7')],_0x56fd16[_0x918e('0x8')],_0x56fd16[_0x918e('0x9')]));if(_0x56fd16['queue']){utils[_0x918e('0xa')](_0x56fd16[_0x918e('0x5')])[_0x918e('0xb')](function(_0x45d928){if(_0x45d928){_0x56fd16['type']=_0x45d928[_0x918e('0xc')];}utils[_0x918e('0xd')](_0x918e('0xe'),_0x56fd16);});}else{utils[_0x918e('0xd')](_0x918e('0xe'),_0x56fd16);}if(_0x56fd16[_0x918e('0xf')]){delete queues[_0x56fd16['transfereduniqueid']];}else{delete queues[_0x56fd16[_0x918e('0x3')]];}}exports[_0x918e('0x10')]=function(_0x1f0d1b){try{utils[_0x918e('0x11')](util[_0x918e('0x12')]('[%s][queues][queuecallerjoin]',_0x1f0d1b['uniqueid']),_0x1f0d1b);utils[_0x918e('0x2')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1f0d1b[_0x918e('0x3')],_0x1f0d1b[_0x918e('0x5')],_0x1f0d1b[_0x918e('0x13')]));queues[_0x1f0d1b[_0x918e('0x3')]]=_[_0x918e('0x14')](_0x1f0d1b,{'originalposition':_0x1f0d1b[_0x918e('0x13')],'queuecallerjoinAt':utils[_0x918e('0x15')](),'mohtime':0x0});}catch(_0x422a1a){utils[_0x918e('0x16')](util[_0x918e('0x12')](_0x918e('0x17'),_0x1f0d1b[_0x918e('0x3')]),_0x422a1a);}};exports[_0x918e('0x18')]=function(_0x5a39ab){try{if(!_[_0x918e('0x19')](queues[_0x5a39ab[_0x918e('0x3')]])){utils[_0x918e('0x11')](util[_0x918e('0x12')](_0x918e('0x1a'),_0x5a39ab[_0x918e('0x3')]),_0x5a39ab);if(queues[_0x5a39ab[_0x918e('0x3')]]['queuecallerleaveAt']){if(!queues[_0x5a39ab['uniqueid']]['queuecallerabandon']&&!queues[_0x5a39ab['uniqueid']][_0x918e('0x1b')]){queues[_0x5a39ab[_0x918e('0x3')]][_0x918e('0x1c')]=!![];queues[_0x5a39ab[_0x918e('0x3')]][_0x918e('0x1d')]=utils['now']();queues[_0x5a39ab[_0x918e('0x3')]]['queuecallerexitreason']=_0x918e('0x1e');}utils['info'](util['format'](_0x918e('0x1f'),_0x5a39ab[_0x918e('0x3')],queues[_0x5a39ab[_0x918e('0x3')]][_0x918e('0x20')],queues[_0x5a39ab[_0x918e('0x3')]][_0x918e('0x9')]));writeDB(queues[_0x5a39ab['uniqueid']]);}else if(queues[_0x5a39ab[_0x918e('0x3')]][_0x918e('0xf')]){utils[_0x918e('0x2')](util[_0x918e('0x12')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5a39ab[_0x918e('0x3')],queues[_0x5a39ab['uniqueid']][_0x918e('0x20')],queues[_0x5a39ab[_0x918e('0x3')]][_0x918e('0xf')]));queues[queues[_0x5a39ab[_0x918e('0x3')]]['transfereduniqueid']]=queues[_0x5a39ab['uniqueid']];queues[queues[_0x5a39ab[_0x918e('0x3')]][_0x918e('0xf')]][_0x918e('0x21')]=0x2;delete queues[_0x5a39ab[_0x918e('0x3')]];}}}catch(_0x802899){utils[_0x918e('0x16')](util[_0x918e('0x12')](_0x918e('0x1a'),_0x5a39ab[_0x918e('0x3')]),_0x802899);}};exports['varset']=function(_0x46e9c8){try{utils[_0x918e('0x11')](util[_0x918e('0x12')](_0x918e('0x22'),_0x46e9c8[_0x918e('0x3')]),_0x46e9c8);if(!_[_0x918e('0x19')](_0x46e9c8[_0x918e('0x23')]['queuestatus'])&&_0x46e9c8['value'][_0x918e('0x24')]()!=='CONTINUE'){if(!_[_0x918e('0x19')](queues[_0x46e9c8[_0x918e('0x3')]])){queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x25')]=![];queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x26')]=null;queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x1b')]=!![];queues[_0x46e9c8[_0x918e('0x3')]]['queuecallerexitAt']=utils['now']();queues[_0x46e9c8['uniqueid']][_0x918e('0x9')]=_0x46e9c8['value'][_0x918e('0x24')]();utils[_0x918e('0x2')](util[_0x918e('0x12')](_0x918e('0x27'),_0x46e9c8['uniqueid'],queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x20')],_0x46e9c8['value'],queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x9')]));writeDB(queues[_0x46e9c8[_0x918e('0x3')]]);}}else if(!_[_0x918e('0x19')](_0x46e9c8['variable'][_0x918e('0x28')])){if(!_['isNil'](queues[_0x46e9c8[_0x918e('0x3')]])&&!queues[_0x46e9c8['uniqueid']][_0x918e('0x25')]){queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x25')]=![];queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x26')]=null;queues[_0x46e9c8[_0x918e('0x3')]]['queuecallerexit']=!![];queues[_0x46e9c8[_0x918e('0x3')]]['queuecallerexitAt']=utils[_0x918e('0x15')]();queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x9')]='EXITWITHKEY';utils[_0x918e('0x2')](util[_0x918e('0x12')](_0x918e('0x29'),_0x46e9c8[_0x918e('0x3')],queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x20')],_0x46e9c8['value'],queues[_0x46e9c8[_0x918e('0x3')]][_0x918e('0x9')]));}}}catch(_0x5ecdb8){utils[_0x918e('0x16')](util['format'](_0x918e('0x22'),_0x46e9c8['uniqueid']),_0x5ecdb8);}};exports[_0x918e('0x25')]=function(_0x4f6063){try{if(!_[_0x918e('0x19')](queues[_0x4f6063[_0x918e('0x3')]])){utils[_0x918e('0x11')](util['format'](_0x918e('0x2a'),_0x4f6063['uniqueid']),_0x4f6063);queues[_0x4f6063[_0x918e('0x3')]]['queuecallerexit']=![];queues[_0x4f6063[_0x918e('0x3')]][_0x918e('0x2b')]=null;queues[_0x4f6063[_0x918e('0x3')]][_0x918e('0x25')]=!![];queues[_0x4f6063[_0x918e('0x3')]][_0x918e('0x26')]=utils['now']();queues[_0x4f6063['uniqueid']][_0x918e('0x9')]=_0x918e('0x2c');utils[_0x918e('0x2')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4f6063['uniqueid'],queues[_0x4f6063[_0x918e('0x3')]]['name'],queues[_0x4f6063['uniqueid']]['queuecallerexitreason']));}}catch(_0x1ccc9d){utils[_0x918e('0x16')](util['format'](_0x918e('0x2a'),_0x4f6063[_0x918e('0x3')]),_0x1ccc9d);}};exports[_0x918e('0x2d')]=function(_0x2ac9a0){try{if(!_[_0x918e('0x19')](queues[_0x2ac9a0[_0x918e('0x3')]])){utils[_0x918e('0x11')](util['format'](_0x918e('0x2e'),_0x2ac9a0[_0x918e('0x3')]),_0x2ac9a0);utils[_0x918e('0x2')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2ac9a0[_0x918e('0x3')],queues[_0x2ac9a0[_0x918e('0x3')]][_0x918e('0x20')],_0x2ac9a0[_0x918e('0x2f')],_0x2ac9a0['connectedlinename']));queues[_0x2ac9a0[_0x918e('0x3')]]['queuecallerleave']=!![];queues[_0x2ac9a0['uniqueid']][_0x918e('0x30')]=utils['now']();queues[_0x2ac9a0[_0x918e('0x3')]][_0x918e('0x31')]=utils[_0x918e('0x32')](queues[_0x2ac9a0[_0x918e('0x3')]][_0x918e('0x30')],queues[_0x2ac9a0[_0x918e('0x3')]]['queuecallerjoinAt']);queues[_0x2ac9a0['uniqueid']][_0x918e('0x13')]=_0x2ac9a0[_0x918e('0x13')];queues[_0x2ac9a0[_0x918e('0x3')]][_0x918e('0x33')]=_0x2ac9a0['count'];queues[_0x2ac9a0[_0x918e('0x3')]][_0x918e('0x2f')]=_0x2ac9a0[_0x918e('0x2f')];queues[_0x2ac9a0['uniqueid']][_0x918e('0x34')]=_0x2ac9a0['connectedlinename'];}}catch(_0x96de53){utils[_0x918e('0x16')](util[_0x918e('0x12')](_0x918e('0x2e'),_0x2ac9a0[_0x918e('0x3')]),_0x96de53);}};exports[_0x918e('0x35')]=function(_0xf7ffca){try{if(!_[_0x918e('0x19')](queues[_0xf7ffca[_0x918e('0x3')]])){utils[_0x918e('0x11')](util[_0x918e('0x12')]('[%s][queues][agentconnect]',_0xf7ffca['uniqueid']),_0xf7ffca);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xf7ffca['uniqueid'],queues[_0xf7ffca[_0x918e('0x3')]][_0x918e('0x20')],_0xf7ffca['membername'],_0xf7ffca['destaccountcode']));queues[_0xf7ffca['uniqueid']][_0x918e('0x25')]=![];queues[_0xf7ffca[_0x918e('0x3')]]['queuecallerabandon']=![];queues[_0xf7ffca[_0x918e('0x3')]][_0x918e('0x26')]=null;queues[_0xf7ffca['uniqueid']][_0x918e('0x1b')]=![];queues[_0xf7ffca['uniqueid']][_0x918e('0x9')]=null;queues[_0xf7ffca[_0x918e('0x3')]]['queuecallerexitAt']=null;queues[_0xf7ffca[_0x918e('0x3')]][_0x918e('0x36')]=!![];queues[_0xf7ffca[_0x918e('0x3')]][_0x918e('0x8')]=_0xf7ffca[_0x918e('0x37')];queues[_0xf7ffca['uniqueid']][_0x918e('0x6')]=_0xf7ffca[_0x918e('0x38')];}}catch(_0x418150){utils[_0x918e('0x16')](util[_0x918e('0x12')](_0x918e('0x39'),_0xf7ffca['uniqueid']),_0x418150);}};exports[_0x918e('0x3a')]=function(_0x4b4c77){try{if(!_[_0x918e('0x19')](queues[_0x4b4c77[_0x918e('0x3')]])){if(queues[_0x4b4c77[_0x918e('0x3')]][_0x918e('0x30')]){utils[_0x918e('0x11')](util['format'](_0x918e('0x3b'),_0x4b4c77[_0x918e('0x3')]),_0x4b4c77);queues[_0x4b4c77[_0x918e('0x3')]][_0x918e('0x25')]=![];queues[_0x4b4c77[_0x918e('0x3')]]['queuecallerabandon']=![];queues[_0x4b4c77['uniqueid']][_0x918e('0x26')]=null;queues[_0x4b4c77[_0x918e('0x3')]]['queuecallerexit']=![];queues[_0x4b4c77[_0x918e('0x3')]]['queuecallerexitAt']=null;queues[_0x4b4c77[_0x918e('0x3')]][_0x918e('0x36')]=!![];queues[_0x4b4c77['uniqueid']][_0x918e('0x6')]=_0x4b4c77[_0x918e('0x38')];queues[_0x4b4c77[_0x918e('0x3')]]['queuecallercomplete']=!![];queues[_0x4b4c77[_0x918e('0x3')]][_0x918e('0x1d')]=utils['now']();if(_0x4b4c77['reason']==_0x918e('0x3c')){if(!queues[_0x4b4c77[_0x918e('0x3')]][_0x918e('0x3c')]){queues[_0x4b4c77[_0x918e('0x3')]][_0x918e('0x9')]=_0x918e('0x3d');}}else{queues[_0x4b4c77[_0x918e('0x3')]][_0x918e('0x9')]=_0x918e('0x3e')+_0x4b4c77[_0x918e('0x3f')][_0x918e('0x24')]();}utils[_0x918e('0x2')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x4b4c77['uniqueid'],queues[_0x4b4c77['uniqueid']][_0x918e('0x20')],_0x4b4c77[_0x918e('0x38')],queues[_0x4b4c77['uniqueid']][_0x918e('0x9')]));writeDB(queues[_0x4b4c77[_0x918e('0x3')]]);}}}catch(_0x2df27f){utils[_0x918e('0x16')](util[_0x918e('0x12')](_0x918e('0x3b'),_0x4b4c77['uniqueid']),_0x2df27f);}};exports[_0x918e('0x40')]=function(_0x1c3316){try{if(!_[_0x918e('0x19')](queues[_0x1c3316[_0x918e('0x41')]])){utils[_0x918e('0x11')](util['format'](_0x918e('0x42'),_0x1c3316['uniqueid']),_0x1c3316);queues[_0x1c3316['transfereeuniqueid']]['transfer']=!![];queues[_0x1c3316[_0x918e('0x41')]][_0x918e('0x43')]=_0x918e('0x44');queues[_0x1c3316[_0x918e('0x41')]][_0x918e('0x45')]=_0x1c3316[_0x918e('0x46')];queues[_0x1c3316[_0x918e('0x41')]][_0x918e('0x47')]=_0x1c3316['transfereeuniqueid'];queues[_0x1c3316['transfereeuniqueid']][_0x918e('0x9')]=_0x918e('0x48');utils[_0x918e('0x2')](util[_0x918e('0x12')](_0x918e('0x49'),_0x1c3316['uniqueid'],queues[_0x1c3316[_0x918e('0x41')]][_0x918e('0x20')],_0x1c3316[_0x918e('0x41')],_0x1c3316['extension']));}}catch(_0x13f6af){utils[_0x918e('0x16')](util['format']('[%s][queues][blindtransfer]',_0x1c3316[_0x918e('0x3')]),_0x13f6af);}};exports[_0x918e('0x4a')]=function(_0x752e06){try{utils['debug'](util[_0x918e('0x12')](_0x918e('0x4b'),_0x752e06[_0x918e('0x4c')]),_0x752e06);if(_0x752e06[_0x918e('0x4c')]==_0x752e06[_0x918e('0x4d')]){if(!_[_0x918e('0x19')](queues[_0x752e06['secondtransfererlinkedid']])){utils['info'](util[_0x918e('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x752e06[_0x918e('0x4c')],queues[_0x752e06[_0x918e('0x4e')]][_0x918e('0x20')],_0x752e06[_0x918e('0x4f')]));queues[_0x752e06[_0x918e('0x4e')]]['transfer']=!![];queues[_0x752e06[_0x918e('0x4e')]][_0x918e('0x43')]=_0x918e('0x50');queues[_0x752e06[_0x918e('0x4e')]][_0x918e('0x45')]=_0x752e06['origtransfererexten'];queues[_0x752e06[_0x918e('0x4e')]][_0x918e('0x47')]=_0x752e06[_0x918e('0x4c')];queues[_0x752e06[_0x918e('0x4e')]][_0x918e('0x9')]=_0x918e('0x51');}if(!_[_0x918e('0x19')](queues[_0x752e06[_0x918e('0x4d')]])){if(_0x752e06[_0x918e('0x52')]&&queues[_0x752e06[_0x918e('0x52')]]){queues[_0x752e06[_0x918e('0x52')]]['queuecallerenterreason']=0x1;queues[_0x752e06[_0x918e('0x41')]]=_[_0x918e('0x53')](queues[_0x752e06['transfereelinkedid']]);queues[_0x752e06['transfereeuniqueid']][_0x918e('0xf')]=_0x752e06['transfertargetuniqueid'];queues[_0x752e06[_0x918e('0x41')]]['queuecallerenterreason']=0x2;queues[_0x752e06[_0x918e('0x41')]][_0x918e('0x7')]=queues[_0x752e06[_0x918e('0x4e')]]['calleridnum'];queues[_0x752e06['transfereeuniqueid']][_0x918e('0x54')]=queues[_0x752e06['secondtransfererlinkedid']][_0x918e('0x54')];queues[_0x752e06['transfereeuniqueid']][_0x918e('0x55')]=utils['now']();queues[_0x752e06[_0x918e('0x41')]][_0x918e('0x30')]=utils['now']();queues[_0x752e06[_0x918e('0x41')]][_0x918e('0x31')]=0x0;queues[_0x752e06['transfereeuniqueid']][_0x918e('0x56')]=0x0;utils[_0x918e('0x2')](util[_0x918e('0x12')](_0x918e('0x57'),_0x752e06[_0x918e('0x4c')],queues[_0x752e06[_0x918e('0x41')]][_0x918e('0x20')],queues[_0x752e06[_0x918e('0x41')]][_0x918e('0x7')],queues[_0x752e06['transfereeuniqueid']][_0x918e('0x54')]));}else{utils[_0x918e('0x2')](util[_0x918e('0x12')](_0x918e('0x58'),_0x752e06[_0x918e('0x4c')],queues[_0x752e06[_0x918e('0x4d')]][_0x918e('0x20')],_0x752e06['secondtransfererlinkedid']));queues[_0x752e06[_0x918e('0x4d')]][_0x918e('0xf')]=_0x752e06[_0x918e('0x4e')];}}}else if(_0x752e06[_0x918e('0x59')]==_0x752e06[_0x918e('0x4e')]){if(!_[_0x918e('0x19')](queues[_0x752e06[_0x918e('0x4d')]])){utils[_0x918e('0x2')](util[_0x918e('0x12')](_0x918e('0x5a'),_0x752e06['origtransfereruniqueid'],queues[_0x752e06[_0x918e('0x4d')]]['name'],_0x752e06[_0x918e('0x59')],_0x752e06['secondtransfererexten']));queues[_0x752e06[_0x918e('0x4d')]][_0x918e('0x3c')]=!![];queues[_0x752e06[_0x918e('0x4d')]][_0x918e('0x43')]=_0x918e('0x50');queues[_0x752e06[_0x918e('0x4d')]]['transferexten']=_0x752e06['secondtransfererexten'];queues[_0x752e06[_0x918e('0x4d')]]['transferuniqueid']=_0x752e06['secondtransfereruniqueid'];queues[_0x752e06[_0x918e('0x4d')]][_0x918e('0x9')]=_0x918e('0x51');}if(!_[_0x918e('0x19')](queues[_0x752e06[_0x918e('0x4e')]])){if(_0x752e06['transfertargetlinkedid']&&queues[_0x752e06[_0x918e('0x5b')]]){queues[_0x752e06[_0x918e('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x752e06[_0x918e('0x5c')]]=_[_0x918e('0x53')](queues[_0x752e06[_0x918e('0x5b')]]);queues[_0x752e06['transfertargetuniqueid']][_0x918e('0xf')]=_0x752e06[_0x918e('0x5c')];queues[_0x752e06[_0x918e('0x5c')]]['queuecallerenterreason']=0x2;queues[_0x752e06[_0x918e('0x5c')]][_0x918e('0x7')]=queues[_0x752e06[_0x918e('0x4d')]][_0x918e('0x7')];queues[_0x752e06['transfertargetuniqueid']][_0x918e('0x54')]=queues[_0x752e06['origtransfererlinkedid']][_0x918e('0x54')];queues[_0x752e06[_0x918e('0x5c')]][_0x918e('0x55')]=utils['now']();queues[_0x752e06['transfertargetuniqueid']][_0x918e('0x30')]=utils[_0x918e('0x15')]();queues[_0x752e06[_0x918e('0x5c')]][_0x918e('0x31')]=0x0;queues[_0x752e06[_0x918e('0x5c')]][_0x918e('0x56')]=0x0;utils['info'](util[_0x918e('0x12')](_0x918e('0x5d'),_0x752e06[_0x918e('0x4c')],queues[_0x752e06[_0x918e('0x5c')]][_0x918e('0x20')],queues[_0x752e06['transfertargetuniqueid']][_0x918e('0xf')],queues[_0x752e06[_0x918e('0x5c')]][_0x918e('0x7')],queues[_0x752e06[_0x918e('0x5c')]][_0x918e('0x54')]));}else{utils[_0x918e('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x752e06[_0x918e('0x4c')],queues[_0x752e06[_0x918e('0x4e')]]['name'],_0x752e06[_0x918e('0x4d')]));queues[_0x752e06[_0x918e('0x4e')]][_0x918e('0xf')]=_0x752e06[_0x918e('0x4d')];}}}}catch(_0x2e56c5){utils[_0x918e('0x16')](util[_0x918e('0x12')]('[%s][queues][attendedtransfer]',_0x752e06[_0x918e('0x4c')]),_0x2e56c5);}};exports[_0x918e('0x5e')]=function(_0x26adb0){try{if(!_['isNil'](queues[_0x26adb0[_0x918e('0x3')]])){utils[_0x918e('0x11')](util[_0x918e('0x12')](_0x918e('0x5f'),_0x26adb0['uniqueid']),_0x26adb0);queues[_0x26adb0[_0x918e('0x3')]][_0x918e('0x60')]=utils[_0x918e('0x15')]();utils[_0x918e('0x2')](util['format'](_0x918e('0x61'),_0x26adb0[_0x918e('0x3')],queues[_0x26adb0[_0x918e('0x3')]][_0x918e('0x20')],queues[_0x26adb0[_0x918e('0x3')]][_0x918e('0x60')]));}}catch(_0x464f54){utils['error'](util[_0x918e('0x12')]('[%s][queues][musiconholdstart]',_0x26adb0['uniqueid']),_0x464f54);}};exports[_0x918e('0x62')]=function(_0x31ea80){try{if(!_['isNil'](queues[_0x31ea80[_0x918e('0x3')]])){if(!_[_0x918e('0x19')](queues[_0x31ea80['uniqueid']]['musiconholdstartAt'])){utils['debug'](util[_0x918e('0x12')](_0x918e('0x63'),_0x31ea80['uniqueid']),_0x31ea80);queues[_0x31ea80[_0x918e('0x3')]][_0x918e('0x56')]+=utils[_0x918e('0x32')](utils[_0x918e('0x15')](),queues[_0x31ea80[_0x918e('0x3')]]['musiconholdstartAt']);utils['info'](util[_0x918e('0x12')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x31ea80[_0x918e('0x3')],queues[_0x31ea80[_0x918e('0x3')]]['name'],queues[_0x31ea80[_0x918e('0x3')]][_0x918e('0x56')]));delete queues[_0x31ea80['uniqueid']][_0x918e('0x60')];}}}catch(_0x143035){utils[_0x918e('0x16')](util[_0x918e('0x12')](_0x918e('0x63'),_0x31ea80[_0x918e('0x3')]),_0x143035);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 38cb662..0e1b665 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 _0xdf36=['outbound','forEach','clone','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','find','monitors','push','error','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type'];(function(_0x1d7827,_0x42b0db){var _0xb449f1=function(_0x482ebc){while(--_0x482ebc){_0x1d7827['push'](_0x1d7827['shift']());}};_0xb449f1(++_0x42b0db);}(_0xdf36,0xa8));var _0x6df3=function(_0x54a83f,_0x528962){_0x54a83f=_0x54a83f-0x0;var _0x5a5366=_0xdf36[_0x54a83f];return _0x5a5366;};'use strict';var _=require(_0x6df3('0x0'));var util=require(_0x6df3('0x1'));var utils=require(_0x6df3('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x3388a4){var _0x5d499b;utils[_0x6df3('0x3')](util[_0x6df3('0x4')]('[%s][recordings][writeDB]',_0x3388a4['uniqueid']));if(transfers['blinds'][_0x3388a4[_0x6df3('0x5')]]){_0x5d499b=_0x3388a4[_0x6df3('0x5')];_0x3388a4[_0x6df3('0x5')]=transfers[_0x6df3('0x6')][_0x3388a4['uniqueid']][_0x6df3('0x7')];}if(_0x3388a4[_0x6df3('0x8')]){utils['getUserByInternal'](_0x3388a4['accountcode'])[_0x6df3('0x9')](function(_0x5c8444){if(_0x5c8444){_0x3388a4[_0x6df3('0xa')]=_0x5c8444[_0x6df3('0xb')];_0x3388a4[_0x6df3('0xc')]=_0x5c8444['id'];}utils[_0x6df3('0xd')](_0x6df3('0xe'),_0x3388a4);});}else{utils[_0x6df3('0xd')](_0x6df3('0xe'),_0x3388a4);}if(_0x5d499b)delete transfers[_0x6df3('0x6')][_0x5d499b];}exports[_0x6df3('0xf')]=function(_0x2daee8){try{utils[_0x6df3('0x10')](util[_0x6df3('0x4')]('[%s][recordings][newchannel]',_0x2daee8[_0x6df3('0x5')]),_0x2daee8);if(_0x2daee8[_0x6df3('0x5')]==_0x2daee8[_0x6df3('0x11')]){utils[_0x6df3('0x3')](util[_0x6df3('0x4')](_0x6df3('0x12'),_0x2daee8[_0x6df3('0x5')],_0x2daee8[_0x6df3('0x13')],_0x2daee8[_0x6df3('0x14')]));recordings[_0x2daee8['uniqueid']]={'uniqueid':_0x2daee8['uniqueid'],'accountcode':_0x2daee8['accountcode'],'exten':_0x2daee8[_0x6df3('0x14')],'context':_0x2daee8[_0x6df3('0x13')],'channel':_0x2daee8[_0x6df3('0x15')],'monitors':[]};}}catch(_0x73e64a){utils['error'](util[_0x6df3('0x4')](_0x6df3('0x16'),_0x2daee8[_0x6df3('0x5')]),_0x73e64a);}};exports[_0x6df3('0x17')]=function(_0x44c2e9){try{utils[_0x6df3('0x10')](util[_0x6df3('0x4')](_0x6df3('0x18'),_0x44c2e9['uniqueid']),_0x44c2e9);if(!_[_0x6df3('0x19')](recordings[_0x44c2e9[_0x6df3('0x5')]])&&_0x44c2e9['channelstate']==0x6){utils[_0x6df3('0x3')](util['format'](_0x6df3('0x1a'),_0x44c2e9[_0x6df3('0x5')],_0x44c2e9['context'],_0x44c2e9['channel']));}else if(!_['isNil'](recordings[_0x44c2e9['linkedid']])&&_0x44c2e9[_0x6df3('0x1b')]==0x6&&_0x44c2e9[_0x6df3('0x13')]!=_0x6df3('0x1c')){utils['info'](util['format'](_0x6df3('0x1d'),_0x44c2e9[_0x6df3('0x5')],_0x44c2e9['linkedid'],_0x44c2e9['context'],_0x44c2e9['channel']));recordings[_0x44c2e9[_0x6df3('0x11')]][_0x6df3('0x8')]=_0x44c2e9[_0x6df3('0x8')];}}catch(_0x4a240f){utils['error'](util['format'](_0x6df3('0x18'),_0x44c2e9[_0x6df3('0x5')]),_0x4a240f);}};exports[_0x6df3('0x1e')]=function(_0x4726b1){try{if(!_[_0x6df3('0x19')](_0x4726b1[_0x6df3('0x1f')])&&!_['isNil'](_0x4726b1['variable'][_0x6df3('0x20')])){utils[_0x6df3('0x10')](util[_0x6df3('0x4')](_0x6df3('0x21'),_0x4726b1[_0x6df3('0x5')]),_0x4726b1);utils[_0x6df3('0x3')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x4726b1[_0x6df3('0x5')],_0x4726b1[_0x6df3('0x1f')],_0x4726b1[_0x6df3('0x22')]));if(_[_0x6df3('0x23')](_0x4726b1[_0x6df3('0x22')],_0x6df3('0x24'))){_0x4726b1[_0x6df3('0x22')]=_0x4726b1[_0x6df3('0x22')][_0x6df3('0x25')](_0x6df3('0x24'),'.WAV');}if(recordings[_0x4726b1[_0x6df3('0x11')]]){var _0x3c2e71=_[_0x6df3('0x26')](recordings[_0x4726b1[_0x6df3('0x11')]]['monitors'],{'value':_0x4726b1['value']});if(_[_0x6df3('0x19')](_0x3c2e71)){recordings[_0x4726b1[_0x6df3('0x11')]][_0x6df3('0x27')][_0x6df3('0x28')]({'value':_0x4726b1[_0x6df3('0x22')]});}}}}catch(_0x3b05c5){utils[_0x6df3('0x29')](util[_0x6df3('0x4')](_0x6df3('0x21'),_0x4726b1[_0x6df3('0x5')]),_0x3b05c5);}};exports[_0x6df3('0x2a')]=function(_0xd70a83){try{if(!_[_0x6df3('0x19')](recordings[_0xd70a83[_0x6df3('0x5')]])){utils[_0x6df3('0x10')](util['format'](_0x6df3('0x2b'),_0xd70a83[_0x6df3('0x5')]),_0xd70a83);utils[_0x6df3('0x3')](util[_0x6df3('0x4')](_0x6df3('0x2c'),_0xd70a83['uniqueid'],_0xd70a83['calleridnum'],_0xd70a83['calleridname'],_0xd70a83[_0x6df3('0x2d')]));recordings[_0xd70a83[_0x6df3('0x5')]][_0x6df3('0x2e')]=_0xd70a83['calleridnum'];recordings[_0xd70a83[_0x6df3('0x5')]][_0x6df3('0x2f')]=_0xd70a83[_0x6df3('0x2f')];recordings[_0xd70a83[_0x6df3('0x5')]][_0x6df3('0x30')]=_0xd70a83['connectedlinenum'];recordings[_0xd70a83[_0x6df3('0x5')]][_0x6df3('0x31')]=_0xd70a83['connectedlinename'];if(recordings[_0xd70a83[_0x6df3('0x5')]][_0x6df3('0x32')]==_0x6df3('0x33')&&recordings[_0xd70a83['uniqueid']][_0x6df3('0x8')]){recordings[_0xd70a83[_0x6df3('0x5')]][_0x6df3('0x30')]=recordings[_0xd70a83[_0x6df3('0x5')]][_0x6df3('0x8')];recordings[_0xd70a83[_0x6df3('0x5')]][_0x6df3('0x31')]='';}recordings[_0xd70a83[_0x6df3('0x5')]][_0x6df3('0x27')][_0x6df3('0x34')](function(_0xccb1d8){var _0x1d065d=_[_0x6df3('0x35')](recordings[_0xd70a83['uniqueid']]);_0x1d065d[_0x6df3('0x22')]=_0xccb1d8[_0x6df3('0x22')];writeDB(_0x1d065d);});delete recordings[_0xd70a83[_0x6df3('0x5')]];}}catch(_0x185e4b){utils['error'](util[_0x6df3('0x4')](_0x6df3('0x2b'),_0xd70a83[_0x6df3('0x5')]),_0x185e4b);}};exports['newexten']=function(_0x5de718){try{if(!_['isNil'](recordings[_0x5de718[_0x6df3('0x5')]])){utils[_0x6df3('0x10')](util['format'](_0x6df3('0x36'),_0x5de718[_0x6df3('0x5')]),_0x5de718);utils[_0x6df3('0x3')](util[_0x6df3('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x5de718[_0x6df3('0x5')],_0x5de718[_0x6df3('0x37')],_0x5de718[_0x6df3('0x38')]));if(_0x5de718[_0x6df3('0x37')][_0x6df3('0x39')]()==_0x6df3('0x3a')&&_[_0x6df3('0x3b')](_0x5de718[_0x6df3('0x38')][_0x6df3('0x39')](),_0x6df3('0x3c'))){var _0x19d16f=_0x5de718[_0x6df3('0x38')]['split']('=');var _0x50b3ba=_0x19d16f[0x0][_0x6df3('0x3d')](_0x19d16f[0x0][_0x6df3('0x3e')]('(')+0x1,_0x19d16f[0x0][_0x6df3('0x3e')](')'));var _0x2c14ee=_0x19d16f[0x1];recordings[_0x5de718['uniqueid']][_0x50b3ba]=_0x2c14ee;}}}catch(_0x351d36){utils[_0x6df3('0x29')](util[_0x6df3('0x4')](_0x6df3('0x36'),_0x5de718['uniqueid']),_0x351d36);}};exports[_0x6df3('0x3f')]=function(_0x596df2){try{if(!_[_0x6df3('0x19')](recordings[_0x596df2['uniqueid']])){utils[_0x6df3('0x10')](util[_0x6df3('0x4')]('[%s][recordings][queuecallerjoin]',_0x596df2[_0x6df3('0x5')]),_0x596df2);utils[_0x6df3('0x3')](util[_0x6df3('0x4')](_0x6df3('0x40'),_0x596df2[_0x6df3('0x5')],_0x596df2[_0x6df3('0x41')]));recordings[_0x596df2['uniqueid']][_0x6df3('0x41')]=_0x596df2[_0x6df3('0x41')];}}catch(_0x47d19d){utils[_0x6df3('0x29')](util[_0x6df3('0x4')](_0x6df3('0x42'),_0x596df2[_0x6df3('0x5')]),_0x47d19d);}};exports[_0x6df3('0x43')]=function(_0x181d1c){try{utils[_0x6df3('0x10')](util[_0x6df3('0x4')](_0x6df3('0x44'),_0x181d1c[_0x6df3('0x5')]),_0x181d1c);utils[_0x6df3('0x3')](util[_0x6df3('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x181d1c['uniqueid'],_0x181d1c[_0x6df3('0x45')],_0x181d1c['transferercalleridname'],_0x181d1c['transfereecalleridnum'],_0x181d1c[_0x6df3('0x46')]));if(recordings[_0x181d1c[_0x6df3('0x47')]]&&transfers[_0x6df3('0x6')][_0x181d1c['transfereruniqueid']]){transfers[_0x6df3('0x6')][_0x181d1c[_0x6df3('0x47')]][_0x6df3('0x48')]=!![];}}catch(_0x5d882f){utils[_0x6df3('0x29')](util['format'](_0x6df3('0x44'),_0x181d1c[_0x6df3('0x5')]),_0x5d882f);}}; \ No newline at end of file +var _0xb601=['channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.WAV','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinename','connectedlinenum','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','then','name','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','newstate','isNil'];(function(_0x3a4ae4,_0x3a2e07){var _0x328c58=function(_0x47397f){while(--_0x47397f){_0x3a4ae4['push'](_0x3a4ae4['shift']());}};_0x328c58(++_0x3a2e07);}(_0xb601,0x105));var _0x1b60=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0xb601[_0x221b8c];return _0x3fab9f;};'use strict';var _=require(_0x1b60('0x0'));var util=require(_0x1b60('0x1'));var utils=require(_0x1b60('0x2'));var transfers=require(_0x1b60('0x3'));var recordings={};function writeDB(_0x3f3bbe){var _0x544642;utils[_0x1b60('0x4')](util[_0x1b60('0x5')](_0x1b60('0x6'),_0x3f3bbe[_0x1b60('0x7')]));if(transfers[_0x1b60('0x8')][_0x3f3bbe['uniqueid']]){_0x544642=_0x3f3bbe['uniqueid'];_0x3f3bbe[_0x1b60('0x7')]=transfers['blinds'][_0x3f3bbe['uniqueid']][_0x1b60('0x9')];}if(_0x3f3bbe['accountcode']){utils[_0x1b60('0xa')](_0x3f3bbe['accountcode'])[_0x1b60('0xb')](function(_0x1b4667){if(_0x1b4667){_0x3f3bbe['membername']=_0x1b4667[_0x1b60('0xc')];_0x3f3bbe['UserId']=_0x1b4667['id'];}utils['request'](_0x1b60('0xd'),_0x3f3bbe);});}else{utils[_0x1b60('0xe')](_0x1b60('0xd'),_0x3f3bbe);}if(_0x544642)delete transfers[_0x1b60('0x8')][_0x544642];}exports['newchannel']=function(_0x342c1a){try{utils[_0x1b60('0xf')](util['format'](_0x1b60('0x10'),_0x342c1a[_0x1b60('0x7')]),_0x342c1a);if(_0x342c1a[_0x1b60('0x7')]==_0x342c1a['linkedid']){utils[_0x1b60('0x4')](util[_0x1b60('0x5')](_0x1b60('0x11'),_0x342c1a[_0x1b60('0x7')],_0x342c1a[_0x1b60('0x12')],_0x342c1a[_0x1b60('0x13')]));recordings[_0x342c1a[_0x1b60('0x7')]]={'uniqueid':_0x342c1a[_0x1b60('0x7')],'accountcode':_0x342c1a[_0x1b60('0x14')],'exten':_0x342c1a[_0x1b60('0x13')],'context':_0x342c1a[_0x1b60('0x12')],'channel':_0x342c1a['channel'],'monitors':[]};}}catch(_0x5ac293){utils['error'](util[_0x1b60('0x5')]('[%s][recordings][newchannel]',_0x342c1a[_0x1b60('0x7')]),_0x5ac293);}};exports[_0x1b60('0x15')]=function(_0x14e47c){try{utils[_0x1b60('0xf')](util['format']('[%s][recordings][newstate]',_0x14e47c['uniqueid']),_0x14e47c);if(!_[_0x1b60('0x16')](recordings[_0x14e47c[_0x1b60('0x7')]])&&_0x14e47c[_0x1b60('0x17')]==0x6){utils[_0x1b60('0x4')](util[_0x1b60('0x5')](_0x1b60('0x18'),_0x14e47c[_0x1b60('0x7')],_0x14e47c[_0x1b60('0x12')],_0x14e47c[_0x1b60('0x19')]));}else if(!_[_0x1b60('0x16')](recordings[_0x14e47c[_0x1b60('0x1a')]])&&_0x14e47c[_0x1b60('0x17')]==0x6&&_0x14e47c['context']!='transfer'){utils['info'](util['format'](_0x1b60('0x1b'),_0x14e47c[_0x1b60('0x7')],_0x14e47c[_0x1b60('0x1a')],_0x14e47c['context'],_0x14e47c[_0x1b60('0x19')]));recordings[_0x14e47c[_0x1b60('0x1a')]][_0x1b60('0x14')]=_0x14e47c[_0x1b60('0x14')];}}catch(_0x4d7c65){utils[_0x1b60('0x1c')](util[_0x1b60('0x5')](_0x1b60('0x1d'),_0x14e47c[_0x1b60('0x7')]),_0x4d7c65);}};exports[_0x1b60('0x1e')]=function(_0x1955cb){try{if(!_[_0x1b60('0x16')](_0x1955cb[_0x1b60('0x1f')])&&!_[_0x1b60('0x16')](_0x1955cb['variable']['mixmonitor_filename'])){utils[_0x1b60('0xf')](util['format'](_0x1b60('0x20'),_0x1955cb[_0x1b60('0x7')]),_0x1955cb);utils[_0x1b60('0x4')](util['format'](_0x1b60('0x21'),_0x1955cb[_0x1b60('0x7')],_0x1955cb[_0x1b60('0x1f')],_0x1955cb['value']));if(_[_0x1b60('0x22')](_0x1955cb[_0x1b60('0x23')],'.wav49')){_0x1955cb[_0x1b60('0x23')]=_0x1955cb[_0x1b60('0x23')]['replace']('.wav49',_0x1b60('0x24'));}if(recordings[_0x1955cb[_0x1b60('0x1a')]]){var _0x53e381=_['find'](recordings[_0x1955cb[_0x1b60('0x1a')]][_0x1b60('0x25')],{'value':_0x1955cb[_0x1b60('0x23')]});if(_[_0x1b60('0x16')](_0x53e381)){recordings[_0x1955cb[_0x1b60('0x1a')]][_0x1b60('0x25')][_0x1b60('0x26')]({'value':_0x1955cb[_0x1b60('0x23')]});}}}}catch(_0x4f0df8){utils[_0x1b60('0x1c')](util[_0x1b60('0x5')](_0x1b60('0x20'),_0x1955cb[_0x1b60('0x7')]),_0x4f0df8);}};exports['hangup']=function(_0x5c58bd){try{if(!_[_0x1b60('0x16')](recordings[_0x5c58bd['uniqueid']])){utils[_0x1b60('0xf')](util[_0x1b60('0x5')](_0x1b60('0x27'),_0x5c58bd[_0x1b60('0x7')]),_0x5c58bd);utils[_0x1b60('0x4')](util[_0x1b60('0x5')](_0x1b60('0x28'),_0x5c58bd[_0x1b60('0x7')],_0x5c58bd[_0x1b60('0x29')],_0x5c58bd[_0x1b60('0x2a')],_0x5c58bd[_0x1b60('0x2b')]));recordings[_0x5c58bd['uniqueid']][_0x1b60('0x29')]=_0x5c58bd[_0x1b60('0x29')];recordings[_0x5c58bd['uniqueid']][_0x1b60('0x2a')]=_0x5c58bd[_0x1b60('0x2a')];recordings[_0x5c58bd[_0x1b60('0x7')]]['connectedlinenum']=_0x5c58bd['connectedlinenum'];recordings[_0x5c58bd[_0x1b60('0x7')]][_0x1b60('0x2c')]=_0x5c58bd[_0x1b60('0x2c')];if(recordings[_0x5c58bd['uniqueid']]['type']=='outbound'&&recordings[_0x5c58bd['uniqueid']][_0x1b60('0x14')]){recordings[_0x5c58bd['uniqueid']][_0x1b60('0x2d')]=recordings[_0x5c58bd['uniqueid']][_0x1b60('0x14')];recordings[_0x5c58bd['uniqueid']][_0x1b60('0x2c')]='';}recordings[_0x5c58bd['uniqueid']][_0x1b60('0x25')][_0x1b60('0x2e')](function(_0x270528){var _0x5f0662=_[_0x1b60('0x2f')](recordings[_0x5c58bd[_0x1b60('0x7')]]);_0x5f0662[_0x1b60('0x23')]=_0x270528[_0x1b60('0x23')];writeDB(_0x5f0662);});delete recordings[_0x5c58bd[_0x1b60('0x7')]];}}catch(_0x411246){utils['error'](util['format'](_0x1b60('0x27'),_0x5c58bd['uniqueid']),_0x411246);}};exports[_0x1b60('0x30')]=function(_0x253892){try{if(!_[_0x1b60('0x16')](recordings[_0x253892[_0x1b60('0x7')]])){utils[_0x1b60('0xf')](util[_0x1b60('0x5')](_0x1b60('0x31'),_0x253892[_0x1b60('0x7')]),_0x253892);utils[_0x1b60('0x4')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x253892[_0x1b60('0x7')],_0x253892[_0x1b60('0x32')],_0x253892[_0x1b60('0x33')]));if(_0x253892[_0x1b60('0x32')][_0x1b60('0x34')]()==_0x1b60('0x35')&&_[_0x1b60('0x36')](_0x253892['appdata'][_0x1b60('0x34')](),_0x1b60('0x37'))){var _0x4bcae6=_0x253892[_0x1b60('0x33')][_0x1b60('0x38')]('=');var _0x5b9ab7=_0x4bcae6[0x0][_0x1b60('0x39')](_0x4bcae6[0x0][_0x1b60('0x3a')]('(')+0x1,_0x4bcae6[0x0][_0x1b60('0x3a')](')'));var _0x165c41=_0x4bcae6[0x1];recordings[_0x253892[_0x1b60('0x7')]][_0x5b9ab7]=_0x165c41;}}}catch(_0x18d334){utils[_0x1b60('0x1c')](util['format']('[%s][recordings][newexten]',_0x253892[_0x1b60('0x7')]),_0x18d334);}};exports[_0x1b60('0x3b')]=function(_0x1dab68){try{if(!_[_0x1b60('0x16')](recordings[_0x1dab68[_0x1b60('0x7')]])){utils[_0x1b60('0xf')](util['format'](_0x1b60('0x3c'),_0x1dab68[_0x1b60('0x7')]),_0x1dab68);utils[_0x1b60('0x4')](util[_0x1b60('0x5')](_0x1b60('0x3d'),_0x1dab68['uniqueid'],_0x1dab68[_0x1b60('0x3e')]));recordings[_0x1dab68[_0x1b60('0x7')]][_0x1b60('0x3e')]=_0x1dab68[_0x1b60('0x3e')];}}catch(_0x59d6e1){utils[_0x1b60('0x1c')](util[_0x1b60('0x5')](_0x1b60('0x3c'),_0x1dab68[_0x1b60('0x7')]),_0x59d6e1);}};exports[_0x1b60('0x3f')]=function(_0x35fd7e){try{utils[_0x1b60('0xf')](util[_0x1b60('0x5')](_0x1b60('0x40'),_0x35fd7e['uniqueid']),_0x35fd7e);utils[_0x1b60('0x4')](util[_0x1b60('0x5')](_0x1b60('0x41'),_0x35fd7e[_0x1b60('0x7')],_0x35fd7e[_0x1b60('0x42')],_0x35fd7e[_0x1b60('0x43')],_0x35fd7e[_0x1b60('0x44')],_0x35fd7e[_0x1b60('0x45')]));if(recordings[_0x35fd7e['transfereruniqueid']]&&transfers[_0x1b60('0x8')][_0x35fd7e[_0x1b60('0x46')]]){transfers[_0x1b60('0x8')][_0x35fd7e['transfereruniqueid']]['recording']=!![];}}catch(_0x24007c){utils[_0x1b60('0x1c')](util['format'](_0x1b60('0x40'),_0x35fd7e['uniqueid']),_0x24007c);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 6bed6f9..566f836 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 _0x7261=['format','[%s][transfers][writeDB]\x20type:%s','type','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','blinds','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info'];(function(_0x278787,_0xa27e4d){var _0x3078d2=function(_0x44f459){while(--_0x44f459){_0x278787['push'](_0x278787['shift']());}};_0x3078d2(++_0xa27e4d);}(_0x7261,0x129));var _0x1726=function(_0x3d1047,_0x14d621){_0x3d1047=_0x3d1047-0x0;var _0x21c4e7=_0x7261[_0x3d1047];return _0x21c4e7;};'use strict';var _=require(_0x1726('0x0'));var util=require(_0x1726('0x1'));var utils=require(_0x1726('0x2'));function writeDB(_0x4b8d1d){utils[_0x1726('0x3')](util[_0x1726('0x4')](_0x1726('0x5'),_0x4b8d1d[_0x1726('0x6')]==='attended'?_0x4b8d1d['origtransfereruniqueid']:_0x4b8d1d['uniqueid'],_0x4b8d1d[_0x1726('0x6')]));utils['request']('CreateVoiceTransferReport',_0x4b8d1d);}exports['blinds']={};exports[_0x1726('0x7')]=function(_0x504381){try{utils[_0x1726('0x8')](util[_0x1726('0x4')](_0x1726('0x9'),_0x504381[_0x1726('0xa')]),_0x504381);utils[_0x1726('0x3')](util['format'](_0x1726('0xb'),_0x504381[_0x1726('0xa')],_0x504381[_0x1726('0xc')],_0x504381[_0x1726('0xd')],_0x504381[_0x1726('0xe')],_0x504381[_0x1726('0xf')]));_0x504381[_0x1726('0x6')]=_0x1726('0x10');exports[_0x1726('0x11')][_0x504381[_0x1726('0x12')]]=_0x504381;writeDB(_0x504381);}catch(_0x43c3cd){utils[_0x1726('0x13')](util['format'](_0x1726('0x9'),_0x504381[_0x1726('0xa')]),_0x43c3cd);}};exports[_0x1726('0x14')]=function(_0x221498){try{utils[_0x1726('0x8')](util[_0x1726('0x4')](_0x1726('0x15'),_0x221498[_0x1726('0x16')]),_0x221498);utils[_0x1726('0x3')](util[_0x1726('0x4')](_0x1726('0x17'),_0x221498[_0x1726('0x16')],_0x221498[_0x1726('0x18')],_0x221498['origtransferercalleridname'],_0x221498[_0x1726('0x19')],_0x221498[_0x1726('0x1a')]));_0x221498=_[_0x1726('0x1b')](_0x221498,{'transfererchannel':_0x221498[_0x1726('0x1c')],'transferercalleridnum':_0x221498[_0x1726('0x18')],'transferercalleridname':_0x221498['origtransferercalleridname'],'transfererconnectedlinenum':_0x221498[_0x1726('0x1d')],'transfererconnectedlinename':_0x221498[_0x1726('0x1e')],'transfereraccountcode':_0x221498[_0x1726('0x1f')],'transferercontext':_0x221498['secondtransferercontext'],'transfererexten':_0x221498[_0x1726('0x20')],'transfererlinkedid':_0x221498[_0x1726('0x21')],'context':_0x221498[_0x1726('0x22')],'extension':_0x221498['origtransfererexten'],'type':_0x1726('0x23')});if(_[_0x1726('0x24')](_0x221498[_0x1726('0x25')])){_0x221498=_[_0x1726('0x1b')](_0x221498,{'transfereechannel':_0x221498['transfertargetchannel'],'transfereecalleridnum':_0x221498['transfertargetcalleridnum'],'transfereecalleridname':_0x221498['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x221498[_0x1726('0x26')],'transfereeconnectedlinename':_0x221498[_0x1726('0x27')],'transfereeaccountcode':_0x221498[_0x1726('0x28')],'transfereecontext':_0x221498[_0x1726('0x29')],'transfereeexten':_0x221498[_0x1726('0x2a')],'transfereelinkedid':_0x221498['transfertargetlinkedid']});}writeDB(_0x221498);}catch(_0x31e007){utils[_0x1726('0x13')](util[_0x1726('0x4')](_0x1726('0x15'),_0x221498['origtransfereruniqueid']),_0x31e007);}}; \ No newline at end of file +var _0xb3bd=['uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','debug'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xb3bd,0x144));var _0xdb3b=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0xb3bd[_0x4cbf20];return _0x582ae4;};'use strict';var _=require('lodash');var util=require(_0xdb3b('0x0'));var utils=require(_0xdb3b('0x1'));function writeDB(_0x10f99b){utils[_0xdb3b('0x2')](util[_0xdb3b('0x3')](_0xdb3b('0x4'),_0x10f99b['type']==='attended'?_0x10f99b[_0xdb3b('0x5')]:_0x10f99b['uniqueid'],_0x10f99b[_0xdb3b('0x6')]));utils[_0xdb3b('0x7')](_0xdb3b('0x8'),_0x10f99b);}exports[_0xdb3b('0x9')]={};exports[_0xdb3b('0xa')]=function(_0xf661f8){try{utils[_0xdb3b('0xb')](util[_0xdb3b('0x3')]('[%s][transfers][blindtransfer]',_0xf661f8[_0xdb3b('0xc')]),_0xf661f8);utils['info'](util[_0xdb3b('0x3')](_0xdb3b('0xd'),_0xf661f8[_0xdb3b('0xc')],_0xf661f8[_0xdb3b('0xe')],_0xf661f8[_0xdb3b('0xf')],_0xf661f8[_0xdb3b('0x10')],_0xf661f8[_0xdb3b('0x11')]));_0xf661f8[_0xdb3b('0x6')]='blind';exports['blinds'][_0xf661f8[_0xdb3b('0x12')]]=_0xf661f8;writeDB(_0xf661f8);}catch(_0x52e51a){utils[_0xdb3b('0x13')](util[_0xdb3b('0x3')](_0xdb3b('0x14'),_0xf661f8['uniqueid']),_0x52e51a);}};exports[_0xdb3b('0x15')]=function(_0x397c92){try{utils[_0xdb3b('0xb')](util[_0xdb3b('0x3')](_0xdb3b('0x16'),_0x397c92[_0xdb3b('0x5')]),_0x397c92);utils[_0xdb3b('0x2')](util[_0xdb3b('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x397c92['origtransfereruniqueid'],_0x397c92[_0xdb3b('0x17')],_0x397c92[_0xdb3b('0x18')],_0x397c92['transfertargetcalleridnum'],_0x397c92[_0xdb3b('0x19')]));_0x397c92=_[_0xdb3b('0x1a')](_0x397c92,{'transfererchannel':_0x397c92[_0xdb3b('0x1b')],'transferercalleridnum':_0x397c92[_0xdb3b('0x17')],'transferercalleridname':_0x397c92['origtransferercalleridname'],'transfererconnectedlinenum':_0x397c92[_0xdb3b('0x1c')],'transfererconnectedlinename':_0x397c92[_0xdb3b('0x1d')],'transfereraccountcode':_0x397c92[_0xdb3b('0x1e')],'transferercontext':_0x397c92['secondtransferercontext'],'transfererexten':_0x397c92[_0xdb3b('0x1f')],'transfererlinkedid':_0x397c92[_0xdb3b('0x20')],'context':_0x397c92['origtransferercontext'],'extension':_0x397c92[_0xdb3b('0x21')],'type':'attended'});if(_[_0xdb3b('0x22')](_0x397c92['transfereechannel'])){_0x397c92=_[_0xdb3b('0x1a')](_0x397c92,{'transfereechannel':_0x397c92[_0xdb3b('0x23')],'transfereecalleridnum':_0x397c92[_0xdb3b('0x24')],'transfereecalleridname':_0x397c92[_0xdb3b('0x19')],'transfereeconnectedlinenum':_0x397c92['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x397c92[_0xdb3b('0x25')],'transfereeaccountcode':_0x397c92[_0xdb3b('0x26')],'transfereecontext':_0x397c92[_0xdb3b('0x27')],'transfereeexten':_0x397c92[_0xdb3b('0x28')],'transfereelinkedid':_0x397c92[_0xdb3b('0x29')]});}writeDB(_0x397c92);}catch(_0x54f9eb){utils[_0xdb3b('0x13')](util['format'](_0xdb3b('0x16'),_0x397c92['origtransfereruniqueid']),_0x54f9eb);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b9fbfd4..b4fd672 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 _0xf9f3=['format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds'];(function(_0x103657,_0x4b812a){var _0x336f83=function(_0x422dba){while(--_0x422dba){_0x103657['push'](_0x103657['shift']());}};_0x336f83(++_0x4b812a);}(_0xf9f3,0x12e));var _0x3f9f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf9f3[_0x167cc1];return _0x10bc4b;};'use strict';var BPromise=require(_0x3f9f('0x0'));var jayson=require(_0x3f9f('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0x3f9f('0x2')]['http']({'port':0x2329});var logger=require(_0x3f9f('0x3'))(_0x3f9f('0x4'));exports['info']=function(_0x3fc416,_0xc77e30){logger[_0x3f9f('0x5')](_0x3fc416,_0xc77e30?util['inspect'](_0xc77e30,{'showHidden':![],'depth':null}):'');};exports[_0x3f9f('0x6')]=function(_0x373b75,_0x8489a0){logger[_0x3f9f('0x6')](_0x373b75,_0x8489a0?util[_0x3f9f('0x7')](_0x8489a0,{'showHidden':![],'depth':null}):'');};exports[_0x3f9f('0x8')]=function(_0x59d287,_0x5e94f6){logger['error'](_0x59d287,_0x5e94f6?util['inspect'](_0x5e94f6,{'showHidden':![],'depth':null}):'');};exports[_0x3f9f('0x9')]=function(_0x578096,_0x34e057){return client[_0x3f9f('0x9')](_0x578096,{'body':_0x34e057})[_0x3f9f('0xa')](function(_0x5ed02a){logger[_0x3f9f('0x6')](_0x3f9f('0xb'),_0x578096,_0x5ed02a?util['inspect'](_0x5ed02a,{'showHidden':![],'depth':null}):'');})[_0x3f9f('0xc')](function(_0x137198){logger[_0x3f9f('0x8')](_0x3f9f('0xb'),_0x578096,_0x137198?util[_0x3f9f('0x7')](_0x137198,{'showHidden':![],'depth':null}):'');});};function getUser(_0x495b8d){return client[_0x3f9f('0x9')](_0x3f9f('0xd'),{'options':{'raw':!![],'attributes':['id',_0x3f9f('0xe'),_0x3f9f('0xf'),_0x3f9f('0x10')],'where':_0x495b8d,'limit':0x1}})[_0x3f9f('0xa')](function(_0xc21fda){logger[_0x3f9f('0x6')](_0x3f9f('0x11'),JSON[_0x3f9f('0x12')](_0x495b8d),_0xc21fda?util[_0x3f9f('0x7')](_0xc21fda,{'showHidden':![],'depth':null}):'');return _0xc21fda[_0x3f9f('0x13')][_0x3f9f('0x14')]?_0xc21fda[_0x3f9f('0x13')][0x0]:null;});}exports[_0x3f9f('0x15')]=function(_0x339643){return new BPromise(function(_0x243132,_0x12ad9b){if(_0x339643){return getUser({'internal':_0x339643})[_0x3f9f('0xa')](function(_0x2aa409){logger[_0x3f9f('0x5')](_0x3f9f('0x16'),_0x339643,_0x2aa409?_0x3f9f('0x17'):_0x3f9f('0x18'));return _0x243132(_0x2aa409);})[_0x3f9f('0xc')](function(_0x3b2b8e){logger[_0x3f9f('0x8')](_0x3f9f('0x19'),_0x3b2b8e?util[_0x3f9f('0x7')](_0x3b2b8e,{'showHidden':![],'depth':null}):'');return _0x243132(null);});}return _0x243132(null);});};exports[_0x3f9f('0x1a')]=function(_0x129b8b){return new BPromise(function(_0xf1d5,_0x4ce954){if(_0x129b8b){return getUser({'interface':_0x129b8b})['then'](function(_0x14ec75){logger[_0x3f9f('0x5')](_0x3f9f('0x1b'),_0x129b8b,_0x14ec75?'found':_0x3f9f('0x18'));return _0xf1d5(_0x14ec75);})[_0x3f9f('0xc')](function(_0x390ee6){logger[_0x3f9f('0x8')](_0x3f9f('0x1c'),_0x390ee6?util[_0x3f9f('0x7')](_0x390ee6,{'showHidden':![],'depth':null}):'');return _0xf1d5(null);});}return _0xf1d5(null);});};exports[_0x3f9f('0x1d')]=function(_0x4e3146){return new BPromise(function(_0x2a24da,_0x114719){if(_0x4e3146){return getUser({'name':_0x4e3146})[_0x3f9f('0xa')](function(_0x4f268f){logger[_0x3f9f('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x4e3146,_0x4f268f?'found':_0x3f9f('0x18'));return _0x2a24da(_0x4f268f);})[_0x3f9f('0xc')](function(_0x1ca49e){logger[_0x3f9f('0x8')](_0x3f9f('0x1e'),_0x1ca49e?util[_0x3f9f('0x7')](_0x1ca49e,{'showHidden':![],'depth':null}):'');return _0x2a24da(null);});}return _0x2a24da(null);});};exports[_0x3f9f('0x1f')]=function(_0x2f6736){return new BPromise(function(_0x36f707,_0x50bb44){if(_0x2f6736){return client[_0x3f9f('0x9')](_0x3f9f('0x20'),{'options':{'raw':!![],'attributes':['id','name',_0x3f9f('0x21'),_0x3f9f('0x22'),_0x3f9f('0x23')],'where':{'name':_0x2f6736},'limit':0x1}})[_0x3f9f('0xa')](function(_0x113810){logger[_0x3f9f('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x2f6736,_0x113810?util['inspect'](_0x113810,{'showHidden':![],'depth':null}):'');logger[_0x3f9f('0x5')](_0x3f9f('0x24'),_0x2f6736,_0x113810?_0x3f9f('0x17'):_0x3f9f('0x18'));return _0x36f707(_0x113810[_0x3f9f('0x13')]['length']?_0x113810[_0x3f9f('0x13')][0x0]:null);})[_0x3f9f('0xc')](function(_0x6aff19){logger[_0x3f9f('0x8')](_0x3f9f('0x25'),_0x6aff19?util[_0x3f9f('0x7')](_0x6aff19,{'showHidden':![],'depth':null}):'');return _0x36f707(null);});}return _0x36f707(null);});};exports[_0x3f9f('0x26')]=function(_0x1c80df,_0x4c13eb){return moment(_0x1c80df)[_0x3f9f('0x27')](_0x4c13eb,_0x3f9f('0x28'))[_0x3f9f('0x29')](_0x3f9f('0x2a'));};exports[_0x3f9f('0x2b')]=function(_0x5d26d6,_0x14d77c){return moment(_0x5d26d6)['subtract'](_0x14d77c,_0x3f9f('0x28'))[_0x3f9f('0x29')](_0x3f9f('0x2a'));};exports[_0x3f9f('0x2c')]=function(_0x338d1d,_0x224a4b){return moment(_0x338d1d)[_0x3f9f('0x2d')](moment(_0x224a4b),'seconds');};exports['sumTime']=function(_0x122ad6,_0x285d48){return parseInt(_0x122ad6,0xa)+parseInt(_0x285d48,0xa);};exports[_0x3f9f('0x2e')]=function(){return moment()['format'](_0x3f9f('0x2a'));};exports['isAfter']=function(_0x23f405,_0x2aa0aa){if(_0x2aa0aa){return moment(_0x23f405)[_0x3f9f('0x2f')](_0x2aa0aa);}return!![];};exports['isBefore']=function(_0x4c5e17,_0x106a80){if(_0x106a80){return moment(_0x4c5e17)[_0x3f9f('0x30')](_0x106a80);}else if(_0x4c5e17){return!![];}return![];}; \ No newline at end of file +var _0x58d5=['GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','util','http','xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName'];(function(_0x81eb80,_0x2743d7){var _0x290cce=function(_0xdb94f8){while(--_0xdb94f8){_0x81eb80['push'](_0x81eb80['shift']());}};_0x290cce(++_0x2743d7);}(_0x58d5,0xd2));var _0x558d=function(_0x244550,_0x31c0d0){_0x244550=_0x244550-0x0;var _0xfbcab3=_0x58d5[_0x244550];return _0xfbcab3;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x558d('0x0'));var moment=require('moment');var util=require(_0x558d('0x1'));var client=jayson['client'][_0x558d('0x2')]({'port':0x2329});var logger=require('../../config/logger')(_0x558d('0x3'));exports['info']=function(_0x273053,_0x53645e){logger[_0x558d('0x4')](_0x273053,_0x53645e?util['inspect'](_0x53645e,{'showHidden':![],'depth':null}):'');};exports[_0x558d('0x5')]=function(_0x4f493e,_0x516b63){logger[_0x558d('0x5')](_0x4f493e,_0x516b63?util[_0x558d('0x6')](_0x516b63,{'showHidden':![],'depth':null}):'');};exports[_0x558d('0x7')]=function(_0xcf2457,_0x257132){logger[_0x558d('0x7')](_0xcf2457,_0x257132?util['inspect'](_0x257132,{'showHidden':![],'depth':null}):'');};exports[_0x558d('0x8')]=function(_0x1d2f83,_0x217f21){return client[_0x558d('0x8')](_0x1d2f83,{'body':_0x217f21})['then'](function(_0x37af28){logger[_0x558d('0x5')](_0x558d('0x9'),_0x1d2f83,_0x37af28?util[_0x558d('0x6')](_0x37af28,{'showHidden':![],'depth':null}):'');})[_0x558d('0xa')](function(_0x9557e4){logger['error'](_0x558d('0x9'),_0x1d2f83,_0x9557e4?util[_0x558d('0x6')](_0x9557e4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x27f2e4){return client[_0x558d('0x8')](_0x558d('0xb'),{'options':{'raw':!![],'attributes':['id',_0x558d('0xc'),_0x558d('0xd'),_0x558d('0xe')],'where':_0x27f2e4,'limit':0x1}})[_0x558d('0xf')](function(_0x527b21){logger[_0x558d('0x5')](_0x558d('0x10'),JSON[_0x558d('0x11')](_0x27f2e4),_0x527b21?util[_0x558d('0x6')](_0x527b21,{'showHidden':![],'depth':null}):'');return _0x527b21[_0x558d('0x12')][_0x558d('0x13')]?_0x527b21[_0x558d('0x12')][0x0]:null;});}exports[_0x558d('0x14')]=function(_0x7d957e){return new BPromise(function(_0x2849b3,_0x3bc1c4){if(_0x7d957e){return getUser({'internal':_0x7d957e})[_0x558d('0xf')](function(_0x1a192a){logger[_0x558d('0x4')](_0x558d('0x15'),_0x7d957e,_0x1a192a?_0x558d('0x16'):'notfound');return _0x2849b3(_0x1a192a);})[_0x558d('0xa')](function(_0x20787a){logger[_0x558d('0x7')](_0x558d('0x17'),_0x20787a?util[_0x558d('0x6')](_0x20787a,{'showHidden':![],'depth':null}):'');return _0x2849b3(null);});}return _0x2849b3(null);});};exports['getUserByInterface']=function(_0x516caf){return new BPromise(function(_0x15759b,_0x10cc21){if(_0x516caf){return getUser({'interface':_0x516caf})['then'](function(_0x40c696){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x516caf,_0x40c696?'found':_0x558d('0x18'));return _0x15759b(_0x40c696);})[_0x558d('0xa')](function(_0x5e8393){logger[_0x558d('0x7')](_0x558d('0x19'),_0x5e8393?util[_0x558d('0x6')](_0x5e8393,{'showHidden':![],'depth':null}):'');return _0x15759b(null);});}return _0x15759b(null);});};exports[_0x558d('0x1a')]=function(_0x567d53){return new BPromise(function(_0x3c5039,_0x4deb1b){if(_0x567d53){return getUser({'name':_0x567d53})[_0x558d('0xf')](function(_0x2d0e88){logger['info'](_0x558d('0x1b'),_0x567d53,_0x2d0e88?'found':_0x558d('0x18'));return _0x3c5039(_0x2d0e88);})['catch'](function(_0x1003f8){logger['error'](_0x558d('0x1c'),_0x1003f8?util[_0x558d('0x6')](_0x1003f8,{'showHidden':![],'depth':null}):'');return _0x3c5039(null);});}return _0x3c5039(null);});};exports[_0x558d('0x1d')]=function(_0x47ffeb){return new BPromise(function(_0x4e4c31,_0x5668bb){if(_0x47ffeb){return client[_0x558d('0x8')](_0x558d('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x558d('0xd'),_0x558d('0x1f'),_0x558d('0x20'),_0x558d('0x21')],'where':{'name':_0x47ffeb},'limit':0x1}})['then'](function(_0x18ebfb){logger[_0x558d('0x5')](_0x558d('0x22'),_0x47ffeb,_0x18ebfb?util[_0x558d('0x6')](_0x18ebfb,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x47ffeb,_0x18ebfb?_0x558d('0x16'):'notfound');return _0x4e4c31(_0x18ebfb[_0x558d('0x12')]['length']?_0x18ebfb[_0x558d('0x12')][0x0]:null);})[_0x558d('0xa')](function(_0x3d9020){logger[_0x558d('0x7')]('[utils][getVoiceQueueByName]',_0x3d9020?util[_0x558d('0x6')](_0x3d9020,{'showHidden':![],'depth':null}):'');return _0x4e4c31(null);});}return _0x4e4c31(null);});};exports[_0x558d('0x23')]=function(_0x476adf,_0x4f6331){return moment(_0x476adf)[_0x558d('0x24')](_0x4f6331,_0x558d('0x25'))['format'](_0x558d('0x26'));};exports[_0x558d('0x27')]=function(_0x5829d1,_0x47eb0b){return moment(_0x5829d1)[_0x558d('0x28')](_0x47eb0b,_0x558d('0x25'))[_0x558d('0x29')](_0x558d('0x26'));};exports[_0x558d('0x2a')]=function(_0x567bf6,_0x5a5a4){return moment(_0x567bf6)[_0x558d('0x2b')](moment(_0x5a5a4),_0x558d('0x25'));};exports[_0x558d('0x2c')]=function(_0x49b8bb,_0x2a3a15){return parseInt(_0x49b8bb,0xa)+parseInt(_0x2a3a15,0xa);};exports[_0x558d('0x2d')]=function(){return moment()[_0x558d('0x29')](_0x558d('0x26'));};exports[_0x558d('0x2e')]=function(_0x225e5a,_0x4b71a0){if(_0x4b71a0){return moment(_0x225e5a)[_0x558d('0x2e')](_0x4b71a0);}return!![];};exports[_0x558d('0x2f')]=function(_0x521926,_0x183cbb){if(_0x183cbb){return moment(_0x521926)[_0x558d('0x2f')](_0x183cbb);}else if(_0x521926){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 b6735ef..198cc95 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 _0xa656=['then','catch','log','user','timestamp','error','api','auth','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','agent_name','fs-extra','lodash','express-winston','path','util','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','role','name','ensureDir'];(function(_0x1d006a,_0x2812b5){var _0x20a76b=function(_0x15953f){while(--_0x15953f){_0x1d006a['push'](_0x1d006a['shift']());}};_0x20a76b(++_0x2812b5);}(_0xa656,0x71));var _0x6a65=function(_0x439a53,_0x51e060){_0x439a53=_0x439a53-0x0;var _0x2736e8=_0xa656[_0x439a53];return _0x2736e8;};var fs=require(_0x6a65('0x0'));var _=require(_0x6a65('0x1'));var ewinston=require(_0x6a65('0x2'));var path=require(_0x6a65('0x3'));var util=require(_0x6a65('0x4'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0x6a65('0x5'))[_0x6a65('0x6')];var maskSensitiveData=require(_0x6a65('0x7'))[_0x6a65('0x8')];function ClientSideLogger(){function _0x54c814(_0x1642af){var _0x59a44c=path[_0x6a65('0x9')](_0x6a65('0xa'),'log',_0x6a65('0xb'));var _0x49c1e1=path[_0x6a65('0x9')](_0x6a65('0xc'),_0x1642af[_0x6a65('0xd')]+'-'+_0x1642af[_0x6a65('0xe')]);return fs[_0x6a65('0xf')](path[_0x6a65('0x9')](_0x59a44c,_0x49c1e1))[_0x6a65('0x10')](function(){var _0x2ccb0d=fileLogger('client',path[_0x6a65('0x9')](_0x59a44c,_0x49c1e1));return _0x2ccb0d;})[_0x6a65('0x11')](function(_0x53e089){throw _0x53e089;});}this[_0x6a65('0x12')]=function(_0x1dee7a,_0x566903,_0x3fd796,_0x190210){return _0x54c814(_0x1dee7a['user'])[_0x6a65('0x10')](function(_0x1befa0){var _0x36bb31=_0x1befa0[_0x566903];return _0x36bb31;})[_0x6a65('0x10')](function(_0x42ac0b){var _0x3d46ac=_0x1dee7a[_0x6a65('0x13')]?_0x1dee7a[_0x6a65('0x13')]['id']:'no-user';var _0x78852d=_0x190210['data'];var _0xec2e77=_0x190210[_0x6a65('0x14')];var _0x55f620=new Date(Number(_0xec2e77));return _0x42ac0b(_0x3d46ac,_0x55f620,_0x3fd796,_0x78852d);})['catch'](function(_0x1b0bcb){fileLogger(_0x6a65('0xc'))[_0x6a65('0x15')](_0x1b0bcb);});};}function setupLoggers(_0x2f2607){return new Promise(function(_0x17b6fe){var _0x21c649=new ClientSideLogger();var _0x16740c=fileLogger(_0x6a65('0x16'));var _0x4ea016=fileLogger(_0x6a65('0x17'));_0x2f2607['set'](_0x6a65('0x18'),_0x21c649);_0x2f2607[_0x6a65('0x19')](ewinston['logger']({'winstonInstance':_0x16740c,'meta':![],'statusLevels':!![],'msg':function(_0x558408,_0x578376){var _0x45e5cc=_0x6a65('0x1a');if(!_[_0x6a65('0x1b')](_0x558408[_0x6a65('0x1c')])){_0x45e5cc+='\x20body=%s';var _0x206dd7=_0x558408['body'];maskSensitiveData(_0x206dd7);}return safeTemplate(util[_0x6a65('0x1d')](_0x45e5cc,_0x558408[_0x6a65('0x1e')],_0x558408[_0x6a65('0x1f')][_0x6a65('0x20')]?_0x558408['headers']['x-forwarded-for']:_0x558408[_0x6a65('0x21')][_0x6a65('0x22')]||_0x558408['ip'],_0x558408[_0x6a65('0x23')],_0x578376['statusCode'],_0x578376[_0x6a65('0x24')],_0x558408['user']?_0x558408[_0x6a65('0x13')]['id']:null,_0x558408[_0x6a65('0x13')]?_0x558408['user'][_0x6a65('0xe')]:null,_0x558408[_0x6a65('0x13')]?_0x558408[_0x6a65('0x13')][_0x6a65('0xd')]:null,_0x206dd7?util[_0x6a65('0x25')](_0x206dd7,![],null):''));}}));_0x2f2607['use'](ewinston[_0x6a65('0x26')]({'winstonInstance':_0x4ea016,'meta':![],'statusLevels':!![],'msg':function(_0x46af8b,_0x5ce18b){var _0x189368=_0x6a65('0x27');if(_0x46af8b['body']&&_0x46af8b[_0x6a65('0x1c')][_0x6a65('0x28')]&&_0x46af8b[_0x6a65('0x1c')][_0x6a65('0x29')]){_0x189368='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x6a65('0x1d')](_0x189368,_0x46af8b[_0x6a65('0x1e')],_0x46af8b[_0x6a65('0x1f')][_0x6a65('0x20')]?_0x46af8b[_0x6a65('0x1f')][_0x6a65('0x20')]:_0x46af8b[_0x6a65('0x21')]['remoteAddress']||_0x46af8b['ip'],_0x46af8b[_0x6a65('0x23')],_0x5ce18b['statusCode'],_0x5ce18b[_0x6a65('0x24')],_0x46af8b[_0x6a65('0x13')]?_0x46af8b['user']['id']:null,_0x46af8b[_0x6a65('0x13')]?_0x46af8b[_0x6a65('0x13')][_0x6a65('0xe')]:null,_0x46af8b[_0x6a65('0x13')]?_0x46af8b['user']['role']:null,_0x46af8b[_0x6a65('0x1c')]&&_0x46af8b[_0x6a65('0x1c')][_0x6a65('0x28')]?_0x46af8b['body'][_0x6a65('0x28')]:'other',_0x46af8b['body']&&_0x46af8b[_0x6a65('0x1c')][_0x6a65('0x29')]?_0x46af8b['body'][_0x6a65('0x29')]:'',_0x46af8b['body']&&_0x46af8b[_0x6a65('0x1c')][_0x6a65('0x2a')]?_0x46af8b['body'][_0x6a65('0x2a')]:'');},'ignoreRoute':function(_0x3f9922){var _0x458404=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x458404['test'](_0x3f9922[_0x6a65('0x23')]);}}));return _0x17b6fe();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x8f51=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','fs-extra','path','util','./loggers','./mask-sensitive-data','maskSensitiveData','join','xcally','client','role','name','ensureDir','then','user','data','timestamp','error','api','set','client-side-logger','logger'];(function(_0xfc6f3a,_0xb058d8){var _0xaff0f8=function(_0x36f994){while(--_0x36f994){_0xfc6f3a['push'](_0xfc6f3a['shift']());}};_0xaff0f8(++_0xb058d8);}(_0x8f51,0x8b));var _0x18f5=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x8f51[_0x42bc91];return _0x3f5507;};var fs=require(_0x18f5('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require(_0x18f5('0x1'));var util=require(_0x18f5('0x2'));var fileLogger=require(_0x18f5('0x3'))['fileLogger'];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x18f5('0x4'))[_0x18f5('0x5')];function ClientSideLogger(){function _0x116578(_0x1d1c8b){var _0x469ed9=path[_0x18f5('0x6')]('/var','log',_0x18f5('0x7'));var _0x233f4a=path[_0x18f5('0x6')](_0x18f5('0x8'),_0x1d1c8b[_0x18f5('0x9')]+'-'+_0x1d1c8b[_0x18f5('0xa')]);return fs[_0x18f5('0xb')](path[_0x18f5('0x6')](_0x469ed9,_0x233f4a))[_0x18f5('0xc')](function(){var _0x23063c=fileLogger(_0x18f5('0x8'),path[_0x18f5('0x6')](_0x469ed9,_0x233f4a));return _0x23063c;})['catch'](function(_0x1ab147){throw _0x1ab147;});}this['log']=function(_0x364b5a,_0x47fd53,_0x761969,_0x18ca69){return _0x116578(_0x364b5a[_0x18f5('0xd')])['then'](function(_0x3cbd2e){var _0x1513ae=_0x3cbd2e[_0x47fd53];return _0x1513ae;})[_0x18f5('0xc')](function(_0x53d5c7){var _0x389ace=_0x364b5a[_0x18f5('0xd')]?_0x364b5a[_0x18f5('0xd')]['id']:'no-user';var _0xaeb44d=_0x18ca69[_0x18f5('0xe')];var _0x22b760=_0x18ca69[_0x18f5('0xf')];var _0x231ed7=new Date(Number(_0x22b760));return _0x53d5c7(_0x389ace,_0x231ed7,_0x761969,_0xaeb44d);})['catch'](function(_0x2b54e3){fileLogger(_0x18f5('0x8'))[_0x18f5('0x10')](_0x2b54e3);});};}function setupLoggers(_0x296ab0){return new Promise(function(_0x3d8c4b){var _0x2aaad5=new ClientSideLogger();var _0x381a4b=fileLogger(_0x18f5('0x11'));var _0x6e7e7f=fileLogger('auth');_0x296ab0[_0x18f5('0x12')](_0x18f5('0x13'),_0x2aaad5);_0x296ab0['use'](ewinston[_0x18f5('0x14')]({'winstonInstance':_0x381a4b,'meta':![],'statusLevels':!![],'msg':function(_0x3809e3,_0x139efe){var _0x15173e=_0x18f5('0x15');if(!_['isEmpty'](_0x3809e3[_0x18f5('0x16')])){_0x15173e+=_0x18f5('0x17');var _0xd61121=_0x3809e3[_0x18f5('0x16')];maskSensitiveData(_0xd61121);}return safeTemplate(util[_0x18f5('0x18')](_0x15173e,_0x3809e3[_0x18f5('0x19')],_0x3809e3[_0x18f5('0x1a')][_0x18f5('0x1b')]?_0x3809e3[_0x18f5('0x1a')]['x-forwarded-for']:_0x3809e3['connection'][_0x18f5('0x1c')]||_0x3809e3['ip'],_0x3809e3[_0x18f5('0x1d')],_0x139efe[_0x18f5('0x1e')],_0x139efe[_0x18f5('0x1f')],_0x3809e3[_0x18f5('0xd')]?_0x3809e3['user']['id']:null,_0x3809e3['user']?_0x3809e3[_0x18f5('0xd')][_0x18f5('0xa')]:null,_0x3809e3['user']?_0x3809e3[_0x18f5('0xd')][_0x18f5('0x9')]:null,_0xd61121?util[_0x18f5('0x20')](_0xd61121,![],null):''));}}));_0x296ab0[_0x18f5('0x21')](ewinston['logger']({'winstonInstance':_0x6e7e7f,'meta':![],'statusLevels':!![],'msg':function(_0x6dbb16,_0x406edb){var _0xad1e38=_0x18f5('0x22');if(_0x6dbb16[_0x18f5('0x16')]&&_0x6dbb16[_0x18f5('0x16')][_0x18f5('0x23')]&&_0x6dbb16[_0x18f5('0x16')][_0x18f5('0x24')]){_0xad1e38=_0x18f5('0x25');}return util[_0x18f5('0x18')](_0xad1e38,_0x6dbb16[_0x18f5('0x19')],_0x6dbb16[_0x18f5('0x1a')][_0x18f5('0x1b')]?_0x6dbb16[_0x18f5('0x1a')][_0x18f5('0x1b')]:_0x6dbb16['connection']['remoteAddress']||_0x6dbb16['ip'],_0x6dbb16[_0x18f5('0x1d')],_0x406edb[_0x18f5('0x1e')],_0x406edb[_0x18f5('0x1f')],_0x6dbb16[_0x18f5('0xd')]?_0x6dbb16['user']['id']:null,_0x6dbb16[_0x18f5('0xd')]?_0x6dbb16[_0x18f5('0xd')][_0x18f5('0xa')]:null,_0x6dbb16['user']?_0x6dbb16[_0x18f5('0xd')]['role']:null,_0x6dbb16['body']&&_0x6dbb16[_0x18f5('0x16')][_0x18f5('0x23')]?_0x6dbb16[_0x18f5('0x16')][_0x18f5('0x23')]:_0x18f5('0x26'),_0x6dbb16[_0x18f5('0x16')]&&_0x6dbb16['body'][_0x18f5('0x24')]?_0x6dbb16[_0x18f5('0x16')][_0x18f5('0x24')]:'',_0x6dbb16[_0x18f5('0x16')]&&_0x6dbb16[_0x18f5('0x16')][_0x18f5('0x27')]?_0x6dbb16[_0x18f5('0x16')]['agent_name']:'');},'ignoreRoute':function(_0x352167){var _0x53cb30=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x53cb30['test'](_0x352167[_0x18f5('0x1d')]);}}));return _0x3d8c4b();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 699eaf1..ec47ec9 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8800=['max','min','MMM','guess','isMoment','split','padStart','length','lodash','moment-timezone','map','source','Date\x20not\x20valid','isValid','locale','toLowerCase','indexOf','slice','exports','circularDoWInterval','monthsShort','concat','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth'];(function(_0x2ac654,_0x24be56){var _0x3d25f9=function(_0x24e95c){while(--_0x24e95c){_0x2ac654['push'](_0x2ac654['shift']());}};_0x3d25f9(++_0x24be56);}(_0x8800,0x155));var _0x0880=function(_0x26b738,_0x4bd64d){_0x26b738=_0x26b738-0x0;var _0x6d0d7e=_0x8800[_0x26b738];return _0x6d0d7e;};var _=require(_0x0880('0x0'));var moment=require(_0x0880('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][_0x0880('0x2')](function(_0x3e7a87){return _0x3e7a87[_0x0880('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x0880('0x4');function throwIfDateNotValid(_0x848339){if(!_0x848339[_0x0880('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xbb4522){var _0x47e01b=_0xbb4522['split'](':')[_0x0880('0x2')](function(_0x3526bc){return parseInt(_0x3526bc,0xa);});var _0x1c9848=_0x47e01b[0x0];var _0x531e2e=_0x47e01b[0x1];if(_0x1c9848<0x0||_0x1c9848>0x17||_0x531e2e<0x0||_0x531e2e>0x3b){throw new Error(EINVALID_DATE);}return[_0x1c9848,_0x531e2e];}function circularDoWInterval(_0x227a7d,_0x4ee6bb){if(_0x227a7d===_0x4ee6bb){return[_0x227a7d];}else{var _0x3e1d50=moment['locale']();moment[_0x0880('0x6')]('en');var _0x27bd15=moment['weekdaysShort']()[_0x0880('0x2')](function(_0x1d90cf){return _0x1d90cf[_0x0880('0x7')]();});moment[_0x0880('0x6')](_0x3e1d50);var _0x1389a0=_0x27bd15['indexOf'](_0x227a7d);var _0x326d39=_0x27bd15[_0x0880('0x8')](_0x4ee6bb);if(_0x326d39>_0x1389a0){return _0x27bd15[_0x0880('0x9')](_0x1389a0,_0x326d39+0x1);}else{var _0x1881fa=_0x27bd15[_0x0880('0x9')](0x0,_0x326d39+0x1);var _0x3d7c55=_0x27bd15[_0x0880('0x9')](_0x1389a0);return _0x3d7c55['concat'](_0x1881fa);}}}module[_0x0880('0xa')][_0x0880('0xb')]=circularDoWInterval;function circularMonthInterval(_0x43debd,_0x225ffa){if(_0x43debd===_0x225ffa){return[_0x43debd];}else{var _0x48a213=moment['locale']();moment[_0x0880('0x6')]('en');var _0x251571=moment[_0x0880('0xc')]()[_0x0880('0x2')](function(_0x36a034){return _0x36a034[_0x0880('0x7')]();});moment['locale'](_0x48a213);var _0x38eeae=_0x251571['indexOf'](_0x43debd);var _0x2eca84=_0x251571[_0x0880('0x8')](_0x225ffa);if(_0x2eca84>_0x38eeae){return _0x251571[_0x0880('0x9')](_0x38eeae,_0x2eca84+0x1);}else{var _0xfcc11=_0x251571[_0x0880('0x9')](0x0,_0x2eca84+0x1);var _0x30f6a8=_0x251571[_0x0880('0x9')](_0x38eeae);return _0x30f6a8[_0x0880('0xd')](_0xfcc11);}}}module[_0x0880('0xa')][_0x0880('0xe')]=circularMonthInterval;function parseDom(_0x4f7bc8){var _0x14cae2=parseInt(_0x4f7bc8,0xa);if(_0x14cae2<0x1||_0x14cae2>0x1f){throw new Error(EINVALID_DATE);}return _0x14cae2;}function timeCompare(_0x554616,_0xb28a90,_0x1bc285){var _0xc87d6=_0x554616[_0x0880('0xf')]();var _0x25f163=extractTime(_0xb28a90);var _0x45339b=_0x25f163[0x0];var _0x1ee285=_0x25f163[0x1];var _0x3beee0=_0x554616[_0x0880('0xf')]()[_0x0880('0x10')](_0x45339b)['minutes'](_0x1ee285);throwIfDateNotValid(_0x3beee0);var _0x384ae7=extractTime(_0x1bc285);var _0x4798d3=_0x384ae7[0x0];var _0x5a6647=_0x384ae7[0x1];var _0x53ebec=_0x554616[_0x0880('0xf')]()[_0x0880('0x10')](_0x4798d3)[_0x0880('0x11')](_0x5a6647);throwIfDateNotValid(_0x53ebec);if(_0x53ebec['isBefore'](_0x3beee0)){var _0x1d8613=_0xc87d6['clone']()[_0x0880('0x12')](_0x0880('0x13'));var _0x5708aa=_0xc87d6[_0x0880('0xf')]()[_0x0880('0x14')](_0x0880('0x13'));return _0xc87d6[_0x0880('0x15')](_0x3beee0,_0x5708aa,undefined,'[]')||_0xc87d6[_0x0880('0x15')](_0x1d8613,_0x53ebec,undefined,'[]');}else{return _0xc87d6['isBetween'](_0x3beee0,_0x53ebec,undefined,'[]');}}module[_0x0880('0xa')][_0x0880('0x16')]=timeCompare;function dowCompare(_0x5a827e,_0x4cbb25,_0x270e17){var _0x22c6f6=_0x5a827e[_0x0880('0x6')]('en')[_0x0880('0x17')](_0x0880('0x18'))[_0x0880('0x7')]();return circularDoWInterval(_0x4cbb25,_0x270e17)[_0x0880('0x19')](_0x22c6f6);}module[_0x0880('0xa')][_0x0880('0x1a')]=dowCompare;function domCompare(_0x507e9a,_0x29cf98,_0x4821c2){var _0x923027=_0x507e9a[_0x0880('0x1b')]();if(_0x29cf98===_0x4821c2){return _0x923027===_0x29cf98;}else{var _0x27394d=_0x507e9a[_0x0880('0x1c')]();var _0x5f27ac=_0x29cf98<_0x4821c2;let _0x56e063=![];var _0xd43d3f=0x0;var _0x38fb62=0x0;if(_0x5f27ac){_0xd43d3f=Math[_0x0880('0x1d')](0x1,_0x29cf98);_0x38fb62=Math[_0x0880('0x1e')](_0x4821c2,_0x27394d);_0x56e063=_0x923027>=_0xd43d3f&&_0x923027<=_0x38fb62;}else{_0xd43d3f=Math['min'](_0x29cf98,_0x27394d);_0x38fb62=Math['max'](0x1,_0x4821c2);_0x56e063=_0x923027>=_0xd43d3f||_0x923027<=_0x38fb62;}return _0x56e063;}}module[_0x0880('0xa')]['domCompare']=domCompare;function monthCompare(_0x48e725,_0x5c6fec,_0x403c16){var _0x4796e0=_0x48e725[_0x0880('0x6')]('en')[_0x0880('0x17')](_0x0880('0x1f'))['toLowerCase']();return circularMonthInterval(_0x5c6fec,_0x403c16)[_0x0880('0x19')](_0x4796e0);}module['exports']['monthCompare']=monthCompare;function iftime(_0x802278,_0x4d55a8=moment['tz'][_0x0880('0x20')](),_0x513913=moment()){if(!validateRx['test'](_0x802278)){throw new Error(EINVALID_STRING);}else{var _0x4b7961=(moment[_0x0880('0x21')](_0x513913)?_0x513913['clone']():moment(_0x513913))['tz'](_0x4d55a8)[_0x0880('0x6')]('en');throwIfDateNotValid(_0x4b7961);var _0x4dc4d4=_0x802278[_0x0880('0x22')](',');var _0x3e9e16=_0x4dc4d4[0x0];var _0x22f619=_0x4dc4d4[0x1];var _0x271ed8=_0x4dc4d4[0x2];var _0x1d45a1=_0x4dc4d4[0x3];let _0x3c7de9=!![];if(_0x3e9e16!=='*'){var _0x388d26=_0x3e9e16['split']('-');var _0x3b821a=_[_0x0880('0x23')](_0x388d26[0x0],0x5,'0');var _0xb46c13=_0x388d26['length']===0x2?_[_0x0880('0x23')](_0x388d26[0x1],0x5,'0'):_0x3b821a;_0x3c7de9=timeCompare(_0x4b7961,_0x3b821a,_0xb46c13);}let _0x35a387=!![];if(_0x22f619!=='*'){var _0x5ccca8=_0x22f619[_0x0880('0x22')]('-');var _0x566dc5=_0x5ccca8[0x0];var _0xa21585=_0x5ccca8[_0x0880('0x24')]===0x2?_0x5ccca8[0x1]:_0x566dc5;_0x35a387=dowCompare(_0x4b7961,_0x566dc5,_0xa21585);}let _0x554b67=!![];if(_0x271ed8!=='*'){var _0x19ccdb=_0x271ed8['split']('-');var _0x2dda9c=parseDom(_0x19ccdb[0x0]);var _0x523539=_0x19ccdb[_0x0880('0x24')]===0x2?parseDom(_0x19ccdb[0x1]):_0x2dda9c;_0x554b67=domCompare(_0x4b7961,_0x2dda9c,_0x523539);}let _0x505a31=!![];if(_0x1d45a1!=='*'){var _0x7a7d7d=_0x1d45a1['split']('-');var _0x4f912d=_0x7a7d7d[0x0];var _0x18a2be=_0x7a7d7d[_0x0880('0x24')]===0x2?_0x7a7d7d[0x1]:_0x7a7d7d[0x0];_0x505a31=monthCompare(_0x4b7961,_0x4f912d,_0x18a2be);}return _0x3c7de9&&_0x35a387&&_0x554b67&&_0x505a31;}}module[_0x0880('0xa')]['iftime']=iftime; \ No newline at end of file +var _0x438a=['min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','moment-timezone','map','join','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','slice','exports','circularDoWInterval','monthsShort','toLowerCase','indexOf','concat','circularMonthInterval','clone','hours','minutes','isBefore','endOf','isBetween','timeCompare','format','includes','date','max'];(function(_0x513d75,_0x2a09c7){var _0x30b7f2=function(_0x19e43e){while(--_0x19e43e){_0x513d75['push'](_0x513d75['shift']());}};_0x30b7f2(++_0x2a09c7);}(_0x438a,0x1eb));var _0xa438=function(_0x3e79bb,_0x5aca5d){_0x3e79bb=_0x3e79bb-0x0;var _0x59438f=_0x438a[_0x3e79bb];return _0x59438f;};var _=require('lodash');var moment=require(_0xa438('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xa438('0x1')](function(_0x22cb58){return _0x22cb58['source'];})[_0xa438('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0xa438('0x3');function throwIfDateNotValid(_0x8f48e6){if(!_0x8f48e6[_0xa438('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x388f34){var _0x53979e=_0x388f34[_0xa438('0x5')](':')[_0xa438('0x1')](function(_0x47a8a3){return parseInt(_0x47a8a3,0xa);});var _0x322f63=_0x53979e[0x0];var _0x9a235c=_0x53979e[0x1];if(_0x322f63<0x0||_0x322f63>0x17||_0x9a235c<0x0||_0x9a235c>0x3b){throw new Error(EINVALID_DATE);}return[_0x322f63,_0x9a235c];}function circularDoWInterval(_0x232321,_0x3e1816){if(_0x232321===_0x3e1816){return[_0x232321];}else{var _0xaeb8f7=moment['locale']();moment[_0xa438('0x6')]('en');var _0x4d5c8a=moment[_0xa438('0x7')]()[_0xa438('0x1')](function(_0x3c975d){return _0x3c975d['toLowerCase']();});moment[_0xa438('0x6')](_0xaeb8f7);var _0xdf9c56=_0x4d5c8a['indexOf'](_0x232321);var _0x403360=_0x4d5c8a['indexOf'](_0x3e1816);if(_0x403360>_0xdf9c56){return _0x4d5c8a[_0xa438('0x8')](_0xdf9c56,_0x403360+0x1);}else{var _0x3cf521=_0x4d5c8a[_0xa438('0x8')](0x0,_0x403360+0x1);var _0xf7f95c=_0x4d5c8a['slice'](_0xdf9c56);return _0xf7f95c['concat'](_0x3cf521);}}}module[_0xa438('0x9')][_0xa438('0xa')]=circularDoWInterval;function circularMonthInterval(_0x129414,_0x103b7e){if(_0x129414===_0x103b7e){return[_0x129414];}else{var _0x5d2378=moment[_0xa438('0x6')]();moment[_0xa438('0x6')]('en');var _0x2472ed=moment[_0xa438('0xb')]()['map'](function(_0x31d502){return _0x31d502[_0xa438('0xc')]();});moment[_0xa438('0x6')](_0x5d2378);var _0x21151f=_0x2472ed[_0xa438('0xd')](_0x129414);var _0x11bda2=_0x2472ed[_0xa438('0xd')](_0x103b7e);if(_0x11bda2>_0x21151f){return _0x2472ed[_0xa438('0x8')](_0x21151f,_0x11bda2+0x1);}else{var _0x4eaf06=_0x2472ed['slice'](0x0,_0x11bda2+0x1);var _0x50fb26=_0x2472ed['slice'](_0x21151f);return _0x50fb26[_0xa438('0xe')](_0x4eaf06);}}}module[_0xa438('0x9')][_0xa438('0xf')]=circularMonthInterval;function parseDom(_0x4b3209){var _0x252877=parseInt(_0x4b3209,0xa);if(_0x252877<0x1||_0x252877>0x1f){throw new Error(EINVALID_DATE);}return _0x252877;}function timeCompare(_0x502893,_0x2a3b9a,_0x36b3bd){var _0x519428=_0x502893[_0xa438('0x10')]();var _0x4c8ecb=extractTime(_0x2a3b9a);var _0x52c0e9=_0x4c8ecb[0x0];var _0x57a3af=_0x4c8ecb[0x1];var _0x5e1186=_0x502893[_0xa438('0x10')]()[_0xa438('0x11')](_0x52c0e9)[_0xa438('0x12')](_0x57a3af);throwIfDateNotValid(_0x5e1186);var _0x3cc8a7=extractTime(_0x36b3bd);var _0x165a4f=_0x3cc8a7[0x0];var _0x2ee84a=_0x3cc8a7[0x1];var _0x55e357=_0x502893['clone']()[_0xa438('0x11')](_0x165a4f)[_0xa438('0x12')](_0x2ee84a);throwIfDateNotValid(_0x55e357);if(_0x55e357[_0xa438('0x13')](_0x5e1186)){var _0x476f95=_0x519428[_0xa438('0x10')]()['startOf']('day');var _0x5465a6=_0x519428[_0xa438('0x10')]()[_0xa438('0x14')]('day');return _0x519428[_0xa438('0x15')](_0x5e1186,_0x5465a6,undefined,'[]')||_0x519428['isBetween'](_0x476f95,_0x55e357,undefined,'[]');}else{return _0x519428[_0xa438('0x15')](_0x5e1186,_0x55e357,undefined,'[]');}}module[_0xa438('0x9')][_0xa438('0x16')]=timeCompare;function dowCompare(_0x206ffe,_0x5ed1d4,_0x1411c6){var _0x3db57f=_0x206ffe[_0xa438('0x6')]('en')[_0xa438('0x17')]('ddd')['toLowerCase']();return circularDoWInterval(_0x5ed1d4,_0x1411c6)[_0xa438('0x18')](_0x3db57f);}module[_0xa438('0x9')]['dowCompare']=dowCompare;function domCompare(_0x1f3218,_0x1da279,_0x3a41f0){var _0x96a969=_0x1f3218[_0xa438('0x19')]();if(_0x1da279===_0x3a41f0){return _0x96a969===_0x1da279;}else{var _0x57848e=_0x1f3218['daysInMonth']();var _0x146425=_0x1da279<_0x3a41f0;let _0x9c2e24=![];var _0x1a56a5=0x0;var _0x51a2e4=0x0;if(_0x146425){_0x1a56a5=Math[_0xa438('0x1a')](0x1,_0x1da279);_0x51a2e4=Math['min'](_0x3a41f0,_0x57848e);_0x9c2e24=_0x96a969>=_0x1a56a5&&_0x96a969<=_0x51a2e4;}else{_0x1a56a5=Math[_0xa438('0x1b')](_0x1da279,_0x57848e);_0x51a2e4=Math['max'](0x1,_0x3a41f0);_0x9c2e24=_0x96a969>=_0x1a56a5||_0x96a969<=_0x51a2e4;}return _0x9c2e24;}}module['exports'][_0xa438('0x1c')]=domCompare;function monthCompare(_0xe2d95f,_0x59e267,_0x246c94){var _0x1c882c=_0xe2d95f['locale']('en')['format'](_0xa438('0x1d'))[_0xa438('0xc')]();return circularMonthInterval(_0x59e267,_0x246c94)[_0xa438('0x18')](_0x1c882c);}module['exports'][_0xa438('0x1e')]=monthCompare;function iftime(_0x351e99,_0x168726=moment['tz'][_0xa438('0x1f')](),_0x198fe9=moment()){if(!validateRx[_0xa438('0x20')](_0x351e99)){throw new Error(EINVALID_STRING);}else{var _0x4b5296=(moment[_0xa438('0x21')](_0x198fe9)?_0x198fe9[_0xa438('0x10')]():moment(_0x198fe9))['tz'](_0x168726)[_0xa438('0x6')]('en');throwIfDateNotValid(_0x4b5296);var _0x12af96=_0x351e99['split'](',');var _0x5e5a67=_0x12af96[0x0];var _0x317a98=_0x12af96[0x1];var _0x72126b=_0x12af96[0x2];var _0x391d4d=_0x12af96[0x3];let _0x523ad7=!![];if(_0x5e5a67!=='*'){var _0x454707=_0x5e5a67[_0xa438('0x5')]('-');var _0x15a6dd=_[_0xa438('0x22')](_0x454707[0x0],0x5,'0');var _0x56ca14=_0x454707[_0xa438('0x23')]===0x2?_[_0xa438('0x22')](_0x454707[0x1],0x5,'0'):_0x15a6dd;_0x523ad7=timeCompare(_0x4b5296,_0x15a6dd,_0x56ca14);}let _0x65e027=!![];if(_0x317a98!=='*'){var _0x5bc615=_0x317a98[_0xa438('0x5')]('-');var _0x137419=_0x5bc615[0x0];var _0x152e04=_0x5bc615[_0xa438('0x23')]===0x2?_0x5bc615[0x1]:_0x137419;_0x65e027=dowCompare(_0x4b5296,_0x137419,_0x152e04);}let _0x3bb747=!![];if(_0x72126b!=='*'){var _0x39b58c=_0x72126b[_0xa438('0x5')]('-');var _0x5f5617=parseDom(_0x39b58c[0x0]);var _0x455f5a=_0x39b58c[_0xa438('0x23')]===0x2?parseDom(_0x39b58c[0x1]):_0x5f5617;_0x3bb747=domCompare(_0x4b5296,_0x5f5617,_0x455f5a);}let _0x1ba96c=!![];if(_0x391d4d!=='*'){var _0x59d58e=_0x391d4d[_0xa438('0x5')]('-');var _0x415050=_0x59d58e[0x0];var _0x1b95ea=_0x59d58e[_0xa438('0x23')]===0x2?_0x59d58e[0x1]:_0x59d58e[0x0];_0x1ba96c=monthCompare(_0x4b5296,_0x415050,_0x1b95ea);}return _0x523ad7&&_0x65e027&&_0x3bb747&&_0x1ba96c;}}module['exports'][_0xa438('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ccf4246..898e1b2 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ce0=['winston','debugLevel','toLowerCase','info','red','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','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','transports','File','%s-%s','error','warn','consoleLogger','fileLogger','util','moment'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x2ce0,0x1c6));var _0x02ce=function(_0x5e9abf,_0xd85289){_0x5e9abf=_0x5e9abf-0x0;var _0x42a421=_0x2ce0[_0x5e9abf];return _0x42a421;};'use strict';var path=require('path');var util=require(_0x02ce('0x0'));var moment=require(_0x02ce('0x1'));var winston=require(_0x02ce('0x2'));var config=require('../config/environment');var debugLevel=config[_0x02ce('0x3')]?config[_0x02ce('0x3')][_0x02ce('0x4')]():_0x02ce('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x02ce('0x6'),'warn':_0x02ce('0x7'),'info':_0x02ce('0x8'),'print':_0x02ce('0x9'),'success':'bold\x20green','http':_0x02ce('0xa'),'verbose':_0x02ce('0xb'),'debug':_0x02ce('0xc'),'silly':_0x02ce('0xd')};winston[_0x02ce('0xe')](XC_LOG_COLORS);function getLogFileName(_0x275b02,_0x3d688e,_0x44cbf5){var _0x37ab04=_0x275b02||_0x02ce('0xf');return path[_0x02ce('0x10')](_0x37ab04,util[_0x02ce('0x11')](_0x02ce('0x12'),_0x3d688e,_0x44cbf5));}function formatter(_0x290847,_0x13c661){_0x13c661[_0x02ce('0x13')]=_0x13c661['message'][_0x02ce('0x14')](/@@{/g,_0x02ce('0x15'))['replace'](/}@@/g,_0x02ce('0x16'))[_0x02ce('0x14')](/@{/g,'{{')[_0x02ce('0x14')](/}@/g,'}}');return util[_0x02ce('0x11')](_0x02ce('0x17'),moment()[_0x02ce('0x11')](_0x02ce('0x18')),_0x13c661[_0x02ce('0x19')]['toUpperCase'](),_0x290847,_0x13c661[_0x02ce('0x13')]);}function fileFormat(_0x2fd899,_0x4750c7){_0x4750c7[_0x02ce('0x13')]=_0x4750c7['message'][_0x02ce('0x14')](/@@{/g,_0x02ce('0x15'))[_0x02ce('0x14')](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x5c929d=_0x4750c7[_0x02ce('0x1a')]&&Object['keys'](_0x4750c7['meta'])[_0x02ce('0x1b')]?'\x0a\x09'+JSON[_0x02ce('0x1c')](_0x4750c7[_0x02ce('0x1a')]):'';return util[_0x02ce('0x11')](_0x02ce('0x1d'),moment()[_0x02ce('0x11')](_0x02ce('0x18')),_0x4750c7[_0x02ce('0x19')][_0x02ce('0x1e')](),_0x2fd899,_0x4750c7[_0x02ce('0x13')],_0x5c929d);}function consoleLogger(){var _0xaebc16=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x02ce('0x1f'))]['Console']({'level':'warn','json':![],'formatter':function(_0x28c9ad){return formatter('',_0x28c9ad);}})]});return _0xaebc16;}function fileLogger(_0x44d131,_0x27dbe4){var _0x431722=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x02ce('0x1f'))][(_0x02ce('0x20'))]({'name':util[_0x02ce('0x11')](_0x02ce('0x21'),_0x44d131,_0x02ce('0x22')),'filename':getLogFileName(_0x27dbe4,_0x44d131,_0x02ce('0x22')),'level':_0x02ce('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xdb84ac){return fileFormat(_0x44d131,_0xdb84ac);}}),new winston['transports'][(_0x02ce('0x20'))]({'name':util[_0x02ce('0x11')](_0x02ce('0x21'),_0x44d131,debugLevel),'filename':getLogFileName(_0x27dbe4,_0x44d131,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e4b37){return fileFormat(_0x44d131,_0x4e4b37);}}),new winston[(_0x02ce('0x1f'))]['Console']({'level':_0x02ce('0x23'),'json':![],'formatter':function(_0x41e9de){return fileFormat(_0x44d131,_0x41e9de);}})]});return _0x431722;}exports[_0x02ce('0x24')]=consoleLogger;exports[_0x02ce('0x25')]=fileLogger; \ No newline at end of file +var _0x3995=['Console','warn','%s-%s','error','File','fileLogger','path','winston','../config/environment','debugLevel','toLowerCase','bold\x20yellow','bold\x20green','gray','bold\x20cyan','addColors','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports'];(function(_0x25f334,_0x44aab9){var _0x11fb6e=function(_0x15a527){while(--_0x15a527){_0x25f334['push'](_0x25f334['shift']());}};_0x11fb6e(++_0x44aab9);}(_0x3995,0x106));var _0x5399=function(_0x2824c4,_0x262154){_0x2824c4=_0x2824c4-0x0;var _0x392b81=_0x3995[_0x2824c4];return _0x392b81;};'use strict';var path=require(_0x5399('0x0'));var util=require('util');var moment=require('moment');var winston=require(_0x5399('0x1'));var config=require(_0x5399('0x2'));var debugLevel=config[_0x5399('0x3')]?config[_0x5399('0x3')][_0x5399('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0x5399('0x5'),'info':'white','print':'bold\x20white','success':_0x5399('0x6'),'http':_0x5399('0x7'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x5399('0x8')};winston[_0x5399('0x9')](XC_LOG_COLORS);function getLogFileName(_0x207cd9,_0x34e4f4,_0x1304ad){var _0x4fc450=_0x207cd9||'/var/log/xcally';return path['join'](_0x4fc450,util[_0x5399('0xa')]('%s-%s.log',_0x34e4f4,_0x1304ad));}function formatter(_0x114ba3,_0x3e4680){_0x3e4680[_0x5399('0xb')]=_0x3e4680[_0x5399('0xb')][_0x5399('0xc')](/@@{/g,_0x5399('0xd'))[_0x5399('0xc')](/}@@/g,_0x5399('0xe'))[_0x5399('0xc')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x5399('0xa')](_0x5399('0xf'),moment()[_0x5399('0xa')](_0x5399('0x10')),_0x3e4680[_0x5399('0x11')][_0x5399('0x12')](),_0x114ba3,_0x3e4680[_0x5399('0xb')]);}function fileFormat(_0xc78334,_0x2713db){_0x2713db[_0x5399('0xb')]=_0x2713db[_0x5399('0xb')][_0x5399('0xc')](/@@{/g,_0x5399('0xd'))[_0x5399('0xc')](/}@@/g,'}}}')[_0x5399('0xc')](/@{/g,'{{')[_0x5399('0xc')](/}@/g,'}}');var _0x362e1a=_0x2713db[_0x5399('0x13')]&&Object[_0x5399('0x14')](_0x2713db[_0x5399('0x13')])[_0x5399('0x15')]?'\x0a\x09'+JSON[_0x5399('0x16')](_0x2713db[_0x5399('0x13')]):'';return util[_0x5399('0xa')](_0x5399('0x17'),moment()[_0x5399('0xa')](_0x5399('0x10')),_0x2713db[_0x5399('0x11')][_0x5399('0x12')](),_0xc78334,_0x2713db[_0x5399('0xb')],_0x362e1a);}function consoleLogger(){var _0x6c0396=new winston[(_0x5399('0x18'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5399('0x19'))][(_0x5399('0x1a'))]({'level':_0x5399('0x1b'),'json':![],'formatter':function(_0x156ab8){return formatter('',_0x156ab8);}})]});return _0x6c0396;}function fileLogger(_0x872f7c,_0x25b219){var _0x4c1c07=new winston[(_0x5399('0x18'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5399('0x19'))]['File']({'name':util[_0x5399('0xa')](_0x5399('0x1c'),_0x872f7c,'error'),'filename':getLogFileName(_0x25b219,_0x872f7c,_0x5399('0x1d')),'level':_0x5399('0x1d'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x148f2b){return fileFormat(_0x872f7c,_0x148f2b);}}),new winston[(_0x5399('0x19'))][(_0x5399('0x1e'))]({'name':util[_0x5399('0xa')](_0x5399('0x1c'),_0x872f7c,debugLevel),'filename':getLogFileName(_0x25b219,_0x872f7c,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x143769){return fileFormat(_0x872f7c,_0x143769);}}),new winston[(_0x5399('0x19'))][(_0x5399('0x1a'))]({'level':_0x5399('0x1b'),'json':![],'formatter':function(_0x1192f0){return fileFormat(_0x872f7c,_0x1192f0);}})]});return _0x4c1c07;}exports['consoleLogger']=consoleLogger;exports[_0x5399('0x1f')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index d5eb63b..970ede7 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 _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x5d8d73,_0x23ebf8){var _0x517d0e=function(_0x279e9c){while(--_0x279e9c){_0x5d8d73['push'](_0x5d8d73['shift']());}};_0x517d0e(++_0x23ebf8);}(_0xda2d,0x102));var _0xdda2=function(_0x1fb014,_0x14614e){_0x1fb014=_0x1fb014-0x0;var _0x5c0ac2=_0xda2d[_0x1fb014];return _0x5c0ac2;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x125bdd,_0x53c299){_0x125bdd=_0x125bdd-0x0;var _0x6955fc=_0x7a54[_0x125bdd];return _0x6955fc;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index e88b36e..fd46b25 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 _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x371951,_0x2796e3){_0x371951=_0x371951-0x0;var _0x23b47f=_0xf4f4[_0x371951];return _0x23b47f;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file +var _0xda2d=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','map','isPlainObject','keys','reduce'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xda2d,0x102));var _0xdda2=function(_0x40d35e,_0x1edd4a){_0x40d35e=_0x40d35e-0x0;var _0x4d8df9=_0xda2d[_0x40d35e];return _0x4d8df9;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x14e970){return _0x14e970==='{{'?_0xdda2('0x0'):_0xdda2('0x1');}function safeTemplate(_0x1f1fcc){var _0x329c5e=_0x1f1fcc;if(typeof _0x1f1fcc==='string'){_0x329c5e=_0x1f1fcc['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x1f1fcc)){_0x329c5e=_0x1f1fcc[_0xdda2('0x2')](function(_0x319129){return safeTemplate(_0x319129);});}else if(_[_0xdda2('0x3')](_0x1f1fcc)){_0x329c5e=Object[_0xdda2('0x4')](_0x1f1fcc)[_0xdda2('0x5')](function(_0xf38e58,_0x2f55dc){_0xf38e58[_0x2f55dc]=safeTemplate(_0x1f1fcc[_0x2f55dc]);return _0xf38e58;},{});}return _0x329c5e;}module[_0xdda2('0x6')][_0xdda2('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 8ce672c..21372b3 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 _0x2f30=['server/app.json','legacy-libs','apps','findIndex','name','motion2','NODE_PATH','env','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x2f30,0xb8));var _0x02f3=function(_0x1b6d82,_0x29e189){_0x1b6d82=_0x1b6d82-0x0;var _0x30ac4e=_0x2f30[_0x1b6d82];return _0x30ac4e;};var fs=require(_0x02f3('0x0'));var path=require(_0x02f3('0x1'));var config=require(_0x02f3('0x2'));var root=config[_0x02f3('0x3')];var APP_JSON_PATH=path[_0x02f3('0x4')](root,_0x02f3('0x5'));var NODEPATH=path[_0x02f3('0x4')](root,_0x02f3('0x6'));function setLegacyLibsNodeEnvPath(_0x22a176){let _0x4bc379=![];if(Array['isArray'](_0x22a176[_0x02f3('0x7')])){var _0x13c4b2=_0x22a176['apps'][_0x02f3('0x8')](function(_0x5f228f){return _0x5f228f[_0x02f3('0x9')]===_0x02f3('0xa');});if(_0x13c4b2>-0x1){var _0x5845a2=_0x22a176[_0x02f3('0x7')][_0x13c4b2];if(typeof _0x5845a2['env'][_0x02f3('0xb')]!=='string'){_0x5845a2[_0x02f3('0xc')][_0x02f3('0xb')]=NODEPATH;_0x4bc379=!![];}}return{'appConfig':_0x22a176,'updated':_0x4bc379};}}function updateAppConfig(_0x3ce42f){return fs[_0x02f3('0xd')](APP_JSON_PATH)[_0x02f3('0xe')](function(_0x1fbf2a){if(_0x1fbf2a){return fs[_0x02f3('0xf')](APP_JSON_PATH)[_0x02f3('0xe')](function(_0x302a5b){var _0x56c93c=setLegacyLibsNodeEnvPath(_0x302a5b);if(_0x56c93c[_0x02f3('0x10')]){_0x3ce42f[_0x02f3('0x11')](_0x02f3('0x12'));return fs[_0x02f3('0x13')](APP_JSON_PATH,_0x302a5b,{'spaces':0x2});}else{return Promise[_0x02f3('0x4')]();}});}else{return Promise[_0x02f3('0x4')]();}});}module[_0x02f3('0x14')]=updateAppConfig; \ No newline at end of file +var _0xcb7d=['then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','apps','name','NODE_PATH'];(function(_0x966f89,_0x79503c){var _0x200579=function(_0x3c304e){while(--_0x3c304e){_0x966f89['push'](_0x966f89['shift']());}};_0x200579(++_0x79503c);}(_0xcb7d,0x147));var _0xdcb7=function(_0x716d84,_0x337a49){_0x716d84=_0x716d84-0x0;var _0xfb2f1a=_0xcb7d[_0x716d84];return _0xfb2f1a;};var fs=require(_0xdcb7('0x0'));var path=require(_0xdcb7('0x1'));var config=require(_0xdcb7('0x2'));var root=config[_0xdcb7('0x3')];var APP_JSON_PATH=path[_0xdcb7('0x4')](root,_0xdcb7('0x5'));var NODEPATH=path[_0xdcb7('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x3b91f4){let _0xe520c0=![];if(Array['isArray'](_0x3b91f4['apps'])){var _0x2a96fe=_0x3b91f4[_0xdcb7('0x6')]['findIndex'](function(_0x4ad904){return _0x4ad904[_0xdcb7('0x7')]==='motion2';});if(_0x2a96fe>-0x1){var _0x8ed549=_0x3b91f4[_0xdcb7('0x6')][_0x2a96fe];if(typeof _0x8ed549['env']['NODE_PATH']!=='string'){_0x8ed549['env'][_0xdcb7('0x8')]=NODEPATH;_0xe520c0=!![];}}return{'appConfig':_0x3b91f4,'updated':_0xe520c0};}}function updateAppConfig(_0x54babd){return fs['pathExists'](APP_JSON_PATH)[_0xdcb7('0x9')](function(_0x1d3eb4){if(_0x1d3eb4){return fs[_0xdcb7('0xa')](APP_JSON_PATH)[_0xdcb7('0x9')](function(_0x5693d2){var _0x97efdc=setLegacyLibsNodeEnvPath(_0x5693d2);if(_0x97efdc[_0xdcb7('0xb')]){_0x54babd[_0xdcb7('0xc')](_0xdcb7('0xd'));return fs[_0xdcb7('0xe')](APP_JSON_PATH,_0x5693d2,{'spaces':0x2});}else{return Promise[_0xdcb7('0x4')]();}});}else{return Promise[_0xdcb7('0x4')]();}});}module[_0xdcb7('0xf')]=updateAppConfig; \ No newline at end of file